From: support Date: Wed, 21 Sep 2022 23:17:54 +0000 (+0000) Subject: Built motion from commit 19288580.|2.6.15 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=47cd523571d1ef9558f17f3060cace544147062f;p=motion2.git Built motion from commit 19288580.|2.6.15 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index ac3274c..50414a2 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-09-21T22:24:27.084Z", + "time": "2022-09-21T23:09:32.507Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 012dd6b..6104c4b 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-09-21T22:24:27.084Z", + "time": "2022-09-21T23:09:32.507Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 256c064..49da641 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 _0x03f0=['TEXT','urlForward[body]','exports','getDataValue','action','STRING','contactManager','integration','motionbar','urlForward','browser','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]'];(function(_0x48a836,_0xa1d010){var _0x249dc8=function(_0x2a95a0){while(--_0x2a95a0){_0x48a836['push'](_0x48a836['shift']());}};_0x249dc8(++_0xa1d010);}(_0x03f0,0x1b2));var _0x003f=function(_0x4f9d84,_0x3c2d86){_0x4f9d84=_0x4f9d84-0x0;var _0x3567e4=_0x03f0[_0x4f9d84];return _0x3567e4;};'use strict';var Sequelize=require('sequelize');module[_0x003f('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x584498){return this[_0x003f('0x1')](_0x003f('0x2'));}},'action':{'type':Sequelize[_0x003f('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x003f('0x4'),_0x003f('0x5'),_0x003f('0x6'),'jscripty',_0x003f('0x7'),_0x003f('0x8'),'bot','script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x003f('0x9')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x003f('0xa')},'data2':{'type':Sequelize[_0x003f('0x3')](0x1000),'comment':_0x003f('0xb')},'data3':{'type':Sequelize[_0x003f('0x3')](0x1000),'comment':_0x003f('0xc')},'data4':{'type':Sequelize[_0x003f('0x3')](0x1000),'comments':_0x003f('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x003f('0xe')},'data6':{'type':Sequelize[_0x003f('0x3')],'comments':_0x003f('0xf')},'data7':{'type':Sequelize[_0x003f('0x10')],'comments':_0x003f('0x11')}}; \ No newline at end of file +var _0xaa85=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','getDataValue','action','integration','motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','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]'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xaa85,0x70));var _0x5aa8=function(_0x1fc107,_0x178371){_0x1fc107=_0x1fc107-0x0;var _0x59473c=_0xaa85[_0x1fc107];return _0x59473c;};'use strict';var Sequelize=require(_0x5aa8('0x0'));module['exports']={'name':{'type':Sequelize[_0x5aa8('0x1')],'get':function(_0x166dd2){return this[_0x5aa8('0x2')](_0x5aa8('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x5aa8('0x4'),_0x5aa8('0x5'),'jscripty',_0x5aa8('0x6'),_0x5aa8('0x7'),_0x5aa8('0x8'),_0x5aa8('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x5aa8('0xa')},'data1':{'type':Sequelize[_0x5aa8('0xb')](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[_0x5aa8('0xb')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x5aa8('0xb')](0x1000),'comment':_0x5aa8('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x5aa8('0xd')},'data5':{'type':Sequelize[_0x5aa8('0xb')](0x1000),'comments':_0x5aa8('0xe')},'data6':{'type':Sequelize[_0x5aa8('0xb')],'comments':_0x5aa8('0xf')},'data7':{'type':Sequelize[_0x5aa8('0x10')],'comments':_0x5aa8('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 1ced7f2..60c967b 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 _0xe63f=['request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xe63f,0x1be));var _0xfe63=function(_0x4fc259,_0x2ca38d){_0x4fc259=_0x4fc259-0x0;var _0x34f140=_0xe63f[_0x4fc259];return _0x34f140;};'use strict';var emlformat=require(_0xfe63('0x0'));var rimraf=require(_0xfe63('0x1'));var zipdir=require(_0xfe63('0x2'));var jsonpatch=require(_0xfe63('0x3'));var rp=require(_0xfe63('0x4'));var moment=require(_0xfe63('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfe63('0x6'));var util=require(_0xfe63('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfe63('0x8'));var ejs=require(_0xfe63('0x9'));var fs=require('fs');var fs_extra=require(_0xfe63('0xa'));var _=require(_0xfe63('0xb'));var squel=require(_0xfe63('0xc'));var crypto=require('crypto');var jsforce=require(_0xfe63('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfe63('0x8'));var querystring=require('querystring');var Papa=require(_0xfe63('0xe'));var Redis=require('ioredis');var authService=require(_0xfe63('0xf'));var qs=require(_0xfe63('0x10'));var as=require(_0xfe63('0x11'));var hardwareService=require(_0xfe63('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xfe63('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfe63('0x14'));var db=require(_0xfe63('0x15'))['db'];function respondWithStatusCode(_0x3cf0e5,_0x151589){_0x151589=_0x151589||0xcc;return function(_0x168c52){if(_0x168c52){return _0x3cf0e5[_0xfe63('0x16')](_0x151589);}return _0x3cf0e5[_0xfe63('0x17')](_0x151589)[_0xfe63('0x18')]();};}function respondWithResult(_0xbd2a80,_0x1dbd2d){_0x1dbd2d=_0x1dbd2d||0xc8;return function(_0x776b5a){if(_0x776b5a){return _0xbd2a80[_0xfe63('0x17')](_0x1dbd2d)['json'](_0x776b5a);}};}function respondWithFilteredResult(_0x1628e8,_0xf2290b){return function(_0x4844e4){if(_0x4844e4){var _0x3d1603=typeof _0xf2290b[_0xfe63('0x19')]==='undefined'&&typeof _0xf2290b['limit']===_0xfe63('0x1a');var _0x31e332=_0x4844e4[_0xfe63('0x1b')];var _0x35c511=_0x3d1603?0x0:_0xf2290b['offset'];var _0x3bd013=_0x3d1603?_0x4844e4[_0xfe63('0x1b')]:_0xf2290b['offset']+_0xf2290b[_0xfe63('0x1c')];var _0x2ad102;if(_0x3bd013>=_0x31e332){_0x3bd013=_0x31e332;_0x2ad102=0xc8;}else{_0x2ad102=0xce;}_0x1628e8[_0xfe63('0x17')](_0x2ad102);return _0x1628e8[_0xfe63('0x1d')](_0xfe63('0x1e'),_0x35c511+'-'+_0x3bd013+'/'+_0x31e332)['json'](_0x4844e4);}return null;};}function patchUpdates(_0x5eaa47){return function(_0x9ac56d){try{jsonpatch[_0xfe63('0x1f')](_0x9ac56d,_0x5eaa47,!![]);}catch(_0x27a132){return BPromise[_0xfe63('0x20')](_0x27a132);}return _0x9ac56d[_0xfe63('0x21')]();};}function saveUpdates(_0x559f5e,_0x5a4540){return function(_0x94e5a6){if(_0x94e5a6){return _0x94e5a6['update'](_0x559f5e)[_0xfe63('0x22')](function(_0x15f0b6){return _0x15f0b6;});}return null;};}function removeEntity(_0x466b08,_0x16bb5d){return function(_0x43578c){if(_0x43578c){return _0x43578c[_0xfe63('0x23')]()[_0xfe63('0x22')](function(){_0x466b08[_0xfe63('0x17')](0xcc)[_0xfe63('0x18')]();});}};}function handleEntityNotFound(_0x102a2b,_0x1a698d){return function(_0x1574e8){if(!_0x1574e8){_0x102a2b['sendStatus'](0x194);}return _0x1574e8;};}function handleError(_0x5edf03,_0x5bda77){_0x5bda77=_0x5bda77||0x1f4;return function(_0x1854e2){logger['error'](_0x1854e2[_0xfe63('0x24')]);if(_0x1854e2[_0xfe63('0x25')]){delete _0x1854e2[_0xfe63('0x25')];}_0x5edf03[_0xfe63('0x17')](_0x5bda77)[_0xfe63('0x26')](_0x1854e2);};}exports[_0xfe63('0x27')]=function(_0x369718,_0x3bf448){if(_0x369718['body']['id']){delete _0x369718[_0xfe63('0x28')]['id'];}return db[_0xfe63('0x29')][_0xfe63('0x2a')]({'where':{'id':_0x369718[_0xfe63('0x2b')]['id']}})[_0xfe63('0x22')](handleEntityNotFound(_0x3bf448,null))['then'](saveUpdates(_0x369718[_0xfe63('0x28')],null))['then'](respondWithResult(_0x3bf448,null))[_0xfe63('0x2c')](handleError(_0x3bf448,null));};exports[_0xfe63('0x23')]=function(_0x2d2d72,_0x35b2d9){return db[_0xfe63('0x29')][_0xfe63('0x2a')]({'where':{'id':_0x2d2d72[_0xfe63('0x2b')]['id']}})[_0xfe63('0x22')](handleEntityNotFound(_0x35b2d9,null))[_0xfe63('0x22')](removeEntity(_0x35b2d9,null))[_0xfe63('0x2c')](handleError(_0x35b2d9,null));}; \ No newline at end of file +var _0x7610=['stack','name','send','update','body','find','params','catch','Action','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error'];(function(_0x375072,_0x1ad2ed){var _0x3e82e7=function(_0x2a03ec){while(--_0x2a03ec){_0x375072['push'](_0x375072['shift']());}};_0x3e82e7(++_0x1ad2ed);}(_0x7610,0x13b));var _0x0761=function(_0x2727a4,_0x5c63f7){_0x2727a4=_0x2727a4-0x0;var _0x1400a3=_0x7610[_0x2727a4];return _0x1400a3;};'use strict';var emlformat=require(_0x0761('0x0'));var rimraf=require(_0x0761('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0761('0x2'));var rp=require('request-promise');var moment=require(_0x0761('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0761('0x4'));var util=require(_0x0761('0x5'));var path=require('path');var sox=require(_0x0761('0x6'));var csv=require(_0x0761('0x7'));var ejs=require(_0x0761('0x8'));var fs=require('fs');var fs_extra=require(_0x0761('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0761('0xa'));var jsforce=require(_0x0761('0xb'));var deskjs=require(_0x0761('0xc'));var toCsv=require(_0x0761('0x7'));var querystring=require(_0x0761('0xd'));var Papa=require(_0x0761('0xe'));var Redis=require(_0x0761('0xf'));var authService=require(_0x0761('0x10'));var qs=require(_0x0761('0x11'));var as=require(_0x0761('0x12'));var hardwareService=require(_0x0761('0x13'));var logger=require(_0x0761('0x14'))(_0x0761('0x15'));var utils=require(_0x0761('0x16'));var config=require(_0x0761('0x17'));var licenseUtil=require(_0x0761('0x18'));var db=require(_0x0761('0x19'))['db'];function respondWithStatusCode(_0x5a1798,_0x4aa74b){_0x4aa74b=_0x4aa74b||0xcc;return function(_0x4a27d6){if(_0x4a27d6){return _0x5a1798[_0x0761('0x1a')](_0x4aa74b);}return _0x5a1798[_0x0761('0x1b')](_0x4aa74b)['end']();};}function respondWithResult(_0x156aff,_0x143db6){_0x143db6=_0x143db6||0xc8;return function(_0x8756bf){if(_0x8756bf){return _0x156aff[_0x0761('0x1b')](_0x143db6)[_0x0761('0x1c')](_0x8756bf);}};}function respondWithFilteredResult(_0x1fb171,_0x2086c4){return function(_0x3886fa){if(_0x3886fa){var _0x1e034f=typeof _0x2086c4[_0x0761('0x1d')]===_0x0761('0x1e')&&typeof _0x2086c4[_0x0761('0x1f')]===_0x0761('0x1e');var _0x21c55a=_0x3886fa[_0x0761('0x20')];var _0x15a2fa=_0x1e034f?0x0:_0x2086c4[_0x0761('0x1d')];var _0x948b65=_0x1e034f?_0x3886fa[_0x0761('0x20')]:_0x2086c4['offset']+_0x2086c4[_0x0761('0x1f')];var _0x1ab425;if(_0x948b65>=_0x21c55a){_0x948b65=_0x21c55a;_0x1ab425=0xc8;}else{_0x1ab425=0xce;}_0x1fb171[_0x0761('0x1b')](_0x1ab425);return _0x1fb171[_0x0761('0x21')](_0x0761('0x22'),_0x15a2fa+'-'+_0x948b65+'/'+_0x21c55a)[_0x0761('0x1c')](_0x3886fa);}return null;};}function patchUpdates(_0x2fd073){return function(_0x23da14){try{jsonpatch[_0x0761('0x23')](_0x23da14,_0x2fd073,!![]);}catch(_0x5e3362){return BPromise[_0x0761('0x24')](_0x5e3362);}return _0x23da14[_0x0761('0x25')]();};}function saveUpdates(_0x39f003,_0x3fa171){return function(_0x1733bf){if(_0x1733bf){return _0x1733bf['update'](_0x39f003)[_0x0761('0x26')](function(_0x580449){return _0x580449;});}return null;};}function removeEntity(_0x6593dc,_0x415dbc){return function(_0x59a6db){if(_0x59a6db){return _0x59a6db[_0x0761('0x27')]()[_0x0761('0x26')](function(){_0x6593dc[_0x0761('0x1b')](0xcc)[_0x0761('0x28')]();});}};}function handleEntityNotFound(_0x23a44a,_0x26d9c7){return function(_0x320b7c){if(!_0x320b7c){_0x23a44a[_0x0761('0x1a')](0x194);}return _0x320b7c;};}function handleError(_0x5a554c,_0x1f526a){_0x1f526a=_0x1f526a||0x1f4;return function(_0x28cdcd){logger[_0x0761('0x29')](_0x28cdcd[_0x0761('0x2a')]);if(_0x28cdcd[_0x0761('0x2b')]){delete _0x28cdcd[_0x0761('0x2b')];}_0x5a554c['status'](_0x1f526a)[_0x0761('0x2c')](_0x28cdcd);};}exports[_0x0761('0x2d')]=function(_0x3387c9,_0x1f1f70){if(_0x3387c9['body']['id']){delete _0x3387c9[_0x0761('0x2e')]['id'];}return db['Action'][_0x0761('0x2f')]({'where':{'id':_0x3387c9[_0x0761('0x30')]['id']}})[_0x0761('0x26')](handleEntityNotFound(_0x1f1f70,null))['then'](saveUpdates(_0x3387c9[_0x0761('0x2e')],null))[_0x0761('0x26')](respondWithResult(_0x1f1f70,null))[_0x0761('0x31')](handleError(_0x1f1f70,null));};exports[_0x0761('0x27')]=function(_0x3a72a7,_0x3ecc03){return db[_0x0761('0x32')][_0x0761('0x2f')]({'where':{'id':_0x3a72a7[_0x0761('0x30')]['id']}})['then'](handleEntityNotFound(_0x3ecc03,null))[_0x0761('0x26')](removeEntity(_0x3ecc03,null))[_0x0761('0x31')](handleError(_0x3ecc03,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 889ec0f..fe1df55 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 _0x00bf=['moment','path','rimraf','../../config/environment','./action.attributes','exports','Action','util','../../config/logger','api'];(function(_0x44d17d,_0x1b8590){var _0x5da69c=function(_0x23b094){while(--_0x23b094){_0x44d17d['push'](_0x44d17d['shift']());}};_0x5da69c(++_0x1b8590);}(_0x00bf,0x7f));var _0xf00b=function(_0x1a81c4,_0x55fe60){_0x1a81c4=_0x1a81c4-0x0;var _0x1dbb26=_0x00bf[_0x1a81c4];return _0x1dbb26;};'use strict';var _=require('lodash');var util=require(_0xf00b('0x0'));var logger=require(_0xf00b('0x1'))(_0xf00b('0x2'));var moment=require(_0xf00b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf00b('0x4'));var rimraf=require(_0xf00b('0x5'));var config=require(_0xf00b('0x6'));var attributes=require(_0xf00b('0x7'));module[_0xf00b('0x8')]=function(_0x55fbec,_0x257029){return _0x55fbec['define'](_0xf00b('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf266=['lodash','util','api','moment','path','rimraf','./action.attributes','exports','Action','tools_actions'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xf266,0x10e));var _0x6f26=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xf266[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x6f26('0x0'));var util=require(_0x6f26('0x1'));var logger=require('../../config/logger')(_0x6f26('0x2'));var moment=require(_0x6f26('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f26('0x4'));var rimraf=require(_0x6f26('0x5'));var config=require('../../config/environment');var attributes=require(_0x6f26('0x6'));module[_0x6f26('0x7')]=function(_0xd9206,_0x112f23){return _0xd9206['define'](_0x6f26('0x8'),attributes,{'tableName':_0x6f26('0x9'),'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 e81e036..513fe1e 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 _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x814b,0x1a2));var _0xb814=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0x814b[_0x5a7618];return _0x12dc65;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x178943,_0x5d1e44){var _0x2fdba5=function(_0x5cd1e2){while(--_0x5cd1e2){_0x178943['push'](_0x178943['shift']());}};_0x2fdba5(++_0x5d1e44);}(_0x5fc3,0xa8));var _0x35fc=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x5fc3[_0x135904];return _0x1ce7d5;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 8e413fe..04261aa 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 _0x3fff=['destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete'];(function(_0x339c69,_0x5bcd5c){var _0x372d92=function(_0x593aaf){while(--_0x593aaf){_0x339c69['push'](_0x339c69['shift']());}};_0x372d92(++_0x5bcd5c);}(_0x3fff,0x16e));var _0xf3ff=function(_0x4fef08,_0x4c98c7){_0x4fef08=_0x4fef08-0x0;var _0x1bde5d=_0x3fff[_0x4fef08];return _0x1bde5d;};'use strict';var multer=require('multer');var util=require(_0xf3ff('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf3ff('0x1'));var router=express[_0xf3ff('0x2')]();var fs_extra=require(_0xf3ff('0x3'));var auth=require(_0xf3ff('0x4'));var interaction=require(_0xf3ff('0x5'));var config=require(_0xf3ff('0x6'));var controller=require(_0xf3ff('0x7'));router['put'](_0xf3ff('0x8'),auth[_0xf3ff('0x9')](),controller[_0xf3ff('0xa')]);router[_0xf3ff('0xb')](_0xf3ff('0x8'),auth[_0xf3ff('0x9')](),controller[_0xf3ff('0xc')]);module[_0xf3ff('0xd')]=router; \ No newline at end of file +var _0x640f=['/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete'];(function(_0x41d863,_0x37ea0c){var _0x20a17c=function(_0x4ae74d){while(--_0x4ae74d){_0x41d863['push'](_0x41d863['shift']());}};_0x20a17c(++_0x37ea0c);}(_0x640f,0x153));var _0xf640=function(_0x272720,_0x4ca775){_0x272720=_0x272720-0x0;var _0x4a630b=_0x640f[_0x272720];return _0x4a630b;};'use strict';var multer=require(_0xf640('0x0'));var util=require('util');var path=require(_0xf640('0x1'));var timeout=require(_0xf640('0x2'));var express=require(_0xf640('0x3'));var router=express['Router']();var fs_extra=require(_0xf640('0x4'));var auth=require(_0xf640('0x5'));var interaction=require(_0xf640('0x6'));var config=require(_0xf640('0x7'));var controller=require(_0xf640('0x8'));router[_0xf640('0x9')]('/:id',auth[_0xf640('0xa')](),controller[_0xf640('0xb')]);router[_0xf640('0xc')](_0xf640('0xd'),auth[_0xf640('0xa')](),controller[_0xf640('0xe')]);module[_0xf640('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index b5b65cb..fadf7c6 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 _0x8958=['TEXT','exports'];(function(_0x8c0bf5,_0x2456ab){var _0x447387=function(_0x4c2469){while(--_0x4c2469){_0x8c0bf5['push'](_0x8c0bf5['shift']());}};_0x447387(++_0x2456ab);}(_0x8958,0x93));var _0x8895=function(_0x4f454c,_0x3ef3b8){_0x4f454c=_0x4f454c-0x0;var _0x3152dc=_0x8958[_0x4f454c];return _0x3152dc;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8895('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x6d97b2,_0x3c1332){_0x6d97b2=_0x6d97b2-0x0;var _0x514465=_0xfdbd[_0x6d97b2];return _0x514465;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 00150bc..d47ee65 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 _0xa849=['type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','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)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','MIN(%s)','AVG(%s)','SEC_TO_TIME(%s)','DATE(%s)','Sequelize','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','SELECT','run','value','from','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','CustomReports','UserProfileResource','error','stack','name','index','AnalyticCustomReport','rawAttributes'];(function(_0x533110,_0x20937f){var _0xc3c866=function(_0x2d4a68){while(--_0x2d4a68){_0x533110['push'](_0x533110['shift']());}};_0xc3c866(++_0x20937f);}(_0xa849,0x11f));var _0x9a84=function(_0xc9af76,_0x385384){_0xc9af76=_0xc9af76-0x0;var _0x35b5d6=_0xa849[_0xc9af76];return _0x35b5d6;};'use strict';var emlformat=require(_0x9a84('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a84('0x1'));var jsonpatch=require(_0x9a84('0x2'));var rp=require('request-promise');var moment=require(_0x9a84('0x3'));var BPromise=require(_0x9a84('0x4'));var Mustache=require(_0x9a84('0x5'));var util=require(_0x9a84('0x6'));var path=require(_0x9a84('0x7'));var sox=require(_0x9a84('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a84('0x9'));var _=require('lodash');var squel=require(_0x9a84('0xa'));var crypto=require(_0x9a84('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9a84('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9a84('0xd'));var Papa=require(_0x9a84('0xe'));var Redis=require(_0x9a84('0xf'));var authService=require(_0x9a84('0x10'));var qs=require(_0x9a84('0x11'));var as=require(_0x9a84('0x12'));var hardwareService=require(_0x9a84('0x13'));var logger=require('../../config/logger')(_0x9a84('0x14'));var utils=require(_0x9a84('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9a84('0x16'));var db=require(_0x9a84('0x17'))['db'];var dbH=require('../../mysqldb')[_0x9a84('0x18')];function respondWithStatusCode(_0x565cab,_0x1f1d3e){_0x1f1d3e=_0x1f1d3e||0xcc;return function(_0x26688d){if(_0x26688d){return _0x565cab[_0x9a84('0x19')](_0x1f1d3e);}return _0x565cab[_0x9a84('0x1a')](_0x1f1d3e)[_0x9a84('0x1b')]();};}function respondWithResult(_0x1142ec,_0x585ef5){_0x585ef5=_0x585ef5||0xc8;return function(_0x5e334d){if(_0x5e334d){return _0x1142ec[_0x9a84('0x1a')](_0x585ef5)[_0x9a84('0x1c')](_0x5e334d);}};}function respondWithFilteredResult(_0x2fc452,_0x2f6652){return function(_0xdc5b7){if(_0xdc5b7){var _0xc780ba=typeof _0x2f6652[_0x9a84('0x1d')]===_0x9a84('0x1e')&&typeof _0x2f6652['limit']==='undefined';var _0x444ebc=_0xdc5b7[_0x9a84('0x1f')];var _0x23a742=_0xc780ba?0x0:_0x2f6652[_0x9a84('0x1d')];var _0x1c7ebc=_0xc780ba?_0xdc5b7[_0x9a84('0x1f')]:_0x2f6652['offset']+_0x2f6652[_0x9a84('0x20')];var _0x507404;if(_0x1c7ebc>=_0x444ebc){_0x1c7ebc=_0x444ebc;_0x507404=0xc8;}else{_0x507404=0xce;}_0x2fc452[_0x9a84('0x1a')](_0x507404);return _0x2fc452[_0x9a84('0x21')](_0x9a84('0x22'),_0x23a742+'-'+_0x1c7ebc+'/'+_0x444ebc)['json'](_0xdc5b7);}return null;};}function patchUpdates(_0x46e92a){return function(_0x20002a){try{jsonpatch[_0x9a84('0x23')](_0x20002a,_0x46e92a,!![]);}catch(_0x2ef3a3){return BPromise['reject'](_0x2ef3a3);}return _0x20002a['save']();};}function saveUpdates(_0x427afc,_0x3fdfa1){return function(_0x12aa8c){if(_0x12aa8c){return _0x12aa8c[_0x9a84('0x24')](_0x427afc)['then'](function(_0x3fc046){return _0x3fc046;});}return null;};}function removeEntity(_0x5cc9e6,_0x43208a){return function(_0x50734e){if(_0x50734e){return _0x50734e[_0x9a84('0x25')]()[_0x9a84('0x26')](function(){var _0x38de5a=_0x50734e['get']({'plain':!![]});var _0x236ac5=_0x9a84('0x27');return db[_0x9a84('0x28')][_0x9a84('0x25')]({'where':{'type':_0x236ac5,'resourceId':_0x38de5a['id']}})[_0x9a84('0x26')](function(){return _0x50734e;});})['then'](function(){_0x5cc9e6['status'](0xcc)[_0x9a84('0x1b')]();});}};}function handleEntityNotFound(_0x547d87,_0x434c50){return function(_0x41ce2f){if(!_0x41ce2f){_0x547d87[_0x9a84('0x19')](0x194);}return _0x41ce2f;};}function handleError(_0x4e90de,_0x270c0e){_0x270c0e=_0x270c0e||0x1f4;return function(_0x164782){logger[_0x9a84('0x29')](_0x164782[_0x9a84('0x2a')]);if(_0x164782[_0x9a84('0x2b')]){delete _0x164782[_0x9a84('0x2b')];}_0x4e90de[_0x9a84('0x1a')](_0x270c0e)['send'](_0x164782);};}exports[_0x9a84('0x2c')]=function(_0x35b3d5,_0x320bf5){var _0x443638={},_0x4850b9={},_0x25ee73={'count':0x0,'rows':[]};var _0x256e5f=_['map'](db[_0x9a84('0x2d')][_0x9a84('0x2e')],function(_0x494ad6){return{'name':_0x494ad6['fieldName'],'type':_0x494ad6[_0x9a84('0x2f')][_0x9a84('0x30')]};});_0x4850b9[_0x9a84('0x31')]=_[_0x9a84('0x32')](_0x256e5f,_0x9a84('0x2b'));_0x4850b9[_0x9a84('0x33')]=_[_0x9a84('0x34')](_0x35b3d5[_0x9a84('0x33')]);_0x4850b9[_0x9a84('0x35')]=_[_0x9a84('0x36')](_0x4850b9[_0x9a84('0x31')],_0x4850b9[_0x9a84('0x33')]);_0x443638[_0x9a84('0x37')]=_[_0x9a84('0x36')](_0x4850b9[_0x9a84('0x31')],qs[_0x9a84('0x38')](_0x35b3d5['query'][_0x9a84('0x38')]));_0x443638[_0x9a84('0x37')]=_0x443638[_0x9a84('0x37')][_0x9a84('0x39')]?_0x443638[_0x9a84('0x37')]:_0x4850b9['model'];if(!_0x35b3d5['query'][_0x9a84('0x3a')](_0x9a84('0x3b'))){_0x443638[_0x9a84('0x20')]=qs[_0x9a84('0x20')](_0x35b3d5['query'][_0x9a84('0x20')]);_0x443638[_0x9a84('0x1d')]=qs[_0x9a84('0x1d')](_0x35b3d5[_0x9a84('0x33')][_0x9a84('0x1d')]);}_0x443638['order']=qs[_0x9a84('0x3c')](_0x35b3d5['query'][_0x9a84('0x3c')]);_0x443638[_0x9a84('0x3d')]=qs[_0x9a84('0x35')](_[_0x9a84('0x3e')](_0x35b3d5[_0x9a84('0x33')],_0x4850b9['filters']),_0x256e5f);if(_0x35b3d5[_0x9a84('0x33')][_0x9a84('0x3f')]){_0x443638['where']=_[_0x9a84('0x40')](_0x443638[_0x9a84('0x3d')],{'$or':_['map'](_0x256e5f,function(_0x2bfe38){if(_0x2bfe38[_0x9a84('0x2f')]!==_0x9a84('0x41')){var _0x2bd77f={};_0x2bd77f[_0x2bfe38[_0x9a84('0x2b')]]={'$like':'%'+_0x35b3d5[_0x9a84('0x33')][_0x9a84('0x3f')]+'%'};return _0x2bd77f;}})});}_0x443638=_['merge']({},_0x443638,_0x35b3d5['options']);var _0x4786b8={'where':_0x443638[_0x9a84('0x3d')]};return db[_0x9a84('0x2d')][_0x9a84('0x1f')](_0x4786b8)[_0x9a84('0x26')](function(_0x482cf5){_0x25ee73[_0x9a84('0x1f')]=_0x482cf5;if(_0x35b3d5[_0x9a84('0x33')][_0x9a84('0x42')]){_0x443638[_0x9a84('0x43')]=[{'all':!![]}];}return db[_0x9a84('0x2d')][_0x9a84('0x44')](_0x443638);})[_0x9a84('0x26')](function(_0x432629){_0x25ee73['rows']=_0x432629;return _0x25ee73;})[_0x9a84('0x26')](respondWithFilteredResult(_0x320bf5,_0x443638))[_0x9a84('0x45')](handleError(_0x320bf5,null));};exports[_0x9a84('0x46')]=function(_0x1e021e,_0x297bb2){var _0x29d410={'raw':![],'where':{'id':_0x1e021e[_0x9a84('0x47')]['id']}},_0x1f1370={};_0x1f1370[_0x9a84('0x31')]=_['keys'](db[_0x9a84('0x2d')][_0x9a84('0x2e')]);_0x1f1370[_0x9a84('0x33')]=_[_0x9a84('0x34')](_0x1e021e[_0x9a84('0x33')]);_0x1f1370['filters']=_['intersection'](_0x1f1370[_0x9a84('0x31')],_0x1f1370[_0x9a84('0x33')]);_0x29d410[_0x9a84('0x37')]=_['intersection'](_0x1f1370[_0x9a84('0x31')],qs[_0x9a84('0x38')](_0x1e021e[_0x9a84('0x33')][_0x9a84('0x38')]));_0x29d410['attributes']=_0x29d410['attributes'][_0x9a84('0x39')]?_0x29d410[_0x9a84('0x37')]:_0x1f1370[_0x9a84('0x31')];if(_0x1e021e['query'][_0x9a84('0x42')]){_0x29d410['include']=[{'all':!![]}];}_0x29d410=_['merge']({},_0x29d410,_0x1e021e[_0x9a84('0x48')]);return db['AnalyticCustomReport']['find'](_0x29d410)[_0x9a84('0x26')](handleEntityNotFound(_0x297bb2,null))[_0x9a84('0x26')](respondWithResult(_0x297bb2,null))[_0x9a84('0x45')](handleError(_0x297bb2,null));};exports[_0x9a84('0x49')]=function(_0xe80e0c,_0x283b8c){return db[_0x9a84('0x2d')]['create'](_0xe80e0c['body'],{})['then'](function(_0xff6373){var _0x5db644=_0xe80e0c[_0x9a84('0x4a')][_0x9a84('0x4b')]({'plain':!![]});if(!_0x5db644)throw new Error(_0x9a84('0x4c'));if(_0x5db644[_0x9a84('0x4d')]===_0x9a84('0x4a')){var _0x2d9d44=_0xff6373['get']({'plain':!![]});var _0x314f47=_0x9a84('0x4e');return db[_0x9a84('0x4f')][_0x9a84('0x50')]({'where':{'name':_0x314f47,'userProfileId':_0x5db644[_0x9a84('0x51')]},'raw':!![]})[_0x9a84('0x26')](function(_0x11a5d7){if(_0x11a5d7&&_0x11a5d7[_0x9a84('0x52')]===0x0){return db[_0x9a84('0x28')]['create']({'name':_0x2d9d44['name'],'resourceId':_0x2d9d44['id'],'type':_0x9a84('0x27'),'sectionId':_0x11a5d7['id']},{})[_0x9a84('0x26')](function(){return _0xff6373;});}else{return _0xff6373;}})[_0x9a84('0x45')](function(_0x4d98bd){logger['error'](_0x9a84('0x53'),_0x4d98bd);throw _0x4d98bd;});}return _0xff6373;})[_0x9a84('0x26')](respondWithResult(_0x283b8c,0xc9))[_0x9a84('0x45')](handleError(_0x283b8c,null));};exports['update']=function(_0x2e43d2,_0x13ff9e){if(_0x2e43d2[_0x9a84('0x54')]['id']){delete _0x2e43d2[_0x9a84('0x54')]['id'];}return db[_0x9a84('0x2d')][_0x9a84('0x50')]({'where':{'id':_0x2e43d2[_0x9a84('0x47')]['id']}})[_0x9a84('0x26')](handleEntityNotFound(_0x13ff9e,null))[_0x9a84('0x26')](saveUpdates(_0x2e43d2[_0x9a84('0x54')],null))[_0x9a84('0x26')](respondWithResult(_0x13ff9e,null))[_0x9a84('0x45')](handleError(_0x13ff9e,null));};exports[_0x9a84('0x25')]=function(_0xf25ef5,_0x157520){return db['AnalyticCustomReport'][_0x9a84('0x50')]({'where':{'id':_0xf25ef5[_0x9a84('0x47')]['id']}})[_0x9a84('0x26')](handleEntityNotFound(_0x157520,null))[_0x9a84('0x26')](removeEntity(_0x157520,null))[_0x9a84('0x45')](handleError(_0x157520,null));};exports[_0x9a84('0x55')]=function(_0x1eaeab,_0x1096d0){var _0x223805=0xa;var _0x5ef115=[_0x9a84('0x56'),_0x9a84('0x57'),_0x9a84('0x58'),_0x9a84('0x59')];var _0x2a7195={'SUM':_0x9a84('0x5a'),'COUNT':_0x9a84('0x5b'),'COUNT DISTINCT':_0x9a84('0x5c'),'MAX':_0x9a84('0x5d'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x9a84('0x5e'),'GROUP_CONCAT ASC':_0x9a84('0x5f'),'GROUP_CONCAT DESC':_0x9a84('0x60')};var _0x58f31f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x9a84('0x61'),'ROUND':_0x9a84('0x62'),'UNIX_TIMESTAMP':_0x9a84('0x63')};var _0x470842=function(_0x26ddf7){return!_[_0x9a84('0x64')]([_0x9a84('0x65'),_0x9a84('0x66'),_0x9a84('0x67'),_0x9a84('0x68')],_0x26ddf7);};var _0x30b4c8=function(_0xa8e22e){if(!_0xa8e22e||!_0xa8e22e[_0x9a84('0x69')]['length']){return'';}for(var _0x1acf1a='(',_0x22aa9=0x0;_0x22aa9<_0xa8e22e[_0x9a84('0x69')][_0x9a84('0x39')];_0x22aa9+=0x1){_0x22aa9>0x0&&(_0x1acf1a+='\x20'+_0xa8e22e[_0x9a84('0x6a')]+'\x20');_0x1acf1a+=_0xa8e22e['rules'][_0x22aa9][_0x9a84('0x6b')]?_0x30b4c8(_0xa8e22e[_0x9a84('0x69')][_0x22aa9][_0x9a84('0x6b')]):_0xa8e22e[_0x9a84('0x69')][_0x22aa9][_0x9a84('0x6c')]+'\x20'+_0xa8e22e[_0x9a84('0x69')][_0x22aa9][_0x9a84('0x6d')]+(_0x470842(_0xa8e22e[_0x9a84('0x69')][_0x22aa9][_0x9a84('0x6d')])?'\x20'+_0xa8e22e['rules'][_0x22aa9]['value']:'');}return _0x1acf1a+')';};var _0x4f08aa={'where':{'id':_0x1eaeab['params']['id']}},_0x1b0af3,_0x1540cc,_0x31958d,_0x5add03,_0x614ef7;_0x4f08aa=_[_0x9a84('0x40')]({},_0x4f08aa,_0x1eaeab[_0x9a84('0x48')]);return db[_0x9a84('0x2d')][_0x9a84('0x50')](_0x4f08aa)[_0x9a84('0x26')](function(_0x25bf26){if(_0x25bf26){_0x1b0af3=_0x25bf26;return _0x25bf26[_0x9a84('0x6e')]();}return null;})[_0x9a84('0x26')](function(_0x83abca){if(_0x83abca){if(!_0x83abca[_0x9a84('0x39')]){throw new db['Sequelize'][(_0x9a84('0x6f'))](_0x9a84('0x70'),0x193);}_0x1540cc=_0x83abca;return db['AnalyticMetric'][_0x9a84('0x44')]({'raw':!![]});}return null;})['then'](function(_0x1196ff){if(_0x1196ff){_0x31958d=_[_0x9a84('0x71')](_0x1196ff,'id');var _0x5775d4;var _0x3f86e5=squel[_0x9a84('0x72')]();_0x3f86e5['from'](_0x1b0af3[_0x9a84('0x73')]);for(var _0x4697b9=0x0;_0x4697b9<_0x1540cc['length'];_0x4697b9+=0x1){_0x5775d4=_0x1540cc[_0x4697b9][_0x9a84('0x74')]?_0x31958d[_0x1540cc[_0x4697b9][_0x9a84('0x74')]][_0x9a84('0x75')]:_0x1540cc[_0x4697b9][_0x9a84('0x6c')];_0x5775d4=_0x1540cc[_0x4697b9][_0x9a84('0x76')]?_[_0x9a84('0x77')](_0x2a7195[_0x1540cc[_0x4697b9]['function']],'%s',_0x5775d4):_0x5775d4;_0x5775d4=_0x1540cc[_0x4697b9][_0x9a84('0x78')]?_['replace'](_0x58f31f[_0x1540cc[_0x4697b9]['format']],'%s',_0x5775d4):_0x5775d4;if(_0x1540cc[_0x4697b9][_0x9a84('0x79')]){_0x3f86e5['group'](_0x5775d4);}_0x1540cc[_0x4697b9][_0x9a84('0x7a')]&&_0x3f86e5[_0x9a84('0x7b')](_0x5775d4,_0x1540cc[_0x4697b9][_0x9a84('0x7a')]===_0x9a84('0x7c')?![]:!![]);_0x3f86e5['field'](_0x5775d4,_0x1540cc[_0x4697b9][_0x9a84('0x7d')]||_0x5775d4);}if(_0x1b0af3['joins']){_0x1b0af3[_0x9a84('0x7e')]=JSON[_0x9a84('0x7f')](_0x1b0af3[_0x9a84('0x7e')]);for(var _0x12ec8a=0x0;_0x12ec8a<_0x1b0af3[_0x9a84('0x7e')]['length'];_0x12ec8a+=0x1){if(_0x1b0af3['joins'][_0x12ec8a][_0x9a84('0x2f')]&&_[_0x9a84('0x64')](_0x5ef115,_0x1b0af3[_0x9a84('0x7e')][_0x12ec8a][_0x9a84('0x2f')])&&_0x1b0af3[_0x9a84('0x7e')][_0x12ec8a][_0x9a84('0x80')]&&_0x1b0af3[_0x9a84('0x7e')][_0x12ec8a]['foreignTable']&&_0x1b0af3[_0x9a84('0x7e')][_0x12ec8a][_0x9a84('0x81')]){_0x3f86e5[_0x1b0af3[_0x9a84('0x7e')][_0x12ec8a][_0x9a84('0x2f')]](_0x1b0af3[_0x9a84('0x7e')][_0x12ec8a][_0x9a84('0x82')],null,util[_0x9a84('0x78')](_0x9a84('0x83'),_0x1b0af3[_0x9a84('0x73')],_0x1b0af3['joins'][_0x12ec8a][_0x9a84('0x80')],_0x1b0af3[_0x9a84('0x7e')][_0x12ec8a][_0x9a84('0x82')],_0x1b0af3[_0x9a84('0x7e')][_0x12ec8a][_0x9a84('0x81')]));}}}if(_0x1b0af3[_0x9a84('0x84')]){_0x1b0af3[_0x9a84('0x84')]=JSON['parse'](_0x1b0af3[_0x9a84('0x84')]);_0x3f86e5['where'](_0x30b4c8(_0x1b0af3[_0x9a84('0x84')]['group']));}_0x614ef7=_0x3f86e5[_0x9a84('0x85')]();_0x3f86e5[_0x9a84('0x20')](_0x223805);_0x3f86e5[_0x9a84('0x1d')](0x0);logger[_0x9a84('0x86')](_0x9a84('0x87'),_0x3f86e5[_0x9a84('0x88')]());return dbH[_0x9a84('0x89')][_0x9a84('0x33')](_0x3f86e5[_0x9a84('0x88')](),{'type':dbH['sequelize'][_0x9a84('0x8a')]['SELECT']});}})[_0x9a84('0x26')](respondWithResult(_0x1096d0,null))[_0x9a84('0x45')](handleError(_0x1096d0,null));};function runReport(_0x3c32c9,_0x27e1fa,_0x4a12ad){var _0x41551e=_0x27e1fa[_0x9a84('0x2b')];var _0x4b2d28=0xa;var _0x56edc3=[_0x9a84('0x56'),_0x9a84('0x57'),_0x9a84('0x58'),_0x9a84('0x59')];var _0x546705={'SUM':_0x9a84('0x5a'),'COUNT':_0x9a84('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9a84('0x5d'),'MIN':_0x9a84('0x8b'),'AVG':_0x9a84('0x8c'),'GROUP_CONCAT':_0x9a84('0x5e'),'GROUP_CONCAT ASC':_0x9a84('0x5f'),'GROUP_CONCAT DESC':_0x9a84('0x60')};var _0x20b986={'SEC_TO_TIME':_0x9a84('0x8d'),'DATE':_0x9a84('0x8e'),'HOUR':_0x9a84('0x61'),'ROUND':_0x9a84('0x62'),'UNIX_TIMESTAMP':_0x9a84('0x63')};var _0x36b53e=function(_0x229c0c){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x9a84('0x68')],_0x229c0c);};var _0x3b26fa=function(_0x25f0ef){if(!_0x25f0ef||!_0x25f0ef['rules'][_0x9a84('0x39')]){return'';}for(var _0x17af6b='(',_0x25fc9f=0x0;_0x25fc9f<_0x25f0ef[_0x9a84('0x69')][_0x9a84('0x39')];_0x25fc9f+=0x1){_0x25fc9f>0x0&&(_0x17af6b+='\x20'+_0x25f0ef[_0x9a84('0x6a')]+'\x20');_0x17af6b+=_0x25f0ef[_0x9a84('0x69')][_0x25fc9f][_0x9a84('0x6b')]?_0x3b26fa(_0x25f0ef[_0x9a84('0x69')][_0x25fc9f]['group']):_0x25f0ef['rules'][_0x25fc9f][_0x9a84('0x6c')]+'\x20'+_0x25f0ef[_0x9a84('0x69')][_0x25fc9f][_0x9a84('0x6d')]+(_0x36b53e(_0x25f0ef['rules'][_0x25fc9f][_0x9a84('0x6d')])?'\x20'+_0x25f0ef[_0x9a84('0x69')][_0x25fc9f]['value']:'');}return _0x17af6b+')';};var _0x291a36={'where':{'id':_0x3c32c9['id']}},_0x5e4e29,_0x3de8e3,_0x1148f1,_0x1c6be2,_0x112884;_0x291a36=_[_0x9a84('0x40')]({},_0x291a36,_0x4a12ad);return db[_0x9a84('0x2d')][_0x9a84('0x50')](_0x291a36)[_0x9a84('0x26')](function(_0x510665){if(_0x510665){_0x5e4e29=_0x510665;return _0x510665[_0x9a84('0x6e')]();}return null;})['then'](function(_0x295b8a){if(_0x295b8a){if(!_0x295b8a['length']){throw new db[(_0x9a84('0x8f'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3de8e3=_0x295b8a;return db['AnalyticMetric'][_0x9a84('0x44')]({'raw':!![]});}return null;})[_0x9a84('0x26')](function(_0x336772){if(_0x336772){_0x1148f1=_[_0x9a84('0x71')](_0x336772,'id');var _0x24f3ae;var _0x121016=squel[_0x9a84('0x72')]();_0x121016['from'](_0x5e4e29[_0x9a84('0x73')]);for(var _0x257ef1=0x0;_0x257ef1<_0x3de8e3[_0x9a84('0x39')];_0x257ef1+=0x1){_0x24f3ae=_0x3de8e3[_0x257ef1][_0x9a84('0x74')]?_0x1148f1[_0x3de8e3[_0x257ef1][_0x9a84('0x74')]][_0x9a84('0x75')]:_0x3de8e3[_0x257ef1]['field'];_0x24f3ae=_0x3de8e3[_0x257ef1][_0x9a84('0x76')]?_[_0x9a84('0x77')](_0x546705[_0x3de8e3[_0x257ef1][_0x9a84('0x76')]],'%s',_0x24f3ae):_0x24f3ae;_0x24f3ae=_0x3de8e3[_0x257ef1][_0x9a84('0x78')]?_[_0x9a84('0x77')](_0x20b986[_0x3de8e3[_0x257ef1][_0x9a84('0x78')]],'%s',_0x24f3ae):_0x24f3ae;if(_0x3de8e3[_0x257ef1]['groupBy']){_0x121016[_0x9a84('0x6b')](_0x24f3ae);}_0x3de8e3[_0x257ef1][_0x9a84('0x7a')]&&_0x121016[_0x9a84('0x7b')](_0x24f3ae,_0x3de8e3[_0x257ef1]['orderBy']==='DESC'?![]:!![]);_0x121016[_0x9a84('0x6c')](_0x24f3ae,_0x3de8e3[_0x257ef1][_0x9a84('0x7d')]||_0x24f3ae);}if(_0x5e4e29[_0x9a84('0x7e')]){_0x5e4e29['joins']=JSON['parse'](_0x5e4e29[_0x9a84('0x7e')]);for(var _0x58266e=0x0;_0x58266e<_0x5e4e29[_0x9a84('0x7e')][_0x9a84('0x39')];_0x58266e+=0x1){if(_0x5e4e29[_0x9a84('0x7e')][_0x58266e][_0x9a84('0x2f')]&&_[_0x9a84('0x64')](_0x56edc3,_0x5e4e29[_0x9a84('0x7e')][_0x58266e]['type'])&&_0x5e4e29['joins'][_0x58266e][_0x9a84('0x80')]&&_0x5e4e29['joins'][_0x58266e][_0x9a84('0x82')]&&_0x5e4e29['joins'][_0x58266e]['foreignKey']){_0x121016[_0x5e4e29[_0x9a84('0x7e')][_0x58266e][_0x9a84('0x2f')]](_0x5e4e29[_0x9a84('0x7e')][_0x58266e][_0x9a84('0x82')],null,util['format'](_0x9a84('0x83'),_0x5e4e29[_0x9a84('0x73')],_0x5e4e29[_0x9a84('0x7e')][_0x58266e][_0x9a84('0x80')],_0x5e4e29['joins'][_0x58266e][_0x9a84('0x82')],_0x5e4e29[_0x9a84('0x7e')][_0x58266e]['foreignKey']));}}}if(_0x5e4e29['conditions']){_0x5e4e29[_0x9a84('0x84')]=JSON['parse'](_0x5e4e29['conditions']);_0x121016[_0x9a84('0x3d')](_0x3b26fa(_0x5e4e29[_0x9a84('0x84')][_0x9a84('0x6b')]));}_0x112884=_0x121016[_0x9a84('0x85')]();_0x121016[_0x9a84('0x20')](_0x4b2d28);_0x121016[_0x9a84('0x1d')](0x0);return;}})[_0x9a84('0x26')](function(){if(_0x27e1fa[_0x9a84('0x90')]==='web'){return null;}var _0x3c8c4e=_[_0x9a84('0x40')](_0x27e1fa,{'name':_0x27e1fa[_0x9a84('0x91')]||_0x27e1fa[_0x9a84('0x2b')]||_0x5e4e29[_0x9a84('0x2b')],'basename':_0x41551e,'savename':util['format'](_0x9a84('0x92'),_0x27e1fa['name']||_0x5e4e29['name'],require(_0x9a84('0x93'))[_0x9a84('0x94')](0x4),_0x27e1fa[_0x9a84('0x90')]||_0x9a84('0x95')),'reportId':_0x5e4e29['id'],'reportType':_0x9a84('0x96')});return db[_0x9a84('0x97')][_0x9a84('0x49')](_0x3c8c4e,{'raw':!![]});})[_0x9a84('0x26')](function(_0x599ca3){if(_0x5e4e29[_0x9a84('0x73')]===_0x9a84('0x98')){_0x112884[_0x9a84('0x3d')](_0x5e4e29[_0x9a84('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x27e1fa[_0x9a84('0x99')],_0x27e1fa[_0x9a84('0x9a')]);}else{_0x112884[_0x9a84('0x3d')](_0x5e4e29[_0x9a84('0x73')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x27e1fa[_0x9a84('0x99')],_0x27e1fa['endDate']);}if(_0x599ca3){logger[_0x9a84('0x9b')](_0x9a84('0x9c'),_0x112884[_0x9a84('0x88')]());require(_0x9a84('0x9d'))[_0x9a84('0x9e')](path['join'](__dirname,_0x9a84('0x9f'),_0x599ca3['output']),[_0x599ca3['id'],_0x112884[_0x9a84('0x88')](),path[_0x9a84('0x56')](__dirname,_0x9a84('0xa0'),_0x599ca3['savename']),_0x41551e]);return _0x599ca3;}else{var _0x23dd9d=squel[_0x9a84('0x72')]();_0x23dd9d['from']('('+_0x112884[_0x9a84('0x88')]()+')',_0x9a84('0xa1'));_0x23dd9d[_0x9a84('0x6c')](_0x9a84('0xa2'),_0x9a84('0x1f'));_0x112884[_0x9a84('0x20')](_0x27e1fa[_0x9a84('0x20')]||_0x4b2d28);_0x112884[_0x9a84('0x1d')](_0x27e1fa['offset']||0x0);return dbH['sequelize'][_0x9a84('0x33')](_0x23dd9d[_0x9a84('0x88')](),{'type':dbH['sequelize']['QueryTypes'][_0x9a84('0xa3')]})[_0x9a84('0x26')](function(_0x5b324b){if(!_0x5b324b[_0x9a84('0x39')]){_0x1c6be2=0x0;}else{_0x1c6be2=_0x5b324b[0x0][_0x9a84('0x1f')]||0x0;}return dbH[_0x9a84('0x89')]['query'](_0x112884[_0x9a84('0x88')](),{'type':dbH[_0x9a84('0x89')]['QueryTypes'][_0x9a84('0xa3')]});})['then'](function(_0x52dbfe){return{'rows':_0x52dbfe||[],'count':_0x1c6be2};});}});}exports[_0x9a84('0xa4')]=function(_0xf1da16,_0x2c8b62){return runReport(_0xf1da16['params'],_0xf1da16[_0x9a84('0x33')],_0xf1da16[_0x9a84('0x48')])['then'](respondWithResult(_0x2c8b62,null))['catch'](handleError(_0x2c8b62,null));};exports['runReport']=runReport;exports[_0x9a84('0x33')]=function(_0xbc357d,_0x276be0){var _0x90e22b=0xa;var _0x5117c1=['join',_0x9a84('0x57'),'right_join',_0x9a84('0x59')];var _0x34c779={'SUM':_0x9a84('0x5a'),'COUNT':_0x9a84('0x5b'),'COUNT DISTINCT':_0x9a84('0x5c'),'MAX':_0x9a84('0x5d'),'MIN':'MIN(%s)','AVG':_0x9a84('0x8c'),'GROUP_CONCAT':_0x9a84('0x5e'),'GROUP_CONCAT ASC':_0x9a84('0x5f'),'GROUP_CONCAT DESC':_0x9a84('0x60')};var _0x327fda={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9a84('0x8e'),'HOUR':_0x9a84('0x61'),'ROUND':_0x9a84('0x62'),'UNIX_TIMESTAMP':_0x9a84('0x63')};var _0x4d2dfb=function(_0x39f7c3){return!_[_0x9a84('0x64')]([_0x9a84('0x65'),_0x9a84('0x66'),_0x9a84('0x67'),_0x9a84('0x68')],_0x39f7c3);};var _0x5959f6=function(_0x9159f4){if(!_0x9159f4||!_0x9159f4[_0x9a84('0x69')]['length']){return'';}for(var _0x4d837e='(',_0x464675=0x0;_0x464675<_0x9159f4[_0x9a84('0x69')][_0x9a84('0x39')];_0x464675+=0x1){_0x464675>0x0&&(_0x4d837e+='\x20'+_0x9159f4['operator']+'\x20');_0x4d837e+=_0x9159f4[_0x9a84('0x69')][_0x464675]['group']?_0x5959f6(_0x9159f4[_0x9a84('0x69')][_0x464675][_0x9a84('0x6b')]):_0x9159f4['rules'][_0x464675][_0x9a84('0x6c')]+'\x20'+_0x9159f4[_0x9a84('0x69')][_0x464675][_0x9a84('0x6d')]+(_0x4d2dfb(_0x9159f4[_0x9a84('0x69')][_0x464675][_0x9a84('0x6d')])?'\x20'+_0x9159f4[_0x9a84('0x69')][_0x464675][_0x9a84('0xa5')]:'');}return _0x4d837e+')';};var _0x24b3c1={'where':{'id':_0xbc357d[_0x9a84('0x47')]['id']}},_0x253695,_0x2ad96a,_0x10065a,_0x45f389,_0x38ca29;_0x24b3c1=_[_0x9a84('0x40')]({},_0x24b3c1,_0xbc357d[_0x9a84('0x48')]);return db[_0x9a84('0x2d')][_0x9a84('0x50')](_0x24b3c1)[_0x9a84('0x26')](function(_0x4eb672){if(_0x4eb672){_0x253695=_0x4eb672;return _0x4eb672[_0x9a84('0x6e')]();}return null;})[_0x9a84('0x26')](function(_0x4e49b6){if(_0x4e49b6){if(!_0x4e49b6[_0x9a84('0x39')]){throw new db[(_0x9a84('0x8f'))][(_0x9a84('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2ad96a=_0x4e49b6;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x40f41b){if(_0x40f41b){_0x10065a=_['keyBy'](_0x40f41b,'id');var _0x466dcb;var _0x3b9e4d=squel['select']();_0x3b9e4d[_0x9a84('0xa6')](_0x253695[_0x9a84('0x73')]);for(var _0x405eff=0x0;_0x405eff<_0x2ad96a[_0x9a84('0x39')];_0x405eff+=0x1){_0x466dcb=_0x2ad96a[_0x405eff]['MetricId']?_0x10065a[_0x2ad96a[_0x405eff][_0x9a84('0x74')]][_0x9a84('0x75')]:_0x2ad96a[_0x405eff][_0x9a84('0x6c')];_0x466dcb=_0x2ad96a[_0x405eff]['function']?_['replace'](_0x34c779[_0x2ad96a[_0x405eff][_0x9a84('0x76')]],'%s',_0x466dcb):_0x466dcb;_0x466dcb=_0x2ad96a[_0x405eff]['format']?_[_0x9a84('0x77')](_0x327fda[_0x2ad96a[_0x405eff][_0x9a84('0x78')]],'%s',_0x466dcb):_0x466dcb;if(_0x2ad96a[_0x405eff][_0x9a84('0x79')]){_0x3b9e4d[_0x9a84('0x6b')](_0x466dcb);}_0x2ad96a[_0x405eff][_0x9a84('0x7a')]&&_0x3b9e4d['order'](_0x466dcb,_0x2ad96a[_0x405eff]['orderBy']===_0x9a84('0x7c')?![]:!![]);_0x3b9e4d[_0x9a84('0x6c')](_0x466dcb,_0x2ad96a[_0x405eff]['alias']||_0x466dcb);}if(_0x253695[_0x9a84('0x7e')]){_0x253695[_0x9a84('0x7e')]=JSON[_0x9a84('0x7f')](_0x253695[_0x9a84('0x7e')]);for(var _0x4aaffd=0x0;_0x4aaffd<_0x253695['joins'][_0x9a84('0x39')];_0x4aaffd+=0x1){if(_0x253695[_0x9a84('0x7e')][_0x4aaffd]['type']&&_[_0x9a84('0x64')](_0x5117c1,_0x253695[_0x9a84('0x7e')][_0x4aaffd][_0x9a84('0x2f')])&&_0x253695[_0x9a84('0x7e')][_0x4aaffd][_0x9a84('0x80')]&&_0x253695[_0x9a84('0x7e')][_0x4aaffd]['foreignTable']&&_0x253695[_0x9a84('0x7e')][_0x4aaffd][_0x9a84('0x81')]){_0x3b9e4d[_0x253695[_0x9a84('0x7e')][_0x4aaffd]['type']](_0x253695[_0x9a84('0x7e')][_0x4aaffd]['foreignTable'],null,util[_0x9a84('0x78')](_0x9a84('0x83'),_0x253695[_0x9a84('0x73')],_0x253695[_0x9a84('0x7e')][_0x4aaffd][_0x9a84('0x80')],_0x253695['joins'][_0x4aaffd][_0x9a84('0x82')],_0x253695['joins'][_0x4aaffd][_0x9a84('0x81')]));}}}if(_0x253695['conditions']){_0x253695[_0x9a84('0x84')]=JSON['parse'](_0x253695[_0x9a84('0x84')]);_0x3b9e4d[_0x9a84('0x3d')](_0x5959f6(_0x253695['conditions'][_0x9a84('0x6b')]));}_0x38ca29=_0x3b9e4d[_0x9a84('0x85')]();_0x3b9e4d['limit'](_0x90e22b);_0x3b9e4d[_0x9a84('0x1d')](0x0);logger['debug']('Limited\x20Query:',_0x3b9e4d[_0x9a84('0x88')]());return dbH[_0x9a84('0x89')][_0x9a84('0x33')](_0x3b9e4d['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x9a84('0xa3')]});}})[_0x9a84('0x26')](function(){return{'sql':_0x38ca29['toString']()};})['then'](respondWithResult(_0x276be0,null))[_0x9a84('0x45')](handleError(_0x276be0,null));}; \ No newline at end of file +var _0x6ff6=['ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','toString','QueryTypes','cross_join','AVG(%s)','AnalyticMetric','metric','web','fullPath','%s-%s.%s','randomstring','output','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../files/reports','savename','COUNT(*)','sequelize','SELECT','run','runReport','debug','Limited\x20Query:','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','CustomReports','UserProfileResource','error','name','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','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)'];(function(_0x166566,_0x5027bf){var _0x37c2ff=function(_0x1a401f){while(--_0x1a401f){_0x166566['push'](_0x166566['shift']());}};_0x37c2ff(++_0x5027bf);}(_0x6ff6,0x182));var _0x66ff=function(_0x4560f9,_0x3887d9){_0x4560f9=_0x4560f9-0x0;var _0x49b8e2=_0x6ff6[_0x4560f9];return _0x49b8e2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x66ff('0x0'));var jsonpatch=require(_0x66ff('0x1'));var rp=require(_0x66ff('0x2'));var moment=require(_0x66ff('0x3'));var BPromise=require(_0x66ff('0x4'));var Mustache=require(_0x66ff('0x5'));var util=require(_0x66ff('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x66ff('0x7'));var ejs=require(_0x66ff('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x66ff('0x9'));var crypto=require(_0x66ff('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x66ff('0xb'));var toCsv=require(_0x66ff('0x7'));var querystring=require(_0x66ff('0xc'));var Papa=require(_0x66ff('0xd'));var Redis=require(_0x66ff('0xe'));var authService=require(_0x66ff('0xf'));var qs=require(_0x66ff('0x10'));var as=require(_0x66ff('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x66ff('0x12'));var licenseUtil=require(_0x66ff('0x13'));var db=require(_0x66ff('0x14'))['db'];var dbH=require(_0x66ff('0x14'))['dbH'];function respondWithStatusCode(_0x216b61,_0x5a3e22){_0x5a3e22=_0x5a3e22||0xcc;return function(_0x1aa967){if(_0x1aa967){return _0x216b61[_0x66ff('0x15')](_0x5a3e22);}return _0x216b61[_0x66ff('0x16')](_0x5a3e22)[_0x66ff('0x17')]();};}function respondWithResult(_0xaea9ff,_0x1177c2){_0x1177c2=_0x1177c2||0xc8;return function(_0x4bc6c6){if(_0x4bc6c6){return _0xaea9ff[_0x66ff('0x16')](_0x1177c2)[_0x66ff('0x18')](_0x4bc6c6);}};}function respondWithFilteredResult(_0x36b0be,_0x55d1d1){return function(_0x586137){if(_0x586137){var _0x5f1e7e=typeof _0x55d1d1[_0x66ff('0x19')]===_0x66ff('0x1a')&&typeof _0x55d1d1[_0x66ff('0x1b')]===_0x66ff('0x1a');var _0x33188b=_0x586137[_0x66ff('0x1c')];var _0x1eaade=_0x5f1e7e?0x0:_0x55d1d1[_0x66ff('0x19')];var _0x457806=_0x5f1e7e?_0x586137[_0x66ff('0x1c')]:_0x55d1d1[_0x66ff('0x19')]+_0x55d1d1[_0x66ff('0x1b')];var _0x15d8bc;if(_0x457806>=_0x33188b){_0x457806=_0x33188b;_0x15d8bc=0xc8;}else{_0x15d8bc=0xce;}_0x36b0be[_0x66ff('0x16')](_0x15d8bc);return _0x36b0be['set'](_0x66ff('0x1d'),_0x1eaade+'-'+_0x457806+'/'+_0x33188b)['json'](_0x586137);}return null;};}function patchUpdates(_0x167463){return function(_0x5e6e3b){try{jsonpatch[_0x66ff('0x1e')](_0x5e6e3b,_0x167463,!![]);}catch(_0x54c3bf){return BPromise['reject'](_0x54c3bf);}return _0x5e6e3b[_0x66ff('0x1f')]();};}function saveUpdates(_0x1b89d2,_0x7dbe25){return function(_0x3b7bd1){if(_0x3b7bd1){return _0x3b7bd1[_0x66ff('0x20')](_0x1b89d2)[_0x66ff('0x21')](function(_0x26ddb6){return _0x26ddb6;});}return null;};}function removeEntity(_0x17ed70,_0x465922){return function(_0xe3ccc2){if(_0xe3ccc2){return _0xe3ccc2[_0x66ff('0x22')]()[_0x66ff('0x21')](function(){var _0x317fca=_0xe3ccc2[_0x66ff('0x23')]({'plain':!![]});var _0x1b9292=_0x66ff('0x24');return db[_0x66ff('0x25')]['destroy']({'where':{'type':_0x1b9292,'resourceId':_0x317fca['id']}})[_0x66ff('0x21')](function(){return _0xe3ccc2;});})['then'](function(){_0x17ed70[_0x66ff('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc30d13,_0x588bc7){return function(_0x10c2d1){if(!_0x10c2d1){_0xc30d13[_0x66ff('0x15')](0x194);}return _0x10c2d1;};}function handleError(_0x61b09b,_0x1a62c9){_0x1a62c9=_0x1a62c9||0x1f4;return function(_0x1d4b6f){logger[_0x66ff('0x26')](_0x1d4b6f['stack']);if(_0x1d4b6f[_0x66ff('0x27')]){delete _0x1d4b6f[_0x66ff('0x27')];}_0x61b09b['status'](_0x1a62c9)['send'](_0x1d4b6f);};}exports[_0x66ff('0x28')]=function(_0x3de313,_0x1b653a){var _0x54485a={},_0x2c47d0={},_0x4bef9a={'count':0x0,'rows':[]};var _0x50fe81=_['map'](db[_0x66ff('0x29')][_0x66ff('0x2a')],function(_0x388ac8){return{'name':_0x388ac8[_0x66ff('0x2b')],'type':_0x388ac8[_0x66ff('0x2c')][_0x66ff('0x2d')]};});_0x2c47d0['model']=_[_0x66ff('0x2e')](_0x50fe81,'name');_0x2c47d0[_0x66ff('0x2f')]=_['keys'](_0x3de313[_0x66ff('0x2f')]);_0x2c47d0[_0x66ff('0x30')]=_[_0x66ff('0x31')](_0x2c47d0[_0x66ff('0x32')],_0x2c47d0[_0x66ff('0x2f')]);_0x54485a[_0x66ff('0x33')]=_[_0x66ff('0x31')](_0x2c47d0['model'],qs[_0x66ff('0x34')](_0x3de313[_0x66ff('0x2f')]['fields']));_0x54485a[_0x66ff('0x33')]=_0x54485a[_0x66ff('0x33')][_0x66ff('0x35')]?_0x54485a[_0x66ff('0x33')]:_0x2c47d0['model'];if(!_0x3de313[_0x66ff('0x2f')]['hasOwnProperty']('nolimit')){_0x54485a[_0x66ff('0x1b')]=qs['limit'](_0x3de313[_0x66ff('0x2f')][_0x66ff('0x1b')]);_0x54485a[_0x66ff('0x19')]=qs[_0x66ff('0x19')](_0x3de313['query'][_0x66ff('0x19')]);}_0x54485a[_0x66ff('0x36')]=qs[_0x66ff('0x37')](_0x3de313[_0x66ff('0x2f')]['sort']);_0x54485a[_0x66ff('0x38')]=qs['filters'](_[_0x66ff('0x39')](_0x3de313[_0x66ff('0x2f')],_0x2c47d0[_0x66ff('0x30')]),_0x50fe81);if(_0x3de313[_0x66ff('0x2f')]['filter']){_0x54485a[_0x66ff('0x38')]=_['merge'](_0x54485a['where'],{'$or':_[_0x66ff('0x2e')](_0x50fe81,function(_0x303ea9){if(_0x303ea9[_0x66ff('0x2c')]!==_0x66ff('0x3a')){var _0x33e043={};_0x33e043[_0x303ea9[_0x66ff('0x27')]]={'$like':'%'+_0x3de313[_0x66ff('0x2f')][_0x66ff('0x3b')]+'%'};return _0x33e043;}})});}_0x54485a=_[_0x66ff('0x3c')]({},_0x54485a,_0x3de313[_0x66ff('0x3d')]);var _0x15f1f4={'where':_0x54485a[_0x66ff('0x38')]};return db[_0x66ff('0x29')][_0x66ff('0x1c')](_0x15f1f4)[_0x66ff('0x21')](function(_0xba845f){_0x4bef9a[_0x66ff('0x1c')]=_0xba845f;if(_0x3de313[_0x66ff('0x2f')][_0x66ff('0x3e')]){_0x54485a[_0x66ff('0x3f')]=[{'all':!![]}];}return db[_0x66ff('0x29')][_0x66ff('0x40')](_0x54485a);})[_0x66ff('0x21')](function(_0x58b2ac){_0x4bef9a[_0x66ff('0x41')]=_0x58b2ac;return _0x4bef9a;})[_0x66ff('0x21')](respondWithFilteredResult(_0x1b653a,_0x54485a))[_0x66ff('0x42')](handleError(_0x1b653a,null));};exports[_0x66ff('0x43')]=function(_0x463952,_0x49cc2b){var _0x4769d0={'raw':![],'where':{'id':_0x463952[_0x66ff('0x44')]['id']}},_0x5a0a28={};_0x5a0a28[_0x66ff('0x32')]=_[_0x66ff('0x45')](db[_0x66ff('0x29')][_0x66ff('0x2a')]);_0x5a0a28[_0x66ff('0x2f')]=_[_0x66ff('0x45')](_0x463952[_0x66ff('0x2f')]);_0x5a0a28['filters']=_[_0x66ff('0x31')](_0x5a0a28[_0x66ff('0x32')],_0x5a0a28[_0x66ff('0x2f')]);_0x4769d0['attributes']=_[_0x66ff('0x31')](_0x5a0a28[_0x66ff('0x32')],qs['fields'](_0x463952[_0x66ff('0x2f')][_0x66ff('0x34')]));_0x4769d0[_0x66ff('0x33')]=_0x4769d0[_0x66ff('0x33')][_0x66ff('0x35')]?_0x4769d0[_0x66ff('0x33')]:_0x5a0a28[_0x66ff('0x32')];if(_0x463952[_0x66ff('0x2f')][_0x66ff('0x3e')]){_0x4769d0[_0x66ff('0x3f')]=[{'all':!![]}];}_0x4769d0=_[_0x66ff('0x3c')]({},_0x4769d0,_0x463952[_0x66ff('0x3d')]);return db[_0x66ff('0x29')][_0x66ff('0x46')](_0x4769d0)['then'](handleEntityNotFound(_0x49cc2b,null))[_0x66ff('0x21')](respondWithResult(_0x49cc2b,null))['catch'](handleError(_0x49cc2b,null));};exports[_0x66ff('0x47')]=function(_0x574854,_0x375ada){return db[_0x66ff('0x29')][_0x66ff('0x47')](_0x574854[_0x66ff('0x48')],{})[_0x66ff('0x21')](function(_0x29eca8){var _0x310ed=_0x574854[_0x66ff('0x49')][_0x66ff('0x23')]({'plain':!![]});if(!_0x310ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x310ed['role']===_0x66ff('0x49')){var _0x450dd3=_0x29eca8[_0x66ff('0x23')]({'plain':!![]});var _0x288564=_0x66ff('0x4a');return db[_0x66ff('0x4b')][_0x66ff('0x46')]({'where':{'name':_0x288564,'userProfileId':_0x310ed[_0x66ff('0x4c')]},'raw':!![]})[_0x66ff('0x21')](function(_0x437c46){if(_0x437c46&&_0x437c46[_0x66ff('0x4d')]===0x0){return db[_0x66ff('0x25')][_0x66ff('0x47')]({'name':_0x450dd3[_0x66ff('0x27')],'resourceId':_0x450dd3['id'],'type':_0x66ff('0x24'),'sectionId':_0x437c46['id']},{})['then'](function(){return _0x29eca8;});}else{return _0x29eca8;}})[_0x66ff('0x42')](function(_0xd8468f){logger[_0x66ff('0x26')](_0x66ff('0x4e'),_0xd8468f);throw _0xd8468f;});}return _0x29eca8;})['then'](respondWithResult(_0x375ada,0xc9))[_0x66ff('0x42')](handleError(_0x375ada,null));};exports['update']=function(_0x3526ef,_0x39b879){if(_0x3526ef[_0x66ff('0x48')]['id']){delete _0x3526ef['body']['id'];}return db[_0x66ff('0x29')][_0x66ff('0x46')]({'where':{'id':_0x3526ef[_0x66ff('0x44')]['id']}})[_0x66ff('0x21')](handleEntityNotFound(_0x39b879,null))[_0x66ff('0x21')](saveUpdates(_0x3526ef['body'],null))[_0x66ff('0x21')](respondWithResult(_0x39b879,null))['catch'](handleError(_0x39b879,null));};exports['destroy']=function(_0x4a811b,_0x304af8){return db['AnalyticCustomReport']['find']({'where':{'id':_0x4a811b[_0x66ff('0x44')]['id']}})[_0x66ff('0x21')](handleEntityNotFound(_0x304af8,null))[_0x66ff('0x21')](removeEntity(_0x304af8,null))[_0x66ff('0x42')](handleError(_0x304af8,null));};exports[_0x66ff('0x4f')]=function(_0x166c57,_0x4fd9ea){var _0x2cc87a=0xa;var _0x553111=[_0x66ff('0x50'),_0x66ff('0x51'),_0x66ff('0x52'),'cross_join'];var _0xdab80c={'SUM':_0x66ff('0x53'),'COUNT':_0x66ff('0x54'),'COUNT DISTINCT':_0x66ff('0x55'),'MAX':_0x66ff('0x56'),'MIN':_0x66ff('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x66ff('0x58'),'GROUP_CONCAT ASC':_0x66ff('0x59'),'GROUP_CONCAT DESC':_0x66ff('0x5a')};var _0x404cee={'SEC_TO_TIME':_0x66ff('0x5b'),'DATE':_0x66ff('0x5c'),'HOUR':_0x66ff('0x5d'),'ROUND':_0x66ff('0x5e'),'UNIX_TIMESTAMP':_0x66ff('0x5f')};var _0x58797c=function(_0x181c90){return!_[_0x66ff('0x60')]([_0x66ff('0x61'),_0x66ff('0x62'),_0x66ff('0x63'),_0x66ff('0x64')],_0x181c90);};var _0x2d11c2=function(_0x43a243){if(!_0x43a243||!_0x43a243['rules'][_0x66ff('0x35')]){return'';}for(var _0x8484f3='(',_0x4d74cb=0x0;_0x4d74cb<_0x43a243[_0x66ff('0x65')][_0x66ff('0x35')];_0x4d74cb+=0x1){_0x4d74cb>0x0&&(_0x8484f3+='\x20'+_0x43a243[_0x66ff('0x66')]+'\x20');_0x8484f3+=_0x43a243[_0x66ff('0x65')][_0x4d74cb]['group']?_0x2d11c2(_0x43a243[_0x66ff('0x65')][_0x4d74cb][_0x66ff('0x67')]):_0x43a243['rules'][_0x4d74cb]['field']+'\x20'+_0x43a243[_0x66ff('0x65')][_0x4d74cb][_0x66ff('0x68')]+(_0x58797c(_0x43a243[_0x66ff('0x65')][_0x4d74cb][_0x66ff('0x68')])?'\x20'+_0x43a243[_0x66ff('0x65')][_0x4d74cb][_0x66ff('0x69')]:'');}return _0x8484f3+')';};var _0x59f971={'where':{'id':_0x166c57[_0x66ff('0x44')]['id']}},_0x220387,_0x12a864,_0x3ff52f,_0x473e69,_0x59cb95;_0x59f971=_[_0x66ff('0x3c')]({},_0x59f971,_0x166c57[_0x66ff('0x3d')]);return db['AnalyticCustomReport'][_0x66ff('0x46')](_0x59f971)['then'](function(_0x4a4d04){if(_0x4a4d04){_0x220387=_0x4a4d04;return _0x4a4d04[_0x66ff('0x6a')]();}return null;})[_0x66ff('0x21')](function(_0x7eea56){if(_0x7eea56){if(!_0x7eea56[_0x66ff('0x35')]){throw new db[(_0x66ff('0x6b'))][(_0x66ff('0x6c'))](_0x66ff('0x6d'),0x193);}_0x12a864=_0x7eea56;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x66ff('0x21')](function(_0x63dc0){if(_0x63dc0){_0x3ff52f=_[_0x66ff('0x6e')](_0x63dc0,'id');var _0x34ef30;var _0x4af498=squel[_0x66ff('0x6f')]();_0x4af498[_0x66ff('0x70')](_0x220387['table']);for(var _0x341b69=0x0;_0x341b69<_0x12a864[_0x66ff('0x35')];_0x341b69+=0x1){_0x34ef30=_0x12a864[_0x341b69][_0x66ff('0x71')]?_0x3ff52f[_0x12a864[_0x341b69][_0x66ff('0x71')]]['metric']:_0x12a864[_0x341b69][_0x66ff('0x72')];_0x34ef30=_0x12a864[_0x341b69][_0x66ff('0x73')]?_[_0x66ff('0x74')](_0xdab80c[_0x12a864[_0x341b69][_0x66ff('0x73')]],'%s',_0x34ef30):_0x34ef30;_0x34ef30=_0x12a864[_0x341b69][_0x66ff('0x75')]?_[_0x66ff('0x74')](_0x404cee[_0x12a864[_0x341b69]['format']],'%s',_0x34ef30):_0x34ef30;if(_0x12a864[_0x341b69][_0x66ff('0x76')]){_0x4af498[_0x66ff('0x67')](_0x34ef30);}_0x12a864[_0x341b69]['orderBy']&&_0x4af498[_0x66ff('0x36')](_0x34ef30,_0x12a864[_0x341b69][_0x66ff('0x77')]===_0x66ff('0x78')?![]:!![]);_0x4af498[_0x66ff('0x72')](_0x34ef30,_0x12a864[_0x341b69][_0x66ff('0x79')]||_0x34ef30);}if(_0x220387['joins']){_0x220387[_0x66ff('0x7a')]=JSON[_0x66ff('0x7b')](_0x220387[_0x66ff('0x7a')]);for(var _0x3ab476=0x0;_0x3ab476<_0x220387['joins']['length'];_0x3ab476+=0x1){if(_0x220387[_0x66ff('0x7a')][_0x3ab476]['type']&&_[_0x66ff('0x60')](_0x553111,_0x220387['joins'][_0x3ab476][_0x66ff('0x2c')])&&_0x220387['joins'][_0x3ab476][_0x66ff('0x7c')]&&_0x220387['joins'][_0x3ab476][_0x66ff('0x7d')]&&_0x220387[_0x66ff('0x7a')][_0x3ab476][_0x66ff('0x7e')]){_0x4af498[_0x220387[_0x66ff('0x7a')][_0x3ab476][_0x66ff('0x2c')]](_0x220387['joins'][_0x3ab476]['foreignTable'],null,util[_0x66ff('0x75')](_0x66ff('0x7f'),_0x220387[_0x66ff('0x80')],_0x220387['joins'][_0x3ab476][_0x66ff('0x7c')],_0x220387[_0x66ff('0x7a')][_0x3ab476][_0x66ff('0x7d')],_0x220387['joins'][_0x3ab476][_0x66ff('0x7e')]));}}}if(_0x220387[_0x66ff('0x81')]){_0x220387[_0x66ff('0x81')]=JSON[_0x66ff('0x7b')](_0x220387[_0x66ff('0x81')]);_0x4af498[_0x66ff('0x38')](_0x2d11c2(_0x220387[_0x66ff('0x81')][_0x66ff('0x67')]));}_0x59cb95=_0x4af498[_0x66ff('0x82')]();_0x4af498[_0x66ff('0x1b')](_0x2cc87a);_0x4af498[_0x66ff('0x19')](0x0);logger['debug']('Limited\x20Query:',_0x4af498[_0x66ff('0x83')]());return dbH['sequelize'][_0x66ff('0x2f')](_0x4af498[_0x66ff('0x83')](),{'type':dbH['sequelize'][_0x66ff('0x84')]['SELECT']});}})[_0x66ff('0x21')](respondWithResult(_0x4fd9ea,null))[_0x66ff('0x42')](handleError(_0x4fd9ea,null));};function runReport(_0x200e75,_0x26a8d8,_0x35acd5){var _0xbf4173=_0x26a8d8[_0x66ff('0x27')];var _0x189f08=0xa;var _0x4f49ae=[_0x66ff('0x50'),_0x66ff('0x51'),'right_join',_0x66ff('0x85')];var _0x417581={'SUM':_0x66ff('0x53'),'COUNT':_0x66ff('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x66ff('0x56'),'MIN':'MIN(%s)','AVG':_0x66ff('0x86'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x66ff('0x59'),'GROUP_CONCAT DESC':_0x66ff('0x5a')};var _0x2269ea={'SEC_TO_TIME':_0x66ff('0x5b'),'DATE':'DATE(%s)','HOUR':_0x66ff('0x5d'),'ROUND':_0x66ff('0x5e'),'UNIX_TIMESTAMP':_0x66ff('0x5f')};var _0x3e02b5=function(_0x3851a2){return!_[_0x66ff('0x60')]([_0x66ff('0x61'),_0x66ff('0x62'),'IS\x20EMPTY',_0x66ff('0x64')],_0x3851a2);};var _0x47eb1e=function(_0x2dec15){if(!_0x2dec15||!_0x2dec15[_0x66ff('0x65')][_0x66ff('0x35')]){return'';}for(var _0x327efe='(',_0x5d5ba2=0x0;_0x5d5ba2<_0x2dec15[_0x66ff('0x65')][_0x66ff('0x35')];_0x5d5ba2+=0x1){_0x5d5ba2>0x0&&(_0x327efe+='\x20'+_0x2dec15[_0x66ff('0x66')]+'\x20');_0x327efe+=_0x2dec15[_0x66ff('0x65')][_0x5d5ba2]['group']?_0x47eb1e(_0x2dec15[_0x66ff('0x65')][_0x5d5ba2][_0x66ff('0x67')]):_0x2dec15[_0x66ff('0x65')][_0x5d5ba2]['field']+'\x20'+_0x2dec15[_0x66ff('0x65')][_0x5d5ba2][_0x66ff('0x68')]+(_0x3e02b5(_0x2dec15[_0x66ff('0x65')][_0x5d5ba2][_0x66ff('0x68')])?'\x20'+_0x2dec15['rules'][_0x5d5ba2]['value']:'');}return _0x327efe+')';};var _0xb5dcaf={'where':{'id':_0x200e75['id']}},_0x5f30a7,_0x1e76b5,_0x237a6a,_0x275833,_0x43910d;_0xb5dcaf=_['merge']({},_0xb5dcaf,_0x35acd5);return db[_0x66ff('0x29')][_0x66ff('0x46')](_0xb5dcaf)[_0x66ff('0x21')](function(_0x1c7515){if(_0x1c7515){_0x5f30a7=_0x1c7515;return _0x1c7515[_0x66ff('0x6a')]();}return null;})[_0x66ff('0x21')](function(_0x92c03c){if(_0x92c03c){if(!_0x92c03c[_0x66ff('0x35')]){throw new db[(_0x66ff('0x6b'))]['ValidationErrorItem'](_0x66ff('0x6d'),0x193);}_0x1e76b5=_0x92c03c;return db[_0x66ff('0x87')]['findAll']({'raw':!![]});}return null;})[_0x66ff('0x21')](function(_0x25f5d9){if(_0x25f5d9){_0x237a6a=_[_0x66ff('0x6e')](_0x25f5d9,'id');var _0x2ae102;var _0x56ce6c=squel[_0x66ff('0x6f')]();_0x56ce6c[_0x66ff('0x70')](_0x5f30a7[_0x66ff('0x80')]);for(var _0x44d1ad=0x0;_0x44d1ad<_0x1e76b5['length'];_0x44d1ad+=0x1){_0x2ae102=_0x1e76b5[_0x44d1ad][_0x66ff('0x71')]?_0x237a6a[_0x1e76b5[_0x44d1ad]['MetricId']][_0x66ff('0x88')]:_0x1e76b5[_0x44d1ad][_0x66ff('0x72')];_0x2ae102=_0x1e76b5[_0x44d1ad][_0x66ff('0x73')]?_['replace'](_0x417581[_0x1e76b5[_0x44d1ad][_0x66ff('0x73')]],'%s',_0x2ae102):_0x2ae102;_0x2ae102=_0x1e76b5[_0x44d1ad][_0x66ff('0x75')]?_[_0x66ff('0x74')](_0x2269ea[_0x1e76b5[_0x44d1ad]['format']],'%s',_0x2ae102):_0x2ae102;if(_0x1e76b5[_0x44d1ad][_0x66ff('0x76')]){_0x56ce6c['group'](_0x2ae102);}_0x1e76b5[_0x44d1ad][_0x66ff('0x77')]&&_0x56ce6c[_0x66ff('0x36')](_0x2ae102,_0x1e76b5[_0x44d1ad][_0x66ff('0x77')]===_0x66ff('0x78')?![]:!![]);_0x56ce6c[_0x66ff('0x72')](_0x2ae102,_0x1e76b5[_0x44d1ad][_0x66ff('0x79')]||_0x2ae102);}if(_0x5f30a7[_0x66ff('0x7a')]){_0x5f30a7[_0x66ff('0x7a')]=JSON[_0x66ff('0x7b')](_0x5f30a7[_0x66ff('0x7a')]);for(var _0x2d29ca=0x0;_0x2d29ca<_0x5f30a7['joins'][_0x66ff('0x35')];_0x2d29ca+=0x1){if(_0x5f30a7['joins'][_0x2d29ca][_0x66ff('0x2c')]&&_[_0x66ff('0x60')](_0x4f49ae,_0x5f30a7[_0x66ff('0x7a')][_0x2d29ca][_0x66ff('0x2c')])&&_0x5f30a7[_0x66ff('0x7a')][_0x2d29ca][_0x66ff('0x7c')]&&_0x5f30a7[_0x66ff('0x7a')][_0x2d29ca][_0x66ff('0x7d')]&&_0x5f30a7['joins'][_0x2d29ca]['foreignKey']){_0x56ce6c[_0x5f30a7[_0x66ff('0x7a')][_0x2d29ca][_0x66ff('0x2c')]](_0x5f30a7[_0x66ff('0x7a')][_0x2d29ca][_0x66ff('0x7d')],null,util[_0x66ff('0x75')]('%s.%s\x20=\x20%s.%s',_0x5f30a7[_0x66ff('0x80')],_0x5f30a7[_0x66ff('0x7a')][_0x2d29ca]['parentKey'],_0x5f30a7[_0x66ff('0x7a')][_0x2d29ca][_0x66ff('0x7d')],_0x5f30a7[_0x66ff('0x7a')][_0x2d29ca][_0x66ff('0x7e')]));}}}if(_0x5f30a7[_0x66ff('0x81')]){_0x5f30a7[_0x66ff('0x81')]=JSON['parse'](_0x5f30a7[_0x66ff('0x81')]);_0x56ce6c['where'](_0x47eb1e(_0x5f30a7[_0x66ff('0x81')][_0x66ff('0x67')]));}_0x43910d=_0x56ce6c[_0x66ff('0x82')]();_0x56ce6c[_0x66ff('0x1b')](_0x189f08);_0x56ce6c[_0x66ff('0x19')](0x0);return;}})['then'](function(){if(_0x26a8d8['output']===_0x66ff('0x89')){return null;}var _0x597fda=_['merge'](_0x26a8d8,{'name':_0x26a8d8[_0x66ff('0x8a')]||_0x26a8d8[_0x66ff('0x27')]||_0x5f30a7[_0x66ff('0x27')],'basename':_0xbf4173,'savename':util[_0x66ff('0x75')](_0x66ff('0x8b'),_0x26a8d8['name']||_0x5f30a7[_0x66ff('0x27')],require(_0x66ff('0x8c'))['generate'](0x4),_0x26a8d8[_0x66ff('0x8d')]||'csv'),'reportId':_0x5f30a7['id'],'reportType':_0x66ff('0x8e')});return db[_0x66ff('0x8f')][_0x66ff('0x47')](_0x597fda,{'raw':!![]});})[_0x66ff('0x21')](function(_0x2983dc){if(_0x5f30a7['table']===_0x66ff('0x90')){_0x43910d[_0x66ff('0x38')](_0x5f30a7[_0x66ff('0x80')]+_0x66ff('0x91'),_0x26a8d8[_0x66ff('0x92')],_0x26a8d8[_0x66ff('0x93')]);}else{_0x43910d[_0x66ff('0x38')](_0x5f30a7['table']+_0x66ff('0x94'),_0x26a8d8[_0x66ff('0x92')],_0x26a8d8[_0x66ff('0x93')]);}if(_0x2983dc){logger[_0x66ff('0x95')]('Run\x20Query:',_0x43910d['toString']());require(_0x66ff('0x96'))['fork'](path[_0x66ff('0x50')](__dirname,'../../components/export/',_0x2983dc['output']),[_0x2983dc['id'],_0x43910d['toString'](),path[_0x66ff('0x50')](__dirname,_0x66ff('0x97'),_0x2983dc[_0x66ff('0x98')]),_0xbf4173]);return _0x2983dc;}else{var _0xe298e3=squel[_0x66ff('0x6f')]();_0xe298e3[_0x66ff('0x70')]('('+_0x43910d[_0x66ff('0x83')]()+')','countTable');_0xe298e3[_0x66ff('0x72')](_0x66ff('0x99'),'count');_0x43910d[_0x66ff('0x1b')](_0x26a8d8[_0x66ff('0x1b')]||_0x189f08);_0x43910d['offset'](_0x26a8d8['offset']||0x0);return dbH[_0x66ff('0x9a')][_0x66ff('0x2f')](_0xe298e3['toString'](),{'type':dbH[_0x66ff('0x9a')][_0x66ff('0x84')][_0x66ff('0x9b')]})[_0x66ff('0x21')](function(_0x81b3dd){if(!_0x81b3dd[_0x66ff('0x35')]){_0x275833=0x0;}else{_0x275833=_0x81b3dd[0x0][_0x66ff('0x1c')]||0x0;}return dbH[_0x66ff('0x9a')][_0x66ff('0x2f')](_0x43910d[_0x66ff('0x83')](),{'type':dbH[_0x66ff('0x9a')][_0x66ff('0x84')][_0x66ff('0x9b')]});})[_0x66ff('0x21')](function(_0x3f8025){return{'rows':_0x3f8025||[],'count':_0x275833};});}});}exports[_0x66ff('0x9c')]=function(_0x4f554a,_0x28ef74){return runReport(_0x4f554a[_0x66ff('0x44')],_0x4f554a[_0x66ff('0x2f')],_0x4f554a[_0x66ff('0x3d')])[_0x66ff('0x21')](respondWithResult(_0x28ef74,null))[_0x66ff('0x42')](handleError(_0x28ef74,null));};exports[_0x66ff('0x9d')]=runReport;exports[_0x66ff('0x2f')]=function(_0x45e930,_0x2e1f19){var _0x4192e4=0xa;var _0x2bed56=[_0x66ff('0x50'),_0x66ff('0x51'),_0x66ff('0x52'),_0x66ff('0x85')];var _0x3d625d={'SUM':_0x66ff('0x53'),'COUNT':_0x66ff('0x54'),'COUNT DISTINCT':_0x66ff('0x55'),'MAX':_0x66ff('0x56'),'MIN':_0x66ff('0x57'),'AVG':_0x66ff('0x86'),'GROUP_CONCAT':_0x66ff('0x58'),'GROUP_CONCAT ASC':_0x66ff('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x392e9e={'SEC_TO_TIME':_0x66ff('0x5b'),'DATE':_0x66ff('0x5c'),'HOUR':_0x66ff('0x5d'),'ROUND':_0x66ff('0x5e'),'UNIX_TIMESTAMP':_0x66ff('0x5f')};var _0x1035a5=function(_0x164aa6){return!_['includes']([_0x66ff('0x61'),'IS\x20NOT\x20NULL',_0x66ff('0x63'),_0x66ff('0x64')],_0x164aa6);};var _0x23a3b6=function(_0x442a90){if(!_0x442a90||!_0x442a90[_0x66ff('0x65')][_0x66ff('0x35')]){return'';}for(var _0x28a222='(',_0x618dff=0x0;_0x618dff<_0x442a90[_0x66ff('0x65')]['length'];_0x618dff+=0x1){_0x618dff>0x0&&(_0x28a222+='\x20'+_0x442a90[_0x66ff('0x66')]+'\x20');_0x28a222+=_0x442a90[_0x66ff('0x65')][_0x618dff][_0x66ff('0x67')]?_0x23a3b6(_0x442a90['rules'][_0x618dff]['group']):_0x442a90['rules'][_0x618dff][_0x66ff('0x72')]+'\x20'+_0x442a90[_0x66ff('0x65')][_0x618dff]['condition']+(_0x1035a5(_0x442a90['rules'][_0x618dff][_0x66ff('0x68')])?'\x20'+_0x442a90[_0x66ff('0x65')][_0x618dff][_0x66ff('0x69')]:'');}return _0x28a222+')';};var _0x293b30={'where':{'id':_0x45e930[_0x66ff('0x44')]['id']}},_0x299965,_0x4949d7,_0x313d2e,_0x240980,_0x575917;_0x293b30=_['merge']({},_0x293b30,_0x45e930[_0x66ff('0x3d')]);return db['AnalyticCustomReport'][_0x66ff('0x46')](_0x293b30)[_0x66ff('0x21')](function(_0x5d3861){if(_0x5d3861){_0x299965=_0x5d3861;return _0x5d3861[_0x66ff('0x6a')]();}return null;})['then'](function(_0x3f3a0f){if(_0x3f3a0f){if(!_0x3f3a0f[_0x66ff('0x35')]){throw new db[(_0x66ff('0x6b'))][(_0x66ff('0x6c'))](_0x66ff('0x6d'),0x193);}_0x4949d7=_0x3f3a0f;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x66ff('0x21')](function(_0x522545){if(_0x522545){_0x313d2e=_['keyBy'](_0x522545,'id');var _0x224e88;var _0xc68a19=squel[_0x66ff('0x6f')]();_0xc68a19[_0x66ff('0x70')](_0x299965[_0x66ff('0x80')]);for(var _0x23e5b8=0x0;_0x23e5b8<_0x4949d7[_0x66ff('0x35')];_0x23e5b8+=0x1){_0x224e88=_0x4949d7[_0x23e5b8]['MetricId']?_0x313d2e[_0x4949d7[_0x23e5b8][_0x66ff('0x71')]][_0x66ff('0x88')]:_0x4949d7[_0x23e5b8][_0x66ff('0x72')];_0x224e88=_0x4949d7[_0x23e5b8][_0x66ff('0x73')]?_[_0x66ff('0x74')](_0x3d625d[_0x4949d7[_0x23e5b8][_0x66ff('0x73')]],'%s',_0x224e88):_0x224e88;_0x224e88=_0x4949d7[_0x23e5b8]['format']?_[_0x66ff('0x74')](_0x392e9e[_0x4949d7[_0x23e5b8]['format']],'%s',_0x224e88):_0x224e88;if(_0x4949d7[_0x23e5b8]['groupBy']){_0xc68a19[_0x66ff('0x67')](_0x224e88);}_0x4949d7[_0x23e5b8]['orderBy']&&_0xc68a19[_0x66ff('0x36')](_0x224e88,_0x4949d7[_0x23e5b8]['orderBy']===_0x66ff('0x78')?![]:!![]);_0xc68a19[_0x66ff('0x72')](_0x224e88,_0x4949d7[_0x23e5b8][_0x66ff('0x79')]||_0x224e88);}if(_0x299965[_0x66ff('0x7a')]){_0x299965[_0x66ff('0x7a')]=JSON[_0x66ff('0x7b')](_0x299965[_0x66ff('0x7a')]);for(var _0x59ff41=0x0;_0x59ff41<_0x299965['joins'][_0x66ff('0x35')];_0x59ff41+=0x1){if(_0x299965[_0x66ff('0x7a')][_0x59ff41][_0x66ff('0x2c')]&&_[_0x66ff('0x60')](_0x2bed56,_0x299965[_0x66ff('0x7a')][_0x59ff41]['type'])&&_0x299965[_0x66ff('0x7a')][_0x59ff41][_0x66ff('0x7c')]&&_0x299965['joins'][_0x59ff41][_0x66ff('0x7d')]&&_0x299965[_0x66ff('0x7a')][_0x59ff41][_0x66ff('0x7e')]){_0xc68a19[_0x299965[_0x66ff('0x7a')][_0x59ff41][_0x66ff('0x2c')]](_0x299965['joins'][_0x59ff41]['foreignTable'],null,util[_0x66ff('0x75')](_0x66ff('0x7f'),_0x299965['table'],_0x299965['joins'][_0x59ff41][_0x66ff('0x7c')],_0x299965[_0x66ff('0x7a')][_0x59ff41]['foreignTable'],_0x299965['joins'][_0x59ff41][_0x66ff('0x7e')]));}}}if(_0x299965[_0x66ff('0x81')]){_0x299965['conditions']=JSON[_0x66ff('0x7b')](_0x299965['conditions']);_0xc68a19[_0x66ff('0x38')](_0x23a3b6(_0x299965[_0x66ff('0x81')]['group']));}_0x575917=_0xc68a19['clone']();_0xc68a19[_0x66ff('0x1b')](_0x4192e4);_0xc68a19[_0x66ff('0x19')](0x0);logger[_0x66ff('0x9e')](_0x66ff('0x9f'),_0xc68a19[_0x66ff('0x83')]());return dbH[_0x66ff('0x9a')][_0x66ff('0x2f')](_0xc68a19[_0x66ff('0x83')](),{'type':dbH[_0x66ff('0x9a')][_0x66ff('0x84')][_0x66ff('0x9b')]});}})['then'](function(){return{'sql':_0x575917[_0x66ff('0x83')]()};})[_0x66ff('0x21')](respondWithResult(_0x2e1f19,null))[_0x66ff('0x42')](handleError(_0x2e1f19,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index b2e8ece..4eb4aed 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 _0xc125=['../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport','analytics_custom_reports','../../config/logger','bluebird','request-promise','path'];(function(_0x51dd23,_0x460d0a){var _0x1cb243=function(_0x18cedd){while(--_0x18cedd){_0x51dd23['push'](_0x51dd23['shift']());}};_0x1cb243(++_0x460d0a);}(_0xc125,0x6c));var _0x5c12=function(_0x58dbe8,_0xfcf155){_0x58dbe8=_0x58dbe8-0x0;var _0x502bc3=_0xc125[_0x58dbe8];return _0x502bc3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5c12('0x0'))('api');var moment=require('moment');var BPromise=require(_0x5c12('0x1'));var rp=require(_0x5c12('0x2'));var fs=require('fs');var path=require(_0x5c12('0x3'));var rimraf=require('rimraf');var config=require(_0x5c12('0x4'));var attributes=require(_0x5c12('0x5'));module['exports']=function(_0x3f101e,_0x4565ab){return _0x3f101e['define'](_0x5c12('0x6'),attributes,{'tableName':_0x5c12('0x7'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x301c=['moment','bluebird','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','../../config/logger'];(function(_0x4fce5d,_0x2ac862){var _0x5da4d4=function(_0x2a64df){while(--_0x2a64df){_0x4fce5d['push'](_0x4fce5d['shift']());}};_0x5da4d4(++_0x2ac862);}(_0x301c,0x1f2));var _0xc301=function(_0x1f48e5,_0x451e6e){_0x1f48e5=_0x1f48e5-0x0;var _0x342f42=_0x301c[_0x1f48e5];return _0x342f42;};'use strict';var _=require(_0xc301('0x0'));var util=require('util');var logger=require(_0xc301('0x1'))('api');var moment=require(_0xc301('0x2'));var BPromise=require(_0xc301('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc301('0x4'));var rimraf=require(_0xc301('0x5'));var config=require('../../config/environment');var attributes=require(_0xc301('0x6'));module[_0xc301('0x7')]=function(_0xea3beb,_0x39b8bd){return _0xea3beb[_0xc301('0x8')](_0xc301('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index a21cf18..9e2e346 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 _0x184a=['info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x184a,0x10c));var _0xa184=function(_0x117f48,_0xf2708c){_0x117f48=_0x117f48-0x0;var _0x41785a=_0x184a[_0x117f48];return _0x41785a;};'use strict';var _=require('lodash');var util=require(_0xa184('0x0'));var moment=require(_0xa184('0x1'));var BPromise=require(_0xa184('0x2'));var rs=require(_0xa184('0x3'));var fs=require('fs');var Redis=require(_0xa184('0x4'));var db=require(_0xa184('0x5'))['db'];var utils=require(_0xa184('0x6'));var logger=require('../../config/logger')(_0xa184('0x7'));var config=require('../../config/environment');var jayson=require(_0xa184('0x8'));var client=jayson[_0xa184('0x9')][_0xa184('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x195d64,_0x45b46b,_0x36baa7){return new BPromise(function(_0x529427,_0x533dc7){return client['request'](_0x195d64,_0x36baa7)[_0xa184('0xb')](function(_0x1f493f){logger[_0xa184('0xc')](_0xa184('0xd'),_0x45b46b,_0xa184('0xe'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x45b46b,_0xa184('0xe'),JSON[_0xa184('0xf')](_0x1f493f));if(_0x1f493f[_0xa184('0x10')]){if(_0x1f493f[_0xa184('0x10')]['code']===0x1f4){logger[_0xa184('0x10')](_0xa184('0xd'),_0x45b46b,_0x1f493f['error'][_0xa184('0x11')]);return _0x533dc7(_0x1f493f[_0xa184('0x10')]['message']);}logger['error'](_0xa184('0xd'),_0x45b46b,_0x1f493f['error'][_0xa184('0x11')]);return _0x529427(_0x1f493f['error'][_0xa184('0x11')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x45b46b,'request\x20sent');_0x529427(_0x1f493f[_0xa184('0x12')]['message']);}})[_0xa184('0x13')](function(_0x369c45){logger[_0xa184('0x10')](_0xa184('0xd'),_0x45b46b,_0x369c45);_0x533dc7(_0x369c45);});});} \ No newline at end of file +var _0xa83a=['request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa83a,0x6d));var _0xaa83=function(_0x40cd04,_0x2385b9){_0x40cd04=_0x40cd04-0x0;var _0x713538=_0xa83a[_0x40cd04];return _0x713538;};'use strict';var _=require(_0xaa83('0x0'));var util=require(_0xaa83('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaa83('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaa83('0x3'));var logger=require(_0xaa83('0x4'))(_0xaa83('0x5'));var config=require(_0xaa83('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaa83('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1dd54c,_0x597993,_0xc9064f){return new BPromise(function(_0x4a14f1,_0x59d708){return client[_0xaa83('0x8')](_0x1dd54c,_0xc9064f)[_0xaa83('0x9')](function(_0x1509c1){logger['info'](_0xaa83('0xa'),_0x597993,_0xaa83('0xb'));logger[_0xaa83('0xc')](_0xaa83('0xd'),_0x597993,_0xaa83('0xb'),JSON[_0xaa83('0xe')](_0x1509c1));if(_0x1509c1[_0xaa83('0xf')]){if(_0x1509c1['error'][_0xaa83('0x10')]===0x1f4){logger[_0xaa83('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x597993,_0x1509c1[_0xaa83('0xf')][_0xaa83('0x11')]);return _0x59d708(_0x1509c1[_0xaa83('0xf')][_0xaa83('0x11')]);}logger[_0xaa83('0xf')](_0xaa83('0xa'),_0x597993,_0x1509c1[_0xaa83('0xf')]['message']);return _0x4a14f1(_0x1509c1[_0xaa83('0xf')]['message']);}else{logger[_0xaa83('0x12')](_0xaa83('0xa'),_0x597993,_0xaa83('0xb'));_0x4a14f1(_0x1509c1['result'][_0xaa83('0x11')]);}})[_0xaa83('0x13')](function(_0x33327f){logger[_0xaa83('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x597993,_0x33327f);_0x59d708(_0x33327f);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index ec665a1..37605da 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 _0xd566=['multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','/:id','update','destroy','exports'];(function(_0x57d97b,_0x4e0e17){var _0x7e7826=function(_0x166721){while(--_0x166721){_0x57d97b['push'](_0x57d97b['shift']());}};_0x7e7826(++_0x4e0e17);}(_0xd566,0x1a2));var _0x6d56=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd566[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x6d56('0x0'));var util=require('util');var path=require(_0x6d56('0x1'));var timeout=require(_0x6d56('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6d56('0x3'));var interaction=require(_0x6d56('0x4'));var config=require('../../config/environment');var controller=require(_0x6d56('0x5'));router[_0x6d56('0x6')]('/',auth[_0x6d56('0x7')](),controller[_0x6d56('0x8')]);router['get']('/:id',auth[_0x6d56('0x7')](),controller[_0x6d56('0x9')]);router['get'](_0x6d56('0xa'),auth['isAuthenticated'](),controller[_0x6d56('0xb')]);router[_0x6d56('0x6')](_0x6d56('0xc'),auth[_0x6d56('0x7')](),controller[_0x6d56('0xd')]);router['get'](_0x6d56('0xe'),auth[_0x6d56('0x7')](),controller['query']);router[_0x6d56('0xf')]('/',auth[_0x6d56('0x7')](),controller[_0x6d56('0x10')]);router[_0x6d56('0x11')](_0x6d56('0x12'),auth['isAuthenticated'](),controller[_0x6d56('0x13')]);router['delete']('/:id',auth[_0x6d56('0x7')](),controller[_0x6d56('0x14')]);module[_0x6d56('0x15')]=router; \ No newline at end of file +var _0x6f18=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','put','update','destroy','exports'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6f18,0x7e));var _0x86f1=function(_0x89c357,_0x5e84cb){_0x89c357=_0x89c357-0x0;var _0x4a6246=_0x6f18[_0x89c357];return _0x4a6246;};'use strict';var multer=require('multer');var util=require(_0x86f1('0x0'));var path=require(_0x86f1('0x1'));var timeout=require('connect-timeout');var express=require(_0x86f1('0x2'));var router=express[_0x86f1('0x3')]();var fs_extra=require(_0x86f1('0x4'));var auth=require(_0x86f1('0x5'));var interaction=require(_0x86f1('0x6'));var config=require(_0x86f1('0x7'));var controller=require(_0x86f1('0x8'));router[_0x86f1('0x9')]('/',auth[_0x86f1('0xa')](),controller[_0x86f1('0xb')]);router[_0x86f1('0x9')](_0x86f1('0xc'),auth[_0x86f1('0xa')](),controller[_0x86f1('0xd')]);router[_0x86f1('0x9')](_0x86f1('0xe'),auth[_0x86f1('0xa')](),controller['preview']);router[_0x86f1('0x9')](_0x86f1('0xf'),auth[_0x86f1('0xa')](),controller[_0x86f1('0x10')]);router['get']('/:id/query',auth['isAuthenticated'](),controller['query']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x86f1('0x11')](_0x86f1('0xc'),auth[_0x86f1('0xa')](),controller[_0x86f1('0x12')]);router['delete'](_0x86f1('0xc'),auth['isAuthenticated'](),controller[_0x86f1('0x13')]);module[_0x86f1('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 35eb1a1..d05f478 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 _0x24ca=['sequelize','STRING','TEXT'];(function(_0x131205,_0x57575c){var _0x305300=function(_0x179eea){while(--_0x179eea){_0x131205['push'](_0x131205['shift']());}};_0x305300(++_0x57575c);}(_0x24ca,0x1bc));var _0xa24c=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x24ca[_0x35f7f5];return _0x5567a4;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file +var _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x51e5bd,_0x3c2cf1){var _0x250aed=function(_0x17120c){while(--_0x17120c){_0x51e5bd['push'](_0x51e5bd['shift']());}};_0x250aed(++_0x3c2cf1);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0xfdbd[_0x1e6b59];return _0x40d7c5;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 4a7b0fc..10681f2 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 _0x6d38=['Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','countTable','COUNT(*)','sequelize','run','SEC_TO_TIME(%s)','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','dbH','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','get','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','AnalyticDefaultReport','findAll','rows','show','keys','fields','find','catch','create','body','user','role','Reports','autoAssociation','UserProfileResource','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','toString','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6d38,0x1ef));var _0x86d3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6d38[_0x138adb];return _0x1b27f2;};'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'];var dbH=require(_0x86d3('0x13'))[_0x86d3('0x14')];function respondWithStatusCode(_0x26d64c,_0xe1b3d7){_0xe1b3d7=_0xe1b3d7||0xcc;return function(_0x1b8d0a){if(_0x1b8d0a){return _0x26d64c[_0x86d3('0x15')](_0xe1b3d7);}return _0x26d64c[_0x86d3('0x16')](_0xe1b3d7)['end']();};}function respondWithResult(_0x1c1ba8,_0x1f35cf){_0x1f35cf=_0x1f35cf||0xc8;return function(_0x356e7d){if(_0x356e7d){return _0x1c1ba8[_0x86d3('0x16')](_0x1f35cf)[_0x86d3('0x17')](_0x356e7d);}};}function respondWithFilteredResult(_0x34fb3b,_0x1ff008){return function(_0x44436d){if(_0x44436d){var _0x53b437=typeof _0x1ff008[_0x86d3('0x18')]===_0x86d3('0x19')&&typeof _0x1ff008[_0x86d3('0x1a')]===_0x86d3('0x19');var _0x46feec=_0x44436d[_0x86d3('0x1b')];var _0x33e459=_0x53b437?0x0:_0x1ff008[_0x86d3('0x18')];var _0x9b76f2=_0x53b437?_0x44436d['count']:_0x1ff008[_0x86d3('0x18')]+_0x1ff008['limit'];var _0x6ced9e;if(_0x9b76f2>=_0x46feec){_0x9b76f2=_0x46feec;_0x6ced9e=0xc8;}else{_0x6ced9e=0xce;}_0x34fb3b['status'](_0x6ced9e);return _0x34fb3b['set'](_0x86d3('0x1c'),_0x33e459+'-'+_0x9b76f2+'/'+_0x46feec)[_0x86d3('0x17')](_0x44436d);}return null;};}function patchUpdates(_0x988066){return function(_0x1720ae){try{jsonpatch['apply'](_0x1720ae,_0x988066,!![]);}catch(_0x2901de){return BPromise['reject'](_0x2901de);}return _0x1720ae[_0x86d3('0x1d')]();};}function saveUpdates(_0x3fdf67,_0x1ce849){return function(_0x5b990d){if(_0x5b990d){return _0x5b990d[_0x86d3('0x1e')](_0x3fdf67)[_0x86d3('0x1f')](function(_0x1fa4ac){return _0x1fa4ac;});}return null;};}function removeEntity(_0x4bf5b8,_0x58ba51){return function(_0x26262a){if(_0x26262a){return _0x26262a['destroy']()[_0x86d3('0x1f')](function(){var _0x1bea5e=_0x26262a[_0x86d3('0x20')]({'plain':!![]});var _0x3c5fe4='DefaultReports';return db['UserProfileResource'][_0x86d3('0x21')]({'where':{'type':_0x3c5fe4,'resourceId':_0x1bea5e['id']}})[_0x86d3('0x1f')](function(){return _0x26262a;});})['then'](function(){_0x4bf5b8[_0x86d3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42413c,_0x41e2f0){return function(_0x287b96){if(!_0x287b96){_0x42413c[_0x86d3('0x15')](0x194);}return _0x287b96;};}function handleError(_0x11a6fd,_0x14c9ff){_0x14c9ff=_0x14c9ff||0x1f4;return function(_0x1f203e){logger[_0x86d3('0x22')](_0x1f203e[_0x86d3('0x23')]);if(_0x1f203e[_0x86d3('0x24')]){delete _0x1f203e[_0x86d3('0x24')];}_0x11a6fd[_0x86d3('0x16')](_0x14c9ff)[_0x86d3('0x25')](_0x1f203e);};}exports[_0x86d3('0x26')]=function(_0x5b09f6,_0x120a0c){var _0x403be3={},_0x2bda35={},_0x31cefe={'count':0x0,'rows':[]};var _0x7709f0=_[_0x86d3('0x27')](db['AnalyticDefaultReport'][_0x86d3('0x28')],function(_0x5c71df){return{'name':_0x5c71df['fieldName'],'type':_0x5c71df[_0x86d3('0x29')][_0x86d3('0x2a')]};});_0x2bda35[_0x86d3('0x2b')]=_['map'](_0x7709f0,_0x86d3('0x24'));_0x2bda35[_0x86d3('0x2c')]=_['keys'](_0x5b09f6[_0x86d3('0x2c')]);_0x2bda35[_0x86d3('0x2d')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],_0x2bda35[_0x86d3('0x2c')]);_0x403be3[_0x86d3('0x2f')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],qs['fields'](_0x5b09f6['query']['fields']));_0x403be3[_0x86d3('0x2f')]=_0x403be3['attributes'][_0x86d3('0x30')]?_0x403be3['attributes']:_0x2bda35[_0x86d3('0x2b')];if(!_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x31')](_0x86d3('0x32'))){_0x403be3[_0x86d3('0x1a')]=qs[_0x86d3('0x1a')](_0x5b09f6[_0x86d3('0x2c')]['limit']);_0x403be3[_0x86d3('0x18')]=qs[_0x86d3('0x18')](_0x5b09f6['query'][_0x86d3('0x18')]);}_0x403be3[_0x86d3('0x33')]=qs[_0x86d3('0x34')](_0x5b09f6[_0x86d3('0x2c')]['sort']);_0x403be3[_0x86d3('0x35')]=qs[_0x86d3('0x2d')](_[_0x86d3('0x36')](_0x5b09f6['query'],_0x2bda35[_0x86d3('0x2d')]),_0x7709f0);if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x37')]){_0x403be3[_0x86d3('0x35')]=_[_0x86d3('0x38')](_0x403be3[_0x86d3('0x35')],{'$or':_[_0x86d3('0x27')](_0x7709f0,function(_0x436065){if(_0x436065['type']!==_0x86d3('0x39')){var _0x470978={};_0x470978[_0x436065[_0x86d3('0x24')]]={'$like':'%'+_0x5b09f6[_0x86d3('0x2c')]['filter']+'%'};return _0x470978;}})});}_0x403be3=_[_0x86d3('0x38')]({},_0x403be3,_0x5b09f6[_0x86d3('0x3a')]);var _0x6f72be={'where':_0x403be3[_0x86d3('0x35')]};return db['AnalyticDefaultReport']['count'](_0x6f72be)[_0x86d3('0x1f')](function(_0x4f422b){_0x31cefe['count']=_0x4f422b;if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x403be3[_0x86d3('0x3c')]=[{'all':!![]}];}return db[_0x86d3('0x3d')][_0x86d3('0x3e')](_0x403be3);})['then'](function(_0x2a5f6c){_0x31cefe[_0x86d3('0x3f')]=_0x2a5f6c;return _0x31cefe;})[_0x86d3('0x1f')](respondWithFilteredResult(_0x120a0c,_0x403be3))['catch'](handleError(_0x120a0c,null));};exports[_0x86d3('0x40')]=function(_0x810d10,_0x5dfae8){var _0x369f68={'raw':!![],'where':{'id':_0x810d10['params']['id']}},_0xcf6c9e={};_0xcf6c9e['model']=_['keys'](db[_0x86d3('0x3d')][_0x86d3('0x28')]);_0xcf6c9e[_0x86d3('0x2c')]=_[_0x86d3('0x41')](_0x810d10[_0x86d3('0x2c')]);_0xcf6c9e[_0x86d3('0x2d')]=_['intersection'](_0xcf6c9e[_0x86d3('0x2b')],_0xcf6c9e[_0x86d3('0x2c')]);_0x369f68['attributes']=_[_0x86d3('0x2e')](_0xcf6c9e[_0x86d3('0x2b')],qs[_0x86d3('0x42')](_0x810d10[_0x86d3('0x2c')][_0x86d3('0x42')]));_0x369f68[_0x86d3('0x2f')]=_0x369f68['attributes'][_0x86d3('0x30')]?_0x369f68[_0x86d3('0x2f')]:_0xcf6c9e['model'];if(_0x810d10[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x369f68[_0x86d3('0x3c')]=[{'all':!![]}];}_0x369f68=_[_0x86d3('0x38')]({},_0x369f68,_0x810d10[_0x86d3('0x3a')]);return db['AnalyticDefaultReport'][_0x86d3('0x43')](_0x369f68)[_0x86d3('0x1f')](handleEntityNotFound(_0x5dfae8,null))[_0x86d3('0x1f')](respondWithResult(_0x5dfae8,null))[_0x86d3('0x44')](handleError(_0x5dfae8,null));};exports[_0x86d3('0x45')]=function(_0x7af7b3,_0x1a4345){return db[_0x86d3('0x3d')][_0x86d3('0x45')](_0x7af7b3[_0x86d3('0x46')],{})[_0x86d3('0x1f')](function(_0x1236ea){var _0x4ea940=_0x7af7b3[_0x86d3('0x47')][_0x86d3('0x20')]({'plain':!![]});if(!_0x4ea940)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ea940[_0x86d3('0x48')]===_0x86d3('0x47')){var _0x197047=_0x1236ea[_0x86d3('0x20')]({'plain':!![]});var _0x1dcff0=_0x86d3('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x1dcff0,'userProfileId':_0x4ea940['userProfileId']},'raw':!![]})['then'](function(_0x159253){if(_0x159253&&_0x159253[_0x86d3('0x4a')]===0x0){return db[_0x86d3('0x4b')][_0x86d3('0x45')]({'name':_0x197047[_0x86d3('0x24')],'resourceId':_0x197047['id'],'type':_0x86d3('0x4c'),'sectionId':_0x159253['id']},{})[_0x86d3('0x1f')](function(){return _0x1236ea;});}else{return _0x1236ea;}})['catch'](function(_0x2afb07){logger[_0x86d3('0x22')](_0x86d3('0x4d'),_0x2afb07);throw _0x2afb07;});}return _0x1236ea;})[_0x86d3('0x1f')](respondWithResult(_0x1a4345,0xc9))[_0x86d3('0x44')](handleError(_0x1a4345,null));};exports[_0x86d3('0x1e')]=function(_0x34935f,_0x4c8828){if(_0x34935f[_0x86d3('0x46')]['id']){delete _0x34935f['body']['id'];}return db[_0x86d3('0x3d')][_0x86d3('0x43')]({'where':{'id':_0x34935f[_0x86d3('0x4e')]['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4c8828,null))[_0x86d3('0x1f')](saveUpdates(_0x34935f['body'],null))[_0x86d3('0x1f')](respondWithResult(_0x4c8828,null))[_0x86d3('0x44')](handleError(_0x4c8828,null));};exports[_0x86d3('0x21')]=function(_0x4e10d9,_0x4ad164){return db['AnalyticDefaultReport'][_0x86d3('0x43')]({'where':{'id':_0x4e10d9['params']['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4ad164,null))[_0x86d3('0x1f')](removeEntity(_0x4ad164,null))[_0x86d3('0x44')](handleError(_0x4ad164,null));};exports[_0x86d3('0x4f')]=function(_0x5963bb,_0x4cd835){var _0x551806=0xa;var _0x28655a=[_0x86d3('0x50'),'left_join',_0x86d3('0x51'),_0x86d3('0x52')];var _0xa085b2={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x86d3('0x59')};var _0x41fad7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x86d3('0x5a'),'HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':_0x86d3('0x5d')};var _0x4598d4=function(_0x4029a4){return!_[_0x86d3('0x5e')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x86d3('0x5f'),'IS\x20NOT\x20EMPTY'],_0x4029a4);};var _0x528ca8=function(_0x58e4b6){if(!_0x58e4b6||!_0x58e4b6[_0x86d3('0x60')]['length']){return'';}for(var _0x254ac3='(',_0x5f2ed6=0x0;_0x5f2ed6<_0x58e4b6[_0x86d3('0x60')][_0x86d3('0x30')];_0x5f2ed6+=0x1){_0x5f2ed6>0x0&&(_0x254ac3+='\x20'+_0x58e4b6[_0x86d3('0x61')]+'\x20');_0x254ac3+=_0x58e4b6['rules'][_0x5f2ed6]['group']?_0x528ca8(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x62')]):_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x63')]+'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')]+(_0x4598d4(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')])?'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x65')]:'');}return _0x254ac3+')';};var _0x1e3479={'where':{'id':_0x5963bb[_0x86d3('0x4e')]['id']}},_0x265beb,_0xfaf168,_0xf0dbbb,_0x3f978c,_0x5e1835;_0x1e3479=_[_0x86d3('0x38')]({},_0x1e3479,_0x5963bb['options']);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x1e3479)[_0x86d3('0x1f')](function(_0x52dc99){if(_0x52dc99){_0x265beb=_0x52dc99;return _0x52dc99[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x45e8d9){if(_0x45e8d9){if(!_0x45e8d9[_0x86d3('0x30')]){throw new db['Sequelize'][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xfaf168=_0x45e8d9;return db[_0x86d3('0x68')][_0x86d3('0x3e')]({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2d4bc1){if(_0x2d4bc1){_0xf0dbbb=_[_0x86d3('0x69')](_0x2d4bc1,'id');var _0x56fd96;var _0x3cc1d8=squel['select']();_0x3cc1d8[_0x86d3('0x6a')](_0x265beb[_0x86d3('0x6b')]);for(var _0x5866fe=0x0;_0x5866fe<_0xfaf168[_0x86d3('0x30')];_0x5866fe+=0x1){_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6c')]?_0xf0dbbb[_0xfaf168[_0x5866fe][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0xfaf168[_0x5866fe][_0x86d3('0x63')];_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0xa085b2[_0xfaf168[_0x5866fe]['function']],'%s',_0x56fd96):_0x56fd96;_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x41fad7[_0xfaf168[_0x5866fe][_0x86d3('0x70')]],'%s',_0x56fd96):_0x56fd96;if(_0xfaf168[_0x5866fe][_0x86d3('0x71')]){_0x3cc1d8[_0x86d3('0x62')](_0x56fd96);}_0xfaf168[_0x5866fe]['orderBy']&&_0x3cc1d8[_0x86d3('0x33')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x72')]==='DESC'?![]:!![]);_0x3cc1d8[_0x86d3('0x63')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x73')]||_0x56fd96);}if(_0x265beb[_0x86d3('0x74')]){_0x265beb[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x265beb[_0x86d3('0x74')]);for(var _0x1bf5ba=0x0;_0x1bf5ba<_0x265beb[_0x86d3('0x74')][_0x86d3('0x30')];_0x1bf5ba+=0x1){if(_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x28655a,_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')])&&_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba]['foreignKey']){_0x3cc1d8[_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]](_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x265beb[_0x86d3('0x6b')],_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')],_0x265beb['joins'][_0x1bf5ba]['foreignTable'],_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x78')]));}}}if(_0x265beb[_0x86d3('0x79')]){_0x265beb[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x265beb['conditions']);_0x3cc1d8[_0x86d3('0x35')](_0x528ca8(_0x265beb[_0x86d3('0x79')]['group']));}_0x5e1835=_0x3cc1d8[_0x86d3('0x7a')]();_0x3cc1d8[_0x86d3('0x1a')](_0x551806);_0x3cc1d8['offset'](0x0);logger[_0x86d3('0x7b')]('Limited\x20Query:',_0x3cc1d8[_0x86d3('0x7c')]());return dbH['sequelize']['query'](_0x3cc1d8[_0x86d3('0x7c')](),{'type':dbH['sequelize'][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})[_0x86d3('0x1f')](respondWithResult(_0x4cd835,null))[_0x86d3('0x44')](handleError(_0x4cd835,null));};function runReport(_0x3193d5,_0x3a1acc,_0x268c93){var _0x3b989c=_0x3a1acc['name'];var _0x245b39=0xa;var _0x158f56=[_0x86d3('0x50'),_0x86d3('0x7f'),_0x86d3('0x51'),'cross_join'];var _0x3d8b35={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xca2e0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1b503a=function(_0x24410c){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x24410c);};var _0x5f4a38=function(_0x593b85){if(!_0x593b85||!_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x3fac94='(',_0x28d98e=0x0;_0x28d98e<_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')];_0x28d98e+=0x1){_0x28d98e>0x0&&(_0x3fac94+='\x20'+_0x593b85['operator']+'\x20');_0x3fac94+=_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]?_0x5f4a38(_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]):_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x63')]+'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x64')]+(_0x1b503a(_0x593b85[_0x86d3('0x60')][_0x28d98e]['condition'])?'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x65')]:'');}return _0x3fac94+')';};var _0x4b871b={'where':{'id':_0x3193d5['id']}},_0x584a57,_0x36ee46,_0x1cbc3a,_0x682a6d,_0x5004cd;_0x4b871b=_[_0x86d3('0x38')]({},_0x4b871b,_0x268c93);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x4b871b)[_0x86d3('0x1f')](function(_0x3d3e7f){if(_0x3d3e7f){_0x584a57=_0x3d3e7f;return _0x3d3e7f['getFields']();}return null;})[_0x86d3('0x1f')](function(_0x1aaf08){if(_0x1aaf08){if(!_0x1aaf08['length']){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))](_0x86d3('0x86'),0x193);}_0x36ee46=_0x1aaf08;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2896e1){if(_0x2896e1){_0x1cbc3a=_[_0x86d3('0x69')](_0x2896e1,'id');var _0x18295c;var _0x44af1c=squel['select']();_0x44af1c[_0x86d3('0x6a')](_0x584a57[_0x86d3('0x6b')]);for(var _0x3582a2=0x0;_0x3582a2<_0x36ee46[_0x86d3('0x30')];_0x3582a2+=0x1){_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6c')]?_0x1cbc3a[_0x36ee46[_0x3582a2][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x36ee46[_0x3582a2][_0x86d3('0x63')];_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0x3d8b35[_0x36ee46[_0x3582a2]['function']],'%s',_0x18295c):_0x18295c;_0x18295c=_0x36ee46[_0x3582a2]['format']?_[_0x86d3('0x6f')](_0xca2e0[_0x36ee46[_0x3582a2][_0x86d3('0x70')]],'%s',_0x18295c):_0x18295c;if(_0x36ee46[_0x3582a2]['groupBy']){_0x44af1c[_0x86d3('0x62')](_0x18295c);}_0x36ee46[_0x3582a2][_0x86d3('0x72')]&&_0x44af1c[_0x86d3('0x33')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x72')]===_0x86d3('0x87')?![]:!![]);_0x44af1c[_0x86d3('0x63')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x73')]||_0x18295c);}if(_0x584a57[_0x86d3('0x74')]){_0x584a57[_0x86d3('0x74')]=JSON['parse'](_0x584a57['joins']);for(var _0x48a6d7=0x0;_0x48a6d7<_0x584a57['joins'][_0x86d3('0x30')];_0x48a6d7+=0x1){if(_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x158f56,_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')])&&_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey']&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x77')]&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x78')]){_0x44af1c[_0x584a57['joins'][_0x48a6d7][_0x86d3('0x29')]](_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],null,util[_0x86d3('0x70')](_0x86d3('0x88'),_0x584a57[_0x86d3('0x6b')],_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey'],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x78')]));}}}if(_0x584a57['conditions']){_0x584a57[_0x86d3('0x79')]=JSON['parse'](_0x584a57['conditions']);_0x44af1c[_0x86d3('0x35')](_0x5f4a38(_0x584a57[_0x86d3('0x79')][_0x86d3('0x62')]));}_0x5004cd=_0x44af1c[_0x86d3('0x7a')]();_0x44af1c[_0x86d3('0x1a')](_0x245b39);_0x44af1c[_0x86d3('0x18')](0x0);return;}})[_0x86d3('0x1f')](function(){if(_0x3a1acc[_0x86d3('0x89')]===_0x86d3('0x8a')){return null;}var _0x120a85=_[_0x86d3('0x38')](_0x3a1acc,{'name':_0x3a1acc[_0x86d3('0x8b')]||_0x3a1acc[_0x86d3('0x24')]||_0x584a57[_0x86d3('0x24')],'basename':_0x3b989c,'savename':util[_0x86d3('0x70')]('%s-%s.%s',_0x3a1acc['name']||_0x584a57['name'],require(_0x86d3('0x8c'))[_0x86d3('0x8d')](0x4),_0x3a1acc[_0x86d3('0x89')]||_0x86d3('0x8e')),'reportId':_0x584a57['id'],'reportType':_0x86d3('0x8f')});return db[_0x86d3('0x90')][_0x86d3('0x45')](_0x120a85,{'raw':!![]});})[_0x86d3('0x1f')](function(_0x10e23d){if(_0x584a57[_0x86d3('0x6b')]===_0x86d3('0x91')){_0x5004cd['where'](_0x584a57[_0x86d3('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}else{_0x5004cd[_0x86d3('0x35')](_0x584a57[_0x86d3('0x6b')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}if(_0x10e23d){logger[_0x86d3('0x94')](_0x86d3('0x95'),_0x5004cd[_0x86d3('0x7c')]());require(_0x86d3('0x96'))[_0x86d3('0x97')](path[_0x86d3('0x50')](__dirname,_0x86d3('0x98'),_0x10e23d[_0x86d3('0x89')]),[_0x10e23d['id'],_0x5004cd[_0x86d3('0x7c')](),path[_0x86d3('0x50')](__dirname,_0x86d3('0x99'),_0x10e23d[_0x86d3('0x9a')]),_0x3b989c]);return _0x10e23d;}else{var _0x428b11=squel[_0x86d3('0x9b')]();_0x428b11[_0x86d3('0x6a')]('('+_0x5004cd['toString']()+')',_0x86d3('0x9c'));_0x428b11[_0x86d3('0x63')](_0x86d3('0x9d'),_0x86d3('0x1b'));_0x5004cd['limit'](_0x3a1acc[_0x86d3('0x1a')]||_0x245b39);_0x5004cd['offset'](_0x3a1acc['offset']||0x0);return dbH[_0x86d3('0x9e')][_0x86d3('0x2c')](_0x428b11[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]})[_0x86d3('0x1f')](function(_0x4777f1){if(!_0x4777f1['length']){_0x682a6d=0x0;}else{_0x682a6d=_0x4777f1[0x0]['count']||0x0;}return dbH['sequelize'][_0x86d3('0x2c')](_0x5004cd[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')]['QueryTypes'][_0x86d3('0x7e')]});})['then'](function(_0x435b8e){return{'rows':_0x435b8e||[],'count':_0x682a6d};});}});}exports[_0x86d3('0x9f')]=function(_0x73b8e6,_0x2c98e1){return runReport(_0x73b8e6['params'],_0x73b8e6[_0x86d3('0x2c')],_0x73b8e6[_0x86d3('0x3a')])[_0x86d3('0x1f')](respondWithResult(_0x2c98e1,null))['catch'](handleError(_0x2c98e1,null));};exports['runReport']=runReport;exports['query']=function(_0x458997,_0x1e3559){var _0x49a101=0xa;var _0x38d724=['join',_0x86d3('0x7f'),_0x86d3('0x51'),_0x86d3('0x52')];var _0x56ff91={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1f347e={'SEC_TO_TIME':_0x86d3('0xa0'),'DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x45b210=function(_0x144e43){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x144e43);};var _0xdc7c21=function(_0x2e0397){if(!_0x2e0397||!_0x2e0397[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x2cc617='(',_0x25339c=0x0;_0x25339c<_0x2e0397['rules'][_0x86d3('0x30')];_0x25339c+=0x1){_0x25339c>0x0&&(_0x2cc617+='\x20'+_0x2e0397[_0x86d3('0x61')]+'\x20');_0x2cc617+=_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]?_0xdc7c21(_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]):_0x2e0397['rules'][_0x25339c][_0x86d3('0x63')]+'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x64')]+(_0x45b210(_0x2e0397[_0x86d3('0x60')][_0x25339c]['condition'])?'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x65')]:'');}return _0x2cc617+')';};var _0x2c0070={'where':{'id':_0x458997[_0x86d3('0x4e')]['id']}},_0x31d436,_0x56e713,_0x525559,_0x3b9e1e,_0x1d8d7c;_0x2c0070=_['merge']({},_0x2c0070,_0x458997[_0x86d3('0x3a')]);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x2c0070)[_0x86d3('0x1f')](function(_0x1f80be){if(_0x1f80be){_0x31d436=_0x1f80be;return _0x1f80be[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x3dddbe){if(_0x3dddbe){if(!_0x3dddbe[_0x86d3('0x30')]){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x56e713=_0x3dddbe;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1d7e83){if(_0x1d7e83){_0x525559=_[_0x86d3('0x69')](_0x1d7e83,'id');var _0x5d9385;var _0x49a499=squel[_0x86d3('0x9b')]();_0x49a499[_0x86d3('0x6a')](_0x31d436[_0x86d3('0x6b')]);for(var _0x33e0a5=0x0;_0x33e0a5<_0x56e713['length'];_0x33e0a5+=0x1){_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6c')]?_0x525559[_0x56e713[_0x33e0a5][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x56e713[_0x33e0a5][_0x86d3('0x63')];_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6e')]?_['replace'](_0x56ff91[_0x56e713[_0x33e0a5][_0x86d3('0x6e')]],'%s',_0x5d9385):_0x5d9385;_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x1f347e[_0x56e713[_0x33e0a5]['format']],'%s',_0x5d9385):_0x5d9385;if(_0x56e713[_0x33e0a5][_0x86d3('0x71')]){_0x49a499['group'](_0x5d9385);}_0x56e713[_0x33e0a5][_0x86d3('0x72')]&&_0x49a499[_0x86d3('0x33')](_0x5d9385,_0x56e713[_0x33e0a5]['orderBy']===_0x86d3('0x87')?![]:!![]);_0x49a499[_0x86d3('0x63')](_0x5d9385,_0x56e713[_0x33e0a5][_0x86d3('0x73')]||_0x5d9385);}if(_0x31d436[_0x86d3('0x74')]){_0x31d436[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x31d436['joins']);for(var _0x10af91=0x0;_0x10af91<_0x31d436['joins'][_0x86d3('0x30')];_0x10af91+=0x1){if(_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x38d724,_0x31d436['joins'][_0x10af91][_0x86d3('0x29')])&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')]&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x77')]&&_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignKey']){_0x49a499[_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]](_0x31d436['joins'][_0x10af91]['foreignTable'],null,util[_0x86d3('0x70')]('%s.%s\x20=\x20%s.%s',_0x31d436['table'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')],_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignTable'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x78')]));}}}if(_0x31d436[_0x86d3('0x79')]){_0x31d436[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x31d436['conditions']);_0x49a499[_0x86d3('0x35')](_0xdc7c21(_0x31d436[_0x86d3('0x79')]['group']));}_0x1d8d7c=_0x49a499['clone']();_0x49a499['limit'](_0x49a101);_0x49a499[_0x86d3('0x18')](0x0);logger['debug']('Limited\x20Query:',_0x49a499[_0x86d3('0x7c')]());return dbH[_0x86d3('0x9e')]['query'](_0x49a499['toString'](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})['then'](function(){return{'sql':_0x1d8d7c[_0x86d3('0x7c')]()};})[_0x86d3('0x1f')](respondWithResult(_0x1e3559,null))[_0x86d3('0x44')](handleError(_0x1e3559,null));}; \ No newline at end of file +var _0xdbf5=['includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','debug','Limited\x20Query:','toString','SELECT','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','IS\x20EMPTY','ValidationErrorItem','metric','DESC','clone','output','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','QueryTypes','run','Sequelize','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','end','status','json','limit','undefined','count','set','Content-Range','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','catch','update','join','left_join','right_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x396882,_0x18a0d4){_0x396882=_0x396882-0x0;var _0xa67f38=_0xdbf5[_0x396882];return _0xa67f38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5dbf('0x16'))[_0x5dbf('0x17')];function respondWithStatusCode(_0x1453a9,_0x7cb848){_0x7cb848=_0x7cb848||0xcc;return function(_0x14493a){if(_0x14493a){return _0x1453a9['sendStatus'](_0x7cb848);}return _0x1453a9['status'](_0x7cb848)[_0x5dbf('0x18')]();};}function respondWithResult(_0x3480c8,_0x48e7fd){_0x48e7fd=_0x48e7fd||0xc8;return function(_0x19624e){if(_0x19624e){return _0x3480c8[_0x5dbf('0x19')](_0x48e7fd)[_0x5dbf('0x1a')](_0x19624e);}};}function respondWithFilteredResult(_0x2dfa44,_0x181816){return function(_0x472eb9){if(_0x472eb9){var _0x2d32cc=typeof _0x181816['offset']==='undefined'&&typeof _0x181816[_0x5dbf('0x1b')]===_0x5dbf('0x1c');var _0x39c7aa=_0x472eb9[_0x5dbf('0x1d')];var _0x20c2b0=_0x2d32cc?0x0:_0x181816['offset'];var _0x11cd00=_0x2d32cc?_0x472eb9['count']:_0x181816['offset']+_0x181816['limit'];var _0x23d1e7;if(_0x11cd00>=_0x39c7aa){_0x11cd00=_0x39c7aa;_0x23d1e7=0xc8;}else{_0x23d1e7=0xce;}_0x2dfa44[_0x5dbf('0x19')](_0x23d1e7);return _0x2dfa44[_0x5dbf('0x1e')](_0x5dbf('0x1f'),_0x20c2b0+'-'+_0x11cd00+'/'+_0x39c7aa)[_0x5dbf('0x1a')](_0x472eb9);}return null;};}function patchUpdates(_0x5b2518){return function(_0x2764ea){try{jsonpatch['apply'](_0x2764ea,_0x5b2518,!![]);}catch(_0xb68f92){return BPromise[_0x5dbf('0x20')](_0xb68f92);}return _0x2764ea[_0x5dbf('0x21')]();};}function saveUpdates(_0x43a612,_0x3b763c){return function(_0x2f154e){if(_0x2f154e){return _0x2f154e['update'](_0x43a612)[_0x5dbf('0x22')](function(_0x3e3a2d){return _0x3e3a2d;});}return null;};}function removeEntity(_0x2d3e1b,_0x2079fc){return function(_0x2763ec){if(_0x2763ec){return _0x2763ec[_0x5dbf('0x23')]()[_0x5dbf('0x22')](function(){var _0x20ab1b=_0x2763ec[_0x5dbf('0x24')]({'plain':!![]});var _0x15a790=_0x5dbf('0x25');return db[_0x5dbf('0x26')][_0x5dbf('0x23')]({'where':{'type':_0x15a790,'resourceId':_0x20ab1b['id']}})[_0x5dbf('0x22')](function(){return _0x2763ec;});})[_0x5dbf('0x22')](function(){_0x2d3e1b[_0x5dbf('0x19')](0xcc)[_0x5dbf('0x18')]();});}};}function handleEntityNotFound(_0x3f8341,_0x159e61){return function(_0x22ec42){if(!_0x22ec42){_0x3f8341[_0x5dbf('0x27')](0x194);}return _0x22ec42;};}function handleError(_0x471027,_0x21cd00){_0x21cd00=_0x21cd00||0x1f4;return function(_0x5768b7){logger[_0x5dbf('0x28')](_0x5768b7[_0x5dbf('0x29')]);if(_0x5768b7[_0x5dbf('0x2a')]){delete _0x5768b7[_0x5dbf('0x2a')];}_0x471027[_0x5dbf('0x19')](_0x21cd00)[_0x5dbf('0x2b')](_0x5768b7);};}exports[_0x5dbf('0x2c')]=function(_0x31d57a,_0x406ce6){var _0x273b63={},_0x294dd7={},_0x50a307={'count':0x0,'rows':[]};var _0x4c1587=_[_0x5dbf('0x2d')](db[_0x5dbf('0x2e')][_0x5dbf('0x2f')],function(_0x3b73ad){return{'name':_0x3b73ad[_0x5dbf('0x30')],'type':_0x3b73ad['type']['key']};});_0x294dd7[_0x5dbf('0x31')]=_[_0x5dbf('0x2d')](_0x4c1587,'name');_0x294dd7[_0x5dbf('0x32')]=_[_0x5dbf('0x33')](_0x31d57a[_0x5dbf('0x32')]);_0x294dd7[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x294dd7['model'],_0x294dd7[_0x5dbf('0x32')]);_0x273b63[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x294dd7[_0x5dbf('0x31')],qs[_0x5dbf('0x37')](_0x31d57a['query'][_0x5dbf('0x37')]));_0x273b63[_0x5dbf('0x36')]=_0x273b63[_0x5dbf('0x36')][_0x5dbf('0x38')]?_0x273b63['attributes']:_0x294dd7[_0x5dbf('0x31')];if(!_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x39')](_0x5dbf('0x3a'))){_0x273b63[_0x5dbf('0x1b')]=qs[_0x5dbf('0x1b')](_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x1b')]);_0x273b63[_0x5dbf('0x3b')]=qs[_0x5dbf('0x3b')](_0x31d57a[_0x5dbf('0x32')]['offset']);}_0x273b63[_0x5dbf('0x3c')]=qs[_0x5dbf('0x3d')](_0x31d57a[_0x5dbf('0x32')]['sort']);_0x273b63[_0x5dbf('0x3e')]=qs[_0x5dbf('0x34')](_[_0x5dbf('0x3f')](_0x31d57a['query'],_0x294dd7[_0x5dbf('0x34')]),_0x4c1587);if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x40')]){_0x273b63['where']=_[_0x5dbf('0x41')](_0x273b63[_0x5dbf('0x3e')],{'$or':_[_0x5dbf('0x2d')](_0x4c1587,function(_0x260c9f){if(_0x260c9f[_0x5dbf('0x42')]!==_0x5dbf('0x43')){var _0x321ae3={};_0x321ae3[_0x260c9f[_0x5dbf('0x2a')]]={'$like':'%'+_0x31d57a['query']['filter']+'%'};return _0x321ae3;}})});}_0x273b63=_['merge']({},_0x273b63,_0x31d57a['options']);var _0x28b28f={'where':_0x273b63[_0x5dbf('0x3e')]};return db['AnalyticDefaultReport'][_0x5dbf('0x1d')](_0x28b28f)[_0x5dbf('0x22')](function(_0x5a60e8){_0x50a307[_0x5dbf('0x1d')]=_0x5a60e8;if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x44')]){_0x273b63[_0x5dbf('0x45')]=[{'all':!![]}];}return db[_0x5dbf('0x2e')][_0x5dbf('0x46')](_0x273b63);})[_0x5dbf('0x22')](function(_0x1c020a){_0x50a307[_0x5dbf('0x47')]=_0x1c020a;return _0x50a307;})[_0x5dbf('0x22')](respondWithFilteredResult(_0x406ce6,_0x273b63))['catch'](handleError(_0x406ce6,null));};exports[_0x5dbf('0x48')]=function(_0x22f958,_0xec1d28){var _0x50880d={'raw':!![],'where':{'id':_0x22f958[_0x5dbf('0x49')]['id']}},_0x16b0ff={};_0x16b0ff[_0x5dbf('0x31')]=_[_0x5dbf('0x33')](db['AnalyticDefaultReport'][_0x5dbf('0x2f')]);_0x16b0ff['query']=_[_0x5dbf('0x33')](_0x22f958[_0x5dbf('0x32')]);_0x16b0ff[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x16b0ff['model'],_0x16b0ff['query']);_0x50880d[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x16b0ff[_0x5dbf('0x31')],qs['fields'](_0x22f958[_0x5dbf('0x32')]['fields']));_0x50880d['attributes']=_0x50880d['attributes']['length']?_0x50880d[_0x5dbf('0x36')]:_0x16b0ff[_0x5dbf('0x31')];if(_0x22f958['query'][_0x5dbf('0x44')]){_0x50880d[_0x5dbf('0x45')]=[{'all':!![]}];}_0x50880d=_['merge']({},_0x50880d,_0x22f958[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')]['find'](_0x50880d)[_0x5dbf('0x22')](handleEntityNotFound(_0xec1d28,null))['then'](respondWithResult(_0xec1d28,null))['catch'](handleError(_0xec1d28,null));};exports[_0x5dbf('0x4b')]=function(_0x2a3d30,_0x17a1c0){return db['AnalyticDefaultReport']['create'](_0x2a3d30[_0x5dbf('0x4c')],{})[_0x5dbf('0x22')](function(_0x21f477){var _0x307a00=_0x2a3d30[_0x5dbf('0x4d')][_0x5dbf('0x24')]({'plain':!![]});if(!_0x307a00)throw new Error(_0x5dbf('0x4e'));if(_0x307a00[_0x5dbf('0x4f')]==='user'){var _0x3f38a0=_0x21f477[_0x5dbf('0x24')]({'plain':!![]});var _0x2927a3=_0x5dbf('0x50');return db[_0x5dbf('0x51')][_0x5dbf('0x52')]({'where':{'name':_0x2927a3,'userProfileId':_0x307a00[_0x5dbf('0x53')]},'raw':!![]})['then'](function(_0x1b0b13){if(_0x1b0b13&&_0x1b0b13['autoAssociation']===0x0){return db[_0x5dbf('0x26')][_0x5dbf('0x4b')]({'name':_0x3f38a0[_0x5dbf('0x2a')],'resourceId':_0x3f38a0['id'],'type':_0x5dbf('0x25'),'sectionId':_0x1b0b13['id']},{})[_0x5dbf('0x22')](function(){return _0x21f477;});}else{return _0x21f477;}})[_0x5dbf('0x54')](function(_0x353d0f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x353d0f);throw _0x353d0f;});}return _0x21f477;})['then'](respondWithResult(_0x17a1c0,0xc9))[_0x5dbf('0x54')](handleError(_0x17a1c0,null));};exports[_0x5dbf('0x55')]=function(_0x36a787,_0x56c8b2){if(_0x36a787['body']['id']){delete _0x36a787[_0x5dbf('0x4c')]['id'];}return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x36a787['params']['id']}})[_0x5dbf('0x22')](handleEntityNotFound(_0x56c8b2,null))['then'](saveUpdates(_0x36a787[_0x5dbf('0x4c')],null))[_0x5dbf('0x22')](respondWithResult(_0x56c8b2,null))[_0x5dbf('0x54')](handleError(_0x56c8b2,null));};exports['destroy']=function(_0x55fd51,_0x1b316d){return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x55fd51[_0x5dbf('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b316d,null))[_0x5dbf('0x22')](removeEntity(_0x1b316d,null))[_0x5dbf('0x54')](handleError(_0x1b316d,null));};exports['preview']=function(_0x5485f3,_0x19ec03){var _0x14bdb1=0xa;var _0x197e8c=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),'cross_join'];var _0x4107f1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5dbf('0x59'),'MIN':'MIN(%s)','AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x461ffb={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x3a84c2=function(_0x2ca889){return!_[_0x5dbf('0x63')]([_0x5dbf('0x64'),_0x5dbf('0x65'),'IS\x20EMPTY',_0x5dbf('0x66')],_0x2ca889);};var _0x553be4=function(_0xb0a9bf){if(!_0xb0a9bf||!_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x110224='(',_0x5a975a=0x0;_0x5a975a<_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')];_0x5a975a+=0x1){_0x5a975a>0x0&&(_0x110224+='\x20'+_0xb0a9bf[_0x5dbf('0x68')]+'\x20');_0x110224+=_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x69')]?_0x553be4(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a]['group']):_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6a')]+'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')]+(_0x3a84c2(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')])?'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6c')]:'');}return _0x110224+')';};var _0x12d69b={'where':{'id':_0x5485f3[_0x5dbf('0x49')]['id']}},_0x3b53da,_0x13c8ab,_0x2997a8,_0x5d7a37,_0x52109d;_0x12d69b=_[_0x5dbf('0x41')]({},_0x12d69b,_0x5485f3[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x12d69b)[_0x5dbf('0x22')](function(_0x1b42cf){if(_0x1b42cf){_0x3b53da=_0x1b42cf;return _0x1b42cf[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x57c568){if(_0x57c568){if(!_0x57c568['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x5dbf('0x6e'),0x193);}_0x13c8ab=_0x57c568;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x29c4d9){if(_0x29c4d9){_0x2997a8=_[_0x5dbf('0x70')](_0x29c4d9,'id');var _0x5331ff;var _0x5bb990=squel[_0x5dbf('0x71')]();_0x5bb990[_0x5dbf('0x72')](_0x3b53da['table']);for(var _0x1728b9=0x0;_0x1728b9<_0x13c8ab[_0x5dbf('0x38')];_0x1728b9+=0x1){_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]?_0x2997a8[_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]]['metric']:_0x13c8ab[_0x1728b9][_0x5dbf('0x6a')];_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4107f1[_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]],'%s',_0x5331ff):_0x5331ff;_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]?_['replace'](_0x461ffb[_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]],'%s',_0x5331ff):_0x5331ff;if(_0x13c8ab[_0x1728b9][_0x5dbf('0x77')]){_0x5bb990[_0x5dbf('0x69')](_0x5331ff);}_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]&&_0x5bb990['order'](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]==='DESC'?![]:!![]);_0x5bb990[_0x5dbf('0x6a')](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x79')]||_0x5331ff);}if(_0x3b53da[_0x5dbf('0x7a')]){_0x3b53da['joins']=JSON[_0x5dbf('0x7b')](_0x3b53da[_0x5dbf('0x7a')]);for(var _0x4166ce=0x0;_0x4166ce<_0x3b53da[_0x5dbf('0x7a')]['length'];_0x4166ce+=0x1){if(_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x197e8c,_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')])&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce]['parentKey']&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')]&&_0x3b53da['joins'][_0x4166ce][_0x5dbf('0x7d')]){_0x5bb990[_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]](_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')](_0x5dbf('0x7e'),_0x3b53da[_0x5dbf('0x7f')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x80')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7d')]));}}}if(_0x3b53da[_0x5dbf('0x81')]){_0x3b53da[_0x5dbf('0x81')]=JSON['parse'](_0x3b53da[_0x5dbf('0x81')]);_0x5bb990[_0x5dbf('0x3e')](_0x553be4(_0x3b53da[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x52109d=_0x5bb990['clone']();_0x5bb990[_0x5dbf('0x1b')](_0x14bdb1);_0x5bb990[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')](_0x5dbf('0x83'),_0x5bb990[_0x5dbf('0x84')]());return dbH['sequelize'][_0x5dbf('0x32')](_0x5bb990[_0x5dbf('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0x5dbf('0x85')]});}})[_0x5dbf('0x22')](respondWithResult(_0x19ec03,null))[_0x5dbf('0x54')](handleError(_0x19ec03,null));};function runReport(_0x8ca7de,_0x14b21b,_0x23ec75){var _0x22339b=_0x14b21b['name'];var _0x310078=0xa;var _0x3b01c0=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x4cceb1={'SUM':_0x5dbf('0x87'),'COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5924d2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x4333db=function(_0x4cb92d){return!_['includes']([_0x5dbf('0x64'),'IS\x20NOT\x20NULL',_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x4cb92d);};var _0x541241=function(_0x3c7eaa){if(!_0x3c7eaa||!_0x3c7eaa['rules'][_0x5dbf('0x38')]){return'';}for(var _0x24d90a='(',_0xa3e94f=0x0;_0xa3e94f<_0x3c7eaa[_0x5dbf('0x67')][_0x5dbf('0x38')];_0xa3e94f+=0x1){_0xa3e94f>0x0&&(_0x24d90a+='\x20'+_0x3c7eaa['operator']+'\x20');_0x24d90a+=_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]?_0x541241(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]):_0x3c7eaa['rules'][_0xa3e94f][_0x5dbf('0x6a')]+'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')]+(_0x4333db(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')])?'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6c')]:'');}return _0x24d90a+')';};var _0x334f63={'where':{'id':_0x8ca7de['id']}},_0x5ac29f,_0x533fdd,_0x5bf068,_0x1bd06b,_0x274497;_0x334f63=_['merge']({},_0x334f63,_0x23ec75);return db['AnalyticDefaultReport']['find'](_0x334f63)[_0x5dbf('0x22')](function(_0x20bda9){if(_0x20bda9){_0x5ac29f=_0x20bda9;return _0x20bda9[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x12757d){if(_0x12757d){if(!_0x12757d[_0x5dbf('0x38')]){throw new db['Sequelize'][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x533fdd=_0x12757d;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x5722b3){if(_0x5722b3){_0x5bf068=_['keyBy'](_0x5722b3,'id');var _0x3a27c4;var _0x3620d2=squel[_0x5dbf('0x71')]();_0x3620d2['from'](_0x5ac29f[_0x5dbf('0x7f')]);for(var _0x447259=0x0;_0x447259<_0x533fdd['length'];_0x447259+=0x1){_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x73')]?_0x5bf068[_0x533fdd[_0x447259][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x533fdd[_0x447259][_0x5dbf('0x6a')];_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4cceb1[_0x533fdd[_0x447259][_0x5dbf('0x74')]],'%s',_0x3a27c4):_0x3a27c4;_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x76')]?_['replace'](_0x5924d2[_0x533fdd[_0x447259]['format']],'%s',_0x3a27c4):_0x3a27c4;if(_0x533fdd[_0x447259]['groupBy']){_0x3620d2[_0x5dbf('0x69')](_0x3a27c4);}_0x533fdd[_0x447259][_0x5dbf('0x78')]&&_0x3620d2[_0x5dbf('0x3c')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x78')]===_0x5dbf('0x8e')?![]:!![]);_0x3620d2[_0x5dbf('0x6a')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x79')]||_0x3a27c4);}if(_0x5ac29f[_0x5dbf('0x7a')]){_0x5ac29f[_0x5dbf('0x7a')]=JSON[_0x5dbf('0x7b')](_0x5ac29f['joins']);for(var _0x2ded2b=0x0;_0x2ded2b<_0x5ac29f[_0x5dbf('0x7a')][_0x5dbf('0x38')];_0x2ded2b+=0x1){if(_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x3b01c0,_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')])&&_0x5ac29f['joins'][_0x2ded2b]['parentKey']&&_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b]['foreignTable']&&_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7d')]){_0x3620d2[_0x5ac29f['joins'][_0x2ded2b]['type']](_0x5ac29f['joins'][_0x2ded2b]['foreignTable'],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x5ac29f[_0x5dbf('0x7f')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x80')],_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7c')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x7d')]));}}}if(_0x5ac29f['conditions']){_0x5ac29f[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x5ac29f[_0x5dbf('0x81')]);_0x3620d2['where'](_0x541241(_0x5ac29f[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x274497=_0x3620d2[_0x5dbf('0x8f')]();_0x3620d2['limit'](_0x310078);_0x3620d2[_0x5dbf('0x3b')](0x0);return;}})[_0x5dbf('0x22')](function(){if(_0x14b21b[_0x5dbf('0x90')]==='web'){return null;}var _0x48a8c5=_['merge'](_0x14b21b,{'name':_0x14b21b[_0x5dbf('0x91')]||_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f[_0x5dbf('0x2a')],'basename':_0x22339b,'savename':util[_0x5dbf('0x76')](_0x5dbf('0x92'),_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f['name'],require(_0x5dbf('0x93'))[_0x5dbf('0x94')](0x4),_0x14b21b[_0x5dbf('0x90')]||'csv'),'reportId':_0x5ac29f['id'],'reportType':_0x5dbf('0x95')});return db[_0x5dbf('0x96')][_0x5dbf('0x4b')](_0x48a8c5,{'raw':!![]});})[_0x5dbf('0x22')](function(_0x2afbd4){if(_0x5ac29f[_0x5dbf('0x7f')]===_0x5dbf('0x97')){_0x274497['where'](_0x5ac29f[_0x5dbf('0x7f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b[_0x5dbf('0x98')],_0x14b21b[_0x5dbf('0x99')]);}else{_0x274497[_0x5dbf('0x3e')](_0x5ac29f['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b['startDate'],_0x14b21b[_0x5dbf('0x99')]);}if(_0x2afbd4){logger[_0x5dbf('0x9a')]('Run\x20Query:',_0x274497[_0x5dbf('0x84')]());require('child_process')[_0x5dbf('0x9b')](path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9c'),_0x2afbd4['output']),[_0x2afbd4['id'],_0x274497[_0x5dbf('0x84')](),path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9d'),_0x2afbd4[_0x5dbf('0x9e')]),_0x22339b]);return _0x2afbd4;}else{var _0x4bc5af=squel[_0x5dbf('0x71')]();_0x4bc5af[_0x5dbf('0x72')]('('+_0x274497['toString']()+')',_0x5dbf('0x9f'));_0x4bc5af['field'](_0x5dbf('0xa0'),_0x5dbf('0x1d'));_0x274497[_0x5dbf('0x1b')](_0x14b21b['limit']||_0x310078);_0x274497[_0x5dbf('0x3b')](_0x14b21b[_0x5dbf('0x3b')]||0x0);return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x4bc5af[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')]['QueryTypes'][_0x5dbf('0x85')]})['then'](function(_0x6cfb82){if(!_0x6cfb82[_0x5dbf('0x38')]){_0x1bd06b=0x0;}else{_0x1bd06b=_0x6cfb82[0x0][_0x5dbf('0x1d')]||0x0;}return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x274497[_0x5dbf('0x84')](),{'type':dbH['sequelize'][_0x5dbf('0xa2')][_0x5dbf('0x85')]});})[_0x5dbf('0x22')](function(_0x4d68f6){return{'rows':_0x4d68f6||[],'count':_0x1bd06b};});}});}exports[_0x5dbf('0xa3')]=function(_0x47ac95,_0x51b241){return runReport(_0x47ac95[_0x5dbf('0x49')],_0x47ac95[_0x5dbf('0x32')],_0x47ac95[_0x5dbf('0x4a')])[_0x5dbf('0x22')](respondWithResult(_0x51b241,null))[_0x5dbf('0x54')](handleError(_0x51b241,null));};exports['runReport']=runReport;exports['query']=function(_0x4f38a0,_0x144300){var _0x1da1e3=0xa;var _0x25e681=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x236754={'SUM':'SUM(%s)','COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x191a16={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x51b0df=function(_0x48ea8a){return!_['includes']([_0x5dbf('0x64'),_0x5dbf('0x65'),_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x48ea8a);};var _0x3de263=function(_0x4f8dde){if(!_0x4f8dde||!_0x4f8dde[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x19effa='(',_0x29177e=0x0;_0x29177e<_0x4f8dde[_0x5dbf('0x67')]['length'];_0x29177e+=0x1){_0x29177e>0x0&&(_0x19effa+='\x20'+_0x4f8dde[_0x5dbf('0x68')]+'\x20');_0x19effa+=_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x69')]?_0x3de263(_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['group']):_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6a')]+'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')]+(_0x51b0df(_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')])?'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['value']:'');}return _0x19effa+')';};var _0x4899ac={'where':{'id':_0x4f38a0['params']['id']}},_0x51864c,_0x4562a4,_0x240304,_0x5df275,_0xc588a2;_0x4899ac=_[_0x5dbf('0x41')]({},_0x4899ac,_0x4f38a0['options']);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x4899ac)[_0x5dbf('0x22')](function(_0x2eafe0){if(_0x2eafe0){_0x51864c=_0x2eafe0;return _0x2eafe0[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x414859){if(_0x414859){if(!_0x414859['length']){throw new db[(_0x5dbf('0xa4'))][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x4562a4=_0x414859;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x153401){if(_0x153401){_0x240304=_[_0x5dbf('0x70')](_0x153401,'id');var _0xbe0ca0;var _0x521c72=squel[_0x5dbf('0x71')]();_0x521c72[_0x5dbf('0x72')](_0x51864c[_0x5dbf('0x7f')]);for(var _0x6b4262=0x0;_0x6b4262<_0x4562a4[_0x5dbf('0x38')];_0x6b4262+=0x1){_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x73')]?_0x240304[_0x4562a4[_0x6b4262][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x4562a4[_0x6b4262][_0x5dbf('0x6a')];_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x236754[_0x4562a4[_0x6b4262][_0x5dbf('0x74')]],'%s',_0xbe0ca0):_0xbe0ca0;_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x76')]?_[_0x5dbf('0x75')](_0x191a16[_0x4562a4[_0x6b4262][_0x5dbf('0x76')]],'%s',_0xbe0ca0):_0xbe0ca0;if(_0x4562a4[_0x6b4262][_0x5dbf('0x77')]){_0x521c72[_0x5dbf('0x69')](_0xbe0ca0);}_0x4562a4[_0x6b4262][_0x5dbf('0x78')]&&_0x521c72[_0x5dbf('0x3c')](_0xbe0ca0,_0x4562a4[_0x6b4262]['orderBy']===_0x5dbf('0x8e')?![]:!![]);_0x521c72['field'](_0xbe0ca0,_0x4562a4[_0x6b4262][_0x5dbf('0x79')]||_0xbe0ca0);}if(_0x51864c['joins']){_0x51864c[_0x5dbf('0x7a')]=JSON['parse'](_0x51864c[_0x5dbf('0x7a')]);for(var _0x417869=0x0;_0x417869<_0x51864c[_0x5dbf('0x7a')]['length'];_0x417869+=0x1){if(_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x25e681,_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')])&&_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x80')]&&_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')]&&_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignKey']){_0x521c72[_0x51864c[_0x5dbf('0x7a')][_0x417869]['type']](_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x51864c[_0x5dbf('0x7f')],_0x51864c['joins'][_0x417869]['parentKey'],_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignTable'],_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x7d')]));}}}if(_0x51864c[_0x5dbf('0x81')]){_0x51864c[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x51864c[_0x5dbf('0x81')]);_0x521c72[_0x5dbf('0x3e')](_0x3de263(_0x51864c[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0xc588a2=_0x521c72[_0x5dbf('0x8f')]();_0x521c72[_0x5dbf('0x1b')](_0x1da1e3);_0x521c72[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')]('Limited\x20Query:',_0x521c72[_0x5dbf('0x84')]());return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x521c72[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')][_0x5dbf('0xa2')]['SELECT']});}})[_0x5dbf('0x22')](function(){return{'sql':_0xc588a2[_0x5dbf('0x84')]()};})[_0x5dbf('0x22')](respondWithResult(_0x144300,null))[_0x5dbf('0x54')](handleError(_0x144300,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 275a776..420ec2a 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 _0xd70a=['bluebird','request-promise','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','moment'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xd70a,0x1d0));var _0xad70=function(_0x27031e,_0x1eb8cd){_0x27031e=_0x27031e-0x0;var _0xfd46b3=_0xd70a[_0x27031e];return _0xfd46b3;};'use strict';var _=require(_0xad70('0x0'));var util=require('util');var logger=require(_0xad70('0x1'))(_0xad70('0x2'));var moment=require(_0xad70('0x3'));var BPromise=require(_0xad70('0x4'));var rp=require(_0xad70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad70('0x6'));var config=require('../../config/environment');var attributes=require(_0xad70('0x7'));module[_0xad70('0x8')]=function(_0x3459d4,_0x26055e){return _0x3459d4[_0xad70('0x9')](_0xad70('0xa'),attributes,{'tableName':_0xad70('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb85=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','bluebird'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xcb85,0x1e8));var _0x5cb8=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0xcb85[_0x49fcfb];return _0x964926;};'use strict';var _=require(_0x5cb8('0x0'));var util=require(_0x5cb8('0x1'));var logger=require(_0x5cb8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5cb8('0x3'));var rp=require(_0x5cb8('0x4'));var fs=require('fs');var path=require(_0x5cb8('0x5'));var rimraf=require(_0x5cb8('0x6'));var config=require(_0x5cb8('0x7'));var attributes=require(_0x5cb8('0x8'));module['exports']=function(_0x158c50,_0x4ee115){return _0x158c50[_0x5cb8('0x9')](_0x5cb8('0xa'),attributes,{'tableName':_0x5cb8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 7fee6c0..8f703aa 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 _0x9554=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x3cb12c,_0x3530f9){var _0x166ef4=function(_0x3e0da){while(--_0x3e0da){_0x3cb12c['push'](_0x3cb12c['shift']());}};_0x166ef4(++_0x3530f9);}(_0x9554,0x105));var _0x4955=function(_0x237c30,_0x4f9ab4){_0x237c30=_0x237c30-0x0;var _0x82d572=_0x9554[_0x237c30];return _0x82d572;};'use strict';var _=require(_0x4955('0x0'));var util=require(_0x4955('0x1'));var moment=require(_0x4955('0x2'));var BPromise=require(_0x4955('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4955('0x4'));var db=require(_0x4955('0x5'))['db'];var utils=require(_0x4955('0x6'));var logger=require(_0x4955('0x7'))(_0x4955('0x8'));var config=require('../../config/environment');var jayson=require(_0x4955('0x9'));var client=jayson['client'][_0x4955('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5632f8,_0x21229e,_0x205d9a){return new BPromise(function(_0x4e51f6,_0x26c61d){return client['request'](_0x5632f8,_0x205d9a)['then'](function(_0x11eac4){logger['info'](_0x4955('0xb'),_0x21229e,'request\x20sent');logger[_0x4955('0xc')](_0x4955('0xd'),_0x21229e,_0x4955('0xe'),JSON[_0x4955('0xf')](_0x11eac4));if(_0x11eac4[_0x4955('0x10')]){if(_0x11eac4['error'][_0x4955('0x11')]===0x1f4){logger['error'](_0x4955('0xb'),_0x21229e,_0x11eac4['error'][_0x4955('0x12')]);return _0x26c61d(_0x11eac4[_0x4955('0x10')]['message']);}logger['error'](_0x4955('0xb'),_0x21229e,_0x11eac4[_0x4955('0x10')]['message']);return _0x4e51f6(_0x11eac4[_0x4955('0x10')][_0x4955('0x12')]);}else{logger['info'](_0x4955('0xb'),_0x21229e,'request\x20sent');_0x4e51f6(_0x11eac4[_0x4955('0x13')][_0x4955('0x12')]);}})[_0x4955('0x14')](function(_0x5e9a2e){logger[_0x4955('0x10')](_0x4955('0xb'),_0x21229e,_0x5e9a2e);_0x26c61d(_0x5e9a2e);});});} \ No newline at end of file +var _0x22af=['client','http','then','info','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','AnalyticDefaultReport,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x42b669,_0x5c50c4){var _0x4b7d33=function(_0x15e1c7){while(--_0x15e1c7){_0x42b669['push'](_0x42b669['shift']());}};_0x4b7d33(++_0x5c50c4);}(_0x22af,0x171));var _0xf22a=function(_0x4df17c,_0x2d2b61){_0x4df17c=_0x4df17c-0x0;var _0x4e79b5=_0x22af[_0x4df17c];return _0x4e79b5;};'use strict';var _=require(_0xf22a('0x0'));var util=require('util');var moment=require(_0xf22a('0x1'));var BPromise=require(_0xf22a('0x2'));var rs=require(_0xf22a('0x3'));var fs=require('fs');var Redis=require(_0xf22a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf22a('0x5'));var logger=require('../../config/logger')(_0xf22a('0x6'));var config=require(_0xf22a('0x7'));var jayson=require(_0xf22a('0x8'));var client=jayson[_0xf22a('0x9')][_0xf22a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x428935,_0x4bc931,_0x149e9f){return new BPromise(function(_0x5204ad,_0x5f170d){return client['request'](_0x428935,_0x149e9f)[_0xf22a('0xb')](function(_0x1e0f8b){logger[_0xf22a('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4bc931,_0xf22a('0xd'));logger['debug'](_0xf22a('0xe'),_0x4bc931,'request\x20sent',JSON[_0xf22a('0xf')](_0x1e0f8b));if(_0x1e0f8b['error']){if(_0x1e0f8b['error'][_0xf22a('0x10')]===0x1f4){logger[_0xf22a('0x11')](_0xf22a('0x12'),_0x4bc931,_0x1e0f8b['error']['message']);return _0x5f170d(_0x1e0f8b[_0xf22a('0x11')][_0xf22a('0x13')]);}logger[_0xf22a('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4bc931,_0x1e0f8b['error'][_0xf22a('0x13')]);return _0x5204ad(_0x1e0f8b['error'][_0xf22a('0x13')]);}else{logger[_0xf22a('0xc')](_0xf22a('0x12'),_0x4bc931,_0xf22a('0xd'));_0x5204ad(_0x1e0f8b['result']['message']);}})[_0xf22a('0x14')](function(_0x3b4f4f){logger['error'](_0xf22a('0x12'),_0x4bc931,_0x3b4f4f);_0x5f170d(_0x3b4f4f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 788d517..d091e65 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 _0xf9d8=['../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x13e42f,_0x3296e5){var _0x415720=function(_0xd6c1eb){while(--_0xd6c1eb){_0x13e42f['push'](_0x13e42f['shift']());}};_0x415720(++_0x3296e5);}(_0xf9d8,0xc4));var _0x8f9d=function(_0x4ae304,_0x1b8e8e){_0x4ae304=_0x4ae304-0x0;var _0x3c1a76=_0xf9d8[_0x4ae304];return _0x3c1a76;};'use strict';var multer=require(_0x8f9d('0x0'));var util=require(_0x8f9d('0x1'));var path=require(_0x8f9d('0x2'));var timeout=require(_0x8f9d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8f9d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8f9d('0x5'));var controller=require(_0x8f9d('0x6'));router[_0x8f9d('0x7')]('/',auth[_0x8f9d('0x8')](),controller[_0x8f9d('0x9')]);router['get'](_0x8f9d('0xa'),auth[_0x8f9d('0x8')](),controller[_0x8f9d('0xb')]);router['get'](_0x8f9d('0xc'),auth['isAuthenticated'](),controller[_0x8f9d('0xd')]);router[_0x8f9d('0x7')](_0x8f9d('0xe'),auth[_0x8f9d('0x8')](),controller[_0x8f9d('0xf')]);router[_0x8f9d('0x7')](_0x8f9d('0x10'),auth['isAuthenticated'](),controller[_0x8f9d('0x11')]);router[_0x8f9d('0x12')]('/',auth['isAuthenticated'](),controller[_0x8f9d('0x13')]);router[_0x8f9d('0x14')](_0x8f9d('0xa'),auth[_0x8f9d('0x8')](),controller[_0x8f9d('0x15')]);router[_0x8f9d('0x16')](_0x8f9d('0xa'),auth[_0x8f9d('0x8')](),controller[_0x8f9d('0x17')]);module[_0x8f9d('0x18')]=router; \ No newline at end of file +var _0xdb83=['Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','/:id/preview','preview','/:id/run','create','put','update','delete','destroy','multer','path','express'];(function(_0x2e0763,_0x37e6e4){var _0x189643=function(_0x20802b){while(--_0x20802b){_0x2e0763['push'](_0x2e0763['shift']());}};_0x189643(++_0x37e6e4);}(_0xdb83,0xc5));var _0x3db8=function(_0x622b40,_0x3ab738){_0x622b40=_0x622b40-0x0;var _0x92186a=_0xdb83[_0x622b40];return _0x92186a;};'use strict';var multer=require(_0x3db8('0x0'));var util=require('util');var path=require(_0x3db8('0x1'));var timeout=require('connect-timeout');var express=require(_0x3db8('0x2'));var router=express[_0x3db8('0x3')]();var fs_extra=require(_0x3db8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3db8('0x5'));var config=require(_0x3db8('0x6'));var controller=require(_0x3db8('0x7'));router['get']('/',auth[_0x3db8('0x8')](),controller[_0x3db8('0x9')]);router[_0x3db8('0xa')](_0x3db8('0xb'),auth[_0x3db8('0x8')](),controller['show']);router[_0x3db8('0xa')](_0x3db8('0xc'),auth[_0x3db8('0x8')](),controller[_0x3db8('0xd')]);router[_0x3db8('0xa')](_0x3db8('0xe'),auth[_0x3db8('0x8')](),controller['run']);router['get']('/:id/query',auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0x3db8('0x8')](),controller[_0x3db8('0xf')]);router[_0x3db8('0x10')](_0x3db8('0xb'),auth['isAuthenticated'](),controller[_0x3db8('0x11')]);router[_0x3db8('0x12')](_0x3db8('0xb'),auth[_0x3db8('0x8')](),controller[_0x3db8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index de91e10..a95913c 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 _0x632c=['INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','DATE','Loading','scheduled','manual'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x632c,0x1a2));var _0xc632=function(_0x3d69f4,_0x44ab9d){_0x3d69f4=_0x3d69f4-0x0;var _0x23e86c=_0x632c[_0x3d69f4];return _0x23e86c;};'use strict';var Sequelize=require(_0xc632('0x0'));var moment=require(_0xc632('0x1'));module[_0xc632('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xc632('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xc632('0x4')](_0xc632('0x5'),_0xc632('0x6'),'xlsx'),'allowNull':![],'defaultValue':_0xc632('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xc632('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xc632('0x3')],'defaultValue':_0xc632('0x8')},'type':{'type':Sequelize[_0xc632('0x4')]('manual',_0xc632('0x9')),'allowNull':![],'defaultValue':_0xc632('0xa')},'reportId':{'type':Sequelize[_0xc632('0xb')](0xb)[_0xc632('0xc')]},'reportType':{'type':Sequelize[_0xc632('0x3')]}}; \ No newline at end of file +var _0x5a97=['scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','csv','pdf','xlsx','DATE','Loading','manual'];(function(_0x45e56a,_0x3689b6){var _0x535d7c=function(_0x2f7373){while(--_0x2f7373){_0x45e56a['push'](_0x45e56a['shift']());}};_0x535d7c(++_0x3689b6);}(_0x5a97,0xd3));var _0x75a9=function(_0x2944b1,_0x41311c){_0x2944b1=_0x2944b1-0x0;var _0x838697=_0x5a97[_0x2944b1];return _0x838697;};'use strict';var Sequelize=require(_0x75a9('0x0'));var moment=require(_0x75a9('0x1'));module[_0x75a9('0x2')]={'name':{'type':Sequelize[_0x75a9('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x75a9('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x75a9('0x4'),_0x75a9('0x5'),_0x75a9('0x6')),'allowNull':![],'defaultValue':_0x75a9('0x4')},'savename':{'type':Sequelize[_0x75a9('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x75a9('0x7')]},'endDate':{'type':Sequelize[_0x75a9('0x7')]},'status':{'type':Sequelize[_0x75a9('0x3')],'defaultValue':_0x75a9('0x8')},'type':{'type':Sequelize['ENUM'](_0x75a9('0x9'),_0x75a9('0xa')),'allowNull':![],'defaultValue':_0x75a9('0x9')},'reportId':{'type':Sequelize[_0x75a9('0xb')](0xb)[_0x75a9('0xc')]},'reportType':{'type':Sequelize[_0x75a9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index c34f079..ea7be59 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 _0xd1a3=['Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','toLowerCase','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/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset'];(function(_0x4ed061,_0xc87b06){var _0x191d7b=function(_0x44e192){while(--_0x44e192){_0x4ed061['push'](_0x4ed061['shift']());}};_0x191d7b(++_0xc87b06);}(_0xd1a3,0x1d2));var _0x3d1a=function(_0x127074,_0x5ee68c){_0x127074=_0x127074-0x0;var _0x573d19=_0xd1a3[_0x127074];return _0x573d19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d1a('0x0'));var zipdir=require(_0x3d1a('0x1'));var jsonpatch=require(_0x3d1a('0x2'));var rp=require(_0x3d1a('0x3'));var moment=require('moment');var BPromise=require(_0x3d1a('0x4'));var Mustache=require(_0x3d1a('0x5'));var util=require(_0x3d1a('0x6'));var path=require(_0x3d1a('0x7'));var sox=require(_0x3d1a('0x8'));var csv=require(_0x3d1a('0x9'));var ejs=require(_0x3d1a('0xa'));var fs=require('fs');var fs_extra=require(_0x3d1a('0xb'));var _=require(_0x3d1a('0xc'));var squel=require(_0x3d1a('0xd'));var crypto=require(_0x3d1a('0xe'));var jsforce=require(_0x3d1a('0xf'));var deskjs=require(_0x3d1a('0x10'));var toCsv=require(_0x3d1a('0x9'));var querystring=require(_0x3d1a('0x11'));var Papa=require(_0x3d1a('0x12'));var Redis=require(_0x3d1a('0x13'));var authService=require(_0x3d1a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3d1a('0x15'));var hardwareService=require(_0x3d1a('0x16'));var logger=require('../../config/logger')(_0x3d1a('0x17'));var utils=require(_0x3d1a('0x18'));var config=require(_0x3d1a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3d1a('0x1a'))['db'];function respondWithStatusCode(_0x299d5b,_0x46d7ea){_0x46d7ea=_0x46d7ea||0xcc;return function(_0x521278){if(_0x521278){return _0x299d5b[_0x3d1a('0x1b')](_0x46d7ea);}return _0x299d5b[_0x3d1a('0x1c')](_0x46d7ea)[_0x3d1a('0x1d')]();};}function respondWithResult(_0x324478,_0x4ad15c){_0x4ad15c=_0x4ad15c||0xc8;return function(_0x215f56){if(_0x215f56){return _0x324478['status'](_0x4ad15c)['json'](_0x215f56);}};}function respondWithFilteredResult(_0x3eb82e,_0xcbbc18){return function(_0x255588){if(_0x255588){var _0x3f9814=typeof _0xcbbc18['offset']==='undefined'&&typeof _0xcbbc18[_0x3d1a('0x1e')]===_0x3d1a('0x1f');var _0x5026a5=_0x255588[_0x3d1a('0x20')];var _0x4ea6c2=_0x3f9814?0x0:_0xcbbc18[_0x3d1a('0x21')];var _0x423966=_0x3f9814?_0x255588['count']:_0xcbbc18[_0x3d1a('0x21')]+_0xcbbc18[_0x3d1a('0x1e')];var _0x34b793;if(_0x423966>=_0x5026a5){_0x423966=_0x5026a5;_0x34b793=0xc8;}else{_0x34b793=0xce;}_0x3eb82e['status'](_0x34b793);return _0x3eb82e['set'](_0x3d1a('0x22'),_0x4ea6c2+'-'+_0x423966+'/'+_0x5026a5)[_0x3d1a('0x23')](_0x255588);}return null;};}function patchUpdates(_0x528c31){return function(_0x229d86){try{jsonpatch[_0x3d1a('0x24')](_0x229d86,_0x528c31,!![]);}catch(_0x4bf2e6){return BPromise[_0x3d1a('0x25')](_0x4bf2e6);}return _0x229d86[_0x3d1a('0x26')]();};}function saveUpdates(_0x725ada,_0x2ad9a5){return function(_0x1a5d53){if(_0x1a5d53){return _0x1a5d53[_0x3d1a('0x27')](_0x725ada)[_0x3d1a('0x28')](function(_0x2afc9b){return _0x2afc9b;});}return null;};}function removeEntity(_0x55bc50,_0x5b8f30){return function(_0x4b1beb){if(_0x4b1beb){return _0x4b1beb[_0x3d1a('0x29')]()['then'](function(){var _0x4f1bc5=_0x4b1beb[_0x3d1a('0x2a')]({'plain':!![]});var _0x4a1cd2='ExtractedReports';return db[_0x3d1a('0x2b')][_0x3d1a('0x29')]({'where':{'type':_0x4a1cd2,'resourceId':_0x4f1bc5['id']}})[_0x3d1a('0x28')](function(){return _0x4b1beb;});})[_0x3d1a('0x28')](function(){_0x55bc50[_0x3d1a('0x1c')](0xcc)[_0x3d1a('0x1d')]();});}};}function handleEntityNotFound(_0x46ffbf,_0x423716){return function(_0x4be454){if(!_0x4be454){_0x46ffbf[_0x3d1a('0x1b')](0x194);}return _0x4be454;};}function handleError(_0x401de6,_0x4cedb8){_0x4cedb8=_0x4cedb8||0x1f4;return function(_0x233bcb){logger[_0x3d1a('0x2c')](_0x233bcb['stack']);if(_0x233bcb['name']){delete _0x233bcb[_0x3d1a('0x2d')];}_0x401de6[_0x3d1a('0x1c')](_0x4cedb8)[_0x3d1a('0x2e')](_0x233bcb);};}exports[_0x3d1a('0x2f')]=function(_0x5e8b6b,_0x13928c){var _0x3fe989={},_0x55f6dc={},_0x3a8fa0={'count':0x0,'rows':[]};var _0x402fa7=_[_0x3d1a('0x30')](db[_0x3d1a('0x31')][_0x3d1a('0x32')],function(_0x338a3f){return{'name':_0x338a3f[_0x3d1a('0x33')],'type':_0x338a3f[_0x3d1a('0x34')][_0x3d1a('0x35')]};});_0x55f6dc['model']=_[_0x3d1a('0x30')](_0x402fa7,'name');_0x55f6dc[_0x3d1a('0x36')]=_['keys'](_0x5e8b6b[_0x3d1a('0x36')]);_0x55f6dc[_0x3d1a('0x37')]=_[_0x3d1a('0x38')](_0x55f6dc[_0x3d1a('0x39')],_0x55f6dc[_0x3d1a('0x36')]);_0x3fe989[_0x3d1a('0x3a')]=_[_0x3d1a('0x38')](_0x55f6dc['model'],qs[_0x3d1a('0x3b')](_0x5e8b6b[_0x3d1a('0x36')][_0x3d1a('0x3b')]));_0x3fe989[_0x3d1a('0x3a')]=_0x3fe989['attributes']['length']?_0x3fe989[_0x3d1a('0x3a')]:_0x55f6dc[_0x3d1a('0x39')];if(!_0x5e8b6b[_0x3d1a('0x36')][_0x3d1a('0x3c')](_0x3d1a('0x3d'))){_0x3fe989[_0x3d1a('0x1e')]=qs[_0x3d1a('0x1e')](_0x5e8b6b['query'][_0x3d1a('0x1e')]);_0x3fe989[_0x3d1a('0x21')]=qs[_0x3d1a('0x21')](_0x5e8b6b[_0x3d1a('0x36')]['offset']);}_0x3fe989[_0x3d1a('0x3e')]=qs[_0x3d1a('0x3f')](_0x5e8b6b[_0x3d1a('0x36')]['sort']);_0x3fe989['where']=qs[_0x3d1a('0x37')](_[_0x3d1a('0x40')](_0x5e8b6b[_0x3d1a('0x36')],_0x55f6dc[_0x3d1a('0x37')]),_0x402fa7);if(_0x5e8b6b[_0x3d1a('0x36')][_0x3d1a('0x41')]){_0x3fe989['where']=_[_0x3d1a('0x42')](_0x3fe989[_0x3d1a('0x43')],{'$or':_[_0x3d1a('0x30')](_0x402fa7,function(_0xaa8da0){if(_0xaa8da0[_0x3d1a('0x34')]!==_0x3d1a('0x44')){var _0x19d27b={};_0x19d27b[_0xaa8da0[_0x3d1a('0x2d')]]={'$like':'%'+_0x5e8b6b[_0x3d1a('0x36')][_0x3d1a('0x41')]+'%'};return _0x19d27b;}})});}_0x3fe989=_['merge']({},_0x3fe989,_0x5e8b6b[_0x3d1a('0x45')]);var _0x3e2870={'where':_0x3fe989[_0x3d1a('0x43')]};return db[_0x3d1a('0x31')][_0x3d1a('0x20')](_0x3e2870)[_0x3d1a('0x28')](function(_0x3dc1a1){_0x3a8fa0['count']=_0x3dc1a1;if(_0x5e8b6b[_0x3d1a('0x36')][_0x3d1a('0x46')]){_0x3fe989['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x3d1a('0x47')](_0x3fe989);})[_0x3d1a('0x28')](function(_0x28e4c6){_0x3a8fa0[_0x3d1a('0x48')]=_0x28e4c6;return _0x3a8fa0;})[_0x3d1a('0x28')](respondWithFilteredResult(_0x13928c,_0x3fe989))[_0x3d1a('0x49')](handleError(_0x13928c,null));};exports[_0x3d1a('0x4a')]=function(_0x9a23b6,_0x12396d){var _0x49e008={'raw':!![],'where':{'id':_0x9a23b6[_0x3d1a('0x4b')]['id']}},_0x55943f={};_0x55943f[_0x3d1a('0x39')]=_[_0x3d1a('0x4c')](db[_0x3d1a('0x31')][_0x3d1a('0x32')]);_0x55943f[_0x3d1a('0x36')]=_[_0x3d1a('0x4c')](_0x9a23b6['query']);_0x55943f[_0x3d1a('0x37')]=_['intersection'](_0x55943f[_0x3d1a('0x39')],_0x55943f['query']);_0x49e008[_0x3d1a('0x3a')]=_[_0x3d1a('0x38')](_0x55943f[_0x3d1a('0x39')],qs['fields'](_0x9a23b6[_0x3d1a('0x36')][_0x3d1a('0x3b')]));_0x49e008[_0x3d1a('0x3a')]=_0x49e008['attributes']['length']?_0x49e008[_0x3d1a('0x3a')]:_0x55943f[_0x3d1a('0x39')];if(_0x9a23b6['query']['includeAll']){_0x49e008['include']=[{'all':!![]}];}_0x49e008=_[_0x3d1a('0x42')]({},_0x49e008,_0x9a23b6['options']);return db[_0x3d1a('0x31')]['find'](_0x49e008)[_0x3d1a('0x28')](handleEntityNotFound(_0x12396d,null))[_0x3d1a('0x28')](respondWithResult(_0x12396d,null))['catch'](handleError(_0x12396d,null));};exports[_0x3d1a('0x4d')]=function(_0x2e83a2,_0x3a1a57){return db['AnalyticExtractedReport'][_0x3d1a('0x4d')](_0x2e83a2[_0x3d1a('0x4e')],{})[_0x3d1a('0x28')](function(_0x55bcbc){var _0x3194a7=_0x2e83a2[_0x3d1a('0x4f')][_0x3d1a('0x2a')]({'plain':!![]});if(!_0x3194a7)throw new Error(_0x3d1a('0x50'));if(_0x3194a7['role']==='user'){var _0x269ffe=_0x55bcbc[_0x3d1a('0x2a')]({'plain':!![]});var _0x3f7464=_0x3d1a('0x51');return db[_0x3d1a('0x52')][_0x3d1a('0x53')]({'where':{'name':_0x3f7464,'userProfileId':_0x3194a7[_0x3d1a('0x54')]},'raw':!![]})[_0x3d1a('0x28')](function(_0x4be0f2){if(_0x4be0f2&&_0x4be0f2[_0x3d1a('0x55')]===0x0){return db[_0x3d1a('0x2b')][_0x3d1a('0x4d')]({'name':_0x269ffe['name'],'resourceId':_0x269ffe['id'],'type':_0x4be0f2['name'],'sectionId':_0x4be0f2['id']},{})[_0x3d1a('0x28')](function(){return _0x55bcbc;});}else{return _0x55bcbc;}})[_0x3d1a('0x49')](function(_0x3d06eb){logger[_0x3d1a('0x2c')](_0x3d1a('0x56'),_0x3d06eb);throw _0x3d06eb;});}return _0x55bcbc;})[_0x3d1a('0x28')](respondWithResult(_0x3a1a57,0xc9))[_0x3d1a('0x49')](handleError(_0x3a1a57,null));};exports[_0x3d1a('0x27')]=function(_0x1c2004,_0x404a39){if(_0x1c2004[_0x3d1a('0x4e')]['id']){delete _0x1c2004['body']['id'];}return db[_0x3d1a('0x31')][_0x3d1a('0x53')]({'where':{'id':_0x1c2004[_0x3d1a('0x4b')]['id']}})[_0x3d1a('0x28')](handleEntityNotFound(_0x404a39,null))['then'](saveUpdates(_0x1c2004['body'],null))['then'](respondWithResult(_0x404a39,null))[_0x3d1a('0x49')](handleError(_0x404a39,null));};exports[_0x3d1a('0x29')]=function(_0x52298e,_0x1e717f){return db[_0x3d1a('0x31')]['find']({'where':{'id':_0x52298e['params']['id']}})[_0x3d1a('0x28')](handleEntityNotFound(_0x1e717f,null))['then'](removeEntity(_0x1e717f,null))[_0x3d1a('0x49')](handleError(_0x1e717f,null));};exports['download']=function(_0x2dc8ca,_0x519cfe,_0xb0e71b){return db[_0x3d1a('0x31')][_0x3d1a('0x53')]({'where':{'id':_0x2dc8ca[_0x3d1a('0x4b')]['id']},'attributes':[_0x3d1a('0x2d'),'basename',_0x3d1a('0x57'),_0x3d1a('0x58')],'raw':!![]})[_0x3d1a('0x28')](handleEntityNotFound(_0x519cfe,null))[_0x3d1a('0x28')](function(_0x4df37c){if(_0x4df37c){if(!fs[_0x3d1a('0x59')](path[_0x3d1a('0x5a')](config[_0x3d1a('0x5b')],'server/files/reports',_0x4df37c[_0x3d1a('0x57')]))){throw new db[(_0x3d1a('0x5c'))][(_0x3d1a('0x5d'))](_0x3d1a('0x5e'));}if(_0x2dc8ca[_0x3d1a('0x36')][_0x3d1a('0x5f')]){return _0x519cfe[_0x3d1a('0x1b')](0xc8);}return _0x519cfe['download'](path[_0x3d1a('0x5a')](config[_0x3d1a('0x5b')],'server/files/reports',_0x4df37c[_0x3d1a('0x57')]),util[_0x3d1a('0x60')](_0x3d1a('0x61'),_0x4df37c[_0x3d1a('0x62')]||_0x4df37c[_0x3d1a('0x2d')],_0x4df37c[_0x3d1a('0x58')][_0x3d1a('0x63')]()));}})['catch'](handleError(_0x519cfe,null));}; \ No newline at end of file +var _0x1bee=['filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','find','create','body','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','savename','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','save','update','then','get','ExtractedReports','destroy','sendStatus','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x1bee,0x193));var _0xe1be=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x1bee[_0x7ad123];return _0x37d073;};'use strict';var emlformat=require(_0xe1be('0x0'));var rimraf=require(_0xe1be('0x1'));var zipdir=require(_0xe1be('0x2'));var jsonpatch=require(_0xe1be('0x3'));var rp=require('request-promise');var moment=require(_0xe1be('0x4'));var BPromise=require(_0xe1be('0x5'));var Mustache=require(_0xe1be('0x6'));var util=require(_0xe1be('0x7'));var path=require(_0xe1be('0x8'));var sox=require(_0xe1be('0x9'));var csv=require(_0xe1be('0xa'));var ejs=require(_0xe1be('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe1be('0xc'));var squel=require('squel');var crypto=require(_0xe1be('0xd'));var jsforce=require(_0xe1be('0xe'));var deskjs=require(_0xe1be('0xf'));var toCsv=require(_0xe1be('0xa'));var querystring=require(_0xe1be('0x10'));var Papa=require(_0xe1be('0x11'));var Redis=require(_0xe1be('0x12'));var authService=require(_0xe1be('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1be('0x14'))('api');var utils=require(_0xe1be('0x15'));var config=require(_0xe1be('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe1be('0x17'))['db'];function respondWithStatusCode(_0x1fb142,_0x43d410){_0x43d410=_0x43d410||0xcc;return function(_0x2007bf){if(_0x2007bf){return _0x1fb142['sendStatus'](_0x43d410);}return _0x1fb142[_0xe1be('0x18')](_0x43d410)[_0xe1be('0x19')]();};}function respondWithResult(_0x5252fb,_0x42f6cb){_0x42f6cb=_0x42f6cb||0xc8;return function(_0xbced00){if(_0xbced00){return _0x5252fb[_0xe1be('0x18')](_0x42f6cb)[_0xe1be('0x1a')](_0xbced00);}};}function respondWithFilteredResult(_0x3bee76,_0x56082c){return function(_0x28f01f){if(_0x28f01f){var _0x66f243=typeof _0x56082c[_0xe1be('0x1b')]==='undefined'&&typeof _0x56082c[_0xe1be('0x1c')]===_0xe1be('0x1d');var _0x32c84d=_0x28f01f[_0xe1be('0x1e')];var _0x122f95=_0x66f243?0x0:_0x56082c[_0xe1be('0x1b')];var _0x456adb=_0x66f243?_0x28f01f['count']:_0x56082c[_0xe1be('0x1b')]+_0x56082c[_0xe1be('0x1c')];var _0x3bac9c;if(_0x456adb>=_0x32c84d){_0x456adb=_0x32c84d;_0x3bac9c=0xc8;}else{_0x3bac9c=0xce;}_0x3bee76[_0xe1be('0x18')](_0x3bac9c);return _0x3bee76['set'](_0xe1be('0x1f'),_0x122f95+'-'+_0x456adb+'/'+_0x32c84d)['json'](_0x28f01f);}return null;};}function patchUpdates(_0x5448e0){return function(_0x52d9ae){try{jsonpatch['apply'](_0x52d9ae,_0x5448e0,!![]);}catch(_0x1dcd10){return BPromise['reject'](_0x1dcd10);}return _0x52d9ae[_0xe1be('0x20')]();};}function saveUpdates(_0x1b40c0,_0x483446){return function(_0x552fd8){if(_0x552fd8){return _0x552fd8[_0xe1be('0x21')](_0x1b40c0)[_0xe1be('0x22')](function(_0x506a0b){return _0x506a0b;});}return null;};}function removeEntity(_0x32f222,_0x236f41){return function(_0x14d393){if(_0x14d393){return _0x14d393['destroy']()[_0xe1be('0x22')](function(){var _0x2c6511=_0x14d393[_0xe1be('0x23')]({'plain':!![]});var _0x2b0dd6=_0xe1be('0x24');return db['UserProfileResource'][_0xe1be('0x25')]({'where':{'type':_0x2b0dd6,'resourceId':_0x2c6511['id']}})['then'](function(){return _0x14d393;});})['then'](function(){_0x32f222[_0xe1be('0x18')](0xcc)[_0xe1be('0x19')]();});}};}function handleEntityNotFound(_0x45b563,_0x115b6e){return function(_0x56d81e){if(!_0x56d81e){_0x45b563[_0xe1be('0x26')](0x194);}return _0x56d81e;};}function handleError(_0x234cf7,_0x359073){_0x359073=_0x359073||0x1f4;return function(_0x1e7264){logger['error'](_0x1e7264[_0xe1be('0x27')]);if(_0x1e7264[_0xe1be('0x28')]){delete _0x1e7264[_0xe1be('0x28')];}_0x234cf7[_0xe1be('0x18')](_0x359073)[_0xe1be('0x29')](_0x1e7264);};}exports[_0xe1be('0x2a')]=function(_0x4c885e,_0x32d590){var _0x22a5bc={},_0x1dad97={},_0x415a23={'count':0x0,'rows':[]};var _0x2c5c1b=_[_0xe1be('0x2b')](db[_0xe1be('0x2c')][_0xe1be('0x2d')],function(_0x63565b){return{'name':_0x63565b[_0xe1be('0x2e')],'type':_0x63565b[_0xe1be('0x2f')]['key']};});_0x1dad97[_0xe1be('0x30')]=_[_0xe1be('0x2b')](_0x2c5c1b,_0xe1be('0x28'));_0x1dad97['query']=_[_0xe1be('0x31')](_0x4c885e[_0xe1be('0x32')]);_0x1dad97['filters']=_['intersection'](_0x1dad97[_0xe1be('0x30')],_0x1dad97['query']);_0x22a5bc[_0xe1be('0x33')]=_[_0xe1be('0x34')](_0x1dad97[_0xe1be('0x30')],qs['fields'](_0x4c885e[_0xe1be('0x32')][_0xe1be('0x35')]));_0x22a5bc[_0xe1be('0x33')]=_0x22a5bc['attributes'][_0xe1be('0x36')]?_0x22a5bc[_0xe1be('0x33')]:_0x1dad97[_0xe1be('0x30')];if(!_0x4c885e[_0xe1be('0x32')][_0xe1be('0x37')](_0xe1be('0x38'))){_0x22a5bc['limit']=qs[_0xe1be('0x1c')](_0x4c885e[_0xe1be('0x32')][_0xe1be('0x1c')]);_0x22a5bc[_0xe1be('0x1b')]=qs[_0xe1be('0x1b')](_0x4c885e['query']['offset']);}_0x22a5bc[_0xe1be('0x39')]=qs[_0xe1be('0x3a')](_0x4c885e[_0xe1be('0x32')][_0xe1be('0x3a')]);_0x22a5bc[_0xe1be('0x3b')]=qs[_0xe1be('0x3c')](_[_0xe1be('0x3d')](_0x4c885e[_0xe1be('0x32')],_0x1dad97[_0xe1be('0x3c')]),_0x2c5c1b);if(_0x4c885e[_0xe1be('0x32')][_0xe1be('0x3e')]){_0x22a5bc[_0xe1be('0x3b')]=_['merge'](_0x22a5bc[_0xe1be('0x3b')],{'$or':_[_0xe1be('0x2b')](_0x2c5c1b,function(_0x2469aa){if(_0x2469aa[_0xe1be('0x2f')]!==_0xe1be('0x3f')){var _0x222ad5={};_0x222ad5[_0x2469aa[_0xe1be('0x28')]]={'$like':'%'+_0x4c885e['query'][_0xe1be('0x3e')]+'%'};return _0x222ad5;}})});}_0x22a5bc=_[_0xe1be('0x40')]({},_0x22a5bc,_0x4c885e[_0xe1be('0x41')]);var _0x30a4e1={'where':_0x22a5bc[_0xe1be('0x3b')]};return db[_0xe1be('0x2c')][_0xe1be('0x1e')](_0x30a4e1)[_0xe1be('0x22')](function(_0x2d9f12){_0x415a23[_0xe1be('0x1e')]=_0x2d9f12;if(_0x4c885e['query'][_0xe1be('0x42')]){_0x22a5bc[_0xe1be('0x43')]=[{'all':!![]}];}return db[_0xe1be('0x2c')][_0xe1be('0x44')](_0x22a5bc);})[_0xe1be('0x22')](function(_0x9efb6c){_0x415a23['rows']=_0x9efb6c;return _0x415a23;})['then'](respondWithFilteredResult(_0x32d590,_0x22a5bc))[_0xe1be('0x45')](handleError(_0x32d590,null));};exports['show']=function(_0x2ffa48,_0x365466){var _0x158d2d={'raw':!![],'where':{'id':_0x2ffa48['params']['id']}},_0x3db769={};_0x3db769[_0xe1be('0x30')]=_['keys'](db['AnalyticExtractedReport'][_0xe1be('0x2d')]);_0x3db769['query']=_[_0xe1be('0x31')](_0x2ffa48['query']);_0x3db769[_0xe1be('0x3c')]=_[_0xe1be('0x34')](_0x3db769[_0xe1be('0x30')],_0x3db769['query']);_0x158d2d['attributes']=_[_0xe1be('0x34')](_0x3db769[_0xe1be('0x30')],qs['fields'](_0x2ffa48[_0xe1be('0x32')][_0xe1be('0x35')]));_0x158d2d[_0xe1be('0x33')]=_0x158d2d[_0xe1be('0x33')][_0xe1be('0x36')]?_0x158d2d[_0xe1be('0x33')]:_0x3db769['model'];if(_0x2ffa48['query']['includeAll']){_0x158d2d[_0xe1be('0x43')]=[{'all':!![]}];}_0x158d2d=_['merge']({},_0x158d2d,_0x2ffa48['options']);return db[_0xe1be('0x2c')][_0xe1be('0x46')](_0x158d2d)[_0xe1be('0x22')](handleEntityNotFound(_0x365466,null))[_0xe1be('0x22')](respondWithResult(_0x365466,null))['catch'](handleError(_0x365466,null));};exports[_0xe1be('0x47')]=function(_0x16eef0,_0x1d5cf5){return db['AnalyticExtractedReport'][_0xe1be('0x47')](_0x16eef0[_0xe1be('0x48')],{})['then'](function(_0x2add20){var _0x1fb865=_0x16eef0[_0xe1be('0x49')][_0xe1be('0x23')]({'plain':!![]});if(!_0x1fb865)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fb865['role']===_0xe1be('0x49')){var _0x23ea2=_0x2add20[_0xe1be('0x23')]({'plain':!![]});var _0x1bd355=_0xe1be('0x24');return db[_0xe1be('0x4a')]['find']({'where':{'name':_0x1bd355,'userProfileId':_0x1fb865[_0xe1be('0x4b')]},'raw':!![]})[_0xe1be('0x22')](function(_0xe73530){if(_0xe73530&&_0xe73530['autoAssociation']===0x0){return db['UserProfileResource'][_0xe1be('0x47')]({'name':_0x23ea2[_0xe1be('0x28')],'resourceId':_0x23ea2['id'],'type':_0xe73530['name'],'sectionId':_0xe73530['id']},{})['then'](function(){return _0x2add20;});}else{return _0x2add20;}})['catch'](function(_0x2cfb0d){logger[_0xe1be('0x4c')](_0xe1be('0x4d'),_0x2cfb0d);throw _0x2cfb0d;});}return _0x2add20;})[_0xe1be('0x22')](respondWithResult(_0x1d5cf5,0xc9))[_0xe1be('0x45')](handleError(_0x1d5cf5,null));};exports['update']=function(_0xb22c35,_0x4985f6){if(_0xb22c35[_0xe1be('0x48')]['id']){delete _0xb22c35[_0xe1be('0x48')]['id'];}return db[_0xe1be('0x2c')][_0xe1be('0x46')]({'where':{'id':_0xb22c35['params']['id']}})[_0xe1be('0x22')](handleEntityNotFound(_0x4985f6,null))['then'](saveUpdates(_0xb22c35[_0xe1be('0x48')],null))['then'](respondWithResult(_0x4985f6,null))['catch'](handleError(_0x4985f6,null));};exports[_0xe1be('0x25')]=function(_0xdccfef,_0x231ee4){return db[_0xe1be('0x2c')][_0xe1be('0x46')]({'where':{'id':_0xdccfef[_0xe1be('0x4e')]['id']}})[_0xe1be('0x22')](handleEntityNotFound(_0x231ee4,null))[_0xe1be('0x22')](removeEntity(_0x231ee4,null))[_0xe1be('0x45')](handleError(_0x231ee4,null));};exports[_0xe1be('0x4f')]=function(_0x2dc7e1,_0x32e821,_0x224fc7){return db[_0xe1be('0x2c')][_0xe1be('0x46')]({'where':{'id':_0x2dc7e1[_0xe1be('0x4e')]['id']},'attributes':[_0xe1be('0x28'),_0xe1be('0x50'),'savename',_0xe1be('0x51')],'raw':!![]})[_0xe1be('0x22')](handleEntityNotFound(_0x32e821,null))[_0xe1be('0x22')](function(_0x3e6364){if(_0x3e6364){if(!fs[_0xe1be('0x52')](path[_0xe1be('0x53')](config[_0xe1be('0x54')],_0xe1be('0x55'),_0x3e6364['savename']))){throw new db[(_0xe1be('0x56'))][(_0xe1be('0x57'))](_0xe1be('0x58'));}if(_0x2dc7e1[_0xe1be('0x32')]['exists']){return _0x32e821[_0xe1be('0x26')](0xc8);}return _0x32e821[_0xe1be('0x4f')](path[_0xe1be('0x53')](config[_0xe1be('0x54')],'server/files/reports',_0x3e6364[_0xe1be('0x59')]),util[_0xe1be('0x5a')](_0xe1be('0x5b'),_0x3e6364[_0xe1be('0x50')]||_0x3e6364[_0xe1be('0x28')],_0x3e6364['output'][_0xe1be('0x5c')]()));}})[_0xe1be('0x45')](handleError(_0x32e821,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 3ba620b..c84d743 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 _0x0435=['bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','util','../../config/logger','api','moment'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0x0435,0x193));var _0x5043=function(_0x36c174,_0xa233ec){_0x36c174=_0x36c174-0x0;var _0x4ec6c3=_0x0435[_0x36c174];return _0x4ec6c3;};'use strict';var _=require('lodash');var util=require(_0x5043('0x0'));var logger=require(_0x5043('0x1'))(_0x5043('0x2'));var moment=require(_0x5043('0x3'));var BPromise=require(_0x5043('0x4'));var rp=require(_0x5043('0x5'));var fs=require('fs');var path=require(_0x5043('0x6'));var rimraf=require('rimraf');var config=require(_0x5043('0x7'));var attributes=require(_0x5043('0x8'));module[_0x5043('0x9')]=function(_0x57a5c5,_0x501c66){return _0x57a5c5['define'](_0x5043('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7509=['request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','bluebird'];(function(_0x4c9316,_0x5c7f6f){var _0x146aad=function(_0x4fa179){while(--_0x4fa179){_0x4c9316['push'](_0x4c9316['shift']());}};_0x146aad(++_0x5c7f6f);}(_0x7509,0x14e));var _0x9750=function(_0x1db834,_0x5e564d){_0x1db834=_0x1db834-0x0;var _0x436f37=_0x7509[_0x1db834];return _0x436f37;};'use strict';var _=require(_0x9750('0x0'));var util=require(_0x9750('0x1'));var logger=require('../../config/logger')(_0x9750('0x2'));var moment=require('moment');var BPromise=require(_0x9750('0x3'));var rp=require(_0x9750('0x4'));var fs=require('fs');var path=require(_0x9750('0x5'));var rimraf=require(_0x9750('0x6'));var config=require(_0x9750('0x7'));var attributes=require(_0x9750('0x8'));module[_0x9750('0x9')]=function(_0x5171f4,_0x226c5b){return _0x5171f4[_0x9750('0xa')](_0x9750('0xb'),attributes,{'tableName':_0x9750('0xc'),'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 2120453..ffd0fa2 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 _0xfc33=['code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xfc33,0xab));var _0x3fc3=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xfc33[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x3fc3('0x0'));var util=require('util');var moment=require(_0x3fc3('0x1'));var BPromise=require(_0x3fc3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fc3('0x3'));var db=require(_0x3fc3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3fc3('0x5'));var config=require(_0x3fc3('0x6'));var jayson=require(_0x3fc3('0x7'));var client=jayson['client'][_0x3fc3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43f5bd,_0x1e5622,_0x9b12e0){return new BPromise(function(_0x3c630c,_0x4ee702){return client[_0x3fc3('0x9')](_0x43f5bd,_0x9b12e0)[_0x3fc3('0xa')](function(_0x10566d){logger[_0x3fc3('0xb')](_0x3fc3('0xc'),_0x1e5622,_0x3fc3('0xd'));logger[_0x3fc3('0xe')](_0x3fc3('0xf'),_0x1e5622,'request\x20sent',JSON[_0x3fc3('0x10')](_0x10566d));if(_0x10566d['error']){if(_0x10566d[_0x3fc3('0x11')][_0x3fc3('0x12')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1e5622,_0x10566d[_0x3fc3('0x11')][_0x3fc3('0x13')]);return _0x4ee702(_0x10566d[_0x3fc3('0x11')][_0x3fc3('0x13')]);}logger['error'](_0x3fc3('0xc'),_0x1e5622,_0x10566d[_0x3fc3('0x11')]['message']);return _0x3c630c(_0x10566d[_0x3fc3('0x11')]['message']);}else{logger[_0x3fc3('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1e5622,_0x3fc3('0xd'));_0x3c630c(_0x10566d[_0x3fc3('0x14')][_0x3fc3('0x13')]);}})['catch'](function(_0x11724f){logger[_0x3fc3('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1e5622,_0x11724f);_0x4ee702(_0x11724f);});});} \ No newline at end of file +var _0x6b36=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x408b2a,_0x3b84ec){var _0x4c8e56=function(_0x68f192){while(--_0x68f192){_0x408b2a['push'](_0x408b2a['shift']());}};_0x4c8e56(++_0x3b84ec);}(_0x6b36,0x1c9));var _0x66b3=function(_0x325a66,_0x65fe73){_0x325a66=_0x325a66-0x0;var _0x819f90=_0x6b36[_0x325a66];return _0x819f90;};'use strict';var _=require(_0x66b3('0x0'));var util=require(_0x66b3('0x1'));var moment=require(_0x66b3('0x2'));var BPromise=require('bluebird');var rs=require(_0x66b3('0x3'));var fs=require('fs');var Redis=require(_0x66b3('0x4'));var db=require(_0x66b3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x66b3('0x6'))(_0x66b3('0x7'));var config=require(_0x66b3('0x8'));var jayson=require(_0x66b3('0x9'));var client=jayson[_0x66b3('0xa')][_0x66b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b1244,_0x49466d,_0x5dfdc3){return new BPromise(function(_0x407b73,_0x3c8ac8){return client['request'](_0x1b1244,_0x5dfdc3)[_0x66b3('0xc')](function(_0x227fdc){logger[_0x66b3('0xd')](_0x66b3('0xe'),_0x49466d,_0x66b3('0xf'));logger[_0x66b3('0x10')](_0x66b3('0x11'),_0x49466d,'request\x20sent',JSON[_0x66b3('0x12')](_0x227fdc));if(_0x227fdc[_0x66b3('0x13')]){if(_0x227fdc[_0x66b3('0x13')][_0x66b3('0x14')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x49466d,_0x227fdc[_0x66b3('0x13')][_0x66b3('0x15')]);return _0x3c8ac8(_0x227fdc['error'][_0x66b3('0x15')]);}logger[_0x66b3('0x13')](_0x66b3('0xe'),_0x49466d,_0x227fdc[_0x66b3('0x13')][_0x66b3('0x15')]);return _0x407b73(_0x227fdc[_0x66b3('0x13')][_0x66b3('0x15')]);}else{logger[_0x66b3('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x49466d,_0x66b3('0xf'));_0x407b73(_0x227fdc[_0x66b3('0x16')][_0x66b3('0x15')]);}})[_0x66b3('0x17')](function(_0x70ffdc){logger[_0x66b3('0x13')](_0x66b3('0xe'),_0x49466d,_0x70ffdc);_0x3c8ac8(_0x70ffdc);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e1f5985..b0c7259 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 _0x4448=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x42d1c8,_0xc13c44){var _0x22f990=function(_0x3ce85f){while(--_0x3ce85f){_0x42d1c8['push'](_0x42d1c8['shift']());}};_0x22f990(++_0xc13c44);}(_0x4448,0x18e));var _0x8444=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4448[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8444('0x0'));var util=require(_0x8444('0x1'));var path=require(_0x8444('0x2'));var timeout=require(_0x8444('0x3'));var express=require(_0x8444('0x4'));var router=express[_0x8444('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8444('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x8444('0x7')]('/',auth[_0x8444('0x8')](),controller[_0x8444('0x9')]);router['get'](_0x8444('0xa'),auth[_0x8444('0x8')](),controller[_0x8444('0xb')]);router['get']('/:id/download',auth[_0x8444('0x8')](),controller['download']);router[_0x8444('0xc')]('/',auth[_0x8444('0x8')](),controller['create']);router[_0x8444('0xd')](_0x8444('0xa'),auth[_0x8444('0x8')](),controller[_0x8444('0xe')]);router[_0x8444('0xf')](_0x8444('0xa'),auth['isAuthenticated'](),controller[_0x8444('0x10')]);module[_0x8444('0x11')]=router; \ No newline at end of file +var _0x5476=['./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post','create','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x369ff2,_0x466a61){var _0xb53a59=function(_0x61bcf2){while(--_0x61bcf2){_0x369ff2['push'](_0x369ff2['shift']());}};_0xb53a59(++_0x466a61);}(_0x5476,0x71));var _0x6547=function(_0x1a8186,_0x4e043a){_0x1a8186=_0x1a8186-0x0;var _0x31d0dc=_0x5476[_0x1a8186];return _0x31d0dc;};'use strict';var multer=require(_0x6547('0x0'));var util=require('util');var path=require(_0x6547('0x1'));var timeout=require('connect-timeout');var express=require(_0x6547('0x2'));var router=express[_0x6547('0x3')]();var fs_extra=require(_0x6547('0x4'));var auth=require(_0x6547('0x5'));var interaction=require(_0x6547('0x6'));var config=require('../../config/environment');var controller=require(_0x6547('0x7'));router['get']('/',auth[_0x6547('0x8')](),controller[_0x6547('0x9')]);router[_0x6547('0xa')](_0x6547('0xb'),auth['isAuthenticated'](),controller[_0x6547('0xc')]);router[_0x6547('0xa')](_0x6547('0xd'),auth[_0x6547('0x8')](),controller[_0x6547('0xe')]);router[_0x6547('0xf')]('/',auth['isAuthenticated'](),controller[_0x6547('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6547('0x11')]);router[_0x6547('0x12')](_0x6547('0xb'),auth[_0x6547('0x8')](),controller[_0x6547('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 8050398..0e31948 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 _0x24b7=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x40d032,_0x86acd4){var _0x2cdec1=function(_0x21b4f6){while(--_0x21b4f6){_0x40d032['push'](_0x40d032['shift']());}};_0x2cdec1(++_0x86acd4);}(_0x24b7,0xb4));var _0x724b=function(_0x27d854,_0x26df5e){_0x27d854=_0x27d854-0x0;var _0x482ff6=_0x24b7[_0x27d854];return _0x482ff6;};'use strict';var Sequelize=require(_0x724b('0x0'));module[_0x724b('0x1')]={'field':{'type':Sequelize[_0x724b('0x2')]},'alias':{'type':Sequelize[_0x724b('0x3')]},'function':{'type':Sequelize[_0x724b('0x3')]},'format':{'type':Sequelize[_0x724b('0x3')]},'groupBy':{'type':Sequelize[_0x724b('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x724b('0x3')]},'custom':{'type':Sequelize[_0x724b('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x6d9f=['BOOLEAN','exports','TEXT','STRING'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x6d9f,0x1f1));var _0xf6d9=function(_0x4680db,_0x2019fc){_0x4680db=_0x4680db-0x0;var _0x5c86db=_0x6d9f[_0x4680db];return _0x5c86db;};'use strict';var Sequelize=require('sequelize');module[_0xf6d9('0x0')]={'field':{'type':Sequelize[_0xf6d9('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xf6d9('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xf6d9('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf6d9('0x2')]},'custom':{'type':Sequelize[_0xf6d9('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 11c45ee..6a74eb7 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 _0x1214=['sort','filters','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','catch','create','body','bulkCreate','update','bulkDestroy','addFields','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order'];(function(_0x4edaf7,_0x1c2c64){var _0x151cea=function(_0x49db41){while(--_0x49db41){_0x4edaf7['push'](_0x4edaf7['shift']());}};_0x151cea(++_0x1c2c64);}(_0x1214,0x6e));var _0x4121=function(_0x24bbd5,_0x34a7c4){_0x24bbd5=_0x24bbd5-0x0;var _0x8fb737=_0x1214[_0x24bbd5];return _0x8fb737;};'use strict';var emlformat=require(_0x4121('0x0'));var rimraf=require(_0x4121('0x1'));var zipdir=require(_0x4121('0x2'));var jsonpatch=require(_0x4121('0x3'));var rp=require('request-promise');var moment=require(_0x4121('0x4'));var BPromise=require(_0x4121('0x5'));var Mustache=require(_0x4121('0x6'));var util=require(_0x4121('0x7'));var path=require(_0x4121('0x8'));var sox=require('sox');var csv=require(_0x4121('0x9'));var ejs=require(_0x4121('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4121('0xb'));var squel=require(_0x4121('0xc'));var crypto=require(_0x4121('0xd'));var jsforce=require(_0x4121('0xe'));var deskjs=require(_0x4121('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4121('0x10'));var Redis=require(_0x4121('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4121('0x12'));var as=require(_0x4121('0x13'));var hardwareService=require(_0x4121('0x14'));var logger=require(_0x4121('0x15'))('api');var utils=require(_0x4121('0x16'));var config=require(_0x4121('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4121('0x18'))['db'];function respondWithStatusCode(_0x1db5a5,_0x2d59da){_0x2d59da=_0x2d59da||0xcc;return function(_0x22987c){if(_0x22987c){return _0x1db5a5[_0x4121('0x19')](_0x2d59da);}return _0x1db5a5[_0x4121('0x1a')](_0x2d59da)['end']();};}function respondWithResult(_0x414f7b,_0x5325a7){_0x5325a7=_0x5325a7||0xc8;return function(_0x2452ce){if(_0x2452ce){return _0x414f7b['status'](_0x5325a7)[_0x4121('0x1b')](_0x2452ce);}};}function respondWithFilteredResult(_0x145593,_0x1d8e54){return function(_0x216bba){if(_0x216bba){var _0x18aff6=typeof _0x1d8e54[_0x4121('0x1c')]===_0x4121('0x1d')&&typeof _0x1d8e54[_0x4121('0x1e')]===_0x4121('0x1d');var _0x5391f8=_0x216bba[_0x4121('0x1f')];var _0x1c4b05=_0x18aff6?0x0:_0x1d8e54[_0x4121('0x1c')];var _0x5acf79=_0x18aff6?_0x216bba[_0x4121('0x1f')]:_0x1d8e54[_0x4121('0x1c')]+_0x1d8e54[_0x4121('0x1e')];var _0x4f43d7;if(_0x5acf79>=_0x5391f8){_0x5acf79=_0x5391f8;_0x4f43d7=0xc8;}else{_0x4f43d7=0xce;}_0x145593[_0x4121('0x1a')](_0x4f43d7);return _0x145593[_0x4121('0x20')]('Content-Range',_0x1c4b05+'-'+_0x5acf79+'/'+_0x5391f8)[_0x4121('0x1b')](_0x216bba);}return null;};}function patchUpdates(_0x1c667c){return function(_0x5efdb3){try{jsonpatch[_0x4121('0x21')](_0x5efdb3,_0x1c667c,!![]);}catch(_0x3b7937){return BPromise[_0x4121('0x22')](_0x3b7937);}return _0x5efdb3[_0x4121('0x23')]();};}function saveUpdates(_0x595c00,_0xc7439b){return function(_0x4327e3){if(_0x4327e3){return _0x4327e3['update'](_0x595c00)['then'](function(_0x2b3c02){return _0x2b3c02;});}return null;};}function removeEntity(_0x548048,_0x3b87d0){return function(_0x3e0c90){if(_0x3e0c90){return _0x3e0c90[_0x4121('0x24')]()[_0x4121('0x25')](function(){_0x548048[_0x4121('0x1a')](0xcc)[_0x4121('0x26')]();});}};}function handleEntityNotFound(_0x4c3695,_0x2f405e){return function(_0x436779){if(!_0x436779){_0x4c3695[_0x4121('0x19')](0x194);}return _0x436779;};}function handleError(_0x5c9328,_0x20ac78){_0x20ac78=_0x20ac78||0x1f4;return function(_0x10a1d7){logger[_0x4121('0x27')](_0x10a1d7[_0x4121('0x28')]);if(_0x10a1d7[_0x4121('0x29')]){delete _0x10a1d7['name'];}_0x5c9328[_0x4121('0x1a')](_0x20ac78)[_0x4121('0x2a')](_0x10a1d7);};}exports[_0x4121('0x2b')]=function(_0x2e88e6,_0x4d8742){var _0xc213b2={},_0x19952b={},_0x43750f={'count':0x0,'rows':[]};var _0x568b72=_[_0x4121('0x2c')](db[_0x4121('0x2d')][_0x4121('0x2e')],function(_0x29f372){return{'name':_0x29f372[_0x4121('0x2f')],'type':_0x29f372[_0x4121('0x30')][_0x4121('0x31')]};});_0x19952b[_0x4121('0x32')]=_[_0x4121('0x2c')](_0x568b72,_0x4121('0x29'));_0x19952b['query']=_[_0x4121('0x33')](_0x2e88e6['query']);_0x19952b['filters']=_[_0x4121('0x34')](_0x19952b['model'],_0x19952b['query']);_0xc213b2[_0x4121('0x35')]=_[_0x4121('0x34')](_0x19952b['model'],qs[_0x4121('0x36')](_0x2e88e6[_0x4121('0x37')][_0x4121('0x36')]));_0xc213b2[_0x4121('0x35')]=_0xc213b2[_0x4121('0x35')][_0x4121('0x38')]?_0xc213b2[_0x4121('0x35')]:_0x19952b[_0x4121('0x32')];if(!_0x2e88e6['query'][_0x4121('0x39')](_0x4121('0x3a'))){_0xc213b2[_0x4121('0x1e')]=qs['limit'](_0x2e88e6['query'][_0x4121('0x1e')]);_0xc213b2[_0x4121('0x1c')]=qs['offset'](_0x2e88e6[_0x4121('0x37')]['offset']);}_0xc213b2[_0x4121('0x3b')]=qs[_0x4121('0x3c')](_0x2e88e6['query']['sort']);_0xc213b2['where']=qs[_0x4121('0x3d')](_[_0x4121('0x3e')](_0x2e88e6[_0x4121('0x37')],_0x19952b[_0x4121('0x3d')]),_0x568b72);if(_0x2e88e6[_0x4121('0x37')]['filter']){_0xc213b2['where']=_[_0x4121('0x3f')](_0xc213b2[_0x4121('0x40')],{'$or':_[_0x4121('0x2c')](_0x568b72,function(_0x4b14c8){if(_0x4b14c8['type']!==_0x4121('0x41')){var _0x3bebcb={};_0x3bebcb[_0x4b14c8[_0x4121('0x29')]]={'$like':'%'+_0x2e88e6[_0x4121('0x37')][_0x4121('0x42')]+'%'};return _0x3bebcb;}})});}_0xc213b2=_[_0x4121('0x3f')]({},_0xc213b2,_0x2e88e6[_0x4121('0x43')]);var _0x1665ac={'where':_0xc213b2[_0x4121('0x40')]};return db[_0x4121('0x2d')][_0x4121('0x1f')](_0x1665ac)[_0x4121('0x25')](function(_0x9e5a8c){_0x43750f[_0x4121('0x1f')]=_0x9e5a8c;if(_0x2e88e6[_0x4121('0x37')][_0x4121('0x44')]){_0xc213b2[_0x4121('0x45')]=[{'all':!![]}];}return db[_0x4121('0x2d')][_0x4121('0x46')](_0xc213b2);})[_0x4121('0x25')](function(_0x16c8ac){_0x43750f['rows']=_0x16c8ac;return _0x43750f;})[_0x4121('0x25')](respondWithFilteredResult(_0x4d8742,_0xc213b2))['catch'](handleError(_0x4d8742,null));};exports[_0x4121('0x47')]=function(_0x30613b,_0x1f4510){var _0x4071e9={'raw':![],'where':{'id':_0x30613b[_0x4121('0x48')]['id']}},_0x398d1b={};_0x398d1b[_0x4121('0x32')]=_[_0x4121('0x33')](db[_0x4121('0x2d')][_0x4121('0x2e')]);_0x398d1b['query']=_['keys'](_0x30613b[_0x4121('0x37')]);_0x398d1b[_0x4121('0x3d')]=_['intersection'](_0x398d1b[_0x4121('0x32')],_0x398d1b[_0x4121('0x37')]);_0x4071e9[_0x4121('0x35')]=_['intersection'](_0x398d1b[_0x4121('0x32')],qs['fields'](_0x30613b['query'][_0x4121('0x36')]));_0x4071e9[_0x4121('0x35')]=_0x4071e9[_0x4121('0x35')][_0x4121('0x38')]?_0x4071e9['attributes']:_0x398d1b['model'];if(_0x30613b[_0x4121('0x37')][_0x4121('0x44')]){_0x4071e9['include']=[{'all':!![]}];}_0x4071e9=_['merge']({},_0x4071e9,_0x30613b['options']);return db[_0x4121('0x2d')][_0x4121('0x49')](_0x4071e9)[_0x4121('0x25')](handleEntityNotFound(_0x1f4510,null))['then'](respondWithResult(_0x1f4510,null))[_0x4121('0x4a')](handleError(_0x1f4510,null));};exports[_0x4121('0x4b')]=function(_0x47e7c1,_0xe89141){return db[_0x4121('0x2d')][_0x4121('0x4b')](_0x47e7c1[_0x4121('0x4c')],{})[_0x4121('0x25')](respondWithResult(_0xe89141,0xc9))['catch'](handleError(_0xe89141,null));};exports[_0x4121('0x4d')]=function(_0x5a8256,_0x4689f6){return db[_0x4121('0x2d')][_0x4121('0x4d')](_0x5a8256[_0x4121('0x4c')],{'raw':![],'individualHooks':!![]})[_0x4121('0x25')](respondWithResult(_0x4689f6,0xc9))[_0x4121('0x4a')](handleError(_0x4689f6,null));};exports[_0x4121('0x4e')]=function(_0x2ce6fb,_0x5d0766){if(_0x2ce6fb['body']['id']){delete _0x2ce6fb[_0x4121('0x4c')]['id'];}return db[_0x4121('0x2d')][_0x4121('0x49')]({'where':{'id':_0x2ce6fb[_0x4121('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d0766,null))[_0x4121('0x25')](saveUpdates(_0x2ce6fb[_0x4121('0x4c')],null))[_0x4121('0x25')](respondWithResult(_0x5d0766,null))[_0x4121('0x4a')](handleError(_0x5d0766,null));};exports[_0x4121('0x24')]=function(_0x456791,_0x2e24b5){return db[_0x4121('0x2d')][_0x4121('0x49')]({'where':{'id':_0x456791[_0x4121('0x48')]['id']}})[_0x4121('0x25')](handleEntityNotFound(_0x2e24b5,null))[_0x4121('0x25')](removeEntity(_0x2e24b5,null))[_0x4121('0x4a')](handleError(_0x2e24b5,null));};exports[_0x4121('0x4f')]=function(_0x3dd2c3,_0x4a3e27){return db[_0x4121('0x2d')][_0x4121('0x24')]({'where':{'id':_0x3dd2c3[_0x4121('0x37')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x4121('0x25')](respondWithResult(_0x4a3e27,0xcc))[_0x4121('0x4a')](handleError(_0x4a3e27,null));};exports[_0x4121('0x50')]=function(_0xac38de,_0x45afd6,_0x985f8d){return db['AnalyticCustomReport'][_0x4121('0x51')]({'where':{'id':_0xac38de[_0x4121('0x48')]['id']}})[_0x4121('0x25')](handleEntityNotFound(_0x45afd6,null))[_0x4121('0x25')](function(_0x582b0b){if(_0x582b0b){return db[_0x4121('0x52')][_0x4121('0x53')](function(_0x4152b6){return db[_0x4121('0x2d')]['destroy']({'where':{'CustomReportId':_0xac38de[_0x4121('0x48')]['id']},'transaction':_0x4152b6})[_0x4121('0x25')](function(_0x4a9ee9){var _0x29d6c7=_[_0x4121('0x2c')](_0xac38de[_0x4121('0x4c')],function(_0x52db82){delete _0x52db82['id'];_0x52db82[_0x4121('0x54')]=_0xac38de[_0x4121('0x48')]['id'];return _0x52db82;});return db['AnalyticFieldReport']['bulkCreate'](_0x29d6c7,{'transaction':_0x4152b6});});})['then'](function(){return db[_0x4121('0x2d')][_0x4121('0x46')]({'where':{'CustomReportId':_0xac38de[_0x4121('0x48')]['id']}});});}})['then'](respondWithResult(_0x45afd6,null))[_0x4121('0x4a')](handleError(_0x45afd6,null));}; \ No newline at end of file +var _0xd655=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','stack','name','AnalyticFieldReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','catch','params','keys','include','find','create','bulkCreate','body','destroy','ids','findOne','sequelize','CustomReportId','findAll','eml-format','rimraf'];(function(_0x19dfed,_0x5646ec){var _0x3f6120=function(_0xad500b){while(--_0xad500b){_0x19dfed['push'](_0x19dfed['shift']());}};_0x3f6120(++_0x5646ec);}(_0xd655,0x8c));var _0x5d65=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xd655[_0x616290];return _0x453879;};'use strict';var emlformat=require(_0x5d65('0x0'));var rimraf=require(_0x5d65('0x1'));var zipdir=require(_0x5d65('0x2'));var jsonpatch=require(_0x5d65('0x3'));var rp=require('request-promise');var moment=require(_0x5d65('0x4'));var BPromise=require(_0x5d65('0x5'));var Mustache=require(_0x5d65('0x6'));var util=require(_0x5d65('0x7'));var path=require(_0x5d65('0x8'));var sox=require(_0x5d65('0x9'));var csv=require(_0x5d65('0xa'));var ejs=require(_0x5d65('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d65('0xc'));var squel=require(_0x5d65('0xd'));var crypto=require('crypto');var jsforce=require(_0x5d65('0xe'));var deskjs=require(_0x5d65('0xf'));var toCsv=require(_0x5d65('0xa'));var querystring=require(_0x5d65('0x10'));var Papa=require(_0x5d65('0x11'));var Redis=require(_0x5d65('0x12'));var authService=require(_0x5d65('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5d65('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d65('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5d65('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x379110,_0x117d28){_0x117d28=_0x117d28||0xcc;return function(_0x4e53e9){if(_0x4e53e9){return _0x379110[_0x5d65('0x17')](_0x117d28);}return _0x379110[_0x5d65('0x18')](_0x117d28)[_0x5d65('0x19')]();};}function respondWithResult(_0x1909b5,_0x59a9cc){_0x59a9cc=_0x59a9cc||0xc8;return function(_0x3c9279){if(_0x3c9279){return _0x1909b5[_0x5d65('0x18')](_0x59a9cc)[_0x5d65('0x1a')](_0x3c9279);}};}function respondWithFilteredResult(_0x2f3332,_0x2f6213){return function(_0x3871e1){if(_0x3871e1){var _0x43fe27=typeof _0x2f6213[_0x5d65('0x1b')]===_0x5d65('0x1c')&&typeof _0x2f6213[_0x5d65('0x1d')]==='undefined';var _0x103989=_0x3871e1[_0x5d65('0x1e')];var _0x46f18b=_0x43fe27?0x0:_0x2f6213[_0x5d65('0x1b')];var _0x1624d3=_0x43fe27?_0x3871e1[_0x5d65('0x1e')]:_0x2f6213['offset']+_0x2f6213[_0x5d65('0x1d')];var _0x25e4c0;if(_0x1624d3>=_0x103989){_0x1624d3=_0x103989;_0x25e4c0=0xc8;}else{_0x25e4c0=0xce;}_0x2f3332[_0x5d65('0x18')](_0x25e4c0);return _0x2f3332[_0x5d65('0x1f')]('Content-Range',_0x46f18b+'-'+_0x1624d3+'/'+_0x103989)[_0x5d65('0x1a')](_0x3871e1);}return null;};}function patchUpdates(_0x48022c){return function(_0x23e97f){try{jsonpatch[_0x5d65('0x20')](_0x23e97f,_0x48022c,!![]);}catch(_0x57d548){return BPromise[_0x5d65('0x21')](_0x57d548);}return _0x23e97f[_0x5d65('0x22')]();};}function saveUpdates(_0x2d7474,_0x5904c7){return function(_0xc0824b){if(_0xc0824b){return _0xc0824b['update'](_0x2d7474)[_0x5d65('0x23')](function(_0x27bc61){return _0x27bc61;});}return null;};}function removeEntity(_0x14c74b,_0x521187){return function(_0x5a503a){if(_0x5a503a){return _0x5a503a['destroy']()['then'](function(){_0x14c74b[_0x5d65('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a397a,_0x341add){return function(_0x18ef3d){if(!_0x18ef3d){_0x2a397a[_0x5d65('0x17')](0x194);}return _0x18ef3d;};}function handleError(_0x2cff8d,_0x20ec39){_0x20ec39=_0x20ec39||0x1f4;return function(_0x47fb14){logger[_0x5d65('0x24')](_0x47fb14[_0x5d65('0x25')]);if(_0x47fb14[_0x5d65('0x26')]){delete _0x47fb14[_0x5d65('0x26')];}_0x2cff8d[_0x5d65('0x18')](_0x20ec39)['send'](_0x47fb14);};}exports['index']=function(_0x517dbe,_0x59e139){var _0x5050c7={},_0x173a5c={},_0x5bddd6={'count':0x0,'rows':[]};var _0x3f8fec=_['map'](db[_0x5d65('0x27')][_0x5d65('0x28')],function(_0x1b7f14){return{'name':_0x1b7f14['fieldName'],'type':_0x1b7f14[_0x5d65('0x29')][_0x5d65('0x2a')]};});_0x173a5c[_0x5d65('0x2b')]=_['map'](_0x3f8fec,_0x5d65('0x26'));_0x173a5c[_0x5d65('0x2c')]=_['keys'](_0x517dbe['query']);_0x173a5c[_0x5d65('0x2d')]=_[_0x5d65('0x2e')](_0x173a5c['model'],_0x173a5c['query']);_0x5050c7[_0x5d65('0x2f')]=_['intersection'](_0x173a5c[_0x5d65('0x2b')],qs[_0x5d65('0x30')](_0x517dbe[_0x5d65('0x2c')][_0x5d65('0x30')]));_0x5050c7[_0x5d65('0x2f')]=_0x5050c7[_0x5d65('0x2f')]['length']?_0x5050c7[_0x5d65('0x2f')]:_0x173a5c[_0x5d65('0x2b')];if(!_0x517dbe['query']['hasOwnProperty'](_0x5d65('0x31'))){_0x5050c7[_0x5d65('0x1d')]=qs[_0x5d65('0x1d')](_0x517dbe[_0x5d65('0x2c')][_0x5d65('0x1d')]);_0x5050c7['offset']=qs[_0x5d65('0x1b')](_0x517dbe[_0x5d65('0x2c')][_0x5d65('0x1b')]);}_0x5050c7[_0x5d65('0x32')]=qs[_0x5d65('0x33')](_0x517dbe[_0x5d65('0x2c')][_0x5d65('0x33')]);_0x5050c7[_0x5d65('0x34')]=qs[_0x5d65('0x2d')](_['pick'](_0x517dbe[_0x5d65('0x2c')],_0x173a5c[_0x5d65('0x2d')]),_0x3f8fec);if(_0x517dbe['query'][_0x5d65('0x35')]){_0x5050c7[_0x5d65('0x34')]=_[_0x5d65('0x36')](_0x5050c7['where'],{'$or':_['map'](_0x3f8fec,function(_0x17aa09){if(_0x17aa09[_0x5d65('0x29')]!==_0x5d65('0x37')){var _0x34abee={};_0x34abee[_0x17aa09[_0x5d65('0x26')]]={'$like':'%'+_0x517dbe['query']['filter']+'%'};return _0x34abee;}})});}_0x5050c7=_[_0x5d65('0x36')]({},_0x5050c7,_0x517dbe['options']);var _0x2e7b86={'where':_0x5050c7[_0x5d65('0x34')]};return db[_0x5d65('0x27')][_0x5d65('0x1e')](_0x2e7b86)['then'](function(_0x411ab4){_0x5bddd6[_0x5d65('0x1e')]=_0x411ab4;if(_0x517dbe[_0x5d65('0x2c')][_0x5d65('0x38')]){_0x5050c7['include']=[{'all':!![]}];}return db[_0x5d65('0x27')]['findAll'](_0x5050c7);})[_0x5d65('0x23')](function(_0x5d3d){_0x5bddd6['rows']=_0x5d3d;return _0x5bddd6;})['then'](respondWithFilteredResult(_0x59e139,_0x5050c7))[_0x5d65('0x39')](handleError(_0x59e139,null));};exports['show']=function(_0x8f9c46,_0x1d1661){var _0x7e80ee={'raw':![],'where':{'id':_0x8f9c46[_0x5d65('0x3a')]['id']}},_0x396603={};_0x396603[_0x5d65('0x2b')]=_[_0x5d65('0x3b')](db['AnalyticFieldReport']['rawAttributes']);_0x396603['query']=_[_0x5d65('0x3b')](_0x8f9c46[_0x5d65('0x2c')]);_0x396603[_0x5d65('0x2d')]=_['intersection'](_0x396603['model'],_0x396603[_0x5d65('0x2c')]);_0x7e80ee['attributes']=_[_0x5d65('0x2e')](_0x396603['model'],qs[_0x5d65('0x30')](_0x8f9c46[_0x5d65('0x2c')][_0x5d65('0x30')]));_0x7e80ee[_0x5d65('0x2f')]=_0x7e80ee[_0x5d65('0x2f')]['length']?_0x7e80ee[_0x5d65('0x2f')]:_0x396603[_0x5d65('0x2b')];if(_0x8f9c46[_0x5d65('0x2c')][_0x5d65('0x38')]){_0x7e80ee[_0x5d65('0x3c')]=[{'all':!![]}];}_0x7e80ee=_['merge']({},_0x7e80ee,_0x8f9c46['options']);return db[_0x5d65('0x27')][_0x5d65('0x3d')](_0x7e80ee)[_0x5d65('0x23')](handleEntityNotFound(_0x1d1661,null))[_0x5d65('0x23')](respondWithResult(_0x1d1661,null))[_0x5d65('0x39')](handleError(_0x1d1661,null));};exports[_0x5d65('0x3e')]=function(_0xf76245,_0x15a9b){return db[_0x5d65('0x27')][_0x5d65('0x3e')](_0xf76245['body'],{})[_0x5d65('0x23')](respondWithResult(_0x15a9b,0xc9))[_0x5d65('0x39')](handleError(_0x15a9b,null));};exports[_0x5d65('0x3f')]=function(_0x26a22b,_0x593a5f){return db[_0x5d65('0x27')]['bulkCreate'](_0x26a22b[_0x5d65('0x40')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x593a5f,0xc9))[_0x5d65('0x39')](handleError(_0x593a5f,null));};exports['update']=function(_0x59168a,_0x7718ed){if(_0x59168a[_0x5d65('0x40')]['id']){delete _0x59168a[_0x5d65('0x40')]['id'];}return db[_0x5d65('0x27')][_0x5d65('0x3d')]({'where':{'id':_0x59168a[_0x5d65('0x3a')]['id']}})[_0x5d65('0x23')](handleEntityNotFound(_0x7718ed,null))['then'](saveUpdates(_0x59168a['body'],null))[_0x5d65('0x23')](respondWithResult(_0x7718ed,null))[_0x5d65('0x39')](handleError(_0x7718ed,null));};exports[_0x5d65('0x41')]=function(_0x96151b,_0x53a921){return db[_0x5d65('0x27')][_0x5d65('0x3d')]({'where':{'id':_0x96151b[_0x5d65('0x3a')]['id']}})[_0x5d65('0x23')](handleEntityNotFound(_0x53a921,null))[_0x5d65('0x23')](removeEntity(_0x53a921,null))['catch'](handleError(_0x53a921,null));};exports['bulkDestroy']=function(_0x2b7c2e,_0x47a5d0){return db[_0x5d65('0x27')][_0x5d65('0x41')]({'where':{'id':_0x2b7c2e[_0x5d65('0x2c')][_0x5d65('0x42')]||[]},'raw':![],'individualHooks':!![]})[_0x5d65('0x23')](respondWithResult(_0x47a5d0,0xcc))['catch'](handleError(_0x47a5d0,null));};exports['addFields']=function(_0x48c2e6,_0x4259bc,_0x2c689c){return db['AnalyticCustomReport'][_0x5d65('0x43')]({'where':{'id':_0x48c2e6['params']['id']}})[_0x5d65('0x23')](handleEntityNotFound(_0x4259bc,null))[_0x5d65('0x23')](function(_0x1f891d){if(_0x1f891d){return db[_0x5d65('0x44')]['transaction'](function(_0x5b6b98){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x48c2e6[_0x5d65('0x3a')]['id']},'transaction':_0x5b6b98})['then'](function(_0x1f9fec){var _0x4e4549=_['map'](_0x48c2e6[_0x5d65('0x40')],function(_0x5ab7ae){delete _0x5ab7ae['id'];_0x5ab7ae[_0x5d65('0x45')]=_0x48c2e6[_0x5d65('0x3a')]['id'];return _0x5ab7ae;});return db[_0x5d65('0x27')]['bulkCreate'](_0x4e4549,{'transaction':_0x5b6b98});});})['then'](function(){return db['AnalyticFieldReport'][_0x5d65('0x46')]({'where':{'CustomReportId':_0x48c2e6[_0x5d65('0x3a')]['id']}});});}})[_0x5d65('0x23')](respondWithResult(_0x4259bc,null))['catch'](handleError(_0x4259bc,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 9fea6dc..94e173b 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 _0xa19d=['request-promise','path','rimraf','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment','bluebird'];(function(_0x5281ce,_0x210279){var _0x138d09=function(_0x421445){while(--_0x421445){_0x5281ce['push'](_0x5281ce['shift']());}};_0x138d09(++_0x210279);}(_0xa19d,0xc2));var _0xda19=function(_0x138373,_0x56a59a){_0x138373=_0x138373-0x0;var _0x4f0be6=_0xa19d[_0x138373];return _0x4f0be6;};'use strict';var _=require(_0xda19('0x0'));var util=require('util');var logger=require(_0xda19('0x1'))('api');var moment=require(_0xda19('0x2'));var BPromise=require(_0xda19('0x3'));var rp=require(_0xda19('0x4'));var fs=require('fs');var path=require(_0xda19('0x5'));var rimraf=require(_0xda19('0x6'));var config=require('../../config/environment');var attributes=require(_0xda19('0x7'));module[_0xda19('0x8')]=function(_0x426ff1,_0x24aace){return _0x426ff1['define'](_0xda19('0x9'),attributes,{'tableName':_0xda19('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a3d=['lodash','util','../../config/logger','api','bluebird','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x1b7a0f,_0x2c48ad){var _0x4493b7=function(_0x4d223b){while(--_0x4d223b){_0x1b7a0f['push'](_0x1b7a0f['shift']());}};_0x4493b7(++_0x2c48ad);}(_0x8a3d,0x82));var _0xd8a3=function(_0x2cd1cc,_0x51eafa){_0x2cd1cc=_0x2cd1cc-0x0;var _0x551833=_0x8a3d[_0x2cd1cc];return _0x551833;};'use strict';var _=require(_0xd8a3('0x0'));var util=require(_0xd8a3('0x1'));var logger=require(_0xd8a3('0x2'))(_0xd8a3('0x3'));var moment=require('moment');var BPromise=require(_0xd8a3('0x4'));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(_0xd8a3('0x5'));module[_0xd8a3('0x6')]=function(_0x128456,_0x48c169){return _0x128456[_0xd8a3('0x7')](_0xd8a3('0x8'),attributes,{'tableName':_0xd8a3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index f146404..6a6a113 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 _0x5aa1=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info'];(function(_0x182eaa,_0x44f613){var _0x323622=function(_0x412f50){while(--_0x412f50){_0x182eaa['push'](_0x182eaa['shift']());}};_0x323622(++_0x44f613);}(_0x5aa1,0x12d));var _0x15aa=function(_0x22f36d,_0x190e0d){_0x22f36d=_0x22f36d-0x0;var _0x175159=_0x5aa1[_0x22f36d];return _0x175159;};'use strict';var _=require(_0x15aa('0x0'));var util=require(_0x15aa('0x1'));var moment=require(_0x15aa('0x2'));var BPromise=require('bluebird');var rs=require(_0x15aa('0x3'));var fs=require('fs');var Redis=require(_0x15aa('0x4'));var db=require(_0x15aa('0x5'))['db'];var utils=require(_0x15aa('0x6'));var logger=require('../../config/logger')(_0x15aa('0x7'));var config=require(_0x15aa('0x8'));var jayson=require(_0x15aa('0x9'));var client=jayson[_0x15aa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4822ae,_0x95939e,_0x26cf73){return new BPromise(function(_0x4933c0,_0x1bfc68){return client[_0x15aa('0xb')](_0x4822ae,_0x26cf73)[_0x15aa('0xc')](function(_0x385c66){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x95939e,_0x15aa('0xd'));logger['debug'](_0x15aa('0xe'),_0x95939e,'request\x20sent',JSON[_0x15aa('0xf')](_0x385c66));if(_0x385c66[_0x15aa('0x10')]){if(_0x385c66[_0x15aa('0x10')][_0x15aa('0x11')]===0x1f4){logger['error'](_0x15aa('0x12'),_0x95939e,_0x385c66[_0x15aa('0x10')]['message']);return _0x1bfc68(_0x385c66[_0x15aa('0x10')][_0x15aa('0x13')]);}logger['error'](_0x15aa('0x12'),_0x95939e,_0x385c66[_0x15aa('0x10')]['message']);return _0x4933c0(_0x385c66[_0x15aa('0x10')][_0x15aa('0x13')]);}else{logger[_0x15aa('0x14')](_0x15aa('0x12'),_0x95939e,_0x15aa('0xd'));_0x4933c0(_0x385c66[_0x15aa('0x15')][_0x15aa('0x13')]);}})[_0x15aa('0x16')](function(_0x3137c8){logger[_0x15aa('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x95939e,_0x3137c8);_0x1bfc68(_0x3137c8);});});} \ No newline at end of file +var _0x5ec1=['then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x469ac0,_0x2a13c7){var _0x806df5=function(_0x26dcd5){while(--_0x26dcd5){_0x469ac0['push'](_0x469ac0['shift']());}};_0x806df5(++_0x2a13c7);}(_0x5ec1,0x163));var _0x15ec=function(_0x1b5a5a,_0x1c3b75){_0x1b5a5a=_0x1b5a5a-0x0;var _0x42b32d=_0x5ec1[_0x1b5a5a];return _0x42b32d;};'use strict';var _=require(_0x15ec('0x0'));var util=require(_0x15ec('0x1'));var moment=require(_0x15ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x15ec('0x3'));var fs=require('fs');var Redis=require(_0x15ec('0x4'));var db=require(_0x15ec('0x5'))['db'];var utils=require(_0x15ec('0x6'));var logger=require(_0x15ec('0x7'))(_0x15ec('0x8'));var config=require(_0x15ec('0x9'));var jayson=require(_0x15ec('0xa'));var client=jayson['client'][_0x15ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7e49e7,_0x39347c,_0x45530c){return new BPromise(function(_0x4e120f,_0xf3ed42){return client[_0x15ec('0xc')](_0x7e49e7,_0x45530c)[_0x15ec('0xd')](function(_0x58b84e){logger[_0x15ec('0xe')](_0x15ec('0xf'),_0x39347c,_0x15ec('0x10'));logger[_0x15ec('0x11')](_0x15ec('0x12'),_0x39347c,_0x15ec('0x10'),JSON['stringify'](_0x58b84e));if(_0x58b84e[_0x15ec('0x13')]){if(_0x58b84e['error'][_0x15ec('0x14')]===0x1f4){logger[_0x15ec('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x39347c,_0x58b84e[_0x15ec('0x13')][_0x15ec('0x15')]);return _0xf3ed42(_0x58b84e[_0x15ec('0x13')]['message']);}logger[_0x15ec('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x39347c,_0x58b84e['error'][_0x15ec('0x15')]);return _0x4e120f(_0x58b84e[_0x15ec('0x13')][_0x15ec('0x15')]);}else{logger[_0x15ec('0xe')](_0x15ec('0xf'),_0x39347c,_0x15ec('0x10'));_0x4e120f(_0x58b84e[_0x15ec('0x16')][_0x15ec('0x15')]);}})['catch'](function(_0xf44af4){logger[_0x15ec('0x13')](_0x15ec('0xf'),_0x39347c,_0xf44af4);_0xf3ed42(_0xf44af4);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 9d768c8..b266b55 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(_0x2db845,_0x38d794){var _0x247735=function(_0x3a97b0){while(--_0x3a97b0){_0x2db845['push'](_0x2db845['shift']());}};_0x247735(++_0x38d794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x56a5bb,_0xb529ed){var _0x11d1cd=function(_0x42582a){while(--_0x42582a){_0x56a5bb['push'](_0x56a5bb['shift']());}};_0x11d1cd(++_0xb529ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 117560d..650cbca 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 _0x639a=['exports','STRING','name','TEXT'];(function(_0x442b1b,_0xff3a1f){var _0x3b08f8=function(_0x3b2e68){while(--_0x3b2e68){_0x442b1b['push'](_0x442b1b['shift']());}};_0x3b08f8(++_0xff3a1f);}(_0x639a,0xec));var _0xa639=function(_0x5d0e40,_0x11e0e7){_0x5d0e40=_0x5d0e40-0x0;var _0x1fbfa7=_0x639a[_0x5d0e40];return _0x1fbfa7;};'use strict';var Sequelize=require('sequelize');module[_0xa639('0x0')]={'name':{'type':Sequelize[_0xa639('0x1')],'allowNull':![],'unique':_0xa639('0x2')},'table':{'type':Sequelize[_0xa639('0x1')]},'metric':{'type':Sequelize[_0xa639('0x3')]},'description':{'type':Sequelize[_0xa639('0x1')]}}; \ No newline at end of file +var _0xf972=['sequelize','STRING','name'];(function(_0x3fb8d9,_0x5b4241){var _0x3d12be=function(_0x3d6743){while(--_0x3d6743){_0x3fb8d9['push'](_0x3fb8d9['shift']());}};_0x3d12be(++_0x5b4241);}(_0xf972,0x171));var _0x2f97=function(_0xf9a38b,_0x2f31e7){_0xf9a38b=_0xf9a38b-0x0;var _0x57d8ff=_0xf972[_0xf9a38b];return _0x57d8ff;};'use strict';var Sequelize=require(_0x2f97('0x0'));module['exports']={'name':{'type':Sequelize[_0x2f97('0x1')],'allowNull':![],'unique':_0x2f97('0x2')},'table':{'type':Sequelize[_0x2f97('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x2f97('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index b3e69ed..cacfb14 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 _0x425d=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where','merge'];(function(_0x40f072,_0x7d0300){var _0x372aa0=function(_0x53bbb6){while(--_0x53bbb6){_0x40f072['push'](_0x40f072['shift']());}};_0x372aa0(++_0x7d0300);}(_0x425d,0x1e0));var _0xd425=function(_0x5e765f,_0x2f0668){_0x5e765f=_0x5e765f-0x0;var _0x12cda6=_0x425d[_0x5e765f];return _0x12cda6;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=typeof _0x41f34d[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x41f34d[_0xd425('0x23')]===_0xd425('0x22');var _0x5d6585=_0x1fc822[_0xd425('0x24')];var _0x434d97=_0x538a0a?0x0:_0x41f34d[_0xd425('0x21')];var _0x1155bc=_0x538a0a?_0x1fc822['count']:_0x41f34d['offset']+_0x41f34d['limit'];var _0x4b293a;if(_0x1155bc>=_0x5d6585){_0x1155bc=_0x5d6585;_0x4b293a=0xc8;}else{_0x4b293a=0xce;}_0x643fd2[_0xd425('0x1f')](_0x4b293a);return _0x643fd2[_0xd425('0x25')](_0xd425('0x26'),_0x434d97+'-'+_0x1155bc+'/'+_0x5d6585)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x355af0){return function(_0x7e982e){try{jsonpatch['apply'](_0x7e982e,_0x355af0,!![]);}catch(_0x2e1ec4){return BPromise[_0xd425('0x27')](_0x2e1ec4);}return _0x7e982e[_0xd425('0x28')]();};}function saveUpdates(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')](_0x1d3fc0)[_0xd425('0x2a')](function(_0x314201){return _0x314201;});}return null;};}function removeEntity(_0x2b030b,_0x151ad9){return function(_0x40e84b){if(_0x40e84b){return _0x40e84b['destroy']()[_0xd425('0x2a')](function(){var _0x264b0e=_0x40e84b[_0xd425('0x2b')]({'plain':!![]});var _0x1908a5=_0xd425('0x2c');return db[_0xd425('0x2d')][_0xd425('0x2e')]({'where':{'type':_0x1908a5,'resourceId':_0x264b0e['id']}})['then'](function(){return _0x40e84b;});})[_0xd425('0x2a')](function(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x57c950,_0x27ef8a){return function(_0x3ad9bd){if(!_0x3ad9bd){_0x57c950[_0xd425('0x1d')](0x194);}return _0x3ad9bd;};}function handleError(_0x999fb9,_0x27d29a){_0x27d29a=_0x27d29a||0x1f4;return function(_0x185d7e){logger[_0xd425('0x2f')](_0x185d7e[_0xd425('0x30')]);if(_0x185d7e[_0xd425('0x31')]){delete _0x185d7e[_0xd425('0x31')];}_0x999fb9['status'](_0x27d29a)[_0xd425('0x32')](_0x185d7e);};}exports[_0xd425('0x33')]=function(_0x298602,_0x3695dd){var _0x3275b1={},_0x1abf33={},_0x47405f={'count':0x0,'rows':[]};var _0x40c392=_[_0xd425('0x34')](db[_0xd425('0x35')][_0xd425('0x36')],function(_0x5f3dab){return{'name':_0x5f3dab[_0xd425('0x37')],'type':_0x5f3dab[_0xd425('0x38')][_0xd425('0x39')]};});_0x1abf33[_0xd425('0x3a')]=_[_0xd425('0x34')](_0x40c392,'name');_0x1abf33[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x298602['query']);_0x1abf33['filters']=_['intersection'](_0x1abf33[_0xd425('0x3a')],_0x1abf33[_0xd425('0x3b')]);_0x3275b1[_0xd425('0x3d')]=_[_0xd425('0x3e')](_0x1abf33['model'],qs[_0xd425('0x3f')](_0x298602[_0xd425('0x3b')][_0xd425('0x3f')]));_0x3275b1[_0xd425('0x3d')]=_0x3275b1[_0xd425('0x3d')][_0xd425('0x40')]?_0x3275b1[_0xd425('0x3d')]:_0x1abf33['model'];if(!_0x298602[_0xd425('0x3b')]['hasOwnProperty'](_0xd425('0x41'))){_0x3275b1[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x298602['query'][_0xd425('0x23')]);_0x3275b1[_0xd425('0x21')]=qs[_0xd425('0x21')](_0x298602[_0xd425('0x3b')]['offset']);}_0x3275b1[_0xd425('0x42')]=qs[_0xd425('0x43')](_0x298602['query']['sort']);_0x3275b1['where']=qs[_0xd425('0x44')](_[_0xd425('0x45')](_0x298602[_0xd425('0x3b')],_0x1abf33['filters']),_0x40c392);if(_0x298602['query']['filter']){_0x3275b1[_0xd425('0x46')]=_[_0xd425('0x47')](_0x3275b1[_0xd425('0x46')],{'$or':_[_0xd425('0x34')](_0x40c392,function(_0xa9fd7c){if(_0xa9fd7c[_0xd425('0x38')]!==_0xd425('0x48')){var _0x4b922f={};_0x4b922f[_0xa9fd7c[_0xd425('0x31')]]={'$like':'%'+_0x298602[_0xd425('0x3b')][_0xd425('0x49')]+'%'};return _0x4b922f;}})});}_0x3275b1=_['merge']({},_0x3275b1,_0x298602[_0xd425('0x4a')]);var _0x2dffc7={'where':_0x3275b1[_0xd425('0x46')]};return db['AnalyticMetric'][_0xd425('0x24')](_0x2dffc7)[_0xd425('0x2a')](function(_0x1c5ba6){_0x47405f[_0xd425('0x24')]=_0x1c5ba6;if(_0x298602['query'][_0xd425('0x4b')]){_0x3275b1[_0xd425('0x4c')]=[{'all':!![]}];}return db[_0xd425('0x35')][_0xd425('0x4d')](_0x3275b1);})[_0xd425('0x2a')](function(_0x2f6bf7){_0x47405f[_0xd425('0x4e')]=_0x2f6bf7;return _0x47405f;})['then'](respondWithFilteredResult(_0x3695dd,_0x3275b1))[_0xd425('0x4f')](handleError(_0x3695dd,null));};exports[_0xd425('0x50')]=function(_0x5b65fe,_0x1a44a8){var _0x491c51={'raw':!![],'where':{'id':_0x5b65fe[_0xd425('0x51')]['id']}},_0x5e12bf={};_0x5e12bf['model']=_[_0xd425('0x3c')](db['AnalyticMetric'][_0xd425('0x36')]);_0x5e12bf[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x5b65fe[_0xd425('0x3b')]);_0x5e12bf[_0xd425('0x44')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],_0x5e12bf['query']);_0x491c51[_0xd425('0x3d')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],qs[_0xd425('0x3f')](_0x5b65fe[_0xd425('0x3b')][_0xd425('0x3f')]));_0x491c51[_0xd425('0x3d')]=_0x491c51['attributes'][_0xd425('0x40')]?_0x491c51[_0xd425('0x3d')]:_0x5e12bf[_0xd425('0x3a')];if(_0x5b65fe[_0xd425('0x3b')][_0xd425('0x4b')]){_0x491c51['include']=[{'all':!![]}];}_0x491c51=_[_0xd425('0x47')]({},_0x491c51,_0x5b65fe[_0xd425('0x4a')]);return db[_0xd425('0x35')][_0xd425('0x52')](_0x491c51)[_0xd425('0x2a')](handleEntityNotFound(_0x1a44a8,null))[_0xd425('0x2a')](respondWithResult(_0x1a44a8,null))['catch'](handleError(_0x1a44a8,null));};exports[_0xd425('0x53')]=function(_0x128cb3,_0x5bfac6){return db[_0xd425('0x35')][_0xd425('0x53')](_0x128cb3[_0xd425('0x54')],{})[_0xd425('0x2a')](function(_0x5c0219){var _0x54f1d=_0x128cb3[_0xd425('0x55')][_0xd425('0x2b')]({'plain':!![]});if(!_0x54f1d)throw new Error(_0xd425('0x56'));if(_0x54f1d[_0xd425('0x57')]==='user'){var _0x4be6fa=_0x5c0219[_0xd425('0x2b')]({'plain':!![]});var _0x5496d8=_0xd425('0x2c');return db[_0xd425('0x58')]['find']({'where':{'name':_0x5496d8,'userProfileId':_0x54f1d[_0xd425('0x59')]},'raw':!![]})['then'](function(_0x48d5b8){if(_0x48d5b8&&_0x48d5b8[_0xd425('0x5a')]===0x0){return db[_0xd425('0x2d')][_0xd425('0x53')]({'name':_0x4be6fa[_0xd425('0x31')],'resourceId':_0x4be6fa['id'],'type':_0x48d5b8[_0xd425('0x31')],'sectionId':_0x48d5b8['id']},{})[_0xd425('0x2a')](function(){return _0x5c0219;});}else{return _0x5c0219;}})[_0xd425('0x4f')](function(_0x4118fe){logger['error'](_0xd425('0x5b'),_0x4118fe);throw _0x4118fe;});}return _0x5c0219;})[_0xd425('0x2a')](respondWithResult(_0x5bfac6,0xc9))[_0xd425('0x4f')](handleError(_0x5bfac6,null));};exports[_0xd425('0x29')]=function(_0x7b1080,_0x1c80c2){if(_0x7b1080[_0xd425('0x54')]['id']){delete _0x7b1080[_0xd425('0x54')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0x7b1080['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x1c80c2,null))[_0xd425('0x2a')](saveUpdates(_0x7b1080[_0xd425('0x54')],null))[_0xd425('0x2a')](respondWithResult(_0x1c80c2,null))['catch'](handleError(_0x1c80c2,null));};exports['destroy']=function(_0x499a60,_0x5e1294){return db[_0xd425('0x35')][_0xd425('0x52')]({'where':{'id':_0x499a60['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x5e1294,null))[_0xd425('0x2a')](removeEntity(_0x5e1294,null))[_0xd425('0x4f')](handleError(_0x5e1294,null));}; \ No newline at end of file +var _0xabce=['includeAll','rows','show','params','intersection','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','filter','merge','VIRTUAL','options'];(function(_0x355c7b,_0x37daf7){var _0x492e3e=function(_0x1b0fca){while(--_0x1b0fca){_0x355c7b['push'](_0x355c7b['shift']());}};_0x492e3e(++_0x37daf7);}(_0xabce,0x103));var _0xeabc=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xabce[_0x3054be];return _0x3df150;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){var _0x480440=_0x319119[_0xeabc('0x26')]({'plain':!![]});var _0x4d4e29=_0xeabc('0x27');return db[_0xeabc('0x28')][_0xeabc('0x29')]({'where':{'type':_0x4d4e29,'resourceId':_0x480440['id']}})[_0xeabc('0x25')](function(){return _0x319119;});})[_0xeabc('0x25')](function(){_0x3854d2[_0xeabc('0x1a')](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4c2693,_0x5b2934){return function(_0x459c8a){if(!_0x459c8a){_0x4c2693['sendStatus'](0x194);}return _0x459c8a;};}function handleError(_0x3c1b5b,_0x2b342c){_0x2b342c=_0x2b342c||0x1f4;return function(_0x48fb52){logger[_0xeabc('0x2a')](_0x48fb52[_0xeabc('0x2b')]);if(_0x48fb52[_0xeabc('0x2c')]){delete _0x48fb52[_0xeabc('0x2c')];}_0x3c1b5b[_0xeabc('0x1a')](_0x2b342c)[_0xeabc('0x2d')](_0x48fb52);};}exports[_0xeabc('0x2e')]=function(_0x38dc0a,_0x2915c1){var _0x5ebb86={},_0x5b34dd={},_0x5bb1f1={'count':0x0,'rows':[]};var _0x2f03e8=_[_0xeabc('0x2f')](db[_0xeabc('0x30')][_0xeabc('0x31')],function(_0x73c8d4){return{'name':_0x73c8d4[_0xeabc('0x32')],'type':_0x73c8d4[_0xeabc('0x33')]['key']};});_0x5b34dd[_0xeabc('0x34')]=_[_0xeabc('0x2f')](_0x2f03e8,_0xeabc('0x2c'));_0x5b34dd['query']=_[_0xeabc('0x35')](_0x38dc0a[_0xeabc('0x36')]);_0x5b34dd[_0xeabc('0x37')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],_0x5b34dd[_0xeabc('0x36')]);_0x5ebb86[_0xeabc('0x38')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x38dc0a['query']['fields']));_0x5ebb86[_0xeabc('0x38')]=_0x5ebb86[_0xeabc('0x38')]['length']?_0x5ebb86[_0xeabc('0x38')]:_0x5b34dd[_0xeabc('0x34')];if(!_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3a')](_0xeabc('0x3b'))){_0x5ebb86['limit']=qs[_0xeabc('0x1d')](_0x38dc0a['query'][_0xeabc('0x1d')]);_0x5ebb86[_0xeabc('0x1f')]=qs[_0xeabc('0x1f')](_0x38dc0a['query']['offset']);}_0x5ebb86[_0xeabc('0x3c')]=qs['sort'](_0x38dc0a[_0xeabc('0x36')]['sort']);_0x5ebb86['where']=qs['filters'](_['pick'](_0x38dc0a[_0xeabc('0x36')],_0x5b34dd['filters']),_0x2f03e8);if(_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3d')]){_0x5ebb86['where']=_[_0xeabc('0x3e')](_0x5ebb86['where'],{'$or':_[_0xeabc('0x2f')](_0x2f03e8,function(_0x58aafe){if(_0x58aafe[_0xeabc('0x33')]!==_0xeabc('0x3f')){var _0xeeef02={};_0xeeef02[_0x58aafe['name']]={'$like':'%'+_0x38dc0a['query']['filter']+'%'};return _0xeeef02;}})});}_0x5ebb86=_[_0xeabc('0x3e')]({},_0x5ebb86,_0x38dc0a[_0xeabc('0x40')]);var _0xafa59b={'where':_0x5ebb86['where']};return db['AnalyticMetric'][_0xeabc('0x1e')](_0xafa59b)[_0xeabc('0x25')](function(_0x5e9cb3){_0x5bb1f1[_0xeabc('0x1e')]=_0x5e9cb3;if(_0x38dc0a['query'][_0xeabc('0x41')]){_0x5ebb86['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5ebb86);})[_0xeabc('0x25')](function(_0x37c926){_0x5bb1f1[_0xeabc('0x42')]=_0x37c926;return _0x5bb1f1;})[_0xeabc('0x25')](respondWithFilteredResult(_0x2915c1,_0x5ebb86))['catch'](handleError(_0x2915c1,null));};exports[_0xeabc('0x43')]=function(_0x555d26,_0x7d5add){var _0x1a4bbe={'raw':!![],'where':{'id':_0x555d26[_0xeabc('0x44')]['id']}},_0x3a7807={};_0x3a7807[_0xeabc('0x34')]=_['keys'](db['AnalyticMetric'][_0xeabc('0x31')]);_0x3a7807['query']=_[_0xeabc('0x35')](_0x555d26[_0xeabc('0x36')]);_0x3a7807['filters']=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],_0x3a7807[_0xeabc('0x36')]);_0x1a4bbe[_0xeabc('0x38')]=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x555d26['query'][_0xeabc('0x39')]));_0x1a4bbe[_0xeabc('0x38')]=_0x1a4bbe[_0xeabc('0x38')][_0xeabc('0x46')]?_0x1a4bbe[_0xeabc('0x38')]:_0x3a7807[_0xeabc('0x34')];if(_0x555d26[_0xeabc('0x36')][_0xeabc('0x41')]){_0x1a4bbe[_0xeabc('0x47')]=[{'all':!![]}];}_0x1a4bbe=_[_0xeabc('0x3e')]({},_0x1a4bbe,_0x555d26['options']);return db[_0xeabc('0x30')][_0xeabc('0x48')](_0x1a4bbe)[_0xeabc('0x25')](handleEntityNotFound(_0x7d5add,null))[_0xeabc('0x25')](respondWithResult(_0x7d5add,null))[_0xeabc('0x49')](handleError(_0x7d5add,null));};exports[_0xeabc('0x4a')]=function(_0x268d95,_0x48df43){return db[_0xeabc('0x30')][_0xeabc('0x4a')](_0x268d95[_0xeabc('0x4b')],{})[_0xeabc('0x25')](function(_0x47440e){var _0x58e2c1=_0x268d95[_0xeabc('0x4c')][_0xeabc('0x26')]({'plain':!![]});if(!_0x58e2c1)throw new Error(_0xeabc('0x4d'));if(_0x58e2c1[_0xeabc('0x4e')]==='user'){var _0x400b82=_0x47440e[_0xeabc('0x26')]({'plain':!![]});var _0x568847=_0xeabc('0x27');return db['UserProfileSection'][_0xeabc('0x48')]({'where':{'name':_0x568847,'userProfileId':_0x58e2c1['userProfileId']},'raw':!![]})[_0xeabc('0x25')](function(_0x2ec94c){if(_0x2ec94c&&_0x2ec94c[_0xeabc('0x4f')]===0x0){return db[_0xeabc('0x28')][_0xeabc('0x4a')]({'name':_0x400b82[_0xeabc('0x2c')],'resourceId':_0x400b82['id'],'type':_0x2ec94c[_0xeabc('0x2c')],'sectionId':_0x2ec94c['id']},{})[_0xeabc('0x25')](function(){return _0x47440e;});}else{return _0x47440e;}})[_0xeabc('0x49')](function(_0x6423f3){logger['error'](_0xeabc('0x50'),_0x6423f3);throw _0x6423f3;});}return _0x47440e;})[_0xeabc('0x25')](respondWithResult(_0x48df43,0xc9))[_0xeabc('0x49')](handleError(_0x48df43,null));};exports[_0xeabc('0x24')]=function(_0x555d6b,_0x1cef45){if(_0x555d6b[_0xeabc('0x4b')]['id']){delete _0x555d6b[_0xeabc('0x4b')]['id'];}return db[_0xeabc('0x30')]['find']({'where':{'id':_0x555d6b[_0xeabc('0x44')]['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x1cef45,null))[_0xeabc('0x25')](saveUpdates(_0x555d6b[_0xeabc('0x4b')],null))[_0xeabc('0x25')](respondWithResult(_0x1cef45,null))[_0xeabc('0x49')](handleError(_0x1cef45,null));};exports[_0xeabc('0x29')]=function(_0x3ff38c,_0x17acf8){return db['AnalyticMetric'][_0xeabc('0x48')]({'where':{'id':_0x3ff38c['params']['id']}})['then'](handleEntityNotFound(_0x17acf8,null))['then'](removeEntity(_0x17acf8,null))[_0xeabc('0x49')](handleError(_0x17acf8,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d13f67d..5f2f9d9 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 _0xb1d3=['AnalyticMetric','analytics_metrics','lodash','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb1d3,0xe8));var _0x3b1d=function(_0x8e1c83,_0x49a46c){_0x8e1c83=_0x8e1c83-0x0;var _0x1b4010=_0xb1d3[_0x8e1c83];return _0x1b4010;};'use strict';var _=require(_0x3b1d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3b1d('0x1'));var BPromise=require(_0x3b1d('0x2'));var rp=require(_0x3b1d('0x3'));var fs=require('fs');var path=require(_0x3b1d('0x4'));var rimraf=require('rimraf');var config=require(_0x3b1d('0x5'));var attributes=require(_0x3b1d('0x6'));module[_0x3b1d('0x7')]=function(_0x477115,_0x524e93){return _0x477115['define'](_0x3b1d('0x8'),attributes,{'tableName':_0x3b1d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4300=['bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticMetric','analytics_metrics','lodash'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x4300,0x1a6));var _0x0430=function(_0x21a07f,_0x4d68db){_0x21a07f=_0x21a07f-0x0;var _0x12a274=_0x4300[_0x21a07f];return _0x12a274;};'use strict';var _=require(_0x0430('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0430('0x1'));var rp=require(_0x0430('0x2'));var fs=require('fs');var path=require(_0x0430('0x3'));var rimraf=require(_0x0430('0x4'));var config=require(_0x0430('0x5'));var attributes=require('./analyticMetric.attributes');module[_0x0430('0x6')]=function(_0x5943c0,_0x16efe3){return _0x5943c0['define'](_0x0430('0x7'),attributes,{'tableName':_0x0430('0x8'),'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 f04832f..524145c 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 _0x2241=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0xf70201,_0x58cf09){var _0x485339=function(_0x37994d){while(--_0x37994d){_0xf70201['push'](_0xf70201['shift']());}};_0x485339(++_0x58cf09);}(_0x2241,0xee));var _0x1224=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2241[_0x432682];return _0x463d05;};'use strict';var _=require(_0x1224('0x0'));var util=require(_0x1224('0x1'));var moment=require(_0x1224('0x2'));var BPromise=require(_0x1224('0x3'));var rs=require(_0x1224('0x4'));var fs=require('fs');var Redis=require(_0x1224('0x5'));var db=require(_0x1224('0x6'))['db'];var utils=require(_0x1224('0x7'));var logger=require(_0x1224('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1224('0x9'));var client=jayson[_0x1224('0xa')][_0x1224('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cfe59,_0x127522,_0x5288ec){return new BPromise(function(_0x5796c5,_0x3a05b3){return client[_0x1224('0xc')](_0x1cfe59,_0x5288ec)[_0x1224('0xd')](function(_0x212556){logger[_0x1224('0xe')](_0x1224('0xf'),_0x127522,_0x1224('0x10'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x127522,_0x1224('0x10'),JSON['stringify'](_0x212556));if(_0x212556[_0x1224('0x11')]){if(_0x212556['error'][_0x1224('0x12')]===0x1f4){logger[_0x1224('0x11')](_0x1224('0xf'),_0x127522,_0x212556[_0x1224('0x11')]['message']);return _0x3a05b3(_0x212556[_0x1224('0x11')][_0x1224('0x13')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x127522,_0x212556[_0x1224('0x11')]['message']);return _0x5796c5(_0x212556[_0x1224('0x11')][_0x1224('0x13')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x127522,'request\x20sent');_0x5796c5(_0x212556[_0x1224('0x14')][_0x1224('0x13')]);}})[_0x1224('0x15')](function(_0x2b85e5){logger[_0x1224('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x127522,_0x2b85e5);_0x3a05b3(_0x2b85e5);});});} \ No newline at end of file +var _0xffa3=['error','code','message','request\x20sent','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xffa3,0x6d));var _0x3ffa=function(_0x21f457,_0x236b16){_0x21f457=_0x21f457-0x0;var _0x179f47=_0xffa3[_0x21f457];return _0x179f47;};'use strict';var _=require(_0x3ffa('0x0'));var util=require(_0x3ffa('0x1'));var moment=require('moment');var BPromise=require(_0x3ffa('0x2'));var rs=require(_0x3ffa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ffa('0x4'))['db'];var utils=require(_0x3ffa('0x5'));var logger=require(_0x3ffa('0x6'))(_0x3ffa('0x7'));var config=require(_0x3ffa('0x8'));var jayson=require(_0x3ffa('0x9'));var client=jayson['client'][_0x3ffa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x80d5ec,_0x5b8630,_0x5393cf){return new BPromise(function(_0x42e0c5,_0x27f378){return client['request'](_0x80d5ec,_0x5393cf)[_0x3ffa('0xb')](function(_0x301567){logger[_0x3ffa('0xc')](_0x3ffa('0xd'),_0x5b8630,'request\x20sent');logger[_0x3ffa('0xe')](_0x3ffa('0xf'),_0x5b8630,'request\x20sent',JSON[_0x3ffa('0x10')](_0x301567));if(_0x301567[_0x3ffa('0x11')]){if(_0x301567[_0x3ffa('0x11')][_0x3ffa('0x12')]===0x1f4){logger[_0x3ffa('0x11')](_0x3ffa('0xd'),_0x5b8630,_0x301567['error'][_0x3ffa('0x13')]);return _0x27f378(_0x301567[_0x3ffa('0x11')][_0x3ffa('0x13')]);}logger[_0x3ffa('0x11')](_0x3ffa('0xd'),_0x5b8630,_0x301567[_0x3ffa('0x11')][_0x3ffa('0x13')]);return _0x42e0c5(_0x301567[_0x3ffa('0x11')][_0x3ffa('0x13')]);}else{logger[_0x3ffa('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x5b8630,_0x3ffa('0x14'));_0x42e0c5(_0x301567['result'][_0x3ffa('0x13')]);}})['catch'](function(_0x29321c){logger['error'](_0x3ffa('0xd'),_0x5b8630,_0x29321c);_0x27f378(_0x29321c);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 4243563..b5bdc01 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 _0x96aa=['get','/:id','show','post','create','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index'];(function(_0x15d9c9,_0x33ea68){var _0xd8ef55=function(_0xcbc418){while(--_0xcbc418){_0x15d9c9['push'](_0x15d9c9['shift']());}};_0xd8ef55(++_0x33ea68);}(_0x96aa,0x67));var _0xa96a=function(_0xd32824,_0x4ebda0){_0xd32824=_0xd32824-0x0;var _0x5c7217=_0x96aa[_0xd32824];return _0x5c7217;};'use strict';var multer=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var path=require('path');var timeout=require(_0xa96a('0x2'));var express=require(_0xa96a('0x3'));var router=express[_0xa96a('0x4')]();var fs_extra=require(_0xa96a('0x5'));var auth=require(_0xa96a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa96a('0x7'));var controller=require(_0xa96a('0x8'));router['get']('/',auth[_0xa96a('0x9')](),controller[_0xa96a('0xa')]);router[_0xa96a('0xb')](_0xa96a('0xc'),auth[_0xa96a('0x9')](),controller[_0xa96a('0xd')]);router[_0xa96a('0xe')]('/',auth[_0xa96a('0x9')](),controller[_0xa96a('0xf')]);router[_0xa96a('0x10')](_0xa96a('0xc'),auth['isAuthenticated'](),controller[_0xa96a('0x11')]);router['delete'](_0xa96a('0xc'),auth[_0xa96a('0x9')](),controller['destroy']);module[_0xa96a('0x12')]=router; \ No newline at end of file +var _0xe5d5=['destroy','exports','path','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x5e05fe,_0x39b242){var _0x127fe3=function(_0x41909d){while(--_0x41909d){_0x5e05fe['push'](_0x5e05fe['shift']());}};_0x127fe3(++_0x39b242);}(_0xe5d5,0x156));var _0x5e5d=function(_0x4ad861,_0x156d92){_0x4ad861=_0x4ad861-0x0;var _0x13e1ff=_0xe5d5[_0x4ad861];return _0x13e1ff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5e5d('0x0'));var timeout=require('connect-timeout');var express=require(_0x5e5d('0x1'));var router=express['Router']();var fs_extra=require(_0x5e5d('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x5e5d('0x3'));var config=require(_0x5e5d('0x4'));var controller=require(_0x5e5d('0x5'));router[_0x5e5d('0x6')]('/',auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x8')]);router[_0x5e5d('0x6')](_0x5e5d('0x9'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0xa')]);router[_0x5e5d('0xb')]('/',auth[_0x5e5d('0x7')](),controller[_0x5e5d('0xc')]);router[_0x5e5d('0xd')]('/:id',auth[_0x5e5d('0x7')](),controller['update']);router[_0x5e5d('0xe')](_0x5e5d('0x9'),auth['isAuthenticated'](),controller[_0x5e5d('0xf')]);module[_0x5e5d('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f269387..a22bbca 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 _0x98e7=['exports','TEXT'];(function(_0x30da54,_0xb7cf20){var _0x390d61=function(_0x4cc728){while(--_0x4cc728){_0x30da54['push'](_0x30da54['shift']());}};_0x390d61(++_0xb7cf20);}(_0x98e7,0x96));var _0x798e=function(_0x1c08f6,_0x14c077){_0x1c08f6=_0x1c08f6-0x0;var _0xbc156a=_0x98e7[_0x1c08f6];return _0xbc156a;};'use strict';var Sequelize=require('sequelize');module[_0x798e('0x0')]={'tree':{'type':Sequelize[_0x798e('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x243e=['sequelize','exports'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x243e,0x1d6));var _0xe243=function(_0x9b3e5e,_0x3a4e56){_0x9b3e5e=_0x9b3e5e-0x0;var _0x4d7afc=_0x243e[_0x9b3e5e];return _0x4d7afc;};'use strict';var Sequelize=require(_0xe243('0x0'));module[_0xe243('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 1ab03fa..dc27a61 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 _0x74ca=['squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','AnalyticTreeReport','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','include','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','fs-extra','lodash'];(function(_0x5ee724,_0x415d2f){var _0x599c8b=function(_0x222fb4){while(--_0x222fb4){_0x5ee724['push'](_0x5ee724['shift']());}};_0x599c8b(++_0x415d2f);}(_0x74ca,0x122));var _0xa74c=function(_0x195513,_0xd158ee){_0x195513=_0x195513-0x0;var _0x4f5542=_0x74ca[_0x195513];return _0x4f5542;};'use strict';var emlformat=require(_0xa74c('0x0'));var rimraf=require(_0xa74c('0x1'));var zipdir=require(_0xa74c('0x2'));var jsonpatch=require(_0xa74c('0x3'));var rp=require(_0xa74c('0x4'));var moment=require(_0xa74c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa74c('0x6'));var util=require('util');var path=require(_0xa74c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa74c('0x8'));var _=require(_0xa74c('0x9'));var squel=require(_0xa74c('0xa'));var crypto=require(_0xa74c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa74c('0xc'));var toCsv=require(_0xa74c('0xd'));var querystring=require('querystring');var Papa=require(_0xa74c('0xe'));var Redis=require(_0xa74c('0xf'));var authService=require(_0xa74c('0x10'));var qs=require(_0xa74c('0x11'));var as=require(_0xa74c('0x12'));var hardwareService=require(_0xa74c('0x13'));var logger=require(_0xa74c('0x14'))(_0xa74c('0x15'));var utils=require(_0xa74c('0x16'));var config=require(_0xa74c('0x17'));var licenseUtil=require(_0xa74c('0x18'));var db=require(_0xa74c('0x19'))['db'];function respondWithStatusCode(_0x595add,_0x3704e0){_0x3704e0=_0x3704e0||0xcc;return function(_0xd52057){if(_0xd52057){return _0x595add[_0xa74c('0x1a')](_0x3704e0);}return _0x595add[_0xa74c('0x1b')](_0x3704e0)['end']();};}function respondWithResult(_0x1ec460,_0x397c83){_0x397c83=_0x397c83||0xc8;return function(_0x2dd79e){if(_0x2dd79e){return _0x1ec460['status'](_0x397c83)[_0xa74c('0x1c')](_0x2dd79e);}};}function respondWithFilteredResult(_0x56d16c,_0x15d9f9){return function(_0x25309c){if(_0x25309c){var _0x3fa50a=typeof _0x15d9f9[_0xa74c('0x1d')]===_0xa74c('0x1e')&&typeof _0x15d9f9[_0xa74c('0x1f')]===_0xa74c('0x1e');var _0x5daf99=_0x25309c[_0xa74c('0x20')];var _0x365fa3=_0x3fa50a?0x0:_0x15d9f9[_0xa74c('0x1d')];var _0x243b46=_0x3fa50a?_0x25309c['count']:_0x15d9f9[_0xa74c('0x1d')]+_0x15d9f9[_0xa74c('0x1f')];var _0x247664;if(_0x243b46>=_0x5daf99){_0x243b46=_0x5daf99;_0x247664=0xc8;}else{_0x247664=0xce;}_0x56d16c['status'](_0x247664);return _0x56d16c['set'](_0xa74c('0x21'),_0x365fa3+'-'+_0x243b46+'/'+_0x5daf99)[_0xa74c('0x1c')](_0x25309c);}return null;};}function patchUpdates(_0x3188fd){return function(_0x4c633e){try{jsonpatch[_0xa74c('0x22')](_0x4c633e,_0x3188fd,!![]);}catch(_0x5eda0d){return BPromise[_0xa74c('0x23')](_0x5eda0d);}return _0x4c633e[_0xa74c('0x24')]();};}function saveUpdates(_0x5c2af4,_0x161c6b){return function(_0x17fce6){if(_0x17fce6){return _0x17fce6['update'](_0x5c2af4)[_0xa74c('0x25')](function(_0x5c00da){return _0x5c00da;});}return null;};}function removeEntity(_0x15ff13,_0x101ab4){return function(_0x3b9984){if(_0x3b9984){return _0x3b9984[_0xa74c('0x26')]()[_0xa74c('0x25')](function(){_0x15ff13[_0xa74c('0x1b')](0xcc)[_0xa74c('0x27')]();});}};}function handleEntityNotFound(_0x6e04b6,_0x1b7709){return function(_0xfd3f6f){if(!_0xfd3f6f){_0x6e04b6[_0xa74c('0x1a')](0x194);}return _0xfd3f6f;};}function handleError(_0x218ae7,_0x1c75a4){_0x1c75a4=_0x1c75a4||0x1f4;return function(_0x19d678){logger[_0xa74c('0x28')](_0x19d678[_0xa74c('0x29')]);if(_0x19d678['name']){delete _0x19d678[_0xa74c('0x2a')];}_0x218ae7['status'](_0x1c75a4)[_0xa74c('0x2b')](_0x19d678);};}exports[_0xa74c('0x2c')]=function(_0x4f9aff,_0xd6ea94){var _0x3905a8={},_0x265b14={},_0x49a929={'count':0x0,'rows':[]};var _0xd77674=_['map'](db[_0xa74c('0x2d')]['rawAttributes'],function(_0x26dfee){return{'name':_0x26dfee['fieldName'],'type':_0x26dfee[_0xa74c('0x2e')][_0xa74c('0x2f')]};});_0x265b14[_0xa74c('0x30')]=_[_0xa74c('0x31')](_0xd77674,_0xa74c('0x2a'));_0x265b14[_0xa74c('0x32')]=_[_0xa74c('0x33')](_0x4f9aff[_0xa74c('0x32')]);_0x265b14[_0xa74c('0x34')]=_[_0xa74c('0x35')](_0x265b14[_0xa74c('0x30')],_0x265b14['query']);_0x3905a8['attributes']=_['intersection'](_0x265b14[_0xa74c('0x30')],qs[_0xa74c('0x36')](_0x4f9aff['query'][_0xa74c('0x36')]));_0x3905a8['attributes']=_0x3905a8['attributes'][_0xa74c('0x37')]?_0x3905a8[_0xa74c('0x38')]:_0x265b14['model'];if(!_0x4f9aff[_0xa74c('0x32')][_0xa74c('0x39')](_0xa74c('0x3a'))){_0x3905a8['limit']=qs[_0xa74c('0x1f')](_0x4f9aff[_0xa74c('0x32')]['limit']);_0x3905a8['offset']=qs['offset'](_0x4f9aff['query'][_0xa74c('0x1d')]);}_0x3905a8[_0xa74c('0x3b')]=qs[_0xa74c('0x3c')](_0x4f9aff[_0xa74c('0x32')]['sort']);_0x3905a8[_0xa74c('0x3d')]=qs['filters'](_[_0xa74c('0x3e')](_0x4f9aff[_0xa74c('0x32')],_0x265b14['filters']),_0xd77674);if(_0x4f9aff[_0xa74c('0x32')][_0xa74c('0x3f')]){_0x3905a8['where']=_[_0xa74c('0x40')](_0x3905a8[_0xa74c('0x3d')],{'$or':_['map'](_0xd77674,function(_0x54eca7){if(_0x54eca7[_0xa74c('0x2e')]!==_0xa74c('0x41')){var _0x472498={};_0x472498[_0x54eca7['name']]={'$like':'%'+_0x4f9aff['query'][_0xa74c('0x3f')]+'%'};return _0x472498;}})});}_0x3905a8=_[_0xa74c('0x40')]({},_0x3905a8,_0x4f9aff[_0xa74c('0x42')]);var _0x4a7606={'where':_0x3905a8[_0xa74c('0x3d')]};return db['AnalyticTreeReport']['count'](_0x4a7606)[_0xa74c('0x25')](function(_0x6f106e){_0x49a929[_0xa74c('0x20')]=_0x6f106e;if(_0x4f9aff[_0xa74c('0x32')][_0xa74c('0x43')]){_0x3905a8['include']=[{'all':!![]}];}return db[_0xa74c('0x2d')]['findAll'](_0x3905a8);})[_0xa74c('0x25')](function(_0x1d414b){_0x49a929['rows']=_0x1d414b;return _0x49a929;})[_0xa74c('0x25')](respondWithFilteredResult(_0xd6ea94,_0x3905a8))[_0xa74c('0x44')](handleError(_0xd6ea94,null));};exports[_0xa74c('0x45')]=function(_0x42968e,_0x5ccacb){var _0x47fdce={'raw':!![],'where':{'id':_0x42968e['params']['id']}},_0x28d493={};_0x28d493[_0xa74c('0x30')]=_[_0xa74c('0x33')](db['AnalyticTreeReport']['rawAttributes']);_0x28d493[_0xa74c('0x32')]=_[_0xa74c('0x33')](_0x42968e[_0xa74c('0x32')]);_0x28d493[_0xa74c('0x34')]=_[_0xa74c('0x35')](_0x28d493[_0xa74c('0x30')],_0x28d493[_0xa74c('0x32')]);_0x47fdce[_0xa74c('0x38')]=_['intersection'](_0x28d493[_0xa74c('0x30')],qs['fields'](_0x42968e['query']['fields']));_0x47fdce['attributes']=_0x47fdce[_0xa74c('0x38')]['length']?_0x47fdce[_0xa74c('0x38')]:_0x28d493[_0xa74c('0x30')];if(_0x42968e[_0xa74c('0x32')][_0xa74c('0x43')]){_0x47fdce[_0xa74c('0x46')]=[{'all':!![]}];}_0x47fdce=_[_0xa74c('0x40')]({},_0x47fdce,_0x42968e[_0xa74c('0x42')]);return db['AnalyticTreeReport'][_0xa74c('0x47')](_0x47fdce)[_0xa74c('0x25')](handleEntityNotFound(_0x5ccacb,null))[_0xa74c('0x25')](respondWithResult(_0x5ccacb,null))['catch'](handleError(_0x5ccacb,null));};exports[_0xa74c('0x48')]=function(_0x377b90,_0x5eab11){return db[_0xa74c('0x2d')][_0xa74c('0x48')](_0x377b90['body'],{})[_0xa74c('0x25')](respondWithResult(_0x5eab11,0xc9))[_0xa74c('0x44')](handleError(_0x5eab11,null));};exports[_0xa74c('0x49')]=function(_0x3a0edf,_0x5c6483){if(_0x3a0edf['body']['id']){delete _0x3a0edf[_0xa74c('0x4a')]['id'];}return db[_0xa74c('0x2d')]['find']({'where':{'id':_0x3a0edf['params']['id']}})[_0xa74c('0x25')](handleEntityNotFound(_0x5c6483,null))[_0xa74c('0x25')](saveUpdates(_0x3a0edf[_0xa74c('0x4a')],null))[_0xa74c('0x25')](respondWithResult(_0x5c6483,null))[_0xa74c('0x44')](handleError(_0x5c6483,null));};exports[_0xa74c('0x26')]=function(_0x4cc485,_0x2ca9e4){return db[_0xa74c('0x2d')][_0xa74c('0x47')]({'where':{'id':_0x4cc485['params']['id']}})[_0xa74c('0x25')](handleEntityNotFound(_0x2ca9e4,null))[_0xa74c('0x25')](removeEntity(_0x2ca9e4,null))[_0xa74c('0x44')](handleError(_0x2ca9e4,null));}; \ No newline at end of file +var _0x20cb=['AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','catch','show','find','create','update','body','params','destroy','fast-json-patch','request-promise','moment','mustache','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','then','end','stack','name','send','index','map'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x20cb,0x66));var _0xb20c=function(_0x1f4f5c,_0x78b830){_0x1f4f5c=_0x1f4f5c-0x0;var _0x5234ef=_0x20cb[_0x1f4f5c];return _0x5234ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb20c('0x0'));var rp=require(_0xb20c('0x1'));var moment=require(_0xb20c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb20c('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb20c('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb20c('0x5'));var squel=require(_0xb20c('0x6'));var crypto=require(_0xb20c('0x7'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb20c('0x8'));var querystring=require('querystring');var Papa=require(_0xb20c('0x9'));var Redis=require(_0xb20c('0xa'));var authService=require(_0xb20c('0xb'));var qs=require(_0xb20c('0xc'));var as=require(_0xb20c('0xd'));var hardwareService=require(_0xb20c('0xe'));var logger=require(_0xb20c('0xf'))('api');var utils=require(_0xb20c('0x10'));var config=require(_0xb20c('0x11'));var licenseUtil=require(_0xb20c('0x12'));var db=require(_0xb20c('0x13'))['db'];function respondWithStatusCode(_0x11d8ee,_0x561708){_0x561708=_0x561708||0xcc;return function(_0x3301f1){if(_0x3301f1){return _0x11d8ee[_0xb20c('0x14')](_0x561708);}return _0x11d8ee['status'](_0x561708)['end']();};}function respondWithResult(_0x2cd1c6,_0x553f13){_0x553f13=_0x553f13||0xc8;return function(_0x3bc83c){if(_0x3bc83c){return _0x2cd1c6[_0xb20c('0x15')](_0x553f13)[_0xb20c('0x16')](_0x3bc83c);}};}function respondWithFilteredResult(_0x33fc75,_0x48f10e){return function(_0xf6d200){if(_0xf6d200){var _0x2a4305=typeof _0x48f10e[_0xb20c('0x17')]===_0xb20c('0x18')&&typeof _0x48f10e['limit']===_0xb20c('0x18');var _0x2a8d64=_0xf6d200['count'];var _0x21f592=_0x2a4305?0x0:_0x48f10e['offset'];var _0x82ea5=_0x2a4305?_0xf6d200['count']:_0x48f10e[_0xb20c('0x17')]+_0x48f10e[_0xb20c('0x19')];var _0x51d28b;if(_0x82ea5>=_0x2a8d64){_0x82ea5=_0x2a8d64;_0x51d28b=0xc8;}else{_0x51d28b=0xce;}_0x33fc75[_0xb20c('0x15')](_0x51d28b);return _0x33fc75[_0xb20c('0x1a')](_0xb20c('0x1b'),_0x21f592+'-'+_0x82ea5+'/'+_0x2a8d64)[_0xb20c('0x16')](_0xf6d200);}return null;};}function patchUpdates(_0x4d4769){return function(_0x2642f2){try{jsonpatch['apply'](_0x2642f2,_0x4d4769,!![]);}catch(_0x2f0aea){return BPromise[_0xb20c('0x1c')](_0x2f0aea);}return _0x2642f2['save']();};}function saveUpdates(_0x2ddf0e,_0xb756c2){return function(_0x35c490){if(_0x35c490){return _0x35c490['update'](_0x2ddf0e)[_0xb20c('0x1d')](function(_0x24e7d5){return _0x24e7d5;});}return null;};}function removeEntity(_0x236c44,_0x489565){return function(_0x447686){if(_0x447686){return _0x447686['destroy']()[_0xb20c('0x1d')](function(){_0x236c44[_0xb20c('0x15')](0xcc)[_0xb20c('0x1e')]();});}};}function handleEntityNotFound(_0x133032,_0x39674c){return function(_0x169c4f){if(!_0x169c4f){_0x133032[_0xb20c('0x14')](0x194);}return _0x169c4f;};}function handleError(_0x152fcd,_0x3c2f64){_0x3c2f64=_0x3c2f64||0x1f4;return function(_0x31fb1b){logger['error'](_0x31fb1b[_0xb20c('0x1f')]);if(_0x31fb1b[_0xb20c('0x20')]){delete _0x31fb1b[_0xb20c('0x20')];}_0x152fcd[_0xb20c('0x15')](_0x3c2f64)[_0xb20c('0x21')](_0x31fb1b);};}exports[_0xb20c('0x22')]=function(_0x137f2b,_0x1b2b08){var _0x3cf5e9={},_0x3cfc6d={},_0x649a4d={'count':0x0,'rows':[]};var _0x3131f1=_[_0xb20c('0x23')](db[_0xb20c('0x24')][_0xb20c('0x25')],function(_0x3ccbb3){return{'name':_0x3ccbb3[_0xb20c('0x26')],'type':_0x3ccbb3[_0xb20c('0x27')][_0xb20c('0x28')]};});_0x3cfc6d[_0xb20c('0x29')]=_[_0xb20c('0x23')](_0x3131f1,_0xb20c('0x20'));_0x3cfc6d[_0xb20c('0x2a')]=_[_0xb20c('0x2b')](_0x137f2b[_0xb20c('0x2a')]);_0x3cfc6d[_0xb20c('0x2c')]=_[_0xb20c('0x2d')](_0x3cfc6d[_0xb20c('0x29')],_0x3cfc6d[_0xb20c('0x2a')]);_0x3cf5e9['attributes']=_[_0xb20c('0x2d')](_0x3cfc6d[_0xb20c('0x29')],qs[_0xb20c('0x2e')](_0x137f2b[_0xb20c('0x2a')]['fields']));_0x3cf5e9[_0xb20c('0x2f')]=_0x3cf5e9[_0xb20c('0x2f')][_0xb20c('0x30')]?_0x3cf5e9['attributes']:_0x3cfc6d['model'];if(!_0x137f2b[_0xb20c('0x2a')][_0xb20c('0x31')](_0xb20c('0x32'))){_0x3cf5e9[_0xb20c('0x19')]=qs[_0xb20c('0x19')](_0x137f2b['query'][_0xb20c('0x19')]);_0x3cf5e9['offset']=qs[_0xb20c('0x17')](_0x137f2b[_0xb20c('0x2a')][_0xb20c('0x17')]);}_0x3cf5e9['order']=qs[_0xb20c('0x33')](_0x137f2b['query']['sort']);_0x3cf5e9['where']=qs[_0xb20c('0x2c')](_[_0xb20c('0x34')](_0x137f2b[_0xb20c('0x2a')],_0x3cfc6d[_0xb20c('0x2c')]),_0x3131f1);if(_0x137f2b['query'][_0xb20c('0x35')]){_0x3cf5e9['where']=_[_0xb20c('0x36')](_0x3cf5e9[_0xb20c('0x37')],{'$or':_[_0xb20c('0x23')](_0x3131f1,function(_0x5d9bbe){if(_0x5d9bbe[_0xb20c('0x27')]!==_0xb20c('0x38')){var _0x4b10fc={};_0x4b10fc[_0x5d9bbe[_0xb20c('0x20')]]={'$like':'%'+_0x137f2b[_0xb20c('0x2a')][_0xb20c('0x35')]+'%'};return _0x4b10fc;}})});}_0x3cf5e9=_[_0xb20c('0x36')]({},_0x3cf5e9,_0x137f2b[_0xb20c('0x39')]);var _0x12bb69={'where':_0x3cf5e9['where']};return db[_0xb20c('0x24')][_0xb20c('0x3a')](_0x12bb69)[_0xb20c('0x1d')](function(_0x2d1bd9){_0x649a4d[_0xb20c('0x3a')]=_0x2d1bd9;if(_0x137f2b['query'][_0xb20c('0x3b')]){_0x3cf5e9[_0xb20c('0x3c')]=[{'all':!![]}];}return db[_0xb20c('0x24')]['findAll'](_0x3cf5e9);})[_0xb20c('0x1d')](function(_0x4f254d){_0x649a4d['rows']=_0x4f254d;return _0x649a4d;})[_0xb20c('0x1d')](respondWithFilteredResult(_0x1b2b08,_0x3cf5e9))[_0xb20c('0x3d')](handleError(_0x1b2b08,null));};exports[_0xb20c('0x3e')]=function(_0x185877,_0x1ad17c){var _0x389300={'raw':!![],'where':{'id':_0x185877['params']['id']}},_0x5c905d={};_0x5c905d[_0xb20c('0x29')]=_['keys'](db[_0xb20c('0x24')][_0xb20c('0x25')]);_0x5c905d[_0xb20c('0x2a')]=_[_0xb20c('0x2b')](_0x185877['query']);_0x5c905d['filters']=_[_0xb20c('0x2d')](_0x5c905d[_0xb20c('0x29')],_0x5c905d[_0xb20c('0x2a')]);_0x389300['attributes']=_[_0xb20c('0x2d')](_0x5c905d[_0xb20c('0x29')],qs[_0xb20c('0x2e')](_0x185877[_0xb20c('0x2a')]['fields']));_0x389300[_0xb20c('0x2f')]=_0x389300[_0xb20c('0x2f')][_0xb20c('0x30')]?_0x389300[_0xb20c('0x2f')]:_0x5c905d[_0xb20c('0x29')];if(_0x185877[_0xb20c('0x2a')][_0xb20c('0x3b')]){_0x389300[_0xb20c('0x3c')]=[{'all':!![]}];}_0x389300=_[_0xb20c('0x36')]({},_0x389300,_0x185877[_0xb20c('0x39')]);return db[_0xb20c('0x24')][_0xb20c('0x3f')](_0x389300)[_0xb20c('0x1d')](handleEntityNotFound(_0x1ad17c,null))[_0xb20c('0x1d')](respondWithResult(_0x1ad17c,null))[_0xb20c('0x3d')](handleError(_0x1ad17c,null));};exports[_0xb20c('0x40')]=function(_0xa65caf,_0x3c9946){return db['AnalyticTreeReport'][_0xb20c('0x40')](_0xa65caf['body'],{})[_0xb20c('0x1d')](respondWithResult(_0x3c9946,0xc9))['catch'](handleError(_0x3c9946,null));};exports[_0xb20c('0x41')]=function(_0x15da64,_0x51410b){if(_0x15da64[_0xb20c('0x42')]['id']){delete _0x15da64[_0xb20c('0x42')]['id'];}return db['AnalyticTreeReport'][_0xb20c('0x3f')]({'where':{'id':_0x15da64[_0xb20c('0x43')]['id']}})['then'](handleEntityNotFound(_0x51410b,null))[_0xb20c('0x1d')](saveUpdates(_0x15da64['body'],null))['then'](respondWithResult(_0x51410b,null))['catch'](handleError(_0x51410b,null));};exports[_0xb20c('0x44')]=function(_0x458ebc,_0x71bc0c){return db[_0xb20c('0x24')][_0xb20c('0x3f')]({'where':{'id':_0x458ebc[_0xb20c('0x43')]['id']}})['then'](handleEntityNotFound(_0x71bc0c,null))['then'](removeEntity(_0x71bc0c,null))[_0xb20c('0x3d')](handleError(_0x71bc0c,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e7bf44a..2f1d70f 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 _0x862e=['lodash','../../config/logger','moment','bluebird','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x29fd16,_0x404af3){var _0x45d208=function(_0x450c55){while(--_0x450c55){_0x29fd16['push'](_0x29fd16['shift']());}};_0x45d208(++_0x404af3);}(_0x862e,0x6e));var _0xe862=function(_0x209d2a,_0x59a302){_0x209d2a=_0x209d2a-0x0;var _0x2d2a4a=_0x862e[_0x209d2a];return _0x2d2a4a;};'use strict';var _=require(_0xe862('0x0'));var util=require('util');var logger=require(_0xe862('0x1'))('api');var moment=require(_0xe862('0x2'));var BPromise=require(_0xe862('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe862('0x4'));var attributes=require(_0xe862('0x5'));module[_0xe862('0x6')]=function(_0x3fe678,_0x388906){return _0x3fe678[_0xe862('0x7')](_0xe862('0x8'),attributes,{'tableName':_0xe862('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d05=['lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2d05,0x1e0));var _0x52d0=function(_0x4ff84a,_0x27224f){_0x4ff84a=_0x4ff84a-0x0;var _0x1f6b53=_0x2d05[_0x4ff84a];return _0x1f6b53;};'use strict';var _=require(_0x52d0('0x0'));var util=require('util');var logger=require(_0x52d0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x52d0('0x2'));var rp=require(_0x52d0('0x3'));var fs=require('fs');var path=require(_0x52d0('0x4'));var rimraf=require('rimraf');var config=require(_0x52d0('0x5'));var attributes=require(_0x52d0('0x6'));module['exports']=function(_0x4ef679,_0x309586){return _0x4ef679[_0x52d0('0x7')](_0x52d0('0x8'),attributes,{'tableName':_0x52d0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index d4305a9..d8a33b3 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x561389,_0x174e1a){_0x561389=_0x561389-0x0;var _0x21ff8d=_0x7a54[_0x561389];return _0x21ff8d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x4174ad,_0xf2743){var _0x337155=function(_0x5be0be){while(--_0x5be0be){_0x4174ad['push'](_0x4174ad['shift']());}};_0x337155(++_0xf2743);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc4aa[_0x8c43de];return _0xa6591b;};'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 f82fc0a..e891718 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 _0xfa89=['../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3ac1be,_0x54f7fc){var _0x24cdb2=function(_0x26cc5d){while(--_0x26cc5d){_0x3ac1be['push'](_0x3ac1be['shift']());}};_0x24cdb2(++_0x54f7fc);}(_0xfa89,0x76));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9fa8('0x0'));var util=require(_0x9fa8('0x1'));var path=require(_0x9fa8('0x2'));var timeout=require(_0x9fa8('0x3'));var express=require(_0x9fa8('0x4'));var router=express['Router']();var fs_extra=require(_0x9fa8('0x5'));var auth=require(_0x9fa8('0x6'));var interaction=require(_0x9fa8('0x7'));var config=require(_0x9fa8('0x8'));var controller=require(_0x9fa8('0x9'));router[_0x9fa8('0xa')]('/',auth[_0x9fa8('0xb')](),controller['index']);router[_0x9fa8('0xa')](_0x9fa8('0xc'),auth[_0x9fa8('0xb')](),controller[_0x9fa8('0xd')]);router[_0x9fa8('0xe')]('/',auth[_0x9fa8('0xb')](),controller[_0x9fa8('0xf')]);router[_0x9fa8('0x10')](_0x9fa8('0xc'),auth[_0x9fa8('0xb')](),controller[_0x9fa8('0x11')]);router[_0x9fa8('0x12')](_0x9fa8('0xc'),auth['isAuthenticated'](),controller[_0x9fa8('0x13')]);module[_0x9fa8('0x14')]=router; \ No newline at end of file +var _0xc69e=['destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','post','create','put','update'];(function(_0x62b584,_0x59cdf5){var _0x245dfb=function(_0x4288d4){while(--_0x4288d4){_0x62b584['push'](_0x62b584['shift']());}};_0x245dfb(++_0x59cdf5);}(_0xc69e,0x132));var _0xec69=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc69e[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0xec69('0x0'));var path=require(_0xec69('0x1'));var timeout=require('connect-timeout');var express=require(_0xec69('0x2'));var router=express[_0xec69('0x3')]();var fs_extra=require(_0xec69('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xec69('0x5'));var config=require(_0xec69('0x6'));var controller=require(_0xec69('0x7'));router['get']('/',auth[_0xec69('0x8')](),controller[_0xec69('0x9')]);router[_0xec69('0xa')](_0xec69('0xb'),auth['isAuthenticated'](),controller[_0xec69('0xc')]);router[_0xec69('0xd')]('/',auth[_0xec69('0x8')](),controller[_0xec69('0xe')]);router[_0xec69('0xf')](_0xec69('0xb'),auth[_0xec69('0x8')](),controller[_0xec69('0x10')]);router['delete'](_0xec69('0xb'),auth[_0xec69('0x8')](),controller[_0xec69('0x11')]);module[_0xec69('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 7586087..2b14acd 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 _0x05b0=['STRING'];(function(_0xbe74d5,_0x3cafa4){var _0x16f9b7=function(_0xf91a32){while(--_0xf91a32){_0xbe74d5['push'](_0xbe74d5['shift']());}};_0x16f9b7(++_0x3cafa4);}(_0x05b0,0x188));var _0x005b=function(_0xa19a0b,_0x22ce7b){_0xa19a0b=_0xa19a0b-0x0;var _0x30534c=_0x05b0[_0xa19a0b];return _0x30534c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x005b('0x0')]},'basename':{'type':Sequelize[_0x005b('0x0')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x27c9=['exports','STRING','sequelize'];(function(_0x4b5325,_0x5bc67f){var _0x3d8fe5=function(_0x5c0b5e){while(--_0x5c0b5e){_0x4b5325['push'](_0x4b5325['shift']());}};_0x3d8fe5(++_0x5bc67f);}(_0x27c9,0x1af));var _0x927c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x27c9[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x927c('0x0'));module[_0x927c('0x1')]={'name':{'type':Sequelize[_0x927c('0x2')]},'basename':{'type':Sequelize[_0x927c('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1e68b88..856bdf4 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 _0x09c0=['offset','undefined','count','limit','status','Content-Range','apply','save','update','destroy','then','error','name','send','index','map','Attachment','rawAttributes','fieldName','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','clone','get','createdAt','updatedAt','body','omit','create','basename','file','mimetype','download','findOne','ChatOfflineMessageId','offline-chat/','join','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0xa89cb1,_0xbf2ea6){var _0x5257c1=function(_0x55a5c8){while(--_0x55a5c8){_0xa89cb1['push'](_0xa89cb1['shift']());}};_0x5257c1(++_0xbf2ea6);}(_0x09c0,0x19d));var _0x009c=function(_0x2c66d3,_0x202350){_0x2c66d3=_0x2c66d3-0x0;var _0x414cab=_0x09c0[_0x2c66d3];return _0x414cab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x009c('0x0'));var zipdir=require(_0x009c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x009c('0x2'));var moment=require(_0x009c('0x3'));var BPromise=require(_0x009c('0x4'));var Mustache=require('mustache');var util=require(_0x009c('0x5'));var path=require(_0x009c('0x6'));var sox=require(_0x009c('0x7'));var csv=require(_0x009c('0x8'));var ejs=require(_0x009c('0x9'));var fs=require('fs');var fs_extra=require(_0x009c('0xa'));var _=require(_0x009c('0xb'));var squel=require(_0x009c('0xc'));var crypto=require(_0x009c('0xd'));var jsforce=require(_0x009c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x009c('0x8'));var querystring=require(_0x009c('0xf'));var Papa=require('papaparse');var Redis=require(_0x009c('0x10'));var authService=require(_0x009c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x009c('0x12'));var hardwareService=require(_0x009c('0x13'));var logger=require('../../config/logger')(_0x009c('0x14'));var utils=require(_0x009c('0x15'));var config=require(_0x009c('0x16'));var licenseUtil=require(_0x009c('0x17'));var db=require(_0x009c('0x18'))['db'];function respondWithStatusCode(_0x284a65,_0x54003a){_0x54003a=_0x54003a||0xcc;return function(_0x5d8ddc){if(_0x5d8ddc){return _0x284a65[_0x009c('0x19')](_0x54003a);}return _0x284a65['status'](_0x54003a)[_0x009c('0x1a')]();};}function respondWithResult(_0x136808,_0x27a050){_0x27a050=_0x27a050||0xc8;return function(_0x2a0559){if(_0x2a0559){return _0x136808['status'](_0x27a050)['json'](_0x2a0559);}};}function respondWithFilteredResult(_0x189b0d,_0x46a804){return function(_0x6a9d3){if(_0x6a9d3){var _0x58d7c5=typeof _0x46a804[_0x009c('0x1b')]===_0x009c('0x1c')&&typeof _0x46a804['limit']==='undefined';var _0x595b5e=_0x6a9d3[_0x009c('0x1d')];var _0x5936ce=_0x58d7c5?0x0:_0x46a804['offset'];var _0x59dfab=_0x58d7c5?_0x6a9d3[_0x009c('0x1d')]:_0x46a804[_0x009c('0x1b')]+_0x46a804[_0x009c('0x1e')];var _0xab22;if(_0x59dfab>=_0x595b5e){_0x59dfab=_0x595b5e;_0xab22=0xc8;}else{_0xab22=0xce;}_0x189b0d[_0x009c('0x1f')](_0xab22);return _0x189b0d['set'](_0x009c('0x20'),_0x5936ce+'-'+_0x59dfab+'/'+_0x595b5e)['json'](_0x6a9d3);}return null;};}function patchUpdates(_0x558e22){return function(_0x3a2ccf){try{jsonpatch[_0x009c('0x21')](_0x3a2ccf,_0x558e22,!![]);}catch(_0x1a5587){return BPromise['reject'](_0x1a5587);}return _0x3a2ccf[_0x009c('0x22')]();};}function saveUpdates(_0xf6116e,_0xec10bb){return function(_0x23d293){if(_0x23d293){return _0x23d293[_0x009c('0x23')](_0xf6116e)['then'](function(_0x153733){return _0x153733;});}return null;};}function removeEntity(_0x359bab,_0x2da6ba){return function(_0x57c2ac){if(_0x57c2ac){return _0x57c2ac[_0x009c('0x24')]()[_0x009c('0x25')](function(){_0x359bab['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4579e7,_0x3113fa){return function(_0x44f66e){if(!_0x44f66e){_0x4579e7['sendStatus'](0x194);}return _0x44f66e;};}function handleError(_0x5af832,_0x59cee6){_0x59cee6=_0x59cee6||0x1f4;return function(_0x24965c){logger[_0x009c('0x26')](_0x24965c['stack']);if(_0x24965c[_0x009c('0x27')]){delete _0x24965c[_0x009c('0x27')];}_0x5af832['status'](_0x59cee6)[_0x009c('0x28')](_0x24965c);};}exports[_0x009c('0x29')]=function(_0x5b46eb,_0x291587){var _0x2cef15={},_0x11bb5f={},_0x2cf1a9={'count':0x0,'rows':[]};var _0x10c691=_[_0x009c('0x2a')](db[_0x009c('0x2b')][_0x009c('0x2c')],function(_0x1c872a){return{'name':_0x1c872a[_0x009c('0x2d')],'type':_0x1c872a['type']['key']};});_0x11bb5f['model']=_[_0x009c('0x2a')](_0x10c691,_0x009c('0x27'));_0x11bb5f[_0x009c('0x2e')]=_['keys'](_0x5b46eb[_0x009c('0x2e')]);_0x11bb5f[_0x009c('0x2f')]=_[_0x009c('0x30')](_0x11bb5f['model'],_0x11bb5f[_0x009c('0x2e')]);_0x2cef15[_0x009c('0x31')]=_[_0x009c('0x30')](_0x11bb5f[_0x009c('0x32')],qs[_0x009c('0x33')](_0x5b46eb[_0x009c('0x2e')][_0x009c('0x33')]));_0x2cef15[_0x009c('0x31')]=_0x2cef15[_0x009c('0x31')][_0x009c('0x34')]?_0x2cef15['attributes']:_0x11bb5f[_0x009c('0x32')];if(!_0x5b46eb['query'][_0x009c('0x35')](_0x009c('0x36'))){_0x2cef15[_0x009c('0x1e')]=qs[_0x009c('0x1e')](_0x5b46eb['query'][_0x009c('0x1e')]);_0x2cef15['offset']=qs['offset'](_0x5b46eb[_0x009c('0x2e')][_0x009c('0x1b')]);}_0x2cef15[_0x009c('0x37')]=qs[_0x009c('0x38')](_0x5b46eb[_0x009c('0x2e')]['sort']);_0x2cef15['where']=qs['filters'](_[_0x009c('0x39')](_0x5b46eb[_0x009c('0x2e')],_0x11bb5f[_0x009c('0x2f')]),_0x10c691);if(_0x5b46eb['query'][_0x009c('0x3a')]){_0x2cef15[_0x009c('0x3b')]=_[_0x009c('0x3c')](_0x2cef15['where'],{'$or':_[_0x009c('0x2a')](_0x10c691,function(_0x3c3d6b){if(_0x3c3d6b[_0x009c('0x3d')]!==_0x009c('0x3e')){var _0x14258b={};_0x14258b[_0x3c3d6b['name']]={'$like':'%'+_0x5b46eb[_0x009c('0x2e')][_0x009c('0x3a')]+'%'};return _0x14258b;}})});}_0x2cef15=_[_0x009c('0x3c')]({},_0x2cef15,_0x5b46eb['options']);var _0x218026={'where':_0x2cef15[_0x009c('0x3b')]};return db['Attachment'][_0x009c('0x1d')](_0x218026)[_0x009c('0x25')](function(_0x5784f0){_0x2cf1a9['count']=_0x5784f0;if(_0x5b46eb['query'][_0x009c('0x3f')]){_0x2cef15[_0x009c('0x40')]=[{'all':!![]}];}return db['Attachment'][_0x009c('0x41')](_0x2cef15);})[_0x009c('0x25')](function(_0x36c6e1){_0x2cf1a9[_0x009c('0x42')]=_0x36c6e1;return _0x2cf1a9;})[_0x009c('0x25')](respondWithFilteredResult(_0x291587,_0x2cef15))[_0x009c('0x43')](handleError(_0x291587,null));};exports[_0x009c('0x44')]=function(_0x5b5dca,_0x3ace25){var _0x5040eb={'raw':!![],'where':{'id':_0x5b5dca[_0x009c('0x45')]['id']}},_0x2a44d3={};_0x2a44d3[_0x009c('0x32')]=_['keys'](db[_0x009c('0x2b')][_0x009c('0x2c')]);_0x2a44d3[_0x009c('0x2e')]=_[_0x009c('0x46')](_0x5b5dca[_0x009c('0x2e')]);_0x2a44d3['filters']=_[_0x009c('0x30')](_0x2a44d3[_0x009c('0x32')],_0x2a44d3[_0x009c('0x2e')]);_0x5040eb[_0x009c('0x31')]=_[_0x009c('0x30')](_0x2a44d3['model'],qs[_0x009c('0x33')](_0x5b5dca[_0x009c('0x2e')][_0x009c('0x33')]));_0x5040eb[_0x009c('0x31')]=_0x5040eb[_0x009c('0x31')][_0x009c('0x34')]?_0x5040eb[_0x009c('0x31')]:_0x2a44d3['model'];if(_0x5b5dca[_0x009c('0x2e')][_0x009c('0x3f')]){_0x5040eb[_0x009c('0x40')]=[{'all':!![]}];}_0x5040eb=_[_0x009c('0x3c')]({},_0x5040eb,_0x5b5dca[_0x009c('0x47')]);return db[_0x009c('0x2b')][_0x009c('0x48')](_0x5040eb)[_0x009c('0x25')](handleEntityNotFound(_0x3ace25,null))[_0x009c('0x25')](respondWithResult(_0x3ace25,null))[_0x009c('0x43')](handleError(_0x3ace25,null));};exports[_0x009c('0x49')]=function(_0x560d7f,_0x343f53){var _0x5ca418={'where':{'id':_0x560d7f[_0x009c('0x45')]['id']}},_0x81841f={};_0x81841f[_0x009c('0x32')]=_[_0x009c('0x46')](db['Attachment'][_0x009c('0x2c')]);_0x5ca418[_0x009c('0x31')]=_['intersection'](_0x81841f[_0x009c('0x32')],qs[_0x009c('0x33')](_0x560d7f['query'][_0x009c('0x33')]));_0x5ca418[_0x009c('0x31')]=_0x5ca418[_0x009c('0x31')]['length']?_0x5ca418[_0x009c('0x31')]:_0x81841f[_0x009c('0x32')];if(_0x560d7f['query'][_0x009c('0x3f')]){_0x5ca418[_0x009c('0x40')]=[{'all':!![]}];}_0x5ca418=_[_0x009c('0x3c')]({},_0x5ca418,_0x560d7f[_0x009c('0x47')]);return db[_0x009c('0x2b')][_0x009c('0x48')](_0x5ca418)[_0x009c('0x25')](handleEntityNotFound(_0x343f53,null))['then'](function(_0x401037){if(_0x401037){var _0xf6f58a=_0x401037[_0x009c('0x4a')]({'plain':!![]});_0xf6f58a=qs['omit'](_0xf6f58a,['id',_0x009c('0x4b'),_0x009c('0x4c')]);_0x560d7f[_0x009c('0x4d')]=_[_0x009c('0x4e')](_0x560d7f[_0x009c('0x4d')],['id',_0x009c('0x4b'),_0x009c('0x4c')]);return db[_0x009c('0x2b')][_0x009c('0x4f')](_[_0x009c('0x3c')](_0xf6f58a,_0x560d7f[_0x009c('0x4d')]),{'include':_0x560d7f[_0x009c('0x2e')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x009c('0x25')](respondWithResult(_0x343f53,0xc9))[_0x009c('0x43')](handleError(_0x343f53,null));};exports[_0x009c('0x23')]=function(_0x2078be,_0x5f80f6){if(_0x2078be['body']['id']){delete _0x2078be[_0x009c('0x4d')]['id'];}return db[_0x009c('0x2b')][_0x009c('0x48')]({'where':{'id':_0x2078be['params']['id']}})[_0x009c('0x25')](handleEntityNotFound(_0x5f80f6,null))[_0x009c('0x25')](saveUpdates(_0x2078be['body'],null))['then'](respondWithResult(_0x5f80f6,null))['catch'](handleError(_0x5f80f6,null));};exports[_0x009c('0x24')]=function(_0x1f890b,_0x41c6b9){return db['Attachment'][_0x009c('0x48')]({'where':{'id':_0x1f890b[_0x009c('0x45')]['id']}})[_0x009c('0x25')](handleEntityNotFound(_0x41c6b9,null))[_0x009c('0x25')](removeEntity(_0x41c6b9,null))[_0x009c('0x43')](handleError(_0x41c6b9,null));};exports[_0x009c('0x4f')]=function(_0x41e0b0,_0x127b59,_0x25786d){_0x41e0b0[_0x009c('0x4d')]['name']=_0x41e0b0['file']['originalname'];_0x41e0b0[_0x009c('0x4d')][_0x009c('0x50')]=_0x41e0b0[_0x009c('0x51')]['filename'];_0x41e0b0['body'][_0x009c('0x3d')]=_0x41e0b0[_0x009c('0x51')][_0x009c('0x52')];return db[_0x009c('0x2b')][_0x009c('0x4f')](_0x41e0b0['body'])[_0x009c('0x25')](respondWithResult(_0x127b59,0xc9))['catch'](handleError(_0x127b59,null));};exports[_0x009c('0x53')]=function(_0x114a06,_0x45c25d,_0x7a14cd){return db['Attachment'][_0x009c('0x54')]({'where':{'id':_0x114a06[_0x009c('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x45c25d,null))[_0x009c('0x25')](function(_0xe2d314){if(_0xe2d314){var _0x11773e=_0xe2d314[_0x009c('0x55')]!==null;var _0x7cb29e=path['join'](config['root'],'server/files/attachments/');if(_0x11773e){_0x7cb29e=path['join'](_0x7cb29e,_0x009c('0x56'));}var _0x46bcd6=path[_0x009c('0x57')](_0x7cb29e,_0xe2d314[_0x009c('0x50')]);return _0x45c25d[_0x009c('0x53')](_0x46bcd6);}})[_0x009c('0x43')](handleError(_0x45c25d,null));}; \ No newline at end of file +var _0x5322=['error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','Attachment','includeAll','findAll','rows','then','catch','params','include','clone','get','omit','createdAt','updatedAt','body','create','destroy','originalname','basename','file','filename','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','eml-format','rimraf','request-promise','moment','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x199f80,_0x334c48){var _0x42fdbc=function(_0x2ece85){while(--_0x2ece85){_0x199f80['push'](_0x199f80['shift']());}};_0x42fdbc(++_0x334c48);}(_0x5322,0x8e));var _0x2532=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x5322[_0x4b2436];return _0x4f5ab2;};'use strict';var emlformat=require(_0x2532('0x0'));var rimraf=require(_0x2532('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2532('0x2'));var moment=require(_0x2532('0x3'));var BPromise=require(_0x2532('0x4'));var Mustache=require('mustache');var util=require(_0x2532('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2532('0x6'));var fs=require('fs');var fs_extra=require(_0x2532('0x7'));var _=require('lodash');var squel=require(_0x2532('0x8'));var crypto=require(_0x2532('0x9'));var jsforce=require(_0x2532('0xa'));var deskjs=require(_0x2532('0xb'));var toCsv=require(_0x2532('0xc'));var querystring=require('querystring');var Papa=require(_0x2532('0xd'));var Redis=require(_0x2532('0xe'));var authService=require(_0x2532('0xf'));var qs=require(_0x2532('0x10'));var as=require(_0x2532('0x11'));var hardwareService=require(_0x2532('0x12'));var logger=require(_0x2532('0x13'))(_0x2532('0x14'));var utils=require('../../config/utils');var config=require(_0x2532('0x15'));var licenseUtil=require(_0x2532('0x16'));var db=require(_0x2532('0x17'))['db'];function respondWithStatusCode(_0x32e4d5,_0x1cd3f7){_0x1cd3f7=_0x1cd3f7||0xcc;return function(_0x9e8d69){if(_0x9e8d69){return _0x32e4d5[_0x2532('0x18')](_0x1cd3f7);}return _0x32e4d5[_0x2532('0x19')](_0x1cd3f7)[_0x2532('0x1a')]();};}function respondWithResult(_0x2cd66e,_0x2f22c1){_0x2f22c1=_0x2f22c1||0xc8;return function(_0x8c9231){if(_0x8c9231){return _0x2cd66e[_0x2532('0x19')](_0x2f22c1)[_0x2532('0x1b')](_0x8c9231);}};}function respondWithFilteredResult(_0xd1c734,_0x11fef2){return function(_0x1a01da){if(_0x1a01da){var _0x556188=typeof _0x11fef2[_0x2532('0x1c')]===_0x2532('0x1d')&&typeof _0x11fef2[_0x2532('0x1e')]==='undefined';var _0x5e586e=_0x1a01da[_0x2532('0x1f')];var _0x4e605f=_0x556188?0x0:_0x11fef2[_0x2532('0x1c')];var _0x4e2c5c=_0x556188?_0x1a01da['count']:_0x11fef2['offset']+_0x11fef2['limit'];var _0x2e101a;if(_0x4e2c5c>=_0x5e586e){_0x4e2c5c=_0x5e586e;_0x2e101a=0xc8;}else{_0x2e101a=0xce;}_0xd1c734[_0x2532('0x19')](_0x2e101a);return _0xd1c734[_0x2532('0x20')](_0x2532('0x21'),_0x4e605f+'-'+_0x4e2c5c+'/'+_0x5e586e)[_0x2532('0x1b')](_0x1a01da);}return null;};}function patchUpdates(_0x271159){return function(_0x40be69){try{jsonpatch[_0x2532('0x22')](_0x40be69,_0x271159,!![]);}catch(_0x24860b){return BPromise[_0x2532('0x23')](_0x24860b);}return _0x40be69[_0x2532('0x24')]();};}function saveUpdates(_0x1852e5,_0x24ba56){return function(_0x2e52c6){if(_0x2e52c6){return _0x2e52c6[_0x2532('0x25')](_0x1852e5)['then'](function(_0xae6a52){return _0xae6a52;});}return null;};}function removeEntity(_0x2cbb47,_0x55a9ec){return function(_0xdca9a3){if(_0xdca9a3){return _0xdca9a3['destroy']()['then'](function(){_0x2cbb47[_0x2532('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d95c2,_0x40a029){return function(_0x5a6a95){if(!_0x5a6a95){_0x4d95c2[_0x2532('0x18')](0x194);}return _0x5a6a95;};}function handleError(_0x35ab87,_0x36ec63){_0x36ec63=_0x36ec63||0x1f4;return function(_0x49ac0a){logger[_0x2532('0x26')](_0x49ac0a[_0x2532('0x27')]);if(_0x49ac0a[_0x2532('0x28')]){delete _0x49ac0a['name'];}_0x35ab87[_0x2532('0x19')](_0x36ec63)[_0x2532('0x29')](_0x49ac0a);};}exports['index']=function(_0x406ceb,_0x1d8fc1){var _0x18becb={},_0x55f1ad={},_0x52bab8={'count':0x0,'rows':[]};var _0x1de451=_[_0x2532('0x2a')](db['Attachment'][_0x2532('0x2b')],function(_0x475fb9){return{'name':_0x475fb9[_0x2532('0x2c')],'type':_0x475fb9['type'][_0x2532('0x2d')]};});_0x55f1ad['model']=_[_0x2532('0x2a')](_0x1de451,_0x2532('0x28'));_0x55f1ad[_0x2532('0x2e')]=_[_0x2532('0x2f')](_0x406ceb['query']);_0x55f1ad[_0x2532('0x30')]=_[_0x2532('0x31')](_0x55f1ad['model'],_0x55f1ad[_0x2532('0x2e')]);_0x18becb[_0x2532('0x32')]=_[_0x2532('0x31')](_0x55f1ad[_0x2532('0x33')],qs[_0x2532('0x34')](_0x406ceb['query'][_0x2532('0x34')]));_0x18becb[_0x2532('0x32')]=_0x18becb[_0x2532('0x32')][_0x2532('0x35')]?_0x18becb[_0x2532('0x32')]:_0x55f1ad[_0x2532('0x33')];if(!_0x406ceb['query'][_0x2532('0x36')](_0x2532('0x37'))){_0x18becb[_0x2532('0x1e')]=qs[_0x2532('0x1e')](_0x406ceb[_0x2532('0x2e')][_0x2532('0x1e')]);_0x18becb[_0x2532('0x1c')]=qs[_0x2532('0x1c')](_0x406ceb['query'][_0x2532('0x1c')]);}_0x18becb[_0x2532('0x38')]=qs[_0x2532('0x39')](_0x406ceb[_0x2532('0x2e')]['sort']);_0x18becb[_0x2532('0x3a')]=qs[_0x2532('0x30')](_[_0x2532('0x3b')](_0x406ceb['query'],_0x55f1ad[_0x2532('0x30')]),_0x1de451);if(_0x406ceb['query']['filter']){_0x18becb[_0x2532('0x3a')]=_[_0x2532('0x3c')](_0x18becb[_0x2532('0x3a')],{'$or':_[_0x2532('0x2a')](_0x1de451,function(_0x283921){if(_0x283921[_0x2532('0x3d')]!==_0x2532('0x3e')){var _0x5cf0c6={};_0x5cf0c6[_0x283921[_0x2532('0x28')]]={'$like':'%'+_0x406ceb[_0x2532('0x2e')]['filter']+'%'};return _0x5cf0c6;}})});}_0x18becb=_[_0x2532('0x3c')]({},_0x18becb,_0x406ceb[_0x2532('0x3f')]);var _0x4f0fd7={'where':_0x18becb[_0x2532('0x3a')]};return db[_0x2532('0x40')][_0x2532('0x1f')](_0x4f0fd7)['then'](function(_0xa78c48){_0x52bab8[_0x2532('0x1f')]=_0xa78c48;if(_0x406ceb[_0x2532('0x2e')][_0x2532('0x41')]){_0x18becb['include']=[{'all':!![]}];}return db[_0x2532('0x40')][_0x2532('0x42')](_0x18becb);})['then'](function(_0x2b60d4){_0x52bab8[_0x2532('0x43')]=_0x2b60d4;return _0x52bab8;})[_0x2532('0x44')](respondWithFilteredResult(_0x1d8fc1,_0x18becb))[_0x2532('0x45')](handleError(_0x1d8fc1,null));};exports['show']=function(_0x410f1f,_0x5eaea9){var _0x1e9d9f={'raw':!![],'where':{'id':_0x410f1f[_0x2532('0x46')]['id']}},_0x349216={};_0x349216['model']=_['keys'](db[_0x2532('0x40')][_0x2532('0x2b')]);_0x349216[_0x2532('0x2e')]=_[_0x2532('0x2f')](_0x410f1f[_0x2532('0x2e')]);_0x349216[_0x2532('0x30')]=_['intersection'](_0x349216[_0x2532('0x33')],_0x349216[_0x2532('0x2e')]);_0x1e9d9f[_0x2532('0x32')]=_[_0x2532('0x31')](_0x349216[_0x2532('0x33')],qs[_0x2532('0x34')](_0x410f1f['query']['fields']));_0x1e9d9f['attributes']=_0x1e9d9f[_0x2532('0x32')]['length']?_0x1e9d9f['attributes']:_0x349216[_0x2532('0x33')];if(_0x410f1f['query'][_0x2532('0x41')]){_0x1e9d9f[_0x2532('0x47')]=[{'all':!![]}];}_0x1e9d9f=_[_0x2532('0x3c')]({},_0x1e9d9f,_0x410f1f[_0x2532('0x3f')]);return db[_0x2532('0x40')]['find'](_0x1e9d9f)[_0x2532('0x44')](handleEntityNotFound(_0x5eaea9,null))[_0x2532('0x44')](respondWithResult(_0x5eaea9,null))[_0x2532('0x45')](handleError(_0x5eaea9,null));};exports[_0x2532('0x48')]=function(_0x41c729,_0x17a10b){var _0x235491={'where':{'id':_0x41c729['params']['id']}},_0x152ea0={};_0x152ea0['model']=_[_0x2532('0x2f')](db[_0x2532('0x40')][_0x2532('0x2b')]);_0x235491['attributes']=_[_0x2532('0x31')](_0x152ea0[_0x2532('0x33')],qs[_0x2532('0x34')](_0x41c729[_0x2532('0x2e')][_0x2532('0x34')]));_0x235491[_0x2532('0x32')]=_0x235491[_0x2532('0x32')][_0x2532('0x35')]?_0x235491[_0x2532('0x32')]:_0x152ea0['model'];if(_0x41c729['query'][_0x2532('0x41')]){_0x235491['include']=[{'all':!![]}];}_0x235491=_[_0x2532('0x3c')]({},_0x235491,_0x41c729[_0x2532('0x3f')]);return db[_0x2532('0x40')]['find'](_0x235491)[_0x2532('0x44')](handleEntityNotFound(_0x17a10b,null))[_0x2532('0x44')](function(_0x53c38b){if(_0x53c38b){var _0x7b66e6=_0x53c38b[_0x2532('0x49')]({'plain':!![]});_0x7b66e6=qs[_0x2532('0x4a')](_0x7b66e6,['id',_0x2532('0x4b'),_0x2532('0x4c')]);_0x41c729[_0x2532('0x4d')]=_[_0x2532('0x4a')](_0x41c729[_0x2532('0x4d')],['id','createdAt','updatedAt']);return db[_0x2532('0x40')][_0x2532('0x4e')](_[_0x2532('0x3c')](_0x7b66e6,_0x41c729[_0x2532('0x4d')]),{'include':_0x41c729[_0x2532('0x2e')][_0x2532('0x41')]?[{'all':!![]}]:undefined});}})[_0x2532('0x44')](respondWithResult(_0x17a10b,0xc9))[_0x2532('0x45')](handleError(_0x17a10b,null));};exports[_0x2532('0x25')]=function(_0x58c0d6,_0x6b2b38){if(_0x58c0d6[_0x2532('0x4d')]['id']){delete _0x58c0d6[_0x2532('0x4d')]['id'];}return db[_0x2532('0x40')]['find']({'where':{'id':_0x58c0d6[_0x2532('0x46')]['id']}})['then'](handleEntityNotFound(_0x6b2b38,null))['then'](saveUpdates(_0x58c0d6[_0x2532('0x4d')],null))[_0x2532('0x44')](respondWithResult(_0x6b2b38,null))[_0x2532('0x45')](handleError(_0x6b2b38,null));};exports[_0x2532('0x4f')]=function(_0x263fb1,_0x22de1c){return db['Attachment']['find']({'where':{'id':_0x263fb1[_0x2532('0x46')]['id']}})[_0x2532('0x44')](handleEntityNotFound(_0x22de1c,null))[_0x2532('0x44')](removeEntity(_0x22de1c,null))[_0x2532('0x45')](handleError(_0x22de1c,null));};exports[_0x2532('0x4e')]=function(_0x4885b5,_0x2e19b7,_0x13d95f){_0x4885b5[_0x2532('0x4d')][_0x2532('0x28')]=_0x4885b5['file'][_0x2532('0x50')];_0x4885b5[_0x2532('0x4d')][_0x2532('0x51')]=_0x4885b5[_0x2532('0x52')][_0x2532('0x53')];_0x4885b5['body'][_0x2532('0x3d')]=_0x4885b5[_0x2532('0x52')][_0x2532('0x54')];return db[_0x2532('0x40')][_0x2532('0x4e')](_0x4885b5[_0x2532('0x4d')])[_0x2532('0x44')](respondWithResult(_0x2e19b7,0xc9))[_0x2532('0x45')](handleError(_0x2e19b7,null));};exports[_0x2532('0x55')]=function(_0x3e74b8,_0x10c214,_0x468825){return db['Attachment'][_0x2532('0x56')]({'where':{'id':_0x3e74b8[_0x2532('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x10c214,null))[_0x2532('0x44')](function(_0x41efb6){if(_0x41efb6){var _0x266a22=_0x41efb6[_0x2532('0x57')]!==null;var _0x23b321=path[_0x2532('0x58')](config['root'],_0x2532('0x59'));if(_0x266a22){_0x23b321=path[_0x2532('0x58')](_0x23b321,'offline-chat/');}var _0x5abb85=path['join'](_0x23b321,_0x41efb6[_0x2532('0x51')]);return _0x10c214[_0x2532('0x55')](_0x5abb85);}})[_0x2532('0x45')](handleError(_0x10c214,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index cd6799a..4d0096b 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 _0x61da=['request-promise','../../config/environment','./attachment.attributes','exports','define','util','bluebird'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x61da,0x91));var _0xa61d=function(_0x311862,_0x57a5f0){_0x311862=_0x311862-0x0;var _0x58bc65=_0x61da[_0x311862];return _0x58bc65;};'use strict';var _=require('lodash');var util=require(_0xa61d('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa61d('0x1'));var rp=require(_0xa61d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa61d('0x3'));var attributes=require(_0xa61d('0x4'));module[_0xa61d('0x5')]=function(_0x42b7a5,_0x24ed42){return _0x42b7a5[_0xa61d('0x6')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f51=['moment','bluebird','request-promise','rimraf','exports','define','lodash','util','../../config/logger','api'];(function(_0x1325ef,_0x3e9267){var _0x21ab8d=function(_0x17e412){while(--_0x17e412){_0x1325ef['push'](_0x1325ef['shift']());}};_0x21ab8d(++_0x3e9267);}(_0x2f51,0x1f0));var _0x12f5=function(_0x25e2bc,_0x27d1ef){_0x25e2bc=_0x25e2bc-0x0;var _0x5152d3=_0x2f51[_0x25e2bc];return _0x5152d3;};'use strict';var _=require(_0x12f5('0x0'));var util=require(_0x12f5('0x1'));var logger=require(_0x12f5('0x2'))(_0x12f5('0x3'));var moment=require(_0x12f5('0x4'));var BPromise=require(_0x12f5('0x5'));var rp=require(_0x12f5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12f5('0x7'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0x12f5('0x8')]=function(_0x851132,_0x3e773b){return _0x851132[_0x12f5('0x9')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 5e908e2..6726dc7 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 _0x0439=['CreateAttachment','Attachment','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x537baf,_0x1d08ad){var _0x574e77=function(_0x3d7260){while(--_0x3d7260){_0x537baf['push'](_0x537baf['shift']());}};_0x574e77(++_0x1d08ad);}(_0x0439,0xdd));var _0x9043=function(_0x1ed8e0,_0x17f2a4){_0x1ed8e0=_0x1ed8e0-0x0;var _0x5d9541=_0x0439[_0x1ed8e0];return _0x5d9541;};'use strict';var _=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var moment=require(_0x9043('0x2'));var BPromise=require(_0x9043('0x3'));var rs=require(_0x9043('0x4'));var fs=require('fs');var Redis=require(_0x9043('0x5'));var db=require(_0x9043('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9043('0x7'))(_0x9043('0x8'));var config=require(_0x9043('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9043('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f79c2,_0x2fe4da,_0x19bf02){return new BPromise(function(_0x5bea98,_0x135a40){return client['request'](_0x4f79c2,_0x19bf02)[_0x9043('0xb')](function(_0x36a5cb){logger['info'](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));logger[_0x9043('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x2fe4da,'request\x20sent',JSON[_0x9043('0xf')](_0x36a5cb));if(_0x36a5cb[_0x9043('0x10')]){if(_0x36a5cb['error'][_0x9043('0x11')]===0x1f4){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb[_0x9043('0x10')][_0x9043('0x12')]);return _0x135a40(_0x36a5cb[_0x9043('0x10')]['message']);}logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb['error'][_0x9043('0x12')]);return _0x5bea98(_0x36a5cb[_0x9043('0x10')]['message']);}else{logger[_0x9043('0x13')](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));_0x5bea98(_0x36a5cb[_0x9043('0x14')][_0x9043('0x12')]);}})[_0x9043('0x15')](function(_0x13b613){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x13b613);_0x135a40(_0x13b613);});});}exports[_0x9043('0x16')]=function(_0x51823a){var _0x584fd9=this;return new Promise(function(_0x47fbdc,_0x2612f8){return db[_0x9043('0x17')][_0x9043('0x18')](_0x51823a[_0x9043('0x19')],{'raw':_0x51823a['options']?_0x51823a[_0x9043('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x161511){logger[_0x9043('0x13')](_0x9043('0x16'),_0x51823a);logger[_0x9043('0xe')](_0x9043('0x16'),_0x51823a,JSON[_0x9043('0xf')](_0x161511));_0x47fbdc(_0x161511);})[_0x9043('0x15')](function(_0x366695){logger['error'](_0x9043('0x16'),_0x366695[_0x9043('0x12')],_0x51823a);_0x2612f8(_0x584fd9[_0x9043('0x10')](0x1f4,_0x366695['message']));});});}; \ No newline at end of file +var _0x0c6d=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateAttachment','Attachment','create','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x5d5b96,_0x2ada70){var _0x177fb5=function(_0x2cdaf8){while(--_0x2cdaf8){_0x5d5b96['push'](_0x5d5b96['shift']());}};_0x177fb5(++_0x2ada70);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x4312e9,_0x1a0877){_0x4312e9=_0x4312e9-0x0;var _0x420562=_0x0c6d[_0x4312e9];return _0x420562;};'use strict';var _=require('lodash');var util=require(_0xd0c6('0x0'));var moment=require(_0xd0c6('0x1'));var BPromise=require(_0xd0c6('0x2'));var rs=require(_0xd0c6('0x3'));var fs=require('fs');var Redis=require(_0xd0c6('0x4'));var db=require(_0xd0c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0c6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd0c6('0x7')][_0xd0c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d4a64,_0x5de1cd,_0x16c6da){return new BPromise(function(_0x534412,_0x2a14f1){return client[_0xd0c6('0x9')](_0x2d4a64,_0x16c6da)[_0xd0c6('0xa')](function(_0x184f65){logger[_0xd0c6('0xb')](_0xd0c6('0xc'),_0x5de1cd,_0xd0c6('0xd'));logger[_0xd0c6('0xe')](_0xd0c6('0xf'),_0x5de1cd,'request\x20sent',JSON[_0xd0c6('0x10')](_0x184f65));if(_0x184f65['error']){if(_0x184f65['error'][_0xd0c6('0x11')]===0x1f4){logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);return _0x2a14f1(_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);}logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);return _0x534412(_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);}else{logger[_0xd0c6('0xb')](_0xd0c6('0xc'),_0x5de1cd,_0xd0c6('0xd'));_0x534412(_0x184f65[_0xd0c6('0x14')][_0xd0c6('0x13')]);}})[_0xd0c6('0x15')](function(_0x19dd14){logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x19dd14);_0x2a14f1(_0x19dd14);});});}exports[_0xd0c6('0x16')]=function(_0x941021){var _0x336efd=this;return new Promise(function(_0x4f7e65,_0x479d38){return db[_0xd0c6('0x17')][_0xd0c6('0x18')](_0x941021['body'],{'raw':_0x941021['options']?_0x941021['options'][_0xd0c6('0x19')]===undefined?!![]:![]:!![]})[_0xd0c6('0xa')](function(_0x1ebce8){logger[_0xd0c6('0xb')](_0xd0c6('0x16'),_0x941021);logger[_0xd0c6('0xe')](_0xd0c6('0x16'),_0x941021,JSON[_0xd0c6('0x10')](_0x1ebce8));_0x4f7e65(_0x1ebce8);})['catch'](function(_0x2f7559){logger[_0xd0c6('0x12')]('CreateAttachment',_0x2f7559[_0xd0c6('0x13')],_0x941021);_0x479d38(_0x336efd[_0xd0c6('0x12')](0x1f4,_0x2f7559[_0xd0c6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 067dd03..5d09245 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x4f1fdc,_0x2ecb58){var _0x5a17a5=function(_0x2152d8){while(--_0x2152d8){_0x4f1fdc['push'](_0x4f1fdc['shift']());}};_0x5a17a5(++_0x2ecb58);}(_0xb10b,0x12a));var _0xbb10=function(_0x52ab8a,_0xee034b){_0x52ab8a=_0x52ab8a-0x0;var _0x5d6ddc=_0xb10b[_0x52ab8a];return _0x5d6ddc;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index bc88d18..32169d6 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 _0xc86f=['message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','User','passport','passport-local','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','undefined','baseDN','url','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','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','name','domain','minutes','clearBlockUser','getLicense','catch','status'];(function(_0x4b6047,_0x43e941){var _0xe4a740=function(_0x570f99){while(--_0x570f99){_0x4b6047['push'](_0x4b6047['shift']());}};_0xe4a740(++_0x43e941);}(_0xc86f,0xce));var _0xfc86=function(_0x3bc9f8,_0x4930e1){_0x3bc9f8=_0x3bc9f8-0x0;var _0x1de4a1=_0xc86f[_0x3bc9f8];return _0x1de4a1;};'use strict';var passport=require(_0xfc86('0x0'));var LocalStrategy=require(_0xfc86('0x1'))['Strategy'];var moment=require(_0xfc86('0x2'));var ActiveDirectory=require(_0xfc86('0x3'));var BPromise=require(_0xfc86('0x4'));var util=require(_0xfc86('0x5'));var db=require(_0xfc86('0x6'))['db'];var authService=require(_0xfc86('0x7'));var utils=require(_0xfc86('0x8'));var config=require('../../config/environment');var logger=require(_0xfc86('0x9'))(_0xfc86('0xa'));function isActiveDirectoryConfigured(_0x3b6be1){var _0x2522e1=![];if(typeof _0x3b6be1[_0xfc86('0xb')]!==_0xfc86('0xc')){_0x2522e1=_0x3b6be1[_0xfc86('0xb')][_0xfc86('0xd')]&&_0x3b6be1['activedirectory'][_0xfc86('0xe')]&&_0x3b6be1['activedirectory']['domain'];}return _0x2522e1;}function adAuthenticate(_0x3b6878,_0x5db147,_0x3420cb){return new BPromise(function(_0x1053de,_0x4049fb){try{var _0x4c3f4b=new ActiveDirectory(_0x3b6878);_0x4c3f4b['authenticate'](_0x5db147,_0x3420cb,function(_0x59250b,_0x45f42f){if(_0x59250b){logger[_0xfc86('0xf')](_0xfc86('0x10'),_0x5db147,util[_0xfc86('0x11')](_0x59250b,{'showHidden':![],'depth':null}));_0x4049fb(_0xfc86('0x12'));}else if(!_0x45f42f){logger['error'](_0xfc86('0x13'),_0x5db147);_0x4049fb(_0xfc86('0x12'));}else{_0x1053de(_0x45f42f);}});}catch(_0x566a04){_0x4049fb(_0x566a04);}});}function ActiveDirectoryAuthenticate(_0x34bb10,_0x47c21d,_0x2d594a,_0x1844ae){var _0x193098,_0x3e2933;if(!isActiveDirectoryConfigured(config)){logger[_0xfc86('0xf')](_0xfc86('0x14'),_0x47c21d);return _0x1844ae(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xfc86('0x15')]['findOne']({'where':{'id':0x1},'attributes':[_0xfc86('0x16'),_0xfc86('0x17')],'raw':!![]})[_0xfc86('0x18')](function(_0x38ad3a){_0x193098=_0x38ad3a;if(!_0x193098[_0xfc86('0x16')]){logger[_0xfc86('0xf')](_0xfc86('0x19'),_0x47c21d);throw new Error(_0xfc86('0x12'));}return _0x34bb10[_0xfc86('0x1a')]({'attributes':['id','name',_0xfc86('0x1b'),_0xfc86('0x1c'),_0xfc86('0x1d'),_0xfc86('0x1e'),_0xfc86('0x1f'),_0xfc86('0x20'),_0xfc86('0x21')],'where':{'name':_0x47c21d,'role':{'$or':[_0xfc86('0x22'),_0xfc86('0x23'),_0xfc86('0x24')]},'adSsoEnabled':!![]}});})[_0xfc86('0x18')](function(_0xbe17d5){if(!_0xbe17d5||_0xbe17d5&&_0xbe17d5['name']!==_0x47c21d){throw new Error(_0xfc86('0x12'));}_0x3e2933=_0xbe17d5;var _0x97ec65=_0x3e2933[_0xfc86('0x25')]+'@'+config[_0xfc86('0xb')][_0xfc86('0x26')];return adAuthenticate(config[_0xfc86('0xb')],_0x97ec65,_0x2d594a);})[_0xfc86('0x18')](function(_0x431847){if(_0x3e2933[_0xfc86('0x1e')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x193098[_0xfc86('0x17')]>0x0){if(_0x3e2933[_0xfc86('0x1f')]){if(moment(_0x3e2933['blockedAt'])['add'](_0x193098['blockDuration'],_0xfc86('0x27'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xfc86('0x28')](_0x3e2933,0x0,![],null)[_0xfc86('0x18')](function(){return utils[_0xfc86('0x29')](_0x3e2933);})[_0xfc86('0x18')](function(){return _0x1844ae(null,_0x3e2933);});}else{return utils[_0xfc86('0x29')](_0x3e2933)['then'](function(){return _0x1844ae(null,_0x3e2933);});}}else{return utils[_0xfc86('0x29')](_0x3e2933)[_0xfc86('0x18')](function(){return _0x1844ae(null,_0x3e2933);});}})[_0xfc86('0x2a')](function(_0x4be792){return _0x1844ae(null,![],_0x4be792);});}function handleError(_0x5ccd61,_0x4e2a2d,_0x2dc6ec){return _0x5ccd61[_0xfc86('0x2b')](_0x4e2a2d||0x1f4)['send']({'message':_0x2dc6ec?_0x2dc6ec[_0xfc86('0x2c')]||_0x2dc6ec:''});}exports[_0xfc86('0x2d')]=function(_0x35c395,_0x2b1de0,_0x24101c){passport[_0xfc86('0x2e')](_0xfc86('0x2f'),function(_0x2827b3,_0x33d87e,_0x5967b1){var _0x46b766=_0x2827b3||_0x5967b1;if(_0x46b766){return handleError(_0x2b1de0,0x191,_0x46b766);}if(!_0x33d87e){return handleError(_0x2b1de0,0x194,{'message':_0xfc86('0x30')});}else{var _0x28ea98={'payload':{'id':_0x33d87e['id'],'role':_0x33d87e['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x28ea98)[_0xfc86('0x18')](function(_0x3aab0a){_0x2b1de0['json']({'id':_0x33d87e['id'],'token':_0x3aab0a,'statusCall':'','isAlreadyLogged':_0x33d87e[_0xfc86('0x21')]});});}})(_0x35c395,_0x2b1de0,_0x24101c);};passport['use']('ad-login',new LocalStrategy({'usernameField':_0xfc86('0x25'),'passwordField':_0xfc86('0x1b')},function(_0x23f144,_0x4bc9d2,_0x4092ac){return ActiveDirectoryAuthenticate(db[_0xfc86('0x31')],_0x23f144,_0x4bc9d2,_0x4092ac);})); \ No newline at end of file +var _0x6e08=['catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','use','passport-local','Strategy','moment','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','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','then','adSsoEnabled','name','password','role','disabled','blocked','blockedAt','agent','blockDuration','minutes','clearBlockUser','getLicense'];(function(_0x528d16,_0x330acd){var _0xcf12c8=function(_0x423f46){while(--_0x423f46){_0x528d16['push'](_0x528d16['shift']());}};_0xcf12c8(++_0x330acd);}(_0x6e08,0x196));var _0x86e0=function(_0x36e557,_0x582535){_0x36e557=_0x36e557-0x0;var _0x4072f7=_0x6e08[_0x36e557];return _0x4072f7;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x86e0('0x0'))[_0x86e0('0x1')];var moment=require(_0x86e0('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x86e0('0x3'));var util=require('util');var db=require(_0x86e0('0x4'))['db'];var authService=require(_0x86e0('0x5'));var utils=require(_0x86e0('0x6'));var config=require(_0x86e0('0x7'));var logger=require(_0x86e0('0x8'))(_0x86e0('0x9'));function isActiveDirectoryConfigured(_0x34be13){var _0x7057ad=![];if(typeof _0x34be13[_0x86e0('0xa')]!==_0x86e0('0xb')){_0x7057ad=_0x34be13[_0x86e0('0xa')][_0x86e0('0xc')]&&_0x34be13[_0x86e0('0xa')][_0x86e0('0xd')]&&_0x34be13[_0x86e0('0xa')][_0x86e0('0xe')];}return _0x7057ad;}function adAuthenticate(_0x58e39e,_0x252765,_0x1f72fc){return new BPromise(function(_0x49309f,_0x41a085){try{var _0x1ab44c=new ActiveDirectory(_0x58e39e);_0x1ab44c[_0x86e0('0xf')](_0x252765,_0x1f72fc,function(_0x8884cd,_0x27f1ef){if(_0x8884cd){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x252765,util[_0x86e0('0x10')](_0x8884cd,{'showHidden':![],'depth':null}));_0x41a085(_0x86e0('0x11'));}else if(!_0x27f1ef){logger['error'](_0x86e0('0x12'),_0x252765);_0x41a085('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x49309f(_0x27f1ef);}});}catch(_0x1438bb){_0x41a085(_0x1438bb);}});}function ActiveDirectoryAuthenticate(_0x5ba2b6,_0x4a15a5,_0x22bd21,_0x4e3584){var _0x4f1b2a,_0xb3f99f;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x86e0('0x13'),_0x4a15a5);return _0x4e3584(null,![],{'message':_0x86e0('0x11')});}return db['Setting'][_0x86e0('0x14')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})[_0x86e0('0x15')](function(_0x4cf415){_0x4f1b2a=_0x4cf415;if(!_0x4f1b2a[_0x86e0('0x16')]){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x4a15a5);throw new Error(_0x86e0('0x11'));}return _0x5ba2b6[_0x86e0('0x14')]({'attributes':['id',_0x86e0('0x17'),_0x86e0('0x18'),'salt',_0x86e0('0x19'),_0x86e0('0x1a'),_0x86e0('0x1b'),_0x86e0('0x1c'),'online'],'where':{'name':_0x4a15a5,'role':{'$or':['admin','user',_0x86e0('0x1d')]},'adSsoEnabled':!![]}});})[_0x86e0('0x15')](function(_0x5e804d){if(!_0x5e804d||_0x5e804d&&_0x5e804d[_0x86e0('0x17')]!==_0x4a15a5){throw new Error(_0x86e0('0x11'));}_0xb3f99f=_0x5e804d;var _0xe36499=_0xb3f99f[_0x86e0('0x17')]+'@'+config[_0x86e0('0xa')][_0x86e0('0xe')];return adAuthenticate(config[_0x86e0('0xa')],_0xe36499,_0x22bd21);})[_0x86e0('0x15')](function(_0x11c972){if(_0xb3f99f[_0x86e0('0x1a')]){throw new Error(_0x86e0('0x11'));}if(_0x4f1b2a[_0x86e0('0x1e')]>0x0){if(_0xb3f99f['blocked']){if(moment(_0xb3f99f[_0x86e0('0x1c')])['add'](_0x4f1b2a['blockDuration'],_0x86e0('0x1f'))>moment()){throw new Error(_0x86e0('0x11'));}return utils[_0x86e0('0x20')](_0xb3f99f,0x0,![],null)[_0x86e0('0x15')](function(){return utils['getLicense'](_0xb3f99f);})[_0x86e0('0x15')](function(){return _0x4e3584(null,_0xb3f99f);});}else{return utils[_0x86e0('0x21')](_0xb3f99f)[_0x86e0('0x15')](function(){return _0x4e3584(null,_0xb3f99f);});}}else{return utils[_0x86e0('0x21')](_0xb3f99f)['then'](function(){return _0x4e3584(null,_0xb3f99f);});}})[_0x86e0('0x22')](function(_0xe307e2){return _0x4e3584(null,![],_0xe307e2);});}function handleError(_0x49c281,_0x5a0e61,_0x294bea){return _0x49c281[_0x86e0('0x23')](_0x5a0e61||0x1f4)[_0x86e0('0x24')]({'message':_0x294bea?_0x294bea[_0x86e0('0x25')]||_0x294bea:''});}exports[_0x86e0('0x26')]=function(_0x174198,_0xf6758c,_0x1472bf){passport[_0x86e0('0xf')](_0x86e0('0x27'),function(_0x33d054,_0x2e6c3b,_0x6d6910){var _0x22b0c7=_0x33d054||_0x6d6910;if(_0x22b0c7){return handleError(_0xf6758c,0x191,_0x22b0c7);}if(!_0x2e6c3b){return handleError(_0xf6758c,0x194,{'message':_0x86e0('0x28')});}else{var _0x4b79ad={'payload':{'id':_0x2e6c3b['id'],'role':_0x2e6c3b[_0x86e0('0x19')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4b79ad)[_0x86e0('0x15')](function(_0x152016){_0xf6758c[_0x86e0('0x29')]({'id':_0x2e6c3b['id'],'token':_0x152016,'statusCall':'','isAlreadyLogged':_0x2e6c3b[_0x86e0('0x2a')]});});}})(_0x174198,_0xf6758c,_0x1472bf);};passport[_0x86e0('0x2b')](_0x86e0('0x27'),new LocalStrategy({'usernameField':_0x86e0('0x17'),'passwordField':_0x86e0('0x18')},function(_0x108f1e,_0x798183,_0x4c1cb3){return ActiveDirectoryAuthenticate(db['User'],_0x108f1e,_0x798183,_0x4c1cb3);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 298fab5..012973e 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 _0xb6bc=['post','login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x3f48c8,_0x299d53){var _0x4c7512=function(_0x526393){while(--_0x526393){_0x3f48c8['push'](_0x3f48c8['shift']());}};_0x4c7512(++_0x299d53);}(_0xb6bc,0x75));var _0xcb6b=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xb6bc[_0x4de586];return _0x46baf5;};'use strict';var express=require(_0xcb6b('0x0'));var router=express[_0xcb6b('0x1')]();var controller=require(_0xcb6b('0x2'));router[_0xcb6b('0x3')]('/',controller[_0xcb6b('0x4')]);module[_0xcb6b('0x5')]=router; \ No newline at end of file +var _0x4918=['login','express','Router','post'];(function(_0xae0db5,_0x36b130){var _0x3df33c=function(_0x81cdf6){while(--_0x81cdf6){_0xae0db5['push'](_0xae0db5['shift']());}};_0x3df33c(++_0x36b130);}(_0x4918,0x1bd));var _0x8491=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x4918[_0x376b45];return _0x2341b3;};'use strict';var express=require(_0x8491('0x0'));var router=express[_0x8491('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x8491('0x2')]('/',controller[_0x8491('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index e23e7f3..31b1df7 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7a54,0x106));var _0x47a5=function(_0x4aaaea,_0x1ce2b4){_0x4aaaea=_0x4aaaea-0x0;var _0x1dcdf7=_0x7a54[_0x4aaaea];return _0x1dcdf7;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x7a54,0x106));var _0x47a5=function(_0x4eb765,_0x25f47f){_0x4eb765=_0x4eb765-0x0;var _0x508971=_0x7a54[_0x4eb765];return _0x508971;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 1ac6438..0d3cc88 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 _0xa3dc=['setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware'];(function(_0x2649e2,_0x3e73be){var _0x4797d4=function(_0xfa2d8b){while(--_0xfa2d8b){_0x2649e2['push'](_0x2649e2['shift']());}};_0x4797d4(++_0x3e73be);}(_0xa3dc,0x1d6));var _0xca3d=function(_0xebc1af,_0x3bbfa8){_0xebc1af=_0xebc1af-0x0;var _0x51860e=_0xa3dc[_0xebc1af];return _0x51860e;};'use strict';var express=require(_0xca3d('0x0'));var passport=require(_0xca3d('0x1'));var router=express[_0xca3d('0x2')]();var controller=require(_0xca3d('0x3'));var userController=require(_0xca3d('0x4'));var authService=require(_0xca3d('0x5'));router[_0xca3d('0x6')]('/',controller[_0xca3d('0x7')]);router[_0xca3d('0x6')](_0xca3d('0x8'),controller[_0xca3d('0x9')],authService[_0xca3d('0xa')],userController[_0xca3d('0x7')],authService[_0xca3d('0xb')]);module[_0xca3d('0xc')]=router; \ No newline at end of file +var _0xda93=['isMiddleware','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback'];(function(_0x4fcfda,_0x45099a){var _0x12c8a5=function(_0x1bc05d){while(--_0x1bc05d){_0x4fcfda['push'](_0x4fcfda['shift']());}};_0x12c8a5(++_0x45099a);}(_0xda93,0x12b));var _0x3da9=function(_0x3a473f,_0x51022d){_0x3a473f=_0x3a473f-0x0;var _0x44b947=_0xda93[_0x3a473f];return _0x44b947;};'use strict';var express=require(_0x3da9('0x0'));var passport=require(_0x3da9('0x1'));var router=express[_0x3da9('0x2')]();var controller=require(_0x3da9('0x3'));var userController=require(_0x3da9('0x4'));var authService=require(_0x3da9('0x5'));router[_0x3da9('0x6')]('/',controller['login']);router['get'](_0x3da9('0x7'),controller[_0x3da9('0x8')],authService[_0x3da9('0x9')],userController['login'],authService['setTokenCookie']);module[_0x3da9('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index dfb1379..dda3a6e 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 _0xa550=['loginAttempts','blockDuration','add','minutes','clearBlockUser','blockedAt','getLicense','catch','MailAccount','find','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','email','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','host','status','Reset\x20Email\x20sent!','reset','User','params','token','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','local-login','util','passport','Strategy','jayson/promise','lodash','randomstring','moment','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role','disabled','blocked','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x39095c,_0x4b930f){var _0x2cf6a3=function(_0x238300){while(--_0x238300){_0x39095c['push'](_0x39095c['shift']());}};_0x2cf6a3(++_0x4b930f);}(_0xa550,0xd6));var _0x0a55=function(_0x11dbbe,_0x7b04d3){_0x11dbbe=_0x11dbbe-0x0;var _0x475061=_0xa550[_0x11dbbe];return _0x475061;};'use strict';var util=require(_0x0a55('0x0'));var passport=require(_0x0a55('0x1'));var LocalStrategy=require('passport-local')[_0x0a55('0x2')];var jayson=require(_0x0a55('0x3'));var _=require(_0x0a55('0x4'));var rs=require(_0x0a55('0x5'));var moment=require(_0x0a55('0x6'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x0a55('0x7'));var client=jayson[_0x0a55('0x8')][_0x0a55('0x9')]({'port':0x232b});function localAuthenticate(_0x2aad99,_0x4bbf0b,_0x56c2ef,_0x2e0224){var _0x525950,_0x213ead;return db[_0x0a55('0xa')][_0x0a55('0xb')]({'where':{'id':0x1},'attributes':[_0x0a55('0xc'),'blockDuration'],'raw':!![]})[_0x0a55('0xd')](function(_0x44392b){_0x525950=_0x44392b;return _0x2aad99['findOne']({'attributes':['id',_0x0a55('0xe'),_0x0a55('0xf'),_0x0a55('0x10'),_0x0a55('0x11'),_0x0a55('0x12'),_0x0a55('0x13'),'blockedAt','loginAttempts'],'where':{'name':_0x4bbf0b,'role':{'$or':['admin',_0x0a55('0x14'),_0x0a55('0x15')]}}});})[_0x0a55('0xd')](function(_0x1ab040){if(!_0x1ab040||_0x1ab040&&_0x1ab040[_0x0a55('0xe')]!==_0x4bbf0b){throw new Error(_0x0a55('0x16'));}else{_0x213ead=_0x1ab040;return _0x213ead;}})[_0x0a55('0xd')](function(){_0x213ead['authenticate'](_0x56c2ef,function(_0x204ae5,_0x3de409){var _0x2ea8ac=_0x213ead[_0x0a55('0x17')]+0x1;if(_0x204ae5){return _0x2e0224(_0x204ae5);}else if(!_0x3de409){if(_0x213ead[_0x0a55('0x12')]){return _0x2e0224(null,![],{'message':_0x0a55('0x16')});}else if(_0x525950['allowedLoginAttempts']>0x0){if(_0x213ead[_0x0a55('0x13')]){if(_0x525950[_0x0a55('0x18')]>0x0){if(moment(_0x213ead['blockedAt'])[_0x0a55('0x19')](_0x525950[_0x0a55('0x18')],_0x0a55('0x1a'))>moment()){return _0x2e0224(null,![],{'message':_0x0a55('0x16')});}else{return utils[_0x0a55('0x1b')](_0x213ead,_0x2ea8ac,![],null)[_0x0a55('0xd')](function(){return _0x2e0224(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x2e0224(null,![],{'message':_0x0a55('0x16')});}}else{if(_0x2ea8ac>=_0x525950[_0x0a55('0xc')]){return utils[_0x0a55('0x1b')](_0x213ead,0x0,!![],moment())[_0x0a55('0xd')](function(){return _0x2e0224(null,![],{'message':_0x0a55('0x16')});});}else{return utils[_0x0a55('0x1b')](_0x213ead,_0x2ea8ac,![],null)[_0x0a55('0xd')](function(){return _0x2e0224(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x2e0224(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x213ead['disabled']){return _0x2e0224(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x525950['allowedLoginAttempts']>0x0){if(_0x213ead['blocked']){if(_0x525950[_0x0a55('0x18')]>0x0){if(moment(_0x213ead[_0x0a55('0x1c')])[_0x0a55('0x19')](_0x525950[_0x0a55('0x18')],_0x0a55('0x1a'))>moment()){return _0x2e0224(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0a55('0x1b')](_0x213ead,0x0,![],null)[_0x0a55('0xd')](function(){return utils[_0x0a55('0x1d')](_0x213ead);})[_0x0a55('0xd')](function(){return _0x2e0224(null,_0x213ead);});}}else{return _0x2e0224(null,![],{'message':_0x0a55('0x16')});}}else{return utils[_0x0a55('0x1b')](_0x213ead,0x0,![],null)[_0x0a55('0xd')](function(){return utils[_0x0a55('0x1d')](_0x213ead);})[_0x0a55('0xd')](function(){return _0x2e0224(null,_0x213ead);})[_0x0a55('0x1e')](function(_0x2409f3){return _0x2e0224(null,![],_0x2409f3);});}}else{if(_0x213ead[_0x0a55('0x13')]){return _0x2e0224(null,![],{'message':_0x0a55('0x16')});}else{return utils[_0x0a55('0x1d')](_0x213ead)[_0x0a55('0xd')](function(){return _0x2e0224(null,_0x213ead);});}}}});})[_0x0a55('0x1e')](function(_0xe90f4){return _0x2e0224(null,![],_0xe90f4);});}function sendServiceMail(_0x1a22ed){return db[_0x0a55('0x1f')][_0x0a55('0x20')]({'where':{'service':!![]},'attributes':['id',_0x0a55('0xe'),'email'],'include':[{'model':db[_0x0a55('0x21')],'as':'Smtp','include':[{'model':db[_0x0a55('0x22')],'as':'CloudProvider'}]}]})[_0x0a55('0xd')](function(_0x36aabd){if(!_0x36aabd){throw new Error(_0x0a55('0x23'));}var _0x48d8dc=_0x36aabd['getSmtpOptions']();var _0x2f36e4={'account':_0x48d8dc,'message':_[_0x0a55('0x24')]({'from':util[_0x0a55('0x25')](_0x0a55('0x26'),_0x36aabd[_0x0a55('0xe')],_0x36aabd[_0x0a55('0x27')]||_0x36aabd[_0x0a55('0x28')][_0x0a55('0x14')])},_0x1a22ed)};return client[_0x0a55('0x29')](_0x0a55('0x2a'),_0x2f36e4);})[_0x0a55('0xd')](function(_0x3b3e20){if(_0x3b3e20[_0x0a55('0x2b')]){throw new Error(util[_0x0a55('0x25')](_0x0a55('0x2c'),_0x3b3e20[_0x0a55('0x2b')][_0x0a55('0x2d')]||JSON['stringify'](_0x3b3e20[_0x0a55('0x2b')])));}return!![];});}function handleError(_0x2eacac,_0x31355b,_0x5f2e76){return _0x2eacac['status'](_0x31355b||0x1f4)[_0x0a55('0x2e')]({'message':_0x5f2e76?_0x5f2e76[_0x0a55('0x2d')]||_0x5f2e76:''});}exports[_0x0a55('0x2f')]=function(_0x441ae1,_0x14d86c,_0x3b98fe){passport['authenticate']('local-login',function(_0x4c86d4,_0x2231da,_0x2f3423){var _0x117c1f=_0x4c86d4||_0x2f3423;if(_0x117c1f){return handleError(_0x14d86c,0x191,_0x117c1f);}if(!_0x2231da){return handleError(_0x14d86c,0x194,{'message':_0x0a55('0x30')});}else{var _0x213525={'payload':{'id':_0x2231da['id'],'role':_0x2231da[_0x0a55('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x0a55('0x31')](_0x213525)['then'](function(_0x3a9e96){_0x14d86c[_0x0a55('0x32')]({'id':_0x2231da['id'],'token':_0x3a9e96,'statusCall':'','isAlreadyLogged':_0x2231da['online']});});}})(_0x441ae1,_0x14d86c,_0x3b98fe);};exports[_0x0a55('0x33')]=function(_0x3bb1d1,_0x47dceb){if(!_0x3bb1d1[_0x0a55('0x34')][_0x0a55('0x27')]){return handleError(_0x47dceb,0x1f4,{'message':_0x0a55('0x35')});}var _0x128f31=rs[_0x0a55('0x36')]();_0x3bb1d1[_0x0a55('0x34')][_0x0a55('0x27')]=_0x3bb1d1[_0x0a55('0x34')][_0x0a55('0x27')][_0x0a55('0x37')]()[_0x0a55('0x38')]();var _0x45deb5;return db[_0x0a55('0xa')][_0x0a55('0xb')]({'where':{'id':0x1},'attributes':[_0x0a55('0xc'),_0x0a55('0x18')],'raw':!![]})[_0x0a55('0xd')](function(_0x524c42){_0x45deb5=_0x524c42;return db['User']['find']({'where':{'email':_0x3bb1d1[_0x0a55('0x34')][_0x0a55('0x27')]}});})[_0x0a55('0xd')](function(_0x4104ee){if(!_0x4104ee){throw new Error(_0x0a55('0x39'));}if(_0x4104ee[_0x0a55('0x12')]){throw new Error(_0x0a55('0x3a'));}if(_0x4104ee[_0x0a55('0x13')]){if(moment(_0x4104ee[_0x0a55('0x1c')])['add'](_0x45deb5[_0x0a55('0x18')],_0x0a55('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x4104ee[_0x0a55('0x13')]=![];_0x4104ee[_0x0a55('0x1c')]=null;}}_0x4104ee[_0x0a55('0x3b')]=_0x128f31;_0x4104ee[_0x0a55('0x3c')]=Date[_0x0a55('0x3d')]()+0x36ee80;return _0x4104ee[_0x0a55('0x3e')]();})[_0x0a55('0xd')](function(){return sendServiceMail({'to':_0x3bb1d1['body'][_0x0a55('0x27')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x0a55('0x3f')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x0a55('0x40')+_0x3bb1d1[_0x0a55('0x41')][_0x0a55('0x42')]+'/reset/'+_0x128f31+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x0a55('0xd')](function(){_0x47dceb[_0x0a55('0x43')](0xc8)[_0x0a55('0x2e')]({'message':_0x0a55('0x44')});})[_0x0a55('0x1e')](function(_0x101049){return handleError(_0x47dceb,0x1f4,_0x101049);});};exports[_0x0a55('0x45')]=function(_0x882c4e,_0x28dcf0){return db[_0x0a55('0x46')]['find']({'where':{'resetPasswordToken':_0x882c4e[_0x0a55('0x47')][_0x0a55('0x48')],'resetPasswordExpires':{'$gt':Date[_0x0a55('0x3d')]()}}})[_0x0a55('0xd')](function(_0x31bb4e){if(!_0x31bb4e){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x0a55('0xa')]['findOne']({'attributes':['id','securePassword','enforcePasswordHistory',_0x0a55('0x49')]})[_0x0a55('0xd')](function(_0x3f0f0e){if(_0x3f0f0e[_0x0a55('0x4a')])authService[_0x0a55('0x4b')](_0x882c4e[_0x0a55('0x34')]['password']);if(!_0x3f0f0e['enforcePasswordHistory']||!_0x31bb4e[_0x0a55('0x4c')])return _0x31bb4e;authService[_0x0a55('0x4d')](_0x882c4e['body']['password'],_0x31bb4e[_0x0a55('0x4c')],_0x3f0f0e['passwordHistoryLimit']);return _0x31bb4e;})[_0x0a55('0xd')](function(){_0x31bb4e[_0x0a55('0xf')]=_0x882c4e['body'][_0x0a55('0xf')];_0x31bb4e['resetPasswordToken']=null;_0x31bb4e[_0x0a55('0x3c')]=null;return _0x31bb4e['save']();});})[_0x0a55('0xd')](function(){_0x28dcf0[_0x0a55('0x43')](0xc8)[_0x0a55('0x2e')]({'message':'Password\x20reset!'});})['catch'](function(_0x15b6f8){return handleError(_0x28dcf0,0x1f4,_0x15b6f8);});};passport['use'](_0x0a55('0x4e'),new LocalStrategy({'usernameField':_0x0a55('0xe'),'passwordField':'password'},function(_0x455aec,_0x5ec54c,_0x55af10){return localAuthenticate(db[_0x0a55('0x46')],_0x455aec,_0x5ec54c,_0x55af10);})); \ No newline at end of file +var _0xd25a=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','local-login','util','passport-local','Strategy','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','disabled','blocked','blockedAt','admin','user','agent'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0xd25a,0x1e7));var _0xad25=function(_0x46e551,_0xc6f51){_0x46e551=_0x46e551-0x0;var _0x5ad448=_0xd25a[_0x46e551];return _0x5ad448;};'use strict';var util=require(_0xad25('0x0'));var passport=require('passport');var LocalStrategy=require(_0xad25('0x1'))[_0xad25('0x2')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0xad25('0x3'));var moment=require(_0xad25('0x4'));var db=require(_0xad25('0x5'))['db'];var authService=require(_0xad25('0x6'));var utils=require(_0xad25('0x7'));var client=jayson[_0xad25('0x8')][_0xad25('0x9')]({'port':0x232b});function localAuthenticate(_0x158290,_0x2a29aa,_0x1bb2d0,_0x2cfcf7){var _0x5372ac,_0x410e4c;return db['Setting'][_0xad25('0xa')]({'where':{'id':0x1},'attributes':[_0xad25('0xb'),_0xad25('0xc')],'raw':!![]})[_0xad25('0xd')](function(_0xfc2cdf){_0x5372ac=_0xfc2cdf;return _0x158290['findOne']({'attributes':['id',_0xad25('0xe'),'password',_0xad25('0xf'),_0xad25('0x10'),_0xad25('0x11'),_0xad25('0x12'),_0xad25('0x13'),'loginAttempts'],'where':{'name':_0x2a29aa,'role':{'$or':[_0xad25('0x14'),_0xad25('0x15'),_0xad25('0x16')]}}});})[_0xad25('0xd')](function(_0x1b3750){if(!_0x1b3750||_0x1b3750&&_0x1b3750[_0xad25('0xe')]!==_0x2a29aa){throw new Error(_0xad25('0x17'));}else{_0x410e4c=_0x1b3750;return _0x410e4c;}})[_0xad25('0xd')](function(){_0x410e4c[_0xad25('0x18')](_0x1bb2d0,function(_0x2f4e28,_0x256a93){var _0x3917f5=_0x410e4c['loginAttempts']+0x1;if(_0x2f4e28){return _0x2cfcf7(_0x2f4e28);}else if(!_0x256a93){if(_0x410e4c[_0xad25('0x11')]){return _0x2cfcf7(null,![],{'message':_0xad25('0x17')});}else if(_0x5372ac[_0xad25('0xb')]>0x0){if(_0x410e4c[_0xad25('0x12')]){if(_0x5372ac['blockDuration']>0x0){if(moment(_0x410e4c[_0xad25('0x13')])[_0xad25('0x19')](_0x5372ac[_0xad25('0xc')],_0xad25('0x1a'))>moment()){return _0x2cfcf7(null,![],{'message':_0xad25('0x17')});}else{return utils[_0xad25('0x1b')](_0x410e4c,_0x3917f5,![],null)[_0xad25('0xd')](function(){return _0x2cfcf7(null,![],{'message':_0xad25('0x17')});});}}else{return _0x2cfcf7(null,![],{'message':_0xad25('0x17')});}}else{if(_0x3917f5>=_0x5372ac[_0xad25('0xb')]){return utils[_0xad25('0x1b')](_0x410e4c,0x0,!![],moment())[_0xad25('0xd')](function(){return _0x2cfcf7(null,![],{'message':_0xad25('0x17')});});}else{return utils['clearBlockUser'](_0x410e4c,_0x3917f5,![],null)[_0xad25('0xd')](function(){return _0x2cfcf7(null,![],{'message':_0xad25('0x17')});});}}}else{return _0x2cfcf7(null,![],{'message':_0xad25('0x17')});}}else{if(_0x410e4c[_0xad25('0x11')]){return _0x2cfcf7(null,![],{'message':_0xad25('0x17')});}else if(_0x5372ac[_0xad25('0xb')]>0x0){if(_0x410e4c[_0xad25('0x12')]){if(_0x5372ac[_0xad25('0xc')]>0x0){if(moment(_0x410e4c['blockedAt'])[_0xad25('0x19')](_0x5372ac[_0xad25('0xc')],_0xad25('0x1a'))>moment()){return _0x2cfcf7(null,![],{'message':_0xad25('0x17')});}else{return utils[_0xad25('0x1b')](_0x410e4c,0x0,![],null)[_0xad25('0xd')](function(){return utils[_0xad25('0x1c')](_0x410e4c);})[_0xad25('0xd')](function(){return _0x2cfcf7(null,_0x410e4c);});}}else{return _0x2cfcf7(null,![],{'message':_0xad25('0x17')});}}else{return utils[_0xad25('0x1b')](_0x410e4c,0x0,![],null)['then'](function(){return utils[_0xad25('0x1c')](_0x410e4c);})[_0xad25('0xd')](function(){return _0x2cfcf7(null,_0x410e4c);})[_0xad25('0x1d')](function(_0x2e64df){return _0x2cfcf7(null,![],_0x2e64df);});}}else{if(_0x410e4c['blocked']){return _0x2cfcf7(null,![],{'message':_0xad25('0x17')});}else{return utils[_0xad25('0x1c')](_0x410e4c)[_0xad25('0xd')](function(){return _0x2cfcf7(null,_0x410e4c);});}}}});})['catch'](function(_0x31d502){return _0x2cfcf7(null,![],_0x31d502);});}function sendServiceMail(_0x293b10){return db[_0xad25('0x1e')][_0xad25('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0xad25('0x20')],'include':[{'model':db[_0xad25('0x21')],'as':_0xad25('0x22'),'include':[{'model':db[_0xad25('0x23')],'as':_0xad25('0x23')}]}]})['then'](function(_0x1fcacb){if(!_0x1fcacb){throw new Error(_0xad25('0x24'));}var _0x3a7087=_0x1fcacb['getSmtpOptions']();var _0x518644={'account':_0x3a7087,'message':_[_0xad25('0x25')]({'from':util['format'](_0xad25('0x26'),_0x1fcacb[_0xad25('0xe')],_0x1fcacb[_0xad25('0x20')]||_0x1fcacb[_0xad25('0x22')][_0xad25('0x15')])},_0x293b10)};return client[_0xad25('0x27')](_0xad25('0x28'),_0x518644);})['then'](function(_0x3ded37){if(_0x3ded37[_0xad25('0x29')]){throw new Error(util[_0xad25('0x2a')](_0xad25('0x2b'),_0x3ded37[_0xad25('0x29')][_0xad25('0x2c')]||JSON[_0xad25('0x2d')](_0x3ded37[_0xad25('0x29')])));}return!![];});}function handleError(_0xd4c482,_0x3aefbd,_0x34007e){return _0xd4c482[_0xad25('0x2e')](_0x3aefbd||0x1f4)[_0xad25('0x2f')]({'message':_0x34007e?_0x34007e[_0xad25('0x2c')]||_0x34007e:''});}exports[_0xad25('0x30')]=function(_0x29d673,_0x3132c7,_0xc17244){passport[_0xad25('0x18')]('local-login',function(_0x5c12ec,_0x3533d8,_0x25ad72){var _0x508f93=_0x5c12ec||_0x25ad72;if(_0x508f93){return handleError(_0x3132c7,0x191,_0x508f93);}if(!_0x3533d8){return handleError(_0x3132c7,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2bd550={'payload':{'id':_0x3533d8['id'],'role':_0x3533d8[_0xad25('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xad25('0x31')](_0x2bd550)['then'](function(_0x29470c){_0x3132c7[_0xad25('0x32')]({'id':_0x3533d8['id'],'token':_0x29470c,'statusCall':'','isAlreadyLogged':_0x3533d8[_0xad25('0x33')]});});}})(_0x29d673,_0x3132c7,_0xc17244);};exports[_0xad25('0x34')]=function(_0x29ef22,_0x422fea){if(!_0x29ef22[_0xad25('0x35')]['email']){return handleError(_0x422fea,0x1f4,{'message':_0xad25('0x36')});}var _0x333aa9=rs[_0xad25('0x37')]();_0x29ef22[_0xad25('0x35')]['email']=_0x29ef22[_0xad25('0x35')][_0xad25('0x20')]['trim']()[_0xad25('0x38')]();var _0x10775b;return db[_0xad25('0x39')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x4cb946){_0x10775b=_0x4cb946;return db[_0xad25('0x3a')]['find']({'where':{'email':_0x29ef22[_0xad25('0x35')][_0xad25('0x20')]}});})[_0xad25('0xd')](function(_0x51de86){if(!_0x51de86){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x51de86[_0xad25('0x11')]){throw new Error(_0xad25('0x3b'));}if(_0x51de86[_0xad25('0x12')]){if(moment(_0x51de86[_0xad25('0x13')])['add'](_0x10775b['blockDuration'],_0xad25('0x1a'))>moment()){throw new Error(_0xad25('0x3c'));}else{_0x51de86[_0xad25('0x12')]=![];_0x51de86['blockedAt']=null;}}_0x51de86[_0xad25('0x3d')]=_0x333aa9;_0x51de86[_0xad25('0x3e')]=Date['now']()+0x36ee80;return _0x51de86[_0xad25('0x3f')]();})['then'](function(){return sendServiceMail({'to':_0x29ef22[_0xad25('0x35')]['email'],'subject':_0xad25('0x40'),'text':_0xad25('0x41')+_0xad25('0x42')+_0xad25('0x43')+_0x29ef22['headers'][_0xad25('0x44')]+_0xad25('0x45')+_0x333aa9+'\x0a\x0a'+_0xad25('0x46')});})[_0xad25('0xd')](function(){_0x422fea[_0xad25('0x2e')](0xc8)[_0xad25('0x2f')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x56a60d){return handleError(_0x422fea,0x1f4,_0x56a60d);});};exports[_0xad25('0x47')]=function(_0x4de54a,_0x1f05a0){return db['User']['find']({'where':{'resetPasswordToken':_0x4de54a[_0xad25('0x48')][_0xad25('0x49')],'resetPasswordExpires':{'$gt':Date[_0xad25('0x4a')]()}}})[_0xad25('0xd')](function(_0x5e49bc){if(!_0x5e49bc){throw new Error(_0xad25('0x4b'));}return db[_0xad25('0x39')][_0xad25('0xa')]({'attributes':['id','securePassword',_0xad25('0x4c'),_0xad25('0x4d')]})[_0xad25('0xd')](function(_0x5519e5){if(_0x5519e5[_0xad25('0x4e')])authService['validatePasswordPattern'](_0x4de54a[_0xad25('0x35')][_0xad25('0x4f')]);if(!_0x5519e5[_0xad25('0x4c')]||!_0x5e49bc[_0xad25('0x50')])return _0x5e49bc;authService[_0xad25('0x51')](_0x4de54a[_0xad25('0x35')][_0xad25('0x4f')],_0x5e49bc[_0xad25('0x50')],_0x5519e5['passwordHistoryLimit']);return _0x5e49bc;})[_0xad25('0xd')](function(){_0x5e49bc[_0xad25('0x4f')]=_0x4de54a['body']['password'];_0x5e49bc['resetPasswordToken']=null;_0x5e49bc[_0xad25('0x3e')]=null;return _0x5e49bc[_0xad25('0x3f')]();});})[_0xad25('0xd')](function(){_0x1f05a0[_0xad25('0x2e')](0xc8)[_0xad25('0x2f')]({'message':_0xad25('0x52')});})['catch'](function(_0x459bc4){return handleError(_0x1f05a0,0x1f4,_0x459bc4);});};passport[_0xad25('0x53')](_0xad25('0x54'),new LocalStrategy({'usernameField':'name','passwordField':_0xad25('0x4f')},function(_0x338a69,_0x103e85,_0xc439c7){return localAuthenticate(db[_0xad25('0x3a')],_0x338a69,_0x103e85,_0xc439c7);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index e544ab5..07d3790 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 _0x5184=['reset','exports','express','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token'];(function(_0x1661e6,_0x271d77){var _0x14428e=function(_0x2733ba){while(--_0x2733ba){_0x1661e6['push'](_0x1661e6['shift']());}};_0x14428e(++_0x271d77);}(_0x5184,0x7a));var _0x4518=function(_0x246ad1,_0xf22da6){_0x246ad1=_0x246ad1-0x0;var _0x5d8277=_0x5184[_0x246ad1];return _0x5d8277;};'use strict';var express=require(_0x4518('0x0'));var router=express[_0x4518('0x1')]();var controller=require(_0x4518('0x2'));router[_0x4518('0x3')]('/',controller[_0x4518('0x4')]);router['post'](_0x4518('0x5'),controller[_0x4518('0x6')]);router[_0x4518('0x3')](_0x4518('0x7'),controller[_0x4518('0x8')]);module[_0x4518('0x9')]=router; \ No newline at end of file +var _0x0a87=['post','/reset/:token','exports','express','Router','./authLocal.controller','login','forgot'];(function(_0x32fb30,_0x2493a7){var _0x5099db=function(_0x46e86d){while(--_0x46e86d){_0x32fb30['push'](_0x32fb30['shift']());}};_0x5099db(++_0x2493a7);}(_0x0a87,0xa3));var _0x70a8=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x0a87[_0x53ccf2];return _0x5a2964;};'use strict';var express=require(_0x70a8('0x0'));var router=express[_0x70a8('0x1')]();var controller=require(_0x70a8('0x2'));router['post']('/',controller[_0x70a8('0x3')]);router['post']('/forgot',controller[_0x70a8('0x4')]);router[_0x70a8('0x5')](_0x70a8('0x6'),controller['reset']);module[_0x70a8('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 635eee3..de2c2b8 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 _0x75c2=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x545b64,_0x31d015){var _0x4a282e=function(_0x38ec28){while(--_0x38ec28){_0x545b64['push'](_0x545b64['shift']());}};_0x4a282e(++_0x31d015);}(_0x75c2,0x10a));var _0x275c=function(_0x319928,_0x234286){_0x319928=_0x319928-0x0;var _0x232fac=_0x75c2[_0x319928];return _0x232fac;};'use strict';var Sequelize=require('sequelize');module[_0x275c('0x0')]={'name':{'type':Sequelize[_0x275c('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x275c('0x1')]},'description':{'type':Sequelize[_0x275c('0x1')]},'status':{'type':Sequelize[_0x275c('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x275c('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xe910=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x5a635c,_0x132b58){var _0x5a4a1a=function(_0x29a41d){while(--_0x29a41d){_0x5a635c['push'](_0x5a635c['shift']());}};_0x5a4a1a(++_0x132b58);}(_0xe910,0xa1));var _0x0e91=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0xe910[_0x12b8ec];return _0x21af77;};'use strict';var Sequelize=require(_0x0e91('0x0'));module[_0x0e91('0x1')]={'name':{'type':Sequelize[_0x0e91('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x0e91('0x2')]},'description':{'type':Sequelize[_0x0e91('0x2')]},'status':{'type':Sequelize[_0x0e91('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0e91('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 0e69629..885ad68 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 _0x70df=['fields','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','destroy','Condition','addConditions','ids','getConditions','findOne','order','addActions','Action','omit','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','sendStatus','stack','name','send','index','map','Automation','type','key','model','query','filters','intersection'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x70df,0x122));var _0xf70d=function(_0x2d54c2,_0x333c45){_0x2d54c2=_0x2d54c2-0x0;var _0x2f9d51=_0x70df[_0x2d54c2];return _0x2f9d51;};'use strict';var emlformat=require(_0xf70d('0x0'));var rimraf=require(_0xf70d('0x1'));var zipdir=require(_0xf70d('0x2'));var jsonpatch=require(_0xf70d('0x3'));var rp=require(_0xf70d('0x4'));var moment=require(_0xf70d('0x5'));var BPromise=require(_0xf70d('0x6'));var Mustache=require(_0xf70d('0x7'));var util=require('util');var path=require(_0xf70d('0x8'));var sox=require(_0xf70d('0x9'));var csv=require(_0xf70d('0xa'));var ejs=require(_0xf70d('0xb'));var fs=require('fs');var fs_extra=require(_0xf70d('0xc'));var _=require(_0xf70d('0xd'));var squel=require('squel');var crypto=require(_0xf70d('0xe'));var jsforce=require(_0xf70d('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf70d('0x10'));var Papa=require(_0xf70d('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf70d('0x12'));var as=require(_0xf70d('0x13'));var hardwareService=require(_0xf70d('0x14'));var logger=require(_0xf70d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf70d('0x16'));var licenseUtil=require(_0xf70d('0x17'));var db=require(_0xf70d('0x18'))['db'];function respondWithStatusCode(_0xf60a54,_0x41be1c){_0x41be1c=_0x41be1c||0xcc;return function(_0x331f1a){if(_0x331f1a){return _0xf60a54['sendStatus'](_0x41be1c);}return _0xf60a54[_0xf70d('0x19')](_0x41be1c)[_0xf70d('0x1a')]();};}function respondWithResult(_0x32b3ae,_0x1c6ffa){_0x1c6ffa=_0x1c6ffa||0xc8;return function(_0x425234){if(_0x425234){return _0x32b3ae['status'](_0x1c6ffa)[_0xf70d('0x1b')](_0x425234);}};}function respondWithFilteredResult(_0x5f3188,_0x1fe56e){return function(_0x2501d9){if(_0x2501d9){var _0x4ef432=typeof _0x1fe56e[_0xf70d('0x1c')]===_0xf70d('0x1d')&&typeof _0x1fe56e[_0xf70d('0x1e')]===_0xf70d('0x1d');var _0x7625ad=_0x2501d9[_0xf70d('0x1f')];var _0x1c7aad=_0x4ef432?0x0:_0x1fe56e['offset'];var _0x409d89=_0x4ef432?_0x2501d9[_0xf70d('0x1f')]:_0x1fe56e[_0xf70d('0x1c')]+_0x1fe56e[_0xf70d('0x1e')];var _0xceeea4;if(_0x409d89>=_0x7625ad){_0x409d89=_0x7625ad;_0xceeea4=0xc8;}else{_0xceeea4=0xce;}_0x5f3188['status'](_0xceeea4);return _0x5f3188[_0xf70d('0x20')](_0xf70d('0x21'),_0x1c7aad+'-'+_0x409d89+'/'+_0x7625ad)[_0xf70d('0x1b')](_0x2501d9);}return null;};}function patchUpdates(_0x369de5){return function(_0x406035){try{jsonpatch['apply'](_0x406035,_0x369de5,!![]);}catch(_0x2214f3){return BPromise['reject'](_0x2214f3);}return _0x406035[_0xf70d('0x22')]();};}function saveUpdates(_0x3f5d81,_0x36da87){return function(_0x3d4d14){if(_0x3d4d14){return _0x3d4d14[_0xf70d('0x23')](_0x3f5d81)[_0xf70d('0x24')](function(_0x399c5e){return _0x399c5e;});}return null;};}function removeEntity(_0x457935,_0x398ea1){return function(_0x164af3){if(_0x164af3){return _0x164af3['destroy']()[_0xf70d('0x24')](function(){_0x457935[_0xf70d('0x19')](0xcc)[_0xf70d('0x1a')]();});}};}function handleEntityNotFound(_0x1afffa,_0x2e403c){return function(_0x57a861){if(!_0x57a861){_0x1afffa[_0xf70d('0x25')](0x194);}return _0x57a861;};}function handleError(_0x2087e6,_0x50e4d2){_0x50e4d2=_0x50e4d2||0x1f4;return function(_0x3157f){logger['error'](_0x3157f[_0xf70d('0x26')]);if(_0x3157f[_0xf70d('0x27')]){delete _0x3157f['name'];}_0x2087e6['status'](_0x50e4d2)[_0xf70d('0x28')](_0x3157f);};}exports[_0xf70d('0x29')]=function(_0x3bfc51,_0x24ce64){var _0x16ace8={},_0x21f491={},_0xabbb98={'count':0x0,'rows':[]};var _0x2e9a79=_[_0xf70d('0x2a')](db[_0xf70d('0x2b')]['rawAttributes'],function(_0x26c304){return{'name':_0x26c304['fieldName'],'type':_0x26c304[_0xf70d('0x2c')][_0xf70d('0x2d')]};});_0x21f491[_0xf70d('0x2e')]=_[_0xf70d('0x2a')](_0x2e9a79,_0xf70d('0x27'));_0x21f491[_0xf70d('0x2f')]=_['keys'](_0x3bfc51[_0xf70d('0x2f')]);_0x21f491[_0xf70d('0x30')]=_[_0xf70d('0x31')](_0x21f491[_0xf70d('0x2e')],_0x21f491['query']);_0x16ace8['attributes']=_[_0xf70d('0x31')](_0x21f491[_0xf70d('0x2e')],qs[_0xf70d('0x32')](_0x3bfc51[_0xf70d('0x2f')][_0xf70d('0x32')]));_0x16ace8['attributes']=_0x16ace8[_0xf70d('0x33')][_0xf70d('0x34')]?_0x16ace8[_0xf70d('0x33')]:_0x21f491[_0xf70d('0x2e')];if(!_0x3bfc51['query'][_0xf70d('0x35')](_0xf70d('0x36'))){_0x16ace8['limit']=qs[_0xf70d('0x1e')](_0x3bfc51['query'][_0xf70d('0x1e')]);_0x16ace8[_0xf70d('0x1c')]=qs[_0xf70d('0x1c')](_0x3bfc51['query']['offset']);}_0x16ace8['order']=qs[_0xf70d('0x37')](_0x3bfc51[_0xf70d('0x2f')][_0xf70d('0x37')]);_0x16ace8['where']=qs[_0xf70d('0x30')](_[_0xf70d('0x38')](_0x3bfc51['query'],_0x21f491[_0xf70d('0x30')]),_0x2e9a79);if(_0x3bfc51[_0xf70d('0x2f')]['filter']){_0x16ace8['where']=_[_0xf70d('0x39')](_0x16ace8[_0xf70d('0x3a')],{'$or':_[_0xf70d('0x2a')](_0x2e9a79,function(_0x2eb004){if(_0x2eb004['type']!==_0xf70d('0x3b')){var _0x4d5388={};_0x4d5388[_0x2eb004['name']]={'$like':'%'+_0x3bfc51[_0xf70d('0x2f')][_0xf70d('0x3c')]+'%'};return _0x4d5388;}})});}_0x16ace8=_[_0xf70d('0x39')]({},_0x16ace8,_0x3bfc51[_0xf70d('0x3d')]);var _0x3451e6={'where':_0x16ace8[_0xf70d('0x3a')]};return db[_0xf70d('0x2b')][_0xf70d('0x1f')](_0x3451e6)[_0xf70d('0x24')](function(_0x5cd4b1){_0xabbb98[_0xf70d('0x1f')]=_0x5cd4b1;if(_0x3bfc51[_0xf70d('0x2f')][_0xf70d('0x3e')]){_0x16ace8[_0xf70d('0x3f')]=[{'all':!![]}];}return db[_0xf70d('0x2b')][_0xf70d('0x40')](_0x16ace8);})[_0xf70d('0x24')](function(_0x5583c9){_0xabbb98[_0xf70d('0x41')]=_0x5583c9;return _0xabbb98;})[_0xf70d('0x24')](respondWithFilteredResult(_0x24ce64,_0x16ace8))[_0xf70d('0x42')](handleError(_0x24ce64,null));};exports[_0xf70d('0x43')]=function(_0x5981af,_0xf299c6){var _0x3ce4b5={'raw':![],'where':{'id':_0x5981af['params']['id']}},_0x9f76bb={};_0x9f76bb[_0xf70d('0x2e')]=_[_0xf70d('0x44')](db[_0xf70d('0x2b')][_0xf70d('0x45')]);_0x9f76bb[_0xf70d('0x2f')]=_[_0xf70d('0x44')](_0x5981af[_0xf70d('0x2f')]);_0x9f76bb[_0xf70d('0x30')]=_[_0xf70d('0x31')](_0x9f76bb[_0xf70d('0x2e')],_0x9f76bb[_0xf70d('0x2f')]);_0x3ce4b5[_0xf70d('0x33')]=_[_0xf70d('0x31')](_0x9f76bb['model'],qs[_0xf70d('0x32')](_0x5981af['query'][_0xf70d('0x32')]));_0x3ce4b5['attributes']=_0x3ce4b5['attributes'][_0xf70d('0x34')]?_0x3ce4b5[_0xf70d('0x33')]:_0x9f76bb[_0xf70d('0x2e')];if(_0x5981af[_0xf70d('0x2f')][_0xf70d('0x3e')]){_0x3ce4b5['include']=[{'all':!![]}];}_0x3ce4b5=_[_0xf70d('0x39')]({},_0x3ce4b5,_0x5981af[_0xf70d('0x3d')]);return db[_0xf70d('0x2b')][_0xf70d('0x46')](_0x3ce4b5)[_0xf70d('0x24')](handleEntityNotFound(_0xf299c6,null))[_0xf70d('0x24')](respondWithResult(_0xf299c6,null))[_0xf70d('0x42')](handleError(_0xf299c6,null));};exports[_0xf70d('0x47')]=function(_0xa239b8,_0x88c81){return db[_0xf70d('0x2b')][_0xf70d('0x47')](_0xa239b8['body'],{})[_0xf70d('0x24')](respondWithResult(_0x88c81,0xc9))['catch'](handleError(_0x88c81,null));};exports[_0xf70d('0x23')]=function(_0x26c1ff,_0x10832a){if(_0x26c1ff['body']['id']){delete _0x26c1ff[_0xf70d('0x48')]['id'];}return db[_0xf70d('0x2b')][_0xf70d('0x46')]({'where':{'id':_0x26c1ff[_0xf70d('0x49')]['id']}})['then'](handleEntityNotFound(_0x10832a,null))[_0xf70d('0x24')](saveUpdates(_0x26c1ff['body'],null))['then'](respondWithResult(_0x10832a,null))[_0xf70d('0x42')](handleError(_0x10832a,null));};exports[_0xf70d('0x4a')]=function(_0x30e1b0,_0x458ed2){return db[_0xf70d('0x2b')]['find']({'where':{'id':_0x30e1b0[_0xf70d('0x49')]['id']}})[_0xf70d('0x24')](handleEntityNotFound(_0x458ed2,null))[_0xf70d('0x24')](removeEntity(_0x458ed2,null))[_0xf70d('0x42')](handleError(_0x458ed2,null));};exports['addConditions']=function(_0x245bb0,_0x11f2a7,_0x2703d3){return db[_0xf70d('0x4b')][_0xf70d('0x46')]({'where':{'id':_0x245bb0[_0xf70d('0x49')]['id']}})['then'](handleEntityNotFound(_0x11f2a7,null))[_0xf70d('0x24')](function(_0x27f99a){if(_0x27f99a){return _0x27f99a[_0xf70d('0x4c')](_0x245bb0['body'][_0xf70d('0x4d')],_['omit'](_0x245bb0[_0xf70d('0x48')],[_0xf70d('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x11f2a7,null))[_0xf70d('0x42')](handleError(_0x11f2a7,null));};exports[_0xf70d('0x4e')]=function(_0x1fc2ad,_0x329929,_0x5b4ff6){var _0x31b344={};var _0x3a5daf={};var _0x13042f;var _0x4e29e4;return db[_0xf70d('0x2b')][_0xf70d('0x4f')]({'where':{'id':_0x1fc2ad['params']['id']}})[_0xf70d('0x24')](handleEntityNotFound(_0x329929,null))['then'](function(_0x2cfb51){if(_0x2cfb51){_0x13042f=_0x2cfb51;_0x3a5daf[_0xf70d('0x2e')]=_[_0xf70d('0x44')](db['Condition'][_0xf70d('0x45')]);_0x3a5daf[_0xf70d('0x2f')]=_[_0xf70d('0x44')](_0x1fc2ad[_0xf70d('0x2f')]);_0x3a5daf[_0xf70d('0x30')]=_[_0xf70d('0x31')](_0x3a5daf[_0xf70d('0x2e')],_0x3a5daf[_0xf70d('0x2f')]);_0x31b344[_0xf70d('0x33')]=_[_0xf70d('0x31')](_0x3a5daf[_0xf70d('0x2e')],qs[_0xf70d('0x32')](_0x1fc2ad[_0xf70d('0x2f')][_0xf70d('0x32')]));_0x31b344['attributes']=_0x31b344[_0xf70d('0x33')]['length']?_0x31b344[_0xf70d('0x33')]:_0x3a5daf[_0xf70d('0x2e')];_0x31b344[_0xf70d('0x50')]=qs[_0xf70d('0x37')](_0x1fc2ad[_0xf70d('0x2f')]['sort']);_0x31b344['where']=qs['filters'](_[_0xf70d('0x38')](_0x1fc2ad[_0xf70d('0x2f')],_0x3a5daf['filters']));if(_0x1fc2ad[_0xf70d('0x2f')][_0xf70d('0x3c')]){_0x31b344[_0xf70d('0x3a')]=_['merge'](_0x31b344[_0xf70d('0x3a')],{'$or':_[_0xf70d('0x2a')](_0x31b344[_0xf70d('0x33')],function(_0x1a177b){var _0x327bd9={};_0x327bd9[_0x1a177b]={'$like':'%'+_0x1fc2ad[_0xf70d('0x2f')][_0xf70d('0x3c')]+'%'};return _0x327bd9;})});}_0x31b344=_[_0xf70d('0x39')]({},_0x31b344,_0x1fc2ad[_0xf70d('0x3d')]);return _0x13042f[_0xf70d('0x4e')](_0x31b344);}})[_0xf70d('0x24')](function(_0x11643f){if(_0x11643f){_0x4e29e4=_0x11643f[_0xf70d('0x34')];if(!_0x1fc2ad['query']['hasOwnProperty'](_0xf70d('0x36'))){_0x31b344['limit']=qs[_0xf70d('0x1e')](_0x1fc2ad[_0xf70d('0x2f')]['limit']);_0x31b344['offset']=qs[_0xf70d('0x1c')](_0x1fc2ad[_0xf70d('0x2f')]['offset']);}return _0x13042f[_0xf70d('0x4e')](_0x31b344);}})[_0xf70d('0x24')](function(_0x5b8fe6){if(_0x5b8fe6){return _0x5b8fe6?{'count':_0x4e29e4,'rows':_0x5b8fe6}:null;}})[_0xf70d('0x24')](respondWithResult(_0x329929,null))[_0xf70d('0x42')](handleError(_0x329929,null));};exports[_0xf70d('0x51')]=function(_0x32ac09,_0x3e956e,_0x459d98){return db[_0xf70d('0x52')][_0xf70d('0x46')]({'where':{'id':_0x32ac09[_0xf70d('0x49')]['id']}})[_0xf70d('0x24')](handleEntityNotFound(_0x3e956e,null))[_0xf70d('0x24')](function(_0x5de0e3){if(_0x5de0e3){return _0x5de0e3[_0xf70d('0x51')](_0x32ac09[_0xf70d('0x48')][_0xf70d('0x4d')],_[_0xf70d('0x53')](_0x32ac09[_0xf70d('0x48')],[_0xf70d('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x3e956e,null))['catch'](handleError(_0x3e956e,null));};exports[_0xf70d('0x54')]=function(_0x35da93,_0x4e6dea,_0x2af4f8){var _0x256d55={};var _0x27abe4={};var _0x39f5f7;var _0x28bab5;return db[_0xf70d('0x2b')]['findOne']({'where':{'id':_0x35da93[_0xf70d('0x49')]['id']}})['then'](handleEntityNotFound(_0x4e6dea,null))[_0xf70d('0x24')](function(_0x201d7d){if(_0x201d7d){_0x39f5f7=_0x201d7d;_0x27abe4[_0xf70d('0x2e')]=_[_0xf70d('0x44')](db[_0xf70d('0x52')]['rawAttributes']);_0x27abe4['query']=_[_0xf70d('0x44')](_0x35da93[_0xf70d('0x2f')]);_0x27abe4[_0xf70d('0x30')]=_[_0xf70d('0x31')](_0x27abe4[_0xf70d('0x2e')],_0x27abe4[_0xf70d('0x2f')]);_0x256d55[_0xf70d('0x33')]=_[_0xf70d('0x31')](_0x27abe4[_0xf70d('0x2e')],qs[_0xf70d('0x32')](_0x35da93[_0xf70d('0x2f')][_0xf70d('0x32')]));_0x256d55[_0xf70d('0x33')]=_0x256d55[_0xf70d('0x33')]['length']?_0x256d55[_0xf70d('0x33')]:_0x27abe4[_0xf70d('0x2e')];_0x256d55['order']=qs['sort'](_0x35da93[_0xf70d('0x2f')][_0xf70d('0x37')]);_0x256d55[_0xf70d('0x3a')]=qs['filters'](_[_0xf70d('0x38')](_0x35da93['query'],_0x27abe4['filters']));if(_0x35da93[_0xf70d('0x2f')][_0xf70d('0x3c')]){_0x256d55[_0xf70d('0x3a')]=_[_0xf70d('0x39')](_0x256d55['where'],{'$or':_['map'](_0x256d55[_0xf70d('0x33')],function(_0x20536f){var _0x4741d0={};_0x4741d0[_0x20536f]={'$like':'%'+_0x35da93[_0xf70d('0x2f')][_0xf70d('0x3c')]+'%'};return _0x4741d0;})});}_0x256d55=_[_0xf70d('0x39')]({},_0x256d55,_0x35da93['options']);return _0x39f5f7[_0xf70d('0x54')](_0x256d55);}})[_0xf70d('0x24')](function(_0x3a4938){if(_0x3a4938){_0x28bab5=_0x3a4938[_0xf70d('0x34')];if(!_0x35da93['query'][_0xf70d('0x35')](_0xf70d('0x36'))){_0x256d55[_0xf70d('0x1e')]=qs['limit'](_0x35da93[_0xf70d('0x2f')][_0xf70d('0x1e')]);_0x256d55[_0xf70d('0x1c')]=qs[_0xf70d('0x1c')](_0x35da93[_0xf70d('0x2f')][_0xf70d('0x1c')]);}return _0x39f5f7[_0xf70d('0x54')](_0x256d55);}})[_0xf70d('0x24')](function(_0x316e44){if(_0x316e44){return _0x316e44?{'count':_0x28bab5,'rows':_0x316e44}:null;}})[_0xf70d('0x24')](respondWithResult(_0x4e6dea,null))[_0xf70d('0x42')](handleError(_0x4e6dea,null));}; \ No newline at end of file +var _0x88a8=['rawAttributes','key','model','query','keys','filters','intersection','attributes','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','then','includeAll','findAll','rows','catch','show','params','fields','length','include','options','create','body','find','addConditions','ids','getConditions','findOne','hasOwnProperty','addActions','Action','omit','getActions','order','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','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','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','end','error','stack','name','send','index','map','Automation'];(function(_0x45ff3e,_0x2d5827){var _0x5166bd=function(_0x1fd1a1){while(--_0x1fd1a1){_0x45ff3e['push'](_0x45ff3e['shift']());}};_0x5166bd(++_0x2d5827);}(_0x88a8,0x180));var _0x888a=function(_0x379c2e,_0x42e14b){_0x379c2e=_0x379c2e-0x0;var _0x1dab1f=_0x88a8[_0x379c2e];return _0x1dab1f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x888a('0x0'));var jsonpatch=require(_0x888a('0x1'));var rp=require(_0x888a('0x2'));var moment=require(_0x888a('0x3'));var BPromise=require(_0x888a('0x4'));var Mustache=require(_0x888a('0x5'));var util=require(_0x888a('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x888a('0x7'));var fs=require('fs');var fs_extra=require(_0x888a('0x8'));var _=require(_0x888a('0x9'));var squel=require(_0x888a('0xa'));var crypto=require(_0x888a('0xb'));var jsforce=require(_0x888a('0xc'));var deskjs=require(_0x888a('0xd'));var toCsv=require(_0x888a('0xe'));var querystring=require(_0x888a('0xf'));var Papa=require('papaparse');var Redis=require(_0x888a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x888a('0x11'));var as=require(_0x888a('0x12'));var hardwareService=require(_0x888a('0x13'));var logger=require(_0x888a('0x14'))(_0x888a('0x15'));var utils=require(_0x888a('0x16'));var config=require(_0x888a('0x17'));var licenseUtil=require(_0x888a('0x18'));var db=require(_0x888a('0x19'))['db'];function respondWithStatusCode(_0x57b88f,_0x251f2e){_0x251f2e=_0x251f2e||0xcc;return function(_0x181e42){if(_0x181e42){return _0x57b88f['sendStatus'](_0x251f2e);}return _0x57b88f['status'](_0x251f2e)['end']();};}function respondWithResult(_0x21326d,_0x265d30){_0x265d30=_0x265d30||0xc8;return function(_0x2e52df){if(_0x2e52df){return _0x21326d[_0x888a('0x1a')](_0x265d30)[_0x888a('0x1b')](_0x2e52df);}};}function respondWithFilteredResult(_0x22ad36,_0x49dec4){return function(_0x44bb81){if(_0x44bb81){var _0x2ef3ba=typeof _0x49dec4[_0x888a('0x1c')]==='undefined'&&typeof _0x49dec4[_0x888a('0x1d')]===_0x888a('0x1e');var _0x4dd66a=_0x44bb81[_0x888a('0x1f')];var _0x9a9e1a=_0x2ef3ba?0x0:_0x49dec4[_0x888a('0x1c')];var _0x45f1a4=_0x2ef3ba?_0x44bb81[_0x888a('0x1f')]:_0x49dec4[_0x888a('0x1c')]+_0x49dec4[_0x888a('0x1d')];var _0xcb4beb;if(_0x45f1a4>=_0x4dd66a){_0x45f1a4=_0x4dd66a;_0xcb4beb=0xc8;}else{_0xcb4beb=0xce;}_0x22ad36[_0x888a('0x1a')](_0xcb4beb);return _0x22ad36[_0x888a('0x20')](_0x888a('0x21'),_0x9a9e1a+'-'+_0x45f1a4+'/'+_0x4dd66a)[_0x888a('0x1b')](_0x44bb81);}return null;};}function patchUpdates(_0x10c396){return function(_0xf58de3){try{jsonpatch[_0x888a('0x22')](_0xf58de3,_0x10c396,!![]);}catch(_0x1257f3){return BPromise[_0x888a('0x23')](_0x1257f3);}return _0xf58de3[_0x888a('0x24')]();};}function saveUpdates(_0xb84430,_0x380930){return function(_0x3e1174){if(_0x3e1174){return _0x3e1174[_0x888a('0x25')](_0xb84430)['then'](function(_0x2bea8e){return _0x2bea8e;});}return null;};}function removeEntity(_0x13d1d4,_0x59077e){return function(_0x2592ea){if(_0x2592ea){return _0x2592ea['destroy']()['then'](function(){_0x13d1d4[_0x888a('0x1a')](0xcc)[_0x888a('0x26')]();});}};}function handleEntityNotFound(_0x33d226,_0x5a63ea){return function(_0x594268){if(!_0x594268){_0x33d226['sendStatus'](0x194);}return _0x594268;};}function handleError(_0x141de8,_0x218289){_0x218289=_0x218289||0x1f4;return function(_0x339bc9){logger[_0x888a('0x27')](_0x339bc9[_0x888a('0x28')]);if(_0x339bc9[_0x888a('0x29')]){delete _0x339bc9[_0x888a('0x29')];}_0x141de8[_0x888a('0x1a')](_0x218289)[_0x888a('0x2a')](_0x339bc9);};}exports[_0x888a('0x2b')]=function(_0x542631,_0x49c403){var _0x3da1ad={},_0x4e4d9d={},_0x566cca={'count':0x0,'rows':[]};var _0x3330c8=_[_0x888a('0x2c')](db[_0x888a('0x2d')][_0x888a('0x2e')],function(_0x7942bf){return{'name':_0x7942bf['fieldName'],'type':_0x7942bf['type'][_0x888a('0x2f')]};});_0x4e4d9d[_0x888a('0x30')]=_[_0x888a('0x2c')](_0x3330c8,'name');_0x4e4d9d[_0x888a('0x31')]=_[_0x888a('0x32')](_0x542631[_0x888a('0x31')]);_0x4e4d9d[_0x888a('0x33')]=_['intersection'](_0x4e4d9d['model'],_0x4e4d9d[_0x888a('0x31')]);_0x3da1ad['attributes']=_[_0x888a('0x34')](_0x4e4d9d[_0x888a('0x30')],qs['fields'](_0x542631[_0x888a('0x31')]['fields']));_0x3da1ad[_0x888a('0x35')]=_0x3da1ad[_0x888a('0x35')]['length']?_0x3da1ad[_0x888a('0x35')]:_0x4e4d9d[_0x888a('0x30')];if(!_0x542631['query']['hasOwnProperty'](_0x888a('0x36'))){_0x3da1ad[_0x888a('0x1d')]=qs['limit'](_0x542631['query'][_0x888a('0x1d')]);_0x3da1ad[_0x888a('0x1c')]=qs[_0x888a('0x1c')](_0x542631['query'][_0x888a('0x1c')]);}_0x3da1ad['order']=qs[_0x888a('0x37')](_0x542631['query'][_0x888a('0x37')]);_0x3da1ad[_0x888a('0x38')]=qs[_0x888a('0x33')](_[_0x888a('0x39')](_0x542631[_0x888a('0x31')],_0x4e4d9d[_0x888a('0x33')]),_0x3330c8);if(_0x542631[_0x888a('0x31')][_0x888a('0x3a')]){_0x3da1ad['where']=_[_0x888a('0x3b')](_0x3da1ad[_0x888a('0x38')],{'$or':_['map'](_0x3330c8,function(_0x2539c5){if(_0x2539c5[_0x888a('0x3c')]!==_0x888a('0x3d')){var _0x4387f0={};_0x4387f0[_0x2539c5[_0x888a('0x29')]]={'$like':'%'+_0x542631[_0x888a('0x31')]['filter']+'%'};return _0x4387f0;}})});}_0x3da1ad=_[_0x888a('0x3b')]({},_0x3da1ad,_0x542631['options']);var _0x4ba9a6={'where':_0x3da1ad[_0x888a('0x38')]};return db[_0x888a('0x2d')][_0x888a('0x1f')](_0x4ba9a6)[_0x888a('0x3e')](function(_0x45cf50){_0x566cca[_0x888a('0x1f')]=_0x45cf50;if(_0x542631[_0x888a('0x31')][_0x888a('0x3f')]){_0x3da1ad['include']=[{'all':!![]}];}return db[_0x888a('0x2d')][_0x888a('0x40')](_0x3da1ad);})[_0x888a('0x3e')](function(_0x45269b){_0x566cca[_0x888a('0x41')]=_0x45269b;return _0x566cca;})[_0x888a('0x3e')](respondWithFilteredResult(_0x49c403,_0x3da1ad))[_0x888a('0x42')](handleError(_0x49c403,null));};exports[_0x888a('0x43')]=function(_0x17877d,_0x288c67){var _0x21b93a={'raw':![],'where':{'id':_0x17877d[_0x888a('0x44')]['id']}},_0x2e3385={};_0x2e3385[_0x888a('0x30')]=_[_0x888a('0x32')](db[_0x888a('0x2d')]['rawAttributes']);_0x2e3385['query']=_[_0x888a('0x32')](_0x17877d['query']);_0x2e3385[_0x888a('0x33')]=_[_0x888a('0x34')](_0x2e3385[_0x888a('0x30')],_0x2e3385[_0x888a('0x31')]);_0x21b93a['attributes']=_[_0x888a('0x34')](_0x2e3385[_0x888a('0x30')],qs[_0x888a('0x45')](_0x17877d['query']['fields']));_0x21b93a[_0x888a('0x35')]=_0x21b93a[_0x888a('0x35')][_0x888a('0x46')]?_0x21b93a[_0x888a('0x35')]:_0x2e3385[_0x888a('0x30')];if(_0x17877d[_0x888a('0x31')][_0x888a('0x3f')]){_0x21b93a[_0x888a('0x47')]=[{'all':!![]}];}_0x21b93a=_['merge']({},_0x21b93a,_0x17877d[_0x888a('0x48')]);return db[_0x888a('0x2d')]['find'](_0x21b93a)['then'](handleEntityNotFound(_0x288c67,null))[_0x888a('0x3e')](respondWithResult(_0x288c67,null))[_0x888a('0x42')](handleError(_0x288c67,null));};exports[_0x888a('0x49')]=function(_0x5bb627,_0x216dba){return db[_0x888a('0x2d')][_0x888a('0x49')](_0x5bb627[_0x888a('0x4a')],{})[_0x888a('0x3e')](respondWithResult(_0x216dba,0xc9))[_0x888a('0x42')](handleError(_0x216dba,null));};exports[_0x888a('0x25')]=function(_0x3d5d20,_0x477316){if(_0x3d5d20[_0x888a('0x4a')]['id']){delete _0x3d5d20['body']['id'];}return db[_0x888a('0x2d')]['find']({'where':{'id':_0x3d5d20[_0x888a('0x44')]['id']}})[_0x888a('0x3e')](handleEntityNotFound(_0x477316,null))[_0x888a('0x3e')](saveUpdates(_0x3d5d20[_0x888a('0x4a')],null))[_0x888a('0x3e')](respondWithResult(_0x477316,null))[_0x888a('0x42')](handleError(_0x477316,null));};exports['destroy']=function(_0x338836,_0x204e91){return db[_0x888a('0x2d')][_0x888a('0x4b')]({'where':{'id':_0x338836[_0x888a('0x44')]['id']}})[_0x888a('0x3e')](handleEntityNotFound(_0x204e91,null))[_0x888a('0x3e')](removeEntity(_0x204e91,null))[_0x888a('0x42')](handleError(_0x204e91,null));};exports[_0x888a('0x4c')]=function(_0x50108f,_0xc702da,_0x304fd3){return db['Condition'][_0x888a('0x4b')]({'where':{'id':_0x50108f[_0x888a('0x44')]['id']}})[_0x888a('0x3e')](handleEntityNotFound(_0xc702da,null))[_0x888a('0x3e')](function(_0x331f67){if(_0x331f67){return _0x331f67['addConditions'](_0x50108f[_0x888a('0x4a')][_0x888a('0x4d')],_['omit'](_0x50108f[_0x888a('0x4a')],[_0x888a('0x4d'),'id'])||{});}})[_0x888a('0x3e')](respondWithResult(_0xc702da,null))[_0x888a('0x42')](handleError(_0xc702da,null));};exports[_0x888a('0x4e')]=function(_0x33e1dc,_0x1aca70,_0x1566b7){var _0x443aad={};var _0x83e579={};var _0x189964;var _0x10af4a;return db[_0x888a('0x2d')][_0x888a('0x4f')]({'where':{'id':_0x33e1dc['params']['id']}})[_0x888a('0x3e')](handleEntityNotFound(_0x1aca70,null))['then'](function(_0x3fb6a8){if(_0x3fb6a8){_0x189964=_0x3fb6a8;_0x83e579[_0x888a('0x30')]=_[_0x888a('0x32')](db['Condition'][_0x888a('0x2e')]);_0x83e579[_0x888a('0x31')]=_[_0x888a('0x32')](_0x33e1dc[_0x888a('0x31')]);_0x83e579[_0x888a('0x33')]=_[_0x888a('0x34')](_0x83e579[_0x888a('0x30')],_0x83e579[_0x888a('0x31')]);_0x443aad['attributes']=_[_0x888a('0x34')](_0x83e579[_0x888a('0x30')],qs[_0x888a('0x45')](_0x33e1dc[_0x888a('0x31')]['fields']));_0x443aad[_0x888a('0x35')]=_0x443aad['attributes'][_0x888a('0x46')]?_0x443aad['attributes']:_0x83e579[_0x888a('0x30')];_0x443aad['order']=qs[_0x888a('0x37')](_0x33e1dc['query'][_0x888a('0x37')]);_0x443aad['where']=qs['filters'](_['pick'](_0x33e1dc[_0x888a('0x31')],_0x83e579[_0x888a('0x33')]));if(_0x33e1dc[_0x888a('0x31')][_0x888a('0x3a')]){_0x443aad[_0x888a('0x38')]=_['merge'](_0x443aad[_0x888a('0x38')],{'$or':_[_0x888a('0x2c')](_0x443aad['attributes'],function(_0x5d4552){var _0x5a0005={};_0x5a0005[_0x5d4552]={'$like':'%'+_0x33e1dc[_0x888a('0x31')][_0x888a('0x3a')]+'%'};return _0x5a0005;})});}_0x443aad=_[_0x888a('0x3b')]({},_0x443aad,_0x33e1dc[_0x888a('0x48')]);return _0x189964[_0x888a('0x4e')](_0x443aad);}})[_0x888a('0x3e')](function(_0x13f411){if(_0x13f411){_0x10af4a=_0x13f411[_0x888a('0x46')];if(!_0x33e1dc[_0x888a('0x31')][_0x888a('0x50')]('nolimit')){_0x443aad['limit']=qs[_0x888a('0x1d')](_0x33e1dc[_0x888a('0x31')][_0x888a('0x1d')]);_0x443aad[_0x888a('0x1c')]=qs[_0x888a('0x1c')](_0x33e1dc[_0x888a('0x31')][_0x888a('0x1c')]);}return _0x189964[_0x888a('0x4e')](_0x443aad);}})[_0x888a('0x3e')](function(_0x4339eb){if(_0x4339eb){return _0x4339eb?{'count':_0x10af4a,'rows':_0x4339eb}:null;}})[_0x888a('0x3e')](respondWithResult(_0x1aca70,null))[_0x888a('0x42')](handleError(_0x1aca70,null));};exports[_0x888a('0x51')]=function(_0x41e2fd,_0x32e256,_0x4b2260){return db[_0x888a('0x52')][_0x888a('0x4b')]({'where':{'id':_0x41e2fd[_0x888a('0x44')]['id']}})[_0x888a('0x3e')](handleEntityNotFound(_0x32e256,null))[_0x888a('0x3e')](function(_0x1faa01){if(_0x1faa01){return _0x1faa01[_0x888a('0x51')](_0x41e2fd[_0x888a('0x4a')]['ids'],_[_0x888a('0x53')](_0x41e2fd[_0x888a('0x4a')],[_0x888a('0x4d'),'id'])||{});}})[_0x888a('0x3e')](respondWithResult(_0x32e256,null))[_0x888a('0x42')](handleError(_0x32e256,null));};exports[_0x888a('0x54')]=function(_0x8507d2,_0x59edd9,_0x8c85fb){var _0x4b2c0b={};var _0xc11cd9={};var _0xf580a3;var _0x3411e7;return db[_0x888a('0x2d')][_0x888a('0x4f')]({'where':{'id':_0x8507d2[_0x888a('0x44')]['id']}})['then'](handleEntityNotFound(_0x59edd9,null))[_0x888a('0x3e')](function(_0x55cb66){if(_0x55cb66){_0xf580a3=_0x55cb66;_0xc11cd9[_0x888a('0x30')]=_[_0x888a('0x32')](db[_0x888a('0x52')]['rawAttributes']);_0xc11cd9[_0x888a('0x31')]=_[_0x888a('0x32')](_0x8507d2[_0x888a('0x31')]);_0xc11cd9['filters']=_[_0x888a('0x34')](_0xc11cd9[_0x888a('0x30')],_0xc11cd9[_0x888a('0x31')]);_0x4b2c0b[_0x888a('0x35')]=_[_0x888a('0x34')](_0xc11cd9[_0x888a('0x30')],qs[_0x888a('0x45')](_0x8507d2['query'][_0x888a('0x45')]));_0x4b2c0b['attributes']=_0x4b2c0b[_0x888a('0x35')][_0x888a('0x46')]?_0x4b2c0b[_0x888a('0x35')]:_0xc11cd9[_0x888a('0x30')];_0x4b2c0b[_0x888a('0x55')]=qs[_0x888a('0x37')](_0x8507d2[_0x888a('0x31')][_0x888a('0x37')]);_0x4b2c0b['where']=qs[_0x888a('0x33')](_[_0x888a('0x39')](_0x8507d2[_0x888a('0x31')],_0xc11cd9[_0x888a('0x33')]));if(_0x8507d2[_0x888a('0x31')][_0x888a('0x3a')]){_0x4b2c0b[_0x888a('0x38')]=_['merge'](_0x4b2c0b[_0x888a('0x38')],{'$or':_[_0x888a('0x2c')](_0x4b2c0b[_0x888a('0x35')],function(_0x2dce87){var _0xfd9eee={};_0xfd9eee[_0x2dce87]={'$like':'%'+_0x8507d2[_0x888a('0x31')]['filter']+'%'};return _0xfd9eee;})});}_0x4b2c0b=_[_0x888a('0x3b')]({},_0x4b2c0b,_0x8507d2[_0x888a('0x48')]);return _0xf580a3[_0x888a('0x54')](_0x4b2c0b);}})[_0x888a('0x3e')](function(_0x232806){if(_0x232806){_0x3411e7=_0x232806[_0x888a('0x46')];if(!_0x8507d2[_0x888a('0x31')]['hasOwnProperty'](_0x888a('0x36'))){_0x4b2c0b['limit']=qs['limit'](_0x8507d2[_0x888a('0x31')]['limit']);_0x4b2c0b[_0x888a('0x1c')]=qs[_0x888a('0x1c')](_0x8507d2[_0x888a('0x31')][_0x888a('0x1c')]);}return _0xf580a3[_0x888a('0x54')](_0x4b2c0b);}})[_0x888a('0x3e')](function(_0x44633b){if(_0x44633b){return _0x44633b?{'count':_0x3411e7,'rows':_0x44633b}:null;}})[_0x888a('0x3e')](respondWithResult(_0x59edd9,null))[_0x888a('0x42')](handleError(_0x59edd9,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8c7e2b6..aeeda19 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 _0xeace=['define','Automation','tools_automations','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x212c17,_0x4c994e){var _0x18f6cd=function(_0x1464b8){while(--_0x1464b8){_0x212c17['push'](_0x212c17['shift']());}};_0x18f6cd(++_0x4c994e);}(_0xeace,0x1bb));var _0xeeac=function(_0x311d81,_0x237598){_0x311d81=_0x311d81-0x0;var _0x4851e9=_0xeace[_0x311d81];return _0x4851e9;};'use strict';var _=require(_0xeeac('0x0'));var util=require('util');var logger=require(_0xeeac('0x1'))(_0xeeac('0x2'));var moment=require(_0xeeac('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeeac('0x4'));var rimraf=require(_0xeeac('0x5'));var config=require(_0xeeac('0x6'));var attributes=require(_0xeeac('0x7'));module['exports']=function(_0x19ed36,_0x3b3d6b){return _0x19ed36[_0xeeac('0x8')](_0xeeac('0x9'),attributes,{'tableName':_0xeeac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96c1=['api','moment','request-promise','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0xa7429c,_0x3f6c95){var _0x57aacc=function(_0x276abe){while(--_0x276abe){_0xa7429c['push'](_0xa7429c['shift']());}};_0x57aacc(++_0x3f6c95);}(_0x96c1,0x183));var _0x196c=function(_0x3e2e4d,_0x4a35ce){_0x3e2e4d=_0x3e2e4d-0x0;var _0x30de83=_0x96c1[_0x3e2e4d];return _0x30de83;};'use strict';var _=require(_0x196c('0x0'));var util=require(_0x196c('0x1'));var logger=require(_0x196c('0x2'))(_0x196c('0x3'));var moment=require(_0x196c('0x4'));var BPromise=require('bluebird');var rp=require(_0x196c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x196c('0x6'));var config=require(_0x196c('0x7'));var attributes=require(_0x196c('0x8'));module[_0x196c('0x9')]=function(_0x246f10,_0x4ac36f){return _0x246f10[_0x196c('0xa')](_0x196c('0xb'),attributes,{'tableName':_0x196c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 72db06b..799fbda 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 _0x5ed9=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','Automation,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5ed9[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var moment=require('moment');var BPromise=require(_0x95ed('0x2'));var rs=require(_0x95ed('0x3'));var fs=require('fs');var Redis=require(_0x95ed('0x4'));var db=require(_0x95ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95ed('0x6'))(_0x95ed('0x7'));var config=require(_0x95ed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x95ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32bf25,_0xaa1eb1,_0x3753b5){return new BPromise(function(_0x1df51f,_0x46ed43){return client[_0x95ed('0xa')](_0x32bf25,_0x3753b5)['then'](function(_0x2b59f5){logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,'request\x20sent');logger[_0x95ed('0xd')]('Automation,\x20%s,\x20%s,\x20%s',_0xaa1eb1,_0x95ed('0xe'),JSON[_0x95ed('0xf')](_0x2b59f5));if(_0x2b59f5[_0x95ed('0x10')]){if(_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x11')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x46ed43(_0x2b59f5['error']['message']);}logger[_0x95ed('0x10')](_0x95ed('0xc'),_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x1df51f(_0x2b59f5['error'][_0x95ed('0x12')]);}else{logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,_0x95ed('0xe'));_0x1df51f(_0x2b59f5[_0x95ed('0x13')]['message']);}})[_0x95ed('0x14')](function(_0x54ad78){logger['error']('Automation,\x20%s,\x20%s',_0xaa1eb1,_0x54ad78);_0x46ed43(_0x54ad78);});});} \ No newline at end of file +var _0xc274=['../../config/logger','rpc','jayson/promise','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4a3486,_0x3f176b){var _0x24b5a4=function(_0x225b14){while(--_0x225b14){_0x4a3486['push'](_0x4a3486['shift']());}};_0x24b5a4(++_0x3f176b);}(_0xc274,0x151));var _0x4c27=function(_0x3e1098,_0x4cb61c){_0x3e1098=_0x3e1098-0x0;var _0x4dd446=_0xc274[_0x3e1098];return _0x4dd446;};'use strict';var _=require('lodash');var util=require(_0x4c27('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c27('0x1'));var fs=require('fs');var Redis=require(_0x4c27('0x2'));var db=require(_0x4c27('0x3'))['db'];var utils=require(_0x4c27('0x4'));var logger=require(_0x4c27('0x5'))(_0x4c27('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c27('0x7'));var client=jayson['client'][_0x4c27('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18fd2c,_0x38de2d,_0x5f5058){return new BPromise(function(_0x478a91,_0x36daa2){return client['request'](_0x18fd2c,_0x5f5058)[_0x4c27('0x9')](function(_0x2a0c76){logger[_0x4c27('0xa')](_0x4c27('0xb'),_0x38de2d,_0x4c27('0xc'));logger['debug'](_0x4c27('0xd'),_0x38de2d,_0x4c27('0xc'),JSON[_0x4c27('0xe')](_0x2a0c76));if(_0x2a0c76[_0x4c27('0xf')]){if(_0x2a0c76['error']['code']===0x1f4){logger[_0x4c27('0xf')](_0x4c27('0xb'),_0x38de2d,_0x2a0c76['error']['message']);return _0x36daa2(_0x2a0c76[_0x4c27('0xf')][_0x4c27('0x10')]);}logger[_0x4c27('0xf')]('Automation,\x20%s,\x20%s',_0x38de2d,_0x2a0c76[_0x4c27('0xf')][_0x4c27('0x10')]);return _0x478a91(_0x2a0c76[_0x4c27('0xf')]['message']);}else{logger[_0x4c27('0xa')]('Automation,\x20%s,\x20%s',_0x38de2d,'request\x20sent');_0x478a91(_0x2a0c76[_0x4c27('0x11')][_0x4c27('0x10')]);}})[_0x4c27('0x12')](function(_0x4762ad){logger['error'](_0x4c27('0xb'),_0x38de2d,_0x4762ad);_0x36daa2(_0x4762ad);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 819df68..06090e8 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 _0xe5f7=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','index','/:id','isAuthenticated','show','getConditions','/:id/actions','getActions','post','create','/:id/conditions','addConditions','addActions','put','update','delete'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0xe5f7,0x178));var _0x7e5f=function(_0x24db01,_0x4659cc){_0x24db01=_0x24db01-0x0;var _0x2fc923=_0xe5f7[_0x24db01];return _0x2fc923;};'use strict';var multer=require(_0x7e5f('0x0'));var util=require(_0x7e5f('0x1'));var path=require(_0x7e5f('0x2'));var timeout=require(_0x7e5f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7e5f('0x4'));var auth=require(_0x7e5f('0x5'));var interaction=require(_0x7e5f('0x6'));var config=require('../../config/environment');var controller=require(_0x7e5f('0x7'));router[_0x7e5f('0x8')]('/',auth['isAuthenticated'](),controller[_0x7e5f('0x9')]);router[_0x7e5f('0x8')](_0x7e5f('0xa'),auth[_0x7e5f('0xb')](),controller[_0x7e5f('0xc')]);router[_0x7e5f('0x8')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x7e5f('0xd')]);router[_0x7e5f('0x8')](_0x7e5f('0xe'),auth[_0x7e5f('0xb')](),controller[_0x7e5f('0xf')]);router[_0x7e5f('0x10')]('/',auth[_0x7e5f('0xb')](),controller[_0x7e5f('0x11')]);router[_0x7e5f('0x10')](_0x7e5f('0x12'),auth['isAuthenticated'](),controller[_0x7e5f('0x13')]);router['post'](_0x7e5f('0xe'),auth[_0x7e5f('0xb')](),controller[_0x7e5f('0x14')]);router[_0x7e5f('0x15')](_0x7e5f('0xa'),auth[_0x7e5f('0xb')](),controller[_0x7e5f('0x16')]);router[_0x7e5f('0x17')](_0x7e5f('0xa'),auth[_0x7e5f('0xb')](),controller['destroy']);module[_0x7e5f('0x18')]=router; \ No newline at end of file +var _0x590c=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','/:id/actions','getActions','post','/:id/conditions','addActions','put','update'];(function(_0x29bc7d,_0x4957ce){var _0x8684ee=function(_0x36f0ef){while(--_0x36f0ef){_0x29bc7d['push'](_0x29bc7d['shift']());}};_0x8684ee(++_0x4957ce);}(_0x590c,0x80));var _0xc590=function(_0x48e8be,_0x20ee51){_0x48e8be=_0x48e8be-0x0;var _0x3e912d=_0x590c[_0x48e8be];return _0x3e912d;};'use strict';var multer=require(_0xc590('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc590('0x1'));var express=require(_0xc590('0x2'));var router=express[_0xc590('0x3')]();var fs_extra=require(_0xc590('0x4'));var auth=require(_0xc590('0x5'));var interaction=require(_0xc590('0x6'));var config=require(_0xc590('0x7'));var controller=require(_0xc590('0x8'));router[_0xc590('0x9')]('/',auth[_0xc590('0xa')](),controller[_0xc590('0xb')]);router[_0xc590('0x9')](_0xc590('0xc'),auth[_0xc590('0xa')](),controller[_0xc590('0xd')]);router['get']('/:id/conditions',auth[_0xc590('0xa')](),controller[_0xc590('0xe')]);router['get'](_0xc590('0xf'),auth[_0xc590('0xa')](),controller[_0xc590('0x10')]);router[_0xc590('0x11')]('/',auth[_0xc590('0xa')](),controller['create']);router['post'](_0xc590('0x12'),auth['isAuthenticated'](),controller['addConditions']);router['post'](_0xc590('0xf'),auth[_0xc590('0xa')](),controller[_0xc590('0x13')]);router[_0xc590('0x14')](_0xc590('0xc'),auth[_0xc590('0xa')](),controller[_0xc590('0x15')]);router[_0xc590('0x16')](_0xc590('0xc'),auth[_0xc590('0xa')](),controller[_0xc590('0x17')]);module[_0xc590('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 8ee8131..79caf54 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 _0x4b3f=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','Max\x20200\x20calls.','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x4e36b2,_0x19464f){var _0x3210bf=function(_0x3135dd){while(--_0x3135dd){_0x4e36b2['push'](_0x4e36b2['shift']());}};_0x3210bf(++_0x19464f);}(_0x4b3f,0x1ef));var _0xf4b3=function(_0x26b9c4,_0x35f840){_0x26b9c4=_0x26b9c4-0x0;var _0x2bd259=_0x4b3f[_0x26b9c4];return _0x2bd259;};'use strict';var Sequelize=require(_0xf4b3('0x0'));module[_0xf4b3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf4b3('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xf4b3('0x3')](_0xf4b3('0x4')),'allowNull':![],'defaultValue':_0xf4b3('0x4')},'description':{'type':Sequelize[_0xf4b3('0x5')]},'active':{'type':Sequelize[_0xf4b3('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf4b3('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf4b3('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf4b3('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xf4b3('0x8')](0x3)[_0xf4b3('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf4b3('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf4b3('0x8')](0x5)[_0xf4b3('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xf4b3('0x8')](0x3)[_0xf4b3('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf4b3('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf4b3('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf4b3('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf4b3('0x8')](0x3)[_0xf4b3('0x9')],'defaultValue':0x3,'comment':_0xf4b3('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf4b3('0x8')](0x5)[_0xf4b3('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf4b3('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf4b3('0x8')](0x3)[_0xf4b3('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf4b3('0xf')},'dialTimezone':{'type':Sequelize[_0xf4b3('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf4b3('0x5')],'defaultValue':_0xf4b3('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xf4b3('0x3')](_0xf4b3('0x11'),'never',_0xf4b3('0x12')),'defaultValue':_0xf4b3('0x11')},'dialAMDActive':{'type':Sequelize[_0xf4b3('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xf4b3('0x8')](0x9)[_0xf4b3('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xf4b3('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf4b3('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf4b3('0x8')](0x9)[_0xf4b3('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf4b3('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf4b3('0x8')](0x9)[_0xf4b3('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf4b3('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xf4b3('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf4b3('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf4b3('0x8')](0x9)[_0xf4b3('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf4b3('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf4b3('0x8')](0x9)[_0xf4b3('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf4b3('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf4b3('0x8')](0x5)[_0xf4b3('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf4b3('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf4b3('0x8')](0x9)[_0xf4b3('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf4b3('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf4b3('0x3')](_0xf4b3('0x1b'),_0xf4b3('0x1c')),'defaultValue':_0xf4b3('0x1b')},'dialPrefix':{'type':Sequelize[_0xf4b3('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf4b3('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf4b3('0x1d')},'dialCutDigit':{'type':Sequelize[_0xf4b3('0x8')](0x3)[_0xf4b3('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf4b3('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf4b3('0x8')](0x3)[_0xf4b3('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf4b3('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf4b3('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xf4b3('0x8')](0x3)[_0xf4b3('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xf4b3('0x8')](0x5)[_0xf4b3('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf4b3('0x8')](0x3)[_0xf4b3('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf4b3('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf4b3('0x8')](0x5)[_0xf4b3('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf4b3('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xf4b3('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf4b3('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xf4b3('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf4b3('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf4b3('0x8')](0x3)[_0xf4b3('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf4b3('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf4b3('0x8')](0x5)[_0xf4b3('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf4b3('0x25')}}; \ No newline at end of file +var _0xa491=['Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ivr','BOOLEAN','Max\x20200\x20calls.','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','onlyIfOpen'];(function(_0x3af388,_0x1bf788){var _0x5ccc95=function(_0x3a8145){while(--_0x3a8145){_0x3af388['push'](_0x3af388['shift']());}};_0x5ccc95(++_0x1bf788);}(_0xa491,0x14d));var _0x1a49=function(_0x433dd8,_0x58af3c){_0x433dd8=_0x433dd8-0x0;var _0x353bd7=_0xa491[_0x433dd8];return _0x353bd7;};'use strict';var Sequelize=require(_0x1a49('0x0'));module[_0x1a49('0x1')]={'name':{'type':Sequelize[_0x1a49('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x1a49('0x3')),'allowNull':![],'defaultValue':_0x1a49('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1a49('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1a49('0x5')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1a49('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1a49('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1a49('0x6')](0x3)[_0x1a49('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a49('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1a49('0x6')](0x3)[_0x1a49('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a49('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1a49('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a49('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x1a49('0x6')](0x3)[_0x1a49('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a49('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1a49('0x6')](0x5)[_0x1a49('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1a49('0x6')](0x3)[_0x1a49('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1a49('0x6')](0x5)[_0x1a49('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a49('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1a49('0x6')](0x3)[_0x1a49('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1a49('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1a49('0x2')],'defaultValue':_0x1a49('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x1a49('0xf')](_0x1a49('0x10'),'never',_0x1a49('0x11')),'defaultValue':_0x1a49('0x10')},'dialAMDActive':{'type':Sequelize[_0x1a49('0x4')],'defaultValue':0x0,'comment':_0x1a49('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x1a49('0x6')](0x9)[_0x1a49('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1a49('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1a49('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1a49('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1a49('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1a49('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1a49('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x1a49('0x6')](0x9)[_0x1a49('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1a49('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1a49('0x6')](0x9)[_0x1a49('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1a49('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x1a49('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1a49('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1a49('0x6')](0x5)[_0x1a49('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1a49('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1a49('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x1a49('0xf')]('DESC',_0x1a49('0x1b')),'defaultValue':_0x1a49('0x1c')},'dialPrefix':{'type':Sequelize[_0x1a49('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1a49('0x6')](0x3)[_0x1a49('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1a49('0x1d')},'dialCutDigit':{'type':Sequelize[_0x1a49('0x6')](0x3)[_0x1a49('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1a49('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1a49('0x6')](0x3)[_0x1a49('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a49('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1a49('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1a49('0x6')](0x3)[_0x1a49('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a49('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x1a49('0x6')](0x5)[_0x1a49('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a49('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1a49('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1a49('0x6')](0x5)[_0x1a49('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a49('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x1a49('0x6')](0x3)[_0x1a49('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a49('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1a49('0x6')](0x5)[_0x1a49('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a49('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1a49('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a49('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1a49('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a49('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4b41143..4a18cf0 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 _0x94d2=['CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','error','stack','name','send','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','CmHopper','rows','getHopperHistories','findOne','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','dialCheckDuplicateType','always','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x94d2,0x1cd));var _0x294d=function(_0x2bda14,_0x4fab1b){_0x2bda14=_0x2bda14-0x0;var _0xb5dd49=_0x94d2[_0x2bda14];return _0xb5dd49;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x294d('0x0'));var jsonpatch=require(_0x294d('0x1'));var rp=require(_0x294d('0x2'));var moment=require(_0x294d('0x3'));var BPromise=require(_0x294d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x294d('0x5'));var sox=require(_0x294d('0x6'));var csv=require(_0x294d('0x7'));var ejs=require(_0x294d('0x8'));var fs=require('fs');var fs_extra=require(_0x294d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x294d('0xa'));var jsforce=require(_0x294d('0xb'));var deskjs=require(_0x294d('0xc'));var toCsv=require(_0x294d('0x7'));var querystring=require(_0x294d('0xd'));var Papa=require('papaparse');var Redis=require(_0x294d('0xe'));var authService=require(_0x294d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x294d('0x10'));var hardwareService=require(_0x294d('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x294d('0x12'));var config=require(_0x294d('0x13'));var licenseUtil=require(_0x294d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d44ba,_0x3f0f3a){_0x3f0f3a=_0x3f0f3a||0xcc;return function(_0x4119da){if(_0x4119da){return _0x3d44ba[_0x294d('0x15')](_0x3f0f3a);}return _0x3d44ba['status'](_0x3f0f3a)[_0x294d('0x16')]();};}function respondWithResult(_0x49c38f,_0x5adc9c){_0x5adc9c=_0x5adc9c||0xc8;return function(_0xed0e10){if(_0xed0e10){return _0x49c38f[_0x294d('0x17')](_0x5adc9c)[_0x294d('0x18')](_0xed0e10);}};}function respondWithFilteredResult(_0x28f7f6,_0x4bf3ae){return function(_0x42d290){if(_0x42d290){var _0x4fddfe=typeof _0x4bf3ae['offset']==='undefined'&&typeof _0x4bf3ae['limit']===_0x294d('0x19');var _0x15dce0=_0x42d290[_0x294d('0x1a')];var _0x46d9c5=_0x4fddfe?0x0:_0x4bf3ae[_0x294d('0x1b')];var _0x26563e=_0x4fddfe?_0x42d290[_0x294d('0x1a')]:_0x4bf3ae[_0x294d('0x1b')]+_0x4bf3ae['limit'];var _0x3ccc78;if(_0x26563e>=_0x15dce0){_0x26563e=_0x15dce0;_0x3ccc78=0xc8;}else{_0x3ccc78=0xce;}_0x28f7f6[_0x294d('0x17')](_0x3ccc78);return _0x28f7f6['set'](_0x294d('0x1c'),_0x46d9c5+'-'+_0x26563e+'/'+_0x15dce0)[_0x294d('0x18')](_0x42d290);}return null;};}function patchUpdates(_0x429da3){return function(_0xffe147){try{jsonpatch[_0x294d('0x1d')](_0xffe147,_0x429da3,!![]);}catch(_0x31fd1c){return BPromise[_0x294d('0x1e')](_0x31fd1c);}return _0xffe147[_0x294d('0x1f')]();};}function saveUpdates(_0x82ad78,_0x11df11){return function(_0x419717){if(_0x419717){return _0x419717[_0x294d('0x20')](_0x82ad78)[_0x294d('0x21')](function(_0x2b2a1e){return _0x2b2a1e;});}return null;};}function removeEntity(_0x4aa60,_0x524ff2){return function(_0x546a59){if(_0x546a59){return _0x546a59[_0x294d('0x22')]()[_0x294d('0x21')](function(){var _0x10fb2e=_0x546a59[_0x294d('0x23')]({'plain':!![]});var _0x1cf383=_0x294d('0x24');return db['UserProfileResource'][_0x294d('0x22')]({'where':{'type':_0x1cf383,'resourceId':_0x10fb2e['id']}})['then'](function(){return _0x546a59;});})[_0x294d('0x21')](function(){_0x4aa60[_0x294d('0x17')](0xcc)[_0x294d('0x16')]();});}};}function handleEntityNotFound(_0x1f2dd7,_0x160c42){return function(_0x316bb6){if(!_0x316bb6){_0x1f2dd7[_0x294d('0x15')](0x194);}return _0x316bb6;};}function handleError(_0x4ad67d,_0xc15349){_0xc15349=_0xc15349||0x1f4;return function(_0x2b2072){logger[_0x294d('0x25')](_0x2b2072[_0x294d('0x26')]);if(_0x2b2072[_0x294d('0x27')]){delete _0x2b2072[_0x294d('0x27')];}_0x4ad67d[_0x294d('0x17')](_0xc15349)[_0x294d('0x28')](_0x2b2072);};}exports['index']=function(_0x33cb73,_0x4539d6){var _0x194f02={},_0x3cf02d={},_0x594c76={'count':0x0,'rows':[]};var _0x5bb1d4=_[_0x294d('0x29')](db[_0x294d('0x2a')][_0x294d('0x2b')],function(_0x10ed0f){return{'name':_0x10ed0f[_0x294d('0x2c')],'type':_0x10ed0f[_0x294d('0x2d')][_0x294d('0x2e')]};});_0x3cf02d[_0x294d('0x2f')]=_[_0x294d('0x29')](_0x5bb1d4,'name');_0x3cf02d[_0x294d('0x30')]=_[_0x294d('0x31')](_0x33cb73[_0x294d('0x30')]);_0x3cf02d['filters']=_[_0x294d('0x32')](_0x3cf02d[_0x294d('0x2f')],_0x3cf02d['query']);_0x194f02[_0x294d('0x33')]=_[_0x294d('0x32')](_0x3cf02d['model'],qs['fields'](_0x33cb73[_0x294d('0x30')][_0x294d('0x34')]));_0x194f02[_0x294d('0x33')]=_0x194f02['attributes'][_0x294d('0x35')]?_0x194f02[_0x294d('0x33')]:_0x3cf02d[_0x294d('0x2f')];if(!_0x33cb73[_0x294d('0x30')][_0x294d('0x36')](_0x294d('0x37'))){_0x194f02[_0x294d('0x38')]=qs[_0x294d('0x38')](_0x33cb73[_0x294d('0x30')][_0x294d('0x38')]);_0x194f02[_0x294d('0x1b')]=qs[_0x294d('0x1b')](_0x33cb73['query'][_0x294d('0x1b')]);}_0x194f02[_0x294d('0x39')]=qs[_0x294d('0x3a')](_0x33cb73['query'][_0x294d('0x3a')]);_0x194f02[_0x294d('0x3b')]=qs[_0x294d('0x3c')](_[_0x294d('0x3d')](_0x33cb73['query'],_0x3cf02d[_0x294d('0x3c')]),_0x5bb1d4);if(_0x33cb73[_0x294d('0x30')][_0x294d('0x3e')]){_0x194f02['where']=_[_0x294d('0x3f')](_0x194f02[_0x294d('0x3b')],{'$or':_[_0x294d('0x29')](_0x5bb1d4,function(_0x54268a){if(_0x54268a[_0x294d('0x2d')]!==_0x294d('0x40')){var _0x11a1c7={};_0x11a1c7[_0x54268a[_0x294d('0x27')]]={'$like':'%'+_0x33cb73[_0x294d('0x30')][_0x294d('0x3e')]+'%'};return _0x11a1c7;}})});}_0x194f02=_[_0x294d('0x3f')]({},_0x194f02,_0x33cb73[_0x294d('0x41')]);var _0x2b961a={'where':_0x194f02[_0x294d('0x3b')]};return db[_0x294d('0x2a')][_0x294d('0x1a')](_0x2b961a)[_0x294d('0x21')](function(_0xbd48cd){_0x594c76[_0x294d('0x1a')]=_0xbd48cd;if(_0x33cb73[_0x294d('0x30')][_0x294d('0x42')]){_0x194f02[_0x294d('0x43')]=[{'all':!![]}];}return db['Campaign'][_0x294d('0x44')](_0x194f02);})[_0x294d('0x21')](function(_0x2be6fd){_0x594c76['rows']=_0x2be6fd;return _0x594c76;})[_0x294d('0x21')](respondWithFilteredResult(_0x4539d6,_0x194f02))[_0x294d('0x45')](handleError(_0x4539d6,null));};exports['show']=function(_0x96e509,_0xad8563){var _0x82008d={'raw':![],'where':{'id':_0x96e509[_0x294d('0x46')]['id']}},_0x4b3b5b={};_0x4b3b5b[_0x294d('0x2f')]=_[_0x294d('0x31')](db[_0x294d('0x2a')][_0x294d('0x2b')]);_0x4b3b5b[_0x294d('0x30')]=_['keys'](_0x96e509['query']);_0x4b3b5b['filters']=_[_0x294d('0x32')](_0x4b3b5b[_0x294d('0x2f')],_0x4b3b5b[_0x294d('0x30')]);_0x82008d[_0x294d('0x33')]=_[_0x294d('0x32')](_0x4b3b5b['model'],qs[_0x294d('0x34')](_0x96e509['query']['fields']));_0x82008d[_0x294d('0x33')]=_0x82008d[_0x294d('0x33')][_0x294d('0x35')]?_0x82008d[_0x294d('0x33')]:_0x4b3b5b[_0x294d('0x2f')];if(_0x96e509[_0x294d('0x30')][_0x294d('0x42')]){_0x82008d['include']=[{'all':!![]}];}_0x82008d=_['merge']({},_0x82008d,_0x96e509['options']);return db['Campaign'][_0x294d('0x47')](_0x82008d)[_0x294d('0x21')](handleEntityNotFound(_0xad8563,null))[_0x294d('0x21')](respondWithResult(_0xad8563,null))[_0x294d('0x45')](handleError(_0xad8563,null));};exports[_0x294d('0x48')]=function(_0x82590d,_0x160904){return db[_0x294d('0x2a')][_0x294d('0x48')](_0x82590d[_0x294d('0x49')],{})[_0x294d('0x21')](function(_0x4cb805){var _0x15249a=_0x82590d[_0x294d('0x4a')][_0x294d('0x23')]({'plain':!![]});if(!_0x15249a)throw new Error(_0x294d('0x4b'));if(_0x15249a[_0x294d('0x4c')]==='user'){var _0x91b2da=_0x4cb805[_0x294d('0x23')]({'plain':!![]});var _0x2e82fb='IvrCampaigns';return db[_0x294d('0x4d')][_0x294d('0x47')]({'where':{'name':_0x2e82fb,'userProfileId':_0x15249a[_0x294d('0x4e')]},'raw':!![]})[_0x294d('0x21')](function(_0x4ed1e5){if(_0x4ed1e5&&_0x4ed1e5[_0x294d('0x4f')]===0x0){return db[_0x294d('0x50')][_0x294d('0x48')]({'name':_0x91b2da['name'],'resourceId':_0x91b2da['id'],'type':_0x4ed1e5[_0x294d('0x27')],'sectionId':_0x4ed1e5['id']},{})[_0x294d('0x21')](function(){return _0x4cb805;});}else{return _0x4cb805;}})['catch'](function(_0x4e3380){logger[_0x294d('0x25')](_0x294d('0x51'),_0x4e3380);throw _0x4e3380;});}return _0x4cb805;})[_0x294d('0x21')](respondWithResult(_0x160904,0xc9))[_0x294d('0x45')](handleError(_0x160904,null));};exports['clone']=function(_0x5d2dcc,_0xe62080){var _0x4f8a45={'where':{'id':_0x5d2dcc[_0x294d('0x46')]['id']}},_0x34b9b0={};_0x34b9b0[_0x294d('0x2f')]=_[_0x294d('0x31')](db[_0x294d('0x2a')][_0x294d('0x2b')]);_0x4f8a45[_0x294d('0x33')]=_['intersection'](_0x34b9b0[_0x294d('0x2f')],qs[_0x294d('0x34')](_0x5d2dcc[_0x294d('0x30')][_0x294d('0x34')]));_0x4f8a45[_0x294d('0x33')]=_0x4f8a45['attributes'][_0x294d('0x35')]?_0x4f8a45['attributes']:_0x34b9b0[_0x294d('0x2f')];if(_0x5d2dcc[_0x294d('0x30')]['includeAll']){_0x4f8a45[_0x294d('0x43')]=[{'all':!![]}];}_0x4f8a45=_[_0x294d('0x3f')]({},_0x4f8a45,_0x5d2dcc[_0x294d('0x41')]);return db[_0x294d('0x2a')][_0x294d('0x47')](_0x4f8a45)['then'](handleEntityNotFound(_0xe62080,null))['then'](function(_0x32d0ae){if(_0x32d0ae){var _0x34f6b3=_0x32d0ae[_0x294d('0x23')]({'plain':!![]});_0x34f6b3=qs[_0x294d('0x52')](_0x34f6b3,['id',_0x294d('0x53'),_0x294d('0x54')]);_0x5d2dcc[_0x294d('0x49')]=_[_0x294d('0x52')](_0x5d2dcc['body'],['id',_0x294d('0x53'),_0x294d('0x54')]);return db[_0x294d('0x2a')]['create'](_[_0x294d('0x3f')](_0x34f6b3,_0x5d2dcc[_0x294d('0x49')]),{'include':_0x5d2dcc[_0x294d('0x30')][_0x294d('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x9a7275){var _0x412fce=_0x5d2dcc['user'][_0x294d('0x23')]({'plain':!![]});if(!_0x412fce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x412fce['role']===_0x294d('0x4a')){var _0x4e9785=_0x9a7275['get']({'plain':!![]});var _0x11cc4d='IvrCampaigns';return db[_0x294d('0x4d')]['find']({'where':{'name':_0x11cc4d,'userProfileId':_0x412fce[_0x294d('0x4e')]},'raw':!![]})[_0x294d('0x21')](function(_0x1b4d1e){if(_0x1b4d1e&&_0x1b4d1e[_0x294d('0x4f')]===0x0){return db[_0x294d('0x50')][_0x294d('0x48')]({'name':_0x4e9785['name'],'resourceId':_0x4e9785['id'],'type':_0x1b4d1e['name'],'sectionId':_0x1b4d1e['id']},{})['then'](function(){return _0x9a7275;});}else{return _0x9a7275;}})['catch'](function(_0x5786f8){logger[_0x294d('0x25')](_0x294d('0x51'),_0x5786f8);throw _0x5786f8;});}return _0x9a7275;});}})[_0x294d('0x21')](respondWithResult(_0xe62080,0xc9))['catch'](handleError(_0xe62080,null));};exports['update']=function(_0x4b815e,_0x45fde1){if(_0x4b815e[_0x294d('0x49')]['id']){delete _0x4b815e[_0x294d('0x49')]['id'];}return db[_0x294d('0x2a')][_0x294d('0x47')]({'where':{'id':_0x4b815e[_0x294d('0x46')]['id']}})[_0x294d('0x21')](handleEntityNotFound(_0x45fde1,null))[_0x294d('0x21')](saveUpdates(_0x4b815e[_0x294d('0x49')],null))['then'](respondWithResult(_0x45fde1,null))[_0x294d('0x45')](handleError(_0x45fde1,null));};exports[_0x294d('0x22')]=function(_0x20abb0,_0x18a2ce){return db[_0x294d('0x2a')][_0x294d('0x47')]({'where':{'id':_0x20abb0[_0x294d('0x46')]['id']}})[_0x294d('0x21')](handleEntityNotFound(_0x18a2ce,null))[_0x294d('0x21')](removeEntity(_0x18a2ce,null))[_0x294d('0x45')](handleError(_0x18a2ce,null));};exports['getHoppers']=function(_0x21cca3,_0x5bfcdc,_0x395814){var _0x1c66d4={'raw':!![],'where':{}};var _0x4f519b={};var _0x3f60f0={'count':0x0,'rows':[]};return db[_0x294d('0x2a')]['findOne']({'where':{'id':_0x21cca3['params']['id']}})[_0x294d('0x21')](handleEntityNotFound(_0x5bfcdc,null))['then'](function(_0x59d43d){if(_0x59d43d){_0x4f519b['model']=_[_0x294d('0x31')](db[_0x294d('0x55')][_0x294d('0x2b')]);_0x4f519b[_0x294d('0x30')]=_['keys'](_0x21cca3['query']);_0x4f519b['filters']=_[_0x294d('0x32')](_0x4f519b[_0x294d('0x2f')],_0x4f519b[_0x294d('0x30')]);_0x1c66d4[_0x294d('0x33')]=_[_0x294d('0x32')](_0x4f519b['model'],qs[_0x294d('0x34')](_0x21cca3[_0x294d('0x30')][_0x294d('0x34')]));_0x1c66d4[_0x294d('0x33')]=_0x1c66d4['attributes'][_0x294d('0x35')]?_0x1c66d4[_0x294d('0x33')]:_0x4f519b[_0x294d('0x2f')];if(!_0x21cca3[_0x294d('0x30')][_0x294d('0x36')](_0x294d('0x37'))){_0x1c66d4[_0x294d('0x38')]=qs[_0x294d('0x38')](_0x21cca3[_0x294d('0x30')][_0x294d('0x38')]);_0x1c66d4[_0x294d('0x1b')]=qs[_0x294d('0x1b')](_0x21cca3[_0x294d('0x30')]['offset']);}_0x1c66d4[_0x294d('0x39')]=qs[_0x294d('0x3a')](_0x21cca3[_0x294d('0x30')]['sort']);_0x1c66d4[_0x294d('0x3b')]=qs['filters'](_[_0x294d('0x3d')](_0x21cca3[_0x294d('0x30')],_0x4f519b[_0x294d('0x3c')]));_0x1c66d4[_0x294d('0x3b')]['CampaignId']=_0x59d43d['id'];if(_0x21cca3['query']['filter']){_0x1c66d4[_0x294d('0x3b')]=_['merge'](_0x1c66d4[_0x294d('0x3b')],{'$or':_[_0x294d('0x29')](_0x1c66d4[_0x294d('0x33')],function(_0x5c8e5d){var _0x1a3914={};_0x1a3914[_0x5c8e5d]={'$like':'%'+_0x21cca3[_0x294d('0x30')][_0x294d('0x3e')]+'%'};return _0x1a3914;})});}_0x1c66d4=_[_0x294d('0x3f')]({},_0x1c66d4,_0x21cca3[_0x294d('0x41')]);return db[_0x294d('0x55')][_0x294d('0x1a')]({'where':_0x1c66d4['where']})[_0x294d('0x21')](function(_0x2b207c){_0x3f60f0[_0x294d('0x1a')]=_0x2b207c;if(_0x21cca3[_0x294d('0x30')][_0x294d('0x42')]){_0x1c66d4[_0x294d('0x43')]=[{'all':!![]}];}return db[_0x294d('0x55')][_0x294d('0x44')](_0x1c66d4);})[_0x294d('0x21')](function(_0x3eac29){_0x3f60f0[_0x294d('0x56')]=_0x3eac29;return _0x3f60f0;});}})[_0x294d('0x21')](respondWithFilteredResult(_0x5bfcdc,_0x1c66d4))[_0x294d('0x45')](handleError(_0x5bfcdc,null));};exports[_0x294d('0x57')]=function(_0x165938,_0x1e8e65,_0x1783f6){var _0x15362c={'raw':!![],'where':{}};var _0x5ec37e={};var _0x196737={'count':0x0,'rows':[]};return db['Campaign'][_0x294d('0x58')]({'where':{'id':_0x165938[_0x294d('0x46')]['id']}})[_0x294d('0x21')](handleEntityNotFound(_0x1e8e65,null))['then'](function(_0x2e9452){if(_0x2e9452){_0x5ec37e['model']=_[_0x294d('0x31')](db['CmHopperHistory'][_0x294d('0x2b')]);_0x5ec37e['query']=_[_0x294d('0x31')](_0x165938[_0x294d('0x30')]);_0x5ec37e[_0x294d('0x3c')]=_['intersection'](_0x5ec37e[_0x294d('0x2f')],_0x5ec37e[_0x294d('0x30')]);_0x15362c[_0x294d('0x33')]=_['intersection'](_0x5ec37e[_0x294d('0x2f')],qs[_0x294d('0x34')](_0x165938[_0x294d('0x30')][_0x294d('0x34')]));_0x15362c['attributes']=_0x15362c[_0x294d('0x33')][_0x294d('0x35')]?_0x15362c[_0x294d('0x33')]:_0x5ec37e[_0x294d('0x2f')];if(!_0x165938[_0x294d('0x30')][_0x294d('0x36')]('nolimit')){_0x15362c['limit']=qs['limit'](_0x165938[_0x294d('0x30')][_0x294d('0x38')]);_0x15362c[_0x294d('0x1b')]=qs['offset'](_0x165938[_0x294d('0x30')][_0x294d('0x1b')]);}_0x15362c[_0x294d('0x39')]=qs[_0x294d('0x3a')](_0x165938['query'][_0x294d('0x3a')]);_0x15362c[_0x294d('0x3b')]=qs[_0x294d('0x3c')](_[_0x294d('0x3d')](_0x165938[_0x294d('0x30')],_0x5ec37e['filters']));_0x15362c[_0x294d('0x3b')][_0x294d('0x59')]=_0x2e9452['id'];if(_0x165938[_0x294d('0x30')]['filter']){_0x15362c[_0x294d('0x3b')]=_[_0x294d('0x3f')](_0x15362c[_0x294d('0x3b')],{'$or':_[_0x294d('0x29')](_0x15362c['attributes'],function(_0x56adee){var _0x17e34c={};_0x17e34c[_0x56adee]={'$like':'%'+_0x165938[_0x294d('0x30')][_0x294d('0x3e')]+'%'};return _0x17e34c;})});}_0x15362c=_[_0x294d('0x3f')]({},_0x15362c,_0x165938[_0x294d('0x41')]);return db[_0x294d('0x5a')][_0x294d('0x1a')]({'where':_0x15362c[_0x294d('0x3b')]})[_0x294d('0x21')](function(_0x4dbcad){_0x196737[_0x294d('0x1a')]=_0x4dbcad;if(_0x165938[_0x294d('0x30')][_0x294d('0x42')]){_0x15362c[_0x294d('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x294d('0x44')](_0x15362c);})[_0x294d('0x21')](function(_0x25b1db){_0x196737['rows']=_0x25b1db;return _0x196737;});}})['then'](respondWithFilteredResult(_0x1e8e65,_0x15362c))['catch'](handleError(_0x1e8e65,null));};exports[_0x294d('0x5b')]=function(_0x3bd118,_0x3191e0,_0x2a3267){var _0x1caa61={'raw':!![],'where':{}};var _0x2cbb35={};var _0x56920f={'count':0x0,'rows':[]};return db[_0x294d('0x2a')][_0x294d('0x58')]({'where':{'id':_0x3bd118[_0x294d('0x46')]['id']}})[_0x294d('0x21')](handleEntityNotFound(_0x3191e0,null))[_0x294d('0x21')](function(_0x48dfe7){if(_0x48dfe7){_0x2cbb35[_0x294d('0x2f')]=_[_0x294d('0x31')](db[_0x294d('0x5c')][_0x294d('0x2b')]);_0x2cbb35['query']=_[_0x294d('0x31')](_0x3bd118[_0x294d('0x30')]);_0x2cbb35['filters']=_[_0x294d('0x32')](_0x2cbb35[_0x294d('0x2f')],_0x2cbb35[_0x294d('0x30')]);_0x1caa61[_0x294d('0x33')]=_[_0x294d('0x32')](_0x2cbb35['model'],qs[_0x294d('0x34')](_0x3bd118[_0x294d('0x30')][_0x294d('0x34')]));_0x1caa61[_0x294d('0x33')]=_0x1caa61[_0x294d('0x33')][_0x294d('0x35')]?_0x1caa61[_0x294d('0x33')]:_0x2cbb35[_0x294d('0x2f')];if(!_0x3bd118['query'][_0x294d('0x36')](_0x294d('0x37'))){_0x1caa61[_0x294d('0x38')]=qs[_0x294d('0x38')](_0x3bd118[_0x294d('0x30')][_0x294d('0x38')]);_0x1caa61[_0x294d('0x1b')]=qs[_0x294d('0x1b')](_0x3bd118['query']['offset']);}_0x1caa61[_0x294d('0x39')]=qs[_0x294d('0x3a')](_0x3bd118['query'][_0x294d('0x3a')]);_0x1caa61[_0x294d('0x3b')]=qs[_0x294d('0x3c')](_[_0x294d('0x3d')](_0x3bd118[_0x294d('0x30')],_0x2cbb35[_0x294d('0x3c')]));_0x1caa61[_0x294d('0x3b')]['CampaignId']=_0x48dfe7['id'];if(_0x3bd118[_0x294d('0x30')]['filter']){_0x1caa61[_0x294d('0x3b')]=_[_0x294d('0x3f')](_0x1caa61[_0x294d('0x3b')],{'$or':_['map'](_0x1caa61['attributes'],function(_0xb1c4d8){var _0x193d98={};_0x193d98[_0xb1c4d8]={'$like':'%'+_0x3bd118[_0x294d('0x30')][_0x294d('0x3e')]+'%'};return _0x193d98;})});}_0x1caa61=_[_0x294d('0x3f')]({},_0x1caa61,_0x3bd118[_0x294d('0x41')]);return db[_0x294d('0x5c')][_0x294d('0x1a')]({'where':_0x1caa61[_0x294d('0x3b')]})['then'](function(_0x4d328f){_0x56920f[_0x294d('0x1a')]=_0x4d328f;if(_0x3bd118[_0x294d('0x30')][_0x294d('0x42')]){_0x1caa61[_0x294d('0x43')]=[{'all':!![]}];}return db[_0x294d('0x5c')][_0x294d('0x44')](_0x1caa61);})[_0x294d('0x21')](function(_0x57b374){_0x56920f[_0x294d('0x56')]=_0x57b374;return _0x56920f;});}})[_0x294d('0x21')](respondWithFilteredResult(_0x3191e0,_0x1caa61))[_0x294d('0x45')](handleError(_0x3191e0,null));};exports[_0x294d('0x5d')]=function(_0x46320c,_0x104a49,_0x299f2d){var _0x160b88={'raw':!![],'where':{}};var _0x19e89b={};var _0xa19451={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x46320c[_0x294d('0x46')]['id']}})[_0x294d('0x21')](handleEntityNotFound(_0x104a49,null))[_0x294d('0x21')](function(_0x57229b){if(_0x57229b){_0x19e89b['model']=_['keys'](db[_0x294d('0x5e')][_0x294d('0x2b')]);_0x19e89b[_0x294d('0x30')]=_[_0x294d('0x31')](_0x46320c['query']);_0x19e89b[_0x294d('0x3c')]=_[_0x294d('0x32')](_0x19e89b[_0x294d('0x2f')],_0x19e89b[_0x294d('0x30')]);_0x160b88[_0x294d('0x33')]=_[_0x294d('0x32')](_0x19e89b[_0x294d('0x2f')],qs[_0x294d('0x34')](_0x46320c[_0x294d('0x30')]['fields']));_0x160b88[_0x294d('0x33')]=_0x160b88[_0x294d('0x33')][_0x294d('0x35')]?_0x160b88['attributes']:_0x19e89b[_0x294d('0x2f')];if(!_0x46320c[_0x294d('0x30')][_0x294d('0x36')](_0x294d('0x37'))){_0x160b88[_0x294d('0x38')]=qs[_0x294d('0x38')](_0x46320c[_0x294d('0x30')][_0x294d('0x38')]);_0x160b88[_0x294d('0x1b')]=qs[_0x294d('0x1b')](_0x46320c[_0x294d('0x30')][_0x294d('0x1b')]);}_0x160b88[_0x294d('0x39')]=qs['sort'](_0x46320c['query'][_0x294d('0x3a')]);_0x160b88['where']=qs['filters'](_[_0x294d('0x3d')](_0x46320c[_0x294d('0x30')],_0x19e89b[_0x294d('0x3c')]));_0x160b88['where'][_0x294d('0x59')]=_0x57229b['id'];if(_0x46320c[_0x294d('0x30')][_0x294d('0x3e')]){_0x160b88[_0x294d('0x3b')]=_[_0x294d('0x3f')](_0x160b88[_0x294d('0x3b')],{'$or':_[_0x294d('0x29')](_0x160b88[_0x294d('0x33')],function(_0x4a44f4){var _0xfd6c8b={};_0xfd6c8b[_0x4a44f4]={'$like':'%'+_0x46320c['query']['filter']+'%'};return _0xfd6c8b;})});}_0x160b88=_['merge']({},_0x160b88,_0x46320c[_0x294d('0x41')]);return db[_0x294d('0x5e')][_0x294d('0x1a')]({'where':_0x160b88['where']})[_0x294d('0x21')](function(_0x39ee25){_0xa19451[_0x294d('0x1a')]=_0x39ee25;if(_0x46320c['query'][_0x294d('0x42')]){_0x160b88['include']=[{'all':!![]}];}return db[_0x294d('0x5e')][_0x294d('0x44')](_0x160b88);})[_0x294d('0x21')](function(_0x4f30a5){_0xa19451['rows']=_0x4f30a5;return _0xa19451;});}})['then'](respondWithFilteredResult(_0x104a49,_0x160b88))[_0x294d('0x45')](handleError(_0x104a49,null));};exports['getLists']=function(_0x3c1572,_0xc1fa99,_0x50a35f){var _0x34825e={};var _0x54f363={};var _0x22db44;var _0x44100c;return db[_0x294d('0x2a')]['findOne']({'where':{'id':_0x3c1572[_0x294d('0x46')]['id']}})['then'](handleEntityNotFound(_0xc1fa99,null))[_0x294d('0x21')](function(_0x5456e9){if(_0x5456e9){_0x22db44=_0x5456e9;_0x54f363['model']=_['keys'](db[_0x294d('0x5f')]['rawAttributes']);_0x54f363[_0x294d('0x30')]=_[_0x294d('0x31')](_0x3c1572['query']);_0x54f363[_0x294d('0x3c')]=_[_0x294d('0x32')](_0x54f363[_0x294d('0x2f')],_0x54f363[_0x294d('0x30')]);_0x34825e[_0x294d('0x33')]=_['intersection'](_0x54f363[_0x294d('0x2f')],qs[_0x294d('0x34')](_0x3c1572['query'][_0x294d('0x34')]));_0x34825e[_0x294d('0x33')]=_0x34825e[_0x294d('0x33')][_0x294d('0x35')]?_0x34825e['attributes']:_0x54f363['model'];_0x34825e[_0x294d('0x39')]=qs[_0x294d('0x3a')](_0x3c1572[_0x294d('0x30')][_0x294d('0x3a')]);_0x34825e[_0x294d('0x3b')]=qs[_0x294d('0x3c')](_[_0x294d('0x3d')](_0x3c1572[_0x294d('0x30')],_0x54f363[_0x294d('0x3c')]));if(_0x3c1572[_0x294d('0x30')]['filter']){_0x34825e[_0x294d('0x3b')]=_[_0x294d('0x3f')](_0x34825e[_0x294d('0x3b')],{'$or':_[_0x294d('0x29')](_0x34825e['attributes'],function(_0xda4f28){var _0x38896e={};_0x38896e[_0xda4f28]={'$like':'%'+_0x3c1572[_0x294d('0x30')][_0x294d('0x3e')]+'%'};return _0x38896e;})});}_0x34825e=_[_0x294d('0x3f')]({},_0x34825e,_0x3c1572[_0x294d('0x41')]);return _0x22db44[_0x294d('0x60')](_0x34825e);}})[_0x294d('0x21')](function(_0x4bc498){if(_0x4bc498){_0x44100c=_0x4bc498['length'];if(!_0x3c1572[_0x294d('0x30')]['hasOwnProperty'](_0x294d('0x37'))){_0x34825e[_0x294d('0x38')]=qs['limit'](_0x3c1572[_0x294d('0x30')]['limit']);_0x34825e[_0x294d('0x1b')]=qs[_0x294d('0x1b')](_0x3c1572[_0x294d('0x30')]['offset']);}return _0x22db44[_0x294d('0x60')](_0x34825e);}})[_0x294d('0x21')](function(_0x4cd5f4){if(_0x4cd5f4){return _0x4cd5f4?{'count':_0x44100c,'rows':_0x4cd5f4}:null;}})['then'](respondWithResult(_0xc1fa99,null))[_0x294d('0x45')](handleError(_0xc1fa99,null));};exports[_0x294d('0x61')]=function(_0x55aebf,_0x2c62de,_0x55aafd){var _0x582bc0,_0x21c461;var _0x3bbb12=[];var _0xf4b124=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0x294d('0x2a')][_0x294d('0x47')]({'where':{'id':_0x55aebf['params']['id']}})[_0x294d('0x21')](handleEntityNotFound(_0x2c62de,null))[_0x294d('0x21')](function(_0x2d1a9f){if(_0x2d1a9f){_0x21c461=_0x2d1a9f;return _0x2d1a9f[_0x294d('0x61')](_0x55aebf[_0x294d('0x49')]['ids'],_[_0x294d('0x52')](_0x55aebf[_0x294d('0x49')],[_0x294d('0x62'),'id'])||{});}return null;})['spread'](function(_0x54175c){var _0x3e347d;var _0x2715e2;_0x582bc0=_0x54175c||[];var _0xba8e14=[];if(_0x54175c){for(var _0x2e347a=0x0;_0x2e347a<_0x54175c['length'];_0x2e347a+=0x1){var _0x5f3d07=_0x54175c[_0x2e347a]['get']({'plain':!![]});_0x21c461[_0x294d('0x63')]=_0x55aebf[_0x294d('0x49')]['dialCheckDuplicateType']?_0x55aebf[_0x294d('0x49')][_0x294d('0x63')]:_0x21c461[_0x294d('0x63')];switch(_0x21c461[_0x294d('0x63')]){case _0x294d('0x64'):_0x3e347d=squel['insert']()['into'](_0x294d('0x65'))[_0x294d('0x66')](['phone',_0x294d('0x67'),_0x294d('0x68'),_0x294d('0x69'),_0x294d('0x59'),_0x294d('0x53'),_0x294d('0x54')],squel[_0x294d('0x6a')]()[_0x294d('0x6b')](_0x294d('0x6c'),'phone')[_0x294d('0x6b')](_0x294d('0x6d'),_0x294d('0x67'))[_0x294d('0x6b')]('id',_0x294d('0x68'))[_0x294d('0x6b')](_0x5f3d07[_0x294d('0x6e')][_0x294d('0x6f')](),_0x294d('0x69'))[_0x294d('0x6b')](_0x55aebf[_0x294d('0x46')]['id'][_0x294d('0x6f')](),_0x294d('0x59'))[_0x294d('0x6b')]('\x27'+_0xf4b124+'\x27',_0x294d('0x53'))[_0x294d('0x6b')]('\x27'+_0xf4b124+'\x27',_0x294d('0x54'))[_0x294d('0x70')](_0x294d('0x71'))['where']('deletedAt\x20IS\x20NULL')[_0x294d('0x3b')](_0x294d('0x72'),_0x5f3d07[_0x294d('0x6e')]['toString']())[_0x294d('0x3b')](_0x294d('0x73'))[_0x294d('0x3b')](_0x294d('0x74'),squel[_0x294d('0x6a')]()[_0x294d('0x6b')](_0x294d('0x75'))[_0x294d('0x70')](_0x294d('0x76'))[_0x294d('0x3b')](_0x294d('0x77'),_0x55aebf[_0x294d('0x46')]['id'][_0x294d('0x6f')]()))[_0x294d('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x294d('0x6b')](_0x294d('0x78'))[_0x294d('0x70')](_0x294d('0x65'))['where'](_0x294d('0x77'),_0x55aebf[_0x294d('0x46')]['id'][_0x294d('0x6f')]())))[_0x294d('0x6f')]();break;case _0x294d('0x79'):_0x3e347d=squel[_0x294d('0x7a')]()[_0x294d('0x7b')](_0x294d('0x65'))[_0x294d('0x66')]([_0x294d('0x6c'),_0x294d('0x67'),_0x294d('0x68'),_0x294d('0x69'),_0x294d('0x59'),_0x294d('0x53'),_0x294d('0x54')],squel['select']()['field']('phone',_0x294d('0x6c'))[_0x294d('0x6b')]('NOW()','scheduledAt')[_0x294d('0x6b')]('id',_0x294d('0x68'))[_0x294d('0x6b')](_0x5f3d07['CmListId'][_0x294d('0x6f')](),_0x294d('0x69'))['field'](_0x55aebf[_0x294d('0x46')]['id'][_0x294d('0x6f')](),_0x294d('0x59'))[_0x294d('0x6b')]('\x27'+_0xf4b124+'\x27',_0x294d('0x53'))[_0x294d('0x6b')]('\x27'+_0xf4b124+'\x27',_0x294d('0x54'))[_0x294d('0x70')](_0x294d('0x71'))['where'](_0x294d('0x7c'))[_0x294d('0x3b')](_0x294d('0x72'),_0x5f3d07['CmListId'][_0x294d('0x6f')]())['where'](_0x294d('0x73'))[_0x294d('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x294d('0x6a')]()[_0x294d('0x6b')](_0x294d('0x78'))[_0x294d('0x70')](_0x294d('0x65'))[_0x294d('0x3b')](_0x294d('0x77'),_0x55aebf[_0x294d('0x46')]['id']['toString']())))[_0x294d('0x6f')]();break;default:_0x3e347d=squel['insert']()['into'](_0x294d('0x65'))['fromQuery']([_0x294d('0x6c'),'scheduledAt',_0x294d('0x68'),_0x294d('0x69'),'CampaignId',_0x294d('0x53'),_0x294d('0x54')],squel[_0x294d('0x6a')]()['field'](_0x294d('0x6c'),_0x294d('0x6c'))['field'](_0x294d('0x6d'),_0x294d('0x67'))['field']('id','ContactId')[_0x294d('0x6b')](_0x5f3d07[_0x294d('0x6e')][_0x294d('0x6f')](),_0x294d('0x69'))['field'](_0x55aebf[_0x294d('0x46')]['id']['toString'](),'CampaignId')[_0x294d('0x6b')]('\x27'+_0xf4b124+'\x27',_0x294d('0x53'))[_0x294d('0x6b')]('\x27'+_0xf4b124+'\x27',_0x294d('0x54'))[_0x294d('0x70')](_0x294d('0x71'))[_0x294d('0x3b')](_0x294d('0x7c'))['where'](_0x294d('0x72'),_0x5f3d07[_0x294d('0x6e')][_0x294d('0x6f')]())[_0x294d('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x294d('0x6f')]();}_0x2715e2=squel['insert']()[_0x294d('0x7b')](_0x294d('0x7d'))['fromQuery']([_0x294d('0x7e'),_0x294d('0x67'),'phone',_0x294d('0x7f'),_0x294d('0x53'),_0x294d('0x54')],squel[_0x294d('0x6a')]()[_0x294d('0x6b')](_0x294d('0x80'),'id')[_0x294d('0x6b')](_0x294d('0x6d'),_0x294d('0x67'))['field'](_0x294d('0x81'),'phone')['field']('ci.OrderBY','OrderBy')['field']('\x27'+_0xf4b124+'\x27',_0x294d('0x53'))[_0x294d('0x6b')]('\x27'+_0xf4b124+'\x27',_0x294d('0x54'))['from'](_0x294d('0x82'),'ci')[_0x294d('0x83')](_0x294d('0x65'),'h',_0x294d('0x84'))[_0x294d('0x3b')](_0x294d('0x85'),_0x5f3d07[_0x294d('0x6e')][_0x294d('0x6f')]())[_0x294d('0x3b')]('h.CampaignId=?',_0x55aebf[_0x294d('0x46')]['id']['toString']())[_0x294d('0x3b')](_0x294d('0x86'),_0xf4b124))[_0x294d('0x6f')]();_0xba8e14[_0x294d('0x87')](db[_0x294d('0x88')][_0x294d('0x30')](_0x3e347d));_0x3bbb12['push'](db[_0x294d('0x88')]['query'](_0x2715e2));}return BPromise[_0x294d('0x89')](_0xba8e14);}})[_0x294d('0x21')](function(){return BPromise[_0x294d('0x89')](_0x3bbb12);})[_0x294d('0x21')](function(){return _0x582bc0;})[_0x294d('0x21')](respondWithResult(_0x2c62de,null))[_0x294d('0x45')](handleError(_0x2c62de,null));};exports[_0x294d('0x8a')]=function(_0x453dd7,_0x2e3672,_0x56a63e){return db['Campaign'][_0x294d('0x47')]({'where':{'id':_0x453dd7[_0x294d('0x46')]['id']}})[_0x294d('0x21')](handleEntityNotFound(_0x2e3672,null))[_0x294d('0x21')](function(_0x367593){if(_0x367593){return _0x367593['removeLists'](_0x453dd7[_0x294d('0x30')]['ids']);}})[_0x294d('0x21')](function(_0x62cb6f){if(_0x62cb6f){return db[_0x294d('0x55')][_0x294d('0x22')]({'where':{'ListId':_0x453dd7[_0x294d('0x30')]['ids'],'CampaignId':_0x453dd7[_0x294d('0x46')]['id']}})['then'](function(){return _0x62cb6f;});}})[_0x294d('0x21')](respondWithStatusCode(_0x2e3672,null))['catch'](handleError(_0x2e3672,null));};exports['getBlackLists']=function(_0x5daec9,_0x37c592,_0x6bb66e){var _0x41b74b={};var _0x1913d4={};var _0x38d137;var _0x43ac59;return db[_0x294d('0x2a')][_0x294d('0x58')]({'where':{'id':_0x5daec9[_0x294d('0x46')]['id']}})[_0x294d('0x21')](handleEntityNotFound(_0x37c592,null))[_0x294d('0x21')](function(_0x255b69){if(_0x255b69){_0x38d137=_0x255b69;_0x1913d4['model']=_[_0x294d('0x31')](db[_0x294d('0x5f')]['rawAttributes']);_0x1913d4[_0x294d('0x30')]=_[_0x294d('0x31')](_0x5daec9[_0x294d('0x30')]);_0x1913d4[_0x294d('0x3c')]=_[_0x294d('0x32')](_0x1913d4['model'],_0x1913d4['query']);_0x41b74b[_0x294d('0x33')]=_[_0x294d('0x32')](_0x1913d4[_0x294d('0x2f')],qs[_0x294d('0x34')](_0x5daec9[_0x294d('0x30')][_0x294d('0x34')]));_0x41b74b[_0x294d('0x33')]=_0x41b74b[_0x294d('0x33')][_0x294d('0x35')]?_0x41b74b[_0x294d('0x33')]:_0x1913d4[_0x294d('0x2f')];_0x41b74b['order']=qs[_0x294d('0x3a')](_0x5daec9[_0x294d('0x30')][_0x294d('0x3a')]);_0x41b74b[_0x294d('0x3b')]=qs[_0x294d('0x3c')](_[_0x294d('0x3d')](_0x5daec9['query'],_0x1913d4[_0x294d('0x3c')]));if(_0x5daec9['query'][_0x294d('0x3e')]){_0x41b74b[_0x294d('0x3b')]=_[_0x294d('0x3f')](_0x41b74b['where'],{'$or':_[_0x294d('0x29')](_0x41b74b[_0x294d('0x33')],function(_0x2cf58e){var _0x3ce06f={};_0x3ce06f[_0x2cf58e]={'$like':'%'+_0x5daec9[_0x294d('0x30')]['filter']+'%'};return _0x3ce06f;})});}_0x41b74b=_[_0x294d('0x3f')]({},_0x41b74b,_0x5daec9['options']);return _0x38d137[_0x294d('0x8b')](_0x41b74b);}})[_0x294d('0x21')](function(_0x5d2f16){if(_0x5d2f16){_0x43ac59=_0x5d2f16[_0x294d('0x35')];if(!_0x5daec9['query'][_0x294d('0x36')]('nolimit')){_0x41b74b[_0x294d('0x38')]=qs[_0x294d('0x38')](_0x5daec9['query'][_0x294d('0x38')]);_0x41b74b[_0x294d('0x1b')]=qs['offset'](_0x5daec9[_0x294d('0x30')][_0x294d('0x1b')]);}return _0x38d137[_0x294d('0x8b')](_0x41b74b);}})[_0x294d('0x21')](function(_0x13d552){if(_0x13d552){return _0x13d552?{'count':_0x43ac59,'rows':_0x13d552}:null;}})['then'](respondWithResult(_0x37c592,null))[_0x294d('0x45')](handleError(_0x37c592,null));};exports[_0x294d('0x8c')]=function(_0x286821,_0x589dfb,_0x556905){var _0x1139a3,_0x58c704;var _0x362363=[];var _0x52af8a=moment()[_0x294d('0x8d')](_0x294d('0x8e'));return db[_0x294d('0x2a')]['find']({'where':{'id':_0x286821['params']['id']}})[_0x294d('0x21')](handleEntityNotFound(_0x589dfb,null))[_0x294d('0x21')](function(_0x3b6df3){if(_0x3b6df3){_0x58c704=_0x3b6df3;return _0x3b6df3[_0x294d('0x8c')](_0x286821[_0x294d('0x49')][_0x294d('0x62')],_[_0x294d('0x52')](_0x286821[_0x294d('0x49')],[_0x294d('0x62'),'id'])||{});}return null;})['spread'](function(_0xf41de7){var _0x27ae41;var _0x33d377;_0x1139a3=_0xf41de7||[];var _0x6025bf=[];if(_0xf41de7){for(var _0x3a32a1=0x0;_0x3a32a1<_0xf41de7[_0x294d('0x35')];_0x3a32a1+=0x1){var _0x3f7738=_0xf41de7[_0x3a32a1][_0x294d('0x23')]({'plain':!![]});_0x27ae41=squel[_0x294d('0x7a')]()[_0x294d('0x7b')](_0x294d('0x8f'))[_0x294d('0x66')]([_0x294d('0x6c'),_0x294d('0x68'),_0x294d('0x69'),_0x294d('0x59'),_0x294d('0x53'),_0x294d('0x54')],squel[_0x294d('0x6a')]()[_0x294d('0x6b')](_0x294d('0x6c'),_0x294d('0x6c'))['field']('id',_0x294d('0x68'))[_0x294d('0x6b')](_0x3f7738[_0x294d('0x6e')][_0x294d('0x6f')](),'ListId')[_0x294d('0x6b')](_0x286821['params']['id'][_0x294d('0x6f')](),'CampaignId')[_0x294d('0x6b')](_0x294d('0x6d'),_0x294d('0x53'))[_0x294d('0x6b')]('NOW()',_0x294d('0x54'))[_0x294d('0x70')](_0x294d('0x71'))[_0x294d('0x3b')](_0x294d('0x7c'))[_0x294d('0x3b')](_0x294d('0x72'),_0x3f7738[_0x294d('0x6e')][_0x294d('0x6f')]())[_0x294d('0x3b')](_0x294d('0x73')))[_0x294d('0x6f')]();_0x6025bf[_0x294d('0x87')](db[_0x294d('0x88')][_0x294d('0x30')](_0x27ae41));}return BPromise[_0x294d('0x89')](_0x6025bf);}})[_0x294d('0x21')](function(){return _0x1139a3;})[_0x294d('0x21')](respondWithResult(_0x589dfb,null))[_0x294d('0x45')](handleError(_0x589dfb,null));};exports['removeBlackLists']=function(_0x4c4e30,_0x371866,_0x101a86){return db['Campaign'][_0x294d('0x47')]({'where':{'id':_0x4c4e30[_0x294d('0x46')]['id']}})[_0x294d('0x21')](handleEntityNotFound(_0x371866,null))[_0x294d('0x21')](function(_0x2fcb95){if(_0x2fcb95){return _0x2fcb95[_0x294d('0x90')](_0x4c4e30[_0x294d('0x30')][_0x294d('0x62')]);}})[_0x294d('0x21')](function(_0xf937c2){if(_0xf937c2){return db[_0x294d('0x5e')][_0x294d('0x22')]({'where':{'ListId':_0x4c4e30[_0x294d('0x30')][_0x294d('0x62')],'CampaignId':_0x4c4e30['params']['id']}})[_0x294d('0x21')](function(){return _0xf937c2;});}})[_0x294d('0x21')](respondWithStatusCode(_0x371866,null))[_0x294d('0x45')](handleError(_0x371866,null));}; \ No newline at end of file +var _0x7fee=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','Campaign','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','userProfileId','getHoppers','findOne','CmHopper','include','findAll','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','select','field','phone','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','CmList','addBlackLists','format','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x7fee[_0x45d3f0];return _0x314b79;};'use strict';var emlformat=require(_0xe7fe('0x0'));var rimraf=require(_0xe7fe('0x1'));var zipdir=require(_0xe7fe('0x2'));var jsonpatch=require(_0xe7fe('0x3'));var rp=require(_0xe7fe('0x4'));var moment=require(_0xe7fe('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe7fe('0x6'));var util=require(_0xe7fe('0x7'));var path=require(_0xe7fe('0x8'));var sox=require('sox');var csv=require(_0xe7fe('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe7fe('0xa'));var _=require(_0xe7fe('0xb'));var squel=require(_0xe7fe('0xc'));var crypto=require(_0xe7fe('0xd'));var jsforce=require(_0xe7fe('0xe'));var deskjs=require(_0xe7fe('0xf'));var toCsv=require(_0xe7fe('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fe('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe7fe('0x11'));var hardwareService=require(_0xe7fe('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe7fe('0x13'));var config=require(_0xe7fe('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7fe('0x15'))['db'];function respondWithStatusCode(_0x3d84d8,_0x285c35){_0x285c35=_0x285c35||0xcc;return function(_0x4a6aa2){if(_0x4a6aa2){return _0x3d84d8[_0xe7fe('0x16')](_0x285c35);}return _0x3d84d8[_0xe7fe('0x17')](_0x285c35)[_0xe7fe('0x18')]();};}function respondWithResult(_0x56cf5c,_0x32f8b3){_0x32f8b3=_0x32f8b3||0xc8;return function(_0x29e745){if(_0x29e745){return _0x56cf5c[_0xe7fe('0x17')](_0x32f8b3)[_0xe7fe('0x19')](_0x29e745);}};}function respondWithFilteredResult(_0x30500a,_0x31be26){return function(_0x14172e){if(_0x14172e){var _0x1647fd=typeof _0x31be26[_0xe7fe('0x1a')]===_0xe7fe('0x1b')&&typeof _0x31be26[_0xe7fe('0x1c')]===_0xe7fe('0x1b');var _0x382093=_0x14172e[_0xe7fe('0x1d')];var _0x141908=_0x1647fd?0x0:_0x31be26[_0xe7fe('0x1a')];var _0x5e16a8=_0x1647fd?_0x14172e[_0xe7fe('0x1d')]:_0x31be26[_0xe7fe('0x1a')]+_0x31be26[_0xe7fe('0x1c')];var _0x331af3;if(_0x5e16a8>=_0x382093){_0x5e16a8=_0x382093;_0x331af3=0xc8;}else{_0x331af3=0xce;}_0x30500a[_0xe7fe('0x17')](_0x331af3);return _0x30500a['set'](_0xe7fe('0x1e'),_0x141908+'-'+_0x5e16a8+'/'+_0x382093)[_0xe7fe('0x19')](_0x14172e);}return null;};}function patchUpdates(_0x2cbe81){return function(_0x584779){try{jsonpatch[_0xe7fe('0x1f')](_0x584779,_0x2cbe81,!![]);}catch(_0x4fe8b7){return BPromise[_0xe7fe('0x20')](_0x4fe8b7);}return _0x584779['save']();};}function saveUpdates(_0x4cb927,_0x545b49){return function(_0x23d8b8){if(_0x23d8b8){return _0x23d8b8[_0xe7fe('0x21')](_0x4cb927)[_0xe7fe('0x22')](function(_0x2e2d5d){return _0x2e2d5d;});}return null;};}function removeEntity(_0x14e73b,_0x276a00){return function(_0x18b0e9){if(_0x18b0e9){return _0x18b0e9[_0xe7fe('0x23')]()[_0xe7fe('0x22')](function(){var _0x239991=_0x18b0e9[_0xe7fe('0x24')]({'plain':!![]});var _0x3256be=_0xe7fe('0x25');return db[_0xe7fe('0x26')][_0xe7fe('0x23')]({'where':{'type':_0x3256be,'resourceId':_0x239991['id']}})[_0xe7fe('0x22')](function(){return _0x18b0e9;});})[_0xe7fe('0x22')](function(){_0x14e73b[_0xe7fe('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d230d,_0x536bd9){return function(_0x28d237){if(!_0x28d237){_0x1d230d[_0xe7fe('0x16')](0x194);}return _0x28d237;};}function handleError(_0x5a8650,_0x48fa94){_0x48fa94=_0x48fa94||0x1f4;return function(_0x2adb68){logger[_0xe7fe('0x27')](_0x2adb68[_0xe7fe('0x28')]);if(_0x2adb68[_0xe7fe('0x29')]){delete _0x2adb68[_0xe7fe('0x29')];}_0x5a8650['status'](_0x48fa94)[_0xe7fe('0x2a')](_0x2adb68);};}exports[_0xe7fe('0x2b')]=function(_0x48962d,_0x4dcd4a){var _0x1de7c2={},_0x3d575a={},_0x4a92e7={'count':0x0,'rows':[]};var _0x58267f=_[_0xe7fe('0x2c')](db['Campaign'][_0xe7fe('0x2d')],function(_0x2b5010){return{'name':_0x2b5010['fieldName'],'type':_0x2b5010['type'][_0xe7fe('0x2e')]};});_0x3d575a[_0xe7fe('0x2f')]=_[_0xe7fe('0x2c')](_0x58267f,_0xe7fe('0x29'));_0x3d575a[_0xe7fe('0x30')]=_[_0xe7fe('0x31')](_0x48962d[_0xe7fe('0x30')]);_0x3d575a[_0xe7fe('0x32')]=_[_0xe7fe('0x33')](_0x3d575a[_0xe7fe('0x2f')],_0x3d575a['query']);_0x1de7c2[_0xe7fe('0x34')]=_[_0xe7fe('0x33')](_0x3d575a[_0xe7fe('0x2f')],qs[_0xe7fe('0x35')](_0x48962d[_0xe7fe('0x30')][_0xe7fe('0x35')]));_0x1de7c2[_0xe7fe('0x34')]=_0x1de7c2[_0xe7fe('0x34')][_0xe7fe('0x36')]?_0x1de7c2[_0xe7fe('0x34')]:_0x3d575a[_0xe7fe('0x2f')];if(!_0x48962d[_0xe7fe('0x30')][_0xe7fe('0x37')](_0xe7fe('0x38'))){_0x1de7c2['limit']=qs['limit'](_0x48962d[_0xe7fe('0x30')][_0xe7fe('0x1c')]);_0x1de7c2[_0xe7fe('0x1a')]=qs[_0xe7fe('0x1a')](_0x48962d['query']['offset']);}_0x1de7c2[_0xe7fe('0x39')]=qs[_0xe7fe('0x3a')](_0x48962d['query'][_0xe7fe('0x3a')]);_0x1de7c2[_0xe7fe('0x3b')]=qs[_0xe7fe('0x32')](_[_0xe7fe('0x3c')](_0x48962d['query'],_0x3d575a[_0xe7fe('0x32')]),_0x58267f);if(_0x48962d[_0xe7fe('0x30')][_0xe7fe('0x3d')]){_0x1de7c2['where']=_[_0xe7fe('0x3e')](_0x1de7c2['where'],{'$or':_[_0xe7fe('0x2c')](_0x58267f,function(_0x1320d){if(_0x1320d[_0xe7fe('0x3f')]!=='VIRTUAL'){var _0x3e1561={};_0x3e1561[_0x1320d[_0xe7fe('0x29')]]={'$like':'%'+_0x48962d[_0xe7fe('0x30')][_0xe7fe('0x3d')]+'%'};return _0x3e1561;}})});}_0x1de7c2=_[_0xe7fe('0x3e')]({},_0x1de7c2,_0x48962d[_0xe7fe('0x40')]);var _0xb99d71={'where':_0x1de7c2[_0xe7fe('0x3b')]};return db['Campaign'][_0xe7fe('0x1d')](_0xb99d71)['then'](function(_0xd4f26d){_0x4a92e7[_0xe7fe('0x1d')]=_0xd4f26d;if(_0x48962d[_0xe7fe('0x30')]['includeAll']){_0x1de7c2['include']=[{'all':!![]}];}return db[_0xe7fe('0x41')]['findAll'](_0x1de7c2);})[_0xe7fe('0x22')](function(_0x932b41){_0x4a92e7[_0xe7fe('0x42')]=_0x932b41;return _0x4a92e7;})[_0xe7fe('0x22')](respondWithFilteredResult(_0x4dcd4a,_0x1de7c2))[_0xe7fe('0x43')](handleError(_0x4dcd4a,null));};exports[_0xe7fe('0x44')]=function(_0x1f26ac,_0x540766){var _0x300f73={'raw':![],'where':{'id':_0x1f26ac[_0xe7fe('0x45')]['id']}},_0x378383={};_0x378383[_0xe7fe('0x2f')]=_['keys'](db[_0xe7fe('0x41')][_0xe7fe('0x2d')]);_0x378383[_0xe7fe('0x30')]=_['keys'](_0x1f26ac[_0xe7fe('0x30')]);_0x378383[_0xe7fe('0x32')]=_[_0xe7fe('0x33')](_0x378383[_0xe7fe('0x2f')],_0x378383['query']);_0x300f73[_0xe7fe('0x34')]=_['intersection'](_0x378383['model'],qs[_0xe7fe('0x35')](_0x1f26ac[_0xe7fe('0x30')][_0xe7fe('0x35')]));_0x300f73['attributes']=_0x300f73[_0xe7fe('0x34')][_0xe7fe('0x36')]?_0x300f73[_0xe7fe('0x34')]:_0x378383['model'];if(_0x1f26ac[_0xe7fe('0x30')][_0xe7fe('0x46')]){_0x300f73['include']=[{'all':!![]}];}_0x300f73=_[_0xe7fe('0x3e')]({},_0x300f73,_0x1f26ac['options']);return db[_0xe7fe('0x41')][_0xe7fe('0x47')](_0x300f73)[_0xe7fe('0x22')](handleEntityNotFound(_0x540766,null))[_0xe7fe('0x22')](respondWithResult(_0x540766,null))[_0xe7fe('0x43')](handleError(_0x540766,null));};exports[_0xe7fe('0x48')]=function(_0xc87621,_0x3f8d80){return db[_0xe7fe('0x41')]['create'](_0xc87621[_0xe7fe('0x49')],{})['then'](function(_0xbfc0b0){var _0x41d07c=_0xc87621['user'][_0xe7fe('0x24')]({'plain':!![]});if(!_0x41d07c)throw new Error(_0xe7fe('0x4a'));if(_0x41d07c[_0xe7fe('0x4b')]===_0xe7fe('0x4c')){var _0x21b9b5=_0xbfc0b0['get']({'plain':!![]});var _0x3406f3='IvrCampaigns';return db[_0xe7fe('0x4d')]['find']({'where':{'name':_0x3406f3,'userProfileId':_0x41d07c['userProfileId']},'raw':!![]})[_0xe7fe('0x22')](function(_0x8b0a1a){if(_0x8b0a1a&&_0x8b0a1a[_0xe7fe('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x21b9b5[_0xe7fe('0x29')],'resourceId':_0x21b9b5['id'],'type':_0x8b0a1a['name'],'sectionId':_0x8b0a1a['id']},{})['then'](function(){return _0xbfc0b0;});}else{return _0xbfc0b0;}})[_0xe7fe('0x43')](function(_0x283995){logger[_0xe7fe('0x27')](_0xe7fe('0x4f'),_0x283995);throw _0x283995;});}return _0xbfc0b0;})[_0xe7fe('0x22')](respondWithResult(_0x3f8d80,0xc9))[_0xe7fe('0x43')](handleError(_0x3f8d80,null));};exports[_0xe7fe('0x50')]=function(_0x4b0c86,_0x35eb55){var _0x30616c={'where':{'id':_0x4b0c86[_0xe7fe('0x45')]['id']}},_0x179262={};_0x179262[_0xe7fe('0x2f')]=_['keys'](db[_0xe7fe('0x41')][_0xe7fe('0x2d')]);_0x30616c['attributes']=_[_0xe7fe('0x33')](_0x179262[_0xe7fe('0x2f')],qs[_0xe7fe('0x35')](_0x4b0c86[_0xe7fe('0x30')][_0xe7fe('0x35')]));_0x30616c[_0xe7fe('0x34')]=_0x30616c[_0xe7fe('0x34')][_0xe7fe('0x36')]?_0x30616c[_0xe7fe('0x34')]:_0x179262[_0xe7fe('0x2f')];if(_0x4b0c86['query'][_0xe7fe('0x46')]){_0x30616c['include']=[{'all':!![]}];}_0x30616c=_[_0xe7fe('0x3e')]({},_0x30616c,_0x4b0c86[_0xe7fe('0x40')]);return db[_0xe7fe('0x41')][_0xe7fe('0x47')](_0x30616c)[_0xe7fe('0x22')](handleEntityNotFound(_0x35eb55,null))[_0xe7fe('0x22')](function(_0xeee714){if(_0xeee714){var _0x526505=_0xeee714['get']({'plain':!![]});_0x526505=qs['omit'](_0x526505,['id',_0xe7fe('0x51'),_0xe7fe('0x52')]);_0x4b0c86[_0xe7fe('0x49')]=_[_0xe7fe('0x53')](_0x4b0c86[_0xe7fe('0x49')],['id','createdAt',_0xe7fe('0x52')]);return db[_0xe7fe('0x41')][_0xe7fe('0x48')](_['merge'](_0x526505,_0x4b0c86[_0xe7fe('0x49')]),{'include':_0x4b0c86['query'][_0xe7fe('0x46')]?[{'all':!![]}]:undefined})[_0xe7fe('0x22')](function(_0x1bbeb0){var _0x102cdb=_0x4b0c86[_0xe7fe('0x4c')]['get']({'plain':!![]});if(!_0x102cdb)throw new Error(_0xe7fe('0x4a'));if(_0x102cdb[_0xe7fe('0x4b')]===_0xe7fe('0x4c')){var _0x168de1=_0x1bbeb0[_0xe7fe('0x24')]({'plain':!![]});var _0x400aa8=_0xe7fe('0x25');return db['UserProfileSection'][_0xe7fe('0x47')]({'where':{'name':_0x400aa8,'userProfileId':_0x102cdb[_0xe7fe('0x54')]},'raw':!![]})[_0xe7fe('0x22')](function(_0xb4b7ea){if(_0xb4b7ea&&_0xb4b7ea[_0xe7fe('0x4e')]===0x0){return db[_0xe7fe('0x26')][_0xe7fe('0x48')]({'name':_0x168de1['name'],'resourceId':_0x168de1['id'],'type':_0xb4b7ea[_0xe7fe('0x29')],'sectionId':_0xb4b7ea['id']},{})['then'](function(){return _0x1bbeb0;});}else{return _0x1bbeb0;}})[_0xe7fe('0x43')](function(_0x189346){logger['error'](_0xe7fe('0x4f'),_0x189346);throw _0x189346;});}return _0x1bbeb0;});}})[_0xe7fe('0x22')](respondWithResult(_0x35eb55,0xc9))[_0xe7fe('0x43')](handleError(_0x35eb55,null));};exports[_0xe7fe('0x21')]=function(_0xe983b5,_0x2ea623){if(_0xe983b5['body']['id']){delete _0xe983b5[_0xe7fe('0x49')]['id'];}return db[_0xe7fe('0x41')]['find']({'where':{'id':_0xe983b5[_0xe7fe('0x45')]['id']}})[_0xe7fe('0x22')](handleEntityNotFound(_0x2ea623,null))['then'](saveUpdates(_0xe983b5[_0xe7fe('0x49')],null))[_0xe7fe('0x22')](respondWithResult(_0x2ea623,null))['catch'](handleError(_0x2ea623,null));};exports[_0xe7fe('0x23')]=function(_0x3d3b15,_0xda96b1){return db['Campaign'][_0xe7fe('0x47')]({'where':{'id':_0x3d3b15['params']['id']}})['then'](handleEntityNotFound(_0xda96b1,null))[_0xe7fe('0x22')](removeEntity(_0xda96b1,null))[_0xe7fe('0x43')](handleError(_0xda96b1,null));};exports[_0xe7fe('0x55')]=function(_0x5580a6,_0xe7e0c9,_0x5b7df8){var _0x40ed2c={'raw':!![],'where':{}};var _0x559c3b={};var _0x58a17c={'count':0x0,'rows':[]};return db[_0xe7fe('0x41')][_0xe7fe('0x56')]({'where':{'id':_0x5580a6[_0xe7fe('0x45')]['id']}})[_0xe7fe('0x22')](handleEntityNotFound(_0xe7e0c9,null))[_0xe7fe('0x22')](function(_0x3ddc10){if(_0x3ddc10){_0x559c3b[_0xe7fe('0x2f')]=_['keys'](db['CmHopper'][_0xe7fe('0x2d')]);_0x559c3b['query']=_[_0xe7fe('0x31')](_0x5580a6[_0xe7fe('0x30')]);_0x559c3b[_0xe7fe('0x32')]=_[_0xe7fe('0x33')](_0x559c3b[_0xe7fe('0x2f')],_0x559c3b['query']);_0x40ed2c[_0xe7fe('0x34')]=_[_0xe7fe('0x33')](_0x559c3b[_0xe7fe('0x2f')],qs[_0xe7fe('0x35')](_0x5580a6[_0xe7fe('0x30')][_0xe7fe('0x35')]));_0x40ed2c[_0xe7fe('0x34')]=_0x40ed2c[_0xe7fe('0x34')][_0xe7fe('0x36')]?_0x40ed2c[_0xe7fe('0x34')]:_0x559c3b[_0xe7fe('0x2f')];if(!_0x5580a6[_0xe7fe('0x30')][_0xe7fe('0x37')](_0xe7fe('0x38'))){_0x40ed2c[_0xe7fe('0x1c')]=qs[_0xe7fe('0x1c')](_0x5580a6['query']['limit']);_0x40ed2c['offset']=qs['offset'](_0x5580a6[_0xe7fe('0x30')][_0xe7fe('0x1a')]);}_0x40ed2c[_0xe7fe('0x39')]=qs['sort'](_0x5580a6[_0xe7fe('0x30')]['sort']);_0x40ed2c[_0xe7fe('0x3b')]=qs[_0xe7fe('0x32')](_[_0xe7fe('0x3c')](_0x5580a6[_0xe7fe('0x30')],_0x559c3b[_0xe7fe('0x32')]));_0x40ed2c[_0xe7fe('0x3b')]['CampaignId']=_0x3ddc10['id'];if(_0x5580a6[_0xe7fe('0x30')]['filter']){_0x40ed2c['where']=_['merge'](_0x40ed2c[_0xe7fe('0x3b')],{'$or':_['map'](_0x40ed2c['attributes'],function(_0x528216){var _0x5acdba={};_0x5acdba[_0x528216]={'$like':'%'+_0x5580a6['query'][_0xe7fe('0x3d')]+'%'};return _0x5acdba;})});}_0x40ed2c=_['merge']({},_0x40ed2c,_0x5580a6['options']);return db[_0xe7fe('0x57')][_0xe7fe('0x1d')]({'where':_0x40ed2c[_0xe7fe('0x3b')]})[_0xe7fe('0x22')](function(_0x3f6b77){_0x58a17c[_0xe7fe('0x1d')]=_0x3f6b77;if(_0x5580a6[_0xe7fe('0x30')][_0xe7fe('0x46')]){_0x40ed2c[_0xe7fe('0x58')]=[{'all':!![]}];}return db[_0xe7fe('0x57')][_0xe7fe('0x59')](_0x40ed2c);})[_0xe7fe('0x22')](function(_0x11a06b){_0x58a17c[_0xe7fe('0x42')]=_0x11a06b;return _0x58a17c;});}})[_0xe7fe('0x22')](respondWithFilteredResult(_0xe7e0c9,_0x40ed2c))[_0xe7fe('0x43')](handleError(_0xe7e0c9,null));};exports[_0xe7fe('0x5a')]=function(_0x4466a9,_0x38346b,_0x2a19e8){var _0x14dc72={'raw':!![],'where':{}};var _0x5ad77e={};var _0x27b809={'count':0x0,'rows':[]};return db[_0xe7fe('0x41')][_0xe7fe('0x56')]({'where':{'id':_0x4466a9[_0xe7fe('0x45')]['id']}})[_0xe7fe('0x22')](handleEntityNotFound(_0x38346b,null))['then'](function(_0x4a63d2){if(_0x4a63d2){_0x5ad77e[_0xe7fe('0x2f')]=_['keys'](db[_0xe7fe('0x5b')][_0xe7fe('0x2d')]);_0x5ad77e['query']=_[_0xe7fe('0x31')](_0x4466a9[_0xe7fe('0x30')]);_0x5ad77e[_0xe7fe('0x32')]=_[_0xe7fe('0x33')](_0x5ad77e['model'],_0x5ad77e['query']);_0x14dc72[_0xe7fe('0x34')]=_[_0xe7fe('0x33')](_0x5ad77e[_0xe7fe('0x2f')],qs[_0xe7fe('0x35')](_0x4466a9[_0xe7fe('0x30')]['fields']));_0x14dc72[_0xe7fe('0x34')]=_0x14dc72['attributes'][_0xe7fe('0x36')]?_0x14dc72[_0xe7fe('0x34')]:_0x5ad77e[_0xe7fe('0x2f')];if(!_0x4466a9['query'][_0xe7fe('0x37')]('nolimit')){_0x14dc72[_0xe7fe('0x1c')]=qs[_0xe7fe('0x1c')](_0x4466a9['query'][_0xe7fe('0x1c')]);_0x14dc72[_0xe7fe('0x1a')]=qs[_0xe7fe('0x1a')](_0x4466a9['query'][_0xe7fe('0x1a')]);}_0x14dc72[_0xe7fe('0x39')]=qs[_0xe7fe('0x3a')](_0x4466a9[_0xe7fe('0x30')]['sort']);_0x14dc72[_0xe7fe('0x3b')]=qs[_0xe7fe('0x32')](_[_0xe7fe('0x3c')](_0x4466a9['query'],_0x5ad77e[_0xe7fe('0x32')]));_0x14dc72[_0xe7fe('0x3b')][_0xe7fe('0x5c')]=_0x4a63d2['id'];if(_0x4466a9[_0xe7fe('0x30')]['filter']){_0x14dc72[_0xe7fe('0x3b')]=_['merge'](_0x14dc72[_0xe7fe('0x3b')],{'$or':_[_0xe7fe('0x2c')](_0x14dc72[_0xe7fe('0x34')],function(_0x49b670){var _0x374261={};_0x374261[_0x49b670]={'$like':'%'+_0x4466a9['query']['filter']+'%'};return _0x374261;})});}_0x14dc72=_['merge']({},_0x14dc72,_0x4466a9[_0xe7fe('0x40')]);return db['CmHopperHistory'][_0xe7fe('0x1d')]({'where':_0x14dc72[_0xe7fe('0x3b')]})['then'](function(_0x1f4a3f){_0x27b809[_0xe7fe('0x1d')]=_0x1f4a3f;if(_0x4466a9[_0xe7fe('0x30')][_0xe7fe('0x46')]){_0x14dc72['include']=[{'all':!![]}];}return db[_0xe7fe('0x5b')][_0xe7fe('0x59')](_0x14dc72);})[_0xe7fe('0x22')](function(_0x1fa01c){_0x27b809[_0xe7fe('0x42')]=_0x1fa01c;return _0x27b809;});}})[_0xe7fe('0x22')](respondWithFilteredResult(_0x38346b,_0x14dc72))[_0xe7fe('0x43')](handleError(_0x38346b,null));};exports[_0xe7fe('0x5d')]=function(_0x3e2c81,_0x5258bc,_0x57b8a9){var _0x24e470={'raw':!![],'where':{}};var _0x4b3987={};var _0x3ea226={'count':0x0,'rows':[]};return db[_0xe7fe('0x41')]['findOne']({'where':{'id':_0x3e2c81[_0xe7fe('0x45')]['id']}})['then'](handleEntityNotFound(_0x5258bc,null))['then'](function(_0x1a789a){if(_0x1a789a){_0x4b3987[_0xe7fe('0x2f')]=_[_0xe7fe('0x31')](db[_0xe7fe('0x5e')][_0xe7fe('0x2d')]);_0x4b3987[_0xe7fe('0x30')]=_[_0xe7fe('0x31')](_0x3e2c81[_0xe7fe('0x30')]);_0x4b3987[_0xe7fe('0x32')]=_[_0xe7fe('0x33')](_0x4b3987['model'],_0x4b3987['query']);_0x24e470[_0xe7fe('0x34')]=_[_0xe7fe('0x33')](_0x4b3987[_0xe7fe('0x2f')],qs['fields'](_0x3e2c81[_0xe7fe('0x30')][_0xe7fe('0x35')]));_0x24e470['attributes']=_0x24e470[_0xe7fe('0x34')][_0xe7fe('0x36')]?_0x24e470[_0xe7fe('0x34')]:_0x4b3987[_0xe7fe('0x2f')];if(!_0x3e2c81[_0xe7fe('0x30')]['hasOwnProperty'](_0xe7fe('0x38'))){_0x24e470[_0xe7fe('0x1c')]=qs[_0xe7fe('0x1c')](_0x3e2c81[_0xe7fe('0x30')][_0xe7fe('0x1c')]);_0x24e470[_0xe7fe('0x1a')]=qs[_0xe7fe('0x1a')](_0x3e2c81[_0xe7fe('0x30')][_0xe7fe('0x1a')]);}_0x24e470[_0xe7fe('0x39')]=qs['sort'](_0x3e2c81['query'][_0xe7fe('0x3a')]);_0x24e470[_0xe7fe('0x3b')]=qs[_0xe7fe('0x32')](_['pick'](_0x3e2c81[_0xe7fe('0x30')],_0x4b3987[_0xe7fe('0x32')]));_0x24e470['where'][_0xe7fe('0x5c')]=_0x1a789a['id'];if(_0x3e2c81['query']['filter']){_0x24e470['where']=_['merge'](_0x24e470[_0xe7fe('0x3b')],{'$or':_[_0xe7fe('0x2c')](_0x24e470[_0xe7fe('0x34')],function(_0x45b4a1){var _0x1ac7ef={};_0x1ac7ef[_0x45b4a1]={'$like':'%'+_0x3e2c81['query'][_0xe7fe('0x3d')]+'%'};return _0x1ac7ef;})});}_0x24e470=_[_0xe7fe('0x3e')]({},_0x24e470,_0x3e2c81[_0xe7fe('0x40')]);return db[_0xe7fe('0x5e')][_0xe7fe('0x1d')]({'where':_0x24e470[_0xe7fe('0x3b')]})[_0xe7fe('0x22')](function(_0x163d52){_0x3ea226[_0xe7fe('0x1d')]=_0x163d52;if(_0x3e2c81[_0xe7fe('0x30')][_0xe7fe('0x46')]){_0x24e470['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x24e470);})[_0xe7fe('0x22')](function(_0x5d4cd7){_0x3ea226[_0xe7fe('0x42')]=_0x5d4cd7;return _0x3ea226;});}})[_0xe7fe('0x22')](respondWithFilteredResult(_0x5258bc,_0x24e470))[_0xe7fe('0x43')](handleError(_0x5258bc,null));};exports[_0xe7fe('0x5f')]=function(_0x526e0a,_0x30da35,_0x10f312){var _0x3553bc={'raw':!![],'where':{}};var _0x2746b5={};var _0x895067={'count':0x0,'rows':[]};return db[_0xe7fe('0x41')]['findOne']({'where':{'id':_0x526e0a[_0xe7fe('0x45')]['id']}})[_0xe7fe('0x22')](handleEntityNotFound(_0x30da35,null))[_0xe7fe('0x22')](function(_0x1d3d9e){if(_0x1d3d9e){_0x2746b5['model']=_[_0xe7fe('0x31')](db[_0xe7fe('0x60')][_0xe7fe('0x2d')]);_0x2746b5['query']=_['keys'](_0x526e0a[_0xe7fe('0x30')]);_0x2746b5[_0xe7fe('0x32')]=_[_0xe7fe('0x33')](_0x2746b5[_0xe7fe('0x2f')],_0x2746b5[_0xe7fe('0x30')]);_0x3553bc['attributes']=_[_0xe7fe('0x33')](_0x2746b5[_0xe7fe('0x2f')],qs[_0xe7fe('0x35')](_0x526e0a[_0xe7fe('0x30')][_0xe7fe('0x35')]));_0x3553bc[_0xe7fe('0x34')]=_0x3553bc[_0xe7fe('0x34')]['length']?_0x3553bc[_0xe7fe('0x34')]:_0x2746b5[_0xe7fe('0x2f')];if(!_0x526e0a[_0xe7fe('0x30')][_0xe7fe('0x37')]('nolimit')){_0x3553bc[_0xe7fe('0x1c')]=qs[_0xe7fe('0x1c')](_0x526e0a[_0xe7fe('0x30')][_0xe7fe('0x1c')]);_0x3553bc['offset']=qs[_0xe7fe('0x1a')](_0x526e0a[_0xe7fe('0x30')][_0xe7fe('0x1a')]);}_0x3553bc[_0xe7fe('0x39')]=qs[_0xe7fe('0x3a')](_0x526e0a[_0xe7fe('0x30')][_0xe7fe('0x3a')]);_0x3553bc['where']=qs[_0xe7fe('0x32')](_[_0xe7fe('0x3c')](_0x526e0a[_0xe7fe('0x30')],_0x2746b5[_0xe7fe('0x32')]));_0x3553bc['where']['CampaignId']=_0x1d3d9e['id'];if(_0x526e0a[_0xe7fe('0x30')]['filter']){_0x3553bc[_0xe7fe('0x3b')]=_[_0xe7fe('0x3e')](_0x3553bc[_0xe7fe('0x3b')],{'$or':_['map'](_0x3553bc[_0xe7fe('0x34')],function(_0x4636a0){var _0xfe3b4d={};_0xfe3b4d[_0x4636a0]={'$like':'%'+_0x526e0a[_0xe7fe('0x30')][_0xe7fe('0x3d')]+'%'};return _0xfe3b4d;})});}_0x3553bc=_[_0xe7fe('0x3e')]({},_0x3553bc,_0x526e0a[_0xe7fe('0x40')]);return db['CmHopperBlack'][_0xe7fe('0x1d')]({'where':_0x3553bc['where']})[_0xe7fe('0x22')](function(_0x171fea){_0x895067[_0xe7fe('0x1d')]=_0x171fea;if(_0x526e0a[_0xe7fe('0x30')][_0xe7fe('0x46')]){_0x3553bc[_0xe7fe('0x58')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x3553bc);})['then'](function(_0x153f69){_0x895067['rows']=_0x153f69;return _0x895067;});}})[_0xe7fe('0x22')](respondWithFilteredResult(_0x30da35,_0x3553bc))[_0xe7fe('0x43')](handleError(_0x30da35,null));};exports[_0xe7fe('0x61')]=function(_0x21914a,_0x4d1f32,_0x55f98a){var _0x46f817={};var _0x19b1d6={};var _0xba9b4d;var _0x2df1bd;return db['Campaign'][_0xe7fe('0x56')]({'where':{'id':_0x21914a['params']['id']}})[_0xe7fe('0x22')](handleEntityNotFound(_0x4d1f32,null))[_0xe7fe('0x22')](function(_0x5b6dbb){if(_0x5b6dbb){_0xba9b4d=_0x5b6dbb;_0x19b1d6[_0xe7fe('0x2f')]=_[_0xe7fe('0x31')](db['CmList'][_0xe7fe('0x2d')]);_0x19b1d6['query']=_[_0xe7fe('0x31')](_0x21914a[_0xe7fe('0x30')]);_0x19b1d6[_0xe7fe('0x32')]=_[_0xe7fe('0x33')](_0x19b1d6[_0xe7fe('0x2f')],_0x19b1d6[_0xe7fe('0x30')]);_0x46f817[_0xe7fe('0x34')]=_[_0xe7fe('0x33')](_0x19b1d6['model'],qs[_0xe7fe('0x35')](_0x21914a['query'][_0xe7fe('0x35')]));_0x46f817['attributes']=_0x46f817[_0xe7fe('0x34')][_0xe7fe('0x36')]?_0x46f817[_0xe7fe('0x34')]:_0x19b1d6[_0xe7fe('0x2f')];_0x46f817['order']=qs['sort'](_0x21914a[_0xe7fe('0x30')]['sort']);_0x46f817[_0xe7fe('0x3b')]=qs[_0xe7fe('0x32')](_[_0xe7fe('0x3c')](_0x21914a[_0xe7fe('0x30')],_0x19b1d6[_0xe7fe('0x32')]));if(_0x21914a[_0xe7fe('0x30')][_0xe7fe('0x3d')]){_0x46f817[_0xe7fe('0x3b')]=_[_0xe7fe('0x3e')](_0x46f817['where'],{'$or':_[_0xe7fe('0x2c')](_0x46f817[_0xe7fe('0x34')],function(_0x355435){var _0x2d0d79={};_0x2d0d79[_0x355435]={'$like':'%'+_0x21914a[_0xe7fe('0x30')]['filter']+'%'};return _0x2d0d79;})});}_0x46f817=_['merge']({},_0x46f817,_0x21914a['options']);return _0xba9b4d[_0xe7fe('0x61')](_0x46f817);}})[_0xe7fe('0x22')](function(_0x514418){if(_0x514418){_0x2df1bd=_0x514418[_0xe7fe('0x36')];if(!_0x21914a[_0xe7fe('0x30')]['hasOwnProperty'](_0xe7fe('0x38'))){_0x46f817[_0xe7fe('0x1c')]=qs[_0xe7fe('0x1c')](_0x21914a[_0xe7fe('0x30')][_0xe7fe('0x1c')]);_0x46f817['offset']=qs[_0xe7fe('0x1a')](_0x21914a[_0xe7fe('0x30')][_0xe7fe('0x1a')]);}return _0xba9b4d[_0xe7fe('0x61')](_0x46f817);}})[_0xe7fe('0x22')](function(_0x3c1cb1){if(_0x3c1cb1){return _0x3c1cb1?{'count':_0x2df1bd,'rows':_0x3c1cb1}:null;}})[_0xe7fe('0x22')](respondWithResult(_0x4d1f32,null))['catch'](handleError(_0x4d1f32,null));};exports[_0xe7fe('0x62')]=function(_0x119953,_0x22db3e,_0x1850b1){var _0x228893,_0xf91fcd;var _0x584a23=[];var _0x44a79f=moment()['format'](_0xe7fe('0x63'));return db[_0xe7fe('0x41')][_0xe7fe('0x47')]({'where':{'id':_0x119953['params']['id']}})[_0xe7fe('0x22')](handleEntityNotFound(_0x22db3e,null))['then'](function(_0x1f70f9){if(_0x1f70f9){_0xf91fcd=_0x1f70f9;return _0x1f70f9['addLists'](_0x119953[_0xe7fe('0x49')]['ids'],_['omit'](_0x119953[_0xe7fe('0x49')],[_0xe7fe('0x64'),'id'])||{});}return null;})['spread'](function(_0x595afb){var _0xc92a35;var _0x4e023c;_0x228893=_0x595afb||[];var _0xaa9e45=[];if(_0x595afb){for(var _0x1e698b=0x0;_0x1e698b<_0x595afb[_0xe7fe('0x36')];_0x1e698b+=0x1){var _0x5c8b06=_0x595afb[_0x1e698b][_0xe7fe('0x24')]({'plain':!![]});_0xf91fcd[_0xe7fe('0x65')]=_0x119953[_0xe7fe('0x49')][_0xe7fe('0x65')]?_0x119953[_0xe7fe('0x49')]['dialCheckDuplicateType']:_0xf91fcd[_0xe7fe('0x65')];switch(_0xf91fcd[_0xe7fe('0x65')]){case'always':_0xc92a35=squel[_0xe7fe('0x66')]()[_0xe7fe('0x67')](_0xe7fe('0x68'))[_0xe7fe('0x69')](['phone',_0xe7fe('0x6a'),'ContactId',_0xe7fe('0x6b'),_0xe7fe('0x5c'),_0xe7fe('0x51'),_0xe7fe('0x52')],squel[_0xe7fe('0x6c')]()[_0xe7fe('0x6d')](_0xe7fe('0x6e'),'phone')[_0xe7fe('0x6d')](_0xe7fe('0x6f'),'scheduledAt')[_0xe7fe('0x6d')]('id',_0xe7fe('0x70'))[_0xe7fe('0x6d')](_0x5c8b06[_0xe7fe('0x71')][_0xe7fe('0x72')](),_0xe7fe('0x6b'))[_0xe7fe('0x6d')](_0x119953['params']['id'][_0xe7fe('0x72')](),_0xe7fe('0x5c'))[_0xe7fe('0x6d')]('\x27'+_0x44a79f+'\x27',_0xe7fe('0x51'))['field']('\x27'+_0x44a79f+'\x27','updatedAt')[_0xe7fe('0x73')](_0xe7fe('0x74'))[_0xe7fe('0x3b')](_0xe7fe('0x75'))[_0xe7fe('0x3b')]('ListId\x20=\x20?',_0x5c8b06[_0xe7fe('0x71')]['toString']())[_0xe7fe('0x3b')](_0xe7fe('0x76'))[_0xe7fe('0x3b')](_0xe7fe('0x77'),squel[_0xe7fe('0x6c')]()['field'](_0xe7fe('0x78'))[_0xe7fe('0x73')](_0xe7fe('0x79'))[_0xe7fe('0x3b')]('CampaignId\x20=\x20?',_0x119953[_0xe7fe('0x45')]['id']['toString']()))[_0xe7fe('0x3b')](_0xe7fe('0x77'),squel[_0xe7fe('0x6c')]()[_0xe7fe('0x6d')](_0xe7fe('0x7a'))[_0xe7fe('0x73')](_0xe7fe('0x68'))[_0xe7fe('0x3b')](_0xe7fe('0x7b'),_0x119953['params']['id'][_0xe7fe('0x72')]())))[_0xe7fe('0x72')]();break;case'onlyIfOpen':_0xc92a35=squel[_0xe7fe('0x66')]()[_0xe7fe('0x67')](_0xe7fe('0x68'))['fromQuery']([_0xe7fe('0x6e'),_0xe7fe('0x6a'),'ContactId',_0xe7fe('0x6b'),_0xe7fe('0x5c'),_0xe7fe('0x51'),_0xe7fe('0x52')],squel['select']()[_0xe7fe('0x6d')](_0xe7fe('0x6e'),_0xe7fe('0x6e'))[_0xe7fe('0x6d')](_0xe7fe('0x6f'),_0xe7fe('0x6a'))[_0xe7fe('0x6d')]('id','ContactId')[_0xe7fe('0x6d')](_0x5c8b06[_0xe7fe('0x71')]['toString'](),_0xe7fe('0x6b'))[_0xe7fe('0x6d')](_0x119953['params']['id'][_0xe7fe('0x72')](),'CampaignId')[_0xe7fe('0x6d')]('\x27'+_0x44a79f+'\x27',_0xe7fe('0x51'))[_0xe7fe('0x6d')]('\x27'+_0x44a79f+'\x27',_0xe7fe('0x52'))[_0xe7fe('0x73')](_0xe7fe('0x74'))[_0xe7fe('0x3b')](_0xe7fe('0x75'))[_0xe7fe('0x3b')](_0xe7fe('0x7c'),_0x5c8b06['CmListId'][_0xe7fe('0x72')]())[_0xe7fe('0x3b')](_0xe7fe('0x76'))[_0xe7fe('0x3b')](_0xe7fe('0x77'),squel[_0xe7fe('0x6c')]()[_0xe7fe('0x6d')](_0xe7fe('0x7a'))['from'](_0xe7fe('0x68'))['where'](_0xe7fe('0x7b'),_0x119953['params']['id'][_0xe7fe('0x72')]())))[_0xe7fe('0x72')]();break;default:_0xc92a35=squel['insert']()[_0xe7fe('0x67')](_0xe7fe('0x68'))[_0xe7fe('0x69')]([_0xe7fe('0x6e'),_0xe7fe('0x6a'),_0xe7fe('0x70'),_0xe7fe('0x6b'),_0xe7fe('0x5c'),_0xe7fe('0x51'),'updatedAt'],squel[_0xe7fe('0x6c')]()['field'](_0xe7fe('0x6e'),_0xe7fe('0x6e'))[_0xe7fe('0x6d')](_0xe7fe('0x6f'),_0xe7fe('0x6a'))['field']('id','ContactId')['field'](_0x5c8b06['CmListId'][_0xe7fe('0x72')](),_0xe7fe('0x6b'))['field'](_0x119953[_0xe7fe('0x45')]['id'][_0xe7fe('0x72')](),'CampaignId')['field']('\x27'+_0x44a79f+'\x27',_0xe7fe('0x51'))[_0xe7fe('0x6d')]('\x27'+_0x44a79f+'\x27','updatedAt')[_0xe7fe('0x73')](_0xe7fe('0x74'))['where']('deletedAt\x20IS\x20NULL')[_0xe7fe('0x3b')](_0xe7fe('0x7c'),_0x5c8b06[_0xe7fe('0x71')][_0xe7fe('0x72')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xe7fe('0x72')]();}_0x4e023c=squel['insert']()[_0xe7fe('0x67')](_0xe7fe('0x7d'))[_0xe7fe('0x69')]([_0xe7fe('0x7e'),'scheduledAt',_0xe7fe('0x6e'),_0xe7fe('0x7f'),_0xe7fe('0x51'),_0xe7fe('0x52')],squel[_0xe7fe('0x6c')]()[_0xe7fe('0x6d')](_0xe7fe('0x80'),'id')[_0xe7fe('0x6d')]('NOW()',_0xe7fe('0x6a'))[_0xe7fe('0x6d')](_0xe7fe('0x81'),'phone')['field'](_0xe7fe('0x82'),'OrderBy')[_0xe7fe('0x6d')]('\x27'+_0x44a79f+'\x27',_0xe7fe('0x51'))[_0xe7fe('0x6d')]('\x27'+_0x44a79f+'\x27','updatedAt')[_0xe7fe('0x73')](_0xe7fe('0x83'),'ci')[_0xe7fe('0x84')](_0xe7fe('0x68'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xe7fe('0x3b')](_0xe7fe('0x85'),_0x5c8b06[_0xe7fe('0x71')][_0xe7fe('0x72')]())[_0xe7fe('0x3b')](_0xe7fe('0x86'),_0x119953[_0xe7fe('0x45')]['id'][_0xe7fe('0x72')]())['where'](_0xe7fe('0x87'),_0x44a79f))['toString']();_0xaa9e45['push'](db[_0xe7fe('0x88')][_0xe7fe('0x30')](_0xc92a35));_0x584a23[_0xe7fe('0x89')](db['sequelize'][_0xe7fe('0x30')](_0x4e023c));}return BPromise[_0xe7fe('0x8a')](_0xaa9e45);}})['then'](function(){return BPromise['all'](_0x584a23);})['then'](function(){return _0x228893;})[_0xe7fe('0x22')](respondWithResult(_0x22db3e,null))[_0xe7fe('0x43')](handleError(_0x22db3e,null));};exports[_0xe7fe('0x8b')]=function(_0x811c32,_0x287067,_0x322283){return db[_0xe7fe('0x41')]['find']({'where':{'id':_0x811c32[_0xe7fe('0x45')]['id']}})['then'](handleEntityNotFound(_0x287067,null))[_0xe7fe('0x22')](function(_0x57d467){if(_0x57d467){return _0x57d467[_0xe7fe('0x8b')](_0x811c32['query']['ids']);}})['then'](function(_0x49e5e5){if(_0x49e5e5){return db[_0xe7fe('0x57')][_0xe7fe('0x23')]({'where':{'ListId':_0x811c32[_0xe7fe('0x30')][_0xe7fe('0x64')],'CampaignId':_0x811c32[_0xe7fe('0x45')]['id']}})['then'](function(){return _0x49e5e5;});}})['then'](respondWithStatusCode(_0x287067,null))['catch'](handleError(_0x287067,null));};exports[_0xe7fe('0x8c')]=function(_0x486e5d,_0x496bc7,_0x380133){var _0x260a4f={};var _0x21cf56={};var _0x4499b5;var _0x117d17;return db[_0xe7fe('0x41')][_0xe7fe('0x56')]({'where':{'id':_0x486e5d[_0xe7fe('0x45')]['id']}})[_0xe7fe('0x22')](handleEntityNotFound(_0x496bc7,null))[_0xe7fe('0x22')](function(_0xde430c){if(_0xde430c){_0x4499b5=_0xde430c;_0x21cf56['model']=_[_0xe7fe('0x31')](db[_0xe7fe('0x8d')][_0xe7fe('0x2d')]);_0x21cf56[_0xe7fe('0x30')]=_['keys'](_0x486e5d[_0xe7fe('0x30')]);_0x21cf56[_0xe7fe('0x32')]=_[_0xe7fe('0x33')](_0x21cf56[_0xe7fe('0x2f')],_0x21cf56[_0xe7fe('0x30')]);_0x260a4f[_0xe7fe('0x34')]=_[_0xe7fe('0x33')](_0x21cf56[_0xe7fe('0x2f')],qs[_0xe7fe('0x35')](_0x486e5d[_0xe7fe('0x30')][_0xe7fe('0x35')]));_0x260a4f[_0xe7fe('0x34')]=_0x260a4f['attributes']['length']?_0x260a4f[_0xe7fe('0x34')]:_0x21cf56['model'];_0x260a4f[_0xe7fe('0x39')]=qs[_0xe7fe('0x3a')](_0x486e5d[_0xe7fe('0x30')][_0xe7fe('0x3a')]);_0x260a4f[_0xe7fe('0x3b')]=qs[_0xe7fe('0x32')](_[_0xe7fe('0x3c')](_0x486e5d[_0xe7fe('0x30')],_0x21cf56[_0xe7fe('0x32')]));if(_0x486e5d['query'][_0xe7fe('0x3d')]){_0x260a4f['where']=_[_0xe7fe('0x3e')](_0x260a4f[_0xe7fe('0x3b')],{'$or':_[_0xe7fe('0x2c')](_0x260a4f[_0xe7fe('0x34')],function(_0x488a9a){var _0x33cee8={};_0x33cee8[_0x488a9a]={'$like':'%'+_0x486e5d[_0xe7fe('0x30')][_0xe7fe('0x3d')]+'%'};return _0x33cee8;})});}_0x260a4f=_[_0xe7fe('0x3e')]({},_0x260a4f,_0x486e5d['options']);return _0x4499b5[_0xe7fe('0x8c')](_0x260a4f);}})[_0xe7fe('0x22')](function(_0x33279c){if(_0x33279c){_0x117d17=_0x33279c[_0xe7fe('0x36')];if(!_0x486e5d[_0xe7fe('0x30')][_0xe7fe('0x37')](_0xe7fe('0x38'))){_0x260a4f[_0xe7fe('0x1c')]=qs[_0xe7fe('0x1c')](_0x486e5d[_0xe7fe('0x30')][_0xe7fe('0x1c')]);_0x260a4f[_0xe7fe('0x1a')]=qs['offset'](_0x486e5d[_0xe7fe('0x30')][_0xe7fe('0x1a')]);}return _0x4499b5[_0xe7fe('0x8c')](_0x260a4f);}})[_0xe7fe('0x22')](function(_0x4a9899){if(_0x4a9899){return _0x4a9899?{'count':_0x117d17,'rows':_0x4a9899}:null;}})[_0xe7fe('0x22')](respondWithResult(_0x496bc7,null))['catch'](handleError(_0x496bc7,null));};exports[_0xe7fe('0x8e')]=function(_0x516897,_0x54e524,_0x5de7e6){var _0x53e414,_0x37f781;var _0x2aff1d=[];var _0x61da2e=moment()[_0xe7fe('0x8f')](_0xe7fe('0x63'));return db[_0xe7fe('0x41')]['find']({'where':{'id':_0x516897[_0xe7fe('0x45')]['id']}})['then'](handleEntityNotFound(_0x54e524,null))[_0xe7fe('0x22')](function(_0x577ae8){if(_0x577ae8){_0x37f781=_0x577ae8;return _0x577ae8['addBlackLists'](_0x516897['body']['ids'],_['omit'](_0x516897[_0xe7fe('0x49')],['ids','id'])||{});}return null;})[_0xe7fe('0x90')](function(_0x3b013e){var _0x2f8420;var _0x50e980;_0x53e414=_0x3b013e||[];var _0x5a5b85=[];if(_0x3b013e){for(var _0x15b291=0x0;_0x15b291<_0x3b013e[_0xe7fe('0x36')];_0x15b291+=0x1){var _0x147fc1=_0x3b013e[_0x15b291][_0xe7fe('0x24')]({'plain':!![]});_0x2f8420=squel[_0xe7fe('0x66')]()['into'](_0xe7fe('0x91'))[_0xe7fe('0x69')]([_0xe7fe('0x6e'),'ContactId',_0xe7fe('0x6b'),_0xe7fe('0x5c'),_0xe7fe('0x51'),_0xe7fe('0x52')],squel[_0xe7fe('0x6c')]()[_0xe7fe('0x6d')]('phone',_0xe7fe('0x6e'))[_0xe7fe('0x6d')]('id',_0xe7fe('0x70'))[_0xe7fe('0x6d')](_0x147fc1[_0xe7fe('0x71')]['toString'](),_0xe7fe('0x6b'))[_0xe7fe('0x6d')](_0x516897[_0xe7fe('0x45')]['id'][_0xe7fe('0x72')](),'CampaignId')[_0xe7fe('0x6d')](_0xe7fe('0x6f'),_0xe7fe('0x51'))['field'](_0xe7fe('0x6f'),_0xe7fe('0x52'))['from'](_0xe7fe('0x74'))[_0xe7fe('0x3b')](_0xe7fe('0x75'))['where'](_0xe7fe('0x7c'),_0x147fc1[_0xe7fe('0x71')]['toString']())[_0xe7fe('0x3b')](_0xe7fe('0x76')))[_0xe7fe('0x72')]();_0x5a5b85['push'](db[_0xe7fe('0x88')][_0xe7fe('0x30')](_0x2f8420));}return BPromise[_0xe7fe('0x8a')](_0x5a5b85);}})['then'](function(){return _0x53e414;})[_0xe7fe('0x22')](respondWithResult(_0x54e524,null))[_0xe7fe('0x43')](handleError(_0x54e524,null));};exports['removeBlackLists']=function(_0x2fb0b5,_0x4346be,_0x5873da){return db[_0xe7fe('0x41')]['find']({'where':{'id':_0x2fb0b5[_0xe7fe('0x45')]['id']}})['then'](handleEntityNotFound(_0x4346be,null))[_0xe7fe('0x22')](function(_0x35a7db){if(_0x35a7db){return _0x35a7db[_0xe7fe('0x92')](_0x2fb0b5[_0xe7fe('0x30')][_0xe7fe('0x64')]);}})[_0xe7fe('0x22')](function(_0x37aeba){if(_0x37aeba){return db[_0xe7fe('0x60')][_0xe7fe('0x23')]({'where':{'ListId':_0x2fb0b5[_0xe7fe('0x30')][_0xe7fe('0x64')],'CampaignId':_0x2fb0b5[_0xe7fe('0x45')]['id']}})[_0xe7fe('0x22')](function(){return _0x37aeba;});}})[_0xe7fe('0x22')](respondWithStatusCode(_0x4346be,null))[_0xe7fe('0x43')](handleError(_0x4346be,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index b16d4e3..47cafed 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(_0x240ad5,_0x5e125b){var _0x9cc8f5=function(_0x1e376e){while(--_0x1e376e){_0x240ad5['push'](_0x240ad5['shift']());}};_0x9cc8f5(++_0x5e125b);}(_0x7a54,0x106));var _0x47a5=function(_0x5bdde3,_0x4b134f){_0x5bdde3=_0x5bdde3-0x0;var _0xbe9b3f=_0x7a54[_0x5bdde3];return _0xbe9b3f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x53ff8e,_0x142c4a){var _0x57058b=function(_0x29c872){while(--_0x29c872){_0x53ff8e['push'](_0x53ff8e['shift']());}};_0x57058b(++_0x142c4a);}(_0x7a54,0x106));var _0x47a5=function(_0x3a9475,_0xe9c585){_0x3a9475=_0x3a9475-0x0;var _0x66b809=_0x7a54[_0x3a9475];return _0x66b809;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 86e8572..929ae05 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 _0x55e0=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCampaign','Campaign','options','where','attributes','limit','include','map','model','stringify','lodash','util','moment','bluebird'];(function(_0x237eca,_0x23ab86){var _0x5a89d2=function(_0x200c97){while(--_0x200c97){_0x237eca['push'](_0x237eca['shift']());}};_0x5a89d2(++_0x23ab86);}(_0x55e0,0xdc));var _0x055e=function(_0x4895f0,_0x5fb03d){_0x4895f0=_0x4895f0-0x0;var _0x427a47=_0x55e0[_0x4895f0];return _0x427a47;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});}exports[_0x055e('0x16')]=function(_0x4c85dd){var _0x36ef10=this;return new Promise(function(_0x2cf3de,_0x2f4a06){return db[_0x055e('0x17')]['findAll']({'raw':_0x4c85dd[_0x055e('0x18')]?_0x4c85dd[_0x055e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4c85dd[_0x055e('0x18')]?_0x4c85dd[_0x055e('0x18')][_0x055e('0x19')]||null:null,'attributes':_0x4c85dd[_0x055e('0x18')]?_0x4c85dd[_0x055e('0x18')][_0x055e('0x1a')]||null:null,'limit':_0x4c85dd['options']?_0x4c85dd[_0x055e('0x18')][_0x055e('0x1b')]||null:null,'include':_0x4c85dd[_0x055e('0x18')]?_0x4c85dd['options'][_0x055e('0x1c')]?_[_0x055e('0x1d')](_0x4c85dd[_0x055e('0x18')][_0x055e('0x1c')],function(_0x51df23){return{'model':db[_0x51df23[_0x055e('0x1e')]],'as':_0x51df23['as'],'attributes':_0x51df23['attributes'],'include':_0x51df23[_0x055e('0x1c')]?_[_0x055e('0x1d')](_0x51df23[_0x055e('0x1c')],function(_0x1a76c6){return{'model':db[_0x1a76c6[_0x055e('0x1e')]],'as':_0x1a76c6['as'],'attributes':_0x1a76c6[_0x055e('0x1a')],'include':_0x1a76c6['include']?_[_0x055e('0x1d')](_0x1a76c6[_0x055e('0x1c')],function(_0x2a82f8){return{'model':db[_0x2a82f8['model']],'as':_0x2a82f8['as'],'attributes':_0x2a82f8[_0x055e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x055e('0xb')](function(_0x42f2df){logger[_0x055e('0xc')]('GetCampaign',_0x4c85dd);logger[_0x055e('0xf')]('GetCampaign',_0x4c85dd,JSON[_0x055e('0x1f')](_0x42f2df));_0x2cf3de(_0x42f2df);})[_0x055e('0x15')](function(_0x23a506){logger[_0x055e('0x11')](_0x055e('0x16'),_0x23a506['message'],_0x4c85dd);_0x2f4a06(_0x36ef10[_0x055e('0x11')](0x1f4,_0x23a506[_0x055e('0x13')]));});});}; \ No newline at end of file +var _0xd136=['catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','map','include','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','Campaign,\x20%s,\x20%s','message','info','result'];(function(_0x2caf7c,_0x588c50){var _0x2ec223=function(_0x5e2c7d){while(--_0x5e2c7d){_0x2caf7c['push'](_0x2caf7c['shift']());}};_0x2ec223(++_0x588c50);}(_0xd136,0x94));var _0x6d13=function(_0x3602e1,_0x29228e){_0x3602e1=_0x3602e1-0x0;var _0x1ac2d7=_0xd136[_0x3602e1];return _0x1ac2d7;};'use strict';var _=require('lodash');var util=require(_0x6d13('0x0'));var moment=require(_0x6d13('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d13('0x2'));var fs=require('fs');var Redis=require(_0x6d13('0x3'));var db=require(_0x6d13('0x4'))['db'];var utils=require(_0x6d13('0x5'));var logger=require(_0x6d13('0x6'))(_0x6d13('0x7'));var config=require(_0x6d13('0x8'));var jayson=require(_0x6d13('0x9'));var client=jayson[_0x6d13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x335482,_0xdf6760,_0x4c563a){return new BPromise(function(_0x598021,_0x1af16f){return client[_0x6d13('0xb')](_0x335482,_0x4c563a)[_0x6d13('0xc')](function(_0x2216d7){logger['info']('Campaign,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));logger[_0x6d13('0xe')](_0x6d13('0xf'),_0xdf6760,'request\x20sent',JSON['stringify'](_0x2216d7));if(_0x2216d7[_0x6d13('0x10')]){if(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x11')]===0x1f4){logger['error'](_0x6d13('0x12'),_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x1af16f(_0x2216d7[_0x6d13('0x10')]['message']);}logger['error']('Campaign,\x20%s,\x20%s',_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x598021(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);}else{logger[_0x6d13('0x14')]('Campaign,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));_0x598021(_0x2216d7[_0x6d13('0x15')][_0x6d13('0x13')]);}})[_0x6d13('0x16')](function(_0x348cab){logger[_0x6d13('0x10')](_0x6d13('0x12'),_0xdf6760,_0x348cab);_0x1af16f(_0x348cab);});});}exports[_0x6d13('0x17')]=function(_0xc6c2b){var _0x5bcac4=this;return new Promise(function(_0x276fdd,_0x269f27){return db[_0x6d13('0x18')][_0x6d13('0x19')]({'raw':_0xc6c2b[_0x6d13('0x1a')]?_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x1b')]===undefined?!![]:![]:!![],'where':_0xc6c2b[_0x6d13('0x1a')]?_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x1c')]||null:null,'attributes':_0xc6c2b[_0x6d13('0x1a')]?_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x1d')]||null:null,'limit':_0xc6c2b[_0x6d13('0x1a')]?_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x1e')]||null:null,'include':_0xc6c2b['options']?_0xc6c2b[_0x6d13('0x1a')]['include']?_[_0x6d13('0x1f')](_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x20')],function(_0x5bbc9d){return{'model':db[_0x5bbc9d[_0x6d13('0x21')]],'as':_0x5bbc9d['as'],'attributes':_0x5bbc9d[_0x6d13('0x1d')],'include':_0x5bbc9d[_0x6d13('0x20')]?_[_0x6d13('0x1f')](_0x5bbc9d[_0x6d13('0x20')],function(_0x361432){return{'model':db[_0x361432[_0x6d13('0x21')]],'as':_0x361432['as'],'attributes':_0x361432[_0x6d13('0x1d')],'include':_0x361432['include']?_[_0x6d13('0x1f')](_0x361432['include'],function(_0x4c8526){return{'model':db[_0x4c8526[_0x6d13('0x21')]],'as':_0x4c8526['as'],'attributes':_0x4c8526['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d13('0xc')](function(_0x2618e5){logger[_0x6d13('0x14')]('GetCampaign',_0xc6c2b);logger[_0x6d13('0xe')](_0x6d13('0x17'),_0xc6c2b,JSON['stringify'](_0x2618e5));_0x276fdd(_0x2618e5);})[_0x6d13('0x16')](function(_0x1eda96){logger[_0x6d13('0x10')](_0x6d13('0x17'),_0x1eda96[_0x6d13('0x13')],_0xc6c2b);_0x269f27(_0x5bcac4[_0x6d13('0x10')](0x1f4,_0x1eda96[_0x6d13('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index df0d0f0..7c97d6b 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 _0xb01a=['/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','addBlackLists','put','/:id','delete','destroy','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','show'];(function(_0x351290,_0x2b09f4){var _0x496a7c=function(_0x5c781f){while(--_0x5c781f){_0x351290['push'](_0x351290['shift']());}};_0x496a7c(++_0x2b09f4);}(_0xb01a,0xe0));var _0xab01=function(_0x4bee2,_0x25edd6){_0x4bee2=_0x4bee2-0x0;var _0xaaa997=_0xb01a[_0x4bee2];return _0xaaa997;};'use strict';var multer=require(_0xab01('0x0'));var util=require(_0xab01('0x1'));var path=require(_0xab01('0x2'));var timeout=require(_0xab01('0x3'));var express=require(_0xab01('0x4'));var router=express[_0xab01('0x5')]();var fs_extra=require(_0xab01('0x6'));var auth=require(_0xab01('0x7'));var interaction=require(_0xab01('0x8'));var config=require(_0xab01('0x9'));var controller=require(_0xab01('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xab01('0xb')]('/:id',auth[_0xab01('0xc')](),controller[_0xab01('0xd')]);router[_0xab01('0xb')](_0xab01('0xe'),auth[_0xab01('0xc')](),controller['getHoppers']);router[_0xab01('0xb')](_0xab01('0xf'),auth[_0xab01('0xc')](),controller[_0xab01('0x10')]);router[_0xab01('0xb')](_0xab01('0x11'),auth['isAuthenticated'](),controller[_0xab01('0x12')]);router['get'](_0xab01('0x13'),auth[_0xab01('0xc')](),controller[_0xab01('0x14')]);router[_0xab01('0xb')](_0xab01('0x15'),auth[_0xab01('0xc')](),controller[_0xab01('0x16')]);router['get'](_0xab01('0x17'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xab01('0x18')]('/',auth[_0xab01('0xc')](),controller[_0xab01('0x19')]);router['post'](_0xab01('0x1a'),auth[_0xab01('0xc')](),controller['clone']);router[_0xab01('0x18')]('/:id/lists',auth[_0xab01('0xc')](),controller['addLists']);router[_0xab01('0x18')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xab01('0x1b')]);router[_0xab01('0x1c')](_0xab01('0x1d'),auth['isAuthenticated'](),controller['update']);router[_0xab01('0x1e')](_0xab01('0x1d'),auth['isAuthenticated'](),controller[_0xab01('0x1f')]);router[_0xab01('0x1e')](_0xab01('0x15'),auth[_0xab01('0xc')](),controller['removeLists']);router[_0xab01('0x1e')](_0xab01('0x17'),auth[_0xab01('0xc')](),controller[_0xab01('0x20')]);module[_0xab01('0x21')]=router; \ No newline at end of file +var _0x8e0d=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','multer','connect-timeout'];(function(_0x512a5a,_0xdca964){var _0x2a1cd2=function(_0x4c53f9){while(--_0x4c53f9){_0x512a5a['push'](_0x512a5a['shift']());}};_0x2a1cd2(++_0xdca964);}(_0x8e0d,0x82));var _0xd8e0=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x8e0d[_0x4bd950];return _0x5dc59a;};'use strict';var multer=require(_0xd8e0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd8e0('0x1'));var express=require(_0xd8e0('0x2'));var router=express['Router']();var fs_extra=require(_0xd8e0('0x3'));var auth=require(_0xd8e0('0x4'));var interaction=require(_0xd8e0('0x5'));var config=require(_0xd8e0('0x6'));var controller=require('./campaign.controller');router['get']('/',auth[_0xd8e0('0x7')](),controller[_0xd8e0('0x8')]);router[_0xd8e0('0x9')](_0xd8e0('0xa'),auth['isAuthenticated'](),controller[_0xd8e0('0xb')]);router[_0xd8e0('0x9')](_0xd8e0('0xc'),auth[_0xd8e0('0x7')](),controller[_0xd8e0('0xd')]);router['get'](_0xd8e0('0xe'),auth['isAuthenticated'](),controller[_0xd8e0('0xf')]);router['get']('/:id/hopper_finals',auth[_0xd8e0('0x7')](),controller[_0xd8e0('0x10')]);router[_0xd8e0('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0xd8e0('0x11')]);router['get'](_0xd8e0('0x12'),auth['isAuthenticated'](),controller['getLists']);router['get'](_0xd8e0('0x13'),auth['isAuthenticated'](),controller[_0xd8e0('0x14')]);router[_0xd8e0('0x15')]('/',auth[_0xd8e0('0x7')](),controller[_0xd8e0('0x16')]);router[_0xd8e0('0x15')](_0xd8e0('0x17'),auth[_0xd8e0('0x7')](),controller[_0xd8e0('0x18')]);router[_0xd8e0('0x15')]('/:id/lists',auth[_0xd8e0('0x7')](),controller[_0xd8e0('0x19')]);router[_0xd8e0('0x15')](_0xd8e0('0x13'),auth[_0xd8e0('0x7')](),controller[_0xd8e0('0x1a')]);router[_0xd8e0('0x1b')](_0xd8e0('0xa'),auth['isAuthenticated'](),controller[_0xd8e0('0x1c')]);router[_0xd8e0('0x1d')]('/:id',auth[_0xd8e0('0x7')](),controller['destroy']);router['delete']('/:id/lists',auth[_0xd8e0('0x7')](),controller[_0xd8e0('0x1e')]);router['delete'](_0xd8e0('0x13'),auth[_0xd8e0('0x7')](),controller[_0xd8e0('0x1f')]);module[_0xd8e0('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index e99b334..6b20ae9 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 _0xb84b=['getDataValue','sequelize','exports','STRING','TEXT'];(function(_0x104a66,_0x1deeab){var _0x3c3c76=function(_0x3beb9f){while(--_0x3beb9f){_0x104a66['push'](_0x104a66['shift']());}};_0x3c3c76(++_0x1deeab);}(_0xb84b,0x191));var _0xbb84=function(_0x41801f,_0x348c7a){_0x41801f=_0x41801f-0x0;var _0xb3d2ec=_0xb84b[_0x41801f];return _0xb3d2ec;};'use strict';var Sequelize=require(_0xbb84('0x0'));module[_0xbb84('0x1')]={'key':{'type':Sequelize[_0xbb84('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xbb84('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xbb84('0x4')]('key');}}}; \ No newline at end of file +var _0xc685=['TEXT','VIRTUAL','sequelize','exports','STRING'];(function(_0xc465f5,_0xa9c358){var _0x3dd839=function(_0x45aa86){while(--_0x45aa86){_0xc465f5['push'](_0xc465f5['shift']());}};_0x3dd839(++_0xa9c358);}(_0xc685,0x84));var _0x5c68=function(_0x2aa066,_0x245411){_0x2aa066=_0x2aa066-0x0;var _0x4a9824=_0xc685[_0x2aa066];return _0x4a9824;};'use strict';var Sequelize=require(_0x5c68('0x0'));module[_0x5c68('0x1')]={'key':{'type':Sequelize[_0x5c68('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x5c68('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x5c68('0x4')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index cc53182..e6d9fcd 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 _0xcdd8=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','CannedAnswer','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','create','MailAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x25c1e1,_0x2201f6){var _0x1ce9ac=function(_0x1765bf){while(--_0x1765bf){_0x25c1e1['push'](_0x25c1e1['shift']());}};_0x1ce9ac(++_0x2201f6);}(_0xcdd8,0x1a6));var _0x8cdd=function(_0x596415,_0x51cc1d){_0x596415=_0x596415-0x0;var _0x3aa028=_0xcdd8[_0x596415];return _0x3aa028;};'use strict';var emlformat=require(_0x8cdd('0x0'));var rimraf=require(_0x8cdd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cdd('0x2'));var rp=require(_0x8cdd('0x3'));var moment=require('moment');var BPromise=require(_0x8cdd('0x4'));var Mustache=require(_0x8cdd('0x5'));var util=require(_0x8cdd('0x6'));var path=require('path');var sox=require(_0x8cdd('0x7'));var csv=require(_0x8cdd('0x8'));var ejs=require(_0x8cdd('0x9'));var fs=require('fs');var fs_extra=require(_0x8cdd('0xa'));var _=require(_0x8cdd('0xb'));var squel=require(_0x8cdd('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8cdd('0xd'));var toCsv=require(_0x8cdd('0x8'));var querystring=require(_0x8cdd('0xe'));var Papa=require(_0x8cdd('0xf'));var Redis=require('ioredis');var authService=require(_0x8cdd('0x10'));var qs=require(_0x8cdd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cdd('0x12'));var logger=require(_0x8cdd('0x13'))('api');var utils=require(_0x8cdd('0x14'));var config=require(_0x8cdd('0x15'));var licenseUtil=require(_0x8cdd('0x16'));var db=require(_0x8cdd('0x17'))['db'];function respondWithStatusCode(_0x3f8d0b,_0x2bad72){_0x2bad72=_0x2bad72||0xcc;return function(_0x45604d){if(_0x45604d){return _0x3f8d0b[_0x8cdd('0x18')](_0x2bad72);}return _0x3f8d0b[_0x8cdd('0x19')](_0x2bad72)[_0x8cdd('0x1a')]();};}function respondWithResult(_0x339fad,_0x2033fd){_0x2033fd=_0x2033fd||0xc8;return function(_0x2bf0ca){if(_0x2bf0ca){return _0x339fad[_0x8cdd('0x19')](_0x2033fd)['json'](_0x2bf0ca);}};}function respondWithFilteredResult(_0x3885f7,_0x4bd1ba){return function(_0x2d5aec){if(_0x2d5aec){var _0x1a982c=typeof _0x4bd1ba['offset']===_0x8cdd('0x1b')&&typeof _0x4bd1ba[_0x8cdd('0x1c')]===_0x8cdd('0x1b');var _0x3f7342=_0x2d5aec['count'];var _0x3aed9e=_0x1a982c?0x0:_0x4bd1ba[_0x8cdd('0x1d')];var _0x93b7cb=_0x1a982c?_0x2d5aec[_0x8cdd('0x1e')]:_0x4bd1ba['offset']+_0x4bd1ba[_0x8cdd('0x1c')];var _0x4fed38;if(_0x93b7cb>=_0x3f7342){_0x93b7cb=_0x3f7342;_0x4fed38=0xc8;}else{_0x4fed38=0xce;}_0x3885f7[_0x8cdd('0x19')](_0x4fed38);return _0x3885f7[_0x8cdd('0x1f')](_0x8cdd('0x20'),_0x3aed9e+'-'+_0x93b7cb+'/'+_0x3f7342)[_0x8cdd('0x21')](_0x2d5aec);}return null;};}function patchUpdates(_0x1350bc){return function(_0x32dd8c){try{jsonpatch[_0x8cdd('0x22')](_0x32dd8c,_0x1350bc,!![]);}catch(_0x22b3de){return BPromise[_0x8cdd('0x23')](_0x22b3de);}return _0x32dd8c[_0x8cdd('0x24')]();};}function saveUpdates(_0x4b9a1c,_0x3ce4fa){return function(_0x2a3a81){if(_0x2a3a81){return _0x2a3a81['update'](_0x4b9a1c)[_0x8cdd('0x25')](function(_0x4b2c85){return _0x4b2c85;});}return null;};}function removeEntity(_0x290ffe,_0x12e3a5){return function(_0x51fc3b){if(_0x51fc3b){return _0x51fc3b[_0x8cdd('0x26')]()[_0x8cdd('0x25')](function(){var _0x4152df=_0x51fc3b[_0x8cdd('0x27')]({'plain':!![]});var _0xd5d2c4=_0x8cdd('0x28');return db[_0x8cdd('0x29')]['destroy']({'where':{'type':_0xd5d2c4,'resourceId':_0x4152df['id']}})['then'](function(){return _0x51fc3b;});})['then'](function(){_0x290ffe[_0x8cdd('0x19')](0xcc)[_0x8cdd('0x1a')]();});}};}function handleEntityNotFound(_0x2f6951,_0x3cf9c4){return function(_0x1f0ed1){if(!_0x1f0ed1){_0x2f6951[_0x8cdd('0x18')](0x194);}return _0x1f0ed1;};}function handleError(_0x519dbf,_0x53e2e6){_0x53e2e6=_0x53e2e6||0x1f4;return function(_0x3f6ca6){logger[_0x8cdd('0x2a')](_0x3f6ca6[_0x8cdd('0x2b')]);if(_0x3f6ca6[_0x8cdd('0x2c')]){delete _0x3f6ca6[_0x8cdd('0x2c')];}_0x519dbf[_0x8cdd('0x19')](_0x53e2e6)[_0x8cdd('0x2d')](_0x3f6ca6);};}exports['index']=function(_0x1bc950,_0x3c1757){var _0x2fdf3a={},_0x179648={},_0x1cb7cb={'count':0x0,'rows':[]};var _0x28bded=_['map'](db[_0x8cdd('0x2e')][_0x8cdd('0x2f')],function(_0x1b1310){return{'name':_0x1b1310[_0x8cdd('0x30')],'type':_0x1b1310[_0x8cdd('0x31')][_0x8cdd('0x32')]};});_0x179648['model']=_[_0x8cdd('0x33')](_0x28bded,_0x8cdd('0x2c'));_0x179648['query']=_[_0x8cdd('0x34')](_0x1bc950['query']);_0x179648[_0x8cdd('0x35')]=_[_0x8cdd('0x36')](_0x179648[_0x8cdd('0x37')],_0x179648[_0x8cdd('0x38')]);_0x2fdf3a[_0x8cdd('0x39')]=_[_0x8cdd('0x36')](_0x179648[_0x8cdd('0x37')],qs[_0x8cdd('0x3a')](_0x1bc950['query'][_0x8cdd('0x3a')]));_0x2fdf3a['attributes']=_0x2fdf3a[_0x8cdd('0x39')][_0x8cdd('0x3b')]?_0x2fdf3a[_0x8cdd('0x39')]:_0x179648['model'];if(!_0x1bc950[_0x8cdd('0x38')][_0x8cdd('0x3c')](_0x8cdd('0x3d'))){_0x2fdf3a['limit']=qs[_0x8cdd('0x1c')](_0x1bc950[_0x8cdd('0x38')]['limit']);_0x2fdf3a[_0x8cdd('0x1d')]=qs[_0x8cdd('0x1d')](_0x1bc950[_0x8cdd('0x38')][_0x8cdd('0x1d')]);}_0x2fdf3a['order']=qs[_0x8cdd('0x3e')](_0x1bc950['query'][_0x8cdd('0x3e')]);_0x2fdf3a['where']=qs[_0x8cdd('0x35')](_['pick'](_0x1bc950['query'],_0x179648[_0x8cdd('0x35')]),_0x28bded);if(_0x1bc950['query'][_0x8cdd('0x3f')]){_0x2fdf3a[_0x8cdd('0x40')]=_['merge'](_0x2fdf3a[_0x8cdd('0x40')],{'$or':[{'key':{'$like':'%'+_0x1bc950[_0x8cdd('0x38')][_0x8cdd('0x3f')]+'%'}},{'value':{'$like':'%'+_0x1bc950[_0x8cdd('0x38')][_0x8cdd('0x3f')]+'%'}}]});}_0x2fdf3a=_[_0x8cdd('0x41')]({},_0x2fdf3a,_0x1bc950[_0x8cdd('0x42')]);var _0x17cac7={'where':_0x2fdf3a[_0x8cdd('0x40')]};return db[_0x8cdd('0x2e')][_0x8cdd('0x1e')](_0x17cac7)[_0x8cdd('0x25')](function(_0x29457e){_0x1cb7cb[_0x8cdd('0x1e')]=_0x29457e;if(_0x1bc950[_0x8cdd('0x38')][_0x8cdd('0x43')]){_0x2fdf3a[_0x8cdd('0x44')]=[{'all':!![]}];}return db[_0x8cdd('0x2e')][_0x8cdd('0x45')](_0x2fdf3a);})[_0x8cdd('0x25')](function(_0x36e9f0){_0x1cb7cb[_0x8cdd('0x46')]=_0x36e9f0;return _0x1cb7cb;})[_0x8cdd('0x25')](respondWithFilteredResult(_0x3c1757,_0x2fdf3a))[_0x8cdd('0x47')](handleError(_0x3c1757,null));};exports[_0x8cdd('0x48')]=function(_0x42a4a6,_0x336496){var _0x5833ee={'raw':!![],'where':{'id':_0x42a4a6[_0x8cdd('0x49')]['id']}},_0x321f17={};_0x321f17[_0x8cdd('0x37')]=_[_0x8cdd('0x34')](db['CannedAnswer']['rawAttributes']);_0x321f17[_0x8cdd('0x38')]=_[_0x8cdd('0x34')](_0x42a4a6[_0x8cdd('0x38')]);_0x321f17[_0x8cdd('0x35')]=_[_0x8cdd('0x36')](_0x321f17[_0x8cdd('0x37')],_0x321f17[_0x8cdd('0x38')]);_0x5833ee[_0x8cdd('0x39')]=_[_0x8cdd('0x36')](_0x321f17[_0x8cdd('0x37')],qs[_0x8cdd('0x3a')](_0x42a4a6[_0x8cdd('0x38')][_0x8cdd('0x3a')]));_0x5833ee[_0x8cdd('0x39')]=_0x5833ee[_0x8cdd('0x39')][_0x8cdd('0x3b')]?_0x5833ee[_0x8cdd('0x39')]:_0x321f17[_0x8cdd('0x37')];if(_0x42a4a6['query'][_0x8cdd('0x43')]){_0x5833ee['include']=[{'all':!![]}];}_0x5833ee=_['merge']({},_0x5833ee,_0x42a4a6['options']);return db['CannedAnswer'][_0x8cdd('0x4a')](_0x5833ee)[_0x8cdd('0x25')](handleEntityNotFound(_0x336496,null))[_0x8cdd('0x25')](respondWithResult(_0x336496,null))[_0x8cdd('0x47')](handleError(_0x336496,null));};exports['update']=function(_0x3a57de,_0x4cc134){if(_0x3a57de[_0x8cdd('0x4b')]['id']){delete _0x3a57de[_0x8cdd('0x4b')]['id'];}return db['CannedAnswer'][_0x8cdd('0x4a')]({'where':{'id':_0x3a57de['params']['id']}})[_0x8cdd('0x25')](handleEntityNotFound(_0x4cc134,null))[_0x8cdd('0x25')](saveUpdates(_0x3a57de['body'],null))[_0x8cdd('0x25')](respondWithResult(_0x4cc134,null))[_0x8cdd('0x47')](handleError(_0x4cc134,null));};exports['destroy']=function(_0x18f7fe,_0x530b00){return db[_0x8cdd('0x2e')]['find']({'where':{'id':_0x18f7fe[_0x8cdd('0x49')]['id']}})[_0x8cdd('0x25')](handleEntityNotFound(_0x530b00,null))['then'](removeEntity(_0x530b00,null))['catch'](handleError(_0x530b00,null));};exports[_0x8cdd('0x4c')]=function(_0x56a33a,_0x5c31e7){var _0x462775={'key':_0x56a33a[_0x8cdd('0x4b')][_0x8cdd('0x32')]};if(_0x56a33a[_0x8cdd('0x4b')][_0x8cdd('0x4d')]){_0x462775[_0x8cdd('0x4d')]=_0x56a33a[_0x8cdd('0x4b')]['MailAccountId'];}else if(_0x56a33a[_0x8cdd('0x4b')]['SmsAccountId']){_0x462775['SmsAccountId']=_0x56a33a[_0x8cdd('0x4b')]['SmsAccountId'];}else if(_0x56a33a[_0x8cdd('0x4b')][_0x8cdd('0x4e')]){_0x462775[_0x8cdd('0x4e')]=_0x56a33a['body'][_0x8cdd('0x4e')];}else if(_0x56a33a[_0x8cdd('0x4b')][_0x8cdd('0x4f')]){_0x462775['ChatWebsiteId']=_0x56a33a[_0x8cdd('0x4b')][_0x8cdd('0x4f')];}return db['CannedAnswer'][_0x8cdd('0x4a')]({'where':_0x462775})[_0x8cdd('0x25')](function(_0x266dd9){if(_0x266dd9){throw new db[(_0x8cdd('0x50'))]['ValidationError'](_0x8cdd('0x51'));}return db[_0x8cdd('0x2e')][_0x8cdd('0x4c')](_0x56a33a[_0x8cdd('0x4b')]);})[_0x8cdd('0x25')](function(_0x53ef46){var _0x469ce0=_0x56a33a[_0x8cdd('0x52')][_0x8cdd('0x27')]({'plain':!![]});if(!_0x469ce0)throw new Error(_0x8cdd('0x53'));if(_0x469ce0['role']===_0x8cdd('0x52')){var _0x4a911f=_0x53ef46[_0x8cdd('0x27')]({'plain':!![]});return db[_0x8cdd('0x54')][_0x8cdd('0x4a')]({'where':{'name':_0x8cdd('0x28'),'userProfileId':_0x469ce0['userProfileId']},'raw':!![]})[_0x8cdd('0x25')](function(_0x2460c8){if(_0x2460c8&&_0x2460c8[_0x8cdd('0x55')]===0x0){return db['UserProfileResource'][_0x8cdd('0x4c')]({'name':_0x4a911f[_0x8cdd('0x2c')],'resourceId':_0x4a911f['id'],'type':_0x2460c8[_0x8cdd('0x2c')],'sectionId':_0x2460c8['id']},{})[_0x8cdd('0x25')](function(){return _0x53ef46;});}else{return _0x53ef46;}})[_0x8cdd('0x47')](function(_0x3a8fa8){logger[_0x8cdd('0x2a')](_0x8cdd('0x56'),_0x3a8fa8);throw _0x3a8fa8;});}return _0x53ef46;})[_0x8cdd('0x25')](respondWithResult(_0x5c31e7,0xc9))[_0x8cdd('0x47')](handleError(_0x5c31e7,null));}; \ No newline at end of file +var _0x588b=['where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','Sequelize','user','get','role','userProfileId','autoAssociation','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','CannedAnswers','UserProfileResource','error','stack','name','index','CannedAnswer','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x450032,_0x3465e8){var _0x1dcf2c=function(_0x4f491c){while(--_0x4f491c){_0x450032['push'](_0x450032['shift']());}};_0x1dcf2c(++_0x3465e8);}(_0x588b,0x1bc));var _0xb588=function(_0x54a297,_0x10426c){_0x54a297=_0x54a297-0x0;var _0x23ad0b=_0x588b[_0x54a297];return _0x23ad0b;};'use strict';var emlformat=require(_0xb588('0x0'));var rimraf=require(_0xb588('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb588('0x2'));var moment=require(_0xb588('0x3'));var BPromise=require(_0xb588('0x4'));var Mustache=require(_0xb588('0x5'));var util=require(_0xb588('0x6'));var path=require(_0xb588('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb588('0x8'));var _=require(_0xb588('0x9'));var squel=require('squel');var crypto=require(_0xb588('0xa'));var jsforce=require(_0xb588('0xb'));var deskjs=require(_0xb588('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb588('0xd'));var Redis=require(_0xb588('0xe'));var authService=require(_0xb588('0xf'));var qs=require(_0xb588('0x10'));var as=require(_0xb588('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb588('0x12'))(_0xb588('0x13'));var utils=require(_0xb588('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb588('0x15'));var db=require(_0xb588('0x16'))['db'];function respondWithStatusCode(_0x441789,_0x3e1a6d){_0x3e1a6d=_0x3e1a6d||0xcc;return function(_0x418d83){if(_0x418d83){return _0x441789[_0xb588('0x17')](_0x3e1a6d);}return _0x441789[_0xb588('0x18')](_0x3e1a6d)[_0xb588('0x19')]();};}function respondWithResult(_0x438cd1,_0x19b511){_0x19b511=_0x19b511||0xc8;return function(_0x2ebe5b){if(_0x2ebe5b){return _0x438cd1[_0xb588('0x18')](_0x19b511)[_0xb588('0x1a')](_0x2ebe5b);}};}function respondWithFilteredResult(_0x504c5f,_0x39c6d1){return function(_0x31a1cd){if(_0x31a1cd){var _0x2611f4=typeof _0x39c6d1[_0xb588('0x1b')]==='undefined'&&typeof _0x39c6d1[_0xb588('0x1c')]==='undefined';var _0x59935f=_0x31a1cd['count'];var _0xf3e1d2=_0x2611f4?0x0:_0x39c6d1[_0xb588('0x1b')];var _0x42bd10=_0x2611f4?_0x31a1cd[_0xb588('0x1d')]:_0x39c6d1[_0xb588('0x1b')]+_0x39c6d1['limit'];var _0x2f117c;if(_0x42bd10>=_0x59935f){_0x42bd10=_0x59935f;_0x2f117c=0xc8;}else{_0x2f117c=0xce;}_0x504c5f[_0xb588('0x18')](_0x2f117c);return _0x504c5f[_0xb588('0x1e')](_0xb588('0x1f'),_0xf3e1d2+'-'+_0x42bd10+'/'+_0x59935f)[_0xb588('0x1a')](_0x31a1cd);}return null;};}function patchUpdates(_0x3e6d02){return function(_0x43836f){try{jsonpatch[_0xb588('0x20')](_0x43836f,_0x3e6d02,!![]);}catch(_0x3a937b){return BPromise[_0xb588('0x21')](_0x3a937b);}return _0x43836f[_0xb588('0x22')]();};}function saveUpdates(_0x183265,_0x221dca){return function(_0x269f5d){if(_0x269f5d){return _0x269f5d['update'](_0x183265)[_0xb588('0x23')](function(_0x45fd96){return _0x45fd96;});}return null;};}function removeEntity(_0x41d8a1,_0x4dfc91){return function(_0x2b0062){if(_0x2b0062){return _0x2b0062[_0xb588('0x24')]()[_0xb588('0x23')](function(){var _0x9477eb=_0x2b0062['get']({'plain':!![]});var _0x5443ae=_0xb588('0x25');return db[_0xb588('0x26')][_0xb588('0x24')]({'where':{'type':_0x5443ae,'resourceId':_0x9477eb['id']}})['then'](function(){return _0x2b0062;});})[_0xb588('0x23')](function(){_0x41d8a1[_0xb588('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c487c,_0x175970){return function(_0x9f2c79){if(!_0x9f2c79){_0x5c487c['sendStatus'](0x194);}return _0x9f2c79;};}function handleError(_0x39387c,_0x12254f){_0x12254f=_0x12254f||0x1f4;return function(_0x164fbf){logger[_0xb588('0x27')](_0x164fbf[_0xb588('0x28')]);if(_0x164fbf[_0xb588('0x29')]){delete _0x164fbf[_0xb588('0x29')];}_0x39387c[_0xb588('0x18')](_0x12254f)['send'](_0x164fbf);};}exports[_0xb588('0x2a')]=function(_0xa73732,_0xc34413){var _0x448345={},_0x961cac={},_0x440f53={'count':0x0,'rows':[]};var _0xcbb048=_['map'](db[_0xb588('0x2b')][_0xb588('0x2c')],function(_0x33a4f7){return{'name':_0x33a4f7['fieldName'],'type':_0x33a4f7[_0xb588('0x2d')][_0xb588('0x2e')]};});_0x961cac[_0xb588('0x2f')]=_[_0xb588('0x30')](_0xcbb048,_0xb588('0x29'));_0x961cac[_0xb588('0x31')]=_[_0xb588('0x32')](_0xa73732['query']);_0x961cac[_0xb588('0x33')]=_[_0xb588('0x34')](_0x961cac['model'],_0x961cac[_0xb588('0x31')]);_0x448345['attributes']=_[_0xb588('0x34')](_0x961cac[_0xb588('0x2f')],qs[_0xb588('0x35')](_0xa73732[_0xb588('0x31')][_0xb588('0x35')]));_0x448345[_0xb588('0x36')]=_0x448345[_0xb588('0x36')][_0xb588('0x37')]?_0x448345[_0xb588('0x36')]:_0x961cac[_0xb588('0x2f')];if(!_0xa73732[_0xb588('0x31')][_0xb588('0x38')](_0xb588('0x39'))){_0x448345['limit']=qs[_0xb588('0x1c')](_0xa73732[_0xb588('0x31')]['limit']);_0x448345['offset']=qs[_0xb588('0x1b')](_0xa73732[_0xb588('0x31')][_0xb588('0x1b')]);}_0x448345[_0xb588('0x3a')]=qs[_0xb588('0x3b')](_0xa73732[_0xb588('0x31')][_0xb588('0x3b')]);_0x448345[_0xb588('0x3c')]=qs[_0xb588('0x33')](_['pick'](_0xa73732[_0xb588('0x31')],_0x961cac['filters']),_0xcbb048);if(_0xa73732[_0xb588('0x31')][_0xb588('0x3d')]){_0x448345[_0xb588('0x3c')]=_['merge'](_0x448345[_0xb588('0x3c')],{'$or':[{'key':{'$like':'%'+_0xa73732[_0xb588('0x31')][_0xb588('0x3d')]+'%'}},{'value':{'$like':'%'+_0xa73732[_0xb588('0x31')]['filter']+'%'}}]});}_0x448345=_[_0xb588('0x3e')]({},_0x448345,_0xa73732[_0xb588('0x3f')]);var _0x2ddd42={'where':_0x448345[_0xb588('0x3c')]};return db['CannedAnswer']['count'](_0x2ddd42)[_0xb588('0x23')](function(_0x38d451){_0x440f53[_0xb588('0x1d')]=_0x38d451;if(_0xa73732['query'][_0xb588('0x40')]){_0x448345[_0xb588('0x41')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb588('0x42')](_0x448345);})[_0xb588('0x23')](function(_0x5a4f5e){_0x440f53[_0xb588('0x43')]=_0x5a4f5e;return _0x440f53;})[_0xb588('0x23')](respondWithFilteredResult(_0xc34413,_0x448345))[_0xb588('0x44')](handleError(_0xc34413,null));};exports[_0xb588('0x45')]=function(_0x53c7c8,_0x18be42){var _0x539854={'raw':!![],'where':{'id':_0x53c7c8[_0xb588('0x46')]['id']}},_0x66b681={};_0x66b681['model']=_[_0xb588('0x32')](db[_0xb588('0x2b')][_0xb588('0x2c')]);_0x66b681[_0xb588('0x31')]=_[_0xb588('0x32')](_0x53c7c8[_0xb588('0x31')]);_0x66b681[_0xb588('0x33')]=_[_0xb588('0x34')](_0x66b681[_0xb588('0x2f')],_0x66b681[_0xb588('0x31')]);_0x539854[_0xb588('0x36')]=_['intersection'](_0x66b681[_0xb588('0x2f')],qs[_0xb588('0x35')](_0x53c7c8[_0xb588('0x31')]['fields']));_0x539854[_0xb588('0x36')]=_0x539854['attributes']['length']?_0x539854[_0xb588('0x36')]:_0x66b681['model'];if(_0x53c7c8[_0xb588('0x31')][_0xb588('0x40')]){_0x539854[_0xb588('0x41')]=[{'all':!![]}];}_0x539854=_['merge']({},_0x539854,_0x53c7c8[_0xb588('0x3f')]);return db[_0xb588('0x2b')][_0xb588('0x47')](_0x539854)[_0xb588('0x23')](handleEntityNotFound(_0x18be42,null))[_0xb588('0x23')](respondWithResult(_0x18be42,null))[_0xb588('0x44')](handleError(_0x18be42,null));};exports[_0xb588('0x48')]=function(_0x1b8536,_0xb0ef9d){if(_0x1b8536[_0xb588('0x49')]['id']){delete _0x1b8536[_0xb588('0x49')]['id'];}return db[_0xb588('0x2b')][_0xb588('0x47')]({'where':{'id':_0x1b8536[_0xb588('0x46')]['id']}})[_0xb588('0x23')](handleEntityNotFound(_0xb0ef9d,null))[_0xb588('0x23')](saveUpdates(_0x1b8536[_0xb588('0x49')],null))[_0xb588('0x23')](respondWithResult(_0xb0ef9d,null))[_0xb588('0x44')](handleError(_0xb0ef9d,null));};exports['destroy']=function(_0x359f6f,_0x12c674){return db['CannedAnswer'][_0xb588('0x47')]({'where':{'id':_0x359f6f[_0xb588('0x46')]['id']}})[_0xb588('0x23')](handleEntityNotFound(_0x12c674,null))['then'](removeEntity(_0x12c674,null))['catch'](handleError(_0x12c674,null));};exports[_0xb588('0x4a')]=function(_0x2358e6,_0x31144b){var _0x5c48c1={'key':_0x2358e6[_0xb588('0x49')][_0xb588('0x2e')]};if(_0x2358e6[_0xb588('0x49')][_0xb588('0x4b')]){_0x5c48c1[_0xb588('0x4b')]=_0x2358e6['body'][_0xb588('0x4b')];}else if(_0x2358e6['body']['SmsAccountId']){_0x5c48c1['SmsAccountId']=_0x2358e6[_0xb588('0x49')][_0xb588('0x4c')];}else if(_0x2358e6[_0xb588('0x49')][_0xb588('0x4d')]){_0x5c48c1[_0xb588('0x4d')]=_0x2358e6['body'][_0xb588('0x4d')];}else if(_0x2358e6[_0xb588('0x49')]['ChatWebsiteId']){_0x5c48c1['ChatWebsiteId']=_0x2358e6[_0xb588('0x49')]['ChatWebsiteId'];}return db[_0xb588('0x2b')][_0xb588('0x47')]({'where':_0x5c48c1})[_0xb588('0x23')](function(_0x339a13){if(_0x339a13){throw new db[(_0xb588('0x4e'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xb588('0x2b')][_0xb588('0x4a')](_0x2358e6[_0xb588('0x49')]);})['then'](function(_0x5e7941){var _0x33b1be=_0x2358e6[_0xb588('0x4f')][_0xb588('0x50')]({'plain':!![]});if(!_0x33b1be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33b1be[_0xb588('0x51')]===_0xb588('0x4f')){var _0xeab879=_0x5e7941[_0xb588('0x50')]({'plain':!![]});return db['UserProfileSection'][_0xb588('0x47')]({'where':{'name':_0xb588('0x25'),'userProfileId':_0x33b1be[_0xb588('0x52')]},'raw':!![]})[_0xb588('0x23')](function(_0x3e100b){if(_0x3e100b&&_0x3e100b[_0xb588('0x53')]===0x0){return db['UserProfileResource'][_0xb588('0x4a')]({'name':_0xeab879['name'],'resourceId':_0xeab879['id'],'type':_0x3e100b[_0xb588('0x29')],'sectionId':_0x3e100b['id']},{})['then'](function(){return _0x5e7941;});}else{return _0x5e7941;}})[_0xb588('0x44')](function(_0x169235){logger[_0xb588('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x169235);throw _0x169235;});}return _0x5e7941;})[_0xb588('0x23')](respondWithResult(_0x31144b,0xc9))['catch'](handleError(_0x31144b,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 2bfd425..37f7e2e 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 _0xe5ad=['tools_canned_answers','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x58a5e7,_0x36717e){var _0x39626a=function(_0x14ae95){while(--_0x14ae95){_0x58a5e7['push'](_0x58a5e7['shift']());}};_0x39626a(++_0x36717e);}(_0xe5ad,0x110));var _0xde5a=function(_0x377e52,_0x40896d){_0x377e52=_0x377e52-0x0;var _0x199e7e=_0xe5ad[_0x377e52];return _0x199e7e;};'use strict';var _=require(_0xde5a('0x0'));var util=require(_0xde5a('0x1'));var logger=require('../../config/logger')(_0xde5a('0x2'));var moment=require(_0xde5a('0x3'));var BPromise=require(_0xde5a('0x4'));var rp=require(_0xde5a('0x5'));var fs=require('fs');var path=require(_0xde5a('0x6'));var rimraf=require(_0xde5a('0x7'));var config=require(_0xde5a('0x8'));var attributes=require(_0xde5a('0x9'));module[_0xde5a('0xa')]=function(_0x3799b1,_0x5eb5e4){return _0x3799b1[_0xde5a('0xb')](_0xde5a('0xc'),attributes,{'tableName':_0xde5a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xde5a('0xe')});}; \ No newline at end of file +var _0xda45=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','tools_canned_answers','utf8mb4'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0xda45,0x111));var _0x5da4=function(_0x155437,_0x2f98ff){_0x155437=_0x155437-0x0;var _0x146f07=_0xda45[_0x155437];return _0x146f07;};'use strict';var _=require(_0x5da4('0x0'));var util=require(_0x5da4('0x1'));var logger=require(_0x5da4('0x2'))(_0x5da4('0x3'));var moment=require(_0x5da4('0x4'));var BPromise=require(_0x5da4('0x5'));var rp=require(_0x5da4('0x6'));var fs=require('fs');var path=require(_0x5da4('0x7'));var rimraf=require(_0x5da4('0x8'));var config=require(_0x5da4('0x9'));var attributes=require('./cannedAnswer.attributes');module[_0x5da4('0xa')]=function(_0x3ef4f5,_0x207683){return _0x3ef4f5['define']('CannedAnswer',attributes,{'tableName':_0x5da4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5da4('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 611e343..0fb7262 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(_0x3829f4,_0x2cc733){var _0x40f678=function(_0x3229d9){while(--_0x3229d9){_0x3829f4['push'](_0x3829f4['shift']());}};_0x40f678(++_0x2cc733);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x3ce31f,_0x243b76){var _0x2d13a2=function(_0x58d9a4){while(--_0x58d9a4){_0x3ce31f['push'](_0x3ce31f['shift']());}};_0x2d13a2(++_0x243b76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 1b29be5..48bc17e 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 _0xb3bc=['multer','connect-timeout','Router','fs-extra','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','post','create','put','/:id','update','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xb3bc,0x12c));var _0xcb3b=function(_0x158e0a,_0x44316d){_0x158e0a=_0x158e0a-0x0;var _0x20b46c=_0xb3bc[_0x158e0a];return _0x20b46c;};'use strict';var multer=require(_0xcb3b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcb3b('0x1'));var express=require('express');var router=express[_0xcb3b('0x2')]();var fs_extra=require(_0xcb3b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcb3b('0x4'));var config=require('../../config/environment');var controller=require(_0xcb3b('0x5'));router[_0xcb3b('0x6')]('/',auth[_0xcb3b('0x7')](),controller[_0xcb3b('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcb3b('0x9')]('/',auth[_0xcb3b('0x7')](),controller[_0xcb3b('0xa')]);router[_0xcb3b('0xb')](_0xcb3b('0xc'),auth[_0xcb3b('0x7')](),controller[_0xcb3b('0xd')]);router['delete']('/:id',auth[_0xcb3b('0x7')](),controller['destroy']);module[_0xcb3b('0xe')]=router; \ No newline at end of file +var _0x5c4a=['update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','create','put'];(function(_0x5e2e35,_0x92e911){var _0x512cc3=function(_0x226201){while(--_0x226201){_0x5e2e35['push'](_0x5e2e35['shift']());}};_0x512cc3(++_0x92e911);}(_0x5c4a,0xc9));var _0xa5c4=function(_0x161ea3,_0x28d0e0){_0x161ea3=_0x161ea3-0x0;var _0x1eb28e=_0x5c4a[_0x161ea3];return _0x1eb28e;};'use strict';var multer=require(_0xa5c4('0x0'));var util=require(_0xa5c4('0x1'));var path=require(_0xa5c4('0x2'));var timeout=require('connect-timeout');var express=require(_0xa5c4('0x3'));var router=express[_0xa5c4('0x4')]();var fs_extra=require(_0xa5c4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa5c4('0x6'));var config=require(_0xa5c4('0x7'));var controller=require(_0xa5c4('0x8'));router[_0xa5c4('0x9')]('/',auth[_0xa5c4('0xa')](),controller[_0xa5c4('0xb')]);router[_0xa5c4('0x9')](_0xa5c4('0xc'),auth[_0xa5c4('0xa')](),controller['show']);router['post']('/',auth[_0xa5c4('0xa')](),controller[_0xa5c4('0xd')]);router[_0xa5c4('0xe')]('/:id',auth[_0xa5c4('0xa')](),controller[_0xa5c4('0xf')]);router[_0xa5c4('0x10')](_0xa5c4('0xc'),auth[_0xa5c4('0xa')](),controller[_0xa5c4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 67a0cb2..8f0f48a 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 _0xa20a=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x18222c,_0x15909e){var _0x3c908f=function(_0x185c04){while(--_0x185c04){_0x18222c['push'](_0x18222c['shift']());}};_0x3c908f(++_0x15909e);}(_0xa20a,0x74));var _0xaa20=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xa20a[_0xef8146];return _0x5a6cb0;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0xaa20('0x0')],'allowNull':![],'defaultValue':_0xaa20('0x1')},'clid':{'type':Sequelize[_0xaa20('0x2')]},'src':{'type':Sequelize[_0xaa20('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xaa20('0x2')]},'channel':{'type':Sequelize[_0xaa20('0x2')]},'dstchannel':{'type':Sequelize[_0xaa20('0x2')]},'lastapp':{'type':Sequelize[_0xaa20('0x2')]},'lastdata':{'type':Sequelize[_0xaa20('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xaa20('0x2')]},'amaflags':{'type':Sequelize[_0xaa20('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xaa20('0x2')]},'userfield':{'type':Sequelize[_0xaa20('0x2')]},'uniqueid':{'type':Sequelize[_0xaa20('0x2')]},'linkedid':{'type':Sequelize[_0xaa20('0x2')]},'sequence':{'type':Sequelize[_0xaa20('0x2')]},'peeraccount':{'type':Sequelize[_0xaa20('0x2')]},'type':{'type':Sequelize[_0xaa20('0x2')]},'tag':{'type':Sequelize[_0xaa20('0x2')]}}; \ No newline at end of file +var _0x5530=['STRING','INTEGER','sequelize','DATE','1970-01-01\x2000:00:01'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0x5530,0xa7));var _0x0553=function(_0x4a16b0,_0x40d9d7){_0x4a16b0=_0x4a16b0-0x0;var _0x115918=_0x5530[_0x4a16b0];return _0x115918;};'use strict';var Sequelize=require(_0x0553('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x0553('0x1')],'allowNull':![],'defaultValue':_0x0553('0x2')},'clid':{'type':Sequelize[_0x0553('0x3')]},'src':{'type':Sequelize[_0x0553('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x0553('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x0553('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x0553('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0553('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0553('0x3')]},'amaflags':{'type':Sequelize[_0x0553('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0553('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x0553('0x3')]},'sequence':{'type':Sequelize[_0x0553('0x3')]},'peeraccount':{'type':Sequelize[_0x0553('0x3')]},'type':{'type':Sequelize[_0x0553('0x3')]},'tag':{'type':Sequelize[_0x0553('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 8fa6d59..ca9fdcd 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 _0x0e85=['json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','util','sox','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','../../mysqldb','sendStatus','status','end'];(function(_0x1e6565,_0x4546d7){var _0x36b792=function(_0x3ae025){while(--_0x3ae025){_0x1e6565['push'](_0x1e6565['shift']());}};_0x36b792(++_0x4546d7);}(_0x0e85,0x7c));var _0x50e8=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x0e85[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['map'](_0x126c99,'name');_0x4f0b88[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x30fedf[_0x50e8('0x2e')]);_0x4f0b88['filters']=_['intersection'](_0x4f0b88[_0x50e8('0x2d')],_0x4f0b88[_0x50e8('0x2e')]);_0x42bbef['attributes']=_[_0x50e8('0x30')](_0x4f0b88[_0x50e8('0x2d')],qs[_0x50e8('0x31')](_0x30fedf[_0x50e8('0x2e')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef['attributes'][_0x50e8('0x33')]?_0x42bbef[_0x50e8('0x32')]:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf['query'][_0x50e8('0x34')](_0x50e8('0x35'))){_0x42bbef['limit']=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1d')]);_0x42bbef[_0x50e8('0x1b')]=qs['offset'](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1b')]);}_0x42bbef[_0x50e8('0x36')]=qs[_0x50e8('0x37')](_0x30fedf['query'][_0x50e8('0x37')]);_0x42bbef[_0x50e8('0x38')]=qs[_0x50e8('0x39')](_['pick'](_0x30fedf['query'],_0x4f0b88['filters']),_0x126c99);if(_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]){_0x42bbef[_0x50e8('0x38')]=_[_0x50e8('0x3b')](_0x42bbef[_0x50e8('0x38')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0xb566c2){if(_0xb566c2[_0x50e8('0x3c')]!==_0x50e8('0x3d')){var _0x3a1b4d={};_0x3a1b4d[_0xb566c2['name']]={'$like':'%'+_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]+'%'};return _0x3a1b4d;}})});}_0x42bbef=_[_0x50e8('0x3b')]({},_0x42bbef,_0x30fedf[_0x50e8('0x3e')]);var _0x5dbbe1={'where':_0x42bbef[_0x50e8('0x38')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x5dbbe1)[_0x50e8('0x23')](function(_0x8e8a97){_0x1041b9['count']=_0x8e8a97;if(_0x30fedf['query'][_0x50e8('0x3f')]){_0x42bbef[_0x50e8('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x50e8('0x41')](_0x42bbef);})[_0x50e8('0x23')](function(_0x3db1ab){_0x1041b9[_0x50e8('0x42')]=_0x3db1ab;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x43')](handleError(_0x39c0c6,null));};exports[_0x50e8('0x44')]=function(_0x172049,_0x5e9da3){var _0x3d26bd={'raw':!![],'where':{'id':_0x172049[_0x50e8('0x45')]['id']}},_0x44e0ca={};_0x44e0ca[_0x50e8('0x2d')]=_['keys'](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x44e0ca[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x172049['query']);_0x44e0ca[_0x50e8('0x39')]=_['intersection'](_0x44e0ca['model'],_0x44e0ca['query']);_0x3d26bd[_0x50e8('0x32')]=_[_0x50e8('0x30')](_0x44e0ca['model'],qs[_0x50e8('0x31')](_0x172049[_0x50e8('0x2e')][_0x50e8('0x31')]));_0x3d26bd[_0x50e8('0x32')]=_0x3d26bd[_0x50e8('0x32')][_0x50e8('0x33')]?_0x3d26bd['attributes']:_0x44e0ca[_0x50e8('0x2d')];if(_0x172049['query'][_0x50e8('0x3f')]){_0x3d26bd[_0x50e8('0x40')]=[{'all':!![]}];}_0x3d26bd=_['merge']({},_0x3d26bd,_0x172049[_0x50e8('0x3e')]);return db['Cdr'][_0x50e8('0x46')](_0x3d26bd)[_0x50e8('0x23')](handleEntityNotFound(_0x5e9da3,null))[_0x50e8('0x23')](respondWithResult(_0x5e9da3,null))[_0x50e8('0x43')](handleError(_0x5e9da3,null));};exports[_0x50e8('0x47')]=function(_0x3f72ea,_0x229d60){return db[_0x50e8('0x29')][_0x50e8('0x47')](_0x3f72ea[_0x50e8('0x48')],{})[_0x50e8('0x23')](respondWithResult(_0x229d60,0xc9))['catch'](handleError(_0x229d60,null));};exports[_0x50e8('0x22')]=function(_0x275a1b,_0x479431){if(_0x275a1b[_0x50e8('0x48')]['id']){delete _0x275a1b['body']['id'];}return db[_0x50e8('0x29')]['find']({'where':{'id':_0x275a1b[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x479431,null))[_0x50e8('0x23')](saveUpdates(_0x275a1b[_0x50e8('0x48')],null))[_0x50e8('0x23')](respondWithResult(_0x479431,null))[_0x50e8('0x43')](handleError(_0x479431,null));};exports[_0x50e8('0x49')]=function(_0x5f256a,_0x3410f3){return db[_0x50e8('0x29')][_0x50e8('0x46')]({'where':{'id':_0x5f256a[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x3410f3,null))[_0x50e8('0x23')](removeEntity(_0x3410f3,null))['catch'](handleError(_0x3410f3,null));};exports[_0x50e8('0x4a')]=function(_0x250b28,_0xff2e24){return db[_0x50e8('0x29')]['describe']()[_0x50e8('0x23')](respondWithResult(_0xff2e24,null))[_0x50e8('0x43')](handleError(_0xff2e24,null));}; \ No newline at end of file +var _0x4300=['stack','name','send','index','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Cdr','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','eml-format','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x4300,0x1a6));var _0x0430=function(_0x30ab2f,_0x411b8a){_0x30ab2f=_0x30ab2f-0x0;var _0x45863a=_0x4300[_0x30ab2f];return _0x45863a;};'use strict';var emlformat=require(_0x0430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0430('0x1'));var BPromise=require(_0x0430('0x2'));var Mustache=require(_0x0430('0x3'));var util=require(_0x0430('0x4'));var path=require(_0x0430('0x5'));var sox=require('sox');var csv=require(_0x0430('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0430('0x7'));var _=require('lodash');var squel=require(_0x0430('0x8'));var crypto=require(_0x0430('0x9'));var jsforce=require(_0x0430('0xa'));var deskjs=require(_0x0430('0xb'));var toCsv=require(_0x0430('0x6'));var querystring=require(_0x0430('0xc'));var Papa=require(_0x0430('0xd'));var Redis=require(_0x0430('0xe'));var authService=require(_0x0430('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0430('0x10'));var hardwareService=require(_0x0430('0x11'));var logger=require(_0x0430('0x12'))(_0x0430('0x13'));var utils=require(_0x0430('0x14'));var config=require(_0x0430('0x15'));var licenseUtil=require(_0x0430('0x16'));var db=require(_0x0430('0x17'))['db'];function respondWithStatusCode(_0x5315a3,_0x4b382a){_0x4b382a=_0x4b382a||0xcc;return function(_0x4292f7){if(_0x4292f7){return _0x5315a3[_0x0430('0x18')](_0x4b382a);}return _0x5315a3[_0x0430('0x19')](_0x4b382a)[_0x0430('0x1a')]();};}function respondWithResult(_0x671534,_0x39d4e2){_0x39d4e2=_0x39d4e2||0xc8;return function(_0x182e2c){if(_0x182e2c){return _0x671534['status'](_0x39d4e2)[_0x0430('0x1b')](_0x182e2c);}};}function respondWithFilteredResult(_0x40e6dc,_0x8fe471){return function(_0x3b34af){if(_0x3b34af){var _0x5c98c9=typeof _0x8fe471['offset']==='undefined'&&typeof _0x8fe471[_0x0430('0x1c')]==='undefined';var _0x495094=_0x3b34af[_0x0430('0x1d')];var _0x2f23b9=_0x5c98c9?0x0:_0x8fe471[_0x0430('0x1e')];var _0xd33c3c=_0x5c98c9?_0x3b34af[_0x0430('0x1d')]:_0x8fe471['offset']+_0x8fe471['limit'];var _0xf11cda;if(_0xd33c3c>=_0x495094){_0xd33c3c=_0x495094;_0xf11cda=0xc8;}else{_0xf11cda=0xce;}_0x40e6dc[_0x0430('0x19')](_0xf11cda);return _0x40e6dc[_0x0430('0x1f')](_0x0430('0x20'),_0x2f23b9+'-'+_0xd33c3c+'/'+_0x495094)['json'](_0x3b34af);}return null;};}function patchUpdates(_0x4d3af1){return function(_0x12a05c){try{jsonpatch[_0x0430('0x21')](_0x12a05c,_0x4d3af1,!![]);}catch(_0x301992){return BPromise[_0x0430('0x22')](_0x301992);}return _0x12a05c[_0x0430('0x23')]();};}function saveUpdates(_0xb17238,_0x5da567){return function(_0x11160f){if(_0x11160f){return _0x11160f[_0x0430('0x24')](_0xb17238)[_0x0430('0x25')](function(_0x1d5b51){return _0x1d5b51;});}return null;};}function removeEntity(_0x54e1a3,_0x188b12){return function(_0x28faa2){if(_0x28faa2){return _0x28faa2[_0x0430('0x26')]()[_0x0430('0x25')](function(){_0x54e1a3[_0x0430('0x19')](0xcc)[_0x0430('0x1a')]();});}};}function handleEntityNotFound(_0x345b8c,_0x3e74d8){return function(_0x36ff02){if(!_0x36ff02){_0x345b8c['sendStatus'](0x194);}return _0x36ff02;};}function handleError(_0x375e54,_0x531611){_0x531611=_0x531611||0x1f4;return function(_0x5a79d6){logger[_0x0430('0x27')](_0x5a79d6[_0x0430('0x28')]);if(_0x5a79d6['name']){delete _0x5a79d6[_0x0430('0x29')];}_0x375e54[_0x0430('0x19')](_0x531611)[_0x0430('0x2a')](_0x5a79d6);};}exports[_0x0430('0x2b')]=function(_0x2b94e4,_0x3805f7){var _0x1df9ec={},_0xd6b31a={},_0x36f6ff={'count':0x0,'rows':[]};var _0x5ae72c=_['map'](db['Cdr'][_0x0430('0x2c')],function(_0x47e1f3){return{'name':_0x47e1f3[_0x0430('0x2d')],'type':_0x47e1f3['type']['key']};});_0xd6b31a[_0x0430('0x2e')]=_[_0x0430('0x2f')](_0x5ae72c,_0x0430('0x29'));_0xd6b31a[_0x0430('0x30')]=_['keys'](_0x2b94e4['query']);_0xd6b31a[_0x0430('0x31')]=_[_0x0430('0x32')](_0xd6b31a['model'],_0xd6b31a['query']);_0x1df9ec[_0x0430('0x33')]=_[_0x0430('0x32')](_0xd6b31a[_0x0430('0x2e')],qs[_0x0430('0x34')](_0x2b94e4[_0x0430('0x30')][_0x0430('0x34')]));_0x1df9ec[_0x0430('0x33')]=_0x1df9ec[_0x0430('0x33')][_0x0430('0x35')]?_0x1df9ec['attributes']:_0xd6b31a[_0x0430('0x2e')];if(!_0x2b94e4[_0x0430('0x30')][_0x0430('0x36')]('nolimit')){_0x1df9ec[_0x0430('0x1c')]=qs['limit'](_0x2b94e4[_0x0430('0x30')]['limit']);_0x1df9ec['offset']=qs[_0x0430('0x1e')](_0x2b94e4[_0x0430('0x30')][_0x0430('0x1e')]);}_0x1df9ec[_0x0430('0x37')]=qs[_0x0430('0x38')](_0x2b94e4[_0x0430('0x30')]['sort']);_0x1df9ec[_0x0430('0x39')]=qs[_0x0430('0x31')](_[_0x0430('0x3a')](_0x2b94e4[_0x0430('0x30')],_0xd6b31a[_0x0430('0x31')]),_0x5ae72c);if(_0x2b94e4[_0x0430('0x30')][_0x0430('0x3b')]){_0x1df9ec[_0x0430('0x39')]=_[_0x0430('0x3c')](_0x1df9ec[_0x0430('0x39')],{'$or':_['map'](_0x5ae72c,function(_0x44c546){if(_0x44c546[_0x0430('0x3d')]!==_0x0430('0x3e')){var _0x314b27={};_0x314b27[_0x44c546[_0x0430('0x29')]]={'$like':'%'+_0x2b94e4[_0x0430('0x30')]['filter']+'%'};return _0x314b27;}})});}_0x1df9ec=_[_0x0430('0x3c')]({},_0x1df9ec,_0x2b94e4[_0x0430('0x3f')]);var _0x50cdcd={'where':_0x1df9ec[_0x0430('0x39')]};return db[_0x0430('0x40')][_0x0430('0x1d')](_0x50cdcd)[_0x0430('0x25')](function(_0x2d6345){_0x36f6ff[_0x0430('0x1d')]=_0x2d6345;if(_0x2b94e4[_0x0430('0x30')][_0x0430('0x41')]){_0x1df9ec[_0x0430('0x42')]=[{'all':!![]}];}return db['Cdr'][_0x0430('0x43')](_0x1df9ec);})[_0x0430('0x25')](function(_0x456f36){_0x36f6ff[_0x0430('0x44')]=_0x456f36;return _0x36f6ff;})['then'](respondWithFilteredResult(_0x3805f7,_0x1df9ec))[_0x0430('0x45')](handleError(_0x3805f7,null));};exports[_0x0430('0x46')]=function(_0x16e96c,_0x435028){var _0x26992f={'raw':!![],'where':{'id':_0x16e96c[_0x0430('0x47')]['id']}},_0x3cc598={};_0x3cc598[_0x0430('0x2e')]=_[_0x0430('0x48')](db[_0x0430('0x40')][_0x0430('0x2c')]);_0x3cc598['query']=_[_0x0430('0x48')](_0x16e96c['query']);_0x3cc598['filters']=_[_0x0430('0x32')](_0x3cc598['model'],_0x3cc598['query']);_0x26992f[_0x0430('0x33')]=_['intersection'](_0x3cc598['model'],qs[_0x0430('0x34')](_0x16e96c['query']['fields']));_0x26992f[_0x0430('0x33')]=_0x26992f['attributes']['length']?_0x26992f[_0x0430('0x33')]:_0x3cc598[_0x0430('0x2e')];if(_0x16e96c[_0x0430('0x30')]['includeAll']){_0x26992f[_0x0430('0x42')]=[{'all':!![]}];}_0x26992f=_[_0x0430('0x3c')]({},_0x26992f,_0x16e96c[_0x0430('0x3f')]);return db['Cdr']['find'](_0x26992f)[_0x0430('0x25')](handleEntityNotFound(_0x435028,null))[_0x0430('0x25')](respondWithResult(_0x435028,null))[_0x0430('0x45')](handleError(_0x435028,null));};exports[_0x0430('0x49')]=function(_0x5e84f4,_0x5a4500){return db['Cdr'][_0x0430('0x49')](_0x5e84f4[_0x0430('0x4a')],{})[_0x0430('0x25')](respondWithResult(_0x5a4500,0xc9))[_0x0430('0x45')](handleError(_0x5a4500,null));};exports[_0x0430('0x24')]=function(_0x421280,_0x5c3184){if(_0x421280['body']['id']){delete _0x421280[_0x0430('0x4a')]['id'];}return db[_0x0430('0x40')][_0x0430('0x4b')]({'where':{'id':_0x421280[_0x0430('0x47')]['id']}})[_0x0430('0x25')](handleEntityNotFound(_0x5c3184,null))[_0x0430('0x25')](saveUpdates(_0x421280[_0x0430('0x4a')],null))[_0x0430('0x25')](respondWithResult(_0x5c3184,null))[_0x0430('0x45')](handleError(_0x5c3184,null));};exports[_0x0430('0x26')]=function(_0x4387db,_0x2bdcd6){return db['Cdr']['find']({'where':{'id':_0x4387db[_0x0430('0x47')]['id']}})[_0x0430('0x25')](handleEntityNotFound(_0x2bdcd6,null))[_0x0430('0x25')](removeEntity(_0x2bdcd6,null))[_0x0430('0x45')](handleError(_0x2bdcd6,null));};exports[_0x0430('0x4c')]=function(_0x261996,_0xfa67a4){return db[_0x0430('0x40')][_0x0430('0x4c')]()[_0x0430('0x25')](respondWithResult(_0xfa67a4,null))[_0x0430('0x45')](handleError(_0xfa67a4,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2f868c2..7f48e68 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4894d0,_0x12806b){var _0x2c7f01=function(_0x417984){while(--_0x417984){_0x4894d0['push'](_0x4894d0['shift']());}};_0x2c7f01(++_0x12806b);}(_0x7a54,0x106));var _0x47a5=function(_0x1e1673,_0x2650fb){_0x1e1673=_0x1e1673-0x0;var _0x511e50=_0x7a54[_0x1e1673];return _0x511e50;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x4122e2,_0x105191){var _0x572cc0=function(_0x444c69){while(--_0x444c69){_0x4122e2['push'](_0x4122e2['shift']());}};_0x572cc0(++_0x105191);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 d860f28..953bba5 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 _0xbb46=['Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','Cdr,\x20%s,\x20%s','debug'];(function(_0x2ddbee,_0x1e4cd8){var _0x39a1c9=function(_0x5a0ed4){while(--_0x5a0ed4){_0x2ddbee['push'](_0x2ddbee['shift']());}};_0x39a1c9(++_0x1e4cd8);}(_0xbb46,0x6b));var _0x6bb4=function(_0x42692d,_0x4f0431){_0x42692d=_0x42692d-0x0;var _0xa025c4=_0xbb46[_0x42692d];return _0xa025c4;};'use strict';var _=require(_0x6bb4('0x0'));var util=require(_0x6bb4('0x1'));var moment=require(_0x6bb4('0x2'));var BPromise=require('bluebird');var rs=require(_0x6bb4('0x3'));var fs=require('fs');var Redis=require(_0x6bb4('0x4'));var db=require(_0x6bb4('0x5'))['db'];var utils=require(_0x6bb4('0x6'));var logger=require(_0x6bb4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6bb4('0x8'));var client=jayson['client'][_0x6bb4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59061f,_0x11ecc4,_0x452ae9){return new BPromise(function(_0x5c29c8,_0x507a93){return client[_0x6bb4('0xa')](_0x59061f,_0x452ae9)['then'](function(_0x2a9215){logger['info'](_0x6bb4('0xb'),_0x11ecc4,'request\x20sent');logger[_0x6bb4('0xc')](_0x6bb4('0xd'),_0x11ecc4,_0x6bb4('0xe'),JSON['stringify'](_0x2a9215));if(_0x2a9215[_0x6bb4('0xf')]){if(_0x2a9215[_0x6bb4('0xf')][_0x6bb4('0x10')]===0x1f4){logger[_0x6bb4('0xf')](_0x6bb4('0xb'),_0x11ecc4,_0x2a9215[_0x6bb4('0xf')][_0x6bb4('0x11')]);return _0x507a93(_0x2a9215[_0x6bb4('0xf')][_0x6bb4('0x11')]);}logger[_0x6bb4('0xf')](_0x6bb4('0xb'),_0x11ecc4,_0x2a9215[_0x6bb4('0xf')][_0x6bb4('0x11')]);return _0x5c29c8(_0x2a9215['error'][_0x6bb4('0x11')]);}else{logger[_0x6bb4('0x12')](_0x6bb4('0xb'),_0x11ecc4,_0x6bb4('0xe'));_0x5c29c8(_0x2a9215['result']['message']);}})[_0x6bb4('0x13')](function(_0x461d3c){logger[_0x6bb4('0xf')](_0x6bb4('0xb'),_0x11ecc4,_0x461d3c);_0x507a93(_0x461d3c);});});} \ No newline at end of file +var _0xdc15=['stringify','error','Cdr,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x35cde3,_0x46a4ef){var _0x2b12c8=function(_0x3a30cd){while(--_0x3a30cd){_0x35cde3['push'](_0x35cde3['shift']());}};_0x2b12c8(++_0x46a4ef);}(_0xdc15,0x1d2));var _0x5dc1=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xdc15[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x5dc1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5dc1('0x1'));var rs=require(_0x5dc1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5dc1('0x3'))['db'];var utils=require(_0x5dc1('0x4'));var logger=require(_0x5dc1('0x5'))(_0x5dc1('0x6'));var config=require(_0x5dc1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5dc1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38b896,_0x1e6a76,_0x26cfcf){return new BPromise(function(_0x4e7b18,_0x10049c){return client['request'](_0x38b896,_0x26cfcf)[_0x5dc1('0x9')](function(_0x51b8f0){logger[_0x5dc1('0xa')]('Cdr,\x20%s,\x20%s',_0x1e6a76,'request\x20sent');logger[_0x5dc1('0xb')](_0x5dc1('0xc'),_0x1e6a76,_0x5dc1('0xd'),JSON[_0x5dc1('0xe')](_0x51b8f0));if(_0x51b8f0[_0x5dc1('0xf')]){if(_0x51b8f0['error']['code']===0x1f4){logger[_0x5dc1('0xf')](_0x5dc1('0x10'),_0x1e6a76,_0x51b8f0[_0x5dc1('0xf')][_0x5dc1('0x11')]);return _0x10049c(_0x51b8f0[_0x5dc1('0xf')][_0x5dc1('0x11')]);}logger['error'](_0x5dc1('0x10'),_0x1e6a76,_0x51b8f0[_0x5dc1('0xf')][_0x5dc1('0x11')]);return _0x4e7b18(_0x51b8f0[_0x5dc1('0xf')]['message']);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x1e6a76,_0x5dc1('0xd'));_0x4e7b18(_0x51b8f0[_0x5dc1('0x12')][_0x5dc1('0x11')]);}})[_0x5dc1('0x13')](function(_0x5a0c56){logger[_0x5dc1('0xf')](_0x5dc1('0x10'),_0x1e6a76,_0x5a0c56);_0x10049c(_0x5a0c56);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 41acb25..0d0acbe 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4ead23,_0x537fec){var _0x36bcae=function(_0xe423ee){while(--_0xe423ee){_0x4ead23['push'](_0x4ead23['shift']());}};_0x36bcae(++_0x537fec);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 82240d1..f83b704 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 _0xa883=['TEXT','STRING','sequelize','exports','INTEGER'];(function(_0x2c38be,_0xaaf1a2){var _0x119ec7=function(_0x2e4ebe){while(--_0x2e4ebe){_0x2c38be['push'](_0x2c38be['shift']());}};_0x119ec7(++_0xaaf1a2);}(_0xa883,0xe8));var _0x3a88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa883[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3a88('0x0'));module[_0x3a88('0x1')]={'priority':{'type':Sequelize[_0x3a88('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3a88('0x3')]()},'description':{'type':Sequelize[_0x3a88('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6ddd=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x161fea,_0x1a6439){var _0x1016cd=function(_0x3c31c2){while(--_0x3c31c2){_0x161fea['push'](_0x161fea['shift']());}};_0x1016cd(++_0x1a6439);}(_0x6ddd,0x9d));var _0xd6dd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6ddd[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0xd6dd('0x0')]={'priority':{'type':Sequelize[_0xd6dd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd6dd('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd6dd('0x3')]()},'description':{'type':Sequelize[_0xd6dd('0x2')]},'interval':{'type':Sequelize[_0xd6dd('0x2')],'defaultValue':_0xd6dd('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 4795616..9307b7d 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 _0x9d9b=['querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','error','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','include','merge','options','find','catch','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x4b449a,_0x35e8a7){var _0x1fadad=function(_0x3e39ec){while(--_0x3e39ec){_0x4b449a['push'](_0x4b449a['shift']());}};_0x1fadad(++_0x35e8a7);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x5293f7,_0x22fc1e){_0x5293f7=_0x5293f7-0x0;var _0x3e042f=_0x9d9b[_0x5293f7];return _0x3e042f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9d9('0x0'));var zipdir=require(_0xb9d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9d9('0x2'));var moment=require('moment');var BPromise=require(_0xb9d9('0x3'));var Mustache=require(_0xb9d9('0x4'));var util=require(_0xb9d9('0x5'));var path=require('path');var sox=require(_0xb9d9('0x6'));var csv=require('to-csv');var ejs=require(_0xb9d9('0x7'));var fs=require('fs');var fs_extra=require(_0xb9d9('0x8'));var _=require('lodash');var squel=require(_0xb9d9('0x9'));var crypto=require(_0xb9d9('0xa'));var jsforce=require(_0xb9d9('0xb'));var deskjs=require(_0xb9d9('0xc'));var toCsv=require(_0xb9d9('0xd'));var querystring=require(_0xb9d9('0xe'));var Papa=require(_0xb9d9('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(_0xb9d9('0x10'));var logger=require(_0xb9d9('0x11'))(_0xb9d9('0x12'));var utils=require('../../config/utils');var config=require(_0xb9d9('0x13'));var licenseUtil=require(_0xb9d9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc03d,_0x5e3782){_0x5e3782=_0x5e3782||0xcc;return function(_0x1245e0){if(_0x1245e0){return _0x3cc03d[_0xb9d9('0x15')](_0x5e3782);}return _0x3cc03d[_0xb9d9('0x16')](_0x5e3782)[_0xb9d9('0x17')]();};}function respondWithResult(_0x26ef71,_0x1d26cf){_0x1d26cf=_0x1d26cf||0xc8;return function(_0x4f0c77){if(_0x4f0c77){return _0x26ef71[_0xb9d9('0x16')](_0x1d26cf)['json'](_0x4f0c77);}};}function respondWithFilteredResult(_0x4c8864,_0x3db648){return function(_0x2c9039){if(_0x2c9039){var _0x3909ab=typeof _0x3db648[_0xb9d9('0x18')]==='undefined'&&typeof _0x3db648['limit']===_0xb9d9('0x19');var _0x5617f1=_0x2c9039['count'];var _0x2b5e26=_0x3909ab?0x0:_0x3db648[_0xb9d9('0x18')];var _0x1e775d=_0x3909ab?_0x2c9039['count']:_0x3db648[_0xb9d9('0x18')]+_0x3db648[_0xb9d9('0x1a')];var _0x493552;if(_0x1e775d>=_0x5617f1){_0x1e775d=_0x5617f1;_0x493552=0xc8;}else{_0x493552=0xce;}_0x4c8864[_0xb9d9('0x16')](_0x493552);return _0x4c8864[_0xb9d9('0x1b')]('Content-Range',_0x2b5e26+'-'+_0x1e775d+'/'+_0x5617f1)[_0xb9d9('0x1c')](_0x2c9039);}return null;};}function patchUpdates(_0x36d55e){return function(_0x50f0ec){try{jsonpatch[_0xb9d9('0x1d')](_0x50f0ec,_0x36d55e,!![]);}catch(_0x42ca87){return BPromise[_0xb9d9('0x1e')](_0x42ca87);}return _0x50f0ec[_0xb9d9('0x1f')]();};}function saveUpdates(_0x288ccd,_0x362104){return function(_0x4c4230){if(_0x4c4230){return _0x4c4230[_0xb9d9('0x20')](_0x288ccd)[_0xb9d9('0x21')](function(_0x53c82a){return _0x53c82a;});}return null;};}function removeEntity(_0x45520b,_0x3d61bf){return function(_0x43bcab){if(_0x43bcab){return _0x43bcab[_0xb9d9('0x22')]()['then'](function(){_0x45520b[_0xb9d9('0x16')](0xcc)[_0xb9d9('0x17')]();});}};}function handleEntityNotFound(_0x6fa6af,_0x436cb7){return function(_0x2650f7){if(!_0x2650f7){_0x6fa6af[_0xb9d9('0x15')](0x194);}return _0x2650f7;};}function handleError(_0x56b394,_0x321937){_0x321937=_0x321937||0x1f4;return function(_0x42181d){logger[_0xb9d9('0x23')](_0x42181d['stack']);if(_0x42181d[_0xb9d9('0x24')]){delete _0x42181d[_0xb9d9('0x24')];}_0x56b394[_0xb9d9('0x16')](_0x321937)[_0xb9d9('0x25')](_0x42181d);};}exports[_0xb9d9('0x26')]=function(_0x402968,_0x89f901){var _0x5c74eb={'raw':!![],'where':{'id':_0x402968[_0xb9d9('0x27')]['id']}},_0x39f006={};_0x39f006[_0xb9d9('0x28')]=_[_0xb9d9('0x29')](db[_0xb9d9('0x2a')][_0xb9d9('0x2b')]);_0x39f006['query']=_[_0xb9d9('0x29')](_0x402968[_0xb9d9('0x2c')]);_0x39f006[_0xb9d9('0x2d')]=_[_0xb9d9('0x2e')](_0x39f006['model'],_0x39f006[_0xb9d9('0x2c')]);_0x5c74eb[_0xb9d9('0x2f')]=_[_0xb9d9('0x2e')](_0x39f006[_0xb9d9('0x28')],qs[_0xb9d9('0x30')](_0x402968[_0xb9d9('0x2c')]['fields']));_0x5c74eb['attributes']=_0x5c74eb[_0xb9d9('0x2f')]['length']?_0x5c74eb[_0xb9d9('0x2f')]:_0x39f006[_0xb9d9('0x28')];if(_0x402968[_0xb9d9('0x2c')]['includeAll']){_0x5c74eb[_0xb9d9('0x31')]=[{'all':!![]}];}_0x5c74eb=_[_0xb9d9('0x32')]({},_0x5c74eb,_0x402968[_0xb9d9('0x33')]);return db[_0xb9d9('0x2a')][_0xb9d9('0x34')](_0x5c74eb)[_0xb9d9('0x21')](handleEntityNotFound(_0x89f901,null))[_0xb9d9('0x21')](respondWithResult(_0x89f901,null))[_0xb9d9('0x35')](handleError(_0x89f901,null));};exports[_0xb9d9('0x20')]=function(_0x4d3a2b,_0x4f3d78){if(_0x4d3a2b['body']['id']){delete _0x4d3a2b[_0xb9d9('0x36')]['id'];}return db[_0xb9d9('0x2a')][_0xb9d9('0x34')]({'where':{'id':_0x4d3a2b[_0xb9d9('0x27')]['id']}})[_0xb9d9('0x21')](handleEntityNotFound(_0x4f3d78,null))[_0xb9d9('0x21')](saveUpdates(_0x4d3a2b['body'],null))['then'](respondWithResult(_0x4f3d78,null))['catch'](handleError(_0x4f3d78,null));};exports[_0xb9d9('0x22')]=function(_0x248168,_0x1f042f){return db[_0xb9d9('0x2a')][_0xb9d9('0x34')]({'where':{'id':_0x248168[_0xb9d9('0x27')]['id']}})[_0xb9d9('0x21')](handleEntityNotFound(_0x1f042f,null))[_0xb9d9('0x21')](removeEntity(_0x1f042f,null))[_0xb9d9('0x35')](handleError(_0x1f042f,null));}; \ No newline at end of file +var _0x3670=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','offset','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','params','model','ChatApplication','rawAttributes','query','keys','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x43b689,_0x1dc98b){var _0x548a2d=function(_0x3993e7){while(--_0x3993e7){_0x43b689['push'](_0x43b689['shift']());}};_0x548a2d(++_0x1dc98b);}(_0x3670,0x16c));var _0x0367=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3670[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0367('0x0'));var zipdir=require(_0x0367('0x1'));var jsonpatch=require(_0x0367('0x2'));var rp=require(_0x0367('0x3'));var moment=require(_0x0367('0x4'));var BPromise=require(_0x0367('0x5'));var Mustache=require(_0x0367('0x6'));var util=require('util');var path=require(_0x0367('0x7'));var sox=require(_0x0367('0x8'));var csv=require(_0x0367('0x9'));var ejs=require(_0x0367('0xa'));var fs=require('fs');var fs_extra=require(_0x0367('0xb'));var _=require(_0x0367('0xc'));var squel=require(_0x0367('0xd'));var crypto=require(_0x0367('0xe'));var jsforce=require(_0x0367('0xf'));var deskjs=require(_0x0367('0x10'));var toCsv=require(_0x0367('0x9'));var querystring=require(_0x0367('0x11'));var Papa=require(_0x0367('0x12'));var Redis=require(_0x0367('0x13'));var authService=require(_0x0367('0x14'));var qs=require(_0x0367('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0367('0x16'));var logger=require('../../config/logger')(_0x0367('0x17'));var utils=require(_0x0367('0x18'));var config=require(_0x0367('0x19'));var licenseUtil=require(_0x0367('0x1a'));var db=require(_0x0367('0x1b'))['db'];function respondWithStatusCode(_0x20a7ce,_0x15a55c){_0x15a55c=_0x15a55c||0xcc;return function(_0xf54c3f){if(_0xf54c3f){return _0x20a7ce['sendStatus'](_0x15a55c);}return _0x20a7ce[_0x0367('0x1c')](_0x15a55c)[_0x0367('0x1d')]();};}function respondWithResult(_0x537439,_0x30c673){_0x30c673=_0x30c673||0xc8;return function(_0x2b7b12){if(_0x2b7b12){return _0x537439[_0x0367('0x1c')](_0x30c673)['json'](_0x2b7b12);}};}function respondWithFilteredResult(_0x314841,_0x14090f){return function(_0x435e6f){if(_0x435e6f){var _0x32391b=typeof _0x14090f['offset']==='undefined'&&typeof _0x14090f[_0x0367('0x1e')]===_0x0367('0x1f');var _0x480fba=_0x435e6f['count'];var _0x486b45=_0x32391b?0x0:_0x14090f[_0x0367('0x20')];var _0x472837=_0x32391b?_0x435e6f[_0x0367('0x21')]:_0x14090f[_0x0367('0x20')]+_0x14090f['limit'];var _0x2073f4;if(_0x472837>=_0x480fba){_0x472837=_0x480fba;_0x2073f4=0xc8;}else{_0x2073f4=0xce;}_0x314841[_0x0367('0x1c')](_0x2073f4);return _0x314841[_0x0367('0x22')](_0x0367('0x23'),_0x486b45+'-'+_0x472837+'/'+_0x480fba)['json'](_0x435e6f);}return null;};}function patchUpdates(_0x5de2fd){return function(_0xbed137){try{jsonpatch[_0x0367('0x24')](_0xbed137,_0x5de2fd,!![]);}catch(_0x4d79da){return BPromise['reject'](_0x4d79da);}return _0xbed137[_0x0367('0x25')]();};}function saveUpdates(_0x1d7463,_0x3fbe62){return function(_0x8f0784){if(_0x8f0784){return _0x8f0784[_0x0367('0x26')](_0x1d7463)[_0x0367('0x27')](function(_0x2681b3){return _0x2681b3;});}return null;};}function removeEntity(_0x42e48e,_0x56e057){return function(_0x5ee1c7){if(_0x5ee1c7){return _0x5ee1c7[_0x0367('0x28')]()[_0x0367('0x27')](function(){_0x42e48e[_0x0367('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b5dce,_0x3aeb2e){return function(_0x520a84){if(!_0x520a84){_0x5b5dce[_0x0367('0x29')](0x194);}return _0x520a84;};}function handleError(_0x285312,_0x3c1564){_0x3c1564=_0x3c1564||0x1f4;return function(_0x2478b5){logger[_0x0367('0x2a')](_0x2478b5['stack']);if(_0x2478b5[_0x0367('0x2b')]){delete _0x2478b5[_0x0367('0x2b')];}_0x285312[_0x0367('0x1c')](_0x3c1564)[_0x0367('0x2c')](_0x2478b5);};}exports['show']=function(_0x2ed10e,_0x34eba6){var _0x156038={'raw':!![],'where':{'id':_0x2ed10e[_0x0367('0x2d')]['id']}},_0x4f19a0={};_0x4f19a0[_0x0367('0x2e')]=_['keys'](db[_0x0367('0x2f')][_0x0367('0x30')]);_0x4f19a0[_0x0367('0x31')]=_[_0x0367('0x32')](_0x2ed10e[_0x0367('0x31')]);_0x4f19a0['filters']=_[_0x0367('0x33')](_0x4f19a0['model'],_0x4f19a0[_0x0367('0x31')]);_0x156038[_0x0367('0x34')]=_[_0x0367('0x33')](_0x4f19a0[_0x0367('0x2e')],qs[_0x0367('0x35')](_0x2ed10e[_0x0367('0x31')]['fields']));_0x156038[_0x0367('0x34')]=_0x156038[_0x0367('0x34')][_0x0367('0x36')]?_0x156038['attributes']:_0x4f19a0[_0x0367('0x2e')];if(_0x2ed10e[_0x0367('0x31')][_0x0367('0x37')]){_0x156038[_0x0367('0x38')]=[{'all':!![]}];}_0x156038=_[_0x0367('0x39')]({},_0x156038,_0x2ed10e[_0x0367('0x3a')]);return db['ChatApplication'][_0x0367('0x3b')](_0x156038)['then'](handleEntityNotFound(_0x34eba6,null))[_0x0367('0x27')](respondWithResult(_0x34eba6,null))[_0x0367('0x3c')](handleError(_0x34eba6,null));};exports[_0x0367('0x26')]=function(_0x5ee938,_0x33395f){if(_0x5ee938['body']['id']){delete _0x5ee938['body']['id'];}return db[_0x0367('0x2f')][_0x0367('0x3b')]({'where':{'id':_0x5ee938[_0x0367('0x2d')]['id']}})[_0x0367('0x27')](handleEntityNotFound(_0x33395f,null))['then'](saveUpdates(_0x5ee938[_0x0367('0x3d')],null))[_0x0367('0x27')](respondWithResult(_0x33395f,null))[_0x0367('0x3c')](handleError(_0x33395f,null));};exports[_0x0367('0x28')]=function(_0x5d60c3,_0x5b41c5){return db[_0x0367('0x2f')][_0x0367('0x3b')]({'where':{'id':_0x5d60c3[_0x0367('0x2d')]['id']}})[_0x0367('0x27')](handleEntityNotFound(_0x5b41c5,null))[_0x0367('0x27')](removeEntity(_0x5b41c5,null))[_0x0367('0x3c')](handleError(_0x5b41c5,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 8b1affe..60c6344 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 _0xd3c6=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x40cbac,_0x20e179){var _0x33eaee=function(_0x15f461){while(--_0x15f461){_0x40cbac['push'](_0x40cbac['shift']());}};_0x33eaee(++_0x20e179);}(_0xd3c6,0x121));var _0x6d3c=function(_0x581c38,_0x7888d9){_0x581c38=_0x581c38-0x0;var _0x17bd29=_0xd3c6[_0x581c38];return _0x17bd29;};'use strict';var _=require(_0x6d3c('0x0'));var util=require(_0x6d3c('0x1'));var logger=require(_0x6d3c('0x2'))(_0x6d3c('0x3'));var moment=require(_0x6d3c('0x4'));var BPromise=require(_0x6d3c('0x5'));var rp=require(_0x6d3c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6d3c('0x7'));var config=require(_0x6d3c('0x8'));var attributes=require('./chatApplication.attributes');module[_0x6d3c('0x9')]=function(_0x28bc65,_0xbc627e){return _0x28bc65[_0x6d3c('0xa')](_0x6d3c('0xb'),attributes,{'tableName':_0x6d3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6d3c('0xd'),'collate':_0x6d3c('0xe')});}; \ No newline at end of file +var _0xc343=['bluebird','path','../../config/environment','./chatApplication.attributes','exports','define','chat_applications','util','../../config/logger','api','moment'];(function(_0x2cbc82,_0x30d15a){var _0x222f31=function(_0x51bc14){while(--_0x51bc14){_0x2cbc82['push'](_0x2cbc82['shift']());}};_0x222f31(++_0x30d15a);}(_0xc343,0x1bf));var _0x3c34=function(_0x4e5d3b,_0x387dcd){_0x4e5d3b=_0x4e5d3b-0x0;var _0x58bf80=_0xc343[_0x4e5d3b];return _0x58bf80;};'use strict';var _=require('lodash');var util=require(_0x3c34('0x0'));var logger=require(_0x3c34('0x1'))(_0x3c34('0x2'));var moment=require(_0x3c34('0x3'));var BPromise=require(_0x3c34('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c34('0x5'));var rimraf=require('rimraf');var config=require(_0x3c34('0x6'));var attributes=require(_0x3c34('0x7'));module[_0x3c34('0x8')]=function(_0x207bfd,_0x41db89){return _0x207bfd[_0x3c34('0x9')]('ChatApplication',attributes,{'tableName':_0x3c34('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index cd1657f..22f7a43 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 _0x7726=['catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7726,0xf3));var _0x6772=function(_0x133ea1,_0x337441){_0x133ea1=_0x133ea1-0x0;var _0xaa1252=_0x7726[_0x133ea1];return _0xaa1252;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6772('0x0'));var BPromise=require(_0x6772('0x1'));var rs=require(_0x6772('0x2'));var fs=require('fs');var Redis=require(_0x6772('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6772('0x4'));var logger=require(_0x6772('0x5'))(_0x6772('0x6'));var config=require(_0x6772('0x7'));var jayson=require(_0x6772('0x8'));var client=jayson[_0x6772('0x9')][_0x6772('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18a406,_0x4f9d4a,_0x309a80){return new BPromise(function(_0x579b82,_0x7cb360){return client[_0x6772('0xb')](_0x18a406,_0x309a80)['then'](function(_0xf36512){logger[_0x6772('0xc')](_0x6772('0xd'),_0x4f9d4a,_0x6772('0xe'));logger[_0x6772('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4f9d4a,_0x6772('0xe'),JSON[_0x6772('0x10')](_0xf36512));if(_0xf36512[_0x6772('0x11')]){if(_0xf36512[_0x6772('0x11')][_0x6772('0x12')]===0x1f4){logger[_0x6772('0x11')](_0x6772('0xd'),_0x4f9d4a,_0xf36512[_0x6772('0x11')][_0x6772('0x13')]);return _0x7cb360(_0xf36512[_0x6772('0x11')][_0x6772('0x13')]);}logger['error'](_0x6772('0xd'),_0x4f9d4a,_0xf36512[_0x6772('0x11')][_0x6772('0x13')]);return _0x579b82(_0xf36512[_0x6772('0x11')][_0x6772('0x13')]);}else{logger[_0x6772('0xc')](_0x6772('0xd'),_0x4f9d4a,_0x6772('0xe'));_0x579b82(_0xf36512[_0x6772('0x14')][_0x6772('0x13')]);}})[_0x6772('0x15')](function(_0x522e06){logger[_0x6772('0x11')](_0x6772('0xd'),_0x4f9d4a,_0x522e06);_0x7cb360(_0x522e06);});});} \ No newline at end of file +var _0x2f0f=['ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x31fb00,_0x4f2099){var _0x2f2ad6=function(_0x45b074){while(--_0x45b074){_0x31fb00['push'](_0x31fb00['shift']());}};_0x2f2ad6(++_0x4f2099);}(_0x2f0f,0x15c));var _0xf2f0=function(_0x12723c,_0x148a5a){_0x12723c=_0x12723c-0x0;var _0x3fc804=_0x2f0f[_0x12723c];return _0x3fc804;};'use strict';var _=require('lodash');var util=require(_0xf2f0('0x0'));var moment=require(_0xf2f0('0x1'));var BPromise=require('bluebird');var rs=require(_0xf2f0('0x2'));var fs=require('fs');var Redis=require(_0xf2f0('0x3'));var db=require(_0xf2f0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf2f0('0x5'));var config=require(_0xf2f0('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf2f0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x254508,_0x42aa09,_0x342610){return new BPromise(function(_0x15118e,_0x1199cb){return client['request'](_0x254508,_0x342610)[_0xf2f0('0x8')](function(_0x4c04b3){logger[_0xf2f0('0x9')](_0xf2f0('0xa'),_0x42aa09,_0xf2f0('0xb'));logger[_0xf2f0('0xc')](_0xf2f0('0xd'),_0x42aa09,'request\x20sent',JSON['stringify'](_0x4c04b3));if(_0x4c04b3[_0xf2f0('0xe')]){if(_0x4c04b3[_0xf2f0('0xe')][_0xf2f0('0xf')]===0x1f4){logger[_0xf2f0('0xe')](_0xf2f0('0xa'),_0x42aa09,_0x4c04b3[_0xf2f0('0xe')][_0xf2f0('0x10')]);return _0x1199cb(_0x4c04b3['error'][_0xf2f0('0x10')]);}logger[_0xf2f0('0xe')](_0xf2f0('0xa'),_0x42aa09,_0x4c04b3[_0xf2f0('0xe')]['message']);return _0x15118e(_0x4c04b3['error']['message']);}else{logger[_0xf2f0('0x9')](_0xf2f0('0xa'),_0x42aa09,_0xf2f0('0xb'));_0x15118e(_0x4c04b3[_0xf2f0('0x11')]['message']);}})[_0xf2f0('0x12')](function(_0x3be6b3){logger[_0xf2f0('0xe')](_0xf2f0('0xa'),_0x42aa09,_0x3be6b3);_0x1199cb(_0x3be6b3);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 8d85d9b..9e07c67 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 _0x0a58=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x584ba9,_0x43f019){var _0x53864c=function(_0x1a35e0){while(--_0x1a35e0){_0x584ba9['push'](_0x584ba9['shift']());}};_0x53864c(++_0x43f019);}(_0x0a58,0xf7));var _0x80a5=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0a58[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x80a5('0x0'));var util=require(_0x80a5('0x1'));var path=require(_0x80a5('0x2'));var timeout=require(_0x80a5('0x3'));var express=require(_0x80a5('0x4'));var router=express[_0x80a5('0x5')]();var fs_extra=require(_0x80a5('0x6'));var auth=require(_0x80a5('0x7'));var interaction=require(_0x80a5('0x8'));var config=require(_0x80a5('0x9'));var controller=require(_0x80a5('0xa'));router[_0x80a5('0xb')](_0x80a5('0xc'),auth[_0x80a5('0xd')](),controller[_0x80a5('0xe')]);router[_0x80a5('0xf')](_0x80a5('0xc'),auth[_0x80a5('0xd')](),controller[_0x80a5('0x10')]);router['delete'](_0x80a5('0xc'),auth[_0x80a5('0xd')](),controller[_0x80a5('0x11')]);module['exports']=router; \ No newline at end of file +var _0x680a=['./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3741a3,_0xc3e3e0){var _0x1b32a6=function(_0x670035){while(--_0x670035){_0x3741a3['push'](_0x3741a3['shift']());}};_0x1b32a6(++_0xc3e3e0);}(_0x680a,0x8e));var _0xa680=function(_0x43d51d,_0x1618ed){_0x43d51d=_0x43d51d-0x0;var _0x3ddbb7=_0x680a[_0x43d51d];return _0x3ddbb7;};'use strict';var multer=require(_0xa680('0x0'));var util=require(_0xa680('0x1'));var path=require(_0xa680('0x2'));var timeout=require(_0xa680('0x3'));var express=require(_0xa680('0x4'));var router=express[_0xa680('0x5')]();var fs_extra=require(_0xa680('0x6'));var auth=require(_0xa680('0x7'));var interaction=require(_0xa680('0x8'));var config=require(_0xa680('0x9'));var controller=require(_0xa680('0xa'));router[_0xa680('0xb')](_0xa680('0xc'),auth[_0xa680('0xd')](),controller[_0xa680('0xe')]);router[_0xa680('0xf')](_0xa680('0xc'),auth[_0xa680('0xd')](),controller[_0xa680('0x10')]);router[_0xa680('0x11')](_0xa680('0xc'),auth[_0xa680('0xd')](),controller['destroy']);module[_0xa680('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 70a8961..23f917e 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 _0x4656=['STRING','BOOLEAN','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4656,0x110));var _0x6465=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x4656[_0x50bf5a];return _0x4ddc1d;};'use strict';var Sequelize=require('sequelize');module[_0x6465('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6465('0x1')]},'write':{'type':Sequelize[_0x6465('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x720e=['sequelize','exports','STRING','BOOLEAN'];(function(_0x47bfb2,_0x1d1e19){var _0x3f0d83=function(_0x106276){while(--_0x106276){_0x47bfb2['push'](_0x47bfb2['shift']());}};_0x3f0d83(++_0x1d1e19);}(_0x720e,0x18c));var _0xe720=function(_0x2c69a1,_0x201903){_0x2c69a1=_0x2c69a1-0x0;var _0x24bb91=_0x720e[_0x2c69a1];return _0x24bb91;};'use strict';var Sequelize=require(_0xe720('0x0'));module[_0xe720('0x1')]={'name':{'type':Sequelize[_0xe720('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe720('0x2')]},'write':{'type':Sequelize[_0xe720('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index d4e2594..b3d5b37 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 _0x6d42=['count','set','Content-Range','reject','update','destroy','error','name','index','ChatGroup','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','then','findAll','rows','catch','keys','includeAll','include','find','create','body','params','describe','getUnread','toInteger','addMembers','getMembers','findOne','removeMembers','ids','ChatGroupId','ChatInternalMessage','split','format','getMessages','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x5049a7,_0xad7685){var _0x2f8aa9=function(_0x513a47){while(--_0x513a47){_0x5049a7['push'](_0x5049a7['shift']());}};_0x2f8aa9(++_0xad7685);}(_0x6d42,0xf0));var _0x26d4=function(_0x3c44fb,_0x15784c){_0x3c44fb=_0x3c44fb-0x0;var _0x338641=_0x6d42[_0x3c44fb];return _0x338641;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x26d4('0x0'));var jsonpatch=require(_0x26d4('0x1'));var rp=require(_0x26d4('0x2'));var moment=require(_0x26d4('0x3'));var BPromise=require(_0x26d4('0x4'));var Mustache=require('mustache');var util=require(_0x26d4('0x5'));var path=require(_0x26d4('0x6'));var sox=require(_0x26d4('0x7'));var csv=require(_0x26d4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26d4('0x9'));var _=require(_0x26d4('0xa'));var squel=require('squel');var crypto=require(_0x26d4('0xb'));var jsforce=require(_0x26d4('0xc'));var deskjs=require(_0x26d4('0xd'));var toCsv=require(_0x26d4('0x8'));var querystring=require(_0x26d4('0xe'));var Papa=require(_0x26d4('0xf'));var Redis=require(_0x26d4('0x10'));var authService=require(_0x26d4('0x11'));var qs=require(_0x26d4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x26d4('0x13'));var logger=require(_0x26d4('0x14'))(_0x26d4('0x15'));var utils=require(_0x26d4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x26d4('0x17'));var db=require(_0x26d4('0x18'))['db'];config[_0x26d4('0x19')]=_[_0x26d4('0x1a')](config[_0x26d4('0x19')],{'host':_0x26d4('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x26d4('0x1c'))['register'](socket);function respondWithStatusCode(_0xb2d516,_0x5c6146){_0x5c6146=_0x5c6146||0xcc;return function(_0x3d2879){if(_0x3d2879){return _0xb2d516[_0x26d4('0x1d')](_0x5c6146);}return _0xb2d516[_0x26d4('0x1e')](_0x5c6146)[_0x26d4('0x1f')]();};}function respondWithResult(_0x243116,_0x4088f9){_0x4088f9=_0x4088f9||0xc8;return function(_0x50fc53){if(_0x50fc53){return _0x243116[_0x26d4('0x1e')](_0x4088f9)[_0x26d4('0x20')](_0x50fc53);}};}function respondWithFilteredResult(_0xf9b387,_0x1e6f5c){return function(_0x5384b7){if(_0x5384b7){var _0x1c3c2c=typeof _0x1e6f5c[_0x26d4('0x21')]===_0x26d4('0x22')&&typeof _0x1e6f5c[_0x26d4('0x23')]===_0x26d4('0x22');var _0x54a358=_0x5384b7[_0x26d4('0x24')];var _0x2cc6c8=_0x1c3c2c?0x0:_0x1e6f5c[_0x26d4('0x21')];var _0x50848c=_0x1c3c2c?_0x5384b7[_0x26d4('0x24')]:_0x1e6f5c['offset']+_0x1e6f5c[_0x26d4('0x23')];var _0x543940;if(_0x50848c>=_0x54a358){_0x50848c=_0x54a358;_0x543940=0xc8;}else{_0x543940=0xce;}_0xf9b387[_0x26d4('0x1e')](_0x543940);return _0xf9b387[_0x26d4('0x25')](_0x26d4('0x26'),_0x2cc6c8+'-'+_0x50848c+'/'+_0x54a358)['json'](_0x5384b7);}return null;};}function patchUpdates(_0x37c6b3){return function(_0x1c3869){try{jsonpatch['apply'](_0x1c3869,_0x37c6b3,!![]);}catch(_0x5b0776){return BPromise[_0x26d4('0x27')](_0x5b0776);}return _0x1c3869['save']();};}function saveUpdates(_0x49b460,_0x3bfed2){return function(_0x1b0851){if(_0x1b0851){return _0x1b0851[_0x26d4('0x28')](_0x49b460)['then'](function(_0x1d4276){return _0x1d4276;});}return null;};}function removeEntity(_0x428a69,_0x5eca70){return function(_0x74abb6){if(_0x74abb6){return _0x74abb6[_0x26d4('0x29')]()['then'](function(){_0x428a69[_0x26d4('0x1e')](0xcc)[_0x26d4('0x1f')]();});}};}function handleEntityNotFound(_0x33c78b,_0x58cb99){return function(_0x31a39b){if(!_0x31a39b){_0x33c78b[_0x26d4('0x1d')](0x194);}return _0x31a39b;};}function handleError(_0x5e7358,_0x129701){_0x129701=_0x129701||0x1f4;return function(_0x55d8a5){logger[_0x26d4('0x2a')](_0x55d8a5['stack']);if(_0x55d8a5[_0x26d4('0x2b')]){delete _0x55d8a5[_0x26d4('0x2b')];}_0x5e7358[_0x26d4('0x1e')](_0x129701)['send'](_0x55d8a5);};}exports[_0x26d4('0x2c')]=function(_0x11eda0,_0x1b34a9){var _0x414000={},_0x1211ed={},_0x366302={'count':0x0,'rows':[]};var _0xf35d47=_['map'](db[_0x26d4('0x2d')][_0x26d4('0x2e')],function(_0x511a9a){return{'name':_0x511a9a[_0x26d4('0x2f')],'type':_0x511a9a[_0x26d4('0x30')][_0x26d4('0x31')]};});_0x1211ed[_0x26d4('0x32')]=_[_0x26d4('0x33')](_0xf35d47,_0x26d4('0x2b'));_0x1211ed[_0x26d4('0x34')]=_['keys'](_0x11eda0[_0x26d4('0x34')]);_0x1211ed[_0x26d4('0x35')]=_[_0x26d4('0x36')](_0x1211ed[_0x26d4('0x32')],_0x1211ed['query']);_0x414000[_0x26d4('0x37')]=_[_0x26d4('0x36')](_0x1211ed[_0x26d4('0x32')],qs[_0x26d4('0x38')](_0x11eda0['query'][_0x26d4('0x38')]));_0x414000['attributes']=_0x414000['attributes'][_0x26d4('0x39')]?_0x414000[_0x26d4('0x37')]:_0x1211ed[_0x26d4('0x32')];if(!_0x11eda0[_0x26d4('0x34')][_0x26d4('0x3a')](_0x26d4('0x3b'))){_0x414000[_0x26d4('0x23')]=qs[_0x26d4('0x23')](_0x11eda0[_0x26d4('0x34')][_0x26d4('0x23')]);_0x414000[_0x26d4('0x21')]=qs['offset'](_0x11eda0[_0x26d4('0x34')][_0x26d4('0x21')]);}_0x414000[_0x26d4('0x3c')]=qs[_0x26d4('0x3d')](_0x11eda0[_0x26d4('0x34')][_0x26d4('0x3d')]);_0x414000['where']=qs[_0x26d4('0x35')](_[_0x26d4('0x3e')](_0x11eda0[_0x26d4('0x34')],_0x1211ed['filters']),_0xf35d47);if(_0x11eda0['query'][_0x26d4('0x3f')]){_0x414000[_0x26d4('0x40')]=_['merge'](_0x414000['where'],{'$or':_['map'](_0xf35d47,function(_0x59e6fd){if(_0x59e6fd[_0x26d4('0x30')]!==_0x26d4('0x41')){var _0x523bd7={};_0x523bd7[_0x59e6fd[_0x26d4('0x2b')]]={'$like':'%'+_0x11eda0[_0x26d4('0x34')][_0x26d4('0x3f')]+'%'};return _0x523bd7;}})});}_0x414000=_[_0x26d4('0x42')]({},_0x414000,_0x11eda0[_0x26d4('0x43')]);var _0x6c001b={'where':_0x414000[_0x26d4('0x40')]};return db[_0x26d4('0x2d')][_0x26d4('0x24')](_0x6c001b)[_0x26d4('0x44')](function(_0x556140){_0x366302[_0x26d4('0x24')]=_0x556140;if(_0x11eda0['query']['includeAll']){_0x414000['include']=[{'all':!![]}];}return db[_0x26d4('0x2d')][_0x26d4('0x45')](_0x414000);})['then'](function(_0x353c67){_0x366302[_0x26d4('0x46')]=_0x353c67;return _0x366302;})[_0x26d4('0x44')](respondWithFilteredResult(_0x1b34a9,_0x414000))[_0x26d4('0x47')](handleError(_0x1b34a9,null));};exports['show']=function(_0x2ef78a,_0x2e550d){var _0x5f6898={'raw':!![],'where':{'id':_0x2ef78a['params']['id']}},_0x55fe34={};_0x55fe34[_0x26d4('0x32')]=_[_0x26d4('0x48')](db['ChatGroup']['rawAttributes']);_0x55fe34[_0x26d4('0x34')]=_[_0x26d4('0x48')](_0x2ef78a['query']);_0x55fe34['filters']=_[_0x26d4('0x36')](_0x55fe34[_0x26d4('0x32')],_0x55fe34[_0x26d4('0x34')]);_0x5f6898[_0x26d4('0x37')]=_[_0x26d4('0x36')](_0x55fe34[_0x26d4('0x32')],qs[_0x26d4('0x38')](_0x2ef78a[_0x26d4('0x34')][_0x26d4('0x38')]));_0x5f6898[_0x26d4('0x37')]=_0x5f6898[_0x26d4('0x37')][_0x26d4('0x39')]?_0x5f6898['attributes']:_0x55fe34[_0x26d4('0x32')];if(_0x2ef78a['query'][_0x26d4('0x49')]){_0x5f6898[_0x26d4('0x4a')]=[{'all':!![]}];}_0x5f6898=_[_0x26d4('0x42')]({},_0x5f6898,_0x2ef78a[_0x26d4('0x43')]);return db[_0x26d4('0x2d')][_0x26d4('0x4b')](_0x5f6898)['then'](handleEntityNotFound(_0x2e550d,null))[_0x26d4('0x44')](respondWithResult(_0x2e550d,null))[_0x26d4('0x47')](handleError(_0x2e550d,null));};exports['create']=function(_0x188d53,_0x2ad1a3){return db['ChatGroup'][_0x26d4('0x4c')](_0x188d53[_0x26d4('0x4d')],{})[_0x26d4('0x44')](respondWithResult(_0x2ad1a3,0xc9))['catch'](handleError(_0x2ad1a3,null));};exports[_0x26d4('0x28')]=function(_0x6b6f05,_0x45a71d){if(_0x6b6f05[_0x26d4('0x4d')]['id']){delete _0x6b6f05[_0x26d4('0x4d')]['id'];}return db[_0x26d4('0x2d')][_0x26d4('0x4b')]({'where':{'id':_0x6b6f05[_0x26d4('0x4e')]['id']}})[_0x26d4('0x44')](handleEntityNotFound(_0x45a71d,null))[_0x26d4('0x44')](saveUpdates(_0x6b6f05[_0x26d4('0x4d')],null))[_0x26d4('0x44')](respondWithResult(_0x45a71d,null))[_0x26d4('0x47')](handleError(_0x45a71d,null));};exports[_0x26d4('0x29')]=function(_0x2ec730,_0x46d6f2){return db[_0x26d4('0x2d')]['find']({'where':{'id':_0x2ec730[_0x26d4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x46d6f2,null))[_0x26d4('0x44')](removeEntity(_0x46d6f2,null))[_0x26d4('0x47')](handleError(_0x46d6f2,null));};exports[_0x26d4('0x4f')]=function(_0x1204ac,_0x3f4975){return db[_0x26d4('0x2d')][_0x26d4('0x4f')]()[_0x26d4('0x44')](respondWithResult(_0x3f4975,null))[_0x26d4('0x47')](handleError(_0x3f4975,null));};exports[_0x26d4('0x50')]=function(_0x8c5b85,_0x4675f6,_0x39f658){return db['ChatInternalMessage'][_0x26d4('0x24')]({'where':{'ChatGroupId':_0x8c5b85['params']['id'],'ToId':_0x8c5b85['user']['id'],'read':![]}})['then'](function(_0x22e560){return{'id':_[_0x26d4('0x51')](_0x8c5b85[_0x26d4('0x4e')]['id']),'count':_0x22e560};})[_0x26d4('0x44')](respondWithResult(_0x4675f6,null))[_0x26d4('0x47')](handleError(_0x4675f6,null));};exports[_0x26d4('0x52')]=function(_0x3a750e,_0x44fba4,_0x17bd56){return db[_0x26d4('0x2d')][_0x26d4('0x4b')]({'where':{'id':_0x3a750e[_0x26d4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x44fba4,null))['then'](function(_0x537e99){if(_0x537e99){return _0x537e99[_0x26d4('0x52')](_0x3a750e[_0x26d4('0x4d')]['ids'],_['omit'](_0x3a750e[_0x26d4('0x4d')],['ids','id'])||{});}})['then'](respondWithResult(_0x44fba4,null))[_0x26d4('0x47')](handleError(_0x44fba4,null));};exports[_0x26d4('0x53')]=function(_0x4e0034,_0x277377,_0x17a826){var _0x200e33={};var _0x4c2069={};var _0x53e86e;var _0x37a777;return db[_0x26d4('0x2d')][_0x26d4('0x54')]({'where':{'id':_0x4e0034['params']['id']}})['then'](handleEntityNotFound(_0x277377,null))[_0x26d4('0x44')](function(_0x44f3e6){if(_0x44f3e6){_0x53e86e=_0x44f3e6;_0x4c2069[_0x26d4('0x32')]=_[_0x26d4('0x48')](db['User']['rawAttributes']);_0x4c2069[_0x26d4('0x34')]=_[_0x26d4('0x48')](_0x4e0034[_0x26d4('0x34')]);_0x4c2069[_0x26d4('0x35')]=_[_0x26d4('0x36')](_0x4c2069[_0x26d4('0x32')],_0x4c2069['query']);_0x200e33[_0x26d4('0x37')]=_['intersection'](_0x4c2069[_0x26d4('0x32')],qs['fields'](_0x4e0034[_0x26d4('0x34')][_0x26d4('0x38')]));_0x200e33[_0x26d4('0x37')]=_0x200e33[_0x26d4('0x37')][_0x26d4('0x39')]?_0x200e33[_0x26d4('0x37')]:_0x4c2069[_0x26d4('0x32')];_0x200e33['order']=qs[_0x26d4('0x3d')](_0x4e0034['query'][_0x26d4('0x3d')]);_0x200e33[_0x26d4('0x40')]=qs['filters'](_[_0x26d4('0x3e')](_0x4e0034[_0x26d4('0x34')],_0x4c2069[_0x26d4('0x35')]));if(_0x4e0034['query'][_0x26d4('0x3f')]){_0x200e33[_0x26d4('0x40')]=_['merge'](_0x200e33[_0x26d4('0x40')],{'$or':_[_0x26d4('0x33')](_0x200e33[_0x26d4('0x37')],function(_0x20cf5d){var _0xb2265e={};_0xb2265e[_0x20cf5d]={'$like':'%'+_0x4e0034[_0x26d4('0x34')][_0x26d4('0x3f')]+'%'};return _0xb2265e;})});}_0x200e33=_[_0x26d4('0x42')]({},_0x200e33,_0x4e0034[_0x26d4('0x43')]);return _0x53e86e[_0x26d4('0x53')](_0x200e33);}})['then'](function(_0x350804){if(_0x350804){_0x37a777=_0x350804['length'];if(!_0x4e0034[_0x26d4('0x34')][_0x26d4('0x3a')](_0x26d4('0x3b'))){_0x200e33[_0x26d4('0x23')]=qs[_0x26d4('0x23')](_0x4e0034[_0x26d4('0x34')][_0x26d4('0x23')]);_0x200e33['offset']=qs[_0x26d4('0x21')](_0x4e0034[_0x26d4('0x34')][_0x26d4('0x21')]);}return _0x53e86e[_0x26d4('0x53')](_0x200e33);}})[_0x26d4('0x44')](function(_0x412f35){if(_0x412f35){return _0x412f35?{'count':_0x37a777,'rows':_0x412f35}:null;}})[_0x26d4('0x44')](respondWithResult(_0x277377,null))['catch'](handleError(_0x277377,null));};exports[_0x26d4('0x55')]=function(_0x45afc3,_0x16841e,_0x55f956){return db[_0x26d4('0x2d')][_0x26d4('0x4b')]({'where':{'id':_0x45afc3['params']['id']}})[_0x26d4('0x44')](handleEntityNotFound(_0x16841e,null))[_0x26d4('0x44')](function(_0x49977a){if(_0x49977a){return _0x49977a['removeMembers'](_0x45afc3['query'][_0x26d4('0x56')]);}})[_0x26d4('0x44')](respondWithStatusCode(_0x16841e,null))[_0x26d4('0x47')](handleError(_0x16841e,null));};exports['addMessage']=function(_0xf04c2b,_0x13ac4b,_0x4320e3){if(_0xf04c2b[_0x26d4('0x4d')]['id']){delete _0xf04c2b[_0x26d4('0x4d')]['id'];}return db[_0x26d4('0x2d')]['find']({'where':{'id':_0xf04c2b[_0x26d4('0x4e')]['id']}})[_0x26d4('0x44')](handleEntityNotFound(_0x13ac4b,null))[_0x26d4('0x44')](function(_0x28c51f){if(_0x28c51f){_0xf04c2b[_0x26d4('0x4d')][_0x26d4('0x57')]=_0x28c51f['id'];return db[_0x26d4('0x58')][_0x26d4('0x4c')](_0xf04c2b['body']);}})[_0x26d4('0x44')](respondWithResult(_0x13ac4b,null))[_0x26d4('0x47')](handleError(_0x13ac4b,null));};exports['getMessages']=function(_0x149942,_0x20e910,_0x4612df){var _0x32af9f={};var _0x1f4305={};var _0x5c648a;var _0x43d9ac;return db[_0x26d4('0x2d')][_0x26d4('0x54')]({'where':{'id':_0x149942[_0x26d4('0x4e')]['id']}})[_0x26d4('0x44')](handleEntityNotFound(_0x20e910,null))[_0x26d4('0x44')](function(_0x114aa0){if(_0x114aa0){_0x5c648a=_0x114aa0;_0x1f4305['model']=_[_0x26d4('0x48')](db[_0x26d4('0x58')][_0x26d4('0x2e')]);_0x1f4305[_0x26d4('0x34')]=_[_0x26d4('0x48')](_0x149942['query']);_0x1f4305[_0x26d4('0x35')]=_[_0x26d4('0x36')](_0x1f4305[_0x26d4('0x32')],_0x1f4305[_0x26d4('0x34')]);_0x32af9f[_0x26d4('0x37')]=_[_0x26d4('0x36')](_0x1f4305['model'],qs[_0x26d4('0x38')](_0x149942[_0x26d4('0x34')][_0x26d4('0x38')]));_0x32af9f[_0x26d4('0x37')]=_0x32af9f['attributes'][_0x26d4('0x39')]?_0x32af9f[_0x26d4('0x37')]:_0x1f4305[_0x26d4('0x32')];_0x32af9f[_0x26d4('0x3c')]=qs[_0x26d4('0x3d')](_0x149942['query'][_0x26d4('0x3d')]);_0x32af9f[_0x26d4('0x40')]=qs['filters'](_[_0x26d4('0x3e')](_0x149942[_0x26d4('0x34')],_0x1f4305[_0x26d4('0x35')]));if(_0x149942[_0x26d4('0x34')][_0x26d4('0x3f')]){_0x32af9f[_0x26d4('0x40')]=_['merge'](_0x32af9f[_0x26d4('0x40')],{'$or':_[_0x26d4('0x33')](_0x32af9f['attributes'],function(_0x414c83){var _0x24b710={};_0x24b710[_0x414c83]={'$like':'%'+_0x149942[_0x26d4('0x34')]['filter']+'%'};return _0x24b710;})});}if(_0x149942[_0x26d4('0x34')]['$gte']){var _0x248960=_0x149942['query']['$gte'][_0x26d4('0x59')](',');var _0x68e656={};_0x68e656[_0x248960[0x0]]={'$gte':moment(_0x248960[0x1])[_0x26d4('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x32af9f['where']=_['merge'](_0x32af9f[_0x26d4('0x40')],_0x68e656);}_0x32af9f=_[_0x26d4('0x42')]({},_0x32af9f,_0x149942['options']);return _0x5c648a[_0x26d4('0x5b')](_0x32af9f);}})[_0x26d4('0x44')](function(_0x570617){if(_0x570617){_0x43d9ac=_0x570617[_0x26d4('0x39')];if(!_0x149942[_0x26d4('0x34')][_0x26d4('0x3a')](_0x26d4('0x3b'))){_0x32af9f[_0x26d4('0x23')]=qs[_0x26d4('0x23')](_0x149942['query']['limit']);_0x32af9f[_0x26d4('0x21')]=qs[_0x26d4('0x21')](_0x149942[_0x26d4('0x34')][_0x26d4('0x21')]);}return _0x5c648a['getMessages'](_0x32af9f);}})[_0x26d4('0x44')](function(_0x30df09){if(_0x30df09){return _0x30df09?{'count':_0x43d9ac,'rows':_0x30df09}:null;}})[_0x26d4('0x44')](respondWithResult(_0x20e910,null))['catch'](handleError(_0x20e910,null));}; \ No newline at end of file +var _0x373c=['findOne','User','order','removeMembers','addMessage','getMessages','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','defaults','socket.io-emitter','redis','register','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','catch','params','include','create','body','find','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers'];(function(_0x1105a3,_0x4e9d4f){var _0x4853ad=function(_0x2bee34){while(--_0x2bee34){_0x1105a3['push'](_0x1105a3['shift']());}};_0x4853ad(++_0x4e9d4f);}(_0x373c,0xc6));var _0xc373=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x373c[_0x53fe97];return _0x5c49a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc373('0x0'));var zipdir=require(_0xc373('0x1'));var jsonpatch=require(_0xc373('0x2'));var rp=require(_0xc373('0x3'));var moment=require(_0xc373('0x4'));var BPromise=require(_0xc373('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc373('0x6'));var csv=require(_0xc373('0x7'));var ejs=require(_0xc373('0x8'));var fs=require('fs');var fs_extra=require(_0xc373('0x9'));var _=require(_0xc373('0xa'));var squel=require(_0xc373('0xb'));var crypto=require(_0xc373('0xc'));var jsforce=require(_0xc373('0xd'));var deskjs=require(_0xc373('0xe'));var toCsv=require(_0xc373('0x7'));var querystring=require(_0xc373('0xf'));var Papa=require('papaparse');var Redis=require(_0xc373('0x10'));var authService=require(_0xc373('0x11'));var qs=require(_0xc373('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc373('0x13'))(_0xc373('0x14'));var utils=require(_0xc373('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc373('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc373('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc373('0x18'))(new Redis(config[_0xc373('0x19')]));require('./chatGroup.socket')[_0xc373('0x1a')](socket);function respondWithStatusCode(_0x4b3ce7,_0x14e61a){_0x14e61a=_0x14e61a||0xcc;return function(_0x52a552){if(_0x52a552){return _0x4b3ce7[_0xc373('0x1b')](_0x14e61a);}return _0x4b3ce7[_0xc373('0x1c')](_0x14e61a)['end']();};}function respondWithResult(_0xa7f9ea,_0x52d6e6){_0x52d6e6=_0x52d6e6||0xc8;return function(_0x25db3a){if(_0x25db3a){return _0xa7f9ea[_0xc373('0x1c')](_0x52d6e6)[_0xc373('0x1d')](_0x25db3a);}};}function respondWithFilteredResult(_0x30161a,_0xe1023){return function(_0x3a5b7f){if(_0x3a5b7f){var _0x4f7dac=typeof _0xe1023['offset']===_0xc373('0x1e')&&typeof _0xe1023[_0xc373('0x1f')]===_0xc373('0x1e');var _0x5849a6=_0x3a5b7f[_0xc373('0x20')];var _0x1369da=_0x4f7dac?0x0:_0xe1023[_0xc373('0x21')];var _0x31ebb5=_0x4f7dac?_0x3a5b7f['count']:_0xe1023[_0xc373('0x21')]+_0xe1023[_0xc373('0x1f')];var _0x4ad470;if(_0x31ebb5>=_0x5849a6){_0x31ebb5=_0x5849a6;_0x4ad470=0xc8;}else{_0x4ad470=0xce;}_0x30161a[_0xc373('0x1c')](_0x4ad470);return _0x30161a[_0xc373('0x22')]('Content-Range',_0x1369da+'-'+_0x31ebb5+'/'+_0x5849a6)[_0xc373('0x1d')](_0x3a5b7f);}return null;};}function patchUpdates(_0x5ca17b){return function(_0x286af2){try{jsonpatch[_0xc373('0x23')](_0x286af2,_0x5ca17b,!![]);}catch(_0x1cb489){return BPromise[_0xc373('0x24')](_0x1cb489);}return _0x286af2[_0xc373('0x25')]();};}function saveUpdates(_0x535563,_0x57d822){return function(_0x34a9ac){if(_0x34a9ac){return _0x34a9ac[_0xc373('0x26')](_0x535563)['then'](function(_0xc8e045){return _0xc8e045;});}return null;};}function removeEntity(_0x18e2db,_0x4d8207){return function(_0x1caa16){if(_0x1caa16){return _0x1caa16[_0xc373('0x27')]()[_0xc373('0x28')](function(){_0x18e2db['status'](0xcc)[_0xc373('0x29')]();});}};}function handleEntityNotFound(_0x50584b,_0x3b6964){return function(_0x334fda){if(!_0x334fda){_0x50584b[_0xc373('0x1b')](0x194);}return _0x334fda;};}function handleError(_0x4462bb,_0x337cda){_0x337cda=_0x337cda||0x1f4;return function(_0x48d125){logger[_0xc373('0x2a')](_0x48d125[_0xc373('0x2b')]);if(_0x48d125[_0xc373('0x2c')]){delete _0x48d125[_0xc373('0x2c')];}_0x4462bb[_0xc373('0x1c')](_0x337cda)[_0xc373('0x2d')](_0x48d125);};}exports[_0xc373('0x2e')]=function(_0x10c4a1,_0x7e54ba){var _0x1f368b={},_0x4c29be={},_0x4c50c9={'count':0x0,'rows':[]};var _0x133c4a=_[_0xc373('0x2f')](db[_0xc373('0x30')][_0xc373('0x31')],function(_0x41e4b8){return{'name':_0x41e4b8[_0xc373('0x32')],'type':_0x41e4b8[_0xc373('0x33')]['key']};});_0x4c29be['model']=_[_0xc373('0x2f')](_0x133c4a,'name');_0x4c29be['query']=_[_0xc373('0x34')](_0x10c4a1['query']);_0x4c29be[_0xc373('0x35')]=_[_0xc373('0x36')](_0x4c29be[_0xc373('0x37')],_0x4c29be[_0xc373('0x38')]);_0x1f368b[_0xc373('0x39')]=_[_0xc373('0x36')](_0x4c29be[_0xc373('0x37')],qs['fields'](_0x10c4a1['query'][_0xc373('0x3a')]));_0x1f368b['attributes']=_0x1f368b[_0xc373('0x39')][_0xc373('0x3b')]?_0x1f368b[_0xc373('0x39')]:_0x4c29be[_0xc373('0x37')];if(!_0x10c4a1['query'][_0xc373('0x3c')](_0xc373('0x3d'))){_0x1f368b['limit']=qs[_0xc373('0x1f')](_0x10c4a1[_0xc373('0x38')][_0xc373('0x1f')]);_0x1f368b[_0xc373('0x21')]=qs[_0xc373('0x21')](_0x10c4a1[_0xc373('0x38')][_0xc373('0x21')]);}_0x1f368b['order']=qs[_0xc373('0x3e')](_0x10c4a1[_0xc373('0x38')][_0xc373('0x3e')]);_0x1f368b[_0xc373('0x3f')]=qs['filters'](_['pick'](_0x10c4a1[_0xc373('0x38')],_0x4c29be[_0xc373('0x35')]),_0x133c4a);if(_0x10c4a1[_0xc373('0x38')]['filter']){_0x1f368b[_0xc373('0x3f')]=_[_0xc373('0x40')](_0x1f368b['where'],{'$or':_[_0xc373('0x2f')](_0x133c4a,function(_0xb45f35){if(_0xb45f35[_0xc373('0x33')]!==_0xc373('0x41')){var _0x2e4d5e={};_0x2e4d5e[_0xb45f35[_0xc373('0x2c')]]={'$like':'%'+_0x10c4a1['query'][_0xc373('0x42')]+'%'};return _0x2e4d5e;}})});}_0x1f368b=_[_0xc373('0x40')]({},_0x1f368b,_0x10c4a1[_0xc373('0x43')]);var _0x54bd2f={'where':_0x1f368b[_0xc373('0x3f')]};return db['ChatGroup'][_0xc373('0x20')](_0x54bd2f)[_0xc373('0x28')](function(_0x436f7d){_0x4c50c9[_0xc373('0x20')]=_0x436f7d;if(_0x10c4a1[_0xc373('0x38')][_0xc373('0x44')]){_0x1f368b['include']=[{'all':!![]}];}return db['ChatGroup'][_0xc373('0x45')](_0x1f368b);})['then'](function(_0x23c818){_0x4c50c9['rows']=_0x23c818;return _0x4c50c9;})[_0xc373('0x28')](respondWithFilteredResult(_0x7e54ba,_0x1f368b))[_0xc373('0x46')](handleError(_0x7e54ba,null));};exports['show']=function(_0x22cfa2,_0x1bfc73){var _0x3db17b={'raw':!![],'where':{'id':_0x22cfa2[_0xc373('0x47')]['id']}},_0xd2373a={};_0xd2373a['model']=_[_0xc373('0x34')](db[_0xc373('0x30')][_0xc373('0x31')]);_0xd2373a[_0xc373('0x38')]=_[_0xc373('0x34')](_0x22cfa2[_0xc373('0x38')]);_0xd2373a[_0xc373('0x35')]=_[_0xc373('0x36')](_0xd2373a[_0xc373('0x37')],_0xd2373a[_0xc373('0x38')]);_0x3db17b[_0xc373('0x39')]=_[_0xc373('0x36')](_0xd2373a['model'],qs[_0xc373('0x3a')](_0x22cfa2[_0xc373('0x38')]['fields']));_0x3db17b[_0xc373('0x39')]=_0x3db17b[_0xc373('0x39')]['length']?_0x3db17b[_0xc373('0x39')]:_0xd2373a['model'];if(_0x22cfa2[_0xc373('0x38')][_0xc373('0x44')]){_0x3db17b[_0xc373('0x48')]=[{'all':!![]}];}_0x3db17b=_['merge']({},_0x3db17b,_0x22cfa2[_0xc373('0x43')]);return db[_0xc373('0x30')]['find'](_0x3db17b)[_0xc373('0x28')](handleEntityNotFound(_0x1bfc73,null))['then'](respondWithResult(_0x1bfc73,null))['catch'](handleError(_0x1bfc73,null));};exports[_0xc373('0x49')]=function(_0xc9268,_0x34c57e){return db['ChatGroup']['create'](_0xc9268[_0xc373('0x4a')],{})['then'](respondWithResult(_0x34c57e,0xc9))[_0xc373('0x46')](handleError(_0x34c57e,null));};exports['update']=function(_0x3057a4,_0x467057){if(_0x3057a4['body']['id']){delete _0x3057a4['body']['id'];}return db[_0xc373('0x30')][_0xc373('0x4b')]({'where':{'id':_0x3057a4[_0xc373('0x47')]['id']}})[_0xc373('0x28')](handleEntityNotFound(_0x467057,null))[_0xc373('0x28')](saveUpdates(_0x3057a4[_0xc373('0x4a')],null))[_0xc373('0x28')](respondWithResult(_0x467057,null))['catch'](handleError(_0x467057,null));};exports['destroy']=function(_0x36cb0c,_0xaf4d17){return db[_0xc373('0x30')]['find']({'where':{'id':_0x36cb0c[_0xc373('0x47')]['id']}})['then'](handleEntityNotFound(_0xaf4d17,null))[_0xc373('0x28')](removeEntity(_0xaf4d17,null))['catch'](handleError(_0xaf4d17,null));};exports[_0xc373('0x4c')]=function(_0x10e894,_0x32a01b){return db[_0xc373('0x30')][_0xc373('0x4c')]()['then'](respondWithResult(_0x32a01b,null))[_0xc373('0x46')](handleError(_0x32a01b,null));};exports[_0xc373('0x4d')]=function(_0x4f929b,_0x16d203,_0x1b9977){return db[_0xc373('0x4e')][_0xc373('0x20')]({'where':{'ChatGroupId':_0x4f929b[_0xc373('0x47')]['id'],'ToId':_0x4f929b['user']['id'],'read':![]}})['then'](function(_0x478edf){return{'id':_[_0xc373('0x4f')](_0x4f929b[_0xc373('0x47')]['id']),'count':_0x478edf};})[_0xc373('0x28')](respondWithResult(_0x16d203,null))['catch'](handleError(_0x16d203,null));};exports[_0xc373('0x50')]=function(_0x29f62c,_0x34b10d,_0x4ae65d){return db[_0xc373('0x30')][_0xc373('0x4b')]({'where':{'id':_0x29f62c['params']['id']}})[_0xc373('0x28')](handleEntityNotFound(_0x34b10d,null))[_0xc373('0x28')](function(_0x3b3225){if(_0x3b3225){return _0x3b3225[_0xc373('0x50')](_0x29f62c[_0xc373('0x4a')][_0xc373('0x51')],_[_0xc373('0x52')](_0x29f62c[_0xc373('0x4a')],[_0xc373('0x51'),'id'])||{});}})[_0xc373('0x28')](respondWithResult(_0x34b10d,null))[_0xc373('0x46')](handleError(_0x34b10d,null));};exports[_0xc373('0x53')]=function(_0x3f1c9c,_0x426ef7,_0x5bb3ff){var _0xdd62a6={};var _0x1cf73e={};var _0x59c5a0;var _0x1d208c;return db[_0xc373('0x30')][_0xc373('0x54')]({'where':{'id':_0x3f1c9c[_0xc373('0x47')]['id']}})['then'](handleEntityNotFound(_0x426ef7,null))[_0xc373('0x28')](function(_0x105186){if(_0x105186){_0x59c5a0=_0x105186;_0x1cf73e[_0xc373('0x37')]=_[_0xc373('0x34')](db[_0xc373('0x55')][_0xc373('0x31')]);_0x1cf73e[_0xc373('0x38')]=_['keys'](_0x3f1c9c['query']);_0x1cf73e[_0xc373('0x35')]=_[_0xc373('0x36')](_0x1cf73e[_0xc373('0x37')],_0x1cf73e['query']);_0xdd62a6['attributes']=_[_0xc373('0x36')](_0x1cf73e[_0xc373('0x37')],qs['fields'](_0x3f1c9c[_0xc373('0x38')][_0xc373('0x3a')]));_0xdd62a6['attributes']=_0xdd62a6[_0xc373('0x39')][_0xc373('0x3b')]?_0xdd62a6[_0xc373('0x39')]:_0x1cf73e[_0xc373('0x37')];_0xdd62a6[_0xc373('0x56')]=qs[_0xc373('0x3e')](_0x3f1c9c[_0xc373('0x38')][_0xc373('0x3e')]);_0xdd62a6[_0xc373('0x3f')]=qs[_0xc373('0x35')](_['pick'](_0x3f1c9c[_0xc373('0x38')],_0x1cf73e[_0xc373('0x35')]));if(_0x3f1c9c[_0xc373('0x38')][_0xc373('0x42')]){_0xdd62a6[_0xc373('0x3f')]=_['merge'](_0xdd62a6[_0xc373('0x3f')],{'$or':_[_0xc373('0x2f')](_0xdd62a6['attributes'],function(_0x3f2f66){var _0x2d86cb={};_0x2d86cb[_0x3f2f66]={'$like':'%'+_0x3f1c9c[_0xc373('0x38')][_0xc373('0x42')]+'%'};return _0x2d86cb;})});}_0xdd62a6=_[_0xc373('0x40')]({},_0xdd62a6,_0x3f1c9c[_0xc373('0x43')]);return _0x59c5a0[_0xc373('0x53')](_0xdd62a6);}})[_0xc373('0x28')](function(_0x15269a){if(_0x15269a){_0x1d208c=_0x15269a[_0xc373('0x3b')];if(!_0x3f1c9c[_0xc373('0x38')][_0xc373('0x3c')](_0xc373('0x3d'))){_0xdd62a6[_0xc373('0x1f')]=qs[_0xc373('0x1f')](_0x3f1c9c[_0xc373('0x38')][_0xc373('0x1f')]);_0xdd62a6['offset']=qs[_0xc373('0x21')](_0x3f1c9c['query'][_0xc373('0x21')]);}return _0x59c5a0[_0xc373('0x53')](_0xdd62a6);}})[_0xc373('0x28')](function(_0x399acd){if(_0x399acd){return _0x399acd?{'count':_0x1d208c,'rows':_0x399acd}:null;}})['then'](respondWithResult(_0x426ef7,null))[_0xc373('0x46')](handleError(_0x426ef7,null));};exports[_0xc373('0x57')]=function(_0x219836,_0x37f7ce,_0x4fc826){return db[_0xc373('0x30')][_0xc373('0x4b')]({'where':{'id':_0x219836[_0xc373('0x47')]['id']}})[_0xc373('0x28')](handleEntityNotFound(_0x37f7ce,null))[_0xc373('0x28')](function(_0x5c4710){if(_0x5c4710){return _0x5c4710[_0xc373('0x57')](_0x219836[_0xc373('0x38')][_0xc373('0x51')]);}})[_0xc373('0x28')](respondWithStatusCode(_0x37f7ce,null))[_0xc373('0x46')](handleError(_0x37f7ce,null));};exports[_0xc373('0x58')]=function(_0x4412c4,_0x14530e,_0xc9279a){if(_0x4412c4[_0xc373('0x4a')]['id']){delete _0x4412c4[_0xc373('0x4a')]['id'];}return db['ChatGroup'][_0xc373('0x4b')]({'where':{'id':_0x4412c4[_0xc373('0x47')]['id']}})[_0xc373('0x28')](handleEntityNotFound(_0x14530e,null))['then'](function(_0x2cf48e){if(_0x2cf48e){_0x4412c4['body']['ChatGroupId']=_0x2cf48e['id'];return db['ChatInternalMessage']['create'](_0x4412c4[_0xc373('0x4a')]);}})['then'](respondWithResult(_0x14530e,null))[_0xc373('0x46')](handleError(_0x14530e,null));};exports[_0xc373('0x59')]=function(_0x19bce6,_0x410b32,_0x39f30b){var _0x27c455={};var _0x671f6b={};var _0x1e86f7;var _0x6aa608;return db['ChatGroup'][_0xc373('0x54')]({'where':{'id':_0x19bce6[_0xc373('0x47')]['id']}})[_0xc373('0x28')](handleEntityNotFound(_0x410b32,null))[_0xc373('0x28')](function(_0x234af6){if(_0x234af6){_0x1e86f7=_0x234af6;_0x671f6b['model']=_['keys'](db[_0xc373('0x4e')]['rawAttributes']);_0x671f6b['query']=_[_0xc373('0x34')](_0x19bce6[_0xc373('0x38')]);_0x671f6b[_0xc373('0x35')]=_[_0xc373('0x36')](_0x671f6b[_0xc373('0x37')],_0x671f6b['query']);_0x27c455[_0xc373('0x39')]=_[_0xc373('0x36')](_0x671f6b[_0xc373('0x37')],qs['fields'](_0x19bce6['query'][_0xc373('0x3a')]));_0x27c455[_0xc373('0x39')]=_0x27c455[_0xc373('0x39')][_0xc373('0x3b')]?_0x27c455['attributes']:_0x671f6b[_0xc373('0x37')];_0x27c455[_0xc373('0x56')]=qs[_0xc373('0x3e')](_0x19bce6[_0xc373('0x38')][_0xc373('0x3e')]);_0x27c455[_0xc373('0x3f')]=qs[_0xc373('0x35')](_[_0xc373('0x5a')](_0x19bce6[_0xc373('0x38')],_0x671f6b[_0xc373('0x35')]));if(_0x19bce6['query']['filter']){_0x27c455[_0xc373('0x3f')]=_['merge'](_0x27c455[_0xc373('0x3f')],{'$or':_[_0xc373('0x2f')](_0x27c455['attributes'],function(_0x30bd9c){var _0x599f21={};_0x599f21[_0x30bd9c]={'$like':'%'+_0x19bce6[_0xc373('0x38')][_0xc373('0x42')]+'%'};return _0x599f21;})});}if(_0x19bce6[_0xc373('0x38')][_0xc373('0x5b')]){var _0x553e32=_0x19bce6[_0xc373('0x38')][_0xc373('0x5b')]['split'](',');var _0x3a1f51={};_0x3a1f51[_0x553e32[0x0]]={'$gte':moment(_0x553e32[0x1])[_0xc373('0x5c')](_0xc373('0x5d'))};_0x27c455[_0xc373('0x3f')]=_[_0xc373('0x40')](_0x27c455[_0xc373('0x3f')],_0x3a1f51);}_0x27c455=_['merge']({},_0x27c455,_0x19bce6[_0xc373('0x43')]);return _0x1e86f7[_0xc373('0x59')](_0x27c455);}})[_0xc373('0x28')](function(_0x22524f){if(_0x22524f){_0x6aa608=_0x22524f[_0xc373('0x3b')];if(!_0x19bce6[_0xc373('0x38')][_0xc373('0x3c')](_0xc373('0x3d'))){_0x27c455[_0xc373('0x1f')]=qs[_0xc373('0x1f')](_0x19bce6[_0xc373('0x38')][_0xc373('0x1f')]);_0x27c455[_0xc373('0x21')]=qs[_0xc373('0x21')](_0x19bce6[_0xc373('0x38')][_0xc373('0x21')]);}return _0x1e86f7[_0xc373('0x59')](_0x27c455);}})[_0xc373('0x28')](function(_0x2b6682){if(_0x2b6682){return _0x2b6682?{'count':_0x6aa608,'rows':_0x2b6682}:null;}})['then'](respondWithResult(_0x410b32,null))[_0xc373('0x46')](handleError(_0x410b32,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 45451f7..1c9519e 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 _0x737c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','ChatGroup'];(function(_0x57433b,_0x4a6782){var _0x5f2f44=function(_0x28f486){while(--_0x28f486){_0x57433b['push'](_0x57433b['shift']());}};_0x5f2f44(++_0x4a6782);}(_0x737c,0x1d2));var _0xc737=function(_0xf64026,_0x43afd3){_0xf64026=_0xf64026-0x0;var _0x1050be=_0x737c[_0xf64026];return _0x1050be;};'use strict';var EventEmitter=require(_0xc737('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xc737('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xc737('0x2')](0x0);var events={'afterCreate':_0xc737('0x3'),'afterUpdate':_0xc737('0x4'),'afterDestroy':_0xc737('0x5')};function emitEvent(_0x19e4f8){return function(_0x221e8d,_0x4b9970,_0x46ce96){ChatGroupEvents['emit'](_0x19e4f8+':'+_0x221e8d['id'],_0x221e8d);ChatGroupEvents[_0xc737('0x6')](_0x19e4f8,_0x221e8d);_0x46ce96(null);};}for(var e in events){if(events[_0xc737('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xc737('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x58c9=['remove','emit','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x57b4e8,_0x2947d3){var _0x68000e=function(_0x30aff4){while(--_0x30aff4){_0x57b4e8['push'](_0x57b4e8['shift']());}};_0x68000e(++_0x2947d3);}(_0x58c9,0x1bc));var _0x958c=function(_0x1b9e08,_0x20bde6){_0x1b9e08=_0x1b9e08-0x0;var _0xe9a83e=_0x58c9[_0x1b9e08];return _0xe9a83e;};'use strict';var EventEmitter=require(_0x958c('0x0'));var ChatGroup=require(_0x958c('0x1'))['db'][_0x958c('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x958c('0x3')](0x0);var events={'afterCreate':_0x958c('0x4'),'afterUpdate':_0x958c('0x5'),'afterDestroy':_0x958c('0x6')};function emitEvent(_0x254a07){return function(_0x393560,_0x21ba78,_0xa86106){ChatGroupEvents[_0x958c('0x7')](_0x254a07+':'+_0x393560['id'],_0x393560);ChatGroupEvents[_0x958c('0x7')](_0x254a07,_0x393560);_0xa86106(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x958c('0x8')](e,emitEvent(event));}}module[_0x958c('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 3eb5b97..caa8185 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 _0x3be6=['path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x245eaa,_0x315370){var _0x3b09be=function(_0x112d74){while(--_0x112d74){_0x245eaa['push'](_0x245eaa['shift']());}};_0x3b09be(++_0x315370);}(_0x3be6,0xc9));var _0x63be=function(_0x27b7d2,_0x56c091){_0x27b7d2=_0x27b7d2-0x0;var _0x3ef6be=_0x3be6[_0x27b7d2];return _0x3ef6be;};'use strict';var _=require(_0x63be('0x0'));var util=require(_0x63be('0x1'));var logger=require(_0x63be('0x2'))(_0x63be('0x3'));var moment=require(_0x63be('0x4'));var BPromise=require(_0x63be('0x5'));var rp=require(_0x63be('0x6'));var fs=require('fs');var path=require(_0x63be('0x7'));var rimraf=require('rimraf');var config=require(_0x63be('0x8'));var attributes=require(_0x63be('0x9'));module[_0x63be('0xa')]=function(_0x5f0f6b,_0x3b6eef){return _0x5f0f6b[_0x63be('0xb')](_0x63be('0xc'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56fa=['path','rimraf','./chatGroup.attributes','define','chat_groups','util','../../config/logger','api','bluebird'];(function(_0x41b034,_0xfd9e20){var _0x3db111=function(_0xcbbe4){while(--_0xcbbe4){_0x41b034['push'](_0x41b034['shift']());}};_0x3db111(++_0xfd9e20);}(_0x56fa,0x15b));var _0xa56f=function(_0x1eb1a3,_0x2becf2){_0x1eb1a3=_0x1eb1a3-0x0;var _0x9ac4e4=_0x56fa[_0x1eb1a3];return _0x9ac4e4;};'use strict';var _=require('lodash');var util=require(_0xa56f('0x0'));var logger=require(_0xa56f('0x1'))(_0xa56f('0x2'));var moment=require('moment');var BPromise=require(_0xa56f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa56f('0x4'));var rimraf=require(_0xa56f('0x5'));var config=require('../../config/environment');var attributes=require(_0xa56f('0x6'));module['exports']=function(_0x40433c,_0x14e771){return _0x40433c[_0xa56f('0x7')]('ChatGroup',attributes,{'tableName':_0xa56f('0x8'),'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 81c17dc..6749e52 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 _0xf041=['rpc','client','redis','defaults','localhost','./chatGroup.socket','register','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x43422c,_0x17388f){var _0x5f20b8=function(_0x60c8b4){while(--_0x60c8b4){_0x43422c['push'](_0x43422c['shift']());}};_0x5f20b8(++_0x17388f);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1f04('0x0'));var BPromise=require(_0x1f04('0x1'));var rs=require(_0x1f04('0x2'));var fs=require('fs');var Redis=require(_0x1f04('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f04('0x4'));var logger=require('../../config/logger')(_0x1f04('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f04('0x6')]['http']({'port':0x232a});config[_0x1f04('0x7')]=_[_0x1f04('0x8')](config[_0x1f04('0x7')],{'host':_0x1f04('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f04('0x7')]));require(_0x1f04('0xa'))[_0x1f04('0xb')](socket);function respondWithRpcPromise(_0x150ec6,_0x181529,_0x2c9aca){return new BPromise(function(_0x1982dd,_0x42b333){return client['request'](_0x150ec6,_0x2c9aca)['then'](function(_0x1022df){logger[_0x1f04('0xc')](_0x1f04('0xd'),_0x181529,_0x1f04('0xe'));logger[_0x1f04('0xf')](_0x1f04('0x10'),_0x181529,_0x1f04('0xe'),JSON[_0x1f04('0x11')](_0x1022df));if(_0x1022df[_0x1f04('0x12')]){if(_0x1022df[_0x1f04('0x12')][_0x1f04('0x13')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x181529,_0x1022df[_0x1f04('0x12')][_0x1f04('0x14')]);return _0x42b333(_0x1022df[_0x1f04('0x12')]['message']);}logger[_0x1f04('0x12')]('ChatGroup,\x20%s,\x20%s',_0x181529,_0x1022df[_0x1f04('0x12')][_0x1f04('0x14')]);return _0x1982dd(_0x1022df[_0x1f04('0x12')][_0x1f04('0x14')]);}else{logger[_0x1f04('0xc')](_0x1f04('0xd'),_0x181529,'request\x20sent');_0x1982dd(_0x1022df['result'][_0x1f04('0x14')]);}})[_0x1f04('0x15')](function(_0x413c24){logger[_0x1f04('0x12')](_0x1f04('0xd'),_0x181529,_0x413c24);_0x42b333(_0x413c24);});});} \ No newline at end of file +var _0x6c96=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','socket.io-emitter','redis','./chatGroup.socket','register','request','then','info'];(function(_0xd4c021,_0x51fd96){var _0x19e5f0=function(_0x22293e){while(--_0x22293e){_0xd4c021['push'](_0xd4c021['shift']());}};_0x19e5f0(++_0x51fd96);}(_0x6c96,0x1c1));var _0x66c9=function(_0x5eb68b,_0x2c5da8){_0x5eb68b=_0x5eb68b-0x0;var _0x3bfcc9=_0x6c96[_0x5eb68b];return _0x3bfcc9;};'use strict';var _=require(_0x66c9('0x0'));var util=require('util');var moment=require(_0x66c9('0x1'));var BPromise=require(_0x66c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66c9('0x3'));var db=require(_0x66c9('0x4'))['db'];var utils=require(_0x66c9('0x5'));var logger=require(_0x66c9('0x6'))(_0x66c9('0x7'));var config=require(_0x66c9('0x8'));var jayson=require(_0x66c9('0x9'));var client=jayson['client'][_0x66c9('0xa')]({'port':0x232a});config['redis']=_[_0x66c9('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x66c9('0xc'))(new Redis(config[_0x66c9('0xd')]));require(_0x66c9('0xe'))[_0x66c9('0xf')](socket);function respondWithRpcPromise(_0x516de9,_0x4aeb2d,_0x519105){return new BPromise(function(_0x54fe7b,_0x148d05){return client[_0x66c9('0x10')](_0x516de9,_0x519105)[_0x66c9('0x11')](function(_0x568471){logger[_0x66c9('0x12')](_0x66c9('0x13'),_0x4aeb2d,_0x66c9('0x14'));logger[_0x66c9('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x4aeb2d,_0x66c9('0x14'),JSON['stringify'](_0x568471));if(_0x568471[_0x66c9('0x16')]){if(_0x568471[_0x66c9('0x16')][_0x66c9('0x17')]===0x1f4){logger[_0x66c9('0x16')]('ChatGroup,\x20%s,\x20%s',_0x4aeb2d,_0x568471[_0x66c9('0x16')][_0x66c9('0x18')]);return _0x148d05(_0x568471['error'][_0x66c9('0x18')]);}logger[_0x66c9('0x16')](_0x66c9('0x13'),_0x4aeb2d,_0x568471[_0x66c9('0x16')][_0x66c9('0x18')]);return _0x54fe7b(_0x568471[_0x66c9('0x16')][_0x66c9('0x18')]);}else{logger[_0x66c9('0x12')]('ChatGroup,\x20%s,\x20%s',_0x4aeb2d,_0x66c9('0x14'));_0x54fe7b(_0x568471['result']['message']);}})[_0x66c9('0x19')](function(_0x1ef3cf){logger[_0x66c9('0x16')](_0x66c9('0x13'),_0x4aeb2d,_0x1ef3cf);_0x148d05(_0x1ef3cf);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 35f9a2c..8ec34e8 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 _0x04d7=['removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x3a0746,_0x1c624d){var _0x29d3dc=function(_0x10e3ba){while(--_0x10e3ba){_0x3a0746['push'](_0x3a0746['shift']());}};_0x29d3dc(++_0x1c624d);}(_0x04d7,0x164));var _0x704d=function(_0x373d08,_0x18fe97){_0x373d08=_0x373d08-0x0;var _0x20c20e=_0x04d7[_0x373d08];return _0x20c20e;};'use strict';var ChatGroupEvents=require(_0x704d('0x0'));var events=[_0x704d('0x1'),_0x704d('0x2'),_0x704d('0x3')];function createListener(_0x563b57,_0x306f25){return function(_0x24f3dc){_0x306f25['emit'](_0x563b57,_0x24f3dc);};}function removeListener(_0x402c93,_0x4cfc21){return function(){ChatGroupEvents[_0x704d('0x4')](_0x402c93,_0x4cfc21);};}exports[_0x704d('0x5')]=function(_0x332f65){for(var _0x4e2aa8=0x0,_0x27384b=events[_0x704d('0x6')];_0x4e2aa8<_0x27384b;_0x4e2aa8++){var _0x21a9f3=events[_0x4e2aa8];var _0x23d556=createListener(_0x704d('0x7')+_0x21a9f3,_0x332f65);ChatGroupEvents['on'](_0x21a9f3,_0x23d556);}}; \ No newline at end of file +var _0xd4a4=['remove','emit','removeListener','register','length','./chatGroup.events','save'];(function(_0x4ccf7f,_0x161ffd){var _0x1953f0=function(_0xfd2ca6){while(--_0xfd2ca6){_0x4ccf7f['push'](_0x4ccf7f['shift']());}};_0x1953f0(++_0x161ffd);}(_0xd4a4,0x116));var _0x4d4a=function(_0x338f07,_0x5460df){_0x338f07=_0x338f07-0x0;var _0x362f66=_0xd4a4[_0x338f07];return _0x362f66;};'use strict';var ChatGroupEvents=require(_0x4d4a('0x0'));var events=[_0x4d4a('0x1'),_0x4d4a('0x2'),'update'];function createListener(_0x5405b2,_0x4acfc7){return function(_0x7c87d2){_0x4acfc7[_0x4d4a('0x3')](_0x5405b2,_0x7c87d2);};}function removeListener(_0x267ff0,_0x59d5a4){return function(){ChatGroupEvents[_0x4d4a('0x4')](_0x267ff0,_0x59d5a4);};}exports[_0x4d4a('0x5')]=function(_0x469be1){for(var _0x64e82b=0x0,_0x46b90d=events[_0x4d4a('0x6')];_0x64e82b<_0x46b90d;_0x64e82b++){var _0x42097c=events[_0x64e82b];var _0x32a3b4=createListener('chatGroup:'+_0x42097c,_0x469be1);ChatGroupEvents['on'](_0x42097c,_0x32a3b4);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index a106063..a059067 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 _0x408a=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','put','/:id','update','delete','destroy'];(function(_0x350dbe,_0x3597c6){var _0x26cffc=function(_0x184a05){while(--_0x184a05){_0x350dbe['push'](_0x350dbe['shift']());}};_0x26cffc(++_0x3597c6);}(_0x408a,0x1b0));var _0xa408=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x408a[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0xa408('0x0'));var util=require(_0xa408('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa408('0x2'));var router=express[_0xa408('0x3')]();var fs_extra=require(_0xa408('0x4'));var auth=require(_0xa408('0x5'));var interaction=require(_0xa408('0x6'));var config=require(_0xa408('0x7'));var controller=require('./chatGroup.controller');router[_0xa408('0x8')]('/',auth[_0xa408('0x9')](),controller[_0xa408('0xa')]);router[_0xa408('0x8')]('/describe',auth[_0xa408('0x9')](),controller[_0xa408('0xb')]);router[_0xa408('0x8')]('/:id',auth[_0xa408('0x9')](),controller[_0xa408('0xc')]);router[_0xa408('0x8')](_0xa408('0xd'),auth[_0xa408('0x9')](),controller[_0xa408('0xe')]);router[_0xa408('0x8')](_0xa408('0xf'),auth[_0xa408('0x9')](),controller[_0xa408('0x10')]);router['get'](_0xa408('0x11'),auth[_0xa408('0x9')](),controller[_0xa408('0x12')]);router[_0xa408('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa408('0x13')](_0xa408('0xf'),auth[_0xa408('0x9')](),controller[_0xa408('0x14')]);router[_0xa408('0x13')](_0xa408('0x11'),auth[_0xa408('0x9')](),controller[_0xa408('0x15')]);router[_0xa408('0x16')](_0xa408('0x17'),auth[_0xa408('0x9')](),controller[_0xa408('0x18')]);router[_0xa408('0x19')](_0xa408('0x17'),auth[_0xa408('0x9')](),controller[_0xa408('0x1a')]);router[_0xa408('0x19')](_0xa408('0xf'),auth[_0xa408('0x9')](),controller['removeMembers']);module['exports']=router; \ No newline at end of file +var _0x43d7=['/:id/members','addMembers','addMessage','put','/:id','update','destroy','delete','removeMembers','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','show','/:id/unread','getUnread','/:id/messages','getMessages','post'];(function(_0x322c5c,_0x1cafcf){var _0x49b630=function(_0x5b9095){while(--_0x5b9095){_0x322c5c['push'](_0x322c5c['shift']());}};_0x49b630(++_0x1cafcf);}(_0x43d7,0xf4));var _0x743d=function(_0x7d02bf,_0x1cb846){_0x7d02bf=_0x7d02bf-0x0;var _0x26c7cd=_0x43d7[_0x7d02bf];return _0x26c7cd;};'use strict';var multer=require(_0x743d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x743d('0x1'));var express=require(_0x743d('0x2'));var router=express[_0x743d('0x3')]();var fs_extra=require(_0x743d('0x4'));var auth=require(_0x743d('0x5'));var interaction=require(_0x743d('0x6'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0x743d('0x7')]('/',auth[_0x743d('0x8')](),controller['index']);router['get']('/describe',auth[_0x743d('0x8')](),controller[_0x743d('0x9')]);router[_0x743d('0x7')]('/:id',auth[_0x743d('0x8')](),controller[_0x743d('0xa')]);router[_0x743d('0x7')](_0x743d('0xb'),auth[_0x743d('0x8')](),controller[_0x743d('0xc')]);router['get']('/:id/members',auth[_0x743d('0x8')](),controller['getMembers']);router[_0x743d('0x7')](_0x743d('0xd'),auth[_0x743d('0x8')](),controller[_0x743d('0xe')]);router['post']('/',auth[_0x743d('0x8')](),controller['create']);router[_0x743d('0xf')](_0x743d('0x10'),auth[_0x743d('0x8')](),controller[_0x743d('0x11')]);router[_0x743d('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0x743d('0x12')]);router[_0x743d('0x13')](_0x743d('0x14'),auth['isAuthenticated'](),controller[_0x743d('0x15')]);router['delete']('/:id',auth[_0x743d('0x8')](),controller[_0x743d('0x16')]);router[_0x743d('0x17')](_0x743d('0x10'),auth[_0x743d('0x8')](),controller[_0x743d('0x18')]);module[_0x743d('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 56c345e..b98f715 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 _0x55ea=['long','DATE','out','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING'];(function(_0x55d1b9,_0x5a7b15){var _0x29e266=function(_0x5be949){while(--_0x5be949){_0x55d1b9['push'](_0x55d1b9['shift']());}};_0x29e266(++_0x5a7b15);}(_0x55ea,0xc9));var _0xa55e=function(_0x4ef608,_0x3db289){_0x4ef608=_0x4ef608-0x0;var _0x467389=_0x55ea[_0x4ef608];return _0x467389;};'use strict';var Sequelize=require(_0xa55e('0x0'));module[_0xa55e('0x1')]={'closed':{'type':Sequelize[_0xa55e('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xa55e('0x3')](_0xa55e('0x4'),_0xa55e('0x5')),'defaultValue':_0xa55e('0x4')},'ratingMessage':{'type':Sequelize[_0xa55e('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xa55e('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa55e('0x7')]},'browserName':{'type':Sequelize[_0xa55e('0x7')]},'browserVersion':{'type':Sequelize[_0xa55e('0x7')]},'osName':{'type':Sequelize[_0xa55e('0x7')]},'osVersion':{'type':Sequelize[_0xa55e('0x7')]},'deviceModel':{'type':Sequelize[_0xa55e('0x7')]},'deviceVendor':{'type':Sequelize[_0xa55e('0x7')]},'deviceType':{'type':Sequelize[_0xa55e('0x7')]},'referer':{'type':Sequelize[_0xa55e('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xa55e('0x8'))},'read1stAt':{'type':Sequelize[_0xa55e('0x9')]},'lastMsgAt':{'type':Sequelize[_0xa55e('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xa55e('0x3')]('in',_0xa55e('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xa55e('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xa55e('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4899=['star','TEXT','STRING','long','DATE','out','sequelize','BOOLEAN','ENUM','thumb'];(function(_0x27e60b,_0x240e75){var _0x39bc77=function(_0x56e67c){while(--_0x56e67c){_0x27e60b['push'](_0x27e60b['shift']());}};_0x39bc77(++_0x240e75);}(_0x4899,0x74));var _0x9489=function(_0x3d4ebe,_0xf81e15){_0x3d4ebe=_0x3d4ebe-0x0;var _0x2b4609=_0x4899[_0x3d4ebe];return _0x2b4609;};'use strict';var Sequelize=require(_0x9489('0x0'));module['exports']={'closed':{'type':Sequelize[_0x9489('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x9489('0x2')]('star',_0x9489('0x3')),'defaultValue':_0x9489('0x4')},'ratingMessage':{'type':Sequelize[_0x9489('0x5')]},'pathTranscript':{'type':Sequelize[_0x9489('0x5')]},'mailTranscript':{'type':Sequelize[_0x9489('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9489('0x6')]},'secondDisposition':{'type':Sequelize[_0x9489('0x6')]},'thirdDisposition':{'type':Sequelize[_0x9489('0x6')]},'note':{'type':Sequelize[_0x9489('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x9489('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x9489('0x6')]},'deviceVendor':{'type':Sequelize[_0x9489('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x9489('0x5')]},'customerIp':{'type':Sequelize[_0x9489('0x6')]},'formData':{'type':Sequelize[_0x9489('0x5')](_0x9489('0x7'))},'read1stAt':{'type':Sequelize[_0x9489('0x8')]},'lastMsgAt':{'type':Sequelize[_0x9489('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x9489('0x2')]('in',_0x9489('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x9489('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x9489('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x9489('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 2cf718e..2e0252b 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 _0xa3bb=['spread','Tag','removeTags','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','N.A.','disposition','browserName','osName','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','transcript-','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','http','client','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','undefined','limit','count','Content-Range','json','update','then','destroy','end','stack','name','send','render','merge','contact','account','index','map','ChatInteraction','rawAttributes','fieldName','key','getOptions','user','show','model','keys','query','filters','intersection','attributes','fields','length','includeAll','options','find','create','body','params','describe','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','type','mimetype','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','ContactId','Messages','System','customer','%s%d','agentIdentifier','website_alias','alias','agent_fullname','agentAlias','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','where','findAll','rows','getMyMessages','include','includeAgent','push','addTags','setTags'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xa3bb,0x1c8));var _0xba3b=function(_0x58220d,_0x1840f4){_0x58220d=_0x58220d-0x0;var _0x363db2=_0xa3bb[_0x58220d];return _0x363db2;};'use strict';var rimraf=require(_0xba3b('0x0'));var zipdir=require(_0xba3b('0x1'));var rp=require(_0xba3b('0x2'));var moment=require(_0xba3b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xba3b('0x4'));var util=require(_0xba3b('0x5'));var path=require(_0xba3b('0x6'));var ejs=require(_0xba3b('0x7'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xba3b('0x8'));var qs=require(_0xba3b('0x9'));var pdf=require(_0xba3b('0xa'));var logger=require(_0xba3b('0xb'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xba3b('0xc')]=_[_0xba3b('0xd')](config[_0xba3b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xba3b('0xe'))(new Redis(config[_0xba3b('0xc')]));require(_0xba3b('0xf'))['register'](socket);var jayson=require(_0xba3b('0x10'));var client=jayson['client'][_0xba3b('0x11')]({'port':0x232b});var client9004=jayson[_0xba3b('0x12')][_0xba3b('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x58d73e,_0x2b5e13,_0x4dae43,_0x1a7cd1){return new BPromise(function(_0x2aeae7,_0x431a01){var _0x2e49ca=_0x1a7cd1||client;return _0x2e49ca[_0xba3b('0x13')](_0x58d73e,_0x4dae43)['then'](function(_0x219694){logger[_0xba3b('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x2b5e13,_0xba3b('0x15'));logger[_0xba3b('0x16')](_0xba3b('0x17'),_0x2b5e13,_0xba3b('0x15'),JSON[_0xba3b('0x18')](_0x219694));if(_0x219694['error']){if(_0x219694[_0xba3b('0x19')][_0xba3b('0x1a')]===0x1f4){logger[_0xba3b('0x19')](_0xba3b('0x1b'),_0x2b5e13,_0x219694[_0xba3b('0x19')][_0xba3b('0x1c')]);return _0x431a01(_0x219694[_0xba3b('0x19')][_0xba3b('0x1c')]);}logger[_0xba3b('0x19')](_0xba3b('0x1b'),_0x2b5e13,_0x219694[_0xba3b('0x19')][_0xba3b('0x1c')]);return _0x2aeae7(_0x219694[_0xba3b('0x19')][_0xba3b('0x1c')]);}else{logger[_0xba3b('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x2b5e13,_0xba3b('0x15'));_0x2aeae7(_0x219694[_0xba3b('0x1d')][_0xba3b('0x1c')]);}})[_0xba3b('0x1e')](function(_0xe50405){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2b5e13,_0xe50405);_0x431a01(_0xe50405);});});}function respondWithStatusCode(_0x1905bb,_0x582c13){_0x582c13=_0x582c13||0xcc;return function(_0x4f1b26){if(_0x4f1b26){return _0x1905bb[_0xba3b('0x1f')](_0x582c13);}return _0x1905bb[_0xba3b('0x20')](_0x582c13)['end']();};}function respondWithResult(_0x5c912b,_0x1925e0){_0x1925e0=_0x1925e0||0xc8;return function(_0x4d1b7d){if(_0x4d1b7d){return _0x5c912b[_0xba3b('0x20')](_0x1925e0)['json'](_0x4d1b7d);}};}function respondWithFilteredResult(_0x429592,_0x257000){return function(_0x310031){if(_0x310031){var _0x42786d=typeof _0x257000[_0xba3b('0x21')]===_0xba3b('0x22')&&typeof _0x257000[_0xba3b('0x23')]===_0xba3b('0x22');var _0xe36e90=_0x310031[_0xba3b('0x24')];var _0x5c0bf6=_0x42786d?0x0:_0x257000[_0xba3b('0x21')];var _0x294ba9=_0x42786d?_0x310031[_0xba3b('0x24')]:_0x257000['offset']+_0x257000[_0xba3b('0x23')];var _0x495b7d;if(_0x294ba9>=_0xe36e90){_0x294ba9=_0xe36e90;_0x495b7d=0xc8;}else{_0x495b7d=0xce;}_0x429592[_0xba3b('0x20')](_0x495b7d);return _0x429592['set'](_0xba3b('0x25'),_0x5c0bf6+'-'+_0x294ba9+'/'+_0xe36e90)[_0xba3b('0x26')](_0x310031);}return null;};}function saveUpdates(_0xa875bb){return function(_0x593e53){if(_0x593e53){return _0x593e53[_0xba3b('0x27')](_0xa875bb)[_0xba3b('0x28')](function(_0x2c55a3){return _0x2c55a3;});}return null;};}function removeEntity(_0x34a41a){return function(_0x2e7ca5){if(_0x2e7ca5){return _0x2e7ca5[_0xba3b('0x29')]()['then'](function(){_0x34a41a[_0xba3b('0x20')](0xcc)[_0xba3b('0x2a')]();});}};}function handleEntityNotFound(_0x3ee7c0){return function(_0x3a1f75){if(!_0x3a1f75){_0x3ee7c0[_0xba3b('0x1f')](0x194);}return _0x3a1f75;};}function handleError(_0x1b0b46,_0x3c74e5){_0x3c74e5=_0x3c74e5||0x1f4;return function(_0x1be9e8){logger[_0xba3b('0x19')](_0x1be9e8[_0xba3b('0x2b')]);if(_0x1be9e8[_0xba3b('0x2c')]){delete _0x1be9e8[_0xba3b('0x2c')];}_0x1b0b46[_0xba3b('0x20')](_0x3c74e5)[_0xba3b('0x2d')](_0x1be9e8);};}function getMustacheRender(_0x274d14,_0xc4c6a9){return Mustache[_0xba3b('0x2e')](_0x274d14,_[_0xba3b('0x2f')](_0xc4c6a9['body'],{'contact':_0xc4c6a9[_0xba3b('0x30')],'message':_0xc4c6a9['message'],'agent':_0xc4c6a9['agent'],'interaction':_0xc4c6a9['interaction'],'account':_0xc4c6a9[_0xba3b('0x31')]}))||'';}exports[_0xba3b('0x32')]=function(_0x2c1dfc,_0x211263){var _0x37ed4f={};var _0x1eb2cf=_[_0xba3b('0x33')](db[_0xba3b('0x34')][_0xba3b('0x35')],function(_0x29435e){return{'name':_0x29435e[_0xba3b('0x36')],'type':_0x29435e['type'][_0xba3b('0x37')]};});_0x37ed4f=qs[_0xba3b('0x38')](_0x1eb2cf,_0x2c1dfc);return interaction['findAll']('chat',_0x2c1dfc['query'],_0x2c1dfc[_0xba3b('0x39')],_0x37ed4f,_0x1eb2cf)[_0xba3b('0x28')](respondWithFilteredResult(_0x211263,_0x37ed4f))['catch'](handleError(_0x211263,null));};exports[_0xba3b('0x3a')]=function(_0x4a7e56,_0x55b6fe){var _0x4a81b5={'raw':![],'where':{'id':_0x4a7e56['params']['id']}},_0x33713b={};_0x33713b[_0xba3b('0x3b')]=_[_0xba3b('0x3c')](db[_0xba3b('0x34')][_0xba3b('0x35')]);_0x33713b[_0xba3b('0x3d')]=_[_0xba3b('0x3c')](_0x4a7e56[_0xba3b('0x3d')]);_0x33713b[_0xba3b('0x3e')]=_[_0xba3b('0x3f')](_0x33713b[_0xba3b('0x3b')],_0x33713b['query']);_0x4a81b5[_0xba3b('0x40')]=_['intersection'](_0x33713b[_0xba3b('0x3b')],qs[_0xba3b('0x41')](_0x4a7e56[_0xba3b('0x3d')][_0xba3b('0x41')]));_0x4a81b5['attributes']=_0x4a81b5[_0xba3b('0x40')][_0xba3b('0x42')]?_0x4a81b5[_0xba3b('0x40')]:_0x33713b[_0xba3b('0x3b')];if(_0x4a7e56[_0xba3b('0x3d')][_0xba3b('0x43')]){_0x4a81b5['include']=[{'all':!![]}];}_0x4a81b5=_[_0xba3b('0x2f')]({},_0x4a81b5,_0x4a7e56[_0xba3b('0x44')]);return db[_0xba3b('0x34')][_0xba3b('0x45')](_0x4a81b5)[_0xba3b('0x28')](handleEntityNotFound(_0x55b6fe,null))[_0xba3b('0x28')](respondWithResult(_0x55b6fe,null))[_0xba3b('0x1e')](handleError(_0x55b6fe,null));};exports[_0xba3b('0x46')]=function(_0x15d5a0,_0x1cf4b4){return db['ChatInteraction'][_0xba3b('0x46')](_0x15d5a0[_0xba3b('0x47')],{})[_0xba3b('0x28')](respondWithResult(_0x1cf4b4,0xc9))[_0xba3b('0x1e')](handleError(_0x1cf4b4,null));};exports[_0xba3b('0x27')]=function(_0xc761a1,_0x234fb2){if(_0xc761a1['body']['id']){delete _0xc761a1[_0xba3b('0x47')]['id'];}return db[_0xba3b('0x34')][_0xba3b('0x45')]({'where':{'id':_0xc761a1[_0xba3b('0x48')]['id']}})['then'](handleEntityNotFound(_0x234fb2,null))[_0xba3b('0x28')](saveUpdates(_0xc761a1[_0xba3b('0x47')],null))['then'](respondWithResult(_0x234fb2,null))[_0xba3b('0x1e')](handleError(_0x234fb2,null));};exports[_0xba3b('0x29')]=function(_0x2c2f07,_0xfa9bb7){return db['ChatInteraction'][_0xba3b('0x45')]({'where':{'id':_0x2c2f07[_0xba3b('0x48')]['id']}})[_0xba3b('0x28')](handleEntityNotFound(_0xfa9bb7,null))[_0xba3b('0x28')](removeEntity(_0xfa9bb7,null))['catch'](handleError(_0xfa9bb7,null));};exports[_0xba3b('0x49')]=function(_0xfa4bc9,_0x56d3d9){return db[_0xba3b('0x34')][_0xba3b('0x49')]()[_0xba3b('0x28')](respondWithResult(_0x56d3d9,null))[_0xba3b('0x1e')](handleError(_0x56d3d9,null));};exports[_0xba3b('0x4a')]=function(_0x3bd0cf,_0x46a602){var _0x4c605e=_0x3bd0cf[_0xba3b('0x48')]['id'];var _0x33efdc;var _0x38f177;var _0x34a71a;return db[_0xba3b('0x34')]['findOne']({'where':{'id':_0x4c605e}})[_0xba3b('0x28')](function(_0x37c12b){_0x33efdc=_0x37c12b;return db[_0xba3b('0x4b')][_0xba3b('0x4c')]({'where':{'id':_0x37c12b[_0xba3b('0x4d')]},'attributes':['id','vidaooApiKey',_0xba3b('0x4e'),_0xba3b('0x4f'),_0xba3b('0x50'),_0xba3b('0x51')],'raw':!![]});})[_0xba3b('0x28')](function(_0x910cd){if(_0x910cd&&_0x910cd[_0xba3b('0x52')]&&_0x910cd[_0xba3b('0x4e')]){_0x38f177=_0x910cd;var _0x5e35df={'interaction':{'id':_0x4c605e},'agent':{'id':_0x3bd0cf['user']['id'],'name':_0x3bd0cf['user'][_0xba3b('0x2c')],'fullname':_0x3bd0cf[_0xba3b('0x39')][_0xba3b('0x53')],'email':_0x3bd0cf[_0xba3b('0x39')][_0xba3b('0x54')]},'contact':_0x3bd0cf[_0xba3b('0x47')][_0xba3b('0x30')],'account':_0x3bd0cf['body']['account']};var _0x19e805={'rejectUnauthorized':![],'method':_0xba3b('0x55'),'url':_0xba3b('0x56'),'headers':{'X-APIKEY':_0x910cd[_0xba3b('0x52')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3bd0cf[_0xba3b('0x39')]['email']],'buttons':null,'topic':_0x38f177[_0xba3b('0x4f')],'note':_['isNull'](_0x38f177[_0xba3b('0x50')])?null:getMustacheRender(_0x38f177['vidaooNote'],_0x5e35df),'metadata':null},'redirect':_0xba3b('0x57'),'json':!![]};try{if(!_[_0xba3b('0x58')](_0x38f177['vidaooMetadata'])){var _0x4f8fa1=getMustacheRender(_0x38f177[_0xba3b('0x51')],_0x5e35df);var _0x1b5931=JSON['parse'](_0x4f8fa1);_0x19e805[_0xba3b('0x47')][_0xba3b('0x59')]=_0x1b5931;}}catch(_0x30463c){throw new db[(_0xba3b('0x5a'))][(_0xba3b('0x5b'))](_0xba3b('0x5c'));}return rp(_0x19e805);}else{throw new db[(_0xba3b('0x5a'))][(_0xba3b('0x5b'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xba3b('0x28')](function(_0x12b7d3){_0x34a71a=_0x12b7d3;if(_0x34a71a['id']){var _0x17ae83={'body':_0x34a71a[_0xba3b('0x5d')],'ChatWebsiteId':_0x38f177['id'],'ChatInteractionId':_0x33efdc['id'],'direction':_0xba3b('0x5e'),'UserId':_0x3bd0cf[_0xba3b('0x39')]['id']};return db[_0xba3b('0x5f')]['create'](_0x17ae83,{});}else{throw new db['Sequelize'][(_0xba3b('0x5b'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x33efdc[_0xba3b('0x60')]({'vidaooSessionId':_0x34a71a['id']});})[_0xba3b('0x28')](respondWithResult(_0x46a602,null))[_0xba3b('0x1e')](handleError(_0x46a602,null));};exports[_0xba3b('0x61')]=function(_0x509d9c,_0x2f033f){if(_0x509d9c['body']['id']){delete _0x509d9c[_0xba3b('0x47')]['id'];}return db[_0xba3b('0x34')][_0xba3b('0x45')]({'where':{'id':_0x509d9c['params']['id']},'include':[{'model':db[_0xba3b('0x62')],'as':_0xba3b('0x63')}]})[_0xba3b('0x28')](handleEntityNotFound(_0x2f033f,null))[_0xba3b('0x28')](saveUpdates(_0x509d9c[_0xba3b('0x47')],null))[_0xba3b('0x28')](respondWithResult(_0x2f033f,null))[_0xba3b('0x1e')](handleError(_0x2f033f,null));};exports[_0xba3b('0x64')]=function(_0x501f9b,_0x3c3b58){if(_0x501f9b['body']['id']){delete _0x501f9b['body']['id'];}return db[_0xba3b('0x34')][_0xba3b('0x45')]({'where':{'id':_0x501f9b[_0xba3b('0x48')]['id']}})[_0xba3b('0x28')](function(_0x1e3e18){if(!_0x1e3e18){logger['error'](_0xba3b('0x65'),'abandon',0x194,_0xba3b('0x66'));_0x3c3b58['sendStatus'](0x194);}else{if(_0x1e3e18[_0xba3b('0x67')]){throw new db['Sequelize']['ValidationError'](_0xba3b('0x68'));}}return _0x1e3e18;})[_0xba3b('0x28')](function(_0x3a61a9){if(_0x3a61a9){return _0x3a61a9[_0xba3b('0x27')]({'closed':_0x501f9b[_0xba3b('0x47')][_0xba3b('0x69')],'disposition':_0x501f9b[_0xba3b('0x47')]['disposition']})[_0xba3b('0x28')](function(_0x41e57b){return _0x41e57b;});}})['then'](function(){return respondWithRpcPromise(_0xba3b('0x6a'),'abandon',_0x501f9b['body'],client9004);})[_0xba3b('0x28')](respondWithResult(_0x3c3b58,null))['catch'](handleError(_0x3c3b58,null));};exports[_0xba3b('0x6b')]=function(_0x4dc2f3,_0x229a65){_0x4dc2f3[_0xba3b('0x47')][_0xba3b('0x2c')]=_0x4dc2f3[_0xba3b('0x6c')][_0xba3b('0x6d')];_0x4dc2f3[_0xba3b('0x47')][_0xba3b('0x6e')]=_0x4dc2f3[_0xba3b('0x6c')]['filename'];_0x4dc2f3[_0xba3b('0x47')][_0xba3b('0x6f')]=_0x4dc2f3['file'][_0xba3b('0x70')];return db[_0xba3b('0x71')][_0xba3b('0x46')](_0x4dc2f3['body'])[_0xba3b('0x28')](respondWithResult(_0x229a65,0xc9))[_0xba3b('0x1e')](handleError(_0x229a65,null));};exports[_0xba3b('0x72')]=function(_0x2b2910,_0x22cf40){return db[_0xba3b('0x34')][_0xba3b('0x4c')]({'where':{'id':_0x2b2910[_0xba3b('0x48')]['id']},'raw':!![]})[_0xba3b('0x28')](handleEntityNotFound(_0x22cf40,null))[_0xba3b('0x28')](function(_0x666fee){if(_0x666fee){if(_0x666fee[_0xba3b('0x69')]){return _0x22cf40['status'](0x193)[_0xba3b('0x26')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0xba3b('0x4c')]({'where':{'id':_0x2b2910[_0xba3b('0x3d')][_0xba3b('0x73')]},'raw':!![]})['then'](handleEntityNotFound(_0x22cf40,null));}})['then'](function(_0x55ecd9){if(_0x55ecd9){var _0x1e14c0=_0x55ecd9[_0xba3b('0x74')]!==null;var _0x377503=path[_0xba3b('0x75')](config[_0xba3b('0x76')],'server/files/attachments/');if(_0x1e14c0){_0x377503=path[_0xba3b('0x75')](_0x377503,_0xba3b('0x77'));}var _0x1364f6=path[_0xba3b('0x75')](_0x377503,_0x55ecd9[_0xba3b('0x6e')]);return _0x22cf40[_0xba3b('0x78')](_0x1364f6);}})['catch'](handleError(_0x22cf40,null));};exports[_0xba3b('0x79')]=function(_0xeec75d,_0x5eacbd){var _0x5a402a=null;var _0x347025=null;var _0xbcad9c=null;if(_0xeec75d['body']['id']){delete _0xeec75d[_0xba3b('0x47')]['id'];}if(_0xeec75d[_0xba3b('0x47')][_0xba3b('0x7a')]){_0xbcad9c=path[_0xba3b('0x75')](config[_0xba3b('0x76')],_0xba3b('0x7b'),util[_0xba3b('0x7c')](_0xba3b('0x7d'),Date[_0xba3b('0x7e')]()));_0xeec75d[_0xba3b('0x47')][_0xba3b('0x7f')]=_0xbcad9c;}return db[_0xba3b('0x34')]['find']({'where':{'id':_0xeec75d[_0xba3b('0x48')]['id']},'include':[{'model':db[_0xba3b('0x5f')],'as':'Messages','include':[{'model':db[_0xba3b('0x80')],'as':_0xba3b('0x80')}]}]})[_0xba3b('0x28')](handleEntityNotFound(_0x5eacbd,null))[_0xba3b('0x28')](saveUpdates(_0xeec75d['body'],null))['then'](function(_0x565ed4){if(_0x565ed4){_0x5a402a=_0x565ed4;return db[_0xba3b('0x4b')][_0xba3b('0x45')]({'where':{'id':_0x5a402a[_0xba3b('0x4d')]}});}})[_0xba3b('0x28')](function(_0x35b135){if(_0x35b135){_0x347025=_0x35b135;return db[_0xba3b('0x62')][_0xba3b('0x45')]({'where':{'id':_0x5a402a[_0xba3b('0x81')]}});}})[_0xba3b('0x28')](function(_0x301238){if(_0x301238){if(_0xbcad9c){var _0x3b8bd6=null;for(var _0x2da2eb=0x1;_0x2da2eb<_0x5a402a[_0xba3b('0x82')][_0xba3b('0x42')];++_0x2da2eb){_0x3b8bd6=_0x5a402a[_0xba3b('0x82')][_0x2da2eb];var _0x7737c3=_0x3b8bd6[_0xba3b('0x67')]?util['format']('%s%d',_0x347025['agentAlias'],_0x3b8bd6[_0xba3b('0x67')]):_0xba3b('0x83');var _0x52abb5=_0xeec75d[_0xba3b('0x47')][_0xba3b('0x84')]||util['format'](_0xba3b('0x85'),'Visitor',_0x3b8bd6[_0xba3b('0x81')]);switch(_0x347025[_0xba3b('0x86')]){case _0xba3b('0x87'):_0x7737c3=_0x3b8bd6[_0xba3b('0x67')]?util[_0xba3b('0x7c')]('%s%d',_0x347025['agentAlias'],_0x3b8bd6[_0xba3b('0x67')]):'System';break;case'agent_alias':_0x7737c3=_0x3b8bd6[_0xba3b('0x67')]?_0x3b8bd6[_0xba3b('0x80')][_0xba3b('0x88')]||_0x3b8bd6[_0xba3b('0x80')][_0xba3b('0x53')]:_0xba3b('0x83');break;case _0xba3b('0x89'):_0x7737c3=_0x3b8bd6[_0xba3b('0x67')]?_0x3b8bd6[_0xba3b('0x80')][_0xba3b('0x53')]:_0xba3b('0x83');break;default:_0x7737c3=_0x3b8bd6[_0xba3b('0x67')]?util[_0xba3b('0x7c')](_0xba3b('0x85'),_0x347025[_0xba3b('0x8a')],_0x3b8bd6[_0xba3b('0x67')]):_0xba3b('0x83');}var _0x5790de=util[_0xba3b('0x7c')](_0xba3b('0x8b'),moment(_0x3b8bd6[_0xba3b('0x8c')])[_0xba3b('0x7c')]('MM/DD/YYYY\x20HH:mm:ss'),_0x3b8bd6[_0xba3b('0x8d')]==='in'?_0x52abb5:_0x7737c3,_0x3b8bd6[_0xba3b('0x47')]);if(!_0x3b8bd6[_0xba3b('0x8e')]){fs[_0xba3b('0x8f')](_0xbcad9c,_0x5790de);}}return db[_0xba3b('0x90')][_0xba3b('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0xba3b('0x91')],'as':_0xba3b('0x92'),'raw':!![],'include':[{'model':db[_0xba3b('0x93')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xba3b('0x28')](function(_0xa38f74){if(!_0xa38f74||!_0xa38f74[_0xba3b('0x92')]||!_0xeec75d[_0xba3b('0x47')])return _0x5a402a;var _0x155d09=_0xa38f74[_0xba3b('0x94')]();return respondWithRpcPromise(_0xba3b('0x95'),_0xba3b('0x96'),{'account':_0x155d09,'message':{'from':util[_0xba3b('0x7c')](_0xba3b('0x97'),_0xa38f74[_0xba3b('0x2c')],_0xa38f74[_0xba3b('0x54')]||_0xa38f74[_0xba3b('0x92')]['user']),'to':_0xeec75d[_0xba3b('0x47')][_0xba3b('0x7a')],'subject':_0xba3b('0x98'),'text':util[_0xba3b('0x7c')](_0xba3b('0x99'),_0xeec75d[_0xba3b('0x47')][_0xba3b('0x7a')]),'attachments':[{'path':_0xbcad9c}]}})['then'](function(){return _0x5a402a;})[_0xba3b('0x1e')](function(_0x5132cd){logger[_0xba3b('0x19')](_0x5132cd);});})[_0xba3b('0x28')](respondWithStatusCode(_0x5eacbd,0xc8))[_0xba3b('0x1e')](handleError(_0x5eacbd,null));};exports[_0xba3b('0x9a')]=function(_0x1ee7cb,_0x2dc63c){return db[_0xba3b('0x5f')]['find']({'where':{'id':_0x1ee7cb[_0xba3b('0x48')]['id']}})[_0xba3b('0x28')](handleEntityNotFound(_0x2dc63c,null))[_0xba3b('0x28')](function(_0x41811c){if(_0x41811c){return _0x41811c[_0xba3b('0x9a')](_0x1ee7cb[_0xba3b('0x47')][_0xba3b('0x9b')],_[_0xba3b('0x9c')](_0x1ee7cb[_0xba3b('0x47')],[_0xba3b('0x9b'),'id'])||{});}})[_0xba3b('0x28')](respondWithResult(_0x2dc63c,null))[_0xba3b('0x1e')](handleError(_0x2dc63c,null));};exports[_0xba3b('0x9d')]=function(_0x89c69a,_0x487afd){var _0x5768dd={'raw':![],'where':{}};var _0x4c4426={};var _0x87f3a7={'count':0x0,'rows':[]};return db[_0xba3b('0x34')][_0xba3b('0x4c')]({'where':{'id':_0x89c69a['params']['id']}})[_0xba3b('0x28')](handleEntityNotFound(_0x487afd,null))[_0xba3b('0x28')](function(_0x4d44c7){if(_0x4d44c7){_0x4c4426[_0xba3b('0x3b')]=_[_0xba3b('0x3c')](db['ChatMessage'][_0xba3b('0x35')]);_0x4c4426['query']=_['keys'](_0x89c69a[_0xba3b('0x3d')]);_0x4c4426[_0xba3b('0x3e')]=_[_0xba3b('0x3f')](_0x4c4426[_0xba3b('0x3b')],_0x4c4426[_0xba3b('0x3d')]);_0x5768dd[_0xba3b('0x40')]=_[_0xba3b('0x3f')](_0x4c4426[_0xba3b('0x3b')],qs[_0xba3b('0x41')](_0x89c69a[_0xba3b('0x3d')]['fields']));_0x5768dd[_0xba3b('0x40')]=_0x5768dd['attributes'][_0xba3b('0x42')]?_0x5768dd[_0xba3b('0x40')]:_0x4c4426[_0xba3b('0x3b')];if(!_0x89c69a[_0xba3b('0x3d')][_0xba3b('0x9e')](_0xba3b('0x9f'))){_0x5768dd['limit']=qs['limit'](_0x89c69a[_0xba3b('0x3d')][_0xba3b('0x23')]);_0x5768dd[_0xba3b('0x21')]=qs[_0xba3b('0x21')](_0x89c69a[_0xba3b('0x3d')]['offset']);}_0x5768dd[_0xba3b('0xa0')]=qs['sort'](_0x89c69a[_0xba3b('0x3d')][_0xba3b('0xa1')]);_0x5768dd['where']=qs['filters'](_[_0xba3b('0xa2')](_0x89c69a[_0xba3b('0x3d')],_0x4c4426[_0xba3b('0x3e')]));_0x5768dd['where'][_0xba3b('0xa3')]=_0x4d44c7['id'];if(_0x89c69a['query']['filter']){_0x5768dd['where']=_[_0xba3b('0x2f')](_0x5768dd['where'],{'$or':_[_0xba3b('0x33')](_0x5768dd[_0xba3b('0x40')],function(_0x46bc1e){var _0x5d9f9b={};_0x5d9f9b[_0x46bc1e]={'$like':'%'+_0x89c69a['query'][_0xba3b('0xa4')]+'%'};return _0x5d9f9b;})});}if(_0x89c69a[_0xba3b('0x3d')][_0xba3b('0xa5')]){var _0x392800=_0x89c69a['query'][_0xba3b('0xa5')][_0xba3b('0xa6')](',');var _0x51413d={};_0x51413d[_0x392800[0x0]]={'$gte':moment(_0x392800[0x1])[_0xba3b('0x7c')](_0xba3b('0xa7'))};_0x5768dd[_0xba3b('0xa8')]=_[_0xba3b('0x2f')](_0x5768dd['where'],_0x51413d);}_0x5768dd=_['merge']({},_0x5768dd,_0x89c69a[_0xba3b('0x44')]);return db[_0xba3b('0x5f')]['count']({'where':_0x5768dd[_0xba3b('0xa8')]})[_0xba3b('0x28')](function(_0x19d7f6){_0x87f3a7[_0xba3b('0x24')]=_0x19d7f6;if(_0x89c69a['query']['includeAll']){_0x5768dd['include']=[{'all':!![]}];}return db[_0xba3b('0x5f')][_0xba3b('0xa9')](_0x5768dd);})['then'](function(_0x56378c){_0x87f3a7[_0xba3b('0xaa')]=_0x56378c;return _0x87f3a7;});}})[_0xba3b('0x28')](respondWithFilteredResult(_0x487afd,_0x5768dd))[_0xba3b('0x1e')](handleError(_0x487afd,null));};exports[_0xba3b('0xab')]=function(_0x4716bf,_0x68e8a8){var _0x4cc9b6={'where':{}},_0x590390={},_0x55daaa={'count':0x0,'rows':[]};return db[_0xba3b('0x34')][_0xba3b('0x4c')]({'where':{'id':_0x4716bf[_0xba3b('0x48')]['id']}})['then'](handleEntityNotFound(_0x68e8a8,null))[_0xba3b('0x28')](function(_0x44c5b1){if(_0x44c5b1){_0x590390[_0xba3b('0x3b')]=_[_0xba3b('0x3c')](db[_0xba3b('0x5f')][_0xba3b('0x35')]);_0x590390[_0xba3b('0x3d')]=_['keys'](_0x4716bf[_0xba3b('0x3d')]);_0x590390[_0xba3b('0x3e')]=_[_0xba3b('0x3f')](_0x590390[_0xba3b('0x3b')],_0x590390[_0xba3b('0x3d')]);_0x4cc9b6[_0xba3b('0x40')]=_[_0xba3b('0x3f')](_0x590390[_0xba3b('0x3b')],qs[_0xba3b('0x41')](_0x4716bf[_0xba3b('0x3d')]['fields']));_0x4cc9b6[_0xba3b('0x40')]=_0x4cc9b6['attributes']['length']?_0x4cc9b6['attributes']:_0x590390[_0xba3b('0x3b')];if(!_0x4716bf[_0xba3b('0x3d')][_0xba3b('0x9e')](_0xba3b('0x9f'))){_0x4cc9b6[_0xba3b('0x23')]=qs[_0xba3b('0x23')](_0x4716bf[_0xba3b('0x3d')][_0xba3b('0x23')]);_0x4cc9b6[_0xba3b('0x21')]=qs[_0xba3b('0x21')](_0x4716bf[_0xba3b('0x3d')][_0xba3b('0x21')]);}_0x4cc9b6['order']=qs['sort'](_0x4716bf[_0xba3b('0x3d')]['sort']);_0x4cc9b6[_0xba3b('0xa8')]=qs[_0xba3b('0x3e')](_['pick'](_0x4716bf[_0xba3b('0x3d')],_0x590390[_0xba3b('0x3e')]));_0x4cc9b6[_0xba3b('0xa8')][_0xba3b('0xa3')]=_0x44c5b1['id'];if(_0x4716bf[_0xba3b('0x3d')][_0xba3b('0xa4')]){_0x4cc9b6[_0xba3b('0xa8')]=_['merge'](_0x4cc9b6[_0xba3b('0xa8')],{'$or':_['map'](_0x4cc9b6['attributes'],function(_0xfcc8af){var _0xc02d10={};_0xc02d10[_0xfcc8af]={'$like':'%'+_0x4716bf[_0xba3b('0x3d')][_0xba3b('0xa4')]+'%'};return _0xc02d10;})});}_0x4cc9b6['where'][_0xba3b('0x8e')]=![];if(_0x4716bf[_0xba3b('0x3d')]['id']){_0x4cc9b6[_0xba3b('0xa8')]['id']={'$gt':_0x4716bf[_0xba3b('0x3d')]['id']};}_0x4cc9b6=_[_0xba3b('0x2f')]({},_0x4cc9b6,_0x4716bf['options']);return db['ChatMessage'][_0xba3b('0x24')]({'where':_0x4cc9b6[_0xba3b('0xa8')]})[_0xba3b('0x28')](function(_0x144afb){_0x55daaa[_0xba3b('0x24')]=_0x144afb;_0x4cc9b6[_0xba3b('0xac')]=[];if(_0x4716bf['query'][_0xba3b('0xad')]){_0x4cc9b6['include'][_0xba3b('0xae')]({'model':db[_0xba3b('0x80')],'as':_0xba3b('0x80'),'attributes':['id',_0xba3b('0x53'),_0xba3b('0x88')]});}if(_0x4716bf[_0xba3b('0x3d')]['includeAll']){_0x4cc9b6[_0xba3b('0xac')]=[{'all':!![]}];}return db[_0xba3b('0x5f')]['findAll'](_0x4cc9b6);})[_0xba3b('0x28')](function(_0xa76bbb){_0x55daaa[_0xba3b('0xaa')]=_0xa76bbb;return _0x55daaa;});}})['then'](respondWithFilteredResult(_0x68e8a8,_0x4cc9b6))['catch'](handleError(_0x68e8a8,null));};exports[_0xba3b('0xaf')]=function(_0x4523db,_0x3323f2){return db[_0xba3b('0x34')][_0xba3b('0x45')]({'where':{'id':_0x4523db[_0xba3b('0x48')]['id']}})[_0xba3b('0x28')](handleEntityNotFound(_0x3323f2,null))[_0xba3b('0x28')](function(_0x1b2461){if(_0x1b2461){return _0x1b2461[_0xba3b('0xb0')](_0x4523db['body']['ids'],_['omit'](_0x4523db[_0xba3b('0x47')],[_0xba3b('0x9b'),'id'])||{})[_0xba3b('0xb1')](function(){return db[_0xba3b('0xb2')]['findAll']({'attributes':['id',_0xba3b('0x2c'),'color'],'where':{'id':_0x4523db['body'][_0xba3b('0x9b')]}});})[_0xba3b('0x28')](function(_0x3178c9){socket['emit']('chatInteractionTags:save',{'id':Number(_0x4523db[_0xba3b('0x48')]['id']),'tags':_0x3178c9||[]});return{'id':Number(_0x4523db['params']['id']),'tags':_0x3178c9||[]};});}})[_0xba3b('0x28')](respondWithResult(_0x3323f2,null))[_0xba3b('0x1e')](handleError(_0x3323f2,null));};exports[_0xba3b('0xb3')]=function(_0x28b47b,_0x375943){return db['ChatInteraction'][_0xba3b('0x45')]({'where':{'id':_0x28b47b['params']['id']}})[_0xba3b('0x28')](handleEntityNotFound(_0x375943,null))['then'](function(_0x4f916d){if(_0x4f916d){return _0x4f916d['removeTags'](_0x28b47b[_0xba3b('0x3d')][_0xba3b('0x9b')]);}})[_0xba3b('0x28')](respondWithStatusCode(_0x375943,null))[_0xba3b('0x1e')](handleError(_0x375943,null));};exports[_0xba3b('0x78')]=function(_0x21be51,_0x40cade){var _0x49ee96=moment()['unix']()[_0xba3b('0xb4')]();var _0x42c4bd=path['join'](config[_0xba3b('0x76')],_0xba3b('0xb5'),_0xba3b('0xb6'),_0xba3b('0xb7'));var _0xdb3446=path[_0xba3b('0x75')](config[_0xba3b('0x76')],'server','files',_0xba3b('0xb8'));var _0xffb02e=path[_0xba3b('0x75')](_0x42c4bd,_0x49ee96);var _0x4f77b3=util[_0xba3b('0x7c')](_0xba3b('0xb9'),_0x21be51[_0xba3b('0x48')]['id'],_0x49ee96);var _0xbde99c=path[_0xba3b('0x75')](_0x42c4bd,_0x4f77b3);var _0x471023=[];_0x471023[_0xba3b('0xae')]({'model':db[_0xba3b('0x80')],'as':_0xba3b('0x80'),'attributes':['id','fullname'],'raw':!![]});_0x471023[_0xba3b('0xae')]({'model':db['CmContact'],'as':_0xba3b('0x63'),'attributes':['id',_0xba3b('0xba'),_0xba3b('0xbb')],'raw':!![]});if(_0x21be51[_0xba3b('0x3d')]['attachments']){_0x471023[_0xba3b('0xae')]({'model':db[_0xba3b('0x71')],'as':_0xba3b('0x71'),'raw':!![]});}var _0x2cd693=[{'model':db[_0xba3b('0x5f')],'as':_0xba3b('0x82'),'attributes':['id','body','createdAt',_0xba3b('0x8d'),'secret',_0xba3b('0xbc')],'include':_0x471023}];_0x2cd693[_0xba3b('0xae')]({'model':db[_0xba3b('0x4b')],'as':_0xba3b('0xbd'),'attributes':['id',_0xba3b('0x2c')]});_0x2cd693['push']({'model':db['User'],'as':_0xba3b('0xbe'),'attributes':['id','fullname']});return db[_0xba3b('0x34')][_0xba3b('0x45')]({'where':{'id':_0x21be51['params']['id']},'include':_0x2cd693})[_0xba3b('0x28')](handleEntityNotFound(_0x40cade,null))[_0xba3b('0x28')](function(_0x2e65ac){if(_0x2e65ac){var _0x50a5aa=_0x2e65ac[_0xba3b('0xbf')]({'plain':!![]});fs[_0xba3b('0xc0')](_0xffb02e);var _0x1416fd={'channel':_0xba3b('0xc1'),'account':_0x50a5aa[_0xba3b('0xbd')]['name'],'agent':_0x50a5aa[_0xba3b('0xbe')]?_0x50a5aa[_0xba3b('0xbe')][_0xba3b('0x53')]:_0xba3b('0xc2'),'createdAt':moment(_0x50a5aa[_0xba3b('0x8c')])[_0xba3b('0x7c')](_0xba3b('0xa7'))[_0xba3b('0xb4')](),'closedAt':_0x50a5aa[_0xba3b('0x69')]?moment(_0x50a5aa['closedAt'])[_0xba3b('0x7c')](_0xba3b('0xa7'))['toString']():'','disposition':_0x50a5aa[_0xba3b('0xc3')],'chatInfo':{'browser':_0x50a5aa[_0xba3b('0xc4')],'os':_0x50a5aa[_0xba3b('0xc5')],'referer':_0x50a5aa['referer'],'customerIp':_0x50a5aa[_0xba3b('0xc6')],'customerPort':_0x50a5aa[_0xba3b('0xc7')]?_0x50a5aa[_0xba3b('0xc7')]:_0xba3b('0xc2')},'messages':_(_0x50a5aa[_0xba3b('0x82')])[_0xba3b('0xc8')]()[_0xba3b('0xa4')]({'secret':![]})[_0xba3b('0x33')](function(_0x331dca){if(_0x331dca[_0xba3b('0x71')]){var _0x549d4a=path[_0xba3b('0x75')](_0xdb3446,_0x331dca['Attachment'][_0xba3b('0x6e')]);if(fs['existsSync'](_0x549d4a)){fs[_0xba3b('0xc9')](_0x549d4a)[_0xba3b('0xca')](fs[_0xba3b('0xcb')](path['join'](_0xffb02e,_0x331dca[_0xba3b('0x71')][_0xba3b('0x6e')])));}}return{'date':moment(_0x331dca[_0xba3b('0x8c')])['format'](_0xba3b('0xa7'))[_0xba3b('0xb4')](),'sender':_0x331dca['direction']===_0xba3b('0x5e')?_0x331dca[_0xba3b('0x80')]?_0x331dca['User'][_0xba3b('0x53')]:'System':_0x331dca[_0xba3b('0x63')][_0xba3b('0xba')]+(_0x331dca['Contact'][_0xba3b('0xbb')]?'\x20'+_0x331dca[_0xba3b('0x63')][_0xba3b('0xbb')]:''),'body':_0x331dca[_0xba3b('0x71')]?_0x331dca[_0xba3b('0x71')][_0xba3b('0x6e')]:_0x331dca[_0xba3b('0x47')],'direction':_0x331dca[_0xba3b('0x8d')]===_0xba3b('0x5e')?'A':'C','secret':_0x331dca['secret'],'read':_0x331dca[_0xba3b('0xbc')],'attachment':_0x331dca[_0xba3b('0x71')]};})[_0xba3b('0xcc')]()};return ejs[_0xba3b('0xcd')](path[_0xba3b('0x75')](config['root'],'server',_0xba3b('0xce'),_0xba3b('0xcf')),{'interaction':_0x1416fd})['then'](function(_0x2e5703){var _0x458c0e=path[_0xba3b('0x75')](_0xffb02e,_0xba3b('0xd0')+_0x50a5aa['id']+'-'+_0x49ee96+'.pdf');var _0x3a34cd={'path':_0x458c0e,'channel':_0xba3b('0xc1'),'interactionId':_0x50a5aa['id']};return pdf['createPdfFromHTML'](_0x2e5703,_0x3a34cd);})[_0xba3b('0x28')](function(){return new Promise(function(_0x46696f,_0x556694){zipdir(_0xffb02e,{'saveTo':_0xbde99c},function(_0x31aa69,_0x508f7b){if(_0x31aa69)return _0x556694(_0x31aa69);return _0x46696f(_0x508f7b);});})['then'](function(){return new BPromise(function(_0x43bb38,_0x525c2d){rimraf(_0xffb02e,function(_0x4576bf){if(_0x4576bf)_0x525c2d(_0x4576bf);return _0x43bb38();});});})[_0xba3b('0x28')](function(){return _0x40cade[_0xba3b('0x78')](_0xbde99c,_0x4f77b3,function(_0x19c413){if(_0x19c413){logger['error'](_0xba3b('0xd1'),_0x19c413);}else{fs[_0xba3b('0xd2')](_0xbde99c);}});});});}else{return _0x40cade[_0xba3b('0x1f')](0xc8);}})['catch'](handleError(_0x40cade,null));}; \ No newline at end of file +var _0x1435=['render','merge','body','contact','interaction','account','index','map','rawAttributes','type','key','getOptions','findAll','query','user','show','params','model','keys','ChatInteraction','intersection','attributes','fields','includeAll','options','create','update','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooTopic','vidaooNote','vidaooApiKey','vidaooEscalation','fullname','email','POST','isNull','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','find','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','closed','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','User','length','%s%d','agentAlias','customer','format','Visitor','agentIdentifier','website_alias','System','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','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','ids','getMessages','filters','nolimit','order','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','hasOwnProperty','sort','pick','include','includeAgent','push','alias','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','files','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','Chat','closedAt','disposition','browserName','osName','referer','customerIp','customerPort','N.A.','existsSync','createReadStream','pipe','createWriteStream','value','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','stack','name','send'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1435,0xa4));var _0x5143=function(_0x560371,_0x48622d){_0x560371=_0x560371-0x0;var _0x2c51e4=_0x1435[_0x560371];return _0x2c51e4;};'use strict';var rimraf=require(_0x5143('0x0'));var zipdir=require(_0x5143('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5143('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5143('0x3'));var ejs=require(_0x5143('0x4'));var fs=require('fs');var _=require(_0x5143('0x5'));var Redis=require(_0x5143('0x6'));var interaction=require(_0x5143('0x7'));var qs=require(_0x5143('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x5143('0x9'))(_0x5143('0xa'));var config=require('../../config/environment');var db=require(_0x5143('0xb'))['db'];config[_0x5143('0xc')]=_[_0x5143('0xd')](config[_0x5143('0xc')],{'host':_0x5143('0xe'),'port':0x18eb});var socket=require(_0x5143('0xf'))(new Redis(config[_0x5143('0xc')]));require('./chatInteraction.socket')[_0x5143('0x10')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5143('0x11')][_0x5143('0x12')]({'port':0x232b});var client9004=jayson['client'][_0x5143('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x22f36b,_0x99b0f9,_0x1d2e48,_0x1c8b64){return new BPromise(function(_0x23916c,_0x3ebcd9){var _0x9ee037=_0x1c8b64||client;return _0x9ee037[_0x5143('0x13')](_0x22f36b,_0x1d2e48)[_0x5143('0x14')](function(_0x51f6b6){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x99b0f9,'request\x20sent');logger[_0x5143('0x15')](_0x5143('0x16'),_0x99b0f9,_0x5143('0x17'),JSON[_0x5143('0x18')](_0x51f6b6));if(_0x51f6b6['error']){if(_0x51f6b6[_0x5143('0x19')][_0x5143('0x1a')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x99b0f9,_0x51f6b6['error'][_0x5143('0x1b')]);return _0x3ebcd9(_0x51f6b6[_0x5143('0x19')][_0x5143('0x1b')]);}logger['error'](_0x5143('0x1c'),_0x99b0f9,_0x51f6b6[_0x5143('0x19')][_0x5143('0x1b')]);return _0x23916c(_0x51f6b6[_0x5143('0x19')][_0x5143('0x1b')]);}else{logger[_0x5143('0x1d')](_0x5143('0x1c'),_0x99b0f9,_0x5143('0x17'));_0x23916c(_0x51f6b6[_0x5143('0x1e')][_0x5143('0x1b')]);}})[_0x5143('0x1f')](function(_0x127e93){logger['error'](_0x5143('0x1c'),_0x99b0f9,_0x127e93);_0x3ebcd9(_0x127e93);});});}function respondWithStatusCode(_0x548e01,_0x28acf6){_0x28acf6=_0x28acf6||0xcc;return function(_0x5593c8){if(_0x5593c8){return _0x548e01[_0x5143('0x20')](_0x28acf6);}return _0x548e01[_0x5143('0x21')](_0x28acf6)[_0x5143('0x22')]();};}function respondWithResult(_0x10116f,_0x2fa4da){_0x2fa4da=_0x2fa4da||0xc8;return function(_0x4c46dc){if(_0x4c46dc){return _0x10116f['status'](_0x2fa4da)[_0x5143('0x23')](_0x4c46dc);}};}function respondWithFilteredResult(_0x5916af,_0x4bc933){return function(_0x4ea206){if(_0x4ea206){var _0x322a4d=typeof _0x4bc933[_0x5143('0x24')]===_0x5143('0x25')&&typeof _0x4bc933[_0x5143('0x26')]===_0x5143('0x25');var _0x27cd14=_0x4ea206[_0x5143('0x27')];var _0x5b43b0=_0x322a4d?0x0:_0x4bc933['offset'];var _0x571383=_0x322a4d?_0x4ea206[_0x5143('0x27')]:_0x4bc933[_0x5143('0x24')]+_0x4bc933[_0x5143('0x26')];var _0xf59757;if(_0x571383>=_0x27cd14){_0x571383=_0x27cd14;_0xf59757=0xc8;}else{_0xf59757=0xce;}_0x5916af[_0x5143('0x21')](_0xf59757);return _0x5916af[_0x5143('0x28')]('Content-Range',_0x5b43b0+'-'+_0x571383+'/'+_0x27cd14)[_0x5143('0x23')](_0x4ea206);}return null;};}function saveUpdates(_0x3ada72){return function(_0x64c488){if(_0x64c488){return _0x64c488['update'](_0x3ada72)[_0x5143('0x14')](function(_0x397c1e){return _0x397c1e;});}return null;};}function removeEntity(_0x5ae02f){return function(_0x2bbe02){if(_0x2bbe02){return _0x2bbe02[_0x5143('0x29')]()[_0x5143('0x14')](function(){_0x5ae02f['status'](0xcc)[_0x5143('0x22')]();});}};}function handleEntityNotFound(_0x4b97f8){return function(_0x5d04e1){if(!_0x5d04e1){_0x4b97f8[_0x5143('0x20')](0x194);}return _0x5d04e1;};}function handleError(_0x384490,_0x1a35b0){_0x1a35b0=_0x1a35b0||0x1f4;return function(_0x57f6f3){logger[_0x5143('0x19')](_0x57f6f3[_0x5143('0x2a')]);if(_0x57f6f3['name']){delete _0x57f6f3[_0x5143('0x2b')];}_0x384490[_0x5143('0x21')](_0x1a35b0)[_0x5143('0x2c')](_0x57f6f3);};}function getMustacheRender(_0x393ee8,_0x1fb999){return Mustache[_0x5143('0x2d')](_0x393ee8,_[_0x5143('0x2e')](_0x1fb999[_0x5143('0x2f')],{'contact':_0x1fb999[_0x5143('0x30')],'message':_0x1fb999['message'],'agent':_0x1fb999['agent'],'interaction':_0x1fb999[_0x5143('0x31')],'account':_0x1fb999[_0x5143('0x32')]}))||'';}exports[_0x5143('0x33')]=function(_0x1b7d4e,_0x598771){var _0x29c68b={};var _0x333868=_[_0x5143('0x34')](db['ChatInteraction'][_0x5143('0x35')],function(_0x279f96){return{'name':_0x279f96['fieldName'],'type':_0x279f96[_0x5143('0x36')][_0x5143('0x37')]};});_0x29c68b=qs[_0x5143('0x38')](_0x333868,_0x1b7d4e);return interaction[_0x5143('0x39')]('chat',_0x1b7d4e[_0x5143('0x3a')],_0x1b7d4e[_0x5143('0x3b')],_0x29c68b,_0x333868)[_0x5143('0x14')](respondWithFilteredResult(_0x598771,_0x29c68b))[_0x5143('0x1f')](handleError(_0x598771,null));};exports[_0x5143('0x3c')]=function(_0x49842c,_0x20134f){var _0x11803c={'raw':![],'where':{'id':_0x49842c[_0x5143('0x3d')]['id']}},_0x3f866={};_0x3f866[_0x5143('0x3e')]=_[_0x5143('0x3f')](db[_0x5143('0x40')]['rawAttributes']);_0x3f866[_0x5143('0x3a')]=_['keys'](_0x49842c[_0x5143('0x3a')]);_0x3f866['filters']=_[_0x5143('0x41')](_0x3f866['model'],_0x3f866[_0x5143('0x3a')]);_0x11803c[_0x5143('0x42')]=_[_0x5143('0x41')](_0x3f866[_0x5143('0x3e')],qs[_0x5143('0x43')](_0x49842c[_0x5143('0x3a')][_0x5143('0x43')]));_0x11803c[_0x5143('0x42')]=_0x11803c[_0x5143('0x42')]['length']?_0x11803c[_0x5143('0x42')]:_0x3f866[_0x5143('0x3e')];if(_0x49842c[_0x5143('0x3a')][_0x5143('0x44')]){_0x11803c['include']=[{'all':!![]}];}_0x11803c=_[_0x5143('0x2e')]({},_0x11803c,_0x49842c[_0x5143('0x45')]);return db[_0x5143('0x40')]['find'](_0x11803c)[_0x5143('0x14')](handleEntityNotFound(_0x20134f,null))[_0x5143('0x14')](respondWithResult(_0x20134f,null))[_0x5143('0x1f')](handleError(_0x20134f,null));};exports['create']=function(_0x179fa6,_0x393fa7){return db[_0x5143('0x40')][_0x5143('0x46')](_0x179fa6[_0x5143('0x2f')],{})[_0x5143('0x14')](respondWithResult(_0x393fa7,0xc9))[_0x5143('0x1f')](handleError(_0x393fa7,null));};exports[_0x5143('0x47')]=function(_0x3dabdd,_0x175b93){if(_0x3dabdd[_0x5143('0x2f')]['id']){delete _0x3dabdd[_0x5143('0x2f')]['id'];}return db[_0x5143('0x40')]['find']({'where':{'id':_0x3dabdd[_0x5143('0x3d')]['id']}})[_0x5143('0x14')](handleEntityNotFound(_0x175b93,null))[_0x5143('0x14')](saveUpdates(_0x3dabdd[_0x5143('0x2f')],null))[_0x5143('0x14')](respondWithResult(_0x175b93,null))['catch'](handleError(_0x175b93,null));};exports['destroy']=function(_0x117876,_0x244cba){return db['ChatInteraction']['find']({'where':{'id':_0x117876[_0x5143('0x3d')]['id']}})[_0x5143('0x14')](handleEntityNotFound(_0x244cba,null))['then'](removeEntity(_0x244cba,null))[_0x5143('0x1f')](handleError(_0x244cba,null));};exports['describe']=function(_0x35748e,_0x3887df){return db[_0x5143('0x40')]['describe']()[_0x5143('0x14')](respondWithResult(_0x3887df,null))[_0x5143('0x1f')](handleError(_0x3887df,null));};exports[_0x5143('0x48')]=function(_0x348f58,_0x1a791f){var _0x518771=_0x348f58[_0x5143('0x3d')]['id'];var _0x3df984;var _0x4a23c4;var _0x3cb300;return db[_0x5143('0x40')][_0x5143('0x49')]({'where':{'id':_0x518771}})[_0x5143('0x14')](function(_0x11d53e){_0x3df984=_0x11d53e;return db[_0x5143('0x4a')]['findOne']({'where':{'id':_0x11d53e[_0x5143('0x4b')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0x5143('0x4c'),_0x5143('0x4d'),'vidaooMetadata'],'raw':!![]});})[_0x5143('0x14')](function(_0x547bdd){if(_0x547bdd&&_0x547bdd[_0x5143('0x4e')]&&_0x547bdd[_0x5143('0x4f')]){_0x4a23c4=_0x547bdd;var _0x5608e1={'interaction':{'id':_0x518771},'agent':{'id':_0x348f58[_0x5143('0x3b')]['id'],'name':_0x348f58['user'][_0x5143('0x2b')],'fullname':_0x348f58['user'][_0x5143('0x50')],'email':_0x348f58['user'][_0x5143('0x51')]},'contact':_0x348f58['body'][_0x5143('0x30')],'account':_0x348f58[_0x5143('0x2f')][_0x5143('0x32')]};var _0x475bb9={'rejectUnauthorized':![],'method':_0x5143('0x52'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x547bdd['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x348f58[_0x5143('0x3b')][_0x5143('0x51')]],'buttons':null,'topic':_0x4a23c4[_0x5143('0x4c')],'note':_[_0x5143('0x53')](_0x4a23c4[_0x5143('0x4d')])?null:getMustacheRender(_0x4a23c4['vidaooNote'],_0x5608e1),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x5143('0x53')](_0x4a23c4[_0x5143('0x54')])){var _0xaaf369=getMustacheRender(_0x4a23c4[_0x5143('0x54')],_0x5608e1);var _0x26c384=JSON['parse'](_0xaaf369);_0x475bb9[_0x5143('0x2f')][_0x5143('0x55')]=_0x26c384;}}catch(_0x415667){throw new db['Sequelize'][(_0x5143('0x56'))](_0x5143('0x57'));}return rp(_0x475bb9);}else{throw new db['Sequelize'][(_0x5143('0x56'))](_0x5143('0x58'));}})[_0x5143('0x14')](function(_0x284d56){_0x3cb300=_0x284d56;if(_0x3cb300['id']){var _0x3adf02={'body':_0x3cb300[_0x5143('0x59')],'ChatWebsiteId':_0x4a23c4['id'],'ChatInteractionId':_0x3df984['id'],'direction':_0x5143('0x5a'),'UserId':_0x348f58['user']['id']};return db[_0x5143('0x5b')]['create'](_0x3adf02,{});}else{throw new db[(_0x5143('0x5c'))][(_0x5143('0x56'))](_0x5143('0x5d'));}})[_0x5143('0x14')](function(){return _0x3df984[_0x5143('0x5e')]({'vidaooSessionId':_0x3cb300['id']});})[_0x5143('0x14')](respondWithResult(_0x1a791f,null))[_0x5143('0x1f')](handleError(_0x1a791f,null));};exports['customUpdate']=function(_0x53c706,_0x358c3f){if(_0x53c706[_0x5143('0x2f')]['id']){delete _0x53c706[_0x5143('0x2f')]['id'];}return db['ChatInteraction'][_0x5143('0x5f')]({'where':{'id':_0x53c706[_0x5143('0x3d')]['id']},'include':[{'model':db[_0x5143('0x60')],'as':_0x5143('0x61')}]})[_0x5143('0x14')](handleEntityNotFound(_0x358c3f,null))['then'](saveUpdates(_0x53c706[_0x5143('0x2f')],null))[_0x5143('0x14')](respondWithResult(_0x358c3f,null))[_0x5143('0x1f')](handleError(_0x358c3f,null));};exports[_0x5143('0x62')]=function(_0x41ba7b,_0xe54546){if(_0x41ba7b['body']['id']){delete _0x41ba7b['body']['id'];}return db[_0x5143('0x40')][_0x5143('0x5f')]({'where':{'id':_0x41ba7b['params']['id']}})[_0x5143('0x14')](function(_0x21c376){if(!_0x21c376){logger[_0x5143('0x19')](_0x5143('0x63'),_0x5143('0x62'),0x194,_0x5143('0x64'));_0xe54546[_0x5143('0x20')](0x194);}else{if(_0x21c376[_0x5143('0x65')]){throw new db[(_0x5143('0x5c'))][(_0x5143('0x56'))](_0x5143('0x66'));}}return _0x21c376;})[_0x5143('0x14')](function(_0xe20aaa){if(_0xe20aaa){return _0xe20aaa[_0x5143('0x47')]({'closed':_0x41ba7b[_0x5143('0x2f')]['closed'],'disposition':_0x41ba7b[_0x5143('0x2f')]['disposition']})[_0x5143('0x14')](function(_0x40df3a){return _0x40df3a;});}})['then'](function(){return respondWithRpcPromise(_0x5143('0x67'),'abandon',_0x41ba7b[_0x5143('0x2f')],client9004);})['then'](respondWithResult(_0xe54546,null))[_0x5143('0x1f')](handleError(_0xe54546,null));};exports[_0x5143('0x68')]=function(_0x33c0df,_0x2f7fe7){_0x33c0df[_0x5143('0x2f')][_0x5143('0x2b')]=_0x33c0df[_0x5143('0x69')][_0x5143('0x6a')];_0x33c0df[_0x5143('0x2f')][_0x5143('0x6b')]=_0x33c0df[_0x5143('0x69')][_0x5143('0x6c')];_0x33c0df['body'][_0x5143('0x36')]=_0x33c0df['file']['mimetype'];return db[_0x5143('0x6d')][_0x5143('0x46')](_0x33c0df['body'])[_0x5143('0x14')](respondWithResult(_0x2f7fe7,0xc9))[_0x5143('0x1f')](handleError(_0x2f7fe7,null));};exports[_0x5143('0x6e')]=function(_0x40d73a,_0xf3542b){return db[_0x5143('0x40')][_0x5143('0x49')]({'where':{'id':_0x40d73a[_0x5143('0x3d')]['id']},'raw':!![]})[_0x5143('0x14')](handleEntityNotFound(_0xf3542b,null))[_0x5143('0x14')](function(_0x4d81fc){if(_0x4d81fc){if(_0x4d81fc[_0x5143('0x6f')]){return _0xf3542b[_0x5143('0x21')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x5143('0x6d')]['findOne']({'where':{'id':_0x40d73a['query'][_0x5143('0x70')]},'raw':!![]})[_0x5143('0x14')](handleEntityNotFound(_0xf3542b,null));}})[_0x5143('0x14')](function(_0x3d692c){if(_0x3d692c){var _0x134221=_0x3d692c[_0x5143('0x71')]!==null;var _0x41c258=path[_0x5143('0x72')](config[_0x5143('0x73')],_0x5143('0x74'));if(_0x134221){_0x41c258=path[_0x5143('0x72')](_0x41c258,_0x5143('0x75'));}var _0x2e3dff=path['join'](_0x41c258,_0x3d692c[_0x5143('0x6b')]);return _0xf3542b[_0x5143('0x76')](_0x2e3dff);}})[_0x5143('0x1f')](handleError(_0xf3542b,null));};exports[_0x5143('0x77')]=function(_0x14f1a5,_0x5628cd){var _0x4b91c7=null;var _0x5c0a4f=null;var _0x4c7053=null;if(_0x14f1a5[_0x5143('0x2f')]['id']){delete _0x14f1a5[_0x5143('0x2f')]['id'];}if(_0x14f1a5[_0x5143('0x2f')][_0x5143('0x78')]){_0x4c7053=path[_0x5143('0x72')](config[_0x5143('0x73')],_0x5143('0x79'),util['format'](_0x5143('0x7a'),Date[_0x5143('0x7b')]()));_0x14f1a5[_0x5143('0x2f')][_0x5143('0x7c')]=_0x4c7053;}return db['ChatInteraction'][_0x5143('0x5f')]({'where':{'id':_0x14f1a5['params']['id']},'include':[{'model':db[_0x5143('0x5b')],'as':_0x5143('0x7d'),'include':[{'model':db[_0x5143('0x7e')],'as':_0x5143('0x7e')}]}]})[_0x5143('0x14')](handleEntityNotFound(_0x5628cd,null))[_0x5143('0x14')](saveUpdates(_0x14f1a5[_0x5143('0x2f')],null))[_0x5143('0x14')](function(_0xd1300a){if(_0xd1300a){_0x4b91c7=_0xd1300a;return db[_0x5143('0x4a')][_0x5143('0x5f')]({'where':{'id':_0x4b91c7[_0x5143('0x4b')]}});}})[_0x5143('0x14')](function(_0x55a7e6){if(_0x55a7e6){_0x5c0a4f=_0x55a7e6;return db[_0x5143('0x60')][_0x5143('0x5f')]({'where':{'id':_0x4b91c7['ContactId']}});}})['then'](function(_0x3fa457){if(_0x3fa457){if(_0x4c7053){var _0x2f26e8=null;for(var _0xd0804d=0x1;_0xd0804d<_0x4b91c7[_0x5143('0x7d')][_0x5143('0x7f')];++_0xd0804d){_0x2f26e8=_0x4b91c7[_0x5143('0x7d')][_0xd0804d];var _0x490419=_0x2f26e8['UserId']?util['format'](_0x5143('0x80'),_0x5c0a4f[_0x5143('0x81')],_0x2f26e8['UserId']):'System';var _0x23d196=_0x14f1a5[_0x5143('0x2f')][_0x5143('0x82')]||util[_0x5143('0x83')]('%s%d',_0x5143('0x84'),_0x2f26e8['ContactId']);switch(_0x5c0a4f[_0x5143('0x85')]){case _0x5143('0x86'):_0x490419=_0x2f26e8[_0x5143('0x65')]?util[_0x5143('0x83')](_0x5143('0x80'),_0x5c0a4f[_0x5143('0x81')],_0x2f26e8[_0x5143('0x65')]):'System';break;case'agent_alias':_0x490419=_0x2f26e8[_0x5143('0x65')]?_0x2f26e8[_0x5143('0x7e')]['alias']||_0x2f26e8[_0x5143('0x7e')][_0x5143('0x50')]:'System';break;case'agent_fullname':_0x490419=_0x2f26e8['UserId']?_0x2f26e8['User']['fullname']:_0x5143('0x87');break;default:_0x490419=_0x2f26e8[_0x5143('0x65')]?util[_0x5143('0x83')](_0x5143('0x80'),_0x5c0a4f[_0x5143('0x81')],_0x2f26e8[_0x5143('0x65')]):_0x5143('0x87');}var _0x1364c5=util[_0x5143('0x83')](_0x5143('0x88'),moment(_0x2f26e8[_0x5143('0x89')])['format'](_0x5143('0x8a')),_0x2f26e8[_0x5143('0x8b')]==='in'?_0x23d196:_0x490419,_0x2f26e8[_0x5143('0x2f')]);if(!_0x2f26e8[_0x5143('0x8c')]){fs[_0x5143('0x8d')](_0x4c7053,_0x1364c5);}}return db[_0x5143('0x8e')][_0x5143('0x49')]({'where':{'service':!![]},'include':[{'model':db[_0x5143('0x8f')],'as':_0x5143('0x90'),'raw':!![],'include':[{'model':db[_0x5143('0x91')],'as':_0x5143('0x91'),'raw':!![]}]}]});}}})[_0x5143('0x14')](function(_0x342643){if(!_0x342643||!_0x342643[_0x5143('0x90')]||!_0x14f1a5[_0x5143('0x2f')])return _0x4b91c7;var _0x310566=_0x342643['getSmtpOptions']();return respondWithRpcPromise(_0x5143('0x92'),_0x5143('0x93'),{'account':_0x310566,'message':{'from':util[_0x5143('0x83')](_0x5143('0x94'),_0x342643[_0x5143('0x2b')],_0x342643[_0x5143('0x51')]||_0x342643[_0x5143('0x90')][_0x5143('0x3b')]),'to':_0x14f1a5['body'][_0x5143('0x78')],'subject':_0x5143('0x95'),'text':util[_0x5143('0x83')](_0x5143('0x96'),_0x14f1a5['body']['mailTranscript']),'attachments':[{'path':_0x4c7053}]}})[_0x5143('0x14')](function(){return _0x4b91c7;})[_0x5143('0x1f')](function(_0x310dda){logger[_0x5143('0x19')](_0x310dda);});})[_0x5143('0x14')](respondWithStatusCode(_0x5628cd,0xc8))[_0x5143('0x1f')](handleError(_0x5628cd,null));};exports[_0x5143('0x97')]=function(_0x4d5876,_0x3434d0){return db[_0x5143('0x5b')]['find']({'where':{'id':_0x4d5876[_0x5143('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3434d0,null))[_0x5143('0x14')](function(_0x2f37d8){if(_0x2f37d8){return _0x2f37d8[_0x5143('0x97')](_0x4d5876[_0x5143('0x2f')][_0x5143('0x98')],_['omit'](_0x4d5876['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x3434d0,null))[_0x5143('0x1f')](handleError(_0x3434d0,null));};exports[_0x5143('0x99')]=function(_0x3a27d8,_0xca70a8){var _0x41ac00={'raw':![],'where':{}};var _0x109293={};var _0x4e199f={'count':0x0,'rows':[]};return db[_0x5143('0x40')][_0x5143('0x49')]({'where':{'id':_0x3a27d8[_0x5143('0x3d')]['id']}})[_0x5143('0x14')](handleEntityNotFound(_0xca70a8,null))['then'](function(_0x48ef64){if(_0x48ef64){_0x109293[_0x5143('0x3e')]=_[_0x5143('0x3f')](db[_0x5143('0x5b')]['rawAttributes']);_0x109293[_0x5143('0x3a')]=_[_0x5143('0x3f')](_0x3a27d8[_0x5143('0x3a')]);_0x109293[_0x5143('0x9a')]=_[_0x5143('0x41')](_0x109293['model'],_0x109293[_0x5143('0x3a')]);_0x41ac00[_0x5143('0x42')]=_[_0x5143('0x41')](_0x109293[_0x5143('0x3e')],qs[_0x5143('0x43')](_0x3a27d8[_0x5143('0x3a')][_0x5143('0x43')]));_0x41ac00[_0x5143('0x42')]=_0x41ac00[_0x5143('0x42')][_0x5143('0x7f')]?_0x41ac00[_0x5143('0x42')]:_0x109293[_0x5143('0x3e')];if(!_0x3a27d8[_0x5143('0x3a')]['hasOwnProperty'](_0x5143('0x9b'))){_0x41ac00[_0x5143('0x26')]=qs[_0x5143('0x26')](_0x3a27d8['query'][_0x5143('0x26')]);_0x41ac00[_0x5143('0x24')]=qs[_0x5143('0x24')](_0x3a27d8[_0x5143('0x3a')]['offset']);}_0x41ac00[_0x5143('0x9c')]=qs['sort'](_0x3a27d8[_0x5143('0x3a')]['sort']);_0x41ac00[_0x5143('0x9d')]=qs[_0x5143('0x9a')](_['pick'](_0x3a27d8[_0x5143('0x3a')],_0x109293[_0x5143('0x9a')]));_0x41ac00['where'][_0x5143('0x9e')]=_0x48ef64['id'];if(_0x3a27d8[_0x5143('0x3a')][_0x5143('0x9f')]){_0x41ac00[_0x5143('0x9d')]=_[_0x5143('0x2e')](_0x41ac00[_0x5143('0x9d')],{'$or':_[_0x5143('0x34')](_0x41ac00[_0x5143('0x42')],function(_0x9c318c){var _0x46c8af={};_0x46c8af[_0x9c318c]={'$like':'%'+_0x3a27d8[_0x5143('0x3a')][_0x5143('0x9f')]+'%'};return _0x46c8af;})});}if(_0x3a27d8[_0x5143('0x3a')]['$gte']){var _0x105993=_0x3a27d8[_0x5143('0x3a')][_0x5143('0xa0')][_0x5143('0xa1')](',');var _0x4c966e={};_0x4c966e[_0x105993[0x0]]={'$gte':moment(_0x105993[0x1])[_0x5143('0x83')](_0x5143('0xa2'))};_0x41ac00['where']=_['merge'](_0x41ac00[_0x5143('0x9d')],_0x4c966e);}_0x41ac00=_[_0x5143('0x2e')]({},_0x41ac00,_0x3a27d8[_0x5143('0x45')]);return db[_0x5143('0x5b')][_0x5143('0x27')]({'where':_0x41ac00['where']})['then'](function(_0x12f5cf){_0x4e199f['count']=_0x12f5cf;if(_0x3a27d8[_0x5143('0x3a')][_0x5143('0x44')]){_0x41ac00['include']=[{'all':!![]}];}return db['ChatMessage'][_0x5143('0x39')](_0x41ac00);})[_0x5143('0x14')](function(_0x20fab7){_0x4e199f[_0x5143('0xa3')]=_0x20fab7;return _0x4e199f;});}})[_0x5143('0x14')](respondWithFilteredResult(_0xca70a8,_0x41ac00))[_0x5143('0x1f')](handleError(_0xca70a8,null));};exports['getMyMessages']=function(_0x30afae,_0x486291){var _0x287e8e={'where':{}},_0x4c4e26={},_0x4bfafb={'count':0x0,'rows':[]};return db[_0x5143('0x40')][_0x5143('0x49')]({'where':{'id':_0x30afae[_0x5143('0x3d')]['id']}})[_0x5143('0x14')](handleEntityNotFound(_0x486291,null))['then'](function(_0x48c0f0){if(_0x48c0f0){_0x4c4e26['model']=_[_0x5143('0x3f')](db[_0x5143('0x5b')]['rawAttributes']);_0x4c4e26[_0x5143('0x3a')]=_['keys'](_0x30afae[_0x5143('0x3a')]);_0x4c4e26[_0x5143('0x9a')]=_['intersection'](_0x4c4e26['model'],_0x4c4e26[_0x5143('0x3a')]);_0x287e8e[_0x5143('0x42')]=_['intersection'](_0x4c4e26[_0x5143('0x3e')],qs[_0x5143('0x43')](_0x30afae[_0x5143('0x3a')][_0x5143('0x43')]));_0x287e8e['attributes']=_0x287e8e[_0x5143('0x42')][_0x5143('0x7f')]?_0x287e8e[_0x5143('0x42')]:_0x4c4e26[_0x5143('0x3e')];if(!_0x30afae[_0x5143('0x3a')][_0x5143('0xa4')](_0x5143('0x9b'))){_0x287e8e[_0x5143('0x26')]=qs['limit'](_0x30afae[_0x5143('0x3a')][_0x5143('0x26')]);_0x287e8e[_0x5143('0x24')]=qs[_0x5143('0x24')](_0x30afae['query']['offset']);}_0x287e8e[_0x5143('0x9c')]=qs[_0x5143('0xa5')](_0x30afae['query'][_0x5143('0xa5')]);_0x287e8e['where']=qs[_0x5143('0x9a')](_[_0x5143('0xa6')](_0x30afae[_0x5143('0x3a')],_0x4c4e26[_0x5143('0x9a')]));_0x287e8e[_0x5143('0x9d')]['ChatInteractionId']=_0x48c0f0['id'];if(_0x30afae[_0x5143('0x3a')]['filter']){_0x287e8e[_0x5143('0x9d')]=_[_0x5143('0x2e')](_0x287e8e[_0x5143('0x9d')],{'$or':_[_0x5143('0x34')](_0x287e8e[_0x5143('0x42')],function(_0x434896){var _0x4b5112={};_0x4b5112[_0x434896]={'$like':'%'+_0x30afae['query'][_0x5143('0x9f')]+'%'};return _0x4b5112;})});}_0x287e8e[_0x5143('0x9d')]['secret']=![];if(_0x30afae[_0x5143('0x3a')]['id']){_0x287e8e[_0x5143('0x9d')]['id']={'$gt':_0x30afae[_0x5143('0x3a')]['id']};}_0x287e8e=_[_0x5143('0x2e')]({},_0x287e8e,_0x30afae[_0x5143('0x45')]);return db[_0x5143('0x5b')][_0x5143('0x27')]({'where':_0x287e8e['where']})['then'](function(_0x44deed){_0x4bfafb[_0x5143('0x27')]=_0x44deed;_0x287e8e[_0x5143('0xa7')]=[];if(_0x30afae[_0x5143('0x3a')][_0x5143('0xa8')]){_0x287e8e[_0x5143('0xa7')][_0x5143('0xa9')]({'model':db[_0x5143('0x7e')],'as':'User','attributes':['id',_0x5143('0x50'),_0x5143('0xaa')]});}if(_0x30afae['query'][_0x5143('0x44')]){_0x287e8e['include']=[{'all':!![]}];}return db[_0x5143('0x5b')][_0x5143('0x39')](_0x287e8e);})[_0x5143('0x14')](function(_0x105684){_0x4bfafb['rows']=_0x105684;return _0x4bfafb;});}})[_0x5143('0x14')](respondWithFilteredResult(_0x486291,_0x287e8e))[_0x5143('0x1f')](handleError(_0x486291,null));};exports['addTags']=function(_0x5f4877,_0x41c1e9){return db[_0x5143('0x40')]['find']({'where':{'id':_0x5f4877[_0x5143('0x3d')]['id']}})[_0x5143('0x14')](handleEntityNotFound(_0x41c1e9,null))[_0x5143('0x14')](function(_0xdd15f4){if(_0xdd15f4){return _0xdd15f4[_0x5143('0xab')](_0x5f4877[_0x5143('0x2f')][_0x5143('0x98')],_['omit'](_0x5f4877[_0x5143('0x2f')],['ids','id'])||{})['spread'](function(){return db[_0x5143('0xac')][_0x5143('0x39')]({'attributes':['id',_0x5143('0x2b'),_0x5143('0xad')],'where':{'id':_0x5f4877['body'][_0x5143('0x98')]}});})[_0x5143('0x14')](function(_0x509a3d){socket[_0x5143('0xae')](_0x5143('0xaf'),{'id':Number(_0x5f4877[_0x5143('0x3d')]['id']),'tags':_0x509a3d||[]});return{'id':Number(_0x5f4877[_0x5143('0x3d')]['id']),'tags':_0x509a3d||[]};});}})[_0x5143('0x14')](respondWithResult(_0x41c1e9,null))['catch'](handleError(_0x41c1e9,null));};exports[_0x5143('0xb0')]=function(_0x318545,_0x382f00){return db['ChatInteraction']['find']({'where':{'id':_0x318545[_0x5143('0x3d')]['id']}})['then'](handleEntityNotFound(_0x382f00,null))[_0x5143('0x14')](function(_0x4714be){if(_0x4714be){return _0x4714be[_0x5143('0xb0')](_0x318545['query']['ids']);}})['then'](respondWithStatusCode(_0x382f00,null))[_0x5143('0x1f')](handleError(_0x382f00,null));};exports[_0x5143('0x76')]=function(_0x4fc7f3,_0x1a3668){var _0x30733d=moment()[_0x5143('0xb1')]()[_0x5143('0xb2')]();var _0x232b4d=path[_0x5143('0x72')](config[_0x5143('0x73')],'server',_0x5143('0xb3'),'tmp');var _0x3e58af=path[_0x5143('0x72')](config[_0x5143('0x73')],'server','files',_0x5143('0xb4'));var _0x414f2d=path[_0x5143('0x72')](_0x232b4d,_0x30733d);var _0x24482c=util[_0x5143('0x83')](_0x5143('0xb5'),_0x4fc7f3['params']['id'],_0x30733d);var _0x5adee2=path['join'](_0x232b4d,_0x24482c);var _0x21ebcb=[];_0x21ebcb[_0x5143('0xa9')]({'model':db[_0x5143('0x7e')],'as':_0x5143('0x7e'),'attributes':['id',_0x5143('0x50')],'raw':!![]});_0x21ebcb[_0x5143('0xa9')]({'model':db[_0x5143('0x60')],'as':'Contact','attributes':['id',_0x5143('0xb6'),_0x5143('0xb7')],'raw':!![]});if(_0x4fc7f3[_0x5143('0x3a')]['attachments']){_0x21ebcb[_0x5143('0xa9')]({'model':db[_0x5143('0x6d')],'as':'Attachment','raw':!![]});}var _0x56317b=[{'model':db[_0x5143('0x5b')],'as':_0x5143('0x7d'),'attributes':['id','body',_0x5143('0x89'),_0x5143('0x8b'),_0x5143('0x8c'),_0x5143('0xb8')],'include':_0x21ebcb}];_0x56317b[_0x5143('0xa9')]({'model':db[_0x5143('0x4a')],'as':_0x5143('0xb9'),'attributes':['id',_0x5143('0x2b')]});_0x56317b[_0x5143('0xa9')]({'model':db[_0x5143('0x7e')],'as':_0x5143('0xba'),'attributes':['id',_0x5143('0x50')]});return db[_0x5143('0x40')][_0x5143('0x5f')]({'where':{'id':_0x4fc7f3[_0x5143('0x3d')]['id']},'include':_0x56317b})[_0x5143('0x14')](handleEntityNotFound(_0x1a3668,null))[_0x5143('0x14')](function(_0x230f5a){if(_0x230f5a){var _0x595725=_0x230f5a[_0x5143('0xbb')]({'plain':!![]});fs['mkdirSync'](_0x414f2d);var _0x299963={'channel':_0x5143('0xbc'),'account':_0x595725[_0x5143('0xb9')]['name'],'agent':_0x595725[_0x5143('0xba')]?_0x595725['Owner']['fullname']:'N.A.','createdAt':moment(_0x595725['createdAt'])[_0x5143('0x83')](_0x5143('0xa2'))[_0x5143('0xb2')](),'closedAt':_0x595725[_0x5143('0x6f')]?moment(_0x595725[_0x5143('0xbd')])[_0x5143('0x83')](_0x5143('0xa2'))[_0x5143('0xb2')]():'','disposition':_0x595725[_0x5143('0xbe')],'chatInfo':{'browser':_0x595725[_0x5143('0xbf')],'os':_0x595725[_0x5143('0xc0')],'referer':_0x595725[_0x5143('0xc1')],'customerIp':_0x595725[_0x5143('0xc2')],'customerPort':_0x595725[_0x5143('0xc3')]?_0x595725[_0x5143('0xc3')]:_0x5143('0xc4')},'messages':_(_0x595725[_0x5143('0x7d')])['tail']()[_0x5143('0x9f')]({'secret':![]})[_0x5143('0x34')](function(_0x3a6b82){if(_0x3a6b82[_0x5143('0x6d')]){var _0x4150ed=path[_0x5143('0x72')](_0x3e58af,_0x3a6b82['Attachment']['basename']);if(fs[_0x5143('0xc5')](_0x4150ed)){fs[_0x5143('0xc6')](_0x4150ed)[_0x5143('0xc7')](fs[_0x5143('0xc8')](path[_0x5143('0x72')](_0x414f2d,_0x3a6b82[_0x5143('0x6d')][_0x5143('0x6b')])));}}return{'date':moment(_0x3a6b82[_0x5143('0x89')])[_0x5143('0x83')](_0x5143('0xa2'))[_0x5143('0xb2')](),'sender':_0x3a6b82['direction']===_0x5143('0x5a')?_0x3a6b82[_0x5143('0x7e')]?_0x3a6b82[_0x5143('0x7e')]['fullname']:_0x5143('0x87'):_0x3a6b82[_0x5143('0x61')][_0x5143('0xb6')]+(_0x3a6b82[_0x5143('0x61')]['lastName']?'\x20'+_0x3a6b82[_0x5143('0x61')][_0x5143('0xb7')]:''),'body':_0x3a6b82[_0x5143('0x6d')]?_0x3a6b82[_0x5143('0x6d')][_0x5143('0x6b')]:_0x3a6b82[_0x5143('0x2f')],'direction':_0x3a6b82['direction']===_0x5143('0x5a')?'A':'C','secret':_0x3a6b82[_0x5143('0x8c')],'read':_0x3a6b82[_0x5143('0xb8')],'attachment':_0x3a6b82[_0x5143('0x6d')]};})[_0x5143('0xc9')]()};return ejs['renderFile'](path[_0x5143('0x72')](config['root'],_0x5143('0xca'),_0x5143('0xcb'),_0x5143('0xcc')),{'interaction':_0x299963})[_0x5143('0x14')](function(_0x2907fe){var _0x4af239=path[_0x5143('0x72')](_0x414f2d,_0x5143('0xcd')+_0x595725['id']+'-'+_0x30733d+_0x5143('0xce'));var _0x1f887c={'path':_0x4af239,'channel':_0x5143('0xbc'),'interactionId':_0x595725['id']};return pdf[_0x5143('0xcf')](_0x2907fe,_0x1f887c);})[_0x5143('0x14')](function(){return new Promise(function(_0x4143dd,_0x40492f){zipdir(_0x414f2d,{'saveTo':_0x5adee2},function(_0x452944,_0x1d6323){if(_0x452944)return _0x40492f(_0x452944);return _0x4143dd(_0x1d6323);});})[_0x5143('0x14')](function(){return new BPromise(function(_0x6da494,_0x353463){rimraf(_0x414f2d,function(_0x3dd557){if(_0x3dd557)_0x353463(_0x3dd557);return _0x6da494();});});})[_0x5143('0x14')](function(){return _0x1a3668[_0x5143('0x76')](_0x5adee2,_0x24482c,function(_0x1a3217){if(_0x1a3217){logger[_0x5143('0x19')]('err',_0x1a3217);}else{fs[_0x5143('0xd0')](_0x5adee2);}});});});}else{return _0x1a3668[_0x5143('0x20')](0xc8);}})[_0x5143('0x1f')](handleError(_0x1a3668,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index b71dbbd..fe019f1 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 _0x1d56=['ChatMessage','setMaxListeners','save','update','remove','then','setDataValue','map','findAll','length','emit','catch','hook','exports','events','../../mysqldb','ChatInteraction'];(function(_0x6030e4,_0xf34dd5){var _0x45175=function(_0x1161e4){while(--_0x1161e4){_0x6030e4['push'](_0x6030e4['shift']());}};_0x45175(++_0xf34dd5);}(_0x1d56,0xc9));var _0x61d5=function(_0x4769cf,_0x28fe2f){_0x4769cf=_0x4769cf-0x0;var _0x36ccd5=_0x1d56[_0x4769cf];return _0x36ccd5;};'use strict';var EventEmitter=require(_0x61d5('0x0'));var ChatInteraction=require(_0x61d5('0x1'))['db'][_0x61d5('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x61d5('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x61d5('0x4')](0x0);var events={'afterCreate':_0x61d5('0x5'),'afterUpdate':_0x61d5('0x6'),'afterDestroy':_0x61d5('0x7')};function emitEvent(_0x547948){return function(_0x64a13e,_0x423f4e,_0x806ebf){_0x64a13e['getUsers']({'attributes':['id'],'raw':!![]})[_0x61d5('0x8')](function(_0x356085){_0x64a13e[_0x61d5('0x9')]('Users',_0x356085[_0x61d5('0xa')](function(_0x786dd9){return{'id':_0x786dd9['id']};}));return ChatMessage[_0x61d5('0xb')]({'where':{'ChatInteractionId':_0x64a13e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x61d5('0x8')](function(_0x32dc97){_0x64a13e[_0x61d5('0x9')]('unreadMessages',_0x32dc97[_0x61d5('0xc')]);ChatInteractionEvents[_0x61d5('0xd')](_0x547948+':'+_0x64a13e['id'],_0x64a13e);ChatInteractionEvents[_0x61d5('0xd')](_0x547948,_0x64a13e);_0x806ebf(null);})[_0x61d5('0xe')](_0x806ebf(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x61d5('0xf')](e,emitEvent(event));}}module[_0x61d5('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xcc80=['then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','ChatMessage','setMaxListeners','save','setDataValue','Users','map','findAll'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xcc80,0x13a));var _0x0cc8=function(_0x1b8ba6,_0x351f1a){_0x1b8ba6=_0x1b8ba6-0x0;var _0x26244b=_0xcc80[_0x1b8ba6];return _0x26244b;};'use strict';var EventEmitter=require(_0x0cc8('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x0cc8('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x0cc8('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0cc8('0x3')](0x0);var events={'afterCreate':_0x0cc8('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1187cb){return function(_0x35d06d,_0xc2b595,_0x274c35){_0x35d06d['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3a3005){_0x35d06d[_0x0cc8('0x5')](_0x0cc8('0x6'),_0x3a3005[_0x0cc8('0x7')](function(_0x271046){return{'id':_0x271046['id']};}));return ChatMessage[_0x0cc8('0x8')]({'where':{'ChatInteractionId':_0x35d06d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0cc8('0x9')](function(_0x26f08d){_0x35d06d[_0x0cc8('0x5')](_0x0cc8('0xa'),_0x26f08d[_0x0cc8('0xb')]);ChatInteractionEvents[_0x0cc8('0xc')](_0x1187cb+':'+_0x35d06d['id'],_0x35d06d);ChatInteractionEvents[_0x0cc8('0xc')](_0x1187cb,_0x35d06d);_0x274c35(null);})[_0x0cc8('0xd')](_0x274c35(null));};}for(var e in events){if(events[_0x0cc8('0xe')](e)){var event=events[e];ChatInteraction[_0x0cc8('0xf')](e,emitEvent(event));}}module[_0x0cc8('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 1873f94..6ec9238 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 _0x40a3=['../../config/logger','api','bluebird','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x255140,_0x13124c){var _0x55032a=function(_0x38e7c4){while(--_0x38e7c4){_0x255140['push'](_0x255140['shift']());}};_0x55032a(++_0x13124c);}(_0x40a3,0x1c0));var _0x340a=function(_0x6ccf5b,_0x445dcd){_0x6ccf5b=_0x6ccf5b-0x0;var _0x8a57db=_0x40a3[_0x6ccf5b];return _0x8a57db;};'use strict';var _=require(_0x340a('0x0'));var util=require(_0x340a('0x1'));var logger=require(_0x340a('0x2'))(_0x340a('0x3'));var moment=require('moment');var BPromise=require(_0x340a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x340a('0x5'));var rimraf=require(_0x340a('0x6'));var config=require('../../config/environment');var attributes=require(_0x340a('0x7'));module[_0x340a('0x8')]=function(_0x2f593e,_0xd953a4){return _0x2f593e[_0x340a('0x9')](_0x340a('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a674b,_0x4524c9,_0x163450){if(_0x2a674b[_0x340a('0xb')](_0x340a('0xc'))){_0x2a674b[_0x340a('0xd')]=moment()[_0x340a('0xe')](_0x340a('0xf'));}_0x163450(null,_0x2a674b);}},'charset':_0x340a('0x10'),'collate':_0x340a('0x11')});}; \ No newline at end of file +var _0x43a4=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x23d8cb,_0x1c0ff5){var _0x1cf75e=function(_0x625ae2){while(--_0x625ae2){_0x23d8cb['push'](_0x23d8cb['shift']());}};_0x1cf75e(++_0x1c0ff5);}(_0x43a4,0x97));var _0x443a=function(_0x753daa,_0x5cb060){_0x753daa=_0x753daa-0x0;var _0x1df62f=_0x43a4[_0x753daa];return _0x1df62f;};'use strict';var _=require(_0x443a('0x0'));var util=require('util');var logger=require(_0x443a('0x1'))(_0x443a('0x2'));var moment=require(_0x443a('0x3'));var BPromise=require(_0x443a('0x4'));var rp=require(_0x443a('0x5'));var fs=require('fs');var path=require(_0x443a('0x6'));var rimraf=require('rimraf');var config=require(_0x443a('0x7'));var attributes=require(_0x443a('0x8'));module['exports']=function(_0x1849dd,_0x5d4674){return _0x1849dd[_0x443a('0x9')](_0x443a('0xa'),attributes,{'tableName':_0x443a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x160b9d,_0xfaa29e,_0xe05e35){if(_0x160b9d[_0x443a('0xc')](_0x443a('0xd'))){_0x160b9d[_0x443a('0xe')]=moment()[_0x443a('0xf')](_0x443a('0x10'));}_0xe05e35(null,_0x160b9d);}},'charset':_0x443a('0x11'),'collate':_0x443a('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 21217a8..b23b05b 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 _0xd367=['../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','spread','AddTags','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x364aa7,_0x246d24){var _0x2e3e05=function(_0x7b0836){while(--_0x7b0836){_0x364aa7['push'](_0x364aa7['shift']());}};_0x2e3e05(++_0x246d24);}(_0xd367,0xc8));var _0x7d36=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd367[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7d36('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d36('0x1'));var db=require(_0x7d36('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d36('0x3'))(_0x7d36('0x4'));var config=require(_0x7d36('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7d36('0x6')][_0x7d36('0x7')]({'port':0x232a});config['redis']=_[_0x7d36('0x8')](config[_0x7d36('0x9')],{'host':_0x7d36('0xa'),'port':0x18eb});var socket=require(_0x7d36('0xb'))(new Redis(config['redis']));require(_0x7d36('0xc'))[_0x7d36('0xd')](socket);function respondWithRpcPromise(_0x3a3c96,_0x335ce5,_0x78eb33){return new BPromise(function(_0x585af6,_0x1a36ee){return client[_0x7d36('0xe')](_0x3a3c96,_0x78eb33)[_0x7d36('0xf')](function(_0x4bbddb){logger['info'](_0x7d36('0x10'),_0x335ce5,_0x7d36('0x11'));logger[_0x7d36('0x12')](_0x7d36('0x13'),_0x335ce5,'request\x20sent',JSON[_0x7d36('0x14')](_0x4bbddb));if(_0x4bbddb[_0x7d36('0x15')]){if(_0x4bbddb[_0x7d36('0x15')][_0x7d36('0x16')]===0x1f4){logger[_0x7d36('0x15')](_0x7d36('0x10'),_0x335ce5,_0x4bbddb[_0x7d36('0x15')]['message']);return _0x1a36ee(_0x4bbddb['error'][_0x7d36('0x17')]);}logger[_0x7d36('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x335ce5,_0x4bbddb[_0x7d36('0x15')][_0x7d36('0x17')]);return _0x585af6(_0x4bbddb[_0x7d36('0x15')]['message']);}else{logger[_0x7d36('0x18')](_0x7d36('0x10'),_0x335ce5,_0x7d36('0x11'));_0x585af6(_0x4bbddb['result']['message']);}})[_0x7d36('0x19')](function(_0x3c07b4){logger[_0x7d36('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x335ce5,_0x3c07b4);_0x1a36ee(_0x3c07b4);});});}exports[_0x7d36('0x1a')]=function(_0x50df1f){var _0x2f89f4=this;return new Promise(function(_0x3b3088,_0x488793){return db[_0x7d36('0x1b')][_0x7d36('0x1c')](_0x50df1f[_0x7d36('0x1d')],{'raw':_0x50df1f[_0x7d36('0x1e')]?_0x50df1f[_0x7d36('0x1e')][_0x7d36('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50df1f['options']?_0x50df1f['options'][_0x7d36('0x20')]||null:null,'attributes':_0x50df1f[_0x7d36('0x1e')]?_0x50df1f[_0x7d36('0x1e')][_0x7d36('0x21')]||null:null,'limit':_0x50df1f[_0x7d36('0x1e')]?_0x50df1f['options'][_0x7d36('0x22')]||null:null})[_0x7d36('0xf')](function(_0x1994f9){logger['info']('UpdateChatInteraction',_0x50df1f);logger[_0x7d36('0x12')](_0x7d36('0x1a'),_0x50df1f,JSON['stringify'](_0x1994f9));_0x3b3088(_0x1994f9);})[_0x7d36('0x19')](function(_0x161e25){logger[_0x7d36('0x15')](_0x7d36('0x1a'),_0x161e25[_0x7d36('0x17')],_0x50df1f);_0x488793(_0x2f89f4[_0x7d36('0x15')](0x1f4,_0x161e25[_0x7d36('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x49ff8d){return new Promise(function(_0x5b9be8,_0x546de9){return db[_0x7d36('0x1b')][_0x7d36('0x23')]({'where':_0x49ff8d[_0x7d36('0x1e')]?_0x49ff8d['options'][_0x7d36('0x20')]||null:null})[_0x7d36('0xf')](function(_0x5dbf23){if(_0x5dbf23){return _0x5dbf23[_0x7d36('0x24')](_0x49ff8d[_0x7d36('0x1d')][_0x7d36('0x25')],_[_0x7d36('0x26')](_0x49ff8d[_0x7d36('0x1d')],[_0x7d36('0x25'),'id'])||{});}})[_0x7d36('0x27')](function(_0x50fe2d){logger[_0x7d36('0x18')](_0x7d36('0x28'),_0x49ff8d);logger[_0x7d36('0x12')](_0x7d36('0x28'),_0x49ff8d,JSON[_0x7d36('0x14')](_0x50fe2d));_0x5b9be8(_0x50fe2d);})['catch'](function(_0x418cb7){logger[_0x7d36('0x15')](_0x7d36('0x28'),_0x418cb7['message'],_0x49ff8d);_0x546de9(_this[_0x7d36('0x15')](0x1f4,_0x418cb7[_0x7d36('0x17')]));});});}; \ No newline at end of file +var _0x5a97=['client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','ChatInteraction','find','ids','omit','AddTags','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4c99d0,_0x1febe1){var _0x5e541f=function(_0x6a83e5){while(--_0x6a83e5){_0x4c99d0['push'](_0x4c99d0['shift']());}};_0x5e541f(++_0x1febe1);}(_0x5a97,0x9f));var _0x75a9=function(_0x595099,_0x5bd5bb){_0x595099=_0x595099-0x0;var _0x28f5ed=_0x5a97[_0x595099];return _0x28f5ed;};'use strict';var _=require(_0x75a9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x75a9('0x1'));var rs=require(_0x75a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75a9('0x3'))['db'];var utils=require(_0x75a9('0x4'));var logger=require(_0x75a9('0x5'))(_0x75a9('0x6'));var config=require(_0x75a9('0x7'));var jayson=require(_0x75a9('0x8'));var client=jayson[_0x75a9('0x9')][_0x75a9('0xa')]({'port':0x232a});config['redis']=_[_0x75a9('0xb')](config[_0x75a9('0xc')],{'host':_0x75a9('0xd'),'port':0x18eb});var socket=require(_0x75a9('0xe'))(new Redis(config['redis']));require(_0x75a9('0xf'))[_0x75a9('0x10')](socket);function respondWithRpcPromise(_0x21812b,_0x4eb6ae,_0x4f0b84){return new BPromise(function(_0x1f43e5,_0x5529ee){return client['request'](_0x21812b,_0x4f0b84)[_0x75a9('0x11')](function(_0x305a98){logger[_0x75a9('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x4eb6ae,_0x75a9('0x13'));logger[_0x75a9('0x14')](_0x75a9('0x15'),_0x4eb6ae,_0x75a9('0x13'),JSON[_0x75a9('0x16')](_0x305a98));if(_0x305a98[_0x75a9('0x17')]){if(_0x305a98[_0x75a9('0x17')][_0x75a9('0x18')]===0x1f4){logger['error'](_0x75a9('0x19'),_0x4eb6ae,_0x305a98[_0x75a9('0x17')][_0x75a9('0x1a')]);return _0x5529ee(_0x305a98[_0x75a9('0x17')][_0x75a9('0x1a')]);}logger[_0x75a9('0x17')](_0x75a9('0x19'),_0x4eb6ae,_0x305a98[_0x75a9('0x17')][_0x75a9('0x1a')]);return _0x1f43e5(_0x305a98['error'][_0x75a9('0x1a')]);}else{logger[_0x75a9('0x12')](_0x75a9('0x19'),_0x4eb6ae,_0x75a9('0x13'));_0x1f43e5(_0x305a98[_0x75a9('0x1b')][_0x75a9('0x1a')]);}})[_0x75a9('0x1c')](function(_0xa463b1){logger[_0x75a9('0x17')](_0x75a9('0x19'),_0x4eb6ae,_0xa463b1);_0x5529ee(_0xa463b1);});});}exports['UpdateChatInteraction']=function(_0xcbcc58){var _0x51269b=this;return new Promise(function(_0x476dce,_0x16e97d){return db['ChatInteraction'][_0x75a9('0x1d')](_0xcbcc58[_0x75a9('0x1e')],{'raw':_0xcbcc58[_0x75a9('0x1f')]?_0xcbcc58['options'][_0x75a9('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcbcc58[_0x75a9('0x1f')]?_0xcbcc58[_0x75a9('0x1f')][_0x75a9('0x21')]||null:null,'attributes':_0xcbcc58[_0x75a9('0x1f')]?_0xcbcc58['options'][_0x75a9('0x22')]||null:null,'limit':_0xcbcc58['options']?_0xcbcc58[_0x75a9('0x1f')][_0x75a9('0x23')]||null:null})[_0x75a9('0x11')](function(_0x1b25e3){logger[_0x75a9('0x12')](_0x75a9('0x24'),_0xcbcc58);logger[_0x75a9('0x14')](_0x75a9('0x24'),_0xcbcc58,JSON[_0x75a9('0x16')](_0x1b25e3));_0x476dce(_0x1b25e3);})[_0x75a9('0x1c')](function(_0x4009da){logger[_0x75a9('0x17')](_0x75a9('0x24'),_0x4009da[_0x75a9('0x1a')],_0xcbcc58);_0x16e97d(_0x51269b[_0x75a9('0x17')](0x1f4,_0x4009da[_0x75a9('0x1a')]));});});};exports['AddTagsToChatInteraction']=function(_0xbc7291){return new Promise(function(_0x2783e0,_0x23332a){return db[_0x75a9('0x25')][_0x75a9('0x26')]({'where':_0xbc7291[_0x75a9('0x1f')]?_0xbc7291[_0x75a9('0x1f')][_0x75a9('0x21')]||null:null})[_0x75a9('0x11')](function(_0x5811ef){if(_0x5811ef){return _0x5811ef['addTags'](_0xbc7291['body'][_0x75a9('0x27')],_[_0x75a9('0x28')](_0xbc7291[_0x75a9('0x1e')],[_0x75a9('0x27'),'id'])||{});}})['spread'](function(_0x29f065){logger['info'](_0x75a9('0x29'),_0xbc7291);logger['debug']('AddTags',_0xbc7291,JSON[_0x75a9('0x16')](_0x29f065));_0x2783e0(_0x29f065);})['catch'](function(_0x41849e){logger[_0x75a9('0x17')](_0x75a9('0x29'),_0x41849e[_0x75a9('0x1a')],_0xbc7291);_0x23332a(_this[_0x75a9('0x17')](0x1f4,_0x41849e[_0x75a9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a723fed..08331c2 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 _0x5d01=['update','removeListener','register','length','chatInteraction:','./chatInteraction.events','remove'];(function(_0x4314d7,_0x355218){var _0x5c599b=function(_0x556354){while(--_0x556354){_0x4314d7['push'](_0x4314d7['shift']());}};_0x5c599b(++_0x355218);}(_0x5d01,0xe5));var _0x15d0=function(_0xa20571,_0x49a4b9){_0xa20571=_0xa20571-0x0;var _0x16beae=_0x5d01[_0xa20571];return _0x16beae;};'use strict';var ChatInteractionEvents=require(_0x15d0('0x0'));var events=['save',_0x15d0('0x1'),_0x15d0('0x2')];function createListener(_0x580bc6,_0xe135d0){return function(_0x665632){_0xe135d0['emit'](_0x580bc6,_0x665632);};}function removeListener(_0x53abcf,_0x1a067d){return function(){ChatInteractionEvents[_0x15d0('0x3')](_0x53abcf,_0x1a067d);};}exports[_0x15d0('0x4')]=function(_0x1b0e27){for(var _0x2af55d=0x0,_0x38d2f4=events[_0x15d0('0x5')];_0x2af55d<_0x38d2f4;_0x2af55d++){var _0x336c8c=events[_0x2af55d];var _0x4e5c50=createListener(_0x15d0('0x6')+_0x336c8c,_0x1b0e27);ChatInteractionEvents['on'](_0x336c8c,_0x4e5c50);}}; \ No newline at end of file +var _0xf5b7=['length','chatInteraction:','save','remove','update','removeListener','register'];(function(_0x35825e,_0x657421){var _0x4f4d90=function(_0x160265){while(--_0x160265){_0x35825e['push'](_0x35825e['shift']());}};_0x4f4d90(++_0x657421);}(_0xf5b7,0xf7));var _0x7f5b=function(_0x141868,_0x29825e){_0x141868=_0x141868-0x0;var _0x3f5673=_0xf5b7[_0x141868];return _0x3f5673;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x7f5b('0x0'),_0x7f5b('0x1'),_0x7f5b('0x2')];function createListener(_0x2d625b,_0x176f09){return function(_0x2d9117){_0x176f09['emit'](_0x2d625b,_0x2d9117);};}function removeListener(_0x30569b,_0x566b54){return function(){ChatInteractionEvents[_0x7f5b('0x3')](_0x30569b,_0x566b54);};}exports[_0x7f5b('0x4')]=function(_0x481e5b){for(var _0x295885=0x0,_0x1fcd6b=events[_0x7f5b('0x5')];_0x295885<_0x1fcd6b;_0x295885++){var _0x16ac54=events[_0x295885];var _0x1d1844=createListener(_0x7f5b('0x6')+_0x16ac54,_0x481e5b);ChatInteractionEvents['on'](_0x16ac54,_0x1d1844);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 82c42eb..12517d9 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 _0x118a=['delete','/:id','chatinteraction:destroy','destroy','removeTags','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','abandon'];(function(_0x2b36f5,_0x5732dc){var _0x5f06b6=function(_0x5def4f){while(--_0x5def4f){_0x2b36f5['push'](_0x2b36f5['shift']());}};_0x5f06b6(++_0x5732dc);}(_0x118a,0x144));var _0xa118=function(_0x1c2d79,_0x53ca9b){_0x1c2d79=_0x1c2d79-0x0;var _0x1c4ff1=_0x118a[_0x1c2d79];return _0x1c4ff1;};'use strict';var multer=require(_0xa118('0x0'));var util=require(_0xa118('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa118('0x2'));var router=express[_0xa118('0x3')]();var fs_extra=require(_0xa118('0x4'));var auth=require(_0xa118('0x5'));var interaction=require(_0xa118('0x6'));var config=require('../../config/environment');var controller=require(_0xa118('0x7'));router[_0xa118('0x8')]('/',auth[_0xa118('0x9')](),controller[_0xa118('0xa')]);router[_0xa118('0x8')](_0xa118('0xb'),auth['isAuthenticated'](),controller[_0xa118('0xc')]);router[_0xa118('0x8')]('/:id',auth[_0xa118('0xd')](),controller[_0xa118('0xe')]);router[_0xa118('0x8')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0xa118('0xf')]);router[_0xa118('0x8')](_0xa118('0x10'),auth[_0xa118('0x9')](),controller['getMessages']);router['get']('/:id/my_messages',auth[_0xa118('0xd')](),controller[_0xa118('0x11')]);router[_0xa118('0x8')](_0xa118('0x12'),auth['isAuthenticated'](),controller[_0xa118('0x13')]);router[_0xa118('0x14')]('/',auth[_0xa118('0x9')](),controller[_0xa118('0x15')]);router['post'](_0xa118('0x16'),auth[_0xa118('0x9')](),controller[_0xa118('0x17')]);var upload=multer({'storage':multer[_0xa118('0x18')]({'destination':function(_0x3bf90d,_0xf81ea,_0x28bafd){_0x28bafd(null,path[_0xa118('0x19')](config[_0xa118('0x1a')],_0xa118('0x1b')));},'filename':function(_0x4aa09e,_0x543a02,_0x179fdd){_0x179fdd(null,util[_0xa118('0x1c')](_0xa118('0x1d'),Date[_0xa118('0x1e')](),_0x543a02['originalname'][_0xa118('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa118('0x14')](_0xa118('0x20'),upload[_0xa118('0x21')](_0xa118('0x22')),controller[_0xa118('0x23')]);router[_0xa118('0x14')](_0xa118('0x10'),auth[_0xa118('0xd')](),controller[_0xa118('0x24')]);router[_0xa118('0x14')](_0xa118('0x25'),auth[_0xa118('0x9')](),interaction['tracked'](_0xa118('0x26'),_0xa118('0x27')),controller[_0xa118('0x28')]);router[_0xa118('0x29')]('/:id',auth[_0xa118('0x9')](),interaction[_0xa118('0x2a')](_0xa118('0x26'),_0xa118('0x2b')),controller[_0xa118('0x2c')]);router[_0xa118('0x29')](_0xa118('0x2d'),controller['customUpdate']);router['put']('/:id/abandon',auth[_0xa118('0xd')](),controller[_0xa118('0x2e')]);router[_0xa118('0x29')]('/:id/close',controller['close']);router[_0xa118('0x2f')](_0xa118('0x30'),auth[_0xa118('0x9')](),interaction[_0xa118('0x2a')](_0xa118('0x26'),_0xa118('0x31')),controller[_0xa118('0x32')]);router[_0xa118('0x2f')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa118('0x33')]);module[_0xa118('0x34')]=router; \ No newline at end of file +var _0x599c=['removeTags','path','connect-timeout','Router','fs-extra','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','delete','chatinteraction:destroy','destroy','/:id/tags'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x599c,0x97));var _0xc599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x599c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc599('0x0'));var timeout=require(_0xc599('0x1'));var express=require('express');var router=express[_0xc599('0x2')]();var fs_extra=require(_0xc599('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc599('0x4'));router[_0xc599('0x5')]('/',auth[_0xc599('0x6')](),controller['index']);router[_0xc599('0x5')](_0xc599('0x7'),auth[_0xc599('0x6')](),controller[_0xc599('0x8')]);router[_0xc599('0x5')](_0xc599('0x9'),auth[_0xc599('0xa')](),controller[_0xc599('0xb')]);router[_0xc599('0x5')](_0xc599('0xc'),auth[_0xc599('0xa')](),controller[_0xc599('0xd')]);router[_0xc599('0x5')](_0xc599('0xe'),auth[_0xc599('0x6')](),controller[_0xc599('0xf')]);router[_0xc599('0x5')](_0xc599('0x10'),auth[_0xc599('0xa')](),controller[_0xc599('0x11')]);router['get'](_0xc599('0x12'),auth[_0xc599('0x6')](),controller[_0xc599('0x13')]);router[_0xc599('0x14')]('/',auth['isAuthenticated'](),controller[_0xc599('0x15')]);router[_0xc599('0x14')](_0xc599('0x16'),auth['isAuthenticated'](),controller[_0xc599('0x17')]);var upload=multer({'storage':multer[_0xc599('0x18')]({'destination':function(_0x34d765,_0x32c8cf,_0x1ff840){_0x1ff840(null,path[_0xc599('0x19')](config[_0xc599('0x1a')],'server/files/attachments/'));},'filename':function(_0x48f66e,_0x32a52c,_0x50f04d){_0x50f04d(null,util[_0xc599('0x1b')](_0xc599('0x1c'),Date[_0xc599('0x1d')](),_0x32a52c[_0xc599('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xc599('0x1f'),upload[_0xc599('0x20')](_0xc599('0x21')),controller['attachmentUpload']);router[_0xc599('0x14')]('/:id/messages',auth[_0xc599('0xa')](),controller[_0xc599('0x22')]);router[_0xc599('0x14')]('/:id/tags',auth[_0xc599('0x6')](),interaction[_0xc599('0x23')](_0xc599('0x24'),_0xc599('0x25')),controller[_0xc599('0x26')]);router[_0xc599('0x27')](_0xc599('0x9'),auth['isAuthenticated'](),interaction[_0xc599('0x23')](_0xc599('0x24'),_0xc599('0x28')),controller['update']);router['put'](_0xc599('0x29'),controller[_0xc599('0x2a')]);router['put'](_0xc599('0x2b'),auth[_0xc599('0xa')](),controller[_0xc599('0x2c')]);router['put']('/:id/close',controller['close']);router[_0xc599('0x2d')]('/:id',auth[_0xc599('0x6')](),interaction['tracked'](_0xc599('0x24'),_0xc599('0x2e')),controller[_0xc599('0x2f')]);router['delete'](_0xc599('0x30'),auth[_0xc599('0x6')](),controller[_0xc599('0x31')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 9bf74b7..1aa9f80 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 _0x68a5=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x3bb707,_0x20308c){var _0x4c8d94=function(_0x48fd5f){while(--_0x48fd5f){_0x3bb707['push'](_0x3bb707['shift']());}};_0x4c8d94(++_0x20308c);}(_0x68a5,0xba));var _0x568a=function(_0x4935ac,_0x2fec9b){_0x4935ac=_0x4935ac-0x0;var _0x10392d=_0x68a5[_0x4935ac];return _0x10392d;};'use strict';var Sequelize=require(_0x568a('0x0'));module[_0x568a('0x1')]={'body':{'type':Sequelize[_0x568a('0x2')](_0x568a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x568a('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x568a('0x5')]}}; \ No newline at end of file +var _0x85c5=['exports','TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x38819a,_0x4ee565){var _0x2ed8f2=function(_0x4a39be){while(--_0x4a39be){_0x38819a['push'](_0x38819a['shift']());}};_0x2ed8f2(++_0x4ee565);}(_0x85c5,0xfb));var _0x585c=function(_0x5af757,_0xd7ca80){_0x5af757=_0x5af757-0x0;var _0x5ae737=_0x85c5[_0x5af757];return _0x5ae737;};'use strict';var Sequelize=require(_0x585c('0x0'));module[_0x585c('0x1')]={'body':{'type':Sequelize[_0x585c('0x2')](_0x585c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x585c('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x585c('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 4c67dd0..28b1db8 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 _0x6a8e=['FromId','ToId','read','-createdAt','all','eml-format','fast-json-patch','request-promise','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','describe','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','findAll','agent','admin','user','role','userpic','lastLoginAt','allowmessenger','sort','-online','VoiceQueue','get','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push'];(function(_0x45fb76,_0x35fd5d){var _0x338556=function(_0x526a58){while(--_0x526a58){_0x45fb76['push'](_0x45fb76['shift']());}};_0x338556(++_0x35fd5d);}(_0x6a8e,0x1a1));var _0xe6a8=function(_0x5cfbd1,_0x2a5877){_0x5cfbd1=_0x5cfbd1-0x0;var _0x206ad5=_0x6a8e[_0x5cfbd1];return _0x206ad5;};'use strict';var emlformat=require(_0xe6a8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe6a8('0x1'));var rp=require(_0xe6a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe6a8('0x3'));var sox=require(_0xe6a8('0x4'));var csv=require(_0xe6a8('0x5'));var ejs=require(_0xe6a8('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe6a8('0x7'));var squel=require(_0xe6a8('0x8'));var crypto=require(_0xe6a8('0x9'));var jsforce=require(_0xe6a8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe6a8('0x5'));var querystring=require(_0xe6a8('0xb'));var Papa=require(_0xe6a8('0xc'));var Redis=require('ioredis');var authService=require(_0xe6a8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe6a8('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6a8('0xf'))('api');var utils=require(_0xe6a8('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xe6a8('0x11'));var db=require(_0xe6a8('0x12'))['db'];config[_0xe6a8('0x13')]=_['defaults'](config[_0xe6a8('0x13')],{'host':_0xe6a8('0x14'),'port':0x18eb});var socket=require(_0xe6a8('0x15'))(new Redis(config[_0xe6a8('0x13')]));require(_0xe6a8('0x16'))[_0xe6a8('0x17')](socket);function respondWithStatusCode(_0x4c2fe7,_0x30afa6){_0x30afa6=_0x30afa6||0xcc;return function(_0x157eaf){if(_0x157eaf){return _0x4c2fe7[_0xe6a8('0x18')](_0x30afa6);}return _0x4c2fe7[_0xe6a8('0x19')](_0x30afa6)[_0xe6a8('0x1a')]();};}function respondWithResult(_0x4ab06d,_0x39030a){_0x39030a=_0x39030a||0xc8;return function(_0x45f7d4){if(_0x45f7d4){return _0x4ab06d[_0xe6a8('0x19')](_0x39030a)['json'](_0x45f7d4);}};}function respondWithFilteredResult(_0x4a2030,_0x17e0ff){return function(_0x443c26){if(_0x443c26){var _0x406f42=typeof _0x17e0ff[_0xe6a8('0x1b')]==='undefined'&&typeof _0x17e0ff[_0xe6a8('0x1c')]===_0xe6a8('0x1d');var _0x367e59=_0x443c26['count'];var _0x4ccd0e=_0x406f42?0x0:_0x17e0ff[_0xe6a8('0x1b')];var _0x79d474=_0x406f42?_0x443c26[_0xe6a8('0x1e')]:_0x17e0ff[_0xe6a8('0x1b')]+_0x17e0ff[_0xe6a8('0x1c')];var _0x512d0f;if(_0x79d474>=_0x367e59){_0x79d474=_0x367e59;_0x512d0f=0xc8;}else{_0x512d0f=0xce;}_0x4a2030[_0xe6a8('0x19')](_0x512d0f);return _0x4a2030[_0xe6a8('0x1f')](_0xe6a8('0x20'),_0x4ccd0e+'-'+_0x79d474+'/'+_0x367e59)[_0xe6a8('0x21')](_0x443c26);}return null;};}function patchUpdates(_0x147b9e){return function(_0xe37f85){try{jsonpatch[_0xe6a8('0x22')](_0xe37f85,_0x147b9e,!![]);}catch(_0x590c55){return BPromise['reject'](_0x590c55);}return _0xe37f85[_0xe6a8('0x23')]();};}function saveUpdates(_0x4b9c51,_0x98a96){return function(_0x37276d){if(_0x37276d){return _0x37276d[_0xe6a8('0x24')](_0x4b9c51)[_0xe6a8('0x25')](function(_0x5d1470){return _0x5d1470;});}return null;};}function removeEntity(_0x1fac20,_0x4d40df){return function(_0x43f83c){if(_0x43f83c){return _0x43f83c[_0xe6a8('0x26')]()['then'](function(){_0x1fac20[_0xe6a8('0x19')](0xcc)[_0xe6a8('0x1a')]();});}};}function handleEntityNotFound(_0x418e60,_0xe05dbe){return function(_0x51ef2f){if(!_0x51ef2f){_0x418e60[_0xe6a8('0x18')](0x194);}return _0x51ef2f;};}function handleError(_0x48c136,_0x9e0125){_0x9e0125=_0x9e0125||0x1f4;return function(_0x3e3943){logger[_0xe6a8('0x27')](_0x3e3943['stack']);if(_0x3e3943[_0xe6a8('0x28')]){delete _0x3e3943['name'];}_0x48c136[_0xe6a8('0x19')](_0x9e0125)[_0xe6a8('0x29')](_0x3e3943);};}exports['index']=function(_0x322033,_0x2ce04f){var _0x3fef68={},_0x52e895={},_0x50833e={'count':0x0,'rows':[]};var _0x45bbc6=_[_0xe6a8('0x2a')](db[_0xe6a8('0x2b')][_0xe6a8('0x2c')],function(_0x862237){return{'name':_0x862237[_0xe6a8('0x2d')],'type':_0x862237[_0xe6a8('0x2e')][_0xe6a8('0x2f')]};});_0x52e895['model']=_[_0xe6a8('0x2a')](_0x45bbc6,_0xe6a8('0x28'));_0x52e895[_0xe6a8('0x30')]=_[_0xe6a8('0x31')](_0x322033[_0xe6a8('0x30')]);_0x52e895[_0xe6a8('0x32')]=_[_0xe6a8('0x33')](_0x52e895[_0xe6a8('0x34')],_0x52e895[_0xe6a8('0x30')]);_0x3fef68['attributes']=_['intersection'](_0x52e895[_0xe6a8('0x34')],qs[_0xe6a8('0x35')](_0x322033[_0xe6a8('0x30')]['fields']));_0x3fef68[_0xe6a8('0x36')]=_0x3fef68[_0xe6a8('0x36')]['length']?_0x3fef68[_0xe6a8('0x36')]:_0x52e895[_0xe6a8('0x34')];if(!_0x322033[_0xe6a8('0x30')][_0xe6a8('0x37')]('nolimit')){_0x3fef68['limit']=qs[_0xe6a8('0x1c')](_0x322033[_0xe6a8('0x30')][_0xe6a8('0x1c')]);_0x3fef68[_0xe6a8('0x1b')]=qs['offset'](_0x322033[_0xe6a8('0x30')][_0xe6a8('0x1b')]);}_0x3fef68[_0xe6a8('0x38')]=qs['sort'](_0x322033[_0xe6a8('0x30')]['sort']);_0x3fef68['where']=qs['filters'](_['pick'](_0x322033[_0xe6a8('0x30')],_0x52e895['filters']),_0x45bbc6);if(_0x322033['query'][_0xe6a8('0x39')]){_0x3fef68[_0xe6a8('0x3a')]=_[_0xe6a8('0x3b')](_0x3fef68[_0xe6a8('0x3a')],{'$or':_[_0xe6a8('0x2a')](_0x45bbc6,function(_0x237beb){if(_0x237beb[_0xe6a8('0x2e')]!==_0xe6a8('0x3c')){var _0x54e6ac={};_0x54e6ac[_0x237beb[_0xe6a8('0x28')]]={'$like':'%'+_0x322033['query'][_0xe6a8('0x39')]+'%'};return _0x54e6ac;}})});}_0x3fef68=_[_0xe6a8('0x3b')]({},_0x3fef68,_0x322033[_0xe6a8('0x3d')]);var _0x428ec5={'where':_0x3fef68[_0xe6a8('0x3a')]};return db['ChatInternalMessage'][_0xe6a8('0x1e')](_0x428ec5)['then'](function(_0x33cfbb){_0x50833e[_0xe6a8('0x1e')]=_0x33cfbb;if(_0x322033['query']['includeAll']){_0x3fef68[_0xe6a8('0x3e')]=[{'all':!![]}];}return db[_0xe6a8('0x2b')]['findAll'](_0x3fef68);})[_0xe6a8('0x25')](function(_0x3785b0){_0x50833e[_0xe6a8('0x3f')]=_0x3785b0;return _0x50833e;})[_0xe6a8('0x25')](respondWithFilteredResult(_0x2ce04f,_0x3fef68))[_0xe6a8('0x40')](handleError(_0x2ce04f,null));};exports[_0xe6a8('0x41')]=function(_0x20c49f,_0x464eef){var _0x33c850={'raw':!![],'where':{'id':_0x20c49f[_0xe6a8('0x42')]['id']}},_0x4ec7d2={};_0x4ec7d2[_0xe6a8('0x34')]=_[_0xe6a8('0x31')](db[_0xe6a8('0x2b')][_0xe6a8('0x2c')]);_0x4ec7d2['query']=_[_0xe6a8('0x31')](_0x20c49f['query']);_0x4ec7d2['filters']=_['intersection'](_0x4ec7d2['model'],_0x4ec7d2[_0xe6a8('0x30')]);_0x33c850[_0xe6a8('0x36')]=_['intersection'](_0x4ec7d2[_0xe6a8('0x34')],qs[_0xe6a8('0x35')](_0x20c49f[_0xe6a8('0x30')][_0xe6a8('0x35')]));_0x33c850[_0xe6a8('0x36')]=_0x33c850[_0xe6a8('0x36')][_0xe6a8('0x43')]?_0x33c850[_0xe6a8('0x36')]:_0x4ec7d2['model'];if(_0x20c49f[_0xe6a8('0x30')][_0xe6a8('0x44')]){_0x33c850[_0xe6a8('0x3e')]=[{'all':!![]}];}_0x33c850=_[_0xe6a8('0x3b')]({},_0x33c850,_0x20c49f['options']);return db[_0xe6a8('0x2b')][_0xe6a8('0x45')](_0x33c850)['then'](handleEntityNotFound(_0x464eef,null))[_0xe6a8('0x25')](respondWithResult(_0x464eef,null))['catch'](handleError(_0x464eef,null));};exports[_0xe6a8('0x46')]=function(_0x48e1e3,_0x1a20fc){return db['ChatInternalMessage'][_0xe6a8('0x46')](_0x48e1e3['body'],{})[_0xe6a8('0x25')](respondWithResult(_0x1a20fc,0xc9))['catch'](handleError(_0x1a20fc,null));};exports[_0xe6a8('0x24')]=function(_0x4ae598,_0x4cf777){if(_0x4ae598[_0xe6a8('0x47')]['id']){delete _0x4ae598[_0xe6a8('0x47')]['id'];}return db[_0xe6a8('0x2b')][_0xe6a8('0x45')]({'where':{'id':_0x4ae598['params']['id']}})[_0xe6a8('0x25')](handleEntityNotFound(_0x4cf777,null))[_0xe6a8('0x25')](saveUpdates(_0x4ae598['body'],null))[_0xe6a8('0x25')](respondWithResult(_0x4cf777,null))[_0xe6a8('0x40')](handleError(_0x4cf777,null));};exports[_0xe6a8('0x26')]=function(_0x3597ce,_0x2449c6){return db[_0xe6a8('0x2b')][_0xe6a8('0x45')]({'where':{'id':_0x3597ce[_0xe6a8('0x42')]['id']}})[_0xe6a8('0x25')](handleEntityNotFound(_0x2449c6,null))[_0xe6a8('0x25')](removeEntity(_0x2449c6,null))[_0xe6a8('0x40')](handleError(_0x2449c6,null));};exports[_0xe6a8('0x48')]=function(_0x1d1497,_0x4d2fa5){return db['ChatInternalMessage']['describe']()[_0xe6a8('0x25')](respondWithResult(_0x4d2fa5,null))['catch'](handleError(_0x4d2fa5,null));};function wrapUser(_0x1351e4){return function(_0x4e629c){var _0x25bff7=_0x1351e4['get']({'plain':!![]});_0x25bff7[_0xe6a8('0x49')]=[];if(_0x4e629c){_0x25bff7[_0xe6a8('0x4a')]=_0x4e629c[_0xe6a8('0x4b')];_0x25bff7['lastMessage']=_0x4e629c;}else{_0x25bff7[_0xe6a8('0x4a')]=moment(0x0)[_0xe6a8('0x4c')](_0xe6a8('0x4d'));_0x25bff7['lastMessage']={};}return _0x25bff7;};}exports['getUsers']=function(_0xf03584,_0x44b7d5,_0x2dd299){var _0xb0e361=[];return db['User'][_0xe6a8('0x4e')]({'where':{'role':[_0xe6a8('0x4f'),_0xe6a8('0x50'),_0xe6a8('0x51')]},'attributes':['id','fullname',_0xe6a8('0x28'),_0xe6a8('0x52'),_0xe6a8('0x53'),'internal','online',_0xe6a8('0x54'),_0xe6a8('0x55'),'showWebBar'],'order':qs[_0xe6a8('0x56')](_0xe6a8('0x57')),'include':[{'model':db[_0xe6a8('0x58')],'as':'VoiceQueues','attributes':['id',_0xe6a8('0x28'),_0xe6a8('0x2e')],'through':{'attributes':[]}}]})[_0xe6a8('0x25')](function(_0x3dc650){if(_0x3dc650){var _0x353dae=_0xf03584[_0xe6a8('0x51')][_0xe6a8('0x59')]({'plain':!![]});if(!_0x353dae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x353dae[_0xe6a8('0x52')]===_0xe6a8('0x51')){return db[_0xe6a8('0x5a')]['find']({'where':{'name':_0xe6a8('0x5b'),'userProfileId':_0x353dae[_0xe6a8('0x5c')]},'raw':!![]})['then'](function(_0x1e9928){if(_0x1e9928){if(_0x1e9928[_0xe6a8('0x5d')]===0x0){return db[_0xe6a8('0x5e')][_0xe6a8('0x4e')]({'where':{'sectionId':_0x1e9928['id']},'raw':!![]})['then'](function(_0x5e927a){var _0x4462e6=[];if(_[_0xe6a8('0x5f')](_0x5e927a)){_0x4462e6=_['filter'](_0x3dc650,function(_0x36596f){if(_0x36596f[_0xe6a8('0x52')]!==_0xe6a8('0x4f')){return _0x36596f;}});return _0x4462e6;}else{for(var _0x55ad07=0x0;_0x55ad07<_0x3dc650[_0xe6a8('0x43')];_0x55ad07++){var _0x175d22=_0x3dc650[_0x55ad07];if(_0x175d22[_0xe6a8('0x52')]===_0xe6a8('0x4f')){var _0x33a9a0=_[_0xe6a8('0x45')](_0x5e927a,function(_0x53eada){return _0x53eada[_0xe6a8('0x60')]===_0x175d22['id'];});if(_0x33a9a0)_0x4462e6[_0xe6a8('0x61')](_0x175d22);}else{_0x4462e6[_0xe6a8('0x61')](_0x175d22);}}return _0x4462e6;}});}else{return _0x3dc650;}}else{var _0x1461e2=_['filter'](_0x3dc650,function(_0x5610bb){if(_0x5610bb[_0xe6a8('0x52')]!==_0xe6a8('0x4f')){return _0x5610bb;}});return _0x1461e2;}});}else{return _0x3dc650;}}})[_0xe6a8('0x25')](function(_0x4bb3c7){var _0x27d4db=[];if(_0x4bb3c7){_0xb0e361=_0x4bb3c7;for(var _0x54c3e7=0x0;_0x54c3e7<_0x4bb3c7[_0xe6a8('0x43')];_0x54c3e7+=0x1){_0xb0e361[_0x54c3e7][_0xe6a8('0x49')]=[];_0x27d4db['push'](db[_0xe6a8('0x2b')][_0xe6a8('0x45')]({'where':{'FromId':[_0xf03584[_0xe6a8('0x51')]['id'],_0x4bb3c7[_0x54c3e7]['id']],'ToId':[_0xf03584[_0xe6a8('0x51')]['id'],_0x4bb3c7[_0x54c3e7]['id']],'ChatGroupId':null},'attributes':['id',_0xe6a8('0x4b'),_0xe6a8('0x62'),_0xe6a8('0x63'),_0xe6a8('0x64'),_0xe6a8('0x47')],'order':qs[_0xe6a8('0x56')](_0xe6a8('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe6a8('0x25')](wrapUser(_0x4bb3c7[_0x54c3e7])));}return BPromise[_0xe6a8('0x66')](_0x27d4db);}return[];})[_0xe6a8('0x25')](function(_0x1f70b6){return{'rows':_0x1f70b6,'count':_0x1f70b6[_0xe6a8('0x43')]};})[_0xe6a8('0x25')](respondWithResult(_0x44b7d5,null))[_0xe6a8('0x40')](handleError(_0x44b7d5,null));}; \ No newline at end of file +var _0x3eae=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','end','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','create','body','find','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Agents','userProfileId','agent','resourceId','push','FromId','read','all'];(function(_0x5966a8,_0x5dff94){var _0x2607e7=function(_0x24739c){while(--_0x24739c){_0x5966a8['push'](_0x5966a8['shift']());}};_0x2607e7(++_0x5dff94);}(_0x3eae,0x6c));var _0xe3ea=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x3eae[_0x34eb31];return _0x254994;};'use strict';var emlformat=require(_0xe3ea('0x0'));var rimraf=require(_0xe3ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe3ea('0x2'));var rp=require(_0xe3ea('0x3'));var moment=require(_0xe3ea('0x4'));var BPromise=require(_0xe3ea('0x5'));var Mustache=require('mustache');var util=require(_0xe3ea('0x6'));var path=require(_0xe3ea('0x7'));var sox=require(_0xe3ea('0x8'));var csv=require(_0xe3ea('0x9'));var ejs=require(_0xe3ea('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe3ea('0xb'));var squel=require(_0xe3ea('0xc'));var crypto=require(_0xe3ea('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe3ea('0x9'));var querystring=require(_0xe3ea('0xe'));var Papa=require(_0xe3ea('0xf'));var Redis=require(_0xe3ea('0x10'));var authService=require(_0xe3ea('0x11'));var qs=require(_0xe3ea('0x12'));var as=require(_0xe3ea('0x13'));var hardwareService=require(_0xe3ea('0x14'));var logger=require('../../config/logger')(_0xe3ea('0x15'));var utils=require(_0xe3ea('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe3ea('0x17'));var db=require(_0xe3ea('0x18'))['db'];config['redis']=_[_0xe3ea('0x19')](config[_0xe3ea('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe3ea('0x1b'))(new Redis(config[_0xe3ea('0x1a')]));require('./chatInternalMessage.socket')[_0xe3ea('0x1c')](socket);function respondWithStatusCode(_0x97c2d0,_0x33f176){_0x33f176=_0x33f176||0xcc;return function(_0x3c79d5){if(_0x3c79d5){return _0x97c2d0['sendStatus'](_0x33f176);}return _0x97c2d0['status'](_0x33f176)[_0xe3ea('0x1d')]();};}function respondWithResult(_0x4c5ca8,_0x4bf0f8){_0x4bf0f8=_0x4bf0f8||0xc8;return function(_0x272278){if(_0x272278){return _0x4c5ca8[_0xe3ea('0x1e')](_0x4bf0f8)['json'](_0x272278);}};}function respondWithFilteredResult(_0x276076,_0x334aac){return function(_0x3e5492){if(_0x3e5492){var _0x212dc3=typeof _0x334aac['offset']==='undefined'&&typeof _0x334aac[_0xe3ea('0x1f')]===_0xe3ea('0x20');var _0x4f6589=_0x3e5492[_0xe3ea('0x21')];var _0x20b82d=_0x212dc3?0x0:_0x334aac[_0xe3ea('0x22')];var _0x48986e=_0x212dc3?_0x3e5492[_0xe3ea('0x21')]:_0x334aac['offset']+_0x334aac[_0xe3ea('0x1f')];var _0x63b2e6;if(_0x48986e>=_0x4f6589){_0x48986e=_0x4f6589;_0x63b2e6=0xc8;}else{_0x63b2e6=0xce;}_0x276076[_0xe3ea('0x1e')](_0x63b2e6);return _0x276076[_0xe3ea('0x23')](_0xe3ea('0x24'),_0x20b82d+'-'+_0x48986e+'/'+_0x4f6589)[_0xe3ea('0x25')](_0x3e5492);}return null;};}function patchUpdates(_0x4158c1){return function(_0x44dd81){try{jsonpatch[_0xe3ea('0x26')](_0x44dd81,_0x4158c1,!![]);}catch(_0x4ca6b4){return BPromise[_0xe3ea('0x27')](_0x4ca6b4);}return _0x44dd81['save']();};}function saveUpdates(_0x53128b,_0x56b3c0){return function(_0x8c0169){if(_0x8c0169){return _0x8c0169[_0xe3ea('0x28')](_0x53128b)[_0xe3ea('0x29')](function(_0x31f240){return _0x31f240;});}return null;};}function removeEntity(_0x57f494,_0x3c5f68){return function(_0x1b7747){if(_0x1b7747){return _0x1b7747[_0xe3ea('0x2a')]()[_0xe3ea('0x29')](function(){_0x57f494['status'](0xcc)[_0xe3ea('0x1d')]();});}};}function handleEntityNotFound(_0x41c451,_0x47e661){return function(_0x327279){if(!_0x327279){_0x41c451['sendStatus'](0x194);}return _0x327279;};}function handleError(_0x490bd3,_0x2c91e5){_0x2c91e5=_0x2c91e5||0x1f4;return function(_0x20a3b5){logger[_0xe3ea('0x2b')](_0x20a3b5[_0xe3ea('0x2c')]);if(_0x20a3b5[_0xe3ea('0x2d')]){delete _0x20a3b5[_0xe3ea('0x2d')];}_0x490bd3[_0xe3ea('0x1e')](_0x2c91e5)[_0xe3ea('0x2e')](_0x20a3b5);};}exports[_0xe3ea('0x2f')]=function(_0x545243,_0x4761c8){var _0x12a0bf={},_0x297167={},_0x4da6de={'count':0x0,'rows':[]};var _0x22e548=_[_0xe3ea('0x30')](db[_0xe3ea('0x31')][_0xe3ea('0x32')],function(_0x3c9b80){return{'name':_0x3c9b80[_0xe3ea('0x33')],'type':_0x3c9b80[_0xe3ea('0x34')][_0xe3ea('0x35')]};});_0x297167[_0xe3ea('0x36')]=_[_0xe3ea('0x30')](_0x22e548,_0xe3ea('0x2d'));_0x297167[_0xe3ea('0x37')]=_[_0xe3ea('0x38')](_0x545243[_0xe3ea('0x37')]);_0x297167[_0xe3ea('0x39')]=_[_0xe3ea('0x3a')](_0x297167[_0xe3ea('0x36')],_0x297167[_0xe3ea('0x37')]);_0x12a0bf[_0xe3ea('0x3b')]=_[_0xe3ea('0x3a')](_0x297167[_0xe3ea('0x36')],qs['fields'](_0x545243['query'][_0xe3ea('0x3c')]));_0x12a0bf[_0xe3ea('0x3b')]=_0x12a0bf['attributes']['length']?_0x12a0bf[_0xe3ea('0x3b')]:_0x297167['model'];if(!_0x545243[_0xe3ea('0x37')]['hasOwnProperty'](_0xe3ea('0x3d'))){_0x12a0bf[_0xe3ea('0x1f')]=qs['limit'](_0x545243['query'][_0xe3ea('0x1f')]);_0x12a0bf[_0xe3ea('0x22')]=qs[_0xe3ea('0x22')](_0x545243[_0xe3ea('0x37')][_0xe3ea('0x22')]);}_0x12a0bf[_0xe3ea('0x3e')]=qs['sort'](_0x545243[_0xe3ea('0x37')][_0xe3ea('0x3f')]);_0x12a0bf[_0xe3ea('0x40')]=qs[_0xe3ea('0x39')](_[_0xe3ea('0x41')](_0x545243[_0xe3ea('0x37')],_0x297167['filters']),_0x22e548);if(_0x545243[_0xe3ea('0x37')]['filter']){_0x12a0bf[_0xe3ea('0x40')]=_[_0xe3ea('0x42')](_0x12a0bf['where'],{'$or':_['map'](_0x22e548,function(_0x5b5cd9){if(_0x5b5cd9[_0xe3ea('0x34')]!=='VIRTUAL'){var _0x2d947b={};_0x2d947b[_0x5b5cd9[_0xe3ea('0x2d')]]={'$like':'%'+_0x545243[_0xe3ea('0x37')][_0xe3ea('0x43')]+'%'};return _0x2d947b;}})});}_0x12a0bf=_[_0xe3ea('0x42')]({},_0x12a0bf,_0x545243[_0xe3ea('0x44')]);var _0x49ac98={'where':_0x12a0bf[_0xe3ea('0x40')]};return db[_0xe3ea('0x31')][_0xe3ea('0x21')](_0x49ac98)[_0xe3ea('0x29')](function(_0x211afc){_0x4da6de[_0xe3ea('0x21')]=_0x211afc;if(_0x545243['query'][_0xe3ea('0x45')]){_0x12a0bf[_0xe3ea('0x46')]=[{'all':!![]}];}return db[_0xe3ea('0x31')][_0xe3ea('0x47')](_0x12a0bf);})['then'](function(_0x5d11ee){_0x4da6de['rows']=_0x5d11ee;return _0x4da6de;})[_0xe3ea('0x29')](respondWithFilteredResult(_0x4761c8,_0x12a0bf))[_0xe3ea('0x48')](handleError(_0x4761c8,null));};exports[_0xe3ea('0x49')]=function(_0x53985d,_0x4af66d){var _0x4f5cac={'raw':!![],'where':{'id':_0x53985d['params']['id']}},_0x59e45a={};_0x59e45a[_0xe3ea('0x36')]=_[_0xe3ea('0x38')](db[_0xe3ea('0x31')][_0xe3ea('0x32')]);_0x59e45a[_0xe3ea('0x37')]=_[_0xe3ea('0x38')](_0x53985d[_0xe3ea('0x37')]);_0x59e45a[_0xe3ea('0x39')]=_[_0xe3ea('0x3a')](_0x59e45a[_0xe3ea('0x36')],_0x59e45a['query']);_0x4f5cac[_0xe3ea('0x3b')]=_['intersection'](_0x59e45a['model'],qs[_0xe3ea('0x3c')](_0x53985d[_0xe3ea('0x37')]['fields']));_0x4f5cac[_0xe3ea('0x3b')]=_0x4f5cac[_0xe3ea('0x3b')]['length']?_0x4f5cac['attributes']:_0x59e45a[_0xe3ea('0x36')];if(_0x53985d[_0xe3ea('0x37')][_0xe3ea('0x45')]){_0x4f5cac['include']=[{'all':!![]}];}_0x4f5cac=_[_0xe3ea('0x42')]({},_0x4f5cac,_0x53985d[_0xe3ea('0x44')]);return db[_0xe3ea('0x31')]['find'](_0x4f5cac)[_0xe3ea('0x29')](handleEntityNotFound(_0x4af66d,null))[_0xe3ea('0x29')](respondWithResult(_0x4af66d,null))[_0xe3ea('0x48')](handleError(_0x4af66d,null));};exports[_0xe3ea('0x4a')]=function(_0xaccf62,_0x160fe8){return db[_0xe3ea('0x31')][_0xe3ea('0x4a')](_0xaccf62['body'],{})['then'](respondWithResult(_0x160fe8,0xc9))[_0xe3ea('0x48')](handleError(_0x160fe8,null));};exports[_0xe3ea('0x28')]=function(_0x5e18b1,_0x1566fe){if(_0x5e18b1[_0xe3ea('0x4b')]['id']){delete _0x5e18b1[_0xe3ea('0x4b')]['id'];}return db[_0xe3ea('0x31')][_0xe3ea('0x4c')]({'where':{'id':_0x5e18b1[_0xe3ea('0x4d')]['id']}})[_0xe3ea('0x29')](handleEntityNotFound(_0x1566fe,null))[_0xe3ea('0x29')](saveUpdates(_0x5e18b1[_0xe3ea('0x4b')],null))[_0xe3ea('0x29')](respondWithResult(_0x1566fe,null))[_0xe3ea('0x48')](handleError(_0x1566fe,null));};exports[_0xe3ea('0x2a')]=function(_0x3bf583,_0x5a5ed0){return db[_0xe3ea('0x31')][_0xe3ea('0x4c')]({'where':{'id':_0x3bf583[_0xe3ea('0x4d')]['id']}})[_0xe3ea('0x29')](handleEntityNotFound(_0x5a5ed0,null))['then'](removeEntity(_0x5a5ed0,null))[_0xe3ea('0x48')](handleError(_0x5a5ed0,null));};exports[_0xe3ea('0x4e')]=function(_0x575e01,_0x528bcd){return db['ChatInternalMessage'][_0xe3ea('0x4e')]()[_0xe3ea('0x29')](respondWithResult(_0x528bcd,null))['catch'](handleError(_0x528bcd,null));};function wrapUser(_0x564545){return function(_0x2e8e25){var _0x1f490b=_0x564545[_0xe3ea('0x4f')]({'plain':!![]});_0x1f490b[_0xe3ea('0x50')]=[];if(_0x2e8e25){_0x1f490b[_0xe3ea('0x51')]=_0x2e8e25[_0xe3ea('0x52')];_0x1f490b[_0xe3ea('0x53')]=_0x2e8e25;}else{_0x1f490b[_0xe3ea('0x51')]=moment(0x0)[_0xe3ea('0x54')](_0xe3ea('0x55'));_0x1f490b[_0xe3ea('0x53')]={};}return _0x1f490b;};}exports[_0xe3ea('0x56')]=function(_0x385b9f,_0x13af3f,_0x3ea2c0){var _0x4e59c0=[];return db[_0xe3ea('0x57')][_0xe3ea('0x47')]({'where':{'role':['agent','admin','user']},'attributes':['id',_0xe3ea('0x58'),_0xe3ea('0x2d'),_0xe3ea('0x59'),_0xe3ea('0x5a'),_0xe3ea('0x5b'),'online',_0xe3ea('0x5c'),_0xe3ea('0x5d'),_0xe3ea('0x5e')],'order':qs[_0xe3ea('0x3f')](_0xe3ea('0x5f')),'include':[{'model':db['VoiceQueue'],'as':_0xe3ea('0x60'),'attributes':['id',_0xe3ea('0x2d'),_0xe3ea('0x34')],'through':{'attributes':[]}}]})[_0xe3ea('0x29')](function(_0x496188){if(_0x496188){var _0x109e69=_0x385b9f['user'][_0xe3ea('0x4f')]({'plain':!![]});if(!_0x109e69)throw new Error(_0xe3ea('0x61'));if(_0x109e69['role']===_0xe3ea('0x62')){return db[_0xe3ea('0x63')][_0xe3ea('0x4c')]({'where':{'name':_0xe3ea('0x64'),'userProfileId':_0x109e69[_0xe3ea('0x65')]},'raw':!![]})[_0xe3ea('0x29')](function(_0x375e1c){if(_0x375e1c){if(_0x375e1c['autoAssociation']===0x0){return db['UserProfileResource'][_0xe3ea('0x47')]({'where':{'sectionId':_0x375e1c['id']},'raw':!![]})[_0xe3ea('0x29')](function(_0x1c716c){var _0x305796=[];if(_['isEmpty'](_0x1c716c)){_0x305796=_[_0xe3ea('0x43')](_0x496188,function(_0x2a44e7){if(_0x2a44e7[_0xe3ea('0x59')]!==_0xe3ea('0x66')){return _0x2a44e7;}});return _0x305796;}else{for(var _0xd3836e=0x0;_0xd3836e<_0x496188['length'];_0xd3836e++){var _0x7947a6=_0x496188[_0xd3836e];if(_0x7947a6[_0xe3ea('0x59')]===_0xe3ea('0x66')){var _0xd0a0ab=_[_0xe3ea('0x4c')](_0x1c716c,function(_0x27f2ab){return _0x27f2ab[_0xe3ea('0x67')]===_0x7947a6['id'];});if(_0xd0a0ab)_0x305796['push'](_0x7947a6);}else{_0x305796[_0xe3ea('0x68')](_0x7947a6);}}return _0x305796;}});}else{return _0x496188;}}else{var _0x272ade=_[_0xe3ea('0x43')](_0x496188,function(_0x5937ce){if(_0x5937ce[_0xe3ea('0x59')]!==_0xe3ea('0x66')){return _0x5937ce;}});return _0x272ade;}});}else{return _0x496188;}}})['then'](function(_0x19814f){var _0xb8f782=[];if(_0x19814f){_0x4e59c0=_0x19814f;for(var _0x36d6ad=0x0;_0x36d6ad<_0x19814f['length'];_0x36d6ad+=0x1){_0x4e59c0[_0x36d6ad][_0xe3ea('0x50')]=[];_0xb8f782[_0xe3ea('0x68')](db[_0xe3ea('0x31')][_0xe3ea('0x4c')]({'where':{'FromId':[_0x385b9f['user']['id'],_0x19814f[_0x36d6ad]['id']],'ToId':[_0x385b9f[_0xe3ea('0x62')]['id'],_0x19814f[_0x36d6ad]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xe3ea('0x69'),'ToId',_0xe3ea('0x6a'),'body'],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe3ea('0x29')](wrapUser(_0x19814f[_0x36d6ad])));}return BPromise[_0xe3ea('0x6b')](_0xb8f782);}return[];})[_0xe3ea('0x29')](function(_0x18c2b5){return{'rows':_0x18c2b5,'count':_0x18c2b5['length']};})['then'](respondWithResult(_0x13af3f,null))['catch'](handleError(_0x13af3f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index b23a7b2..4a51e7b 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 _0x16a2=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update'];(function(_0x5d6280,_0x3f72ab){var _0x77b738=function(_0x1b8208){while(--_0x1b8208){_0x5d6280['push'](_0x5d6280['shift']());}};_0x77b738(++_0x3f72ab);}(_0x16a2,0xaa));var _0x216a=function(_0x4c260a,_0x148241){_0x4c260a=_0x4c260a-0x0;var _0x17bbdd=_0x16a2[_0x4c260a];return _0x17bbdd;};'use strict';var EventEmitter=require(_0x216a('0x0'));var ChatInternalMessage=require(_0x216a('0x1'))['db'][_0x216a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x216a('0x3')](0x0);var events={'afterCreate':_0x216a('0x4'),'afterUpdate':_0x216a('0x5'),'afterDestroy':_0x216a('0x6')};function emitEvent(_0x5e5559){return function(_0x467c54,_0x5d4fb2,_0x337ac9){ChatInternalMessageEvents[_0x216a('0x7')](_0x5e5559+':'+_0x467c54['id'],_0x467c54);ChatInternalMessageEvents[_0x216a('0x7')](_0x5e5559,_0x467c54);_0x337ac9(null);};}for(var e in events){if(events[_0x216a('0x8')](e)){var event=events[e];ChatInternalMessage[_0x216a('0x9')](e,emitEvent(event));}}module[_0x216a('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb640=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb640,0xc7));var _0x0b64=function(_0x5a327b,_0x3d253c){_0x5a327b=_0x5a327b-0x0;var _0x474bfb=_0xb640[_0x5a327b];return _0x474bfb;};'use strict';var EventEmitter=require(_0x0b64('0x0'));var ChatInternalMessage=require(_0x0b64('0x1'))['db'][_0x0b64('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0b64('0x3')](0x0);var events={'afterCreate':_0x0b64('0x4'),'afterUpdate':_0x0b64('0x5'),'afterDestroy':_0x0b64('0x6')};function emitEvent(_0x547486){return function(_0x3e598b,_0x3d8c7e,_0xe9ffce){ChatInternalMessageEvents['emit'](_0x547486+':'+_0x3e598b['id'],_0x3e598b);ChatInternalMessageEvents[_0x0b64('0x7')](_0x547486,_0x3e598b);_0xe9ffce(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x0b64('0x8')](e,emitEvent(event));}}module[_0x0b64('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 0304334..85ab344 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 _0x83fb=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util'];(function(_0x182c4e,_0x5586da){var _0x4fd822=function(_0x31ec55){while(--_0x31ec55){_0x182c4e['push'](_0x182c4e['shift']());}};_0x4fd822(++_0x5586da);}(_0x83fb,0x85));var _0xb83f=function(_0x440af5,_0x558acf){_0x440af5=_0x440af5-0x0;var _0x2addc8=_0x83fb[_0x440af5];return _0x2addc8;};'use strict';var _=require(_0xb83f('0x0'));var util=require(_0xb83f('0x1'));var logger=require(_0xb83f('0x2'))(_0xb83f('0x3'));var moment=require(_0xb83f('0x4'));var BPromise=require(_0xb83f('0x5'));var rp=require(_0xb83f('0x6'));var fs=require('fs');var path=require(_0xb83f('0x7'));var rimraf=require(_0xb83f('0x8'));var config=require(_0xb83f('0x9'));var attributes=require(_0xb83f('0xa'));module[_0xb83f('0xb')]=function(_0x4f12e9,_0x5de344){return _0x4f12e9['define'](_0xb83f('0xc'),attributes,{'tableName':_0xb83f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb83f('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1df3=['lodash','api','moment','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci'];(function(_0x2ee189,_0x4f0852){var _0x4bb3a8=function(_0x464bac){while(--_0x464bac){_0x2ee189['push'](_0x2ee189['shift']());}};_0x4bb3a8(++_0x4f0852);}(_0x1df3,0x82));var _0x31df=function(_0x396635,_0x471b01){_0x396635=_0x396635-0x0;var _0x3dfd63=_0x1df3[_0x396635];return _0x3dfd63;};'use strict';var _=require(_0x31df('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x31df('0x1'));var moment=require(_0x31df('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x31df('0x3'));var config=require(_0x31df('0x4'));var attributes=require(_0x31df('0x5'));module['exports']=function(_0x50c363,_0x5cb560){return _0x50c363[_0x31df('0x6')](_0x31df('0x7'),attributes,{'tableName':_0x31df('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x31df('0x9')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 2942c21..82266ed 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 _0x1360=['request\x20sent','debug','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x1360,0xd6));var _0x0136=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x1360[_0x3747ae];return _0x339035;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0136('0x0'));var BPromise=require(_0x0136('0x1'));var rs=require(_0x0136('0x2'));var fs=require('fs');var Redis=require(_0x0136('0x3'));var db=require(_0x0136('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0136('0x5'))(_0x0136('0x6'));var config=require(_0x0136('0x7'));var jayson=require(_0x0136('0x8'));var client=jayson[_0x0136('0x9')][_0x0136('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0136('0xb')],{'host':_0x0136('0xc'),'port':0x18eb});var socket=require(_0x0136('0xd'))(new Redis(config[_0x0136('0xb')]));require(_0x0136('0xe'))[_0x0136('0xf')](socket);function respondWithRpcPromise(_0x1a6998,_0x16c9ee,_0x23bb49){return new BPromise(function(_0x1453f3,_0x5cdd79){return client[_0x0136('0x10')](_0x1a6998,_0x23bb49)[_0x0136('0x11')](function(_0x1f89fb){logger[_0x0136('0x12')](_0x0136('0x13'),_0x16c9ee,_0x0136('0x14'));logger[_0x0136('0x15')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x16c9ee,'request\x20sent',JSON['stringify'](_0x1f89fb));if(_0x1f89fb[_0x0136('0x16')]){if(_0x1f89fb[_0x0136('0x16')][_0x0136('0x17')]===0x1f4){logger[_0x0136('0x16')](_0x0136('0x13'),_0x16c9ee,_0x1f89fb[_0x0136('0x16')][_0x0136('0x18')]);return _0x5cdd79(_0x1f89fb[_0x0136('0x16')][_0x0136('0x18')]);}logger[_0x0136('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x16c9ee,_0x1f89fb[_0x0136('0x16')][_0x0136('0x18')]);return _0x1453f3(_0x1f89fb['error'][_0x0136('0x18')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x16c9ee,_0x0136('0x14'));_0x1453f3(_0x1f89fb[_0x0136('0x19')]['message']);}})['catch'](function(_0x3d7595){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x16c9ee,_0x3d7595);_0x5cdd79(_0x3d7595);});});} \ No newline at end of file +var _0xcbf6=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','socket.io-emitter','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring'];(function(_0x4e61d4,_0x5ed236){var _0x5d5249=function(_0x5a6342){while(--_0x5a6342){_0x4e61d4['push'](_0x4e61d4['shift']());}};_0x5d5249(++_0x5ed236);}(_0xcbf6,0xd8));var _0x6cbf=function(_0x78d8b7,_0x2cfc1d){_0x78d8b7=_0x78d8b7-0x0;var _0x5a979c=_0xcbf6[_0x78d8b7];return _0x5a979c;};'use strict';var _=require(_0x6cbf('0x0'));var util=require('util');var moment=require(_0x6cbf('0x1'));var BPromise=require(_0x6cbf('0x2'));var rs=require(_0x6cbf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6cbf('0x4'))['db'];var utils=require(_0x6cbf('0x5'));var logger=require('../../config/logger')(_0x6cbf('0x6'));var config=require(_0x6cbf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6cbf('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x6cbf('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x6cbf('0xa'))(new Redis(config[_0x6cbf('0x9')]));require('./chatInternalMessage.socket')[_0x6cbf('0xb')](socket);function respondWithRpcPromise(_0x16d325,_0x336036,_0x5ec088){return new BPromise(function(_0x2b0d1e,_0x161e83){return client[_0x6cbf('0xc')](_0x16d325,_0x5ec088)['then'](function(_0x572523){logger[_0x6cbf('0xd')](_0x6cbf('0xe'),_0x336036,_0x6cbf('0xf'));logger[_0x6cbf('0x10')](_0x6cbf('0x11'),_0x336036,'request\x20sent',JSON[_0x6cbf('0x12')](_0x572523));if(_0x572523['error']){if(_0x572523[_0x6cbf('0x13')]['code']===0x1f4){logger[_0x6cbf('0x13')](_0x6cbf('0xe'),_0x336036,_0x572523[_0x6cbf('0x13')][_0x6cbf('0x14')]);return _0x161e83(_0x572523[_0x6cbf('0x13')][_0x6cbf('0x14')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x336036,_0x572523['error']['message']);return _0x2b0d1e(_0x572523['error']['message']);}else{logger[_0x6cbf('0xd')](_0x6cbf('0xe'),_0x336036,'request\x20sent');_0x2b0d1e(_0x572523[_0x6cbf('0x15')][_0x6cbf('0x14')]);}})['catch'](function(_0x304701){logger[_0x6cbf('0x13')](_0x6cbf('0xe'),_0x336036,_0x304701);_0x161e83(_0x304701);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 872676a..d574432 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 _0xfbfe=['removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','remove','update','emit'];(function(_0x8a50fd,_0x6d3613){var _0x5b565a=function(_0x2d6893){while(--_0x2d6893){_0x8a50fd['push'](_0x8a50fd['shift']());}};_0x5b565a(++_0x6d3613);}(_0xfbfe,0xcc));var _0xefbf=function(_0x59c1e9,_0x5cf14f){_0x59c1e9=_0x59c1e9-0x0;var _0x58d216=_0xfbfe[_0x59c1e9];return _0x58d216;};'use strict';var ChatInternalMessageEvents=require(_0xefbf('0x0'));var events=['save',_0xefbf('0x1'),_0xefbf('0x2')];function createListener(_0x35939f,_0x258d8e){return function(_0x334298){_0x258d8e[_0xefbf('0x3')](_0x35939f,_0x334298);};}function removeListener(_0xc09d65,_0x1064bd){return function(){ChatInternalMessageEvents[_0xefbf('0x4')](_0xc09d65,_0x1064bd);};}exports[_0xefbf('0x5')]=function(_0x240741){for(var _0x445736=0x0,_0x3a0245=events[_0xefbf('0x6')];_0x445736<_0x3a0245;_0x445736++){var _0x317dbc=events[_0x445736];var _0x54ac84=createListener(_0xefbf('0x7')+_0x317dbc,_0x240741);ChatInternalMessageEvents['on'](_0x317dbc,_0x54ac84);}}; \ No newline at end of file +var _0xd540=['emit','register','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd540,0x148));var _0x0d54=function(_0x24ef3a,_0x289bbd){_0x24ef3a=_0x24ef3a-0x0;var _0x1ca219=_0xd540[_0x24ef3a];return _0x1ca219;};'use strict';var ChatInternalMessageEvents=require(_0x0d54('0x0'));var events=[_0x0d54('0x1'),'remove','update'];function createListener(_0x57ff0f,_0x25acf4){return function(_0xd9371d){_0x25acf4[_0x0d54('0x2')](_0x57ff0f,_0xd9371d);};}function removeListener(_0x334be8,_0x43cb8b){return function(){ChatInternalMessageEvents['removeListener'](_0x334be8,_0x43cb8b);};}exports[_0x0d54('0x3')]=function(_0x939e2f){for(var _0x3a844f=0x0,_0x6edd97=events['length'];_0x3a844f<_0x6edd97;_0x3a844f++){var _0x48910f=events[_0x3a844f];var _0x151105=createListener(_0x0d54('0x4')+_0x48910f,_0x939e2f);ChatInternalMessageEvents['on'](_0x48910f,_0x151105);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 2c04aef..dfe5db6 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 _0x7d6b=['exports','multer','express','Router','fs-extra','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','create','put','/:id','update','delete','destroy'];(function(_0xff9b1d,_0x2b5114){var _0x972396=function(_0x2b43e1){while(--_0x2b43e1){_0xff9b1d['push'](_0xff9b1d['shift']());}};_0x972396(++_0x2b5114);}(_0x7d6b,0xfd));var _0xb7d6=function(_0xc757ef,_0x59c05c){_0xc757ef=_0xc757ef-0x0;var _0x552324=_0x7d6b[_0xc757ef];return _0x552324;};'use strict';var multer=require(_0xb7d6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb7d6('0x1'));var router=express[_0xb7d6('0x2')]();var fs_extra=require(_0xb7d6('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb7d6('0x4'));var controller=require(_0xb7d6('0x5'));router[_0xb7d6('0x6')]('/',auth[_0xb7d6('0x7')](),controller[_0xb7d6('0x8')]);router['get'](_0xb7d6('0x9'),auth[_0xb7d6('0x7')](),controller[_0xb7d6('0xa')]);router[_0xb7d6('0x6')]('/users',auth[_0xb7d6('0x7')](),controller['getUsers']);router['get']('/:id',auth[_0xb7d6('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xb7d6('0xb')]);router[_0xb7d6('0xc')](_0xb7d6('0xd'),controller[_0xb7d6('0xe')]);router[_0xb7d6('0xf')](_0xb7d6('0xd'),auth['isAuthenticated'](),controller[_0xb7d6('0x10')]);module[_0xb7d6('0x11')]=router; \ No newline at end of file +var _0xfb15=['./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x114843,_0x36b2ff){var _0x3d7a28=function(_0xbb9915){while(--_0xbb9915){_0x114843['push'](_0x114843['shift']());}};_0x3d7a28(++_0x36b2ff);}(_0xfb15,0x70));var _0x5fb1=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xfb15[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x5fb1('0x0'));var util=require(_0x5fb1('0x1'));var path=require(_0x5fb1('0x2'));var timeout=require(_0x5fb1('0x3'));var express=require(_0x5fb1('0x4'));var router=express[_0x5fb1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5fb1('0x6'));var interaction=require(_0x5fb1('0x7'));var config=require('../../config/environment');var controller=require(_0x5fb1('0x8'));router[_0x5fb1('0x9')]('/',auth[_0x5fb1('0xa')](),controller[_0x5fb1('0xb')]);router['get'](_0x5fb1('0xc'),auth[_0x5fb1('0xa')](),controller['describe']);router[_0x5fb1('0x9')](_0x5fb1('0xd'),auth['isAuthenticated'](),controller[_0x5fb1('0xe')]);router[_0x5fb1('0x9')](_0x5fb1('0xf'),auth[_0x5fb1('0xa')](),controller[_0x5fb1('0x10')]);router[_0x5fb1('0x11')]('/',auth[_0x5fb1('0xa')](),controller[_0x5fb1('0x12')]);router[_0x5fb1('0x13')](_0x5fb1('0xf'),controller[_0x5fb1('0x14')]);router[_0x5fb1('0x15')]('/:id',auth[_0x5fb1('0xa')](),controller[_0x5fb1('0x16')]);module[_0x5fb1('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 87f2b06..6137e5c 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 _0xb6fa=['STRING','TEXT','sequelize','medium','ENUM','out','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xb6fa[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0xab6f('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xab6f('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xab6f('0x2')]('in',_0xab6f('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xab6f('0x4')]},'providerName':{'type':Sequelize[_0xab6f('0x5')]},'providerResponse':{'type':Sequelize[_0xab6f('0x6')]}}; \ No newline at end of file +var _0x6146=['BOOLEAN','ENUM','out','STRING','sequelize','TEXT','medium'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0x6146,0xba));var _0x6614=function(_0x17fbba,_0x190b7f){_0x17fbba=_0x17fbba-0x0;var _0x50ab48=_0x6146[_0x17fbba];return _0x50ab48;};'use strict';var Sequelize=require(_0x6614('0x0'));module['exports']={'body':{'type':Sequelize[_0x6614('0x1')](_0x6614('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6614('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6614('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6614('0x4')]('in',_0x6614('0x5')),'defaultValue':_0x6614('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6614('0x6')]},'providerResponse':{'type':Sequelize[_0x6614('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index fefded7..755b364 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 _0xdc10=['undefined','count','save','destroy','stack','name','send','index','ChatMessage','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','chat-interactions','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','update','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','event','reject','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','offset'];(function(_0x2f574b,_0x5dc9d7){var _0x285cd1=function(_0x523096){while(--_0x523096){_0x2f574b['push'](_0x2f574b['shift']());}};_0x285cd1(++_0x5dc9d7);}(_0xdc10,0x15f));var _0x0dc1=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xdc10[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require(_0x0dc1('0x0'));var rimraf=require(_0x0dc1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0dc1('0x2'));var rp=require(_0x0dc1('0x3'));var moment=require(_0x0dc1('0x4'));var BPromise=require(_0x0dc1('0x5'));var Mustache=require('mustache');var util=require(_0x0dc1('0x6'));var path=require('path');var sox=require(_0x0dc1('0x7'));var csv=require(_0x0dc1('0x8'));var ejs=require(_0x0dc1('0x9'));var fs=require('fs');var fs_extra=require(_0x0dc1('0xa'));var _=require(_0x0dc1('0xb'));var squel=require(_0x0dc1('0xc'));var crypto=require(_0x0dc1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0dc1('0xe'));var Papa=require(_0x0dc1('0xf'));var Redis=require(_0x0dc1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0dc1('0x11'));var as=require(_0x0dc1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0dc1('0x13'))(_0x0dc1('0x14'));var utils=require(_0x0dc1('0x15'));var config=require(_0x0dc1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dc1('0x17'))['db'];config[_0x0dc1('0x18')]=_['defaults'](config['redis'],{'host':_0x0dc1('0x19'),'port':0x18eb});var socket=require(_0x0dc1('0x1a'))(new Redis(config[_0x0dc1('0x18')]));require(_0x0dc1('0x1b'))[_0x0dc1('0x1c')](socket);var jayson=require(_0x0dc1('0x1d'));var client=jayson[_0x0dc1('0x1e')][_0x0dc1('0x1f')]({'port':0x232c});var client9002=jayson[_0x0dc1('0x1e')][_0x0dc1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x411c03,_0x26fb2b,_0x39930f,_0x3c6869){return new BPromise(function(_0x51641c,_0x11ab00){var _0x143821=_0x3c6869||client;return _0x143821[_0x0dc1('0x20')](_0x411c03,_0x39930f)[_0x0dc1('0x21')](function(_0x3d566d){logger['info'](_0x0dc1('0x22'),_0x26fb2b,'request\x20sent');logger[_0x0dc1('0x23')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x26fb2b,_0x0dc1('0x24'),JSON[_0x0dc1('0x25')](_0x3d566d));if(_0x3d566d[_0x0dc1('0x26')]){if(_0x3d566d[_0x0dc1('0x26')][_0x0dc1('0x27')]===0x1f4){logger[_0x0dc1('0x26')](_0x0dc1('0x22'),_0x26fb2b,_0x3d566d[_0x0dc1('0x26')][_0x0dc1('0x28')]);return _0x11ab00(_0x3d566d['error'][_0x0dc1('0x28')]);}logger[_0x0dc1('0x26')](_0x0dc1('0x22'),_0x26fb2b,_0x3d566d['error'][_0x0dc1('0x28')]);return _0x51641c(_0x3d566d[_0x0dc1('0x26')][_0x0dc1('0x28')]);}else{logger[_0x0dc1('0x29')](_0x0dc1('0x22'),_0x26fb2b,_0x0dc1('0x24'));_0x51641c(_0x3d566d[_0x0dc1('0x2a')]['message']);}})['catch'](function(_0x5df717){logger[_0x0dc1('0x26')](_0x0dc1('0x22'),_0x26fb2b,_0x5df717);_0x11ab00(_0x5df717);});});}function respondWithStatusCode(_0x59997d,_0x3bc675){_0x3bc675=_0x3bc675||0xcc;return function(_0x36829f){if(_0x36829f){return _0x59997d[_0x0dc1('0x2b')](_0x3bc675);}return _0x59997d[_0x0dc1('0x2c')](_0x3bc675)[_0x0dc1('0x2d')]();};}function respondWithResult(_0xa40d76,_0x2a6068){_0x2a6068=_0x2a6068||0xc8;return function(_0x7412bb){if(_0x7412bb){return _0xa40d76[_0x0dc1('0x2c')](_0x2a6068)[_0x0dc1('0x2e')](_0x7412bb);}};}function respondWithFilteredResult(_0x11f0d5,_0x4939a3){return function(_0x52e6a2){if(_0x52e6a2){var _0x34ce47=typeof _0x4939a3[_0x0dc1('0x2f')]===_0x0dc1('0x30')&&typeof _0x4939a3['limit']===_0x0dc1('0x30');var _0x17c84a=_0x52e6a2[_0x0dc1('0x31')];var _0x5a3fe9=_0x34ce47?0x0:_0x4939a3[_0x0dc1('0x2f')];var _0x51028e=_0x34ce47?_0x52e6a2[_0x0dc1('0x31')]:_0x4939a3['offset']+_0x4939a3['limit'];var _0x56d48c;if(_0x51028e>=_0x17c84a){_0x51028e=_0x17c84a;_0x56d48c=0xc8;}else{_0x56d48c=0xce;}_0x11f0d5['status'](_0x56d48c);return _0x11f0d5['set']('Content-Range',_0x5a3fe9+'-'+_0x51028e+'/'+_0x17c84a)[_0x0dc1('0x2e')](_0x52e6a2);}return null;};}function patchUpdates(_0x220321){return function(_0x453b48){try{jsonpatch['apply'](_0x453b48,_0x220321,!![]);}catch(_0x1cced8){return BPromise['reject'](_0x1cced8);}return _0x453b48[_0x0dc1('0x32')]();};}function saveUpdates(_0x2b0264,_0x1dc383){return function(_0x5afd31){if(_0x5afd31){return _0x5afd31['update'](_0x2b0264)[_0x0dc1('0x21')](function(_0x628420){return _0x628420;});}return null;};}function removeEntity(_0x1e9e78,_0x2a14f6){return function(_0x5a45cd){if(_0x5a45cd){return _0x5a45cd[_0x0dc1('0x33')]()[_0x0dc1('0x21')](function(){_0x1e9e78[_0x0dc1('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x497172,_0x6b89af){return function(_0x25a686){if(!_0x25a686){_0x497172['sendStatus'](0x194);}return _0x25a686;};}function handleError(_0x58e51a,_0x2e06f2){_0x2e06f2=_0x2e06f2||0x1f4;return function(_0x422718){logger['error'](_0x422718[_0x0dc1('0x34')]);if(_0x422718['name']){delete _0x422718[_0x0dc1('0x35')];}_0x58e51a[_0x0dc1('0x2c')](_0x2e06f2)[_0x0dc1('0x36')](_0x422718);};}exports[_0x0dc1('0x37')]=function(_0x58b587,_0x3f8436){var _0x5094df={},_0x1b8d83={},_0x43c2ea={'count':0x0,'rows':[]};var _0x2013da=_['map'](db[_0x0dc1('0x38')][_0x0dc1('0x39')],function(_0x736f5e){return{'name':_0x736f5e[_0x0dc1('0x3a')],'type':_0x736f5e['type'][_0x0dc1('0x3b')]};});_0x1b8d83[_0x0dc1('0x3c')]=_[_0x0dc1('0x3d')](_0x2013da,_0x0dc1('0x35'));_0x1b8d83[_0x0dc1('0x3e')]=_[_0x0dc1('0x3f')](_0x58b587[_0x0dc1('0x3e')]);_0x1b8d83['filters']=_[_0x0dc1('0x40')](_0x1b8d83[_0x0dc1('0x3c')],_0x1b8d83[_0x0dc1('0x3e')]);_0x5094df['attributes']=_[_0x0dc1('0x40')](_0x1b8d83[_0x0dc1('0x3c')],qs['fields'](_0x58b587[_0x0dc1('0x3e')][_0x0dc1('0x41')]));_0x5094df[_0x0dc1('0x42')]=_0x5094df['attributes']['length']?_0x5094df[_0x0dc1('0x42')]:_0x1b8d83[_0x0dc1('0x3c')];if(!_0x58b587[_0x0dc1('0x3e')][_0x0dc1('0x43')](_0x0dc1('0x44'))){_0x5094df['limit']=qs['limit'](_0x58b587[_0x0dc1('0x3e')][_0x0dc1('0x45')]);_0x5094df[_0x0dc1('0x2f')]=qs[_0x0dc1('0x2f')](_0x58b587[_0x0dc1('0x3e')][_0x0dc1('0x2f')]);}_0x5094df['order']=qs['sort'](_0x58b587['query'][_0x0dc1('0x46')]);_0x5094df['where']=qs[_0x0dc1('0x47')](_[_0x0dc1('0x48')](_0x58b587[_0x0dc1('0x3e')],_0x1b8d83[_0x0dc1('0x47')]),_0x2013da);if(_0x58b587[_0x0dc1('0x3e')][_0x0dc1('0x49')]){_0x5094df[_0x0dc1('0x4a')]=_[_0x0dc1('0x4b')](_0x5094df[_0x0dc1('0x4a')],{'$or':_['map'](_0x2013da,function(_0x28e53d){if(_0x28e53d[_0x0dc1('0x4c')]!==_0x0dc1('0x4d')){var _0x195e63={};_0x195e63[_0x28e53d[_0x0dc1('0x35')]]={'$like':'%'+_0x58b587['query'][_0x0dc1('0x49')]+'%'};return _0x195e63;}})});}_0x5094df=_[_0x0dc1('0x4b')]({},_0x5094df,_0x58b587['options']);var _0x4200d6={'where':_0x5094df[_0x0dc1('0x4a')]};return db[_0x0dc1('0x38')][_0x0dc1('0x31')](_0x4200d6)[_0x0dc1('0x21')](function(_0x5e8327){_0x43c2ea[_0x0dc1('0x31')]=_0x5e8327;if(_0x58b587['query'][_0x0dc1('0x4e')]){_0x5094df[_0x0dc1('0x4f')]=[{'all':!![]}];}return db[_0x0dc1('0x38')][_0x0dc1('0x50')](_0x5094df);})[_0x0dc1('0x21')](function(_0x3be5a6){_0x43c2ea[_0x0dc1('0x51')]=_0x3be5a6;return _0x43c2ea;})[_0x0dc1('0x21')](respondWithFilteredResult(_0x3f8436,_0x5094df))[_0x0dc1('0x52')](handleError(_0x3f8436,null));};exports[_0x0dc1('0x53')]=function(_0xd6fe82,_0x44b2a2){var _0x40001d={'raw':!![],'where':{'id':_0xd6fe82[_0x0dc1('0x54')]['id']}},_0x3abf61={};_0x3abf61[_0x0dc1('0x3c')]=_['keys'](db[_0x0dc1('0x38')][_0x0dc1('0x39')]);_0x3abf61[_0x0dc1('0x3e')]=_[_0x0dc1('0x3f')](_0xd6fe82[_0x0dc1('0x3e')]);_0x3abf61[_0x0dc1('0x47')]=_[_0x0dc1('0x40')](_0x3abf61['model'],_0x3abf61['query']);_0x40001d['attributes']=_['intersection'](_0x3abf61[_0x0dc1('0x3c')],qs[_0x0dc1('0x41')](_0xd6fe82[_0x0dc1('0x3e')]['fields']));_0x40001d[_0x0dc1('0x42')]=_0x40001d[_0x0dc1('0x42')][_0x0dc1('0x55')]?_0x40001d[_0x0dc1('0x42')]:_0x3abf61[_0x0dc1('0x3c')];if(_0xd6fe82[_0x0dc1('0x3e')][_0x0dc1('0x4e')]){_0x40001d[_0x0dc1('0x4f')]=[{'all':!![]}];}_0x40001d=_[_0x0dc1('0x4b')]({},_0x40001d,_0xd6fe82[_0x0dc1('0x56')]);return db['ChatMessage'][_0x0dc1('0x57')](_0x40001d)['then'](handleEntityNotFound(_0x44b2a2,null))[_0x0dc1('0x21')](respondWithResult(_0x44b2a2,null))[_0x0dc1('0x52')](handleError(_0x44b2a2,null));};exports[_0x0dc1('0x58')]=function(_0x18575b,_0x36458f){return db['ChatMessage'][_0x0dc1('0x58')](_0x18575b[_0x0dc1('0x59')],{})[_0x0dc1('0x21')](respondWithResult(_0x36458f,0xc9))[_0x0dc1('0x52')](handleError(_0x36458f,null));};exports['update']=function(_0x9be7f1,_0xe8f5d7){if(_0x9be7f1[_0x0dc1('0x59')]['id']){delete _0x9be7f1['body']['id'];}return db[_0x0dc1('0x38')][_0x0dc1('0x57')]({'where':{'id':_0x9be7f1[_0x0dc1('0x54')]['id']}})[_0x0dc1('0x21')](handleEntityNotFound(_0xe8f5d7,null))[_0x0dc1('0x21')](saveUpdates(_0x9be7f1[_0x0dc1('0x59')],null))[_0x0dc1('0x21')](respondWithResult(_0xe8f5d7,null))[_0x0dc1('0x52')](handleError(_0xe8f5d7,null));};exports[_0x0dc1('0x33')]=function(_0x3dea47,_0x5f0728){return db['ChatMessage'][_0x0dc1('0x57')]({'where':{'id':_0x3dea47[_0x0dc1('0x54')]['id']}})[_0x0dc1('0x21')](handleEntityNotFound(_0x5f0728,null))[_0x0dc1('0x21')](removeEntity(_0x5f0728,null))[_0x0dc1('0x52')](handleError(_0x5f0728,null));};exports[_0x0dc1('0x5a')]=function(_0x17cc59,_0x56a098){return db[_0x0dc1('0x38')][_0x0dc1('0x5a')]()['then'](respondWithResult(_0x56a098,null))[_0x0dc1('0x52')](handleError(_0x56a098,null));};var interaction_log=require(_0x0dc1('0x13'))(_0x0dc1('0x5b'));exports[_0x0dc1('0x5c')]=function(_0x65dc75,_0x8a0f15,_0x428137){var _0x5252ce={'agent':{},'channel':_0x0dc1('0x5d')};if(_0x65dc75['body']['id']){delete _0x65dc75[_0x0dc1('0x59')]['id'];}_0x65dc75[_0x0dc1('0x59')][_0x0dc1('0x5e')]=!![];_0x65dc75[_0x0dc1('0x59')][_0x0dc1('0x5f')]=moment()['format'](_0x0dc1('0x60'));_0x65dc75[_0x0dc1('0x59')][_0x0dc1('0x61')]=_0x65dc75[_0x0dc1('0x59')][_0x0dc1('0x61')]||_0x65dc75[_0x0dc1('0x62')]['id'];_0x5252ce[_0x0dc1('0x63')]['id']=_0x65dc75[_0x0dc1('0x59')][_0x0dc1('0x61')];return db[_0x0dc1('0x38')][_0x0dc1('0x57')]({'where':{'id':_0x65dc75[_0x0dc1('0x54')]['id'],'UserId':null}})[_0x0dc1('0x21')](handleEntityNotFound(_0x8a0f15,null))['then'](saveUpdates(_0x65dc75[_0x0dc1('0x59')],null))[_0x0dc1('0x21')](function(_0x4d49e6){if(_0x4d49e6){_0x5252ce[_0x0dc1('0x28')]=_0x4d49e6[_0x0dc1('0x64')]({'plain':!![]});return db[_0x0dc1('0x65')]['find']({'where':{'id':_0x4d49e6['ChatInteractionId']}});}return null;})[_0x0dc1('0x21')](handleEntityNotFound(_0x8a0f15,null))[_0x0dc1('0x21')](function(_0x1b2f0c){if(_0x1b2f0c){return _0x1b2f0c[_0x0dc1('0x66')]({'UserId':_0x65dc75[_0x0dc1('0x59')]['UserId'],'read1stAt':_['isNil'](_0x1b2f0c['read1stAt'])?moment()[_0x0dc1('0x67')](_0x0dc1('0x60')):undefined});}return null;})[_0x0dc1('0x21')](function(_0x5835bf){if(_0x5835bf){_0x5252ce[_0x0dc1('0x68')]=_0x5835bf[_0x0dc1('0x64')]({'plain':!![]});interaction_log[_0x0dc1('0x29')](_0x0dc1('0x69'),_0x65dc75[_0x0dc1('0x62')]['id'],_0x65dc75['user'][_0x0dc1('0x35')],_0x65dc75[_0x0dc1('0x62')][_0x0dc1('0x6a')],_0x5252ce['interaction']['id'],_0x65dc75[_0x0dc1('0x59')]?JSON[_0x0dc1('0x25')](_0x65dc75['body']):_0x0dc1('0x6b'));return respondWithRpcPromise(_0x0dc1('0x6c'),_0x0dc1('0x6d'),_0x5252ce);}return null;})[_0x0dc1('0x21')](function(_0x31ea84){var _0x476047='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x31ea84[_0x0dc1('0x28')]['ContactId'];return db['sequelize']['query'](_0x476047,{'type':db[_0x0dc1('0x6e')][_0x0dc1('0x6f')][_0x0dc1('0x70')],'raw':!![]})['then'](function(_0x4ae770){return _0x4ae770;});})[_0x0dc1('0x21')](function(_0x3c4924){if(_0x3c4924){_0x5252ce[_0x0dc1('0x28')]['contact']=_0x3c4924[0x0];if(!_0x65dc75[_0x0dc1('0x59')][_0x0dc1('0x61')])return;return db[_0x0dc1('0x71')][_0x0dc1('0x57')]({'where':{'id':_0x65dc75[_0x0dc1('0x59')][_0x0dc1('0x61')],'role':_0x0dc1('0x63')},'attributes':['id',_0x0dc1('0x35'),_0x0dc1('0x72'),_0x0dc1('0x73'),_0x0dc1('0x74')],'raw':!![]});}return null;})[_0x0dc1('0x21')](function(_0x1b106d){if(!_0x1b106d)return null;_0x5252ce[_0x0dc1('0x28')][_0x0dc1('0x63')]=_0x1b106d;return _0x5252ce;})[_0x0dc1('0x21')](function(_0xc7c13d){if(_0xc7c13d){if(_0x65dc75['body'][_0x0dc1('0x75')]){_0x5252ce['message'][_0x0dc1('0x76')]=util['format'](_0x0dc1('0x77'),_0x65dc75[_0x0dc1('0x62')][_0x0dc1('0x35')]);_0x5252ce[_0x0dc1('0x28')][_0x0dc1('0x78')]=_0x5252ce[_0x0dc1('0x78')];_0x5252ce[_0x0dc1('0x28')][_0x0dc1('0x79')]=_0x5252ce[_0x0dc1('0x78')];_0x5252ce[_0x0dc1('0x28')]['event']='accept';return respondWithRpcPromise(_0x0dc1('0x7a'),_0x0dc1('0x7a'),{'event':_0x0dc1('0x7b'),'message':_['merge'](_0x5252ce[_0x0dc1('0x28')],JSON[_0x0dc1('0x7c')](_0x5252ce[_0x0dc1('0x68')]['formData']))},client9002)['then'](function(){return _0x5252ce;});}return _0x5252ce;}return null;})['then'](respondWithResult(_0x8a0f15,null))[_0x0dc1('0x52')](handleError(_0x8a0f15,null));};var interaction_log=require(_0x0dc1('0x13'))(_0x0dc1('0x5b'));exports['reject']=function(_0x565745,_0x373033,_0x126a43){var _0x2051c5={'agent':{},'channel':'chat'};if(_0x565745[_0x0dc1('0x59')]['id']){delete _0x565745[_0x0dc1('0x59')]['id'];}_0x565745[_0x0dc1('0x59')][_0x0dc1('0x61')]=_0x565745[_0x0dc1('0x59')]['UserId']||_0x565745[_0x0dc1('0x62')]['id'];_0x2051c5['agent']['id']=_0x565745[_0x0dc1('0x59')][_0x0dc1('0x61')];return db['ChatMessage']['find']({'where':{'id':_0x565745[_0x0dc1('0x54')]['id'],'UserId':null}})[_0x0dc1('0x21')](handleEntityNotFound(_0x373033,null))[_0x0dc1('0x21')](function(_0x12ef2a){if(_0x12ef2a){_0x2051c5[_0x0dc1('0x28')]=_0x12ef2a[_0x0dc1('0x64')]({'plain':!![]});return db['ChatInteraction'][_0x0dc1('0x57')]({'where':{'id':_0x12ef2a[_0x0dc1('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x373033,null))[_0x0dc1('0x21')](function(_0x84fd15){if(_0x84fd15){_0x2051c5[_0x0dc1('0x68')]=_0x84fd15[_0x0dc1('0x64')]({'plain':!![]});interaction_log[_0x0dc1('0x29')](_0x0dc1('0x7e'),_0x565745[_0x0dc1('0x62')]['id'],_0x565745[_0x0dc1('0x62')][_0x0dc1('0x35')],_0x565745[_0x0dc1('0x62')][_0x0dc1('0x6a')],_0x2051c5['interaction']['id'],_0x565745[_0x0dc1('0x59')]?JSON[_0x0dc1('0x25')](_0x565745[_0x0dc1('0x59')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x2051c5);}return null;})[_0x0dc1('0x21')](function(_0x1228f7){var _0x226ece=_0x0dc1('0x7f')+_0x1228f7['message'][_0x0dc1('0x80')];return db[_0x0dc1('0x81')]['query'](_0x226ece,{'type':db[_0x0dc1('0x6e')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x59d3e2){return _0x59d3e2;});})[_0x0dc1('0x21')](function(_0x253b6b){if(_0x253b6b){_0x2051c5[_0x0dc1('0x28')]['contact']=_0x253b6b[0x0];if(!_0x565745['body']['UserId'])return;return db[_0x0dc1('0x71')][_0x0dc1('0x57')]({'where':{'id':_0x565745[_0x0dc1('0x59')][_0x0dc1('0x61')],'role':_0x0dc1('0x63')},'attributes':['id','name',_0x0dc1('0x72'),_0x0dc1('0x73'),_0x0dc1('0x74')],'raw':!![]});}return null;})[_0x0dc1('0x21')](function(_0xd6bde1){if(!_0xd6bde1)return null;_0x2051c5[_0x0dc1('0x28')][_0x0dc1('0x63')]=_0xd6bde1;return _0x2051c5;})[_0x0dc1('0x21')](function(_0x449d95){if(_0x449d95){_0x449d95[_0x0dc1('0x28')]['interface']=util[_0x0dc1('0x67')](_0x0dc1('0x77'),_0x565745['user']['name']);_0x449d95['message'][_0x0dc1('0x78')]=_0x2051c5['channel'];_0x449d95[_0x0dc1('0x28')]['motionChannel']=_0x2051c5[_0x0dc1('0x78')];_0x449d95['message'][_0x0dc1('0x82')]=_0x0dc1('0x83');respondWithRpcPromise(_0x0dc1('0x7a'),_0x0dc1('0x7a'),{'event':_0x0dc1('0x84'),'message':_[_0x0dc1('0x4b')](_0x2051c5['message'],JSON[_0x0dc1('0x7c')](_0x2051c5[_0x0dc1('0x68')]['formData']))},client9002);return _0x2051c5;}return null;})['then'](respondWithResult(_0x373033,null))['catch'](handleError(_0x373033,null));}; \ No newline at end of file +var _0x7a98=['mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','destroy','stack','name','send','index','map','ChatMessage','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rawAttributes','find','create','body','update','params','describe','../../config/logger','chat-interactions','accept','chat','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteraction','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x7a98,0x190));var _0x87a9=function(_0x57f7e2,_0x4872f2){_0x57f7e2=_0x57f7e2-0x0;var _0x26eac1=_0x7a98[_0x57f7e2];return _0x26eac1;};'use strict';var emlformat=require(_0x87a9('0x0'));var rimraf=require(_0x87a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x87a9('0x2'));var moment=require(_0x87a9('0x3'));var BPromise=require(_0x87a9('0x4'));var Mustache=require(_0x87a9('0x5'));var util=require(_0x87a9('0x6'));var path=require(_0x87a9('0x7'));var sox=require(_0x87a9('0x8'));var csv=require(_0x87a9('0x9'));var ejs=require(_0x87a9('0xa'));var fs=require('fs');var fs_extra=require(_0x87a9('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x87a9('0xc'));var deskjs=require(_0x87a9('0xd'));var toCsv=require(_0x87a9('0x9'));var querystring=require(_0x87a9('0xe'));var Papa=require(_0x87a9('0xf'));var Redis=require('ioredis');var authService=require(_0x87a9('0x10'));var qs=require(_0x87a9('0x11'));var as=require(_0x87a9('0x12'));var hardwareService=require(_0x87a9('0x13'));var logger=require('../../config/logger')(_0x87a9('0x14'));var utils=require(_0x87a9('0x15'));var config=require(_0x87a9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x87a9('0x17'))['db'];config[_0x87a9('0x18')]=_['defaults'](config[_0x87a9('0x18')],{'host':_0x87a9('0x19'),'port':0x18eb});var socket=require(_0x87a9('0x1a'))(new Redis(config[_0x87a9('0x18')]));require(_0x87a9('0x1b'))[_0x87a9('0x1c')](socket);var jayson=require(_0x87a9('0x1d'));var client=jayson[_0x87a9('0x1e')][_0x87a9('0x1f')]({'port':0x232c});var client9002=jayson[_0x87a9('0x1e')][_0x87a9('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x94b2ed,_0x28844f,_0x475abd,_0x29c51e){return new BPromise(function(_0x58c180,_0x2b663c){var _0x169664=_0x29c51e||client;return _0x169664['request'](_0x94b2ed,_0x475abd)[_0x87a9('0x20')](function(_0x5cbb3a){logger[_0x87a9('0x21')](_0x87a9('0x22'),_0x28844f,'request\x20sent');logger[_0x87a9('0x23')](_0x87a9('0x24'),_0x28844f,_0x87a9('0x25'),JSON['stringify'](_0x5cbb3a));if(_0x5cbb3a[_0x87a9('0x26')]){if(_0x5cbb3a[_0x87a9('0x26')]['code']===0x1f4){logger[_0x87a9('0x26')](_0x87a9('0x22'),_0x28844f,_0x5cbb3a[_0x87a9('0x26')][_0x87a9('0x27')]);return _0x2b663c(_0x5cbb3a['error'][_0x87a9('0x27')]);}logger[_0x87a9('0x26')](_0x87a9('0x22'),_0x28844f,_0x5cbb3a['error'][_0x87a9('0x27')]);return _0x58c180(_0x5cbb3a[_0x87a9('0x26')][_0x87a9('0x27')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x28844f,_0x87a9('0x25'));_0x58c180(_0x5cbb3a[_0x87a9('0x28')][_0x87a9('0x27')]);}})[_0x87a9('0x29')](function(_0x20a703){logger[_0x87a9('0x26')]('ChatMessage,\x20%s,\x20%s',_0x28844f,_0x20a703);_0x2b663c(_0x20a703);});});}function respondWithStatusCode(_0x4a0732,_0xefc2cd){_0xefc2cd=_0xefc2cd||0xcc;return function(_0x2ef23d){if(_0x2ef23d){return _0x4a0732[_0x87a9('0x2a')](_0xefc2cd);}return _0x4a0732['status'](_0xefc2cd)[_0x87a9('0x2b')]();};}function respondWithResult(_0x5a00be,_0x1379dc){_0x1379dc=_0x1379dc||0xc8;return function(_0x40f3a){if(_0x40f3a){return _0x5a00be['status'](_0x1379dc)['json'](_0x40f3a);}};}function respondWithFilteredResult(_0x4c2b07,_0x44f324){return function(_0x4f7556){if(_0x4f7556){var _0x5a598e=typeof _0x44f324[_0x87a9('0x2c')]===_0x87a9('0x2d')&&typeof _0x44f324[_0x87a9('0x2e')]===_0x87a9('0x2d');var _0x56b0c1=_0x4f7556[_0x87a9('0x2f')];var _0x2d0e77=_0x5a598e?0x0:_0x44f324[_0x87a9('0x2c')];var _0xb79bf8=_0x5a598e?_0x4f7556[_0x87a9('0x2f')]:_0x44f324['offset']+_0x44f324[_0x87a9('0x2e')];var _0x5d11c3;if(_0xb79bf8>=_0x56b0c1){_0xb79bf8=_0x56b0c1;_0x5d11c3=0xc8;}else{_0x5d11c3=0xce;}_0x4c2b07[_0x87a9('0x30')](_0x5d11c3);return _0x4c2b07[_0x87a9('0x31')](_0x87a9('0x32'),_0x2d0e77+'-'+_0xb79bf8+'/'+_0x56b0c1)[_0x87a9('0x33')](_0x4f7556);}return null;};}function patchUpdates(_0x176f03){return function(_0x5accdf){try{jsonpatch[_0x87a9('0x34')](_0x5accdf,_0x176f03,!![]);}catch(_0x3864d0){return BPromise[_0x87a9('0x35')](_0x3864d0);}return _0x5accdf['save']();};}function saveUpdates(_0x170158,_0x17c209){return function(_0x18fc45){if(_0x18fc45){return _0x18fc45['update'](_0x170158)['then'](function(_0x34f19c){return _0x34f19c;});}return null;};}function removeEntity(_0x2ea66a,_0x2d51ec){return function(_0x190c15){if(_0x190c15){return _0x190c15[_0x87a9('0x36')]()[_0x87a9('0x20')](function(){_0x2ea66a[_0x87a9('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dc588,_0x4b96eb){return function(_0x1295b5){if(!_0x1295b5){_0x1dc588[_0x87a9('0x2a')](0x194);}return _0x1295b5;};}function handleError(_0x25eabd,_0x211a22){_0x211a22=_0x211a22||0x1f4;return function(_0x95cd5e){logger[_0x87a9('0x26')](_0x95cd5e[_0x87a9('0x37')]);if(_0x95cd5e[_0x87a9('0x38')]){delete _0x95cd5e['name'];}_0x25eabd[_0x87a9('0x30')](_0x211a22)[_0x87a9('0x39')](_0x95cd5e);};}exports[_0x87a9('0x3a')]=function(_0x267191,_0x518fd6){var _0x52000e={},_0x323d03={},_0x1f9c7b={'count':0x0,'rows':[]};var _0x3b31a8=_[_0x87a9('0x3b')](db[_0x87a9('0x3c')]['rawAttributes'],function(_0x4baa86){return{'name':_0x4baa86[_0x87a9('0x3d')],'type':_0x4baa86[_0x87a9('0x3e')]['key']};});_0x323d03[_0x87a9('0x3f')]=_[_0x87a9('0x3b')](_0x3b31a8,_0x87a9('0x38'));_0x323d03[_0x87a9('0x40')]=_[_0x87a9('0x41')](_0x267191[_0x87a9('0x40')]);_0x323d03['filters']=_[_0x87a9('0x42')](_0x323d03['model'],_0x323d03['query']);_0x52000e[_0x87a9('0x43')]=_['intersection'](_0x323d03[_0x87a9('0x3f')],qs[_0x87a9('0x44')](_0x267191[_0x87a9('0x40')][_0x87a9('0x44')]));_0x52000e['attributes']=_0x52000e[_0x87a9('0x43')][_0x87a9('0x45')]?_0x52000e[_0x87a9('0x43')]:_0x323d03[_0x87a9('0x3f')];if(!_0x267191[_0x87a9('0x40')][_0x87a9('0x46')]('nolimit')){_0x52000e[_0x87a9('0x2e')]=qs[_0x87a9('0x2e')](_0x267191[_0x87a9('0x40')][_0x87a9('0x2e')]);_0x52000e[_0x87a9('0x2c')]=qs[_0x87a9('0x2c')](_0x267191['query']['offset']);}_0x52000e[_0x87a9('0x47')]=qs['sort'](_0x267191['query'][_0x87a9('0x48')]);_0x52000e[_0x87a9('0x49')]=qs['filters'](_[_0x87a9('0x4a')](_0x267191['query'],_0x323d03[_0x87a9('0x4b')]),_0x3b31a8);if(_0x267191[_0x87a9('0x40')]['filter']){_0x52000e['where']=_[_0x87a9('0x4c')](_0x52000e[_0x87a9('0x49')],{'$or':_[_0x87a9('0x3b')](_0x3b31a8,function(_0x507d4c){if(_0x507d4c[_0x87a9('0x3e')]!==_0x87a9('0x4d')){var _0x500ec3={};_0x500ec3[_0x507d4c[_0x87a9('0x38')]]={'$like':'%'+_0x267191['query'][_0x87a9('0x4e')]+'%'};return _0x500ec3;}})});}_0x52000e=_[_0x87a9('0x4c')]({},_0x52000e,_0x267191[_0x87a9('0x4f')]);var _0x26bc5a={'where':_0x52000e[_0x87a9('0x49')]};return db['ChatMessage'][_0x87a9('0x2f')](_0x26bc5a)[_0x87a9('0x20')](function(_0x282c79){_0x1f9c7b['count']=_0x282c79;if(_0x267191[_0x87a9('0x40')][_0x87a9('0x50')]){_0x52000e[_0x87a9('0x51')]=[{'all':!![]}];}return db['ChatMessage'][_0x87a9('0x52')](_0x52000e);})['then'](function(_0x49ccef){_0x1f9c7b['rows']=_0x49ccef;return _0x1f9c7b;})[_0x87a9('0x20')](respondWithFilteredResult(_0x518fd6,_0x52000e))[_0x87a9('0x29')](handleError(_0x518fd6,null));};exports['show']=function(_0x1fcb49,_0x26dc03){var _0xac2742={'raw':!![],'where':{'id':_0x1fcb49['params']['id']}},_0x285ce7={};_0x285ce7[_0x87a9('0x3f')]=_[_0x87a9('0x41')](db['ChatMessage'][_0x87a9('0x53')]);_0x285ce7[_0x87a9('0x40')]=_[_0x87a9('0x41')](_0x1fcb49[_0x87a9('0x40')]);_0x285ce7[_0x87a9('0x4b')]=_[_0x87a9('0x42')](_0x285ce7[_0x87a9('0x3f')],_0x285ce7[_0x87a9('0x40')]);_0xac2742[_0x87a9('0x43')]=_[_0x87a9('0x42')](_0x285ce7[_0x87a9('0x3f')],qs[_0x87a9('0x44')](_0x1fcb49['query'][_0x87a9('0x44')]));_0xac2742[_0x87a9('0x43')]=_0xac2742[_0x87a9('0x43')][_0x87a9('0x45')]?_0xac2742['attributes']:_0x285ce7['model'];if(_0x1fcb49[_0x87a9('0x40')]['includeAll']){_0xac2742[_0x87a9('0x51')]=[{'all':!![]}];}_0xac2742=_[_0x87a9('0x4c')]({},_0xac2742,_0x1fcb49[_0x87a9('0x4f')]);return db['ChatMessage'][_0x87a9('0x54')](_0xac2742)[_0x87a9('0x20')](handleEntityNotFound(_0x26dc03,null))[_0x87a9('0x20')](respondWithResult(_0x26dc03,null))[_0x87a9('0x29')](handleError(_0x26dc03,null));};exports[_0x87a9('0x55')]=function(_0x10ba06,_0x55d628){return db[_0x87a9('0x3c')][_0x87a9('0x55')](_0x10ba06[_0x87a9('0x56')],{})[_0x87a9('0x20')](respondWithResult(_0x55d628,0xc9))[_0x87a9('0x29')](handleError(_0x55d628,null));};exports[_0x87a9('0x57')]=function(_0xbe8654,_0xa5f906){if(_0xbe8654[_0x87a9('0x56')]['id']){delete _0xbe8654['body']['id'];}return db[_0x87a9('0x3c')][_0x87a9('0x54')]({'where':{'id':_0xbe8654[_0x87a9('0x58')]['id']}})[_0x87a9('0x20')](handleEntityNotFound(_0xa5f906,null))[_0x87a9('0x20')](saveUpdates(_0xbe8654[_0x87a9('0x56')],null))['then'](respondWithResult(_0xa5f906,null))[_0x87a9('0x29')](handleError(_0xa5f906,null));};exports[_0x87a9('0x36')]=function(_0x33d88d,_0x1668dc){return db[_0x87a9('0x3c')]['find']({'where':{'id':_0x33d88d[_0x87a9('0x58')]['id']}})[_0x87a9('0x20')](handleEntityNotFound(_0x1668dc,null))['then'](removeEntity(_0x1668dc,null))[_0x87a9('0x29')](handleError(_0x1668dc,null));};exports[_0x87a9('0x59')]=function(_0x333203,_0x2429a8){return db['ChatMessage']['describe']()['then'](respondWithResult(_0x2429a8,null))[_0x87a9('0x29')](handleError(_0x2429a8,null));};var interaction_log=require(_0x87a9('0x5a'))(_0x87a9('0x5b'));exports[_0x87a9('0x5c')]=function(_0x106ac0,_0x43d842,_0x320a5f){var _0x478daa={'agent':{},'channel':_0x87a9('0x5d')};if(_0x106ac0[_0x87a9('0x56')]['id']){delete _0x106ac0[_0x87a9('0x56')]['id'];}_0x106ac0[_0x87a9('0x56')][_0x87a9('0x5e')]=!![];_0x106ac0[_0x87a9('0x56')]['readAt']=moment()['format'](_0x87a9('0x5f'));_0x106ac0[_0x87a9('0x56')][_0x87a9('0x60')]=_0x106ac0['body'][_0x87a9('0x60')]||_0x106ac0['user']['id'];_0x478daa[_0x87a9('0x61')]['id']=_0x106ac0['body'][_0x87a9('0x60')];return db['ChatMessage'][_0x87a9('0x54')]({'where':{'id':_0x106ac0[_0x87a9('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x43d842,null))[_0x87a9('0x20')](saveUpdates(_0x106ac0[_0x87a9('0x56')],null))[_0x87a9('0x20')](function(_0x185977){if(_0x185977){_0x478daa[_0x87a9('0x27')]=_0x185977[_0x87a9('0x62')]({'plain':!![]});return db[_0x87a9('0x63')][_0x87a9('0x54')]({'where':{'id':_0x185977['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x43d842,null))['then'](function(_0x4f6cfb){if(_0x4f6cfb){return _0x4f6cfb[_0x87a9('0x57')]({'UserId':_0x106ac0[_0x87a9('0x56')][_0x87a9('0x60')],'read1stAt':_[_0x87a9('0x64')](_0x4f6cfb[_0x87a9('0x65')])?moment()['format'](_0x87a9('0x5f')):undefined});}return null;})[_0x87a9('0x20')](function(_0xa6bf3e){if(_0xa6bf3e){_0x478daa['interaction']=_0xa6bf3e[_0x87a9('0x62')]({'plain':!![]});interaction_log[_0x87a9('0x21')](_0x87a9('0x66'),_0x106ac0['user']['id'],_0x106ac0[_0x87a9('0x67')][_0x87a9('0x38')],_0x106ac0[_0x87a9('0x67')][_0x87a9('0x68')],_0x478daa[_0x87a9('0x69')]['id'],_0x106ac0[_0x87a9('0x56')]?JSON['stringify'](_0x106ac0[_0x87a9('0x56')]):_0x87a9('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x87a9('0x6b'),_0x478daa);}return null;})[_0x87a9('0x20')](function(_0x11c38f){var _0x24fb2c=_0x87a9('0x6c')+_0x11c38f[_0x87a9('0x27')][_0x87a9('0x6d')];return db[_0x87a9('0x6e')][_0x87a9('0x40')](_0x24fb2c,{'type':db[_0x87a9('0x6f')][_0x87a9('0x70')][_0x87a9('0x71')],'raw':!![]})['then'](function(_0x40d8a2){return _0x40d8a2;});})[_0x87a9('0x20')](function(_0x445f8d){if(_0x445f8d){_0x478daa['message'][_0x87a9('0x72')]=_0x445f8d[0x0];if(!_0x106ac0['body']['UserId'])return;return db[_0x87a9('0x73')]['find']({'where':{'id':_0x106ac0[_0x87a9('0x56')][_0x87a9('0x60')],'role':_0x87a9('0x61')},'attributes':['id',_0x87a9('0x38'),_0x87a9('0x74'),_0x87a9('0x75'),_0x87a9('0x76')],'raw':!![]});}return null;})[_0x87a9('0x20')](function(_0x35ceb3){if(!_0x35ceb3)return null;_0x478daa[_0x87a9('0x27')][_0x87a9('0x61')]=_0x35ceb3;return _0x478daa;})[_0x87a9('0x20')](function(_0x59ee32){if(_0x59ee32){if(_0x106ac0[_0x87a9('0x56')][_0x87a9('0x77')]){_0x478daa[_0x87a9('0x27')][_0x87a9('0x78')]=util[_0x87a9('0x79')](_0x87a9('0x7a'),_0x106ac0[_0x87a9('0x67')]['name']);_0x478daa['message'][_0x87a9('0x7b')]=_0x478daa[_0x87a9('0x7b')];_0x478daa[_0x87a9('0x27')][_0x87a9('0x7c')]=_0x478daa['channel'];_0x478daa[_0x87a9('0x27')]['event']='accept';return respondWithRpcPromise(_0x87a9('0x7d'),_0x87a9('0x7d'),{'event':_0x87a9('0x7e'),'message':_[_0x87a9('0x4c')](_0x478daa[_0x87a9('0x27')],JSON[_0x87a9('0x7f')](_0x478daa['interaction'][_0x87a9('0x80')]))},client9002)['then'](function(){return _0x478daa;});}return _0x478daa;}return null;})[_0x87a9('0x20')](respondWithResult(_0x43d842,null))[_0x87a9('0x29')](handleError(_0x43d842,null));};var interaction_log=require('../../config/logger')(_0x87a9('0x5b'));exports[_0x87a9('0x35')]=function(_0x1b02f9,_0x5c7358,_0x1e9d26){var _0x4a8657={'agent':{},'channel':'chat'};if(_0x1b02f9[_0x87a9('0x56')]['id']){delete _0x1b02f9[_0x87a9('0x56')]['id'];}_0x1b02f9[_0x87a9('0x56')][_0x87a9('0x60')]=_0x1b02f9[_0x87a9('0x56')]['UserId']||_0x1b02f9['user']['id'];_0x4a8657[_0x87a9('0x61')]['id']=_0x1b02f9['body'][_0x87a9('0x60')];return db[_0x87a9('0x3c')][_0x87a9('0x54')]({'where':{'id':_0x1b02f9[_0x87a9('0x58')]['id'],'UserId':null}})[_0x87a9('0x20')](handleEntityNotFound(_0x5c7358,null))[_0x87a9('0x20')](function(_0x304c26){if(_0x304c26){_0x4a8657[_0x87a9('0x27')]=_0x304c26['get']({'plain':!![]});return db['ChatInteraction'][_0x87a9('0x54')]({'where':{'id':_0x304c26[_0x87a9('0x81')]}});}return null;})[_0x87a9('0x20')](handleEntityNotFound(_0x5c7358,null))[_0x87a9('0x20')](function(_0x4b9ed6){if(_0x4b9ed6){_0x4a8657['interaction']=_0x4b9ed6['get']({'plain':!![]});interaction_log[_0x87a9('0x21')](_0x87a9('0x82'),_0x1b02f9[_0x87a9('0x67')]['id'],_0x1b02f9[_0x87a9('0x67')]['name'],_0x1b02f9[_0x87a9('0x67')][_0x87a9('0x68')],_0x4a8657[_0x87a9('0x69')]['id'],_0x1b02f9[_0x87a9('0x56')]?JSON['stringify'](_0x1b02f9[_0x87a9('0x56')]):_0x87a9('0x6a'));return respondWithRpcPromise(_0x87a9('0x83'),_0x87a9('0x84'),_0x4a8657);}return null;})['then'](function(_0x579d63){var _0x3c724=_0x87a9('0x6c')+_0x579d63['message'][_0x87a9('0x6d')];return db[_0x87a9('0x6e')][_0x87a9('0x40')](_0x3c724,{'type':db[_0x87a9('0x6f')][_0x87a9('0x70')]['SELECT'],'raw':!![]})[_0x87a9('0x20')](function(_0x2a8ac1){return _0x2a8ac1;});})[_0x87a9('0x20')](function(_0xe2e088){if(_0xe2e088){_0x4a8657[_0x87a9('0x27')][_0x87a9('0x72')]=_0xe2e088[0x0];if(!_0x1b02f9['body'][_0x87a9('0x60')])return;return db[_0x87a9('0x73')]['find']({'where':{'id':_0x1b02f9[_0x87a9('0x56')][_0x87a9('0x60')],'role':'agent'},'attributes':['id',_0x87a9('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x4cfab5){if(!_0x4cfab5)return null;_0x4a8657[_0x87a9('0x27')][_0x87a9('0x61')]=_0x4cfab5;return _0x4a8657;})[_0x87a9('0x20')](function(_0x19188f){if(_0x19188f){_0x19188f[_0x87a9('0x27')][_0x87a9('0x78')]=util['format'](_0x87a9('0x7a'),_0x1b02f9[_0x87a9('0x67')][_0x87a9('0x38')]);_0x19188f[_0x87a9('0x27')][_0x87a9('0x7b')]=_0x4a8657['channel'];_0x19188f[_0x87a9('0x27')][_0x87a9('0x7c')]=_0x4a8657[_0x87a9('0x7b')];_0x19188f['message'][_0x87a9('0x85')]=_0x87a9('0x35');respondWithRpcPromise('EventManager',_0x87a9('0x7d'),{'event':_0x87a9('0x86'),'message':_[_0x87a9('0x4c')](_0x4a8657[_0x87a9('0x27')],JSON[_0x87a9('0x7f')](_0x4a8657['interaction']['formData']))},client9002);return _0x4a8657;}return null;})['then'](respondWithResult(_0x5c7358,null))[_0x87a9('0x29')](handleError(_0x5c7358,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index d155224..1bde0c1 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 _0x9d70=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x9d70,0xd5));var _0x09d7=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x9d70[_0x40220a];return _0x3903cc;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x09d7('0x0'))['db'][_0x09d7('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x09d7('0x2')](0x0);var events={'afterCreate':_0x09d7('0x3'),'afterUpdate':_0x09d7('0x4'),'afterDestroy':_0x09d7('0x5')};function emitEvent(_0xd2207f){return function(_0x426e08,_0xb9cf99,_0x3639ec){ChatMessageEvents[_0x09d7('0x6')](_0xd2207f+':'+_0x426e08['id'],_0x426e08);ChatMessageEvents[_0x09d7('0x6')](_0xd2207f,_0x426e08);_0x3639ec(null);};}for(var e in events){if(events[_0x09d7('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x09d7('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x8bf2=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x85f9ac,_0x218c30){var _0x7e29cf=function(_0xb1473f){while(--_0xb1473f){_0x85f9ac['push'](_0x85f9ac['shift']());}};_0x7e29cf(++_0x218c30);}(_0x8bf2,0xba));var _0x28bf=function(_0x5968f4,_0x28a384){_0x5968f4=_0x5968f4-0x0;var _0x589de1=_0x8bf2[_0x5968f4];return _0x589de1;};'use strict';var EventEmitter=require(_0x28bf('0x0'));var ChatMessage=require(_0x28bf('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x28bf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x28bf('0x3'),'afterDestroy':_0x28bf('0x4')};function emitEvent(_0x4c6815){return function(_0x361ac1,_0x153ce7,_0x27ca3e){ChatMessageEvents['emit'](_0x4c6815+':'+_0x361ac1['id'],_0x361ac1);ChatMessageEvents[_0x28bf('0x5')](_0x4c6815,_0x361ac1);_0x27ca3e(null);};}for(var e in events){if(events[_0x28bf('0x6')](e)){var event=events[e];ChatMessage[_0x28bf('0x7')](e,emitEvent(event));}}module[_0x28bf('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index be7e045..fb9017f 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 _0xff16=['direction','toLowerCase','out','secret','ChatInteraction','ChatInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get'];(function(_0x286658,_0x48f2c4){var _0x4dd1e6=function(_0x1cd8cb){while(--_0x1cd8cb){_0x286658['push'](_0x286658['shift']());}};_0x4dd1e6(++_0x48f2c4);}(_0xff16,0x7f));var _0x6ff1=function(_0x1a17a0,_0x2d06c1){_0x1a17a0=_0x1a17a0-0x0;var _0x25778f=_0xff16[_0x1a17a0];return _0x25778f;};'use strict';var _=require(_0x6ff1('0x0'));var util=require(_0x6ff1('0x1'));var logger=require('../../config/logger')(_0x6ff1('0x2'));var moment=require(_0x6ff1('0x3'));var BPromise=require(_0x6ff1('0x4'));var rp=require(_0x6ff1('0x5'));var fs=require('fs');var path=require(_0x6ff1('0x6'));var rimraf=require(_0x6ff1('0x7'));var config=require(_0x6ff1('0x8'));var attributes=require(_0x6ff1('0x9'));module['exports']=function(_0x153a91,_0x4f8f24){return _0x153a91[_0x6ff1('0xa')](_0x6ff1('0xb'),attributes,{'tableName':_0x6ff1('0xc'),'paranoid':![],'indexes':[{'name':_0x6ff1('0xd'),'fields':[_0x6ff1('0xe')],'type':_0x6ff1('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41e99f,_0x172393,_0x514f83){var _0x2bbd50=_0x153a91[_0x6ff1('0x10')];var _0x41bcca=_0x41e99f[_0x6ff1('0x11')]({'plain':!![]});if(_0x41bcca[_0x6ff1('0x12')][_0x6ff1('0x13')]()==='in'||_0x41bcca[_0x6ff1('0x12')][_0x6ff1('0x13')]()===_0x6ff1('0x14')&&!_0x41bcca[_0x6ff1('0x15')]&&!_['isNil'](_0x41bcca['UserId'])){_0x2bbd50[_0x6ff1('0x16')]['findOne']({'where':{'id':_0x41bcca[_0x6ff1('0x17')]}})[_0x6ff1('0x18')](function(_0x1451af){if(_0x1451af){_0x1451af['update']({'lastMsgAt':_0x41bcca['createdAt'],'lastMsgDirection':_0x41bcca['direction'][_0x6ff1('0x13')]()});}})[_0x6ff1('0x19')](function(_0x23112d){console[_0x6ff1('0x1a')](_0x23112d);});}_0x514f83();}},'charset':_0x6ff1('0x1b'),'collate':_0x6ff1('0x1c')});}; \ No newline at end of file +var _0x45dc=['error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update'];(function(_0xeb9575,_0x25a470){var _0x274759=function(_0x2a7f88){while(--_0x2a7f88){_0xeb9575['push'](_0xeb9575['shift']());}};_0x274759(++_0x25a470);}(_0x45dc,0x139));var _0xc45d=function(_0x2233be,_0xd10120){_0x2233be=_0x2233be-0x0;var _0x1a6468=_0x45dc[_0x2233be];return _0x1a6468;};'use strict';var _=require('lodash');var util=require(_0xc45d('0x0'));var logger=require(_0xc45d('0x1'))(_0xc45d('0x2'));var moment=require(_0xc45d('0x3'));var BPromise=require(_0xc45d('0x4'));var rp=require(_0xc45d('0x5'));var fs=require('fs');var path=require(_0xc45d('0x6'));var rimraf=require(_0xc45d('0x7'));var config=require(_0xc45d('0x8'));var attributes=require(_0xc45d('0x9'));module[_0xc45d('0xa')]=function(_0x2c8383,_0x352dc2){return _0x2c8383[_0xc45d('0xb')](_0xc45d('0xc'),attributes,{'tableName':_0xc45d('0xd'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xc45d('0xe')],'type':_0xc45d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x433457,_0x1c53d0,_0x355a2f){var _0x7792d1=_0x2c8383[_0xc45d('0x10')];var _0x4bfcd3=_0x433457[_0xc45d('0x11')]({'plain':!![]});if(_0x4bfcd3[_0xc45d('0x12')][_0xc45d('0x13')]()==='in'||_0x4bfcd3[_0xc45d('0x12')][_0xc45d('0x13')]()===_0xc45d('0x14')&&!_0x4bfcd3[_0xc45d('0x15')]&&!_[_0xc45d('0x16')](_0x4bfcd3[_0xc45d('0x17')])){_0x7792d1[_0xc45d('0x18')][_0xc45d('0x19')]({'where':{'id':_0x4bfcd3[_0xc45d('0x1a')]}})['then'](function(_0x5c7025){if(_0x5c7025){_0x5c7025[_0xc45d('0x1b')]({'lastMsgAt':_0x4bfcd3['createdAt'],'lastMsgDirection':_0x4bfcd3[_0xc45d('0x12')][_0xc45d('0x13')]()});}})['catch'](function(_0x503bd5){console[_0xc45d('0x1c')](_0x503bd5);});}_0x355a2f();}},'charset':_0xc45d('0x1d'),'collate':_0xc45d('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 5ff2b75..644d2e6 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 _0x41d7=['catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message'];(function(_0x346587,_0x3b78c9){var _0x39f770=function(_0x3199fa){while(--_0x3199fa){_0x346587['push'](_0x346587['shift']());}};_0x39f770(++_0x3b78c9);}(_0x41d7,0x194));var _0x741d=function(_0x5cd290,_0x393e66){_0x5cd290=_0x5cd290-0x0;var _0x2d3166=_0x41d7[_0x5cd290];return _0x2d3166;};'use strict';var _=require('lodash');var util=require(_0x741d('0x0'));var moment=require(_0x741d('0x1'));var BPromise=require(_0x741d('0x2'));var rs=require(_0x741d('0x3'));var fs=require('fs');var Redis=require(_0x741d('0x4'));var db=require(_0x741d('0x5'))['db'];var utils=require(_0x741d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x741d('0x7'));var jayson=require(_0x741d('0x8'));var client=jayson['client'][_0x741d('0x9')]({'port':0x232a});config[_0x741d('0xa')]=_[_0x741d('0xb')](config['redis'],{'host':_0x741d('0xc'),'port':0x18eb});var socket=require(_0x741d('0xd'))(new Redis(config['redis']));require(_0x741d('0xe'))[_0x741d('0xf')](socket);function respondWithRpcPromise(_0x41a071,_0x5a711e,_0x5a1b32){return new BPromise(function(_0x1a7e91,_0x20bdb5){return client[_0x741d('0x10')](_0x41a071,_0x5a1b32)['then'](function(_0x71df37){logger[_0x741d('0x11')]('ChatMessage,\x20%s,\x20%s',_0x5a711e,_0x741d('0x12'));logger[_0x741d('0x13')](_0x741d('0x14'),_0x5a711e,_0x741d('0x12'),JSON['stringify'](_0x71df37));if(_0x71df37[_0x741d('0x15')]){if(_0x71df37[_0x741d('0x15')][_0x741d('0x16')]===0x1f4){logger[_0x741d('0x15')](_0x741d('0x17'),_0x5a711e,_0x71df37[_0x741d('0x15')][_0x741d('0x18')]);return _0x20bdb5(_0x71df37[_0x741d('0x15')][_0x741d('0x18')]);}logger[_0x741d('0x15')](_0x741d('0x17'),_0x5a711e,_0x71df37[_0x741d('0x15')][_0x741d('0x18')]);return _0x1a7e91(_0x71df37[_0x741d('0x15')][_0x741d('0x18')]);}else{logger[_0x741d('0x11')](_0x741d('0x17'),_0x5a711e,'request\x20sent');_0x1a7e91(_0x71df37['result'][_0x741d('0x18')]);}})[_0x741d('0x19')](function(_0x174dc4){logger[_0x741d('0x15')](_0x741d('0x17'),_0x5a711e,_0x174dc4);_0x20bdb5(_0x174dc4);});});}exports[_0x741d('0x1a')]=function(_0x49750c){var _0x279ff1=this;return new Promise(function(_0x2b9871,_0x1f0acb){return db[_0x741d('0x1b')][_0x741d('0x1c')](_0x49750c[_0x741d('0x1d')],{'raw':_0x49750c[_0x741d('0x1e')]?_0x49750c['options'][_0x741d('0x1f')]===undefined?!![]:![]:!![]})[_0x741d('0x20')](function(_0x5c6550){logger['info'](_0x741d('0x1a'),_0x49750c);logger[_0x741d('0x13')](_0x741d('0x1a'),_0x49750c,JSON['stringify'](_0x5c6550));_0x2b9871(_0x5c6550);})[_0x741d('0x19')](function(_0x581d2d){logger[_0x741d('0x15')](_0x741d('0x1a'),_0x581d2d['message'],_0x49750c);_0x1f0acb(_0x279ff1[_0x741d('0x15')](0x1f4,_0x581d2d[_0x741d('0x18')]));});});}; \ No newline at end of file +var _0x218e=['raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options'];(function(_0x1eb37b,_0xecd594){var _0x2c37fd=function(_0x548705){while(--_0x548705){_0x1eb37b['push'](_0x1eb37b['shift']());}};_0x2c37fd(++_0xecd594);}(_0x218e,0x1c8));var _0xe218=function(_0xe85976,_0x40f837){_0xe85976=_0xe85976-0x0;var _0x1d59c0=_0x218e[_0xe85976];return _0x1d59c0;};'use strict';var _=require(_0xe218('0x0'));var util=require(_0xe218('0x1'));var moment=require(_0xe218('0x2'));var BPromise=require(_0xe218('0x3'));var rs=require(_0xe218('0x4'));var fs=require('fs');var Redis=require(_0xe218('0x5'));var db=require(_0xe218('0x6'))['db'];var utils=require(_0xe218('0x7'));var logger=require(_0xe218('0x8'))('rpc');var config=require(_0xe218('0x9'));var jayson=require(_0xe218('0xa'));var client=jayson[_0xe218('0xb')]['http']({'port':0x232a});config['redis']=_[_0xe218('0xc')](config[_0xe218('0xd')],{'host':_0xe218('0xe'),'port':0x18eb});var socket=require(_0xe218('0xf'))(new Redis(config[_0xe218('0xd')]));require(_0xe218('0x10'))['register'](socket);function respondWithRpcPromise(_0x1e0d68,_0x5d7313,_0x28eb79){return new BPromise(function(_0x198ba8,_0x1604ed){return client['request'](_0x1e0d68,_0x28eb79)[_0xe218('0x11')](function(_0x2943d5){logger[_0xe218('0x12')](_0xe218('0x13'),_0x5d7313,_0xe218('0x14'));logger[_0xe218('0x15')](_0xe218('0x16'),_0x5d7313,'request\x20sent',JSON[_0xe218('0x17')](_0x2943d5));if(_0x2943d5[_0xe218('0x18')]){if(_0x2943d5[_0xe218('0x18')][_0xe218('0x19')]===0x1f4){logger['error'](_0xe218('0x13'),_0x5d7313,_0x2943d5[_0xe218('0x18')][_0xe218('0x1a')]);return _0x1604ed(_0x2943d5[_0xe218('0x18')][_0xe218('0x1a')]);}logger[_0xe218('0x18')](_0xe218('0x13'),_0x5d7313,_0x2943d5[_0xe218('0x18')][_0xe218('0x1a')]);return _0x198ba8(_0x2943d5['error'][_0xe218('0x1a')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x5d7313,'request\x20sent');_0x198ba8(_0x2943d5[_0xe218('0x1b')][_0xe218('0x1a')]);}})[_0xe218('0x1c')](function(_0x4fe54f){logger[_0xe218('0x18')](_0xe218('0x13'),_0x5d7313,_0x4fe54f);_0x1604ed(_0x4fe54f);});});}exports[_0xe218('0x1d')]=function(_0x461ee7){var _0x485890=this;return new Promise(function(_0x927533,_0x269c48){return db[_0xe218('0x1e')][_0xe218('0x1f')](_0x461ee7[_0xe218('0x20')],{'raw':_0x461ee7[_0xe218('0x21')]?_0x461ee7[_0xe218('0x21')][_0xe218('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x454e0d){logger[_0xe218('0x12')](_0xe218('0x1d'),_0x461ee7);logger[_0xe218('0x15')](_0xe218('0x1d'),_0x461ee7,JSON[_0xe218('0x17')](_0x454e0d));_0x927533(_0x454e0d);})['catch'](function(_0xec802a){logger[_0xe218('0x18')]('CreateChatMessage',_0xec802a[_0xe218('0x1a')],_0x461ee7);_0x269c48(_0x485890['error'](0x1f4,_0xec802a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 07ee609..9c191aa 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 _0x9fc5=['save','remove','emit','removeListener','register','length','chatMessage:'];(function(_0x3fbb40,_0x408c22){var _0x3a9c8=function(_0x454e9c){while(--_0x454e9c){_0x3fbb40['push'](_0x3fbb40['shift']());}};_0x3a9c8(++_0x408c22);}(_0x9fc5,0xb6));var _0x59fc=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x9fc5[_0x54b062];return _0x255e41;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x59fc('0x0'),_0x59fc('0x1'),'update'];function createListener(_0x4647c5,_0x24cd55){return function(_0x46c819){_0x24cd55[_0x59fc('0x2')](_0x4647c5,_0x46c819);};}function removeListener(_0x44979c,_0x1b0778){return function(){ChatMessageEvents[_0x59fc('0x3')](_0x44979c,_0x1b0778);};}exports[_0x59fc('0x4')]=function(_0x4cb94d){for(var _0x3bde0b=0x0,_0x13897f=events[_0x59fc('0x5')];_0x3bde0b<_0x13897f;_0x3bde0b++){var _0x55fa6d=events[_0x3bde0b];var _0xdd2bb9=createListener(_0x59fc('0x6')+_0x55fa6d,_0x4cb94d);ChatMessageEvents['on'](_0x55fa6d,_0xdd2bb9);}}; \ No newline at end of file +var _0x3248=['remove','update','removeListener','length','chatMessage:','./chatMessage.events','save'];(function(_0x1d4bdb,_0x58f77b){var _0x288bea=function(_0x4a1630){while(--_0x4a1630){_0x1d4bdb['push'](_0x1d4bdb['shift']());}};_0x288bea(++_0x58f77b);}(_0x3248,0x1b0));var _0x8324=function(_0x31c426,_0x39e11e){_0x31c426=_0x31c426-0x0;var _0x5811ad=_0x3248[_0x31c426];return _0x5811ad;};'use strict';var ChatMessageEvents=require(_0x8324('0x0'));var events=[_0x8324('0x1'),_0x8324('0x2'),_0x8324('0x3')];function createListener(_0x9b580,_0x23b671){return function(_0x3ab598){_0x23b671['emit'](_0x9b580,_0x3ab598);};}function removeListener(_0x4c565b,_0x2e46f3){return function(){ChatMessageEvents[_0x8324('0x4')](_0x4c565b,_0x2e46f3);};}exports['register']=function(_0x18edd2){for(var _0x283f5f=0x0,_0x446423=events[_0x8324('0x5')];_0x283f5f<_0x446423;_0x283f5f++){var _0x215c15=events[_0x283f5f];var _0x5d5f01=createListener(_0x8324('0x6')+_0x215c15,_0x18edd2);ChatMessageEvents['on'](_0x215c15,_0x5d5f01);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 956ac7c..a9c8da3 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 _0xe35a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','describe','get','/:id','show','post','tracked','chatmessage:create','put','update','/:id/reject','reject','exports','multer','util','path'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xe35a,0x16d));var _0xae35=function(_0x28f0a8,_0x2cfd26){_0x28f0a8=_0x28f0a8-0x0;var _0x33db97=_0xe35a[_0x28f0a8];return _0x33db97;};'use strict';var multer=require(_0xae35('0x0'));var util=require(_0xae35('0x1'));var path=require(_0xae35('0x2'));var timeout=require(_0xae35('0x3'));var express=require('express');var router=express[_0xae35('0x4')]();var fs_extra=require(_0xae35('0x5'));var auth=require(_0xae35('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae35('0x7'));var controller=require(_0xae35('0x8'));router['get']('/',auth[_0xae35('0x9')](),controller[_0xae35('0xa')]);router['get']('/describe',auth[_0xae35('0x9')](),controller[_0xae35('0xb')]);router[_0xae35('0xc')](_0xae35('0xd'),auth[_0xae35('0x9')](),controller[_0xae35('0xe')]);router[_0xae35('0xf')]('/',auth[_0xae35('0x9')](),interaction[_0xae35('0x10')]('chat',_0xae35('0x11')),controller['create']);router[_0xae35('0x12')](_0xae35('0xd'),controller[_0xae35('0x13')]);router[_0xae35('0x12')]('/:id/accept',auth[_0xae35('0x9')](),controller['accept']);router[_0xae35('0x12')](_0xae35('0x14'),auth[_0xae35('0x9')](),controller[_0xae35('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xae35('0x16')]=router; \ No newline at end of file +var _0x51ca=['chat','create','put','update','/:id/reject','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked'];(function(_0x43bb6e,_0x2209d8){var _0x4361b5=function(_0x2d8d65){while(--_0x2d8d65){_0x43bb6e['push'](_0x43bb6e['shift']());}};_0x4361b5(++_0x2209d8);}(_0x51ca,0x187));var _0xa51c=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x51ca[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0xa51c('0x0'));var util=require('util');var path=require(_0xa51c('0x1'));var timeout=require(_0xa51c('0x2'));var express=require('express');var router=express[_0xa51c('0x3')]();var fs_extra=require(_0xa51c('0x4'));var auth=require(_0xa51c('0x5'));var interaction=require(_0xa51c('0x6'));var config=require(_0xa51c('0x7'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0xa51c('0x8')](),controller[_0xa51c('0x9')]);router[_0xa51c('0xa')](_0xa51c('0xb'),auth[_0xa51c('0x8')](),controller[_0xa51c('0xc')]);router[_0xa51c('0xa')](_0xa51c('0xd'),auth[_0xa51c('0x8')](),controller[_0xa51c('0xe')]);router[_0xa51c('0xf')]('/',auth['isAuthenticated'](),interaction[_0xa51c('0x10')](_0xa51c('0x11'),'chatmessage:create'),controller[_0xa51c('0x12')]);router[_0xa51c('0x13')](_0xa51c('0xd'),controller[_0xa51c('0x14')]);router[_0xa51c('0x13')]('/:id/accept',auth[_0xa51c('0x8')](),controller['accept']);router[_0xa51c('0x13')](_0xa51c('0x15'),auth[_0xa51c('0x8')](),controller['reject']);router[_0xa51c('0x16')](_0xa51c('0xd'),auth['isAuthenticated'](),controller[_0xa51c('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 528e454..94f5527 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(_0x5758a9,_0x9b8d6a){var _0x124453=function(_0x34b011){while(--_0x34b011){_0x5758a9['push'](_0x5758a9['shift']());}};_0x124453(++_0x9b8d6a);}(_0xadb5,0xad));var _0x5adb=function(_0x1a3b2c,_0x700a46){_0x1a3b2c=_0x1a3b2c-0x0;var _0x2d17d1=_0xadb5[_0x1a3b2c];return _0x2d17d1;};'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(_0x918247,_0x2e9efd){var _0xffe665=function(_0x60605c){while(--_0x60605c){_0x918247['push'](_0x918247['shift']());}};_0xffe665(++_0x2e9efd);}(_0xb10b,0x12a));var _0xbb10=function(_0x2da563,_0x52eb28){_0x2da563=_0x2da563-0x0;var _0x518093=_0xb10b[_0x2da563];return _0x518093;};'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 9f3ce5d..c6ac985 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(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7a54,0x106));var _0x47a5=function(_0x210a22,_0x49b215){_0x210a22=_0x210a22-0x0;var _0x10ca4d=_0x7a54[_0x210a22];return _0x10ca4d;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2e0c00,_0x31c1c2){var _0x557430=function(_0x41b916){while(--_0x41b916){_0x2e0c00['push'](_0x2e0c00['shift']());}};_0x557430(++_0x31c1c2);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 100c2ff..7497ec4 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 _0x0186=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x179a0c,_0x2ca073){var _0x1c8b9a=function(_0xfa6124){while(--_0xfa6124){_0x179a0c['push'](_0x179a0c['shift']());}};_0x1c8b9a(++_0x2ca073);}(_0x0186,0x1f1));var _0x6018=function(_0x26b60a,_0x367a36){_0x26b60a=_0x26b60a-0x0;var _0x197815=_0x0186[_0x26b60a];return _0x197815;};'use strict';var EventEmitter=require(_0x6018('0x0'));var ChatOfflineMessage=require(_0x6018('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x6018('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6018('0x3'),'afterDestroy':_0x6018('0x4')};function emitEvent(_0x48df36){return function(_0x1e93cc,_0x4cdde3,_0x56b6eb){ChatOfflineMessageEvents[_0x6018('0x5')](_0x48df36+':'+_0x1e93cc['id'],_0x1e93cc);ChatOfflineMessageEvents[_0x6018('0x5')](_0x48df36,_0x1e93cc);_0x56b6eb(null);};}for(var e in events){if(events[_0x6018('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x6018('0x7')](e,emitEvent(event));}}module[_0x6018('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xa40b=['update','emit','hook','events','setMaxListeners','save'];(function(_0x165fa0,_0x3a25a9){var _0x5d58bb=function(_0x2dfaee){while(--_0x2dfaee){_0x165fa0['push'](_0x165fa0['shift']());}};_0x5d58bb(++_0x3a25a9);}(_0xa40b,0x147));var _0xba40=function(_0x485bc0,_0x35d9e7){_0x485bc0=_0x485bc0-0x0;var _0x4c2650=_0xa40b[_0x485bc0];return _0x4c2650;};'use strict';var EventEmitter=require(_0xba40('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xba40('0x1')](0x0);var events={'afterCreate':_0xba40('0x2'),'afterUpdate':_0xba40('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2ac0a3){return function(_0x324210,_0x2a5430,_0x424c05){ChatOfflineMessageEvents['emit'](_0x2ac0a3+':'+_0x324210['id'],_0x324210);ChatOfflineMessageEvents[_0xba40('0x4')](_0x2ac0a3,_0x324210);_0x424c05(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xba40('0x5')](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 fad775f..5fda508 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 _0xf83a=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x186ef9,_0x52607e){var _0x2aabf7=function(_0x53b782){while(--_0x53b782){_0x186ef9['push'](_0x186ef9['shift']());}};_0x2aabf7(++_0x52607e);}(_0xf83a,0x1d5));var _0xaf83=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0xf83a[_0x1fdb40];return _0x281f93;};'use strict';var attributes=require(_0xaf83('0x0'));module[_0xaf83('0x1')]=function(_0x4069ed){return _0x4069ed[_0xaf83('0x2')](_0xaf83('0x3'),attributes,{'tableName':_0xaf83('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaf83('0x5'),'collate':_0xaf83('0x6')});}; \ No newline at end of file +var _0x48e2=['ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define'];(function(_0x13ef6e,_0x231831){var _0x2d0ea2=function(_0x3db6bb){while(--_0x3db6bb){_0x13ef6e['push'](_0x13ef6e['shift']());}};_0x2d0ea2(++_0x231831);}(_0x48e2,0xdb));var _0x248e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x48e2[_0x432682];return _0x463d05;};'use strict';var attributes=require(_0x248e('0x0'));module[_0x248e('0x1')]=function(_0x19f374){return _0x19f374[_0x248e('0x2')](_0x248e('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x248e('0x4'),'collate':_0x248e('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 9be4d74..e16c641 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 _0xb7b6=['then','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0xac9730,_0xc2ae15){var _0x5378a4=function(_0x602edd){while(--_0x602edd){_0xac9730['push'](_0xac9730['shift']());}};_0x5378a4(++_0xc2ae15);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x844c1b,_0x28bd7f){_0x844c1b=_0x844c1b-0x0;var _0x11ad15=_0xb7b6[_0x844c1b];return _0x11ad15;};'use strict';var _=require(_0x6b7b('0x0'));var util=require(_0x6b7b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b7b('0x2'));var fs=require('fs');var Redis=require(_0x6b7b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b7b('0x4'));var logger=require(_0x6b7b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6b7b('0x6'));var client=jayson[_0x6b7b('0x7')][_0x6b7b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xff519e,_0x24359f,_0x483b9c){return new BPromise(function(_0x49a6c8,_0x2bb86d){return client[_0x6b7b('0x9')](_0xff519e,_0x483b9c)[_0x6b7b('0xa')](function(_0x115f2d){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x24359f,'request\x20sent');logger[_0x6b7b('0xb')](_0x6b7b('0xc'),_0x24359f,_0x6b7b('0xd'),JSON[_0x6b7b('0xe')](_0x115f2d));if(_0x115f2d[_0x6b7b('0xf')]){if(_0x115f2d[_0x6b7b('0xf')]['code']===0x1f4){logger[_0x6b7b('0xf')](_0x6b7b('0x10'),_0x24359f,_0x115f2d['error'][_0x6b7b('0x11')]);return _0x2bb86d(_0x115f2d[_0x6b7b('0xf')]['message']);}logger[_0x6b7b('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x24359f,_0x115f2d[_0x6b7b('0xf')][_0x6b7b('0x11')]);return _0x49a6c8(_0x115f2d[_0x6b7b('0xf')]['message']);}else{logger['info'](_0x6b7b('0x10'),_0x24359f,'request\x20sent');_0x49a6c8(_0x115f2d['result'][_0x6b7b('0x11')]);}})[_0x6b7b('0x12')](function(_0x4ef35b){logger[_0x6b7b('0xf')](_0x6b7b('0x10'),_0x24359f,_0x4ef35b);_0x2bb86d(_0x4ef35b);});});} \ No newline at end of file +var _0xc903=['message','lodash','moment','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x1801c0,_0x597579){var _0x215e70=function(_0x3c7ed9){while(--_0x3c7ed9){_0x1801c0['push'](_0x1801c0['shift']());}};_0x215e70(++_0x597579);}(_0xc903,0x177));var _0x3c90=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0xc903[_0x52e0ee];return _0x32534c;};'use strict';var _=require(_0x3c90('0x0'));var util=require('util');var moment=require(_0x3c90('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c90('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c90('0x3'));var logger=require('../../config/logger')(_0x3c90('0x4'));var config=require(_0x3c90('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3c90('0x6')][_0x3c90('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x37f629,_0xa77b0,_0x15c161){return new BPromise(function(_0x256f5f,_0x33c590){return client[_0x3c90('0x8')](_0x37f629,_0x15c161)[_0x3c90('0x9')](function(_0x10f518){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0xa77b0,'request\x20sent');logger['debug'](_0x3c90('0xa'),_0xa77b0,_0x3c90('0xb'),JSON[_0x3c90('0xc')](_0x10f518));if(_0x10f518[_0x3c90('0xd')]){if(_0x10f518['error'][_0x3c90('0xe')]===0x1f4){logger[_0x3c90('0xd')](_0x3c90('0xf'),_0xa77b0,_0x10f518[_0x3c90('0xd')][_0x3c90('0x10')]);return _0x33c590(_0x10f518[_0x3c90('0xd')][_0x3c90('0x10')]);}logger[_0x3c90('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0xa77b0,_0x10f518[_0x3c90('0xd')][_0x3c90('0x10')]);return _0x256f5f(_0x10f518[_0x3c90('0xd')][_0x3c90('0x10')]);}else{logger['info'](_0x3c90('0xf'),_0xa77b0,'request\x20sent');_0x256f5f(_0x10f518['result']['message']);}})['catch'](function(_0x20328d){logger[_0x3c90('0xd')](_0x3c90('0xf'),_0xa77b0,_0x20328d);_0x33c590(_0x20328d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 24436c2..8ec7b1b 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 _0xc199=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x4a73dd,_0x58e46c){var _0x279e6b=function(_0x25254b){while(--_0x25254b){_0x4a73dd['push'](_0x4a73dd['shift']());}};_0x279e6b(++_0x58e46c);}(_0xc199,0x172));var _0x9c19=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xc199[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x9c19('0x0'));var util=require('util');var path=require(_0x9c19('0x1'));var timeout=require(_0x9c19('0x2'));var express=require(_0x9c19('0x3'));var router=express[_0x9c19('0x4')]();var fs_extra=require(_0x9c19('0x5'));var auth=require(_0x9c19('0x6'));var interaction=require(_0x9c19('0x7'));var config=require(_0x9c19('0x8'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0x9c19('0x9')](),controller[_0x9c19('0xa')]);router[_0x9c19('0xb')](_0x9c19('0xc'),auth[_0x9c19('0x9')](),controller[_0x9c19('0xd')]);router[_0x9c19('0xb')]('/:id',auth[_0x9c19('0x9')](),controller[_0x9c19('0xe')]);router[_0x9c19('0xf')]('/',auth[_0x9c19('0x9')](),controller[_0x9c19('0x10')]);router[_0x9c19('0x11')](_0x9c19('0x12'),auth['isAuthenticated'](),controller[_0x9c19('0x13')]);router[_0x9c19('0x14')](_0x9c19('0x12'),auth['isAuthenticated'](),controller[_0x9c19('0x15')]);module[_0x9c19('0x16')]=router; \ No newline at end of file +var _0x74a4=['get','/describe','describe','/:id','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','index'];(function(_0x2266ee,_0x1c3ce2){var _0x27065f=function(_0x2154da){while(--_0x2154da){_0x2266ee['push'](_0x2266ee['shift']());}};_0x27065f(++_0x1c3ce2);}(_0x74a4,0x172));var _0x474a=function(_0x3acb19,_0x108d2d){_0x3acb19=_0x3acb19-0x0;var _0x5ef900=_0x74a4[_0x3acb19];return _0x5ef900;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x474a('0x0'));var timeout=require(_0x474a('0x1'));var express=require(_0x474a('0x2'));var router=express[_0x474a('0x3')]();var fs_extra=require(_0x474a('0x4'));var auth=require(_0x474a('0x5'));var interaction=require(_0x474a('0x6'));var config=require('../../config/environment');var controller=require(_0x474a('0x7'));router['get']('/',auth[_0x474a('0x8')](),controller[_0x474a('0x9')]);router[_0x474a('0xa')](_0x474a('0xb'),auth[_0x474a('0x8')](),controller[_0x474a('0xc')]);router[_0x474a('0xa')](_0x474a('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x474a('0x8')](),controller[_0x474a('0xe')]);router[_0x474a('0xf')](_0x474a('0xd'),auth[_0x474a('0x8')](),controller[_0x474a('0x10')]);router[_0x474a('0x11')](_0x474a('0xd'),auth[_0x474a('0x8')](),controller['destroy']);module[_0x474a('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 671b0db..233dc01 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 _0x4da7=['mouseOver'];(function(_0x3c6207,_0x3c9b77){var _0x3ea118=function(_0x232fcf){while(--_0x232fcf){_0x3c6207['push'](_0x3c6207['shift']());}};_0x3ea118(++_0x3c9b77);}(_0x4da7,0xec));var _0x74da=function(_0x2c6659,_0x562ebd){_0x2c6659=_0x2c6659-0x0;var _0x3c5675=_0x4da7[_0x2c6659];return _0x3c5675;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver','timeout'),'defaultValue':_0x74da('0x0')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x90c0=['mouseOver','timeout','INTEGER','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x90c0,0x16b));var _0x090c=function(_0x1058db,_0x7e3063){_0x1058db=_0x1058db-0x0;var _0x195b98=_0x90c0[_0x1058db];return _0x195b98;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x090c('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x090c('0x1'),_0x090c('0x2')),'defaultValue':_0x090c('0x1')},'selector':{'type':Sequelize[_0x090c('0x0')]},'timeout':{'type':Sequelize[_0x090c('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 846a2e5..72d7cb0 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 _0x2427=['sendStatus','error','name','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','model','fields','attributes','length','include','options','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','offset','limit','undefined','set','apply','reject','save','update','destroy','then'];(function(_0x1be3f6,_0x31704a){var _0x50336a=function(_0x285e56){while(--_0x285e56){_0x1be3f6['push'](_0x1be3f6['shift']());}};_0x50336a(++_0x31704a);}(_0x2427,0x165));var _0x7242=function(_0x4828b8,_0xaf9d1e){_0x4828b8=_0x4828b8-0x0;var _0x3cbb3f=_0x2427[_0x4828b8];return _0x3cbb3f;};'use strict';var emlformat=require(_0x7242('0x0'));var rimraf=require(_0x7242('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7242('0x2'));var rp=require('request-promise');var moment=require(_0x7242('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7242('0x4'));var util=require(_0x7242('0x5'));var path=require(_0x7242('0x6'));var sox=require('sox');var csv=require(_0x7242('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7242('0x8'));var _=require(_0x7242('0x9'));var squel=require(_0x7242('0xa'));var crypto=require(_0x7242('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7242('0xc'));var toCsv=require(_0x7242('0x7'));var querystring=require('querystring');var Papa=require(_0x7242('0xd'));var Redis=require(_0x7242('0xe'));var authService=require(_0x7242('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7242('0x10'));var hardwareService=require(_0x7242('0x11'));var logger=require(_0x7242('0x12'))(_0x7242('0x13'));var utils=require('../../config/utils');var config=require(_0x7242('0x14'));var licenseUtil=require(_0x7242('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2efc1e,_0x406138){_0x406138=_0x406138||0xcc;return function(_0x438ff5){if(_0x438ff5){return _0x2efc1e['sendStatus'](_0x406138);}return _0x2efc1e['status'](_0x406138)[_0x7242('0x16')]();};}function respondWithResult(_0x4e8042,_0x22af73){_0x22af73=_0x22af73||0xc8;return function(_0x375ca6){if(_0x375ca6){return _0x4e8042[_0x7242('0x17')](_0x22af73)[_0x7242('0x18')](_0x375ca6);}};}function respondWithFilteredResult(_0x461f20,_0x13e8c9){return function(_0x3ef574){if(_0x3ef574){var _0x4db26b=typeof _0x13e8c9[_0x7242('0x19')]==='undefined'&&typeof _0x13e8c9[_0x7242('0x1a')]===_0x7242('0x1b');var _0x4828a0=_0x3ef574['count'];var _0x58ccfc=_0x4db26b?0x0:_0x13e8c9[_0x7242('0x19')];var _0xf7f7f9=_0x4db26b?_0x3ef574['count']:_0x13e8c9['offset']+_0x13e8c9['limit'];var _0x1214c4;if(_0xf7f7f9>=_0x4828a0){_0xf7f7f9=_0x4828a0;_0x1214c4=0xc8;}else{_0x1214c4=0xce;}_0x461f20['status'](_0x1214c4);return _0x461f20[_0x7242('0x1c')]('Content-Range',_0x58ccfc+'-'+_0xf7f7f9+'/'+_0x4828a0)[_0x7242('0x18')](_0x3ef574);}return null;};}function patchUpdates(_0x32f42b){return function(_0xb3a27f){try{jsonpatch[_0x7242('0x1d')](_0xb3a27f,_0x32f42b,!![]);}catch(_0xd68b73){return BPromise[_0x7242('0x1e')](_0xd68b73);}return _0xb3a27f[_0x7242('0x1f')]();};}function saveUpdates(_0x4bf6a6,_0x2fd572){return function(_0x36fc79){if(_0x36fc79){return _0x36fc79[_0x7242('0x20')](_0x4bf6a6)['then'](function(_0x32cef6){return _0x32cef6;});}return null;};}function removeEntity(_0x69b776,_0xee9c58){return function(_0x28ea5d){if(_0x28ea5d){return _0x28ea5d[_0x7242('0x21')]()[_0x7242('0x22')](function(){_0x69b776[_0x7242('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ce2b2,_0x42ad68){return function(_0x41e5a5){if(!_0x41e5a5){_0x4ce2b2[_0x7242('0x23')](0x194);}return _0x41e5a5;};}function handleError(_0x2b2c95,_0x111bf6){_0x111bf6=_0x111bf6||0x1f4;return function(_0x241ec1){logger[_0x7242('0x24')](_0x241ec1['stack']);if(_0x241ec1[_0x7242('0x25')]){delete _0x241ec1[_0x7242('0x25')];}_0x2b2c95[_0x7242('0x17')](_0x111bf6)['send'](_0x241ec1);};}exports[_0x7242('0x26')]=function(_0x37b063,_0x1c59d0){var _0x32ccf2={'raw':!![],'where':{'id':_0x37b063[_0x7242('0x27')]['id']}},_0x140a72={};_0x140a72['model']=_[_0x7242('0x28')](db[_0x7242('0x29')][_0x7242('0x2a')]);_0x140a72[_0x7242('0x2b')]=_['keys'](_0x37b063[_0x7242('0x2b')]);_0x140a72[_0x7242('0x2c')]=_[_0x7242('0x2d')](_0x140a72[_0x7242('0x2e')],_0x140a72[_0x7242('0x2b')]);_0x32ccf2['attributes']=_[_0x7242('0x2d')](_0x140a72[_0x7242('0x2e')],qs['fields'](_0x37b063[_0x7242('0x2b')][_0x7242('0x2f')]));_0x32ccf2[_0x7242('0x30')]=_0x32ccf2['attributes'][_0x7242('0x31')]?_0x32ccf2['attributes']:_0x140a72['model'];if(_0x37b063[_0x7242('0x2b')]['includeAll']){_0x32ccf2[_0x7242('0x32')]=[{'all':!![]}];}_0x32ccf2=_['merge']({},_0x32ccf2,_0x37b063[_0x7242('0x33')]);return db[_0x7242('0x29')][_0x7242('0x34')](_0x32ccf2)['then'](handleEntityNotFound(_0x1c59d0,null))['then'](respondWithResult(_0x1c59d0,null))[_0x7242('0x35')](handleError(_0x1c59d0,null));};exports[_0x7242('0x36')]=function(_0x33eead,_0x164a6a){return db[_0x7242('0x29')][_0x7242('0x36')](_0x33eead['body'],{})[_0x7242('0x22')](respondWithResult(_0x164a6a,0xc9))['catch'](handleError(_0x164a6a,null));};exports[_0x7242('0x20')]=function(_0x2cc7f8,_0x2645eb){if(_0x2cc7f8[_0x7242('0x37')]['id']){delete _0x2cc7f8[_0x7242('0x37')]['id'];}return db['ChatProactiveAction'][_0x7242('0x34')]({'where':{'id':_0x2cc7f8[_0x7242('0x27')]['id']}})[_0x7242('0x22')](handleEntityNotFound(_0x2645eb,null))[_0x7242('0x22')](saveUpdates(_0x2cc7f8[_0x7242('0x37')],null))[_0x7242('0x22')](respondWithResult(_0x2645eb,null))[_0x7242('0x35')](handleError(_0x2645eb,null));};exports[_0x7242('0x21')]=function(_0xf409f7,_0x54bb65){return db[_0x7242('0x29')][_0x7242('0x34')]({'where':{'id':_0xf409f7[_0x7242('0x27')]['id']}})[_0x7242('0x22')](handleEntityNotFound(_0x54bb65,null))['then'](removeEntity(_0x54bb65,null))['catch'](handleError(_0x54bb65,null));}; \ No newline at end of file +var _0x39d9=['ChatProactiveAction','find','create','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','then','destroy','error','name','send','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','include'];(function(_0x338829,_0x5d0144){var _0xe84fdd=function(_0x1e8875){while(--_0x1e8875){_0x338829['push'](_0x338829['shift']());}};_0xe84fdd(++_0x5d0144);}(_0x39d9,0x17f));var _0x939d=function(_0x67143c,_0x433024){_0x67143c=_0x67143c-0x0;var _0x1dbbc3=_0x39d9[_0x67143c];return _0x1dbbc3;};'use strict';var emlformat=require(_0x939d('0x0'));var rimraf=require(_0x939d('0x1'));var zipdir=require(_0x939d('0x2'));var jsonpatch=require(_0x939d('0x3'));var rp=require(_0x939d('0x4'));var moment=require(_0x939d('0x5'));var BPromise=require(_0x939d('0x6'));var Mustache=require(_0x939d('0x7'));var util=require('util');var path=require(_0x939d('0x8'));var sox=require(_0x939d('0x9'));var csv=require(_0x939d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x939d('0xb'));var _=require('lodash');var squel=require(_0x939d('0xc'));var crypto=require(_0x939d('0xd'));var jsforce=require(_0x939d('0xe'));var deskjs=require(_0x939d('0xf'));var toCsv=require(_0x939d('0xa'));var querystring=require(_0x939d('0x10'));var Papa=require(_0x939d('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x939d('0x12'));var as=require(_0x939d('0x13'));var hardwareService=require(_0x939d('0x14'));var logger=require(_0x939d('0x15'))(_0x939d('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x939d('0x17'))['db'];function respondWithStatusCode(_0x3078d6,_0x13993e){_0x13993e=_0x13993e||0xcc;return function(_0x51f46d){if(_0x51f46d){return _0x3078d6[_0x939d('0x18')](_0x13993e);}return _0x3078d6[_0x939d('0x19')](_0x13993e)[_0x939d('0x1a')]();};}function respondWithResult(_0x209385,_0x2c73e7){_0x2c73e7=_0x2c73e7||0xc8;return function(_0x2406aa){if(_0x2406aa){return _0x209385[_0x939d('0x19')](_0x2c73e7)[_0x939d('0x1b')](_0x2406aa);}};}function respondWithFilteredResult(_0x1b9d52,_0x4bd0ab){return function(_0x5539a7){if(_0x5539a7){var _0x40e252=typeof _0x4bd0ab['offset']===_0x939d('0x1c')&&typeof _0x4bd0ab[_0x939d('0x1d')]==='undefined';var _0x6bea18=_0x5539a7[_0x939d('0x1e')];var _0xbed71e=_0x40e252?0x0:_0x4bd0ab['offset'];var _0x42212f=_0x40e252?_0x5539a7[_0x939d('0x1e')]:_0x4bd0ab[_0x939d('0x1f')]+_0x4bd0ab[_0x939d('0x1d')];var _0x1e848d;if(_0x42212f>=_0x6bea18){_0x42212f=_0x6bea18;_0x1e848d=0xc8;}else{_0x1e848d=0xce;}_0x1b9d52[_0x939d('0x19')](_0x1e848d);return _0x1b9d52['set']('Content-Range',_0xbed71e+'-'+_0x42212f+'/'+_0x6bea18)[_0x939d('0x1b')](_0x5539a7);}return null;};}function patchUpdates(_0x586626){return function(_0x1034ad){try{jsonpatch[_0x939d('0x20')](_0x1034ad,_0x586626,!![]);}catch(_0x27ea6e){return BPromise['reject'](_0x27ea6e);}return _0x1034ad['save']();};}function saveUpdates(_0x1cecf8,_0x555026){return function(_0x5483e0){if(_0x5483e0){return _0x5483e0['update'](_0x1cecf8)[_0x939d('0x21')](function(_0x28d92e){return _0x28d92e;});}return null;};}function removeEntity(_0x682d38,_0x2532f2){return function(_0x5bb207){if(_0x5bb207){return _0x5bb207[_0x939d('0x22')]()[_0x939d('0x21')](function(){_0x682d38['status'](0xcc)[_0x939d('0x1a')]();});}};}function handleEntityNotFound(_0x59c200,_0x5a00ef){return function(_0x2bc482){if(!_0x2bc482){_0x59c200[_0x939d('0x18')](0x194);}return _0x2bc482;};}function handleError(_0x448364,_0x30f643){_0x30f643=_0x30f643||0x1f4;return function(_0x4ab0e6){logger[_0x939d('0x23')](_0x4ab0e6['stack']);if(_0x4ab0e6[_0x939d('0x24')]){delete _0x4ab0e6[_0x939d('0x24')];}_0x448364[_0x939d('0x19')](_0x30f643)[_0x939d('0x25')](_0x4ab0e6);};}exports[_0x939d('0x26')]=function(_0x31a8bb,_0x584696){var _0x150543={'raw':!![],'where':{'id':_0x31a8bb[_0x939d('0x27')]['id']}},_0x203f07={};_0x203f07[_0x939d('0x28')]=_[_0x939d('0x29')](db['ChatProactiveAction']['rawAttributes']);_0x203f07[_0x939d('0x2a')]=_[_0x939d('0x29')](_0x31a8bb[_0x939d('0x2a')]);_0x203f07[_0x939d('0x2b')]=_[_0x939d('0x2c')](_0x203f07[_0x939d('0x28')],_0x203f07['query']);_0x150543[_0x939d('0x2d')]=_['intersection'](_0x203f07[_0x939d('0x28')],qs[_0x939d('0x2e')](_0x31a8bb['query']['fields']));_0x150543[_0x939d('0x2d')]=_0x150543['attributes']['length']?_0x150543[_0x939d('0x2d')]:_0x203f07[_0x939d('0x28')];if(_0x31a8bb[_0x939d('0x2a')][_0x939d('0x2f')]){_0x150543[_0x939d('0x30')]=[{'all':!![]}];}_0x150543=_['merge']({},_0x150543,_0x31a8bb['options']);return db[_0x939d('0x31')][_0x939d('0x32')](_0x150543)[_0x939d('0x21')](handleEntityNotFound(_0x584696,null))['then'](respondWithResult(_0x584696,null))['catch'](handleError(_0x584696,null));};exports[_0x939d('0x33')]=function(_0x49ba6b,_0xdfcefe){return db[_0x939d('0x31')][_0x939d('0x33')](_0x49ba6b['body'],{})[_0x939d('0x21')](respondWithResult(_0xdfcefe,0xc9))[_0x939d('0x34')](handleError(_0xdfcefe,null));};exports[_0x939d('0x35')]=function(_0x5b1ad2,_0x3b81a4){if(_0x5b1ad2['body']['id']){delete _0x5b1ad2['body']['id'];}return db[_0x939d('0x31')][_0x939d('0x32')]({'where':{'id':_0x5b1ad2[_0x939d('0x27')]['id']}})[_0x939d('0x21')](handleEntityNotFound(_0x3b81a4,null))[_0x939d('0x21')](saveUpdates(_0x5b1ad2['body'],null))[_0x939d('0x21')](respondWithResult(_0x3b81a4,null))['catch'](handleError(_0x3b81a4,null));};exports[_0x939d('0x22')]=function(_0x5553b0,_0x46c153){return db[_0x939d('0x31')][_0x939d('0x32')]({'where':{'id':_0x5553b0[_0x939d('0x27')]['id']}})[_0x939d('0x21')](handleEntityNotFound(_0x46c153,null))[_0x939d('0x21')](removeEntity(_0x46c153,null))[_0x939d('0x34')](handleError(_0x46c153,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2fe78b7..ca0d6ef 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 _0x744d=['ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x22cc9b,_0x4db415){var _0x51aa40=function(_0xa18962){while(--_0xa18962){_0x22cc9b['push'](_0x22cc9b['shift']());}};_0x51aa40(++_0x4db415);}(_0x744d,0x154));var _0xd744=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x744d[_0x3430aa];return _0x2ac5c;};'use strict';var _=require(_0xd744('0x0'));var util=require(_0xd744('0x1'));var logger=require(_0xd744('0x2'))('api');var moment=require(_0xd744('0x3'));var BPromise=require(_0xd744('0x4'));var rp=require(_0xd744('0x5'));var fs=require('fs');var path=require(_0xd744('0x6'));var rimraf=require(_0xd744('0x7'));var config=require(_0xd744('0x8'));var attributes=require(_0xd744('0x9'));module[_0xd744('0xa')]=function(_0x55c4c0,_0x2de0db){return _0x55c4c0['define'](_0xd744('0xb'),attributes,{'tableName':_0xd744('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x784e=['./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0x784e,0x95));var _0xe784=function(_0x400933,_0x30b97d){_0x400933=_0x400933-0x0;var _0x193156=_0x784e[_0x400933];return _0x193156;};'use strict';var _=require('lodash');var util=require(_0xe784('0x0'));var logger=require(_0xe784('0x1'))(_0xe784('0x2'));var moment=require(_0xe784('0x3'));var BPromise=require(_0xe784('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe784('0x5'));var rimraf=require(_0xe784('0x6'));var config=require('../../config/environment');var attributes=require(_0xe784('0x7'));module[_0xe784('0x8')]=function(_0x38558,_0x3ce2f4){return _0x38558[_0xe784('0x9')](_0xe784('0xa'),attributes,{'tableName':_0xe784('0xb'),'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 5658bde..2119e9c 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 _0x2e43=['request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x2e43,0x182));var _0x32e4=function(_0x43a251,_0x2ca1b8){_0x43a251=_0x43a251-0x0;var _0x15f782=_0x2e43[_0x43a251];return _0x15f782;};'use strict';var _=require('lodash');var util=require(_0x32e4('0x0'));var moment=require(_0x32e4('0x1'));var BPromise=require(_0x32e4('0x2'));var rs=require(_0x32e4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32e4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x32e4('0x5'));var config=require(_0x32e4('0x6'));var jayson=require(_0x32e4('0x7'));var client=jayson[_0x32e4('0x8')][_0x32e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x231bc6,_0x257af,_0x3cccc3){return new BPromise(function(_0x2c71df,_0x498fe1){return client[_0x32e4('0xa')](_0x231bc6,_0x3cccc3)[_0x32e4('0xb')](function(_0x4b56db){logger[_0x32e4('0xc')](_0x32e4('0xd'),_0x257af,_0x32e4('0xe'));logger['debug'](_0x32e4('0xf'),_0x257af,_0x32e4('0xe'),JSON[_0x32e4('0x10')](_0x4b56db));if(_0x4b56db[_0x32e4('0x11')]){if(_0x4b56db[_0x32e4('0x11')][_0x32e4('0x12')]===0x1f4){logger[_0x32e4('0x11')](_0x32e4('0xd'),_0x257af,_0x4b56db['error'][_0x32e4('0x13')]);return _0x498fe1(_0x4b56db[_0x32e4('0x11')][_0x32e4('0x13')]);}logger[_0x32e4('0x11')](_0x32e4('0xd'),_0x257af,_0x4b56db[_0x32e4('0x11')][_0x32e4('0x13')]);return _0x2c71df(_0x4b56db[_0x32e4('0x11')][_0x32e4('0x13')]);}else{logger[_0x32e4('0xc')](_0x32e4('0xd'),_0x257af,_0x32e4('0xe'));_0x2c71df(_0x4b56db[_0x32e4('0x14')]['message']);}})[_0x32e4('0x15')](function(_0x597db0){logger[_0x32e4('0x11')](_0x32e4('0xd'),_0x257af,_0x597db0);_0x498fe1(_0x597db0);});});} \ No newline at end of file +var _0xcd4c=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x37efca,_0x1fe11b){var _0x1d683d=function(_0x17cd06){while(--_0x17cd06){_0x37efca['push'](_0x37efca['shift']());}};_0x1d683d(++_0x1fe11b);}(_0xcd4c,0x190));var _0xccd4=function(_0x1f81d2,_0x31f860){_0x1f81d2=_0x1f81d2-0x0;var _0x26df08=_0xcd4c[_0x1f81d2];return _0x26df08;};'use strict';var _=require(_0xccd4('0x0'));var util=require(_0xccd4('0x1'));var moment=require('moment');var BPromise=require(_0xccd4('0x2'));var rs=require(_0xccd4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccd4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xccd4('0x5'))(_0xccd4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xccd4('0x7')][_0xccd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b56db,_0xafd174,_0x2f14ec){return new BPromise(function(_0x3012cb,_0x5ba0b0){return client[_0xccd4('0x9')](_0x3b56db,_0x2f14ec)['then'](function(_0x1562df){logger[_0xccd4('0xa')](_0xccd4('0xb'),_0xafd174,'request\x20sent');logger[_0xccd4('0xc')](_0xccd4('0xd'),_0xafd174,_0xccd4('0xe'),JSON[_0xccd4('0xf')](_0x1562df));if(_0x1562df[_0xccd4('0x10')]){if(_0x1562df[_0xccd4('0x10')][_0xccd4('0x11')]===0x1f4){logger[_0xccd4('0x10')](_0xccd4('0xb'),_0xafd174,_0x1562df[_0xccd4('0x10')][_0xccd4('0x12')]);return _0x5ba0b0(_0x1562df[_0xccd4('0x10')][_0xccd4('0x12')]);}logger['error'](_0xccd4('0xb'),_0xafd174,_0x1562df[_0xccd4('0x10')]['message']);return _0x3012cb(_0x1562df[_0xccd4('0x10')][_0xccd4('0x12')]);}else{logger[_0xccd4('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0xafd174,'request\x20sent');_0x3012cb(_0x1562df[_0xccd4('0x13')][_0xccd4('0x12')]);}})[_0xccd4('0x14')](function(_0xf0a79a){logger[_0xccd4('0x10')](_0xccd4('0xb'),_0xafd174,_0xf0a79a);_0x5ba0b0(_0xf0a79a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index dba9a3f..3155855 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 _0x4819=['post','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x63c794,_0x14f52c){var _0x16f319=function(_0x149940){while(--_0x149940){_0x63c794['push'](_0x63c794['shift']());}};_0x16f319(++_0x14f52c);}(_0x4819,0xcd));var _0x9481=function(_0x47d1ae,_0x41e056){_0x47d1ae=_0x47d1ae-0x0;var _0x47328a=_0x4819[_0x47d1ae];return _0x47328a;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get'](_0x9481('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9481('0xb')]('/',auth[_0x9481('0xc')](),controller[_0x9481('0xd')]);router[_0x9481('0xe')](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['delete'](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);module[_0x9481('0x11')]=router; \ No newline at end of file +var _0x33c5=['fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','util','path','express','Router'];(function(_0x11e089,_0x30524){var _0x2e2d6e=function(_0x53514b){while(--_0x53514b){_0x11e089['push'](_0x11e089['shift']());}};_0x2e2d6e(++_0x30524);}(_0x33c5,0xe6));var _0x533c=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0x33c5[_0x3a9661];return _0x5bb119;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var fs_extra=require(_0x533c('0x4'));var auth=require(_0x533c('0x5'));var interaction=require(_0x533c('0x6'));var config=require('../../config/environment');var controller=require(_0x533c('0x7'));router[_0x533c('0x8')](_0x533c('0x9'),auth[_0x533c('0xa')](),controller[_0x533c('0xb')]);router[_0x533c('0xc')]('/',auth[_0x533c('0xa')](),controller[_0x533c('0xd')]);router[_0x533c('0xe')](_0x533c('0x9'),auth[_0x533c('0xa')](),controller[_0x533c('0xf')]);router[_0x533c('0x10')](_0x533c('0x9'),auth[_0x533c('0xa')](),controller[_0x533c('0x11')]);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 d5e585e..ec30209 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 _0xfa52=['sequelize','exports','name','STRING','rrmemory','beepall'];(function(_0x5527c5,_0x472828){var _0x3cf085=function(_0x4bbdb2){while(--_0x4bbdb2){_0x5527c5['push'](_0x5527c5['shift']());}};_0x3cf085(++_0x472828);}(_0xfa52,0x162));var _0x2fa5=function(_0x18bce2,_0x8fba74){_0x18bce2=_0x18bce2-0x0;var _0x10f149=_0xfa52[_0x18bce2];return _0x10f149;};'use strict';var Sequelize=require(_0x2fa5('0x0'));module[_0x2fa5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2fa5('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2fa5('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2fa5('0x4'),_0x2fa5('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x01ce=['sequelize','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x49dbfd,_0x46a238){var _0x2fa6ca=function(_0x53c22e){while(--_0x53c22e){_0x49dbfd['push'](_0x49dbfd['shift']());}};_0x2fa6ca(++_0x46a238);}(_0x01ce,0x126));var _0xe01c=function(_0x275234,_0x3db79a){_0x275234=_0x275234-0x0;var _0x2827d3=_0x01ce[_0x275234];return _0x2827d3;};'use strict';var Sequelize=require(_0xe01c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe01c('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe01c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe01c('0x3')](_0xe01c('0x4'),'beepall',_0xe01c('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 28b13a9..35d27aa 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 _0x6009=['ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','Team','getTeams','addTeams','ids','Agents','online','voicePause','sequelize','transaction','findOrCreate','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','SELECT','TeamId','includes','all','union','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/license/util','localhost','redis','./chatQueue.socket','register','client','http','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','update','get','UserProfileResource','destroy','name','send','map','ChatQueue','rawAttributes','type','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','merge','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','find','describe','getMembers','UserChatQueue','order','pick'];(function(_0x44784c,_0x4498c1){var _0x4bbfb1=function(_0x5d5ef7){while(--_0x5d5ef7){_0x44784c['push'](_0x44784c['shift']());}};_0x4bbfb1(++_0x4498c1);}(_0x6009,0xbf));var _0x9600=function(_0x26659f,_0x32f426){_0x26659f=_0x26659f-0x0;var _0x42667f=_0x6009[_0x26659f];return _0x42667f;};'use strict';var emlformat=require(_0x9600('0x0'));var rimraf=require(_0x9600('0x1'));var zipdir=require(_0x9600('0x2'));var jsonpatch=require(_0x9600('0x3'));var rp=require(_0x9600('0x4'));var moment=require('moment');var BPromise=require(_0x9600('0x5'));var Mustache=require(_0x9600('0x6'));var util=require(_0x9600('0x7'));var path=require(_0x9600('0x8'));var sox=require(_0x9600('0x9'));var csv=require(_0x9600('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9600('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9600('0xc'));var jsforce=require(_0x9600('0xd'));var deskjs=require(_0x9600('0xe'));var toCsv=require(_0x9600('0xa'));var querystring=require(_0x9600('0xf'));var Papa=require(_0x9600('0x10'));var Redis=require(_0x9600('0x11'));var authService=require(_0x9600('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9600('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9600('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x9600('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9600('0x16')]));require(_0x9600('0x17'))[_0x9600('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9600('0x19')][_0x9600('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x116891,_0x51784f,_0x5276bf,_0x210c24){return new BPromise(function(_0x36a9b,_0x24f9d1){var _0x199a94=_0x210c24||client;return _0x199a94['request'](_0x116891,_0x5276bf)[_0x9600('0x1b')](function(_0x3fbb40){logger[_0x9600('0x1c')]('ChatQueue,\x20%s,\x20%s',_0x51784f,'request\x20sent');logger[_0x9600('0x1d')](_0x9600('0x1e'),_0x51784f,_0x9600('0x1f'),JSON[_0x9600('0x20')](_0x3fbb40));if(_0x3fbb40[_0x9600('0x21')]){if(_0x3fbb40[_0x9600('0x21')][_0x9600('0x22')]===0x1f4){logger[_0x9600('0x21')](_0x9600('0x23'),_0x51784f,_0x3fbb40[_0x9600('0x21')][_0x9600('0x24')]);return _0x24f9d1(_0x3fbb40['error'][_0x9600('0x24')]);}logger['error'](_0x9600('0x23'),_0x51784f,_0x3fbb40[_0x9600('0x21')]['message']);return _0x36a9b(_0x3fbb40['error'][_0x9600('0x24')]);}else{logger['info'](_0x9600('0x23'),_0x51784f,'request\x20sent');_0x36a9b(_0x3fbb40['result'][_0x9600('0x24')]);}})['catch'](function(_0x390615){logger['error'](_0x9600('0x23'),_0x51784f,_0x390615);_0x24f9d1(_0x390615);});});}function respondWithStatusCode(_0x5abb4d,_0x34b88c){_0x34b88c=_0x34b88c||0xcc;return function(_0x238919){if(_0x238919){return _0x5abb4d[_0x9600('0x25')](_0x34b88c);}return _0x5abb4d[_0x9600('0x26')](_0x34b88c)[_0x9600('0x27')]();};}function respondWithResult(_0x467e14,_0x344a4a){_0x344a4a=_0x344a4a||0xc8;return function(_0x1f2f66){if(_0x1f2f66){return _0x467e14['status'](_0x344a4a)[_0x9600('0x28')](_0x1f2f66);}};}function respondWithFilteredResult(_0x698a75,_0x1df06f){return function(_0x212d5c){if(_0x212d5c){var _0x56e17f=typeof _0x1df06f[_0x9600('0x29')]===_0x9600('0x2a')&&typeof _0x1df06f[_0x9600('0x2b')]===_0x9600('0x2a');var _0x1a2c88=_0x212d5c['count'];var _0x4c5588=_0x56e17f?0x0:_0x1df06f['offset'];var _0x312079=_0x56e17f?_0x212d5c['count']:_0x1df06f['offset']+_0x1df06f[_0x9600('0x2b')];var _0x241219;if(_0x312079>=_0x1a2c88){_0x312079=_0x1a2c88;_0x241219=0xc8;}else{_0x241219=0xce;}_0x698a75['status'](_0x241219);return _0x698a75['set']('Content-Range',_0x4c5588+'-'+_0x312079+'/'+_0x1a2c88)[_0x9600('0x28')](_0x212d5c);}return null;};}function patchUpdates(_0x224721){return function(_0x4c357a){try{jsonpatch[_0x9600('0x2c')](_0x4c357a,_0x224721,!![]);}catch(_0x2bd6e3){return BPromise[_0x9600('0x2d')](_0x2bd6e3);}return _0x4c357a[_0x9600('0x2e')]();};}function saveUpdates(_0x1e7878,_0x195e99){return function(_0x287a97){if(_0x287a97){return _0x287a97[_0x9600('0x2f')](_0x1e7878)[_0x9600('0x1b')](function(_0x2c744b){return _0x2c744b;});}return null;};}function removeEntity(_0x48fe00,_0x2d25ce){return function(_0x37f2b9){if(_0x37f2b9){return _0x37f2b9['destroy']()[_0x9600('0x1b')](function(){var _0x3cc91a=_0x37f2b9[_0x9600('0x30')]({'plain':!![]});var _0x34b389='ChatQueues';return db[_0x9600('0x31')][_0x9600('0x32')]({'where':{'type':_0x34b389,'resourceId':_0x3cc91a['id']}})['then'](function(){return _0x37f2b9;});})[_0x9600('0x1b')](function(){_0x48fe00[_0x9600('0x26')](0xcc)[_0x9600('0x27')]();});}};}function handleEntityNotFound(_0x8e711f,_0x24ed8e){return function(_0x10dd06){if(!_0x10dd06){_0x8e711f['sendStatus'](0x194);}return _0x10dd06;};}function handleError(_0xc366eb,_0x3d9926){_0x3d9926=_0x3d9926||0x1f4;return function(_0x912fd8){logger[_0x9600('0x21')](_0x912fd8['stack']);if(_0x912fd8[_0x9600('0x33')]){delete _0x912fd8[_0x9600('0x33')];}_0xc366eb['status'](_0x3d9926)[_0x9600('0x34')](_0x912fd8);};}exports['index']=function(_0x27ac3c,_0x3f68e0){var _0x2a907b={},_0x369e18={},_0x5f33f4={'count':0x0,'rows':[]};var _0x2fb936=_[_0x9600('0x35')](db[_0x9600('0x36')][_0x9600('0x37')],function(_0x3d9238){return{'name':_0x3d9238['fieldName'],'type':_0x3d9238[_0x9600('0x38')]['key']};});_0x369e18['model']=_[_0x9600('0x35')](_0x2fb936,_0x9600('0x33'));_0x369e18['query']=_[_0x9600('0x39')](_0x27ac3c[_0x9600('0x3a')]);_0x369e18['filters']=_[_0x9600('0x3b')](_0x369e18[_0x9600('0x3c')],_0x369e18[_0x9600('0x3a')]);_0x2a907b[_0x9600('0x3d')]=_['intersection'](_0x369e18[_0x9600('0x3c')],qs['fields'](_0x27ac3c[_0x9600('0x3a')][_0x9600('0x3e')]));_0x2a907b[_0x9600('0x3d')]=_0x2a907b['attributes'][_0x9600('0x3f')]?_0x2a907b[_0x9600('0x3d')]:_0x369e18[_0x9600('0x3c')];if(!_0x27ac3c[_0x9600('0x3a')][_0x9600('0x40')](_0x9600('0x41'))){_0x2a907b['limit']=qs[_0x9600('0x2b')](_0x27ac3c['query']['limit']);_0x2a907b[_0x9600('0x29')]=qs[_0x9600('0x29')](_0x27ac3c[_0x9600('0x3a')][_0x9600('0x29')]);}_0x2a907b['order']=qs[_0x9600('0x42')](_0x27ac3c['query'][_0x9600('0x42')]);_0x2a907b['where']=qs[_0x9600('0x43')](_['pick'](_0x27ac3c['query'],_0x369e18['filters']),_0x2fb936);if(_0x27ac3c[_0x9600('0x3a')][_0x9600('0x44')]){_0x2a907b[_0x9600('0x45')]=_['merge'](_0x2a907b[_0x9600('0x45')],{'$or':_[_0x9600('0x35')](_0x2fb936,function(_0x583f42){if(_0x583f42[_0x9600('0x38')]!==_0x9600('0x46')){var _0xe499a5={};_0xe499a5[_0x583f42[_0x9600('0x33')]]={'$like':'%'+_0x27ac3c[_0x9600('0x3a')][_0x9600('0x44')]+'%'};return _0xe499a5;}})});}_0x2a907b=_['merge']({},_0x2a907b,_0x27ac3c['options']);var _0x11f1e1={'where':_0x2a907b[_0x9600('0x45')]};return db[_0x9600('0x36')]['count'](_0x11f1e1)['then'](function(_0x5e3e97){_0x5f33f4[_0x9600('0x47')]=_0x5e3e97;if(_0x27ac3c['query'][_0x9600('0x48')]){_0x2a907b[_0x9600('0x49')]=[{'all':!![]}];}return db[_0x9600('0x36')][_0x9600('0x4a')](_0x2a907b);})[_0x9600('0x1b')](function(_0x127cc0){_0x5f33f4[_0x9600('0x4b')]=_0x127cc0;return _0x5f33f4;})[_0x9600('0x1b')](respondWithFilteredResult(_0x3f68e0,_0x2a907b))[_0x9600('0x4c')](handleError(_0x3f68e0,null));};exports['show']=function(_0x199ba4,_0x29071a){var _0x36775f={'raw':!![],'where':{'id':_0x199ba4[_0x9600('0x4d')]['id']}},_0x1b0807={};_0x1b0807[_0x9600('0x3c')]=_['keys'](db[_0x9600('0x36')][_0x9600('0x37')]);_0x1b0807[_0x9600('0x3a')]=_['keys'](_0x199ba4[_0x9600('0x3a')]);_0x1b0807[_0x9600('0x43')]=_[_0x9600('0x3b')](_0x1b0807[_0x9600('0x3c')],_0x1b0807[_0x9600('0x3a')]);_0x36775f[_0x9600('0x3d')]=_['intersection'](_0x1b0807[_0x9600('0x3c')],qs['fields'](_0x199ba4[_0x9600('0x3a')][_0x9600('0x3e')]));_0x36775f[_0x9600('0x3d')]=_0x36775f[_0x9600('0x3d')][_0x9600('0x3f')]?_0x36775f['attributes']:_0x1b0807['model'];if(_0x199ba4[_0x9600('0x3a')][_0x9600('0x48')]){_0x36775f[_0x9600('0x49')]=[{'all':!![]}];}_0x36775f=_[_0x9600('0x4e')]({},_0x36775f,_0x199ba4[_0x9600('0x4f')]);return db['ChatQueue']['find'](_0x36775f)[_0x9600('0x1b')](handleEntityNotFound(_0x29071a,null))[_0x9600('0x1b')](respondWithResult(_0x29071a,null))[_0x9600('0x4c')](handleError(_0x29071a,null));};exports[_0x9600('0x50')]=function(_0x13609d,_0x54b073){return db[_0x9600('0x36')][_0x9600('0x50')](_0x13609d[_0x9600('0x51')],{})[_0x9600('0x1b')](function(_0x2cfa54){var _0x520eeb=_0x13609d['user'][_0x9600('0x30')]({'plain':!![]});if(!_0x520eeb)throw new Error(_0x9600('0x52'));if(_0x520eeb[_0x9600('0x53')]===_0x9600('0x54')){var _0x379a3e=_0x2cfa54[_0x9600('0x30')]({'plain':!![]});var _0x5e2f76=_0x9600('0x55');return db[_0x9600('0x56')]['find']({'where':{'name':_0x5e2f76,'userProfileId':_0x520eeb[_0x9600('0x57')]},'raw':!![]})[_0x9600('0x1b')](function(_0x59e6a5){if(_0x59e6a5&&_0x59e6a5[_0x9600('0x58')]===0x0){return db[_0x9600('0x31')][_0x9600('0x50')]({'name':_0x379a3e[_0x9600('0x33')],'resourceId':_0x379a3e['id'],'type':_0x59e6a5[_0x9600('0x33')],'sectionId':_0x59e6a5['id']},{})[_0x9600('0x1b')](function(){return _0x2cfa54;});}else{return _0x2cfa54;}})[_0x9600('0x4c')](function(_0x15952f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15952f);throw _0x15952f;});}return _0x2cfa54;})[_0x9600('0x1b')](respondWithResult(_0x54b073,0xc9))['catch'](handleError(_0x54b073,null));};exports[_0x9600('0x2f')]=function(_0x328f56,_0x5788f9){if(_0x328f56[_0x9600('0x51')]['id']){delete _0x328f56['body']['id'];}return db[_0x9600('0x36')][_0x9600('0x59')]({'where':{'id':_0x328f56[_0x9600('0x4d')]['id']}})[_0x9600('0x1b')](handleEntityNotFound(_0x5788f9,null))[_0x9600('0x1b')](saveUpdates(_0x328f56[_0x9600('0x51')],null))['then'](respondWithResult(_0x5788f9,null))[_0x9600('0x4c')](handleError(_0x5788f9,null));};exports[_0x9600('0x32')]=function(_0x339f1e,_0x1b8e59){return db[_0x9600('0x36')][_0x9600('0x59')]({'where':{'id':_0x339f1e[_0x9600('0x4d')]['id']}})[_0x9600('0x1b')](handleEntityNotFound(_0x1b8e59,null))[_0x9600('0x1b')](removeEntity(_0x1b8e59,null))[_0x9600('0x4c')](handleError(_0x1b8e59,null));};exports['describe']=function(_0x3ae73b,_0x4e0c8d){return db['ChatQueue'][_0x9600('0x5a')]()[_0x9600('0x1b')](respondWithResult(_0x4e0c8d,null))[_0x9600('0x4c')](handleError(_0x4e0c8d,null));};exports[_0x9600('0x5b')]=function(_0x45dd68,_0x2abc75,_0x447e32){var _0x16514d={'raw':!![],'where':{}},_0x2ae96e={},_0x54ef7b;return db[_0x9600('0x36')]['findOne']({'where':{'id':_0x45dd68[_0x9600('0x4d')]['id']}})[_0x9600('0x1b')](handleEntityNotFound(_0x2abc75,null))[_0x9600('0x1b')](function(_0x2fa9a9){if(_0x2fa9a9){_0x54ef7b=_0x2fa9a9[_0x9600('0x30')]({'plain':!![]});_0x2ae96e[_0x9600('0x3c')]=_[_0x9600('0x39')](db[_0x9600('0x5c')][_0x9600('0x37')]);_0x2ae96e[_0x9600('0x3a')]=_[_0x9600('0x39')](_0x45dd68['query']);_0x2ae96e['filters']=_[_0x9600('0x3b')](_0x2ae96e[_0x9600('0x3c')],_0x2ae96e[_0x9600('0x3a')]);_0x16514d[_0x9600('0x3d')]=_[_0x9600('0x3b')](_0x2ae96e[_0x9600('0x3c')],qs[_0x9600('0x3e')](_0x45dd68[_0x9600('0x3a')][_0x9600('0x3e')]));_0x16514d[_0x9600('0x3d')]=_0x16514d[_0x9600('0x3d')][_0x9600('0x3f')]?_0x16514d[_0x9600('0x3d')]:_0x2ae96e['model'];if(!_0x45dd68[_0x9600('0x3a')]['hasOwnProperty'](_0x9600('0x41'))){_0x16514d[_0x9600('0x2b')]=qs['limit'](_0x45dd68[_0x9600('0x3a')][_0x9600('0x2b')]);_0x16514d[_0x9600('0x29')]=qs['offset'](_0x45dd68[_0x9600('0x3a')][_0x9600('0x29')]);}_0x16514d[_0x9600('0x5d')]=qs[_0x9600('0x42')](_0x45dd68[_0x9600('0x3a')][_0x9600('0x42')]);_0x16514d['where']=qs[_0x9600('0x43')](_[_0x9600('0x5e')](_0x45dd68[_0x9600('0x3a')],_0x2ae96e[_0x9600('0x43')]));_0x16514d[_0x9600('0x45')][_0x9600('0x5f')]=_0x2fa9a9['id'];if(_0x45dd68[_0x9600('0x3a')][_0x9600('0x44')]){_0x16514d[_0x9600('0x45')]=_[_0x9600('0x4e')](_0x16514d[_0x9600('0x45')],{'$or':_[_0x9600('0x35')](_0x16514d[_0x9600('0x3d')],function(_0x1b0d7f){var _0x5ded13={};_0x5ded13[_0x1b0d7f]={'$like':'%'+_0x45dd68[_0x9600('0x3a')][_0x9600('0x44')]+'%'};return _0x5ded13;})});}_0x16514d=_['merge']({},_0x16514d,_0x45dd68[_0x9600('0x4f')]);return db[_0x9600('0x5c')][_0x9600('0x4a')](_0x16514d);}})['then'](function(_0x5a16de){if(_0x5a16de){return db[_0x9600('0x60')][_0x9600('0x61')]({'where':{'id':_[_0x9600('0x35')](_0x5a16de,_0x9600('0x62')),'role':_0x9600('0x63')},'attributes':['id',_0x9600('0x33'),_0x9600('0x64'),_0x9600('0x65'),_0x9600('0x66')]});}})['then'](function(_0x4ac8c6){if(_0x4ac8c6){return{'count':_0x4ac8c6['count'],'rows':_[_0x9600('0x35')](_0x4ac8c6[_0x9600('0x4b')],function(_0x3378df){return{'membername':_0x3378df[_0x9600('0x33')],'UserId':_0x3378df['id'],'queue_name':_0x54ef7b[_0x9600('0x33')],'ChatQueueId':_0x54ef7b['id'],'interface':util[_0x9600('0x67')](_0x9600('0x68'),_0x9600('0x69'),_0x3378df['name']),'penalty':0x0,'paused':_0x3378df['chatPause'],'createdAt':_0x3378df[_0x9600('0x66')],'updatedAt':_0x3378df[_0x9600('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9600('0x1b')](respondWithFilteredResult(_0x2abc75,_0x16514d))[_0x9600('0x4c')](handleError(_0x2abc75,null));};exports['getTeams']=function(_0x4bcb31,_0x602073,_0x3cd6a7){var _0x5c1513={};var _0x3be243={};var _0x5adcea;var _0x38107a;return db['ChatQueue'][_0x9600('0x6a')]({'where':{'id':_0x4bcb31[_0x9600('0x4d')]['id']}})['then'](handleEntityNotFound(_0x602073,null))[_0x9600('0x1b')](function(_0x371b33){if(_0x371b33){_0x5adcea=_0x371b33;_0x3be243['model']=_[_0x9600('0x39')](db[_0x9600('0x6b')][_0x9600('0x37')]);_0x3be243[_0x9600('0x3a')]=_['keys'](_0x4bcb31[_0x9600('0x3a')]);_0x3be243[_0x9600('0x43')]=_[_0x9600('0x3b')](_0x3be243[_0x9600('0x3c')],_0x3be243[_0x9600('0x3a')]);_0x5c1513['attributes']=_[_0x9600('0x3b')](_0x3be243[_0x9600('0x3c')],qs['fields'](_0x4bcb31[_0x9600('0x3a')][_0x9600('0x3e')]));_0x5c1513[_0x9600('0x3d')]=_0x5c1513[_0x9600('0x3d')][_0x9600('0x3f')]?_0x5c1513['attributes']:_0x3be243[_0x9600('0x3c')];_0x5c1513[_0x9600('0x5d')]=qs[_0x9600('0x42')](_0x4bcb31[_0x9600('0x3a')][_0x9600('0x42')]);_0x5c1513[_0x9600('0x45')]=qs[_0x9600('0x43')](_['pick'](_0x4bcb31[_0x9600('0x3a')],_0x3be243[_0x9600('0x43')]));if(_0x4bcb31[_0x9600('0x3a')][_0x9600('0x44')]){_0x5c1513[_0x9600('0x45')]=_[_0x9600('0x4e')](_0x5c1513[_0x9600('0x45')],{'$or':_[_0x9600('0x35')](_0x5c1513[_0x9600('0x3d')],function(_0x3c5cab){var _0xa8b027={};_0xa8b027[_0x3c5cab]={'$like':'%'+_0x4bcb31[_0x9600('0x3a')][_0x9600('0x44')]+'%'};return _0xa8b027;})});}_0x5c1513=_[_0x9600('0x4e')]({},_0x5c1513,_0x4bcb31['options']);return _0x5adcea[_0x9600('0x6c')](_0x5c1513);}})[_0x9600('0x1b')](function(_0x470c31){if(_0x470c31){_0x38107a=_0x470c31[_0x9600('0x3f')];if(!_0x4bcb31[_0x9600('0x3a')][_0x9600('0x40')](_0x9600('0x41'))){_0x5c1513[_0x9600('0x2b')]=qs[_0x9600('0x2b')](_0x4bcb31[_0x9600('0x3a')][_0x9600('0x2b')]);_0x5c1513['offset']=qs[_0x9600('0x29')](_0x4bcb31[_0x9600('0x3a')][_0x9600('0x29')]);}return _0x5adcea['getTeams'](_0x5c1513);}})[_0x9600('0x1b')](function(_0x1f6cb1){if(_0x1f6cb1){return _0x1f6cb1?{'count':_0x38107a,'rows':_0x1f6cb1}:null;}})[_0x9600('0x1b')](respondWithResult(_0x602073,null))[_0x9600('0x4c')](handleError(_0x602073,null));};exports[_0x9600('0x6d')]=function(_0x30d14b,_0x5cacce,_0x4e8bbd){var _0x396793=_0x30d14b[_0x9600('0x51')][_0x9600('0x6e')];return db['Team']['findAll']({'where':{'id':_0x396793},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9600('0x6f'),'attributes':['id',_0x9600('0x33'),_0x9600('0x70'),_0x9600('0x71'),'interface'],'raw':!![]}]})[_0x9600('0x1b')](function(_0x44b09d){if(_0x44b09d){var _0xa411c3=_['flatMap'](_0x44b09d,function(_0x5cdef0){var _0x3b350a=_0x5cdef0[_0x9600('0x30')]({'plain':!![]});return _0x3b350a[_0x9600('0x6f')];});return db[_0x9600('0x36')]['find']({'where':{'id':_0x30d14b['params']['id']}})[_0x9600('0x1b')](function(_0x1700e9){return db[_0x9600('0x72')][_0x9600('0x73')](function(_0x4ec0d7){return _0x1700e9[_0x9600('0x6d')](_0x396793,{'transaction':_0x4ec0d7})[_0x9600('0x1b')](function(){return BPromise['each'](_0xa411c3,function(_0x4bde6c){return db[_0x9600('0x5c')][_0x9600('0x74')]({'where':{'UserId':_0x4bde6c['id'],'ChatQueueId':_0x30d14b['params']['id']},'transaction':_0x4ec0d7});});})[_0x9600('0x1b')](function(){_0xa411c3['forEach'](function(_0x567440){socket[_0x9600('0x75')](_0x9600('0x76'),{'UserId':_0x567440['id'],'ChatQueueId':_0x1700e9['id']});});});});});}})[_0x9600('0x1b')](respondWithStatusCode(_0x5cacce,null))[_0x9600('0x4c')](handleError(_0x5cacce,null));};exports[_0x9600('0x77')]=function(_0x4a9c88,_0x201e11,_0x4e059){return db[_0x9600('0x6b')][_0x9600('0x4a')]({'where':{'id':_0x4a9c88[_0x9600('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9600('0x60')],'as':_0x9600('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x9600('0x1b')](handleEntityNotFound(_0x201e11,null))[_0x9600('0x1b')](function(_0x2e92db){var _0x47628c=_[_0x9600('0x35')](_0x2e92db,'id');var _0x1cfba3=[];var _0x3a4c7d=[];var _0x45e445=squel['select']();_0x45e445[_0x9600('0x78')](_0x9600('0x79'))[_0x9600('0x7a')](_0x9600('0x7b'),'tq')[_0x9600('0x7c')](_0x9600('0x7d'),'ut',_0x9600('0x7e'))[_0x9600('0x45')](_0x9600('0x7f'),_0x4a9c88[_0x9600('0x4d')]['id']);for(var _0x11eb23=0x0;_0x11eb23<_0x2e92db[_0x9600('0x3f')];_0x11eb23+=0x1){let _0x34386e=_0x2e92db[_0x11eb23];for(var _0x1938dc=0x0;_0x1938dc<_0x34386e[_0x9600('0x6f')][_0x9600('0x3f')];_0x1938dc+=0x1){let _0x28a1c7=_0x34386e[_0x9600('0x6f')][_0x1938dc];var _0x4e9953=_0x45e445[_0x9600('0x80')]();_0x4e9953['where']('ut.UserId\x20=\x20?',_0x28a1c7['id']);_0x3a4c7d[_0x9600('0x81')](db[_0x9600('0x72')]['query'](_0x4e9953[_0x9600('0x82')](),{'type':db[_0x9600('0x72')]['QueryTypes'][_0x9600('0x83')]})[_0x9600('0x1b')](function(_0x156feb){if(_0x156feb[_0x9600('0x3f')]===0x1){return _0x28a1c7['id'];}else{var _0x542c21=_['every'](_[_0x9600('0x35')](_0x156feb,_0x9600('0x84')),function(_0x2f989d){return _[_0x9600('0x85')](_0x47628c,_0x2f989d);});if(_0x542c21){return _0x28a1c7['id'];}}}));}}return BPromise[_0x9600('0x86')](_0x3a4c7d)[_0x9600('0x1b')](function(_0x459296){_0x1cfba3=_(_0x1cfba3)[_0x9600('0x87')](_0x459296)['compact']()['value']();return db[_0x9600('0x36')]['find']({'where':{'id':_0x4a9c88['params']['id']}})[_0x9600('0x1b')](function(_0x25bb4a){return db[_0x9600('0x72')][_0x9600('0x73')](function(_0x3cdcaf){return _0x25bb4a[_0x9600('0x77')](_0x4a9c88[_0x9600('0x3a')][_0x9600('0x6e')],{'transaction':_0x3cdcaf})['then'](function(){if(!_[_0x9600('0x88')](_0x1cfba3)){return _0x25bb4a[_0x9600('0x89')](_0x1cfba3,{'transaction':_0x3cdcaf});}})[_0x9600('0x1b')](function(){_0x1cfba3['forEach'](function(_0xe9b15f){socket[_0x9600('0x75')](_0x9600('0x8a'),{'UserId':_0xe9b15f,'ChatQueueId':_0x25bb4a['id']});});});});});});})['then'](respondWithStatusCode(_0x201e11,null))['catch'](handleError(_0x201e11,null));};exports[_0x9600('0x8b')]=function(_0x6415d3,_0x5c5e9e,_0x170a10){return db['ChatQueue'][_0x9600('0x59')]({'where':{'id':_0x6415d3['params']['id']}})['then'](handleEntityNotFound(_0x5c5e9e,null))['then'](function(_0x276f10){if(_0x276f10){return _0x276f10[_0x9600('0x8b')](_0x6415d3[_0x9600('0x51')][_0x9600('0x6e')],_[_0x9600('0x8c')](_0x6415d3[_0x9600('0x51')],[_0x9600('0x6e'),'id'])||{})['spread'](function(_0x5cdd94){for(var _0x38bac0=0x0;_0x38bac0<_0x6415d3[_0x9600('0x51')]['ids'][_0x9600('0x3f')];_0x38bac0+=0x1){socket['emit'](_0x9600('0x76'),{'UserId':Number(_0x6415d3[_0x9600('0x51')][_0x9600('0x6e')][_0x38bac0]),'ChatQueueId':Number(_0x6415d3[_0x9600('0x4d')]['id'])});}return _0x5cdd94;});}})[_0x9600('0x1b')](respondWithResult(_0x5c5e9e,null))['catch'](handleError(_0x5c5e9e,null));};exports[_0x9600('0x89')]=function(_0x23b4be,_0x3234ff,_0x2ca32c){return db[_0x9600('0x36')][_0x9600('0x59')]({'where':{'id':_0x23b4be[_0x9600('0x4d')]['id']}})[_0x9600('0x1b')](handleEntityNotFound(_0x3234ff,null))[_0x9600('0x1b')](function(_0x30c1cf){if(_0x30c1cf){return _0x30c1cf[_0x9600('0x89')](_0x23b4be[_0x9600('0x3a')]['ids'])[_0x9600('0x1b')](function(){if(_[_0x9600('0x8d')](_0x23b4be[_0x9600('0x3a')][_0x9600('0x6e')])){for(var _0x4c3d98=0x0;_0x4c3d98<_0x23b4be[_0x9600('0x3a')][_0x9600('0x6e')][_0x9600('0x3f')];_0x4c3d98+=0x1){socket[_0x9600('0x75')](_0x9600('0x8a'),{'UserId':Number(_0x23b4be[_0x9600('0x3a')][_0x9600('0x6e')][_0x4c3d98]),'ChatQueueId':Number(_0x23b4be[_0x9600('0x4d')]['id'])});}}else{socket['emit'](_0x9600('0x8a'),{'UserId':Number(_0x23b4be[_0x9600('0x3a')][_0x9600('0x6e')]),'ChatQueueId':Number(_0x23b4be['params']['id'])});}});}})[_0x9600('0x1b')](respondWithStatusCode(_0x3234ff,null))[_0x9600('0x4c')](handleError(_0x3234ff,null));};exports['getAgents']=function(_0x467531,_0x4c1a66,_0x3f9e9a){var _0x4a32e0={};var _0x3200ac={};var _0x4ec23e;var _0xded492;return db['ChatQueue'][_0x9600('0x6a')]({'where':{'id':_0x467531[_0x9600('0x4d')]['id']}})[_0x9600('0x1b')](handleEntityNotFound(_0x4c1a66,null))['then'](function(_0x2edf23){if(_0x2edf23){_0x4ec23e=_0x2edf23;_0x3200ac['model']=_[_0x9600('0x39')](db[_0x9600('0x60')][_0x9600('0x37')]);_0x3200ac[_0x9600('0x3a')]=_[_0x9600('0x39')](_0x467531[_0x9600('0x3a')]);_0x3200ac[_0x9600('0x43')]=_[_0x9600('0x3b')](_0x3200ac['model'],_0x3200ac[_0x9600('0x3a')]);_0x4a32e0['attributes']=_['intersection'](_0x3200ac[_0x9600('0x3c')],qs[_0x9600('0x3e')](_0x467531['query'][_0x9600('0x3e')]));_0x4a32e0[_0x9600('0x3d')]=_0x4a32e0[_0x9600('0x3d')][_0x9600('0x3f')]?_0x4a32e0[_0x9600('0x3d')]:_0x3200ac[_0x9600('0x3c')];_0x4a32e0[_0x9600('0x5d')]=qs[_0x9600('0x42')](_0x467531[_0x9600('0x3a')][_0x9600('0x42')]);_0x4a32e0[_0x9600('0x45')]=qs[_0x9600('0x43')](_[_0x9600('0x5e')](_0x467531[_0x9600('0x3a')],_0x3200ac[_0x9600('0x43')]));if(_0x467531[_0x9600('0x3a')][_0x9600('0x44')]){_0x4a32e0['where']=_[_0x9600('0x4e')](_0x4a32e0[_0x9600('0x45')],{'$or':_[_0x9600('0x35')](_0x4a32e0[_0x9600('0x3d')],function(_0x30dcba){var _0x2e10f7={};_0x2e10f7[_0x30dcba]={'$like':'%'+_0x467531[_0x9600('0x3a')][_0x9600('0x44')]+'%'};return _0x2e10f7;})});}_0x4a32e0=_[_0x9600('0x4e')]({},_0x4a32e0,_0x467531[_0x9600('0x4f')]);return _0x4ec23e['getAgents'](_0x4a32e0);}})[_0x9600('0x1b')](function(_0x476182){if(_0x476182){_0xded492=_0x476182[_0x9600('0x3f')];if(!_0x467531['query']['hasOwnProperty'](_0x9600('0x41'))){_0x4a32e0['limit']=qs[_0x9600('0x2b')](_0x467531['query']['limit']);_0x4a32e0[_0x9600('0x29')]=qs[_0x9600('0x29')](_0x467531['query']['offset']);}return _0x4ec23e[_0x9600('0x8e')](_0x4a32e0);}})['then'](function(_0x127c81){if(_0x127c81){return _0x127c81?{'count':_0xded492,'rows':_0x127c81}:null;}})[_0x9600('0x1b')](respondWithResult(_0x4c1a66,null))[_0x9600('0x4c')](handleError(_0x4c1a66,null));}; \ No newline at end of file +var _0xa0cd=['describe','getMembers','UserChatQueue','ChatQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','chatPause','getTeams','Team','addTeams','ids','online','voicePause','flatMap','transaction','each','forEach','emit','userChatQueue:save','removeTeams','from','team_has_chat_queues','join','user_has_teams','Agents','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','all','union','compact','value','removeAgents','addAgents','omit','spread','isArray','getAgents','findOne','pick','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','localhost','./chatQueue.socket','register','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','ChatQueues','name','index','map','ChatQueue','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','rows','show','params','rawAttributes','keys','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','update','body'];(function(_0x1007b3,_0x344f7f){var _0x7cf215=function(_0x5e25a0){while(--_0x5e25a0){_0x1007b3['push'](_0x1007b3['shift']());}};_0x7cf215(++_0x344f7f);}(_0xa0cd,0x1e8));var _0xda0c=function(_0xa22054,_0x464303){_0xa22054=_0xa22054-0x0;var _0x4bee13=_0xa0cd[_0xa22054];return _0x4bee13;};'use strict';var emlformat=require(_0xda0c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda0c('0x1'));var jsonpatch=require(_0xda0c('0x2'));var rp=require(_0xda0c('0x3'));var moment=require('moment');var BPromise=require(_0xda0c('0x4'));var Mustache=require(_0xda0c('0x5'));var util=require('util');var path=require(_0xda0c('0x6'));var sox=require(_0xda0c('0x7'));var csv=require(_0xda0c('0x8'));var ejs=require(_0xda0c('0x9'));var fs=require('fs');var fs_extra=require(_0xda0c('0xa'));var _=require(_0xda0c('0xb'));var squel=require(_0xda0c('0xc'));var crypto=require(_0xda0c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xda0c('0xe'));var toCsv=require(_0xda0c('0x8'));var querystring=require(_0xda0c('0xf'));var Papa=require('papaparse');var Redis=require(_0xda0c('0x10'));var authService=require(_0xda0c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xda0c('0x12'));var hardwareService=require(_0xda0c('0x13'));var logger=require('../../config/logger')(_0xda0c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xda0c('0x15'));var db=require('../../mysqldb')['db'];config[_0xda0c('0x16')]=_['defaults'](config[_0xda0c('0x16')],{'host':_0xda0c('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xda0c('0x18'))[_0xda0c('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xda0c('0x1a')][_0xda0c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4c946a,_0x32e52a,_0x4af665,_0x53608c){return new BPromise(function(_0x479ebe,_0x4d3624){var _0x58d81a=_0x53608c||client;return _0x58d81a[_0xda0c('0x1c')](_0x4c946a,_0x4af665)[_0xda0c('0x1d')](function(_0x4a2f83){logger['info'](_0xda0c('0x1e'),_0x32e52a,_0xda0c('0x1f'));logger[_0xda0c('0x20')](_0xda0c('0x21'),_0x32e52a,'request\x20sent',JSON[_0xda0c('0x22')](_0x4a2f83));if(_0x4a2f83[_0xda0c('0x23')]){if(_0x4a2f83[_0xda0c('0x23')]['code']===0x1f4){logger['error'](_0xda0c('0x1e'),_0x32e52a,_0x4a2f83[_0xda0c('0x23')][_0xda0c('0x24')]);return _0x4d3624(_0x4a2f83[_0xda0c('0x23')]['message']);}logger[_0xda0c('0x23')]('ChatQueue,\x20%s,\x20%s',_0x32e52a,_0x4a2f83[_0xda0c('0x23')][_0xda0c('0x24')]);return _0x479ebe(_0x4a2f83[_0xda0c('0x23')][_0xda0c('0x24')]);}else{logger[_0xda0c('0x25')](_0xda0c('0x1e'),_0x32e52a,_0xda0c('0x1f'));_0x479ebe(_0x4a2f83['result']['message']);}})[_0xda0c('0x26')](function(_0x51716e){logger[_0xda0c('0x23')](_0xda0c('0x1e'),_0x32e52a,_0x51716e);_0x4d3624(_0x51716e);});});}function respondWithStatusCode(_0x3da213,_0x34cc81){_0x34cc81=_0x34cc81||0xcc;return function(_0x4df4c8){if(_0x4df4c8){return _0x3da213[_0xda0c('0x27')](_0x34cc81);}return _0x3da213[_0xda0c('0x28')](_0x34cc81)[_0xda0c('0x29')]();};}function respondWithResult(_0x1a38b2,_0x323c6c){_0x323c6c=_0x323c6c||0xc8;return function(_0x1b2f18){if(_0x1b2f18){return _0x1a38b2['status'](_0x323c6c)[_0xda0c('0x2a')](_0x1b2f18);}};}function respondWithFilteredResult(_0x1569d7,_0x3cdc6a){return function(_0x4ddeca){if(_0x4ddeca){var _0x549ee2=typeof _0x3cdc6a[_0xda0c('0x2b')]===_0xda0c('0x2c')&&typeof _0x3cdc6a[_0xda0c('0x2d')]===_0xda0c('0x2c');var _0x2bf4b9=_0x4ddeca[_0xda0c('0x2e')];var _0x585734=_0x549ee2?0x0:_0x3cdc6a[_0xda0c('0x2b')];var _0x5d4fbb=_0x549ee2?_0x4ddeca['count']:_0x3cdc6a['offset']+_0x3cdc6a['limit'];var _0x5a5b73;if(_0x5d4fbb>=_0x2bf4b9){_0x5d4fbb=_0x2bf4b9;_0x5a5b73=0xc8;}else{_0x5a5b73=0xce;}_0x1569d7[_0xda0c('0x28')](_0x5a5b73);return _0x1569d7[_0xda0c('0x2f')](_0xda0c('0x30'),_0x585734+'-'+_0x5d4fbb+'/'+_0x2bf4b9)[_0xda0c('0x2a')](_0x4ddeca);}return null;};}function patchUpdates(_0x386074){return function(_0x3ab646){try{jsonpatch[_0xda0c('0x31')](_0x3ab646,_0x386074,!![]);}catch(_0x269d74){return BPromise[_0xda0c('0x32')](_0x269d74);}return _0x3ab646[_0xda0c('0x33')]();};}function saveUpdates(_0x32e224,_0x50b47c){return function(_0x3e3aa6){if(_0x3e3aa6){return _0x3e3aa6['update'](_0x32e224)[_0xda0c('0x1d')](function(_0x57acd4){return _0x57acd4;});}return null;};}function removeEntity(_0xeea3c2,_0x26c9a6){return function(_0x3f53b6){if(_0x3f53b6){return _0x3f53b6[_0xda0c('0x34')]()[_0xda0c('0x1d')](function(){var _0x50f86a=_0x3f53b6[_0xda0c('0x35')]({'plain':!![]});var _0x40bad3=_0xda0c('0x36');return db['UserProfileResource'][_0xda0c('0x34')]({'where':{'type':_0x40bad3,'resourceId':_0x50f86a['id']}})[_0xda0c('0x1d')](function(){return _0x3f53b6;});})['then'](function(){_0xeea3c2[_0xda0c('0x28')](0xcc)[_0xda0c('0x29')]();});}};}function handleEntityNotFound(_0x492986,_0x58b6c0){return function(_0x2a61a8){if(!_0x2a61a8){_0x492986['sendStatus'](0x194);}return _0x2a61a8;};}function handleError(_0x148edb,_0x321bd9){_0x321bd9=_0x321bd9||0x1f4;return function(_0x5a006a){logger['error'](_0x5a006a['stack']);if(_0x5a006a[_0xda0c('0x37')]){delete _0x5a006a[_0xda0c('0x37')];}_0x148edb['status'](_0x321bd9)['send'](_0x5a006a);};}exports[_0xda0c('0x38')]=function(_0x464d8b,_0x4f268e){var _0x394365={},_0x157acb={},_0x13cf1a={'count':0x0,'rows':[]};var _0x5404be=_[_0xda0c('0x39')](db[_0xda0c('0x3a')]['rawAttributes'],function(_0x4cc76b){return{'name':_0x4cc76b[_0xda0c('0x3b')],'type':_0x4cc76b['type'][_0xda0c('0x3c')]};});_0x157acb[_0xda0c('0x3d')]=_[_0xda0c('0x39')](_0x5404be,_0xda0c('0x37'));_0x157acb[_0xda0c('0x3e')]=_['keys'](_0x464d8b[_0xda0c('0x3e')]);_0x157acb['filters']=_[_0xda0c('0x3f')](_0x157acb[_0xda0c('0x3d')],_0x157acb[_0xda0c('0x3e')]);_0x394365['attributes']=_[_0xda0c('0x3f')](_0x157acb[_0xda0c('0x3d')],qs['fields'](_0x464d8b[_0xda0c('0x3e')][_0xda0c('0x40')]));_0x394365[_0xda0c('0x41')]=_0x394365[_0xda0c('0x41')][_0xda0c('0x42')]?_0x394365[_0xda0c('0x41')]:_0x157acb['model'];if(!_0x464d8b[_0xda0c('0x3e')][_0xda0c('0x43')](_0xda0c('0x44'))){_0x394365['limit']=qs[_0xda0c('0x2d')](_0x464d8b[_0xda0c('0x3e')]['limit']);_0x394365['offset']=qs[_0xda0c('0x2b')](_0x464d8b[_0xda0c('0x3e')]['offset']);}_0x394365[_0xda0c('0x45')]=qs[_0xda0c('0x46')](_0x464d8b[_0xda0c('0x3e')]['sort']);_0x394365[_0xda0c('0x47')]=qs[_0xda0c('0x48')](_['pick'](_0x464d8b[_0xda0c('0x3e')],_0x157acb[_0xda0c('0x48')]),_0x5404be);if(_0x464d8b[_0xda0c('0x3e')]['filter']){_0x394365[_0xda0c('0x47')]=_[_0xda0c('0x49')](_0x394365[_0xda0c('0x47')],{'$or':_[_0xda0c('0x39')](_0x5404be,function(_0x3ff6af){if(_0x3ff6af['type']!=='VIRTUAL'){var _0x5ed40f={};_0x5ed40f[_0x3ff6af[_0xda0c('0x37')]]={'$like':'%'+_0x464d8b[_0xda0c('0x3e')][_0xda0c('0x4a')]+'%'};return _0x5ed40f;}})});}_0x394365=_['merge']({},_0x394365,_0x464d8b[_0xda0c('0x4b')]);var _0x42fe92={'where':_0x394365[_0xda0c('0x47')]};return db['ChatQueue'][_0xda0c('0x2e')](_0x42fe92)[_0xda0c('0x1d')](function(_0x49c24c){_0x13cf1a['count']=_0x49c24c;if(_0x464d8b[_0xda0c('0x3e')][_0xda0c('0x4c')]){_0x394365['include']=[{'all':!![]}];}return db[_0xda0c('0x3a')]['findAll'](_0x394365);})[_0xda0c('0x1d')](function(_0x884703){_0x13cf1a[_0xda0c('0x4d')]=_0x884703;return _0x13cf1a;})[_0xda0c('0x1d')](respondWithFilteredResult(_0x4f268e,_0x394365))[_0xda0c('0x26')](handleError(_0x4f268e,null));};exports[_0xda0c('0x4e')]=function(_0x1bc4e3,_0x90aae4){var _0x44cd4e={'raw':!![],'where':{'id':_0x1bc4e3[_0xda0c('0x4f')]['id']}},_0x56fbb8={};_0x56fbb8[_0xda0c('0x3d')]=_['keys'](db[_0xda0c('0x3a')][_0xda0c('0x50')]);_0x56fbb8[_0xda0c('0x3e')]=_[_0xda0c('0x51')](_0x1bc4e3[_0xda0c('0x3e')]);_0x56fbb8[_0xda0c('0x48')]=_[_0xda0c('0x3f')](_0x56fbb8['model'],_0x56fbb8[_0xda0c('0x3e')]);_0x44cd4e['attributes']=_['intersection'](_0x56fbb8[_0xda0c('0x3d')],qs[_0xda0c('0x40')](_0x1bc4e3[_0xda0c('0x3e')][_0xda0c('0x40')]));_0x44cd4e[_0xda0c('0x41')]=_0x44cd4e[_0xda0c('0x41')][_0xda0c('0x42')]?_0x44cd4e[_0xda0c('0x41')]:_0x56fbb8[_0xda0c('0x3d')];if(_0x1bc4e3[_0xda0c('0x3e')]['includeAll']){_0x44cd4e[_0xda0c('0x52')]=[{'all':!![]}];}_0x44cd4e=_[_0xda0c('0x49')]({},_0x44cd4e,_0x1bc4e3[_0xda0c('0x4b')]);return db['ChatQueue'][_0xda0c('0x53')](_0x44cd4e)['then'](handleEntityNotFound(_0x90aae4,null))[_0xda0c('0x1d')](respondWithResult(_0x90aae4,null))[_0xda0c('0x26')](handleError(_0x90aae4,null));};exports[_0xda0c('0x54')]=function(_0x166736,_0x3dae6a){return db[_0xda0c('0x3a')][_0xda0c('0x54')](_0x166736['body'],{})[_0xda0c('0x1d')](function(_0x3cee3d){var _0x4b1cac=_0x166736['user']['get']({'plain':!![]});if(!_0x4b1cac)throw new Error(_0xda0c('0x55'));if(_0x4b1cac[_0xda0c('0x56')]==='user'){var _0x184f1b=_0x3cee3d[_0xda0c('0x35')]({'plain':!![]});var _0x436e18=_0xda0c('0x36');return db[_0xda0c('0x57')][_0xda0c('0x53')]({'where':{'name':_0x436e18,'userProfileId':_0x4b1cac[_0xda0c('0x58')]},'raw':!![]})[_0xda0c('0x1d')](function(_0x214a27){if(_0x214a27&&_0x214a27['autoAssociation']===0x0){return db[_0xda0c('0x59')]['create']({'name':_0x184f1b[_0xda0c('0x37')],'resourceId':_0x184f1b['id'],'type':_0x214a27['name'],'sectionId':_0x214a27['id']},{})[_0xda0c('0x1d')](function(){return _0x3cee3d;});}else{return _0x3cee3d;}})[_0xda0c('0x26')](function(_0x32f984){logger[_0xda0c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32f984);throw _0x32f984;});}return _0x3cee3d;})[_0xda0c('0x1d')](respondWithResult(_0x3dae6a,0xc9))[_0xda0c('0x26')](handleError(_0x3dae6a,null));};exports[_0xda0c('0x5a')]=function(_0x5d29ef,_0x56741b){if(_0x5d29ef[_0xda0c('0x5b')]['id']){delete _0x5d29ef[_0xda0c('0x5b')]['id'];}return db[_0xda0c('0x3a')][_0xda0c('0x53')]({'where':{'id':_0x5d29ef[_0xda0c('0x4f')]['id']}})[_0xda0c('0x1d')](handleEntityNotFound(_0x56741b,null))[_0xda0c('0x1d')](saveUpdates(_0x5d29ef[_0xda0c('0x5b')],null))[_0xda0c('0x1d')](respondWithResult(_0x56741b,null))[_0xda0c('0x26')](handleError(_0x56741b,null));};exports[_0xda0c('0x34')]=function(_0x487195,_0x198289){return db['ChatQueue'][_0xda0c('0x53')]({'where':{'id':_0x487195[_0xda0c('0x4f')]['id']}})[_0xda0c('0x1d')](handleEntityNotFound(_0x198289,null))[_0xda0c('0x1d')](removeEntity(_0x198289,null))['catch'](handleError(_0x198289,null));};exports[_0xda0c('0x5c')]=function(_0x41ecaf,_0x3f1cfb){return db[_0xda0c('0x3a')][_0xda0c('0x5c')]()[_0xda0c('0x1d')](respondWithResult(_0x3f1cfb,null))[_0xda0c('0x26')](handleError(_0x3f1cfb,null));};exports[_0xda0c('0x5d')]=function(_0x24d430,_0x5224eb,_0x4f1aa2){var _0x5beb99={'raw':!![],'where':{}},_0x506cd8={},_0x119783;return db[_0xda0c('0x3a')]['findOne']({'where':{'id':_0x24d430[_0xda0c('0x4f')]['id']}})[_0xda0c('0x1d')](handleEntityNotFound(_0x5224eb,null))[_0xda0c('0x1d')](function(_0x45a9e9){if(_0x45a9e9){_0x119783=_0x45a9e9['get']({'plain':!![]});_0x506cd8[_0xda0c('0x3d')]=_[_0xda0c('0x51')](db[_0xda0c('0x5e')][_0xda0c('0x50')]);_0x506cd8[_0xda0c('0x3e')]=_['keys'](_0x24d430[_0xda0c('0x3e')]);_0x506cd8[_0xda0c('0x48')]=_['intersection'](_0x506cd8['model'],_0x506cd8[_0xda0c('0x3e')]);_0x5beb99[_0xda0c('0x41')]=_[_0xda0c('0x3f')](_0x506cd8['model'],qs['fields'](_0x24d430['query'][_0xda0c('0x40')]));_0x5beb99[_0xda0c('0x41')]=_0x5beb99[_0xda0c('0x41')][_0xda0c('0x42')]?_0x5beb99['attributes']:_0x506cd8['model'];if(!_0x24d430[_0xda0c('0x3e')][_0xda0c('0x43')]('nolimit')){_0x5beb99[_0xda0c('0x2d')]=qs[_0xda0c('0x2d')](_0x24d430[_0xda0c('0x3e')][_0xda0c('0x2d')]);_0x5beb99['offset']=qs['offset'](_0x24d430[_0xda0c('0x3e')][_0xda0c('0x2b')]);}_0x5beb99[_0xda0c('0x45')]=qs[_0xda0c('0x46')](_0x24d430[_0xda0c('0x3e')][_0xda0c('0x46')]);_0x5beb99[_0xda0c('0x47')]=qs[_0xda0c('0x48')](_['pick'](_0x24d430[_0xda0c('0x3e')],_0x506cd8[_0xda0c('0x48')]));_0x5beb99['where'][_0xda0c('0x5f')]=_0x45a9e9['id'];if(_0x24d430['query']['filter']){_0x5beb99[_0xda0c('0x47')]=_[_0xda0c('0x49')](_0x5beb99[_0xda0c('0x47')],{'$or':_[_0xda0c('0x39')](_0x5beb99[_0xda0c('0x41')],function(_0x387562){var _0x4ef8e9={};_0x4ef8e9[_0x387562]={'$like':'%'+_0x24d430['query']['filter']+'%'};return _0x4ef8e9;})});}_0x5beb99=_[_0xda0c('0x49')]({},_0x5beb99,_0x24d430[_0xda0c('0x4b')]);return db['UserChatQueue'][_0xda0c('0x60')](_0x5beb99);}})['then'](function(_0x28105e){if(_0x28105e){return db[_0xda0c('0x61')][_0xda0c('0x62')]({'where':{'id':_['map'](_0x28105e,_0xda0c('0x63')),'role':_0xda0c('0x64')},'attributes':['id','name','chatPause',_0xda0c('0x65'),_0xda0c('0x66')]});}})[_0xda0c('0x1d')](function(_0x28c9c3){if(_0x28c9c3){return{'count':_0x28c9c3[_0xda0c('0x2e')],'rows':_[_0xda0c('0x39')](_0x28c9c3['rows'],function(_0x494d7e){return{'membername':_0x494d7e[_0xda0c('0x37')],'UserId':_0x494d7e['id'],'queue_name':_0x119783[_0xda0c('0x37')],'ChatQueueId':_0x119783['id'],'interface':util[_0xda0c('0x67')](_0xda0c('0x68'),_0xda0c('0x69'),_0x494d7e[_0xda0c('0x37')]),'penalty':0x0,'paused':_0x494d7e[_0xda0c('0x6a')],'createdAt':_0x494d7e['createdAt'],'updatedAt':_0x494d7e[_0xda0c('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xda0c('0x1d')](respondWithFilteredResult(_0x5224eb,_0x5beb99))['catch'](handleError(_0x5224eb,null));};exports[_0xda0c('0x6b')]=function(_0x468c63,_0x42720f,_0x4f37b4){var _0x3748c9={};var _0x5944d4={};var _0x5730ac;var _0x53c337;return db[_0xda0c('0x3a')]['findOne']({'where':{'id':_0x468c63['params']['id']}})['then'](handleEntityNotFound(_0x42720f,null))['then'](function(_0x423e85){if(_0x423e85){_0x5730ac=_0x423e85;_0x5944d4[_0xda0c('0x3d')]=_[_0xda0c('0x51')](db[_0xda0c('0x6c')][_0xda0c('0x50')]);_0x5944d4[_0xda0c('0x3e')]=_[_0xda0c('0x51')](_0x468c63[_0xda0c('0x3e')]);_0x5944d4[_0xda0c('0x48')]=_[_0xda0c('0x3f')](_0x5944d4[_0xda0c('0x3d')],_0x5944d4[_0xda0c('0x3e')]);_0x3748c9[_0xda0c('0x41')]=_[_0xda0c('0x3f')](_0x5944d4[_0xda0c('0x3d')],qs[_0xda0c('0x40')](_0x468c63[_0xda0c('0x3e')]['fields']));_0x3748c9[_0xda0c('0x41')]=_0x3748c9['attributes'][_0xda0c('0x42')]?_0x3748c9[_0xda0c('0x41')]:_0x5944d4['model'];_0x3748c9['order']=qs['sort'](_0x468c63[_0xda0c('0x3e')]['sort']);_0x3748c9[_0xda0c('0x47')]=qs[_0xda0c('0x48')](_['pick'](_0x468c63[_0xda0c('0x3e')],_0x5944d4['filters']));if(_0x468c63['query'][_0xda0c('0x4a')]){_0x3748c9[_0xda0c('0x47')]=_[_0xda0c('0x49')](_0x3748c9['where'],{'$or':_['map'](_0x3748c9['attributes'],function(_0x4572f9){var _0x15bdb8={};_0x15bdb8[_0x4572f9]={'$like':'%'+_0x468c63['query'][_0xda0c('0x4a')]+'%'};return _0x15bdb8;})});}_0x3748c9=_[_0xda0c('0x49')]({},_0x3748c9,_0x468c63[_0xda0c('0x4b')]);return _0x5730ac[_0xda0c('0x6b')](_0x3748c9);}})['then'](function(_0x115b1e){if(_0x115b1e){_0x53c337=_0x115b1e[_0xda0c('0x42')];if(!_0x468c63[_0xda0c('0x3e')][_0xda0c('0x43')](_0xda0c('0x44'))){_0x3748c9[_0xda0c('0x2d')]=qs[_0xda0c('0x2d')](_0x468c63[_0xda0c('0x3e')][_0xda0c('0x2d')]);_0x3748c9['offset']=qs[_0xda0c('0x2b')](_0x468c63[_0xda0c('0x3e')]['offset']);}return _0x5730ac[_0xda0c('0x6b')](_0x3748c9);}})['then'](function(_0x4c338f){if(_0x4c338f){return _0x4c338f?{'count':_0x53c337,'rows':_0x4c338f}:null;}})[_0xda0c('0x1d')](respondWithResult(_0x42720f,null))[_0xda0c('0x26')](handleError(_0x42720f,null));};exports[_0xda0c('0x6d')]=function(_0x1ceb38,_0x1774cb,_0x573da3){var _0x2efe8c=_0x1ceb38[_0xda0c('0x5b')][_0xda0c('0x6e')];return db[_0xda0c('0x6c')][_0xda0c('0x60')]({'where':{'id':_0x2efe8c},'attributes':['id'],'include':[{'model':db[_0xda0c('0x61')],'as':'Agents','attributes':['id',_0xda0c('0x37'),_0xda0c('0x6f'),_0xda0c('0x70'),'interface'],'raw':!![]}]})[_0xda0c('0x1d')](function(_0x14c95e){if(_0x14c95e){var _0xe2908d=_[_0xda0c('0x71')](_0x14c95e,function(_0x13c34e){var _0x4f247f=_0x13c34e['get']({'plain':!![]});return _0x4f247f['Agents'];});return db[_0xda0c('0x3a')]['find']({'where':{'id':_0x1ceb38[_0xda0c('0x4f')]['id']}})[_0xda0c('0x1d')](function(_0x2fb0a5){return db['sequelize'][_0xda0c('0x72')](function(_0x2b822d){return _0x2fb0a5[_0xda0c('0x6d')](_0x2efe8c,{'transaction':_0x2b822d})[_0xda0c('0x1d')](function(){return BPromise[_0xda0c('0x73')](_0xe2908d,function(_0x239022){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x239022['id'],'ChatQueueId':_0x1ceb38[_0xda0c('0x4f')]['id']},'transaction':_0x2b822d});});})[_0xda0c('0x1d')](function(){_0xe2908d[_0xda0c('0x74')](function(_0xab3abb){socket[_0xda0c('0x75')](_0xda0c('0x76'),{'UserId':_0xab3abb['id'],'ChatQueueId':_0x2fb0a5['id']});});});});});}})['then'](respondWithStatusCode(_0x1774cb,null))['catch'](handleError(_0x1774cb,null));};exports[_0xda0c('0x77')]=function(_0x20dc06,_0x2eb91d,_0x4b7178){return db[_0xda0c('0x6c')][_0xda0c('0x60')]({'where':{'id':_0x20dc06[_0xda0c('0x3e')][_0xda0c('0x6e')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xda0c('0x1d')](handleEntityNotFound(_0x2eb91d,null))['then'](function(_0x520a41){var _0x16613f=_[_0xda0c('0x39')](_0x520a41,'id');var _0x2cd342=[];var _0x3df11a=[];var _0x1a6d83=squel['select']();_0x1a6d83['field']('tq.TeamId')[_0xda0c('0x78')](_0xda0c('0x79'),'tq')[_0xda0c('0x7a')](_0xda0c('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xda0c('0x47')]('ChatQueueId\x20=\x20?',_0x20dc06[_0xda0c('0x4f')]['id']);for(var _0x33f5cc=0x0;_0x33f5cc<_0x520a41['length'];_0x33f5cc+=0x1){let _0x1256d0=_0x520a41[_0x33f5cc];for(var _0x2bb619=0x0;_0x2bb619<_0x1256d0[_0xda0c('0x7c')]['length'];_0x2bb619+=0x1){let _0x50b711=_0x1256d0['Agents'][_0x2bb619];var _0x3977e8=_0x1a6d83[_0xda0c('0x7d')]();_0x3977e8[_0xda0c('0x47')](_0xda0c('0x7e'),_0x50b711['id']);_0x3df11a[_0xda0c('0x7f')](db[_0xda0c('0x80')][_0xda0c('0x3e')](_0x3977e8[_0xda0c('0x81')](),{'type':db[_0xda0c('0x80')][_0xda0c('0x82')]['SELECT']})[_0xda0c('0x1d')](function(_0x23738e){if(_0x23738e['length']===0x1){return _0x50b711['id'];}else{var _0x21383a=_[_0xda0c('0x83')](_[_0xda0c('0x39')](_0x23738e,_0xda0c('0x84')),function(_0x41b3b2){return _['includes'](_0x16613f,_0x41b3b2);});if(_0x21383a){return _0x50b711['id'];}}}));}}return BPromise[_0xda0c('0x85')](_0x3df11a)[_0xda0c('0x1d')](function(_0x8415d9){_0x2cd342=_(_0x2cd342)[_0xda0c('0x86')](_0x8415d9)[_0xda0c('0x87')]()[_0xda0c('0x88')]();return db['ChatQueue'][_0xda0c('0x53')]({'where':{'id':_0x20dc06[_0xda0c('0x4f')]['id']}})[_0xda0c('0x1d')](function(_0x5ee4bb){return db[_0xda0c('0x80')]['transaction'](function(_0x5f202d){return _0x5ee4bb[_0xda0c('0x77')](_0x20dc06[_0xda0c('0x3e')][_0xda0c('0x6e')],{'transaction':_0x5f202d})['then'](function(){if(!_['isEmpty'](_0x2cd342)){return _0x5ee4bb[_0xda0c('0x89')](_0x2cd342,{'transaction':_0x5f202d});}})[_0xda0c('0x1d')](function(){_0x2cd342[_0xda0c('0x74')](function(_0x5007de){socket[_0xda0c('0x75')]('userChatQueue:remove',{'UserId':_0x5007de,'ChatQueueId':_0x5ee4bb['id']});});});});});});})[_0xda0c('0x1d')](respondWithStatusCode(_0x2eb91d,null))[_0xda0c('0x26')](handleError(_0x2eb91d,null));};exports[_0xda0c('0x8a')]=function(_0x4d80f5,_0x44bd62,_0x3d78a5){return db[_0xda0c('0x3a')]['find']({'where':{'id':_0x4d80f5['params']['id']}})[_0xda0c('0x1d')](handleEntityNotFound(_0x44bd62,null))[_0xda0c('0x1d')](function(_0x2ede92){if(_0x2ede92){return _0x2ede92[_0xda0c('0x8a')](_0x4d80f5[_0xda0c('0x5b')][_0xda0c('0x6e')],_[_0xda0c('0x8b')](_0x4d80f5[_0xda0c('0x5b')],[_0xda0c('0x6e'),'id'])||{})[_0xda0c('0x8c')](function(_0x313d2b){for(var _0x20f5cd=0x0;_0x20f5cd<_0x4d80f5['body'][_0xda0c('0x6e')][_0xda0c('0x42')];_0x20f5cd+=0x1){socket['emit'](_0xda0c('0x76'),{'UserId':Number(_0x4d80f5[_0xda0c('0x5b')][_0xda0c('0x6e')][_0x20f5cd]),'ChatQueueId':Number(_0x4d80f5['params']['id'])});}return _0x313d2b;});}})['then'](respondWithResult(_0x44bd62,null))[_0xda0c('0x26')](handleError(_0x44bd62,null));};exports[_0xda0c('0x89')]=function(_0x183204,_0x4968b5,_0x555687){return db[_0xda0c('0x3a')][_0xda0c('0x53')]({'where':{'id':_0x183204[_0xda0c('0x4f')]['id']}})[_0xda0c('0x1d')](handleEntityNotFound(_0x4968b5,null))['then'](function(_0x58e205){if(_0x58e205){return _0x58e205['removeAgents'](_0x183204['query'][_0xda0c('0x6e')])[_0xda0c('0x1d')](function(){if(_[_0xda0c('0x8d')](_0x183204[_0xda0c('0x3e')][_0xda0c('0x6e')])){for(var _0x25619d=0x0;_0x25619d<_0x183204[_0xda0c('0x3e')][_0xda0c('0x6e')][_0xda0c('0x42')];_0x25619d+=0x1){socket[_0xda0c('0x75')]('userChatQueue:remove',{'UserId':Number(_0x183204[_0xda0c('0x3e')]['ids'][_0x25619d]),'ChatQueueId':Number(_0x183204[_0xda0c('0x4f')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x183204[_0xda0c('0x3e')][_0xda0c('0x6e')]),'ChatQueueId':Number(_0x183204[_0xda0c('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x4968b5,null))[_0xda0c('0x26')](handleError(_0x4968b5,null));};exports[_0xda0c('0x8e')]=function(_0x24e860,_0x2dcde1,_0x23ec1c){var _0x897770={};var _0x57256d={};var _0x24754f;var _0x2550f9;return db[_0xda0c('0x3a')][_0xda0c('0x8f')]({'where':{'id':_0x24e860[_0xda0c('0x4f')]['id']}})[_0xda0c('0x1d')](handleEntityNotFound(_0x2dcde1,null))[_0xda0c('0x1d')](function(_0x14ea24){if(_0x14ea24){_0x24754f=_0x14ea24;_0x57256d['model']=_[_0xda0c('0x51')](db['User'][_0xda0c('0x50')]);_0x57256d[_0xda0c('0x3e')]=_[_0xda0c('0x51')](_0x24e860['query']);_0x57256d[_0xda0c('0x48')]=_['intersection'](_0x57256d[_0xda0c('0x3d')],_0x57256d[_0xda0c('0x3e')]);_0x897770['attributes']=_[_0xda0c('0x3f')](_0x57256d[_0xda0c('0x3d')],qs[_0xda0c('0x40')](_0x24e860[_0xda0c('0x3e')][_0xda0c('0x40')]));_0x897770['attributes']=_0x897770[_0xda0c('0x41')][_0xda0c('0x42')]?_0x897770[_0xda0c('0x41')]:_0x57256d[_0xda0c('0x3d')];_0x897770['order']=qs[_0xda0c('0x46')](_0x24e860[_0xda0c('0x3e')]['sort']);_0x897770[_0xda0c('0x47')]=qs[_0xda0c('0x48')](_[_0xda0c('0x90')](_0x24e860[_0xda0c('0x3e')],_0x57256d['filters']));if(_0x24e860['query'][_0xda0c('0x4a')]){_0x897770['where']=_['merge'](_0x897770[_0xda0c('0x47')],{'$or':_[_0xda0c('0x39')](_0x897770['attributes'],function(_0x184193){var _0x57764a={};_0x57764a[_0x184193]={'$like':'%'+_0x24e860[_0xda0c('0x3e')][_0xda0c('0x4a')]+'%'};return _0x57764a;})});}_0x897770=_['merge']({},_0x897770,_0x24e860[_0xda0c('0x4b')]);return _0x24754f[_0xda0c('0x8e')](_0x897770);}})[_0xda0c('0x1d')](function(_0x3f797c){if(_0x3f797c){_0x2550f9=_0x3f797c[_0xda0c('0x42')];if(!_0x24e860[_0xda0c('0x3e')][_0xda0c('0x43')](_0xda0c('0x44'))){_0x897770[_0xda0c('0x2d')]=qs[_0xda0c('0x2d')](_0x24e860[_0xda0c('0x3e')][_0xda0c('0x2d')]);_0x897770[_0xda0c('0x2b')]=qs['offset'](_0x24e860[_0xda0c('0x3e')][_0xda0c('0x2b')]);}return _0x24754f[_0xda0c('0x8e')](_0x897770);}})[_0xda0c('0x1d')](function(_0x324926){if(_0x324926){return _0x324926?{'count':_0x2550f9,'rows':_0x324926}:null;}})['then'](respondWithResult(_0x2dcde1,null))[_0xda0c('0x26')](handleError(_0x2dcde1,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index cb48512..83894e0 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 _0xbc6c=['exports','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0xbc6c,0x1b1));var _0xcbc6=function(_0x157e54,_0x1c14ab){_0x157e54=_0x157e54-0x0;var _0x8a1271=_0xbc6c[_0x157e54];return _0x8a1271;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xcbc6('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcbc6('0x1'),'afterUpdate':_0xcbc6('0x2'),'afterDestroy':_0xcbc6('0x3')};function emitEvent(_0x20205f){return function(_0x40f649,_0x35bf9e,_0x4dfe4e){ChatQueueEvents[_0xcbc6('0x4')](_0x20205f+':'+_0x40f649['id'],_0x40f649);ChatQueueEvents['emit'](_0x20205f,_0x40f649);_0x4dfe4e(null);};}for(var e in events){if(events[_0xcbc6('0x5')](e)){var event=events[e];ChatQueue[_0xcbc6('0x6')](e,emitEvent(event));}}module[_0xcbc6('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xc641=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x4e2198,_0x399d54){var _0x22fdd7=function(_0x2fc7d0){while(--_0x2fc7d0){_0x4e2198['push'](_0x4e2198['shift']());}};_0x22fdd7(++_0x399d54);}(_0xc641,0xea));var _0x1c64=function(_0x221e3d,_0x2e84b7){_0x221e3d=_0x221e3d-0x0;var _0x5e207b=_0xc641[_0x221e3d];return _0x5e207b;};'use strict';var EventEmitter=require(_0x1c64('0x0'));var ChatQueue=require(_0x1c64('0x1'))['db'][_0x1c64('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x1c64('0x3')](0x0);var events={'afterCreate':_0x1c64('0x4'),'afterUpdate':_0x1c64('0x5'),'afterDestroy':_0x1c64('0x6')};function emitEvent(_0x3c503b){return function(_0x2b735f,_0xf5a22e,_0x214498){ChatQueueEvents['emit'](_0x3c503b+':'+_0x2b735f['id'],_0x2b735f);ChatQueueEvents[_0x1c64('0x7')](_0x3c503b,_0x2b735f);_0x214498(null);};}for(var e in events){if(events[_0x1c64('0x8')](e)){var event=events[e];ChatQueue[_0x1c64('0x9')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 7786816..556cb6d 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 _0xb566=['chat_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0xb566,0x83));var _0x6b56=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0xb566[_0x46361e];return _0x14e302;};'use strict';var _=require(_0x6b56('0x0'));var util=require('util');var logger=require(_0x6b56('0x1'))(_0x6b56('0x2'));var moment=require('moment');var BPromise=require(_0x6b56('0x3'));var rp=require(_0x6b56('0x4'));var fs=require('fs');var path=require(_0x6b56('0x5'));var rimraf=require(_0x6b56('0x6'));var config=require(_0x6b56('0x7'));var attributes=require(_0x6b56('0x8'));module[_0x6b56('0x9')]=function(_0x1b2558,_0x1f9457){return _0x1b2558[_0x6b56('0xa')](_0x6b56('0xb'),attributes,{'tableName':_0x6b56('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc309=['ChatQueue','chat_queues','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x327cb4,_0x40fb5e){var _0x5b9ec8=function(_0x3c6a2a){while(--_0x3c6a2a){_0x327cb4['push'](_0x327cb4['shift']());}};_0x5b9ec8(++_0x40fb5e);}(_0xc309,0x18e));var _0x9c30=function(_0x2967ad,_0x12f152){_0x2967ad=_0x2967ad-0x0;var _0x553577=_0xc309[_0x2967ad];return _0x553577;};'use strict';var _=require(_0x9c30('0x0'));var util=require(_0x9c30('0x1'));var logger=require(_0x9c30('0x2'))('api');var moment=require(_0x9c30('0x3'));var BPromise=require(_0x9c30('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c30('0x5'));var rimraf=require(_0x9c30('0x6'));var config=require(_0x9c30('0x7'));var attributes=require(_0x9c30('0x8'));module['exports']=function(_0x31b24c,_0x29906c){return _0x31b24c['define'](_0x9c30('0x9'),attributes,{'tableName':_0x9c30('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index c5d2446..f968a6c 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 _0xb847=['http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowChatQueue','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb847,0x17e));var _0x7b84=function(_0x41d364,_0xdfdc1a){_0x41d364=_0x41d364-0x0;var _0x5ace98=_0xb847[_0x41d364];return _0x5ace98;};'use strict';var _=require(_0x7b84('0x0'));var util=require(_0x7b84('0x1'));var moment=require('moment');var BPromise=require(_0x7b84('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b84('0x3'));var db=require(_0x7b84('0x4'))['db'];var utils=require(_0x7b84('0x5'));var logger=require(_0x7b84('0x6'))(_0x7b84('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7b84('0x8')]({'port':0x232a});config[_0x7b84('0x9')]=_[_0x7b84('0xa')](config[_0x7b84('0x9')],{'host':_0x7b84('0xb'),'port':0x18eb});var socket=require(_0x7b84('0xc'))(new Redis(config[_0x7b84('0x9')]));require(_0x7b84('0xd'))[_0x7b84('0xe')](socket);function respondWithRpcPromise(_0x5c5d19,_0x20d3a6,_0x2677c2){return new BPromise(function(_0x21b420,_0x47e2f0){return client['request'](_0x5c5d19,_0x2677c2)[_0x7b84('0xf')](function(_0x5a7c18){logger[_0x7b84('0x10')](_0x7b84('0x11'),_0x20d3a6,_0x7b84('0x12'));logger[_0x7b84('0x13')](_0x7b84('0x14'),_0x20d3a6,'request\x20sent',JSON['stringify'](_0x5a7c18));if(_0x5a7c18['error']){if(_0x5a7c18[_0x7b84('0x15')][_0x7b84('0x16')]===0x1f4){logger[_0x7b84('0x15')](_0x7b84('0x11'),_0x20d3a6,_0x5a7c18[_0x7b84('0x15')][_0x7b84('0x17')]);return _0x47e2f0(_0x5a7c18[_0x7b84('0x15')][_0x7b84('0x17')]);}logger[_0x7b84('0x15')](_0x7b84('0x11'),_0x20d3a6,_0x5a7c18[_0x7b84('0x15')][_0x7b84('0x17')]);return _0x21b420(_0x5a7c18[_0x7b84('0x15')][_0x7b84('0x17')]);}else{logger[_0x7b84('0x10')]('ChatQueue,\x20%s,\x20%s',_0x20d3a6,'request\x20sent');_0x21b420(_0x5a7c18[_0x7b84('0x18')][_0x7b84('0x17')]);}})['catch'](function(_0x52058d){logger['error'](_0x7b84('0x11'),_0x20d3a6,_0x52058d);_0x47e2f0(_0x52058d);});});}exports[_0x7b84('0x19')]=function(_0x35121e){var _0x467132=this;return new Promise(function(_0x1f6edf,_0x2239ba){return db[_0x7b84('0x1a')][_0x7b84('0x1b')]({'raw':_0x35121e['options']?_0x35121e[_0x7b84('0x1c')][_0x7b84('0x1d')]===undefined?!![]:![]:!![],'where':_0x35121e[_0x7b84('0x1c')]?_0x35121e['options'][_0x7b84('0x1e')]||null:null,'attributes':_0x35121e[_0x7b84('0x1c')]?_0x35121e['options'][_0x7b84('0x1f')]||null:null,'limit':_0x35121e['options']?_0x35121e[_0x7b84('0x1c')][_0x7b84('0x20')]||null:null,'include':_0x35121e[_0x7b84('0x1c')]?_0x35121e['options']['include']?_['map'](_0x35121e[_0x7b84('0x1c')][_0x7b84('0x21')],function(_0x5abb6e){return{'model':db[_0x5abb6e[_0x7b84('0x22')]],'as':_0x5abb6e['as'],'attributes':_0x5abb6e[_0x7b84('0x1f')],'include':_0x5abb6e['include']?_['map'](_0x5abb6e['include'],function(_0x3bea0c){return{'model':db[_0x3bea0c[_0x7b84('0x22')]],'as':_0x3bea0c['as'],'attributes':_0x3bea0c[_0x7b84('0x1f')],'include':_0x3bea0c[_0x7b84('0x21')]?_[_0x7b84('0x23')](_0x3bea0c['include'],function(_0x50fd74){return{'model':db[_0x50fd74['model']],'as':_0x50fd74['as'],'attributes':_0x50fd74['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b84('0xf')](function(_0x2903f2){logger['info'](_0x7b84('0x19'),_0x35121e);logger[_0x7b84('0x13')](_0x7b84('0x19'),_0x35121e,JSON['stringify'](_0x2903f2));_0x1f6edf(_0x2903f2);})[_0x7b84('0x24')](function(_0x5c836e){logger[_0x7b84('0x15')](_0x7b84('0x19'),_0x5c836e['message'],_0x35121e);_0x2239ba(_0x467132[_0x7b84('0x15')](0x1f4,_0x5c836e['message']));});});};exports[_0x7b84('0x25')]=function(_0x193095){var _0x20c388=this;return new Promise(function(_0x11eb5e,_0x287e6e){return db['ChatQueue'][_0x7b84('0x26')]({'raw':_0x193095['options']?_0x193095[_0x7b84('0x1c')][_0x7b84('0x1d')]===undefined?!![]:![]:!![],'where':_0x193095['options']?_0x193095[_0x7b84('0x1c')][_0x7b84('0x1e')]||null:null,'attributes':_0x193095[_0x7b84('0x1c')]?_0x193095[_0x7b84('0x1c')]['attributes']||null:null,'include':_0x193095['options']?_0x193095[_0x7b84('0x1c')][_0x7b84('0x21')]?_[_0x7b84('0x23')](_0x193095['options'][_0x7b84('0x21')],function(_0xa8220e){return{'model':db[_0xa8220e[_0x7b84('0x22')]],'as':_0xa8220e['as'],'attributes':_0xa8220e[_0x7b84('0x1f')],'include':_0xa8220e[_0x7b84('0x21')]?_['map'](_0xa8220e[_0x7b84('0x21')],function(_0x5d5c70){return{'model':db[_0x5d5c70[_0x7b84('0x22')]],'as':_0x5d5c70['as'],'attributes':_0x5d5c70[_0x7b84('0x1f')],'include':_0x5d5c70[_0x7b84('0x21')]?_[_0x7b84('0x23')](_0x5d5c70['include'],function(_0x148504){return{'model':db[_0x148504[_0x7b84('0x22')]],'as':_0x148504['as'],'attributes':_0x148504[_0x7b84('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7b84('0xf')](function(_0x34f4f3){logger[_0x7b84('0x10')]('ShowChatQueue',_0x193095);logger['debug'](_0x7b84('0x25'),_0x193095,JSON['stringify'](_0x34f4f3));_0x11eb5e(_0x34f4f3);})[_0x7b84('0x24')](function(_0x12fb73){logger[_0x7b84('0x15')](_0x7b84('0x25'),_0x12fb73['message'],_0x193095);_0x287e6e(_0x20c388[_0x7b84('0x15')](0x1f4,_0x12fb73['message']));});});}; \ No newline at end of file +var _0xf274=['redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','map','model','ShowChatQueue','find','include','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xf274,0x99));var _0x4f27=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf274[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x4f27('0x0'));var moment=require(_0x4f27('0x1'));var BPromise=require(_0x4f27('0x2'));var rs=require(_0x4f27('0x3'));var fs=require('fs');var Redis=require(_0x4f27('0x4'));var db=require(_0x4f27('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f27('0x6'))(_0x4f27('0x7'));var config=require(_0x4f27('0x8'));var jayson=require(_0x4f27('0x9'));var client=jayson[_0x4f27('0xa')]['http']({'port':0x232a});config[_0x4f27('0xb')]=_[_0x4f27('0xc')](config[_0x4f27('0xb')],{'host':_0x4f27('0xd'),'port':0x18eb});var socket=require(_0x4f27('0xe'))(new Redis(config[_0x4f27('0xb')]));require(_0x4f27('0xf'))['register'](socket);function respondWithRpcPromise(_0x5d2624,_0x150414,_0x1eb796){return new BPromise(function(_0x4f4640,_0x211294){return client[_0x4f27('0x10')](_0x5d2624,_0x1eb796)[_0x4f27('0x11')](function(_0x3f395b){logger['info'](_0x4f27('0x12'),_0x150414,_0x4f27('0x13'));logger[_0x4f27('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x150414,_0x4f27('0x13'),JSON[_0x4f27('0x15')](_0x3f395b));if(_0x3f395b[_0x4f27('0x16')]){if(_0x3f395b[_0x4f27('0x16')][_0x4f27('0x17')]===0x1f4){logger[_0x4f27('0x16')](_0x4f27('0x12'),_0x150414,_0x3f395b[_0x4f27('0x16')][_0x4f27('0x18')]);return _0x211294(_0x3f395b[_0x4f27('0x16')][_0x4f27('0x18')]);}logger[_0x4f27('0x16')](_0x4f27('0x12'),_0x150414,_0x3f395b['error'][_0x4f27('0x18')]);return _0x4f4640(_0x3f395b['error'][_0x4f27('0x18')]);}else{logger[_0x4f27('0x19')](_0x4f27('0x12'),_0x150414,_0x4f27('0x13'));_0x4f4640(_0x3f395b[_0x4f27('0x1a')][_0x4f27('0x18')]);}})[_0x4f27('0x1b')](function(_0x4d6fb3){logger[_0x4f27('0x16')]('ChatQueue,\x20%s,\x20%s',_0x150414,_0x4d6fb3);_0x211294(_0x4d6fb3);});});}exports[_0x4f27('0x1c')]=function(_0x29a177){var _0x6cb587=this;return new Promise(function(_0x426ac7,_0x57c89f){return db[_0x4f27('0x1d')][_0x4f27('0x1e')]({'raw':_0x29a177[_0x4f27('0x1f')]?_0x29a177[_0x4f27('0x1f')][_0x4f27('0x20')]===undefined?!![]:![]:!![],'where':_0x29a177[_0x4f27('0x1f')]?_0x29a177['options'][_0x4f27('0x21')]||null:null,'attributes':_0x29a177[_0x4f27('0x1f')]?_0x29a177['options'][_0x4f27('0x22')]||null:null,'limit':_0x29a177['options']?_0x29a177[_0x4f27('0x1f')][_0x4f27('0x23')]||null:null,'include':_0x29a177[_0x4f27('0x1f')]?_0x29a177[_0x4f27('0x1f')]['include']?_[_0x4f27('0x24')](_0x29a177[_0x4f27('0x1f')]['include'],function(_0x185ba2){return{'model':db[_0x185ba2[_0x4f27('0x25')]],'as':_0x185ba2['as'],'attributes':_0x185ba2[_0x4f27('0x22')],'include':_0x185ba2['include']?_[_0x4f27('0x24')](_0x185ba2['include'],function(_0x4652dd){return{'model':db[_0x4652dd['model']],'as':_0x4652dd['as'],'attributes':_0x4652dd[_0x4f27('0x22')],'include':_0x4652dd['include']?_[_0x4f27('0x24')](_0x4652dd['include'],function(_0x539ac9){return{'model':db[_0x539ac9[_0x4f27('0x25')]],'as':_0x539ac9['as'],'attributes':_0x539ac9[_0x4f27('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36d787){logger['info'](_0x4f27('0x1c'),_0x29a177);logger[_0x4f27('0x14')](_0x4f27('0x1c'),_0x29a177,JSON[_0x4f27('0x15')](_0x36d787));_0x426ac7(_0x36d787);})['catch'](function(_0x5b02d3){logger[_0x4f27('0x16')](_0x4f27('0x1c'),_0x5b02d3['message'],_0x29a177);_0x57c89f(_0x6cb587['error'](0x1f4,_0x5b02d3[_0x4f27('0x18')]));});});};exports[_0x4f27('0x26')]=function(_0x3cf621){var _0x4d514b=this;return new Promise(function(_0x47d415,_0x4886b9){return db['ChatQueue'][_0x4f27('0x27')]({'raw':_0x3cf621['options']?_0x3cf621['options'][_0x4f27('0x20')]===undefined?!![]:![]:!![],'where':_0x3cf621[_0x4f27('0x1f')]?_0x3cf621[_0x4f27('0x1f')][_0x4f27('0x21')]||null:null,'attributes':_0x3cf621[_0x4f27('0x1f')]?_0x3cf621[_0x4f27('0x1f')]['attributes']||null:null,'include':_0x3cf621[_0x4f27('0x1f')]?_0x3cf621[_0x4f27('0x1f')][_0x4f27('0x28')]?_[_0x4f27('0x24')](_0x3cf621['options']['include'],function(_0x27ec74){return{'model':db[_0x27ec74[_0x4f27('0x25')]],'as':_0x27ec74['as'],'attributes':_0x27ec74[_0x4f27('0x22')],'include':_0x27ec74[_0x4f27('0x28')]?_[_0x4f27('0x24')](_0x27ec74[_0x4f27('0x28')],function(_0x45ce84){return{'model':db[_0x45ce84['model']],'as':_0x45ce84['as'],'attributes':_0x45ce84[_0x4f27('0x22')],'include':_0x45ce84[_0x4f27('0x28')]?_[_0x4f27('0x24')](_0x45ce84[_0x4f27('0x28')],function(_0x363843){return{'model':db[_0x363843[_0x4f27('0x25')]],'as':_0x363843['as'],'attributes':_0x363843['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5afea9){logger['info'](_0x4f27('0x26'),_0x3cf621);logger[_0x4f27('0x14')](_0x4f27('0x26'),_0x3cf621,JSON[_0x4f27('0x15')](_0x5afea9));_0x47d415(_0x5afea9);})[_0x4f27('0x1b')](function(_0x102b13){logger[_0x4f27('0x16')]('ShowChatQueue',_0x102b13[_0x4f27('0x18')],_0x3cf621);_0x4886b9(_0x4d514b[_0x4f27('0x16')](0x1f4,_0x102b13['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 4d90715..752f38c 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 _0x81bd=['save','remove','update','removeListener','./chatQueue.events'];(function(_0x1d2ef2,_0x1a7599){var _0x345183=function(_0x21384d){while(--_0x21384d){_0x1d2ef2['push'](_0x1d2ef2['shift']());}};_0x345183(++_0x1a7599);}(_0x81bd,0x7c));var _0xd81b=function(_0x4441cf,_0x4509a6){_0x4441cf=_0x4441cf-0x0;var _0x3b8877=_0x81bd[_0x4441cf];return _0x3b8877;};'use strict';var ChatQueueEvents=require(_0xd81b('0x0'));var events=[_0xd81b('0x1'),_0xd81b('0x2'),_0xd81b('0x3')];function createListener(_0x2d27cb,_0x2ec03a){return function(_0x111a9c){_0x2ec03a['emit'](_0x2d27cb,_0x111a9c);};}function removeListener(_0x16e8de,_0x2c3d9e){return function(){ChatQueueEvents[_0xd81b('0x4')](_0x16e8de,_0x2c3d9e);};}exports['register']=function(_0x42a0aa){for(var _0x34eb73=0x0,_0x1f3f2c=events['length'];_0x34eb73<_0x1f3f2c;_0x34eb73++){var _0x5e14e8=events[_0x34eb73];var _0xa4cf97=createListener('chatQueue:'+_0x5e14e8,_0x42a0aa);ChatQueueEvents['on'](_0x5e14e8,_0xa4cf97);}}; \ No newline at end of file +var _0xe107=['remove','update','removeListener','register','length','./chatQueue.events'];(function(_0x1cbb0e,_0x4a6c9a){var _0xd18a94=function(_0x4754c4){while(--_0x4754c4){_0x1cbb0e['push'](_0x1cbb0e['shift']());}};_0xd18a94(++_0x4a6c9a);}(_0xe107,0xb3));var _0x7e10=function(_0x512ce0,_0x43563d){_0x512ce0=_0x512ce0-0x0;var _0xe26d9a=_0xe107[_0x512ce0];return _0xe26d9a;};'use strict';var ChatQueueEvents=require(_0x7e10('0x0'));var events=['save',_0x7e10('0x1'),_0x7e10('0x2')];function createListener(_0x2871b0,_0x570b2a){return function(_0x31212d){_0x570b2a['emit'](_0x2871b0,_0x31212d);};}function removeListener(_0x4db676,_0x2bdf3c){return function(){ChatQueueEvents[_0x7e10('0x3')](_0x4db676,_0x2bdf3c);};}exports[_0x7e10('0x4')]=function(_0x5be19f){for(var _0x5f1edf=0x0,_0x1dd3de=events[_0x7e10('0x5')];_0x5f1edf<_0x1dd3de;_0x5f1edf++){var _0x156c56=events[_0x5f1edf];var _0x3413f7=createListener('chatQueue:'+_0x156c56,_0x5be19f);ChatQueueEvents['on'](_0x156c56,_0x3413f7);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 111e058..a3f838d 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 _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x5fc3,0xa8));var _0x35fc=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x5fc3[_0x533110];return _0xc3c866;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=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(_0x371a1d,_0x30cf66){var _0x40afb9=function(_0x3618db){while(--_0x3618db){_0x371a1d['push'](_0x371a1d['shift']());}};_0x40afb9(++_0x30cf66);}(_0x55ca,0x126));var _0xa55c=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0x55ca[_0x12c280];return _0x3638d3;};'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 667713d..ca69e17 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 _0x36c3=['STRING','DATE','sequelize','exports'];(function(_0x2552b9,_0x5e66f7){var _0x54394e=function(_0x26993e){while(--_0x26993e){_0x2552b9['push'](_0x2552b9['shift']());}};_0x54394e(++_0x5e66f7);}(_0x36c3,0x132));var _0x336c=function(_0x10d244,_0x49c680){_0x10d244=_0x10d244-0x0;var _0x67755d=_0x36c3[_0x10d244];return _0x67755d;};'use strict';var moment=require('moment');var Sequelize=require(_0x336c('0x0'));module[_0x336c('0x1')]={'uniqueid':{'type':Sequelize[_0x336c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x336c('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x336c('0x3')]},'acceptAt':{'type':Sequelize[_0x336c('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x336c('0x2')]}}; \ No newline at end of file +var _0x5ec0=['exports','DATE','moment'];(function(_0x47bc66,_0x4cdd4f){var _0x520611=function(_0x2ecbf4){while(--_0x2ecbf4){_0x47bc66['push'](_0x47bc66['shift']());}};_0x520611(++_0x4cdd4f);}(_0x5ec0,0x10d));var _0x05ec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5ec0[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x05ec('0x0'));var Sequelize=require('sequelize');module[_0x05ec('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x05ec('0x2')]},'acceptAt':{'type':Sequelize[_0x05ec('0x2')]},'exitAt':{'type':Sequelize[_0x05ec('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index cf90988..425516c 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 _0x9ab0=['length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x5b5ffe,_0x1c5874){var _0x2d12bc=function(_0x14d075){while(--_0x14d075){_0x5b5ffe['push'](_0x5b5ffe['shift']());}};_0x2d12bc(++_0x1c5874);}(_0x9ab0,0x195));var _0x09ab=function(_0x53a441,_0x1760aa){_0x53a441=_0x53a441-0x0;var _0xea5ff9=_0x9ab0[_0x53a441];return _0xea5ff9;};'use strict';var emlformat=require(_0x09ab('0x0'));var rimraf=require(_0x09ab('0x1'));var zipdir=require(_0x09ab('0x2'));var jsonpatch=require(_0x09ab('0x3'));var rp=require(_0x09ab('0x4'));var moment=require(_0x09ab('0x5'));var BPromise=require(_0x09ab('0x6'));var Mustache=require(_0x09ab('0x7'));var util=require(_0x09ab('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x09ab('0x9'));var fs=require('fs');var fs_extra=require(_0x09ab('0xa'));var _=require(_0x09ab('0xb'));var squel=require(_0x09ab('0xc'));var crypto=require(_0x09ab('0xd'));var jsforce=require(_0x09ab('0xe'));var deskjs=require(_0x09ab('0xf'));var toCsv=require(_0x09ab('0x10'));var querystring=require(_0x09ab('0x11'));var Papa=require('papaparse');var Redis=require(_0x09ab('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x09ab('0x13'));var as=require(_0x09ab('0x14'));var hardwareService=require(_0x09ab('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x09ab('0x16'));var config=require(_0x09ab('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cd3d7,_0x1a667a){_0x1a667a=_0x1a667a||0xcc;return function(_0x367bc4){if(_0x367bc4){return _0x3cd3d7[_0x09ab('0x18')](_0x1a667a);}return _0x3cd3d7[_0x09ab('0x19')](_0x1a667a)[_0x09ab('0x1a')]();};}function respondWithResult(_0x18ecda,_0x25bb6b){_0x25bb6b=_0x25bb6b||0xc8;return function(_0x10971){if(_0x10971){return _0x18ecda[_0x09ab('0x19')](_0x25bb6b)[_0x09ab('0x1b')](_0x10971);}};}function respondWithFilteredResult(_0x27cf42,_0x5ac9da){return function(_0x24db01){if(_0x24db01){var _0x3ff3b2=typeof _0x5ac9da[_0x09ab('0x1c')]==='undefined'&&typeof _0x5ac9da[_0x09ab('0x1d')]===_0x09ab('0x1e');var _0x2f75a8=_0x24db01['count'];var _0x3d77d6=_0x3ff3b2?0x0:_0x5ac9da[_0x09ab('0x1c')];var _0x88f781=_0x3ff3b2?_0x24db01[_0x09ab('0x1f')]:_0x5ac9da[_0x09ab('0x1c')]+_0x5ac9da[_0x09ab('0x1d')];var _0x5c053b;if(_0x88f781>=_0x2f75a8){_0x88f781=_0x2f75a8;_0x5c053b=0xc8;}else{_0x5c053b=0xce;}_0x27cf42[_0x09ab('0x19')](_0x5c053b);return _0x27cf42[_0x09ab('0x20')]('Content-Range',_0x3d77d6+'-'+_0x88f781+'/'+_0x2f75a8)[_0x09ab('0x1b')](_0x24db01);}return null;};}function patchUpdates(_0x6a3b15){return function(_0x1be6af){try{jsonpatch[_0x09ab('0x21')](_0x1be6af,_0x6a3b15,!![]);}catch(_0x403d30){return BPromise[_0x09ab('0x22')](_0x403d30);}return _0x1be6af[_0x09ab('0x23')]();};}function saveUpdates(_0x1bde95,_0x48d46c){return function(_0x30304f){if(_0x30304f){return _0x30304f[_0x09ab('0x24')](_0x1bde95)[_0x09ab('0x25')](function(_0x33e2d8){return _0x33e2d8;});}return null;};}function removeEntity(_0x3314b8,_0x35ea70){return function(_0x597beb){if(_0x597beb){return _0x597beb[_0x09ab('0x26')]()[_0x09ab('0x25')](function(){_0x3314b8[_0x09ab('0x19')](0xcc)[_0x09ab('0x1a')]();});}};}function handleEntityNotFound(_0x293e54,_0x4c776b){return function(_0x50a95b){if(!_0x50a95b){_0x293e54[_0x09ab('0x18')](0x194);}return _0x50a95b;};}function handleError(_0x40932c,_0x5138d4){_0x5138d4=_0x5138d4||0x1f4;return function(_0x429b1b){logger[_0x09ab('0x27')](_0x429b1b[_0x09ab('0x28')]);if(_0x429b1b[_0x09ab('0x29')]){delete _0x429b1b[_0x09ab('0x29')];}_0x40932c[_0x09ab('0x19')](_0x5138d4)[_0x09ab('0x2a')](_0x429b1b);};}exports[_0x09ab('0x2b')]=function(_0x55c5f0,_0x1f4eed){var _0x2d4028={},_0x300e2a={},_0x333684={'count':0x0,'rows':[]};var _0x177069=_[_0x09ab('0x2c')](db[_0x09ab('0x2d')][_0x09ab('0x2e')],function(_0x222892){return{'name':_0x222892[_0x09ab('0x2f')],'type':_0x222892[_0x09ab('0x30')][_0x09ab('0x31')]};});_0x300e2a[_0x09ab('0x32')]=_['map'](_0x177069,_0x09ab('0x29'));_0x300e2a[_0x09ab('0x33')]=_[_0x09ab('0x34')](_0x55c5f0[_0x09ab('0x33')]);_0x300e2a[_0x09ab('0x35')]=_[_0x09ab('0x36')](_0x300e2a[_0x09ab('0x32')],_0x300e2a[_0x09ab('0x33')]);_0x2d4028[_0x09ab('0x37')]=_['intersection'](_0x300e2a['model'],qs[_0x09ab('0x38')](_0x55c5f0[_0x09ab('0x33')]['fields']));_0x2d4028[_0x09ab('0x37')]=_0x2d4028[_0x09ab('0x37')][_0x09ab('0x39')]?_0x2d4028['attributes']:_0x300e2a[_0x09ab('0x32')];if(!_0x55c5f0[_0x09ab('0x33')][_0x09ab('0x3a')]('nolimit')){_0x2d4028['limit']=qs[_0x09ab('0x1d')](_0x55c5f0[_0x09ab('0x33')][_0x09ab('0x1d')]);_0x2d4028[_0x09ab('0x1c')]=qs[_0x09ab('0x1c')](_0x55c5f0['query'][_0x09ab('0x1c')]);}_0x2d4028[_0x09ab('0x3b')]=qs['sort'](_0x55c5f0[_0x09ab('0x33')][_0x09ab('0x3c')]);_0x2d4028['where']=qs['filters'](_['pick'](_0x55c5f0['query'],_0x300e2a[_0x09ab('0x35')]),_0x177069);if(_0x55c5f0[_0x09ab('0x33')]['filter']){_0x2d4028[_0x09ab('0x3d')]=_[_0x09ab('0x3e')](_0x2d4028[_0x09ab('0x3d')],{'$or':_[_0x09ab('0x2c')](_0x177069,function(_0x5e2597){if(_0x5e2597[_0x09ab('0x30')]!==_0x09ab('0x3f')){var _0x3f8011={};_0x3f8011[_0x5e2597[_0x09ab('0x29')]]={'$like':'%'+_0x55c5f0[_0x09ab('0x33')][_0x09ab('0x40')]+'%'};return _0x3f8011;}})});}_0x2d4028=_[_0x09ab('0x3e')]({},_0x2d4028,_0x55c5f0[_0x09ab('0x41')]);var _0x3d8a67={'where':_0x2d4028[_0x09ab('0x3d')]};return db[_0x09ab('0x2d')][_0x09ab('0x1f')](_0x3d8a67)['then'](function(_0x24a7c6){_0x333684[_0x09ab('0x1f')]=_0x24a7c6;if(_0x55c5f0[_0x09ab('0x33')][_0x09ab('0x42')]){_0x2d4028[_0x09ab('0x43')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x09ab('0x44')](_0x2d4028);})['then'](function(_0x12f859){_0x333684[_0x09ab('0x45')]=_0x12f859;return _0x333684;})[_0x09ab('0x25')](respondWithFilteredResult(_0x1f4eed,_0x2d4028))[_0x09ab('0x46')](handleError(_0x1f4eed,null));};exports[_0x09ab('0x47')]=function(_0x5ded5d,_0x171383){var _0x277ea6={'raw':!![],'where':{'id':_0x5ded5d[_0x09ab('0x48')]['id']}},_0x4430f2={};_0x4430f2[_0x09ab('0x32')]=_[_0x09ab('0x34')](db[_0x09ab('0x2d')][_0x09ab('0x2e')]);_0x4430f2[_0x09ab('0x33')]=_[_0x09ab('0x34')](_0x5ded5d[_0x09ab('0x33')]);_0x4430f2[_0x09ab('0x35')]=_[_0x09ab('0x36')](_0x4430f2[_0x09ab('0x32')],_0x4430f2[_0x09ab('0x33')]);_0x277ea6[_0x09ab('0x37')]=_[_0x09ab('0x36')](_0x4430f2[_0x09ab('0x32')],qs[_0x09ab('0x38')](_0x5ded5d['query']['fields']));_0x277ea6[_0x09ab('0x37')]=_0x277ea6[_0x09ab('0x37')]['length']?_0x277ea6[_0x09ab('0x37')]:_0x4430f2[_0x09ab('0x32')];if(_0x5ded5d['query'][_0x09ab('0x42')]){_0x277ea6[_0x09ab('0x43')]=[{'all':!![]}];}_0x277ea6=_['merge']({},_0x277ea6,_0x5ded5d[_0x09ab('0x41')]);return db[_0x09ab('0x2d')][_0x09ab('0x49')](_0x277ea6)[_0x09ab('0x25')](handleEntityNotFound(_0x171383,null))[_0x09ab('0x25')](respondWithResult(_0x171383,null))[_0x09ab('0x46')](handleError(_0x171383,null));};exports[_0x09ab('0x4a')]=function(_0x361424,_0x4a582c){return db[_0x09ab('0x2d')][_0x09ab('0x4a')](_0x361424[_0x09ab('0x4b')],{})['then'](respondWithResult(_0x4a582c,0xc9))[_0x09ab('0x46')](handleError(_0x4a582c,null));};exports[_0x09ab('0x24')]=function(_0x3e45a1,_0xc2a33b){if(_0x3e45a1['body']['id']){delete _0x3e45a1['body']['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x3e45a1[_0x09ab('0x48')]['id']}})[_0x09ab('0x25')](handleEntityNotFound(_0xc2a33b,null))[_0x09ab('0x25')](saveUpdates(_0x3e45a1['body'],null))[_0x09ab('0x25')](respondWithResult(_0xc2a33b,null))[_0x09ab('0x46')](handleError(_0xc2a33b,null));};exports['destroy']=function(_0x21b10c,_0xee2f7b){return db[_0x09ab('0x2d')][_0x09ab('0x49')]({'where':{'id':_0x21b10c['params']['id']}})[_0x09ab('0x25')](handleEntityNotFound(_0xee2f7b,null))[_0x09ab('0x25')](removeEntity(_0xee2f7b,null))[_0x09ab('0x46')](handleError(_0xee2f7b,null));};exports[_0x09ab('0x4c')]=function(_0x2002c2,_0x55fd92){return db[_0x09ab('0x2d')][_0x09ab('0x4c')]()[_0x09ab('0x25')](respondWithResult(_0x55fd92,null))[_0x09ab('0x46')](handleError(_0x55fd92,null));}; \ No newline at end of file +var _0xf02c=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','error','stack','send','index','ChatQueueReport','rawAttributes','type','key','map','name','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2432c7,_0x219a14){var _0x384408=function(_0x4374f9){while(--_0x4374f9){_0x2432c7['push'](_0x2432c7['shift']());}};_0x384408(++_0x219a14);}(_0xf02c,0x92));var _0xcf02=function(_0x4d308c,_0x177061){_0x4d308c=_0x4d308c-0x0;var _0x421381=_0xf02c[_0x4d308c];return _0x421381;};'use strict';var emlformat=require(_0xcf02('0x0'));var rimraf=require(_0xcf02('0x1'));var zipdir=require(_0xcf02('0x2'));var jsonpatch=require(_0xcf02('0x3'));var rp=require(_0xcf02('0x4'));var moment=require(_0xcf02('0x5'));var BPromise=require(_0xcf02('0x6'));var Mustache=require(_0xcf02('0x7'));var util=require(_0xcf02('0x8'));var path=require(_0xcf02('0x9'));var sox=require(_0xcf02('0xa'));var csv=require(_0xcf02('0xb'));var ejs=require(_0xcf02('0xc'));var fs=require('fs');var fs_extra=require(_0xcf02('0xd'));var _=require(_0xcf02('0xe'));var squel=require('squel');var crypto=require(_0xcf02('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcf02('0x10'));var Papa=require(_0xcf02('0x11'));var Redis=require(_0xcf02('0x12'));var authService=require(_0xcf02('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcf02('0x14'));var hardwareService=require(_0xcf02('0x15'));var logger=require(_0xcf02('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xcf02('0x17'));var licenseUtil=require(_0xcf02('0x18'));var db=require(_0xcf02('0x19'))['db'];function respondWithStatusCode(_0x20b8c7,_0x2908b5){_0x2908b5=_0x2908b5||0xcc;return function(_0x5da922){if(_0x5da922){return _0x20b8c7[_0xcf02('0x1a')](_0x2908b5);}return _0x20b8c7[_0xcf02('0x1b')](_0x2908b5)[_0xcf02('0x1c')]();};}function respondWithResult(_0x304dc8,_0x3621a6){_0x3621a6=_0x3621a6||0xc8;return function(_0x19f1be){if(_0x19f1be){return _0x304dc8[_0xcf02('0x1b')](_0x3621a6)['json'](_0x19f1be);}};}function respondWithFilteredResult(_0x255ff7,_0x123d77){return function(_0x275870){if(_0x275870){var _0x5b2512=typeof _0x123d77[_0xcf02('0x1d')]===_0xcf02('0x1e')&&typeof _0x123d77[_0xcf02('0x1f')]===_0xcf02('0x1e');var _0x4a2d89=_0x275870['count'];var _0x4f3829=_0x5b2512?0x0:_0x123d77[_0xcf02('0x1d')];var _0x53a97e=_0x5b2512?_0x275870[_0xcf02('0x20')]:_0x123d77[_0xcf02('0x1d')]+_0x123d77[_0xcf02('0x1f')];var _0x4424bb;if(_0x53a97e>=_0x4a2d89){_0x53a97e=_0x4a2d89;_0x4424bb=0xc8;}else{_0x4424bb=0xce;}_0x255ff7['status'](_0x4424bb);return _0x255ff7['set'](_0xcf02('0x21'),_0x4f3829+'-'+_0x53a97e+'/'+_0x4a2d89)[_0xcf02('0x22')](_0x275870);}return null;};}function patchUpdates(_0x5bc7a2){return function(_0xff91e7){try{jsonpatch[_0xcf02('0x23')](_0xff91e7,_0x5bc7a2,!![]);}catch(_0x37f8b2){return BPromise[_0xcf02('0x24')](_0x37f8b2);}return _0xff91e7['save']();};}function saveUpdates(_0x18819a,_0x4260e2){return function(_0x3bf3f4){if(_0x3bf3f4){return _0x3bf3f4[_0xcf02('0x25')](_0x18819a)[_0xcf02('0x26')](function(_0x731aed){return _0x731aed;});}return null;};}function removeEntity(_0x17cce9,_0x2926b9){return function(_0x4f651c){if(_0x4f651c){return _0x4f651c['destroy']()['then'](function(){_0x17cce9[_0xcf02('0x1b')](0xcc)[_0xcf02('0x1c')]();});}};}function handleEntityNotFound(_0x2fd260,_0x67d43c){return function(_0xc424cc){if(!_0xc424cc){_0x2fd260[_0xcf02('0x1a')](0x194);}return _0xc424cc;};}function handleError(_0x207cfe,_0x1cccb0){_0x1cccb0=_0x1cccb0||0x1f4;return function(_0x4ee2b9){logger[_0xcf02('0x27')](_0x4ee2b9[_0xcf02('0x28')]);if(_0x4ee2b9['name']){delete _0x4ee2b9['name'];}_0x207cfe[_0xcf02('0x1b')](_0x1cccb0)[_0xcf02('0x29')](_0x4ee2b9);};}exports[_0xcf02('0x2a')]=function(_0x210256,_0x3cc47e){var _0x5eb4c5={},_0x2b8bc6={},_0x318c5e={'count':0x0,'rows':[]};var _0x32edbf=_['map'](db[_0xcf02('0x2b')][_0xcf02('0x2c')],function(_0xab73ca){return{'name':_0xab73ca['fieldName'],'type':_0xab73ca[_0xcf02('0x2d')][_0xcf02('0x2e')]};});_0x2b8bc6['model']=_[_0xcf02('0x2f')](_0x32edbf,_0xcf02('0x30'));_0x2b8bc6['query']=_[_0xcf02('0x31')](_0x210256[_0xcf02('0x32')]);_0x2b8bc6[_0xcf02('0x33')]=_[_0xcf02('0x34')](_0x2b8bc6[_0xcf02('0x35')],_0x2b8bc6['query']);_0x5eb4c5[_0xcf02('0x36')]=_[_0xcf02('0x34')](_0x2b8bc6[_0xcf02('0x35')],qs[_0xcf02('0x37')](_0x210256[_0xcf02('0x32')]['fields']));_0x5eb4c5['attributes']=_0x5eb4c5[_0xcf02('0x36')][_0xcf02('0x38')]?_0x5eb4c5[_0xcf02('0x36')]:_0x2b8bc6['model'];if(!_0x210256['query'][_0xcf02('0x39')](_0xcf02('0x3a'))){_0x5eb4c5[_0xcf02('0x1f')]=qs[_0xcf02('0x1f')](_0x210256[_0xcf02('0x32')]['limit']);_0x5eb4c5[_0xcf02('0x1d')]=qs[_0xcf02('0x1d')](_0x210256[_0xcf02('0x32')]['offset']);}_0x5eb4c5[_0xcf02('0x3b')]=qs[_0xcf02('0x3c')](_0x210256[_0xcf02('0x32')][_0xcf02('0x3c')]);_0x5eb4c5[_0xcf02('0x3d')]=qs['filters'](_[_0xcf02('0x3e')](_0x210256[_0xcf02('0x32')],_0x2b8bc6['filters']),_0x32edbf);if(_0x210256[_0xcf02('0x32')][_0xcf02('0x3f')]){_0x5eb4c5[_0xcf02('0x3d')]=_[_0xcf02('0x40')](_0x5eb4c5['where'],{'$or':_[_0xcf02('0x2f')](_0x32edbf,function(_0x2db3ba){if(_0x2db3ba[_0xcf02('0x2d')]!==_0xcf02('0x41')){var _0x3d6d1d={};_0x3d6d1d[_0x2db3ba[_0xcf02('0x30')]]={'$like':'%'+_0x210256['query'][_0xcf02('0x3f')]+'%'};return _0x3d6d1d;}})});}_0x5eb4c5=_[_0xcf02('0x40')]({},_0x5eb4c5,_0x210256[_0xcf02('0x42')]);var _0x301630={'where':_0x5eb4c5[_0xcf02('0x3d')]};return db['ChatQueueReport'][_0xcf02('0x20')](_0x301630)['then'](function(_0x24e2ff){_0x318c5e[_0xcf02('0x20')]=_0x24e2ff;if(_0x210256[_0xcf02('0x32')][_0xcf02('0x43')]){_0x5eb4c5['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xcf02('0x44')](_0x5eb4c5);})[_0xcf02('0x26')](function(_0x33372b){_0x318c5e[_0xcf02('0x45')]=_0x33372b;return _0x318c5e;})[_0xcf02('0x26')](respondWithFilteredResult(_0x3cc47e,_0x5eb4c5))[_0xcf02('0x46')](handleError(_0x3cc47e,null));};exports['show']=function(_0x256323,_0x45898d){var _0x345f41={'raw':!![],'where':{'id':_0x256323[_0xcf02('0x47')]['id']}},_0x2525d8={};_0x2525d8[_0xcf02('0x35')]=_['keys'](db[_0xcf02('0x2b')]['rawAttributes']);_0x2525d8[_0xcf02('0x32')]=_[_0xcf02('0x31')](_0x256323[_0xcf02('0x32')]);_0x2525d8['filters']=_[_0xcf02('0x34')](_0x2525d8['model'],_0x2525d8[_0xcf02('0x32')]);_0x345f41['attributes']=_[_0xcf02('0x34')](_0x2525d8[_0xcf02('0x35')],qs[_0xcf02('0x37')](_0x256323[_0xcf02('0x32')]['fields']));_0x345f41['attributes']=_0x345f41[_0xcf02('0x36')][_0xcf02('0x38')]?_0x345f41[_0xcf02('0x36')]:_0x2525d8[_0xcf02('0x35')];if(_0x256323[_0xcf02('0x32')][_0xcf02('0x43')]){_0x345f41['include']=[{'all':!![]}];}_0x345f41=_[_0xcf02('0x40')]({},_0x345f41,_0x256323[_0xcf02('0x42')]);return db[_0xcf02('0x2b')][_0xcf02('0x48')](_0x345f41)[_0xcf02('0x26')](handleEntityNotFound(_0x45898d,null))[_0xcf02('0x26')](respondWithResult(_0x45898d,null))[_0xcf02('0x46')](handleError(_0x45898d,null));};exports['create']=function(_0x58b78f,_0x46478e){return db['ChatQueueReport'][_0xcf02('0x49')](_0x58b78f['body'],{})[_0xcf02('0x26')](respondWithResult(_0x46478e,0xc9))[_0xcf02('0x46')](handleError(_0x46478e,null));};exports[_0xcf02('0x25')]=function(_0x175765,_0x29831c){if(_0x175765[_0xcf02('0x4a')]['id']){delete _0x175765[_0xcf02('0x4a')]['id'];}return db[_0xcf02('0x2b')][_0xcf02('0x48')]({'where':{'id':_0x175765[_0xcf02('0x47')]['id']}})['then'](handleEntityNotFound(_0x29831c,null))[_0xcf02('0x26')](saveUpdates(_0x175765[_0xcf02('0x4a')],null))[_0xcf02('0x26')](respondWithResult(_0x29831c,null))[_0xcf02('0x46')](handleError(_0x29831c,null));};exports['destroy']=function(_0x13d8f0,_0x444867){return db[_0xcf02('0x2b')][_0xcf02('0x48')]({'where':{'id':_0x13d8f0[_0xcf02('0x47')]['id']}})[_0xcf02('0x26')](handleEntityNotFound(_0x444867,null))[_0xcf02('0x26')](removeEntity(_0x444867,null))[_0xcf02('0x46')](handleError(_0x444867,null));};exports[_0xcf02('0x4b')]=function(_0x41f71f,_0x3cfa66){return db[_0xcf02('0x2b')]['describe']()[_0xcf02('0x26')](respondWithResult(_0x3cfa66,null))[_0xcf02('0x46')](handleError(_0x3cfa66,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index d35dfcd..32f3b20 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20c6ad,_0x422629){var _0x5e4569=function(_0x2c4353){while(--_0x2c4353){_0x20c6ad['push'](_0x20c6ad['shift']());}};_0x5e4569(++_0x422629);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 950e638..b039202 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 _0x66bf=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','catch','UpdateChatQueueReport','update','where','attributes','limit','debug','lodash','util','moment','bluebird','ioredis'];(function(_0x4c4fcb,_0xf87b0d){var _0x1041db=function(_0x283f62){while(--_0x283f62){_0x4c4fcb['push'](_0x4c4fcb['shift']());}};_0x1041db(++_0xf87b0d);}(_0x66bf,0x1c9));var _0xf66b=function(_0x1693e1,_0xcd6a2e){_0x1693e1=_0x1693e1-0x0;var _0x29ccb0=_0x66bf[_0x1693e1];return _0x29ccb0;};'use strict';var _=require(_0xf66b('0x0'));var util=require(_0xf66b('0x1'));var moment=require(_0xf66b('0x2'));var BPromise=require(_0xf66b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf66b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf66b('0x5'))(_0xf66b('0x6'));var config=require(_0xf66b('0x7'));var jayson=require(_0xf66b('0x8'));var client=jayson['client'][_0xf66b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21407a,_0x2d86bc,_0xa6edc5){return new BPromise(function(_0x17a66f,_0x561c87){return client[_0xf66b('0xa')](_0x21407a,_0xa6edc5)[_0xf66b('0xb')](function(_0xfde58a){logger['info'](_0xf66b('0xc'),_0x2d86bc,_0xf66b('0xd'));logger['debug'](_0xf66b('0xe'),_0x2d86bc,_0xf66b('0xd'),JSON[_0xf66b('0xf')](_0xfde58a));if(_0xfde58a[_0xf66b('0x10')]){if(_0xfde58a[_0xf66b('0x10')]['code']===0x1f4){logger[_0xf66b('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x2d86bc,_0xfde58a[_0xf66b('0x10')][_0xf66b('0x11')]);return _0x561c87(_0xfde58a[_0xf66b('0x10')][_0xf66b('0x11')]);}logger[_0xf66b('0x10')](_0xf66b('0xc'),_0x2d86bc,_0xfde58a[_0xf66b('0x10')][_0xf66b('0x11')]);return _0x17a66f(_0xfde58a[_0xf66b('0x10')][_0xf66b('0x11')]);}else{logger[_0xf66b('0x12')](_0xf66b('0xc'),_0x2d86bc,_0xf66b('0xd'));_0x17a66f(_0xfde58a[_0xf66b('0x13')]['message']);}})['catch'](function(_0x34afb6){logger['error'](_0xf66b('0xc'),_0x2d86bc,_0x34afb6);_0x561c87(_0x34afb6);});});}exports[_0xf66b('0x14')]=function(_0x48fb98){var _0x545330=this;return new Promise(function(_0x342a6f,_0x4a5530){return db[_0xf66b('0x15')][_0xf66b('0x16')](_0x48fb98[_0xf66b('0x17')],{'raw':_0x48fb98[_0xf66b('0x18')]?_0x48fb98[_0xf66b('0x18')][_0xf66b('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x268492){logger[_0xf66b('0x12')]('CreateChatQueueReport',_0x48fb98);logger['debug']('CreateChatQueueReport',_0x48fb98,JSON[_0xf66b('0xf')](_0x268492));_0x342a6f(_0x268492);})[_0xf66b('0x1a')](function(_0x501f9c){logger[_0xf66b('0x10')](_0xf66b('0x14'),_0x501f9c[_0xf66b('0x11')],_0x48fb98);_0x4a5530(_0x545330[_0xf66b('0x10')](0x1f4,_0x501f9c['message']));});});};exports[_0xf66b('0x1b')]=function(_0x2f3d08){var _0x1cde32=this;return new Promise(function(_0x493163,_0x2d68d9){return db[_0xf66b('0x15')][_0xf66b('0x1c')](_0x2f3d08[_0xf66b('0x17')],{'raw':_0x2f3d08[_0xf66b('0x18')]?_0x2f3d08[_0xf66b('0x18')][_0xf66b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f3d08[_0xf66b('0x18')]?_0x2f3d08['options'][_0xf66b('0x1d')]||null:null,'attributes':_0x2f3d08[_0xf66b('0x18')]?_0x2f3d08[_0xf66b('0x18')][_0xf66b('0x1e')]||null:null,'limit':_0x2f3d08[_0xf66b('0x18')]?_0x2f3d08['options'][_0xf66b('0x1f')]||null:null})[_0xf66b('0xb')](function(_0x348d81){logger[_0xf66b('0x12')]('UpdateChatQueueReport',_0x2f3d08);logger[_0xf66b('0x20')](_0xf66b('0x1b'),_0x2f3d08,JSON[_0xf66b('0xf')](_0x348d81));_0x493163(_0x348d81);})['catch'](function(_0x593fad){logger[_0xf66b('0x10')]('UpdateChatQueueReport',_0x593fad[_0xf66b('0x11')],_0x2f3d08);_0x2d68d9(_0x1cde32['error'](0x1f4,_0x593fad['message']));});});}; \ No newline at end of file +var _0x9173=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','CreateChatQueueReport','ChatQueueReport','body','options','raw','stringify','UpdateChatQueueReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x532ac3,_0x55e608){var _0x37bd3e=function(_0x59f198){while(--_0x59f198){_0x532ac3['push'](_0x532ac3['shift']());}};_0x37bd3e(++_0x55e608);}(_0x9173,0xb4));var _0x3917=function(_0xe68ffb,_0x52d71d){_0xe68ffb=_0xe68ffb-0x0;var _0x5b282a=_0x9173[_0xe68ffb];return _0x5b282a;};'use strict';var _=require(_0x3917('0x0'));var util=require(_0x3917('0x1'));var moment=require('moment');var BPromise=require(_0x3917('0x2'));var rs=require(_0x3917('0x3'));var fs=require('fs');var Redis=require(_0x3917('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3917('0x5'));var logger=require('../../config/logger')(_0x3917('0x6'));var config=require(_0x3917('0x7'));var jayson=require(_0x3917('0x8'));var client=jayson[_0x3917('0x9')][_0x3917('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48d592,_0x181918,_0x27f513){return new BPromise(function(_0x11267b,_0x44d50e){return client[_0x3917('0xb')](_0x48d592,_0x27f513)[_0x3917('0xc')](function(_0x58282f){logger[_0x3917('0xd')](_0x3917('0xe'),_0x181918,'request\x20sent');logger[_0x3917('0xf')](_0x3917('0x10'),_0x181918,'request\x20sent',JSON['stringify'](_0x58282f));if(_0x58282f['error']){if(_0x58282f[_0x3917('0x11')][_0x3917('0x12')]===0x1f4){logger[_0x3917('0x11')](_0x3917('0xe'),_0x181918,_0x58282f[_0x3917('0x11')][_0x3917('0x13')]);return _0x44d50e(_0x58282f['error'][_0x3917('0x13')]);}logger[_0x3917('0x11')](_0x3917('0xe'),_0x181918,_0x58282f[_0x3917('0x11')]['message']);return _0x11267b(_0x58282f[_0x3917('0x11')][_0x3917('0x13')]);}else{logger[_0x3917('0xd')](_0x3917('0xe'),_0x181918,_0x3917('0x14'));_0x11267b(_0x58282f['result'][_0x3917('0x13')]);}})['catch'](function(_0x4912cd){logger[_0x3917('0x11')](_0x3917('0xe'),_0x181918,_0x4912cd);_0x44d50e(_0x4912cd);});});}exports[_0x3917('0x15')]=function(_0x509b2b){var _0x402d3c=this;return new Promise(function(_0x504934,_0x47da7e){return db[_0x3917('0x16')]['create'](_0x509b2b[_0x3917('0x17')],{'raw':_0x509b2b[_0x3917('0x18')]?_0x509b2b[_0x3917('0x18')][_0x3917('0x19')]===undefined?!![]:![]:!![]})[_0x3917('0xc')](function(_0x2f9f7d){logger[_0x3917('0xd')](_0x3917('0x15'),_0x509b2b);logger[_0x3917('0xf')](_0x3917('0x15'),_0x509b2b,JSON[_0x3917('0x1a')](_0x2f9f7d));_0x504934(_0x2f9f7d);})['catch'](function(_0x1e3d24){logger[_0x3917('0x11')]('CreateChatQueueReport',_0x1e3d24['message'],_0x509b2b);_0x47da7e(_0x402d3c[_0x3917('0x11')](0x1f4,_0x1e3d24['message']));});});};exports[_0x3917('0x1b')]=function(_0x337aba){var _0x3ddc64=this;return new Promise(function(_0x5f16b7,_0x1e47a2){return db['ChatQueueReport'][_0x3917('0x1c')](_0x337aba[_0x3917('0x17')],{'raw':_0x337aba[_0x3917('0x18')]?_0x337aba['options'][_0x3917('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x337aba[_0x3917('0x18')]?_0x337aba[_0x3917('0x18')][_0x3917('0x1d')]||null:null,'attributes':_0x337aba[_0x3917('0x18')]?_0x337aba['options']['attributes']||null:null,'limit':_0x337aba[_0x3917('0x18')]?_0x337aba[_0x3917('0x18')][_0x3917('0x1e')]||null:null})[_0x3917('0xc')](function(_0x12302d){logger[_0x3917('0xd')](_0x3917('0x1b'),_0x337aba);logger[_0x3917('0xf')](_0x3917('0x1b'),_0x337aba,JSON[_0x3917('0x1a')](_0x12302d));_0x5f16b7(_0x12302d);})['catch'](function(_0x345869){logger['error'](_0x3917('0x1b'),_0x345869['message'],_0x337aba);_0x1e47a2(_0x3ddc64[_0x3917('0x11')](0x1f4,_0x345869[_0x3917('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 76ab85b..4ce082d 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 _0x9886=['put','delete','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','post','create'];(function(_0x3baf61,_0x187408){var _0x515476=function(_0x450f8f){while(--_0x450f8f){_0x3baf61['push'](_0x3baf61['shift']());}};_0x515476(++_0x187408);}(_0x9886,0x89));var _0x6988=function(_0x5a0e2f,_0x2d039e){_0x5a0e2f=_0x5a0e2f-0x0;var _0x4e05ae=_0x9886[_0x5a0e2f];return _0x4e05ae;};'use strict';var multer=require(_0x6988('0x0'));var util=require(_0x6988('0x1'));var path=require(_0x6988('0x2'));var timeout=require('connect-timeout');var express=require(_0x6988('0x3'));var router=express[_0x6988('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6988('0x5'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x6988('0x6')]('/',auth[_0x6988('0x7')](),controller[_0x6988('0x8')]);router[_0x6988('0x6')](_0x6988('0x9'),auth[_0x6988('0x7')](),controller['describe']);router[_0x6988('0x6')](_0x6988('0xa'),auth[_0x6988('0x7')](),controller['show']);router[_0x6988('0xb')]('/',auth[_0x6988('0x7')](),controller[_0x6988('0xc')]);router[_0x6988('0xd')]('/:id',auth[_0x6988('0x7')](),controller['update']);router[_0x6988('0xe')](_0x6988('0xa'),auth[_0x6988('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3379=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x378fcb,_0x48e7c5){var _0x3c66e1=function(_0x5be5a7){while(--_0x5be5a7){_0x378fcb['push'](_0x378fcb['shift']());}};_0x3c66e1(++_0x48e7c5);}(_0x3379,0x19a));var _0x9337=function(_0x118a8b,_0x2c978d){_0x118a8b=_0x118a8b-0x0;var _0x480063=_0x3379[_0x118a8b];return _0x480063;};'use strict';var multer=require(_0x9337('0x0'));var util=require(_0x9337('0x1'));var path=require(_0x9337('0x2'));var timeout=require(_0x9337('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9337('0x4'));var auth=require(_0x9337('0x5'));var interaction=require(_0x9337('0x6'));var config=require(_0x9337('0x7'));var controller=require(_0x9337('0x8'));router[_0x9337('0x9')]('/',auth[_0x9337('0xa')](),controller[_0x9337('0xb')]);router[_0x9337('0x9')](_0x9337('0xc'),auth[_0x9337('0xa')](),controller[_0x9337('0xd')]);router[_0x9337('0x9')](_0x9337('0xe'),auth[_0x9337('0xa')](),controller[_0x9337('0xf')]);router[_0x9337('0x10')]('/',auth[_0x9337('0xa')](),controller[_0x9337('0x11')]);router[_0x9337('0x12')](_0x9337('0xe'),auth[_0x9337('0xa')](),controller[_0x9337('0x13')]);router[_0x9337('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x9337('0x15')]);module[_0x9337('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index e72350c..18c23dc 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x22d045,_0x13fd64){var _0x2460b1=function(_0x3e0ddf){while(--_0x3e0ddf){_0x22d045['push'](_0x22d045['shift']());}};_0x2460b1(++_0x13fd64);}(_0x54ef,0x112));var _0xf54e=function(_0x377b61,_0x4c03f3){_0x377b61=_0x377b61-0x0;var _0x3a940c=_0x54ef[_0x377b61];return _0x3a940c;};'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 +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x154784,_0x526d63){var _0xf3eaed=function(_0x53d100){while(--_0x53d100){_0x154784['push'](_0x154784['shift']());}};_0xf3eaed(++_0x526d63);}(_0x008c,0x188));var _0xc008=function(_0x207696,_0x1cf674){_0x207696=_0x207696-0x0;var _0x4060f3=_0x008c[_0x207696];return _0x4060f3;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 47c8dd4..99c939c 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 _0x8fee=['name','send','index','map','ChatTransferReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','show','params','find','catch','create','body','describe','zip-dir','fast-json-patch','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error'];(function(_0x36ffe9,_0x515d5c){var _0x45c5ad=function(_0x286cc1){while(--_0x286cc1){_0x36ffe9['push'](_0x36ffe9['shift']());}};_0x45c5ad(++_0x515d5c);}(_0x8fee,0x153));var _0xe8fe=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x8fee[_0x4d8666];return _0x37175b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe8fe('0x0'));var jsonpatch=require(_0xe8fe('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe8fe('0x2'));var Mustache=require(_0xe8fe('0x3'));var util=require('util');var path=require(_0xe8fe('0x4'));var sox=require(_0xe8fe('0x5'));var csv=require(_0xe8fe('0x6'));var ejs=require(_0xe8fe('0x7'));var fs=require('fs');var fs_extra=require(_0xe8fe('0x8'));var _=require(_0xe8fe('0x9'));var squel=require(_0xe8fe('0xa'));var crypto=require(_0xe8fe('0xb'));var jsforce=require(_0xe8fe('0xc'));var deskjs=require(_0xe8fe('0xd'));var toCsv=require(_0xe8fe('0x6'));var querystring=require(_0xe8fe('0xe'));var Papa=require(_0xe8fe('0xf'));var Redis=require(_0xe8fe('0x10'));var authService=require(_0xe8fe('0x11'));var qs=require(_0xe8fe('0x12'));var as=require(_0xe8fe('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe8fe('0x14'));var utils=require(_0xe8fe('0x15'));var config=require(_0xe8fe('0x16'));var licenseUtil=require(_0xe8fe('0x17'));var db=require(_0xe8fe('0x18'))['db'];function respondWithStatusCode(_0x345a2d,_0x309997){_0x309997=_0x309997||0xcc;return function(_0x161f2c){if(_0x161f2c){return _0x345a2d['sendStatus'](_0x309997);}return _0x345a2d[_0xe8fe('0x19')](_0x309997)[_0xe8fe('0x1a')]();};}function respondWithResult(_0x12cd1e,_0xc189a4){_0xc189a4=_0xc189a4||0xc8;return function(_0x20fb0d){if(_0x20fb0d){return _0x12cd1e[_0xe8fe('0x19')](_0xc189a4)['json'](_0x20fb0d);}};}function respondWithFilteredResult(_0x1fbc2d,_0x3682e2){return function(_0xb086d7){if(_0xb086d7){var _0x40b9b6=typeof _0x3682e2[_0xe8fe('0x1b')]===_0xe8fe('0x1c')&&typeof _0x3682e2[_0xe8fe('0x1d')]===_0xe8fe('0x1c');var _0x1761e4=_0xb086d7[_0xe8fe('0x1e')];var _0x253712=_0x40b9b6?0x0:_0x3682e2[_0xe8fe('0x1b')];var _0x4c8f16=_0x40b9b6?_0xb086d7[_0xe8fe('0x1e')]:_0x3682e2[_0xe8fe('0x1b')]+_0x3682e2[_0xe8fe('0x1d')];var _0x502eeb;if(_0x4c8f16>=_0x1761e4){_0x4c8f16=_0x1761e4;_0x502eeb=0xc8;}else{_0x502eeb=0xce;}_0x1fbc2d[_0xe8fe('0x19')](_0x502eeb);return _0x1fbc2d[_0xe8fe('0x1f')](_0xe8fe('0x20'),_0x253712+'-'+_0x4c8f16+'/'+_0x1761e4)[_0xe8fe('0x21')](_0xb086d7);}return null;};}function patchUpdates(_0x156f3b){return function(_0x5b3b42){try{jsonpatch[_0xe8fe('0x22')](_0x5b3b42,_0x156f3b,!![]);}catch(_0x4f8060){return BPromise[_0xe8fe('0x23')](_0x4f8060);}return _0x5b3b42[_0xe8fe('0x24')]();};}function saveUpdates(_0x325a27,_0x286aa4){return function(_0x50c9cb){if(_0x50c9cb){return _0x50c9cb[_0xe8fe('0x25')](_0x325a27)[_0xe8fe('0x26')](function(_0x35c0f){return _0x35c0f;});}return null;};}function removeEntity(_0x2b11ae,_0x1bc248){return function(_0x56e359){if(_0x56e359){return _0x56e359[_0xe8fe('0x27')]()[_0xe8fe('0x26')](function(){_0x2b11ae['status'](0xcc)[_0xe8fe('0x1a')]();});}};}function handleEntityNotFound(_0x49986c,_0x55c0bb){return function(_0xbb531d){if(!_0xbb531d){_0x49986c['sendStatus'](0x194);}return _0xbb531d;};}function handleError(_0x347971,_0x4aa153){_0x4aa153=_0x4aa153||0x1f4;return function(_0x460852){logger[_0xe8fe('0x28')](_0x460852['stack']);if(_0x460852[_0xe8fe('0x29')]){delete _0x460852[_0xe8fe('0x29')];}_0x347971[_0xe8fe('0x19')](_0x4aa153)[_0xe8fe('0x2a')](_0x460852);};}exports[_0xe8fe('0x2b')]=function(_0x1489d6,_0x57d1ef){var _0x320b03={},_0x1d6820={},_0x4b311f={'count':0x0,'rows':[]};var _0xb9c03a=_[_0xe8fe('0x2c')](db[_0xe8fe('0x2d')][_0xe8fe('0x2e')],function(_0x5a5785){return{'name':_0x5a5785['fieldName'],'type':_0x5a5785['type'][_0xe8fe('0x2f')]};});_0x1d6820[_0xe8fe('0x30')]=_[_0xe8fe('0x2c')](_0xb9c03a,_0xe8fe('0x29'));_0x1d6820[_0xe8fe('0x31')]=_[_0xe8fe('0x32')](_0x1489d6[_0xe8fe('0x31')]);_0x1d6820[_0xe8fe('0x33')]=_[_0xe8fe('0x34')](_0x1d6820[_0xe8fe('0x30')],_0x1d6820[_0xe8fe('0x31')]);_0x320b03['attributes']=_[_0xe8fe('0x34')](_0x1d6820['model'],qs[_0xe8fe('0x35')](_0x1489d6['query'][_0xe8fe('0x35')]));_0x320b03[_0xe8fe('0x36')]=_0x320b03[_0xe8fe('0x36')][_0xe8fe('0x37')]?_0x320b03[_0xe8fe('0x36')]:_0x1d6820[_0xe8fe('0x30')];if(!_0x1489d6[_0xe8fe('0x31')][_0xe8fe('0x38')](_0xe8fe('0x39'))){_0x320b03[_0xe8fe('0x1d')]=qs[_0xe8fe('0x1d')](_0x1489d6[_0xe8fe('0x31')][_0xe8fe('0x1d')]);_0x320b03[_0xe8fe('0x1b')]=qs[_0xe8fe('0x1b')](_0x1489d6[_0xe8fe('0x31')][_0xe8fe('0x1b')]);}_0x320b03[_0xe8fe('0x3a')]=qs[_0xe8fe('0x3b')](_0x1489d6['query']['sort']);_0x320b03[_0xe8fe('0x3c')]=qs[_0xe8fe('0x33')](_[_0xe8fe('0x3d')](_0x1489d6[_0xe8fe('0x31')],_0x1d6820[_0xe8fe('0x33')]),_0xb9c03a);if(_0x1489d6[_0xe8fe('0x31')][_0xe8fe('0x3e')]){_0x320b03[_0xe8fe('0x3c')]=_[_0xe8fe('0x3f')](_0x320b03['where'],{'$or':_[_0xe8fe('0x2c')](_0xb9c03a,function(_0x5cf3f1){if(_0x5cf3f1[_0xe8fe('0x40')]!=='VIRTUAL'){var _0x4bfd18={};_0x4bfd18[_0x5cf3f1[_0xe8fe('0x29')]]={'$like':'%'+_0x1489d6[_0xe8fe('0x31')][_0xe8fe('0x3e')]+'%'};return _0x4bfd18;}})});}_0x320b03=_['merge']({},_0x320b03,_0x1489d6[_0xe8fe('0x41')]);var _0xdfc9bc={'where':_0x320b03['where']};return db[_0xe8fe('0x2d')][_0xe8fe('0x1e')](_0xdfc9bc)['then'](function(_0x30ab33){_0x4b311f['count']=_0x30ab33;if(_0x1489d6[_0xe8fe('0x31')]['includeAll']){_0x320b03[_0xe8fe('0x42')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xe8fe('0x43')](_0x320b03);})[_0xe8fe('0x26')](function(_0x5dc813){_0x4b311f[_0xe8fe('0x44')]=_0x5dc813;return _0x4b311f;})[_0xe8fe('0x26')](respondWithFilteredResult(_0x57d1ef,_0x320b03))['catch'](handleError(_0x57d1ef,null));};exports[_0xe8fe('0x45')]=function(_0x18dc05,_0x57f092){var _0x4c6f91={'raw':!![],'where':{'id':_0x18dc05[_0xe8fe('0x46')]['id']}},_0x24bbf8={};_0x24bbf8['model']=_[_0xe8fe('0x32')](db[_0xe8fe('0x2d')][_0xe8fe('0x2e')]);_0x24bbf8['query']=_[_0xe8fe('0x32')](_0x18dc05[_0xe8fe('0x31')]);_0x24bbf8[_0xe8fe('0x33')]=_[_0xe8fe('0x34')](_0x24bbf8[_0xe8fe('0x30')],_0x24bbf8['query']);_0x4c6f91['attributes']=_[_0xe8fe('0x34')](_0x24bbf8['model'],qs['fields'](_0x18dc05['query'][_0xe8fe('0x35')]));_0x4c6f91[_0xe8fe('0x36')]=_0x4c6f91[_0xe8fe('0x36')][_0xe8fe('0x37')]?_0x4c6f91['attributes']:_0x24bbf8[_0xe8fe('0x30')];if(_0x18dc05[_0xe8fe('0x31')]['includeAll']){_0x4c6f91[_0xe8fe('0x42')]=[{'all':!![]}];}_0x4c6f91=_[_0xe8fe('0x3f')]({},_0x4c6f91,_0x18dc05['options']);return db[_0xe8fe('0x2d')][_0xe8fe('0x47')](_0x4c6f91)[_0xe8fe('0x26')](handleEntityNotFound(_0x57f092,null))[_0xe8fe('0x26')](respondWithResult(_0x57f092,null))[_0xe8fe('0x48')](handleError(_0x57f092,null));};exports['create']=function(_0x531bb4,_0x599dbd){return db[_0xe8fe('0x2d')][_0xe8fe('0x49')](_0x531bb4['body'],{})[_0xe8fe('0x26')](respondWithResult(_0x599dbd,0xc9))[_0xe8fe('0x48')](handleError(_0x599dbd,null));};exports[_0xe8fe('0x25')]=function(_0x4af1bb,_0x5d1c10){if(_0x4af1bb[_0xe8fe('0x4a')]['id']){delete _0x4af1bb[_0xe8fe('0x4a')]['id'];}return db[_0xe8fe('0x2d')]['find']({'where':{'id':_0x4af1bb[_0xe8fe('0x46')]['id']}})[_0xe8fe('0x26')](handleEntityNotFound(_0x5d1c10,null))[_0xe8fe('0x26')](saveUpdates(_0x4af1bb[_0xe8fe('0x4a')],null))[_0xe8fe('0x26')](respondWithResult(_0x5d1c10,null))[_0xe8fe('0x48')](handleError(_0x5d1c10,null));};exports[_0xe8fe('0x27')]=function(_0x5b4d57,_0x52797d){return db[_0xe8fe('0x2d')]['find']({'where':{'id':_0x5b4d57[_0xe8fe('0x46')]['id']}})[_0xe8fe('0x26')](handleEntityNotFound(_0x52797d,null))['then'](removeEntity(_0x52797d,null))[_0xe8fe('0x48')](handleError(_0x52797d,null));};exports[_0xe8fe('0x4b')]=function(_0x45016b,_0x1b0a58){return db[_0xe8fe('0x2d')][_0xe8fe('0x4b')]()[_0xe8fe('0x26')](respondWithResult(_0x1b0a58,null))[_0xe8fe('0x48')](handleError(_0x1b0a58,null));}; \ No newline at end of file +var _0xc3fb=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatTransferReport','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','params','rawAttributes','length','find','catch','create','body','describe','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x5f2c80,_0x16b932){var _0x27bd88=function(_0x5ea856){while(--_0x5ea856){_0x5f2c80['push'](_0x5f2c80['shift']());}};_0x27bd88(++_0x16b932);}(_0xc3fb,0x1ea));var _0xbc3f=function(_0xb8e155,_0x1ff226){_0xb8e155=_0xb8e155-0x0;var _0x578880=_0xc3fb[_0xb8e155];return _0x578880;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc3f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc3f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbc3f('0x2'));var Mustache=require('mustache');var util=require(_0xbc3f('0x3'));var path=require(_0xbc3f('0x4'));var sox=require(_0xbc3f('0x5'));var csv=require(_0xbc3f('0x6'));var ejs=require(_0xbc3f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc3f('0x8'));var squel=require(_0xbc3f('0x9'));var crypto=require(_0xbc3f('0xa'));var jsforce=require(_0xbc3f('0xb'));var deskjs=require(_0xbc3f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbc3f('0xd'));var Papa=require(_0xbc3f('0xe'));var Redis=require(_0xbc3f('0xf'));var authService=require(_0xbc3f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbc3f('0x11'));var hardwareService=require(_0xbc3f('0x12'));var logger=require('../../config/logger')(_0xbc3f('0x13'));var utils=require(_0xbc3f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbc3f('0x15'))['db'];function respondWithStatusCode(_0x53ae38,_0x28bd86){_0x28bd86=_0x28bd86||0xcc;return function(_0x4e0584){if(_0x4e0584){return _0x53ae38[_0xbc3f('0x16')](_0x28bd86);}return _0x53ae38[_0xbc3f('0x17')](_0x28bd86)[_0xbc3f('0x18')]();};}function respondWithResult(_0x25565a,_0x10c502){_0x10c502=_0x10c502||0xc8;return function(_0x48f24d){if(_0x48f24d){return _0x25565a[_0xbc3f('0x17')](_0x10c502)[_0xbc3f('0x19')](_0x48f24d);}};}function respondWithFilteredResult(_0x56e004,_0x5a3896){return function(_0x44aece){if(_0x44aece){var _0x287988=typeof _0x5a3896[_0xbc3f('0x1a')]===_0xbc3f('0x1b')&&typeof _0x5a3896[_0xbc3f('0x1c')]===_0xbc3f('0x1b');var _0x4cfbbc=_0x44aece[_0xbc3f('0x1d')];var _0x46ceac=_0x287988?0x0:_0x5a3896[_0xbc3f('0x1a')];var _0x5f16a8=_0x287988?_0x44aece[_0xbc3f('0x1d')]:_0x5a3896['offset']+_0x5a3896[_0xbc3f('0x1c')];var _0x1c3ea1;if(_0x5f16a8>=_0x4cfbbc){_0x5f16a8=_0x4cfbbc;_0x1c3ea1=0xc8;}else{_0x1c3ea1=0xce;}_0x56e004[_0xbc3f('0x17')](_0x1c3ea1);return _0x56e004[_0xbc3f('0x1e')](_0xbc3f('0x1f'),_0x46ceac+'-'+_0x5f16a8+'/'+_0x4cfbbc)[_0xbc3f('0x19')](_0x44aece);}return null;};}function patchUpdates(_0x621aa6){return function(_0x22678e){try{jsonpatch[_0xbc3f('0x20')](_0x22678e,_0x621aa6,!![]);}catch(_0xeadf67){return BPromise[_0xbc3f('0x21')](_0xeadf67);}return _0x22678e[_0xbc3f('0x22')]();};}function saveUpdates(_0x172f59,_0xef9ca){return function(_0x239a8c){if(_0x239a8c){return _0x239a8c[_0xbc3f('0x23')](_0x172f59)[_0xbc3f('0x24')](function(_0x2f52c9){return _0x2f52c9;});}return null;};}function removeEntity(_0x5884cd,_0x20046f){return function(_0xcb5ee2){if(_0xcb5ee2){return _0xcb5ee2[_0xbc3f('0x25')]()[_0xbc3f('0x24')](function(){_0x5884cd[_0xbc3f('0x17')](0xcc)[_0xbc3f('0x18')]();});}};}function handleEntityNotFound(_0x4e1d19,_0x3ed361){return function(_0x41e067){if(!_0x41e067){_0x4e1d19[_0xbc3f('0x16')](0x194);}return _0x41e067;};}function handleError(_0x389327,_0x4e036d){_0x4e036d=_0x4e036d||0x1f4;return function(_0x10eefb){logger[_0xbc3f('0x26')](_0x10eefb[_0xbc3f('0x27')]);if(_0x10eefb[_0xbc3f('0x28')]){delete _0x10eefb[_0xbc3f('0x28')];}_0x389327[_0xbc3f('0x17')](_0x4e036d)['send'](_0x10eefb);};}exports[_0xbc3f('0x29')]=function(_0x23ac34,_0x488b4f){var _0x6b1ba={},_0x477184={},_0x733c30={'count':0x0,'rows':[]};var _0x230f8d=_[_0xbc3f('0x2a')](db[_0xbc3f('0x2b')]['rawAttributes'],function(_0x270645){return{'name':_0x270645[_0xbc3f('0x2c')],'type':_0x270645['type'][_0xbc3f('0x2d')]};});_0x477184[_0xbc3f('0x2e')]=_['map'](_0x230f8d,_0xbc3f('0x28'));_0x477184[_0xbc3f('0x2f')]=_[_0xbc3f('0x30')](_0x23ac34[_0xbc3f('0x2f')]);_0x477184['filters']=_['intersection'](_0x477184[_0xbc3f('0x2e')],_0x477184[_0xbc3f('0x2f')]);_0x6b1ba[_0xbc3f('0x31')]=_[_0xbc3f('0x32')](_0x477184[_0xbc3f('0x2e')],qs[_0xbc3f('0x33')](_0x23ac34[_0xbc3f('0x2f')][_0xbc3f('0x33')]));_0x6b1ba['attributes']=_0x6b1ba[_0xbc3f('0x31')]['length']?_0x6b1ba[_0xbc3f('0x31')]:_0x477184[_0xbc3f('0x2e')];if(!_0x23ac34[_0xbc3f('0x2f')][_0xbc3f('0x34')](_0xbc3f('0x35'))){_0x6b1ba['limit']=qs[_0xbc3f('0x1c')](_0x23ac34[_0xbc3f('0x2f')][_0xbc3f('0x1c')]);_0x6b1ba[_0xbc3f('0x1a')]=qs['offset'](_0x23ac34['query'][_0xbc3f('0x1a')]);}_0x6b1ba[_0xbc3f('0x36')]=qs[_0xbc3f('0x37')](_0x23ac34[_0xbc3f('0x2f')][_0xbc3f('0x37')]);_0x6b1ba[_0xbc3f('0x38')]=qs['filters'](_[_0xbc3f('0x39')](_0x23ac34['query'],_0x477184[_0xbc3f('0x3a')]),_0x230f8d);if(_0x23ac34['query'][_0xbc3f('0x3b')]){_0x6b1ba[_0xbc3f('0x38')]=_[_0xbc3f('0x3c')](_0x6b1ba[_0xbc3f('0x38')],{'$or':_[_0xbc3f('0x2a')](_0x230f8d,function(_0x2eeabf){if(_0x2eeabf['type']!=='VIRTUAL'){var _0x4aa129={};_0x4aa129[_0x2eeabf[_0xbc3f('0x28')]]={'$like':'%'+_0x23ac34[_0xbc3f('0x2f')]['filter']+'%'};return _0x4aa129;}})});}_0x6b1ba=_[_0xbc3f('0x3c')]({},_0x6b1ba,_0x23ac34[_0xbc3f('0x3d')]);var _0x4471e2={'where':_0x6b1ba['where']};return db[_0xbc3f('0x2b')][_0xbc3f('0x1d')](_0x4471e2)[_0xbc3f('0x24')](function(_0x3561b0){_0x733c30[_0xbc3f('0x1d')]=_0x3561b0;if(_0x23ac34[_0xbc3f('0x2f')][_0xbc3f('0x3e')]){_0x6b1ba[_0xbc3f('0x3f')]=[{'all':!![]}];}return db[_0xbc3f('0x2b')][_0xbc3f('0x40')](_0x6b1ba);})[_0xbc3f('0x24')](function(_0x44ac73){_0x733c30[_0xbc3f('0x41')]=_0x44ac73;return _0x733c30;})[_0xbc3f('0x24')](respondWithFilteredResult(_0x488b4f,_0x6b1ba))['catch'](handleError(_0x488b4f,null));};exports['show']=function(_0x4ea5dd,_0x225b13){var _0x2f9af0={'raw':!![],'where':{'id':_0x4ea5dd[_0xbc3f('0x42')]['id']}},_0x29d96d={};_0x29d96d[_0xbc3f('0x2e')]=_['keys'](db[_0xbc3f('0x2b')][_0xbc3f('0x43')]);_0x29d96d[_0xbc3f('0x2f')]=_[_0xbc3f('0x30')](_0x4ea5dd[_0xbc3f('0x2f')]);_0x29d96d[_0xbc3f('0x3a')]=_['intersection'](_0x29d96d[_0xbc3f('0x2e')],_0x29d96d[_0xbc3f('0x2f')]);_0x2f9af0['attributes']=_[_0xbc3f('0x32')](_0x29d96d[_0xbc3f('0x2e')],qs[_0xbc3f('0x33')](_0x4ea5dd[_0xbc3f('0x2f')]['fields']));_0x2f9af0[_0xbc3f('0x31')]=_0x2f9af0[_0xbc3f('0x31')][_0xbc3f('0x44')]?_0x2f9af0[_0xbc3f('0x31')]:_0x29d96d[_0xbc3f('0x2e')];if(_0x4ea5dd['query'][_0xbc3f('0x3e')]){_0x2f9af0[_0xbc3f('0x3f')]=[{'all':!![]}];}_0x2f9af0=_[_0xbc3f('0x3c')]({},_0x2f9af0,_0x4ea5dd[_0xbc3f('0x3d')]);return db['ChatTransferReport'][_0xbc3f('0x45')](_0x2f9af0)[_0xbc3f('0x24')](handleEntityNotFound(_0x225b13,null))[_0xbc3f('0x24')](respondWithResult(_0x225b13,null))[_0xbc3f('0x46')](handleError(_0x225b13,null));};exports[_0xbc3f('0x47')]=function(_0xe6ae9d,_0x86fee9){return db[_0xbc3f('0x2b')][_0xbc3f('0x47')](_0xe6ae9d[_0xbc3f('0x48')],{})[_0xbc3f('0x24')](respondWithResult(_0x86fee9,0xc9))[_0xbc3f('0x46')](handleError(_0x86fee9,null));};exports[_0xbc3f('0x23')]=function(_0x15c2da,_0x5117e0){if(_0x15c2da[_0xbc3f('0x48')]['id']){delete _0x15c2da[_0xbc3f('0x48')]['id'];}return db[_0xbc3f('0x2b')][_0xbc3f('0x45')]({'where':{'id':_0x15c2da['params']['id']}})[_0xbc3f('0x24')](handleEntityNotFound(_0x5117e0,null))[_0xbc3f('0x24')](saveUpdates(_0x15c2da[_0xbc3f('0x48')],null))[_0xbc3f('0x24')](respondWithResult(_0x5117e0,null))[_0xbc3f('0x46')](handleError(_0x5117e0,null));};exports[_0xbc3f('0x25')]=function(_0x266a54,_0x1042df){return db[_0xbc3f('0x2b')][_0xbc3f('0x45')]({'where':{'id':_0x266a54[_0xbc3f('0x42')]['id']}})[_0xbc3f('0x24')](handleEntityNotFound(_0x1042df,null))[_0xbc3f('0x24')](removeEntity(_0x1042df,null))[_0xbc3f('0x46')](handleError(_0x1042df,null));};exports['describe']=function(_0x30940a,_0x4723a1){return db['ChatTransferReport'][_0xbc3f('0x49')]()[_0xbc3f('0x24')](respondWithResult(_0x4723a1,null))['catch'](handleError(_0x4723a1,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index aaa14ca..6ede30d 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 _0x761a=['../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1e8ef9,_0x4148ca){var _0x590241=function(_0x5d09c0){while(--_0x5d09c0){_0x1e8ef9['push'](_0x1e8ef9['shift']());}};_0x590241(++_0x4148ca);}(_0x761a,0x1b5));var _0xa761=function(_0x488554,_0x47914c){_0x488554=_0x488554-0x0;var _0x471a8a=_0x761a[_0x488554];return _0x471a8a;};'use strict';var _=require(_0xa761('0x0'));var util=require('util');var logger=require(_0xa761('0x1'))('api');var moment=require(_0xa761('0x2'));var BPromise=require(_0xa761('0x3'));var rp=require(_0xa761('0x4'));var fs=require('fs');var path=require(_0xa761('0x5'));var rimraf=require(_0xa761('0x6'));var config=require(_0xa761('0x7'));var attributes=require(_0xa761('0x8'));module['exports']=function(_0x427092,_0x130973){return _0x427092[_0xa761('0x9')](_0xa761('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa761('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x77fe=['./chatTransferReport.attributes','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x551fdb,_0x4f24a9){var _0x54e6a2=function(_0x328979){while(--_0x328979){_0x551fdb['push'](_0x551fdb['shift']());}};_0x54e6a2(++_0x4f24a9);}(_0x77fe,0x158));var _0xe77f=function(_0x23a94d,_0x3a935d){_0x23a94d=_0x23a94d-0x0;var _0xfb1235=_0x77fe[_0x23a94d];return _0xfb1235;};'use strict';var _=require(_0xe77f('0x0'));var util=require(_0xe77f('0x1'));var logger=require(_0xe77f('0x2'))('api');var moment=require(_0xe77f('0x3'));var BPromise=require(_0xe77f('0x4'));var rp=require(_0xe77f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe77f('0x6'));module['exports']=function(_0x2b6458,_0x56283f){return _0x2b6458[_0xe77f('0x7')](_0xe77f('0x8'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xe77f('0x9'),'fields':[_0xe77f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index f3adfec..dc01075 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 _0xc8db=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','request\x20sent','stringify','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x92fb79,_0x1c0ffc){var _0x423393=function(_0x2857e0){while(--_0x2857e0){_0x92fb79['push'](_0x92fb79['shift']());}};_0x423393(++_0x1c0ffc);}(_0xc8db,0x14a));var _0xbc8d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc8db[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xbc8d('0x0'));var util=require(_0xbc8d('0x1'));var moment=require(_0xbc8d('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc8d('0x3'));var fs=require('fs');var Redis=require(_0xbc8d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc8d('0x5'));var logger=require(_0xbc8d('0x6'))(_0xbc8d('0x7'));var config=require(_0xbc8d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbc8d('0x9')][_0xbc8d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x452ccc,_0x115bb4,_0x2be2f6){return new BPromise(function(_0x2b414c,_0x473c28){return client[_0xbc8d('0xb')](_0x452ccc,_0x2be2f6)[_0xbc8d('0xc')](function(_0x321a59){logger[_0xbc8d('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x115bb4,'request\x20sent');logger[_0xbc8d('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x115bb4,_0xbc8d('0xf'),JSON[_0xbc8d('0x10')](_0x321a59));if(_0x321a59[_0xbc8d('0x11')]){if(_0x321a59['error']['code']===0x1f4){logger[_0xbc8d('0x11')](_0xbc8d('0x12'),_0x115bb4,_0x321a59['error'][_0xbc8d('0x13')]);return _0x473c28(_0x321a59[_0xbc8d('0x11')]['message']);}logger[_0xbc8d('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x115bb4,_0x321a59[_0xbc8d('0x11')][_0xbc8d('0x13')]);return _0x2b414c(_0x321a59[_0xbc8d('0x11')]['message']);}else{logger[_0xbc8d('0xd')](_0xbc8d('0x12'),_0x115bb4,'request\x20sent');_0x2b414c(_0x321a59[_0xbc8d('0x14')][_0xbc8d('0x13')]);}})[_0xbc8d('0x15')](function(_0x3c425c){logger[_0xbc8d('0x11')](_0xbc8d('0x12'),_0x115bb4,_0x3c425c);_0x473c28(_0x3c425c);});});} \ No newline at end of file +var _0x6907=['request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2befc5,_0x20d9a5){var _0xb3e05e=function(_0x52eb3f){while(--_0x52eb3f){_0x2befc5['push'](_0x2befc5['shift']());}};_0xb3e05e(++_0x20d9a5);}(_0x6907,0x130));var _0x7690=function(_0x110542,_0x1bf123){_0x110542=_0x110542-0x0;var _0x1bb886=_0x6907[_0x110542];return _0x1bb886;};'use strict';var _=require(_0x7690('0x0'));var util=require(_0x7690('0x1'));var moment=require(_0x7690('0x2'));var BPromise=require('bluebird');var rs=require(_0x7690('0x3'));var fs=require('fs');var Redis=require(_0x7690('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7690('0x5'));var logger=require(_0x7690('0x6'))(_0x7690('0x7'));var config=require(_0x7690('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7690('0x9')][_0x7690('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53fd15,_0x581270,_0x521d0b){return new BPromise(function(_0x200d63,_0x5de641){return client[_0x7690('0xb')](_0x53fd15,_0x521d0b)['then'](function(_0x40b709){logger[_0x7690('0xc')](_0x7690('0xd'),_0x581270,_0x7690('0xe'));logger[_0x7690('0xf')](_0x7690('0x10'),_0x581270,_0x7690('0xe'),JSON['stringify'](_0x40b709));if(_0x40b709['error']){if(_0x40b709[_0x7690('0x11')]['code']===0x1f4){logger[_0x7690('0x11')](_0x7690('0xd'),_0x581270,_0x40b709[_0x7690('0x11')][_0x7690('0x12')]);return _0x5de641(_0x40b709[_0x7690('0x11')]['message']);}logger['error'](_0x7690('0xd'),_0x581270,_0x40b709[_0x7690('0x11')][_0x7690('0x12')]);return _0x200d63(_0x40b709[_0x7690('0x11')][_0x7690('0x12')]);}else{logger['info'](_0x7690('0xd'),_0x581270,'request\x20sent');_0x200d63(_0x40b709[_0x7690('0x13')][_0x7690('0x12')]);}})[_0x7690('0x14')](function(_0x151951){logger['error'](_0x7690('0xd'),_0x581270,_0x151951);_0x5de641(_0x151951);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index aa74288..8c014a8 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 _0x2f93=['index','describe','/:id','show','create','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated'];(function(_0x1bf7a0,_0x444f36){var _0x1d4a6a=function(_0x4a4690){while(--_0x4a4690){_0x1bf7a0['push'](_0x1bf7a0['shift']());}};_0x1d4a6a(++_0x444f36);}(_0x2f93,0x190));var _0x32f9=function(_0x2e224e,_0x354d39){_0x2e224e=_0x2e224e-0x0;var _0x501986=_0x2f93[_0x2e224e];return _0x501986;};'use strict';var multer=require('multer');var util=require(_0x32f9('0x0'));var path=require('path');var timeout=require(_0x32f9('0x1'));var express=require(_0x32f9('0x2'));var router=express[_0x32f9('0x3')]();var fs_extra=require(_0x32f9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x32f9('0x5'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0x32f9('0x6')]('/',auth[_0x32f9('0x7')](),controller[_0x32f9('0x8')]);router[_0x32f9('0x6')]('/describe',auth[_0x32f9('0x7')](),controller[_0x32f9('0x9')]);router[_0x32f9('0x6')](_0x32f9('0xa'),auth['isAuthenticated'](),controller[_0x32f9('0xb')]);router['post']('/',auth[_0x32f9('0x7')](),controller[_0x32f9('0xc')]);router[_0x32f9('0xd')](_0x32f9('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x32f9('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x32f9('0xf')]);module[_0x32f9('0x10')]=router; \ No newline at end of file +var _0x622c=['isAuthenticated','/:id','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','/describe'];(function(_0x58e92d,_0x1181bd){var _0x45d179=function(_0xf162a4){while(--_0xf162a4){_0x58e92d['push'](_0x58e92d['shift']());}};_0x45d179(++_0x1181bd);}(_0x622c,0x183));var _0xc622=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0x622c[_0x3e69ae];return _0x3d7f42;};'use strict';var multer=require(_0xc622('0x0'));var util=require(_0xc622('0x1'));var path=require(_0xc622('0x2'));var timeout=require(_0xc622('0x3'));var express=require(_0xc622('0x4'));var router=express[_0xc622('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc622('0x6'));var interaction=require(_0xc622('0x7'));var config=require(_0xc622('0x8'));var controller=require(_0xc622('0x9'));router[_0xc622('0xa')]('/',auth['isAuthenticated'](),controller[_0xc622('0xb')]);router[_0xc622('0xa')](_0xc622('0xc'),auth[_0xc622('0xd')](),controller['describe']);router[_0xc622('0xa')](_0xc622('0xe'),auth[_0xc622('0xd')](),controller['show']);router['post']('/',auth[_0xc622('0xd')](),controller[_0xc622('0xf')]);router[_0xc622('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc622('0x11')]);router[_0xc622('0x12')](_0xc622('0xe'),auth[_0xc622('0xd')](),controller['destroy']);module[_0xc622('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 035ed27..467a1a7 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 _0x4ea3=['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','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','input','name','text','getDataValue','onlineForm','parse','setDataValue','stringify','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x1ae4a9,_0x4c0ed9){var _0x54d0b0=function(_0x4fff20){while(--_0x4fff20){_0x1ae4a9['push'](_0x1ae4a9['shift']());}};_0x54d0b0(++_0x4c0ed9);}(_0x4ea3,0x70));var _0x34ea=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4ea3[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x34ea('0x0'));var rs=require(_0x34ea('0x1'));module[_0x34ea('0x2')]={'name':{'type':Sequelize[_0x34ea('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x34ea('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x34ea('0x5')},'key':{'type':Sequelize[_0x34ea('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0x6')},'customerAlias':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x34ea('0x3')],'allowNull':![],'defaultValue':_0x34ea('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x34ea('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x34ea('0x3')],'allowNull':![],'defaultValue':_0x34ea('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x34ea('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x34ea('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x34ea('0xa')](_0x34ea('0xb'),_0x34ea('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0xd')},'start_chat_button':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0xe')},'offline_chat_button':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0xf')},'header_offline':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0x10')},'download_transcript':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x34ea('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x34ea('0x12')]},'closingQuestion':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0x13')},'formSubmitSuccessMessage':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0x14')},'noteTitle':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0x15')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x34ea('0x16')},'closingMessage':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0x17')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x34ea('0xf')},'skipMessageButton':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0x18')},'conditionAgreement':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0x19')},'ratingType':{'type':Sequelize['ENUM']('star',_0x34ea('0x1a')),'defaultValue':_0x34ea('0x1b')},'ratingStarsNumber':{'type':Sequelize[_0x34ea('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x34ea('0x1c'),'variable':null,'config':{'placeholder':_0x34ea('0x1d'),'type':_0x34ea('0x1e'),'required':!![]},'props':{'title':_0x34ea('0x1d'),'helpText':''}},{'type':_0x34ea('0x1c'),'props':{'title':_0x34ea('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x34ea('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x34ea('0x1f')](_0x34ea('0x20'))?JSON[_0x34ea('0x21')](this['getDataValue']('onlineForm')):{};},'set':function(_0x564d1b){return this[_0x34ea('0x22')](_0x34ea('0x20'),JSON[_0x34ea('0x23')](_0x564d1b));}},'offlineForm':{'type':Sequelize[_0x34ea('0x12')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x34ea('0x1c'),'props':{'title':_0x34ea('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x34ea('0x5'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x34ea('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x34ea('0x1f')](_0x34ea('0x25'))?JSON[_0x34ea('0x21')](this['getDataValue'](_0x34ea('0x25'))):{};},'set':function(_0x59b9f6){return this[_0x34ea('0x22')]('offlineForm',JSON[_0x34ea('0x23')](_0x59b9f6));}},'token':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':function(){return rs[_0x34ea('0x26')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0x27')},'waitingMessage':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x34ea('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x34ea('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x34ea('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0x18')},'sendUnmanaged':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x34ea('0x12')]},'showAgentAvatar':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x34ea('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x34ea('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x34ea('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0x2c')},'verticalAlignment':{'type':Sequelize[_0x34ea('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0x2d')},'defaultTitle':{'type':Sequelize[_0x34ea('0x3')]},'customerAvatar':{'type':Sequelize[_0x34ea('0x12')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x34ea('0x3')],'allowNull':![],'defaultValue':_0x34ea('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x34ea('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':_0x34ea('0x2f')},'systemAvatar':{'type':Sequelize[_0x34ea('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x34ea('0x9')],'comment':_0x34ea('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![],'comment':_0x34ea('0x31'),'set':function(_0xa1ff39){if(!_0xa1ff39)this[_0x34ea('0x22')](_0x34ea('0x32'),null);this[_0x34ea('0x22')](_0x34ea('0x33'),_0xa1ff39);}},'vidaooEscalation':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x34ea('0x3')]},'vidaooTopic':{'type':Sequelize[_0x34ea('0x3')],'allowNull':![],'defaultValue':_0x34ea('0x34')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x34ea('0x35');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x34ea('0x11')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x34ea('0x12')]}}; \ No newline at end of file +var _0xb903=['BOOLEAN','Feedback','star','thumb','INTEGER','TEXT','stringify','input','text','name','parse','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','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','ENUM','rounded','Chat','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb903,0x185));var _0x3b90=function(_0x1857cc,_0x388c8e){_0x1857cc=_0x1857cc-0x0;var _0x41bcc3=_0xb903[_0x1857cc];return _0x41bcc3;};'use strict';var Sequelize=require(_0x3b90('0x0'));var rs=require(_0x3b90('0x1'));module[_0x3b90('0x2')]={'name':{'type':Sequelize[_0x3b90('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3b90('0x4')},'description':{'type':Sequelize[_0x3b90('0x3')]},'mapKey':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x5')},'mapKeyOffline':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x5')},'key':{'type':Sequelize[_0x3b90('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3b90('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3b90('0x3')],'allowNull':![],'defaultValue':_0x3b90('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3b90('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3b90('0x8')](_0x3b90('0x9'),'squared'),'defaultValue':_0x3b90('0x9')},'header_online':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0xa')},'offline_chat_button':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0xb')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0xc')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0xd')},'formSubmitSuccessMessage':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0xe')},'formSubmitFailureMessage':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0xf')},'placeholderMessage':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x10')},'closingMessageButton':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x11')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0x12')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x14')},'ratingType':{'type':Sequelize[_0x3b90('0x8')](_0x3b90('0x15'),_0x3b90('0x16')),'defaultValue':_0x3b90('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x3b90('0x17')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3b90('0x18')],'defaultValue':function(){return JSON[_0x3b90('0x19')]({'items':[{'type':_0x3b90('0x1a'),'variable':null,'config':{'placeholder':'name','type':_0x3b90('0x1b'),'required':!![]},'props':{'title':_0x3b90('0x1c'),'helpText':''}},{'type':_0x3b90('0x1a'),'props':{'title':_0x3b90('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3b90('0x5'),'type':_0x3b90('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x3b90('0x1d')](this[_0x3b90('0x1e')](_0x3b90('0x1f'))):{};},'set':function(_0x2ffa1a){return this['setDataValue'](_0x3b90('0x1f'),JSON[_0x3b90('0x19')](_0x2ffa1a));}},'offlineForm':{'type':Sequelize[_0x3b90('0x18')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x3b90('0x1a'),'props':{'title':_0x3b90('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3b90('0x5'),'type':_0x3b90('0x5')},'variable':null},{'type':_0x3b90('0x20'),'config':{'placeholder':_0x3b90('0x21')},'props':{'title':'Comments','helpText':_0x3b90('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x3b90('0x23'))?JSON[_0x3b90('0x1d')](this[_0x3b90('0x1e')](_0x3b90('0x23'))):{};},'set':function(_0xd515bd){return this[_0x3b90('0x24')](_0x3b90('0x23'),JSON[_0x3b90('0x19')](_0xd515bd));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3b90('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x25')},'waitingMessage':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0x27')},'skipUnmanaged':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x12')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3b90('0x18')]},'showAgentAvatar':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x3b90('0x28');}},'notificationSound':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3b90('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x3b90('0x17')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0x2a')},'messagesAlignment':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x2b')},'defaultTitle':{'type':Sequelize[_0x3b90('0x3')]},'customerAvatar':{'type':Sequelize[_0x3b90('0x18')]},'showCustomerAvatar':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3b90('0x17')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3b90('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3b90('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3b90('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x2d')},'systemAvatar':{'type':Sequelize[_0x3b90('0x18')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3b90('0x17')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![],'comment':_0x3b90('0x2e'),'set':function(_0x40ce3a){if(!_0x40ce3a)this[_0x3b90('0x24')](_0x3b90('0x2f'),null);this[_0x3b90('0x24')](_0x3b90('0x30'),_0x40ce3a);}},'vidaooEscalation':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3b90('0x3')]},'vidaooTopic':{'type':Sequelize[_0x3b90('0x3')],'allowNull':![],'defaultValue':_0x3b90('0x31')},'vidaooNote':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':function(){return _0x3b90('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x3b90('0x18')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3b90('0x18')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 50948ac..e0d4ecf 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 _0x2e56=['close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','startRouting','EventManager','offline','files','no\x20available\x20attributes','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','openNewInteraction','toPairsIn','mapValues','email','Chat','MailAccountId','NotifyMailAccount','notifyMail','offline-chat','addInteraction','ids','getInteractions','Owner','fullname','internal','color','tag','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','URL','address','origin','3.1.0','x-real-ip','connection','virtual','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','Transaction','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','Contact','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','get','ChatWebsites','UserProfileResource','destroy','stack','name','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','mandatoryDispositionPause','find','create','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','pick','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','setUA','getResult','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','account','applications','list','orderBy','priority','asc','contact','customerIp','headers','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','device','vendor','format','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','autoclose','push'];(function(_0xc298ad,_0xea4dc2){var _0x11b2e6=function(_0xe2314f){while(--_0xe2314f){_0xc298ad['push'](_0xc298ad['shift']());}};_0x11b2e6(++_0xea4dc2);}(_0x2e56,0x75));var _0x62e5=function(_0x3d1244,_0x156028){_0x3d1244=_0x3d1244-0x0;var _0x5d6372=_0x2e56[_0x3d1244];return _0x5d6372;};'use strict';var BPromise=require(_0x62e5('0x0'));var Mustache=require('mustache');var util=require(_0x62e5('0x1'));var path=require(_0x62e5('0x2'));var ejs=require(_0x62e5('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62e5('0x4'));var querystring=require('querystring');var Redis=require(_0x62e5('0x5'));var qs=require(_0x62e5('0x6'));var logger=require(_0x62e5('0x7'))(_0x62e5('0x8'));var config=require('../../config/environment');var url=require(_0x62e5('0x9'));var db=require(_0x62e5('0xa'))['db'];config[_0x62e5('0xb')]=_[_0x62e5('0xc')](config[_0x62e5('0xb')],{'host':_0x62e5('0xd'),'port':0x18eb});var socket=require(_0x62e5('0xe'))(new Redis(config[_0x62e5('0xb')]));require(_0x62e5('0xf'))['register'](socket);var htmlToText=require('html-to-text');var jayson=require(_0x62e5('0x10'));var client=jayson[_0x62e5('0x11')][_0x62e5('0x12')]({'port':0x232c});var client9002=jayson[_0x62e5('0x11')][_0x62e5('0x12')]({'port':0x232a});var client9003=jayson[_0x62e5('0x11')][_0x62e5('0x12')]({'port':0x232b});var client9001=jayson[_0x62e5('0x11')][_0x62e5('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x3391c9,_0x500b8d,_0x37752a,_0x145061){return new BPromise(function(_0x9cc5ad,_0x402765){var _0x37f6b3=_0x145061||client;return _0x37f6b3[_0x62e5('0x13')](_0x3391c9,_0x37752a)[_0x62e5('0x14')](function(_0x4797ce){logger['info'](_0x62e5('0x15'),_0x500b8d,_0x62e5('0x16'));logger[_0x62e5('0x17')](_0x62e5('0x18'),_0x500b8d,'request\x20sent',JSON[_0x62e5('0x19')](_0x4797ce));if(_0x4797ce[_0x62e5('0x1a')]){if(_0x4797ce[_0x62e5('0x1a')][_0x62e5('0x1b')]===0x1f4){logger[_0x62e5('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x500b8d,_0x4797ce[_0x62e5('0x1a')][_0x62e5('0x1c')]);return _0x402765(_0x4797ce[_0x62e5('0x1a')][_0x62e5('0x1c')]);}logger['error'](_0x62e5('0x15'),_0x500b8d,_0x4797ce[_0x62e5('0x1a')][_0x62e5('0x1c')]);return _0x9cc5ad(_0x4797ce[_0x62e5('0x1a')][_0x62e5('0x1c')]);}else{logger[_0x62e5('0x1d')](_0x62e5('0x15'),_0x500b8d,_0x62e5('0x16'));_0x9cc5ad(_0x4797ce[_0x62e5('0x1e')]['message']);}})[_0x62e5('0x1f')](function(_0x2bf07e){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x500b8d,_0x2bf07e);_0x402765(_0x2bf07e);});});}function respondWithStatusCode(_0x45cac2,_0x13557c){_0x13557c=_0x13557c||0xcc;return function(_0x3c0e82){if(_0x3c0e82){return _0x45cac2[_0x62e5('0x20')](_0x13557c);}return _0x45cac2[_0x62e5('0x21')](_0x13557c)[_0x62e5('0x22')]();};}function respondWithResult(_0x568fc5,_0x42bbc3){_0x42bbc3=_0x42bbc3||0xc8;return function(_0x2d1cf5){if(_0x2d1cf5){return _0x568fc5['status'](_0x42bbc3)['json'](_0x2d1cf5);}};}function respondWithFilteredResult(_0x55c897,_0x2ed8fc){return function(_0x540e94){if(_0x540e94){var _0x319155=typeof _0x2ed8fc[_0x62e5('0x23')]===_0x62e5('0x24')&&typeof _0x2ed8fc[_0x62e5('0x25')]==='undefined';var _0x31bc35=_0x540e94[_0x62e5('0x26')];var _0x58b5bc=_0x319155?0x0:_0x2ed8fc[_0x62e5('0x23')];var _0x351d6a=_0x319155?_0x540e94['count']:_0x2ed8fc[_0x62e5('0x23')]+_0x2ed8fc[_0x62e5('0x25')];var _0x1d9f3d;if(_0x351d6a>=_0x31bc35){_0x351d6a=_0x31bc35;_0x1d9f3d=0xc8;}else{_0x1d9f3d=0xce;}_0x55c897[_0x62e5('0x21')](_0x1d9f3d);return _0x55c897[_0x62e5('0x27')](_0x62e5('0x28'),_0x58b5bc+'-'+_0x351d6a+'/'+_0x31bc35)['json'](_0x540e94);}return null;};}function saveUpdates(_0x26a25b){return function(_0x50e772){if(_0x50e772){return _0x50e772[_0x62e5('0x29')](_0x26a25b)['then'](function(_0x204de5){return _0x204de5;});}return null;};}function removeEntity(_0x3f66a9){return function(_0x37eb8c){if(_0x37eb8c){return _0x37eb8c['destroy']()[_0x62e5('0x14')](function(){var _0x167e0b=_0x37eb8c[_0x62e5('0x2a')]({'plain':!![]});var _0x14d34f=_0x62e5('0x2b');return db[_0x62e5('0x2c')][_0x62e5('0x2d')]({'where':{'type':_0x14d34f,'resourceId':_0x167e0b['id']}})[_0x62e5('0x14')](function(){return _0x37eb8c;});})[_0x62e5('0x14')](function(){_0x3f66a9[_0x62e5('0x21')](0xcc)[_0x62e5('0x22')]();});}};}function handleEntityNotFound(_0x593d59){return function(_0x4f4dbb){if(!_0x4f4dbb){_0x593d59[_0x62e5('0x20')](0x194);}return _0x4f4dbb;};}function handleError(_0x70fdc9,_0x356f65){_0x356f65=_0x356f65||0x1f4;return function(_0x4f3f17){logger['error'](_0x4f3f17[_0x62e5('0x2e')]);if(_0x4f3f17[_0x62e5('0x2f')]){delete _0x4f3f17[_0x62e5('0x2f')];}_0x70fdc9[_0x62e5('0x21')](_0x356f65)['send'](_0x4f3f17);};}exports['index']=function(_0x2d8663,_0x3ea308){var _0x434427={'include':[{'model':db[_0x62e5('0x30')],'as':'mandatoryDispositionPause'}]},_0x16c815={},_0x46eec7={'count':0x0,'rows':[]};var _0x4c3ecb=_[_0x62e5('0x31')](db[_0x62e5('0x32')][_0x62e5('0x33')],function(_0x26ac11){return{'name':_0x26ac11[_0x62e5('0x34')],'type':_0x26ac11[_0x62e5('0x35')][_0x62e5('0x36')]};});_0x16c815[_0x62e5('0x37')]=_[_0x62e5('0x31')](_0x4c3ecb,_0x62e5('0x2f'));_0x16c815[_0x62e5('0x38')]=_[_0x62e5('0x39')](_0x2d8663[_0x62e5('0x38')]);_0x16c815[_0x62e5('0x3a')]=_[_0x62e5('0x3b')](_0x16c815[_0x62e5('0x37')],_0x16c815['query']);_0x434427[_0x62e5('0x3c')]=_[_0x62e5('0x3b')](_0x16c815['model'],qs[_0x62e5('0x3d')](_0x2d8663[_0x62e5('0x38')][_0x62e5('0x3d')]));_0x434427[_0x62e5('0x3c')]=_0x434427['attributes'][_0x62e5('0x3e')]?_0x434427[_0x62e5('0x3c')]:_0x16c815['model'];if(!_0x2d8663['query'][_0x62e5('0x3f')](_0x62e5('0x40'))){_0x434427[_0x62e5('0x25')]=qs[_0x62e5('0x25')](_0x2d8663[_0x62e5('0x38')][_0x62e5('0x25')]);_0x434427[_0x62e5('0x23')]=qs['offset'](_0x2d8663[_0x62e5('0x38')][_0x62e5('0x23')]);}_0x434427[_0x62e5('0x41')]=qs[_0x62e5('0x42')](_0x2d8663[_0x62e5('0x38')][_0x62e5('0x42')]);_0x434427[_0x62e5('0x43')]=qs['filters'](_['pick'](_0x2d8663[_0x62e5('0x38')],_0x16c815[_0x62e5('0x3a')]),_0x4c3ecb);if(_0x2d8663[_0x62e5('0x38')][_0x62e5('0x44')]){_0x434427[_0x62e5('0x43')]=_['merge'](_0x434427[_0x62e5('0x43')],{'$or':_[_0x62e5('0x31')](_0x4c3ecb,function(_0x386482){if(_0x386482['type']!==_0x62e5('0x45')){var _0x4a37a1={};_0x4a37a1[_0x386482[_0x62e5('0x2f')]]={'$like':'%'+_0x2d8663[_0x62e5('0x38')][_0x62e5('0x44')]+'%'};return _0x4a37a1;}})});}_0x434427=_[_0x62e5('0x46')]({},_0x434427,_0x2d8663[_0x62e5('0x47')]);var _0x47c97f={'where':_0x434427['where']};return db[_0x62e5('0x32')][_0x62e5('0x26')](_0x47c97f)['then'](function(_0x511c86){_0x46eec7[_0x62e5('0x26')]=_0x511c86;if(_0x2d8663[_0x62e5('0x38')][_0x62e5('0x48')]){_0x434427[_0x62e5('0x49')]=[{'all':!![]}];}return db[_0x62e5('0x32')][_0x62e5('0x4a')](_0x434427);})[_0x62e5('0x14')](function(_0x1a3b57){_0x46eec7[_0x62e5('0x4b')]=_0x1a3b57;return _0x46eec7;})[_0x62e5('0x14')](respondWithFilteredResult(_0x3ea308,_0x434427))[_0x62e5('0x1f')](handleError(_0x3ea308,null));};exports[_0x62e5('0x4c')]=function(_0x277bfd,_0x3dbe16){var _0x44d207={'raw':![],'where':{'id':_0x277bfd['params']['id']},'include':[{'model':db[_0x62e5('0x30')],'as':_0x62e5('0x4d')}]},_0x123bae={};_0x123bae[_0x62e5('0x37')]=_['keys'](db[_0x62e5('0x32')][_0x62e5('0x33')]);_0x123bae[_0x62e5('0x38')]=_[_0x62e5('0x39')](_0x277bfd[_0x62e5('0x38')]);_0x123bae[_0x62e5('0x3a')]=_[_0x62e5('0x3b')](_0x123bae[_0x62e5('0x37')],_0x123bae[_0x62e5('0x38')]);_0x44d207[_0x62e5('0x3c')]=_['intersection'](_0x123bae[_0x62e5('0x37')],qs[_0x62e5('0x3d')](_0x277bfd[_0x62e5('0x38')]['fields']));_0x44d207['attributes']=_0x44d207['attributes'][_0x62e5('0x3e')]?_0x44d207[_0x62e5('0x3c')]:_0x123bae[_0x62e5('0x37')];if(_0x277bfd[_0x62e5('0x38')][_0x62e5('0x48')]){_0x44d207[_0x62e5('0x49')]=[{'all':!![]}];}_0x44d207=_[_0x62e5('0x46')]({},_0x44d207,_0x277bfd['options']);return db[_0x62e5('0x32')][_0x62e5('0x4e')](_0x44d207)[_0x62e5('0x14')](handleEntityNotFound(_0x3dbe16,null))[_0x62e5('0x14')](respondWithResult(_0x3dbe16,null))['catch'](handleError(_0x3dbe16,null));};exports[_0x62e5('0x4f')]=function(_0x25d391,_0x3ec16f){return db[_0x62e5('0x32')][_0x62e5('0x4f')](_0x25d391['body'],{})[_0x62e5('0x14')](function(_0x1d5363){var _0x4e8ef9=_0x25d391[_0x62e5('0x50')][_0x62e5('0x2a')]({'plain':!![]});if(!_0x4e8ef9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e8ef9['role']===_0x62e5('0x50')){var _0x19f52c=_0x1d5363[_0x62e5('0x2a')]({'plain':!![]});var _0x23276f=_0x62e5('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x23276f,'userProfileId':_0x4e8ef9[_0x62e5('0x51')]},'raw':!![]})[_0x62e5('0x14')](function(_0x132059){if(_0x132059&&_0x132059[_0x62e5('0x52')]===0x0){return db[_0x62e5('0x2c')][_0x62e5('0x4f')]({'name':_0x19f52c['name'],'resourceId':_0x19f52c['id'],'type':_0x132059[_0x62e5('0x2f')],'sectionId':_0x132059['id']},{})['then'](function(){return _0x1d5363;});}else{return _0x1d5363;}})[_0x62e5('0x1f')](function(_0x1ec476){logger[_0x62e5('0x1a')](_0x62e5('0x53'),_0x1ec476);throw _0x1ec476;});}return _0x1d5363;})['then'](respondWithResult(_0x3ec16f,0xc9))[_0x62e5('0x1f')](handleError(_0x3ec16f,null));};exports[_0x62e5('0x29')]=function(_0x174d6c,_0x4aac3f){if(_0x174d6c[_0x62e5('0x54')]['id']){delete _0x174d6c[_0x62e5('0x54')]['id'];}return db[_0x62e5('0x32')][_0x62e5('0x4e')]({'where':{'id':_0x174d6c[_0x62e5('0x55')]['id']},'include':[{'model':db[_0x62e5('0x30')],'as':_0x62e5('0x4d')}]})[_0x62e5('0x14')](handleEntityNotFound(_0x4aac3f,null))[_0x62e5('0x14')](saveUpdates(_0x174d6c[_0x62e5('0x54')],null))[_0x62e5('0x14')](respondWithResult(_0x4aac3f,null))[_0x62e5('0x1f')](handleError(_0x4aac3f,null));};exports[_0x62e5('0x2d')]=function(_0x53f1e8,_0x130cd4){return db[_0x62e5('0x32')]['find']({'where':{'id':_0x53f1e8[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x130cd4,null))[_0x62e5('0x14')](removeEntity(_0x130cd4,null))[_0x62e5('0x1f')](handleError(_0x130cd4,null));};exports[_0x62e5('0x56')]=function(_0xc6da0f,_0x23a8ad){return db[_0x62e5('0x32')]['describe']()['then'](respondWithResult(_0x23a8ad,null))['catch'](handleError(_0x23a8ad,null));};exports[_0x62e5('0x57')]=function(_0x549aa7,_0x53f733){if(_0x549aa7[_0x62e5('0x54')]['id']){delete _0x549aa7['body']['id'];}return db['ChatWebsite'][_0x62e5('0x4e')]({'where':{'id':_0x549aa7[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x53f733,null))[_0x62e5('0x14')](function(_0x498cbe){if(_0x498cbe){_0x549aa7['body'][_0x62e5('0x58')]=_0x498cbe['id'];return db[_0x62e5('0x59')]['create'](_0x549aa7[_0x62e5('0x54')]);}})[_0x62e5('0x14')](respondWithResult(_0x53f733,null))[_0x62e5('0x1f')](handleError(_0x53f733,null));};exports[_0x62e5('0x5a')]=function(_0x5b4041,_0x420e15){var _0x3991ae={'raw':![],'where':{}};var _0x532205={};var _0x476212={'count':0x0,'rows':[]};return db[_0x62e5('0x32')][_0x62e5('0x5b')]({'where':{'id':_0x5b4041[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x420e15,null))[_0x62e5('0x14')](function(_0x3ed409){if(_0x3ed409){_0x532205[_0x62e5('0x37')]=_[_0x62e5('0x39')](db[_0x62e5('0x59')][_0x62e5('0x33')]);_0x532205[_0x62e5('0x38')]=_['keys'](_0x5b4041[_0x62e5('0x38')]);_0x532205[_0x62e5('0x3a')]=_[_0x62e5('0x3b')](_0x532205[_0x62e5('0x37')],_0x532205[_0x62e5('0x38')]);_0x3991ae[_0x62e5('0x3c')]=_[_0x62e5('0x3b')](_0x532205['model'],qs[_0x62e5('0x3d')](_0x5b4041[_0x62e5('0x38')][_0x62e5('0x3d')]));_0x3991ae[_0x62e5('0x3c')]=_0x3991ae['attributes'][_0x62e5('0x3e')]?_0x3991ae['attributes']:_0x532205[_0x62e5('0x37')];if(!_0x5b4041[_0x62e5('0x38')]['hasOwnProperty'](_0x62e5('0x40'))){_0x3991ae[_0x62e5('0x25')]=qs['limit'](_0x5b4041[_0x62e5('0x38')][_0x62e5('0x25')]);_0x3991ae[_0x62e5('0x23')]=qs[_0x62e5('0x23')](_0x5b4041[_0x62e5('0x38')]['offset']);}_0x3991ae[_0x62e5('0x41')]=qs[_0x62e5('0x42')](_0x5b4041['query'][_0x62e5('0x42')]);_0x3991ae[_0x62e5('0x43')]=qs['filters'](_[_0x62e5('0x5c')](_0x5b4041[_0x62e5('0x38')],_0x532205['filters']));_0x3991ae[_0x62e5('0x43')][_0x62e5('0x58')]=_0x3ed409['id'];if(_0x5b4041[_0x62e5('0x38')]['filter']){_0x3991ae[_0x62e5('0x43')]=_['merge'](_0x3991ae[_0x62e5('0x43')],{'$or':_[_0x62e5('0x31')](_0x3991ae[_0x62e5('0x3c')],function(_0x340fd5){var _0xf0e581={};_0xf0e581[_0x340fd5]={'$like':'%'+_0x5b4041[_0x62e5('0x38')]['filter']+'%'};return _0xf0e581;})});}_0x3991ae=_['merge']({},_0x3991ae,_0x5b4041[_0x62e5('0x47')]);return db[_0x62e5('0x59')]['count']({'where':_0x3991ae[_0x62e5('0x43')]})[_0x62e5('0x14')](function(_0x40f07f){_0x476212[_0x62e5('0x26')]=_0x40f07f;if(_0x5b4041['query']['includeAll']){_0x3991ae[_0x62e5('0x49')]=[{'all':!![]}];}return db[_0x62e5('0x59')][_0x62e5('0x4a')](_0x3991ae);})[_0x62e5('0x14')](function(_0x544869){_0x476212['rows']=_0x544869;return _0x476212;});}})['then'](respondWithFilteredResult(_0x420e15,_0x3991ae))[_0x62e5('0x1f')](handleError(_0x420e15,null));};exports['removeDispositions']=function(_0x57d40a,_0x4b19c3){return db['ChatWebsite'][_0x62e5('0x4e')]({'where':{'id':_0x57d40a[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x4b19c3,null))[_0x62e5('0x14')](function(_0xcb1d6f){if(_0xcb1d6f){return _0xcb1d6f[_0x62e5('0x5d')](_0x57d40a[_0x62e5('0x38')]['ids']);}})[_0x62e5('0x14')](respondWithStatusCode(_0x4b19c3,null))['catch'](handleError(_0x4b19c3,null));};exports[_0x62e5('0x5e')]=function(_0x200ac8,_0x1b68fa){if(_0x200ac8[_0x62e5('0x54')]['id']){delete _0x200ac8[_0x62e5('0x54')]['id'];}return db[_0x62e5('0x32')][_0x62e5('0x4e')]({'where':{'id':_0x200ac8[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x1b68fa,null))['then'](function(_0x5762f5){if(_0x5762f5){_0x200ac8[_0x62e5('0x54')]['ChatWebsiteId']=_0x5762f5['id'];return db['CannedAnswer']['create'](_0x200ac8[_0x62e5('0x54')]);}})[_0x62e5('0x14')](respondWithResult(_0x1b68fa,null))[_0x62e5('0x1f')](handleError(_0x1b68fa,null));};exports[_0x62e5('0x5f')]=function(_0x4e8791,_0x369982){var _0x46b3bf={'raw':![],'where':{}};var _0x5141fc={};var _0x340b79={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x62e5('0x5b')]({'where':{'id':_0x4e8791['params']['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x369982,null))[_0x62e5('0x14')](function(_0x1d1c2f){if(_0x1d1c2f){_0x5141fc[_0x62e5('0x37')]=_[_0x62e5('0x39')](db[_0x62e5('0x60')]['rawAttributes']);_0x5141fc[_0x62e5('0x38')]=_[_0x62e5('0x39')](_0x4e8791['query']);_0x5141fc[_0x62e5('0x3a')]=_['intersection'](_0x5141fc[_0x62e5('0x37')],_0x5141fc['query']);_0x46b3bf[_0x62e5('0x3c')]=_[_0x62e5('0x3b')](_0x5141fc['model'],qs[_0x62e5('0x3d')](_0x4e8791[_0x62e5('0x38')]['fields']));_0x46b3bf['attributes']=_0x46b3bf[_0x62e5('0x3c')][_0x62e5('0x3e')]?_0x46b3bf[_0x62e5('0x3c')]:_0x5141fc[_0x62e5('0x37')];if(!_0x4e8791['query'][_0x62e5('0x3f')](_0x62e5('0x40'))){_0x46b3bf['limit']=qs[_0x62e5('0x25')](_0x4e8791[_0x62e5('0x38')][_0x62e5('0x25')]);_0x46b3bf[_0x62e5('0x23')]=qs[_0x62e5('0x23')](_0x4e8791[_0x62e5('0x38')]['offset']);}_0x46b3bf[_0x62e5('0x41')]=qs[_0x62e5('0x42')](_0x4e8791[_0x62e5('0x38')][_0x62e5('0x42')]);_0x46b3bf[_0x62e5('0x43')]=qs[_0x62e5('0x3a')](_[_0x62e5('0x5c')](_0x4e8791[_0x62e5('0x38')],_0x5141fc[_0x62e5('0x3a')]));_0x46b3bf[_0x62e5('0x43')][_0x62e5('0x58')]=_0x1d1c2f['id'];if(_0x4e8791['query'][_0x62e5('0x44')]){_0x46b3bf[_0x62e5('0x43')]=_[_0x62e5('0x46')](_0x46b3bf[_0x62e5('0x43')],{'$or':_[_0x62e5('0x31')](_0x46b3bf[_0x62e5('0x3c')],function(_0x8e7d4){var _0x2d0e92={};_0x2d0e92[_0x8e7d4]={'$like':'%'+_0x4e8791[_0x62e5('0x38')][_0x62e5('0x44')]+'%'};return _0x2d0e92;})});}_0x46b3bf=_[_0x62e5('0x46')]({},_0x46b3bf,_0x4e8791[_0x62e5('0x47')]);return db[_0x62e5('0x60')][_0x62e5('0x26')]({'where':_0x46b3bf['where']})['then'](function(_0x49de90){_0x340b79['count']=_0x49de90;if(_0x4e8791['query'][_0x62e5('0x48')]){_0x46b3bf[_0x62e5('0x49')]=[{'all':!![]}];}return db[_0x62e5('0x60')]['findAll'](_0x46b3bf);})[_0x62e5('0x14')](function(_0x286900){_0x340b79['rows']=_0x286900;return _0x340b79;});}})['then'](respondWithFilteredResult(_0x369982,_0x46b3bf))[_0x62e5('0x1f')](handleError(_0x369982,null));};exports[_0x62e5('0x61')]=function(_0x56d9f2,_0x13952a){return db[_0x62e5('0x32')][_0x62e5('0x4e')]({'where':{'id':_0x56d9f2[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x13952a,null))['then'](function(_0x3a413f){if(_0x3a413f){return _0x3a413f[_0x62e5('0x61')](_0x56d9f2[_0x62e5('0x38')]['ids']);}})[_0x62e5('0x14')](respondWithStatusCode(_0x13952a,null))[_0x62e5('0x1f')](handleError(_0x13952a,null));};exports[_0x62e5('0x62')]=function(_0x1f4787,_0x321edc){_0x1f4787['body'][_0x62e5('0x63')]=_0x1f4787[_0x62e5('0x64')][_0x62e5('0x65')];return db[_0x62e5('0x32')]['find']({'where':{'id':_0x1f4787[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x321edc,null))[_0x62e5('0x14')](saveUpdates(_0x1f4787['body'],null))[_0x62e5('0x14')](respondWithResult(_0x321edc,null))[_0x62e5('0x1f')](handleError(_0x321edc,null));};exports[_0x62e5('0x66')]=function(_0x1ab534,_0x130253){_0x1ab534[_0x62e5('0x54')][_0x62e5('0x67')]=_0x1ab534[_0x62e5('0x64')][_0x62e5('0x65')];return db[_0x62e5('0x32')][_0x62e5('0x4e')]({'where':{'id':_0x1ab534[_0x62e5('0x55')]['id']}})['then'](handleEntityNotFound(_0x130253,null))[_0x62e5('0x14')](saveUpdates(_0x1ab534[_0x62e5('0x54')],null))[_0x62e5('0x14')](respondWithResult(_0x130253,null))['catch'](handleError(_0x130253,null));};exports[_0x62e5('0x68')]=function(_0x281dc2,_0x1861d2){_0x281dc2[_0x62e5('0x54')][_0x62e5('0x69')]=_0x281dc2[_0x62e5('0x64')][_0x62e5('0x65')];return db[_0x62e5('0x32')][_0x62e5('0x4e')]({'where':{'id':_0x281dc2[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x1861d2,null))[_0x62e5('0x14')](saveUpdates(_0x281dc2[_0x62e5('0x54')],null))['then'](respondWithResult(_0x1861d2,null))[_0x62e5('0x1f')](handleError(_0x1861d2,null));};exports['addSystemAvatar']=function(_0x1fc1cb,_0x40f674){_0x1fc1cb[_0x62e5('0x54')][_0x62e5('0x6a')]=_0x1fc1cb[_0x62e5('0x64')][_0x62e5('0x65')];return db[_0x62e5('0x32')][_0x62e5('0x4e')]({'where':{'id':_0x1fc1cb[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x40f674,null))[_0x62e5('0x14')](saveUpdates(_0x1fc1cb[_0x62e5('0x54')],null))[_0x62e5('0x14')](respondWithResult(_0x40f674,null))[_0x62e5('0x1f')](handleError(_0x40f674,null));};exports['getLogo']=function(_0x228ea3,_0x1a8c3e){var _0x300de5=path[_0x62e5('0x6b')](config[_0x62e5('0x6c')],'server/files/images/logos/default_logo.svg');var _0x41d4a0={'where':{'id':_0x228ea3[_0x62e5('0x55')]['id']},'attributes':['id',_0x62e5('0x63')],'raw':!![]};var _0x39cf52=![];return require(_0x62e5('0x6d'))[_0x62e5('0x6e')]()[_0x62e5('0x14')](function(_0x267c8a){if(_0x267c8a){_0x39cf52=_0x267c8a[_0x62e5('0x6f')];}})[_0x62e5('0x14')](function(){return db[_0x62e5('0x32')][_0x62e5('0x4e')](_0x41d4a0);})[_0x62e5('0x14')](handleEntityNotFound(_0x1a8c3e,null))[_0x62e5('0x14')](function(_0x32e5fa){if(_0x32e5fa){if(!_[_0x62e5('0x70')](_0x32e5fa[_0x62e5('0x63')])){if(fs[_0x62e5('0x71')](path[_0x62e5('0x6b')](config[_0x62e5('0x6c')],_0x62e5('0x72'),_0x32e5fa['sitepic']))&&_0x39cf52){_0x300de5=path[_0x62e5('0x6b')](config['root'],'server/files/images/logos/',_0x32e5fa[_0x62e5('0x63')]);}}return _0x1a8c3e['download'](_0x300de5);}})[_0x62e5('0x1f')](handleError(_0x1a8c3e,null));};exports[_0x62e5('0x73')]=function(_0x4db52a,_0x1ceb18){var _0x2fee94=path[_0x62e5('0x6b')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x48f663={'where':{'id':_0x4db52a['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x62e5('0x32')][_0x62e5('0x4e')](_0x48f663)[_0x62e5('0x14')](handleEntityNotFound(_0x1ceb18,null))[_0x62e5('0x14')](function(_0x26dedb){if(_0x26dedb){if(!_[_0x62e5('0x70')](_0x26dedb['agentAvatar'])){if(fs[_0x62e5('0x71')](path[_0x62e5('0x6b')](config[_0x62e5('0x6c')],_0x62e5('0x74'),_0x26dedb[_0x62e5('0x67')]))){_0x2fee94=path[_0x62e5('0x6b')](config[_0x62e5('0x6c')],_0x62e5('0x74'),_0x26dedb['agentAvatar']);}}return _0x1ceb18[_0x62e5('0x75')](_0x2fee94);}})[_0x62e5('0x1f')](handleError(_0x1ceb18,null));};exports[_0x62e5('0x76')]=function(_0x123502,_0x1f2bdd){var _0x6c0dac=path[_0x62e5('0x6b')](config[_0x62e5('0x6c')],_0x62e5('0x77'));var _0x4a3c44={'where':{'id':_0x123502[_0x62e5('0x55')]['id']},'attributes':['id','customerAvatar',_0x62e5('0x78')],'raw':!![]};return db[_0x62e5('0x32')][_0x62e5('0x4e')](_0x4a3c44)[_0x62e5('0x14')](handleEntityNotFound(_0x1f2bdd,null))[_0x62e5('0x14')](function(_0x1e7736){if(_0x1e7736){if(!_['isNil'](_0x1e7736[_0x62e5('0x69')])){if(fs[_0x62e5('0x71')](path[_0x62e5('0x6b')](config[_0x62e5('0x6c')],_0x62e5('0x74'),_0x1e7736[_0x62e5('0x69')]))&&_0x1e7736[_0x62e5('0x78')]){_0x6c0dac=path[_0x62e5('0x6b')](config['root'],_0x62e5('0x74'),_0x1e7736[_0x62e5('0x69')]);}}return _0x1f2bdd[_0x62e5('0x75')](_0x6c0dac);}})['catch'](handleError(_0x1f2bdd,null));};exports[_0x62e5('0x79')]=function(_0x364e88,_0x1dc31a){var _0x592fbd=path['join'](config[_0x62e5('0x6c')],_0x62e5('0x7a'));var _0x28d45e={'where':{'id':_0x364e88[_0x62e5('0x55')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x62e5('0x32')][_0x62e5('0x4e')](_0x28d45e)[_0x62e5('0x14')](handleEntityNotFound(_0x1dc31a,null))[_0x62e5('0x14')](function(_0x250362){if(_0x250362){if(!_[_0x62e5('0x70')](_0x250362[_0x62e5('0x6a')])){if(fs[_0x62e5('0x71')](path['join'](config['root'],_0x62e5('0x74'),_0x250362[_0x62e5('0x6a')]))){_0x592fbd=path[_0x62e5('0x6b')](config[_0x62e5('0x6c')],'server/files/images/avatars/',_0x250362[_0x62e5('0x6a')]);}}return _0x1dc31a[_0x62e5('0x75')](_0x592fbd);}})[_0x62e5('0x1f')](handleError(_0x1dc31a,null));};exports['notify']=function(_0x20eac0,_0x2978ba){var _0x4f5266=require('user-agent-parser');var _0x5c76dd=new _0x4f5266();var _0x5ad401=_0x5c76dd[_0x62e5('0x7b')](_0x20eac0['headers']['user-agent'])[_0x62e5('0x7c')]();var _0x32cf38={'body':_0x20eac0[_0x62e5('0x54')],'channel':'chat'};var _0x1f3f83=[];var _0x275c63=[];var _0x4af7bf={};var _0x1cb5cf=![];return db[_0x62e5('0x7d')][_0x62e5('0x56')]()[_0x62e5('0x14')](function(_0x3cd0fb){if(!_0x3cd0fb){throw new db[(_0x62e5('0x7e'))][(_0x62e5('0x7f'))]('no\x20available\x20attributes');}_0x1f3f83=_[_0x62e5('0x80')](_['keys'](_0x3cd0fb),[_0x62e5('0x81'),_0x62e5('0x82')]);_0x275c63=_['difference'](_[_0x62e5('0x39')](_0x3cd0fb),[_0x62e5('0x81'),_0x62e5('0x82'),_0x62e5('0x83'),_0x62e5('0x84')]);if(_0x20eac0['body']['id']){delete _0x20eac0['body']['id'];}if(_[_0x62e5('0x70')](_0x20eac0[_0x62e5('0x54')][_0x62e5('0x85')])){throw new db['Sequelize'][(_0x62e5('0x7f'))](_0x62e5('0x86'));}if(_[_0x62e5('0x70')](_0x20eac0[_0x62e5('0x54')]['body'])||_0x20eac0[_0x62e5('0x54')]['body']===''){throw new db['Sequelize'][(_0x62e5('0x7f'))](_0x62e5('0x87'));}if(_[_0x62e5('0x70')](_0x20eac0['body']['mapKey'])){throw new db['Sequelize'][(_0x62e5('0x7f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x275c63);}if(!_[_0x62e5('0x88')](_0x275c63,_0x20eac0[_0x62e5('0x54')][_0x62e5('0x89')])){throw new db[(_0x62e5('0x7e'))][(_0x62e5('0x7f'))](_0x62e5('0x8a')+_0x275c63);}_0x4af7bf[_0x20eac0['body']['mapKey']]=_0x20eac0[_0x62e5('0x54')]['from'];})[_0x62e5('0x14')](function(){return db[_0x62e5('0x32')]['find']({'where':{'id':_0x20eac0[_0x62e5('0x55')]['id']},'include':[{'model':db[_0x62e5('0x8b')],'as':_0x62e5('0x8c'),'include':[{'model':db[_0x62e5('0x7d')],'as':_0x62e5('0x8d'),'where':_0x4af7bf,'limit':0x1,'order':[[_0x62e5('0x82'),_0x62e5('0x8e')]]}]},{'model':db[_0x62e5('0x8f')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x2978ba,null))['then'](function(_0x42a138){if(_0x42a138&&_0x42a138[_0x62e5('0x8c')]){_0x32cf38[_0x62e5('0x90')]=_0x42a138;_0x32cf38[_0x62e5('0x91')]=_0x42a138['Applications'];_0x32cf38[_0x62e5('0x92')]=_0x42a138[_0x62e5('0x8c')];_0x32cf38[_0x62e5('0x91')]=_[_0x62e5('0x93')](_0x32cf38['applications'],[_0x62e5('0x94')],[_0x62e5('0x95')]);if(_0x32cf38[_0x62e5('0x90')]['Applications']){delete _0x32cf38['account']['Applications'];}if(_0x32cf38[_0x62e5('0x90')][_0x62e5('0x8c')]&&_0x32cf38[_0x62e5('0x90')]['List']['Contacts'][_0x62e5('0x3e')]){return _0x32cf38[_0x62e5('0x90')][_0x62e5('0x8c')]['Contacts'][0x0];}var _0x4e45f2=_[_0x62e5('0xc')](_0x20eac0[_0x62e5('0x54')],{'firstName':_0x20eac0[_0x62e5('0x54')][_0x62e5('0x85')],'ListId':_0x42a138[_0x62e5('0x84')]});_0x4e45f2[_0x20eac0[_0x62e5('0x54')][_0x62e5('0x89')]]=_0x20eac0[_0x62e5('0x54')][_0x62e5('0x85')];return db[_0x62e5('0x7d')][_0x62e5('0x4f')](_0x4e45f2,{'fields':_0x1f3f83,'raw':!![]});}})[_0x62e5('0x14')](handleEntityNotFound(_0x2978ba,null))['then'](function(_0x23650c){_0x32cf38[_0x62e5('0x96')]=_0x23650c;var _0xae9460=_0x20eac0[_0x62e5('0x54')][_0x62e5('0x97')];if(_0x20eac0[_0x62e5('0x98')]['cf-connecting-ip']){_0xae9460=_0x20eac0[_0x62e5('0x98')]['cf-connecting-ip'];}else if(_0x20eac0[_0x62e5('0x98')][_0x62e5('0x99')]){_0xae9460=_[_0x62e5('0x9a')](_0x20eac0[_0x62e5('0x98')][_0x62e5('0x99')][_0x62e5('0x9b')](','));}if(_0x23650c){var _0x2aa0ae={'ContactId':_0x23650c['id'],'ChatWebsiteId':_0x20eac0['params']['id'],'from':(_0x23650c[_0x62e5('0x9c')]||'')+'\x20'+(_0x23650c[_0x62e5('0x9d')]||''),'customerIp':_0xae9460,'customerPort':_0x20eac0[_0x62e5('0x98')][_0x62e5('0x9e')]?_0x20eac0[_0x62e5('0x98')][_0x62e5('0x9e')]:null,'referer':_0x20eac0[_0x62e5('0x54')][_0x62e5('0x9f')],'browserName':_0x5ad401[_0x62e5('0xa0')]['name']&&_0x5ad401[_0x62e5('0xa0')][_0x62e5('0xa1')]?util['format'](_0x62e5('0xa2'),_0x5ad401['browser']['name'],_0x5ad401[_0x62e5('0xa0')][_0x62e5('0xa1')]):'unknown','browserVersion':_0x5ad401[_0x62e5('0xa0')][_0x62e5('0xa1')]||'unknown','osName':util['format'](_0x62e5('0xa2'),_0x5ad401['os'][_0x62e5('0x2f')],_0x5ad401['os'][_0x62e5('0xa1')]),'osVersion':_0x5ad401['os']['version'],'deviceModel':_0x5ad401[_0x62e5('0xa3')][_0x62e5('0x37')]&&_0x5ad401[_0x62e5('0xa3')][_0x62e5('0xa4')]?util[_0x62e5('0xa5')](_0x62e5('0xa6'),_0x5ad401[_0x62e5('0xa3')]['model'],_0x5ad401[_0x62e5('0xa3')][_0x62e5('0xa4')],_0x5ad401[_0x62e5('0xa3')][_0x62e5('0x35')]):null,'deviceVendor':_0x5ad401[_0x62e5('0xa3')]['vendor'],'deviceType':_0x5ad401[_0x62e5('0xa3')][_0x62e5('0x35')],'formData':JSON['stringify'](_0x20eac0[_0x62e5('0x54')])};var _0x5e5b8b={'ChatWebsiteId':_0x20eac0[_0x62e5('0x55')]['id'],'closed':![]};if(_0x20eac0[_0x62e5('0x54')][_0x62e5('0xa7')]){_0x5e5b8b['threadId']=_0x20eac0['body'][_0x62e5('0xa7')];return db[_0x62e5('0xa8')][_0x62e5('0x4e')]({'where':_0x5e5b8b})['then'](function(_0x2c3004){if(_0x2c3004){return[_0x2c3004,![]];}_0x2aa0ae[_0x62e5('0xa7')]=_0x20eac0[_0x62e5('0x54')][_0x62e5('0xa7')];_0x2aa0ae[_0x62e5('0xa9')]=_0x20eac0[_0x62e5('0x54')]['externalUrl'];return db[_0x62e5('0xa8')][_0x62e5('0x4f')](_0x2aa0ae)[_0x62e5('0x14')](function(_0x281b84){return[_0x281b84,!![]];});});}_0x5e5b8b[_0x62e5('0xaa')]=_0x23650c['id'];if(_0x20eac0['body'][_0x62e5('0xab')]&&_0x20eac0[_0x62e5('0x54')]['interaction']['id']){_0x5e5b8b['id']=_0x20eac0[_0x62e5('0x54')]['interaction']['id'];return db['ChatInteraction'][_0x62e5('0x4e')]({'where':_0x5e5b8b})[_0x62e5('0x14')](function(_0x193583){if(_0x193583){return[_0x193583,![]];}return db['ChatInteraction']['create'](_0x2aa0ae)[_0x62e5('0x14')](function(_0x1ab365){return[_0x1ab365,!![]];});});}return db[_0x62e5('0xa8')][_0x62e5('0x4f')](_0x2aa0ae)[_0x62e5('0x14')](function(_0x23f7fd){return[_0x23f7fd,!![]];});}})[_0x62e5('0xac')](function(_0x580ac9,_0x7b7934){if(_0x580ac9){_0x1cb5cf=_0x7b7934;if(!_0x7b7934){var _0x2f24d0={'from':(_0x32cf38[_0x62e5('0x96')][_0x62e5('0x9c')]||'')+'\x20'+(_0x32cf38[_0x62e5('0x96')][_0x62e5('0x9d')]||'')};if(_0x20eac0['body']['threadId']&&_0x20eac0[_0x62e5('0x54')]['messageId']&&_0x20eac0[_0x62e5('0x54')][_0x62e5('0xa7')]!=_0x20eac0[_0x62e5('0x54')][_0x62e5('0xad')]){_0x2f24d0[_0x62e5('0xa7')]=_0x20eac0['body'][_0x62e5('0xad')];}return _0x580ac9[_0x62e5('0x29')](_0x2f24d0);}else{return _0x580ac9;}}})['then'](function(_0x62bb47){_0x32cf38[_0x62e5('0xab')]=_0x62bb47[_0x62e5('0x2a')]({'plain':!![]});_0x32cf38[_0x62e5('0xab')]['created']=_0x1cb5cf;if(_0x32cf38[_0x62e5('0xab')]['created']){if(_0x32cf38['account'][_0x62e5('0xae')]){_0x32cf38[_0x62e5('0x91')][_0x62e5('0xaf')]({'id':0x0,'priority':_0x32cf38[_0x62e5('0x91')][_0x62e5('0x3e')]+0x1,'app':_0x62e5('0xb0'),'appdata':_0x62e5('0xb1'),'interval':_0x62e5('0xb2')});}}return db[_0x62e5('0xb3')]['create']({'body':_0x20eac0[_0x62e5('0x54')][_0x62e5('0x54')],'ChatWebsiteId':_0x20eac0[_0x62e5('0x55')]['id'],'ChatInteractionId':_0x62bb47['id'],'direction':'in','ContactId':_0x32cf38[_0x62e5('0x96')]['id'],'AttachmentId':_0x20eac0[_0x62e5('0x54')][_0x62e5('0xb4')]});})[_0x62e5('0x14')](function(_0x2870a1){_0x32cf38[_0x62e5('0x1c')]=_0x2870a1;if(_0x32cf38[_0x62e5('0xab')][_0x62e5('0xb5')]){return db[_0x62e5('0xb6')]['find']({'attributes':['id','name'],'where':{'id':_0x32cf38[_0x62e5('0xab')][_0x62e5('0xb5')]}})[_0x62e5('0x14')](function(_0x2ff5e6){if(_0x2ff5e6){_0x32cf38[_0x62e5('0x91')][_0x62e5('0xb7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2ff5e6[_0x62e5('0x2f')]+','+(_0x32cf38[_0x62e5('0x90')][_0x62e5('0xb8')]||0xa),'interval':_0x62e5('0xb2')});_0x32cf38['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0x62e5('0xb9'),_0x32cf38);});}return respondWithRpcPromise('Start',_0x62e5('0xb9'),_0x32cf38);})[_0x62e5('0x14')](function(_0x2f8840){respondWithRpcPromise(_0x62e5('0xba'),_0x62e5('0xba'),{'event':'notify','message':_0x2f8840},client9002);return _0x2f8840;})['then'](respondWithResult(_0x2978ba,null))[_0x62e5('0x1f')](handleError(_0x2978ba,null));};exports[_0x62e5('0xbb')]=function(_0x28cb62,_0xdab765){var _0x2dbe86,_0x342dd6,_0x434f4c;var _0x2bcb6f=[];var _0x3bd536={};var _0x1833d0=_0x28cb62[_0x62e5('0xbc')]||[];var _0x205ddd=[];var _0x3a382e;return db[_0x62e5('0x7d')][_0x62e5('0x56')]()[_0x62e5('0x14')](function(_0x4edfb4){if(!_0x4edfb4){throw new db[(_0x62e5('0x7e'))][(_0x62e5('0x7f'))](_0x62e5('0xbd'));}_0x2bcb6f=_[_0x62e5('0x80')](_[_0x62e5('0x39')](_0x4edfb4),[_0x62e5('0x81'),_0x62e5('0x82'),'CompanyId',_0x62e5('0x84')]);if(_0x28cb62[_0x62e5('0x54')]['id']){delete _0x28cb62[_0x62e5('0x54')]['id'];}if(_[_0x62e5('0x70')](_0x28cb62[_0x62e5('0x54')][_0x62e5('0x85')])){throw _0xdab765['status'](0x1f4)[_0x62e5('0xbe')](new db[(_0x62e5('0x7e'))][(_0x62e5('0x7f'))](_0x62e5('0x86')));}if(_[_0x62e5('0x70')](_0x28cb62[_0x62e5('0x54')][_0x62e5('0x54')])||_0x28cb62[_0x62e5('0x54')][_0x62e5('0x54')]===''){throw _0xdab765[_0x62e5('0x21')](0x1f4)[_0x62e5('0xbe')](new db['Sequelize']['ValidationError'](_0x62e5('0x87')));}if(_['isNil'](_0x28cb62[_0x62e5('0x54')]['mapKeyOffline'])){throw _0xdab765[_0x62e5('0x21')](0x1f4)[_0x62e5('0xbe')](new db[(_0x62e5('0x7e'))][(_0x62e5('0x7f'))](_0x62e5('0xbf')+_0x2bcb6f));}if(!_['includes'](_0x2bcb6f,_0x28cb62[_0x62e5('0x54')]['mapKeyOffline'])){throw _0xdab765['status'](0x1f4)['send'](new db[(_0x62e5('0x7e'))][(_0x62e5('0x7f'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2bcb6f));}_0x3bd536[_0x28cb62['body']['mapKeyOffline']]=_0x28cb62[_0x62e5('0x54')][_0x62e5('0x85')];})[_0x62e5('0x14')](function(){return db[_0x62e5('0x32')]['find']({'where':{'id':_0x28cb62[_0x62e5('0x55')]['id']},'include':[{'model':db[_0x62e5('0x8b')],'as':_0x62e5('0x8c')},{'model':db[_0x62e5('0xc0')],'as':_0x62e5('0xc0')}]});})[_0x62e5('0x14')](handleEntityNotFound(_0xdab765,null))['then'](function(_0x4709dd){if(_0x4709dd&&_0x4709dd['List']){_0x342dd6=_0x4709dd;var _0x150c1a=_['defaults'](_0x28cb62['body'],{'firstName':_0x28cb62[_0x62e5('0x54')]['from'],'phone':_0x28cb62['body']['from'],'ListId':_0x4709dd[_0x62e5('0x84')]});_0x150c1a[_0x28cb62[_0x62e5('0x54')]['mapKeyOffline']]=_0x28cb62[_0x62e5('0x54')][_0x62e5('0x85')];return db['CmContact']['findOrCreate']({'where':_0x3bd536,'defaults':_0x150c1a});}})['spread'](function(_0x3c9e77){if(_0x3c9e77){_0x434f4c=_0x3c9e77;var _0x327573=fs[_0x62e5('0xc1')](path[_0x62e5('0x6b')](config[_0x62e5('0x6c')],_0x62e5('0xc2')),_0x62e5('0xc3'));var _0x293a63=ejs[_0x62e5('0xc4')](_0x327573,{'body':_[_0x62e5('0xc5')](_0x28cb62[_0x62e5('0x54')]['body']),'bodyTitle':_0x342dd6['offlineMessageBody']});return db[_0x62e5('0xc6')]['create']({'body':_0x293a63,'plainBody':htmlToText[_0x62e5('0xc7')](_0x293a63),'ContactId':_0x3c9e77['id'],'ChatWebsiteId':_0x342dd6['id']});}})['then'](function(_0x53ac50){_0x3a382e=_0x53ac50;if(_0x1833d0['length']){var _0x22fbf6=_0x1833d0['map'](function(_0xbcf32f){return{'name':_0xbcf32f[_0x62e5('0xc8')],'basename':_0xbcf32f[_0x62e5('0x65')],'type':_0xbcf32f[_0x62e5('0xc9')],'ChatOfflineMessageId':_0x53ac50['id']};});_0x205ddd=_0x22fbf6[_0x62e5('0x31')](_0x29354e=>{var _0x46a13a={'filename':_0x29354e['name'],'path':path[_0x62e5('0x6b')](config[_0x62e5('0x6c')],_0x62e5('0xca'),_0x62e5('0xbc'),_0x62e5('0xcb'),'offline-chat',_0x29354e[_0x62e5('0xcc')])};return _0x46a13a;});if(!_0x342dd6['openNewInteraction']){return db[_0x62e5('0xcd')][_0x62e5('0xce')](function(_0x4b6838){return db[_0x62e5('0xcf')][_0x62e5('0xd0')](_0x22fbf6,{'transaction':_0x4b6838});});}}})[_0x62e5('0x14')](function(){if(_0x3a382e){_0x2dbe86=_0x3a382e;return db['MailAccount'][_0x62e5('0x5b')]({'where':{'service':!![]},'include':[{'model':db[_0x62e5('0xd1')],'as':_0x62e5('0xd2'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x62e5('0xd3'),'raw':!![]}]}]});}})['then'](function(_0x131180){if(_0x131180&&_0x131180[_0x62e5('0xd2')]&&_0x342dd6[_0x62e5('0xd4')]&&_0x342dd6[_0x62e5('0xd5')]){var _0x5f0ec1=_0x131180[_0x62e5('0xd6')]();return respondWithRpcPromise(_0x62e5('0xd7'),'sendMail',{'account':_0x5f0ec1,'message':{'from':util[_0x62e5('0xa5')](_0x62e5('0xd8'),_0x131180[_0x62e5('0x2f')],_0x131180['email']||_0x131180[_0x62e5('0xd2')][_0x62e5('0x50')]),'to':_0x342dd6[_0x62e5('0xd5')],'subject':_0x342dd6['offlineMessageSubject'],'html':_0x2dbe86[_0x62e5('0x54')],'attachments':_0x205ddd}},client9003)['then'](function(){return _0x2dbe86;})[_0x62e5('0x1f')](function(_0xe28606){logger['error'](_0xe28606);});}})[_0x62e5('0x14')](function(){if(_0x342dd6&&_0x342dd6[_0x62e5('0xd9')]&&_0x342dd6['MailAccountId']){var _0x1bba93=[];if(_0x1833d0[_0x62e5('0x3e')]){_0x1bba93=_0x1833d0['map'](function(_0x31f94d){return{'name':_0x31f94d[_0x62e5('0xc8')],'basename':_0x31f94d[_0x62e5('0x65')],'type':_0x31f94d[_0x62e5('0xc9')],'ChatOfflineMessageId':_0x3a382e['id']};});}var _0x44f7b9;if(!_[_0x62e5('0x70')](_0x342dd6['subjectOffline'])){var _0x40d901=_[_0x62e5('0x31')](_0x28cb62['body'],function(_0x4aff00){return _0x4aff00;});var _0x2b80da=_[_0x62e5('0xda')](_0x40d901)[0x0];var _0x1292b0=_[_0x62e5('0xdb')](_0x2b80da,function(_0x369aff){return _0x369aff;});_0x44f7b9=_0x1292b0[0x1][_0x342dd6['subjectOffline']];}var _0x1acff0={'from':_0x434f4c[_0x62e5('0xdc')],'firstName':_0x434f4c[_0x62e5('0x9c')],'lastName':_0x434f4c['lastName'],'mapKey':_0x62e5('0xdc'),'message':{'from':_0x434f4c[_0x62e5('0xdc')],'to':_0x342dd6[_0x62e5('0xc0')][_0x62e5('0xdc')],'cc':'','subject':_['isNil'](_0x44f7b9)?_0x342dd6['offlineMessageSubject']:_0x44f7b9,'messageId':'','sentAt':new Date(),'attach':_0x1bba93[_0x62e5('0x3e')],'attachments':_0x1bba93,'originChannel':_0x62e5('0xdd'),'ChatWebsiteId':_0x342dd6['id'],'ChatOfflineMessageId':_0x2dbe86['id'],'originTo':_0x342dd6['MailAccount'][_0x62e5('0xdc')]},'body':_0x2dbe86[_0x62e5('0x54')]};var _0x5cb915={'account':{'id':_0x342dd6[_0x62e5('0xde')]},'body':_0x1acff0,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x62e5('0xdf'),_0x62e5('0xe0'),_0x5cb915,client9001)[_0x62e5('0x14')](function(){return _0x2dbe86;})[_0x62e5('0x1f')](function(_0x16045b){logger[_0x62e5('0x1a')](_0x16045b);});}return;})['then'](function(){if(_0x2dbe86){return _0x2dbe86;}})[_0x62e5('0x14')](respondWithResult(_0xdab765,null))[_0x62e5('0x1f')](function(_0x3c5580){logger[_0x62e5('0x1a')](_0x62e5('0x1f'),_0x3c5580);for(var _0xa596e0 of _0x1833d0){var _0x1f7bd1=path['join'](config['root'],_0x62e5('0xca'),_0x62e5('0xbc'),'attachments',_0x62e5('0xe1'),_0xa596e0[_0x62e5('0x65')]);fs_extra['remove'](_0x1f7bd1)[_0x62e5('0x1f')](function(_0x514100){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x1f7bd1,_0x514100);});}});};exports[_0x62e5('0xe2')]=function(_0x333943,_0x10435f){return db[_0x62e5('0xa8')][_0x62e5('0x4e')]({'where':{'id':_0x333943[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x10435f,null))[_0x62e5('0x14')](function(_0x1693e4){if(_0x1693e4){return _0x1693e4['addInteraction'](_0x333943[_0x62e5('0x54')][_0x62e5('0xe3')],_['omit'](_0x333943[_0x62e5('0x54')],[_0x62e5('0xe3'),'id'])||{});}})[_0x62e5('0x14')](respondWithResult(_0x10435f,null))[_0x62e5('0x1f')](handleError(_0x10435f,null));};exports[_0x62e5('0xe4')]=function(_0x4e21a2,_0x87c5ab){var _0x897109={'raw':![],'where':{}};var _0x16287a={};var _0x2dbfc4={'count':0x0,'rows':[]};return db[_0x62e5('0x32')][_0x62e5('0x5b')]({'where':{'id':_0x4e21a2['params']['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x87c5ab,null))[_0x62e5('0x14')](function(_0x233894){if(_0x233894){_0x16287a[_0x62e5('0x37')]=_[_0x62e5('0x39')](db[_0x62e5('0xa8')][_0x62e5('0x33')]);_0x16287a[_0x62e5('0x38')]=_[_0x62e5('0x39')](_0x4e21a2['query']);_0x16287a[_0x62e5('0x3a')]=_[_0x62e5('0x3b')](_0x16287a[_0x62e5('0x37')],_0x16287a[_0x62e5('0x38')]);_0x897109[_0x62e5('0x3c')]=_[_0x62e5('0x3b')](_0x16287a['model'],qs[_0x62e5('0x3d')](_0x4e21a2[_0x62e5('0x38')][_0x62e5('0x3d')]));_0x897109['attributes']=_0x897109[_0x62e5('0x3c')]['length']?_0x897109[_0x62e5('0x3c')]:_0x16287a[_0x62e5('0x37')];if(!_0x4e21a2[_0x62e5('0x38')][_0x62e5('0x3f')](_0x62e5('0x40'))){_0x897109[_0x62e5('0x25')]=qs[_0x62e5('0x25')](_0x4e21a2[_0x62e5('0x38')][_0x62e5('0x25')]);_0x897109[_0x62e5('0x23')]=qs['offset'](_0x4e21a2[_0x62e5('0x38')]['offset']);}_0x897109[_0x62e5('0x41')]=qs[_0x62e5('0x42')](_0x4e21a2[_0x62e5('0x38')][_0x62e5('0x42')]);_0x897109['where']=qs[_0x62e5('0x3a')](_['pick'](_0x4e21a2[_0x62e5('0x38')],_0x16287a[_0x62e5('0x3a')]));_0x897109[_0x62e5('0x43')][_0x62e5('0x58')]=_0x233894['id'];if(_0x4e21a2[_0x62e5('0x38')][_0x62e5('0x44')]){_0x897109[_0x62e5('0x43')]=_[_0x62e5('0x46')](_0x897109[_0x62e5('0x43')],{'$or':_[_0x62e5('0x31')](_0x897109[_0x62e5('0x3c')],function(_0x7cd930){var _0x2aa5ba={};_0x2aa5ba[_0x7cd930]={'$like':'%'+_0x4e21a2[_0x62e5('0x38')][_0x62e5('0x44')]+'%'};return _0x2aa5ba;})});}_0x897109=_[_0x62e5('0x46')]({},_0x897109,_0x4e21a2[_0x62e5('0x47')]);return db['ChatInteraction'][_0x62e5('0x26')]({'where':_0x897109['where']})['then'](function(_0x3ac5b7){_0x2dbfc4[_0x62e5('0x26')]=_0x3ac5b7;if(_0x4e21a2[_0x62e5('0x38')]['includeAll']){_0x897109['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x62e5('0xb6')],'as':_0x62e5('0xe5'),'attributes':[_0x62e5('0x2f'),_0x62e5('0xe6'),_0x62e5('0xe7')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x62e5('0x2f'),_0x62e5('0xe8')],'where':_0x4e21a2[_0x62e5('0x38')][_0x62e5('0xe9')]?{'id':_0x4e21a2['query'][_0x62e5('0xe9')]}:undefined,'required':_0x4e21a2[_0x62e5('0x38')][_0x62e5('0xe9')]?!![]:![]}];}return db[_0x62e5('0xa8')][_0x62e5('0x4a')](_0x897109);})[_0x62e5('0x14')](function(_0x18aab9){_0x2dbfc4[_0x62e5('0x4b')]=_0x18aab9;return _0x2dbfc4;});}})[_0x62e5('0x14')](respondWithFilteredResult(_0x87c5ab,_0x897109))['catch'](handleError(_0x87c5ab,null));};function iftimePromise(_0xeaff20,_0x56b4ae){return respondWithRpcPromise('Command','getSnippet',{'command':_0x56b4ae[_0x62e5('0xea')]?util[_0x62e5('0xa5')](_0x62e5('0xeb'),_0xeaff20[_0x62e5('0xec')],_0x56b4ae[_0x62e5('0xea')]):util['format'](_0x62e5('0xed'),_0xeaff20[_0x62e5('0xec')])},client9002)[_0x62e5('0x14')](function(_0x1f706a){var _0x471a4d=_0x1f706a&&_0x1f706a[_0x62e5('0xee')](_0x62e5('0xef'))>=0x0?!![]:![];logger[_0x62e5('0x1d')](_0x62e5('0xf0'),_0x56b4ae['id'],_0xeaff20['id'],_0xeaff20[_0x62e5('0xec')],_0x471a4d?_0x62e5('0xf1'):_0x62e5('0xf2'),_0x56b4ae[_0x62e5('0xea')]?_0x56b4ae['timezone']:_0x62e5('0xf3'));return _0x471a4d;})[_0x62e5('0x1f')](function(_0x289a7a){logger[_0x62e5('0x1a')](_0x62e5('0xf0'),_0x56b4ae['id'],_0xeaff20['id'],_0xeaff20[_0x62e5('0xec')],util[_0x62e5('0xf4')](_0x289a7a,{'showHidden':![],'depth':null}),_0x56b4ae[_0x62e5('0xea')]?_0x56b4ae[_0x62e5('0xea')]:_0x62e5('0xf3'));return![];});}exports[_0x62e5('0xf5')]=function(_0x5913d5,_0x5b74cd){var _0x5462b3=0x0;var _0x4ae02b=0x0;var _0xa9bce6=![];var _0xe36df9;var _0x154d0d;return db['ChatWebsite']['find']({'where':{'id':_0x5913d5['params']['id']},'include':[{'model':db[_0x62e5('0xf6')],'as':'Interval','include':[{'model':db[_0x62e5('0xf6')],'as':_0x62e5('0xf7'),'attributes':['id',_0x62e5('0xec')],'raw':!![]}]}]})[_0x62e5('0x14')](handleEntityNotFound(_0x5b74cd,null))[_0x62e5('0x14')](function(_0x208dca){if(_0x208dca){_0xe36df9=_0x208dca;return _0x208dca[_0x62e5('0xf8')]({'raw':!![]});}})[_0x62e5('0x14')](function(_0x5892f2){if(_0xe36df9){if(_0x5892f2){_0x154d0d=_0x5892f2;}}return require(_0x62e5('0x6d'))['getLicense']();})[_0x62e5('0x14')](function(_0x510836){if(_0x510836){_0x4ae02b=_0x510836['virtual'];_0xa9bce6=_0x510836[_0x62e5('0x6f')];}})[_0x62e5('0x14')](function(){return db[_0x62e5('0xa8')][_0x62e5('0x26')]({'where':{'closed':![]}});})[_0x62e5('0x14')](function(_0x2bc6bc){_0x5462b3=_0x2bc6bc;if(_0x4ae02b&&_0x2bc6bc>_0x4ae02b){return db[_0x62e5('0xf9')][_0x62e5('0x5b')]({'where':{'id':0x1}})[_0x62e5('0x14')](function(_0x64bd21){if(_0x64bd21){_0x64bd21[_0x62e5('0xfa')](_0x62e5('0xfb'));}});}})[_0x62e5('0x14')](function(){if(_0xe36df9[_0x62e5('0xf6')]&&_0xe36df9[_0x62e5('0xf6')][_0x62e5('0xf7')]){var _0xcf37c6=[];for(var _0x5283fa=0x0;_0x5283fa<_0xe36df9[_0x62e5('0xf6')][_0x62e5('0xf7')][_0x62e5('0x3e')];_0x5283fa++){var _0x47fd1e=_0xe36df9[_0x62e5('0xf6')][_0x62e5('0xf7')][_0x5283fa][_0x62e5('0x2a')]({'plain':!![]});_0xcf37c6['push'](iftimePromise(_0x47fd1e,_0xe36df9));}return BPromise[_0x62e5('0xfc')](_0xcf37c6)[_0x62e5('0x14')](function(_0xac5d72){return _[_0x62e5('0xfd')](_0xac5d72);});}else{return!![];}})['then'](function(_0x2e8e8b){var _0x13cfd3=fs[_0x62e5('0xc1')](path[_0x62e5('0x6b')](config[_0x62e5('0x6c')],_0x62e5('0xfe')),'utf8');var _0x3d96c0=new url[(_0x62e5('0xff'))](_0xe36df9[_0x62e5('0x100')])[_0x62e5('0x101')];var _0x5b84df=_0x62e5('0x102');var _0x2eda41=![];var _0x30db6d={'chatVersion':_0x5b84df,'chatWebsiteAddressOrigin':_0x3d96c0,'remote':_0xe36df9['remote'],'query':querystring[_0x62e5('0x19')](_[_0x62e5('0x46')](_0xe36df9['get']({'plain':!![]}),{'customerIp':_0x5913d5[_0x62e5('0x98')]['x-forwarded-for']||_0x5913d5[_0x62e5('0x98')][_0x62e5('0x103')]||_0x5913d5[_0x62e5('0x104')]['remoteAddress']||_0x5913d5['ip'],'referer':_0x5913d5[_0x62e5('0x98')]['referer'],'openedInteractions':_0x5462b3,'maxInteractions':_0x4ae02b,'virtual':_0xa9bce6[_0x62e5('0x105')],'online':_0x2e8e8b,'custom':_0xa9bce6}))['replace'](/'/g,'\x5c\x27')};_0x5b74cd[_0x62e5('0xbe')](ejs[_0x62e5('0xc4')](Mustache[_0x62e5('0xc4')](_0x13cfd3,_0x30db6d),{'proactiveActions':_0x154d0d,'alignment':_0xe36df9[_0x62e5('0x106')],'verticalAlignment':_0xe36df9[_0x62e5('0x107')],'div_color':_0xe36df9['color'],'labelText':_0xe36df9[_0x62e5('0x108')],'text_color':_0xe36df9[_0x62e5('0x109')],'text_button_color':_0xe36df9[_0x62e5('0x10a')],'button_color':_0xe36df9[_0x62e5('0x10b')],'background_color':_0xe36df9[_0x62e5('0x10c')],'hideWhenOffline':_0xe36df9[_0x62e5('0x10d')],'intervalId':_0xe36df9['IntervalId'],'isDevelopment':_0x2eda41,'chatVersion':_0x5b84df}));})['catch'](handleError(_0x5b74cd,null));};exports[_0x62e5('0x10e')]=function(_0xa5aa91,_0x3223ba){var _0x4b4182=_0xa5aa91[_0x62e5('0x55')]['id'];var _0xfc10e5=_0xa5aa91[_0x62e5('0x54')];var _0x2aad12=0xc8;var _0x5a21fc=null;return db[_0x62e5('0xcd')]['transaction']({'isolationLevel':db[_0x62e5('0xcd')][_0x62e5('0x10f')]['ISOLATION_LEVELS'][_0x62e5('0x110')]},function(_0x528ec9){return db[_0x62e5('0x32')][_0x62e5('0x5b')]({'where':{'id':_0x4b4182},'transaction':_0x528ec9})[_0x62e5('0x14')](function(_0x5cc664){if(_0x5cc664){return db['ChatApplication'][_0x62e5('0x2d')]({'where':{'ChatWebsiteId':_0x4b4182},'transaction':_0x528ec9})['then'](function(){var _0x141714=_[_0x62e5('0x31')](_0xfc10e5,function(_0x4c1918){_0x4c1918[_0x62e5('0x58')]=_0x4b4182;return _0x4c1918;});return db[_0x62e5('0x8f')][_0x62e5('0xd0')](_0x141714,{'transaction':_0x528ec9});});}else{_0x2aad12=0x194;_0x5a21fc=[];}});})[_0x62e5('0x14')](function(){if(_0x2aad12!==0x194){return db['ChatApplication'][_0x62e5('0x111')]({'where':{'ChatWebsiteId':_0x4b4182},'order':_0x62e5('0x94')})['then'](function(_0x386bfc){_0x5a21fc=_0x386bfc;});}})[_0x62e5('0x1f')](function(_0x495f5f){_0x2aad12=0x1f4;logger[_0x62e5('0x1a')](_0x495f5f[_0x62e5('0x2e')]);if(_0x495f5f[_0x62e5('0x2f')]){delete _0x495f5f[_0x62e5('0x2f')];}_0x5a21fc=_0x495f5f;})['finally'](function(){if(_0x5a21fc===null){_0x3223ba[_0x62e5('0x20')](_0x2aad12);}else{if(_0x2aad12===0x1f4){_0x3223ba[_0x62e5('0x21')](_0x2aad12)['send'](_0x5a21fc);}else{_0x3223ba[_0x62e5('0x21')](_0x2aad12)['json'](_0x5a21fc);}}});};exports['getApplications']=function(_0x338592,_0x37d023){var _0x259ac9={};var _0x2cad59={};var _0xbf5437;var _0x5b3565;return db['ChatWebsite'][_0x62e5('0x5b')]({'where':{'id':_0x338592['params']['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x37d023,null))[_0x62e5('0x14')](function(_0x1c7545){if(_0x1c7545){_0xbf5437=_0x1c7545;_0x2cad59['model']=_[_0x62e5('0x39')](db[_0x62e5('0x8f')][_0x62e5('0x33')]);_0x2cad59[_0x62e5('0x38')]=_[_0x62e5('0x39')](_0x338592[_0x62e5('0x38')]);_0x2cad59[_0x62e5('0x3a')]=_['intersection'](_0x2cad59[_0x62e5('0x37')],_0x2cad59[_0x62e5('0x38')]);_0x259ac9[_0x62e5('0x3c')]=_[_0x62e5('0x3b')](_0x2cad59[_0x62e5('0x37')],qs[_0x62e5('0x3d')](_0x338592[_0x62e5('0x38')][_0x62e5('0x3d')]));_0x259ac9[_0x62e5('0x3c')]=_0x259ac9[_0x62e5('0x3c')][_0x62e5('0x3e')]?_0x259ac9[_0x62e5('0x3c')]:_0x2cad59[_0x62e5('0x37')];_0x259ac9[_0x62e5('0x41')]=qs[_0x62e5('0x42')](_0x338592[_0x62e5('0x38')][_0x62e5('0x42')]);_0x259ac9['where']=qs['filters'](_[_0x62e5('0x5c')](_0x338592[_0x62e5('0x38')],_0x2cad59[_0x62e5('0x3a')]));if(_0x338592['query'][_0x62e5('0x44')]){_0x259ac9[_0x62e5('0x43')]=_['merge'](_0x259ac9[_0x62e5('0x43')],{'$or':_[_0x62e5('0x31')](_0x259ac9[_0x62e5('0x3c')],function(_0x2cfe9f){var _0x4cf0ab={};_0x4cf0ab[_0x2cfe9f]={'$like':'%'+_0x338592['query'][_0x62e5('0x44')]+'%'};return _0x4cf0ab;})});}_0x259ac9=_['merge']({},_0x259ac9,_0x338592['options']);return _0xbf5437[_0x62e5('0x112')](_0x259ac9);}})[_0x62e5('0x14')](function(_0xc3adc3){if(_0xc3adc3){_0x5b3565=_0xc3adc3[_0x62e5('0x3e')];if(!_0x338592[_0x62e5('0x38')][_0x62e5('0x3f')]('nolimit')){_0x259ac9['limit']=qs[_0x62e5('0x25')](_0x338592[_0x62e5('0x38')][_0x62e5('0x25')]);_0x259ac9[_0x62e5('0x23')]=qs[_0x62e5('0x23')](_0x338592['query'][_0x62e5('0x23')]);}return _0xbf5437[_0x62e5('0x112')](_0x259ac9);}})['then'](function(_0x3d0edf){if(_0x3d0edf){return _0x3d0edf?{'count':_0x5b3565,'rows':_0x3d0edf}:null;}})[_0x62e5('0x14')](respondWithResult(_0x37d023,null))[_0x62e5('0x1f')](handleError(_0x37d023,null));};exports[_0x62e5('0x113')]=function(_0xaf1909,_0x2b8138){return db[_0x62e5('0x114')][_0x62e5('0x4e')]({'where':{'id':_0xaf1909[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x2b8138,null))[_0x62e5('0x14')](function(_0x5986f6){if(_0x5986f6){return _0x5986f6['addProactiveActions'](_0xaf1909[_0x62e5('0x54')][_0x62e5('0xe3')],_[_0x62e5('0x115')](_0xaf1909[_0x62e5('0x54')],[_0x62e5('0xe3'),'id'])||{});}})['then'](respondWithResult(_0x2b8138,null))[_0x62e5('0x1f')](handleError(_0x2b8138,null));};exports[_0x62e5('0xf8')]=function(_0x2f313d,_0xbeb1d0){var _0x51e909={};var _0x261ff1={};var _0x12f973;var _0x4d4109;return db['ChatWebsite'][_0x62e5('0x5b')]({'where':{'id':_0x2f313d[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0xbeb1d0,null))[_0x62e5('0x14')](function(_0x5b27cf){if(_0x5b27cf){_0x12f973=_0x5b27cf;_0x261ff1[_0x62e5('0x37')]=_[_0x62e5('0x39')](db[_0x62e5('0x116')][_0x62e5('0x33')]);_0x261ff1[_0x62e5('0x38')]=_[_0x62e5('0x39')](_0x2f313d[_0x62e5('0x38')]);_0x261ff1[_0x62e5('0x3a')]=_[_0x62e5('0x3b')](_0x261ff1[_0x62e5('0x37')],_0x261ff1[_0x62e5('0x38')]);_0x51e909[_0x62e5('0x3c')]=_[_0x62e5('0x3b')](_0x261ff1[_0x62e5('0x37')],qs[_0x62e5('0x3d')](_0x2f313d['query'][_0x62e5('0x3d')]));_0x51e909[_0x62e5('0x3c')]=_0x51e909['attributes']['length']?_0x51e909[_0x62e5('0x3c')]:_0x261ff1['model'];_0x51e909[_0x62e5('0x41')]=qs[_0x62e5('0x42')](_0x2f313d[_0x62e5('0x38')][_0x62e5('0x42')]);_0x51e909[_0x62e5('0x43')]=qs['filters'](_['pick'](_0x2f313d[_0x62e5('0x38')],_0x261ff1[_0x62e5('0x3a')]));if(_0x2f313d[_0x62e5('0x38')][_0x62e5('0x44')]){_0x51e909[_0x62e5('0x43')]=_[_0x62e5('0x46')](_0x51e909[_0x62e5('0x43')],{'$or':_[_0x62e5('0x31')](_0x51e909[_0x62e5('0x3c')],function(_0x3518b1){var _0x45e037={};_0x45e037[_0x3518b1]={'$like':'%'+_0x2f313d[_0x62e5('0x38')][_0x62e5('0x44')]+'%'};return _0x45e037;})});}_0x51e909=_[_0x62e5('0x46')]({},_0x51e909,_0x2f313d[_0x62e5('0x47')]);return _0x12f973[_0x62e5('0xf8')](_0x51e909);}})[_0x62e5('0x14')](function(_0x145e03){if(_0x145e03){_0x4d4109=_0x145e03[_0x62e5('0x3e')];if(!_0x2f313d[_0x62e5('0x38')][_0x62e5('0x3f')](_0x62e5('0x40'))){_0x51e909[_0x62e5('0x25')]=qs['limit'](_0x2f313d['query'][_0x62e5('0x25')]);_0x51e909[_0x62e5('0x23')]=qs[_0x62e5('0x23')](_0x2f313d[_0x62e5('0x38')][_0x62e5('0x23')]);}return _0x12f973[_0x62e5('0xf8')](_0x51e909);}})['then'](function(_0x5bc46f){if(_0x5bc46f){return _0x5bc46f?{'count':_0x4d4109,'rows':_0x5bc46f}:null;}})[_0x62e5('0x14')](respondWithResult(_0xbeb1d0,null))[_0x62e5('0x1f')](handleError(_0xbeb1d0,null));};exports[_0x62e5('0x117')]=function(_0xa4d3a4,_0x22852e){var _0x5812a6=_0xa4d3a4[_0x62e5('0x38')][_0x62e5('0x118')]===_0x62e5('0x119')?_0x62e5('0x11a'):'onlineForm';return db[_0x62e5('0x32')][_0x62e5('0x4e')]({'attributes':['id',_0x5812a6],'where':{'id':_0xa4d3a4['params']['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x22852e,null))[_0x62e5('0x14')](function(_0x5a9751){if(_0x5a9751){var _0x25a493=_0x5a9751[_0x5812a6];var _0x3c7631=_0x25a493&&_0x25a493[_0x62e5('0x11b')]?_0x25a493[_0x62e5('0x11b')]:[];_0x22852e['send']({'fromKey':_['isNil'](_0x25a493[_0x62e5('0x11c')])?undefined:_0x25a493[_0x62e5('0x11c')],'count':_0x3c7631[_0x62e5('0x3e')],'rows':_0x3c7631});}})['catch'](handleError(_0x22852e,null));};exports['getOfflineMessages']=function(_0x4366a3,_0x40a263){var _0x5f3987={'raw':![],'where':{}};var _0x59ef0b={};var _0x147ff0={'count':0x0,'rows':[]};return db[_0x62e5('0x32')]['findOne']({'where':{'id':_0x4366a3[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x40a263,null))[_0x62e5('0x14')](function(_0x517871){if(_0x517871){_0x59ef0b['model']=_[_0x62e5('0x39')](db[_0x62e5('0xc6')][_0x62e5('0x33')]);_0x59ef0b['query']=_['keys'](_0x4366a3[_0x62e5('0x38')]);_0x59ef0b[_0x62e5('0x3a')]=_['intersection'](_0x59ef0b[_0x62e5('0x37')],_0x59ef0b[_0x62e5('0x38')]);_0x5f3987[_0x62e5('0x3c')]=_[_0x62e5('0x3b')](_0x59ef0b['model'],qs[_0x62e5('0x3d')](_0x4366a3[_0x62e5('0x38')]['fields']));_0x5f3987[_0x62e5('0x3c')]=_0x5f3987[_0x62e5('0x3c')][_0x62e5('0x3e')]?_0x5f3987[_0x62e5('0x3c')]:_0x59ef0b[_0x62e5('0x37')];if(!_0x4366a3['query'][_0x62e5('0x3f')]('nolimit')){_0x5f3987[_0x62e5('0x25')]=qs[_0x62e5('0x25')](_0x4366a3[_0x62e5('0x38')]['limit']);_0x5f3987[_0x62e5('0x23')]=qs[_0x62e5('0x23')](_0x4366a3[_0x62e5('0x38')][_0x62e5('0x23')]);}_0x5f3987[_0x62e5('0x41')]=qs[_0x62e5('0x42')](_0x4366a3[_0x62e5('0x38')]['sort']);_0x5f3987[_0x62e5('0x43')]=qs[_0x62e5('0x3a')](_[_0x62e5('0x5c')](_0x4366a3['query'],_0x59ef0b[_0x62e5('0x3a')]));_0x5f3987[_0x62e5('0x43')][_0x62e5('0x58')]=_0x517871['id'];if(_0x4366a3[_0x62e5('0x38')]['filter']){_0x5f3987[_0x62e5('0x43')]=_[_0x62e5('0x46')](_0x5f3987[_0x62e5('0x43')],{'$or':_[_0x62e5('0x31')](_0x5f3987['attributes'],function(_0x159d9f){var _0x4288e7={};_0x4288e7[_0x159d9f]={'$like':'%'+_0x4366a3[_0x62e5('0x38')][_0x62e5('0x44')]+'%'};return _0x4288e7;})});}_0x5f3987=_[_0x62e5('0x46')]({},_0x5f3987,_0x4366a3[_0x62e5('0x47')]);return db[_0x62e5('0xc6')][_0x62e5('0x26')]({'where':_0x5f3987['where']})[_0x62e5('0x14')](function(_0x1861e6){_0x147ff0[_0x62e5('0x26')]=_0x1861e6;if(_0x4366a3[_0x62e5('0x38')][_0x62e5('0x48')]){_0x5f3987[_0x62e5('0x49')]=[{'all':!![]}];}else{_0x5f3987[_0x62e5('0x49')]=[{'model':db[_0x62e5('0x7d')],'as':_0x62e5('0x11d'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0x62e5('0xc6')][_0x62e5('0x4a')](_0x5f3987);})[_0x62e5('0x14')](function(_0x49cac6){_0x147ff0[_0x62e5('0x4b')]=_0x49cac6;return _0x147ff0;});}})['then'](respondWithFilteredResult(_0x40a263,_0x5f3987))[_0x62e5('0x1f')](handleError(_0x40a263,null));};exports['addAgents']=function(_0x4dd6f4,_0x5f43d6){return db[_0x62e5('0x32')][_0x62e5('0x4e')]({'where':{'id':_0x4dd6f4[_0x62e5('0x55')]['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x5f43d6,null))[_0x62e5('0x14')](function(_0xdbc0be){if(_0xdbc0be){return _0xdbc0be[_0x62e5('0x11e')](_0x4dd6f4[_0x62e5('0x54')]['ids'],_[_0x62e5('0x115')](_0x4dd6f4[_0x62e5('0x54')],[_0x62e5('0xe3'),'id'])||{})[_0x62e5('0xac')](function(_0x3145f8){for(var _0xe4e6c7=0x0;_0xe4e6c7<_0x4dd6f4['body'][_0x62e5('0xe3')]['length'];_0xe4e6c7+=0x1){socket[_0x62e5('0x11f')](_0x62e5('0x120'),{'UserId':Number(_0x4dd6f4['body']['ids'][_0xe4e6c7]),'ChatWebsiteId':Number(_0x4dd6f4['params']['id'])});}return _0x3145f8;});}})['then'](respondWithResult(_0x5f43d6,null))[_0x62e5('0x1f')](handleError(_0x5f43d6,null));};exports[_0x62e5('0x121')]=function(_0x516599,_0x1fe39f){return db['ChatWebsite']['find']({'where':{'id':_0x516599[_0x62e5('0x55')]['id']}})['then'](handleEntityNotFound(_0x1fe39f,null))[_0x62e5('0x14')](function(_0x447d20){if(_0x447d20){return _0x447d20[_0x62e5('0x121')](_0x516599[_0x62e5('0x38')]['ids'])['then'](function(){if(_[_0x62e5('0x122')](_0x516599[_0x62e5('0x38')]['ids'])){for(var _0x3fbf8d=0x0;_0x3fbf8d<_0x516599[_0x62e5('0x38')]['ids'][_0x62e5('0x3e')];_0x3fbf8d+=0x1){socket[_0x62e5('0x11f')](_0x62e5('0x123'),{'UserId':Number(_0x516599[_0x62e5('0x38')]['ids'][_0x3fbf8d]),'ChatWebsiteId':Number(_0x516599[_0x62e5('0x55')]['id'])});}}else{socket[_0x62e5('0x11f')](_0x62e5('0x123'),{'UserId':Number(_0x516599[_0x62e5('0x38')]['ids']),'ChatWebsiteId':Number(_0x516599[_0x62e5('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x1fe39f,null))[_0x62e5('0x1f')](handleError(_0x1fe39f,null));};exports[_0x62e5('0x124')]=function(_0x14e1bb,_0x3e1045){var _0x22a74e={};var _0x537f97={};var _0x3d7b4d;var _0x1cd0e0;return db[_0x62e5('0x32')][_0x62e5('0x5b')]({'where':{'id':_0x14e1bb['params']['id']}})[_0x62e5('0x14')](handleEntityNotFound(_0x3e1045,null))[_0x62e5('0x14')](function(_0x1bed1d){if(_0x1bed1d){_0x3d7b4d=_0x1bed1d;_0x537f97['model']=_[_0x62e5('0x39')](db[_0x62e5('0xb6')][_0x62e5('0x33')]);_0x537f97[_0x62e5('0x38')]=_[_0x62e5('0x39')](_0x14e1bb[_0x62e5('0x38')]);_0x537f97[_0x62e5('0x3a')]=_[_0x62e5('0x3b')](_0x537f97[_0x62e5('0x37')],_0x537f97[_0x62e5('0x38')]);_0x22a74e['attributes']=_['intersection'](_0x537f97[_0x62e5('0x37')],qs[_0x62e5('0x3d')](_0x14e1bb['query'][_0x62e5('0x3d')]));_0x22a74e[_0x62e5('0x3c')]=_0x22a74e[_0x62e5('0x3c')][_0x62e5('0x3e')]?_0x22a74e['attributes']:_0x537f97[_0x62e5('0x37')];_0x22a74e[_0x62e5('0x41')]=qs[_0x62e5('0x42')](_0x14e1bb['query']['sort']);_0x22a74e['where']=qs[_0x62e5('0x3a')](_[_0x62e5('0x5c')](_0x14e1bb[_0x62e5('0x38')],_0x537f97[_0x62e5('0x3a')]));if(_0x14e1bb[_0x62e5('0x38')][_0x62e5('0x44')]){_0x22a74e[_0x62e5('0x43')]=_[_0x62e5('0x46')](_0x22a74e[_0x62e5('0x43')],{'$or':_[_0x62e5('0x31')](_0x22a74e['attributes'],function(_0x3cb6ec){var _0x16d118={};_0x16d118[_0x3cb6ec]={'$like':'%'+_0x14e1bb[_0x62e5('0x38')][_0x62e5('0x44')]+'%'};return _0x16d118;})});}_0x22a74e=_[_0x62e5('0x46')]({},_0x22a74e,_0x14e1bb[_0x62e5('0x47')]);return _0x3d7b4d[_0x62e5('0x124')](_0x22a74e);}})[_0x62e5('0x14')](function(_0x4a761e){if(_0x4a761e){_0x1cd0e0=_0x4a761e['length'];if(!_0x14e1bb['query']['hasOwnProperty']('nolimit')){_0x22a74e['limit']=qs['limit'](_0x14e1bb[_0x62e5('0x38')][_0x62e5('0x25')]);_0x22a74e[_0x62e5('0x23')]=qs['offset'](_0x14e1bb[_0x62e5('0x38')][_0x62e5('0x23')]);}return _0x3d7b4d[_0x62e5('0x124')](_0x22a74e);}})[_0x62e5('0x14')](function(_0x35fc93){if(_0x35fc93){return _0x35fc93?{'count':_0x1cd0e0,'rows':_0x35fc93}:null;}})[_0x62e5('0x14')](respondWithResult(_0x3e1045,null))['catch'](handleError(_0x3e1045,null));}; \ No newline at end of file +var _0x61bd=['offlineMessageSubject','MailAccountId','originalname','subjectOffline','toPairsIn','Chat','notifyMail','server','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Owner','fullname','internal','Tags','color','tag','Command','iftime\x20%s,%s','timezone','iftime\x20%s','interval','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','getSnippet','Interval','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','Intervals','all','URL','address','origin','3.1.0','x-real-ip','connection','remoteAddress','referer','replace','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','chatProactiveAction','addProactiveActions','omit','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','path','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','redis','defaults','localhost','register','html-to-text','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','get','ChatWebsites','UserProfileResource','name','send','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','Pause','fields','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','update','params','describe','addDisposition','Disposition','findOne','order','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','sitepic','../../config/license/util','custom','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','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','account','applications','Applications','list','orderBy','priority','asc','contact','customerIp','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','%s\x20%s','version','unknown','format','device','vendor','stringify','ChatInteraction','threadId','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','files','attachments','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','forwardOffline','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email'];(function(_0x5cb6a9,_0x2422cb){var _0x469f1c=function(_0x2d6cee){while(--_0x2d6cee){_0x5cb6a9['push'](_0x5cb6a9['shift']());}};_0x469f1c(++_0x2422cb);}(_0x61bd,0x180));var _0xd61b=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x61bd[_0x59bcb1];return _0x4a737f;};'use strict';var BPromise=require(_0xd61b('0x0'));var Mustache=require(_0xd61b('0x1'));var util=require('util');var path=require(_0xd61b('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0xd61b('0x3'));var Redis=require('ioredis');var qs=require(_0xd61b('0x4'));var logger=require(_0xd61b('0x5'))(_0xd61b('0x6'));var config=require(_0xd61b('0x7'));var url=require(_0xd61b('0x8'));var db=require('../../mysqldb')['db'];config[_0xd61b('0x9')]=_[_0xd61b('0xa')](config[_0xd61b('0x9')],{'host':_0xd61b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd61b('0x9')]));require('./chatWebsite.socket')[_0xd61b('0xc')](socket);var htmlToText=require(_0xd61b('0xd'));var jayson=require('jayson/promise');var client=jayson[_0xd61b('0xe')][_0xd61b('0xf')]({'port':0x232c});var client9002=jayson['client'][_0xd61b('0xf')]({'port':0x232a});var client9003=jayson[_0xd61b('0xe')]['http']({'port':0x232b});var client9001=jayson[_0xd61b('0xe')][_0xd61b('0xf')]({'port':0x2329});function respondWithRpcPromise(_0x42d675,_0x16e969,_0x527d5d,_0x3f2cbb){return new BPromise(function(_0x5705b2,_0x5de4fe){var _0x1cf78c=_0x3f2cbb||client;return _0x1cf78c[_0xd61b('0x10')](_0x42d675,_0x527d5d)[_0xd61b('0x11')](function(_0x1c37c6){logger[_0xd61b('0x12')](_0xd61b('0x13'),_0x16e969,_0xd61b('0x14'));logger['debug'](_0xd61b('0x15'),_0x16e969,_0xd61b('0x14'),JSON['stringify'](_0x1c37c6));if(_0x1c37c6[_0xd61b('0x16')]){if(_0x1c37c6[_0xd61b('0x16')][_0xd61b('0x17')]===0x1f4){logger[_0xd61b('0x16')](_0xd61b('0x13'),_0x16e969,_0x1c37c6[_0xd61b('0x16')][_0xd61b('0x18')]);return _0x5de4fe(_0x1c37c6['error'][_0xd61b('0x18')]);}logger[_0xd61b('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x16e969,_0x1c37c6[_0xd61b('0x16')][_0xd61b('0x18')]);return _0x5705b2(_0x1c37c6['error']['message']);}else{logger[_0xd61b('0x12')](_0xd61b('0x13'),_0x16e969,_0xd61b('0x14'));_0x5705b2(_0x1c37c6[_0xd61b('0x19')]['message']);}})['catch'](function(_0xf8705f){logger[_0xd61b('0x16')](_0xd61b('0x13'),_0x16e969,_0xf8705f);_0x5de4fe(_0xf8705f);});});}function respondWithStatusCode(_0x429f17,_0x1e1305){_0x1e1305=_0x1e1305||0xcc;return function(_0x1cac98){if(_0x1cac98){return _0x429f17[_0xd61b('0x1a')](_0x1e1305);}return _0x429f17[_0xd61b('0x1b')](_0x1e1305)[_0xd61b('0x1c')]();};}function respondWithResult(_0x2ba771,_0x3a256c){_0x3a256c=_0x3a256c||0xc8;return function(_0x2ba436){if(_0x2ba436){return _0x2ba771['status'](_0x3a256c)['json'](_0x2ba436);}};}function respondWithFilteredResult(_0x424c08,_0x537d97){return function(_0x448f5b){if(_0x448f5b){var _0x4a42ba=typeof _0x537d97[_0xd61b('0x1d')]===_0xd61b('0x1e')&&typeof _0x537d97[_0xd61b('0x1f')]===_0xd61b('0x1e');var _0x43f965=_0x448f5b[_0xd61b('0x20')];var _0x4455af=_0x4a42ba?0x0:_0x537d97[_0xd61b('0x1d')];var _0x3c1946=_0x4a42ba?_0x448f5b[_0xd61b('0x20')]:_0x537d97[_0xd61b('0x1d')]+_0x537d97[_0xd61b('0x1f')];var _0x2958a7;if(_0x3c1946>=_0x43f965){_0x3c1946=_0x43f965;_0x2958a7=0xc8;}else{_0x2958a7=0xce;}_0x424c08[_0xd61b('0x1b')](_0x2958a7);return _0x424c08[_0xd61b('0x21')](_0xd61b('0x22'),_0x4455af+'-'+_0x3c1946+'/'+_0x43f965)[_0xd61b('0x23')](_0x448f5b);}return null;};}function saveUpdates(_0x4fff79){return function(_0x2e3736){if(_0x2e3736){return _0x2e3736['update'](_0x4fff79)[_0xd61b('0x11')](function(_0x2d8b6b){return _0x2d8b6b;});}return null;};}function removeEntity(_0x1b9eda){return function(_0x1a292e){if(_0x1a292e){return _0x1a292e[_0xd61b('0x24')]()[_0xd61b('0x11')](function(){var _0x5c0b00=_0x1a292e[_0xd61b('0x25')]({'plain':!![]});var _0x15b248=_0xd61b('0x26');return db[_0xd61b('0x27')]['destroy']({'where':{'type':_0x15b248,'resourceId':_0x5c0b00['id']}})[_0xd61b('0x11')](function(){return _0x1a292e;});})[_0xd61b('0x11')](function(){_0x1b9eda['status'](0xcc)[_0xd61b('0x1c')]();});}};}function handleEntityNotFound(_0x351656){return function(_0x116445){if(!_0x116445){_0x351656[_0xd61b('0x1a')](0x194);}return _0x116445;};}function handleError(_0x576b9c,_0x386f78){_0x386f78=_0x386f78||0x1f4;return function(_0x527e96){logger[_0xd61b('0x16')](_0x527e96['stack']);if(_0x527e96[_0xd61b('0x28')]){delete _0x527e96[_0xd61b('0x28')];}_0x576b9c['status'](_0x386f78)[_0xd61b('0x29')](_0x527e96);};}exports[_0xd61b('0x2a')]=function(_0x267a72,_0x2c0674){var _0x47df7c={'include':[{'model':db['Pause'],'as':_0xd61b('0x2b')}]},_0x584882={},_0x58a99a={'count':0x0,'rows':[]};var _0x1e4172=_[_0xd61b('0x2c')](db[_0xd61b('0x2d')][_0xd61b('0x2e')],function(_0x45c805){return{'name':_0x45c805[_0xd61b('0x2f')],'type':_0x45c805[_0xd61b('0x30')][_0xd61b('0x31')]};});_0x584882['model']=_[_0xd61b('0x2c')](_0x1e4172,_0xd61b('0x28'));_0x584882[_0xd61b('0x32')]=_[_0xd61b('0x33')](_0x267a72['query']);_0x584882[_0xd61b('0x34')]=_[_0xd61b('0x35')](_0x584882[_0xd61b('0x36')],_0x584882[_0xd61b('0x32')]);_0x47df7c['attributes']=_[_0xd61b('0x35')](_0x584882[_0xd61b('0x36')],qs['fields'](_0x267a72[_0xd61b('0x32')]['fields']));_0x47df7c[_0xd61b('0x37')]=_0x47df7c['attributes'][_0xd61b('0x38')]?_0x47df7c[_0xd61b('0x37')]:_0x584882[_0xd61b('0x36')];if(!_0x267a72[_0xd61b('0x32')][_0xd61b('0x39')](_0xd61b('0x3a'))){_0x47df7c[_0xd61b('0x1f')]=qs[_0xd61b('0x1f')](_0x267a72['query'][_0xd61b('0x1f')]);_0x47df7c[_0xd61b('0x1d')]=qs[_0xd61b('0x1d')](_0x267a72[_0xd61b('0x32')][_0xd61b('0x1d')]);}_0x47df7c['order']=qs[_0xd61b('0x3b')](_0x267a72[_0xd61b('0x32')][_0xd61b('0x3b')]);_0x47df7c[_0xd61b('0x3c')]=qs[_0xd61b('0x34')](_[_0xd61b('0x3d')](_0x267a72[_0xd61b('0x32')],_0x584882[_0xd61b('0x34')]),_0x1e4172);if(_0x267a72[_0xd61b('0x32')][_0xd61b('0x3e')]){_0x47df7c[_0xd61b('0x3c')]=_['merge'](_0x47df7c[_0xd61b('0x3c')],{'$or':_[_0xd61b('0x2c')](_0x1e4172,function(_0x22d8f0){if(_0x22d8f0['type']!=='VIRTUAL'){var _0x598dcc={};_0x598dcc[_0x22d8f0[_0xd61b('0x28')]]={'$like':'%'+_0x267a72[_0xd61b('0x32')][_0xd61b('0x3e')]+'%'};return _0x598dcc;}})});}_0x47df7c=_[_0xd61b('0x3f')]({},_0x47df7c,_0x267a72[_0xd61b('0x40')]);var _0x4722dd={'where':_0x47df7c['where']};return db[_0xd61b('0x2d')][_0xd61b('0x20')](_0x4722dd)[_0xd61b('0x11')](function(_0x3b8e0f){_0x58a99a[_0xd61b('0x20')]=_0x3b8e0f;if(_0x267a72['query'][_0xd61b('0x41')]){_0x47df7c[_0xd61b('0x42')]=[{'all':!![]}];}return db[_0xd61b('0x2d')][_0xd61b('0x43')](_0x47df7c);})[_0xd61b('0x11')](function(_0x26c86a){_0x58a99a['rows']=_0x26c86a;return _0x58a99a;})[_0xd61b('0x11')](respondWithFilteredResult(_0x2c0674,_0x47df7c))[_0xd61b('0x44')](handleError(_0x2c0674,null));};exports[_0xd61b('0x45')]=function(_0x218767,_0x477b04){var _0x575af5={'raw':![],'where':{'id':_0x218767['params']['id']},'include':[{'model':db[_0xd61b('0x46')],'as':_0xd61b('0x2b')}]},_0xdc6b58={};_0xdc6b58[_0xd61b('0x36')]=_[_0xd61b('0x33')](db[_0xd61b('0x2d')][_0xd61b('0x2e')]);_0xdc6b58['query']=_[_0xd61b('0x33')](_0x218767['query']);_0xdc6b58[_0xd61b('0x34')]=_[_0xd61b('0x35')](_0xdc6b58['model'],_0xdc6b58[_0xd61b('0x32')]);_0x575af5[_0xd61b('0x37')]=_[_0xd61b('0x35')](_0xdc6b58['model'],qs[_0xd61b('0x47')](_0x218767['query'][_0xd61b('0x47')]));_0x575af5[_0xd61b('0x37')]=_0x575af5['attributes'][_0xd61b('0x38')]?_0x575af5['attributes']:_0xdc6b58[_0xd61b('0x36')];if(_0x218767[_0xd61b('0x32')][_0xd61b('0x41')]){_0x575af5['include']=[{'all':!![]}];}_0x575af5=_[_0xd61b('0x3f')]({},_0x575af5,_0x218767['options']);return db['ChatWebsite'][_0xd61b('0x48')](_0x575af5)['then'](handleEntityNotFound(_0x477b04,null))[_0xd61b('0x11')](respondWithResult(_0x477b04,null))['catch'](handleError(_0x477b04,null));};exports[_0xd61b('0x49')]=function(_0x307dd2,_0x207a3b){return db['ChatWebsite'][_0xd61b('0x49')](_0x307dd2[_0xd61b('0x4a')],{})[_0xd61b('0x11')](function(_0x2a9962){var _0x321404=_0x307dd2[_0xd61b('0x4b')][_0xd61b('0x25')]({'plain':!![]});if(!_0x321404)throw new Error(_0xd61b('0x4c'));if(_0x321404[_0xd61b('0x4d')]===_0xd61b('0x4b')){var _0x1c61f9=_0x2a9962[_0xd61b('0x25')]({'plain':!![]});var _0x537eaa=_0xd61b('0x26');return db[_0xd61b('0x4e')][_0xd61b('0x48')]({'where':{'name':_0x537eaa,'userProfileId':_0x321404[_0xd61b('0x4f')]},'raw':!![]})[_0xd61b('0x11')](function(_0x314f75){if(_0x314f75&&_0x314f75[_0xd61b('0x50')]===0x0){return db['UserProfileResource'][_0xd61b('0x49')]({'name':_0x1c61f9['name'],'resourceId':_0x1c61f9['id'],'type':_0x314f75['name'],'sectionId':_0x314f75['id']},{})[_0xd61b('0x11')](function(){return _0x2a9962;});}else{return _0x2a9962;}})[_0xd61b('0x44')](function(_0x10ffd1){logger[_0xd61b('0x16')](_0xd61b('0x51'),_0x10ffd1);throw _0x10ffd1;});}return _0x2a9962;})[_0xd61b('0x11')](respondWithResult(_0x207a3b,0xc9))[_0xd61b('0x44')](handleError(_0x207a3b,null));};exports[_0xd61b('0x52')]=function(_0x58af20,_0x59468e){if(_0x58af20['body']['id']){delete _0x58af20[_0xd61b('0x4a')]['id'];}return db[_0xd61b('0x2d')][_0xd61b('0x48')]({'where':{'id':_0x58af20['params']['id']},'include':[{'model':db[_0xd61b('0x46')],'as':_0xd61b('0x2b')}]})[_0xd61b('0x11')](handleEntityNotFound(_0x59468e,null))['then'](saveUpdates(_0x58af20[_0xd61b('0x4a')],null))[_0xd61b('0x11')](respondWithResult(_0x59468e,null))['catch'](handleError(_0x59468e,null));};exports[_0xd61b('0x24')]=function(_0x269b3c,_0x31909d){return db['ChatWebsite'][_0xd61b('0x48')]({'where':{'id':_0x269b3c[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x31909d,null))['then'](removeEntity(_0x31909d,null))['catch'](handleError(_0x31909d,null));};exports[_0xd61b('0x54')]=function(_0x2662a3,_0x8f9c17){return db[_0xd61b('0x2d')][_0xd61b('0x54')]()[_0xd61b('0x11')](respondWithResult(_0x8f9c17,null))[_0xd61b('0x44')](handleError(_0x8f9c17,null));};exports[_0xd61b('0x55')]=function(_0x32b2a5,_0x3a4056){if(_0x32b2a5[_0xd61b('0x4a')]['id']){delete _0x32b2a5[_0xd61b('0x4a')]['id'];}return db[_0xd61b('0x2d')][_0xd61b('0x48')]({'where':{'id':_0x32b2a5[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x3a4056,null))[_0xd61b('0x11')](function(_0x1179dc){if(_0x1179dc){_0x32b2a5['body']['ChatWebsiteId']=_0x1179dc['id'];return db[_0xd61b('0x56')][_0xd61b('0x49')](_0x32b2a5[_0xd61b('0x4a')]);}})[_0xd61b('0x11')](respondWithResult(_0x3a4056,null))[_0xd61b('0x44')](handleError(_0x3a4056,null));};exports['getDispositions']=function(_0x5de61d,_0x5f5cde){var _0x14bc8a={'raw':![],'where':{}};var _0x3d02cb={};var _0xea9860={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd61b('0x57')]({'where':{'id':_0x5de61d[_0xd61b('0x53')]['id']}})['then'](handleEntityNotFound(_0x5f5cde,null))[_0xd61b('0x11')](function(_0xc82526){if(_0xc82526){_0x3d02cb[_0xd61b('0x36')]=_['keys'](db['Disposition'][_0xd61b('0x2e')]);_0x3d02cb['query']=_['keys'](_0x5de61d[_0xd61b('0x32')]);_0x3d02cb[_0xd61b('0x34')]=_[_0xd61b('0x35')](_0x3d02cb[_0xd61b('0x36')],_0x3d02cb[_0xd61b('0x32')]);_0x14bc8a[_0xd61b('0x37')]=_['intersection'](_0x3d02cb[_0xd61b('0x36')],qs[_0xd61b('0x47')](_0x5de61d[_0xd61b('0x32')]['fields']));_0x14bc8a[_0xd61b('0x37')]=_0x14bc8a['attributes'][_0xd61b('0x38')]?_0x14bc8a['attributes']:_0x3d02cb[_0xd61b('0x36')];if(!_0x5de61d[_0xd61b('0x32')][_0xd61b('0x39')]('nolimit')){_0x14bc8a[_0xd61b('0x1f')]=qs[_0xd61b('0x1f')](_0x5de61d[_0xd61b('0x32')][_0xd61b('0x1f')]);_0x14bc8a[_0xd61b('0x1d')]=qs[_0xd61b('0x1d')](_0x5de61d[_0xd61b('0x32')][_0xd61b('0x1d')]);}_0x14bc8a[_0xd61b('0x58')]=qs[_0xd61b('0x3b')](_0x5de61d[_0xd61b('0x32')][_0xd61b('0x3b')]);_0x14bc8a[_0xd61b('0x3c')]=qs['filters'](_[_0xd61b('0x3d')](_0x5de61d[_0xd61b('0x32')],_0x3d02cb[_0xd61b('0x34')]));_0x14bc8a['where'][_0xd61b('0x59')]=_0xc82526['id'];if(_0x5de61d[_0xd61b('0x32')][_0xd61b('0x3e')]){_0x14bc8a['where']=_['merge'](_0x14bc8a[_0xd61b('0x3c')],{'$or':_[_0xd61b('0x2c')](_0x14bc8a[_0xd61b('0x37')],function(_0x2f5f97){var _0x1bd878={};_0x1bd878[_0x2f5f97]={'$like':'%'+_0x5de61d[_0xd61b('0x32')][_0xd61b('0x3e')]+'%'};return _0x1bd878;})});}_0x14bc8a=_['merge']({},_0x14bc8a,_0x5de61d[_0xd61b('0x40')]);return db[_0xd61b('0x56')][_0xd61b('0x20')]({'where':_0x14bc8a[_0xd61b('0x3c')]})[_0xd61b('0x11')](function(_0x1b06f8){_0xea9860[_0xd61b('0x20')]=_0x1b06f8;if(_0x5de61d[_0xd61b('0x32')][_0xd61b('0x41')]){_0x14bc8a['include']=[{'all':!![]}];}return db[_0xd61b('0x56')][_0xd61b('0x43')](_0x14bc8a);})[_0xd61b('0x11')](function(_0x1c2c69){_0xea9860['rows']=_0x1c2c69;return _0xea9860;});}})['then'](respondWithFilteredResult(_0x5f5cde,_0x14bc8a))[_0xd61b('0x44')](handleError(_0x5f5cde,null));};exports['removeDispositions']=function(_0x4d3775,_0x11c9a9){return db[_0xd61b('0x2d')][_0xd61b('0x48')]({'where':{'id':_0x4d3775[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x11c9a9,null))[_0xd61b('0x11')](function(_0x25a6f1){if(_0x25a6f1){return _0x25a6f1[_0xd61b('0x5a')](_0x4d3775[_0xd61b('0x32')][_0xd61b('0x5b')]);}})['then'](respondWithStatusCode(_0x11c9a9,null))[_0xd61b('0x44')](handleError(_0x11c9a9,null));};exports[_0xd61b('0x5c')]=function(_0x212887,_0x52368e){if(_0x212887[_0xd61b('0x4a')]['id']){delete _0x212887[_0xd61b('0x4a')]['id'];}return db[_0xd61b('0x2d')][_0xd61b('0x48')]({'where':{'id':_0x212887[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x52368e,null))['then'](function(_0x309a64){if(_0x309a64){_0x212887[_0xd61b('0x4a')][_0xd61b('0x59')]=_0x309a64['id'];return db[_0xd61b('0x5d')]['create'](_0x212887[_0xd61b('0x4a')]);}})[_0xd61b('0x11')](respondWithResult(_0x52368e,null))[_0xd61b('0x44')](handleError(_0x52368e,null));};exports[_0xd61b('0x5e')]=function(_0x28cb6f,_0x3e0eab){var _0x3468e4={'raw':![],'where':{}};var _0x198c8d={};var _0x4e5878={'count':0x0,'rows':[]};return db[_0xd61b('0x2d')][_0xd61b('0x57')]({'where':{'id':_0x28cb6f[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x3e0eab,null))[_0xd61b('0x11')](function(_0x262cb3){if(_0x262cb3){_0x198c8d[_0xd61b('0x36')]=_[_0xd61b('0x33')](db[_0xd61b('0x5d')][_0xd61b('0x2e')]);_0x198c8d[_0xd61b('0x32')]=_[_0xd61b('0x33')](_0x28cb6f[_0xd61b('0x32')]);_0x198c8d[_0xd61b('0x34')]=_['intersection'](_0x198c8d['model'],_0x198c8d[_0xd61b('0x32')]);_0x3468e4[_0xd61b('0x37')]=_['intersection'](_0x198c8d[_0xd61b('0x36')],qs[_0xd61b('0x47')](_0x28cb6f[_0xd61b('0x32')][_0xd61b('0x47')]));_0x3468e4['attributes']=_0x3468e4[_0xd61b('0x37')][_0xd61b('0x38')]?_0x3468e4[_0xd61b('0x37')]:_0x198c8d['model'];if(!_0x28cb6f['query'][_0xd61b('0x39')](_0xd61b('0x3a'))){_0x3468e4['limit']=qs['limit'](_0x28cb6f[_0xd61b('0x32')]['limit']);_0x3468e4[_0xd61b('0x1d')]=qs[_0xd61b('0x1d')](_0x28cb6f[_0xd61b('0x32')][_0xd61b('0x1d')]);}_0x3468e4[_0xd61b('0x58')]=qs[_0xd61b('0x3b')](_0x28cb6f[_0xd61b('0x32')]['sort']);_0x3468e4['where']=qs[_0xd61b('0x34')](_[_0xd61b('0x3d')](_0x28cb6f[_0xd61b('0x32')],_0x198c8d['filters']));_0x3468e4['where']['ChatWebsiteId']=_0x262cb3['id'];if(_0x28cb6f[_0xd61b('0x32')][_0xd61b('0x3e')]){_0x3468e4[_0xd61b('0x3c')]=_[_0xd61b('0x3f')](_0x3468e4[_0xd61b('0x3c')],{'$or':_[_0xd61b('0x2c')](_0x3468e4['attributes'],function(_0x3d64fe){var _0x36aaa8={};_0x36aaa8[_0x3d64fe]={'$like':'%'+_0x28cb6f[_0xd61b('0x32')][_0xd61b('0x3e')]+'%'};return _0x36aaa8;})});}_0x3468e4=_['merge']({},_0x3468e4,_0x28cb6f[_0xd61b('0x40')]);return db[_0xd61b('0x5d')][_0xd61b('0x20')]({'where':_0x3468e4['where']})[_0xd61b('0x11')](function(_0x2f86fe){_0x4e5878['count']=_0x2f86fe;if(_0x28cb6f[_0xd61b('0x32')]['includeAll']){_0x3468e4[_0xd61b('0x42')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd61b('0x43')](_0x3468e4);})[_0xd61b('0x11')](function(_0x1c0431){_0x4e5878[_0xd61b('0x5f')]=_0x1c0431;return _0x4e5878;});}})[_0xd61b('0x11')](respondWithFilteredResult(_0x3e0eab,_0x3468e4))[_0xd61b('0x44')](handleError(_0x3e0eab,null));};exports[_0xd61b('0x60')]=function(_0x2c846a,_0x2523a3){return db[_0xd61b('0x2d')][_0xd61b('0x48')]({'where':{'id':_0x2c846a['params']['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x2523a3,null))[_0xd61b('0x11')](function(_0x10e4a3){if(_0x10e4a3){return _0x10e4a3[_0xd61b('0x60')](_0x2c846a['query'][_0xd61b('0x5b')]);}})['then'](respondWithStatusCode(_0x2523a3,null))[_0xd61b('0x44')](handleError(_0x2523a3,null));};exports['addLogo']=function(_0x2d6d2c,_0x57cb29){_0x2d6d2c['body']['sitepic']=_0x2d6d2c['file'][_0xd61b('0x61')];return db[_0xd61b('0x2d')][_0xd61b('0x48')]({'where':{'id':_0x2d6d2c[_0xd61b('0x53')]['id']}})['then'](handleEntityNotFound(_0x57cb29,null))['then'](saveUpdates(_0x2d6d2c['body'],null))['then'](respondWithResult(_0x57cb29,null))[_0xd61b('0x44')](handleError(_0x57cb29,null));};exports[_0xd61b('0x62')]=function(_0x2b4737,_0x557fa3){_0x2b4737[_0xd61b('0x4a')][_0xd61b('0x63')]=_0x2b4737[_0xd61b('0x64')][_0xd61b('0x61')];return db[_0xd61b('0x2d')][_0xd61b('0x48')]({'where':{'id':_0x2b4737[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x557fa3,null))['then'](saveUpdates(_0x2b4737['body'],null))[_0xd61b('0x11')](respondWithResult(_0x557fa3,null))[_0xd61b('0x44')](handleError(_0x557fa3,null));};exports[_0xd61b('0x65')]=function(_0x430a98,_0xf12e98){_0x430a98['body'][_0xd61b('0x66')]=_0x430a98[_0xd61b('0x64')][_0xd61b('0x61')];return db['ChatWebsite'][_0xd61b('0x48')]({'where':{'id':_0x430a98[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0xf12e98,null))[_0xd61b('0x11')](saveUpdates(_0x430a98[_0xd61b('0x4a')],null))[_0xd61b('0x11')](respondWithResult(_0xf12e98,null))['catch'](handleError(_0xf12e98,null));};exports[_0xd61b('0x67')]=function(_0x26f646,_0x3c3224){_0x26f646[_0xd61b('0x4a')][_0xd61b('0x68')]=_0x26f646[_0xd61b('0x64')][_0xd61b('0x61')];return db[_0xd61b('0x2d')][_0xd61b('0x48')]({'where':{'id':_0x26f646[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x3c3224,null))['then'](saveUpdates(_0x26f646['body'],null))[_0xd61b('0x11')](respondWithResult(_0x3c3224,null))['catch'](handleError(_0x3c3224,null));};exports[_0xd61b('0x69')]=function(_0x1fad21,_0x3c4e80){var _0x36c239=path[_0xd61b('0x6a')](config[_0xd61b('0x6b')],'server/files/images/logos/default_logo.svg');var _0x66743e={'where':{'id':_0x1fad21['params']['id']},'attributes':['id',_0xd61b('0x6c')],'raw':!![]};var _0x2b7340=![];return require(_0xd61b('0x6d'))['getLicense']()[_0xd61b('0x11')](function(_0x2b654a){if(_0x2b654a){_0x2b7340=_0x2b654a[_0xd61b('0x6e')];}})[_0xd61b('0x11')](function(){return db['ChatWebsite'][_0xd61b('0x48')](_0x66743e);})[_0xd61b('0x11')](handleEntityNotFound(_0x3c4e80,null))[_0xd61b('0x11')](function(_0x251ec1){if(_0x251ec1){if(!_[_0xd61b('0x6f')](_0x251ec1[_0xd61b('0x6c')])){if(fs[_0xd61b('0x70')](path[_0xd61b('0x6a')](config[_0xd61b('0x6b')],_0xd61b('0x71'),_0x251ec1[_0xd61b('0x6c')]))&&_0x2b7340){_0x36c239=path[_0xd61b('0x6a')](config['root'],_0xd61b('0x71'),_0x251ec1[_0xd61b('0x6c')]);}}return _0x3c4e80[_0xd61b('0x72')](_0x36c239);}})[_0xd61b('0x44')](handleError(_0x3c4e80,null));};exports['getAvatar']=function(_0x3a358d,_0x4254f5){var _0x3f52d5=path[_0xd61b('0x6a')](config[_0xd61b('0x6b')],_0xd61b('0x73'));var _0xb5bc80={'where':{'id':_0x3a358d['params']['id']},'attributes':['id',_0xd61b('0x63')],'raw':!![]};return db[_0xd61b('0x2d')][_0xd61b('0x48')](_0xb5bc80)[_0xd61b('0x11')](handleEntityNotFound(_0x4254f5,null))[_0xd61b('0x11')](function(_0x8a2d45){if(_0x8a2d45){if(!_[_0xd61b('0x6f')](_0x8a2d45[_0xd61b('0x63')])){if(fs[_0xd61b('0x70')](path[_0xd61b('0x6a')](config['root'],_0xd61b('0x74'),_0x8a2d45[_0xd61b('0x63')]))){_0x3f52d5=path[_0xd61b('0x6a')](config[_0xd61b('0x6b')],_0xd61b('0x74'),_0x8a2d45['agentAvatar']);}}return _0x4254f5[_0xd61b('0x72')](_0x3f52d5);}})[_0xd61b('0x44')](handleError(_0x4254f5,null));};exports[_0xd61b('0x75')]=function(_0x3a7776,_0x3fdcd4){var _0x4e1a1=path[_0xd61b('0x6a')](config['root'],_0xd61b('0x76'));var _0x49f399={'where':{'id':_0x3a7776['params']['id']},'attributes':['id',_0xd61b('0x66'),_0xd61b('0x77')],'raw':!![]};return db[_0xd61b('0x2d')][_0xd61b('0x48')](_0x49f399)['then'](handleEntityNotFound(_0x3fdcd4,null))['then'](function(_0x1ee35e){if(_0x1ee35e){if(!_[_0xd61b('0x6f')](_0x1ee35e[_0xd61b('0x66')])){if(fs['existsSync'](path[_0xd61b('0x6a')](config[_0xd61b('0x6b')],_0xd61b('0x74'),_0x1ee35e[_0xd61b('0x66')]))&&_0x1ee35e['showCustomerAvatar']){_0x4e1a1=path[_0xd61b('0x6a')](config[_0xd61b('0x6b')],'server/files/images/avatars/',_0x1ee35e[_0xd61b('0x66')]);}}return _0x3fdcd4[_0xd61b('0x72')](_0x4e1a1);}})[_0xd61b('0x44')](handleError(_0x3fdcd4,null));};exports[_0xd61b('0x78')]=function(_0x431445,_0xdbda81){var _0xa4bf25=path[_0xd61b('0x6a')](config[_0xd61b('0x6b')],_0xd61b('0x79'));var _0x3b060a={'where':{'id':_0x431445[_0xd61b('0x53')]['id']},'attributes':['id',_0xd61b('0x68')],'raw':!![]};return db[_0xd61b('0x2d')][_0xd61b('0x48')](_0x3b060a)[_0xd61b('0x11')](handleEntityNotFound(_0xdbda81,null))[_0xd61b('0x11')](function(_0x4e798b){if(_0x4e798b){if(!_[_0xd61b('0x6f')](_0x4e798b[_0xd61b('0x68')])){if(fs[_0xd61b('0x70')](path[_0xd61b('0x6a')](config[_0xd61b('0x6b')],'server/files/images/avatars/',_0x4e798b['systemAvatar']))){_0xa4bf25=path[_0xd61b('0x6a')](config[_0xd61b('0x6b')],_0xd61b('0x74'),_0x4e798b[_0xd61b('0x68')]);}}return _0xdbda81[_0xd61b('0x72')](_0xa4bf25);}})['catch'](handleError(_0xdbda81,null));};exports[_0xd61b('0x7a')]=function(_0x25b2f9,_0x5d6713){var _0x3b3dd1=require(_0xd61b('0x7b'));var _0x580885=new _0x3b3dd1();var _0x5a7116=_0x580885['setUA'](_0x25b2f9[_0xd61b('0x7c')][_0xd61b('0x7d')])[_0xd61b('0x7e')]();var _0x43fe19={'body':_0x25b2f9['body'],'channel':_0xd61b('0x7f')};var _0x2423f5=[];var _0x25da21=[];var _0x2199f1={};var _0x500bbe=![];return db[_0xd61b('0x80')][_0xd61b('0x54')]()['then'](function(_0x1398cb){if(!_0x1398cb){throw new db[(_0xd61b('0x81'))][(_0xd61b('0x82'))](_0xd61b('0x83'));}_0x2423f5=_[_0xd61b('0x84')](_[_0xd61b('0x33')](_0x1398cb),[_0xd61b('0x85'),_0xd61b('0x86')]);_0x25da21=_['difference'](_[_0xd61b('0x33')](_0x1398cb),[_0xd61b('0x85'),_0xd61b('0x86'),_0xd61b('0x87'),_0xd61b('0x88')]);if(_0x25b2f9[_0xd61b('0x4a')]['id']){delete _0x25b2f9[_0xd61b('0x4a')]['id'];}if(_[_0xd61b('0x6f')](_0x25b2f9['body'][_0xd61b('0x89')])){throw new db[(_0xd61b('0x81'))]['ValidationError'](_0xd61b('0x8a'));}if(_[_0xd61b('0x6f')](_0x25b2f9['body']['body'])||_0x25b2f9[_0xd61b('0x4a')][_0xd61b('0x4a')]===''){throw new db[(_0xd61b('0x81'))]['ValidationError'](_0xd61b('0x8b'));}if(_[_0xd61b('0x6f')](_0x25b2f9['body'][_0xd61b('0x8c')])){throw new db[(_0xd61b('0x81'))][(_0xd61b('0x82'))](_0xd61b('0x8d')+_0x25da21);}if(!_[_0xd61b('0x8e')](_0x25da21,_0x25b2f9['body'][_0xd61b('0x8c')])){throw new db[(_0xd61b('0x81'))][(_0xd61b('0x82'))](_0xd61b('0x8f')+_0x25da21);}_0x2199f1[_0x25b2f9[_0xd61b('0x4a')][_0xd61b('0x8c')]]=_0x25b2f9[_0xd61b('0x4a')][_0xd61b('0x89')];})[_0xd61b('0x11')](function(){return db[_0xd61b('0x2d')][_0xd61b('0x48')]({'where':{'id':_0x25b2f9[_0xd61b('0x53')]['id']},'include':[{'model':db[_0xd61b('0x90')],'as':_0xd61b('0x91'),'include':[{'model':db[_0xd61b('0x80')],'as':_0xd61b('0x92'),'where':_0x2199f1,'limit':0x1,'order':[['updatedAt',_0xd61b('0x93')]]}]},{'model':db[_0xd61b('0x94')],'as':'Applications'}]});})[_0xd61b('0x11')](handleEntityNotFound(_0x5d6713,null))[_0xd61b('0x11')](function(_0x425552){if(_0x425552&&_0x425552[_0xd61b('0x91')]){_0x43fe19[_0xd61b('0x95')]=_0x425552;_0x43fe19[_0xd61b('0x96')]=_0x425552[_0xd61b('0x97')];_0x43fe19[_0xd61b('0x98')]=_0x425552[_0xd61b('0x91')];_0x43fe19[_0xd61b('0x96')]=_[_0xd61b('0x99')](_0x43fe19['applications'],[_0xd61b('0x9a')],[_0xd61b('0x9b')]);if(_0x43fe19[_0xd61b('0x95')][_0xd61b('0x97')]){delete _0x43fe19[_0xd61b('0x95')]['Applications'];}if(_0x43fe19['account']['List']&&_0x43fe19['account'][_0xd61b('0x91')][_0xd61b('0x92')][_0xd61b('0x38')]){return _0x43fe19['account'][_0xd61b('0x91')][_0xd61b('0x92')][0x0];}var _0x1bb6d4=_[_0xd61b('0xa')](_0x25b2f9[_0xd61b('0x4a')],{'firstName':_0x25b2f9[_0xd61b('0x4a')][_0xd61b('0x89')],'ListId':_0x425552[_0xd61b('0x88')]});_0x1bb6d4[_0x25b2f9['body'][_0xd61b('0x8c')]]=_0x25b2f9[_0xd61b('0x4a')][_0xd61b('0x89')];return db[_0xd61b('0x80')]['create'](_0x1bb6d4,{'fields':_0x2423f5,'raw':!![]});}})[_0xd61b('0x11')](handleEntityNotFound(_0x5d6713,null))[_0xd61b('0x11')](function(_0x1dd5fa){_0x43fe19[_0xd61b('0x9c')]=_0x1dd5fa;var _0x358eda=_0x25b2f9['body'][_0xd61b('0x9d')];if(_0x25b2f9[_0xd61b('0x7c')]['cf-connecting-ip']){_0x358eda=_0x25b2f9[_0xd61b('0x7c')]['cf-connecting-ip'];}else if(_0x25b2f9[_0xd61b('0x7c')][_0xd61b('0x9e')]){_0x358eda=_[_0xd61b('0x9f')](_0x25b2f9[_0xd61b('0x7c')][_0xd61b('0x9e')][_0xd61b('0xa0')](','));}if(_0x1dd5fa){var _0x3c21ce={'ContactId':_0x1dd5fa['id'],'ChatWebsiteId':_0x25b2f9[_0xd61b('0x53')]['id'],'from':(_0x1dd5fa[_0xd61b('0xa1')]||'')+'\x20'+(_0x1dd5fa[_0xd61b('0xa2')]||''),'customerIp':_0x358eda,'customerPort':_0x25b2f9[_0xd61b('0x7c')][_0xd61b('0xa3')]?_0x25b2f9['headers'][_0xd61b('0xa3')]:null,'referer':_0x25b2f9[_0xd61b('0x4a')]['referer'],'browserName':_0x5a7116['browser'][_0xd61b('0x28')]&&_0x5a7116[_0xd61b('0xa4')]['version']?util['format'](_0xd61b('0xa5'),_0x5a7116[_0xd61b('0xa4')][_0xd61b('0x28')],_0x5a7116[_0xd61b('0xa4')][_0xd61b('0xa6')]):'unknown','browserVersion':_0x5a7116[_0xd61b('0xa4')][_0xd61b('0xa6')]||_0xd61b('0xa7'),'osName':util[_0xd61b('0xa8')](_0xd61b('0xa5'),_0x5a7116['os'][_0xd61b('0x28')],_0x5a7116['os'][_0xd61b('0xa6')]),'osVersion':_0x5a7116['os'][_0xd61b('0xa6')],'deviceModel':_0x5a7116[_0xd61b('0xa9')][_0xd61b('0x36')]&&_0x5a7116['device'][_0xd61b('0xaa')]?util['format']('%s\x20%s\x20%s',_0x5a7116[_0xd61b('0xa9')][_0xd61b('0x36')],_0x5a7116[_0xd61b('0xa9')][_0xd61b('0xaa')],_0x5a7116[_0xd61b('0xa9')][_0xd61b('0x30')]):null,'deviceVendor':_0x5a7116[_0xd61b('0xa9')]['vendor'],'deviceType':_0x5a7116['device']['type'],'formData':JSON[_0xd61b('0xab')](_0x25b2f9[_0xd61b('0x4a')])};var _0xef3f9e={'ChatWebsiteId':_0x25b2f9[_0xd61b('0x53')]['id'],'closed':![]};if(_0x25b2f9[_0xd61b('0x4a')]['threadId']){_0xef3f9e['threadId']=_0x25b2f9['body']['threadId'];return db[_0xd61b('0xac')][_0xd61b('0x48')]({'where':_0xef3f9e})[_0xd61b('0x11')](function(_0x53c84b){if(_0x53c84b){return[_0x53c84b,![]];}_0x3c21ce[_0xd61b('0xad')]=_0x25b2f9['body'][_0xd61b('0xad')];_0x3c21ce[_0xd61b('0xae')]=_0x25b2f9[_0xd61b('0x4a')][_0xd61b('0xae')];return db[_0xd61b('0xac')][_0xd61b('0x49')](_0x3c21ce)[_0xd61b('0x11')](function(_0x22bc54){return[_0x22bc54,!![]];});});}_0xef3f9e[_0xd61b('0xaf')]=_0x1dd5fa['id'];if(_0x25b2f9[_0xd61b('0x4a')][_0xd61b('0xb0')]&&_0x25b2f9[_0xd61b('0x4a')]['interaction']['id']){_0xef3f9e['id']=_0x25b2f9[_0xd61b('0x4a')]['interaction']['id'];return db[_0xd61b('0xac')][_0xd61b('0x48')]({'where':_0xef3f9e})[_0xd61b('0x11')](function(_0x49b951){if(_0x49b951){return[_0x49b951,![]];}return db[_0xd61b('0xac')]['create'](_0x3c21ce)[_0xd61b('0x11')](function(_0x8cdda0){return[_0x8cdda0,!![]];});});}return db[_0xd61b('0xac')][_0xd61b('0x49')](_0x3c21ce)[_0xd61b('0x11')](function(_0x57dd7c){return[_0x57dd7c,!![]];});}})['spread'](function(_0x437813,_0x36472f){if(_0x437813){_0x500bbe=_0x36472f;if(!_0x36472f){var _0x3d2ffa={'from':(_0x43fe19['contact'][_0xd61b('0xa1')]||'')+'\x20'+(_0x43fe19[_0xd61b('0x9c')][_0xd61b('0xa2')]||'')};if(_0x25b2f9[_0xd61b('0x4a')]['threadId']&&_0x25b2f9[_0xd61b('0x4a')]['messageId']&&_0x25b2f9[_0xd61b('0x4a')][_0xd61b('0xad')]!=_0x25b2f9[_0xd61b('0x4a')][_0xd61b('0xb1')]){_0x3d2ffa[_0xd61b('0xad')]=_0x25b2f9[_0xd61b('0x4a')]['messageId'];}return _0x437813[_0xd61b('0x52')](_0x3d2ffa);}else{return _0x437813;}}})[_0xd61b('0x11')](function(_0x5b6f37){_0x43fe19['interaction']=_0x5b6f37[_0xd61b('0x25')]({'plain':!![]});_0x43fe19[_0xd61b('0xb0')][_0xd61b('0xb2')]=_0x500bbe;if(_0x43fe19[_0xd61b('0xb0')]['created']){if(_0x43fe19[_0xd61b('0x95')][_0xd61b('0xb3')]){_0x43fe19['applications'][_0xd61b('0xb4')]({'id':0x0,'priority':_0x43fe19['applications'][_0xd61b('0x38')]+0x1,'app':_0xd61b('0xb5'),'appdata':_0xd61b('0xb6'),'interval':_0xd61b('0xb7')});}}return db['ChatMessage'][_0xd61b('0x49')]({'body':_0x25b2f9[_0xd61b('0x4a')][_0xd61b('0x4a')],'ChatWebsiteId':_0x25b2f9[_0xd61b('0x53')]['id'],'ChatInteractionId':_0x5b6f37['id'],'direction':'in','ContactId':_0x43fe19[_0xd61b('0x9c')]['id'],'AttachmentId':_0x25b2f9[_0xd61b('0x4a')]['AttachmentId']});})['then'](function(_0x519f86){_0x43fe19['message']=_0x519f86;if(_0x43fe19[_0xd61b('0xb0')][_0xd61b('0xb8')]){return db[_0xd61b('0xb9')][_0xd61b('0x48')]({'attributes':['id','name'],'where':{'id':_0x43fe19[_0xd61b('0xb0')][_0xd61b('0xb8')]}})[_0xd61b('0x11')](function(_0x67b4dc){if(_0x67b4dc){_0x43fe19['applications'][_0xd61b('0xba')]({'id':0x0,'priority':0x0,'app':_0xd61b('0xbb'),'appdata':_0x67b4dc[_0xd61b('0x28')]+','+(_0x43fe19[_0xd61b('0x95')][_0xd61b('0xbc')]||0xa),'interval':'*,*,*,*'});_0x43fe19['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xd61b('0xbd'),_0x43fe19);});}return respondWithRpcPromise(_0xd61b('0xbe'),_0xd61b('0xbd'),_0x43fe19);})[_0xd61b('0x11')](function(_0x3dd694){respondWithRpcPromise(_0xd61b('0xbf'),_0xd61b('0xbf'),{'event':_0xd61b('0x7a'),'message':_0x3dd694},client9002);return _0x3dd694;})[_0xd61b('0x11')](respondWithResult(_0x5d6713,null))[_0xd61b('0x44')](handleError(_0x5d6713,null));};exports[_0xd61b('0xc0')]=function(_0x239f6b,_0x4a4cb8){var _0x5688bf,_0xfae9c1,_0x57b530;var _0x1a8fb3=[];var _0xee7c82={};var _0x571ebc=_0x239f6b['files']||[];var _0x56923d=[];var _0x11a4df;return db[_0xd61b('0x80')][_0xd61b('0x54')]()[_0xd61b('0x11')](function(_0x1ef6bf){if(!_0x1ef6bf){throw new db[(_0xd61b('0x81'))]['ValidationError'](_0xd61b('0x83'));}_0x1a8fb3=_[_0xd61b('0x84')](_['keys'](_0x1ef6bf),[_0xd61b('0x85'),_0xd61b('0x86'),_0xd61b('0x87'),_0xd61b('0x88')]);if(_0x239f6b['body']['id']){delete _0x239f6b[_0xd61b('0x4a')]['id'];}if(_['isNil'](_0x239f6b[_0xd61b('0x4a')][_0xd61b('0x89')])){throw _0x4a4cb8[_0xd61b('0x1b')](0x1f4)['send'](new db[(_0xd61b('0x81'))][(_0xd61b('0x82'))](_0xd61b('0x8a')));}if(_['isNil'](_0x239f6b['body']['body'])||_0x239f6b[_0xd61b('0x4a')]['body']===''){throw _0x4a4cb8['status'](0x1f4)[_0xd61b('0x29')](new db[(_0xd61b('0x81'))][(_0xd61b('0x82'))](_0xd61b('0x8b')));}if(_[_0xd61b('0x6f')](_0x239f6b[_0xd61b('0x4a')][_0xd61b('0xc1')])){throw _0x4a4cb8['status'](0x1f4)['send'](new db[(_0xd61b('0x81'))][(_0xd61b('0x82'))](_0xd61b('0xc2')+_0x1a8fb3));}if(!_['includes'](_0x1a8fb3,_0x239f6b[_0xd61b('0x4a')]['mapKeyOffline'])){throw _0x4a4cb8['status'](0x1f4)[_0xd61b('0x29')](new db['Sequelize'][(_0xd61b('0x82'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1a8fb3));}_0xee7c82[_0x239f6b[_0xd61b('0x4a')][_0xd61b('0xc1')]]=_0x239f6b[_0xd61b('0x4a')][_0xd61b('0x89')];})[_0xd61b('0x11')](function(){return db[_0xd61b('0x2d')][_0xd61b('0x48')]({'where':{'id':_0x239f6b['params']['id']},'include':[{'model':db[_0xd61b('0x90')],'as':'List'},{'model':db[_0xd61b('0xc3')],'as':_0xd61b('0xc3')}]});})[_0xd61b('0x11')](handleEntityNotFound(_0x4a4cb8,null))[_0xd61b('0x11')](function(_0x66f65a){if(_0x66f65a&&_0x66f65a[_0xd61b('0x91')]){_0xfae9c1=_0x66f65a;var _0x2a51bc=_[_0xd61b('0xa')](_0x239f6b[_0xd61b('0x4a')],{'firstName':_0x239f6b['body'][_0xd61b('0x89')],'phone':_0x239f6b[_0xd61b('0x4a')][_0xd61b('0x89')],'ListId':_0x66f65a['ListId']});_0x2a51bc[_0x239f6b['body'][_0xd61b('0xc1')]]=_0x239f6b[_0xd61b('0x4a')][_0xd61b('0x89')];return db[_0xd61b('0x80')][_0xd61b('0xc4')]({'where':_0xee7c82,'defaults':_0x2a51bc});}})[_0xd61b('0xc5')](function(_0x348c15){if(_0x348c15){_0x57b530=_0x348c15;var _0x312d08=fs[_0xd61b('0xc6')](path[_0xd61b('0x6a')](config[_0xd61b('0x6b')],_0xd61b('0xc7')),_0xd61b('0xc8'));var _0x41217d=ejs['render'](_0x312d08,{'body':_['toPairs'](_0x239f6b[_0xd61b('0x4a')][_0xd61b('0x4a')]),'bodyTitle':_0xfae9c1[_0xd61b('0xc9')]});return db[_0xd61b('0xca')][_0xd61b('0x49')]({'body':_0x41217d,'plainBody':htmlToText[_0xd61b('0xcb')](_0x41217d),'ContactId':_0x348c15['id'],'ChatWebsiteId':_0xfae9c1['id']});}})[_0xd61b('0x11')](function(_0x3e9087){_0x11a4df=_0x3e9087;if(_0x571ebc[_0xd61b('0x38')]){var _0x442c50=_0x571ebc[_0xd61b('0x2c')](function(_0x669a88){return{'name':_0x669a88['originalname'],'basename':_0x669a88['filename'],'type':_0x669a88[_0xd61b('0xcc')],'ChatOfflineMessageId':_0x3e9087['id']};});_0x56923d=_0x442c50[_0xd61b('0x2c')](_0x4f547c=>{var _0x595288={'filename':_0x4f547c[_0xd61b('0x28')],'path':path[_0xd61b('0x6a')](config[_0xd61b('0x6b')],'server',_0xd61b('0xcd'),_0xd61b('0xce'),'offline-chat',_0x4f547c['basename'])};return _0x595288;});if(!_0xfae9c1[_0xd61b('0xcf')]){return db[_0xd61b('0xd0')][_0xd61b('0xd1')](function(_0x48caae){return db[_0xd61b('0xd2')]['bulkCreate'](_0x442c50,{'transaction':_0x48caae});});}}})[_0xd61b('0x11')](function(){if(_0x11a4df){_0x5688bf=_0x11a4df;return db[_0xd61b('0xc3')][_0xd61b('0x57')]({'where':{'service':!![]},'include':[{'model':db[_0xd61b('0xd3')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0xd61b('0x11')](function(_0x2d8852){if(_0x2d8852&&_0x2d8852['Smtp']&&_0xfae9c1[_0xd61b('0xd4')]&&_0xfae9c1[_0xd61b('0xd5')]){var _0x292441=_0x2d8852['getSmtpOptions']();return respondWithRpcPromise(_0xd61b('0xd6'),_0xd61b('0xd7'),{'account':_0x292441,'message':{'from':util[_0xd61b('0xa8')](_0xd61b('0xd8'),_0x2d8852['name'],_0x2d8852[_0xd61b('0xd9')]||_0x2d8852['Smtp'][_0xd61b('0x4b')]),'to':_0xfae9c1[_0xd61b('0xd5')],'subject':_0xfae9c1[_0xd61b('0xda')],'html':_0x5688bf[_0xd61b('0x4a')],'attachments':_0x56923d}},client9003)[_0xd61b('0x11')](function(){return _0x5688bf;})[_0xd61b('0x44')](function(_0x28c5bf){logger['error'](_0x28c5bf);});}})[_0xd61b('0x11')](function(){if(_0xfae9c1&&_0xfae9c1[_0xd61b('0xcf')]&&_0xfae9c1[_0xd61b('0xdb')]){var _0x53fff2=[];if(_0x571ebc[_0xd61b('0x38')]){_0x53fff2=_0x571ebc[_0xd61b('0x2c')](function(_0x1e882f){return{'name':_0x1e882f[_0xd61b('0xdc')],'basename':_0x1e882f[_0xd61b('0x61')],'type':_0x1e882f[_0xd61b('0xcc')],'ChatOfflineMessageId':_0x11a4df['id']};});}var _0x34cffe;if(!_[_0xd61b('0x6f')](_0xfae9c1[_0xd61b('0xdd')])){var _0x5c3794=_[_0xd61b('0x2c')](_0x239f6b[_0xd61b('0x4a')],function(_0xf1bd94){return _0xf1bd94;});var _0x424f3e=_[_0xd61b('0xde')](_0x5c3794)[0x0];var _0x4b9b75=_['mapValues'](_0x424f3e,function(_0xa110f3){return _0xa110f3;});_0x34cffe=_0x4b9b75[0x1][_0xfae9c1[_0xd61b('0xdd')]];}var _0x3e74a0={'from':_0x57b530['email'],'firstName':_0x57b530[_0xd61b('0xa1')],'lastName':_0x57b530['lastName'],'mapKey':'email','message':{'from':_0x57b530[_0xd61b('0xd9')],'to':_0xfae9c1[_0xd61b('0xc3')][_0xd61b('0xd9')],'cc':'','subject':_[_0xd61b('0x6f')](_0x34cffe)?_0xfae9c1[_0xd61b('0xda')]:_0x34cffe,'messageId':'','sentAt':new Date(),'attach':_0x53fff2['length'],'attachments':_0x53fff2,'originChannel':_0xd61b('0xdf'),'ChatWebsiteId':_0xfae9c1['id'],'ChatOfflineMessageId':_0x5688bf['id'],'originTo':_0xfae9c1[_0xd61b('0xc3')][_0xd61b('0xd9')]},'body':_0x5688bf[_0xd61b('0x4a')]};var _0xe2d3e2={'account':{'id':_0xfae9c1[_0xd61b('0xdb')]},'body':_0x3e74a0,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xd61b('0xe0'),_0xe2d3e2,client9001)['then'](function(){return _0x5688bf;})['catch'](function(_0x2bb59f){logger[_0xd61b('0x16')](_0x2bb59f);});}return;})['then'](function(){if(_0x5688bf){return _0x5688bf;}})[_0xd61b('0x11')](respondWithResult(_0x4a4cb8,null))[_0xd61b('0x44')](function(_0x276157){logger[_0xd61b('0x16')]('catch',_0x276157);for(var _0x48ea6b of _0x571ebc){var _0x388b50=path[_0xd61b('0x6a')](config[_0xd61b('0x6b')],_0xd61b('0xe1'),_0xd61b('0xcd'),_0xd61b('0xce'),_0xd61b('0xe2'),_0x48ea6b[_0xd61b('0x61')]);fs_extra[_0xd61b('0xe3')](_0x388b50)[_0xd61b('0x44')](function(_0xe380a8){logger[_0xd61b('0x16')](_0xd61b('0xe4'),_0x388b50,_0xe380a8);});}});};exports[_0xd61b('0xe5')]=function(_0x2988e8,_0x3ca80e){return db[_0xd61b('0xac')][_0xd61b('0x48')]({'where':{'id':_0x2988e8['params']['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x3ca80e,null))[_0xd61b('0x11')](function(_0x255b2f){if(_0x255b2f){return _0x255b2f[_0xd61b('0xe5')](_0x2988e8[_0xd61b('0x4a')]['ids'],_['omit'](_0x2988e8[_0xd61b('0x4a')],[_0xd61b('0x5b'),'id'])||{});}})[_0xd61b('0x11')](respondWithResult(_0x3ca80e,null))['catch'](handleError(_0x3ca80e,null));};exports[_0xd61b('0xe6')]=function(_0x242a1c,_0x463d32){var _0x5af0ce={'raw':![],'where':{}};var _0x1a7702={};var _0x9ce106={'count':0x0,'rows':[]};return db[_0xd61b('0x2d')][_0xd61b('0x57')]({'where':{'id':_0x242a1c[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x463d32,null))[_0xd61b('0x11')](function(_0x2d9755){if(_0x2d9755){_0x1a7702['model']=_[_0xd61b('0x33')](db[_0xd61b('0xac')][_0xd61b('0x2e')]);_0x1a7702[_0xd61b('0x32')]=_[_0xd61b('0x33')](_0x242a1c['query']);_0x1a7702['filters']=_[_0xd61b('0x35')](_0x1a7702[_0xd61b('0x36')],_0x1a7702[_0xd61b('0x32')]);_0x5af0ce[_0xd61b('0x37')]=_[_0xd61b('0x35')](_0x1a7702[_0xd61b('0x36')],qs[_0xd61b('0x47')](_0x242a1c[_0xd61b('0x32')][_0xd61b('0x47')]));_0x5af0ce[_0xd61b('0x37')]=_0x5af0ce[_0xd61b('0x37')]['length']?_0x5af0ce[_0xd61b('0x37')]:_0x1a7702[_0xd61b('0x36')];if(!_0x242a1c[_0xd61b('0x32')][_0xd61b('0x39')](_0xd61b('0x3a'))){_0x5af0ce[_0xd61b('0x1f')]=qs['limit'](_0x242a1c[_0xd61b('0x32')]['limit']);_0x5af0ce[_0xd61b('0x1d')]=qs[_0xd61b('0x1d')](_0x242a1c['query'][_0xd61b('0x1d')]);}_0x5af0ce[_0xd61b('0x58')]=qs['sort'](_0x242a1c[_0xd61b('0x32')][_0xd61b('0x3b')]);_0x5af0ce[_0xd61b('0x3c')]=qs[_0xd61b('0x34')](_[_0xd61b('0x3d')](_0x242a1c[_0xd61b('0x32')],_0x1a7702[_0xd61b('0x34')]));_0x5af0ce[_0xd61b('0x3c')]['ChatWebsiteId']=_0x2d9755['id'];if(_0x242a1c['query']['filter']){_0x5af0ce[_0xd61b('0x3c')]=_['merge'](_0x5af0ce['where'],{'$or':_['map'](_0x5af0ce[_0xd61b('0x37')],function(_0x4eaab6){var _0x441d5c={};_0x441d5c[_0x4eaab6]={'$like':'%'+_0x242a1c[_0xd61b('0x32')][_0xd61b('0x3e')]+'%'};return _0x441d5c;})});}_0x5af0ce=_[_0xd61b('0x3f')]({},_0x5af0ce,_0x242a1c[_0xd61b('0x40')]);return db[_0xd61b('0xac')][_0xd61b('0x20')]({'where':_0x5af0ce[_0xd61b('0x3c')]})[_0xd61b('0x11')](function(_0x241a39){_0x9ce106['count']=_0x241a39;if(_0x242a1c[_0xd61b('0x32')]['includeAll']){_0x5af0ce[_0xd61b('0x42')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xd61b('0xb9')],'as':_0xd61b('0xe7'),'attributes':[_0xd61b('0x28'),_0xd61b('0xe8'),_0xd61b('0xe9')],'required':![]},{'model':db['Tag'],'as':_0xd61b('0xea'),'attributes':['id',_0xd61b('0x28'),_0xd61b('0xeb')],'where':_0x242a1c['query'][_0xd61b('0xec')]?{'id':_0x242a1c[_0xd61b('0x32')][_0xd61b('0xec')]}:undefined,'required':_0x242a1c[_0xd61b('0x32')][_0xd61b('0xec')]?!![]:![]}];}return db[_0xd61b('0xac')][_0xd61b('0x43')](_0x5af0ce);})[_0xd61b('0x11')](function(_0x36a0c1){_0x9ce106[_0xd61b('0x5f')]=_0x36a0c1;return _0x9ce106;});}})['then'](respondWithFilteredResult(_0x463d32,_0x5af0ce))[_0xd61b('0x44')](handleError(_0x463d32,null));};function iftimePromise(_0x47d173,_0x2f79c3){return respondWithRpcPromise(_0xd61b('0xed'),'getSnippet',{'command':_0x2f79c3['timezone']?util[_0xd61b('0xa8')](_0xd61b('0xee'),_0x47d173['interval'],_0x2f79c3[_0xd61b('0xef')]):util['format'](_0xd61b('0xf0'),_0x47d173[_0xd61b('0xf1')])},client9002)[_0xd61b('0x11')](function(_0x44a359){var _0x31f7a3=_0x44a359&&_0x44a359['indexOf'](_0xd61b('0xf2'))>=0x0?!![]:![];logger[_0xd61b('0x12')](_0xd61b('0xf3'),_0x2f79c3['id'],_0x47d173['id'],_0x47d173[_0xd61b('0xf1')],_0x31f7a3?_0xd61b('0xf4'):_0xd61b('0xf5'),_0x2f79c3[_0xd61b('0xef')]?_0x2f79c3[_0xd61b('0xef')]:'No\x20timezone');return _0x31f7a3;})[_0xd61b('0x44')](function(_0x3043aa){logger[_0xd61b('0x16')](_0xd61b('0xf3'),_0x2f79c3['id'],_0x47d173['id'],_0x47d173[_0xd61b('0xf1')],util[_0xd61b('0xf6')](_0x3043aa,{'showHidden':![],'depth':null}),_0x2f79c3['timezone']?_0x2f79c3[_0xd61b('0xef')]:_0xd61b('0xf7'));return![];});}exports[_0xd61b('0xf8')]=function(_0x46890e,_0x16f385){var _0x43fc10=0x0;var _0x58b6e3=0x0;var _0x22d077=![];var _0x52985b;var _0x345ece;return db[_0xd61b('0x2d')][_0xd61b('0x48')]({'where':{'id':_0x46890e['params']['id']},'include':[{'model':db[_0xd61b('0xf9')],'as':'Interval','include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0xd61b('0x11')](handleEntityNotFound(_0x16f385,null))[_0xd61b('0x11')](function(_0x63569b){if(_0x63569b){_0x52985b=_0x63569b;return _0x63569b[_0xd61b('0xfa')]({'raw':!![]});}})[_0xd61b('0x11')](function(_0x987014){if(_0x52985b){if(_0x987014){_0x345ece=_0x987014;}}return require('../../config/license/util')[_0xd61b('0xfb')]();})[_0xd61b('0x11')](function(_0x52c91a){if(_0x52c91a){_0x58b6e3=_0x52c91a[_0xd61b('0xfc')];_0x22d077=_0x52c91a[_0xd61b('0x6e')];}})['then'](function(){return db[_0xd61b('0xac')][_0xd61b('0x20')]({'where':{'closed':![]}});})[_0xd61b('0x11')](function(_0x18f896){_0x43fc10=_0x18f896;if(_0x58b6e3&&_0x18f896>_0x58b6e3){return db[_0xd61b('0xfd')][_0xd61b('0x57')]({'where':{'id':0x1}})[_0xd61b('0x11')](function(_0x146fd9){if(_0x146fd9){_0x146fd9[_0xd61b('0xfe')](_0xd61b('0xff'));}});}})[_0xd61b('0x11')](function(){if(_0x52985b['Interval']&&_0x52985b['Interval']['Intervals']){var _0x395319=[];for(var _0x40b390=0x0;_0x40b390<_0x52985b[_0xd61b('0xf9')][_0xd61b('0x100')]['length'];_0x40b390++){var _0x547304=_0x52985b['Interval'][_0xd61b('0x100')][_0x40b390][_0xd61b('0x25')]({'plain':!![]});_0x395319[_0xd61b('0xb4')](iftimePromise(_0x547304,_0x52985b));}return BPromise[_0xd61b('0x101')](_0x395319)[_0xd61b('0x11')](function(_0x22f411){return _['some'](_0x22f411);});}else{return!![];}})[_0xd61b('0x11')](function(_0x41ea5b){var _0x3eec58=fs[_0xd61b('0xc6')](path[_0xd61b('0x6a')](config[_0xd61b('0x6b')],'server/files/chat/iframe.ejs'),_0xd61b('0xc8'));var _0xe85354=new url[(_0xd61b('0x102'))](_0x52985b[_0xd61b('0x103')])[_0xd61b('0x104')];var _0x326a78=_0xd61b('0x105');var _0x23cc60=![];var _0xe14f57={'chatVersion':_0x326a78,'chatWebsiteAddressOrigin':_0xe85354,'remote':_0x52985b['remote'],'query':querystring[_0xd61b('0xab')](_[_0xd61b('0x3f')](_0x52985b['get']({'plain':!![]}),{'customerIp':_0x46890e[_0xd61b('0x7c')][_0xd61b('0x9e')]||_0x46890e[_0xd61b('0x7c')][_0xd61b('0x106')]||_0x46890e[_0xd61b('0x107')][_0xd61b('0x108')]||_0x46890e['ip'],'referer':_0x46890e[_0xd61b('0x7c')][_0xd61b('0x109')],'openedInteractions':_0x43fc10,'maxInteractions':_0x58b6e3,'virtual':_0x22d077[_0xd61b('0xfc')],'online':_0x41ea5b,'custom':_0x22d077}))[_0xd61b('0x10a')](/'/g,'\x5c\x27')};_0x16f385[_0xd61b('0x29')](ejs[_0xd61b('0x10b')](Mustache[_0xd61b('0x10b')](_0x3eec58,_0xe14f57),{'proactiveActions':_0x345ece,'alignment':_0x52985b[_0xd61b('0x10c')],'verticalAlignment':_0x52985b[_0xd61b('0x10d')],'div_color':_0x52985b[_0xd61b('0xeb')],'labelText':_0x52985b[_0xd61b('0x10e')],'text_color':_0x52985b[_0xd61b('0x10f')],'text_button_color':_0x52985b[_0xd61b('0x110')],'button_color':_0x52985b[_0xd61b('0x111')],'background_color':_0x52985b[_0xd61b('0x112')],'hideWhenOffline':_0x52985b[_0xd61b('0x113')],'intervalId':_0x52985b[_0xd61b('0x114')],'isDevelopment':_0x23cc60,'chatVersion':_0x326a78}));})[_0xd61b('0x44')](handleError(_0x16f385,null));};exports[_0xd61b('0x115')]=function(_0x2b9388,_0x864081){var _0x49d871=_0x2b9388[_0xd61b('0x53')]['id'];var _0x250391=_0x2b9388[_0xd61b('0x4a')];var _0x50c1c7=0xc8;var _0x2d5964=null;return db[_0xd61b('0xd0')]['transaction']({'isolationLevel':db[_0xd61b('0xd0')][_0xd61b('0x116')][_0xd61b('0x117')][_0xd61b('0x118')]},function(_0xbaddd){return db['ChatWebsite'][_0xd61b('0x57')]({'where':{'id':_0x49d871},'transaction':_0xbaddd})['then'](function(_0x5d7cd7){if(_0x5d7cd7){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x49d871},'transaction':_0xbaddd})['then'](function(){var _0x29a066=_[_0xd61b('0x2c')](_0x250391,function(_0x14e9b3){_0x14e9b3[_0xd61b('0x59')]=_0x49d871;return _0x14e9b3;});return db[_0xd61b('0x94')][_0xd61b('0x119')](_0x29a066,{'transaction':_0xbaddd});});}else{_0x50c1c7=0x194;_0x2d5964=[];}});})[_0xd61b('0x11')](function(){if(_0x50c1c7!==0x194){return db[_0xd61b('0x94')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x49d871},'order':'priority'})[_0xd61b('0x11')](function(_0x61f352){_0x2d5964=_0x61f352;});}})[_0xd61b('0x44')](function(_0x265117){_0x50c1c7=0x1f4;logger[_0xd61b('0x16')](_0x265117['stack']);if(_0x265117[_0xd61b('0x28')]){delete _0x265117[_0xd61b('0x28')];}_0x2d5964=_0x265117;})['finally'](function(){if(_0x2d5964===null){_0x864081[_0xd61b('0x1a')](_0x50c1c7);}else{if(_0x50c1c7===0x1f4){_0x864081[_0xd61b('0x1b')](_0x50c1c7)['send'](_0x2d5964);}else{_0x864081['status'](_0x50c1c7)['json'](_0x2d5964);}}});};exports[_0xd61b('0x11a')]=function(_0x312da9,_0x28cff0){var _0x1cc54b={};var _0x32f41f={};var _0xcf6efa;var _0x5eb91d;return db[_0xd61b('0x2d')][_0xd61b('0x57')]({'where':{'id':_0x312da9[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x28cff0,null))[_0xd61b('0x11')](function(_0x15f3ba){if(_0x15f3ba){_0xcf6efa=_0x15f3ba;_0x32f41f[_0xd61b('0x36')]=_[_0xd61b('0x33')](db[_0xd61b('0x94')][_0xd61b('0x2e')]);_0x32f41f[_0xd61b('0x32')]=_['keys'](_0x312da9['query']);_0x32f41f[_0xd61b('0x34')]=_[_0xd61b('0x35')](_0x32f41f[_0xd61b('0x36')],_0x32f41f[_0xd61b('0x32')]);_0x1cc54b[_0xd61b('0x37')]=_[_0xd61b('0x35')](_0x32f41f[_0xd61b('0x36')],qs[_0xd61b('0x47')](_0x312da9[_0xd61b('0x32')][_0xd61b('0x47')]));_0x1cc54b[_0xd61b('0x37')]=_0x1cc54b[_0xd61b('0x37')][_0xd61b('0x38')]?_0x1cc54b[_0xd61b('0x37')]:_0x32f41f['model'];_0x1cc54b[_0xd61b('0x58')]=qs[_0xd61b('0x3b')](_0x312da9[_0xd61b('0x32')][_0xd61b('0x3b')]);_0x1cc54b['where']=qs[_0xd61b('0x34')](_['pick'](_0x312da9[_0xd61b('0x32')],_0x32f41f[_0xd61b('0x34')]));if(_0x312da9[_0xd61b('0x32')][_0xd61b('0x3e')]){_0x1cc54b[_0xd61b('0x3c')]=_[_0xd61b('0x3f')](_0x1cc54b['where'],{'$or':_['map'](_0x1cc54b[_0xd61b('0x37')],function(_0x57f960){var _0x4442b6={};_0x4442b6[_0x57f960]={'$like':'%'+_0x312da9['query']['filter']+'%'};return _0x4442b6;})});}_0x1cc54b=_[_0xd61b('0x3f')]({},_0x1cc54b,_0x312da9[_0xd61b('0x40')]);return _0xcf6efa[_0xd61b('0x11a')](_0x1cc54b);}})[_0xd61b('0x11')](function(_0x437283){if(_0x437283){_0x5eb91d=_0x437283['length'];if(!_0x312da9['query'][_0xd61b('0x39')]('nolimit')){_0x1cc54b[_0xd61b('0x1f')]=qs[_0xd61b('0x1f')](_0x312da9[_0xd61b('0x32')]['limit']);_0x1cc54b[_0xd61b('0x1d')]=qs[_0xd61b('0x1d')](_0x312da9[_0xd61b('0x32')][_0xd61b('0x1d')]);}return _0xcf6efa['getApplications'](_0x1cc54b);}})[_0xd61b('0x11')](function(_0x44c080){if(_0x44c080){return _0x44c080?{'count':_0x5eb91d,'rows':_0x44c080}:null;}})[_0xd61b('0x11')](respondWithResult(_0x28cff0,null))[_0xd61b('0x44')](handleError(_0x28cff0,null));};exports['addProactiveActions']=function(_0x167f00,_0x8175bc){return db[_0xd61b('0x11b')]['find']({'where':{'id':_0x167f00[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x8175bc,null))[_0xd61b('0x11')](function(_0x59720c){if(_0x59720c){return _0x59720c[_0xd61b('0x11c')](_0x167f00[_0xd61b('0x4a')][_0xd61b('0x5b')],_[_0xd61b('0x11d')](_0x167f00['body'],['ids','id'])||{});}})[_0xd61b('0x11')](respondWithResult(_0x8175bc,null))[_0xd61b('0x44')](handleError(_0x8175bc,null));};exports[_0xd61b('0xfa')]=function(_0x2ababc,_0x2d8037){var _0x2f8c00={};var _0x1a971b={};var _0x14684f;var _0x970abe;return db[_0xd61b('0x2d')][_0xd61b('0x57')]({'where':{'id':_0x2ababc[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x2d8037,null))[_0xd61b('0x11')](function(_0x32df22){if(_0x32df22){_0x14684f=_0x32df22;_0x1a971b[_0xd61b('0x36')]=_[_0xd61b('0x33')](db[_0xd61b('0x11e')]['rawAttributes']);_0x1a971b[_0xd61b('0x32')]=_['keys'](_0x2ababc[_0xd61b('0x32')]);_0x1a971b[_0xd61b('0x34')]=_['intersection'](_0x1a971b[_0xd61b('0x36')],_0x1a971b[_0xd61b('0x32')]);_0x2f8c00[_0xd61b('0x37')]=_['intersection'](_0x1a971b[_0xd61b('0x36')],qs[_0xd61b('0x47')](_0x2ababc[_0xd61b('0x32')][_0xd61b('0x47')]));_0x2f8c00[_0xd61b('0x37')]=_0x2f8c00[_0xd61b('0x37')][_0xd61b('0x38')]?_0x2f8c00[_0xd61b('0x37')]:_0x1a971b[_0xd61b('0x36')];_0x2f8c00[_0xd61b('0x58')]=qs[_0xd61b('0x3b')](_0x2ababc['query'][_0xd61b('0x3b')]);_0x2f8c00[_0xd61b('0x3c')]=qs['filters'](_[_0xd61b('0x3d')](_0x2ababc[_0xd61b('0x32')],_0x1a971b['filters']));if(_0x2ababc[_0xd61b('0x32')][_0xd61b('0x3e')]){_0x2f8c00[_0xd61b('0x3c')]=_['merge'](_0x2f8c00['where'],{'$or':_[_0xd61b('0x2c')](_0x2f8c00[_0xd61b('0x37')],function(_0x56fdd1){var _0x37f1ec={};_0x37f1ec[_0x56fdd1]={'$like':'%'+_0x2ababc[_0xd61b('0x32')]['filter']+'%'};return _0x37f1ec;})});}_0x2f8c00=_['merge']({},_0x2f8c00,_0x2ababc[_0xd61b('0x40')]);return _0x14684f['getProactiveActions'](_0x2f8c00);}})['then'](function(_0x1967c5){if(_0x1967c5){_0x970abe=_0x1967c5[_0xd61b('0x38')];if(!_0x2ababc[_0xd61b('0x32')]['hasOwnProperty']('nolimit')){_0x2f8c00[_0xd61b('0x1f')]=qs['limit'](_0x2ababc[_0xd61b('0x32')][_0xd61b('0x1f')]);_0x2f8c00[_0xd61b('0x1d')]=qs[_0xd61b('0x1d')](_0x2ababc['query']['offset']);}return _0x14684f['getProactiveActions'](_0x2f8c00);}})['then'](function(_0x2a515f){if(_0x2a515f){return _0x2a515f?{'count':_0x970abe,'rows':_0x2a515f}:null;}})[_0xd61b('0x11')](respondWithResult(_0x2d8037,null))[_0xd61b('0x44')](handleError(_0x2d8037,null));};exports[_0xd61b('0x11f')]=function(_0xdf0323,_0x8d7e66){var _0x108c43=_0xdf0323[_0xd61b('0x32')][_0xd61b('0x120')]===_0xd61b('0x121')?'offlineForm':_0xd61b('0x122');return db[_0xd61b('0x2d')][_0xd61b('0x48')]({'attributes':['id',_0x108c43],'where':{'id':_0xdf0323['params']['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x8d7e66,null))[_0xd61b('0x11')](function(_0xdfb482){if(_0xdfb482){var _0x446b6e=_0xdfb482[_0x108c43];var _0x34ed13=_0x446b6e&&_0x446b6e[_0xd61b('0x123')]?_0x446b6e[_0xd61b('0x123')]:[];_0x8d7e66[_0xd61b('0x29')]({'fromKey':_['isNil'](_0x446b6e[_0xd61b('0x124')])?undefined:_0x446b6e['fromKey'],'count':_0x34ed13[_0xd61b('0x38')],'rows':_0x34ed13});}})[_0xd61b('0x44')](handleError(_0x8d7e66,null));};exports[_0xd61b('0x125')]=function(_0x3acf25,_0x15aa20){var _0x556ddd={'raw':![],'where':{}};var _0x2f5652={};var _0x339863={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd61b('0x57')]({'where':{'id':_0x3acf25[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x15aa20,null))[_0xd61b('0x11')](function(_0x37d998){if(_0x37d998){_0x2f5652[_0xd61b('0x36')]=_[_0xd61b('0x33')](db[_0xd61b('0xca')]['rawAttributes']);_0x2f5652[_0xd61b('0x32')]=_[_0xd61b('0x33')](_0x3acf25[_0xd61b('0x32')]);_0x2f5652[_0xd61b('0x34')]=_[_0xd61b('0x35')](_0x2f5652[_0xd61b('0x36')],_0x2f5652[_0xd61b('0x32')]);_0x556ddd[_0xd61b('0x37')]=_[_0xd61b('0x35')](_0x2f5652[_0xd61b('0x36')],qs[_0xd61b('0x47')](_0x3acf25[_0xd61b('0x32')]['fields']));_0x556ddd['attributes']=_0x556ddd[_0xd61b('0x37')]['length']?_0x556ddd[_0xd61b('0x37')]:_0x2f5652[_0xd61b('0x36')];if(!_0x3acf25['query'][_0xd61b('0x39')]('nolimit')){_0x556ddd[_0xd61b('0x1f')]=qs['limit'](_0x3acf25[_0xd61b('0x32')][_0xd61b('0x1f')]);_0x556ddd['offset']=qs[_0xd61b('0x1d')](_0x3acf25['query'][_0xd61b('0x1d')]);}_0x556ddd[_0xd61b('0x58')]=qs[_0xd61b('0x3b')](_0x3acf25[_0xd61b('0x32')]['sort']);_0x556ddd['where']=qs[_0xd61b('0x34')](_[_0xd61b('0x3d')](_0x3acf25[_0xd61b('0x32')],_0x2f5652[_0xd61b('0x34')]));_0x556ddd[_0xd61b('0x3c')][_0xd61b('0x59')]=_0x37d998['id'];if(_0x3acf25[_0xd61b('0x32')][_0xd61b('0x3e')]){_0x556ddd[_0xd61b('0x3c')]=_[_0xd61b('0x3f')](_0x556ddd[_0xd61b('0x3c')],{'$or':_[_0xd61b('0x2c')](_0x556ddd[_0xd61b('0x37')],function(_0x500925){var _0x2a672c={};_0x2a672c[_0x500925]={'$like':'%'+_0x3acf25[_0xd61b('0x32')][_0xd61b('0x3e')]+'%'};return _0x2a672c;})});}_0x556ddd=_[_0xd61b('0x3f')]({},_0x556ddd,_0x3acf25['options']);return db[_0xd61b('0xca')][_0xd61b('0x20')]({'where':_0x556ddd['where']})[_0xd61b('0x11')](function(_0x5d3922){_0x339863[_0xd61b('0x20')]=_0x5d3922;if(_0x3acf25['query']['includeAll']){_0x556ddd['include']=[{'all':!![]}];}else{_0x556ddd['include']=[{'model':db[_0xd61b('0x80')],'as':_0xd61b('0x126'),'required':![]},{'model':db[_0xd61b('0xd2')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0xd61b('0x43')](_0x556ddd);})[_0xd61b('0x11')](function(_0x2551b4){_0x339863[_0xd61b('0x5f')]=_0x2551b4;return _0x339863;});}})[_0xd61b('0x11')](respondWithFilteredResult(_0x15aa20,_0x556ddd))[_0xd61b('0x44')](handleError(_0x15aa20,null));};exports[_0xd61b('0x127')]=function(_0x57d7a4,_0x2ad861){return db[_0xd61b('0x2d')][_0xd61b('0x48')]({'where':{'id':_0x57d7a4[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x2ad861,null))['then'](function(_0x9e9c34){if(_0x9e9c34){return _0x9e9c34[_0xd61b('0x127')](_0x57d7a4[_0xd61b('0x4a')]['ids'],_['omit'](_0x57d7a4['body'],[_0xd61b('0x5b'),'id'])||{})['spread'](function(_0x58f4a2){for(var _0x2a5a84=0x0;_0x2a5a84<_0x57d7a4['body'][_0xd61b('0x5b')]['length'];_0x2a5a84+=0x1){socket[_0xd61b('0x128')](_0xd61b('0x129'),{'UserId':Number(_0x57d7a4[_0xd61b('0x4a')][_0xd61b('0x5b')][_0x2a5a84]),'ChatWebsiteId':Number(_0x57d7a4['params']['id'])});}return _0x58f4a2;});}})[_0xd61b('0x11')](respondWithResult(_0x2ad861,null))[_0xd61b('0x44')](handleError(_0x2ad861,null));};exports[_0xd61b('0x12a')]=function(_0x5a5e09,_0x38458b){return db[_0xd61b('0x2d')]['find']({'where':{'id':_0x5a5e09[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x38458b,null))[_0xd61b('0x11')](function(_0x5b4297){if(_0x5b4297){return _0x5b4297['removeAgents'](_0x5a5e09['query']['ids'])['then'](function(){if(_['isArray'](_0x5a5e09['query'][_0xd61b('0x5b')])){for(var _0x550d48=0x0;_0x550d48<_0x5a5e09[_0xd61b('0x32')][_0xd61b('0x5b')][_0xd61b('0x38')];_0x550d48+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x5a5e09['query'][_0xd61b('0x5b')][_0x550d48]),'ChatWebsiteId':Number(_0x5a5e09['params']['id'])});}}else{socket[_0xd61b('0x128')](_0xd61b('0x12b'),{'UserId':Number(_0x5a5e09[_0xd61b('0x32')][_0xd61b('0x5b')]),'ChatWebsiteId':Number(_0x5a5e09['params']['id'])});}});}})[_0xd61b('0x11')](respondWithStatusCode(_0x38458b,null))['catch'](handleError(_0x38458b,null));};exports[_0xd61b('0x12c')]=function(_0x558ab2,_0x44c558){var _0x6c33d1={};var _0x340b26={};var _0x19d200;var _0x5ab7f0;return db['ChatWebsite']['findOne']({'where':{'id':_0x558ab2[_0xd61b('0x53')]['id']}})[_0xd61b('0x11')](handleEntityNotFound(_0x44c558,null))[_0xd61b('0x11')](function(_0x299578){if(_0x299578){_0x19d200=_0x299578;_0x340b26[_0xd61b('0x36')]=_[_0xd61b('0x33')](db[_0xd61b('0xb9')][_0xd61b('0x2e')]);_0x340b26[_0xd61b('0x32')]=_[_0xd61b('0x33')](_0x558ab2[_0xd61b('0x32')]);_0x340b26['filters']=_[_0xd61b('0x35')](_0x340b26[_0xd61b('0x36')],_0x340b26['query']);_0x6c33d1[_0xd61b('0x37')]=_['intersection'](_0x340b26[_0xd61b('0x36')],qs['fields'](_0x558ab2[_0xd61b('0x32')][_0xd61b('0x47')]));_0x6c33d1['attributes']=_0x6c33d1[_0xd61b('0x37')][_0xd61b('0x38')]?_0x6c33d1['attributes']:_0x340b26[_0xd61b('0x36')];_0x6c33d1[_0xd61b('0x58')]=qs[_0xd61b('0x3b')](_0x558ab2[_0xd61b('0x32')][_0xd61b('0x3b')]);_0x6c33d1['where']=qs[_0xd61b('0x34')](_[_0xd61b('0x3d')](_0x558ab2['query'],_0x340b26['filters']));if(_0x558ab2[_0xd61b('0x32')][_0xd61b('0x3e')]){_0x6c33d1[_0xd61b('0x3c')]=_[_0xd61b('0x3f')](_0x6c33d1[_0xd61b('0x3c')],{'$or':_[_0xd61b('0x2c')](_0x6c33d1[_0xd61b('0x37')],function(_0x3dd3ea){var _0x1dfaca={};_0x1dfaca[_0x3dd3ea]={'$like':'%'+_0x558ab2[_0xd61b('0x32')][_0xd61b('0x3e')]+'%'};return _0x1dfaca;})});}_0x6c33d1=_[_0xd61b('0x3f')]({},_0x6c33d1,_0x558ab2['options']);return _0x19d200[_0xd61b('0x12c')](_0x6c33d1);}})[_0xd61b('0x11')](function(_0x3b9266){if(_0x3b9266){_0x5ab7f0=_0x3b9266[_0xd61b('0x38')];if(!_0x558ab2['query'][_0xd61b('0x39')](_0xd61b('0x3a'))){_0x6c33d1['limit']=qs[_0xd61b('0x1f')](_0x558ab2[_0xd61b('0x32')]['limit']);_0x6c33d1[_0xd61b('0x1d')]=qs[_0xd61b('0x1d')](_0x558ab2[_0xd61b('0x32')][_0xd61b('0x1d')]);}return _0x19d200['getAgents'](_0x6c33d1);}})['then'](function(_0x42baaa){if(_0x42baaa){return _0x42baaa?{'count':_0x5ab7f0,'rows':_0x42baaa}:null;}})[_0xd61b('0x11')](respondWithResult(_0x44c558,null))[_0xd61b('0x44')](handleError(_0x44c558,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index db3ad90..b7e40c7 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 _0xf822=['events','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x118ebd,_0x336277){var _0xa21b14=function(_0x4acf8c){while(--_0x4acf8c){_0x118ebd['push'](_0x118ebd['shift']());}};_0xa21b14(++_0x336277);}(_0xf822,0x19e));var _0x2f82=function(_0x337b35,_0x462348){_0x337b35=_0x337b35-0x0;var _0x175c9d=_0xf822[_0x337b35];return _0x175c9d;};'use strict';var EventEmitter=require(_0x2f82('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x2f82('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2f82('0x2')](0x0);var events={'afterCreate':_0x2f82('0x3'),'afterUpdate':_0x2f82('0x4'),'afterDestroy':_0x2f82('0x5')};function emitEvent(_0x260206){return function(_0x48a05c,_0x12e2d7,_0xd4688e){ChatWebsiteEvents[_0x2f82('0x6')](_0x260206+':'+_0x48a05c['id'],_0x48a05c);ChatWebsiteEvents['emit'](_0x260206,_0x48a05c);_0xd4688e(null);};}for(var e in events){if(events[_0x2f82('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x2f82('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x18d6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x50deaf,_0x5524cb){var _0x3973e8=function(_0x1702c4){while(--_0x1702c4){_0x50deaf['push'](_0x50deaf['shift']());}};_0x3973e8(++_0x5524cb);}(_0x18d6,0x166));var _0x618d=function(_0x14e5ef,_0x10cce4){_0x14e5ef=_0x14e5ef-0x0;var _0x5ce0db=_0x18d6[_0x14e5ef];return _0x5ce0db;};'use strict';var EventEmitter=require(_0x618d('0x0'));var ChatWebsite=require(_0x618d('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x618d('0x2')](0x0);var events={'afterCreate':_0x618d('0x3'),'afterUpdate':_0x618d('0x4'),'afterDestroy':_0x618d('0x5')};function emitEvent(_0x5f341a){return function(_0x3151de,_0x1a7716,_0x47d0b3){ChatWebsiteEvents[_0x618d('0x6')](_0x5f341a+':'+_0x3151de['id'],_0x3151de);ChatWebsiteEvents['emit'](_0x5f341a,_0x3151de);_0x47d0b3(null);};}for(var e in events){if(events[_0x618d('0x7')](e)){var event=events[e];ChatWebsite[_0x618d('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 3dad375..c6a7039 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 _0xaceb=['../../config/environment','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaceb,0x137));var _0xbace=function(_0x142f7f,_0x4dfb94){_0x142f7f=_0x142f7f-0x0;var _0x3cc8ed=_0xaceb[_0x142f7f];return _0x3cc8ed;};'use strict';var _=require(_0xbace('0x0'));var util=require(_0xbace('0x1'));var logger=require(_0xbace('0x2'))(_0xbace('0x3'));var moment=require(_0xbace('0x4'));var BPromise=require('bluebird');var rp=require(_0xbace('0x5'));var fs=require('fs');var path=require(_0xbace('0x6'));var rimraf=require(_0xbace('0x7'));var config=require(_0xbace('0x8'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x329dd8,_0x5b2774){return _0x329dd8['define'](_0xbace('0x9'),attributes,{'tableName':_0xbace('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x456f=['../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2c592c,_0x55e83b){var _0x340192=function(_0x3d86d5){while(--_0x3d86d5){_0x2c592c['push'](_0x2c592c['shift']());}};_0x340192(++_0x55e83b);}(_0x456f,0xaa));var _0xf456=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x456f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf456('0x0'))(_0xf456('0x1'));var moment=require('moment');var BPromise=require(_0xf456('0x2'));var rp=require(_0xf456('0x3'));var fs=require('fs');var path=require(_0xf456('0x4'));var rimraf=require(_0xf456('0x5'));var config=require(_0xf456('0x6'));var attributes=require(_0xf456('0x7'));module[_0xf456('0x8')]=function(_0x20119a,_0x21f483){return _0x20119a[_0xf456('0x9')]('ChatWebsite',attributes,{'tableName':_0xf456('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 67145fc..5de2cc2 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 _0xbe8d=['message','result','catch','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbe8d,0xc3));var _0xdbe8=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0xbe8d[_0x4c7d8b];return _0x187158;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdbe8('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbe8('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdbe8('0x2'))(_0xdbe8('0x3'));var config=require(_0xdbe8('0x4'));var jayson=require(_0xdbe8('0x5'));var client=jayson['client'][_0xdbe8('0x6')]({'port':0x232a});config['redis']=_[_0xdbe8('0x7')](config[_0xdbe8('0x8')],{'host':_0xdbe8('0x9'),'port':0x18eb});var socket=require(_0xdbe8('0xa'))(new Redis(config[_0xdbe8('0x8')]));require(_0xdbe8('0xb'))[_0xdbe8('0xc')](socket);function respondWithRpcPromise(_0x31ac8f,_0x33f2c8,_0x1c4ae7){return new BPromise(function(_0x513f20,_0x1b0402){return client[_0xdbe8('0xd')](_0x31ac8f,_0x1c4ae7)['then'](function(_0x211dba){logger[_0xdbe8('0xe')](_0xdbe8('0xf'),_0x33f2c8,_0xdbe8('0x10'));logger['debug'](_0xdbe8('0x11'),_0x33f2c8,_0xdbe8('0x10'),JSON[_0xdbe8('0x12')](_0x211dba));if(_0x211dba[_0xdbe8('0x13')]){if(_0x211dba[_0xdbe8('0x13')][_0xdbe8('0x14')]===0x1f4){logger[_0xdbe8('0x13')](_0xdbe8('0xf'),_0x33f2c8,_0x211dba[_0xdbe8('0x13')][_0xdbe8('0x15')]);return _0x1b0402(_0x211dba[_0xdbe8('0x13')][_0xdbe8('0x15')]);}logger[_0xdbe8('0x13')](_0xdbe8('0xf'),_0x33f2c8,_0x211dba[_0xdbe8('0x13')][_0xdbe8('0x15')]);return _0x513f20(_0x211dba[_0xdbe8('0x13')]['message']);}else{logger['info'](_0xdbe8('0xf'),_0x33f2c8,_0xdbe8('0x10'));_0x513f20(_0x211dba[_0xdbe8('0x16')][_0xdbe8('0x15')]);}})[_0xdbe8('0x17')](function(_0x2d456b){logger[_0xdbe8('0x13')](_0xdbe8('0xf'),_0x33f2c8,_0x2d456b);_0x1b0402(_0x2d456b);});});} \ No newline at end of file +var _0xda76=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0xda76,0x1e1));var _0x6da7=function(_0x316321,_0x5e36ac){_0x316321=_0x316321-0x0;var _0x57aeb0=_0xda76[_0x316321];return _0x57aeb0;};'use strict';var _=require(_0x6da7('0x0'));var util=require(_0x6da7('0x1'));var moment=require('moment');var BPromise=require(_0x6da7('0x2'));var rs=require(_0x6da7('0x3'));var fs=require('fs');var Redis=require(_0x6da7('0x4'));var db=require(_0x6da7('0x5'))['db'];var utils=require(_0x6da7('0x6'));var logger=require(_0x6da7('0x7'))(_0x6da7('0x8'));var config=require(_0x6da7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6da7('0xa')][_0x6da7('0xb')]({'port':0x232a});config['redis']=_[_0x6da7('0xc')](config[_0x6da7('0xd')],{'host':_0x6da7('0xe'),'port':0x18eb});var socket=require(_0x6da7('0xf'))(new Redis(config[_0x6da7('0xd')]));require('./chatWebsite.socket')[_0x6da7('0x10')](socket);function respondWithRpcPromise(_0x15686c,_0x21d7cb,_0x120e99){return new BPromise(function(_0x539653,_0x185e99){return client['request'](_0x15686c,_0x120e99)[_0x6da7('0x11')](function(_0x90265a){logger[_0x6da7('0x12')](_0x6da7('0x13'),_0x21d7cb,_0x6da7('0x14'));logger[_0x6da7('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x21d7cb,_0x6da7('0x14'),JSON['stringify'](_0x90265a));if(_0x90265a[_0x6da7('0x16')]){if(_0x90265a[_0x6da7('0x16')][_0x6da7('0x17')]===0x1f4){logger['error'](_0x6da7('0x13'),_0x21d7cb,_0x90265a[_0x6da7('0x16')][_0x6da7('0x18')]);return _0x185e99(_0x90265a[_0x6da7('0x16')][_0x6da7('0x18')]);}logger['error'](_0x6da7('0x13'),_0x21d7cb,_0x90265a['error'][_0x6da7('0x18')]);return _0x539653(_0x90265a['error'][_0x6da7('0x18')]);}else{logger[_0x6da7('0x12')](_0x6da7('0x13'),_0x21d7cb,'request\x20sent');_0x539653(_0x90265a[_0x6da7('0x19')][_0x6da7('0x18')]);}})[_0x6da7('0x1a')](function(_0x17ce22){logger[_0x6da7('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x21d7cb,_0x17ce22);_0x185e99(_0x17ce22);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index e8fdea3..51360b2 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 _0xd013=['length','chatWebsite:','./chatWebsite.events','save','remove','update','emit','register'];(function(_0x10b4d3,_0x12e69b){var _0x12615b=function(_0x36eb54){while(--_0x36eb54){_0x10b4d3['push'](_0x10b4d3['shift']());}};_0x12615b(++_0x12e69b);}(_0xd013,0x132));var _0x3d01=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xd013[_0x110c3d];return _0x226d67;};'use strict';var ChatWebsiteEvents=require(_0x3d01('0x0'));var events=[_0x3d01('0x1'),_0x3d01('0x2'),_0x3d01('0x3')];function createListener(_0x133aef,_0x2418ae){return function(_0x2458e9){_0x2418ae[_0x3d01('0x4')](_0x133aef,_0x2458e9);};}function removeListener(_0x163035,_0x27c14c){return function(){ChatWebsiteEvents['removeListener'](_0x163035,_0x27c14c);};}exports[_0x3d01('0x5')]=function(_0x3da28c){for(var _0x5872b4=0x0,_0x5bc1d2=events[_0x3d01('0x6')];_0x5872b4<_0x5bc1d2;_0x5872b4++){var _0x5b622a=events[_0x5872b4];var _0x976bb=createListener(_0x3d01('0x7')+_0x5b622a,_0x3da28c);ChatWebsiteEvents['on'](_0x5b622a,_0x976bb);}}; \ No newline at end of file +var _0x04bd=['length','chatWebsite:','./chatWebsite.events','save','update','emit','removeListener','register'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x04bd,0x1f2));var _0xd04b=function(_0x1608c8,_0x2d1754){_0x1608c8=_0x1608c8-0x0;var _0x53f1cc=_0x04bd[_0x1608c8];return _0x53f1cc;};'use strict';var ChatWebsiteEvents=require(_0xd04b('0x0'));var events=[_0xd04b('0x1'),'remove',_0xd04b('0x2')];function createListener(_0x3de03f,_0x13e7d0){return function(_0x954a3a){_0x13e7d0[_0xd04b('0x3')](_0x3de03f,_0x954a3a);};}function removeListener(_0x888dcb,_0x21c3d7){return function(){ChatWebsiteEvents[_0xd04b('0x4')](_0x888dcb,_0x21c3d7);};}exports[_0xd04b('0x5')]=function(_0x42746d){for(var _0x4f1594=0x0,_0x5c6dfb=events[_0xd04b('0x6')];_0x4f1594<_0x5c6dfb;_0x4f1594++){var _0x4a9a83=events[_0x4f1594];var _0x45f946=createListener(_0xd04b('0x7')+_0x4a9a83,_0x42746d);ChatWebsiteEvents['on'](_0x4a9a83,_0x45f946);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 4a52398..d517d75 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 _0x01af=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','addLogo','server/files/images/avatars/','/:id/avatar','file','addAvatar','now','single','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','ensureDir','replace','any','addInteraction','/:id/applications','addProactiveActions','put','update','destroy','delete','removeDispositions','/:id/users','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x17e88d,_0x5330f7){var _0x52137a=function(_0x250385){while(--_0x250385){_0x17e88d['push'](_0x17e88d['shift']());}};_0x52137a(++_0x5330f7);}(_0x01af,0xcc));var _0xf01a=function(_0x213d25,_0x25b8ab){_0x213d25=_0x213d25-0x0;var _0xebc989=_0x01af[_0x213d25];return _0xebc989;};'use strict';var multer=require(_0xf01a('0x0'));var util=require(_0xf01a('0x1'));var path=require(_0xf01a('0x2'));var timeout=require(_0xf01a('0x3'));var express=require(_0xf01a('0x4'));var router=express['Router']();var fs_extra=require(_0xf01a('0x5'));var auth=require(_0xf01a('0x6'));var interaction=require(_0xf01a('0x7'));var config=require(_0xf01a('0x8'));var controller=require(_0xf01a('0x9'));router[_0xf01a('0xa')]('/',auth[_0xf01a('0xb')](),controller[_0xf01a('0xc')]);router['get'](_0xf01a('0xd'),auth[_0xf01a('0xb')](),controller[_0xf01a('0xe')]);router[_0xf01a('0xa')](_0xf01a('0xf'),auth[_0xf01a('0xb')](),controller[_0xf01a('0x10')]);router[_0xf01a('0xa')](_0xf01a('0x11'),auth[_0xf01a('0xb')](),controller[_0xf01a('0x12')]);router[_0xf01a('0xa')](_0xf01a('0x13'),auth[_0xf01a('0xb')](),controller[_0xf01a('0x14')]);router['get'](_0xf01a('0x15'),controller['getLogo']);router['get']('/:id/avatar',controller['getAvatar']);router[_0xf01a('0xa')](_0xf01a('0x16'),controller[_0xf01a('0x17')]);router[_0xf01a('0xa')]('/:id/system_avatar',controller[_0xf01a('0x18')]);router['get'](_0xf01a('0x19'),auth[_0xf01a('0xb')](),controller[_0xf01a('0x1a')]);router[_0xf01a('0xa')]('/:id/snippet',controller[_0xf01a('0x1b')]);router[_0xf01a('0xa')]('/:id/applications',auth[_0xf01a('0xb')](),controller['getApplications']);router[_0xf01a('0xa')](_0xf01a('0x1c'),auth[_0xf01a('0xb')](),controller[_0xf01a('0x1d')]);router['get'](_0xf01a('0x1e'),controller['getFields']);router[_0xf01a('0xa')](_0xf01a('0x1f'),auth[_0xf01a('0xb')](),controller['getOfflineMessages']);router[_0xf01a('0xa')]('/:id/users',auth[_0xf01a('0xb')](),controller[_0xf01a('0x20')]);router[_0xf01a('0x21')]('/',auth[_0xf01a('0xb')](),controller[_0xf01a('0x22')]);router[_0xf01a('0x21')](_0xf01a('0x11'),auth[_0xf01a('0xb')](),controller[_0xf01a('0x23')]);router[_0xf01a('0x21')](_0xf01a('0x13'),auth[_0xf01a('0xb')](),controller[_0xf01a('0x24')]);var upload=multer({'storage':multer[_0xf01a('0x25')]({'destination':function(_0x814aa6,_0x3e2292,_0x3153c9){_0x3153c9(null,path[_0xf01a('0x26')](config[_0xf01a('0x27')],_0xf01a('0x28')));},'filename':function(_0x274b16,_0x28087c,_0x17f5c5){_0x17f5c5(null,util[_0xf01a('0x29')](_0xf01a('0x2a'),Date['now'](),_0x28087c[_0xf01a('0x2b')]));}})});router[_0xf01a('0x21')](_0xf01a('0x15'),upload['single']('file'),controller[_0xf01a('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x70019a,_0x2e8024,_0x3a21c1){_0x3a21c1(null,path[_0xf01a('0x26')](config[_0xf01a('0x27')],_0xf01a('0x2d')));},'filename':function(_0x3c81d0,_0x398307,_0x2242f0){_0x2242f0(null,util[_0xf01a('0x29')](_0xf01a('0x2a'),Date['now'](),_0x398307['originalname']));}})});router[_0xf01a('0x21')](_0xf01a('0x2e'),upload['single'](_0xf01a('0x2f')),controller[_0xf01a('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3cf6b1,_0xfdf0df,_0x583664){_0x583664(null,path[_0xf01a('0x26')](config[_0xf01a('0x27')],_0xf01a('0x2d')));},'filename':function(_0x5a9955,_0x319581,_0x11af3f){_0x11af3f(null,util['format'](_0xf01a('0x2a'),Date[_0xf01a('0x31')](),_0x319581[_0xf01a('0x2b')]));}})});router[_0xf01a('0x21')](_0xf01a('0x16'),upload[_0xf01a('0x32')](_0xf01a('0x2f')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xf01a('0x25')]({'destination':function(_0x3ba483,_0x1e9136,_0x2339c3){_0x2339c3(null,path[_0xf01a('0x26')](config[_0xf01a('0x27')],_0xf01a('0x2d')));},'filename':function(_0x43a06e,_0x8560ef,_0x5047f1){_0x5047f1(null,util[_0xf01a('0x29')](_0xf01a('0x2a'),Date['now'](),_0x8560ef['originalname']));}})});router['post'](_0xf01a('0x33'),upload[_0xf01a('0x32')](_0xf01a('0x2f')),controller[_0xf01a('0x34')]);router['post'](_0xf01a('0x35'),controller[_0xf01a('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0xf01a('0x25')]({'destination':function(_0xa81cb9,_0x763895,_0x1cc4d8){const _0x559d2f=path[_0xf01a('0x26')](config[_0xf01a('0x27')],_0xf01a('0x37'),_0xf01a('0x38'),'offline-chat');fs_extra[_0xf01a('0x39')](_0x559d2f,function(){_0x1cc4d8(null,_0x559d2f);});},'filename':function(_0x2cf8df,_0xbcd55f,_0xef4b3){const _0x4613fd=_0xbcd55f['originalname'][_0xf01a('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x6db998=path['extname'](_0x4613fd);const _0x3a090f=Date[_0xf01a('0x31')]()+'-'+_0x4613fd[_0xf01a('0x3a')](_0x6db998,'')+_0x6db998;_0xef4b3(null,_0x3a090f);}})});router[_0xf01a('0x21')]('/:id/offline',offlineUploadMulter[_0xf01a('0x3b')](),controller['offline']);router[_0xf01a('0x21')]('/:id/interactions',auth[_0xf01a('0xb')](),controller[_0xf01a('0x3c')]);router['post'](_0xf01a('0x3d'),auth['isAuthenticated'](),controller['addApplications']);router[_0xf01a('0x21')](_0xf01a('0x1c'),auth[_0xf01a('0xb')](),controller[_0xf01a('0x3e')]);router[_0xf01a('0x21')]('/:id/users',auth[_0xf01a('0xb')](),controller['addAgents']);router[_0xf01a('0x3f')](_0xf01a('0xf'),auth[_0xf01a('0xb')](),controller[_0xf01a('0x40')]);router['delete'](_0xf01a('0xf'),auth[_0xf01a('0xb')](),controller[_0xf01a('0x41')]);router[_0xf01a('0x42')](_0xf01a('0x11'),auth[_0xf01a('0xb')](),controller[_0xf01a('0x43')]);router['delete']('/:id/canned_answers',auth[_0xf01a('0xb')](),controller['removeAnswers']);router[_0xf01a('0x42')](_0xf01a('0x44'),auth[_0xf01a('0xb')](),controller['removeAgents']);module[_0xf01a('0x45')]=router; \ No newline at end of file +var _0xd5e5=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','single','file','server/files/images/avatars/','originalname','join','addSystemAvatar','notify','server/files','attachments','ensureDir','replace','/:id/offline','offline','/:id/interactions','addInteraction','addProactiveActions','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','fs-extra'];(function(_0x4d199d,_0x2882a2){var _0x46389a=function(_0x20ecf3){while(--_0x20ecf3){_0x4d199d['push'](_0x4d199d['shift']());}};_0x46389a(++_0x2882a2);}(_0xd5e5,0x177));var _0x5d5e=function(_0x5e8531,_0x315eaf){_0x5e8531=_0x5e8531-0x0;var _0x304ae4=_0xd5e5[_0x5e8531];return _0x304ae4;};'use strict';var multer=require('multer');var util=require(_0x5d5e('0x0'));var path=require(_0x5d5e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5d5e('0x2'));var auth=require(_0x5d5e('0x3'));var interaction=require(_0x5d5e('0x4'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0x5d5e('0x5')]('/',auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x7')]);router[_0x5d5e('0x5')](_0x5d5e('0x8'),auth[_0x5d5e('0x6')](),controller['describe']);router['get'](_0x5d5e('0x9'),auth['isAuthenticated'](),controller[_0x5d5e('0xa')]);router['get'](_0x5d5e('0xb'),auth[_0x5d5e('0x6')](),controller[_0x5d5e('0xc')]);router[_0x5d5e('0x5')](_0x5d5e('0xd'),auth[_0x5d5e('0x6')](),controller[_0x5d5e('0xe')]);router['get'](_0x5d5e('0xf'),controller[_0x5d5e('0x10')]);router[_0x5d5e('0x5')](_0x5d5e('0x11'),controller['getAvatar']);router[_0x5d5e('0x5')](_0x5d5e('0x12'),controller['getCustomerAvatar']);router[_0x5d5e('0x5')](_0x5d5e('0x13'),controller[_0x5d5e('0x14')]);router[_0x5d5e('0x5')]('/:id/interactions',auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x15')]);router[_0x5d5e('0x5')](_0x5d5e('0x16'),controller[_0x5d5e('0x17')]);router[_0x5d5e('0x5')]('/:id/applications',auth[_0x5d5e('0x6')](),controller['getApplications']);router[_0x5d5e('0x5')](_0x5d5e('0x18'),auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x19')]);router['get']('/:id/fields',controller[_0x5d5e('0x1a')]);router['get']('/:id/offline_messages',auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x1b')]);router[_0x5d5e('0x5')](_0x5d5e('0x1c'),auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x1d')]);router[_0x5d5e('0x1e')]('/',auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x1f')]);router[_0x5d5e('0x1e')](_0x5d5e('0xb'),auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x20')]);router[_0x5d5e('0x1e')]('/:id/canned_answers',auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x21')]);var upload=multer({'storage':multer[_0x5d5e('0x22')]({'destination':function(_0x58478b,_0x8fa882,_0x47000c){_0x47000c(null,path['join'](config[_0x5d5e('0x23')],_0x5d5e('0x24')));},'filename':function(_0x4f4bb3,_0x581786,_0x1ba209){_0x1ba209(null,util[_0x5d5e('0x25')](_0x5d5e('0x26'),Date[_0x5d5e('0x27')](),_0x581786['originalname']));}})});router['post'](_0x5d5e('0xf'),upload[_0x5d5e('0x28')](_0x5d5e('0x29')),controller['addLogo']);var upload=multer({'storage':multer[_0x5d5e('0x22')]({'destination':function(_0xa14a47,_0x541138,_0x1466bf){_0x1466bf(null,path['join'](config[_0x5d5e('0x23')],_0x5d5e('0x2a')));},'filename':function(_0x13a08a,_0x2bd79c,_0x545a6b){_0x545a6b(null,util['format'](_0x5d5e('0x26'),Date[_0x5d5e('0x27')](),_0x2bd79c[_0x5d5e('0x2b')]));}})});router[_0x5d5e('0x1e')]('/:id/avatar',upload['single'](_0x5d5e('0x29')),controller['addAvatar']);var upload=multer({'storage':multer[_0x5d5e('0x22')]({'destination':function(_0x42ca0c,_0xfc4a8e,_0x327171){_0x327171(null,path['join'](config['root'],_0x5d5e('0x2a')));},'filename':function(_0x4a27e9,_0x185764,_0x3d339b){_0x3d339b(null,util[_0x5d5e('0x25')](_0x5d5e('0x26'),Date[_0x5d5e('0x27')](),_0x185764['originalname']));}})});router[_0x5d5e('0x1e')]('/:id/customer_avatar',upload[_0x5d5e('0x28')](_0x5d5e('0x29')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x5d5e('0x22')]({'destination':function(_0x5e56a4,_0x3e0fe9,_0x22ad28){_0x22ad28(null,path[_0x5d5e('0x2c')](config[_0x5d5e('0x23')],_0x5d5e('0x2a')));},'filename':function(_0x1b4762,_0x4fc640,_0x5a128f){_0x5a128f(null,util[_0x5d5e('0x25')]('%s-%s',Date[_0x5d5e('0x27')](),_0x4fc640[_0x5d5e('0x2b')]));}})});router[_0x5d5e('0x1e')](_0x5d5e('0x13'),upload['single'](_0x5d5e('0x29')),controller[_0x5d5e('0x2d')]);router[_0x5d5e('0x1e')]('/:id/notify',controller[_0x5d5e('0x2e')]);const offlineUploadMulter=multer({'storage':multer[_0x5d5e('0x22')]({'destination':function(_0x330423,_0x3603d1,_0x26ffe5){const _0xfe3215=path['join'](config['root'],_0x5d5e('0x2f'),_0x5d5e('0x30'),'offline-chat');fs_extra[_0x5d5e('0x31')](_0xfe3215,function(){_0x26ffe5(null,_0xfe3215);});},'filename':function(_0x3a7411,_0x1fd8cd,_0x2e0fc7){const _0x533b63=_0x1fd8cd['originalname'][_0x5d5e('0x32')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x690409=path['extname'](_0x533b63);const _0x469ea8=Date['now']()+'-'+_0x533b63[_0x5d5e('0x32')](_0x690409,'')+_0x690409;_0x2e0fc7(null,_0x469ea8);}})});router[_0x5d5e('0x1e')](_0x5d5e('0x33'),offlineUploadMulter['any'](),controller[_0x5d5e('0x34')]);router[_0x5d5e('0x1e')](_0x5d5e('0x35'),auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x36')]);router['post']('/:id/applications',auth[_0x5d5e('0x6')](),controller['addApplications']);router[_0x5d5e('0x1e')](_0x5d5e('0x18'),auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x37')]);router[_0x5d5e('0x1e')]('/:id/users',auth[_0x5d5e('0x6')](),controller['addAgents']);router['put'](_0x5d5e('0x9'),auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x38')]);router[_0x5d5e('0x39')](_0x5d5e('0x9'),auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x3a')]);router[_0x5d5e('0x39')](_0x5d5e('0xb'),auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x3b')]);router[_0x5d5e('0x39')](_0x5d5e('0xd'),auth['isAuthenticated'](),controller[_0x5d5e('0x3c')]);router[_0x5d5e('0x39')]('/:id/users',auth[_0x5d5e('0x6')](),controller[_0x5d5e('0x3d')]);module[_0x5d5e('0x3e')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index d40e92a..5e7648c 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 _0xdd18=['get','expressEndpoint','/client-logs','isAuthenticated','exports','express','../components/auth/service','../config/environment','Router','env','app'];(function(_0x181cc8,_0x2dd891){var _0x41a5fc=function(_0x42fc1a){while(--_0x42fc1a){_0x181cc8['push'](_0x181cc8['shift']());}};_0x41a5fc(++_0x2dd891);}(_0xdd18,0x10d));var _0x8dd1=function(_0x12a5c7,_0x5b43ff){_0x12a5c7=_0x12a5c7-0x0;var _0x2b07bf=_0xdd18[_0x12a5c7];return _0x2b07bf;};var beaverLogger=require('beaver-logger/server');var express=require(_0x8dd1('0x0'));var auth=require(_0x8dd1('0x1'));var config=require(_0x8dd1('0x2'));var router=express[_0x8dd1('0x3')]();var isProduction=config[_0x8dd1('0x4')]==='production'||![];function clientSideLogs(_0x3c0f77,_0x4e75e6,_0x5a50d1){var _0x1ce4b1=_0x3c0f77[_0x8dd1('0x5')][_0x8dd1('0x6')]('client-side-logger');if(!_0x1ce4b1){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x8dd1('0x7')]({'uri':_0x8dd1('0x8'),'logger':_0x1ce4b1,'enableCors':!isProduction})(_0x3c0f77,_0x4e75e6,_0x5a50d1);}router['use'](auth[_0x8dd1('0x9')](),clientSideLogs);module[_0x8dd1('0xa')]=router; \ No newline at end of file +var _0xb69e=['expressEndpoint','/client-logs','exports','beaver-logger/server','express','../components/auth/service','Router','env','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb69e,0x1ed));var _0xeb69=function(_0x471957,_0xfba279){_0x471957=_0x471957-0x0;var _0x3a403c=_0xb69e[_0x471957];return _0x3a403c;};var beaverLogger=require(_0xeb69('0x0'));var express=require(_0xeb69('0x1'));var auth=require(_0xeb69('0x2'));var config=require('../config/environment');var router=express[_0xeb69('0x3')]();var isProduction=config[_0xeb69('0x4')]==='production'||![];function clientSideLogs(_0x23cad5,_0x2ebab8,_0x55230f){var _0x4f4501=_0x23cad5['app']['get'](_0xeb69('0x5'));if(!_0x4f4501){throw new Error(_0xeb69('0x6'));}return beaverLogger[_0xeb69('0x7')]({'uri':_0xeb69('0x8'),'logger':_0x4f4501,'enableCors':!isProduction})(_0x23cad5,_0x2ebab8,_0x55230f);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0xeb69('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 346b523..71fdbb0 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 _0x88af=['STRING','AmazonAWS','Google','MicrosoftAzure','ENUM','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports'];(function(_0x3cf61b,_0x150a07){var _0x1f7aee=function(_0x4f7f1c){while(--_0x4f7f1c){_0x3cf61b['push'](_0x3cf61b['shift']());}};_0x1f7aee(++_0x150a07);}(_0x88af,0xdf));var _0xf88a=function(_0x1af482,_0x1af5b7){_0x1af482=_0x1af482-0x0;var _0x7e7580=_0x88af[_0x1af482];return _0x7e7580;};'use strict';var Sequelize=require('sequelize');module[_0xf88a('0x0')]={'name':{'type':Sequelize[_0xf88a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xf88a('0x2'),_0xf88a('0x3'),_0xf88a('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xf88a('0x5')]('Outlook365',_0xf88a('0x6'))},'data1':{'type':Sequelize[_0xf88a('0x1')],'comment':_0xf88a('0x7')},'data2':{'type':Sequelize['STRING'],'comment':_0xf88a('0x8')},'data3':{'type':Sequelize[_0xf88a('0x1')],'comment':_0xf88a('0x9')},'data4':{'type':Sequelize[_0xf88a('0x1')],'comment':_0xf88a('0xa')},'data5':{'type':Sequelize[_0xf88a('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xf88a('0xb')],'comment':_0xf88a('0xc')},'data7':{'type':Sequelize['TEXT'],'comment':_0xf88a('0xd')}}; \ No newline at end of file +var _0x2404=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','STRING','AmazonAWS','MicrosoftAzure','ENUM','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0xa31422,_0x5d62b4){var _0x2a465c=function(_0x422732){while(--_0x422732){_0xa31422['push'](_0xa31422['shift']());}};_0x2a465c(++_0x5d62b4);}(_0x2404,0x1b1));var _0x4240=function(_0x160c96,_0x414016){_0x160c96=_0x160c96-0x0;var _0x56f2f5=_0x2404[_0x160c96];return _0x56f2f5;};'use strict';var Sequelize=require(_0x4240('0x0'));module['exports']={'name':{'type':Sequelize[_0x4240('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x4240('0x2'),'Google',_0x4240('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x4240('0x4')]('Outlook365',_0x4240('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0x4240('0x6')},'data2':{'type':Sequelize['STRING'],'comment':_0x4240('0x7')},'data3':{'type':Sequelize[_0x4240('0x1')],'comment':_0x4240('0x8')},'data4':{'type':Sequelize[_0x4240('0x1')],'comment':_0x4240('0x9')},'data5':{'type':Sequelize[_0x4240('0xa')],'comment':_0x4240('0xb')},'data6':{'type':Sequelize[_0x4240('0xa')],'comment':_0x4240('0xc')},'data7':{'type':Sequelize[_0x4240('0xa')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index b01735f..edeaa89 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 _0xc6c5=['VIRTUAL','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','length','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','create','find','encryptString','oauth2MicrosoftAuthorize','findOne','sendStatus','generateMicrosoftAuthorizationUrl','user','get','Invalid\x20state\x20parameter','parse','toString','isValidIdToken','id_token','oauth2Claims','getOauth2MicrosoftAccessToken','code','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','padEnd','index','map','CloudProvider','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type'];(function(_0xcaffe3,_0x1dea08){var _0x22b738=function(_0x1f5e54){while(--_0x1f5e54){_0xcaffe3['push'](_0xcaffe3['shift']());}};_0x22b738(++_0x1dea08);}(_0xc6c5,0xec));var _0x5c6c=function(_0x3c97de,_0x2c4098){_0x3c97de=_0x3c97de-0x0;var _0x49c77a=_0xc6c5[_0x3c97de];return _0x49c77a;};'use strict';var _=require('lodash');var Redis=require(_0x5c6c('0x0'));var qs=require(_0x5c6c('0x1'));var encryptor=require(_0x5c6c('0x2'));var config=require(_0x5c6c('0x3'));var logger=require('../../config/logger')(_0x5c6c('0x4'));var db=require(_0x5c6c('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x5c6c('0x6')]=_[_0x5c6c('0x7')](config[_0x5c6c('0x6')],{'host':_0x5c6c('0x8'),'port':0x18eb});var socket=require(_0x5c6c('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0x5c6c('0x6')]);function respondWithStatusCode(_0x205d2d,_0x1c7768){_0x1c7768=_0x1c7768||0xcc;return function(_0x5d9a7c){if(_0x5d9a7c){return _0x205d2d['sendStatus'](_0x1c7768);}return _0x205d2d[_0x5c6c('0xa')](_0x1c7768)[_0x5c6c('0xb')]();};}function respondWithResult(_0x259df2,_0xf72841){_0xf72841=_0xf72841||0xc8;return function(_0x436df2){if(_0x436df2){return _0x259df2[_0x5c6c('0xa')](_0xf72841)[_0x5c6c('0xc')](_0x436df2);}};}function respondWithFilteredResult(_0x3e0764,_0x39b0c2){return function(_0x36dea4){if(_0x36dea4){var _0x47b102=typeof _0x39b0c2[_0x5c6c('0xd')]===_0x5c6c('0xe')&&typeof _0x39b0c2[_0x5c6c('0xf')]===_0x5c6c('0xe');var _0x3ec51f=_0x36dea4[_0x5c6c('0x10')];var _0x28d3da=_0x47b102?0x0:_0x39b0c2[_0x5c6c('0xd')];var _0x2e468c=_0x47b102?_0x36dea4[_0x5c6c('0x10')]:_0x39b0c2[_0x5c6c('0xd')]+_0x39b0c2[_0x5c6c('0xf')];var _0x4afbeb;if(_0x2e468c>=_0x3ec51f){_0x2e468c=_0x3ec51f;_0x4afbeb=0xc8;}else{_0x4afbeb=0xce;}_0x3e0764[_0x5c6c('0xa')](_0x4afbeb);return _0x3e0764[_0x5c6c('0x11')](_0x5c6c('0x12'),_0x28d3da+'-'+_0x2e468c+'/'+_0x3ec51f)[_0x5c6c('0xc')](_0x36dea4);}return null;};}function saveUpdates(_0x520532){return function(_0x2db51f){if(_0x2db51f){return _0x2db51f[_0x5c6c('0x13')](_0x520532)['then'](function(_0x1ba0c7){return _0x1ba0c7;});}return null;};}function removeEntity(_0x5a7e40){return function(_0x3671ba){if(_0x3671ba){return _0x3671ba[_0x5c6c('0x14')]()[_0x5c6c('0x15')](function(){_0x5a7e40['status'](0xcc)[_0x5c6c('0xb')]();});}};}function handleEntityNotFound(_0x206031){return function(_0x589df8){if(!_0x589df8){_0x206031['sendStatus'](0x194);}return _0x589df8;};}function handleError(_0x1cd421,_0x2bc1cc){_0x2bc1cc=_0x2bc1cc||0x1f4;return function(_0x30ff6e){logger[_0x5c6c('0x16')](_0x30ff6e[_0x5c6c('0x17')]);if(_0x30ff6e['name']){delete _0x30ff6e[_0x5c6c('0x18')];}_0x1cd421[_0x5c6c('0xa')](_0x2bc1cc)['send'](_0x30ff6e);};}function maskClientSecret(_0x3425cd){return _[_0x5c6c('0x19')](_0x3425cd['slice'](0x0,0x3),0x14,'*');}exports[_0x5c6c('0x1a')]=function(_0x5bbf0c,_0x3ffb1e){var _0x5123ce={},_0x4ab5ed={},_0x4ce2b6={'count':0x0,'rows':[]};var _0x288478=_[_0x5c6c('0x1b')](db[_0x5c6c('0x1c')][_0x5c6c('0x1d')],function(_0x22c2fd){return{'name':_0x22c2fd['fieldName'],'type':_0x22c2fd['type'][_0x5c6c('0x1e')]};});_0x4ab5ed[_0x5c6c('0x1f')]=_[_0x5c6c('0x1b')](_0x288478,_0x5c6c('0x18'));_0x4ab5ed[_0x5c6c('0x20')]=_[_0x5c6c('0x21')](_0x5bbf0c[_0x5c6c('0x20')]);_0x4ab5ed[_0x5c6c('0x22')]=_['intersection'](_0x4ab5ed[_0x5c6c('0x1f')],_0x4ab5ed[_0x5c6c('0x20')]);_0x5123ce[_0x5c6c('0x23')]=_[_0x5c6c('0x24')](_0x4ab5ed[_0x5c6c('0x1f')],qs[_0x5c6c('0x25')](_0x5bbf0c[_0x5c6c('0x20')][_0x5c6c('0x25')]));_0x5123ce['attributes']=_0x5123ce['attributes']['length']?_0x5123ce[_0x5c6c('0x23')]:_0x4ab5ed[_0x5c6c('0x1f')];if(!_0x5bbf0c[_0x5c6c('0x20')][_0x5c6c('0x26')](_0x5c6c('0x27'))){_0x5123ce[_0x5c6c('0xf')]=qs[_0x5c6c('0xf')](_0x5bbf0c[_0x5c6c('0x20')]['limit']);_0x5123ce[_0x5c6c('0xd')]=qs[_0x5c6c('0xd')](_0x5bbf0c[_0x5c6c('0x20')][_0x5c6c('0xd')]);}_0x5123ce[_0x5c6c('0x28')]=qs[_0x5c6c('0x29')](_0x5bbf0c['query'][_0x5c6c('0x29')]);_0x5123ce[_0x5c6c('0x2a')]=qs[_0x5c6c('0x22')](_['pick'](_0x5bbf0c[_0x5c6c('0x20')],_0x4ab5ed[_0x5c6c('0x22')]),_0x288478);if(_0x5bbf0c[_0x5c6c('0x20')][_0x5c6c('0x2b')]){_0x5123ce['where']=_[_0x5c6c('0x2c')](_0x5123ce[_0x5c6c('0x2a')],{'$or':_[_0x5c6c('0x1b')](_0x288478,function(_0x13da5f){if(_0x13da5f[_0x5c6c('0x2d')]!==_0x5c6c('0x2e')){var _0x49e11f={};_0x49e11f[_0x13da5f[_0x5c6c('0x18')]]={'$like':'%'+_0x5bbf0c[_0x5c6c('0x20')][_0x5c6c('0x2b')]+'%'};return _0x49e11f;}})});}_0x5123ce=_[_0x5c6c('0x2c')]({},_0x5123ce,_0x5bbf0c[_0x5c6c('0x2f')]);var _0x21b9c8={'where':_0x5123ce[_0x5c6c('0x2a')]};return db[_0x5c6c('0x1c')][_0x5c6c('0x10')](_0x21b9c8)[_0x5c6c('0x15')](function(_0x418ec5){_0x4ce2b6[_0x5c6c('0x10')]=_0x418ec5;if(_0x5bbf0c[_0x5c6c('0x20')][_0x5c6c('0x30')]){_0x5123ce[_0x5c6c('0x31')]=[{'all':!![]}];}return db[_0x5c6c('0x1c')][_0x5c6c('0x32')](_0x5123ce);})[_0x5c6c('0x15')](function(_0x10ba61){_0x4ce2b6[_0x5c6c('0x33')]=_[_0x5c6c('0x1b')](_0x10ba61,function(_0x59edca){if(_0x59edca[_0x5c6c('0x34')]===_0x5c6c('0x35')){var _0xaa72da=encryptor[_0x5c6c('0x36')](_0x59edca[_0x5c6c('0x37')]);_0x59edca[_0x5c6c('0x37')]=maskClientSecret(_0xaa72da);}return _0x59edca;});return _0x4ce2b6;})[_0x5c6c('0x15')](respondWithFilteredResult(_0x3ffb1e,_0x5123ce))[_0x5c6c('0x38')](handleError(_0x3ffb1e,null));};exports[_0x5c6c('0x39')]=function(_0x53c840,_0x222e71){var _0x1fa10f={'raw':!![],'where':{'id':_0x53c840[_0x5c6c('0x3a')]['id']}},_0x29ec3f={};_0x29ec3f[_0x5c6c('0x1f')]=_[_0x5c6c('0x21')](db[_0x5c6c('0x1c')]['rawAttributes']);_0x29ec3f[_0x5c6c('0x20')]=_[_0x5c6c('0x21')](_0x53c840['query']);_0x29ec3f[_0x5c6c('0x22')]=_[_0x5c6c('0x24')](_0x29ec3f[_0x5c6c('0x1f')],_0x29ec3f[_0x5c6c('0x20')]);_0x1fa10f['attributes']=_['intersection'](_0x29ec3f[_0x5c6c('0x1f')],qs[_0x5c6c('0x25')](_0x53c840[_0x5c6c('0x20')][_0x5c6c('0x25')]));_0x1fa10f[_0x5c6c('0x23')]=_0x1fa10f['attributes'][_0x5c6c('0x3b')]?_0x1fa10f[_0x5c6c('0x23')]:_0x29ec3f[_0x5c6c('0x1f')];if(_0x53c840[_0x5c6c('0x20')]['includeAll']){_0x1fa10f[_0x5c6c('0x31')]=[{'all':!![]}];}_0x1fa10f=_['merge']({},_0x1fa10f,_0x53c840[_0x5c6c('0x2f')]);return db[_0x5c6c('0x1c')]['find'](_0x1fa10f)[_0x5c6c('0x15')](handleEntityNotFound(_0x222e71,null))['then'](function(_0x4e99cb){if(_0x4e99cb[_0x5c6c('0x34')]===_0x5c6c('0x35')){var _0x2f44d6=encryptor[_0x5c6c('0x36')](_0x4e99cb['data3']);_0x4e99cb[_0x5c6c('0x37')]=maskClientSecret(_0x2f44d6);}return _0x4e99cb;})[_0x5c6c('0x15')](respondWithResult(_0x222e71,null))[_0x5c6c('0x38')](handleError(_0x222e71,null));};exports['create']=function(_0x3b004d,_0x3547a0){if(!_0x3b004d[_0x5c6c('0x3c')]['name'])throw new Error(_0x5c6c('0x3d'));if(!_0x3b004d['body'][_0x5c6c('0x34')])throw new Error(_0x5c6c('0x3e'));var _0x5b81df=db['CloudProvider']['rawAttributes'][_0x5c6c('0x34')][_0x5c6c('0x3f')];if(!_0x5b81df['includes'](_0x3b004d[_0x5c6c('0x3c')]['service']))throw new Error(_0x5c6c('0x40')+_0x5b81df[_0x5c6c('0x41')](',\x20'));if(_0x3b004d[_0x5c6c('0x3c')]['service']===_0x5c6c('0x35')&&_0x3b004d['body'][_0x5c6c('0x37')]){_0x3b004d[_0x5c6c('0x3c')][_0x5c6c('0x37')]=encryptor['encryptString'](_0x3b004d['body'][_0x5c6c('0x37')]);}return db[_0x5c6c('0x1c')][_0x5c6c('0x42')](_0x3b004d[_0x5c6c('0x3c')],{})[_0x5c6c('0x15')](respondWithResult(_0x3547a0,0xc9))[_0x5c6c('0x38')](handleError(_0x3547a0,null));};exports[_0x5c6c('0x13')]=function(_0x4ffd60,_0x49fd04){if(_0x4ffd60[_0x5c6c('0x3c')]['id']){delete _0x4ffd60[_0x5c6c('0x3c')]['id'];}return db[_0x5c6c('0x1c')][_0x5c6c('0x43')]({'where':{'id':_0x4ffd60[_0x5c6c('0x3a')]['id']}})[_0x5c6c('0x15')](handleEntityNotFound(_0x49fd04,null))[_0x5c6c('0x15')](function(_0x4055db){if(_0x4055db[_0x5c6c('0x34')]==='MicrosoftAzure'&&_0x4ffd60[_0x5c6c('0x3c')][_0x5c6c('0x37')]){_0x4ffd60[_0x5c6c('0x3c')][_0x5c6c('0x37')]=encryptor[_0x5c6c('0x44')](_0x4ffd60[_0x5c6c('0x3c')][_0x5c6c('0x37')]);}return _0x4055db;})[_0x5c6c('0x15')](saveUpdates(_0x4ffd60[_0x5c6c('0x3c')],null))[_0x5c6c('0x15')](respondWithResult(_0x49fd04,null))[_0x5c6c('0x38')](handleError(_0x49fd04,null));};exports[_0x5c6c('0x14')]=function(_0x2ec252,_0x4d036f){return db[_0x5c6c('0x1c')][_0x5c6c('0x43')]({'where':{'id':_0x2ec252[_0x5c6c('0x3a')]['id']}})[_0x5c6c('0x15')](handleEntityNotFound(_0x4d036f,null))[_0x5c6c('0x15')](removeEntity(_0x4d036f,null))[_0x5c6c('0x38')](handleError(_0x4d036f,null));};exports[_0x5c6c('0x45')]=function(_0xef4851,_0x13127c){return db[_0x5c6c('0x1c')][_0x5c6c('0x46')]({'where':{'id':_0xef4851[_0x5c6c('0x3a')]['id']},'raw':!![]})[_0x5c6c('0x15')](function(_0x2c6395){if(!_0x2c6395)return _0x13127c[_0x5c6c('0x47')](0x194);return{'url':oauth[_0x5c6c('0x48')](_0x2c6395,_0xef4851[_0x5c6c('0x49')]['id'])};})[_0x5c6c('0x15')](respondWithResult(_0x13127c,null))['catch'](handleError(_0x13127c,null));};exports['oauth2MicrosoftCallback']=function(_0x2837bf,_0x101d1f){var _0x2bc8d8=_0x2837bf[_0x5c6c('0x3c')];var _0x54f971;var _0x547978;if(_0x2bc8d8[_0x5c6c('0x16')])throw _0x2bc8d8;redis[_0x5c6c('0x4a')](_0x2bc8d8['state'])['then'](function(_0x47a7b1){if(!_0x47a7b1)throw new Error(_0x5c6c('0x4b'));_0x54f971=JSON[_0x5c6c('0x4c')](_0x47a7b1);var _0x179b95=Buffer['from'](_0x2bc8d8['state'],'base64')[_0x5c6c('0x4d')]('ascii');_0x547978=JSON[_0x5c6c('0x4c')](_0x179b95);if(!oauth[_0x5c6c('0x4e')](_0x2bc8d8[_0x5c6c('0x4f')],_0x54f971[_0x5c6c('0x50')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x2bc8d8['state']);return oauth[_0x5c6c('0x51')](_0x2bc8d8[_0x5c6c('0x52')],_0x54f971);})[_0x5c6c('0x15')](function(_0x1d5298){_0x54f971['data5']=_0x1d5298['access_token'];_0x54f971[_0x5c6c('0x53')]=_0x1d5298[_0x5c6c('0x54')];return db['CloudProvider'][_0x5c6c('0x13')]({'data5':_0x54f971[_0x5c6c('0x55')],'data6':_0x54f971[_0x5c6c('0x53')]},{'where':{'id':_0x54f971['id']}});})[_0x5c6c('0x15')](function(){oauth[_0x5c6c('0x56')](_0x54f971);socket[_0x5c6c('0x57')](_0x5c6c('0x58'),{'id':_0x547978['id']});return;})[_0x5c6c('0x15')](respondWithStatusCode(_0x101d1f,null))[_0x5c6c('0x38')](function(_0xcc9e64){if(_0x547978){socket[_0x5c6c('0x57')](_0x5c6c('0x59'),{'id':_0x547978['id']});}if(!_0x54f971){logger['error'](_0x5c6c('0x5a'),_0xcc9e64);return _0x101d1f[_0x5c6c('0xa')](0x1f4)[_0x5c6c('0x5b')](_0xcc9e64[_0x5c6c('0x5c')]);}logger[_0x5c6c('0x16')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x54f971['id'],JSON[_0x5c6c('0x5d')](_0xcc9e64));});}; \ No newline at end of file +var _0x32f8=['fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','CloudProvider','count','includeAll','include','rows','service','data3','catch','show','params','intersection','find','MicrosoftAzure','decryptString','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','join','encryptString','destroy','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','from','base64','toString','ascii','parse','id_token','Unable\x20to\x20validate\x20id_token','del','state','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','microsoftAuthorization:success','emit','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','json','undefined','offset','limit','set','Content-Range','update','then','end','error','name','padEnd','slice','index','map','rawAttributes'];(function(_0x1c5d89,_0x32d5bf){var _0x2361c3=function(_0x201b5c){while(--_0x201b5c){_0x1c5d89['push'](_0x1c5d89['shift']());}};_0x2361c3(++_0x32d5bf);}(_0x32f8,0x107));var _0x832f=function(_0x1d05b7,_0x655cf0){_0x1d05b7=_0x1d05b7-0x0;var _0x3b5763=_0x32f8[_0x1d05b7];return _0x3b5763;};'use strict';var _=require(_0x832f('0x0'));var Redis=require(_0x832f('0x1'));var qs=require(_0x832f('0x2'));var encryptor=require(_0x832f('0x3'));var config=require('../../config/environment');var logger=require(_0x832f('0x4'))(_0x832f('0x5'));var db=require(_0x832f('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x832f('0x7')]=_[_0x832f('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x832f('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0x832f('0x7')]);function respondWithStatusCode(_0x176e43,_0x48727c){_0x48727c=_0x48727c||0xcc;return function(_0x5b91b5){if(_0x5b91b5){return _0x176e43[_0x832f('0xa')](_0x48727c);}return _0x176e43[_0x832f('0xb')](_0x48727c)['end']();};}function respondWithResult(_0x336bac,_0x38f2db){_0x38f2db=_0x38f2db||0xc8;return function(_0x4106c7){if(_0x4106c7){return _0x336bac[_0x832f('0xb')](_0x38f2db)[_0x832f('0xc')](_0x4106c7);}};}function respondWithFilteredResult(_0x52222a,_0x34e00a){return function(_0x2aca13){if(_0x2aca13){var _0x265731=typeof _0x34e00a['offset']==='undefined'&&typeof _0x34e00a['limit']===_0x832f('0xd');var _0x4845dd=_0x2aca13['count'];var _0xd9ae5a=_0x265731?0x0:_0x34e00a[_0x832f('0xe')];var _0x5eb5d7=_0x265731?_0x2aca13['count']:_0x34e00a['offset']+_0x34e00a[_0x832f('0xf')];var _0x456e25;if(_0x5eb5d7>=_0x4845dd){_0x5eb5d7=_0x4845dd;_0x456e25=0xc8;}else{_0x456e25=0xce;}_0x52222a['status'](_0x456e25);return _0x52222a[_0x832f('0x10')](_0x832f('0x11'),_0xd9ae5a+'-'+_0x5eb5d7+'/'+_0x4845dd)[_0x832f('0xc')](_0x2aca13);}return null;};}function saveUpdates(_0xf6a5a){return function(_0xfe45a9){if(_0xfe45a9){return _0xfe45a9[_0x832f('0x12')](_0xf6a5a)[_0x832f('0x13')](function(_0x1ff1fd){return _0x1ff1fd;});}return null;};}function removeEntity(_0x22dc23){return function(_0x2fffc0){if(_0x2fffc0){return _0x2fffc0['destroy']()[_0x832f('0x13')](function(){_0x22dc23['status'](0xcc)[_0x832f('0x14')]();});}};}function handleEntityNotFound(_0x4fccbf){return function(_0x528964){if(!_0x528964){_0x4fccbf[_0x832f('0xa')](0x194);}return _0x528964;};}function handleError(_0x2e8747,_0x3d74b9){_0x3d74b9=_0x3d74b9||0x1f4;return function(_0x27fa94){logger[_0x832f('0x15')](_0x27fa94['stack']);if(_0x27fa94[_0x832f('0x16')]){delete _0x27fa94[_0x832f('0x16')];}_0x2e8747[_0x832f('0xb')](_0x3d74b9)['send'](_0x27fa94);};}function maskClientSecret(_0x346a8c){return _[_0x832f('0x17')](_0x346a8c[_0x832f('0x18')](0x0,0x3),0x14,'*');}exports[_0x832f('0x19')]=function(_0x519fc7,_0x282a18){var _0x3a7629={},_0x31eddb={},_0x2006c3={'count':0x0,'rows':[]};var _0xa70691=_[_0x832f('0x1a')](db['CloudProvider'][_0x832f('0x1b')],function(_0x588b5a){return{'name':_0x588b5a[_0x832f('0x1c')],'type':_0x588b5a[_0x832f('0x1d')][_0x832f('0x1e')]};});_0x31eddb[_0x832f('0x1f')]=_[_0x832f('0x1a')](_0xa70691,_0x832f('0x16'));_0x31eddb[_0x832f('0x20')]=_[_0x832f('0x21')](_0x519fc7[_0x832f('0x20')]);_0x31eddb['filters']=_['intersection'](_0x31eddb[_0x832f('0x1f')],_0x31eddb[_0x832f('0x20')]);_0x3a7629[_0x832f('0x22')]=_['intersection'](_0x31eddb[_0x832f('0x1f')],qs[_0x832f('0x23')](_0x519fc7['query'][_0x832f('0x23')]));_0x3a7629[_0x832f('0x22')]=_0x3a7629[_0x832f('0x22')][_0x832f('0x24')]?_0x3a7629[_0x832f('0x22')]:_0x31eddb[_0x832f('0x1f')];if(!_0x519fc7[_0x832f('0x20')]['hasOwnProperty'](_0x832f('0x25'))){_0x3a7629[_0x832f('0xf')]=qs[_0x832f('0xf')](_0x519fc7[_0x832f('0x20')][_0x832f('0xf')]);_0x3a7629[_0x832f('0xe')]=qs['offset'](_0x519fc7[_0x832f('0x20')][_0x832f('0xe')]);}_0x3a7629[_0x832f('0x26')]=qs[_0x832f('0x27')](_0x519fc7['query'][_0x832f('0x27')]);_0x3a7629[_0x832f('0x28')]=qs['filters'](_[_0x832f('0x29')](_0x519fc7[_0x832f('0x20')],_0x31eddb[_0x832f('0x2a')]),_0xa70691);if(_0x519fc7[_0x832f('0x20')][_0x832f('0x2b')]){_0x3a7629[_0x832f('0x28')]=_[_0x832f('0x2c')](_0x3a7629[_0x832f('0x28')],{'$or':_['map'](_0xa70691,function(_0xfd7ced){if(_0xfd7ced[_0x832f('0x1d')]!==_0x832f('0x2d')){var _0x28b7d3={};_0x28b7d3[_0xfd7ced[_0x832f('0x16')]]={'$like':'%'+_0x519fc7[_0x832f('0x20')]['filter']+'%'};return _0x28b7d3;}})});}_0x3a7629=_[_0x832f('0x2c')]({},_0x3a7629,_0x519fc7[_0x832f('0x2e')]);var _0x59f582={'where':_0x3a7629[_0x832f('0x28')]};return db[_0x832f('0x2f')][_0x832f('0x30')](_0x59f582)[_0x832f('0x13')](function(_0x3dad63){_0x2006c3[_0x832f('0x30')]=_0x3dad63;if(_0x519fc7[_0x832f('0x20')][_0x832f('0x31')]){_0x3a7629[_0x832f('0x32')]=[{'all':!![]}];}return db[_0x832f('0x2f')]['findAll'](_0x3a7629);})[_0x832f('0x13')](function(_0x53f8dd){_0x2006c3[_0x832f('0x33')]=_[_0x832f('0x1a')](_0x53f8dd,function(_0x250d2c){if(_0x250d2c[_0x832f('0x34')]==='MicrosoftAzure'){var _0x56b433=encryptor['decryptString'](_0x250d2c[_0x832f('0x35')]);_0x250d2c[_0x832f('0x35')]=maskClientSecret(_0x56b433);}return _0x250d2c;});return _0x2006c3;})[_0x832f('0x13')](respondWithFilteredResult(_0x282a18,_0x3a7629))[_0x832f('0x36')](handleError(_0x282a18,null));};exports[_0x832f('0x37')]=function(_0x45ac6d,_0x72a384){var _0xe83d6f={'raw':!![],'where':{'id':_0x45ac6d[_0x832f('0x38')]['id']}},_0x341ed8={};_0x341ed8[_0x832f('0x1f')]=_[_0x832f('0x21')](db[_0x832f('0x2f')]['rawAttributes']);_0x341ed8[_0x832f('0x20')]=_[_0x832f('0x21')](_0x45ac6d['query']);_0x341ed8[_0x832f('0x2a')]=_[_0x832f('0x39')](_0x341ed8[_0x832f('0x1f')],_0x341ed8['query']);_0xe83d6f['attributes']=_[_0x832f('0x39')](_0x341ed8[_0x832f('0x1f')],qs[_0x832f('0x23')](_0x45ac6d['query']['fields']));_0xe83d6f[_0x832f('0x22')]=_0xe83d6f[_0x832f('0x22')][_0x832f('0x24')]?_0xe83d6f[_0x832f('0x22')]:_0x341ed8[_0x832f('0x1f')];if(_0x45ac6d[_0x832f('0x20')][_0x832f('0x31')]){_0xe83d6f['include']=[{'all':!![]}];}_0xe83d6f=_[_0x832f('0x2c')]({},_0xe83d6f,_0x45ac6d['options']);return db['CloudProvider'][_0x832f('0x3a')](_0xe83d6f)[_0x832f('0x13')](handleEntityNotFound(_0x72a384,null))['then'](function(_0x364615){if(_0x364615[_0x832f('0x34')]===_0x832f('0x3b')){var _0x1f9ab2=encryptor[_0x832f('0x3c')](_0x364615['data3']);_0x364615[_0x832f('0x35')]=maskClientSecret(_0x1f9ab2);}return _0x364615;})['then'](respondWithResult(_0x72a384,null))[_0x832f('0x36')](handleError(_0x72a384,null));};exports[_0x832f('0x3d')]=function(_0x492d4a,_0x3b3a10){if(!_0x492d4a[_0x832f('0x3e')][_0x832f('0x16')])throw new Error(_0x832f('0x3f'));if(!_0x492d4a['body']['service'])throw new Error(_0x832f('0x40'));var _0x22c836=db['CloudProvider']['rawAttributes'][_0x832f('0x34')]['values'];if(!_0x22c836[_0x832f('0x41')](_0x492d4a[_0x832f('0x3e')][_0x832f('0x34')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x22c836[_0x832f('0x42')](',\x20'));if(_0x492d4a[_0x832f('0x3e')][_0x832f('0x34')]===_0x832f('0x3b')&&_0x492d4a[_0x832f('0x3e')][_0x832f('0x35')]){_0x492d4a[_0x832f('0x3e')][_0x832f('0x35')]=encryptor[_0x832f('0x43')](_0x492d4a[_0x832f('0x3e')][_0x832f('0x35')]);}return db[_0x832f('0x2f')][_0x832f('0x3d')](_0x492d4a['body'],{})[_0x832f('0x13')](respondWithResult(_0x3b3a10,0xc9))[_0x832f('0x36')](handleError(_0x3b3a10,null));};exports[_0x832f('0x12')]=function(_0x219760,_0x4beeab){if(_0x219760['body']['id']){delete _0x219760[_0x832f('0x3e')]['id'];}return db[_0x832f('0x2f')][_0x832f('0x3a')]({'where':{'id':_0x219760[_0x832f('0x38')]['id']}})[_0x832f('0x13')](handleEntityNotFound(_0x4beeab,null))[_0x832f('0x13')](function(_0x237fe6){if(_0x237fe6[_0x832f('0x34')]===_0x832f('0x3b')&&_0x219760['body'][_0x832f('0x35')]){_0x219760[_0x832f('0x3e')][_0x832f('0x35')]=encryptor[_0x832f('0x43')](_0x219760[_0x832f('0x3e')][_0x832f('0x35')]);}return _0x237fe6;})[_0x832f('0x13')](saveUpdates(_0x219760[_0x832f('0x3e')],null))[_0x832f('0x13')](respondWithResult(_0x4beeab,null))[_0x832f('0x36')](handleError(_0x4beeab,null));};exports[_0x832f('0x44')]=function(_0x1ae146,_0x557c72){return db[_0x832f('0x2f')]['find']({'where':{'id':_0x1ae146['params']['id']}})[_0x832f('0x13')](handleEntityNotFound(_0x557c72,null))[_0x832f('0x13')](removeEntity(_0x557c72,null))[_0x832f('0x36')](handleError(_0x557c72,null));};exports[_0x832f('0x45')]=function(_0x1f1e80,_0x4b95b6){return db[_0x832f('0x2f')]['findOne']({'where':{'id':_0x1f1e80['params']['id']},'raw':!![]})[_0x832f('0x13')](function(_0x2708d1){if(!_0x2708d1)return _0x4b95b6['sendStatus'](0x194);return{'url':oauth[_0x832f('0x46')](_0x2708d1,_0x1f1e80[_0x832f('0x47')]['id'])};})[_0x832f('0x13')](respondWithResult(_0x4b95b6,null))['catch'](handleError(_0x4b95b6,null));};exports[_0x832f('0x48')]=function(_0x30e9e2,_0x4b76bd){var _0x22c185=_0x30e9e2[_0x832f('0x3e')];var _0x57d21d;var _0x3c90fa;if(_0x22c185[_0x832f('0x15')])throw _0x22c185;redis[_0x832f('0x49')](_0x22c185['state'])[_0x832f('0x13')](function(_0x264c54){if(!_0x264c54)throw new Error(_0x832f('0x4a'));_0x57d21d=JSON['parse'](_0x264c54);var _0x537d03=Buffer[_0x832f('0x4b')](_0x22c185['state'],_0x832f('0x4c'))[_0x832f('0x4d')](_0x832f('0x4e'));_0x3c90fa=JSON[_0x832f('0x4f')](_0x537d03);if(!oauth['isValidIdToken'](_0x22c185[_0x832f('0x50')],_0x57d21d['oauth2Claims']))throw new Error(_0x832f('0x51'));redis[_0x832f('0x52')](_0x22c185[_0x832f('0x53')]);return oauth[_0x832f('0x54')](_0x22c185[_0x832f('0x55')],_0x57d21d);})['then'](function(_0x4c6cf6){_0x57d21d[_0x832f('0x56')]=_0x4c6cf6[_0x832f('0x57')];_0x57d21d[_0x832f('0x58')]=_0x4c6cf6[_0x832f('0x59')];return db['CloudProvider'][_0x832f('0x12')]({'data5':_0x57d21d[_0x832f('0x56')],'data6':_0x57d21d[_0x832f('0x58')]},{'where':{'id':_0x57d21d['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x57d21d);socket['emit'](_0x832f('0x5a'),{'id':_0x3c90fa['id']});return;})['then'](respondWithStatusCode(_0x4b76bd,null))[_0x832f('0x36')](function(_0x215c37){if(_0x3c90fa){socket[_0x832f('0x5b')]('microsoftAuthorization:error',{'id':_0x3c90fa['id']});}if(!_0x57d21d){logger[_0x832f('0x15')](_0x832f('0x5c'),_0x215c37);return _0x4b76bd['status'](0x1f4)[_0x832f('0x5d')](_0x215c37[_0x832f('0x5e')]);}logger[_0x832f('0x15')](_0x832f('0x5f'),_0x57d21d['id'],JSON[_0x832f('0x60')](_0x215c37));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index a4808b4..acfeefe 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 _0xc480=['bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','../../config/logger','api'];(function(_0x49ab57,_0x5e5fc9){var _0x32c892=function(_0xc949bb){while(--_0xc949bb){_0x49ab57['push'](_0x49ab57['shift']());}};_0x32c892(++_0x5e5fc9);}(_0xc480,0x1c5));var _0x0c48=function(_0x376243,_0x17d96d){_0x376243=_0x376243-0x0;var _0x22edcc=_0xc480[_0x376243];return _0x22edcc;};'use strict';var _=require(_0x0c48('0x0'));var util=require('util');var logger=require(_0x0c48('0x1'))(_0x0c48('0x2'));var moment=require('moment');var BPromise=require(_0x0c48('0x3'));var rp=require(_0x0c48('0x4'));var fs=require('fs');var path=require(_0x0c48('0x5'));var rimraf=require(_0x0c48('0x6'));var config=require(_0x0c48('0x7'));var attributes=require(_0x0c48('0x8'));module['exports']=function(_0x224e5a,_0x75c6cc){return _0x224e5a[_0x0c48('0x9')](_0x0c48('0xa'),attributes,{'tableName':_0x0c48('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd52c=['rimraf','./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','api','moment','request-promise','path'];(function(_0x5d0f5e,_0x3e15c8){var _0x556ddd=function(_0x455428){while(--_0x455428){_0x5d0f5e['push'](_0x5d0f5e['shift']());}};_0x556ddd(++_0x3e15c8);}(_0xd52c,0x1a7));var _0xcd52=function(_0x5ea529,_0xb364a2){_0x5ea529=_0x5ea529-0x0;var _0x42c1af=_0xd52c[_0x5ea529];return _0x42c1af;};'use strict';var _=require(_0xcd52('0x0'));var util=require(_0xcd52('0x1'));var logger=require('../../config/logger')(_0xcd52('0x2'));var moment=require(_0xcd52('0x3'));var BPromise=require('bluebird');var rp=require(_0xcd52('0x4'));var fs=require('fs');var path=require(_0xcd52('0x5'));var rimraf=require(_0xcd52('0x6'));var config=require('../../config/environment');var attributes=require(_0xcd52('0x7'));module[_0xcd52('0x8')]=function(_0x23d7af,_0x961939){return _0x23d7af[_0xcd52('0x9')](_0xcd52('0xa'),attributes,{'tableName':'cloud_providers','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 69a388a..7376f47 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 _0x7698=['decode','payload','iss','aud','audience','nonce','isAfter','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','{TENANT_ID}','data5','access_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','/.default','join','Outlook365','data7','replace','data2','code','id_token','from','toString','base64','hex','client_id','data1','response_type','data4','response_mode','form_post','scope','state','login','key','value','oauth2Claims','oauth2/','stringify'];(function(_0x11d95f,_0x34f442){var _0x2b1a14=function(_0x3a4fa5){while(--_0x3a4fa5){_0x11d95f['push'](_0x11d95f['shift']());}};_0x2b1a14(++_0x34f442);}(_0x7698,0xc0));var _0x8769=function(_0x309ad6,_0x5a02bb){_0x309ad6=_0x309ad6-0x0;var _0x29ba4c=_0x7698[_0x309ad6];return _0x29ba4c;};'use strict';var _=require(_0x8769('0x0'));var crypto=require(_0x8769('0x1'));var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require(_0x8769('0x2'));var rp=require(_0x8769('0x3'));var util=require(_0x8769('0x4'));var encryptor=require(_0x8769('0x5'));var config=require(_0x8769('0x6'));var logger=require(_0x8769('0x7'))(_0x8769('0x8'));var schedule=require(_0x8769('0x9'));var db=require(_0x8769('0xa'))['db'];config['redis']=_['defaults'](config[_0x8769('0xb')],{'host':_0x8769('0xc'),'port':0x18eb});var redis=new Redis(config[_0x8769('0xb')]);var MICROSOFT_AUTH_URL=_0x8769('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x8769('0xe'),'profile',_0x8769('0xf'),_0x8769('0x10'),_0x8769('0x11'),_0x8769('0x12'),_0x8769('0x13')],'Dynamics365':[_0x8769('0xe'),_0x8769('0x10')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x8769('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2f3ece){var _0x188157=_[_0x8769('0x15')](AZURE_AUTH_SCOPES[_0x2f3ece[_0x8769('0x16')]]);if(_0x2f3ece[_0x8769('0x16')]===_0x8769('0x17'))_0x188157[_0x8769('0x18')](_0x2f3ece['data7']+_0x8769('0x19'));return _0x188157[_0x8769('0x1a')]('\x20');}function getAccessTokenScope(_0x41db69){if(_0x41db69[_0x8769('0x16')]===_0x8769('0x1b'))return _0x8769('0x11');if(_0x41db69[_0x8769('0x16')]==='Dynamics365')return _0x41db69[_0x8769('0x1c')]+_0x8769('0x19');}function generateMicrosoftAuthorizationUrl(_0x6e7de9,_0x49d5fb){var _0x4387b4=MICROSOFT_AUTH_URL[_0x8769('0x1d')]('{TENANT_ID}',_0x6e7de9[_0x8769('0x1e')]);var _0x420b6b=[_0x8769('0x1f'),_0x8769('0x20')];var _0x1994aa=Buffer[_0x8769('0x21')](JSON['stringify']({'id':_0x49d5fb}))[_0x8769('0x22')](_0x8769('0x23'));var _0xcc1bb=crypto['randomBytes'](0x10)['toString'](_0x8769('0x24'));var _0x4bfa31=getAuthorizationScopes(_0x6e7de9);var _0x251d85=[{'key':_0x8769('0x25'),'value':_0x6e7de9[_0x8769('0x26')]},{'key':_0x8769('0x27'),'value':encodeURIComponent(_0x420b6b['join']('\x20'))},{'key':'redirect_uri','value':_0x6e7de9[_0x8769('0x28')]},{'key':_0x8769('0x29'),'value':_0x8769('0x2a')},{'key':_0x8769('0x2b'),'value':encodeURIComponent(_0x4bfa31)},{'key':_0x8769('0x2c'),'value':_0x1994aa},{'key':'nonce','value':_0xcc1bb},{'key':'prompt','value':_0x8769('0x2d')}];var _0x673c96=_0x4387b4+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x8769('0x15')](_0x251d85,function(_0x50dce2){return _0x50dce2[_0x8769('0x2e')]+'='+_0x50dce2[_0x8769('0x2f')];})['join']('&');_0x6e7de9[_0x8769('0x30')]={'issuer':_0x4387b4[_0x8769('0x1d')](_0x8769('0x31'),''),'audience':_0x6e7de9['data1'],'state':_0x1994aa,'nonce':_0xcc1bb};redis['set'](_0x1994aa,JSON[_0x8769('0x32')](_0x6e7de9));return _0x673c96;}function isValidIdToken(_0x5dc71f,_0x4d6ac6){try{var _0x54181b=jwt[_0x8769('0x33')](_0x5dc71f,{'complete':!![]});var _0x19b70c=_0x54181b[_0x8769('0x34')];if(_0x19b70c[_0x8769('0x35')]!==_0x4d6ac6['issuer'])return![];if(_0x19b70c[_0x8769('0x36')]!==_0x4d6ac6[_0x8769('0x37')])return![];if(_0x19b70c[_0x8769('0x38')]!==_0x4d6ac6['nonce'])return![];if(moment()[_0x8769('0x39')](moment[_0x8769('0x3a')](_0x19b70c['exp'])))return![];return!![];}catch(_0x167b24){throw _0x167b24;}}function refreshOauth2MicrosoftAccessToken(_0x27ce4f){return Promise[_0x8769('0x3b')]()[_0x8769('0x3c')](function(){if(_0x27ce4f[_0x8769('0x3d')])return _0x27ce4f;return db[_0x8769('0x3e')][_0x8769('0x3f')]({'where':{'id':_0x27ce4f['id']},'raw':!![]});})[_0x8769('0x3c')](function(_0x55cec7){var _0x5a7614={'grant_type':_0x8769('0x40'),'refresh_token':_0x55cec7[_0x8769('0x41')],'scope':getAccessTokenScope(_0x55cec7),'redirect_uri':_0x55cec7[_0x8769('0x28')],'client_id':_0x55cec7[_0x8769('0x26')],'client_secret':encryptor[_0x8769('0x42')](_0x55cec7[_0x8769('0x3d')])};var _0x413d31={'method':_0x8769('0x43'),'uri':MICROSOFT_AUTH_URL[_0x8769('0x1d')](_0x8769('0x44'),_0x55cec7[_0x8769('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5a7614,'json':!![]};return rp(_0x413d31);})[_0x8769('0x3c')](function(_0x56787e){_0x27ce4f[_0x8769('0x45')]=_0x56787e[_0x8769('0x46')];_0x27ce4f['data6']=_0x56787e[_0x8769('0x40')];return db['CloudProvider']['update']({'data5':_0x27ce4f[_0x8769('0x45')],'data6':_0x27ce4f[_0x8769('0x41')]},{'where':{'id':_0x27ce4f['id']}});})[_0x8769('0x3c')](function(){return _0x27ce4f;})[_0x8769('0x47')](function(_0x134b88){logger[_0x8769('0x48')](_0x8769('0x49'),_0x27ce4f['id'],_0x134b88);});}function getOauth2MicrosoftAccessToken(_0x1cbbdf,_0x1800c5){var _0x252f92={'grant_type':_0x8769('0x4a'),'code':_0x1cbbdf,'scope':getAccessTokenScope(_0x1800c5),'redirect_uri':_0x1800c5['data4'],'client_id':_0x1800c5[_0x8769('0x26')],'client_secret':encryptor[_0x8769('0x42')](_0x1800c5[_0x8769('0x3d')])};var _0x37779e={'method':_0x8769('0x43'),'uri':MICROSOFT_AUTH_URL[_0x8769('0x1d')](_0x8769('0x44'),_0x1800c5[_0x8769('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x252f92,'json':!![]};return rp(_0x37779e);}function startRefreshInterval(_0x1ad7e4){var _0x57dbe0=schedule[_0x8769('0x4b')];if(_0x57dbe0[_0x1ad7e4['id']])clearInterval(_0x57dbe0[_0x1ad7e4['id']]);_0x57dbe0[_0x1ad7e4['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x1ad7e4['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x57dbe0;}function startAllRefreshIntervals(){return db[_0x8769('0x3e')][_0x8769('0x4c')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8769('0x3c')](function(_0x2b0100){var _0x14f731=_0x2b0100[_0x8769('0x15')](function(_0x494a3e){return refreshOauth2MicrosoftAccessToken(_0x494a3e)['then'](function(_0x186a58){startRefreshInterval(_0x186a58);});});return Promise[_0x8769('0x4d')](_0x14f731);})[_0x8769('0x47')](function(_0x130c66){var _0x4c2739=_0x130c66?util[_0x8769('0x4e')](_0x130c66,{'showHidden':![],'depth':null}):'';logger[_0x8769('0x48')](_0x8769('0x4f'),_0x4c2739);});}module[_0x8769('0x50')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xd0ac=['type','Dynamics365','push','data7','id_token','from','stringify','toString','base64','hex','client_id','response_type','data4','response_mode','scope','state','nonce','prompt','key','replace','data1','set','decode','payload','iss','isAfter','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','{TENANT_ID}','data2','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0xd0ac,0xc3));var _0xcd0a=function(_0x2c2ef7,_0x337198){_0x2c2ef7=_0x2c2ef7-0x0;var _0x2d53e8=_0xd0ac[_0x2c2ef7];return _0x2d53e8;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0xcd0a('0x0'));var moment=require(_0xcd0a('0x1'));var Redis=require(_0xcd0a('0x2'));var rp=require('request-promise');var util=require(_0xcd0a('0x3'));var encryptor=require(_0xcd0a('0x4'));var config=require(_0xcd0a('0x5'));var logger=require(_0xcd0a('0x6'))(_0xcd0a('0x7'));var schedule=require(_0xcd0a('0x8'));var db=require(_0xcd0a('0x9'))['db'];config[_0xcd0a('0xa')]=_['defaults'](config['redis'],{'host':_0xcd0a('0xb'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xcd0a('0xc'),_0xcd0a('0xd'),'email',_0xcd0a('0xe'),_0xcd0a('0xf'),_0xcd0a('0x10'),_0xcd0a('0x11')],'Dynamics365':[_0xcd0a('0xc'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xcd0a('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xcd0a('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x8db674){var _0x2f53ab=_[_0xcd0a('0x14')](AZURE_AUTH_SCOPES[_0x8db674[_0xcd0a('0x15')]]);if(_0x8db674[_0xcd0a('0x15')]===_0xcd0a('0x16'))_0x2f53ab[_0xcd0a('0x17')](_0x8db674[_0xcd0a('0x18')]+'/.default');return _0x2f53ab['join']('\x20');}function getAccessTokenScope(_0x328b8b){if(_0x328b8b[_0xcd0a('0x15')]==='Outlook365')return _0xcd0a('0xf');if(_0x328b8b[_0xcd0a('0x15')]===_0xcd0a('0x16'))return _0x328b8b[_0xcd0a('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x33f1a5,_0x2b0bd0){var _0x1f6a0f=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x33f1a5['data2']);var _0x2f66a5=['code',_0xcd0a('0x19')];var _0x16c7ca=Buffer[_0xcd0a('0x1a')](JSON[_0xcd0a('0x1b')]({'id':_0x2b0bd0}))[_0xcd0a('0x1c')](_0xcd0a('0x1d'));var _0x385ca3=crypto['randomBytes'](0x10)[_0xcd0a('0x1c')](_0xcd0a('0x1e'));var _0x5b1beb=getAuthorizationScopes(_0x33f1a5);var _0x1b0b0b=[{'key':_0xcd0a('0x1f'),'value':_0x33f1a5['data1']},{'key':_0xcd0a('0x20'),'value':encodeURIComponent(_0x2f66a5['join']('\x20'))},{'key':'redirect_uri','value':_0x33f1a5[_0xcd0a('0x21')]},{'key':_0xcd0a('0x22'),'value':'form_post'},{'key':_0xcd0a('0x23'),'value':encodeURIComponent(_0x5b1beb)},{'key':_0xcd0a('0x24'),'value':_0x16c7ca},{'key':_0xcd0a('0x25'),'value':_0x385ca3},{'key':_0xcd0a('0x26'),'value':'login'}];var _0x3b1b90=_0x1f6a0f+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x1b0b0b,function(_0x4c7ee6){return _0x4c7ee6[_0xcd0a('0x27')]+'='+_0x4c7ee6['value'];})['join']('&');_0x33f1a5['oauth2Claims']={'issuer':_0x1f6a0f[_0xcd0a('0x28')]('oauth2/',''),'audience':_0x33f1a5[_0xcd0a('0x29')],'state':_0x16c7ca,'nonce':_0x385ca3};redis[_0xcd0a('0x2a')](_0x16c7ca,JSON[_0xcd0a('0x1b')](_0x33f1a5));return _0x3b1b90;}function isValidIdToken(_0x60aef2,_0x40f9e1){try{var _0x237755=jwt[_0xcd0a('0x2b')](_0x60aef2,{'complete':!![]});var _0x55eb5c=_0x237755[_0xcd0a('0x2c')];if(_0x55eb5c[_0xcd0a('0x2d')]!==_0x40f9e1['issuer'])return![];if(_0x55eb5c['aud']!==_0x40f9e1['audience'])return![];if(_0x55eb5c[_0xcd0a('0x25')]!==_0x40f9e1[_0xcd0a('0x25')])return![];if(moment()[_0xcd0a('0x2e')](moment[_0xcd0a('0x2f')](_0x55eb5c['exp'])))return![];return!![];}catch(_0x5662ea){throw _0x5662ea;}}function refreshOauth2MicrosoftAccessToken(_0x300e7d){return Promise[_0xcd0a('0x30')]()[_0xcd0a('0x31')](function(){if(_0x300e7d[_0xcd0a('0x32')])return _0x300e7d;return db[_0xcd0a('0x33')][_0xcd0a('0x34')]({'where':{'id':_0x300e7d['id']},'raw':!![]});})[_0xcd0a('0x31')](function(_0x5d7ed1){var _0x48d62b={'grant_type':_0xcd0a('0x35'),'refresh_token':_0x5d7ed1[_0xcd0a('0x36')],'scope':getAccessTokenScope(_0x5d7ed1),'redirect_uri':_0x5d7ed1[_0xcd0a('0x21')],'client_id':_0x5d7ed1[_0xcd0a('0x29')],'client_secret':encryptor[_0xcd0a('0x37')](_0x5d7ed1[_0xcd0a('0x32')])};var _0x2596ca={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0xcd0a('0x38'),_0x5d7ed1[_0xcd0a('0x39')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x48d62b,'json':!![]};return rp(_0x2596ca);})[_0xcd0a('0x31')](function(_0xddcf4d){_0x300e7d[_0xcd0a('0x3a')]=_0xddcf4d[_0xcd0a('0x3b')];_0x300e7d[_0xcd0a('0x36')]=_0xddcf4d[_0xcd0a('0x35')];return db[_0xcd0a('0x33')][_0xcd0a('0x3c')]({'data5':_0x300e7d[_0xcd0a('0x3a')],'data6':_0x300e7d[_0xcd0a('0x36')]},{'where':{'id':_0x300e7d['id']}});})['then'](function(){return _0x300e7d;})[_0xcd0a('0x3d')](function(_0x1e3ccd){logger[_0xcd0a('0x3e')](_0xcd0a('0x3f'),_0x300e7d['id'],_0x1e3ccd);});}function getOauth2MicrosoftAccessToken(_0x1d71ec,_0x41bf96){var _0x554705={'grant_type':_0xcd0a('0x40'),'code':_0x1d71ec,'scope':getAccessTokenScope(_0x41bf96),'redirect_uri':_0x41bf96['data4'],'client_id':_0x41bf96['data1'],'client_secret':encryptor[_0xcd0a('0x37')](_0x41bf96[_0xcd0a('0x32')])};var _0x17b3f8={'method':_0xcd0a('0x41'),'uri':MICROSOFT_AUTH_URL['replace'](_0xcd0a('0x38'),_0x41bf96[_0xcd0a('0x39')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x554705,'json':!![]};return rp(_0x17b3f8);}function startRefreshInterval(_0x1d1a7a){var _0x20b335=schedule[_0xcd0a('0x42')];if(_0x20b335[_0x1d1a7a['id']])clearInterval(_0x20b335[_0x1d1a7a['id']]);_0x20b335[_0x1d1a7a['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xcd0a('0x43')](this,{'id':_0x1d1a7a['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xcd0a('0x42')]=_0x20b335;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xcd0a('0x44')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xcd0a('0x31')](function(_0x484717){var _0x2e6989=_0x484717['map'](function(_0x44df6b){return refreshOauth2MicrosoftAccessToken(_0x44df6b)[_0xcd0a('0x31')](function(_0x5ea130){startRefreshInterval(_0x5ea130);});});return Promise['all'](_0x2e6989);})['catch'](function(_0x574f75){var _0xa25bb1=_0x574f75?util[_0xcd0a('0x45')](_0x574f75,{'showHidden':![],'depth':null}):'';logger[_0xcd0a('0x3e')](_0xcd0a('0x46'),_0xa25bb1);});}module[_0xcd0a('0x47')]={'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 7c4bf1f..3c12754 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 _0xda81=['then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x28edda,_0xbd447a){var _0x21f4a4=function(_0x5ae05e){while(--_0x5ae05e){_0x28edda['push'](_0x28edda['shift']());}};_0x21f4a4(++_0xbd447a);}(_0xda81,0x1c3));var _0x1da8=function(_0x4364fc,_0x3aa451){_0x4364fc=_0x4364fc-0x0;var _0xfec681=_0xda81[_0x4364fc];return _0xfec681;};'use strict';var _=require(_0x1da8('0x0'));var util=require(_0x1da8('0x1'));var moment=require(_0x1da8('0x2'));var BPromise=require('bluebird');var rs=require(_0x1da8('0x3'));var fs=require('fs');var Redis=require(_0x1da8('0x4'));var db=require(_0x1da8('0x5'))['db'];var utils=require(_0x1da8('0x6'));var logger=require('../../config/logger')(_0x1da8('0x7'));var config=require(_0x1da8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1da8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x891482,_0x2c2bb4,_0xea1eb1){return new BPromise(function(_0x1a3278,_0x11dc1e){return client[_0x1da8('0xa')](_0x891482,_0xea1eb1)[_0x1da8('0xb')](function(_0x17a7fc){logger[_0x1da8('0xc')]('CloudProvider,\x20%s,\x20%s',_0x2c2bb4,_0x1da8('0xd'));logger[_0x1da8('0xe')](_0x1da8('0xf'),_0x2c2bb4,_0x1da8('0xd'),JSON[_0x1da8('0x10')](_0x17a7fc));if(_0x17a7fc['error']){if(_0x17a7fc[_0x1da8('0x11')]['code']===0x1f4){logger[_0x1da8('0x11')](_0x1da8('0x12'),_0x2c2bb4,_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);return _0x11dc1e(_0x17a7fc[_0x1da8('0x11')]['message']);}logger[_0x1da8('0x11')]('CloudProvider,\x20%s,\x20%s',_0x2c2bb4,_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);return _0x1a3278(_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);}else{logger[_0x1da8('0xc')](_0x1da8('0x12'),_0x2c2bb4,'request\x20sent');_0x1a3278(_0x17a7fc[_0x1da8('0x14')][_0x1da8('0x13')]);}})[_0x1da8('0x15')](function(_0x197b09){logger[_0x1da8('0x11')](_0x1da8('0x12'),_0x2c2bb4,_0x197b09);_0x11dc1e(_0x197b09);});});} \ No newline at end of file +var _0x0c8d=['request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s'];(function(_0x1d43e7,_0x3840ce){var _0x3b4df2=function(_0x59444f){while(--_0x59444f){_0x1d43e7['push'](_0x1d43e7['shift']());}};_0x3b4df2(++_0x3840ce);}(_0x0c8d,0x79));var _0xd0c8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0c8d[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xd0c8('0x0'));var moment=require(_0xd0c8('0x1'));var BPromise=require(_0xd0c8('0x2'));var rs=require(_0xd0c8('0x3'));var fs=require('fs');var Redis=require(_0xd0c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd0c8('0x5'));var jayson=require(_0xd0c8('0x6'));var client=jayson[_0xd0c8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16d1c1,_0x5f0027,_0x415439){return new BPromise(function(_0x34e3d5,_0x2f6200){return client[_0xd0c8('0x8')](_0x16d1c1,_0x415439)[_0xd0c8('0x9')](function(_0x5678f9){logger[_0xd0c8('0xa')](_0xd0c8('0xb'),_0x5f0027,_0xd0c8('0xc'));logger[_0xd0c8('0xd')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5f0027,'request\x20sent',JSON[_0xd0c8('0xe')](_0x5678f9));if(_0x5678f9[_0xd0c8('0xf')]){if(_0x5678f9['error']['code']===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x5f0027,_0x5678f9['error'][_0xd0c8('0x10')]);return _0x2f6200(_0x5678f9[_0xd0c8('0xf')]['message']);}logger[_0xd0c8('0xf')](_0xd0c8('0xb'),_0x5f0027,_0x5678f9[_0xd0c8('0xf')][_0xd0c8('0x10')]);return _0x34e3d5(_0x5678f9[_0xd0c8('0xf')][_0xd0c8('0x10')]);}else{logger[_0xd0c8('0xa')](_0xd0c8('0xb'),_0x5f0027,_0xd0c8('0xc'));_0x34e3d5(_0x5678f9[_0xd0c8('0x11')][_0xd0c8('0x10')]);}})[_0xd0c8('0x12')](function(_0x58c3e0){logger[_0xd0c8('0xf')](_0xd0c8('0xb'),_0x5f0027,_0x58c3e0);_0x2f6200(_0x58c3e0);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index a4978e9..2774e8c 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x2fd025,_0x28bd75){var _0x210087=function(_0x350449){while(--_0x350449){_0x2fd025['push'](_0x2fd025['shift']());}};_0x210087(++_0x28bd75);}(_0x2ef3,0xba));var _0x32ef=function(_0x52f613,_0x26efb4){_0x52f613=_0x52f613-0x0;var _0x3fd852=_0x2ef3[_0x52f613];return _0x3fd852;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x44e36f,_0x10a892){var _0x5ebacc=function(_0x4527e7){while(--_0x4527e7){_0x44e36f['push'](_0x44e36f['shift']());}};_0x5ebacc(++_0x10a892);}(_0x2ef3,0xba));var _0x32ef=function(_0x4300fa,_0x283329){_0x4300fa=_0x4300fa-0x0;var _0x538c1c=_0x2ef3[_0x4300fa];return _0x538c1c;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 41f1a26..7cd82d9 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 _0xfc01=['sequelize','exports','STRING','name'];(function(_0x2d7daa,_0x5efc28){var _0x2d9c78=function(_0x4cfa2a){while(--_0x4cfa2a){_0x2d7daa['push'](_0x2d7daa['shift']());}};_0x2d9c78(++_0x5efc28);}(_0xfc01,0xe0));var _0x1fc0=function(_0x264105,_0x3ec79c){_0x264105=_0x264105-0x0;var _0x5121d4=_0xfc01[_0x264105];return _0x5121d4;};'use strict';var Sequelize=require(_0x1fc0('0x0'));module[_0x1fc0('0x1')]={'name':{'type':Sequelize[_0x1fc0('0x2')],'unique':_0x1fc0('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1fc0('0x2')]},'companyId':{'type':Sequelize[_0x1fc0('0x2')]},'website':{'type':Sequelize[_0x1fc0('0x2')]},'phone':{'type':Sequelize[_0x1fc0('0x2')]},'fax':{'type':Sequelize[_0x1fc0('0x2')]},'type':{'type':Sequelize[_0x1fc0('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1fc0('0x2')]},'country':{'type':Sequelize[_0x1fc0('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x1fc0('0x2')]},'sPostalCode':{'type':Sequelize[_0x1fc0('0x2')]},'sCity':{'type':Sequelize[_0x1fc0('0x2')]},'sCountry':{'type':Sequelize[_0x1fc0('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8c0e=['STRING','sequelize','exports','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8c0e,0x1c9));var _0xe8c0=function(_0x5e21b4,_0x166ad4){_0x5e21b4=_0x5e21b4-0x0;var _0x5d7297=_0x8c0e[_0x5e21b4];return _0x5d7297;};'use strict';var Sequelize=require(_0xe8c0('0x0'));module[_0xe8c0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe8c0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe8c0('0x3')]},'companyId':{'type':Sequelize[_0xe8c0('0x3')]},'website':{'type':Sequelize[_0xe8c0('0x3')]},'phone':{'type':Sequelize[_0xe8c0('0x3')]},'fax':{'type':Sequelize[_0xe8c0('0x3')]},'type':{'type':Sequelize[_0xe8c0('0x3')]},'street':{'type':Sequelize[_0xe8c0('0x3')]},'postalCode':{'type':Sequelize[_0xe8c0('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xe8c0('0x3')]},'email':{'type':Sequelize[_0xe8c0('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe8c0('0x3')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xe8c0('0x3')]},'sCity':{'type':Sequelize[_0xe8c0('0x3')]},'sCountry':{'type':Sequelize[_0xe8c0('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 7721679..d548ea2 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 _0x83eb=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','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','find','addContacts','ids','omit','getContacts','findOne','CmContact','pick','map','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','then','destroy','get','Companies','UserProfileResource','sendStatus','error','stack','name','send','index','CmCompany','describe','model','keys'];(function(_0x130720,_0x48ba32){var _0x18755c=function(_0x35407a){while(--_0x35407a){_0x130720['push'](_0x130720['shift']());}};_0x18755c(++_0x48ba32);}(_0x83eb,0x1ea));var _0xb83e=function(_0x3d35a4,_0xa1d986){_0x3d35a4=_0x3d35a4-0x0;var _0x5e2374=_0x83eb[_0x3d35a4];return _0x5e2374;};'use strict';var emlformat=require(_0xb83e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb83e('0x1'));var jsonpatch=require(_0xb83e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb83e('0x3'));var Mustache=require('mustache');var util=require(_0xb83e('0x4'));var path=require(_0xb83e('0x5'));var sox=require(_0xb83e('0x6'));var csv=require(_0xb83e('0x7'));var ejs=require(_0xb83e('0x8'));var fs=require('fs');var fs_extra=require(_0xb83e('0x9'));var _=require(_0xb83e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb83e('0xb'));var deskjs=require(_0xb83e('0xc'));var toCsv=require(_0xb83e('0x7'));var querystring=require(_0xb83e('0xd'));var Papa=require(_0xb83e('0xe'));var Redis=require(_0xb83e('0xf'));var authService=require(_0xb83e('0x10'));var qs=require(_0xb83e('0x11'));var as=require(_0xb83e('0x12'));var hardwareService=require(_0xb83e('0x13'));var logger=require('../../config/logger')(_0xb83e('0x14'));var utils=require('../../config/utils');var config=require(_0xb83e('0x15'));var licenseUtil=require(_0xb83e('0x16'));var db=require(_0xb83e('0x17'))['db'];function respondWithStatusCode(_0x52b7d9,_0x23d00e){_0x23d00e=_0x23d00e||0xcc;return function(_0x57d7ea){if(_0x57d7ea){return _0x52b7d9['sendStatus'](_0x23d00e);}return _0x52b7d9['status'](_0x23d00e)[_0xb83e('0x18')]();};}function respondWithResult(_0x5a36e7,_0x1f3461){_0x1f3461=_0x1f3461||0xc8;return function(_0x4efc48){if(_0x4efc48){return _0x5a36e7['status'](_0x1f3461)[_0xb83e('0x19')](_0x4efc48);}};}function respondWithFilteredResult(_0x5b58ef,_0x2493eb){return function(_0x3060e7){if(_0x3060e7){var _0x38ae4a=typeof _0x2493eb[_0xb83e('0x1a')]===_0xb83e('0x1b')&&typeof _0x2493eb['limit']===_0xb83e('0x1b');var _0x509e8d=_0x3060e7[_0xb83e('0x1c')];var _0x2ed2d8=_0x38ae4a?0x0:_0x2493eb[_0xb83e('0x1a')];var _0x2a54eb=_0x38ae4a?_0x3060e7['count']:_0x2493eb[_0xb83e('0x1a')]+_0x2493eb[_0xb83e('0x1d')];var _0x241386;if(_0x2a54eb>=_0x509e8d){_0x2a54eb=_0x509e8d;_0x241386=0xc8;}else{_0x241386=0xce;}_0x5b58ef[_0xb83e('0x1e')](_0x241386);return _0x5b58ef[_0xb83e('0x1f')](_0xb83e('0x20'),_0x2ed2d8+'-'+_0x2a54eb+'/'+_0x509e8d)[_0xb83e('0x19')](_0x3060e7);}return null;};}function patchUpdates(_0x46cebc){return function(_0x53d082){try{jsonpatch[_0xb83e('0x21')](_0x53d082,_0x46cebc,!![]);}catch(_0x146ac1){return BPromise[_0xb83e('0x22')](_0x146ac1);}return _0x53d082['save']();};}function saveUpdates(_0x3a77a6,_0x5b14b0){return function(_0x7b7acf){if(_0x7b7acf){return _0x7b7acf['update'](_0x3a77a6)[_0xb83e('0x23')](function(_0x304892){return _0x304892;});}return null;};}function removeEntity(_0x596bfc,_0x2d1c20){return function(_0x2df54e){if(_0x2df54e){return _0x2df54e[_0xb83e('0x24')]()[_0xb83e('0x23')](function(){var _0xd0fe77=_0x2df54e[_0xb83e('0x25')]({'plain':!![]});var _0x13da02=_0xb83e('0x26');return db[_0xb83e('0x27')][_0xb83e('0x24')]({'where':{'type':_0x13da02,'resourceId':_0xd0fe77['id']}})[_0xb83e('0x23')](function(){return _0x2df54e;});})[_0xb83e('0x23')](function(){_0x596bfc['status'](0xcc)[_0xb83e('0x18')]();});}};}function handleEntityNotFound(_0x1b82ba,_0x2de75b){return function(_0x314211){if(!_0x314211){_0x1b82ba[_0xb83e('0x28')](0x194);}return _0x314211;};}function handleError(_0x4e82b7,_0x1eae3a){_0x1eae3a=_0x1eae3a||0x1f4;return function(_0x38afaa){logger[_0xb83e('0x29')](_0x38afaa[_0xb83e('0x2a')]);if(_0x38afaa[_0xb83e('0x2b')]){delete _0x38afaa[_0xb83e('0x2b')];}_0x4e82b7['status'](_0x1eae3a)[_0xb83e('0x2c')](_0x38afaa);};}exports[_0xb83e('0x2d')]=function(_0x5dbbeb,_0x19e7cf){var _0x423789={},_0x4e57fa={},_0x5b3c5e={'count':0x0,'rows':[]};return db[_0xb83e('0x2e')][_0xb83e('0x2f')]()[_0xb83e('0x23')](function(_0x450371){_0x4e57fa[_0xb83e('0x30')]=_[_0xb83e('0x31')](_0x450371);_0x4e57fa[_0xb83e('0x32')]=_['keys'](_0x5dbbeb[_0xb83e('0x32')]);_0x4e57fa[_0xb83e('0x33')]=_[_0xb83e('0x34')](_0x4e57fa[_0xb83e('0x30')],_0x4e57fa[_0xb83e('0x32')]);_0x423789[_0xb83e('0x35')]=_['intersection'](_0x4e57fa[_0xb83e('0x30')],qs[_0xb83e('0x36')](_0x5dbbeb['query'][_0xb83e('0x36')]));_0x423789[_0xb83e('0x35')]=_0x423789['attributes'][_0xb83e('0x37')]?_0x423789[_0xb83e('0x35')]:_0x4e57fa[_0xb83e('0x30')];if(!_0x5dbbeb['query'][_0xb83e('0x38')](_0xb83e('0x39'))){_0x423789['limit']=qs[_0xb83e('0x1d')](_0x5dbbeb['query'][_0xb83e('0x1d')]);_0x423789[_0xb83e('0x1a')]=qs[_0xb83e('0x1a')](_0x5dbbeb[_0xb83e('0x32')]['offset']);}_0x423789[_0xb83e('0x3a')]=qs['sort'](_0x5dbbeb[_0xb83e('0x32')][_0xb83e('0x3b')]);_0x423789['where']=qs['filters'](_['pick'](_0x5dbbeb[_0xb83e('0x32')],_0x4e57fa['filters']),_0x450371);if(_0x5dbbeb[_0xb83e('0x32')][_0xb83e('0x3c')]){_0x423789[_0xb83e('0x3d')]=_[_0xb83e('0x3e')](_0x423789[_0xb83e('0x3d')],{'$or':_['map'](_0x423789[_0xb83e('0x35')],function(_0x50dadf){var _0x15efb7={};_0x15efb7[_0x50dadf]={'$like':'%'+_0x5dbbeb[_0xb83e('0x32')]['filter']+'%'};return _0x15efb7;})});}_0x423789=_[_0xb83e('0x3e')]({},_0x423789,_0x5dbbeb[_0xb83e('0x3f')]);var _0x21e7c0={'where':_0x423789[_0xb83e('0x3d')]};return db[_0xb83e('0x2e')]['count'](_0x21e7c0)[_0xb83e('0x23')](function(_0x152595){_0x5b3c5e['count']=_0x152595;if(_0x5dbbeb[_0xb83e('0x32')][_0xb83e('0x40')]){_0x423789[_0xb83e('0x41')]=[{'all':!![]}];}return db[_0xb83e('0x2e')][_0xb83e('0x42')](_0x423789);})[_0xb83e('0x23')](function(_0x2aaa08){_0x5b3c5e[_0xb83e('0x43')]=_0x2aaa08;return _0x5b3c5e;})[_0xb83e('0x23')](respondWithFilteredResult(_0x19e7cf,_0x423789))['catch'](handleError(_0x19e7cf,null));})[_0xb83e('0x44')](handleError(_0x19e7cf,null));};exports[_0xb83e('0x45')]=function(_0x3adc57,_0x979161){var _0x3ac676={'raw':![],'where':{'id':_0x3adc57['params']['id']}},_0xb354db={};_0xb354db['model']=_[_0xb83e('0x31')](db[_0xb83e('0x2e')][_0xb83e('0x46')]);_0xb354db[_0xb83e('0x32')]=_[_0xb83e('0x31')](_0x3adc57['query']);_0xb354db[_0xb83e('0x33')]=_[_0xb83e('0x34')](_0xb354db[_0xb83e('0x30')],_0xb354db['query']);_0x3ac676[_0xb83e('0x35')]=_[_0xb83e('0x34')](_0xb354db[_0xb83e('0x30')],qs[_0xb83e('0x36')](_0x3adc57[_0xb83e('0x32')][_0xb83e('0x36')]));_0x3ac676['attributes']=_0x3ac676['attributes'][_0xb83e('0x37')]?_0x3ac676[_0xb83e('0x35')]:_0xb354db[_0xb83e('0x30')];if(_0x3adc57[_0xb83e('0x32')]['includeAll']){_0x3ac676[_0xb83e('0x41')]=[{'all':!![]}];}_0x3ac676=_['merge']({},_0x3ac676,_0x3adc57[_0xb83e('0x3f')]);return db['CmCompany']['find'](_0x3ac676)[_0xb83e('0x23')](handleEntityNotFound(_0x979161,null))[_0xb83e('0x23')](respondWithResult(_0x979161,null))[_0xb83e('0x44')](handleError(_0x979161,null));};exports[_0xb83e('0x47')]=function(_0x100779,_0xed2ba5){return db[_0xb83e('0x2e')][_0xb83e('0x47')](_0x100779[_0xb83e('0x48')],{})[_0xb83e('0x23')](function(_0x986fce){var _0x20e8ed=_0x100779[_0xb83e('0x49')]['get']({'plain':!![]});if(!_0x20e8ed)throw new Error(_0xb83e('0x4a'));if(_0x20e8ed[_0xb83e('0x4b')]===_0xb83e('0x49')){var _0x501250=_0x986fce['get']({'plain':!![]});var _0x3ab38f=_0xb83e('0x26');return db[_0xb83e('0x4c')]['find']({'where':{'name':_0x3ab38f,'userProfileId':_0x20e8ed[_0xb83e('0x4d')]},'raw':!![]})[_0xb83e('0x23')](function(_0x3ff6d0){if(_0x3ff6d0&&_0x3ff6d0[_0xb83e('0x4e')]===0x0){return db['UserProfileResource'][_0xb83e('0x47')]({'name':_0x501250['name'],'resourceId':_0x501250['id'],'type':_0x3ff6d0['name'],'sectionId':_0x3ff6d0['id']},{})[_0xb83e('0x23')](function(){return _0x986fce;});}else{return _0x986fce;}})[_0xb83e('0x44')](function(_0x15da60){logger[_0xb83e('0x29')](_0xb83e('0x4f'),_0x15da60);throw _0x15da60;});}return _0x986fce;})[_0xb83e('0x23')](respondWithResult(_0xed2ba5,0xc9))[_0xb83e('0x44')](handleError(_0xed2ba5,null));};exports['update']=function(_0x528d2e,_0x493716){if(_0x528d2e[_0xb83e('0x48')]['id']){delete _0x528d2e[_0xb83e('0x48')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x528d2e[_0xb83e('0x50')]['id']}})[_0xb83e('0x23')](handleEntityNotFound(_0x493716,null))['then'](saveUpdates(_0x528d2e['body'],null))['then'](respondWithResult(_0x493716,null))[_0xb83e('0x44')](handleError(_0x493716,null));};exports[_0xb83e('0x24')]=function(_0x33f639,_0xe96c9e){return db[_0xb83e('0x2e')][_0xb83e('0x51')]({'where':{'id':_0x33f639[_0xb83e('0x50')]['id']}})[_0xb83e('0x23')](handleEntityNotFound(_0xe96c9e,null))[_0xb83e('0x23')](removeEntity(_0xe96c9e,null))['catch'](handleError(_0xe96c9e,null));};exports[_0xb83e('0x2f')]=function(_0x482be7,_0x171e54){return db[_0xb83e('0x2e')][_0xb83e('0x2f')]()[_0xb83e('0x23')](respondWithResult(_0x171e54,null))['catch'](handleError(_0x171e54,null));};exports[_0xb83e('0x52')]=function(_0x526a48,_0x5e6546,_0x228bbe){return db['CmContact'][_0xb83e('0x51')]({'where':{'id':_0x526a48[_0xb83e('0x50')]['id']}})['then'](handleEntityNotFound(_0x5e6546,null))[_0xb83e('0x23')](function(_0xfdb496){if(_0xfdb496){return _0xfdb496[_0xb83e('0x52')](_0x526a48[_0xb83e('0x48')][_0xb83e('0x53')],_[_0xb83e('0x54')](_0x526a48[_0xb83e('0x48')],[_0xb83e('0x53'),'id'])||{});}})[_0xb83e('0x23')](respondWithResult(_0x5e6546,null))[_0xb83e('0x44')](handleError(_0x5e6546,null));};exports[_0xb83e('0x55')]=function(_0x1f3724,_0x4860fa,_0x326112){var _0x32f5b1={};var _0x5517ea={};var _0x260c2d;var _0x4d66b4;return db['CmCompany'][_0xb83e('0x56')]({'where':{'id':_0x1f3724[_0xb83e('0x50')]['id']}})[_0xb83e('0x23')](handleEntityNotFound(_0x4860fa,null))[_0xb83e('0x23')](function(_0x255251){if(_0x255251){_0x260c2d=_0x255251;_0x5517ea['model']=_[_0xb83e('0x31')](db[_0xb83e('0x57')][_0xb83e('0x46')]);_0x5517ea[_0xb83e('0x32')]=_[_0xb83e('0x31')](_0x1f3724[_0xb83e('0x32')]);_0x5517ea[_0xb83e('0x33')]=_[_0xb83e('0x34')](_0x5517ea['model'],_0x5517ea[_0xb83e('0x32')]);_0x32f5b1[_0xb83e('0x35')]=_[_0xb83e('0x34')](_0x5517ea[_0xb83e('0x30')],qs['fields'](_0x1f3724[_0xb83e('0x32')]['fields']));_0x32f5b1[_0xb83e('0x35')]=_0x32f5b1[_0xb83e('0x35')]['length']?_0x32f5b1[_0xb83e('0x35')]:_0x5517ea[_0xb83e('0x30')];_0x32f5b1[_0xb83e('0x3a')]=qs[_0xb83e('0x3b')](_0x1f3724['query']['sort']);_0x32f5b1[_0xb83e('0x3d')]=qs[_0xb83e('0x33')](_[_0xb83e('0x58')](_0x1f3724['query'],_0x5517ea[_0xb83e('0x33')]));if(_0x1f3724[_0xb83e('0x32')][_0xb83e('0x3c')]){_0x32f5b1[_0xb83e('0x3d')]=_[_0xb83e('0x3e')](_0x32f5b1[_0xb83e('0x3d')],{'$or':_[_0xb83e('0x59')](_0x32f5b1[_0xb83e('0x35')],function(_0xea0004){var _0x22c83b={};_0x22c83b[_0xea0004]={'$like':'%'+_0x1f3724['query']['filter']+'%'};return _0x22c83b;})});}_0x32f5b1=_[_0xb83e('0x3e')]({},_0x32f5b1,_0x1f3724[_0xb83e('0x3f')]);return _0x260c2d[_0xb83e('0x55')](_0x32f5b1);}})[_0xb83e('0x23')](function(_0x31befc){if(_0x31befc){_0x4d66b4=_0x31befc['length'];if(!_0x1f3724['query']['hasOwnProperty'](_0xb83e('0x39'))){_0x32f5b1[_0xb83e('0x1d')]=qs[_0xb83e('0x1d')](_0x1f3724[_0xb83e('0x32')][_0xb83e('0x1d')]);_0x32f5b1[_0xb83e('0x1a')]=qs['offset'](_0x1f3724[_0xb83e('0x32')][_0xb83e('0x1a')]);}return _0x260c2d[_0xb83e('0x55')](_0x32f5b1);}})[_0xb83e('0x23')](function(_0x2c5d45){if(_0x2c5d45){return _0x2c5d45?{'count':_0x4d66b4,'rows':_0x2c5d45}:null;}})[_0xb83e('0x23')](respondWithResult(_0x4860fa,null))[_0xb83e('0x44')](handleError(_0x4860fa,null));}; \ No newline at end of file +var _0xdd67=['where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addContacts','ids','omit','getContacts','findOne','CmContact','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','update','then','destroy','Companies','UserProfileResource','sendStatus','error','stack','name','send','index','CmCompany','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x23ca63,_0x31c208){var _0x1a7bc8=function(_0x48ff77){while(--_0x48ff77){_0x23ca63['push'](_0x23ca63['shift']());}};_0x1a7bc8(++_0x31c208);}(_0xdd67,0x16a));var _0x7dd6=function(_0x466b9a,_0x3859f3){_0x466b9a=_0x466b9a-0x0;var _0x5bdb2d=_0xdd67[_0x466b9a];return _0x5bdb2d;};'use strict';var emlformat=require(_0x7dd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7dd6('0x1'));var jsonpatch=require(_0x7dd6('0x2'));var rp=require(_0x7dd6('0x3'));var moment=require(_0x7dd6('0x4'));var BPromise=require(_0x7dd6('0x5'));var Mustache=require(_0x7dd6('0x6'));var util=require(_0x7dd6('0x7'));var path=require(_0x7dd6('0x8'));var sox=require(_0x7dd6('0x9'));var csv=require('to-csv');var ejs=require(_0x7dd6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7dd6('0xb'));var crypto=require(_0x7dd6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7dd6('0xd'));var toCsv=require(_0x7dd6('0xe'));var querystring=require(_0x7dd6('0xf'));var Papa=require(_0x7dd6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7dd6('0x11'))('api');var utils=require(_0x7dd6('0x12'));var config=require(_0x7dd6('0x13'));var licenseUtil=require(_0x7dd6('0x14'));var db=require(_0x7dd6('0x15'))['db'];function respondWithStatusCode(_0x56e9c4,_0x526d85){_0x526d85=_0x526d85||0xcc;return function(_0x3ce8ce){if(_0x3ce8ce){return _0x56e9c4['sendStatus'](_0x526d85);}return _0x56e9c4['status'](_0x526d85)[_0x7dd6('0x16')]();};}function respondWithResult(_0x147e62,_0x4c669f){_0x4c669f=_0x4c669f||0xc8;return function(_0x2637e2){if(_0x2637e2){return _0x147e62[_0x7dd6('0x17')](_0x4c669f)[_0x7dd6('0x18')](_0x2637e2);}};}function respondWithFilteredResult(_0x2be573,_0xb9e1d1){return function(_0x31f653){if(_0x31f653){var _0x5560c3=typeof _0xb9e1d1[_0x7dd6('0x19')]===_0x7dd6('0x1a')&&typeof _0xb9e1d1[_0x7dd6('0x1b')]==='undefined';var _0x5e1aa2=_0x31f653['count'];var _0x243bdf=_0x5560c3?0x0:_0xb9e1d1[_0x7dd6('0x19')];var _0x9965c0=_0x5560c3?_0x31f653[_0x7dd6('0x1c')]:_0xb9e1d1['offset']+_0xb9e1d1[_0x7dd6('0x1b')];var _0x2c5701;if(_0x9965c0>=_0x5e1aa2){_0x9965c0=_0x5e1aa2;_0x2c5701=0xc8;}else{_0x2c5701=0xce;}_0x2be573[_0x7dd6('0x17')](_0x2c5701);return _0x2be573['set']('Content-Range',_0x243bdf+'-'+_0x9965c0+'/'+_0x5e1aa2)[_0x7dd6('0x18')](_0x31f653);}return null;};}function patchUpdates(_0x33500d){return function(_0x2982c6){try{jsonpatch['apply'](_0x2982c6,_0x33500d,!![]);}catch(_0x14a22a){return BPromise['reject'](_0x14a22a);}return _0x2982c6['save']();};}function saveUpdates(_0x92b15e,_0x472329){return function(_0xb0d943){if(_0xb0d943){return _0xb0d943[_0x7dd6('0x1d')](_0x92b15e)[_0x7dd6('0x1e')](function(_0x5b1a2b){return _0x5b1a2b;});}return null;};}function removeEntity(_0x4b456c,_0x53dd9f){return function(_0x420ced){if(_0x420ced){return _0x420ced[_0x7dd6('0x1f')]()[_0x7dd6('0x1e')](function(){var _0x58c1ff=_0x420ced['get']({'plain':!![]});var _0x402282=_0x7dd6('0x20');return db[_0x7dd6('0x21')][_0x7dd6('0x1f')]({'where':{'type':_0x402282,'resourceId':_0x58c1ff['id']}})[_0x7dd6('0x1e')](function(){return _0x420ced;});})[_0x7dd6('0x1e')](function(){_0x4b456c[_0x7dd6('0x17')](0xcc)[_0x7dd6('0x16')]();});}};}function handleEntityNotFound(_0x6993a5,_0x5b97b2){return function(_0x7285b1){if(!_0x7285b1){_0x6993a5[_0x7dd6('0x22')](0x194);}return _0x7285b1;};}function handleError(_0x13b3bf,_0x4a3140){_0x4a3140=_0x4a3140||0x1f4;return function(_0x3689dc){logger[_0x7dd6('0x23')](_0x3689dc[_0x7dd6('0x24')]);if(_0x3689dc['name']){delete _0x3689dc[_0x7dd6('0x25')];}_0x13b3bf[_0x7dd6('0x17')](_0x4a3140)[_0x7dd6('0x26')](_0x3689dc);};}exports[_0x7dd6('0x27')]=function(_0xca55f9,_0x3d7694){var _0x168cc8={},_0x353e14={},_0x398f32={'count':0x0,'rows':[]};return db[_0x7dd6('0x28')]['describe']()[_0x7dd6('0x1e')](function(_0x2487b7){_0x353e14['model']=_[_0x7dd6('0x29')](_0x2487b7);_0x353e14[_0x7dd6('0x2a')]=_['keys'](_0xca55f9[_0x7dd6('0x2a')]);_0x353e14[_0x7dd6('0x2b')]=_['intersection'](_0x353e14[_0x7dd6('0x2c')],_0x353e14[_0x7dd6('0x2a')]);_0x168cc8[_0x7dd6('0x2d')]=_[_0x7dd6('0x2e')](_0x353e14[_0x7dd6('0x2c')],qs[_0x7dd6('0x2f')](_0xca55f9[_0x7dd6('0x2a')][_0x7dd6('0x2f')]));_0x168cc8[_0x7dd6('0x2d')]=_0x168cc8[_0x7dd6('0x2d')][_0x7dd6('0x30')]?_0x168cc8[_0x7dd6('0x2d')]:_0x353e14[_0x7dd6('0x2c')];if(!_0xca55f9[_0x7dd6('0x2a')][_0x7dd6('0x31')](_0x7dd6('0x32'))){_0x168cc8[_0x7dd6('0x1b')]=qs[_0x7dd6('0x1b')](_0xca55f9[_0x7dd6('0x2a')][_0x7dd6('0x1b')]);_0x168cc8[_0x7dd6('0x19')]=qs[_0x7dd6('0x19')](_0xca55f9[_0x7dd6('0x2a')]['offset']);}_0x168cc8[_0x7dd6('0x33')]=qs[_0x7dd6('0x34')](_0xca55f9[_0x7dd6('0x2a')]['sort']);_0x168cc8[_0x7dd6('0x35')]=qs['filters'](_[_0x7dd6('0x36')](_0xca55f9[_0x7dd6('0x2a')],_0x353e14['filters']),_0x2487b7);if(_0xca55f9['query'][_0x7dd6('0x37')]){_0x168cc8['where']=_[_0x7dd6('0x38')](_0x168cc8[_0x7dd6('0x35')],{'$or':_[_0x7dd6('0x39')](_0x168cc8[_0x7dd6('0x2d')],function(_0x2af17c){var _0x4256a6={};_0x4256a6[_0x2af17c]={'$like':'%'+_0xca55f9[_0x7dd6('0x2a')]['filter']+'%'};return _0x4256a6;})});}_0x168cc8=_[_0x7dd6('0x38')]({},_0x168cc8,_0xca55f9[_0x7dd6('0x3a')]);var _0xf82315={'where':_0x168cc8[_0x7dd6('0x35')]};return db['CmCompany'][_0x7dd6('0x1c')](_0xf82315)['then'](function(_0x2ed995){_0x398f32[_0x7dd6('0x1c')]=_0x2ed995;if(_0xca55f9[_0x7dd6('0x2a')][_0x7dd6('0x3b')]){_0x168cc8[_0x7dd6('0x3c')]=[{'all':!![]}];}return db['CmCompany'][_0x7dd6('0x3d')](_0x168cc8);})['then'](function(_0x3f41ad){_0x398f32[_0x7dd6('0x3e')]=_0x3f41ad;return _0x398f32;})[_0x7dd6('0x1e')](respondWithFilteredResult(_0x3d7694,_0x168cc8))[_0x7dd6('0x3f')](handleError(_0x3d7694,null));})[_0x7dd6('0x3f')](handleError(_0x3d7694,null));};exports[_0x7dd6('0x40')]=function(_0x34b84e,_0x3c3136){var _0x3390e2={'raw':![],'where':{'id':_0x34b84e['params']['id']}},_0x2a0ad4={};_0x2a0ad4[_0x7dd6('0x2c')]=_[_0x7dd6('0x29')](db['CmCompany'][_0x7dd6('0x41')]);_0x2a0ad4['query']=_['keys'](_0x34b84e['query']);_0x2a0ad4[_0x7dd6('0x2b')]=_[_0x7dd6('0x2e')](_0x2a0ad4['model'],_0x2a0ad4[_0x7dd6('0x2a')]);_0x3390e2[_0x7dd6('0x2d')]=_[_0x7dd6('0x2e')](_0x2a0ad4['model'],qs[_0x7dd6('0x2f')](_0x34b84e[_0x7dd6('0x2a')]['fields']));_0x3390e2[_0x7dd6('0x2d')]=_0x3390e2[_0x7dd6('0x2d')][_0x7dd6('0x30')]?_0x3390e2[_0x7dd6('0x2d')]:_0x2a0ad4['model'];if(_0x34b84e[_0x7dd6('0x2a')]['includeAll']){_0x3390e2[_0x7dd6('0x3c')]=[{'all':!![]}];}_0x3390e2=_[_0x7dd6('0x38')]({},_0x3390e2,_0x34b84e[_0x7dd6('0x3a')]);return db[_0x7dd6('0x28')][_0x7dd6('0x42')](_0x3390e2)[_0x7dd6('0x1e')](handleEntityNotFound(_0x3c3136,null))[_0x7dd6('0x1e')](respondWithResult(_0x3c3136,null))[_0x7dd6('0x3f')](handleError(_0x3c3136,null));};exports[_0x7dd6('0x43')]=function(_0x2b7909,_0x325a13){return db[_0x7dd6('0x28')][_0x7dd6('0x43')](_0x2b7909['body'],{})[_0x7dd6('0x1e')](function(_0x48e9fd){var _0x301be9=_0x2b7909['user']['get']({'plain':!![]});if(!_0x301be9)throw new Error(_0x7dd6('0x44'));if(_0x301be9['role']===_0x7dd6('0x45')){var _0x41d360=_0x48e9fd['get']({'plain':!![]});var _0x5201d5=_0x7dd6('0x20');return db[_0x7dd6('0x46')][_0x7dd6('0x42')]({'where':{'name':_0x5201d5,'userProfileId':_0x301be9[_0x7dd6('0x47')]},'raw':!![]})[_0x7dd6('0x1e')](function(_0x4580dc){if(_0x4580dc&&_0x4580dc[_0x7dd6('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x41d360[_0x7dd6('0x25')],'resourceId':_0x41d360['id'],'type':_0x4580dc[_0x7dd6('0x25')],'sectionId':_0x4580dc['id']},{})['then'](function(){return _0x48e9fd;});}else{return _0x48e9fd;}})[_0x7dd6('0x3f')](function(_0x1fa9f7){logger[_0x7dd6('0x23')](_0x7dd6('0x49'),_0x1fa9f7);throw _0x1fa9f7;});}return _0x48e9fd;})['then'](respondWithResult(_0x325a13,0xc9))[_0x7dd6('0x3f')](handleError(_0x325a13,null));};exports[_0x7dd6('0x1d')]=function(_0x50711b,_0x48619e){if(_0x50711b['body']['id']){delete _0x50711b[_0x7dd6('0x4a')]['id'];}return db[_0x7dd6('0x28')]['find']({'where':{'id':_0x50711b[_0x7dd6('0x4b')]['id']}})[_0x7dd6('0x1e')](handleEntityNotFound(_0x48619e,null))[_0x7dd6('0x1e')](saveUpdates(_0x50711b[_0x7dd6('0x4a')],null))['then'](respondWithResult(_0x48619e,null))[_0x7dd6('0x3f')](handleError(_0x48619e,null));};exports['destroy']=function(_0x20eb75,_0x5c6b92){return db['CmCompany']['find']({'where':{'id':_0x20eb75[_0x7dd6('0x4b')]['id']}})[_0x7dd6('0x1e')](handleEntityNotFound(_0x5c6b92,null))[_0x7dd6('0x1e')](removeEntity(_0x5c6b92,null))[_0x7dd6('0x3f')](handleError(_0x5c6b92,null));};exports[_0x7dd6('0x4c')]=function(_0x408e03,_0x1108f7){return db['CmCompany'][_0x7dd6('0x4c')]()['then'](respondWithResult(_0x1108f7,null))[_0x7dd6('0x3f')](handleError(_0x1108f7,null));};exports[_0x7dd6('0x4d')]=function(_0x207efa,_0x334056,_0x4c00aa){return db['CmContact'][_0x7dd6('0x42')]({'where':{'id':_0x207efa[_0x7dd6('0x4b')]['id']}})[_0x7dd6('0x1e')](handleEntityNotFound(_0x334056,null))[_0x7dd6('0x1e')](function(_0x58b077){if(_0x58b077){return _0x58b077[_0x7dd6('0x4d')](_0x207efa[_0x7dd6('0x4a')][_0x7dd6('0x4e')],_[_0x7dd6('0x4f')](_0x207efa[_0x7dd6('0x4a')],[_0x7dd6('0x4e'),'id'])||{});}})[_0x7dd6('0x1e')](respondWithResult(_0x334056,null))[_0x7dd6('0x3f')](handleError(_0x334056,null));};exports[_0x7dd6('0x50')]=function(_0x8ffa9b,_0xdec992,_0x2f4f27){var _0x21e8c7={};var _0x40d53d={};var _0x12ec56;var _0x3e3877;return db[_0x7dd6('0x28')][_0x7dd6('0x51')]({'where':{'id':_0x8ffa9b[_0x7dd6('0x4b')]['id']}})[_0x7dd6('0x1e')](handleEntityNotFound(_0xdec992,null))[_0x7dd6('0x1e')](function(_0x3d6553){if(_0x3d6553){_0x12ec56=_0x3d6553;_0x40d53d[_0x7dd6('0x2c')]=_[_0x7dd6('0x29')](db[_0x7dd6('0x52')]['rawAttributes']);_0x40d53d[_0x7dd6('0x2a')]=_['keys'](_0x8ffa9b[_0x7dd6('0x2a')]);_0x40d53d['filters']=_[_0x7dd6('0x2e')](_0x40d53d[_0x7dd6('0x2c')],_0x40d53d[_0x7dd6('0x2a')]);_0x21e8c7[_0x7dd6('0x2d')]=_[_0x7dd6('0x2e')](_0x40d53d[_0x7dd6('0x2c')],qs[_0x7dd6('0x2f')](_0x8ffa9b[_0x7dd6('0x2a')]['fields']));_0x21e8c7[_0x7dd6('0x2d')]=_0x21e8c7[_0x7dd6('0x2d')][_0x7dd6('0x30')]?_0x21e8c7[_0x7dd6('0x2d')]:_0x40d53d[_0x7dd6('0x2c')];_0x21e8c7[_0x7dd6('0x33')]=qs['sort'](_0x8ffa9b[_0x7dd6('0x2a')][_0x7dd6('0x34')]);_0x21e8c7['where']=qs[_0x7dd6('0x2b')](_['pick'](_0x8ffa9b[_0x7dd6('0x2a')],_0x40d53d[_0x7dd6('0x2b')]));if(_0x8ffa9b[_0x7dd6('0x2a')]['filter']){_0x21e8c7[_0x7dd6('0x35')]=_[_0x7dd6('0x38')](_0x21e8c7[_0x7dd6('0x35')],{'$or':_[_0x7dd6('0x39')](_0x21e8c7['attributes'],function(_0x41b836){var _0x5b4895={};_0x5b4895[_0x41b836]={'$like':'%'+_0x8ffa9b[_0x7dd6('0x2a')][_0x7dd6('0x37')]+'%'};return _0x5b4895;})});}_0x21e8c7=_[_0x7dd6('0x38')]({},_0x21e8c7,_0x8ffa9b['options']);return _0x12ec56['getContacts'](_0x21e8c7);}})[_0x7dd6('0x1e')](function(_0x23e1ee){if(_0x23e1ee){_0x3e3877=_0x23e1ee[_0x7dd6('0x30')];if(!_0x8ffa9b[_0x7dd6('0x2a')][_0x7dd6('0x31')](_0x7dd6('0x32'))){_0x21e8c7['limit']=qs[_0x7dd6('0x1b')](_0x8ffa9b[_0x7dd6('0x2a')][_0x7dd6('0x1b')]);_0x21e8c7['offset']=qs[_0x7dd6('0x19')](_0x8ffa9b['query'][_0x7dd6('0x19')]);}return _0x12ec56[_0x7dd6('0x50')](_0x21e8c7);}})['then'](function(_0x272590){if(_0x272590){return _0x272590?{'count':_0x3e3877,'rows':_0x272590}:null;}})[_0x7dd6('0x1e')](respondWithResult(_0xdec992,null))[_0x7dd6('0x3f')](handleError(_0xdec992,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c9be79d..07240ad 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 _0xc673=['rimraf','../../config/environment','exports','define','cm_companies','lodash','../../config/logger','api','moment','request-promise'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0xc673,0x73));var _0x3c67=function(_0x45dbf9,_0x56cfff){_0x45dbf9=_0x45dbf9-0x0;var _0x4f2a10=_0xc673[_0x45dbf9];return _0x4f2a10;};'use strict';var _=require(_0x3c67('0x0'));var util=require('util');var logger=require(_0x3c67('0x1'))(_0x3c67('0x2'));var moment=require(_0x3c67('0x3'));var BPromise=require('bluebird');var rp=require(_0x3c67('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c67('0x5'));var config=require(_0x3c67('0x6'));var attributes=require('./cmCompany.attributes');module[_0x3c67('0x7')]=function(_0x5d29d0,_0x490335){return _0x5d29d0[_0x3c67('0x8')]('CmCompany',attributes,{'tableName':_0x3c67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff21=['bluebird','path','rimraf','exports','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xff21,0x119));var _0x1ff2=function(_0x5b080b,_0xe34631){_0x5b080b=_0x5b080b-0x0;var _0x3d724c=_0xff21[_0x5b080b];return _0x3d724c;};'use strict';var _=require(_0x1ff2('0x0'));var util=require(_0x1ff2('0x1'));var logger=require(_0x1ff2('0x2'))(_0x1ff2('0x3'));var moment=require(_0x1ff2('0x4'));var BPromise=require(_0x1ff2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ff2('0x6'));var rimraf=require(_0x1ff2('0x7'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x1ff2('0x8')]=function(_0x3fe210,_0x49635d){return _0x3fe210['define'](_0x1ff2('0x9'),attributes,{'tableName':_0x1ff2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index e96c06e..0891fbc 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 _0xeb40=['CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','debug'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xeb40,0x177));var _0x0eb4=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xeb40[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0x0eb4('0x0'));var util=require(_0x0eb4('0x1'));var moment=require(_0x0eb4('0x2'));var BPromise=require('bluebird');var rs=require(_0x0eb4('0x3'));var fs=require('fs');var Redis=require(_0x0eb4('0x4'));var db=require(_0x0eb4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0eb4('0x6'));var config=require(_0x0eb4('0x7'));var jayson=require(_0x0eb4('0x8'));var client=jayson[_0x0eb4('0x9')][_0x0eb4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x184e2f,_0x283d63,_0x78f97d){return new BPromise(function(_0x55c785,_0x2009bc){return client[_0x0eb4('0xb')](_0x184e2f,_0x78f97d)[_0x0eb4('0xc')](function(_0x3d1c0e){logger[_0x0eb4('0xd')](_0x0eb4('0xe'),_0x283d63,'request\x20sent');logger[_0x0eb4('0xf')](_0x0eb4('0x10'),_0x283d63,_0x0eb4('0x11'),JSON['stringify'](_0x3d1c0e));if(_0x3d1c0e[_0x0eb4('0x12')]){if(_0x3d1c0e[_0x0eb4('0x12')][_0x0eb4('0x13')]===0x1f4){logger['error'](_0x0eb4('0xe'),_0x283d63,_0x3d1c0e['error']['message']);return _0x2009bc(_0x3d1c0e['error'][_0x0eb4('0x14')]);}logger[_0x0eb4('0x12')]('CmCompany,\x20%s,\x20%s',_0x283d63,_0x3d1c0e['error'][_0x0eb4('0x14')]);return _0x55c785(_0x3d1c0e[_0x0eb4('0x12')]['message']);}else{logger[_0x0eb4('0xd')]('CmCompany,\x20%s,\x20%s',_0x283d63,_0x0eb4('0x11'));_0x55c785(_0x3d1c0e[_0x0eb4('0x15')][_0x0eb4('0x14')]);}})[_0x0eb4('0x16')](function(_0x5d6f0a){logger[_0x0eb4('0x12')](_0x0eb4('0xe'),_0x283d63,_0x5d6f0a);_0x2009bc(_0x5d6f0a);});});} \ No newline at end of file +var _0x6855=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','lodash'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x6855,0x107));var _0x5685=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0x6855[_0x382c73];return _0x1dd0bf;};'use strict';var _=require(_0x5685('0x0'));var util=require(_0x5685('0x1'));var moment=require(_0x5685('0x2'));var BPromise=require(_0x5685('0x3'));var rs=require(_0x5685('0x4'));var fs=require('fs');var Redis=require(_0x5685('0x5'));var db=require(_0x5685('0x6'))['db'];var utils=require(_0x5685('0x7'));var logger=require(_0x5685('0x8'))(_0x5685('0x9'));var config=require('../../config/environment');var jayson=require(_0x5685('0xa'));var client=jayson[_0x5685('0xb')][_0x5685('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ab099,_0x5df481,_0x21343c){return new BPromise(function(_0x2f179b,_0x5e04de){return client['request'](_0x3ab099,_0x21343c)[_0x5685('0xd')](function(_0x1f9bea){logger[_0x5685('0xe')]('CmCompany,\x20%s,\x20%s',_0x5df481,'request\x20sent');logger[_0x5685('0xf')](_0x5685('0x10'),_0x5df481,_0x5685('0x11'),JSON[_0x5685('0x12')](_0x1f9bea));if(_0x1f9bea['error']){if(_0x1f9bea[_0x5685('0x13')][_0x5685('0x14')]===0x1f4){logger['error'](_0x5685('0x15'),_0x5df481,_0x1f9bea['error'][_0x5685('0x16')]);return _0x5e04de(_0x1f9bea[_0x5685('0x13')][_0x5685('0x16')]);}logger[_0x5685('0x13')]('CmCompany,\x20%s,\x20%s',_0x5df481,_0x1f9bea['error'][_0x5685('0x16')]);return _0x2f179b(_0x1f9bea['error'][_0x5685('0x16')]);}else{logger['info'](_0x5685('0x15'),_0x5df481,'request\x20sent');_0x2f179b(_0x1f9bea[_0x5685('0x17')][_0x5685('0x16')]);}})['catch'](function(_0x963b1d){logger[_0x5685('0x13')](_0x5685('0x15'),_0x5df481,_0x963b1d);_0x5e04de(_0x963b1d);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 0ddae93..0eb2a33 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 _0x9888=['delete','destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','create','addContacts','put','update'];(function(_0x3a84cc,_0x1da9fa){var _0x129257=function(_0x41bb44){while(--_0x41bb44){_0x3a84cc['push'](_0x3a84cc['shift']());}};_0x129257(++_0x1da9fa);}(_0x9888,0x15c));var _0x8988=function(_0x382d22,_0x2e3eb0){_0x382d22=_0x382d22-0x0;var _0x22d509=_0x9888[_0x382d22];return _0x22d509;};'use strict';var multer=require('multer');var util=require(_0x8988('0x0'));var path=require('path');var timeout=require(_0x8988('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8988('0x2'));var auth=require(_0x8988('0x3'));var interaction=require(_0x8988('0x4'));var config=require(_0x8988('0x5'));var controller=require(_0x8988('0x6'));router[_0x8988('0x7')]('/',auth[_0x8988('0x8')](),controller[_0x8988('0x9')]);router[_0x8988('0x7')](_0x8988('0xa'),auth[_0x8988('0x8')](),controller[_0x8988('0xb')]);router[_0x8988('0x7')](_0x8988('0xc'),auth[_0x8988('0x8')](),controller[_0x8988('0xd')]);router['get'](_0x8988('0xe'),auth[_0x8988('0x8')](),controller[_0x8988('0xf')]);router['post']('/',auth[_0x8988('0x8')](),controller[_0x8988('0x10')]);router['post'](_0x8988('0xe'),auth[_0x8988('0x8')](),controller[_0x8988('0x11')]);router[_0x8988('0x12')]('/:id',auth[_0x8988('0x8')](),controller[_0x8988('0x13')]);router[_0x8988('0x14')]('/:id',auth[_0x8988('0x8')](),controller[_0x8988('0x15')]);module[_0x8988('0x16')]=router; \ No newline at end of file +var _0x4e94=['./cmCompany.controller','get','/describe','isAuthenticated','describe','/:id','getContacts','create','post','/:id/contacts','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x4e94,0x1f2));var _0x44e9=function(_0x5c0a22,_0x3e0eb3){_0x5c0a22=_0x5c0a22-0x0;var _0x292d8e=_0x4e94[_0x5c0a22];return _0x292d8e;};'use strict';var multer=require(_0x44e9('0x0'));var util=require(_0x44e9('0x1'));var path=require('path');var timeout=require(_0x44e9('0x2'));var express=require(_0x44e9('0x3'));var router=express[_0x44e9('0x4')]();var fs_extra=require(_0x44e9('0x5'));var auth=require(_0x44e9('0x6'));var interaction=require(_0x44e9('0x7'));var config=require('../../config/environment');var controller=require(_0x44e9('0x8'));router[_0x44e9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x44e9('0x9')](_0x44e9('0xa'),auth[_0x44e9('0xb')](),controller[_0x44e9('0xc')]);router['get'](_0x44e9('0xd'),auth[_0x44e9('0xb')](),controller['show']);router[_0x44e9('0x9')]('/:id/contacts',auth[_0x44e9('0xb')](),controller[_0x44e9('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x44e9('0xf')]);router[_0x44e9('0x10')](_0x44e9('0x11'),auth[_0x44e9('0xb')](),controller['addContacts']);router[_0x44e9('0x12')](_0x44e9('0xd'),auth['isAuthenticated'](),controller[_0x44e9('0x13')]);router[_0x44e9('0x14')](_0x44e9('0xd'),auth[_0x44e9('0xb')](),controller['destroy']);module[_0x44e9('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index e4ec448..d26d99c 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 _0x84ca=['NOW','lodash','sequelize','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84ca,0x1b9));var _0xa84c=function(_0x35c3a6,_0x2796d4){_0x35c3a6=_0x35c3a6-0x0;var _0x11a9e6=_0x84ca[_0x35c3a6];return _0x11a9e6;};'use strict';var _=require(_0xa84c('0x0'));var Sequelize=require(_0xa84c('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xa84c('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xa84c('0x2')]},'street':{'type':Sequelize[_0xa84c('0x2')]},'postalCode':{'type':Sequelize[_0xa84c('0x2')]},'city':{'type':Sequelize[_0xa84c('0x2')]},'country':{'type':Sequelize[_0xa84c('0x2')]},'dateOfBirth':{'type':Sequelize[_0xa84c('0x2')]},'description':{'type':Sequelize[_0xa84c('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xa84c('0x2')]},'fax':{'type':Sequelize[_0xa84c('0x2')]},'email':{'type':Sequelize[_0xa84c('0x2')]},'url':{'type':Sequelize[_0xa84c('0x2')]},'facebook':{'type':Sequelize[_0xa84c('0x2')]},'fb_data':{'type':Sequelize[_0xa84c('0x2')]},'twitter':{'type':Sequelize[_0xa84c('0x2')]},'skype':{'type':Sequelize[_0xa84c('0x2')]},'teams':{'type':Sequelize[_0xa84c('0x2')]},'viber':{'type':Sequelize[_0xa84c('0x2')]},'line':{'type':Sequelize[_0xa84c('0x2')]},'wechat':{'type':Sequelize[_0xa84c('0x2')]},'telegram':{'type':Sequelize[_0xa84c('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xa84c('0x2')]},'priority':{'type':Sequelize[_0xa84c('0x4')](0x2)[_0xa84c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa84c('0x6')],'defaultValue':Sequelize[_0xa84c('0x7')]},'dialTimezone':{'type':Sequelize[_0xa84c('0x2')]},'utcOffset':{'type':Sequelize[_0xa84c('0x4')]}}; \ No newline at end of file +var _0x1adb=['NOW','lodash','sequelize','STRING','TEXT','INTEGER','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1adb,0xb7));var _0xb1ad=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1adb[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xb1ad('0x0'));var Sequelize=require(_0xb1ad('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xb1ad('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb1ad('0x2')]},'street':{'type':Sequelize[_0xb1ad('0x2')]},'postalCode':{'type':Sequelize[_0xb1ad('0x2')]},'city':{'type':Sequelize[_0xb1ad('0x2')]},'country':{'type':Sequelize[_0xb1ad('0x2')]},'dateOfBirth':{'type':Sequelize[_0xb1ad('0x2')]},'description':{'type':Sequelize[_0xb1ad('0x3')]},'phone':{'type':Sequelize[_0xb1ad('0x2')]},'mobile':{'type':Sequelize[_0xb1ad('0x2')]},'fax':{'type':Sequelize[_0xb1ad('0x2')]},'email':{'type':Sequelize[_0xb1ad('0x2')]},'url':{'type':Sequelize[_0xb1ad('0x2')]},'facebook':{'type':Sequelize[_0xb1ad('0x2')]},'fb_data':{'type':Sequelize[_0xb1ad('0x2')]},'twitter':{'type':Sequelize[_0xb1ad('0x2')]},'skype':{'type':Sequelize[_0xb1ad('0x2')]},'teams':{'type':Sequelize[_0xb1ad('0x2')]},'viber':{'type':Sequelize[_0xb1ad('0x2')]},'line':{'type':Sequelize[_0xb1ad('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xb1ad('0x2')]},'UserId':{'type':Sequelize[_0xb1ad('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xb1ad('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb1ad('0x5')],'defaultValue':Sequelize[_0xb1ad('0x6')]},'dialTimezone':{'type':Sequelize[_0xb1ad('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 1d557df..8f7b0fa 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 _0xc78e=['status','json','offset','undefined','count','set','update','then','error','stack','name','send','index','describe','getOptions','findAll','query','user','destroy','CmContact','catch','tags','keys','length','startsWith','cf_','columnName','displayName','CmCustomField','alias','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','body','from','get','mergeWith','isArray','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','push','where','ListId','hasOwnProperty','all','params','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','$and','omit','map','cf_%d','format','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','text','phone','findOne','model','intersection','fields','attributes','order','sort','pick','filter','merge','getTags','nolimit','limit','setTags','ids','setAdditionalPhones','OrderBy','item_types','items','ItemTypeId','description','find','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','CmHopperId','item','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','hopperId','getHoppers','rawAttributes','filters','ContactId','includeAll','include','rows','getHopperHistories','options','getHopperFinals','getJscriptySessions','uploadCsv','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','0777','child_process','fork','CompanyId','pid','upload','createReadStream','parse','import','User','binding','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','agent','No\x20ListId\x20specified','../../components/import/cm/csvUpdates','getJourney','sms','openchannel','fax','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','callerid','endtime','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','startCase','chat','Account','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','deviceModel','osName','ratingMessage','ratingValue','referer','mail','subject','substatus','threadId','findAndCountAll','flatten','sortBy','reverse','value','slice','moment','util','path','lodash','squel','papaparse','../../components/contacts','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','socket.io-emitter','redis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc78e,0x1d4));var _0xec78=function(_0x35b5fb,_0x175955){_0x35b5fb=_0x35b5fb-0x0;var _0xb76d8c=_0xc78e[_0x35b5fb];return _0xb76d8c;};'use strict';var moment=require(_0xec78('0x0'));var BPromise=require('bluebird');var util=require(_0xec78('0x1'));var path=require(_0xec78('0x2'));var fs=require('fs');var _=require(_0xec78('0x3'));var squel=require(_0xec78('0x4'));var Papa=require(_0xec78('0x5'));var Redis=require('ioredis');var contacts=require(_0xec78('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xec78('0x7'))('api');var config=require(_0xec78('0x8'));var shared=require(_0xec78('0x9'));var db=require(_0xec78('0xa'))['db'];config['redis']=_[_0xec78('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xec78('0xc'))(new Redis(config[_0xec78('0xd')]));require('./cmContact.socket')['register'](socket);function respondWithResult(_0x484841,_0x372eeb){_0x372eeb=_0x372eeb||0xc8;return function(_0x30663f){if(_0x30663f){return _0x484841[_0xec78('0xe')](_0x372eeb)[_0xec78('0xf')](_0x30663f);}};}function respondWithFilteredResult(_0xc4ff65,_0x79ec5){return function(_0xb91aac){if(_0xb91aac){var _0x3fdbc6=typeof _0x79ec5[_0xec78('0x10')]===_0xec78('0x11')&&typeof _0x79ec5['limit']===_0xec78('0x11');var _0x10f9a6=_0xb91aac[_0xec78('0x12')];var _0x103644=_0x3fdbc6?0x0:_0x79ec5[_0xec78('0x10')];var _0x4dbf6e=_0x3fdbc6?_0xb91aac[_0xec78('0x12')]:_0x79ec5[_0xec78('0x10')]+_0x79ec5['limit'];var _0x15bb1a;if(_0x4dbf6e>=_0x10f9a6){_0x4dbf6e=_0x10f9a6;_0x15bb1a=0xc8;}else{_0x15bb1a=0xce;}_0xc4ff65[_0xec78('0xe')](_0x15bb1a);return _0xc4ff65[_0xec78('0x13')]('Content-Range',_0x103644+'-'+_0x4dbf6e+'/'+_0x10f9a6)[_0xec78('0xf')](_0xb91aac);}return null;};}function saveUpdates(_0x52f85e){return function(_0x7eb055){if(_0x7eb055){return _0x7eb055[_0xec78('0x14')](_0x52f85e)[_0xec78('0x15')](function(_0x45de1d){return _0x45de1d;});}return null;};}function removeEntity(_0x29aa05){return function(_0x33fa5a){if(_0x33fa5a){return _0x33fa5a['destroy']()[_0xec78('0x15')](function(){_0x29aa05[_0xec78('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52acb8){return function(_0x256d20){if(!_0x256d20){_0x52acb8['sendStatus'](0x194);}return _0x256d20;};}function handleError(_0x15d2ed,_0x1203a4){_0x1203a4=_0x1203a4||0x1f4;return function(_0x451195){logger[_0xec78('0x16')](_0x451195[_0xec78('0x17')]);if(_0x451195[_0xec78('0x18')]){delete _0x451195[_0xec78('0x18')];}_0x15d2ed[_0xec78('0xe')](_0x1203a4)[_0xec78('0x19')](_0x451195);};}exports[_0xec78('0x1a')]=function(_0xc54946,_0x58aa2d){var _0x4fad41={};return contacts[_0xec78('0x1b')]()['then'](function(_0x854cf){_0x4fad41=qs[_0xec78('0x1c')](_0x854cf,_0xc54946);return contacts[_0xec78('0x1d')](_0xc54946[_0xec78('0x1e')],_0xc54946[_0xec78('0x1f')],_0x4fad41,_0x854cf);})[_0xec78('0x15')](respondWithFilteredResult(_0x58aa2d,_0x4fad41))['catch'](handleError(_0x58aa2d,null));};exports[_0xec78('0x20')]=function(_0x25e047,_0x44929c){return db[_0xec78('0x21')]['find']({'where':{'id':_0x25e047['params']['id']}})[_0xec78('0x15')](handleEntityNotFound(_0x44929c,null))[_0xec78('0x15')](removeEntity(_0x44929c,null))[_0xec78('0x22')](handleError(_0x44929c,null));};exports[_0xec78('0x1b')]=function(_0x3c1db5,_0xa87d64){return db[_0xec78('0x21')][_0xec78('0x1b')]()[_0xec78('0x15')](function(_0x26ab9b){delete _0x26ab9b[_0xec78('0x23')];for(var _0x4f5769=0x0;_0x4f57690x0){return new Promise(function(_0x1c500e){var _0x3c28f2=[];for(var _0x3be0a1=0x0;_0x3be0a1<_0x549f4d[_0xec78('0x25')];_0x3be0a1++){_0x3c28f2[_0xec78('0x57')](insertAdditionalPhones(_0x549f4d[_0x3be0a1]['contact'],_0x549f4d[_0x3be0a1]['additionalPhones']));}Promise[_0xec78('0x5b')](_0x3c28f2)[_0xec78('0x15')](function(){_0x1c500e(0x1);});})[_0xec78('0x15')](function(){return{'success':_0x579711,'failure':_0x4a31bd,'duplicates':_0x2ad3f8};});}else{return{'success':_0x579711,'failure':_0x4a31bd,'duplicates':_0x2ad3f8};}}})['then'](respondWithResult(_0x211f11,0xc9))[_0xec78('0x22')](handleError(_0x211f11,null));};exports['show']=function(_0x1ea4e6,_0x3d7623){var _0x2cb018;return db['CmContact']['describe']()[_0xec78('0x15')](function(_0x24d39d){return db[_0xec78('0x21')]['find']({'where':{'id':_0x1ea4e6[_0xec78('0x5c')]['id']},'include':[{'model':db[_0xec78('0x5d')],'as':_0xec78('0x5e'),'attributes':['id',_0xec78('0x18'),_0xec78('0x5f')],'required':_0x1ea4e6[_0xec78('0x1e')][_0xec78('0x60')]?!![]:![]},{'model':db[_0xec78('0x42')],'as':_0xec78('0x61'),'where':{'CmContactId':_0x1ea4e6[_0xec78('0x5c')]['id']},'required':![],'include':[{'model':db[_0xec78('0x62')],'as':_0xec78('0x63')}]}],'order':[db[_0xec78('0x64')][_0xec78('0x65')]('Phones.OrderBy')],'attributes':_['keys'](_0x24d39d)});})[_0xec78('0x15')](function(_0x398842){if(!_['isNil'](_0x398842)){_0x2cb018=_0x398842[_0xec78('0x32')]({'plain':!![]});var _0x77ecc4={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x398842&&_0x398842[_0xec78('0x59')]){if(_0x398842[_0xec78('0x59')]){_0x77ecc4[_0xec78('0x58')][_0xec78('0x66')]['push']({'ListId':{'$ne':_0x398842[_0xec78('0x59')]}});}}return db[_0xec78('0x2a')][_0xec78('0x1d')](_0x77ecc4);}})[_0xec78('0x15')](function(_0x14786c){if(!_['isNil'](_0x14786c)){return _[_0xec78('0x67')](_0x2cb018,_[_0xec78('0x68')](_0x14786c,function(_0x3a2880){return util['format'](_0xec78('0x69'),_0x3a2880['id']);}));}})[_0xec78('0x15')](handleEntityNotFound(_0x3d7623,null))[_0xec78('0x15')](respondWithResult(_0x3d7623,null))['catch'](handleError(_0x3d7623,null));};exports[_0xec78('0x14')]=function(_0x16d512,_0x1d0b4d){var _0x3cdf0c;if(_0x16d512['body']['id']){delete _0x16d512[_0xec78('0x30')]['id'];}if(!_[_0xec78('0x4e')](_0x16d512[_0xec78('0x30')][_0xec78('0x4f')])){var _0x4754f8=_0x16d512['body'][_0xec78('0x4f')];if(!_[_0xec78('0x4e')](shared[_0xec78('0x50')][_0x4754f8]))_0x16d512[_0xec78('0x30')]['utcOffset']=shared[_0xec78('0x50')][_0x4754f8][_0xec78('0x51')];}return db[_0xec78('0x21')]['find']({'where':{'id':_0x16d512[_0xec78('0x5c')]['id']}})[_0xec78('0x15')](handleEntityNotFound(_0x1d0b4d,null))[_0xec78('0x15')](saveUpdates(_0x16d512['body'],null))[_0xec78('0x15')](function(_0x2293c9){_0x3cdf0c=_0x2293c9;var _0x3100be={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2293c9&&_0x2293c9['ListId']){if(_0x2293c9['ListId']){_0x3100be[_0xec78('0x58')]['$and'][_0xec78('0x57')]({'ListId':{'$ne':_0x2293c9[_0xec78('0x59')]}});}}return db[_0xec78('0x2a')][_0xec78('0x1d')](_0x3100be);})[_0xec78('0x15')](function(_0x321af6){if(_0x321af6){return _['omit'](_['pickBy'](_0x16d512[_0xec78('0x30')],function(_0x336568,_0x26f8d6){return _[_0xec78('0x26')](_0x26f8d6,_0xec78('0x27'));}),_[_0xec78('0x68')](_0x321af6,function(_0x448a82){return util[_0xec78('0x6a')](_0xec78('0x69'),_0x448a82['id']);}));}})['then'](function(_0x44d983){if(_0x44d983&&!_[_0xec78('0x6b')](_0x44d983)){var _0x3f3b90=squel[_0xec78('0x14')]()[_0xec78('0x6c')](_0xec78('0x6d'))[_0xec78('0x6e')](_0x44d983)[_0xec78('0x58')](_0xec78('0x6f'),_0x16d512['params']['id'])['toParam']();return db['sequelize'][_0xec78('0x1e')](_0x3f3b90[_0xec78('0x70')],{'replacements':_0x3f3b90['values']});}})[_0xec78('0x15')](function(){if(_0x16d512['body'][_0xec78('0x71')]&&_0x3cdf0c){return db['CmHopper']['update']({'phone':_0x16d512['body'][_0xec78('0x71')],'OrderBy':0x0},{'where':{'ContactId':_0x3cdf0c['id']}});}})[_0xec78('0x15')](function(){return _0x3cdf0c;})[_0xec78('0x15')](respondWithResult(_0x1d0b4d,null))['catch'](handleError(_0x1d0b4d,null));};exports['getTags']=function(_0x1c6f6b,_0x561eba){var _0x20a1ea={};var _0x469a9e={};var _0x5bbe32;var _0xd706ae;return db[_0xec78('0x21')][_0xec78('0x72')]({'where':{'id':_0x1c6f6b[_0xec78('0x5c')]['id']}})[_0xec78('0x15')](handleEntityNotFound(_0x561eba,null))['then'](function(_0x4373a6){if(_0x4373a6){_0x5bbe32=_0x4373a6;_0x469a9e[_0xec78('0x73')]=_[_0xec78('0x24')](db[_0xec78('0x5d')]['rawAttributes']);_0x469a9e[_0xec78('0x1e')]=_[_0xec78('0x24')](_0x1c6f6b[_0xec78('0x1e')]);_0x469a9e['filters']=_[_0xec78('0x74')](_0x469a9e['model'],_0x469a9e[_0xec78('0x1e')]);_0x20a1ea['attributes']=_[_0xec78('0x74')](_0x469a9e[_0xec78('0x73')],qs[_0xec78('0x75')](_0x1c6f6b['query'][_0xec78('0x75')]));_0x20a1ea[_0xec78('0x76')]=_0x20a1ea[_0xec78('0x76')]['length']?_0x20a1ea['attributes']:_0x469a9e[_0xec78('0x73')];_0x20a1ea[_0xec78('0x77')]=qs[_0xec78('0x78')](_0x1c6f6b[_0xec78('0x1e')][_0xec78('0x78')]);_0x20a1ea[_0xec78('0x58')]=qs['filters'](_[_0xec78('0x79')](_0x1c6f6b['query'],_0x469a9e['filters']));if(_0x1c6f6b['query'][_0xec78('0x7a')]){_0x20a1ea[_0xec78('0x58')]=_[_0xec78('0x7b')](_0x20a1ea[_0xec78('0x58')],{'$or':_[_0xec78('0x68')](_0x20a1ea[_0xec78('0x76')],function(_0x40fb37){var _0x66d90a={};_0x66d90a[_0x40fb37]={'$like':'%'+_0x1c6f6b[_0xec78('0x1e')][_0xec78('0x7a')]+'%'};return _0x66d90a;})});}_0x20a1ea=_['merge']({},_0x20a1ea,_0x1c6f6b['options']);return _0x5bbe32[_0xec78('0x7c')](_0x20a1ea);}})[_0xec78('0x15')](function(_0x5703f1){if(_0x5703f1){_0xd706ae=_0x5703f1[_0xec78('0x25')];if(!_0x1c6f6b[_0xec78('0x1e')][_0xec78('0x5a')](_0xec78('0x7d'))){_0x20a1ea[_0xec78('0x7e')]=qs['limit'](_0x1c6f6b[_0xec78('0x1e')][_0xec78('0x7e')]);_0x20a1ea[_0xec78('0x10')]=qs[_0xec78('0x10')](_0x1c6f6b[_0xec78('0x1e')][_0xec78('0x10')]);}return _0x5bbe32[_0xec78('0x7c')](_0x20a1ea);}})['then'](function(_0x3998fc){if(_0x3998fc){return _0x3998fc?{'count':_0xd706ae,'rows':_0x3998fc}:null;}})[_0xec78('0x15')](respondWithResult(_0x561eba,null))['catch'](handleError(_0x561eba,null));};exports[_0xec78('0x7f')]=function(_0x17d762,_0x31b235){if(_0x17d762['body']['id']){delete _0x17d762[_0xec78('0x30')]['id'];}return db[_0xec78('0x21')][_0xec78('0x72')]({'where':{'id':_0x17d762[_0xec78('0x5c')]['id']}})[_0xec78('0x15')](handleEntityNotFound(_0x31b235,null))[_0xec78('0x15')](function(_0x3353fc){if(_0x3353fc){return _0x3353fc[_0xec78('0x7f')](_0x17d762[_0xec78('0x30')][_0xec78('0x80')]||[]);}return null;})['then'](respondWithResult(_0x31b235,null))[_0xec78('0x22')](handleError(_0x31b235,null));};exports[_0xec78('0x81')]=function(_0x32e2ce,_0x18825b){var _0x1fdd13=[];_0x1fdd13[_0xec78('0x57')](addAdditionalPhones(_0x32e2ce[_0xec78('0x30')]));Promise['all'](_0x1fdd13)[_0xec78('0x15')](function(){_0x1fdd13=[];_0x1fdd13['push'](deleteCmHopperPhones(_0x32e2ce[_0xec78('0x30')]['id']));_0x1fdd13['push'](addCmHopperPhones(_0x32e2ce[_0xec78('0x30')]['id']));Promise[_0xec78('0x5b')](_0x1fdd13)[_0xec78('0x15')](function(){return[0x1];})['then'](respondWithResult(_0x18825b,null));});};function addAdditionalPhones(_0x10df27){var _0x2fd590;return new Promise(function(_0x592d65){return db['CmContactHasItem'][_0xec78('0x20')]({'where':{'CmContactId':_0x10df27['id']}})[_0xec78('0x15')](function(){db[_0xec78('0x62')][_0xec78('0x1d')]({'raw':!![],'attributes':['id',_0xec78('0x82')]})['then'](function(_0x59226a){var _0x334472=[];for(var _0x3dd048=0x0;_0x3dd048<_0x10df27['items'][_0xec78('0x25')];_0x3dd048++){var _0x37739d=_0x10df27[_0xec78('0x83')]?_[_0xec78('0x4e')](_0x10df27[_0xec78('0x83')][_0x3dd048])?'':_0x10df27[_0xec78('0x83')][_0x3dd048]:_0x10df27[_0xec78('0x84')][_0x3dd048][_0xec78('0x85')]?_0x10df27[_0xec78('0x84')][_0x3dd048][_0xec78('0x85')]:'';var _0x51e781=_[_0xec78('0x4e')](_0x10df27[_0xec78('0x84')][_0x3dd048]['description'])?'':_0x10df27[_0xec78('0x84')][_0x3dd048][_0xec78('0x86')];var _0x1220c7=_0x37739d+':'+_0x10df27[_0xec78('0x84')][_0x3dd048][_0xec78('0x71')]+'§'+_0x51e781;if(_[_0xec78('0x4e')](_0x2fd590))_0x2fd590=_0x1220c7;else _0x2fd590+=';'+_0x1220c7;var _0x2620fa=null;var _0x58dbcb=null;if(_0x10df27[_0xec78('0x83')]){if(!_[_0xec78('0x4e')](_0x10df27[_0xec78('0x83')][_0x3dd048])){_0x58dbcb=_[_0xec78('0x87')](_0x59226a,function(_0x324236){return _0x324236['id']===_0x10df27['item_types'][_0x3dd048];});if(!_[_0xec78('0x4e')](_0x58dbcb)){_0x2620fa=_0x58dbcb[_0xec78('0x82')];}}}else{if(!_[_0xec78('0x4e')](_0x10df27[_0xec78('0x84')][_0x3dd048])){_0x58dbcb=_[_0xec78('0x87')](_0x59226a,function(_0x311de3){return _0x311de3['id']===_0x10df27[_0xec78('0x84')][_0x3dd048][_0xec78('0x85')];});if(!_[_0xec78('0x4e')](_0x58dbcb)){_0x2620fa=_0x3dd048;}}}if(_[_0xec78('0x4e')](_0x2620fa)){_0x2620fa=0x64;}_0x334472[_0xec78('0x57')](addAdditionalPhone(_0x10df27['id'],_0x10df27[_0xec78('0x84')][_0x3dd048][_0xec78('0x71')],_0x10df27[_0xec78('0x83')]?_[_0xec78('0x4e')](_0x10df27[_0xec78('0x83')][_0x3dd048])?null:_0x10df27[_0xec78('0x83')][_0x3dd048]:_0x10df27[_0xec78('0x84')][_0x3dd048][_0xec78('0x85')]?_0x10df27[_0xec78('0x84')][_0x3dd048]['ItemTypeId']:null,_0x2620fa,_0x51e781));}Promise[_0xec78('0x5b')](_0x334472)[_0xec78('0x15')](function(){db[_0xec78('0x21')][_0xec78('0x14')]({'AdditionalPhones':_0x2fd590},{'where':{'id':_0x10df27['id']}})[_0xec78('0x15')](function(){_0x592d65(0x1);});});});});});}function addAdditionalPhone(_0xe5ebd5,_0x46f51f,_0x1a088f,_0x13ee87,_0x48fc1a){return db[_0xec78('0x42')]['find']({'where':{'CmContactId':_0xe5ebd5,'item':_0x46f51f}})['then'](function(_0x2d7482){if(_0x2d7482)logger[_0xec78('0x2e')](_0xec78('0x88'),_0x2d7482);else{db['CmContactHasItem'][_0xec78('0x39')]({'CmContactId':_0xe5ebd5,'item':_0x46f51f,'ItemTypeId':_0x1a088f,'OrderBy':_0x13ee87,'ItemClass':_0xec78('0x89'),'description':_0x48fc1a});}});}function deleteCmHopperPhones(_0x22a55b){return new Promise(function(_0x4ef742){return db[_0xec78('0x35')][_0xec78('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x22a55b}})[_0xec78('0x15')](function(_0xcf418){db[_0xec78('0x8a')][_0xec78('0x20')]({'where':{'CmHopperId':{'$in':_['map'](_0xcf418,'id')}}});})[_0xec78('0x15')](function(){_0x4ef742(0x1);});});}function addCmHopperPhones(_0x310e82){return new Promise(function(_0x22f879){return db[_0xec78('0x35')][_0xec78('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x310e82}})[_0xec78('0x15')](function(_0x2aeb3e){var _0x3e34dd=[];_[_0xec78('0x68')](_0x2aeb3e,function(_0x4a0a63){_0x3e34dd[_0xec78('0x57')](createCmHopperPhone(_0x310e82,_0x4a0a63['id']));});Promise[_0xec78('0x5b')](_0x3e34dd)[_0xec78('0x15')](function(){_0x22f879(0x1);});});});}function createCmHopperPhone(_0x158538,_0x3fa3f3){return new Promise(function(_0x54a0fb){db[_0xec78('0x42')][_0xec78('0x1d')]({'raw':!![],'attributes':['item',_0xec78('0x82')],'where':{'CmContactId':_0x158538,'ItemClass':_0xec78('0x89')},'include':[{'model':db[_0xec78('0x62')],'attributes':['OrderBy'],'as':_0xec78('0x63')}],'order':['OrderBy',db['sequelize']['literal']('`ItemType`.OrderBy')]})[_0xec78('0x15')](function(_0x574611){var _0x594e4e=0x1;var _0x4735b0=_[_0xec78('0x68')](_0x574611,function(_0x7a261f){_0x7a261f[_0xec78('0x8b')]=_0x3fa3f3;_0x7a261f[_0xec78('0x71')]=_0x7a261f[_0xec78('0x8c')];_0x7a261f[_0xec78('0x82')]=_0x594e4e;delete _0x7a261f['ItemType.OrderBy'];_0x594e4e=_0x594e4e+0x1;return _0x7a261f;});return db[_0xec78('0x8a')][_0xec78('0x53')](_0x4735b0,{});})[_0xec78('0x15')](function(){_0x54a0fb(0x1);});});}function insertAdditionalPhones(_0x5be8bc,_0xd9e9c8){return new Promise(function(_0x158669){var _0x2cab0c=[];for(var _0x5cdaca=0x0;_0x5cdaca<_0xd9e9c8[_0xec78('0x25')];_0x5cdaca++){var _0x290757=_0xd9e9c8[_0x5cdaca];_0x2cab0c['push'](parseContactItemType(_0x290757));}Promise[_0xec78('0x5b')](_0x2cab0c)[_0xec78('0x15')](function(){var _0x59c005={'id':_0x5be8bc['id'],'items':_0xd9e9c8};return addAdditionalPhones(_0x59c005)[_0xec78('0x15')](function(){return addCmHopperPhones(_0x5be8bc['id']);});})['then'](function(){_0x158669(_0x5be8bc);});});}function parseContactItemType(_0x120664){return new Promise(function(_0x1bbd1d){if(_0x120664[_0xec78('0x5a')](_0xec78('0x85'))){_0x1bbd1d(_0x120664);}else{return db[_0xec78('0x62')][_0xec78('0x87')]({'where':{'name':_0x120664['ItemType']}})[_0xec78('0x15')](function(_0x5a79c8){if(_[_0xec78('0x4e')](_0x5a79c8))_0x120664['ItemTypeId']=null;else _0x120664[_0xec78('0x85')]=_0x5a79c8['id'];_0x1bbd1d(_0x120664);});}});}exports[_0xec78('0x8d')]=function(_0x7c599,_0x137451){return db[_0xec78('0x42')][_0xec78('0x1d')]({'raw':!![],'where':{'CmContactId':_0x7c599[_0xec78('0x5c')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xec78('0x62')],'as':_0xec78('0x63')}],'order':[[_0xec78('0x82')],[db[_0xec78('0x64')]['literal'](_0xec78('0x8e'))]]})['then'](function(_0xa2d03e){return _0xa2d03e;})[_0xec78('0x15')](respondWithResult(_0x137451,null))[_0xec78('0x22')](handleError(_0x137451,null));};exports[_0xec78('0x8f')]=function(_0x1a5212,_0x596396){return db['CmContactHasItem'][_0xec78('0x1d')]({'raw':!![],'where':{'CmContactId':_0x1a5212[_0xec78('0x30')][_0xec78('0x90')]}})[_0xec78('0x15')](function(_0x3e7db8){var _0x1677db=_[_0xec78('0x68')](_0x3e7db8,function(_0x529710){_0x529710[_0xec78('0x91')]=_0x1a5212['body']['toContactId'];return _0x529710;});return db['CmContactHasItem'][_0xec78('0x53')](_0x1677db,{});})['then'](function(){return addCmHopperPhones(_0x1a5212[_0xec78('0x30')]['toContactId']);})[_0xec78('0x15')](function(){return['ok'];})[_0xec78('0x15')](respondWithResult(_0x596396,null))['catch'](handleError(_0x596396,null));};exports['rescheduleAdditionalPhones']=function(_0x97ad6a,_0x2708e6){var _0x33094c=[];_0x33094c[_0xec78('0x57')](createCmHopperPhone(_0x97ad6a[_0xec78('0x30')]['id'],_0x97ad6a[_0xec78('0x30')][_0xec78('0x92')]));Promise[_0xec78('0x5b')](_0x33094c)[_0xec78('0x15')](function(){return[0x1];})[_0xec78('0x15')](respondWithResult(_0x2708e6,null));};exports[_0xec78('0x93')]=function(_0x57fd45,_0x2f6a18){var _0x4ce500={'raw':![],'where':{}};var _0x267ceb={};var _0x107ea9={'count':0x0,'rows':[]};return db[_0xec78('0x21')]['findOne']({'where':{'id':_0x57fd45[_0xec78('0x5c')]['id']}})[_0xec78('0x15')](handleEntityNotFound(_0x2f6a18,null))[_0xec78('0x15')](function(_0x5df85d){if(_0x5df85d){_0x267ceb['model']=_['keys'](db[_0xec78('0x35')][_0xec78('0x94')]);_0x267ceb[_0xec78('0x1e')]=_[_0xec78('0x24')](_0x57fd45[_0xec78('0x1e')]);_0x267ceb[_0xec78('0x95')]=_[_0xec78('0x74')](_0x267ceb[_0xec78('0x73')],_0x267ceb[_0xec78('0x1e')]);_0x4ce500[_0xec78('0x76')]=_[_0xec78('0x74')](_0x267ceb[_0xec78('0x73')],qs[_0xec78('0x75')](_0x57fd45['query'][_0xec78('0x75')]));_0x4ce500[_0xec78('0x76')]=_0x4ce500['attributes'][_0xec78('0x25')]?_0x4ce500[_0xec78('0x76')]:_0x267ceb[_0xec78('0x73')];if(!_0x57fd45[_0xec78('0x1e')][_0xec78('0x5a')](_0xec78('0x7d'))){_0x4ce500[_0xec78('0x7e')]=qs[_0xec78('0x7e')](_0x57fd45[_0xec78('0x1e')][_0xec78('0x7e')]);_0x4ce500['offset']=qs[_0xec78('0x10')](_0x57fd45[_0xec78('0x1e')][_0xec78('0x10')]);}_0x4ce500[_0xec78('0x77')]=qs['sort'](_0x57fd45[_0xec78('0x1e')][_0xec78('0x78')]);_0x4ce500[_0xec78('0x58')]=qs[_0xec78('0x95')](_[_0xec78('0x79')](_0x57fd45[_0xec78('0x1e')],_0x267ceb[_0xec78('0x95')]));_0x4ce500[_0xec78('0x58')][_0xec78('0x96')]=_0x5df85d['id'];if(_0x57fd45[_0xec78('0x1e')]['filter']){_0x4ce500['where']=_[_0xec78('0x7b')](_0x4ce500[_0xec78('0x58')],{'$or':_[_0xec78('0x68')](_0x4ce500[_0xec78('0x76')],function(_0x19b6f5){var _0x24f225={};_0x24f225[_0x19b6f5]={'$like':'%'+_0x57fd45[_0xec78('0x1e')][_0xec78('0x7a')]+'%'};return _0x24f225;})});}_0x4ce500=_[_0xec78('0x7b')]({},_0x4ce500,_0x57fd45['options']);return db[_0xec78('0x35')][_0xec78('0x12')]({'where':_0x4ce500[_0xec78('0x58')]})['then'](function(_0x5849b6){_0x107ea9[_0xec78('0x12')]=_0x5849b6;if(_0x57fd45['query'][_0xec78('0x97')]){_0x4ce500[_0xec78('0x98')]=[{'all':!![]}];}return db[_0xec78('0x35')]['findAll'](_0x4ce500);})[_0xec78('0x15')](function(_0x357eb7){_0x107ea9[_0xec78('0x99')]=_0x357eb7;return _0x107ea9;});}})[_0xec78('0x15')](respondWithFilteredResult(_0x2f6a18,_0x4ce500))['catch'](handleError(_0x2f6a18,null));};exports[_0xec78('0x9a')]=function(_0xee796e,_0xefe746){var _0x327bd3={'raw':!![],'where':{}};var _0x1ddc18={};var _0x39e721={'count':0x0,'rows':[]};return db[_0xec78('0x21')][_0xec78('0x72')]({'where':{'id':_0xee796e[_0xec78('0x5c')]['id']}})[_0xec78('0x15')](handleEntityNotFound(_0xefe746,null))[_0xec78('0x15')](function(_0x270ac7){if(_0x270ac7){_0x1ddc18[_0xec78('0x73')]=_[_0xec78('0x24')](db[_0xec78('0x44')]['rawAttributes']);_0x1ddc18[_0xec78('0x1e')]=_['keys'](_0xee796e[_0xec78('0x1e')]);_0x1ddc18[_0xec78('0x95')]=_[_0xec78('0x74')](_0x1ddc18[_0xec78('0x73')],_0x1ddc18[_0xec78('0x1e')]);_0x327bd3[_0xec78('0x76')]=_[_0xec78('0x74')](_0x1ddc18[_0xec78('0x73')],qs['fields'](_0xee796e[_0xec78('0x1e')][_0xec78('0x75')]));_0x327bd3['attributes']=_0x327bd3['attributes'][_0xec78('0x25')]?_0x327bd3[_0xec78('0x76')]:_0x1ddc18[_0xec78('0x73')];if(!_0xee796e[_0xec78('0x1e')][_0xec78('0x5a')](_0xec78('0x7d'))){_0x327bd3['limit']=qs[_0xec78('0x7e')](_0xee796e[_0xec78('0x1e')][_0xec78('0x7e')]);_0x327bd3[_0xec78('0x10')]=qs[_0xec78('0x10')](_0xee796e[_0xec78('0x1e')][_0xec78('0x10')]);}_0x327bd3[_0xec78('0x77')]=qs['sort'](_0xee796e['query'][_0xec78('0x78')]);_0x327bd3['where']=qs[_0xec78('0x95')](_['pick'](_0xee796e['query'],_0x1ddc18[_0xec78('0x95')]));_0x327bd3[_0xec78('0x58')][_0xec78('0x96')]=_0x270ac7['id'];if(_0xee796e['query'][_0xec78('0x7a')]){_0x327bd3[_0xec78('0x58')]=_[_0xec78('0x7b')](_0x327bd3[_0xec78('0x58')],{'$or':_[_0xec78('0x68')](_0x327bd3[_0xec78('0x76')],function(_0x310837){var _0x52ba2a={};_0x52ba2a[_0x310837]={'$like':'%'+_0xee796e[_0xec78('0x1e')]['filter']+'%'};return _0x52ba2a;})});}_0x327bd3=_[_0xec78('0x7b')]({},_0x327bd3,_0xee796e[_0xec78('0x9b')]);return db[_0xec78('0x44')][_0xec78('0x12')]({'where':_0x327bd3['where']})[_0xec78('0x15')](function(_0x23b277){_0x39e721[_0xec78('0x12')]=_0x23b277;if(_0xee796e[_0xec78('0x1e')][_0xec78('0x97')]){_0x327bd3[_0xec78('0x98')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xec78('0x1d')](_0x327bd3);})[_0xec78('0x15')](function(_0x21c208){_0x39e721[_0xec78('0x99')]=_0x21c208;return _0x39e721;});}})[_0xec78('0x15')](respondWithFilteredResult(_0xefe746,_0x327bd3))[_0xec78('0x22')](handleError(_0xefe746,null));};exports[_0xec78('0x9c')]=function(_0x5cb65d,_0x7cef82){var _0x2a5c81={'raw':!![],'where':{}};var _0x2f052a={};var _0x305339={'count':0x0,'rows':[]};return db[_0xec78('0x21')][_0xec78('0x72')]({'where':{'id':_0x5cb65d[_0xec78('0x5c')]['id']}})[_0xec78('0x15')](handleEntityNotFound(_0x7cef82,null))['then'](function(_0x48a351){if(_0x48a351){_0x2f052a[_0xec78('0x73')]=_[_0xec78('0x24')](db['CmHopperFinal'][_0xec78('0x94')]);_0x2f052a[_0xec78('0x1e')]=_[_0xec78('0x24')](_0x5cb65d[_0xec78('0x1e')]);_0x2f052a[_0xec78('0x95')]=_[_0xec78('0x74')](_0x2f052a[_0xec78('0x73')],_0x2f052a[_0xec78('0x1e')]);_0x2a5c81[_0xec78('0x76')]=_[_0xec78('0x74')](_0x2f052a[_0xec78('0x73')],qs[_0xec78('0x75')](_0x5cb65d[_0xec78('0x1e')][_0xec78('0x75')]));_0x2a5c81[_0xec78('0x76')]=_0x2a5c81[_0xec78('0x76')][_0xec78('0x25')]?_0x2a5c81[_0xec78('0x76')]:_0x2f052a[_0xec78('0x73')];if(!_0x5cb65d[_0xec78('0x1e')][_0xec78('0x5a')](_0xec78('0x7d'))){_0x2a5c81['limit']=qs['limit'](_0x5cb65d[_0xec78('0x1e')][_0xec78('0x7e')]);_0x2a5c81[_0xec78('0x10')]=qs['offset'](_0x5cb65d['query'][_0xec78('0x10')]);}_0x2a5c81[_0xec78('0x77')]=qs[_0xec78('0x78')](_0x5cb65d['query'][_0xec78('0x78')]);_0x2a5c81[_0xec78('0x58')]=qs[_0xec78('0x95')](_['pick'](_0x5cb65d['query'],_0x2f052a['filters']));_0x2a5c81[_0xec78('0x58')][_0xec78('0x96')]=_0x48a351['id'];if(_0x5cb65d['query'][_0xec78('0x7a')]){_0x2a5c81['where']=_[_0xec78('0x7b')](_0x2a5c81[_0xec78('0x58')],{'$or':_[_0xec78('0x68')](_0x2a5c81[_0xec78('0x76')],function(_0x554cff){var _0x2f8c6f={};_0x2f8c6f[_0x554cff]={'$like':'%'+_0x5cb65d['query'][_0xec78('0x7a')]+'%'};return _0x2f8c6f;})});}_0x2a5c81=_['merge']({},_0x2a5c81,_0x5cb65d[_0xec78('0x9b')]);return db['CmHopperFinal']['count']({'where':_0x2a5c81[_0xec78('0x58')]})[_0xec78('0x15')](function(_0x4176c6){_0x305339[_0xec78('0x12')]=_0x4176c6;if(_0x5cb65d['query'][_0xec78('0x97')]){_0x2a5c81[_0xec78('0x98')]=[{'all':!![]}];}return db[_0xec78('0x43')][_0xec78('0x1d')](_0x2a5c81);})[_0xec78('0x15')](function(_0x386109){_0x305339[_0xec78('0x99')]=_0x386109;return _0x305339;});}})['then'](respondWithFilteredResult(_0x7cef82,_0x2a5c81))['catch'](handleError(_0x7cef82,null));};exports[_0xec78('0x9d')]=function(_0x43305a,_0x4d62c7){var _0x1a1dbf={'raw':!![],'where':{}};var _0x52619d={};var _0x31db9c={'count':0x0,'rows':[]};return db[_0xec78('0x21')][_0xec78('0x72')]({'where':{'id':_0x43305a[_0xec78('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4d62c7,null))['then'](function(_0x26152f){if(_0x26152f){_0x52619d['model']=_['keys'](db['JscriptySessionReport'][_0xec78('0x94')]);_0x52619d[_0xec78('0x1e')]=_[_0xec78('0x24')](_0x43305a[_0xec78('0x1e')]);_0x52619d[_0xec78('0x95')]=_[_0xec78('0x74')](_0x52619d[_0xec78('0x73')],_0x52619d[_0xec78('0x1e')]);_0x1a1dbf[_0xec78('0x76')]=_['intersection'](_0x52619d[_0xec78('0x73')],qs['fields'](_0x43305a[_0xec78('0x1e')]['fields']));_0x1a1dbf[_0xec78('0x76')]=_0x1a1dbf[_0xec78('0x76')][_0xec78('0x25')]?_0x1a1dbf[_0xec78('0x76')]:_0x52619d[_0xec78('0x73')];if(!_0x43305a[_0xec78('0x1e')][_0xec78('0x5a')]('nolimit')){_0x1a1dbf['limit']=qs[_0xec78('0x7e')](_0x43305a[_0xec78('0x1e')][_0xec78('0x7e')]);_0x1a1dbf[_0xec78('0x10')]=qs[_0xec78('0x10')](_0x43305a[_0xec78('0x1e')]['offset']);}_0x1a1dbf[_0xec78('0x77')]=qs[_0xec78('0x78')](_0x43305a['query'][_0xec78('0x78')]);_0x1a1dbf[_0xec78('0x58')]=qs[_0xec78('0x95')](_[_0xec78('0x79')](_0x43305a[_0xec78('0x1e')],_0x52619d[_0xec78('0x95')]));_0x1a1dbf['where']['ContactId']=_0x26152f['id'];if(_0x43305a['query'][_0xec78('0x7a')]){_0x1a1dbf['where']=_['merge'](_0x1a1dbf['where'],{'$or':_[_0xec78('0x68')](_0x1a1dbf[_0xec78('0x76')],function(_0x5f4bc0){var _0x2fdb94={};_0x2fdb94[_0x5f4bc0]={'$like':'%'+_0x43305a[_0xec78('0x1e')][_0xec78('0x7a')]+'%'};return _0x2fdb94;})});}_0x1a1dbf=_[_0xec78('0x7b')]({},_0x1a1dbf,_0x43305a[_0xec78('0x9b')]);return db[_0xec78('0x4a')][_0xec78('0x12')]({'where':_0x1a1dbf[_0xec78('0x58')]})[_0xec78('0x15')](function(_0x421316){_0x31db9c[_0xec78('0x12')]=_0x421316;if(_0x43305a[_0xec78('0x1e')][_0xec78('0x97')]){_0x1a1dbf[_0xec78('0x98')]=[{'all':!![]}];}return db[_0xec78('0x4a')][_0xec78('0x1d')](_0x1a1dbf);})['then'](function(_0x4fa659){_0x31db9c[_0xec78('0x99')]=_0x4fa659;return _0x31db9c;});}})[_0xec78('0x15')](respondWithFilteredResult(_0x4d62c7,_0x1a1dbf))[_0xec78('0x22')](handleError(_0x4d62c7,null));};exports[_0xec78('0x9e')]=function(_0x525c01,_0x153c5a){try{if(!_0x525c01['body'][_0xec78('0x59')]){throw new Error('No\x20ListId\x20specified');}if(!_0x525c01[_0xec78('0x30')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x525c01[_0xec78('0x30')][_0xec78('0x9f')]){throw new Error(_0xec78('0xa0'));}if(!_0x525c01[_0xec78('0x30')][_0xec78('0xa1')]){throw new Error(_0xec78('0xa2'));}var _0x42a0e9=_0x525c01['body'][_0xec78('0xa3')][_0xec78('0xa4')](',');var _0x456801=_0x525c01['body'][_0xec78('0x9f')]['split'](',');if(!_0x42a0e9[_0xec78('0x25')]||!_0x456801['length']||_0x42a0e9[_0xec78('0x25')]!==_0x456801[_0xec78('0x25')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x525c01[_0xec78('0x30')][_0xec78('0x75')]=_[_0xec78('0xa5')](_0x42a0e9,_0x456801);if(!_0x525c01['body']['fields']['phone']){throw new Error(_0xec78('0xa6'));}if(!_0x525c01[_0xec78('0x30')][_0xec78('0x75')][_0xec78('0xa7')]){throw new Error(_0xec78('0xa8'));}var _0x3cfe73=path['join'](config['root'],_0xec78('0xa9'),_0x525c01[_0xec78('0xaa')]['filename']);fs['chmodSync'](_0x3cfe73,parseInt(_0xec78('0xab'),0x8));var _0x108e36=require(_0xec78('0xac'))[_0xec78('0xad')](path[_0xec78('0x4d')](__dirname,'../../components/import/cm/csv'),[_0x3cfe73,_0x525c01[_0xec78('0x30')][_0xec78('0xa3')],_0x525c01[_0xec78('0x30')][_0xec78('0x9f')],_0x525c01['body']['ListId'],_0x525c01[_0xec78('0x30')][_0xec78('0xae')],_0x525c01['body']['duplicates'],_0x525c01[_0xec78('0x30')][_0xec78('0xa1')]]);return _0x153c5a[_0xec78('0xe')](0xc8)[_0xec78('0xf')]({'message':'File\x20uploaded\x20correctly!','pid':_0x108e36[_0xec78('0xaf')]});}catch(_0x1b717e){return _0x153c5a[_0xec78('0xe')](0x1f4)['send'](_0x1b717e);}};exports[_0xec78('0xb0')]=function(_0x2a13da,_0xe2043){var _0x23c7ee=fs[_0xec78('0xb1')](_0x2a13da[_0xec78('0xaa')][_0xec78('0x2')]);Papa[_0xec78('0xb2')](_0x23c7ee,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3dd212){return _0xe2043[_0xec78('0xe')](0xc8)[_0xec78('0xf')]({'file':_0x2a13da[_0xec78('0xaa')],'fields':_0x3dd212['meta'][_0xec78('0x75')]});}});};exports[_0xec78('0xb3')]=function(_0x210962,_0x3367f1){return db[_0xec78('0xb4')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xec78('0x15')](function(_0x1a1dfd){var _0x4919ff=![];if(!_0x210962['body'][_0xec78('0x59')]){throw new Error('No\x20ListId\x20specified');}if(!_0x210962[_0xec78('0x30')]['binding'][_0xec78('0x71')]){throw new Error(_0xec78('0xa6'));}if(!_0x210962[_0xec78('0x30')][_0xec78('0xb5')]['firstName']){throw new Error(_0xec78('0xa8'));}if(!_0x210962['body']['socket_timestamp']){throw new Error(_0xec78('0xa2'));}var _0x9373fa=require(_0xec78('0xac'))[_0xec78('0xad')](path[_0xec78('0x4d')](__dirname,'../../components/import/cm/csv2'),[_0x210962[_0xec78('0x5c')]['id'],JSON[_0xec78('0xb6')](_0x210962[_0xec78('0x30')]),JSON['stringify'](_0x1a1dfd)]);_0x9373fa['on'](_0xec78('0xb7'),function(){_0x4919ff=!![];return _0x3367f1[_0xec78('0xe')](0xc8)[_0xec78('0xf')]({'message':_0xec78('0xb8'),'pid':_0x9373fa[_0xec78('0xaf')]});});_0x9373fa['on'](_0xec78('0xb9'),function(_0x2f8574){if(_0x2f8574&&!_0x4919ff){return _0x3367f1['status'](0x1f4)[_0xec78('0xf')]({'message':_0xec78('0xba'),'pid':_0x9373fa['pid']});}});})[_0xec78('0x22')](handleError(_0x3367f1,null));};exports[_0xec78('0xbb')]=function(_0x5f59d9,_0x267bb8){return db['User'][_0xec78('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xec78('0xbc')}})[_0xec78('0x15')](function(_0xe03b72){var _0x32a492=![];if(!_0x5f59d9[_0xec78('0x30')][_0xec78('0x59')]){throw new Error(_0xec78('0xbd'));}if(!_0x5f59d9[_0xec78('0x30')][_0xec78('0xb5')][_0xec78('0x71')]){throw new Error(_0xec78('0xa6'));}if(!_0x5f59d9[_0xec78('0x30')][_0xec78('0xb5')][_0xec78('0xa7')]){throw new Error(_0xec78('0xa8'));}if(!_0x5f59d9[_0xec78('0x30')][_0xec78('0xa1')]){throw new Error(_0xec78('0xa2'));}var _0x309a94=require(_0xec78('0xac'))[_0xec78('0xad')](path[_0xec78('0x4d')](__dirname,_0xec78('0xbe')),[_0x5f59d9[_0xec78('0x5c')]['id'],JSON['stringify'](_0x5f59d9[_0xec78('0x30')]),JSON[_0xec78('0xb6')](_0xe03b72)]);_0x309a94['on'](_0xec78('0xb7'),function(){_0x32a492=!![];return _0x267bb8[_0xec78('0xe')](0xc8)[_0xec78('0xf')]({'message':_0xec78('0xb8'),'pid':_0x309a94[_0xec78('0xaf')]});});_0x309a94['on']('exit',function(_0x193237){if(_0x193237&&!_0x32a492){return _0x267bb8[_0xec78('0xe')](0x1f4)[_0xec78('0xf')]({'message':_0xec78('0xba'),'pid':_0x309a94['pid']});}});})[_0xec78('0x22')](handleError(_0x267bb8,null));};exports[_0xec78('0xbf')]=function(_0x36fc4a,_0x301b8d){var _0x144013=['mail','chat',_0xec78('0xc0'),_0xec78('0xc1'),_0xec78('0xc2'),'whatsapp',_0xec78('0xc3')];var _0x37c8c6={'offset':0x0,'order':qs[_0xec78('0x78')](_0xec78('0xc4'))},_0x2b4407={'count':0x0,'rows':[]};Promise[_0xec78('0xc5')]()[_0xec78('0x15')](function(){if(_0x36fc4a[_0xec78('0x1e')][_0xec78('0xc6')]){if(!_[_0xec78('0xc7')](_0x144013,_0x36fc4a['query']['channel'][_0xec78('0xc8')]())){throw new Error(_0xec78('0xc9'));}_0x144013=[_0x36fc4a[_0xec78('0x1e')][_0xec78('0xc6')]['toLowerCase']()];}if(_0x36fc4a[_0xec78('0x1e')][_0xec78('0xca')]){try{var _0x521370=JSON[_0xec78('0xb2')](_0x36fc4a['query']['range']);if(!moment(_0x521370['from'])[_0xec78('0xcb')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x521370['to'])[_0xec78('0xcb')]()){throw new Error(_0xec78('0xcc'));}}catch(_0x41e10b){throw new Error(_0xec78('0xcd'));}}if(!_0x36fc4a[_0xec78('0x1e')]['hasOwnProperty'](_0xec78('0x7d'))){_0x37c8c6['limit']=qs[_0xec78('0x7e')](_0x36fc4a['query']['limit']||0xa);_0x37c8c6[_0xec78('0x10')]=qs[_0xec78('0x10')](_0x36fc4a[_0xec78('0x1e')][_0xec78('0x10')]);}var _0x52ef24=_0x144013[_0xec78('0x68')](function(_0x449ede){if(_0x449ede===_0xec78('0xc3')){var _0x4d5297={'attributes':['id','uniqueid',_0xec78('0x2d'),_0xec78('0xce'),'destination',_0xec78('0xcf'),'starttime',_0xec78('0xd0'),'duration',_0xec78('0xd1'),_0xec78('0xd2'),'userDisposition',_0xec78('0xd3'),_0xec78('0xd4'),_0xec78('0xd5')],'where':{'ContactId':_0x36fc4a['params']['id']},'include':[{'model':db[_0xec78('0xb4')],'as':'User','attributes':['id','name',_0xec78('0xd6'),_0xec78('0x2b')]}],'order':[[_0xec78('0xd2'),_0xec78('0xd7')]]};if(_0x36fc4a[_0xec78('0x1e')][_0xec78('0xca')]){_0x4d5297[_0xec78('0x58')][_0xec78('0xd2')]={'$gte':_0x521370[_0xec78('0x31')],'$lte':_0x521370['to']};}return db[_0xec78('0xd8')]['findAndCountAll'](_0x4d5297)[_0xec78('0x15')](function(_0x46da33){_0x2b4407['count']+=_0x46da33[_0xec78('0x12')];return _[_0xec78('0x68')](_0x46da33[_0xec78('0x99')],function(_0x5bbb8c){var _0x3d69c5=_0x5bbb8c[_0xec78('0x32')]({'plain':!![]});_0x3d69c5['channel']=_0x449ede;if(_0x3d69c5['User']){_0x3d69c5[_0xec78('0xb4')]={'id':_0x3d69c5[_0xec78('0xb4')]['id'],'name':_0x3d69c5[_0xec78('0xb4')][_0xec78('0x18')],'fullname':_0x3d69c5['User'][_0xec78('0xd6')],'alias':_0x3d69c5[_0xec78('0xb4')][_0xec78('0x2b')]};}return _0x3d69c5;});});}else{var _0xb6ebdc=_[_0xec78('0xd9')](_0x449ede)+(_0x449ede===_0xec78('0xda')?'Website':_0xec78('0xdb'));var _0x137e76={'attributes':['id','closed','closedAt',_0xec78('0xd2'),_0xec78('0xd1'),'disposition',_0xec78('0xdc'),_0xec78('0xdd'),_0xec78('0xd5'),_0xb6ebdc+'Id'],'where':{'ContactId':_0x36fc4a[_0xec78('0x5c')]['id']},'include':[{'model':db[_0xb6ebdc],'as':_0xec78('0xdb'),'attributes':['id','name',_0xec78('0xde')]},{'model':db[_0xec78('0xb4')],'as':_0xec78('0xdf'),'attributes':['id',_0xec78('0x18'),_0xec78('0xd6')]},{'model':db['Tag'],'as':_0xec78('0x5e'),'attributes':['id',_0xec78('0x18'),_0xec78('0x5f')],'through':{'attributes':[]}}],'order':[[_0xec78('0xd2'),_0xec78('0xd7')]]};if(_0x36fc4a['query'][_0xec78('0xca')]){_0x137e76[_0xec78('0x58')]['createdAt']={'$gte':_0x521370[_0xec78('0x31')],'$lte':_0x521370['to']};}switch(_0x449ede){case _0xec78('0xda'):_0x137e76[_0xec78('0x76')][_0xec78('0x57')](_0xec78('0xe0'),_0xec78('0xe1'),'customerPort',_0xec78('0xe2'),_0xec78('0xe3'),_0xec78('0xe4'),'ratingType',_0xec78('0xe5'),_0xec78('0xe6'));break;case _0xec78('0xe7'):_0x137e76[_0xec78('0x76')][_0xec78('0x57')](_0xec78('0xe8'),_0xec78('0xe9'));break;case'openchannel':_0x137e76[_0xec78('0x76')][_0xec78('0x57')]('externalUrl',_0xec78('0xea'));break;}return db[_[_0xec78('0xd9')](_0x449ede)+'Interaction'][_0xec78('0xeb')](_0x137e76)[_0xec78('0x15')](function(_0x49bbb5){_0x2b4407[_0xec78('0x12')]+=_0x49bbb5[_0xec78('0x12')];return _[_0xec78('0x68')](_0x49bbb5[_0xec78('0x99')],function(_0x4cd0){var _0xbcbba=_0x4cd0[_0xec78('0x32')]({'plain':!![]});_0xbcbba[_0xec78('0xc6')]=_0x449ede;if(_0xbcbba[_0xec78('0xdf')]){_0xbcbba[_0xec78('0xdf')]={'id':_0xbcbba[_0xec78('0xdf')]['id'],'name':_0xbcbba[_0xec78('0xdf')][_0xec78('0x18')],'fullname':_0xbcbba[_0xec78('0xdf')][_0xec78('0xd6')]};}return _0xbcbba;});});}});return Promise[_0xec78('0x5b')](_0x52ef24);})['then'](function(_0x2566c8){return _(_0x2566c8)[_0xec78('0xec')]()[_0xec78('0xed')](_0xec78('0xd2'))[_0xec78('0xee')]()[_0xec78('0xef')]();})['then'](function(_0x46a3c9){_0x2b4407[_0xec78('0x99')]=_0x37c8c6[_0xec78('0x7e')]?_0x46a3c9[_0xec78('0xf0')](_0x37c8c6[_0xec78('0x10')],_0x37c8c6[_0xec78('0x10')]+_0x37c8c6['limit']):_0x46a3c9;return _0x2b4407;})[_0xec78('0x15')](respondWithFilteredResult(_0x301b8d,_0x37c8c6))[_0xec78('0x22')](handleError(_0x301b8d,null));}; \ No newline at end of file +var _0xe951=['`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','order','ContactId','includeAll','include','rows','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','split','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','import','User','agent','binding','firstName','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','child_process','getJourney','chat','sms','fax','whatsapp','voice','resolve','channel','includes','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','userDisposition','UserId','createdAt','DESC','findAndCountAll','fullname','startCase','Website','closed','closedAt','disposition','thirdDisposition','Account','key','browserName','customerIp','customerPort','deviceModel','osName','ratingType','ratingValue','referer','mail','subject','substatus','openchannel','threadId','Interaction','Owner','flatten','sortBy','reverse','value','slice','util','path','lodash','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','describe','getOptions','findAll','query','user','catch','CmContact','tags','keys','startsWith','cf_','columnName','analytics','length','displayName','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','ReportAgentPreview','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','find','color','Phones','params','sequelize','literal','Phones.OrderBy','$and','CmCustomField','omit','map','cf_%d','format','table','setFields','id\x20=\x20?','text','phone','getTags','findOne','Tag','rawAttributes','filters','intersection','model','attributes','fields','sort','pick','filter','merge','options','nolimit','setTags','ids','ContactItemType','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','ItemType'];(function(_0x303479,_0x2037d0){var _0x353203=function(_0x295326){while(--_0x295326){_0x303479['push'](_0x303479['shift']());}};_0x353203(++_0x2037d0);}(_0xe951,0x6e));var _0x1e95=function(_0x2d1da8,_0x5606b9){_0x2d1da8=_0x2d1da8-0x0;var _0x53ae73=_0xe951[_0x2d1da8];return _0x53ae73;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x1e95('0x0'));var path=require(_0x1e95('0x1'));var fs=require('fs');var _=require(_0x1e95('0x2'));var squel=require('squel');var Papa=require(_0x1e95('0x3'));var Redis=require(_0x1e95('0x4'));var contacts=require(_0x1e95('0x5'));var qs=require(_0x1e95('0x6'));var logger=require(_0x1e95('0x7'))(_0x1e95('0x8'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var db=require(_0x1e95('0x9'))['db'];config[_0x1e95('0xa')]=_[_0x1e95('0xb')](config[_0x1e95('0xa')],{'host':_0x1e95('0xc'),'port':0x18eb});var socket=require(_0x1e95('0xd'))(new Redis(config[_0x1e95('0xa')]));require(_0x1e95('0xe'))[_0x1e95('0xf')](socket);function respondWithResult(_0x14b091,_0x387de7){_0x387de7=_0x387de7||0xc8;return function(_0x562277){if(_0x562277){return _0x14b091[_0x1e95('0x10')](_0x387de7)[_0x1e95('0x11')](_0x562277);}};}function respondWithFilteredResult(_0x37e049,_0x5c6282){return function(_0x4595ee){if(_0x4595ee){var _0x531570=typeof _0x5c6282[_0x1e95('0x12')]===_0x1e95('0x13')&&typeof _0x5c6282[_0x1e95('0x14')]==='undefined';var _0x32ee8e=_0x4595ee[_0x1e95('0x15')];var _0xb98c04=_0x531570?0x0:_0x5c6282[_0x1e95('0x12')];var _0x1ff83a=_0x531570?_0x4595ee[_0x1e95('0x15')]:_0x5c6282[_0x1e95('0x12')]+_0x5c6282[_0x1e95('0x14')];var _0x2c1eb0;if(_0x1ff83a>=_0x32ee8e){_0x1ff83a=_0x32ee8e;_0x2c1eb0=0xc8;}else{_0x2c1eb0=0xce;}_0x37e049[_0x1e95('0x10')](_0x2c1eb0);return _0x37e049[_0x1e95('0x16')](_0x1e95('0x17'),_0xb98c04+'-'+_0x1ff83a+'/'+_0x32ee8e)[_0x1e95('0x11')](_0x4595ee);}return null;};}function saveUpdates(_0x36cabd){return function(_0x32ad42){if(_0x32ad42){return _0x32ad42[_0x1e95('0x18')](_0x36cabd)[_0x1e95('0x19')](function(_0x46085e){return _0x46085e;});}return null;};}function removeEntity(_0x134c22){return function(_0x2e8de7){if(_0x2e8de7){return _0x2e8de7[_0x1e95('0x1a')]()[_0x1e95('0x19')](function(){_0x134c22['status'](0xcc)[_0x1e95('0x1b')]();});}};}function handleEntityNotFound(_0x12fa1e){return function(_0x365ea7){if(!_0x365ea7){_0x12fa1e[_0x1e95('0x1c')](0x194);}return _0x365ea7;};}function handleError(_0x45f455,_0x1b9b66){_0x1b9b66=_0x1b9b66||0x1f4;return function(_0x1cc8b9){logger['error'](_0x1cc8b9[_0x1e95('0x1d')]);if(_0x1cc8b9[_0x1e95('0x1e')]){delete _0x1cc8b9['name'];}_0x45f455[_0x1e95('0x10')](_0x1b9b66)[_0x1e95('0x1f')](_0x1cc8b9);};}exports['index']=function(_0x383f21,_0x5e585e){var _0x1fe7d1={};return contacts[_0x1e95('0x20')]()[_0x1e95('0x19')](function(_0x254164){_0x1fe7d1=qs[_0x1e95('0x21')](_0x254164,_0x383f21);return contacts[_0x1e95('0x22')](_0x383f21[_0x1e95('0x23')],_0x383f21[_0x1e95('0x24')],_0x1fe7d1,_0x254164);})[_0x1e95('0x19')](respondWithFilteredResult(_0x5e585e,_0x1fe7d1))[_0x1e95('0x25')](handleError(_0x5e585e,null));};exports['destroy']=function(_0x2b52a1,_0x898f04){return db[_0x1e95('0x26')]['find']({'where':{'id':_0x2b52a1['params']['id']}})[_0x1e95('0x19')](handleEntityNotFound(_0x898f04,null))['then'](removeEntity(_0x898f04,null))[_0x1e95('0x25')](handleError(_0x898f04,null));};exports['describe']=function(_0x5821e3,_0x545a58){return db[_0x1e95('0x26')][_0x1e95('0x20')]()[_0x1e95('0x19')](function(_0x411995){delete _0x411995[_0x1e95('0x27')];for(var _0xb02abe=0x0;_0xb02abe0x0){return new Promise(function(_0xc47106){var _0x2cc991=[];for(var _0x51e531=0x0;_0x51e531<_0x54017a[_0x1e95('0x2d')];_0x51e531++){_0x2cc991[_0x1e95('0x5c')](insertAdditionalPhones(_0x54017a[_0x51e531]['contact'],_0x54017a[_0x51e531][_0x1e95('0x57')]));}Promise[_0x1e95('0x60')](_0x2cc991)['then'](function(){_0xc47106(0x1);});})[_0x1e95('0x19')](function(){return{'success':_0x35a271,'failure':_0x4d9a70,'duplicates':_0x5d86c3};});}else{return{'success':_0x35a271,'failure':_0x4d9a70,'duplicates':_0x5d86c3};}}})[_0x1e95('0x19')](respondWithResult(_0x19efbf,0xc9))[_0x1e95('0x25')](handleError(_0x19efbf,null));};exports[_0x1e95('0x61')]=function(_0x20dae9,_0x4b05c4){var _0x7347a6;return db['CmContact']['describe']()[_0x1e95('0x19')](function(_0x4aa651){return db[_0x1e95('0x26')][_0x1e95('0x62')]({'where':{'id':_0x20dae9['params']['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x1e95('0x1e'),_0x1e95('0x63')],'required':_0x20dae9[_0x1e95('0x23')]['tag']?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x1e95('0x64'),'where':{'CmContactId':_0x20dae9[_0x1e95('0x65')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':'ItemType'}]}],'order':[db[_0x1e95('0x66')][_0x1e95('0x67')](_0x1e95('0x68'))],'attributes':_['keys'](_0x4aa651)});})[_0x1e95('0x19')](function(_0x33f537){if(!_[_0x1e95('0x54')](_0x33f537)){_0x7347a6=_0x33f537[_0x1e95('0x39')]({'plain':!![]});var _0xdbf45c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x33f537&&_0x33f537['ListId']){if(_0x33f537[_0x1e95('0x5d')]){_0xdbf45c[_0x1e95('0x5a')][_0x1e95('0x69')]['push']({'ListId':{'$ne':_0x33f537['ListId']}});}}return db[_0x1e95('0x6a')][_0x1e95('0x22')](_0xdbf45c);}})[_0x1e95('0x19')](function(_0x245764){if(!_[_0x1e95('0x54')](_0x245764)){return _[_0x1e95('0x6b')](_0x7347a6,_[_0x1e95('0x6c')](_0x245764,function(_0x144bbe){return util['format'](_0x1e95('0x6d'),_0x144bbe['id']);}));}})['then'](handleEntityNotFound(_0x4b05c4,null))[_0x1e95('0x19')](respondWithResult(_0x4b05c4,null))[_0x1e95('0x25')](handleError(_0x4b05c4,null));};exports[_0x1e95('0x18')]=function(_0x4bece5,_0x3f52bf){var _0x158c58;if(_0x4bece5[_0x1e95('0x37')]['id']){delete _0x4bece5['body']['id'];}if(!_['isNil'](_0x4bece5[_0x1e95('0x37')]['dialTimezone'])){var _0xe47305=_0x4bece5[_0x1e95('0x37')]['dialTimezone'];if(!_[_0x1e95('0x54')](shared[_0x1e95('0x55')][_0xe47305]))_0x4bece5[_0x1e95('0x37')][_0x1e95('0x56')]=shared['timezones'][_0xe47305][_0x1e95('0x56')];}return db[_0x1e95('0x26')][_0x1e95('0x62')]({'where':{'id':_0x4bece5[_0x1e95('0x65')]['id']}})[_0x1e95('0x19')](handleEntityNotFound(_0x3f52bf,null))['then'](saveUpdates(_0x4bece5['body'],null))[_0x1e95('0x19')](function(_0x24a43e){_0x158c58=_0x24a43e;var _0x586269={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x24a43e&&_0x24a43e[_0x1e95('0x5d')]){if(_0x24a43e[_0x1e95('0x5d')]){_0x586269[_0x1e95('0x5a')][_0x1e95('0x69')]['push']({'ListId':{'$ne':_0x24a43e['ListId']}});}}return db[_0x1e95('0x6a')][_0x1e95('0x22')](_0x586269);})['then'](function(_0x4697e4){if(_0x4697e4){return _[_0x1e95('0x6b')](_['pickBy'](_0x4bece5[_0x1e95('0x37')],function(_0xb3166e,_0x55bfa8){return _['startsWith'](_0x55bfa8,'cf_');}),_[_0x1e95('0x6c')](_0x4697e4,function(_0x6e9a49){return util[_0x1e95('0x6e')](_0x1e95('0x6d'),_0x6e9a49['id']);}));}})[_0x1e95('0x19')](function(_0x24f7c7){if(_0x24f7c7&&!_['isEmpty'](_0x24f7c7)){var _0x32c226=squel[_0x1e95('0x18')]()[_0x1e95('0x6f')]('cm_contacts')[_0x1e95('0x70')](_0x24f7c7)[_0x1e95('0x5a')](_0x1e95('0x71'),_0x4bece5[_0x1e95('0x65')]['id'])['toParam']();return db[_0x1e95('0x66')]['query'](_0x32c226[_0x1e95('0x72')],{'replacements':_0x32c226[_0x1e95('0x32')]});}})[_0x1e95('0x19')](function(){if(_0x4bece5[_0x1e95('0x37')][_0x1e95('0x73')]&&_0x158c58){return db[_0x1e95('0x3e')]['update']({'phone':_0x4bece5['body'][_0x1e95('0x73')],'OrderBy':0x0},{'where':{'ContactId':_0x158c58['id']}});}})[_0x1e95('0x19')](function(){return _0x158c58;})[_0x1e95('0x19')](respondWithResult(_0x3f52bf,null))[_0x1e95('0x25')](handleError(_0x3f52bf,null));};exports[_0x1e95('0x74')]=function(_0x227865,_0x48d70a){var _0x2af174={};var _0x5e0163={};var _0x464728;var _0x120140;return db[_0x1e95('0x26')][_0x1e95('0x75')]({'where':{'id':_0x227865[_0x1e95('0x65')]['id']}})[_0x1e95('0x19')](handleEntityNotFound(_0x48d70a,null))['then'](function(_0xea8144){if(_0xea8144){_0x464728=_0xea8144;_0x5e0163['model']=_['keys'](db[_0x1e95('0x76')][_0x1e95('0x77')]);_0x5e0163['query']=_['keys'](_0x227865[_0x1e95('0x23')]);_0x5e0163[_0x1e95('0x78')]=_[_0x1e95('0x79')](_0x5e0163[_0x1e95('0x7a')],_0x5e0163['query']);_0x2af174[_0x1e95('0x7b')]=_[_0x1e95('0x79')](_0x5e0163['model'],qs[_0x1e95('0x7c')](_0x227865[_0x1e95('0x23')]['fields']));_0x2af174[_0x1e95('0x7b')]=_0x2af174[_0x1e95('0x7b')][_0x1e95('0x2d')]?_0x2af174[_0x1e95('0x7b')]:_0x5e0163[_0x1e95('0x7a')];_0x2af174['order']=qs[_0x1e95('0x7d')](_0x227865[_0x1e95('0x23')][_0x1e95('0x7d')]);_0x2af174[_0x1e95('0x5a')]=qs[_0x1e95('0x78')](_[_0x1e95('0x7e')](_0x227865[_0x1e95('0x23')],_0x5e0163[_0x1e95('0x78')]));if(_0x227865['query'][_0x1e95('0x7f')]){_0x2af174[_0x1e95('0x5a')]=_['merge'](_0x2af174['where'],{'$or':_['map'](_0x2af174[_0x1e95('0x7b')],function(_0x5cae9b){var _0x31369f={};_0x31369f[_0x5cae9b]={'$like':'%'+_0x227865[_0x1e95('0x23')][_0x1e95('0x7f')]+'%'};return _0x31369f;})});}_0x2af174=_[_0x1e95('0x80')]({},_0x2af174,_0x227865[_0x1e95('0x81')]);return _0x464728[_0x1e95('0x74')](_0x2af174);}})[_0x1e95('0x19')](function(_0x492c17){if(_0x492c17){_0x120140=_0x492c17[_0x1e95('0x2d')];if(!_0x227865[_0x1e95('0x23')][_0x1e95('0x36')](_0x1e95('0x82'))){_0x2af174[_0x1e95('0x14')]=qs[_0x1e95('0x14')](_0x227865[_0x1e95('0x23')][_0x1e95('0x14')]);_0x2af174[_0x1e95('0x12')]=qs[_0x1e95('0x12')](_0x227865[_0x1e95('0x23')]['offset']);}return _0x464728[_0x1e95('0x74')](_0x2af174);}})[_0x1e95('0x19')](function(_0x3a47e1){if(_0x3a47e1){return _0x3a47e1?{'count':_0x120140,'rows':_0x3a47e1}:null;}})[_0x1e95('0x19')](respondWithResult(_0x48d70a,null))[_0x1e95('0x25')](handleError(_0x48d70a,null));};exports[_0x1e95('0x83')]=function(_0x3fa5e4,_0x2321e0){if(_0x3fa5e4[_0x1e95('0x37')]['id']){delete _0x3fa5e4['body']['id'];}return db[_0x1e95('0x26')][_0x1e95('0x75')]({'where':{'id':_0x3fa5e4[_0x1e95('0x65')]['id']}})[_0x1e95('0x19')](handleEntityNotFound(_0x2321e0,null))[_0x1e95('0x19')](function(_0x4c7a46){if(_0x4c7a46){return _0x4c7a46[_0x1e95('0x83')](_0x3fa5e4[_0x1e95('0x37')][_0x1e95('0x84')]||[]);}return null;})[_0x1e95('0x19')](respondWithResult(_0x2321e0,null))[_0x1e95('0x25')](handleError(_0x2321e0,null));};exports['setAdditionalPhones']=function(_0x4eb72d,_0xb27dc4){var _0x1ecccd=[];_0x1ecccd[_0x1e95('0x5c')](addAdditionalPhones(_0x4eb72d[_0x1e95('0x37')]));Promise[_0x1e95('0x60')](_0x1ecccd)['then'](function(){_0x1ecccd=[];_0x1ecccd['push'](deleteCmHopperPhones(_0x4eb72d[_0x1e95('0x37')]['id']));_0x1ecccd['push'](addCmHopperPhones(_0x4eb72d['body']['id']));Promise[_0x1e95('0x60')](_0x1ecccd)[_0x1e95('0x19')](function(){return[0x1];})['then'](respondWithResult(_0xb27dc4,null));});};function addAdditionalPhones(_0x597fe7){var _0x35dd8c;return new Promise(function(_0x5c2152){return db['CmContactHasItem'][_0x1e95('0x1a')]({'where':{'CmContactId':_0x597fe7['id']}})[_0x1e95('0x19')](function(){db[_0x1e95('0x85')][_0x1e95('0x22')]({'raw':!![],'attributes':['id','OrderBy']})[_0x1e95('0x19')](function(_0x370483){var _0x15f880=[];for(var _0x223835=0x0;_0x223835<_0x597fe7[_0x1e95('0x86')][_0x1e95('0x2d')];_0x223835++){var _0x5e1454=_0x597fe7[_0x1e95('0x87')]?_[_0x1e95('0x54')](_0x597fe7['item_types'][_0x223835])?'':_0x597fe7[_0x1e95('0x87')][_0x223835]:_0x597fe7[_0x1e95('0x86')][_0x223835][_0x1e95('0x88')]?_0x597fe7[_0x1e95('0x86')][_0x223835][_0x1e95('0x88')]:'';var _0x334a0a=_[_0x1e95('0x54')](_0x597fe7[_0x1e95('0x86')][_0x223835]['description'])?'':_0x597fe7[_0x1e95('0x86')][_0x223835][_0x1e95('0x89')];var _0x58d415=_0x5e1454+':'+_0x597fe7[_0x1e95('0x86')][_0x223835][_0x1e95('0x73')]+'§'+_0x334a0a;if(_['isNil'](_0x35dd8c))_0x35dd8c=_0x58d415;else _0x35dd8c+=';'+_0x58d415;var _0x1d21f4=null;var _0x125919=null;if(_0x597fe7[_0x1e95('0x87')]){if(!_[_0x1e95('0x54')](_0x597fe7[_0x1e95('0x87')][_0x223835])){_0x125919=_[_0x1e95('0x62')](_0x370483,function(_0x2dcbb9){return _0x2dcbb9['id']===_0x597fe7[_0x1e95('0x87')][_0x223835];});if(!_[_0x1e95('0x54')](_0x125919)){_0x1d21f4=_0x125919[_0x1e95('0x8a')];}}}else{if(!_[_0x1e95('0x54')](_0x597fe7['items'][_0x223835])){_0x125919=_[_0x1e95('0x62')](_0x370483,function(_0x202137){return _0x202137['id']===_0x597fe7[_0x1e95('0x86')][_0x223835][_0x1e95('0x88')];});if(!_[_0x1e95('0x54')](_0x125919)){_0x1d21f4=_0x223835;}}}if(_[_0x1e95('0x54')](_0x1d21f4)){_0x1d21f4=0x64;}_0x15f880[_0x1e95('0x5c')](addAdditionalPhone(_0x597fe7['id'],_0x597fe7[_0x1e95('0x86')][_0x223835]['phone'],_0x597fe7['item_types']?_[_0x1e95('0x54')](_0x597fe7[_0x1e95('0x87')][_0x223835])?null:_0x597fe7['item_types'][_0x223835]:_0x597fe7[_0x1e95('0x86')][_0x223835][_0x1e95('0x88')]?_0x597fe7[_0x1e95('0x86')][_0x223835][_0x1e95('0x88')]:null,_0x1d21f4,_0x334a0a));}Promise[_0x1e95('0x60')](_0x15f880)[_0x1e95('0x19')](function(){db[_0x1e95('0x26')][_0x1e95('0x18')]({'AdditionalPhones':_0x35dd8c},{'where':{'id':_0x597fe7['id']}})[_0x1e95('0x19')](function(){_0x5c2152(0x1);});});});});});}function addAdditionalPhone(_0xdb721,_0x50ab51,_0x4352f8,_0x3c9aef,_0x3a36ac){return db[_0x1e95('0x4a')][_0x1e95('0x62')]({'where':{'CmContactId':_0xdb721,'item':_0x50ab51}})['then'](function(_0x5b73e3){if(_0x5b73e3)logger['info'](_0x1e95('0x8b'),_0x5b73e3);else{db[_0x1e95('0x4a')][_0x1e95('0x41')]({'CmContactId':_0xdb721,'item':_0x50ab51,'ItemTypeId':_0x4352f8,'OrderBy':_0x3c9aef,'ItemClass':_0x1e95('0x8c'),'description':_0x3a36ac});}});}function deleteCmHopperPhones(_0x74df4){return new Promise(function(_0x312c98){return db[_0x1e95('0x3e')][_0x1e95('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x74df4}})[_0x1e95('0x19')](function(_0x165c0a){db[_0x1e95('0x8d')][_0x1e95('0x1a')]({'where':{'CmHopperId':{'$in':_[_0x1e95('0x6c')](_0x165c0a,'id')}}});})[_0x1e95('0x19')](function(){_0x312c98(0x1);});});}function addCmHopperPhones(_0x429eb6){return new Promise(function(_0x2d6aca){return db['CmHopper'][_0x1e95('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x429eb6}})['then'](function(_0x51f46a){var _0x17f082=[];_['map'](_0x51f46a,function(_0xdcd5db){_0x17f082['push'](createCmHopperPhone(_0x429eb6,_0xdcd5db['id']));});Promise['all'](_0x17f082)['then'](function(){_0x2d6aca(0x1);});});});}function createCmHopperPhone(_0x4fc7b1,_0x13cb53){return new Promise(function(_0x354f40){db[_0x1e95('0x4a')][_0x1e95('0x22')]({'raw':!![],'attributes':[_0x1e95('0x8e'),_0x1e95('0x8a')],'where':{'CmContactId':_0x4fc7b1,'ItemClass':'PHONE'},'include':[{'model':db[_0x1e95('0x85')],'attributes':['OrderBy'],'as':_0x1e95('0x8f')}],'order':[_0x1e95('0x8a'),db[_0x1e95('0x66')][_0x1e95('0x67')](_0x1e95('0x90'))]})[_0x1e95('0x19')](function(_0x4ad4bd){var _0x591edc=0x1;var _0x1107dc=_[_0x1e95('0x6c')](_0x4ad4bd,function(_0xc133e0){_0xc133e0[_0x1e95('0x91')]=_0x13cb53;_0xc133e0[_0x1e95('0x73')]=_0xc133e0['item'];_0xc133e0[_0x1e95('0x8a')]=_0x591edc;delete _0xc133e0[_0x1e95('0x92')];_0x591edc=_0x591edc+0x1;return _0xc133e0;});return db[_0x1e95('0x8d')][_0x1e95('0x58')](_0x1107dc,{});})[_0x1e95('0x19')](function(){_0x354f40(0x1);});});}function insertAdditionalPhones(_0x5b58f5,_0x499409){return new Promise(function(_0x1bf490){var _0x5c1825=[];for(var _0x7c6b31=0x0;_0x7c6b31<_0x499409['length'];_0x7c6b31++){var _0x231043=_0x499409[_0x7c6b31];_0x5c1825[_0x1e95('0x5c')](parseContactItemType(_0x231043));}Promise[_0x1e95('0x60')](_0x5c1825)[_0x1e95('0x19')](function(){var _0x5156b1={'id':_0x5b58f5['id'],'items':_0x499409};return addAdditionalPhones(_0x5156b1)[_0x1e95('0x19')](function(){return addCmHopperPhones(_0x5b58f5['id']);});})[_0x1e95('0x19')](function(){_0x1bf490(_0x5b58f5);});});}function parseContactItemType(_0x2c9a00){return new Promise(function(_0x5dd7dd){if(_0x2c9a00[_0x1e95('0x36')](_0x1e95('0x88'))){_0x5dd7dd(_0x2c9a00);}else{return db[_0x1e95('0x85')][_0x1e95('0x62')]({'where':{'name':_0x2c9a00[_0x1e95('0x8f')]}})['then'](function(_0x519e04){if(_[_0x1e95('0x54')](_0x519e04))_0x2c9a00['ItemTypeId']=null;else _0x2c9a00[_0x1e95('0x88')]=_0x519e04['id'];_0x5dd7dd(_0x2c9a00);});}});}exports[_0x1e95('0x93')]=function(_0x29052e,_0x3b4fce){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x29052e['params']['id'],'ItemClass':_0x1e95('0x8c')},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0x1e95('0x8a')],[db[_0x1e95('0x66')][_0x1e95('0x67')]('`ItemType`.OrderBy')]]})[_0x1e95('0x19')](function(_0x5f5091){return _0x5f5091;})['then'](respondWithResult(_0x3b4fce,null))['catch'](handleError(_0x3b4fce,null));};exports['duplicateAdditionalPhones']=function(_0x40ee0d,_0x61dafd){return db['CmContactHasItem'][_0x1e95('0x22')]({'raw':!![],'where':{'CmContactId':_0x40ee0d[_0x1e95('0x37')][_0x1e95('0x94')]}})[_0x1e95('0x19')](function(_0x5b8072){var _0x170d4c=_[_0x1e95('0x6c')](_0x5b8072,function(_0x4f0f52){_0x4f0f52[_0x1e95('0x95')]=_0x40ee0d['body'][_0x1e95('0x96')];return _0x4f0f52;});return db[_0x1e95('0x4a')][_0x1e95('0x58')](_0x170d4c,{});})[_0x1e95('0x19')](function(){return addCmHopperPhones(_0x40ee0d['body'][_0x1e95('0x96')]);})[_0x1e95('0x19')](function(){return['ok'];})[_0x1e95('0x19')](respondWithResult(_0x61dafd,null))[_0x1e95('0x25')](handleError(_0x61dafd,null));};exports[_0x1e95('0x97')]=function(_0x4538cc,_0x38ac37){var _0x140bf8=[];_0x140bf8[_0x1e95('0x5c')](createCmHopperPhone(_0x4538cc[_0x1e95('0x37')]['id'],_0x4538cc[_0x1e95('0x37')][_0x1e95('0x98')]));Promise[_0x1e95('0x60')](_0x140bf8)[_0x1e95('0x19')](function(){return[0x1];})[_0x1e95('0x19')](respondWithResult(_0x38ac37,null));};exports[_0x1e95('0x99')]=function(_0x10b631,_0x2d8956){var _0x8dd6ae={'raw':![],'where':{}};var _0x4d1a32={};var _0x43c3a9={'count':0x0,'rows':[]};return db[_0x1e95('0x26')][_0x1e95('0x75')]({'where':{'id':_0x10b631['params']['id']}})[_0x1e95('0x19')](handleEntityNotFound(_0x2d8956,null))[_0x1e95('0x19')](function(_0x5278c8){if(_0x5278c8){_0x4d1a32[_0x1e95('0x7a')]=_[_0x1e95('0x28')](db['CmHopper'][_0x1e95('0x77')]);_0x4d1a32[_0x1e95('0x23')]=_['keys'](_0x10b631[_0x1e95('0x23')]);_0x4d1a32[_0x1e95('0x78')]=_['intersection'](_0x4d1a32[_0x1e95('0x7a')],_0x4d1a32['query']);_0x8dd6ae[_0x1e95('0x7b')]=_[_0x1e95('0x79')](_0x4d1a32['model'],qs[_0x1e95('0x7c')](_0x10b631[_0x1e95('0x23')][_0x1e95('0x7c')]));_0x8dd6ae[_0x1e95('0x7b')]=_0x8dd6ae[_0x1e95('0x7b')][_0x1e95('0x2d')]?_0x8dd6ae[_0x1e95('0x7b')]:_0x4d1a32[_0x1e95('0x7a')];if(!_0x10b631[_0x1e95('0x23')][_0x1e95('0x36')]('nolimit')){_0x8dd6ae[_0x1e95('0x14')]=qs[_0x1e95('0x14')](_0x10b631['query']['limit']);_0x8dd6ae[_0x1e95('0x12')]=qs['offset'](_0x10b631[_0x1e95('0x23')][_0x1e95('0x12')]);}_0x8dd6ae[_0x1e95('0x9a')]=qs[_0x1e95('0x7d')](_0x10b631['query'][_0x1e95('0x7d')]);_0x8dd6ae[_0x1e95('0x5a')]=qs[_0x1e95('0x78')](_['pick'](_0x10b631[_0x1e95('0x23')],_0x4d1a32[_0x1e95('0x78')]));_0x8dd6ae[_0x1e95('0x5a')][_0x1e95('0x9b')]=_0x5278c8['id'];if(_0x10b631[_0x1e95('0x23')][_0x1e95('0x7f')]){_0x8dd6ae['where']=_[_0x1e95('0x80')](_0x8dd6ae[_0x1e95('0x5a')],{'$or':_[_0x1e95('0x6c')](_0x8dd6ae[_0x1e95('0x7b')],function(_0x17d93f){var _0x53b9ed={};_0x53b9ed[_0x17d93f]={'$like':'%'+_0x10b631[_0x1e95('0x23')][_0x1e95('0x7f')]+'%'};return _0x53b9ed;})});}_0x8dd6ae=_['merge']({},_0x8dd6ae,_0x10b631['options']);return db[_0x1e95('0x3e')][_0x1e95('0x15')]({'where':_0x8dd6ae[_0x1e95('0x5a')]})[_0x1e95('0x19')](function(_0x211629){_0x43c3a9[_0x1e95('0x15')]=_0x211629;if(_0x10b631[_0x1e95('0x23')][_0x1e95('0x9c')]){_0x8dd6ae[_0x1e95('0x9d')]=[{'all':!![]}];}return db[_0x1e95('0x3e')][_0x1e95('0x22')](_0x8dd6ae);})[_0x1e95('0x19')](function(_0xa6de68){_0x43c3a9[_0x1e95('0x9e')]=_0xa6de68;return _0x43c3a9;});}})[_0x1e95('0x19')](respondWithFilteredResult(_0x2d8956,_0x8dd6ae))[_0x1e95('0x25')](handleError(_0x2d8956,null));};exports[_0x1e95('0x9f')]=function(_0xaebb9d,_0x1cfa92){var _0x138a25={'raw':!![],'where':{}};var _0x4d3fe1={};var _0x38c1f4={'count':0x0,'rows':[]};return db[_0x1e95('0x26')][_0x1e95('0x75')]({'where':{'id':_0xaebb9d[_0x1e95('0x65')]['id']}})['then'](handleEntityNotFound(_0x1cfa92,null))[_0x1e95('0x19')](function(_0x3c650c){if(_0x3c650c){_0x4d3fe1[_0x1e95('0x7a')]=_[_0x1e95('0x28')](db[_0x1e95('0xa0')][_0x1e95('0x77')]);_0x4d3fe1[_0x1e95('0x23')]=_[_0x1e95('0x28')](_0xaebb9d['query']);_0x4d3fe1[_0x1e95('0x78')]=_[_0x1e95('0x79')](_0x4d3fe1[_0x1e95('0x7a')],_0x4d3fe1['query']);_0x138a25[_0x1e95('0x7b')]=_[_0x1e95('0x79')](_0x4d3fe1['model'],qs[_0x1e95('0x7c')](_0xaebb9d['query'][_0x1e95('0x7c')]));_0x138a25[_0x1e95('0x7b')]=_0x138a25[_0x1e95('0x7b')]['length']?_0x138a25[_0x1e95('0x7b')]:_0x4d3fe1[_0x1e95('0x7a')];if(!_0xaebb9d['query'][_0x1e95('0x36')](_0x1e95('0x82'))){_0x138a25['limit']=qs[_0x1e95('0x14')](_0xaebb9d[_0x1e95('0x23')][_0x1e95('0x14')]);_0x138a25[_0x1e95('0x12')]=qs[_0x1e95('0x12')](_0xaebb9d['query']['offset']);}_0x138a25[_0x1e95('0x9a')]=qs[_0x1e95('0x7d')](_0xaebb9d[_0x1e95('0x23')][_0x1e95('0x7d')]);_0x138a25['where']=qs[_0x1e95('0x78')](_[_0x1e95('0x7e')](_0xaebb9d[_0x1e95('0x23')],_0x4d3fe1['filters']));_0x138a25[_0x1e95('0x5a')]['ContactId']=_0x3c650c['id'];if(_0xaebb9d[_0x1e95('0x23')][_0x1e95('0x7f')]){_0x138a25['where']=_[_0x1e95('0x80')](_0x138a25['where'],{'$or':_[_0x1e95('0x6c')](_0x138a25[_0x1e95('0x7b')],function(_0x1f8ae3){var _0x3b0a25={};_0x3b0a25[_0x1f8ae3]={'$like':'%'+_0xaebb9d[_0x1e95('0x23')]['filter']+'%'};return _0x3b0a25;})});}_0x138a25=_[_0x1e95('0x80')]({},_0x138a25,_0xaebb9d[_0x1e95('0x81')]);return db[_0x1e95('0xa0')]['count']({'where':_0x138a25[_0x1e95('0x5a')]})[_0x1e95('0x19')](function(_0xb6e679){_0x38c1f4[_0x1e95('0x15')]=_0xb6e679;if(_0xaebb9d[_0x1e95('0x23')]['includeAll']){_0x138a25[_0x1e95('0x9d')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x138a25);})[_0x1e95('0x19')](function(_0x516019){_0x38c1f4[_0x1e95('0x9e')]=_0x516019;return _0x38c1f4;});}})[_0x1e95('0x19')](respondWithFilteredResult(_0x1cfa92,_0x138a25))[_0x1e95('0x25')](handleError(_0x1cfa92,null));};exports[_0x1e95('0xa1')]=function(_0x3c248b,_0x237249){var _0x592920={'raw':!![],'where':{}};var _0x53ac5a={};var _0x2965f1={'count':0x0,'rows':[]};return db[_0x1e95('0x26')][_0x1e95('0x75')]({'where':{'id':_0x3c248b[_0x1e95('0x65')]['id']}})[_0x1e95('0x19')](handleEntityNotFound(_0x237249,null))[_0x1e95('0x19')](function(_0x30a84a){if(_0x30a84a){_0x53ac5a[_0x1e95('0x7a')]=_[_0x1e95('0x28')](db[_0x1e95('0x4b')][_0x1e95('0x77')]);_0x53ac5a[_0x1e95('0x23')]=_['keys'](_0x3c248b[_0x1e95('0x23')]);_0x53ac5a[_0x1e95('0x78')]=_[_0x1e95('0x79')](_0x53ac5a['model'],_0x53ac5a['query']);_0x592920['attributes']=_['intersection'](_0x53ac5a[_0x1e95('0x7a')],qs[_0x1e95('0x7c')](_0x3c248b['query'][_0x1e95('0x7c')]));_0x592920[_0x1e95('0x7b')]=_0x592920[_0x1e95('0x7b')][_0x1e95('0x2d')]?_0x592920[_0x1e95('0x7b')]:_0x53ac5a[_0x1e95('0x7a')];if(!_0x3c248b[_0x1e95('0x23')]['hasOwnProperty'](_0x1e95('0x82'))){_0x592920['limit']=qs[_0x1e95('0x14')](_0x3c248b['query']['limit']);_0x592920[_0x1e95('0x12')]=qs[_0x1e95('0x12')](_0x3c248b[_0x1e95('0x23')]['offset']);}_0x592920[_0x1e95('0x9a')]=qs['sort'](_0x3c248b[_0x1e95('0x23')][_0x1e95('0x7d')]);_0x592920[_0x1e95('0x5a')]=qs[_0x1e95('0x78')](_['pick'](_0x3c248b['query'],_0x53ac5a[_0x1e95('0x78')]));_0x592920[_0x1e95('0x5a')][_0x1e95('0x9b')]=_0x30a84a['id'];if(_0x3c248b[_0x1e95('0x23')][_0x1e95('0x7f')]){_0x592920[_0x1e95('0x5a')]=_[_0x1e95('0x80')](_0x592920[_0x1e95('0x5a')],{'$or':_['map'](_0x592920[_0x1e95('0x7b')],function(_0xaaaa34){var _0x3a7a4c={};_0x3a7a4c[_0xaaaa34]={'$like':'%'+_0x3c248b[_0x1e95('0x23')][_0x1e95('0x7f')]+'%'};return _0x3a7a4c;})});}_0x592920=_[_0x1e95('0x80')]({},_0x592920,_0x3c248b[_0x1e95('0x81')]);return db[_0x1e95('0x4b')][_0x1e95('0x15')]({'where':_0x592920[_0x1e95('0x5a')]})[_0x1e95('0x19')](function(_0x9421b7){_0x2965f1[_0x1e95('0x15')]=_0x9421b7;if(_0x3c248b[_0x1e95('0x23')][_0x1e95('0x9c')]){_0x592920[_0x1e95('0x9d')]=[{'all':!![]}];}return db[_0x1e95('0x4b')][_0x1e95('0x22')](_0x592920);})[_0x1e95('0x19')](function(_0x740b40){_0x2965f1[_0x1e95('0x9e')]=_0x740b40;return _0x2965f1;});}})['then'](respondWithFilteredResult(_0x237249,_0x592920))[_0x1e95('0x25')](handleError(_0x237249,null));};exports[_0x1e95('0xa2')]=function(_0x502045,_0x5effe2){var _0xfac149={'raw':!![],'where':{}};var _0x49444f={};var _0x56642d={'count':0x0,'rows':[]};return db[_0x1e95('0x26')][_0x1e95('0x75')]({'where':{'id':_0x502045[_0x1e95('0x65')]['id']}})[_0x1e95('0x19')](handleEntityNotFound(_0x5effe2,null))[_0x1e95('0x19')](function(_0x42980d){if(_0x42980d){_0x49444f['model']=_['keys'](db['JscriptySessionReport'][_0x1e95('0x77')]);_0x49444f[_0x1e95('0x23')]=_[_0x1e95('0x28')](_0x502045['query']);_0x49444f[_0x1e95('0x78')]=_[_0x1e95('0x79')](_0x49444f[_0x1e95('0x7a')],_0x49444f[_0x1e95('0x23')]);_0xfac149['attributes']=_['intersection'](_0x49444f['model'],qs[_0x1e95('0x7c')](_0x502045[_0x1e95('0x23')][_0x1e95('0x7c')]));_0xfac149[_0x1e95('0x7b')]=_0xfac149['attributes'][_0x1e95('0x2d')]?_0xfac149['attributes']:_0x49444f[_0x1e95('0x7a')];if(!_0x502045[_0x1e95('0x23')][_0x1e95('0x36')](_0x1e95('0x82'))){_0xfac149[_0x1e95('0x14')]=qs['limit'](_0x502045[_0x1e95('0x23')][_0x1e95('0x14')]);_0xfac149[_0x1e95('0x12')]=qs[_0x1e95('0x12')](_0x502045[_0x1e95('0x23')]['offset']);}_0xfac149[_0x1e95('0x9a')]=qs['sort'](_0x502045[_0x1e95('0x23')]['sort']);_0xfac149[_0x1e95('0x5a')]=qs[_0x1e95('0x78')](_['pick'](_0x502045[_0x1e95('0x23')],_0x49444f[_0x1e95('0x78')]));_0xfac149[_0x1e95('0x5a')][_0x1e95('0x9b')]=_0x42980d['id'];if(_0x502045[_0x1e95('0x23')]['filter']){_0xfac149[_0x1e95('0x5a')]=_['merge'](_0xfac149['where'],{'$or':_[_0x1e95('0x6c')](_0xfac149['attributes'],function(_0x57be0c){var _0x48b733={};_0x48b733[_0x57be0c]={'$like':'%'+_0x502045['query'][_0x1e95('0x7f')]+'%'};return _0x48b733;})});}_0xfac149=_[_0x1e95('0x80')]({},_0xfac149,_0x502045[_0x1e95('0x81')]);return db['JscriptySessionReport'][_0x1e95('0x15')]({'where':_0xfac149[_0x1e95('0x5a')]})[_0x1e95('0x19')](function(_0x142ef9){_0x56642d[_0x1e95('0x15')]=_0x142ef9;if(_0x502045[_0x1e95('0x23')]['includeAll']){_0xfac149[_0x1e95('0x9d')]=[{'all':!![]}];}return db[_0x1e95('0x4f')][_0x1e95('0x22')](_0xfac149);})[_0x1e95('0x19')](function(_0x485a32){_0x56642d[_0x1e95('0x9e')]=_0x485a32;return _0x56642d;});}})[_0x1e95('0x19')](respondWithFilteredResult(_0x5effe2,_0xfac149))[_0x1e95('0x25')](handleError(_0x5effe2,null));};exports['uploadCsv']=function(_0x2331fd,_0x1c04b6){try{if(!_0x2331fd[_0x1e95('0x37')]['ListId']){throw new Error(_0x1e95('0xa3'));}if(!_0x2331fd[_0x1e95('0x37')][_0x1e95('0xa4')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x2331fd[_0x1e95('0x37')][_0x1e95('0xa5')]){throw new Error(_0x1e95('0xa6'));}if(!_0x2331fd['body'][_0x1e95('0xa7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0xcb10cc=_0x2331fd['body'][_0x1e95('0xa4')][_0x1e95('0xa8')](',');var _0x4c033d=_0x2331fd['body'][_0x1e95('0xa5')][_0x1e95('0xa8')](',');if(!_0xcb10cc[_0x1e95('0x2d')]||!_0x4c033d['length']||_0xcb10cc['length']!==_0x4c033d[_0x1e95('0x2d')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x2331fd[_0x1e95('0x37')][_0x1e95('0x7c')]=_[_0x1e95('0xa9')](_0xcb10cc,_0x4c033d);if(!_0x2331fd['body'][_0x1e95('0x7c')]['phone']){throw new Error(_0x1e95('0xaa'));}if(!_0x2331fd[_0x1e95('0x37')][_0x1e95('0x7c')]['firstName']){throw new Error(_0x1e95('0xab'));}var _0x4e8d07=path['join'](config[_0x1e95('0xac')],'server/files/tmp',_0x2331fd[_0x1e95('0xad')][_0x1e95('0xae')]);fs[_0x1e95('0xaf')](_0x4e8d07,parseInt(_0x1e95('0xb0'),0x8));var _0x2e2965=require('child_process')[_0x1e95('0xb1')](path['join'](__dirname,_0x1e95('0xb2')),[_0x4e8d07,_0x2331fd[_0x1e95('0x37')][_0x1e95('0xa4')],_0x2331fd[_0x1e95('0x37')][_0x1e95('0xa5')],_0x2331fd[_0x1e95('0x37')][_0x1e95('0x5d')],_0x2331fd['body'][_0x1e95('0xb3')],_0x2331fd[_0x1e95('0x37')][_0x1e95('0x59')],_0x2331fd['body'][_0x1e95('0xa7')]]);return _0x1c04b6[_0x1e95('0x10')](0xc8)[_0x1e95('0x11')]({'message':_0x1e95('0xb4'),'pid':_0x2e2965[_0x1e95('0xb5')]});}catch(_0x126dc0){return _0x1c04b6[_0x1e95('0x10')](0x1f4)[_0x1e95('0x1f')](_0x126dc0);}};exports[_0x1e95('0xb6')]=function(_0x552b1a,_0x5c5558){var _0x2b695d=fs[_0x1e95('0xb7')](_0x552b1a['file'][_0x1e95('0x1')]);Papa[_0x1e95('0xb8')](_0x2b695d,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xc1633a){return _0x5c5558[_0x1e95('0x10')](0xc8)[_0x1e95('0x11')]({'file':_0x552b1a[_0x1e95('0xad')],'fields':_0xc1633a['meta'][_0x1e95('0x7c')]});}});};exports[_0x1e95('0xb9')]=function(_0x593165,_0x41f7ad){return db[_0x1e95('0xba')][_0x1e95('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':_0x1e95('0xbb')}})['then'](function(_0xee81b4){var _0x536868=![];if(!_0x593165[_0x1e95('0x37')][_0x1e95('0x5d')]){throw new Error(_0x1e95('0xa3'));}if(!_0x593165[_0x1e95('0x37')][_0x1e95('0xbc')]['phone']){throw new Error(_0x1e95('0xaa'));}if(!_0x593165[_0x1e95('0x37')][_0x1e95('0xbc')][_0x1e95('0xbd')]){throw new Error(_0x1e95('0xab'));}if(!_0x593165[_0x1e95('0x37')][_0x1e95('0xa7')]){throw new Error(_0x1e95('0xbe'));}var _0x68c774=require('child_process')['fork'](path['join'](__dirname,_0x1e95('0xbf')),[_0x593165[_0x1e95('0x65')]['id'],JSON[_0x1e95('0xc0')](_0x593165[_0x1e95('0x37')]),JSON[_0x1e95('0xc0')](_0xee81b4)]);_0x68c774['on'](_0x1e95('0xc1'),function(){_0x536868=!![];return _0x41f7ad[_0x1e95('0x10')](0xc8)[_0x1e95('0x11')]({'message':_0x1e95('0xc2'),'pid':_0x68c774[_0x1e95('0xb5')]});});_0x68c774['on'](_0x1e95('0xc3'),function(_0x30dfc6){if(_0x30dfc6&&!_0x536868){return _0x41f7ad[_0x1e95('0x10')](0x1f4)[_0x1e95('0x11')]({'message':_0x1e95('0xc4'),'pid':_0x68c774['pid']});}});})[_0x1e95('0x25')](handleError(_0x41f7ad,null));};exports['importUpdates']=function(_0x89d7a2,_0x464cdd){return db[_0x1e95('0xba')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x1e95('0xbb')}})[_0x1e95('0x19')](function(_0xc54b21){var _0x4181b2=![];if(!_0x89d7a2['body']['ListId']){throw new Error(_0x1e95('0xa3'));}if(!_0x89d7a2['body'][_0x1e95('0xbc')][_0x1e95('0x73')]){throw new Error(_0x1e95('0xaa'));}if(!_0x89d7a2['body'][_0x1e95('0xbc')][_0x1e95('0xbd')]){throw new Error(_0x1e95('0xab'));}if(!_0x89d7a2['body']['socket_timestamp']){throw new Error(_0x1e95('0xbe'));}var _0x964cf0=require(_0x1e95('0xc5'))['fork'](path[_0x1e95('0x3c')](__dirname,'../../components/import/cm/csvUpdates'),[_0x89d7a2['params']['id'],JSON[_0x1e95('0xc0')](_0x89d7a2[_0x1e95('0x37')]),JSON[_0x1e95('0xc0')](_0xc54b21)]);_0x964cf0['on'](_0x1e95('0xc1'),function(){_0x4181b2=!![];return _0x464cdd[_0x1e95('0x10')](0xc8)['json']({'message':_0x1e95('0xc2'),'pid':_0x964cf0[_0x1e95('0xb5')]});});_0x964cf0['on'](_0x1e95('0xc3'),function(_0x22701b){if(_0x22701b&&!_0x4181b2){return _0x464cdd[_0x1e95('0x10')](0x1f4)[_0x1e95('0x11')]({'message':'error\x20child\x20process','pid':_0x964cf0[_0x1e95('0xb5')]});}});})['catch'](handleError(_0x464cdd,null));};exports[_0x1e95('0xc6')]=function(_0x563782,_0x3981d2){var _0x473a7c=['mail',_0x1e95('0xc7'),_0x1e95('0xc8'),'openchannel',_0x1e95('0xc9'),_0x1e95('0xca'),_0x1e95('0xcb')];var _0x57bcf7={'offset':0x0,'order':qs[_0x1e95('0x7d')]('-createdAt')},_0x4cd8a1={'count':0x0,'rows':[]};Promise[_0x1e95('0xcc')]()[_0x1e95('0x19')](function(){if(_0x563782[_0x1e95('0x23')][_0x1e95('0xcd')]){if(!_[_0x1e95('0xce')](_0x473a7c,_0x563782['query'][_0x1e95('0xcd')]['toLowerCase']())){throw new Error('Invalid\x20channel');}_0x473a7c=[_0x563782[_0x1e95('0x23')][_0x1e95('0xcd')][_0x1e95('0xcf')]()];}if(_0x563782[_0x1e95('0x23')][_0x1e95('0xd0')]){try{var _0x113488=JSON['parse'](_0x563782[_0x1e95('0x23')][_0x1e95('0xd0')]);if(!moment(_0x113488[_0x1e95('0x38')])['isValid']()){throw new Error(_0x1e95('0xd1'));}if(!moment(_0x113488['to'])['isValid']()){throw new Error(_0x1e95('0xd2'));}}catch(_0x1efe00){throw new Error(_0x1e95('0xd3'));}}if(!_0x563782['query']['hasOwnProperty'](_0x1e95('0x82'))){_0x57bcf7[_0x1e95('0x14')]=qs[_0x1e95('0x14')](_0x563782[_0x1e95('0x23')][_0x1e95('0x14')]||0xa);_0x57bcf7[_0x1e95('0x12')]=qs[_0x1e95('0x12')](_0x563782[_0x1e95('0x23')][_0x1e95('0x12')]);}var _0x53b259=_0x473a7c[_0x1e95('0x6c')](function(_0x3fd3b1){if(_0x3fd3b1===_0x1e95('0xcb')){var _0x3e952d={'attributes':['id',_0x1e95('0xd4'),_0x1e95('0x31'),_0x1e95('0xd5'),_0x1e95('0xd6'),_0x1e95('0xd7'),_0x1e95('0xd8'),_0x1e95('0xd9'),_0x1e95('0xda'),_0x1e95('0xdb'),'createdAt',_0x1e95('0xdc'),'userSecondDisposition','userThirdDisposition',_0x1e95('0xdd')],'where':{'ContactId':_0x563782[_0x1e95('0x65')]['id']},'include':[{'model':db[_0x1e95('0xba')],'as':_0x1e95('0xba'),'attributes':['id',_0x1e95('0x1e'),'fullname',_0x1e95('0x2f')]}],'order':[[_0x1e95('0xde'),_0x1e95('0xdf')]]};if(_0x563782[_0x1e95('0x23')][_0x1e95('0xd0')]){_0x3e952d[_0x1e95('0x5a')][_0x1e95('0xde')]={'$gte':_0x113488['from'],'$lte':_0x113488['to']};}return db['VoiceCallReport'][_0x1e95('0xe0')](_0x3e952d)[_0x1e95('0x19')](function(_0x275ed6){_0x4cd8a1[_0x1e95('0x15')]+=_0x275ed6[_0x1e95('0x15')];return _[_0x1e95('0x6c')](_0x275ed6[_0x1e95('0x9e')],function(_0x11b80d){var _0x265b46=_0x11b80d[_0x1e95('0x39')]({'plain':!![]});_0x265b46[_0x1e95('0xcd')]=_0x3fd3b1;if(_0x265b46[_0x1e95('0xba')]){_0x265b46[_0x1e95('0xba')]={'id':_0x265b46[_0x1e95('0xba')]['id'],'name':_0x265b46['User'][_0x1e95('0x1e')],'fullname':_0x265b46[_0x1e95('0xba')][_0x1e95('0xe1')],'alias':_0x265b46['User'][_0x1e95('0x2f')]};}return _0x265b46;});});}else{var _0x156d67=_[_0x1e95('0xe2')](_0x3fd3b1)+(_0x3fd3b1===_0x1e95('0xc7')?_0x1e95('0xe3'):'Account');var _0x28aaa6={'attributes':['id',_0x1e95('0xe4'),_0x1e95('0xe5'),_0x1e95('0xde'),_0x1e95('0xdb'),_0x1e95('0xe6'),'secondDisposition',_0x1e95('0xe7'),'UserId',_0x156d67+'Id'],'where':{'ContactId':_0x563782['params']['id']},'include':[{'model':db[_0x156d67],'as':_0x1e95('0xe8'),'attributes':['id',_0x1e95('0x1e'),_0x1e95('0xe9')]},{'model':db[_0x1e95('0xba')],'as':'Owner','attributes':['id',_0x1e95('0x1e'),'fullname']},{'model':db[_0x1e95('0x76')],'as':'Tags','attributes':['id',_0x1e95('0x1e'),_0x1e95('0x63')],'through':{'attributes':[]}}],'order':[[_0x1e95('0xde'),'DESC']]};if(_0x563782['query'][_0x1e95('0xd0')]){_0x28aaa6['where'][_0x1e95('0xde')]={'$gte':_0x113488['from'],'$lte':_0x113488['to']};}switch(_0x3fd3b1){case _0x1e95('0xc7'):_0x28aaa6['attributes'][_0x1e95('0x5c')](_0x1e95('0xea'),_0x1e95('0xeb'),_0x1e95('0xec'),_0x1e95('0xed'),_0x1e95('0xee'),'ratingMessage',_0x1e95('0xef'),_0x1e95('0xf0'),_0x1e95('0xf1'));break;case _0x1e95('0xf2'):_0x28aaa6[_0x1e95('0x7b')][_0x1e95('0x5c')](_0x1e95('0xf3'),_0x1e95('0xf4'));break;case _0x1e95('0xf5'):_0x28aaa6[_0x1e95('0x7b')][_0x1e95('0x5c')]('externalUrl',_0x1e95('0xf6'));break;}return db[_[_0x1e95('0xe2')](_0x3fd3b1)+_0x1e95('0xf7')]['findAndCountAll'](_0x28aaa6)[_0x1e95('0x19')](function(_0x47d2f8){_0x4cd8a1['count']+=_0x47d2f8[_0x1e95('0x15')];return _[_0x1e95('0x6c')](_0x47d2f8['rows'],function(_0x28b791){var _0xb49a4b=_0x28b791[_0x1e95('0x39')]({'plain':!![]});_0xb49a4b[_0x1e95('0xcd')]=_0x3fd3b1;if(_0xb49a4b[_0x1e95('0xf8')]){_0xb49a4b['Owner']={'id':_0xb49a4b[_0x1e95('0xf8')]['id'],'name':_0xb49a4b['Owner'][_0x1e95('0x1e')],'fullname':_0xb49a4b[_0x1e95('0xf8')]['fullname']};}return _0xb49a4b;});});}});return Promise['all'](_0x53b259);})[_0x1e95('0x19')](function(_0x332d68){return _(_0x332d68)[_0x1e95('0xf9')]()[_0x1e95('0xfa')](_0x1e95('0xde'))[_0x1e95('0xfb')]()[_0x1e95('0xfc')]();})['then'](function(_0x49cd25){_0x4cd8a1[_0x1e95('0x9e')]=_0x57bcf7[_0x1e95('0x14')]?_0x49cd25[_0x1e95('0xfd')](_0x57bcf7[_0x1e95('0x12')],_0x57bcf7['offset']+_0x57bcf7['limit']):_0x49cd25;return _0x4cd8a1;})[_0x1e95('0x19')](respondWithFilteredResult(_0x3981d2,_0x57bcf7))[_0x1e95('0x25')](handleError(_0x3981d2,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index b7a47b5..0073bca 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 _0x59f7=['emit','hasOwnProperty','hook','exports','../../mysqldb','CmContact','setMaxListeners','save','update'];(function(_0x1407d1,_0x4cc88c){var _0x4e6cbe=function(_0x40b958){while(--_0x40b958){_0x1407d1['push'](_0x1407d1['shift']());}};_0x4e6cbe(++_0x4cc88c);}(_0x59f7,0xc1));var _0x759f=function(_0x1692cd,_0x34ba8e){_0x1692cd=_0x1692cd-0x0;var _0x180cff=_0x59f7[_0x1692cd];return _0x180cff;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x759f('0x0'))['db'][_0x759f('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x759f('0x2')](0x0);var events={'afterCreate':_0x759f('0x3'),'afterUpdate':_0x759f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x45f810){return function(_0x693f13,_0x470cc7,_0x45ac7e){CmContactEvents[_0x759f('0x5')](_0x45f810+':'+_0x693f13['id'],_0x693f13);CmContactEvents[_0x759f('0x5')](_0x45f810,_0x693f13);_0x45ac7e(null);};}for(var e in events){if(events[_0x759f('0x6')](e)){var event=events[e];CmContact[_0x759f('0x7')](e,emitEvent(event));}}module[_0x759f('0x8')]=CmContactEvents; \ No newline at end of file +var _0xd6c9=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x259984,_0x2bb933){var _0x394607=function(_0x18138b){while(--_0x18138b){_0x259984['push'](_0x259984['shift']());}};_0x394607(++_0x2bb933);}(_0xd6c9,0x1b7));var _0x9d6c=function(_0x372845,_0x21fdd1){_0x372845=_0x372845-0x0;var _0x168cb9=_0xd6c9[_0x372845];return _0x168cb9;};'use strict';var EventEmitter=require(_0x9d6c('0x0'));var CmContact=require(_0x9d6c('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9d6c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9d6c('0x3'),'afterDestroy':_0x9d6c('0x4')};function emitEvent(_0x3ce681){return function(_0x18736e,_0x223712,_0x2714bc){CmContactEvents[_0x9d6c('0x5')](_0x3ce681+':'+_0x18736e['id'],_0x18736e);CmContactEvents['emit'](_0x3ce681,_0x18736e);_0x2714bc(null);};}for(var e in events){if(events[_0x9d6c('0x6')](e)){var event=events[e];CmContact[_0x9d6c('0x7')](e,emitEvent(event));}}module[_0x9d6c('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 e2a41ef..091aa82 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 _0xc8e0=['CmHopperBlack','message','length','onlyIfOpen','cmContact,\x20%s,\x20%s','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','then','utcOffset','add','minutes','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','always','CmList','BlackLists'];(function(_0xca93f0,_0x4006be){var _0x461ee6=function(_0x4433ea){while(--_0x4433ea){_0xca93f0['push'](_0xca93f0['shift']());}};_0x461ee6(++_0x4006be);}(_0xc8e0,0xa8));var _0x0c8e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc8e0[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x0c8e('0x0'));var util=require(_0x0c8e('0x1'));var logger=require(_0x0c8e('0x2'))('api');var moment=require(_0x0c8e('0x3'));var BPromise=require('bluebird');var rp=require(_0x0c8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c8e('0x5'));var config=require(_0x0c8e('0x6'));var shared=require(_0x0c8e('0x7'));var attributes=require(_0x0c8e('0x8'));module[_0x0c8e('0x9')]=function(_0x2ed962,_0x132013){return _0x2ed962[_0x0c8e('0xa')](_0x0c8e('0xb'),attributes,{'tableName':_0x0c8e('0xc'),'paranoid':!![],'indexes':[{'name':_0x0c8e('0xd'),'fields':[_0x0c8e('0xd')]},{'name':_0x0c8e('0xe'),'fields':[_0x0c8e('0xf'),_0x0c8e('0x10'),'phone','mobile',_0x0c8e('0x11'),_0x0c8e('0x12')],'type':_0x0c8e('0x13')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x0c8e('0x14'),'hooks':{'afterCreate':function(_0x562be7,_0x414cb6,_0xa96274){var _0xc5adfd=_0x2ed962[_0x0c8e('0x15')];var _0x395eb2=_0x562be7[_0x0c8e('0x16')]({'plain':!![]});function _0x68b016(){return function(_0x23ccf4){logger[_0x0c8e('0x17')](_0x0c8e('0x18'),_0x0c8e('0x19'),util[_0x0c8e('0x1a')](_0x23ccf4,{'showHidden':![],'depth':null}));};}function _0x5d8437(_0x20bb98,_0xf79f42){var _0x31c93f=_0xf79f42['scheduledat']?_0xf79f42[_0x0c8e('0x1b')]:moment()[_0x0c8e('0x1c')](_0x0c8e('0x1d'));return new BPromise(function(_0x392873,_0x2235f2){if(_[_0x0c8e('0x1e')](_0xf79f42[_0x0c8e('0x1f')])){_0x392873({'ret':_0x31c93f});}else{_0xc5adfd['VoiceQueue'][_0x0c8e('0x20')]({'where':{'id':_0x20bb98['id']}})[_0x0c8e('0x21')](function(_0x39e73d){if(!_[_0x0c8e('0x1e')](_0x39e73d)){var _0x520489=_0x39e73d['dialTimezone'];if(!_[_0x0c8e('0x1e')](_0x520489)){var _0x12172a=shared['timezones'];var _0xedd773=_0x12172a[_0x520489];var _0x52909d=_0x12172a[_0xf79f42[_0x0c8e('0x1f')]];if(!_[_0x0c8e('0x1e')](_0xedd773)&&!_[_0x0c8e('0x1e')](_0x52909d)){var _0x1f1607=_0xedd773[_0x0c8e('0x22')]-_0x52909d[_0x0c8e('0x22')];_0x31c93f=_0xf79f42[_0x0c8e('0x1b')]?_0xf79f42[_0x0c8e('0x1b')]:moment();var _0x51539d=moment(_0x31c93f)[_0x0c8e('0x23')](_0x1f1607,_0x0c8e('0x24'));_0x392873({'ret':_0x51539d[_0x0c8e('0x1c')](_0x0c8e('0x1d'))});}else _0x392873({'ret':_0x31c93f});}else _0x392873({'ret':_0x31c93f});}else{_0x392873({'ret':_0x31c93f});}});}});return 0xa;}var _0x1afb9e=function(_0x2b9edd){return new BPromise(function(_0x5b0759,_0x280983){_0x5d8437(_0x2b9edd,_0x395eb2)['then'](function(_0x23d7cd){_0x395eb2[_0x0c8e('0x1b')]=_0x23d7cd['ret'];_0xc5adfd[_0x0c8e('0x25')][_0x0c8e('0x20')]({'where':{'phone':_0x395eb2[_0x0c8e('0xd')],'VoiceQueueId':_0x2b9edd['id']}})[_0x0c8e('0x21')](function(_0x28510e){if(!_[_0x0c8e('0x1e')](_0x28510e)){throw new Error(_0x0c8e('0x26')+_0x395eb2[_0x0c8e('0xd')]+_0x0c8e('0x27')+_0x2b9edd['id']);}return _0xc5adfd[_0x0c8e('0x25')][_0x0c8e('0x28')]({'phone':_0x395eb2['phone'],'ContactId':_0x395eb2['id'],'ListId':_0x395eb2[_0x0c8e('0x29')],'priority':_0x395eb2[_0x0c8e('0x2a')]?_0x395eb2[_0x0c8e('0x2a')]:0x2,'scheduledat':_0x395eb2['scheduledat']?_0x395eb2[_0x0c8e('0x1b')]:moment()[_0x0c8e('0x1c')](_0x0c8e('0x1d')),'callback':_0x395eb2[_0x0c8e('0x2b')]?!![]:![],'callbackuniqueid':_0x395eb2[_0x0c8e('0x2b')]?_0x395eb2[_0x0c8e('0x2b')]:undefined,'callbackat':_0x395eb2['callbackUniqueid']?moment()[_0x0c8e('0x1c')](_0x0c8e('0x1d')):undefined,'VoiceQueueId':_0x2b9edd['id']});})[_0x0c8e('0x2c')](function(_0x353dbb){_0x280983(_0x353dbb);});});});};var _0xdd9ca5=function(_0x118176){return new BPromise(function(_0x5bce77,_0x457948){_0x5d8437(_0x118176,_0x395eb2)[_0x0c8e('0x21')](function(_0x4e7dc0){_0x395eb2[_0x0c8e('0x1b')]=_0x4e7dc0[_0x0c8e('0x2d')];_0xc5adfd[_0x0c8e('0x25')][_0x0c8e('0x20')]({'where':{'phone':_0x395eb2[_0x0c8e('0xd')],'VoiceQueueId':_0x118176['id']}})['then'](function(_0x233df8){if(!_[_0x0c8e('0x1e')](_0x233df8)){throw new Error('cmContact,\x20afterCreate\x20'+_0x395eb2[_0x0c8e('0xd')]+_0x0c8e('0x2e')+_0x118176['id']);}return _0xc5adfd[_0x0c8e('0x2f')]['findOne']({'where':{'calleridnum':_0x395eb2[_0x0c8e('0xd')],'VoiceQueueId':_0x118176['id']}});})[_0x0c8e('0x21')](function(_0x5d4d6e){if(!_[_0x0c8e('0x1e')](_0x5d4d6e)){throw new Error(_0x0c8e('0x30')+_0x395eb2[_0x0c8e('0xd')]+_0x0c8e('0x31')+_0x118176['id']);}return _0xc5adfd[_0x0c8e('0x25')][_0x0c8e('0x28')]({'phone':_0x395eb2[_0x0c8e('0xd')],'ContactId':_0x395eb2['id'],'ListId':_0x395eb2['ListId'],'priority':_0x395eb2[_0x0c8e('0x2a')]?_0x395eb2[_0x0c8e('0x2a')]:0x2,'scheduledat':_0x395eb2[_0x0c8e('0x1b')]?_0x395eb2['scheduledat']:moment()[_0x0c8e('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x395eb2[_0x0c8e('0x2b')]?!![]:![],'callbackuniqueid':_0x395eb2[_0x0c8e('0x2b')]?_0x395eb2[_0x0c8e('0x2b')]:undefined,'callbackat':_0x395eb2[_0x0c8e('0x2b')]?moment()[_0x0c8e('0x1c')](_0x0c8e('0x1d')):undefined,'VoiceQueueId':_0x118176['id']});})[_0x0c8e('0x2c')](function(_0x34ac07){_0x457948(_0x34ac07);});});});};function _0x17e2bf(){return function(_0x40bbda){logger[_0x0c8e('0x17')](_0x0c8e('0x18'),_0x0c8e('0x19'),util[_0x0c8e('0x1a')](_0x40bbda,{'showHidden':![],'depth':null}));};}function _0x5a6140(_0x4a1232,_0x26b5c0){var _0x357f93=_0x26b5c0[_0x0c8e('0x1b')]?_0x26b5c0[_0x0c8e('0x1b')]:moment()[_0x0c8e('0x1c')](_0x0c8e('0x1d'));return new BPromise(function(_0x4746ca,_0x54fe38){if(_['isNil'](_0x26b5c0[_0x0c8e('0x1f')])){_0x4746ca({'ret':_0x357f93});}else{_0xc5adfd[_0x0c8e('0x32')][_0x0c8e('0x20')]({'where':{'id':_0x4a1232['id']}})[_0x0c8e('0x21')](function(_0xfacb4a){if(!_[_0x0c8e('0x1e')](_0xfacb4a)){var _0x131c8e=_0xfacb4a['dialTimezone'];if(!_[_0x0c8e('0x1e')](_0x131c8e)){var _0x379ca6=shared[_0x0c8e('0x33')];var _0x21882e=_0x379ca6[_0x131c8e];var _0x570bfd=_0x379ca6[_0x26b5c0[_0x0c8e('0x1f')]];if(!_['isNil'](_0x21882e)&&!_[_0x0c8e('0x1e')](_0x570bfd)){var _0x4c93c6=_0x21882e['utcOffset']-_0x570bfd[_0x0c8e('0x22')];_0x357f93=_0x26b5c0[_0x0c8e('0x1b')]?_0x26b5c0[_0x0c8e('0x1b')]:moment();var _0x545bcb=moment(_0x357f93)[_0x0c8e('0x23')](_0x4c93c6,'minutes');_0x4746ca({'ret':_0x545bcb[_0x0c8e('0x1c')](_0x0c8e('0x1d'))});}else _0x4746ca({'ret':_0x357f93});}else _0x4746ca({'ret':_0x357f93});}else{_0x4746ca({'ret':_0x357f93});}});}});return 0xa;}var _0x13c48a=function(_0x45b0dd){return new BPromise(function(_0x31c4c7,_0x176d08){_0x5a6140(_0x45b0dd,_0x395eb2)[_0x0c8e('0x21')](function(_0x2a3721){_0x395eb2[_0x0c8e('0x1b')]=_0x2a3721[_0x0c8e('0x2d')];_0xc5adfd['CmHopper'][_0x0c8e('0x20')]({'where':{'phone':_0x395eb2[_0x0c8e('0xd')],'CampaignId':_0x45b0dd['id']}})['then'](function(_0x81a0fd){if(!_[_0x0c8e('0x1e')](_0x81a0fd)){throw new Error(_0x0c8e('0x26')+_0x395eb2[_0x0c8e('0xd')]+_0x0c8e('0x34')+_0x45b0dd['id']);}return _0xc5adfd[_0x0c8e('0x25')]['create']({'phone':_0x395eb2['phone'],'ContactId':_0x395eb2['id'],'ListId':_0x395eb2[_0x0c8e('0x29')],'priority':_0x395eb2[_0x0c8e('0x2a')]?_0x395eb2['priority']:0x2,'scheduledat':_0x395eb2['scheduledat']?_0x395eb2[_0x0c8e('0x1b')]:moment()[_0x0c8e('0x1c')](_0x0c8e('0x1d')),'callback':_0x395eb2['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x395eb2['callbackUniqueid']?_0x395eb2['callbackUniqueid']:undefined,'callbackat':_0x395eb2[_0x0c8e('0x2b')]?moment()['format'](_0x0c8e('0x1d')):undefined,'CampaignId':_0x45b0dd['id']});})[_0x0c8e('0x2c')](function(_0x1b0417){_0x176d08(_0x1b0417);});});});};var _0x8e9c85=function(_0x2bc3f9){return new BPromise(function(_0xf28de3,_0x456dcd){_0x5a6140(_0x2bc3f9,_0x395eb2)[_0x0c8e('0x21')](function(_0x4c4288){_0x395eb2[_0x0c8e('0x1b')]=_0x4c4288[_0x0c8e('0x2d')];_0xc5adfd[_0x0c8e('0x25')][_0x0c8e('0x20')]({'where':{'phone':_0x395eb2[_0x0c8e('0xd')],'CampaignId':_0x2bc3f9['id']}})[_0x0c8e('0x21')](function(_0x3c6574){if(!_['isNil'](_0x3c6574)){throw new Error(_0x0c8e('0x26')+_0x395eb2[_0x0c8e('0xd')]+_0x0c8e('0x35')+_0x2bc3f9['id']);}return _0xc5adfd[_0x0c8e('0x2f')][_0x0c8e('0x20')]({'where':{'calleridnum':_0x395eb2['phone'],'CampaignId':_0x2bc3f9['id']}});})[_0x0c8e('0x21')](function(_0x198455){if(!_[_0x0c8e('0x1e')](_0x198455)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x395eb2['phone']+_0x0c8e('0x36')+_0x2bc3f9['id']);}return _0xc5adfd[_0x0c8e('0x25')][_0x0c8e('0x28')]({'phone':_0x395eb2['phone'],'ContactId':_0x395eb2['id'],'ListId':_0x395eb2['ListId'],'priority':_0x395eb2[_0x0c8e('0x2a')]?_0x395eb2['priority']:0x2,'scheduledat':_0x395eb2[_0x0c8e('0x1b')]?_0x395eb2['scheduledat']:moment()[_0x0c8e('0x1c')](_0x0c8e('0x1d')),'callback':_0x395eb2[_0x0c8e('0x2b')]?!![]:![],'callbackuniqueid':_0x395eb2[_0x0c8e('0x2b')]?_0x395eb2[_0x0c8e('0x2b')]:undefined,'callbackat':_0x395eb2['callbackUniqueid']?moment()[_0x0c8e('0x1c')](_0x0c8e('0x1d')):undefined,'CampaignId':_0x2bc3f9['id']});})[_0x0c8e('0x2c')](function(_0x3daed5){_0x456dcd(_0x3daed5);});});});};if(_0x395eb2[_0x0c8e('0x29')]){_0xc5adfd[_0x0c8e('0x37')][_0x0c8e('0x38')]({'where':{'type':_0x0c8e('0x39')},'attributes':['id',_0x0c8e('0x3a'),_0x0c8e('0x1f')],'include':[{'model':_0xc5adfd['CmList'],'as':_0x0c8e('0x3b'),'where':{'id':_0x395eb2[_0x0c8e('0x29')]}}]})[_0x0c8e('0x21')](function(_0x47be56){if(_0x47be56){var _0x592aef=[];for(var _0x3b6b37=0x0,_0x50541d;_0x3b6b37<_0x47be56['length'];_0x3b6b37+=0x1){_0x50541d=_0x47be56[_0x3b6b37][_0x0c8e('0x16')]({'plain':!![]});switch(_0x50541d['dialCheckDuplicateType']){case _0x0c8e('0x3c'):_0xdd9ca5(_0x50541d)['catch'](_0x68b016());break;case'onlyIfOpen':_0x1afb9e(_0x50541d)['catch'](_0x68b016());break;default:_0x5a6140(_0x50541d,_0x395eb2)[_0x0c8e('0x21')](function(_0x2b280c){_0x395eb2[_0x0c8e('0x1b')]=_0x2b280c[_0x0c8e('0x2d')];_0xc5adfd[_0x0c8e('0x25')]['create']({'phone':_0x395eb2['phone'],'ContactId':_0x395eb2['id'],'ListId':_0x395eb2[_0x0c8e('0x29')],'scheduledat':_0x395eb2['scheduledat']?_0x395eb2['scheduledat']:moment()[_0x0c8e('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x395eb2['priority']?_0x395eb2['priority']:0x2,'callback':_0x395eb2[_0x0c8e('0x2b')]?!![]:![],'callbackuniqueid':_0x395eb2[_0x0c8e('0x2b')]?_0x395eb2[_0x0c8e('0x2b')]:undefined,'callbackat':_0x395eb2[_0x0c8e('0x2b')]?moment()['format'](_0x0c8e('0x1d')):undefined,'VoiceQueueId':_0x50541d['id']})[_0x0c8e('0x2c')](_0x68b016());});}}}})[_0x0c8e('0x21')](function(){return _0xc5adfd['VoiceQueue'][_0x0c8e('0x38')]({'where':{'type':_0x0c8e('0x39')},'attributes':['id'],'include':[{'model':_0xc5adfd[_0x0c8e('0x3d')],'as':_0x0c8e('0x3e'),'where':{'id':_0x395eb2[_0x0c8e('0x29')]}}]})[_0x0c8e('0x21')](function(_0x39e630){if(_0x39e630){var _0x1f3424=[];for(var _0x597c5b=0x0,_0x2c6bb6;_0x597c5b<_0x39e630['length'];_0x597c5b+=0x1){_0x2c6bb6=_0x39e630[_0x597c5b]['get']({'plain':!![]});_0xc5adfd[_0x0c8e('0x3f')]['create']({'phone':_0x395eb2[_0x0c8e('0xd')],'ContactId':_0x395eb2['id'],'ListId':_0x395eb2[_0x0c8e('0x29')],'VoiceQueueId':_0x2c6bb6['id']})[_0x0c8e('0x2c')](function(_0x1c940b){logger[_0x0c8e('0x17')]('cmContact,\x20%s,\x20%s','afterCreate',_0x1c940b[_0x0c8e('0x40')]);});}}});})[_0x0c8e('0x21')](function(){return _0xc5adfd[_0x0c8e('0x32')][_0x0c8e('0x38')]({'attributes':['id',_0x0c8e('0x3a'),_0x0c8e('0x1f')],'include':[{'model':_0xc5adfd[_0x0c8e('0x3d')],'as':_0x0c8e('0x3b'),'where':{'id':_0x395eb2[_0x0c8e('0x29')]}}]})[_0x0c8e('0x21')](function(_0x102eef){if(_0x102eef){var _0x323c32=[];for(var _0xc2a41c=0x0,_0x45cc0e;_0xc2a41c<_0x102eef[_0x0c8e('0x41')];_0xc2a41c+=0x1){_0x45cc0e=_0x102eef[_0xc2a41c]['get']({'plain':!![]});switch(_0x45cc0e[_0x0c8e('0x3a')]){case _0x0c8e('0x3c'):_0x8e9c85(_0x45cc0e)[_0x0c8e('0x2c')](_0x17e2bf());break;case _0x0c8e('0x42'):_0x13c48a(_0x45cc0e)[_0x0c8e('0x2c')](_0x17e2bf());break;default:_0xc5adfd[_0x0c8e('0x25')]['create']({'phone':_0x395eb2['phone'],'ContactId':_0x395eb2['id'],'ListId':_0x395eb2['ListId'],'scheduledat':_0x395eb2[_0x0c8e('0x1b')]?_0x395eb2[_0x0c8e('0x1b')]:moment()[_0x0c8e('0x1c')](_0x0c8e('0x1d')),'priority':_0x395eb2[_0x0c8e('0x2a')]?_0x395eb2[_0x0c8e('0x2a')]:0x2,'callback':_0x395eb2[_0x0c8e('0x2b')]?!![]:![],'callbackuniqueid':_0x395eb2[_0x0c8e('0x2b')]?_0x395eb2[_0x0c8e('0x2b')]:undefined,'callbackat':_0x395eb2[_0x0c8e('0x2b')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x45cc0e['id']})[_0x0c8e('0x2c')](_0x17e2bf());}}}});})['then'](function(){return _0xc5adfd[_0x0c8e('0x32')]['findAll']({'attributes':['id'],'include':[{'model':_0xc5adfd[_0x0c8e('0x3d')],'as':'BlackLists','where':{'id':_0x395eb2[_0x0c8e('0x29')]}}]})[_0x0c8e('0x21')](function(_0x550a63){if(_0x550a63){var _0x52da6b=[];for(var _0x3371a4=0x0,_0x37d11f;_0x3371a4<_0x550a63['length'];_0x3371a4+=0x1){_0x37d11f=_0x550a63[_0x3371a4][_0x0c8e('0x16')]({'plain':!![]});_0xc5adfd[_0x0c8e('0x3f')]['create']({'phone':_0x395eb2[_0x0c8e('0xd')],'ContactId':_0x395eb2['id'],'ListId':_0x395eb2['ListId'],'CampaignId':_0x37d11f['id']})['catch'](function(_0x124987){logger[_0x0c8e('0x17')](_0x0c8e('0x43'),_0x0c8e('0x19'),_0x124987[_0x0c8e('0x40')]);});}}});})[_0x0c8e('0x21')](function(){_0xa96274();})[_0x0c8e('0x2c')](function(_0x3e877e){logger[_0x0c8e('0x17')](_0x0c8e('0x43'),_0x0c8e('0x19'),_0x3e877e[_0x0c8e('0x40')]);_0xa96274(_0x3e877e);});}else{_0xa96274(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0xa7a7af,_0x5d965c,_0x4ba24f){var _0x11f70d=_0x2ed962['models'];var _0x220310=_0xa7a7af[_0x0c8e('0x16')]({'plain':!![]});return _0x11f70d[_0x0c8e('0x25')][_0x0c8e('0x38')]({'raw':!![],'where':{'ListId':_0x220310[_0x0c8e('0x29')],'ContactId':_0x220310['id']}})[_0x0c8e('0x21')](function(_0x2615e5){if(!_[_0x0c8e('0x44')](_0x2615e5)){var _0x857c6a=[];for(var _0x24aedf=0x0;_0x24aedf<_0x2615e5[_0x0c8e('0x41')];_0x24aedf+=0x1){var _0x5360be=_0x11f70d['CmHopper'][_0x0c8e('0x45')]({'where':{'ListId':_0x2615e5[_0x24aedf][_0x0c8e('0x29')],'ContactId':_0x2615e5[_0x24aedf][_0x0c8e('0x46')],'VoiceQueueId':_0x2615e5[_0x24aedf][_0x0c8e('0x47')],'CampaignId':_0x2615e5[_0x24aedf][_0x0c8e('0x48')]}});_0x857c6a[_0x0c8e('0x49')](_0x5360be);}return BPromise[_0x0c8e('0x4a')](_0x857c6a);}})['then'](function(_0x2b8772){logger['info'](_0x0c8e('0x4b'),util['inspect'](_0x2b8772,{'showHidden':![],'depth':null}));_0x4ba24f();})[_0x0c8e('0x2c')](function(_0x3a5c5b){logger[_0x0c8e('0x17')](_0x0c8e('0x4c'),util[_0x0c8e('0x1a')](_0x3a5c5b,{'showHidden':![],'depth':null}));_0x4ba24f(_0x3a5c5b);});}}});}; \ No newline at end of file +var _0x0079=['format','YYYY-MM-DD\x20HH:mm:ss','VoiceQueue','findOne','isNil','dialTimezone','utcOffset','add','minutes','then','ret','CmHopper','cmContact,\x20afterCreate\x20','create','priority','callbackUniqueid','catch','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','ListId','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','onlyIfOpen','CmHopperBlack','cmContact,\x20%s,\x20%s','message','always','Campaign','BlackLists','isEmpty','destroy','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat'];(function(_0x366525,_0x55e1e3){var _0x1fcb86=function(_0x5a5eac){while(--_0x5a5eac){_0x366525['push'](_0x366525['shift']());}};_0x1fcb86(++_0x55e1e3);}(_0x0079,0xbb));var _0x9007=function(_0x517787,_0x2e4a07){_0x517787=_0x517787-0x0;var _0x8438ae=_0x0079[_0x517787];return _0x8438ae;};'use strict';var _=require(_0x9007('0x0'));var util=require('util');var logger=require(_0x9007('0x1'))(_0x9007('0x2'));var moment=require(_0x9007('0x3'));var BPromise=require(_0x9007('0x4'));var rp=require(_0x9007('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9007('0x6'));var config=require('../../config/environment');var shared=require(_0x9007('0x7'));var attributes=require(_0x9007('0x8'));module[_0x9007('0x9')]=function(_0x25e475,_0x5b21c1){return _0x25e475[_0x9007('0xa')](_0x9007('0xb'),attributes,{'tableName':_0x9007('0xc'),'paranoid':!![],'indexes':[{'name':_0x9007('0xd'),'fields':[_0x9007('0xd')]},{'name':_0x9007('0xe'),'fields':[_0x9007('0xf'),_0x9007('0x10'),_0x9007('0xd'),_0x9007('0x11'),'fax',_0x9007('0x12')],'type':_0x9007('0x13')}],'timestamps':!![],'charset':_0x9007('0x14'),'collate':_0x9007('0x15'),'hooks':{'afterCreate':function(_0xa32bc0,_0x2efec8,_0x2537b8){var _0xa31c38=_0x25e475[_0x9007('0x16')];var _0x47de55=_0xa32bc0[_0x9007('0x17')]({'plain':!![]});function _0xe82dc3(){return function(_0x506052){logger[_0x9007('0x18')](_0x9007('0x19'),_0x9007('0x1a'),util[_0x9007('0x1b')](_0x506052,{'showHidden':![],'depth':null}));};}function _0x5f2dae(_0x592ba2,_0x41eeb9){var _0x12a9f8=_0x41eeb9[_0x9007('0x1c')]?_0x41eeb9[_0x9007('0x1c')]:moment()[_0x9007('0x1d')](_0x9007('0x1e'));return new BPromise(function(_0x10fff9,_0x125e63){if(_['isNil'](_0x41eeb9['dialTimezone'])){_0x10fff9({'ret':_0x12a9f8});}else{_0xa31c38[_0x9007('0x1f')][_0x9007('0x20')]({'where':{'id':_0x592ba2['id']}})['then'](function(_0x38293c){if(!_[_0x9007('0x21')](_0x38293c)){var _0x59fa70=_0x38293c[_0x9007('0x22')];if(!_[_0x9007('0x21')](_0x59fa70)){var _0x2e2d7e=shared['timezones'];var _0x5b3058=_0x2e2d7e[_0x59fa70];var _0x1afd01=_0x2e2d7e[_0x41eeb9['dialTimezone']];if(!_[_0x9007('0x21')](_0x5b3058)&&!_[_0x9007('0x21')](_0x1afd01)){var _0x3aa917=_0x5b3058['utcOffset']-_0x1afd01[_0x9007('0x23')];_0x12a9f8=_0x41eeb9[_0x9007('0x1c')]?_0x41eeb9[_0x9007('0x1c')]:moment();var _0x4ae01b=moment(_0x12a9f8)[_0x9007('0x24')](_0x3aa917,_0x9007('0x25'));_0x10fff9({'ret':_0x4ae01b[_0x9007('0x1d')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x10fff9({'ret':_0x12a9f8});}else _0x10fff9({'ret':_0x12a9f8});}else{_0x10fff9({'ret':_0x12a9f8});}});}});return 0xa;}var _0x51323c=function(_0x4f66cf){return new BPromise(function(_0x3b4f0f,_0x5d3725){_0x5f2dae(_0x4f66cf,_0x47de55)[_0x9007('0x26')](function(_0x50265e){_0x47de55[_0x9007('0x1c')]=_0x50265e[_0x9007('0x27')];_0xa31c38[_0x9007('0x28')]['findOne']({'where':{'phone':_0x47de55[_0x9007('0xd')],'VoiceQueueId':_0x4f66cf['id']}})[_0x9007('0x26')](function(_0x3b40fd){if(!_['isNil'](_0x3b40fd)){throw new Error(_0x9007('0x29')+_0x47de55[_0x9007('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x4f66cf['id']);}return _0xa31c38[_0x9007('0x28')][_0x9007('0x2a')]({'phone':_0x47de55[_0x9007('0xd')],'ContactId':_0x47de55['id'],'ListId':_0x47de55['ListId'],'priority':_0x47de55[_0x9007('0x2b')]?_0x47de55['priority']:0x2,'scheduledat':_0x47de55[_0x9007('0x1c')]?_0x47de55['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x47de55['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x47de55[_0x9007('0x2c')]?_0x47de55['callbackUniqueid']:undefined,'callbackat':_0x47de55[_0x9007('0x2c')]?moment()[_0x9007('0x1d')](_0x9007('0x1e')):undefined,'VoiceQueueId':_0x4f66cf['id']});})[_0x9007('0x2d')](function(_0x1808ed){_0x5d3725(_0x1808ed);});});});};var _0x38c92f=function(_0x387b5d){return new BPromise(function(_0x2fdbb2,_0x608b86){_0x5f2dae(_0x387b5d,_0x47de55)[_0x9007('0x26')](function(_0x165658){_0x47de55['scheduledat']=_0x165658[_0x9007('0x27')];_0xa31c38['CmHopper'][_0x9007('0x20')]({'where':{'phone':_0x47de55['phone'],'VoiceQueueId':_0x387b5d['id']}})['then'](function(_0x435294){if(!_[_0x9007('0x21')](_0x435294)){throw new Error(_0x9007('0x29')+_0x47de55[_0x9007('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x387b5d['id']);}return _0xa31c38[_0x9007('0x2e')][_0x9007('0x20')]({'where':{'calleridnum':_0x47de55[_0x9007('0xd')],'VoiceQueueId':_0x387b5d['id']}});})[_0x9007('0x26')](function(_0x1b8826){if(!_[_0x9007('0x21')](_0x1b8826)){throw new Error(_0x9007('0x2f')+_0x47de55[_0x9007('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x387b5d['id']);}return _0xa31c38[_0x9007('0x28')][_0x9007('0x2a')]({'phone':_0x47de55['phone'],'ContactId':_0x47de55['id'],'ListId':_0x47de55['ListId'],'priority':_0x47de55['priority']?_0x47de55[_0x9007('0x2b')]:0x2,'scheduledat':_0x47de55[_0x9007('0x1c')]?_0x47de55['scheduledat']:moment()[_0x9007('0x1d')](_0x9007('0x1e')),'callback':_0x47de55[_0x9007('0x2c')]?!![]:![],'callbackuniqueid':_0x47de55[_0x9007('0x2c')]?_0x47de55[_0x9007('0x2c')]:undefined,'callbackat':_0x47de55['callbackUniqueid']?moment()[_0x9007('0x1d')](_0x9007('0x1e')):undefined,'VoiceQueueId':_0x387b5d['id']});})['catch'](function(_0x28a90b){_0x608b86(_0x28a90b);});});});};function _0x38122b(){return function(_0x1f48b4){logger[_0x9007('0x18')]('cmContact',_0x9007('0x1a'),util[_0x9007('0x1b')](_0x1f48b4,{'showHidden':![],'depth':null}));};}function _0x16ddc8(_0xc40c7d,_0x42310a){var _0x53ce70=_0x42310a[_0x9007('0x1c')]?_0x42310a['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x1ab3d8,_0x2f9ff6){if(_['isNil'](_0x42310a['dialTimezone'])){_0x1ab3d8({'ret':_0x53ce70});}else{_0xa31c38['Campaign']['findOne']({'where':{'id':_0xc40c7d['id']}})[_0x9007('0x26')](function(_0x154eb5){if(!_[_0x9007('0x21')](_0x154eb5)){var _0x19a1a5=_0x154eb5[_0x9007('0x22')];if(!_['isNil'](_0x19a1a5)){var _0x5732ef=shared['timezones'];var _0x428124=_0x5732ef[_0x19a1a5];var _0x1291d2=_0x5732ef[_0x42310a[_0x9007('0x22')]];if(!_[_0x9007('0x21')](_0x428124)&&!_[_0x9007('0x21')](_0x1291d2)){var _0x32c331=_0x428124[_0x9007('0x23')]-_0x1291d2[_0x9007('0x23')];_0x53ce70=_0x42310a[_0x9007('0x1c')]?_0x42310a[_0x9007('0x1c')]:moment();var _0x3575b7=moment(_0x53ce70)[_0x9007('0x24')](_0x32c331,_0x9007('0x25'));_0x1ab3d8({'ret':_0x3575b7['format'](_0x9007('0x1e'))});}else _0x1ab3d8({'ret':_0x53ce70});}else _0x1ab3d8({'ret':_0x53ce70});}else{_0x1ab3d8({'ret':_0x53ce70});}});}});return 0xa;}var _0x4ed3e9=function(_0x20b9bd){return new BPromise(function(_0x47fd81,_0x149bc2){_0x16ddc8(_0x20b9bd,_0x47de55)['then'](function(_0x2fdecc){_0x47de55[_0x9007('0x1c')]=_0x2fdecc['ret'];_0xa31c38[_0x9007('0x28')]['findOne']({'where':{'phone':_0x47de55[_0x9007('0xd')],'CampaignId':_0x20b9bd['id']}})[_0x9007('0x26')](function(_0x4b3fb3){if(!_['isNil'](_0x4b3fb3)){throw new Error(_0x9007('0x29')+_0x47de55[_0x9007('0xd')]+_0x9007('0x30')+_0x20b9bd['id']);}return _0xa31c38[_0x9007('0x28')][_0x9007('0x2a')]({'phone':_0x47de55[_0x9007('0xd')],'ContactId':_0x47de55['id'],'ListId':_0x47de55[_0x9007('0x31')],'priority':_0x47de55['priority']?_0x47de55[_0x9007('0x2b')]:0x2,'scheduledat':_0x47de55[_0x9007('0x1c')]?_0x47de55[_0x9007('0x1c')]:moment()[_0x9007('0x1d')](_0x9007('0x1e')),'callback':_0x47de55[_0x9007('0x2c')]?!![]:![],'callbackuniqueid':_0x47de55[_0x9007('0x2c')]?_0x47de55[_0x9007('0x2c')]:undefined,'callbackat':_0x47de55[_0x9007('0x2c')]?moment()[_0x9007('0x1d')](_0x9007('0x1e')):undefined,'CampaignId':_0x20b9bd['id']});})[_0x9007('0x2d')](function(_0x1c90fb){_0x149bc2(_0x1c90fb);});});});};var _0x4a4e62=function(_0x29ff0c){return new BPromise(function(_0x14072e,_0x3ccd51){_0x16ddc8(_0x29ff0c,_0x47de55)[_0x9007('0x26')](function(_0x10604d){_0x47de55['scheduledat']=_0x10604d[_0x9007('0x27')];_0xa31c38[_0x9007('0x28')][_0x9007('0x20')]({'where':{'phone':_0x47de55[_0x9007('0xd')],'CampaignId':_0x29ff0c['id']}})[_0x9007('0x26')](function(_0x51e2a){if(!_[_0x9007('0x21')](_0x51e2a)){throw new Error(_0x9007('0x29')+_0x47de55[_0x9007('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x29ff0c['id']);}return _0xa31c38['CmHopperFinal'][_0x9007('0x20')]({'where':{'calleridnum':_0x47de55[_0x9007('0xd')],'CampaignId':_0x29ff0c['id']}});})[_0x9007('0x26')](function(_0x15cc23){if(!_['isNil'](_0x15cc23)){throw new Error(_0x9007('0x2f')+_0x47de55[_0x9007('0xd')]+_0x9007('0x32')+_0x29ff0c['id']);}return _0xa31c38[_0x9007('0x28')]['create']({'phone':_0x47de55[_0x9007('0xd')],'ContactId':_0x47de55['id'],'ListId':_0x47de55[_0x9007('0x31')],'priority':_0x47de55[_0x9007('0x2b')]?_0x47de55[_0x9007('0x2b')]:0x2,'scheduledat':_0x47de55['scheduledat']?_0x47de55['scheduledat']:moment()[_0x9007('0x1d')](_0x9007('0x1e')),'callback':_0x47de55[_0x9007('0x2c')]?!![]:![],'callbackuniqueid':_0x47de55[_0x9007('0x2c')]?_0x47de55[_0x9007('0x2c')]:undefined,'callbackat':_0x47de55[_0x9007('0x2c')]?moment()['format'](_0x9007('0x1e')):undefined,'CampaignId':_0x29ff0c['id']});})[_0x9007('0x2d')](function(_0x2f2789){_0x3ccd51(_0x2f2789);});});});};if(_0x47de55[_0x9007('0x31')]){_0xa31c38[_0x9007('0x1f')][_0x9007('0x33')]({'where':{'type':_0x9007('0x34')},'attributes':['id',_0x9007('0x35'),_0x9007('0x22')],'include':[{'model':_0xa31c38[_0x9007('0x36')],'as':_0x9007('0x37'),'where':{'id':_0x47de55['ListId']}}]})[_0x9007('0x26')](function(_0x213e82){if(_0x213e82){var _0x559278=[];for(var _0x1e25bd=0x0,_0x328ae4;_0x1e25bd<_0x213e82[_0x9007('0x38')];_0x1e25bd+=0x1){_0x328ae4=_0x213e82[_0x1e25bd]['get']({'plain':!![]});switch(_0x328ae4[_0x9007('0x35')]){case'always':_0x38c92f(_0x328ae4)[_0x9007('0x2d')](_0xe82dc3());break;case _0x9007('0x39'):_0x51323c(_0x328ae4)[_0x9007('0x2d')](_0xe82dc3());break;default:_0x16ddc8(_0x328ae4,_0x47de55)[_0x9007('0x26')](function(_0x3cf8b2){_0x47de55[_0x9007('0x1c')]=_0x3cf8b2[_0x9007('0x27')];_0xa31c38['CmHopper'][_0x9007('0x2a')]({'phone':_0x47de55[_0x9007('0xd')],'ContactId':_0x47de55['id'],'ListId':_0x47de55['ListId'],'scheduledat':_0x47de55[_0x9007('0x1c')]?_0x47de55[_0x9007('0x1c')]:moment()[_0x9007('0x1d')](_0x9007('0x1e')),'priority':_0x47de55[_0x9007('0x2b')]?_0x47de55[_0x9007('0x2b')]:0x2,'callback':_0x47de55[_0x9007('0x2c')]?!![]:![],'callbackuniqueid':_0x47de55['callbackUniqueid']?_0x47de55[_0x9007('0x2c')]:undefined,'callbackat':_0x47de55[_0x9007('0x2c')]?moment()[_0x9007('0x1d')](_0x9007('0x1e')):undefined,'VoiceQueueId':_0x328ae4['id']})[_0x9007('0x2d')](_0xe82dc3());});}}}})[_0x9007('0x26')](function(){return _0xa31c38[_0x9007('0x1f')]['findAll']({'where':{'type':_0x9007('0x34')},'attributes':['id'],'include':[{'model':_0xa31c38[_0x9007('0x36')],'as':'BlackLists','where':{'id':_0x47de55[_0x9007('0x31')]}}]})[_0x9007('0x26')](function(_0x13e347){if(_0x13e347){var _0x3a7272=[];for(var _0x5f4e3c=0x0,_0x291f00;_0x5f4e3c<_0x13e347[_0x9007('0x38')];_0x5f4e3c+=0x1){_0x291f00=_0x13e347[_0x5f4e3c]['get']({'plain':!![]});_0xa31c38[_0x9007('0x3a')][_0x9007('0x2a')]({'phone':_0x47de55[_0x9007('0xd')],'ContactId':_0x47de55['id'],'ListId':_0x47de55[_0x9007('0x31')],'VoiceQueueId':_0x291f00['id']})['catch'](function(_0xdbf9e2){logger[_0x9007('0x18')](_0x9007('0x3b'),_0x9007('0x1a'),_0xdbf9e2[_0x9007('0x3c')]);});}}});})[_0x9007('0x26')](function(){return _0xa31c38['Campaign'][_0x9007('0x33')]({'attributes':['id','dialCheckDuplicateType',_0x9007('0x22')],'include':[{'model':_0xa31c38[_0x9007('0x36')],'as':_0x9007('0x37'),'where':{'id':_0x47de55['ListId']}}]})[_0x9007('0x26')](function(_0x40be4b){if(_0x40be4b){var _0x367891=[];for(var _0x4e2a40=0x0,_0x5771e5;_0x4e2a40<_0x40be4b[_0x9007('0x38')];_0x4e2a40+=0x1){_0x5771e5=_0x40be4b[_0x4e2a40]['get']({'plain':!![]});switch(_0x5771e5[_0x9007('0x35')]){case _0x9007('0x3d'):_0x4a4e62(_0x5771e5)[_0x9007('0x2d')](_0x38122b());break;case _0x9007('0x39'):_0x4ed3e9(_0x5771e5)[_0x9007('0x2d')](_0x38122b());break;default:_0xa31c38[_0x9007('0x28')][_0x9007('0x2a')]({'phone':_0x47de55[_0x9007('0xd')],'ContactId':_0x47de55['id'],'ListId':_0x47de55[_0x9007('0x31')],'scheduledat':_0x47de55[_0x9007('0x1c')]?_0x47de55[_0x9007('0x1c')]:moment()[_0x9007('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x47de55[_0x9007('0x2b')]?_0x47de55[_0x9007('0x2b')]:0x2,'callback':_0x47de55[_0x9007('0x2c')]?!![]:![],'callbackuniqueid':_0x47de55[_0x9007('0x2c')]?_0x47de55[_0x9007('0x2c')]:undefined,'callbackat':_0x47de55[_0x9007('0x2c')]?moment()[_0x9007('0x1d')](_0x9007('0x1e')):undefined,'CampaignId':_0x5771e5['id']})[_0x9007('0x2d')](_0x38122b());}}}});})[_0x9007('0x26')](function(){return _0xa31c38[_0x9007('0x3e')]['findAll']({'attributes':['id'],'include':[{'model':_0xa31c38['CmList'],'as':_0x9007('0x3f'),'where':{'id':_0x47de55['ListId']}}]})[_0x9007('0x26')](function(_0x192a76){if(_0x192a76){var _0x4b5dd3=[];for(var _0x51e2f6=0x0,_0x49a58a;_0x51e2f6<_0x192a76[_0x9007('0x38')];_0x51e2f6+=0x1){_0x49a58a=_0x192a76[_0x51e2f6][_0x9007('0x17')]({'plain':!![]});_0xa31c38[_0x9007('0x3a')][_0x9007('0x2a')]({'phone':_0x47de55['phone'],'ContactId':_0x47de55['id'],'ListId':_0x47de55[_0x9007('0x31')],'CampaignId':_0x49a58a['id']})[_0x9007('0x2d')](function(_0xa772f6){logger[_0x9007('0x18')](_0x9007('0x3b'),_0x9007('0x1a'),_0xa772f6[_0x9007('0x3c')]);});}}});})[_0x9007('0x26')](function(){_0x2537b8();})[_0x9007('0x2d')](function(_0x4dc12f){logger['error'](_0x9007('0x3b'),_0x9007('0x1a'),_0x4dc12f[_0x9007('0x3c')]);_0x2537b8(_0x4dc12f);});}else{_0x2537b8(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x354123,_0x3d6598,_0x13c240){var _0x5ab773=_0x25e475[_0x9007('0x16')];var _0x328031=_0x354123['get']({'plain':!![]});return _0x5ab773[_0x9007('0x28')][_0x9007('0x33')]({'raw':!![],'where':{'ListId':_0x328031['ListId'],'ContactId':_0x328031['id']}})[_0x9007('0x26')](function(_0x53bd36){if(!_[_0x9007('0x40')](_0x53bd36)){var _0x368f66=[];for(var _0x33e65d=0x0;_0x33e65d<_0x53bd36['length'];_0x33e65d+=0x1){var _0x348fb9=_0x5ab773['CmHopper'][_0x9007('0x41')]({'where':{'ListId':_0x53bd36[_0x33e65d][_0x9007('0x31')],'ContactId':_0x53bd36[_0x33e65d]['ContactId'],'VoiceQueueId':_0x53bd36[_0x33e65d][_0x9007('0x42')],'CampaignId':_0x53bd36[_0x33e65d][_0x9007('0x43')]}});_0x368f66[_0x9007('0x44')](_0x348fb9);}return BPromise[_0x9007('0x45')](_0x368f66);}})[_0x9007('0x26')](function(_0x2a2642){logger['info'](_0x9007('0x46'),util[_0x9007('0x1b')](_0x2a2642,{'showHidden':![],'depth':null}));_0x13c240();})[_0x9007('0x2d')](function(_0x58f732){logger[_0x9007('0x18')](_0x9007('0x47'),util['inspect'](_0x58f732,{'showHidden':![],'depth':null}));_0x13c240(_0x58f732);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 624c2ba..6b449c5 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(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x38da12,_0x4a70eb){var _0xbf8b94=function(_0x323bc4){while(--_0x323bc4){_0x38da12['push'](_0x38da12['shift']());}};_0xbf8b94(++_0x4a70eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 2e2642f..113f9c4 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 _0x3f49=['exports','STRING','INTEGER','sequelize'];(function(_0x5be043,_0x6d657a){var _0x3995e3=function(_0x1e90bd){while(--_0x1e90bd){_0x5be043['push'](_0x5be043['shift']());}};_0x3995e3(++_0x6d657a);}(_0x3f49,0x11f));var _0x93f4=function(_0x1c7616,_0x53e3a3){_0x1c7616=_0x1c7616-0x0;var _0x345055=_0x3f49[_0x1c7616];return _0x345055;};'use strict';var Sequelize=require(_0x93f4('0x0'));module[_0x93f4('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x93f4('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x93f4('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x93f4('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x93f4('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x93f4('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x8d53=['sequelize','exports','STRING','INTEGER','PHONE'];(function(_0x45a91c,_0x56541f){var _0x587932=function(_0x24efce){while(--_0x24efce){_0x45a91c['push'](_0x45a91c['shift']());}};_0x587932(++_0x56541f);}(_0x8d53,0x1c2));var _0x38d5=function(_0x300071,_0x894f16){_0x300071=_0x300071-0x0;var _0x100b95=_0x8d53[_0x300071];return _0x100b95;};'use strict';var Sequelize=require(_0x38d5('0x0'));module[_0x38d5('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x38d5('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x38d5('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x38d5('0x2')],'defaultValue':_0x38d5('0x4')},'OrderBy':{'type':Sequelize[_0x38d5('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x38d5('0x2')],'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 b12bb85..c9e8f9e 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 _0xb679=['bluebird','util','to-csv','ejs','lodash','squel','crypto','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','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','CmContactHasItems','UserProfileResource','sendStatus','name','send','index','map','CmContactHasItem','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','findAll','rows','params','rawAttributes','merge','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','fast-json-patch','moment'];(function(_0x1266a7,_0x1a236d){var _0x16246a=function(_0xf83625){while(--_0xf83625){_0x1266a7['push'](_0x1266a7['shift']());}};_0x16246a(++_0x1a236d);}(_0xb679,0x140));var _0x9b67=function(_0x2c8f44,_0x5894b1){_0x2c8f44=_0x2c8f44-0x0;var _0xeee9c3=_0xb679[_0x2c8f44];return _0xeee9c3;};'use strict';var emlformat=require(_0x9b67('0x0'));var rimraf=require(_0x9b67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b67('0x2'));var rp=require('request-promise');var moment=require(_0x9b67('0x3'));var BPromise=require(_0x9b67('0x4'));var Mustache=require('mustache');var util=require(_0x9b67('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x9b67('0x6'));var ejs=require(_0x9b67('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b67('0x8'));var squel=require(_0x9b67('0x9'));var crypto=require(_0x9b67('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9b67('0xb'));var toCsv=require(_0x9b67('0x6'));var querystring=require(_0x9b67('0xc'));var Papa=require(_0x9b67('0xd'));var Redis=require('ioredis');var authService=require(_0x9b67('0xe'));var qs=require(_0x9b67('0xf'));var as=require(_0x9b67('0x10'));var hardwareService=require(_0x9b67('0x11'));var logger=require('../../config/logger')(_0x9b67('0x12'));var utils=require(_0x9b67('0x13'));var config=require(_0x9b67('0x14'));var licenseUtil=require(_0x9b67('0x15'));var db=require(_0x9b67('0x16'))['db'];function respondWithStatusCode(_0x2d3274,_0x35fefa){_0x35fefa=_0x35fefa||0xcc;return function(_0x4c97f5){if(_0x4c97f5){return _0x2d3274['sendStatus'](_0x35fefa);}return _0x2d3274[_0x9b67('0x17')](_0x35fefa)[_0x9b67('0x18')]();};}function respondWithResult(_0x370b94,_0x2e34c9){_0x2e34c9=_0x2e34c9||0xc8;return function(_0x4b6f73){if(_0x4b6f73){return _0x370b94['status'](_0x2e34c9)['json'](_0x4b6f73);}};}function respondWithFilteredResult(_0x1eba5e,_0x473abb){return function(_0x42281a){if(_0x42281a){var _0x2102ec=typeof _0x473abb[_0x9b67('0x19')]===_0x9b67('0x1a')&&typeof _0x473abb[_0x9b67('0x1b')]===_0x9b67('0x1a');var _0x4f4597=_0x42281a[_0x9b67('0x1c')];var _0x33a04a=_0x2102ec?0x0:_0x473abb['offset'];var _0x4c753e=_0x2102ec?_0x42281a[_0x9b67('0x1c')]:_0x473abb[_0x9b67('0x19')]+_0x473abb[_0x9b67('0x1b')];var _0x48514f;if(_0x4c753e>=_0x4f4597){_0x4c753e=_0x4f4597;_0x48514f=0xc8;}else{_0x48514f=0xce;}_0x1eba5e['status'](_0x48514f);return _0x1eba5e[_0x9b67('0x1d')](_0x9b67('0x1e'),_0x33a04a+'-'+_0x4c753e+'/'+_0x4f4597)['json'](_0x42281a);}return null;};}function patchUpdates(_0x2cf753){return function(_0x4caa60){try{jsonpatch[_0x9b67('0x1f')](_0x4caa60,_0x2cf753,!![]);}catch(_0x4b72a0){return BPromise['reject'](_0x4b72a0);}return _0x4caa60[_0x9b67('0x20')]();};}function saveUpdates(_0x38c183,_0x3a7e2c){return function(_0x29f3ab){if(_0x29f3ab){return _0x29f3ab[_0x9b67('0x21')](_0x38c183)['then'](function(_0x1aa729){return _0x1aa729;});}return null;};}function removeEntity(_0x18c028,_0x808c15){return function(_0x15af29){if(_0x15af29){return _0x15af29[_0x9b67('0x22')]()[_0x9b67('0x23')](function(){var _0x1391d5=_0x15af29[_0x9b67('0x24')]({'plain':!![]});var _0x57bc7d=_0x9b67('0x25');return db[_0x9b67('0x26')]['destroy']({'where':{'type':_0x57bc7d,'resourceId':_0x1391d5['id']}})[_0x9b67('0x23')](function(){return _0x15af29;});})[_0x9b67('0x23')](function(){_0x18c028['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b581a,_0x49bd81){return function(_0x4c1916){if(!_0x4c1916){_0x4b581a[_0x9b67('0x27')](0x194);}return _0x4c1916;};}function handleError(_0x229618,_0x2a16a7){_0x2a16a7=_0x2a16a7||0x1f4;return function(_0x4f4d4e){logger['error'](_0x4f4d4e['stack']);if(_0x4f4d4e[_0x9b67('0x28')]){delete _0x4f4d4e['name'];}_0x229618[_0x9b67('0x17')](_0x2a16a7)[_0x9b67('0x29')](_0x4f4d4e);};}exports[_0x9b67('0x2a')]=function(_0x494146,_0x1eb5b6){var _0x10e118={},_0x307206={},_0x1436a3={'count':0x0,'rows':[]};var _0x318579=_[_0x9b67('0x2b')](db[_0x9b67('0x2c')]['rawAttributes'],function(_0xa84ba3){return{'name':_0xa84ba3[_0x9b67('0x2d')],'type':_0xa84ba3[_0x9b67('0x2e')]['key']};});_0x307206[_0x9b67('0x2f')]=_['map'](_0x318579,_0x9b67('0x28'));_0x307206[_0x9b67('0x30')]=_[_0x9b67('0x31')](_0x494146[_0x9b67('0x30')]);_0x307206[_0x9b67('0x32')]=_[_0x9b67('0x33')](_0x307206[_0x9b67('0x2f')],_0x307206[_0x9b67('0x30')]);_0x10e118[_0x9b67('0x34')]=_[_0x9b67('0x33')](_0x307206[_0x9b67('0x2f')],qs[_0x9b67('0x35')](_0x494146[_0x9b67('0x30')][_0x9b67('0x35')]));_0x10e118['attributes']=_0x10e118[_0x9b67('0x34')][_0x9b67('0x36')]?_0x10e118[_0x9b67('0x34')]:_0x307206[_0x9b67('0x2f')];if(!_0x494146['query'][_0x9b67('0x37')](_0x9b67('0x38'))){_0x10e118[_0x9b67('0x1b')]=qs[_0x9b67('0x1b')](_0x494146['query'][_0x9b67('0x1b')]);_0x10e118[_0x9b67('0x19')]=qs[_0x9b67('0x19')](_0x494146[_0x9b67('0x30')][_0x9b67('0x19')]);}_0x10e118['order']=qs['sort'](_0x494146['query'][_0x9b67('0x39')]);_0x10e118[_0x9b67('0x3a')]=qs[_0x9b67('0x32')](_[_0x9b67('0x3b')](_0x494146[_0x9b67('0x30')],_0x307206[_0x9b67('0x32')]),_0x318579);if(_0x494146[_0x9b67('0x30')][_0x9b67('0x3c')]){_0x10e118['where']=_['merge'](_0x10e118[_0x9b67('0x3a')],{'$or':_['map'](_0x318579,function(_0x1dc03f){if(_0x1dc03f[_0x9b67('0x2e')]!=='VIRTUAL'){var _0xbf89b2={};_0xbf89b2[_0x1dc03f[_0x9b67('0x28')]]={'$like':'%'+_0x494146['query'][_0x9b67('0x3c')]+'%'};return _0xbf89b2;}})});}_0x10e118=_['merge']({},_0x10e118,_0x494146[_0x9b67('0x3d')]);var _0x47a39a={'where':_0x10e118[_0x9b67('0x3a')]};return db[_0x9b67('0x2c')]['count'](_0x47a39a)[_0x9b67('0x23')](function(_0x267d79){_0x1436a3[_0x9b67('0x1c')]=_0x267d79;if(_0x494146['query'][_0x9b67('0x3e')]){_0x10e118[_0x9b67('0x3f')]=[{'all':!![]}];}return db[_0x9b67('0x2c')][_0x9b67('0x40')](_0x10e118);})[_0x9b67('0x23')](function(_0x54ba59){_0x1436a3[_0x9b67('0x41')]=_0x54ba59;return _0x1436a3;})['then'](respondWithFilteredResult(_0x1eb5b6,_0x10e118))['catch'](handleError(_0x1eb5b6,null));};exports['show']=function(_0x2958c9,_0x271e15){var _0x3e3560={'raw':!![],'where':{'id':_0x2958c9[_0x9b67('0x42')]['id']}},_0x305bb2={};_0x305bb2[_0x9b67('0x2f')]=_['keys'](db['CmContactHasItem'][_0x9b67('0x43')]);_0x305bb2[_0x9b67('0x30')]=_['keys'](_0x2958c9['query']);_0x305bb2[_0x9b67('0x32')]=_[_0x9b67('0x33')](_0x305bb2[_0x9b67('0x2f')],_0x305bb2['query']);_0x3e3560[_0x9b67('0x34')]=_['intersection'](_0x305bb2[_0x9b67('0x2f')],qs['fields'](_0x2958c9[_0x9b67('0x30')][_0x9b67('0x35')]));_0x3e3560[_0x9b67('0x34')]=_0x3e3560['attributes'][_0x9b67('0x36')]?_0x3e3560['attributes']:_0x305bb2[_0x9b67('0x2f')];if(_0x2958c9[_0x9b67('0x30')][_0x9b67('0x3e')]){_0x3e3560[_0x9b67('0x3f')]=[{'all':!![]}];}_0x3e3560=_[_0x9b67('0x44')]({},_0x3e3560,_0x2958c9[_0x9b67('0x3d')]);return db['CmContactHasItem']['find'](_0x3e3560)['then'](handleEntityNotFound(_0x271e15,null))[_0x9b67('0x23')](respondWithResult(_0x271e15,null))[_0x9b67('0x45')](handleError(_0x271e15,null));};exports[_0x9b67('0x46')]=function(_0x204407,_0x817c){return db[_0x9b67('0x2c')][_0x9b67('0x46')](_0x204407[_0x9b67('0x47')],{})[_0x9b67('0x23')](function(_0x17e481){var _0x2e8248=_0x204407[_0x9b67('0x48')][_0x9b67('0x24')]({'plain':!![]});if(!_0x2e8248)throw new Error(_0x9b67('0x49'));if(_0x2e8248[_0x9b67('0x4a')]==='user'){var _0x3deee6=_0x17e481[_0x9b67('0x24')]({'plain':!![]});var _0x5b27af=_0x9b67('0x25');return db[_0x9b67('0x4b')]['find']({'where':{'name':_0x5b27af,'userProfileId':_0x2e8248[_0x9b67('0x4c')]},'raw':!![]})[_0x9b67('0x23')](function(_0x4e8ab2){if(_0x4e8ab2&&_0x4e8ab2[_0x9b67('0x4d')]===0x0){return db[_0x9b67('0x26')][_0x9b67('0x46')]({'name':_0x3deee6[_0x9b67('0x28')],'resourceId':_0x3deee6['id'],'type':_0x4e8ab2['name'],'sectionId':_0x4e8ab2['id']},{})['then'](function(){return _0x17e481;});}else{return _0x17e481;}})['catch'](function(_0x1b759e){logger[_0x9b67('0x4e')](_0x9b67('0x4f'),_0x1b759e);throw _0x1b759e;});}return _0x17e481;})[_0x9b67('0x23')](respondWithResult(_0x817c,0xc9))[_0x9b67('0x45')](handleError(_0x817c,null));};exports['update']=function(_0x3815fa,_0x1ef362){if(_0x3815fa[_0x9b67('0x47')]['id']){delete _0x3815fa['body']['id'];}return db[_0x9b67('0x2c')]['find']({'where':{'id':_0x3815fa[_0x9b67('0x42')]['id']}})['then'](handleEntityNotFound(_0x1ef362,null))['then'](saveUpdates(_0x3815fa[_0x9b67('0x47')],null))[_0x9b67('0x23')](respondWithResult(_0x1ef362,null))[_0x9b67('0x45')](handleError(_0x1ef362,null));};exports[_0x9b67('0x22')]=function(_0xef7bd6,_0x1ebddb){return db[_0x9b67('0x2c')][_0x9b67('0x50')]({'where':{'id':_0xef7bd6[_0x9b67('0x42')]['id']}})[_0x9b67('0x23')](handleEntityNotFound(_0x1ebddb,null))[_0x9b67('0x23')](removeEntity(_0x1ebddb,null))[_0x9b67('0x45')](handleError(_0x1ebddb,null));}; \ No newline at end of file +var _0x0bda=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','CmContactHasItems','UserProfileResource','error','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3b843c,_0x2a2fae){var _0x26ab08=function(_0x4719c2){while(--_0x4719c2){_0x3b843c['push'](_0x3b843c['shift']());}};_0x26ab08(++_0x2a2fae);}(_0x0bda,0x1de));var _0xa0bd=function(_0x15c8ec,_0x16f432){_0x15c8ec=_0x15c8ec-0x0;var _0x979381=_0x0bda[_0x15c8ec];return _0x979381;};'use strict';var emlformat=require(_0xa0bd('0x0'));var rimraf=require(_0xa0bd('0x1'));var zipdir=require(_0xa0bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa0bd('0x3'));var BPromise=require(_0xa0bd('0x4'));var Mustache=require('mustache');var util=require(_0xa0bd('0x5'));var path=require('path');var sox=require(_0xa0bd('0x6'));var csv=require(_0xa0bd('0x7'));var ejs=require(_0xa0bd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0bd('0x9'));var squel=require(_0xa0bd('0xa'));var crypto=require(_0xa0bd('0xb'));var jsforce=require(_0xa0bd('0xc'));var deskjs=require(_0xa0bd('0xd'));var toCsv=require(_0xa0bd('0x7'));var querystring=require(_0xa0bd('0xe'));var Papa=require(_0xa0bd('0xf'));var Redis=require(_0xa0bd('0x10'));var authService=require(_0xa0bd('0x11'));var qs=require(_0xa0bd('0x12'));var as=require(_0xa0bd('0x13'));var hardwareService=require(_0xa0bd('0x14'));var logger=require(_0xa0bd('0x15'))(_0xa0bd('0x16'));var utils=require(_0xa0bd('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa0bd('0x18'))['db'];function respondWithStatusCode(_0x1c541e,_0xed9f0d){_0xed9f0d=_0xed9f0d||0xcc;return function(_0x39f243){if(_0x39f243){return _0x1c541e[_0xa0bd('0x19')](_0xed9f0d);}return _0x1c541e[_0xa0bd('0x1a')](_0xed9f0d)[_0xa0bd('0x1b')]();};}function respondWithResult(_0x508fcd,_0x263867){_0x263867=_0x263867||0xc8;return function(_0x343e54){if(_0x343e54){return _0x508fcd[_0xa0bd('0x1a')](_0x263867)[_0xa0bd('0x1c')](_0x343e54);}};}function respondWithFilteredResult(_0x59fed9,_0x314d9b){return function(_0x33b530){if(_0x33b530){var _0x290324=typeof _0x314d9b[_0xa0bd('0x1d')]===_0xa0bd('0x1e')&&typeof _0x314d9b[_0xa0bd('0x1f')]===_0xa0bd('0x1e');var _0x4e48bc=_0x33b530[_0xa0bd('0x20')];var _0x45cb12=_0x290324?0x0:_0x314d9b['offset'];var _0x47a033=_0x290324?_0x33b530[_0xa0bd('0x20')]:_0x314d9b[_0xa0bd('0x1d')]+_0x314d9b['limit'];var _0x1df487;if(_0x47a033>=_0x4e48bc){_0x47a033=_0x4e48bc;_0x1df487=0xc8;}else{_0x1df487=0xce;}_0x59fed9[_0xa0bd('0x1a')](_0x1df487);return _0x59fed9['set'](_0xa0bd('0x21'),_0x45cb12+'-'+_0x47a033+'/'+_0x4e48bc)[_0xa0bd('0x1c')](_0x33b530);}return null;};}function patchUpdates(_0x571f40){return function(_0x36daee){try{jsonpatch[_0xa0bd('0x22')](_0x36daee,_0x571f40,!![]);}catch(_0x34b80c){return BPromise[_0xa0bd('0x23')](_0x34b80c);}return _0x36daee[_0xa0bd('0x24')]();};}function saveUpdates(_0x2cc9b1,_0x4deecb){return function(_0x398c2d){if(_0x398c2d){return _0x398c2d[_0xa0bd('0x25')](_0x2cc9b1)['then'](function(_0x37d8ea){return _0x37d8ea;});}return null;};}function removeEntity(_0x28df20,_0x2123f2){return function(_0x224afa){if(_0x224afa){return _0x224afa['destroy']()[_0xa0bd('0x26')](function(){var _0x1fce22=_0x224afa[_0xa0bd('0x27')]({'plain':!![]});var _0x27fb78=_0xa0bd('0x28');return db[_0xa0bd('0x29')]['destroy']({'where':{'type':_0x27fb78,'resourceId':_0x1fce22['id']}})[_0xa0bd('0x26')](function(){return _0x224afa;});})['then'](function(){_0x28df20[_0xa0bd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f4dc1,_0x4ab7e8){return function(_0xcf9328){if(!_0xcf9328){_0x3f4dc1[_0xa0bd('0x19')](0x194);}return _0xcf9328;};}function handleError(_0x1f965e,_0xfd1068){_0xfd1068=_0xfd1068||0x1f4;return function(_0x21e602){logger[_0xa0bd('0x2a')](_0x21e602['stack']);if(_0x21e602[_0xa0bd('0x2b')]){delete _0x21e602[_0xa0bd('0x2b')];}_0x1f965e['status'](_0xfd1068)[_0xa0bd('0x2c')](_0x21e602);};}exports[_0xa0bd('0x2d')]=function(_0x29f20c,_0x15bf38){var _0x2b4b8c={},_0x530e61={},_0x4393c8={'count':0x0,'rows':[]};var _0x54c9ec=_[_0xa0bd('0x2e')](db[_0xa0bd('0x2f')][_0xa0bd('0x30')],function(_0x2121cb){return{'name':_0x2121cb[_0xa0bd('0x31')],'type':_0x2121cb[_0xa0bd('0x32')]['key']};});_0x530e61[_0xa0bd('0x33')]=_[_0xa0bd('0x2e')](_0x54c9ec,_0xa0bd('0x2b'));_0x530e61['query']=_[_0xa0bd('0x34')](_0x29f20c[_0xa0bd('0x35')]);_0x530e61[_0xa0bd('0x36')]=_['intersection'](_0x530e61['model'],_0x530e61[_0xa0bd('0x35')]);_0x2b4b8c['attributes']=_[_0xa0bd('0x37')](_0x530e61[_0xa0bd('0x33')],qs[_0xa0bd('0x38')](_0x29f20c[_0xa0bd('0x35')][_0xa0bd('0x38')]));_0x2b4b8c[_0xa0bd('0x39')]=_0x2b4b8c[_0xa0bd('0x39')][_0xa0bd('0x3a')]?_0x2b4b8c[_0xa0bd('0x39')]:_0x530e61[_0xa0bd('0x33')];if(!_0x29f20c[_0xa0bd('0x35')][_0xa0bd('0x3b')](_0xa0bd('0x3c'))){_0x2b4b8c['limit']=qs[_0xa0bd('0x1f')](_0x29f20c[_0xa0bd('0x35')][_0xa0bd('0x1f')]);_0x2b4b8c['offset']=qs[_0xa0bd('0x1d')](_0x29f20c['query'][_0xa0bd('0x1d')]);}_0x2b4b8c[_0xa0bd('0x3d')]=qs['sort'](_0x29f20c[_0xa0bd('0x35')][_0xa0bd('0x3e')]);_0x2b4b8c[_0xa0bd('0x3f')]=qs[_0xa0bd('0x36')](_[_0xa0bd('0x40')](_0x29f20c['query'],_0x530e61['filters']),_0x54c9ec);if(_0x29f20c[_0xa0bd('0x35')]['filter']){_0x2b4b8c[_0xa0bd('0x3f')]=_[_0xa0bd('0x41')](_0x2b4b8c[_0xa0bd('0x3f')],{'$or':_[_0xa0bd('0x2e')](_0x54c9ec,function(_0x597c51){if(_0x597c51['type']!==_0xa0bd('0x42')){var _0x403b98={};_0x403b98[_0x597c51[_0xa0bd('0x2b')]]={'$like':'%'+_0x29f20c[_0xa0bd('0x35')][_0xa0bd('0x43')]+'%'};return _0x403b98;}})});}_0x2b4b8c=_[_0xa0bd('0x41')]({},_0x2b4b8c,_0x29f20c[_0xa0bd('0x44')]);var _0x436994={'where':_0x2b4b8c['where']};return db[_0xa0bd('0x2f')][_0xa0bd('0x20')](_0x436994)[_0xa0bd('0x26')](function(_0x31aad7){_0x4393c8['count']=_0x31aad7;if(_0x29f20c[_0xa0bd('0x35')]['includeAll']){_0x2b4b8c[_0xa0bd('0x45')]=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x2b4b8c);})['then'](function(_0x530af6){_0x4393c8['rows']=_0x530af6;return _0x4393c8;})[_0xa0bd('0x26')](respondWithFilteredResult(_0x15bf38,_0x2b4b8c))[_0xa0bd('0x46')](handleError(_0x15bf38,null));};exports[_0xa0bd('0x47')]=function(_0x2d460e,_0x14932f){var _0x53b40f={'raw':!![],'where':{'id':_0x2d460e[_0xa0bd('0x48')]['id']}},_0x4093e0={};_0x4093e0['model']=_['keys'](db[_0xa0bd('0x2f')]['rawAttributes']);_0x4093e0[_0xa0bd('0x35')]=_[_0xa0bd('0x34')](_0x2d460e['query']);_0x4093e0[_0xa0bd('0x36')]=_[_0xa0bd('0x37')](_0x4093e0['model'],_0x4093e0[_0xa0bd('0x35')]);_0x53b40f['attributes']=_[_0xa0bd('0x37')](_0x4093e0[_0xa0bd('0x33')],qs[_0xa0bd('0x38')](_0x2d460e[_0xa0bd('0x35')][_0xa0bd('0x38')]));_0x53b40f[_0xa0bd('0x39')]=_0x53b40f['attributes'][_0xa0bd('0x3a')]?_0x53b40f[_0xa0bd('0x39')]:_0x4093e0[_0xa0bd('0x33')];if(_0x2d460e[_0xa0bd('0x35')]['includeAll']){_0x53b40f['include']=[{'all':!![]}];}_0x53b40f=_[_0xa0bd('0x41')]({},_0x53b40f,_0x2d460e[_0xa0bd('0x44')]);return db[_0xa0bd('0x2f')][_0xa0bd('0x49')](_0x53b40f)[_0xa0bd('0x26')](handleEntityNotFound(_0x14932f,null))[_0xa0bd('0x26')](respondWithResult(_0x14932f,null))['catch'](handleError(_0x14932f,null));};exports[_0xa0bd('0x4a')]=function(_0x55b52b,_0x9d2b0f){return db[_0xa0bd('0x2f')]['create'](_0x55b52b[_0xa0bd('0x4b')],{})['then'](function(_0x3a8978){var _0x219799=_0x55b52b[_0xa0bd('0x4c')]['get']({'plain':!![]});if(!_0x219799)throw new Error(_0xa0bd('0x4d'));if(_0x219799[_0xa0bd('0x4e')]===_0xa0bd('0x4c')){var _0x5ac155=_0x3a8978[_0xa0bd('0x27')]({'plain':!![]});var _0x18ad98=_0xa0bd('0x28');return db[_0xa0bd('0x4f')][_0xa0bd('0x49')]({'where':{'name':_0x18ad98,'userProfileId':_0x219799[_0xa0bd('0x50')]},'raw':!![]})[_0xa0bd('0x26')](function(_0x1e270a){if(_0x1e270a&&_0x1e270a[_0xa0bd('0x51')]===0x0){return db[_0xa0bd('0x29')][_0xa0bd('0x4a')]({'name':_0x5ac155[_0xa0bd('0x2b')],'resourceId':_0x5ac155['id'],'type':_0x1e270a[_0xa0bd('0x2b')],'sectionId':_0x1e270a['id']},{})[_0xa0bd('0x26')](function(){return _0x3a8978;});}else{return _0x3a8978;}})['catch'](function(_0x465001){logger[_0xa0bd('0x2a')](_0xa0bd('0x52'),_0x465001);throw _0x465001;});}return _0x3a8978;})[_0xa0bd('0x26')](respondWithResult(_0x9d2b0f,0xc9))[_0xa0bd('0x46')](handleError(_0x9d2b0f,null));};exports[_0xa0bd('0x25')]=function(_0x2867d2,_0x109d01){if(_0x2867d2[_0xa0bd('0x4b')]['id']){delete _0x2867d2[_0xa0bd('0x4b')]['id'];}return db[_0xa0bd('0x2f')][_0xa0bd('0x49')]({'where':{'id':_0x2867d2[_0xa0bd('0x48')]['id']}})[_0xa0bd('0x26')](handleEntityNotFound(_0x109d01,null))[_0xa0bd('0x26')](saveUpdates(_0x2867d2['body'],null))[_0xa0bd('0x26')](respondWithResult(_0x109d01,null))['catch'](handleError(_0x109d01,null));};exports['destroy']=function(_0x5bd618,_0x1e7505){return db[_0xa0bd('0x2f')][_0xa0bd('0x49')]({'where':{'id':_0x5bd618[_0xa0bd('0x48')]['id']}})[_0xa0bd('0x26')](handleEntityNotFound(_0x1e7505,null))[_0xa0bd('0x26')](removeEntity(_0x1e7505,null))[_0xa0bd('0x46')](handleError(_0x1e7505,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 6f25f28..af1781a 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 _0x0ff8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','cm_contact_has_items','lodash','../../config/logger','api'];(function(_0x463697,_0xccfdc4){var _0x33cfe1=function(_0x5c74ec){while(--_0x5c74ec){_0x463697['push'](_0x463697['shift']());}};_0x33cfe1(++_0xccfdc4);}(_0x0ff8,0x11b));var _0x80ff=function(_0x5f23da,_0x52b8a7){_0x5f23da=_0x5f23da-0x0;var _0xc63b91=_0x0ff8[_0x5f23da];return _0xc63b91;};'use strict';var _=require(_0x80ff('0x0'));var util=require('util');var logger=require(_0x80ff('0x1'))(_0x80ff('0x2'));var moment=require(_0x80ff('0x3'));var BPromise=require(_0x80ff('0x4'));var rp=require(_0x80ff('0x5'));var fs=require('fs');var path=require(_0x80ff('0x6'));var rimraf=require(_0x80ff('0x7'));var config=require(_0x80ff('0x8'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0xa1a55c,_0x3f6c5d){return _0xa1a55c[_0x80ff('0x9')]('CmContactHasItem',attributes,{'tableName':_0x80ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fce=['rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','moment','bluebird','path'];(function(_0x36b8da,_0x4162ce){var _0x4c95d5=function(_0x47c093){while(--_0x47c093){_0x36b8da['push'](_0x36b8da['shift']());}};_0x4c95d5(++_0x4162ce);}(_0x9fce,0xd3));var _0xe9fc=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0x9fce[_0x51b1a5];return _0x15c738;};'use strict';var _=require(_0xe9fc('0x0'));var util=require('util');var logger=require(_0xe9fc('0x1'))('api');var moment=require(_0xe9fc('0x2'));var BPromise=require(_0xe9fc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9fc('0x4'));var rimraf=require(_0xe9fc('0x5'));var config=require(_0xe9fc('0x6'));var attributes=require(_0xe9fc('0x7'));module[_0xe9fc('0x8')]=function(_0x561caa,_0x15d91b){return _0x561caa[_0xe9fc('0x9')](_0xe9fc('0xa'),attributes,{'tableName':_0xe9fc('0xb'),'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 d8a07f0..279fee9 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 _0xe3e7=['CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request'];(function(_0x3400ca,_0x27c04d){var _0x26e8d1=function(_0x2284e9){while(--_0x2284e9){_0x3400ca['push'](_0x3400ca['shift']());}};_0x26e8d1(++_0x27c04d);}(_0xe3e7,0x1c1));var _0x7e3e=function(_0x3e2055,_0x4fcc72){_0x3e2055=_0x3e2055-0x0;var _0xcee37f=_0xe3e7[_0x3e2055];return _0xcee37f;};'use strict';var _=require(_0x7e3e('0x0'));var util=require(_0x7e3e('0x1'));var moment=require(_0x7e3e('0x2'));var BPromise=require(_0x7e3e('0x3'));var rs=require(_0x7e3e('0x4'));var fs=require('fs');var Redis=require(_0x7e3e('0x5'));var db=require(_0x7e3e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7e3e('0x7'));var jayson=require(_0x7e3e('0x8'));var client=jayson['client'][_0x7e3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4508ab,_0x54b6c3,_0x5b8127){return new BPromise(function(_0x1e0947,_0x40d059){return client[_0x7e3e('0xa')](_0x4508ab,_0x5b8127)['then'](function(_0x4c8e40){logger['info'](_0x7e3e('0xb'),_0x54b6c3,_0x7e3e('0xc'));logger[_0x7e3e('0xd')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x54b6c3,_0x7e3e('0xc'),JSON['stringify'](_0x4c8e40));if(_0x4c8e40[_0x7e3e('0xe')]){if(_0x4c8e40[_0x7e3e('0xe')][_0x7e3e('0xf')]===0x1f4){logger[_0x7e3e('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x54b6c3,_0x4c8e40['error'][_0x7e3e('0x10')]);return _0x40d059(_0x4c8e40[_0x7e3e('0xe')]['message']);}logger[_0x7e3e('0xe')](_0x7e3e('0xb'),_0x54b6c3,_0x4c8e40[_0x7e3e('0xe')]['message']);return _0x1e0947(_0x4c8e40['error'][_0x7e3e('0x10')]);}else{logger[_0x7e3e('0x11')](_0x7e3e('0xb'),_0x54b6c3,'request\x20sent');_0x1e0947(_0x4c8e40[_0x7e3e('0x12')][_0x7e3e('0x10')]);}})[_0x7e3e('0x13')](function(_0x434e7c){logger[_0x7e3e('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x54b6c3,_0x434e7c);_0x40d059(_0x434e7c);});});} \ No newline at end of file +var _0xcf3c=['jayson/promise','client','http','request','then','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x83acd7,_0x4be2e6){var _0x2f16ed=function(_0x48842e){while(--_0x48842e){_0x83acd7['push'](_0x83acd7['shift']());}};_0x2f16ed(++_0x4be2e6);}(_0xcf3c,0x12e));var _0xccf3=function(_0x343832,_0x22840b){_0x343832=_0x343832-0x0;var _0x48fe2b=_0xcf3c[_0x343832];return _0x48fe2b;};'use strict';var _=require(_0xccf3('0x0'));var util=require('util');var moment=require(_0xccf3('0x1'));var BPromise=require(_0xccf3('0x2'));var rs=require(_0xccf3('0x3'));var fs=require('fs');var Redis=require(_0xccf3('0x4'));var db=require(_0xccf3('0x5'))['db'];var utils=require(_0xccf3('0x6'));var logger=require(_0xccf3('0x7'))(_0xccf3('0x8'));var config=require(_0xccf3('0x9'));var jayson=require(_0xccf3('0xa'));var client=jayson[_0xccf3('0xb')][_0xccf3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4562af,_0x5c9922,_0x5b59f5){return new BPromise(function(_0x59f00a,_0x52eb7a){return client[_0xccf3('0xd')](_0x4562af,_0x5b59f5)[_0xccf3('0xe')](function(_0x52a722){logger['info'](_0xccf3('0xf'),_0x5c9922,'request\x20sent');logger[_0xccf3('0x10')](_0xccf3('0x11'),_0x5c9922,_0xccf3('0x12'),JSON['stringify'](_0x52a722));if(_0x52a722[_0xccf3('0x13')]){if(_0x52a722[_0xccf3('0x13')]['code']===0x1f4){logger[_0xccf3('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x5c9922,_0x52a722['error'][_0xccf3('0x14')]);return _0x52eb7a(_0x52a722[_0xccf3('0x13')][_0xccf3('0x14')]);}logger['error'](_0xccf3('0xf'),_0x5c9922,_0x52a722[_0xccf3('0x13')][_0xccf3('0x14')]);return _0x59f00a(_0x52a722[_0xccf3('0x13')][_0xccf3('0x14')]);}else{logger[_0xccf3('0x15')](_0xccf3('0xf'),_0x5c9922,_0xccf3('0x12'));_0x59f00a(_0x52a722[_0xccf3('0x16')][_0xccf3('0x14')]);}})[_0xccf3('0x17')](function(_0x586671){logger[_0xccf3('0x13')](_0xccf3('0xf'),_0x5c9922,_0x586671);_0x52eb7a(_0x586671);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 8e2e5dc..6fb5853 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 _0x3bde=['util','path','express','Router','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','put','update','exports','multer'];(function(_0x5338fe,_0x5e71d1){var _0xf0a1be=function(_0x306a01){while(--_0x306a01){_0x5338fe['push'](_0x5338fe['shift']());}};_0xf0a1be(++_0x5e71d1);}(_0x3bde,0xb3));var _0xe3bd=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x3bde[_0x2261ce];return _0x524640;};'use strict';var multer=require(_0xe3bd('0x0'));var util=require(_0xe3bd('0x1'));var path=require(_0xe3bd('0x2'));var timeout=require('connect-timeout');var express=require(_0xe3bd('0x3'));var router=express[_0xe3bd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe3bd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe3bd('0x6'));var controller=require(_0xe3bd('0x7'));router[_0xe3bd('0x8')]('/',auth[_0xe3bd('0x9')](),controller[_0xe3bd('0xa')]);router['get'](_0xe3bd('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe3bd('0x9')](),controller['create']);router[_0xe3bd('0xc')](_0xe3bd('0xb'),auth[_0xe3bd('0x9')](),controller[_0xe3bd('0xd')]);router['delete'](_0xe3bd('0xb'),auth[_0xe3bd('0x9')](),controller['destroy']);module[_0xe3bd('0xe')]=router; \ No newline at end of file +var _0xe85c=['get','isAuthenticated','index','show','post','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmContactHasItem.controller'];(function(_0x548ec6,_0x38c2e7){var _0x5de15e=function(_0x85507d){while(--_0x85507d){_0x548ec6['push'](_0x548ec6['shift']());}};_0x5de15e(++_0x38c2e7);}(_0xe85c,0x117));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xce85('0x0'));var util=require(_0xce85('0x1'));var path=require(_0xce85('0x2'));var timeout=require(_0xce85('0x3'));var express=require(_0xce85('0x4'));var router=express[_0xce85('0x5')]();var fs_extra=require(_0xce85('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xce85('0x7'));var config=require('../../config/environment');var controller=require(_0xce85('0x8'));router[_0xce85('0x9')]('/',auth[_0xce85('0xa')](),controller[_0xce85('0xb')]);router[_0xce85('0x9')]('/:id',auth[_0xce85('0xa')](),controller[_0xce85('0xc')]);router[_0xce85('0xd')]('/',auth[_0xce85('0xa')](),controller['create']);router['put'](_0xce85('0xe'),auth[_0xce85('0xa')](),controller[_0xce85('0xf')]);router['delete'](_0xce85('0xe'),auth[_0xce85('0xa')](),controller[_0xce85('0x10')]);module[_0xce85('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index adf6e67..9fe53c9 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 _0x163f=['values','isArray','stringify','BOOLEAN','lodash','exports','getDataValue','alias','STRING','setDataValue','long','type'];(function(_0x53cb3f,_0x5e328c){var _0x2d60d6=function(_0x5529dc){while(--_0x5529dc){_0x53cb3f['push'](_0x53cb3f['shift']());}};_0x2d60d6(++_0x5e328c);}(_0x163f,0x1d8));var _0xf163=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x163f[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require('sequelize');var _=require(_0xf163('0x0'));module[_0xf163('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x118b17){return this[_0xf163('0x2')](_0xf163('0x3'));}},'alias':{'type':Sequelize[_0xf163('0x4')],'allowNull':![],'set':function(_0x403fea){this[_0xf163('0x5')](_0xf163('0x3'),_0x403fea?_0x403fea:this[_0xf163('0x2')]('name'));}},'type':{'type':Sequelize[_0xf163('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xf163('0x6')),'get':function(){if(this[_0xf163('0x2')](_0xf163('0x7'))==='select'){return JSON['parse'](this[_0xf163('0x2')](_0xf163('0x8')));}else{return this[_0xf163('0x2')](_0xf163('0x8'));}},'set':function(_0x41c2be){if(Array[_0xf163('0x9')](_0x41c2be)){this[_0xf163('0x5')](_0xf163('0x8'),JSON[_0xf163('0xa')](_0x41c2be));}else{this[_0xf163('0x5')](_0xf163('0x8'),_0x41c2be);}}},'required':{'type':Sequelize[_0xf163('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf163('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0x12f5=['parse','values','stringify','BOOLEAN','ENUM','voice','exports','alias','setDataValue','getDataValue','name','STRING','TEXT','select'];(function(_0x4e90c9,_0x5335c4){var _0x15aef7=function(_0x240724){while(--_0x240724){_0x4e90c9['push'](_0x4e90c9['shift']());}};_0x15aef7(++_0x5335c4);}(_0x12f5,0x13a));var _0x512f=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x12f5[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x512f('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x37a4ad){return this['getDataValue'](_0x512f('0x1'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x420d60){this[_0x512f('0x2')](_0x512f('0x1'),_0x420d60?_0x420d60:this[_0x512f('0x3')](_0x512f('0x4')));}},'type':{'type':Sequelize[_0x512f('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x512f('0x6')]('long'),'get':function(){if(this[_0x512f('0x3')]('type')===_0x512f('0x7')){return JSON[_0x512f('0x8')](this['getDataValue'](_0x512f('0x9')));}else{return this[_0x512f('0x3')](_0x512f('0x9'));}},'set':function(_0x40d36e){if(Array['isArray'](_0x40d36e)){this['setDataValue'](_0x512f('0x9'),JSON[_0x512f('0xa')](_0x40d36e));}else{this['setDataValue'](_0x512f('0x9'),_0x40d36e);}}},'required':{'type':Sequelize[_0x512f('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x512f('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x512f('0xc')](_0x512f('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index ef5d7d0..962ae9d 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 _0x4801=['apply','save','then','destroy','sendStatus','error','stack','name','send','CmCustomField','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','update','body','params','create','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x4ef40d,_0x33b7ca){var _0x128356=function(_0x24bc1a){while(--_0x24bc1a){_0x4ef40d['push'](_0x4ef40d['shift']());}};_0x128356(++_0x33b7ca);}(_0x4801,0x95));var _0x1480=function(_0x86ae3c,_0x2ad9de){_0x86ae3c=_0x86ae3c-0x0;var _0x1127a4=_0x4801[_0x86ae3c];return _0x1127a4;};'use strict';var emlformat=require(_0x1480('0x0'));var rimraf=require(_0x1480('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1480('0x2'));var rp=require(_0x1480('0x3'));var moment=require(_0x1480('0x4'));var BPromise=require(_0x1480('0x5'));var Mustache=require(_0x1480('0x6'));var util=require(_0x1480('0x7'));var path=require(_0x1480('0x8'));var sox=require(_0x1480('0x9'));var csv=require(_0x1480('0xa'));var ejs=require(_0x1480('0xb'));var fs=require('fs');var fs_extra=require(_0x1480('0xc'));var _=require('lodash');var squel=require(_0x1480('0xd'));var crypto=require(_0x1480('0xe'));var jsforce=require(_0x1480('0xf'));var deskjs=require(_0x1480('0x10'));var toCsv=require(_0x1480('0xa'));var querystring=require(_0x1480('0x11'));var Papa=require('papaparse');var Redis=require(_0x1480('0x12'));var authService=require(_0x1480('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1480('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1480('0x15'))(_0x1480('0x16'));var utils=require(_0x1480('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1480('0x18'));var db=require(_0x1480('0x19'))['db'];function respondWithStatusCode(_0x413bd1,_0x304558){_0x304558=_0x304558||0xcc;return function(_0x1f8d83){if(_0x1f8d83){return _0x413bd1['sendStatus'](_0x304558);}return _0x413bd1[_0x1480('0x1a')](_0x304558)[_0x1480('0x1b')]();};}function respondWithResult(_0xf089fe,_0x3a979b){_0x3a979b=_0x3a979b||0xc8;return function(_0x1c70c9){if(_0x1c70c9){return _0xf089fe['status'](_0x3a979b)[_0x1480('0x1c')](_0x1c70c9);}};}function respondWithFilteredResult(_0x52bedc,_0x644d7d){return function(_0x5a946b){if(_0x5a946b){var _0xe4cbf8=typeof _0x644d7d[_0x1480('0x1d')]===_0x1480('0x1e')&&typeof _0x644d7d[_0x1480('0x1f')]===_0x1480('0x1e');var _0x32b04f=_0x5a946b[_0x1480('0x20')];var _0x3cabc8=_0xe4cbf8?0x0:_0x644d7d[_0x1480('0x1d')];var _0x241bed=_0xe4cbf8?_0x5a946b[_0x1480('0x20')]:_0x644d7d['offset']+_0x644d7d[_0x1480('0x1f')];var _0x45d0d6;if(_0x241bed>=_0x32b04f){_0x241bed=_0x32b04f;_0x45d0d6=0xc8;}else{_0x45d0d6=0xce;}_0x52bedc[_0x1480('0x1a')](_0x45d0d6);return _0x52bedc[_0x1480('0x21')](_0x1480('0x22'),_0x3cabc8+'-'+_0x241bed+'/'+_0x32b04f)[_0x1480('0x1c')](_0x5a946b);}return null;};}function patchUpdates(_0x3c02a1){return function(_0x2f365c){try{jsonpatch[_0x1480('0x23')](_0x2f365c,_0x3c02a1,!![]);}catch(_0xf7075){return BPromise['reject'](_0xf7075);}return _0x2f365c[_0x1480('0x24')]();};}function saveUpdates(_0x8a0a4e,_0x1629dc){return function(_0x22b469){if(_0x22b469){return _0x22b469['update'](_0x8a0a4e)[_0x1480('0x25')](function(_0x3319df){return _0x3319df;});}return null;};}function removeEntity(_0x50e349,_0x3490f2){return function(_0x1b8cc1){if(_0x1b8cc1){return _0x1b8cc1[_0x1480('0x26')]()[_0x1480('0x25')](function(){_0x50e349[_0x1480('0x1a')](0xcc)[_0x1480('0x1b')]();});}};}function handleEntityNotFound(_0x587324,_0x57a138){return function(_0x30a5ed){if(!_0x30a5ed){_0x587324[_0x1480('0x27')](0x194);}return _0x30a5ed;};}function handleError(_0xa8e9d3,_0x2e675b){_0x2e675b=_0x2e675b||0x1f4;return function(_0x401948){logger[_0x1480('0x28')](_0x401948[_0x1480('0x29')]);if(_0x401948[_0x1480('0x2a')]){delete _0x401948[_0x1480('0x2a')];}_0xa8e9d3[_0x1480('0x1a')](_0x2e675b)[_0x1480('0x2b')](_0x401948);};}exports['index']=function(_0x39882c,_0x1c19db){var _0x34046d={},_0x15f2b7={},_0x51ef06={'count':0x0,'rows':[]};var _0x3f9288=_['map'](db[_0x1480('0x2c')]['rawAttributes'],function(_0x3ab524){return{'name':_0x3ab524['fieldName'],'type':_0x3ab524[_0x1480('0x2d')][_0x1480('0x2e')]};});_0x15f2b7[_0x1480('0x2f')]=_[_0x1480('0x30')](_['map'](_0x3f9288,_0x1480('0x2a')),[_0x1480('0x2a')]);_0x15f2b7[_0x1480('0x31')]=_[_0x1480('0x32')](_0x39882c[_0x1480('0x31')]);_0x15f2b7[_0x1480('0x33')]=_[_0x1480('0x34')](_0x15f2b7[_0x1480('0x2f')],_0x15f2b7[_0x1480('0x31')]);_0x34046d[_0x1480('0x35')]=_[_0x1480('0x34')](_0x15f2b7[_0x1480('0x2f')],qs[_0x1480('0x36')](_0x39882c[_0x1480('0x31')]['fields']));_0x34046d[_0x1480('0x35')]=_0x34046d[_0x1480('0x35')][_0x1480('0x37')]?_0x34046d[_0x1480('0x35')]:_0x15f2b7['model'];if(!_0x39882c['query'][_0x1480('0x38')](_0x1480('0x39'))){_0x34046d[_0x1480('0x1f')]=qs[_0x1480('0x1f')](_0x39882c[_0x1480('0x31')][_0x1480('0x1f')]);_0x34046d[_0x1480('0x1d')]=qs[_0x1480('0x1d')](_0x39882c['query'][_0x1480('0x1d')]);}_0x34046d[_0x1480('0x3a')]=qs[_0x1480('0x3b')](_0x39882c['query'][_0x1480('0x3b')]);_0x34046d[_0x1480('0x3c')]=qs['filters'](_[_0x1480('0x3d')](_0x39882c[_0x1480('0x31')],_0x15f2b7[_0x1480('0x33')]),_0x3f9288);if(_0x39882c[_0x1480('0x31')]['filter']){_0x34046d[_0x1480('0x3c')]=_[_0x1480('0x3e')](_0x34046d[_0x1480('0x3c')],{'$or':_[_0x1480('0x3f')](_0x3f9288,function(_0x337fa2){if(_0x337fa2[_0x1480('0x2d')]!=='VIRTUAL'){var _0x7e4397={};_0x7e4397[_0x337fa2[_0x1480('0x2a')]]={'$like':'%'+_0x39882c[_0x1480('0x31')][_0x1480('0x40')]+'%'};return _0x7e4397;}})});}_0x34046d=_['merge']({},_0x34046d,_0x39882c[_0x1480('0x41')]);var _0x5efc02={'where':_0x34046d[_0x1480('0x3c')]};return db['CmCustomField'][_0x1480('0x20')](_0x5efc02)['then'](function(_0x1de1c7){_0x51ef06['count']=_0x1de1c7;if(_0x39882c[_0x1480('0x31')][_0x1480('0x42')]){_0x34046d['include']=[{'all':!![]}];}return db[_0x1480('0x2c')][_0x1480('0x43')](_0x34046d);})[_0x1480('0x25')](function(_0xda4aad){_0x51ef06[_0x1480('0x44')]=_0xda4aad;return _0x51ef06;})['then'](respondWithFilteredResult(_0x1c19db,_0x34046d))[_0x1480('0x45')](handleError(_0x1c19db,null));};exports[_0x1480('0x46')]=function(_0x1b7d83,_0x34baba){var _0x3cfca9={'raw':!![],'where':{'id':_0x1b7d83['params']['id']}},_0x24e484={};_0x24e484[_0x1480('0x2f')]=_[_0x1480('0x32')](db['CmCustomField'][_0x1480('0x47')]);_0x24e484[_0x1480('0x31')]=_[_0x1480('0x32')](_0x1b7d83[_0x1480('0x31')]);_0x24e484[_0x1480('0x33')]=_[_0x1480('0x34')](_0x24e484[_0x1480('0x2f')],_0x24e484[_0x1480('0x31')]);_0x3cfca9[_0x1480('0x35')]=_['intersection'](_0x24e484[_0x1480('0x2f')],qs[_0x1480('0x36')](_0x1b7d83[_0x1480('0x31')][_0x1480('0x36')]));_0x3cfca9[_0x1480('0x35')]=_0x3cfca9['attributes'][_0x1480('0x37')]?_0x3cfca9[_0x1480('0x35')]:_0x24e484['model'];if(_0x1b7d83[_0x1480('0x31')][_0x1480('0x42')]){_0x3cfca9[_0x1480('0x48')]=[{'all':!![]}];}_0x3cfca9=_[_0x1480('0x3e')]({},_0x3cfca9,_0x1b7d83[_0x1480('0x41')]);return db[_0x1480('0x2c')][_0x1480('0x49')](_0x3cfca9)[_0x1480('0x25')](handleEntityNotFound(_0x34baba,null))['then'](respondWithResult(_0x34baba,null))[_0x1480('0x45')](handleError(_0x34baba,null));};exports[_0x1480('0x4a')]=function(_0x7c2998,_0x1c39bb){if(_0x7c2998[_0x1480('0x4b')]['id']){delete _0x7c2998['body']['id'];}return db['CmCustomField'][_0x1480('0x49')]({'where':{'id':_0x7c2998[_0x1480('0x4c')]['id']}})[_0x1480('0x25')](handleEntityNotFound(_0x1c39bb,null))[_0x1480('0x25')](saveUpdates(_0x7c2998[_0x1480('0x4b')],null))[_0x1480('0x25')](respondWithResult(_0x1c39bb,null))[_0x1480('0x45')](handleError(_0x1c39bb,null));};exports[_0x1480('0x26')]=function(_0x481dbf,_0x44bc77){return db['CmCustomField'][_0x1480('0x49')]({'where':{'id':_0x481dbf[_0x1480('0x4c')]['id']}})['then'](handleEntityNotFound(_0x44bc77,null))[_0x1480('0x25')](removeEntity(_0x44bc77,null))['catch'](handleError(_0x44bc77,null));};exports[_0x1480('0x4d')]=function(_0x5e9443,_0x3c7c6e){var _0x498d39;return db['sequelize'][_0x1480('0x4e')](function(_0x4ecf62){return db[_0x1480('0x2c')][_0x1480('0x4d')](_0x5e9443['body'],{'transaction':_0x4ecf62})['then'](function(_0xa244f1){_0x498d39=_0xa244f1;var _0x2daf28={'type':db[_0x1480('0x4f')][_0x1480('0x50')],'transaction':_0x4ecf62};switch(_0x5e9443[_0x1480('0x4b')][_0x1480('0x2d')]){case _0x1480('0x51'):_0x2daf28['type']=db['Sequelize'][_0x1480('0x50')];break;case _0x1480('0x52'):_0x2daf28['type']=db[_0x1480('0x4f')][_0x1480('0x53')];break;case'switch':_0x2daf28['type']=db[_0x1480('0x4f')][_0x1480('0x54')];_0x2daf28[_0x1480('0x55')]=![];break;default:}return db[_0x1480('0x56')][_0x1480('0x57')][_0x1480('0x58')](_0x1480('0x59'),util[_0x1480('0x5a')](_0x1480('0x5b'),_0x498d39['id']),_0x2daf28);})[_0x1480('0x25')](function(){return _0x498d39;});})[_0x1480('0x25')](respondWithResult(_0x3c7c6e,0xc9))[_0x1480('0x45')](handleError(_0x3c7c6e,null));}; \ No newline at end of file +var _0x5446=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','create','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','switch','defaultValue','queryInterface','addColumn','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4728c8,_0x3e1dd5){var _0x4b66ff=function(_0x22f8b4){while(--_0x22f8b4){_0x4728c8['push'](_0x4728c8['shift']());}};_0x4b66ff(++_0x3e1dd5);}(_0x5446,0x1c1));var _0x6544=function(_0x5ecf56,_0x5afce1){_0x5ecf56=_0x5ecf56-0x0;var _0x31dac6=_0x5446[_0x5ecf56];return _0x31dac6;};'use strict';var emlformat=require(_0x6544('0x0'));var rimraf=require(_0x6544('0x1'));var zipdir=require(_0x6544('0x2'));var jsonpatch=require(_0x6544('0x3'));var rp=require(_0x6544('0x4'));var moment=require(_0x6544('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6544('0x6'));var path=require(_0x6544('0x7'));var sox=require(_0x6544('0x8'));var csv=require(_0x6544('0x9'));var ejs=require(_0x6544('0xa'));var fs=require('fs');var fs_extra=require(_0x6544('0xb'));var _=require(_0x6544('0xc'));var squel=require(_0x6544('0xd'));var crypto=require(_0x6544('0xe'));var jsforce=require(_0x6544('0xf'));var deskjs=require(_0x6544('0x10'));var toCsv=require(_0x6544('0x9'));var querystring=require(_0x6544('0x11'));var Papa=require(_0x6544('0x12'));var Redis=require('ioredis');var authService=require(_0x6544('0x13'));var qs=require(_0x6544('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6544('0x15'));var logger=require('../../config/logger')(_0x6544('0x16'));var utils=require(_0x6544('0x17'));var config=require(_0x6544('0x18'));var licenseUtil=require(_0x6544('0x19'));var db=require(_0x6544('0x1a'))['db'];function respondWithStatusCode(_0x2c6220,_0x3efe89){_0x3efe89=_0x3efe89||0xcc;return function(_0x525d2a){if(_0x525d2a){return _0x2c6220['sendStatus'](_0x3efe89);}return _0x2c6220['status'](_0x3efe89)[_0x6544('0x1b')]();};}function respondWithResult(_0x201d49,_0x2e6fc){_0x2e6fc=_0x2e6fc||0xc8;return function(_0x481cca){if(_0x481cca){return _0x201d49[_0x6544('0x1c')](_0x2e6fc)[_0x6544('0x1d')](_0x481cca);}};}function respondWithFilteredResult(_0x97e42d,_0xa6c2f4){return function(_0x12bbd7){if(_0x12bbd7){var _0x207e3b=typeof _0xa6c2f4[_0x6544('0x1e')]===_0x6544('0x1f')&&typeof _0xa6c2f4[_0x6544('0x20')]===_0x6544('0x1f');var _0x24ddaa=_0x12bbd7['count'];var _0x59ba60=_0x207e3b?0x0:_0xa6c2f4[_0x6544('0x1e')];var _0x2a6ef3=_0x207e3b?_0x12bbd7[_0x6544('0x21')]:_0xa6c2f4['offset']+_0xa6c2f4[_0x6544('0x20')];var _0x3aeecd;if(_0x2a6ef3>=_0x24ddaa){_0x2a6ef3=_0x24ddaa;_0x3aeecd=0xc8;}else{_0x3aeecd=0xce;}_0x97e42d['status'](_0x3aeecd);return _0x97e42d[_0x6544('0x22')](_0x6544('0x23'),_0x59ba60+'-'+_0x2a6ef3+'/'+_0x24ddaa)[_0x6544('0x1d')](_0x12bbd7);}return null;};}function patchUpdates(_0x4987fc){return function(_0x4e3bf2){try{jsonpatch[_0x6544('0x24')](_0x4e3bf2,_0x4987fc,!![]);}catch(_0x4166f0){return BPromise[_0x6544('0x25')](_0x4166f0);}return _0x4e3bf2[_0x6544('0x26')]();};}function saveUpdates(_0x59f203,_0x4c5fec){return function(_0x3ed1e8){if(_0x3ed1e8){return _0x3ed1e8[_0x6544('0x27')](_0x59f203)[_0x6544('0x28')](function(_0x592d97){return _0x592d97;});}return null;};}function removeEntity(_0x5b9912,_0x3806d5){return function(_0x537a5a){if(_0x537a5a){return _0x537a5a[_0x6544('0x29')]()['then'](function(){_0x5b9912[_0x6544('0x1c')](0xcc)[_0x6544('0x1b')]();});}};}function handleEntityNotFound(_0x2faceb,_0x23dcac){return function(_0x36f14a){if(!_0x36f14a){_0x2faceb['sendStatus'](0x194);}return _0x36f14a;};}function handleError(_0x3622f2,_0x254a17){_0x254a17=_0x254a17||0x1f4;return function(_0x359247){logger[_0x6544('0x2a')](_0x359247[_0x6544('0x2b')]);if(_0x359247[_0x6544('0x2c')]){delete _0x359247[_0x6544('0x2c')];}_0x3622f2['status'](_0x254a17)['send'](_0x359247);};}exports[_0x6544('0x2d')]=function(_0x46c971,_0x1192f2){var _0x3b5715={},_0x28f89c={},_0x3fb5b9={'count':0x0,'rows':[]};var _0x4fc2de=_[_0x6544('0x2e')](db[_0x6544('0x2f')][_0x6544('0x30')],function(_0x10b211){return{'name':_0x10b211[_0x6544('0x31')],'type':_0x10b211[_0x6544('0x32')][_0x6544('0x33')]};});_0x28f89c['model']=_['differenceBy'](_['map'](_0x4fc2de,_0x6544('0x2c')),['name']);_0x28f89c[_0x6544('0x34')]=_[_0x6544('0x35')](_0x46c971[_0x6544('0x34')]);_0x28f89c[_0x6544('0x36')]=_[_0x6544('0x37')](_0x28f89c[_0x6544('0x38')],_0x28f89c['query']);_0x3b5715[_0x6544('0x39')]=_[_0x6544('0x37')](_0x28f89c[_0x6544('0x38')],qs[_0x6544('0x3a')](_0x46c971[_0x6544('0x34')][_0x6544('0x3a')]));_0x3b5715['attributes']=_0x3b5715['attributes'][_0x6544('0x3b')]?_0x3b5715['attributes']:_0x28f89c[_0x6544('0x38')];if(!_0x46c971[_0x6544('0x34')][_0x6544('0x3c')](_0x6544('0x3d'))){_0x3b5715['limit']=qs[_0x6544('0x20')](_0x46c971[_0x6544('0x34')][_0x6544('0x20')]);_0x3b5715[_0x6544('0x1e')]=qs[_0x6544('0x1e')](_0x46c971[_0x6544('0x34')][_0x6544('0x1e')]);}_0x3b5715[_0x6544('0x3e')]=qs[_0x6544('0x3f')](_0x46c971['query'][_0x6544('0x3f')]);_0x3b5715[_0x6544('0x40')]=qs[_0x6544('0x36')](_[_0x6544('0x41')](_0x46c971['query'],_0x28f89c[_0x6544('0x36')]),_0x4fc2de);if(_0x46c971[_0x6544('0x34')][_0x6544('0x42')]){_0x3b5715[_0x6544('0x40')]=_[_0x6544('0x43')](_0x3b5715['where'],{'$or':_['map'](_0x4fc2de,function(_0x1a049e){if(_0x1a049e['type']!==_0x6544('0x44')){var _0x14984f={};_0x14984f[_0x1a049e[_0x6544('0x2c')]]={'$like':'%'+_0x46c971[_0x6544('0x34')][_0x6544('0x42')]+'%'};return _0x14984f;}})});}_0x3b5715=_[_0x6544('0x43')]({},_0x3b5715,_0x46c971[_0x6544('0x45')]);var _0xe4ba94={'where':_0x3b5715[_0x6544('0x40')]};return db[_0x6544('0x2f')][_0x6544('0x21')](_0xe4ba94)[_0x6544('0x28')](function(_0xc29592){_0x3fb5b9[_0x6544('0x21')]=_0xc29592;if(_0x46c971[_0x6544('0x34')][_0x6544('0x46')]){_0x3b5715[_0x6544('0x47')]=[{'all':!![]}];}return db[_0x6544('0x2f')][_0x6544('0x48')](_0x3b5715);})[_0x6544('0x28')](function(_0x12b5fb){_0x3fb5b9[_0x6544('0x49')]=_0x12b5fb;return _0x3fb5b9;})[_0x6544('0x28')](respondWithFilteredResult(_0x1192f2,_0x3b5715))[_0x6544('0x4a')](handleError(_0x1192f2,null));};exports['show']=function(_0x3f8aff,_0x477508){var _0x5dda45={'raw':!![],'where':{'id':_0x3f8aff[_0x6544('0x4b')]['id']}},_0x2a01e8={};_0x2a01e8[_0x6544('0x38')]=_[_0x6544('0x35')](db[_0x6544('0x2f')]['rawAttributes']);_0x2a01e8[_0x6544('0x34')]=_[_0x6544('0x35')](_0x3f8aff[_0x6544('0x34')]);_0x2a01e8[_0x6544('0x36')]=_[_0x6544('0x37')](_0x2a01e8[_0x6544('0x38')],_0x2a01e8['query']);_0x5dda45[_0x6544('0x39')]=_['intersection'](_0x2a01e8['model'],qs['fields'](_0x3f8aff[_0x6544('0x34')]['fields']));_0x5dda45[_0x6544('0x39')]=_0x5dda45[_0x6544('0x39')][_0x6544('0x3b')]?_0x5dda45[_0x6544('0x39')]:_0x2a01e8[_0x6544('0x38')];if(_0x3f8aff[_0x6544('0x34')][_0x6544('0x46')]){_0x5dda45['include']=[{'all':!![]}];}_0x5dda45=_[_0x6544('0x43')]({},_0x5dda45,_0x3f8aff[_0x6544('0x45')]);return db[_0x6544('0x2f')][_0x6544('0x4c')](_0x5dda45)[_0x6544('0x28')](handleEntityNotFound(_0x477508,null))[_0x6544('0x28')](respondWithResult(_0x477508,null))[_0x6544('0x4a')](handleError(_0x477508,null));};exports[_0x6544('0x27')]=function(_0x1bde24,_0x484015){if(_0x1bde24[_0x6544('0x4d')]['id']){delete _0x1bde24['body']['id'];}return db[_0x6544('0x2f')][_0x6544('0x4c')]({'where':{'id':_0x1bde24[_0x6544('0x4b')]['id']}})['then'](handleEntityNotFound(_0x484015,null))['then'](saveUpdates(_0x1bde24['body'],null))['then'](respondWithResult(_0x484015,null))[_0x6544('0x4a')](handleError(_0x484015,null));};exports[_0x6544('0x29')]=function(_0xcdd0c6,_0x2aa828){return db[_0x6544('0x2f')]['find']({'where':{'id':_0xcdd0c6['params']['id']}})[_0x6544('0x28')](handleEntityNotFound(_0x2aa828,null))['then'](removeEntity(_0x2aa828,null))[_0x6544('0x4a')](handleError(_0x2aa828,null));};exports[_0x6544('0x4e')]=function(_0x459d79,_0x15270d){var _0x5c326c;return db[_0x6544('0x4f')][_0x6544('0x50')](function(_0x302a47){return db[_0x6544('0x2f')][_0x6544('0x4e')](_0x459d79['body'],{'transaction':_0x302a47})['then'](function(_0x41e8bb){_0x5c326c=_0x41e8bb;var _0x5bf397={'type':db[_0x6544('0x51')]['TEXT'],'transaction':_0x302a47};switch(_0x459d79['body']['type']){case _0x6544('0x52'):_0x5bf397[_0x6544('0x32')]=db[_0x6544('0x51')][_0x6544('0x53')];break;case _0x6544('0x54'):_0x5bf397[_0x6544('0x32')]=db[_0x6544('0x51')][_0x6544('0x55')];break;case _0x6544('0x56'):_0x5bf397['type']=db[_0x6544('0x51')]['BOOLEAN'];_0x5bf397[_0x6544('0x57')]=![];break;default:}return db[_0x6544('0x4f')][_0x6544('0x58')][_0x6544('0x59')]('cm_contacts',util[_0x6544('0x5a')]('cf_%d',_0x5c326c['id']),_0x5bf397);})[_0x6544('0x28')](function(){return _0x5c326c;});})[_0x6544('0x28')](respondWithResult(_0x15270d,0xc9))['catch'](handleError(_0x15270d,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index dcb4d35..439d31d 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 _0xa3d5=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x480e86,_0xee5284){var _0x17a5dd=function(_0x550469){while(--_0x550469){_0x480e86['push'](_0x480e86['shift']());}};_0x17a5dd(++_0xee5284);}(_0xa3d5,0x1bf));var _0x5a3d=function(_0x1c97c8,_0x28d564){_0x1c97c8=_0x1c97c8-0x0;var _0x2c096d=_0xa3d5[_0x1c97c8];return _0x2c096d;};'use strict';var _=require(_0x5a3d('0x0'));var util=require(_0x5a3d('0x1'));var logger=require(_0x5a3d('0x2'))(_0x5a3d('0x3'));var moment=require(_0x5a3d('0x4'));var BPromise=require(_0x5a3d('0x5'));var rp=require(_0x5a3d('0x6'));var fs=require('fs');var path=require(_0x5a3d('0x7'));var rimraf=require('rimraf');var config=require(_0x5a3d('0x8'));var attributes=require(_0x5a3d('0x9'));module[_0x5a3d('0xa')]=function(_0x1134cd,_0x5c9fc8){return _0x1134cd[_0x5a3d('0xb')](_0x5a3d('0xc'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ce5=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x4c212d,_0x1660fa){var _0xb8bb5a=function(_0x4f4daa){while(--_0x4f4daa){_0x4c212d['push'](_0x4c212d['shift']());}};_0xb8bb5a(++_0x1660fa);}(_0x0ce5,0x138));var _0x50ce=function(_0x155bbf,_0x1bca34){_0x155bbf=_0x155bbf-0x0;var _0x1cb0ac=_0x0ce5[_0x155bbf];return _0x1cb0ac;};'use strict';var _=require(_0x50ce('0x0'));var util=require(_0x50ce('0x1'));var logger=require(_0x50ce('0x2'))(_0x50ce('0x3'));var moment=require('moment');var BPromise=require(_0x50ce('0x4'));var rp=require(_0x50ce('0x5'));var fs=require('fs');var path=require(_0x50ce('0x6'));var rimraf=require('rimraf');var config=require(_0x50ce('0x7'));var attributes=require(_0x50ce('0x8'));module[_0x50ce('0x9')]=function(_0x585a24,_0x4e4701){return _0x585a24[_0x50ce('0xa')](_0x50ce('0xb'),attributes,{'tableName':'cm_custom_fields','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 ab0513e..519ee95 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 _0x52bf=['CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x15ad1a,_0x2de048){var _0x228e84=function(_0x2f17c7){while(--_0x2f17c7){_0x15ad1a['push'](_0x15ad1a['shift']());}};_0x228e84(++_0x2de048);}(_0x52bf,0x106));var _0xf52b=function(_0x30f037,_0x4a57e2){_0x30f037=_0x30f037-0x0;var _0xde3167=_0x52bf[_0x30f037];return _0xde3167;};'use strict';var _=require(_0xf52b('0x0'));var util=require(_0xf52b('0x1'));var moment=require(_0xf52b('0x2'));var BPromise=require(_0xf52b('0x3'));var rs=require(_0xf52b('0x4'));var fs=require('fs');var Redis=require(_0xf52b('0x5'));var db=require(_0xf52b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf52b('0x7'))(_0xf52b('0x8'));var config=require(_0xf52b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf52b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43248e,_0x20d31d,_0x561adc){return new BPromise(function(_0x2d422b,_0x49f565){return client[_0xf52b('0xb')](_0x43248e,_0x561adc)[_0xf52b('0xc')](function(_0x223c97){logger[_0xf52b('0xd')](_0xf52b('0xe'),_0x20d31d,_0xf52b('0xf'));logger[_0xf52b('0x10')](_0xf52b('0x11'),_0x20d31d,'request\x20sent',JSON[_0xf52b('0x12')](_0x223c97));if(_0x223c97['error']){if(_0x223c97[_0xf52b('0x13')][_0xf52b('0x14')]===0x1f4){logger[_0xf52b('0x13')](_0xf52b('0xe'),_0x20d31d,_0x223c97['error'][_0xf52b('0x15')]);return _0x49f565(_0x223c97[_0xf52b('0x13')][_0xf52b('0x15')]);}logger[_0xf52b('0x13')]('CmCustomField,\x20%s,\x20%s',_0x20d31d,_0x223c97[_0xf52b('0x13')][_0xf52b('0x15')]);return _0x2d422b(_0x223c97['error'][_0xf52b('0x15')]);}else{logger[_0xf52b('0xd')](_0xf52b('0xe'),_0x20d31d,_0xf52b('0xf'));_0x2d422b(_0x223c97['result'][_0xf52b('0x15')]);}})[_0xf52b('0x16')](function(_0x549296){logger[_0xf52b('0x13')]('CmCustomField,\x20%s,\x20%s',_0x20d31d,_0x549296);_0x49f565(_0x549296);});});} \ No newline at end of file +var _0xdc2f=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x578c4d,_0x49e56c){var _0x2cfa7d=function(_0x25bf6d){while(--_0x25bf6d){_0x578c4d['push'](_0x578c4d['shift']());}};_0x2cfa7d(++_0x49e56c);}(_0xdc2f,0x192));var _0xfdc2=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xdc2f[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xfdc2('0x0'));var util=require(_0xfdc2('0x1'));var moment=require(_0xfdc2('0x2'));var BPromise=require('bluebird');var rs=require(_0xfdc2('0x3'));var fs=require('fs');var Redis=require(_0xfdc2('0x4'));var db=require(_0xfdc2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfdc2('0x6'))('rpc');var config=require(_0xfdc2('0x7'));var jayson=require(_0xfdc2('0x8'));var client=jayson[_0xfdc2('0x9')][_0xfdc2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19d5c7,_0x378802,_0x34e5db){return new BPromise(function(_0x167df7,_0x24f3f9){return client[_0xfdc2('0xb')](_0x19d5c7,_0x34e5db)[_0xfdc2('0xc')](function(_0x146eb4){logger[_0xfdc2('0xd')](_0xfdc2('0xe'),_0x378802,_0xfdc2('0xf'));logger['debug'](_0xfdc2('0x10'),_0x378802,_0xfdc2('0xf'),JSON[_0xfdc2('0x11')](_0x146eb4));if(_0x146eb4[_0xfdc2('0x12')]){if(_0x146eb4[_0xfdc2('0x12')]['code']===0x1f4){logger[_0xfdc2('0x12')](_0xfdc2('0xe'),_0x378802,_0x146eb4[_0xfdc2('0x12')][_0xfdc2('0x13')]);return _0x24f3f9(_0x146eb4[_0xfdc2('0x12')][_0xfdc2('0x13')]);}logger[_0xfdc2('0x12')]('CmCustomField,\x20%s,\x20%s',_0x378802,_0x146eb4['error'][_0xfdc2('0x13')]);return _0x167df7(_0x146eb4['error']['message']);}else{logger[_0xfdc2('0xd')]('CmCustomField,\x20%s,\x20%s',_0x378802,_0xfdc2('0xf'));_0x167df7(_0x146eb4[_0xfdc2('0x14')][_0xfdc2('0x13')]);}})[_0xfdc2('0x15')](function(_0x3ca5c){logger[_0xfdc2('0x12')]('CmCustomField,\x20%s,\x20%s',_0x378802,_0x3ca5c);_0x24f3f9(_0x3ca5c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d90d073..a76615e 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 _0xc746=['../../config/environment','isAuthenticated','index','show','create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x38aa58,_0x35a451){var _0x4839c5=function(_0x54d355){while(--_0x54d355){_0x38aa58['push'](_0x38aa58['shift']());}};_0x4839c5(++_0x35a451);}(_0xc746,0xc9));var _0x6c74=function(_0x5cf05d,_0x1eadca){_0x5cf05d=_0x5cf05d-0x0;var _0x38c424=_0xc746[_0x5cf05d];return _0x38c424;};'use strict';var multer=require(_0x6c74('0x0'));var util=require(_0x6c74('0x1'));var path=require(_0x6c74('0x2'));var timeout=require(_0x6c74('0x3'));var express=require(_0x6c74('0x4'));var router=express[_0x6c74('0x5')]();var fs_extra=require(_0x6c74('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6c74('0x7'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x6c74('0x8')](),controller[_0x6c74('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6c74('0xa')]);router['post']('/',auth[_0x6c74('0x8')](),controller[_0x6c74('0xb')]);router[_0x6c74('0xc')](_0x6c74('0xd'),auth[_0x6c74('0x8')](),controller['update']);router[_0x6c74('0xe')](_0x6c74('0xd'),auth[_0x6c74('0x8')](),controller['destroy']);module[_0x6c74('0xf')]=router; \ No newline at end of file +var _0xdb2a=['isAuthenticated','index','post','create','/:id','update','destroy','multer','util','path','Router','fs-extra','../../components/interaction/service','./cmCustomField.controller','get'];(function(_0x4192ad,_0x488f5c){var _0x415dc3=function(_0x288ed5){while(--_0x288ed5){_0x4192ad['push'](_0x4192ad['shift']());}};_0x415dc3(++_0x488f5c);}(_0xdb2a,0x16f));var _0xadb2=function(_0x299d09,_0x3d8966){_0x299d09=_0x299d09-0x0;var _0x1a44d3=_0xdb2a[_0x299d09];return _0x1a44d3;};'use strict';var multer=require(_0xadb2('0x0'));var util=require(_0xadb2('0x1'));var path=require(_0xadb2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xadb2('0x3')]();var fs_extra=require(_0xadb2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xadb2('0x5'));var config=require('../../config/environment');var controller=require(_0xadb2('0x6'));router[_0xadb2('0x7')]('/',auth[_0xadb2('0x8')](),controller[_0xadb2('0x9')]);router[_0xadb2('0x7')]('/:id',auth[_0xadb2('0x8')](),controller['show']);router[_0xadb2('0xa')]('/',auth[_0xadb2('0x8')](),controller[_0xadb2('0xb')]);router['put'](_0xadb2('0xc'),auth[_0xadb2('0x8')](),controller[_0xadb2('0xd')]);router['delete'](_0xadb2('0xc'),auth['isAuthenticated'](),controller[_0xadb2('0xe')]);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 f2fef87..b0fd955 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 _0xd1e5=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','exports'];(function(_0x5baf1c,_0x2a4b60){var _0x2bc6cf=function(_0x5b0bd6){while(--_0x5b0bd6){_0x5baf1c['push'](_0x5baf1c['shift']());}};_0x2bc6cf(++_0x2a4b60);}(_0xd1e5,0x1e7));var _0x5d1e=function(_0x42322a,_0x296b64){_0x42322a=_0x42322a-0x0;var _0x178dee=_0xd1e5[_0x42322a];return _0x178dee;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x5d1e('0x0')]={'phone':{'type':Sequelize[_0x5d1e('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5d1e('0x2')],'defaultValue':moment()['format'](_0x5d1e('0x3'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5d1e('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x5d1e('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5d1e('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5d1e('0x2')]},'priority':{'type':Sequelize[_0x5d1e('0x4')](0x2)[_0x5d1e('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x5d1e('0x4')],'unique':_0x5d1e('0x7')},'ListId':{'type':Sequelize[_0x5d1e('0x4')],'unique':_0x5d1e('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x5d1e('0x7')},'CampaignId':{'type':Sequelize[_0x5d1e('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x5d1e('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x5d1e('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5d1e('0x1')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xdfb1=['sequelize','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','STRING','UNSIGNED','contactListQueue'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0xdfb1,0x15f));var _0x1dfb=function(_0x306415,_0x274e44){_0x306415=_0x306415-0x0;var _0x812a89=_0xdfb1[_0x306415];return _0x812a89;};'use strict';var moment=require('moment');var Sequelize=require(_0x1dfb('0x0'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1dfb('0x1')],'defaultValue':moment()[_0x1dfb('0x2')](_0x1dfb('0x3'))},'countbusyretry':{'type':Sequelize[_0x1dfb('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1dfb('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1dfb('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1dfb('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1dfb('0x1')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x1dfb('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1dfb('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x1dfb('0x4')],'unique':_0x1dfb('0x8')},'UserId':{'type':Sequelize[_0x1dfb('0x4')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x1dfb('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x1dfb('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1dfb('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1dfb('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1dfb('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1dfb('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x1dfb('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1dfb('0x6')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'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 71bd28e..96cfafc 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 _0x6737=['$ne','$eq','$not','$between','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$any','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','CmHopper','find','create','body','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','createdAt','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','ivr','CmContact','firstName','calleridname','isNil','lastName','finally','CmHopperFinal','end','getVoiceQueues','preview','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','ASC','findOne','scheduledat','LOCK','UPDATE','Contact','Company','CmList','List','Queue','dialActive','recallme','CmCompany','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','limit','count','offset','set','Content-Range','json','update','then','sendStatus','error','stack','send','rawAttributes','type','key','model','map','name','query','filters','intersection','$and','$or','$gt','$gte','$lt'];(function(_0x5b42fa,_0x4a9e81){var _0x1ede4f=function(_0x205c44){while(--_0x205c44){_0x5b42fa['push'](_0x5b42fa['shift']());}};_0x1ede4f(++_0x4a9e81);}(_0x6737,0xe2));var _0x7673=function(_0x13996f,_0x5d2577){_0x13996f=_0x13996f-0x0;var _0x230b2f=_0x6737[_0x13996f];return _0x230b2f;};'use strict';var moment=require('moment');var _=require(_0x7673('0x0'));var qs=require(_0x7673('0x1'));var logger=require('../../config/logger')(_0x7673('0x2'));var shared=require(_0x7673('0x3'));var db=require(_0x7673('0x4'))['db'];function respondWithResult(_0x12efff,_0x54002e){_0x54002e=_0x54002e||0xc8;return function(_0x32e6f2){if(_0x32e6f2){return _0x12efff[_0x7673('0x5')](_0x54002e)['json'](_0x32e6f2);}};}function respondWithFilteredResult(_0x2f5edc,_0x15230f){return function(_0x5af802){if(_0x5af802){var _0x4e4b24=typeof _0x15230f['offset']==='undefined'&&typeof _0x15230f[_0x7673('0x6')]==='undefined';var _0x3b3184=_0x5af802[_0x7673('0x7')];var _0x5bfae2=_0x4e4b24?0x0:_0x15230f[_0x7673('0x8')];var _0x331f57=_0x4e4b24?_0x5af802[_0x7673('0x7')]:_0x15230f['offset']+_0x15230f['limit'];var _0x3ca258;if(_0x331f57>=_0x3b3184){_0x331f57=_0x3b3184;_0x3ca258=0xc8;}else{_0x3ca258=0xce;}_0x2f5edc['status'](_0x3ca258);return _0x2f5edc[_0x7673('0x9')](_0x7673('0xa'),_0x5bfae2+'-'+_0x331f57+'/'+_0x3b3184)[_0x7673('0xb')](_0x5af802);}return null;};}function saveUpdates(_0x451c87,_0x41d6bd){return function(_0x119e42){if(_0x119e42){return _0x119e42[_0x7673('0xc')](_0x451c87)[_0x7673('0xd')](function(_0x1da115){return _0x1da115;});}return null;};}function handleEntityNotFound(_0x20a649,_0x5c8626){return function(_0x26f0c4){if(!_0x26f0c4){_0x20a649[_0x7673('0xe')](0x194);}return _0x26f0c4;};}function handleError(_0x408470,_0x2c83d){_0x2c83d=_0x2c83d||0x1f4;return function(_0x224cea){logger[_0x7673('0xf')](_0x224cea[_0x7673('0x10')]);if(_0x224cea['name']){delete _0x224cea['name'];}_0x408470[_0x7673('0x5')](_0x2c83d)[_0x7673('0x11')](_0x224cea);};}exports['index']=function(_0x3afbb3,_0x17699a){var _0x58a821={},_0x33ff7d={},_0x44704d={'count':0x0,'rows':[]};var _0x1015ba=_['map'](db['CmHopper'][_0x7673('0x12')],function(_0x267fa3){return{'name':_0x267fa3['fieldName'],'type':_0x267fa3[_0x7673('0x13')][_0x7673('0x14')]};});_0x33ff7d[_0x7673('0x15')]=_[_0x7673('0x16')](_0x1015ba,_0x7673('0x17'));_0x33ff7d[_0x7673('0x18')]=_['keys'](_0x3afbb3['query']);_0x33ff7d[_0x7673('0x19')]=_[_0x7673('0x1a')](_0x33ff7d[_0x7673('0x15')],_0x33ff7d[_0x7673('0x18')]);_0x33ff7d[_0x7673('0x19')]=_['concat'](_0x33ff7d[_0x7673('0x19')],[_0x7673('0x1b'),_0x7673('0x1c'),_0x7673('0x1d'),_0x7673('0x1e'),_0x7673('0x1f'),'$lte',_0x7673('0x20'),_0x7673('0x21'),_0x7673('0x22'),_0x7673('0x23'),'$notBetween','$in',_0x7673('0x24'),_0x7673('0x25'),_0x7673('0x26'),_0x7673('0x27'),_0x7673('0x28'),_0x7673('0x25'),_0x7673('0x29'),'$contains','$contained',_0x7673('0x2a')]);_0x58a821[_0x7673('0x2b')]=_[_0x7673('0x1a')](_0x33ff7d[_0x7673('0x15')],qs[_0x7673('0x2c')](_0x3afbb3[_0x7673('0x18')][_0x7673('0x2c')]));_0x58a821['attributes']=_0x58a821['attributes'][_0x7673('0x2d')]?_0x58a821[_0x7673('0x2b')]:_0x33ff7d[_0x7673('0x15')];if(!_0x3afbb3[_0x7673('0x18')]['hasOwnProperty'](_0x7673('0x2e'))){_0x58a821['limit']=qs[_0x7673('0x6')](_0x3afbb3[_0x7673('0x18')][_0x7673('0x6')]);_0x58a821[_0x7673('0x8')]=qs[_0x7673('0x8')](_0x3afbb3[_0x7673('0x18')][_0x7673('0x8')]);}_0x58a821[_0x7673('0x2f')]=qs[_0x7673('0x30')](_0x3afbb3[_0x7673('0x18')][_0x7673('0x30')]);_0x58a821[_0x7673('0x31')]=qs[_0x7673('0x19')](_['pick'](_0x3afbb3[_0x7673('0x18')],_0x33ff7d[_0x7673('0x19')]),_0x1015ba);if(_0x3afbb3[_0x7673('0x18')][_0x7673('0x32')]){_0x58a821[_0x7673('0x31')]=_[_0x7673('0x33')](_0x58a821[_0x7673('0x31')],{'$or':_['map'](_0x1015ba,function(_0x563e2d){if(_0x563e2d[_0x7673('0x13')]!==_0x7673('0x34')){var _0x2d34cb={};_0x2d34cb[_0x563e2d[_0x7673('0x17')]]={'$like':'%'+_0x3afbb3[_0x7673('0x18')][_0x7673('0x32')]+'%'};return _0x2d34cb;}})});}_0x58a821=_[_0x7673('0x33')]({},_0x58a821,_0x3afbb3['options']);var _0x2845f6={'where':_0x58a821[_0x7673('0x31')]};return db['CmHopper'][_0x7673('0x7')](_0x2845f6)[_0x7673('0xd')](function(_0x287eee){_0x44704d[_0x7673('0x7')]=_0x287eee;if(_0x3afbb3['query'][_0x7673('0x35')]){_0x58a821[_0x7673('0x36')]=[{'all':!![]}];}return db['CmHopper'][_0x7673('0x37')](_0x58a821);})[_0x7673('0xd')](function(_0x1be04a){_0x44704d['rows']=_0x1be04a;return _0x44704d;})[_0x7673('0xd')](respondWithFilteredResult(_0x17699a,_0x58a821))[_0x7673('0x38')](handleError(_0x17699a,null));};exports[_0x7673('0x39')]=function(_0x5dfb9a,_0x4c6106){var _0x13ce30={'raw':!![],'where':{'id':_0x5dfb9a['params']['id']}},_0x5efdf6={};_0x5efdf6[_0x7673('0x15')]=_[_0x7673('0x3a')](db['CmHopper'][_0x7673('0x12')]);_0x5efdf6[_0x7673('0x18')]=_[_0x7673('0x3a')](_0x5dfb9a[_0x7673('0x18')]);_0x5efdf6[_0x7673('0x19')]=_[_0x7673('0x1a')](_0x5efdf6['model'],_0x5efdf6[_0x7673('0x18')]);_0x13ce30['attributes']=_[_0x7673('0x1a')](_0x5efdf6['model'],qs[_0x7673('0x2c')](_0x5dfb9a[_0x7673('0x18')]['fields']));_0x13ce30['attributes']=_0x13ce30[_0x7673('0x2b')]['length']?_0x13ce30[_0x7673('0x2b')]:_0x5efdf6[_0x7673('0x15')];if(_0x5dfb9a[_0x7673('0x18')][_0x7673('0x35')]){_0x13ce30[_0x7673('0x36')]=[{'all':!![]}];}_0x13ce30=_['merge']({},_0x13ce30,_0x5dfb9a['options']);return db[_0x7673('0x3b')][_0x7673('0x3c')](_0x13ce30)['then'](handleEntityNotFound(_0x4c6106,null))[_0x7673('0xd')](respondWithResult(_0x4c6106,null))[_0x7673('0x38')](handleError(_0x4c6106,null));};exports[_0x7673('0x3d')]=function(_0x5991d7,_0x1a9017){return db[_0x7673('0x3b')][_0x7673('0x3d')](_0x5991d7[_0x7673('0x3e')],{})[_0x7673('0xd')](respondWithResult(_0x1a9017,0xc9))[_0x7673('0x38')](handleError(_0x1a9017,null));};exports[_0x7673('0xc')]=function(_0x232576,_0x58e17d){if(_0x232576['body']['id']){delete _0x232576[_0x7673('0x3e')]['id'];}return db[_0x7673('0x3b')][_0x7673('0x3c')]({'where':{'id':_0x232576[_0x7673('0x3f')]['id']}})[_0x7673('0xd')](handleEntityNotFound(_0x58e17d,null))[_0x7673('0xd')](saveUpdates(_0x232576[_0x7673('0x3e')],null))['then'](respondWithResult(_0x58e17d,null))[_0x7673('0x38')](handleError(_0x58e17d,null));};exports[_0x7673('0x40')]=function(_0x461ac3,_0x2de2e9){return db[_0x7673('0x3b')]['describe']()[_0x7673('0xd')](respondWithResult(_0x2de2e9,null))[_0x7673('0x38')](handleError(_0x2de2e9,null));};exports[_0x7673('0x41')]=function(_0x2397fb,_0x3f76a3){var _0x4c022d;var _0x56cd7a=_0x2397fb[_0x7673('0x3f')]['id'];return db[_0x7673('0x3b')]['find']({'where':{'id':_0x2397fb[_0x7673('0x3f')]['id']}})[_0x7673('0xd')](handleEntityNotFound(_0x3f76a3,null))[_0x7673('0xd')](function(_0x32a5e7){if(_0x32a5e7){return _0x32a5e7[_0x7673('0x41')]()['then'](function(_0x23789d){return _0x23789d;});}})[_0x7673('0xd')](function(_0x2a275b){_0x4c022d=_0x2a275b;if(_0x2a275b){if(_0x2a275b[_0x7673('0x42')]||_0x2a275b['CampaignId']){return db[_0x2a275b[_0x7673('0x42')]?_0x7673('0x43'):_0x7673('0x44')][_0x7673('0x3c')]({'where':{'id':_0x2a275b[_0x7673('0x42')]?_0x2a275b[_0x7673('0x42')]:_0x2a275b[_0x7673('0x45')]},'attributes':['id',_0x7673('0x17')],'raw':!![]});}}})[_0x7673('0xd')](function(_0x362409){var _0xcb9e0b={};if(_0x362409){_['merge'](_0xcb9e0b,_[_0x7673('0x46')](_0x4c022d['dataValues'],[_0x7673('0x47'),_0x7673('0x48'),'id']));_0xcb9e0b[_0x7673('0x49')]=0x15;_0xcb9e0b['statedesc']=_0x7673('0x4a');_0xcb9e0b[_0x7673('0x4b')]=_0x362409[_0x7673('0x17')];_0xcb9e0b[_0x7673('0x4c')]=_0x2397fb[_0x7673('0x4d')][_0x7673('0x17')];_0xcb9e0b[_0x7673('0x4e')]=_0x2397fb[_0x7673('0x4d')]['id'];_0xcb9e0b[_0x7673('0x4a')]=!![];_0xcb9e0b[_0x7673('0x4f')]=moment()[_0x7673('0x50')](_0x7673('0x51'));_0xcb9e0b[_0x7673('0x52')]=_0x4c022d[_0x7673('0x53')];_0xcb9e0b['campaigntype']=_0x4c022d[_0x7673('0x42')]?'queue':_0x7673('0x54');return db[_0x7673('0x55')][_0x7673('0x3c')]({'where':{'id':_0xcb9e0b['ContactId']},'attributes':[_0x7673('0x56'),'lastName']})['then'](function(_0x1804a4){if(!_['isNil'](_0x3f76a3)&&!_['isNil'](_0x1804a4[_0x7673('0x56')])){_0xcb9e0b[_0x7673('0x57')]=_0x1804a4[_0x7673('0x56')];if(!_[_0x7673('0x58')](_0x1804a4[_0x7673('0x59')])){_0xcb9e0b[_0x7673('0x57')]+='\x20'+_0x1804a4[_0x7673('0x59')];}}})[_0x7673('0x5a')](function(){return db[_0x7673('0x5b')][_0x7673('0x3d')](_0xcb9e0b);});}})[_0x7673('0xd')](function(_0x5e1985){return db['CmHopperAdditionalPhone'][_0x7673('0x41')]({'where':{'CmHopperId':_0x56cd7a}});})[_0x7673('0xd')](function(){return _0x3f76a3[_0x7673('0x5')](0xcc)[_0x7673('0x5c')]();})[_0x7673('0x38')](handleError(_0x3f76a3,null));};exports['getPreview']=function(_0x5caca9,_0x44fa26){var _0x7ac2d=[];return db[_0x7673('0x55')][_0x7673('0x40')]()[_0x7673('0xd')](function(_0x47b5b3){_0x7ac2d=_[_0x7673('0x3a')](_0x47b5b3);return _0x5caca9[_0x7673('0x4d')][_0x7673('0x5d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x7673('0x5e')},'attributes':['id','dialOrderByScheduledAt',_0x7673('0x5f')],'raw':!![]});})[_0x7673('0xd')](function(_0x31be3a){if(_0x31be3a&&_0x31be3a['length']){return db[_0x7673('0x60')][_0x7673('0x61')](function(_0x562a20){var _0x53c638={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x7673('0x51'))},'VoiceQueueId':{'$in':_[_0x7673('0x16')](_0x31be3a,'id')},'$or':[{'UserId':null},{'UserId':_0x5caca9[_0x7673('0x4d')]['id']}]};var _0x40776d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x31be3a)['filter']([_0x7673('0x5f'),0x0])['map']('id')[_0x7673('0x62')]()},'$or':[{'UserId':null},{'UserId':_0x5caca9[_0x7673('0x4d')]['id']}]};var _0x12cfe7={'$or':[_0x53c638,_0x40776d]};var _0x2a8feb=[];if(_0x5caca9['body'][_0x7673('0x63')]&&_0x5caca9[_0x7673('0x3e')][_0x7673('0x63')]==='prev'){if(!_['isEmpty'](_0x5caca9[_0x7673('0x3e')][_0x7673('0x64')])){_0x12cfe7['id']={'$in':_0x5caca9[_0x7673('0x3e')][_0x7673('0x64')]};}_0x2a8feb=[[_0x7673('0x65'),'ASC'],[_0x7673('0x66'),_0x31be3a[0x0][_0x7673('0x67')]==='ASC'?'DESC':'ASC'],db[_0x7673('0x60')][_0x7673('0x68')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x7673('0x69')]];}else{if(!_['isEmpty'](_0x5caca9['body'][_0x7673('0x64')])){_0x12cfe7['id']={'$notIn':_0x5caca9[_0x7673('0x3e')][_0x7673('0x64')]};}_0x2a8feb=[[_0x7673('0x65'),'DESC'],[_0x7673('0x66'),_0x31be3a[0x0]['dialOrderByScheduledAt']],db[_0x7673('0x60')][_0x7673('0x68')](_0x7673('0x6a')),['id',_0x7673('0x6b')]];}return db[_0x7673('0x3b')][_0x7673('0x6c')]({'attributes':['id',_0x7673('0x6d'),'phone','recallme'],'where':_0x12cfe7,'order':_0x2a8feb,'transaction':_0x562a20,'lock':_0x562a20[_0x7673('0x6e')][_0x7673('0x6f')],'include':[{'model':db[_0x7673('0x55')],'as':_0x7673('0x70'),'attributes':_0x7ac2d,'include':[{'model':db['CmCompany'],'as':_0x7673('0x71'),'attributes':['id',_0x7673('0x17')]}]},{'model':db[_0x7673('0x72')],'as':_0x7673('0x73'),'attributes':['id',_0x7673('0x17')]},{'model':db['VoiceQueue'],'as':_0x7673('0x74'),'attributes':['id',_0x7673('0x17'),_0x7673('0x75')]}]})['then'](function(_0x376f42){if(_0x376f42){return _0x376f42[_0x7673('0xc')]({'UserId':_0x5caca9[_0x7673('0x4d')]['id']},{'transaction':_0x562a20});}});});}})[_0x7673('0xd')](handleEntityNotFound(_0x44fa26,null))[_0x7673('0xd')](respondWithResult(_0x44fa26,null))[_0x7673('0x38')](handleError(_0x44fa26,null));};exports['getPreviewRecall']=function(_0xc74a16,_0x36a751,_0xc6660d){var _0x413d2a=[];var _0x1a32e3=_0xc74a16[_0x7673('0x3f')]['id'];var _0x533e5b=_0xc74a16[_0x7673('0x4d')]['id'];return db[_0x7673('0x55')][_0x7673('0x40')]()[_0x7673('0xd')](function(_0x52de39){_0x413d2a=_[_0x7673('0x3a')](_0x52de39);return db[_0x7673('0x60')][_0x7673('0x61')](function(_0xc4e03e){const _0xfed5e5={'id':_0x1a32e3};return db[_0x7673('0x3b')][_0x7673('0x6c')]({'attributes':['id',_0x7673('0x6d'),_0x7673('0x76')],'where':_0xfed5e5,'transaction':_0xc4e03e,'lock':_0xc4e03e[_0x7673('0x6e')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x7673('0x70'),'attributes':_0x413d2a,'include':[{'model':db[_0x7673('0x77')],'as':_0x7673('0x71'),'attributes':['id','name']}]},{'model':db[_0x7673('0x72')],'as':_0x7673('0x73'),'attributes':['id',_0x7673('0x17')]},{'model':db['VoiceQueue'],'as':_0x7673('0x74'),'attributes':['id','name',_0x7673('0x75')]}]})[_0x7673('0xd')](function(_0x4c7b28){if(_0x4c7b28){return _0x4c7b28['update']({'UserId':_0x533e5b},{'transaction':_0xc4e03e});}});});})[_0x7673('0xd')](handleEntityNotFound(_0x36a751,null))[_0x7673('0xd')](respondWithResult(_0x36a751,null))['catch'](handleError(_0x36a751,null));};exports['getOpenContacts']=function(_0x384aac,_0x595493){return _0x384aac[_0x7673('0x4d')][_0x7673('0x5d')]({'where':{'type':_0x7673('0x78'),'dialActive':!![],'dialMethod':_0x7673('0x5e')},'attributes':['id'],'raw':!![]})[_0x7673('0xd')](function(_0x3c82d3){if(_0x3c82d3&&_0x3c82d3[_0x7673('0x2d')]){return db[_0x7673('0x3b')][_0x7673('0x7')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x7673('0x51'))},'VoiceQueueId':{'$in':_[_0x7673('0x16')](_0x3c82d3,'id')},'$or':[{'UserId':null},{'UserId':_0x384aac[_0x7673('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x1cc5c2){if(!_[_0x7673('0x58')](_0x1cc5c2)&&_[_0x7673('0x79')](_0x1cc5c2)){return _0x595493[_0x7673('0x5')](0xc8)[_0x7673('0xb')]({'contacts':_0x1cc5c2});}else{logger[_0x7673('0xf')](_0x7673('0x7a'),'getOpenContacts',0x194,_0x7673('0x7b'));_0x595493['sendStatus'](0x194);}})[_0x7673('0x38')](handleError(_0x595493,null));};exports[_0x7673('0x7c')]=function(_0x1c61f9,_0x3a7767){var _0x4ed050=shared[_0x7673('0x7d')];var _0x31e97c=[];_[_0x7673('0x16')](_0x4ed050,function(_0x541a8a){_0x31e97c[_0x7673('0x7e')]({'id':_0x541a8a[_0x7673('0x17')],'name':_0x541a8a[_0x7673('0x17')],'utcOffset':_0x541a8a[_0x7673('0x7f')]});});return _0x3a7767['status'](0xc8)[_0x7673('0xb')]({'tz':_0x31e97c});};exports[_0x7673('0x80')]=function(_0x493c4d,_0x2d3583){var _0x332c63=shared['timezones'];var _0x3ba1aa={};if(!_['isNil'](_0x332c63[_0x493c4d[_0x7673('0x3e')]['id']]))_0x3ba1aa=_0x332c63[_0x493c4d['body']['id']];return _0x2d3583[_0x7673('0x5')](0xc8)[_0x7673('0xb')](_0x3ba1aa);}; \ No newline at end of file +var _0xb138=['deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','end','getPreview','sequelize','format','dialPreviewAutoRecallMe','value','direction','prev','hopperIds','priority','dialOrderByScheduledAt','ASC','literal','DESC','isEmpty','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','UPDATE','CmCompany','CmList','List','dialActive','getPreviewRecall','transaction','Company','Queue','getOpenContacts','getVoiceQueues','outbound','preview','isNumber','entity\x20not\x20found','getTimezones','utcOffset','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','then','sendStatus','error','name','send','index','map','CmHopper','rawAttributes','fieldName','key','model','keys','query','intersection','filters','concat','$and','$or','$gte','$lte','$ne','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','includeAll','catch','create','body','update','find','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId'];(function(_0x113976,_0x2849f2){var _0x5273a3=function(_0x4ef37b){while(--_0x4ef37b){_0x113976['push'](_0x113976['shift']());}};_0x5273a3(++_0x2849f2);}(_0xb138,0x1dd));var _0x8b13=function(_0x48b4e4,_0x1eac55){_0x48b4e4=_0x48b4e4-0x0;var _0x3e8fd3=_0xb138[_0x48b4e4];return _0x3e8fd3;};'use strict';var moment=require(_0x8b13('0x0'));var _=require(_0x8b13('0x1'));var qs=require(_0x8b13('0x2'));var logger=require(_0x8b13('0x3'))(_0x8b13('0x4'));var shared=require(_0x8b13('0x5'));var db=require(_0x8b13('0x6'))['db'];function respondWithResult(_0x5369d4,_0x4411a0){_0x4411a0=_0x4411a0||0xc8;return function(_0x241acb){if(_0x241acb){return _0x5369d4[_0x8b13('0x7')](_0x4411a0)['json'](_0x241acb);}};}function respondWithFilteredResult(_0xd19a0f,_0x13f7bd){return function(_0x5d51b1){if(_0x5d51b1){var _0x3fdf4d=typeof _0x13f7bd[_0x8b13('0x8')]===_0x8b13('0x9')&&typeof _0x13f7bd['limit']===_0x8b13('0x9');var _0x1aed6f=_0x5d51b1['count'];var _0x53ae50=_0x3fdf4d?0x0:_0x13f7bd[_0x8b13('0x8')];var _0x21fcd9=_0x3fdf4d?_0x5d51b1[_0x8b13('0xa')]:_0x13f7bd[_0x8b13('0x8')]+_0x13f7bd[_0x8b13('0xb')];var _0x51f070;if(_0x21fcd9>=_0x1aed6f){_0x21fcd9=_0x1aed6f;_0x51f070=0xc8;}else{_0x51f070=0xce;}_0xd19a0f[_0x8b13('0x7')](_0x51f070);return _0xd19a0f[_0x8b13('0xc')](_0x8b13('0xd'),_0x53ae50+'-'+_0x21fcd9+'/'+_0x1aed6f)[_0x8b13('0xe')](_0x5d51b1);}return null;};}function saveUpdates(_0xb227e0,_0x1893b1){return function(_0x58f97e){if(_0x58f97e){return _0x58f97e['update'](_0xb227e0)[_0x8b13('0xf')](function(_0x130a6f){return _0x130a6f;});}return null;};}function handleEntityNotFound(_0x5f12b5,_0x51a935){return function(_0x479773){if(!_0x479773){_0x5f12b5[_0x8b13('0x10')](0x194);}return _0x479773;};}function handleError(_0x407ef4,_0xf29086){_0xf29086=_0xf29086||0x1f4;return function(_0x2c615a){logger[_0x8b13('0x11')](_0x2c615a['stack']);if(_0x2c615a[_0x8b13('0x12')]){delete _0x2c615a[_0x8b13('0x12')];}_0x407ef4[_0x8b13('0x7')](_0xf29086)[_0x8b13('0x13')](_0x2c615a);};}exports[_0x8b13('0x14')]=function(_0x1fcfe6,_0x10fbde){var _0x441ddc={},_0x4989d3={},_0x4dac71={'count':0x0,'rows':[]};var _0xae4966=_[_0x8b13('0x15')](db[_0x8b13('0x16')][_0x8b13('0x17')],function(_0x1e0fe3){return{'name':_0x1e0fe3[_0x8b13('0x18')],'type':_0x1e0fe3['type'][_0x8b13('0x19')]};});_0x4989d3[_0x8b13('0x1a')]=_[_0x8b13('0x15')](_0xae4966,'name');_0x4989d3['query']=_[_0x8b13('0x1b')](_0x1fcfe6[_0x8b13('0x1c')]);_0x4989d3['filters']=_[_0x8b13('0x1d')](_0x4989d3[_0x8b13('0x1a')],_0x4989d3[_0x8b13('0x1c')]);_0x4989d3[_0x8b13('0x1e')]=_[_0x8b13('0x1f')](_0x4989d3['filters'],[_0x8b13('0x20'),_0x8b13('0x21'),'$gt',_0x8b13('0x22'),'$lt',_0x8b13('0x23'),_0x8b13('0x24'),'$eq',_0x8b13('0x25'),_0x8b13('0x26'),'$notBetween',_0x8b13('0x27'),_0x8b13('0x28'),_0x8b13('0x29'),_0x8b13('0x2a'),_0x8b13('0x2b'),'$notILike',_0x8b13('0x29'),_0x8b13('0x2c'),_0x8b13('0x2d'),_0x8b13('0x2e'),_0x8b13('0x2f')]);_0x441ddc[_0x8b13('0x30')]=_['intersection'](_0x4989d3[_0x8b13('0x1a')],qs[_0x8b13('0x31')](_0x1fcfe6[_0x8b13('0x1c')][_0x8b13('0x31')]));_0x441ddc[_0x8b13('0x30')]=_0x441ddc[_0x8b13('0x30')][_0x8b13('0x32')]?_0x441ddc[_0x8b13('0x30')]:_0x4989d3[_0x8b13('0x1a')];if(!_0x1fcfe6['query'][_0x8b13('0x33')](_0x8b13('0x34'))){_0x441ddc[_0x8b13('0xb')]=qs[_0x8b13('0xb')](_0x1fcfe6['query']['limit']);_0x441ddc[_0x8b13('0x8')]=qs['offset'](_0x1fcfe6['query'][_0x8b13('0x8')]);}_0x441ddc['order']=qs[_0x8b13('0x35')](_0x1fcfe6[_0x8b13('0x1c')][_0x8b13('0x35')]);_0x441ddc[_0x8b13('0x36')]=qs[_0x8b13('0x1e')](_[_0x8b13('0x37')](_0x1fcfe6[_0x8b13('0x1c')],_0x4989d3[_0x8b13('0x1e')]),_0xae4966);if(_0x1fcfe6[_0x8b13('0x1c')][_0x8b13('0x38')]){_0x441ddc['where']=_[_0x8b13('0x39')](_0x441ddc[_0x8b13('0x36')],{'$or':_[_0x8b13('0x15')](_0xae4966,function(_0x4141db){if(_0x4141db[_0x8b13('0x3a')]!==_0x8b13('0x3b')){var _0x6b4645={};_0x6b4645[_0x4141db[_0x8b13('0x12')]]={'$like':'%'+_0x1fcfe6['query'][_0x8b13('0x38')]+'%'};return _0x6b4645;}})});}_0x441ddc=_['merge']({},_0x441ddc,_0x1fcfe6[_0x8b13('0x3c')]);var _0x37732c={'where':_0x441ddc[_0x8b13('0x36')]};return db[_0x8b13('0x16')][_0x8b13('0xa')](_0x37732c)[_0x8b13('0xf')](function(_0x4ec1a5){_0x4dac71['count']=_0x4ec1a5;if(_0x1fcfe6[_0x8b13('0x1c')]['includeAll']){_0x441ddc[_0x8b13('0x3d')]=[{'all':!![]}];}return db['CmHopper'][_0x8b13('0x3e')](_0x441ddc);})[_0x8b13('0xf')](function(_0x29a359){_0x4dac71[_0x8b13('0x3f')]=_0x29a359;return _0x4dac71;})[_0x8b13('0xf')](respondWithFilteredResult(_0x10fbde,_0x441ddc))['catch'](handleError(_0x10fbde,null));};exports['show']=function(_0x230a8c,_0x595d8d){var _0x6ba2f3={'raw':!![],'where':{'id':_0x230a8c['params']['id']}},_0x9f2d81={};_0x9f2d81[_0x8b13('0x1a')]=_[_0x8b13('0x1b')](db[_0x8b13('0x16')][_0x8b13('0x17')]);_0x9f2d81[_0x8b13('0x1c')]=_[_0x8b13('0x1b')](_0x230a8c[_0x8b13('0x1c')]);_0x9f2d81['filters']=_['intersection'](_0x9f2d81['model'],_0x9f2d81[_0x8b13('0x1c')]);_0x6ba2f3[_0x8b13('0x30')]=_[_0x8b13('0x1d')](_0x9f2d81[_0x8b13('0x1a')],qs[_0x8b13('0x31')](_0x230a8c[_0x8b13('0x1c')]['fields']));_0x6ba2f3[_0x8b13('0x30')]=_0x6ba2f3['attributes'][_0x8b13('0x32')]?_0x6ba2f3['attributes']:_0x9f2d81[_0x8b13('0x1a')];if(_0x230a8c[_0x8b13('0x1c')][_0x8b13('0x40')]){_0x6ba2f3[_0x8b13('0x3d')]=[{'all':!![]}];}_0x6ba2f3=_[_0x8b13('0x39')]({},_0x6ba2f3,_0x230a8c[_0x8b13('0x3c')]);return db[_0x8b13('0x16')]['find'](_0x6ba2f3)['then'](handleEntityNotFound(_0x595d8d,null))['then'](respondWithResult(_0x595d8d,null))[_0x8b13('0x41')](handleError(_0x595d8d,null));};exports[_0x8b13('0x42')]=function(_0x288faa,_0x288838){return db['CmHopper']['create'](_0x288faa[_0x8b13('0x43')],{})['then'](respondWithResult(_0x288838,0xc9))[_0x8b13('0x41')](handleError(_0x288838,null));};exports[_0x8b13('0x44')]=function(_0x20c363,_0x28ae75){if(_0x20c363[_0x8b13('0x43')]['id']){delete _0x20c363['body']['id'];}return db[_0x8b13('0x16')][_0x8b13('0x45')]({'where':{'id':_0x20c363[_0x8b13('0x46')]['id']}})[_0x8b13('0xf')](handleEntityNotFound(_0x28ae75,null))[_0x8b13('0xf')](saveUpdates(_0x20c363[_0x8b13('0x43')],null))[_0x8b13('0xf')](respondWithResult(_0x28ae75,null))[_0x8b13('0x41')](handleError(_0x28ae75,null));};exports[_0x8b13('0x47')]=function(_0x518298,_0x46d096){return db['CmHopper'][_0x8b13('0x47')]()[_0x8b13('0xf')](respondWithResult(_0x46d096,null))[_0x8b13('0x41')](handleError(_0x46d096,null));};exports['destroy']=function(_0x148efb,_0x35f612){var _0x257107;var _0x4129c0=_0x148efb[_0x8b13('0x46')]['id'];return db[_0x8b13('0x16')][_0x8b13('0x45')]({'where':{'id':_0x148efb['params']['id']}})[_0x8b13('0xf')](handleEntityNotFound(_0x35f612,null))['then'](function(_0x19b70b){if(_0x19b70b){return _0x19b70b[_0x8b13('0x48')]()[_0x8b13('0xf')](function(_0x435867){return _0x435867;});}})[_0x8b13('0xf')](function(_0x22e613){_0x257107=_0x22e613;if(_0x22e613){if(_0x22e613[_0x8b13('0x49')]||_0x22e613[_0x8b13('0x4a')]){return db[_0x22e613[_0x8b13('0x49')]?_0x8b13('0x4b'):_0x8b13('0x4c')][_0x8b13('0x45')]({'where':{'id':_0x22e613[_0x8b13('0x49')]?_0x22e613[_0x8b13('0x49')]:_0x22e613[_0x8b13('0x4a')]},'attributes':['id',_0x8b13('0x12')],'raw':!![]});}}})[_0x8b13('0xf')](function(_0x50c354){var _0x1699c6={};if(_0x50c354){_[_0x8b13('0x39')](_0x1699c6,_['omit'](_0x257107[_0x8b13('0x4d')],[_0x8b13('0x4e'),_0x8b13('0x4f'),'id']));_0x1699c6[_0x8b13('0x50')]=0x15;_0x1699c6[_0x8b13('0x51')]=_0x8b13('0x52');_0x1699c6[_0x8b13('0x53')]=_0x50c354[_0x8b13('0x12')];_0x1699c6[_0x8b13('0x54')]=_0x148efb[_0x8b13('0x55')][_0x8b13('0x12')];_0x1699c6[_0x8b13('0x56')]=_0x148efb[_0x8b13('0x55')]['id'];_0x1699c6[_0x8b13('0x52')]=!![];_0x1699c6[_0x8b13('0x57')]=moment()['format'](_0x8b13('0x58'));_0x1699c6[_0x8b13('0x59')]=_0x257107['phone'];_0x1699c6[_0x8b13('0x5a')]=_0x257107[_0x8b13('0x49')]?_0x8b13('0x5b'):_0x8b13('0x5c');return db[_0x8b13('0x5d')]['find']({'where':{'id':_0x1699c6[_0x8b13('0x5e')]},'attributes':[_0x8b13('0x5f'),_0x8b13('0x60')]})['then'](function(_0x5d76a7){if(!_[_0x8b13('0x61')](_0x35f612)&&!_['isNil'](_0x5d76a7[_0x8b13('0x5f')])){_0x1699c6[_0x8b13('0x62')]=_0x5d76a7[_0x8b13('0x5f')];if(!_[_0x8b13('0x61')](_0x5d76a7['lastName'])){_0x1699c6[_0x8b13('0x62')]+='\x20'+_0x5d76a7[_0x8b13('0x60')];}}})['finally'](function(){return db[_0x8b13('0x63')][_0x8b13('0x42')](_0x1699c6);});}})[_0x8b13('0xf')](function(_0x23a63c){return db['CmHopperAdditionalPhone'][_0x8b13('0x48')]({'where':{'CmHopperId':_0x4129c0}});})[_0x8b13('0xf')](function(){return _0x35f612[_0x8b13('0x7')](0xcc)[_0x8b13('0x64')]();})[_0x8b13('0x41')](handleError(_0x35f612,null));};exports[_0x8b13('0x65')]=function(_0x571e89,_0x123f52){var _0x1082d9=[];return db[_0x8b13('0x5d')]['describe']()[_0x8b13('0xf')](function(_0x576c91){_0x1082d9=_[_0x8b13('0x1b')](_0x576c91);return _0x571e89[_0x8b13('0x55')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})[_0x8b13('0xf')](function(_0x1bc936){if(_0x1bc936&&_0x1bc936['length']){return db[_0x8b13('0x66')]['transaction'](function(_0x274bad){var _0x2d2fa3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8b13('0x67')](_0x8b13('0x58'))},'VoiceQueueId':{'$in':_[_0x8b13('0x15')](_0x1bc936,'id')},'$or':[{'UserId':null},{'UserId':_0x571e89[_0x8b13('0x55')]['id']}]};var _0xa7c7d5={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1bc936)['filter']([_0x8b13('0x68'),0x0])['map']('id')[_0x8b13('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x571e89[_0x8b13('0x55')]['id']}]};var _0x207a54={'$or':[_0x2d2fa3,_0xa7c7d5]};var _0x11a4ba=[];if(_0x571e89[_0x8b13('0x43')][_0x8b13('0x6a')]&&_0x571e89[_0x8b13('0x43')]['direction']===_0x8b13('0x6b')){if(!_['isEmpty'](_0x571e89[_0x8b13('0x43')][_0x8b13('0x6c')])){_0x207a54['id']={'$in':_0x571e89[_0x8b13('0x43')][_0x8b13('0x6c')]};}_0x11a4ba=[[_0x8b13('0x6d'),'ASC'],['scheduledAt',_0x1bc936[0x0][_0x8b13('0x6e')]===_0x8b13('0x6f')?'DESC':_0x8b13('0x6f')],db[_0x8b13('0x66')][_0x8b13('0x70')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x8b13('0x71')]];}else{if(!_[_0x8b13('0x72')](_0x571e89[_0x8b13('0x43')][_0x8b13('0x6c')])){_0x207a54['id']={'$notIn':_0x571e89['body'][_0x8b13('0x6c')]};}_0x11a4ba=[[_0x8b13('0x6d'),'DESC'],[_0x8b13('0x73'),_0x1bc936[0x0][_0x8b13('0x6e')]],db[_0x8b13('0x66')][_0x8b13('0x70')](_0x8b13('0x74')),['id',_0x8b13('0x6f')]];}return db[_0x8b13('0x16')][_0x8b13('0x75')]({'attributes':['id',_0x8b13('0x76'),_0x8b13('0x77'),_0x8b13('0x78')],'where':_0x207a54,'order':_0x11a4ba,'transaction':_0x274bad,'lock':_0x274bad[_0x8b13('0x79')][_0x8b13('0x7a')],'include':[{'model':db[_0x8b13('0x5d')],'as':'Contact','attributes':_0x1082d9,'include':[{'model':db[_0x8b13('0x7b')],'as':'Company','attributes':['id',_0x8b13('0x12')]}]},{'model':db[_0x8b13('0x7c')],'as':_0x8b13('0x7d'),'attributes':['id',_0x8b13('0x12')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x8b13('0x12'),_0x8b13('0x7e')]}]})['then'](function(_0x21b638){if(_0x21b638){return _0x21b638[_0x8b13('0x44')]({'UserId':_0x571e89[_0x8b13('0x55')]['id']},{'transaction':_0x274bad});}});});}})[_0x8b13('0xf')](handleEntityNotFound(_0x123f52,null))[_0x8b13('0xf')](respondWithResult(_0x123f52,null))[_0x8b13('0x41')](handleError(_0x123f52,null));};exports[_0x8b13('0x7f')]=function(_0xce30cc,_0xddd6f9,_0x24211c){var _0x48fd36=[];var _0x2a1fd3=_0xce30cc[_0x8b13('0x46')]['id'];var _0x5ac2c4=_0xce30cc[_0x8b13('0x55')]['id'];return db[_0x8b13('0x5d')]['describe']()[_0x8b13('0xf')](function(_0x44ca37){_0x48fd36=_[_0x8b13('0x1b')](_0x44ca37);return db[_0x8b13('0x66')][_0x8b13('0x80')](function(_0xe81c2e){const _0x142886={'id':_0x2a1fd3};return db[_0x8b13('0x16')]['findOne']({'attributes':['id',_0x8b13('0x76'),_0x8b13('0x78')],'where':_0x142886,'transaction':_0xe81c2e,'lock':_0xe81c2e[_0x8b13('0x79')]['UPDATE'],'include':[{'model':db[_0x8b13('0x5d')],'as':'Contact','attributes':_0x48fd36,'include':[{'model':db[_0x8b13('0x7b')],'as':_0x8b13('0x81'),'attributes':['id',_0x8b13('0x12')]}]},{'model':db[_0x8b13('0x7c')],'as':_0x8b13('0x7d'),'attributes':['id',_0x8b13('0x12')]},{'model':db[_0x8b13('0x4b')],'as':_0x8b13('0x82'),'attributes':['id',_0x8b13('0x12'),_0x8b13('0x7e')]}]})['then'](function(_0x3dc732){if(_0x3dc732){return _0x3dc732[_0x8b13('0x44')]({'UserId':_0x5ac2c4},{'transaction':_0xe81c2e});}});});})[_0x8b13('0xf')](handleEntityNotFound(_0xddd6f9,null))[_0x8b13('0xf')](respondWithResult(_0xddd6f9,null))[_0x8b13('0x41')](handleError(_0xddd6f9,null));};exports[_0x8b13('0x83')]=function(_0x2c69f5,_0x9173d){return _0x2c69f5[_0x8b13('0x55')][_0x8b13('0x84')]({'where':{'type':_0x8b13('0x85'),'dialActive':!![],'dialMethod':_0x8b13('0x86')},'attributes':['id'],'raw':!![]})[_0x8b13('0xf')](function(_0x4bb71a){if(_0x4bb71a&&_0x4bb71a['length']){return db[_0x8b13('0x16')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8b13('0x67')](_0x8b13('0x58'))},'VoiceQueueId':{'$in':_['map'](_0x4bb71a,'id')},'$or':[{'UserId':null},{'UserId':_0x2c69f5['user']['id']}]}});}return 0x0;})[_0x8b13('0xf')](function(_0x416f9c){if(!_[_0x8b13('0x61')](_0x416f9c)&&_[_0x8b13('0x87')](_0x416f9c)){return _0x9173d[_0x8b13('0x7')](0xc8)['json']({'contacts':_0x416f9c});}else{logger[_0x8b13('0x11')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x8b13('0x83'),0x194,_0x8b13('0x88'));_0x9173d['sendStatus'](0x194);}})[_0x8b13('0x41')](handleError(_0x9173d,null));};exports[_0x8b13('0x89')]=function(_0x3f345a,_0x34cee5){var _0x2f1ddf=shared['timezones'];var _0x223765=[];_[_0x8b13('0x15')](_0x2f1ddf,function(_0x471f25){_0x223765['push']({'id':_0x471f25[_0x8b13('0x12')],'name':_0x471f25['name'],'utcOffset':_0x471f25[_0x8b13('0x8a')]});});return _0x34cee5[_0x8b13('0x7')](0xc8)[_0x8b13('0xe')]({'tz':_0x223765});};exports[_0x8b13('0x8b')]=function(_0x229009,_0xe70f1b){var _0x441173=shared[_0x8b13('0x8c')];var _0x42ea3a={};if(!_[_0x8b13('0x61')](_0x441173[_0x229009['body']['id']]))_0x42ea3a=_0x441173[_0x229009[_0x8b13('0x43')]['id']];return _0xe70f1b[_0x8b13('0x7')](0xc8)[_0x8b13('0xe')](_0x42ea3a);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 70b879c..b2e9203 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 _0x53ec=['moment','bluebird','path','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x53ec,0x192));var _0xc53e=function(_0x2a87e9,_0x25c03e){_0x2a87e9=_0x2a87e9-0x0;var _0x5de0e6=_0x53ec[_0x2a87e9];return _0x5de0e6;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]},{'name':_0xc53e('0xc'),'fields':[_0xc53e('0xc')]},{'name':_0xc53e('0xd'),'fields':[_0xc53e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x20f2ac,_0x4477a3){var _0x400a5c=function(_0x320a8a){while(--_0x320a8a){_0x20f2ac['push'](_0x20f2ac['shift']());}};_0x400a5c(++_0x4477a3);}(_0xc1c6,0xf7));var _0x6c1c=function(_0xe0eaa9,_0x3ef57f){_0xe0eaa9=_0xe0eaa9-0x0;var _0x5da1d6=_0xc1c6[_0xe0eaa9];return _0x5da1d6;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]},{'name':'phone','fields':[_0x6c1c('0xb')]},{'name':_0x6c1c('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index c455329..db36c98 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 _0x9f91=['attributes','include','map','model','then','info','debug','stringify','catch','error','message','ShowCmHopper','CreateCmHopper','body','update','limit','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','order','LOCK','UPDATE','CmContact','keys','User','Agent','name','voicePause','push','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','transaction','all','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','List','lodash','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','where'];(function(_0x46ba52,_0x23b97c){var _0x53cf77=function(_0x5e8a11){while(--_0x5e8a11){_0x46ba52['push'](_0x46ba52['shift']());}};_0x53cf77(++_0x23b97c);}(_0x9f91,0x1e0));var _0x19f9=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0x9f91[_0xea35d1];return _0x1d7a7c;};'use strict';var _=require(_0x19f9('0x0'));var util=require(_0x19f9('0x1'));var moment=require(_0x19f9('0x2'));var BPromise=require(_0x19f9('0x3'));var db=require(_0x19f9('0x4'))['db'];var logger=require('../../config/logger')(_0x19f9('0x5'));exports[_0x19f9('0x6')]=function(_0x531c1f){var _0x309c88=this;return new Promise(function(_0x27493e,_0x3d2c77){return db[_0x19f9('0x7')][_0x19f9('0x8')]({'raw':_0x531c1f[_0x19f9('0x9')]?_0x531c1f[_0x19f9('0x9')][_0x19f9('0xa')]===undefined?!![]:![]:!![],'where':_0x531c1f[_0x19f9('0x9')]?_0x531c1f[_0x19f9('0x9')][_0x19f9('0xb')]||null:null,'attributes':_0x531c1f['options']?_0x531c1f[_0x19f9('0x9')][_0x19f9('0xc')]||null:null,'limit':_0x531c1f['options']?_0x531c1f['options']['limit']||null:null,'include':_0x531c1f['options']?_0x531c1f[_0x19f9('0x9')][_0x19f9('0xd')]?_[_0x19f9('0xe')](_0x531c1f[_0x19f9('0x9')][_0x19f9('0xd')],function(_0x142982){return{'model':db[_0x142982['model']],'as':_0x142982['as'],'attributes':_0x142982[_0x19f9('0xc')],'include':_0x142982[_0x19f9('0xd')]?_[_0x19f9('0xe')](_0x142982['include'],function(_0x44b4f0){return{'model':db[_0x44b4f0[_0x19f9('0xf')]],'as':_0x44b4f0['as'],'attributes':_0x44b4f0[_0x19f9('0xc')],'include':_0x44b4f0[_0x19f9('0xd')]?_[_0x19f9('0xe')](_0x44b4f0[_0x19f9('0xd')],function(_0x2454a3){return{'model':db[_0x2454a3[_0x19f9('0xf')]],'as':_0x2454a3['as'],'attributes':_0x2454a3[_0x19f9('0xc')]};}):[]};}):[]};}):[]:[]})[_0x19f9('0x10')](function(_0x5aa573){logger[_0x19f9('0x11')](_0x19f9('0x6'),_0x531c1f);logger[_0x19f9('0x12')](_0x19f9('0x6'),_0x531c1f,JSON[_0x19f9('0x13')](_0x5aa573));_0x27493e(_0x5aa573);})[_0x19f9('0x14')](function(_0x244ef7){logger[_0x19f9('0x15')]('GetCmHopper',_0x244ef7[_0x19f9('0x16')],_0x531c1f);_0x3d2c77(_0x309c88['error'](0x1f4,_0x244ef7[_0x19f9('0x16')]));});});};exports[_0x19f9('0x17')]=function(_0x23c4aa){var _0x79c67e=this;return new Promise(function(_0x324140,_0x39088c){return db[_0x19f9('0x7')]['find']({'raw':_0x23c4aa[_0x19f9('0x9')]?_0x23c4aa[_0x19f9('0x9')][_0x19f9('0xa')]===undefined?!![]:![]:!![],'where':_0x23c4aa[_0x19f9('0x9')]?_0x23c4aa[_0x19f9('0x9')][_0x19f9('0xb')]||null:null,'attributes':_0x23c4aa[_0x19f9('0x9')]?_0x23c4aa[_0x19f9('0x9')][_0x19f9('0xc')]||null:null,'include':_0x23c4aa[_0x19f9('0x9')]?_0x23c4aa[_0x19f9('0x9')][_0x19f9('0xd')]?_[_0x19f9('0xe')](_0x23c4aa['options'][_0x19f9('0xd')],function(_0x3d2041){return{'model':db[_0x3d2041[_0x19f9('0xf')]],'as':_0x3d2041['as'],'attributes':_0x3d2041[_0x19f9('0xc')],'include':_0x3d2041['include']?_[_0x19f9('0xe')](_0x3d2041['include'],function(_0x531b6e){return{'model':db[_0x531b6e[_0x19f9('0xf')]],'as':_0x531b6e['as'],'attributes':_0x531b6e[_0x19f9('0xc')],'include':_0x531b6e['include']?_[_0x19f9('0xe')](_0x531b6e[_0x19f9('0xd')],function(_0x1d698c){return{'model':db[_0x1d698c[_0x19f9('0xf')]],'as':_0x1d698c['as'],'attributes':_0x1d698c[_0x19f9('0xc')]};}):[]};}):[]};}):[]:[]})[_0x19f9('0x10')](function(_0x17590e){logger[_0x19f9('0x11')]('ShowCmHopper',_0x23c4aa);logger['debug'](_0x19f9('0x17'),_0x23c4aa,JSON[_0x19f9('0x13')](_0x17590e));_0x324140(_0x17590e);})[_0x19f9('0x14')](function(_0x1a4dd5){logger[_0x19f9('0x15')](_0x19f9('0x17'),_0x1a4dd5[_0x19f9('0x16')],_0x23c4aa);_0x39088c(_0x79c67e[_0x19f9('0x15')](0x1f4,_0x1a4dd5[_0x19f9('0x16')]));});});};exports[_0x19f9('0x18')]=function(_0x1fc60c){var _0x4bd20f=this;return new Promise(function(_0x263bd6,_0x1aed24){return db[_0x19f9('0x7')]['create'](_0x1fc60c[_0x19f9('0x19')],{'raw':_0x1fc60c[_0x19f9('0x9')]?_0x1fc60c['options'][_0x19f9('0xa')]===undefined?!![]:![]:!![]})[_0x19f9('0x10')](function(_0x1339bd){logger[_0x19f9('0x11')]('CreateCmHopper',_0x1fc60c);logger[_0x19f9('0x12')]('CreateCmHopper',_0x1fc60c,JSON[_0x19f9('0x13')](_0x1339bd));_0x263bd6(_0x1339bd);})['catch'](function(_0xb1dcde){logger[_0x19f9('0x15')](_0x19f9('0x18'),_0xb1dcde[_0x19f9('0x16')],_0x1fc60c);_0x1aed24(_0x4bd20f[_0x19f9('0x15')](0x1f4,_0xb1dcde['message']));});});};exports['UpdateCmHopper']=function(_0x191b49){var _0x4df3d1=this;return new Promise(function(_0x20cfdd,_0x37bb1){return db[_0x19f9('0x7')][_0x19f9('0x1a')](_0x191b49[_0x19f9('0x19')],{'raw':_0x191b49[_0x19f9('0x9')]?_0x191b49[_0x19f9('0x9')][_0x19f9('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x191b49[_0x19f9('0x9')]?_0x191b49[_0x19f9('0x9')][_0x19f9('0xb')]||null:null,'attributes':_0x191b49[_0x19f9('0x9')]?_0x191b49[_0x19f9('0x9')][_0x19f9('0xc')]||null:null,'limit':_0x191b49[_0x19f9('0x9')]?_0x191b49[_0x19f9('0x9')][_0x19f9('0x1b')]||null:null})['then'](function(_0x32b7ef){logger[_0x19f9('0x11')](_0x19f9('0x1c'),_0x191b49);logger[_0x19f9('0x11')](_0x19f9('0x1d'),JSON['stringify'](_0x191b49['options'][_0x19f9('0xb')]),_0x191b49[_0x19f9('0x19')][_0x19f9('0x1e')]);logger['debug'](_0x19f9('0x1c'),_0x191b49,JSON[_0x19f9('0x13')](_0x32b7ef));_0x20cfdd(_0x32b7ef);})['catch'](function(_0x1ab1f8){logger[_0x19f9('0x15')](_0x19f9('0x1c'),_0x1ab1f8[_0x19f9('0x16')],_0x191b49);_0x37bb1(_0x4df3d1[_0x19f9('0x15')](0x1f4,_0x1ab1f8['message']));});});};exports[_0x19f9('0x1f')]=function(_0x3af7d3){var _0x4af0f3=this;return new Promise(function(_0x1bb251,_0x4b91e4){return db[_0x19f9('0x7')][_0x19f9('0x20')]({'where':_0x3af7d3[_0x19f9('0x9')]?_0x3af7d3[_0x19f9('0x9')][_0x19f9('0xb')]||null:null})[_0x19f9('0x10')](function(_0x3a9914){logger[_0x19f9('0x11')](_0x19f9('0x1f'),_0x3af7d3);logger['debug']('DestroyCmHopper',_0x3af7d3,JSON[_0x19f9('0x13')](_0x3a9914));_0x1bb251(_0x3a9914);})['catch'](function(_0x36a45f){logger[_0x19f9('0x15')](_0x19f9('0x1f'),_0x36a45f[_0x19f9('0x16')],_0x3af7d3);_0x4b91e4(_0x4af0f3['error'](0x1f4,_0x36a45f['message']));});});};exports[_0x19f9('0x21')]=function(_0x65a629){var _0x3f67aa=this;return new Promise(function(_0x507166,_0x575e11){return db['CmContact'][_0x19f9('0x22')]()[_0x19f9('0x10')](function(_0x3a3865){return db[_0x19f9('0x23')]['transaction'](function(_0xedf55b){return db[_0x19f9('0x7')][_0x19f9('0x8')]({'where':_0x65a629[_0x19f9('0x9')]?_0x65a629[_0x19f9('0x9')]['where']||null:null,'attributes':_0x65a629[_0x19f9('0x9')]?_0x65a629[_0x19f9('0x9')]['attributes']||null:null,'limit':_0x65a629['options']?_0x65a629['options'][_0x19f9('0x1b')]||null:null,'order':_0x65a629['options']?_0x65a629[_0x19f9('0x9')][_0x19f9('0x24')]||null:null,'transaction':_0xedf55b,'lock':_0xedf55b[_0x19f9('0x25')][_0x19f9('0x26')],'include':[{'model':db[_0x19f9('0x27')],'as':'Contact','attributes':_[_0x19f9('0x28')](_0x3a3865)},{'model':db[_0x19f9('0x29')],'as':_0x19f9('0x2a'),'attributes':['id',_0x19f9('0x2b'),_0x19f9('0x2c')]}]})['then'](function(_0x44f246){var _0x27be8e=[];var _0x2163da=[];for(var _0x34e8a3=0x0;_0x34e8a3<_0x44f246['length'];_0x34e8a3+=0x1){var _0x1e7125=_0x44f246[_0x34e8a3]['UserId'];if(_0x1e7125===null){_0x27be8e['push'](_0x44f246[_0x34e8a3][_0x19f9('0x1a')](_0x65a629['body'],{'transaction':_0xedf55b}));}else if(!_0x2163da['includes'](_0x1e7125)){_0x2163da[_0x19f9('0x2d')](_0x1e7125);_0x27be8e['push'](_0x44f246[_0x34e8a3][_0x19f9('0x1a')](_0x65a629[_0x19f9('0x19')],{'transaction':_0xedf55b}));}}return BPromise['all'](_0x27be8e);});})[_0x19f9('0x10')](function(_0x2c2e01){logger['info'](_0x19f9('0x21'),_0x65a629);if(_0x2c2e01[_0x19f9('0x2e')]>0x0){logger['info'](_0x19f9('0x2f'),_0x2c2e01[0x0][_0x19f9('0x30')]['id'],_0x2c2e01[0x0]['dataValues'][_0x19f9('0x31')],_0x2c2e01[0x0][_0x19f9('0x30')][_0x19f9('0x1e')]);}logger[_0x19f9('0x12')](_0x19f9('0x21'),_0x65a629,JSON['stringify'](_0x2c2e01));_0x507166(_0x2c2e01);})[_0x19f9('0x14')](function(_0x145825){logger[_0x19f9('0x15')](_0x19f9('0x21'),_0x145825[_0x19f9('0x16')],_0x65a629);_0x575e11(_0x3f67aa[_0x19f9('0x15')](0x1f4,_0x145825[_0x19f9('0x16')]));});});});};exports[_0x19f9('0x32')]=function(_0x3a811e){var _0x4e4700=this;return new Promise(function(_0xada8bb,_0x5305e4){return db[_0x19f9('0x23')]['transaction'](function(_0x48b5f2){return db[_0x19f9('0x33')][_0x19f9('0x34')](_0x3a811e[_0x19f9('0x19')],{'raw':_0x3a811e[_0x19f9('0x9')]?_0x3a811e[_0x19f9('0x9')][_0x19f9('0xa')]===undefined?!![]:![]:!![],'transaction':_0x48b5f2})[_0x19f9('0x10')](function(){logger['info'](_0x19f9('0x35'),JSON['stringify'](_0x3a811e[_0x19f9('0x9')][_0x19f9('0xb')]),_0x3a811e['options'][_0x19f9('0xb')][_0x19f9('0x1e')]);return db['CmHopper']['destroy']({'where':_0x3a811e[_0x19f9('0x9')]?_0x3a811e[_0x19f9('0x9')][_0x19f9('0xb')]||null:null,'transaction':_0x48b5f2});});})[_0x19f9('0x10')](function(_0x2a7188){logger[_0x19f9('0x11')](_0x19f9('0x32'),_0x3a811e);logger['debug'](_0x19f9('0x32'),_0x3a811e,JSON[_0x19f9('0x13')](_0x2a7188));_0xada8bb(_0x2a7188);})['catch'](function(_0x5cf7d0){logger[_0x19f9('0x15')]('MoveContactManagedDialer',_0x5cf7d0['message'],_0x3a811e);_0x5305e4(_0x4e4700[_0x19f9('0x15')](0x1f4,_0x5cf7d0['message']));});});};exports[_0x19f9('0x36')]=function(_0x15156a){var _0x57372c=this;return new Promise(function(_0xd61758,_0x133845){return db[_0x19f9('0x7')][_0x19f9('0x8')]({'raw':_0x15156a[_0x19f9('0x9')]?_0x15156a[_0x19f9('0x9')][_0x19f9('0xa')]===undefined?!![]:![]:!![],'where':_0x15156a['options']?_0x15156a[_0x19f9('0x9')][_0x19f9('0xb')]||null:null,'attributes':[[db[_0x19f9('0x23')]['fn'](_0x19f9('0x37'),db[_0x19f9('0x23')]['fn']('IF',db['sequelize'][_0x19f9('0x38')](_0x19f9('0x39')+util[_0x19f9('0x3a')]('\x22%s\x22',moment()[_0x19f9('0x3a')](_0x19f9('0x3b')))+_0x19f9('0x3c')))),_0x19f9('0x3d')]]})[_0x19f9('0x10')](function(_0x471e59){logger['info']('CountReScheduled',_0x15156a);logger[_0x19f9('0x12')](_0x19f9('0x36'),_0x15156a,JSON['stringify'](_0x471e59));_0xd61758(_0x471e59);})['catch'](function(_0x5be5af){logger[_0x19f9('0x15')](_0x19f9('0x36'),_0x5be5af['message'],_0x15156a);_0x133845(_0x57372c[_0x19f9('0x15')](0x1f4,_0x5be5af[_0x19f9('0x16')]));});});};exports[_0x19f9('0x3e')]=function(_0x3b2c42){var _0x33c382=this;return new Promise(function(_0x5cbc8e,_0x58c32a){return db['CmContact']['describe']()['then'](function(){return db[_0x19f9('0x23')][_0x19f9('0x3f')](function(_0x2e22f1){return db[_0x19f9('0x7')]['findAll']({'where':_0x3b2c42[_0x19f9('0x9')]?_0x3b2c42[_0x19f9('0x9')]['where']||null:null,'attributes':_0x3b2c42[_0x19f9('0x9')]?_0x3b2c42[_0x19f9('0x9')][_0x19f9('0xc')]||null:null,'limit':0x1,'order':_0x3b2c42[_0x19f9('0x9')]?_0x3b2c42[_0x19f9('0x9')][_0x19f9('0x24')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x2e22f1,'lock':_0x2e22f1[_0x19f9('0x25')]['UPDATE'],'include':_0x3b2c42[_0x19f9('0x9')]?_0x3b2c42[_0x19f9('0x9')]['include']?_['map'](_0x3b2c42['options'][_0x19f9('0xd')],function(_0x208a41){return{'model':db[_0x208a41[_0x19f9('0xf')]],'as':_0x208a41['as'],'attributes':_0x208a41['attributes'],'include':_0x208a41[_0x19f9('0xd')]?_[_0x19f9('0xe')](_0x208a41['include'],function(_0x3eb011){return{'model':db[_0x3eb011[_0x19f9('0xf')]],'as':_0x3eb011['as'],'attributes':_0x3eb011[_0x19f9('0xc')],'include':_0x3eb011[_0x19f9('0xd')]?_[_0x19f9('0xe')](_0x3eb011[_0x19f9('0xd')],function(_0xb3ffaa){return{'model':db[_0xb3ffaa[_0x19f9('0xf')]],'as':_0xb3ffaa['as'],'attributes':_0xb3ffaa[_0x19f9('0xc')]};}):[]};}):[]};}):[]:[]})[_0x19f9('0x10')](function(_0x58cbe6){var _0x29ef73=[];for(var _0x47b613=0x0;_0x47b613<_0x58cbe6[_0x19f9('0x2e')];_0x47b613+=0x1){_0x29ef73[_0x19f9('0x2d')](_0x58cbe6[_0x47b613][_0x19f9('0x1a')](_0x3b2c42['body'],{'transaction':_0x2e22f1}));}return BPromise[_0x19f9('0x40')](_0x29ef73);});})[_0x19f9('0x10')](function(_0x492420){logger['info'](_0x19f9('0x3e'),_0x3b2c42);logger[_0x19f9('0x12')]('GetContactRecallMe',_0x3b2c42,JSON[_0x19f9('0x13')](_0x492420));_0x5cbc8e(_0x492420);})['catch'](function(_0x13e3cb){logger[_0x19f9('0x15')]('GetContactRecallMe',_0x13e3cb[_0x19f9('0x16')],_0x3b2c42);_0x58c32a(_0x33c382[_0x19f9('0x15')](0x1f4,_0x13e3cb[_0x19f9('0x16')]));});});});};exports[_0x19f9('0x41')]=function(_0x303175){var _0x17da98=this;return new Promise(function(_0x5a238a,_0x55885a){db[_0x19f9('0x27')][_0x19f9('0x22')]()[_0x19f9('0x10')](function(_0x5a6396){return db[_0x19f9('0x7')][_0x19f9('0x8')]({'raw':_0x303175['options']?_0x303175[_0x19f9('0x9')][_0x19f9('0xa')]===undefined?!![]:![]:!![],'where':_0x303175['options']?_0x303175[_0x19f9('0x9')][_0x19f9('0xb')]||null:null,'attributes':_0x303175[_0x19f9('0x9')]?_0x303175['options'][_0x19f9('0xc')]||null:null,'limit':_0x303175[_0x19f9('0x9')]?_0x303175[_0x19f9('0x9')][_0x19f9('0x1b')]||null:null,'include':_0x303175['options']?_0x303175[_0x19f9('0x9')]['include']?_[_0x19f9('0xe')](_0x303175[_0x19f9('0x9')][_0x19f9('0xd')],function(_0x30dda){return{'model':db[_0x30dda[_0x19f9('0xf')]],'as':_0x30dda['as'],'attributes':_0x30dda['as']===_0x19f9('0x42')?_['keys'](_0x5a6396):_0x30dda['attributes'],'include':_0x30dda[_0x19f9('0xd')]?_[_0x19f9('0xe')](_0x30dda[_0x19f9('0xd')],function(_0x2ed1b9){return{'model':db[_0x2ed1b9['model']],'as':_0x2ed1b9['as'],'attributes':_0x2ed1b9[_0x19f9('0xc')],'include':_0x2ed1b9[_0x19f9('0xd')]?_[_0x19f9('0xe')](_0x2ed1b9[_0x19f9('0xd')],function(_0x4cd48e){return{'model':db[_0x4cd48e[_0x19f9('0xf')]],'as':_0x4cd48e['as'],'attributes':_0x4cd48e[_0x19f9('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d6877){logger[_0x19f9('0x11')]('GetCmHopper',_0x303175);logger['debug'](_0x19f9('0x6'),_0x303175,JSON[_0x19f9('0x13')](_0x4d6877));_0x5a238a(_0x4d6877);})[_0x19f9('0x14')](function(_0x498101){logger['error']('GetCmHopper',_0x498101[_0x19f9('0x16')],_0x303175);_0x55885a(_0x17da98[_0x19f9('0x15')](0x1f4,_0x498101[_0x19f9('0x16')]));});});});};exports[_0x19f9('0x43')]=function(_0x103cf4){var _0x18afde=this;return new Promise(function(_0x2268b3,_0x5ac81b){return db[_0x19f9('0x27')][_0x19f9('0x44')]({'raw':!![],'where':{'phone':_0x103cf4[_0x19f9('0x9')][_0x19f9('0xb')][_0x19f9('0x45')]},'attributes':['id',_0x19f9('0x46')],'order':[['id',_0x19f9('0x47')]]})[_0x19f9('0x10')](function(_0x5e9b14){logger[_0x19f9('0x11')](_0x19f9('0x48'),_0x103cf4);logger[_0x19f9('0x12')]('getContactByPhone',_0x103cf4,JSON[_0x19f9('0x13')](_0x5e9b14));_0x2268b3(_0x5e9b14);})[_0x19f9('0x14')](function(_0x957831){logger[_0x19f9('0x15')](_0x19f9('0x48'),_0x957831[_0x19f9('0x16')],_0x103cf4);_0x5ac81b(_0x18afde[_0x19f9('0x15')](0x1f4,_0x957831[_0x19f9('0x16')]));});});};exports['ResetActiveCalls']=function(_0x302dcd){var _0x20c06f=this;return new Promise(function(_0x2abdab,_0x51502a){return db[_0x19f9('0x23')][_0x19f9('0x3f')](function(_0x4289ec){var _0x369267=_0x302dcd[_0x19f9('0x9')]&&_0x302dcd[_0x19f9('0x9')][_0x19f9('0xb')]?_0x302dcd[_0x19f9('0x9')]['where']:{};return db[_0x19f9('0x7')][_0x19f9('0x1a')](_0x302dcd[_0x19f9('0x19')],{'where':_0x369267,'transaction':_0x4289ec})[_0x19f9('0x10')](function(_0x5293a2){logger[_0x19f9('0x11')](_0x19f9('0x49'),_0x302dcd);logger[_0x19f9('0x12')](_0x19f9('0x49'),_0x302dcd,JSON[_0x19f9('0x13')](_0x5293a2));_0x2abdab(_0x5293a2);})[_0x19f9('0x14')](function(_0x4cf9e3){logger['error']('ResetActiveCalls',_0x4cf9e3[_0x19f9('0x16')],_0x302dcd);_0x51502a(_0x20c06f[_0x19f9('0x15')](0x1f4,_0x4cf9e3[_0x19f9('0x16')]));});});});};exports[_0x19f9('0x4a')]=function(_0x3e76e5){var _0x1a77e6=this;var _0x1af5f0=_0x3e76e5['body']['where'][_0x19f9('0x4b')];var _0x48aa91=_0x3e76e5[_0x19f9('0x19')][_0x19f9('0xb')][_0x19f9('0x4c')];var _0x2a27c4=_0x3e76e5[_0x19f9('0x19')][_0x19f9('0xb')][_0x19f9('0x4d')];return new Promise(function(_0x40fa10,_0x4ab3db){return db[_0x19f9('0x7')][_0x19f9('0x8')]({'where':{'voiceQueueId':{'$in':_0x1af5f0},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x19f9('0x23')][_0x19f9('0x38')](_0x19f9('0x4e')+_0x48aa91+_0x19f9('0x4f')),'$gt':db['sequelize'][_0x19f9('0x38')](_0x19f9('0x50'))}},'UserId':{'$in':_0x2a27c4}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db['User'],'as':_0x19f9('0x2a'),'attributes':['id',_0x19f9('0x2b'),_0x19f9('0x2c')]},{'model':db['CmList'],'as':_0x19f9('0x51')}]})[_0x19f9('0x10')](function(_0x577019){if(_0x577019[_0x19f9('0x2e')]>0x0){return db[_0x19f9('0x23')][_0x19f9('0x3f')](function(_0x108263){return db['CmHopper'][_0x19f9('0x1a')]({'recallmeNotifiedDate':db[_0x19f9('0x23')]['literal'](_0x19f9('0x50'))},{'where':{'id':{'$in':_[_0x19f9('0xe')](_0x577019,'id')}},'transaction':_0x108263})[_0x19f9('0x10')](function(){_0x40fa10(_0x577019);})[_0x19f9('0x14')](function(_0x49787d){logger[_0x19f9('0x15')](_0x19f9('0x4a'),_0x49787d[_0x19f9('0x16')],_0x3e76e5);_0x4ab3db(_0x1a77e6['error'](0x1f4,_0x49787d[_0x19f9('0x16')]));});})[_0x19f9('0x14')](function(_0x4d1904){logger[_0x19f9('0x15')](_0x19f9('0x4a'),_0x4d1904[_0x19f9('0x16')],_0x3e76e5);_0x4ab3db(_0x1a77e6[_0x19f9('0x15')](0x1f4,_0x4d1904[_0x19f9('0x16')]));});}else{_0x40fa10(_0x577019);}});});}; \ No newline at end of file +var _0xb62e=['\x20MINUTE','NOW()','List','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowCmHopper','CreateCmHopper','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','CmContact','describe','transaction','order','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','create','CountReScheduled','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','UserId','LOCK','GetCmHopperPreview','GetContactByPhone','dialTimezone','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0xb62e,0x1de));var _0xeb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xeb62('0x4'))(_0xeb62('0x5'));exports[_0xeb62('0x6')]=function(_0x929329){var _0x3c7ad5=this;return new Promise(function(_0x1ebdbb,_0x5bc3c7){return db[_0xeb62('0x7')][_0xeb62('0x8')]({'raw':_0x929329[_0xeb62('0x9')]?_0x929329['options'][_0xeb62('0xa')]===undefined?!![]:![]:!![],'where':_0x929329[_0xeb62('0x9')]?_0x929329[_0xeb62('0x9')][_0xeb62('0xb')]||null:null,'attributes':_0x929329['options']?_0x929329['options'][_0xeb62('0xc')]||null:null,'limit':_0x929329[_0xeb62('0x9')]?_0x929329[_0xeb62('0x9')][_0xeb62('0xd')]||null:null,'include':_0x929329[_0xeb62('0x9')]?_0x929329[_0xeb62('0x9')][_0xeb62('0xe')]?_[_0xeb62('0xf')](_0x929329[_0xeb62('0x9')][_0xeb62('0xe')],function(_0x4a493c){return{'model':db[_0x4a493c[_0xeb62('0x10')]],'as':_0x4a493c['as'],'attributes':_0x4a493c[_0xeb62('0xc')],'include':_0x4a493c[_0xeb62('0xe')]?_[_0xeb62('0xf')](_0x4a493c['include'],function(_0x333126){return{'model':db[_0x333126[_0xeb62('0x10')]],'as':_0x333126['as'],'attributes':_0x333126[_0xeb62('0xc')],'include':_0x333126['include']?_[_0xeb62('0xf')](_0x333126[_0xeb62('0xe')],function(_0x2fd4c7){return{'model':db[_0x2fd4c7['model']],'as':_0x2fd4c7['as'],'attributes':_0x2fd4c7[_0xeb62('0xc')]};}):[]};}):[]};}):[]:[]})[_0xeb62('0x11')](function(_0x184106){logger[_0xeb62('0x12')](_0xeb62('0x6'),_0x929329);logger[_0xeb62('0x13')](_0xeb62('0x6'),_0x929329,JSON[_0xeb62('0x14')](_0x184106));_0x1ebdbb(_0x184106);})[_0xeb62('0x15')](function(_0x27fd84){logger[_0xeb62('0x16')](_0xeb62('0x6'),_0x27fd84[_0xeb62('0x17')],_0x929329);_0x5bc3c7(_0x3c7ad5['error'](0x1f4,_0x27fd84[_0xeb62('0x17')]));});});};exports[_0xeb62('0x18')]=function(_0x332396){var _0xb44905=this;return new Promise(function(_0x425817,_0x24cbf3){return db[_0xeb62('0x7')]['find']({'raw':_0x332396['options']?_0x332396[_0xeb62('0x9')][_0xeb62('0xa')]===undefined?!![]:![]:!![],'where':_0x332396[_0xeb62('0x9')]?_0x332396[_0xeb62('0x9')][_0xeb62('0xb')]||null:null,'attributes':_0x332396['options']?_0x332396['options'][_0xeb62('0xc')]||null:null,'include':_0x332396[_0xeb62('0x9')]?_0x332396[_0xeb62('0x9')][_0xeb62('0xe')]?_['map'](_0x332396['options'][_0xeb62('0xe')],function(_0x4dbc2c){return{'model':db[_0x4dbc2c[_0xeb62('0x10')]],'as':_0x4dbc2c['as'],'attributes':_0x4dbc2c['attributes'],'include':_0x4dbc2c[_0xeb62('0xe')]?_['map'](_0x4dbc2c[_0xeb62('0xe')],function(_0x6bfbbc){return{'model':db[_0x6bfbbc[_0xeb62('0x10')]],'as':_0x6bfbbc['as'],'attributes':_0x6bfbbc['attributes'],'include':_0x6bfbbc[_0xeb62('0xe')]?_[_0xeb62('0xf')](_0x6bfbbc[_0xeb62('0xe')],function(_0xe8872c){return{'model':db[_0xe8872c[_0xeb62('0x10')]],'as':_0xe8872c['as'],'attributes':_0xe8872c[_0xeb62('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x192517){logger[_0xeb62('0x12')]('ShowCmHopper',_0x332396);logger[_0xeb62('0x13')](_0xeb62('0x18'),_0x332396,JSON[_0xeb62('0x14')](_0x192517));_0x425817(_0x192517);})[_0xeb62('0x15')](function(_0x235448){logger['error']('ShowCmHopper',_0x235448[_0xeb62('0x17')],_0x332396);_0x24cbf3(_0xb44905[_0xeb62('0x16')](0x1f4,_0x235448[_0xeb62('0x17')]));});});};exports[_0xeb62('0x19')]=function(_0x42b197){var _0x2ad3ec=this;return new Promise(function(_0x1ae51e,_0x4be25d){return db[_0xeb62('0x7')]['create'](_0x42b197['body'],{'raw':_0x42b197[_0xeb62('0x9')]?_0x42b197[_0xeb62('0x9')]['raw']===undefined?!![]:![]:!![]})[_0xeb62('0x11')](function(_0x4bcfce){logger[_0xeb62('0x12')](_0xeb62('0x19'),_0x42b197);logger['debug'](_0xeb62('0x19'),_0x42b197,JSON[_0xeb62('0x14')](_0x4bcfce));_0x1ae51e(_0x4bcfce);})['catch'](function(_0x1b3a60){logger[_0xeb62('0x16')](_0xeb62('0x19'),_0x1b3a60[_0xeb62('0x17')],_0x42b197);_0x4be25d(_0x2ad3ec['error'](0x1f4,_0x1b3a60[_0xeb62('0x17')]));});});};exports[_0xeb62('0x1a')]=function(_0x4cf6b0){var _0x4acc96=this;return new Promise(function(_0x112cd7,_0x117d8c){return db['CmHopper'][_0xeb62('0x1b')](_0x4cf6b0[_0xeb62('0x1c')],{'raw':_0x4cf6b0[_0xeb62('0x9')]?_0x4cf6b0[_0xeb62('0x9')][_0xeb62('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cf6b0[_0xeb62('0x9')]?_0x4cf6b0[_0xeb62('0x9')]['where']||null:null,'attributes':_0x4cf6b0['options']?_0x4cf6b0[_0xeb62('0x9')][_0xeb62('0xc')]||null:null,'limit':_0x4cf6b0[_0xeb62('0x9')]?_0x4cf6b0[_0xeb62('0x9')]['limit']||null:null})[_0xeb62('0x11')](function(_0x510c7d){logger[_0xeb62('0x12')](_0xeb62('0x1a'),_0x4cf6b0);logger[_0xeb62('0x12')](_0xeb62('0x1d'),JSON[_0xeb62('0x14')](_0x4cf6b0[_0xeb62('0x9')][_0xeb62('0xb')]),_0x4cf6b0[_0xeb62('0x1c')]['active']);logger[_0xeb62('0x13')](_0xeb62('0x1a'),_0x4cf6b0,JSON[_0xeb62('0x14')](_0x510c7d));_0x112cd7(_0x510c7d);})[_0xeb62('0x15')](function(_0x5dd0e3){logger['error'](_0xeb62('0x1a'),_0x5dd0e3[_0xeb62('0x17')],_0x4cf6b0);_0x117d8c(_0x4acc96['error'](0x1f4,_0x5dd0e3[_0xeb62('0x17')]));});});};exports[_0xeb62('0x1e')]=function(_0x48dd81){var _0x25e9f0=this;return new Promise(function(_0x478a54,_0x37022f){return db['CmHopper'][_0xeb62('0x1f')]({'where':_0x48dd81['options']?_0x48dd81[_0xeb62('0x9')][_0xeb62('0xb')]||null:null})[_0xeb62('0x11')](function(_0x594274){logger['info'](_0xeb62('0x1e'),_0x48dd81);logger[_0xeb62('0x13')](_0xeb62('0x1e'),_0x48dd81,JSON[_0xeb62('0x14')](_0x594274));_0x478a54(_0x594274);})[_0xeb62('0x15')](function(_0x4afd5e){logger[_0xeb62('0x16')]('DestroyCmHopper',_0x4afd5e[_0xeb62('0x17')],_0x48dd81);_0x37022f(_0x25e9f0['error'](0x1f4,_0x4afd5e[_0xeb62('0x17')]));});});};exports['GetContactDialer']=function(_0x26c77d){var _0x4dbcac=this;return new Promise(function(_0x2f04ce,_0x4624e7){return db[_0xeb62('0x20')][_0xeb62('0x21')]()[_0xeb62('0x11')](function(_0x21bb97){return db['sequelize'][_0xeb62('0x22')](function(_0x1b3e2c){return db['CmHopper']['findAll']({'where':_0x26c77d['options']?_0x26c77d['options'][_0xeb62('0xb')]||null:null,'attributes':_0x26c77d[_0xeb62('0x9')]?_0x26c77d['options'][_0xeb62('0xc')]||null:null,'limit':_0x26c77d[_0xeb62('0x9')]?_0x26c77d[_0xeb62('0x9')][_0xeb62('0xd')]||null:null,'order':_0x26c77d[_0xeb62('0x9')]?_0x26c77d['options'][_0xeb62('0x23')]||null:null,'transaction':_0x1b3e2c,'lock':_0x1b3e2c['LOCK'][_0xeb62('0x24')],'include':[{'model':db[_0xeb62('0x20')],'as':_0xeb62('0x25'),'attributes':_[_0xeb62('0x26')](_0x21bb97)},{'model':db[_0xeb62('0x27')],'as':_0xeb62('0x28'),'attributes':['id',_0xeb62('0x29'),_0xeb62('0x2a')]}]})[_0xeb62('0x11')](function(_0x3a29ac){var _0xe13846=[];var _0x13e102=[];for(var _0x4c3b96=0x0;_0x4c3b96<_0x3a29ac[_0xeb62('0x2b')];_0x4c3b96+=0x1){var _0x50bfec=_0x3a29ac[_0x4c3b96]['UserId'];if(_0x50bfec===null){_0xe13846[_0xeb62('0x2c')](_0x3a29ac[_0x4c3b96][_0xeb62('0x1b')](_0x26c77d['body'],{'transaction':_0x1b3e2c}));}else if(!_0x13e102[_0xeb62('0x2d')](_0x50bfec)){_0x13e102[_0xeb62('0x2c')](_0x50bfec);_0xe13846['push'](_0x3a29ac[_0x4c3b96][_0xeb62('0x1b')](_0x26c77d[_0xeb62('0x1c')],{'transaction':_0x1b3e2c}));}}return BPromise[_0xeb62('0x2e')](_0xe13846);});})[_0xeb62('0x11')](function(_0xe71e83){logger[_0xeb62('0x12')](_0xeb62('0x2f'),_0x26c77d);if(_0xe71e83[_0xeb62('0x2b')]>0x0){logger['info'](_0xeb62('0x30'),_0xe71e83[0x0]['dataValues']['id'],_0xe71e83[0x0][_0xeb62('0x31')][_0xeb62('0x32')],_0xe71e83[0x0][_0xeb62('0x31')][_0xeb62('0x33')]);}logger[_0xeb62('0x13')](_0xeb62('0x2f'),_0x26c77d,JSON[_0xeb62('0x14')](_0xe71e83));_0x2f04ce(_0xe71e83);})[_0xeb62('0x15')](function(_0x595d58){logger['error']('GetContactDialer',_0x595d58['message'],_0x26c77d);_0x4624e7(_0x4dbcac[_0xeb62('0x16')](0x1f4,_0x595d58['message']));});});});};exports[_0xeb62('0x34')]=function(_0x5c0e7f){var _0x1cd951=this;return new Promise(function(_0x342768,_0xff18cd){return db['sequelize'][_0xeb62('0x22')](function(_0x1486a6){return db['CmHopperFinal'][_0xeb62('0x35')](_0x5c0e7f[_0xeb62('0x1c')],{'raw':_0x5c0e7f[_0xeb62('0x9')]?_0x5c0e7f[_0xeb62('0x9')]['raw']===undefined?!![]:![]:!![],'transaction':_0x1486a6})[_0xeb62('0x11')](function(){logger[_0xeb62('0x12')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xeb62('0x14')](_0x5c0e7f[_0xeb62('0x9')][_0xeb62('0xb')]),_0x5c0e7f[_0xeb62('0x9')][_0xeb62('0xb')][_0xeb62('0x33')]);return db[_0xeb62('0x7')][_0xeb62('0x1f')]({'where':_0x5c0e7f[_0xeb62('0x9')]?_0x5c0e7f[_0xeb62('0x9')][_0xeb62('0xb')]||null:null,'transaction':_0x1486a6});});})[_0xeb62('0x11')](function(_0x200b43){logger[_0xeb62('0x12')](_0xeb62('0x34'),_0x5c0e7f);logger[_0xeb62('0x13')]('MoveContactManagedDialer',_0x5c0e7f,JSON['stringify'](_0x200b43));_0x342768(_0x200b43);})['catch'](function(_0x5b28ec){logger[_0xeb62('0x16')]('MoveContactManagedDialer',_0x5b28ec[_0xeb62('0x17')],_0x5c0e7f);_0xff18cd(_0x1cd951[_0xeb62('0x16')](0x1f4,_0x5b28ec[_0xeb62('0x17')]));});});};exports[_0xeb62('0x36')]=function(_0x8b0d67){var _0x2f2294=this;return new Promise(function(_0x38d206,_0x8a64de){return db[_0xeb62('0x7')][_0xeb62('0x8')]({'raw':_0x8b0d67['options']?_0x8b0d67[_0xeb62('0x9')][_0xeb62('0xa')]===undefined?!![]:![]:!![],'where':_0x8b0d67[_0xeb62('0x9')]?_0x8b0d67[_0xeb62('0x9')]['where']||null:null,'attributes':[[db[_0xeb62('0x37')]['fn'](_0xeb62('0x38'),db[_0xeb62('0x37')]['fn']('IF',db[_0xeb62('0x37')][_0xeb62('0x39')](_0xeb62('0x3a')+util[_0xeb62('0x3b')](_0xeb62('0x3c'),moment()[_0xeb62('0x3b')](_0xeb62('0x3d')))+_0xeb62('0x3e')))),'contactsRescheduled']]})[_0xeb62('0x11')](function(_0x33419f){logger[_0xeb62('0x12')](_0xeb62('0x36'),_0x8b0d67);logger[_0xeb62('0x13')](_0xeb62('0x36'),_0x8b0d67,JSON[_0xeb62('0x14')](_0x33419f));_0x38d206(_0x33419f);})[_0xeb62('0x15')](function(_0x1183f4){logger[_0xeb62('0x16')]('CountReScheduled',_0x1183f4[_0xeb62('0x17')],_0x8b0d67);_0x8a64de(_0x2f2294[_0xeb62('0x16')](0x1f4,_0x1183f4[_0xeb62('0x17')]));});});};exports[_0xeb62('0x3f')]=function(_0x546856){var _0x1732c1=this;return new Promise(function(_0x317f35,_0x3f7dc8){return db[_0xeb62('0x20')][_0xeb62('0x21')]()[_0xeb62('0x11')](function(){return db['sequelize'][_0xeb62('0x22')](function(_0x1b56cf){return db[_0xeb62('0x7')][_0xeb62('0x8')]({'where':_0x546856[_0xeb62('0x9')]?_0x546856[_0xeb62('0x9')][_0xeb62('0xb')]||null:null,'attributes':_0x546856[_0xeb62('0x9')]?_0x546856[_0xeb62('0x9')][_0xeb62('0xc')]||null:null,'limit':0x1,'order':_0x546856[_0xeb62('0x9')]?_0x546856[_0xeb62('0x9')][_0xeb62('0x23')]||null:null,'group':db[_0xeb62('0x7')][_0xeb62('0x40')],'transaction':_0x1b56cf,'lock':_0x1b56cf[_0xeb62('0x41')]['UPDATE'],'include':_0x546856[_0xeb62('0x9')]?_0x546856['options'][_0xeb62('0xe')]?_[_0xeb62('0xf')](_0x546856['options'][_0xeb62('0xe')],function(_0x10986a){return{'model':db[_0x10986a[_0xeb62('0x10')]],'as':_0x10986a['as'],'attributes':_0x10986a[_0xeb62('0xc')],'include':_0x10986a[_0xeb62('0xe')]?_[_0xeb62('0xf')](_0x10986a[_0xeb62('0xe')],function(_0x449582){return{'model':db[_0x449582[_0xeb62('0x10')]],'as':_0x449582['as'],'attributes':_0x449582[_0xeb62('0xc')],'include':_0x449582[_0xeb62('0xe')]?_[_0xeb62('0xf')](_0x449582[_0xeb62('0xe')],function(_0x4c6b69){return{'model':db[_0x4c6b69[_0xeb62('0x10')]],'as':_0x4c6b69['as'],'attributes':_0x4c6b69[_0xeb62('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f8de8){var _0x5c2b15=[];for(var _0x32679a=0x0;_0x32679a<_0x1f8de8[_0xeb62('0x2b')];_0x32679a+=0x1){_0x5c2b15[_0xeb62('0x2c')](_0x1f8de8[_0x32679a][_0xeb62('0x1b')](_0x546856[_0xeb62('0x1c')],{'transaction':_0x1b56cf}));}return BPromise[_0xeb62('0x2e')](_0x5c2b15);});})['then'](function(_0x29b112){logger['info'](_0xeb62('0x3f'),_0x546856);logger[_0xeb62('0x13')](_0xeb62('0x3f'),_0x546856,JSON[_0xeb62('0x14')](_0x29b112));_0x317f35(_0x29b112);})[_0xeb62('0x15')](function(_0x520110){logger[_0xeb62('0x16')](_0xeb62('0x3f'),_0x520110[_0xeb62('0x17')],_0x546856);_0x3f7dc8(_0x1732c1['error'](0x1f4,_0x520110[_0xeb62('0x17')]));});});});};exports[_0xeb62('0x42')]=function(_0x8a8ef3){var _0x7ca547=this;return new Promise(function(_0x16c28d,_0x31f999){db['CmContact']['describe']()['then'](function(_0x50590b){return db['CmHopper'][_0xeb62('0x8')]({'raw':_0x8a8ef3[_0xeb62('0x9')]?_0x8a8ef3[_0xeb62('0x9')][_0xeb62('0xa')]===undefined?!![]:![]:!![],'where':_0x8a8ef3[_0xeb62('0x9')]?_0x8a8ef3[_0xeb62('0x9')][_0xeb62('0xb')]||null:null,'attributes':_0x8a8ef3[_0xeb62('0x9')]?_0x8a8ef3[_0xeb62('0x9')][_0xeb62('0xc')]||null:null,'limit':_0x8a8ef3[_0xeb62('0x9')]?_0x8a8ef3[_0xeb62('0x9')]['limit']||null:null,'include':_0x8a8ef3[_0xeb62('0x9')]?_0x8a8ef3[_0xeb62('0x9')][_0xeb62('0xe')]?_[_0xeb62('0xf')](_0x8a8ef3[_0xeb62('0x9')][_0xeb62('0xe')],function(_0x30c8e0){return{'model':db[_0x30c8e0[_0xeb62('0x10')]],'as':_0x30c8e0['as'],'attributes':_0x30c8e0['as']===_0xeb62('0x25')?_[_0xeb62('0x26')](_0x50590b):_0x30c8e0[_0xeb62('0xc')],'include':_0x30c8e0[_0xeb62('0xe')]?_[_0xeb62('0xf')](_0x30c8e0[_0xeb62('0xe')],function(_0xfff29b){return{'model':db[_0xfff29b[_0xeb62('0x10')]],'as':_0xfff29b['as'],'attributes':_0xfff29b[_0xeb62('0xc')],'include':_0xfff29b[_0xeb62('0xe')]?_['map'](_0xfff29b[_0xeb62('0xe')],function(_0x544b2e){return{'model':db[_0x544b2e[_0xeb62('0x10')]],'as':_0x544b2e['as'],'attributes':_0x544b2e[_0xeb62('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d909f){logger['info']('GetCmHopper',_0x8a8ef3);logger[_0xeb62('0x13')](_0xeb62('0x6'),_0x8a8ef3,JSON[_0xeb62('0x14')](_0x1d909f));_0x16c28d(_0x1d909f);})[_0xeb62('0x15')](function(_0x539b8d){logger[_0xeb62('0x16')](_0xeb62('0x6'),_0x539b8d['message'],_0x8a8ef3);_0x31f999(_0x7ca547[_0xeb62('0x16')](0x1f4,_0x539b8d[_0xeb62('0x17')]));});});});};exports[_0xeb62('0x43')]=function(_0x29d1e0){var _0x204f50=this;return new Promise(function(_0xa14afb,_0x119f9c){return db[_0xeb62('0x20')]['findOne']({'raw':!![],'where':{'phone':_0x29d1e0[_0xeb62('0x9')][_0xeb62('0xb')]['phone']},'attributes':['id',_0xeb62('0x44')],'order':[['id','DESC']]})['then'](function(_0x2321aa){logger[_0xeb62('0x12')](_0xeb62('0x45'),_0x29d1e0);logger[_0xeb62('0x13')](_0xeb62('0x45'),_0x29d1e0,JSON['stringify'](_0x2321aa));_0xa14afb(_0x2321aa);})[_0xeb62('0x15')](function(_0x1909ee){logger[_0xeb62('0x16')](_0xeb62('0x45'),_0x1909ee[_0xeb62('0x17')],_0x29d1e0);_0x119f9c(_0x204f50[_0xeb62('0x16')](0x1f4,_0x1909ee[_0xeb62('0x17')]));});});};exports[_0xeb62('0x46')]=function(_0x4f027c){var _0x53d4bb=this;return new Promise(function(_0x2ba33b,_0x36b104){return db[_0xeb62('0x37')][_0xeb62('0x22')](function(_0x599418){var _0x63ce7a=_0x4f027c['options']&&_0x4f027c['options'][_0xeb62('0xb')]?_0x4f027c[_0xeb62('0x9')]['where']:{};return db[_0xeb62('0x7')]['update'](_0x4f027c[_0xeb62('0x1c')],{'where':_0x63ce7a,'transaction':_0x599418})[_0xeb62('0x11')](function(_0x6a5da8){logger['info']('ResetActiveCalls',_0x4f027c);logger[_0xeb62('0x13')](_0xeb62('0x46'),_0x4f027c,JSON[_0xeb62('0x14')](_0x6a5da8));_0x2ba33b(_0x6a5da8);})['catch'](function(_0x2038b4){logger[_0xeb62('0x16')](_0xeb62('0x46'),_0x2038b4[_0xeb62('0x17')],_0x4f027c);_0x36b104(_0x53d4bb[_0xeb62('0x16')](0x1f4,_0x2038b4[_0xeb62('0x17')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x4cd599){var _0x5d0c09=this;var _0x23c6d7=_0x4cd599['body']['where'][_0xeb62('0x47')];var _0x49d2c7=_0x4cd599['body']['where'][_0xeb62('0x48')];var _0x5c48c8=_0x4cd599[_0xeb62('0x1c')][_0xeb62('0xb')][_0xeb62('0x49')];return new Promise(function(_0x75000c,_0x3380f4){return db[_0xeb62('0x7')][_0xeb62('0x8')]({'where':{'voiceQueueId':{'$in':_0x23c6d7},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0xeb62('0x4a')+_0x49d2c7+_0xeb62('0x4b')),'$gt':db[_0xeb62('0x37')][_0xeb62('0x39')](_0xeb62('0x4c'))}},'UserId':{'$in':_0x5c48c8}},'include':[{'model':db['CmContact'],'as':_0xeb62('0x25')},{'model':db[_0xeb62('0x27')],'as':_0xeb62('0x28'),'attributes':['id','name',_0xeb62('0x2a')]},{'model':db['CmList'],'as':_0xeb62('0x4d')}]})[_0xeb62('0x11')](function(_0x4ff08a){if(_0x4ff08a['length']>0x0){return db[_0xeb62('0x37')][_0xeb62('0x22')](function(_0x5611a6){return db[_0xeb62('0x7')]['update']({'recallmeNotifiedDate':db[_0xeb62('0x37')][_0xeb62('0x39')]('NOW()')},{'where':{'id':{'$in':_['map'](_0x4ff08a,'id')}},'transaction':_0x5611a6})[_0xeb62('0x11')](function(){_0x75000c(_0x4ff08a);})[_0xeb62('0x15')](function(_0x42b301){logger[_0xeb62('0x16')](_0xeb62('0x4e'),_0x42b301[_0xeb62('0x17')],_0x4cd599);_0x3380f4(_0x5d0c09[_0xeb62('0x16')](0x1f4,_0x42b301[_0xeb62('0x17')]));});})[_0xeb62('0x15')](function(_0x416ec7){logger[_0xeb62('0x16')](_0xeb62('0x4e'),_0x416ec7[_0xeb62('0x17')],_0x4cd599);_0x3380f4(_0x5d0c09[_0xeb62('0x16')](0x1f4,_0x416ec7[_0xeb62('0x17')]));});}else{_0x75000c(_0x4ff08a);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 6ac4052..89e5158 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 _0x37ff=['isAuthenticated','index','describe','/opencontacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','getTimezone','update','delete','destroy','exports','Router','../../components/auth/service','./cmHopper.controller','get'];(function(_0x50c09e,_0x1c4dbb){var _0x355565=function(_0x405cf6){while(--_0x405cf6){_0x50c09e['push'](_0x50c09e['shift']());}};_0x355565(++_0x1c4dbb);}(_0x37ff,0x104));var _0xf37f=function(_0x3d8240,_0x2663d4){_0x3d8240=_0x3d8240-0x0;var _0x3d0372=_0x37ff[_0x3d8240];return _0x3d0372;};'use strict';var express=require('express');var router=express[_0xf37f('0x0')]();var auth=require(_0xf37f('0x1'));var controller=require(_0xf37f('0x2'));router[_0xf37f('0x3')]('/',auth[_0xf37f('0x4')](),controller[_0xf37f('0x5')]);router[_0xf37f('0x3')]('/describe',auth[_0xf37f('0x4')](),controller[_0xf37f('0x6')]);router[_0xf37f('0x3')](_0xf37f('0x7'),auth[_0xf37f('0x4')](),controller['getOpenContacts']);router[_0xf37f('0x3')](_0xf37f('0x8'),auth[_0xf37f('0x4')](),controller[_0xf37f('0x9')]);router[_0xf37f('0x3')](_0xf37f('0xa'),auth[_0xf37f('0x4')](),controller[_0xf37f('0xb')]);router[_0xf37f('0x3')](_0xf37f('0xc'),auth[_0xf37f('0x4')](),controller[_0xf37f('0xd')]);router[_0xf37f('0xe')]('/',auth[_0xf37f('0x4')](),controller['create']);router[_0xf37f('0xe')](_0xf37f('0xf'),auth[_0xf37f('0x4')](),controller[_0xf37f('0x10')]);router['post']('/timezone',auth[_0xf37f('0x4')](),controller[_0xf37f('0x11')]);router['put']('/:id',auth[_0xf37f('0x4')](),controller[_0xf37f('0x12')]);router[_0xf37f('0x13')](_0xf37f('0xa'),auth[_0xf37f('0x4')](),controller[_0xf37f('0x14')]);module[_0xf37f('0x15')]=router; \ No newline at end of file +var _0xa22d=['getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','getTimezone','put','destroy','exports','express','Router','isAuthenticated','/describe','describe','get','/opencontacts'];(function(_0x466ae9,_0x162794){var _0x29e4b5=function(_0xed9ff0){while(--_0xed9ff0){_0x466ae9['push'](_0x466ae9['shift']());}};_0x29e4b5(++_0x162794);}(_0xa22d,0x1b2));var _0xda22=function(_0x1a7f06,_0x4ad73a){_0x1a7f06=_0x1a7f06-0x0;var _0x4663aa=_0xa22d[_0x1a7f06];return _0x4663aa;};'use strict';var express=require(_0xda22('0x0'));var router=express[_0xda22('0x1')]();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router['get']('/',auth[_0xda22('0x2')](),controller['index']);router['get'](_0xda22('0x3'),auth[_0xda22('0x2')](),controller[_0xda22('0x4')]);router[_0xda22('0x5')](_0xda22('0x6'),auth[_0xda22('0x2')](),controller[_0xda22('0x7')]);router[_0xda22('0x5')]('/timezones',auth[_0xda22('0x2')](),controller[_0xda22('0x8')]);router[_0xda22('0x5')](_0xda22('0x9'),auth[_0xda22('0x2')](),controller[_0xda22('0xa')]);router[_0xda22('0x5')](_0xda22('0xb'),auth[_0xda22('0x2')](),controller[_0xda22('0xc')]);router[_0xda22('0xd')]('/',auth['isAuthenticated'](),controller[_0xda22('0xe')]);router[_0xda22('0xd')](_0xda22('0xf'),auth[_0xda22('0x2')](),controller[_0xda22('0x10')]);router[_0xda22('0xd')]('/timezone',auth[_0xda22('0x2')](),controller[_0xda22('0x11')]);router[_0xda22('0x12')](_0xda22('0x9'),auth[_0xda22('0x2')](),controller['update']);router['delete'](_0xda22('0x9'),auth['isAuthenticated'](),controller[_0xda22('0x13')]);module[_0xda22('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 760ff2d..7c03a70 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 _0x79f1=['exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x402281,_0x359520){var _0xf36b29=function(_0x2ed9cb){while(--_0x2ed9cb){_0x402281['push'](_0x402281['shift']());}};_0xf36b29(++_0x359520);}(_0x79f1,0x156));var _0x179f=function(_0x3a07d4,_0xa80b88){_0x3a07d4=_0x3a07d4-0x0;var _0x2c352=_0x79f1[_0x3a07d4];return _0x2c352;};'use strict';var moment=require(_0x179f('0x0'));var Sequelize=require(_0x179f('0x1'));module[_0x179f('0x2')]={'CmHopperId':{'type':Sequelize[_0x179f('0x3')]},'phone':{'type':Sequelize[_0x179f('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x179f('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x179f('0x5')],'defaultValue':moment()[_0x179f('0x6')](_0x179f('0x7'))},'countbusyretry':{'type':Sequelize[_0x179f('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x179f('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x179f('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x179f('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x179f('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x179f('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbce5=['exports','INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x5930b2,_0x3e9417){var _0x58cc4b=function(_0x5543ac){while(--_0x5543ac){_0x5930b2['push'](_0x5930b2['shift']());}};_0x58cc4b(++_0x3e9417);}(_0xbce5,0xcc));var _0x5bce=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xbce5[_0x54d4fe];return _0x1ab5bb;};'use strict';var moment=require(_0x5bce('0x0'));var Sequelize=require('sequelize');module[_0x5bce('0x1')]={'CmHopperId':{'type':Sequelize[_0x5bce('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x5bce('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x5bce('0x3')],'defaultValue':moment()['format'](_0x5bce('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5bce('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5bce('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x5bce('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5bce('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5bce('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5bce('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 713ba52..a51b8d1 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 _0xb68b=['querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','then','destroy','UserProfileResource','error','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0xb68b,0x130));var _0xbb68=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xb68b[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0xbb68('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb68('0x1'));var jsonpatch=require(_0xbb68('0x2'));var rp=require(_0xbb68('0x3'));var moment=require(_0xbb68('0x4'));var BPromise=require(_0xbb68('0x5'));var Mustache=require(_0xbb68('0x6'));var util=require(_0xbb68('0x7'));var path=require(_0xbb68('0x8'));var sox=require(_0xbb68('0x9'));var csv=require(_0xbb68('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb68('0xb'));var _=require(_0xbb68('0xc'));var squel=require(_0xbb68('0xd'));var crypto=require(_0xbb68('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbb68('0xf'));var toCsv=require(_0xbb68('0xa'));var querystring=require(_0xbb68('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbb68('0x11'));var qs=require(_0xbb68('0x12'));var as=require(_0xbb68('0x13'));var hardwareService=require(_0xbb68('0x14'));var logger=require('../../config/logger')(_0xbb68('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbb68('0x16'));var db=require(_0xbb68('0x17'))['db'];function respondWithStatusCode(_0x4723b9,_0x17573c){_0x17573c=_0x17573c||0xcc;return function(_0x3c01fd){if(_0x3c01fd){return _0x4723b9[_0xbb68('0x18')](_0x17573c);}return _0x4723b9[_0xbb68('0x19')](_0x17573c)[_0xbb68('0x1a')]();};}function respondWithResult(_0x467294,_0x4b6e13){_0x4b6e13=_0x4b6e13||0xc8;return function(_0x338f29){if(_0x338f29){return _0x467294[_0xbb68('0x19')](_0x4b6e13)[_0xbb68('0x1b')](_0x338f29);}};}function respondWithFilteredResult(_0xfdcc3a,_0x3a0f95){return function(_0xad6418){if(_0xad6418){var _0x54d7d4=typeof _0x3a0f95[_0xbb68('0x1c')]===_0xbb68('0x1d')&&typeof _0x3a0f95[_0xbb68('0x1e')]===_0xbb68('0x1d');var _0x56c80d=_0xad6418['count'];var _0x444466=_0x54d7d4?0x0:_0x3a0f95[_0xbb68('0x1c')];var _0x320c11=_0x54d7d4?_0xad6418[_0xbb68('0x1f')]:_0x3a0f95[_0xbb68('0x1c')]+_0x3a0f95[_0xbb68('0x1e')];var _0x42df79;if(_0x320c11>=_0x56c80d){_0x320c11=_0x56c80d;_0x42df79=0xc8;}else{_0x42df79=0xce;}_0xfdcc3a[_0xbb68('0x19')](_0x42df79);return _0xfdcc3a[_0xbb68('0x20')]('Content-Range',_0x444466+'-'+_0x320c11+'/'+_0x56c80d)['json'](_0xad6418);}return null;};}function patchUpdates(_0x45b339){return function(_0x9e804f){try{jsonpatch['apply'](_0x9e804f,_0x45b339,!![]);}catch(_0x1ea6c3){return BPromise['reject'](_0x1ea6c3);}return _0x9e804f[_0xbb68('0x21')]();};}function saveUpdates(_0x466940,_0x29404e){return function(_0x101aa6){if(_0x101aa6){return _0x101aa6['update'](_0x466940)[_0xbb68('0x22')](function(_0x2219ac){return _0x2219ac;});}return null;};}function removeEntity(_0x26a738,_0x2c7a0f){return function(_0x4ae4a7){if(_0x4ae4a7){return _0x4ae4a7[_0xbb68('0x23')]()[_0xbb68('0x22')](function(){var _0x42d125=_0x4ae4a7['get']({'plain':!![]});var _0x4324d6='CmHopperAdditionalPhones';return db[_0xbb68('0x24')]['destroy']({'where':{'type':_0x4324d6,'resourceId':_0x42d125['id']}})['then'](function(){return _0x4ae4a7;});})[_0xbb68('0x22')](function(){_0x26a738[_0xbb68('0x19')](0xcc)[_0xbb68('0x1a')]();});}};}function handleEntityNotFound(_0x4c0878,_0xdbe8b7){return function(_0x2336fa){if(!_0x2336fa){_0x4c0878[_0xbb68('0x18')](0x194);}return _0x2336fa;};}function handleError(_0x2e5327,_0x50f96f){_0x50f96f=_0x50f96f||0x1f4;return function(_0x42f5de){logger[_0xbb68('0x25')](_0x42f5de[_0xbb68('0x26')]);if(_0x42f5de[_0xbb68('0x27')]){delete _0x42f5de[_0xbb68('0x27')];}_0x2e5327['status'](_0x50f96f)['send'](_0x42f5de);};}exports[_0xbb68('0x28')]=function(_0xfddc9b,_0x56412a){var _0x31ead4={},_0xc6dbd9={},_0x20734c={'count':0x0,'rows':[]};var _0x2851be=_[_0xbb68('0x29')](db[_0xbb68('0x2a')][_0xbb68('0x2b')],function(_0x199ac2){return{'name':_0x199ac2[_0xbb68('0x2c')],'type':_0x199ac2[_0xbb68('0x2d')][_0xbb68('0x2e')]};});_0xc6dbd9[_0xbb68('0x2f')]=_[_0xbb68('0x29')](_0x2851be,_0xbb68('0x27'));_0xc6dbd9['query']=_[_0xbb68('0x30')](_0xfddc9b[_0xbb68('0x31')]);_0xc6dbd9[_0xbb68('0x32')]=_[_0xbb68('0x33')](_0xc6dbd9[_0xbb68('0x2f')],_0xc6dbd9[_0xbb68('0x31')]);_0x31ead4[_0xbb68('0x34')]=_[_0xbb68('0x33')](_0xc6dbd9[_0xbb68('0x2f')],qs[_0xbb68('0x35')](_0xfddc9b['query'][_0xbb68('0x35')]));_0x31ead4[_0xbb68('0x34')]=_0x31ead4[_0xbb68('0x34')][_0xbb68('0x36')]?_0x31ead4['attributes']:_0xc6dbd9[_0xbb68('0x2f')];if(!_0xfddc9b[_0xbb68('0x31')][_0xbb68('0x37')](_0xbb68('0x38'))){_0x31ead4[_0xbb68('0x1e')]=qs[_0xbb68('0x1e')](_0xfddc9b['query'][_0xbb68('0x1e')]);_0x31ead4['offset']=qs[_0xbb68('0x1c')](_0xfddc9b[_0xbb68('0x31')]['offset']);}_0x31ead4['order']=qs['sort'](_0xfddc9b[_0xbb68('0x31')][_0xbb68('0x39')]);_0x31ead4['where']=qs['filters'](_[_0xbb68('0x3a')](_0xfddc9b[_0xbb68('0x31')],_0xc6dbd9[_0xbb68('0x32')]),_0x2851be);if(_0xfddc9b[_0xbb68('0x31')][_0xbb68('0x3b')]){_0x31ead4[_0xbb68('0x3c')]=_[_0xbb68('0x3d')](_0x31ead4[_0xbb68('0x3c')],{'$or':_['map'](_0x2851be,function(_0x31de7d){if(_0x31de7d[_0xbb68('0x2d')]!==_0xbb68('0x3e')){var _0x774e7e={};_0x774e7e[_0x31de7d[_0xbb68('0x27')]]={'$like':'%'+_0xfddc9b[_0xbb68('0x31')]['filter']+'%'};return _0x774e7e;}})});}_0x31ead4=_[_0xbb68('0x3d')]({},_0x31ead4,_0xfddc9b['options']);var _0x570b82={'where':_0x31ead4[_0xbb68('0x3c')]};return db[_0xbb68('0x2a')][_0xbb68('0x1f')](_0x570b82)[_0xbb68('0x22')](function(_0x21162e){_0x20734c[_0xbb68('0x1f')]=_0x21162e;if(_0xfddc9b[_0xbb68('0x31')][_0xbb68('0x3f')]){_0x31ead4[_0xbb68('0x40')]=[{'all':!![]}];}return db[_0xbb68('0x2a')][_0xbb68('0x41')](_0x31ead4);})[_0xbb68('0x22')](function(_0x5dce6e){_0x20734c[_0xbb68('0x42')]=_0x5dce6e;return _0x20734c;})[_0xbb68('0x22')](respondWithFilteredResult(_0x56412a,_0x31ead4))[_0xbb68('0x43')](handleError(_0x56412a,null));};exports['show']=function(_0x2d5c81,_0x4677fd){var _0x431b80={'raw':!![],'where':{'id':_0x2d5c81['params']['id']}},_0x346f05={};_0x346f05[_0xbb68('0x2f')]=_['keys'](db[_0xbb68('0x2a')][_0xbb68('0x2b')]);_0x346f05['query']=_['keys'](_0x2d5c81['query']);_0x346f05[_0xbb68('0x32')]=_[_0xbb68('0x33')](_0x346f05[_0xbb68('0x2f')],_0x346f05['query']);_0x431b80[_0xbb68('0x34')]=_[_0xbb68('0x33')](_0x346f05[_0xbb68('0x2f')],qs[_0xbb68('0x35')](_0x2d5c81['query']['fields']));_0x431b80['attributes']=_0x431b80[_0xbb68('0x34')]['length']?_0x431b80[_0xbb68('0x34')]:_0x346f05[_0xbb68('0x2f')];if(_0x2d5c81[_0xbb68('0x31')][_0xbb68('0x3f')]){_0x431b80[_0xbb68('0x40')]=[{'all':!![]}];}_0x431b80=_[_0xbb68('0x3d')]({},_0x431b80,_0x2d5c81[_0xbb68('0x44')]);return db['CmHopperAdditionalPhone'][_0xbb68('0x45')](_0x431b80)[_0xbb68('0x22')](handleEntityNotFound(_0x4677fd,null))[_0xbb68('0x22')](respondWithResult(_0x4677fd,null))[_0xbb68('0x43')](handleError(_0x4677fd,null));};exports[_0xbb68('0x46')]=function(_0x52060d,_0x427821){return db['CmHopperAdditionalPhone'][_0xbb68('0x46')](_0x52060d[_0xbb68('0x47')],{})[_0xbb68('0x22')](function(_0x371861){var _0x1967cc=_0x52060d['user']['get']({'plain':!![]});if(!_0x1967cc)throw new Error(_0xbb68('0x48'));if(_0x1967cc[_0xbb68('0x49')]===_0xbb68('0x4a')){var _0x134cbf=_0x371861['get']({'plain':!![]});var _0x30eb96='CmHopperAdditionalPhones';return db['UserProfileSection'][_0xbb68('0x45')]({'where':{'name':_0x30eb96,'userProfileId':_0x1967cc[_0xbb68('0x4b')]},'raw':!![]})[_0xbb68('0x22')](function(_0x499211){if(_0x499211&&_0x499211[_0xbb68('0x4c')]===0x0){return db[_0xbb68('0x24')][_0xbb68('0x46')]({'name':_0x134cbf[_0xbb68('0x27')],'resourceId':_0x134cbf['id'],'type':_0x499211[_0xbb68('0x27')],'sectionId':_0x499211['id']},{})[_0xbb68('0x22')](function(){return _0x371861;});}else{return _0x371861;}})[_0xbb68('0x43')](function(_0x5c7419){logger[_0xbb68('0x25')](_0xbb68('0x4d'),_0x5c7419);throw _0x5c7419;});}return _0x371861;})['then'](respondWithResult(_0x427821,0xc9))['catch'](handleError(_0x427821,null));};exports[_0xbb68('0x4e')]=function(_0x34b3e3,_0x442b76){if(_0x34b3e3['body']['id']){delete _0x34b3e3[_0xbb68('0x47')]['id'];}return db['CmHopperAdditionalPhone'][_0xbb68('0x45')]({'where':{'id':_0x34b3e3[_0xbb68('0x4f')]['id']}})[_0xbb68('0x22')](handleEntityNotFound(_0x442b76,null))[_0xbb68('0x22')](saveUpdates(_0x34b3e3[_0xbb68('0x47')],null))['then'](respondWithResult(_0x442b76,null))[_0xbb68('0x43')](handleError(_0x442b76,null));};exports['destroy']=function(_0x1cfb53,_0x3184fd){return db['CmHopperAdditionalPhone'][_0xbb68('0x45')]({'where':{'id':_0x1cfb53[_0xbb68('0x4f')]['id']}})[_0xbb68('0x22')](handleEntityNotFound(_0x3184fd,null))[_0xbb68('0x22')](removeEntity(_0x3184fd,null))[_0xbb68('0x43')](handleError(_0x3184fd,null));}; \ No newline at end of file +var _0x4293=['userProfileId','autoAssociation','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','CmHopperAdditionalPhone','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection'];(function(_0x23082a,_0x445d35){var _0x4be541=function(_0xb3f462){while(--_0xb3f462){_0x23082a['push'](_0x23082a['shift']());}};_0x4be541(++_0x445d35);}(_0x4293,0x199));var _0x3429=function(_0xff2f84,_0x5a0e90){_0xff2f84=_0xff2f84-0x0;var _0x397dfb=_0x4293[_0xff2f84];return _0x397dfb;};'use strict';var emlformat=require(_0x3429('0x0'));var rimraf=require(_0x3429('0x1'));var zipdir=require(_0x3429('0x2'));var jsonpatch=require(_0x3429('0x3'));var rp=require(_0x3429('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3429('0x5'));var util=require('util');var path=require(_0x3429('0x6'));var sox=require(_0x3429('0x7'));var csv=require(_0x3429('0x8'));var ejs=require(_0x3429('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3429('0xa'));var squel=require('squel');var crypto=require(_0x3429('0xb'));var jsforce=require(_0x3429('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3429('0x8'));var querystring=require(_0x3429('0xd'));var Papa=require('papaparse');var Redis=require(_0x3429('0xe'));var authService=require(_0x3429('0xf'));var qs=require(_0x3429('0x10'));var as=require(_0x3429('0x11'));var hardwareService=require(_0x3429('0x12'));var logger=require('../../config/logger')(_0x3429('0x13'));var utils=require(_0x3429('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3429('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23c1e6,_0xcec59a){_0xcec59a=_0xcec59a||0xcc;return function(_0x16ea50){if(_0x16ea50){return _0x23c1e6[_0x3429('0x16')](_0xcec59a);}return _0x23c1e6[_0x3429('0x17')](_0xcec59a)[_0x3429('0x18')]();};}function respondWithResult(_0x135983,_0x53c945){_0x53c945=_0x53c945||0xc8;return function(_0x38dcc5){if(_0x38dcc5){return _0x135983['status'](_0x53c945)['json'](_0x38dcc5);}};}function respondWithFilteredResult(_0x261e46,_0x515696){return function(_0x5d319){if(_0x5d319){var _0x2c8321=typeof _0x515696[_0x3429('0x19')]===_0x3429('0x1a')&&typeof _0x515696['limit']===_0x3429('0x1a');var _0x18fd03=_0x5d319[_0x3429('0x1b')];var _0x37fd6f=_0x2c8321?0x0:_0x515696[_0x3429('0x19')];var _0xb1ba11=_0x2c8321?_0x5d319[_0x3429('0x1b')]:_0x515696[_0x3429('0x19')]+_0x515696[_0x3429('0x1c')];var _0x18d738;if(_0xb1ba11>=_0x18fd03){_0xb1ba11=_0x18fd03;_0x18d738=0xc8;}else{_0x18d738=0xce;}_0x261e46[_0x3429('0x17')](_0x18d738);return _0x261e46[_0x3429('0x1d')](_0x3429('0x1e'),_0x37fd6f+'-'+_0xb1ba11+'/'+_0x18fd03)['json'](_0x5d319);}return null;};}function patchUpdates(_0x25a0ed){return function(_0x111161){try{jsonpatch[_0x3429('0x1f')](_0x111161,_0x25a0ed,!![]);}catch(_0x35ef48){return BPromise['reject'](_0x35ef48);}return _0x111161[_0x3429('0x20')]();};}function saveUpdates(_0x45340d,_0x22403f){return function(_0x2f121a){if(_0x2f121a){return _0x2f121a['update'](_0x45340d)['then'](function(_0x3d1075){return _0x3d1075;});}return null;};}function removeEntity(_0x2d0917,_0xe25049){return function(_0x19b76e){if(_0x19b76e){return _0x19b76e[_0x3429('0x21')]()[_0x3429('0x22')](function(){var _0x257178=_0x19b76e[_0x3429('0x23')]({'plain':!![]});var _0x3a40b6=_0x3429('0x24');return db[_0x3429('0x25')]['destroy']({'where':{'type':_0x3a40b6,'resourceId':_0x257178['id']}})[_0x3429('0x22')](function(){return _0x19b76e;});})[_0x3429('0x22')](function(){_0x2d0917[_0x3429('0x17')](0xcc)[_0x3429('0x18')]();});}};}function handleEntityNotFound(_0xb5b696,_0x3add70){return function(_0x59c467){if(!_0x59c467){_0xb5b696[_0x3429('0x16')](0x194);}return _0x59c467;};}function handleError(_0x4226da,_0x259f20){_0x259f20=_0x259f20||0x1f4;return function(_0x4d904a){logger[_0x3429('0x26')](_0x4d904a[_0x3429('0x27')]);if(_0x4d904a[_0x3429('0x28')]){delete _0x4d904a[_0x3429('0x28')];}_0x4226da[_0x3429('0x17')](_0x259f20)[_0x3429('0x29')](_0x4d904a);};}exports['index']=function(_0x293cae,_0x4ca254){var _0x527b1b={},_0x537785={},_0x7696a0={'count':0x0,'rows':[]};var _0x4e5f7a=_['map'](db[_0x3429('0x2a')]['rawAttributes'],function(_0x4cede8){return{'name':_0x4cede8['fieldName'],'type':_0x4cede8[_0x3429('0x2b')][_0x3429('0x2c')]};});_0x537785[_0x3429('0x2d')]=_[_0x3429('0x2e')](_0x4e5f7a,'name');_0x537785[_0x3429('0x2f')]=_[_0x3429('0x30')](_0x293cae[_0x3429('0x2f')]);_0x537785['filters']=_[_0x3429('0x31')](_0x537785[_0x3429('0x2d')],_0x537785['query']);_0x527b1b[_0x3429('0x32')]=_['intersection'](_0x537785[_0x3429('0x2d')],qs[_0x3429('0x33')](_0x293cae['query'][_0x3429('0x33')]));_0x527b1b[_0x3429('0x32')]=_0x527b1b[_0x3429('0x32')][_0x3429('0x34')]?_0x527b1b[_0x3429('0x32')]:_0x537785[_0x3429('0x2d')];if(!_0x293cae[_0x3429('0x2f')][_0x3429('0x35')]('nolimit')){_0x527b1b[_0x3429('0x1c')]=qs[_0x3429('0x1c')](_0x293cae['query'][_0x3429('0x1c')]);_0x527b1b[_0x3429('0x19')]=qs[_0x3429('0x19')](_0x293cae['query'][_0x3429('0x19')]);}_0x527b1b[_0x3429('0x36')]=qs[_0x3429('0x37')](_0x293cae[_0x3429('0x2f')][_0x3429('0x37')]);_0x527b1b[_0x3429('0x38')]=qs[_0x3429('0x39')](_[_0x3429('0x3a')](_0x293cae['query'],_0x537785[_0x3429('0x39')]),_0x4e5f7a);if(_0x293cae[_0x3429('0x2f')][_0x3429('0x3b')]){_0x527b1b[_0x3429('0x38')]=_[_0x3429('0x3c')](_0x527b1b['where'],{'$or':_[_0x3429('0x2e')](_0x4e5f7a,function(_0xbde581){if(_0xbde581[_0x3429('0x2b')]!==_0x3429('0x3d')){var _0x3b4f13={};_0x3b4f13[_0xbde581[_0x3429('0x28')]]={'$like':'%'+_0x293cae[_0x3429('0x2f')][_0x3429('0x3b')]+'%'};return _0x3b4f13;}})});}_0x527b1b=_[_0x3429('0x3c')]({},_0x527b1b,_0x293cae[_0x3429('0x3e')]);var _0x50b993={'where':_0x527b1b[_0x3429('0x38')]};return db[_0x3429('0x2a')]['count'](_0x50b993)[_0x3429('0x22')](function(_0x1f90f8){_0x7696a0[_0x3429('0x1b')]=_0x1f90f8;if(_0x293cae[_0x3429('0x2f')][_0x3429('0x3f')]){_0x527b1b[_0x3429('0x40')]=[{'all':!![]}];}return db[_0x3429('0x2a')][_0x3429('0x41')](_0x527b1b);})[_0x3429('0x22')](function(_0x30a745){_0x7696a0[_0x3429('0x42')]=_0x30a745;return _0x7696a0;})[_0x3429('0x22')](respondWithFilteredResult(_0x4ca254,_0x527b1b))['catch'](handleError(_0x4ca254,null));};exports[_0x3429('0x43')]=function(_0x2fd611,_0x599c17){var _0x2de74c={'raw':!![],'where':{'id':_0x2fd611[_0x3429('0x44')]['id']}},_0x4eea09={};_0x4eea09[_0x3429('0x2d')]=_['keys'](db['CmHopperAdditionalPhone'][_0x3429('0x45')]);_0x4eea09[_0x3429('0x2f')]=_[_0x3429('0x30')](_0x2fd611[_0x3429('0x2f')]);_0x4eea09[_0x3429('0x39')]=_[_0x3429('0x31')](_0x4eea09['model'],_0x4eea09[_0x3429('0x2f')]);_0x2de74c[_0x3429('0x32')]=_[_0x3429('0x31')](_0x4eea09[_0x3429('0x2d')],qs['fields'](_0x2fd611[_0x3429('0x2f')][_0x3429('0x33')]));_0x2de74c[_0x3429('0x32')]=_0x2de74c[_0x3429('0x32')]['length']?_0x2de74c[_0x3429('0x32')]:_0x4eea09[_0x3429('0x2d')];if(_0x2fd611[_0x3429('0x2f')][_0x3429('0x3f')]){_0x2de74c['include']=[{'all':!![]}];}_0x2de74c=_[_0x3429('0x3c')]({},_0x2de74c,_0x2fd611[_0x3429('0x3e')]);return db[_0x3429('0x2a')][_0x3429('0x46')](_0x2de74c)[_0x3429('0x22')](handleEntityNotFound(_0x599c17,null))['then'](respondWithResult(_0x599c17,null))[_0x3429('0x47')](handleError(_0x599c17,null));};exports[_0x3429('0x48')]=function(_0x4f63ce,_0x1c24d5){return db['CmHopperAdditionalPhone']['create'](_0x4f63ce['body'],{})['then'](function(_0x1a8062){var _0x292394=_0x4f63ce['user'][_0x3429('0x23')]({'plain':!![]});if(!_0x292394)throw new Error(_0x3429('0x49'));if(_0x292394[_0x3429('0x4a')]===_0x3429('0x4b')){var _0x17a2f7=_0x1a8062[_0x3429('0x23')]({'plain':!![]});var _0x5a4f54=_0x3429('0x24');return db[_0x3429('0x4c')][_0x3429('0x46')]({'where':{'name':_0x5a4f54,'userProfileId':_0x292394[_0x3429('0x4d')]},'raw':!![]})[_0x3429('0x22')](function(_0x15ffe7){if(_0x15ffe7&&_0x15ffe7[_0x3429('0x4e')]===0x0){return db[_0x3429('0x25')][_0x3429('0x48')]({'name':_0x17a2f7['name'],'resourceId':_0x17a2f7['id'],'type':_0x15ffe7['name'],'sectionId':_0x15ffe7['id']},{})[_0x3429('0x22')](function(){return _0x1a8062;});}else{return _0x1a8062;}})[_0x3429('0x47')](function(_0x50bb19){logger[_0x3429('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50bb19);throw _0x50bb19;});}return _0x1a8062;})[_0x3429('0x22')](respondWithResult(_0x1c24d5,0xc9))['catch'](handleError(_0x1c24d5,null));};exports[_0x3429('0x4f')]=function(_0xf04eb0,_0x1b97bd){if(_0xf04eb0[_0x3429('0x50')]['id']){delete _0xf04eb0[_0x3429('0x50')]['id'];}return db[_0x3429('0x2a')]['find']({'where':{'id':_0xf04eb0[_0x3429('0x44')]['id']}})[_0x3429('0x22')](handleEntityNotFound(_0x1b97bd,null))[_0x3429('0x22')](saveUpdates(_0xf04eb0['body'],null))[_0x3429('0x22')](respondWithResult(_0x1b97bd,null))[_0x3429('0x47')](handleError(_0x1b97bd,null));};exports[_0x3429('0x21')]=function(_0x34fc3f,_0x4165d3){return db[_0x3429('0x2a')][_0x3429('0x46')]({'where':{'id':_0x34fc3f[_0x3429('0x44')]['id']}})[_0x3429('0x22')](handleEntityNotFound(_0x4165d3,null))[_0x3429('0x22')](removeEntity(_0x4165d3,null))['catch'](handleError(_0x4165d3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 416acc6..ae09e21 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 _0xb2cf=['request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2cf,0x10c));var _0xfb2c=function(_0x7ed187,_0x336b60){_0x7ed187=_0x7ed187-0x0;var _0x3a2f18=_0xb2cf[_0x7ed187];return _0x3a2f18;};'use strict';var _=require(_0xfb2c('0x0'));var util=require(_0xfb2c('0x1'));var logger=require(_0xfb2c('0x2'))(_0xfb2c('0x3'));var moment=require(_0xfb2c('0x4'));var BPromise=require('bluebird');var rp=require(_0xfb2c('0x5'));var fs=require('fs');var path=require(_0xfb2c('0x6'));var rimraf=require('rimraf');var config=require(_0xfb2c('0x7'));var attributes=require(_0xfb2c('0x8'));module[_0xfb2c('0x9')]=function(_0x25fabe,_0xf7c813){return _0x25fabe[_0xfb2c('0xa')](_0xfb2c('0xb'),attributes,{'tableName':_0xfb2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9c5=['./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','../../config/logger','api','request-promise'];(function(_0x38ff6c,_0x3b8e2b){var _0x1ee0c1=function(_0x10533d){while(--_0x10533d){_0x38ff6c['push'](_0x38ff6c['shift']());}};_0x1ee0c1(++_0x3b8e2b);}(_0xd9c5,0x115));var _0x5d9c=function(_0x209de0,_0x241d00){_0x209de0=_0x209de0-0x0;var _0x5d86b2=_0xd9c5[_0x209de0];return _0x5d86b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5d9c('0x0'))(_0x5d9c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5d9c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5d9c('0x3'));module[_0x5d9c('0x4')]=function(_0x104ccf,_0x18149d){return _0x104ccf[_0x5d9c('0x5')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x5d9c('0x6'),'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 2239793..586c58d 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 _0xf990=['countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnosuchnumberretry','SwapAdditionalPhones','duration','waitTime','VerifyAdditionalPhones','isNil','scheduledat','add','minutes','phone','countmachineretry','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry'];(function(_0x4d36a4,_0x303dd0){var _0x8d4548=function(_0x295887){while(--_0x295887){_0x4d36a4['push'](_0x4d36a4['shift']());}};_0x8d4548(++_0x303dd0);}(_0xf990,0x87));var _0x0f99=function(_0x479188,_0x505a1c){_0x479188=_0x479188-0x0;var _0x466b0d=_0xf990[_0x479188];return _0x466b0d;};'use strict';var _=require(_0x0f99('0x0'));var util=require('util');var moment=require(_0x0f99('0x1'));var BPromise=require(_0x0f99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f99('0x3'));var db=require(_0x0f99('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f99('0x5'))(_0x0f99('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f99('0x7'));var client=jayson[_0x0f99('0x8')][_0x0f99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43c4aa,_0x5581b7,_0x56ac4c){return new BPromise(function(_0x166219,_0x4365a3){return client[_0x0f99('0xa')](_0x43c4aa,_0x56ac4c)[_0x0f99('0xb')](function(_0x4deab6){logger[_0x0f99('0xc')](_0x0f99('0xd'),_0x5581b7,_0x0f99('0xe'));logger[_0x0f99('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x5581b7,_0x0f99('0xe'),JSON[_0x0f99('0x10')](_0x4deab6));if(_0x4deab6[_0x0f99('0x11')]){if(_0x4deab6[_0x0f99('0x11')]['code']===0x1f4){logger['error'](_0x0f99('0xd'),_0x5581b7,_0x4deab6[_0x0f99('0x11')][_0x0f99('0x12')]);return _0x4365a3(_0x4deab6[_0x0f99('0x11')][_0x0f99('0x12')]);}logger[_0x0f99('0x11')](_0x0f99('0xd'),_0x5581b7,_0x4deab6[_0x0f99('0x11')]['message']);return _0x166219(_0x4deab6[_0x0f99('0x11')]['message']);}else{logger['info'](_0x0f99('0xd'),_0x5581b7,_0x0f99('0xe'));_0x166219(_0x4deab6[_0x0f99('0x13')][_0x0f99('0x12')]);}})[_0x0f99('0x14')](function(_0x495117){logger[_0x0f99('0x11')](_0x0f99('0xd'),_0x5581b7,_0x495117);_0x4365a3(_0x495117);});});}exports['VerifyAdditionalPhones']=function(_0x382024){var _0x10c85b=this;return new Promise(function(_0x7ffaa1,_0x26ce1f){return db[_0x0f99('0x15')][_0x0f99('0x16')]({'raw':!![],'where':{'ContactId':_0x382024[_0x0f99('0x17')][_0x0f99('0x18')],'ListId':_0x382024[_0x0f99('0x17')][_0x0f99('0x19')],'VoiceQueueId':_0x382024['body'][_0x0f99('0x1a')]===undefined?null:_0x382024[_0x0f99('0x17')][_0x0f99('0x1a')],'CampaignId':_0x382024['body']['CampaignId']===undefined?null:_0x382024[_0x0f99('0x17')][_0x0f99('0x1b')]}})['then'](function(_0x2821b3){if(_0x2821b3!=null){return db[_0x0f99('0x1c')][_0x0f99('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2821b3['id'],'OrderBy':{'$gt':_0x2821b3['OrderBy']}},'order':[[_0x0f99('0x1d'),_0x0f99('0x1e')]]})[_0x0f99('0xb')](function(_0x220402){var _0x442d7e=0x0;if(_0x220402){if(_0x220402[_0x0f99('0x1f')]+_0x220402[_0x0f99('0x20')]+_0x220402[_0x0f99('0x21')]+_0x220402['countnosuchnumberretry']+_0x220402[_0x0f99('0x22')]+_0x220402[_0x0f99('0x23')]+_0x220402['countmachineretry']+_0x220402[_0x0f99('0x24')]<_0x382024[_0x0f99('0x25')][_0x0f99('0x26')])_0x442d7e=0x1;_0x7ffaa1({'additional':_0x442d7e});}else{return db[_0x0f99('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x2821b3['id']},'order':[['OrderBy',_0x0f99('0x1e')]]})[_0x0f99('0xb')](function(_0x20779c){var _0x32eb8d=0x0;if(_0x20779c){if(_0x20779c['countbusyretry']+_0x20779c[_0x0f99('0x20')]+_0x20779c[_0x0f99('0x21')]+_0x20779c[_0x0f99('0x27')]+_0x20779c['countdropretry']+_0x20779c[_0x0f99('0x23')]+_0x20779c['countmachineretry']+_0x20779c['countagentrejectretry']<_0x382024[_0x0f99('0x25')]['dialGlobalMaxRetry'])_0x32eb8d=0x1;_0x7ffaa1({'additional':_0x32eb8d});}else{_0x7ffaa1({'additional':0x0});}})['catch'](function(_0x22dd4b){logger[_0x0f99('0x11')]('VerifyAdditionalPhones',_0x22dd4b[_0x0f99('0x12')]);_0x26ce1f(_0x10c85b[_0x0f99('0x11')](0x1f4,_0x22dd4b[_0x0f99('0x12')]));});}})[_0x0f99('0x14')](function(_0x42e263){logger[_0x0f99('0x11')]('VerifyAdditionalPhones',_0x42e263['message']);_0x26ce1f(_0x10c85b[_0x0f99('0x11')](0x1f4,_0x42e263[_0x0f99('0x12')]));});}else _0x7ffaa1({'additional':0x0});});});};exports[_0x0f99('0x28')]=function(_0x5ea537){var _0x1ced44=this;return new Promise(function(_0x3e35f9,_0x1d938d){return db[_0x0f99('0x15')][_0x0f99('0x16')]({'raw':!![],'where':{'ContactId':_0x5ea537[_0x0f99('0x17')][_0x0f99('0x18')],'ListId':_0x5ea537[_0x0f99('0x17')][_0x0f99('0x19')],'VoiceQueueId':_0x5ea537[_0x0f99('0x17')][_0x0f99('0x1a')]===undefined?null:_0x5ea537[_0x0f99('0x17')][_0x0f99('0x1a')],'CampaignId':_0x5ea537[_0x0f99('0x17')][_0x0f99('0x1b')]===undefined?null:_0x5ea537['body'][_0x0f99('0x1b')]}})[_0x0f99('0xb')](function(_0x2c5034){if(_0x2c5034!=null){return db[_0x0f99('0x1c')][_0x0f99('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2c5034['id'],'OrderBy':{'$gte':_0x2c5034[_0x0f99('0x1d')]}},'order':[[_0x0f99('0x1d'),_0x0f99('0x1e')]]})[_0x0f99('0xb')](function(_0x32b6b5){if(_0x32b6b5)return activateAdditionalPhone(_0x2c5034,_0x5ea537[_0x0f99('0x17')],_0x32b6b5,_0x5ea537[_0x0f99('0x29')],_0x5ea537[_0x0f99('0x2a')])['then'](function(_0x20c9f9){_0x3e35f9(_0x20c9f9);});else{return db[_0x0f99('0x1c')][_0x0f99('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2c5034['id']},'order':[['OrderBy',_0x0f99('0x1e')]]})[_0x0f99('0xb')](function(_0xe81acc){if(_0xe81acc)return activateAdditionalPhone(_0x2c5034,_0x5ea537[_0x0f99('0x17')],_0xe81acc,_0x5ea537[_0x0f99('0x29')],_0x5ea537[_0x0f99('0x2a')])[_0x0f99('0xb')](function(_0x5145df){_0x3e35f9(_0x5145df);});else{_0x3e35f9({'id':_0x2c5034['id'],'phone':''});}})['catch'](function(_0x1d33a5){logger[_0x0f99('0x11')]('VerifyAdditionalPhones',_0x1d33a5[_0x0f99('0x12')]);_0x1d938d(_0x1ced44[_0x0f99('0x11')](0x1f4,_0x1d33a5[_0x0f99('0x12')]));});}})[_0x0f99('0x14')](function(_0x2730fd){logger['error'](_0x0f99('0x2b'),_0x2730fd[_0x0f99('0x12')]);_0x1d938d(_0x1ced44[_0x0f99('0x11')](0x1f4,_0x2730fd[_0x0f99('0x12')]));});}else _0x3e35f9(0x1);});});};function activateAdditionalPhone(_0xbb5c83,_0x102d23,_0x417666,_0x506a77,_0x584823){return new Promise(function(_0x5b4516,_0x13e916){var _0x2fc4e8;if(_[_0x0f99('0x2c')](_0x417666[_0x0f99('0x2d')])){_0x417666['scheduledat']=moment();}if(moment()>moment(_0x417666[_0x0f99('0x2d')])){_0x2fc4e8=moment()[_0x0f99('0x2e')](_0x584823||0x3,_0x0f99('0x2f'));}else{if(_0x417666[_0x0f99('0x1d')]==0x0){_0x2fc4e8=moment(_0x417666[_0x0f99('0x2d')]);}else{_0x2fc4e8=moment()[_0x0f99('0x2e')](_0x584823||0x3,'minutes');}}if(_[_0x0f99('0x2c')](_0x2fc4e8)){_0x2fc4e8=moment()[_0x0f99('0x2e')](_0x584823||0x3,_0x0f99('0x2f'));}var _0x2dbb61={'phone':_0xbb5c83[_0x0f99('0x30')],'active':0x0,'OrderBy':_[_0x0f99('0x2c')](_0xbb5c83[_0x0f99('0x1d')])?0x0:_0xbb5c83[_0x0f99('0x1d')],'scheduledat':moment()[_0x0f99('0x2e')](_0x506a77||0x1,_0x0f99('0x2f')),'countbusyretry':_0x102d23['countbusyretry'],'countcongestionretry':_0x102d23[_0x0f99('0x20')],'countnoanswerretry':_0x102d23[_0x0f99('0x21')],'countnosuchnumberretry':_0x102d23[_0x0f99('0x27')],'countdropretry':_0x102d23[_0x0f99('0x22')],'countabandonedretry':_0x102d23[_0x0f99('0x23')],'countmachineretry':_0x102d23[_0x0f99('0x31')],'countagentrejectretry':_0x102d23[_0x0f99('0x24')],'createdAt':_0x102d23[_0x0f99('0x32')],'updatedAt':_0x102d23[_0x0f99('0x33')]};var _0x325db9={'CmHopperId':_0xbb5c83['id'],'phone':_0x417666[_0x0f99('0x30')],'active':0x0,'OrderBy':_[_0x0f99('0x2c')](_0x417666['OrderBy'])?0x0:_0x417666[_0x0f99('0x1d')],'scheduledat':_0x2fc4e8,'countbusyretry':_0x417666[_0x0f99('0x1f')],'countcongestionretry':_0x417666[_0x0f99('0x20')],'countnoanswerretry':_0x417666['countnoanswerretry'],'countnosuchnumberretry':_0x417666[_0x0f99('0x27')],'countdropretry':_0x417666[_0x0f99('0x22')],'countabandonedretry':_0x417666[_0x0f99('0x23')],'countmachineretry':_0x417666[_0x0f99('0x31')],'countagentrejectretry':_0x417666[_0x0f99('0x24')],'createdAt':_0x417666[_0x0f99('0x32')],'updatedAt':_0x417666[_0x0f99('0x33')]};return db[_0x0f99('0x34')]['transaction'](function(_0x92ca65){return db[_0x0f99('0x1c')][_0x0f99('0x35')](_0x2dbb61,{'where':{'id':_0x417666['id']}},{'transaction':_0x92ca65})[_0x0f99('0xb')](function(){return db[_0x0f99('0x15')][_0x0f99('0x35')](_0x325db9,{'where':{'id':_0xbb5c83['id']}},{'transaction':_0x92ca65});});})[_0x0f99('0xb')](function(_0x3b496b){_0x5b4516({'id':_0xbb5c83['id'],'phone':_0x417666['phone']});})['catch'](function(_0x428dc5){logger[_0x0f99('0x11')](_0x0f99('0x36'),_0x428dc5[_0x0f99('0x12')]);_0x13e916({'error':_0x428dc5[_0x0f99('0x12')]});});});}exports[_0x0f99('0x37')]=function(_0x4e12b7){var _0x35d2b6=this;return new Promise(function(_0xf5d47e,_0x27354d){return db[_0x0f99('0x15')]['update'](_0x4e12b7[_0x0f99('0x17')]['field'],{'where':{'id':_0x4e12b7[_0x0f99('0x17')]['id']}})['then'](function(_0x2728c4){_0xf5d47e(_0x2728c4);})[_0x0f99('0x14')](function(_0x5b2a3f){logger['error']('IncrementPreviewCounters',_0x5b2a3f['message']);_0x27354d(_0x35d2b6['error'](0x1f4,_0x5b2a3f[_0x0f99('0x12')]));});});}; \ No newline at end of file +var _0x7529=['body','ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','CmHopperAdditionalPhone','countnosuchnumberretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','sequelize','transaction','activateAdditionalPhone','IncrementPreviewCounters','CmHopper','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','result','catch','VerifyAdditionalPhones','findOne'];(function(_0x5d180a,_0x403fba){var _0x3089eb=function(_0x4d76bd){while(--_0x4d76bd){_0x5d180a['push'](_0x5d180a['shift']());}};_0x3089eb(++_0x403fba);}(_0x7529,0x1c6));var _0x9752=function(_0x296982,_0x4c309f){_0x296982=_0x296982-0x0;var _0x1faafb=_0x7529[_0x296982];return _0x1faafb;};'use strict';var _=require(_0x9752('0x0'));var util=require(_0x9752('0x1'));var moment=require(_0x9752('0x2'));var BPromise=require(_0x9752('0x3'));var rs=require(_0x9752('0x4'));var fs=require('fs');var Redis=require(_0x9752('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9752('0x6'));var logger=require(_0x9752('0x7'))(_0x9752('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9752('0x9')][_0x9752('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x270062,_0x3d95e4,_0x1d4276){return new BPromise(function(_0x1157a4,_0x2f5f21){return client[_0x9752('0xb')](_0x270062,_0x1d4276)[_0x9752('0xc')](function(_0x4a0dbb){logger[_0x9752('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3d95e4,'request\x20sent');logger[_0x9752('0xe')](_0x9752('0xf'),_0x3d95e4,_0x9752('0x10'),JSON[_0x9752('0x11')](_0x4a0dbb));if(_0x4a0dbb[_0x9752('0x12')]){if(_0x4a0dbb[_0x9752('0x12')][_0x9752('0x13')]===0x1f4){logger[_0x9752('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3d95e4,_0x4a0dbb['error']['message']);return _0x2f5f21(_0x4a0dbb[_0x9752('0x12')][_0x9752('0x14')]);}logger[_0x9752('0x12')](_0x9752('0x15'),_0x3d95e4,_0x4a0dbb[_0x9752('0x12')][_0x9752('0x14')]);return _0x1157a4(_0x4a0dbb[_0x9752('0x12')][_0x9752('0x14')]);}else{logger[_0x9752('0xd')](_0x9752('0x15'),_0x3d95e4,_0x9752('0x10'));_0x1157a4(_0x4a0dbb[_0x9752('0x16')][_0x9752('0x14')]);}})[_0x9752('0x17')](function(_0x1e077d){logger[_0x9752('0x12')](_0x9752('0x15'),_0x3d95e4,_0x1e077d);_0x2f5f21(_0x1e077d);});});}exports[_0x9752('0x18')]=function(_0x5f573a){var _0x5d8ecf=this;return new Promise(function(_0x6de83a,_0x4cab0e){return db['CmHopper'][_0x9752('0x19')]({'raw':!![],'where':{'ContactId':_0x5f573a[_0x9752('0x1a')][_0x9752('0x1b')],'ListId':_0x5f573a[_0x9752('0x1a')][_0x9752('0x1c')],'VoiceQueueId':_0x5f573a[_0x9752('0x1a')]['VoiceQueueId']===undefined?null:_0x5f573a[_0x9752('0x1a')][_0x9752('0x1d')],'CampaignId':_0x5f573a['body']['CampaignId']===undefined?null:_0x5f573a[_0x9752('0x1a')][_0x9752('0x1e')]}})[_0x9752('0xc')](function(_0x3834a3){if(_0x3834a3!=null){return db['CmHopperAdditionalPhone'][_0x9752('0x19')]({'raw':!![],'where':{'CmHopperId':_0x3834a3['id'],'OrderBy':{'$gt':_0x3834a3[_0x9752('0x1f')]}},'order':[[_0x9752('0x1f'),_0x9752('0x20')]]})[_0x9752('0xc')](function(_0x88f3a5){var _0x47f24d=0x0;if(_0x88f3a5){if(_0x88f3a5[_0x9752('0x21')]+_0x88f3a5[_0x9752('0x22')]+_0x88f3a5[_0x9752('0x23')]+_0x88f3a5['countnosuchnumberretry']+_0x88f3a5[_0x9752('0x24')]+_0x88f3a5[_0x9752('0x25')]+_0x88f3a5[_0x9752('0x26')]+_0x88f3a5[_0x9752('0x27')]<_0x5f573a['entity']['dialGlobalMaxRetry'])_0x47f24d=0x1;_0x6de83a({'additional':_0x47f24d});}else{return db[_0x9752('0x28')][_0x9752('0x19')]({'raw':!![],'where':{'CmHopperId':_0x3834a3['id']},'order':[['OrderBy',_0x9752('0x20')]]})[_0x9752('0xc')](function(_0x1f9bf1){var _0x10190c=0x0;if(_0x1f9bf1){if(_0x1f9bf1['countbusyretry']+_0x1f9bf1[_0x9752('0x22')]+_0x1f9bf1[_0x9752('0x23')]+_0x1f9bf1[_0x9752('0x29')]+_0x1f9bf1[_0x9752('0x24')]+_0x1f9bf1[_0x9752('0x25')]+_0x1f9bf1[_0x9752('0x26')]+_0x1f9bf1[_0x9752('0x27')]<_0x5f573a[_0x9752('0x2a')][_0x9752('0x2b')])_0x10190c=0x1;_0x6de83a({'additional':_0x10190c});}else{_0x6de83a({'additional':0x0});}})[_0x9752('0x17')](function(_0x15aad5){logger[_0x9752('0x12')](_0x9752('0x18'),_0x15aad5[_0x9752('0x14')]);_0x4cab0e(_0x5d8ecf[_0x9752('0x12')](0x1f4,_0x15aad5[_0x9752('0x14')]));});}})[_0x9752('0x17')](function(_0x4c3745){logger[_0x9752('0x12')]('VerifyAdditionalPhones',_0x4c3745[_0x9752('0x14')]);_0x4cab0e(_0x5d8ecf['error'](0x1f4,_0x4c3745[_0x9752('0x14')]));});}else _0x6de83a({'additional':0x0});});});};exports[_0x9752('0x2c')]=function(_0x324dbe){var _0x1cd208=this;return new Promise(function(_0x1cc408,_0x5a33b4){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x324dbe['body']['ContactId'],'ListId':_0x324dbe[_0x9752('0x1a')][_0x9752('0x1c')],'VoiceQueueId':_0x324dbe[_0x9752('0x1a')]['VoiceQueueId']===undefined?null:_0x324dbe[_0x9752('0x1a')][_0x9752('0x1d')],'CampaignId':_0x324dbe['body'][_0x9752('0x1e')]===undefined?null:_0x324dbe[_0x9752('0x1a')][_0x9752('0x1e')]}})[_0x9752('0xc')](function(_0x3fcebd){if(_0x3fcebd!=null){return db[_0x9752('0x28')][_0x9752('0x19')]({'raw':!![],'where':{'CmHopperId':_0x3fcebd['id'],'OrderBy':{'$gte':_0x3fcebd['OrderBy']}},'order':[[_0x9752('0x1f'),_0x9752('0x20')]]})[_0x9752('0xc')](function(_0x1952d6){if(_0x1952d6)return activateAdditionalPhone(_0x3fcebd,_0x324dbe[_0x9752('0x1a')],_0x1952d6,_0x324dbe[_0x9752('0x2d')],_0x324dbe[_0x9752('0x2e')])[_0x9752('0xc')](function(_0x407b6f){_0x1cc408(_0x407b6f);});else{return db[_0x9752('0x28')][_0x9752('0x19')]({'raw':!![],'where':{'CmHopperId':_0x3fcebd['id']},'order':[['OrderBy',_0x9752('0x20')]]})[_0x9752('0xc')](function(_0x5ce0b3){if(_0x5ce0b3)return activateAdditionalPhone(_0x3fcebd,_0x324dbe['body'],_0x5ce0b3,_0x324dbe['duration'],_0x324dbe[_0x9752('0x2e')])[_0x9752('0xc')](function(_0x1a448e){_0x1cc408(_0x1a448e);});else{_0x1cc408({'id':_0x3fcebd['id'],'phone':''});}})[_0x9752('0x17')](function(_0xc4b690){logger[_0x9752('0x12')](_0x9752('0x18'),_0xc4b690[_0x9752('0x14')]);_0x5a33b4(_0x1cd208['error'](0x1f4,_0xc4b690['message']));});}})['catch'](function(_0x359f60){logger[_0x9752('0x12')](_0x9752('0x18'),_0x359f60[_0x9752('0x14')]);_0x5a33b4(_0x1cd208['error'](0x1f4,_0x359f60['message']));});}else _0x1cc408(0x1);});});};function activateAdditionalPhone(_0x2fd6d4,_0x205eb2,_0x16a143,_0x3d25a6,_0x49760e){return new Promise(function(_0x3008c7,_0x2bdff6){var _0x5c0685;if(_[_0x9752('0x2f')](_0x16a143['scheduledat'])){_0x16a143[_0x9752('0x30')]=moment();}if(moment()>moment(_0x16a143['scheduledat'])){_0x5c0685=moment()['add'](_0x49760e||0x3,_0x9752('0x31'));}else{if(_0x16a143[_0x9752('0x1f')]==0x0){_0x5c0685=moment(_0x16a143[_0x9752('0x30')]);}else{_0x5c0685=moment()[_0x9752('0x32')](_0x49760e||0x3,_0x9752('0x31'));}}if(_['isNil'](_0x5c0685)){_0x5c0685=moment()[_0x9752('0x32')](_0x49760e||0x3,_0x9752('0x31'));}var _0x19b403={'phone':_0x2fd6d4[_0x9752('0x33')],'active':0x0,'OrderBy':_['isNil'](_0x2fd6d4[_0x9752('0x1f')])?0x0:_0x2fd6d4[_0x9752('0x1f')],'scheduledat':moment()[_0x9752('0x32')](_0x3d25a6||0x1,_0x9752('0x31')),'countbusyretry':_0x205eb2[_0x9752('0x21')],'countcongestionretry':_0x205eb2[_0x9752('0x22')],'countnoanswerretry':_0x205eb2[_0x9752('0x23')],'countnosuchnumberretry':_0x205eb2[_0x9752('0x29')],'countdropretry':_0x205eb2[_0x9752('0x24')],'countabandonedretry':_0x205eb2[_0x9752('0x25')],'countmachineretry':_0x205eb2['countmachineretry'],'countagentrejectretry':_0x205eb2[_0x9752('0x27')],'createdAt':_0x205eb2[_0x9752('0x34')],'updatedAt':_0x205eb2[_0x9752('0x35')]};var _0x1619f8={'CmHopperId':_0x2fd6d4['id'],'phone':_0x16a143['phone'],'active':0x0,'OrderBy':_[_0x9752('0x2f')](_0x16a143[_0x9752('0x1f')])?0x0:_0x16a143[_0x9752('0x1f')],'scheduledat':_0x5c0685,'countbusyretry':_0x16a143['countbusyretry'],'countcongestionretry':_0x16a143[_0x9752('0x22')],'countnoanswerretry':_0x16a143[_0x9752('0x23')],'countnosuchnumberretry':_0x16a143[_0x9752('0x29')],'countdropretry':_0x16a143[_0x9752('0x24')],'countabandonedretry':_0x16a143[_0x9752('0x25')],'countmachineretry':_0x16a143[_0x9752('0x26')],'countagentrejectretry':_0x16a143[_0x9752('0x27')],'createdAt':_0x16a143[_0x9752('0x34')],'updatedAt':_0x16a143['updatedAt']};return db[_0x9752('0x36')][_0x9752('0x37')](function(_0x49bfe0){return db[_0x9752('0x28')]['update'](_0x19b403,{'where':{'id':_0x16a143['id']}},{'transaction':_0x49bfe0})[_0x9752('0xc')](function(){return db['CmHopper']['update'](_0x1619f8,{'where':{'id':_0x2fd6d4['id']}},{'transaction':_0x49bfe0});});})[_0x9752('0xc')](function(_0x1f0584){_0x3008c7({'id':_0x2fd6d4['id'],'phone':_0x16a143[_0x9752('0x33')]});})[_0x9752('0x17')](function(_0x6765aa){logger[_0x9752('0x12')](_0x9752('0x38'),_0x6765aa[_0x9752('0x14')]);_0x2bdff6({'error':_0x6765aa[_0x9752('0x14')]});});});}exports[_0x9752('0x39')]=function(_0x1613c3){var _0x4c5573=this;return new Promise(function(_0x594a83,_0x17c846){return db[_0x9752('0x3a')][_0x9752('0x3b')](_0x1613c3[_0x9752('0x1a')]['field'],{'where':{'id':_0x1613c3[_0x9752('0x1a')]['id']}})[_0x9752('0xc')](function(_0x981834){_0x594a83(_0x981834);})['catch'](function(_0x5c5861){logger[_0x9752('0x12')](_0x9752('0x39'),_0x5c5861[_0x9752('0x14')]);_0x17c846(_0x4c5573[_0x9752('0x12')](0x1f4,_0x5c5861[_0x9752('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 6c15b5f..b534c16 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 _0x320c=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0xbc0544,_0x5d7158){var _0x47e0ec=function(_0x57890e){while(--_0x57890e){_0xbc0544['push'](_0xbc0544['shift']());}};_0x47e0ec(++_0x5d7158);}(_0x320c,0x7b));var _0xc320=function(_0x4898b4,_0x41ca23){_0x4898b4=_0x4898b4-0x0;var _0x85539f=_0x320c[_0x4898b4];return _0x85539f;};'use strict';var multer=require(_0xc320('0x0'));var util=require(_0xc320('0x1'));var path=require(_0xc320('0x2'));var timeout=require('connect-timeout');var express=require(_0xc320('0x3'));var router=express[_0xc320('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc320('0x5'));var interaction=require(_0xc320('0x6'));var config=require(_0xc320('0x7'));var controller=require(_0xc320('0x8'));router[_0xc320('0x9')]('/',auth[_0xc320('0xa')](),controller[_0xc320('0xb')]);router[_0xc320('0x9')](_0xc320('0xc'),auth['isAuthenticated'](),controller[_0xc320('0xd')]);router[_0xc320('0xe')]('/',auth[_0xc320('0xa')](),controller['create']);router[_0xc320('0xf')](_0xc320('0xc'),auth['isAuthenticated'](),controller[_0xc320('0x10')]);router[_0xc320('0x11')]('/:id',auth[_0xc320('0xa')](),controller[_0xc320('0x12')]);module[_0xc320('0x13')]=router; \ No newline at end of file +var _0x830c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated','create','put','delete','destroy','exports'];(function(_0x1336b7,_0x2ac8b8){var _0x13718b=function(_0x2ccbee){while(--_0x2ccbee){_0x1336b7['push'](_0x1336b7['shift']());}};_0x13718b(++_0x2ac8b8);}(_0x830c,0xf7));var _0xc830=function(_0x35f14f,_0x33cca1){_0x35f14f=_0x35f14f-0x0;var _0x5bfd63=_0x830c[_0x35f14f];return _0x5bfd63;};'use strict';var multer=require(_0xc830('0x0'));var util=require(_0xc830('0x1'));var path=require(_0xc830('0x2'));var timeout=require(_0xc830('0x3'));var express=require(_0xc830('0x4'));var router=express[_0xc830('0x5')]();var fs_extra=require(_0xc830('0x6'));var auth=require(_0xc830('0x7'));var interaction=require(_0xc830('0x8'));var config=require('../../config/environment');var controller=require(_0xc830('0x9'));router[_0xc830('0xa')]('/',auth['isAuthenticated'](),controller[_0xc830('0xb')]);router[_0xc830('0xa')](_0xc830('0xc'),auth[_0xc830('0xd')](),controller['show']);router['post']('/',auth[_0xc830('0xd')](),controller[_0xc830('0xe')]);router[_0xc830('0xf')]('/:id',auth[_0xc830('0xd')](),controller['update']);router[_0xc830('0x10')](_0xc830('0xc'),auth[_0xc830('0xd')](),controller[_0xc830('0x11')]);module[_0xc830('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 2d6a596..3622e55 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 _0x46e1=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x4d5164,_0x4e20cb){var _0x2df768=function(_0x400737){while(--_0x400737){_0x4d5164['push'](_0x4d5164['shift']());}};_0x2df768(++_0x4e20cb);}(_0x46e1,0x155));var _0x146e=function(_0x39da77,_0x7d312a){_0x39da77=_0x39da77-0x0;var _0x53934=_0x46e1[_0x39da77];return _0x53934;};'use strict';var moment=require(_0x146e('0x0'));var Sequelize=require(_0x146e('0x1'));module[_0x146e('0x2')]={'phone':{'type':Sequelize[_0x146e('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x146e('0x4')],'unique':_0x146e('0x5')},'ListId':{'type':Sequelize[_0x146e('0x4')],'unique':_0x146e('0x5')},'VoiceQueueId':{'type':Sequelize[_0x146e('0x4')],'unique':_0x146e('0x5')}}; \ No newline at end of file +var _0xf8db=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x3c4a03,_0x5375e0){var _0x115fe0=function(_0x1e69e4){while(--_0x1e69e4){_0x3c4a03['push'](_0x3c4a03['shift']());}};_0x115fe0(++_0x5375e0);}(_0xf8db,0x16b));var _0xbf8d=function(_0x1d1722,_0x759c36){_0x1d1722=_0x1d1722-0x0;var _0x100055=_0xf8db[_0x1d1722];return _0x100055;};'use strict';var moment=require(_0xbf8d('0x0'));var Sequelize=require('sequelize');module[_0xbf8d('0x1')]={'phone':{'type':Sequelize[_0xbf8d('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xbf8d('0x3')],'unique':_0xbf8d('0x4')},'ListId':{'type':Sequelize[_0xbf8d('0x3')],'unique':_0xbf8d('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xbf8d('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index bb7341d..264cb70 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 _0x8a21=['attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x8a21,0x1d8));var _0x18a2=function(_0x1b97f3,_0xce63f3){_0x1b97f3=_0x1b97f3-0x0;var _0x32d818=_0x8a21[_0x1b97f3];return _0x32d818;};'use strict';var emlformat=require(_0x18a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x18a2('0x1'));var rp=require(_0x18a2('0x2'));var moment=require(_0x18a2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x18a2('0x4'));var path=require(_0x18a2('0x5'));var sox=require(_0x18a2('0x6'));var csv=require(_0x18a2('0x7'));var ejs=require(_0x18a2('0x8'));var fs=require('fs');var fs_extra=require(_0x18a2('0x9'));var _=require(_0x18a2('0xa'));var squel=require(_0x18a2('0xb'));var crypto=require('crypto');var jsforce=require(_0x18a2('0xc'));var deskjs=require(_0x18a2('0xd'));var toCsv=require(_0x18a2('0x7'));var querystring=require('querystring');var Papa=require(_0x18a2('0xe'));var Redis=require(_0x18a2('0xf'));var authService=require(_0x18a2('0x10'));var qs=require(_0x18a2('0x11'));var as=require(_0x18a2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x18a2('0x13'))(_0x18a2('0x14'));var utils=require('../../config/utils');var config=require(_0x18a2('0x15'));var licenseUtil=require(_0x18a2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30ee0b,_0x27e3af){_0x27e3af=_0x27e3af||0xcc;return function(_0x538947){if(_0x538947){return _0x30ee0b[_0x18a2('0x17')](_0x27e3af);}return _0x30ee0b[_0x18a2('0x18')](_0x27e3af)[_0x18a2('0x19')]();};}function respondWithResult(_0x2d03c0,_0x589277){_0x589277=_0x589277||0xc8;return function(_0x494cf1){if(_0x494cf1){return _0x2d03c0[_0x18a2('0x18')](_0x589277)['json'](_0x494cf1);}};}function respondWithFilteredResult(_0x29e733,_0x4e7f30){return function(_0x358572){if(_0x358572){var _0x3037c6=typeof _0x4e7f30[_0x18a2('0x1a')]==='undefined'&&typeof _0x4e7f30[_0x18a2('0x1b')]===_0x18a2('0x1c');var _0x13a23c=_0x358572[_0x18a2('0x1d')];var _0x22296a=_0x3037c6?0x0:_0x4e7f30['offset'];var _0x26929f=_0x3037c6?_0x358572['count']:_0x4e7f30[_0x18a2('0x1a')]+_0x4e7f30['limit'];var _0x1bb83f;if(_0x26929f>=_0x13a23c){_0x26929f=_0x13a23c;_0x1bb83f=0xc8;}else{_0x1bb83f=0xce;}_0x29e733[_0x18a2('0x18')](_0x1bb83f);return _0x29e733[_0x18a2('0x1e')](_0x18a2('0x1f'),_0x22296a+'-'+_0x26929f+'/'+_0x13a23c)[_0x18a2('0x20')](_0x358572);}return null;};}function patchUpdates(_0x227fd0){return function(_0x19a326){try{jsonpatch[_0x18a2('0x21')](_0x19a326,_0x227fd0,!![]);}catch(_0x5f3252){return BPromise[_0x18a2('0x22')](_0x5f3252);}return _0x19a326[_0x18a2('0x23')]();};}function saveUpdates(_0x3a063a,_0x5c5164){return function(_0x1ed01f){if(_0x1ed01f){return _0x1ed01f[_0x18a2('0x24')](_0x3a063a)[_0x18a2('0x25')](function(_0x3b741c){return _0x3b741c;});}return null;};}function removeEntity(_0x3fdf6c,_0x591a4c){return function(_0x5340cc){if(_0x5340cc){return _0x5340cc['destroy']()[_0x18a2('0x25')](function(){_0x3fdf6c[_0x18a2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32f573,_0x3be4db){return function(_0x531eb3){if(!_0x531eb3){_0x32f573[_0x18a2('0x17')](0x194);}return _0x531eb3;};}function handleError(_0x327d81,_0x3cecc){_0x3cecc=_0x3cecc||0x1f4;return function(_0x3689b6){logger[_0x18a2('0x26')](_0x3689b6[_0x18a2('0x27')]);if(_0x3689b6[_0x18a2('0x28')]){delete _0x3689b6[_0x18a2('0x28')];}_0x327d81[_0x18a2('0x18')](_0x3cecc)[_0x18a2('0x29')](_0x3689b6);};}exports[_0x18a2('0x2a')]=function(_0x562df1,_0x43a4f8){var _0x2df574={},_0x490410={},_0x266810={'count':0x0,'rows':[]};var _0x49f50f=_[_0x18a2('0x2b')](db[_0x18a2('0x2c')][_0x18a2('0x2d')],function(_0x56b765){return{'name':_0x56b765[_0x18a2('0x2e')],'type':_0x56b765[_0x18a2('0x2f')][_0x18a2('0x30')]};});_0x490410[_0x18a2('0x31')]=_[_0x18a2('0x2b')](_0x49f50f,'name');_0x490410[_0x18a2('0x32')]=_[_0x18a2('0x33')](_0x562df1[_0x18a2('0x32')]);_0x490410[_0x18a2('0x34')]=_['intersection'](_0x490410[_0x18a2('0x31')],_0x490410[_0x18a2('0x32')]);_0x2df574[_0x18a2('0x35')]=_[_0x18a2('0x36')](_0x490410['model'],qs[_0x18a2('0x37')](_0x562df1[_0x18a2('0x32')][_0x18a2('0x37')]));_0x2df574[_0x18a2('0x35')]=_0x2df574[_0x18a2('0x35')][_0x18a2('0x38')]?_0x2df574['attributes']:_0x490410[_0x18a2('0x31')];if(!_0x562df1[_0x18a2('0x32')][_0x18a2('0x39')](_0x18a2('0x3a'))){_0x2df574[_0x18a2('0x1b')]=qs['limit'](_0x562df1[_0x18a2('0x32')]['limit']);_0x2df574[_0x18a2('0x1a')]=qs[_0x18a2('0x1a')](_0x562df1[_0x18a2('0x32')][_0x18a2('0x1a')]);}_0x2df574['order']=qs[_0x18a2('0x3b')](_0x562df1[_0x18a2('0x32')]['sort']);_0x2df574[_0x18a2('0x3c')]=qs[_0x18a2('0x34')](_[_0x18a2('0x3d')](_0x562df1[_0x18a2('0x32')],_0x490410[_0x18a2('0x34')]),_0x49f50f);if(_0x562df1['query'][_0x18a2('0x3e')]){_0x2df574[_0x18a2('0x3c')]=_[_0x18a2('0x3f')](_0x2df574[_0x18a2('0x3c')],{'$or':_['map'](_0x49f50f,function(_0x55068a){if(_0x55068a[_0x18a2('0x2f')]!=='VIRTUAL'){var _0x345927={};_0x345927[_0x55068a[_0x18a2('0x28')]]={'$like':'%'+_0x562df1[_0x18a2('0x32')][_0x18a2('0x3e')]+'%'};return _0x345927;}})});}_0x2df574=_[_0x18a2('0x3f')]({},_0x2df574,_0x562df1[_0x18a2('0x40')]);var _0x1124db={'where':_0x2df574['where']};return db[_0x18a2('0x2c')][_0x18a2('0x1d')](_0x1124db)['then'](function(_0x1a8461){_0x266810[_0x18a2('0x1d')]=_0x1a8461;if(_0x562df1['query'][_0x18a2('0x41')]){_0x2df574[_0x18a2('0x42')]=[{'all':!![]}];}return db[_0x18a2('0x2c')][_0x18a2('0x43')](_0x2df574);})['then'](function(_0xa2953){_0x266810['rows']=_0xa2953;return _0x266810;})[_0x18a2('0x25')](respondWithFilteredResult(_0x43a4f8,_0x2df574))[_0x18a2('0x44')](handleError(_0x43a4f8,null));};exports[_0x18a2('0x45')]=function(_0x75e839,_0x3d69b7){var _0x13a032={'raw':!![],'where':{'id':_0x75e839[_0x18a2('0x46')]['id']}},_0x19d8dd={};_0x19d8dd[_0x18a2('0x31')]=_[_0x18a2('0x33')](db[_0x18a2('0x2c')]['rawAttributes']);_0x19d8dd['query']=_[_0x18a2('0x33')](_0x75e839[_0x18a2('0x32')]);_0x19d8dd[_0x18a2('0x34')]=_['intersection'](_0x19d8dd[_0x18a2('0x31')],_0x19d8dd[_0x18a2('0x32')]);_0x13a032[_0x18a2('0x35')]=_[_0x18a2('0x36')](_0x19d8dd[_0x18a2('0x31')],qs[_0x18a2('0x37')](_0x75e839[_0x18a2('0x32')][_0x18a2('0x37')]));_0x13a032[_0x18a2('0x35')]=_0x13a032[_0x18a2('0x35')][_0x18a2('0x38')]?_0x13a032[_0x18a2('0x35')]:_0x19d8dd[_0x18a2('0x31')];if(_0x75e839[_0x18a2('0x32')][_0x18a2('0x41')]){_0x13a032[_0x18a2('0x42')]=[{'all':!![]}];}_0x13a032=_[_0x18a2('0x3f')]({},_0x13a032,_0x75e839[_0x18a2('0x40')]);return db[_0x18a2('0x2c')][_0x18a2('0x47')](_0x13a032)[_0x18a2('0x25')](handleEntityNotFound(_0x3d69b7,null))['then'](respondWithResult(_0x3d69b7,null))['catch'](handleError(_0x3d69b7,null));};exports[_0x18a2('0x24')]=function(_0x57eca3,_0x592add){if(_0x57eca3[_0x18a2('0x48')]['id']){delete _0x57eca3[_0x18a2('0x48')]['id'];}return db[_0x18a2('0x2c')]['find']({'where':{'id':_0x57eca3[_0x18a2('0x46')]['id']}})[_0x18a2('0x25')](handleEntityNotFound(_0x592add,null))[_0x18a2('0x25')](saveUpdates(_0x57eca3['body'],null))[_0x18a2('0x25')](respondWithResult(_0x592add,null))['catch'](handleError(_0x592add,null));};exports[_0x18a2('0x49')]=function(_0x18d02f,_0x2d5b08){return db[_0x18a2('0x2c')][_0x18a2('0x47')]({'where':{'id':_0x18d02f[_0x18a2('0x46')]['id']}})[_0x18a2('0x25')](handleEntityNotFound(_0x2d5b08,null))[_0x18a2('0x25')](removeEntity(_0x2d5b08,null))[_0x18a2('0x44')](handleError(_0x2d5b08,null));};exports[_0x18a2('0x4a')]=function(_0x514a74,_0x18b348){return db[_0x18a2('0x2c')]['describe']()[_0x18a2('0x25')](respondWithResult(_0x18b348,null))[_0x18a2('0x44')](handleError(_0x18b348,null));}; \ No newline at end of file +var _0xbfdb=['query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','params','find','body','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','type'];(function(_0x19e928,_0x26a0e4){var _0x4e941f=function(_0x52a5cd){while(--_0x52a5cd){_0x19e928['push'](_0x19e928['shift']());}};_0x4e941f(++_0x26a0e4);}(_0xbfdb,0x181));var _0xbbfd=function(_0x55991c,_0x1692a7){_0x55991c=_0x55991c-0x0;var _0x32c3b4=_0xbfdb[_0x55991c];return _0x32c3b4;};'use strict';var emlformat=require(_0xbbfd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbbfd('0x1'));var jsonpatch=require(_0xbbfd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbbfd('0x3'));var Mustache=require(_0xbbfd('0x4'));var util=require(_0xbbfd('0x5'));var path=require(_0xbbfd('0x6'));var sox=require(_0xbbfd('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbbfd('0x8'));var _=require(_0xbbfd('0x9'));var squel=require(_0xbbfd('0xa'));var crypto=require(_0xbbfd('0xb'));var jsforce=require(_0xbbfd('0xc'));var deskjs=require(_0xbbfd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbbfd('0xe'));var Redis=require(_0xbbfd('0xf'));var authService=require(_0xbbfd('0x10'));var qs=require(_0xbbfd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbbfd('0x12'));var logger=require(_0xbbfd('0x13'))(_0xbbfd('0x14'));var utils=require(_0xbbfd('0x15'));var config=require(_0xbbfd('0x16'));var licenseUtil=require(_0xbbfd('0x17'));var db=require(_0xbbfd('0x18'))['db'];function respondWithStatusCode(_0x5c77ec,_0x467aa4){_0x467aa4=_0x467aa4||0xcc;return function(_0xc4e549){if(_0xc4e549){return _0x5c77ec[_0xbbfd('0x19')](_0x467aa4);}return _0x5c77ec[_0xbbfd('0x1a')](_0x467aa4)[_0xbbfd('0x1b')]();};}function respondWithResult(_0x13d9a0,_0x2882de){_0x2882de=_0x2882de||0xc8;return function(_0x32e83f){if(_0x32e83f){return _0x13d9a0[_0xbbfd('0x1a')](_0x2882de)[_0xbbfd('0x1c')](_0x32e83f);}};}function respondWithFilteredResult(_0x1da170,_0x282946){return function(_0x290163){if(_0x290163){var _0x35a4d3=typeof _0x282946[_0xbbfd('0x1d')]==='undefined'&&typeof _0x282946[_0xbbfd('0x1e')]==='undefined';var _0x504a94=_0x290163['count'];var _0x1cf034=_0x35a4d3?0x0:_0x282946['offset'];var _0x5a4f3e=_0x35a4d3?_0x290163[_0xbbfd('0x1f')]:_0x282946['offset']+_0x282946[_0xbbfd('0x1e')];var _0x5835fc;if(_0x5a4f3e>=_0x504a94){_0x5a4f3e=_0x504a94;_0x5835fc=0xc8;}else{_0x5835fc=0xce;}_0x1da170[_0xbbfd('0x1a')](_0x5835fc);return _0x1da170[_0xbbfd('0x20')]('Content-Range',_0x1cf034+'-'+_0x5a4f3e+'/'+_0x504a94)[_0xbbfd('0x1c')](_0x290163);}return null;};}function patchUpdates(_0x1c09e5){return function(_0x9f1c11){try{jsonpatch[_0xbbfd('0x21')](_0x9f1c11,_0x1c09e5,!![]);}catch(_0xb9cd6f){return BPromise[_0xbbfd('0x22')](_0xb9cd6f);}return _0x9f1c11['save']();};}function saveUpdates(_0x342cb2,_0x249c5a){return function(_0x365c06){if(_0x365c06){return _0x365c06[_0xbbfd('0x23')](_0x342cb2)[_0xbbfd('0x24')](function(_0x57843a){return _0x57843a;});}return null;};}function removeEntity(_0x5356f8,_0x5a7606){return function(_0x3b460d){if(_0x3b460d){return _0x3b460d[_0xbbfd('0x25')]()[_0xbbfd('0x24')](function(){_0x5356f8[_0xbbfd('0x1a')](0xcc)[_0xbbfd('0x1b')]();});}};}function handleEntityNotFound(_0x32f180,_0x34582f){return function(_0x3c3098){if(!_0x3c3098){_0x32f180[_0xbbfd('0x19')](0x194);}return _0x3c3098;};}function handleError(_0x478543,_0x212d5a){_0x212d5a=_0x212d5a||0x1f4;return function(_0x4485b6){logger[_0xbbfd('0x26')](_0x4485b6[_0xbbfd('0x27')]);if(_0x4485b6[_0xbbfd('0x28')]){delete _0x4485b6[_0xbbfd('0x28')];}_0x478543[_0xbbfd('0x1a')](_0x212d5a)[_0xbbfd('0x29')](_0x4485b6);};}exports[_0xbbfd('0x2a')]=function(_0x4f8416,_0x372851){var _0x46ea08={},_0x293584={},_0x2bcd1e={'count':0x0,'rows':[]};var _0x28d228=_[_0xbbfd('0x2b')](db[_0xbbfd('0x2c')][_0xbbfd('0x2d')],function(_0x85368d){return{'name':_0x85368d['fieldName'],'type':_0x85368d[_0xbbfd('0x2e')]['key']};});_0x293584['model']=_[_0xbbfd('0x2b')](_0x28d228,_0xbbfd('0x28'));_0x293584[_0xbbfd('0x2f')]=_[_0xbbfd('0x30')](_0x4f8416[_0xbbfd('0x2f')]);_0x293584[_0xbbfd('0x31')]=_[_0xbbfd('0x32')](_0x293584[_0xbbfd('0x33')],_0x293584['query']);_0x46ea08['attributes']=_[_0xbbfd('0x32')](_0x293584[_0xbbfd('0x33')],qs[_0xbbfd('0x34')](_0x4f8416['query'][_0xbbfd('0x34')]));_0x46ea08[_0xbbfd('0x35')]=_0x46ea08['attributes'][_0xbbfd('0x36')]?_0x46ea08[_0xbbfd('0x35')]:_0x293584[_0xbbfd('0x33')];if(!_0x4f8416[_0xbbfd('0x2f')][_0xbbfd('0x37')](_0xbbfd('0x38'))){_0x46ea08['limit']=qs[_0xbbfd('0x1e')](_0x4f8416[_0xbbfd('0x2f')][_0xbbfd('0x1e')]);_0x46ea08['offset']=qs[_0xbbfd('0x1d')](_0x4f8416[_0xbbfd('0x2f')]['offset']);}_0x46ea08[_0xbbfd('0x39')]=qs[_0xbbfd('0x3a')](_0x4f8416[_0xbbfd('0x2f')][_0xbbfd('0x3a')]);_0x46ea08[_0xbbfd('0x3b')]=qs[_0xbbfd('0x31')](_[_0xbbfd('0x3c')](_0x4f8416['query'],_0x293584[_0xbbfd('0x31')]),_0x28d228);if(_0x4f8416[_0xbbfd('0x2f')][_0xbbfd('0x3d')]){_0x46ea08[_0xbbfd('0x3b')]=_['merge'](_0x46ea08[_0xbbfd('0x3b')],{'$or':_[_0xbbfd('0x2b')](_0x28d228,function(_0x2c526c){if(_0x2c526c['type']!==_0xbbfd('0x3e')){var _0x101823={};_0x101823[_0x2c526c['name']]={'$like':'%'+_0x4f8416[_0xbbfd('0x2f')]['filter']+'%'};return _0x101823;}})});}_0x46ea08=_[_0xbbfd('0x3f')]({},_0x46ea08,_0x4f8416[_0xbbfd('0x40')]);var _0x10989c={'where':_0x46ea08[_0xbbfd('0x3b')]};return db[_0xbbfd('0x2c')][_0xbbfd('0x1f')](_0x10989c)['then'](function(_0x2fc2ce){_0x2bcd1e['count']=_0x2fc2ce;if(_0x4f8416[_0xbbfd('0x2f')]['includeAll']){_0x46ea08[_0xbbfd('0x41')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x46ea08);})['then'](function(_0x491a42){_0x2bcd1e[_0xbbfd('0x42')]=_0x491a42;return _0x2bcd1e;})[_0xbbfd('0x24')](respondWithFilteredResult(_0x372851,_0x46ea08))[_0xbbfd('0x43')](handleError(_0x372851,null));};exports['show']=function(_0x51f396,_0xdef7ba){var _0x540ba1={'raw':!![],'where':{'id':_0x51f396[_0xbbfd('0x44')]['id']}},_0x26b209={};_0x26b209[_0xbbfd('0x33')]=_[_0xbbfd('0x30')](db[_0xbbfd('0x2c')][_0xbbfd('0x2d')]);_0x26b209[_0xbbfd('0x2f')]=_[_0xbbfd('0x30')](_0x51f396[_0xbbfd('0x2f')]);_0x26b209['filters']=_['intersection'](_0x26b209[_0xbbfd('0x33')],_0x26b209['query']);_0x540ba1[_0xbbfd('0x35')]=_[_0xbbfd('0x32')](_0x26b209[_0xbbfd('0x33')],qs[_0xbbfd('0x34')](_0x51f396[_0xbbfd('0x2f')][_0xbbfd('0x34')]));_0x540ba1[_0xbbfd('0x35')]=_0x540ba1[_0xbbfd('0x35')][_0xbbfd('0x36')]?_0x540ba1[_0xbbfd('0x35')]:_0x26b209[_0xbbfd('0x33')];if(_0x51f396['query']['includeAll']){_0x540ba1[_0xbbfd('0x41')]=[{'all':!![]}];}_0x540ba1=_[_0xbbfd('0x3f')]({},_0x540ba1,_0x51f396[_0xbbfd('0x40')]);return db[_0xbbfd('0x2c')][_0xbbfd('0x45')](_0x540ba1)[_0xbbfd('0x24')](handleEntityNotFound(_0xdef7ba,null))[_0xbbfd('0x24')](respondWithResult(_0xdef7ba,null))[_0xbbfd('0x43')](handleError(_0xdef7ba,null));};exports[_0xbbfd('0x23')]=function(_0x4140c3,_0x300f4a){if(_0x4140c3[_0xbbfd('0x46')]['id']){delete _0x4140c3['body']['id'];}return db[_0xbbfd('0x2c')][_0xbbfd('0x45')]({'where':{'id':_0x4140c3[_0xbbfd('0x44')]['id']}})[_0xbbfd('0x24')](handleEntityNotFound(_0x300f4a,null))['then'](saveUpdates(_0x4140c3[_0xbbfd('0x46')],null))['then'](respondWithResult(_0x300f4a,null))[_0xbbfd('0x43')](handleError(_0x300f4a,null));};exports[_0xbbfd('0x25')]=function(_0x149a49,_0x2eeaa0){return db[_0xbbfd('0x2c')][_0xbbfd('0x45')]({'where':{'id':_0x149a49[_0xbbfd('0x44')]['id']}})[_0xbbfd('0x24')](handleEntityNotFound(_0x2eeaa0,null))[_0xbbfd('0x24')](removeEntity(_0x2eeaa0,null))['catch'](handleError(_0x2eeaa0,null));};exports[_0xbbfd('0x47')]=function(_0x33c5be,_0x2c459b){return db[_0xbbfd('0x2c')][_0xbbfd('0x47')]()[_0xbbfd('0x24')](respondWithResult(_0x2c459b,null))['catch'](handleError(_0x2c459b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 4124db9..8c6a6de 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 _0xda0d=['moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api'];(function(_0x4ba705,_0x2d23c3){var _0x2fd562=function(_0x4d3d57){while(--_0x4d3d57){_0x4ba705['push'](_0x4ba705['shift']());}};_0x2fd562(++_0x2d23c3);}(_0xda0d,0x1ae));var _0xdda0=function(_0x12ac04,_0x25f852){_0x12ac04=_0x12ac04-0x0;var _0x211e7c=_0xda0d[_0x12ac04];return _0x211e7c;};'use strict';var _=require(_0xdda0('0x0'));var util=require(_0xdda0('0x1'));var logger=require(_0xdda0('0x2'))(_0xdda0('0x3'));var moment=require(_0xdda0('0x4'));var BPromise=require(_0xdda0('0x5'));var rp=require(_0xdda0('0x6'));var fs=require('fs');var path=require(_0xdda0('0x7'));var rimraf=require(_0xdda0('0x8'));var config=require('../../config/environment');var attributes=require(_0xdda0('0x9'));module[_0xdda0('0xa')]=function(_0x16b68d,_0x2e390c){return _0x16b68d[_0xdda0('0xb')](_0xdda0('0xc'),attributes,{'tableName':_0xdda0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd485=['request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment'];(function(_0x8809b4,_0x3bdc8a){var _0xc33cb7=function(_0x4bec4e){while(--_0x4bec4e){_0x8809b4['push'](_0x8809b4['shift']());}};_0xc33cb7(++_0x3bdc8a);}(_0xd485,0xee));var _0x5d48=function(_0x15b5c2,_0x41c860){_0x15b5c2=_0x15b5c2-0x0;var _0x1c4b09=_0xd485[_0x15b5c2];return _0x1c4b09;};'use strict';var _=require('lodash');var util=require(_0x5d48('0x0'));var logger=require(_0x5d48('0x1'))(_0x5d48('0x2'));var moment=require(_0x5d48('0x3'));var BPromise=require('bluebird');var rp=require(_0x5d48('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d48('0x5'));var config=require(_0x5d48('0x6'));var attributes=require(_0x5d48('0x7'));module['exports']=function(_0x318edb,_0xa924f8){return _0x318edb[_0x5d48('0x8')](_0x5d48('0x9'),attributes,{'tableName':_0x5d48('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 34fd64f..fe49d48 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 _0xddb7=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','raw','DestroyCmHopperBlack','lodash','util'];(function(_0x100b55,_0x3b4c99){var _0x26608e=function(_0x464f82){while(--_0x464f82){_0x100b55['push'](_0x100b55['shift']());}};_0x26608e(++_0x3b4c99);}(_0xddb7,0x6a));var _0x7ddb=function(_0x41599f,_0x394e48){_0x41599f=_0x41599f-0x0;var _0x573ee8=_0xddb7[_0x41599f];return _0x573ee8;};'use strict';var _=require(_0x7ddb('0x0'));var util=require(_0x7ddb('0x1'));var moment=require(_0x7ddb('0x2'));var BPromise=require(_0x7ddb('0x3'));var rs=require(_0x7ddb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ddb('0x5'))['db'];var utils=require(_0x7ddb('0x6'));var logger=require(_0x7ddb('0x7'))(_0x7ddb('0x8'));var config=require(_0x7ddb('0x9'));var jayson=require(_0x7ddb('0xa'));var client=jayson[_0x7ddb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2edd29,_0x201ca0,_0x55875a){return new BPromise(function(_0x5475b7,_0x3ab078){return client[_0x7ddb('0xc')](_0x2edd29,_0x55875a)[_0x7ddb('0xd')](function(_0x3a69d3){logger[_0x7ddb('0xe')](_0x7ddb('0xf'),_0x201ca0,'request\x20sent');logger[_0x7ddb('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x201ca0,_0x7ddb('0x11'),JSON[_0x7ddb('0x12')](_0x3a69d3));if(_0x3a69d3['error']){if(_0x3a69d3[_0x7ddb('0x13')][_0x7ddb('0x14')]===0x1f4){logger[_0x7ddb('0x13')](_0x7ddb('0xf'),_0x201ca0,_0x3a69d3[_0x7ddb('0x13')]['message']);return _0x3ab078(_0x3a69d3[_0x7ddb('0x13')]['message']);}logger['error'](_0x7ddb('0xf'),_0x201ca0,_0x3a69d3['error'][_0x7ddb('0x15')]);return _0x5475b7(_0x3a69d3['error'][_0x7ddb('0x15')]);}else{logger[_0x7ddb('0xe')](_0x7ddb('0xf'),_0x201ca0,_0x7ddb('0x11'));_0x5475b7(_0x3a69d3['result'][_0x7ddb('0x15')]);}})[_0x7ddb('0x16')](function(_0x27a159){logger[_0x7ddb('0x13')](_0x7ddb('0xf'),_0x201ca0,_0x27a159);_0x3ab078(_0x27a159);});});}exports[_0x7ddb('0x17')]=function(_0x3fc7e7){var _0x52ea36=this;return new Promise(function(_0x322f02,_0xedf522){return db[_0x7ddb('0x18')]['findAll']({'raw':_0x3fc7e7['options']?_0x3fc7e7[_0x7ddb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3fc7e7[_0x7ddb('0x19')]?_0x3fc7e7[_0x7ddb('0x19')][_0x7ddb('0x1a')]||null:null,'attributes':_0x3fc7e7[_0x7ddb('0x19')]?_0x3fc7e7[_0x7ddb('0x19')][_0x7ddb('0x1b')]||null:null,'limit':_0x3fc7e7[_0x7ddb('0x19')]?_0x3fc7e7[_0x7ddb('0x19')][_0x7ddb('0x1c')]||null:null,'include':_0x3fc7e7[_0x7ddb('0x19')]?_0x3fc7e7[_0x7ddb('0x19')][_0x7ddb('0x1d')]?_[_0x7ddb('0x1e')](_0x3fc7e7['options']['include'],function(_0x1ccdcf){return{'model':db[_0x1ccdcf[_0x7ddb('0x1f')]],'as':_0x1ccdcf['as'],'attributes':_0x1ccdcf[_0x7ddb('0x1b')],'include':_0x1ccdcf[_0x7ddb('0x1d')]?_[_0x7ddb('0x1e')](_0x1ccdcf[_0x7ddb('0x1d')],function(_0x33c40f){return{'model':db[_0x33c40f[_0x7ddb('0x1f')]],'as':_0x33c40f['as'],'attributes':_0x33c40f[_0x7ddb('0x1b')],'include':_0x33c40f[_0x7ddb('0x1d')]?_['map'](_0x33c40f['include'],function(_0x64daf7){return{'model':db[_0x64daf7[_0x7ddb('0x1f')]],'as':_0x64daf7['as'],'attributes':_0x64daf7[_0x7ddb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7ddb('0xd')](function(_0x4e50e9){logger[_0x7ddb('0xe')](_0x7ddb('0x17'),_0x3fc7e7);logger[_0x7ddb('0x10')]('GetCmHopperBlack',_0x3fc7e7,JSON[_0x7ddb('0x12')](_0x4e50e9));_0x322f02(_0x4e50e9);})[_0x7ddb('0x16')](function(_0x2e7a09){logger[_0x7ddb('0x13')](_0x7ddb('0x17'),_0x2e7a09[_0x7ddb('0x15')],_0x3fc7e7);_0xedf522(_0x52ea36[_0x7ddb('0x13')](0x1f4,_0x2e7a09['message']));});});};exports[_0x7ddb('0x20')]=function(_0x167566){var _0x4fe70d=this;return new Promise(function(_0x105905,_0x8ba929){return db['CmHopperBlack'][_0x7ddb('0x21')](_0x167566['body'],{'raw':_0x167566[_0x7ddb('0x19')]?_0x167566[_0x7ddb('0x19')][_0x7ddb('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x167566[_0x7ddb('0x19')]?_0x167566[_0x7ddb('0x19')][_0x7ddb('0x1a')]||null:null,'attributes':_0x167566[_0x7ddb('0x19')]?_0x167566[_0x7ddb('0x19')]['attributes']||null:null,'limit':_0x167566['options']?_0x167566[_0x7ddb('0x19')][_0x7ddb('0x1c')]||null:null})['then'](function(_0x29e43b){logger[_0x7ddb('0xe')]('UpdateCmHopperBlack',_0x167566);logger[_0x7ddb('0x10')](_0x7ddb('0x20'),_0x167566,JSON['stringify'](_0x29e43b));_0x105905(_0x29e43b);})[_0x7ddb('0x16')](function(_0x4e3c93){logger['error'](_0x7ddb('0x20'),_0x4e3c93[_0x7ddb('0x15')],_0x167566);_0x8ba929(_0x4fe70d[_0x7ddb('0x13')](0x1f4,_0x4e3c93[_0x7ddb('0x15')]));});});};exports[_0x7ddb('0x23')]=function(_0x4b73d8){var _0x20c078=this;return new Promise(function(_0xc7fe6d,_0x1a15ea){return db['CmHopperBlack']['destroy']({'where':_0x4b73d8[_0x7ddb('0x19')]?_0x4b73d8[_0x7ddb('0x19')][_0x7ddb('0x1a')]||null:null})[_0x7ddb('0xd')](function(_0x1e047){logger['info'](_0x7ddb('0x23'),_0x4b73d8);logger[_0x7ddb('0x10')](_0x7ddb('0x23'),_0x4b73d8,JSON[_0x7ddb('0x12')](_0x1e047));_0xc7fe6d(_0x1e047);})[_0x7ddb('0x16')](function(_0x1723c9){logger[_0x7ddb('0x13')](_0x7ddb('0x23'),_0x1723c9[_0x7ddb('0x15')],_0x4b73d8);_0x1a15ea(_0x20c078['error'](0x1f4,_0x1723c9[_0x7ddb('0x15')]));});});}; \ No newline at end of file +var _0xfe8b=['CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','then','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetCmHopperBlack'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xfe8b,0x140));var _0xbfe8=function(_0x209603,_0x351b88){_0x209603=_0x209603-0x0;var _0x3e06d4=_0xfe8b[_0x209603];return _0x3e06d4;};'use strict';var _=require(_0xbfe8('0x0'));var util=require(_0xbfe8('0x1'));var moment=require(_0xbfe8('0x2'));var BPromise=require(_0xbfe8('0x3'));var rs=require(_0xbfe8('0x4'));var fs=require('fs');var Redis=require(_0xbfe8('0x5'));var db=require(_0xbfe8('0x6'))['db'];var utils=require(_0xbfe8('0x7'));var logger=require(_0xbfe8('0x8'))('rpc');var config=require(_0xbfe8('0x9'));var jayson=require(_0xbfe8('0xa'));var client=jayson[_0xbfe8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd0c43,_0x4a28f9,_0x3513dc){return new BPromise(function(_0x3ab0bf,_0x12f60d){return client[_0xbfe8('0xc')](_0xd0c43,_0x3513dc)['then'](function(_0x3bbe55){logger[_0xbfe8('0xd')](_0xbfe8('0xe'),_0x4a28f9,_0xbfe8('0xf'));logger[_0xbfe8('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x4a28f9,'request\x20sent',JSON[_0xbfe8('0x11')](_0x3bbe55));if(_0x3bbe55[_0xbfe8('0x12')]){if(_0x3bbe55['error']['code']===0x1f4){logger['error'](_0xbfe8('0xe'),_0x4a28f9,_0x3bbe55[_0xbfe8('0x12')][_0xbfe8('0x13')]);return _0x12f60d(_0x3bbe55[_0xbfe8('0x12')][_0xbfe8('0x13')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x4a28f9,_0x3bbe55[_0xbfe8('0x12')][_0xbfe8('0x13')]);return _0x3ab0bf(_0x3bbe55[_0xbfe8('0x12')][_0xbfe8('0x13')]);}else{logger[_0xbfe8('0xd')](_0xbfe8('0xe'),_0x4a28f9,_0xbfe8('0xf'));_0x3ab0bf(_0x3bbe55['result'][_0xbfe8('0x13')]);}})[_0xbfe8('0x14')](function(_0x5eaffc){logger[_0xbfe8('0x12')](_0xbfe8('0xe'),_0x4a28f9,_0x5eaffc);_0x12f60d(_0x5eaffc);});});}exports[_0xbfe8('0x15')]=function(_0x4a08e){var _0x9d4197=this;return new Promise(function(_0x37cf19,_0x316e53){return db[_0xbfe8('0x16')][_0xbfe8('0x17')]({'raw':_0x4a08e[_0xbfe8('0x18')]?_0x4a08e['options'][_0xbfe8('0x19')]===undefined?!![]:![]:!![],'where':_0x4a08e[_0xbfe8('0x18')]?_0x4a08e[_0xbfe8('0x18')][_0xbfe8('0x1a')]||null:null,'attributes':_0x4a08e['options']?_0x4a08e[_0xbfe8('0x18')][_0xbfe8('0x1b')]||null:null,'limit':_0x4a08e[_0xbfe8('0x18')]?_0x4a08e[_0xbfe8('0x18')][_0xbfe8('0x1c')]||null:null,'include':_0x4a08e[_0xbfe8('0x18')]?_0x4a08e[_0xbfe8('0x18')][_0xbfe8('0x1d')]?_['map'](_0x4a08e[_0xbfe8('0x18')][_0xbfe8('0x1d')],function(_0x578f2c){return{'model':db[_0x578f2c[_0xbfe8('0x1e')]],'as':_0x578f2c['as'],'attributes':_0x578f2c[_0xbfe8('0x1b')],'include':_0x578f2c[_0xbfe8('0x1d')]?_[_0xbfe8('0x1f')](_0x578f2c[_0xbfe8('0x1d')],function(_0x1edfd7){return{'model':db[_0x1edfd7[_0xbfe8('0x1e')]],'as':_0x1edfd7['as'],'attributes':_0x1edfd7[_0xbfe8('0x1b')],'include':_0x1edfd7['include']?_[_0xbfe8('0x1f')](_0x1edfd7[_0xbfe8('0x1d')],function(_0x1a17e1){return{'model':db[_0x1a17e1['model']],'as':_0x1a17e1['as'],'attributes':_0x1a17e1[_0xbfe8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbfe8('0x20')](function(_0x443496){logger[_0xbfe8('0xd')](_0xbfe8('0x15'),_0x4a08e);logger[_0xbfe8('0x10')](_0xbfe8('0x15'),_0x4a08e,JSON[_0xbfe8('0x11')](_0x443496));_0x37cf19(_0x443496);})[_0xbfe8('0x14')](function(_0x3695bc){logger[_0xbfe8('0x12')](_0xbfe8('0x15'),_0x3695bc[_0xbfe8('0x13')],_0x4a08e);_0x316e53(_0x9d4197[_0xbfe8('0x12')](0x1f4,_0x3695bc[_0xbfe8('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x5415de){var _0x14559b=this;return new Promise(function(_0x6f8f4b,_0x284da8){return db[_0xbfe8('0x16')][_0xbfe8('0x21')](_0x5415de[_0xbfe8('0x22')],{'raw':_0x5415de[_0xbfe8('0x18')]?_0x5415de[_0xbfe8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5415de[_0xbfe8('0x18')]?_0x5415de[_0xbfe8('0x18')]['where']||null:null,'attributes':_0x5415de[_0xbfe8('0x18')]?_0x5415de[_0xbfe8('0x18')]['attributes']||null:null,'limit':_0x5415de[_0xbfe8('0x18')]?_0x5415de['options'][_0xbfe8('0x1c')]||null:null})['then'](function(_0x12b516){logger[_0xbfe8('0xd')](_0xbfe8('0x23'),_0x5415de);logger[_0xbfe8('0x10')](_0xbfe8('0x23'),_0x5415de,JSON['stringify'](_0x12b516));_0x6f8f4b(_0x12b516);})[_0xbfe8('0x14')](function(_0x741395){logger[_0xbfe8('0x12')](_0xbfe8('0x23'),_0x741395['message'],_0x5415de);_0x284da8(_0x14559b[_0xbfe8('0x12')](0x1f4,_0x741395[_0xbfe8('0x13')]));});});};exports[_0xbfe8('0x24')]=function(_0x58baec){var _0x13ace3=this;return new Promise(function(_0x690acd,_0x3347d2){return db['CmHopperBlack'][_0xbfe8('0x25')]({'where':_0x58baec['options']?_0x58baec[_0xbfe8('0x18')][_0xbfe8('0x1a')]||null:null})[_0xbfe8('0x20')](function(_0xe47785){logger[_0xbfe8('0xd')]('DestroyCmHopperBlack',_0x58baec);logger[_0xbfe8('0x10')]('DestroyCmHopperBlack',_0x58baec,JSON['stringify'](_0xe47785));_0x690acd(_0xe47785);})[_0xbfe8('0x14')](function(_0x596601){logger[_0xbfe8('0x12')]('DestroyCmHopperBlack',_0x596601['message'],_0x58baec);_0x3347d2(_0x13ace3['error'](0x1f4,_0x596601[_0xbfe8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 2f78acf..e632d57 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 _0x9fd4=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id'];(function(_0x1dea1a,_0x3e7df7){var _0x5967c2=function(_0xa84a6d){while(--_0xa84a6d){_0x1dea1a['push'](_0x1dea1a['shift']());}};_0x5967c2(++_0x3e7df7);}(_0x9fd4,0x16c));var _0x49fd=function(_0x37bed5,_0x4fcea4){_0x37bed5=_0x37bed5-0x0;var _0xfd86c3=_0x9fd4[_0x37bed5];return _0xfd86c3;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require(_0x49fd('0x3'));var express=require(_0x49fd('0x4'));var router=express[_0x49fd('0x5')]();var fs_extra=require(_0x49fd('0x6'));var auth=require(_0x49fd('0x7'));var interaction=require(_0x49fd('0x8'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x49fd('0x9')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xb')]);router[_0x49fd('0x9')]('/describe',auth[_0x49fd('0xa')](),controller[_0x49fd('0xc')]);router[_0x49fd('0x9')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),controller['show']);router[_0x49fd('0xe')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),controller[_0x49fd('0xf')]);router[_0x49fd('0x10')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),controller['destroy']);module[_0x49fd('0x11')]=router; \ No newline at end of file +var _0xd117=['/describe','describe','/:id','show','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xd117,0x182));var _0x7d11=function(_0x31cc0e,_0x24ba4c){_0x31cc0e=_0x31cc0e-0x0;var _0x144862=_0xd117[_0x31cc0e];return _0x144862;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0x12')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['delete']('/:id',auth[_0x7d11('0xc')](),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 ff61d12..07043c2 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 _0x6e47=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue','followuptime','seconds'];(function(_0x3c6741,_0x24c6f0){var _0x5d3310=function(_0x504ffb){while(--_0x504ffb){_0x3c6741['push'](_0x3c6741['shift']());}};_0x5d3310(++_0x24c6f0);}(_0x6e47,0x14e));var _0x76e4=function(_0x2c74ed,_0x2e4c92){_0x2c74ed=_0x2c74ed-0x0;var _0x29e21b=_0x6e47[_0x2c74ed];return _0x29e21b;};'use strict';var Sequelize=require(_0x76e4('0x0'));var moment=require('moment');module[_0x76e4('0x1')]={'state':{'type':Sequelize[_0x76e4('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x76e4('0x3')]},'scheduledat':{'type':Sequelize[_0x76e4('0x4')]},'countbusyretry':{'type':Sequelize[_0x76e4('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x76e4('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x76e4('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x76e4('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76e4('0x4')]},'responsetime':{'type':Sequelize[_0x76e4('0x4')]},'answertime':{'type':Sequelize[_0x76e4('0x4')]},'droptime':{'type':Sequelize[_0x76e4('0x4')]},'endtime':{'type':Sequelize[_0x76e4('0x4')]},'ringtime':{'type':Sequelize[_0x76e4('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x76e4('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x76e4('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x76e4('0x3')]},'campaign':{'type':Sequelize[_0x76e4('0x3')]},'campaigntype':{'type':Sequelize[_0x76e4('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x76e4('0x3')]},'disposition':{'type':Sequelize[_0x76e4('0x3')]},'secondDisposition':{'type':Sequelize[_0x76e4('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x76e4('0x4')],'set':function(_0x247244){var _0x3395a8=this[_0x76e4('0x5')]('endtime');if(_0x3395a8&&_0x247244){this['setDataValue'](_0x76e4('0x6'),moment(_0x247244)['diff'](moment(_0x3395a8),_0x76e4('0x7')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x76e4('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x76e4('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x76e4('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x76e4('0x4')]},'callback':{'type':Sequelize[_0x76e4('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x76e4('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x76e4('0x4')]},'deleted':{'type':Sequelize[_0x76e4('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x76e4('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x76e4('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x76e4('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x76e4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1a74=['setDataValue','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0xdf850b,_0x51b89d){var _0x89a499=function(_0x36f252){while(--_0x36f252){_0xdf850b['push'](_0xdf850b['shift']());}};_0x89a499(++_0x51b89d);}(_0x1a74,0x118));var _0x41a7=function(_0x16324b,_0x4aa8f5){_0x16324b=_0x16324b-0x0;var _0x46215b=_0x1a74[_0x16324b];return _0x46215b;};'use strict';var Sequelize=require(_0x41a7('0x0'));var moment=require(_0x41a7('0x1'));module[_0x41a7('0x2')]={'state':{'type':Sequelize[_0x41a7('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x41a7('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x41a7('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x41a7('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x41a7('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x41a7('0x4')]},'originatecalleridname':{'type':Sequelize[_0x41a7('0x4')]},'calleridnum':{'type':Sequelize[_0x41a7('0x4')]},'calleridname':{'type':Sequelize[_0x41a7('0x4')]},'starttime':{'type':Sequelize[_0x41a7('0x5')]},'responsetime':{'type':Sequelize[_0x41a7('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x41a7('0x5')]},'ringtime':{'type':Sequelize[_0x41a7('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x41a7('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x41a7('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x41a7('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x41a7('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x41a7('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x41a7('0x4')]},'secondDisposition':{'type':Sequelize[_0x41a7('0x4')]},'thirdDisposition':{'type':Sequelize[_0x41a7('0x4')]},'dispositionat':{'type':Sequelize[_0x41a7('0x5')],'set':function(_0x4db967){var _0x20a5f4=this[_0x41a7('0x6')](_0x41a7('0x7'));if(_0x20a5f4&&_0x4db967){this[_0x41a7('0x8')]('followuptime',moment(_0x4db967)[_0x41a7('0x9')](moment(_0x20a5f4),_0x41a7('0xa')));}}},'amd':{'type':Sequelize[_0x41a7('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x41a7('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x41a7('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x41a7('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x41a7('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x41a7('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x41a7('0x5')]},'deleted':{'type':Sequelize[_0x41a7('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x41a7('0x5')]},'recallme':{'type':Sequelize[_0x41a7('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x41a7('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x41a7('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x41a7('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x41a7('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x41a7('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index a030709..af99bdc 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 _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(_0x2eb3db,_0x4a32c0){var _0x358f33=function(_0x1d0588){while(--_0x1d0588){_0x2eb3db['push'](_0x2eb3db['shift']());}};_0x358f33(++_0x4a32c0);}(_0x5d17,0x114));var _0x75d1=function(_0x158876,_0x8600fe){_0x158876=_0x158876-0x0;var _0x51c285=_0x5d17[_0x158876];return _0x51c285;};'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 +var _0x4c60=['include','findAll','rows','catch','show','includeAll','find','describe','update','uniqueid','body','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','answeringMachine','VoiceQueue','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','CmHopperFinal','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x462691,_0x4fbaf5){var _0x12fe7e=function(_0x12c206){while(--_0x12c206){_0x462691['push'](_0x462691['shift']());}};_0x12fe7e(++_0x4fbaf5);}(_0x4c60,0xc1));var _0x04c6=function(_0xc6804b,_0x393ebd){_0xc6804b=_0xc6804b-0x0;var _0xf99d40=_0x4c60[_0xc6804b];return _0xf99d40;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['CmHopperFinal'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':!![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['CmHopperFinal'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['CmHopperFinal'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')]()['then'](respondWithResult(_0x4ef366,null))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0x2472ed,_0xee2822){if(_0x2472ed['body'][_0x04c6('0x44')]){delete _0x2472ed[_0x04c6('0x45')][_0x04c6('0x44')];}return db[_0x04c6('0x27')]['find']({'where':{'uniqueid':_0x2472ed[_0x04c6('0x46')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0xee2822,null))[_0x04c6('0x1f')](saveUpdates(_0x2472ed[_0x04c6('0x45')],null))['then'](respondWithResult(_0xee2822,null))[_0x04c6('0x3e')](handleError(_0xee2822,null));};exports[_0x04c6('0x47')]=function(_0x15ec61,_0x489361,_0x3119f0){return db[_0x04c6('0x27')][_0x04c6('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x15ec61[_0x04c6('0x46')]['id']},'attributes':[[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4b')))),_0x04c6('0x4c')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4d')))),_0x04c6('0x4e')],[db[_0x04c6('0x48')]['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4f')))),_0x04c6('0x50')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x04c6('0x51')],[db[_0x04c6('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x52')))),_0x04c6('0x53')],[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x54')))),_0x04c6('0x55')],[db[_0x04c6('0x48')]['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x56')))),'answeringMachine']]})[_0x04c6('0x1f')](handleEntityNotFound(_0x489361,null))[_0x04c6('0x1f')](respondWithResult(_0x489361,null))[_0x04c6('0x3e')](handleError(_0x489361,null));};exports[_0x04c6('0x57')]=function(_0x28299e,_0x5b536f,_0xf073a8){return db[_0x04c6('0x27')]['findAll']({'raw':![],'where':{'CampaignId':_0x28299e[_0x04c6('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db['sequelize']['literal'](_0x04c6('0x4b')))),'noSuchContacts'],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4d')))),_0x04c6('0x4e')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4f')))),_0x04c6('0x50')],[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),_0x04c6('0x58')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x59')))),_0x04c6('0x51')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x52')))),_0x04c6('0x53')],[db['sequelize']['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x54')))),'reCallContacts'],[db[_0x04c6('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x56')))),_0x04c6('0x5a')]]})[_0x04c6('0x1f')](handleEntityNotFound(_0x5b536f,null))[_0x04c6('0x1f')](respondWithResult(_0x5b536f,null))[_0x04c6('0x3e')](handleError(_0x5b536f,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x31cc93,_0x1b6242,_0x1f5b9a){return db[_0x04c6('0x5b')][_0x04c6('0x41')]({'where':{'id':_0x31cc93['params']['id']}})['then'](handleEntityNotFound(_0x1b6242,null))[_0x04c6('0x1f')](function(_0x598941){var _0x2df63b;if(_0x598941){_0x2df63b=squel['insert']()[_0x04c6('0x5c')](_0x04c6('0x5d'))['fromQuery']([_0x04c6('0x5e'),_0x04c6('0x5f'),_0x04c6('0x60'),_0x04c6('0x61'),_0x04c6('0x62'),_0x04c6('0x63'),_0x04c6('0x64')],squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x67'),_0x04c6('0x5e'))[_0x04c6('0x66')](_0x04c6('0x68'),'scheduledAt')[_0x04c6('0x66')](_0x04c6('0x69'),'ContactId')[_0x04c6('0x66')](_0x04c6('0x6a'),_0x04c6('0x61'))[_0x04c6('0x66')](_0x04c6('0x6b'),'VoiceQueueId')[_0x04c6('0x66')]('NOW()',_0x04c6('0x63'))['field'](_0x04c6('0x68'),_0x04c6('0x64'))[_0x04c6('0x6c')](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x6e'),_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())[_0x04c6('0x35')]('state\x20=\x20?',_0x31cc93[_0x04c6('0x45')][_0x04c6('0x70')]['toString']())[_0x04c6('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x04c6('0x35')](_0x04c6('0x71'),squel['select']()[_0x04c6('0x66')](_0x04c6('0x5e'))['from'](_0x04c6('0x5d'))[_0x04c6('0x35')]('VoiceQueueId\x20=\x20?',_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]()))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()['field']('calleridnum')['from'](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x6e'),_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where'](_0x04c6('0x72')))[_0x04c6('0x73')](_0x04c6('0x60')))[_0x04c6('0x6f')]();return db[_0x04c6('0x48')][_0x04c6('0x2b')](_0x2df63b);}return[];})[_0x04c6('0x1f')](respondWithResult(_0x1b6242,null))['catch'](handleError(_0x1b6242,null));};exports[_0x04c6('0x74')]=function(_0x4f258c,_0x202761,_0x480c74){return db['Campaign'][_0x04c6('0x41')]({'where':{'id':_0x4f258c['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x202761,null))[_0x04c6('0x1f')](function(_0x174de6){var _0x425d01;if(_0x174de6){_0x425d01=squel[_0x04c6('0x75')]()['into']('cm_hopper')[_0x04c6('0x76')]([_0x04c6('0x5e'),_0x04c6('0x5f'),_0x04c6('0x60'),_0x04c6('0x61'),_0x04c6('0x77'),'createdAt',_0x04c6('0x64')],squel['select']()['field'](_0x04c6('0x67'),_0x04c6('0x5e'))[_0x04c6('0x66')](_0x04c6('0x68'),_0x04c6('0x5f'))[_0x04c6('0x66')](_0x04c6('0x69'),_0x04c6('0x60'))[_0x04c6('0x66')](_0x04c6('0x6a'),_0x04c6('0x61'))['field'](_0x04c6('0x78'),'CampaignId')['field'](_0x04c6('0x68'),_0x04c6('0x63'))[_0x04c6('0x66')](_0x04c6('0x68'),_0x04c6('0x64'))[_0x04c6('0x6c')](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x79'),_0x4f258c[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where']('state\x20=\x20?',_0x4f258c[_0x04c6('0x45')][_0x04c6('0x70')]['toString']())[_0x04c6('0x35')](_0x04c6('0x7a'))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x5e'))[_0x04c6('0x6c')](_0x04c6('0x5d'))[_0x04c6('0x35')](_0x04c6('0x79'),_0x4f258c['params']['id'][_0x04c6('0x6f')]()))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x7b'))[_0x04c6('0x6c')](_0x04c6('0x6d'))['where'](_0x04c6('0x79'),_0x4f258c[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where']('state\x20=\x204'))['group'](_0x04c6('0x60')))[_0x04c6('0x6f')]();return db['sequelize'][_0x04c6('0x2b')](_0x425d01);}return[];})[_0x04c6('0x1f')](respondWithResult(_0x202761,null))[_0x04c6('0x3e')](handleError(_0x202761,null));};exports['checkContactHopper']=function(_0x343c1f,_0x485457,_0x1c0c74){return db[_0x04c6('0x7c')][_0x04c6('0x7d')]({'where':{'VoiceQueueId':_0x343c1f['body']['VoiceQueueId'],'CampaignId':_0x343c1f[_0x04c6('0x45')][_0x04c6('0x77')],'ContactId':_0x343c1f[_0x04c6('0x45')][_0x04c6('0x60')]}})['then'](handleEntityNotFound(_0x485457,null))['then'](function(_0x3e12a4){if(_0x3e12a4){return _0x3e12a4;}return null;})[_0x04c6('0x1f')](respondWithResult(_0x485457,null))[_0x04c6('0x3e')](handleError(_0x485457,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2e2eed7..1e38b11 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 _0x9eab=['bluebird','path','rimraf','../../config/environment','define','calleridnum','uniqueid','lodash','util','api'];(function(_0x5895e2,_0x57816c){var _0x3ebdd2=function(_0x17e4b8){while(--_0x17e4b8){_0x5895e2['push'](_0x5895e2['shift']());}};_0x3ebdd2(++_0x57816c);}(_0x9eab,0x183));var _0xb9ea=function(_0x1590c4,_0x2186b0){_0x1590c4=_0x1590c4-0x0;var _0x1c728a=_0x9eab[_0x1590c4];return _0x1c728a;};'use strict';var _=require(_0xb9ea('0x0'));var util=require(_0xb9ea('0x1'));var logger=require('../../config/logger')(_0xb9ea('0x2'));var moment=require('moment');var BPromise=require(_0xb9ea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9ea('0x4'));var rimraf=require(_0xb9ea('0x5'));var config=require(_0xb9ea('0x6'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x28a52b,_0x445657){return _0x28a52b[_0xb9ea('0x7')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xb9ea('0x8'),'fields':[_0xb9ea('0x8')]},{'name':_0xb9ea('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd8e=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xcd8e,0x1cd));var _0xecd8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcd8e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xecd8('0x0'));var util=require(_0xecd8('0x1'));var logger=require('../../config/logger')(_0xecd8('0x2'));var moment=require(_0xecd8('0x3'));var BPromise=require(_0xecd8('0x4'));var rp=require(_0xecd8('0x5'));var fs=require('fs');var path=require(_0xecd8('0x6'));var rimraf=require(_0xecd8('0x7'));var config=require(_0xecd8('0x8'));var attributes=require('./cmHopperFinal.attributes');module[_0xecd8('0x9')]=function(_0x23abdb,_0x4f7d00){return _0x23abdb[_0xecd8('0xa')]('CmHopperFinal',attributes,{'tableName':_0xecd8('0xb'),'paranoid':![],'indexes':[{'name':_0xecd8('0xc'),'fields':[_0xecd8('0xc')]},{'name':_0xecd8('0xd'),'fields':[_0xecd8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 94d6fce..97d8919 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x381d21,_0x25471a){var _0x54a3a3=function(_0x1abbbd){while(--_0x1abbbd){_0x381d21['push'](_0x381d21['shift']());}};_0x54a3a3(++_0x25471a);}(_0xb10b,0x12a));var _0xbb10=function(_0xb260f8,_0xc008c5){_0xb260f8=_0xb260f8-0x0;var _0x63096d=_0xb10b[_0xb260f8];return _0x63096d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4bed41,_0x24f728){var _0x1749e9=function(_0x35f74f){while(--_0x35f74f){_0x4bed41['push'](_0x4bed41['shift']());}};_0x1749e9(++_0x24f728);}(_0xb10b,0x12a));var _0xbb10=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0xb10b[_0x2de0a7];return _0x429437;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index f398e4a..20ef88c 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 _0x020c=['get','/describe','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','index'];(function(_0x910989,_0x2abee0){var _0x5d49df=function(_0x11d3bc){while(--_0x11d3bc){_0x910989['push'](_0x910989['shift']());}};_0x5d49df(++_0x2abee0);}(_0x020c,0xf8));var _0xc020=function(_0x4ff3d1,_0x15c737){_0x4ff3d1=_0x4ff3d1-0x0;var _0x32af0c=_0x020c[_0x4ff3d1];return _0x32af0c;};'use strict';var multer=require(_0xc020('0x0'));var util=require(_0xc020('0x1'));var path=require(_0xc020('0x2'));var timeout=require(_0xc020('0x3'));var express=require(_0xc020('0x4'));var router=express[_0xc020('0x5')]();var fs_extra=require(_0xc020('0x6'));var auth=require(_0xc020('0x7'));var interaction=require(_0xc020('0x8'));var config=require(_0xc020('0x9'));var controller=require(_0xc020('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xc020('0xb')]);router[_0xc020('0xc')](_0xc020('0xd'),auth[_0xc020('0xe')](),controller[_0xc020('0xf')]);router[_0xc020('0xc')](_0xc020('0x10'),auth['isAuthenticated'](),controller[_0xc020('0x11')]);router[_0xc020('0xc')](_0xc020('0x12'),auth[_0xc020('0xe')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xc020('0xc')](_0xc020('0x13'),auth[_0xc020('0xe')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xc020('0x14')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xc020('0x14')](_0xc020('0x15'),auth[_0xc020('0xe')](),controller[_0xc020('0x16')]);router[_0xc020('0x14')](_0xc020('0x17'),auth['isAuthenticated'](),controller['checkContactHopper']);router['put']('/:id',auth[_0xc020('0xe')](),controller[_0xc020('0x18')]);module[_0xc020('0x19')]=router; \ No newline at end of file +var _0x28a6=['checkContactHopper','put','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','moveContactsQueueCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal'];(function(_0x28fe2b,_0x1e4309){var _0x3deb08=function(_0x4e8b2b){while(--_0x4e8b2b){_0x28fe2b['push'](_0x28fe2b['shift']());}};_0x3deb08(++_0x1e4309);}(_0x28a6,0x8f));var _0x628a=function(_0x25ba6a,_0x4422d6){_0x25ba6a=_0x25ba6a-0x0;var _0x1be09a=_0x28a6[_0x25ba6a];return _0x1be09a;};'use strict';var multer=require(_0x628a('0x0'));var util=require(_0x628a('0x1'));var path=require(_0x628a('0x2'));var timeout=require(_0x628a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x628a('0x4'));var auth=require(_0x628a('0x5'));var interaction=require(_0x628a('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x628a('0x7')]('/',auth[_0x628a('0x8')](),controller[_0x628a('0x9')]);router[_0x628a('0x7')](_0x628a('0xa'),auth[_0x628a('0x8')](),controller['describe']);router[_0x628a('0x7')](_0x628a('0xb'),auth[_0x628a('0x8')](),controller['show']);router['get']('/voice/queue/countAttributes/:id',auth[_0x628a('0x8')](),controller[_0x628a('0xc')]);router['get'](_0x628a('0xd'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router['post']('/voice/queue/moveContacts/:id',auth[_0x628a('0x8')](),controller[_0x628a('0xe')]);router[_0x628a('0xf')]('/voice/campaign/moveContacts/:id',auth[_0x628a('0x8')](),controller[_0x628a('0x10')]);router[_0x628a('0xf')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x628a('0x11')]);router[_0x628a('0x12')](_0x628a('0xb'),auth[_0x628a('0x8')](),controller['update']);module[_0x628a('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index c18eda6..d1f128a 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 _0x4c4a=['STRING','BOOLEAN','sequelize','exports','INTEGER','DATE'];(function(_0x4d35fe,_0x3ba8f7){var _0x10e0d7=function(_0x484439){while(--_0x484439){_0x4d35fe['push'](_0x4d35fe['shift']());}};_0x10e0d7(++_0x3ba8f7);}(_0x4c4a,0x1d0));var _0xa4c4=function(_0x47434e,_0x2b6808){_0x47434e=_0x47434e-0x0;var _0xb964a8=_0x4c4a[_0x47434e];return _0xb964a8;};'use strict';var Sequelize=require(_0xa4c4('0x0'));module[_0xa4c4('0x1')]={'state':{'type':Sequelize[_0xa4c4('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xa4c4('0x3')]},'countbusyretry':{'type':Sequelize[_0xa4c4('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa4c4('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa4c4('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa4c4('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xa4c4('0x4')]},'calleridnum':{'type':Sequelize[_0xa4c4('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xa4c4('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xa4c4('0x3')]},'endtime':{'type':Sequelize[_0xa4c4('0x3')]},'ringtime':{'type':Sequelize[_0xa4c4('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa4c4('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa4c4('0x4')]},'campaign':{'type':Sequelize[_0xa4c4('0x4')]},'campaigntype':{'type':Sequelize[_0xa4c4('0x4')]},'membername':{'type':Sequelize[_0xa4c4('0x4')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xa4c4('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xa4c4('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa4c4('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa4c4('0x3')]},'recallme':{'type':Sequelize[_0xa4c4('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xa4c4('0x3')]},'edited':{'type':Sequelize[_0xa4c4('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xa4c4('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa4c4('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa4c4('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa4c4('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa4c4('0x4')]}}; \ No newline at end of file +var _0xa6f8=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x3eacc9,_0x5ef6a5){var _0x26a345=function(_0x3763bc){while(--_0x3763bc){_0x3eacc9['push'](_0x3eacc9['shift']());}};_0x26a345(++_0x5ef6a5);}(_0xa6f8,0x94));var _0x8a6f=function(_0x7c3555,_0x514fd9){_0x7c3555=_0x7c3555-0x0;var _0x49c4dc=_0xa6f8[_0x7c3555];return _0x49c4dc;};'use strict';var Sequelize=require(_0x8a6f('0x0'));module['exports']={'state':{'type':Sequelize[_0x8a6f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8a6f('0x2')]},'scheduledat':{'type':Sequelize[_0x8a6f('0x3')]},'countbusyretry':{'type':Sequelize[_0x8a6f('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8a6f('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8a6f('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8a6f('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8a6f('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x8a6f('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8a6f('0x2')]},'calleridname':{'type':Sequelize[_0x8a6f('0x2')]},'starttime':{'type':Sequelize[_0x8a6f('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x8a6f('0x3')]},'droptime':{'type':Sequelize[_0x8a6f('0x3')]},'endtime':{'type':Sequelize[_0x8a6f('0x3')]},'ringtime':{'type':Sequelize[_0x8a6f('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8a6f('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8a6f('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8a6f('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8a6f('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x8a6f('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8a6f('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8a6f('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8a6f('0x3')]},'edited':{'type':Sequelize[_0x8a6f('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8a6f('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8a6f('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index ed3b5a9..74034a4 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 _0x47fd=['merge','options','includeAll','include','findAll','rows','length','find','catch','create','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','json','apply','reject','update','then','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL'];(function(_0x3ecfa5,_0x20084e){var _0x546596=function(_0x5aac75){while(--_0x5aac75){_0x3ecfa5['push'](_0x3ecfa5['shift']());}};_0x546596(++_0x20084e);}(_0x47fd,0x1e8));var _0xd47f=function(_0x42334c,_0x379771){_0x42334c=_0x42334c-0x0;var _0x4feed7=_0x47fd[_0x42334c];return _0x4feed7;};'use strict';var emlformat=require(_0xd47f('0x0'));var rimraf=require(_0xd47f('0x1'));var zipdir=require(_0xd47f('0x2'));var jsonpatch=require(_0xd47f('0x3'));var rp=require(_0xd47f('0x4'));var moment=require(_0xd47f('0x5'));var BPromise=require(_0xd47f('0x6'));var Mustache=require(_0xd47f('0x7'));var util=require(_0xd47f('0x8'));var path=require(_0xd47f('0x9'));var sox=require('sox');var csv=require(_0xd47f('0xa'));var ejs=require(_0xd47f('0xb'));var fs=require('fs');var fs_extra=require(_0xd47f('0xc'));var _=require(_0xd47f('0xd'));var squel=require(_0xd47f('0xe'));var crypto=require('crypto');var jsforce=require(_0xd47f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd47f('0xa'));var querystring=require(_0xd47f('0x10'));var Papa=require(_0xd47f('0x11'));var Redis=require('ioredis');var authService=require(_0xd47f('0x12'));var qs=require(_0xd47f('0x13'));var as=require(_0xd47f('0x14'));var hardwareService=require(_0xd47f('0x15'));var logger=require(_0xd47f('0x16'))(_0xd47f('0x17'));var utils=require(_0xd47f('0x18'));var config=require(_0xd47f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd47f('0x1a'))['db'];function respondWithStatusCode(_0x3fce26,_0x521d9b){_0x521d9b=_0x521d9b||0xcc;return function(_0x4bc770){if(_0x4bc770){return _0x3fce26[_0xd47f('0x1b')](_0x521d9b);}return _0x3fce26[_0xd47f('0x1c')](_0x521d9b)[_0xd47f('0x1d')]();};}function respondWithResult(_0x493b9b,_0x57350f){_0x57350f=_0x57350f||0xc8;return function(_0x1e83ee){if(_0x1e83ee){return _0x493b9b[_0xd47f('0x1c')](_0x57350f)['json'](_0x1e83ee);}};}function respondWithFilteredResult(_0x5174b9,_0x59965b){return function(_0x1e711d){if(_0x1e711d){var _0x3a7847=typeof _0x59965b['offset']==='undefined'&&typeof _0x59965b[_0xd47f('0x1e')]===_0xd47f('0x1f');var _0x18178e=_0x1e711d['count'];var _0x2a5a56=_0x3a7847?0x0:_0x59965b['offset'];var _0x43441e=_0x3a7847?_0x1e711d[_0xd47f('0x20')]:_0x59965b[_0xd47f('0x21')]+_0x59965b['limit'];var _0xbaa0ad;if(_0x43441e>=_0x18178e){_0x43441e=_0x18178e;_0xbaa0ad=0xc8;}else{_0xbaa0ad=0xce;}_0x5174b9[_0xd47f('0x1c')](_0xbaa0ad);return _0x5174b9[_0xd47f('0x22')]('Content-Range',_0x2a5a56+'-'+_0x43441e+'/'+_0x18178e)[_0xd47f('0x23')](_0x1e711d);}return null;};}function patchUpdates(_0x1e949c){return function(_0x113512){try{jsonpatch[_0xd47f('0x24')](_0x113512,_0x1e949c,!![]);}catch(_0x3b0539){return BPromise[_0xd47f('0x25')](_0x3b0539);}return _0x113512['save']();};}function saveUpdates(_0x1fd88e,_0x6e425d){return function(_0x2ca9a9){if(_0x2ca9a9){return _0x2ca9a9[_0xd47f('0x26')](_0x1fd88e)[_0xd47f('0x27')](function(_0x4d1917){return _0x4d1917;});}return null;};}function removeEntity(_0x528c08,_0x156e94){return function(_0x158f8f){if(_0x158f8f){return _0x158f8f['destroy']()[_0xd47f('0x27')](function(){_0x528c08[_0xd47f('0x1c')](0xcc)[_0xd47f('0x1d')]();});}};}function handleEntityNotFound(_0x34216f,_0x165990){return function(_0x5774c9){if(!_0x5774c9){_0x34216f['sendStatus'](0x194);}return _0x5774c9;};}function handleError(_0x1ea68b,_0x3e93c6){_0x3e93c6=_0x3e93c6||0x1f4;return function(_0x22892b){logger['error'](_0x22892b[_0xd47f('0x28')]);if(_0x22892b[_0xd47f('0x29')]){delete _0x22892b[_0xd47f('0x29')];}_0x1ea68b[_0xd47f('0x1c')](_0x3e93c6)[_0xd47f('0x2a')](_0x22892b);};}exports[_0xd47f('0x2b')]=function(_0x507147,_0x2936af){var _0x307e5a={},_0x24ebb7={},_0x236a14={'count':0x0,'rows':[]};var _0xedfeac=_[_0xd47f('0x2c')](db[_0xd47f('0x2d')][_0xd47f('0x2e')],function(_0x51df76){return{'name':_0x51df76[_0xd47f('0x2f')],'type':_0x51df76[_0xd47f('0x30')][_0xd47f('0x31')]};});_0x24ebb7[_0xd47f('0x32')]=_[_0xd47f('0x2c')](_0xedfeac,'name');_0x24ebb7[_0xd47f('0x33')]=_[_0xd47f('0x34')](_0x507147[_0xd47f('0x33')]);_0x24ebb7[_0xd47f('0x35')]=_[_0xd47f('0x36')](_0x24ebb7['model'],_0x24ebb7[_0xd47f('0x33')]);_0x307e5a[_0xd47f('0x37')]=_[_0xd47f('0x36')](_0x24ebb7[_0xd47f('0x32')],qs[_0xd47f('0x38')](_0x507147[_0xd47f('0x33')][_0xd47f('0x38')]));_0x307e5a[_0xd47f('0x37')]=_0x307e5a[_0xd47f('0x37')]['length']?_0x307e5a[_0xd47f('0x37')]:_0x24ebb7['model'];if(!_0x507147[_0xd47f('0x33')][_0xd47f('0x39')](_0xd47f('0x3a'))){_0x307e5a[_0xd47f('0x1e')]=qs[_0xd47f('0x1e')](_0x507147[_0xd47f('0x33')][_0xd47f('0x1e')]);_0x307e5a[_0xd47f('0x21')]=qs[_0xd47f('0x21')](_0x507147[_0xd47f('0x33')][_0xd47f('0x21')]);}_0x307e5a[_0xd47f('0x3b')]=qs['sort'](_0x507147[_0xd47f('0x33')][_0xd47f('0x3c')]);_0x307e5a['where']=qs[_0xd47f('0x35')](_[_0xd47f('0x3d')](_0x507147['query'],_0x24ebb7[_0xd47f('0x35')]),_0xedfeac);if(_0x507147[_0xd47f('0x33')][_0xd47f('0x3e')]){_0x307e5a[_0xd47f('0x3f')]=_['merge'](_0x307e5a['where'],{'$or':_[_0xd47f('0x2c')](_0xedfeac,function(_0x332474){if(_0x332474[_0xd47f('0x30')]!==_0xd47f('0x40')){var _0xb20c99={};_0xb20c99[_0x332474[_0xd47f('0x29')]]={'$like':'%'+_0x507147[_0xd47f('0x33')][_0xd47f('0x3e')]+'%'};return _0xb20c99;}})});}_0x307e5a=_[_0xd47f('0x41')]({},_0x307e5a,_0x507147[_0xd47f('0x42')]);var _0x336b2a={'where':_0x307e5a[_0xd47f('0x3f')]};return db[_0xd47f('0x2d')]['count'](_0x336b2a)[_0xd47f('0x27')](function(_0x57eef0){_0x236a14['count']=_0x57eef0;if(_0x507147[_0xd47f('0x33')][_0xd47f('0x43')]){_0x307e5a[_0xd47f('0x44')]=[{'all':!![]}];}return db[_0xd47f('0x2d')][_0xd47f('0x45')](_0x307e5a);})[_0xd47f('0x27')](function(_0x3cfb36){_0x236a14[_0xd47f('0x46')]=_0x3cfb36;return _0x236a14;})[_0xd47f('0x27')](respondWithFilteredResult(_0x2936af,_0x307e5a))['catch'](handleError(_0x2936af,null));};exports['show']=function(_0x76c329,_0x3c1683){var _0x170b8f={'raw':!![],'where':{'id':_0x76c329['params']['id']}},_0x36c7f5={};_0x36c7f5[_0xd47f('0x32')]=_['keys'](db[_0xd47f('0x2d')][_0xd47f('0x2e')]);_0x36c7f5[_0xd47f('0x33')]=_['keys'](_0x76c329[_0xd47f('0x33')]);_0x36c7f5[_0xd47f('0x35')]=_[_0xd47f('0x36')](_0x36c7f5[_0xd47f('0x32')],_0x36c7f5[_0xd47f('0x33')]);_0x170b8f[_0xd47f('0x37')]=_[_0xd47f('0x36')](_0x36c7f5[_0xd47f('0x32')],qs[_0xd47f('0x38')](_0x76c329[_0xd47f('0x33')][_0xd47f('0x38')]));_0x170b8f[_0xd47f('0x37')]=_0x170b8f['attributes'][_0xd47f('0x47')]?_0x170b8f['attributes']:_0x36c7f5[_0xd47f('0x32')];if(_0x76c329[_0xd47f('0x33')][_0xd47f('0x43')]){_0x170b8f[_0xd47f('0x44')]=[{'all':!![]}];}_0x170b8f=_[_0xd47f('0x41')]({},_0x170b8f,_0x76c329[_0xd47f('0x42')]);return db[_0xd47f('0x2d')][_0xd47f('0x48')](_0x170b8f)[_0xd47f('0x27')](handleEntityNotFound(_0x3c1683,null))[_0xd47f('0x27')](respondWithResult(_0x3c1683,null))[_0xd47f('0x49')](handleError(_0x3c1683,null));};exports[_0xd47f('0x4a')]=function(_0x1a5cf4,_0x2d3b8b){return db['CmHopperHistory'][_0xd47f('0x4a')](_0x1a5cf4[_0xd47f('0x4b')],{})['then'](respondWithResult(_0x2d3b8b,0xc9))[_0xd47f('0x49')](handleError(_0x2d3b8b,null));};exports[_0xd47f('0x4c')]=function(_0x5a4747,_0x58f213){return db[_0xd47f('0x2d')][_0xd47f('0x4c')]()[_0xd47f('0x27')](respondWithResult(_0x58f213,null))['catch'](handleError(_0x58f213,null));};exports[_0xd47f('0x26')]=function(_0x40ac53,_0x3a57e5){if(_0x40ac53[_0xd47f('0x4b')][_0xd47f('0x4d')]){delete _0x40ac53[_0xd47f('0x4b')][_0xd47f('0x4d')];}return db[_0xd47f('0x2d')][_0xd47f('0x48')]({'where':{'uniqueid':_0x40ac53[_0xd47f('0x4e')]['id']}})[_0xd47f('0x27')](handleEntityNotFound(_0x3a57e5,null))[_0xd47f('0x27')](saveUpdates(_0x40ac53[_0xd47f('0x4b')],null))[_0xd47f('0x27')](respondWithResult(_0x3a57e5,null))[_0xd47f('0x49')](handleError(_0x3a57e5,null));}; \ No newline at end of file +var _0x7ad3=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','create','body','describe','update','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x1a4134,_0x110ba3){var _0xce32ce=function(_0x56edb5){while(--_0x56edb5){_0x1a4134['push'](_0x1a4134['shift']());}};_0xce32ce(++_0x110ba3);}(_0x7ad3,0x1da));var _0x37ad=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x7ad3[_0x468b0f];return _0x3e74d9;};'use strict';var emlformat=require(_0x37ad('0x0'));var rimraf=require(_0x37ad('0x1'));var zipdir=require(_0x37ad('0x2'));var jsonpatch=require(_0x37ad('0x3'));var rp=require(_0x37ad('0x4'));var moment=require(_0x37ad('0x5'));var BPromise=require(_0x37ad('0x6'));var Mustache=require(_0x37ad('0x7'));var util=require(_0x37ad('0x8'));var path=require('path');var sox=require(_0x37ad('0x9'));var csv=require(_0x37ad('0xa'));var ejs=require(_0x37ad('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x37ad('0xc'));var squel=require(_0x37ad('0xd'));var crypto=require(_0x37ad('0xe'));var jsforce=require(_0x37ad('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x37ad('0xa'));var querystring=require('querystring');var Papa=require(_0x37ad('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x37ad('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x37ad('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x37ad('0x13'));var licenseUtil=require(_0x37ad('0x14'));var db=require(_0x37ad('0x15'))['db'];function respondWithStatusCode(_0xe3eeed,_0x5ee405){_0x5ee405=_0x5ee405||0xcc;return function(_0x242057){if(_0x242057){return _0xe3eeed[_0x37ad('0x16')](_0x5ee405);}return _0xe3eeed[_0x37ad('0x17')](_0x5ee405)[_0x37ad('0x18')]();};}function respondWithResult(_0x98cf57,_0x12c37b){_0x12c37b=_0x12c37b||0xc8;return function(_0x2a8a47){if(_0x2a8a47){return _0x98cf57[_0x37ad('0x17')](_0x12c37b)[_0x37ad('0x19')](_0x2a8a47);}};}function respondWithFilteredResult(_0x2809d9,_0x239f4e){return function(_0x1d7a83){if(_0x1d7a83){var _0x42950e=typeof _0x239f4e[_0x37ad('0x1a')]==='undefined'&&typeof _0x239f4e[_0x37ad('0x1b')]==='undefined';var _0x11989c=_0x1d7a83[_0x37ad('0x1c')];var _0x58ea12=_0x42950e?0x0:_0x239f4e[_0x37ad('0x1a')];var _0x1dafc5=_0x42950e?_0x1d7a83[_0x37ad('0x1c')]:_0x239f4e['offset']+_0x239f4e[_0x37ad('0x1b')];var _0x2acb1c;if(_0x1dafc5>=_0x11989c){_0x1dafc5=_0x11989c;_0x2acb1c=0xc8;}else{_0x2acb1c=0xce;}_0x2809d9[_0x37ad('0x17')](_0x2acb1c);return _0x2809d9[_0x37ad('0x1d')](_0x37ad('0x1e'),_0x58ea12+'-'+_0x1dafc5+'/'+_0x11989c)[_0x37ad('0x19')](_0x1d7a83);}return null;};}function patchUpdates(_0x14dbf5){return function(_0xf111cf){try{jsonpatch['apply'](_0xf111cf,_0x14dbf5,!![]);}catch(_0x4d05fd){return BPromise['reject'](_0x4d05fd);}return _0xf111cf[_0x37ad('0x1f')]();};}function saveUpdates(_0x5521b1,_0x324e08){return function(_0x481018){if(_0x481018){return _0x481018['update'](_0x5521b1)[_0x37ad('0x20')](function(_0xe3389d){return _0xe3389d;});}return null;};}function removeEntity(_0x41faa1,_0x407afe){return function(_0x37bda4){if(_0x37bda4){return _0x37bda4[_0x37ad('0x21')]()[_0x37ad('0x20')](function(){_0x41faa1[_0x37ad('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x443dbc,_0x37eb40){return function(_0x25c4df){if(!_0x25c4df){_0x443dbc[_0x37ad('0x16')](0x194);}return _0x25c4df;};}function handleError(_0x56a0f5,_0x293dbe){_0x293dbe=_0x293dbe||0x1f4;return function(_0xf9e4d0){logger[_0x37ad('0x22')](_0xf9e4d0[_0x37ad('0x23')]);if(_0xf9e4d0[_0x37ad('0x24')]){delete _0xf9e4d0[_0x37ad('0x24')];}_0x56a0f5[_0x37ad('0x17')](_0x293dbe)[_0x37ad('0x25')](_0xf9e4d0);};}exports[_0x37ad('0x26')]=function(_0x1323ff,_0x5931c4){var _0x340fbc={},_0x1cbd46={},_0x5706ac={'count':0x0,'rows':[]};var _0x3e0334=_[_0x37ad('0x27')](db[_0x37ad('0x28')][_0x37ad('0x29')],function(_0x530815){return{'name':_0x530815[_0x37ad('0x2a')],'type':_0x530815[_0x37ad('0x2b')][_0x37ad('0x2c')]};});_0x1cbd46[_0x37ad('0x2d')]=_[_0x37ad('0x27')](_0x3e0334,_0x37ad('0x24'));_0x1cbd46[_0x37ad('0x2e')]=_[_0x37ad('0x2f')](_0x1323ff['query']);_0x1cbd46[_0x37ad('0x30')]=_[_0x37ad('0x31')](_0x1cbd46[_0x37ad('0x2d')],_0x1cbd46[_0x37ad('0x2e')]);_0x340fbc[_0x37ad('0x32')]=_[_0x37ad('0x31')](_0x1cbd46[_0x37ad('0x2d')],qs[_0x37ad('0x33')](_0x1323ff[_0x37ad('0x2e')]['fields']));_0x340fbc['attributes']=_0x340fbc[_0x37ad('0x32')][_0x37ad('0x34')]?_0x340fbc[_0x37ad('0x32')]:_0x1cbd46[_0x37ad('0x2d')];if(!_0x1323ff[_0x37ad('0x2e')][_0x37ad('0x35')](_0x37ad('0x36'))){_0x340fbc['limit']=qs[_0x37ad('0x1b')](_0x1323ff[_0x37ad('0x2e')][_0x37ad('0x1b')]);_0x340fbc['offset']=qs['offset'](_0x1323ff[_0x37ad('0x2e')][_0x37ad('0x1a')]);}_0x340fbc[_0x37ad('0x37')]=qs[_0x37ad('0x38')](_0x1323ff['query'][_0x37ad('0x38')]);_0x340fbc[_0x37ad('0x39')]=qs[_0x37ad('0x30')](_[_0x37ad('0x3a')](_0x1323ff['query'],_0x1cbd46[_0x37ad('0x30')]),_0x3e0334);if(_0x1323ff[_0x37ad('0x2e')]['filter']){_0x340fbc[_0x37ad('0x39')]=_[_0x37ad('0x3b')](_0x340fbc[_0x37ad('0x39')],{'$or':_[_0x37ad('0x27')](_0x3e0334,function(_0xa1c5c4){if(_0xa1c5c4['type']!==_0x37ad('0x3c')){var _0x5545a6={};_0x5545a6[_0xa1c5c4[_0x37ad('0x24')]]={'$like':'%'+_0x1323ff['query'][_0x37ad('0x3d')]+'%'};return _0x5545a6;}})});}_0x340fbc=_[_0x37ad('0x3b')]({},_0x340fbc,_0x1323ff[_0x37ad('0x3e')]);var _0x3a4bbb={'where':_0x340fbc[_0x37ad('0x39')]};return db[_0x37ad('0x28')][_0x37ad('0x1c')](_0x3a4bbb)[_0x37ad('0x20')](function(_0x26493d){_0x5706ac[_0x37ad('0x1c')]=_0x26493d;if(_0x1323ff[_0x37ad('0x2e')][_0x37ad('0x3f')]){_0x340fbc['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x37ad('0x40')](_0x340fbc);})[_0x37ad('0x20')](function(_0x8b13cf){_0x5706ac[_0x37ad('0x41')]=_0x8b13cf;return _0x5706ac;})['then'](respondWithFilteredResult(_0x5931c4,_0x340fbc))[_0x37ad('0x42')](handleError(_0x5931c4,null));};exports[_0x37ad('0x43')]=function(_0x505c52,_0x253872){var _0x2b8a8f={'raw':!![],'where':{'id':_0x505c52[_0x37ad('0x44')]['id']}},_0x1f7edc={};_0x1f7edc[_0x37ad('0x2d')]=_[_0x37ad('0x2f')](db[_0x37ad('0x28')][_0x37ad('0x29')]);_0x1f7edc['query']=_['keys'](_0x505c52[_0x37ad('0x2e')]);_0x1f7edc[_0x37ad('0x30')]=_[_0x37ad('0x31')](_0x1f7edc[_0x37ad('0x2d')],_0x1f7edc[_0x37ad('0x2e')]);_0x2b8a8f[_0x37ad('0x32')]=_[_0x37ad('0x31')](_0x1f7edc[_0x37ad('0x2d')],qs[_0x37ad('0x33')](_0x505c52['query'][_0x37ad('0x33')]));_0x2b8a8f['attributes']=_0x2b8a8f[_0x37ad('0x32')][_0x37ad('0x34')]?_0x2b8a8f[_0x37ad('0x32')]:_0x1f7edc['model'];if(_0x505c52['query']['includeAll']){_0x2b8a8f['include']=[{'all':!![]}];}_0x2b8a8f=_['merge']({},_0x2b8a8f,_0x505c52[_0x37ad('0x3e')]);return db[_0x37ad('0x28')]['find'](_0x2b8a8f)[_0x37ad('0x20')](handleEntityNotFound(_0x253872,null))[_0x37ad('0x20')](respondWithResult(_0x253872,null))[_0x37ad('0x42')](handleError(_0x253872,null));};exports[_0x37ad('0x45')]=function(_0x17baa7,_0x2424cf){return db['CmHopperHistory'][_0x37ad('0x45')](_0x17baa7[_0x37ad('0x46')],{})[_0x37ad('0x20')](respondWithResult(_0x2424cf,0xc9))[_0x37ad('0x42')](handleError(_0x2424cf,null));};exports[_0x37ad('0x47')]=function(_0x36475b,_0x4bd88b){return db[_0x37ad('0x28')][_0x37ad('0x47')]()[_0x37ad('0x20')](respondWithResult(_0x4bd88b,null))[_0x37ad('0x42')](handleError(_0x4bd88b,null));};exports[_0x37ad('0x48')]=function(_0x24d3c5,_0x17e45a){if(_0x24d3c5[_0x37ad('0x46')][_0x37ad('0x49')]){delete _0x24d3c5[_0x37ad('0x46')][_0x37ad('0x49')];}return db['CmHopperHistory'][_0x37ad('0x4a')]({'where':{'uniqueid':_0x24d3c5['params']['id']}})[_0x37ad('0x20')](handleEntityNotFound(_0x17e45a,null))[_0x37ad('0x20')](saveUpdates(_0x24d3c5[_0x37ad('0x46')],null))['then'](respondWithResult(_0x17e45a,null))[_0x37ad('0x42')](handleError(_0x17e45a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 7b03c37..e4e90ad 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 _0x72d7=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','./cmHopperHistory.attributes','exports'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x72d7,0x19b));var _0x772d=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x72d7[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x772d('0x0'));var util=require(_0x772d('0x1'));var logger=require(_0x772d('0x2'))(_0x772d('0x3'));var moment=require(_0x772d('0x4'));var BPromise=require(_0x772d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x772d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x772d('0x7'));module[_0x772d('0x8')]=function(_0x2b014d,_0x527450){return _0x2b014d[_0x772d('0x9')](_0x772d('0xa'),attributes,{'tableName':_0x772d('0xb'),'paranoid':![],'indexes':[{'name':_0x772d('0xc'),'fields':[_0x772d('0xc')]},{'name':_0x772d('0xd'),'fields':[_0x772d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50e5=['cm_hopper_history','endtime','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define'];(function(_0x4ac749,_0x3e27a4){var _0x358d88=function(_0x591ccd){while(--_0x591ccd){_0x4ac749['push'](_0x4ac749['shift']());}};_0x358d88(++_0x3e27a4);}(_0x50e5,0xb7));var _0x550e=function(_0x341b9c,_0x15b408){_0x341b9c=_0x341b9c-0x0;var _0x5d034c=_0x50e5[_0x341b9c];return _0x5d034c;};'use strict';var _=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var logger=require('../../config/logger')(_0x550e('0x2'));var moment=require(_0x550e('0x3'));var BPromise=require(_0x550e('0x4'));var rp=require(_0x550e('0x5'));var fs=require('fs');var path=require(_0x550e('0x6'));var rimraf=require(_0x550e('0x7'));var config=require(_0x550e('0x8'));var attributes=require(_0x550e('0x9'));module[_0x550e('0xa')]=function(_0x3d8c9b,_0x863e3b){return _0x3d8c9b[_0x550e('0xb')]('CmHopperHistory',attributes,{'tableName':_0x550e('0xc'),'paranoid':![],'indexes':[{'name':_0x550e('0xd'),'fields':['endtime']},{'name':_0x550e('0xe'),'fields':[_0x550e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 984ae27..176f17c 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 _0xad53=['code','message','result','CmHopperHistory','body','options','raw','CreateCmHopperHistory','debug','AvgHandleTime','findAll','where','col','predictiveIntervalTotalCalls','sequelize','predictiveIntervalAnsweredCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','catch','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x11decf,_0x46d65d){var _0x35bb52=function(_0x3325d6){while(--_0x3325d6){_0x11decf['push'](_0x11decf['shift']());}};_0x35bb52(++_0x46d65d);}(_0xad53,0x1ea));var _0x3ad5=function(_0x592864,_0x20bb1d){_0x592864=_0x592864-0x0;var _0x416298=_0xad53[_0x592864];return _0x416298;};'use strict';var _=require(_0x3ad5('0x0'));var util=require(_0x3ad5('0x1'));var moment=require(_0x3ad5('0x2'));var BPromise=require(_0x3ad5('0x3'));var rs=require(_0x3ad5('0x4'));var fs=require('fs');var Redis=require(_0x3ad5('0x5'));var db=require(_0x3ad5('0x6'))['db'];var utils=require(_0x3ad5('0x7'));var logger=require('../../config/logger')(_0x3ad5('0x8'));var config=require(_0x3ad5('0x9'));var jayson=require(_0x3ad5('0xa'));var client=jayson[_0x3ad5('0xb')][_0x3ad5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a7780,_0x5e8e41,_0x5c40d7){return new BPromise(function(_0x1ef667,_0x1262a4){return client[_0x3ad5('0xd')](_0x5a7780,_0x5c40d7)[_0x3ad5('0xe')](function(_0x17fd04){logger[_0x3ad5('0xf')](_0x3ad5('0x10'),_0x5e8e41,_0x3ad5('0x11'));logger['debug'](_0x3ad5('0x12'),_0x5e8e41,_0x3ad5('0x11'),JSON[_0x3ad5('0x13')](_0x17fd04));if(_0x17fd04[_0x3ad5('0x14')]){if(_0x17fd04['error'][_0x3ad5('0x15')]===0x1f4){logger[_0x3ad5('0x14')](_0x3ad5('0x10'),_0x5e8e41,_0x17fd04['error'][_0x3ad5('0x16')]);return _0x1262a4(_0x17fd04[_0x3ad5('0x14')][_0x3ad5('0x16')]);}logger[_0x3ad5('0x14')](_0x3ad5('0x10'),_0x5e8e41,_0x17fd04[_0x3ad5('0x14')]['message']);return _0x1ef667(_0x17fd04['error'][_0x3ad5('0x16')]);}else{logger[_0x3ad5('0xf')](_0x3ad5('0x10'),_0x5e8e41,_0x3ad5('0x11'));_0x1ef667(_0x17fd04[_0x3ad5('0x17')][_0x3ad5('0x16')]);}})['catch'](function(_0x56123a){logger[_0x3ad5('0x14')](_0x3ad5('0x10'),_0x5e8e41,_0x56123a);_0x1262a4(_0x56123a);});});}exports['CreateCmHopperHistory']=function(_0x5d557e){var _0x445741=this;return new Promise(function(_0xd8775,_0x179cda){return db[_0x3ad5('0x18')]['create'](_0x5d557e[_0x3ad5('0x19')],{'raw':_0x5d557e[_0x3ad5('0x1a')]?_0x5d557e[_0x3ad5('0x1a')][_0x3ad5('0x1b')]===undefined?!![]:![]:!![]})[_0x3ad5('0xe')](function(_0x1c37c7){logger[_0x3ad5('0xf')](_0x3ad5('0x1c'),_0x5d557e);logger[_0x3ad5('0x1d')]('CreateCmHopperHistory',_0x5d557e,JSON[_0x3ad5('0x13')](_0x1c37c7));_0xd8775(_0x1c37c7);})['catch'](function(_0x936a29){logger['error'](_0x3ad5('0x1c'),_0x936a29[_0x3ad5('0x16')],_0x5d557e);_0x179cda(_0x445741[_0x3ad5('0x14')](0x1f4,_0x936a29[_0x3ad5('0x16')]));});});};exports[_0x3ad5('0x1e')]=function(_0x26b402){var _0x4c59dc=this;return new Promise(function(_0x437b4c,_0x1aa2e9){return db['CmHopperHistory'][_0x3ad5('0x1f')]({'raw':_0x26b402[_0x3ad5('0x1a')]?_0x26b402[_0x3ad5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x26b402[_0x3ad5('0x1a')]?_0x26b402[_0x3ad5('0x1a')][_0x3ad5('0x20')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize'][_0x3ad5('0x21')]('id')),_0x3ad5('0x22')],[db[_0x3ad5('0x23')]['fn']('COUNT',db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x3ad5('0x24')],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')]('`state`\x20=\x2011,\x201,\x20null'))),_0x3ad5('0x28')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x29'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x2a')))),_0x3ad5('0x2b')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x29'),db['sequelize']['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x2c')))),_0x3ad5('0x2d')]]})[_0x3ad5('0xe')](function(_0x41240f){logger[_0x3ad5('0xf')]('AvgHandleTime',_0x26b402);logger['debug'](_0x3ad5('0x1e'),_0x26b402,JSON[_0x3ad5('0x13')](_0x41240f));_0x437b4c(_0x41240f);})['catch'](function(_0x1005ac){logger[_0x3ad5('0x14')](_0x3ad5('0x1e'),_0x1005ac[_0x3ad5('0x16')],_0x26b402);_0x1aa2e9(_0x4c59dc[_0x3ad5('0x14')](0x1f4,_0x1005ac[_0x3ad5('0x16')]));});});};exports[_0x3ad5('0x2e')]=function(_0x2f8bea){var _0x247f0c=this;return new Promise(function(_0x256c59,_0x13de0d){return db[_0x3ad5('0x18')][_0x3ad5('0x1f')]({'raw':_0x2f8bea['options']?_0x2f8bea[_0x3ad5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2f8bea[_0x3ad5('0x1a')]?_0x2f8bea[_0x3ad5('0x1a')][_0x3ad5('0x20')]||null:null,'attributes':[[_0x3ad5('0x2f'),_0x3ad5('0x30')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x25'),db['sequelize']['fn']('IF',db['sequelize'][_0x3ad5('0x26')](_0x3ad5('0x31')))),_0x3ad5('0x32')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x33')))),_0x3ad5('0x34')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x35')))),_0x3ad5('0x36')],[db[_0x3ad5('0x23')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')]('`state`\x20=\x205,\x201,\x20null'))),_0x3ad5('0x37')],[db['sequelize']['fn']('COUNT',db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x38')))),_0x3ad5('0x39')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x25'),db['sequelize']['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x3a')))),_0x3ad5('0x3b')],[db[_0x3ad5('0x23')]['fn']('COUNT',db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x3c')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn']('COUNT',db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x3d')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')]['literal'](_0x3ad5('0x3e')))),_0x3ad5('0x3f')],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0x3ad5('0x40')],[db['sequelize']['fn'](_0x3ad5('0x25'),db['sequelize']['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')]('`state`\x20=\x2018,\x201,\x20null'))),_0x3ad5('0x41')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x25'),db['sequelize']['fn']('IF',db['sequelize'][_0x3ad5('0x26')](_0x3ad5('0x42')))),_0x3ad5('0x43')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x25'),db['sequelize']['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')]('`state`\x20=\x2020,\x201,\x20null'))),_0x3ad5('0x41')],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x44')))),_0x3ad5('0x45')]],'group':[_0x3ad5('0x2f')]})[_0x3ad5('0xe')](function(_0x4506f6){logger[_0x3ad5('0xf')]('GetVoiceQueueHopperHistory',_0x2f8bea);logger[_0x3ad5('0x1d')](_0x3ad5('0x2e'),_0x2f8bea,JSON['stringify'](_0x4506f6));_0x256c59(_0x4506f6);})[_0x3ad5('0x46')](function(_0x543041){logger[_0x3ad5('0x14')]('GetVoiceQueueHopperHistory',_0x543041[_0x3ad5('0x16')],_0x2f8bea);_0x13de0d(_0x247f0c[_0x3ad5('0x14')](0x1f4,_0x543041['message']));});});};exports[_0x3ad5('0x47')]=function(_0x53e2e7){var _0x10e0a2=this;return new Promise(function(_0x164115,_0x35038a){return db['CmHopperHistory'][_0x3ad5('0x1f')]({'raw':_0x53e2e7['options']?_0x53e2e7[_0x3ad5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x53e2e7[_0x3ad5('0x1a')]?_0x53e2e7[_0x3ad5('0x1a')][_0x3ad5('0x20')]||null:null,'attributes':[[_0x3ad5('0x2f'),'name'],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')][_0x3ad5('0x21')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')]('`state`\x20=\x204,\x201,\x20null'))),_0x3ad5('0x48')]],'group':[_0x3ad5('0x2f')]})[_0x3ad5('0xe')](function(_0x3ff478){logger[_0x3ad5('0xf')](_0x3ad5('0x47'),_0x53e2e7);logger['debug']('GetCampaignHopperHistory',_0x53e2e7,JSON[_0x3ad5('0x13')](_0x3ff478));_0x164115(_0x3ff478);})[_0x3ad5('0x46')](function(_0x2e109e){logger['error']('GetCampaignHopperHistory',_0x2e109e['message'],_0x53e2e7);_0x35038a(_0x10e0a2['error'](0x1f4,_0x2e109e['message']));});});}; \ No newline at end of file +var _0xc964=['request\x20sent','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','CmHopperHistory','create','body','options','raw','then','catch','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','literal','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s,\x20%s'];(function(_0x239c72,_0x554a85){var _0x5da3f6=function(_0x2c8377){while(--_0x2c8377){_0x239c72['push'](_0x239c72['shift']());}};_0x5da3f6(++_0x554a85);}(_0xc964,0x7e));var _0x4c96=function(_0x44d666,_0x1ae48c){_0x44d666=_0x44d666-0x0;var _0x168d2f=_0xc964[_0x44d666];return _0x168d2f;};'use strict';var _=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var moment=require('moment');var BPromise=require(_0x4c96('0x2'));var rs=require(_0x4c96('0x3'));var fs=require('fs');var Redis=require(_0x4c96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c96('0x5'));var logger=require('../../config/logger')(_0x4c96('0x6'));var config=require(_0x4c96('0x7'));var jayson=require(_0x4c96('0x8'));var client=jayson[_0x4c96('0x9')][_0x4c96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fa8a0,_0x4070a5,_0x493618){return new BPromise(function(_0x19ed76,_0xaa3f20){return client[_0x4c96('0xb')](_0x1fa8a0,_0x493618)['then'](function(_0x208911){logger[_0x4c96('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x4070a5,'request\x20sent');logger['debug'](_0x4c96('0xd'),_0x4070a5,_0x4c96('0xe'),JSON[_0x4c96('0xf')](_0x208911));if(_0x208911['error']){if(_0x208911[_0x4c96('0x10')]['code']===0x1f4){logger['error'](_0x4c96('0x11'),_0x4070a5,_0x208911[_0x4c96('0x10')][_0x4c96('0x12')]);return _0xaa3f20(_0x208911['error']['message']);}logger[_0x4c96('0x10')](_0x4c96('0x11'),_0x4070a5,_0x208911[_0x4c96('0x10')]['message']);return _0x19ed76(_0x208911[_0x4c96('0x10')][_0x4c96('0x12')]);}else{logger[_0x4c96('0xc')](_0x4c96('0x11'),_0x4070a5,_0x4c96('0xe'));_0x19ed76(_0x208911[_0x4c96('0x13')][_0x4c96('0x12')]);}})['catch'](function(_0x388237){logger['error'](_0x4c96('0x11'),_0x4070a5,_0x388237);_0xaa3f20(_0x388237);});});}exports['CreateCmHopperHistory']=function(_0x2453e0){var _0x494a26=this;return new Promise(function(_0x17891b,_0x1807b6){return db[_0x4c96('0x14')][_0x4c96('0x15')](_0x2453e0[_0x4c96('0x16')],{'raw':_0x2453e0[_0x4c96('0x17')]?_0x2453e0[_0x4c96('0x17')][_0x4c96('0x18')]===undefined?!![]:![]:!![]})[_0x4c96('0x19')](function(_0x9546c5){logger[_0x4c96('0xc')]('CreateCmHopperHistory',_0x2453e0);logger['debug']('CreateCmHopperHistory',_0x2453e0,JSON[_0x4c96('0xf')](_0x9546c5));_0x17891b(_0x9546c5);})[_0x4c96('0x1a')](function(_0x29f3a3){logger[_0x4c96('0x10')](_0x4c96('0x1b'),_0x29f3a3[_0x4c96('0x12')],_0x2453e0);_0x1807b6(_0x494a26['error'](0x1f4,_0x29f3a3[_0x4c96('0x12')]));});});};exports[_0x4c96('0x1c')]=function(_0x2cabae){var _0x31a854=this;return new Promise(function(_0x2f6f93,_0x23fbfa){return db['CmHopperHistory'][_0x4c96('0x1d')]({'raw':_0x2cabae[_0x4c96('0x17')]?_0x2cabae['options'][_0x4c96('0x18')]===undefined?!![]:![]:!![],'where':_0x2cabae['options']?_0x2cabae[_0x4c96('0x17')][_0x4c96('0x1e')]||null:null,'attributes':[[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db['sequelize'][_0x4c96('0x21')]('id')),_0x4c96('0x22')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal'](_0x4c96('0x23')))),_0x4c96('0x24')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x4c96('0x25')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal'](_0x4c96('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x4c96('0x1f')]['fn']('AVG',db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x28')))),_0x4c96('0x29')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x2a'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x2b')))),_0x4c96('0x2c')]]})[_0x4c96('0x19')](function(_0xa1e751){logger[_0x4c96('0xc')]('AvgHandleTime',_0x2cabae);logger[_0x4c96('0x2d')](_0x4c96('0x1c'),_0x2cabae,JSON[_0x4c96('0xf')](_0xa1e751));_0x2f6f93(_0xa1e751);})['catch'](function(_0x299939){logger['error'](_0x4c96('0x1c'),_0x299939['message'],_0x2cabae);_0x23fbfa(_0x31a854[_0x4c96('0x10')](0x1f4,_0x299939[_0x4c96('0x12')]));});});};exports[_0x4c96('0x2e')]=function(_0x47c1ce){var _0x5d0f4e=this;return new Promise(function(_0x367230,_0x3cb0af){return db['CmHopperHistory'][_0x4c96('0x1d')]({'raw':_0x47c1ce[_0x4c96('0x17')]?_0x47c1ce[_0x4c96('0x17')][_0x4c96('0x18')]===undefined?!![]:![]:!![],'where':_0x47c1ce['options']?_0x47c1ce[_0x4c96('0x17')][_0x4c96('0x1e')]||null:null,'attributes':[[_0x4c96('0x2f'),_0x4c96('0x30')],[db[_0x4c96('0x1f')]['fn']('COUNT',db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal'](_0x4c96('0x31')))),_0x4c96('0x32')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')]('`state`\x20=\x203,\x201,\x20null'))),_0x4c96('0x33')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x23')))),_0x4c96('0x34')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db['sequelize']['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x35')))),_0x4c96('0x36')],[db[_0x4c96('0x1f')]['fn']('COUNT',db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x37')))),'outboundCongestionCallsDay'],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4c96('0x38')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4c96('0x39')],[db['sequelize']['fn']('COUNT',db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x3a')))),_0x4c96('0x3b')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal'](_0x4c96('0x3c')))),_0x4c96('0x3d')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db['sequelize'][_0x4c96('0x27')](_0x4c96('0x3e')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal'](_0x4c96('0x3f')))),_0x4c96('0x40')],[db['sequelize']['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x41')))),_0x4c96('0x40')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x42')))),'outboundReCallsDay']],'group':['campaign']})[_0x4c96('0x19')](function(_0x454b63){logger['info'](_0x4c96('0x2e'),_0x47c1ce);logger[_0x4c96('0x2d')](_0x4c96('0x2e'),_0x47c1ce,JSON[_0x4c96('0xf')](_0x454b63));_0x367230(_0x454b63);})[_0x4c96('0x1a')](function(_0x37d112){logger['error'](_0x4c96('0x2e'),_0x37d112['message'],_0x47c1ce);_0x3cb0af(_0x5d0f4e[_0x4c96('0x10')](0x1f4,_0x37d112[_0x4c96('0x12')]));});});};exports[_0x4c96('0x43')]=function(_0xb4e36d){var _0x3b0992=this;return new Promise(function(_0xd3b2c9,_0x5eac72){return db[_0x4c96('0x14')][_0x4c96('0x1d')]({'raw':_0xb4e36d[_0x4c96('0x17')]?_0xb4e36d['options'][_0x4c96('0x18')]===undefined?!![]:![]:!![],'where':_0xb4e36d['options']?_0xb4e36d[_0x4c96('0x17')][_0x4c96('0x1e')]||null:null,'attributes':[['campaign','name'],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')][_0x4c96('0x21')]('id')),_0x4c96('0x44')],[db[_0x4c96('0x1f')]['fn']('COUNT',db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x23')))),_0x4c96('0x45')]],'group':['campaign']})[_0x4c96('0x19')](function(_0x22dda3){logger[_0x4c96('0xc')](_0x4c96('0x43'),_0xb4e36d);logger['debug'](_0x4c96('0x43'),_0xb4e36d,JSON[_0x4c96('0xf')](_0x22dda3));_0xd3b2c9(_0x22dda3);})[_0x4c96('0x1a')](function(_0x388a9b){logger['error']('GetCampaignHopperHistory',_0x388a9b[_0x4c96('0x12')],_0xb4e36d);_0x5eac72(_0x3b0992['error'](0x1f4,_0x388a9b[_0x4c96('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 67722a3..3df52c5 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 _0x0761=['put','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x237fcb,_0x592357){var _0x4eafc6=function(_0x27c8ca){while(--_0x27c8ca){_0x237fcb['push'](_0x237fcb['shift']());}};_0x4eafc6(++_0x592357);}(_0x0761,0x1a5));var _0x1076=function(_0x56e527,_0x14733b){_0x56e527=_0x56e527-0x0;var _0x717a6b=_0x0761[_0x56e527];return _0x717a6b;};'use strict';var multer=require('multer');var util=require(_0x1076('0x0'));var path=require(_0x1076('0x1'));var timeout=require(_0x1076('0x2'));var express=require('express');var router=express[_0x1076('0x3')]();var fs_extra=require(_0x1076('0x4'));var auth=require(_0x1076('0x5'));var interaction=require(_0x1076('0x6'));var config=require(_0x1076('0x7'));var controller=require(_0x1076('0x8'));router[_0x1076('0x9')]('/',auth[_0x1076('0xa')](),controller[_0x1076('0xb')]);router[_0x1076('0x9')](_0x1076('0xc'),auth[_0x1076('0xa')](),controller[_0x1076('0xd')]);router['get'](_0x1076('0xe'),auth[_0x1076('0xa')](),controller['show']);router[_0x1076('0xf')]('/',auth[_0x1076('0xa')](),controller['create']);router[_0x1076('0x10')](_0x1076('0xe'),auth[_0x1076('0xa')](),controller[_0x1076('0x11')]);module[_0x1076('0x12')]=router; \ No newline at end of file +var _0x6ede=['get','/describe','isAuthenticated','describe','/:id','post','create','put','update','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6ede,0x91));var _0xe6ed=function(_0x522c6d,_0x4d250d){_0x522c6d=_0x522c6d-0x0;var _0x26300d=_0x6ede[_0x522c6d];return _0x26300d;};'use strict';var multer=require(_0xe6ed('0x0'));var util=require('util');var path=require(_0xe6ed('0x1'));var timeout=require('connect-timeout');var express=require(_0xe6ed('0x2'));var router=express[_0xe6ed('0x3')]();var fs_extra=require(_0xe6ed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe6ed('0x5'));var config=require(_0xe6ed('0x6'));var controller=require(_0xe6ed('0x7'));router[_0xe6ed('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe6ed('0x9'),auth[_0xe6ed('0xa')](),controller[_0xe6ed('0xb')]);router[_0xe6ed('0x8')](_0xe6ed('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xe6ed('0xd')]('/',auth[_0xe6ed('0xa')](),controller[_0xe6ed('0xe')]);router[_0xe6ed('0xf')](_0xe6ed('0xc'),auth[_0xe6ed('0xa')](),controller[_0xe6ed('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index e24a11c..0cb3274 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 _0xfa2b=['exports','STRING','name','sequelize'];(function(_0x39f4cb,_0x1e6403){var _0x477b48=function(_0x5ae344){while(--_0x5ae344){_0x39f4cb['push'](_0x39f4cb['shift']());}};_0x477b48(++_0x1e6403);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x2662f,_0x5538fd){_0x2662f=_0x2662f-0x0;var _0x28e298=_0xfa2b[_0x2662f];return _0x28e298;};'use strict';var Sequelize=require(_0xbfa2('0x0'));module[_0xbfa2('0x1')]={'name':{'type':Sequelize[_0xbfa2('0x2')],'unique':_0xbfa2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbfa2('0x2')]},'dialPrefix':{'type':Sequelize[_0xbfa2('0x2')]}}; \ No newline at end of file +var _0xe0c3=['sequelize','STRING','name'];(function(_0x27f144,_0x2a2440){var _0x4ab9be=function(_0x2c640c){while(--_0x2c640c){_0x27f144['push'](_0x27f144['shift']());}};_0x4ab9be(++_0x2a2440);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x3e0c('0x0'));module['exports']={'name':{'type':Sequelize[_0x3e0c('0x1')],'unique':_0x3e0c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3e0c('0x1')]},'dialPrefix':{'type':Sequelize[_0x3e0c('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 2500632..e163b46 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 _0xe951=['c.cf_','alias','field','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','sequelize','transaction','CmCustomField','addCustomFields','TEXT','Sequelize','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','info','message','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','name','send','index','CmList','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','describe','Disposition','getDispositions','findOne','order','ListId','include','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','omit','success','dataValues','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','findAll','select','from','c.ListId\x20=\x20?'];(function(_0x54622b,_0x388fce){var _0x303c2c=function(_0x3a9f28){while(--_0x3a9f28){_0x54622b['push'](_0x54622b['shift']());}};_0x303c2c(++_0x388fce);}(_0xe951,0xca));var _0x1e95=function(_0x2972cf,_0x343fde){_0x2972cf=_0x2972cf-0x0;var _0x4c173f=_0xe951[_0x2972cf];return _0x4c173f;};'use strict';var emlformat=require(_0x1e95('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e95('0x1'));var jsonpatch=require(_0x1e95('0x2'));var rp=require(_0x1e95('0x3'));var moment=require(_0x1e95('0x4'));var BPromise=require(_0x1e95('0x5'));var Mustache=require(_0x1e95('0x6'));var util=require(_0x1e95('0x7'));var path=require('path');var sox=require(_0x1e95('0x8'));var csv=require('to-csv');var ejs=require(_0x1e95('0x9'));var fs=require('fs');var fs_extra=require(_0x1e95('0xa'));var _=require(_0x1e95('0xb'));var squel=require(_0x1e95('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1e95('0xd'));var toCsv=require(_0x1e95('0xe'));var querystring=require(_0x1e95('0xf'));var Papa=require('papaparse');var Redis=require(_0x1e95('0x10'));var authService=require(_0x1e95('0x11'));var qs=require(_0x1e95('0x12'));var as=require(_0x1e95('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e95('0x14'))(_0x1e95('0x15'));var utils=require(_0x1e95('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1e95('0x17'));var db=require(_0x1e95('0x18'))['db'];var csv_results;config['redis']=_[_0x1e95('0x19')](config[_0x1e95('0x1a')],{'host':_0x1e95('0x1b'),'port':0x18eb});var socket=require(_0x1e95('0x1c'))(new Redis(config[_0x1e95('0x1a')]));require(_0x1e95('0x1d'))[_0x1e95('0x1e')](socket);function respondWithStatusCode(_0x459383,_0x48348d){_0x48348d=_0x48348d||0xcc;return function(_0x30b8b4){if(_0x30b8b4){return _0x459383[_0x1e95('0x1f')](_0x48348d);}return _0x459383[_0x1e95('0x20')](_0x48348d)[_0x1e95('0x21')]();};}function respondWithResult(_0x1fbb3e,_0x44b8d3){_0x44b8d3=_0x44b8d3||0xc8;return function(_0x52d641){if(_0x52d641){return _0x1fbb3e['status'](_0x44b8d3)[_0x1e95('0x22')](_0x52d641);}};}function respondWithFilteredResult(_0x34eb9c,_0x4ae3a8){return function(_0xa1ccb8){if(_0xa1ccb8){var _0x137829=typeof _0x4ae3a8['offset']==='undefined'&&typeof _0x4ae3a8[_0x1e95('0x23')]==='undefined';var _0x1019c9=_0xa1ccb8[_0x1e95('0x24')];var _0x455b06=_0x137829?0x0:_0x4ae3a8[_0x1e95('0x25')];var _0x51c095=_0x137829?_0xa1ccb8[_0x1e95('0x24')]:_0x4ae3a8[_0x1e95('0x25')]+_0x4ae3a8[_0x1e95('0x23')];var _0x4190dd;if(_0x51c095>=_0x1019c9){_0x51c095=_0x1019c9;_0x4190dd=0xc8;}else{_0x4190dd=0xce;}_0x34eb9c['status'](_0x4190dd);return _0x34eb9c[_0x1e95('0x26')](_0x1e95('0x27'),_0x455b06+'-'+_0x51c095+'/'+_0x1019c9)[_0x1e95('0x22')](_0xa1ccb8);}return null;};}function patchUpdates(_0x562cc9){return function(_0x30fde1){try{jsonpatch['apply'](_0x30fde1,_0x562cc9,!![]);}catch(_0x2d0183){return BPromise[_0x1e95('0x28')](_0x2d0183);}return _0x30fde1[_0x1e95('0x29')]();};}function saveUpdates(_0x29196b,_0x2d4508){return function(_0x959311){if(_0x959311){return _0x959311[_0x1e95('0x2a')](_0x29196b)['then'](function(_0x1b86a9){return _0x1b86a9;});}return null;};}function removeEntity(_0x573703,_0x3b2027){return function(_0x9b9990){if(_0x9b9990){return _0x9b9990[_0x1e95('0x2b')]()[_0x1e95('0x2c')](function(){var _0x355ed9=_0x9b9990[_0x1e95('0x2d')]({'plain':!![]});var _0x39baf5=_0x1e95('0x2e');return db[_0x1e95('0x2f')]['destroy']({'where':{'type':_0x39baf5,'resourceId':_0x355ed9['id']}})['then'](function(){return _0x9b9990;});})[_0x1e95('0x2c')](function(){_0x573703[_0x1e95('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24edef,_0x4a7752){return function(_0x45f913){if(!_0x45f913){_0x24edef[_0x1e95('0x1f')](0x194);}return _0x45f913;};}function handleError(_0x394c47,_0x49a55c){_0x49a55c=_0x49a55c||0x1f4;return function(_0x299435){logger[_0x1e95('0x30')](_0x299435['stack']);if(_0x299435[_0x1e95('0x31')]){delete _0x299435[_0x1e95('0x31')];}_0x394c47[_0x1e95('0x20')](_0x49a55c)[_0x1e95('0x32')](_0x299435);};}exports[_0x1e95('0x33')]=function(_0x558708,_0x3ef5fb){var _0x57b7f0={},_0x1006b0={},_0x2d6026={'count':0x0,'rows':[]};var _0x3ab0d0=_['map'](db[_0x1e95('0x34')][_0x1e95('0x35')],function(_0x4d7bb3){return{'name':_0x4d7bb3['fieldName'],'type':_0x4d7bb3[_0x1e95('0x36')][_0x1e95('0x37')]};});_0x1006b0['model']=_[_0x1e95('0x38')](_0x3ab0d0,_0x1e95('0x31'));_0x1006b0['query']=_['keys'](_0x558708[_0x1e95('0x39')]);_0x1006b0[_0x1e95('0x3a')]=_['intersection'](_0x1006b0['model'],_0x1006b0[_0x1e95('0x39')]);_0x57b7f0['attributes']=_[_0x1e95('0x3b')](_0x1006b0[_0x1e95('0x3c')],qs[_0x1e95('0x3d')](_0x558708[_0x1e95('0x39')]['fields']));_0x57b7f0['attributes']=_0x57b7f0[_0x1e95('0x3e')][_0x1e95('0x3f')]?_0x57b7f0[_0x1e95('0x3e')]:_0x1006b0[_0x1e95('0x3c')];if(!_0x558708[_0x1e95('0x39')][_0x1e95('0x40')](_0x1e95('0x41'))){_0x57b7f0[_0x1e95('0x23')]=qs['limit'](_0x558708[_0x1e95('0x39')][_0x1e95('0x23')]);_0x57b7f0[_0x1e95('0x25')]=qs[_0x1e95('0x25')](_0x558708[_0x1e95('0x39')][_0x1e95('0x25')]);}_0x57b7f0['order']=qs['sort'](_0x558708[_0x1e95('0x39')][_0x1e95('0x42')]);_0x57b7f0['where']=qs['filters'](_[_0x1e95('0x43')](_0x558708['query'],_0x1006b0[_0x1e95('0x3a')]),_0x3ab0d0);if(_0x558708['query'][_0x1e95('0x44')]){_0x57b7f0[_0x1e95('0x45')]=_['merge'](_0x57b7f0[_0x1e95('0x45')],{'$or':_['map'](_0x3ab0d0,function(_0x4194a4){if(_0x4194a4[_0x1e95('0x36')]!==_0x1e95('0x46')){var _0x3c5ee1={};_0x3c5ee1[_0x4194a4[_0x1e95('0x31')]]={'$like':'%'+_0x558708[_0x1e95('0x39')]['filter']+'%'};return _0x3c5ee1;}})});}_0x57b7f0=_[_0x1e95('0x47')]({},_0x57b7f0,_0x558708[_0x1e95('0x48')]);var _0x205379={'where':_0x57b7f0[_0x1e95('0x45')]};return db['CmList'][_0x1e95('0x24')](_0x205379)[_0x1e95('0x2c')](function(_0xd03c2a){_0x2d6026[_0x1e95('0x24')]=_0xd03c2a;if(_0x558708[_0x1e95('0x39')][_0x1e95('0x49')]){_0x57b7f0['include']=[{'all':!![]}];}return db['CmList']['findAll'](_0x57b7f0);})[_0x1e95('0x2c')](function(_0x462349){_0x2d6026[_0x1e95('0x4a')]=_0x462349;return _0x2d6026;})[_0x1e95('0x2c')](respondWithFilteredResult(_0x3ef5fb,_0x57b7f0))[_0x1e95('0x4b')](handleError(_0x3ef5fb,null));};exports[_0x1e95('0x4c')]=function(_0x5c19a5,_0xf7220c){var _0x139c32={'raw':![],'where':{'id':_0x5c19a5['params']['id']}},_0x4aa526={};_0x4aa526['model']=_[_0x1e95('0x4d')](db['CmList'][_0x1e95('0x35')]);_0x4aa526[_0x1e95('0x39')]=_[_0x1e95('0x4d')](_0x5c19a5[_0x1e95('0x39')]);_0x4aa526['filters']=_[_0x1e95('0x3b')](_0x4aa526[_0x1e95('0x3c')],_0x4aa526[_0x1e95('0x39')]);_0x139c32[_0x1e95('0x3e')]=_['intersection'](_0x4aa526[_0x1e95('0x3c')],qs[_0x1e95('0x3d')](_0x5c19a5['query'][_0x1e95('0x3d')]));_0x139c32[_0x1e95('0x3e')]=_0x139c32[_0x1e95('0x3e')]['length']?_0x139c32[_0x1e95('0x3e')]:_0x4aa526[_0x1e95('0x3c')];if(_0x5c19a5[_0x1e95('0x39')][_0x1e95('0x49')]){_0x139c32['include']=[{'all':!![]}];}_0x139c32=_[_0x1e95('0x47')]({},_0x139c32,_0x5c19a5[_0x1e95('0x48')]);return db[_0x1e95('0x34')][_0x1e95('0x4e')](_0x139c32)[_0x1e95('0x2c')](handleEntityNotFound(_0xf7220c,null))[_0x1e95('0x2c')](respondWithResult(_0xf7220c,null))[_0x1e95('0x4b')](handleError(_0xf7220c,null));};exports[_0x1e95('0x4f')]=function(_0x2ac544,_0x19c614){return db[_0x1e95('0x34')][_0x1e95('0x4f')](_0x2ac544[_0x1e95('0x50')],{})['then'](function(_0x5118c7){var _0x2d05b5=_0x2ac544[_0x1e95('0x51')][_0x1e95('0x2d')]({'plain':!![]});if(!_0x2d05b5)throw new Error(_0x1e95('0x52'));if(_0x2d05b5['role']===_0x1e95('0x51')){var _0x3dbc7d=_0x5118c7[_0x1e95('0x2d')]({'plain':!![]});var _0x17f596=_0x1e95('0x2e');return db[_0x1e95('0x53')][_0x1e95('0x4e')]({'where':{'name':_0x17f596,'userProfileId':_0x2d05b5[_0x1e95('0x54')]},'raw':!![]})[_0x1e95('0x2c')](function(_0x36e925){if(_0x36e925&&_0x36e925[_0x1e95('0x55')]===0x0){return db[_0x1e95('0x2f')][_0x1e95('0x4f')]({'name':_0x3dbc7d[_0x1e95('0x31')],'resourceId':_0x3dbc7d['id'],'type':_0x36e925[_0x1e95('0x31')],'sectionId':_0x36e925['id']},{})[_0x1e95('0x2c')](function(){return _0x5118c7;});}else{return _0x5118c7;}})[_0x1e95('0x4b')](function(_0x49e10a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49e10a);throw _0x49e10a;});}return _0x5118c7;})[_0x1e95('0x2c')](respondWithResult(_0x19c614,0xc9))[_0x1e95('0x4b')](handleError(_0x19c614,null));};exports[_0x1e95('0x2a')]=function(_0x5c7dc1,_0x1828af){if(_0x5c7dc1[_0x1e95('0x50')]['id']){delete _0x5c7dc1['body']['id'];}return db[_0x1e95('0x34')][_0x1e95('0x4e')]({'where':{'id':_0x5c7dc1[_0x1e95('0x56')]['id']}})['then'](handleEntityNotFound(_0x1828af,null))['then'](saveUpdates(_0x5c7dc1['body'],null))['then'](respondWithResult(_0x1828af,null))[_0x1e95('0x4b')](handleError(_0x1828af,null));};exports[_0x1e95('0x2b')]=function(_0x4e2684,_0x405b27){return db['CmList'][_0x1e95('0x4e')]({'where':{'id':_0x4e2684[_0x1e95('0x56')]['id']}})[_0x1e95('0x2c')](handleEntityNotFound(_0x405b27,null))[_0x1e95('0x2c')](removeEntity(_0x405b27,null))[_0x1e95('0x4b')](handleError(_0x405b27,null));};exports[_0x1e95('0x57')]=function(_0x9102a3,_0x1ba780){return db[_0x1e95('0x34')]['describe']()[_0x1e95('0x2c')](respondWithResult(_0x1ba780,null))[_0x1e95('0x4b')](handleError(_0x1ba780,null));};exports['addDisposition']=function(_0x45b265,_0x380814,_0x19b466){if(_0x45b265['body']['id']){delete _0x45b265[_0x1e95('0x50')]['id'];}return db[_0x1e95('0x34')][_0x1e95('0x4e')]({'where':{'id':_0x45b265[_0x1e95('0x56')]['id']}})[_0x1e95('0x2c')](handleEntityNotFound(_0x380814,null))[_0x1e95('0x2c')](function(_0x1f0868){if(_0x1f0868){_0x45b265[_0x1e95('0x50')]['ListId']=_0x1f0868['id'];return db[_0x1e95('0x58')][_0x1e95('0x4f')](_0x45b265[_0x1e95('0x50')]);}})[_0x1e95('0x2c')](respondWithResult(_0x380814,null))[_0x1e95('0x4b')](handleError(_0x380814,null));};exports[_0x1e95('0x59')]=function(_0x5563b2,_0x364808,_0x47a74a){var _0x2d321e={'raw':![],'where':{}};var _0x508535={};var _0x23c7f4={'count':0x0,'rows':[]};return db['CmList'][_0x1e95('0x5a')]({'where':{'id':_0x5563b2[_0x1e95('0x56')]['id']}})[_0x1e95('0x2c')](handleEntityNotFound(_0x364808,null))[_0x1e95('0x2c')](function(_0xb0670d){if(_0xb0670d){_0x508535[_0x1e95('0x3c')]=_[_0x1e95('0x4d')](db[_0x1e95('0x58')][_0x1e95('0x35')]);_0x508535[_0x1e95('0x39')]=_[_0x1e95('0x4d')](_0x5563b2['query']);_0x508535[_0x1e95('0x3a')]=_[_0x1e95('0x3b')](_0x508535[_0x1e95('0x3c')],_0x508535[_0x1e95('0x39')]);_0x2d321e[_0x1e95('0x3e')]=_[_0x1e95('0x3b')](_0x508535['model'],qs[_0x1e95('0x3d')](_0x5563b2[_0x1e95('0x39')]['fields']));_0x2d321e[_0x1e95('0x3e')]=_0x2d321e[_0x1e95('0x3e')][_0x1e95('0x3f')]?_0x2d321e[_0x1e95('0x3e')]:_0x508535[_0x1e95('0x3c')];if(!_0x5563b2[_0x1e95('0x39')][_0x1e95('0x40')](_0x1e95('0x41'))){_0x2d321e[_0x1e95('0x23')]=qs[_0x1e95('0x23')](_0x5563b2[_0x1e95('0x39')][_0x1e95('0x23')]);_0x2d321e[_0x1e95('0x25')]=qs[_0x1e95('0x25')](_0x5563b2['query'][_0x1e95('0x25')]);}_0x2d321e[_0x1e95('0x5b')]=qs[_0x1e95('0x42')](_0x5563b2[_0x1e95('0x39')]['sort']);_0x2d321e[_0x1e95('0x45')]=qs[_0x1e95('0x3a')](_[_0x1e95('0x43')](_0x5563b2[_0x1e95('0x39')],_0x508535[_0x1e95('0x3a')]));_0x2d321e[_0x1e95('0x45')][_0x1e95('0x5c')]=_0xb0670d['id'];if(_0x5563b2['query'][_0x1e95('0x44')]){_0x2d321e[_0x1e95('0x45')]=_[_0x1e95('0x47')](_0x2d321e[_0x1e95('0x45')],{'$or':_[_0x1e95('0x38')](_0x2d321e[_0x1e95('0x3e')],function(_0x3d54e7){var _0x3d0fe1={};_0x3d0fe1[_0x3d54e7]={'$like':'%'+_0x5563b2[_0x1e95('0x39')]['filter']+'%'};return _0x3d0fe1;})});}_0x2d321e=_[_0x1e95('0x47')]({},_0x2d321e,_0x5563b2[_0x1e95('0x48')]);return db['Disposition'][_0x1e95('0x24')]({'where':_0x2d321e[_0x1e95('0x45')]})[_0x1e95('0x2c')](function(_0x1b1865){_0x23c7f4[_0x1e95('0x24')]=_0x1b1865;if(_0x5563b2[_0x1e95('0x39')][_0x1e95('0x49')]){_0x2d321e[_0x1e95('0x5d')]=[{'all':!![]}];}return db[_0x1e95('0x58')]['findAll'](_0x2d321e);})[_0x1e95('0x2c')](function(_0x39c232){_0x23c7f4[_0x1e95('0x4a')]=_0x39c232;return _0x23c7f4;});}})[_0x1e95('0x2c')](respondWithFilteredResult(_0x364808,_0x2d321e))['catch'](handleError(_0x364808,null));};exports[_0x1e95('0x5e')]=function(_0x3ba0dd,_0x3b973b,_0x10049f){return db[_0x1e95('0x34')][_0x1e95('0x4e')]({'where':{'id':_0x3ba0dd[_0x1e95('0x56')]['id']}})[_0x1e95('0x2c')](handleEntityNotFound(_0x3b973b,null))[_0x1e95('0x2c')](function(_0x4c513c){if(_0x4c513c){return _0x4c513c['removeDispositions'](_0x3ba0dd[_0x1e95('0x39')][_0x1e95('0x5f')]);}})[_0x1e95('0x2c')](respondWithStatusCode(_0x3b973b,null))[_0x1e95('0x4b')](handleError(_0x3b973b,null));};exports[_0x1e95('0x60')]=function(_0x3ac68e,_0x4b0a82,_0x44bc93){return db[_0x1e95('0x34')][_0x1e95('0x4e')]({'where':{'id':_0x3ac68e['params']['id']}})[_0x1e95('0x2c')](handleEntityNotFound(_0x4b0a82,null))[_0x1e95('0x2c')](function(_0x2c4b67){if(_0x2c4b67){var _0x317c4e=[];var _0x4c8eed={'success':[],'errors':[]};return db[_0x1e95('0x61')][_0x1e95('0x57')]()[_0x1e95('0x2c')](function(_0x5abf30){if(_0x3ac68e[_0x1e95('0x50')][_0x1e95('0x62')]&&_[_0x1e95('0x63')](_0x3ac68e['body']['tags'])){if(_0x3ac68e[_0x1e95('0x50')]['tags'][_0x1e95('0x3f')]){_0x3ac68e['body'][_0x1e95('0x62')]=_0x3ac68e[_0x1e95('0x50')]['tags'][_0x1e95('0x64')](';')+';';}else{_0x3ac68e[_0x1e95('0x50')][_0x1e95('0x62')]=null;}}else{_0x3ac68e[_0x1e95('0x50')][_0x1e95('0x62')]=null;}if(_0x3ac68e['body']&&_['isArray'](_0x3ac68e[_0x1e95('0x50')])){for(var _0x49d4fb=0x0;_0x49d4fb<_0x3ac68e[_0x1e95('0x50')][_0x1e95('0x3f')];_0x49d4fb+=0x1){_0x3ac68e[_0x1e95('0x50')][_0x49d4fb][_0x1e95('0x5c')]=_0x3ac68e['params']['id'];_0x317c4e[_0x1e95('0x65')](_0x3ac68e['body'][_0x49d4fb]);}return BPromise['each'](_0x317c4e,function(_0x1a2491){return db[_0x1e95('0x61')][_0x1e95('0x4f')](_[_0x1e95('0x66')](_0x1a2491,[_0x1e95('0x5f'),'id'])||{},{'fields':_['keys'](_0x5abf30),'raw':!![]})[_0x1e95('0x2c')](function(_0x17c6aa){_0x4c8eed[_0x1e95('0x67')][_0x1e95('0x65')](_0x17c6aa[_0x1e95('0x68')]);})[_0x1e95('0x4b')](function(_0x2de078){_0x4c8eed['errors']['push']({'data':_0x1a2491,'error':_0x2de078['message']});});})[_0x1e95('0x2c')](function(_0x217ffd){return _0x4c8eed;})['catch'](function(_0x5d6d87){return _0x5d6d87;});}else{_0x4b0a82[_0x1e95('0x20')](0x190)[_0x1e95('0x22')]({'message':_0x1e95('0x69')});}});}})[_0x1e95('0x2c')](respondWithResult(_0x4b0a82,null))[_0x1e95('0x4b')](handleError(_0x4b0a82,null));};exports[_0x1e95('0x6a')]=function(_0x5ee404,_0x3c86a6,_0x2a107a){var _0x2e9828;return db[_0x1e95('0x34')][_0x1e95('0x4e')]({'where':{'id':_0x5ee404[_0x1e95('0x56')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x1e95('0x6b')}]})['then'](handleEntityNotFound(_0x3c86a6,null))[_0x1e95('0x2c')](function(_0x24dfe9){if(_0x24dfe9){_0x2e9828=_0x24dfe9;return db['CmContact'][_0x1e95('0x35')];}})['then'](function(_0x4e14c7){if(_0x4e14c7){var _0x17a945={};var _0x333441={};_0x333441[_0x1e95('0x3c')]=_[_0x1e95('0x6c')](_[_0x1e95('0x4d')](_0x4e14c7),_[_0x1e95('0x38')](_0x2e9828[_0x1e95('0x6b')],function(_0x153297){return util[_0x1e95('0x6d')](_0x1e95('0x6e'),_0x153297['id']);}));_0x333441[_0x1e95('0x39')]=_[_0x1e95('0x4d')](_0x5ee404['query']);_0x333441[_0x1e95('0x3a')]=_[_0x1e95('0x3b')](_0x333441['model'],_0x333441[_0x1e95('0x39')]);_0x17a945[_0x1e95('0x3e')]=_[_0x1e95('0x3b')](_0x333441[_0x1e95('0x3c')],qs[_0x1e95('0x3d')](_0x5ee404[_0x1e95('0x39')][_0x1e95('0x3d')]));_0x17a945['attributes']=_0x17a945[_0x1e95('0x3e')]['length']?_0x17a945['attributes']:_0x333441[_0x1e95('0x3c')];if(!_0x5ee404[_0x1e95('0x39')][_0x1e95('0x40')](_0x1e95('0x41'))){_0x17a945['limit']=qs['limit'](_0x5ee404['query'][_0x1e95('0x23')]);_0x17a945[_0x1e95('0x25')]=qs[_0x1e95('0x25')](_0x5ee404[_0x1e95('0x39')][_0x1e95('0x25')]);}_0x17a945['order']=qs[_0x1e95('0x42')](_0x5ee404['query'][_0x1e95('0x42')]);_0x17a945['where']=qs[_0x1e95('0x3a')](_['pick'](_0x5ee404[_0x1e95('0x39')],_0x333441['filters']));_0x17a945[_0x1e95('0x6f')]=!![];if(_0x5ee404[_0x1e95('0x39')][_0x1e95('0x44')]){_0x17a945[_0x1e95('0x45')]=_[_0x1e95('0x47')](_0x17a945[_0x1e95('0x45')],{'$or':_['map'](_0x17a945[_0x1e95('0x3e')],function(_0x578c97){var _0x3bd6d3={};_0x3bd6d3[_0x578c97]={'$like':'%'+_0x5ee404[_0x1e95('0x39')]['filter']+'%'};return _0x3bd6d3;})});}_0x17a945=_['merge']({},_0x17a945,_0x5ee404[_0x1e95('0x48')]);return _0x2e9828[_0x1e95('0x6a')](_0x17a945);}})[_0x1e95('0x2c')](respondWithResult(_0x3c86a6,null))[_0x1e95('0x4b')](handleError(_0x3c86a6,null));};exports['getContactsCsv']=function(_0xdb84a5,_0x49f9d9,_0x3f0b81){var _0xfd042d;var _0xf9ea0d;var _0xb839ea;var _0x313ca8=_0xdb84a5['params']['id'];csv_results=[];return db['ContactItemType'][_0x1e95('0x70')]({'attributes':['id','name'],'raw':!![],'order':['OrderBy']})[_0x1e95('0x2c')](function(_0x40aebf){_0xfd042d=_0x40aebf;var _0x4ee6d2=_[_0x1e95('0x4d')](db[_0x1e95('0x61')][_0x1e95('0x35')]);return db['CmCustomField'][_0x1e95('0x70')]({'raw':!![],'attributes':['id','alias']})[_0x1e95('0x2c')](function(_0x270278){_0xf9ea0d=_0x270278;var _0x308310=squel[_0x1e95('0x71')]()[_0x1e95('0x3d')](_0x4ee6d2)[_0x1e95('0x72')]('cm_contacts','c')[_0x1e95('0x45')](_0x1e95('0x73'),_0x313ca8)[_0x1e95('0x45')]('c.deletedAt\x20is\x20null')['distinct']();for(var _0x1cfa37=0x0;_0x1cfa37<_0xf9ea0d[_0x1e95('0x3f')];_0x1cfa37++){_0x308310['field'](_0x1e95('0x74')+_0xf9ea0d[_0x1cfa37]['id'],'customField_'+_0xf9ea0d[_0x1cfa37][_0x1e95('0x75')]);}for(var _0x1cfa37=0x0;_0x1cfa37<_0xfd042d[_0x1e95('0x3f')];_0x1cfa37++){_0x308310['field'](squel['select']()[_0x1e95('0x76')]('item')[_0x1e95('0x72')](_0x1e95('0x77'))[_0x1e95('0x45')](_0x1e95('0x78'),_0xfd042d[_0x1cfa37]['id'])[_0x1e95('0x45')](_0x1e95('0x79')),_0x1e95('0x7a')+_0xfd042d[_0x1cfa37][_0x1e95('0x31')]);_0x308310[_0x1e95('0x76')](squel['select']()[_0x1e95('0x76')](_0x1e95('0x7b'))[_0x1e95('0x72')](_0x1e95('0x77'))[_0x1e95('0x45')](_0x1e95('0x78'),_0xfd042d[_0x1cfa37]['id'])[_0x1e95('0x45')](_0x1e95('0x79')),_0x1e95('0x7c')+_0xfd042d[_0x1cfa37][_0x1e95('0x31')]);}var _0x2f2946=[];_0x2f2946['push'](_0x308310['toString']());BPromise['each'](_0x2f2946,handleQuery)['then'](function(_0x4d29a9){handleQuery(_0x308310[_0x1e95('0x7d')]());var _0x7327c3=csv_results[0x0];if(!_[_0x1e95('0x7e')](_0x7327c3)){var _0x13d281=toCsv(_0x7327c3);var _0x1a2f0c=Date[_0x1e95('0x7f')]();fs[_0x1e95('0x80')](util[_0x1e95('0x6d')](_0x1e95('0x81'),_0x313ca8,_0x1a2f0c),_0x13d281);_0x49f9d9[_0x1e95('0x82')]('Content-disposition',_0x1e95('0x83')+util[_0x1e95('0x6d')]('list_%d_%s.csv',_0x313ca8,_0x1a2f0c));_0x49f9d9[_0x1e95('0x82')](_0x1e95('0x84'),_0x1e95('0x85'));return _0x49f9d9[_0x1e95('0x86')](util[_0x1e95('0x6d')](_0x1e95('0x81'),_0x313ca8,_0x1a2f0c));}else{return _0x49f9d9[_0x1e95('0x1f')](0xcc);}});});});};exports[_0x1e95('0x87')]=function(_0xb7fa7b,_0x258d87,_0x4450b2){var _0x865670;delete _0xb7fa7b[_0x1e95('0x50')]['id'];return db[_0x1e95('0x34')][_0x1e95('0x5a')]({'where':{'id':_0xb7fa7b[_0x1e95('0x56')]['id']}})[_0x1e95('0x2c')](handleEntityNotFound(_0x258d87,null))['then'](function(_0x176de6){if(_0x176de6){return db[_0x1e95('0x88')][_0x1e95('0x89')](function(_0x4836fb){return db[_0x1e95('0x8a')]['create'](_0xb7fa7b['body'],{'transaction':_0x4836fb})['then'](function(_0x56a263){_0x865670=_0x56a263;return _0x176de6[_0x1e95('0x8b')](_0x56a263,{'transaction':_0x4836fb});})[_0x1e95('0x2c')](function(){var _0x4053b9={'type':db['Sequelize'][_0x1e95('0x8c')],'transaction':_0x4836fb};switch(_0xb7fa7b[_0x1e95('0x50')][_0x1e95('0x36')]){case'text':_0x4053b9[_0x1e95('0x36')]=db[_0x1e95('0x8d')]['TEXT'];break;case'number':_0x4053b9[_0x1e95('0x36')]=db[_0x1e95('0x8d')]['INTEGER'];break;case'switch':_0x4053b9[_0x1e95('0x36')]=db[_0x1e95('0x8d')][_0x1e95('0x8e')];_0x4053b9[_0x1e95('0x8f')]=![];break;default:}return db[_0x1e95('0x88')][_0x1e95('0x90')][_0x1e95('0x91')]('cm_contacts',util['format'](_0x1e95('0x92'),_0x865670['id']),_0x4053b9);})[_0x1e95('0x2c')](function(){return _0x865670;});});}})['then'](respondWithResult(_0x258d87,null))[_0x1e95('0x4b')](handleError(_0x258d87,null));};exports[_0x1e95('0x93')]=function(_0x56760f,_0x4dd8de,_0x56b635){var _0xe00d68={};var _0x188a8={};var _0x251f1a;var _0x148c2c;return db[_0x1e95('0x34')][_0x1e95('0x5a')]({'where':{'id':_0x56760f[_0x1e95('0x56')]['id']}})[_0x1e95('0x2c')](handleEntityNotFound(_0x4dd8de,null))[_0x1e95('0x2c')](function(_0x57ff3c){if(_0x57ff3c){_0x251f1a=_0x57ff3c;_0x188a8['model']=_[_0x1e95('0x4d')](db[_0x1e95('0x8a')][_0x1e95('0x35')]);_0x188a8[_0x1e95('0x39')]=_['keys'](_0x56760f[_0x1e95('0x39')]);_0x188a8[_0x1e95('0x3a')]=_['intersection'](_0x188a8[_0x1e95('0x3c')],_0x188a8[_0x1e95('0x39')]);_0xe00d68[_0x1e95('0x3e')]=_['intersection'](_0x188a8[_0x1e95('0x3c')],qs[_0x1e95('0x3d')](_0x56760f[_0x1e95('0x39')]['fields']));_0xe00d68['attributes']=_0xe00d68[_0x1e95('0x3e')][_0x1e95('0x3f')]?_0xe00d68[_0x1e95('0x3e')]:_0x188a8[_0x1e95('0x3c')];_0xe00d68[_0x1e95('0x5b')]=qs[_0x1e95('0x42')](_0x56760f[_0x1e95('0x39')]['sort']);_0xe00d68['where']=qs[_0x1e95('0x3a')](_[_0x1e95('0x43')](_0x56760f[_0x1e95('0x39')],_0x188a8['filters']));_0xe00d68[_0x1e95('0x45')]=_[_0x1e95('0x47')](_0xe00d68[_0x1e95('0x45')],{'$or':[{'ListId':_0x57ff3c['id']},{'ListId':null}]});if(_0x56760f['query'][_0x1e95('0x44')]){_0xe00d68['where']=_['merge'](_0xe00d68[_0x1e95('0x45')],{'$or':_['map'](_0xe00d68[_0x1e95('0x3e')],function(_0xfc9f72){var _0x1225fb={};_0x1225fb[_0xfc9f72]={'$like':'%'+_0x56760f[_0x1e95('0x39')][_0x1e95('0x44')]+'%'};return _0x1225fb;})});}_0xe00d68=_[_0x1e95('0x47')]({},_0xe00d68,_0x56760f[_0x1e95('0x48')]);return db[_0x1e95('0x8a')][_0x1e95('0x94')](_0xe00d68);}})[_0x1e95('0x2c')](respondWithResult(_0x4dd8de,null))[_0x1e95('0x4b')](handleError(_0x4dd8de,null));};exports[_0x1e95('0x95')]=function(_0x17e867,_0x4b5155){return db[_0x1e95('0x8a')]['findAndCountAll']({'where':{'ListId':null}})[_0x1e95('0x2c')](handleEntityNotFound(_0x4b5155,null))[_0x1e95('0x2c')](function(_0x736d00){return _0x736d00;})[_0x1e95('0x2c')](respondWithResult(_0x4b5155,null))['catch'](handleError(_0x4b5155,null));};exports['addAgents']=function(_0x49955f,_0x5d4b05,_0x32f8eb){return db[_0x1e95('0x34')]['find']({'where':{'id':_0x49955f['params']['id']}})[_0x1e95('0x2c')](handleEntityNotFound(_0x5d4b05,null))[_0x1e95('0x2c')](function(_0x533779){if(_0x533779){return _0x533779[_0x1e95('0x96')](_0x49955f['body'][_0x1e95('0x5f')],_['omit'](_0x49955f[_0x1e95('0x50')],[_0x1e95('0x5f'),'id'])||{})[_0x1e95('0x97')](function(_0x175c38){for(var _0x516058=0x0;_0x516058<_0x49955f[_0x1e95('0x50')][_0x1e95('0x5f')][_0x1e95('0x3f')];_0x516058+=0x1){socket[_0x1e95('0x98')]('userCmList:save',{'UserId':Number(_0x49955f[_0x1e95('0x50')][_0x1e95('0x5f')][_0x516058]),'CmListId':Number(_0x49955f[_0x1e95('0x56')]['id'])});}return _0x175c38;});}})[_0x1e95('0x2c')](respondWithResult(_0x5d4b05,null))[_0x1e95('0x4b')](handleError(_0x5d4b05,null));};exports['removeAgents']=function(_0x5ce8ca,_0x1be76b,_0x5d181f){return db['CmList'][_0x1e95('0x4e')]({'where':{'id':_0x5ce8ca[_0x1e95('0x56')]['id']}})['then'](handleEntityNotFound(_0x1be76b,null))[_0x1e95('0x2c')](function(_0x1ea120){if(_0x1ea120){return _0x1ea120[_0x1e95('0x99')](_0x5ce8ca[_0x1e95('0x39')][_0x1e95('0x5f')])[_0x1e95('0x2c')](function(){if(_[_0x1e95('0x63')](_0x5ce8ca[_0x1e95('0x39')][_0x1e95('0x5f')])){for(var _0x14c9de=0x0;_0x14c9de<_0x5ce8ca[_0x1e95('0x39')]['ids'][_0x1e95('0x3f')];_0x14c9de+=0x1){socket[_0x1e95('0x98')](_0x1e95('0x9a'),{'UserId':Number(_0x5ce8ca[_0x1e95('0x39')][_0x1e95('0x5f')][_0x14c9de]),'CmListId':Number(_0x5ce8ca['params']['id'])});}}else{socket['emit'](_0x1e95('0x9a'),{'UserId':Number(_0x5ce8ca[_0x1e95('0x39')]['ids']),'CmListId':Number(_0x5ce8ca[_0x1e95('0x56')]['id'])});}});}})[_0x1e95('0x2c')](respondWithStatusCode(_0x1be76b,null))['catch'](handleError(_0x1be76b,null));};exports[_0x1e95('0x9b')]=function(_0x45eebe,_0x1d2aae,_0x438248){var _0x2704ce={};var _0x300d67={};var _0x28bb97;var _0x10a16d;return db[_0x1e95('0x34')]['findOne']({'where':{'id':_0x45eebe['params']['id']}})[_0x1e95('0x2c')](handleEntityNotFound(_0x1d2aae,null))[_0x1e95('0x2c')](function(_0x25883e){if(_0x25883e){_0x28bb97=_0x25883e;_0x300d67[_0x1e95('0x3c')]=_[_0x1e95('0x4d')](db[_0x1e95('0x9c')][_0x1e95('0x35')]);_0x300d67[_0x1e95('0x39')]=_[_0x1e95('0x4d')](_0x45eebe[_0x1e95('0x39')]);_0x300d67[_0x1e95('0x3a')]=_['intersection'](_0x300d67[_0x1e95('0x3c')],_0x300d67[_0x1e95('0x39')]);_0x2704ce[_0x1e95('0x3e')]=_[_0x1e95('0x3b')](_0x300d67[_0x1e95('0x3c')],qs['fields'](_0x45eebe[_0x1e95('0x39')][_0x1e95('0x3d')]));_0x2704ce[_0x1e95('0x3e')]=_0x2704ce[_0x1e95('0x3e')]['length']?_0x2704ce[_0x1e95('0x3e')]:_0x300d67[_0x1e95('0x3c')];_0x2704ce[_0x1e95('0x5b')]=qs[_0x1e95('0x42')](_0x45eebe[_0x1e95('0x39')][_0x1e95('0x42')]);_0x2704ce[_0x1e95('0x45')]=qs['filters'](_['pick'](_0x45eebe['query'],_0x300d67['filters']));if(_0x45eebe[_0x1e95('0x39')][_0x1e95('0x44')]){_0x2704ce[_0x1e95('0x45')]=_['merge'](_0x2704ce[_0x1e95('0x45')],{'$or':_[_0x1e95('0x38')](_0x2704ce[_0x1e95('0x3e')],function(_0x412c1c){var _0xa2d22b={};_0xa2d22b[_0x412c1c]={'$like':'%'+_0x45eebe[_0x1e95('0x39')][_0x1e95('0x44')]+'%'};return _0xa2d22b;})});}_0x2704ce=_[_0x1e95('0x47')]({},_0x2704ce,_0x45eebe['options']);return _0x28bb97['getAgents'](_0x2704ce);}})[_0x1e95('0x2c')](function(_0xc28e77){if(_0xc28e77){_0x10a16d=_0xc28e77[_0x1e95('0x3f')];if(!_0x45eebe[_0x1e95('0x39')][_0x1e95('0x40')](_0x1e95('0x41'))){_0x2704ce[_0x1e95('0x23')]=qs[_0x1e95('0x23')](_0x45eebe[_0x1e95('0x39')][_0x1e95('0x23')]);_0x2704ce[_0x1e95('0x25')]=qs[_0x1e95('0x25')](_0x45eebe[_0x1e95('0x39')][_0x1e95('0x25')]);}return _0x28bb97[_0x1e95('0x9b')](_0x2704ce);}})['then'](function(_0x1892df){if(_0x1892df){return _0x1892df?{'count':_0x10a16d,'rows':_0x1892df}:null;}})[_0x1e95('0x2c')](respondWithResult(_0x1d2aae,null))[_0x1e95('0x4b')](handleError(_0x1d2aae,null));};function handleQuery(_0x2e5c4d){logger[_0x1e95('0x9d')](_0x2e5c4d);return db[_0x1e95('0x88')][_0x1e95('0x39')](_0x2e5c4d)[_0x1e95('0x97')](function(_0xb1fa89){csv_results['push'](_0xb1fa89);})[_0x1e95('0x4b')](function(_0x5aaec5){logger[_0x1e95('0x30')](_0x5aaec5[_0x1e95('0x9e')]);});} \ No newline at end of file +var _0x9754=['success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','ContactItemType','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','text/csv','addCustomField','sequelize','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','ids','spread','emit','userCmList:save','userCmList:remove','User','getAgents','info','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','get','Lists','UserProfileResource','destroy','send','index','map','rawAttributes','fieldName','key','name','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','CmList','findAll','catch','show','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','params','describe','addDisposition','ListId','Disposition','findOne','pick','includeAll','rows','removeDispositions','addContacts','CmContact','tags','isArray','join','push','each','omit'];(function(_0x9a64ce,_0x526ebf){var _0x407a96=function(_0x1c2cc1){while(--_0x1c2cc1){_0x9a64ce['push'](_0x9a64ce['shift']());}};_0x407a96(++_0x526ebf);}(_0x9754,0xda));var _0x4975=function(_0x2f2c1d,_0x13f6a3){_0x2f2c1d=_0x2f2c1d-0x0;var _0x422b21=_0x9754[_0x2f2c1d];return _0x422b21;};'use strict';var emlformat=require(_0x4975('0x0'));var rimraf=require(_0x4975('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4975('0x2'));var rp=require('request-promise');var moment=require(_0x4975('0x3'));var BPromise=require(_0x4975('0x4'));var Mustache=require(_0x4975('0x5'));var util=require(_0x4975('0x6'));var path=require('path');var sox=require(_0x4975('0x7'));var csv=require(_0x4975('0x8'));var ejs=require(_0x4975('0x9'));var fs=require('fs');var fs_extra=require(_0x4975('0xa'));var _=require(_0x4975('0xb'));var squel=require(_0x4975('0xc'));var crypto=require('crypto');var jsforce=require(_0x4975('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4975('0x8'));var querystring=require('querystring');var Papa=require(_0x4975('0xe'));var Redis=require(_0x4975('0xf'));var authService=require(_0x4975('0x10'));var qs=require(_0x4975('0x11'));var as=require(_0x4975('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4975('0x13'))(_0x4975('0x14'));var utils=require('../../config/utils');var config=require(_0x4975('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config[_0x4975('0x16')]=_[_0x4975('0x17')](config[_0x4975('0x16')],{'host':_0x4975('0x18'),'port':0x18eb});var socket=require(_0x4975('0x19'))(new Redis(config[_0x4975('0x16')]));require(_0x4975('0x1a'))[_0x4975('0x1b')](socket);function respondWithStatusCode(_0x417e81,_0x50ff5e){_0x50ff5e=_0x50ff5e||0xcc;return function(_0x1f329a){if(_0x1f329a){return _0x417e81[_0x4975('0x1c')](_0x50ff5e);}return _0x417e81[_0x4975('0x1d')](_0x50ff5e)[_0x4975('0x1e')]();};}function respondWithResult(_0xb7a541,_0x3e273b){_0x3e273b=_0x3e273b||0xc8;return function(_0x2e5276){if(_0x2e5276){return _0xb7a541[_0x4975('0x1d')](_0x3e273b)[_0x4975('0x1f')](_0x2e5276);}};}function respondWithFilteredResult(_0x394c99,_0x3faab6){return function(_0x24180b){if(_0x24180b){var _0x104610=typeof _0x3faab6['offset']===_0x4975('0x20')&&typeof _0x3faab6[_0x4975('0x21')]===_0x4975('0x20');var _0xcfa9d1=_0x24180b['count'];var _0x4bb090=_0x104610?0x0:_0x3faab6[_0x4975('0x22')];var _0x3540d1=_0x104610?_0x24180b[_0x4975('0x23')]:_0x3faab6['offset']+_0x3faab6['limit'];var _0x47a6d5;if(_0x3540d1>=_0xcfa9d1){_0x3540d1=_0xcfa9d1;_0x47a6d5=0xc8;}else{_0x47a6d5=0xce;}_0x394c99[_0x4975('0x1d')](_0x47a6d5);return _0x394c99[_0x4975('0x24')](_0x4975('0x25'),_0x4bb090+'-'+_0x3540d1+'/'+_0xcfa9d1)[_0x4975('0x1f')](_0x24180b);}return null;};}function patchUpdates(_0xfb3c10){return function(_0x36e603){try{jsonpatch[_0x4975('0x26')](_0x36e603,_0xfb3c10,!![]);}catch(_0x513d6f){return BPromise[_0x4975('0x27')](_0x513d6f);}return _0x36e603['save']();};}function saveUpdates(_0x5eb0bc,_0x49af06){return function(_0x40316d){if(_0x40316d){return _0x40316d[_0x4975('0x28')](_0x5eb0bc)[_0x4975('0x29')](function(_0x1d058d){return _0x1d058d;});}return null;};}function removeEntity(_0xfa8d7e,_0xa72852){return function(_0x114391){if(_0x114391){return _0x114391['destroy']()[_0x4975('0x29')](function(){var _0x26bffc=_0x114391[_0x4975('0x2a')]({'plain':!![]});var _0x5ccf75=_0x4975('0x2b');return db[_0x4975('0x2c')][_0x4975('0x2d')]({'where':{'type':_0x5ccf75,'resourceId':_0x26bffc['id']}})[_0x4975('0x29')](function(){return _0x114391;});})[_0x4975('0x29')](function(){_0xfa8d7e[_0x4975('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9aef7a,_0x12c02c){return function(_0x2ba412){if(!_0x2ba412){_0x9aef7a[_0x4975('0x1c')](0x194);}return _0x2ba412;};}function handleError(_0x27c972,_0x236e50){_0x236e50=_0x236e50||0x1f4;return function(_0x314304){logger['error'](_0x314304['stack']);if(_0x314304['name']){delete _0x314304['name'];}_0x27c972[_0x4975('0x1d')](_0x236e50)[_0x4975('0x2e')](_0x314304);};}exports[_0x4975('0x2f')]=function(_0x14a9cc,_0x25e653){var _0x313da0={},_0x26a860={},_0x24dd5e={'count':0x0,'rows':[]};var _0x16f41f=_[_0x4975('0x30')](db['CmList'][_0x4975('0x31')],function(_0x2c39c1){return{'name':_0x2c39c1[_0x4975('0x32')],'type':_0x2c39c1['type'][_0x4975('0x33')]};});_0x26a860['model']=_[_0x4975('0x30')](_0x16f41f,_0x4975('0x34'));_0x26a860[_0x4975('0x35')]=_[_0x4975('0x36')](_0x14a9cc['query']);_0x26a860['filters']=_['intersection'](_0x26a860[_0x4975('0x37')],_0x26a860[_0x4975('0x35')]);_0x313da0[_0x4975('0x38')]=_[_0x4975('0x39')](_0x26a860[_0x4975('0x37')],qs[_0x4975('0x3a')](_0x14a9cc['query'][_0x4975('0x3a')]));_0x313da0['attributes']=_0x313da0['attributes'][_0x4975('0x3b')]?_0x313da0[_0x4975('0x38')]:_0x26a860[_0x4975('0x37')];if(!_0x14a9cc[_0x4975('0x35')][_0x4975('0x3c')](_0x4975('0x3d'))){_0x313da0[_0x4975('0x21')]=qs[_0x4975('0x21')](_0x14a9cc[_0x4975('0x35')]['limit']);_0x313da0['offset']=qs[_0x4975('0x22')](_0x14a9cc[_0x4975('0x35')]['offset']);}_0x313da0[_0x4975('0x3e')]=qs[_0x4975('0x3f')](_0x14a9cc[_0x4975('0x35')][_0x4975('0x3f')]);_0x313da0[_0x4975('0x40')]=qs[_0x4975('0x41')](_['pick'](_0x14a9cc[_0x4975('0x35')],_0x26a860[_0x4975('0x41')]),_0x16f41f);if(_0x14a9cc[_0x4975('0x35')][_0x4975('0x42')]){_0x313da0[_0x4975('0x40')]=_[_0x4975('0x43')](_0x313da0['where'],{'$or':_[_0x4975('0x30')](_0x16f41f,function(_0xc618ce){if(_0xc618ce[_0x4975('0x44')]!=='VIRTUAL'){var _0x54851f={};_0x54851f[_0xc618ce[_0x4975('0x34')]]={'$like':'%'+_0x14a9cc[_0x4975('0x35')][_0x4975('0x42')]+'%'};return _0x54851f;}})});}_0x313da0=_[_0x4975('0x43')]({},_0x313da0,_0x14a9cc[_0x4975('0x45')]);var _0x2a485c={'where':_0x313da0[_0x4975('0x40')]};return db[_0x4975('0x46')][_0x4975('0x23')](_0x2a485c)[_0x4975('0x29')](function(_0x34e299){_0x24dd5e[_0x4975('0x23')]=_0x34e299;if(_0x14a9cc['query']['includeAll']){_0x313da0['include']=[{'all':!![]}];}return db[_0x4975('0x46')][_0x4975('0x47')](_0x313da0);})[_0x4975('0x29')](function(_0x3d2b12){_0x24dd5e['rows']=_0x3d2b12;return _0x24dd5e;})[_0x4975('0x29')](respondWithFilteredResult(_0x25e653,_0x313da0))[_0x4975('0x48')](handleError(_0x25e653,null));};exports[_0x4975('0x49')]=function(_0x168e6b,_0x1ac60f){var _0x407b91={'raw':![],'where':{'id':_0x168e6b['params']['id']}},_0x17acc5={};_0x17acc5[_0x4975('0x37')]=_[_0x4975('0x36')](db[_0x4975('0x46')][_0x4975('0x31')]);_0x17acc5[_0x4975('0x35')]=_['keys'](_0x168e6b[_0x4975('0x35')]);_0x17acc5[_0x4975('0x41')]=_['intersection'](_0x17acc5[_0x4975('0x37')],_0x17acc5[_0x4975('0x35')]);_0x407b91[_0x4975('0x38')]=_[_0x4975('0x39')](_0x17acc5[_0x4975('0x37')],qs[_0x4975('0x3a')](_0x168e6b[_0x4975('0x35')]['fields']));_0x407b91[_0x4975('0x38')]=_0x407b91[_0x4975('0x38')][_0x4975('0x3b')]?_0x407b91[_0x4975('0x38')]:_0x17acc5[_0x4975('0x37')];if(_0x168e6b['query']['includeAll']){_0x407b91[_0x4975('0x4a')]=[{'all':!![]}];}_0x407b91=_[_0x4975('0x43')]({},_0x407b91,_0x168e6b[_0x4975('0x45')]);return db[_0x4975('0x46')][_0x4975('0x4b')](_0x407b91)[_0x4975('0x29')](handleEntityNotFound(_0x1ac60f,null))['then'](respondWithResult(_0x1ac60f,null))[_0x4975('0x48')](handleError(_0x1ac60f,null));};exports['create']=function(_0x332997,_0x2b7753){return db[_0x4975('0x46')][_0x4975('0x4c')](_0x332997[_0x4975('0x4d')],{})[_0x4975('0x29')](function(_0x5e2668){var _0x2a7048=_0x332997['user']['get']({'plain':!![]});if(!_0x2a7048)throw new Error(_0x4975('0x4e'));if(_0x2a7048['role']===_0x4975('0x4f')){var _0x37f80f=_0x5e2668[_0x4975('0x2a')]({'plain':!![]});var _0x24bbb7='Lists';return db[_0x4975('0x50')]['find']({'where':{'name':_0x24bbb7,'userProfileId':_0x2a7048[_0x4975('0x51')]},'raw':!![]})['then'](function(_0x311519){if(_0x311519&&_0x311519[_0x4975('0x52')]===0x0){return db[_0x4975('0x2c')][_0x4975('0x4c')]({'name':_0x37f80f[_0x4975('0x34')],'resourceId':_0x37f80f['id'],'type':_0x311519['name'],'sectionId':_0x311519['id']},{})[_0x4975('0x29')](function(){return _0x5e2668;});}else{return _0x5e2668;}})[_0x4975('0x48')](function(_0x3aa37c){logger[_0x4975('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3aa37c);throw _0x3aa37c;});}return _0x5e2668;})[_0x4975('0x29')](respondWithResult(_0x2b7753,0xc9))[_0x4975('0x48')](handleError(_0x2b7753,null));};exports[_0x4975('0x28')]=function(_0x4f0d1b,_0x53e011){if(_0x4f0d1b[_0x4975('0x4d')]['id']){delete _0x4f0d1b[_0x4975('0x4d')]['id'];}return db[_0x4975('0x46')][_0x4975('0x4b')]({'where':{'id':_0x4f0d1b[_0x4975('0x54')]['id']}})[_0x4975('0x29')](handleEntityNotFound(_0x53e011,null))['then'](saveUpdates(_0x4f0d1b[_0x4975('0x4d')],null))[_0x4975('0x29')](respondWithResult(_0x53e011,null))['catch'](handleError(_0x53e011,null));};exports[_0x4975('0x2d')]=function(_0x5c66be,_0x41a3a){return db['CmList'][_0x4975('0x4b')]({'where':{'id':_0x5c66be[_0x4975('0x54')]['id']}})[_0x4975('0x29')](handleEntityNotFound(_0x41a3a,null))[_0x4975('0x29')](removeEntity(_0x41a3a,null))[_0x4975('0x48')](handleError(_0x41a3a,null));};exports[_0x4975('0x55')]=function(_0xff599d,_0x28e433){return db[_0x4975('0x46')][_0x4975('0x55')]()['then'](respondWithResult(_0x28e433,null))[_0x4975('0x48')](handleError(_0x28e433,null));};exports[_0x4975('0x56')]=function(_0x36814c,_0x4b243a,_0x31c4d5){if(_0x36814c[_0x4975('0x4d')]['id']){delete _0x36814c[_0x4975('0x4d')]['id'];}return db[_0x4975('0x46')][_0x4975('0x4b')]({'where':{'id':_0x36814c[_0x4975('0x54')]['id']}})[_0x4975('0x29')](handleEntityNotFound(_0x4b243a,null))[_0x4975('0x29')](function(_0x3c2a00){if(_0x3c2a00){_0x36814c['body'][_0x4975('0x57')]=_0x3c2a00['id'];return db[_0x4975('0x58')][_0x4975('0x4c')](_0x36814c[_0x4975('0x4d')]);}})[_0x4975('0x29')](respondWithResult(_0x4b243a,null))[_0x4975('0x48')](handleError(_0x4b243a,null));};exports['getDispositions']=function(_0xd6f512,_0x1be245,_0x412ce2){var _0x39c62d={'raw':![],'where':{}};var _0x3467ee={};var _0x3279b3={'count':0x0,'rows':[]};return db[_0x4975('0x46')][_0x4975('0x59')]({'where':{'id':_0xd6f512[_0x4975('0x54')]['id']}})[_0x4975('0x29')](handleEntityNotFound(_0x1be245,null))[_0x4975('0x29')](function(_0x98186c){if(_0x98186c){_0x3467ee[_0x4975('0x37')]=_[_0x4975('0x36')](db[_0x4975('0x58')][_0x4975('0x31')]);_0x3467ee[_0x4975('0x35')]=_[_0x4975('0x36')](_0xd6f512[_0x4975('0x35')]);_0x3467ee['filters']=_[_0x4975('0x39')](_0x3467ee[_0x4975('0x37')],_0x3467ee[_0x4975('0x35')]);_0x39c62d[_0x4975('0x38')]=_[_0x4975('0x39')](_0x3467ee[_0x4975('0x37')],qs[_0x4975('0x3a')](_0xd6f512[_0x4975('0x35')][_0x4975('0x3a')]));_0x39c62d[_0x4975('0x38')]=_0x39c62d[_0x4975('0x38')][_0x4975('0x3b')]?_0x39c62d[_0x4975('0x38')]:_0x3467ee[_0x4975('0x37')];if(!_0xd6f512[_0x4975('0x35')][_0x4975('0x3c')](_0x4975('0x3d'))){_0x39c62d[_0x4975('0x21')]=qs[_0x4975('0x21')](_0xd6f512[_0x4975('0x35')]['limit']);_0x39c62d[_0x4975('0x22')]=qs['offset'](_0xd6f512[_0x4975('0x35')][_0x4975('0x22')]);}_0x39c62d[_0x4975('0x3e')]=qs[_0x4975('0x3f')](_0xd6f512['query']['sort']);_0x39c62d['where']=qs[_0x4975('0x41')](_[_0x4975('0x5a')](_0xd6f512['query'],_0x3467ee[_0x4975('0x41')]));_0x39c62d['where'][_0x4975('0x57')]=_0x98186c['id'];if(_0xd6f512[_0x4975('0x35')][_0x4975('0x42')]){_0x39c62d['where']=_[_0x4975('0x43')](_0x39c62d[_0x4975('0x40')],{'$or':_[_0x4975('0x30')](_0x39c62d[_0x4975('0x38')],function(_0x329d45){var _0x35bc9b={};_0x35bc9b[_0x329d45]={'$like':'%'+_0xd6f512['query'][_0x4975('0x42')]+'%'};return _0x35bc9b;})});}_0x39c62d=_[_0x4975('0x43')]({},_0x39c62d,_0xd6f512[_0x4975('0x45')]);return db[_0x4975('0x58')]['count']({'where':_0x39c62d[_0x4975('0x40')]})['then'](function(_0x52a872){_0x3279b3['count']=_0x52a872;if(_0xd6f512['query'][_0x4975('0x5b')]){_0x39c62d[_0x4975('0x4a')]=[{'all':!![]}];}return db[_0x4975('0x58')][_0x4975('0x47')](_0x39c62d);})[_0x4975('0x29')](function(_0x3854ce){_0x3279b3[_0x4975('0x5c')]=_0x3854ce;return _0x3279b3;});}})['then'](respondWithFilteredResult(_0x1be245,_0x39c62d))[_0x4975('0x48')](handleError(_0x1be245,null));};exports[_0x4975('0x5d')]=function(_0xc5f66f,_0x42056e,_0x262841){return db[_0x4975('0x46')]['find']({'where':{'id':_0xc5f66f[_0x4975('0x54')]['id']}})[_0x4975('0x29')](handleEntityNotFound(_0x42056e,null))[_0x4975('0x29')](function(_0x58f37a){if(_0x58f37a){return _0x58f37a[_0x4975('0x5d')](_0xc5f66f[_0x4975('0x35')]['ids']);}})['then'](respondWithStatusCode(_0x42056e,null))[_0x4975('0x48')](handleError(_0x42056e,null));};exports[_0x4975('0x5e')]=function(_0x575d90,_0x40447b,_0x411c41){return db[_0x4975('0x46')][_0x4975('0x4b')]({'where':{'id':_0x575d90[_0x4975('0x54')]['id']}})['then'](handleEntityNotFound(_0x40447b,null))['then'](function(_0x377802){if(_0x377802){var _0x226800=[];var _0x3a91ed={'success':[],'errors':[]};return db[_0x4975('0x5f')]['describe']()[_0x4975('0x29')](function(_0xfa6c11){if(_0x575d90['body'][_0x4975('0x60')]&&_[_0x4975('0x61')](_0x575d90[_0x4975('0x4d')]['tags'])){if(_0x575d90[_0x4975('0x4d')][_0x4975('0x60')][_0x4975('0x3b')]){_0x575d90[_0x4975('0x4d')]['tags']=_0x575d90[_0x4975('0x4d')]['tags'][_0x4975('0x62')](';')+';';}else{_0x575d90[_0x4975('0x4d')][_0x4975('0x60')]=null;}}else{_0x575d90['body'][_0x4975('0x60')]=null;}if(_0x575d90[_0x4975('0x4d')]&&_[_0x4975('0x61')](_0x575d90[_0x4975('0x4d')])){for(var _0x1c5ee0=0x0;_0x1c5ee0<_0x575d90['body'][_0x4975('0x3b')];_0x1c5ee0+=0x1){_0x575d90['body'][_0x1c5ee0][_0x4975('0x57')]=_0x575d90[_0x4975('0x54')]['id'];_0x226800[_0x4975('0x63')](_0x575d90[_0x4975('0x4d')][_0x1c5ee0]);}return BPromise[_0x4975('0x64')](_0x226800,function(_0x3d19df){return db[_0x4975('0x5f')][_0x4975('0x4c')](_[_0x4975('0x65')](_0x3d19df,['ids','id'])||{},{'fields':_[_0x4975('0x36')](_0xfa6c11),'raw':!![]})['then'](function(_0x3f5c9f){_0x3a91ed[_0x4975('0x66')][_0x4975('0x63')](_0x3f5c9f[_0x4975('0x67')]);})[_0x4975('0x48')](function(_0x481ffe){_0x3a91ed[_0x4975('0x68')]['push']({'data':_0x3d19df,'error':_0x481ffe[_0x4975('0x69')]});});})[_0x4975('0x29')](function(_0x231163){return _0x3a91ed;})[_0x4975('0x48')](function(_0x11bf96){return _0x11bf96;});}else{_0x40447b['status'](0x190)[_0x4975('0x1f')]({'message':_0x4975('0x6a')});}});}})[_0x4975('0x29')](respondWithResult(_0x40447b,null))[_0x4975('0x48')](handleError(_0x40447b,null));};exports['getContacts']=function(_0x4a298b,_0x49a3e5,_0x3ff11c){var _0x4c57d0;return db[_0x4975('0x46')][_0x4975('0x4b')]({'where':{'id':_0x4a298b['params']['id']},'include':[{'model':db[_0x4975('0x6b')],'as':_0x4975('0x6c')}]})[_0x4975('0x29')](handleEntityNotFound(_0x49a3e5,null))[_0x4975('0x29')](function(_0x21cec0){if(_0x21cec0){_0x4c57d0=_0x21cec0;return db[_0x4975('0x5f')][_0x4975('0x31')];}})[_0x4975('0x29')](function(_0x2f2253){if(_0x2f2253){var _0x3dbe65={};var _0x3dd34e={};_0x3dd34e['model']=_[_0x4975('0x6d')](_['keys'](_0x2f2253),_[_0x4975('0x30')](_0x4c57d0[_0x4975('0x6c')],function(_0x4214cb){return util[_0x4975('0x6e')](_0x4975('0x6f'),_0x4214cb['id']);}));_0x3dd34e[_0x4975('0x35')]=_[_0x4975('0x36')](_0x4a298b[_0x4975('0x35')]);_0x3dd34e[_0x4975('0x41')]=_['intersection'](_0x3dd34e[_0x4975('0x37')],_0x3dd34e[_0x4975('0x35')]);_0x3dbe65[_0x4975('0x38')]=_[_0x4975('0x39')](_0x3dd34e[_0x4975('0x37')],qs[_0x4975('0x3a')](_0x4a298b[_0x4975('0x35')][_0x4975('0x3a')]));_0x3dbe65['attributes']=_0x3dbe65[_0x4975('0x38')][_0x4975('0x3b')]?_0x3dbe65[_0x4975('0x38')]:_0x3dd34e['model'];if(!_0x4a298b['query']['hasOwnProperty'](_0x4975('0x3d'))){_0x3dbe65['limit']=qs[_0x4975('0x21')](_0x4a298b[_0x4975('0x35')][_0x4975('0x21')]);_0x3dbe65[_0x4975('0x22')]=qs[_0x4975('0x22')](_0x4a298b['query']['offset']);}_0x3dbe65[_0x4975('0x3e')]=qs[_0x4975('0x3f')](_0x4a298b[_0x4975('0x35')][_0x4975('0x3f')]);_0x3dbe65[_0x4975('0x40')]=qs['filters'](_['pick'](_0x4a298b[_0x4975('0x35')],_0x3dd34e[_0x4975('0x41')]));_0x3dbe65[_0x4975('0x70')]=!![];if(_0x4a298b[_0x4975('0x35')][_0x4975('0x42')]){_0x3dbe65[_0x4975('0x40')]=_[_0x4975('0x43')](_0x3dbe65[_0x4975('0x40')],{'$or':_[_0x4975('0x30')](_0x3dbe65[_0x4975('0x38')],function(_0x281032){var _0x409186={};_0x409186[_0x281032]={'$like':'%'+_0x4a298b['query'][_0x4975('0x42')]+'%'};return _0x409186;})});}_0x3dbe65=_[_0x4975('0x43')]({},_0x3dbe65,_0x4a298b[_0x4975('0x45')]);return _0x4c57d0[_0x4975('0x71')](_0x3dbe65);}})[_0x4975('0x29')](respondWithResult(_0x49a3e5,null))[_0x4975('0x48')](handleError(_0x49a3e5,null));};exports['getContactsCsv']=function(_0x336e3a,_0x5bac41,_0x4b065c){var _0x18d277;var _0x115b2b;var _0x35ff66;var _0x5644ea=_0x336e3a[_0x4975('0x54')]['id'];csv_results=[];return db[_0x4975('0x72')][_0x4975('0x47')]({'attributes':['id',_0x4975('0x34')],'raw':!![],'order':['OrderBy']})[_0x4975('0x29')](function(_0x4bc396){_0x18d277=_0x4bc396;var _0x4dc41e=_[_0x4975('0x36')](db['CmContact'][_0x4975('0x31')]);return db[_0x4975('0x6b')][_0x4975('0x47')]({'raw':!![],'attributes':['id','alias']})[_0x4975('0x29')](function(_0x363528){_0x115b2b=_0x363528;var _0x127ded=squel[_0x4975('0x73')]()['fields'](_0x4dc41e)[_0x4975('0x74')]('cm_contacts','c')[_0x4975('0x40')](_0x4975('0x75'),_0x5644ea)['where'](_0x4975('0x76'))[_0x4975('0x77')]();for(var _0xb126ff=0x0;_0xb126ff<_0x115b2b['length'];_0xb126ff++){_0x127ded[_0x4975('0x78')](_0x4975('0x79')+_0x115b2b[_0xb126ff]['id'],_0x4975('0x7a')+_0x115b2b[_0xb126ff]['alias']);}for(var _0xb126ff=0x0;_0xb126ff<_0x18d277[_0x4975('0x3b')];_0xb126ff++){_0x127ded[_0x4975('0x78')](squel[_0x4975('0x73')]()[_0x4975('0x78')](_0x4975('0x7b'))[_0x4975('0x74')](_0x4975('0x7c'))[_0x4975('0x40')](_0x4975('0x7d'),_0x18d277[_0xb126ff]['id'])['where'](_0x4975('0x7e')),_0x4975('0x7f')+_0x18d277[_0xb126ff][_0x4975('0x34')]);_0x127ded[_0x4975('0x78')](squel[_0x4975('0x73')]()[_0x4975('0x78')](_0x4975('0x80'))[_0x4975('0x74')](_0x4975('0x7c'))[_0x4975('0x40')](_0x4975('0x7d'),_0x18d277[_0xb126ff]['id'])[_0x4975('0x40')]('CmContactId\x20=\x20c.id'),_0x4975('0x81')+_0x18d277[_0xb126ff][_0x4975('0x34')]);}var _0x238aba=[];_0x238aba[_0x4975('0x63')](_0x127ded['toString']());BPromise[_0x4975('0x64')](_0x238aba,handleQuery)[_0x4975('0x29')](function(_0xaad53d){handleQuery(_0x127ded[_0x4975('0x82')]());var _0x3b5c9c=csv_results[0x0];if(!_[_0x4975('0x83')](_0x3b5c9c)){var _0x538a8b=toCsv(_0x3b5c9c);var _0x315945=Date['now']();fs[_0x4975('0x84')](util[_0x4975('0x6e')](_0x4975('0x85'),_0x5644ea,_0x315945),_0x538a8b);_0x5bac41[_0x4975('0x86')]('Content-disposition','attachment;\x20filename='+util[_0x4975('0x6e')](_0x4975('0x87'),_0x5644ea,_0x315945));_0x5bac41['setHeader']('Content-type',_0x4975('0x88'));return _0x5bac41['download'](util[_0x4975('0x6e')](_0x4975('0x85'),_0x5644ea,_0x315945));}else{return _0x5bac41[_0x4975('0x1c')](0xcc);}});});});};exports[_0x4975('0x89')]=function(_0x3ec110,_0x232748,_0x289e98){var _0x29316a;delete _0x3ec110[_0x4975('0x4d')]['id'];return db['CmList']['findOne']({'where':{'id':_0x3ec110['params']['id']}})[_0x4975('0x29')](handleEntityNotFound(_0x232748,null))[_0x4975('0x29')](function(_0x4fb3fd){if(_0x4fb3fd){return db[_0x4975('0x8a')]['transaction'](function(_0x44c11c){return db['CmCustomField'][_0x4975('0x4c')](_0x3ec110[_0x4975('0x4d')],{'transaction':_0x44c11c})['then'](function(_0x16e864){_0x29316a=_0x16e864;return _0x4fb3fd['addCustomFields'](_0x16e864,{'transaction':_0x44c11c});})['then'](function(){var _0x3b507f={'type':db[_0x4975('0x8b')]['TEXT'],'transaction':_0x44c11c};switch(_0x3ec110[_0x4975('0x4d')][_0x4975('0x44')]){case'text':_0x3b507f[_0x4975('0x44')]=db[_0x4975('0x8b')][_0x4975('0x8c')];break;case _0x4975('0x8d'):_0x3b507f['type']=db[_0x4975('0x8b')]['INTEGER'];break;case _0x4975('0x8e'):_0x3b507f['type']=db[_0x4975('0x8b')][_0x4975('0x8f')];_0x3b507f[_0x4975('0x90')]=![];break;default:}return db[_0x4975('0x8a')][_0x4975('0x91')][_0x4975('0x92')](_0x4975('0x93'),util[_0x4975('0x6e')](_0x4975('0x94'),_0x29316a['id']),_0x3b507f);})[_0x4975('0x29')](function(){return _0x29316a;});});}})[_0x4975('0x29')](respondWithResult(_0x232748,null))['catch'](handleError(_0x232748,null));};exports[_0x4975('0x95')]=function(_0xe32277,_0x1ce8ec,_0x365b4c){var _0x3665ef={};var _0x1b9e13={};var _0x2a3872;var _0x239bcb;return db[_0x4975('0x46')][_0x4975('0x59')]({'where':{'id':_0xe32277[_0x4975('0x54')]['id']}})[_0x4975('0x29')](handleEntityNotFound(_0x1ce8ec,null))[_0x4975('0x29')](function(_0x51bf90){if(_0x51bf90){_0x2a3872=_0x51bf90;_0x1b9e13['model']=_[_0x4975('0x36')](db[_0x4975('0x6b')][_0x4975('0x31')]);_0x1b9e13['query']=_[_0x4975('0x36')](_0xe32277['query']);_0x1b9e13[_0x4975('0x41')]=_['intersection'](_0x1b9e13[_0x4975('0x37')],_0x1b9e13[_0x4975('0x35')]);_0x3665ef[_0x4975('0x38')]=_[_0x4975('0x39')](_0x1b9e13[_0x4975('0x37')],qs[_0x4975('0x3a')](_0xe32277[_0x4975('0x35')][_0x4975('0x3a')]));_0x3665ef[_0x4975('0x38')]=_0x3665ef['attributes'][_0x4975('0x3b')]?_0x3665ef[_0x4975('0x38')]:_0x1b9e13[_0x4975('0x37')];_0x3665ef['order']=qs[_0x4975('0x3f')](_0xe32277[_0x4975('0x35')][_0x4975('0x3f')]);_0x3665ef[_0x4975('0x40')]=qs[_0x4975('0x41')](_[_0x4975('0x5a')](_0xe32277[_0x4975('0x35')],_0x1b9e13[_0x4975('0x41')]));_0x3665ef[_0x4975('0x40')]=_[_0x4975('0x43')](_0x3665ef[_0x4975('0x40')],{'$or':[{'ListId':_0x51bf90['id']},{'ListId':null}]});if(_0xe32277['query']['filter']){_0x3665ef[_0x4975('0x40')]=_[_0x4975('0x43')](_0x3665ef['where'],{'$or':_['map'](_0x3665ef['attributes'],function(_0x11fcb3){var _0x20dbbd={};_0x20dbbd[_0x11fcb3]={'$like':'%'+_0xe32277[_0x4975('0x35')][_0x4975('0x42')]+'%'};return _0x20dbbd;})});}_0x3665ef=_['merge']({},_0x3665ef,_0xe32277['options']);return db[_0x4975('0x6b')]['findAndCountAll'](_0x3665ef);}})[_0x4975('0x29')](respondWithResult(_0x1ce8ec,null))['catch'](handleError(_0x1ce8ec,null));};exports['getGlobalCustomFields']=function(_0x2b52a4,_0x44f097){return db[_0x4975('0x6b')][_0x4975('0x96')]({'where':{'ListId':null}})[_0x4975('0x29')](handleEntityNotFound(_0x44f097,null))['then'](function(_0x3f008c){return _0x3f008c;})['then'](respondWithResult(_0x44f097,null))[_0x4975('0x48')](handleError(_0x44f097,null));};exports[_0x4975('0x97')]=function(_0x31ba94,_0x37b10c,_0x154173){return db[_0x4975('0x46')][_0x4975('0x4b')]({'where':{'id':_0x31ba94[_0x4975('0x54')]['id']}})['then'](handleEntityNotFound(_0x37b10c,null))[_0x4975('0x29')](function(_0x354010){if(_0x354010){return _0x354010[_0x4975('0x97')](_0x31ba94[_0x4975('0x4d')][_0x4975('0x98')],_['omit'](_0x31ba94[_0x4975('0x4d')],[_0x4975('0x98'),'id'])||{})[_0x4975('0x99')](function(_0x2f811a){for(var _0x307f41=0x0;_0x307f41<_0x31ba94[_0x4975('0x4d')][_0x4975('0x98')][_0x4975('0x3b')];_0x307f41+=0x1){socket[_0x4975('0x9a')](_0x4975('0x9b'),{'UserId':Number(_0x31ba94[_0x4975('0x4d')][_0x4975('0x98')][_0x307f41]),'CmListId':Number(_0x31ba94[_0x4975('0x54')]['id'])});}return _0x2f811a;});}})[_0x4975('0x29')](respondWithResult(_0x37b10c,null))['catch'](handleError(_0x37b10c,null));};exports['removeAgents']=function(_0x2c7a5e,_0x5e2b68,_0x4f23eb){return db[_0x4975('0x46')][_0x4975('0x4b')]({'where':{'id':_0x2c7a5e[_0x4975('0x54')]['id']}})[_0x4975('0x29')](handleEntityNotFound(_0x5e2b68,null))[_0x4975('0x29')](function(_0x4647ea){if(_0x4647ea){return _0x4647ea['removeAgents'](_0x2c7a5e[_0x4975('0x35')][_0x4975('0x98')])['then'](function(){if(_['isArray'](_0x2c7a5e[_0x4975('0x35')][_0x4975('0x98')])){for(var _0x256994=0x0;_0x256994<_0x2c7a5e[_0x4975('0x35')]['ids']['length'];_0x256994+=0x1){socket[_0x4975('0x9a')](_0x4975('0x9c'),{'UserId':Number(_0x2c7a5e['query'][_0x4975('0x98')][_0x256994]),'CmListId':Number(_0x2c7a5e['params']['id'])});}}else{socket[_0x4975('0x9a')](_0x4975('0x9c'),{'UserId':Number(_0x2c7a5e['query'][_0x4975('0x98')]),'CmListId':Number(_0x2c7a5e['params']['id'])});}});}})[_0x4975('0x29')](respondWithStatusCode(_0x5e2b68,null))[_0x4975('0x48')](handleError(_0x5e2b68,null));};exports['getAgents']=function(_0x138cf7,_0x28354f,_0x1846b4){var _0x383985={};var _0x424ca0={};var _0x306c07;var _0x40681b;return db[_0x4975('0x46')][_0x4975('0x59')]({'where':{'id':_0x138cf7[_0x4975('0x54')]['id']}})[_0x4975('0x29')](handleEntityNotFound(_0x28354f,null))['then'](function(_0x5b41f){if(_0x5b41f){_0x306c07=_0x5b41f;_0x424ca0[_0x4975('0x37')]=_[_0x4975('0x36')](db[_0x4975('0x9d')]['rawAttributes']);_0x424ca0[_0x4975('0x35')]=_[_0x4975('0x36')](_0x138cf7['query']);_0x424ca0[_0x4975('0x41')]=_['intersection'](_0x424ca0[_0x4975('0x37')],_0x424ca0['query']);_0x383985[_0x4975('0x38')]=_['intersection'](_0x424ca0[_0x4975('0x37')],qs[_0x4975('0x3a')](_0x138cf7[_0x4975('0x35')][_0x4975('0x3a')]));_0x383985['attributes']=_0x383985[_0x4975('0x38')][_0x4975('0x3b')]?_0x383985[_0x4975('0x38')]:_0x424ca0['model'];_0x383985['order']=qs[_0x4975('0x3f')](_0x138cf7[_0x4975('0x35')]['sort']);_0x383985[_0x4975('0x40')]=qs['filters'](_[_0x4975('0x5a')](_0x138cf7[_0x4975('0x35')],_0x424ca0['filters']));if(_0x138cf7['query']['filter']){_0x383985['where']=_[_0x4975('0x43')](_0x383985['where'],{'$or':_[_0x4975('0x30')](_0x383985['attributes'],function(_0x2cfc58){var _0x1d4ec4={};_0x1d4ec4[_0x2cfc58]={'$like':'%'+_0x138cf7['query'][_0x4975('0x42')]+'%'};return _0x1d4ec4;})});}_0x383985=_['merge']({},_0x383985,_0x138cf7[_0x4975('0x45')]);return _0x306c07['getAgents'](_0x383985);}})[_0x4975('0x29')](function(_0x13f00f){if(_0x13f00f){_0x40681b=_0x13f00f[_0x4975('0x3b')];if(!_0x138cf7[_0x4975('0x35')][_0x4975('0x3c')]('nolimit')){_0x383985[_0x4975('0x21')]=qs[_0x4975('0x21')](_0x138cf7[_0x4975('0x35')]['limit']);_0x383985['offset']=qs[_0x4975('0x22')](_0x138cf7[_0x4975('0x35')][_0x4975('0x22')]);}return _0x306c07[_0x4975('0x9e')](_0x383985);}})['then'](function(_0x30cb3b){if(_0x30cb3b){return _0x30cb3b?{'count':_0x40681b,'rows':_0x30cb3b}:null;}})['then'](respondWithResult(_0x28354f,null))[_0x4975('0x48')](handleError(_0x28354f,null));};function handleQuery(_0x9cf9e5){logger[_0x4975('0x9f')](_0x9cf9e5);return db[_0x4975('0x8a')][_0x4975('0x35')](_0x9cf9e5)[_0x4975('0x99')](function(_0x1d2aa2){csv_results['push'](_0x1d2aa2);})['catch'](function(_0x3eb68e){logger[_0x4975('0x53')](_0x3eb68e[_0x4975('0x69')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 71bb715..c544b60 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0x5fc3[_0x5447aa];return _0xb21e53;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x814b,0x1a2));var _0xb814=function(_0x5d23be,_0x3b4f3c){_0x5d23be=_0x5d23be-0x0;var _0x4d60a9=_0x814b[_0x5d23be];return _0x4d60a9;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index c558ec3..8d042d4 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(_0x200a3c,_0x4797ec){var _0x682cde=function(_0x4cecdb){while(--_0x4cecdb){_0x200a3c['push'](_0x200a3c['shift']());}};_0x682cde(++_0x4797ec);}(_0xac4a,0x13f));var _0xaac4=function(_0x42ea9c,_0xef1f9){_0x42ea9c=_0x42ea9c-0x0;var _0xca90a6=_0xac4a[_0x42ea9c];return _0xca90a6;};'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 _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','cm_lists','lodash'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xe14d,0x1ee));var _0xde14=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xe14d[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('CmList',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 291dbef..de96999 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 _0xa8d2=['localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CmList,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x2effe0,_0x24b2a3){var _0x47bd4d=function(_0x439be6){while(--_0x439be6){_0x2effe0['push'](_0x2effe0['shift']());}};_0x47bd4d(++_0x24b2a3);}(_0xa8d2,0x1ea));var _0x2a8d=function(_0x2615ff,_0x412cb0){_0x2615ff=_0x2615ff-0x0;var _0x3ef958=_0xa8d2[_0x2615ff];return _0x3ef958;};'use strict';var _=require(_0x2a8d('0x0'));var util=require('util');var moment=require(_0x2a8d('0x1'));var BPromise=require(_0x2a8d('0x2'));var rs=require(_0x2a8d('0x3'));var fs=require('fs');var Redis=require(_0x2a8d('0x4'));var db=require(_0x2a8d('0x5'))['db'];var utils=require(_0x2a8d('0x6'));var logger=require(_0x2a8d('0x7'))(_0x2a8d('0x8'));var config=require(_0x2a8d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2a8d('0xa')][_0x2a8d('0xb')]({'port':0x232a});config[_0x2a8d('0xc')]=_[_0x2a8d('0xd')](config[_0x2a8d('0xc')],{'host':_0x2a8d('0xe'),'port':0x18eb});var socket=require(_0x2a8d('0xf'))(new Redis(config[_0x2a8d('0xc')]));require(_0x2a8d('0x10'))[_0x2a8d('0x11')](socket);function respondWithRpcPromise(_0x2e7893,_0x534e05,_0x5006cb){return new BPromise(function(_0x2579bb,_0x213bb2){return client[_0x2a8d('0x12')](_0x2e7893,_0x5006cb)['then'](function(_0x5b37cb){logger[_0x2a8d('0x13')]('CmList,\x20%s,\x20%s',_0x534e05,'request\x20sent');logger['debug'](_0x2a8d('0x14'),_0x534e05,_0x2a8d('0x15'),JSON[_0x2a8d('0x16')](_0x5b37cb));if(_0x5b37cb[_0x2a8d('0x17')]){if(_0x5b37cb[_0x2a8d('0x17')][_0x2a8d('0x18')]===0x1f4){logger[_0x2a8d('0x17')]('CmList,\x20%s,\x20%s',_0x534e05,_0x5b37cb[_0x2a8d('0x17')][_0x2a8d('0x19')]);return _0x213bb2(_0x5b37cb[_0x2a8d('0x17')][_0x2a8d('0x19')]);}logger[_0x2a8d('0x17')](_0x2a8d('0x1a'),_0x534e05,_0x5b37cb['error'][_0x2a8d('0x19')]);return _0x2579bb(_0x5b37cb[_0x2a8d('0x17')][_0x2a8d('0x19')]);}else{logger[_0x2a8d('0x13')](_0x2a8d('0x1a'),_0x534e05,'request\x20sent');_0x2579bb(_0x5b37cb[_0x2a8d('0x1b')][_0x2a8d('0x19')]);}})['catch'](function(_0x330936){logger[_0x2a8d('0x17')](_0x2a8d('0x1a'),_0x534e05,_0x330936);_0x213bb2(_0x330936);});});} \ No newline at end of file +var _0xa1d2=['http','redis','defaults','socket.io-emitter','register','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xa1d2,0x92));var _0x2a1d=function(_0x3acd85,_0xaefb6a){_0x3acd85=_0x3acd85-0x0;var _0x1f7d9f=_0xa1d2[_0x3acd85];return _0x1f7d9f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2a1d('0x0'));var BPromise=require(_0x2a1d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a1d('0x2'));var db=require(_0x2a1d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a1d('0x4'))(_0x2a1d('0x5'));var config=require(_0x2a1d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2a1d('0x7')][_0x2a1d('0x8')]({'port':0x232a});config[_0x2a1d('0x9')]=_[_0x2a1d('0xa')](config[_0x2a1d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2a1d('0xb'))(new Redis(config[_0x2a1d('0x9')]));require('./cmList.socket')[_0x2a1d('0xc')](socket);function respondWithRpcPromise(_0x2e4400,_0xcf1db0,_0x1ed259){return new BPromise(function(_0xe4ea8c,_0x35c6df){return client['request'](_0x2e4400,_0x1ed259)['then'](function(_0x53b014){logger[_0x2a1d('0xd')](_0x2a1d('0xe'),_0xcf1db0,'request\x20sent');logger[_0x2a1d('0xf')](_0x2a1d('0x10'),_0xcf1db0,_0x2a1d('0x11'),JSON[_0x2a1d('0x12')](_0x53b014));if(_0x53b014['error']){if(_0x53b014[_0x2a1d('0x13')]['code']===0x1f4){logger['error'](_0x2a1d('0xe'),_0xcf1db0,_0x53b014[_0x2a1d('0x13')][_0x2a1d('0x14')]);return _0x35c6df(_0x53b014['error'][_0x2a1d('0x14')]);}logger[_0x2a1d('0x13')]('CmList,\x20%s,\x20%s',_0xcf1db0,_0x53b014[_0x2a1d('0x13')][_0x2a1d('0x14')]);return _0xe4ea8c(_0x53b014['error'][_0x2a1d('0x14')]);}else{logger[_0x2a1d('0xd')](_0x2a1d('0xe'),_0xcf1db0,_0x2a1d('0x11'));_0xe4ea8c(_0x53b014['result'][_0x2a1d('0x14')]);}})[_0x2a1d('0x15')](function(_0x34082a){logger['error'](_0x2a1d('0xe'),_0xcf1db0,_0x34082a);_0x35c6df(_0x34082a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index d5d28f1..af076d8 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 _0x3b30=['./cmList.events','save','remove','update','emit','register','length','cmList:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3b30,0xe0));var _0x03b3=function(_0x3bfeb5,_0xcbc5c8){_0x3bfeb5=_0x3bfeb5-0x0;var _0x2a9947=_0x3b30[_0x3bfeb5];return _0x2a9947;};'use strict';var CmListEvents=require(_0x03b3('0x0'));var events=[_0x03b3('0x1'),_0x03b3('0x2'),_0x03b3('0x3')];function createListener(_0x21dc24,_0x1ecd03){return function(_0x6cabad){_0x1ecd03[_0x03b3('0x4')](_0x21dc24,_0x6cabad);};}function removeListener(_0x1d31b5,_0x111b08){return function(){CmListEvents['removeListener'](_0x1d31b5,_0x111b08);};}exports[_0x03b3('0x5')]=function(_0x43537b){for(var _0xbb2690=0x0,_0x570627=events[_0x03b3('0x6')];_0xbb2690<_0x570627;_0xbb2690++){var _0x89946c=events[_0xbb2690];var _0x13d301=createListener(_0x03b3('0x7')+_0x89946c,_0x43537b);CmListEvents['on'](_0x89946c,_0x13d301);}}; \ No newline at end of file +var _0xe775=['save','remove','update','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x1c0d12,_0x2a5bd8){var _0x172014=function(_0x416ee3){while(--_0x416ee3){_0x1c0d12['push'](_0x1c0d12['shift']());}};_0x172014(++_0x2a5bd8);}(_0xe775,0x13a));var _0x5e77=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0xe775[_0x2bf888];return _0x3038d6;};'use strict';var CmListEvents=require(_0x5e77('0x0'));var events=[_0x5e77('0x1'),_0x5e77('0x2'),_0x5e77('0x3')];function createListener(_0x47c88,_0xe66d68){return function(_0xdb8774){_0xe66d68[_0x5e77('0x4')](_0x47c88,_0xdb8774);};}function removeListener(_0x443c46,_0x12f5e9){return function(){CmListEvents[_0x5e77('0x5')](_0x443c46,_0x12f5e9);};}exports[_0x5e77('0x6')]=function(_0x4256e5){for(var _0x4d16d0=0x0,_0x8b9150=events[_0x5e77('0x7')];_0x4d16d0<_0x8b9150;_0x4d16d0++){var _0x3c8dad=events[_0x4d16d0];var _0xdd0991=createListener(_0x5e77('0x8')+_0x3c8dad,_0x4256e5);CmListEvents['on'](_0x3c8dad,_0xdd0991);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 0ce3b7b..9cb7012 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 _0x15cd=['post','create','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','/:id','delete','removeDispositions','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','getGlobalCustomFields','get','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents'];(function(_0x21a8ba,_0x2b09e1){var _0x1da12a=function(_0xb9a7f0){while(--_0xb9a7f0){_0x21a8ba['push'](_0x21a8ba['shift']());}};_0x1da12a(++_0x2b09e1);}(_0x15cd,0x1cb));var _0xd15c=function(_0x5e980d,_0x316987){_0x5e980d=_0x5e980d-0x0;var _0x347477=_0x15cd[_0x5e980d];return _0x347477;};'use strict';var multer=require('multer');var util=require(_0xd15c('0x0'));var path=require(_0xd15c('0x1'));var timeout=require('connect-timeout');var express=require(_0xd15c('0x2'));var router=express[_0xd15c('0x3')]();var fs_extra=require(_0xd15c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd15c('0x5'));var config=require(_0xd15c('0x6'));var controller=require(_0xd15c('0x7'));router['get']('/',auth[_0xd15c('0x8')](),controller['index']);router['get']('/describe',auth[_0xd15c('0x8')](),controller['describe']);router['get']('/global_fields',auth[_0xd15c('0x8')](),controller[_0xd15c('0x9')]);router[_0xd15c('0xa')]('/:id',auth[_0xd15c('0x8')](),controller[_0xd15c('0xb')]);router['get'](_0xd15c('0xc'),auth[_0xd15c('0x8')](),controller[_0xd15c('0xd')]);router[_0xd15c('0xa')](_0xd15c('0xe'),auth[_0xd15c('0x8')](),controller[_0xd15c('0xf')]);router[_0xd15c('0xa')](_0xd15c('0x10'),auth[_0xd15c('0x8')](),controller[_0xd15c('0x11')]);router[_0xd15c('0xa')]('/:id/fields',auth[_0xd15c('0x8')](),controller[_0xd15c('0x12')]);router[_0xd15c('0xa')](_0xd15c('0x13'),auth[_0xd15c('0x8')](),controller[_0xd15c('0x14')]);router[_0xd15c('0x15')]('/',auth[_0xd15c('0x8')](),controller[_0xd15c('0x16')]);router[_0xd15c('0x15')]('/:id/dispositions',auth[_0xd15c('0x8')](),controller[_0xd15c('0x17')]);router[_0xd15c('0x15')](_0xd15c('0xe'),auth[_0xd15c('0x8')](),controller[_0xd15c('0x18')]);router[_0xd15c('0x15')](_0xd15c('0x19'),auth['isAuthenticated'](),controller[_0xd15c('0x1a')]);router[_0xd15c('0x15')](_0xd15c('0x13'),auth[_0xd15c('0x8')](),controller[_0xd15c('0x1b')]);router[_0xd15c('0x1c')](_0xd15c('0x1d'),auth[_0xd15c('0x8')](),controller['update']);router['delete'](_0xd15c('0x1d'),auth[_0xd15c('0x8')](),controller['destroy']);router[_0xd15c('0x1e')](_0xd15c('0xc'),auth[_0xd15c('0x8')](),controller[_0xd15c('0x1f')]);router[_0xd15c('0x1e')](_0xd15c('0x13'),auth[_0xd15c('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x1da1=['create','addDisposition','/:id/contacts','addContacts','addCustomField','/:id/users','put','destroy','removeDispositions','delete','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/global_fields','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','post'];(function(_0x11a6a7,_0x316ede){var _0x329be9=function(_0x9eae24){while(--_0x9eae24){_0x11a6a7['push'](_0x11a6a7['shift']());}};_0x329be9(++_0x316ede);}(_0x1da1,0x1a4));var _0x11da=function(_0x4f84eb,_0x51560b){_0x4f84eb=_0x4f84eb-0x0;var _0x2a2734=_0x1da1[_0x4f84eb];return _0x2a2734;};'use strict';var multer=require(_0x11da('0x0'));var util=require(_0x11da('0x1'));var path=require(_0x11da('0x2'));var timeout=require(_0x11da('0x3'));var express=require(_0x11da('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x11da('0x5'));var interaction=require(_0x11da('0x6'));var config=require(_0x11da('0x7'));var controller=require('./cmList.controller');router[_0x11da('0x8')]('/',auth[_0x11da('0x9')](),controller[_0x11da('0xa')]);router['get']('/describe',auth[_0x11da('0x9')](),controller[_0x11da('0xb')]);router['get'](_0x11da('0xc'),auth[_0x11da('0x9')](),controller['getGlobalCustomFields']);router[_0x11da('0x8')](_0x11da('0xd'),auth[_0x11da('0x9')](),controller[_0x11da('0xe')]);router[_0x11da('0x8')](_0x11da('0xf'),auth[_0x11da('0x9')](),controller[_0x11da('0x10')]);router[_0x11da('0x8')]('/:id/contacts',auth[_0x11da('0x9')](),controller[_0x11da('0x11')]);router[_0x11da('0x8')](_0x11da('0x12'),auth[_0x11da('0x9')](),controller['getContactsCsv']);router[_0x11da('0x8')](_0x11da('0x13'),auth[_0x11da('0x9')](),controller[_0x11da('0x14')]);router[_0x11da('0x8')]('/:id/users',auth[_0x11da('0x9')](),controller['getAgents']);router[_0x11da('0x15')]('/',auth[_0x11da('0x9')](),controller[_0x11da('0x16')]);router[_0x11da('0x15')](_0x11da('0xf'),auth[_0x11da('0x9')](),controller[_0x11da('0x17')]);router[_0x11da('0x15')](_0x11da('0x18'),auth[_0x11da('0x9')](),controller[_0x11da('0x19')]);router[_0x11da('0x15')]('/:id/fields',auth[_0x11da('0x9')](),controller[_0x11da('0x1a')]);router[_0x11da('0x15')](_0x11da('0x1b'),auth[_0x11da('0x9')](),controller['addAgents']);router[_0x11da('0x1c')](_0x11da('0xd'),auth[_0x11da('0x9')](),controller['update']);router['delete'](_0x11da('0xd'),auth[_0x11da('0x9')](),controller[_0x11da('0x1d')]);router['delete'](_0x11da('0xf'),auth['isAuthenticated'](),controller[_0x11da('0x1e')]);router[_0x11da('0x1f')](_0x11da('0x1b'),auth[_0x11da('0x9')](),controller[_0x11da('0x20')]);module[_0x11da('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 26844e5..0a3ed14 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 _0xeac2=['STRING','exports','VIRTUAL','getDataValue'];(function(_0x407a3a,_0x582bde){var _0x109c43=function(_0x550c06){while(--_0x550c06){_0x407a3a['push'](_0x407a3a['shift']());}};_0x109c43(++_0x582bde);}(_0xeac2,0x1b1));var _0x2eac=function(_0x2111af,_0x1bca32){_0x2111af=_0x2111af-0x0;var _0x482622=_0xeac2[_0x2111af];return _0x482622;};'use strict';var Sequelize=require('sequelize');module[_0x2eac('0x0')]={'name':{'type':Sequelize[_0x2eac('0x1')],'get':function(_0x34f38a){return this[_0x2eac('0x2')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x2eac('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x2234=['VIRTUAL','getDataValue','STRING','sequelize','exports'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x2234,0x6c));var _0x4223=function(_0x4c9f76,_0x5e0403){_0x4c9f76=_0x4c9f76-0x0;var _0x551afe=_0x2234[_0x4c9f76];return _0x551afe;};'use strict';var Sequelize=require(_0x4223('0x0'));module[_0x4223('0x1')]={'name':{'type':Sequelize[_0x4223('0x2')],'get':function(_0x5f1b9e){return this[_0x4223('0x3')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x4223('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x4223('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index ac75db5..f4f70d4 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(_0x353ffc,_0x465b99){var _0x216d85=function(_0x1c7042){while(--_0x1c7042){_0x353ffc['push'](_0x353ffc['shift']());}};_0x216d85(++_0x465b99);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 _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(_0x3d5e6d,_0xa8385b){var _0x1c3bf3=function(_0x5e0a23){while(--_0x5e0a23){_0x3d5e6d['push'](_0x3d5e6d['shift']());}};_0x1c3bf3(++_0xa8385b);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index d773f44..deec81f 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 _0x0c3d=['./condition.attributes','exports','define','Condition','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b6c0c,_0x51ef20){var _0x178991=function(_0x3b6f64){while(--_0x3b6f64){_0x1b6c0c['push'](_0x1b6c0c['shift']());}};_0x178991(++_0x51ef20);}(_0x0c3d,0x1c0));var _0xd0c3=function(_0x563129,_0x26d5f9){_0x563129=_0x563129-0x0;var _0x28d1a3=_0x0c3d[_0x563129];return _0x28d1a3;};'use strict';var _=require(_0xd0c3('0x0'));var util=require(_0xd0c3('0x1'));var logger=require(_0xd0c3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd0c3('0x3'));var rp=require(_0xd0c3('0x4'));var fs=require('fs');var path=require(_0xd0c3('0x5'));var rimraf=require(_0xd0c3('0x6'));var config=require(_0xd0c3('0x7'));var attributes=require(_0xd0c3('0x8'));module[_0xd0c3('0x9')]=function(_0x4e2f2b,_0xe2f29e){return _0x4e2f2b[_0xd0c3('0xa')](_0xd0c3('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1616=['exports','define','Condition','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1616,0xfa));var _0x6161=function(_0x3ab164,_0x2fa5e9){_0x3ab164=_0x3ab164-0x0;var _0x39565e=_0x1616[_0x3ab164];return _0x39565e;};'use strict';var _=require(_0x6161('0x0'));var util=require(_0x6161('0x1'));var logger=require(_0x6161('0x2'))(_0x6161('0x3'));var moment=require(_0x6161('0x4'));var BPromise=require(_0x6161('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6161('0x6'));var rimraf=require(_0x6161('0x7'));var config=require(_0x6161('0x8'));var attributes=require(_0x6161('0x9'));module[_0x6161('0xa')]=function(_0x1ae2d1,_0x3c2b65){return _0x1ae2d1[_0x6161('0xb')](_0x6161('0xc'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index d86ea64..073246b 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 _0xe846=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x2857fc,_0x411fd1){var _0x49047c=function(_0x30ceb2){while(--_0x30ceb2){_0x2857fc['push'](_0x2857fc['shift']());}};_0x49047c(++_0x411fd1);}(_0xe846,0xb4));var _0x6e84=function(_0x586bf1,_0x436f7a){_0x586bf1=_0x586bf1-0x0;var _0x4fe996=_0xe846[_0x586bf1];return _0x4fe996;};'use strict';var _=require(_0x6e84('0x0'));var util=require('util');var moment=require(_0x6e84('0x1'));var BPromise=require(_0x6e84('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e84('0x3'));var db=require(_0x6e84('0x4'))['db'];var utils=require(_0x6e84('0x5'));var logger=require(_0x6e84('0x6'))('rpc');var config=require(_0x6e84('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6e84('0x8')][_0x6e84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c58f8,_0x58feee,_0x456d59){return new BPromise(function(_0xe377c5,_0x181a0f){return client[_0x6e84('0xa')](_0x2c58f8,_0x456d59)[_0x6e84('0xb')](function(_0x41e83a){logger[_0x6e84('0xc')](_0x6e84('0xd'),_0x58feee,_0x6e84('0xe'));logger['debug'](_0x6e84('0xf'),_0x58feee,_0x6e84('0xe'),JSON[_0x6e84('0x10')](_0x41e83a));if(_0x41e83a[_0x6e84('0x11')]){if(_0x41e83a[_0x6e84('0x11')]['code']===0x1f4){logger['error'](_0x6e84('0xd'),_0x58feee,_0x41e83a[_0x6e84('0x11')][_0x6e84('0x12')]);return _0x181a0f(_0x41e83a[_0x6e84('0x11')][_0x6e84('0x12')]);}logger[_0x6e84('0x11')]('Condition,\x20%s,\x20%s',_0x58feee,_0x41e83a[_0x6e84('0x11')][_0x6e84('0x12')]);return _0xe377c5(_0x41e83a[_0x6e84('0x11')][_0x6e84('0x12')]);}else{logger[_0x6e84('0xc')](_0x6e84('0xd'),_0x58feee,_0x6e84('0xe'));_0xe377c5(_0x41e83a['result']['message']);}})[_0x6e84('0x13')](function(_0x2a0c86){logger[_0x6e84('0x11')]('Condition,\x20%s,\x20%s',_0x58feee,_0x2a0c86);_0x181a0f(_0x2a0c86);});});} \ No newline at end of file +var _0xd0be=['request','then','info','Condition,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x3bc3fd,_0x1f6a7e){var _0x85df7=function(_0x580b03){while(--_0x580b03){_0x3bc3fd['push'](_0x3bc3fd['shift']());}};_0x85df7(++_0x1f6a7e);}(_0xd0be,0x182));var _0xed0b=function(_0x37b9ad,_0x179adf){_0x37b9ad=_0x37b9ad-0x0;var _0x6264e2=_0xd0be[_0x37b9ad];return _0x6264e2;};'use strict';var _=require(_0xed0b('0x0'));var util=require(_0xed0b('0x1'));var moment=require(_0xed0b('0x2'));var BPromise=require(_0xed0b('0x3'));var rs=require(_0xed0b('0x4'));var fs=require('fs');var Redis=require(_0xed0b('0x5'));var db=require(_0xed0b('0x6'))['db'];var utils=require(_0xed0b('0x7'));var logger=require(_0xed0b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed0b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x213d0e,_0x12cd3a,_0x6fdd58){return new BPromise(function(_0x6f1607,_0x5dd87a){return client[_0xed0b('0xa')](_0x213d0e,_0x6fdd58)[_0xed0b('0xb')](function(_0x16a789){logger[_0xed0b('0xc')](_0xed0b('0xd'),_0x12cd3a,_0xed0b('0xe'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x12cd3a,_0xed0b('0xe'),JSON[_0xed0b('0xf')](_0x16a789));if(_0x16a789[_0xed0b('0x10')]){if(_0x16a789['error']['code']===0x1f4){logger[_0xed0b('0x10')]('Condition,\x20%s,\x20%s',_0x12cd3a,_0x16a789[_0xed0b('0x10')][_0xed0b('0x11')]);return _0x5dd87a(_0x16a789[_0xed0b('0x10')]['message']);}logger[_0xed0b('0x10')]('Condition,\x20%s,\x20%s',_0x12cd3a,_0x16a789[_0xed0b('0x10')][_0xed0b('0x11')]);return _0x6f1607(_0x16a789['error']['message']);}else{logger[_0xed0b('0xc')](_0xed0b('0xd'),_0x12cd3a,_0xed0b('0xe'));_0x6f1607(_0x16a789['result'][_0xed0b('0x11')]);}})['catch'](function(_0x5217df){logger[_0xed0b('0x10')](_0xed0b('0xd'),_0x12cd3a,_0x5217df);_0x5dd87a(_0x5217df);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index d9ebe4e..48e0160 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 _0xaa3e=['isAuthenticated','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./condition.controller','/:id'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xaa3e,0x100));var _0xeaa3=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xaa3e[_0x4ed4d2];return _0x15ae2e;};'use strict';var multer=require('multer');var util=require(_0xeaa3('0x0'));var path=require('path');var timeout=require(_0xeaa3('0x1'));var express=require(_0xeaa3('0x2'));var router=express[_0xeaa3('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xeaa3('0x4'));var config=require(_0xeaa3('0x5'));var controller=require(_0xeaa3('0x6'));router['put'](_0xeaa3('0x7'),auth[_0xeaa3('0x8')](),controller['update']);router[_0xeaa3('0x9')](_0xeaa3('0x7'),auth[_0xeaa3('0x8')](),controller['destroy']);module[_0xeaa3('0xa')]=router; \ No newline at end of file +var _0x3446=['../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1a9b94,_0x4d763e){var _0x379102=function(_0x1d9e7c){while(--_0x1d9e7c){_0x1a9b94['push'](_0x1a9b94['shift']());}};_0x379102(++_0x4d763e);}(_0x3446,0xbc));var _0x6344=function(_0x55ad69,_0xdfa7e3){_0x55ad69=_0x55ad69-0x0;var _0x368488=_0x3446[_0x55ad69];return _0x368488;};'use strict';var multer=require(_0x6344('0x0'));var util=require(_0x6344('0x1'));var path=require('path');var timeout=require(_0x6344('0x2'));var express=require(_0x6344('0x3'));var router=express[_0x6344('0x4')]();var fs_extra=require(_0x6344('0x5'));var auth=require(_0x6344('0x6'));var interaction=require(_0x6344('0x7'));var config=require(_0x6344('0x8'));var controller=require(_0x6344('0x9'));router['put'](_0x6344('0xa'),auth[_0x6344('0xb')](),controller[_0x6344('0xc')]);router['delete'](_0x6344('0xa'),auth[_0x6344('0xb')](),controller[_0x6344('0xd')]);module[_0x6344('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 622e65d..7058872 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 _0x60e1=['exports','INTEGER','STRING','sequelize'];(function(_0x27b070,_0x217d9b){var _0x1d8ecb=function(_0x1f0dec){while(--_0x1f0dec){_0x27b070['push'](_0x27b070['shift']());}};_0x1d8ecb(++_0x217d9b);}(_0x60e1,0xbf));var _0x160e=function(_0x53a9fc,_0x4aa510){_0x53a9fc=_0x53a9fc-0x0;var _0xc73782=_0x60e1[_0x53a9fc];return _0xc73782;};'use strict';var Sequelize=require(_0x160e('0x0'));module[_0x160e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x160e('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x160e('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x0601=['exports','STRING','name','INTEGER','sequelize'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x0601,0xd6));var _0x1060=function(_0x41397f,_0x391216){_0x41397f=_0x41397f-0x0;var _0x136f79=_0x0601[_0x41397f];return _0x136f79;};'use strict';var Sequelize=require(_0x1060('0x0'));module[_0x1060('0x1')]={'name':{'type':Sequelize[_0x1060('0x2')],'allowNull':![],'unique':_0x1060('0x3')},'OrderBy':{'type':Sequelize[_0x1060('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x1060('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 2bcc536..3e961a6 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 _0x056b=['find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','CmContactHasItem','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','ContactItemTypes','error','stack','name','index','map','ContactItemType','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll'];(function(_0xc6aa88,_0x1fe80f){var _0x2d1a11=function(_0x551273){while(--_0x551273){_0xc6aa88['push'](_0xc6aa88['shift']());}};_0x2d1a11(++_0x1fe80f);}(_0x056b,0xb6));var _0xb056=function(_0x53594d,_0xb372ae){_0x53594d=_0x53594d-0x0;var _0x3b2544=_0x056b[_0x53594d];return _0x3b2544;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb056('0x0'));var zipdir=require(_0xb056('0x1'));var jsonpatch=require(_0xb056('0x2'));var rp=require(_0xb056('0x3'));var moment=require(_0xb056('0x4'));var BPromise=require(_0xb056('0x5'));var Mustache=require(_0xb056('0x6'));var util=require(_0xb056('0x7'));var path=require(_0xb056('0x8'));var sox=require(_0xb056('0x9'));var csv=require(_0xb056('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb056('0xb'));var _=require(_0xb056('0xc'));var squel=require(_0xb056('0xd'));var crypto=require(_0xb056('0xe'));var jsforce=require(_0xb056('0xf'));var deskjs=require(_0xb056('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb056('0x11'));var Redis=require(_0xb056('0x12'));var authService=require(_0xb056('0x13'));var qs=require(_0xb056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb056('0x15'));var logger=require('../../config/logger')(_0xb056('0x16'));var utils=require(_0xb056('0x17'));var config=require(_0xb056('0x18'));var licenseUtil=require(_0xb056('0x19'));var db=require(_0xb056('0x1a'))['db'];function respondWithStatusCode(_0x5d8306,_0x49c5ec){_0x49c5ec=_0x49c5ec||0xcc;return function(_0xf3e80f){if(_0xf3e80f){return _0x5d8306[_0xb056('0x1b')](_0x49c5ec);}return _0x5d8306['status'](_0x49c5ec)[_0xb056('0x1c')]();};}function respondWithResult(_0x34611b,_0xf1c2e9){_0xf1c2e9=_0xf1c2e9||0xc8;return function(_0x1197e5){if(_0x1197e5){return _0x34611b[_0xb056('0x1d')](_0xf1c2e9)[_0xb056('0x1e')](_0x1197e5);}};}function respondWithFilteredResult(_0x179e49,_0x4b838e){return function(_0x162146){if(_0x162146){var _0x43565e=typeof _0x4b838e[_0xb056('0x1f')]===_0xb056('0x20')&&typeof _0x4b838e['limit']===_0xb056('0x20');var _0x4e501a=_0x162146[_0xb056('0x21')];var _0x311eb9=_0x43565e?0x0:_0x4b838e['offset'];var _0x29c77e=_0x43565e?_0x162146['count']:_0x4b838e[_0xb056('0x1f')]+_0x4b838e[_0xb056('0x22')];var _0x5e4bd9;if(_0x29c77e>=_0x4e501a){_0x29c77e=_0x4e501a;_0x5e4bd9=0xc8;}else{_0x5e4bd9=0xce;}_0x179e49[_0xb056('0x1d')](_0x5e4bd9);return _0x179e49['set'](_0xb056('0x23'),_0x311eb9+'-'+_0x29c77e+'/'+_0x4e501a)[_0xb056('0x1e')](_0x162146);}return null;};}function patchUpdates(_0x457b54){return function(_0x33dd35){try{jsonpatch['apply'](_0x33dd35,_0x457b54,!![]);}catch(_0x1db585){return BPromise['reject'](_0x1db585);}return _0x33dd35[_0xb056('0x24')]();};}function saveUpdates(_0x5dea90,_0x324ce6){return function(_0x40ac2d){if(_0x40ac2d){return _0x40ac2d[_0xb056('0x25')](_0x5dea90)[_0xb056('0x26')](function(_0x36e539){return _0x36e539;});}return null;};}function removeEntity(_0x4bb6c0,_0x4e66c3){return function(_0x1016da){if(_0x1016da){return _0x1016da[_0xb056('0x27')]()[_0xb056('0x26')](function(){var _0x1bd6ac=_0x1016da['get']({'plain':!![]});var _0x44a14f=_0xb056('0x28');return db['UserProfileResource'][_0xb056('0x27')]({'where':{'type':_0x44a14f,'resourceId':_0x1bd6ac['id']}})[_0xb056('0x26')](function(){return _0x1016da;});})[_0xb056('0x26')](function(){_0x4bb6c0[_0xb056('0x1d')](0xcc)[_0xb056('0x1c')]();});}};}function handleEntityNotFound(_0x4024d7,_0x211898){return function(_0x2042f1){if(!_0x2042f1){_0x4024d7['sendStatus'](0x194);}return _0x2042f1;};}function handleError(_0x29fbc1,_0x51b06b){_0x51b06b=_0x51b06b||0x1f4;return function(_0x3d83d3){logger[_0xb056('0x29')](_0x3d83d3[_0xb056('0x2a')]);if(_0x3d83d3['name']){delete _0x3d83d3[_0xb056('0x2b')];}_0x29fbc1[_0xb056('0x1d')](_0x51b06b)['send'](_0x3d83d3);};}exports[_0xb056('0x2c')]=function(_0x43aa63,_0x329eaa){var _0x1fad05={},_0x3ce984={},_0x4ebca5={'count':0x0,'rows':[]};var _0x87f31e=_[_0xb056('0x2d')](db[_0xb056('0x2e')][_0xb056('0x2f')],function(_0x103482){return{'name':_0x103482['fieldName'],'type':_0x103482[_0xb056('0x30')][_0xb056('0x31')]};});_0x3ce984[_0xb056('0x32')]=_[_0xb056('0x2d')](_0x87f31e,_0xb056('0x2b'));_0x3ce984[_0xb056('0x33')]=_[_0xb056('0x34')](_0x43aa63[_0xb056('0x33')]);_0x3ce984['filters']=_[_0xb056('0x35')](_0x3ce984['model'],_0x3ce984[_0xb056('0x33')]);_0x1fad05['attributes']=_['intersection'](_0x3ce984[_0xb056('0x32')],qs[_0xb056('0x36')](_0x43aa63[_0xb056('0x33')][_0xb056('0x36')]));_0x1fad05[_0xb056('0x37')]=_0x1fad05[_0xb056('0x37')][_0xb056('0x38')]?_0x1fad05['attributes']:_0x3ce984[_0xb056('0x32')];if(!_0x43aa63[_0xb056('0x33')]['hasOwnProperty']('nolimit')){_0x1fad05[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x43aa63[_0xb056('0x33')]['limit']);_0x1fad05[_0xb056('0x1f')]=qs[_0xb056('0x1f')](_0x43aa63[_0xb056('0x33')][_0xb056('0x1f')]);}_0x1fad05[_0xb056('0x39')]=qs[_0xb056('0x3a')](_0x43aa63[_0xb056('0x33')][_0xb056('0x3a')]);_0x1fad05[_0xb056('0x3b')]=qs[_0xb056('0x3c')](_[_0xb056('0x3d')](_0x43aa63[_0xb056('0x33')],_0x3ce984['filters']),_0x87f31e);if(_0x43aa63[_0xb056('0x33')]['filter']){_0x1fad05[_0xb056('0x3b')]=_[_0xb056('0x3e')](_0x1fad05[_0xb056('0x3b')],{'$or':_[_0xb056('0x2d')](_0x87f31e,function(_0x460f28){if(_0x460f28[_0xb056('0x30')]!==_0xb056('0x3f')){var _0x42b54f={};_0x42b54f[_0x460f28['name']]={'$like':'%'+_0x43aa63[_0xb056('0x33')][_0xb056('0x40')]+'%'};return _0x42b54f;}})});}_0x1fad05=_[_0xb056('0x3e')]({},_0x1fad05,_0x43aa63[_0xb056('0x41')]);var _0x134db7={'where':_0x1fad05['where']};return db[_0xb056('0x2e')][_0xb056('0x21')](_0x134db7)[_0xb056('0x26')](function(_0x216f72){_0x4ebca5[_0xb056('0x21')]=_0x216f72;if(_0x43aa63[_0xb056('0x33')]['includeAll']){_0x1fad05[_0xb056('0x42')]=[{'all':!![]}];}return db['ContactItemType'][_0xb056('0x43')](_0x1fad05);})[_0xb056('0x26')](function(_0x21d98e){_0x4ebca5[_0xb056('0x44')]=_0x21d98e;return _0x4ebca5;})[_0xb056('0x26')](respondWithFilteredResult(_0x329eaa,_0x1fad05))[_0xb056('0x45')](handleError(_0x329eaa,null));};exports[_0xb056('0x46')]=function(_0x248819,_0x2c8b61){var _0x149341={'raw':!![],'where':{'id':_0x248819[_0xb056('0x47')]['id']}},_0x4fa3c5={};_0x4fa3c5[_0xb056('0x32')]=_[_0xb056('0x34')](db['ContactItemType'][_0xb056('0x2f')]);_0x4fa3c5[_0xb056('0x33')]=_['keys'](_0x248819['query']);_0x4fa3c5[_0xb056('0x3c')]=_[_0xb056('0x35')](_0x4fa3c5[_0xb056('0x32')],_0x4fa3c5[_0xb056('0x33')]);_0x149341['attributes']=_['intersection'](_0x4fa3c5['model'],qs['fields'](_0x248819['query']['fields']));_0x149341[_0xb056('0x37')]=_0x149341['attributes'][_0xb056('0x38')]?_0x149341[_0xb056('0x37')]:_0x4fa3c5[_0xb056('0x32')];if(_0x248819[_0xb056('0x33')][_0xb056('0x48')]){_0x149341[_0xb056('0x42')]=[{'all':!![]}];}_0x149341=_[_0xb056('0x3e')]({},_0x149341,_0x248819[_0xb056('0x41')]);return db['ContactItemType'][_0xb056('0x49')](_0x149341)[_0xb056('0x26')](handleEntityNotFound(_0x2c8b61,null))['then'](respondWithResult(_0x2c8b61,null))[_0xb056('0x45')](handleError(_0x2c8b61,null));};exports[_0xb056('0x4a')]=function(_0xe40439,_0x2f2d22){return db[_0xb056('0x2e')][_0xb056('0x4a')](_0xe40439['body'],{})[_0xb056('0x26')](function(_0x5e2224){var _0x132268=_0xe40439[_0xb056('0x4b')][_0xb056('0x4c')]({'plain':!![]});if(!_0x132268)throw new Error(_0xb056('0x4d'));if(_0x132268[_0xb056('0x4e')]===_0xb056('0x4b')){var _0x2b6733=_0x5e2224[_0xb056('0x4c')]({'plain':!![]});var _0x5a3bbf=_0xb056('0x28');return db[_0xb056('0x4f')][_0xb056('0x49')]({'where':{'name':_0x5a3bbf,'userProfileId':_0x132268[_0xb056('0x50')]},'raw':!![]})[_0xb056('0x26')](function(_0x35acab){if(_0x35acab&&_0x35acab[_0xb056('0x51')]===0x0){return db[_0xb056('0x52')]['create']({'name':_0x2b6733[_0xb056('0x2b')],'resourceId':_0x2b6733['id'],'type':_0x35acab[_0xb056('0x2b')],'sectionId':_0x35acab['id']},{})[_0xb056('0x26')](function(){return _0x5e2224;});}else{return _0x5e2224;}})[_0xb056('0x45')](function(_0x1a5170){logger[_0xb056('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a5170);throw _0x1a5170;});}return _0x5e2224;})[_0xb056('0x26')](respondWithResult(_0x2f2d22,0xc9))[_0xb056('0x45')](handleError(_0x2f2d22,null));};exports[_0xb056('0x25')]=function(_0x536d85,_0x37c64c){if(_0x536d85['body']['id']){delete _0x536d85[_0xb056('0x53')]['id'];}return db[_0xb056('0x2e')][_0xb056('0x49')]({'where':{'id':_0x536d85[_0xb056('0x47')]['id']}})['then'](handleEntityNotFound(_0x37c64c,null))[_0xb056('0x26')](saveUpdates(_0x536d85[_0xb056('0x53')],null))['then'](respondWithResult(_0x37c64c,null))[_0xb056('0x45')](handleError(_0x37c64c,null));};exports[_0xb056('0x27')]=function(_0x1d3cdd,_0x1546e5){return db[_0xb056('0x2e')]['find']({'where':{'id':_0x1d3cdd[_0xb056('0x47')]['id']}})[_0xb056('0x26')](handleEntityNotFound(_0x1546e5,null))[_0xb056('0x26')](db[_0xb056('0x54')][_0xb056('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1d3cdd[_0xb056('0x47')]['id']}}))[_0xb056('0x26')](removeEntity(_0x1546e5,null))[_0xb056('0x45')](handleError(_0x1546e5,null));}; \ No newline at end of file +var _0xfb11=['show','keys','rawAttributes','includeAll','include','find','body','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','ContactItemTypes','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','ContactItemType','findAll','rows','catch'];(function(_0x858df5,_0x11f7f4){var _0x2569fe=function(_0x5bbfee){while(--_0x5bbfee){_0x858df5['push'](_0x858df5['shift']());}};_0x2569fe(++_0x11f7f4);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xfb11[_0x12d033];return _0x3b4e80;};'use strict';var emlformat=require(_0x1fb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fb1('0x1'));var jsonpatch=require(_0x1fb1('0x2'));var rp=require('request-promise');var moment=require(_0x1fb1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1fb1('0x4'));var util=require('util');var path=require(_0x1fb1('0x5'));var sox=require(_0x1fb1('0x6'));var csv=require('to-csv');var ejs=require(_0x1fb1('0x7'));var fs=require('fs');var fs_extra=require(_0x1fb1('0x8'));var _=require('lodash');var squel=require(_0x1fb1('0x9'));var crypto=require(_0x1fb1('0xa'));var jsforce=require(_0x1fb1('0xb'));var deskjs=require(_0x1fb1('0xc'));var toCsv=require(_0x1fb1('0xd'));var querystring=require(_0x1fb1('0xe'));var Papa=require(_0x1fb1('0xf'));var Redis=require(_0x1fb1('0x10'));var authService=require(_0x1fb1('0x11'));var qs=require(_0x1fb1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fb1('0x13'));var logger=require('../../config/logger')(_0x1fb1('0x14'));var utils=require('../../config/utils');var config=require(_0x1fb1('0x15'));var licenseUtil=require(_0x1fb1('0x16'));var db=require(_0x1fb1('0x17'))['db'];function respondWithStatusCode(_0x10bcac,_0x333229){_0x333229=_0x333229||0xcc;return function(_0x14f290){if(_0x14f290){return _0x10bcac['sendStatus'](_0x333229);}return _0x10bcac[_0x1fb1('0x18')](_0x333229)[_0x1fb1('0x19')]();};}function respondWithResult(_0x2c5be1,_0x44f24c){_0x44f24c=_0x44f24c||0xc8;return function(_0xd83038){if(_0xd83038){return _0x2c5be1[_0x1fb1('0x18')](_0x44f24c)[_0x1fb1('0x1a')](_0xd83038);}};}function respondWithFilteredResult(_0x316fe5,_0x358b58){return function(_0x4cbe42){if(_0x4cbe42){var _0x5c8d23=typeof _0x358b58[_0x1fb1('0x1b')]===_0x1fb1('0x1c')&&typeof _0x358b58[_0x1fb1('0x1d')]==='undefined';var _0x161ca3=_0x4cbe42[_0x1fb1('0x1e')];var _0x24d4df=_0x5c8d23?0x0:_0x358b58[_0x1fb1('0x1b')];var _0x33c6b6=_0x5c8d23?_0x4cbe42[_0x1fb1('0x1e')]:_0x358b58[_0x1fb1('0x1b')]+_0x358b58[_0x1fb1('0x1d')];var _0x4041ea;if(_0x33c6b6>=_0x161ca3){_0x33c6b6=_0x161ca3;_0x4041ea=0xc8;}else{_0x4041ea=0xce;}_0x316fe5['status'](_0x4041ea);return _0x316fe5[_0x1fb1('0x1f')]('Content-Range',_0x24d4df+'-'+_0x33c6b6+'/'+_0x161ca3)['json'](_0x4cbe42);}return null;};}function patchUpdates(_0xdf9c1b){return function(_0x313d9a){try{jsonpatch[_0x1fb1('0x20')](_0x313d9a,_0xdf9c1b,!![]);}catch(_0x54ad97){return BPromise[_0x1fb1('0x21')](_0x54ad97);}return _0x313d9a['save']();};}function saveUpdates(_0x5c76f5,_0x532c63){return function(_0x31178c){if(_0x31178c){return _0x31178c[_0x1fb1('0x22')](_0x5c76f5)[_0x1fb1('0x23')](function(_0x10924f){return _0x10924f;});}return null;};}function removeEntity(_0x303a06,_0x53b8af){return function(_0x4272c7){if(_0x4272c7){return _0x4272c7[_0x1fb1('0x24')]()[_0x1fb1('0x23')](function(){var _0x5fc9e6=_0x4272c7[_0x1fb1('0x25')]({'plain':!![]});var _0x1353a4=_0x1fb1('0x26');return db[_0x1fb1('0x27')]['destroy']({'where':{'type':_0x1353a4,'resourceId':_0x5fc9e6['id']}})[_0x1fb1('0x23')](function(){return _0x4272c7;});})[_0x1fb1('0x23')](function(){_0x303a06[_0x1fb1('0x18')](0xcc)[_0x1fb1('0x19')]();});}};}function handleEntityNotFound(_0x1898e7,_0x29e1bd){return function(_0x1a74c4){if(!_0x1a74c4){_0x1898e7[_0x1fb1('0x28')](0x194);}return _0x1a74c4;};}function handleError(_0xa7bba,_0x33a3b7){_0x33a3b7=_0x33a3b7||0x1f4;return function(_0x5e99e7){logger[_0x1fb1('0x29')](_0x5e99e7[_0x1fb1('0x2a')]);if(_0x5e99e7[_0x1fb1('0x2b')]){delete _0x5e99e7[_0x1fb1('0x2b')];}_0xa7bba['status'](_0x33a3b7)[_0x1fb1('0x2c')](_0x5e99e7);};}exports[_0x1fb1('0x2d')]=function(_0x90d8ef,_0x1b71cb){var _0x5402e9={},_0x245f84={},_0x30c8eb={'count':0x0,'rows':[]};var _0x5d45a5=_[_0x1fb1('0x2e')](db['ContactItemType']['rawAttributes'],function(_0x354e92){return{'name':_0x354e92[_0x1fb1('0x2f')],'type':_0x354e92['type'][_0x1fb1('0x30')]};});_0x245f84[_0x1fb1('0x31')]=_[_0x1fb1('0x2e')](_0x5d45a5,_0x1fb1('0x2b'));_0x245f84[_0x1fb1('0x32')]=_['keys'](_0x90d8ef[_0x1fb1('0x32')]);_0x245f84[_0x1fb1('0x33')]=_[_0x1fb1('0x34')](_0x245f84[_0x1fb1('0x31')],_0x245f84[_0x1fb1('0x32')]);_0x5402e9[_0x1fb1('0x35')]=_[_0x1fb1('0x34')](_0x245f84[_0x1fb1('0x31')],qs[_0x1fb1('0x36')](_0x90d8ef['query'][_0x1fb1('0x36')]));_0x5402e9['attributes']=_0x5402e9[_0x1fb1('0x35')]['length']?_0x5402e9[_0x1fb1('0x35')]:_0x245f84['model'];if(!_0x90d8ef['query'][_0x1fb1('0x37')](_0x1fb1('0x38'))){_0x5402e9[_0x1fb1('0x1d')]=qs[_0x1fb1('0x1d')](_0x90d8ef['query'][_0x1fb1('0x1d')]);_0x5402e9[_0x1fb1('0x1b')]=qs[_0x1fb1('0x1b')](_0x90d8ef['query'][_0x1fb1('0x1b')]);}_0x5402e9[_0x1fb1('0x39')]=qs[_0x1fb1('0x3a')](_0x90d8ef[_0x1fb1('0x32')][_0x1fb1('0x3a')]);_0x5402e9[_0x1fb1('0x3b')]=qs[_0x1fb1('0x33')](_['pick'](_0x90d8ef[_0x1fb1('0x32')],_0x245f84[_0x1fb1('0x33')]),_0x5d45a5);if(_0x90d8ef['query'][_0x1fb1('0x3c')]){_0x5402e9['where']=_[_0x1fb1('0x3d')](_0x5402e9[_0x1fb1('0x3b')],{'$or':_[_0x1fb1('0x2e')](_0x5d45a5,function(_0x439eec){if(_0x439eec[_0x1fb1('0x3e')]!==_0x1fb1('0x3f')){var _0x927301={};_0x927301[_0x439eec[_0x1fb1('0x2b')]]={'$like':'%'+_0x90d8ef[_0x1fb1('0x32')][_0x1fb1('0x3c')]+'%'};return _0x927301;}})});}_0x5402e9=_[_0x1fb1('0x3d')]({},_0x5402e9,_0x90d8ef[_0x1fb1('0x40')]);var _0xafc9a7={'where':_0x5402e9[_0x1fb1('0x3b')]};return db[_0x1fb1('0x41')]['count'](_0xafc9a7)[_0x1fb1('0x23')](function(_0xca1fd3){_0x30c8eb[_0x1fb1('0x1e')]=_0xca1fd3;if(_0x90d8ef[_0x1fb1('0x32')]['includeAll']){_0x5402e9['include']=[{'all':!![]}];}return db[_0x1fb1('0x41')][_0x1fb1('0x42')](_0x5402e9);})[_0x1fb1('0x23')](function(_0x3edc8a){_0x30c8eb[_0x1fb1('0x43')]=_0x3edc8a;return _0x30c8eb;})[_0x1fb1('0x23')](respondWithFilteredResult(_0x1b71cb,_0x5402e9))[_0x1fb1('0x44')](handleError(_0x1b71cb,null));};exports[_0x1fb1('0x45')]=function(_0x14aa27,_0x320bda){var _0x4a943c={'raw':!![],'where':{'id':_0x14aa27['params']['id']}},_0x44ccbe={};_0x44ccbe['model']=_[_0x1fb1('0x46')](db[_0x1fb1('0x41')][_0x1fb1('0x47')]);_0x44ccbe[_0x1fb1('0x32')]=_['keys'](_0x14aa27['query']);_0x44ccbe[_0x1fb1('0x33')]=_[_0x1fb1('0x34')](_0x44ccbe[_0x1fb1('0x31')],_0x44ccbe[_0x1fb1('0x32')]);_0x4a943c[_0x1fb1('0x35')]=_[_0x1fb1('0x34')](_0x44ccbe[_0x1fb1('0x31')],qs[_0x1fb1('0x36')](_0x14aa27[_0x1fb1('0x32')]['fields']));_0x4a943c['attributes']=_0x4a943c[_0x1fb1('0x35')]['length']?_0x4a943c[_0x1fb1('0x35')]:_0x44ccbe[_0x1fb1('0x31')];if(_0x14aa27[_0x1fb1('0x32')][_0x1fb1('0x48')]){_0x4a943c[_0x1fb1('0x49')]=[{'all':!![]}];}_0x4a943c=_[_0x1fb1('0x3d')]({},_0x4a943c,_0x14aa27['options']);return db[_0x1fb1('0x41')][_0x1fb1('0x4a')](_0x4a943c)[_0x1fb1('0x23')](handleEntityNotFound(_0x320bda,null))['then'](respondWithResult(_0x320bda,null))[_0x1fb1('0x44')](handleError(_0x320bda,null));};exports['create']=function(_0x6e105b,_0xba4fa7){return db[_0x1fb1('0x41')]['create'](_0x6e105b[_0x1fb1('0x4b')],{})[_0x1fb1('0x23')](function(_0x52271f){var _0xe492ab=_0x6e105b[_0x1fb1('0x4c')][_0x1fb1('0x25')]({'plain':!![]});if(!_0xe492ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe492ab['role']==='user'){var _0x31a85a=_0x52271f[_0x1fb1('0x25')]({'plain':!![]});var _0x1e2754=_0x1fb1('0x26');return db[_0x1fb1('0x4d')][_0x1fb1('0x4a')]({'where':{'name':_0x1e2754,'userProfileId':_0xe492ab['userProfileId']},'raw':!![]})['then'](function(_0x267c36){if(_0x267c36&&_0x267c36[_0x1fb1('0x4e')]===0x0){return db[_0x1fb1('0x27')][_0x1fb1('0x4f')]({'name':_0x31a85a['name'],'resourceId':_0x31a85a['id'],'type':_0x267c36['name'],'sectionId':_0x267c36['id']},{})[_0x1fb1('0x23')](function(){return _0x52271f;});}else{return _0x52271f;}})['catch'](function(_0x41fefb){logger['error'](_0x1fb1('0x50'),_0x41fefb);throw _0x41fefb;});}return _0x52271f;})['then'](respondWithResult(_0xba4fa7,0xc9))[_0x1fb1('0x44')](handleError(_0xba4fa7,null));};exports[_0x1fb1('0x22')]=function(_0x1475ee,_0xca9395){if(_0x1475ee[_0x1fb1('0x4b')]['id']){delete _0x1475ee['body']['id'];}return db['ContactItemType'][_0x1fb1('0x4a')]({'where':{'id':_0x1475ee[_0x1fb1('0x51')]['id']}})['then'](handleEntityNotFound(_0xca9395,null))['then'](saveUpdates(_0x1475ee[_0x1fb1('0x4b')],null))[_0x1fb1('0x23')](respondWithResult(_0xca9395,null))[_0x1fb1('0x44')](handleError(_0xca9395,null));};exports[_0x1fb1('0x24')]=function(_0x439670,_0xc9e8d4){return db['ContactItemType'][_0x1fb1('0x4a')]({'where':{'id':_0x439670[_0x1fb1('0x51')]['id']}})[_0x1fb1('0x23')](handleEntityNotFound(_0xc9e8d4,null))[_0x1fb1('0x23')](db[_0x1fb1('0x52')][_0x1fb1('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x439670[_0x1fb1('0x51')]['id']}}))['then'](removeEntity(_0xc9e8d4,null))[_0x1fb1('0x44')](handleError(_0xc9e8d4,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index cbe94a0..0152bf7 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 _0x4a24=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0x4a24,0x1ce));var _0x44a2=function(_0x85d5a8,_0x1977be){_0x85d5a8=_0x85d5a8-0x0;var _0x20479b=_0x4a24[_0x85d5a8];return _0x20479b;};'use strict';var _=require(_0x44a2('0x0'));var util=require(_0x44a2('0x1'));var logger=require(_0x44a2('0x2'))(_0x44a2('0x3'));var moment=require(_0x44a2('0x4'));var BPromise=require(_0x44a2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x44a2('0x6'));var rimraf=require(_0x44a2('0x7'));var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module[_0x44a2('0x8')]=function(_0x957447,_0x1698de){return _0x957447[_0x44a2('0x9')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6301=['rimraf','../../config/environment','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','moment','bluebird'];(function(_0x49263c,_0x446eec){var _0x5760b0=function(_0x59f553){while(--_0x59f553){_0x49263c['push'](_0x49263c['shift']());}};_0x5760b0(++_0x446eec);}(_0x6301,0x8a));var _0x1630=function(_0xf5ed1b,_0x33a489){_0xf5ed1b=_0xf5ed1b-0x0;var _0x5ecbdb=_0x6301[_0xf5ed1b];return _0x5ecbdb;};'use strict';var _=require(_0x1630('0x0'));var util=require(_0x1630('0x1'));var logger=require(_0x1630('0x2'))('api');var moment=require(_0x1630('0x3'));var BPromise=require(_0x1630('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1630('0x5'));var config=require(_0x1630('0x6'));var attributes=require('./contactItemType.attributes');module[_0x1630('0x7')]=function(_0x87bd81,_0x170aee){return _0x87bd81[_0x1630('0x8')](_0x1630('0x9'),attributes,{'tableName':_0x1630('0xa'),'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 7c29b02..92bc4b0 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 _0x3bb2=['request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s'];(function(_0x2a661c,_0x5695ee){var _0x58d7fc=function(_0x35ab93){while(--_0x35ab93){_0x2a661c['push'](_0x2a661c['shift']());}};_0x58d7fc(++_0x5695ee);}(_0x3bb2,0x1b2));var _0x23bb=function(_0x3121e5,_0x428351){_0x3121e5=_0x3121e5-0x0;var _0x2f6c5e=_0x3bb2[_0x3121e5];return _0x2f6c5e;};'use strict';var _=require(_0x23bb('0x0'));var util=require(_0x23bb('0x1'));var moment=require(_0x23bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x23bb('0x3'));var fs=require('fs');var Redis=require(_0x23bb('0x4'));var db=require(_0x23bb('0x5'))['db'];var utils=require(_0x23bb('0x6'));var logger=require(_0x23bb('0x7'))('rpc');var config=require(_0x23bb('0x8'));var jayson=require(_0x23bb('0x9'));var client=jayson[_0x23bb('0xa')][_0x23bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5df7f5,_0x572e5f,_0x34c1d7){return new BPromise(function(_0x3c64a2,_0x3cf71d){return client[_0x23bb('0xc')](_0x5df7f5,_0x34c1d7)[_0x23bb('0xd')](function(_0x33762d){logger[_0x23bb('0xe')](_0x23bb('0xf'),_0x572e5f,_0x23bb('0x10'));logger[_0x23bb('0x11')](_0x23bb('0x12'),_0x572e5f,_0x23bb('0x10'),JSON[_0x23bb('0x13')](_0x33762d));if(_0x33762d[_0x23bb('0x14')]){if(_0x33762d[_0x23bb('0x14')][_0x23bb('0x15')]===0x1f4){logger['error'](_0x23bb('0xf'),_0x572e5f,_0x33762d[_0x23bb('0x14')][_0x23bb('0x16')]);return _0x3cf71d(_0x33762d[_0x23bb('0x14')][_0x23bb('0x16')]);}logger['error'](_0x23bb('0xf'),_0x572e5f,_0x33762d[_0x23bb('0x14')][_0x23bb('0x16')]);return _0x3c64a2(_0x33762d[_0x23bb('0x14')][_0x23bb('0x16')]);}else{logger[_0x23bb('0xe')](_0x23bb('0xf'),_0x572e5f,_0x23bb('0x10'));_0x3c64a2(_0x33762d[_0x23bb('0x17')][_0x23bb('0x16')]);}})[_0x23bb('0x18')](function(_0x3afe40){logger[_0x23bb('0x14')](_0x23bb('0xf'),_0x572e5f,_0x3afe40);_0x3cf71d(_0x3afe40);});});} \ No newline at end of file +var _0x484a=['stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x3ab675,_0x81bb8){var _0x2120ef=function(_0x2b82a9){while(--_0x2b82a9){_0x3ab675['push'](_0x3ab675['shift']());}};_0x2120ef(++_0x81bb8);}(_0x484a,0x191));var _0xa484=function(_0x3865b6,_0x44ec54){_0x3865b6=_0x3865b6-0x0;var _0x555947=_0x484a[_0x3865b6];return _0x555947;};'use strict';var _=require(_0xa484('0x0'));var util=require(_0xa484('0x1'));var moment=require('moment');var BPromise=require(_0xa484('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa484('0x3'));var db=require(_0xa484('0x4'))['db'];var utils=require(_0xa484('0x5'));var logger=require(_0xa484('0x6'))('rpc');var config=require(_0xa484('0x7'));var jayson=require(_0xa484('0x8'));var client=jayson[_0xa484('0x9')][_0xa484('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4891d8,_0x3f0ed8,_0x47ce1a){return new BPromise(function(_0x184ff1,_0x24251d){return client[_0xa484('0xb')](_0x4891d8,_0x47ce1a)[_0xa484('0xc')](function(_0x58b1f3){logger[_0xa484('0xd')](_0xa484('0xe'),_0x3f0ed8,_0xa484('0xf'));logger['debug'](_0xa484('0x10'),_0x3f0ed8,'request\x20sent',JSON[_0xa484('0x11')](_0x58b1f3));if(_0x58b1f3[_0xa484('0x12')]){if(_0x58b1f3[_0xa484('0x12')]['code']===0x1f4){logger['error'](_0xa484('0xe'),_0x3f0ed8,_0x58b1f3['error'][_0xa484('0x13')]);return _0x24251d(_0x58b1f3[_0xa484('0x12')]['message']);}logger[_0xa484('0x12')](_0xa484('0xe'),_0x3f0ed8,_0x58b1f3[_0xa484('0x12')][_0xa484('0x13')]);return _0x184ff1(_0x58b1f3['error'][_0xa484('0x13')]);}else{logger['info'](_0xa484('0xe'),_0x3f0ed8,_0xa484('0xf'));_0x184ff1(_0x58b1f3[_0xa484('0x14')][_0xa484('0x13')]);}})[_0xa484('0x15')](function(_0x2a4c2a){logger[_0xa484('0x12')](_0xa484('0xe'),_0x3f0ed8,_0x2a4c2a);_0x24251d(_0x2a4c2a);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 549ab11..bd9ed13 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 _0xf654=['put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create'];(function(_0x51730e,_0x36f487){var _0x32e3dd=function(_0xd20f07){while(--_0xd20f07){_0x51730e['push'](_0x51730e['shift']());}};_0x32e3dd(++_0x36f487);}(_0xf654,0x1b4));var _0x4f65=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf654[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4f65('0x0'));var util=require(_0x4f65('0x1'));var path=require(_0x4f65('0x2'));var timeout=require(_0x4f65('0x3'));var express=require('express');var router=express[_0x4f65('0x4')]();var fs_extra=require(_0x4f65('0x5'));var auth=require(_0x4f65('0x6'));var interaction=require(_0x4f65('0x7'));var config=require(_0x4f65('0x8'));var controller=require('./contactItemType.controller');router[_0x4f65('0x9')]('/',auth[_0x4f65('0xa')](),controller['index']);router['get'](_0x4f65('0xb'),auth[_0x4f65('0xa')](),controller['show']);router[_0x4f65('0xc')]('/',auth[_0x4f65('0xa')](),controller[_0x4f65('0xd')]);router[_0x4f65('0xe')](_0x4f65('0xb'),auth[_0x4f65('0xa')](),controller['update']);router[_0x4f65('0xf')](_0x4f65('0xb'),auth[_0x4f65('0xa')](),controller[_0x4f65('0x10')]);module[_0x4f65('0x11')]=router; \ No newline at end of file +var _0x19cc=['index','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated'];(function(_0x5436a1,_0x43ce08){var _0x46c586=function(_0x622b2b){while(--_0x622b2b){_0x5436a1['push'](_0x5436a1['shift']());}};_0x46c586(++_0x43ce08);}(_0x19cc,0x139));var _0xc19c=function(_0x4df1f5,_0x39c6d2){_0x4df1f5=_0x4df1f5-0x0;var _0x56585b=_0x19cc[_0x4df1f5];return _0x56585b;};'use strict';var multer=require(_0xc19c('0x0'));var util=require('util');var path=require(_0xc19c('0x1'));var timeout=require(_0xc19c('0x2'));var express=require(_0xc19c('0x3'));var router=express['Router']();var fs_extra=require(_0xc19c('0x4'));var auth=require(_0xc19c('0x5'));var interaction=require(_0xc19c('0x6'));var config=require('../../config/environment');var controller=require(_0xc19c('0x7'));router[_0xc19c('0x8')]('/',auth[_0xc19c('0x9')](),controller[_0xc19c('0xa')]);router[_0xc19c('0x8')]('/:id',auth[_0xc19c('0x9')](),controller[_0xc19c('0xb')]);router[_0xc19c('0xc')]('/',auth[_0xc19c('0x9')](),controller['create']);router[_0xc19c('0xd')](_0xc19c('0xe'),auth[_0xc19c('0x9')](),controller[_0xc19c('0xf')]);router[_0xc19c('0x10')](_0xc19c('0xe'),auth[_0xc19c('0x9')](),controller[_0xc19c('0x11')]);module[_0xc19c('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 fadeae8..d8474b8 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xb7e7,0x121));var _0x7b7e=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xb7e7[_0x39d544];return _0x5a5ff2;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x20cc2a,_0x26da27){var _0x433e78=function(_0xad4c7c){while(--_0xad4c7c){_0x20cc2a['push'](_0x20cc2a['shift']());}};_0x433e78(++_0x26da27);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 709255a..c24accc 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 _0xdb84=['attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','map','Dashboard','rawAttributes','type','model','query','keys','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','filter','merge','include','show','params','attributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','autoAssociation','catch','includeAll','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','custom','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0x5043a0,_0x21cadd){var _0x5eac3b=function(_0x28a702){while(--_0x28a702){_0x5043a0['push'](_0x5043a0['shift']());}};_0x5eac3b(++_0x21cadd);}(_0xdb84,0x190));var _0x4db8=function(_0xbb2c90,_0x3b0548){_0xbb2c90=_0xbb2c90-0x0;var _0x22063=_0xdb84[_0xbb2c90];return _0x22063;};'use strict';var emlformat=require(_0x4db8('0x0'));var rimraf=require(_0x4db8('0x1'));var zipdir=require(_0x4db8('0x2'));var jsonpatch=require(_0x4db8('0x3'));var rp=require(_0x4db8('0x4'));var moment=require(_0x4db8('0x5'));var BPromise=require(_0x4db8('0x6'));var Mustache=require(_0x4db8('0x7'));var util=require(_0x4db8('0x8'));var path=require(_0x4db8('0x9'));var sox=require(_0x4db8('0xa'));var csv=require(_0x4db8('0xb'));var ejs=require(_0x4db8('0xc'));var fs=require('fs');var fs_extra=require(_0x4db8('0xd'));var _=require(_0x4db8('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4db8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4db8('0xb'));var querystring=require(_0x4db8('0x10'));var Papa=require(_0x4db8('0x11'));var Redis=require(_0x4db8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4db8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4db8('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4db8('0x15'));var config=require(_0x4db8('0x16'));var licenseUtil=require(_0x4db8('0x17'));var db=require(_0x4db8('0x18'))['db'];config[_0x4db8('0x19')]=_[_0x4db8('0x1a')](config[_0x4db8('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x4db8('0x1b'))(new Redis(config[_0x4db8('0x19')]));require('./dashboard.socket')[_0x4db8('0x1c')](socket);function respondWithStatusCode(_0x5f3a3c,_0x126cc6){_0x126cc6=_0x126cc6||0xcc;return function(_0x2973b8){if(_0x2973b8){return _0x5f3a3c['sendStatus'](_0x126cc6);}return _0x5f3a3c[_0x4db8('0x1d')](_0x126cc6)[_0x4db8('0x1e')]();};}function respondWithResult(_0x5763c0,_0x46a0d9){_0x46a0d9=_0x46a0d9||0xc8;return function(_0x4b60bd){if(_0x4b60bd){return _0x5763c0[_0x4db8('0x1d')](_0x46a0d9)[_0x4db8('0x1f')](_0x4b60bd);}};}function respondWithFilteredResult(_0x5b90f8,_0x5bb57e){return function(_0x565310){if(_0x565310){var _0x44efe7=typeof _0x5bb57e[_0x4db8('0x20')]===_0x4db8('0x21')&&typeof _0x5bb57e[_0x4db8('0x22')]===_0x4db8('0x21');var _0x25fc0c=_0x565310[_0x4db8('0x23')];var _0xa7c2ed=_0x44efe7?0x0:_0x5bb57e['offset'];var _0x501cfe=_0x44efe7?_0x565310[_0x4db8('0x23')]:_0x5bb57e['offset']+_0x5bb57e[_0x4db8('0x22')];var _0xbebf74;if(_0x501cfe>=_0x25fc0c){_0x501cfe=_0x25fc0c;_0xbebf74=0xc8;}else{_0xbebf74=0xce;}_0x5b90f8[_0x4db8('0x1d')](_0xbebf74);return _0x5b90f8['set'](_0x4db8('0x24'),_0xa7c2ed+'-'+_0x501cfe+'/'+_0x25fc0c)[_0x4db8('0x1f')](_0x565310);}return null;};}function patchUpdates(_0x2df74b){return function(_0x39ecd4){try{jsonpatch[_0x4db8('0x25')](_0x39ecd4,_0x2df74b,!![]);}catch(_0x1929c3){return BPromise[_0x4db8('0x26')](_0x1929c3);}return _0x39ecd4[_0x4db8('0x27')]();};}function saveUpdates(_0x919878,_0x306238){return function(_0x1b37f6){if(_0x1b37f6){return _0x1b37f6[_0x4db8('0x28')](_0x919878)[_0x4db8('0x29')](function(_0x5155b3){return _0x5155b3;});}return null;};}function removeEntity(_0x3ba984,_0x33157f){return function(_0x4153b2){if(_0x4153b2){return _0x4153b2[_0x4db8('0x2a')]()['then'](function(){var _0x5ec311=_0x4153b2[_0x4db8('0x2b')]({'plain':!![]});var _0xc64ef8='CustomDashboards';return db[_0x4db8('0x2c')]['destroy']({'where':{'type':_0xc64ef8,'resourceId':_0x5ec311['id']}})[_0x4db8('0x29')](function(){return _0x4153b2;});})[_0x4db8('0x29')](function(){_0x3ba984[_0x4db8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd240d4,_0x3f6211){return function(_0x3dce0c){if(!_0x3dce0c){_0xd240d4[_0x4db8('0x2d')](0x194);}return _0x3dce0c;};}function handleError(_0x2db965,_0x2f89a7){_0x2f89a7=_0x2f89a7||0x1f4;return function(_0x38a5ff){logger[_0x4db8('0x2e')](_0x38a5ff[_0x4db8('0x2f')]);if(_0x38a5ff[_0x4db8('0x30')]){delete _0x38a5ff[_0x4db8('0x30')];}_0x2db965['status'](_0x2f89a7)['send'](_0x38a5ff);};}exports[_0x4db8('0x31')]=function(_0x55456d,_0x1d44ab){var _0x5e50de={},_0x103bb4={},_0x43e645={'count':0x0,'rows':[]};var _0x3b2d49=_[_0x4db8('0x32')](db[_0x4db8('0x33')][_0x4db8('0x34')],function(_0x16d0dd){return{'name':_0x16d0dd['fieldName'],'type':_0x16d0dd[_0x4db8('0x35')]['key']};});_0x103bb4[_0x4db8('0x36')]=_[_0x4db8('0x32')](_0x3b2d49,_0x4db8('0x30'));_0x103bb4[_0x4db8('0x37')]=_[_0x4db8('0x38')](_0x55456d[_0x4db8('0x37')]);_0x103bb4['filters']=_[_0x4db8('0x39')](_0x103bb4['model'],_0x103bb4[_0x4db8('0x37')]);_0x5e50de['attributes']=_[_0x4db8('0x39')](_0x103bb4[_0x4db8('0x36')],qs[_0x4db8('0x3a')](_0x55456d[_0x4db8('0x37')][_0x4db8('0x3a')]));_0x5e50de['attributes']=_0x5e50de['attributes'][_0x4db8('0x3b')]?_0x5e50de['attributes']:_0x103bb4[_0x4db8('0x36')];if(!_0x55456d[_0x4db8('0x37')][_0x4db8('0x3c')](_0x4db8('0x3d'))){_0x5e50de['limit']=qs[_0x4db8('0x22')](_0x55456d[_0x4db8('0x37')][_0x4db8('0x22')]);_0x5e50de[_0x4db8('0x20')]=qs['offset'](_0x55456d[_0x4db8('0x37')][_0x4db8('0x20')]);}_0x5e50de[_0x4db8('0x3e')]=qs['sort'](_0x55456d[_0x4db8('0x37')][_0x4db8('0x3f')]);_0x5e50de['where']=qs[_0x4db8('0x40')](_['pick'](_0x55456d[_0x4db8('0x37')],_0x103bb4[_0x4db8('0x40')]),_0x3b2d49);if(_0x55456d['query']['filter']){_0x5e50de[_0x4db8('0x41')]=_['merge'](_0x5e50de[_0x4db8('0x41')],{'$or':_[_0x4db8('0x32')](_0x3b2d49,function(_0x2dd389){if(_0x2dd389[_0x4db8('0x35')]!==_0x4db8('0x42')){var _0x335b16={};_0x335b16[_0x2dd389[_0x4db8('0x30')]]={'$like':'%'+_0x55456d[_0x4db8('0x37')][_0x4db8('0x43')]+'%'};return _0x335b16;}})});}_0x5e50de=_[_0x4db8('0x44')]({},_0x5e50de,_0x55456d['options']);var _0x3c6618={'where':_0x5e50de[_0x4db8('0x41')]};return db[_0x4db8('0x33')][_0x4db8('0x23')](_0x3c6618)[_0x4db8('0x29')](function(_0x239e97){_0x43e645['count']=_0x239e97;if(_0x55456d[_0x4db8('0x37')]['includeAll']){_0x5e50de[_0x4db8('0x45')]=[{'all':!![]}];}return db[_0x4db8('0x33')]['findAll'](_0x5e50de);})['then'](function(_0xe774ed){_0x43e645['rows']=_0xe774ed;return _0x43e645;})['then'](respondWithFilteredResult(_0x1d44ab,_0x5e50de))['catch'](handleError(_0x1d44ab,null));};exports[_0x4db8('0x46')]=function(_0x211522,_0x391578){var _0x360397={'raw':![],'where':{'id':_0x211522[_0x4db8('0x47')]['id']}},_0x5b0b21={};_0x5b0b21['model']=_[_0x4db8('0x38')](db[_0x4db8('0x33')]['rawAttributes']);_0x5b0b21[_0x4db8('0x37')]=_[_0x4db8('0x38')](_0x211522[_0x4db8('0x37')]);_0x5b0b21['filters']=_[_0x4db8('0x39')](_0x5b0b21['model'],_0x5b0b21['query']);_0x360397['attributes']=_[_0x4db8('0x39')](_0x5b0b21[_0x4db8('0x36')],qs[_0x4db8('0x3a')](_0x211522[_0x4db8('0x37')]['fields']));_0x360397[_0x4db8('0x48')]=_0x360397[_0x4db8('0x48')][_0x4db8('0x3b')]?_0x360397[_0x4db8('0x48')]:_0x5b0b21[_0x4db8('0x36')];if(_0x211522[_0x4db8('0x37')]['includeAll']){_0x360397[_0x4db8('0x45')]=[{'all':!![]}];}_0x360397=_[_0x4db8('0x44')]({},_0x360397,_0x211522[_0x4db8('0x49')]);return db[_0x4db8('0x33')][_0x4db8('0x4a')](_0x360397)[_0x4db8('0x29')](handleEntityNotFound(_0x391578,null))[_0x4db8('0x29')](respondWithResult(_0x391578,null))['catch'](handleError(_0x391578,null));};exports[_0x4db8('0x4b')]=function(_0x30d1b0,_0x5cdbf2){return db[_0x4db8('0x33')][_0x4db8('0x4b')](_0x30d1b0[_0x4db8('0x4c')],{})[_0x4db8('0x29')](function(_0x2a71d2){var _0xa74398=_0x30d1b0[_0x4db8('0x4d')][_0x4db8('0x2b')]({'plain':!![]});if(!_0xa74398)throw new Error(_0x4db8('0x4e'));if(_0xa74398[_0x4db8('0x4f')]==='user'){var _0x96f131=_0x2a71d2['get']({'plain':!![]});var _0x46ad7e=_0x4db8('0x50');return db[_0x4db8('0x51')][_0x4db8('0x4a')]({'where':{'name':_0x46ad7e,'userProfileId':_0xa74398['userProfileId']},'raw':!![]})['then'](function(_0x2c5f92){if(_0x2c5f92&&_0x2c5f92[_0x4db8('0x52')]===0x0){return db[_0x4db8('0x2c')][_0x4db8('0x4b')]({'name':_0x96f131[_0x4db8('0x30')],'resourceId':_0x96f131['id'],'type':_0x2c5f92[_0x4db8('0x30')],'sectionId':_0x2c5f92['id']},{})[_0x4db8('0x29')](function(){return _0x2a71d2;});}else{return _0x2a71d2;}})[_0x4db8('0x53')](function(_0x1b2485){logger[_0x4db8('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b2485);throw _0x1b2485;});}return _0x2a71d2;})[_0x4db8('0x29')](respondWithResult(_0x5cdbf2,0xc9))[_0x4db8('0x53')](handleError(_0x5cdbf2,null));};exports['clone']=function(_0x65620b,_0x5eb086){var _0x4b77eb={'where':{'id':_0x65620b['params']['id']}},_0x1ad7bc={};_0x1ad7bc[_0x4db8('0x36')]=_[_0x4db8('0x38')](db[_0x4db8('0x33')][_0x4db8('0x34')]);_0x4b77eb['attributes']=_[_0x4db8('0x39')](_0x1ad7bc[_0x4db8('0x36')],qs[_0x4db8('0x3a')](_0x65620b['query'][_0x4db8('0x3a')]));_0x4b77eb[_0x4db8('0x48')]=_0x4b77eb[_0x4db8('0x48')][_0x4db8('0x3b')]?_0x4b77eb[_0x4db8('0x48')]:_0x1ad7bc['model'];if(_0x65620b[_0x4db8('0x37')][_0x4db8('0x54')]){_0x4b77eb[_0x4db8('0x45')]=[{'all':!![]}];}_0x4b77eb=_[_0x4db8('0x44')]({},_0x4b77eb,_0x65620b['options']);return db[_0x4db8('0x33')][_0x4db8('0x4a')](_0x4b77eb)['then'](handleEntityNotFound(_0x5eb086,null))[_0x4db8('0x29')](function(_0xace379){if(_0xace379){var _0x7cfe73=_0xace379[_0x4db8('0x2b')]({'plain':!![]});_0x7cfe73=qs[_0x4db8('0x55')](_0x7cfe73,['id',_0x4db8('0x56'),_0x4db8('0x57')]);_0x65620b['body']=_[_0x4db8('0x55')](_0x65620b['body'],['id',_0x4db8('0x56'),_0x4db8('0x57')]);return db[_0x4db8('0x33')][_0x4db8('0x4b')](_[_0x4db8('0x44')](_0x7cfe73,_0x65620b[_0x4db8('0x4c')]),{'include':_0x65620b[_0x4db8('0x37')][_0x4db8('0x54')]?[{'all':!![]}]:undefined})[_0x4db8('0x29')](function(_0x56c21f){var _0x4b6b2d=_0x65620b[_0x4db8('0x4d')][_0x4db8('0x2b')]({'plain':!![]});if(!_0x4b6b2d)throw new Error(_0x4db8('0x4e'));if(_0x4b6b2d[_0x4db8('0x4f')]===_0x4db8('0x4d')){var _0x4b7d09=_0x56c21f[_0x4db8('0x2b')]({'plain':!![]});var _0x5cac68=_0x4db8('0x50');return db[_0x4db8('0x51')][_0x4db8('0x4a')]({'where':{'name':_0x5cac68,'userProfileId':_0x4b6b2d[_0x4db8('0x58')]},'raw':!![]})[_0x4db8('0x29')](function(_0x2a89cf){if(_0x2a89cf&&_0x2a89cf[_0x4db8('0x52')]===0x0){return db[_0x4db8('0x2c')]['create']({'name':_0x4b7d09['name'],'resourceId':_0x4b7d09['id'],'type':_0x2a89cf[_0x4db8('0x30')],'sectionId':_0x2a89cf['id']},{})[_0x4db8('0x29')](function(){return _0x56c21f;});}else{return _0x56c21f;}})[_0x4db8('0x53')](function(_0x1b970a){logger['error'](_0x4db8('0x59'),_0x1b970a);throw _0x1b970a;});}return _0x56c21f;});}})[_0x4db8('0x29')](respondWithResult(_0x5eb086,0xc9))['catch'](handleError(_0x5eb086,null));};exports[_0x4db8('0x28')]=function(_0x2f77a4,_0x32c1d8){if(_0x2f77a4['body']['id']){delete _0x2f77a4['body']['id'];}return db[_0x4db8('0x33')][_0x4db8('0x4a')]({'where':{'id':_0x2f77a4[_0x4db8('0x47')]['id']}})[_0x4db8('0x29')](handleEntityNotFound(_0x32c1d8,null))['then'](saveUpdates(_0x2f77a4[_0x4db8('0x4c')],null))[_0x4db8('0x29')](respondWithResult(_0x32c1d8,null))[_0x4db8('0x53')](handleError(_0x32c1d8,null));};exports[_0x4db8('0x2a')]=function(_0x241781,_0x5bb6d9){return db[_0x4db8('0x33')][_0x4db8('0x4a')]({'where':{'id':_0x241781[_0x4db8('0x47')]['id']}})[_0x4db8('0x29')](handleEntityNotFound(_0x5bb6d9,null))[_0x4db8('0x29')](removeEntity(_0x5bb6d9,null))[_0x4db8('0x53')](handleError(_0x5bb6d9,null));};function widgetAttributes(_0x4deef2){try{switch(_0x4deef2['type']){case _0x4db8('0x5a'):return[{'name':_0x4db8('0x5b'),'value':_0x4deef2[_0x4db8('0x5b')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x0]?_0x4deef2[_0x4db8('0x5c')][0x0][_0x4db8('0x5d')]:undefined)||'https://'}];case _0x4db8('0x5e'):return[{'name':'attrPath','value':_0x4deef2['attrPath']||(_0x4deef2['attrs']&&_0x4deef2[_0x4db8('0x5c')][0x0]?_0x4deef2[_0x4db8('0x5c')][0x0][_0x4db8('0x5d')]:undefined)||''}];case'clock':return[{'name':_0x4db8('0x5f'),'value':_0x4deef2[_0x4db8('0x5f')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x0]?_0x4deef2[_0x4db8('0x5c')][0x0][_0x4db8('0x5d')]:undefined)||_0x4db8('0x60')},{'name':_0x4db8('0x61'),'value':_0x4deef2[_0x4db8('0x61')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2['attrs'][0x1]?_0x4deef2[_0x4db8('0x5c')][0x1][_0x4db8('0x5d')]:undefined)||_0x4db8('0x62')},{'name':_0x4db8('0x63'),'value':_0x4deef2[_0x4db8('0x63')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2['attrs'][0x2]?_0x4deef2['attrs'][0x2][_0x4db8('0x5d')]:undefined)||0xc}];case _0x4db8('0x64'):return[{'name':_0x4db8('0x65'),'value':_0x4deef2[_0x4db8('0x65')]||(_0x4deef2['attrs']&&_0x4deef2['attrs'][0x0]?_0x4deef2[_0x4db8('0x5c')][0x0][_0x4db8('0x5d')]:undefined)||_0x4db8('0x66')},{'name':'attrVoiceQueues','value':_0x4deef2['attrVoiceQueues']||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x1]?_0x4deef2['attrs'][0x1][_0x4db8('0x5d')]:undefined)||[]},{'name':_0x4db8('0x63'),'value':_0x4deef2[_0x4db8('0x63')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x2]?_0x4deef2['attrs'][0x2][_0x4db8('0x5d')]:undefined)||0x14},{'name':'attrChannel','value':_0x4deef2[_0x4db8('0x67')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x3]?_0x4deef2[_0x4db8('0x5c')][0x3][_0x4db8('0x5d')]:undefined)||'voice'},{'name':_0x4db8('0x68'),'value':_0x4deef2[_0x4db8('0x68')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2['attrs'][0x4]?_0x4deef2[_0x4db8('0x5c')][0x4][_0x4db8('0x5d')]:undefined)||''},{'name':_0x4db8('0x69'),'value':_0x4deef2[_0x4db8('0x69')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x5]?_0x4deef2['attrs'][0x5][_0x4db8('0x5d')]:undefined)||''},{'name':_0x4db8('0x6a'),'value':_0x4deef2[_0x4db8('0x6a')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x6]?_0x4deef2[_0x4db8('0x5c')][0x6][_0x4db8('0x5d')]:undefined)||''},{'name':_0x4db8('0x6b'),'value':_0x4deef2['attrOpenchannelAccounts']||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2['attrs'][0x7]?_0x4deef2['attrs'][0x7]['value']:undefined)||''},{'name':_0x4db8('0x6c'),'value':_0x4deef2[_0x4db8('0x6c')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2['attrs'][0x8]?_0x4deef2[_0x4db8('0x5c')][0x8]['value']:undefined)||''},{'name':_0x4db8('0x6d'),'value':_0x4deef2[_0x4db8('0x6d')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2['attrs'][0x9]?_0x4deef2['attrs'][0x9]['value']:undefined)||''}];case _0x4db8('0x6e'):case _0x4db8('0x6f'):return[{'name':_0x4db8('0x70'),'value':_0x4deef2[_0x4db8('0x70')]||(_0x4deef2['attrs']&&_0x4deef2[_0x4db8('0x5c')][0x0]?_0x4deef2['attrs'][0x0][_0x4db8('0x5d')]:undefined)||_0x4db8('0x66')},{'name':_0x4db8('0x71'),'value':_0x4deef2[_0x4db8('0x71')]||(_0x4deef2['attrs']&&_0x4deef2['attrs'][0x1]?_0x4deef2['attrs'][0x1][_0x4db8('0x5d')]:undefined)||null},{'name':_0x4db8('0x72'),'value':_0x4deef2[_0x4db8('0x72')]||(_0x4deef2['attrs']&&_0x4deef2[_0x4db8('0x5c')][0x2]?_0x4deef2['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x4deef2[_0x4db8('0x73')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x3]?_0x4deef2[_0x4db8('0x5c')][0x3][_0x4db8('0x5d')]:undefined)||[]},{'name':_0x4db8('0x67'),'value':_0x4deef2['attrChannel']||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x4]?_0x4deef2['attrs'][0x4][_0x4db8('0x5d')]:undefined)||'voice'},{'name':_0x4db8('0x68'),'value':_0x4deef2[_0x4db8('0x68')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x5]?_0x4deef2[_0x4db8('0x5c')][0x5][_0x4db8('0x5d')]:undefined)||''},{'name':_0x4db8('0x69'),'value':_0x4deef2[_0x4db8('0x69')]||(_0x4deef2['attrs']&&_0x4deef2['attrs'][0x6]?_0x4deef2[_0x4db8('0x5c')][0x6][_0x4db8('0x5d')]:undefined)||''},{'name':_0x4db8('0x6a'),'value':_0x4deef2[_0x4db8('0x6a')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x7]?_0x4deef2[_0x4db8('0x5c')][0x7]['value']:undefined)||''},{'name':_0x4db8('0x6b'),'value':_0x4deef2['attrOpenchannelAccounts']||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x8]?_0x4deef2[_0x4db8('0x5c')][0x8][_0x4db8('0x5d')]:undefined)||''},{'name':_0x4db8('0x6c'),'value':_0x4deef2[_0x4db8('0x6c')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x9]?_0x4deef2[_0x4db8('0x5c')][0x9][_0x4db8('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4deef2[_0x4db8('0x6d')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0xa]?_0x4deef2[_0x4db8('0x5c')][0xa][_0x4db8('0x5d')]:undefined)||''}];case _0x4db8('0x74'):return[{'name':_0x4db8('0x75'),'type':_0x4deef2[_0x4db8('0x76')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2['attrs'][0x0]?_0x4deef2[_0x4db8('0x5c')][0x0][_0x4db8('0x35')]:undefined)||null,'value':_0x4deef2[_0x4db8('0x75')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x0]?_0x4deef2[_0x4db8('0x5c')][0x0][_0x4db8('0x5d')]:undefined)||null},{'name':_0x4db8('0x77'),'value':_0x4deef2[_0x4db8('0x77')]||(_0x4deef2[_0x4db8('0x5c')]&&_0x4deef2[_0x4db8('0x5c')][0x1]?_0x4deef2[_0x4db8('0x5c')][0x1][_0x4db8('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x41c422){logger['error'](_0x4db8('0x78'),JSON[_0x4db8('0x79')](_0x41c422));return[];}}exports[_0x4db8('0x7a')]=function(_0x13d8c6,_0x597031,_0x38cbcc){if(_0x13d8c6[_0x4db8('0x4c')]['id']){delete _0x13d8c6[_0x4db8('0x4c')]['id'];}return db[_0x4db8('0x33')][_0x4db8('0x4a')]({'where':{'id':_0x13d8c6[_0x4db8('0x47')]['id']}})['then'](handleEntityNotFound(_0x597031,null))['then'](function(_0x49988f){if(_0x49988f){_0x13d8c6[_0x4db8('0x4c')][_0x4db8('0x7b')]=_0x49988f['id'];_0x13d8c6[_0x4db8('0x4c')]['attrs']=widgetAttributes(_0x13d8c6[_0x4db8('0x4c')]);return db[_0x4db8('0x7c')][_0x4db8('0x4b')](_0x13d8c6[_0x4db8('0x4c')]);}})['then'](respondWithResult(_0x597031,null))['catch'](handleError(_0x597031,null));};exports['getItems']=function(_0x51bc3a,_0x5a8f10,_0x1c84e1){var _0x154c84={};var _0x35b998={};var _0x346540;var _0x257407;return db[_0x4db8('0x33')][_0x4db8('0x7d')]({'where':{'id':_0x51bc3a['params']['id']}})[_0x4db8('0x29')](handleEntityNotFound(_0x5a8f10,null))['then'](function(_0xe8ba77){if(_0xe8ba77){_0x346540=_0xe8ba77;_0x35b998[_0x4db8('0x36')]=_['keys'](db['DashboardItem'][_0x4db8('0x34')]);_0x35b998[_0x4db8('0x37')]=_[_0x4db8('0x38')](_0x51bc3a[_0x4db8('0x37')]);_0x35b998[_0x4db8('0x40')]=_[_0x4db8('0x39')](_0x35b998[_0x4db8('0x36')],_0x35b998[_0x4db8('0x37')]);_0x154c84['attributes']=_[_0x4db8('0x39')](_0x35b998[_0x4db8('0x36')],qs[_0x4db8('0x3a')](_0x51bc3a[_0x4db8('0x37')][_0x4db8('0x3a')]));_0x154c84[_0x4db8('0x48')]=_0x154c84[_0x4db8('0x48')][_0x4db8('0x3b')]?_0x154c84['attributes']:_0x35b998[_0x4db8('0x36')];_0x154c84[_0x4db8('0x3e')]=qs[_0x4db8('0x3f')](_0x51bc3a[_0x4db8('0x37')][_0x4db8('0x3f')]);_0x154c84[_0x4db8('0x41')]=qs['filters'](_['pick'](_0x51bc3a[_0x4db8('0x37')],_0x35b998[_0x4db8('0x40')]));if(_0x51bc3a['query']['filter']){_0x154c84['where']=_[_0x4db8('0x44')](_0x154c84['where'],{'$or':_[_0x4db8('0x32')](_0x154c84[_0x4db8('0x48')],function(_0x533773){var _0xfcb1d4={};_0xfcb1d4[_0x533773]={'$like':'%'+_0x51bc3a['query']['filter']+'%'};return _0xfcb1d4;})});}_0x154c84=_[_0x4db8('0x44')]({},_0x154c84,_0x51bc3a['options']);return _0x346540[_0x4db8('0x7e')](_0x154c84);}})[_0x4db8('0x29')](function(_0x15eb4d){if(_0x15eb4d){_0x257407=_0x15eb4d[_0x4db8('0x3b')];if(!_0x51bc3a[_0x4db8('0x37')][_0x4db8('0x3c')]('nolimit')){_0x154c84[_0x4db8('0x22')]=qs['limit'](_0x51bc3a['query'][_0x4db8('0x22')]);_0x154c84[_0x4db8('0x20')]=qs['offset'](_0x51bc3a['query'][_0x4db8('0x20')]);}return _0x346540[_0x4db8('0x7e')](_0x154c84);}})['then'](function(_0x7b996e){if(_0x7b996e){return _0x7b996e?{'count':_0x257407,'rows':_0x7b996e}:null;}})[_0x4db8('0x29')](respondWithResult(_0x5a8f10,null))[_0x4db8('0x53')](handleError(_0x5a8f10,null));}; \ No newline at end of file +var _0x1bde=['update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','includeAll','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrFaxAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','defaults','redis','localhost','./dashboard.socket','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1bde,0x1e7));var _0xe1bd=function(_0x17244e,_0x2d1f5e){_0x17244e=_0x17244e-0x0;var _0x2953b1=_0x1bde[_0x17244e];return _0x2953b1;};'use strict';var emlformat=require(_0xe1bd('0x0'));var rimraf=require(_0xe1bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1bd('0x2'));var rp=require(_0xe1bd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe1bd('0x4'));var path=require(_0xe1bd('0x5'));var sox=require(_0xe1bd('0x6'));var csv=require(_0xe1bd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe1bd('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe1bd('0x9'));var jsforce=require(_0xe1bd('0xa'));var deskjs=require(_0xe1bd('0xb'));var toCsv=require(_0xe1bd('0x7'));var querystring=require('querystring');var Papa=require(_0xe1bd('0xc'));var Redis=require(_0xe1bd('0xd'));var authService=require(_0xe1bd('0xe'));var qs=require(_0xe1bd('0xf'));var as=require(_0xe1bd('0x10'));var hardwareService=require(_0xe1bd('0x11'));var logger=require('../../config/logger')(_0xe1bd('0x12'));var utils=require(_0xe1bd('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe1bd('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe1bd('0x15')](config[_0xe1bd('0x16')],{'host':_0xe1bd('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1bd('0x16')]));require(_0xe1bd('0x18'))['register'](socket);function respondWithStatusCode(_0x452b14,_0x755dbb){_0x755dbb=_0x755dbb||0xcc;return function(_0x19c08f){if(_0x19c08f){return _0x452b14[_0xe1bd('0x19')](_0x755dbb);}return _0x452b14[_0xe1bd('0x1a')](_0x755dbb)[_0xe1bd('0x1b')]();};}function respondWithResult(_0x54ebbf,_0x36074c){_0x36074c=_0x36074c||0xc8;return function(_0x498fed){if(_0x498fed){return _0x54ebbf[_0xe1bd('0x1a')](_0x36074c)[_0xe1bd('0x1c')](_0x498fed);}};}function respondWithFilteredResult(_0x1140db,_0x11f561){return function(_0x41b83a){if(_0x41b83a){var _0x711d79=typeof _0x11f561['offset']===_0xe1bd('0x1d')&&typeof _0x11f561['limit']===_0xe1bd('0x1d');var _0xb1fa28=_0x41b83a[_0xe1bd('0x1e')];var _0x2a5f86=_0x711d79?0x0:_0x11f561[_0xe1bd('0x1f')];var _0x5c1214=_0x711d79?_0x41b83a[_0xe1bd('0x1e')]:_0x11f561['offset']+_0x11f561['limit'];var _0x129746;if(_0x5c1214>=_0xb1fa28){_0x5c1214=_0xb1fa28;_0x129746=0xc8;}else{_0x129746=0xce;}_0x1140db[_0xe1bd('0x1a')](_0x129746);return _0x1140db[_0xe1bd('0x20')](_0xe1bd('0x21'),_0x2a5f86+'-'+_0x5c1214+'/'+_0xb1fa28)[_0xe1bd('0x1c')](_0x41b83a);}return null;};}function patchUpdates(_0x13d19d){return function(_0x1f5668){try{jsonpatch[_0xe1bd('0x22')](_0x1f5668,_0x13d19d,!![]);}catch(_0x56a46f){return BPromise[_0xe1bd('0x23')](_0x56a46f);}return _0x1f5668[_0xe1bd('0x24')]();};}function saveUpdates(_0x1114b3,_0x57bab6){return function(_0x430724){if(_0x430724){return _0x430724[_0xe1bd('0x25')](_0x1114b3)[_0xe1bd('0x26')](function(_0x149724){return _0x149724;});}return null;};}function removeEntity(_0x412ada,_0x1fa9dc){return function(_0x1ab9f2){if(_0x1ab9f2){return _0x1ab9f2[_0xe1bd('0x27')]()[_0xe1bd('0x26')](function(){var _0x36635d=_0x1ab9f2[_0xe1bd('0x28')]({'plain':!![]});var _0x514df9=_0xe1bd('0x29');return db[_0xe1bd('0x2a')][_0xe1bd('0x27')]({'where':{'type':_0x514df9,'resourceId':_0x36635d['id']}})['then'](function(){return _0x1ab9f2;});})[_0xe1bd('0x26')](function(){_0x412ada[_0xe1bd('0x1a')](0xcc)[_0xe1bd('0x1b')]();});}};}function handleEntityNotFound(_0x5e5661,_0x302813){return function(_0x4f2613){if(!_0x4f2613){_0x5e5661[_0xe1bd('0x19')](0x194);}return _0x4f2613;};}function handleError(_0x340ed7,_0x1acd34){_0x1acd34=_0x1acd34||0x1f4;return function(_0x232c97){logger[_0xe1bd('0x2b')](_0x232c97[_0xe1bd('0x2c')]);if(_0x232c97[_0xe1bd('0x2d')]){delete _0x232c97[_0xe1bd('0x2d')];}_0x340ed7[_0xe1bd('0x1a')](_0x1acd34)['send'](_0x232c97);};}exports[_0xe1bd('0x2e')]=function(_0x552042,_0x1040e9){var _0x1db895={},_0x2c69af={},_0x49078e={'count':0x0,'rows':[]};var _0x354482=_[_0xe1bd('0x2f')](db[_0xe1bd('0x30')][_0xe1bd('0x31')],function(_0x39b4ea){return{'name':_0x39b4ea[_0xe1bd('0x32')],'type':_0x39b4ea[_0xe1bd('0x33')][_0xe1bd('0x34')]};});_0x2c69af[_0xe1bd('0x35')]=_['map'](_0x354482,_0xe1bd('0x2d'));_0x2c69af[_0xe1bd('0x36')]=_[_0xe1bd('0x37')](_0x552042[_0xe1bd('0x36')]);_0x2c69af[_0xe1bd('0x38')]=_[_0xe1bd('0x39')](_0x2c69af[_0xe1bd('0x35')],_0x2c69af[_0xe1bd('0x36')]);_0x1db895['attributes']=_['intersection'](_0x2c69af[_0xe1bd('0x35')],qs[_0xe1bd('0x3a')](_0x552042[_0xe1bd('0x36')][_0xe1bd('0x3a')]));_0x1db895['attributes']=_0x1db895[_0xe1bd('0x3b')][_0xe1bd('0x3c')]?_0x1db895[_0xe1bd('0x3b')]:_0x2c69af[_0xe1bd('0x35')];if(!_0x552042[_0xe1bd('0x36')][_0xe1bd('0x3d')]('nolimit')){_0x1db895[_0xe1bd('0x3e')]=qs[_0xe1bd('0x3e')](_0x552042[_0xe1bd('0x36')][_0xe1bd('0x3e')]);_0x1db895[_0xe1bd('0x1f')]=qs[_0xe1bd('0x1f')](_0x552042[_0xe1bd('0x36')][_0xe1bd('0x1f')]);}_0x1db895[_0xe1bd('0x3f')]=qs[_0xe1bd('0x40')](_0x552042['query']['sort']);_0x1db895[_0xe1bd('0x41')]=qs[_0xe1bd('0x38')](_[_0xe1bd('0x42')](_0x552042['query'],_0x2c69af[_0xe1bd('0x38')]),_0x354482);if(_0x552042[_0xe1bd('0x36')][_0xe1bd('0x43')]){_0x1db895[_0xe1bd('0x41')]=_[_0xe1bd('0x44')](_0x1db895[_0xe1bd('0x41')],{'$or':_['map'](_0x354482,function(_0x17b20c){if(_0x17b20c[_0xe1bd('0x33')]!==_0xe1bd('0x45')){var _0x402772={};_0x402772[_0x17b20c[_0xe1bd('0x2d')]]={'$like':'%'+_0x552042['query']['filter']+'%'};return _0x402772;}})});}_0x1db895=_['merge']({},_0x1db895,_0x552042[_0xe1bd('0x46')]);var _0x470c01={'where':_0x1db895[_0xe1bd('0x41')]};return db[_0xe1bd('0x30')]['count'](_0x470c01)[_0xe1bd('0x26')](function(_0x5c4822){_0x49078e[_0xe1bd('0x1e')]=_0x5c4822;if(_0x552042[_0xe1bd('0x36')]['includeAll']){_0x1db895[_0xe1bd('0x47')]=[{'all':!![]}];}return db[_0xe1bd('0x30')][_0xe1bd('0x48')](_0x1db895);})[_0xe1bd('0x26')](function(_0x4fa1f0){_0x49078e['rows']=_0x4fa1f0;return _0x49078e;})[_0xe1bd('0x26')](respondWithFilteredResult(_0x1040e9,_0x1db895))['catch'](handleError(_0x1040e9,null));};exports[_0xe1bd('0x49')]=function(_0x15f7ac,_0x34cbb1){var _0x346ba6={'raw':![],'where':{'id':_0x15f7ac[_0xe1bd('0x4a')]['id']}},_0x16f6ec={};_0x16f6ec[_0xe1bd('0x35')]=_['keys'](db[_0xe1bd('0x30')][_0xe1bd('0x31')]);_0x16f6ec[_0xe1bd('0x36')]=_[_0xe1bd('0x37')](_0x15f7ac['query']);_0x16f6ec[_0xe1bd('0x38')]=_['intersection'](_0x16f6ec['model'],_0x16f6ec[_0xe1bd('0x36')]);_0x346ba6[_0xe1bd('0x3b')]=_[_0xe1bd('0x39')](_0x16f6ec[_0xe1bd('0x35')],qs['fields'](_0x15f7ac[_0xe1bd('0x36')]['fields']));_0x346ba6[_0xe1bd('0x3b')]=_0x346ba6['attributes'][_0xe1bd('0x3c')]?_0x346ba6[_0xe1bd('0x3b')]:_0x16f6ec[_0xe1bd('0x35')];if(_0x15f7ac['query']['includeAll']){_0x346ba6['include']=[{'all':!![]}];}_0x346ba6=_[_0xe1bd('0x44')]({},_0x346ba6,_0x15f7ac[_0xe1bd('0x46')]);return db['Dashboard'][_0xe1bd('0x4b')](_0x346ba6)[_0xe1bd('0x26')](handleEntityNotFound(_0x34cbb1,null))[_0xe1bd('0x26')](respondWithResult(_0x34cbb1,null))[_0xe1bd('0x4c')](handleError(_0x34cbb1,null));};exports[_0xe1bd('0x4d')]=function(_0x45b046,_0x23df53){return db[_0xe1bd('0x30')]['create'](_0x45b046[_0xe1bd('0x4e')],{})[_0xe1bd('0x26')](function(_0x1dc4d8){var _0x5e297a=_0x45b046[_0xe1bd('0x4f')][_0xe1bd('0x28')]({'plain':!![]});if(!_0x5e297a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e297a[_0xe1bd('0x50')]===_0xe1bd('0x4f')){var _0x321f02=_0x1dc4d8[_0xe1bd('0x28')]({'plain':!![]});var _0x44ea51=_0xe1bd('0x29');return db[_0xe1bd('0x51')][_0xe1bd('0x4b')]({'where':{'name':_0x44ea51,'userProfileId':_0x5e297a[_0xe1bd('0x52')]},'raw':!![]})['then'](function(_0x52a697){if(_0x52a697&&_0x52a697[_0xe1bd('0x53')]===0x0){return db[_0xe1bd('0x2a')][_0xe1bd('0x4d')]({'name':_0x321f02[_0xe1bd('0x2d')],'resourceId':_0x321f02['id'],'type':_0x52a697['name'],'sectionId':_0x52a697['id']},{})[_0xe1bd('0x26')](function(){return _0x1dc4d8;});}else{return _0x1dc4d8;}})[_0xe1bd('0x4c')](function(_0x48718f){logger[_0xe1bd('0x2b')](_0xe1bd('0x54'),_0x48718f);throw _0x48718f;});}return _0x1dc4d8;})[_0xe1bd('0x26')](respondWithResult(_0x23df53,0xc9))[_0xe1bd('0x4c')](handleError(_0x23df53,null));};exports[_0xe1bd('0x55')]=function(_0x4d8eef,_0x217176){var _0x1bd793={'where':{'id':_0x4d8eef['params']['id']}},_0x3607d5={};_0x3607d5[_0xe1bd('0x35')]=_[_0xe1bd('0x37')](db[_0xe1bd('0x30')][_0xe1bd('0x31')]);_0x1bd793['attributes']=_['intersection'](_0x3607d5[_0xe1bd('0x35')],qs[_0xe1bd('0x3a')](_0x4d8eef[_0xe1bd('0x36')][_0xe1bd('0x3a')]));_0x1bd793[_0xe1bd('0x3b')]=_0x1bd793['attributes'][_0xe1bd('0x3c')]?_0x1bd793['attributes']:_0x3607d5[_0xe1bd('0x35')];if(_0x4d8eef['query']['includeAll']){_0x1bd793['include']=[{'all':!![]}];}_0x1bd793=_['merge']({},_0x1bd793,_0x4d8eef[_0xe1bd('0x46')]);return db[_0xe1bd('0x30')]['find'](_0x1bd793)[_0xe1bd('0x26')](handleEntityNotFound(_0x217176,null))['then'](function(_0xe94e84){if(_0xe94e84){var _0x32dd24=_0xe94e84[_0xe1bd('0x28')]({'plain':!![]});_0x32dd24=qs[_0xe1bd('0x56')](_0x32dd24,['id','createdAt','updatedAt']);_0x4d8eef['body']=_[_0xe1bd('0x56')](_0x4d8eef['body'],['id','createdAt',_0xe1bd('0x57')]);return db['Dashboard'][_0xe1bd('0x4d')](_[_0xe1bd('0x44')](_0x32dd24,_0x4d8eef[_0xe1bd('0x4e')]),{'include':_0x4d8eef[_0xe1bd('0x36')][_0xe1bd('0x58')]?[{'all':!![]}]:undefined})[_0xe1bd('0x26')](function(_0x8fafdb){var _0x4c2782=_0x4d8eef[_0xe1bd('0x4f')][_0xe1bd('0x28')]({'plain':!![]});if(!_0x4c2782)throw new Error(_0xe1bd('0x59'));if(_0x4c2782['role']===_0xe1bd('0x4f')){var _0x40153f=_0x8fafdb[_0xe1bd('0x28')]({'plain':!![]});var _0x4760a5='CustomDashboards';return db[_0xe1bd('0x51')][_0xe1bd('0x4b')]({'where':{'name':_0x4760a5,'userProfileId':_0x4c2782['userProfileId']},'raw':!![]})[_0xe1bd('0x26')](function(_0x7b510a){if(_0x7b510a&&_0x7b510a['autoAssociation']===0x0){return db['UserProfileResource'][_0xe1bd('0x4d')]({'name':_0x40153f[_0xe1bd('0x2d')],'resourceId':_0x40153f['id'],'type':_0x7b510a[_0xe1bd('0x2d')],'sectionId':_0x7b510a['id']},{})[_0xe1bd('0x26')](function(){return _0x8fafdb;});}else{return _0x8fafdb;}})[_0xe1bd('0x4c')](function(_0x474c60){logger[_0xe1bd('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x474c60);throw _0x474c60;});}return _0x8fafdb;});}})[_0xe1bd('0x26')](respondWithResult(_0x217176,0xc9))['catch'](handleError(_0x217176,null));};exports[_0xe1bd('0x25')]=function(_0x6e70a8,_0x3a239f){if(_0x6e70a8[_0xe1bd('0x4e')]['id']){delete _0x6e70a8['body']['id'];}return db[_0xe1bd('0x30')][_0xe1bd('0x4b')]({'where':{'id':_0x6e70a8['params']['id']}})['then'](handleEntityNotFound(_0x3a239f,null))[_0xe1bd('0x26')](saveUpdates(_0x6e70a8[_0xe1bd('0x4e')],null))[_0xe1bd('0x26')](respondWithResult(_0x3a239f,null))[_0xe1bd('0x4c')](handleError(_0x3a239f,null));};exports[_0xe1bd('0x27')]=function(_0x4d1e00,_0x1d562f){return db[_0xe1bd('0x30')][_0xe1bd('0x4b')]({'where':{'id':_0x4d1e00[_0xe1bd('0x4a')]['id']}})[_0xe1bd('0x26')](handleEntityNotFound(_0x1d562f,null))['then'](removeEntity(_0x1d562f,null))[_0xe1bd('0x4c')](handleError(_0x1d562f,null));};function widgetAttributes(_0x1bf4cc){try{switch(_0x1bf4cc[_0xe1bd('0x33')]){case _0xe1bd('0x5a'):return[{'name':_0xe1bd('0x5b'),'value':_0x1bf4cc['attrUrl']||(_0x1bf4cc['attrs']&&_0x1bf4cc[_0xe1bd('0x5c')][0x0]?_0x1bf4cc[_0xe1bd('0x5c')][0x0][_0xe1bd('0x5d')]:undefined)||_0xe1bd('0x5e')}];case _0xe1bd('0x5f'):return[{'name':_0xe1bd('0x60'),'value':_0x1bf4cc[_0xe1bd('0x60')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x0]?_0x1bf4cc[_0xe1bd('0x5c')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xe1bd('0x61'),'value':_0x1bf4cc[_0xe1bd('0x61')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc['attrs'][0x0]?_0x1bf4cc[_0xe1bd('0x5c')][0x0][_0xe1bd('0x5d')]:undefined)||_0xe1bd('0x62')},{'name':_0xe1bd('0x63'),'value':_0x1bf4cc[_0xe1bd('0x63')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x1]?_0x1bf4cc['attrs'][0x1][_0xe1bd('0x5d')]:undefined)||_0xe1bd('0x64')},{'name':_0xe1bd('0x65'),'value':_0x1bf4cc[_0xe1bd('0x65')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x2]?_0x1bf4cc[_0xe1bd('0x5c')][0x2][_0xe1bd('0x5d')]:undefined)||0xc}];case _0xe1bd('0x66'):return[{'name':_0xe1bd('0x67'),'value':_0x1bf4cc[_0xe1bd('0x67')]||(_0x1bf4cc['attrs']&&_0x1bf4cc[_0xe1bd('0x5c')][0x0]?_0x1bf4cc['attrs'][0x0]['value']:undefined)||'total'},{'name':_0xe1bd('0x68'),'value':_0x1bf4cc['attrVoiceQueues']||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x1]?_0x1bf4cc[_0xe1bd('0x5c')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x1bf4cc['attrFontSize']||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x2]?_0x1bf4cc[_0xe1bd('0x5c')][0x2]['value']:undefined)||0x14},{'name':_0xe1bd('0x69'),'value':_0x1bf4cc[_0xe1bd('0x69')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x3]?_0x1bf4cc['attrs'][0x3][_0xe1bd('0x5d')]:undefined)||_0xe1bd('0x6a')},{'name':_0xe1bd('0x6b'),'value':_0x1bf4cc[_0xe1bd('0x6b')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x4]?_0x1bf4cc[_0xe1bd('0x5c')][0x4][_0xe1bd('0x5d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1bf4cc['attrFaxAccounts']||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x5]?_0x1bf4cc[_0xe1bd('0x5c')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x1bf4cc[_0xe1bd('0x6c')]||(_0x1bf4cc['attrs']&&_0x1bf4cc['attrs'][0x6]?_0x1bf4cc['attrs'][0x6][_0xe1bd('0x5d')]:undefined)||''},{'name':_0xe1bd('0x6d'),'value':_0x1bf4cc[_0xe1bd('0x6d')]||(_0x1bf4cc['attrs']&&_0x1bf4cc[_0xe1bd('0x5c')][0x7]?_0x1bf4cc['attrs'][0x7][_0xe1bd('0x5d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1bf4cc[_0xe1bd('0x6e')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x8]?_0x1bf4cc['attrs'][0x8]['value']:undefined)||''},{'name':_0xe1bd('0x6f'),'value':_0x1bf4cc['attrChatWebsites']||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x9]?_0x1bf4cc[_0xe1bd('0x5c')][0x9][_0xe1bd('0x5d')]:undefined)||''}];case _0xe1bd('0x70'):case _0xe1bd('0x71'):return[{'name':_0xe1bd('0x72'),'value':_0x1bf4cc['attrSerie1']||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x0]?_0x1bf4cc['attrs'][0x0][_0xe1bd('0x5d')]:undefined)||_0xe1bd('0x73')},{'name':'attrSerie2','value':_0x1bf4cc[_0xe1bd('0x74')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x1]?_0x1bf4cc[_0xe1bd('0x5c')][0x1][_0xe1bd('0x5d')]:undefined)||null},{'name':_0xe1bd('0x75'),'value':_0x1bf4cc[_0xe1bd('0x75')]||(_0x1bf4cc['attrs']&&_0x1bf4cc[_0xe1bd('0x5c')][0x2]?_0x1bf4cc[_0xe1bd('0x5c')][0x2][_0xe1bd('0x5d')]:undefined)||null},{'name':_0xe1bd('0x68'),'value':_0x1bf4cc['attrVoiceQueues']||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x3]?_0x1bf4cc[_0xe1bd('0x5c')][0x3]['value']:undefined)||[]},{'name':_0xe1bd('0x69'),'value':_0x1bf4cc[_0xe1bd('0x69')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x4]?_0x1bf4cc[_0xe1bd('0x5c')][0x4]['value']:undefined)||_0xe1bd('0x6a')},{'name':'attrEmailAccounts','value':_0x1bf4cc['attrEmailAccounts']||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x5]?_0x1bf4cc[_0xe1bd('0x5c')][0x5][_0xe1bd('0x5d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1bf4cc[_0xe1bd('0x76')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc['attrs'][0x6]?_0x1bf4cc['attrs'][0x6]['value']:undefined)||''},{'name':_0xe1bd('0x6c'),'value':_0x1bf4cc['attrSmsAccounts']||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x7]?_0x1bf4cc[_0xe1bd('0x5c')][0x7][_0xe1bd('0x5d')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1bf4cc[_0xe1bd('0x6d')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc['attrs'][0x8]?_0x1bf4cc[_0xe1bd('0x5c')][0x8][_0xe1bd('0x5d')]:undefined)||''},{'name':_0xe1bd('0x6e'),'value':_0x1bf4cc[_0xe1bd('0x6e')]||(_0x1bf4cc['attrs']&&_0x1bf4cc['attrs'][0x9]?_0x1bf4cc[_0xe1bd('0x5c')][0x9][_0xe1bd('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1bf4cc[_0xe1bd('0x6f')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0xa]?_0x1bf4cc[_0xe1bd('0x5c')][0xa][_0xe1bd('0x5d')]:undefined)||''}];case _0xe1bd('0x77'):return[{'name':_0xe1bd('0x78'),'type':_0x1bf4cc[_0xe1bd('0x79')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x0]?_0x1bf4cc['attrs'][0x0][_0xe1bd('0x33')]:undefined)||null,'value':_0x1bf4cc[_0xe1bd('0x78')]||(_0x1bf4cc['attrs']&&_0x1bf4cc[_0xe1bd('0x5c')][0x0]?_0x1bf4cc[_0xe1bd('0x5c')][0x0][_0xe1bd('0x5d')]:undefined)||null},{'name':'attrRefresh','value':_0x1bf4cc[_0xe1bd('0x7a')]||(_0x1bf4cc[_0xe1bd('0x5c')]&&_0x1bf4cc[_0xe1bd('0x5c')][0x1]?_0x1bf4cc[_0xe1bd('0x5c')][0x1][_0xe1bd('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x4e31b2){logger[_0xe1bd('0x2b')](_0xe1bd('0x7b'),JSON[_0xe1bd('0x7c')](_0x4e31b2));return[];}}exports[_0xe1bd('0x7d')]=function(_0x3dc701,_0x32a0ab,_0x5857cb){if(_0x3dc701[_0xe1bd('0x4e')]['id']){delete _0x3dc701[_0xe1bd('0x4e')]['id'];}return db['Dashboard'][_0xe1bd('0x4b')]({'where':{'id':_0x3dc701[_0xe1bd('0x4a')]['id']}})[_0xe1bd('0x26')](handleEntityNotFound(_0x32a0ab,null))['then'](function(_0xdcd1b1){if(_0xdcd1b1){_0x3dc701['body'][_0xe1bd('0x7e')]=_0xdcd1b1['id'];_0x3dc701[_0xe1bd('0x4e')][_0xe1bd('0x5c')]=widgetAttributes(_0x3dc701['body']);return db[_0xe1bd('0x7f')][_0xe1bd('0x4d')](_0x3dc701[_0xe1bd('0x4e')]);}})[_0xe1bd('0x26')](respondWithResult(_0x32a0ab,null))[_0xe1bd('0x4c')](handleError(_0x32a0ab,null));};exports[_0xe1bd('0x80')]=function(_0x1b321f,_0x54cc38,_0x186746){var _0x2b0453={};var _0x31582d={};var _0x2d0733;var _0x4c1fad;return db[_0xe1bd('0x30')][_0xe1bd('0x81')]({'where':{'id':_0x1b321f[_0xe1bd('0x4a')]['id']}})[_0xe1bd('0x26')](handleEntityNotFound(_0x54cc38,null))[_0xe1bd('0x26')](function(_0x111c98){if(_0x111c98){_0x2d0733=_0x111c98;_0x31582d['model']=_[_0xe1bd('0x37')](db[_0xe1bd('0x7f')]['rawAttributes']);_0x31582d[_0xe1bd('0x36')]=_['keys'](_0x1b321f[_0xe1bd('0x36')]);_0x31582d['filters']=_[_0xe1bd('0x39')](_0x31582d['model'],_0x31582d[_0xe1bd('0x36')]);_0x2b0453['attributes']=_[_0xe1bd('0x39')](_0x31582d[_0xe1bd('0x35')],qs[_0xe1bd('0x3a')](_0x1b321f[_0xe1bd('0x36')][_0xe1bd('0x3a')]));_0x2b0453[_0xe1bd('0x3b')]=_0x2b0453[_0xe1bd('0x3b')]['length']?_0x2b0453[_0xe1bd('0x3b')]:_0x31582d[_0xe1bd('0x35')];_0x2b0453['order']=qs['sort'](_0x1b321f[_0xe1bd('0x36')]['sort']);_0x2b0453[_0xe1bd('0x41')]=qs[_0xe1bd('0x38')](_['pick'](_0x1b321f[_0xe1bd('0x36')],_0x31582d['filters']));if(_0x1b321f[_0xe1bd('0x36')][_0xe1bd('0x43')]){_0x2b0453[_0xe1bd('0x41')]=_[_0xe1bd('0x44')](_0x2b0453[_0xe1bd('0x41')],{'$or':_[_0xe1bd('0x2f')](_0x2b0453['attributes'],function(_0x4a180f){var _0x5e92cd={};_0x5e92cd[_0x4a180f]={'$like':'%'+_0x1b321f[_0xe1bd('0x36')][_0xe1bd('0x43')]+'%'};return _0x5e92cd;})});}_0x2b0453=_[_0xe1bd('0x44')]({},_0x2b0453,_0x1b321f[_0xe1bd('0x46')]);return _0x2d0733[_0xe1bd('0x80')](_0x2b0453);}})['then'](function(_0xc0e219){if(_0xc0e219){_0x4c1fad=_0xc0e219[_0xe1bd('0x3c')];if(!_0x1b321f['query'][_0xe1bd('0x3d')](_0xe1bd('0x82'))){_0x2b0453[_0xe1bd('0x3e')]=qs[_0xe1bd('0x3e')](_0x1b321f['query'][_0xe1bd('0x3e')]);_0x2b0453[_0xe1bd('0x1f')]=qs[_0xe1bd('0x1f')](_0x1b321f['query'][_0xe1bd('0x1f')]);}return _0x2d0733[_0xe1bd('0x80')](_0x2b0453);}})[_0xe1bd('0x26')](function(_0x1f01d3){if(_0x1f01d3){return _0x1f01d3?{'count':_0x4c1fad,'rows':_0x1f01d3}:null;}})['then'](respondWithResult(_0x54cc38,null))[_0xe1bd('0x4c')](handleError(_0x54cc38,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index cc969f5..38d0c0a 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 _0xdf79=['emit','hasOwnProperty','exports','Dashboard','save','remove'];(function(_0x2c4d31,_0x21f3a8){var _0x3a9785=function(_0x1fb5b8){while(--_0x1fb5b8){_0x2c4d31['push'](_0x2c4d31['shift']());}};_0x3a9785(++_0x21f3a8);}(_0xdf79,0x99));var _0x9df7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdf79[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x9df7('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9df7('0x1'),'afterUpdate':'update','afterDestroy':_0x9df7('0x2')};function emitEvent(_0x399c2d){return function(_0x2cc502,_0x5af1eb,_0x3e1de5){DashboardEvents[_0x9df7('0x3')](_0x399c2d+':'+_0x2cc502['id'],_0x2cc502);DashboardEvents['emit'](_0x399c2d,_0x2cc502);_0x3e1de5(null);};}for(var e in events){if(events[_0x9df7('0x4')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x9df7('0x5')]=DashboardEvents; \ No newline at end of file +var _0xb522=['events','../../mysqldb','Dashboard','setMaxListeners','remove','emit','hook'];(function(_0x427aab,_0x4d372a){var _0x6434b=function(_0x672675){while(--_0x672675){_0x427aab['push'](_0x427aab['shift']());}};_0x6434b(++_0x4d372a);}(_0xb522,0x15e));var _0x2b52=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb522[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x2b52('0x0'));var Dashboard=require(_0x2b52('0x1'))['db'][_0x2b52('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x2b52('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2b52('0x4')};function emitEvent(_0x458a08){return function(_0xfb3d44,_0x5224dd,_0x1477cb){DashboardEvents[_0x2b52('0x5')](_0x458a08+':'+_0xfb3d44['id'],_0xfb3d44);DashboardEvents[_0x2b52('0x5')](_0x458a08,_0xfb3d44);_0x1477cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x2b52('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 005d4a8..7bd3dc4 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 _0x8af9=['rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','path'];(function(_0x4d7c86,_0x9b62a6){var _0x59443d=function(_0x5af971){while(--_0x5af971){_0x4d7c86['push'](_0x4d7c86['shift']());}};_0x59443d(++_0x9b62a6);}(_0x8af9,0x132));var _0x98af=function(_0x41e57d,_0x1bd4a5){_0x41e57d=_0x41e57d-0x0;var _0x426ec6=_0x8af9[_0x41e57d];return _0x426ec6;};'use strict';var _=require(_0x98af('0x0'));var util=require(_0x98af('0x1'));var logger=require(_0x98af('0x2'))(_0x98af('0x3'));var moment=require(_0x98af('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x98af('0x5'));var rimraf=require(_0x98af('0x6'));var config=require(_0x98af('0x7'));var attributes=require(_0x98af('0x8'));module[_0x98af('0x9')]=function(_0x44ee3f,_0x1407ce){return _0x44ee3f[_0x98af('0xa')](_0x98af('0xb'),attributes,{'tableName':_0x98af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32b1=['api','bluebird','request-promise','path','../../config/environment','exports','Dashboard','dashboards','lodash','util'];(function(_0x5af0d4,_0xf43577){var _0x133965=function(_0x5dc26c){while(--_0x5dc26c){_0x5af0d4['push'](_0x5af0d4['shift']());}};_0x133965(++_0xf43577);}(_0x32b1,0xbc));var _0x132b=function(_0x5bbc59,_0x77aa05){_0x5bbc59=_0x5bbc59-0x0;var _0x27a027=_0x32b1[_0x5bbc59];return _0x27a027;};'use strict';var _=require(_0x132b('0x0'));var util=require(_0x132b('0x1'));var logger=require('../../config/logger')(_0x132b('0x2'));var moment=require('moment');var BPromise=require(_0x132b('0x3'));var rp=require(_0x132b('0x4'));var fs=require('fs');var path=require(_0x132b('0x5'));var rimraf=require('rimraf');var config=require(_0x132b('0x6'));var attributes=require('./dashboard.attributes');module[_0x132b('0x7')]=function(_0x2bd4a2,_0x588aa4){return _0x2bd4a2['define'](_0x132b('0x8'),attributes,{'tableName':_0x132b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 511d8e7..8a52ddd 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 _0xd774=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x46ddb9,_0x39f91c){var _0x2b780e=function(_0x246cac){while(--_0x246cac){_0x46ddb9['push'](_0x46ddb9['shift']());}};_0x2b780e(++_0x39f91c);}(_0xd774,0xb1));var _0x4d77=function(_0x581d05,_0x3db0e7){_0x581d05=_0x581d05-0x0;var _0x3db033=_0xd774[_0x581d05];return _0x3db033;};'use strict';var _=require('lodash');var util=require(_0x4d77('0x0'));var moment=require(_0x4d77('0x1'));var BPromise=require(_0x4d77('0x2'));var rs=require(_0x4d77('0x3'));var fs=require('fs');var Redis=require(_0x4d77('0x4'));var db=require(_0x4d77('0x5'))['db'];var utils=require(_0x4d77('0x6'));var logger=require('../../config/logger')(_0x4d77('0x7'));var config=require(_0x4d77('0x8'));var jayson=require(_0x4d77('0x9'));var client=jayson[_0x4d77('0xa')][_0x4d77('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4d77('0xc')],{'host':_0x4d77('0xd'),'port':0x18eb});var socket=require(_0x4d77('0xe'))(new Redis(config[_0x4d77('0xc')]));require(_0x4d77('0xf'))[_0x4d77('0x10')](socket);function respondWithRpcPromise(_0xfce8dd,_0x54f285,_0x1a3ba7){return new BPromise(function(_0xaaae5c,_0x47e158){return client[_0x4d77('0x11')](_0xfce8dd,_0x1a3ba7)['then'](function(_0x9c8912){logger[_0x4d77('0x12')](_0x4d77('0x13'),_0x54f285,_0x4d77('0x14'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x54f285,_0x4d77('0x14'),JSON[_0x4d77('0x15')](_0x9c8912));if(_0x9c8912[_0x4d77('0x16')]){if(_0x9c8912['error'][_0x4d77('0x17')]===0x1f4){logger[_0x4d77('0x16')]('Dashboard,\x20%s,\x20%s',_0x54f285,_0x9c8912['error']['message']);return _0x47e158(_0x9c8912['error'][_0x4d77('0x18')]);}logger['error'](_0x4d77('0x13'),_0x54f285,_0x9c8912[_0x4d77('0x16')][_0x4d77('0x18')]);return _0xaaae5c(_0x9c8912[_0x4d77('0x16')]['message']);}else{logger['info'](_0x4d77('0x13'),_0x54f285,_0x4d77('0x14'));_0xaaae5c(_0x9c8912['result'][_0x4d77('0x18')]);}})[_0x4d77('0x19')](function(_0x5f05da){logger[_0x4d77('0x16')](_0x4d77('0x13'),_0x54f285,_0x5f05da);_0x47e158(_0x5f05da);});});} \ No newline at end of file +var _0xe7ce=['redis','defaults','localhost','socket.io-emitter','register','then','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x387334,_0x2c6b6e){var _0x38b481=function(_0x255842){while(--_0x255842){_0x387334['push'](_0x387334['shift']());}};_0x38b481(++_0x2c6b6e);}(_0xe7ce,0x13c));var _0xee7c=function(_0x5e3ef8,_0x13c2a6){_0x5e3ef8=_0x5e3ef8-0x0;var _0x1f68ae=_0xe7ce[_0x5e3ef8];return _0x1f68ae;};'use strict';var _=require(_0xee7c('0x0'));var util=require(_0xee7c('0x1'));var moment=require(_0xee7c('0x2'));var BPromise=require('bluebird');var rs=require(_0xee7c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee7c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xee7c('0x5'))('rpc');var config=require(_0xee7c('0x6'));var jayson=require(_0xee7c('0x7'));var client=jayson['client'][_0xee7c('0x8')]({'port':0x232a});config[_0xee7c('0x9')]=_[_0xee7c('0xa')](config[_0xee7c('0x9')],{'host':_0xee7c('0xb'),'port':0x18eb});var socket=require(_0xee7c('0xc'))(new Redis(config['redis']));require('./dashboard.socket')[_0xee7c('0xd')](socket);function respondWithRpcPromise(_0x496af3,_0x2ae5a6,_0x1a72ec){return new BPromise(function(_0x422e50,_0x5c32bc){return client['request'](_0x496af3,_0x1a72ec)[_0xee7c('0xe')](function(_0x286071){logger['info'](_0xee7c('0xf'),_0x2ae5a6,'request\x20sent');logger[_0xee7c('0x10')](_0xee7c('0x11'),_0x2ae5a6,_0xee7c('0x12'),JSON[_0xee7c('0x13')](_0x286071));if(_0x286071[_0xee7c('0x14')]){if(_0x286071[_0xee7c('0x14')][_0xee7c('0x15')]===0x1f4){logger[_0xee7c('0x14')](_0xee7c('0xf'),_0x2ae5a6,_0x286071[_0xee7c('0x14')]['message']);return _0x5c32bc(_0x286071[_0xee7c('0x14')][_0xee7c('0x16')]);}logger[_0xee7c('0x14')]('Dashboard,\x20%s,\x20%s',_0x2ae5a6,_0x286071[_0xee7c('0x14')]['message']);return _0x422e50(_0x286071['error'][_0xee7c('0x16')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x2ae5a6,_0xee7c('0x12'));_0x422e50(_0x286071[_0xee7c('0x17')]['message']);}})[_0xee7c('0x18')](function(_0x241f7c){logger[_0xee7c('0x14')](_0xee7c('0xf'),_0x2ae5a6,_0x241f7c);_0x5c32bc(_0x241f7c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 35554a4..2c00bf6 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 _0xb1d0=['remove','update','emit','removeListener','register','dashboard:','./dashboard.events','save'];(function(_0x52522d,_0x7347af){var _0x37e5db=function(_0x16dde7){while(--_0x16dde7){_0x52522d['push'](_0x52522d['shift']());}};_0x37e5db(++_0x7347af);}(_0xb1d0,0x196));var _0x0b1d=function(_0x3b0265,_0x54c4b6){_0x3b0265=_0x3b0265-0x0;var _0x4d6215=_0xb1d0[_0x3b0265];return _0x4d6215;};'use strict';var DashboardEvents=require(_0x0b1d('0x0'));var events=[_0x0b1d('0x1'),_0x0b1d('0x2'),_0x0b1d('0x3')];function createListener(_0x37f557,_0x57f3f1){return function(_0x5cdbf5){_0x57f3f1[_0x0b1d('0x4')](_0x37f557,_0x5cdbf5);};}function removeListener(_0x395c10,_0x475e6d){return function(){DashboardEvents[_0x0b1d('0x5')](_0x395c10,_0x475e6d);};}exports[_0x0b1d('0x6')]=function(_0x2d875f){for(var _0x198563=0x0,_0x5b1763=events['length'];_0x198563<_0x5b1763;_0x198563++){var _0x34b770=events[_0x198563];var _0x174173=createListener(_0x0b1d('0x7')+_0x34b770,_0x2d875f);DashboardEvents['on'](_0x34b770,_0x174173);}}; \ No newline at end of file +var _0xe536=['./dashboard.events','remove','emit','removeListener','register','length','dashboard:'];(function(_0xab1b8d,_0x2ca1d7){var _0x446863=function(_0x1aebe9){while(--_0x1aebe9){_0xab1b8d['push'](_0xab1b8d['shift']());}};_0x446863(++_0x2ca1d7);}(_0xe536,0x1c7));var _0x6e53=function(_0x1e6beb,_0x186539){_0x1e6beb=_0x1e6beb-0x0;var _0x54738c=_0xe536[_0x1e6beb];return _0x54738c;};'use strict';var DashboardEvents=require(_0x6e53('0x0'));var events=['save',_0x6e53('0x1'),'update'];function createListener(_0x52b439,_0x10cb57){return function(_0xc53c53){_0x10cb57[_0x6e53('0x2')](_0x52b439,_0xc53c53);};}function removeListener(_0x54d774,_0xb974b7){return function(){DashboardEvents[_0x6e53('0x3')](_0x54d774,_0xb974b7);};}exports[_0x6e53('0x4')]=function(_0x24a613){for(var _0xfd30ae=0x0,_0x51122c=events[_0x6e53('0x5')];_0xfd30ae<_0x51122c;_0xfd30ae++){var _0x2a0a1f=events[_0xfd30ae];var _0x545c02=createListener(_0x6e53('0x6')+_0x2a0a1f,_0x24a613);DashboardEvents['on'](_0x2a0a1f,_0x545c02);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index bb9211e..786a688 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 _0x68cc=['get','/:id','show','/:id/items','getItems','post','clone','addItem','put','update','destroy','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index'];(function(_0x452429,_0x10ca1a){var _0x162c24=function(_0x509e11){while(--_0x509e11){_0x452429['push'](_0x452429['shift']());}};_0x162c24(++_0x10ca1a);}(_0x68cc,0x1eb));var _0xc68c=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x68cc[_0x297fd3];return _0x2af381;};'use strict';var multer=require('multer');var util=require(_0xc68c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc68c('0x1')]();var fs_extra=require(_0xc68c('0x2'));var auth=require(_0xc68c('0x3'));var interaction=require(_0xc68c('0x4'));var config=require(_0xc68c('0x5'));var controller=require(_0xc68c('0x6'));router['get']('/',auth[_0xc68c('0x7')](),controller[_0xc68c('0x8')]);router[_0xc68c('0x9')](_0xc68c('0xa'),auth[_0xc68c('0x7')](),controller[_0xc68c('0xb')]);router[_0xc68c('0x9')](_0xc68c('0xc'),auth[_0xc68c('0x7')](),controller[_0xc68c('0xd')]);router[_0xc68c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/clone',auth[_0xc68c('0x7')](),controller[_0xc68c('0xf')]);router[_0xc68c('0xe')](_0xc68c('0xc'),auth['isAuthenticated'](),controller[_0xc68c('0x10')]);router[_0xc68c('0x11')](_0xc68c('0xa'),auth['isAuthenticated'](),controller[_0xc68c('0x12')]);router['delete'](_0xc68c('0xa'),auth[_0xc68c('0x7')](),controller[_0xc68c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x768a=['/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','put','destroy','exports','util','connect-timeout','express','Router','./dashboard.controller','isAuthenticated','index','get'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x768a,0x7d));var _0xa768=function(_0x2730a1,_0x36508f){_0x2730a1=_0x2730a1-0x0;var _0x3c149b=_0x768a[_0x2730a1];return _0x3c149b;};'use strict';var multer=require('multer');var util=require(_0xa768('0x0'));var path=require('path');var timeout=require(_0xa768('0x1'));var express=require(_0xa768('0x2'));var router=express[_0xa768('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa768('0x4'));router['get']('/',auth[_0xa768('0x5')](),controller[_0xa768('0x6')]);router[_0xa768('0x7')](_0xa768('0x8'),auth[_0xa768('0x5')](),controller[_0xa768('0x9')]);router[_0xa768('0x7')](_0xa768('0xa'),auth[_0xa768('0x5')](),controller[_0xa768('0xb')]);router[_0xa768('0xc')]('/',auth['isAuthenticated'](),controller[_0xa768('0xd')]);router[_0xa768('0xc')](_0xa768('0xe'),auth[_0xa768('0x5')](),controller[_0xa768('0xf')]);router[_0xa768('0xc')]('/:id/items',auth[_0xa768('0x5')](),controller['addItem']);router[_0xa768('0x10')](_0xa768('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa768('0x8'),auth[_0xa768('0x5')](),controller[_0xa768('0x11')]);module[_0xa768('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 5d9ca66..d342d38 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 _0xeda8=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','#ffffff','sequelize','squel','exports','STRING'];(function(_0x19ae53,_0x2164c3){var _0x3e1bf7=function(_0x231193){while(--_0x231193){_0x19ae53['push'](_0x19ae53['shift']());}};_0x3e1bf7(++_0x2164c3);}(_0xeda8,0x104));var _0x8eda=function(_0x568c74,_0x2e97c9){_0x568c74=_0x568c74-0x0;var _0x22d3b9=_0xeda8[_0x568c74];return _0x22d3b9;};'use strict';var Sequelize=require(_0x8eda('0x0'));var squel=require(_0x8eda('0x1'));var _=require('lodash');module[_0x8eda('0x2')]={'title':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eda('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x8eda('0x4')](_0x8eda('0x5')),'get':function(){try{return JSON[_0x8eda('0x6')](this[_0x8eda('0x7')](_0x8eda('0x8')));}catch(_0x22dee9){return[];}},'set':function(_0x1f3556){try{this[_0x8eda('0x9')](_0x8eda('0x8'),JSON['stringify'](_0x1f3556));}catch(_0x28b721){this[_0x8eda('0x9')](_0x8eda('0x8'),JSON[_0x8eda('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':_0x8eda('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eda('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x4c60=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x1d2730,_0x3f983c){var _0x33df87=function(_0x4a7fea){while(--_0x4a7fea){_0x1d2730['push'](_0x1d2730['shift']());}};_0x33df87(++_0x3f983c);}(_0x4c60,0xc1));var _0x04c6=function(_0x2eb5be,_0x7aa2ad){_0x2eb5be=_0x2eb5be-0x0;var _0x59d436=_0x4c60[_0x2eb5be];return _0x59d436;};'use strict';var Sequelize=require(_0x04c6('0x0'));var squel=require(_0x04c6('0x1'));var _=require(_0x04c6('0x2'));module[_0x04c6('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x04c6('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x04c6('0x5')));}catch(_0xc6e772){return[];}},'set':function(_0x2054da){try{this[_0x04c6('0x6')](_0x04c6('0x5'),JSON[_0x04c6('0x7')](_0x2054da));}catch(_0x8f9b13){this['setDataValue'](_0x04c6('0x5'),JSON[_0x04c6('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x04c6('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 03e2f47..dde2e06 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 _0xb2ad=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','redis','./dashboardItem.socket','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring'];(function(_0x4dbdc3,_0x5a525d){var _0x1765ad=function(_0x516849){while(--_0x516849){_0x4dbdc3['push'](_0x4dbdc3['shift']());}};_0x1765ad(++_0x5a525d);}(_0xb2ad,0x16d));var _0xdb2a=function(_0x428a0e,_0x4cfa8e){_0x428a0e=_0x428a0e-0x0;var _0x5e180b=_0xb2ad[_0x428a0e];return _0x5e180b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb2a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb2a('0x1'));var rp=require(_0xdb2a('0x2'));var moment=require(_0xdb2a('0x3'));var BPromise=require(_0xdb2a('0x4'));var Mustache=require(_0xdb2a('0x5'));var util=require('util');var path=require(_0xdb2a('0x6'));var sox=require(_0xdb2a('0x7'));var csv=require(_0xdb2a('0x8'));var ejs=require(_0xdb2a('0x9'));var fs=require('fs');var fs_extra=require(_0xdb2a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdb2a('0xb'));var jsforce=require(_0xdb2a('0xc'));var deskjs=require(_0xdb2a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdb2a('0xe'));var Papa=require(_0xdb2a('0xf'));var Redis=require('ioredis');var authService=require(_0xdb2a('0x10'));var qs=require(_0xdb2a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb2a('0x12'))(_0xdb2a('0x13'));var utils=require(_0xdb2a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdb2a('0x15'));var db=require(_0xdb2a('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xdb2a('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb2a('0x18')]));require(_0xdb2a('0x19'))['register'](socket);function respondWithStatusCode(_0x33045a,_0x52ffb0){_0x52ffb0=_0x52ffb0||0xcc;return function(_0x542503){if(_0x542503){return _0x33045a['sendStatus'](_0x52ffb0);}return _0x33045a['status'](_0x52ffb0)[_0xdb2a('0x1a')]();};}function respondWithResult(_0x2df1fd,_0x48712c){_0x48712c=_0x48712c||0xc8;return function(_0x48e2e3){if(_0x48e2e3){return _0x2df1fd[_0xdb2a('0x1b')](_0x48712c)[_0xdb2a('0x1c')](_0x48e2e3);}};}function respondWithFilteredResult(_0x440dab,_0x1bdd2f){return function(_0x52508d){if(_0x52508d){var _0x2bc67d=typeof _0x1bdd2f[_0xdb2a('0x1d')]===_0xdb2a('0x1e')&&typeof _0x1bdd2f['limit']==='undefined';var _0x424583=_0x52508d[_0xdb2a('0x1f')];var _0x125233=_0x2bc67d?0x0:_0x1bdd2f[_0xdb2a('0x1d')];var _0x2b64e4=_0x2bc67d?_0x52508d['count']:_0x1bdd2f[_0xdb2a('0x1d')]+_0x1bdd2f['limit'];var _0x444fcf;if(_0x2b64e4>=_0x424583){_0x2b64e4=_0x424583;_0x444fcf=0xc8;}else{_0x444fcf=0xce;}_0x440dab['status'](_0x444fcf);return _0x440dab['set'](_0xdb2a('0x20'),_0x125233+'-'+_0x2b64e4+'/'+_0x424583)[_0xdb2a('0x1c')](_0x52508d);}return null;};}function patchUpdates(_0x46910c){return function(_0x557e76){try{jsonpatch[_0xdb2a('0x21')](_0x557e76,_0x46910c,!![]);}catch(_0x871b44){return BPromise[_0xdb2a('0x22')](_0x871b44);}return _0x557e76[_0xdb2a('0x23')]();};}function saveUpdates(_0x1f3d54,_0x412556){return function(_0x4b2205){if(_0x4b2205){return _0x4b2205[_0xdb2a('0x24')](_0x1f3d54)[_0xdb2a('0x25')](function(_0x5f00fb){return _0x5f00fb;});}return null;};}function removeEntity(_0x332911,_0x3645e9){return function(_0x3b05b2){if(_0x3b05b2){return _0x3b05b2[_0xdb2a('0x26')]()['then'](function(){_0x332911[_0xdb2a('0x1b')](0xcc)[_0xdb2a('0x1a')]();});}};}function handleEntityNotFound(_0x3439c1,_0x1cab2b){return function(_0x4ed637){if(!_0x4ed637){_0x3439c1[_0xdb2a('0x27')](0x194);}return _0x4ed637;};}function handleError(_0x46a80a,_0x4262cf){_0x4262cf=_0x4262cf||0x1f4;return function(_0x2b1c6d){logger[_0xdb2a('0x28')](_0x2b1c6d['stack']);if(_0x2b1c6d[_0xdb2a('0x29')]){delete _0x2b1c6d[_0xdb2a('0x29')];}_0x46a80a[_0xdb2a('0x1b')](_0x4262cf)[_0xdb2a('0x2a')](_0x2b1c6d);};}exports[_0xdb2a('0x2b')]=function(_0xd3a8a3,_0x134053){var _0x2b01e5={'raw':![],'where':{'id':_0xd3a8a3[_0xdb2a('0x2c')]['id']}},_0x3c55cc={};_0x3c55cc[_0xdb2a('0x2d')]=_[_0xdb2a('0x2e')](db[_0xdb2a('0x2f')][_0xdb2a('0x30')]);_0x3c55cc[_0xdb2a('0x31')]=_[_0xdb2a('0x2e')](_0xd3a8a3[_0xdb2a('0x31')]);_0x3c55cc[_0xdb2a('0x32')]=_[_0xdb2a('0x33')](_0x3c55cc[_0xdb2a('0x2d')],_0x3c55cc['query']);_0x2b01e5[_0xdb2a('0x34')]=_[_0xdb2a('0x33')](_0x3c55cc[_0xdb2a('0x2d')],qs['fields'](_0xd3a8a3[_0xdb2a('0x31')][_0xdb2a('0x35')]));_0x2b01e5[_0xdb2a('0x34')]=_0x2b01e5[_0xdb2a('0x34')][_0xdb2a('0x36')]?_0x2b01e5[_0xdb2a('0x34')]:_0x3c55cc[_0xdb2a('0x2d')];if(_0xd3a8a3[_0xdb2a('0x31')][_0xdb2a('0x37')]){_0x2b01e5[_0xdb2a('0x38')]=[{'all':!![]}];}_0x2b01e5=_[_0xdb2a('0x39')]({},_0x2b01e5,_0xd3a8a3[_0xdb2a('0x3a')]);return db[_0xdb2a('0x2f')][_0xdb2a('0x3b')](_0x2b01e5)[_0xdb2a('0x25')](handleEntityNotFound(_0x134053,null))['then'](respondWithResult(_0x134053,null))[_0xdb2a('0x3c')](handleError(_0x134053,null));};exports['destroy']=function(_0x52f058,_0x250fb8){return db[_0xdb2a('0x2f')][_0xdb2a('0x3b')]({'where':{'id':_0x52f058[_0xdb2a('0x2c')]['id']}})[_0xdb2a('0x25')](handleEntityNotFound(_0x250fb8,null))['then'](removeEntity(_0x250fb8,null))['catch'](handleError(_0x250fb8,null));};function widgetAttributes(_0x472170){try{switch(_0x472170['type']){case'iframe':return[{'name':_0xdb2a('0x3d'),'value':_0x472170[_0xdb2a('0x3d')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170['attrs'][0x0]?_0x472170[_0xdb2a('0x3e')][0x0][_0xdb2a('0x3f')]:undefined)||_0xdb2a('0x40')}];case'custom':return[{'name':_0xdb2a('0x41'),'value':_0x472170[_0xdb2a('0x41')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x0]?_0x472170[_0xdb2a('0x3e')][0x0][_0xdb2a('0x3f')]:undefined)||''}];case _0xdb2a('0x42'):return[{'name':'attrHourFormat','value':_0x472170[_0xdb2a('0x43')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x0]?_0x472170[_0xdb2a('0x3e')][0x0]['value']:undefined)||_0xdb2a('0x44')},{'name':_0xdb2a('0x45'),'value':_0x472170['attrTimezone']||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x1]?_0x472170[_0xdb2a('0x3e')][0x1][_0xdb2a('0x3f')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x472170['attrFontSize']||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x2]?_0x472170[_0xdb2a('0x3e')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x472170[_0xdb2a('0x46')]||(_0x472170['attrs']&&_0x472170[_0xdb2a('0x3e')][0x0]?_0x472170[_0xdb2a('0x3e')][0x0][_0xdb2a('0x3f')]:undefined)||_0xdb2a('0x47')},{'name':'attrVoiceQueues','value':_0x472170[_0xdb2a('0x48')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x1]?_0x472170['attrs'][0x1][_0xdb2a('0x3f')]:undefined)||[]},{'name':_0xdb2a('0x49'),'value':_0x472170[_0xdb2a('0x49')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170['attrs'][0x2]?_0x472170[_0xdb2a('0x3e')][0x2]['value']:undefined)||0x14},{'name':_0xdb2a('0x4a'),'value':_0x472170['attrChannel']||(_0x472170['attrs']&&_0x472170[_0xdb2a('0x3e')][0x3]?_0x472170[_0xdb2a('0x3e')][0x3][_0xdb2a('0x3f')]:undefined)||_0xdb2a('0x4b')},{'name':_0xdb2a('0x4c'),'value':_0x472170[_0xdb2a('0x4c')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170['attrs'][0x4]?_0x472170[_0xdb2a('0x3e')][0x4][_0xdb2a('0x3f')]:undefined)||''},{'name':_0xdb2a('0x4d'),'value':_0x472170[_0xdb2a('0x4d')]||(_0x472170['attrs']&&_0x472170[_0xdb2a('0x3e')][0x5]?_0x472170[_0xdb2a('0x3e')][0x5]['value']:undefined)||''},{'name':_0xdb2a('0x4e'),'value':_0x472170[_0xdb2a('0x4e')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x6]?_0x472170['attrs'][0x6]['value']:undefined)||''},{'name':_0xdb2a('0x4f'),'value':_0x472170['attrOpenchannelAccounts']||(_0x472170[_0xdb2a('0x3e')]&&_0x472170['attrs'][0x7]?_0x472170[_0xdb2a('0x3e')][0x7][_0xdb2a('0x3f')]:undefined)||''},{'name':_0xdb2a('0x50'),'value':_0x472170['attrWhatsappAccounts']||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x8]?_0x472170[_0xdb2a('0x3e')][0x8]['value']:undefined)||''},{'name':_0xdb2a('0x51'),'value':_0x472170['attrChatWebsites']||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x9]?_0x472170['attrs'][0x9][_0xdb2a('0x3f')]:undefined)||''}];case _0xdb2a('0x52'):case _0xdb2a('0x53'):return[{'name':_0xdb2a('0x54'),'value':_0x472170['attrSerie1']||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x0]?_0x472170[_0xdb2a('0x3e')][0x0][_0xdb2a('0x3f')]:undefined)||_0xdb2a('0x47')},{'name':_0xdb2a('0x55'),'value':_0x472170[_0xdb2a('0x55')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170['attrs'][0x1]?_0x472170['attrs'][0x1][_0xdb2a('0x3f')]:undefined)||null},{'name':_0xdb2a('0x56'),'value':_0x472170[_0xdb2a('0x56')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x2]?_0x472170[_0xdb2a('0x3e')][0x2][_0xdb2a('0x3f')]:undefined)||null},{'name':_0xdb2a('0x48'),'value':_0x472170[_0xdb2a('0x48')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x3]?_0x472170[_0xdb2a('0x3e')][0x3][_0xdb2a('0x3f')]:undefined)||[]},{'name':_0xdb2a('0x4a'),'value':_0x472170['attrChannel']||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x4]?_0x472170[_0xdb2a('0x3e')][0x4][_0xdb2a('0x3f')]:undefined)||'voice'},{'name':_0xdb2a('0x4c'),'value':_0x472170[_0xdb2a('0x4c')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170['attrs'][0x5]?_0x472170[_0xdb2a('0x3e')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x472170['attrFaxAccounts']||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x6]?_0x472170[_0xdb2a('0x3e')][0x6][_0xdb2a('0x3f')]:undefined)||''},{'name':_0xdb2a('0x4e'),'value':_0x472170[_0xdb2a('0x4e')]||(_0x472170['attrs']&&_0x472170['attrs'][0x7]?_0x472170['attrs'][0x7][_0xdb2a('0x3f')]:undefined)||''},{'name':_0xdb2a('0x4f'),'value':_0x472170['attrOpenchannelAccounts']||(_0x472170[_0xdb2a('0x3e')]&&_0x472170['attrs'][0x8]?_0x472170['attrs'][0x8][_0xdb2a('0x3f')]:undefined)||''},{'name':_0xdb2a('0x50'),'value':_0x472170[_0xdb2a('0x50')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x9]?_0x472170['attrs'][0x9]['value']:undefined)||''},{'name':_0xdb2a('0x51'),'value':_0x472170[_0xdb2a('0x51')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0xa]?_0x472170[_0xdb2a('0x3e')][0xa][_0xdb2a('0x3f')]:undefined)||''}];case _0xdb2a('0x57'):return[{'name':_0xdb2a('0x58'),'type':_0x472170[_0xdb2a('0x59')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x0]?_0x472170['attrs'][0x0]['type']:undefined)||null,'value':_0x472170[_0xdb2a('0x58')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x0]?_0x472170[_0xdb2a('0x3e')][0x0][_0xdb2a('0x3f')]:undefined)||null},{'name':'attrRefresh','value':_0x472170[_0xdb2a('0x5a')]||(_0x472170[_0xdb2a('0x3e')]&&_0x472170[_0xdb2a('0x3e')][0x1]?_0x472170[_0xdb2a('0x3e')][0x1][_0xdb2a('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x2930c3){logger[_0xdb2a('0x28')](_0xdb2a('0x5b'),JSON[_0xdb2a('0x5c')](_0x2930c3));return[];}}exports[_0xdb2a('0x5d')]=function(_0x2d7448,_0x43825a){if(_0x2d7448[_0xdb2a('0x5e')]){_0x2d7448[_0xdb2a('0x5e')][_0xdb2a('0x3e')]=widgetAttributes(_0x2d7448[_0xdb2a('0x5e')]);}return db[_0xdb2a('0x2f')][_0xdb2a('0x5d')](_0x2d7448[_0xdb2a('0x5e')],{})[_0xdb2a('0x25')](respondWithResult(_0x43825a,0xc9))[_0xdb2a('0x3c')](handleError(_0x43825a,null));};exports[_0xdb2a('0x24')]=function(_0x2808a6,_0x376e80){if(_0x2808a6[_0xdb2a('0x5e')]['id']){delete _0x2808a6[_0xdb2a('0x5e')]['id'];}_0x2808a6[_0xdb2a('0x5e')][_0xdb2a('0x3e')]=widgetAttributes(_0x2808a6['body']);return db[_0xdb2a('0x2f')][_0xdb2a('0x3b')]({'where':{'id':_0x2808a6[_0xdb2a('0x2c')]['id']}})['then'](handleEntityNotFound(_0x376e80,null))[_0xdb2a('0x25')](saveUpdates(_0x2808a6[_0xdb2a('0x5e')],null))[_0xdb2a('0x25')](respondWithResult(_0x376e80,null))[_0xdb2a('0x3c')](handleError(_0x376e80,null));}; \ No newline at end of file +var _0x51f2=['keys','rawAttributes','query','intersection','attributes','fields','includeAll','merge','options','DashboardItem','find','type','iframe','attrUrl','attrs','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','offset','undefined','count','limit','json','then','destroy','error','stack','name','model'];(function(_0x440cfe,_0x124101){var _0x400d98=function(_0x13a305){while(--_0x13a305){_0x440cfe['push'](_0x440cfe['shift']());}};_0x400d98(++_0x124101);}(_0x51f2,0xeb));var _0x251f=function(_0xb0bcc4,_0x55214f){_0xb0bcc4=_0xb0bcc4-0x0;var _0x3aef48=_0x51f2[_0xb0bcc4];return _0x3aef48;};'use strict';var emlformat=require(_0x251f('0x0'));var rimraf=require(_0x251f('0x1'));var zipdir=require(_0x251f('0x2'));var jsonpatch=require(_0x251f('0x3'));var rp=require(_0x251f('0x4'));var moment=require(_0x251f('0x5'));var BPromise=require(_0x251f('0x6'));var Mustache=require(_0x251f('0x7'));var util=require(_0x251f('0x8'));var path=require('path');var sox=require(_0x251f('0x9'));var csv=require(_0x251f('0xa'));var ejs=require(_0x251f('0xb'));var fs=require('fs');var fs_extra=require(_0x251f('0xc'));var _=require(_0x251f('0xd'));var squel=require('squel');var crypto=require(_0x251f('0xe'));var jsforce=require(_0x251f('0xf'));var deskjs=require(_0x251f('0x10'));var toCsv=require(_0x251f('0xa'));var querystring=require('querystring');var Papa=require(_0x251f('0x11'));var Redis=require(_0x251f('0x12'));var authService=require(_0x251f('0x13'));var qs=require(_0x251f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x251f('0x15'));var logger=require(_0x251f('0x16'))(_0x251f('0x17'));var utils=require(_0x251f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x251f('0x19'));var db=require(_0x251f('0x1a'))['db'];config[_0x251f('0x1b')]=_[_0x251f('0x1c')](config[_0x251f('0x1b')],{'host':_0x251f('0x1d'),'port':0x18eb});var socket=require(_0x251f('0x1e'))(new Redis(config[_0x251f('0x1b')]));require(_0x251f('0x1f'))[_0x251f('0x20')](socket);function respondWithStatusCode(_0x1837d1,_0x575ee5){_0x575ee5=_0x575ee5||0xcc;return function(_0x1f6333){if(_0x1f6333){return _0x1837d1[_0x251f('0x21')](_0x575ee5);}return _0x1837d1['status'](_0x575ee5)[_0x251f('0x22')]();};}function respondWithResult(_0x4303e2,_0x2f16d4){_0x2f16d4=_0x2f16d4||0xc8;return function(_0x190ff3){if(_0x190ff3){return _0x4303e2[_0x251f('0x23')](_0x2f16d4)['json'](_0x190ff3);}};}function respondWithFilteredResult(_0x5d34b2,_0x27ed41){return function(_0x39e173){if(_0x39e173){var _0x2647a1=typeof _0x27ed41[_0x251f('0x24')]===_0x251f('0x25')&&typeof _0x27ed41['limit']===_0x251f('0x25');var _0x2198a7=_0x39e173['count'];var _0x509b50=_0x2647a1?0x0:_0x27ed41[_0x251f('0x24')];var _0x41c627=_0x2647a1?_0x39e173[_0x251f('0x26')]:_0x27ed41[_0x251f('0x24')]+_0x27ed41[_0x251f('0x27')];var _0x52f31d;if(_0x41c627>=_0x2198a7){_0x41c627=_0x2198a7;_0x52f31d=0xc8;}else{_0x52f31d=0xce;}_0x5d34b2[_0x251f('0x23')](_0x52f31d);return _0x5d34b2['set']('Content-Range',_0x509b50+'-'+_0x41c627+'/'+_0x2198a7)[_0x251f('0x28')](_0x39e173);}return null;};}function patchUpdates(_0xdd907d){return function(_0x4efb26){try{jsonpatch['apply'](_0x4efb26,_0xdd907d,!![]);}catch(_0x124dd2){return BPromise['reject'](_0x124dd2);}return _0x4efb26['save']();};}function saveUpdates(_0x2da7ad,_0x356d9f){return function(_0x1de0ce){if(_0x1de0ce){return _0x1de0ce['update'](_0x2da7ad)[_0x251f('0x29')](function(_0x1f770c){return _0x1f770c;});}return null;};}function removeEntity(_0x5d5790,_0x56979d){return function(_0x137ca1){if(_0x137ca1){return _0x137ca1[_0x251f('0x2a')]()[_0x251f('0x29')](function(){_0x5d5790[_0x251f('0x23')](0xcc)[_0x251f('0x22')]();});}};}function handleEntityNotFound(_0x2842ed,_0x42a442){return function(_0xcbd067){if(!_0xcbd067){_0x2842ed[_0x251f('0x21')](0x194);}return _0xcbd067;};}function handleError(_0x5aa987,_0x2d2054){_0x2d2054=_0x2d2054||0x1f4;return function(_0x13c6be){logger[_0x251f('0x2b')](_0x13c6be[_0x251f('0x2c')]);if(_0x13c6be[_0x251f('0x2d')]){delete _0x13c6be[_0x251f('0x2d')];}_0x5aa987['status'](_0x2d2054)['send'](_0x13c6be);};}exports['show']=function(_0x1b04d2,_0x2264df){var _0x2e2caa={'raw':![],'where':{'id':_0x1b04d2['params']['id']}},_0x5cd423={};_0x5cd423[_0x251f('0x2e')]=_[_0x251f('0x2f')](db['DashboardItem'][_0x251f('0x30')]);_0x5cd423[_0x251f('0x31')]=_['keys'](_0x1b04d2[_0x251f('0x31')]);_0x5cd423['filters']=_[_0x251f('0x32')](_0x5cd423['model'],_0x5cd423[_0x251f('0x31')]);_0x2e2caa[_0x251f('0x33')]=_[_0x251f('0x32')](_0x5cd423[_0x251f('0x2e')],qs[_0x251f('0x34')](_0x1b04d2[_0x251f('0x31')][_0x251f('0x34')]));_0x2e2caa[_0x251f('0x33')]=_0x2e2caa[_0x251f('0x33')]['length']?_0x2e2caa[_0x251f('0x33')]:_0x5cd423[_0x251f('0x2e')];if(_0x1b04d2[_0x251f('0x31')][_0x251f('0x35')]){_0x2e2caa['include']=[{'all':!![]}];}_0x2e2caa=_[_0x251f('0x36')]({},_0x2e2caa,_0x1b04d2[_0x251f('0x37')]);return db[_0x251f('0x38')][_0x251f('0x39')](_0x2e2caa)[_0x251f('0x29')](handleEntityNotFound(_0x2264df,null))[_0x251f('0x29')](respondWithResult(_0x2264df,null))['catch'](handleError(_0x2264df,null));};exports[_0x251f('0x2a')]=function(_0x21f929,_0x41ea75){return db['DashboardItem'][_0x251f('0x39')]({'where':{'id':_0x21f929['params']['id']}})[_0x251f('0x29')](handleEntityNotFound(_0x41ea75,null))[_0x251f('0x29')](removeEntity(_0x41ea75,null))['catch'](handleError(_0x41ea75,null));};function widgetAttributes(_0x3c3716){try{switch(_0x3c3716[_0x251f('0x3a')]){case _0x251f('0x3b'):return[{'name':_0x251f('0x3c'),'value':_0x3c3716['attrUrl']||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x0]?_0x3c3716['attrs'][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':_0x251f('0x3e'),'value':_0x3c3716[_0x251f('0x3e')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x0]?_0x3c3716[_0x251f('0x3d')][0x0][_0x251f('0x3f')]:undefined)||''}];case'clock':return[{'name':_0x251f('0x40'),'value':_0x3c3716['attrHourFormat']||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716['attrs'][0x0]?_0x3c3716[_0x251f('0x3d')][0x0][_0x251f('0x3f')]:undefined)||_0x251f('0x41')},{'name':_0x251f('0x42'),'value':_0x3c3716[_0x251f('0x42')]||(_0x3c3716['attrs']&&_0x3c3716[_0x251f('0x3d')][0x1]?_0x3c3716[_0x251f('0x3d')][0x1][_0x251f('0x3f')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x3c3716[_0x251f('0x43')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716['attrs'][0x2]?_0x3c3716[_0x251f('0x3d')][0x2]['value']:undefined)||0xc}];case _0x251f('0x44'):return[{'name':'attrMetric','value':_0x3c3716[_0x251f('0x45')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x0]?_0x3c3716[_0x251f('0x3d')][0x0]['value']:undefined)||'total'},{'name':_0x251f('0x46'),'value':_0x3c3716[_0x251f('0x46')]||(_0x3c3716['attrs']&&_0x3c3716[_0x251f('0x3d')][0x1]?_0x3c3716[_0x251f('0x3d')][0x1]['value']:undefined)||[]},{'name':_0x251f('0x43'),'value':_0x3c3716[_0x251f('0x43')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x2]?_0x3c3716[_0x251f('0x3d')][0x2][_0x251f('0x3f')]:undefined)||0x14},{'name':_0x251f('0x47'),'value':_0x3c3716[_0x251f('0x47')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x3]?_0x3c3716['attrs'][0x3][_0x251f('0x3f')]:undefined)||_0x251f('0x48')},{'name':_0x251f('0x49'),'value':_0x3c3716[_0x251f('0x49')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x4]?_0x3c3716[_0x251f('0x3d')][0x4][_0x251f('0x3f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3c3716[_0x251f('0x4a')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x5]?_0x3c3716[_0x251f('0x3d')][0x5][_0x251f('0x3f')]:undefined)||''},{'name':_0x251f('0x4b'),'value':_0x3c3716['attrSmsAccounts']||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x6]?_0x3c3716[_0x251f('0x3d')][0x6][_0x251f('0x3f')]:undefined)||''},{'name':_0x251f('0x4c'),'value':_0x3c3716[_0x251f('0x4c')]||(_0x3c3716['attrs']&&_0x3c3716[_0x251f('0x3d')][0x7]?_0x3c3716[_0x251f('0x3d')][0x7][_0x251f('0x3f')]:undefined)||''},{'name':_0x251f('0x4d'),'value':_0x3c3716['attrWhatsappAccounts']||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x8]?_0x3c3716[_0x251f('0x3d')][0x8][_0x251f('0x3f')]:undefined)||''},{'name':_0x251f('0x4e'),'value':_0x3c3716[_0x251f('0x4e')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x9]?_0x3c3716[_0x251f('0x3d')][0x9][_0x251f('0x3f')]:undefined)||''}];case'multibar-chart':case _0x251f('0x4f'):return[{'name':_0x251f('0x50'),'value':_0x3c3716[_0x251f('0x50')]||(_0x3c3716['attrs']&&_0x3c3716[_0x251f('0x3d')][0x0]?_0x3c3716[_0x251f('0x3d')][0x0]['value']:undefined)||_0x251f('0x51')},{'name':_0x251f('0x52'),'value':_0x3c3716['attrSerie2']||(_0x3c3716['attrs']&&_0x3c3716[_0x251f('0x3d')][0x1]?_0x3c3716['attrs'][0x1][_0x251f('0x3f')]:undefined)||null},{'name':_0x251f('0x53'),'value':_0x3c3716[_0x251f('0x53')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x2]?_0x3c3716['attrs'][0x2]['value']:undefined)||null},{'name':_0x251f('0x46'),'value':_0x3c3716[_0x251f('0x46')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x3]?_0x3c3716[_0x251f('0x3d')][0x3][_0x251f('0x3f')]:undefined)||[]},{'name':_0x251f('0x47'),'value':_0x3c3716[_0x251f('0x47')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x4]?_0x3c3716['attrs'][0x4][_0x251f('0x3f')]:undefined)||_0x251f('0x48')},{'name':_0x251f('0x49'),'value':_0x3c3716['attrEmailAccounts']||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716['attrs'][0x5]?_0x3c3716[_0x251f('0x3d')][0x5][_0x251f('0x3f')]:undefined)||''},{'name':_0x251f('0x4a'),'value':_0x3c3716[_0x251f('0x4a')]||(_0x3c3716['attrs']&&_0x3c3716[_0x251f('0x3d')][0x6]?_0x3c3716[_0x251f('0x3d')][0x6]['value']:undefined)||''},{'name':_0x251f('0x4b'),'value':_0x3c3716[_0x251f('0x4b')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x7]?_0x3c3716[_0x251f('0x3d')][0x7][_0x251f('0x3f')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3c3716[_0x251f('0x4c')]||(_0x3c3716['attrs']&&_0x3c3716['attrs'][0x8]?_0x3c3716[_0x251f('0x3d')][0x8][_0x251f('0x3f')]:undefined)||''},{'name':_0x251f('0x4d'),'value':_0x3c3716[_0x251f('0x4d')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x9]?_0x3c3716['attrs'][0x9][_0x251f('0x3f')]:undefined)||''},{'name':_0x251f('0x4e'),'value':_0x3c3716[_0x251f('0x4e')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0xa]?_0x3c3716[_0x251f('0x3d')][0xa][_0x251f('0x3f')]:undefined)||''}];case _0x251f('0x54'):return[{'name':_0x251f('0x55'),'type':_0x3c3716[_0x251f('0x56')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x0]?_0x3c3716['attrs'][0x0][_0x251f('0x3a')]:undefined)||null,'value':_0x3c3716[_0x251f('0x55')]||(_0x3c3716['attrs']&&_0x3c3716[_0x251f('0x3d')][0x0]?_0x3c3716['attrs'][0x0][_0x251f('0x3f')]:undefined)||null},{'name':_0x251f('0x57'),'value':_0x3c3716[_0x251f('0x57')]||(_0x3c3716[_0x251f('0x3d')]&&_0x3c3716[_0x251f('0x3d')][0x1]?_0x3c3716[_0x251f('0x3d')][0x1][_0x251f('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x4ab1f8){logger[_0x251f('0x2b')](_0x251f('0x58'),JSON[_0x251f('0x59')](_0x4ab1f8));return[];}}exports[_0x251f('0x5a')]=function(_0x12af71,_0x16ac34){if(_0x12af71[_0x251f('0x5b')]){_0x12af71[_0x251f('0x5b')][_0x251f('0x3d')]=widgetAttributes(_0x12af71[_0x251f('0x5b')]);}return db[_0x251f('0x38')][_0x251f('0x5a')](_0x12af71[_0x251f('0x5b')],{})[_0x251f('0x29')](respondWithResult(_0x16ac34,0xc9))['catch'](handleError(_0x16ac34,null));};exports['update']=function(_0x55141b,_0x4c8445){if(_0x55141b[_0x251f('0x5b')]['id']){delete _0x55141b[_0x251f('0x5b')]['id'];}_0x55141b[_0x251f('0x5b')][_0x251f('0x3d')]=widgetAttributes(_0x55141b['body']);return db['DashboardItem'][_0x251f('0x39')]({'where':{'id':_0x55141b[_0x251f('0x5c')]['id']}})[_0x251f('0x29')](handleEntityNotFound(_0x4c8445,null))[_0x251f('0x29')](saveUpdates(_0x55141b[_0x251f('0x5b')],null))['then'](respondWithResult(_0x4c8445,null))[_0x251f('0x5d')](handleError(_0x4c8445,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 62bd911..931f09e 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 _0x5777=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','DashboardItem'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5777,0xb2));var _0x7577=function(_0x25feba,_0xff2e40){_0x25feba=_0x25feba-0x0;var _0x48a7ab=_0x5777[_0x25feba];return _0x48a7ab;};'use strict';var EventEmitter=require(_0x7577('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x7577('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7577('0x2')](0x0);var events={'afterCreate':_0x7577('0x3'),'afterUpdate':'update','afterDestroy':_0x7577('0x4')};function emitEvent(_0x51bd10){return function(_0x856b2a,_0x3935c1,_0x5d2299){DashboardItemEvents[_0x7577('0x5')](_0x51bd10+':'+_0x856b2a['id'],_0x856b2a);DashboardItemEvents[_0x7577('0x5')](_0x51bd10,_0x856b2a);_0x5d2299(null);};}for(var e in events){if(events[_0x7577('0x6')](e)){var event=events[e];DashboardItem[_0x7577('0x7')](e,emitEvent(event));}}module[_0x7577('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xb286=['hook','exports','events','../../mysqldb','emit'];(function(_0x1f4ff3,_0x48e8e5){var _0x4d017f=function(_0x3c2ed8){while(--_0x3c2ed8){_0x1f4ff3['push'](_0x1f4ff3['shift']());}};_0x4d017f(++_0x48e8e5);}(_0xb286,0x151));var _0x6b28=function(_0x52fbd4,_0x400f7f){_0x52fbd4=_0x52fbd4-0x0;var _0x47a4fc=_0xb286[_0x52fbd4];return _0x47a4fc;};'use strict';var EventEmitter=require(_0x6b28('0x0'));var DashboardItem=require(_0x6b28('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5198be){return function(_0x1c77e7,_0x179bba,_0x12c1f4){DashboardItemEvents[_0x6b28('0x2')](_0x5198be+':'+_0x1c77e7['id'],_0x1c77e7);DashboardItemEvents[_0x6b28('0x2')](_0x5198be,_0x1c77e7);_0x12c1f4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x6b28('0x3')](e,emitEvent(event));}}module[_0x6b28('0x4')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d74a686..5121634 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 _0xccf3=['lodash','util','bluebird','request-promise','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items'];(function(_0x40886f,_0x30f5b5){var _0x4173b9=function(_0x1e1b80){while(--_0x1e1b80){_0x40886f['push'](_0x40886f['shift']());}};_0x4173b9(++_0x30f5b5);}(_0xccf3,0x99));var _0x3ccf=function(_0xc8b197,_0x357666){_0xc8b197=_0xc8b197-0x0;var _0x41a289=_0xccf3[_0xc8b197];return _0x41a289;};'use strict';var _=require(_0x3ccf('0x0'));var util=require(_0x3ccf('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3ccf('0x2'));var rp=require(_0x3ccf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3ccf('0x4'));var attributes=require(_0x3ccf('0x5'));module['exports']=function(_0x26f583,_0x447171){return _0x26f583[_0x3ccf('0x6')](_0x3ccf('0x7'),attributes,{'tableName':_0x3ccf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d9d=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','dashboard_items'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0x9d9d,0x129));var _0xd9d9=function(_0x14e665,_0x2fbda4){_0x14e665=_0x14e665-0x0;var _0x4b4824=_0x9d9d[_0x14e665];return _0x4b4824;};'use strict';var _=require('lodash');var util=require(_0xd9d9('0x0'));var logger=require(_0xd9d9('0x1'))(_0xd9d9('0x2'));var moment=require(_0xd9d9('0x3'));var BPromise=require(_0xd9d9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9d9('0x5'));var rimraf=require(_0xd9d9('0x6'));var config=require(_0xd9d9('0x7'));var attributes=require(_0xd9d9('0x8'));module[_0xd9d9('0x9')]=function(_0x341c8c,_0x315af7){return _0x341c8c['define']('DashboardItem',attributes,{'tableName':_0xd9d9('0xa'),'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 91fe084..b8c08e3 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 _0x2516=['request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x1fb4ff,_0x172d25){var _0x3f2d20=function(_0x358d44){while(--_0x358d44){_0x1fb4ff['push'](_0x1fb4ff['shift']());}};_0x3f2d20(++_0x172d25);}(_0x2516,0x7d));var _0x6251=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x2516[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x6251('0x0'));var util=require(_0x6251('0x1'));var moment=require('moment');var BPromise=require(_0x6251('0x2'));var rs=require(_0x6251('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6251('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6251('0x5'))(_0x6251('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6251('0x7')]({'port':0x232a});config['redis']=_[_0x6251('0x8')](config[_0x6251('0x9')],{'host':_0x6251('0xa'),'port':0x18eb});var socket=require(_0x6251('0xb'))(new Redis(config[_0x6251('0x9')]));require(_0x6251('0xc'))['register'](socket);function respondWithRpcPromise(_0x1e8465,_0x20f8c5,_0x14b313){return new BPromise(function(_0x269cc4,_0x1c11d3){return client[_0x6251('0xd')](_0x1e8465,_0x14b313)[_0x6251('0xe')](function(_0x9eb4f){logger[_0x6251('0xf')](_0x6251('0x10'),_0x20f8c5,_0x6251('0x11'));logger[_0x6251('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x20f8c5,'request\x20sent',JSON[_0x6251('0x13')](_0x9eb4f));if(_0x9eb4f[_0x6251('0x14')]){if(_0x9eb4f[_0x6251('0x14')]['code']===0x1f4){logger[_0x6251('0x14')](_0x6251('0x10'),_0x20f8c5,_0x9eb4f['error'][_0x6251('0x15')]);return _0x1c11d3(_0x9eb4f[_0x6251('0x14')][_0x6251('0x15')]);}logger[_0x6251('0x14')](_0x6251('0x10'),_0x20f8c5,_0x9eb4f[_0x6251('0x14')]['message']);return _0x269cc4(_0x9eb4f[_0x6251('0x14')][_0x6251('0x15')]);}else{logger['info'](_0x6251('0x10'),_0x20f8c5,_0x6251('0x11'));_0x269cc4(_0x9eb4f[_0x6251('0x16')][_0x6251('0x15')]);}})['catch'](function(_0x241102){logger['error']('DashboardItem,\x20%s,\x20%s',_0x20f8c5,_0x241102);_0x1c11d3(_0x241102);});});} \ No newline at end of file +var _0x234d=['then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','request'];(function(_0x1bc6c2,_0x2c15bd){var _0x58b07f=function(_0x437271){while(--_0x437271){_0x1bc6c2['push'](_0x1bc6c2['shift']());}};_0x58b07f(++_0x2c15bd);}(_0x234d,0x18b));var _0xd234=function(_0x1fe8a4,_0xaad5b7){_0x1fe8a4=_0x1fe8a4-0x0;var _0x293efd=_0x234d[_0x1fe8a4];return _0x293efd;};'use strict';var _=require(_0xd234('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd234('0x1'));var rs=require(_0xd234('0x2'));var fs=require('fs');var Redis=require(_0xd234('0x3'));var db=require(_0xd234('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd234('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd234('0x6')][_0xd234('0x7')]({'port':0x232a});config[_0xd234('0x8')]=_[_0xd234('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd234('0xa'))(new Redis(config[_0xd234('0x8')]));require(_0xd234('0xb'))['register'](socket);function respondWithRpcPromise(_0x385d76,_0x31f5d3,_0x2ed2e3){return new BPromise(function(_0x283b0d,_0x3f054f){return client[_0xd234('0xc')](_0x385d76,_0x2ed2e3)[_0xd234('0xd')](function(_0x1b6f0e){logger[_0xd234('0xe')](_0xd234('0xf'),_0x31f5d3,_0xd234('0x10'));logger[_0xd234('0x11')](_0xd234('0x12'),_0x31f5d3,_0xd234('0x10'),JSON[_0xd234('0x13')](_0x1b6f0e));if(_0x1b6f0e[_0xd234('0x14')]){if(_0x1b6f0e[_0xd234('0x14')][_0xd234('0x15')]===0x1f4){logger[_0xd234('0x14')](_0xd234('0xf'),_0x31f5d3,_0x1b6f0e[_0xd234('0x14')][_0xd234('0x16')]);return _0x3f054f(_0x1b6f0e[_0xd234('0x14')]['message']);}logger[_0xd234('0x14')](_0xd234('0xf'),_0x31f5d3,_0x1b6f0e[_0xd234('0x14')][_0xd234('0x16')]);return _0x283b0d(_0x1b6f0e[_0xd234('0x14')][_0xd234('0x16')]);}else{logger[_0xd234('0xe')](_0xd234('0xf'),_0x31f5d3,_0xd234('0x10'));_0x283b0d(_0x1b6f0e['result']['message']);}})[_0xd234('0x17')](function(_0x4ca8de){logger[_0xd234('0x14')](_0xd234('0xf'),_0x31f5d3,_0x4ca8de);_0x3f054f(_0x4ca8de);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 5f3e9f3..f1b1073 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 _0x9a96=['dashboardItem:','./dashboardItem.events','save','remove','emit','removeListener','length'];(function(_0x14675b,_0x21a339){var _0x49575a=function(_0x45ec1){while(--_0x45ec1){_0x14675b['push'](_0x14675b['shift']());}};_0x49575a(++_0x21a339);}(_0x9a96,0x120));var _0x69a9=function(_0x727ef1,_0x405280){_0x727ef1=_0x727ef1-0x0;var _0x2d778b=_0x9a96[_0x727ef1];return _0x2d778b;};'use strict';var DashboardItemEvents=require(_0x69a9('0x0'));var events=[_0x69a9('0x1'),_0x69a9('0x2'),'update'];function createListener(_0x33eda0,_0x5e36f4){return function(_0x17896c){_0x5e36f4[_0x69a9('0x3')](_0x33eda0,_0x17896c);};}function removeListener(_0x33b09d,_0x534f8a){return function(){DashboardItemEvents[_0x69a9('0x4')](_0x33b09d,_0x534f8a);};}exports['register']=function(_0x21dfac){for(var _0x28a9f1=0x0,_0xfc56f5=events[_0x69a9('0x5')];_0x28a9f1<_0xfc56f5;_0x28a9f1++){var _0x2d8961=events[_0x28a9f1];var _0x20120d=createListener(_0x69a9('0x6')+_0x2d8961,_0x21dfac);DashboardItemEvents['on'](_0x2d8961,_0x20120d);}}; \ No newline at end of file +var _0xd248=['./dashboardItem.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3bda84,_0x44e32e){var _0x53cdec=function(_0x59e198){while(--_0x59e198){_0x3bda84['push'](_0x3bda84['shift']());}};_0x53cdec(++_0x44e32e);}(_0xd248,0x110));var _0x8d24=function(_0x437953,_0x2a63e0){_0x437953=_0x437953-0x0;var _0x21ed64=_0xd248[_0x437953];return _0x21ed64;};'use strict';var DashboardItemEvents=require(_0x8d24('0x0'));var events=[_0x8d24('0x1'),_0x8d24('0x2'),_0x8d24('0x3')];function createListener(_0x30d1ad,_0x3f3a4d){return function(_0x24545c){_0x3f3a4d[_0x8d24('0x4')](_0x30d1ad,_0x24545c);};}function removeListener(_0x15f6ea,_0x3231b9){return function(){DashboardItemEvents[_0x8d24('0x5')](_0x15f6ea,_0x3231b9);};}exports[_0x8d24('0x6')]=function(_0x2594f1){for(var _0x1fa68f=0x0,_0x21bf95=events[_0x8d24('0x7')];_0x1fa68f<_0x21bf95;_0x1fa68f++){var _0x57c425=events[_0x1fa68f];var _0x1d856d=createListener('dashboardItem:'+_0x57c425,_0x2594f1);DashboardItemEvents['on'](_0x57c425,_0x1d856d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index df3657e..5d5fd8f 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 _0xfbfd=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','/:id','isAuthenticated','post','create','update','delete','destroy'];(function(_0x4b7ed3,_0x3573fa){var _0x3888fd=function(_0x383090){while(--_0x383090){_0x4b7ed3['push'](_0x4b7ed3['shift']());}};_0x3888fd(++_0x3573fa);}(_0xfbfd,0x168));var _0xdfbf=function(_0x560a09,_0x1a17b1){_0x560a09=_0x560a09-0x0;var _0x3b3232=_0xfbfd[_0x560a09];return _0x3b3232;};'use strict';var multer=require(_0xdfbf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdfbf('0x1'));var express=require(_0xdfbf('0x2'));var router=express[_0xdfbf('0x3')]();var fs_extra=require(_0xdfbf('0x4'));var auth=require(_0xdfbf('0x5'));var interaction=require(_0xdfbf('0x6'));var config=require('../../config/environment');var controller=require(_0xdfbf('0x7'));router['get'](_0xdfbf('0x8'),auth[_0xdfbf('0x9')](),controller['show']);router[_0xdfbf('0xa')]('/',auth['isAuthenticated'](),controller[_0xdfbf('0xb')]);router['put'](_0xdfbf('0x8'),auth[_0xdfbf('0x9')](),controller[_0xdfbf('0xc')]);router[_0xdfbf('0xd')](_0xdfbf('0x8'),auth[_0xdfbf('0x9')](),controller[_0xdfbf('0xe')]);module['exports']=router; \ No newline at end of file +var _0xac95=['delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','show','create','put','/:id','update'];(function(_0xfb299e,_0x2ca984){var _0x564de9=function(_0x39e05f){while(--_0x39e05f){_0xfb299e['push'](_0xfb299e['shift']());}};_0x564de9(++_0x2ca984);}(_0xac95,0xcc));var _0x5ac9=function(_0x15327e,_0x3fae7d){_0x15327e=_0x15327e-0x0;var _0x7e3962=_0xac95[_0x15327e];return _0x7e3962;};'use strict';var multer=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var path=require(_0x5ac9('0x2'));var timeout=require(_0x5ac9('0x3'));var express=require(_0x5ac9('0x4'));var router=express[_0x5ac9('0x5')]();var fs_extra=require(_0x5ac9('0x6'));var auth=require(_0x5ac9('0x7'));var interaction=require(_0x5ac9('0x8'));var config=require(_0x5ac9('0x9'));var controller=require(_0x5ac9('0xa'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x5ac9('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5ac9('0xc')]);router[_0x5ac9('0xd')](_0x5ac9('0xe'),auth['isAuthenticated'](),controller[_0x5ac9('0xf')]);router[_0x5ac9('0x10')](_0x5ac9('0xe'),auth[_0x5ac9('0x11')](),controller[_0x5ac9('0x12')]);module[_0x5ac9('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 22fb3e2..58da3dc 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 _0x9b8f=['first','third','STRING','ENUM'];(function(_0x215366,_0x4919de){var _0xc78c39=function(_0x4b2678){while(--_0x4b2678){_0x215366['push'](_0x215366['shift']());}};_0xc78c39(++_0x4919de);}(_0x9b8f,0x14e));var _0xf9b8=function(_0x9c08b6,_0x1ca0f2){_0x9c08b6=_0x9c08b6-0x0;var _0x27d93e=_0x9b8f[_0x9c08b6];return _0x27d93e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf9b8('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0xf9b8('0x1')](_0xf9b8('0x2'),'second',_0xf9b8('0x3')),'allowNull':![],'defaultValue':_0xf9b8('0x2')},'description':{'type':Sequelize[_0xf9b8('0x0')]}}; \ No newline at end of file +var _0x4340=['first','third','STRING','sequelize','ENUM'];(function(_0x5b734b,_0x486a7f){var _0x2a15a3=function(_0x187239){while(--_0x187239){_0x5b734b['push'](_0x5b734b['shift']());}};_0x2a15a3(++_0x486a7f);}(_0x4340,0xb7));var _0x0434=function(_0x16dee3,_0x366f9c){_0x16dee3=_0x16dee3-0x0;var _0x5bd3f1=_0x4340[_0x16dee3];return _0x5bd3f1;};'use strict';var Sequelize=require(_0x0434('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x0434('0x1')](_0x0434('0x2'),'second',_0x0434('0x3')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x0434('0x4')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 48e6fdd..3ce261d 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 _0xb294=['find','create','body','user','Dispositions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Disposition','findAll','rows','catch','show','params','includeAll','include'];(function(_0x57f87b,_0x91c818){var _0x13ee7f=function(_0x2a1517){while(--_0x2a1517){_0x57f87b['push'](_0x57f87b['shift']());}};_0x13ee7f(++_0x91c818);}(_0xb294,0x159));var _0x4b29=function(_0x37320c,_0x11386e){_0x37320c=_0x37320c-0x0;var _0x59b2de=_0xb294[_0x37320c];return _0x59b2de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b29('0x0'));var zipdir=require(_0x4b29('0x1'));var jsonpatch=require(_0x4b29('0x2'));var rp=require(_0x4b29('0x3'));var moment=require(_0x4b29('0x4'));var BPromise=require(_0x4b29('0x5'));var Mustache=require(_0x4b29('0x6'));var util=require(_0x4b29('0x7'));var path=require('path');var sox=require(_0x4b29('0x8'));var csv=require('to-csv');var ejs=require(_0x4b29('0x9'));var fs=require('fs');var fs_extra=require(_0x4b29('0xa'));var _=require(_0x4b29('0xb'));var squel=require(_0x4b29('0xc'));var crypto=require(_0x4b29('0xd'));var jsforce=require(_0x4b29('0xe'));var deskjs=require(_0x4b29('0xf'));var toCsv=require(_0x4b29('0x10'));var querystring=require(_0x4b29('0x11'));var Papa=require(_0x4b29('0x12'));var Redis=require(_0x4b29('0x13'));var authService=require(_0x4b29('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4b29('0x15'));var hardwareService=require(_0x4b29('0x16'));var logger=require(_0x4b29('0x17'))(_0x4b29('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b29('0x19'))['db'];function respondWithStatusCode(_0x20a75b,_0x2efdd5){_0x2efdd5=_0x2efdd5||0xcc;return function(_0xfc03d4){if(_0xfc03d4){return _0x20a75b[_0x4b29('0x1a')](_0x2efdd5);}return _0x20a75b['status'](_0x2efdd5)[_0x4b29('0x1b')]();};}function respondWithResult(_0x109f5d,_0x29a2d3){_0x29a2d3=_0x29a2d3||0xc8;return function(_0x44433c){if(_0x44433c){return _0x109f5d[_0x4b29('0x1c')](_0x29a2d3)['json'](_0x44433c);}};}function respondWithFilteredResult(_0x384a8e,_0x2e094a){return function(_0x17da92){if(_0x17da92){var _0x4517b4=typeof _0x2e094a[_0x4b29('0x1d')]===_0x4b29('0x1e')&&typeof _0x2e094a[_0x4b29('0x1f')]===_0x4b29('0x1e');var _0x58c244=_0x17da92['count'];var _0x476e1e=_0x4517b4?0x0:_0x2e094a['offset'];var _0x290be2=_0x4517b4?_0x17da92[_0x4b29('0x20')]:_0x2e094a[_0x4b29('0x1d')]+_0x2e094a['limit'];var _0x343236;if(_0x290be2>=_0x58c244){_0x290be2=_0x58c244;_0x343236=0xc8;}else{_0x343236=0xce;}_0x384a8e[_0x4b29('0x1c')](_0x343236);return _0x384a8e[_0x4b29('0x21')](_0x4b29('0x22'),_0x476e1e+'-'+_0x290be2+'/'+_0x58c244)[_0x4b29('0x23')](_0x17da92);}return null;};}function patchUpdates(_0x588c44){return function(_0x4379aa){try{jsonpatch[_0x4b29('0x24')](_0x4379aa,_0x588c44,!![]);}catch(_0x3e99a9){return BPromise['reject'](_0x3e99a9);}return _0x4379aa[_0x4b29('0x25')]();};}function saveUpdates(_0x114497,_0x2b1ab6){return function(_0x82197e){if(_0x82197e){return _0x82197e['update'](_0x114497)[_0x4b29('0x26')](function(_0x111719){return _0x111719;});}return null;};}function removeEntity(_0x5bffcf,_0x2dd70b){return function(_0x359ab2){if(_0x359ab2){return _0x359ab2[_0x4b29('0x27')]()[_0x4b29('0x26')](function(){var _0x3ae242=_0x359ab2[_0x4b29('0x28')]({'plain':!![]});var _0x407c95='Dispositions';return db['UserProfileResource'][_0x4b29('0x27')]({'where':{'type':_0x407c95,'resourceId':_0x3ae242['id']}})['then'](function(){return _0x359ab2;});})[_0x4b29('0x26')](function(){_0x5bffcf[_0x4b29('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x155d57,_0x3b8c5f){return function(_0x18c952){if(!_0x18c952){_0x155d57[_0x4b29('0x1a')](0x194);}return _0x18c952;};}function handleError(_0x4e89c1,_0x4c1801){_0x4c1801=_0x4c1801||0x1f4;return function(_0x48ebb5){logger[_0x4b29('0x29')](_0x48ebb5[_0x4b29('0x2a')]);if(_0x48ebb5['name']){delete _0x48ebb5[_0x4b29('0x2b')];}_0x4e89c1['status'](_0x4c1801)[_0x4b29('0x2c')](_0x48ebb5);};}exports[_0x4b29('0x2d')]=function(_0x51b498,_0x4d0526){var _0x4a4d4e={},_0x3f4069={},_0x227ec1={'count':0x0,'rows':[]};var _0x525d00=_[_0x4b29('0x2e')](db['Disposition'][_0x4b29('0x2f')],function(_0x50198d){return{'name':_0x50198d[_0x4b29('0x30')],'type':_0x50198d[_0x4b29('0x31')]['key']};});_0x3f4069[_0x4b29('0x32')]=_[_0x4b29('0x2e')](_0x525d00,_0x4b29('0x2b'));_0x3f4069['query']=_[_0x4b29('0x33')](_0x51b498[_0x4b29('0x34')]);_0x3f4069[_0x4b29('0x35')]=_[_0x4b29('0x36')](_0x3f4069['model'],_0x3f4069[_0x4b29('0x34')]);_0x4a4d4e[_0x4b29('0x37')]=_[_0x4b29('0x36')](_0x3f4069['model'],qs[_0x4b29('0x38')](_0x51b498[_0x4b29('0x34')][_0x4b29('0x38')]));_0x4a4d4e[_0x4b29('0x37')]=_0x4a4d4e[_0x4b29('0x37')][_0x4b29('0x39')]?_0x4a4d4e[_0x4b29('0x37')]:_0x3f4069[_0x4b29('0x32')];if(!_0x51b498['query'][_0x4b29('0x3a')]('nolimit')){_0x4a4d4e[_0x4b29('0x1f')]=qs[_0x4b29('0x1f')](_0x51b498[_0x4b29('0x34')][_0x4b29('0x1f')]);_0x4a4d4e[_0x4b29('0x1d')]=qs[_0x4b29('0x1d')](_0x51b498[_0x4b29('0x34')][_0x4b29('0x1d')]);}_0x4a4d4e[_0x4b29('0x3b')]=qs[_0x4b29('0x3c')](_0x51b498[_0x4b29('0x34')][_0x4b29('0x3c')]);_0x4a4d4e[_0x4b29('0x3d')]=qs[_0x4b29('0x35')](_[_0x4b29('0x3e')](_0x51b498[_0x4b29('0x34')],_0x3f4069['filters']),_0x525d00);if(_0x51b498[_0x4b29('0x34')][_0x4b29('0x3f')]){_0x4a4d4e[_0x4b29('0x3d')]=_[_0x4b29('0x40')](_0x4a4d4e[_0x4b29('0x3d')],{'$or':_[_0x4b29('0x2e')](_0x525d00,function(_0x6cd830){if(_0x6cd830[_0x4b29('0x31')]!==_0x4b29('0x41')){var _0x4464cd={};_0x4464cd[_0x6cd830[_0x4b29('0x2b')]]={'$like':'%'+_0x51b498['query'][_0x4b29('0x3f')]+'%'};return _0x4464cd;}})});}_0x4a4d4e=_['merge']({},_0x4a4d4e,_0x51b498[_0x4b29('0x42')]);var _0x394f13={'where':_0x4a4d4e[_0x4b29('0x3d')]};return db[_0x4b29('0x43')][_0x4b29('0x20')](_0x394f13)[_0x4b29('0x26')](function(_0x10e925){_0x227ec1[_0x4b29('0x20')]=_0x10e925;if(_0x51b498[_0x4b29('0x34')]['includeAll']){_0x4a4d4e['include']=[{'all':!![]}];}return db['Disposition'][_0x4b29('0x44')](_0x4a4d4e);})[_0x4b29('0x26')](function(_0x1298d3){_0x227ec1[_0x4b29('0x45')]=_0x1298d3;return _0x227ec1;})[_0x4b29('0x26')](respondWithFilteredResult(_0x4d0526,_0x4a4d4e))[_0x4b29('0x46')](handleError(_0x4d0526,null));};exports[_0x4b29('0x47')]=function(_0x3f0902,_0x40b6b2){var _0x333133={'raw':!![],'where':{'id':_0x3f0902[_0x4b29('0x48')]['id']}},_0x4fa376={};_0x4fa376[_0x4b29('0x32')]=_[_0x4b29('0x33')](db['Disposition'][_0x4b29('0x2f')]);_0x4fa376[_0x4b29('0x34')]=_['keys'](_0x3f0902[_0x4b29('0x34')]);_0x4fa376[_0x4b29('0x35')]=_[_0x4b29('0x36')](_0x4fa376[_0x4b29('0x32')],_0x4fa376['query']);_0x333133[_0x4b29('0x37')]=_['intersection'](_0x4fa376[_0x4b29('0x32')],qs[_0x4b29('0x38')](_0x3f0902[_0x4b29('0x34')][_0x4b29('0x38')]));_0x333133[_0x4b29('0x37')]=_0x333133['attributes'][_0x4b29('0x39')]?_0x333133[_0x4b29('0x37')]:_0x4fa376['model'];if(_0x3f0902[_0x4b29('0x34')][_0x4b29('0x49')]){_0x333133[_0x4b29('0x4a')]=[{'all':!![]}];}_0x333133=_[_0x4b29('0x40')]({},_0x333133,_0x3f0902[_0x4b29('0x42')]);return db[_0x4b29('0x43')][_0x4b29('0x4b')](_0x333133)[_0x4b29('0x26')](handleEntityNotFound(_0x40b6b2,null))[_0x4b29('0x26')](respondWithResult(_0x40b6b2,null))[_0x4b29('0x46')](handleError(_0x40b6b2,null));};exports[_0x4b29('0x4c')]=function(_0x26e991,_0x47f8c1){return db[_0x4b29('0x43')][_0x4b29('0x4c')](_0x26e991[_0x4b29('0x4d')],{})[_0x4b29('0x26')](function(_0x2445ab){var _0x49ae7c=_0x26e991[_0x4b29('0x4e')]['get']({'plain':!![]});if(!_0x49ae7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49ae7c['role']===_0x4b29('0x4e')){var _0x35f78b=_0x2445ab['get']({'plain':!![]});var _0x4d8a0d=_0x4b29('0x4f');return db[_0x4b29('0x50')][_0x4b29('0x4b')]({'where':{'name':_0x4d8a0d,'userProfileId':_0x49ae7c[_0x4b29('0x51')]},'raw':!![]})[_0x4b29('0x26')](function(_0x129432){if(_0x129432&&_0x129432[_0x4b29('0x52')]===0x0){return db['UserProfileResource'][_0x4b29('0x4c')]({'name':_0x35f78b['name'],'resourceId':_0x35f78b['id'],'type':_0x129432[_0x4b29('0x2b')],'sectionId':_0x129432['id']},{})[_0x4b29('0x26')](function(){return _0x2445ab;});}else{return _0x2445ab;}})['catch'](function(_0x453a6a){logger[_0x4b29('0x29')](_0x4b29('0x53'),_0x453a6a);throw _0x453a6a;});}return _0x2445ab;})['then'](respondWithResult(_0x47f8c1,0xc9))[_0x4b29('0x46')](handleError(_0x47f8c1,null));};exports['update']=function(_0x6f80b2,_0x232ff0){if(_0x6f80b2[_0x4b29('0x4d')]['id']){delete _0x6f80b2[_0x4b29('0x4d')]['id'];}return db[_0x4b29('0x43')]['find']({'where':{'id':_0x6f80b2[_0x4b29('0x48')]['id']}})[_0x4b29('0x26')](handleEntityNotFound(_0x232ff0,null))['then'](saveUpdates(_0x6f80b2[_0x4b29('0x4d')],null))[_0x4b29('0x26')](respondWithResult(_0x232ff0,null))['catch'](handleError(_0x232ff0,null));};exports[_0x4b29('0x27')]=function(_0x41d9d7,_0x42c888){return db['Disposition'][_0x4b29('0x4b')]({'where':{'id':_0x41d9d7['params']['id']}})[_0x4b29('0x26')](handleEntityNotFound(_0x42c888,null))[_0x4b29('0x26')](removeEntity(_0x42c888,null))['catch'](handleError(_0x42c888,null));}; \ No newline at end of file +var _0xccd4=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','index','map','Disposition','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','include','findAll','rows','catch','show','params','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x523739,_0x58eb15){var _0x38075e=function(_0x1a907c){while(--_0x1a907c){_0x523739['push'](_0x523739['shift']());}};_0x38075e(++_0x58eb15);}(_0xccd4,0xa4));var _0x4ccd=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xccd4[_0x34bc30];return _0x5706de;};'use strict';var emlformat=require(_0x4ccd('0x0'));var rimraf=require(_0x4ccd('0x1'));var zipdir=require(_0x4ccd('0x2'));var jsonpatch=require(_0x4ccd('0x3'));var rp=require(_0x4ccd('0x4'));var moment=require(_0x4ccd('0x5'));var BPromise=require(_0x4ccd('0x6'));var Mustache=require(_0x4ccd('0x7'));var util=require(_0x4ccd('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4ccd('0x9'));var fs=require('fs');var fs_extra=require(_0x4ccd('0xa'));var _=require(_0x4ccd('0xb'));var squel=require(_0x4ccd('0xc'));var crypto=require(_0x4ccd('0xd'));var jsforce=require(_0x4ccd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4ccd('0xf'));var querystring=require(_0x4ccd('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4ccd('0x11'));var qs=require(_0x4ccd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ccd('0x13'));var logger=require(_0x4ccd('0x14'))(_0x4ccd('0x15'));var utils=require(_0x4ccd('0x16'));var config=require(_0x4ccd('0x17'));var licenseUtil=require(_0x4ccd('0x18'));var db=require(_0x4ccd('0x19'))['db'];function respondWithStatusCode(_0x57bc32,_0x423336){_0x423336=_0x423336||0xcc;return function(_0x22fef4){if(_0x22fef4){return _0x57bc32[_0x4ccd('0x1a')](_0x423336);}return _0x57bc32[_0x4ccd('0x1b')](_0x423336)[_0x4ccd('0x1c')]();};}function respondWithResult(_0x46be83,_0x32f3cf){_0x32f3cf=_0x32f3cf||0xc8;return function(_0x3784ad){if(_0x3784ad){return _0x46be83[_0x4ccd('0x1b')](_0x32f3cf)[_0x4ccd('0x1d')](_0x3784ad);}};}function respondWithFilteredResult(_0x29643b,_0x4d4c9a){return function(_0x27dcfa){if(_0x27dcfa){var _0xf338b7=typeof _0x4d4c9a[_0x4ccd('0x1e')]===_0x4ccd('0x1f')&&typeof _0x4d4c9a[_0x4ccd('0x20')]==='undefined';var _0x31688d=_0x27dcfa['count'];var _0x5615d8=_0xf338b7?0x0:_0x4d4c9a[_0x4ccd('0x1e')];var _0x1047c8=_0xf338b7?_0x27dcfa[_0x4ccd('0x21')]:_0x4d4c9a[_0x4ccd('0x1e')]+_0x4d4c9a[_0x4ccd('0x20')];var _0x33df51;if(_0x1047c8>=_0x31688d){_0x1047c8=_0x31688d;_0x33df51=0xc8;}else{_0x33df51=0xce;}_0x29643b[_0x4ccd('0x1b')](_0x33df51);return _0x29643b[_0x4ccd('0x22')](_0x4ccd('0x23'),_0x5615d8+'-'+_0x1047c8+'/'+_0x31688d)[_0x4ccd('0x1d')](_0x27dcfa);}return null;};}function patchUpdates(_0x98b4e0){return function(_0x33febc){try{jsonpatch[_0x4ccd('0x24')](_0x33febc,_0x98b4e0,!![]);}catch(_0x738204){return BPromise['reject'](_0x738204);}return _0x33febc[_0x4ccd('0x25')]();};}function saveUpdates(_0x1bf1b2,_0x4074dc){return function(_0x1a608d){if(_0x1a608d){return _0x1a608d[_0x4ccd('0x26')](_0x1bf1b2)[_0x4ccd('0x27')](function(_0x55b766){return _0x55b766;});}return null;};}function removeEntity(_0x35af9b,_0x4efa54){return function(_0x464501){if(_0x464501){return _0x464501[_0x4ccd('0x28')]()[_0x4ccd('0x27')](function(){var _0x29c926=_0x464501[_0x4ccd('0x29')]({'plain':!![]});var _0xd54f92=_0x4ccd('0x2a');return db[_0x4ccd('0x2b')][_0x4ccd('0x28')]({'where':{'type':_0xd54f92,'resourceId':_0x29c926['id']}})['then'](function(){return _0x464501;});})[_0x4ccd('0x27')](function(){_0x35af9b[_0x4ccd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2918b4,_0x2216e7){return function(_0x48a22a){if(!_0x48a22a){_0x2918b4['sendStatus'](0x194);}return _0x48a22a;};}function handleError(_0x24e9fa,_0x546e98){_0x546e98=_0x546e98||0x1f4;return function(_0x469bf8){logger[_0x4ccd('0x2c')](_0x469bf8['stack']);if(_0x469bf8['name']){delete _0x469bf8[_0x4ccd('0x2d')];}_0x24e9fa[_0x4ccd('0x1b')](_0x546e98)[_0x4ccd('0x2e')](_0x469bf8);};}exports[_0x4ccd('0x2f')]=function(_0x9f06c1,_0x252067){var _0x73eb00={},_0x3ba762={},_0x1d84a0={'count':0x0,'rows':[]};var _0x11f150=_[_0x4ccd('0x30')](db[_0x4ccd('0x31')][_0x4ccd('0x32')],function(_0x4d2c58){return{'name':_0x4d2c58[_0x4ccd('0x33')],'type':_0x4d2c58[_0x4ccd('0x34')]['key']};});_0x3ba762[_0x4ccd('0x35')]=_[_0x4ccd('0x30')](_0x11f150,_0x4ccd('0x2d'));_0x3ba762[_0x4ccd('0x36')]=_[_0x4ccd('0x37')](_0x9f06c1[_0x4ccd('0x36')]);_0x3ba762[_0x4ccd('0x38')]=_['intersection'](_0x3ba762[_0x4ccd('0x35')],_0x3ba762[_0x4ccd('0x36')]);_0x73eb00[_0x4ccd('0x39')]=_[_0x4ccd('0x3a')](_0x3ba762['model'],qs[_0x4ccd('0x3b')](_0x9f06c1[_0x4ccd('0x36')][_0x4ccd('0x3b')]));_0x73eb00[_0x4ccd('0x39')]=_0x73eb00[_0x4ccd('0x39')][_0x4ccd('0x3c')]?_0x73eb00[_0x4ccd('0x39')]:_0x3ba762[_0x4ccd('0x35')];if(!_0x9f06c1[_0x4ccd('0x36')][_0x4ccd('0x3d')](_0x4ccd('0x3e'))){_0x73eb00[_0x4ccd('0x20')]=qs[_0x4ccd('0x20')](_0x9f06c1['query']['limit']);_0x73eb00[_0x4ccd('0x1e')]=qs['offset'](_0x9f06c1[_0x4ccd('0x36')][_0x4ccd('0x1e')]);}_0x73eb00[_0x4ccd('0x3f')]=qs[_0x4ccd('0x40')](_0x9f06c1[_0x4ccd('0x36')][_0x4ccd('0x40')]);_0x73eb00[_0x4ccd('0x41')]=qs[_0x4ccd('0x38')](_['pick'](_0x9f06c1[_0x4ccd('0x36')],_0x3ba762[_0x4ccd('0x38')]),_0x11f150);if(_0x9f06c1[_0x4ccd('0x36')]['filter']){_0x73eb00['where']=_[_0x4ccd('0x42')](_0x73eb00[_0x4ccd('0x41')],{'$or':_['map'](_0x11f150,function(_0x179e16){if(_0x179e16['type']!=='VIRTUAL'){var _0x4373ca={};_0x4373ca[_0x179e16[_0x4ccd('0x2d')]]={'$like':'%'+_0x9f06c1[_0x4ccd('0x36')][_0x4ccd('0x43')]+'%'};return _0x4373ca;}})});}_0x73eb00=_[_0x4ccd('0x42')]({},_0x73eb00,_0x9f06c1['options']);var _0x195a63={'where':_0x73eb00['where']};return db[_0x4ccd('0x31')][_0x4ccd('0x21')](_0x195a63)[_0x4ccd('0x27')](function(_0x1f57e7){_0x1d84a0['count']=_0x1f57e7;if(_0x9f06c1[_0x4ccd('0x36')]['includeAll']){_0x73eb00[_0x4ccd('0x44')]=[{'all':!![]}];}return db[_0x4ccd('0x31')][_0x4ccd('0x45')](_0x73eb00);})[_0x4ccd('0x27')](function(_0x257b4a){_0x1d84a0[_0x4ccd('0x46')]=_0x257b4a;return _0x1d84a0;})['then'](respondWithFilteredResult(_0x252067,_0x73eb00))[_0x4ccd('0x47')](handleError(_0x252067,null));};exports[_0x4ccd('0x48')]=function(_0x376b6a,_0x5e61f0){var _0x70514e={'raw':!![],'where':{'id':_0x376b6a[_0x4ccd('0x49')]['id']}},_0x1b386e={};_0x1b386e[_0x4ccd('0x35')]=_[_0x4ccd('0x37')](db['Disposition'][_0x4ccd('0x32')]);_0x1b386e['query']=_['keys'](_0x376b6a[_0x4ccd('0x36')]);_0x1b386e[_0x4ccd('0x38')]=_[_0x4ccd('0x3a')](_0x1b386e[_0x4ccd('0x35')],_0x1b386e[_0x4ccd('0x36')]);_0x70514e[_0x4ccd('0x39')]=_['intersection'](_0x1b386e['model'],qs['fields'](_0x376b6a[_0x4ccd('0x36')][_0x4ccd('0x3b')]));_0x70514e[_0x4ccd('0x39')]=_0x70514e[_0x4ccd('0x39')][_0x4ccd('0x3c')]?_0x70514e[_0x4ccd('0x39')]:_0x1b386e['model'];if(_0x376b6a[_0x4ccd('0x36')][_0x4ccd('0x4a')]){_0x70514e['include']=[{'all':!![]}];}_0x70514e=_[_0x4ccd('0x42')]({},_0x70514e,_0x376b6a[_0x4ccd('0x4b')]);return db[_0x4ccd('0x31')][_0x4ccd('0x4c')](_0x70514e)['then'](handleEntityNotFound(_0x5e61f0,null))['then'](respondWithResult(_0x5e61f0,null))['catch'](handleError(_0x5e61f0,null));};exports[_0x4ccd('0x4d')]=function(_0x523d0e,_0x430716){return db['Disposition'][_0x4ccd('0x4d')](_0x523d0e['body'],{})['then'](function(_0x571954){var _0x37376a=_0x523d0e[_0x4ccd('0x4e')][_0x4ccd('0x29')]({'plain':!![]});if(!_0x37376a)throw new Error(_0x4ccd('0x4f'));if(_0x37376a['role']===_0x4ccd('0x4e')){var _0x2edf3c=_0x571954[_0x4ccd('0x29')]({'plain':!![]});var _0x26514a=_0x4ccd('0x2a');return db[_0x4ccd('0x50')][_0x4ccd('0x4c')]({'where':{'name':_0x26514a,'userProfileId':_0x37376a['userProfileId']},'raw':!![]})[_0x4ccd('0x27')](function(_0x3588e9){if(_0x3588e9&&_0x3588e9['autoAssociation']===0x0){return db[_0x4ccd('0x2b')][_0x4ccd('0x4d')]({'name':_0x2edf3c['name'],'resourceId':_0x2edf3c['id'],'type':_0x3588e9[_0x4ccd('0x2d')],'sectionId':_0x3588e9['id']},{})['then'](function(){return _0x571954;});}else{return _0x571954;}})[_0x4ccd('0x47')](function(_0x2ca24f){logger[_0x4ccd('0x2c')](_0x4ccd('0x51'),_0x2ca24f);throw _0x2ca24f;});}return _0x571954;})[_0x4ccd('0x27')](respondWithResult(_0x430716,0xc9))[_0x4ccd('0x47')](handleError(_0x430716,null));};exports[_0x4ccd('0x26')]=function(_0x1feddc,_0x3d532d){if(_0x1feddc['body']['id']){delete _0x1feddc['body']['id'];}return db['Disposition'][_0x4ccd('0x4c')]({'where':{'id':_0x1feddc[_0x4ccd('0x49')]['id']}})['then'](handleEntityNotFound(_0x3d532d,null))[_0x4ccd('0x27')](saveUpdates(_0x1feddc['body'],null))[_0x4ccd('0x27')](respondWithResult(_0x3d532d,null))[_0x4ccd('0x47')](handleError(_0x3d532d,null));};exports[_0x4ccd('0x28')]=function(_0x477b46,_0x34d78e){return db['Disposition'][_0x4ccd('0x4c')]({'where':{'id':_0x477b46[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x27')](handleEntityNotFound(_0x34d78e,null))['then'](removeEntity(_0x34d78e,null))[_0x4ccd('0x47')](handleError(_0x34d78e,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 5d1f2c0..c598f6c 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 _0x0202=['MailAccountId','name_sms','SmsAccountId','name_fax','OpenchannelAccountId','name_whatsapp','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat'];(function(_0x405aeb,_0x5ee732){var _0x50e76a=function(_0x2cded1){while(--_0x2cded1){_0x405aeb['push'](_0x405aeb['shift']());}};_0x50e76a(++_0x5ee732);}(_0x0202,0x18d));var _0x2020=function(_0x5bebf2,_0x32aa77){_0x5bebf2=_0x5bebf2-0x0;var _0x2924e4=_0x0202[_0x5bebf2];return _0x2924e4;};'use strict';var _=require('lodash');var util=require(_0x2020('0x0'));var logger=require(_0x2020('0x1'))(_0x2020('0x2'));var moment=require('moment');var BPromise=require(_0x2020('0x3'));var rp=require(_0x2020('0x4'));var fs=require('fs');var path=require(_0x2020('0x5'));var rimraf=require(_0x2020('0x6'));var config=require(_0x2020('0x7'));var attributes=require(_0x2020('0x8'));module[_0x2020('0x9')]=function(_0x18da15,_0x551b74){return _0x18da15[_0x2020('0xa')](_0x2020('0xb'),attributes,{'tableName':_0x2020('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2020('0xd'),'fields':[_0x2020('0xe'),_0x2020('0xf')]},{'unique':!![],'name':_0x2020('0x10'),'fields':[_0x2020('0xe'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':['name',_0x2020('0x11')]},{'unique':!![],'name':_0x2020('0x12'),'fields':['name',_0x2020('0x13')]},{'unique':!![],'name':_0x2020('0x14'),'fields':[_0x2020('0xe'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x2020('0xe'),_0x2020('0x15')]},{'unique':!![],'name':_0x2020('0x16'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc308=['name_sms','SmsAccountId','name_fax','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId'];(function(_0x3ab4c2,_0x457813){var _0x5f22a6=function(_0x14a85d){while(--_0x14a85d){_0x3ab4c2['push'](_0x3ab4c2['shift']());}};_0x5f22a6(++_0x457813);}(_0xc308,0x1af));var _0x8c30=function(_0x380d16,_0xdf0d31){_0x380d16=_0x380d16-0x0;var _0x5d5253=_0xc308[_0x380d16];return _0x5d5253;};'use strict';var _=require(_0x8c30('0x0'));var util=require('util');var logger=require(_0x8c30('0x1'))('api');var moment=require(_0x8c30('0x2'));var BPromise=require(_0x8c30('0x3'));var rp=require(_0x8c30('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c30('0x5'));var config=require(_0x8c30('0x6'));var attributes=require(_0x8c30('0x7'));module[_0x8c30('0x8')]=function(_0x50a7be,_0x24109f){return _0x50a7be[_0x8c30('0x9')](_0x8c30('0xa'),attributes,{'tableName':_0x8c30('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x8c30('0xc'),'fields':['name',_0x8c30('0xd')]},{'unique':!![],'name':_0x8c30('0xe'),'fields':[_0x8c30('0xf'),_0x8c30('0x10')]},{'unique':!![],'name':_0x8c30('0x11'),'fields':[_0x8c30('0xf'),_0x8c30('0x12')]},{'unique':!![],'name':_0x8c30('0x13'),'fields':[_0x8c30('0xf'),_0x8c30('0x14')]},{'unique':!![],'name':_0x8c30('0x15'),'fields':[_0x8c30('0xf'),'FaxAccountId']},{'unique':!![],'name':_0x8c30('0x16'),'fields':[_0x8c30('0xf'),'OpenchannelAccountId']},{'unique':!![],'name':_0x8c30('0x17'),'fields':[_0x8c30('0xf'),_0x8c30('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7a5a2c7..c9efce6 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(_0x2e983e,_0x495ce6){var _0xabf9d8=function(_0x1f17d1){while(--_0x1f17d1){_0x2e983e['push'](_0x2e983e['shift']());}};_0xabf9d8(++_0x495ce6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x2dd69d,_0x41a06c){var _0x38e7f2=function(_0x347c33){while(--_0x347c33){_0x2dd69d['push'](_0x2dd69d['shift']());}};_0x38e7f2(++_0x41a06c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 91e674d..1520900 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 _0xd9ad=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','get','/:id','post','create','put','update'];(function(_0x490a80,_0x2c3ec4){var _0x4177da=function(_0xe57b7d){while(--_0xe57b7d){_0x490a80['push'](_0x490a80['shift']());}};_0x4177da(++_0x2c3ec4);}(_0xd9ad,0x132));var _0xdd9a=function(_0x5a6f0d,_0x28bfa5){_0x5a6f0d=_0x5a6f0d-0x0;var _0x13d5f0=_0xd9ad[_0x5a6f0d];return _0x13d5f0;};'use strict';var multer=require(_0xdd9a('0x0'));var util=require(_0xdd9a('0x1'));var path=require(_0xdd9a('0x2'));var timeout=require(_0xdd9a('0x3'));var express=require(_0xdd9a('0x4'));var router=express['Router']();var fs_extra=require(_0xdd9a('0x5'));var auth=require(_0xdd9a('0x6'));var interaction=require(_0xdd9a('0x7'));var config=require(_0xdd9a('0x8'));var controller=require(_0xdd9a('0x9'));router['get']('/',auth[_0xdd9a('0xa')](),controller['index']);router[_0xdd9a('0xb')](_0xdd9a('0xc'),auth[_0xdd9a('0xa')](),controller['show']);router[_0xdd9a('0xd')]('/',auth[_0xdd9a('0xa')](),controller[_0xdd9a('0xe')]);router[_0xdd9a('0xf')]('/:id',auth[_0xdd9a('0xa')](),controller[_0xdd9a('0x10')]);router[_0xdd9a('0x11')](_0xdd9a('0xc'),auth[_0xdd9a('0xa')](),controller[_0xdd9a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x47c7=['isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get'];(function(_0x223dda,_0x5f20d7){var _0x4d1016=function(_0x228b96){while(--_0x228b96){_0x223dda['push'](_0x223dda['shift']());}};_0x4d1016(++_0x5f20d7);}(_0x47c7,0x131));var _0x747c=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x47c7[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0x747c('0x0'));var util=require('util');var path=require(_0x747c('0x1'));var timeout=require(_0x747c('0x2'));var express=require('express');var router=express[_0x747c('0x3')]();var fs_extra=require(_0x747c('0x4'));var auth=require(_0x747c('0x5'));var interaction=require(_0x747c('0x6'));var config=require(_0x747c('0x7'));var controller=require(_0x747c('0x8'));router[_0x747c('0x9')]('/',auth[_0x747c('0xa')](),controller[_0x747c('0xb')]);router[_0x747c('0x9')]('/:id',auth[_0x747c('0xa')](),controller[_0x747c('0xc')]);router[_0x747c('0xd')]('/',auth[_0x747c('0xa')](),controller[_0x747c('0xe')]);router[_0x747c('0xf')](_0x747c('0x10'),auth[_0x747c('0xa')](),controller[_0x747c('0x11')]);router[_0x747c('0x12')](_0x747c('0x10'),auth[_0x747c('0xa')](),controller[_0x747c('0x13')]);module[_0x747c('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 50f55c8..0566763 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 _0x750b=['SIP','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','7200','9600','14400','4800','12000','INTEGER'];(function(_0x1d5a6c,_0x57fcb1){var _0x4ff124=function(_0x1b1422){while(--_0x1b1422){_0x1d5a6c['push'](_0x1d5a6c['shift']());}};_0x4ff124(++_0x57fcb1);}(_0x750b,0x1bf));var _0xb750=function(_0x389fb6,_0x56f281){_0x389fb6=_0x389fb6-0x0;var _0x500088=_0x750b[_0x389fb6];return _0x500088;};'use strict';var Sequelize=require(_0xb750('0x0'));module[_0xb750('0x1')]={'name':{'type':Sequelize[_0xb750('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb750('0x2')]},'ecm':{'type':Sequelize[_0xb750('0x3')](_0xb750('0x4'),'no'),'defaultValue':_0xb750('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xb750('0x5')},'localstationid':{'type':Sequelize[_0xb750('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xb750('0x3')](_0xb750('0x6'),'4800',_0xb750('0x7'),_0xb750('0x8'),'12000',_0xb750('0x9')),'defaultValue':_0xb750('0xa')},'maxrate':{'type':Sequelize['ENUM'](_0xb750('0x6'),'4800',_0xb750('0x7'),_0xb750('0x8'),_0xb750('0xb'),_0xb750('0x9')),'defaultValue':_0xb750('0x9')},'modem':{'type':Sequelize[_0xb750('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb750('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb750('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xb750('0xd'),_0xb750('0xe'),_0xb750('0xf'),_0xb750('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb750('0x11')],'defaultValue':function(){return _0xb750('0x12');}},'notificationSound':{'type':Sequelize[_0xb750('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb750('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb750('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb750('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb750('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb750('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb750('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xb750('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xb750('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x598b5a){if(!_0x598b5a)this['setDataValue'](_0xb750('0x15'),null);this['setDataValue'](_0xb750('0x16'),_0x598b5a);}}}; \ No newline at end of file +var _0xb0e2=['SIP','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','mandatoryDispositionPauseId','setDataValue','sequelize','STRING','ENUM','yes','2400','4800','7200','14400','9600','12000','v17,v27,v29','INTEGER'];(function(_0x522d8b,_0x21f430){var _0x5e0c73=function(_0x535457){while(--_0x535457){_0x522d8b['push'](_0x522d8b['shift']());}};_0x5e0c73(++_0x21f430);}(_0xb0e2,0xac));var _0x2b0e=function(_0x1fc5a7,_0x2e3266){_0x1fc5a7=_0x1fc5a7-0x0;var _0x598a42=_0xb0e2[_0x1fc5a7];return _0x598a42;};'use strict';var Sequelize=require(_0x2b0e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2b0e('0x1')]},'ecm':{'type':Sequelize[_0x2b0e('0x2')](_0x2b0e('0x3'),'no'),'defaultValue':_0x2b0e('0x3')},'headerinfo':{'type':Sequelize[_0x2b0e('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x2b0e('0x2')](_0x2b0e('0x4'),_0x2b0e('0x5'),_0x2b0e('0x6'),'9600','12000',_0x2b0e('0x7')),'defaultValue':_0x2b0e('0x5')},'maxrate':{'type':Sequelize[_0x2b0e('0x2')](_0x2b0e('0x4'),_0x2b0e('0x5'),'7200',_0x2b0e('0x8'),_0x2b0e('0x9'),'14400'),'defaultValue':_0x2b0e('0x7')},'modem':{'type':Sequelize[_0x2b0e('0x1')],'defaultValue':_0x2b0e('0xa')},'gateway':{'type':Sequelize[_0x2b0e('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x2b0e('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x2b0e('0x2')](_0x2b0e('0xc'),_0x2b0e('0xd'),_0x2b0e('0xe'),_0x2b0e('0xf')),'defaultValue':_0x2b0e('0xc')},'key':{'type':Sequelize[_0x2b0e('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2b0e('0x10')],'defaultValue':function(){return _0x2b0e('0x11');}},'notificationSound':{'type':Sequelize[_0x2b0e('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2b0e('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2b0e('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2b0e('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x2b0e('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2b0e('0x14'),'set':function(_0x25333a){if(!_0x25333a)this['setDataValue'](_0x2b0e('0x15'),null);this[_0x2b0e('0x16')]('mandatoryDisposition',_0x25333a);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index abe8b01..12babb4 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 _0xdd7f=['redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','get','FaxAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','filters','filter','where','merge','map','VIRTUAL','options','findAll','params','includeAll','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','pick','include','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','CmContact','Owner','internal','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','context','system','priority','Answer','push','CDR(type)=inbound-fax','Set','ecm','localstationid','faxdetect','maxrate','minrate','modem','t38timeout','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0xdd7f,0xa9));var _0xfdd7=function(_0x5a5176,_0x1c5f42){_0x5a5176=_0x5a5176-0x0;var _0x1b9968=_0xdd7f[_0x5a5176];return _0x1b9968;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfdd7('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfdd7('0x1'));var moment=require('moment');var BPromise=require(_0xfdd7('0x2'));var Mustache=require(_0xfdd7('0x3'));var util=require(_0xfdd7('0x4'));var path=require(_0xfdd7('0x5'));var sox=require(_0xfdd7('0x6'));var csv=require(_0xfdd7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfdd7('0x8'));var _=require(_0xfdd7('0x9'));var squel=require(_0xfdd7('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd7('0xb'));var deskjs=require(_0xfdd7('0xc'));var toCsv=require(_0xfdd7('0x7'));var querystring=require('querystring');var Papa=require(_0xfdd7('0xd'));var Redis=require(_0xfdd7('0xe'));var authService=require(_0xfdd7('0xf'));var qs=require(_0xfdd7('0x10'));var as=require(_0xfdd7('0x11'));var hardwareService=require(_0xfdd7('0x12'));var logger=require(_0xfdd7('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfdd7('0x14'));var db=require('../../mysqldb')['db'];config[_0xfdd7('0x15')]=_[_0xfdd7('0x16')](config[_0xfdd7('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xfdd7('0x17'))(new Redis(config['redis']));require(_0xfdd7('0x18'))[_0xfdd7('0x19')](socket);var jayson=require(_0xfdd7('0x1a'));var client=jayson[_0xfdd7('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0xfdd7('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1874c1,_0x298f90,_0x30aee1,_0x5de818){return new BPromise(function(_0x21449a,_0x2557f8){var _0x259b8c=_0x5de818||client;return _0x259b8c[_0xfdd7('0x1d')](_0x1874c1,_0x30aee1)[_0xfdd7('0x1e')](function(_0x18b2cc){logger[_0xfdd7('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x298f90,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x298f90,_0xfdd7('0x20'),JSON[_0xfdd7('0x21')](_0x18b2cc));if(_0x18b2cc[_0xfdd7('0x22')]){if(_0x18b2cc[_0xfdd7('0x22')][_0xfdd7('0x23')]===0x1f4){logger[_0xfdd7('0x22')](_0xfdd7('0x24'),_0x298f90,_0x18b2cc[_0xfdd7('0x22')][_0xfdd7('0x25')]);return _0x2557f8(_0x18b2cc[_0xfdd7('0x22')][_0xfdd7('0x25')]);}logger[_0xfdd7('0x22')](_0xfdd7('0x24'),_0x298f90,_0x18b2cc[_0xfdd7('0x22')][_0xfdd7('0x25')]);return _0x21449a(_0x18b2cc[_0xfdd7('0x22')][_0xfdd7('0x25')]);}else{logger[_0xfdd7('0x1f')](_0xfdd7('0x24'),_0x298f90,_0xfdd7('0x20'));_0x21449a(_0x18b2cc[_0xfdd7('0x26')][_0xfdd7('0x25')]);}})['catch'](function(_0x1ad7c3){logger[_0xfdd7('0x22')]('FaxAccount,\x20%s,\x20%s',_0x298f90,_0x1ad7c3);_0x2557f8(_0x1ad7c3);});});}function respondWithStatusCode(_0x5a8522,_0x218154){_0x218154=_0x218154||0xcc;return function(_0x583c31){if(_0x583c31){return _0x5a8522[_0xfdd7('0x27')](_0x218154);}return _0x5a8522[_0xfdd7('0x28')](_0x218154)[_0xfdd7('0x29')]();};}function respondWithResult(_0x5e8cf1,_0x183d82){_0x183d82=_0x183d82||0xc8;return function(_0x307431){if(_0x307431){return _0x5e8cf1['status'](_0x183d82)[_0xfdd7('0x2a')](_0x307431);}};}function respondWithFilteredResult(_0x29b869,_0x59ef9e){return function(_0x4c56ff){if(_0x4c56ff){var _0x377ed7=typeof _0x59ef9e['offset']===_0xfdd7('0x2b')&&typeof _0x59ef9e['limit']==='undefined';var _0xe63080=_0x4c56ff[_0xfdd7('0x2c')];var _0x1f0502=_0x377ed7?0x0:_0x59ef9e['offset'];var _0x452f91=_0x377ed7?_0x4c56ff[_0xfdd7('0x2c')]:_0x59ef9e['offset']+_0x59ef9e[_0xfdd7('0x2d')];var _0x3c00d4;if(_0x452f91>=_0xe63080){_0x452f91=_0xe63080;_0x3c00d4=0xc8;}else{_0x3c00d4=0xce;}_0x29b869[_0xfdd7('0x28')](_0x3c00d4);return _0x29b869[_0xfdd7('0x2e')](_0xfdd7('0x2f'),_0x1f0502+'-'+_0x452f91+'/'+_0xe63080)['json'](_0x4c56ff);}return null;};}function patchUpdates(_0x50566a){return function(_0x588654){try{jsonpatch[_0xfdd7('0x30')](_0x588654,_0x50566a,!![]);}catch(_0x24b440){return BPromise[_0xfdd7('0x31')](_0x24b440);}return _0x588654['save']();};}function saveUpdates(_0x59f97a,_0x18927f){return function(_0x16e3cd){if(_0x16e3cd){return _0x16e3cd[_0xfdd7('0x32')](_0x59f97a)[_0xfdd7('0x1e')](function(_0x4247d9){return _0x4247d9;});}return null;};}function removeEntity(_0x1b7099,_0x1de865){return function(_0x93698a){if(_0x93698a){return _0x93698a[_0xfdd7('0x33')]()['then'](function(){var _0x47b608=_0x93698a[_0xfdd7('0x34')]({'plain':!![]});var _0x413bfa=_0xfdd7('0x35');return db['UserProfileResource'][_0xfdd7('0x33')]({'where':{'type':_0x413bfa,'resourceId':_0x47b608['id']}})['then'](function(){return _0x93698a;});})['then'](function(){_0x1b7099[_0xfdd7('0x28')](0xcc)[_0xfdd7('0x29')]();});}};}function handleEntityNotFound(_0x1aa097,_0x51942b){return function(_0x473518){if(!_0x473518){_0x1aa097['sendStatus'](0x194);}return _0x473518;};}function handleError(_0x501f1a,_0x1c1251){_0x1c1251=_0x1c1251||0x1f4;return function(_0x2e885b){logger[_0xfdd7('0x22')](_0x2e885b[_0xfdd7('0x36')]);if(_0x2e885b[_0xfdd7('0x37')]){delete _0x2e885b[_0xfdd7('0x37')];}_0x501f1a[_0xfdd7('0x28')](_0x1c1251)[_0xfdd7('0x38')](_0x2e885b);};}exports[_0xfdd7('0x39')]=function(_0x57ffd5,_0x40bc36){var _0x142951={'include':[{'model':db[_0xfdd7('0x3a')],'as':_0xfdd7('0x3b')}]},_0x1b5560={},_0x3161fa={'count':0x0,'rows':[]};var _0x4aa04f=_['map'](db[_0xfdd7('0x3c')][_0xfdd7('0x3d')],function(_0x210f78){return{'name':_0x210f78['fieldName'],'type':_0x210f78[_0xfdd7('0x3e')]['key']};});_0x1b5560['model']=_['map'](_0x4aa04f,'name');_0x1b5560[_0xfdd7('0x3f')]=_[_0xfdd7('0x40')](_0x57ffd5['query']);_0x1b5560['filters']=_[_0xfdd7('0x41')](_0x1b5560['model'],_0x1b5560[_0xfdd7('0x3f')]);_0x142951[_0xfdd7('0x42')]=_[_0xfdd7('0x41')](_0x1b5560[_0xfdd7('0x43')],qs[_0xfdd7('0x44')](_0x57ffd5[_0xfdd7('0x3f')]['fields']));_0x142951[_0xfdd7('0x42')]=_0x142951[_0xfdd7('0x42')][_0xfdd7('0x45')]?_0x142951[_0xfdd7('0x42')]:_0x1b5560[_0xfdd7('0x43')];if(!_0x57ffd5[_0xfdd7('0x3f')][_0xfdd7('0x46')](_0xfdd7('0x47'))){_0x142951['limit']=qs['limit'](_0x57ffd5['query'][_0xfdd7('0x2d')]);_0x142951[_0xfdd7('0x48')]=qs[_0xfdd7('0x48')](_0x57ffd5[_0xfdd7('0x3f')][_0xfdd7('0x48')]);}_0x142951[_0xfdd7('0x49')]=qs[_0xfdd7('0x4a')](_0x57ffd5[_0xfdd7('0x3f')][_0xfdd7('0x4a')]);_0x142951['where']=qs[_0xfdd7('0x4b')](_['pick'](_0x57ffd5[_0xfdd7('0x3f')],_0x1b5560[_0xfdd7('0x4b')]),_0x4aa04f);if(_0x57ffd5[_0xfdd7('0x3f')][_0xfdd7('0x4c')]){_0x142951[_0xfdd7('0x4d')]=_[_0xfdd7('0x4e')](_0x142951[_0xfdd7('0x4d')],{'$or':_[_0xfdd7('0x4f')](_0x4aa04f,function(_0x19afb3){if(_0x19afb3[_0xfdd7('0x3e')]!==_0xfdd7('0x50')){var _0x3ff740={};_0x3ff740[_0x19afb3['name']]={'$like':'%'+_0x57ffd5[_0xfdd7('0x3f')][_0xfdd7('0x4c')]+'%'};return _0x3ff740;}})});}_0x142951=_[_0xfdd7('0x4e')]({},_0x142951,_0x57ffd5[_0xfdd7('0x51')]);var _0x252c83={'where':_0x142951[_0xfdd7('0x4d')]};return db['FaxAccount']['count'](_0x252c83)[_0xfdd7('0x1e')](function(_0x4f8d05){_0x3161fa[_0xfdd7('0x2c')]=_0x4f8d05;if(_0x57ffd5[_0xfdd7('0x3f')]['includeAll']){_0x142951['include']=[{'all':!![]}];}return db[_0xfdd7('0x3c')][_0xfdd7('0x52')](_0x142951);})[_0xfdd7('0x1e')](function(_0x9cf50c){_0x3161fa['rows']=_0x9cf50c;return _0x3161fa;})['then'](respondWithFilteredResult(_0x40bc36,_0x142951))['catch'](handleError(_0x40bc36,null));};exports['show']=function(_0x35a48e,_0x2e1063){var _0x2dcfef={'raw':![],'where':{'id':_0x35a48e[_0xfdd7('0x53')]['id']},'include':[{'model':db[_0xfdd7('0x3a')],'as':_0xfdd7('0x3b')}]},_0x311911={};_0x311911[_0xfdd7('0x43')]=_[_0xfdd7('0x40')](db[_0xfdd7('0x3c')][_0xfdd7('0x3d')]);_0x311911[_0xfdd7('0x3f')]=_[_0xfdd7('0x40')](_0x35a48e[_0xfdd7('0x3f')]);_0x311911['filters']=_['intersection'](_0x311911[_0xfdd7('0x43')],_0x311911[_0xfdd7('0x3f')]);_0x2dcfef[_0xfdd7('0x42')]=_['intersection'](_0x311911[_0xfdd7('0x43')],qs[_0xfdd7('0x44')](_0x35a48e['query'][_0xfdd7('0x44')]));_0x2dcfef[_0xfdd7('0x42')]=_0x2dcfef[_0xfdd7('0x42')]['length']?_0x2dcfef['attributes']:_0x311911[_0xfdd7('0x43')];if(_0x35a48e['query'][_0xfdd7('0x54')]){_0x2dcfef['include']=[{'all':!![]}];}_0x2dcfef=_[_0xfdd7('0x4e')]({},_0x2dcfef,_0x35a48e[_0xfdd7('0x51')]);return db[_0xfdd7('0x3c')]['find'](_0x2dcfef)[_0xfdd7('0x1e')](handleEntityNotFound(_0x2e1063,null))['then'](respondWithResult(_0x2e1063,null))[_0xfdd7('0x55')](handleError(_0x2e1063,null));};exports[_0xfdd7('0x56')]=function(_0x5c85b2,_0x59a63b){return db[_0xfdd7('0x3c')][_0xfdd7('0x56')](_0x5c85b2['body'],{})[_0xfdd7('0x1e')](function(_0x4a9439){var _0x422666=_0x5c85b2['user'][_0xfdd7('0x34')]({'plain':!![]});if(!_0x422666)throw new Error(_0xfdd7('0x57'));if(_0x422666[_0xfdd7('0x58')]===_0xfdd7('0x59')){var _0x3dc8ea=_0x4a9439['get']({'plain':!![]});var _0x2021f7=_0xfdd7('0x35');return db[_0xfdd7('0x5a')][_0xfdd7('0x5b')]({'where':{'name':_0x2021f7,'userProfileId':_0x422666['userProfileId']},'raw':!![]})[_0xfdd7('0x1e')](function(_0x2a571f){if(_0x2a571f&&_0x2a571f[_0xfdd7('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x3dc8ea['name'],'resourceId':_0x3dc8ea['id'],'type':_0x2a571f['name'],'sectionId':_0x2a571f['id']},{})['then'](function(){return _0x4a9439;});}else{return _0x4a9439;}})[_0xfdd7('0x55')](function(_0x192f01){logger[_0xfdd7('0x22')](_0xfdd7('0x5d'),_0x192f01);throw _0x192f01;});}return _0x4a9439;})[_0xfdd7('0x1e')](respondWithResult(_0x59a63b,0xc9))[_0xfdd7('0x55')](handleError(_0x59a63b,null));};exports[_0xfdd7('0x32')]=function(_0x1b82ee,_0x58e74d){if(_0x1b82ee[_0xfdd7('0x5e')]['id']){delete _0x1b82ee['body']['id'];}return db[_0xfdd7('0x3c')]['find']({'where':{'id':_0x1b82ee['params']['id']},'include':[{'model':db[_0xfdd7('0x3a')],'as':_0xfdd7('0x3b')}]})['then'](handleEntityNotFound(_0x58e74d,null))[_0xfdd7('0x1e')](saveUpdates(_0x1b82ee[_0xfdd7('0x5e')],null))[_0xfdd7('0x1e')](respondWithResult(_0x58e74d,null))[_0xfdd7('0x55')](handleError(_0x58e74d,null));};exports[_0xfdd7('0x33')]=function(_0x6cd74d,_0x37d703){return db['FaxAccount'][_0xfdd7('0x5b')]({'where':{'id':_0x6cd74d[_0xfdd7('0x53')]['id']}})['then'](handleEntityNotFound(_0x37d703,null))['then'](removeEntity(_0x37d703,null))['catch'](handleError(_0x37d703,null));};exports[_0xfdd7('0x5f')]=function(_0x552bfd,_0x3bd223){return db[_0xfdd7('0x3c')]['describe']()[_0xfdd7('0x1e')](respondWithResult(_0x3bd223,null))[_0xfdd7('0x55')](handleError(_0x3bd223,null));};exports[_0xfdd7('0x60')]=function(_0x246a81,_0x16ce73,_0x30ecf1){if(_0x246a81[_0xfdd7('0x5e')]['id']){delete _0x246a81[_0xfdd7('0x5e')]['id'];}return db[_0xfdd7('0x3c')]['find']({'where':{'id':_0x246a81[_0xfdd7('0x53')]['id']}})[_0xfdd7('0x1e')](handleEntityNotFound(_0x16ce73,null))[_0xfdd7('0x1e')](function(_0x34ab84){if(_0x34ab84){_0x246a81[_0xfdd7('0x5e')][_0xfdd7('0x61')]=_0x34ab84['id'];return db['Disposition'][_0xfdd7('0x56')](_0x246a81['body']);}})[_0xfdd7('0x1e')](respondWithResult(_0x16ce73,null))[_0xfdd7('0x55')](handleError(_0x16ce73,null));};exports[_0xfdd7('0x62')]=function(_0x1c04c,_0x5a9ea8,_0x4b2eea){var _0x4ddffe={'raw':![],'where':{}};var _0x44f97c={};var _0x38a2b4={'count':0x0,'rows':[]};return db[_0xfdd7('0x3c')][_0xfdd7('0x63')]({'where':{'id':_0x1c04c[_0xfdd7('0x53')]['id']}})[_0xfdd7('0x1e')](handleEntityNotFound(_0x5a9ea8,null))[_0xfdd7('0x1e')](function(_0x22d375){if(_0x22d375){_0x44f97c[_0xfdd7('0x43')]=_[_0xfdd7('0x40')](db[_0xfdd7('0x64')][_0xfdd7('0x3d')]);_0x44f97c[_0xfdd7('0x3f')]=_[_0xfdd7('0x40')](_0x1c04c[_0xfdd7('0x3f')]);_0x44f97c[_0xfdd7('0x4b')]=_[_0xfdd7('0x41')](_0x44f97c[_0xfdd7('0x43')],_0x44f97c[_0xfdd7('0x3f')]);_0x4ddffe['attributes']=_[_0xfdd7('0x41')](_0x44f97c[_0xfdd7('0x43')],qs[_0xfdd7('0x44')](_0x1c04c['query'][_0xfdd7('0x44')]));_0x4ddffe[_0xfdd7('0x42')]=_0x4ddffe[_0xfdd7('0x42')][_0xfdd7('0x45')]?_0x4ddffe[_0xfdd7('0x42')]:_0x44f97c[_0xfdd7('0x43')];if(!_0x1c04c[_0xfdd7('0x3f')][_0xfdd7('0x46')](_0xfdd7('0x47'))){_0x4ddffe[_0xfdd7('0x2d')]=qs[_0xfdd7('0x2d')](_0x1c04c[_0xfdd7('0x3f')]['limit']);_0x4ddffe[_0xfdd7('0x48')]=qs[_0xfdd7('0x48')](_0x1c04c[_0xfdd7('0x3f')][_0xfdd7('0x48')]);}_0x4ddffe[_0xfdd7('0x49')]=qs[_0xfdd7('0x4a')](_0x1c04c[_0xfdd7('0x3f')][_0xfdd7('0x4a')]);_0x4ddffe['where']=qs[_0xfdd7('0x4b')](_[_0xfdd7('0x65')](_0x1c04c[_0xfdd7('0x3f')],_0x44f97c[_0xfdd7('0x4b')]));_0x4ddffe[_0xfdd7('0x4d')][_0xfdd7('0x61')]=_0x22d375['id'];if(_0x1c04c[_0xfdd7('0x3f')][_0xfdd7('0x4c')]){_0x4ddffe[_0xfdd7('0x4d')]=_[_0xfdd7('0x4e')](_0x4ddffe['where'],{'$or':_[_0xfdd7('0x4f')](_0x4ddffe[_0xfdd7('0x42')],function(_0x137b54){var _0x56c03a={};_0x56c03a[_0x137b54]={'$like':'%'+_0x1c04c[_0xfdd7('0x3f')][_0xfdd7('0x4c')]+'%'};return _0x56c03a;})});}_0x4ddffe=_[_0xfdd7('0x4e')]({},_0x4ddffe,_0x1c04c['options']);return db[_0xfdd7('0x64')][_0xfdd7('0x2c')]({'where':_0x4ddffe['where']})[_0xfdd7('0x1e')](function(_0x36b14f){_0x38a2b4[_0xfdd7('0x2c')]=_0x36b14f;if(_0x1c04c['query'][_0xfdd7('0x54')]){_0x4ddffe[_0xfdd7('0x66')]=[{'all':!![]}];}return db['Disposition'][_0xfdd7('0x52')](_0x4ddffe);})[_0xfdd7('0x1e')](function(_0x261728){_0x38a2b4[_0xfdd7('0x67')]=_0x261728;return _0x38a2b4;});}})[_0xfdd7('0x1e')](respondWithFilteredResult(_0x5a9ea8,_0x4ddffe))[_0xfdd7('0x55')](handleError(_0x5a9ea8,null));};exports[_0xfdd7('0x68')]=function(_0x114b11,_0x1d73d6,_0x2045f1){return db['FaxAccount']['find']({'where':{'id':_0x114b11[_0xfdd7('0x53')]['id']}})[_0xfdd7('0x1e')](handleEntityNotFound(_0x1d73d6,null))[_0xfdd7('0x1e')](function(_0xa6fdab){if(_0xa6fdab){return _0xa6fdab['removeDispositions'](_0x114b11[_0xfdd7('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x1d73d6,null))[_0xfdd7('0x55')](handleError(_0x1d73d6,null));};exports[_0xfdd7('0x69')]=function(_0xc93153,_0x3b1a34,_0x298805){if(_0xc93153[_0xfdd7('0x5e')]['id']){delete _0xc93153['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0xc93153[_0xfdd7('0x53')]['id']}})[_0xfdd7('0x1e')](handleEntityNotFound(_0x3b1a34,null))[_0xfdd7('0x1e')](function(_0x584742){if(_0x584742){_0xc93153[_0xfdd7('0x5e')]['FaxAccountId']=_0x584742['id'];return db[_0xfdd7('0x6a')][_0xfdd7('0x56')](_0xc93153[_0xfdd7('0x5e')]);}})['then'](respondWithResult(_0x3b1a34,null))[_0xfdd7('0x55')](handleError(_0x3b1a34,null));};exports[_0xfdd7('0x6b')]=function(_0x316739,_0xa5220,_0x204207){var _0x1b0c7f={'raw':![],'where':{}};var _0x5b53b0={};var _0x34c1fa={'count':0x0,'rows':[]};return db[_0xfdd7('0x3c')]['findOne']({'where':{'id':_0x316739['params']['id']}})[_0xfdd7('0x1e')](handleEntityNotFound(_0xa5220,null))[_0xfdd7('0x1e')](function(_0x19348b){if(_0x19348b){_0x5b53b0[_0xfdd7('0x43')]=_[_0xfdd7('0x40')](db[_0xfdd7('0x6a')]['rawAttributes']);_0x5b53b0[_0xfdd7('0x3f')]=_[_0xfdd7('0x40')](_0x316739[_0xfdd7('0x3f')]);_0x5b53b0[_0xfdd7('0x4b')]=_[_0xfdd7('0x41')](_0x5b53b0[_0xfdd7('0x43')],_0x5b53b0[_0xfdd7('0x3f')]);_0x1b0c7f[_0xfdd7('0x42')]=_[_0xfdd7('0x41')](_0x5b53b0[_0xfdd7('0x43')],qs[_0xfdd7('0x44')](_0x316739['query'][_0xfdd7('0x44')]));_0x1b0c7f[_0xfdd7('0x42')]=_0x1b0c7f['attributes'][_0xfdd7('0x45')]?_0x1b0c7f[_0xfdd7('0x42')]:_0x5b53b0['model'];if(!_0x316739['query'][_0xfdd7('0x46')]('nolimit')){_0x1b0c7f[_0xfdd7('0x2d')]=qs['limit'](_0x316739[_0xfdd7('0x3f')]['limit']);_0x1b0c7f[_0xfdd7('0x48')]=qs['offset'](_0x316739[_0xfdd7('0x3f')]['offset']);}_0x1b0c7f[_0xfdd7('0x49')]=qs['sort'](_0x316739['query'][_0xfdd7('0x4a')]);_0x1b0c7f[_0xfdd7('0x4d')]=qs['filters'](_[_0xfdd7('0x65')](_0x316739[_0xfdd7('0x3f')],_0x5b53b0[_0xfdd7('0x4b')]));_0x1b0c7f[_0xfdd7('0x4d')][_0xfdd7('0x61')]=_0x19348b['id'];if(_0x316739[_0xfdd7('0x3f')]['filter']){_0x1b0c7f[_0xfdd7('0x4d')]=_[_0xfdd7('0x4e')](_0x1b0c7f[_0xfdd7('0x4d')],{'$or':_[_0xfdd7('0x4f')](_0x1b0c7f['attributes'],function(_0xa3d2){var _0x3a27e4={};_0x3a27e4[_0xa3d2]={'$like':'%'+_0x316739[_0xfdd7('0x3f')][_0xfdd7('0x4c')]+'%'};return _0x3a27e4;})});}_0x1b0c7f=_[_0xfdd7('0x4e')]({},_0x1b0c7f,_0x316739['options']);return db[_0xfdd7('0x6a')][_0xfdd7('0x2c')]({'where':_0x1b0c7f[_0xfdd7('0x4d')]})['then'](function(_0xc42f52){_0x34c1fa[_0xfdd7('0x2c')]=_0xc42f52;if(_0x316739[_0xfdd7('0x3f')][_0xfdd7('0x54')]){_0x1b0c7f[_0xfdd7('0x66')]=[{'all':!![]}];}return db[_0xfdd7('0x6a')][_0xfdd7('0x52')](_0x1b0c7f);})['then'](function(_0x50e556){_0x34c1fa[_0xfdd7('0x67')]=_0x50e556;return _0x34c1fa;});}})[_0xfdd7('0x1e')](respondWithFilteredResult(_0xa5220,_0x1b0c7f))[_0xfdd7('0x55')](handleError(_0xa5220,null));};exports['removeAnswers']=function(_0x222622,_0x3434ab,_0x1f09f2){return db[_0xfdd7('0x3c')][_0xfdd7('0x5b')]({'where':{'id':_0x222622[_0xfdd7('0x53')]['id']}})[_0xfdd7('0x1e')](handleEntityNotFound(_0x3434ab,null))[_0xfdd7('0x1e')](function(_0x3cd9c5){if(_0x3cd9c5){return _0x3cd9c5[_0xfdd7('0x6c')](_0x222622[_0xfdd7('0x3f')][_0xfdd7('0x6d')]);}})[_0xfdd7('0x1e')](respondWithStatusCode(_0x3434ab,null))[_0xfdd7('0x55')](handleError(_0x3434ab,null));};exports[_0xfdd7('0x6e')]=function(_0x121344,_0x55e62d,_0x4ad3f1){return db[_0xfdd7('0x6f')][_0xfdd7('0x5b')]({'where':{'id':_0x121344[_0xfdd7('0x53')]['id']}})['then'](handleEntityNotFound(_0x55e62d,null))['then'](function(_0x16d110){if(_0x16d110){return _0x16d110[_0xfdd7('0x6e')](_0x121344[_0xfdd7('0x5e')]['ids'],_[_0xfdd7('0x70')](_0x121344[_0xfdd7('0x5e')],[_0xfdd7('0x6d'),'id'])||{});}})[_0xfdd7('0x1e')](respondWithResult(_0x55e62d,null))[_0xfdd7('0x55')](handleError(_0x55e62d,null));};exports['getInteractions']=function(_0x157a12,_0x13e3d5,_0x36c9ea){var _0x15c7fb={'raw':![],'where':{}};var _0x30d3fe={};var _0x50bdd4={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x157a12['params']['id']}})[_0xfdd7('0x1e')](handleEntityNotFound(_0x13e3d5,null))['then'](function(_0x570b2d){if(_0x570b2d){_0x30d3fe['model']=_[_0xfdd7('0x40')](db[_0xfdd7('0x6f')][_0xfdd7('0x3d')]);_0x30d3fe[_0xfdd7('0x3f')]=_[_0xfdd7('0x40')](_0x157a12[_0xfdd7('0x3f')]);_0x30d3fe[_0xfdd7('0x4b')]=_[_0xfdd7('0x41')](_0x30d3fe[_0xfdd7('0x43')],_0x30d3fe[_0xfdd7('0x3f')]);_0x15c7fb[_0xfdd7('0x42')]=_['intersection'](_0x30d3fe['model'],qs[_0xfdd7('0x44')](_0x157a12[_0xfdd7('0x3f')][_0xfdd7('0x44')]));_0x15c7fb[_0xfdd7('0x42')]=_0x15c7fb[_0xfdd7('0x42')]['length']?_0x15c7fb[_0xfdd7('0x42')]:_0x30d3fe[_0xfdd7('0x43')];if(!_0x157a12[_0xfdd7('0x3f')]['hasOwnProperty'](_0xfdd7('0x47'))){_0x15c7fb[_0xfdd7('0x2d')]=qs[_0xfdd7('0x2d')](_0x157a12['query'][_0xfdd7('0x2d')]);_0x15c7fb['offset']=qs['offset'](_0x157a12[_0xfdd7('0x3f')][_0xfdd7('0x48')]);}_0x15c7fb[_0xfdd7('0x49')]=qs[_0xfdd7('0x4a')](_0x157a12[_0xfdd7('0x3f')][_0xfdd7('0x4a')]);_0x15c7fb[_0xfdd7('0x4d')]=qs[_0xfdd7('0x4b')](_['pick'](_0x157a12[_0xfdd7('0x3f')],_0x30d3fe[_0xfdd7('0x4b')]));_0x15c7fb[_0xfdd7('0x4d')]['FaxAccountId']=_0x570b2d['id'];if(_0x157a12[_0xfdd7('0x3f')][_0xfdd7('0x4c')]){_0x15c7fb[_0xfdd7('0x4d')]=_['merge'](_0x15c7fb['where'],{'$or':_[_0xfdd7('0x4f')](_0x15c7fb[_0xfdd7('0x42')],function(_0x53fbc2){var _0x1aff84={};_0x1aff84[_0x53fbc2]={'$like':'%'+_0x157a12[_0xfdd7('0x3f')][_0xfdd7('0x4c')]+'%'};return _0x1aff84;})});}_0x15c7fb=_[_0xfdd7('0x4e')]({},_0x15c7fb,_0x157a12['options']);return db['FaxInteraction']['count']({'where':_0x15c7fb[_0xfdd7('0x4d')]})[_0xfdd7('0x1e')](function(_0x859233){_0x50bdd4[_0xfdd7('0x2c')]=_0x859233;if(_0x157a12[_0xfdd7('0x3f')][_0xfdd7('0x54')]){_0x15c7fb['include']=[{'model':db[_0xfdd7('0x71')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xfdd7('0x72'),'attributes':[_0xfdd7('0x37'),'fullname',_0xfdd7('0x73')],'required':![]},{'model':db[_0xfdd7('0x74')],'as':_0xfdd7('0x75'),'attributes':['id',_0xfdd7('0x37'),'color'],'where':_0x157a12[_0xfdd7('0x3f')][_0xfdd7('0x76')]?{'id':_0x157a12[_0xfdd7('0x3f')]['tag']}:undefined,'required':_0x157a12['query'][_0xfdd7('0x76')]?!![]:![]}];}return db[_0xfdd7('0x6f')][_0xfdd7('0x52')](_0x15c7fb);})['then'](function(_0x567f3a){_0x50bdd4[_0xfdd7('0x67')]=_0x567f3a;return _0x50bdd4;});}})[_0xfdd7('0x1e')](respondWithFilteredResult(_0x13e3d5,_0x15c7fb))[_0xfdd7('0x55')](handleError(_0x13e3d5,null));};exports[_0xfdd7('0x77')]=function(_0x251b8a,_0x1fd615){var _0x1a468b=_0x251b8a[_0xfdd7('0x53')]['id'];var _0x4b6aaf=_0x251b8a[_0xfdd7('0x5e')];var _0x5d5697=0xc8;var _0x1e6640=null;return db[_0xfdd7('0x78')][_0xfdd7('0x79')]({'isolationLevel':db['sequelize'][_0xfdd7('0x7a')][_0xfdd7('0x7b')]['READ_COMMITTED']},function(_0x38ba26){return db['FaxAccount'][_0xfdd7('0x63')]({'where':{'id':_0x1a468b},'transaction':_0x38ba26})[_0xfdd7('0x1e')](function(_0x356f2f){if(_0x356f2f){return db[_0xfdd7('0x7c')][_0xfdd7('0x33')]({'where':{'FaxAccountId':_0x1a468b},'transaction':_0x38ba26})[_0xfdd7('0x1e')](function(){var _0x2df137=_[_0xfdd7('0x4f')](_0x4b6aaf,function(_0x44554d){_0x44554d['FaxAccountId']=_0x1a468b;return _0x44554d;});return db[_0xfdd7('0x7c')][_0xfdd7('0x7d')](_0x2df137,{'transaction':_0x38ba26});});}else{_0x5d5697=0x194;_0x1e6640=[];}});})['then'](function(){if(_0x5d5697!==0x194){return db[_0xfdd7('0x7c')][_0xfdd7('0x7e')]({'where':{'FaxAccountId':_0x1a468b},'order':'priority'})[_0xfdd7('0x1e')](function(_0x2cc80c){_0x1e6640=_0x2cc80c;});}})[_0xfdd7('0x55')](function(_0x52ee38){_0x5d5697=0x1f4;logger[_0xfdd7('0x22')](_0x52ee38[_0xfdd7('0x36')]);if(_0x52ee38['name']){delete _0x52ee38[_0xfdd7('0x37')];}_0x1e6640=_0x52ee38;})[_0xfdd7('0x7f')](function(){if(_0x1e6640===null){_0x1fd615[_0xfdd7('0x27')](_0x5d5697);}else{if(_0x5d5697===0x1f4){_0x1fd615[_0xfdd7('0x28')](_0x5d5697)[_0xfdd7('0x38')](_0x1e6640);}else{_0x1fd615['status'](_0x5d5697)[_0xfdd7('0x2a')](_0x1e6640);}}});};exports['getApplications']=function(_0x48a390,_0x4382d1,_0x2658ec){var _0x3b6ce2={};var _0x22a85b={};var _0x2fc1e6;var _0x3ac57d;return db[_0xfdd7('0x3c')][_0xfdd7('0x63')]({'where':{'id':_0x48a390[_0xfdd7('0x53')]['id']}})['then'](handleEntityNotFound(_0x4382d1,null))[_0xfdd7('0x1e')](function(_0x5c0f09){if(_0x5c0f09){_0x2fc1e6=_0x5c0f09;_0x22a85b[_0xfdd7('0x43')]=_[_0xfdd7('0x40')](db[_0xfdd7('0x7c')][_0xfdd7('0x3d')]);_0x22a85b[_0xfdd7('0x3f')]=_['keys'](_0x48a390['query']);_0x22a85b[_0xfdd7('0x4b')]=_[_0xfdd7('0x41')](_0x22a85b[_0xfdd7('0x43')],_0x22a85b['query']);_0x3b6ce2[_0xfdd7('0x42')]=_[_0xfdd7('0x41')](_0x22a85b[_0xfdd7('0x43')],qs[_0xfdd7('0x44')](_0x48a390[_0xfdd7('0x3f')][_0xfdd7('0x44')]));_0x3b6ce2[_0xfdd7('0x42')]=_0x3b6ce2[_0xfdd7('0x42')]['length']?_0x3b6ce2[_0xfdd7('0x42')]:_0x22a85b[_0xfdd7('0x43')];_0x3b6ce2[_0xfdd7('0x49')]=qs[_0xfdd7('0x4a')](_0x48a390[_0xfdd7('0x3f')][_0xfdd7('0x4a')]);_0x3b6ce2['where']=qs[_0xfdd7('0x4b')](_[_0xfdd7('0x65')](_0x48a390[_0xfdd7('0x3f')],_0x22a85b[_0xfdd7('0x4b')]));if(_0x48a390[_0xfdd7('0x3f')][_0xfdd7('0x4c')]){_0x3b6ce2[_0xfdd7('0x4d')]=_[_0xfdd7('0x4e')](_0x3b6ce2[_0xfdd7('0x4d')],{'$or':_['map'](_0x3b6ce2[_0xfdd7('0x42')],function(_0x312e54){var _0x52c71f={};_0x52c71f[_0x312e54]={'$like':'%'+_0x48a390['query'][_0xfdd7('0x4c')]+'%'};return _0x52c71f;})});}_0x3b6ce2=_['merge']({},_0x3b6ce2,_0x48a390[_0xfdd7('0x51')]);return _0x2fc1e6[_0xfdd7('0x80')](_0x3b6ce2);}})[_0xfdd7('0x1e')](function(_0x130a31){if(_0x130a31){_0x3ac57d=_0x130a31['length'];if(!_0x48a390[_0xfdd7('0x3f')][_0xfdd7('0x46')](_0xfdd7('0x47'))){_0x3b6ce2['limit']=qs[_0xfdd7('0x2d')](_0x48a390[_0xfdd7('0x3f')]['limit']);_0x3b6ce2[_0xfdd7('0x48')]=qs['offset'](_0x48a390['query']['offset']);}return _0x2fc1e6['getApplications'](_0x3b6ce2);}})[_0xfdd7('0x1e')](function(_0x2f9478){if(_0x2f9478){return _0x2f9478?{'count':_0x3ac57d,'rows':_0x2f9478}:null;}})[_0xfdd7('0x1e')](respondWithResult(_0x4382d1,null))[_0xfdd7('0x55')](handleError(_0x4382d1,null));};function Extension(_0x52d3b4,_0x2a94fa,_0x596b8e,_0xb995eb){this[_0xfdd7('0x81')]='from-voip-provider';this['exten']=_0x52d3b4['localstationid'];this['app']=_0xb995eb;this[_0xfdd7('0x3e')]=_0xfdd7('0x82');this['description']='Fax\x20Extension';this[_0xfdd7('0x61')]=_0x52d3b4['id'];this[_0xfdd7('0x83')]=_0x2a94fa;this['appdata']=_0x596b8e;}function createExtensionsReciveFax(_0x164de0){var _0x3e832e=0x1;var _0x29b890=[];_0x29b890['push'](new Extension(_0x164de0,_0x3e832e,'',_0xfdd7('0x84')));_0x3e832e+=0x1;_0x29b890[_0xfdd7('0x85')](new Extension(_0x164de0,_0x3e832e,_0xfdd7('0x86'),_0xfdd7('0x87')));_0x3e832e+=0x1;for(var _0x5c02ee in _0x164de0){if(_0x164de0['hasOwnProperty'](_0x5c02ee)&&(_0x5c02ee===_0xfdd7('0x88')||_0x5c02ee===_0xfdd7('0x89')||_0x5c02ee==='gateway'||_0x5c02ee===_0xfdd7('0x8a')||_0x5c02ee==='headerinfo'||_0x5c02ee===_0xfdd7('0x8b')||_0x5c02ee===_0xfdd7('0x8c')||_0x5c02ee===_0xfdd7('0x8d')||_0x5c02ee===_0xfdd7('0x8e'))){_0x29b890[_0xfdd7('0x85')](new Extension(_0x164de0,_0x3e832e,'FAXOPT('+_0x5c02ee+')='+_0x164de0[_0x5c02ee],'Set'));_0x3e832e+=0x1;}}_0x29b890['push'](new Extension(_0x164de0,_0x3e832e,'6','Wait'));_0x3e832e+=0x1;_0x29b890[_0xfdd7('0x85')](new Extension(_0x164de0,_0x3e832e,_0xfdd7('0x8f'),'ReceiveFax'));_0x3e832e=0x0;return _0x29b890;}exports[_0xfdd7('0x90')]=function(_0xa1e683,_0x1c7ad7,_0x570162){var _0x4423ad;return db['sequelize'][_0xfdd7('0x79')](function(_0x83f9b6){return db[_0xfdd7('0x3c')][_0xfdd7('0x56')](_0xa1e683['body'],{'transaction':_0x83f9b6})[_0xfdd7('0x1e')](function(_0x1800dc){_0x4423ad=_0x1800dc['get']({'plain':!![]});return db[_0xfdd7('0x91')][_0xfdd7('0x7d')](createExtensionsReciveFax(_0x4423ad),{'transaction':_0x83f9b6});});})[_0xfdd7('0x1e')](function(){return _0x4423ad;})[_0xfdd7('0x1e')](respondWithResult(_0x1c7ad7,null))[_0xfdd7('0x55')](handleError(_0x1c7ad7,null));};exports[_0xfdd7('0x92')]=function(_0x2d62d5,_0x1c15ca,_0x5ff1a6){var _0xc5ad17;return db[_0xfdd7('0x78')][_0xfdd7('0x79')](function(_0x418222){return db[_0xfdd7('0x3c')][_0xfdd7('0x32')](_0x2d62d5[_0xfdd7('0x5e')],{'where':{'id':_0x2d62d5['body']['id']},'transaction':_0x418222})[_0xfdd7('0x1e')](function(_0x285269){return db[_0xfdd7('0x91')][_0xfdd7('0x33')]({'where':{'FaxAccountId':_0x2d62d5[_0xfdd7('0x5e')]['id']},'transaction':_0x418222})[_0xfdd7('0x1e')](function(_0x515a73){return db[_0xfdd7('0x91')][_0xfdd7('0x7d')](createExtensionsReciveFax(_['omit'](_0x2d62d5[_0xfdd7('0x5e')],[_0xfdd7('0x93'),_0xfdd7('0x94'),_0xfdd7('0x95'),_0xfdd7('0x96'),_0xfdd7('0x97'),_0xfdd7('0x98')])),{'transaction':_0x418222});});});})['then'](function(){return db[_0xfdd7('0x3c')][_0xfdd7('0x99')](_0x2d62d5[_0xfdd7('0x5e')]['id']);})[_0xfdd7('0x1e')](respondWithResult(_0x1c15ca,null))[_0xfdd7('0x55')](handleError(_0x1c15ca,null));};exports[_0xfdd7('0x9a')]=function(_0xa1a110,_0x12844e,_0x5f94e6){var _0xe636d3={'raw':!![],'where':{}};var _0x5015e3={};var _0x5c07c2={'count':0x0,'rows':[]};return db[_0xfdd7('0x3c')][_0xfdd7('0x63')]({'where':{'id':_0xa1a110[_0xfdd7('0x53')]['id']}})[_0xfdd7('0x1e')](handleEntityNotFound(_0x12844e,null))['then'](function(_0x4faa24){if(_0x4faa24){_0x5015e3[_0xfdd7('0x43')]=_[_0xfdd7('0x40')](db['FaxMessage'][_0xfdd7('0x3d')]);_0x5015e3['query']=_[_0xfdd7('0x40')](_0xa1a110['query']);_0x5015e3[_0xfdd7('0x4b')]=_['intersection'](_0x5015e3[_0xfdd7('0x43')],_0x5015e3[_0xfdd7('0x3f')]);_0xe636d3[_0xfdd7('0x42')]=_['intersection'](_0x5015e3[_0xfdd7('0x43')],qs['fields'](_0xa1a110[_0xfdd7('0x3f')]['fields']));_0xe636d3[_0xfdd7('0x42')]=_0xe636d3[_0xfdd7('0x42')][_0xfdd7('0x45')]?_0xe636d3[_0xfdd7('0x42')]:_0x5015e3[_0xfdd7('0x43')];if(!_0xa1a110['query'][_0xfdd7('0x46')](_0xfdd7('0x47'))){_0xe636d3[_0xfdd7('0x2d')]=qs['limit'](_0xa1a110['query'][_0xfdd7('0x2d')]);_0xe636d3[_0xfdd7('0x48')]=qs[_0xfdd7('0x48')](_0xa1a110[_0xfdd7('0x3f')]['offset']);}_0xe636d3[_0xfdd7('0x49')]=qs['sort'](_0xa1a110[_0xfdd7('0x3f')][_0xfdd7('0x4a')]);_0xe636d3['where']=qs[_0xfdd7('0x4b')](_['pick'](_0xa1a110['query'],_0x5015e3[_0xfdd7('0x4b')]));_0xe636d3[_0xfdd7('0x4d')]['FaxAccountId']=_0x4faa24['id'];if(_0xa1a110[_0xfdd7('0x3f')][_0xfdd7('0x4c')]){_0xe636d3[_0xfdd7('0x4d')]=_['merge'](_0xe636d3[_0xfdd7('0x4d')],{'$or':_[_0xfdd7('0x4f')](_0xe636d3['attributes'],function(_0x4046d0){var _0x5d0cd4={};_0x5d0cd4[_0x4046d0]={'$like':'%'+_0xa1a110[_0xfdd7('0x3f')][_0xfdd7('0x4c')]+'%'};return _0x5d0cd4;})});}if(_0xa1a110[_0xfdd7('0x3f')][_0xfdd7('0x9b')]){var _0xb037d7=_0xa1a110[_0xfdd7('0x3f')][_0xfdd7('0x9b')][_0xfdd7('0x9c')](',');var _0x354d51={};_0x354d51[_0xb037d7[0x0]]={'$gte':moment(_0xb037d7[0x1])[_0xfdd7('0x9d')](_0xfdd7('0x9e'))};_0xe636d3[_0xfdd7('0x4d')]=_[_0xfdd7('0x4e')](_0xe636d3[_0xfdd7('0x4d')],_0x354d51);}_0xe636d3=_[_0xfdd7('0x4e')]({},_0xe636d3,_0xa1a110[_0xfdd7('0x51')]);return db[_0xfdd7('0x9f')][_0xfdd7('0x2c')]({'where':_0xe636d3[_0xfdd7('0x4d')]})[_0xfdd7('0x1e')](function(_0xa10dde){_0x5c07c2[_0xfdd7('0x2c')]=_0xa10dde;if(_0xa1a110[_0xfdd7('0x3f')][_0xfdd7('0x54')]){_0xe636d3[_0xfdd7('0x66')]=[{'all':!![]}];}return db[_0xfdd7('0x9f')][_0xfdd7('0x52')](_0xe636d3);})[_0xfdd7('0x1e')](function(_0x103e1f){_0x5c07c2['rows']=_0x103e1f;return _0x5c07c2;});}})[_0xfdd7('0x1e')](respondWithFilteredResult(_0x12844e,_0xe636d3))['catch'](handleError(_0x12844e,null));};exports['send']=function(_0x217cb5,_0x37222e,_0x47bdb8){var _0x5d80f4,_0x52d615={},_0x104c55;if(_0x217cb5[_0xfdd7('0x5e')]['to']){_0x104c55=_0x217cb5[_0xfdd7('0x5e')]['to'][0x0];}return db[_0xfdd7('0x3c')]['find']({'where':{'id':_0x217cb5[_0xfdd7('0x53')]['id']},'include':[{'model':db[_0xfdd7('0xa0')],'as':_0xfdd7('0xa1'),'include':[{'model':db[_0xfdd7('0x71')],'as':_0xfdd7('0xa2'),'where':{'fax':_0x104c55},'limit':0x1,'order':[[_0xfdd7('0x96'),_0xfdd7('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x37222e,null))[_0xfdd7('0x1e')](function(_0x56c19b){_0x5d80f4=_0x56c19b;if(_0x217cb5['body'][_0xfdd7('0xa4')]&&_0x217cb5[_0xfdd7('0x5e')]['attachments'][_0xfdd7('0x45')]){for(var _0x295501=0x0;_0x295501<_0x217cb5['body']['attachments'][_0xfdd7('0x45')];_0x295501+=0x1){_0x217cb5[_0xfdd7('0x5e')][_0xfdd7('0xa4')][_0x295501]={'filename':_0x217cb5[_0xfdd7('0x5e')][_0xfdd7('0xa4')][_0x295501][_0xfdd7('0x37')],'id':_0x217cb5[_0xfdd7('0x5e')]['attachments'][_0x295501]['id'],'path':path['join'](config['root'],_0xfdd7('0xa5'),_0x217cb5[_0xfdd7('0x5e')][_0xfdd7('0xa4')][_0x295501][_0xfdd7('0xa6')])};}}return respondWithRpcPromise(_0xfdd7('0xa7'),'CheckAfterSend',{'FaxAccountId':_[_0xfdd7('0xa8')](_0x217cb5['params']['id'])?undefined:_0x217cb5[_0xfdd7('0x53')]['id'],'path':_[_0xfdd7('0xa8')](_0x217cb5[_0xfdd7('0x5e')][_0xfdd7('0xa4')][0x0][_0xfdd7('0x5')])?undefined:_0x217cb5[_0xfdd7('0x5e')][_0xfdd7('0xa4')][0x0][_0xfdd7('0x5')],'fax':_['isNil'](_0x217cb5[_0xfdd7('0x5e')]['to'][0x0])?undefined:_0x217cb5['body']['to'][0x0]},client9002);})[_0xfdd7('0x1e')](function(){if(_0x5d80f4){if(_['isNil'](_0x217cb5[_0xfdd7('0x5e')]['from'])){_0x217cb5['body'][_0xfdd7('0xa9')]=util[_0xfdd7('0x9d')](_0xfdd7('0xaa'),_0x5d80f4[_0xfdd7('0x37')],_0x5d80f4[_0xfdd7('0xab')]);}if(_0x5d80f4['List']){if(_0x5d80f4['List'][_0xfdd7('0xa2')][_0xfdd7('0x45')]){return _0x5d80f4[_0xfdd7('0xa1')]['Contacts'][0x0];}else{return db[_0xfdd7('0x71')]['create'](_[_0xfdd7('0x16')](_0x217cb5[_0xfdd7('0x5e')],{'firstName':_0x217cb5[_0xfdd7('0x5e')]['to'][0x0],'phone':_0x217cb5[_0xfdd7('0x5e')]['to'][0x0],'fax':_0x217cb5[_0xfdd7('0x5e')]['to'][0x0],'ListId':_0x5d80f4[_0xfdd7('0x98')]}));}}else{throw new Error(_0xfdd7('0xac'));}}else{throw new Error(_0xfdd7('0xad'));}})[_0xfdd7('0x1e')](function(_0x470628){if(_0x470628){return db[_0xfdd7('0x6f')][_0xfdd7('0x5b')]({'where':{'ContactId':_0x470628['id'],'closed':![],'FaxAccountId':_0x5d80f4['id']}})[_0xfdd7('0x1e')](function(_0x2b5ddb){if(_0x2b5ddb){return[_0x2b5ddb,![]];}return db['FaxInteraction'][_0xfdd7('0x56')]({'UserId':_0x217cb5[_0xfdd7('0x59')]['id'],'ContactId':_0x470628['id'],'FaxAccountId':_0x5d80f4['id'],'fax':_0x217cb5[_0xfdd7('0x5e')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xfdd7('0x4e')](_0x217cb5[_0xfdd7('0x5e')],{'read':![],'body':_0x217cb5[_0xfdd7('0x5e')][_0xfdd7('0xa4')][0x0][_0xfdd7('0xae')],'FaxAccountId':_0x5d80f4['id'],'UserId':_0x217cb5['user']['id'],'ContactId':_0x470628['id'],'AttachmentId':_0x217cb5['body'][_0xfdd7('0xa4')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xfdd7('0xaf')}]})[_0xfdd7('0x1e')](function(_0x1ad2c6){return[_0x1ad2c6,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xfdd7('0xb0')](function(_0x2bb759,_0x682a){if(_0x682a){return _0x2bb759;}return db[_0xfdd7('0x9f')][_0xfdd7('0x56')]({'direction':_0xfdd7('0xb1'),'read':![],'body':_0x217cb5['body'][_0xfdd7('0xa4')][0x0][_0xfdd7('0xae')],'FaxAccountId':_0x5d80f4['id'],'FaxInteractionId':_0x2bb759['id'],'UserId':_0x217cb5[_0xfdd7('0x59')]['id'],'ContactId':_0x2bb759[_0xfdd7('0xb2')],'AttachmentId':_0x217cb5[_0xfdd7('0x5e')][_0xfdd7('0xa4')][0x0]['id']})[_0xfdd7('0x1e')](function(_0x1c58aa){_0x2bb759[_0xfdd7('0xb3')][_0xfdd7('0xaf')]=[];_0x2bb759[_0xfdd7('0xb3')]['Messages'][_0xfdd7('0x85')](_0x1c58aa[_0xfdd7('0xb3')]);return _0x2bb759;});})[_0xfdd7('0x1e')](function(_0x1752c5){respondWithRpcPromise(_0xfdd7('0xb4'),'SendFax',{'FaxAccountId':_['isNil'](_0x217cb5[_0xfdd7('0x53')]['id'])?undefined:_0x217cb5[_0xfdd7('0x53')]['id'],'path':_['isNil'](_0x217cb5[_0xfdd7('0x5e')][_0xfdd7('0xa4')][0x0]['path'])?undefined:_0x217cb5[_0xfdd7('0x5e')]['attachments'][0x0][_0xfdd7('0x5')],'fax':_['isNil'](_0x217cb5[_0xfdd7('0x5e')]['to'][0x0])?undefined:_0x217cb5[_0xfdd7('0x5e')]['to'][0x0],'AttachmentId':_0x217cb5[_0xfdd7('0x5e')][_0xfdd7('0xa4')][0x0]['id']},client9002)[_0xfdd7('0x1e')](function(_0xfafb62){logger[_0xfdd7('0x1f')](_0xfdd7('0xb5'),_0xfafb62);})[_0xfdd7('0x55')](function(_0x60c2e4){logger[_0xfdd7('0x1f')]('SendFaxRpc,\x20%s',_0x60c2e4);});return _0x1752c5;})[_0xfdd7('0x1e')](respondWithResult(_0x37222e,null))[_0xfdd7('0x55')](handleError(_0x37222e,null));};exports[_0xfdd7('0xb6')]=function(_0x40360c,_0x3e465f,_0x21ffeb){return db[_0xfdd7('0x3c')][_0xfdd7('0x5b')]({'where':{'id':_0x40360c[_0xfdd7('0x53')]['id']}})['then'](handleEntityNotFound(_0x3e465f,null))[_0xfdd7('0x1e')](function(_0x542900){if(_0x542900){return _0x542900[_0xfdd7('0xb6')](_0x40360c['body'][_0xfdd7('0x6d')],_[_0xfdd7('0x70')](_0x40360c[_0xfdd7('0x5e')],['ids','id'])||{})['spread'](function(_0x2774a4){for(var _0x47dc52=0x0;_0x47dc52<_0x40360c[_0xfdd7('0x5e')][_0xfdd7('0x6d')][_0xfdd7('0x45')];_0x47dc52+=0x1){socket[_0xfdd7('0xb7')](_0xfdd7('0xb8'),{'UserId':Number(_0x40360c['body'][_0xfdd7('0x6d')][_0x47dc52]),'FaxAccountId':Number(_0x40360c[_0xfdd7('0x53')]['id'])});}return _0x2774a4;});}})[_0xfdd7('0x1e')](respondWithResult(_0x3e465f,null))[_0xfdd7('0x55')](handleError(_0x3e465f,null));};exports['removeAgents']=function(_0xf5c1e0,_0x5183c,_0x35083b){return db['FaxAccount']['find']({'where':{'id':_0xf5c1e0[_0xfdd7('0x53')]['id']}})[_0xfdd7('0x1e')](handleEntityNotFound(_0x5183c,null))['then'](function(_0x486862){if(_0x486862){return _0x486862[_0xfdd7('0xb9')](_0xf5c1e0[_0xfdd7('0x3f')]['ids'])[_0xfdd7('0x1e')](function(){if(_[_0xfdd7('0xba')](_0xf5c1e0['query'][_0xfdd7('0x6d')])){for(var _0x221a4e=0x0;_0x221a4e<_0xf5c1e0[_0xfdd7('0x3f')][_0xfdd7('0x6d')][_0xfdd7('0x45')];_0x221a4e+=0x1){socket[_0xfdd7('0xb7')](_0xfdd7('0xbb'),{'UserId':Number(_0xf5c1e0['query'][_0xfdd7('0x6d')][_0x221a4e]),'FaxAccountId':Number(_0xf5c1e0['params']['id'])});}}else{socket['emit'](_0xfdd7('0xbb'),{'UserId':Number(_0xf5c1e0[_0xfdd7('0x3f')][_0xfdd7('0x6d')]),'FaxAccountId':Number(_0xf5c1e0[_0xfdd7('0x53')]['id'])});}});}})[_0xfdd7('0x1e')](respondWithStatusCode(_0x5183c,null))[_0xfdd7('0x55')](handleError(_0x5183c,null));};exports[_0xfdd7('0xbc')]=function(_0x347941,_0x13091e,_0x188f4d){var _0x5bd320={};var _0x2fe932={};var _0x5e0d70;var _0x5bd8bc;return db[_0xfdd7('0x3c')]['findOne']({'where':{'id':_0x347941['params']['id']}})[_0xfdd7('0x1e')](handleEntityNotFound(_0x13091e,null))['then'](function(_0x5d287f){if(_0x5d287f){_0x5e0d70=_0x5d287f;_0x2fe932[_0xfdd7('0x43')]=_[_0xfdd7('0x40')](db[_0xfdd7('0xbd')][_0xfdd7('0x3d')]);_0x2fe932[_0xfdd7('0x3f')]=_[_0xfdd7('0x40')](_0x347941[_0xfdd7('0x3f')]);_0x2fe932['filters']=_[_0xfdd7('0x41')](_0x2fe932[_0xfdd7('0x43')],_0x2fe932[_0xfdd7('0x3f')]);_0x5bd320[_0xfdd7('0x42')]=_[_0xfdd7('0x41')](_0x2fe932[_0xfdd7('0x43')],qs[_0xfdd7('0x44')](_0x347941[_0xfdd7('0x3f')]['fields']));_0x5bd320[_0xfdd7('0x42')]=_0x5bd320[_0xfdd7('0x42')][_0xfdd7('0x45')]?_0x5bd320['attributes']:_0x2fe932[_0xfdd7('0x43')];_0x5bd320[_0xfdd7('0x49')]=qs[_0xfdd7('0x4a')](_0x347941[_0xfdd7('0x3f')][_0xfdd7('0x4a')]);_0x5bd320[_0xfdd7('0x4d')]=qs[_0xfdd7('0x4b')](_[_0xfdd7('0x65')](_0x347941['query'],_0x2fe932[_0xfdd7('0x4b')]));if(_0x347941[_0xfdd7('0x3f')]['filter']){_0x5bd320['where']=_[_0xfdd7('0x4e')](_0x5bd320[_0xfdd7('0x4d')],{'$or':_[_0xfdd7('0x4f')](_0x5bd320['attributes'],function(_0xc0c7af){var _0x4bf97f={};_0x4bf97f[_0xc0c7af]={'$like':'%'+_0x347941[_0xfdd7('0x3f')][_0xfdd7('0x4c')]+'%'};return _0x4bf97f;})});}_0x5bd320=_[_0xfdd7('0x4e')]({},_0x5bd320,_0x347941['options']);return _0x5e0d70[_0xfdd7('0xbc')](_0x5bd320);}})[_0xfdd7('0x1e')](function(_0x484169){if(_0x484169){_0x5bd8bc=_0x484169[_0xfdd7('0x45')];if(!_0x347941[_0xfdd7('0x3f')][_0xfdd7('0x46')](_0xfdd7('0x47'))){_0x5bd320[_0xfdd7('0x2d')]=qs[_0xfdd7('0x2d')](_0x347941['query'][_0xfdd7('0x2d')]);_0x5bd320[_0xfdd7('0x48')]=qs[_0xfdd7('0x48')](_0x347941['query']['offset']);}return _0x5e0d70[_0xfdd7('0xbc')](_0x5bd320);}})[_0xfdd7('0x1e')](function(_0x203e17){if(_0x203e17){return _0x203e17?{'count':_0x5bd8bc,'rows':_0x203e17}:null;}})[_0xfdd7('0x1e')](respondWithResult(_0x13091e,null))[_0xfdd7('0x55')](handleError(_0x13091e,null));}; \ No newline at end of file +var _0xc471=['role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','filter','includeAll','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','localstationid','app','system','description','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','transaction','get','VoiceExtension','updateAccountApplications','update','omit','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','format','CmList','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','client','http','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','destroy','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','options','findAll','rows','catch','show','params','length','include','find','create','user'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xc471,0x132));var _0x1c47=function(_0x3dace2,_0x23bb97){_0x3dace2=_0x3dace2-0x0;var _0x3fa122=_0xc471[_0x3dace2];return _0x3fa122;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c47('0x0'));var zipdir=require(_0x1c47('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1c47('0x2'));var BPromise=require(_0x1c47('0x3'));var Mustache=require(_0x1c47('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1c47('0x5'));var csv=require(_0x1c47('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c47('0x7'));var _=require(_0x1c47('0x8'));var squel=require(_0x1c47('0x9'));var crypto=require(_0x1c47('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1c47('0xb'));var Papa=require(_0x1c47('0xc'));var Redis=require(_0x1c47('0xd'));var authService=require(_0x1c47('0xe'));var qs=require(_0x1c47('0xf'));var as=require(_0x1c47('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c47('0x11'))('api');var utils=require(_0x1c47('0x12'));var config=require(_0x1c47('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c47('0x14'))['db'];config[_0x1c47('0x15')]=_[_0x1c47('0x16')](config['redis'],{'host':_0x1c47('0x17'),'port':0x18eb});var socket=require(_0x1c47('0x18'))(new Redis(config[_0x1c47('0x15')]));require(_0x1c47('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x1c47('0x1a')][_0x1c47('0x1b')]({'port':0x232c});var client9002=jayson[_0x1c47('0x1a')][_0x1c47('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x982a3d,_0x32fd46,_0x38920a,_0x301356){return new BPromise(function(_0x5e47a4,_0x34ff0b){var _0x4daca8=_0x301356||client;return _0x4daca8['request'](_0x982a3d,_0x38920a)[_0x1c47('0x1c')](function(_0xb0f870){logger[_0x1c47('0x1d')](_0x1c47('0x1e'),_0x32fd46,'request\x20sent');logger[_0x1c47('0x1f')](_0x1c47('0x20'),_0x32fd46,_0x1c47('0x21'),JSON[_0x1c47('0x22')](_0xb0f870));if(_0xb0f870[_0x1c47('0x23')]){if(_0xb0f870[_0x1c47('0x23')][_0x1c47('0x24')]===0x1f4){logger[_0x1c47('0x23')](_0x1c47('0x1e'),_0x32fd46,_0xb0f870[_0x1c47('0x23')][_0x1c47('0x25')]);return _0x34ff0b(_0xb0f870[_0x1c47('0x23')][_0x1c47('0x25')]);}logger[_0x1c47('0x23')](_0x1c47('0x1e'),_0x32fd46,_0xb0f870[_0x1c47('0x23')][_0x1c47('0x25')]);return _0x5e47a4(_0xb0f870[_0x1c47('0x23')][_0x1c47('0x25')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x32fd46,_0x1c47('0x21'));_0x5e47a4(_0xb0f870[_0x1c47('0x26')][_0x1c47('0x25')]);}})['catch'](function(_0x304300){logger[_0x1c47('0x23')]('FaxAccount,\x20%s,\x20%s',_0x32fd46,_0x304300);_0x34ff0b(_0x304300);});});}function respondWithStatusCode(_0x3899d4,_0x242819){_0x242819=_0x242819||0xcc;return function(_0x577fed){if(_0x577fed){return _0x3899d4[_0x1c47('0x27')](_0x242819);}return _0x3899d4[_0x1c47('0x28')](_0x242819)['end']();};}function respondWithResult(_0x3f79dd,_0x640d06){_0x640d06=_0x640d06||0xc8;return function(_0x1071b0){if(_0x1071b0){return _0x3f79dd[_0x1c47('0x28')](_0x640d06)[_0x1c47('0x29')](_0x1071b0);}};}function respondWithFilteredResult(_0x4e62f5,_0x4a741d){return function(_0x4260b8){if(_0x4260b8){var _0x5d8563=typeof _0x4a741d['offset']===_0x1c47('0x2a')&&typeof _0x4a741d['limit']==='undefined';var _0x260f00=_0x4260b8[_0x1c47('0x2b')];var _0x3d21c8=_0x5d8563?0x0:_0x4a741d['offset'];var _0x81b1d0=_0x5d8563?_0x4260b8[_0x1c47('0x2b')]:_0x4a741d[_0x1c47('0x2c')]+_0x4a741d[_0x1c47('0x2d')];var _0x130b8a;if(_0x81b1d0>=_0x260f00){_0x81b1d0=_0x260f00;_0x130b8a=0xc8;}else{_0x130b8a=0xce;}_0x4e62f5['status'](_0x130b8a);return _0x4e62f5[_0x1c47('0x2e')](_0x1c47('0x2f'),_0x3d21c8+'-'+_0x81b1d0+'/'+_0x260f00)[_0x1c47('0x29')](_0x4260b8);}return null;};}function patchUpdates(_0x1484ce){return function(_0x2a0ad5){try{jsonpatch[_0x1c47('0x30')](_0x2a0ad5,_0x1484ce,!![]);}catch(_0x309530){return BPromise['reject'](_0x309530);}return _0x2a0ad5[_0x1c47('0x31')]();};}function saveUpdates(_0x3a0b79,_0x463669){return function(_0x25b2c6){if(_0x25b2c6){return _0x25b2c6['update'](_0x3a0b79)['then'](function(_0x47b2ea){return _0x47b2ea;});}return null;};}function removeEntity(_0x53d374,_0x2c85bc){return function(_0x386875){if(_0x386875){return _0x386875[_0x1c47('0x32')]()['then'](function(){var _0x109661=_0x386875['get']({'plain':!![]});var _0x397f54='FaxAccounts';return db[_0x1c47('0x33')][_0x1c47('0x32')]({'where':{'type':_0x397f54,'resourceId':_0x109661['id']}})[_0x1c47('0x1c')](function(){return _0x386875;});})['then'](function(){_0x53d374[_0x1c47('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ecbec,_0x71fb3b){return function(_0x3d3481){if(!_0x3d3481){_0x2ecbec[_0x1c47('0x27')](0x194);}return _0x3d3481;};}function handleError(_0x357be3,_0x3cf3c3){_0x3cf3c3=_0x3cf3c3||0x1f4;return function(_0xde1cc3){logger[_0x1c47('0x23')](_0xde1cc3[_0x1c47('0x34')]);if(_0xde1cc3[_0x1c47('0x35')]){delete _0xde1cc3[_0x1c47('0x35')];}_0x357be3[_0x1c47('0x28')](_0x3cf3c3)[_0x1c47('0x36')](_0xde1cc3);};}exports['index']=function(_0x224919,_0xa0d53){var _0x22c4f6={'include':[{'model':db[_0x1c47('0x37')],'as':_0x1c47('0x38')}]},_0xd276ce={},_0x10bbaf={'count':0x0,'rows':[]};var _0x3f5453=_['map'](db[_0x1c47('0x39')][_0x1c47('0x3a')],function(_0x3e60c9){return{'name':_0x3e60c9['fieldName'],'type':_0x3e60c9[_0x1c47('0x3b')][_0x1c47('0x3c')]};});_0xd276ce[_0x1c47('0x3d')]=_['map'](_0x3f5453,_0x1c47('0x35'));_0xd276ce[_0x1c47('0x3e')]=_[_0x1c47('0x3f')](_0x224919[_0x1c47('0x3e')]);_0xd276ce[_0x1c47('0x40')]=_[_0x1c47('0x41')](_0xd276ce[_0x1c47('0x3d')],_0xd276ce[_0x1c47('0x3e')]);_0x22c4f6['attributes']=_[_0x1c47('0x41')](_0xd276ce['model'],qs[_0x1c47('0x42')](_0x224919[_0x1c47('0x3e')][_0x1c47('0x42')]));_0x22c4f6[_0x1c47('0x43')]=_0x22c4f6['attributes']['length']?_0x22c4f6['attributes']:_0xd276ce[_0x1c47('0x3d')];if(!_0x224919[_0x1c47('0x3e')][_0x1c47('0x44')](_0x1c47('0x45'))){_0x22c4f6[_0x1c47('0x2d')]=qs[_0x1c47('0x2d')](_0x224919[_0x1c47('0x3e')][_0x1c47('0x2d')]);_0x22c4f6[_0x1c47('0x2c')]=qs[_0x1c47('0x2c')](_0x224919[_0x1c47('0x3e')][_0x1c47('0x2c')]);}_0x22c4f6[_0x1c47('0x46')]=qs[_0x1c47('0x47')](_0x224919[_0x1c47('0x3e')][_0x1c47('0x47')]);_0x22c4f6[_0x1c47('0x48')]=qs['filters'](_[_0x1c47('0x49')](_0x224919[_0x1c47('0x3e')],_0xd276ce[_0x1c47('0x40')]),_0x3f5453);if(_0x224919['query']['filter']){_0x22c4f6[_0x1c47('0x48')]=_[_0x1c47('0x4a')](_0x22c4f6[_0x1c47('0x48')],{'$or':_[_0x1c47('0x4b')](_0x3f5453,function(_0x187e30){if(_0x187e30[_0x1c47('0x3b')]!==_0x1c47('0x4c')){var _0x28b1a1={};_0x28b1a1[_0x187e30['name']]={'$like':'%'+_0x224919[_0x1c47('0x3e')]['filter']+'%'};return _0x28b1a1;}})});}_0x22c4f6=_[_0x1c47('0x4a')]({},_0x22c4f6,_0x224919[_0x1c47('0x4d')]);var _0x1fa61b={'where':_0x22c4f6[_0x1c47('0x48')]};return db[_0x1c47('0x39')][_0x1c47('0x2b')](_0x1fa61b)['then'](function(_0x79b56d){_0x10bbaf[_0x1c47('0x2b')]=_0x79b56d;if(_0x224919['query']['includeAll']){_0x22c4f6['include']=[{'all':!![]}];}return db[_0x1c47('0x39')][_0x1c47('0x4e')](_0x22c4f6);})[_0x1c47('0x1c')](function(_0x3f05e4){_0x10bbaf[_0x1c47('0x4f')]=_0x3f05e4;return _0x10bbaf;})['then'](respondWithFilteredResult(_0xa0d53,_0x22c4f6))[_0x1c47('0x50')](handleError(_0xa0d53,null));};exports[_0x1c47('0x51')]=function(_0x5116fd,_0x23d381){var _0x470412={'raw':![],'where':{'id':_0x5116fd[_0x1c47('0x52')]['id']},'include':[{'model':db[_0x1c47('0x37')],'as':_0x1c47('0x38')}]},_0x4e5b74={};_0x4e5b74[_0x1c47('0x3d')]=_[_0x1c47('0x3f')](db[_0x1c47('0x39')][_0x1c47('0x3a')]);_0x4e5b74['query']=_[_0x1c47('0x3f')](_0x5116fd[_0x1c47('0x3e')]);_0x4e5b74[_0x1c47('0x40')]=_[_0x1c47('0x41')](_0x4e5b74[_0x1c47('0x3d')],_0x4e5b74[_0x1c47('0x3e')]);_0x470412[_0x1c47('0x43')]=_[_0x1c47('0x41')](_0x4e5b74[_0x1c47('0x3d')],qs[_0x1c47('0x42')](_0x5116fd[_0x1c47('0x3e')][_0x1c47('0x42')]));_0x470412[_0x1c47('0x43')]=_0x470412[_0x1c47('0x43')][_0x1c47('0x53')]?_0x470412[_0x1c47('0x43')]:_0x4e5b74[_0x1c47('0x3d')];if(_0x5116fd[_0x1c47('0x3e')]['includeAll']){_0x470412[_0x1c47('0x54')]=[{'all':!![]}];}_0x470412=_[_0x1c47('0x4a')]({},_0x470412,_0x5116fd['options']);return db['FaxAccount'][_0x1c47('0x55')](_0x470412)[_0x1c47('0x1c')](handleEntityNotFound(_0x23d381,null))[_0x1c47('0x1c')](respondWithResult(_0x23d381,null))[_0x1c47('0x50')](handleError(_0x23d381,null));};exports[_0x1c47('0x56')]=function(_0x3969fb,_0x1c93f3){return db['FaxAccount'][_0x1c47('0x56')](_0x3969fb['body'],{})[_0x1c47('0x1c')](function(_0x14662c){var _0x5a0aeb=_0x3969fb[_0x1c47('0x57')]['get']({'plain':!![]});if(!_0x5a0aeb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a0aeb[_0x1c47('0x58')]===_0x1c47('0x57')){var _0x577f5a=_0x14662c['get']({'plain':!![]});var _0x12d019=_0x1c47('0x59');return db[_0x1c47('0x5a')]['find']({'where':{'name':_0x12d019,'userProfileId':_0x5a0aeb[_0x1c47('0x5b')]},'raw':!![]})['then'](function(_0x4e1b3a){if(_0x4e1b3a&&_0x4e1b3a[_0x1c47('0x5c')]===0x0){return db[_0x1c47('0x33')]['create']({'name':_0x577f5a[_0x1c47('0x35')],'resourceId':_0x577f5a['id'],'type':_0x4e1b3a[_0x1c47('0x35')],'sectionId':_0x4e1b3a['id']},{})[_0x1c47('0x1c')](function(){return _0x14662c;});}else{return _0x14662c;}})[_0x1c47('0x50')](function(_0x7f1fa5){logger[_0x1c47('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7f1fa5);throw _0x7f1fa5;});}return _0x14662c;})[_0x1c47('0x1c')](respondWithResult(_0x1c93f3,0xc9))[_0x1c47('0x50')](handleError(_0x1c93f3,null));};exports['update']=function(_0x14f431,_0x4d2353){if(_0x14f431[_0x1c47('0x5d')]['id']){delete _0x14f431['body']['id'];}return db[_0x1c47('0x39')][_0x1c47('0x55')]({'where':{'id':_0x14f431[_0x1c47('0x52')]['id']},'include':[{'model':db[_0x1c47('0x37')],'as':_0x1c47('0x38')}]})[_0x1c47('0x1c')](handleEntityNotFound(_0x4d2353,null))[_0x1c47('0x1c')](saveUpdates(_0x14f431[_0x1c47('0x5d')],null))[_0x1c47('0x1c')](respondWithResult(_0x4d2353,null))[_0x1c47('0x50')](handleError(_0x4d2353,null));};exports[_0x1c47('0x32')]=function(_0x3914a3,_0x57fbc8){return db['FaxAccount'][_0x1c47('0x55')]({'where':{'id':_0x3914a3[_0x1c47('0x52')]['id']}})['then'](handleEntityNotFound(_0x57fbc8,null))[_0x1c47('0x1c')](removeEntity(_0x57fbc8,null))[_0x1c47('0x50')](handleError(_0x57fbc8,null));};exports[_0x1c47('0x5e')]=function(_0x53e5e1,_0x26fe17){return db['FaxAccount'][_0x1c47('0x5e')]()[_0x1c47('0x1c')](respondWithResult(_0x26fe17,null))[_0x1c47('0x50')](handleError(_0x26fe17,null));};exports[_0x1c47('0x5f')]=function(_0x33fb51,_0x5c124d,_0x56d2fe){if(_0x33fb51[_0x1c47('0x5d')]['id']){delete _0x33fb51['body']['id'];}return db[_0x1c47('0x39')]['find']({'where':{'id':_0x33fb51[_0x1c47('0x52')]['id']}})[_0x1c47('0x1c')](handleEntityNotFound(_0x5c124d,null))[_0x1c47('0x1c')](function(_0x55132f){if(_0x55132f){_0x33fb51[_0x1c47('0x5d')][_0x1c47('0x60')]=_0x55132f['id'];return db['Disposition'][_0x1c47('0x56')](_0x33fb51[_0x1c47('0x5d')]);}})['then'](respondWithResult(_0x5c124d,null))[_0x1c47('0x50')](handleError(_0x5c124d,null));};exports[_0x1c47('0x61')]=function(_0xf92f05,_0x3ab26a,_0x18c5d6){var _0x7903c6={'raw':![],'where':{}};var _0x25be46={};var _0x50526f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1c47('0x62')]({'where':{'id':_0xf92f05['params']['id']}})[_0x1c47('0x1c')](handleEntityNotFound(_0x3ab26a,null))[_0x1c47('0x1c')](function(_0x1f14cd){if(_0x1f14cd){_0x25be46[_0x1c47('0x3d')]=_['keys'](db[_0x1c47('0x63')][_0x1c47('0x3a')]);_0x25be46[_0x1c47('0x3e')]=_[_0x1c47('0x3f')](_0xf92f05[_0x1c47('0x3e')]);_0x25be46['filters']=_[_0x1c47('0x41')](_0x25be46[_0x1c47('0x3d')],_0x25be46[_0x1c47('0x3e')]);_0x7903c6[_0x1c47('0x43')]=_[_0x1c47('0x41')](_0x25be46[_0x1c47('0x3d')],qs[_0x1c47('0x42')](_0xf92f05[_0x1c47('0x3e')][_0x1c47('0x42')]));_0x7903c6[_0x1c47('0x43')]=_0x7903c6['attributes'][_0x1c47('0x53')]?_0x7903c6[_0x1c47('0x43')]:_0x25be46[_0x1c47('0x3d')];if(!_0xf92f05[_0x1c47('0x3e')][_0x1c47('0x44')](_0x1c47('0x45'))){_0x7903c6[_0x1c47('0x2d')]=qs[_0x1c47('0x2d')](_0xf92f05[_0x1c47('0x3e')][_0x1c47('0x2d')]);_0x7903c6['offset']=qs[_0x1c47('0x2c')](_0xf92f05[_0x1c47('0x3e')]['offset']);}_0x7903c6[_0x1c47('0x46')]=qs[_0x1c47('0x47')](_0xf92f05[_0x1c47('0x3e')][_0x1c47('0x47')]);_0x7903c6[_0x1c47('0x48')]=qs['filters'](_[_0x1c47('0x49')](_0xf92f05[_0x1c47('0x3e')],_0x25be46[_0x1c47('0x40')]));_0x7903c6[_0x1c47('0x48')]['FaxAccountId']=_0x1f14cd['id'];if(_0xf92f05[_0x1c47('0x3e')][_0x1c47('0x64')]){_0x7903c6[_0x1c47('0x48')]=_['merge'](_0x7903c6[_0x1c47('0x48')],{'$or':_[_0x1c47('0x4b')](_0x7903c6[_0x1c47('0x43')],function(_0x312766){var _0x3c6ca5={};_0x3c6ca5[_0x312766]={'$like':'%'+_0xf92f05[_0x1c47('0x3e')][_0x1c47('0x64')]+'%'};return _0x3c6ca5;})});}_0x7903c6=_['merge']({},_0x7903c6,_0xf92f05[_0x1c47('0x4d')]);return db['Disposition'][_0x1c47('0x2b')]({'where':_0x7903c6[_0x1c47('0x48')]})['then'](function(_0x2e8708){_0x50526f[_0x1c47('0x2b')]=_0x2e8708;if(_0xf92f05[_0x1c47('0x3e')][_0x1c47('0x65')]){_0x7903c6[_0x1c47('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x1c47('0x4e')](_0x7903c6);})[_0x1c47('0x1c')](function(_0xd50a0c){_0x50526f[_0x1c47('0x4f')]=_0xd50a0c;return _0x50526f;});}})[_0x1c47('0x1c')](respondWithFilteredResult(_0x3ab26a,_0x7903c6))[_0x1c47('0x50')](handleError(_0x3ab26a,null));};exports[_0x1c47('0x66')]=function(_0x4ae8de,_0x40c693,_0x73de58){return db['FaxAccount'][_0x1c47('0x55')]({'where':{'id':_0x4ae8de[_0x1c47('0x52')]['id']}})[_0x1c47('0x1c')](handleEntityNotFound(_0x40c693,null))[_0x1c47('0x1c')](function(_0x562fcd){if(_0x562fcd){return _0x562fcd['removeDispositions'](_0x4ae8de['query']['ids']);}})[_0x1c47('0x1c')](respondWithStatusCode(_0x40c693,null))[_0x1c47('0x50')](handleError(_0x40c693,null));};exports['addAnswer']=function(_0x1084ce,_0x2bb8d6,_0x46ced9){if(_0x1084ce[_0x1c47('0x5d')]['id']){delete _0x1084ce[_0x1c47('0x5d')]['id'];}return db[_0x1c47('0x39')]['find']({'where':{'id':_0x1084ce[_0x1c47('0x52')]['id']}})['then'](handleEntityNotFound(_0x2bb8d6,null))[_0x1c47('0x1c')](function(_0x2c4095){if(_0x2c4095){_0x1084ce['body']['FaxAccountId']=_0x2c4095['id'];return db[_0x1c47('0x67')]['create'](_0x1084ce[_0x1c47('0x5d')]);}})['then'](respondWithResult(_0x2bb8d6,null))[_0x1c47('0x50')](handleError(_0x2bb8d6,null));};exports[_0x1c47('0x68')]=function(_0x7dbb9c,_0x14998f,_0x26d424){var _0x2ce272={'raw':![],'where':{}};var _0x3d60de={};var _0x42d1ef={'count':0x0,'rows':[]};return db[_0x1c47('0x39')][_0x1c47('0x62')]({'where':{'id':_0x7dbb9c[_0x1c47('0x52')]['id']}})[_0x1c47('0x1c')](handleEntityNotFound(_0x14998f,null))[_0x1c47('0x1c')](function(_0x2e81bf){if(_0x2e81bf){_0x3d60de[_0x1c47('0x3d')]=_[_0x1c47('0x3f')](db[_0x1c47('0x67')][_0x1c47('0x3a')]);_0x3d60de[_0x1c47('0x3e')]=_[_0x1c47('0x3f')](_0x7dbb9c[_0x1c47('0x3e')]);_0x3d60de['filters']=_[_0x1c47('0x41')](_0x3d60de['model'],_0x3d60de[_0x1c47('0x3e')]);_0x2ce272[_0x1c47('0x43')]=_['intersection'](_0x3d60de[_0x1c47('0x3d')],qs[_0x1c47('0x42')](_0x7dbb9c[_0x1c47('0x3e')][_0x1c47('0x42')]));_0x2ce272[_0x1c47('0x43')]=_0x2ce272[_0x1c47('0x43')][_0x1c47('0x53')]?_0x2ce272[_0x1c47('0x43')]:_0x3d60de[_0x1c47('0x3d')];if(!_0x7dbb9c[_0x1c47('0x3e')]['hasOwnProperty']('nolimit')){_0x2ce272[_0x1c47('0x2d')]=qs['limit'](_0x7dbb9c['query']['limit']);_0x2ce272[_0x1c47('0x2c')]=qs[_0x1c47('0x2c')](_0x7dbb9c['query'][_0x1c47('0x2c')]);}_0x2ce272[_0x1c47('0x46')]=qs[_0x1c47('0x47')](_0x7dbb9c[_0x1c47('0x3e')][_0x1c47('0x47')]);_0x2ce272['where']=qs[_0x1c47('0x40')](_[_0x1c47('0x49')](_0x7dbb9c[_0x1c47('0x3e')],_0x3d60de[_0x1c47('0x40')]));_0x2ce272[_0x1c47('0x48')]['FaxAccountId']=_0x2e81bf['id'];if(_0x7dbb9c[_0x1c47('0x3e')][_0x1c47('0x64')]){_0x2ce272['where']=_[_0x1c47('0x4a')](_0x2ce272[_0x1c47('0x48')],{'$or':_[_0x1c47('0x4b')](_0x2ce272[_0x1c47('0x43')],function(_0x5ca37a){var _0x1de6e2={};_0x1de6e2[_0x5ca37a]={'$like':'%'+_0x7dbb9c[_0x1c47('0x3e')]['filter']+'%'};return _0x1de6e2;})});}_0x2ce272=_['merge']({},_0x2ce272,_0x7dbb9c[_0x1c47('0x4d')]);return db[_0x1c47('0x67')][_0x1c47('0x2b')]({'where':_0x2ce272[_0x1c47('0x48')]})[_0x1c47('0x1c')](function(_0x2e67ea){_0x42d1ef['count']=_0x2e67ea;if(_0x7dbb9c['query'][_0x1c47('0x65')]){_0x2ce272[_0x1c47('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1c47('0x4e')](_0x2ce272);})['then'](function(_0xd98501){_0x42d1ef[_0x1c47('0x4f')]=_0xd98501;return _0x42d1ef;});}})[_0x1c47('0x1c')](respondWithFilteredResult(_0x14998f,_0x2ce272))['catch'](handleError(_0x14998f,null));};exports[_0x1c47('0x69')]=function(_0x44dabf,_0x152d02,_0x2a98e7){return db[_0x1c47('0x39')]['find']({'where':{'id':_0x44dabf['params']['id']}})['then'](handleEntityNotFound(_0x152d02,null))[_0x1c47('0x1c')](function(_0x1fc1f3){if(_0x1fc1f3){return _0x1fc1f3[_0x1c47('0x69')](_0x44dabf[_0x1c47('0x3e')][_0x1c47('0x6a')]);}})['then'](respondWithStatusCode(_0x152d02,null))[_0x1c47('0x50')](handleError(_0x152d02,null));};exports[_0x1c47('0x6b')]=function(_0x4b1805,_0x1682af,_0x309f74){return db[_0x1c47('0x6c')][_0x1c47('0x55')]({'where':{'id':_0x4b1805['params']['id']}})[_0x1c47('0x1c')](handleEntityNotFound(_0x1682af,null))[_0x1c47('0x1c')](function(_0xa40611){if(_0xa40611){return _0xa40611[_0x1c47('0x6b')](_0x4b1805['body']['ids'],_['omit'](_0x4b1805['body'],[_0x1c47('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x1682af,null))['catch'](handleError(_0x1682af,null));};exports['getInteractions']=function(_0xd8c6b3,_0x407211,_0x175401){var _0x19330b={'raw':![],'where':{}};var _0x54310e={};var _0x4207c7={'count':0x0,'rows':[]};return db[_0x1c47('0x39')][_0x1c47('0x62')]({'where':{'id':_0xd8c6b3[_0x1c47('0x52')]['id']}})['then'](handleEntityNotFound(_0x407211,null))[_0x1c47('0x1c')](function(_0x372300){if(_0x372300){_0x54310e[_0x1c47('0x3d')]=_[_0x1c47('0x3f')](db[_0x1c47('0x6c')][_0x1c47('0x3a')]);_0x54310e['query']=_[_0x1c47('0x3f')](_0xd8c6b3[_0x1c47('0x3e')]);_0x54310e[_0x1c47('0x40')]=_[_0x1c47('0x41')](_0x54310e['model'],_0x54310e[_0x1c47('0x3e')]);_0x19330b[_0x1c47('0x43')]=_['intersection'](_0x54310e[_0x1c47('0x3d')],qs[_0x1c47('0x42')](_0xd8c6b3[_0x1c47('0x3e')][_0x1c47('0x42')]));_0x19330b[_0x1c47('0x43')]=_0x19330b['attributes']['length']?_0x19330b[_0x1c47('0x43')]:_0x54310e['model'];if(!_0xd8c6b3[_0x1c47('0x3e')]['hasOwnProperty'](_0x1c47('0x45'))){_0x19330b[_0x1c47('0x2d')]=qs[_0x1c47('0x2d')](_0xd8c6b3[_0x1c47('0x3e')][_0x1c47('0x2d')]);_0x19330b['offset']=qs[_0x1c47('0x2c')](_0xd8c6b3[_0x1c47('0x3e')][_0x1c47('0x2c')]);}_0x19330b[_0x1c47('0x46')]=qs[_0x1c47('0x47')](_0xd8c6b3['query'][_0x1c47('0x47')]);_0x19330b[_0x1c47('0x48')]=qs['filters'](_[_0x1c47('0x49')](_0xd8c6b3[_0x1c47('0x3e')],_0x54310e[_0x1c47('0x40')]));_0x19330b[_0x1c47('0x48')][_0x1c47('0x60')]=_0x372300['id'];if(_0xd8c6b3['query'][_0x1c47('0x64')]){_0x19330b[_0x1c47('0x48')]=_['merge'](_0x19330b[_0x1c47('0x48')],{'$or':_[_0x1c47('0x4b')](_0x19330b[_0x1c47('0x43')],function(_0x53e126){var _0x1ebb9e={};_0x1ebb9e[_0x53e126]={'$like':'%'+_0xd8c6b3[_0x1c47('0x3e')]['filter']+'%'};return _0x1ebb9e;})});}_0x19330b=_[_0x1c47('0x4a')]({},_0x19330b,_0xd8c6b3['options']);return db[_0x1c47('0x6c')]['count']({'where':_0x19330b[_0x1c47('0x48')]})[_0x1c47('0x1c')](function(_0x4b9460){_0x4207c7['count']=_0x4b9460;if(_0xd8c6b3['query']['includeAll']){_0x19330b[_0x1c47('0x54')]=[{'model':db['CmContact'],'as':_0x1c47('0x6d'),'required':![]},{'model':db[_0x1c47('0x6e')],'as':_0x1c47('0x6f'),'attributes':[_0x1c47('0x35'),_0x1c47('0x70'),'internal'],'required':![]},{'model':db[_0x1c47('0x71')],'as':_0x1c47('0x72'),'attributes':['id',_0x1c47('0x35'),_0x1c47('0x73')],'where':_0xd8c6b3[_0x1c47('0x3e')][_0x1c47('0x74')]?{'id':_0xd8c6b3['query'][_0x1c47('0x74')]}:undefined,'required':_0xd8c6b3[_0x1c47('0x3e')][_0x1c47('0x74')]?!![]:![]}];}return db[_0x1c47('0x6c')][_0x1c47('0x4e')](_0x19330b);})[_0x1c47('0x1c')](function(_0x50a5de){_0x4207c7[_0x1c47('0x4f')]=_0x50a5de;return _0x4207c7;});}})[_0x1c47('0x1c')](respondWithFilteredResult(_0x407211,_0x19330b))[_0x1c47('0x50')](handleError(_0x407211,null));};exports[_0x1c47('0x75')]=function(_0xa9b266,_0x133c12){var _0x23f1db=_0xa9b266[_0x1c47('0x52')]['id'];var _0x25d9d0=_0xa9b266[_0x1c47('0x5d')];var _0x3dd1b5=0xc8;var _0x581676=null;return db[_0x1c47('0x76')]['transaction']({'isolationLevel':db['sequelize'][_0x1c47('0x77')][_0x1c47('0x78')][_0x1c47('0x79')]},function(_0x8a6da5){return db[_0x1c47('0x39')]['findOne']({'where':{'id':_0x23f1db},'transaction':_0x8a6da5})[_0x1c47('0x1c')](function(_0x1d6ab0){if(_0x1d6ab0){return db[_0x1c47('0x7a')][_0x1c47('0x32')]({'where':{'FaxAccountId':_0x23f1db},'transaction':_0x8a6da5})[_0x1c47('0x1c')](function(){var _0x23b4db=_[_0x1c47('0x4b')](_0x25d9d0,function(_0x1968c5){_0x1968c5[_0x1c47('0x60')]=_0x23f1db;return _0x1968c5;});return db[_0x1c47('0x7a')][_0x1c47('0x7b')](_0x23b4db,{'transaction':_0x8a6da5});});}else{_0x3dd1b5=0x194;_0x581676=[];}});})['then'](function(){if(_0x3dd1b5!==0x194){return db[_0x1c47('0x7a')][_0x1c47('0x7c')]({'where':{'FaxAccountId':_0x23f1db},'order':_0x1c47('0x7d')})[_0x1c47('0x1c')](function(_0x3301f1){_0x581676=_0x3301f1;});}})[_0x1c47('0x50')](function(_0x439cdd){_0x3dd1b5=0x1f4;logger['error'](_0x439cdd[_0x1c47('0x34')]);if(_0x439cdd['name']){delete _0x439cdd['name'];}_0x581676=_0x439cdd;})['finally'](function(){if(_0x581676===null){_0x133c12[_0x1c47('0x27')](_0x3dd1b5);}else{if(_0x3dd1b5===0x1f4){_0x133c12[_0x1c47('0x28')](_0x3dd1b5)['send'](_0x581676);}else{_0x133c12['status'](_0x3dd1b5)[_0x1c47('0x29')](_0x581676);}}});};exports[_0x1c47('0x7e')]=function(_0x1e5e6b,_0x5b672c,_0x1e3112){var _0xdf69f0={};var _0x1ba1e5={};var _0x1c6413;var _0x28145a;return db[_0x1c47('0x39')][_0x1c47('0x62')]({'where':{'id':_0x1e5e6b[_0x1c47('0x52')]['id']}})[_0x1c47('0x1c')](handleEntityNotFound(_0x5b672c,null))[_0x1c47('0x1c')](function(_0x583e28){if(_0x583e28){_0x1c6413=_0x583e28;_0x1ba1e5[_0x1c47('0x3d')]=_[_0x1c47('0x3f')](db[_0x1c47('0x7a')][_0x1c47('0x3a')]);_0x1ba1e5['query']=_[_0x1c47('0x3f')](_0x1e5e6b[_0x1c47('0x3e')]);_0x1ba1e5[_0x1c47('0x40')]=_['intersection'](_0x1ba1e5[_0x1c47('0x3d')],_0x1ba1e5[_0x1c47('0x3e')]);_0xdf69f0[_0x1c47('0x43')]=_[_0x1c47('0x41')](_0x1ba1e5['model'],qs[_0x1c47('0x42')](_0x1e5e6b[_0x1c47('0x3e')][_0x1c47('0x42')]));_0xdf69f0[_0x1c47('0x43')]=_0xdf69f0[_0x1c47('0x43')]['length']?_0xdf69f0[_0x1c47('0x43')]:_0x1ba1e5[_0x1c47('0x3d')];_0xdf69f0['order']=qs[_0x1c47('0x47')](_0x1e5e6b[_0x1c47('0x3e')][_0x1c47('0x47')]);_0xdf69f0[_0x1c47('0x48')]=qs[_0x1c47('0x40')](_[_0x1c47('0x49')](_0x1e5e6b['query'],_0x1ba1e5['filters']));if(_0x1e5e6b[_0x1c47('0x3e')]['filter']){_0xdf69f0[_0x1c47('0x48')]=_[_0x1c47('0x4a')](_0xdf69f0[_0x1c47('0x48')],{'$or':_[_0x1c47('0x4b')](_0xdf69f0[_0x1c47('0x43')],function(_0x35a6a0){var _0x19a7c8={};_0x19a7c8[_0x35a6a0]={'$like':'%'+_0x1e5e6b['query'][_0x1c47('0x64')]+'%'};return _0x19a7c8;})});}_0xdf69f0=_['merge']({},_0xdf69f0,_0x1e5e6b[_0x1c47('0x4d')]);return _0x1c6413[_0x1c47('0x7e')](_0xdf69f0);}})[_0x1c47('0x1c')](function(_0x48c70a){if(_0x48c70a){_0x28145a=_0x48c70a['length'];if(!_0x1e5e6b[_0x1c47('0x3e')]['hasOwnProperty'](_0x1c47('0x45'))){_0xdf69f0[_0x1c47('0x2d')]=qs[_0x1c47('0x2d')](_0x1e5e6b[_0x1c47('0x3e')][_0x1c47('0x2d')]);_0xdf69f0['offset']=qs[_0x1c47('0x2c')](_0x1e5e6b[_0x1c47('0x3e')][_0x1c47('0x2c')]);}return _0x1c6413[_0x1c47('0x7e')](_0xdf69f0);}})[_0x1c47('0x1c')](function(_0xd7d524){if(_0xd7d524){return _0xd7d524?{'count':_0x28145a,'rows':_0xd7d524}:null;}})[_0x1c47('0x1c')](respondWithResult(_0x5b672c,null))[_0x1c47('0x50')](handleError(_0x5b672c,null));};function Extension(_0x1db66b,_0x3b29e9,_0x306e70,_0x4fd109){this[_0x1c47('0x7f')]=_0x1c47('0x80');this['exten']=_0x1db66b[_0x1c47('0x81')];this[_0x1c47('0x82')]=_0x4fd109;this[_0x1c47('0x3b')]=_0x1c47('0x83');this[_0x1c47('0x84')]='Fax\x20Extension';this[_0x1c47('0x60')]=_0x1db66b['id'];this[_0x1c47('0x7d')]=_0x3b29e9;this[_0x1c47('0x85')]=_0x306e70;}function createExtensionsReciveFax(_0x1def54){var _0x226725=0x1;var _0x3919b5=[];_0x3919b5[_0x1c47('0x86')](new Extension(_0x1def54,_0x226725,'','Answer'));_0x226725+=0x1;_0x3919b5[_0x1c47('0x86')](new Extension(_0x1def54,_0x226725,_0x1c47('0x87'),_0x1c47('0x88')));_0x226725+=0x1;for(var _0x493499 in _0x1def54){if(_0x1def54[_0x1c47('0x44')](_0x493499)&&(_0x493499===_0x1c47('0x89')||_0x493499==='localstationid'||_0x493499===_0x1c47('0x8a')||_0x493499===_0x1c47('0x8b')||_0x493499===_0x1c47('0x8c')||_0x493499===_0x1c47('0x8d')||_0x493499===_0x1c47('0x8e')||_0x493499===_0x1c47('0x8f')||_0x493499===_0x1c47('0x90'))){_0x3919b5[_0x1c47('0x86')](new Extension(_0x1def54,_0x226725,_0x1c47('0x91')+_0x493499+')='+_0x1def54[_0x493499],'Set'));_0x226725+=0x1;}}_0x3919b5[_0x1c47('0x86')](new Extension(_0x1def54,_0x226725,'6',_0x1c47('0x92')));_0x226725+=0x1;_0x3919b5['push'](new Extension(_0x1def54,_0x226725,_0x1c47('0x93'),'ReceiveFax'));_0x226725=0x0;return _0x3919b5;}exports[_0x1c47('0x94')]=function(_0x229396,_0x2945ca,_0x111a43){var _0x4d7d6e;return db[_0x1c47('0x76')][_0x1c47('0x95')](function(_0x38abef){return db[_0x1c47('0x39')]['create'](_0x229396[_0x1c47('0x5d')],{'transaction':_0x38abef})[_0x1c47('0x1c')](function(_0x21c0b0){_0x4d7d6e=_0x21c0b0[_0x1c47('0x96')]({'plain':!![]});return db[_0x1c47('0x97')][_0x1c47('0x7b')](createExtensionsReciveFax(_0x4d7d6e),{'transaction':_0x38abef});});})[_0x1c47('0x1c')](function(){return _0x4d7d6e;})['then'](respondWithResult(_0x2945ca,null))[_0x1c47('0x50')](handleError(_0x2945ca,null));};exports[_0x1c47('0x98')]=function(_0x90f629,_0x311ac8,_0x540789){var _0x49309a;return db[_0x1c47('0x76')][_0x1c47('0x95')](function(_0x16e956){return db[_0x1c47('0x39')][_0x1c47('0x99')](_0x90f629[_0x1c47('0x5d')],{'where':{'id':_0x90f629[_0x1c47('0x5d')]['id']},'transaction':_0x16e956})[_0x1c47('0x1c')](function(_0x1ef60c){return db['VoiceExtension'][_0x1c47('0x32')]({'where':{'FaxAccountId':_0x90f629['body']['id']},'transaction':_0x16e956})[_0x1c47('0x1c')](function(_0x592137){return db[_0x1c47('0x97')][_0x1c47('0x7b')](createExtensionsReciveFax(_[_0x1c47('0x9a')](_0x90f629[_0x1c47('0x5d')],[_0x1c47('0x9b'),_0x1c47('0x3c'),_0x1c47('0x9c'),_0x1c47('0x9d'),_0x1c47('0x9e'),_0x1c47('0x9f')])),{'transaction':_0x16e956});});});})[_0x1c47('0x1c')](function(){return db[_0x1c47('0x39')][_0x1c47('0xa0')](_0x90f629[_0x1c47('0x5d')]['id']);})[_0x1c47('0x1c')](respondWithResult(_0x311ac8,null))[_0x1c47('0x50')](handleError(_0x311ac8,null));};exports[_0x1c47('0xa1')]=function(_0x5080a3,_0x588d41,_0x489208){var _0x206f29={'raw':!![],'where':{}};var _0x3ee35d={};var _0x3a66ae={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1c47('0x62')]({'where':{'id':_0x5080a3[_0x1c47('0x52')]['id']}})[_0x1c47('0x1c')](handleEntityNotFound(_0x588d41,null))['then'](function(_0x1fdb45){if(_0x1fdb45){_0x3ee35d[_0x1c47('0x3d')]=_[_0x1c47('0x3f')](db[_0x1c47('0xa2')][_0x1c47('0x3a')]);_0x3ee35d[_0x1c47('0x3e')]=_[_0x1c47('0x3f')](_0x5080a3[_0x1c47('0x3e')]);_0x3ee35d[_0x1c47('0x40')]=_['intersection'](_0x3ee35d[_0x1c47('0x3d')],_0x3ee35d[_0x1c47('0x3e')]);_0x206f29[_0x1c47('0x43')]=_['intersection'](_0x3ee35d[_0x1c47('0x3d')],qs[_0x1c47('0x42')](_0x5080a3[_0x1c47('0x3e')]['fields']));_0x206f29['attributes']=_0x206f29['attributes'][_0x1c47('0x53')]?_0x206f29[_0x1c47('0x43')]:_0x3ee35d['model'];if(!_0x5080a3[_0x1c47('0x3e')]['hasOwnProperty']('nolimit')){_0x206f29[_0x1c47('0x2d')]=qs[_0x1c47('0x2d')](_0x5080a3[_0x1c47('0x3e')]['limit']);_0x206f29[_0x1c47('0x2c')]=qs[_0x1c47('0x2c')](_0x5080a3[_0x1c47('0x3e')][_0x1c47('0x2c')]);}_0x206f29[_0x1c47('0x46')]=qs['sort'](_0x5080a3['query'][_0x1c47('0x47')]);_0x206f29[_0x1c47('0x48')]=qs[_0x1c47('0x40')](_[_0x1c47('0x49')](_0x5080a3[_0x1c47('0x3e')],_0x3ee35d[_0x1c47('0x40')]));_0x206f29[_0x1c47('0x48')][_0x1c47('0x60')]=_0x1fdb45['id'];if(_0x5080a3['query'][_0x1c47('0x64')]){_0x206f29[_0x1c47('0x48')]=_[_0x1c47('0x4a')](_0x206f29[_0x1c47('0x48')],{'$or':_[_0x1c47('0x4b')](_0x206f29[_0x1c47('0x43')],function(_0x174385){var _0x25ca72={};_0x25ca72[_0x174385]={'$like':'%'+_0x5080a3[_0x1c47('0x3e')]['filter']+'%'};return _0x25ca72;})});}if(_0x5080a3[_0x1c47('0x3e')]['$gte']){var _0x41e009=_0x5080a3[_0x1c47('0x3e')]['$gte']['split'](',');var _0x48dc12={};_0x48dc12[_0x41e009[0x0]]={'$gte':moment(_0x41e009[0x1])[_0x1c47('0xa3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x206f29[_0x1c47('0x48')]=_[_0x1c47('0x4a')](_0x206f29[_0x1c47('0x48')],_0x48dc12);}_0x206f29=_[_0x1c47('0x4a')]({},_0x206f29,_0x5080a3['options']);return db[_0x1c47('0xa2')]['count']({'where':_0x206f29[_0x1c47('0x48')]})[_0x1c47('0x1c')](function(_0x77bf52){_0x3a66ae[_0x1c47('0x2b')]=_0x77bf52;if(_0x5080a3['query'][_0x1c47('0x65')]){_0x206f29[_0x1c47('0x54')]=[{'all':!![]}];}return db[_0x1c47('0xa2')][_0x1c47('0x4e')](_0x206f29);})[_0x1c47('0x1c')](function(_0x36840e){_0x3a66ae[_0x1c47('0x4f')]=_0x36840e;return _0x3a66ae;});}})[_0x1c47('0x1c')](respondWithFilteredResult(_0x588d41,_0x206f29))['catch'](handleError(_0x588d41,null));};exports[_0x1c47('0x36')]=function(_0x225811,_0x26c587,_0x48b267){var _0x3948cb,_0x45f2c7={},_0x56e49a;if(_0x225811[_0x1c47('0x5d')]['to']){_0x56e49a=_0x225811[_0x1c47('0x5d')]['to'][0x0];}return db[_0x1c47('0x39')][_0x1c47('0x55')]({'where':{'id':_0x225811[_0x1c47('0x52')]['id']},'include':[{'model':db[_0x1c47('0xa4')],'as':_0x1c47('0xa5'),'include':[{'model':db[_0x1c47('0xa6')],'as':_0x1c47('0xa7'),'where':{'fax':_0x56e49a},'limit':0x1,'order':[[_0x1c47('0x9d'),_0x1c47('0xa8')]]}]}]})[_0x1c47('0x1c')](handleEntityNotFound(_0x26c587,null))['then'](function(_0x28659b){_0x3948cb=_0x28659b;if(_0x225811[_0x1c47('0x5d')][_0x1c47('0xa9')]&&_0x225811['body'][_0x1c47('0xa9')][_0x1c47('0x53')]){for(var _0x5b8728=0x0;_0x5b8728<_0x225811['body'][_0x1c47('0xa9')][_0x1c47('0x53')];_0x5b8728+=0x1){_0x225811['body']['attachments'][_0x5b8728]={'filename':_0x225811[_0x1c47('0x5d')][_0x1c47('0xa9')][_0x5b8728][_0x1c47('0x35')],'id':_0x225811[_0x1c47('0x5d')][_0x1c47('0xa9')][_0x5b8728]['id'],'path':path[_0x1c47('0xaa')](config[_0x1c47('0xab')],_0x1c47('0xac'),_0x225811[_0x1c47('0x5d')][_0x1c47('0xa9')][_0x5b8728][_0x1c47('0xad')])};}}return respondWithRpcPromise(_0x1c47('0xae'),_0x1c47('0xae'),{'FaxAccountId':_[_0x1c47('0xaf')](_0x225811[_0x1c47('0x52')]['id'])?undefined:_0x225811[_0x1c47('0x52')]['id'],'path':_[_0x1c47('0xaf')](_0x225811[_0x1c47('0x5d')][_0x1c47('0xa9')][0x0][_0x1c47('0xb0')])?undefined:_0x225811[_0x1c47('0x5d')][_0x1c47('0xa9')][0x0][_0x1c47('0xb0')],'fax':_[_0x1c47('0xaf')](_0x225811[_0x1c47('0x5d')]['to'][0x0])?undefined:_0x225811['body']['to'][0x0]},client9002);})['then'](function(){if(_0x3948cb){if(_[_0x1c47('0xaf')](_0x225811[_0x1c47('0x5d')][_0x1c47('0xb1')])){_0x225811[_0x1c47('0x5d')][_0x1c47('0xb1')]=util[_0x1c47('0xa3')](_0x1c47('0xb2'),_0x3948cb[_0x1c47('0x35')],_0x3948cb[_0x1c47('0xb3')]);}if(_0x3948cb[_0x1c47('0xa5')]){if(_0x3948cb[_0x1c47('0xa5')][_0x1c47('0xa7')][_0x1c47('0x53')]){return _0x3948cb[_0x1c47('0xa5')][_0x1c47('0xa7')][0x0];}else{return db['CmContact'][_0x1c47('0x56')](_[_0x1c47('0x16')](_0x225811[_0x1c47('0x5d')],{'firstName':_0x225811['body']['to'][0x0],'phone':_0x225811[_0x1c47('0x5d')]['to'][0x0],'fax':_0x225811[_0x1c47('0x5d')]['to'][0x0],'ListId':_0x3948cb['ListId']}));}}else{throw new Error(_0x1c47('0xb4'));}}else{throw new Error(_0x1c47('0xb5'));}})[_0x1c47('0x1c')](function(_0x11a856){if(_0x11a856){return db[_0x1c47('0x6c')]['find']({'where':{'ContactId':_0x11a856['id'],'closed':![],'FaxAccountId':_0x3948cb['id']}})[_0x1c47('0x1c')](function(_0x59fd95){if(_0x59fd95){return[_0x59fd95,![]];}return db['FaxInteraction']['create']({'UserId':_0x225811[_0x1c47('0x57')]['id'],'ContactId':_0x11a856['id'],'FaxAccountId':_0x3948cb['id'],'fax':_0x225811[_0x1c47('0x5d')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x1c47('0x4a')](_0x225811[_0x1c47('0x5d')],{'read':![],'body':_0x225811['body'][_0x1c47('0xa9')][0x0][_0x1c47('0xb6')],'FaxAccountId':_0x3948cb['id'],'UserId':_0x225811[_0x1c47('0x57')]['id'],'ContactId':_0x11a856['id'],'AttachmentId':_0x225811[_0x1c47('0x5d')][_0x1c47('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x1c47('0xa2')],'as':_0x1c47('0xb7')}]})[_0x1c47('0x1c')](function(_0x42deb1){return[_0x42deb1,!![]];});});}else{throw new Error(_0x1c47('0xb8'));}})['spread'](function(_0x2844a9,_0x2b834f){if(_0x2b834f){return _0x2844a9;}return db[_0x1c47('0xa2')]['create']({'direction':'out','read':![],'body':_0x225811[_0x1c47('0x5d')][_0x1c47('0xa9')][0x0][_0x1c47('0xb6')],'FaxAccountId':_0x3948cb['id'],'FaxInteractionId':_0x2844a9['id'],'UserId':_0x225811[_0x1c47('0x57')]['id'],'ContactId':_0x2844a9[_0x1c47('0xb9')],'AttachmentId':_0x225811[_0x1c47('0x5d')][_0x1c47('0xa9')][0x0]['id']})[_0x1c47('0x1c')](function(_0x58fa1b){_0x2844a9[_0x1c47('0xba')]['Messages']=[];_0x2844a9[_0x1c47('0xba')]['Messages']['push'](_0x58fa1b[_0x1c47('0xba')]);return _0x2844a9;});})[_0x1c47('0x1c')](function(_0x94182d){respondWithRpcPromise(_0x1c47('0xbb'),_0x1c47('0xbb'),{'FaxAccountId':_[_0x1c47('0xaf')](_0x225811[_0x1c47('0x52')]['id'])?undefined:_0x225811['params']['id'],'path':_[_0x1c47('0xaf')](_0x225811[_0x1c47('0x5d')]['attachments'][0x0]['path'])?undefined:_0x225811[_0x1c47('0x5d')][_0x1c47('0xa9')][0x0][_0x1c47('0xb0')],'fax':_['isNil'](_0x225811[_0x1c47('0x5d')]['to'][0x0])?undefined:_0x225811['body']['to'][0x0],'AttachmentId':_0x225811[_0x1c47('0x5d')][_0x1c47('0xa9')][0x0]['id']},client9002)[_0x1c47('0x1c')](function(_0x4d41b8){logger[_0x1c47('0x1d')](_0x1c47('0xbc'),_0x4d41b8);})[_0x1c47('0x50')](function(_0x2dcb98){logger[_0x1c47('0x1d')](_0x1c47('0xbc'),_0x2dcb98);});return _0x94182d;})[_0x1c47('0x1c')](respondWithResult(_0x26c587,null))[_0x1c47('0x50')](handleError(_0x26c587,null));};exports[_0x1c47('0xbd')]=function(_0x262bd5,_0x581ae6,_0x52d2d6){return db[_0x1c47('0x39')][_0x1c47('0x55')]({'where':{'id':_0x262bd5[_0x1c47('0x52')]['id']}})['then'](handleEntityNotFound(_0x581ae6,null))[_0x1c47('0x1c')](function(_0x1f3bcc){if(_0x1f3bcc){return _0x1f3bcc['addAgents'](_0x262bd5[_0x1c47('0x5d')][_0x1c47('0x6a')],_['omit'](_0x262bd5['body'],[_0x1c47('0x6a'),'id'])||{})[_0x1c47('0xbe')](function(_0x267fa7){for(var _0x268764=0x0;_0x268764<_0x262bd5[_0x1c47('0x5d')][_0x1c47('0x6a')][_0x1c47('0x53')];_0x268764+=0x1){socket[_0x1c47('0xbf')](_0x1c47('0xc0'),{'UserId':Number(_0x262bd5[_0x1c47('0x5d')][_0x1c47('0x6a')][_0x268764]),'FaxAccountId':Number(_0x262bd5[_0x1c47('0x52')]['id'])});}return _0x267fa7;});}})[_0x1c47('0x1c')](respondWithResult(_0x581ae6,null))[_0x1c47('0x50')](handleError(_0x581ae6,null));};exports[_0x1c47('0xc1')]=function(_0x1d6c07,_0x5bf0fc,_0x1fb2c6){return db[_0x1c47('0x39')][_0x1c47('0x55')]({'where':{'id':_0x1d6c07[_0x1c47('0x52')]['id']}})[_0x1c47('0x1c')](handleEntityNotFound(_0x5bf0fc,null))[_0x1c47('0x1c')](function(_0x13ef3a){if(_0x13ef3a){return _0x13ef3a[_0x1c47('0xc1')](_0x1d6c07[_0x1c47('0x3e')][_0x1c47('0x6a')])[_0x1c47('0x1c')](function(){if(_[_0x1c47('0xc2')](_0x1d6c07['query'][_0x1c47('0x6a')])){for(var _0x21318b=0x0;_0x21318b<_0x1d6c07['query'][_0x1c47('0x6a')][_0x1c47('0x53')];_0x21318b+=0x1){socket['emit'](_0x1c47('0xc3'),{'UserId':Number(_0x1d6c07[_0x1c47('0x3e')][_0x1c47('0x6a')][_0x21318b]),'FaxAccountId':Number(_0x1d6c07[_0x1c47('0x52')]['id'])});}}else{socket[_0x1c47('0xbf')]('userFaxAccount:remove',{'UserId':Number(_0x1d6c07[_0x1c47('0x3e')]['ids']),'FaxAccountId':Number(_0x1d6c07['params']['id'])});}});}})[_0x1c47('0x1c')](respondWithStatusCode(_0x5bf0fc,null))[_0x1c47('0x50')](handleError(_0x5bf0fc,null));};exports[_0x1c47('0xc4')]=function(_0x44681a,_0xcd1f94,_0x5b8dd0){var _0x312545={};var _0x1c4e7c={};var _0x18d2b3;var _0x5472e4;return db['FaxAccount']['findOne']({'where':{'id':_0x44681a['params']['id']}})[_0x1c47('0x1c')](handleEntityNotFound(_0xcd1f94,null))[_0x1c47('0x1c')](function(_0x49279f){if(_0x49279f){_0x18d2b3=_0x49279f;_0x1c4e7c[_0x1c47('0x3d')]=_[_0x1c47('0x3f')](db[_0x1c47('0x6e')][_0x1c47('0x3a')]);_0x1c4e7c[_0x1c47('0x3e')]=_[_0x1c47('0x3f')](_0x44681a[_0x1c47('0x3e')]);_0x1c4e7c[_0x1c47('0x40')]=_['intersection'](_0x1c4e7c[_0x1c47('0x3d')],_0x1c4e7c[_0x1c47('0x3e')]);_0x312545[_0x1c47('0x43')]=_['intersection'](_0x1c4e7c[_0x1c47('0x3d')],qs[_0x1c47('0x42')](_0x44681a['query'][_0x1c47('0x42')]));_0x312545[_0x1c47('0x43')]=_0x312545[_0x1c47('0x43')][_0x1c47('0x53')]?_0x312545[_0x1c47('0x43')]:_0x1c4e7c['model'];_0x312545['order']=qs[_0x1c47('0x47')](_0x44681a['query'][_0x1c47('0x47')]);_0x312545[_0x1c47('0x48')]=qs[_0x1c47('0x40')](_[_0x1c47('0x49')](_0x44681a['query'],_0x1c4e7c[_0x1c47('0x40')]));if(_0x44681a[_0x1c47('0x3e')][_0x1c47('0x64')]){_0x312545['where']=_[_0x1c47('0x4a')](_0x312545[_0x1c47('0x48')],{'$or':_[_0x1c47('0x4b')](_0x312545[_0x1c47('0x43')],function(_0x59aa85){var _0x4db80c={};_0x4db80c[_0x59aa85]={'$like':'%'+_0x44681a['query'][_0x1c47('0x64')]+'%'};return _0x4db80c;})});}_0x312545=_[_0x1c47('0x4a')]({},_0x312545,_0x44681a['options']);return _0x18d2b3['getAgents'](_0x312545);}})[_0x1c47('0x1c')](function(_0x99eb3a){if(_0x99eb3a){_0x5472e4=_0x99eb3a['length'];if(!_0x44681a[_0x1c47('0x3e')][_0x1c47('0x44')](_0x1c47('0x45'))){_0x312545[_0x1c47('0x2d')]=qs[_0x1c47('0x2d')](_0x44681a[_0x1c47('0x3e')][_0x1c47('0x2d')]);_0x312545[_0x1c47('0x2c')]=qs['offset'](_0x44681a[_0x1c47('0x3e')][_0x1c47('0x2c')]);}return _0x18d2b3[_0x1c47('0xc4')](_0x312545);}})[_0x1c47('0x1c')](function(_0x21133c){if(_0x21133c){return _0x21133c?{'count':_0x5472e4,'rows':_0x21133c}:null;}})[_0x1c47('0x1c')](respondWithResult(_0xcd1f94,null))['catch'](handleError(_0xcd1f94,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 8f92629..19a1343 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 _0x160f=['../../mysqldb','FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty','events'];(function(_0x81b33b,_0x1d15eb){var _0x2a67c2=function(_0xb1595e){while(--_0xb1595e){_0x81b33b['push'](_0x81b33b['shift']());}};_0x2a67c2(++_0x1d15eb);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf160('0x0'));var FaxAccount=require(_0xf160('0x1'))['db'][_0xf160('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf160('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf160('0x4'),'afterDestroy':_0xf160('0x5')};function emitEvent(_0x183b15){return function(_0x3b2d7b,_0x194331,_0xfdbd72){FaxAccountEvents['emit'](_0x183b15+':'+_0x3b2d7b['id'],_0x3b2d7b);FaxAccountEvents[_0xf160('0x6')](_0x183b15,_0x3b2d7b);_0xfdbd72(null);};}for(var e in events){if(events[_0xf160('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xaa23=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount','save'];(function(_0x3f9a64,_0x224930){var _0x353b88=function(_0x4fdb95){while(--_0x4fdb95){_0x3f9a64['push'](_0x3f9a64['shift']());}};_0x353b88(++_0x224930);}(_0xaa23,0x17f));var _0x3aa2=function(_0x4b7f28,_0x27d23a){_0x4b7f28=_0x4b7f28-0x0;var _0xf5b553=_0xaa23[_0x4b7f28];return _0xf5b553;};'use strict';var EventEmitter=require(_0x3aa2('0x0'));var FaxAccount=require(_0x3aa2('0x1'))['db'][_0x3aa2('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3aa2('0x3'),'afterUpdate':_0x3aa2('0x4'),'afterDestroy':_0x3aa2('0x5')};function emitEvent(_0x5cc721){return function(_0x27da0d,_0x515c63,_0x51b7c9){FaxAccountEvents['emit'](_0x5cc721+':'+_0x27da0d['id'],_0x27da0d);FaxAccountEvents[_0x3aa2('0x6')](_0x5cc721,_0x27da0d);_0x51b7c9(null);};}for(var e in events){if(events[_0x3aa2('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x3aa2('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index d25b394..3f499e7 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 _0xaca2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util'];(function(_0x401f30,_0x4bba01){var _0x419d3b=function(_0x25ff24){while(--_0x25ff24){_0x401f30['push'](_0x401f30['shift']());}};_0x419d3b(++_0x4bba01);}(_0xaca2,0xd0));var _0x2aca=function(_0x34e4a0,_0x1fd446){_0x34e4a0=_0x34e4a0-0x0;var _0x3ead3e=_0xaca2[_0x34e4a0];return _0x3ead3e;};'use strict';var _=require(_0x2aca('0x0'));var util=require(_0x2aca('0x1'));var logger=require(_0x2aca('0x2'))(_0x2aca('0x3'));var moment=require(_0x2aca('0x4'));var BPromise=require(_0x2aca('0x5'));var rp=require(_0x2aca('0x6'));var fs=require('fs');var path=require(_0x2aca('0x7'));var rimraf=require(_0x2aca('0x8'));var config=require(_0x2aca('0x9'));var attributes=require(_0x2aca('0xa'));module['exports']=function(_0x491b69,_0x7a97dd){return _0x491b69[_0x2aca('0xb')](_0x2aca('0xc'),attributes,{'tableName':_0x2aca('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91ee=['moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','FaxAccount','api'];(function(_0x247b70,_0x234abd){var _0x3ffbb9=function(_0x2f5667){while(--_0x2f5667){_0x247b70['push'](_0x247b70['shift']());}};_0x3ffbb9(++_0x234abd);}(_0x91ee,0x7f));var _0xe91e=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x91ee[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe91e('0x0'));var moment=require(_0xe91e('0x1'));var BPromise=require(_0xe91e('0x2'));var rp=require(_0xe91e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe91e('0x4'));var config=require(_0xe91e('0x5'));var attributes=require(_0xe91e('0x6'));module['exports']=function(_0x10b729,_0x5ed380){return _0x10b729['define'](_0xe91e('0x7'),attributes,{'tableName':'fax_accounts','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 71a9c69..5fdbf9c 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 _0xf6cb=['DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','length','contact','FaxInteraction','find','create','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','unshift','Start','startRouting','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','findAll','options','raw','where','limit','include','model','attributes','map','catch','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','body','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','FaxAccount','account','CmList','List','Contacts'];(function(_0x29900d,_0x35548b){var _0x2d2895=function(_0xa9825d){while(--_0xa9825d){_0x29900d['push'](_0x29900d['shift']());}};_0x2d2895(++_0x35548b);}(_0xf6cb,0x127));var _0xbf6c=function(_0x571d22,_0x8d3445){_0x571d22=_0x571d22-0x0;var _0x562025=_0xf6cb[_0x571d22];return _0x562025;};'use strict';var _=require(_0xbf6c('0x0'));var util=require(_0xbf6c('0x1'));var moment=require(_0xbf6c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf6c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf6c('0x4'))(_0xbf6c('0x5'));var config=require(_0xbf6c('0x6'));var jayson=require(_0xbf6c('0x7'));var client=jayson[_0xbf6c('0x8')][_0xbf6c('0x9')]({'port':0x232c});config[_0xbf6c('0xa')]=_[_0xbf6c('0xb')](config['redis'],{'host':_0xbf6c('0xc'),'port':0x18eb});var socket=require(_0xbf6c('0xd'))(new Redis(config[_0xbf6c('0xa')]));require(_0xbf6c('0xe'))[_0xbf6c('0xf')](socket);function respondWithRpcPromise(_0x6220df,_0x5569ab,_0xefea7b){return new BPromise(function(_0x5ca195,_0xc9a7db){return client[_0xbf6c('0x10')](_0x6220df,_0xefea7b)[_0xbf6c('0x11')](function(_0x3ee25c){logger[_0xbf6c('0x12')]('FaxAccount,\x20%s,\x20%s',_0x5569ab,'request\x20sent');logger[_0xbf6c('0x13')](_0xbf6c('0x14'),_0x5569ab,_0xbf6c('0x15'),JSON[_0xbf6c('0x16')](_0x3ee25c));if(_0x3ee25c[_0xbf6c('0x17')]){if(_0x3ee25c['error']['code']===0x1f4){logger[_0xbf6c('0x17')](_0xbf6c('0x18'),_0x5569ab,_0x3ee25c[_0xbf6c('0x17')]['message']);return _0xc9a7db(_0x3ee25c[_0xbf6c('0x17')]['message']);}logger['error'](_0xbf6c('0x18'),_0x5569ab,_0x3ee25c[_0xbf6c('0x17')][_0xbf6c('0x19')]);return _0x5ca195(_0x3ee25c[_0xbf6c('0x17')][_0xbf6c('0x19')]);}else{logger[_0xbf6c('0x12')]('FaxAccount,\x20%s,\x20%s',_0x5569ab,_0xbf6c('0x15'));_0x5ca195(_0x3ee25c[_0xbf6c('0x1a')]['message']);}})['catch'](function(_0x4881c2){logger['error'](_0xbf6c('0x18'),_0x5569ab,_0x4881c2);_0xc9a7db(_0x4881c2);});});}exports[_0xbf6c('0x1b')]=function(_0x1d764d){var _0x3f30fe=this;return new Promise(function(_0x1252f5,_0x8f312d){return db['FaxAccount'][_0xbf6c('0x1c')]({'raw':_0x1d764d[_0xbf6c('0x1d')]?_0x1d764d['options'][_0xbf6c('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d764d[_0xbf6c('0x1d')]?_0x1d764d[_0xbf6c('0x1d')][_0xbf6c('0x1f')]||null:null,'attributes':_0x1d764d[_0xbf6c('0x1d')]?_0x1d764d[_0xbf6c('0x1d')]['attributes']||null:null,'limit':_0x1d764d[_0xbf6c('0x1d')]?_0x1d764d[_0xbf6c('0x1d')][_0xbf6c('0x20')]||null:null,'include':_0x1d764d[_0xbf6c('0x1d')]?_0x1d764d['options']['include']?_['map'](_0x1d764d[_0xbf6c('0x1d')][_0xbf6c('0x21')],function(_0x142fda){return{'model':db[_0x142fda[_0xbf6c('0x22')]],'as':_0x142fda['as'],'attributes':_0x142fda[_0xbf6c('0x23')],'include':_0x142fda[_0xbf6c('0x21')]?_[_0xbf6c('0x24')](_0x142fda[_0xbf6c('0x21')],function(_0x31998a){return{'model':db[_0x31998a[_0xbf6c('0x22')]],'as':_0x31998a['as'],'attributes':_0x31998a[_0xbf6c('0x23')],'include':_0x31998a['include']?_['map'](_0x31998a['include'],function(_0x1380a8){return{'model':db[_0x1380a8['model']],'as':_0x1380a8['as'],'attributes':_0x1380a8['attributes']};}):[]};}):[]};}):[]:[]})[_0xbf6c('0x11')](function(_0x25896d){logger[_0xbf6c('0x12')](_0xbf6c('0x1b'),_0x1d764d);logger['debug'](_0xbf6c('0x1b'),_0x1d764d,JSON[_0xbf6c('0x16')](_0x25896d));_0x1252f5(_0x25896d);})[_0xbf6c('0x25')](function(_0x5d7547){logger[_0xbf6c('0x17')](_0xbf6c('0x1b'),_0x5d7547[_0xbf6c('0x19')],_0x1d764d);_0x8f312d(_0x3f30fe['error'](0x1f4,_0x5d7547[_0xbf6c('0x19')]));});});};exports[_0xbf6c('0x26')]=function(_0x527b98,_0x2db178,_0x1e07f4){var _0x545e0a=this;return new Promise(function(_0x5e22a8,_0x3606ca){var _0x43b40c={'body':_0x527b98['body'],'channel':_0xbf6c('0x27')};var _0x574b67=[];var _0xf11ee2=[];var _0x30db39={};return db[_0xbf6c('0x28')][_0xbf6c('0x29')]()[_0xbf6c('0x11')](function(_0x27dd71){if(!_0x27dd71){throw new db[(_0xbf6c('0x2a'))][(_0xbf6c('0x2b'))](_0xbf6c('0x2c'));}_0x574b67=_[_0xbf6c('0x2d')](_['keys'](_0x27dd71),['createdAt',_0xbf6c('0x2e')]);_0xf11ee2=_[_0xbf6c('0x2d')](_['keys'](_0x27dd71),[_0xbf6c('0x2f'),'updatedAt','CompanyId',_0xbf6c('0x30')]);if(_0x527b98[_0xbf6c('0x31')]['id']){delete _0x527b98[_0xbf6c('0x31')]['id'];}if(_[_0xbf6c('0x32')](_0x527b98['body']['from'])){throw new db[(_0xbf6c('0x2a'))]['ValidationError'](_0xbf6c('0x33'));}if(_['isNil'](_0x527b98[_0xbf6c('0x31')]['body'])||_0x527b98[_0xbf6c('0x31')][_0xbf6c('0x31')]===''){throw new db[(_0xbf6c('0x2a'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbf6c('0x32')](_0x527b98[_0xbf6c('0x31')][_0xbf6c('0x34')])){throw new db['Sequelize'][(_0xbf6c('0x2b'))](_0xbf6c('0x35')+_0xf11ee2);}if(!_[_0xbf6c('0x36')](_0xf11ee2,_0x527b98[_0xbf6c('0x31')]['mapKey'])){throw new db['Sequelize'][(_0xbf6c('0x2b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xf11ee2);}_0x30db39[_0x527b98[_0xbf6c('0x31')][_0xbf6c('0x34')]]=_0x527b98[_0xbf6c('0x31')][_0xbf6c('0x37')];})[_0xbf6c('0x11')](function(){return db[_0xbf6c('0x38')]['find']({'where':{'id':_0x527b98[_0xbf6c('0x39')]['id']},'include':[{'model':db[_0xbf6c('0x3a')],'as':_0xbf6c('0x3b'),'include':[{'model':db[_0xbf6c('0x28')],'as':_0xbf6c('0x3c'),'where':_0x30db39,'limit':0x1,'order':[[_0xbf6c('0x2e'),_0xbf6c('0x3d')]]}]},{'model':db[_0xbf6c('0x3e')],'as':_0xbf6c('0x3f')}]});})[_0xbf6c('0x11')](function(_0x135427){if(_0x135427&&_0x135427['List']){var _0x3eb8bf=_0x135427[_0xbf6c('0x40')]({'plain':!![]});_0x43b40c[_0xbf6c('0x39')]=_0x3eb8bf;_0x43b40c[_0xbf6c('0x41')]=_0x3eb8bf[_0xbf6c('0x3f')];_0x43b40c[_0xbf6c('0x42')]=_0x3eb8bf['List'];_0x43b40c[_0xbf6c('0x41')]=_[_0xbf6c('0x43')](_0x43b40c['applications'],[_0xbf6c('0x44')],[_0xbf6c('0x45')]);if(_0x43b40c['account'][_0xbf6c('0x3f')]){delete _0x43b40c[_0xbf6c('0x39')][_0xbf6c('0x3f')];}if(_0x43b40c[_0xbf6c('0x39')][_0xbf6c('0x3b')]&&_0x43b40c[_0xbf6c('0x39')]['List'][_0xbf6c('0x3c')][_0xbf6c('0x46')]){return _0x43b40c[_0xbf6c('0x39')][_0xbf6c('0x3b')][_0xbf6c('0x3c')][0x0];}var _0x2a82a6=_[_0xbf6c('0xb')](_0x527b98[_0xbf6c('0x31')],{'firstName':_0x527b98['body'][_0xbf6c('0x37')],'ListId':_0x3eb8bf[_0xbf6c('0x30')]});_0x2a82a6[_0x527b98[_0xbf6c('0x31')]['mapKey']]=_0x527b98[_0xbf6c('0x31')][_0xbf6c('0x37')];return db[_0xbf6c('0x28')]['create'](_0x2a82a6,{'fields':_0x574b67,'raw':!![]});}})['then'](function(_0x80a1bc){_0x43b40c[_0xbf6c('0x47')]=_0x80a1bc;if(_0x80a1bc){var _0x10cdae={'ContactId':_0x80a1bc['id'],'FaxAccountId':_0x527b98[_0xbf6c('0x39')]['id'],'fax':_0x80a1bc[_0xbf6c('0x27')]};return db[_0xbf6c('0x48')][_0xbf6c('0x49')]({'where':{'ContactId':_0x80a1bc['id'],'closed':![],'FaxAccountId':_0x527b98[_0xbf6c('0x39')]['id']}})[_0xbf6c('0x11')](function(_0x52da20){if(_0x52da20){return[_0x52da20,![]];}return db['FaxInteraction'][_0xbf6c('0x4a')](_0x10cdae)['then'](function(_0x39107d){return[_0x39107d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x29b83d,_0x44254f){var _0x4124a0=_0x29b83d['get']({'plain':!![]});if(_0x44254f){if(_0x43b40c['account'][_0xbf6c('0x4b')]){_0x43b40c[_0xbf6c('0x41')][_0xbf6c('0x4c')]({'id':0x0,'priority':_0x43b40c[_0xbf6c('0x41')]['length']+0x1,'app':_0xbf6c('0x4d'),'appdata':'unmanaged','interval':_0xbf6c('0x4e')});}_0x4124a0[_0xbf6c('0x4f')]=!![];}else{_0x4124a0['created']=![];}_0x43b40c[_0xbf6c('0x50')]=_0x4124a0;return db[_0xbf6c('0x51')][_0xbf6c('0x4a')]({'body':_0x527b98[_0xbf6c('0x31')][_0xbf6c('0x31')],'FaxAccountId':_0x527b98[_0xbf6c('0x39')]['id'],'FaxInteractionId':_0x29b83d['id'],'direction':'in','ContactId':_0x29b83d[_0xbf6c('0x52')],'AttachmentId':_0x527b98[_0xbf6c('0x31')][_0xbf6c('0x53')]});})['then'](function(_0x28b7a3){_0x43b40c['message']=_0x28b7a3;if(_0x43b40c[_0xbf6c('0x50')][_0xbf6c('0x54')]){return db['User']['find']({'attributes':['id',_0xbf6c('0x55')],'where':{'id':_0x43b40c[_0xbf6c('0x50')][_0xbf6c('0x54')]}})[_0xbf6c('0x11')](function(_0x370977){if(_0x370977){_0x43b40c[_0xbf6c('0x41')][_0xbf6c('0x56')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x370977['name']+','+(_0x43b40c[_0xbf6c('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0xbf6c('0x4e')});}return respondWithRpcPromise(_0xbf6c('0x57'),_0xbf6c('0x58'),_0x43b40c);});}return respondWithRpcPromise(_0xbf6c('0x57'),_0xbf6c('0x58'),_0x43b40c);})[_0xbf6c('0x11')](function(_0x1a6aa0){_0x5e22a8(_0x1a6aa0);})['catch'](function(_0x3baa52){_0x3606ca(_0x545e0a[_0xbf6c('0x17')](0x1f4,_0x3baa52[_0xbf6c('0x19')]));});});}; \ No newline at end of file +var _0x755d=['localhost','./faxAccount.socket','register','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','limit','include','attributes','map','model','NotifyFaxAccount','fax','CmContact','describe','Sequelize','keys','updatedAt','createdAt','CompanyId','ListId','body','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','CmList','Contacts','DESC','FaxApplication','Applications','List','applications','orderBy','priority','account','defaults','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','User','name','UserId','unshift','agent','Start','startRouting','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis'];(function(_0x515f78,_0x3b69be){var _0x506f6c=function(_0x14da41){while(--_0x14da41){_0x515f78['push'](_0x515f78['shift']());}};_0x506f6c(++_0x3b69be);}(_0x755d,0x1b3));var _0xd755=function(_0x16a637,_0x5eb627){_0x16a637=_0x16a637-0x0;var _0x25126d=_0x755d[_0x16a637];return _0x25126d;};'use strict';var _=require(_0xd755('0x0'));var util=require(_0xd755('0x1'));var moment=require('moment');var BPromise=require(_0xd755('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd755('0x3'))['db'];var utils=require(_0xd755('0x4'));var logger=require(_0xd755('0x5'))(_0xd755('0x6'));var config=require(_0xd755('0x7'));var jayson=require(_0xd755('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0xd755('0x9')]=_['defaults'](config['redis'],{'host':_0xd755('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd755('0x9')]));require(_0xd755('0xb'))[_0xd755('0xc')](socket);function respondWithRpcPromise(_0x30cbfd,_0x74bb5e,_0x291759){return new BPromise(function(_0x2d6c25,_0xcf6ade){return client[_0xd755('0xd')](_0x30cbfd,_0x291759)[_0xd755('0xe')](function(_0x5e53db){logger['info']('FaxAccount,\x20%s,\x20%s',_0x74bb5e,_0xd755('0xf'));logger[_0xd755('0x10')](_0xd755('0x11'),_0x74bb5e,_0xd755('0xf'),JSON[_0xd755('0x12')](_0x5e53db));if(_0x5e53db[_0xd755('0x13')]){if(_0x5e53db['error'][_0xd755('0x14')]===0x1f4){logger['error'](_0xd755('0x15'),_0x74bb5e,_0x5e53db[_0xd755('0x13')][_0xd755('0x16')]);return _0xcf6ade(_0x5e53db[_0xd755('0x13')][_0xd755('0x16')]);}logger[_0xd755('0x13')](_0xd755('0x15'),_0x74bb5e,_0x5e53db[_0xd755('0x13')][_0xd755('0x16')]);return _0x2d6c25(_0x5e53db[_0xd755('0x13')][_0xd755('0x16')]);}else{logger[_0xd755('0x17')](_0xd755('0x15'),_0x74bb5e,'request\x20sent');_0x2d6c25(_0x5e53db[_0xd755('0x18')]['message']);}})[_0xd755('0x19')](function(_0x29a9fb){logger[_0xd755('0x13')](_0xd755('0x15'),_0x74bb5e,_0x29a9fb);_0xcf6ade(_0x29a9fb);});});}exports[_0xd755('0x1a')]=function(_0x3322f0){var _0x2e6f09=this;return new Promise(function(_0x321dfc,_0x1a8202){return db[_0xd755('0x1b')][_0xd755('0x1c')]({'raw':_0x3322f0[_0xd755('0x1d')]?_0x3322f0[_0xd755('0x1d')][_0xd755('0x1e')]===undefined?!![]:![]:!![],'where':_0x3322f0['options']?_0x3322f0[_0xd755('0x1d')][_0xd755('0x1f')]||null:null,'attributes':_0x3322f0[_0xd755('0x1d')]?_0x3322f0[_0xd755('0x1d')]['attributes']||null:null,'limit':_0x3322f0[_0xd755('0x1d')]?_0x3322f0[_0xd755('0x1d')][_0xd755('0x20')]||null:null,'include':_0x3322f0['options']?_0x3322f0[_0xd755('0x1d')][_0xd755('0x21')]?_['map'](_0x3322f0['options'][_0xd755('0x21')],function(_0xcef59b){return{'model':db[_0xcef59b['model']],'as':_0xcef59b['as'],'attributes':_0xcef59b[_0xd755('0x22')],'include':_0xcef59b[_0xd755('0x21')]?_[_0xd755('0x23')](_0xcef59b[_0xd755('0x21')],function(_0x1d3d48){return{'model':db[_0x1d3d48['model']],'as':_0x1d3d48['as'],'attributes':_0x1d3d48[_0xd755('0x22')],'include':_0x1d3d48['include']?_[_0xd755('0x23')](_0x1d3d48['include'],function(_0x483c5e){return{'model':db[_0x483c5e[_0xd755('0x24')]],'as':_0x483c5e['as'],'attributes':_0x483c5e[_0xd755('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb1f192){logger[_0xd755('0x17')](_0xd755('0x1a'),_0x3322f0);logger[_0xd755('0x10')](_0xd755('0x1a'),_0x3322f0,JSON[_0xd755('0x12')](_0xb1f192));_0x321dfc(_0xb1f192);})[_0xd755('0x19')](function(_0x16ec9d){logger[_0xd755('0x13')](_0xd755('0x1a'),_0x16ec9d['message'],_0x3322f0);_0x1a8202(_0x2e6f09[_0xd755('0x13')](0x1f4,_0x16ec9d[_0xd755('0x16')]));});});};exports[_0xd755('0x25')]=function(_0x579012,_0x5d568d,_0x11bcc1){var _0x469e59=this;return new Promise(function(_0x2dad7f,_0x158896){var _0x30c986={'body':_0x579012['body'],'channel':_0xd755('0x26')};var _0x582fe9=[];var _0x16de64=[];var _0x3bb2bc={};return db[_0xd755('0x27')][_0xd755('0x28')]()[_0xd755('0xe')](function(_0xf0d7d9){if(!_0xf0d7d9){throw new db[(_0xd755('0x29'))]['ValidationError']('no\x20available\x20attributes');}_0x582fe9=_['difference'](_[_0xd755('0x2a')](_0xf0d7d9),['createdAt',_0xd755('0x2b')]);_0x16de64=_['difference'](_[_0xd755('0x2a')](_0xf0d7d9),[_0xd755('0x2c'),_0xd755('0x2b'),_0xd755('0x2d'),_0xd755('0x2e')]);if(_0x579012[_0xd755('0x2f')]['id']){delete _0x579012[_0xd755('0x2f')]['id'];}if(_['isNil'](_0x579012[_0xd755('0x2f')]['from'])){throw new db[(_0xd755('0x29'))][(_0xd755('0x30'))](_0xd755('0x31'));}if(_[_0xd755('0x32')](_0x579012[_0xd755('0x2f')]['body'])||_0x579012[_0xd755('0x2f')][_0xd755('0x2f')]===''){throw new db['Sequelize']['ValidationError'](_0xd755('0x33'));}if(_[_0xd755('0x32')](_0x579012[_0xd755('0x2f')][_0xd755('0x34')])){throw new db[(_0xd755('0x29'))][(_0xd755('0x30'))](_0xd755('0x35')+_0x16de64);}if(!_[_0xd755('0x36')](_0x16de64,_0x579012[_0xd755('0x2f')]['mapKey'])){throw new db[(_0xd755('0x29'))][(_0xd755('0x30'))](_0xd755('0x37')+_0x16de64);}_0x3bb2bc[_0x579012[_0xd755('0x2f')][_0xd755('0x34')]]=_0x579012[_0xd755('0x2f')][_0xd755('0x38')];})[_0xd755('0xe')](function(){return db[_0xd755('0x1b')][_0xd755('0x39')]({'where':{'id':_0x579012['account']['id']},'include':[{'model':db[_0xd755('0x3a')],'as':'List','include':[{'model':db[_0xd755('0x27')],'as':_0xd755('0x3b'),'where':_0x3bb2bc,'limit':0x1,'order':[[_0xd755('0x2b'),_0xd755('0x3c')]]}]},{'model':db[_0xd755('0x3d')],'as':_0xd755('0x3e')}]});})['then'](function(_0x22584d){if(_0x22584d&&_0x22584d[_0xd755('0x3f')]){var _0x418cf4=_0x22584d['get']({'plain':!![]});_0x30c986['account']=_0x418cf4;_0x30c986[_0xd755('0x40')]=_0x418cf4['Applications'];_0x30c986['list']=_0x418cf4[_0xd755('0x3f')];_0x30c986[_0xd755('0x40')]=_[_0xd755('0x41')](_0x30c986[_0xd755('0x40')],[_0xd755('0x42')],['asc']);if(_0x30c986[_0xd755('0x43')]['Applications']){delete _0x30c986[_0xd755('0x43')][_0xd755('0x3e')];}if(_0x30c986[_0xd755('0x43')][_0xd755('0x3f')]&&_0x30c986[_0xd755('0x43')][_0xd755('0x3f')][_0xd755('0x3b')]['length']){return _0x30c986[_0xd755('0x43')][_0xd755('0x3f')][_0xd755('0x3b')][0x0];}var _0x1e0ed8=_[_0xd755('0x44')](_0x579012['body'],{'firstName':_0x579012[_0xd755('0x2f')]['from'],'ListId':_0x418cf4[_0xd755('0x2e')]});_0x1e0ed8[_0x579012[_0xd755('0x2f')]['mapKey']]=_0x579012[_0xd755('0x2f')][_0xd755('0x38')];return db[_0xd755('0x27')][_0xd755('0x45')](_0x1e0ed8,{'fields':_0x582fe9,'raw':!![]});}})[_0xd755('0xe')](function(_0x10c3cf){_0x30c986['contact']=_0x10c3cf;if(_0x10c3cf){var _0x5d38fe={'ContactId':_0x10c3cf['id'],'FaxAccountId':_0x579012[_0xd755('0x43')]['id'],'fax':_0x10c3cf[_0xd755('0x26')]};return db[_0xd755('0x46')][_0xd755('0x39')]({'where':{'ContactId':_0x10c3cf['id'],'closed':![],'FaxAccountId':_0x579012[_0xd755('0x43')]['id']}})['then'](function(_0x5a80af){if(_0x5a80af){return[_0x5a80af,![]];}return db[_0xd755('0x46')][_0xd755('0x45')](_0x5d38fe)[_0xd755('0xe')](function(_0xe2b269){return[_0xe2b269,!![]];});});}else{throw new Error(_0xd755('0x47'));}})[_0xd755('0x48')](function(_0x1d57a7,_0x1efe26){var _0x14db53=_0x1d57a7['get']({'plain':!![]});if(_0x1efe26){if(_0x30c986['account'][_0xd755('0x49')]){_0x30c986[_0xd755('0x40')][_0xd755('0x4a')]({'id':0x0,'priority':_0x30c986[_0xd755('0x40')]['length']+0x1,'app':'close','appdata':_0xd755('0x4b'),'interval':_0xd755('0x4c')});}_0x14db53[_0xd755('0x4d')]=!![];}else{_0x14db53[_0xd755('0x4d')]=![];}_0x30c986['interaction']=_0x14db53;return db[_0xd755('0x4e')][_0xd755('0x45')]({'body':_0x579012[_0xd755('0x2f')][_0xd755('0x2f')],'FaxAccountId':_0x579012['account']['id'],'FaxInteractionId':_0x1d57a7['id'],'direction':'in','ContactId':_0x1d57a7[_0xd755('0x4f')],'AttachmentId':_0x579012[_0xd755('0x2f')][_0xd755('0x50')]});})['then'](function(_0x4f7034){_0x30c986['message']=_0x4f7034;if(_0x30c986[_0xd755('0x51')]['UserId']){return db[_0xd755('0x52')][_0xd755('0x39')]({'attributes':['id',_0xd755('0x53')],'where':{'id':_0x30c986[_0xd755('0x51')][_0xd755('0x54')]}})[_0xd755('0xe')](function(_0x3fd1b2){if(_0x3fd1b2){_0x30c986[_0xd755('0x40')][_0xd755('0x55')]({'id':0x0,'priority':0x0,'app':_0xd755('0x56'),'appdata':_0x3fd1b2[_0xd755('0x53')]+','+(_0x30c986[_0xd755('0x43')]['waitForTheAssignedAgent']||0xa),'interval':_0xd755('0x4c')});}return respondWithRpcPromise(_0xd755('0x57'),'startRouting',_0x30c986);});}return respondWithRpcPromise(_0xd755('0x57'),_0xd755('0x58'),_0x30c986);})[_0xd755('0xe')](function(_0x72f6b8){_0x2dad7f(_0x72f6b8);})[_0xd755('0x19')](function(_0x5925e0){_0x158896(_0x469e59[_0xd755('0x13')](0x1f4,_0x5925e0[_0xd755('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 5917d66..17569d9 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 _0x72c4=['register','length','faxAccount:','save','update','removeListener'];(function(_0x2ba9ac,_0xa1fdc4){var _0x1b0fc9=function(_0x4343de){while(--_0x4343de){_0x2ba9ac['push'](_0x2ba9ac['shift']());}};_0x1b0fc9(++_0xa1fdc4);}(_0x72c4,0x189));var _0x472c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x72c4[_0x167cc1];return _0x10bc4b;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x472c('0x0'),'remove',_0x472c('0x1')];function createListener(_0x53df3f,_0x1cbc39){return function(_0x5f088c){_0x1cbc39['emit'](_0x53df3f,_0x5f088c);};}function removeListener(_0x12769a,_0x469e66){return function(){FaxAccountEvents[_0x472c('0x2')](_0x12769a,_0x469e66);};}exports[_0x472c('0x3')]=function(_0x2b88da){for(var _0x3d10bb=0x0,_0xf658d7=events[_0x472c('0x4')];_0x3d10bb<_0xf658d7;_0x3d10bb++){var _0x5735a8=events[_0x3d10bb];var _0x51c0e3=createListener(_0x472c('0x5')+_0x5735a8,_0x2b88da);FaxAccountEvents['on'](_0x5735a8,_0x51c0e3);}}; \ No newline at end of file +var _0x618a=['emit','removeListener','remove','update'];(function(_0x56e8c5,_0x3b70e1){var _0x32b7c2=function(_0x3392a6){while(--_0x3392a6){_0x56e8c5['push'](_0x56e8c5['shift']());}};_0x32b7c2(++_0x3b70e1);}(_0x618a,0xe6));var _0xa618=function(_0x86bf72,_0x3bb497){_0x86bf72=_0x86bf72-0x0;var _0x4e8131=_0x618a[_0x86bf72];return _0x4e8131;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0xa618('0x0'),_0xa618('0x1')];function createListener(_0x44e495,_0x1933c2){return function(_0x3c045d){_0x1933c2[_0xa618('0x2')](_0x44e495,_0x3c045d);};}function removeListener(_0x443b04,_0x199c25){return function(){FaxAccountEvents[_0xa618('0x3')](_0x443b04,_0x199c25);};}exports['register']=function(_0x1bced7){for(var _0x3c0add=0x0,_0x3f7ac4=events['length'];_0x3c0add<_0x3f7ac4;_0x3c0add++){var _0x5bbbd4=events[_0x3c0add];var _0x1cc5e0=createListener('faxAccount:'+_0x5bbbd4,_0x1bced7);FaxAccountEvents['on'](_0x5bbbd4,_0x1cc5e0);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 8af4569..48e8d9b 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x117523,_0x41a999){var _0x31f34a=function(_0x3feaa6){while(--_0x3feaa6){_0x117523['push'](_0x117523['shift']());}};_0x31f34a(++_0x41a999);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x4b72ec,_0x455b1f){var _0x50fb52=function(_0x1f7c57){while(--_0x1f7c57){_0x4b72ec['push'](_0x4b72ec['shift']());}};_0x50fb52(++_0x455b1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index dda33b2..7975812 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 _0x294b=['exports','INTEGER','STRING','TEXT'];(function(_0x187f66,_0xbb607b){var _0x422e00=function(_0x1120f9){while(--_0x1120f9){_0x187f66['push'](_0x187f66['shift']());}};_0x422e00(++_0xbb607b);}(_0x294b,0x1e0));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xb294('0x0')]={'priority':{'type':Sequelize[_0xb294('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb294('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb294('0x3')]()},'description':{'type':Sequelize[_0xb294('0x2')]},'interval':{'type':Sequelize[_0xb294('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x332a=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x332a,0x167));var _0xa332=function(_0x5cb6f3,_0x4085bc){_0x5cb6f3=_0x5cb6f3-0x0;var _0x225ffe=_0x332a[_0x5cb6f3];return _0x225ffe;};'use strict';var Sequelize=require(_0xa332('0x0'));module[_0xa332('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa332('0x2')],'allowNull':![],'defaultValue':_0xa332('0x3')},'appdata':{'type':Sequelize[_0xa332('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa332('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 523befa..29df818 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 _0x5c3e=['destroy','end','sendStatus','stack','name','index','map','FaxApplication','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','type','VIRTUAL','options','where','includeAll','include','rows','catch','params','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','then'];(function(_0x4b4d91,_0x2f97cf){var _0x4d5618=function(_0x53835c){while(--_0x53835c){_0x4b4d91['push'](_0x4b4d91['shift']());}};_0x4d5618(++_0x2f97cf);}(_0x5c3e,0xbf));var _0xe5c3=function(_0x49c6bd,_0x23ef94){_0x49c6bd=_0x49c6bd-0x0;var _0x24e120=_0x5c3e[_0x49c6bd];return _0x24e120;};'use strict';var emlformat=require(_0xe5c3('0x0'));var rimraf=require(_0xe5c3('0x1'));var zipdir=require(_0xe5c3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5c3('0x3'));var moment=require(_0xe5c3('0x4'));var BPromise=require(_0xe5c3('0x5'));var Mustache=require(_0xe5c3('0x6'));var util=require('util');var path=require(_0xe5c3('0x7'));var sox=require(_0xe5c3('0x8'));var csv=require(_0xe5c3('0x9'));var ejs=require(_0xe5c3('0xa'));var fs=require('fs');var fs_extra=require(_0xe5c3('0xb'));var _=require('lodash');var squel=require(_0xe5c3('0xc'));var crypto=require(_0xe5c3('0xd'));var jsforce=require(_0xe5c3('0xe'));var deskjs=require(_0xe5c3('0xf'));var toCsv=require(_0xe5c3('0x9'));var querystring=require(_0xe5c3('0x10'));var Papa=require(_0xe5c3('0x11'));var Redis=require(_0xe5c3('0x12'));var authService=require(_0xe5c3('0x13'));var qs=require(_0xe5c3('0x14'));var as=require(_0xe5c3('0x15'));var hardwareService=require(_0xe5c3('0x16'));var logger=require(_0xe5c3('0x17'))(_0xe5c3('0x18'));var utils=require(_0xe5c3('0x19'));var config=require(_0xe5c3('0x1a'));var licenseUtil=require(_0xe5c3('0x1b'));var db=require(_0xe5c3('0x1c'))['db'];function respondWithStatusCode(_0x4ab32b,_0x5edf3a){_0x5edf3a=_0x5edf3a||0xcc;return function(_0x5d6e98){if(_0x5d6e98){return _0x4ab32b['sendStatus'](_0x5edf3a);}return _0x4ab32b[_0xe5c3('0x1d')](_0x5edf3a)['end']();};}function respondWithResult(_0x384be1,_0x483a0c){_0x483a0c=_0x483a0c||0xc8;return function(_0x36f77f){if(_0x36f77f){return _0x384be1['status'](_0x483a0c)[_0xe5c3('0x1e')](_0x36f77f);}};}function respondWithFilteredResult(_0x44eb5e,_0x2ebeb5){return function(_0x5321f0){if(_0x5321f0){var _0x50ec69=typeof _0x2ebeb5[_0xe5c3('0x1f')]===_0xe5c3('0x20')&&typeof _0x2ebeb5[_0xe5c3('0x21')]==='undefined';var _0xb571f2=_0x5321f0[_0xe5c3('0x22')];var _0x11c97f=_0x50ec69?0x0:_0x2ebeb5[_0xe5c3('0x1f')];var _0xfa742c=_0x50ec69?_0x5321f0[_0xe5c3('0x22')]:_0x2ebeb5['offset']+_0x2ebeb5[_0xe5c3('0x21')];var _0x5c2496;if(_0xfa742c>=_0xb571f2){_0xfa742c=_0xb571f2;_0x5c2496=0xc8;}else{_0x5c2496=0xce;}_0x44eb5e[_0xe5c3('0x1d')](_0x5c2496);return _0x44eb5e[_0xe5c3('0x23')]('Content-Range',_0x11c97f+'-'+_0xfa742c+'/'+_0xb571f2)['json'](_0x5321f0);}return null;};}function patchUpdates(_0x4623c9){return function(_0x143fb5){try{jsonpatch[_0xe5c3('0x24')](_0x143fb5,_0x4623c9,!![]);}catch(_0x5d900e){return BPromise[_0xe5c3('0x25')](_0x5d900e);}return _0x143fb5[_0xe5c3('0x26')]();};}function saveUpdates(_0xff8845,_0xabcc28){return function(_0x542ad1){if(_0x542ad1){return _0x542ad1['update'](_0xff8845)[_0xe5c3('0x27')](function(_0x1af9b9){return _0x1af9b9;});}return null;};}function removeEntity(_0x765b81,_0x2c3b76){return function(_0x472e6f){if(_0x472e6f){return _0x472e6f[_0xe5c3('0x28')]()[_0xe5c3('0x27')](function(){_0x765b81[_0xe5c3('0x1d')](0xcc)[_0xe5c3('0x29')]();});}};}function handleEntityNotFound(_0x1c0b74,_0x1ca8e8){return function(_0x9bfb15){if(!_0x9bfb15){_0x1c0b74[_0xe5c3('0x2a')](0x194);}return _0x9bfb15;};}function handleError(_0x1e7379,_0x43bcc9){_0x43bcc9=_0x43bcc9||0x1f4;return function(_0x2f7a1e){logger['error'](_0x2f7a1e[_0xe5c3('0x2b')]);if(_0x2f7a1e[_0xe5c3('0x2c')]){delete _0x2f7a1e[_0xe5c3('0x2c')];}_0x1e7379[_0xe5c3('0x1d')](_0x43bcc9)['send'](_0x2f7a1e);};}exports[_0xe5c3('0x2d')]=function(_0x1e2c7d,_0x421f27){var _0x4de10f={},_0x1e8ac0={},_0x458cf3={'count':0x0,'rows':[]};var _0x5c5f02=_[_0xe5c3('0x2e')](db[_0xe5c3('0x2f')]['rawAttributes'],function(_0x141e29){return{'name':_0x141e29['fieldName'],'type':_0x141e29['type'][_0xe5c3('0x30')]};});_0x1e8ac0[_0xe5c3('0x31')]=_['map'](_0x5c5f02,_0xe5c3('0x2c'));_0x1e8ac0['query']=_[_0xe5c3('0x32')](_0x1e2c7d[_0xe5c3('0x33')]);_0x1e8ac0['filters']=_[_0xe5c3('0x34')](_0x1e8ac0['model'],_0x1e8ac0[_0xe5c3('0x33')]);_0x4de10f[_0xe5c3('0x35')]=_['intersection'](_0x1e8ac0[_0xe5c3('0x31')],qs['fields'](_0x1e2c7d[_0xe5c3('0x33')][_0xe5c3('0x36')]));_0x4de10f['attributes']=_0x4de10f[_0xe5c3('0x35')][_0xe5c3('0x37')]?_0x4de10f[_0xe5c3('0x35')]:_0x1e8ac0[_0xe5c3('0x31')];if(!_0x1e2c7d[_0xe5c3('0x33')][_0xe5c3('0x38')](_0xe5c3('0x39'))){_0x4de10f['limit']=qs[_0xe5c3('0x21')](_0x1e2c7d[_0xe5c3('0x33')]['limit']);_0x4de10f[_0xe5c3('0x1f')]=qs[_0xe5c3('0x1f')](_0x1e2c7d[_0xe5c3('0x33')][_0xe5c3('0x1f')]);}_0x4de10f[_0xe5c3('0x3a')]=qs['sort'](_0x1e2c7d[_0xe5c3('0x33')][_0xe5c3('0x3b')]);_0x4de10f['where']=qs[_0xe5c3('0x3c')](_[_0xe5c3('0x3d')](_0x1e2c7d['query'],_0x1e8ac0['filters']),_0x5c5f02);if(_0x1e2c7d[_0xe5c3('0x33')][_0xe5c3('0x3e')]){_0x4de10f['where']=_[_0xe5c3('0x3f')](_0x4de10f['where'],{'$or':_[_0xe5c3('0x2e')](_0x5c5f02,function(_0x106e7d){if(_0x106e7d[_0xe5c3('0x40')]!==_0xe5c3('0x41')){var _0x187d82={};_0x187d82[_0x106e7d[_0xe5c3('0x2c')]]={'$like':'%'+_0x1e2c7d['query'][_0xe5c3('0x3e')]+'%'};return _0x187d82;}})});}_0x4de10f=_[_0xe5c3('0x3f')]({},_0x4de10f,_0x1e2c7d[_0xe5c3('0x42')]);var _0x21124e={'where':_0x4de10f[_0xe5c3('0x43')]};return db[_0xe5c3('0x2f')][_0xe5c3('0x22')](_0x21124e)[_0xe5c3('0x27')](function(_0x420e14){_0x458cf3['count']=_0x420e14;if(_0x1e2c7d[_0xe5c3('0x33')][_0xe5c3('0x44')]){_0x4de10f[_0xe5c3('0x45')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x4de10f);})[_0xe5c3('0x27')](function(_0x51f670){_0x458cf3[_0xe5c3('0x46')]=_0x51f670;return _0x458cf3;})[_0xe5c3('0x27')](respondWithFilteredResult(_0x421f27,_0x4de10f))[_0xe5c3('0x47')](handleError(_0x421f27,null));};exports['show']=function(_0x107612,_0x464803){var _0x43b06c={'raw':!![],'where':{'id':_0x107612[_0xe5c3('0x48')]['id']}},_0x8ba8cf={};_0x8ba8cf['model']=_['keys'](db['FaxApplication']['rawAttributes']);_0x8ba8cf[_0xe5c3('0x33')]=_[_0xe5c3('0x32')](_0x107612['query']);_0x8ba8cf['filters']=_[_0xe5c3('0x34')](_0x8ba8cf[_0xe5c3('0x31')],_0x8ba8cf[_0xe5c3('0x33')]);_0x43b06c['attributes']=_[_0xe5c3('0x34')](_0x8ba8cf[_0xe5c3('0x31')],qs[_0xe5c3('0x36')](_0x107612['query'][_0xe5c3('0x36')]));_0x43b06c[_0xe5c3('0x35')]=_0x43b06c[_0xe5c3('0x35')][_0xe5c3('0x37')]?_0x43b06c[_0xe5c3('0x35')]:_0x8ba8cf['model'];if(_0x107612['query'][_0xe5c3('0x44')]){_0x43b06c[_0xe5c3('0x45')]=[{'all':!![]}];}_0x43b06c=_[_0xe5c3('0x3f')]({},_0x43b06c,_0x107612[_0xe5c3('0x42')]);return db[_0xe5c3('0x2f')][_0xe5c3('0x49')](_0x43b06c)[_0xe5c3('0x27')](handleEntityNotFound(_0x464803,null))[_0xe5c3('0x27')](respondWithResult(_0x464803,null))[_0xe5c3('0x47')](handleError(_0x464803,null));};exports[_0xe5c3('0x4a')]=function(_0x4ddc14,_0x197541){return db[_0xe5c3('0x2f')]['create'](_0x4ddc14[_0xe5c3('0x4b')],{})['then'](respondWithResult(_0x197541,0xc9))[_0xe5c3('0x47')](handleError(_0x197541,null));};exports[_0xe5c3('0x4c')]=function(_0x1900b1,_0x5e5273){if(_0x1900b1[_0xe5c3('0x4b')]['id']){delete _0x1900b1[_0xe5c3('0x4b')]['id'];}return db[_0xe5c3('0x2f')][_0xe5c3('0x49')]({'where':{'id':_0x1900b1[_0xe5c3('0x48')]['id']}})[_0xe5c3('0x27')](handleEntityNotFound(_0x5e5273,null))[_0xe5c3('0x27')](saveUpdates(_0x1900b1[_0xe5c3('0x4b')],null))[_0xe5c3('0x27')](respondWithResult(_0x5e5273,null))[_0xe5c3('0x47')](handleError(_0x5e5273,null));};exports[_0xe5c3('0x28')]=function(_0x182d54,_0x2d0b6d){return db[_0xe5c3('0x2f')][_0xe5c3('0x49')]({'where':{'id':_0x182d54['params']['id']}})[_0xe5c3('0x27')](handleEntityNotFound(_0x2d0b6d,null))['then'](removeEntity(_0x2d0b6d,null))[_0xe5c3('0x47')](handleError(_0x2d0b6d,null));}; \ No newline at end of file +var _0xe6f7=['../../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','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxApplication','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xe6f7,0x1c9));var _0x7e6f=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0xe6f7[_0x525b28];return _0x180178;};'use strict';var emlformat=require(_0x7e6f('0x0'));var rimraf=require(_0x7e6f('0x1'));var zipdir=require(_0x7e6f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e6f('0x3'));var moment=require(_0x7e6f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7e6f('0x5'));var util=require(_0x7e6f('0x6'));var path=require('path');var sox=require(_0x7e6f('0x7'));var csv=require(_0x7e6f('0x8'));var ejs=require(_0x7e6f('0x9'));var fs=require('fs');var fs_extra=require(_0x7e6f('0xa'));var _=require(_0x7e6f('0xb'));var squel=require('squel');var crypto=require(_0x7e6f('0xc'));var jsforce=require(_0x7e6f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7e6f('0x8'));var querystring=require(_0x7e6f('0xe'));var Papa=require(_0x7e6f('0xf'));var Redis=require(_0x7e6f('0x10'));var authService=require(_0x7e6f('0x11'));var qs=require(_0x7e6f('0x12'));var as=require(_0x7e6f('0x13'));var hardwareService=require(_0x7e6f('0x14'));var logger=require(_0x7e6f('0x15'))(_0x7e6f('0x16'));var utils=require(_0x7e6f('0x17'));var config=require(_0x7e6f('0x18'));var licenseUtil=require(_0x7e6f('0x19'));var db=require(_0x7e6f('0x1a'))['db'];function respondWithStatusCode(_0x6ca599,_0x5bf0e1){_0x5bf0e1=_0x5bf0e1||0xcc;return function(_0x2f7546){if(_0x2f7546){return _0x6ca599['sendStatus'](_0x5bf0e1);}return _0x6ca599['status'](_0x5bf0e1)[_0x7e6f('0x1b')]();};}function respondWithResult(_0x497a27,_0x27a615){_0x27a615=_0x27a615||0xc8;return function(_0x422c16){if(_0x422c16){return _0x497a27[_0x7e6f('0x1c')](_0x27a615)[_0x7e6f('0x1d')](_0x422c16);}};}function respondWithFilteredResult(_0x1210e5,_0x57c1c5){return function(_0x52fde3){if(_0x52fde3){var _0x166655=typeof _0x57c1c5[_0x7e6f('0x1e')]===_0x7e6f('0x1f')&&typeof _0x57c1c5[_0x7e6f('0x20')]===_0x7e6f('0x1f');var _0x4fc5f1=_0x52fde3[_0x7e6f('0x21')];var _0x154e93=_0x166655?0x0:_0x57c1c5[_0x7e6f('0x1e')];var _0x16c977=_0x166655?_0x52fde3[_0x7e6f('0x21')]:_0x57c1c5[_0x7e6f('0x1e')]+_0x57c1c5['limit'];var _0x541fd0;if(_0x16c977>=_0x4fc5f1){_0x16c977=_0x4fc5f1;_0x541fd0=0xc8;}else{_0x541fd0=0xce;}_0x1210e5[_0x7e6f('0x1c')](_0x541fd0);return _0x1210e5[_0x7e6f('0x22')](_0x7e6f('0x23'),_0x154e93+'-'+_0x16c977+'/'+_0x4fc5f1)[_0x7e6f('0x1d')](_0x52fde3);}return null;};}function patchUpdates(_0xb30979){return function(_0x295afb){try{jsonpatch[_0x7e6f('0x24')](_0x295afb,_0xb30979,!![]);}catch(_0x25bc4a){return BPromise[_0x7e6f('0x25')](_0x25bc4a);}return _0x295afb[_0x7e6f('0x26')]();};}function saveUpdates(_0x29317b,_0x9a753d){return function(_0x1b31d3){if(_0x1b31d3){return _0x1b31d3[_0x7e6f('0x27')](_0x29317b)[_0x7e6f('0x28')](function(_0x2a89cd){return _0x2a89cd;});}return null;};}function removeEntity(_0x201dc0,_0x54c651){return function(_0x2bbd0f){if(_0x2bbd0f){return _0x2bbd0f[_0x7e6f('0x29')]()[_0x7e6f('0x28')](function(){_0x201dc0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdc0a5,_0x2eb972){return function(_0x5aaf81){if(!_0x5aaf81){_0xdc0a5[_0x7e6f('0x2a')](0x194);}return _0x5aaf81;};}function handleError(_0xa68bc5,_0x199ec8){_0x199ec8=_0x199ec8||0x1f4;return function(_0x14a7aa){logger[_0x7e6f('0x2b')](_0x14a7aa[_0x7e6f('0x2c')]);if(_0x14a7aa[_0x7e6f('0x2d')]){delete _0x14a7aa[_0x7e6f('0x2d')];}_0xa68bc5[_0x7e6f('0x1c')](_0x199ec8)[_0x7e6f('0x2e')](_0x14a7aa);};}exports[_0x7e6f('0x2f')]=function(_0x64f882,_0x2363cf){var _0x1d652d={},_0x1fc23f={},_0x2aa6ff={'count':0x0,'rows':[]};var _0x1e76fe=_[_0x7e6f('0x30')](db[_0x7e6f('0x31')]['rawAttributes'],function(_0x2d6c5e){return{'name':_0x2d6c5e['fieldName'],'type':_0x2d6c5e[_0x7e6f('0x32')][_0x7e6f('0x33')]};});_0x1fc23f[_0x7e6f('0x34')]=_['map'](_0x1e76fe,'name');_0x1fc23f[_0x7e6f('0x35')]=_[_0x7e6f('0x36')](_0x64f882[_0x7e6f('0x35')]);_0x1fc23f[_0x7e6f('0x37')]=_[_0x7e6f('0x38')](_0x1fc23f[_0x7e6f('0x34')],_0x1fc23f[_0x7e6f('0x35')]);_0x1d652d[_0x7e6f('0x39')]=_[_0x7e6f('0x38')](_0x1fc23f['model'],qs['fields'](_0x64f882['query'][_0x7e6f('0x3a')]));_0x1d652d[_0x7e6f('0x39')]=_0x1d652d[_0x7e6f('0x39')]['length']?_0x1d652d[_0x7e6f('0x39')]:_0x1fc23f[_0x7e6f('0x34')];if(!_0x64f882['query'][_0x7e6f('0x3b')]('nolimit')){_0x1d652d['limit']=qs[_0x7e6f('0x20')](_0x64f882[_0x7e6f('0x35')][_0x7e6f('0x20')]);_0x1d652d['offset']=qs[_0x7e6f('0x1e')](_0x64f882[_0x7e6f('0x35')][_0x7e6f('0x1e')]);}_0x1d652d[_0x7e6f('0x3c')]=qs[_0x7e6f('0x3d')](_0x64f882[_0x7e6f('0x35')]['sort']);_0x1d652d['where']=qs[_0x7e6f('0x37')](_[_0x7e6f('0x3e')](_0x64f882[_0x7e6f('0x35')],_0x1fc23f[_0x7e6f('0x37')]),_0x1e76fe);if(_0x64f882[_0x7e6f('0x35')][_0x7e6f('0x3f')]){_0x1d652d['where']=_[_0x7e6f('0x40')](_0x1d652d[_0x7e6f('0x41')],{'$or':_['map'](_0x1e76fe,function(_0x2d3380){if(_0x2d3380['type']!==_0x7e6f('0x42')){var _0x314579={};_0x314579[_0x2d3380[_0x7e6f('0x2d')]]={'$like':'%'+_0x64f882['query'][_0x7e6f('0x3f')]+'%'};return _0x314579;}})});}_0x1d652d=_[_0x7e6f('0x40')]({},_0x1d652d,_0x64f882[_0x7e6f('0x43')]);var _0xc5a87e={'where':_0x1d652d[_0x7e6f('0x41')]};return db[_0x7e6f('0x31')][_0x7e6f('0x21')](_0xc5a87e)[_0x7e6f('0x28')](function(_0x3e2d67){_0x2aa6ff[_0x7e6f('0x21')]=_0x3e2d67;if(_0x64f882[_0x7e6f('0x35')][_0x7e6f('0x44')]){_0x1d652d[_0x7e6f('0x45')]=[{'all':!![]}];}return db[_0x7e6f('0x31')][_0x7e6f('0x46')](_0x1d652d);})[_0x7e6f('0x28')](function(_0x4f95f8){_0x2aa6ff[_0x7e6f('0x47')]=_0x4f95f8;return _0x2aa6ff;})[_0x7e6f('0x28')](respondWithFilteredResult(_0x2363cf,_0x1d652d))['catch'](handleError(_0x2363cf,null));};exports[_0x7e6f('0x48')]=function(_0xeb2888,_0x3e223d){var _0x73f429={'raw':!![],'where':{'id':_0xeb2888[_0x7e6f('0x49')]['id']}},_0x2f0c65={};_0x2f0c65[_0x7e6f('0x34')]=_[_0x7e6f('0x36')](db[_0x7e6f('0x31')][_0x7e6f('0x4a')]);_0x2f0c65['query']=_['keys'](_0xeb2888['query']);_0x2f0c65['filters']=_['intersection'](_0x2f0c65['model'],_0x2f0c65[_0x7e6f('0x35')]);_0x73f429[_0x7e6f('0x39')]=_[_0x7e6f('0x38')](_0x2f0c65[_0x7e6f('0x34')],qs[_0x7e6f('0x3a')](_0xeb2888[_0x7e6f('0x35')][_0x7e6f('0x3a')]));_0x73f429[_0x7e6f('0x39')]=_0x73f429['attributes'][_0x7e6f('0x4b')]?_0x73f429[_0x7e6f('0x39')]:_0x2f0c65['model'];if(_0xeb2888['query'][_0x7e6f('0x44')]){_0x73f429[_0x7e6f('0x45')]=[{'all':!![]}];}_0x73f429=_[_0x7e6f('0x40')]({},_0x73f429,_0xeb2888[_0x7e6f('0x43')]);return db[_0x7e6f('0x31')][_0x7e6f('0x4c')](_0x73f429)[_0x7e6f('0x28')](handleEntityNotFound(_0x3e223d,null))[_0x7e6f('0x28')](respondWithResult(_0x3e223d,null))[_0x7e6f('0x4d')](handleError(_0x3e223d,null));};exports['create']=function(_0x54cac1,_0x174d35){return db[_0x7e6f('0x31')]['create'](_0x54cac1['body'],{})[_0x7e6f('0x28')](respondWithResult(_0x174d35,0xc9))[_0x7e6f('0x4d')](handleError(_0x174d35,null));};exports['update']=function(_0x95b444,_0x451386){if(_0x95b444[_0x7e6f('0x4e')]['id']){delete _0x95b444['body']['id'];}return db[_0x7e6f('0x31')]['find']({'where':{'id':_0x95b444[_0x7e6f('0x49')]['id']}})[_0x7e6f('0x28')](handleEntityNotFound(_0x451386,null))[_0x7e6f('0x28')](saveUpdates(_0x95b444[_0x7e6f('0x4e')],null))[_0x7e6f('0x28')](respondWithResult(_0x451386,null))[_0x7e6f('0x4d')](handleError(_0x451386,null));};exports[_0x7e6f('0x29')]=function(_0x818785,_0x293853){return db[_0x7e6f('0x31')][_0x7e6f('0x4c')]({'where':{'id':_0x818785[_0x7e6f('0x49')]['id']}})['then'](handleEntityNotFound(_0x293853,null))['then'](removeEntity(_0x293853,null))['catch'](handleError(_0x293853,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 83e85ea..dae1d5a 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 _0x0ab6=['utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications'];(function(_0x26cf74,_0x3da273){var _0x886083=function(_0x4af2cc){while(--_0x4af2cc){_0x26cf74['push'](_0x26cf74['shift']());}};_0x886083(++_0x3da273);}(_0x0ab6,0x1d6));var _0x60ab=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0ab6[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x60ab('0x0'));var moment=require(_0x60ab('0x1'));var BPromise=require(_0x60ab('0x2'));var rp=require(_0x60ab('0x3'));var fs=require('fs');var path=require(_0x60ab('0x4'));var rimraf=require('rimraf');var config=require(_0x60ab('0x5'));var attributes=require(_0x60ab('0x6'));module[_0x60ab('0x7')]=function(_0x62877b,_0x59e423){return _0x62877b[_0x60ab('0x8')](_0x60ab('0x9'),attributes,{'tableName':_0x60ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x60ab('0xb'),'collate':_0x60ab('0xc')});}; \ No newline at end of file +var _0x40ba=['exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0x40ba,0xab));var _0xa40b=function(_0x1b76e6,_0x598520){_0x1b76e6=_0x1b76e6-0x0;var _0x333b53=_0x40ba[_0x1b76e6];return _0x333b53;};'use strict';var _=require(_0xa40b('0x0'));var util=require(_0xa40b('0x1'));var logger=require(_0xa40b('0x2'))(_0xa40b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa40b('0x4'));var fs=require('fs');var path=require(_0xa40b('0x5'));var rimraf=require(_0xa40b('0x6'));var config=require(_0xa40b('0x7'));var attributes=require(_0xa40b('0x8'));module[_0xa40b('0x9')]=function(_0x4e3115,_0x3bdbf5){return _0x4e3115[_0xa40b('0xa')](_0xa40b('0xb'),attributes,{'tableName':_0xa40b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa40b('0xd'),'collate':_0xa40b('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 83b3755..f282be4 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 _0x77aa=['message','info','result','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','then','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x4a3e36,_0x431412){var _0x50aebb=function(_0x51486c){while(--_0x51486c){_0x4a3e36['push'](_0x4a3e36['shift']());}};_0x50aebb(++_0x431412);}(_0x77aa,0x89));var _0xa77a=function(_0x438d43,_0x5cdc35){_0x438d43=_0x438d43-0x0;var _0x5a0cd3=_0x77aa[_0x438d43];return _0x5a0cd3;};'use strict';var _=require(_0xa77a('0x0'));var util=require(_0xa77a('0x1'));var moment=require(_0xa77a('0x2'));var BPromise=require('bluebird');var rs=require(_0xa77a('0x3'));var fs=require('fs');var Redis=require(_0xa77a('0x4'));var db=require(_0xa77a('0x5'))['db'];var utils=require(_0xa77a('0x6'));var logger=require(_0xa77a('0x7'))(_0xa77a('0x8'));var config=require(_0xa77a('0x9'));var jayson=require(_0xa77a('0xa'));var client=jayson[_0xa77a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe85259,_0x40f941,_0x5b8cf7){return new BPromise(function(_0x344457,_0x183a55){return client['request'](_0xe85259,_0x5b8cf7)['then'](function(_0x2c752e){logger['info'](_0xa77a('0xc'),_0x40f941,'request\x20sent');logger[_0xa77a('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x40f941,_0xa77a('0xe'),JSON[_0xa77a('0xf')](_0x2c752e));if(_0x2c752e['error']){if(_0x2c752e[_0xa77a('0x10')][_0xa77a('0x11')]===0x1f4){logger[_0xa77a('0x10')]('FaxApplication,\x20%s,\x20%s',_0x40f941,_0x2c752e[_0xa77a('0x10')][_0xa77a('0x12')]);return _0x183a55(_0x2c752e[_0xa77a('0x10')][_0xa77a('0x12')]);}logger[_0xa77a('0x10')](_0xa77a('0xc'),_0x40f941,_0x2c752e['error'][_0xa77a('0x12')]);return _0x344457(_0x2c752e[_0xa77a('0x10')][_0xa77a('0x12')]);}else{logger[_0xa77a('0x13')](_0xa77a('0xc'),_0x40f941,_0xa77a('0xe'));_0x344457(_0x2c752e[_0xa77a('0x14')][_0xa77a('0x12')]);}})['catch'](function(_0x378666){logger[_0xa77a('0x10')](_0xa77a('0xc'),_0x40f941,_0x378666);_0x183a55(_0x378666);});});}exports[_0xa77a('0x15')]=function(_0x57cdc4){var _0x1ae382=this;return new Promise(function(_0x2b8b00,_0x3f1d13){return db[_0xa77a('0x16')][_0xa77a('0x17')](_0x57cdc4[_0xa77a('0x18')],{'raw':_0x57cdc4[_0xa77a('0x19')]?_0x57cdc4[_0xa77a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57cdc4[_0xa77a('0x19')]?_0x57cdc4['options'][_0xa77a('0x1a')]||null:null,'attributes':_0x57cdc4['options']?_0x57cdc4[_0xa77a('0x19')][_0xa77a('0x1b')]||null:null,'limit':_0x57cdc4[_0xa77a('0x19')]?_0x57cdc4['options'][_0xa77a('0x1c')]||null:null})[_0xa77a('0x1d')](function(_0x313478){logger[_0xa77a('0x13')](_0xa77a('0x15'),_0x57cdc4);logger['debug'](_0xa77a('0x15'),_0x57cdc4,JSON[_0xa77a('0xf')](_0x313478));_0x2b8b00(_0x313478);})[_0xa77a('0x1e')](function(_0x390cab){logger[_0xa77a('0x10')](_0xa77a('0x15'),_0x390cab[_0xa77a('0x12')],_0x57cdc4);_0x3f1d13(_0x1ae382['error'](0x1f4,_0x390cab[_0xa77a('0x12')]));});});}; \ No newline at end of file +var _0x93e2=['debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxApplication','update','body','options','where','UpdateFaxApplication','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x42a122,_0x5a487c){var _0xa576ed=function(_0x2edd72){while(--_0x2edd72){_0x42a122['push'](_0x42a122['shift']());}};_0xa576ed(++_0x5a487c);}(_0x93e2,0x106));var _0x293e=function(_0x37cad2,_0x1e6d7e){_0x37cad2=_0x37cad2-0x0;var _0x2158b2=_0x93e2[_0x37cad2];return _0x2158b2;};'use strict';var _=require('lodash');var util=require(_0x293e('0x0'));var moment=require(_0x293e('0x1'));var BPromise=require(_0x293e('0x2'));var rs=require(_0x293e('0x3'));var fs=require('fs');var Redis=require(_0x293e('0x4'));var db=require(_0x293e('0x5'))['db'];var utils=require(_0x293e('0x6'));var logger=require(_0x293e('0x7'))(_0x293e('0x8'));var config=require('../../config/environment');var jayson=require(_0x293e('0x9'));var client=jayson[_0x293e('0xa')][_0x293e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1faee4,_0x87ca8b,_0x39f3be){return new BPromise(function(_0x1dfdbf,_0x54dec6){return client[_0x293e('0xc')](_0x1faee4,_0x39f3be)[_0x293e('0xd')](function(_0x2c224d){logger[_0x293e('0xe')](_0x293e('0xf'),_0x87ca8b,_0x293e('0x10'));logger[_0x293e('0x11')](_0x293e('0x12'),_0x87ca8b,_0x293e('0x10'),JSON['stringify'](_0x2c224d));if(_0x2c224d[_0x293e('0x13')]){if(_0x2c224d[_0x293e('0x13')][_0x293e('0x14')]===0x1f4){logger[_0x293e('0x13')](_0x293e('0xf'),_0x87ca8b,_0x2c224d[_0x293e('0x13')]['message']);return _0x54dec6(_0x2c224d[_0x293e('0x13')][_0x293e('0x15')]);}logger[_0x293e('0x13')](_0x293e('0xf'),_0x87ca8b,_0x2c224d[_0x293e('0x13')][_0x293e('0x15')]);return _0x1dfdbf(_0x2c224d[_0x293e('0x13')][_0x293e('0x15')]);}else{logger[_0x293e('0xe')]('FaxApplication,\x20%s,\x20%s',_0x87ca8b,_0x293e('0x10'));_0x1dfdbf(_0x2c224d[_0x293e('0x16')][_0x293e('0x15')]);}})[_0x293e('0x17')](function(_0x2b0664){logger[_0x293e('0x13')]('FaxApplication,\x20%s,\x20%s',_0x87ca8b,_0x2b0664);_0x54dec6(_0x2b0664);});});}exports['UpdateFaxApplication']=function(_0x29ec8d){var _0x49e0d8=this;return new Promise(function(_0x3384cb,_0x187520){return db[_0x293e('0x18')][_0x293e('0x19')](_0x29ec8d[_0x293e('0x1a')],{'raw':_0x29ec8d[_0x293e('0x1b')]?_0x29ec8d[_0x293e('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29ec8d[_0x293e('0x1b')]?_0x29ec8d[_0x293e('0x1b')][_0x293e('0x1c')]||null:null,'attributes':_0x29ec8d[_0x293e('0x1b')]?_0x29ec8d[_0x293e('0x1b')]['attributes']||null:null,'limit':_0x29ec8d[_0x293e('0x1b')]?_0x29ec8d[_0x293e('0x1b')]['limit']||null:null})['then'](function(_0x4c531b){logger[_0x293e('0xe')](_0x293e('0x1d'),_0x29ec8d);logger[_0x293e('0x11')](_0x293e('0x1d'),_0x29ec8d,JSON[_0x293e('0x1e')](_0x4c531b));_0x3384cb(_0x4c531b);})['catch'](function(_0x53010d){logger[_0x293e('0x13')](_0x293e('0x1d'),_0x53010d[_0x293e('0x15')],_0x29ec8d);_0x187520(_0x49e0d8[_0x293e('0x13')](0x1f4,_0x53010d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 709e17c..63a19f6 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 _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x5a7e3c,_0xdc9219){var _0x59252b=function(_0x29655c){while(--_0x29655c){_0x5a7e3c['push'](_0x5a7e3c['shift']());}};_0x59252b(++_0xdc9219);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x56263a,_0x2ae425){_0x56263a=_0x56263a-0x0;var _0x112eb9=_0x9ffd[_0x56263a];return _0x112eb9;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x83b2fe,_0x67ce0a){var _0x4599a9=function(_0x2e5fee){while(--_0x2e5fee){_0x83b2fe['push'](_0x83b2fe['shift']());}};_0x4599a9(++_0x67ce0a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('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 ccba8f8..b5092ac 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 _0xbd41=['exports','DATE','STRING','out','ENUM','sequelize'];(function(_0x722939,_0x4fb48a){var _0x32f43d=function(_0x2e758a){while(--_0x2e758a){_0x722939['push'](_0x722939['shift']());}};_0x32f43d(++_0x4fb48a);}(_0xbd41,0x1c1));var _0x1bd4=function(_0x3452a8,_0x4bfaa4){_0x3452a8=_0x3452a8-0x0;var _0x233814=_0xbd41[_0x3452a8];return _0x233814;};'use strict';var Sequelize=require(_0x1bd4('0x0'));module[_0x1bd4('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1bd4('0x2')]},'disposition':{'type':Sequelize[_0x1bd4('0x3')]},'secondDisposition':{'type':Sequelize[_0x1bd4('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1bd4('0x3')]},'note':{'type':Sequelize[_0x1bd4('0x3')]},'read1stAt':{'type':Sequelize[_0x1bd4('0x2')]},'fax':{'type':Sequelize[_0x1bd4('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1bd4('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1bd4('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x10cc=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x1231b4,_0x235731){var _0x405687=function(_0x4793ee){while(--_0x4793ee){_0x1231b4['push'](_0x1231b4['shift']());}};_0x405687(++_0x235731);}(_0x10cc,0x195));var _0xc10c=function(_0x189e14,_0x28775e){_0x189e14=_0x189e14-0x0;var _0x3a0f5a=_0x10cc[_0x189e14];return _0x3a0f5a;};'use strict';var Sequelize=require(_0xc10c('0x0'));module[_0xc10c('0x1')]={'closed':{'type':Sequelize[_0xc10c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc10c('0x3')]},'secondDisposition':{'type':Sequelize[_0xc10c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc10c('0x3')]},'read1stAt':{'type':Sequelize[_0xc10c('0x4')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xc10c('0x5')]('in',_0xc10c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc10c('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc10c('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 9b9e1e4..0cd7639 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 _0xc9e2=['$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','existsSync','pipe','createWriteStream','basename','resolve','err','zip-dir','moment','bluebird','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','offset','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','fax','query','user','catch','params','model','keys','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','findOne','FaxMessage','filters','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x81e39d,_0x4c3934){var _0x548fbb=function(_0x1adda5){while(--_0x1adda5){_0x81e39d['push'](_0x81e39d['shift']());}};_0x548fbb(++_0x4c3934);}(_0xc9e2,0x1ba));var _0x2c9e=function(_0x260e23,_0x2ea2c8){_0x260e23=_0x260e23-0x0;var _0x46d899=_0xc9e2[_0x260e23];return _0x46d899;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x2c9e('0x0'));var moment=require(_0x2c9e('0x1'));var BPromise=require(_0x2c9e('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x2c9e('0x3'));var interaction=require('../../components/interaction/service');var qs=require(_0x2c9e('0x4'));var logger=require('../../config/logger')(_0x2c9e('0x5'));var config=require(_0x2c9e('0x6'));var db=require(_0x2c9e('0x7'))['db'];config[_0x2c9e('0x8')]=_[_0x2c9e('0x9')](config[_0x2c9e('0x8')],{'host':_0x2c9e('0xa'),'port':0x18eb});var socket=require(_0x2c9e('0xb'))(new Redis(config[_0x2c9e('0x8')]));require(_0x2c9e('0xc'))[_0x2c9e('0xd')](socket);function respondWithStatusCode(_0x5db822,_0x4139d7){_0x4139d7=_0x4139d7||0xcc;return function(_0x3079d0){if(_0x3079d0){return _0x5db822[_0x2c9e('0xe')](_0x4139d7);}return _0x5db822['status'](_0x4139d7)[_0x2c9e('0xf')]();};}function respondWithResult(_0x2e315e,_0x4aec55){_0x4aec55=_0x4aec55||0xc8;return function(_0x18c3a0){if(_0x18c3a0){return _0x2e315e[_0x2c9e('0x10')](_0x4aec55)['json'](_0x18c3a0);}};}function respondWithFilteredResult(_0x19352e,_0xf6af34){return function(_0x39b7c9){if(_0x39b7c9){var _0x384460=typeof _0xf6af34[_0x2c9e('0x11')]==='undefined'&&typeof _0xf6af34['limit']==='undefined';var _0x59e4df=_0x39b7c9['count'];var _0x5ce9b1=_0x384460?0x0:_0xf6af34[_0x2c9e('0x11')];var _0x125d3a=_0x384460?_0x39b7c9[_0x2c9e('0x12')]:_0xf6af34[_0x2c9e('0x11')]+_0xf6af34[_0x2c9e('0x13')];var _0x19de0b;if(_0x125d3a>=_0x59e4df){_0x125d3a=_0x59e4df;_0x19de0b=0xc8;}else{_0x19de0b=0xce;}_0x19352e[_0x2c9e('0x10')](_0x19de0b);return _0x19352e[_0x2c9e('0x14')](_0x2c9e('0x15'),_0x5ce9b1+'-'+_0x125d3a+'/'+_0x59e4df)['json'](_0x39b7c9);}return null;};}function saveUpdates(_0x468bf9){return function(_0x44d9e9){if(_0x44d9e9){return _0x44d9e9[_0x2c9e('0x16')](_0x468bf9)[_0x2c9e('0x17')](function(_0x2cd2cc){return _0x2cd2cc;});}return null;};}function removeEntity(_0x35f1c6){return function(_0x4d7178){if(_0x4d7178){return _0x4d7178[_0x2c9e('0x18')]()[_0x2c9e('0x17')](function(){_0x35f1c6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x300284){return function(_0x5c8374){if(!_0x5c8374){_0x300284['sendStatus'](0x194);}return _0x5c8374;};}function handleError(_0x537abd,_0xba7aa){_0xba7aa=_0xba7aa||0x1f4;return function(_0x59b5bb){logger[_0x2c9e('0x19')](_0x59b5bb[_0x2c9e('0x1a')]);if(_0x59b5bb[_0x2c9e('0x1b')]){delete _0x59b5bb[_0x2c9e('0x1b')];}_0x537abd[_0x2c9e('0x10')](_0xba7aa)[_0x2c9e('0x1c')](_0x59b5bb);};}exports[_0x2c9e('0x1d')]=function(_0x57ffbf,_0x239c5d){var _0x12e243={};var _0x26e7fd=_[_0x2c9e('0x1e')](db[_0x2c9e('0x1f')][_0x2c9e('0x20')],function(_0x4d2a53){return{'name':_0x4d2a53[_0x2c9e('0x21')],'type':_0x4d2a53['type'][_0x2c9e('0x22')]};});_0x12e243=qs[_0x2c9e('0x23')](_0x26e7fd,_0x57ffbf);return interaction[_0x2c9e('0x24')](_0x2c9e('0x25'),_0x57ffbf[_0x2c9e('0x26')],_0x57ffbf[_0x2c9e('0x27')],_0x12e243,_0x26e7fd)[_0x2c9e('0x17')](respondWithFilteredResult(_0x239c5d,_0x12e243))[_0x2c9e('0x28')](handleError(_0x239c5d,null));};exports['show']=function(_0x144147,_0x3205ff){var _0x3521d6={'raw':![],'where':{'id':_0x144147[_0x2c9e('0x29')]['id']}},_0x59be1e={};_0x59be1e[_0x2c9e('0x2a')]=_[_0x2c9e('0x2b')](db[_0x2c9e('0x1f')][_0x2c9e('0x20')]);_0x59be1e[_0x2c9e('0x26')]=_['keys'](_0x144147[_0x2c9e('0x26')]);_0x59be1e['filters']=_[_0x2c9e('0x2c')](_0x59be1e[_0x2c9e('0x2a')],_0x59be1e[_0x2c9e('0x26')]);_0x3521d6[_0x2c9e('0x2d')]=_[_0x2c9e('0x2c')](_0x59be1e[_0x2c9e('0x2a')],qs[_0x2c9e('0x2e')](_0x144147[_0x2c9e('0x26')][_0x2c9e('0x2e')]));_0x3521d6[_0x2c9e('0x2d')]=_0x3521d6[_0x2c9e('0x2d')]['length']?_0x3521d6[_0x2c9e('0x2d')]:_0x59be1e[_0x2c9e('0x2a')];if(_0x144147[_0x2c9e('0x26')][_0x2c9e('0x2f')]){_0x3521d6[_0x2c9e('0x30')]=[{'all':!![]}];}_0x3521d6=_[_0x2c9e('0x31')]({},_0x3521d6,_0x144147[_0x2c9e('0x32')]);return db[_0x2c9e('0x1f')][_0x2c9e('0x33')](_0x3521d6)['then'](handleEntityNotFound(_0x3205ff,null))[_0x2c9e('0x17')](respondWithResult(_0x3205ff,null))[_0x2c9e('0x28')](handleError(_0x3205ff,null));};exports[_0x2c9e('0x34')]=function(_0x4b1936,_0x598945){return db[_0x2c9e('0x1f')][_0x2c9e('0x34')](_0x4b1936[_0x2c9e('0x35')],{})[_0x2c9e('0x17')](respondWithResult(_0x598945,0xc9))['catch'](handleError(_0x598945,null));};exports[_0x2c9e('0x16')]=function(_0x3e8fdd,_0xb9ab32){if(_0x3e8fdd[_0x2c9e('0x35')]['id']){delete _0x3e8fdd['body']['id'];}return db[_0x2c9e('0x1f')][_0x2c9e('0x33')]({'where':{'id':_0x3e8fdd[_0x2c9e('0x29')]['id']}})['then'](handleEntityNotFound(_0xb9ab32,null))[_0x2c9e('0x17')](saveUpdates(_0x3e8fdd['body'],null))[_0x2c9e('0x17')](respondWithResult(_0xb9ab32,null))[_0x2c9e('0x28')](handleError(_0xb9ab32,null));};exports[_0x2c9e('0x18')]=function(_0x3e8cd4,_0x22eb5e){return db['FaxInteraction']['find']({'where':{'id':_0x3e8cd4['params']['id']}})[_0x2c9e('0x17')](handleEntityNotFound(_0x22eb5e,null))[_0x2c9e('0x17')](removeEntity(_0x22eb5e,null))[_0x2c9e('0x28')](handleError(_0x22eb5e,null));};exports[_0x2c9e('0x36')]=function(_0x1fe0f7,_0x22b5bd){return db[_0x2c9e('0x1f')][_0x2c9e('0x36')]()[_0x2c9e('0x17')](respondWithResult(_0x22b5bd,null))[_0x2c9e('0x28')](handleError(_0x22b5bd,null));};exports[_0x2c9e('0x37')]=function(_0x28409e,_0x473054){return db['FaxMessage'][_0x2c9e('0x33')]({'where':{'id':_0x28409e[_0x2c9e('0x29')]['id']}})[_0x2c9e('0x17')](handleEntityNotFound(_0x473054,null))['then'](function(_0x2c2533){if(_0x2c2533){return _0x2c2533[_0x2c9e('0x37')](_0x28409e[_0x2c9e('0x35')][_0x2c9e('0x38')],_[_0x2c9e('0x39')](_0x28409e['body'],[_0x2c9e('0x38'),'id'])||{});}})['then'](respondWithResult(_0x473054,null))[_0x2c9e('0x28')](handleError(_0x473054,null));};exports['getMessages']=function(_0x1ddcfa,_0x2c36d1){var _0x32ab4b={'raw':![],'where':{}};var _0x5617e5={};var _0x4d2052={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x2c9e('0x3a')]({'where':{'id':_0x1ddcfa[_0x2c9e('0x29')]['id']}})[_0x2c9e('0x17')](handleEntityNotFound(_0x2c36d1,null))['then'](function(_0x259ac4){if(_0x259ac4){_0x5617e5[_0x2c9e('0x2a')]=_[_0x2c9e('0x2b')](db[_0x2c9e('0x3b')]['rawAttributes']);_0x5617e5[_0x2c9e('0x26')]=_[_0x2c9e('0x2b')](_0x1ddcfa[_0x2c9e('0x26')]);_0x5617e5[_0x2c9e('0x3c')]=_[_0x2c9e('0x2c')](_0x5617e5[_0x2c9e('0x2a')],_0x5617e5[_0x2c9e('0x26')]);_0x32ab4b[_0x2c9e('0x2d')]=_['intersection'](_0x5617e5[_0x2c9e('0x2a')],qs[_0x2c9e('0x2e')](_0x1ddcfa['query'][_0x2c9e('0x2e')]));_0x32ab4b[_0x2c9e('0x2d')]=_0x32ab4b['attributes'][_0x2c9e('0x3d')]?_0x32ab4b['attributes']:_0x5617e5[_0x2c9e('0x2a')];if(!_0x1ddcfa['query'][_0x2c9e('0x3e')](_0x2c9e('0x3f'))){_0x32ab4b['limit']=qs[_0x2c9e('0x13')](_0x1ddcfa[_0x2c9e('0x26')][_0x2c9e('0x13')]);_0x32ab4b[_0x2c9e('0x11')]=qs[_0x2c9e('0x11')](_0x1ddcfa['query'][_0x2c9e('0x11')]);}_0x32ab4b[_0x2c9e('0x40')]=qs[_0x2c9e('0x41')](_0x1ddcfa[_0x2c9e('0x26')]['sort']);_0x32ab4b['where']=qs[_0x2c9e('0x3c')](_['pick'](_0x1ddcfa[_0x2c9e('0x26')],_0x5617e5[_0x2c9e('0x3c')]));_0x32ab4b[_0x2c9e('0x42')]['FaxInteractionId']=_0x259ac4['id'];if(_0x1ddcfa['query'][_0x2c9e('0x43')]){_0x32ab4b[_0x2c9e('0x42')]=_['merge'](_0x32ab4b['where'],{'$or':_[_0x2c9e('0x1e')](_0x32ab4b[_0x2c9e('0x2d')],function(_0x5a97b9){var _0x159913={};_0x159913[_0x5a97b9]={'$like':'%'+_0x1ddcfa['query'][_0x2c9e('0x43')]+'%'};return _0x159913;})});}if(_0x1ddcfa['query'][_0x2c9e('0x44')]){var _0x2f4b4c=_0x1ddcfa[_0x2c9e('0x26')][_0x2c9e('0x44')][_0x2c9e('0x45')](',');var _0x5765aa={};_0x5765aa[_0x2f4b4c[0x0]]={'$gte':moment(_0x2f4b4c[0x1])[_0x2c9e('0x46')](_0x2c9e('0x47'))};_0x32ab4b['where']=_[_0x2c9e('0x31')](_0x32ab4b[_0x2c9e('0x42')],_0x5765aa);}_0x32ab4b=_['merge']({},_0x32ab4b,_0x1ddcfa['options']);return db[_0x2c9e('0x3b')][_0x2c9e('0x12')]({'where':_0x32ab4b[_0x2c9e('0x42')]})[_0x2c9e('0x17')](function(_0x3ef2de){_0x4d2052[_0x2c9e('0x12')]=_0x3ef2de;if(_0x1ddcfa[_0x2c9e('0x26')]['includeAll']){_0x32ab4b['include']=[{'all':!![]}];}return db[_0x2c9e('0x3b')][_0x2c9e('0x24')](_0x32ab4b);})['then'](function(_0xec1b1f){_0x4d2052[_0x2c9e('0x48')]=_0xec1b1f;return _0x4d2052;});}})['then'](respondWithFilteredResult(_0x2c36d1,_0x32ab4b))[_0x2c9e('0x28')](handleError(_0x2c36d1,null));};exports[_0x2c9e('0x49')]=function(_0x205955,_0x43fd26){return db[_0x2c9e('0x1f')][_0x2c9e('0x33')]({'where':{'id':_0x205955['params']['id']}})[_0x2c9e('0x17')](handleEntityNotFound(_0x43fd26,null))['then'](function(_0x4dc58e){if(_0x4dc58e){return _0x4dc58e[_0x2c9e('0x4a')](_0x205955[_0x2c9e('0x35')][_0x2c9e('0x38')],_[_0x2c9e('0x39')](_0x205955[_0x2c9e('0x35')],['ids','id'])||{})[_0x2c9e('0x4b')](function(){return db[_0x2c9e('0x4c')]['findAll']({'attributes':['id',_0x2c9e('0x1b'),_0x2c9e('0x4d')],'where':{'id':_0x205955['body'][_0x2c9e('0x38')]}});})[_0x2c9e('0x17')](function(_0x3191fe){socket['emit'](_0x2c9e('0x4e'),{'id':Number(_0x205955[_0x2c9e('0x29')]['id']),'tags':_0x3191fe||[]});return{'id':Number(_0x205955['params']['id']),'tags':_0x3191fe||[]};});}})['then'](respondWithResult(_0x43fd26,null))['catch'](handleError(_0x43fd26,null));};exports[_0x2c9e('0x4f')]=function(_0x59c35d,_0x3999e6){return db[_0x2c9e('0x1f')][_0x2c9e('0x33')]({'where':{'id':_0x59c35d[_0x2c9e('0x29')]['id']}})[_0x2c9e('0x17')](handleEntityNotFound(_0x3999e6,null))['then'](function(_0x10cff3){if(_0x10cff3){return _0x10cff3[_0x2c9e('0x4f')](_0x59c35d[_0x2c9e('0x26')][_0x2c9e('0x38')]);}})[_0x2c9e('0x17')](respondWithStatusCode(_0x3999e6,null))[_0x2c9e('0x28')](handleError(_0x3999e6,null));};exports[_0x2c9e('0x50')]=function(_0x22bab4,_0x4d2b92){var _0x7237=moment()[_0x2c9e('0x51')]()[_0x2c9e('0x52')]();var _0x2a8f1e=path[_0x2c9e('0x53')](config[_0x2c9e('0x54')],_0x2c9e('0x55'),_0x2c9e('0x56'),_0x2c9e('0x57'));var _0x113edc=path[_0x2c9e('0x53')](config[_0x2c9e('0x54')],'server',_0x2c9e('0x56'),_0x2c9e('0x58'));var _0x2ab7ff=path[_0x2c9e('0x53')](_0x2a8f1e,_0x7237);var _0x5ed975=util[_0x2c9e('0x46')](_0x2c9e('0x59'),_0x22bab4[_0x2c9e('0x29')]['id'],_0x7237);var _0x90a0c4=path[_0x2c9e('0x53')](_0x2a8f1e,_0x5ed975);var _0x1bad19=[];_0x1bad19[_0x2c9e('0x5a')]({'model':db[_0x2c9e('0x5b')],'as':'Attachment','raw':!![]});var _0x31984b=[{'model':db[_0x2c9e('0x3b')],'as':_0x2c9e('0x5c'),'attributes':['id',_0x2c9e('0x35'),_0x2c9e('0x5d')],'include':_0x1bad19}];return db[_0x2c9e('0x1f')][_0x2c9e('0x33')]({'where':{'id':_0x22bab4[_0x2c9e('0x29')]['id']},'include':_0x31984b})[_0x2c9e('0x17')](handleEntityNotFound(_0x4d2b92,null))[_0x2c9e('0x17')](function(_0x118e0c){if(_0x118e0c&&_0x118e0c[_0x2c9e('0x5c')]){var _0x1203e7=_0x118e0c[_0x2c9e('0x5e')]({'plain':!![]});fs[_0x2c9e('0x5f')](_0x2ab7ff);for(var _0x234849=0x0;_0x234849<_0x1203e7['Messages'][_0x2c9e('0x3d')];_0x234849++){var _0x3adf57=_0x1203e7[_0x2c9e('0x5c')][_0x234849][_0x2c9e('0x5b')];if(_0x3adf57){var _0x5c0a8d=path[_0x2c9e('0x53')](_0x113edc,_0x3adf57['basename']);if(fs[_0x2c9e('0x60')](_0x5c0a8d)){fs['createReadStream'](_0x5c0a8d)[_0x2c9e('0x61')](fs[_0x2c9e('0x62')](path[_0x2c9e('0x53')](_0x2ab7ff,_0x3adf57[_0x2c9e('0x63')])));}}}return BPromise[_0x2c9e('0x64')]()[_0x2c9e('0x17')](function(){return new BPromise(function(_0x125048,_0x7f6a0f){zipdir(_0x2ab7ff,{'saveTo':_0x90a0c4},function(_0x5ca249,_0x5f69f7){if(_0x5ca249)return _0x7f6a0f(_0x5ca249);return _0x125048(_0x5f69f7);});})[_0x2c9e('0x17')](function(){return new BPromise(function(_0x419a91,_0x32e1bb){rimraf(_0x2ab7ff,function(_0x15fb72){if(_0x15fb72)_0x32e1bb(_0x15fb72);return _0x419a91();});});})[_0x2c9e('0x17')](function(){return _0x4d2b92[_0x2c9e('0x50')](_0x90a0c4,_0x5ed975,function(_0x45a0a2){if(_0x45a0a2){console['log'](_0x2c9e('0x65'),_0x45a0a2);}else{fs['unlinkSync'](_0x90a0c4);}});});});}else{return _0x4d2b92[_0x2c9e('0xe')](0xc8);}})['catch'](handleError(_0x4d2b92,null));}; \ No newline at end of file +var _0x4301=['order','sort','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','rows','omit','spread','color','emit','faxInteractionTags:save','removeTags','download','toString','join','server','files','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','resolve','log','err','unlinkSync','rimraf','moment','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','sendStatus','error','stack','name','index','map','fieldName','key','fax','query','user','catch','show','params','model','keys','FaxInteraction','filters','intersection','attributes','fields','length','merge','options','find','create','body','destroy','describe','addMessage','ids','getMessages','findOne','FaxMessage','hasOwnProperty','nolimit'];(function(_0x552f18,_0x19a3e8){var _0x4fff46=function(_0x4a343f){while(--_0x4a343f){_0x552f18['push'](_0x552f18['shift']());}};_0x4fff46(++_0x19a3e8);}(_0x4301,0xf0));var _0x1430=function(_0x1cab62,_0x363241){_0x1cab62=_0x1cab62-0x0;var _0x1cc028=_0x4301[_0x1cab62];return _0x1cc028;};'use strict';var rimraf=require(_0x1430('0x0'));var zipdir=require('zip-dir');var moment=require(_0x1430('0x1'));var BPromise=require(_0x1430('0x2'));var util=require(_0x1430('0x3'));var path=require(_0x1430('0x4'));var fs=require('fs');var _=require(_0x1430('0x5'));var Redis=require('ioredis');var interaction=require(_0x1430('0x6'));var qs=require(_0x1430('0x7'));var logger=require(_0x1430('0x8'))('api');var config=require(_0x1430('0x9'));var db=require(_0x1430('0xa'))['db'];config[_0x1430('0xb')]=_['defaults'](config['redis'],{'host':_0x1430('0xc'),'port':0x18eb});var socket=require(_0x1430('0xd'))(new Redis(config[_0x1430('0xb')]));require(_0x1430('0xe'))[_0x1430('0xf')](socket);function respondWithStatusCode(_0x4e876f,_0x4eb696){_0x4eb696=_0x4eb696||0xcc;return function(_0x4c3bce){if(_0x4c3bce){return _0x4e876f['sendStatus'](_0x4eb696);}return _0x4e876f[_0x1430('0x10')](_0x4eb696)[_0x1430('0x11')]();};}function respondWithResult(_0x23731,_0x1ad21d){_0x1ad21d=_0x1ad21d||0xc8;return function(_0x3ad6dc){if(_0x3ad6dc){return _0x23731[_0x1430('0x10')](_0x1ad21d)[_0x1430('0x12')](_0x3ad6dc);}};}function respondWithFilteredResult(_0x34a52e,_0x3c0ed7){return function(_0x2d5356){if(_0x2d5356){var _0x3a707f=typeof _0x3c0ed7['offset']===_0x1430('0x13')&&typeof _0x3c0ed7[_0x1430('0x14')]===_0x1430('0x13');var _0x2abb07=_0x2d5356[_0x1430('0x15')];var _0x23eb47=_0x3a707f?0x0:_0x3c0ed7[_0x1430('0x16')];var _0x517598=_0x3a707f?_0x2d5356['count']:_0x3c0ed7[_0x1430('0x16')]+_0x3c0ed7[_0x1430('0x14')];var _0x3d85f6;if(_0x517598>=_0x2abb07){_0x517598=_0x2abb07;_0x3d85f6=0xc8;}else{_0x3d85f6=0xce;}_0x34a52e['status'](_0x3d85f6);return _0x34a52e[_0x1430('0x17')](_0x1430('0x18'),_0x23eb47+'-'+_0x517598+'/'+_0x2abb07)[_0x1430('0x12')](_0x2d5356);}return null;};}function saveUpdates(_0x3abd65){return function(_0x5453ee){if(_0x5453ee){return _0x5453ee[_0x1430('0x19')](_0x3abd65)['then'](function(_0xd660b0){return _0xd660b0;});}return null;};}function removeEntity(_0x239af1){return function(_0x5f3390){if(_0x5f3390){return _0x5f3390['destroy']()[_0x1430('0x1a')](function(){_0x239af1[_0x1430('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d50bc){return function(_0x439da2){if(!_0x439da2){_0x4d50bc[_0x1430('0x1b')](0x194);}return _0x439da2;};}function handleError(_0x13c9c7,_0x4b2730){_0x4b2730=_0x4b2730||0x1f4;return function(_0x3bb730){logger[_0x1430('0x1c')](_0x3bb730[_0x1430('0x1d')]);if(_0x3bb730[_0x1430('0x1e')]){delete _0x3bb730[_0x1430('0x1e')];}_0x13c9c7[_0x1430('0x10')](_0x4b2730)['send'](_0x3bb730);};}exports[_0x1430('0x1f')]=function(_0x2921dd,_0x5b5112){var _0x35d777={};var _0xc2eefa=_[_0x1430('0x20')](db['FaxInteraction']['rawAttributes'],function(_0x1e29d8){return{'name':_0x1e29d8[_0x1430('0x21')],'type':_0x1e29d8['type'][_0x1430('0x22')]};});_0x35d777=qs['getOptions'](_0xc2eefa,_0x2921dd);return interaction['findAll'](_0x1430('0x23'),_0x2921dd[_0x1430('0x24')],_0x2921dd[_0x1430('0x25')],_0x35d777,_0xc2eefa)[_0x1430('0x1a')](respondWithFilteredResult(_0x5b5112,_0x35d777))[_0x1430('0x26')](handleError(_0x5b5112,null));};exports[_0x1430('0x27')]=function(_0x3904a5,_0x1bc58e){var _0x10e68b={'raw':![],'where':{'id':_0x3904a5[_0x1430('0x28')]['id']}},_0x2f3b16={};_0x2f3b16[_0x1430('0x29')]=_[_0x1430('0x2a')](db[_0x1430('0x2b')]['rawAttributes']);_0x2f3b16[_0x1430('0x24')]=_['keys'](_0x3904a5['query']);_0x2f3b16[_0x1430('0x2c')]=_[_0x1430('0x2d')](_0x2f3b16[_0x1430('0x29')],_0x2f3b16['query']);_0x10e68b[_0x1430('0x2e')]=_[_0x1430('0x2d')](_0x2f3b16[_0x1430('0x29')],qs[_0x1430('0x2f')](_0x3904a5[_0x1430('0x24')]['fields']));_0x10e68b[_0x1430('0x2e')]=_0x10e68b[_0x1430('0x2e')][_0x1430('0x30')]?_0x10e68b[_0x1430('0x2e')]:_0x2f3b16['model'];if(_0x3904a5[_0x1430('0x24')]['includeAll']){_0x10e68b['include']=[{'all':!![]}];}_0x10e68b=_[_0x1430('0x31')]({},_0x10e68b,_0x3904a5[_0x1430('0x32')]);return db[_0x1430('0x2b')][_0x1430('0x33')](_0x10e68b)[_0x1430('0x1a')](handleEntityNotFound(_0x1bc58e,null))['then'](respondWithResult(_0x1bc58e,null))[_0x1430('0x26')](handleError(_0x1bc58e,null));};exports[_0x1430('0x34')]=function(_0x1c52aa,_0x3791db){return db[_0x1430('0x2b')][_0x1430('0x34')](_0x1c52aa[_0x1430('0x35')],{})[_0x1430('0x1a')](respondWithResult(_0x3791db,0xc9))[_0x1430('0x26')](handleError(_0x3791db,null));};exports['update']=function(_0x53b9b7,_0x5a112f){if(_0x53b9b7[_0x1430('0x35')]['id']){delete _0x53b9b7[_0x1430('0x35')]['id'];}return db[_0x1430('0x2b')][_0x1430('0x33')]({'where':{'id':_0x53b9b7['params']['id']}})[_0x1430('0x1a')](handleEntityNotFound(_0x5a112f,null))[_0x1430('0x1a')](saveUpdates(_0x53b9b7['body'],null))[_0x1430('0x1a')](respondWithResult(_0x5a112f,null))[_0x1430('0x26')](handleError(_0x5a112f,null));};exports[_0x1430('0x36')]=function(_0x217fdd,_0x1c3bc8){return db[_0x1430('0x2b')][_0x1430('0x33')]({'where':{'id':_0x217fdd['params']['id']}})[_0x1430('0x1a')](handleEntityNotFound(_0x1c3bc8,null))[_0x1430('0x1a')](removeEntity(_0x1c3bc8,null))[_0x1430('0x26')](handleError(_0x1c3bc8,null));};exports[_0x1430('0x37')]=function(_0x55772f,_0x17ca6d){return db[_0x1430('0x2b')]['describe']()[_0x1430('0x1a')](respondWithResult(_0x17ca6d,null))[_0x1430('0x26')](handleError(_0x17ca6d,null));};exports[_0x1430('0x38')]=function(_0x4b27e6,_0x1186fa){return db['FaxMessage'][_0x1430('0x33')]({'where':{'id':_0x4b27e6['params']['id']}})[_0x1430('0x1a')](handleEntityNotFound(_0x1186fa,null))[_0x1430('0x1a')](function(_0x20927f){if(_0x20927f){return _0x20927f[_0x1430('0x38')](_0x4b27e6[_0x1430('0x35')]['ids'],_['omit'](_0x4b27e6['body'],[_0x1430('0x39'),'id'])||{});}})[_0x1430('0x1a')](respondWithResult(_0x1186fa,null))[_0x1430('0x26')](handleError(_0x1186fa,null));};exports[_0x1430('0x3a')]=function(_0xb34b8e,_0x141366){var _0x98e55f={'raw':![],'where':{}};var _0x36f2ac={};var _0x22f825={'count':0x0,'rows':[]};return db[_0x1430('0x2b')][_0x1430('0x3b')]({'where':{'id':_0xb34b8e[_0x1430('0x28')]['id']}})['then'](handleEntityNotFound(_0x141366,null))[_0x1430('0x1a')](function(_0xbb43fb){if(_0xbb43fb){_0x36f2ac['model']=_[_0x1430('0x2a')](db[_0x1430('0x3c')]['rawAttributes']);_0x36f2ac[_0x1430('0x24')]=_[_0x1430('0x2a')](_0xb34b8e[_0x1430('0x24')]);_0x36f2ac[_0x1430('0x2c')]=_[_0x1430('0x2d')](_0x36f2ac[_0x1430('0x29')],_0x36f2ac[_0x1430('0x24')]);_0x98e55f[_0x1430('0x2e')]=_[_0x1430('0x2d')](_0x36f2ac[_0x1430('0x29')],qs[_0x1430('0x2f')](_0xb34b8e[_0x1430('0x24')][_0x1430('0x2f')]));_0x98e55f[_0x1430('0x2e')]=_0x98e55f[_0x1430('0x2e')][_0x1430('0x30')]?_0x98e55f['attributes']:_0x36f2ac[_0x1430('0x29')];if(!_0xb34b8e[_0x1430('0x24')][_0x1430('0x3d')](_0x1430('0x3e'))){_0x98e55f['limit']=qs['limit'](_0xb34b8e['query']['limit']);_0x98e55f[_0x1430('0x16')]=qs['offset'](_0xb34b8e[_0x1430('0x24')][_0x1430('0x16')]);}_0x98e55f[_0x1430('0x3f')]=qs[_0x1430('0x40')](_0xb34b8e[_0x1430('0x24')][_0x1430('0x40')]);_0x98e55f['where']=qs[_0x1430('0x2c')](_['pick'](_0xb34b8e[_0x1430('0x24')],_0x36f2ac[_0x1430('0x2c')]));_0x98e55f[_0x1430('0x41')][_0x1430('0x42')]=_0xbb43fb['id'];if(_0xb34b8e[_0x1430('0x24')]['filter']){_0x98e55f['where']=_[_0x1430('0x31')](_0x98e55f['where'],{'$or':_[_0x1430('0x20')](_0x98e55f[_0x1430('0x2e')],function(_0x1fc313){var _0x5d8b5b={};_0x5d8b5b[_0x1fc313]={'$like':'%'+_0xb34b8e['query'][_0x1430('0x43')]+'%'};return _0x5d8b5b;})});}if(_0xb34b8e[_0x1430('0x24')]['$gte']){var _0x4b5f93=_0xb34b8e['query'][_0x1430('0x44')][_0x1430('0x45')](',');var _0x2aa88d={};_0x2aa88d[_0x4b5f93[0x0]]={'$gte':moment(_0x4b5f93[0x1])[_0x1430('0x46')](_0x1430('0x47'))};_0x98e55f[_0x1430('0x41')]=_['merge'](_0x98e55f[_0x1430('0x41')],_0x2aa88d);}_0x98e55f=_[_0x1430('0x31')]({},_0x98e55f,_0xb34b8e[_0x1430('0x32')]);return db['FaxMessage'][_0x1430('0x15')]({'where':_0x98e55f[_0x1430('0x41')]})[_0x1430('0x1a')](function(_0x13b72a){_0x22f825['count']=_0x13b72a;if(_0xb34b8e[_0x1430('0x24')][_0x1430('0x48')]){_0x98e55f[_0x1430('0x49')]=[{'all':!![]}];}return db[_0x1430('0x3c')][_0x1430('0x4a')](_0x98e55f);})['then'](function(_0x9d50dc){_0x22f825[_0x1430('0x4b')]=_0x9d50dc;return _0x22f825;});}})['then'](respondWithFilteredResult(_0x141366,_0x98e55f))['catch'](handleError(_0x141366,null));};exports['addTags']=function(_0x175deb,_0x1300c6){return db[_0x1430('0x2b')][_0x1430('0x33')]({'where':{'id':_0x175deb[_0x1430('0x28')]['id']}})['then'](handleEntityNotFound(_0x1300c6,null))['then'](function(_0x443d81){if(_0x443d81){return _0x443d81['setTags'](_0x175deb[_0x1430('0x35')][_0x1430('0x39')],_[_0x1430('0x4c')](_0x175deb[_0x1430('0x35')],[_0x1430('0x39'),'id'])||{})[_0x1430('0x4d')](function(){return db['Tag'][_0x1430('0x4a')]({'attributes':['id','name',_0x1430('0x4e')],'where':{'id':_0x175deb[_0x1430('0x35')][_0x1430('0x39')]}});})[_0x1430('0x1a')](function(_0x865a80){socket[_0x1430('0x4f')](_0x1430('0x50'),{'id':Number(_0x175deb['params']['id']),'tags':_0x865a80||[]});return{'id':Number(_0x175deb[_0x1430('0x28')]['id']),'tags':_0x865a80||[]};});}})[_0x1430('0x1a')](respondWithResult(_0x1300c6,null))[_0x1430('0x26')](handleError(_0x1300c6,null));};exports[_0x1430('0x51')]=function(_0x2b7f43,_0x41f547){return db[_0x1430('0x2b')]['find']({'where':{'id':_0x2b7f43[_0x1430('0x28')]['id']}})['then'](handleEntityNotFound(_0x41f547,null))[_0x1430('0x1a')](function(_0x3ca023){if(_0x3ca023){return _0x3ca023['removeTags'](_0x2b7f43[_0x1430('0x24')][_0x1430('0x39')]);}})[_0x1430('0x1a')](respondWithStatusCode(_0x41f547,null))[_0x1430('0x26')](handleError(_0x41f547,null));};exports[_0x1430('0x52')]=function(_0x5ce47c,_0x396d77){var _0x37ed9f=moment()['unix']()[_0x1430('0x53')]();var _0x46e7e8=path[_0x1430('0x54')](config['root'],_0x1430('0x55'),_0x1430('0x56'),'tmp');var _0x3b8ec6=path[_0x1430('0x54')](config['root'],'server','files','attachments');var _0x46d83d=path[_0x1430('0x54')](_0x46e7e8,_0x37ed9f);var _0x3b5d17=util[_0x1430('0x46')]('transcript-%d-%s.zip',_0x5ce47c[_0x1430('0x28')]['id'],_0x37ed9f);var _0x54b337=path[_0x1430('0x54')](_0x46e7e8,_0x3b5d17);var _0x4cddaa=[];_0x4cddaa[_0x1430('0x57')]({'model':db[_0x1430('0x58')],'as':_0x1430('0x58'),'raw':!![]});var _0x508abf=[{'model':db[_0x1430('0x3c')],'as':_0x1430('0x59'),'attributes':['id',_0x1430('0x35'),_0x1430('0x5a')],'include':_0x4cddaa}];return db[_0x1430('0x2b')][_0x1430('0x33')]({'where':{'id':_0x5ce47c[_0x1430('0x28')]['id']},'include':_0x508abf})['then'](handleEntityNotFound(_0x396d77,null))[_0x1430('0x1a')](function(_0x14f32b){if(_0x14f32b&&_0x14f32b[_0x1430('0x59')]){var _0x1749b7=_0x14f32b[_0x1430('0x5b')]({'plain':!![]});fs[_0x1430('0x5c')](_0x46d83d);for(var _0x29d527=0x0;_0x29d527<_0x1749b7[_0x1430('0x59')][_0x1430('0x30')];_0x29d527++){var _0x3f3b0a=_0x1749b7['Messages'][_0x29d527][_0x1430('0x58')];if(_0x3f3b0a){var _0x3e339d=path[_0x1430('0x54')](_0x3b8ec6,_0x3f3b0a[_0x1430('0x5d')]);if(fs[_0x1430('0x5e')](_0x3e339d)){fs[_0x1430('0x5f')](_0x3e339d)[_0x1430('0x60')](fs['createWriteStream'](path['join'](_0x46d83d,_0x3f3b0a[_0x1430('0x5d')])));}}}return BPromise[_0x1430('0x61')]()['then'](function(){return new BPromise(function(_0x246012,_0x556dc8){zipdir(_0x46d83d,{'saveTo':_0x54b337},function(_0x4f64a2,_0x75b65f){if(_0x4f64a2)return _0x556dc8(_0x4f64a2);return _0x246012(_0x75b65f);});})[_0x1430('0x1a')](function(){return new BPromise(function(_0x5ede69,_0x4f9ee7){rimraf(_0x46d83d,function(_0x58565b){if(_0x58565b)_0x4f9ee7(_0x58565b);return _0x5ede69();});});})['then'](function(){return _0x396d77[_0x1430('0x52')](_0x54b337,_0x3b5d17,function(_0x2812fb){if(_0x2812fb){console[_0x1430('0x62')](_0x1430('0x63'),_0x2812fb);}else{fs[_0x1430('0x64')](_0x54b337);}});});});}else{return _0x396d77[_0x1430('0x1b')](0xc8);}})[_0x1430('0x26')](handleError(_0x396d77,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 498d32c..cf0080e 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 _0x782a=['Users','map','findAll','then','unreadMessages','length','emit','hasOwnProperty','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove'];(function(_0x1ff1b4,_0x28cd56){var _0x3172a4=function(_0x4f00b3){while(--_0x4f00b3){_0x1ff1b4['push'](_0x1ff1b4['shift']());}};_0x3172a4(++_0x28cd56);}(_0x782a,0xf9));var _0xa782=function(_0x917bb1,_0x5c39e5){_0x917bb1=_0x917bb1-0x0;var _0x5bfab7=_0x782a[_0x917bb1];return _0x5bfab7;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xa782('0x0'))['db'][_0xa782('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0xa782('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xa782('0x3')](0x0);var events={'afterCreate':_0xa782('0x4'),'afterUpdate':'update','afterDestroy':_0xa782('0x5')};function emitEvent(_0x25160e){return function(_0xf3c2e0,_0x113963,_0x11e983){_0xf3c2e0['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3f6c7c){_0xf3c2e0['setDataValue'](_0xa782('0x6'),_0x3f6c7c[_0xa782('0x7')](function(_0x39d6a6){return{'id':_0x39d6a6['id']};}));return FaxMessage[_0xa782('0x8')]({'where':{'FaxInteractionId':_0xf3c2e0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa782('0x9')](function(_0x278bf3){_0xf3c2e0['setDataValue'](_0xa782('0xa'),_0x278bf3[_0xa782('0xb')]);FaxInteractionEvents[_0xa782('0xc')](_0x25160e+':'+_0xf3c2e0['id'],_0xf3c2e0);FaxInteractionEvents['emit'](_0x25160e,_0xf3c2e0);_0x11e983(null);})['catch'](_0x11e983(null));};}for(var e in events){if(events[_0xa782('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xa782('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x14dd=['events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x1b1040,_0x54f8b8){var _0x9fab04=function(_0x349fcc){while(--_0x349fcc){_0x1b1040['push'](_0x1b1040['shift']());}};_0x9fab04(++_0x54f8b8);}(_0x14dd,0x98));var _0xd14d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14dd[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd14d('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xd14d('0x1')];var FaxMessage=require(_0xd14d('0x2'))['db'][_0xd14d('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xd14d('0x4')](0x0);var events={'afterCreate':_0xd14d('0x5'),'afterUpdate':_0xd14d('0x6'),'afterDestroy':_0xd14d('0x7')};function emitEvent(_0x591d40){return function(_0x1bfa95,_0x154d9c,_0x3fc018){_0x1bfa95[_0xd14d('0x8')]({'attributes':['id'],'raw':!![]})[_0xd14d('0x9')](function(_0x171da8){_0x1bfa95[_0xd14d('0xa')](_0xd14d('0xb'),_0x171da8['map'](function(_0x521683){return{'id':_0x521683['id']};}));return FaxMessage[_0xd14d('0xc')]({'where':{'FaxInteractionId':_0x1bfa95['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd14d('0x9')](function(_0x1380d2){_0x1bfa95['setDataValue']('unreadMessages',_0x1380d2[_0xd14d('0xd')]);FaxInteractionEvents[_0xd14d('0xe')](_0x591d40+':'+_0x1bfa95['id'],_0x1bfa95);FaxInteractionEvents[_0xd14d('0xe')](_0x591d40,_0x1bfa95);_0x3fc018(null);})[_0xd14d('0xf')](_0x3fc018(null));};}for(var e in events){if(events[_0xd14d('0x10')](e)){var event=events[e];FaxInteraction[_0xd14d('0x11')](e,emitEvent(event));}}module[_0xd14d('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index c0ecb96..d59992d 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 _0x0731=['fax_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxInteraction'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x0731,0x175));var _0x1073=function(_0x5f5962,_0x5903c3){_0x5f5962=_0x5f5962-0x0;var _0x2c269c=_0x0731[_0x5f5962];return _0x2c269c;};'use strict';var _=require(_0x1073('0x0'));var util=require(_0x1073('0x1'));var logger=require(_0x1073('0x2'))(_0x1073('0x3'));var moment=require('moment');var BPromise=require(_0x1073('0x4'));var rp=require(_0x1073('0x5'));var fs=require('fs');var path=require(_0x1073('0x6'));var rimraf=require(_0x1073('0x7'));var config=require(_0x1073('0x8'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x43c791,_0x2ffb4b){return _0x43c791[_0x1073('0x9')](_0x1073('0xa'),attributes,{'tableName':_0x1073('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f61e1,_0x41a384,_0x2ab5b2){if(_0x2f61e1['changed'](_0x1073('0xc'))){_0x2f61e1[_0x1073('0xd')]=moment()[_0x1073('0xe')](_0x1073('0xf'));}_0x2ab5b2(null,_0x2f61e1);}}});}; \ No newline at end of file +var _0x58d5=['FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird','path','../../config/environment','exports'];(function(_0x3d3d7b,_0x5c0937){var _0x33e7c8=function(_0xe0ee81){while(--_0xe0ee81){_0x3d3d7b['push'](_0x3d3d7b['shift']());}};_0x33e7c8(++_0x5c0937);}(_0x58d5,0xd2));var _0x558d=function(_0x157c09,_0x1ae0c4){_0x157c09=_0x157c09-0x0;var _0x5b306d=_0x58d5[_0x157c09];return _0x5b306d;};'use strict';var _=require('lodash');var util=require(_0x558d('0x0'));var logger=require('../../config/logger')(_0x558d('0x1'));var moment=require('moment');var BPromise=require(_0x558d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x558d('0x3'));var rimraf=require('rimraf');var config=require(_0x558d('0x4'));var attributes=require('./faxInteraction.attributes');module[_0x558d('0x5')]=function(_0x4848d0,_0x240137){return _0x4848d0['define'](_0x558d('0x6'),attributes,{'tableName':_0x558d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x464395,_0x24b89b,_0xcf2457){if(_0x464395[_0x558d('0x8')](_0x558d('0x9'))){_0x464395['closedAt']=moment()[_0x558d('0xa')](_0x558d('0xb'));}_0xcf2457(null,_0x464395);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index d8022f0..9f339d3 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 _0xdd9c=['client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToFaxInteraction','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x37f742,_0x2a7ae8){var _0xc87883=function(_0xf2367d){while(--_0xf2367d){_0x37f742['push'](_0x37f742['shift']());}};_0xc87883(++_0x2a7ae8);}(_0xdd9c,0xa3));var _0xcdd9=function(_0x2cb4df,_0x1759fd){_0x2cb4df=_0x2cb4df-0x0;var _0x22e115=_0xdd9c[_0x2cb4df];return _0x22e115;};'use strict';var _=require(_0xcdd9('0x0'));var util=require(_0xcdd9('0x1'));var moment=require(_0xcdd9('0x2'));var BPromise=require(_0xcdd9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdd9('0x4'));var db=require(_0xcdd9('0x5'))['db'];var utils=require(_0xcdd9('0x6'));var logger=require(_0xcdd9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcdd9('0x8'));var client=jayson[_0xcdd9('0x9')][_0xcdd9('0xa')]({'port':0x232a});config['redis']=_[_0xcdd9('0xb')](config[_0xcdd9('0xc')],{'host':_0xcdd9('0xd'),'port':0x18eb});var socket=require(_0xcdd9('0xe'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xcdd9('0xf')](socket);function respondWithRpcPromise(_0x41a899,_0x5bf401,_0x388392){return new BPromise(function(_0x2466b3,_0x15d6f2){return client['request'](_0x41a899,_0x388392)[_0xcdd9('0x10')](function(_0x4171b4){logger[_0xcdd9('0x11')](_0xcdd9('0x12'),_0x5bf401,_0xcdd9('0x13'));logger[_0xcdd9('0x14')](_0xcdd9('0x15'),_0x5bf401,_0xcdd9('0x13'),JSON['stringify'](_0x4171b4));if(_0x4171b4['error']){if(_0x4171b4[_0xcdd9('0x16')][_0xcdd9('0x17')]===0x1f4){logger[_0xcdd9('0x16')](_0xcdd9('0x12'),_0x5bf401,_0x4171b4[_0xcdd9('0x16')][_0xcdd9('0x18')]);return _0x15d6f2(_0x4171b4[_0xcdd9('0x16')][_0xcdd9('0x18')]);}logger[_0xcdd9('0x16')](_0xcdd9('0x12'),_0x5bf401,_0x4171b4[_0xcdd9('0x16')]['message']);return _0x2466b3(_0x4171b4[_0xcdd9('0x16')][_0xcdd9('0x18')]);}else{logger[_0xcdd9('0x11')](_0xcdd9('0x12'),_0x5bf401,_0xcdd9('0x13'));_0x2466b3(_0x4171b4[_0xcdd9('0x19')]['message']);}})[_0xcdd9('0x1a')](function(_0x27e29d){logger[_0xcdd9('0x16')](_0xcdd9('0x12'),_0x5bf401,_0x27e29d);_0x15d6f2(_0x27e29d);});});}exports[_0xcdd9('0x1b')]=function(_0x5a01c6){var _0x1fac1b=this;return new Promise(function(_0x4bf2ff,_0x4c4f94){return db[_0xcdd9('0x1c')][_0xcdd9('0x1d')](_0x5a01c6[_0xcdd9('0x1e')],{'raw':_0x5a01c6[_0xcdd9('0x1f')]?_0x5a01c6[_0xcdd9('0x1f')][_0xcdd9('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a01c6[_0xcdd9('0x1f')]?_0x5a01c6[_0xcdd9('0x1f')][_0xcdd9('0x21')]||null:null,'attributes':_0x5a01c6[_0xcdd9('0x1f')]?_0x5a01c6[_0xcdd9('0x1f')][_0xcdd9('0x22')]||null:null,'limit':_0x5a01c6[_0xcdd9('0x1f')]?_0x5a01c6[_0xcdd9('0x1f')][_0xcdd9('0x23')]||null:null})['then'](function(_0x50d67a){logger['info'](_0xcdd9('0x1b'),_0x5a01c6);logger[_0xcdd9('0x14')](_0xcdd9('0x1b'),_0x5a01c6,JSON[_0xcdd9('0x24')](_0x50d67a));_0x4bf2ff(_0x50d67a);})[_0xcdd9('0x1a')](function(_0x27842c){logger[_0xcdd9('0x16')](_0xcdd9('0x1b'),_0x27842c['message'],_0x5a01c6);_0x4c4f94(_0x1fac1b[_0xcdd9('0x16')](0x1f4,_0x27842c['message']));});});};exports[_0xcdd9('0x25')]=function(_0x2ba558){return new Promise(function(_0x168144,_0x234043){return db[_0xcdd9('0x1c')]['find']({'where':_0x2ba558['options']?_0x2ba558['options'][_0xcdd9('0x21')]||null:null})[_0xcdd9('0x10')](function(_0x237ec2){if(_0x237ec2){return _0x237ec2[_0xcdd9('0x26')](_0x2ba558['body']['ids'],_[_0xcdd9('0x27')](_0x2ba558['body'],[_0xcdd9('0x28'),'id'])||{});}})[_0xcdd9('0x29')](function(_0x1af407){logger[_0xcdd9('0x11')]('AddTags',_0x2ba558);logger[_0xcdd9('0x14')](_0xcdd9('0x2a'),_0x2ba558,JSON[_0xcdd9('0x24')](_0x1af407));_0x168144(_0x1af407);})[_0xcdd9('0x1a')](function(_0x3b72dc){logger[_0xcdd9('0x16')]('AddTags',_0x3b72dc[_0xcdd9('0x18')],_0x2ba558);_0x234043(_this[_0xcdd9('0x16')](0x1f4,_0x3b72dc['message']));});});}; \ No newline at end of file +var _0x23ac=['body','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','UpdateFaxInteraction','FaxInteraction','update','options','where','attributes','limit','catch','AddTagsToFaxInteraction','find'];(function(_0x27781c,_0x55ed89){var _0x48cee6=function(_0x20d9d9){while(--_0x20d9d9){_0x27781c['push'](_0x27781c['shift']());}};_0x48cee6(++_0x55ed89);}(_0x23ac,0xf5));var _0xc23a=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x23ac[_0x47e549];return _0x251374;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc23a('0x0'));var BPromise=require(_0xc23a('0x1'));var rs=require(_0xc23a('0x2'));var fs=require('fs');var Redis=require(_0xc23a('0x3'));var db=require(_0xc23a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc23a('0x5'))(_0xc23a('0x6'));var config=require('../../config/environment');var jayson=require(_0xc23a('0x7'));var client=jayson[_0xc23a('0x8')][_0xc23a('0x9')]({'port':0x232a});config[_0xc23a('0xa')]=_['defaults'](config[_0xc23a('0xa')],{'host':_0xc23a('0xb'),'port':0x18eb});var socket=require(_0xc23a('0xc'))(new Redis(config[_0xc23a('0xa')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2a43a3,_0x3f2310,_0x5ce2c0){return new BPromise(function(_0x4a66db,_0x431eb7){return client[_0xc23a('0xd')](_0x2a43a3,_0x5ce2c0)[_0xc23a('0xe')](function(_0x2c890e){logger[_0xc23a('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x3f2310,'request\x20sent');logger[_0xc23a('0x10')](_0xc23a('0x11'),_0x3f2310,_0xc23a('0x12'),JSON[_0xc23a('0x13')](_0x2c890e));if(_0x2c890e[_0xc23a('0x14')]){if(_0x2c890e[_0xc23a('0x14')][_0xc23a('0x15')]===0x1f4){logger[_0xc23a('0x14')](_0xc23a('0x16'),_0x3f2310,_0x2c890e['error'][_0xc23a('0x17')]);return _0x431eb7(_0x2c890e[_0xc23a('0x14')][_0xc23a('0x17')]);}logger[_0xc23a('0x14')](_0xc23a('0x16'),_0x3f2310,_0x2c890e['error']['message']);return _0x4a66db(_0x2c890e['error'][_0xc23a('0x17')]);}else{logger[_0xc23a('0xf')](_0xc23a('0x16'),_0x3f2310,'request\x20sent');_0x4a66db(_0x2c890e[_0xc23a('0x18')][_0xc23a('0x17')]);}})['catch'](function(_0x52b68c){logger[_0xc23a('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x3f2310,_0x52b68c);_0x431eb7(_0x52b68c);});});}exports[_0xc23a('0x19')]=function(_0x16ad80){var _0x258a98=this;return new Promise(function(_0x47f7dd,_0x38c2b1){return db[_0xc23a('0x1a')][_0xc23a('0x1b')](_0x16ad80['body'],{'raw':_0x16ad80['options']?_0x16ad80[_0xc23a('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16ad80['options']?_0x16ad80['options'][_0xc23a('0x1d')]||null:null,'attributes':_0x16ad80['options']?_0x16ad80[_0xc23a('0x1c')][_0xc23a('0x1e')]||null:null,'limit':_0x16ad80['options']?_0x16ad80[_0xc23a('0x1c')][_0xc23a('0x1f')]||null:null})[_0xc23a('0xe')](function(_0x403b98){logger[_0xc23a('0xf')](_0xc23a('0x19'),_0x16ad80);logger[_0xc23a('0x10')](_0xc23a('0x19'),_0x16ad80,JSON[_0xc23a('0x13')](_0x403b98));_0x47f7dd(_0x403b98);})[_0xc23a('0x20')](function(_0x4591c4){logger[_0xc23a('0x14')](_0xc23a('0x19'),_0x4591c4[_0xc23a('0x17')],_0x16ad80);_0x38c2b1(_0x258a98['error'](0x1f4,_0x4591c4[_0xc23a('0x17')]));});});};exports[_0xc23a('0x21')]=function(_0x112d25){return new Promise(function(_0x75e58b,_0x5bea31){return db[_0xc23a('0x1a')][_0xc23a('0x22')]({'where':_0x112d25['options']?_0x112d25[_0xc23a('0x1c')][_0xc23a('0x1d')]||null:null})['then'](function(_0x517bfb){if(_0x517bfb){return _0x517bfb['addTags'](_0x112d25[_0xc23a('0x23')][_0xc23a('0x24')],_[_0xc23a('0x25')](_0x112d25[_0xc23a('0x23')],[_0xc23a('0x24'),'id'])||{});}})[_0xc23a('0x26')](function(_0x18c209){logger['info'](_0xc23a('0x27'),_0x112d25);logger[_0xc23a('0x10')](_0xc23a('0x27'),_0x112d25,JSON[_0xc23a('0x13')](_0x18c209));_0x75e58b(_0x18c209);})[_0xc23a('0x20')](function(_0x244184){logger[_0xc23a('0x14')](_0xc23a('0x27'),_0x244184[_0xc23a('0x17')],_0x112d25);_0x5bea31(_this[_0xc23a('0x14')](0x1f4,_0x244184[_0xc23a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 4505455..bab1b2b 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 _0x5969=['emit','faxInteraction:','./faxInteraction.events','remove','update'];(function(_0x5849b8,_0x95d106){var _0xe43b9=function(_0x3ce71e){while(--_0x3ce71e){_0x5849b8['push'](_0x5849b8['shift']());}};_0xe43b9(++_0x95d106);}(_0x5969,0x66));var _0x9596=function(_0x1c28b1,_0x1be593){_0x1c28b1=_0x1c28b1-0x0;var _0x45cd08=_0x5969[_0x1c28b1];return _0x45cd08;};'use strict';var FaxInteractionEvents=require(_0x9596('0x0'));var events=['save',_0x9596('0x1'),_0x9596('0x2')];function createListener(_0x2f034e,_0x1b6a6f){return function(_0x4d67b0){_0x1b6a6f[_0x9596('0x3')](_0x2f034e,_0x4d67b0);};}function removeListener(_0x238cae,_0x3ed1d2){return function(){FaxInteractionEvents['removeListener'](_0x238cae,_0x3ed1d2);};}exports['register']=function(_0x4277ac){for(var _0x250dda=0x0,_0x5232f6=events['length'];_0x250dda<_0x5232f6;_0x250dda++){var _0x4b1e71=events[_0x250dda];var _0x380e5e=createListener(_0x9596('0x4')+_0x4b1e71,_0x4277ac);FaxInteractionEvents['on'](_0x4b1e71,_0x380e5e);}}; \ No newline at end of file +var _0xa86b=['save','update','emit','faxInteraction:','./faxInteraction.events'];(function(_0x484c48,_0x5b23fe){var _0xbf45e4=function(_0x4137bb){while(--_0x4137bb){_0x484c48['push'](_0x484c48['shift']());}};_0xbf45e4(++_0x5b23fe);}(_0xa86b,0x1df));var _0xba86=function(_0x3254c7,_0x49f01a){_0x3254c7=_0x3254c7-0x0;var _0x2b8e38=_0xa86b[_0x3254c7];return _0x2b8e38;};'use strict';var FaxInteractionEvents=require(_0xba86('0x0'));var events=[_0xba86('0x1'),'remove',_0xba86('0x2')];function createListener(_0x16cc07,_0x33a5f7){return function(_0x261f1f){_0x33a5f7[_0xba86('0x3')](_0x16cc07,_0x261f1f);};}function removeListener(_0x365a4a,_0x692882){return function(){FaxInteractionEvents['removeListener'](_0x365a4a,_0x692882);};}exports['register']=function(_0x24db17){for(var _0x46f689=0x0,_0xb44aba=events['length'];_0x46f689<_0xb44aba;_0x46f689++){var _0x1a6149=events[_0x46f689];var _0x213d1a=createListener(_0xba86('0x4')+_0x1a6149,_0x24db17);FaxInteractionEvents['on'](_0x1a6149,_0x213d1a);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 6326790..5e22a82 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 _0x98d5=['destroy','removeTags','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','get','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','fax','addTags','put','/:id','tracked','faxinteraction:update','update','faxinteraction:destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98d5,0xfb));var _0x598d=function(_0x178d6d,_0x5340b4){_0x178d6d=_0x178d6d-0x0;var _0x288eb2=_0x98d5[_0x178d6d];return _0x288eb2;};'use strict';var multer=require(_0x598d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x598d('0x1'));var express=require(_0x598d('0x2'));var router=express[_0x598d('0x3')]();var fs_extra=require(_0x598d('0x4'));var auth=require(_0x598d('0x5'));var interaction=require(_0x598d('0x6'));var config=require(_0x598d('0x7'));var controller=require(_0x598d('0x8'));router['get']('/',auth[_0x598d('0x9')](),controller['index']);router[_0x598d('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x598d('0xb')]);router[_0x598d('0xa')]('/:id',auth[_0x598d('0x9')](),controller[_0x598d('0xc')]);router[_0x598d('0xa')](_0x598d('0xd'),auth[_0x598d('0x9')](),controller[_0x598d('0xe')]);router['get']('/:id/download',auth[_0x598d('0x9')](),controller[_0x598d('0xf')]);router[_0x598d('0x10')]('/',auth[_0x598d('0x9')](),controller[_0x598d('0x11')]);router[_0x598d('0x10')](_0x598d('0xd'),auth[_0x598d('0x9')](),controller[_0x598d('0x12')]);router[_0x598d('0x10')](_0x598d('0x13'),auth[_0x598d('0x9')](),interaction['tracked'](_0x598d('0x14'),'faxinteraction:addtags'),controller[_0x598d('0x15')]);router[_0x598d('0x16')](_0x598d('0x17'),auth[_0x598d('0x9')](),interaction[_0x598d('0x18')]('fax',_0x598d('0x19')),controller[_0x598d('0x1a')]);router['delete'](_0x598d('0x17'),auth[_0x598d('0x9')](),interaction['tracked'](_0x598d('0x14'),_0x598d('0x1b')),controller[_0x598d('0x1c')]);router['delete']('/:id/tags',auth[_0x598d('0x9')](),controller[_0x598d('0x1d')]);module[_0x598d('0x1e')]=router; \ No newline at end of file +var _0xa1a6=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path'];(function(_0x5d5ed0,_0x5caa45){var _0x17cd5f=function(_0x3652e1){while(--_0x3652e1){_0x5d5ed0['push'](_0x5d5ed0['shift']());}};_0x17cd5f(++_0x5caa45);}(_0xa1a6,0x10d));var _0x6a1a=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0xa1a6[_0x158da6];return _0x429c30;};'use strict';var multer=require(_0x6a1a('0x0'));var util=require(_0x6a1a('0x1'));var path=require(_0x6a1a('0x2'));var timeout=require(_0x6a1a('0x3'));var express=require(_0x6a1a('0x4'));var router=express[_0x6a1a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6a1a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a1a('0x7'));var controller=require(_0x6a1a('0x8'));router[_0x6a1a('0x9')]('/',auth[_0x6a1a('0xa')](),controller[_0x6a1a('0xb')]);router[_0x6a1a('0x9')]('/describe',auth[_0x6a1a('0xa')](),controller[_0x6a1a('0xc')]);router[_0x6a1a('0x9')](_0x6a1a('0xd'),auth[_0x6a1a('0xa')](),controller[_0x6a1a('0xe')]);router['get'](_0x6a1a('0xf'),auth[_0x6a1a('0xa')](),controller[_0x6a1a('0x10')]);router[_0x6a1a('0x9')]('/:id/download',auth[_0x6a1a('0xa')](),controller[_0x6a1a('0x11')]);router['post']('/',auth[_0x6a1a('0xa')](),controller[_0x6a1a('0x12')]);router[_0x6a1a('0x13')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6a1a('0x14')]);router[_0x6a1a('0x13')](_0x6a1a('0x15'),auth['isAuthenticated'](),interaction[_0x6a1a('0x16')](_0x6a1a('0x17'),_0x6a1a('0x18')),controller[_0x6a1a('0x19')]);router[_0x6a1a('0x1a')](_0x6a1a('0xd'),auth['isAuthenticated'](),interaction[_0x6a1a('0x16')](_0x6a1a('0x17'),_0x6a1a('0x1b')),controller[_0x6a1a('0x1c')]);router[_0x6a1a('0x1d')]('/:id',auth['isAuthenticated'](),interaction[_0x6a1a('0x16')](_0x6a1a('0x17'),_0x6a1a('0x1e')),controller[_0x6a1a('0x1f')]);router[_0x6a1a('0x1d')]('/:id/tags',auth[_0x6a1a('0xa')](),controller[_0x6a1a('0x20')]);module[_0x6a1a('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index b8c5ce7..92ba005 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 _0x1948=['BOOLEAN','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x5702d1,_0x8e1bea){var _0x5c844b=function(_0x5a117a){while(--_0x5a117a){_0x5702d1['push'](_0x5702d1['shift']());}};_0x5c844b(++_0x8e1bea);}(_0x1948,0x145));var _0x8194=function(_0xb91ba6,_0x50cb6f){_0xb91ba6=_0xb91ba6-0x0;var _0x51b33c=_0x1948[_0xb91ba6];return _0x51b33c;};'use strict';var Sequelize=require(_0x8194('0x0'));module[_0x8194('0x1')]={'body':{'type':Sequelize[_0x8194('0x2')](_0x8194('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8194('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8194('0x5')),'defaultValue':_0x8194('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8194('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x8194('0x6')]}}; \ No newline at end of file +var _0x6c84=['TEXT','medium','BOOLEAN','out','sequelize','exports'];(function(_0x4467b8,_0x364a40){var _0x2a8192=function(_0x104e82){while(--_0x104e82){_0x4467b8['push'](_0x4467b8['shift']());}};_0x2a8192(++_0x364a40);}(_0x6c84,0x112));var _0x46c8=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x6c84[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0x46c8('0x0'));module[_0x46c8('0x1')]={'body':{'type':Sequelize[_0x46c8('0x2')](_0x46c8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x46c8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x46c8('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x46c8('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 3122601..daca577 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 _0x6206=['code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','show','params','includeAll','find','body','describe','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','internal','manual','interface','channel','motionChannel','accept','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','QueryTypes','User','email','SIP/%s','event','rejectmessage','create','CmContact','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x3b3064,_0x36bf5e){var _0x51eb6a=function(_0x52b27e){while(--_0x52b27e){_0x3b3064['push'](_0x3b3064['shift']());}};_0x51eb6a(++_0x36bf5e);}(_0x6206,0x193));var _0x6620=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x6206[_0x12f688];return _0x59c3de;};'use strict';var emlformat=require(_0x6620('0x0'));var rimraf=require(_0x6620('0x1'));var zipdir=require(_0x6620('0x2'));var jsonpatch=require(_0x6620('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6620('0x4'));var util=require(_0x6620('0x5'));var path=require(_0x6620('0x6'));var sox=require(_0x6620('0x7'));var csv=require(_0x6620('0x8'));var ejs=require(_0x6620('0x9'));var fs=require('fs');var fs_extra=require(_0x6620('0xa'));var _=require(_0x6620('0xb'));var squel=require(_0x6620('0xc'));var crypto=require(_0x6620('0xd'));var jsforce=require(_0x6620('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6620('0x8'));var querystring=require(_0x6620('0xf'));var Papa=require(_0x6620('0x10'));var Redis=require(_0x6620('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6620('0x12'));var hardwareService=require(_0x6620('0x13'));var logger=require(_0x6620('0x14'))(_0x6620('0x15'));var utils=require(_0x6620('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6620('0x17'));var db=require(_0x6620('0x18'))['db'];config[_0x6620('0x19')]=_[_0x6620('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6620('0x1b'))(new Redis(config[_0x6620('0x19')]));require(_0x6620('0x1c'))[_0x6620('0x1d')](socket);var jayson=require(_0x6620('0x1e'));var client=jayson[_0x6620('0x1f')][_0x6620('0x20')]({'port':0x232c});var client9002=jayson[_0x6620('0x1f')][_0x6620('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x235c2c,_0x529e6e,_0x2f456b,_0x1287b7){return new BPromise(function(_0x23a698,_0x2ff579){var _0x51783e=_0x1287b7||client;return _0x51783e[_0x6620('0x21')](_0x235c2c,_0x2f456b)[_0x6620('0x22')](function(_0x4cd4ce){logger[_0x6620('0x23')](_0x6620('0x24'),_0x529e6e,_0x6620('0x25'));logger[_0x6620('0x26')](_0x6620('0x27'),_0x529e6e,'request\x20sent',JSON['stringify'](_0x4cd4ce));if(_0x4cd4ce[_0x6620('0x28')]){if(_0x4cd4ce[_0x6620('0x28')][_0x6620('0x29')]===0x1f4){logger[_0x6620('0x28')](_0x6620('0x24'),_0x529e6e,_0x4cd4ce[_0x6620('0x28')][_0x6620('0x2a')]);return _0x2ff579(_0x4cd4ce[_0x6620('0x28')][_0x6620('0x2a')]);}logger[_0x6620('0x28')](_0x6620('0x24'),_0x529e6e,_0x4cd4ce['error'][_0x6620('0x2a')]);return _0x23a698(_0x4cd4ce[_0x6620('0x28')][_0x6620('0x2a')]);}else{logger[_0x6620('0x23')](_0x6620('0x24'),_0x529e6e,'request\x20sent');_0x23a698(_0x4cd4ce[_0x6620('0x2b')][_0x6620('0x2a')]);}})[_0x6620('0x2c')](function(_0x1d1635){logger[_0x6620('0x28')](_0x6620('0x24'),_0x529e6e,_0x1d1635);_0x2ff579(_0x1d1635);});});}function respondWithStatusCode(_0x5bfb02,_0x8a604d){_0x8a604d=_0x8a604d||0xcc;return function(_0x1eeb1a){if(_0x1eeb1a){return _0x5bfb02[_0x6620('0x2d')](_0x8a604d);}return _0x5bfb02['status'](_0x8a604d)[_0x6620('0x2e')]();};}function respondWithResult(_0x594d04,_0x5693a2){_0x5693a2=_0x5693a2||0xc8;return function(_0x2595f9){if(_0x2595f9){return _0x594d04[_0x6620('0x2f')](_0x5693a2)[_0x6620('0x30')](_0x2595f9);}};}function respondWithFilteredResult(_0x299b1d,_0x5895e5){return function(_0x2b8b63){if(_0x2b8b63){var _0x26286d=typeof _0x5895e5[_0x6620('0x31')]===_0x6620('0x32')&&typeof _0x5895e5['limit']===_0x6620('0x32');var _0x55a4e3=_0x2b8b63[_0x6620('0x33')];var _0x4f3873=_0x26286d?0x0:_0x5895e5[_0x6620('0x31')];var _0x42374c=_0x26286d?_0x2b8b63[_0x6620('0x33')]:_0x5895e5[_0x6620('0x31')]+_0x5895e5[_0x6620('0x34')];var _0x4fce9b;if(_0x42374c>=_0x55a4e3){_0x42374c=_0x55a4e3;_0x4fce9b=0xc8;}else{_0x4fce9b=0xce;}_0x299b1d[_0x6620('0x2f')](_0x4fce9b);return _0x299b1d['set']('Content-Range',_0x4f3873+'-'+_0x42374c+'/'+_0x55a4e3)[_0x6620('0x30')](_0x2b8b63);}return null;};}function patchUpdates(_0x530376){return function(_0x5a7822){try{jsonpatch['apply'](_0x5a7822,_0x530376,!![]);}catch(_0x4aa86d){return BPromise[_0x6620('0x35')](_0x4aa86d);}return _0x5a7822[_0x6620('0x36')]();};}function saveUpdates(_0x45ae4e,_0x54e15e){return function(_0x49039e){if(_0x49039e){return _0x49039e[_0x6620('0x37')](_0x45ae4e)[_0x6620('0x22')](function(_0x23351a){return _0x23351a;});}return null;};}function removeEntity(_0x1c3ca0,_0x530b05){return function(_0x243534){if(_0x243534){return _0x243534[_0x6620('0x38')]()[_0x6620('0x22')](function(){_0x1c3ca0[_0x6620('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a5db7,_0x1cae1e){return function(_0x133d61){if(!_0x133d61){_0x4a5db7['sendStatus'](0x194);}return _0x133d61;};}function handleError(_0x2fcf56,_0x216d96){_0x216d96=_0x216d96||0x1f4;return function(_0x58b963){logger[_0x6620('0x28')](_0x58b963[_0x6620('0x39')]);if(_0x58b963['name']){delete _0x58b963[_0x6620('0x3a')];}_0x2fcf56[_0x6620('0x2f')](_0x216d96)[_0x6620('0x3b')](_0x58b963);};}exports[_0x6620('0x3c')]=function(_0x19a06e,_0x9dbba5){var _0x3fa24b={},_0x480dee={},_0x515101={'count':0x0,'rows':[]};var _0x1c64b8=_[_0x6620('0x3d')](db[_0x6620('0x3e')][_0x6620('0x3f')],function(_0x356ddb){return{'name':_0x356ddb[_0x6620('0x40')],'type':_0x356ddb[_0x6620('0x41')][_0x6620('0x42')]};});_0x480dee[_0x6620('0x43')]=_[_0x6620('0x3d')](_0x1c64b8,_0x6620('0x3a'));_0x480dee['query']=_[_0x6620('0x44')](_0x19a06e[_0x6620('0x45')]);_0x480dee[_0x6620('0x46')]=_[_0x6620('0x47')](_0x480dee[_0x6620('0x43')],_0x480dee[_0x6620('0x45')]);_0x3fa24b[_0x6620('0x48')]=_[_0x6620('0x47')](_0x480dee[_0x6620('0x43')],qs[_0x6620('0x49')](_0x19a06e[_0x6620('0x45')][_0x6620('0x49')]));_0x3fa24b['attributes']=_0x3fa24b[_0x6620('0x48')][_0x6620('0x4a')]?_0x3fa24b[_0x6620('0x48')]:_0x480dee['model'];if(!_0x19a06e['query'][_0x6620('0x4b')](_0x6620('0x4c'))){_0x3fa24b[_0x6620('0x34')]=qs['limit'](_0x19a06e[_0x6620('0x45')]['limit']);_0x3fa24b['offset']=qs[_0x6620('0x31')](_0x19a06e[_0x6620('0x45')][_0x6620('0x31')]);}_0x3fa24b[_0x6620('0x4d')]=qs['sort'](_0x19a06e[_0x6620('0x45')][_0x6620('0x4e')]);_0x3fa24b[_0x6620('0x4f')]=qs[_0x6620('0x46')](_[_0x6620('0x50')](_0x19a06e[_0x6620('0x45')],_0x480dee[_0x6620('0x46')]),_0x1c64b8);if(_0x19a06e[_0x6620('0x45')][_0x6620('0x51')]){_0x3fa24b[_0x6620('0x4f')]=_[_0x6620('0x52')](_0x3fa24b[_0x6620('0x4f')],{'$or':_['map'](_0x1c64b8,function(_0x76a98a){if(_0x76a98a['type']!=='VIRTUAL'){var _0x26845f={};_0x26845f[_0x76a98a[_0x6620('0x3a')]]={'$like':'%'+_0x19a06e[_0x6620('0x45')][_0x6620('0x51')]+'%'};return _0x26845f;}})});}_0x3fa24b=_[_0x6620('0x52')]({},_0x3fa24b,_0x19a06e[_0x6620('0x53')]);var _0x3d6031={'where':_0x3fa24b[_0x6620('0x4f')]};return db['FaxMessage'][_0x6620('0x33')](_0x3d6031)[_0x6620('0x22')](function(_0x5041b1){_0x515101[_0x6620('0x33')]=_0x5041b1;if(_0x19a06e['query']['includeAll']){_0x3fa24b[_0x6620('0x54')]=[{'all':!![]}];}return db[_0x6620('0x3e')]['findAll'](_0x3fa24b);})['then'](function(_0xb9e486){_0x515101[_0x6620('0x55')]=_0xb9e486;return _0x515101;})['then'](respondWithFilteredResult(_0x9dbba5,_0x3fa24b))[_0x6620('0x2c')](handleError(_0x9dbba5,null));};exports[_0x6620('0x56')]=function(_0x16f036,_0x276b2c){var _0xfd2f5d={'raw':!![],'where':{'id':_0x16f036[_0x6620('0x57')]['id']}},_0x32b7c7={};_0x32b7c7[_0x6620('0x43')]=_[_0x6620('0x44')](db[_0x6620('0x3e')][_0x6620('0x3f')]);_0x32b7c7[_0x6620('0x45')]=_[_0x6620('0x44')](_0x16f036['query']);_0x32b7c7[_0x6620('0x46')]=_[_0x6620('0x47')](_0x32b7c7[_0x6620('0x43')],_0x32b7c7[_0x6620('0x45')]);_0xfd2f5d['attributes']=_[_0x6620('0x47')](_0x32b7c7[_0x6620('0x43')],qs[_0x6620('0x49')](_0x16f036[_0x6620('0x45')][_0x6620('0x49')]));_0xfd2f5d[_0x6620('0x48')]=_0xfd2f5d[_0x6620('0x48')]['length']?_0xfd2f5d[_0x6620('0x48')]:_0x32b7c7[_0x6620('0x43')];if(_0x16f036[_0x6620('0x45')][_0x6620('0x58')]){_0xfd2f5d[_0x6620('0x54')]=[{'all':!![]}];}_0xfd2f5d=_[_0x6620('0x52')]({},_0xfd2f5d,_0x16f036['options']);return db['FaxMessage'][_0x6620('0x59')](_0xfd2f5d)[_0x6620('0x22')](handleEntityNotFound(_0x276b2c,null))[_0x6620('0x22')](respondWithResult(_0x276b2c,null))[_0x6620('0x2c')](handleError(_0x276b2c,null));};exports[_0x6620('0x37')]=function(_0x33209e,_0x594b2b){if(_0x33209e[_0x6620('0x5a')]['id']){delete _0x33209e[_0x6620('0x5a')]['id'];}return db[_0x6620('0x3e')][_0x6620('0x59')]({'where':{'id':_0x33209e[_0x6620('0x57')]['id']}})[_0x6620('0x22')](handleEntityNotFound(_0x594b2b,null))['then'](saveUpdates(_0x33209e['body'],null))['then'](respondWithResult(_0x594b2b,null))['catch'](handleError(_0x594b2b,null));};exports[_0x6620('0x38')]=function(_0x4a85b1,_0x348ba1){return db[_0x6620('0x3e')]['find']({'where':{'id':_0x4a85b1[_0x6620('0x57')]['id']}})['then'](handleEntityNotFound(_0x348ba1,null))['then'](removeEntity(_0x348ba1,null))[_0x6620('0x2c')](handleError(_0x348ba1,null));};exports[_0x6620('0x5b')]=function(_0x3aa3ca,_0x31b595){return db['FaxMessage'][_0x6620('0x5b')]()['then'](respondWithResult(_0x31b595,null))[_0x6620('0x2c')](handleError(_0x31b595,null));};var interaction_log=require('../../config/logger')(_0x6620('0x5c'));exports['accept']=function(_0x3a3d0b,_0x1b2bc9,_0x598d88){var _0x193915={'agent':{},'channel':_0x6620('0x5d')};if(_0x3a3d0b[_0x6620('0x5a')]['id']){delete _0x3a3d0b[_0x6620('0x5a')]['id'];}_0x3a3d0b[_0x6620('0x5a')][_0x6620('0x5e')]=!![];_0x3a3d0b[_0x6620('0x5a')][_0x6620('0x5f')]=moment()[_0x6620('0x60')](_0x6620('0x61'));_0x3a3d0b[_0x6620('0x5a')][_0x6620('0x62')]=_0x3a3d0b[_0x6620('0x5a')][_0x6620('0x62')]||_0x3a3d0b[_0x6620('0x63')]['id'];_0x193915[_0x6620('0x64')]['id']=_0x3a3d0b['body']['UserId'];return db[_0x6620('0x3e')][_0x6620('0x59')]({'where':{'id':_0x3a3d0b[_0x6620('0x57')]['id'],'UserId':null}})[_0x6620('0x22')](handleEntityNotFound(_0x1b2bc9,null))[_0x6620('0x22')](saveUpdates(_0x3a3d0b['body'],null))['then'](function(_0x232ef3){if(_0x232ef3){_0x193915[_0x6620('0x2a')]=_0x232ef3[_0x6620('0x65')]({'plain':!![]});return db[_0x6620('0x66')][_0x6620('0x59')]({'where':{'id':_0x232ef3[_0x6620('0x67')]}});}return null;})[_0x6620('0x22')](handleEntityNotFound(_0x1b2bc9,null))[_0x6620('0x22')](function(_0xaaafa7){if(_0xaaafa7){return _0xaaafa7[_0x6620('0x37')]({'UserId':_0x3a3d0b['body']['UserId'],'read1stAt':_[_0x6620('0x68')](_0xaaafa7['read1stAt'])?moment()[_0x6620('0x60')](_0x6620('0x61')):undefined});}return null;})[_0x6620('0x22')](function(_0x1f9406){if(_0x1f9406){_0x193915[_0x6620('0x69')]=_0x1f9406[_0x6620('0x65')]({'plain':!![]});interaction_log[_0x6620('0x23')](_0x6620('0x6a'),_0x3a3d0b[_0x6620('0x63')]['id'],_0x3a3d0b[_0x6620('0x63')][_0x6620('0x3a')],_0x3a3d0b[_0x6620('0x63')]['role'],_0x193915[_0x6620('0x69')]['id'],_0x3a3d0b[_0x6620('0x5a')]?JSON[_0x6620('0x6b')](_0x3a3d0b[_0x6620('0x5a')]):_0x6620('0x6c'));return respondWithRpcPromise(_0x6620('0x6d'),_0x6620('0x6e'),_0x193915);}return null;})[_0x6620('0x22')](function(_0x404788){var _0x2b5c2c=_0x6620('0x6f')+_0x404788[_0x6620('0x2a')][_0x6620('0x70')];return db[_0x6620('0x71')][_0x6620('0x45')](_0x2b5c2c,{'type':db[_0x6620('0x72')]['QueryTypes'][_0x6620('0x73')],'raw':!![]})[_0x6620('0x22')](function(_0x15a8e2){return _0x15a8e2;});})[_0x6620('0x22')](function(_0x4f22d8){if(_0x4f22d8){_0x193915['message'][_0x6620('0x74')]=_0x4f22d8[0x0];if(!_0x3a3d0b['body'][_0x6620('0x62')])return;return db['User'][_0x6620('0x59')]({'where':{'id':_0x3a3d0b['body'][_0x6620('0x62')],'role':_0x6620('0x64')},'attributes':['id',_0x6620('0x3a'),_0x6620('0x75'),'email',_0x6620('0x76')],'raw':!![]});}return null;})['then'](function(_0x1d0f32){if(!_0x1d0f32)return null;_0x193915[_0x6620('0x2a')][_0x6620('0x64')]=_0x1d0f32;return _0x193915;})[_0x6620('0x22')](function(_0x5363c9){if(_0x5363c9){if(_0x3a3d0b[_0x6620('0x5a')][_0x6620('0x77')]){_0x193915[_0x6620('0x2a')][_0x6620('0x78')]=util[_0x6620('0x60')]('SIP/%s',_0x3a3d0b[_0x6620('0x63')][_0x6620('0x3a')]);_0x193915['message'][_0x6620('0x79')]=_0x193915['channel'];_0x193915[_0x6620('0x2a')][_0x6620('0x7a')]=_0x193915[_0x6620('0x79')];_0x193915['message']['event']=_0x6620('0x7b');return respondWithRpcPromise('EventManager',_0x6620('0x7c'),{'event':'acceptmessage','message':_0x193915['message']},client9002)['then'](function(){return _0x193915;});}return _0x193915;}return null;})['then'](respondWithResult(_0x1b2bc9,null))[_0x6620('0x2c')](handleError(_0x1b2bc9,null));};var interaction_log=require('../../config/logger')(_0x6620('0x5c'));exports[_0x6620('0x35')]=function(_0xf64b83,_0x59df6a,_0x359ff0){var _0x2ad772={'agent':{},'channel':_0x6620('0x5d')};if(_0xf64b83['body']['id']){delete _0xf64b83[_0x6620('0x5a')]['id'];}_0xf64b83['body']['UserId']=_0xf64b83['body']['UserId']||_0xf64b83[_0x6620('0x63')]['id'];_0x2ad772[_0x6620('0x64')]['id']=_0xf64b83[_0x6620('0x5a')][_0x6620('0x62')];return db[_0x6620('0x3e')]['find']({'where':{'id':_0xf64b83[_0x6620('0x57')]['id'],'UserId':null}})[_0x6620('0x22')](handleEntityNotFound(_0x59df6a,null))[_0x6620('0x22')](function(_0x51165d){if(_0x51165d){_0x2ad772['message']=_0x51165d[_0x6620('0x65')]({'plain':!![]});return db['FaxInteraction'][_0x6620('0x59')]({'where':{'id':_0x51165d[_0x6620('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x59df6a,null))[_0x6620('0x22')](function(_0x35434f){if(_0x35434f){_0x2ad772[_0x6620('0x69')]=_0x35434f[_0x6620('0x65')]({'plain':!![]});interaction_log['info'](_0x6620('0x7d'),_0xf64b83[_0x6620('0x63')]['id'],_0xf64b83[_0x6620('0x63')][_0x6620('0x3a')],_0xf64b83[_0x6620('0x63')][_0x6620('0x7e')],_0x2ad772[_0x6620('0x69')]['id'],_0xf64b83[_0x6620('0x5a')]?JSON[_0x6620('0x6b')](_0xf64b83['body']):'null');return respondWithRpcPromise(_0x6620('0x7f'),_0x6620('0x80'),_0x2ad772);}return null;})[_0x6620('0x22')](function(_0x2f5697){var _0x3b8bde=_0x6620('0x6f')+_0x2f5697[_0x6620('0x2a')][_0x6620('0x70')];return db[_0x6620('0x71')][_0x6620('0x45')](_0x3b8bde,{'type':db[_0x6620('0x72')][_0x6620('0x81')][_0x6620('0x73')],'raw':!![]})['then'](function(_0x43ace3){return _0x43ace3;});})[_0x6620('0x22')](function(_0x3cf27d){if(_0x3cf27d){_0x2ad772[_0x6620('0x2a')][_0x6620('0x74')]=_0x3cf27d[0x0];if(!_0xf64b83[_0x6620('0x5a')][_0x6620('0x62')])return;return db[_0x6620('0x82')][_0x6620('0x59')]({'where':{'id':_0xf64b83['body']['UserId'],'role':_0x6620('0x64')},'attributes':['id','name',_0x6620('0x75'),_0x6620('0x83'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3c19e1){if(!_0x3c19e1)return null;_0x2ad772[_0x6620('0x2a')][_0x6620('0x64')]=_0x3c19e1;return _0x2ad772;})['then'](function(_0x1db72f){if(_0x1db72f){_0x1db72f['message'][_0x6620('0x78')]=util[_0x6620('0x60')](_0x6620('0x84'),_0xf64b83[_0x6620('0x63')][_0x6620('0x3a')]);_0x1db72f['message'][_0x6620('0x79')]=_0x2ad772[_0x6620('0x79')];_0x1db72f[_0x6620('0x2a')][_0x6620('0x7a')]=_0x2ad772[_0x6620('0x79')];_0x1db72f[_0x6620('0x2a')][_0x6620('0x85')]='reject';respondWithRpcPromise(_0x6620('0x7c'),'EventManager',{'event':_0x6620('0x86'),'message':_0x1db72f[_0x6620('0x2a')]},client9002);return _0x2ad772;}return null;})[_0x6620('0x22')](respondWithResult(_0x59df6a,null))[_0x6620('0x2c')](handleError(_0x59df6a,null));};exports[_0x6620('0x87')]=function(_0x2e39c5,_0x5e39bc){var _0x231a1a;return db[_0x6620('0x3e')][_0x6620('0x87')](_0x2e39c5[_0x6620('0x5a')],{})[_0x6620('0x22')](function(_0x14722a){_0x231a1a=_0x14722a;return db[_0x6620('0x88')]['findOne']({'where':{'id':_0x231a1a['ContactId']}});})[_0x6620('0x22')](function(_0x608cfc){if(_[_0x6620('0x68')](_0x608cfc)){return;}else{_0x231a1a[_0x6620('0x5d')]=_0x608cfc[_0x6620('0x5d')];return db[_0x6620('0x89')]['findOne']({'where':{'id':_0x231a1a['AttachmentId']}});}})['then'](function(_0x4836ee){return respondWithRpcPromise(_0x6620('0x8a'),'SendFax',{'FaxAccountId':_[_0x6620('0x68')](_0x2e39c5[_0x6620('0x5a')])?undefined:_0x2e39c5['body'][_0x6620('0x8b')],'path':_['isNil'](_0x4836ee)?undefined:util[_0x6620('0x60')](_0x6620('0x8c'),_0x4836ee[_0x6620('0x8d')]),'fax':_['isNil'](_0x231a1a[_0x6620('0x5d')])?undefined:_0x231a1a[_0x6620('0x5d')],'AttachmentId':_0x231a1a['AttachmentId']},client9002);})[_0x6620('0x22')](respondWithResult(_0x5e39bc,0xc9))[_0x6620('0x2c')](handleError(_0x5e39bc,null));};exports[_0x6620('0x8e')]=function(_0xf28f44,_0x2ec374){var _0x5b54f3=path[_0x6620('0x8f')](config[_0x6620('0x90')],_0x6620('0x91'),_0x6620('0x92'),_0x6620('0x93'));return db[_0x6620('0x3e')][_0x6620('0x59')]({'where':{'id':_0xf28f44[_0x6620('0x57')]['id']},'include':[{'model':db['Attachment'],'as':_0x6620('0x89')}]})[_0x6620('0x22')](handleEntityNotFound(_0x2ec374,null))['then'](function(_0x578820){if(_0x578820){return _0x2ec374[_0x6620('0x8e')](path['join'](_0x5b54f3,_0x578820[_0x6620('0x89')][_0x6620('0x8d')]));}})[_0x6620('0x2c')](handleError(_0x2ec374,null));}; \ No newline at end of file +var _0xfe74=['hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','body','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteractionId','update','isNil','read1stAt','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','reject','info','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','contact','User','event','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','files','attachments','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','undefined','limit','count','Content-Range','apply','save','destroy','end','sendStatus','name','send','index','map','FaxMessage','fieldName','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x169996,_0x4d945a){var _0x22b22b=function(_0x576be8){while(--_0x576be8){_0x169996['push'](_0x169996['shift']());}};_0x22b22b(++_0x4d945a);}(_0xfe74,0xdb));var _0x4fe7=function(_0x14b9d7,_0x2cc6fc){_0x14b9d7=_0x14b9d7-0x0;var _0x347cdc=_0xfe74[_0x14b9d7];return _0x347cdc;};'use strict';var emlformat=require(_0x4fe7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4fe7('0x1'));var rp=require('request-promise');var moment=require(_0x4fe7('0x2'));var BPromise=require(_0x4fe7('0x3'));var Mustache=require(_0x4fe7('0x4'));var util=require(_0x4fe7('0x5'));var path=require(_0x4fe7('0x6'));var sox=require(_0x4fe7('0x7'));var csv=require(_0x4fe7('0x8'));var ejs=require(_0x4fe7('0x9'));var fs=require('fs');var fs_extra=require(_0x4fe7('0xa'));var _=require(_0x4fe7('0xb'));var squel=require('squel');var crypto=require(_0x4fe7('0xc'));var jsforce=require(_0x4fe7('0xd'));var deskjs=require(_0x4fe7('0xe'));var toCsv=require(_0x4fe7('0x8'));var querystring=require(_0x4fe7('0xf'));var Papa=require(_0x4fe7('0x10'));var Redis=require(_0x4fe7('0x11'));var authService=require(_0x4fe7('0x12'));var qs=require(_0x4fe7('0x13'));var as=require(_0x4fe7('0x14'));var hardwareService=require(_0x4fe7('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4fe7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4fe7('0x17'))['db'];config[_0x4fe7('0x18')]=_[_0x4fe7('0x19')](config[_0x4fe7('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fe7('0x1a'))(new Redis(config['redis']));require(_0x4fe7('0x1b'))['register'](socket);var jayson=require(_0x4fe7('0x1c'));var client=jayson[_0x4fe7('0x1d')][_0x4fe7('0x1e')]({'port':0x232c});var client9002=jayson[_0x4fe7('0x1d')][_0x4fe7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2ecb78,_0x521d36,_0x5b995f,_0xa79a65){return new BPromise(function(_0x37702e,_0x43b918){var _0x6ed820=_0xa79a65||client;return _0x6ed820[_0x4fe7('0x1f')](_0x2ecb78,_0x5b995f)[_0x4fe7('0x20')](function(_0x2b9924){logger['info'](_0x4fe7('0x21'),_0x521d36,_0x4fe7('0x22'));logger['debug'](_0x4fe7('0x23'),_0x521d36,'request\x20sent',JSON[_0x4fe7('0x24')](_0x2b9924));if(_0x2b9924[_0x4fe7('0x25')]){if(_0x2b9924[_0x4fe7('0x25')][_0x4fe7('0x26')]===0x1f4){logger[_0x4fe7('0x25')](_0x4fe7('0x21'),_0x521d36,_0x2b9924['error'][_0x4fe7('0x27')]);return _0x43b918(_0x2b9924[_0x4fe7('0x25')][_0x4fe7('0x27')]);}logger['error'](_0x4fe7('0x21'),_0x521d36,_0x2b9924['error'][_0x4fe7('0x27')]);return _0x37702e(_0x2b9924['error']['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x521d36,_0x4fe7('0x22'));_0x37702e(_0x2b9924['result']['message']);}})[_0x4fe7('0x28')](function(_0x5c73d3){logger[_0x4fe7('0x25')](_0x4fe7('0x21'),_0x521d36,_0x5c73d3);_0x43b918(_0x5c73d3);});});}function respondWithStatusCode(_0x3c46fe,_0x5ce40f){_0x5ce40f=_0x5ce40f||0xcc;return function(_0x122f2f){if(_0x122f2f){return _0x3c46fe['sendStatus'](_0x5ce40f);}return _0x3c46fe[_0x4fe7('0x29')](_0x5ce40f)['end']();};}function respondWithResult(_0x17a9be,_0x2ef4da){_0x2ef4da=_0x2ef4da||0xc8;return function(_0x46789f){if(_0x46789f){return _0x17a9be[_0x4fe7('0x29')](_0x2ef4da)[_0x4fe7('0x2a')](_0x46789f);}};}function respondWithFilteredResult(_0x5f20b8,_0x5e59eb){return function(_0x42eafe){if(_0x42eafe){var _0x966462=typeof _0x5e59eb[_0x4fe7('0x2b')]===_0x4fe7('0x2c')&&typeof _0x5e59eb[_0x4fe7('0x2d')]==='undefined';var _0x2f1a8d=_0x42eafe[_0x4fe7('0x2e')];var _0x134700=_0x966462?0x0:_0x5e59eb[_0x4fe7('0x2b')];var _0x1874ab=_0x966462?_0x42eafe['count']:_0x5e59eb['offset']+_0x5e59eb[_0x4fe7('0x2d')];var _0x5bf47a;if(_0x1874ab>=_0x2f1a8d){_0x1874ab=_0x2f1a8d;_0x5bf47a=0xc8;}else{_0x5bf47a=0xce;}_0x5f20b8[_0x4fe7('0x29')](_0x5bf47a);return _0x5f20b8['set'](_0x4fe7('0x2f'),_0x134700+'-'+_0x1874ab+'/'+_0x2f1a8d)[_0x4fe7('0x2a')](_0x42eafe);}return null;};}function patchUpdates(_0x5183ad){return function(_0x79320){try{jsonpatch[_0x4fe7('0x30')](_0x79320,_0x5183ad,!![]);}catch(_0x3bd5bf){return BPromise['reject'](_0x3bd5bf);}return _0x79320[_0x4fe7('0x31')]();};}function saveUpdates(_0x45eab7,_0x211ee9){return function(_0xa402fe){if(_0xa402fe){return _0xa402fe['update'](_0x45eab7)[_0x4fe7('0x20')](function(_0x1737b7){return _0x1737b7;});}return null;};}function removeEntity(_0x256b08,_0xa8faa1){return function(_0x17a76a){if(_0x17a76a){return _0x17a76a[_0x4fe7('0x32')]()[_0x4fe7('0x20')](function(){_0x256b08[_0x4fe7('0x29')](0xcc)[_0x4fe7('0x33')]();});}};}function handleEntityNotFound(_0x3246e9,_0x224d57){return function(_0xf93b01){if(!_0xf93b01){_0x3246e9[_0x4fe7('0x34')](0x194);}return _0xf93b01;};}function handleError(_0x4a6651,_0x424066){_0x424066=_0x424066||0x1f4;return function(_0x2f459c){logger[_0x4fe7('0x25')](_0x2f459c['stack']);if(_0x2f459c[_0x4fe7('0x35')]){delete _0x2f459c[_0x4fe7('0x35')];}_0x4a6651[_0x4fe7('0x29')](_0x424066)[_0x4fe7('0x36')](_0x2f459c);};}exports[_0x4fe7('0x37')]=function(_0x87a625,_0x42acca){var _0x31bd3d={},_0x420313={},_0x5e1ebb={'count':0x0,'rows':[]};var _0x2e6ee1=_[_0x4fe7('0x38')](db[_0x4fe7('0x39')]['rawAttributes'],function(_0x1c2536){return{'name':_0x1c2536[_0x4fe7('0x3a')],'type':_0x1c2536['type'][_0x4fe7('0x3b')]};});_0x420313[_0x4fe7('0x3c')]=_[_0x4fe7('0x38')](_0x2e6ee1,_0x4fe7('0x35'));_0x420313[_0x4fe7('0x3d')]=_[_0x4fe7('0x3e')](_0x87a625['query']);_0x420313['filters']=_[_0x4fe7('0x3f')](_0x420313[_0x4fe7('0x3c')],_0x420313['query']);_0x31bd3d[_0x4fe7('0x40')]=_['intersection'](_0x420313[_0x4fe7('0x3c')],qs[_0x4fe7('0x41')](_0x87a625[_0x4fe7('0x3d')][_0x4fe7('0x41')]));_0x31bd3d[_0x4fe7('0x40')]=_0x31bd3d[_0x4fe7('0x40')][_0x4fe7('0x42')]?_0x31bd3d[_0x4fe7('0x40')]:_0x420313[_0x4fe7('0x3c')];if(!_0x87a625[_0x4fe7('0x3d')][_0x4fe7('0x43')](_0x4fe7('0x44'))){_0x31bd3d['limit']=qs[_0x4fe7('0x2d')](_0x87a625[_0x4fe7('0x3d')][_0x4fe7('0x2d')]);_0x31bd3d[_0x4fe7('0x2b')]=qs['offset'](_0x87a625['query'][_0x4fe7('0x2b')]);}_0x31bd3d[_0x4fe7('0x45')]=qs[_0x4fe7('0x46')](_0x87a625['query'][_0x4fe7('0x46')]);_0x31bd3d[_0x4fe7('0x47')]=qs['filters'](_[_0x4fe7('0x48')](_0x87a625[_0x4fe7('0x3d')],_0x420313[_0x4fe7('0x49')]),_0x2e6ee1);if(_0x87a625[_0x4fe7('0x3d')]['filter']){_0x31bd3d[_0x4fe7('0x47')]=_[_0x4fe7('0x4a')](_0x31bd3d[_0x4fe7('0x47')],{'$or':_[_0x4fe7('0x38')](_0x2e6ee1,function(_0x2d0000){if(_0x2d0000['type']!==_0x4fe7('0x4b')){var _0x4b9f42={};_0x4b9f42[_0x2d0000['name']]={'$like':'%'+_0x87a625[_0x4fe7('0x3d')][_0x4fe7('0x4c')]+'%'};return _0x4b9f42;}})});}_0x31bd3d=_['merge']({},_0x31bd3d,_0x87a625[_0x4fe7('0x4d')]);var _0x43ec92={'where':_0x31bd3d[_0x4fe7('0x47')]};return db[_0x4fe7('0x39')][_0x4fe7('0x2e')](_0x43ec92)[_0x4fe7('0x20')](function(_0x1c93a3){_0x5e1ebb[_0x4fe7('0x2e')]=_0x1c93a3;if(_0x87a625[_0x4fe7('0x3d')]['includeAll']){_0x31bd3d[_0x4fe7('0x4e')]=[{'all':!![]}];}return db[_0x4fe7('0x39')][_0x4fe7('0x4f')](_0x31bd3d);})[_0x4fe7('0x20')](function(_0x484805){_0x5e1ebb[_0x4fe7('0x50')]=_0x484805;return _0x5e1ebb;})['then'](respondWithFilteredResult(_0x42acca,_0x31bd3d))[_0x4fe7('0x28')](handleError(_0x42acca,null));};exports[_0x4fe7('0x51')]=function(_0x4c59e6,_0x325458){var _0x138434={'raw':!![],'where':{'id':_0x4c59e6[_0x4fe7('0x52')]['id']}},_0x1bf797={};_0x1bf797[_0x4fe7('0x3c')]=_[_0x4fe7('0x3e')](db[_0x4fe7('0x39')][_0x4fe7('0x53')]);_0x1bf797[_0x4fe7('0x3d')]=_[_0x4fe7('0x3e')](_0x4c59e6['query']);_0x1bf797['filters']=_[_0x4fe7('0x3f')](_0x1bf797[_0x4fe7('0x3c')],_0x1bf797[_0x4fe7('0x3d')]);_0x138434['attributes']=_[_0x4fe7('0x3f')](_0x1bf797[_0x4fe7('0x3c')],qs['fields'](_0x4c59e6[_0x4fe7('0x3d')][_0x4fe7('0x41')]));_0x138434['attributes']=_0x138434[_0x4fe7('0x40')][_0x4fe7('0x42')]?_0x138434[_0x4fe7('0x40')]:_0x1bf797['model'];if(_0x4c59e6[_0x4fe7('0x3d')][_0x4fe7('0x54')]){_0x138434[_0x4fe7('0x4e')]=[{'all':!![]}];}_0x138434=_[_0x4fe7('0x4a')]({},_0x138434,_0x4c59e6['options']);return db['FaxMessage'][_0x4fe7('0x55')](_0x138434)[_0x4fe7('0x20')](handleEntityNotFound(_0x325458,null))[_0x4fe7('0x20')](respondWithResult(_0x325458,null))[_0x4fe7('0x28')](handleError(_0x325458,null));};exports['update']=function(_0xcec98a,_0x257987){if(_0xcec98a[_0x4fe7('0x56')]['id']){delete _0xcec98a['body']['id'];}return db[_0x4fe7('0x39')][_0x4fe7('0x55')]({'where':{'id':_0xcec98a[_0x4fe7('0x52')]['id']}})[_0x4fe7('0x20')](handleEntityNotFound(_0x257987,null))[_0x4fe7('0x20')](saveUpdates(_0xcec98a[_0x4fe7('0x56')],null))[_0x4fe7('0x20')](respondWithResult(_0x257987,null))['catch'](handleError(_0x257987,null));};exports[_0x4fe7('0x32')]=function(_0x5cac9b,_0x49d228){return db[_0x4fe7('0x39')][_0x4fe7('0x55')]({'where':{'id':_0x5cac9b[_0x4fe7('0x52')]['id']}})[_0x4fe7('0x20')](handleEntityNotFound(_0x49d228,null))['then'](removeEntity(_0x49d228,null))[_0x4fe7('0x28')](handleError(_0x49d228,null));};exports[_0x4fe7('0x57')]=function(_0x228243,_0x4d9770){return db[_0x4fe7('0x39')][_0x4fe7('0x57')]()[_0x4fe7('0x20')](respondWithResult(_0x4d9770,null))[_0x4fe7('0x28')](handleError(_0x4d9770,null));};var interaction_log=require(_0x4fe7('0x58'))(_0x4fe7('0x59'));exports[_0x4fe7('0x5a')]=function(_0x431e04,_0x58fc49,_0x55a86a){var _0x2fd280={'agent':{},'channel':_0x4fe7('0x5b')};if(_0x431e04[_0x4fe7('0x56')]['id']){delete _0x431e04[_0x4fe7('0x56')]['id'];}_0x431e04[_0x4fe7('0x56')][_0x4fe7('0x5c')]=!![];_0x431e04[_0x4fe7('0x56')][_0x4fe7('0x5d')]=moment()[_0x4fe7('0x5e')](_0x4fe7('0x5f'));_0x431e04[_0x4fe7('0x56')][_0x4fe7('0x60')]=_0x431e04[_0x4fe7('0x56')][_0x4fe7('0x60')]||_0x431e04[_0x4fe7('0x61')]['id'];_0x2fd280['agent']['id']=_0x431e04[_0x4fe7('0x56')][_0x4fe7('0x60')];return db[_0x4fe7('0x39')]['find']({'where':{'id':_0x431e04[_0x4fe7('0x52')]['id'],'UserId':null}})[_0x4fe7('0x20')](handleEntityNotFound(_0x58fc49,null))[_0x4fe7('0x20')](saveUpdates(_0x431e04[_0x4fe7('0x56')],null))[_0x4fe7('0x20')](function(_0x33cfdc){if(_0x33cfdc){_0x2fd280[_0x4fe7('0x27')]=_0x33cfdc[_0x4fe7('0x62')]({'plain':!![]});return db['FaxInteraction'][_0x4fe7('0x55')]({'where':{'id':_0x33cfdc[_0x4fe7('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x58fc49,null))[_0x4fe7('0x20')](function(_0x208a16){if(_0x208a16){return _0x208a16[_0x4fe7('0x64')]({'UserId':_0x431e04[_0x4fe7('0x56')][_0x4fe7('0x60')],'read1stAt':_[_0x4fe7('0x65')](_0x208a16[_0x4fe7('0x66')])?moment()['format'](_0x4fe7('0x5f')):undefined});}return null;})['then'](function(_0x268300){if(_0x268300){_0x2fd280[_0x4fe7('0x67')]=_0x268300['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x431e04[_0x4fe7('0x61')]['id'],_0x431e04['user'][_0x4fe7('0x35')],_0x431e04[_0x4fe7('0x61')][_0x4fe7('0x68')],_0x2fd280['interaction']['id'],_0x431e04[_0x4fe7('0x56')]?JSON['stringify'](_0x431e04['body']):_0x4fe7('0x69'));return respondWithRpcPromise(_0x4fe7('0x6a'),'acceptMessage',_0x2fd280);}return null;})[_0x4fe7('0x20')](function(_0x7015f2){var _0x53064c=_0x4fe7('0x6b')+_0x7015f2[_0x4fe7('0x27')][_0x4fe7('0x6c')];return db[_0x4fe7('0x6d')]['query'](_0x53064c,{'type':db['Sequelize'][_0x4fe7('0x6e')]['SELECT'],'raw':!![]})[_0x4fe7('0x20')](function(_0x35954c){return _0x35954c;});})[_0x4fe7('0x20')](function(_0xda0c51){if(_0xda0c51){_0x2fd280[_0x4fe7('0x27')]['contact']=_0xda0c51[0x0];if(!_0x431e04['body']['UserId'])return;return db['User'][_0x4fe7('0x55')]({'where':{'id':_0x431e04[_0x4fe7('0x56')]['UserId'],'role':_0x4fe7('0x6f')},'attributes':['id','name',_0x4fe7('0x70'),_0x4fe7('0x71'),_0x4fe7('0x72')],'raw':!![]});}return null;})['then'](function(_0x2c4492){if(!_0x2c4492)return null;_0x2fd280[_0x4fe7('0x27')][_0x4fe7('0x6f')]=_0x2c4492;return _0x2fd280;})['then'](function(_0x2579c0){if(_0x2579c0){if(_0x431e04[_0x4fe7('0x56')][_0x4fe7('0x73')]){_0x2fd280[_0x4fe7('0x27')][_0x4fe7('0x74')]=util[_0x4fe7('0x5e')](_0x4fe7('0x75'),_0x431e04['user']['name']);_0x2fd280[_0x4fe7('0x27')][_0x4fe7('0x76')]=_0x2fd280[_0x4fe7('0x76')];_0x2fd280[_0x4fe7('0x27')][_0x4fe7('0x77')]=_0x2fd280[_0x4fe7('0x76')];_0x2fd280[_0x4fe7('0x27')]['event']=_0x4fe7('0x5a');return respondWithRpcPromise(_0x4fe7('0x78'),_0x4fe7('0x78'),{'event':'acceptmessage','message':_0x2fd280[_0x4fe7('0x27')]},client9002)[_0x4fe7('0x20')](function(){return _0x2fd280;});}return _0x2fd280;}return null;})[_0x4fe7('0x20')](respondWithResult(_0x58fc49,null))[_0x4fe7('0x28')](handleError(_0x58fc49,null));};var interaction_log=require(_0x4fe7('0x58'))(_0x4fe7('0x59'));exports[_0x4fe7('0x79')]=function(_0x4f49e1,_0x4ef675,_0x382485){var _0x1325ce={'agent':{},'channel':_0x4fe7('0x5b')};if(_0x4f49e1['body']['id']){delete _0x4f49e1[_0x4fe7('0x56')]['id'];}_0x4f49e1['body'][_0x4fe7('0x60')]=_0x4f49e1['body'][_0x4fe7('0x60')]||_0x4f49e1['user']['id'];_0x1325ce[_0x4fe7('0x6f')]['id']=_0x4f49e1[_0x4fe7('0x56')][_0x4fe7('0x60')];return db[_0x4fe7('0x39')][_0x4fe7('0x55')]({'where':{'id':_0x4f49e1['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4ef675,null))[_0x4fe7('0x20')](function(_0x1e5e6a){if(_0x1e5e6a){_0x1325ce['message']=_0x1e5e6a[_0x4fe7('0x62')]({'plain':!![]});return db['FaxInteraction'][_0x4fe7('0x55')]({'where':{'id':_0x1e5e6a[_0x4fe7('0x63')]}});}return null;})[_0x4fe7('0x20')](handleEntityNotFound(_0x4ef675,null))[_0x4fe7('0x20')](function(_0x49fe51){if(_0x49fe51){_0x1325ce[_0x4fe7('0x67')]=_0x49fe51[_0x4fe7('0x62')]({'plain':!![]});interaction_log[_0x4fe7('0x7a')](_0x4fe7('0x7b'),_0x4f49e1['user']['id'],_0x4f49e1[_0x4fe7('0x61')]['name'],_0x4f49e1['user'][_0x4fe7('0x68')],_0x1325ce['interaction']['id'],_0x4f49e1['body']?JSON[_0x4fe7('0x24')](_0x4f49e1[_0x4fe7('0x56')]):_0x4fe7('0x69'));return respondWithRpcPromise(_0x4fe7('0x7c'),'rejectMessage',_0x1325ce);}return null;})['then'](function(_0xf772df){var _0x204c98='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xf772df['message'][_0x4fe7('0x6c')];return db[_0x4fe7('0x6d')][_0x4fe7('0x3d')](_0x204c98,{'type':db[_0x4fe7('0x7d')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x390e17){return _0x390e17;});})[_0x4fe7('0x20')](function(_0x3a2a63){if(_0x3a2a63){_0x1325ce[_0x4fe7('0x27')][_0x4fe7('0x7e')]=_0x3a2a63[0x0];if(!_0x4f49e1['body']['UserId'])return;return db[_0x4fe7('0x7f')][_0x4fe7('0x55')]({'where':{'id':_0x4f49e1[_0x4fe7('0x56')][_0x4fe7('0x60')],'role':_0x4fe7('0x6f')},'attributes':['id',_0x4fe7('0x35'),_0x4fe7('0x70'),_0x4fe7('0x71'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2b6f2d){if(!_0x2b6f2d)return null;_0x1325ce[_0x4fe7('0x27')][_0x4fe7('0x6f')]=_0x2b6f2d;return _0x1325ce;})['then'](function(_0xc9ae75){if(_0xc9ae75){_0xc9ae75[_0x4fe7('0x27')][_0x4fe7('0x74')]=util['format']('SIP/%s',_0x4f49e1[_0x4fe7('0x61')]['name']);_0xc9ae75[_0x4fe7('0x27')][_0x4fe7('0x76')]=_0x1325ce[_0x4fe7('0x76')];_0xc9ae75[_0x4fe7('0x27')]['motionChannel']=_0x1325ce[_0x4fe7('0x76')];_0xc9ae75[_0x4fe7('0x27')][_0x4fe7('0x80')]=_0x4fe7('0x79');respondWithRpcPromise('EventManager',_0x4fe7('0x78'),{'event':_0x4fe7('0x81'),'message':_0xc9ae75[_0x4fe7('0x27')]},client9002);return _0x1325ce;}return null;})[_0x4fe7('0x20')](respondWithResult(_0x4ef675,null))[_0x4fe7('0x28')](handleError(_0x4ef675,null));};exports[_0x4fe7('0x82')]=function(_0x15af34,_0x3f1a8d){var _0x439b06;return db[_0x4fe7('0x39')][_0x4fe7('0x82')](_0x15af34['body'],{})[_0x4fe7('0x20')](function(_0x673ea2){_0x439b06=_0x673ea2;return db[_0x4fe7('0x83')][_0x4fe7('0x84')]({'where':{'id':_0x439b06[_0x4fe7('0x6c')]}});})[_0x4fe7('0x20')](function(_0x3fcd70){if(_[_0x4fe7('0x65')](_0x3fcd70)){return;}else{_0x439b06[_0x4fe7('0x5b')]=_0x3fcd70[_0x4fe7('0x5b')];return db[_0x4fe7('0x85')][_0x4fe7('0x84')]({'where':{'id':_0x439b06[_0x4fe7('0x86')]}});}})[_0x4fe7('0x20')](function(_0x3c8c1a){return respondWithRpcPromise(_0x4fe7('0x87'),_0x4fe7('0x87'),{'FaxAccountId':_[_0x4fe7('0x65')](_0x15af34[_0x4fe7('0x56')])?undefined:_0x15af34[_0x4fe7('0x56')][_0x4fe7('0x88')],'path':_[_0x4fe7('0x65')](_0x3c8c1a)?undefined:util[_0x4fe7('0x5e')](_0x4fe7('0x89'),_0x3c8c1a[_0x4fe7('0x8a')]),'fax':_[_0x4fe7('0x65')](_0x439b06[_0x4fe7('0x5b')])?undefined:_0x439b06[_0x4fe7('0x5b')],'AttachmentId':_0x439b06[_0x4fe7('0x86')]},client9002);})[_0x4fe7('0x20')](respondWithResult(_0x3f1a8d,0xc9))[_0x4fe7('0x28')](handleError(_0x3f1a8d,null));};exports['download']=function(_0x5a0d0a,_0x1cbab9){var _0x2539c1=path[_0x4fe7('0x8b')](config[_0x4fe7('0x8c')],'server',_0x4fe7('0x8d'),_0x4fe7('0x8e'));return db[_0x4fe7('0x39')]['find']({'where':{'id':_0x5a0d0a['params']['id']},'include':[{'model':db['Attachment'],'as':_0x4fe7('0x85')}]})['then'](handleEntityNotFound(_0x1cbab9,null))[_0x4fe7('0x20')](function(_0x203295){if(_0x203295){return _0x1cbab9['download'](path[_0x4fe7('0x8b')](_0x2539c1,_0x203295[_0x4fe7('0x85')][_0x4fe7('0x8a')]));}})['catch'](handleError(_0x1cbab9,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ceaf60d..f77d1a8 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 _0xb234=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x31d354,_0x2cc826){var _0x340a41=function(_0x2a0ca6){while(--_0x2a0ca6){_0x31d354['push'](_0x31d354['shift']());}};_0x340a41(++_0x2cc826);}(_0xb234,0x13f));var _0x4b23=function(_0x5e3736,_0x4649e7){_0x5e3736=_0x5e3736-0x0;var _0x854f42=_0xb234[_0x5e3736];return _0x854f42;};'use strict';var EventEmitter=require(_0x4b23('0x0'));var FaxMessage=require(_0x4b23('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4b23('0x2')](0x0);var events={'afterCreate':_0x4b23('0x3'),'afterUpdate':_0x4b23('0x4'),'afterDestroy':_0x4b23('0x5')};function emitEvent(_0x5496ed){return function(_0x5557dc,_0x36c95e,_0xf90d41){FaxMessageEvents['emit'](_0x5496ed+':'+_0x5557dc['id'],_0x5557dc);FaxMessageEvents[_0x4b23('0x6')](_0x5496ed,_0x5557dc);_0xf90d41(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x4b23('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x55c3=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x5c8b2d,_0x2b3536){var _0x13670f=function(_0x35b549){while(--_0x35b549){_0x5c8b2d['push'](_0x5c8b2d['shift']());}};_0x13670f(++_0x2b3536);}(_0x55c3,0x189));var _0x355c=function(_0x437d30,_0x5bcb61){_0x437d30=_0x437d30-0x0;var _0x5210b1=_0x55c3[_0x437d30];return _0x5210b1;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x355c('0x0'))['db'][_0x355c('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x355c('0x2')](0x0);var events={'afterCreate':_0x355c('0x3'),'afterUpdate':_0x355c('0x4'),'afterDestroy':_0x355c('0x5')};function emitEvent(_0x1f5257){return function(_0x132c7a,_0x1655c1,_0x1c7a4f){FaxMessageEvents[_0x355c('0x6')](_0x1f5257+':'+_0x132c7a['id'],_0x132c7a);FaxMessageEvents[_0x355c('0x6')](_0x1f5257,_0x132c7a);_0x1c7a4f(null);};}for(var e in events){if(events[_0x355c('0x7')](e)){var event=events[e];FaxMessage[_0x355c('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 67b3269..856985d 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 _0x6ca7=['request-promise','path','rimraf','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','then','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0xd64668,_0x3f3acb){var _0x163ef9=function(_0x159f81){while(--_0x159f81){_0xd64668['push'](_0xd64668['shift']());}};_0x163ef9(++_0x3f3acb);}(_0x6ca7,0x1bb));var _0x76ca=function(_0x16cb03,_0x43ea58){_0x16cb03=_0x16cb03-0x0;var _0x10944e=_0x6ca7[_0x16cb03];return _0x10944e;};'use strict';var _=require(_0x76ca('0x0'));var util=require(_0x76ca('0x1'));var logger=require(_0x76ca('0x2'))(_0x76ca('0x3'));var moment=require('moment');var BPromise=require(_0x76ca('0x4'));var rp=require(_0x76ca('0x5'));var fs=require('fs');var path=require(_0x76ca('0x6'));var rimraf=require(_0x76ca('0x7'));var config=require('../../config/environment');var attributes=require(_0x76ca('0x8'));module['exports']=function(_0x37ec6a,_0x3894b3){return _0x37ec6a[_0x76ca('0x9')](_0x76ca('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x76ca('0xb'),'fields':[_0x76ca('0xc')],'type':_0x76ca('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f2d8b,_0x2da296,_0x1878b6){var _0x15485f=_0x37ec6a[_0x76ca('0xe')];var _0x22e2f8=_0x2f2d8b[_0x76ca('0xf')]({'plain':!![]});if(_0x22e2f8[_0x76ca('0x10')]['toLowerCase']()==='in'||_0x22e2f8['direction'][_0x76ca('0x11')]()===_0x76ca('0x12')&&!_0x22e2f8[_0x76ca('0x13')]&&!_[_0x76ca('0x14')](_0x22e2f8[_0x76ca('0x15')])){_0x15485f['FaxInteraction'][_0x76ca('0x16')]({'where':{'id':_0x22e2f8[_0x76ca('0x17')]}})[_0x76ca('0x18')](function(_0xa901e9){if(_0xa901e9){_0xa901e9['update']({'lastMsgAt':_0x22e2f8['createdAt'],'lastMsgDirection':_0x22e2f8[_0x76ca('0x10')][_0x76ca('0x11')]()});}})['catch'](function(_0x6d436e){console[_0x76ca('0x19')](_0x6d436e);});}_0x1878b6();}},'charset':_0x76ca('0x1a'),'collate':_0x76ca('0x1b')});}; \ No newline at end of file +var _0xdee3=['findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId'];(function(_0x4fde83,_0x2d9011){var _0x3b33e3=function(_0x3b4214){while(--_0x3b4214){_0x4fde83['push'](_0x4fde83['shift']());}};_0x3b33e3(++_0x2d9011);}(_0xdee3,0xa4));var _0x3dee=function(_0x3d796a,_0x28d4f2){_0x3d796a=_0x3d796a-0x0;var _0x1761c1=_0xdee3[_0x3d796a];return _0x1761c1;};'use strict';var _=require(_0x3dee('0x0'));var util=require(_0x3dee('0x1'));var logger=require(_0x3dee('0x2'))(_0x3dee('0x3'));var moment=require(_0x3dee('0x4'));var BPromise=require(_0x3dee('0x5'));var rp=require(_0x3dee('0x6'));var fs=require('fs');var path=require(_0x3dee('0x7'));var rimraf=require(_0x3dee('0x8'));var config=require('../../config/environment');var attributes=require(_0x3dee('0x9'));module['exports']=function(_0x356b96,_0x26353c){return _0x356b96[_0x3dee('0xa')](_0x3dee('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x3dee('0xc'),'fields':[_0x3dee('0xd')],'type':_0x3dee('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x181707,_0x307552,_0x1e27cd){var _0x1f8801=_0x356b96[_0x3dee('0xf')];var _0x46defa=_0x181707[_0x3dee('0x10')]({'plain':!![]});if(_0x46defa[_0x3dee('0x11')][_0x3dee('0x12')]()==='in'||_0x46defa[_0x3dee('0x11')][_0x3dee('0x12')]()==='out'&&!_0x46defa[_0x3dee('0x13')]&&!_[_0x3dee('0x14')](_0x46defa[_0x3dee('0x15')])){_0x1f8801['FaxInteraction'][_0x3dee('0x16')]({'where':{'id':_0x46defa[_0x3dee('0x17')]}})[_0x3dee('0x18')](function(_0x1544a2){if(_0x1544a2){_0x1544a2[_0x3dee('0x19')]({'lastMsgAt':_0x46defa[_0x3dee('0x1a')],'lastMsgDirection':_0x46defa[_0x3dee('0x11')][_0x3dee('0x12')]()});}})[_0x3dee('0x1b')](function(_0x3f992d){console[_0x3dee('0x1c')](_0x3f992d);});}_0x1e27cd();}},'charset':_0x3dee('0x1d'),'collate':_0x3dee('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 6e25814..94cdc13 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 _0x9c44=['code','message','info','catch','FaxMessage','create','body','options','CreateFaxMessage','stringify','UpdateFaxMessage','update','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'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});config[_0x49c4('0x9')]=_[_0x49c4('0xa')](config[_0x49c4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x49c4('0xb'))(new Redis(config[_0x49c4('0x9')]));require(_0x49c4('0xc'))[_0x49c4('0xd')](socket);function respondWithRpcPromise(_0x4c7d3a,_0x5ab4a3,_0x451ea6){return new BPromise(function(_0x313e73,_0x58cad7){return client[_0x49c4('0xe')](_0x4c7d3a,_0x451ea6)[_0x49c4('0xf')](function(_0x4adb3c){logger['info'](_0x49c4('0x10'),_0x5ab4a3,_0x49c4('0x11'));logger['debug'](_0x49c4('0x12'),_0x5ab4a3,_0x49c4('0x11'),JSON['stringify'](_0x4adb3c));if(_0x4adb3c[_0x49c4('0x13')]){if(_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x14')]===0x1f4){logger[_0x49c4('0x13')](_0x49c4('0x10'),_0x5ab4a3,_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x15')]);return _0x58cad7(_0x4adb3c[_0x49c4('0x13')]['message']);}logger[_0x49c4('0x13')](_0x49c4('0x10'),_0x5ab4a3,_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x15')]);return _0x313e73(_0x4adb3c[_0x49c4('0x13')]['message']);}else{logger[_0x49c4('0x16')](_0x49c4('0x10'),_0x5ab4a3,'request\x20sent');_0x313e73(_0x4adb3c['result'][_0x49c4('0x15')]);}})[_0x49c4('0x17')](function(_0x3addb2){logger['error'](_0x49c4('0x10'),_0x5ab4a3,_0x3addb2);_0x58cad7(_0x3addb2);});});}exports['CreateFaxMessage']=function(_0x2cbd50){var _0x1806c2=this;return new Promise(function(_0xe31fcc,_0x291526){return db[_0x49c4('0x18')][_0x49c4('0x19')](_0x2cbd50[_0x49c4('0x1a')],{'raw':_0x2cbd50[_0x49c4('0x1b')]?_0x2cbd50[_0x49c4('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x57f502){logger[_0x49c4('0x16')]('CreateFaxMessage',_0x2cbd50);logger['debug'](_0x49c4('0x1c'),_0x2cbd50,JSON[_0x49c4('0x1d')](_0x57f502));_0xe31fcc(_0x57f502);})[_0x49c4('0x17')](function(_0xd335e4){logger['error']('CreateFaxMessage',_0xd335e4[_0x49c4('0x15')],_0x2cbd50);_0x291526(_0x1806c2[_0x49c4('0x13')](0x1f4,_0xd335e4['message']));});});};exports[_0x49c4('0x1e')]=function(_0x43e014){var _0x210159=this;return new Promise(function(_0xa7a826,_0x531d92){return db['FaxMessage'][_0x49c4('0x1f')](_0x43e014['body'],{'raw':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e014[_0x49c4('0x1b')]?_0x43e014['options'][_0x49c4('0x21')]||null:null,'attributes':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x22')]||null:null,'limit':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x23')]||null:null})[_0x49c4('0xf')](function(_0x17b50f){logger[_0x49c4('0x16')](_0x49c4('0x1e'),_0x43e014);logger['debug']('UpdateFaxMessage',_0x43e014,JSON['stringify'](_0x17b50f));_0xa7a826(_0x17b50f);})[_0x49c4('0x17')](function(_0x7ee704){logger[_0x49c4('0x13')](_0x49c4('0x1e'),_0x7ee704[_0x49c4('0x15')],_0x43e014);_0x531d92(_0x210159['error'](0x1f4,_0x7ee704[_0x49c4('0x15')]));});});}; \ No newline at end of file +var _0x668b=['./faxMessage.socket','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxMessage','FaxMessage','create','body','raw','UpdateFaxMessage','update','options','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x13a7a9,_0x21bc73){var _0x5e6d8b=function(_0x5d50d1){while(--_0x5d50d1){_0x13a7a9['push'](_0x13a7a9['shift']());}};_0x5e6d8b(++_0x21bc73);}(_0x668b,0x140));var _0xb668=function(_0x229d7e,_0x5bc489){_0x229d7e=_0x229d7e-0x0;var _0xa78280=_0x668b[_0x229d7e];return _0xa78280;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});config[_0xb668('0xa')]=_[_0xb668('0xb')](config[_0xb668('0xa')],{'host':_0xb668('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb668('0xa')]));require(_0xb668('0xd'))[_0xb668('0xe')](socket);function respondWithRpcPromise(_0x16d50d,_0x39b79c,_0x3606a7){return new BPromise(function(_0x45bc39,_0x3616e9){return client['request'](_0x16d50d,_0x3606a7)[_0xb668('0xf')](function(_0x27dbf7){logger[_0xb668('0x10')](_0xb668('0x11'),_0x39b79c,_0xb668('0x12'));logger[_0xb668('0x13')](_0xb668('0x14'),_0x39b79c,_0xb668('0x12'),JSON[_0xb668('0x15')](_0x27dbf7));if(_0x27dbf7[_0xb668('0x16')]){if(_0x27dbf7[_0xb668('0x16')][_0xb668('0x17')]===0x1f4){logger[_0xb668('0x16')](_0xb668('0x11'),_0x39b79c,_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);return _0x3616e9(_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);}logger[_0xb668('0x16')](_0xb668('0x11'),_0x39b79c,_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);return _0x45bc39(_0x27dbf7['error'][_0xb668('0x18')]);}else{logger['info'](_0xb668('0x11'),_0x39b79c,_0xb668('0x12'));_0x45bc39(_0x27dbf7['result'][_0xb668('0x18')]);}})[_0xb668('0x19')](function(_0x53ff78){logger[_0xb668('0x16')]('FaxMessage,\x20%s,\x20%s',_0x39b79c,_0x53ff78);_0x3616e9(_0x53ff78);});});}exports[_0xb668('0x1a')]=function(_0x178a5d){var _0x253ba5=this;return new Promise(function(_0x12805a,_0x5d33ae){return db[_0xb668('0x1b')][_0xb668('0x1c')](_0x178a5d[_0xb668('0x1d')],{'raw':_0x178a5d['options']?_0x178a5d['options'][_0xb668('0x1e')]===undefined?!![]:![]:!![]})[_0xb668('0xf')](function(_0x517eee){logger[_0xb668('0x10')]('CreateFaxMessage',_0x178a5d);logger[_0xb668('0x13')]('CreateFaxMessage',_0x178a5d,JSON[_0xb668('0x15')](_0x517eee));_0x12805a(_0x517eee);})[_0xb668('0x19')](function(_0x3f84c7){logger[_0xb668('0x16')](_0xb668('0x1a'),_0x3f84c7[_0xb668('0x18')],_0x178a5d);_0x5d33ae(_0x253ba5['error'](0x1f4,_0x3f84c7[_0xb668('0x18')]));});});};exports[_0xb668('0x1f')]=function(_0x2ab8c2){var _0x49abfd=this;return new Promise(function(_0x5e0cee,_0xe62fce){return db[_0xb668('0x1b')][_0xb668('0x20')](_0x2ab8c2['body'],{'raw':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2[_0xb668('0x21')][_0xb668('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ab8c2['options']?_0x2ab8c2['options'][_0xb668('0x22')]||null:null,'attributes':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2['options'][_0xb668('0x23')]||null:null,'limit':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2[_0xb668('0x21')][_0xb668('0x24')]||null:null})[_0xb668('0xf')](function(_0x5f36b5){logger[_0xb668('0x10')](_0xb668('0x1f'),_0x2ab8c2);logger['debug'](_0xb668('0x1f'),_0x2ab8c2,JSON['stringify'](_0x5f36b5));_0x5e0cee(_0x5f36b5);})[_0xb668('0x19')](function(_0x406cc5){logger[_0xb668('0x16')](_0xb668('0x1f'),_0x406cc5[_0xb668('0x18')],_0x2ab8c2);_0xe62fce(_0x49abfd[_0xb668('0x16')](0x1f4,_0x406cc5[_0xb668('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 22defc2..80c3da6 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 _0xb469=['remove','emit','removeListener','register','length','faxMessage:','./faxMessage.events','save'];(function(_0x21c622,_0x124272){var _0x4fed92=function(_0x2dfe00){while(--_0x2dfe00){_0x21c622['push'](_0x21c622['shift']());}};_0x4fed92(++_0x124272);}(_0xb469,0x156));var _0x9b46=function(_0x1ef46e,_0x461abe){_0x1ef46e=_0x1ef46e-0x0;var _0x2114f2=_0xb469[_0x1ef46e];return _0x2114f2;};'use strict';var FaxMessageEvents=require(_0x9b46('0x0'));var events=[_0x9b46('0x1'),_0x9b46('0x2'),'update'];function createListener(_0x25e966,_0x2210c8){return function(_0x5d9bc1){_0x2210c8[_0x9b46('0x3')](_0x25e966,_0x5d9bc1);};}function removeListener(_0x111d17,_0x3d6b8c){return function(){FaxMessageEvents[_0x9b46('0x4')](_0x111d17,_0x3d6b8c);};}exports[_0x9b46('0x5')]=function(_0x52304f){for(var _0x25d2d2=0x0,_0x5cfb98=events[_0x9b46('0x6')];_0x25d2d2<_0x5cfb98;_0x25d2d2++){var _0x2648c5=events[_0x25d2d2];var _0x1d0078=createListener(_0x9b46('0x7')+_0x2648c5,_0x52304f);FaxMessageEvents['on'](_0x2648c5,_0x1d0078);}}; \ No newline at end of file +var _0x89b4=['length','faxMessage:','./faxMessage.events','save','update','register'];(function(_0x4c2642,_0xe893ad){var _0x64a035=function(_0x1464cf){while(--_0x1464cf){_0x4c2642['push'](_0x4c2642['shift']());}};_0x64a035(++_0xe893ad);}(_0x89b4,0xf2));var _0x489b=function(_0x429ed3,_0x52fda3){_0x429ed3=_0x429ed3-0x0;var _0x437c89=_0x89b4[_0x429ed3];return _0x437c89;};'use strict';var FaxMessageEvents=require(_0x489b('0x0'));var events=[_0x489b('0x1'),'remove',_0x489b('0x2')];function createListener(_0x22b881,_0x277233){return function(_0x52d29e){_0x277233['emit'](_0x22b881,_0x52d29e);};}function removeListener(_0x534f2e,_0x5e6786){return function(){FaxMessageEvents['removeListener'](_0x534f2e,_0x5e6786);};}exports[_0x489b('0x3')]=function(_0x216e4a){for(var _0x296f17=0x0,_0x50360a=events[_0x489b('0x4')];_0x296f17<_0x50360a;_0x296f17++){var _0x6b0ecc=events[_0x296f17];var _0xa22ab9=createListener(_0x489b('0x5')+_0x6b0ecc,_0x216e4a);FaxMessageEvents['on'](_0x6b0ecc,_0xa22ab9);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index b37e324..e0dbd35 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 _0x9aea=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','fax','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','path','express'];(function(_0xb34d1e,_0x243fb7){var _0x4e59c0=function(_0x4e9594){while(--_0x4e9594){_0xb34d1e['push'](_0xb34d1e['shift']());}};_0x4e59c0(++_0x243fb7);}(_0x9aea,0xdd));var _0xa9ae=function(_0x2d581e,_0x85488c){_0x2d581e=_0x2d581e-0x0;var _0x5abadd=_0x9aea[_0x2d581e];return _0x5abadd;};'use strict';var multer=require(_0xa9ae('0x0'));var util=require('util');var path=require(_0xa9ae('0x1'));var timeout=require('connect-timeout');var express=require(_0xa9ae('0x2'));var router=express[_0xa9ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa9ae('0x4'));var interaction=require(_0xa9ae('0x5'));var config=require(_0xa9ae('0x6'));var controller=require(_0xa9ae('0x7'));router[_0xa9ae('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9ae('0x9')]);router[_0xa9ae('0x8')](_0xa9ae('0xa'),auth['isAuthenticated'](),controller[_0xa9ae('0xb')]);router[_0xa9ae('0x8')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0xe')]);router[_0xa9ae('0x8')](_0xa9ae('0xf'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x10')]);router['post']('/',auth[_0xa9ae('0xd')](),interaction['tracked'](_0xa9ae('0x11'),_0xa9ae('0x12')),controller[_0xa9ae('0x13')]);router[_0xa9ae('0x14')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x15')]);router[_0xa9ae('0x14')]('/:id/accept',auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x16')]);router[_0xa9ae('0x14')](_0xa9ae('0x17'),auth['isAuthenticated'](),controller[_0xa9ae('0x18')]);router[_0xa9ae('0x19')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x1a')]);module[_0xa9ae('0x1b')]=router; \ No newline at end of file +var _0xb4e6=['/:id/download','download','post','tracked','fax','create','put','/:id','update','/:id/accept','accept','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','describe','show'];(function(_0xed2305,_0x35bae4){var _0x5ec077=function(_0xa30e87){while(--_0xa30e87){_0xed2305['push'](_0xed2305['shift']());}};_0x5ec077(++_0x35bae4);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x33080e,_0x1c600a){_0x33080e=_0x33080e-0x0;var _0x407395=_0xb4e6[_0x33080e];return _0x407395;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var fs_extra=require(_0x6b4e('0x5'));var auth=require(_0x6b4e('0x6'));var interaction=require(_0x6b4e('0x7'));var config=require('../../config/environment');var controller=require(_0x6b4e('0x8'));router[_0x6b4e('0x9')]('/',auth[_0x6b4e('0xa')](),controller['index']);router[_0x6b4e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6b4e('0xb')]);router['get']('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x9')](_0x6b4e('0xd'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xe')]);router[_0x6b4e('0xf')]('/',auth['isAuthenticated'](),interaction[_0x6b4e('0x10')](_0x6b4e('0x11'),'faxmessage:create'),controller[_0x6b4e('0x12')]);router[_0x6b4e('0x13')](_0x6b4e('0x14'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x15')]);router[_0x6b4e('0x13')](_0x6b4e('0x16'),auth['isAuthenticated'](),controller[_0x6b4e('0x17')]);router[_0x6b4e('0x13')]('/:id/reject',auth[_0x6b4e('0xa')](),controller['reject']);router[_0x6b4e('0x18')](_0x6b4e('0x14'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x19')]);module[_0x6b4e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 11645bf..3e9569d 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 _0x175c=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x10c0d4,_0x42d65b){var _0x3606f3=function(_0x5ac655){while(--_0x5ac655){_0x10c0d4['push'](_0x10c0d4['shift']());}};_0x3606f3(++_0x42d65b);}(_0x175c,0x120));var _0xc175=function(_0x500327,_0x44eefa){_0x500327=_0x500327-0x0;var _0x409e36=_0x175c[_0x500327];return _0x409e36;};'use strict';var Sequelize=require(_0xc175('0x0'));module[_0xc175('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc175('0x2')]},'timeout':{'type':Sequelize[_0xc175('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc175('0x4')](_0xc175('0x5'),_0xc175('0x6'),_0xc175('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc175('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5d10=['name','ENUM','rrmemory','roundrobin','INTEGER','sequelize','exports','STRING'];(function(_0x14de96,_0x4c6ec4){var _0x29d86e=function(_0x40ad8b){while(--_0x40ad8b){_0x14de96['push'](_0x14de96['shift']());}};_0x29d86e(++_0x4c6ec4);}(_0x5d10,0x85));var _0x05d1=function(_0xb8a206,_0x328cde){_0xb8a206=_0xb8a206-0x0;var _0x49b515=_0x5d10[_0xb8a206];return _0x49b515;};'use strict';var Sequelize=require(_0x05d1('0x0'));module[_0x05d1('0x1')]={'name':{'type':Sequelize[_0x05d1('0x2')],'unique':_0x05d1('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x05d1('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x05d1('0x4')](_0x05d1('0x5'),'beepall',_0x05d1('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x05d1('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index f530e8f..012d7d0 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 _0x50fb=['name','send','index','FaxQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','FaxQueueId','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','update','then','destroy','get','FaxQueues','end','error','stack'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x50fb,0x64));var _0xb50f=function(_0x5baa77,_0x1dc1e6){_0x5baa77=_0x5baa77-0x0;var _0x444b78=_0x50fb[_0x5baa77];return _0x444b78;};'use strict';var emlformat=require(_0xb50f('0x0'));var rimraf=require(_0xb50f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb50f('0x2'));var moment=require('moment');var BPromise=require(_0xb50f('0x3'));var Mustache=require(_0xb50f('0x4'));var util=require(_0xb50f('0x5'));var path=require(_0xb50f('0x6'));var sox=require('sox');var csv=require(_0xb50f('0x7'));var ejs=require(_0xb50f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb50f('0x9'));var squel=require(_0xb50f('0xa'));var crypto=require(_0xb50f('0xb'));var jsforce=require(_0xb50f('0xc'));var deskjs=require(_0xb50f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb50f('0xe'));var Papa=require(_0xb50f('0xf'));var Redis=require(_0xb50f('0x10'));var authService=require(_0xb50f('0x11'));var qs=require(_0xb50f('0x12'));var as=require(_0xb50f('0x13'));var hardwareService=require(_0xb50f('0x14'));var logger=require(_0xb50f('0x15'))('api');var utils=require(_0xb50f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb50f('0x17'));var db=require(_0xb50f('0x18'))['db'];config['redis']=_[_0xb50f('0x19')](config[_0xb50f('0x1a')],{'host':_0xb50f('0x1b'),'port':0x18eb});var socket=require(_0xb50f('0x1c'))(new Redis(config['redis']));require(_0xb50f('0x1d'))[_0xb50f('0x1e')](socket);function respondWithStatusCode(_0x113f1c,_0xc15b18){_0xc15b18=_0xc15b18||0xcc;return function(_0x571008){if(_0x571008){return _0x113f1c[_0xb50f('0x1f')](_0xc15b18);}return _0x113f1c['status'](_0xc15b18)['end']();};}function respondWithResult(_0x522462,_0x55a034){_0x55a034=_0x55a034||0xc8;return function(_0x20a32a){if(_0x20a32a){return _0x522462['status'](_0x55a034)[_0xb50f('0x20')](_0x20a32a);}};}function respondWithFilteredResult(_0x4d8216,_0x33b60b){return function(_0x2f232d){if(_0x2f232d){var _0x35e327=typeof _0x33b60b[_0xb50f('0x21')]===_0xb50f('0x22')&&typeof _0x33b60b['limit']===_0xb50f('0x22');var _0x334fbf=_0x2f232d[_0xb50f('0x23')];var _0x349741=_0x35e327?0x0:_0x33b60b[_0xb50f('0x21')];var _0x5aa342=_0x35e327?_0x2f232d[_0xb50f('0x23')]:_0x33b60b[_0xb50f('0x21')]+_0x33b60b[_0xb50f('0x24')];var _0x448e01;if(_0x5aa342>=_0x334fbf){_0x5aa342=_0x334fbf;_0x448e01=0xc8;}else{_0x448e01=0xce;}_0x4d8216[_0xb50f('0x25')](_0x448e01);return _0x4d8216[_0xb50f('0x26')](_0xb50f('0x27'),_0x349741+'-'+_0x5aa342+'/'+_0x334fbf)['json'](_0x2f232d);}return null;};}function patchUpdates(_0x15b26c){return function(_0xab717f){try{jsonpatch[_0xb50f('0x28')](_0xab717f,_0x15b26c,!![]);}catch(_0x411279){return BPromise['reject'](_0x411279);}return _0xab717f['save']();};}function saveUpdates(_0x59434c,_0x1d9bf4){return function(_0x4f517c){if(_0x4f517c){return _0x4f517c[_0xb50f('0x29')](_0x59434c)[_0xb50f('0x2a')](function(_0x175196){return _0x175196;});}return null;};}function removeEntity(_0x10b294,_0x59b156){return function(_0xe0dca5){if(_0xe0dca5){return _0xe0dca5[_0xb50f('0x2b')]()[_0xb50f('0x2a')](function(){var _0x1c2ffa=_0xe0dca5[_0xb50f('0x2c')]({'plain':!![]});var _0x222bc1=_0xb50f('0x2d');return db['UserProfileResource'][_0xb50f('0x2b')]({'where':{'type':_0x222bc1,'resourceId':_0x1c2ffa['id']}})[_0xb50f('0x2a')](function(){return _0xe0dca5;});})['then'](function(){_0x10b294[_0xb50f('0x25')](0xcc)[_0xb50f('0x2e')]();});}};}function handleEntityNotFound(_0x53c7c7,_0x1cf12a){return function(_0x3580b5){if(!_0x3580b5){_0x53c7c7['sendStatus'](0x194);}return _0x3580b5;};}function handleError(_0x2b7b2d,_0x59991d){_0x59991d=_0x59991d||0x1f4;return function(_0x2578c5){logger[_0xb50f('0x2f')](_0x2578c5[_0xb50f('0x30')]);if(_0x2578c5[_0xb50f('0x31')]){delete _0x2578c5[_0xb50f('0x31')];}_0x2b7b2d[_0xb50f('0x25')](_0x59991d)[_0xb50f('0x32')](_0x2578c5);};}exports[_0xb50f('0x33')]=function(_0x1b22be,_0xcb0d3c){var _0x275e30={},_0x5e3fc3={},_0x3ded44={'count':0x0,'rows':[]};var _0x106590=_['map'](db[_0xb50f('0x34')][_0xb50f('0x35')],function(_0x3000c1){return{'name':_0x3000c1[_0xb50f('0x36')],'type':_0x3000c1[_0xb50f('0x37')][_0xb50f('0x38')]};});_0x5e3fc3[_0xb50f('0x39')]=_[_0xb50f('0x3a')](_0x106590,_0xb50f('0x31'));_0x5e3fc3[_0xb50f('0x3b')]=_[_0xb50f('0x3c')](_0x1b22be[_0xb50f('0x3b')]);_0x5e3fc3[_0xb50f('0x3d')]=_[_0xb50f('0x3e')](_0x5e3fc3[_0xb50f('0x39')],_0x5e3fc3['query']);_0x275e30['attributes']=_[_0xb50f('0x3e')](_0x5e3fc3['model'],qs[_0xb50f('0x3f')](_0x1b22be[_0xb50f('0x3b')][_0xb50f('0x3f')]));_0x275e30['attributes']=_0x275e30[_0xb50f('0x40')][_0xb50f('0x41')]?_0x275e30[_0xb50f('0x40')]:_0x5e3fc3['model'];if(!_0x1b22be[_0xb50f('0x3b')]['hasOwnProperty'](_0xb50f('0x42'))){_0x275e30[_0xb50f('0x24')]=qs[_0xb50f('0x24')](_0x1b22be[_0xb50f('0x3b')][_0xb50f('0x24')]);_0x275e30[_0xb50f('0x21')]=qs['offset'](_0x1b22be[_0xb50f('0x3b')][_0xb50f('0x21')]);}_0x275e30[_0xb50f('0x43')]=qs[_0xb50f('0x44')](_0x1b22be[_0xb50f('0x3b')][_0xb50f('0x44')]);_0x275e30['where']=qs[_0xb50f('0x3d')](_[_0xb50f('0x45')](_0x1b22be['query'],_0x5e3fc3[_0xb50f('0x3d')]),_0x106590);if(_0x1b22be[_0xb50f('0x3b')][_0xb50f('0x46')]){_0x275e30['where']=_[_0xb50f('0x47')](_0x275e30[_0xb50f('0x48')],{'$or':_[_0xb50f('0x3a')](_0x106590,function(_0x54a22e){if(_0x54a22e[_0xb50f('0x37')]!==_0xb50f('0x49')){var _0x5624e2={};_0x5624e2[_0x54a22e['name']]={'$like':'%'+_0x1b22be[_0xb50f('0x3b')][_0xb50f('0x46')]+'%'};return _0x5624e2;}})});}_0x275e30=_[_0xb50f('0x47')]({},_0x275e30,_0x1b22be[_0xb50f('0x4a')]);var _0x22c8c7={'where':_0x275e30[_0xb50f('0x48')]};return db[_0xb50f('0x34')]['count'](_0x22c8c7)[_0xb50f('0x2a')](function(_0x5e3a76){_0x3ded44[_0xb50f('0x23')]=_0x5e3a76;if(_0x1b22be[_0xb50f('0x3b')][_0xb50f('0x4b')]){_0x275e30[_0xb50f('0x4c')]=[{'all':!![]}];}return db[_0xb50f('0x34')]['findAll'](_0x275e30);})['then'](function(_0x2d0df2){_0x3ded44['rows']=_0x2d0df2;return _0x3ded44;})[_0xb50f('0x2a')](respondWithFilteredResult(_0xcb0d3c,_0x275e30))['catch'](handleError(_0xcb0d3c,null));};exports[_0xb50f('0x4d')]=function(_0xa695e0,_0x26dffd){var _0x45d724={'raw':!![],'where':{'id':_0xa695e0[_0xb50f('0x4e')]['id']}},_0x477dcb={};_0x477dcb[_0xb50f('0x39')]=_[_0xb50f('0x3c')](db[_0xb50f('0x34')][_0xb50f('0x35')]);_0x477dcb['query']=_['keys'](_0xa695e0[_0xb50f('0x3b')]);_0x477dcb['filters']=_['intersection'](_0x477dcb[_0xb50f('0x39')],_0x477dcb[_0xb50f('0x3b')]);_0x45d724[_0xb50f('0x40')]=_[_0xb50f('0x3e')](_0x477dcb['model'],qs['fields'](_0xa695e0['query'][_0xb50f('0x3f')]));_0x45d724[_0xb50f('0x40')]=_0x45d724[_0xb50f('0x40')][_0xb50f('0x41')]?_0x45d724[_0xb50f('0x40')]:_0x477dcb[_0xb50f('0x39')];if(_0xa695e0[_0xb50f('0x3b')][_0xb50f('0x4b')]){_0x45d724[_0xb50f('0x4c')]=[{'all':!![]}];}_0x45d724=_[_0xb50f('0x47')]({},_0x45d724,_0xa695e0[_0xb50f('0x4a')]);return db[_0xb50f('0x34')][_0xb50f('0x4f')](_0x45d724)[_0xb50f('0x2a')](handleEntityNotFound(_0x26dffd,null))[_0xb50f('0x2a')](respondWithResult(_0x26dffd,null))[_0xb50f('0x50')](handleError(_0x26dffd,null));};exports[_0xb50f('0x51')]=function(_0x267f1a,_0x215287){return db[_0xb50f('0x34')][_0xb50f('0x51')](_0x267f1a['body'],{})['then'](function(_0x2cea20){var _0x1def26=_0x267f1a[_0xb50f('0x52')]['get']({'plain':!![]});if(!_0x1def26)throw new Error(_0xb50f('0x53'));if(_0x1def26[_0xb50f('0x54')]===_0xb50f('0x52')){var _0x1548c8=_0x2cea20[_0xb50f('0x2c')]({'plain':!![]});var _0x2dbbef=_0xb50f('0x2d');return db[_0xb50f('0x55')][_0xb50f('0x4f')]({'where':{'name':_0x2dbbef,'userProfileId':_0x1def26[_0xb50f('0x56')]},'raw':!![]})[_0xb50f('0x2a')](function(_0x277f76){if(_0x277f76&&_0x277f76[_0xb50f('0x57')]===0x0){return db[_0xb50f('0x58')][_0xb50f('0x51')]({'name':_0x1548c8[_0xb50f('0x31')],'resourceId':_0x1548c8['id'],'type':_0x277f76[_0xb50f('0x31')],'sectionId':_0x277f76['id']},{})[_0xb50f('0x2a')](function(){return _0x2cea20;});}else{return _0x2cea20;}})[_0xb50f('0x50')](function(_0x3eaf5a){logger['error'](_0xb50f('0x59'),_0x3eaf5a);throw _0x3eaf5a;});}return _0x2cea20;})[_0xb50f('0x2a')](respondWithResult(_0x215287,0xc9))[_0xb50f('0x50')](handleError(_0x215287,null));};exports[_0xb50f('0x29')]=function(_0x5b3741,_0xf48830){if(_0x5b3741[_0xb50f('0x5a')]['id']){delete _0x5b3741[_0xb50f('0x5a')]['id'];}return db['FaxQueue'][_0xb50f('0x4f')]({'where':{'id':_0x5b3741['params']['id']}})[_0xb50f('0x2a')](handleEntityNotFound(_0xf48830,null))[_0xb50f('0x2a')](saveUpdates(_0x5b3741[_0xb50f('0x5a')],null))[_0xb50f('0x2a')](respondWithResult(_0xf48830,null))[_0xb50f('0x50')](handleError(_0xf48830,null));};exports[_0xb50f('0x2b')]=function(_0x497e76,_0x4b2e2c){return db[_0xb50f('0x34')]['find']({'where':{'id':_0x497e76[_0xb50f('0x4e')]['id']}})[_0xb50f('0x2a')](handleEntityNotFound(_0x4b2e2c,null))['then'](removeEntity(_0x4b2e2c,null))[_0xb50f('0x50')](handleError(_0x4b2e2c,null));};exports['describe']=function(_0x2ec6bf,_0x3d2b80){return db[_0xb50f('0x34')][_0xb50f('0x5b')]()[_0xb50f('0x2a')](respondWithResult(_0x3d2b80,null))[_0xb50f('0x50')](handleError(_0x3d2b80,null));};exports[_0xb50f('0x5c')]=function(_0x371fcf,_0x14db28,_0x411994){var _0x176d47={'raw':!![],'where':{}},_0x105c0a={},_0x21dabd;return db['FaxQueue'][_0xb50f('0x5d')]({'where':{'id':_0x371fcf[_0xb50f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x14db28,null))[_0xb50f('0x2a')](function(_0x90b3ec){if(_0x90b3ec){_0x21dabd=_0x90b3ec[_0xb50f('0x2c')]({'plain':!![]});_0x105c0a[_0xb50f('0x39')]=_[_0xb50f('0x3c')](db[_0xb50f('0x5e')][_0xb50f('0x35')]);_0x105c0a[_0xb50f('0x3b')]=_[_0xb50f('0x3c')](_0x371fcf[_0xb50f('0x3b')]);_0x105c0a[_0xb50f('0x3d')]=_[_0xb50f('0x3e')](_0x105c0a[_0xb50f('0x39')],_0x105c0a[_0xb50f('0x3b')]);_0x176d47[_0xb50f('0x40')]=_[_0xb50f('0x3e')](_0x105c0a[_0xb50f('0x39')],qs[_0xb50f('0x3f')](_0x371fcf[_0xb50f('0x3b')]['fields']));_0x176d47['attributes']=_0x176d47[_0xb50f('0x40')][_0xb50f('0x41')]?_0x176d47[_0xb50f('0x40')]:_0x105c0a['model'];if(!_0x371fcf[_0xb50f('0x3b')][_0xb50f('0x5f')](_0xb50f('0x42'))){_0x176d47[_0xb50f('0x24')]=qs[_0xb50f('0x24')](_0x371fcf[_0xb50f('0x3b')][_0xb50f('0x24')]);_0x176d47[_0xb50f('0x21')]=qs[_0xb50f('0x21')](_0x371fcf[_0xb50f('0x3b')]['offset']);}_0x176d47['order']=qs[_0xb50f('0x44')](_0x371fcf[_0xb50f('0x3b')][_0xb50f('0x44')]);_0x176d47[_0xb50f('0x48')]=qs[_0xb50f('0x3d')](_[_0xb50f('0x45')](_0x371fcf['query'],_0x105c0a[_0xb50f('0x3d')]));_0x176d47[_0xb50f('0x48')][_0xb50f('0x60')]=_0x90b3ec['id'];if(_0x371fcf['query'][_0xb50f('0x46')]){_0x176d47[_0xb50f('0x48')]=_[_0xb50f('0x47')](_0x176d47[_0xb50f('0x48')],{'$or':_['map'](_0x176d47[_0xb50f('0x40')],function(_0x1de1b9){var _0x592b97={};_0x592b97[_0x1de1b9]={'$like':'%'+_0x371fcf['query'][_0xb50f('0x46')]+'%'};return _0x592b97;})});}_0x176d47=_['merge']({},_0x176d47,_0x371fcf[_0xb50f('0x4a')]);return db['UserFaxQueue'][_0xb50f('0x61')](_0x176d47);}})['then'](function(_0x25ca88){if(_0x25ca88){return db[_0xb50f('0x62')][_0xb50f('0x63')]({'where':{'id':_[_0xb50f('0x3a')](_0x25ca88,_0xb50f('0x64')),'role':_0xb50f('0x65')},'attributes':['id',_0xb50f('0x31'),_0xb50f('0x66'),_0xb50f('0x67'),_0xb50f('0x68')]});}})['then'](function(_0x3b36d1){if(_0x3b36d1){return{'count':_0x3b36d1[_0xb50f('0x23')],'rows':_[_0xb50f('0x3a')](_0x3b36d1[_0xb50f('0x69')],function(_0x1ebd1f){return{'membername':_0x1ebd1f[_0xb50f('0x31')],'UserId':_0x1ebd1f['id'],'queue_name':_0x21dabd['name'],'FaxQueueId':_0x21dabd['id'],'interface':util[_0xb50f('0x6a')](_0xb50f('0x6b'),_0xb50f('0x6c'),_0x1ebd1f['name']),'penalty':0x0,'paused':_0x1ebd1f[_0xb50f('0x66')],'createdAt':_0x1ebd1f['createdAt'],'updatedAt':_0x1ebd1f[_0xb50f('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x14db28,_0x176d47))[_0xb50f('0x50')](handleError(_0x14db28,null));};exports[_0xb50f('0x6d')]=function(_0x3fb50a,_0x40d6c7,_0x26c8f0){var _0xdfdf17={};var _0x3ccff9={};var _0x4acbf2;var _0x1a3570;return db[_0xb50f('0x34')][_0xb50f('0x5d')]({'where':{'id':_0x3fb50a['params']['id']}})[_0xb50f('0x2a')](handleEntityNotFound(_0x40d6c7,null))[_0xb50f('0x2a')](function(_0x15c414){if(_0x15c414){_0x4acbf2=_0x15c414;_0x3ccff9[_0xb50f('0x39')]=_['keys'](db[_0xb50f('0x6e')][_0xb50f('0x35')]);_0x3ccff9[_0xb50f('0x3b')]=_['keys'](_0x3fb50a[_0xb50f('0x3b')]);_0x3ccff9[_0xb50f('0x3d')]=_['intersection'](_0x3ccff9['model'],_0x3ccff9[_0xb50f('0x3b')]);_0xdfdf17[_0xb50f('0x40')]=_[_0xb50f('0x3e')](_0x3ccff9[_0xb50f('0x39')],qs[_0xb50f('0x3f')](_0x3fb50a[_0xb50f('0x3b')][_0xb50f('0x3f')]));_0xdfdf17[_0xb50f('0x40')]=_0xdfdf17['attributes']['length']?_0xdfdf17['attributes']:_0x3ccff9[_0xb50f('0x39')];_0xdfdf17[_0xb50f('0x43')]=qs[_0xb50f('0x44')](_0x3fb50a[_0xb50f('0x3b')][_0xb50f('0x44')]);_0xdfdf17[_0xb50f('0x48')]=qs[_0xb50f('0x3d')](_['pick'](_0x3fb50a[_0xb50f('0x3b')],_0x3ccff9['filters']));if(_0x3fb50a[_0xb50f('0x3b')][_0xb50f('0x46')]){_0xdfdf17['where']=_[_0xb50f('0x47')](_0xdfdf17[_0xb50f('0x48')],{'$or':_['map'](_0xdfdf17['attributes'],function(_0x1c2328){var _0x2a2634={};_0x2a2634[_0x1c2328]={'$like':'%'+_0x3fb50a[_0xb50f('0x3b')]['filter']+'%'};return _0x2a2634;})});}_0xdfdf17=_[_0xb50f('0x47')]({},_0xdfdf17,_0x3fb50a[_0xb50f('0x4a')]);return _0x4acbf2[_0xb50f('0x6d')](_0xdfdf17);}})[_0xb50f('0x2a')](function(_0x202628){if(_0x202628){_0x1a3570=_0x202628[_0xb50f('0x41')];if(!_0x3fb50a[_0xb50f('0x3b')][_0xb50f('0x5f')](_0xb50f('0x42'))){_0xdfdf17[_0xb50f('0x24')]=qs['limit'](_0x3fb50a[_0xb50f('0x3b')]['limit']);_0xdfdf17[_0xb50f('0x21')]=qs['offset'](_0x3fb50a[_0xb50f('0x3b')][_0xb50f('0x21')]);}return _0x4acbf2[_0xb50f('0x6d')](_0xdfdf17);}})[_0xb50f('0x2a')](function(_0xc8ad4){if(_0xc8ad4){return _0xc8ad4?{'count':_0x1a3570,'rows':_0xc8ad4}:null;}})[_0xb50f('0x2a')](respondWithResult(_0x40d6c7,null))[_0xb50f('0x50')](handleError(_0x40d6c7,null));};exports[_0xb50f('0x6f')]=function(_0x56ce71,_0x5991a5,_0xa31260){var _0xe5d8a4=_0x56ce71['body'][_0xb50f('0x70')];return db[_0xb50f('0x6e')][_0xb50f('0x61')]({'where':{'id':_0xe5d8a4},'attributes':['id'],'include':[{'model':db[_0xb50f('0x62')],'as':'Agents','attributes':['id',_0xb50f('0x31'),_0xb50f('0x71'),_0xb50f('0x72'),'interface'],'raw':!![]}]})['then'](function(_0xf89efd){if(_0xf89efd){var _0x18380c=_['flatMap'](_0xf89efd,function(_0x3ff10c){var _0x19accc=_0x3ff10c['get']({'plain':!![]});return _0x19accc[_0xb50f('0x73')];});return db[_0xb50f('0x34')][_0xb50f('0x4f')]({'where':{'id':_0x56ce71[_0xb50f('0x4e')]['id']}})[_0xb50f('0x2a')](function(_0x167b61){return db[_0xb50f('0x74')][_0xb50f('0x75')](function(_0x36afbc){return _0x167b61['addTeams'](_0xe5d8a4,{'transaction':_0x36afbc})['then'](function(){return BPromise[_0xb50f('0x76')](_0x18380c,function(_0x390df5){return db[_0xb50f('0x5e')][_0xb50f('0x77')]({'where':{'UserId':_0x390df5['id'],'FaxQueueId':_0x56ce71['params']['id']},'transaction':_0x36afbc});});})[_0xb50f('0x2a')](function(){_0x18380c[_0xb50f('0x78')](function(_0x21a126){socket[_0xb50f('0x79')](_0xb50f('0x7a'),{'UserId':_0x21a126['id'],'FaxQueueId':_0x167b61['id']});});});});});}})[_0xb50f('0x2a')](respondWithStatusCode(_0x5991a5,null))[_0xb50f('0x50')](handleError(_0x5991a5,null));};exports['removeTeams']=function(_0xae737c,_0x4b2802,_0x187a69){return db[_0xb50f('0x6e')]['findAll']({'where':{'id':_0xae737c[_0xb50f('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb50f('0x62')],'as':_0xb50f('0x73'),'attributes':['id'],'raw':!![]}]})[_0xb50f('0x2a')](handleEntityNotFound(_0x4b2802,null))['then'](function(_0x5c0fd8){var _0x4cb912=_[_0xb50f('0x3a')](_0x5c0fd8,'id');var _0x3cb984=[];var _0x3e477e=[];var _0x447bcf=squel[_0xb50f('0x7b')]();_0x447bcf['field'](_0xb50f('0x7c'))[_0xb50f('0x7d')](_0xb50f('0x7e'),'tq')[_0xb50f('0x7f')](_0xb50f('0x80'),'ut',_0xb50f('0x81'))[_0xb50f('0x48')](_0xb50f('0x82'),_0xae737c[_0xb50f('0x4e')]['id']);for(var _0x3a10ec=0x0;_0x3a10ec<_0x5c0fd8[_0xb50f('0x41')];_0x3a10ec+=0x1){let _0x2775be=_0x5c0fd8[_0x3a10ec];for(var _0x317c6f=0x0;_0x317c6f<_0x2775be[_0xb50f('0x73')][_0xb50f('0x41')];_0x317c6f+=0x1){let _0x5f1ed4=_0x2775be['Agents'][_0x317c6f];var _0x54019d=_0x447bcf[_0xb50f('0x83')]();_0x54019d[_0xb50f('0x48')](_0xb50f('0x84'),_0x5f1ed4['id']);_0x3e477e[_0xb50f('0x85')](db[_0xb50f('0x74')][_0xb50f('0x3b')](_0x54019d[_0xb50f('0x86')](),{'type':db[_0xb50f('0x74')][_0xb50f('0x87')]['SELECT']})['then'](function(_0x5abf84){if(_0x5abf84[_0xb50f('0x41')]===0x1){return _0x5f1ed4['id'];}else{var _0x450491=_[_0xb50f('0x88')](_['map'](_0x5abf84,'TeamId'),function(_0x459953){return _[_0xb50f('0x89')](_0x4cb912,_0x459953);});if(_0x450491){return _0x5f1ed4['id'];}}}));}}return BPromise[_0xb50f('0x8a')](_0x3e477e)[_0xb50f('0x2a')](function(_0x381a11){_0x3cb984=_(_0x3cb984)[_0xb50f('0x8b')](_0x381a11)[_0xb50f('0x8c')]()['value']();return db[_0xb50f('0x34')][_0xb50f('0x4f')]({'where':{'id':_0xae737c['params']['id']}})[_0xb50f('0x2a')](function(_0x31da60){return db[_0xb50f('0x74')][_0xb50f('0x75')](function(_0x1ab9da){return _0x31da60[_0xb50f('0x8d')](_0xae737c['query'][_0xb50f('0x70')],{'transaction':_0x1ab9da})[_0xb50f('0x2a')](function(){if(!_[_0xb50f('0x8e')](_0x3cb984)){return _0x31da60[_0xb50f('0x8f')](_0x3cb984,{'transaction':_0x1ab9da});}})['then'](function(){_0x3cb984[_0xb50f('0x78')](function(_0x1c7289){socket[_0xb50f('0x79')](_0xb50f('0x90'),{'UserId':_0x1c7289,'FaxQueueId':_0x31da60['id']});});});});});});})[_0xb50f('0x2a')](respondWithStatusCode(_0x4b2802,null))[_0xb50f('0x50')](handleError(_0x4b2802,null));};exports[_0xb50f('0x91')]=function(_0x557b16,_0xc6e718,_0x2f184a){return db[_0xb50f('0x34')][_0xb50f('0x4f')]({'where':{'id':_0x557b16[_0xb50f('0x4e')]['id']}})[_0xb50f('0x2a')](handleEntityNotFound(_0xc6e718,null))[_0xb50f('0x2a')](function(_0x2e9fda){if(_0x2e9fda){return _0x2e9fda[_0xb50f('0x91')](_0x557b16[_0xb50f('0x5a')][_0xb50f('0x70')],_['omit'](_0x557b16[_0xb50f('0x5a')],[_0xb50f('0x70'),'id'])||{})[_0xb50f('0x92')](function(_0x53bc93){for(var _0x39f092=0x0;_0x39f092<_0x557b16['body'][_0xb50f('0x70')][_0xb50f('0x41')];_0x39f092+=0x1){socket[_0xb50f('0x79')](_0xb50f('0x7a'),{'UserId':Number(_0x557b16[_0xb50f('0x5a')][_0xb50f('0x70')][_0x39f092]),'FaxQueueId':Number(_0x557b16[_0xb50f('0x4e')]['id'])});}return _0x53bc93;});}})[_0xb50f('0x2a')](respondWithResult(_0xc6e718,null))[_0xb50f('0x50')](handleError(_0xc6e718,null));};exports['removeAgents']=function(_0x548b5d,_0x3b08b1,_0x2a44bc){return db[_0xb50f('0x34')][_0xb50f('0x4f')]({'where':{'id':_0x548b5d[_0xb50f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3b08b1,null))[_0xb50f('0x2a')](function(_0x49fd94){if(_0x49fd94){return _0x49fd94[_0xb50f('0x8f')](_0x548b5d[_0xb50f('0x3b')]['ids'])[_0xb50f('0x2a')](function(){if(_[_0xb50f('0x93')](_0x548b5d[_0xb50f('0x3b')]['ids'])){for(var _0x47b383=0x0;_0x47b383<_0x548b5d['query']['ids'][_0xb50f('0x41')];_0x47b383+=0x1){socket[_0xb50f('0x79')]('userFaxQueue:remove',{'UserId':Number(_0x548b5d[_0xb50f('0x3b')][_0xb50f('0x70')][_0x47b383]),'FaxQueueId':Number(_0x548b5d[_0xb50f('0x4e')]['id'])});}}else{socket[_0xb50f('0x79')](_0xb50f('0x90'),{'UserId':Number(_0x548b5d['query'][_0xb50f('0x70')]),'FaxQueueId':Number(_0x548b5d[_0xb50f('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x3b08b1,null))[_0xb50f('0x50')](handleError(_0x3b08b1,null));};exports['getAgents']=function(_0x452681,_0x4ae530,_0x1481e9){var _0x7e01ec={};var _0x1433a1={};var _0x3b23d9;var _0xab2e6d;return db[_0xb50f('0x34')]['findOne']({'where':{'id':_0x452681[_0xb50f('0x4e')]['id']}})[_0xb50f('0x2a')](handleEntityNotFound(_0x4ae530,null))[_0xb50f('0x2a')](function(_0x16dc39){if(_0x16dc39){_0x3b23d9=_0x16dc39;_0x1433a1[_0xb50f('0x39')]=_[_0xb50f('0x3c')](db[_0xb50f('0x62')]['rawAttributes']);_0x1433a1[_0xb50f('0x3b')]=_['keys'](_0x452681[_0xb50f('0x3b')]);_0x1433a1['filters']=_[_0xb50f('0x3e')](_0x1433a1[_0xb50f('0x39')],_0x1433a1[_0xb50f('0x3b')]);_0x7e01ec[_0xb50f('0x40')]=_[_0xb50f('0x3e')](_0x1433a1[_0xb50f('0x39')],qs[_0xb50f('0x3f')](_0x452681[_0xb50f('0x3b')]['fields']));_0x7e01ec['attributes']=_0x7e01ec[_0xb50f('0x40')][_0xb50f('0x41')]?_0x7e01ec[_0xb50f('0x40')]:_0x1433a1[_0xb50f('0x39')];_0x7e01ec[_0xb50f('0x43')]=qs[_0xb50f('0x44')](_0x452681[_0xb50f('0x3b')][_0xb50f('0x44')]);_0x7e01ec[_0xb50f('0x48')]=qs[_0xb50f('0x3d')](_['pick'](_0x452681[_0xb50f('0x3b')],_0x1433a1['filters']));if(_0x452681[_0xb50f('0x3b')][_0xb50f('0x46')]){_0x7e01ec['where']=_[_0xb50f('0x47')](_0x7e01ec[_0xb50f('0x48')],{'$or':_[_0xb50f('0x3a')](_0x7e01ec[_0xb50f('0x40')],function(_0x49dfac){var _0x117d98={};_0x117d98[_0x49dfac]={'$like':'%'+_0x452681[_0xb50f('0x3b')]['filter']+'%'};return _0x117d98;})});}_0x7e01ec=_[_0xb50f('0x47')]({},_0x7e01ec,_0x452681[_0xb50f('0x4a')]);return _0x3b23d9[_0xb50f('0x94')](_0x7e01ec);}})[_0xb50f('0x2a')](function(_0x2a2ead){if(_0x2a2ead){_0xab2e6d=_0x2a2ead[_0xb50f('0x41')];if(!_0x452681[_0xb50f('0x3b')][_0xb50f('0x5f')](_0xb50f('0x42'))){_0x7e01ec['limit']=qs['limit'](_0x452681['query'][_0xb50f('0x24')]);_0x7e01ec['offset']=qs[_0xb50f('0x21')](_0x452681[_0xb50f('0x3b')][_0xb50f('0x21')]);}return _0x3b23d9[_0xb50f('0x94')](_0x7e01ec);}})['then'](function(_0xc2c1d2){if(_0xc2c1d2){return _0xc2c1d2?{'count':_0xab2e6d,'rows':_0xc2c1d2}:null;}})[_0xb50f('0x2a')](respondWithResult(_0x4ae530,null))[_0xb50f('0x50')](handleError(_0x4ae530,null));}; \ No newline at end of file +var _0xd853=['count','limit','set','Content-Range','apply','reject','save','update','then','FaxQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','FaxQueue','includeAll','include','findAll','rows','catch','show','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','describe','getMembers','findOne','UserFaxQueue','pick','User','findAndCountAll','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','getTeams','options','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','isEmpty','userFaxQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','undefined'];(function(_0x3f82e5,_0x85163b){var _0x566981=function(_0x57876e){while(--_0x57876e){_0x3f82e5['push'](_0x3f82e5['shift']());}};_0x566981(++_0x85163b);}(_0xd853,0x6f));var _0x3d85=function(_0x14634f,_0x5ed190){_0x14634f=_0x14634f-0x0;var _0x5021f9=_0xd853[_0x14634f];return _0x5021f9;};'use strict';var emlformat=require(_0x3d85('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3d85('0x1'));var rp=require(_0x3d85('0x2'));var moment=require(_0x3d85('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3d85('0x4'));var util=require(_0x3d85('0x5'));var path=require(_0x3d85('0x6'));var sox=require(_0x3d85('0x7'));var csv=require(_0x3d85('0x8'));var ejs=require(_0x3d85('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d85('0xa'));var squel=require(_0x3d85('0xb'));var crypto=require(_0x3d85('0xc'));var jsforce=require(_0x3d85('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3d85('0x8'));var querystring=require(_0x3d85('0xe'));var Papa=require(_0x3d85('0xf'));var Redis=require(_0x3d85('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3d85('0x11'));var as=require(_0x3d85('0x12'));var hardwareService=require(_0x3d85('0x13'));var logger=require('../../config/logger')(_0x3d85('0x14'));var utils=require(_0x3d85('0x15'));var config=require(_0x3d85('0x16'));var licenseUtil=require(_0x3d85('0x17'));var db=require('../../mysqldb')['db'];config[_0x3d85('0x18')]=_[_0x3d85('0x19')](config['redis'],{'host':_0x3d85('0x1a'),'port':0x18eb});var socket=require(_0x3d85('0x1b'))(new Redis(config['redis']));require(_0x3d85('0x1c'))[_0x3d85('0x1d')](socket);function respondWithStatusCode(_0x3b2a4c,_0x196535){_0x196535=_0x196535||0xcc;return function(_0x40f515){if(_0x40f515){return _0x3b2a4c['sendStatus'](_0x196535);}return _0x3b2a4c[_0x3d85('0x1e')](_0x196535)[_0x3d85('0x1f')]();};}function respondWithResult(_0x184bba,_0x32868a){_0x32868a=_0x32868a||0xc8;return function(_0x5e2c6f){if(_0x5e2c6f){return _0x184bba[_0x3d85('0x1e')](_0x32868a)[_0x3d85('0x20')](_0x5e2c6f);}};}function respondWithFilteredResult(_0x379bd4,_0x1223ce){return function(_0x552332){if(_0x552332){var _0x2bff6f=typeof _0x1223ce[_0x3d85('0x21')]===_0x3d85('0x22')&&typeof _0x1223ce['limit']==='undefined';var _0x422f87=_0x552332[_0x3d85('0x23')];var _0x1674ac=_0x2bff6f?0x0:_0x1223ce[_0x3d85('0x21')];var _0x561c45=_0x2bff6f?_0x552332[_0x3d85('0x23')]:_0x1223ce[_0x3d85('0x21')]+_0x1223ce[_0x3d85('0x24')];var _0x1af876;if(_0x561c45>=_0x422f87){_0x561c45=_0x422f87;_0x1af876=0xc8;}else{_0x1af876=0xce;}_0x379bd4[_0x3d85('0x1e')](_0x1af876);return _0x379bd4[_0x3d85('0x25')](_0x3d85('0x26'),_0x1674ac+'-'+_0x561c45+'/'+_0x422f87)[_0x3d85('0x20')](_0x552332);}return null;};}function patchUpdates(_0x5e335a){return function(_0x3dc877){try{jsonpatch[_0x3d85('0x27')](_0x3dc877,_0x5e335a,!![]);}catch(_0x53e0ca){return BPromise[_0x3d85('0x28')](_0x53e0ca);}return _0x3dc877[_0x3d85('0x29')]();};}function saveUpdates(_0x4e2175,_0x32869d){return function(_0x3239e9){if(_0x3239e9){return _0x3239e9[_0x3d85('0x2a')](_0x4e2175)[_0x3d85('0x2b')](function(_0x3809fc){return _0x3809fc;});}return null;};}function removeEntity(_0x3b131f,_0x4077b3){return function(_0x66f4d8){if(_0x66f4d8){return _0x66f4d8['destroy']()['then'](function(){var _0x5d2f9=_0x66f4d8['get']({'plain':!![]});var _0x566cfb=_0x3d85('0x2c');return db[_0x3d85('0x2d')]['destroy']({'where':{'type':_0x566cfb,'resourceId':_0x5d2f9['id']}})['then'](function(){return _0x66f4d8;});})[_0x3d85('0x2b')](function(){_0x3b131f['status'](0xcc)[_0x3d85('0x1f')]();});}};}function handleEntityNotFound(_0x175dc9,_0x5061b1){return function(_0x3820e2){if(!_0x3820e2){_0x175dc9['sendStatus'](0x194);}return _0x3820e2;};}function handleError(_0x3a5b2b,_0x90b8fd){_0x90b8fd=_0x90b8fd||0x1f4;return function(_0x3fbf5b){logger['error'](_0x3fbf5b[_0x3d85('0x2e')]);if(_0x3fbf5b[_0x3d85('0x2f')]){delete _0x3fbf5b[_0x3d85('0x2f')];}_0x3a5b2b['status'](_0x90b8fd)[_0x3d85('0x30')](_0x3fbf5b);};}exports[_0x3d85('0x31')]=function(_0x5a11b4,_0x2d82bf){var _0x4bdf28={},_0x371619={},_0x2aed11={'count':0x0,'rows':[]};var _0x1cd500=_[_0x3d85('0x32')](db['FaxQueue'][_0x3d85('0x33')],function(_0x4a821e){return{'name':_0x4a821e[_0x3d85('0x34')],'type':_0x4a821e[_0x3d85('0x35')][_0x3d85('0x36')]};});_0x371619[_0x3d85('0x37')]=_[_0x3d85('0x32')](_0x1cd500,'name');_0x371619[_0x3d85('0x38')]=_[_0x3d85('0x39')](_0x5a11b4['query']);_0x371619[_0x3d85('0x3a')]=_[_0x3d85('0x3b')](_0x371619[_0x3d85('0x37')],_0x371619[_0x3d85('0x38')]);_0x4bdf28[_0x3d85('0x3c')]=_[_0x3d85('0x3b')](_0x371619[_0x3d85('0x37')],qs[_0x3d85('0x3d')](_0x5a11b4[_0x3d85('0x38')][_0x3d85('0x3d')]));_0x4bdf28['attributes']=_0x4bdf28['attributes'][_0x3d85('0x3e')]?_0x4bdf28['attributes']:_0x371619[_0x3d85('0x37')];if(!_0x5a11b4[_0x3d85('0x38')][_0x3d85('0x3f')](_0x3d85('0x40'))){_0x4bdf28[_0x3d85('0x24')]=qs['limit'](_0x5a11b4[_0x3d85('0x38')]['limit']);_0x4bdf28['offset']=qs[_0x3d85('0x21')](_0x5a11b4[_0x3d85('0x38')][_0x3d85('0x21')]);}_0x4bdf28[_0x3d85('0x41')]=qs[_0x3d85('0x42')](_0x5a11b4[_0x3d85('0x38')][_0x3d85('0x42')]);_0x4bdf28[_0x3d85('0x43')]=qs['filters'](_['pick'](_0x5a11b4[_0x3d85('0x38')],_0x371619[_0x3d85('0x3a')]),_0x1cd500);if(_0x5a11b4['query'][_0x3d85('0x44')]){_0x4bdf28['where']=_[_0x3d85('0x45')](_0x4bdf28['where'],{'$or':_[_0x3d85('0x32')](_0x1cd500,function(_0x357feb){if(_0x357feb[_0x3d85('0x35')]!==_0x3d85('0x46')){var _0x37c90b={};_0x37c90b[_0x357feb['name']]={'$like':'%'+_0x5a11b4[_0x3d85('0x38')]['filter']+'%'};return _0x37c90b;}})});}_0x4bdf28=_['merge']({},_0x4bdf28,_0x5a11b4['options']);var _0x481fd3={'where':_0x4bdf28[_0x3d85('0x43')]};return db[_0x3d85('0x47')][_0x3d85('0x23')](_0x481fd3)['then'](function(_0x1b5445){_0x2aed11[_0x3d85('0x23')]=_0x1b5445;if(_0x5a11b4[_0x3d85('0x38')][_0x3d85('0x48')]){_0x4bdf28[_0x3d85('0x49')]=[{'all':!![]}];}return db[_0x3d85('0x47')][_0x3d85('0x4a')](_0x4bdf28);})[_0x3d85('0x2b')](function(_0x3a957a){_0x2aed11[_0x3d85('0x4b')]=_0x3a957a;return _0x2aed11;})[_0x3d85('0x2b')](respondWithFilteredResult(_0x2d82bf,_0x4bdf28))[_0x3d85('0x4c')](handleError(_0x2d82bf,null));};exports[_0x3d85('0x4d')]=function(_0x220cdf,_0x233c72){var _0x3645ac={'raw':!![],'where':{'id':_0x220cdf['params']['id']}},_0x2fe4e4={};_0x2fe4e4[_0x3d85('0x37')]=_['keys'](db[_0x3d85('0x47')]['rawAttributes']);_0x2fe4e4['query']=_[_0x3d85('0x39')](_0x220cdf[_0x3d85('0x38')]);_0x2fe4e4['filters']=_['intersection'](_0x2fe4e4[_0x3d85('0x37')],_0x2fe4e4[_0x3d85('0x38')]);_0x3645ac[_0x3d85('0x3c')]=_[_0x3d85('0x3b')](_0x2fe4e4[_0x3d85('0x37')],qs[_0x3d85('0x3d')](_0x220cdf[_0x3d85('0x38')]['fields']));_0x3645ac[_0x3d85('0x3c')]=_0x3645ac['attributes'][_0x3d85('0x3e')]?_0x3645ac['attributes']:_0x2fe4e4[_0x3d85('0x37')];if(_0x220cdf['query'][_0x3d85('0x48')]){_0x3645ac[_0x3d85('0x49')]=[{'all':!![]}];}_0x3645ac=_[_0x3d85('0x45')]({},_0x3645ac,_0x220cdf['options']);return db[_0x3d85('0x47')]['find'](_0x3645ac)[_0x3d85('0x2b')](handleEntityNotFound(_0x233c72,null))[_0x3d85('0x2b')](respondWithResult(_0x233c72,null))[_0x3d85('0x4c')](handleError(_0x233c72,null));};exports[_0x3d85('0x4e')]=function(_0x53d53e,_0x24e093){return db[_0x3d85('0x47')][_0x3d85('0x4e')](_0x53d53e[_0x3d85('0x4f')],{})[_0x3d85('0x2b')](function(_0x583e82){var _0x24c455=_0x53d53e[_0x3d85('0x50')][_0x3d85('0x51')]({'plain':!![]});if(!_0x24c455)throw new Error(_0x3d85('0x52'));if(_0x24c455[_0x3d85('0x53')]===_0x3d85('0x50')){var _0xf950cd=_0x583e82['get']({'plain':!![]});var _0x28bb01=_0x3d85('0x2c');return db[_0x3d85('0x54')][_0x3d85('0x55')]({'where':{'name':_0x28bb01,'userProfileId':_0x24c455[_0x3d85('0x56')]},'raw':!![]})['then'](function(_0x39dd32){if(_0x39dd32&&_0x39dd32[_0x3d85('0x57')]===0x0){return db['UserProfileResource'][_0x3d85('0x4e')]({'name':_0xf950cd['name'],'resourceId':_0xf950cd['id'],'type':_0x39dd32[_0x3d85('0x2f')],'sectionId':_0x39dd32['id']},{})[_0x3d85('0x2b')](function(){return _0x583e82;});}else{return _0x583e82;}})['catch'](function(_0x1756a4){logger[_0x3d85('0x58')](_0x3d85('0x59'),_0x1756a4);throw _0x1756a4;});}return _0x583e82;})[_0x3d85('0x2b')](respondWithResult(_0x24e093,0xc9))[_0x3d85('0x4c')](handleError(_0x24e093,null));};exports[_0x3d85('0x2a')]=function(_0x37684c,_0x482e93){if(_0x37684c[_0x3d85('0x4f')]['id']){delete _0x37684c[_0x3d85('0x4f')]['id'];}return db[_0x3d85('0x47')][_0x3d85('0x55')]({'where':{'id':_0x37684c['params']['id']}})[_0x3d85('0x2b')](handleEntityNotFound(_0x482e93,null))[_0x3d85('0x2b')](saveUpdates(_0x37684c[_0x3d85('0x4f')],null))[_0x3d85('0x2b')](respondWithResult(_0x482e93,null))['catch'](handleError(_0x482e93,null));};exports[_0x3d85('0x5a')]=function(_0x55e556,_0x15a22e){return db[_0x3d85('0x47')][_0x3d85('0x55')]({'where':{'id':_0x55e556[_0x3d85('0x5b')]['id']}})[_0x3d85('0x2b')](handleEntityNotFound(_0x15a22e,null))[_0x3d85('0x2b')](removeEntity(_0x15a22e,null))[_0x3d85('0x4c')](handleError(_0x15a22e,null));};exports[_0x3d85('0x5c')]=function(_0x4b595c,_0x1c68a2){return db['FaxQueue'][_0x3d85('0x5c')]()['then'](respondWithResult(_0x1c68a2,null))[_0x3d85('0x4c')](handleError(_0x1c68a2,null));};exports[_0x3d85('0x5d')]=function(_0x29ad77,_0x35eb57,_0x1c4ce8){var _0x144ae7={'raw':!![],'where':{}},_0x2657b8={},_0x1ddb53;return db['FaxQueue'][_0x3d85('0x5e')]({'where':{'id':_0x29ad77[_0x3d85('0x5b')]['id']}})[_0x3d85('0x2b')](handleEntityNotFound(_0x35eb57,null))['then'](function(_0x1b8929){if(_0x1b8929){_0x1ddb53=_0x1b8929[_0x3d85('0x51')]({'plain':!![]});_0x2657b8[_0x3d85('0x37')]=_[_0x3d85('0x39')](db[_0x3d85('0x5f')][_0x3d85('0x33')]);_0x2657b8['query']=_[_0x3d85('0x39')](_0x29ad77['query']);_0x2657b8['filters']=_[_0x3d85('0x3b')](_0x2657b8[_0x3d85('0x37')],_0x2657b8[_0x3d85('0x38')]);_0x144ae7['attributes']=_[_0x3d85('0x3b')](_0x2657b8[_0x3d85('0x37')],qs['fields'](_0x29ad77['query'][_0x3d85('0x3d')]));_0x144ae7[_0x3d85('0x3c')]=_0x144ae7['attributes'][_0x3d85('0x3e')]?_0x144ae7['attributes']:_0x2657b8['model'];if(!_0x29ad77[_0x3d85('0x38')]['hasOwnProperty']('nolimit')){_0x144ae7[_0x3d85('0x24')]=qs[_0x3d85('0x24')](_0x29ad77[_0x3d85('0x38')][_0x3d85('0x24')]);_0x144ae7[_0x3d85('0x21')]=qs[_0x3d85('0x21')](_0x29ad77['query']['offset']);}_0x144ae7[_0x3d85('0x41')]=qs['sort'](_0x29ad77[_0x3d85('0x38')][_0x3d85('0x42')]);_0x144ae7[_0x3d85('0x43')]=qs[_0x3d85('0x3a')](_[_0x3d85('0x60')](_0x29ad77['query'],_0x2657b8[_0x3d85('0x3a')]));_0x144ae7[_0x3d85('0x43')]['FaxQueueId']=_0x1b8929['id'];if(_0x29ad77[_0x3d85('0x38')][_0x3d85('0x44')]){_0x144ae7[_0x3d85('0x43')]=_[_0x3d85('0x45')](_0x144ae7['where'],{'$or':_['map'](_0x144ae7[_0x3d85('0x3c')],function(_0x9707ba){var _0x2b0e27={};_0x2b0e27[_0x9707ba]={'$like':'%'+_0x29ad77[_0x3d85('0x38')]['filter']+'%'};return _0x2b0e27;})});}_0x144ae7=_['merge']({},_0x144ae7,_0x29ad77['options']);return db[_0x3d85('0x5f')][_0x3d85('0x4a')](_0x144ae7);}})[_0x3d85('0x2b')](function(_0x1c7f2b){if(_0x1c7f2b){return db[_0x3d85('0x61')][_0x3d85('0x62')]({'where':{'id':_[_0x3d85('0x32')](_0x1c7f2b,_0x3d85('0x63')),'role':_0x3d85('0x64')},'attributes':['id','name',_0x3d85('0x65'),'updatedAt',_0x3d85('0x66')]});}})[_0x3d85('0x2b')](function(_0x58f8be){if(_0x58f8be){return{'count':_0x58f8be[_0x3d85('0x23')],'rows':_[_0x3d85('0x32')](_0x58f8be[_0x3d85('0x4b')],function(_0x3c9a9b){return{'membername':_0x3c9a9b[_0x3d85('0x2f')],'UserId':_0x3c9a9b['id'],'queue_name':_0x1ddb53['name'],'FaxQueueId':_0x1ddb53['id'],'interface':util[_0x3d85('0x67')](_0x3d85('0x68'),_0x3d85('0x69'),_0x3c9a9b['name']),'penalty':0x0,'paused':_0x3c9a9b[_0x3d85('0x65')],'createdAt':_0x3c9a9b[_0x3d85('0x66')],'updatedAt':_0x3c9a9b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x35eb57,_0x144ae7))[_0x3d85('0x4c')](handleError(_0x35eb57,null));};exports[_0x3d85('0x6a')]=function(_0x477948,_0x1fc2c4,_0x1b5d8b){var _0x333522={};var _0x519bb8={};var _0x525334;var _0x35cb38;return db[_0x3d85('0x47')][_0x3d85('0x5e')]({'where':{'id':_0x477948[_0x3d85('0x5b')]['id']}})[_0x3d85('0x2b')](handleEntityNotFound(_0x1fc2c4,null))[_0x3d85('0x2b')](function(_0x129130){if(_0x129130){_0x525334=_0x129130;_0x519bb8[_0x3d85('0x37')]=_[_0x3d85('0x39')](db['Team'][_0x3d85('0x33')]);_0x519bb8[_0x3d85('0x38')]=_['keys'](_0x477948[_0x3d85('0x38')]);_0x519bb8['filters']=_[_0x3d85('0x3b')](_0x519bb8[_0x3d85('0x37')],_0x519bb8[_0x3d85('0x38')]);_0x333522[_0x3d85('0x3c')]=_['intersection'](_0x519bb8['model'],qs[_0x3d85('0x3d')](_0x477948['query'][_0x3d85('0x3d')]));_0x333522[_0x3d85('0x3c')]=_0x333522['attributes'][_0x3d85('0x3e')]?_0x333522[_0x3d85('0x3c')]:_0x519bb8[_0x3d85('0x37')];_0x333522[_0x3d85('0x41')]=qs[_0x3d85('0x42')](_0x477948['query'][_0x3d85('0x42')]);_0x333522[_0x3d85('0x43')]=qs[_0x3d85('0x3a')](_[_0x3d85('0x60')](_0x477948[_0x3d85('0x38')],_0x519bb8['filters']));if(_0x477948[_0x3d85('0x38')][_0x3d85('0x44')]){_0x333522['where']=_[_0x3d85('0x45')](_0x333522['where'],{'$or':_[_0x3d85('0x32')](_0x333522[_0x3d85('0x3c')],function(_0x9be756){var _0x1fc3da={};_0x1fc3da[_0x9be756]={'$like':'%'+_0x477948[_0x3d85('0x38')][_0x3d85('0x44')]+'%'};return _0x1fc3da;})});}_0x333522=_['merge']({},_0x333522,_0x477948[_0x3d85('0x6b')]);return _0x525334[_0x3d85('0x6a')](_0x333522);}})[_0x3d85('0x2b')](function(_0x87a168){if(_0x87a168){_0x35cb38=_0x87a168[_0x3d85('0x3e')];if(!_0x477948[_0x3d85('0x38')]['hasOwnProperty'](_0x3d85('0x40'))){_0x333522[_0x3d85('0x24')]=qs['limit'](_0x477948[_0x3d85('0x38')][_0x3d85('0x24')]);_0x333522[_0x3d85('0x21')]=qs[_0x3d85('0x21')](_0x477948[_0x3d85('0x38')][_0x3d85('0x21')]);}return _0x525334[_0x3d85('0x6a')](_0x333522);}})[_0x3d85('0x2b')](function(_0x34f17e){if(_0x34f17e){return _0x34f17e?{'count':_0x35cb38,'rows':_0x34f17e}:null;}})[_0x3d85('0x2b')](respondWithResult(_0x1fc2c4,null))[_0x3d85('0x4c')](handleError(_0x1fc2c4,null));};exports[_0x3d85('0x6c')]=function(_0xe4483c,_0x20d2a2,_0x2487f8){var _0x3314d9=_0xe4483c[_0x3d85('0x4f')][_0x3d85('0x6d')];return db[_0x3d85('0x6e')][_0x3d85('0x4a')]({'where':{'id':_0x3314d9},'attributes':['id'],'include':[{'model':db[_0x3d85('0x61')],'as':_0x3d85('0x6f'),'attributes':['id',_0x3d85('0x2f'),_0x3d85('0x70'),_0x3d85('0x71'),_0x3d85('0x72')],'raw':!![]}]})['then'](function(_0x481000){if(_0x481000){var _0xd4e968=_['flatMap'](_0x481000,function(_0x3c0c37){var _0x5bcc36=_0x3c0c37[_0x3d85('0x51')]({'plain':!![]});return _0x5bcc36[_0x3d85('0x6f')];});return db['FaxQueue'][_0x3d85('0x55')]({'where':{'id':_0xe4483c[_0x3d85('0x5b')]['id']}})[_0x3d85('0x2b')](function(_0x40f403){return db[_0x3d85('0x73')][_0x3d85('0x74')](function(_0x3c2724){return _0x40f403['addTeams'](_0x3314d9,{'transaction':_0x3c2724})[_0x3d85('0x2b')](function(){return BPromise[_0x3d85('0x75')](_0xd4e968,function(_0xef731c){return db[_0x3d85('0x5f')][_0x3d85('0x76')]({'where':{'UserId':_0xef731c['id'],'FaxQueueId':_0xe4483c[_0x3d85('0x5b')]['id']},'transaction':_0x3c2724});});})[_0x3d85('0x2b')](function(){_0xd4e968[_0x3d85('0x77')](function(_0x2b3b1b){socket[_0x3d85('0x78')](_0x3d85('0x79'),{'UserId':_0x2b3b1b['id'],'FaxQueueId':_0x40f403['id']});});});});});}})['then'](respondWithStatusCode(_0x20d2a2,null))[_0x3d85('0x4c')](handleError(_0x20d2a2,null));};exports['removeTeams']=function(_0x392de3,_0x33a00d,_0x4a9eeb){return db['Team']['findAll']({'where':{'id':_0x392de3['query'][_0x3d85('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x3d85('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3d85('0x2b')](handleEntityNotFound(_0x33a00d,null))[_0x3d85('0x2b')](function(_0x235179){var _0x43dbb0=_['map'](_0x235179,'id');var _0x3e602c=[];var _0x575562=[];var _0x5798f8=squel[_0x3d85('0x7a')]();_0x5798f8[_0x3d85('0x7b')](_0x3d85('0x7c'))['from'](_0x3d85('0x7d'),'tq')[_0x3d85('0x7e')](_0x3d85('0x7f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3d85('0x43')]('FaxQueueId\x20=\x20?',_0x392de3[_0x3d85('0x5b')]['id']);for(var _0x16f47d=0x0;_0x16f47d<_0x235179[_0x3d85('0x3e')];_0x16f47d+=0x1){let _0x107e50=_0x235179[_0x16f47d];for(var _0x6c3571=0x0;_0x6c3571<_0x107e50[_0x3d85('0x6f')][_0x3d85('0x3e')];_0x6c3571+=0x1){let _0x97cc37=_0x107e50[_0x3d85('0x6f')][_0x6c3571];var _0x65cb49=_0x5798f8[_0x3d85('0x80')]();_0x65cb49[_0x3d85('0x43')](_0x3d85('0x81'),_0x97cc37['id']);_0x575562[_0x3d85('0x82')](db[_0x3d85('0x73')]['query'](_0x65cb49[_0x3d85('0x83')](),{'type':db[_0x3d85('0x73')][_0x3d85('0x84')][_0x3d85('0x85')]})[_0x3d85('0x2b')](function(_0x3eff06){if(_0x3eff06['length']===0x1){return _0x97cc37['id'];}else{var _0xf2f807=_['every'](_[_0x3d85('0x32')](_0x3eff06,_0x3d85('0x86')),function(_0x2ec3f9){return _[_0x3d85('0x87')](_0x43dbb0,_0x2ec3f9);});if(_0xf2f807){return _0x97cc37['id'];}}}));}}return BPromise[_0x3d85('0x88')](_0x575562)[_0x3d85('0x2b')](function(_0x3e8ae7){_0x3e602c=_(_0x3e602c)['union'](_0x3e8ae7)[_0x3d85('0x89')]()[_0x3d85('0x8a')]();return db[_0x3d85('0x47')][_0x3d85('0x55')]({'where':{'id':_0x392de3['params']['id']}})['then'](function(_0x37dfa5){return db[_0x3d85('0x73')][_0x3d85('0x74')](function(_0x1ee457){return _0x37dfa5['removeTeams'](_0x392de3[_0x3d85('0x38')]['ids'],{'transaction':_0x1ee457})[_0x3d85('0x2b')](function(){if(!_[_0x3d85('0x8b')](_0x3e602c)){return _0x37dfa5['removeAgents'](_0x3e602c,{'transaction':_0x1ee457});}})[_0x3d85('0x2b')](function(){_0x3e602c['forEach'](function(_0x2a2e96){socket[_0x3d85('0x78')](_0x3d85('0x8c'),{'UserId':_0x2a2e96,'FaxQueueId':_0x37dfa5['id']});});});});});});})[_0x3d85('0x2b')](respondWithStatusCode(_0x33a00d,null))['catch'](handleError(_0x33a00d,null));};exports[_0x3d85('0x8d')]=function(_0x5a1e91,_0x453cf8,_0x1e5c60){return db['FaxQueue']['find']({'where':{'id':_0x5a1e91[_0x3d85('0x5b')]['id']}})[_0x3d85('0x2b')](handleEntityNotFound(_0x453cf8,null))[_0x3d85('0x2b')](function(_0x63f3cb){if(_0x63f3cb){return _0x63f3cb[_0x3d85('0x8d')](_0x5a1e91[_0x3d85('0x4f')][_0x3d85('0x6d')],_['omit'](_0x5a1e91[_0x3d85('0x4f')],[_0x3d85('0x6d'),'id'])||{})[_0x3d85('0x8e')](function(_0x5108fd){for(var _0x25c899=0x0;_0x25c899<_0x5a1e91[_0x3d85('0x4f')][_0x3d85('0x6d')][_0x3d85('0x3e')];_0x25c899+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x5a1e91[_0x3d85('0x4f')][_0x3d85('0x6d')][_0x25c899]),'FaxQueueId':Number(_0x5a1e91['params']['id'])});}return _0x5108fd;});}})[_0x3d85('0x2b')](respondWithResult(_0x453cf8,null))[_0x3d85('0x4c')](handleError(_0x453cf8,null));};exports[_0x3d85('0x8f')]=function(_0x2e9f19,_0xa7c974,_0x4d5974){return db[_0x3d85('0x47')][_0x3d85('0x55')]({'where':{'id':_0x2e9f19[_0x3d85('0x5b')]['id']}})['then'](handleEntityNotFound(_0xa7c974,null))[_0x3d85('0x2b')](function(_0x2969fd){if(_0x2969fd){return _0x2969fd[_0x3d85('0x8f')](_0x2e9f19[_0x3d85('0x38')][_0x3d85('0x6d')])[_0x3d85('0x2b')](function(){if(_[_0x3d85('0x90')](_0x2e9f19[_0x3d85('0x38')][_0x3d85('0x6d')])){for(var _0x3c9816=0x0;_0x3c9816<_0x2e9f19[_0x3d85('0x38')]['ids'][_0x3d85('0x3e')];_0x3c9816+=0x1){socket[_0x3d85('0x78')](_0x3d85('0x8c'),{'UserId':Number(_0x2e9f19['query'][_0x3d85('0x6d')][_0x3c9816]),'FaxQueueId':Number(_0x2e9f19[_0x3d85('0x5b')]['id'])});}}else{socket[_0x3d85('0x78')]('userFaxQueue:remove',{'UserId':Number(_0x2e9f19[_0x3d85('0x38')][_0x3d85('0x6d')]),'FaxQueueId':Number(_0x2e9f19[_0x3d85('0x5b')]['id'])});}});}})[_0x3d85('0x2b')](respondWithStatusCode(_0xa7c974,null))[_0x3d85('0x4c')](handleError(_0xa7c974,null));};exports[_0x3d85('0x91')]=function(_0x2c4bd8,_0x29b17d,_0x1257e4){var _0x4d055f={};var _0x76f613={};var _0x1ebfc9;var _0x26fa20;return db[_0x3d85('0x47')][_0x3d85('0x5e')]({'where':{'id':_0x2c4bd8['params']['id']}})[_0x3d85('0x2b')](handleEntityNotFound(_0x29b17d,null))[_0x3d85('0x2b')](function(_0x4a3890){if(_0x4a3890){_0x1ebfc9=_0x4a3890;_0x76f613[_0x3d85('0x37')]=_[_0x3d85('0x39')](db[_0x3d85('0x61')][_0x3d85('0x33')]);_0x76f613[_0x3d85('0x38')]=_['keys'](_0x2c4bd8[_0x3d85('0x38')]);_0x76f613['filters']=_[_0x3d85('0x3b')](_0x76f613['model'],_0x76f613[_0x3d85('0x38')]);_0x4d055f[_0x3d85('0x3c')]=_['intersection'](_0x76f613[_0x3d85('0x37')],qs[_0x3d85('0x3d')](_0x2c4bd8[_0x3d85('0x38')][_0x3d85('0x3d')]));_0x4d055f[_0x3d85('0x3c')]=_0x4d055f[_0x3d85('0x3c')][_0x3d85('0x3e')]?_0x4d055f['attributes']:_0x76f613[_0x3d85('0x37')];_0x4d055f[_0x3d85('0x41')]=qs[_0x3d85('0x42')](_0x2c4bd8[_0x3d85('0x38')]['sort']);_0x4d055f[_0x3d85('0x43')]=qs[_0x3d85('0x3a')](_[_0x3d85('0x60')](_0x2c4bd8['query'],_0x76f613[_0x3d85('0x3a')]));if(_0x2c4bd8['query'][_0x3d85('0x44')]){_0x4d055f[_0x3d85('0x43')]=_['merge'](_0x4d055f[_0x3d85('0x43')],{'$or':_[_0x3d85('0x32')](_0x4d055f[_0x3d85('0x3c')],function(_0x532a4c){var _0x14bc82={};_0x14bc82[_0x532a4c]={'$like':'%'+_0x2c4bd8['query'][_0x3d85('0x44')]+'%'};return _0x14bc82;})});}_0x4d055f=_[_0x3d85('0x45')]({},_0x4d055f,_0x2c4bd8[_0x3d85('0x6b')]);return _0x1ebfc9[_0x3d85('0x91')](_0x4d055f);}})['then'](function(_0x299ec4){if(_0x299ec4){_0x26fa20=_0x299ec4[_0x3d85('0x3e')];if(!_0x2c4bd8[_0x3d85('0x38')][_0x3d85('0x3f')](_0x3d85('0x40'))){_0x4d055f['limit']=qs[_0x3d85('0x24')](_0x2c4bd8['query']['limit']);_0x4d055f[_0x3d85('0x21')]=qs['offset'](_0x2c4bd8[_0x3d85('0x38')]['offset']);}return _0x1ebfc9[_0x3d85('0x91')](_0x4d055f);}})[_0x3d85('0x2b')](function(_0x368d19){if(_0x368d19){return _0x368d19?{'count':_0x26fa20,'rows':_0x368d19}:null;}})[_0x3d85('0x2b')](respondWithResult(_0x29b17d,null))[_0x3d85('0x4c')](handleError(_0x29b17d,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 99aa6f0..dd6131a 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 _0x3945=['hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x27cb5b,_0x4ebda4){var _0x3847f2=function(_0x5b2274){while(--_0x5b2274){_0x27cb5b['push'](_0x27cb5b['shift']());}};_0x3847f2(++_0x4ebda4);}(_0x3945,0x1ec));var _0x5394=function(_0x38c792,_0x22a1e3){_0x38c792=_0x38c792-0x0;var _0x5e33fe=_0x3945[_0x38c792];return _0x5e33fe;};'use strict';var EventEmitter=require(_0x5394('0x0'));var FaxQueue=require(_0x5394('0x1'))['db'][_0x5394('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5394('0x3')](0x0);var events={'afterCreate':_0x5394('0x4'),'afterUpdate':_0x5394('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b3db6){return function(_0x5d4780,_0x2e63c3,_0x12b8be){FaxQueueEvents[_0x5394('0x6')](_0x5b3db6+':'+_0x5d4780['id'],_0x5d4780);FaxQueueEvents['emit'](_0x5b3db6,_0x5d4780);_0x12b8be(null);};}for(var e in events){if(events[_0x5394('0x7')](e)){var event=events[e];FaxQueue[_0x5394('0x8')](e,emitEvent(event));}}module[_0x5394('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xe948=['setMaxListeners','update','remove','exports','events','../../mysqldb','FaxQueue'];(function(_0x35dfc7,_0x8aa196){var _0x2c7922=function(_0xb1d5e3){while(--_0xb1d5e3){_0x35dfc7['push'](_0x35dfc7['shift']());}};_0x2c7922(++_0x8aa196);}(_0xe948,0xf2));var _0x8e94=function(_0x82c5d9,_0x41bdfb){_0x82c5d9=_0x82c5d9-0x0;var _0x4b5cd6=_0xe948[_0x82c5d9];return _0x4b5cd6;};'use strict';var EventEmitter=require(_0x8e94('0x0'));var FaxQueue=require(_0x8e94('0x1'))['db'][_0x8e94('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8e94('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e94('0x4'),'afterDestroy':_0x8e94('0x5')};function emitEvent(_0x1e9bb1){return function(_0x56057c,_0x14c4d0,_0x3967d6){FaxQueueEvents['emit'](_0x1e9bb1+':'+_0x56057c['id'],_0x56057c);FaxQueueEvents['emit'](_0x1e9bb1,_0x56057c);_0x3967d6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x8e94('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 4a1cab7..c9e7c2a 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 _0xcabb=['bluebird','request-promise','path','rimraf','exports','define','fax_queues','lodash','util','../../config/logger','api'];(function(_0x155af3,_0x4b7f9a){var _0x15a675=function(_0xec0188){while(--_0xec0188){_0x155af3['push'](_0x155af3['shift']());}};_0x15a675(++_0x4b7f9a);}(_0xcabb,0x11a));var _0xbcab=function(_0x559c4c,_0x29896a){_0x559c4c=_0x559c4c-0x0;var _0x109a5f=_0xcabb[_0x559c4c];return _0x109a5f;};'use strict';var _=require(_0xbcab('0x0'));var util=require(_0xbcab('0x1'));var logger=require(_0xbcab('0x2'))(_0xbcab('0x3'));var moment=require('moment');var BPromise=require(_0xbcab('0x4'));var rp=require(_0xbcab('0x5'));var fs=require('fs');var path=require(_0xbcab('0x6'));var rimraf=require(_0xbcab('0x7'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xbcab('0x8')]=function(_0x4f8f42,_0x3a17e8){return _0x4f8f42[_0xbcab('0x9')]('FaxQueue',attributes,{'tableName':_0xbcab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c9f=['define','FaxQueue','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x9c9f,0x66));var _0xf9c9=function(_0x3d4fb9,_0xef3606){_0x3d4fb9=_0x3d4fb9-0x0;var _0x11a255=_0x9c9f[_0x3d4fb9];return _0x11a255;};'use strict';var _=require(_0xf9c9('0x0'));var util=require(_0xf9c9('0x1'));var logger=require(_0xf9c9('0x2'))(_0xf9c9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf9c9('0x4'));var fs=require('fs');var path=require(_0xf9c9('0x5'));var rimraf=require('rimraf');var config=require(_0xf9c9('0x6'));var attributes=require('./faxQueue.attributes');module[_0xf9c9('0x7')]=function(_0x55bb40,_0x2efdae){return _0x55bb40[_0xf9c9('0x8')](_0xf9c9('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 170966c..d1cf9e2 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 _0xc6f3=['then','GetFaxQueue','find','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','catch','FaxQueue','findAll','options','raw','where','attributes','include','model','map'];(function(_0x42e2df,_0x1513dd){var _0x582d66=function(_0x184b6f){while(--_0x184b6f){_0x42e2df['push'](_0x42e2df['shift']());}};_0x582d66(++_0x1513dd);}(_0xc6f3,0x1cc));var _0x3c6f=function(_0x46ed72,_0x3d8aaa){_0x46ed72=_0x46ed72-0x0;var _0x3c960f=_0xc6f3[_0x46ed72];return _0x3c960f;};'use strict';var _=require(_0x3c6f('0x0'));var util=require(_0x3c6f('0x1'));var moment=require(_0x3c6f('0x2'));var BPromise=require(_0x3c6f('0x3'));var rs=require(_0x3c6f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3c6f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3c6f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3c6f('0x7')][_0x3c6f('0x8')]({'port':0x232a});config[_0x3c6f('0x9')]=_[_0x3c6f('0xa')](config[_0x3c6f('0x9')],{'host':_0x3c6f('0xb'),'port':0x18eb});var socket=require(_0x3c6f('0xc'))(new Redis(config[_0x3c6f('0x9')]));require('./faxQueue.socket')[_0x3c6f('0xd')](socket);function respondWithRpcPromise(_0x25b1ce,_0x2bf587,_0x444f82){return new BPromise(function(_0x1d7be0,_0x3d45bb){return client[_0x3c6f('0xe')](_0x25b1ce,_0x444f82)['then'](function(_0x13f461){logger[_0x3c6f('0xf')]('FaxQueue,\x20%s,\x20%s',_0x2bf587,_0x3c6f('0x10'));logger[_0x3c6f('0x11')](_0x3c6f('0x12'),_0x2bf587,_0x3c6f('0x10'),JSON[_0x3c6f('0x13')](_0x13f461));if(_0x13f461[_0x3c6f('0x14')]){if(_0x13f461['error'][_0x3c6f('0x15')]===0x1f4){logger[_0x3c6f('0x14')](_0x3c6f('0x16'),_0x2bf587,_0x13f461[_0x3c6f('0x14')][_0x3c6f('0x17')]);return _0x3d45bb(_0x13f461[_0x3c6f('0x14')][_0x3c6f('0x17')]);}logger['error'](_0x3c6f('0x16'),_0x2bf587,_0x13f461[_0x3c6f('0x14')][_0x3c6f('0x17')]);return _0x1d7be0(_0x13f461[_0x3c6f('0x14')]['message']);}else{logger[_0x3c6f('0xf')](_0x3c6f('0x16'),_0x2bf587,_0x3c6f('0x10'));_0x1d7be0(_0x13f461['result'][_0x3c6f('0x17')]);}})[_0x3c6f('0x18')](function(_0x14b4f7){logger[_0x3c6f('0x14')]('FaxQueue,\x20%s,\x20%s',_0x2bf587,_0x14b4f7);_0x3d45bb(_0x14b4f7);});});}exports['GetFaxQueue']=function(_0x41bd09){var _0x1f500b=this;return new Promise(function(_0x595bef,_0x43dba4){return db[_0x3c6f('0x19')][_0x3c6f('0x1a')]({'raw':_0x41bd09[_0x3c6f('0x1b')]?_0x41bd09[_0x3c6f('0x1b')][_0x3c6f('0x1c')]===undefined?!![]:![]:!![],'where':_0x41bd09[_0x3c6f('0x1b')]?_0x41bd09[_0x3c6f('0x1b')][_0x3c6f('0x1d')]||null:null,'attributes':_0x41bd09[_0x3c6f('0x1b')]?_0x41bd09['options'][_0x3c6f('0x1e')]||null:null,'limit':_0x41bd09[_0x3c6f('0x1b')]?_0x41bd09[_0x3c6f('0x1b')]['limit']||null:null,'include':_0x41bd09[_0x3c6f('0x1b')]?_0x41bd09['options'][_0x3c6f('0x1f')]?_['map'](_0x41bd09[_0x3c6f('0x1b')][_0x3c6f('0x1f')],function(_0x34c117){return{'model':db[_0x34c117[_0x3c6f('0x20')]],'as':_0x34c117['as'],'attributes':_0x34c117[_0x3c6f('0x1e')],'include':_0x34c117[_0x3c6f('0x1f')]?_[_0x3c6f('0x21')](_0x34c117[_0x3c6f('0x1f')],function(_0x48275d){return{'model':db[_0x48275d['model']],'as':_0x48275d['as'],'attributes':_0x48275d[_0x3c6f('0x1e')],'include':_0x48275d[_0x3c6f('0x1f')]?_[_0x3c6f('0x21')](_0x48275d['include'],function(_0x326737){return{'model':db[_0x326737[_0x3c6f('0x20')]],'as':_0x326737['as'],'attributes':_0x326737[_0x3c6f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3c6f('0x22')](function(_0x26e0e4){logger['info'](_0x3c6f('0x23'),_0x41bd09);logger['debug']('GetFaxQueue',_0x41bd09,JSON[_0x3c6f('0x13')](_0x26e0e4));_0x595bef(_0x26e0e4);})['catch'](function(_0x2fbab2){logger[_0x3c6f('0x14')](_0x3c6f('0x23'),_0x2fbab2[_0x3c6f('0x17')],_0x41bd09);_0x43dba4(_0x1f500b[_0x3c6f('0x14')](0x1f4,_0x2fbab2[_0x3c6f('0x17')]));});});};exports['ShowFaxQueue']=function(_0x2e193b){var _0x3e4ffa=this;return new Promise(function(_0x100999,_0x154845){return db[_0x3c6f('0x19')][_0x3c6f('0x24')]({'raw':_0x2e193b['options']?_0x2e193b['options'][_0x3c6f('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e193b[_0x3c6f('0x1b')]?_0x2e193b[_0x3c6f('0x1b')][_0x3c6f('0x1d')]||null:null,'attributes':_0x2e193b[_0x3c6f('0x1b')]?_0x2e193b[_0x3c6f('0x1b')][_0x3c6f('0x1e')]||null:null,'include':_0x2e193b['options']?_0x2e193b[_0x3c6f('0x1b')][_0x3c6f('0x1f')]?_['map'](_0x2e193b[_0x3c6f('0x1b')][_0x3c6f('0x1f')],function(_0x32e6f4){return{'model':db[_0x32e6f4[_0x3c6f('0x20')]],'as':_0x32e6f4['as'],'attributes':_0x32e6f4[_0x3c6f('0x1e')],'include':_0x32e6f4[_0x3c6f('0x1f')]?_[_0x3c6f('0x21')](_0x32e6f4[_0x3c6f('0x1f')],function(_0x1c877e){return{'model':db[_0x1c877e[_0x3c6f('0x20')]],'as':_0x1c877e['as'],'attributes':_0x1c877e[_0x3c6f('0x1e')],'include':_0x1c877e[_0x3c6f('0x1f')]?_[_0x3c6f('0x21')](_0x1c877e['include'],function(_0x5e8cb8){return{'model':db[_0x5e8cb8[_0x3c6f('0x20')]],'as':_0x5e8cb8['as'],'attributes':_0x5e8cb8[_0x3c6f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53f1a2){logger[_0x3c6f('0xf')](_0x3c6f('0x25'),_0x2e193b);logger[_0x3c6f('0x11')](_0x3c6f('0x25'),_0x2e193b,JSON[_0x3c6f('0x13')](_0x53f1a2));_0x100999(_0x53f1a2);})[_0x3c6f('0x18')](function(_0x24a4f7){logger[_0x3c6f('0x14')](_0x3c6f('0x25'),_0x24a4f7['message'],_0x2e193b);_0x154845(_0x3e4ffa['error'](0x1f4,_0x24a4f7[_0x3c6f('0x17')]));});});}; \ No newline at end of file +var _0x1b5b=['code','message','result','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','map','model','then','catch','ShowFaxQueue','find','where','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0x1b5b,0x123));var _0xb1b5=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x1b5b[_0x389832];return _0x59429e;};'use strict';var _=require(_0xb1b5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb1b5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1b5('0x2'));var db=require(_0xb1b5('0x3'))['db'];var utils=require(_0xb1b5('0x4'));var logger=require('../../config/logger')(_0xb1b5('0x5'));var config=require(_0xb1b5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb1b5('0x7')][_0xb1b5('0x8')]({'port':0x232a});config[_0xb1b5('0x9')]=_[_0xb1b5('0xa')](config['redis'],{'host':_0xb1b5('0xb'),'port':0x18eb});var socket=require(_0xb1b5('0xc'))(new Redis(config[_0xb1b5('0x9')]));require(_0xb1b5('0xd'))[_0xb1b5('0xe')](socket);function respondWithRpcPromise(_0x120bc1,_0x4d6667,_0x3f0622){return new BPromise(function(_0x4e46da,_0x58bc13){return client[_0xb1b5('0xf')](_0x120bc1,_0x3f0622)['then'](function(_0x1e3a24){logger[_0xb1b5('0x10')](_0xb1b5('0x11'),_0x4d6667,_0xb1b5('0x12'));logger[_0xb1b5('0x13')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x4d6667,_0xb1b5('0x12'),JSON['stringify'](_0x1e3a24));if(_0x1e3a24['error']){if(_0x1e3a24[_0xb1b5('0x14')][_0xb1b5('0x15')]===0x1f4){logger['error'](_0xb1b5('0x11'),_0x4d6667,_0x1e3a24[_0xb1b5('0x14')][_0xb1b5('0x16')]);return _0x58bc13(_0x1e3a24[_0xb1b5('0x14')][_0xb1b5('0x16')]);}logger[_0xb1b5('0x14')]('FaxQueue,\x20%s,\x20%s',_0x4d6667,_0x1e3a24['error'][_0xb1b5('0x16')]);return _0x4e46da(_0x1e3a24[_0xb1b5('0x14')]['message']);}else{logger[_0xb1b5('0x10')](_0xb1b5('0x11'),_0x4d6667,_0xb1b5('0x12'));_0x4e46da(_0x1e3a24[_0xb1b5('0x17')][_0xb1b5('0x16')]);}})['catch'](function(_0x1fb32b){logger[_0xb1b5('0x14')](_0xb1b5('0x11'),_0x4d6667,_0x1fb32b);_0x58bc13(_0x1fb32b);});});}exports[_0xb1b5('0x18')]=function(_0x400706){var _0x253e03=this;return new Promise(function(_0x193819,_0x565fde){return db[_0xb1b5('0x19')][_0xb1b5('0x1a')]({'raw':_0x400706[_0xb1b5('0x1b')]?_0x400706[_0xb1b5('0x1b')][_0xb1b5('0x1c')]===undefined?!![]:![]:!![],'where':_0x400706[_0xb1b5('0x1b')]?_0x400706[_0xb1b5('0x1b')]['where']||null:null,'attributes':_0x400706['options']?_0x400706[_0xb1b5('0x1b')][_0xb1b5('0x1d')]||null:null,'limit':_0x400706[_0xb1b5('0x1b')]?_0x400706[_0xb1b5('0x1b')][_0xb1b5('0x1e')]||null:null,'include':_0x400706[_0xb1b5('0x1b')]?_0x400706[_0xb1b5('0x1b')][_0xb1b5('0x1f')]?_[_0xb1b5('0x20')](_0x400706[_0xb1b5('0x1b')]['include'],function(_0x4269c0){return{'model':db[_0x4269c0[_0xb1b5('0x21')]],'as':_0x4269c0['as'],'attributes':_0x4269c0[_0xb1b5('0x1d')],'include':_0x4269c0['include']?_['map'](_0x4269c0[_0xb1b5('0x1f')],function(_0x2c0921){return{'model':db[_0x2c0921['model']],'as':_0x2c0921['as'],'attributes':_0x2c0921[_0xb1b5('0x1d')],'include':_0x2c0921[_0xb1b5('0x1f')]?_[_0xb1b5('0x20')](_0x2c0921['include'],function(_0x4b2df4){return{'model':db[_0x4b2df4[_0xb1b5('0x21')]],'as':_0x4b2df4['as'],'attributes':_0x4b2df4['attributes']};}):[]};}):[]};}):[]:[]})[_0xb1b5('0x22')](function(_0x14a8c9){logger[_0xb1b5('0x10')]('GetFaxQueue',_0x400706);logger['debug'](_0xb1b5('0x18'),_0x400706,JSON['stringify'](_0x14a8c9));_0x193819(_0x14a8c9);})[_0xb1b5('0x23')](function(_0x3c7c0d){logger[_0xb1b5('0x14')](_0xb1b5('0x18'),_0x3c7c0d[_0xb1b5('0x16')],_0x400706);_0x565fde(_0x253e03[_0xb1b5('0x14')](0x1f4,_0x3c7c0d[_0xb1b5('0x16')]));});});};exports[_0xb1b5('0x24')]=function(_0x5aaad4){var _0x6e613c=this;return new Promise(function(_0x1f0cfc,_0x54745a){return db[_0xb1b5('0x19')][_0xb1b5('0x25')]({'raw':_0x5aaad4[_0xb1b5('0x1b')]?_0x5aaad4[_0xb1b5('0x1b')][_0xb1b5('0x1c')]===undefined?!![]:![]:!![],'where':_0x5aaad4['options']?_0x5aaad4['options'][_0xb1b5('0x26')]||null:null,'attributes':_0x5aaad4[_0xb1b5('0x1b')]?_0x5aaad4['options'][_0xb1b5('0x1d')]||null:null,'include':_0x5aaad4[_0xb1b5('0x1b')]?_0x5aaad4[_0xb1b5('0x1b')][_0xb1b5('0x1f')]?_[_0xb1b5('0x20')](_0x5aaad4[_0xb1b5('0x1b')]['include'],function(_0x241e5a){return{'model':db[_0x241e5a['model']],'as':_0x241e5a['as'],'attributes':_0x241e5a[_0xb1b5('0x1d')],'include':_0x241e5a['include']?_['map'](_0x241e5a['include'],function(_0xff2563){return{'model':db[_0xff2563['model']],'as':_0xff2563['as'],'attributes':_0xff2563['attributes'],'include':_0xff2563[_0xb1b5('0x1f')]?_[_0xb1b5('0x20')](_0xff2563[_0xb1b5('0x1f')],function(_0x4b46d3){return{'model':db[_0x4b46d3['model']],'as':_0x4b46d3['as'],'attributes':_0x4b46d3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x366c2d){logger[_0xb1b5('0x10')](_0xb1b5('0x24'),_0x5aaad4);logger['debug'](_0xb1b5('0x24'),_0x5aaad4,JSON['stringify'](_0x366c2d));_0x1f0cfc(_0x366c2d);})[_0xb1b5('0x23')](function(_0x57d0fb){logger[_0xb1b5('0x14')](_0xb1b5('0x24'),_0x57d0fb[_0xb1b5('0x16')],_0x5aaad4);_0x54745a(_0x6e613c[_0xb1b5('0x14')](0x1f4,_0x57d0fb['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index f14068e..e7c60b6 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 _0xf513=['remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x1e7ead,_0x7f6227){var _0x3912b2=function(_0x1eeb03){while(--_0x1eeb03){_0x1e7ead['push'](_0x1e7ead['shift']());}};_0x3912b2(++_0x7f6227);}(_0xf513,0x181));var _0x3f51=function(_0x3b5a71,_0x581c86){_0x3b5a71=_0x3b5a71-0x0;var _0xeca5b7=_0xf513[_0x3b5a71];return _0xeca5b7;};'use strict';var FaxQueueEvents=require(_0x3f51('0x0'));var events=[_0x3f51('0x1'),_0x3f51('0x2'),_0x3f51('0x3')];function createListener(_0x74ab72,_0x3d10ec){return function(_0x51b07f){_0x3d10ec[_0x3f51('0x4')](_0x74ab72,_0x51b07f);};}function removeListener(_0x15612d,_0x3d4aea){return function(){FaxQueueEvents[_0x3f51('0x5')](_0x15612d,_0x3d4aea);};}exports[_0x3f51('0x6')]=function(_0x567b49){for(var _0xdc7974=0x0,_0x39fcac=events[_0x3f51('0x7')];_0xdc7974<_0x39fcac;_0xdc7974++){var _0x5c55c5=events[_0xdc7974];var _0x5aa0d9=createListener(_0x3f51('0x8')+_0x5c55c5,_0x567b49);FaxQueueEvents['on'](_0x5c55c5,_0x5aa0d9);}}; \ No newline at end of file +var _0x2ac3=['./faxQueue.events','update','removeListener','register','length','faxQueue:'];(function(_0x440739,_0x5d12c2){var _0x2071c7=function(_0xb71ed7){while(--_0xb71ed7){_0x440739['push'](_0x440739['shift']());}};_0x2071c7(++_0x5d12c2);}(_0x2ac3,0x198));var _0x32ac=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2ac3[_0xa464c9];return _0x3d73c4;};'use strict';var FaxQueueEvents=require(_0x32ac('0x0'));var events=['save','remove',_0x32ac('0x1')];function createListener(_0x46634c,_0x34d0fe){return function(_0x14e751){_0x34d0fe['emit'](_0x46634c,_0x14e751);};}function removeListener(_0x5ca75,_0x3081ea){return function(){FaxQueueEvents[_0x32ac('0x2')](_0x5ca75,_0x3081ea);};}exports[_0x32ac('0x3')]=function(_0x4819be){for(var _0xc3ae36=0x0,_0x5c4115=events[_0x32ac('0x4')];_0xc3ae36<_0x5c4115;_0xc3ae36++){var _0x4a09c5=events[_0xc3ae36];var _0x34caf4=createListener(_0x32ac('0x5')+_0x4a09c5,_0x4819be);FaxQueueEvents['on'](_0x4a09c5,_0x34caf4);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index c5f1e21..0729c23 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 _0x90b1=['addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0x90b1,0x1bb));var _0x190b=function(_0x36ff42,_0x33ee47){_0x36ff42=_0x36ff42-0x0;var _0x2ff9b4=_0x90b1[_0x36ff42];return _0x2ff9b4;};'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('./faxQueue.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('0x8')](_0x190b('0xe'),auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x8')](_0x190b('0x10'),auth[_0x190b('0xa')](),controller['getTeams']);router[_0x190b('0x8')](_0x190b('0x11'),auth['isAuthenticated'](),controller[_0x190b('0x12')]);router[_0x190b('0x13')]('/',auth[_0x190b('0xa')](),controller[_0x190b('0x14')]);router[_0x190b('0x13')](_0x190b('0x10'),auth[_0x190b('0xa')](),controller[_0x190b('0x15')]);router[_0x190b('0x13')](_0x190b('0x11'),auth[_0x190b('0xa')](),controller[_0x190b('0x16')]);router[_0x190b('0x17')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller[_0x190b('0x18')]);router[_0x190b('0x19')]('/:id',auth[_0x190b('0xa')](),controller['destroy']);router[_0x190b('0x19')](_0x190b('0x10'),auth[_0x190b('0xa')](),controller[_0x190b('0x1a')]);router['delete'](_0x190b('0x11'),auth[_0x190b('0xa')](),controller[_0x190b('0x1b')]);module[_0x190b('0x1c')]=router; \ No newline at end of file +var _0x4c60=['destroy','multer','util','path','connect-timeout','Router','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete'];(function(_0x1c3a07,_0x2ce82b){var _0x54ba26=function(_0x27ec7c){while(--_0x27ec7c){_0x1c3a07['push'](_0x1c3a07['shift']());}};_0x54ba26(++_0x2ce82b);}(_0x4c60,0xc1));var _0x04c6=function(_0x335ce7,_0x296377){_0x335ce7=_0x335ce7-0x0;var _0x55e03f=_0x4c60[_0x335ce7];return _0x55e03f;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('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(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['describe']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x04c6('0xc')]);router['get'](_0x04c6('0xd'),auth[_0x04c6('0x7')](),controller['getTeams']);router[_0x04c6('0x6')](_0x04c6('0xe'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xf')]);router['post']('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x10')]);router[_0x04c6('0x11')]('/:id/teams',auth[_0x04c6('0x7')](),controller[_0x04c6('0x12')]);router[_0x04c6('0x11')](_0x04c6('0xe'),auth[_0x04c6('0x7')](),controller[_0x04c6('0x13')]);router[_0x04c6('0x14')](_0x04c6('0xa'),auth['isAuthenticated'](),controller[_0x04c6('0x15')]);router[_0x04c6('0x16')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0x17')]);router[_0x04c6('0x16')](_0x04c6('0xd'),auth[_0x04c6('0x7')](),controller['removeTeams']);router[_0x04c6('0x16')](_0x04c6('0xe'),auth[_0x04c6('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index f6d8f1c..e0daa25 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 _0xbead=['moment','exports','STRING','DATE'];(function(_0x3dbb28,_0x7135cd){var _0x521bcb=function(_0x449278){while(--_0x449278){_0x3dbb28['push'](_0x3dbb28['shift']());}};_0x521bcb(++_0x7135cd);}(_0xbead,0x1f4));var _0xdbea=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0xbead[_0x4702ee];return _0x62ca7d;};'use strict';var moment=require(_0xdbea('0x0'));var Sequelize=require('sequelize');module[_0xdbea('0x1')]={'uniqueid':{'type':Sequelize[_0xdbea('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xdbea('0x3')]},'leaveAt':{'type':Sequelize[_0xdbea('0x3')]},'acceptAt':{'type':Sequelize[_0xdbea('0x3')]},'exitAt':{'type':Sequelize[_0xdbea('0x3')]},'reason':{'type':Sequelize[_0xdbea('0x2')]}}; \ No newline at end of file +var _0x6c41=['STRING','DATE','moment','sequelize','exports'];(function(_0x3251a3,_0x2e58c4){var _0x389946=function(_0x462e6e){while(--_0x462e6e){_0x3251a3['push'](_0x3251a3['shift']());}};_0x389946(++_0x2e58c4);}(_0x6c41,0x98));var _0x16c4=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0x6c41[_0x553a87];return _0x12d1e6;};'use strict';var moment=require(_0x16c4('0x0'));var Sequelize=require(_0x16c4('0x1'));module[_0x16c4('0x2')]={'uniqueid':{'type':Sequelize[_0x16c4('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x16c4('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x16c4('0x4')]},'reason':{'type':Sequelize[_0x16c4('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 11ac019..6ebb4b6 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 _0xb492=['squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','FaxQueueReport','then','includeAll','include','findAll','rows','catch','params','create','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash'];(function(_0x175b48,_0x3d9f90){var _0x52b98b=function(_0x47537b){while(--_0x47537b){_0x175b48['push'](_0x175b48['shift']());}};_0x52b98b(++_0x3d9f90);}(_0xb492,0x172));var _0x2b49=function(_0x332564,_0x1324c6){_0x332564=_0x332564-0x0;var _0x44948=_0xb492[_0x332564];return _0x44948;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b49('0x0'));var zipdir=require(_0x2b49('0x1'));var jsonpatch=require(_0x2b49('0x2'));var rp=require(_0x2b49('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b49('0x4'));var util=require(_0x2b49('0x5'));var path=require(_0x2b49('0x6'));var sox=require(_0x2b49('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b49('0x8'));var _=require(_0x2b49('0x9'));var squel=require(_0x2b49('0xa'));var crypto=require(_0x2b49('0xb'));var jsforce=require(_0x2b49('0xc'));var deskjs=require(_0x2b49('0xd'));var toCsv=require(_0x2b49('0xe'));var querystring=require(_0x2b49('0xf'));var Papa=require('papaparse');var Redis=require(_0x2b49('0x10'));var authService=require(_0x2b49('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2b49('0x12'));var hardwareService=require(_0x2b49('0x13'));var logger=require(_0x2b49('0x14'))('api');var utils=require(_0x2b49('0x15'));var config=require(_0x2b49('0x16'));var licenseUtil=require(_0x2b49('0x17'));var db=require(_0x2b49('0x18'))['db'];function respondWithStatusCode(_0x1af731,_0x1bda39){_0x1bda39=_0x1bda39||0xcc;return function(_0x5aad36){if(_0x5aad36){return _0x1af731['sendStatus'](_0x1bda39);}return _0x1af731[_0x2b49('0x19')](_0x1bda39)[_0x2b49('0x1a')]();};}function respondWithResult(_0x5e7361,_0x4dec02){_0x4dec02=_0x4dec02||0xc8;return function(_0x30eb71){if(_0x30eb71){return _0x5e7361[_0x2b49('0x19')](_0x4dec02)[_0x2b49('0x1b')](_0x30eb71);}};}function respondWithFilteredResult(_0x4d114b,_0x14fb17){return function(_0xf92e0d){if(_0xf92e0d){var _0x5ee983=typeof _0x14fb17['offset']===_0x2b49('0x1c')&&typeof _0x14fb17[_0x2b49('0x1d')]===_0x2b49('0x1c');var _0x14359f=_0xf92e0d[_0x2b49('0x1e')];var _0x248de1=_0x5ee983?0x0:_0x14fb17[_0x2b49('0x1f')];var _0x25f0d8=_0x5ee983?_0xf92e0d[_0x2b49('0x1e')]:_0x14fb17[_0x2b49('0x1f')]+_0x14fb17['limit'];var _0x37b4ae;if(_0x25f0d8>=_0x14359f){_0x25f0d8=_0x14359f;_0x37b4ae=0xc8;}else{_0x37b4ae=0xce;}_0x4d114b['status'](_0x37b4ae);return _0x4d114b[_0x2b49('0x20')](_0x2b49('0x21'),_0x248de1+'-'+_0x25f0d8+'/'+_0x14359f)[_0x2b49('0x1b')](_0xf92e0d);}return null;};}function patchUpdates(_0x389ff0){return function(_0x1e54f4){try{jsonpatch[_0x2b49('0x22')](_0x1e54f4,_0x389ff0,!![]);}catch(_0x5d33f8){return BPromise[_0x2b49('0x23')](_0x5d33f8);}return _0x1e54f4[_0x2b49('0x24')]();};}function saveUpdates(_0x38edc3,_0x5840ef){return function(_0x8e4c){if(_0x8e4c){return _0x8e4c['update'](_0x38edc3)['then'](function(_0x3107b1){return _0x3107b1;});}return null;};}function removeEntity(_0x1242bb,_0x744835){return function(_0x509164){if(_0x509164){return _0x509164[_0x2b49('0x25')]()['then'](function(){_0x1242bb[_0x2b49('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ea951,_0x3fd4b6){return function(_0x26a7a5){if(!_0x26a7a5){_0x3ea951[_0x2b49('0x26')](0x194);}return _0x26a7a5;};}function handleError(_0x5530e2,_0x4300c0){_0x4300c0=_0x4300c0||0x1f4;return function(_0x191602){logger[_0x2b49('0x27')](_0x191602[_0x2b49('0x28')]);if(_0x191602[_0x2b49('0x29')]){delete _0x191602[_0x2b49('0x29')];}_0x5530e2['status'](_0x4300c0)[_0x2b49('0x2a')](_0x191602);};}exports[_0x2b49('0x2b')]=function(_0x237233,_0x461592){var _0x23138e={},_0xf27200={},_0x177e4c={'count':0x0,'rows':[]};var _0x44c80b=_[_0x2b49('0x2c')](db['FaxQueueReport'][_0x2b49('0x2d')],function(_0x65c004){return{'name':_0x65c004[_0x2b49('0x2e')],'type':_0x65c004['type']['key']};});_0xf27200['model']=_[_0x2b49('0x2c')](_0x44c80b,_0x2b49('0x29'));_0xf27200[_0x2b49('0x2f')]=_[_0x2b49('0x30')](_0x237233[_0x2b49('0x2f')]);_0xf27200[_0x2b49('0x31')]=_[_0x2b49('0x32')](_0xf27200['model'],_0xf27200[_0x2b49('0x2f')]);_0x23138e[_0x2b49('0x33')]=_[_0x2b49('0x32')](_0xf27200[_0x2b49('0x34')],qs[_0x2b49('0x35')](_0x237233[_0x2b49('0x2f')][_0x2b49('0x35')]));_0x23138e[_0x2b49('0x33')]=_0x23138e[_0x2b49('0x33')][_0x2b49('0x36')]?_0x23138e[_0x2b49('0x33')]:_0xf27200[_0x2b49('0x34')];if(!_0x237233[_0x2b49('0x2f')][_0x2b49('0x37')]('nolimit')){_0x23138e[_0x2b49('0x1d')]=qs['limit'](_0x237233['query']['limit']);_0x23138e[_0x2b49('0x1f')]=qs[_0x2b49('0x1f')](_0x237233[_0x2b49('0x2f')]['offset']);}_0x23138e['order']=qs['sort'](_0x237233[_0x2b49('0x2f')][_0x2b49('0x38')]);_0x23138e[_0x2b49('0x39')]=qs['filters'](_[_0x2b49('0x3a')](_0x237233['query'],_0xf27200['filters']),_0x44c80b);if(_0x237233['query'][_0x2b49('0x3b')]){_0x23138e[_0x2b49('0x39')]=_['merge'](_0x23138e['where'],{'$or':_[_0x2b49('0x2c')](_0x44c80b,function(_0x2d2447){if(_0x2d2447[_0x2b49('0x3c')]!==_0x2b49('0x3d')){var _0x51d9f8={};_0x51d9f8[_0x2d2447[_0x2b49('0x29')]]={'$like':'%'+_0x237233[_0x2b49('0x2f')][_0x2b49('0x3b')]+'%'};return _0x51d9f8;}})});}_0x23138e=_[_0x2b49('0x3e')]({},_0x23138e,_0x237233[_0x2b49('0x3f')]);var _0x5395af={'where':_0x23138e[_0x2b49('0x39')]};return db[_0x2b49('0x40')][_0x2b49('0x1e')](_0x5395af)[_0x2b49('0x41')](function(_0x225d4b){_0x177e4c['count']=_0x225d4b;if(_0x237233['query'][_0x2b49('0x42')]){_0x23138e[_0x2b49('0x43')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x2b49('0x44')](_0x23138e);})['then'](function(_0x4521d0){_0x177e4c[_0x2b49('0x45')]=_0x4521d0;return _0x177e4c;})[_0x2b49('0x41')](respondWithFilteredResult(_0x461592,_0x23138e))[_0x2b49('0x46')](handleError(_0x461592,null));};exports['show']=function(_0x511fb4,_0x326e37){var _0x2968bf={'raw':!![],'where':{'id':_0x511fb4[_0x2b49('0x47')]['id']}},_0x4ff21d={};_0x4ff21d[_0x2b49('0x34')]=_[_0x2b49('0x30')](db[_0x2b49('0x40')][_0x2b49('0x2d')]);_0x4ff21d[_0x2b49('0x2f')]=_[_0x2b49('0x30')](_0x511fb4[_0x2b49('0x2f')]);_0x4ff21d[_0x2b49('0x31')]=_['intersection'](_0x4ff21d['model'],_0x4ff21d['query']);_0x2968bf[_0x2b49('0x33')]=_[_0x2b49('0x32')](_0x4ff21d[_0x2b49('0x34')],qs[_0x2b49('0x35')](_0x511fb4['query'][_0x2b49('0x35')]));_0x2968bf[_0x2b49('0x33')]=_0x2968bf[_0x2b49('0x33')][_0x2b49('0x36')]?_0x2968bf[_0x2b49('0x33')]:_0x4ff21d[_0x2b49('0x34')];if(_0x511fb4[_0x2b49('0x2f')][_0x2b49('0x42')]){_0x2968bf[_0x2b49('0x43')]=[{'all':!![]}];}_0x2968bf=_[_0x2b49('0x3e')]({},_0x2968bf,_0x511fb4['options']);return db[_0x2b49('0x40')]['find'](_0x2968bf)[_0x2b49('0x41')](handleEntityNotFound(_0x326e37,null))[_0x2b49('0x41')](respondWithResult(_0x326e37,null))['catch'](handleError(_0x326e37,null));};exports[_0x2b49('0x48')]=function(_0x35e146,_0x3beacf){return db[_0x2b49('0x40')][_0x2b49('0x48')](_0x35e146['body'],{})[_0x2b49('0x41')](respondWithResult(_0x3beacf,0xc9))[_0x2b49('0x46')](handleError(_0x3beacf,null));};exports[_0x2b49('0x49')]=function(_0x4ff422,_0x4ec660){if(_0x4ff422[_0x2b49('0x4a')]['id']){delete _0x4ff422[_0x2b49('0x4a')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x4ff422[_0x2b49('0x47')]['id']}})[_0x2b49('0x41')](handleEntityNotFound(_0x4ec660,null))[_0x2b49('0x41')](saveUpdates(_0x4ff422['body'],null))[_0x2b49('0x41')](respondWithResult(_0x4ec660,null))[_0x2b49('0x46')](handleError(_0x4ec660,null));};exports[_0x2b49('0x25')]=function(_0x29dc15,_0x5cac55){return db[_0x2b49('0x40')]['find']({'where':{'id':_0x29dc15[_0x2b49('0x47')]['id']}})[_0x2b49('0x41')](handleEntityNotFound(_0x5cac55,null))[_0x2b49('0x41')](removeEntity(_0x5cac55,null))['catch'](handleError(_0x5cac55,null));};exports[_0x2b49('0x4b')]=function(_0xe305e2,_0x2539c4){return db[_0x2b49('0x40')][_0x2b49('0x4b')]()[_0x2b49('0x41')](respondWithResult(_0x2539c4,null))[_0x2b49('0x46')](handleError(_0x2539c4,null));}; \ No newline at end of file +var _0x2356=['ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','json','reject','save','destroy','then','name','send','index','map','FaxQueueReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','merge','where','type','VIRTUAL','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','options','find','create','body','update','describe','rimraf','zip-dir','moment','bluebird','path'];(function(_0x1d7336,_0x4c49b7){var _0x1f92b4=function(_0x585d47){while(--_0x585d47){_0x1d7336['push'](_0x1d7336['shift']());}};_0x1f92b4(++_0x4c49b7);}(_0x2356,0x14f));var _0x6235=function(_0x14a0b5,_0x1de8af){_0x14a0b5=_0x14a0b5-0x0;var _0x3a320b=_0x2356[_0x14a0b5];return _0x3a320b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6235('0x0'));var zipdir=require(_0x6235('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6235('0x2'));var BPromise=require(_0x6235('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6235('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6235('0x5'));var fs=require('fs');var fs_extra=require(_0x6235('0x6'));var _=require(_0x6235('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6235('0x8'));var toCsv=require('to-csv');var querystring=require(_0x6235('0x9'));var Papa=require(_0x6235('0xa'));var Redis=require(_0x6235('0xb'));var authService=require(_0x6235('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x6235('0xd'));var hardwareService=require(_0x6235('0xe'));var logger=require(_0x6235('0xf'))(_0x6235('0x10'));var utils=require(_0x6235('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x6235('0x12'));var db=require(_0x6235('0x13'))['db'];function respondWithStatusCode(_0x1303e7,_0x6c422b){_0x6c422b=_0x6c422b||0xcc;return function(_0x48df2d){if(_0x48df2d){return _0x1303e7[_0x6235('0x14')](_0x6c422b);}return _0x1303e7[_0x6235('0x15')](_0x6c422b)['end']();};}function respondWithResult(_0x3f5b7d,_0x48e3a7){_0x48e3a7=_0x48e3a7||0xc8;return function(_0x35156f){if(_0x35156f){return _0x3f5b7d[_0x6235('0x15')](_0x48e3a7)['json'](_0x35156f);}};}function respondWithFilteredResult(_0x1cfd0b,_0x1f1c54){return function(_0x3f619b){if(_0x3f619b){var _0x3f32af=typeof _0x1f1c54['offset']===_0x6235('0x16')&&typeof _0x1f1c54[_0x6235('0x17')]===_0x6235('0x16');var _0x2e5a84=_0x3f619b[_0x6235('0x18')];var _0x2a3554=_0x3f32af?0x0:_0x1f1c54[_0x6235('0x19')];var _0x22f090=_0x3f32af?_0x3f619b[_0x6235('0x18')]:_0x1f1c54[_0x6235('0x19')]+_0x1f1c54['limit'];var _0x35103a;if(_0x22f090>=_0x2e5a84){_0x22f090=_0x2e5a84;_0x35103a=0xc8;}else{_0x35103a=0xce;}_0x1cfd0b[_0x6235('0x15')](_0x35103a);return _0x1cfd0b['set']('Content-Range',_0x2a3554+'-'+_0x22f090+'/'+_0x2e5a84)[_0x6235('0x1a')](_0x3f619b);}return null;};}function patchUpdates(_0x4f0aa2){return function(_0x5d3872){try{jsonpatch['apply'](_0x5d3872,_0x4f0aa2,!![]);}catch(_0x367207){return BPromise[_0x6235('0x1b')](_0x367207);}return _0x5d3872[_0x6235('0x1c')]();};}function saveUpdates(_0x1c60c7,_0x24c057){return function(_0x270c49){if(_0x270c49){return _0x270c49['update'](_0x1c60c7)['then'](function(_0x4663b3){return _0x4663b3;});}return null;};}function removeEntity(_0x5ac43d,_0x2189d0){return function(_0x1bed65){if(_0x1bed65){return _0x1bed65[_0x6235('0x1d')]()[_0x6235('0x1e')](function(){_0x5ac43d[_0x6235('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e3d90,_0x1da380){return function(_0x168b01){if(!_0x168b01){_0x1e3d90[_0x6235('0x14')](0x194);}return _0x168b01;};}function handleError(_0x3eac45,_0x5a58d9){_0x5a58d9=_0x5a58d9||0x1f4;return function(_0x4b44f8){logger['error'](_0x4b44f8['stack']);if(_0x4b44f8[_0x6235('0x1f')]){delete _0x4b44f8[_0x6235('0x1f')];}_0x3eac45[_0x6235('0x15')](_0x5a58d9)[_0x6235('0x20')](_0x4b44f8);};}exports[_0x6235('0x21')]=function(_0x2acc8c,_0x59bb16){var _0x47e86b={},_0x5dc066={},_0x94db3c={'count':0x0,'rows':[]};var _0x50ea93=_[_0x6235('0x22')](db[_0x6235('0x23')]['rawAttributes'],function(_0x37580b){return{'name':_0x37580b[_0x6235('0x24')],'type':_0x37580b['type'][_0x6235('0x25')]};});_0x5dc066[_0x6235('0x26')]=_[_0x6235('0x22')](_0x50ea93,_0x6235('0x1f'));_0x5dc066[_0x6235('0x27')]=_[_0x6235('0x28')](_0x2acc8c[_0x6235('0x27')]);_0x5dc066[_0x6235('0x29')]=_[_0x6235('0x2a')](_0x5dc066[_0x6235('0x26')],_0x5dc066['query']);_0x47e86b[_0x6235('0x2b')]=_['intersection'](_0x5dc066['model'],qs[_0x6235('0x2c')](_0x2acc8c['query']['fields']));_0x47e86b[_0x6235('0x2b')]=_0x47e86b['attributes']['length']?_0x47e86b[_0x6235('0x2b')]:_0x5dc066[_0x6235('0x26')];if(!_0x2acc8c[_0x6235('0x27')]['hasOwnProperty'](_0x6235('0x2d'))){_0x47e86b[_0x6235('0x17')]=qs[_0x6235('0x17')](_0x2acc8c['query'][_0x6235('0x17')]);_0x47e86b['offset']=qs[_0x6235('0x19')](_0x2acc8c[_0x6235('0x27')][_0x6235('0x19')]);}_0x47e86b[_0x6235('0x2e')]=qs[_0x6235('0x2f')](_0x2acc8c['query'][_0x6235('0x2f')]);_0x47e86b['where']=qs[_0x6235('0x29')](_[_0x6235('0x30')](_0x2acc8c[_0x6235('0x27')],_0x5dc066[_0x6235('0x29')]),_0x50ea93);if(_0x2acc8c[_0x6235('0x27')]['filter']){_0x47e86b['where']=_[_0x6235('0x31')](_0x47e86b[_0x6235('0x32')],{'$or':_[_0x6235('0x22')](_0x50ea93,function(_0x41cdc2){if(_0x41cdc2[_0x6235('0x33')]!==_0x6235('0x34')){var _0xe277d0={};_0xe277d0[_0x41cdc2[_0x6235('0x1f')]]={'$like':'%'+_0x2acc8c[_0x6235('0x27')][_0x6235('0x35')]+'%'};return _0xe277d0;}})});}_0x47e86b=_['merge']({},_0x47e86b,_0x2acc8c['options']);var _0x4d1cac={'where':_0x47e86b['where']};return db['FaxQueueReport'][_0x6235('0x18')](_0x4d1cac)[_0x6235('0x1e')](function(_0x290da6){_0x94db3c['count']=_0x290da6;if(_0x2acc8c[_0x6235('0x27')]['includeAll']){_0x47e86b[_0x6235('0x36')]=[{'all':!![]}];}return db[_0x6235('0x23')][_0x6235('0x37')](_0x47e86b);})[_0x6235('0x1e')](function(_0x36abb1){_0x94db3c[_0x6235('0x38')]=_0x36abb1;return _0x94db3c;})[_0x6235('0x1e')](respondWithFilteredResult(_0x59bb16,_0x47e86b))[_0x6235('0x39')](handleError(_0x59bb16,null));};exports['show']=function(_0x565c9f,_0x341fdc){var _0x54cbb1={'raw':!![],'where':{'id':_0x565c9f[_0x6235('0x3a')]['id']}},_0x173c62={};_0x173c62[_0x6235('0x26')]=_[_0x6235('0x28')](db[_0x6235('0x23')][_0x6235('0x3b')]);_0x173c62[_0x6235('0x27')]=_['keys'](_0x565c9f[_0x6235('0x27')]);_0x173c62[_0x6235('0x29')]=_[_0x6235('0x2a')](_0x173c62['model'],_0x173c62[_0x6235('0x27')]);_0x54cbb1[_0x6235('0x2b')]=_[_0x6235('0x2a')](_0x173c62[_0x6235('0x26')],qs[_0x6235('0x2c')](_0x565c9f[_0x6235('0x27')][_0x6235('0x2c')]));_0x54cbb1[_0x6235('0x2b')]=_0x54cbb1['attributes'][_0x6235('0x3c')]?_0x54cbb1[_0x6235('0x2b')]:_0x173c62[_0x6235('0x26')];if(_0x565c9f['query'][_0x6235('0x3d')]){_0x54cbb1[_0x6235('0x36')]=[{'all':!![]}];}_0x54cbb1=_[_0x6235('0x31')]({},_0x54cbb1,_0x565c9f[_0x6235('0x3e')]);return db[_0x6235('0x23')][_0x6235('0x3f')](_0x54cbb1)[_0x6235('0x1e')](handleEntityNotFound(_0x341fdc,null))[_0x6235('0x1e')](respondWithResult(_0x341fdc,null))[_0x6235('0x39')](handleError(_0x341fdc,null));};exports['create']=function(_0x148a78,_0x4f30c4){return db[_0x6235('0x23')][_0x6235('0x40')](_0x148a78[_0x6235('0x41')],{})['then'](respondWithResult(_0x4f30c4,0xc9))['catch'](handleError(_0x4f30c4,null));};exports[_0x6235('0x42')]=function(_0x433263,_0x4468d4){if(_0x433263[_0x6235('0x41')]['id']){delete _0x433263['body']['id'];}return db[_0x6235('0x23')][_0x6235('0x3f')]({'where':{'id':_0x433263['params']['id']}})[_0x6235('0x1e')](handleEntityNotFound(_0x4468d4,null))['then'](saveUpdates(_0x433263[_0x6235('0x41')],null))[_0x6235('0x1e')](respondWithResult(_0x4468d4,null))[_0x6235('0x39')](handleError(_0x4468d4,null));};exports['destroy']=function(_0x2aa5f9,_0x5bff03){return db['FaxQueueReport']['find']({'where':{'id':_0x2aa5f9[_0x6235('0x3a')]['id']}})[_0x6235('0x1e')](handleEntityNotFound(_0x5bff03,null))[_0x6235('0x1e')](removeEntity(_0x5bff03,null))[_0x6235('0x39')](handleError(_0x5bff03,null));};exports[_0x6235('0x43')]=function(_0xfc23f0,_0x392d60){return db['FaxQueueReport'][_0x6235('0x43')]()[_0x6235('0x1e')](respondWithResult(_0x392d60,null))[_0x6235('0x39')](handleError(_0x392d60,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c850641..cdb6ad4 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0xe1a1ab,_0x536c2f){var _0x14fcde=function(_0xf23632){while(--_0xf23632){_0xe1a1ab['push'](_0xe1a1ab['shift']());}};_0x14fcde(++_0x536c2f);}(_0x326f,0xd1));var _0xf326=function(_0x3df245,_0x4c1c6f){_0x3df245=_0x3df245-0x0;var _0xd237cb=_0x326f[_0x3df245];return _0xd237cb;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x50d0af,_0x1f0541){var _0x3bbe9c=function(_0x10bccd){while(--_0x10bccd){_0x50d0af['push'](_0x50d0af['shift']());}};_0x3bbe9c(++_0x1f0541);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc4aa[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index ae1e807..a1cf06f 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 _0xba03=['limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','debug','stringify','UpdateFaxQueueReport','raw','where','attributes'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xba03,0x9c));var _0x3ba0=function(_0x30e553,_0x464327){_0x30e553=_0x30e553-0x0;var _0x4ce3ef=_0xba03[_0x30e553];return _0x4ce3ef;};'use strict';var _=require(_0x3ba0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3ba0('0x1'));var rs=require(_0x3ba0('0x2'));var fs=require('fs');var Redis=require(_0x3ba0('0x3'));var db=require(_0x3ba0('0x4'))['db'];var utils=require(_0x3ba0('0x5'));var logger=require('../../config/logger')(_0x3ba0('0x6'));var config=require(_0x3ba0('0x7'));var jayson=require(_0x3ba0('0x8'));var client=jayson['client'][_0x3ba0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x133efe,_0x1c4fb5,_0x34d55f){return new BPromise(function(_0x54cb2e,_0x4f7161){return client['request'](_0x133efe,_0x34d55f)[_0x3ba0('0xa')](function(_0x22ff4b){logger[_0x3ba0('0xb')](_0x3ba0('0xc'),_0x1c4fb5,_0x3ba0('0xd'));logger['debug'](_0x3ba0('0xe'),_0x1c4fb5,'request\x20sent',JSON['stringify'](_0x22ff4b));if(_0x22ff4b[_0x3ba0('0xf')]){if(_0x22ff4b[_0x3ba0('0xf')][_0x3ba0('0x10')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x1c4fb5,_0x22ff4b[_0x3ba0('0xf')][_0x3ba0('0x11')]);return _0x4f7161(_0x22ff4b[_0x3ba0('0xf')][_0x3ba0('0x11')]);}logger[_0x3ba0('0xf')](_0x3ba0('0xc'),_0x1c4fb5,_0x22ff4b[_0x3ba0('0xf')][_0x3ba0('0x11')]);return _0x54cb2e(_0x22ff4b[_0x3ba0('0xf')][_0x3ba0('0x11')]);}else{logger[_0x3ba0('0xb')](_0x3ba0('0xc'),_0x1c4fb5,_0x3ba0('0xd'));_0x54cb2e(_0x22ff4b[_0x3ba0('0x12')]['message']);}})[_0x3ba0('0x13')](function(_0x2cbf3a){logger[_0x3ba0('0xf')](_0x3ba0('0xc'),_0x1c4fb5,_0x2cbf3a);_0x4f7161(_0x2cbf3a);});});}exports[_0x3ba0('0x14')]=function(_0xb8f86){var _0x5590ab=this;return new Promise(function(_0x5c0469,_0x538bcc){return db[_0x3ba0('0x15')]['create'](_0xb8f86[_0x3ba0('0x16')],{'raw':_0xb8f86['options']?_0xb8f86[_0x3ba0('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x3ba0('0xa')](function(_0x288f8e){logger[_0x3ba0('0xb')](_0x3ba0('0x14'),_0xb8f86);logger[_0x3ba0('0x18')](_0x3ba0('0x14'),_0xb8f86,JSON[_0x3ba0('0x19')](_0x288f8e));_0x5c0469(_0x288f8e);})[_0x3ba0('0x13')](function(_0x56085b){logger['error'](_0x3ba0('0x14'),_0x56085b[_0x3ba0('0x11')],_0xb8f86);_0x538bcc(_0x5590ab[_0x3ba0('0xf')](0x1f4,_0x56085b['message']));});});};exports[_0x3ba0('0x1a')]=function(_0x450f84){var _0x1f3c40=this;return new Promise(function(_0x37bc56,_0x1a7280){return db[_0x3ba0('0x15')]['update'](_0x450f84['body'],{'raw':_0x450f84['options']?_0x450f84[_0x3ba0('0x17')][_0x3ba0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x450f84[_0x3ba0('0x17')]?_0x450f84['options'][_0x3ba0('0x1c')]||null:null,'attributes':_0x450f84[_0x3ba0('0x17')]?_0x450f84[_0x3ba0('0x17')][_0x3ba0('0x1d')]||null:null,'limit':_0x450f84[_0x3ba0('0x17')]?_0x450f84['options'][_0x3ba0('0x1e')]||null:null})['then'](function(_0x20ef51){logger[_0x3ba0('0xb')](_0x3ba0('0x1a'),_0x450f84);logger[_0x3ba0('0x18')](_0x3ba0('0x1a'),_0x450f84,JSON[_0x3ba0('0x19')](_0x20ef51));_0x37bc56(_0x20ef51);})[_0x3ba0('0x13')](function(_0x281614){logger[_0x3ba0('0xf')](_0x3ba0('0x1a'),_0x281614[_0x3ba0('0x11')],_0x450f84);_0x1a7280(_0x1f3c40['error'](0x1f4,_0x281614[_0x3ba0('0x11')]));});});}; \ No newline at end of file +var _0x34aa=['jayson/promise','client','http','request','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','body','options','raw','UpdateFaxQueueReport','where','attributes','limit','then','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0xfad11,_0x747aab){var _0x4f4298=function(_0x35e5cd){while(--_0x35e5cd){_0xfad11['push'](_0xfad11['shift']());}};_0x4f4298(++_0x747aab);}(_0x34aa,0x1ab));var _0xa34a=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0x34aa[_0x529abc];return _0x453afa;};'use strict';var _=require(_0xa34a('0x0'));var util=require('util');var moment=require(_0xa34a('0x1'));var BPromise=require(_0xa34a('0x2'));var rs=require(_0xa34a('0x3'));var fs=require('fs');var Redis=require(_0xa34a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa34a('0x5'))(_0xa34a('0x6'));var config=require('../../config/environment');var jayson=require(_0xa34a('0x7'));var client=jayson[_0xa34a('0x8')][_0xa34a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44cc9d,_0xace4f5,_0x449904){return new BPromise(function(_0x383eb5,_0x1e1ff9){return client[_0xa34a('0xa')](_0x44cc9d,_0x449904)['then'](function(_0xe2989c){logger['info'](_0xa34a('0xb'),_0xace4f5,_0xa34a('0xc'));logger[_0xa34a('0xd')](_0xa34a('0xe'),_0xace4f5,_0xa34a('0xc'),JSON[_0xa34a('0xf')](_0xe2989c));if(_0xe2989c[_0xa34a('0x10')]){if(_0xe2989c[_0xa34a('0x10')][_0xa34a('0x11')]===0x1f4){logger[_0xa34a('0x10')](_0xa34a('0xb'),_0xace4f5,_0xe2989c[_0xa34a('0x10')][_0xa34a('0x12')]);return _0x1e1ff9(_0xe2989c['error'][_0xa34a('0x12')]);}logger['error'](_0xa34a('0xb'),_0xace4f5,_0xe2989c[_0xa34a('0x10')][_0xa34a('0x12')]);return _0x383eb5(_0xe2989c[_0xa34a('0x10')][_0xa34a('0x12')]);}else{logger['info'](_0xa34a('0xb'),_0xace4f5,'request\x20sent');_0x383eb5(_0xe2989c[_0xa34a('0x13')]['message']);}})['catch'](function(_0x5e3512){logger['error'](_0xa34a('0xb'),_0xace4f5,_0x5e3512);_0x1e1ff9(_0x5e3512);});});}exports[_0xa34a('0x14')]=function(_0x576a0b){var _0x25b686=this;return new Promise(function(_0xc9a879,_0x361c8b){return db[_0xa34a('0x15')]['create'](_0x576a0b[_0xa34a('0x16')],{'raw':_0x576a0b[_0xa34a('0x17')]?_0x576a0b[_0xa34a('0x17')][_0xa34a('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x244232){logger['info'](_0xa34a('0x14'),_0x576a0b);logger[_0xa34a('0xd')](_0xa34a('0x14'),_0x576a0b,JSON[_0xa34a('0xf')](_0x244232));_0xc9a879(_0x244232);})['catch'](function(_0x20ef93){logger['error'](_0xa34a('0x14'),_0x20ef93['message'],_0x576a0b);_0x361c8b(_0x25b686[_0xa34a('0x10')](0x1f4,_0x20ef93['message']));});});};exports[_0xa34a('0x19')]=function(_0x1b7ae9){var _0x1bedaf=this;return new Promise(function(_0x20529,_0x54d0a0){return db[_0xa34a('0x15')]['update'](_0x1b7ae9[_0xa34a('0x16')],{'raw':_0x1b7ae9['options']?_0x1b7ae9[_0xa34a('0x17')][_0xa34a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7ae9['options']?_0x1b7ae9[_0xa34a('0x17')][_0xa34a('0x1a')]||null:null,'attributes':_0x1b7ae9[_0xa34a('0x17')]?_0x1b7ae9[_0xa34a('0x17')][_0xa34a('0x1b')]||null:null,'limit':_0x1b7ae9[_0xa34a('0x17')]?_0x1b7ae9[_0xa34a('0x17')][_0xa34a('0x1c')]||null:null})[_0xa34a('0x1d')](function(_0x3fb664){logger['info'](_0xa34a('0x19'),_0x1b7ae9);logger[_0xa34a('0xd')](_0xa34a('0x19'),_0x1b7ae9,JSON['stringify'](_0x3fb664));_0x20529(_0x3fb664);})[_0xa34a('0x1e')](function(_0x452e8a){logger['error'](_0xa34a('0x19'),_0x452e8a[_0xa34a('0x12')],_0x1b7ae9);_0x54d0a0(_0x1bedaf[_0xa34a('0x10')](0x1f4,_0x452e8a[_0xa34a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index bb89987..36a81f1 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 _0xd0e3=['post','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','/describe','get','/:id','show'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd0e3,0x1e0));var _0x3d0e=function(_0x31b2c5,_0x20eda5){_0x31b2c5=_0x31b2c5-0x0;var _0x477c8c=_0xd0e3[_0x31b2c5];return _0x477c8c;};'use strict';var multer=require(_0x3d0e('0x0'));var util=require(_0x3d0e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3d0e('0x2'));var router=express[_0x3d0e('0x3')]();var fs_extra=require(_0x3d0e('0x4'));var auth=require(_0x3d0e('0x5'));var interaction=require(_0x3d0e('0x6'));var config=require(_0x3d0e('0x7'));var controller=require(_0x3d0e('0x8'));router['get']('/',auth[_0x3d0e('0x9')](),controller['index']);router['get'](_0x3d0e('0xa'),auth[_0x3d0e('0x9')](),controller['describe']);router[_0x3d0e('0xb')](_0x3d0e('0xc'),auth[_0x3d0e('0x9')](),controller[_0x3d0e('0xd')]);router[_0x3d0e('0xe')]('/',auth[_0x3d0e('0x9')](),controller['create']);router[_0x3d0e('0xf')](_0x3d0e('0xc'),auth[_0x3d0e('0x9')](),controller['update']);router[_0x3d0e('0x10')](_0x3d0e('0xc'),auth['isAuthenticated'](),controller[_0x3d0e('0x11')]);module[_0x3d0e('0x12')]=router; \ No newline at end of file +var _0x8ff6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x59b2c9,_0x2c4e19){var _0x2b05b9=function(_0xf46e03){while(--_0xf46e03){_0x59b2c9['push'](_0x59b2c9['shift']());}};_0x2b05b9(++_0x2c4e19);}(_0x8ff6,0xc2));var _0x68ff=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x8ff6[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require(_0x68ff('0x0'));var util=require(_0x68ff('0x1'));var path=require(_0x68ff('0x2'));var timeout=require(_0x68ff('0x3'));var express=require('express');var router=express[_0x68ff('0x4')]();var fs_extra=require(_0x68ff('0x5'));var auth=require(_0x68ff('0x6'));var interaction=require(_0x68ff('0x7'));var config=require(_0x68ff('0x8'));var controller=require(_0x68ff('0x9'));router[_0x68ff('0xa')]('/',auth['isAuthenticated'](),controller[_0x68ff('0xb')]);router[_0x68ff('0xa')](_0x68ff('0xc'),auth[_0x68ff('0xd')](),controller[_0x68ff('0xe')]);router[_0x68ff('0xa')]('/:id',auth[_0x68ff('0xd')](),controller['show']);router[_0x68ff('0xf')]('/',auth[_0x68ff('0xd')](),controller['create']);router[_0x68ff('0x10')](_0x68ff('0x11'),auth[_0x68ff('0xd')](),controller[_0x68ff('0x12')]);router[_0x68ff('0x13')](_0x68ff('0x11'),auth[_0x68ff('0xd')](),controller[_0x68ff('0x14')]);module[_0x68ff('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 0802510..8245182 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0xb23e8a,_0x34ef81){var _0xc9b754=function(_0x53f85f){while(--_0x53f85f){_0xb23e8a['push'](_0xb23e8a['shift']());}};_0xc9b754(++_0x34ef81);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xf3cd[_0x3a6efd];return _0x487b9a;};'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 +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x73d817,_0x54eed1){var _0x178cf8=function(_0x3cdf24){while(--_0x3cdf24){_0x73d817['push'](_0x73d817['shift']());}};_0x178cf8(++_0x54eed1);}(_0x008c,0x188));var _0xc008=function(_0x1ab683,_0x27030b){_0x1ab683=_0x1ab683-0x0;var _0x357546=_0x008c[_0x1ab683];return _0x357546;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 390f343..5957f87 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 _0xc12c=['body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','FaxTransferReport','create'];(function(_0x52ab5b,_0x54a4b7){var _0x29108a=function(_0x661272){while(--_0x661272){_0x52ab5b['push'](_0x52ab5b['shift']());}};_0x29108a(++_0x54a4b7);}(_0xc12c,0xdc));var _0xcc12=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xc12c[_0x45e98e];return _0x374dba;};'use strict';var emlformat=require(_0xcc12('0x0'));var rimraf=require(_0xcc12('0x1'));var zipdir=require(_0xcc12('0x2'));var jsonpatch=require(_0xcc12('0x3'));var rp=require(_0xcc12('0x4'));var moment=require(_0xcc12('0x5'));var BPromise=require(_0xcc12('0x6'));var Mustache=require(_0xcc12('0x7'));var util=require(_0xcc12('0x8'));var path=require(_0xcc12('0x9'));var sox=require('sox');var csv=require(_0xcc12('0xa'));var ejs=require(_0xcc12('0xb'));var fs=require('fs');var fs_extra=require(_0xcc12('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcc12('0xd'));var jsforce=require(_0xcc12('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcc12('0xa'));var querystring=require('querystring');var Papa=require(_0xcc12('0xf'));var Redis=require(_0xcc12('0x10'));var authService=require(_0xcc12('0x11'));var qs=require(_0xcc12('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc12('0x13'))(_0xcc12('0x14'));var utils=require(_0xcc12('0x15'));var config=require(_0xcc12('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19519b,_0x4a0b2f){_0x4a0b2f=_0x4a0b2f||0xcc;return function(_0x6a8270){if(_0x6a8270){return _0x19519b['sendStatus'](_0x4a0b2f);}return _0x19519b[_0xcc12('0x17')](_0x4a0b2f)['end']();};}function respondWithResult(_0x56918e,_0x5788b8){_0x5788b8=_0x5788b8||0xc8;return function(_0x247b0e){if(_0x247b0e){return _0x56918e['status'](_0x5788b8)[_0xcc12('0x18')](_0x247b0e);}};}function respondWithFilteredResult(_0x137fdf,_0x359c62){return function(_0x5f30e6){if(_0x5f30e6){var _0x39a064=typeof _0x359c62[_0xcc12('0x19')]===_0xcc12('0x1a')&&typeof _0x359c62[_0xcc12('0x1b')]===_0xcc12('0x1a');var _0x22cbdb=_0x5f30e6[_0xcc12('0x1c')];var _0x5497bb=_0x39a064?0x0:_0x359c62['offset'];var _0x451b80=_0x39a064?_0x5f30e6['count']:_0x359c62[_0xcc12('0x19')]+_0x359c62[_0xcc12('0x1b')];var _0x16aa85;if(_0x451b80>=_0x22cbdb){_0x451b80=_0x22cbdb;_0x16aa85=0xc8;}else{_0x16aa85=0xce;}_0x137fdf['status'](_0x16aa85);return _0x137fdf[_0xcc12('0x1d')](_0xcc12('0x1e'),_0x5497bb+'-'+_0x451b80+'/'+_0x22cbdb)[_0xcc12('0x18')](_0x5f30e6);}return null;};}function patchUpdates(_0x3715c8){return function(_0x546013){try{jsonpatch[_0xcc12('0x1f')](_0x546013,_0x3715c8,!![]);}catch(_0x339ed5){return BPromise[_0xcc12('0x20')](_0x339ed5);}return _0x546013[_0xcc12('0x21')]();};}function saveUpdates(_0x18d1e8,_0x15a3ab){return function(_0x4efd59){if(_0x4efd59){return _0x4efd59[_0xcc12('0x22')](_0x18d1e8)[_0xcc12('0x23')](function(_0x980072){return _0x980072;});}return null;};}function removeEntity(_0x22111e,_0x4ec52c){return function(_0x77b96b){if(_0x77b96b){return _0x77b96b[_0xcc12('0x24')]()['then'](function(){_0x22111e[_0xcc12('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c25c0,_0x292986){return function(_0x137690){if(!_0x137690){_0x3c25c0['sendStatus'](0x194);}return _0x137690;};}function handleError(_0x2b979b,_0x10c162){_0x10c162=_0x10c162||0x1f4;return function(_0x244e28){logger[_0xcc12('0x25')](_0x244e28[_0xcc12('0x26')]);if(_0x244e28[_0xcc12('0x27')]){delete _0x244e28['name'];}_0x2b979b[_0xcc12('0x17')](_0x10c162)[_0xcc12('0x28')](_0x244e28);};}exports['index']=function(_0x475975,_0x56f2b8){var _0x48453a={},_0xc578c0={},_0x35cf43={'count':0x0,'rows':[]};var _0x1983fb=_[_0xcc12('0x29')](db['FaxTransferReport'][_0xcc12('0x2a')],function(_0x271f02){return{'name':_0x271f02['fieldName'],'type':_0x271f02['type'][_0xcc12('0x2b')]};});_0xc578c0[_0xcc12('0x2c')]=_[_0xcc12('0x29')](_0x1983fb,'name');_0xc578c0[_0xcc12('0x2d')]=_[_0xcc12('0x2e')](_0x475975[_0xcc12('0x2d')]);_0xc578c0[_0xcc12('0x2f')]=_['intersection'](_0xc578c0[_0xcc12('0x2c')],_0xc578c0['query']);_0x48453a[_0xcc12('0x30')]=_[_0xcc12('0x31')](_0xc578c0['model'],qs[_0xcc12('0x32')](_0x475975[_0xcc12('0x2d')][_0xcc12('0x32')]));_0x48453a['attributes']=_0x48453a[_0xcc12('0x30')][_0xcc12('0x33')]?_0x48453a[_0xcc12('0x30')]:_0xc578c0[_0xcc12('0x2c')];if(!_0x475975[_0xcc12('0x2d')][_0xcc12('0x34')](_0xcc12('0x35'))){_0x48453a[_0xcc12('0x1b')]=qs[_0xcc12('0x1b')](_0x475975[_0xcc12('0x2d')][_0xcc12('0x1b')]);_0x48453a[_0xcc12('0x19')]=qs[_0xcc12('0x19')](_0x475975['query'][_0xcc12('0x19')]);}_0x48453a['order']=qs[_0xcc12('0x36')](_0x475975[_0xcc12('0x2d')][_0xcc12('0x36')]);_0x48453a[_0xcc12('0x37')]=qs[_0xcc12('0x2f')](_[_0xcc12('0x38')](_0x475975[_0xcc12('0x2d')],_0xc578c0['filters']),_0x1983fb);if(_0x475975[_0xcc12('0x2d')][_0xcc12('0x39')]){_0x48453a['where']=_[_0xcc12('0x3a')](_0x48453a[_0xcc12('0x37')],{'$or':_[_0xcc12('0x29')](_0x1983fb,function(_0x56fb92){if(_0x56fb92['type']!==_0xcc12('0x3b')){var _0x48e927={};_0x48e927[_0x56fb92[_0xcc12('0x27')]]={'$like':'%'+_0x475975['query'][_0xcc12('0x39')]+'%'};return _0x48e927;}})});}_0x48453a=_[_0xcc12('0x3a')]({},_0x48453a,_0x475975[_0xcc12('0x3c')]);var _0x1f94d0={'where':_0x48453a[_0xcc12('0x37')]};return db['FaxTransferReport'][_0xcc12('0x1c')](_0x1f94d0)[_0xcc12('0x23')](function(_0x3f5a76){_0x35cf43[_0xcc12('0x1c')]=_0x3f5a76;if(_0x475975[_0xcc12('0x2d')][_0xcc12('0x3d')]){_0x48453a[_0xcc12('0x3e')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xcc12('0x3f')](_0x48453a);})[_0xcc12('0x23')](function(_0x566e53){_0x35cf43['rows']=_0x566e53;return _0x35cf43;})[_0xcc12('0x23')](respondWithFilteredResult(_0x56f2b8,_0x48453a))[_0xcc12('0x40')](handleError(_0x56f2b8,null));};exports[_0xcc12('0x41')]=function(_0x329d40,_0xb4ec04){var _0x2ed80b={'raw':!![],'where':{'id':_0x329d40['params']['id']}},_0x5ccd59={};_0x5ccd59[_0xcc12('0x2c')]=_[_0xcc12('0x2e')](db[_0xcc12('0x42')][_0xcc12('0x2a')]);_0x5ccd59[_0xcc12('0x2d')]=_[_0xcc12('0x2e')](_0x329d40[_0xcc12('0x2d')]);_0x5ccd59[_0xcc12('0x2f')]=_['intersection'](_0x5ccd59[_0xcc12('0x2c')],_0x5ccd59[_0xcc12('0x2d')]);_0x2ed80b[_0xcc12('0x30')]=_[_0xcc12('0x31')](_0x5ccd59[_0xcc12('0x2c')],qs['fields'](_0x329d40[_0xcc12('0x2d')][_0xcc12('0x32')]));_0x2ed80b['attributes']=_0x2ed80b[_0xcc12('0x30')][_0xcc12('0x33')]?_0x2ed80b['attributes']:_0x5ccd59['model'];if(_0x329d40[_0xcc12('0x2d')]['includeAll']){_0x2ed80b[_0xcc12('0x3e')]=[{'all':!![]}];}_0x2ed80b=_[_0xcc12('0x3a')]({},_0x2ed80b,_0x329d40[_0xcc12('0x3c')]);return db[_0xcc12('0x42')]['find'](_0x2ed80b)[_0xcc12('0x23')](handleEntityNotFound(_0xb4ec04,null))[_0xcc12('0x23')](respondWithResult(_0xb4ec04,null))[_0xcc12('0x40')](handleError(_0xb4ec04,null));};exports['create']=function(_0x21ce0a,_0xd271f0){return db[_0xcc12('0x42')][_0xcc12('0x43')](_0x21ce0a['body'],{})[_0xcc12('0x23')](respondWithResult(_0xd271f0,0xc9))[_0xcc12('0x40')](handleError(_0xd271f0,null));};exports[_0xcc12('0x22')]=function(_0x5cad44,_0x2b5b25){if(_0x5cad44[_0xcc12('0x44')]['id']){delete _0x5cad44[_0xcc12('0x44')]['id'];}return db['FaxTransferReport'][_0xcc12('0x45')]({'where':{'id':_0x5cad44[_0xcc12('0x46')]['id']}})['then'](handleEntityNotFound(_0x2b5b25,null))[_0xcc12('0x23')](saveUpdates(_0x5cad44[_0xcc12('0x44')],null))[_0xcc12('0x23')](respondWithResult(_0x2b5b25,null))[_0xcc12('0x40')](handleError(_0x2b5b25,null));};exports['destroy']=function(_0x46a0b6,_0x209ced){return db[_0xcc12('0x42')]['find']({'where':{'id':_0x46a0b6['params']['id']}})[_0xcc12('0x23')](handleEntityNotFound(_0x209ced,null))[_0xcc12('0x23')](removeEntity(_0x209ced,null))[_0xcc12('0x40')](handleError(_0x209ced,null));};exports['describe']=function(_0x3a80d6,_0x5bf7a1){return db['FaxTransferReport'][_0xcc12('0x47')]()[_0xcc12('0x23')](respondWithResult(_0x5bf7a1,null))['catch'](handleError(_0x5bf7a1,null));}; \ No newline at end of file +var _0xd8c2=['sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','name','map','FaxTransferReport','rawAttributes','type','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x23dca5,_0x14a402){var _0x14dc71=function(_0x1573ba){while(--_0x1573ba){_0x23dca5['push'](_0x23dca5['shift']());}};_0x14dc71(++_0x14a402);}(_0xd8c2,0x11e));var _0x2d8c=function(_0x107036,_0xda36){_0x107036=_0x107036-0x0;var _0x139862=_0xd8c2[_0x107036];return _0x139862;};'use strict';var emlformat=require(_0x2d8c('0x0'));var rimraf=require(_0x2d8c('0x1'));var zipdir=require(_0x2d8c('0x2'));var jsonpatch=require(_0x2d8c('0x3'));var rp=require(_0x2d8c('0x4'));var moment=require(_0x2d8c('0x5'));var BPromise=require(_0x2d8c('0x6'));var Mustache=require(_0x2d8c('0x7'));var util=require(_0x2d8c('0x8'));var path=require(_0x2d8c('0x9'));var sox=require(_0x2d8c('0xa'));var csv=require(_0x2d8c('0xb'));var ejs=require(_0x2d8c('0xc'));var fs=require('fs');var fs_extra=require(_0x2d8c('0xd'));var _=require(_0x2d8c('0xe'));var squel=require(_0x2d8c('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2d8c('0xb'));var querystring=require('querystring');var Papa=require(_0x2d8c('0x10'));var Redis=require(_0x2d8c('0x11'));var authService=require(_0x2d8c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2d8c('0x13'));var hardwareService=require(_0x2d8c('0x14'));var logger=require(_0x2d8c('0x15'))(_0x2d8c('0x16'));var utils=require(_0x2d8c('0x17'));var config=require(_0x2d8c('0x18'));var licenseUtil=require(_0x2d8c('0x19'));var db=require(_0x2d8c('0x1a'))['db'];function respondWithStatusCode(_0x5f56b8,_0xea77ad){_0xea77ad=_0xea77ad||0xcc;return function(_0x279142){if(_0x279142){return _0x5f56b8[_0x2d8c('0x1b')](_0xea77ad);}return _0x5f56b8['status'](_0xea77ad)[_0x2d8c('0x1c')]();};}function respondWithResult(_0x764198,_0x53299d){_0x53299d=_0x53299d||0xc8;return function(_0x1ffc05){if(_0x1ffc05){return _0x764198[_0x2d8c('0x1d')](_0x53299d)[_0x2d8c('0x1e')](_0x1ffc05);}};}function respondWithFilteredResult(_0x1b29c6,_0x2e6f1b){return function(_0x2c616a){if(_0x2c616a){var _0x16eaa4=typeof _0x2e6f1b['offset']===_0x2d8c('0x1f')&&typeof _0x2e6f1b[_0x2d8c('0x20')]===_0x2d8c('0x1f');var _0x66806b=_0x2c616a['count'];var _0x47831c=_0x16eaa4?0x0:_0x2e6f1b['offset'];var _0x5d591b=_0x16eaa4?_0x2c616a[_0x2d8c('0x21')]:_0x2e6f1b[_0x2d8c('0x22')]+_0x2e6f1b[_0x2d8c('0x20')];var _0x23bb0e;if(_0x5d591b>=_0x66806b){_0x5d591b=_0x66806b;_0x23bb0e=0xc8;}else{_0x23bb0e=0xce;}_0x1b29c6['status'](_0x23bb0e);return _0x1b29c6[_0x2d8c('0x23')]('Content-Range',_0x47831c+'-'+_0x5d591b+'/'+_0x66806b)[_0x2d8c('0x1e')](_0x2c616a);}return null;};}function patchUpdates(_0x12a813){return function(_0x137861){try{jsonpatch[_0x2d8c('0x24')](_0x137861,_0x12a813,!![]);}catch(_0x3961ef){return BPromise[_0x2d8c('0x25')](_0x3961ef);}return _0x137861[_0x2d8c('0x26')]();};}function saveUpdates(_0x5d33d7,_0x314a23){return function(_0x28591c){if(_0x28591c){return _0x28591c[_0x2d8c('0x27')](_0x5d33d7)[_0x2d8c('0x28')](function(_0x44f1d5){return _0x44f1d5;});}return null;};}function removeEntity(_0xb9d52a,_0x51179b){return function(_0xbfdd5f){if(_0xbfdd5f){return _0xbfdd5f[_0x2d8c('0x29')]()[_0x2d8c('0x28')](function(){_0xb9d52a[_0x2d8c('0x1d')](0xcc)[_0x2d8c('0x1c')]();});}};}function handleEntityNotFound(_0x570e3f,_0x53909d){return function(_0x4c382c){if(!_0x4c382c){_0x570e3f[_0x2d8c('0x1b')](0x194);}return _0x4c382c;};}function handleError(_0x21031d,_0x5500b7){_0x5500b7=_0x5500b7||0x1f4;return function(_0x6a146d){logger['error'](_0x6a146d['stack']);if(_0x6a146d[_0x2d8c('0x2a')]){delete _0x6a146d[_0x2d8c('0x2a')];}_0x21031d['status'](_0x5500b7)['send'](_0x6a146d);};}exports['index']=function(_0x57e044,_0x4fa686){var _0xb88b91={},_0x232c36={},_0x75175a={'count':0x0,'rows':[]};var _0x442ccc=_[_0x2d8c('0x2b')](db[_0x2d8c('0x2c')][_0x2d8c('0x2d')],function(_0x40c871){return{'name':_0x40c871['fieldName'],'type':_0x40c871[_0x2d8c('0x2e')][_0x2d8c('0x2f')]};});_0x232c36['model']=_[_0x2d8c('0x2b')](_0x442ccc,_0x2d8c('0x2a'));_0x232c36[_0x2d8c('0x30')]=_[_0x2d8c('0x31')](_0x57e044[_0x2d8c('0x30')]);_0x232c36[_0x2d8c('0x32')]=_['intersection'](_0x232c36['model'],_0x232c36[_0x2d8c('0x30')]);_0xb88b91[_0x2d8c('0x33')]=_[_0x2d8c('0x34')](_0x232c36['model'],qs[_0x2d8c('0x35')](_0x57e044[_0x2d8c('0x30')]['fields']));_0xb88b91[_0x2d8c('0x33')]=_0xb88b91[_0x2d8c('0x33')][_0x2d8c('0x36')]?_0xb88b91[_0x2d8c('0x33')]:_0x232c36[_0x2d8c('0x37')];if(!_0x57e044[_0x2d8c('0x30')][_0x2d8c('0x38')]('nolimit')){_0xb88b91[_0x2d8c('0x20')]=qs[_0x2d8c('0x20')](_0x57e044[_0x2d8c('0x30')][_0x2d8c('0x20')]);_0xb88b91[_0x2d8c('0x22')]=qs['offset'](_0x57e044[_0x2d8c('0x30')]['offset']);}_0xb88b91[_0x2d8c('0x39')]=qs[_0x2d8c('0x3a')](_0x57e044[_0x2d8c('0x30')][_0x2d8c('0x3a')]);_0xb88b91['where']=qs[_0x2d8c('0x32')](_[_0x2d8c('0x3b')](_0x57e044['query'],_0x232c36['filters']),_0x442ccc);if(_0x57e044[_0x2d8c('0x30')][_0x2d8c('0x3c')]){_0xb88b91[_0x2d8c('0x3d')]=_[_0x2d8c('0x3e')](_0xb88b91[_0x2d8c('0x3d')],{'$or':_[_0x2d8c('0x2b')](_0x442ccc,function(_0x442dfb){if(_0x442dfb[_0x2d8c('0x2e')]!==_0x2d8c('0x3f')){var _0xb4a5e6={};_0xb4a5e6[_0x442dfb[_0x2d8c('0x2a')]]={'$like':'%'+_0x57e044[_0x2d8c('0x30')][_0x2d8c('0x3c')]+'%'};return _0xb4a5e6;}})});}_0xb88b91=_[_0x2d8c('0x3e')]({},_0xb88b91,_0x57e044[_0x2d8c('0x40')]);var _0x26e809={'where':_0xb88b91['where']};return db['FaxTransferReport']['count'](_0x26e809)['then'](function(_0x12f5c0){_0x75175a[_0x2d8c('0x21')]=_0x12f5c0;if(_0x57e044[_0x2d8c('0x30')][_0x2d8c('0x41')]){_0xb88b91['include']=[{'all':!![]}];}return db[_0x2d8c('0x2c')][_0x2d8c('0x42')](_0xb88b91);})[_0x2d8c('0x28')](function(_0x2749ac){_0x75175a[_0x2d8c('0x43')]=_0x2749ac;return _0x75175a;})['then'](respondWithFilteredResult(_0x4fa686,_0xb88b91))['catch'](handleError(_0x4fa686,null));};exports[_0x2d8c('0x44')]=function(_0x3cb11f,_0x5b9a8f){var _0x4fe4ee={'raw':!![],'where':{'id':_0x3cb11f[_0x2d8c('0x45')]['id']}},_0x3c1e9b={};_0x3c1e9b[_0x2d8c('0x37')]=_[_0x2d8c('0x31')](db[_0x2d8c('0x2c')]['rawAttributes']);_0x3c1e9b['query']=_['keys'](_0x3cb11f[_0x2d8c('0x30')]);_0x3c1e9b['filters']=_['intersection'](_0x3c1e9b[_0x2d8c('0x37')],_0x3c1e9b[_0x2d8c('0x30')]);_0x4fe4ee[_0x2d8c('0x33')]=_[_0x2d8c('0x34')](_0x3c1e9b['model'],qs[_0x2d8c('0x35')](_0x3cb11f[_0x2d8c('0x30')][_0x2d8c('0x35')]));_0x4fe4ee[_0x2d8c('0x33')]=_0x4fe4ee['attributes'][_0x2d8c('0x36')]?_0x4fe4ee[_0x2d8c('0x33')]:_0x3c1e9b[_0x2d8c('0x37')];if(_0x3cb11f['query'][_0x2d8c('0x41')]){_0x4fe4ee['include']=[{'all':!![]}];}_0x4fe4ee=_[_0x2d8c('0x3e')]({},_0x4fe4ee,_0x3cb11f[_0x2d8c('0x40')]);return db[_0x2d8c('0x2c')][_0x2d8c('0x46')](_0x4fe4ee)[_0x2d8c('0x28')](handleEntityNotFound(_0x5b9a8f,null))[_0x2d8c('0x28')](respondWithResult(_0x5b9a8f,null))[_0x2d8c('0x47')](handleError(_0x5b9a8f,null));};exports['create']=function(_0x1e214a,_0x25f3b6){return db['FaxTransferReport']['create'](_0x1e214a[_0x2d8c('0x48')],{})[_0x2d8c('0x28')](respondWithResult(_0x25f3b6,0xc9))['catch'](handleError(_0x25f3b6,null));};exports[_0x2d8c('0x27')]=function(_0x287e0d,_0x521324){if(_0x287e0d[_0x2d8c('0x48')]['id']){delete _0x287e0d['body']['id'];}return db[_0x2d8c('0x2c')][_0x2d8c('0x46')]({'where':{'id':_0x287e0d[_0x2d8c('0x45')]['id']}})[_0x2d8c('0x28')](handleEntityNotFound(_0x521324,null))[_0x2d8c('0x28')](saveUpdates(_0x287e0d[_0x2d8c('0x48')],null))[_0x2d8c('0x28')](respondWithResult(_0x521324,null))[_0x2d8c('0x47')](handleError(_0x521324,null));};exports['destroy']=function(_0x11fa63,_0x40cbee){return db[_0x2d8c('0x2c')][_0x2d8c('0x46')]({'where':{'id':_0x11fa63[_0x2d8c('0x45')]['id']}})['then'](handleEntityNotFound(_0x40cbee,null))['then'](removeEntity(_0x40cbee,null))[_0x2d8c('0x47')](handleError(_0x40cbee,null));};exports[_0x2d8c('0x49')]=function(_0x4ce8fb,_0x173e16){return db[_0x2d8c('0x2c')][_0x2d8c('0x49')]()[_0x2d8c('0x28')](respondWithResult(_0x173e16,null))[_0x2d8c('0x47')](handleError(_0x173e16,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 59d5932..a33a784 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 _0x6a0b=['lodash','util','../../config/logger','api','bluebird','path','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x35f7d1,_0x39d318){var _0x53ac5f=function(_0x30b171){while(--_0x30b171){_0x35f7d1['push'](_0x35f7d1['shift']());}};_0x53ac5f(++_0x39d318);}(_0x6a0b,0x181));var _0xb6a0=function(_0x7d9c46,_0x55c788){_0x7d9c46=_0x7d9c46-0x0;var _0x20aca3=_0x6a0b[_0x7d9c46];return _0x20aca3;};'use strict';var _=require(_0xb6a0('0x0'));var util=require(_0xb6a0('0x1'));var logger=require(_0xb6a0('0x2'))(_0xb6a0('0x3'));var moment=require('moment');var BPromise=require(_0xb6a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6a0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb6a0('0x6'));module[_0xb6a0('0x7')]=function(_0x46ad5a,_0x3136e9){return _0x46ad5a['define'](_0xb6a0('0x8'),attributes,{'tableName':_0xb6a0('0x9'),'paranoid':![],'indexes':[{'name':_0xb6a0('0xa'),'fields':[_0xb6a0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9053=['FaxTransferReport','uniqueid','util','moment','bluebird','path','./faxTransferReport.attributes','exports','define'];(function(_0x2ec3d1,_0x2d82b2){var _0x2551e2=function(_0x5a638b){while(--_0x5a638b){_0x2ec3d1['push'](_0x2ec3d1['shift']());}};_0x2551e2(++_0x2d82b2);}(_0x9053,0x161));var _0x3905=function(_0x19cfac,_0x3745dc){_0x19cfac=_0x19cfac-0x0;var _0x25d2a5=_0x9053[_0x19cfac];return _0x25d2a5;};'use strict';var _=require('lodash');var util=require(_0x3905('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3905('0x1'));var BPromise=require(_0x3905('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3905('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3905('0x4'));module[_0x3905('0x5')]=function(_0x2925cf,_0x95ec97){return _0x2925cf[_0x3905('0x6')](_0x3905('0x7'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x3905('0x8'),'fields':[_0x3905('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 1690273..7d4ca0e 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 _0xa8b2=['FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x36ea36,_0x544f2a){var _0x419659=function(_0x43a55e){while(--_0x43a55e){_0x36ea36['push'](_0x36ea36['shift']());}};_0x419659(++_0x544f2a);}(_0xa8b2,0x6e));var _0x2a8b=function(_0x26a4ba,_0x3fa856){_0x26a4ba=_0x26a4ba-0x0;var _0x244518=_0xa8b2[_0x26a4ba];return _0x244518;};'use strict';var _=require(_0x2a8b('0x0'));var util=require(_0x2a8b('0x1'));var moment=require('moment');var BPromise=require(_0x2a8b('0x2'));var rs=require(_0x2a8b('0x3'));var fs=require('fs');var Redis=require(_0x2a8b('0x4'));var db=require(_0x2a8b('0x5'))['db'];var utils=require(_0x2a8b('0x6'));var logger=require(_0x2a8b('0x7'))('rpc');var config=require(_0x2a8b('0x8'));var jayson=require(_0x2a8b('0x9'));var client=jayson[_0x2a8b('0xa')][_0x2a8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42b3da,_0x37dbad,_0x46709d){return new BPromise(function(_0x116eaa,_0x269958){return client['request'](_0x42b3da,_0x46709d)[_0x2a8b('0xc')](function(_0x53b42d){logger[_0x2a8b('0xd')](_0x2a8b('0xe'),_0x37dbad,_0x2a8b('0xf'));logger['debug'](_0x2a8b('0x10'),_0x37dbad,'request\x20sent',JSON['stringify'](_0x53b42d));if(_0x53b42d[_0x2a8b('0x11')]){if(_0x53b42d[_0x2a8b('0x11')]['code']===0x1f4){logger[_0x2a8b('0x11')](_0x2a8b('0xe'),_0x37dbad,_0x53b42d[_0x2a8b('0x11')][_0x2a8b('0x12')]);return _0x269958(_0x53b42d[_0x2a8b('0x11')][_0x2a8b('0x12')]);}logger[_0x2a8b('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x37dbad,_0x53b42d[_0x2a8b('0x11')][_0x2a8b('0x12')]);return _0x116eaa(_0x53b42d[_0x2a8b('0x11')][_0x2a8b('0x12')]);}else{logger['info'](_0x2a8b('0xe'),_0x37dbad,_0x2a8b('0xf'));_0x116eaa(_0x53b42d[_0x2a8b('0x13')][_0x2a8b('0x12')]);}})[_0x2a8b('0x14')](function(_0x1e4dcb){logger[_0x2a8b('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x37dbad,_0x1e4dcb);_0x269958(_0x1e4dcb);});});} \ No newline at end of file +var _0xda6b=['code','message','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1b1738,_0x25dd1b){var _0x145c6f=function(_0x1b0b14){while(--_0x1b0b14){_0x1b1738['push'](_0x1b1738['shift']());}};_0x145c6f(++_0x25dd1b);}(_0xda6b,0x1b7));var _0xbda6=function(_0x2927eb,_0x2b92de){_0x2927eb=_0x2927eb-0x0;var _0x25f438=_0xda6b[_0x2927eb];return _0x25f438;};'use strict';var _=require(_0xbda6('0x0'));var util=require('util');var moment=require(_0xbda6('0x1'));var BPromise=require(_0xbda6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbda6('0x3'));var db=require(_0xbda6('0x4'))['db'];var utils=require(_0xbda6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbda6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbda6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45ade1,_0x5ae50c,_0x26649b){return new BPromise(function(_0x5dfc6c,_0x372d14){return client[_0xbda6('0x8')](_0x45ade1,_0x26649b)[_0xbda6('0x9')](function(_0xe00c26){logger[_0xbda6('0xa')](_0xbda6('0xb'),_0x5ae50c,_0xbda6('0xc'));logger[_0xbda6('0xd')](_0xbda6('0xe'),_0x5ae50c,_0xbda6('0xc'),JSON[_0xbda6('0xf')](_0xe00c26));if(_0xe00c26[_0xbda6('0x10')]){if(_0xe00c26[_0xbda6('0x10')][_0xbda6('0x11')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x5ae50c,_0xe00c26[_0xbda6('0x10')]['message']);return _0x372d14(_0xe00c26[_0xbda6('0x10')][_0xbda6('0x12')]);}logger[_0xbda6('0x10')](_0xbda6('0xb'),_0x5ae50c,_0xe00c26[_0xbda6('0x10')][_0xbda6('0x12')]);return _0x5dfc6c(_0xe00c26[_0xbda6('0x10')][_0xbda6('0x12')]);}else{logger[_0xbda6('0xa')](_0xbda6('0xb'),_0x5ae50c,'request\x20sent');_0x5dfc6c(_0xe00c26['result'][_0xbda6('0x12')]);}})['catch'](function(_0x4aeeab){logger[_0xbda6('0x10')](_0xbda6('0xb'),_0x5ae50c,_0x4aeeab);_0x372d14(_0x4aeeab);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 1608d45..c3e0613 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 _0x365a=['isAuthenticated','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','describe','/:id'];(function(_0x1e5b99,_0x64b0b1){var _0x3dc6ab=function(_0x199d06){while(--_0x199d06){_0x1e5b99['push'](_0x1e5b99['shift']());}};_0x3dc6ab(++_0x64b0b1);}(_0x365a,0x136));var _0xa365=function(_0xf533d3,_0x2d9cb2){_0xf533d3=_0xf533d3-0x0;var _0x560516=_0x365a[_0xf533d3];return _0x560516;};'use strict';var multer=require(_0xa365('0x0'));var util=require('util');var path=require(_0xa365('0x1'));var timeout=require(_0xa365('0x2'));var express=require(_0xa365('0x3'));var router=express[_0xa365('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa365('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa365('0x6'));var controller=require(_0xa365('0x7'));router[_0xa365('0x8')]('/',auth['isAuthenticated'](),controller[_0xa365('0x9')]);router[_0xa365('0x8')](_0xa365('0xa'),auth['isAuthenticated'](),controller[_0xa365('0xb')]);router[_0xa365('0x8')](_0xa365('0xc'),auth[_0xa365('0xd')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa365('0xe')]);router[_0xa365('0xf')](_0xa365('0xc'),auth[_0xa365('0xd')](),controller[_0xa365('0x10')]);router['delete']('/:id',auth[_0xa365('0xd')](),controller[_0xa365('0x11')]);module[_0xa365('0x12')]=router; \ No newline at end of file +var _0xa943=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','update','delete','destroy','exports','multer','util'];(function(_0x59f1c0,_0x35e71c){var _0x1ffc51=function(_0x51236e){while(--_0x51236e){_0x59f1c0['push'](_0x59f1c0['shift']());}};_0x1ffc51(++_0x35e71c);}(_0xa943,0x132));var _0x3a94=function(_0x1e3858,_0x29245d){_0x1e3858=_0x1e3858-0x0;var _0x249203=_0xa943[_0x1e3858];return _0x249203;};'use strict';var multer=require(_0x3a94('0x0'));var util=require(_0x3a94('0x1'));var path=require(_0x3a94('0x2'));var timeout=require(_0x3a94('0x3'));var express=require(_0x3a94('0x4'));var router=express[_0x3a94('0x5')]();var fs_extra=require(_0x3a94('0x6'));var auth=require(_0x3a94('0x7'));var interaction=require(_0x3a94('0x8'));var config=require(_0x3a94('0x9'));var controller=require(_0x3a94('0xa'));router['get']('/',auth[_0x3a94('0xb')](),controller[_0x3a94('0xc')]);router[_0x3a94('0xd')](_0x3a94('0xe'),auth[_0x3a94('0xb')](),controller[_0x3a94('0xf')]);router[_0x3a94('0xd')](_0x3a94('0x10'),auth[_0x3a94('0xb')](),controller[_0x3a94('0x11')]);router['post']('/',auth[_0x3a94('0xb')](),controller['create']);router['put'](_0x3a94('0x10'),auth[_0x3a94('0xb')](),controller[_0x3a94('0x12')]);router[_0x3a94('0x13')](_0x3a94('0x10'),auth[_0x3a94('0xb')](),controller[_0x3a94('0x14')]);module[_0x3a94('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index df73a04..8be2c09 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 _0xe7f6=['put','/:id','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xe7f6,0x118));var _0x6e7f=function(_0xef4cf0,_0x16c9c3){_0xef4cf0=_0xef4cf0-0x0;var _0x497ad2=_0xe7f6[_0xef4cf0];return _0x497ad2;};'use strict';var multer=require(_0x6e7f('0x0'));var util=require('util');var path=require(_0x6e7f('0x1'));var timeout=require('connect-timeout');var express=require(_0x6e7f('0x2'));var router=express[_0x6e7f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6e7f('0x4'));var interaction=require(_0x6e7f('0x5'));var config=require(_0x6e7f('0x6'));var controller=require(_0x6e7f('0x7'));router[_0x6e7f('0x8')]('/',auth[_0x6e7f('0x9')](),controller[_0x6e7f('0xa')]);router[_0x6e7f('0x8')]('/:id',auth[_0x6e7f('0x9')](),controller[_0x6e7f('0xb')]);router[_0x6e7f('0x8')](_0x6e7f('0xc'),auth['isAuthenticated'](),controller[_0x6e7f('0xd')]);router[_0x6e7f('0x8')](_0x6e7f('0xe'),auth['isAuthenticated'](),controller[_0x6e7f('0xf')]);router[_0x6e7f('0x10')]('/',auth['isAuthenticated'](),controller[_0x6e7f('0x11')]);router[_0x6e7f('0x10')](_0x6e7f('0xc'),auth[_0x6e7f('0x9')](),controller[_0x6e7f('0x12')]);router[_0x6e7f('0x13')](_0x6e7f('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x6e7f('0x15')](_0x6e7f('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e7f('0x16')]=router; \ No newline at end of file +var _0x4a3b=['index','/:id','show','/:id/configurations','getFields','create','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated'];(function(_0x258257,_0x32042d){var _0xafb58a=function(_0x506b5a){while(--_0x506b5a){_0x258257['push'](_0x258257['shift']());}};_0xafb58a(++_0x32042d);}(_0x4a3b,0xa5));var _0xb4a3=function(_0x364f37,_0x16f182){_0x364f37=_0x364f37-0x0;var _0x94014=_0x4a3b[_0x364f37];return _0x94014;};'use strict';var multer=require('multer');var util=require(_0xb4a3('0x0'));var path=require(_0xb4a3('0x1'));var timeout=require(_0xb4a3('0x2'));var express=require(_0xb4a3('0x3'));var router=express['Router']();var fs_extra=require(_0xb4a3('0x4'));var auth=require(_0xb4a3('0x5'));var interaction=require(_0xb4a3('0x6'));var config=require(_0xb4a3('0x7'));var controller=require(_0xb4a3('0x8'));router[_0xb4a3('0x9')]('/',auth[_0xb4a3('0xa')](),controller[_0xb4a3('0xb')]);router[_0xb4a3('0x9')](_0xb4a3('0xc'),auth[_0xb4a3('0xa')](),controller[_0xb4a3('0xd')]);router[_0xb4a3('0x9')](_0xb4a3('0xe'),auth[_0xb4a3('0xa')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xb4a3('0xa')](),controller[_0xb4a3('0xf')]);router['post']('/',auth[_0xb4a3('0xa')](),controller[_0xb4a3('0x10')]);router['post'](_0xb4a3('0xe'),auth[_0xb4a3('0xa')](),controller[_0xb4a3('0x11')]);router[_0xb4a3('0x12')](_0xb4a3('0xc'),auth[_0xb4a3('0xa')](),controller[_0xb4a3('0x13')]);router[_0xb4a3('0x14')](_0xb4a3('0xc'),auth[_0xb4a3('0xa')](),controller[_0xb4a3('0x15')]);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 40f29f5..dfbf8a0 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 _0x2698=['STRING','basic','integrationTab','newTab','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2698,0x86));var _0x8269=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2698[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8269('0x0'));module['exports']={'name':{'type':Sequelize[_0x8269('0x1')]},'description':{'type':Sequelize[_0x8269('0x1')]},'username':{'type':Sequelize[_0x8269('0x1')]},'remoteUri':{'type':Sequelize[_0x8269('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x8269('0x2')),'defaultValue':_0x8269('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x8269('0x1')]},'consumerSecret':{'type':Sequelize[_0x8269('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8269('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8269('0x3'),_0x8269('0x4')),'defaultValue':_0x8269('0x3')}}; \ No newline at end of file +var _0x3bc1=['basic','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x472d29,_0xb942ce){var _0x5583f3=function(_0xf75b35){while(--_0xf75b35){_0x472d29['push'](_0x472d29['shift']());}};_0x5583f3(++_0xb942ce);}(_0x3bc1,0x11c));var _0x13bc=function(_0xf412e7,_0x287927){_0xf412e7=_0xf412e7-0x0;var _0x5d644a=_0x3bc1[_0xf412e7];return _0x5d644a;};'use strict';var Sequelize=require(_0x13bc('0x0'));module[_0x13bc('0x1')]={'name':{'type':Sequelize[_0x13bc('0x2')]},'description':{'type':Sequelize[_0x13bc('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x13bc('0x2')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x13bc('0x3')},'password':{'type':Sequelize[_0x13bc('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x13bc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x13bc('0x4')](_0x13bc('0x5'),_0x13bc('0x6')),'defaultValue':_0x13bc('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 6202f36..4e5a388 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 _0x0bbe=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','limit','undefined','count','offset','status','Content-Range','apply','reject','save','update','destroy','error','stack','send','index','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','DeskAccount','then','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','findOne','DeskConfiguration','getConfigurations','nolimit','addConfiguration','channel','Descriptions','getDescriptions','DeskField','Subjects','priority','remoteUri','authType','consumerKey','token','tokenSecret','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','password','base64','concat','_embedded','entries','active','label','statusCode','getFields','stringify','Wrong\x20credentials'];(function(_0x16581f,_0x45ac48){var _0x2cc7e5=function(_0x1801f5){while(--_0x1801f5){_0x16581f['push'](_0x16581f['shift']());}};_0x2cc7e5(++_0x45ac48);}(_0x0bbe,0x1d0));var _0xe0bb=function(_0x2b1c26,_0x16e0e6){_0x2b1c26=_0x2b1c26-0x0;var _0x14df9e=_0x0bbe[_0x2b1c26];return _0x14df9e;};'use strict';var emlformat=require(_0xe0bb('0x0'));var rimraf=require(_0xe0bb('0x1'));var zipdir=require(_0xe0bb('0x2'));var jsonpatch=require(_0xe0bb('0x3'));var rp=require(_0xe0bb('0x4'));var moment=require(_0xe0bb('0x5'));var BPromise=require(_0xe0bb('0x6'));var Mustache=require(_0xe0bb('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe0bb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0bb('0x9'));var _=require(_0xe0bb('0xa'));var squel=require(_0xe0bb('0xb'));var crypto=require(_0xe0bb('0xc'));var jsforce=require(_0xe0bb('0xd'));var deskjs=require(_0xe0bb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe0bb('0xf'));var Papa=require(_0xe0bb('0x10'));var Redis=require('ioredis');var authService=require(_0xe0bb('0x11'));var qs=require(_0xe0bb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0bb('0x13'));var logger=require(_0xe0bb('0x14'))(_0xe0bb('0x15'));var utils=require(_0xe0bb('0x16'));var config=require(_0xe0bb('0x17'));var licenseUtil=require(_0xe0bb('0x18'));var db=require(_0xe0bb('0x19'))['db'];var integrations=require(_0xe0bb('0x1a'));function respondWithStatusCode(_0x1db497,_0x1c006e){_0x1c006e=_0x1c006e||0xcc;return function(_0x178cee){if(_0x178cee){return _0x1db497[_0xe0bb('0x1b')](_0x1c006e);}return _0x1db497['status'](_0x1c006e)[_0xe0bb('0x1c')]();};}function respondWithResult(_0xbd7108,_0x4b4391){_0x4b4391=_0x4b4391||0xc8;return function(_0x40200f){if(_0x40200f){return _0xbd7108['status'](_0x4b4391)[_0xe0bb('0x1d')](_0x40200f);}};}function respondWithFilteredResult(_0x12be54,_0x219a53){return function(_0x1439ba){if(_0x1439ba){var _0x3e52ff=typeof _0x219a53['offset']==='undefined'&&typeof _0x219a53[_0xe0bb('0x1e')]===_0xe0bb('0x1f');var _0x2cb55a=_0x1439ba[_0xe0bb('0x20')];var _0x3cd9cc=_0x3e52ff?0x0:_0x219a53['offset'];var _0x62c4cf=_0x3e52ff?_0x1439ba['count']:_0x219a53[_0xe0bb('0x21')]+_0x219a53[_0xe0bb('0x1e')];var _0x270d70;if(_0x62c4cf>=_0x2cb55a){_0x62c4cf=_0x2cb55a;_0x270d70=0xc8;}else{_0x270d70=0xce;}_0x12be54[_0xe0bb('0x22')](_0x270d70);return _0x12be54['set'](_0xe0bb('0x23'),_0x3cd9cc+'-'+_0x62c4cf+'/'+_0x2cb55a)[_0xe0bb('0x1d')](_0x1439ba);}return null;};}function patchUpdates(_0x293dec){return function(_0x491e25){try{jsonpatch[_0xe0bb('0x24')](_0x491e25,_0x293dec,!![]);}catch(_0x2f9514){return BPromise[_0xe0bb('0x25')](_0x2f9514);}return _0x491e25[_0xe0bb('0x26')]();};}function saveUpdates(_0x2e4fd8,_0x460fab){return function(_0x11ffb3){if(_0x11ffb3){return _0x11ffb3[_0xe0bb('0x27')](_0x2e4fd8)['then'](function(_0x93c995){return _0x93c995;});}return null;};}function removeEntity(_0x54063a,_0x264c9b){return function(_0x2e959c){if(_0x2e959c){return _0x2e959c[_0xe0bb('0x28')]()['then'](function(){_0x54063a[_0xe0bb('0x22')](0xcc)[_0xe0bb('0x1c')]();});}};}function handleEntityNotFound(_0x4c5714,_0x3b6091){return function(_0x205128){if(!_0x205128){_0x4c5714[_0xe0bb('0x1b')](0x194);}return _0x205128;};}function handleError(_0x8d85a7,_0x364f89){_0x364f89=_0x364f89||0x1f4;return function(_0x242964){logger[_0xe0bb('0x29')](_0x242964[_0xe0bb('0x2a')]);if(_0x242964['name']){delete _0x242964['name'];}_0x8d85a7[_0xe0bb('0x22')](_0x364f89)[_0xe0bb('0x2b')](_0x242964);};}exports[_0xe0bb('0x2c')]=function(_0x5c74a5,_0x465867){var _0x441b64={},_0x16c204={},_0x2cad3d={'count':0x0,'rows':[]};var _0x7d78ab=_['map'](db['DeskAccount'][_0xe0bb('0x2d')],function(_0x10f9a4){return{'name':_0x10f9a4[_0xe0bb('0x2e')],'type':_0x10f9a4[_0xe0bb('0x2f')][_0xe0bb('0x30')]};});_0x16c204[_0xe0bb('0x31')]=_[_0xe0bb('0x32')](_0x7d78ab,_0xe0bb('0x33'));_0x16c204[_0xe0bb('0x34')]=_['keys'](_0x5c74a5['query']);_0x16c204[_0xe0bb('0x35')]=_[_0xe0bb('0x36')](_0x16c204[_0xe0bb('0x31')],_0x16c204['query']);_0x441b64[_0xe0bb('0x37')]=_[_0xe0bb('0x36')](_0x16c204['model'],qs[_0xe0bb('0x38')](_0x5c74a5[_0xe0bb('0x34')][_0xe0bb('0x38')]));_0x441b64[_0xe0bb('0x37')]=_0x441b64[_0xe0bb('0x37')][_0xe0bb('0x39')]?_0x441b64[_0xe0bb('0x37')]:_0x16c204[_0xe0bb('0x31')];if(!_0x5c74a5['query'][_0xe0bb('0x3a')]('nolimit')){_0x441b64[_0xe0bb('0x1e')]=qs[_0xe0bb('0x1e')](_0x5c74a5[_0xe0bb('0x34')][_0xe0bb('0x1e')]);_0x441b64['offset']=qs[_0xe0bb('0x21')](_0x5c74a5[_0xe0bb('0x34')][_0xe0bb('0x21')]);}_0x441b64[_0xe0bb('0x3b')]=qs['sort'](_0x5c74a5[_0xe0bb('0x34')][_0xe0bb('0x3c')]);_0x441b64['where']=qs['filters'](_[_0xe0bb('0x3d')](_0x5c74a5[_0xe0bb('0x34')],_0x16c204[_0xe0bb('0x35')]),_0x7d78ab);if(_0x5c74a5['query'][_0xe0bb('0x3e')]){_0x441b64[_0xe0bb('0x3f')]=_[_0xe0bb('0x40')](_0x441b64['where'],{'$or':_[_0xe0bb('0x32')](_0x7d78ab,function(_0x1d72a2){if(_0x1d72a2[_0xe0bb('0x2f')]!==_0xe0bb('0x41')){var _0x14efd8={};_0x14efd8[_0x1d72a2[_0xe0bb('0x33')]]={'$like':'%'+_0x5c74a5[_0xe0bb('0x34')][_0xe0bb('0x3e')]+'%'};return _0x14efd8;}})});}_0x441b64=_[_0xe0bb('0x40')]({},_0x441b64,_0x5c74a5['options']);var _0xc30175={'where':_0x441b64['where']};return db[_0xe0bb('0x42')]['count'](_0xc30175)[_0xe0bb('0x43')](function(_0x375405){_0x2cad3d[_0xe0bb('0x20')]=_0x375405;if(_0x5c74a5['query'][_0xe0bb('0x44')]){_0x441b64[_0xe0bb('0x45')]=[{'all':!![]}];}return db[_0xe0bb('0x42')][_0xe0bb('0x46')](_0x441b64);})[_0xe0bb('0x43')](function(_0x277ff5){_0x2cad3d[_0xe0bb('0x47')]=_0x277ff5;return _0x2cad3d;})[_0xe0bb('0x43')](respondWithFilteredResult(_0x465867,_0x441b64))[_0xe0bb('0x48')](handleError(_0x465867,null));};exports[_0xe0bb('0x49')]=function(_0x44ffef,_0x1d9ea6){var _0x915848={'raw':![],'where':{'id':_0x44ffef[_0xe0bb('0x4a')]['id']}},_0x54e3b6={};_0x54e3b6['model']=_[_0xe0bb('0x4b')](db[_0xe0bb('0x42')][_0xe0bb('0x2d')]);_0x54e3b6[_0xe0bb('0x34')]=_['keys'](_0x44ffef['query']);_0x54e3b6[_0xe0bb('0x35')]=_['intersection'](_0x54e3b6[_0xe0bb('0x31')],_0x54e3b6['query']);_0x915848['attributes']=_[_0xe0bb('0x36')](_0x54e3b6[_0xe0bb('0x31')],qs['fields'](_0x44ffef[_0xe0bb('0x34')][_0xe0bb('0x38')]));_0x915848['attributes']=_0x915848[_0xe0bb('0x37')][_0xe0bb('0x39')]?_0x915848[_0xe0bb('0x37')]:_0x54e3b6['model'];if(_0x44ffef[_0xe0bb('0x34')]['includeAll']){_0x915848[_0xe0bb('0x45')]=[{'all':!![]}];}_0x915848=_[_0xe0bb('0x40')]({},_0x915848,_0x44ffef[_0xe0bb('0x4c')]);return db[_0xe0bb('0x42')][_0xe0bb('0x4d')](_0x915848)['then'](handleEntityNotFound(_0x1d9ea6,null))[_0xe0bb('0x43')](respondWithResult(_0x1d9ea6,null))[_0xe0bb('0x48')](handleError(_0x1d9ea6,null));};exports[_0xe0bb('0x4e')]=function(_0x599b49,_0x11108b){return db[_0xe0bb('0x42')][_0xe0bb('0x4e')](_0x599b49['body'],{})[_0xe0bb('0x43')](respondWithResult(_0x11108b,0xc9))[_0xe0bb('0x48')](handleError(_0x11108b,null));};exports[_0xe0bb('0x27')]=function(_0x40d733,_0x25a663){if(_0x40d733[_0xe0bb('0x4f')]['id']){delete _0x40d733[_0xe0bb('0x4f')]['id'];}return db[_0xe0bb('0x42')][_0xe0bb('0x4d')]({'where':{'id':_0x40d733[_0xe0bb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x25a663,null))['then'](saveUpdates(_0x40d733['body'],null))[_0xe0bb('0x43')](respondWithResult(_0x25a663,null))['catch'](handleError(_0x25a663,null));};exports[_0xe0bb('0x28')]=function(_0x4dfa09,_0x225a71){return db['DeskAccount']['find']({'where':{'id':_0x4dfa09[_0xe0bb('0x4a')]['id']}})[_0xe0bb('0x43')](handleEntityNotFound(_0x225a71,null))['then'](removeEntity(_0x225a71,null))['catch'](handleError(_0x225a71,null));};exports['getConfigurations']=function(_0x2bea2e,_0x581a8d,_0x3b1649){var _0x51a2a1={};var _0x2c0600={};var _0x246611;var _0x10faaf;return db[_0xe0bb('0x42')][_0xe0bb('0x50')]({'where':{'id':_0x2bea2e['params']['id']}})[_0xe0bb('0x43')](handleEntityNotFound(_0x581a8d,null))[_0xe0bb('0x43')](function(_0x45b215){if(_0x45b215){_0x246611=_0x45b215;_0x2c0600[_0xe0bb('0x31')]=_[_0xe0bb('0x4b')](db[_0xe0bb('0x51')][_0xe0bb('0x2d')]);_0x2c0600['query']=_[_0xe0bb('0x4b')](_0x2bea2e[_0xe0bb('0x34')]);_0x2c0600['filters']=_['intersection'](_0x2c0600[_0xe0bb('0x31')],_0x2c0600[_0xe0bb('0x34')]);_0x51a2a1[_0xe0bb('0x37')]=_[_0xe0bb('0x36')](_0x2c0600['model'],qs[_0xe0bb('0x38')](_0x2bea2e['query'][_0xe0bb('0x38')]));_0x51a2a1['attributes']=_0x51a2a1[_0xe0bb('0x37')][_0xe0bb('0x39')]?_0x51a2a1[_0xe0bb('0x37')]:_0x2c0600[_0xe0bb('0x31')];_0x51a2a1[_0xe0bb('0x3b')]=qs[_0xe0bb('0x3c')](_0x2bea2e[_0xe0bb('0x34')][_0xe0bb('0x3c')]);_0x51a2a1[_0xe0bb('0x3f')]=qs[_0xe0bb('0x35')](_[_0xe0bb('0x3d')](_0x2bea2e[_0xe0bb('0x34')],_0x2c0600[_0xe0bb('0x35')]));if(_0x2bea2e[_0xe0bb('0x34')][_0xe0bb('0x3e')]){_0x51a2a1[_0xe0bb('0x3f')]=_[_0xe0bb('0x40')](_0x51a2a1[_0xe0bb('0x3f')],{'$or':_[_0xe0bb('0x32')](_0x51a2a1[_0xe0bb('0x37')],function(_0x431dff){var _0x17483e={};_0x17483e[_0x431dff]={'$like':'%'+_0x2bea2e[_0xe0bb('0x34')][_0xe0bb('0x3e')]+'%'};return _0x17483e;})});}_0x51a2a1=_[_0xe0bb('0x40')]({},_0x51a2a1,_0x2bea2e[_0xe0bb('0x4c')]);return _0x246611[_0xe0bb('0x52')](_0x51a2a1);}})[_0xe0bb('0x43')](function(_0x146e61){if(_0x146e61){_0x10faaf=_0x146e61[_0xe0bb('0x39')];if(!_0x2bea2e[_0xe0bb('0x34')]['hasOwnProperty'](_0xe0bb('0x53'))){_0x51a2a1[_0xe0bb('0x1e')]=qs['limit'](_0x2bea2e[_0xe0bb('0x34')]['limit']);_0x51a2a1[_0xe0bb('0x21')]=qs[_0xe0bb('0x21')](_0x2bea2e[_0xe0bb('0x34')][_0xe0bb('0x21')]);}return _0x246611[_0xe0bb('0x52')](_0x51a2a1);}})[_0xe0bb('0x43')](function(_0x17ba9c){if(_0x17ba9c){return _0x17ba9c?{'count':_0x10faaf,'rows':_0x17ba9c}:null;}})[_0xe0bb('0x43')](respondWithResult(_0x581a8d,null))[_0xe0bb('0x48')](handleError(_0x581a8d,null));};exports[_0xe0bb('0x54')]=function(_0x390277,_0x121712,_0x301f05){if(_0x390277['body']['id']){delete _0x390277['body']['id'];}return db['DeskAccount'][_0xe0bb('0x50')]({'where':{'id':_0x390277[_0xe0bb('0x4a')]['id']}})[_0xe0bb('0x43')](handleEntityNotFound(_0x121712,null))[_0xe0bb('0x43')](function(_0x5729ce){if(_0x5729ce){_0x390277[_0xe0bb('0x4f')]['AccountId']=_0x5729ce['id'];_0x390277[_0xe0bb('0x4f')]['Subjects']=integrations['getSubjects'](_0x390277[_0xe0bb('0x4f')][_0xe0bb('0x55')],_0x390277['body'][_0xe0bb('0x2f')]);_0x390277[_0xe0bb('0x4f')][_0xe0bb('0x56')]=integrations[_0xe0bb('0x57')](_0x390277[_0xe0bb('0x4f')]['channel'],_0x390277[_0xe0bb('0x4f')][_0xe0bb('0x2f')]);return db[_0xe0bb('0x51')][_0xe0bb('0x4e')](_0x390277[_0xe0bb('0x4f')],{'include':[{'model':db[_0xe0bb('0x58')],'as':_0xe0bb('0x59')},{'model':db[_0xe0bb('0x58')],'as':_0xe0bb('0x56')}]});}return null;})[_0xe0bb('0x43')](respondWithResult(_0x121712,null))[_0xe0bb('0x48')](handleError(_0x121712,null));};exports['getFields']=function(_0x5f2fcb,_0x5c9c23,_0x443213){var _0x440e45=[{'name':_0xe0bb('0x5a'),'label':_0xe0bb('0x5a'),'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 _0x58731f='';return db['DeskAccount'][_0xe0bb('0x50')]({'where':{'id':_0x5f2fcb[_0xe0bb('0x4a')]['id']},'attributes':['id',_0xe0bb('0x5b'),_0xe0bb('0x5c'),'username','password',_0xe0bb('0x5d'),'consumerSecret',_0xe0bb('0x5e'),_0xe0bb('0x5f')]})['then'](handleEntityNotFound(_0x5c9c23,null))['then'](function(_0x14aa31){if(_0x14aa31){_0x58731f=_0x14aa31[_0xe0bb('0x5b')];var _0x2d6799=_0x58731f[_0xe0bb('0x60')](-0x1);if(_0x2d6799==='/'){_0x58731f=_0x58731f['substring'](0x0,_0x58731f[_0xe0bb('0x61')](_0x2d6799));}var _0x308811={'method':_0xe0bb('0x62'),'uri':util[_0xe0bb('0x63')](_0xe0bb('0x64'),_0x58731f),'headers':{'Content-Type':_0xe0bb('0x65'),'Accept':'application/json'},'json':!![]};if(_0x14aa31['authType']===_0xe0bb('0x66')){_0x308811[_0xe0bb('0x67')]['Authorization']=util[_0xe0bb('0x63')](_0xe0bb('0x68'),new Buffer(util[_0xe0bb('0x63')]('%s:%s',_0x14aa31['username'],_0x14aa31[_0xe0bb('0x69')]))['toString'](_0xe0bb('0x6a')));}return rp(_0x308811)[_0xe0bb('0x43')](function(_0xad5dac){return _0x440e45[_0xe0bb('0x6b')](_[_0xe0bb('0x32')](_0xad5dac[_0xe0bb('0x6c')][_0xe0bb('0x6d')],function(_0x9924ee){return{'id':_0x9924ee[_0xe0bb('0x33')],'name':_0x9924ee['name'],'type':_0x9924ee[_0xe0bb('0x2f')],'active':_0x9924ee[_0xe0bb('0x6e')],'label':_0x9924ee[_0xe0bb('0x6f')],'custom':!![]};}));});}})[_0xe0bb('0x43')](function(_0x4bc91b){return{'count':_0x4bc91b[_0xe0bb('0x39')],'rows':_0x4bc91b};})['then'](respondWithResult(_0x5c9c23,null))[_0xe0bb('0x48')](function(_0x45b55e){var _0x34ab68=_0x5f2fcb[_0xe0bb('0x34')]['test']?0x1f4:_0x45b55e[_0xe0bb('0x70')]||0x1f4;logger[_0xe0bb('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0xe0bb('0x71'),_0x34ab68,JSON[_0xe0bb('0x72')](_0x45b55e));delete _0x45b55e['name'];if(_0x34ab68===0x191){_0x34ab68=0x190;}_0x5c9c23['status'](_0x34ab68)[_0xe0bb('0x2b')](_0x5f2fcb[_0xe0bb('0x34')]['test']?{'message':_0xe0bb('0x73'),'statusCode':_0x45b55e['statusCode']}:_0x45b55e);});}; \ No newline at end of file +var _0x3029=['DeskConfiguration','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','password','token','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','active','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne'];(function(_0x445175,_0x49ee96){var _0x559740=function(_0x42132d){while(--_0x42132d){_0x445175['push'](_0x445175['shift']());}};_0x559740(++_0x49ee96);}(_0x3029,0x1e7));var _0x9302=function(_0x5276a4,_0x3eaa2d){_0x5276a4=_0x5276a4-0x0;var _0x58669b=_0x3029[_0x5276a4];return _0x58669b;};'use strict';var emlformat=require(_0x9302('0x0'));var rimraf=require(_0x9302('0x1'));var zipdir=require(_0x9302('0x2'));var jsonpatch=require(_0x9302('0x3'));var rp=require('request-promise');var moment=require(_0x9302('0x4'));var BPromise=require(_0x9302('0x5'));var Mustache=require('mustache');var util=require(_0x9302('0x6'));var path=require(_0x9302('0x7'));var sox=require(_0x9302('0x8'));var csv=require(_0x9302('0x9'));var ejs=require(_0x9302('0xa'));var fs=require('fs');var fs_extra=require(_0x9302('0xb'));var _=require(_0x9302('0xc'));var squel=require(_0x9302('0xd'));var crypto=require(_0x9302('0xe'));var jsforce=require(_0x9302('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9302('0x9'));var querystring=require(_0x9302('0x10'));var Papa=require('papaparse');var Redis=require(_0x9302('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9302('0x12'));var hardwareService=require(_0x9302('0x13'));var logger=require(_0x9302('0x14'))('api');var utils=require(_0x9302('0x15'));var config=require(_0x9302('0x16'));var licenseUtil=require(_0x9302('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9302('0x18'));function respondWithStatusCode(_0x53fb5e,_0x2c2e2f){_0x2c2e2f=_0x2c2e2f||0xcc;return function(_0x17fafd){if(_0x17fafd){return _0x53fb5e[_0x9302('0x19')](_0x2c2e2f);}return _0x53fb5e[_0x9302('0x1a')](_0x2c2e2f)[_0x9302('0x1b')]();};}function respondWithResult(_0x3b581d,_0x1fc389){_0x1fc389=_0x1fc389||0xc8;return function(_0x28fc15){if(_0x28fc15){return _0x3b581d[_0x9302('0x1a')](_0x1fc389)[_0x9302('0x1c')](_0x28fc15);}};}function respondWithFilteredResult(_0x2a407b,_0x4cb791){return function(_0x209b60){if(_0x209b60){var _0x15a27e=typeof _0x4cb791[_0x9302('0x1d')]===_0x9302('0x1e')&&typeof _0x4cb791[_0x9302('0x1f')]===_0x9302('0x1e');var _0x7928f9=_0x209b60[_0x9302('0x20')];var _0x199e06=_0x15a27e?0x0:_0x4cb791[_0x9302('0x1d')];var _0x3a012b=_0x15a27e?_0x209b60['count']:_0x4cb791[_0x9302('0x1d')]+_0x4cb791[_0x9302('0x1f')];var _0x2665c1;if(_0x3a012b>=_0x7928f9){_0x3a012b=_0x7928f9;_0x2665c1=0xc8;}else{_0x2665c1=0xce;}_0x2a407b[_0x9302('0x1a')](_0x2665c1);return _0x2a407b[_0x9302('0x21')](_0x9302('0x22'),_0x199e06+'-'+_0x3a012b+'/'+_0x7928f9)['json'](_0x209b60);}return null;};}function patchUpdates(_0x20f3b7){return function(_0x5044ec){try{jsonpatch['apply'](_0x5044ec,_0x20f3b7,!![]);}catch(_0x2a0cb0){return BPromise[_0x9302('0x23')](_0x2a0cb0);}return _0x5044ec[_0x9302('0x24')]();};}function saveUpdates(_0x1e680,_0x4c5b5d){return function(_0xd4099d){if(_0xd4099d){return _0xd4099d[_0x9302('0x25')](_0x1e680)['then'](function(_0x51708b){return _0x51708b;});}return null;};}function removeEntity(_0x1e641d,_0x1772aa){return function(_0xe0d471){if(_0xe0d471){return _0xe0d471[_0x9302('0x26')]()['then'](function(){_0x1e641d[_0x9302('0x1a')](0xcc)[_0x9302('0x1b')]();});}};}function handleEntityNotFound(_0x40d2bc,_0x55b170){return function(_0x840fae){if(!_0x840fae){_0x40d2bc[_0x9302('0x19')](0x194);}return _0x840fae;};}function handleError(_0x15b70e,_0x54c0d6){_0x54c0d6=_0x54c0d6||0x1f4;return function(_0x2cad87){logger[_0x9302('0x27')](_0x2cad87['stack']);if(_0x2cad87[_0x9302('0x28')]){delete _0x2cad87['name'];}_0x15b70e[_0x9302('0x1a')](_0x54c0d6)[_0x9302('0x29')](_0x2cad87);};}exports[_0x9302('0x2a')]=function(_0x155b46,_0x1016a3){var _0x475af9={},_0xff2060={},_0x2ddadc={'count':0x0,'rows':[]};var _0x106bf8=_[_0x9302('0x2b')](db[_0x9302('0x2c')][_0x9302('0x2d')],function(_0x5f153c){return{'name':_0x5f153c[_0x9302('0x2e')],'type':_0x5f153c[_0x9302('0x2f')][_0x9302('0x30')]};});_0xff2060['model']=_['map'](_0x106bf8,_0x9302('0x28'));_0xff2060[_0x9302('0x31')]=_[_0x9302('0x32')](_0x155b46[_0x9302('0x31')]);_0xff2060['filters']=_[_0x9302('0x33')](_0xff2060[_0x9302('0x34')],_0xff2060[_0x9302('0x31')]);_0x475af9[_0x9302('0x35')]=_[_0x9302('0x33')](_0xff2060[_0x9302('0x34')],qs['fields'](_0x155b46['query'][_0x9302('0x36')]));_0x475af9[_0x9302('0x35')]=_0x475af9[_0x9302('0x35')]['length']?_0x475af9[_0x9302('0x35')]:_0xff2060[_0x9302('0x34')];if(!_0x155b46[_0x9302('0x31')][_0x9302('0x37')](_0x9302('0x38'))){_0x475af9[_0x9302('0x1f')]=qs[_0x9302('0x1f')](_0x155b46['query'][_0x9302('0x1f')]);_0x475af9[_0x9302('0x1d')]=qs[_0x9302('0x1d')](_0x155b46['query'][_0x9302('0x1d')]);}_0x475af9[_0x9302('0x39')]=qs[_0x9302('0x3a')](_0x155b46['query'][_0x9302('0x3a')]);_0x475af9[_0x9302('0x3b')]=qs[_0x9302('0x3c')](_[_0x9302('0x3d')](_0x155b46[_0x9302('0x31')],_0xff2060[_0x9302('0x3c')]),_0x106bf8);if(_0x155b46['query'][_0x9302('0x3e')]){_0x475af9['where']=_[_0x9302('0x3f')](_0x475af9[_0x9302('0x3b')],{'$or':_[_0x9302('0x2b')](_0x106bf8,function(_0x4121b2){if(_0x4121b2['type']!=='VIRTUAL'){var _0x14b1df={};_0x14b1df[_0x4121b2[_0x9302('0x28')]]={'$like':'%'+_0x155b46[_0x9302('0x31')][_0x9302('0x3e')]+'%'};return _0x14b1df;}})});}_0x475af9=_[_0x9302('0x3f')]({},_0x475af9,_0x155b46[_0x9302('0x40')]);var _0x44f014={'where':_0x475af9[_0x9302('0x3b')]};return db[_0x9302('0x2c')][_0x9302('0x20')](_0x44f014)[_0x9302('0x41')](function(_0x19d3dc){_0x2ddadc[_0x9302('0x20')]=_0x19d3dc;if(_0x155b46['query'][_0x9302('0x42')]){_0x475af9[_0x9302('0x43')]=[{'all':!![]}];}return db[_0x9302('0x2c')][_0x9302('0x44')](_0x475af9);})['then'](function(_0x5c487f){_0x2ddadc[_0x9302('0x45')]=_0x5c487f;return _0x2ddadc;})['then'](respondWithFilteredResult(_0x1016a3,_0x475af9))[_0x9302('0x46')](handleError(_0x1016a3,null));};exports[_0x9302('0x47')]=function(_0x48cb89,_0x76089c){var _0x4bd935={'raw':![],'where':{'id':_0x48cb89[_0x9302('0x48')]['id']}},_0x153cd5={};_0x153cd5[_0x9302('0x34')]=_[_0x9302('0x32')](db[_0x9302('0x2c')][_0x9302('0x2d')]);_0x153cd5[_0x9302('0x31')]=_['keys'](_0x48cb89[_0x9302('0x31')]);_0x153cd5['filters']=_[_0x9302('0x33')](_0x153cd5[_0x9302('0x34')],_0x153cd5[_0x9302('0x31')]);_0x4bd935[_0x9302('0x35')]=_[_0x9302('0x33')](_0x153cd5['model'],qs[_0x9302('0x36')](_0x48cb89[_0x9302('0x31')][_0x9302('0x36')]));_0x4bd935[_0x9302('0x35')]=_0x4bd935['attributes']['length']?_0x4bd935[_0x9302('0x35')]:_0x153cd5[_0x9302('0x34')];if(_0x48cb89[_0x9302('0x31')]['includeAll']){_0x4bd935['include']=[{'all':!![]}];}_0x4bd935=_['merge']({},_0x4bd935,_0x48cb89[_0x9302('0x40')]);return db['DeskAccount'][_0x9302('0x49')](_0x4bd935)[_0x9302('0x41')](handleEntityNotFound(_0x76089c,null))[_0x9302('0x41')](respondWithResult(_0x76089c,null))['catch'](handleError(_0x76089c,null));};exports[_0x9302('0x4a')]=function(_0x3aaca0,_0x2b3cf3){return db[_0x9302('0x2c')][_0x9302('0x4a')](_0x3aaca0['body'],{})[_0x9302('0x41')](respondWithResult(_0x2b3cf3,0xc9))['catch'](handleError(_0x2b3cf3,null));};exports[_0x9302('0x25')]=function(_0x48e293,_0x26b04f){if(_0x48e293[_0x9302('0x4b')]['id']){delete _0x48e293[_0x9302('0x4b')]['id'];}return db[_0x9302('0x2c')][_0x9302('0x49')]({'where':{'id':_0x48e293['params']['id']}})[_0x9302('0x41')](handleEntityNotFound(_0x26b04f,null))[_0x9302('0x41')](saveUpdates(_0x48e293[_0x9302('0x4b')],null))[_0x9302('0x41')](respondWithResult(_0x26b04f,null))[_0x9302('0x46')](handleError(_0x26b04f,null));};exports[_0x9302('0x26')]=function(_0x42763f,_0x3627a0){return db[_0x9302('0x2c')][_0x9302('0x49')]({'where':{'id':_0x42763f['params']['id']}})[_0x9302('0x41')](handleEntityNotFound(_0x3627a0,null))[_0x9302('0x41')](removeEntity(_0x3627a0,null))[_0x9302('0x46')](handleError(_0x3627a0,null));};exports[_0x9302('0x4c')]=function(_0x261880,_0x407b39,_0x3233fe){var _0x3b4cac={};var _0x59da38={};var _0x190dcf;var _0x5440fb;return db['DeskAccount'][_0x9302('0x4d')]({'where':{'id':_0x261880['params']['id']}})[_0x9302('0x41')](handleEntityNotFound(_0x407b39,null))[_0x9302('0x41')](function(_0x2a6f5e){if(_0x2a6f5e){_0x190dcf=_0x2a6f5e;_0x59da38[_0x9302('0x34')]=_[_0x9302('0x32')](db[_0x9302('0x4e')][_0x9302('0x2d')]);_0x59da38['query']=_[_0x9302('0x32')](_0x261880[_0x9302('0x31')]);_0x59da38[_0x9302('0x3c')]=_[_0x9302('0x33')](_0x59da38['model'],_0x59da38[_0x9302('0x31')]);_0x3b4cac[_0x9302('0x35')]=_[_0x9302('0x33')](_0x59da38[_0x9302('0x34')],qs[_0x9302('0x36')](_0x261880['query'][_0x9302('0x36')]));_0x3b4cac[_0x9302('0x35')]=_0x3b4cac['attributes'][_0x9302('0x4f')]?_0x3b4cac['attributes']:_0x59da38[_0x9302('0x34')];_0x3b4cac[_0x9302('0x39')]=qs['sort'](_0x261880['query']['sort']);_0x3b4cac['where']=qs[_0x9302('0x3c')](_[_0x9302('0x3d')](_0x261880[_0x9302('0x31')],_0x59da38[_0x9302('0x3c')]));if(_0x261880[_0x9302('0x31')]['filter']){_0x3b4cac[_0x9302('0x3b')]=_['merge'](_0x3b4cac['where'],{'$or':_[_0x9302('0x2b')](_0x3b4cac[_0x9302('0x35')],function(_0xa22c0){var _0x51ef49={};_0x51ef49[_0xa22c0]={'$like':'%'+_0x261880[_0x9302('0x31')][_0x9302('0x3e')]+'%'};return _0x51ef49;})});}_0x3b4cac=_[_0x9302('0x3f')]({},_0x3b4cac,_0x261880[_0x9302('0x40')]);return _0x190dcf[_0x9302('0x4c')](_0x3b4cac);}})['then'](function(_0x531958){if(_0x531958){_0x5440fb=_0x531958['length'];if(!_0x261880[_0x9302('0x31')][_0x9302('0x37')]('nolimit')){_0x3b4cac[_0x9302('0x1f')]=qs[_0x9302('0x1f')](_0x261880[_0x9302('0x31')][_0x9302('0x1f')]);_0x3b4cac[_0x9302('0x1d')]=qs['offset'](_0x261880[_0x9302('0x31')]['offset']);}return _0x190dcf['getConfigurations'](_0x3b4cac);}})['then'](function(_0x176407){if(_0x176407){return _0x176407?{'count':_0x5440fb,'rows':_0x176407}:null;}})[_0x9302('0x41')](respondWithResult(_0x407b39,null))[_0x9302('0x46')](handleError(_0x407b39,null));};exports[_0x9302('0x50')]=function(_0x2020ac,_0x514504,_0x56cdcc){if(_0x2020ac[_0x9302('0x4b')]['id']){delete _0x2020ac['body']['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x2020ac['params']['id']}})[_0x9302('0x41')](handleEntityNotFound(_0x514504,null))[_0x9302('0x41')](function(_0x1c8ab1){if(_0x1c8ab1){_0x2020ac['body'][_0x9302('0x51')]=_0x1c8ab1['id'];_0x2020ac[_0x9302('0x4b')]['Subjects']=integrations[_0x9302('0x52')](_0x2020ac[_0x9302('0x4b')][_0x9302('0x53')],_0x2020ac[_0x9302('0x4b')][_0x9302('0x2f')]);_0x2020ac[_0x9302('0x4b')][_0x9302('0x54')]=integrations[_0x9302('0x55')](_0x2020ac[_0x9302('0x4b')][_0x9302('0x53')],_0x2020ac[_0x9302('0x4b')]['type']);return db[_0x9302('0x4e')]['create'](_0x2020ac[_0x9302('0x4b')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x9302('0x56')],'as':_0x9302('0x54')}]});}return null;})[_0x9302('0x41')](respondWithResult(_0x514504,null))[_0x9302('0x46')](handleError(_0x514504,null));};exports[_0x9302('0x57')]=function(_0x4ae1dd,_0x2c8c8e,_0x159166){var _0x13dd49=[{'name':_0x9302('0x58'),'label':_0x9302('0x58'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x36131b='';return db['DeskAccount'][_0x9302('0x4d')]({'where':{'id':_0x4ae1dd[_0x9302('0x48')]['id']},'attributes':['id',_0x9302('0x59'),_0x9302('0x5a'),'username',_0x9302('0x5b'),'consumerKey','consumerSecret',_0x9302('0x5c'),_0x9302('0x5d')]})[_0x9302('0x41')](handleEntityNotFound(_0x2c8c8e,null))[_0x9302('0x41')](function(_0x463578){if(_0x463578){_0x36131b=_0x463578[_0x9302('0x59')];var _0xcc7f9a=_0x36131b[_0x9302('0x5e')](-0x1);if(_0xcc7f9a==='/'){_0x36131b=_0x36131b[_0x9302('0x5f')](0x0,_0x36131b[_0x9302('0x60')](_0xcc7f9a));}var _0x43bbd9={'method':'GET','uri':util[_0x9302('0x61')](_0x9302('0x62'),_0x36131b),'headers':{'Content-Type':_0x9302('0x63'),'Accept':'application/json'},'json':!![]};if(_0x463578['authType']===_0x9302('0x64')){_0x43bbd9['headers'][_0x9302('0x65')]=util[_0x9302('0x61')](_0x9302('0x66'),new Buffer(util[_0x9302('0x61')](_0x9302('0x67'),_0x463578['username'],_0x463578['password']))[_0x9302('0x68')](_0x9302('0x69')));}return rp(_0x43bbd9)['then'](function(_0xe7487b){return _0x13dd49[_0x9302('0x6a')](_[_0x9302('0x2b')](_0xe7487b['_embedded']['entries'],function(_0x13738d){return{'id':_0x13738d[_0x9302('0x28')],'name':_0x13738d['name'],'type':_0x13738d[_0x9302('0x2f')],'active':_0x13738d[_0x9302('0x6b')],'label':_0x13738d['label'],'custom':!![]};}));});}})[_0x9302('0x41')](function(_0x419730){return{'count':_0x419730[_0x9302('0x4f')],'rows':_0x419730};})[_0x9302('0x41')](respondWithResult(_0x2c8c8e,null))['catch'](function(_0x26e97f){var _0x404dcc=_0x4ae1dd[_0x9302('0x31')]['test']?0x1f4:_0x26e97f['statusCode']||0x1f4;logger[_0x9302('0x27')](_0x9302('0x6c'),_0x9302('0x57'),_0x404dcc,JSON[_0x9302('0x6d')](_0x26e97f));delete _0x26e97f[_0x9302('0x28')];if(_0x404dcc===0x191){_0x404dcc=0x190;}_0x2c8c8e[_0x9302('0x1a')](_0x404dcc)[_0x9302('0x29')](_0x4ae1dd[_0x9302('0x31')][_0x9302('0x6e')]?{'message':_0x9302('0x6f'),'statusCode':_0x26e97f[_0x9302('0x70')]}:_0x26e97f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index da24bac..5a61813 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 _0x453c=['../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x453c,0x112));var _0xc453=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0x453c[_0x207811];return _0x170d56;};'use strict';var _=require(_0xc453('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc453('0x1'));var rp=require(_0xc453('0x2'));var fs=require('fs');var path=require(_0xc453('0x3'));var rimraf=require('rimraf');var config=require(_0xc453('0x4'));var attributes=require(_0xc453('0x5'));var integrations=require(_0xc453('0x6'));module[_0xc453('0x7')]=function(_0x19e9f7,_0x42a383){return _0x19e9f7[_0xc453('0x8')]('DeskAccount',attributes,{'tableName':_0xc453('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb38b=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define','int_desk_accounts','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb38b,0x78));var _0xbb38=function(_0x2e2b1a,_0x50b50c){_0x2e2b1a=_0x2e2b1a-0x0;var _0x1d4be3=_0xb38b[_0x2e2b1a];return _0x1d4be3;};'use strict';var _=require(_0xbb38('0x0'));var util=require('util');var logger=require(_0xbb38('0x1'))(_0xbb38('0x2'));var moment=require(_0xbb38('0x3'));var BPromise=require(_0xbb38('0x4'));var rp=require(_0xbb38('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb38('0x6'));var config=require(_0xbb38('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xbb38('0x8'));module['exports']=function(_0x513b42,_0x39d79b){return _0x513b42[_0xbb38('0x9')]('DeskAccount',attributes,{'tableName':_0xbb38('0xa'),'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 29fbcaf..926e425 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 _0xb9fe=['util','moment','randomstring','../../config/logger','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','map','include','model','GetDeskAccount','ShowDeskAccount','lodash'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0xb9fe,0x19f));var _0xeb9f=function(_0x3cdfb1,_0x32aefe){_0x3cdfb1=_0x3cdfb1-0x0;var _0x1ce4a0=_0xb9fe[_0x3cdfb1];return _0x1ce4a0;};'use strict';var _=require(_0xeb9f('0x0'));var util=require(_0xeb9f('0x1'));var moment=require(_0xeb9f('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb9f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeb9f('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9f('0x5'));var client=jayson[_0xeb9f('0x6')][_0xeb9f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c1681,_0x31659f,_0x47a2ba){return new BPromise(function(_0x9fb844,_0x550c25){return client[_0xeb9f('0x8')](_0x1c1681,_0x47a2ba)[_0xeb9f('0x9')](function(_0xaec675){logger[_0xeb9f('0xa')](_0xeb9f('0xb'),_0x31659f,_0xeb9f('0xc'));logger[_0xeb9f('0xd')](_0xeb9f('0xe'),_0x31659f,_0xeb9f('0xc'),JSON[_0xeb9f('0xf')](_0xaec675));if(_0xaec675[_0xeb9f('0x10')]){if(_0xaec675['error'][_0xeb9f('0x11')]===0x1f4){logger[_0xeb9f('0x10')](_0xeb9f('0xb'),_0x31659f,_0xaec675[_0xeb9f('0x10')][_0xeb9f('0x12')]);return _0x550c25(_0xaec675[_0xeb9f('0x10')][_0xeb9f('0x12')]);}logger[_0xeb9f('0x10')](_0xeb9f('0xb'),_0x31659f,_0xaec675[_0xeb9f('0x10')][_0xeb9f('0x12')]);return _0x9fb844(_0xaec675[_0xeb9f('0x10')][_0xeb9f('0x12')]);}else{logger['info'](_0xeb9f('0xb'),_0x31659f,'request\x20sent');_0x9fb844(_0xaec675[_0xeb9f('0x13')][_0xeb9f('0x12')]);}})[_0xeb9f('0x14')](function(_0x3ed839){logger[_0xeb9f('0x10')](_0xeb9f('0xb'),_0x31659f,_0x3ed839);_0x550c25(_0x3ed839);});});}exports['GetDeskAccount']=function(_0x30af09){var _0x2285bc=this;return new Promise(function(_0x523a55,_0x2635c0){return db[_0xeb9f('0x15')][_0xeb9f('0x16')]({'raw':_0x30af09[_0xeb9f('0x17')]?_0x30af09[_0xeb9f('0x17')][_0xeb9f('0x18')]===undefined?!![]:![]:!![],'where':_0x30af09[_0xeb9f('0x17')]?_0x30af09[_0xeb9f('0x17')][_0xeb9f('0x19')]||null:null,'attributes':_0x30af09['options']?_0x30af09['options'][_0xeb9f('0x1a')]||null:null,'limit':_0x30af09[_0xeb9f('0x17')]?_0x30af09[_0xeb9f('0x17')]['limit']||null:null,'include':_0x30af09['options']?_0x30af09[_0xeb9f('0x17')]['include']?_[_0xeb9f('0x1b')](_0x30af09[_0xeb9f('0x17')][_0xeb9f('0x1c')],function(_0x4a8a6f){return{'model':db[_0x4a8a6f[_0xeb9f('0x1d')]],'as':_0x4a8a6f['as'],'attributes':_0x4a8a6f[_0xeb9f('0x1a')],'include':_0x4a8a6f[_0xeb9f('0x1c')]?_[_0xeb9f('0x1b')](_0x4a8a6f[_0xeb9f('0x1c')],function(_0x25a3a6){return{'model':db[_0x25a3a6[_0xeb9f('0x1d')]],'as':_0x25a3a6['as'],'attributes':_0x25a3a6[_0xeb9f('0x1a')],'include':_0x25a3a6['include']?_[_0xeb9f('0x1b')](_0x25a3a6[_0xeb9f('0x1c')],function(_0x8e367d){return{'model':db[_0x8e367d[_0xeb9f('0x1d')]],'as':_0x8e367d['as'],'attributes':_0x8e367d['attributes']};}):[]};}):[]};}):[]:[]})[_0xeb9f('0x9')](function(_0x414e5c){logger[_0xeb9f('0xa')](_0xeb9f('0x1e'),_0x30af09);logger[_0xeb9f('0xd')](_0xeb9f('0x1e'),_0x30af09,JSON[_0xeb9f('0xf')](_0x414e5c));_0x523a55(_0x414e5c);})[_0xeb9f('0x14')](function(_0x3f74a5){logger[_0xeb9f('0x10')](_0xeb9f('0x1e'),_0x3f74a5[_0xeb9f('0x12')],_0x30af09);_0x2635c0(_0x2285bc['error'](0x1f4,_0x3f74a5[_0xeb9f('0x12')]));});});};exports[_0xeb9f('0x1f')]=function(_0x3e9363){var _0x533543=this;return new Promise(function(_0xf87531,_0x57542a){return db[_0xeb9f('0x15')]['find']({'raw':_0x3e9363[_0xeb9f('0x17')]?_0x3e9363[_0xeb9f('0x17')][_0xeb9f('0x18')]===undefined?!![]:![]:!![],'where':_0x3e9363[_0xeb9f('0x17')]?_0x3e9363['options']['where']||null:null,'attributes':_0x3e9363[_0xeb9f('0x17')]?_0x3e9363[_0xeb9f('0x17')][_0xeb9f('0x1a')]||null:null,'include':_0x3e9363[_0xeb9f('0x17')]?_0x3e9363[_0xeb9f('0x17')]['include']?_[_0xeb9f('0x1b')](_0x3e9363[_0xeb9f('0x17')][_0xeb9f('0x1c')],function(_0x21fa42){return{'model':db[_0x21fa42[_0xeb9f('0x1d')]],'as':_0x21fa42['as'],'attributes':_0x21fa42['attributes'],'include':_0x21fa42[_0xeb9f('0x1c')]?_[_0xeb9f('0x1b')](_0x21fa42[_0xeb9f('0x1c')],function(_0x19e028){return{'model':db[_0x19e028[_0xeb9f('0x1d')]],'as':_0x19e028['as'],'attributes':_0x19e028['attributes'],'include':_0x19e028[_0xeb9f('0x1c')]?_[_0xeb9f('0x1b')](_0x19e028['include'],function(_0x39508a){return{'model':db[_0x39508a['model']],'as':_0x39508a['as'],'attributes':_0x39508a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x232ef9){logger[_0xeb9f('0xa')]('ShowDeskAccount',_0x3e9363);logger['debug'](_0xeb9f('0x1f'),_0x3e9363,JSON[_0xeb9f('0xf')](_0x232ef9));_0xf87531(_0x232ef9);})[_0xeb9f('0x14')](function(_0x37525c){logger['error'](_0xeb9f('0x1f'),_0x37525c[_0xeb9f('0x12')],_0x3e9363);_0x57542a(_0x533543['error'](0x1f4,_0x37525c['message']));});});}; \ No newline at end of file +var _0x1ec1=['catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','map','model','include','ShowDeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x95d122,_0x234f40){var _0x55df15=function(_0x474a2e){while(--_0x474a2e){_0x95d122['push'](_0x95d122['shift']());}};_0x55df15(++_0x234f40);}(_0x1ec1,0x12d));var _0x11ec=function(_0x176871,_0x20fd97){_0x176871=_0x176871-0x0;var _0x474c42=_0x1ec1[_0x176871];return _0x474c42;};'use strict';var _=require(_0x11ec('0x0'));var util=require(_0x11ec('0x1'));var moment=require('moment');var BPromise=require(_0x11ec('0x2'));var rs=require(_0x11ec('0x3'));var fs=require('fs');var Redis=require(_0x11ec('0x4'));var db=require(_0x11ec('0x5'))['db'];var utils=require(_0x11ec('0x6'));var logger=require(_0x11ec('0x7'))('rpc');var config=require(_0x11ec('0x8'));var jayson=require(_0x11ec('0x9'));var client=jayson[_0x11ec('0xa')][_0x11ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x473477,_0x3e37bd,_0x20e244){return new BPromise(function(_0xd89fa4,_0x25bfa6){return client[_0x11ec('0xc')](_0x473477,_0x20e244)[_0x11ec('0xd')](function(_0x5b8382){logger[_0x11ec('0xe')](_0x11ec('0xf'),_0x3e37bd,'request\x20sent');logger[_0x11ec('0x10')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3e37bd,_0x11ec('0x11'),JSON[_0x11ec('0x12')](_0x5b8382));if(_0x5b8382[_0x11ec('0x13')]){if(_0x5b8382['error'][_0x11ec('0x14')]===0x1f4){logger[_0x11ec('0x13')](_0x11ec('0xf'),_0x3e37bd,_0x5b8382['error']['message']);return _0x25bfa6(_0x5b8382[_0x11ec('0x13')][_0x11ec('0x15')]);}logger[_0x11ec('0x13')](_0x11ec('0xf'),_0x3e37bd,_0x5b8382[_0x11ec('0x13')][_0x11ec('0x15')]);return _0xd89fa4(_0x5b8382[_0x11ec('0x13')][_0x11ec('0x15')]);}else{logger[_0x11ec('0xe')](_0x11ec('0xf'),_0x3e37bd,'request\x20sent');_0xd89fa4(_0x5b8382[_0x11ec('0x16')][_0x11ec('0x15')]);}})[_0x11ec('0x17')](function(_0x107f0d){logger[_0x11ec('0x13')]('DeskAccount,\x20%s,\x20%s',_0x3e37bd,_0x107f0d);_0x25bfa6(_0x107f0d);});});}exports[_0x11ec('0x18')]=function(_0x529e17){var _0x1b125b=this;return new Promise(function(_0x1bc96e,_0x5e2c23){return db[_0x11ec('0x19')][_0x11ec('0x1a')]({'raw':_0x529e17[_0x11ec('0x1b')]?_0x529e17[_0x11ec('0x1b')][_0x11ec('0x1c')]===undefined?!![]:![]:!![],'where':_0x529e17[_0x11ec('0x1b')]?_0x529e17[_0x11ec('0x1b')][_0x11ec('0x1d')]||null:null,'attributes':_0x529e17[_0x11ec('0x1b')]?_0x529e17[_0x11ec('0x1b')][_0x11ec('0x1e')]||null:null,'limit':_0x529e17[_0x11ec('0x1b')]?_0x529e17['options']['limit']||null:null,'include':_0x529e17[_0x11ec('0x1b')]?_0x529e17[_0x11ec('0x1b')]['include']?_[_0x11ec('0x1f')](_0x529e17[_0x11ec('0x1b')]['include'],function(_0x5ec6de){return{'model':db[_0x5ec6de[_0x11ec('0x20')]],'as':_0x5ec6de['as'],'attributes':_0x5ec6de[_0x11ec('0x1e')],'include':_0x5ec6de[_0x11ec('0x21')]?_[_0x11ec('0x1f')](_0x5ec6de['include'],function(_0x583357){return{'model':db[_0x583357[_0x11ec('0x20')]],'as':_0x583357['as'],'attributes':_0x583357[_0x11ec('0x1e')],'include':_0x583357[_0x11ec('0x21')]?_[_0x11ec('0x1f')](_0x583357[_0x11ec('0x21')],function(_0x4d92f4){return{'model':db[_0x4d92f4[_0x11ec('0x20')]],'as':_0x4d92f4['as'],'attributes':_0x4d92f4['attributes']};}):[]};}):[]};}):[]:[]})[_0x11ec('0xd')](function(_0x5331b8){logger[_0x11ec('0xe')](_0x11ec('0x18'),_0x529e17);logger[_0x11ec('0x10')](_0x11ec('0x18'),_0x529e17,JSON[_0x11ec('0x12')](_0x5331b8));_0x1bc96e(_0x5331b8);})['catch'](function(_0x24806d){logger[_0x11ec('0x13')]('GetDeskAccount',_0x24806d[_0x11ec('0x15')],_0x529e17);_0x5e2c23(_0x1b125b['error'](0x1f4,_0x24806d[_0x11ec('0x15')]));});});};exports[_0x11ec('0x22')]=function(_0x5f0774){var _0x523e3d=this;return new Promise(function(_0x112383,_0x5374dc){return db['DeskAccount'][_0x11ec('0x23')]({'raw':_0x5f0774[_0x11ec('0x1b')]?_0x5f0774[_0x11ec('0x1b')][_0x11ec('0x1c')]===undefined?!![]:![]:!![],'where':_0x5f0774['options']?_0x5f0774[_0x11ec('0x1b')][_0x11ec('0x1d')]||null:null,'attributes':_0x5f0774['options']?_0x5f0774[_0x11ec('0x1b')][_0x11ec('0x1e')]||null:null,'include':_0x5f0774[_0x11ec('0x1b')]?_0x5f0774[_0x11ec('0x1b')][_0x11ec('0x21')]?_['map'](_0x5f0774['options'][_0x11ec('0x21')],function(_0x293179){return{'model':db[_0x293179[_0x11ec('0x20')]],'as':_0x293179['as'],'attributes':_0x293179[_0x11ec('0x1e')],'include':_0x293179['include']?_['map'](_0x293179[_0x11ec('0x21')],function(_0x48070c){return{'model':db[_0x48070c['model']],'as':_0x48070c['as'],'attributes':_0x48070c[_0x11ec('0x1e')],'include':_0x48070c['include']?_[_0x11ec('0x1f')](_0x48070c[_0x11ec('0x21')],function(_0x1338fb){return{'model':db[_0x1338fb[_0x11ec('0x20')]],'as':_0x1338fb['as'],'attributes':_0x1338fb[_0x11ec('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x11ec('0xd')](function(_0x5130c6){logger[_0x11ec('0xe')](_0x11ec('0x22'),_0x5f0774);logger[_0x11ec('0x10')](_0x11ec('0x22'),_0x5f0774,JSON['stringify'](_0x5130c6));_0x112383(_0x5130c6);})[_0x11ec('0x17')](function(_0x174b37){logger[_0x11ec('0x13')](_0x11ec('0x22'),_0x174b37[_0x11ec('0x15')],_0x5f0774);_0x5374dc(_0x523e3d[_0x11ec('0x13')](0x1f4,_0x174b37['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index b2d7bc1..31b1021 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x3cb054,_0x8d69ce){var _0x5f1582=function(_0x1b5751){while(--_0x1b5751){_0x3cb054['push'](_0x3cb054['shift']());}};_0x5f1582(++_0x8d69ce);}(_0xedd9,0xfc));var _0x9edd=function(_0x2b1a46,_0x41b19d){_0x2b1a46=_0x2b1a46-0x0;var _0x18f777=_0xedd9[_0x2b1a46];return _0x18f777;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _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(_0x5b5184,_0x6f5765){var _0x438acd=function(_0x200353){while(--_0x200353){_0x5b5184['push'](_0x5b5184['shift']());}};_0x438acd(++_0x6f5765);}(_0x008c,0x188));var _0xc008=function(_0x4ecedb,_0x2dffa3){_0x4ecedb=_0x4ecedb-0x0;var _0x3544cc=_0x008c[_0x4ecedb];return _0x3544cc;};'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 7859a52..a79d39a 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 _0x4ee5=['sequelize','exports','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4ee5,0xcc));var _0x54ee=function(_0x47badd,_0x3e1bc2){_0x47badd=_0x47badd-0x0;var _0x192af8=_0x4ee5[_0x47badd];return _0x192af8;};'use strict';var Sequelize=require(_0x54ee('0x0'));module[_0x54ee('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x54ee('0x2')]}}; \ No newline at end of file +var _0xd1a1=['STRING','sequelize','exports'];(function(_0x3895ef,_0x21c044){var _0x4785aa=function(_0x54d908){while(--_0x54d908){_0x3895ef['push'](_0x3895ef['shift']());}};_0x4785aa(++_0x21c044);}(_0xd1a1,0x1cc));var _0x1d1a=function(_0x51ee4d,_0x177f97){_0x51ee4d=_0x51ee4d-0x0;var _0x4734f4=_0xd1a1[_0x51ee4d];return _0x4734f4;};'use strict';var Sequelize=require(_0x1d1a('0x0'));module[_0x1d1a('0x1')]={'name':{'type':Sequelize[_0x1d1a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 655fefa..6e622fa 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 _0xe786=['../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','DeskConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','getFields','findOne','order','getSubjects','DeskField','getDescriptions','pick','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x13c367,_0x6e5907){var _0xb0dae6=function(_0x562d7d){while(--_0x562d7d){_0x13c367['push'](_0x13c367['shift']());}};_0xb0dae6(++_0x6e5907);}(_0xe786,0x12f));var _0x6e78=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xe786[_0x44bcb0];return _0xfaf881;};'use strict';var emlformat=require(_0x6e78('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e78('0x1'));var jsonpatch=require(_0x6e78('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6e78('0x3'));var Mustache=require('mustache');var util=require(_0x6e78('0x4'));var path=require(_0x6e78('0x5'));var sox=require(_0x6e78('0x6'));var csv=require(_0x6e78('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e78('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6e78('0x9'));var deskjs=require(_0x6e78('0xa'));var toCsv=require(_0x6e78('0x7'));var querystring=require(_0x6e78('0xb'));var Papa=require(_0x6e78('0xc'));var Redis=require(_0x6e78('0xd'));var authService=require(_0x6e78('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6e78('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e78('0x10'))(_0x6e78('0x11'));var utils=require(_0x6e78('0x12'));var config=require(_0x6e78('0x13'));var licenseUtil=require(_0x6e78('0x14'));var db=require(_0x6e78('0x15'))['db'];function respondWithStatusCode(_0x1ab839,_0x5cfa7a){_0x5cfa7a=_0x5cfa7a||0xcc;return function(_0x4ef330){if(_0x4ef330){return _0x1ab839[_0x6e78('0x16')](_0x5cfa7a);}return _0x1ab839['status'](_0x5cfa7a)[_0x6e78('0x17')]();};}function respondWithResult(_0x4d24b0,_0x5694af){_0x5694af=_0x5694af||0xc8;return function(_0x119854){if(_0x119854){return _0x4d24b0[_0x6e78('0x18')](_0x5694af)[_0x6e78('0x19')](_0x119854);}};}function respondWithFilteredResult(_0x300df5,_0x1cee87){return function(_0x405679){if(_0x405679){var _0xa9f2e4=typeof _0x1cee87[_0x6e78('0x1a')]==='undefined'&&typeof _0x1cee87[_0x6e78('0x1b')]===_0x6e78('0x1c');var _0xa15307=_0x405679[_0x6e78('0x1d')];var _0xd60388=_0xa9f2e4?0x0:_0x1cee87[_0x6e78('0x1a')];var _0x4362ea=_0xa9f2e4?_0x405679[_0x6e78('0x1d')]:_0x1cee87[_0x6e78('0x1a')]+_0x1cee87[_0x6e78('0x1b')];var _0x29c07b;if(_0x4362ea>=_0xa15307){_0x4362ea=_0xa15307;_0x29c07b=0xc8;}else{_0x29c07b=0xce;}_0x300df5[_0x6e78('0x18')](_0x29c07b);return _0x300df5[_0x6e78('0x1e')](_0x6e78('0x1f'),_0xd60388+'-'+_0x4362ea+'/'+_0xa15307)[_0x6e78('0x19')](_0x405679);}return null;};}function patchUpdates(_0xc7528c){return function(_0x220ae5){try{jsonpatch[_0x6e78('0x20')](_0x220ae5,_0xc7528c,!![]);}catch(_0x1ca6ea){return BPromise[_0x6e78('0x21')](_0x1ca6ea);}return _0x220ae5['save']();};}function saveUpdates(_0xc6b8fd,_0x2f5e37){return function(_0x4aedf5){if(_0x4aedf5){return _0x4aedf5[_0x6e78('0x22')](_0xc6b8fd)[_0x6e78('0x23')](function(_0x63d8ac){return _0x63d8ac;});}return null;};}function removeEntity(_0x5a7d1d,_0x16e3b1){return function(_0x4ef276){if(_0x4ef276){return _0x4ef276['destroy']()['then'](function(){_0x5a7d1d[_0x6e78('0x18')](0xcc)[_0x6e78('0x17')]();});}};}function handleEntityNotFound(_0x4af5e0,_0x5b1e86){return function(_0x67fe8a){if(!_0x67fe8a){_0x4af5e0[_0x6e78('0x16')](0x194);}return _0x67fe8a;};}function handleError(_0x1c1b19,_0x3cd562){_0x3cd562=_0x3cd562||0x1f4;return function(_0x32726d){logger[_0x6e78('0x24')](_0x32726d[_0x6e78('0x25')]);if(_0x32726d[_0x6e78('0x26')]){delete _0x32726d[_0x6e78('0x26')];}_0x1c1b19[_0x6e78('0x18')](_0x3cd562)[_0x6e78('0x27')](_0x32726d);};}exports['index']=function(_0x20c62c,_0x55cf4b){var _0x24821d={},_0x33c55b={},_0x210cd5={'count':0x0,'rows':[]};var _0x47530f=_['map'](db[_0x6e78('0x28')][_0x6e78('0x29')],function(_0x51aeb9){return{'name':_0x51aeb9[_0x6e78('0x2a')],'type':_0x51aeb9[_0x6e78('0x2b')]['key']};});_0x33c55b[_0x6e78('0x2c')]=_[_0x6e78('0x2d')](_0x47530f,'name');_0x33c55b[_0x6e78('0x2e')]=_[_0x6e78('0x2f')](_0x20c62c['query']);_0x33c55b[_0x6e78('0x30')]=_[_0x6e78('0x31')](_0x33c55b['model'],_0x33c55b['query']);_0x24821d['attributes']=_[_0x6e78('0x31')](_0x33c55b[_0x6e78('0x2c')],qs[_0x6e78('0x32')](_0x20c62c['query'][_0x6e78('0x32')]));_0x24821d[_0x6e78('0x33')]=_0x24821d[_0x6e78('0x33')][_0x6e78('0x34')]?_0x24821d[_0x6e78('0x33')]:_0x33c55b[_0x6e78('0x2c')];if(!_0x20c62c[_0x6e78('0x2e')][_0x6e78('0x35')](_0x6e78('0x36'))){_0x24821d[_0x6e78('0x1b')]=qs[_0x6e78('0x1b')](_0x20c62c['query'][_0x6e78('0x1b')]);_0x24821d[_0x6e78('0x1a')]=qs[_0x6e78('0x1a')](_0x20c62c[_0x6e78('0x2e')][_0x6e78('0x1a')]);}_0x24821d['order']=qs[_0x6e78('0x37')](_0x20c62c[_0x6e78('0x2e')][_0x6e78('0x37')]);_0x24821d['where']=qs[_0x6e78('0x30')](_['pick'](_0x20c62c[_0x6e78('0x2e')],_0x33c55b[_0x6e78('0x30')]),_0x47530f);if(_0x20c62c[_0x6e78('0x2e')][_0x6e78('0x38')]){_0x24821d['where']=_[_0x6e78('0x39')](_0x24821d[_0x6e78('0x3a')],{'$or':_[_0x6e78('0x2d')](_0x47530f,function(_0x5f01b0){if(_0x5f01b0['type']!==_0x6e78('0x3b')){var _0x1bba9c={};_0x1bba9c[_0x5f01b0[_0x6e78('0x26')]]={'$like':'%'+_0x20c62c['query']['filter']+'%'};return _0x1bba9c;}})});}_0x24821d=_['merge']({},_0x24821d,_0x20c62c[_0x6e78('0x3c')]);var _0x4ec0e1={'where':_0x24821d[_0x6e78('0x3a')]};return db[_0x6e78('0x28')][_0x6e78('0x1d')](_0x4ec0e1)['then'](function(_0x1345bc){_0x210cd5[_0x6e78('0x1d')]=_0x1345bc;if(_0x20c62c[_0x6e78('0x2e')][_0x6e78('0x3d')]){_0x24821d[_0x6e78('0x3e')]=[{'all':!![]}];}return db[_0x6e78('0x28')]['findAll'](_0x24821d);})[_0x6e78('0x23')](function(_0x4f314a){_0x210cd5[_0x6e78('0x3f')]=_0x4f314a;return _0x210cd5;})[_0x6e78('0x23')](respondWithFilteredResult(_0x55cf4b,_0x24821d))[_0x6e78('0x40')](handleError(_0x55cf4b,null));};exports[_0x6e78('0x41')]=function(_0x379ffc,_0x7497d4){var _0xff20c7={'raw':![],'where':{'id':_0x379ffc[_0x6e78('0x42')]['id']}},_0xbfdf0f={};_0xbfdf0f['model']=_[_0x6e78('0x2f')](db['DeskConfiguration'][_0x6e78('0x29')]);_0xbfdf0f[_0x6e78('0x2e')]=_['keys'](_0x379ffc['query']);_0xbfdf0f[_0x6e78('0x30')]=_[_0x6e78('0x31')](_0xbfdf0f[_0x6e78('0x2c')],_0xbfdf0f[_0x6e78('0x2e')]);_0xff20c7['attributes']=_['intersection'](_0xbfdf0f[_0x6e78('0x2c')],qs['fields'](_0x379ffc['query'][_0x6e78('0x32')]));_0xff20c7[_0x6e78('0x33')]=_0xff20c7[_0x6e78('0x33')][_0x6e78('0x34')]?_0xff20c7[_0x6e78('0x33')]:_0xbfdf0f[_0x6e78('0x2c')];if(_0x379ffc[_0x6e78('0x2e')][_0x6e78('0x3d')]){_0xff20c7[_0x6e78('0x3e')]=[{'all':!![]}];}_0xff20c7=_['merge']({},_0xff20c7,_0x379ffc[_0x6e78('0x3c')]);return db[_0x6e78('0x28')][_0x6e78('0x43')](_0xff20c7)['then'](handleEntityNotFound(_0x7497d4,null))[_0x6e78('0x23')](respondWithResult(_0x7497d4,null))[_0x6e78('0x40')](handleError(_0x7497d4,null));};exports[_0x6e78('0x44')]=function(_0x2db168,_0x5c561a){return db[_0x6e78('0x28')][_0x6e78('0x44')](_0x2db168[_0x6e78('0x45')],{})[_0x6e78('0x23')](respondWithResult(_0x5c561a,0xc9))[_0x6e78('0x40')](handleError(_0x5c561a,null));};exports[_0x6e78('0x22')]=function(_0x4507ff,_0x2fcccb){if(_0x4507ff[_0x6e78('0x45')]['id']){delete _0x4507ff[_0x6e78('0x45')]['id'];}return db[_0x6e78('0x28')][_0x6e78('0x43')]({'where':{'id':_0x4507ff[_0x6e78('0x42')]['id']}})['then'](handleEntityNotFound(_0x2fcccb,null))[_0x6e78('0x23')](saveUpdates(_0x4507ff[_0x6e78('0x45')],null))[_0x6e78('0x23')](respondWithResult(_0x2fcccb,null))[_0x6e78('0x40')](handleError(_0x2fcccb,null));};exports[_0x6e78('0x46')]=function(_0x29141e,_0x13948c){return db[_0x6e78('0x28')][_0x6e78('0x43')]({'where':{'id':_0x29141e[_0x6e78('0x42')]['id']}})[_0x6e78('0x23')](handleEntityNotFound(_0x13948c,null))[_0x6e78('0x23')](removeEntity(_0x13948c,null))[_0x6e78('0x40')](handleError(_0x13948c,null));};exports[_0x6e78('0x47')]=function(_0x3beac2,_0x6f4f53,_0x5adeeb){var _0x58a2fc={};var _0x1f83e3={};var _0x33d4a2;var _0x242cbe;return db[_0x6e78('0x28')][_0x6e78('0x48')]({'where':{'id':_0x3beac2[_0x6e78('0x42')]['id']}})[_0x6e78('0x23')](handleEntityNotFound(_0x6f4f53,null))['then'](function(_0x17f36a){if(_0x17f36a){_0x33d4a2=_0x17f36a;_0x1f83e3[_0x6e78('0x2c')]=_[_0x6e78('0x2f')](db['DeskField']['rawAttributes']);_0x1f83e3['query']=_[_0x6e78('0x2f')](_0x3beac2['query']);_0x1f83e3[_0x6e78('0x30')]=_[_0x6e78('0x31')](_0x1f83e3[_0x6e78('0x2c')],_0x1f83e3[_0x6e78('0x2e')]);_0x58a2fc[_0x6e78('0x33')]=_['intersection'](_0x1f83e3[_0x6e78('0x2c')],qs['fields'](_0x3beac2[_0x6e78('0x2e')][_0x6e78('0x32')]));_0x58a2fc[_0x6e78('0x33')]=_0x58a2fc[_0x6e78('0x33')]['length']?_0x58a2fc[_0x6e78('0x33')]:_0x1f83e3['model'];_0x58a2fc[_0x6e78('0x49')]=qs[_0x6e78('0x37')](_0x3beac2[_0x6e78('0x2e')][_0x6e78('0x37')]);_0x58a2fc[_0x6e78('0x3a')]=qs['filters'](_['pick'](_0x3beac2[_0x6e78('0x2e')],_0x1f83e3[_0x6e78('0x30')]));if(_0x3beac2[_0x6e78('0x2e')]['filter']){_0x58a2fc['where']=_[_0x6e78('0x39')](_0x58a2fc[_0x6e78('0x3a')],{'$or':_[_0x6e78('0x2d')](_0x58a2fc[_0x6e78('0x33')],function(_0x5bda0d){var _0x4301a6={};_0x4301a6[_0x5bda0d]={'$like':'%'+_0x3beac2[_0x6e78('0x2e')][_0x6e78('0x38')]+'%'};return _0x4301a6;})});}_0x58a2fc=_['merge']({},_0x58a2fc,_0x3beac2[_0x6e78('0x3c')]);return _0x33d4a2[_0x6e78('0x47')](_0x58a2fc);}})[_0x6e78('0x23')](function(_0x13be2b){if(_0x13be2b){_0x242cbe=_0x13be2b[_0x6e78('0x34')];if(!_0x3beac2['query'][_0x6e78('0x35')](_0x6e78('0x36'))){_0x58a2fc[_0x6e78('0x1b')]=qs[_0x6e78('0x1b')](_0x3beac2[_0x6e78('0x2e')][_0x6e78('0x1b')]);_0x58a2fc[_0x6e78('0x1a')]=qs['offset'](_0x3beac2[_0x6e78('0x2e')][_0x6e78('0x1a')]);}return _0x33d4a2[_0x6e78('0x47')](_0x58a2fc);}})[_0x6e78('0x23')](function(_0x52a0c9){if(_0x52a0c9){return _0x52a0c9?{'count':_0x242cbe,'rows':_0x52a0c9}:null;}})[_0x6e78('0x23')](respondWithResult(_0x6f4f53,null))[_0x6e78('0x40')](handleError(_0x6f4f53,null));};exports[_0x6e78('0x4a')]=function(_0xb3480d,_0x255e98,_0x11a176){var _0x205c51={};var _0x24f89c={};var _0x1945ab;var _0x253524;return db[_0x6e78('0x28')][_0x6e78('0x48')]({'where':{'id':_0xb3480d[_0x6e78('0x42')]['id']}})['then'](handleEntityNotFound(_0x255e98,null))[_0x6e78('0x23')](function(_0x78a44e){if(_0x78a44e){_0x1945ab=_0x78a44e;_0x24f89c[_0x6e78('0x2c')]=_[_0x6e78('0x2f')](db[_0x6e78('0x4b')][_0x6e78('0x29')]);_0x24f89c[_0x6e78('0x2e')]=_[_0x6e78('0x2f')](_0xb3480d[_0x6e78('0x2e')]);_0x24f89c['filters']=_[_0x6e78('0x31')](_0x24f89c[_0x6e78('0x2c')],_0x24f89c[_0x6e78('0x2e')]);_0x205c51['attributes']=_['intersection'](_0x24f89c['model'],qs['fields'](_0xb3480d[_0x6e78('0x2e')][_0x6e78('0x32')]));_0x205c51['attributes']=_0x205c51[_0x6e78('0x33')][_0x6e78('0x34')]?_0x205c51[_0x6e78('0x33')]:_0x24f89c['model'];_0x205c51[_0x6e78('0x49')]=qs['sort'](_0xb3480d[_0x6e78('0x2e')][_0x6e78('0x37')]);_0x205c51[_0x6e78('0x3a')]=qs['filters'](_['pick'](_0xb3480d[_0x6e78('0x2e')],_0x24f89c['filters']));if(_0xb3480d[_0x6e78('0x2e')]['filter']){_0x205c51[_0x6e78('0x3a')]=_[_0x6e78('0x39')](_0x205c51[_0x6e78('0x3a')],{'$or':_[_0x6e78('0x2d')](_0x205c51['attributes'],function(_0x4884f4){var _0x4ec03e={};_0x4ec03e[_0x4884f4]={'$like':'%'+_0xb3480d['query'][_0x6e78('0x38')]+'%'};return _0x4ec03e;})});}_0x205c51=_[_0x6e78('0x39')]({},_0x205c51,_0xb3480d[_0x6e78('0x3c')]);return _0x1945ab[_0x6e78('0x4a')](_0x205c51);}})['then'](function(_0x5a4e81){if(_0x5a4e81){_0x253524=_0x5a4e81[_0x6e78('0x34')];if(!_0xb3480d[_0x6e78('0x2e')][_0x6e78('0x35')](_0x6e78('0x36'))){_0x205c51[_0x6e78('0x1b')]=qs['limit'](_0xb3480d[_0x6e78('0x2e')]['limit']);_0x205c51[_0x6e78('0x1a')]=qs['offset'](_0xb3480d[_0x6e78('0x2e')][_0x6e78('0x1a')]);}return _0x1945ab[_0x6e78('0x4a')](_0x205c51);}})[_0x6e78('0x23')](function(_0x298816){if(_0x298816){return _0x298816?{'count':_0x253524,'rows':_0x298816}:null;}})['then'](respondWithResult(_0x255e98,null))[_0x6e78('0x40')](handleError(_0x255e98,null));};exports[_0x6e78('0x4c')]=function(_0x2d0e9a,_0x46af69,_0x2bb04a){var _0x176c65={};var _0x507295={};var _0x28bb4f;var _0x349565;return db[_0x6e78('0x28')]['findOne']({'where':{'id':_0x2d0e9a[_0x6e78('0x42')]['id']}})[_0x6e78('0x23')](handleEntityNotFound(_0x46af69,null))[_0x6e78('0x23')](function(_0xa9b4f6){if(_0xa9b4f6){_0x28bb4f=_0xa9b4f6;_0x507295['model']=_[_0x6e78('0x2f')](db[_0x6e78('0x4b')][_0x6e78('0x29')]);_0x507295['query']=_['keys'](_0x2d0e9a[_0x6e78('0x2e')]);_0x507295[_0x6e78('0x30')]=_['intersection'](_0x507295[_0x6e78('0x2c')],_0x507295[_0x6e78('0x2e')]);_0x176c65[_0x6e78('0x33')]=_[_0x6e78('0x31')](_0x507295[_0x6e78('0x2c')],qs['fields'](_0x2d0e9a['query'][_0x6e78('0x32')]));_0x176c65[_0x6e78('0x33')]=_0x176c65['attributes']['length']?_0x176c65['attributes']:_0x507295[_0x6e78('0x2c')];_0x176c65[_0x6e78('0x49')]=qs['sort'](_0x2d0e9a[_0x6e78('0x2e')][_0x6e78('0x37')]);_0x176c65['where']=qs[_0x6e78('0x30')](_[_0x6e78('0x4d')](_0x2d0e9a[_0x6e78('0x2e')],_0x507295[_0x6e78('0x30')]));if(_0x2d0e9a[_0x6e78('0x2e')][_0x6e78('0x38')]){_0x176c65[_0x6e78('0x3a')]=_['merge'](_0x176c65[_0x6e78('0x3a')],{'$or':_[_0x6e78('0x2d')](_0x176c65['attributes'],function(_0x57e1c8){var _0x254419={};_0x254419[_0x57e1c8]={'$like':'%'+_0x2d0e9a[_0x6e78('0x2e')]['filter']+'%'};return _0x254419;})});}_0x176c65=_[_0x6e78('0x39')]({},_0x176c65,_0x2d0e9a[_0x6e78('0x3c')]);return _0x28bb4f['getDescriptions'](_0x176c65);}})[_0x6e78('0x23')](function(_0x15dae6){if(_0x15dae6){_0x349565=_0x15dae6['length'];if(!_0x2d0e9a[_0x6e78('0x2e')][_0x6e78('0x35')](_0x6e78('0x36'))){_0x176c65['limit']=qs[_0x6e78('0x1b')](_0x2d0e9a['query'][_0x6e78('0x1b')]);_0x176c65[_0x6e78('0x1a')]=qs[_0x6e78('0x1a')](_0x2d0e9a[_0x6e78('0x2e')][_0x6e78('0x1a')]);}return _0x28bb4f['getDescriptions'](_0x176c65);}})[_0x6e78('0x23')](function(_0x3d42d6){if(_0x3d42d6){return _0x3d42d6?{'count':_0x349565,'rows':_0x3d42d6}:null;}})[_0x6e78('0x23')](respondWithResult(_0x46af69,null))[_0x6e78('0x40')](handleError(_0x46af69,null));};exports[_0x6e78('0x4e')]=function(_0x15c64c,_0x97a34f,_0x14a96a){var _0x5a52ff={};var _0x40730b={};var _0x23c174;var _0x50966e;return db[_0x6e78('0x28')][_0x6e78('0x48')]({'where':{'id':_0x15c64c[_0x6e78('0x42')]['id']}})[_0x6e78('0x23')](handleEntityNotFound(_0x97a34f,null))[_0x6e78('0x23')](function(_0x524087){if(_0x524087){_0x23c174=_0x524087;_0x40730b[_0x6e78('0x2c')]=_[_0x6e78('0x2f')](db[_0x6e78('0x4f')]['rawAttributes']);_0x40730b[_0x6e78('0x2e')]=_[_0x6e78('0x2f')](_0x15c64c[_0x6e78('0x2e')]);_0x40730b[_0x6e78('0x30')]=_[_0x6e78('0x31')](_0x40730b['model'],_0x40730b['query']);_0x5a52ff[_0x6e78('0x33')]=_[_0x6e78('0x31')](_0x40730b[_0x6e78('0x2c')],qs[_0x6e78('0x32')](_0x15c64c[_0x6e78('0x2e')]['fields']));_0x5a52ff[_0x6e78('0x33')]=_0x5a52ff[_0x6e78('0x33')]['length']?_0x5a52ff['attributes']:_0x40730b[_0x6e78('0x2c')];_0x5a52ff[_0x6e78('0x49')]=qs[_0x6e78('0x37')](_0x15c64c[_0x6e78('0x2e')]['sort']);_0x5a52ff['where']=qs[_0x6e78('0x30')](_[_0x6e78('0x4d')](_0x15c64c[_0x6e78('0x2e')],_0x40730b[_0x6e78('0x30')]));if(_0x15c64c[_0x6e78('0x2e')][_0x6e78('0x38')]){_0x5a52ff['where']=_['merge'](_0x5a52ff['where'],{'$or':_[_0x6e78('0x2d')](_0x5a52ff[_0x6e78('0x33')],function(_0x51c94c){var _0x5be1f8={};_0x5be1f8[_0x51c94c]={'$like':'%'+_0x15c64c[_0x6e78('0x2e')]['filter']+'%'};return _0x5be1f8;})});}_0x5a52ff=_[_0x6e78('0x39')]({},_0x5a52ff,_0x15c64c[_0x6e78('0x3c')]);return _0x23c174[_0x6e78('0x4e')](_0x5a52ff);}})[_0x6e78('0x23')](function(_0x4c6f0e){if(_0x4c6f0e){_0x50966e=_0x4c6f0e['length'];if(!_0x15c64c[_0x6e78('0x2e')][_0x6e78('0x35')](_0x6e78('0x36'))){_0x5a52ff[_0x6e78('0x1b')]=qs[_0x6e78('0x1b')](_0x15c64c['query'][_0x6e78('0x1b')]);_0x5a52ff[_0x6e78('0x1a')]=qs[_0x6e78('0x1a')](_0x15c64c[_0x6e78('0x2e')][_0x6e78('0x1a')]);}return _0x23c174[_0x6e78('0x4e')](_0x5a52ff);}})[_0x6e78('0x23')](function(_0x7a2f62){if(_0x7a2f62){return _0x7a2f62?{'count':_0x50966e,'rows':_0x7a2f62}:null;}})[_0x6e78('0x23')](respondWithResult(_0x97a34f,null))[_0x6e78('0x40')](handleError(_0x97a34f,null));};exports[_0x6e78('0x50')]=function(_0x301a79,_0xbb882f,_0x2ad7f6){if(_0x301a79[_0x6e78('0x45')]['id']){delete _0x301a79[_0x6e78('0x45')]['id'];}return db['DeskConfiguration'][_0x6e78('0x48')]({'where':{'id':_0x301a79[_0x6e78('0x42')]['id']}})[_0x6e78('0x23')](handleEntityNotFound(_0xbb882f,null))[_0x6e78('0x23')](function(_0x1b6777){if(_0x1b6777){return _0x1b6777[_0x6e78('0x50')](_0x301a79[_0x6e78('0x45')]['ids']||[]);}return null;})[_0x6e78('0x23')](respondWithResult(_0xbb882f,null))['catch'](handleError(_0xbb882f,null));}; \ No newline at end of file +var _0xe93c=['undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','DeskConfiguration','includeAll','findAll','rows','catch','show','params','include','find','create','body','getFields','findOne','DeskField','filters','filter','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json'];(function(_0x3ddf26,_0x15c898){var _0x32a6c3=function(_0x32e45f){while(--_0x32e45f){_0x3ddf26['push'](_0x3ddf26['shift']());}};_0x32a6c3(++_0x15c898);}(_0xe93c,0x8d));var _0xce93=function(_0x3077e8,_0x5ab632){_0x3077e8=_0x3077e8-0x0;var _0x2ff01e=_0xe93c[_0x3077e8];return _0x2ff01e;};'use strict';var emlformat=require(_0xce93('0x0'));var rimraf=require(_0xce93('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce93('0x2'));var rp=require(_0xce93('0x3'));var moment=require(_0xce93('0x4'));var BPromise=require(_0xce93('0x5'));var Mustache=require('mustache');var util=require(_0xce93('0x6'));var path=require(_0xce93('0x7'));var sox=require(_0xce93('0x8'));var csv=require(_0xce93('0x9'));var ejs=require(_0xce93('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce93('0xb'));var squel=require(_0xce93('0xc'));var crypto=require('crypto');var jsforce=require(_0xce93('0xd'));var deskjs=require(_0xce93('0xe'));var toCsv=require('to-csv');var querystring=require(_0xce93('0xf'));var Papa=require(_0xce93('0x10'));var Redis=require(_0xce93('0x11'));var authService=require(_0xce93('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xce93('0x13'));var hardwareService=require(_0xce93('0x14'));var logger=require(_0xce93('0x15'))(_0xce93('0x16'));var utils=require('../../config/utils');var config=require(_0xce93('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xce93('0x18'))['db'];function respondWithStatusCode(_0x34fcce,_0x2ef10d){_0x2ef10d=_0x2ef10d||0xcc;return function(_0x18f498){if(_0x18f498){return _0x34fcce[_0xce93('0x19')](_0x2ef10d);}return _0x34fcce['status'](_0x2ef10d)[_0xce93('0x1a')]();};}function respondWithResult(_0x441aaf,_0x40c77a){_0x40c77a=_0x40c77a||0xc8;return function(_0x12e342){if(_0x12e342){return _0x441aaf[_0xce93('0x1b')](_0x40c77a)[_0xce93('0x1c')](_0x12e342);}};}function respondWithFilteredResult(_0x343e3d,_0x4d986b){return function(_0x50b982){if(_0x50b982){var _0x12c8be=typeof _0x4d986b['offset']===_0xce93('0x1d')&&typeof _0x4d986b[_0xce93('0x1e')]===_0xce93('0x1d');var _0x4474be=_0x50b982[_0xce93('0x1f')];var _0x23f0eb=_0x12c8be?0x0:_0x4d986b['offset'];var _0x18dead=_0x12c8be?_0x50b982['count']:_0x4d986b[_0xce93('0x20')]+_0x4d986b[_0xce93('0x1e')];var _0x51774e;if(_0x18dead>=_0x4474be){_0x18dead=_0x4474be;_0x51774e=0xc8;}else{_0x51774e=0xce;}_0x343e3d[_0xce93('0x1b')](_0x51774e);return _0x343e3d[_0xce93('0x21')](_0xce93('0x22'),_0x23f0eb+'-'+_0x18dead+'/'+_0x4474be)[_0xce93('0x1c')](_0x50b982);}return null;};}function patchUpdates(_0x5cffc5){return function(_0x582e2d){try{jsonpatch[_0xce93('0x23')](_0x582e2d,_0x5cffc5,!![]);}catch(_0x495b65){return BPromise[_0xce93('0x24')](_0x495b65);}return _0x582e2d['save']();};}function saveUpdates(_0x4b16ca,_0x59eb07){return function(_0x391ad8){if(_0x391ad8){return _0x391ad8[_0xce93('0x25')](_0x4b16ca)[_0xce93('0x26')](function(_0x334b0d){return _0x334b0d;});}return null;};}function removeEntity(_0x176b0b,_0x2a7ffe){return function(_0x291105){if(_0x291105){return _0x291105[_0xce93('0x27')]()[_0xce93('0x26')](function(){_0x176b0b[_0xce93('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35ad73,_0x1d8b84){return function(_0x38e6da){if(!_0x38e6da){_0x35ad73[_0xce93('0x19')](0x194);}return _0x38e6da;};}function handleError(_0xd4a095,_0x1a4fff){_0x1a4fff=_0x1a4fff||0x1f4;return function(_0x2ff62c){logger[_0xce93('0x28')](_0x2ff62c['stack']);if(_0x2ff62c['name']){delete _0x2ff62c[_0xce93('0x29')];}_0xd4a095[_0xce93('0x1b')](_0x1a4fff)[_0xce93('0x2a')](_0x2ff62c);};}exports[_0xce93('0x2b')]=function(_0x3aae60,_0x563dc9){var _0xa210b9={},_0x325b92={},_0x57fe4c={'count':0x0,'rows':[]};var _0x3b66cf=_[_0xce93('0x2c')](db['DeskConfiguration'][_0xce93('0x2d')],function(_0x130807){return{'name':_0x130807['fieldName'],'type':_0x130807[_0xce93('0x2e')]['key']};});_0x325b92[_0xce93('0x2f')]=_[_0xce93('0x2c')](_0x3b66cf,_0xce93('0x29'));_0x325b92['query']=_[_0xce93('0x30')](_0x3aae60[_0xce93('0x31')]);_0x325b92['filters']=_['intersection'](_0x325b92['model'],_0x325b92[_0xce93('0x31')]);_0xa210b9['attributes']=_[_0xce93('0x32')](_0x325b92['model'],qs[_0xce93('0x33')](_0x3aae60['query'][_0xce93('0x33')]));_0xa210b9['attributes']=_0xa210b9[_0xce93('0x34')][_0xce93('0x35')]?_0xa210b9[_0xce93('0x34')]:_0x325b92['model'];if(!_0x3aae60['query'][_0xce93('0x36')]('nolimit')){_0xa210b9[_0xce93('0x1e')]=qs[_0xce93('0x1e')](_0x3aae60[_0xce93('0x31')][_0xce93('0x1e')]);_0xa210b9[_0xce93('0x20')]=qs[_0xce93('0x20')](_0x3aae60[_0xce93('0x31')][_0xce93('0x20')]);}_0xa210b9[_0xce93('0x37')]=qs[_0xce93('0x38')](_0x3aae60['query'][_0xce93('0x38')]);_0xa210b9['where']=qs['filters'](_[_0xce93('0x39')](_0x3aae60[_0xce93('0x31')],_0x325b92['filters']),_0x3b66cf);if(_0x3aae60[_0xce93('0x31')]['filter']){_0xa210b9[_0xce93('0x3a')]=_[_0xce93('0x3b')](_0xa210b9[_0xce93('0x3a')],{'$or':_[_0xce93('0x2c')](_0x3b66cf,function(_0x362c33){if(_0x362c33['type']!==_0xce93('0x3c')){var _0x5b8d90={};_0x5b8d90[_0x362c33[_0xce93('0x29')]]={'$like':'%'+_0x3aae60[_0xce93('0x31')]['filter']+'%'};return _0x5b8d90;}})});}_0xa210b9=_[_0xce93('0x3b')]({},_0xa210b9,_0x3aae60[_0xce93('0x3d')]);var _0x5ecb91={'where':_0xa210b9[_0xce93('0x3a')]};return db[_0xce93('0x3e')][_0xce93('0x1f')](_0x5ecb91)[_0xce93('0x26')](function(_0x4364c6){_0x57fe4c['count']=_0x4364c6;if(_0x3aae60[_0xce93('0x31')][_0xce93('0x3f')]){_0xa210b9['include']=[{'all':!![]}];}return db[_0xce93('0x3e')][_0xce93('0x40')](_0xa210b9);})[_0xce93('0x26')](function(_0x805e13){_0x57fe4c[_0xce93('0x41')]=_0x805e13;return _0x57fe4c;})['then'](respondWithFilteredResult(_0x563dc9,_0xa210b9))[_0xce93('0x42')](handleError(_0x563dc9,null));};exports[_0xce93('0x43')]=function(_0x5941bb,_0x5019c8){var _0x43d628={'raw':![],'where':{'id':_0x5941bb[_0xce93('0x44')]['id']}},_0x3696ae={};_0x3696ae['model']=_[_0xce93('0x30')](db[_0xce93('0x3e')]['rawAttributes']);_0x3696ae['query']=_[_0xce93('0x30')](_0x5941bb['query']);_0x3696ae['filters']=_[_0xce93('0x32')](_0x3696ae['model'],_0x3696ae[_0xce93('0x31')]);_0x43d628['attributes']=_[_0xce93('0x32')](_0x3696ae[_0xce93('0x2f')],qs[_0xce93('0x33')](_0x5941bb[_0xce93('0x31')]['fields']));_0x43d628[_0xce93('0x34')]=_0x43d628[_0xce93('0x34')]['length']?_0x43d628[_0xce93('0x34')]:_0x3696ae[_0xce93('0x2f')];if(_0x5941bb[_0xce93('0x31')][_0xce93('0x3f')]){_0x43d628[_0xce93('0x45')]=[{'all':!![]}];}_0x43d628=_[_0xce93('0x3b')]({},_0x43d628,_0x5941bb[_0xce93('0x3d')]);return db[_0xce93('0x3e')][_0xce93('0x46')](_0x43d628)[_0xce93('0x26')](handleEntityNotFound(_0x5019c8,null))[_0xce93('0x26')](respondWithResult(_0x5019c8,null))[_0xce93('0x42')](handleError(_0x5019c8,null));};exports[_0xce93('0x47')]=function(_0x75b9fb,_0x44d938){return db[_0xce93('0x3e')]['create'](_0x75b9fb['body'],{})[_0xce93('0x26')](respondWithResult(_0x44d938,0xc9))[_0xce93('0x42')](handleError(_0x44d938,null));};exports[_0xce93('0x25')]=function(_0x4f1b73,_0x1bb2f4){if(_0x4f1b73['body']['id']){delete _0x4f1b73['body']['id'];}return db[_0xce93('0x3e')]['find']({'where':{'id':_0x4f1b73['params']['id']}})[_0xce93('0x26')](handleEntityNotFound(_0x1bb2f4,null))[_0xce93('0x26')](saveUpdates(_0x4f1b73[_0xce93('0x48')],null))[_0xce93('0x26')](respondWithResult(_0x1bb2f4,null))[_0xce93('0x42')](handleError(_0x1bb2f4,null));};exports['destroy']=function(_0x112c8d,_0x1f646f){return db[_0xce93('0x3e')][_0xce93('0x46')]({'where':{'id':_0x112c8d[_0xce93('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f646f,null))[_0xce93('0x26')](removeEntity(_0x1f646f,null))[_0xce93('0x42')](handleError(_0x1f646f,null));};exports[_0xce93('0x49')]=function(_0x4642b0,_0x1c7851,_0x56f684){var _0x1b8548={};var _0x10da77={};var _0x92f08e;var _0x48df46;return db[_0xce93('0x3e')][_0xce93('0x4a')]({'where':{'id':_0x4642b0[_0xce93('0x44')]['id']}})[_0xce93('0x26')](handleEntityNotFound(_0x1c7851,null))[_0xce93('0x26')](function(_0x5642df){if(_0x5642df){_0x92f08e=_0x5642df;_0x10da77[_0xce93('0x2f')]=_['keys'](db[_0xce93('0x4b')][_0xce93('0x2d')]);_0x10da77[_0xce93('0x31')]=_[_0xce93('0x30')](_0x4642b0['query']);_0x10da77[_0xce93('0x4c')]=_[_0xce93('0x32')](_0x10da77['model'],_0x10da77['query']);_0x1b8548[_0xce93('0x34')]=_[_0xce93('0x32')](_0x10da77['model'],qs['fields'](_0x4642b0[_0xce93('0x31')][_0xce93('0x33')]));_0x1b8548['attributes']=_0x1b8548[_0xce93('0x34')][_0xce93('0x35')]?_0x1b8548[_0xce93('0x34')]:_0x10da77[_0xce93('0x2f')];_0x1b8548['order']=qs[_0xce93('0x38')](_0x4642b0[_0xce93('0x31')]['sort']);_0x1b8548[_0xce93('0x3a')]=qs[_0xce93('0x4c')](_['pick'](_0x4642b0[_0xce93('0x31')],_0x10da77[_0xce93('0x4c')]));if(_0x4642b0['query'][_0xce93('0x4d')]){_0x1b8548[_0xce93('0x3a')]=_[_0xce93('0x3b')](_0x1b8548[_0xce93('0x3a')],{'$or':_[_0xce93('0x2c')](_0x1b8548[_0xce93('0x34')],function(_0x3c552d){var _0x5bf913={};_0x5bf913[_0x3c552d]={'$like':'%'+_0x4642b0['query']['filter']+'%'};return _0x5bf913;})});}_0x1b8548=_[_0xce93('0x3b')]({},_0x1b8548,_0x4642b0[_0xce93('0x3d')]);return _0x92f08e[_0xce93('0x49')](_0x1b8548);}})['then'](function(_0x37bc4b){if(_0x37bc4b){_0x48df46=_0x37bc4b[_0xce93('0x35')];if(!_0x4642b0[_0xce93('0x31')][_0xce93('0x36')](_0xce93('0x4e'))){_0x1b8548[_0xce93('0x1e')]=qs[_0xce93('0x1e')](_0x4642b0[_0xce93('0x31')][_0xce93('0x1e')]);_0x1b8548[_0xce93('0x20')]=qs[_0xce93('0x20')](_0x4642b0[_0xce93('0x31')][_0xce93('0x20')]);}return _0x92f08e[_0xce93('0x49')](_0x1b8548);}})[_0xce93('0x26')](function(_0x2477f9){if(_0x2477f9){return _0x2477f9?{'count':_0x48df46,'rows':_0x2477f9}:null;}})[_0xce93('0x26')](respondWithResult(_0x1c7851,null))[_0xce93('0x42')](handleError(_0x1c7851,null));};exports['getSubjects']=function(_0x1c320a,_0x2ad55c,_0xb6fc1a){var _0x451d66={};var _0x43435a={};var _0x53e90f;var _0x3d9ff7;return db[_0xce93('0x3e')][_0xce93('0x4a')]({'where':{'id':_0x1c320a[_0xce93('0x44')]['id']}})[_0xce93('0x26')](handleEntityNotFound(_0x2ad55c,null))['then'](function(_0x420904){if(_0x420904){_0x53e90f=_0x420904;_0x43435a['model']=_['keys'](db[_0xce93('0x4b')][_0xce93('0x2d')]);_0x43435a['query']=_[_0xce93('0x30')](_0x1c320a[_0xce93('0x31')]);_0x43435a[_0xce93('0x4c')]=_['intersection'](_0x43435a[_0xce93('0x2f')],_0x43435a[_0xce93('0x31')]);_0x451d66['attributes']=_[_0xce93('0x32')](_0x43435a[_0xce93('0x2f')],qs['fields'](_0x1c320a[_0xce93('0x31')][_0xce93('0x33')]));_0x451d66['attributes']=_0x451d66[_0xce93('0x34')][_0xce93('0x35')]?_0x451d66[_0xce93('0x34')]:_0x43435a[_0xce93('0x2f')];_0x451d66[_0xce93('0x37')]=qs[_0xce93('0x38')](_0x1c320a['query'][_0xce93('0x38')]);_0x451d66[_0xce93('0x3a')]=qs[_0xce93('0x4c')](_[_0xce93('0x39')](_0x1c320a[_0xce93('0x31')],_0x43435a[_0xce93('0x4c')]));if(_0x1c320a[_0xce93('0x31')][_0xce93('0x4d')]){_0x451d66[_0xce93('0x3a')]=_[_0xce93('0x3b')](_0x451d66[_0xce93('0x3a')],{'$or':_[_0xce93('0x2c')](_0x451d66['attributes'],function(_0x5c6a44){var _0x50c16e={};_0x50c16e[_0x5c6a44]={'$like':'%'+_0x1c320a['query'][_0xce93('0x4d')]+'%'};return _0x50c16e;})});}_0x451d66=_[_0xce93('0x3b')]({},_0x451d66,_0x1c320a['options']);return _0x53e90f['getSubjects'](_0x451d66);}})[_0xce93('0x26')](function(_0x1a1660){if(_0x1a1660){_0x3d9ff7=_0x1a1660[_0xce93('0x35')];if(!_0x1c320a[_0xce93('0x31')]['hasOwnProperty'](_0xce93('0x4e'))){_0x451d66[_0xce93('0x1e')]=qs[_0xce93('0x1e')](_0x1c320a['query'][_0xce93('0x1e')]);_0x451d66[_0xce93('0x20')]=qs[_0xce93('0x20')](_0x1c320a[_0xce93('0x31')][_0xce93('0x20')]);}return _0x53e90f[_0xce93('0x4f')](_0x451d66);}})[_0xce93('0x26')](function(_0x996044){if(_0x996044){return _0x996044?{'count':_0x3d9ff7,'rows':_0x996044}:null;}})[_0xce93('0x26')](respondWithResult(_0x2ad55c,null))[_0xce93('0x42')](handleError(_0x2ad55c,null));};exports[_0xce93('0x50')]=function(_0x26b359,_0x2c199b,_0x1a092d){var _0x216db3={};var _0x451770={};var _0x1d45a8;var _0xea9d17;return db['DeskConfiguration']['findOne']({'where':{'id':_0x26b359[_0xce93('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c199b,null))['then'](function(_0x41f8a4){if(_0x41f8a4){_0x1d45a8=_0x41f8a4;_0x451770['model']=_[_0xce93('0x30')](db[_0xce93('0x4b')][_0xce93('0x2d')]);_0x451770[_0xce93('0x31')]=_[_0xce93('0x30')](_0x26b359[_0xce93('0x31')]);_0x451770[_0xce93('0x4c')]=_[_0xce93('0x32')](_0x451770[_0xce93('0x2f')],_0x451770[_0xce93('0x31')]);_0x216db3['attributes']=_[_0xce93('0x32')](_0x451770[_0xce93('0x2f')],qs[_0xce93('0x33')](_0x26b359[_0xce93('0x31')][_0xce93('0x33')]));_0x216db3[_0xce93('0x34')]=_0x216db3['attributes']['length']?_0x216db3[_0xce93('0x34')]:_0x451770['model'];_0x216db3[_0xce93('0x37')]=qs[_0xce93('0x38')](_0x26b359['query'][_0xce93('0x38')]);_0x216db3[_0xce93('0x3a')]=qs[_0xce93('0x4c')](_['pick'](_0x26b359['query'],_0x451770[_0xce93('0x4c')]));if(_0x26b359[_0xce93('0x31')][_0xce93('0x4d')]){_0x216db3['where']=_[_0xce93('0x3b')](_0x216db3[_0xce93('0x3a')],{'$or':_[_0xce93('0x2c')](_0x216db3[_0xce93('0x34')],function(_0x433546){var _0x402272={};_0x402272[_0x433546]={'$like':'%'+_0x26b359[_0xce93('0x31')]['filter']+'%'};return _0x402272;})});}_0x216db3=_[_0xce93('0x3b')]({},_0x216db3,_0x26b359['options']);return _0x1d45a8[_0xce93('0x50')](_0x216db3);}})[_0xce93('0x26')](function(_0x1ccfd0){if(_0x1ccfd0){_0xea9d17=_0x1ccfd0['length'];if(!_0x26b359['query'][_0xce93('0x36')](_0xce93('0x4e'))){_0x216db3[_0xce93('0x1e')]=qs[_0xce93('0x1e')](_0x26b359['query']['limit']);_0x216db3['offset']=qs[_0xce93('0x20')](_0x26b359[_0xce93('0x31')]['offset']);}return _0x1d45a8[_0xce93('0x50')](_0x216db3);}})[_0xce93('0x26')](function(_0x1446a7){if(_0x1446a7){return _0x1446a7?{'count':_0xea9d17,'rows':_0x1446a7}:null;}})[_0xce93('0x26')](respondWithResult(_0x2c199b,null))[_0xce93('0x42')](handleError(_0x2c199b,null));};exports[_0xce93('0x51')]=function(_0x36bce2,_0x154f87,_0x50f291){var _0x46f348={};var _0x2c8f80={};var _0x1e888b;var _0x56f4ef;return db[_0xce93('0x3e')][_0xce93('0x4a')]({'where':{'id':_0x36bce2['params']['id']}})[_0xce93('0x26')](handleEntityNotFound(_0x154f87,null))['then'](function(_0x3384b3){if(_0x3384b3){_0x1e888b=_0x3384b3;_0x2c8f80[_0xce93('0x2f')]=_[_0xce93('0x30')](db[_0xce93('0x52')][_0xce93('0x2d')]);_0x2c8f80['query']=_[_0xce93('0x30')](_0x36bce2[_0xce93('0x31')]);_0x2c8f80[_0xce93('0x4c')]=_[_0xce93('0x32')](_0x2c8f80['model'],_0x2c8f80[_0xce93('0x31')]);_0x46f348['attributes']=_[_0xce93('0x32')](_0x2c8f80['model'],qs[_0xce93('0x33')](_0x36bce2[_0xce93('0x31')][_0xce93('0x33')]));_0x46f348[_0xce93('0x34')]=_0x46f348[_0xce93('0x34')][_0xce93('0x35')]?_0x46f348[_0xce93('0x34')]:_0x2c8f80['model'];_0x46f348['order']=qs[_0xce93('0x38')](_0x36bce2[_0xce93('0x31')][_0xce93('0x38')]);_0x46f348[_0xce93('0x3a')]=qs[_0xce93('0x4c')](_[_0xce93('0x39')](_0x36bce2[_0xce93('0x31')],_0x2c8f80['filters']));if(_0x36bce2['query']['filter']){_0x46f348[_0xce93('0x3a')]=_[_0xce93('0x3b')](_0x46f348['where'],{'$or':_['map'](_0x46f348['attributes'],function(_0x1d3756){var _0x19fed3={};_0x19fed3[_0x1d3756]={'$like':'%'+_0x36bce2['query'][_0xce93('0x4d')]+'%'};return _0x19fed3;})});}_0x46f348=_[_0xce93('0x3b')]({},_0x46f348,_0x36bce2['options']);return _0x1e888b[_0xce93('0x51')](_0x46f348);}})[_0xce93('0x26')](function(_0x14f0d8){if(_0x14f0d8){_0x56f4ef=_0x14f0d8[_0xce93('0x35')];if(!_0x36bce2[_0xce93('0x31')]['hasOwnProperty'](_0xce93('0x4e'))){_0x46f348[_0xce93('0x1e')]=qs[_0xce93('0x1e')](_0x36bce2['query']['limit']);_0x46f348[_0xce93('0x20')]=qs['offset'](_0x36bce2[_0xce93('0x31')][_0xce93('0x20')]);}return _0x1e888b[_0xce93('0x51')](_0x46f348);}})[_0xce93('0x26')](function(_0x183518){if(_0x183518){return _0x183518?{'count':_0x56f4ef,'rows':_0x183518}:null;}})[_0xce93('0x26')](respondWithResult(_0x154f87,null))[_0xce93('0x42')](handleError(_0x154f87,null));};exports['setTags']=function(_0x3bd0d3,_0x29d365,_0x5187b5){if(_0x3bd0d3[_0xce93('0x48')]['id']){delete _0x3bd0d3[_0xce93('0x48')]['id'];}return db[_0xce93('0x3e')][_0xce93('0x4a')]({'where':{'id':_0x3bd0d3[_0xce93('0x44')]['id']}})[_0xce93('0x26')](handleEntityNotFound(_0x29d365,null))[_0xce93('0x26')](function(_0x4fb6d6){if(_0x4fb6d6){return _0x4fb6d6[_0xce93('0x53')](_0x3bd0d3[_0xce93('0x48')][_0xce93('0x54')]||[]);}return null;})[_0xce93('0x26')](respondWithResult(_0x29d365,null))[_0xce93('0x42')](handleError(_0x29d365,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 5633105..b86d40c 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 _0xca21=['exports','define','int_desk_configurations','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xca21,0xcf));var _0x1ca2=function(_0x58281b,_0x4cc135){_0x58281b=_0x58281b-0x0;var _0x43251c=_0xca21[_0x58281b];return _0x43251c;};'use strict';var _=require(_0x1ca2('0x0'));var util=require(_0x1ca2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1ca2('0x2'));var BPromise=require(_0x1ca2('0x3'));var rp=require(_0x1ca2('0x4'));var fs=require('fs');var path=require(_0x1ca2('0x5'));var rimraf=require(_0x1ca2('0x6'));var config=require(_0x1ca2('0x7'));var attributes=require(_0x1ca2('0x8'));module[_0x1ca2('0x9')]=function(_0x51556b,_0x4f5d05){return _0x51556b[_0x1ca2('0xa')]('DeskConfiguration',attributes,{'tableName':_0x1ca2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabdb=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DeskConfiguration','int_desk_configurations','util','../../config/logger'];(function(_0x528fc1,_0x5b7bc2){var _0x1093e5=function(_0x1578ec){while(--_0x1578ec){_0x528fc1['push'](_0x528fc1['shift']());}};_0x1093e5(++_0x5b7bc2);}(_0xabdb,0xbe));var _0xbabd=function(_0x1ede3e,_0x441c15){_0x1ede3e=_0x1ede3e-0x0;var _0x311f28=_0xabdb[_0x1ede3e];return _0x311f28;};'use strict';var _=require('lodash');var util=require(_0xbabd('0x0'));var logger=require(_0xbabd('0x1'))(_0xbabd('0x2'));var moment=require('moment');var BPromise=require(_0xbabd('0x3'));var rp=require(_0xbabd('0x4'));var fs=require('fs');var path=require(_0xbabd('0x5'));var rimraf=require(_0xbabd('0x6'));var config=require(_0xbabd('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0xbabd('0x8')]=function(_0x396007,_0x199935){return _0x396007[_0xbabd('0x9')](_0xbabd('0xa'),attributes,{'tableName':_0xbabd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 10ed6b1..2c54422 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 _0x30d4=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x30f878,_0x61db8d){var _0x17092e=function(_0x36c1b8){while(--_0x36c1b8){_0x30f878['push'](_0x30f878['shift']());}};_0x17092e(++_0x61db8d);}(_0x30d4,0xed));var _0x430d=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x30d4[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0x430d('0x0'));var util=require(_0x430d('0x1'));var moment=require(_0x430d('0x2'));var BPromise=require('bluebird');var rs=require(_0x430d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x430d('0x4'))['db'];var utils=require(_0x430d('0x5'));var logger=require('../../config/logger')(_0x430d('0x6'));var config=require(_0x430d('0x7'));var jayson=require(_0x430d('0x8'));var client=jayson[_0x430d('0x9')][_0x430d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4951a0,_0x391fe8,_0x2d8c1d){return new BPromise(function(_0x16a932,_0x3dfc84){return client['request'](_0x4951a0,_0x2d8c1d)['then'](function(_0x2ea388){logger[_0x430d('0xb')](_0x430d('0xc'),_0x391fe8,_0x430d('0xd'));logger[_0x430d('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x391fe8,_0x430d('0xd'),JSON[_0x430d('0xf')](_0x2ea388));if(_0x2ea388[_0x430d('0x10')]){if(_0x2ea388[_0x430d('0x10')][_0x430d('0x11')]===0x1f4){logger[_0x430d('0x10')](_0x430d('0xc'),_0x391fe8,_0x2ea388['error'][_0x430d('0x12')]);return _0x3dfc84(_0x2ea388['error']['message']);}logger['error'](_0x430d('0xc'),_0x391fe8,_0x2ea388['error']['message']);return _0x16a932(_0x2ea388[_0x430d('0x10')][_0x430d('0x12')]);}else{logger[_0x430d('0xb')](_0x430d('0xc'),_0x391fe8,_0x430d('0xd'));_0x16a932(_0x2ea388['result']['message']);}})[_0x430d('0x13')](function(_0x19e448){logger['error'](_0x430d('0xc'),_0x391fe8,_0x19e448);_0x3dfc84(_0x19e448);});});} \ No newline at end of file +var _0x4b38=['catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x351926,_0x5bae6b){var _0x42d721=function(_0x5e3a85){while(--_0x5e3a85){_0x351926['push'](_0x351926['shift']());}};_0x42d721(++_0x5bae6b);}(_0x4b38,0x157));var _0x84b3=function(_0x576828,_0x229282){_0x576828=_0x576828-0x0;var _0x15e1d4=_0x4b38[_0x576828];return _0x15e1d4;};'use strict';var _=require(_0x84b3('0x0'));var util=require('util');var moment=require(_0x84b3('0x1'));var BPromise=require('bluebird');var rs=require(_0x84b3('0x2'));var fs=require('fs');var Redis=require(_0x84b3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x84b3('0x4'));var logger=require(_0x84b3('0x5'))('rpc');var config=require(_0x84b3('0x6'));var jayson=require(_0x84b3('0x7'));var client=jayson['client'][_0x84b3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4887ac,_0x3c6b39,_0x4ce704){return new BPromise(function(_0x368bf1,_0x1084b0){return client['request'](_0x4887ac,_0x4ce704)['then'](function(_0xd18247){logger[_0x84b3('0x9')](_0x84b3('0xa'),_0x3c6b39,_0x84b3('0xb'));logger['debug'](_0x84b3('0xc'),_0x3c6b39,_0x84b3('0xb'),JSON[_0x84b3('0xd')](_0xd18247));if(_0xd18247[_0x84b3('0xe')]){if(_0xd18247['error'][_0x84b3('0xf')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3c6b39,_0xd18247[_0x84b3('0xe')][_0x84b3('0x10')]);return _0x1084b0(_0xd18247[_0x84b3('0xe')][_0x84b3('0x10')]);}logger[_0x84b3('0xe')](_0x84b3('0xa'),_0x3c6b39,_0xd18247[_0x84b3('0xe')][_0x84b3('0x10')]);return _0x368bf1(_0xd18247['error'][_0x84b3('0x10')]);}else{logger[_0x84b3('0x9')](_0x84b3('0xa'),_0x3c6b39,_0x84b3('0xb'));_0x368bf1(_0xd18247[_0x84b3('0x11')][_0x84b3('0x10')]);}})[_0x84b3('0x12')](function(_0xd96ba9){logger[_0x84b3('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x3c6b39,_0xd96ba9);_0x1084b0(_0xd96ba9);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index df5e42b..3f036ca 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 _0xc9a0=['../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x325388,_0x4bef2c){var _0x384848=function(_0x4434fd){while(--_0x4434fd){_0x325388['push'](_0x325388['shift']());}};_0x384848(++_0x4bef2c);}(_0xc9a0,0x12c));var _0x0c9a=function(_0x2b4153,_0x12d809){_0x2b4153=_0x2b4153-0x0;var _0x3abd2f=_0xc9a0[_0x2b4153];return _0x3abd2f;};'use strict';var multer=require(_0x0c9a('0x0'));var util=require(_0x0c9a('0x1'));var path=require('path');var timeout=require(_0x0c9a('0x2'));var express=require(_0x0c9a('0x3'));var router=express[_0x0c9a('0x4')]();var fs_extra=require(_0x0c9a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0c9a('0x6'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0x0c9a('0x7')]('/',auth[_0x0c9a('0x8')](),controller[_0x0c9a('0x9')]);router['get']('/:id',auth[_0x0c9a('0x8')](),controller[_0x0c9a('0xa')]);router[_0x0c9a('0xb')]('/',auth['isAuthenticated'](),controller[_0x0c9a('0xc')]);router[_0x0c9a('0xd')](_0x0c9a('0xe'),auth['isAuthenticated'](),controller[_0x0c9a('0xf')]);router[_0x0c9a('0x10')](_0x0c9a('0xe'),auth[_0x0c9a('0x8')](),controller[_0x0c9a('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0c01=['post','create','put','/:id','update','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated'];(function(_0x499c7f,_0x2d8184){var _0x433bee=function(_0xd1543a){while(--_0xd1543a){_0x499c7f['push'](_0x499c7f['shift']());}};_0x433bee(++_0x2d8184);}(_0x0c01,0x10f));var _0x10c0=function(_0x31cee5,_0x4d8a19){_0x31cee5=_0x31cee5-0x0;var _0x3181b4=_0x0c01[_0x31cee5];return _0x3181b4;};'use strict';var multer=require(_0x10c0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x10c0('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x10c0('0x2'));var auth=require(_0x10c0('0x3'));var interaction=require(_0x10c0('0x4'));var config=require(_0x10c0('0x5'));var controller=require(_0x10c0('0x6'));router[_0x10c0('0x7')]('/',auth[_0x10c0('0x8')](),controller['index']);router[_0x10c0('0x7')]('/:id',auth[_0x10c0('0x8')](),controller['show']);router[_0x10c0('0x9')]('/',auth[_0x10c0('0x8')](),controller[_0x10c0('0xa')]);router[_0x10c0('0xb')](_0x10c0('0xc'),auth[_0x10c0('0x8')](),controller[_0x10c0('0xd')]);router['delete'](_0x10c0('0xc'),auth[_0x10c0('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 0e17d45..370a184 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 _0xb0b2=['STRING','variable','customVariable','BOOLEAN','sequelize','ENUM','string','keyValue'];(function(_0x2ac6ef,_0xeaebbf){var _0x17f044=function(_0x41629b){while(--_0x41629b){_0x2ac6ef['push'](_0x2ac6ef['shift']());}};_0x17f044(++_0xeaebbf);}(_0xb0b2,0x124));var _0x2b0b=function(_0x2bcd56,_0x1e76eb){_0x2bcd56=_0x2bcd56-0x0;var _0x10052f=_0xb0b2[_0x2bcd56];return _0x10052f;};'use strict';var Sequelize=require(_0x2b0b('0x0'));module['exports']={'type':{'type':Sequelize[_0x2b0b('0x1')](_0x2b0b('0x2'),'variable','customVariable',_0x2b0b('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2b0b('0x4')]},'key':{'type':Sequelize[_0x2b0b('0x4')]},'keyType':{'type':Sequelize[_0x2b0b('0x1')](_0x2b0b('0x2'),_0x2b0b('0x5'),_0x2b0b('0x6'))},'keyContent':{'type':Sequelize[_0x2b0b('0x4')]},'idField':{'type':Sequelize[_0x2b0b('0x4')]},'nameField':{'type':Sequelize[_0x2b0b('0x4')]},'customField':{'type':Sequelize[_0x2b0b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc0a6=['picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x4a035a,_0x18fee7){var _0x18bf30=function(_0x5b8796){while(--_0x5b8796){_0x4a035a['push'](_0x4a035a['shift']());}};_0x18bf30(++_0x18fee7);}(_0xc0a6,0xf6));var _0x6c0a=function(_0x2e0317,_0x5e0741){_0x2e0317=_0x2e0317-0x0;var _0x122d55=_0xc0a6[_0x2e0317];return _0x122d55;};'use strict';var Sequelize=require(_0x6c0a('0x0'));module['exports']={'type':{'type':Sequelize[_0x6c0a('0x1')](_0x6c0a('0x2'),_0x6c0a('0x3'),_0x6c0a('0x4'),_0x6c0a('0x5'),_0x6c0a('0x6')),'defaultValue':_0x6c0a('0x2')},'content':{'type':Sequelize[_0x6c0a('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6c0a('0x1')]('string','variable',_0x6c0a('0x4'))},'keyContent':{'type':Sequelize[_0x6c0a('0x7')]},'idField':{'type':Sequelize[_0x6c0a('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6c0a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6c0a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 5ebfb03..3f41a0c 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 _0x0aee=['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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','save','update','destroy','then','name','send','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','options','DeskField','count','includeAll','findAll','params','fields','length','include','find','catch','create','body','eml-format','zip-dir','request-promise','mustache','util','path','to-csv'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0x0aee,0x1a3));var _0xe0ae=function(_0xd9c7d3,_0x478e9b){_0xd9c7d3=_0xd9c7d3-0x0;var _0x55e790=_0x0aee[_0xd9c7d3];return _0x55e790;};'use strict';var emlformat=require(_0xe0ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0ae('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe0ae('0x3'));var util=require(_0xe0ae('0x4'));var path=require(_0xe0ae('0x5'));var sox=require('sox');var csv=require(_0xe0ae('0x6'));var ejs=require(_0xe0ae('0x7'));var fs=require('fs');var fs_extra=require(_0xe0ae('0x8'));var _=require(_0xe0ae('0x9'));var squel=require(_0xe0ae('0xa'));var crypto=require(_0xe0ae('0xb'));var jsforce=require(_0xe0ae('0xc'));var deskjs=require(_0xe0ae('0xd'));var toCsv=require(_0xe0ae('0x6'));var querystring=require(_0xe0ae('0xe'));var Papa=require(_0xe0ae('0xf'));var Redis=require(_0xe0ae('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe0ae('0x11'));var as=require(_0xe0ae('0x12'));var hardwareService=require(_0xe0ae('0x13'));var logger=require(_0xe0ae('0x14'))(_0xe0ae('0x15'));var utils=require(_0xe0ae('0x16'));var config=require(_0xe0ae('0x17'));var licenseUtil=require(_0xe0ae('0x18'));var db=require(_0xe0ae('0x19'))['db'];function respondWithStatusCode(_0x35c2c4,_0xf431bf){_0xf431bf=_0xf431bf||0xcc;return function(_0x1e93d4){if(_0x1e93d4){return _0x35c2c4[_0xe0ae('0x1a')](_0xf431bf);}return _0x35c2c4[_0xe0ae('0x1b')](_0xf431bf)[_0xe0ae('0x1c')]();};}function respondWithResult(_0x41f551,_0xae9fb7){_0xae9fb7=_0xae9fb7||0xc8;return function(_0xd4e85f){if(_0xd4e85f){return _0x41f551[_0xe0ae('0x1b')](_0xae9fb7)[_0xe0ae('0x1d')](_0xd4e85f);}};}function respondWithFilteredResult(_0x460b37,_0x1c2143){return function(_0x374d63){if(_0x374d63){var _0x3bc4e4=typeof _0x1c2143[_0xe0ae('0x1e')]===_0xe0ae('0x1f')&&typeof _0x1c2143[_0xe0ae('0x20')]===_0xe0ae('0x1f');var _0x389c27=_0x374d63['count'];var _0x338944=_0x3bc4e4?0x0:_0x1c2143[_0xe0ae('0x1e')];var _0x3186d4=_0x3bc4e4?_0x374d63['count']:_0x1c2143[_0xe0ae('0x1e')]+_0x1c2143['limit'];var _0x495928;if(_0x3186d4>=_0x389c27){_0x3186d4=_0x389c27;_0x495928=0xc8;}else{_0x495928=0xce;}_0x460b37['status'](_0x495928);return _0x460b37['set']('Content-Range',_0x338944+'-'+_0x3186d4+'/'+_0x389c27)['json'](_0x374d63);}return null;};}function patchUpdates(_0x11ddd0){return function(_0x38aa56){try{jsonpatch[_0xe0ae('0x21')](_0x38aa56,_0x11ddd0,!![]);}catch(_0x33ce62){return BPromise['reject'](_0x33ce62);}return _0x38aa56[_0xe0ae('0x22')]();};}function saveUpdates(_0x35dd73,_0x49c632){return function(_0x310060){if(_0x310060){return _0x310060[_0xe0ae('0x23')](_0x35dd73)['then'](function(_0x210bcb){return _0x210bcb;});}return null;};}function removeEntity(_0x4b82e3,_0x3948c1){return function(_0x4435f2){if(_0x4435f2){return _0x4435f2[_0xe0ae('0x24')]()[_0xe0ae('0x25')](function(){_0x4b82e3[_0xe0ae('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x363614,_0x409ac2){return function(_0x1ef449){if(!_0x1ef449){_0x363614[_0xe0ae('0x1a')](0x194);}return _0x1ef449;};}function handleError(_0x5cfa33,_0x47cfb6){_0x47cfb6=_0x47cfb6||0x1f4;return function(_0x1025f0){logger['error'](_0x1025f0['stack']);if(_0x1025f0[_0xe0ae('0x26')]){delete _0x1025f0[_0xe0ae('0x26')];}_0x5cfa33['status'](_0x47cfb6)[_0xe0ae('0x27')](_0x1025f0);};}exports['index']=function(_0xb0776a,_0x363f03){var _0x2e9b62={},_0x249afa={},_0x18d0d2={'count':0x0,'rows':[]};var _0x575d5e=_['map'](db['DeskField'][_0xe0ae('0x28')],function(_0x4a625d){return{'name':_0x4a625d[_0xe0ae('0x29')],'type':_0x4a625d['type']['key']};});_0x249afa[_0xe0ae('0x2a')]=_['map'](_0x575d5e,_0xe0ae('0x26'));_0x249afa[_0xe0ae('0x2b')]=_[_0xe0ae('0x2c')](_0xb0776a[_0xe0ae('0x2b')]);_0x249afa[_0xe0ae('0x2d')]=_[_0xe0ae('0x2e')](_0x249afa[_0xe0ae('0x2a')],_0x249afa[_0xe0ae('0x2b')]);_0x2e9b62[_0xe0ae('0x2f')]=_[_0xe0ae('0x2e')](_0x249afa[_0xe0ae('0x2a')],qs['fields'](_0xb0776a['query']['fields']));_0x2e9b62[_0xe0ae('0x2f')]=_0x2e9b62[_0xe0ae('0x2f')]['length']?_0x2e9b62[_0xe0ae('0x2f')]:_0x249afa[_0xe0ae('0x2a')];if(!_0xb0776a['query'][_0xe0ae('0x30')](_0xe0ae('0x31'))){_0x2e9b62[_0xe0ae('0x20')]=qs[_0xe0ae('0x20')](_0xb0776a[_0xe0ae('0x2b')]['limit']);_0x2e9b62['offset']=qs['offset'](_0xb0776a[_0xe0ae('0x2b')][_0xe0ae('0x1e')]);}_0x2e9b62[_0xe0ae('0x32')]=qs['sort'](_0xb0776a[_0xe0ae('0x2b')][_0xe0ae('0x33')]);_0x2e9b62[_0xe0ae('0x34')]=qs[_0xe0ae('0x2d')](_['pick'](_0xb0776a[_0xe0ae('0x2b')],_0x249afa['filters']),_0x575d5e);if(_0xb0776a['query'][_0xe0ae('0x35')]){_0x2e9b62['where']=_[_0xe0ae('0x36')](_0x2e9b62[_0xe0ae('0x34')],{'$or':_[_0xe0ae('0x37')](_0x575d5e,function(_0x235ff6){if(_0x235ff6[_0xe0ae('0x38')]!==_0xe0ae('0x39')){var _0x98faa={};_0x98faa[_0x235ff6[_0xe0ae('0x26')]]={'$like':'%'+_0xb0776a[_0xe0ae('0x2b')]['filter']+'%'};return _0x98faa;}})});}_0x2e9b62=_['merge']({},_0x2e9b62,_0xb0776a[_0xe0ae('0x3a')]);var _0x4029b6={'where':_0x2e9b62['where']};return db[_0xe0ae('0x3b')][_0xe0ae('0x3c')](_0x4029b6)[_0xe0ae('0x25')](function(_0x4569c6){_0x18d0d2[_0xe0ae('0x3c')]=_0x4569c6;if(_0xb0776a[_0xe0ae('0x2b')][_0xe0ae('0x3d')]){_0x2e9b62['include']=[{'all':!![]}];}return db[_0xe0ae('0x3b')][_0xe0ae('0x3e')](_0x2e9b62);})['then'](function(_0x373012){_0x18d0d2['rows']=_0x373012;return _0x18d0d2;})[_0xe0ae('0x25')](respondWithFilteredResult(_0x363f03,_0x2e9b62))['catch'](handleError(_0x363f03,null));};exports['show']=function(_0x4176c8,_0x5c5f4d){var _0x6f6785={'raw':!![],'where':{'id':_0x4176c8[_0xe0ae('0x3f')]['id']}},_0x53a0d2={};_0x53a0d2[_0xe0ae('0x2a')]=_[_0xe0ae('0x2c')](db[_0xe0ae('0x3b')][_0xe0ae('0x28')]);_0x53a0d2[_0xe0ae('0x2b')]=_[_0xe0ae('0x2c')](_0x4176c8[_0xe0ae('0x2b')]);_0x53a0d2[_0xe0ae('0x2d')]=_['intersection'](_0x53a0d2['model'],_0x53a0d2['query']);_0x6f6785['attributes']=_[_0xe0ae('0x2e')](_0x53a0d2[_0xe0ae('0x2a')],qs[_0xe0ae('0x40')](_0x4176c8[_0xe0ae('0x2b')][_0xe0ae('0x40')]));_0x6f6785['attributes']=_0x6f6785[_0xe0ae('0x2f')][_0xe0ae('0x41')]?_0x6f6785['attributes']:_0x53a0d2['model'];if(_0x4176c8[_0xe0ae('0x2b')][_0xe0ae('0x3d')]){_0x6f6785[_0xe0ae('0x42')]=[{'all':!![]}];}_0x6f6785=_[_0xe0ae('0x36')]({},_0x6f6785,_0x4176c8[_0xe0ae('0x3a')]);return db[_0xe0ae('0x3b')][_0xe0ae('0x43')](_0x6f6785)[_0xe0ae('0x25')](handleEntityNotFound(_0x5c5f4d,null))[_0xe0ae('0x25')](respondWithResult(_0x5c5f4d,null))[_0xe0ae('0x44')](handleError(_0x5c5f4d,null));};exports[_0xe0ae('0x45')]=function(_0x2bfb37,_0x163246){return db[_0xe0ae('0x3b')][_0xe0ae('0x45')](_0x2bfb37[_0xe0ae('0x46')],{})['then'](respondWithResult(_0x163246,0xc9))[_0xe0ae('0x44')](handleError(_0x163246,null));};exports[_0xe0ae('0x23')]=function(_0x30f150,_0x35d1b3){if(_0x30f150[_0xe0ae('0x46')]['id']){delete _0x30f150[_0xe0ae('0x46')]['id'];}return db[_0xe0ae('0x3b')][_0xe0ae('0x43')]({'where':{'id':_0x30f150[_0xe0ae('0x3f')]['id']}})[_0xe0ae('0x25')](handleEntityNotFound(_0x35d1b3,null))[_0xe0ae('0x25')](saveUpdates(_0x30f150[_0xe0ae('0x46')],null))[_0xe0ae('0x25')](respondWithResult(_0x35d1b3,null))[_0xe0ae('0x44')](handleError(_0x35d1b3,null));};exports['destroy']=function(_0x540463,_0x4ab004){return db[_0xe0ae('0x3b')]['find']({'where':{'id':_0x540463[_0xe0ae('0x3f')]['id']}})[_0xe0ae('0x25')](handleEntityNotFound(_0x4ab004,null))[_0xe0ae('0x25')](removeEntity(_0x4ab004,null))[_0xe0ae('0x44')](handleError(_0x4ab004,null));}; \ No newline at end of file +var _0x647c=['DeskField','include','rows','catch','show','params','includeAll','find','create','body','update','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','destroy','then','end','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options'];(function(_0x20fbb6,_0x3271e1){var _0x3f88ea=function(_0x43771d){while(--_0x43771d){_0x20fbb6['push'](_0x20fbb6['shift']());}};_0x3f88ea(++_0x3271e1);}(_0x647c,0x1d3));var _0xc647=function(_0x33c65a,_0x2fa474){_0x33c65a=_0x33c65a-0x0;var _0x55b76e=_0x647c[_0x33c65a];return _0x55b76e;};'use strict';var emlformat=require(_0xc647('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc647('0x1'));var jsonpatch=require(_0xc647('0x2'));var rp=require('request-promise');var moment=require(_0xc647('0x3'));var BPromise=require(_0xc647('0x4'));var Mustache=require(_0xc647('0x5'));var util=require(_0xc647('0x6'));var path=require(_0xc647('0x7'));var sox=require('sox');var csv=require(_0xc647('0x8'));var ejs=require(_0xc647('0x9'));var fs=require('fs');var fs_extra=require(_0xc647('0xa'));var _=require(_0xc647('0xb'));var squel=require(_0xc647('0xc'));var crypto=require(_0xc647('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc647('0x8'));var querystring=require(_0xc647('0xe'));var Papa=require(_0xc647('0xf'));var Redis=require('ioredis');var authService=require(_0xc647('0x10'));var qs=require(_0xc647('0x11'));var as=require(_0xc647('0x12'));var hardwareService=require(_0xc647('0x13'));var logger=require(_0xc647('0x14'))(_0xc647('0x15'));var utils=require(_0xc647('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc647('0x17'));var db=require(_0xc647('0x18'))['db'];function respondWithStatusCode(_0x333ed0,_0x3afba2){_0x3afba2=_0x3afba2||0xcc;return function(_0x145933){if(_0x145933){return _0x333ed0[_0xc647('0x19')](_0x3afba2);}return _0x333ed0[_0xc647('0x1a')](_0x3afba2)['end']();};}function respondWithResult(_0x4d3dc3,_0x7e11a0){_0x7e11a0=_0x7e11a0||0xc8;return function(_0x4b57f1){if(_0x4b57f1){return _0x4d3dc3[_0xc647('0x1a')](_0x7e11a0)['json'](_0x4b57f1);}};}function respondWithFilteredResult(_0x353831,_0x46d496){return function(_0x2be197){if(_0x2be197){var _0x5a479a=typeof _0x46d496[_0xc647('0x1b')]===_0xc647('0x1c')&&typeof _0x46d496['limit']===_0xc647('0x1c');var _0x1c1db0=_0x2be197[_0xc647('0x1d')];var _0x407756=_0x5a479a?0x0:_0x46d496[_0xc647('0x1b')];var _0x1f502b=_0x5a479a?_0x2be197['count']:_0x46d496['offset']+_0x46d496[_0xc647('0x1e')];var _0x2b1f5a;if(_0x1f502b>=_0x1c1db0){_0x1f502b=_0x1c1db0;_0x2b1f5a=0xc8;}else{_0x2b1f5a=0xce;}_0x353831[_0xc647('0x1a')](_0x2b1f5a);return _0x353831[_0xc647('0x1f')](_0xc647('0x20'),_0x407756+'-'+_0x1f502b+'/'+_0x1c1db0)[_0xc647('0x21')](_0x2be197);}return null;};}function patchUpdates(_0x5494b7){return function(_0x35b36d){try{jsonpatch[_0xc647('0x22')](_0x35b36d,_0x5494b7,!![]);}catch(_0x13f94d){return BPromise[_0xc647('0x23')](_0x13f94d);}return _0x35b36d['save']();};}function saveUpdates(_0x397f3d,_0x25ec1b){return function(_0x15efba){if(_0x15efba){return _0x15efba['update'](_0x397f3d)['then'](function(_0x24dd5c){return _0x24dd5c;});}return null;};}function removeEntity(_0xf829b3,_0x4d1887){return function(_0x560bdf){if(_0x560bdf){return _0x560bdf[_0xc647('0x24')]()[_0xc647('0x25')](function(){_0xf829b3[_0xc647('0x1a')](0xcc)[_0xc647('0x26')]();});}};}function handleEntityNotFound(_0x3f2f37,_0x4fb1a3){return function(_0x1a99be){if(!_0x1a99be){_0x3f2f37[_0xc647('0x19')](0x194);}return _0x1a99be;};}function handleError(_0x2deb49,_0x5cbd31){_0x5cbd31=_0x5cbd31||0x1f4;return function(_0x5027){logger['error'](_0x5027['stack']);if(_0x5027['name']){delete _0x5027[_0xc647('0x27')];}_0x2deb49[_0xc647('0x1a')](_0x5cbd31)[_0xc647('0x28')](_0x5027);};}exports[_0xc647('0x29')]=function(_0x39119e,_0x39fc93){var _0x139e21={},_0x1f4e56={},_0x2432fe={'count':0x0,'rows':[]};var _0x2b7947=_['map'](db['DeskField'][_0xc647('0x2a')],function(_0x4652e4){return{'name':_0x4652e4[_0xc647('0x2b')],'type':_0x4652e4[_0xc647('0x2c')][_0xc647('0x2d')]};});_0x1f4e56['model']=_[_0xc647('0x2e')](_0x2b7947,'name');_0x1f4e56[_0xc647('0x2f')]=_[_0xc647('0x30')](_0x39119e[_0xc647('0x2f')]);_0x1f4e56['filters']=_[_0xc647('0x31')](_0x1f4e56[_0xc647('0x32')],_0x1f4e56[_0xc647('0x2f')]);_0x139e21[_0xc647('0x33')]=_[_0xc647('0x31')](_0x1f4e56[_0xc647('0x32')],qs[_0xc647('0x34')](_0x39119e[_0xc647('0x2f')][_0xc647('0x34')]));_0x139e21[_0xc647('0x33')]=_0x139e21[_0xc647('0x33')][_0xc647('0x35')]?_0x139e21['attributes']:_0x1f4e56[_0xc647('0x32')];if(!_0x39119e[_0xc647('0x2f')][_0xc647('0x36')](_0xc647('0x37'))){_0x139e21[_0xc647('0x1e')]=qs['limit'](_0x39119e['query'][_0xc647('0x1e')]);_0x139e21[_0xc647('0x1b')]=qs[_0xc647('0x1b')](_0x39119e[_0xc647('0x2f')][_0xc647('0x1b')]);}_0x139e21[_0xc647('0x38')]=qs[_0xc647('0x39')](_0x39119e[_0xc647('0x2f')][_0xc647('0x39')]);_0x139e21[_0xc647('0x3a')]=qs[_0xc647('0x3b')](_[_0xc647('0x3c')](_0x39119e[_0xc647('0x2f')],_0x1f4e56[_0xc647('0x3b')]),_0x2b7947);if(_0x39119e['query'][_0xc647('0x3d')]){_0x139e21[_0xc647('0x3a')]=_[_0xc647('0x3e')](_0x139e21[_0xc647('0x3a')],{'$or':_['map'](_0x2b7947,function(_0x3c1c99){if(_0x3c1c99[_0xc647('0x2c')]!==_0xc647('0x3f')){var _0x42d248={};_0x42d248[_0x3c1c99['name']]={'$like':'%'+_0x39119e[_0xc647('0x2f')]['filter']+'%'};return _0x42d248;}})});}_0x139e21=_['merge']({},_0x139e21,_0x39119e[_0xc647('0x40')]);var _0x3b1296={'where':_0x139e21['where']};return db[_0xc647('0x41')][_0xc647('0x1d')](_0x3b1296)[_0xc647('0x25')](function(_0x30ea19){_0x2432fe['count']=_0x30ea19;if(_0x39119e[_0xc647('0x2f')]['includeAll']){_0x139e21[_0xc647('0x42')]=[{'all':!![]}];}return db[_0xc647('0x41')]['findAll'](_0x139e21);})['then'](function(_0x317b9d){_0x2432fe[_0xc647('0x43')]=_0x317b9d;return _0x2432fe;})[_0xc647('0x25')](respondWithFilteredResult(_0x39fc93,_0x139e21))[_0xc647('0x44')](handleError(_0x39fc93,null));};exports[_0xc647('0x45')]=function(_0x283254,_0x4dabc6){var _0x31a908={'raw':!![],'where':{'id':_0x283254[_0xc647('0x46')]['id']}},_0x1693ab={};_0x1693ab[_0xc647('0x32')]=_['keys'](db[_0xc647('0x41')][_0xc647('0x2a')]);_0x1693ab[_0xc647('0x2f')]=_[_0xc647('0x30')](_0x283254['query']);_0x1693ab[_0xc647('0x3b')]=_['intersection'](_0x1693ab[_0xc647('0x32')],_0x1693ab[_0xc647('0x2f')]);_0x31a908[_0xc647('0x33')]=_['intersection'](_0x1693ab[_0xc647('0x32')],qs[_0xc647('0x34')](_0x283254[_0xc647('0x2f')]['fields']));_0x31a908[_0xc647('0x33')]=_0x31a908[_0xc647('0x33')][_0xc647('0x35')]?_0x31a908[_0xc647('0x33')]:_0x1693ab[_0xc647('0x32')];if(_0x283254['query'][_0xc647('0x47')]){_0x31a908[_0xc647('0x42')]=[{'all':!![]}];}_0x31a908=_[_0xc647('0x3e')]({},_0x31a908,_0x283254[_0xc647('0x40')]);return db['DeskField'][_0xc647('0x48')](_0x31a908)[_0xc647('0x25')](handleEntityNotFound(_0x4dabc6,null))[_0xc647('0x25')](respondWithResult(_0x4dabc6,null))[_0xc647('0x44')](handleError(_0x4dabc6,null));};exports[_0xc647('0x49')]=function(_0x27ead8,_0x16d88f){return db[_0xc647('0x41')][_0xc647('0x49')](_0x27ead8[_0xc647('0x4a')],{})[_0xc647('0x25')](respondWithResult(_0x16d88f,0xc9))[_0xc647('0x44')](handleError(_0x16d88f,null));};exports[_0xc647('0x4b')]=function(_0x6fc8d9,_0x3aa8cd){if(_0x6fc8d9[_0xc647('0x4a')]['id']){delete _0x6fc8d9[_0xc647('0x4a')]['id'];}return db['DeskField'][_0xc647('0x48')]({'where':{'id':_0x6fc8d9[_0xc647('0x46')]['id']}})['then'](handleEntityNotFound(_0x3aa8cd,null))[_0xc647('0x25')](saveUpdates(_0x6fc8d9[_0xc647('0x4a')],null))[_0xc647('0x25')](respondWithResult(_0x3aa8cd,null))['catch'](handleError(_0x3aa8cd,null));};exports[_0xc647('0x24')]=function(_0x58b617,_0x4a4023){return db[_0xc647('0x41')][_0xc647('0x48')]({'where':{'id':_0x58b617['params']['id']}})[_0xc647('0x25')](handleEntityNotFound(_0x4a4023,null))['then'](removeEntity(_0x4a4023,null))[_0xc647('0x44')](handleError(_0x4a4023,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 4e787ba..cfcb4dc 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 _0xd343=['bluebird','path','rimraf','exports','define','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xd343,0x97));var _0x3d34=function(_0x5f5641,_0x20bd42){_0x5f5641=_0x5f5641-0x0;var _0x3090cb=_0xd343[_0x5f5641];return _0x3090cb;};'use strict';var _=require(_0x3d34('0x0'));var util=require(_0x3d34('0x1'));var logger=require(_0x3d34('0x2'))(_0x3d34('0x3'));var moment=require(_0x3d34('0x4'));var BPromise=require(_0x3d34('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d34('0x6'));var rimraf=require(_0x3d34('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x3d34('0x8')]=function(_0x25e763,_0x1568a2){return _0x25e763[_0x3d34('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x3d34('0xa'),'fields':[_0x3d34('0xb'),_0x3d34('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x34ee=['DeskField','idField','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define'];(function(_0x1c4a44,_0x15abd4){var _0x2009f5=function(_0x1ceced){while(--_0x1ceced){_0x1c4a44['push'](_0x1c4a44['shift']());}};_0x2009f5(++_0x15abd4);}(_0x34ee,0xe6));var _0xe34e=function(_0x158dd7,_0x1f5f90){_0x158dd7=_0x158dd7-0x0;var _0x1772ba=_0x34ee[_0x158dd7];return _0x1772ba;};'use strict';var _=require(_0xe34e('0x0'));var util=require(_0xe34e('0x1'));var logger=require(_0xe34e('0x2'))('api');var moment=require(_0xe34e('0x3'));var BPromise=require('bluebird');var rp=require(_0xe34e('0x4'));var fs=require('fs');var path=require(_0xe34e('0x5'));var rimraf=require(_0xe34e('0x6'));var config=require(_0xe34e('0x7'));var attributes=require(_0xe34e('0x8'));module['exports']=function(_0x18bca1,_0x4f94f8){return _0x18bca1[_0xe34e('0x9')](_0xe34e('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xe34e('0xb'),'FieldId'],'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 78ca9fa..f884159 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 _0xa0d8=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xa0d8,0x6c));var _0x8a0d=function(_0x1cc366,_0x26692e){_0x1cc366=_0x1cc366-0x0;var _0x21caee=_0xa0d8[_0x1cc366];return _0x21caee;};'use strict';var _=require(_0x8a0d('0x0'));var util=require(_0x8a0d('0x1'));var moment=require(_0x8a0d('0x2'));var BPromise=require(_0x8a0d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a0d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a0d('0x5'));var logger=require(_0x8a0d('0x6'))(_0x8a0d('0x7'));var config=require(_0x8a0d('0x8'));var jayson=require(_0x8a0d('0x9'));var client=jayson[_0x8a0d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ddf1d,_0x525a4e,_0x194ff6){return new BPromise(function(_0xc79028,_0x35b171){return client[_0x8a0d('0xb')](_0x4ddf1d,_0x194ff6)['then'](function(_0x33dd5e){logger[_0x8a0d('0xc')](_0x8a0d('0xd'),_0x525a4e,'request\x20sent');logger[_0x8a0d('0xe')](_0x8a0d('0xf'),_0x525a4e,_0x8a0d('0x10'),JSON[_0x8a0d('0x11')](_0x33dd5e));if(_0x33dd5e[_0x8a0d('0x12')]){if(_0x33dd5e[_0x8a0d('0x12')]['code']===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x525a4e,_0x33dd5e[_0x8a0d('0x12')][_0x8a0d('0x13')]);return _0x35b171(_0x33dd5e[_0x8a0d('0x12')][_0x8a0d('0x13')]);}logger[_0x8a0d('0x12')](_0x8a0d('0xd'),_0x525a4e,_0x33dd5e[_0x8a0d('0x12')][_0x8a0d('0x13')]);return _0xc79028(_0x33dd5e[_0x8a0d('0x12')][_0x8a0d('0x13')]);}else{logger[_0x8a0d('0xc')](_0x8a0d('0xd'),_0x525a4e,_0x8a0d('0x10'));_0xc79028(_0x33dd5e[_0x8a0d('0x14')][_0x8a0d('0x13')]);}})[_0x8a0d('0x15')](function(_0x3e76a2){logger[_0x8a0d('0x12')](_0x8a0d('0xd'),_0x525a4e,_0x3e76a2);_0x35b171(_0x3e76a2);});});} \ No newline at end of file +var _0x25de=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x4e19e5,_0x48d4f8){var _0x55f13e=function(_0x3ef68c){while(--_0x3ef68c){_0x4e19e5['push'](_0x4e19e5['shift']());}};_0x55f13e(++_0x48d4f8);}(_0x25de,0x122));var _0xe25d=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0x25de[_0x3d27a];return _0x314fd7;};'use strict';var _=require(_0xe25d('0x0'));var util=require(_0xe25d('0x1'));var moment=require(_0xe25d('0x2'));var BPromise=require(_0xe25d('0x3'));var rs=require(_0xe25d('0x4'));var fs=require('fs');var Redis=require(_0xe25d('0x5'));var db=require(_0xe25d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe25d('0x7'))(_0xe25d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe25d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa4cc08,_0x253f14,_0x39bd31){return new BPromise(function(_0x3baafe,_0x12641f){return client[_0xe25d('0xa')](_0xa4cc08,_0x39bd31)[_0xe25d('0xb')](function(_0x55059f){logger[_0xe25d('0xc')](_0xe25d('0xd'),_0x253f14,'request\x20sent');logger[_0xe25d('0xe')](_0xe25d('0xf'),_0x253f14,_0xe25d('0x10'),JSON['stringify'](_0x55059f));if(_0x55059f[_0xe25d('0x11')]){if(_0x55059f['error'][_0xe25d('0x12')]===0x1f4){logger[_0xe25d('0x11')](_0xe25d('0xd'),_0x253f14,_0x55059f[_0xe25d('0x11')][_0xe25d('0x13')]);return _0x12641f(_0x55059f[_0xe25d('0x11')][_0xe25d('0x13')]);}logger[_0xe25d('0x11')]('DeskField,\x20%s,\x20%s',_0x253f14,_0x55059f['error']['message']);return _0x3baafe(_0x55059f[_0xe25d('0x11')][_0xe25d('0x13')]);}else{logger[_0xe25d('0xc')]('DeskField,\x20%s,\x20%s',_0x253f14,_0xe25d('0x10'));_0x3baafe(_0x55059f['result'][_0xe25d('0x13')]);}})[_0xe25d('0x14')](function(_0x4d72ec){logger['error']('DeskField,\x20%s,\x20%s',_0x253f14,_0x4d72ec);_0x12641f(_0x4d72ec);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index f72ceb7..8b0e6c0 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 _0x0d40=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x27f81e,_0x293850){var _0x48189a=function(_0x24f480){while(--_0x24f480){_0x27f81e['push'](_0x27f81e['shift']());}};_0x48189a(++_0x293850);}(_0x0d40,0x192));var _0x00d4=function(_0x138293,_0x197e7f){_0x138293=_0x138293-0x0;var _0x34c4a2=_0x0d40[_0x138293];return _0x34c4a2;};'use strict';var multer=require(_0x00d4('0x0'));var util=require(_0x00d4('0x1'));var path=require(_0x00d4('0x2'));var timeout=require(_0x00d4('0x3'));var express=require(_0x00d4('0x4'));var router=express[_0x00d4('0x5')]();var fs_extra=require(_0x00d4('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x00d4('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x00d4('0x8')]('/',auth[_0x00d4('0x9')](),controller[_0x00d4('0xa')]);router['get'](_0x00d4('0xb'),auth[_0x00d4('0x9')](),controller[_0x00d4('0xc')]);router[_0x00d4('0x8')](_0x00d4('0xd'),auth[_0x00d4('0x9')](),controller[_0x00d4('0xe')]);router[_0x00d4('0x8')](_0x00d4('0xf'),auth[_0x00d4('0x9')](),controller[_0x00d4('0x10')]);router['post']('/',auth[_0x00d4('0x9')](),controller[_0x00d4('0x11')]);router[_0x00d4('0x12')]('/:id/configurations',auth[_0x00d4('0x9')](),controller[_0x00d4('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x00d4('0x14')]);router[_0x00d4('0x15')](_0x00d4('0xb'),auth[_0x00d4('0x9')](),controller['destroy']);module[_0x00d4('0x16')]=router; \ No newline at end of file +var _0x02f5=['../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','post','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x02f5,0x9a));var _0x502f=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0x02f5[_0x16771d];return _0x386f11;};'use strict';var multer=require(_0x502f('0x0'));var util=require(_0x502f('0x1'));var path=require(_0x502f('0x2'));var timeout=require(_0x502f('0x3'));var express=require(_0x502f('0x4'));var router=express[_0x502f('0x5')]();var fs_extra=require(_0x502f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x502f('0x7'));var config=require('../../config/environment');var controller=require(_0x502f('0x8'));router[_0x502f('0x9')]('/',auth['isAuthenticated'](),controller[_0x502f('0xa')]);router['get'](_0x502f('0xb'),auth['isAuthenticated'](),controller[_0x502f('0xc')]);router['get'](_0x502f('0xd'),auth[_0x502f('0xe')](),controller[_0x502f('0xf')]);router[_0x502f('0x9')](_0x502f('0x10'),auth[_0x502f('0xe')](),controller['getFields']);router[_0x502f('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x502f('0xd'),auth[_0x502f('0xe')](),controller[_0x502f('0x12')]);router[_0x502f('0x13')]('/:id',auth[_0x502f('0xe')](),controller['update']);router[_0x502f('0x14')](_0x502f('0xb'),auth[_0x502f('0xe')](),controller[_0x502f('0x15')]);module[_0x502f('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 22d768c..bc8f508 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 _0xb6f1=['BOOLEAN','sequelize','STRING'];(function(_0x5dccc5,_0xc65000){var _0x447f2f=function(_0x3f7cdb){while(--_0x3f7cdb){_0x5dccc5['push'](_0x5dccc5['shift']());}};_0x447f2f(++_0xc65000);}(_0xb6f1,0x118));var _0x1b6f=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0xb6f1[_0x2b0a86];return _0x955940;};'use strict';var Sequelize=require(_0x1b6f('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b6f('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1b6f('0x1')]},'remoteUri':{'type':Sequelize[_0x1b6f('0x1')]},'tenantId':{'type':Sequelize[_0x1b6f('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x1b6f('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1b6f('0x1')]},'modernAuthentication':{'type':Sequelize[_0x1b6f('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xbd18=['sequelize','exports','STRING'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xbd18,0x195));var _0x8bd1=function(_0x207313,_0x22a9c6){_0x207313=_0x207313-0x0;var _0x4c8d99=_0xbd18[_0x207313];return _0x4c8d99;};'use strict';var Sequelize=require(_0x8bd1('0x0'));module[_0x8bd1('0x1')]={'name':{'type':Sequelize[_0x8bd1('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x8bd1('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x8bd1('0x2')]},'serverUrl':{'type':Sequelize[_0x8bd1('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 8da1ef8..c13c29a 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 _0x6153=['accountidname','accountidyominame','billedserviceunits','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','TrueOption','true','FalseOption','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','status','json','offset','undefined','count','limit','set','update','then','destroy','end','sendStatus','error','stack','name','map','Dynamics365Account','fieldName','type','key','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','body','getConfigurations','findOne','Dynamics365Configuration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','getFields','incident','Incident','PhoneCall','description','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties'];(function(_0x55fe01,_0x12ed37){var _0x5b42f0=function(_0x461191){while(--_0x461191){_0x55fe01['push'](_0x55fe01['shift']());}};_0x5b42f0(++_0x12ed37);}(_0x6153,0x6c));var _0x3615=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6153[_0x57b54c];return _0x59cc19;};'use strict';var rp=require(_0x3615('0x0'));var util=require(_0x3615('0x1'));var _=require(_0x3615('0x2'));var qs=require(_0x3615('0x3'));var logger=require(_0x3615('0x4'))(_0x3615('0x5'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x41c6dc,_0x23ddfd){_0x23ddfd=_0x23ddfd||0xc8;return function(_0x571064){if(_0x571064){return _0x41c6dc[_0x3615('0x6')](_0x23ddfd)[_0x3615('0x7')](_0x571064);}};}function respondWithFilteredResult(_0x27bf1e,_0x16c4c0){return function(_0x275094){if(_0x275094){var _0x21bbb7=typeof _0x16c4c0[_0x3615('0x8')]===_0x3615('0x9')&&typeof _0x16c4c0['limit']===_0x3615('0x9');var _0x566a3a=_0x275094[_0x3615('0xa')];var _0x29100c=_0x21bbb7?0x0:_0x16c4c0['offset'];var _0x4e6d48=_0x21bbb7?_0x275094[_0x3615('0xa')]:_0x16c4c0['offset']+_0x16c4c0[_0x3615('0xb')];var _0x2df483;if(_0x4e6d48>=_0x566a3a){_0x4e6d48=_0x566a3a;_0x2df483=0xc8;}else{_0x2df483=0xce;}_0x27bf1e['status'](_0x2df483);return _0x27bf1e[_0x3615('0xc')]('Content-Range',_0x29100c+'-'+_0x4e6d48+'/'+_0x566a3a)['json'](_0x275094);}return null;};}function saveUpdates(_0x5d11c6){return function(_0x36dbe6){if(_0x36dbe6){return _0x36dbe6[_0x3615('0xd')](_0x5d11c6)[_0x3615('0xe')](function(_0x41c40c){return _0x41c40c;});}return null;};}function removeEntity(_0x3b3e10){return function(_0x3888a2){if(_0x3888a2){return _0x3888a2[_0x3615('0xf')]()['then'](function(){_0x3b3e10[_0x3615('0x6')](0xcc)[_0x3615('0x10')]();});}};}function handleEntityNotFound(_0x27b355){return function(_0x5577cd){if(!_0x5577cd){_0x27b355[_0x3615('0x11')](0x194);}return _0x5577cd;};}function handleError(_0x118704,_0x5ab98e){_0x5ab98e=_0x5ab98e||0x1f4;return function(_0x4f3170){logger[_0x3615('0x12')](_0x4f3170[_0x3615('0x13')]);if(_0x4f3170[_0x3615('0x14')]){delete _0x4f3170['name'];}_0x118704[_0x3615('0x6')](_0x5ab98e)['send'](_0x4f3170);};}exports['index']=function(_0x2808f1,_0x287e71){var _0x143117={},_0x27a2b9={},_0x17ec07={'count':0x0,'rows':[]};var _0x4f9749=_[_0x3615('0x15')](db[_0x3615('0x16')]['rawAttributes'],function(_0x3fbd95){return{'name':_0x3fbd95[_0x3615('0x17')],'type':_0x3fbd95[_0x3615('0x18')][_0x3615('0x19')]};});_0x27a2b9[_0x3615('0x1a')]=_[_0x3615('0x15')](_0x4f9749,'name');_0x27a2b9[_0x3615('0x1b')]=_[_0x3615('0x1c')](_0x2808f1[_0x3615('0x1b')]);_0x27a2b9[_0x3615('0x1d')]=_[_0x3615('0x1e')](_0x27a2b9[_0x3615('0x1a')],_0x27a2b9['query']);_0x143117[_0x3615('0x1f')]=_['intersection'](_0x27a2b9[_0x3615('0x1a')],qs[_0x3615('0x20')](_0x2808f1[_0x3615('0x1b')][_0x3615('0x20')]));_0x143117[_0x3615('0x1f')]=_0x143117['attributes']['length']?_0x143117[_0x3615('0x1f')]:_0x27a2b9[_0x3615('0x1a')];if(!_0x2808f1['query'][_0x3615('0x21')](_0x3615('0x22'))){_0x143117[_0x3615('0xb')]=qs[_0x3615('0xb')](_0x2808f1[_0x3615('0x1b')]['limit']);_0x143117['offset']=qs[_0x3615('0x8')](_0x2808f1['query'][_0x3615('0x8')]);}_0x143117[_0x3615('0x23')]=qs[_0x3615('0x24')](_0x2808f1[_0x3615('0x1b')][_0x3615('0x24')]);_0x143117[_0x3615('0x25')]=qs[_0x3615('0x1d')](_[_0x3615('0x26')](_0x2808f1[_0x3615('0x1b')],_0x27a2b9[_0x3615('0x1d')]),_0x4f9749);if(_0x2808f1['query'][_0x3615('0x27')]){_0x143117[_0x3615('0x25')]=_[_0x3615('0x28')](_0x143117[_0x3615('0x25')],{'$or':_[_0x3615('0x15')](_0x4f9749,function(_0x2d2e91){if(_0x2d2e91[_0x3615('0x18')]!==_0x3615('0x29')){var _0xadf3c9={};_0xadf3c9[_0x2d2e91[_0x3615('0x14')]]={'$like':'%'+_0x2808f1[_0x3615('0x1b')][_0x3615('0x27')]+'%'};return _0xadf3c9;}})});}_0x143117=_[_0x3615('0x28')]({},_0x143117,_0x2808f1[_0x3615('0x2a')]);var _0x3bbdba={'where':_0x143117['where']};return db[_0x3615('0x16')][_0x3615('0xa')](_0x3bbdba)['then'](function(_0x3e0c20){_0x17ec07['count']=_0x3e0c20;if(_0x2808f1['query'][_0x3615('0x2b')]){_0x143117['include']=[{'all':!![]}];}return db[_0x3615('0x16')][_0x3615('0x2c')](_0x143117);})[_0x3615('0xe')](function(_0x1928f9){_0x17ec07[_0x3615('0x2d')]=_0x1928f9;return _0x17ec07;})[_0x3615('0xe')](respondWithFilteredResult(_0x287e71,_0x143117))[_0x3615('0x2e')](handleError(_0x287e71,null));};exports[_0x3615('0x2f')]=function(_0x5bf070,_0x47568a){var _0x5f25a2={'raw':![],'where':{'id':_0x5bf070[_0x3615('0x30')]['id']}},_0x20fab9={};_0x20fab9[_0x3615('0x1a')]=_[_0x3615('0x1c')](db[_0x3615('0x16')]['rawAttributes']);_0x20fab9[_0x3615('0x1b')]=_[_0x3615('0x1c')](_0x5bf070['query']);_0x20fab9[_0x3615('0x1d')]=_[_0x3615('0x1e')](_0x20fab9[_0x3615('0x1a')],_0x20fab9['query']);_0x5f25a2[_0x3615('0x1f')]=_[_0x3615('0x1e')](_0x20fab9[_0x3615('0x1a')],qs['fields'](_0x5bf070[_0x3615('0x1b')][_0x3615('0x20')]));_0x5f25a2[_0x3615('0x1f')]=_0x5f25a2[_0x3615('0x1f')][_0x3615('0x31')]?_0x5f25a2[_0x3615('0x1f')]:_0x20fab9['model'];if(_0x5bf070['query'][_0x3615('0x2b')]){_0x5f25a2[_0x3615('0x32')]=[{'all':!![]}];}_0x5f25a2=_[_0x3615('0x28')]({},_0x5f25a2,_0x5bf070[_0x3615('0x2a')]);return db['Dynamics365Account'][_0x3615('0x33')](_0x5f25a2)[_0x3615('0xe')](handleEntityNotFound(_0x47568a,null))[_0x3615('0xe')](respondWithResult(_0x47568a,null))[_0x3615('0x2e')](handleError(_0x47568a,null));};exports['create']=function(_0x21307e,_0x4db600){return db['Dynamics365Account'][_0x3615('0x34')](_0x21307e[_0x3615('0x35')],{})['then'](respondWithResult(_0x4db600,0xc9))[_0x3615('0x2e')](handleError(_0x4db600,null));};exports[_0x3615('0xd')]=function(_0x4debf6,_0x173c05){if(_0x4debf6[_0x3615('0x35')]['id']){delete _0x4debf6[_0x3615('0x35')]['id'];}return db[_0x3615('0x16')][_0x3615('0x33')]({'where':{'id':_0x4debf6['params']['id']}})['then'](handleEntityNotFound(_0x173c05,null))[_0x3615('0xe')](saveUpdates(_0x4debf6[_0x3615('0x35')],null))[_0x3615('0xe')](respondWithResult(_0x173c05,null))[_0x3615('0x2e')](handleError(_0x173c05,null));};exports[_0x3615('0xf')]=function(_0x3ed939,_0x51ef23){return db['Dynamics365Account'][_0x3615('0x33')]({'where':{'id':_0x3ed939[_0x3615('0x30')]['id']}})[_0x3615('0xe')](handleEntityNotFound(_0x51ef23,null))[_0x3615('0xe')](removeEntity(_0x51ef23,null))[_0x3615('0x2e')](handleError(_0x51ef23,null));};exports[_0x3615('0x36')]=function(_0x4d648d,_0x2eee6e){var _0x3d7efb={};var _0x51df89={};var _0x200e88;var _0x11858b;return db[_0x3615('0x16')][_0x3615('0x37')]({'where':{'id':_0x4d648d[_0x3615('0x30')]['id']}})[_0x3615('0xe')](handleEntityNotFound(_0x2eee6e,null))[_0x3615('0xe')](function(_0x460eb9){if(_0x460eb9){_0x200e88=_0x460eb9;_0x51df89['model']=_[_0x3615('0x1c')](db[_0x3615('0x38')][_0x3615('0x39')]);_0x51df89[_0x3615('0x1b')]=_[_0x3615('0x1c')](_0x4d648d[_0x3615('0x1b')]);_0x51df89[_0x3615('0x1d')]=_['intersection'](_0x51df89[_0x3615('0x1a')],_0x51df89[_0x3615('0x1b')]);_0x3d7efb[_0x3615('0x1f')]=_[_0x3615('0x1e')](_0x51df89['model'],qs['fields'](_0x4d648d[_0x3615('0x1b')][_0x3615('0x20')]));_0x3d7efb[_0x3615('0x1f')]=_0x3d7efb['attributes']['length']?_0x3d7efb[_0x3615('0x1f')]:_0x51df89[_0x3615('0x1a')];_0x3d7efb[_0x3615('0x23')]=qs[_0x3615('0x24')](_0x4d648d['query']['sort']);_0x3d7efb['where']=qs[_0x3615('0x1d')](_[_0x3615('0x26')](_0x4d648d['query'],_0x51df89['filters']));if(_0x4d648d['query']['filter']){_0x3d7efb[_0x3615('0x25')]=_[_0x3615('0x28')](_0x3d7efb[_0x3615('0x25')],{'$or':_[_0x3615('0x15')](_0x3d7efb[_0x3615('0x1f')],function(_0x5b2b28){var _0x11d918={};_0x11d918[_0x5b2b28]={'$like':'%'+_0x4d648d[_0x3615('0x1b')][_0x3615('0x27')]+'%'};return _0x11d918;})});}_0x3d7efb=_[_0x3615('0x28')]({},_0x3d7efb,_0x4d648d[_0x3615('0x2a')]);return _0x200e88[_0x3615('0x36')](_0x3d7efb);}})[_0x3615('0xe')](function(_0x4fee26){if(_0x4fee26){_0x11858b=_0x4fee26[_0x3615('0x31')];if(!_0x4d648d[_0x3615('0x1b')][_0x3615('0x21')](_0x3615('0x22'))){_0x3d7efb['limit']=qs['limit'](_0x4d648d[_0x3615('0x1b')]['limit']);_0x3d7efb['offset']=qs['offset'](_0x4d648d['query'][_0x3615('0x8')]);}return _0x200e88['getConfigurations'](_0x3d7efb);}})['then'](function(_0x54e0df){if(_0x54e0df){return _0x54e0df?{'count':_0x11858b,'rows':_0x54e0df}:null;}})[_0x3615('0xe')](respondWithResult(_0x2eee6e,null))[_0x3615('0x2e')](handleError(_0x2eee6e,null));};exports[_0x3615('0x3a')]=function(_0x41e8c6,_0x100011){if(_0x41e8c6[_0x3615('0x35')]['id']){delete _0x41e8c6[_0x3615('0x35')]['id'];}return db['Dynamics365Account'][_0x3615('0x37')]({'where':{'id':_0x41e8c6[_0x3615('0x30')]['id']}})['then'](handleEntityNotFound(_0x100011,null))[_0x3615('0xe')](function(_0x1e62f7){if(_0x1e62f7){_0x41e8c6[_0x3615('0x35')][_0x3615('0x3b')]=_0x1e62f7['id'];_0x41e8c6[_0x3615('0x35')][_0x3615('0x3c')]=integrations[_0x3615('0x3d')](_0x41e8c6['body'][_0x3615('0x3e')],_0x41e8c6[_0x3615('0x35')][_0x3615('0x18')]);_0x41e8c6[_0x3615('0x35')][_0x3615('0x3f')]=integrations['getDescriptions'](_0x41e8c6[_0x3615('0x35')][_0x3615('0x3e')],_0x41e8c6['body'][_0x3615('0x18')]);return db[_0x3615('0x38')][_0x3615('0x34')](_0x41e8c6[_0x3615('0x35')],{'include':[{'model':db[_0x3615('0x40')],'as':_0x3615('0x3c')},{'model':db[_0x3615('0x40')],'as':_0x3615('0x3f')}]});}return null;})['then'](respondWithResult(_0x100011,null))[_0x3615('0x2e')](handleError(_0x100011,null));};function sanitizeRemoteUri(_0x12cc28){var _0x248270=_0x12cc28[_0x3615('0x41')](-0x1);if(_0x248270==='/')return _0x12cc28[_0x3615('0x42')](0x0,_0x12cc28[_0x3615('0x43')](_0x248270));return _0x12cc28;}function getWebApiUrl(_0x5d84f3){return util['format']('%s/api/data/v9.0/',_0x5d84f3);}exports[_0x3615('0x44')]=function(_0x27c2c7,_0x119567){var _0x106a7b=_0x27c2c7[_0x3615('0x1b')]['ticketType'];var _0x3bd138=_0x106a7b===_0x3615('0x45')?_0x3615('0x46'):_0x3615('0x47');var _0x14d627='';var _0x224370='';var _0x169e2a='';var _0x5cfebc='';var _0xb0c015='';var _0x1950ec='';var _0x4b38ed='';var _0x584f8d='';var _0x23d3d5=['title',_0x3615('0x48'),'customerid','ownerid',_0x3615('0x49'),_0x3615('0x4a'),_0x3615('0x4b'),_0x3615('0x4c'),_0x3615('0x4d'),_0x3615('0x4e')];var _0x50bb77=[_0x3615('0x4f'),_0x3615('0x50'),'actualserviceunits',_0x3615('0x51'),'contactidname',_0x3615('0x52'),'contractdetailidname',_0x3615('0x53'),'createdbyexternalpartyname',_0x3615('0x54'),_0x3615('0x55'),_0x3615('0x56'),_0x3615('0x57'),'createdonbehalfbyname',_0x3615('0x58'),_0x3615('0x59'),'customeridtype',_0x3615('0x5a'),_0x3615('0x5b'),'entitlementidname',_0x3615('0x5c'),_0x3615('0x5d'),_0x3615('0x5e'),_0x3615('0x5f'),'firstresponsebykpiidname',_0x3615('0x60'),'importsequencenumber',_0x3615('0x61'),'kbarticleidname',_0x3615('0x62'),_0x3615('0x63'),'modifiedbyexternalpartyname',_0x3615('0x64'),_0x3615('0x65'),_0x3615('0x66'),_0x3615('0x67'),_0x3615('0x68'),'modifiedonbehalfbyyominame',_0x3615('0x69'),_0x3615('0x6a'),_0x3615('0x6b'),_0x3615('0x6c'),'overriddencreatedon',_0x3615('0x6d'),_0x3615('0x6e'),_0x3615('0x6f'),_0x3615('0x70'),_0x3615('0x71'),_0x3615('0x72'),_0x3615('0x73'),_0x3615('0x74'),'productserialnumber',_0x3615('0x75'),_0x3615('0x76'),'responseby',_0x3615('0x77'),'responsiblecontactidyominame',_0x3615('0x78'),_0x3615('0x79'),_0x3615('0x7a'),_0x3615('0x7b'),_0x3615('0x7c'),_0x3615('0x7d'),'subjectidname',_0x3615('0x7e'),_0x3615('0x7f'),_0x3615('0x80'),_0x3615('0x81'),'utcconversiontimezonecode',_0x3615('0x82')];var _0xaffb42=_0x23d3d5[_0x3615('0x83')](_0x50bb77);return db[_0x3615('0x16')][_0x3615('0x37')]({'where':{'id':_0x27c2c7['params']['id']},'attributes':['id',_0x3615('0x84'),'password',_0x3615('0x85'),_0x3615('0x86'),_0x3615('0x87'),_0x3615('0x88'),'modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':_0x3615('0x89'),'attributes':['id',_0x3615('0x8a'),_0x3615('0x8b')]}]})[_0x3615('0xe')](handleEntityNotFound(_0x119567,null))[_0x3615('0xe')](function(_0x9594be){if(_0x9594be){if(_0x9594be['modernAuthentication']){_0x9594be['access_token']=_0x9594be[_0x3615('0x89')][_0x3615('0x8a')];_0x584f8d=sanitizeRemoteUri(_0x9594be[_0x3615('0x89')]['data7']);_0x4b38ed=getWebApiUrl(_0x584f8d);return _0x9594be;}_0x584f8d=sanitizeRemoteUri(_0x9594be[_0x3615('0x85')]);_0x4b38ed=getWebApiUrl(_0x584f8d);var _0x48748f={'method':_0x3615('0x8c'),'uri':_0x3615('0x8d')+_0x9594be['tenantId']+_0x3615('0x8e'),'form':{'client_id':_0x9594be[_0x3615('0x87')],'resource':_0x584f8d,'username':_0x9594be[_0x3615('0x84')],'password':_0x9594be['password'],'grant_type':_0x3615('0x8f'),'client_secret':_0x9594be['clientSecret']},'json':!![]};return rp(_0x48748f);}})[_0x3615('0xe')](function(_0x121e62){_0x1950ec=_0x121e62['access_token'];var _0x44bbff={'method':_0x3615('0x90'),'uri':encodeURI(_0x4b38ed+_0x3615('0x91')+_0x3bd138+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1950ec,'If-None-Match':null,'OData-Version':_0x3615('0x92')},'json':!![]};return rp(_0x44bbff);})[_0x3615('0xe')](function(_0x3d47e2){var _0x2a096a=_0x3d47e2['value'][0x0];var _0x371931=_0x2a096a['MetadataId'];var _0x641776={'method':_0x3615('0x90'),'uri':_0x4b38ed+_0x3615('0x93')+_0x371931+_0x3615('0x94'),'headers':{'Authorization':_0x3615('0x95')+_0x1950ec,'If-None-Match':null,'OData-Version':_0x3615('0x92')},'json':!![]};return rp(_0x641776);})[_0x3615('0xe')](function(_0x1825f0){_0x14d627=_0x1825f0;_0x224370=_0x14d627[_0x3615('0x96')];_0x224370=_[_0x3615('0x97')](_0x224370,function(_0xc498d3){return!_0xaffb42['includes'](_0xc498d3[_0x3615('0x98')]);});var _0x59ccc4=[];var _0x43dea7=[];_0x224370[_0x3615('0x99')](function(_0x466567){if(_0x466567[_0x3615('0x9a')]){var _0x36a6da=_0x466567[_0x3615('0x9a')][_0x3615('0x42')](_0x466567[_0x3615('0x9a')][_0x3615('0x43')]('.')+0x1);if(_0x36a6da===_0x3615('0x9b')){_0x59ccc4['push'](getSelectList(_0x4b38ed,_0x106a7b,_0x43dea7,_0x14d627[_0x3615('0x9c')],_0x466567[_0x3615('0x9c')],_0x1950ec));}}});return Promise[_0x3615('0x9d')](_0x59ccc4);})[_0x3615('0xe')](function(_0x293f67){_0x169e2a=_0x293f67[0x0];var _0x11e610=[];var _0x85210d=[];_0x224370[_0x3615('0x99')](function(_0xe0763b){if(!_[_0x3615('0x9e')](_0xe0763b['@odata.type'])){var _0x4d3881=_0xe0763b[_0x3615('0x9a')]['substring'](_0xe0763b[_0x3615('0x9a')]['lastIndexOf']('.')+0x1);if(_0x4d3881===_0x3615('0x9f')){_0x11e610[_0x3615('0xa0')](getBooleanList(_0x4b38ed,_0x106a7b,_0x85210d,_0x14d627['MetadataId'],_0xe0763b[_0x3615('0x9c')],_0x1950ec));}}});return Promise[_0x3615('0x9d')](_0x11e610);})[_0x3615('0xe')](function(_0x27afd3){_0x5cfebc=_0x27afd3[0x0];var _0x5278a8=[];var _0x157c2d=[];_0x224370['forEach'](function(_0x46684a){if(_0x46684a[_0x3615('0x9a')]){var _0x32dd94=_0x46684a[_0x3615('0x9a')]['substring'](_0x46684a['@odata.type']['lastIndexOf']('.')+0x1);if(_0x32dd94===_0x3615('0xa1')||_0x32dd94===_0x3615('0xa2')||_0x32dd94===_0x3615('0xa3')||_0x32dd94===_0x3615('0xa4')||_0x32dd94==='MemoAttributeMetadata'||_0x32dd94===_0x3615('0xa5')||_0x32dd94===_0x3615('0xa6')||_0x32dd94===_0x3615('0xa7')||_0x32dd94===_0x3615('0xa8')||_0x32dd94===_0x3615('0xa9')){_0x5278a8[_0x3615('0xa0')](getInputList(_0x4b38ed,_0x106a7b,_0x32dd94,_0x157c2d,_0x14d627[_0x3615('0x9c')],_0x46684a['MetadataId'],_0x1950ec));}}});return Promise[_0x3615('0x9d')](_0x5278a8);})['then'](function(_0x26c15b){_0xb0c015=_0x26c15b[0x0];var _0x9d529f=_0x169e2a[_0x3615('0x83')](_0x5cfebc)['concat'](_0xb0c015);var _0x39f0e2={'count':_0x9d529f[_0x3615('0x31')],'rows':_0x9d529f};return _0x39f0e2;})[_0x3615('0xe')](respondWithResult(_0x119567,null))[_0x3615('0x2e')](function(_0x40ad8a){var _0x1cdbc2=_0x27c2c7[_0x3615('0x1b')][_0x3615('0xaa')]?0x1f4:_0x40ad8a[_0x3615('0xab')]||0x1f4;logger['error'](_0x40ad8a[_0x3615('0x13')]);delete _0x40ad8a[_0x3615('0x14')];if(_0x1cdbc2===0x191){_0x1cdbc2=0x190;}_0x119567[_0x3615('0x6')](_0x1cdbc2)[_0x3615('0xac')](_0x27c2c7[_0x3615('0x1b')][_0x3615('0xaa')]?{'message':'Wrong\x20credentials','statusCode':_0x40ad8a[_0x3615('0xab')]}:_0x40ad8a);});};function getSelectList(_0xb7cce5,_0x594bcb,_0x21871e,_0x28282b,_0x14dc6a,_0x52358a){var _0x2141d8={'method':_0x3615('0x90'),'uri':_0xb7cce5+_0x3615('0x93')+_0x28282b+_0x3615('0xad')+_0x14dc6a+_0x3615('0xae')+_0x3615('0xaf'),'headers':{'Authorization':_0x3615('0x95')+_0x52358a,'If-None-Match':null,'OData-Version':_0x3615('0x92')},'json':!![]};return rp(_0x2141d8)[_0x3615('0xe')](function(_0x470426){var _0x4b5deb=[];var _0x403bbd=_0x470426[_0x3615('0xb0')][_0x3615('0xb1')];_0x403bbd[_0x3615('0x99')](function(_0x32fce3){_0x4b5deb[_0x3615('0xa0')]({'name':_0x32fce3[_0x3615('0xb2')][_0x3615('0xb3')][_0x3615('0xb2')],'value':String(_0x32fce3[_0x3615('0xb4')])});});var _0x2492d2={'id':_0x594bcb+'_'+_0x470426[_0x3615('0x98')],'name':_0x470426['DisplayName'][_0x3615('0xb3')][_0x3615('0xb2')],'custom':![],'options':_0x4b5deb};_0x21871e[_0x3615('0xa0')](_0x2492d2);return _0x21871e;});}function getBooleanList(_0x46748c,_0x4d81a2,_0x28de59,_0x5179f0,_0x533ca0,_0x19491b){var _0x53a5d2={'method':_0x3615('0x90'),'uri':_0x46748c+'EntityDefinitions('+_0x5179f0+_0x3615('0xad')+_0x533ca0+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x3615('0x95')+_0x19491b,'If-None-Match':null,'OData-Version':_0x3615('0x92')},'json':!![]};return rp(_0x53a5d2)[_0x3615('0xe')](function(_0x40c671){var _0x4a78cd=[];_0x4a78cd[_0x3615('0xa0')]({'name':_0x40c671[_0x3615('0xb0')][_0x3615('0xb5')]['Label'][_0x3615('0xb3')][_0x3615('0xb2')],'value':_0x3615('0xb6')},{'name':_0x40c671[_0x3615('0xb0')][_0x3615('0xb7')][_0x3615('0xb2')][_0x3615('0xb3')][_0x3615('0xb2')],'value':'false'});var _0x58bd37={'id':_0x4d81a2+'_'+_0x40c671[_0x3615('0x98')],'name':_0x40c671[_0x3615('0xb8')][_0x3615('0xb3')][_0x3615('0xb2')],'custom':![],'options':_0x4a78cd};_0x28de59[_0x3615('0xa0')](_0x58bd37);return _0x28de59;});}function getInputList(_0x53b5a4,_0x358834,_0x286493,_0x564c4e,_0x4bc6c4,_0x343961,_0x538c56){var _0x3fcc8d={'method':_0x3615('0x90'),'uri':_0x53b5a4+_0x3615('0x93')+_0x4bc6c4+')/Attributes('+_0x343961+_0x3615('0xb9')+_0x286493+_0x3615('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x538c56,'If-None-Match':null,'OData-Version':_0x3615('0x92')},'json':!![]};return rp(_0x3fcc8d)[_0x3615('0xe')](function(_0x56985a){var _0x416f7c={'id':_0x358834+'_'+_0x56985a[_0x3615('0x98')],'name':_0x56985a[_0x3615('0xb8')]['UserLocalizedLabel']?_0x56985a[_0x3615('0xb8')][_0x3615('0xb3')][_0x3615('0xb2')]:_0x56985a[_0x3615('0x98')],'custom':![],'options':[]};_0x564c4e[_0x3615('0xa0')](_0x416f7c);return _0x564c4e;});} \ No newline at end of file +var _0xeb83=['json','offset','undefined','limit','count','set','Content-Range','update','then','end','error','name','send','map','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order','addConfiguration','AccountId','Subjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','format','ticketType','incident','PhoneCall','title','ownerid','subject','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','username','password','remoteUri','tenantId','modernAuthentication','CloudProvider','access_token','data5','data7','POST','/oauth2/token','clientId','clientSecret','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','test','stack','Wrong\x20credentials','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Attributes(','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','api','../../components/integrations/configuration','status'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xeb83,0xad));var _0x3eb8=function(_0x10bc65,_0x48b106){_0x10bc65=_0x10bc65-0x0;var _0x308ee2=_0xeb83[_0x10bc65];return _0x308ee2;};'use strict';var rp=require(_0x3eb8('0x0'));var util=require(_0x3eb8('0x1'));var _=require(_0x3eb8('0x2'));var qs=require(_0x3eb8('0x3'));var logger=require('../../config/logger')(_0x3eb8('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3eb8('0x5'));function respondWithResult(_0x189fed,_0x3e715c){_0x3e715c=_0x3e715c||0xc8;return function(_0x24e72d){if(_0x24e72d){return _0x189fed[_0x3eb8('0x6')](_0x3e715c)[_0x3eb8('0x7')](_0x24e72d);}};}function respondWithFilteredResult(_0x3b4253,_0x222fe8){return function(_0x49a66a){if(_0x49a66a){var _0x420584=typeof _0x222fe8[_0x3eb8('0x8')]===_0x3eb8('0x9')&&typeof _0x222fe8[_0x3eb8('0xa')]===_0x3eb8('0x9');var _0x5c687e=_0x49a66a[_0x3eb8('0xb')];var _0x43a2d8=_0x420584?0x0:_0x222fe8[_0x3eb8('0x8')];var _0x4b8c9e=_0x420584?_0x49a66a[_0x3eb8('0xb')]:_0x222fe8[_0x3eb8('0x8')]+_0x222fe8[_0x3eb8('0xa')];var _0x4d88a4;if(_0x4b8c9e>=_0x5c687e){_0x4b8c9e=_0x5c687e;_0x4d88a4=0xc8;}else{_0x4d88a4=0xce;}_0x3b4253[_0x3eb8('0x6')](_0x4d88a4);return _0x3b4253[_0x3eb8('0xc')](_0x3eb8('0xd'),_0x43a2d8+'-'+_0x4b8c9e+'/'+_0x5c687e)[_0x3eb8('0x7')](_0x49a66a);}return null;};}function saveUpdates(_0x31c990){return function(_0x1935c3){if(_0x1935c3){return _0x1935c3[_0x3eb8('0xe')](_0x31c990)[_0x3eb8('0xf')](function(_0x3b6903){return _0x3b6903;});}return null;};}function removeEntity(_0x229dfa){return function(_0x1cb562){if(_0x1cb562){return _0x1cb562['destroy']()[_0x3eb8('0xf')](function(){_0x229dfa['status'](0xcc)[_0x3eb8('0x10')]();});}};}function handleEntityNotFound(_0x495bc3){return function(_0xc41880){if(!_0xc41880){_0x495bc3['sendStatus'](0x194);}return _0xc41880;};}function handleError(_0x62a40,_0x5a57c5){_0x5a57c5=_0x5a57c5||0x1f4;return function(_0x2ad4bc){logger[_0x3eb8('0x11')](_0x2ad4bc['stack']);if(_0x2ad4bc[_0x3eb8('0x12')]){delete _0x2ad4bc['name'];}_0x62a40['status'](_0x5a57c5)[_0x3eb8('0x13')](_0x2ad4bc);};}exports['index']=function(_0x325d18,_0x304a94){var _0x131c2c={},_0x1fc913={},_0xaf957c={'count':0x0,'rows':[]};var _0x2e021a=_[_0x3eb8('0x14')](db['Dynamics365Account'][_0x3eb8('0x15')],function(_0x51c943){return{'name':_0x51c943['fieldName'],'type':_0x51c943[_0x3eb8('0x16')][_0x3eb8('0x17')]};});_0x1fc913['model']=_[_0x3eb8('0x14')](_0x2e021a,_0x3eb8('0x12'));_0x1fc913[_0x3eb8('0x18')]=_[_0x3eb8('0x19')](_0x325d18[_0x3eb8('0x18')]);_0x1fc913[_0x3eb8('0x1a')]=_['intersection'](_0x1fc913['model'],_0x1fc913[_0x3eb8('0x18')]);_0x131c2c[_0x3eb8('0x1b')]=_[_0x3eb8('0x1c')](_0x1fc913[_0x3eb8('0x1d')],qs['fields'](_0x325d18['query'][_0x3eb8('0x1e')]));_0x131c2c[_0x3eb8('0x1b')]=_0x131c2c[_0x3eb8('0x1b')][_0x3eb8('0x1f')]?_0x131c2c[_0x3eb8('0x1b')]:_0x1fc913['model'];if(!_0x325d18[_0x3eb8('0x18')][_0x3eb8('0x20')](_0x3eb8('0x21'))){_0x131c2c['limit']=qs[_0x3eb8('0xa')](_0x325d18[_0x3eb8('0x18')][_0x3eb8('0xa')]);_0x131c2c['offset']=qs['offset'](_0x325d18[_0x3eb8('0x18')][_0x3eb8('0x8')]);}_0x131c2c['order']=qs[_0x3eb8('0x22')](_0x325d18[_0x3eb8('0x18')][_0x3eb8('0x22')]);_0x131c2c[_0x3eb8('0x23')]=qs[_0x3eb8('0x1a')](_[_0x3eb8('0x24')](_0x325d18[_0x3eb8('0x18')],_0x1fc913[_0x3eb8('0x1a')]),_0x2e021a);if(_0x325d18[_0x3eb8('0x18')][_0x3eb8('0x25')]){_0x131c2c[_0x3eb8('0x23')]=_[_0x3eb8('0x26')](_0x131c2c[_0x3eb8('0x23')],{'$or':_[_0x3eb8('0x14')](_0x2e021a,function(_0x42734e){if(_0x42734e[_0x3eb8('0x16')]!==_0x3eb8('0x27')){var _0x95e86e={};_0x95e86e[_0x42734e[_0x3eb8('0x12')]]={'$like':'%'+_0x325d18['query'][_0x3eb8('0x25')]+'%'};return _0x95e86e;}})});}_0x131c2c=_[_0x3eb8('0x26')]({},_0x131c2c,_0x325d18[_0x3eb8('0x28')]);var _0x15e5a9={'where':_0x131c2c[_0x3eb8('0x23')]};return db[_0x3eb8('0x29')][_0x3eb8('0xb')](_0x15e5a9)[_0x3eb8('0xf')](function(_0x31ed15){_0xaf957c[_0x3eb8('0xb')]=_0x31ed15;if(_0x325d18[_0x3eb8('0x18')][_0x3eb8('0x2a')]){_0x131c2c[_0x3eb8('0x2b')]=[{'all':!![]}];}return db[_0x3eb8('0x29')][_0x3eb8('0x2c')](_0x131c2c);})[_0x3eb8('0xf')](function(_0x2554fd){_0xaf957c[_0x3eb8('0x2d')]=_0x2554fd;return _0xaf957c;})[_0x3eb8('0xf')](respondWithFilteredResult(_0x304a94,_0x131c2c))[_0x3eb8('0x2e')](handleError(_0x304a94,null));};exports['show']=function(_0x55da29,_0x369ed0){var _0x4f5f4c={'raw':![],'where':{'id':_0x55da29[_0x3eb8('0x2f')]['id']}},_0x1485e0={};_0x1485e0['model']=_[_0x3eb8('0x19')](db[_0x3eb8('0x29')][_0x3eb8('0x15')]);_0x1485e0['query']=_['keys'](_0x55da29[_0x3eb8('0x18')]);_0x1485e0[_0x3eb8('0x1a')]=_[_0x3eb8('0x1c')](_0x1485e0[_0x3eb8('0x1d')],_0x1485e0[_0x3eb8('0x18')]);_0x4f5f4c[_0x3eb8('0x1b')]=_['intersection'](_0x1485e0[_0x3eb8('0x1d')],qs[_0x3eb8('0x1e')](_0x55da29[_0x3eb8('0x18')][_0x3eb8('0x1e')]));_0x4f5f4c[_0x3eb8('0x1b')]=_0x4f5f4c[_0x3eb8('0x1b')][_0x3eb8('0x1f')]?_0x4f5f4c[_0x3eb8('0x1b')]:_0x1485e0[_0x3eb8('0x1d')];if(_0x55da29[_0x3eb8('0x18')][_0x3eb8('0x2a')]){_0x4f5f4c[_0x3eb8('0x2b')]=[{'all':!![]}];}_0x4f5f4c=_[_0x3eb8('0x26')]({},_0x4f5f4c,_0x55da29[_0x3eb8('0x28')]);return db[_0x3eb8('0x29')][_0x3eb8('0x30')](_0x4f5f4c)['then'](handleEntityNotFound(_0x369ed0,null))[_0x3eb8('0xf')](respondWithResult(_0x369ed0,null))['catch'](handleError(_0x369ed0,null));};exports[_0x3eb8('0x31')]=function(_0x1a8608,_0x570719){return db[_0x3eb8('0x29')][_0x3eb8('0x31')](_0x1a8608[_0x3eb8('0x32')],{})[_0x3eb8('0xf')](respondWithResult(_0x570719,0xc9))[_0x3eb8('0x2e')](handleError(_0x570719,null));};exports[_0x3eb8('0xe')]=function(_0x39491f,_0x30d64b){if(_0x39491f['body']['id']){delete _0x39491f[_0x3eb8('0x32')]['id'];}return db[_0x3eb8('0x29')][_0x3eb8('0x30')]({'where':{'id':_0x39491f[_0x3eb8('0x2f')]['id']}})[_0x3eb8('0xf')](handleEntityNotFound(_0x30d64b,null))[_0x3eb8('0xf')](saveUpdates(_0x39491f['body'],null))[_0x3eb8('0xf')](respondWithResult(_0x30d64b,null))[_0x3eb8('0x2e')](handleError(_0x30d64b,null));};exports['destroy']=function(_0xe00203,_0x3108ef){return db[_0x3eb8('0x29')][_0x3eb8('0x30')]({'where':{'id':_0xe00203[_0x3eb8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3108ef,null))[_0x3eb8('0xf')](removeEntity(_0x3108ef,null))['catch'](handleError(_0x3108ef,null));};exports[_0x3eb8('0x33')]=function(_0x116b67,_0x92ee37){var _0x5361cd={};var _0x3cae82={};var _0x9b7ad1;var _0x4cfced;return db['Dynamics365Account'][_0x3eb8('0x34')]({'where':{'id':_0x116b67[_0x3eb8('0x2f')]['id']}})[_0x3eb8('0xf')](handleEntityNotFound(_0x92ee37,null))[_0x3eb8('0xf')](function(_0x49e4f2){if(_0x49e4f2){_0x9b7ad1=_0x49e4f2;_0x3cae82[_0x3eb8('0x1d')]=_['keys'](db[_0x3eb8('0x35')][_0x3eb8('0x15')]);_0x3cae82[_0x3eb8('0x18')]=_[_0x3eb8('0x19')](_0x116b67[_0x3eb8('0x18')]);_0x3cae82[_0x3eb8('0x1a')]=_[_0x3eb8('0x1c')](_0x3cae82[_0x3eb8('0x1d')],_0x3cae82['query']);_0x5361cd[_0x3eb8('0x1b')]=_[_0x3eb8('0x1c')](_0x3cae82[_0x3eb8('0x1d')],qs[_0x3eb8('0x1e')](_0x116b67[_0x3eb8('0x18')]['fields']));_0x5361cd['attributes']=_0x5361cd[_0x3eb8('0x1b')][_0x3eb8('0x1f')]?_0x5361cd[_0x3eb8('0x1b')]:_0x3cae82['model'];_0x5361cd[_0x3eb8('0x36')]=qs[_0x3eb8('0x22')](_0x116b67[_0x3eb8('0x18')][_0x3eb8('0x22')]);_0x5361cd[_0x3eb8('0x23')]=qs[_0x3eb8('0x1a')](_[_0x3eb8('0x24')](_0x116b67[_0x3eb8('0x18')],_0x3cae82[_0x3eb8('0x1a')]));if(_0x116b67['query'][_0x3eb8('0x25')]){_0x5361cd[_0x3eb8('0x23')]=_[_0x3eb8('0x26')](_0x5361cd[_0x3eb8('0x23')],{'$or':_[_0x3eb8('0x14')](_0x5361cd[_0x3eb8('0x1b')],function(_0x3fe514){var _0x23d90a={};_0x23d90a[_0x3fe514]={'$like':'%'+_0x116b67[_0x3eb8('0x18')][_0x3eb8('0x25')]+'%'};return _0x23d90a;})});}_0x5361cd=_[_0x3eb8('0x26')]({},_0x5361cd,_0x116b67[_0x3eb8('0x28')]);return _0x9b7ad1['getConfigurations'](_0x5361cd);}})[_0x3eb8('0xf')](function(_0x369b3d){if(_0x369b3d){_0x4cfced=_0x369b3d['length'];if(!_0x116b67['query'][_0x3eb8('0x20')](_0x3eb8('0x21'))){_0x5361cd[_0x3eb8('0xa')]=qs[_0x3eb8('0xa')](_0x116b67[_0x3eb8('0x18')][_0x3eb8('0xa')]);_0x5361cd[_0x3eb8('0x8')]=qs[_0x3eb8('0x8')](_0x116b67[_0x3eb8('0x18')][_0x3eb8('0x8')]);}return _0x9b7ad1[_0x3eb8('0x33')](_0x5361cd);}})[_0x3eb8('0xf')](function(_0x5ac9ef){if(_0x5ac9ef){return _0x5ac9ef?{'count':_0x4cfced,'rows':_0x5ac9ef}:null;}})[_0x3eb8('0xf')](respondWithResult(_0x92ee37,null))[_0x3eb8('0x2e')](handleError(_0x92ee37,null));};exports[_0x3eb8('0x37')]=function(_0x4fcbcf,_0x550056){if(_0x4fcbcf[_0x3eb8('0x32')]['id']){delete _0x4fcbcf[_0x3eb8('0x32')]['id'];}return db[_0x3eb8('0x29')][_0x3eb8('0x34')]({'where':{'id':_0x4fcbcf[_0x3eb8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x550056,null))['then'](function(_0x111fe5){if(_0x111fe5){_0x4fcbcf[_0x3eb8('0x32')][_0x3eb8('0x38')]=_0x111fe5['id'];_0x4fcbcf['body'][_0x3eb8('0x39')]=integrations['getSubjects'](_0x4fcbcf['body'][_0x3eb8('0x3a')],_0x4fcbcf[_0x3eb8('0x32')][_0x3eb8('0x16')]);_0x4fcbcf[_0x3eb8('0x32')]['Descriptions']=integrations[_0x3eb8('0x3b')](_0x4fcbcf['body'][_0x3eb8('0x3a')],_0x4fcbcf[_0x3eb8('0x32')]['type']);return db[_0x3eb8('0x35')]['create'](_0x4fcbcf[_0x3eb8('0x32')],{'include':[{'model':db[_0x3eb8('0x3c')],'as':_0x3eb8('0x39')},{'model':db[_0x3eb8('0x3c')],'as':_0x3eb8('0x3d')}]});}return null;})['then'](respondWithResult(_0x550056,null))[_0x3eb8('0x2e')](handleError(_0x550056,null));};function sanitizeRemoteUri(_0x46afdd){var _0x718cb8=_0x46afdd[_0x3eb8('0x3e')](-0x1);if(_0x718cb8==='/')return _0x46afdd[_0x3eb8('0x3f')](0x0,_0x46afdd[_0x3eb8('0x40')](_0x718cb8));return _0x46afdd;}function getWebApiUrl(_0xcd6078){return util[_0x3eb8('0x41')]('%s/api/data/v9.0/',_0xcd6078);}exports['getFields']=function(_0x57f6d7,_0x359f73){var _0x479c7d=_0x57f6d7['query'][_0x3eb8('0x42')];var _0x3f3388=_0x479c7d===_0x3eb8('0x43')?'Incident':_0x3eb8('0x44');var _0x3ce8a4='';var _0x3ab733='';var _0x188fa7='';var _0x5f36b6='';var _0x49a7cd='';var _0x4decca='';var _0x1337b1='';var _0x11f2ed='';var _0x54b12a=[_0x3eb8('0x45'),'description','customerid',_0x3eb8('0x46'),'caseorigincode',_0x3eb8('0x47'),_0x3eb8('0x48'),'regardingobjectid',_0x3eb8('0x49'),'phonecall_activity_parties'];var _0x677caf=[_0x3eb8('0x4a'),_0x3eb8('0x4b'),_0x3eb8('0x4c'),_0x3eb8('0x4d'),_0x3eb8('0x4e'),_0x3eb8('0x4f'),_0x3eb8('0x50'),_0x3eb8('0x51'),_0x3eb8('0x52'),_0x3eb8('0x53'),'createdbyname','createdbyyominame',_0x3eb8('0x54'),_0x3eb8('0x55'),_0x3eb8('0x56'),_0x3eb8('0x57'),'customeridtype',_0x3eb8('0x58'),_0x3eb8('0x59'),_0x3eb8('0x5a'),'entityimage_timestamp','entityimage_url',_0x3eb8('0x5b'),_0x3eb8('0x5c'),_0x3eb8('0x5d'),_0x3eb8('0x5e'),_0x3eb8('0x5f'),_0x3eb8('0x60'),_0x3eb8('0x61'),_0x3eb8('0x62'),'masteridname',_0x3eb8('0x63'),'modifiedbyexternalpartyyominame',_0x3eb8('0x64'),_0x3eb8('0x65'),_0x3eb8('0x66'),_0x3eb8('0x67'),_0x3eb8('0x68'),_0x3eb8('0x69'),'msdyn_iotalertname',_0x3eb8('0x6a'),_0x3eb8('0x6b'),'overriddencreatedon',_0x3eb8('0x6c'),_0x3eb8('0x6d'),'owneridyominame',_0x3eb8('0x6e'),'primarycontactidname',_0x3eb8('0x6f'),_0x3eb8('0x70'),_0x3eb8('0x71'),'productserialnumber',_0x3eb8('0x72'),_0x3eb8('0x73'),_0x3eb8('0x74'),_0x3eb8('0x75'),_0x3eb8('0x76'),_0x3eb8('0x77'),_0x3eb8('0x78'),'slaname',_0x3eb8('0x79'),_0x3eb8('0x7a'),'statuscode','subjectidname',_0x3eb8('0x7b'),_0x3eb8('0x7c'),'transactioncurrencyidname','traversedpath',_0x3eb8('0x7d'),'versionnumber'];var _0x154ddb=_0x54b12a['concat'](_0x677caf);return db[_0x3eb8('0x29')][_0x3eb8('0x34')]({'where':{'id':_0x57f6d7[_0x3eb8('0x2f')]['id']},'attributes':['id',_0x3eb8('0x7e'),_0x3eb8('0x7f'),_0x3eb8('0x80'),_0x3eb8('0x81'),'clientId','clientSecret',_0x3eb8('0x82')],'include':[{'model':db['CloudProvider'],'as':_0x3eb8('0x83'),'attributes':['id','data5','data7']}]})[_0x3eb8('0xf')](handleEntityNotFound(_0x359f73,null))[_0x3eb8('0xf')](function(_0xa17867){if(_0xa17867){if(_0xa17867[_0x3eb8('0x82')]){_0xa17867[_0x3eb8('0x84')]=_0xa17867[_0x3eb8('0x83')][_0x3eb8('0x85')];_0x11f2ed=sanitizeRemoteUri(_0xa17867['CloudProvider'][_0x3eb8('0x86')]);_0x1337b1=getWebApiUrl(_0x11f2ed);return _0xa17867;}_0x11f2ed=sanitizeRemoteUri(_0xa17867['remoteUri']);_0x1337b1=getWebApiUrl(_0x11f2ed);var _0x2ff2d0={'method':_0x3eb8('0x87'),'uri':'https://login.microsoftonline.com/'+_0xa17867[_0x3eb8('0x81')]+_0x3eb8('0x88'),'form':{'client_id':_0xa17867[_0x3eb8('0x89')],'resource':_0x11f2ed,'username':_0xa17867[_0x3eb8('0x7e')],'password':_0xa17867[_0x3eb8('0x7f')],'grant_type':_0x3eb8('0x7f'),'client_secret':_0xa17867[_0x3eb8('0x8a')]},'json':!![]};return rp(_0x2ff2d0);}})[_0x3eb8('0xf')](function(_0x46302f){_0x4decca=_0x46302f[_0x3eb8('0x84')];var _0x11cd78={'method':'GET','uri':encodeURI(_0x1337b1+_0x3eb8('0x8b')+_0x3f3388+'\x27'),'headers':{'Authorization':_0x3eb8('0x8c')+_0x4decca,'If-None-Match':null,'OData-Version':_0x3eb8('0x8d')},'json':!![]};return rp(_0x11cd78);})[_0x3eb8('0xf')](function(_0x4aaa15){var _0x34b9c2=_0x4aaa15['value'][0x0];var _0x58d5fe=_0x34b9c2['MetadataId'];var _0x17d5d1={'method':_0x3eb8('0x8e'),'uri':_0x1337b1+_0x3eb8('0x8f')+_0x58d5fe+_0x3eb8('0x90'),'headers':{'Authorization':_0x3eb8('0x8c')+_0x4decca,'If-None-Match':null,'OData-Version':_0x3eb8('0x8d')},'json':!![]};return rp(_0x17d5d1);})['then'](function(_0x4019b7){_0x3ce8a4=_0x4019b7;_0x3ab733=_0x3ce8a4['Attributes'];_0x3ab733=_['remove'](_0x3ab733,function(_0x2f8b4a){return!_0x154ddb['includes'](_0x2f8b4a[_0x3eb8('0x91')]);});var _0x33daa2=[];var _0x499c18=[];_0x3ab733[_0x3eb8('0x92')](function(_0x3ee006){if(_0x3ee006[_0x3eb8('0x93')]){var _0x990e83=_0x3ee006[_0x3eb8('0x93')][_0x3eb8('0x3f')](_0x3ee006[_0x3eb8('0x93')]['lastIndexOf']('.')+0x1);if(_0x990e83===_0x3eb8('0x94')){_0x33daa2[_0x3eb8('0x95')](getSelectList(_0x1337b1,_0x479c7d,_0x499c18,_0x3ce8a4[_0x3eb8('0x96')],_0x3ee006[_0x3eb8('0x96')],_0x4decca));}}});return Promise[_0x3eb8('0x97')](_0x33daa2);})['then'](function(_0x59e38c){_0x188fa7=_0x59e38c[0x0];var _0x3facce=[];var _0x52f116=[];_0x3ab733['forEach'](function(_0x5d4065){if(!_['isNil'](_0x5d4065[_0x3eb8('0x93')])){var _0x5be843=_0x5d4065[_0x3eb8('0x93')]['substring'](_0x5d4065['@odata.type'][_0x3eb8('0x40')]('.')+0x1);if(_0x5be843===_0x3eb8('0x98')){_0x3facce[_0x3eb8('0x95')](getBooleanList(_0x1337b1,_0x479c7d,_0x52f116,_0x3ce8a4[_0x3eb8('0x96')],_0x5d4065[_0x3eb8('0x96')],_0x4decca));}}});return Promise[_0x3eb8('0x97')](_0x3facce);})[_0x3eb8('0xf')](function(_0x24cb85){_0x5f36b6=_0x24cb85[0x0];var _0x14c160=[];var _0x47d50b=[];_0x3ab733[_0x3eb8('0x92')](function(_0x41a69f){if(_0x41a69f[_0x3eb8('0x93')]){var _0x678103=_0x41a69f[_0x3eb8('0x93')]['substring'](_0x41a69f['@odata.type'][_0x3eb8('0x40')]('.')+0x1);if(_0x678103==='StringAttributeMetadata'||_0x678103===_0x3eb8('0x99')||_0x678103===_0x3eb8('0x9a')||_0x678103===_0x3eb8('0x9b')||_0x678103===_0x3eb8('0x9c')||_0x678103===_0x3eb8('0x9d')||_0x678103===_0x3eb8('0x9e')||_0x678103===_0x3eb8('0x9f')||_0x678103===_0x3eb8('0xa0')||_0x678103==='DecimalAttributeMetadata'){_0x14c160[_0x3eb8('0x95')](getInputList(_0x1337b1,_0x479c7d,_0x678103,_0x47d50b,_0x3ce8a4[_0x3eb8('0x96')],_0x41a69f[_0x3eb8('0x96')],_0x4decca));}}});return Promise[_0x3eb8('0x97')](_0x14c160);})['then'](function(_0x12cb2b){_0x49a7cd=_0x12cb2b[0x0];var _0x8c5416=_0x188fa7[_0x3eb8('0xa1')](_0x5f36b6)[_0x3eb8('0xa1')](_0x49a7cd);var _0x2a7384={'count':_0x8c5416['length'],'rows':_0x8c5416};return _0x2a7384;})[_0x3eb8('0xf')](respondWithResult(_0x359f73,null))['catch'](function(_0x248fd9){var _0x5c6832=_0x57f6d7[_0x3eb8('0x18')][_0x3eb8('0xa2')]?0x1f4:_0x248fd9['statusCode']||0x1f4;logger[_0x3eb8('0x11')](_0x248fd9[_0x3eb8('0xa3')]);delete _0x248fd9[_0x3eb8('0x12')];if(_0x5c6832===0x191){_0x5c6832=0x190;}_0x359f73[_0x3eb8('0x6')](_0x5c6832)[_0x3eb8('0x13')](_0x57f6d7[_0x3eb8('0x18')]['test']?{'message':_0x3eb8('0xa4'),'statusCode':_0x248fd9[_0x3eb8('0xa5')]}:_0x248fd9);});};function getSelectList(_0x147b14,_0x3b78ff,_0x148033,_0x16b102,_0x36967e,_0x1fa58c){var _0x30a619={'method':_0x3eb8('0x8e'),'uri':_0x147b14+_0x3eb8('0x8f')+_0x16b102+')/Attributes('+_0x36967e+_0x3eb8('0xa6')+_0x3eb8('0xa7'),'headers':{'Authorization':'Bearer\x20'+_0x1fa58c,'If-None-Match':null,'OData-Version':_0x3eb8('0x8d')},'json':!![]};return rp(_0x30a619)[_0x3eb8('0xf')](function(_0x5b207b){var _0x51aafb=[];var _0x57e5d0=_0x5b207b[_0x3eb8('0xa8')][_0x3eb8('0xa9')];_0x57e5d0[_0x3eb8('0x92')](function(_0x26eb5c){_0x51aafb[_0x3eb8('0x95')]({'name':_0x26eb5c[_0x3eb8('0xaa')]['UserLocalizedLabel'][_0x3eb8('0xaa')],'value':String(_0x26eb5c[_0x3eb8('0xab')])});});var _0x5d6724={'id':_0x3b78ff+'_'+_0x5b207b[_0x3eb8('0x91')],'name':_0x5b207b[_0x3eb8('0xac')][_0x3eb8('0xad')][_0x3eb8('0xaa')],'custom':![],'options':_0x51aafb};_0x148033[_0x3eb8('0x95')](_0x5d6724);return _0x148033;});}function getBooleanList(_0x38e01,_0x19470a,_0x4e7ccd,_0x159337,_0xebb2d8,_0x1ad3e4){var _0x5d803e={'method':_0x3eb8('0x8e'),'uri':_0x38e01+_0x3eb8('0x8f')+_0x159337+_0x3eb8('0xae')+_0xebb2d8+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x3eb8('0x8c')+_0x1ad3e4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5d803e)['then'](function(_0x1b2e26){var _0x276ca3=[];_0x276ca3[_0x3eb8('0x95')]({'name':_0x1b2e26[_0x3eb8('0xa8')][_0x3eb8('0xaf')][_0x3eb8('0xaa')]['UserLocalizedLabel'][_0x3eb8('0xaa')],'value':_0x3eb8('0xb0')},{'name':_0x1b2e26[_0x3eb8('0xa8')][_0x3eb8('0xb1')][_0x3eb8('0xaa')][_0x3eb8('0xad')][_0x3eb8('0xaa')],'value':_0x3eb8('0xb2')});var _0x205a43={'id':_0x19470a+'_'+_0x1b2e26[_0x3eb8('0x91')],'name':_0x1b2e26[_0x3eb8('0xac')][_0x3eb8('0xad')][_0x3eb8('0xaa')],'custom':![],'options':_0x276ca3};_0x4e7ccd['push'](_0x205a43);return _0x4e7ccd;});}function getInputList(_0x598139,_0x283474,_0x3d1855,_0xa1acfc,_0x40865f,_0x421596,_0x17db08){var _0x5d3f73={'method':'GET','uri':_0x598139+_0x3eb8('0x8f')+_0x40865f+')/Attributes('+_0x421596+_0x3eb8('0xb3')+_0x3d1855+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x3eb8('0x8c')+_0x17db08,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5d3f73)[_0x3eb8('0xf')](function(_0x32b43d){var _0x446d9d={'id':_0x283474+'_'+_0x32b43d[_0x3eb8('0x91')],'name':_0x32b43d['DisplayName']['UserLocalizedLabel']?_0x32b43d[_0x3eb8('0xac')][_0x3eb8('0xad')]['Label']:_0x32b43d[_0x3eb8('0x91')],'custom':![],'options':[]};_0xa1acfc[_0x3eb8('0x95')](_0x446d9d);return _0xa1acfc;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index c892010..b10dcdc 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x194244,_0x31748a){var _0x3f66db=function(_0x425567){while(--_0x425567){_0x194244['push'](_0x194244['shift']());}};_0x3f66db(++_0x31748a);}(_0x757a,0xde));var _0xa757=function(_0x21d807,_0x3318e0){_0x21d807=_0x21d807-0x0;var _0x2dcb8a=_0x757a[_0x21d807];return _0x2dcb8a;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x11a750,_0xb63301){var _0x133409=function(_0x24aa49){while(--_0x24aa49){_0x11a750['push'](_0x11a750['shift']());}};_0x133409(++_0xb63301);}(_0x757a,0xde));var _0xa757=function(_0x34f302,_0x42c7da){_0x34f302=_0x34f302-0x0;var _0x354c2=_0x757a[_0x34f302];return _0x354c2;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 8f0cc17..4349c9e 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 _0x8260=['then','info','request\x20sent','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','debug','ShowDynamics365Account','find','where','lodash','moment','bluebird','../../mysqldb','../../config/utils','client','http'];(function(_0xec2ebc,_0x3ded7f){var _0x463c60=function(_0x39f356){while(--_0x39f356){_0xec2ebc['push'](_0xec2ebc['shift']());}};_0x463c60(++_0x3ded7f);}(_0x8260,0x18c));var _0x0826=function(_0x34c8ff,_0x674110){_0x34c8ff=_0x34c8ff-0x0;var _0x42601c=_0x8260[_0x34c8ff];return _0x42601c;};'use strict';var _=require(_0x0826('0x0'));var util=require('util');var moment=require(_0x0826('0x1'));var BPromise=require(_0x0826('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0826('0x3'))['db'];var utils=require(_0x0826('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0826('0x5')][_0x0826('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x13035b,_0x123807,_0x32920d){return new BPromise(function(_0x2dd6ae,_0x133c37){return client['request'](_0x13035b,_0x32920d)[_0x0826('0x7')](function(_0x147da3){logger[_0x0826('0x8')]('Dynamics365Account,\x20%s,\x20%s',_0x123807,_0x0826('0x9'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x123807,_0x0826('0x9'),JSON[_0x0826('0xa')](_0x147da3));if(_0x147da3[_0x0826('0xb')]){if(_0x147da3[_0x0826('0xb')][_0x0826('0xc')]===0x1f4){logger['error'](_0x0826('0xd'),_0x123807,_0x147da3[_0x0826('0xb')]['message']);return _0x133c37(_0x147da3[_0x0826('0xb')][_0x0826('0xe')]);}logger[_0x0826('0xb')](_0x0826('0xd'),_0x123807,_0x147da3['error'][_0x0826('0xe')]);return _0x2dd6ae(_0x147da3[_0x0826('0xb')]['message']);}else{logger[_0x0826('0x8')]('Dynamics365Account,\x20%s,\x20%s',_0x123807,_0x0826('0x9'));_0x2dd6ae(_0x147da3[_0x0826('0xf')]['message']);}})[_0x0826('0x10')](function(_0x11d1ed){logger[_0x0826('0xb')](_0x0826('0xd'),_0x123807,_0x11d1ed);_0x133c37(_0x11d1ed);});});}exports[_0x0826('0x11')]=function(_0x27766b){var _0xbae033=this;return new Promise(function(_0x57c0e9,_0x5568c7){return db[_0x0826('0x12')][_0x0826('0x13')]({'raw':_0x27766b[_0x0826('0x14')]?_0x27766b[_0x0826('0x14')][_0x0826('0x15')]===undefined?!![]:![]:!![],'where':_0x27766b['options']?_0x27766b[_0x0826('0x14')]['where']||null:null,'attributes':_0x27766b['options']?_0x27766b['options'][_0x0826('0x16')]||null:null,'limit':_0x27766b[_0x0826('0x14')]?_0x27766b[_0x0826('0x14')][_0x0826('0x17')]||null:null,'include':_0x27766b[_0x0826('0x14')]?_0x27766b[_0x0826('0x14')][_0x0826('0x18')]?_[_0x0826('0x19')](_0x27766b[_0x0826('0x14')][_0x0826('0x18')],function(_0x186205){return{'model':db[_0x186205['model']],'as':_0x186205['as'],'attributes':_0x186205['attributes'],'include':_0x186205['include']?_[_0x0826('0x19')](_0x186205['include'],function(_0x4f1d42){return{'model':db[_0x4f1d42[_0x0826('0x1a')]],'as':_0x4f1d42['as'],'attributes':_0x4f1d42[_0x0826('0x16')],'include':_0x4f1d42[_0x0826('0x18')]?_[_0x0826('0x19')](_0x4f1d42[_0x0826('0x18')],function(_0x2a03b5){return{'model':db[_0x2a03b5[_0x0826('0x1a')]],'as':_0x2a03b5['as'],'attributes':_0x2a03b5[_0x0826('0x16')]};}):[]};}):[]};}):[]:[]})[_0x0826('0x7')](function(_0x479561){logger['info'](_0x0826('0x11'),_0x27766b);logger[_0x0826('0x1b')]('GetDynamics365Account',_0x27766b,JSON[_0x0826('0xa')](_0x479561));_0x57c0e9(_0x479561);})['catch'](function(_0x3d75ce){logger[_0x0826('0xb')](_0x0826('0x11'),_0x3d75ce[_0x0826('0xe')],_0x27766b);_0x5568c7(_0xbae033[_0x0826('0xb')](0x1f4,_0x3d75ce[_0x0826('0xe')]));});});};exports[_0x0826('0x1c')]=function(_0x37bd3e){var _0x16fefa=this;return new Promise(function(_0x1cae3d,_0x27c519){return db[_0x0826('0x12')][_0x0826('0x1d')]({'raw':_0x37bd3e[_0x0826('0x14')]?_0x37bd3e[_0x0826('0x14')][_0x0826('0x15')]===undefined?!![]:![]:!![],'where':_0x37bd3e[_0x0826('0x14')]?_0x37bd3e[_0x0826('0x14')][_0x0826('0x1e')]||null:null,'attributes':_0x37bd3e[_0x0826('0x14')]?_0x37bd3e['options'][_0x0826('0x16')]||null:null,'include':_0x37bd3e[_0x0826('0x14')]?_0x37bd3e[_0x0826('0x14')][_0x0826('0x18')]?_[_0x0826('0x19')](_0x37bd3e['options']['include'],function(_0x486e7b){return{'model':db[_0x486e7b[_0x0826('0x1a')]],'as':_0x486e7b['as'],'attributes':_0x486e7b['attributes'],'include':_0x486e7b[_0x0826('0x18')]?_[_0x0826('0x19')](_0x486e7b['include'],function(_0x4bae35){return{'model':db[_0x4bae35['model']],'as':_0x4bae35['as'],'attributes':_0x4bae35['attributes'],'include':_0x4bae35[_0x0826('0x18')]?_['map'](_0x4bae35['include'],function(_0x44bf88){return{'model':db[_0x44bf88[_0x0826('0x1a')]],'as':_0x44bf88['as'],'attributes':_0x44bf88['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x38a49f){logger['info']('ShowDynamics365Account',_0x37bd3e);logger[_0x0826('0x1b')](_0x0826('0x1c'),_0x37bd3e,JSON['stringify'](_0x38a49f));_0x1cae3d(_0x38a49f);})[_0x0826('0x10')](function(_0x18fdf3){logger[_0x0826('0xb')]('ShowDynamics365Account',_0x18fdf3[_0x0826('0xe')],_0x37bd3e);_0x27c519(_0x16fefa[_0x0826('0xb')](0x1f4,_0x18fdf3['message']));});});}; \ No newline at end of file +var _0x9ec0=['catch','GetDynamics365Account','Dynamics365Account','options','raw','where','limit','include','map','model','attributes','then','find','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x9ec0,0x118));var _0x09ec=function(_0x337bee,_0x53cbca){_0x337bee=_0x337bee-0x0;var _0x24c37d=_0x9ec0[_0x337bee];return _0x24c37d;};'use strict';var _=require(_0x09ec('0x0'));var util=require(_0x09ec('0x1'));var moment=require(_0x09ec('0x2'));var BPromise=require(_0x09ec('0x3'));var rs=require(_0x09ec('0x4'));var fs=require('fs');var Redis=require(_0x09ec('0x5'));var db=require(_0x09ec('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x09ec('0x7'))(_0x09ec('0x8'));var config=require(_0x09ec('0x9'));var jayson=require(_0x09ec('0xa'));var client=jayson[_0x09ec('0xb')][_0x09ec('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x406e76,_0x42faec,_0x41d14a){return new BPromise(function(_0x3e471d,_0x356c20){return client[_0x09ec('0xd')](_0x406e76,_0x41d14a)['then'](function(_0x2d5fdc){logger['info'](_0x09ec('0xe'),_0x42faec,'request\x20sent');logger[_0x09ec('0xf')](_0x09ec('0x10'),_0x42faec,'request\x20sent',JSON[_0x09ec('0x11')](_0x2d5fdc));if(_0x2d5fdc['error']){if(_0x2d5fdc[_0x09ec('0x12')][_0x09ec('0x13')]===0x1f4){logger[_0x09ec('0x12')](_0x09ec('0xe'),_0x42faec,_0x2d5fdc[_0x09ec('0x12')][_0x09ec('0x14')]);return _0x356c20(_0x2d5fdc[_0x09ec('0x12')][_0x09ec('0x14')]);}logger[_0x09ec('0x12')](_0x09ec('0xe'),_0x42faec,_0x2d5fdc[_0x09ec('0x12')][_0x09ec('0x14')]);return _0x3e471d(_0x2d5fdc[_0x09ec('0x12')][_0x09ec('0x14')]);}else{logger[_0x09ec('0x15')](_0x09ec('0xe'),_0x42faec,_0x09ec('0x16'));_0x3e471d(_0x2d5fdc[_0x09ec('0x17')][_0x09ec('0x14')]);}})[_0x09ec('0x18')](function(_0x2b9deb){logger[_0x09ec('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x42faec,_0x2b9deb);_0x356c20(_0x2b9deb);});});}exports[_0x09ec('0x19')]=function(_0x105fbf){var _0x1ad8de=this;return new Promise(function(_0x5df15b,_0x16ee19){return db[_0x09ec('0x1a')]['findAll']({'raw':_0x105fbf[_0x09ec('0x1b')]?_0x105fbf['options'][_0x09ec('0x1c')]===undefined?!![]:![]:!![],'where':_0x105fbf[_0x09ec('0x1b')]?_0x105fbf[_0x09ec('0x1b')][_0x09ec('0x1d')]||null:null,'attributes':_0x105fbf[_0x09ec('0x1b')]?_0x105fbf[_0x09ec('0x1b')]['attributes']||null:null,'limit':_0x105fbf['options']?_0x105fbf[_0x09ec('0x1b')][_0x09ec('0x1e')]||null:null,'include':_0x105fbf['options']?_0x105fbf[_0x09ec('0x1b')][_0x09ec('0x1f')]?_[_0x09ec('0x20')](_0x105fbf[_0x09ec('0x1b')]['include'],function(_0x2cd0c6){return{'model':db[_0x2cd0c6[_0x09ec('0x21')]],'as':_0x2cd0c6['as'],'attributes':_0x2cd0c6[_0x09ec('0x22')],'include':_0x2cd0c6[_0x09ec('0x1f')]?_[_0x09ec('0x20')](_0x2cd0c6[_0x09ec('0x1f')],function(_0x3f1a56){return{'model':db[_0x3f1a56['model']],'as':_0x3f1a56['as'],'attributes':_0x3f1a56[_0x09ec('0x22')],'include':_0x3f1a56[_0x09ec('0x1f')]?_[_0x09ec('0x20')](_0x3f1a56['include'],function(_0x456e07){return{'model':db[_0x456e07[_0x09ec('0x21')]],'as':_0x456e07['as'],'attributes':_0x456e07[_0x09ec('0x22')]};}):[]};}):[]};}):[]:[]})[_0x09ec('0x23')](function(_0x3329ed){logger[_0x09ec('0x15')](_0x09ec('0x19'),_0x105fbf);logger['debug']('GetDynamics365Account',_0x105fbf,JSON[_0x09ec('0x11')](_0x3329ed));_0x5df15b(_0x3329ed);})[_0x09ec('0x18')](function(_0x607334){logger[_0x09ec('0x12')](_0x09ec('0x19'),_0x607334[_0x09ec('0x14')],_0x105fbf);_0x16ee19(_0x1ad8de[_0x09ec('0x12')](0x1f4,_0x607334[_0x09ec('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x5d01bd){var _0x39e502=this;return new Promise(function(_0x4477e5,_0x2431f9){return db[_0x09ec('0x1a')][_0x09ec('0x24')]({'raw':_0x5d01bd[_0x09ec('0x1b')]?_0x5d01bd[_0x09ec('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5d01bd[_0x09ec('0x1b')]?_0x5d01bd['options']['where']||null:null,'attributes':_0x5d01bd[_0x09ec('0x1b')]?_0x5d01bd[_0x09ec('0x1b')][_0x09ec('0x22')]||null:null,'include':_0x5d01bd[_0x09ec('0x1b')]?_0x5d01bd[_0x09ec('0x1b')][_0x09ec('0x1f')]?_[_0x09ec('0x20')](_0x5d01bd[_0x09ec('0x1b')][_0x09ec('0x1f')],function(_0x1e1ff9){return{'model':db[_0x1e1ff9[_0x09ec('0x21')]],'as':_0x1e1ff9['as'],'attributes':_0x1e1ff9[_0x09ec('0x22')],'include':_0x1e1ff9[_0x09ec('0x1f')]?_[_0x09ec('0x20')](_0x1e1ff9[_0x09ec('0x1f')],function(_0x3db9c4){return{'model':db[_0x3db9c4[_0x09ec('0x21')]],'as':_0x3db9c4['as'],'attributes':_0x3db9c4[_0x09ec('0x22')],'include':_0x3db9c4[_0x09ec('0x1f')]?_['map'](_0x3db9c4[_0x09ec('0x1f')],function(_0x3432fe){return{'model':db[_0x3432fe[_0x09ec('0x21')]],'as':_0x3432fe['as'],'attributes':_0x3432fe[_0x09ec('0x22')]};}):[]};}):[]};}):[]:[]})[_0x09ec('0x23')](function(_0x3f3592){logger[_0x09ec('0x15')](_0x09ec('0x25'),_0x5d01bd);logger[_0x09ec('0xf')](_0x09ec('0x25'),_0x5d01bd,JSON['stringify'](_0x3f3592));_0x4477e5(_0x3f3592);})[_0x09ec('0x18')](function(_0x5430dc){logger[_0x09ec('0x12')](_0x09ec('0x25'),_0x5430dc[_0x09ec('0x14')],_0x5d01bd);_0x2431f9(_0x39e502[_0x09ec('0x12')](0x1f4,_0x5430dc[_0x09ec('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 472bf1c..ac42d49 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 _0x7c93=['post','create','put','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x7c93,0x16e));var _0x37c9=function(_0x278537,_0x3c8b81){_0x278537=_0x278537-0x0;var _0x3a00bd=_0x7c93[_0x278537];return _0x3a00bd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x37c9('0x0'));var timeout=require(_0x37c9('0x1'));var express=require(_0x37c9('0x2'));var router=express['Router']();var fs_extra=require(_0x37c9('0x3'));var auth=require(_0x37c9('0x4'));var interaction=require(_0x37c9('0x5'));var config=require(_0x37c9('0x6'));var controller=require(_0x37c9('0x7'));router[_0x37c9('0x8')]('/',auth[_0x37c9('0x9')](),controller[_0x37c9('0xa')]);router[_0x37c9('0x8')](_0x37c9('0xb'),auth[_0x37c9('0x9')](),controller[_0x37c9('0xc')]);router[_0x37c9('0x8')](_0x37c9('0xd'),auth[_0x37c9('0x9')](),controller[_0x37c9('0xe')]);router[_0x37c9('0x8')]('/:id/subjects',auth[_0x37c9('0x9')](),controller[_0x37c9('0xf')]);router[_0x37c9('0x8')](_0x37c9('0x10'),auth[_0x37c9('0x9')](),controller[_0x37c9('0x11')]);router[_0x37c9('0x12')]('/',auth[_0x37c9('0x9')](),controller[_0x37c9('0x13')]);router[_0x37c9('0x14')](_0x37c9('0xb'),auth[_0x37c9('0x9')](),controller['update']);router[_0x37c9('0x15')](_0x37c9('0xb'),auth[_0x37c9('0x9')](),controller[_0x37c9('0x16')]);module[_0x37c9('0x17')]=router; \ No newline at end of file +var _0x534b=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get'];(function(_0x200387,_0x44b0a5){var _0x2139c3=function(_0x45dbea){while(--_0x45dbea){_0x200387['push'](_0x200387['shift']());}};_0x2139c3(++_0x44b0a5);}(_0x534b,0xbd));var _0xb534=function(_0xa68d83,_0x182822){_0xa68d83=_0xa68d83-0x0;var _0x105f62=_0x534b[_0xa68d83];return _0x105f62;};'use strict';var multer=require(_0xb534('0x0'));var util=require(_0xb534('0x1'));var path=require('path');var timeout=require(_0xb534('0x2'));var express=require(_0xb534('0x3'));var router=express[_0xb534('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb534('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb534('0x6'));var controller=require(_0xb534('0x7'));router[_0xb534('0x8')]('/',auth[_0xb534('0x9')](),controller[_0xb534('0xa')]);router['get'](_0xb534('0xb'),auth[_0xb534('0x9')](),controller[_0xb534('0xc')]);router[_0xb534('0x8')](_0xb534('0xd'),auth[_0xb534('0x9')](),controller[_0xb534('0xe')]);router['get'](_0xb534('0xf'),auth['isAuthenticated'](),controller[_0xb534('0x10')]);router[_0xb534('0x8')](_0xb534('0x11'),auth[_0xb534('0x9')](),controller['getDescriptions']);router[_0xb534('0x12')]('/',auth[_0xb534('0x9')](),controller['create']);router[_0xb534('0x13')](_0xb534('0xb'),auth[_0xb534('0x9')](),controller['update']);router[_0xb534('0x14')](_0xb534('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xb534('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 425f498..ccf2db1 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 _0x417b=['BOOLEAN','sequelize','exports','STRING','incident','phonecall','contact','nothing'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x417b,0x181));var _0xb417=function(_0x5aaabd,_0x5acd37){_0x5aaabd=_0x5aaabd-0x0;var _0x1e3fb3=_0x417b[_0x5aaabd];return _0x1e3fb3;};'use strict';var Sequelize=require(_0xb417('0x0'));module[_0xb417('0x1')]={'name':{'type':Sequelize[_0xb417('0x2')]},'description':{'type':Sequelize[_0xb417('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xb417('0x3'),_0xb417('0x4')),'defaultValue':_0xb417('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0xb417('0x5'),_0xb417('0x6')),'defaultValue':_0xb417('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xb417('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xb417('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf67a=['nothing','BOOLEAN','sequelize','exports','STRING','phonecall','incident','contact'];(function(_0x2187b8,_0x5d1253){var _0x40e501=function(_0x21afb9){while(--_0x21afb9){_0x2187b8['push'](_0x2187b8['shift']());}};_0x40e501(++_0x5d1253);}(_0xf67a,0x19a));var _0xaf67=function(_0x4cedb0,_0x1132a2){_0x4cedb0=_0x4cedb0-0x0;var _0x45da59=_0xf67a[_0x4cedb0];return _0x45da59;};'use strict';var Sequelize=require(_0xaf67('0x0'));module[_0xaf67('0x1')]={'name':{'type':Sequelize[_0xaf67('0x2')]},'description':{'type':Sequelize[_0xaf67('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0xaf67('0x3')),'defaultValue':_0xaf67('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0xaf67('0x5'),_0xaf67('0x6')),'defaultValue':_0xaf67('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xaf67('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xaf67('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 2a220cd..dc816bc 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 _0x0a53=['length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','params','fields','options','find','create','body','destroy','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','offset','undefined','count','limit','set','apply','update','then','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a53,0xf7));var _0x30a5=function(_0x11b9be,_0x3a8373){_0x11b9be=_0x11b9be-0x0;var _0x32057d=_0x0a53[_0x11b9be];return _0x32057d;};'use strict';var emlformat=require(_0x30a5('0x0'));var rimraf=require(_0x30a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x30a5('0x2'));var rp=require(_0x30a5('0x3'));var moment=require(_0x30a5('0x4'));var BPromise=require(_0x30a5('0x5'));var Mustache=require(_0x30a5('0x6'));var util=require('util');var path=require(_0x30a5('0x7'));var sox=require(_0x30a5('0x8'));var csv=require('to-csv');var ejs=require(_0x30a5('0x9'));var fs=require('fs');var fs_extra=require(_0x30a5('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x30a5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x30a5('0xc'));var toCsv=require(_0x30a5('0xd'));var querystring=require(_0x30a5('0xe'));var Papa=require(_0x30a5('0xf'));var Redis=require('ioredis');var authService=require(_0x30a5('0x10'));var qs=require(_0x30a5('0x11'));var as=require(_0x30a5('0x12'));var hardwareService=require(_0x30a5('0x13'));var logger=require('../../config/logger')(_0x30a5('0x14'));var utils=require(_0x30a5('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x583fc5,_0x35db52){_0x35db52=_0x35db52||0xcc;return function(_0x33089a){if(_0x33089a){return _0x583fc5[_0x30a5('0x16')](_0x35db52);}return _0x583fc5[_0x30a5('0x17')](_0x35db52)['end']();};}function respondWithResult(_0x5236f5,_0x3bcb38){_0x3bcb38=_0x3bcb38||0xc8;return function(_0x4e7010){if(_0x4e7010){return _0x5236f5['status'](_0x3bcb38)['json'](_0x4e7010);}};}function respondWithFilteredResult(_0x3c8773,_0x10d2b0){return function(_0x2ef380){if(_0x2ef380){var _0x56c132=typeof _0x10d2b0[_0x30a5('0x18')]===_0x30a5('0x19')&&typeof _0x10d2b0['limit']==='undefined';var _0x3f0abf=_0x2ef380['count'];var _0x511501=_0x56c132?0x0:_0x10d2b0[_0x30a5('0x18')];var _0x3f48e1=_0x56c132?_0x2ef380[_0x30a5('0x1a')]:_0x10d2b0[_0x30a5('0x18')]+_0x10d2b0[_0x30a5('0x1b')];var _0x2b8e40;if(_0x3f48e1>=_0x3f0abf){_0x3f48e1=_0x3f0abf;_0x2b8e40=0xc8;}else{_0x2b8e40=0xce;}_0x3c8773[_0x30a5('0x17')](_0x2b8e40);return _0x3c8773[_0x30a5('0x1c')]('Content-Range',_0x511501+'-'+_0x3f48e1+'/'+_0x3f0abf)['json'](_0x2ef380);}return null;};}function patchUpdates(_0x14bd0e){return function(_0x5a08dc){try{jsonpatch[_0x30a5('0x1d')](_0x5a08dc,_0x14bd0e,!![]);}catch(_0x718a74){return BPromise['reject'](_0x718a74);}return _0x5a08dc['save']();};}function saveUpdates(_0x61e86b,_0x27dd4f){return function(_0x4f6cdd){if(_0x4f6cdd){return _0x4f6cdd[_0x30a5('0x1e')](_0x61e86b)[_0x30a5('0x1f')](function(_0x47c808){return _0x47c808;});}return null;};}function removeEntity(_0x4476ac,_0x4108c3){return function(_0x357265){if(_0x357265){return _0x357265['destroy']()[_0x30a5('0x1f')](function(){_0x4476ac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58703b,_0x441cd9){return function(_0x4deb03){if(!_0x4deb03){_0x58703b[_0x30a5('0x16')](0x194);}return _0x4deb03;};}function handleError(_0x278eae,_0x2bc509){_0x2bc509=_0x2bc509||0x1f4;return function(_0x2ef2af){logger[_0x30a5('0x20')](_0x2ef2af[_0x30a5('0x21')]);if(_0x2ef2af[_0x30a5('0x22')]){delete _0x2ef2af[_0x30a5('0x22')];}_0x278eae['status'](_0x2bc509)[_0x30a5('0x23')](_0x2ef2af);};}exports[_0x30a5('0x24')]=function(_0x59c013,_0x406df8){var _0x1e1919={},_0xc47f9b={},_0x9240bd={'count':0x0,'rows':[]};var _0x1a8dd5=_[_0x30a5('0x25')](db[_0x30a5('0x26')][_0x30a5('0x27')],function(_0x148cc2){return{'name':_0x148cc2[_0x30a5('0x28')],'type':_0x148cc2[_0x30a5('0x29')][_0x30a5('0x2a')]};});_0xc47f9b[_0x30a5('0x2b')]=_[_0x30a5('0x25')](_0x1a8dd5,_0x30a5('0x22'));_0xc47f9b[_0x30a5('0x2c')]=_[_0x30a5('0x2d')](_0x59c013['query']);_0xc47f9b[_0x30a5('0x2e')]=_[_0x30a5('0x2f')](_0xc47f9b['model'],_0xc47f9b[_0x30a5('0x2c')]);_0x1e1919['attributes']=_[_0x30a5('0x2f')](_0xc47f9b[_0x30a5('0x2b')],qs['fields'](_0x59c013[_0x30a5('0x2c')]['fields']));_0x1e1919[_0x30a5('0x30')]=_0x1e1919[_0x30a5('0x30')][_0x30a5('0x31')]?_0x1e1919[_0x30a5('0x30')]:_0xc47f9b['model'];if(!_0x59c013[_0x30a5('0x2c')][_0x30a5('0x32')](_0x30a5('0x33'))){_0x1e1919['limit']=qs[_0x30a5('0x1b')](_0x59c013[_0x30a5('0x2c')][_0x30a5('0x1b')]);_0x1e1919[_0x30a5('0x18')]=qs[_0x30a5('0x18')](_0x59c013['query'][_0x30a5('0x18')]);}_0x1e1919[_0x30a5('0x34')]=qs[_0x30a5('0x35')](_0x59c013[_0x30a5('0x2c')][_0x30a5('0x35')]);_0x1e1919[_0x30a5('0x36')]=qs[_0x30a5('0x2e')](_['pick'](_0x59c013[_0x30a5('0x2c')],_0xc47f9b['filters']),_0x1a8dd5);if(_0x59c013[_0x30a5('0x2c')][_0x30a5('0x37')]){_0x1e1919[_0x30a5('0x36')]=_[_0x30a5('0x38')](_0x1e1919[_0x30a5('0x36')],{'$or':_['map'](_0x1a8dd5,function(_0x55b5fe){if(_0x55b5fe[_0x30a5('0x29')]!==_0x30a5('0x39')){var _0x2e824a={};_0x2e824a[_0x55b5fe[_0x30a5('0x22')]]={'$like':'%'+_0x59c013[_0x30a5('0x2c')][_0x30a5('0x37')]+'%'};return _0x2e824a;}})});}_0x1e1919=_[_0x30a5('0x38')]({},_0x1e1919,_0x59c013['options']);var _0x522ebe={'where':_0x1e1919[_0x30a5('0x36')]};return db[_0x30a5('0x26')][_0x30a5('0x1a')](_0x522ebe)['then'](function(_0x1030fb){_0x9240bd[_0x30a5('0x1a')]=_0x1030fb;if(_0x59c013[_0x30a5('0x2c')][_0x30a5('0x3a')]){_0x1e1919[_0x30a5('0x3b')]=[{'all':!![]}];}return db[_0x30a5('0x26')]['findAll'](_0x1e1919);})[_0x30a5('0x1f')](function(_0xde40f2){_0x9240bd['rows']=_0xde40f2;return _0x9240bd;})['then'](respondWithFilteredResult(_0x406df8,_0x1e1919))[_0x30a5('0x3c')](handleError(_0x406df8,null));};exports['show']=function(_0x5012da,_0x3a917b){var _0x303473={'raw':![],'where':{'id':_0x5012da[_0x30a5('0x3d')]['id']}},_0x44bb1b={};_0x44bb1b[_0x30a5('0x2b')]=_[_0x30a5('0x2d')](db['Dynamics365Configuration'][_0x30a5('0x27')]);_0x44bb1b[_0x30a5('0x2c')]=_[_0x30a5('0x2d')](_0x5012da['query']);_0x44bb1b[_0x30a5('0x2e')]=_[_0x30a5('0x2f')](_0x44bb1b['model'],_0x44bb1b[_0x30a5('0x2c')]);_0x303473[_0x30a5('0x30')]=_[_0x30a5('0x2f')](_0x44bb1b[_0x30a5('0x2b')],qs['fields'](_0x5012da[_0x30a5('0x2c')][_0x30a5('0x3e')]));_0x303473[_0x30a5('0x30')]=_0x303473[_0x30a5('0x30')][_0x30a5('0x31')]?_0x303473[_0x30a5('0x30')]:_0x44bb1b[_0x30a5('0x2b')];if(_0x5012da['query'][_0x30a5('0x3a')]){_0x303473[_0x30a5('0x3b')]=[{'all':!![]}];}_0x303473=_[_0x30a5('0x38')]({},_0x303473,_0x5012da[_0x30a5('0x3f')]);return db[_0x30a5('0x26')][_0x30a5('0x40')](_0x303473)[_0x30a5('0x1f')](handleEntityNotFound(_0x3a917b,null))[_0x30a5('0x1f')](respondWithResult(_0x3a917b,null))['catch'](handleError(_0x3a917b,null));};exports[_0x30a5('0x41')]=function(_0x1e8797,_0x55a1e0){return db[_0x30a5('0x26')][_0x30a5('0x41')](_0x1e8797['body'],{})['then'](respondWithResult(_0x55a1e0,0xc9))[_0x30a5('0x3c')](handleError(_0x55a1e0,null));};exports[_0x30a5('0x1e')]=function(_0x2e43b1,_0x2742a8){if(_0x2e43b1[_0x30a5('0x42')]['id']){delete _0x2e43b1[_0x30a5('0x42')]['id'];}return db[_0x30a5('0x26')][_0x30a5('0x40')]({'where':{'id':_0x2e43b1[_0x30a5('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2742a8,null))[_0x30a5('0x1f')](saveUpdates(_0x2e43b1['body'],null))[_0x30a5('0x1f')](respondWithResult(_0x2742a8,null))[_0x30a5('0x3c')](handleError(_0x2742a8,null));};exports[_0x30a5('0x43')]=function(_0x2245f6,_0x28edfa){return db[_0x30a5('0x26')][_0x30a5('0x40')]({'where':{'id':_0x2245f6[_0x30a5('0x3d')]['id']}})['then'](handleEntityNotFound(_0x28edfa,null))['then'](removeEntity(_0x28edfa,null))[_0x30a5('0x3c')](handleError(_0x28edfa,null));};exports[_0x30a5('0x44')]=function(_0x303c04,_0x5cdcdd,_0x28a06a){var _0x13b096={};var _0x5694f4={};var _0x61c3a2;var _0x533bbd;return db[_0x30a5('0x26')][_0x30a5('0x45')]({'where':{'id':_0x303c04[_0x30a5('0x3d')]['id']}})[_0x30a5('0x1f')](handleEntityNotFound(_0x5cdcdd,null))[_0x30a5('0x1f')](function(_0x3c7787){if(_0x3c7787){_0x61c3a2=_0x3c7787;_0x5694f4[_0x30a5('0x2b')]=_[_0x30a5('0x2d')](db[_0x30a5('0x46')][_0x30a5('0x27')]);_0x5694f4['query']=_[_0x30a5('0x2d')](_0x303c04['query']);_0x5694f4[_0x30a5('0x2e')]=_['intersection'](_0x5694f4[_0x30a5('0x2b')],_0x5694f4[_0x30a5('0x2c')]);_0x13b096[_0x30a5('0x30')]=_[_0x30a5('0x2f')](_0x5694f4['model'],qs[_0x30a5('0x3e')](_0x303c04[_0x30a5('0x2c')][_0x30a5('0x3e')]));_0x13b096[_0x30a5('0x30')]=_0x13b096[_0x30a5('0x30')][_0x30a5('0x31')]?_0x13b096['attributes']:_0x5694f4[_0x30a5('0x2b')];_0x13b096[_0x30a5('0x34')]=qs[_0x30a5('0x35')](_0x303c04[_0x30a5('0x2c')][_0x30a5('0x35')]);_0x13b096['where']=qs['filters'](_[_0x30a5('0x47')](_0x303c04[_0x30a5('0x2c')],_0x5694f4[_0x30a5('0x2e')]));if(_0x303c04[_0x30a5('0x2c')][_0x30a5('0x37')]){_0x13b096['where']=_[_0x30a5('0x38')](_0x13b096[_0x30a5('0x36')],{'$or':_[_0x30a5('0x25')](_0x13b096[_0x30a5('0x30')],function(_0x13ae02){var _0x1026ce={};_0x1026ce[_0x13ae02]={'$like':'%'+_0x303c04[_0x30a5('0x2c')][_0x30a5('0x37')]+'%'};return _0x1026ce;})});}_0x13b096=_[_0x30a5('0x38')]({},_0x13b096,_0x303c04[_0x30a5('0x3f')]);return _0x61c3a2[_0x30a5('0x44')](_0x13b096);}})['then'](function(_0xd28eaa){if(_0xd28eaa){_0x533bbd=_0xd28eaa[_0x30a5('0x31')];if(!_0x303c04[_0x30a5('0x2c')][_0x30a5('0x32')](_0x30a5('0x33'))){_0x13b096['limit']=qs[_0x30a5('0x1b')](_0x303c04[_0x30a5('0x2c')][_0x30a5('0x1b')]);_0x13b096[_0x30a5('0x18')]=qs[_0x30a5('0x18')](_0x303c04[_0x30a5('0x2c')][_0x30a5('0x18')]);}return _0x61c3a2[_0x30a5('0x44')](_0x13b096);}})[_0x30a5('0x1f')](function(_0x4189cd){if(_0x4189cd){return _0x4189cd?{'count':_0x533bbd,'rows':_0x4189cd}:null;}})[_0x30a5('0x1f')](respondWithResult(_0x5cdcdd,null))[_0x30a5('0x3c')](handleError(_0x5cdcdd,null));};exports[_0x30a5('0x48')]=function(_0xed64a0,_0x1522c1,_0x4aae00){var _0x516d1b={};var _0x2be43c={};var _0x5812d2;var _0x14d369;return db[_0x30a5('0x26')]['findOne']({'where':{'id':_0xed64a0[_0x30a5('0x3d')]['id']}})[_0x30a5('0x1f')](handleEntityNotFound(_0x1522c1,null))[_0x30a5('0x1f')](function(_0x56c8e9){if(_0x56c8e9){_0x5812d2=_0x56c8e9;_0x2be43c[_0x30a5('0x2b')]=_[_0x30a5('0x2d')](db[_0x30a5('0x46')][_0x30a5('0x27')]);_0x2be43c[_0x30a5('0x2c')]=_[_0x30a5('0x2d')](_0xed64a0[_0x30a5('0x2c')]);_0x2be43c[_0x30a5('0x2e')]=_['intersection'](_0x2be43c[_0x30a5('0x2b')],_0x2be43c[_0x30a5('0x2c')]);_0x516d1b[_0x30a5('0x30')]=_['intersection'](_0x2be43c[_0x30a5('0x2b')],qs[_0x30a5('0x3e')](_0xed64a0[_0x30a5('0x2c')][_0x30a5('0x3e')]));_0x516d1b[_0x30a5('0x30')]=_0x516d1b[_0x30a5('0x30')][_0x30a5('0x31')]?_0x516d1b[_0x30a5('0x30')]:_0x2be43c[_0x30a5('0x2b')];_0x516d1b[_0x30a5('0x34')]=qs[_0x30a5('0x35')](_0xed64a0[_0x30a5('0x2c')][_0x30a5('0x35')]);_0x516d1b[_0x30a5('0x36')]=qs[_0x30a5('0x2e')](_[_0x30a5('0x47')](_0xed64a0['query'],_0x2be43c[_0x30a5('0x2e')]));if(_0xed64a0['query'][_0x30a5('0x37')]){_0x516d1b[_0x30a5('0x36')]=_[_0x30a5('0x38')](_0x516d1b[_0x30a5('0x36')],{'$or':_[_0x30a5('0x25')](_0x516d1b[_0x30a5('0x30')],function(_0x52f748){var _0x48c8f4={};_0x48c8f4[_0x52f748]={'$like':'%'+_0xed64a0['query'][_0x30a5('0x37')]+'%'};return _0x48c8f4;})});}_0x516d1b=_[_0x30a5('0x38')]({},_0x516d1b,_0xed64a0['options']);return _0x5812d2[_0x30a5('0x48')](_0x516d1b);}})[_0x30a5('0x1f')](function(_0x14d1d9){if(_0x14d1d9){_0x14d369=_0x14d1d9[_0x30a5('0x31')];if(!_0xed64a0[_0x30a5('0x2c')][_0x30a5('0x32')](_0x30a5('0x33'))){_0x516d1b['limit']=qs[_0x30a5('0x1b')](_0xed64a0[_0x30a5('0x2c')][_0x30a5('0x1b')]);_0x516d1b[_0x30a5('0x18')]=qs['offset'](_0xed64a0['query'][_0x30a5('0x18')]);}return _0x5812d2[_0x30a5('0x48')](_0x516d1b);}})['then'](function(_0x1b1c6a){if(_0x1b1c6a){return _0x1b1c6a?{'count':_0x14d369,'rows':_0x1b1c6a}:null;}})[_0x30a5('0x1f')](respondWithResult(_0x1522c1,null))['catch'](handleError(_0x1522c1,null));};exports['getDescriptions']=function(_0x4eefc2,_0x4f1cbe,_0x5344ad){var _0x233325={};var _0x35b475={};var _0x2b072b;var _0xe1e197;return db['Dynamics365Configuration'][_0x30a5('0x45')]({'where':{'id':_0x4eefc2[_0x30a5('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4f1cbe,null))[_0x30a5('0x1f')](function(_0x5b06b9){if(_0x5b06b9){_0x2b072b=_0x5b06b9;_0x35b475[_0x30a5('0x2b')]=_['keys'](db['Dynamics365Field'][_0x30a5('0x27')]);_0x35b475[_0x30a5('0x2c')]=_[_0x30a5('0x2d')](_0x4eefc2[_0x30a5('0x2c')]);_0x35b475['filters']=_['intersection'](_0x35b475[_0x30a5('0x2b')],_0x35b475[_0x30a5('0x2c')]);_0x233325['attributes']=_['intersection'](_0x35b475[_0x30a5('0x2b')],qs['fields'](_0x4eefc2[_0x30a5('0x2c')][_0x30a5('0x3e')]));_0x233325['attributes']=_0x233325['attributes'][_0x30a5('0x31')]?_0x233325[_0x30a5('0x30')]:_0x35b475['model'];_0x233325[_0x30a5('0x34')]=qs[_0x30a5('0x35')](_0x4eefc2[_0x30a5('0x2c')][_0x30a5('0x35')]);_0x233325['where']=qs[_0x30a5('0x2e')](_[_0x30a5('0x47')](_0x4eefc2['query'],_0x35b475[_0x30a5('0x2e')]));if(_0x4eefc2[_0x30a5('0x2c')][_0x30a5('0x37')]){_0x233325[_0x30a5('0x36')]=_[_0x30a5('0x38')](_0x233325[_0x30a5('0x36')],{'$or':_['map'](_0x233325['attributes'],function(_0x1f3c10){var _0x49cd78={};_0x49cd78[_0x1f3c10]={'$like':'%'+_0x4eefc2['query'][_0x30a5('0x37')]+'%'};return _0x49cd78;})});}_0x233325=_[_0x30a5('0x38')]({},_0x233325,_0x4eefc2[_0x30a5('0x3f')]);return _0x2b072b[_0x30a5('0x49')](_0x233325);}})[_0x30a5('0x1f')](function(_0x146cfe){if(_0x146cfe){_0xe1e197=_0x146cfe[_0x30a5('0x31')];if(!_0x4eefc2['query'][_0x30a5('0x32')]('nolimit')){_0x233325[_0x30a5('0x1b')]=qs[_0x30a5('0x1b')](_0x4eefc2[_0x30a5('0x2c')][_0x30a5('0x1b')]);_0x233325[_0x30a5('0x18')]=qs[_0x30a5('0x18')](_0x4eefc2[_0x30a5('0x2c')][_0x30a5('0x18')]);}return _0x2b072b['getDescriptions'](_0x233325);}})[_0x30a5('0x1f')](function(_0x5d420b){if(_0x5d420b){return _0x5d420b?{'count':_0xe1e197,'rows':_0x5d420b}:null;}})[_0x30a5('0x1f')](respondWithResult(_0x4f1cbe,null))[_0x30a5('0x3c')](handleError(_0x4f1cbe,null));}; \ No newline at end of file +var _0xca27=['body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create'];(function(_0x282a9c,_0x3c77d5){var _0x7d6774=function(_0x1a8c05){while(--_0x1a8c05){_0x282a9c['push'](_0x282a9c['shift']());}};_0x7d6774(++_0x3c77d5);}(_0xca27,0xf3));var _0x7ca2=function(_0x2b39c2,_0x31fdbc){_0x2b39c2=_0x2b39c2-0x0;var _0x484705=_0xca27[_0x2b39c2];return _0x484705;};'use strict';var emlformat=require(_0x7ca2('0x0'));var rimraf=require(_0x7ca2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7ca2('0x2'));var moment=require(_0x7ca2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7ca2('0x4'));var util=require(_0x7ca2('0x5'));var path=require('path');var sox=require(_0x7ca2('0x6'));var csv=require(_0x7ca2('0x7'));var ejs=require(_0x7ca2('0x8'));var fs=require('fs');var fs_extra=require(_0x7ca2('0x9'));var _=require(_0x7ca2('0xa'));var squel=require(_0x7ca2('0xb'));var crypto=require('crypto');var jsforce=require(_0x7ca2('0xc'));var deskjs=require(_0x7ca2('0xd'));var toCsv=require(_0x7ca2('0x7'));var querystring=require(_0x7ca2('0xe'));var Papa=require(_0x7ca2('0xf'));var Redis=require(_0x7ca2('0x10'));var authService=require(_0x7ca2('0x11'));var qs=require(_0x7ca2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ca2('0x13'));var logger=require('../../config/logger')(_0x7ca2('0x14'));var utils=require(_0x7ca2('0x15'));var config=require(_0x7ca2('0x16'));var licenseUtil=require(_0x7ca2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x573a2f,_0x15acc6){_0x15acc6=_0x15acc6||0xcc;return function(_0xa9954f){if(_0xa9954f){return _0x573a2f[_0x7ca2('0x18')](_0x15acc6);}return _0x573a2f[_0x7ca2('0x19')](_0x15acc6)[_0x7ca2('0x1a')]();};}function respondWithResult(_0x309a59,_0x1e5503){_0x1e5503=_0x1e5503||0xc8;return function(_0x574f8b){if(_0x574f8b){return _0x309a59['status'](_0x1e5503)[_0x7ca2('0x1b')](_0x574f8b);}};}function respondWithFilteredResult(_0x736de2,_0x218822){return function(_0x31540c){if(_0x31540c){var _0x480a51=typeof _0x218822[_0x7ca2('0x1c')]===_0x7ca2('0x1d')&&typeof _0x218822[_0x7ca2('0x1e')]===_0x7ca2('0x1d');var _0xa8c7bb=_0x31540c[_0x7ca2('0x1f')];var _0x3c6d2b=_0x480a51?0x0:_0x218822[_0x7ca2('0x1c')];var _0x394005=_0x480a51?_0x31540c[_0x7ca2('0x1f')]:_0x218822[_0x7ca2('0x1c')]+_0x218822['limit'];var _0xa28a8e;if(_0x394005>=_0xa8c7bb){_0x394005=_0xa8c7bb;_0xa28a8e=0xc8;}else{_0xa28a8e=0xce;}_0x736de2['status'](_0xa28a8e);return _0x736de2[_0x7ca2('0x20')](_0x7ca2('0x21'),_0x3c6d2b+'-'+_0x394005+'/'+_0xa8c7bb)['json'](_0x31540c);}return null;};}function patchUpdates(_0x558629){return function(_0x394b47){try{jsonpatch[_0x7ca2('0x22')](_0x394b47,_0x558629,!![]);}catch(_0x33c295){return BPromise['reject'](_0x33c295);}return _0x394b47['save']();};}function saveUpdates(_0x39af1f,_0x515c0d){return function(_0x1a1402){if(_0x1a1402){return _0x1a1402[_0x7ca2('0x23')](_0x39af1f)['then'](function(_0x2a9978){return _0x2a9978;});}return null;};}function removeEntity(_0x5bd6af,_0x478344){return function(_0x4662c3){if(_0x4662c3){return _0x4662c3[_0x7ca2('0x24')]()[_0x7ca2('0x25')](function(){_0x5bd6af[_0x7ca2('0x19')](0xcc)[_0x7ca2('0x1a')]();});}};}function handleEntityNotFound(_0xf35a37,_0xfcfa2){return function(_0x1672ab){if(!_0x1672ab){_0xf35a37[_0x7ca2('0x18')](0x194);}return _0x1672ab;};}function handleError(_0x17b048,_0x559581){_0x559581=_0x559581||0x1f4;return function(_0x5170c2){logger['error'](_0x5170c2[_0x7ca2('0x26')]);if(_0x5170c2[_0x7ca2('0x27')]){delete _0x5170c2[_0x7ca2('0x27')];}_0x17b048[_0x7ca2('0x19')](_0x559581)[_0x7ca2('0x28')](_0x5170c2);};}exports[_0x7ca2('0x29')]=function(_0xd47dd0,_0x5c0ad9){var _0x1f020d={},_0x10f392={},_0x3375b1={'count':0x0,'rows':[]};var _0x17d63b=_[_0x7ca2('0x2a')](db[_0x7ca2('0x2b')][_0x7ca2('0x2c')],function(_0x229498){return{'name':_0x229498[_0x7ca2('0x2d')],'type':_0x229498[_0x7ca2('0x2e')]['key']};});_0x10f392[_0x7ca2('0x2f')]=_[_0x7ca2('0x2a')](_0x17d63b,_0x7ca2('0x27'));_0x10f392[_0x7ca2('0x30')]=_[_0x7ca2('0x31')](_0xd47dd0[_0x7ca2('0x30')]);_0x10f392['filters']=_['intersection'](_0x10f392[_0x7ca2('0x2f')],_0x10f392[_0x7ca2('0x30')]);_0x1f020d[_0x7ca2('0x32')]=_[_0x7ca2('0x33')](_0x10f392['model'],qs[_0x7ca2('0x34')](_0xd47dd0['query'][_0x7ca2('0x34')]));_0x1f020d[_0x7ca2('0x32')]=_0x1f020d['attributes'][_0x7ca2('0x35')]?_0x1f020d[_0x7ca2('0x32')]:_0x10f392[_0x7ca2('0x2f')];if(!_0xd47dd0[_0x7ca2('0x30')][_0x7ca2('0x36')](_0x7ca2('0x37'))){_0x1f020d['limit']=qs[_0x7ca2('0x1e')](_0xd47dd0[_0x7ca2('0x30')][_0x7ca2('0x1e')]);_0x1f020d['offset']=qs['offset'](_0xd47dd0['query'][_0x7ca2('0x1c')]);}_0x1f020d[_0x7ca2('0x38')]=qs[_0x7ca2('0x39')](_0xd47dd0[_0x7ca2('0x30')][_0x7ca2('0x39')]);_0x1f020d[_0x7ca2('0x3a')]=qs[_0x7ca2('0x3b')](_[_0x7ca2('0x3c')](_0xd47dd0[_0x7ca2('0x30')],_0x10f392['filters']),_0x17d63b);if(_0xd47dd0[_0x7ca2('0x30')][_0x7ca2('0x3d')]){_0x1f020d[_0x7ca2('0x3a')]=_[_0x7ca2('0x3e')](_0x1f020d['where'],{'$or':_[_0x7ca2('0x2a')](_0x17d63b,function(_0x55ecb0){if(_0x55ecb0[_0x7ca2('0x2e')]!=='VIRTUAL'){var _0x1d4286={};_0x1d4286[_0x55ecb0[_0x7ca2('0x27')]]={'$like':'%'+_0xd47dd0[_0x7ca2('0x30')][_0x7ca2('0x3d')]+'%'};return _0x1d4286;}})});}_0x1f020d=_[_0x7ca2('0x3e')]({},_0x1f020d,_0xd47dd0[_0x7ca2('0x3f')]);var _0x36b5aa={'where':_0x1f020d[_0x7ca2('0x3a')]};return db[_0x7ca2('0x2b')][_0x7ca2('0x1f')](_0x36b5aa)[_0x7ca2('0x25')](function(_0x42ec0a){_0x3375b1[_0x7ca2('0x1f')]=_0x42ec0a;if(_0xd47dd0['query'][_0x7ca2('0x40')]){_0x1f020d[_0x7ca2('0x41')]=[{'all':!![]}];}return db[_0x7ca2('0x2b')][_0x7ca2('0x42')](_0x1f020d);})[_0x7ca2('0x25')](function(_0x5154f4){_0x3375b1[_0x7ca2('0x43')]=_0x5154f4;return _0x3375b1;})['then'](respondWithFilteredResult(_0x5c0ad9,_0x1f020d))[_0x7ca2('0x44')](handleError(_0x5c0ad9,null));};exports[_0x7ca2('0x45')]=function(_0x5b1bcf,_0x6fa7a7){var _0x6c95b7={'raw':![],'where':{'id':_0x5b1bcf[_0x7ca2('0x46')]['id']}},_0x38581b={};_0x38581b['model']=_[_0x7ca2('0x31')](db[_0x7ca2('0x2b')]['rawAttributes']);_0x38581b[_0x7ca2('0x30')]=_[_0x7ca2('0x31')](_0x5b1bcf['query']);_0x38581b[_0x7ca2('0x3b')]=_['intersection'](_0x38581b[_0x7ca2('0x2f')],_0x38581b[_0x7ca2('0x30')]);_0x6c95b7[_0x7ca2('0x32')]=_[_0x7ca2('0x33')](_0x38581b['model'],qs['fields'](_0x5b1bcf[_0x7ca2('0x30')][_0x7ca2('0x34')]));_0x6c95b7[_0x7ca2('0x32')]=_0x6c95b7['attributes'][_0x7ca2('0x35')]?_0x6c95b7['attributes']:_0x38581b[_0x7ca2('0x2f')];if(_0x5b1bcf[_0x7ca2('0x30')][_0x7ca2('0x40')]){_0x6c95b7[_0x7ca2('0x41')]=[{'all':!![]}];}_0x6c95b7=_[_0x7ca2('0x3e')]({},_0x6c95b7,_0x5b1bcf[_0x7ca2('0x3f')]);return db[_0x7ca2('0x2b')][_0x7ca2('0x47')](_0x6c95b7)[_0x7ca2('0x25')](handleEntityNotFound(_0x6fa7a7,null))[_0x7ca2('0x25')](respondWithResult(_0x6fa7a7,null))['catch'](handleError(_0x6fa7a7,null));};exports[_0x7ca2('0x48')]=function(_0x5c476b,_0x18a2e9){return db[_0x7ca2('0x2b')][_0x7ca2('0x48')](_0x5c476b[_0x7ca2('0x49')],{})['then'](respondWithResult(_0x18a2e9,0xc9))[_0x7ca2('0x44')](handleError(_0x18a2e9,null));};exports[_0x7ca2('0x23')]=function(_0x5d7bd9,_0x1d14c9){if(_0x5d7bd9[_0x7ca2('0x49')]['id']){delete _0x5d7bd9[_0x7ca2('0x49')]['id'];}return db['Dynamics365Configuration'][_0x7ca2('0x47')]({'where':{'id':_0x5d7bd9[_0x7ca2('0x46')]['id']}})[_0x7ca2('0x25')](handleEntityNotFound(_0x1d14c9,null))[_0x7ca2('0x25')](saveUpdates(_0x5d7bd9[_0x7ca2('0x49')],null))['then'](respondWithResult(_0x1d14c9,null))[_0x7ca2('0x44')](handleError(_0x1d14c9,null));};exports[_0x7ca2('0x24')]=function(_0xc0e267,_0x33be44){return db[_0x7ca2('0x2b')][_0x7ca2('0x47')]({'where':{'id':_0xc0e267[_0x7ca2('0x46')]['id']}})[_0x7ca2('0x25')](handleEntityNotFound(_0x33be44,null))[_0x7ca2('0x25')](removeEntity(_0x33be44,null))[_0x7ca2('0x44')](handleError(_0x33be44,null));};exports[_0x7ca2('0x4a')]=function(_0x5ba819,_0x346d42,_0x5bab4f){var _0x1515ba={};var _0x5daeb8={};var _0xca407d;var _0x45ac39;return db[_0x7ca2('0x2b')][_0x7ca2('0x4b')]({'where':{'id':_0x5ba819[_0x7ca2('0x46')]['id']}})[_0x7ca2('0x25')](handleEntityNotFound(_0x346d42,null))[_0x7ca2('0x25')](function(_0x5e3cf2){if(_0x5e3cf2){_0xca407d=_0x5e3cf2;_0x5daeb8[_0x7ca2('0x2f')]=_[_0x7ca2('0x31')](db[_0x7ca2('0x4c')]['rawAttributes']);_0x5daeb8[_0x7ca2('0x30')]=_[_0x7ca2('0x31')](_0x5ba819['query']);_0x5daeb8[_0x7ca2('0x3b')]=_[_0x7ca2('0x33')](_0x5daeb8[_0x7ca2('0x2f')],_0x5daeb8['query']);_0x1515ba[_0x7ca2('0x32')]=_[_0x7ca2('0x33')](_0x5daeb8['model'],qs['fields'](_0x5ba819['query']['fields']));_0x1515ba[_0x7ca2('0x32')]=_0x1515ba[_0x7ca2('0x32')][_0x7ca2('0x35')]?_0x1515ba[_0x7ca2('0x32')]:_0x5daeb8[_0x7ca2('0x2f')];_0x1515ba[_0x7ca2('0x38')]=qs['sort'](_0x5ba819['query'][_0x7ca2('0x39')]);_0x1515ba[_0x7ca2('0x3a')]=qs[_0x7ca2('0x3b')](_[_0x7ca2('0x3c')](_0x5ba819['query'],_0x5daeb8[_0x7ca2('0x3b')]));if(_0x5ba819[_0x7ca2('0x30')][_0x7ca2('0x3d')]){_0x1515ba[_0x7ca2('0x3a')]=_[_0x7ca2('0x3e')](_0x1515ba['where'],{'$or':_['map'](_0x1515ba[_0x7ca2('0x32')],function(_0x498542){var _0x48f386={};_0x48f386[_0x498542]={'$like':'%'+_0x5ba819[_0x7ca2('0x30')][_0x7ca2('0x3d')]+'%'};return _0x48f386;})});}_0x1515ba=_[_0x7ca2('0x3e')]({},_0x1515ba,_0x5ba819[_0x7ca2('0x3f')]);return _0xca407d[_0x7ca2('0x4a')](_0x1515ba);}})[_0x7ca2('0x25')](function(_0x19b7a7){if(_0x19b7a7){_0x45ac39=_0x19b7a7[_0x7ca2('0x35')];if(!_0x5ba819[_0x7ca2('0x30')][_0x7ca2('0x36')](_0x7ca2('0x37'))){_0x1515ba['limit']=qs[_0x7ca2('0x1e')](_0x5ba819[_0x7ca2('0x30')]['limit']);_0x1515ba[_0x7ca2('0x1c')]=qs[_0x7ca2('0x1c')](_0x5ba819[_0x7ca2('0x30')][_0x7ca2('0x1c')]);}return _0xca407d[_0x7ca2('0x4a')](_0x1515ba);}})[_0x7ca2('0x25')](function(_0x1fa2a2){if(_0x1fa2a2){return _0x1fa2a2?{'count':_0x45ac39,'rows':_0x1fa2a2}:null;}})[_0x7ca2('0x25')](respondWithResult(_0x346d42,null))[_0x7ca2('0x44')](handleError(_0x346d42,null));};exports[_0x7ca2('0x4d')]=function(_0xd13b69,_0x16a897,_0x3b72a6){var _0x241177={};var _0xe1cff5={};var _0x1453dc;var _0x43ad2b;return db[_0x7ca2('0x2b')][_0x7ca2('0x4b')]({'where':{'id':_0xd13b69[_0x7ca2('0x46')]['id']}})[_0x7ca2('0x25')](handleEntityNotFound(_0x16a897,null))[_0x7ca2('0x25')](function(_0x25e261){if(_0x25e261){_0x1453dc=_0x25e261;_0xe1cff5[_0x7ca2('0x2f')]=_['keys'](db[_0x7ca2('0x4c')][_0x7ca2('0x2c')]);_0xe1cff5[_0x7ca2('0x30')]=_[_0x7ca2('0x31')](_0xd13b69[_0x7ca2('0x30')]);_0xe1cff5[_0x7ca2('0x3b')]=_['intersection'](_0xe1cff5[_0x7ca2('0x2f')],_0xe1cff5['query']);_0x241177[_0x7ca2('0x32')]=_[_0x7ca2('0x33')](_0xe1cff5[_0x7ca2('0x2f')],qs[_0x7ca2('0x34')](_0xd13b69['query'][_0x7ca2('0x34')]));_0x241177[_0x7ca2('0x32')]=_0x241177['attributes'][_0x7ca2('0x35')]?_0x241177[_0x7ca2('0x32')]:_0xe1cff5['model'];_0x241177[_0x7ca2('0x38')]=qs[_0x7ca2('0x39')](_0xd13b69[_0x7ca2('0x30')]['sort']);_0x241177[_0x7ca2('0x3a')]=qs[_0x7ca2('0x3b')](_[_0x7ca2('0x3c')](_0xd13b69[_0x7ca2('0x30')],_0xe1cff5[_0x7ca2('0x3b')]));if(_0xd13b69['query'][_0x7ca2('0x3d')]){_0x241177[_0x7ca2('0x3a')]=_[_0x7ca2('0x3e')](_0x241177[_0x7ca2('0x3a')],{'$or':_[_0x7ca2('0x2a')](_0x241177['attributes'],function(_0x5ae3ad){var _0x7d110f={};_0x7d110f[_0x5ae3ad]={'$like':'%'+_0xd13b69['query'][_0x7ca2('0x3d')]+'%'};return _0x7d110f;})});}_0x241177=_[_0x7ca2('0x3e')]({},_0x241177,_0xd13b69['options']);return _0x1453dc[_0x7ca2('0x4d')](_0x241177);}})['then'](function(_0x4ff7d1){if(_0x4ff7d1){_0x43ad2b=_0x4ff7d1[_0x7ca2('0x35')];if(!_0xd13b69[_0x7ca2('0x30')][_0x7ca2('0x36')](_0x7ca2('0x37'))){_0x241177['limit']=qs[_0x7ca2('0x1e')](_0xd13b69[_0x7ca2('0x30')]['limit']);_0x241177[_0x7ca2('0x1c')]=qs[_0x7ca2('0x1c')](_0xd13b69[_0x7ca2('0x30')][_0x7ca2('0x1c')]);}return _0x1453dc['getSubjects'](_0x241177);}})[_0x7ca2('0x25')](function(_0x50703e){if(_0x50703e){return _0x50703e?{'count':_0x43ad2b,'rows':_0x50703e}:null;}})[_0x7ca2('0x25')](respondWithResult(_0x16a897,null))['catch'](handleError(_0x16a897,null));};exports[_0x7ca2('0x4e')]=function(_0x4ea5b8,_0x1dc9f2,_0x35f535){var _0x434401={};var _0x21fe26={};var _0x24413e;var _0x992731;return db[_0x7ca2('0x2b')]['findOne']({'where':{'id':_0x4ea5b8[_0x7ca2('0x46')]['id']}})[_0x7ca2('0x25')](handleEntityNotFound(_0x1dc9f2,null))[_0x7ca2('0x25')](function(_0x2cf978){if(_0x2cf978){_0x24413e=_0x2cf978;_0x21fe26[_0x7ca2('0x2f')]=_['keys'](db[_0x7ca2('0x4c')][_0x7ca2('0x2c')]);_0x21fe26['query']=_[_0x7ca2('0x31')](_0x4ea5b8[_0x7ca2('0x30')]);_0x21fe26['filters']=_[_0x7ca2('0x33')](_0x21fe26['model'],_0x21fe26['query']);_0x434401[_0x7ca2('0x32')]=_[_0x7ca2('0x33')](_0x21fe26[_0x7ca2('0x2f')],qs['fields'](_0x4ea5b8[_0x7ca2('0x30')][_0x7ca2('0x34')]));_0x434401[_0x7ca2('0x32')]=_0x434401[_0x7ca2('0x32')][_0x7ca2('0x35')]?_0x434401[_0x7ca2('0x32')]:_0x21fe26[_0x7ca2('0x2f')];_0x434401['order']=qs['sort'](_0x4ea5b8[_0x7ca2('0x30')]['sort']);_0x434401['where']=qs['filters'](_[_0x7ca2('0x3c')](_0x4ea5b8[_0x7ca2('0x30')],_0x21fe26[_0x7ca2('0x3b')]));if(_0x4ea5b8[_0x7ca2('0x30')][_0x7ca2('0x3d')]){_0x434401[_0x7ca2('0x3a')]=_[_0x7ca2('0x3e')](_0x434401[_0x7ca2('0x3a')],{'$or':_['map'](_0x434401[_0x7ca2('0x32')],function(_0x3b335f){var _0x47878b={};_0x47878b[_0x3b335f]={'$like':'%'+_0x4ea5b8['query']['filter']+'%'};return _0x47878b;})});}_0x434401=_[_0x7ca2('0x3e')]({},_0x434401,_0x4ea5b8[_0x7ca2('0x3f')]);return _0x24413e[_0x7ca2('0x4e')](_0x434401);}})['then'](function(_0x8184d8){if(_0x8184d8){_0x992731=_0x8184d8[_0x7ca2('0x35')];if(!_0x4ea5b8[_0x7ca2('0x30')][_0x7ca2('0x36')](_0x7ca2('0x37'))){_0x434401[_0x7ca2('0x1e')]=qs[_0x7ca2('0x1e')](_0x4ea5b8['query'][_0x7ca2('0x1e')]);_0x434401[_0x7ca2('0x1c')]=qs[_0x7ca2('0x1c')](_0x4ea5b8[_0x7ca2('0x30')][_0x7ca2('0x1c')]);}return _0x24413e[_0x7ca2('0x4e')](_0x434401);}})[_0x7ca2('0x25')](function(_0x3fafb0){if(_0x3fafb0){return _0x3fafb0?{'count':_0x992731,'rows':_0x3fafb0}:null;}})[_0x7ca2('0x25')](respondWithResult(_0x1dc9f2,null))[_0x7ca2('0x44')](handleError(_0x1dc9f2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 2046fbd..0dd1514 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 _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x50a06a,_0x1f18a9){var _0x4f200d=function(_0x24d9de){while(--_0x24d9de){_0x50a06a['push'](_0x50a06a['shift']());}};_0x4f200d(++_0x1f18a9);}(_0x00bb,0x1d8));var _0xb00b=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x00bb[_0x6c993a];return _0x27f547;};'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 +var _0x70e0=['int_dynamics365_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x495ee7,_0x1f8218){var _0x27e06d=function(_0x4218eb){while(--_0x4218eb){_0x495ee7['push'](_0x495ee7['shift']());}};_0x27e06d(++_0x1f8218);}(_0x70e0,0x17b));var _0x070e=function(_0x530ccd,_0x295b98){_0x530ccd=_0x530ccd-0x0;var _0x4480bc=_0x70e0[_0x530ccd];return _0x4480bc;};'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']('Dynamics365Configuration',attributes,{'tableName':_0x070e('0x8'),'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 107d7d7..ed28801 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 _0x0985=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x44e982,_0xa57fe5){var _0x5660d0=function(_0x4770a2){while(--_0x4770a2){_0x44e982['push'](_0x44e982['shift']());}};_0x5660d0(++_0xa57fe5);}(_0x0985,0xf4));var _0x5098=function(_0x537684,_0x52e31b){_0x537684=_0x537684-0x0;var _0x4eff9b=_0x0985[_0x537684];return _0x4eff9b;};'use strict';var _=require(_0x5098('0x0'));var util=require(_0x5098('0x1'));var moment=require('moment');var BPromise=require(_0x5098('0x2'));var rs=require(_0x5098('0x3'));var fs=require('fs');var Redis=require(_0x5098('0x4'));var db=require(_0x5098('0x5'))['db'];var utils=require(_0x5098('0x6'));var logger=require(_0x5098('0x7'))(_0x5098('0x8'));var config=require(_0x5098('0x9'));var jayson=require(_0x5098('0xa'));var client=jayson[_0x5098('0xb')][_0x5098('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46fe3c,_0x5e2d36,_0x3351f0){return new BPromise(function(_0x37ffa9,_0x349334){return client[_0x5098('0xd')](_0x46fe3c,_0x3351f0)[_0x5098('0xe')](function(_0xc66561){logger['info'](_0x5098('0xf'),_0x5e2d36,_0x5098('0x10'));logger[_0x5098('0x11')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5e2d36,_0x5098('0x10'),JSON[_0x5098('0x12')](_0xc66561));if(_0xc66561[_0x5098('0x13')]){if(_0xc66561['error'][_0x5098('0x14')]===0x1f4){logger[_0x5098('0x13')](_0x5098('0xf'),_0x5e2d36,_0xc66561[_0x5098('0x13')][_0x5098('0x15')]);return _0x349334(_0xc66561[_0x5098('0x13')]['message']);}logger[_0x5098('0x13')](_0x5098('0xf'),_0x5e2d36,_0xc66561[_0x5098('0x13')][_0x5098('0x15')]);return _0x37ffa9(_0xc66561[_0x5098('0x13')][_0x5098('0x15')]);}else{logger['info'](_0x5098('0xf'),_0x5e2d36,'request\x20sent');_0x37ffa9(_0xc66561[_0x5098('0x16')][_0x5098('0x15')]);}})[_0x5098('0x17')](function(_0x245ae5){logger[_0x5098('0x13')](_0x5098('0xf'),_0x5e2d36,_0x245ae5);_0x349334(_0x245ae5);});});} \ No newline at end of file +var _0xe3e0=['../../config/logger','rpc','jayson/promise','client','http','then','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x54d572,_0x703801){var _0x5414d8=function(_0x561de5){while(--_0x561de5){_0x54d572['push'](_0x54d572['shift']());}};_0x5414d8(++_0x703801);}(_0xe3e0,0x15e));var _0x0e3e=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0xe3e0[_0x556927];return _0x5f1235;};'use strict';var _=require(_0x0e3e('0x0'));var util=require(_0x0e3e('0x1'));var moment=require(_0x0e3e('0x2'));var BPromise=require(_0x0e3e('0x3'));var rs=require(_0x0e3e('0x4'));var fs=require('fs');var Redis=require(_0x0e3e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e3e('0x6'));var logger=require(_0x0e3e('0x7'))(_0x0e3e('0x8'));var config=require('../../config/environment');var jayson=require(_0x0e3e('0x9'));var client=jayson[_0x0e3e('0xa')][_0x0e3e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ac592,_0x242b7f,_0x2171f5){return new BPromise(function(_0x2d2b91,_0x34c419){return client['request'](_0x3ac592,_0x2171f5)[_0x0e3e('0xc')](function(_0x2cc91d){logger['info'](_0x0e3e('0xd'),_0x242b7f,'request\x20sent');logger['debug'](_0x0e3e('0xe'),_0x242b7f,_0x0e3e('0xf'),JSON[_0x0e3e('0x10')](_0x2cc91d));if(_0x2cc91d['error']){if(_0x2cc91d[_0x0e3e('0x11')][_0x0e3e('0x12')]===0x1f4){logger['error'](_0x0e3e('0xd'),_0x242b7f,_0x2cc91d[_0x0e3e('0x11')][_0x0e3e('0x13')]);return _0x34c419(_0x2cc91d['error'][_0x0e3e('0x13')]);}logger[_0x0e3e('0x11')](_0x0e3e('0xd'),_0x242b7f,_0x2cc91d[_0x0e3e('0x11')][_0x0e3e('0x13')]);return _0x2d2b91(_0x2cc91d[_0x0e3e('0x11')][_0x0e3e('0x13')]);}else{logger['info'](_0x0e3e('0xd'),_0x242b7f,_0x0e3e('0xf'));_0x2d2b91(_0x2cc91d[_0x0e3e('0x14')]['message']);}})['catch'](function(_0x1b6cfd){logger[_0x0e3e('0x11')](_0x0e3e('0xd'),_0x242b7f,_0x1b6cfd);_0x34c419(_0x1b6cfd);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index bcfc815..24a30b9 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 _0x9ed5=['get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x3ce36e,_0x56e47d){var _0xbc4e50=function(_0x763c9e){while(--_0x763c9e){_0x3ce36e['push'](_0x3ce36e['shift']());}};_0xbc4e50(++_0x56e47d);}(_0x9ed5,0x160));var _0x59ed=function(_0x4b8156,_0x437af2){_0x4b8156=_0x4b8156-0x0;var _0x4a819c=_0x9ed5[_0x4b8156];return _0x4a819c;};'use strict';var multer=require('multer');var util=require(_0x59ed('0x0'));var path=require(_0x59ed('0x1'));var timeout=require(_0x59ed('0x2'));var express=require(_0x59ed('0x3'));var router=express[_0x59ed('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x59ed('0x5'));var interaction=require(_0x59ed('0x6'));var config=require(_0x59ed('0x7'));var controller=require(_0x59ed('0x8'));router[_0x59ed('0x9')]('/',auth[_0x59ed('0xa')](),controller[_0x59ed('0xb')]);router[_0x59ed('0x9')](_0x59ed('0xc'),auth[_0x59ed('0xa')](),controller[_0x59ed('0xd')]);router['post']('/',auth[_0x59ed('0xa')](),controller[_0x59ed('0xe')]);router['put'](_0x59ed('0xc'),auth[_0x59ed('0xa')](),controller[_0x59ed('0xf')]);router[_0x59ed('0x10')](_0x59ed('0xc'),auth[_0x59ed('0xa')](),controller[_0x59ed('0x11')]);module[_0x59ed('0x12')]=router; \ No newline at end of file +var _0xb2a2=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2a2,0x178));var _0x2b2a=function(_0x1c6c1c,_0x17b7c8){_0x1c6c1c=_0x1c6c1c-0x0;var _0x4292ba=_0xb2a2[_0x1c6c1c];return _0x4292ba;};'use strict';var multer=require('multer');var util=require(_0x2b2a('0x0'));var path=require(_0x2b2a('0x1'));var timeout=require(_0x2b2a('0x2'));var express=require(_0x2b2a('0x3'));var router=express[_0x2b2a('0x4')]();var fs_extra=require(_0x2b2a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2b2a('0x6'));var config=require(_0x2b2a('0x7'));var controller=require(_0x2b2a('0x8'));router[_0x2b2a('0x9')]('/',auth[_0x2b2a('0xa')](),controller[_0x2b2a('0xb')]);router[_0x2b2a('0x9')](_0x2b2a('0xc'),auth[_0x2b2a('0xa')](),controller[_0x2b2a('0xd')]);router[_0x2b2a('0xe')]('/',auth[_0x2b2a('0xa')](),controller[_0x2b2a('0xf')]);router['put'](_0x2b2a('0xc'),auth[_0x2b2a('0xa')](),controller[_0x2b2a('0x10')]);router['delete']('/:id',auth[_0x2b2a('0xa')](),controller[_0x2b2a('0x11')]);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 c6b78f3..d6f0660 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 _0x7b91=['ENUM','string','keyValue','STRING','variable','customVariable','BOOLEAN','exports'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x7b91,0x7f));var _0x17b9=function(_0x372979,_0x5c4cd9){_0x372979=_0x372979-0x0;var _0x518d3c=_0x7b91[_0x372979];return _0x518d3c;};'use strict';var Sequelize=require('sequelize');module[_0x17b9('0x0')]={'type':{'type':Sequelize[_0x17b9('0x1')](_0x17b9('0x2'),'variable','customVariable',_0x17b9('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x17b9('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x17b9('0x1')]('string',_0x17b9('0x5'),_0x17b9('0x6'))},'keyContent':{'type':Sequelize[_0x17b9('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x17b9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x17b9('0x4')]}}; \ No newline at end of file +var _0x2e7b=['keyValue','picklist','STRING','variable','customVariable','sequelize','exports','ENUM','string'];(function(_0x20b309,_0x3bb8e3){var _0x3562e1=function(_0x4b6954){while(--_0x4b6954){_0x20b309['push'](_0x20b309['shift']());}};_0x3562e1(++_0x3bb8e3);}(_0x2e7b,0x11c));var _0xb2e7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2e7b[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xb2e7('0x0'));module[_0xb2e7('0x1')]={'type':{'type':Sequelize[_0xb2e7('0x2')](_0xb2e7('0x3'),'variable','customVariable',_0xb2e7('0x4'),_0xb2e7('0x5')),'defaultValue':_0xb2e7('0x3')},'content':{'type':Sequelize[_0xb2e7('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb2e7('0x2')](_0xb2e7('0x3'),_0xb2e7('0x7'),_0xb2e7('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb2e7('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index dd6f354..6419bbc 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 _0x2ce2=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','save','update','then','end','error','stack','name','send','map','Dynamics365Field','rawAttributes','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x10a5a7,_0x241ba8){var _0x402f69=function(_0x29e8c4){while(--_0x29e8c4){_0x10a5a7['push'](_0x10a5a7['shift']());}};_0x402f69(++_0x241ba8);}(_0x2ce2,0x1f1));var _0x22ce=function(_0xe14ee9,_0x4cd8e1){_0xe14ee9=_0xe14ee9-0x0;var _0x1dda60=_0x2ce2[_0xe14ee9];return _0x1dda60;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22ce('0x0'));var zipdir=require(_0x22ce('0x1'));var jsonpatch=require(_0x22ce('0x2'));var rp=require('request-promise');var moment=require(_0x22ce('0x3'));var BPromise=require(_0x22ce('0x4'));var Mustache=require(_0x22ce('0x5'));var util=require(_0x22ce('0x6'));var path=require(_0x22ce('0x7'));var sox=require(_0x22ce('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x22ce('0x9'));var jsforce=require(_0x22ce('0xa'));var deskjs=require(_0x22ce('0xb'));var toCsv=require(_0x22ce('0xc'));var querystring=require(_0x22ce('0xd'));var Papa=require(_0x22ce('0xe'));var Redis=require('ioredis');var authService=require(_0x22ce('0xf'));var qs=require(_0x22ce('0x10'));var as=require(_0x22ce('0x11'));var hardwareService=require(_0x22ce('0x12'));var logger=require(_0x22ce('0x13'))(_0x22ce('0x14'));var utils=require(_0x22ce('0x15'));var config=require(_0x22ce('0x16'));var licenseUtil=require(_0x22ce('0x17'));var db=require(_0x22ce('0x18'))['db'];function respondWithStatusCode(_0x4756c3,_0x2a7dfd){_0x2a7dfd=_0x2a7dfd||0xcc;return function(_0x463305){if(_0x463305){return _0x4756c3[_0x22ce('0x19')](_0x2a7dfd);}return _0x4756c3[_0x22ce('0x1a')](_0x2a7dfd)['end']();};}function respondWithResult(_0x246c74,_0x3c0e37){_0x3c0e37=_0x3c0e37||0xc8;return function(_0x50ef3d){if(_0x50ef3d){return _0x246c74[_0x22ce('0x1a')](_0x3c0e37)['json'](_0x50ef3d);}};}function respondWithFilteredResult(_0x54518a,_0x29456e){return function(_0x72ed8b){if(_0x72ed8b){var _0x3bbfa1=typeof _0x29456e[_0x22ce('0x1b')]==='undefined'&&typeof _0x29456e[_0x22ce('0x1c')]===_0x22ce('0x1d');var _0x298773=_0x72ed8b[_0x22ce('0x1e')];var _0x450694=_0x3bbfa1?0x0:_0x29456e['offset'];var _0x2d2e59=_0x3bbfa1?_0x72ed8b['count']:_0x29456e[_0x22ce('0x1b')]+_0x29456e[_0x22ce('0x1c')];var _0xf729b6;if(_0x2d2e59>=_0x298773){_0x2d2e59=_0x298773;_0xf729b6=0xc8;}else{_0xf729b6=0xce;}_0x54518a[_0x22ce('0x1a')](_0xf729b6);return _0x54518a[_0x22ce('0x1f')](_0x22ce('0x20'),_0x450694+'-'+_0x2d2e59+'/'+_0x298773)[_0x22ce('0x21')](_0x72ed8b);}return null;};}function patchUpdates(_0x41baf8){return function(_0x59b769){try{jsonpatch['apply'](_0x59b769,_0x41baf8,!![]);}catch(_0x3f21ca){return BPromise['reject'](_0x3f21ca);}return _0x59b769[_0x22ce('0x22')]();};}function saveUpdates(_0x38de69,_0x536ce0){return function(_0x1fb013){if(_0x1fb013){return _0x1fb013[_0x22ce('0x23')](_0x38de69)[_0x22ce('0x24')](function(_0x176fd7){return _0x176fd7;});}return null;};}function removeEntity(_0x4acf22,_0x5e4083){return function(_0x2642c8){if(_0x2642c8){return _0x2642c8['destroy']()[_0x22ce('0x24')](function(){_0x4acf22['status'](0xcc)[_0x22ce('0x25')]();});}};}function handleEntityNotFound(_0xc49c0c,_0x4ef018){return function(_0x375f8f){if(!_0x375f8f){_0xc49c0c[_0x22ce('0x19')](0x194);}return _0x375f8f;};}function handleError(_0x424fe9,_0x2cbde1){_0x2cbde1=_0x2cbde1||0x1f4;return function(_0x52fed8){logger[_0x22ce('0x26')](_0x52fed8[_0x22ce('0x27')]);if(_0x52fed8['name']){delete _0x52fed8[_0x22ce('0x28')];}_0x424fe9[_0x22ce('0x1a')](_0x2cbde1)[_0x22ce('0x29')](_0x52fed8);};}exports['index']=function(_0x5d1383,_0x2979b1){var _0x56b145={},_0x3bc220={},_0x19847c={'count':0x0,'rows':[]};var _0x3d4578=_[_0x22ce('0x2a')](db[_0x22ce('0x2b')][_0x22ce('0x2c')],function(_0x5feb3c){return{'name':_0x5feb3c['fieldName'],'type':_0x5feb3c['type']['key']};});_0x3bc220[_0x22ce('0x2d')]=_[_0x22ce('0x2a')](_0x3d4578,_0x22ce('0x28'));_0x3bc220['query']=_[_0x22ce('0x2e')](_0x5d1383['query']);_0x3bc220[_0x22ce('0x2f')]=_[_0x22ce('0x30')](_0x3bc220['model'],_0x3bc220[_0x22ce('0x31')]);_0x56b145[_0x22ce('0x32')]=_['intersection'](_0x3bc220[_0x22ce('0x2d')],qs['fields'](_0x5d1383[_0x22ce('0x31')][_0x22ce('0x33')]));_0x56b145[_0x22ce('0x32')]=_0x56b145['attributes'][_0x22ce('0x34')]?_0x56b145[_0x22ce('0x32')]:_0x3bc220[_0x22ce('0x2d')];if(!_0x5d1383['query'][_0x22ce('0x35')](_0x22ce('0x36'))){_0x56b145['limit']=qs[_0x22ce('0x1c')](_0x5d1383[_0x22ce('0x31')][_0x22ce('0x1c')]);_0x56b145[_0x22ce('0x1b')]=qs[_0x22ce('0x1b')](_0x5d1383[_0x22ce('0x31')][_0x22ce('0x1b')]);}_0x56b145[_0x22ce('0x37')]=qs[_0x22ce('0x38')](_0x5d1383[_0x22ce('0x31')][_0x22ce('0x38')]);_0x56b145[_0x22ce('0x39')]=qs['filters'](_[_0x22ce('0x3a')](_0x5d1383[_0x22ce('0x31')],_0x3bc220[_0x22ce('0x2f')]),_0x3d4578);if(_0x5d1383['query'][_0x22ce('0x3b')]){_0x56b145[_0x22ce('0x39')]=_[_0x22ce('0x3c')](_0x56b145[_0x22ce('0x39')],{'$or':_['map'](_0x3d4578,function(_0x5d7345){if(_0x5d7345[_0x22ce('0x3d')]!==_0x22ce('0x3e')){var _0xde43b6={};_0xde43b6[_0x5d7345[_0x22ce('0x28')]]={'$like':'%'+_0x5d1383[_0x22ce('0x31')][_0x22ce('0x3b')]+'%'};return _0xde43b6;}})});}_0x56b145=_['merge']({},_0x56b145,_0x5d1383[_0x22ce('0x3f')]);var _0x370b13={'where':_0x56b145[_0x22ce('0x39')]};return db['Dynamics365Field'][_0x22ce('0x1e')](_0x370b13)[_0x22ce('0x24')](function(_0x38cbce){_0x19847c['count']=_0x38cbce;if(_0x5d1383['query'][_0x22ce('0x40')]){_0x56b145[_0x22ce('0x41')]=[{'all':!![]}];}return db[_0x22ce('0x2b')][_0x22ce('0x42')](_0x56b145);})[_0x22ce('0x24')](function(_0x10f93f){_0x19847c[_0x22ce('0x43')]=_0x10f93f;return _0x19847c;})[_0x22ce('0x24')](respondWithFilteredResult(_0x2979b1,_0x56b145))['catch'](handleError(_0x2979b1,null));};exports[_0x22ce('0x44')]=function(_0x4a92b7,_0x3f781d){var _0x67f9e5={'raw':!![],'where':{'id':_0x4a92b7[_0x22ce('0x45')]['id']}},_0xf723d2={};_0xf723d2[_0x22ce('0x2d')]=_[_0x22ce('0x2e')](db[_0x22ce('0x2b')][_0x22ce('0x2c')]);_0xf723d2[_0x22ce('0x31')]=_[_0x22ce('0x2e')](_0x4a92b7[_0x22ce('0x31')]);_0xf723d2['filters']=_[_0x22ce('0x30')](_0xf723d2[_0x22ce('0x2d')],_0xf723d2[_0x22ce('0x31')]);_0x67f9e5[_0x22ce('0x32')]=_[_0x22ce('0x30')](_0xf723d2['model'],qs['fields'](_0x4a92b7[_0x22ce('0x31')][_0x22ce('0x33')]));_0x67f9e5[_0x22ce('0x32')]=_0x67f9e5[_0x22ce('0x32')][_0x22ce('0x34')]?_0x67f9e5[_0x22ce('0x32')]:_0xf723d2[_0x22ce('0x2d')];if(_0x4a92b7[_0x22ce('0x31')][_0x22ce('0x40')]){_0x67f9e5['include']=[{'all':!![]}];}_0x67f9e5=_['merge']({},_0x67f9e5,_0x4a92b7[_0x22ce('0x3f')]);return db[_0x22ce('0x2b')][_0x22ce('0x46')](_0x67f9e5)[_0x22ce('0x24')](handleEntityNotFound(_0x3f781d,null))[_0x22ce('0x24')](respondWithResult(_0x3f781d,null))[_0x22ce('0x47')](handleError(_0x3f781d,null));};exports[_0x22ce('0x48')]=function(_0x487124,_0x378f20){return db['Dynamics365Field'][_0x22ce('0x48')](_0x487124[_0x22ce('0x49')],{})['then'](respondWithResult(_0x378f20,0xc9))[_0x22ce('0x47')](handleError(_0x378f20,null));};exports[_0x22ce('0x23')]=function(_0x360102,_0x45c55b){if(_0x360102[_0x22ce('0x49')]['id']){delete _0x360102[_0x22ce('0x49')]['id'];}return db['Dynamics365Field'][_0x22ce('0x46')]({'where':{'id':_0x360102[_0x22ce('0x45')]['id']}})['then'](handleEntityNotFound(_0x45c55b,null))[_0x22ce('0x24')](saveUpdates(_0x360102[_0x22ce('0x49')],null))['then'](respondWithResult(_0x45c55b,null))[_0x22ce('0x47')](handleError(_0x45c55b,null));};exports['destroy']=function(_0x515768,_0xd34063){return db[_0x22ce('0x2b')]['find']({'where':{'id':_0x515768[_0x22ce('0x45')]['id']}})[_0x22ce('0x24')](handleEntityNotFound(_0xd34063,null))[_0x22ce('0x24')](removeEntity(_0xd34063,null))[_0x22ce('0x47')](handleError(_0xd34063,null));}; \ No newline at end of file +var _0x176b=['destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x176b,0x1dd));var _0xb176=function(_0x1e4e22,_0x567aad){_0x1e4e22=_0x1e4e22-0x0;var _0x5a26ea=_0x176b[_0x1e4e22];return _0x5a26ea;};'use strict';var emlformat=require(_0xb176('0x0'));var rimraf=require(_0xb176('0x1'));var zipdir=require(_0xb176('0x2'));var jsonpatch=require(_0xb176('0x3'));var rp=require(_0xb176('0x4'));var moment=require('moment');var BPromise=require(_0xb176('0x5'));var Mustache=require('mustache');var util=require(_0xb176('0x6'));var path=require('path');var sox=require(_0xb176('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb176('0x8'));var _=require(_0xb176('0x9'));var squel=require(_0xb176('0xa'));var crypto=require(_0xb176('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb176('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb176('0xd'));var Papa=require(_0xb176('0xe'));var Redis=require('ioredis');var authService=require(_0xb176('0xf'));var qs=require(_0xb176('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb176('0x11'));var logger=require('../../config/logger')(_0xb176('0x12'));var utils=require('../../config/utils');var config=require(_0xb176('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb176('0x14'))['db'];function respondWithStatusCode(_0x1de3ee,_0x382501){_0x382501=_0x382501||0xcc;return function(_0xde20f7){if(_0xde20f7){return _0x1de3ee['sendStatus'](_0x382501);}return _0x1de3ee[_0xb176('0x15')](_0x382501)['end']();};}function respondWithResult(_0x3557eb,_0x3a6771){_0x3a6771=_0x3a6771||0xc8;return function(_0x4a519b){if(_0x4a519b){return _0x3557eb[_0xb176('0x15')](_0x3a6771)[_0xb176('0x16')](_0x4a519b);}};}function respondWithFilteredResult(_0x247fe3,_0x37bd99){return function(_0x47d2a6){if(_0x47d2a6){var _0x3af73d=typeof _0x37bd99['offset']===_0xb176('0x17')&&typeof _0x37bd99['limit']===_0xb176('0x17');var _0x159076=_0x47d2a6[_0xb176('0x18')];var _0x208cb9=_0x3af73d?0x0:_0x37bd99['offset'];var _0x33cdf6=_0x3af73d?_0x47d2a6[_0xb176('0x18')]:_0x37bd99[_0xb176('0x19')]+_0x37bd99[_0xb176('0x1a')];var _0x972e45;if(_0x33cdf6>=_0x159076){_0x33cdf6=_0x159076;_0x972e45=0xc8;}else{_0x972e45=0xce;}_0x247fe3[_0xb176('0x15')](_0x972e45);return _0x247fe3[_0xb176('0x1b')](_0xb176('0x1c'),_0x208cb9+'-'+_0x33cdf6+'/'+_0x159076)[_0xb176('0x16')](_0x47d2a6);}return null;};}function patchUpdates(_0x57f481){return function(_0x59b349){try{jsonpatch[_0xb176('0x1d')](_0x59b349,_0x57f481,!![]);}catch(_0x32e2c8){return BPromise[_0xb176('0x1e')](_0x32e2c8);}return _0x59b349[_0xb176('0x1f')]();};}function saveUpdates(_0x47e5e8,_0x3800cc){return function(_0x5ead40){if(_0x5ead40){return _0x5ead40[_0xb176('0x20')](_0x47e5e8)[_0xb176('0x21')](function(_0x24fa2f){return _0x24fa2f;});}return null;};}function removeEntity(_0x70440,_0x5352c2){return function(_0xf78290){if(_0xf78290){return _0xf78290[_0xb176('0x22')]()[_0xb176('0x21')](function(){_0x70440['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d843e,_0x29e631){return function(_0xddfa46){if(!_0xddfa46){_0x5d843e[_0xb176('0x23')](0x194);}return _0xddfa46;};}function handleError(_0x1d1482,_0x5bf632){_0x5bf632=_0x5bf632||0x1f4;return function(_0x19e5c1){logger[_0xb176('0x24')](_0x19e5c1[_0xb176('0x25')]);if(_0x19e5c1[_0xb176('0x26')]){delete _0x19e5c1[_0xb176('0x26')];}_0x1d1482['status'](_0x5bf632)[_0xb176('0x27')](_0x19e5c1);};}exports[_0xb176('0x28')]=function(_0x2f6804,_0x1abd9c){var _0x241708={},_0xd01a5a={},_0x4661fc={'count':0x0,'rows':[]};var _0x42ebbf=_[_0xb176('0x29')](db[_0xb176('0x2a')][_0xb176('0x2b')],function(_0x262695){return{'name':_0x262695['fieldName'],'type':_0x262695[_0xb176('0x2c')]['key']};});_0xd01a5a[_0xb176('0x2d')]=_[_0xb176('0x29')](_0x42ebbf,_0xb176('0x26'));_0xd01a5a[_0xb176('0x2e')]=_[_0xb176('0x2f')](_0x2f6804['query']);_0xd01a5a[_0xb176('0x30')]=_[_0xb176('0x31')](_0xd01a5a[_0xb176('0x2d')],_0xd01a5a[_0xb176('0x2e')]);_0x241708[_0xb176('0x32')]=_[_0xb176('0x31')](_0xd01a5a['model'],qs['fields'](_0x2f6804['query'][_0xb176('0x33')]));_0x241708[_0xb176('0x32')]=_0x241708[_0xb176('0x32')]['length']?_0x241708['attributes']:_0xd01a5a[_0xb176('0x2d')];if(!_0x2f6804['query'][_0xb176('0x34')](_0xb176('0x35'))){_0x241708[_0xb176('0x1a')]=qs[_0xb176('0x1a')](_0x2f6804[_0xb176('0x2e')][_0xb176('0x1a')]);_0x241708['offset']=qs['offset'](_0x2f6804['query'][_0xb176('0x19')]);}_0x241708[_0xb176('0x36')]=qs['sort'](_0x2f6804[_0xb176('0x2e')][_0xb176('0x37')]);_0x241708[_0xb176('0x38')]=qs[_0xb176('0x30')](_[_0xb176('0x39')](_0x2f6804[_0xb176('0x2e')],_0xd01a5a[_0xb176('0x30')]),_0x42ebbf);if(_0x2f6804[_0xb176('0x2e')][_0xb176('0x3a')]){_0x241708[_0xb176('0x38')]=_[_0xb176('0x3b')](_0x241708[_0xb176('0x38')],{'$or':_[_0xb176('0x29')](_0x42ebbf,function(_0x4f3264){if(_0x4f3264[_0xb176('0x2c')]!==_0xb176('0x3c')){var _0x555d86={};_0x555d86[_0x4f3264['name']]={'$like':'%'+_0x2f6804[_0xb176('0x2e')][_0xb176('0x3a')]+'%'};return _0x555d86;}})});}_0x241708=_[_0xb176('0x3b')]({},_0x241708,_0x2f6804[_0xb176('0x3d')]);var _0x2e64d8={'where':_0x241708[_0xb176('0x38')]};return db[_0xb176('0x2a')][_0xb176('0x18')](_0x2e64d8)[_0xb176('0x21')](function(_0x151bfa){_0x4661fc[_0xb176('0x18')]=_0x151bfa;if(_0x2f6804[_0xb176('0x2e')]['includeAll']){_0x241708[_0xb176('0x3e')]=[{'all':!![]}];}return db[_0xb176('0x2a')][_0xb176('0x3f')](_0x241708);})[_0xb176('0x21')](function(_0x3e69f5){_0x4661fc[_0xb176('0x40')]=_0x3e69f5;return _0x4661fc;})['then'](respondWithFilteredResult(_0x1abd9c,_0x241708))[_0xb176('0x41')](handleError(_0x1abd9c,null));};exports[_0xb176('0x42')]=function(_0x578673,_0x36a3aa){var _0x212104={'raw':!![],'where':{'id':_0x578673[_0xb176('0x43')]['id']}},_0xb29adc={};_0xb29adc[_0xb176('0x2d')]=_['keys'](db[_0xb176('0x2a')][_0xb176('0x2b')]);_0xb29adc['query']=_[_0xb176('0x2f')](_0x578673['query']);_0xb29adc[_0xb176('0x30')]=_[_0xb176('0x31')](_0xb29adc[_0xb176('0x2d')],_0xb29adc[_0xb176('0x2e')]);_0x212104[_0xb176('0x32')]=_[_0xb176('0x31')](_0xb29adc[_0xb176('0x2d')],qs[_0xb176('0x33')](_0x578673['query']['fields']));_0x212104[_0xb176('0x32')]=_0x212104[_0xb176('0x32')][_0xb176('0x44')]?_0x212104[_0xb176('0x32')]:_0xb29adc[_0xb176('0x2d')];if(_0x578673[_0xb176('0x2e')][_0xb176('0x45')]){_0x212104[_0xb176('0x3e')]=[{'all':!![]}];}_0x212104=_[_0xb176('0x3b')]({},_0x212104,_0x578673[_0xb176('0x3d')]);return db['Dynamics365Field']['find'](_0x212104)[_0xb176('0x21')](handleEntityNotFound(_0x36a3aa,null))[_0xb176('0x21')](respondWithResult(_0x36a3aa,null))[_0xb176('0x41')](handleError(_0x36a3aa,null));};exports['create']=function(_0x203ef8,_0x14c661){return db[_0xb176('0x2a')][_0xb176('0x46')](_0x203ef8[_0xb176('0x47')],{})[_0xb176('0x21')](respondWithResult(_0x14c661,0xc9))[_0xb176('0x41')](handleError(_0x14c661,null));};exports['update']=function(_0x41286e,_0x316ec7){if(_0x41286e['body']['id']){delete _0x41286e['body']['id'];}return db[_0xb176('0x2a')]['find']({'where':{'id':_0x41286e[_0xb176('0x43')]['id']}})[_0xb176('0x21')](handleEntityNotFound(_0x316ec7,null))[_0xb176('0x21')](saveUpdates(_0x41286e[_0xb176('0x47')],null))[_0xb176('0x21')](respondWithResult(_0x316ec7,null))[_0xb176('0x41')](handleError(_0x316ec7,null));};exports[_0xb176('0x22')]=function(_0x64844a,_0x5e6792){return db[_0xb176('0x2a')][_0xb176('0x48')]({'where':{'id':_0x64844a['params']['id']}})[_0xb176('0x21')](handleEntityNotFound(_0x5e6792,null))[_0xb176('0x21')](removeEntity(_0x5e6792,null))[_0xb176('0x41')](handleError(_0x5e6792,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2f302c4..8d996f0 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 _0xfcc9=['../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x126c6c,_0x3d6fae){var _0x2945ad=function(_0x30c709){while(--_0x30c709){_0x126c6c['push'](_0x126c6c['shift']());}};_0x2945ad(++_0x3d6fae);}(_0xfcc9,0xe8));var _0x9fcc=function(_0x286595,_0x29f350){_0x286595=_0x286595-0x0;var _0x3ea6b8=_0xfcc9[_0x286595];return _0x3ea6b8;};'use strict';var _=require(_0x9fcc('0x0'));var util=require(_0x9fcc('0x1'));var logger=require(_0x9fcc('0x2'))(_0x9fcc('0x3'));var moment=require(_0x9fcc('0x4'));var BPromise=require('bluebird');var rp=require(_0x9fcc('0x5'));var fs=require('fs');var path=require(_0x9fcc('0x6'));var rimraf=require(_0x9fcc('0x7'));var config=require(_0x9fcc('0x8'));var attributes=require(_0x9fcc('0x9'));module[_0x9fcc('0xa')]=function(_0x185b75,_0x4c95df){return _0x185b75[_0x9fcc('0xb')](_0x9fcc('0xc'),attributes,{'tableName':_0x9fcc('0xd'),'paranoid':![],'indexes':[{'name':_0x9fcc('0xe'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x25a1=['bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','util','../../config/logger','moment'];(function(_0x1569fc,_0x115095){var _0x277783=function(_0x49e9c1){while(--_0x49e9c1){_0x1569fc['push'](_0x1569fc['shift']());}};_0x277783(++_0x115095);}(_0x25a1,0x1e7));var _0x125a=function(_0x22773c,_0x3dfea1){_0x22773c=_0x22773c-0x0;var _0x33d4b9=_0x25a1[_0x22773c];return _0x33d4b9;};'use strict';var _=require('lodash');var util=require(_0x125a('0x0'));var logger=require(_0x125a('0x1'))('api');var moment=require(_0x125a('0x2'));var BPromise=require(_0x125a('0x3'));var rp=require(_0x125a('0x4'));var fs=require('fs');var path=require(_0x125a('0x5'));var rimraf=require(_0x125a('0x6'));var config=require(_0x125a('0x7'));var attributes=require(_0x125a('0x8'));module[_0x125a('0x9')]=function(_0x245d60,_0x181607){return _0x245d60[_0x125a('0xa')](_0x125a('0xb'),attributes,{'tableName':_0x125a('0xc'),'paranoid':![],'indexes':[{'name':_0x125a('0xd'),'fields':['idField','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 6d2579a..73c647a 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 _0x7d13=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','../../mysqldb'];(function(_0x2c2622,_0x57f844){var _0x91774f=function(_0x4e89e7){while(--_0x4e89e7){_0x2c2622['push'](_0x2c2622['shift']());}};_0x91774f(++_0x57f844);}(_0x7d13,0x151));var _0x37d1=function(_0x544b3f,_0x4d8b66){_0x544b3f=_0x544b3f-0x0;var _0x15787f=_0x7d13[_0x544b3f];return _0x15787f;};'use strict';var _=require('lodash');var util=require(_0x37d1('0x0'));var moment=require(_0x37d1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x37d1('0x2'))['db'];var utils=require(_0x37d1('0x3'));var logger=require('../../config/logger')(_0x37d1('0x4'));var config=require(_0x37d1('0x5'));var jayson=require(_0x37d1('0x6'));var client=jayson[_0x37d1('0x7')][_0x37d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x389a86,_0x19223e,_0x310384){return new BPromise(function(_0x3b5630,_0x51eeb0){return client['request'](_0x389a86,_0x310384)[_0x37d1('0x9')](function(_0x5b5029){logger[_0x37d1('0xa')](_0x37d1('0xb'),_0x19223e,_0x37d1('0xc'));logger[_0x37d1('0xd')](_0x37d1('0xe'),_0x19223e,_0x37d1('0xc'),JSON['stringify'](_0x5b5029));if(_0x5b5029['error']){if(_0x5b5029[_0x37d1('0xf')][_0x37d1('0x10')]===0x1f4){logger[_0x37d1('0xf')](_0x37d1('0xb'),_0x19223e,_0x5b5029[_0x37d1('0xf')][_0x37d1('0x11')]);return _0x51eeb0(_0x5b5029['error'][_0x37d1('0x11')]);}logger[_0x37d1('0xf')](_0x37d1('0xb'),_0x19223e,_0x5b5029[_0x37d1('0xf')][_0x37d1('0x11')]);return _0x3b5630(_0x5b5029[_0x37d1('0xf')][_0x37d1('0x11')]);}else{logger['info'](_0x37d1('0xb'),_0x19223e,_0x37d1('0xc'));_0x3b5630(_0x5b5029[_0x37d1('0x12')]['message']);}})[_0x37d1('0x13')](function(_0x1c4b26){logger[_0x37d1('0xf')](_0x37d1('0xb'),_0x19223e,_0x1c4b26);_0x51eeb0(_0x1c4b26);});});} \ No newline at end of file +var _0x8d4a=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment'];(function(_0x3e6513,_0x2b98b9){var _0x2192f7=function(_0x9d7241){while(--_0x9d7241){_0x3e6513['push'](_0x3e6513['shift']());}};_0x2192f7(++_0x2b98b9);}(_0x8d4a,0x155));var _0xa8d4=function(_0x76c62e,_0x3207d8){_0x76c62e=_0x76c62e-0x0;var _0x14e73d=_0x8d4a[_0x76c62e];return _0x14e73d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa8d4('0x0'));var BPromise=require(_0xa8d4('0x1'));var rs=require(_0xa8d4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8d4('0x3'))['db'];var utils=require(_0xa8d4('0x4'));var logger=require(_0xa8d4('0x5'))(_0xa8d4('0x6'));var config=require(_0xa8d4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa8d4('0x8')][_0xa8d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb2a5,_0x12e3f8,_0x3e8755){return new BPromise(function(_0x30fd2a,_0xc05100){return client[_0xa8d4('0xa')](_0x5eb2a5,_0x3e8755)['then'](function(_0x37d052){logger['info'](_0xa8d4('0xb'),_0x12e3f8,_0xa8d4('0xc'));logger[_0xa8d4('0xd')](_0xa8d4('0xe'),_0x12e3f8,_0xa8d4('0xc'),JSON[_0xa8d4('0xf')](_0x37d052));if(_0x37d052['error']){if(_0x37d052[_0xa8d4('0x10')]['code']===0x1f4){logger[_0xa8d4('0x10')](_0xa8d4('0xb'),_0x12e3f8,_0x37d052['error'][_0xa8d4('0x11')]);return _0xc05100(_0x37d052[_0xa8d4('0x10')][_0xa8d4('0x11')]);}logger[_0xa8d4('0x10')](_0xa8d4('0xb'),_0x12e3f8,_0x37d052[_0xa8d4('0x10')]['message']);return _0x30fd2a(_0x37d052[_0xa8d4('0x10')][_0xa8d4('0x11')]);}else{logger['info'](_0xa8d4('0xb'),_0x12e3f8,'request\x20sent');_0x30fd2a(_0x37d052[_0xa8d4('0x12')]['message']);}})['catch'](function(_0x379312){logger[_0xa8d4('0x10')](_0xa8d4('0xb'),_0x12e3f8,_0x379312);_0xc05100(_0x379312);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index b8c4951..b7bfe00 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 _0xe62c=['/:id','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','index'];(function(_0x2cdae9,_0x7878bb){var _0x3d4346=function(_0x14bb1b){while(--_0x14bb1b){_0x2cdae9['push'](_0x2cdae9['shift']());}};_0x3d4346(++_0x7878bb);}(_0xe62c,0x1d9));var _0xce62=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xe62c[_0x4d8ed9];return _0x1e2140;};'use strict';var multer=require(_0xce62('0x0'));var util=require(_0xce62('0x1'));var path=require('path');var timeout=require(_0xce62('0x2'));var express=require(_0xce62('0x3'));var router=express[_0xce62('0x4')]();var fs_extra=require(_0xce62('0x5'));var auth=require(_0xce62('0x6'));var interaction=require(_0xce62('0x7'));var config=require('../../config/environment');var controller=require(_0xce62('0x8'));router[_0xce62('0x9')]('/',auth['isAuthenticated'](),controller[_0xce62('0xa')]);router[_0xce62('0x9')](_0xce62('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xce62('0x9')](_0xce62('0xc'),auth['isAuthenticated'](),controller[_0xce62('0xd')]);router[_0xce62('0x9')](_0xce62('0xe'),auth[_0xce62('0xf')](),controller[_0xce62('0x10')]);router['post']('/',auth[_0xce62('0xf')](),controller['create']);router[_0xce62('0x11')]('/:id/configurations',auth[_0xce62('0xf')](),controller[_0xce62('0x12')]);router['put'](_0xce62('0xb'),auth[_0xce62('0xf')](),controller[_0xce62('0x13')]);router['delete']('/:id',auth[_0xce62('0xf')](),controller[_0xce62('0x14')]);module[_0xce62('0x15')]=router; \ No newline at end of file +var _0x6f2d=['destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','index','isAuthenticated','show','get','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','/:id','delete'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6f2d,0x10a));var _0xd6f2=function(_0xf7ef0b,_0xd1fe92){_0xf7ef0b=_0xf7ef0b-0x0;var _0x4fbc22=_0x6f2d[_0xf7ef0b];return _0x4fbc22;};'use strict';var multer=require('multer');var util=require(_0xd6f2('0x0'));var path=require(_0xd6f2('0x1'));var timeout=require('connect-timeout');var express=require(_0xd6f2('0x2'));var router=express['Router']();var fs_extra=require(_0xd6f2('0x3'));var auth=require(_0xd6f2('0x4'));var interaction=require(_0xd6f2('0x5'));var config=require(_0xd6f2('0x6'));var controller=require(_0xd6f2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd6f2('0x8')]);router['get']('/:id',auth[_0xd6f2('0x9')](),controller[_0xd6f2('0xa')]);router[_0xd6f2('0xb')](_0xd6f2('0xc'),auth['isAuthenticated'](),controller[_0xd6f2('0xd')]);router[_0xd6f2('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0xd6f2('0xe')]);router[_0xd6f2('0xf')]('/',auth[_0xd6f2('0x9')](),controller[_0xd6f2('0x10')]);router[_0xd6f2('0xf')](_0xd6f2('0xc'),auth[_0xd6f2('0x9')](),controller[_0xd6f2('0x11')]);router['put'](_0xd6f2('0x12'),auth[_0xd6f2('0x9')](),controller['update']);router[_0xd6f2('0x13')](_0xd6f2('0x12'),auth[_0xd6f2('0x9')](),controller[_0xd6f2('0x14')]);module[_0xd6f2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 094df6a..b4dbfb9 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 _0xadb5=['remoteUri','exports','STRING','username'];(function(_0x33c603,_0x6d0ce4){var _0xae96f4=function(_0x2679f8){while(--_0x2679f8){_0x33c603['push'](_0x33c603['shift']());}};_0xae96f4(++_0x6d0ce4);}(_0xadb5,0xad));var _0x5adb=function(_0xd456c9,_0x11765f){_0xd456c9=_0xd456c9-0x0;var _0x598be7=_0xadb5[_0xd456c9];return _0x598be7;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5adb('0x1')]},'username':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x3')},'serverUrl':{'type':Sequelize[_0x5adb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x1eba=['exports','STRING','remoteUri','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1eba,0x1d7));var _0xa1eb=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x1eba[_0xd39959];return _0x1ff69c;};'use strict';var Sequelize=require(_0xa1eb('0x0'));module[_0xa1eb('0x1')]={'name':{'type':Sequelize[_0xa1eb('0x2')]},'description':{'type':Sequelize[_0xa1eb('0x2')]},'username':{'type':Sequelize[_0xa1eb('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa1eb('0x2')],'unique':_0xa1eb('0x3')},'serverUrl':{'type':Sequelize[_0xa1eb('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index ad85afe..4c82912 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 _0xa788=['fast-json-patch','moment','bluebird','util','path','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','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','pick','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','apiKey','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','stringify','send','test','statusCode','eml-format','rimraf','zip-dir'];(function(_0x4b80ba,_0x2e4a1b){var _0x13f737=function(_0x2c5a07){while(--_0x2c5a07){_0x4b80ba['push'](_0x4b80ba['shift']());}};_0x13f737(++_0x2e4a1b);}(_0xa788,0x70));var _0x8a78=function(_0x4bf6ad,_0x376edb){_0x4bf6ad=_0x4bf6ad-0x0;var _0x171021=_0xa788[_0x4bf6ad];return _0x171021;};'use strict';var emlformat=require(_0x8a78('0x0'));var rimraf=require(_0x8a78('0x1'));var zipdir=require(_0x8a78('0x2'));var jsonpatch=require(_0x8a78('0x3'));var rp=require('request-promise');var moment=require(_0x8a78('0x4'));var BPromise=require(_0x8a78('0x5'));var Mustache=require('mustache');var util=require(_0x8a78('0x6'));var path=require(_0x8a78('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a78('0x8'));var _=require(_0x8a78('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8a78('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8a78('0xb'));var Papa=require(_0x8a78('0xc'));var Redis=require('ioredis');var authService=require(_0x8a78('0xd'));var qs=require(_0x8a78('0xe'));var as=require(_0x8a78('0xf'));var hardwareService=require(_0x8a78('0x10'));var logger=require(_0x8a78('0x11'))(_0x8a78('0x12'));var utils=require(_0x8a78('0x13'));var config=require(_0x8a78('0x14'));var licenseUtil=require(_0x8a78('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8a78('0x16'));function respondWithStatusCode(_0x294b34,_0x31b77e){_0x31b77e=_0x31b77e||0xcc;return function(_0x4b4bc8){if(_0x4b4bc8){return _0x294b34[_0x8a78('0x17')](_0x31b77e);}return _0x294b34[_0x8a78('0x18')](_0x31b77e)[_0x8a78('0x19')]();};}function respondWithResult(_0x4b073b,_0x423787){_0x423787=_0x423787||0xc8;return function(_0x5bf8a4){if(_0x5bf8a4){return _0x4b073b[_0x8a78('0x18')](_0x423787)['json'](_0x5bf8a4);}};}function respondWithFilteredResult(_0x429b2c,_0x586d47){return function(_0x57212b){if(_0x57212b){var _0x580cf9=typeof _0x586d47[_0x8a78('0x1a')]===_0x8a78('0x1b')&&typeof _0x586d47[_0x8a78('0x1c')]===_0x8a78('0x1b');var _0x303aab=_0x57212b[_0x8a78('0x1d')];var _0x9ce954=_0x580cf9?0x0:_0x586d47[_0x8a78('0x1a')];var _0x20343b=_0x580cf9?_0x57212b[_0x8a78('0x1d')]:_0x586d47[_0x8a78('0x1a')]+_0x586d47[_0x8a78('0x1c')];var _0x23721b;if(_0x20343b>=_0x303aab){_0x20343b=_0x303aab;_0x23721b=0xc8;}else{_0x23721b=0xce;}_0x429b2c[_0x8a78('0x18')](_0x23721b);return _0x429b2c['set'](_0x8a78('0x1e'),_0x9ce954+'-'+_0x20343b+'/'+_0x303aab)['json'](_0x57212b);}return null;};}function patchUpdates(_0xa6f4b8){return function(_0x1dd032){try{jsonpatch['apply'](_0x1dd032,_0xa6f4b8,!![]);}catch(_0x1389e8){return BPromise[_0x8a78('0x1f')](_0x1389e8);}return _0x1dd032[_0x8a78('0x20')]();};}function saveUpdates(_0x43b3b8,_0x2d7d03){return function(_0x530446){if(_0x530446){return _0x530446[_0x8a78('0x21')](_0x43b3b8)['then'](function(_0x3532d1){return _0x3532d1;});}return null;};}function removeEntity(_0x43305f,_0x118357){return function(_0x381795){if(_0x381795){return _0x381795[_0x8a78('0x22')]()[_0x8a78('0x23')](function(){_0x43305f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21908e,_0x2737d0){return function(_0x30fbe9){if(!_0x30fbe9){_0x21908e['sendStatus'](0x194);}return _0x30fbe9;};}function handleError(_0x10e6b6,_0x43f182){_0x43f182=_0x43f182||0x1f4;return function(_0x3c51db){logger[_0x8a78('0x24')](_0x3c51db[_0x8a78('0x25')]);if(_0x3c51db[_0x8a78('0x26')]){delete _0x3c51db[_0x8a78('0x26')];}_0x10e6b6['status'](_0x43f182)['send'](_0x3c51db);};}exports[_0x8a78('0x27')]=function(_0x370927,_0x2c26d0){var _0x19c208={},_0x5138ad={},_0x1561d8={'count':0x0,'rows':[]};var _0x27c5d1=_['map'](db[_0x8a78('0x28')][_0x8a78('0x29')],function(_0x2fbc0e){return{'name':_0x2fbc0e[_0x8a78('0x2a')],'type':_0x2fbc0e[_0x8a78('0x2b')][_0x8a78('0x2c')]};});_0x5138ad[_0x8a78('0x2d')]=_[_0x8a78('0x2e')](_0x27c5d1,_0x8a78('0x26'));_0x5138ad[_0x8a78('0x2f')]=_[_0x8a78('0x30')](_0x370927['query']);_0x5138ad[_0x8a78('0x31')]=_[_0x8a78('0x32')](_0x5138ad['model'],_0x5138ad[_0x8a78('0x2f')]);_0x19c208['attributes']=_[_0x8a78('0x32')](_0x5138ad[_0x8a78('0x2d')],qs[_0x8a78('0x33')](_0x370927['query']['fields']));_0x19c208[_0x8a78('0x34')]=_0x19c208['attributes'][_0x8a78('0x35')]?_0x19c208[_0x8a78('0x34')]:_0x5138ad[_0x8a78('0x2d')];if(!_0x370927[_0x8a78('0x2f')][_0x8a78('0x36')]('nolimit')){_0x19c208[_0x8a78('0x1c')]=qs[_0x8a78('0x1c')](_0x370927[_0x8a78('0x2f')][_0x8a78('0x1c')]);_0x19c208[_0x8a78('0x1a')]=qs['offset'](_0x370927[_0x8a78('0x2f')][_0x8a78('0x1a')]);}_0x19c208[_0x8a78('0x37')]=qs['sort'](_0x370927[_0x8a78('0x2f')][_0x8a78('0x38')]);_0x19c208[_0x8a78('0x39')]=qs['filters'](_['pick'](_0x370927['query'],_0x5138ad['filters']),_0x27c5d1);if(_0x370927[_0x8a78('0x2f')][_0x8a78('0x3a')]){_0x19c208[_0x8a78('0x39')]=_[_0x8a78('0x3b')](_0x19c208[_0x8a78('0x39')],{'$or':_[_0x8a78('0x2e')](_0x27c5d1,function(_0x1d5423){if(_0x1d5423['type']!==_0x8a78('0x3c')){var _0x3655d3={};_0x3655d3[_0x1d5423['name']]={'$like':'%'+_0x370927[_0x8a78('0x2f')][_0x8a78('0x3a')]+'%'};return _0x3655d3;}})});}_0x19c208=_[_0x8a78('0x3b')]({},_0x19c208,_0x370927[_0x8a78('0x3d')]);var _0x321519={'where':_0x19c208[_0x8a78('0x39')]};return db[_0x8a78('0x28')][_0x8a78('0x1d')](_0x321519)[_0x8a78('0x23')](function(_0x329ba1){_0x1561d8[_0x8a78('0x1d')]=_0x329ba1;if(_0x370927[_0x8a78('0x2f')][_0x8a78('0x3e')]){_0x19c208[_0x8a78('0x3f')]=[{'all':!![]}];}return db[_0x8a78('0x28')][_0x8a78('0x40')](_0x19c208);})[_0x8a78('0x23')](function(_0x1d87dd){_0x1561d8[_0x8a78('0x41')]=_0x1d87dd;return _0x1561d8;})[_0x8a78('0x23')](respondWithFilteredResult(_0x2c26d0,_0x19c208))[_0x8a78('0x42')](handleError(_0x2c26d0,null));};exports['show']=function(_0x5b894c,_0x2ed20a){var _0x12bbf8={'raw':![],'where':{'id':_0x5b894c[_0x8a78('0x43')]['id']}},_0xb0eea6={};_0xb0eea6[_0x8a78('0x2d')]=_[_0x8a78('0x30')](db['FreshdeskAccount'][_0x8a78('0x29')]);_0xb0eea6[_0x8a78('0x2f')]=_[_0x8a78('0x30')](_0x5b894c[_0x8a78('0x2f')]);_0xb0eea6[_0x8a78('0x31')]=_[_0x8a78('0x32')](_0xb0eea6[_0x8a78('0x2d')],_0xb0eea6[_0x8a78('0x2f')]);_0x12bbf8[_0x8a78('0x34')]=_[_0x8a78('0x32')](_0xb0eea6[_0x8a78('0x2d')],qs[_0x8a78('0x33')](_0x5b894c[_0x8a78('0x2f')][_0x8a78('0x33')]));_0x12bbf8[_0x8a78('0x34')]=_0x12bbf8[_0x8a78('0x34')][_0x8a78('0x35')]?_0x12bbf8[_0x8a78('0x34')]:_0xb0eea6[_0x8a78('0x2d')];if(_0x5b894c[_0x8a78('0x2f')]['includeAll']){_0x12bbf8[_0x8a78('0x3f')]=[{'all':!![]}];}_0x12bbf8=_[_0x8a78('0x3b')]({},_0x12bbf8,_0x5b894c[_0x8a78('0x3d')]);return db['FreshdeskAccount'][_0x8a78('0x44')](_0x12bbf8)[_0x8a78('0x23')](handleEntityNotFound(_0x2ed20a,null))[_0x8a78('0x23')](respondWithResult(_0x2ed20a,null))[_0x8a78('0x42')](handleError(_0x2ed20a,null));};exports[_0x8a78('0x45')]=function(_0x32b165,_0x16d46f){return db['FreshdeskAccount'][_0x8a78('0x45')](_0x32b165['body'],{})[_0x8a78('0x23')](respondWithResult(_0x16d46f,0xc9))['catch'](handleError(_0x16d46f,null));};exports['update']=function(_0x568924,_0x2f1542){if(_0x568924[_0x8a78('0x46')]['id']){delete _0x568924[_0x8a78('0x46')]['id'];}return db[_0x8a78('0x28')][_0x8a78('0x44')]({'where':{'id':_0x568924[_0x8a78('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f1542,null))['then'](saveUpdates(_0x568924[_0x8a78('0x46')],null))['then'](respondWithResult(_0x2f1542,null))['catch'](handleError(_0x2f1542,null));};exports[_0x8a78('0x22')]=function(_0x1eba19,_0x424400){return db[_0x8a78('0x28')][_0x8a78('0x44')]({'where':{'id':_0x1eba19[_0x8a78('0x43')]['id']}})['then'](handleEntityNotFound(_0x424400,null))[_0x8a78('0x23')](removeEntity(_0x424400,null))[_0x8a78('0x42')](handleError(_0x424400,null));};exports[_0x8a78('0x47')]=function(_0x18b2a4,_0x445cc9,_0x25709b){var _0xca898d={};var _0x22b554={};var _0x35b5b4;var _0x49e5e4;return db[_0x8a78('0x28')][_0x8a78('0x48')]({'where':{'id':_0x18b2a4[_0x8a78('0x43')]['id']}})['then'](handleEntityNotFound(_0x445cc9,null))['then'](function(_0x2fb809){if(_0x2fb809){_0x35b5b4=_0x2fb809;_0x22b554['model']=_[_0x8a78('0x30')](db[_0x8a78('0x49')]['rawAttributes']);_0x22b554[_0x8a78('0x2f')]=_[_0x8a78('0x30')](_0x18b2a4['query']);_0x22b554[_0x8a78('0x31')]=_[_0x8a78('0x32')](_0x22b554[_0x8a78('0x2d')],_0x22b554[_0x8a78('0x2f')]);_0xca898d[_0x8a78('0x34')]=_[_0x8a78('0x32')](_0x22b554[_0x8a78('0x2d')],qs[_0x8a78('0x33')](_0x18b2a4[_0x8a78('0x2f')][_0x8a78('0x33')]));_0xca898d[_0x8a78('0x34')]=_0xca898d[_0x8a78('0x34')][_0x8a78('0x35')]?_0xca898d['attributes']:_0x22b554[_0x8a78('0x2d')];_0xca898d[_0x8a78('0x37')]=qs[_0x8a78('0x38')](_0x18b2a4[_0x8a78('0x2f')][_0x8a78('0x38')]);_0xca898d[_0x8a78('0x39')]=qs[_0x8a78('0x31')](_[_0x8a78('0x4a')](_0x18b2a4[_0x8a78('0x2f')],_0x22b554[_0x8a78('0x31')]));if(_0x18b2a4[_0x8a78('0x2f')][_0x8a78('0x3a')]){_0xca898d[_0x8a78('0x39')]=_[_0x8a78('0x3b')](_0xca898d[_0x8a78('0x39')],{'$or':_[_0x8a78('0x2e')](_0xca898d['attributes'],function(_0x402aed){var _0xe3b592={};_0xe3b592[_0x402aed]={'$like':'%'+_0x18b2a4['query'][_0x8a78('0x3a')]+'%'};return _0xe3b592;})});}_0xca898d=_[_0x8a78('0x3b')]({},_0xca898d,_0x18b2a4[_0x8a78('0x3d')]);return _0x35b5b4['getConfigurations'](_0xca898d);}})[_0x8a78('0x23')](function(_0x471b1d){if(_0x471b1d){_0x49e5e4=_0x471b1d[_0x8a78('0x35')];if(!_0x18b2a4[_0x8a78('0x2f')]['hasOwnProperty'](_0x8a78('0x4b'))){_0xca898d[_0x8a78('0x1c')]=qs[_0x8a78('0x1c')](_0x18b2a4[_0x8a78('0x2f')][_0x8a78('0x1c')]);_0xca898d[_0x8a78('0x1a')]=qs[_0x8a78('0x1a')](_0x18b2a4[_0x8a78('0x2f')]['offset']);}return _0x35b5b4[_0x8a78('0x47')](_0xca898d);}})[_0x8a78('0x23')](function(_0x524785){if(_0x524785){return _0x524785?{'count':_0x49e5e4,'rows':_0x524785}:null;}})['then'](respondWithResult(_0x445cc9,null))[_0x8a78('0x42')](handleError(_0x445cc9,null));};exports[_0x8a78('0x4c')]=function(_0xc9b8af,_0x30f0eb,_0x21129d){if(_0xc9b8af[_0x8a78('0x46')]['id']){delete _0xc9b8af[_0x8a78('0x46')]['id'];}return db[_0x8a78('0x28')][_0x8a78('0x48')]({'where':{'id':_0xc9b8af['params']['id']}})['then'](handleEntityNotFound(_0x30f0eb,null))['then'](function(_0x180e32){if(_0x180e32){_0xc9b8af[_0x8a78('0x46')]['AccountId']=_0x180e32['id'];_0xc9b8af[_0x8a78('0x46')][_0x8a78('0x4d')]=integrations[_0x8a78('0x4e')](_0xc9b8af[_0x8a78('0x46')]['channel'],_0xc9b8af[_0x8a78('0x46')]['type']);_0xc9b8af[_0x8a78('0x46')][_0x8a78('0x4f')]=integrations[_0x8a78('0x50')](_0xc9b8af['body'][_0x8a78('0x51')],_0xc9b8af[_0x8a78('0x46')][_0x8a78('0x2b')]);return db[_0x8a78('0x49')][_0x8a78('0x45')](_0xc9b8af[_0x8a78('0x46')],{'include':[{'model':db[_0x8a78('0x52')],'as':_0x8a78('0x4d')},{'model':db['FreshdeskField'],'as':_0x8a78('0x4f')}]});}return null;})[_0x8a78('0x23')](respondWithResult(_0x30f0eb,null))['catch'](handleError(_0x30f0eb,null));};exports[_0x8a78('0x53')]=function(_0x379db5,_0x3df0b4,_0x4850ac){var _0x11ce80='';return db['FreshdeskAccount'][_0x8a78('0x48')]({'where':{'id':_0x379db5[_0x8a78('0x43')]['id']},'attributes':['id','remoteUri','apiKey']})['then'](handleEntityNotFound(_0x3df0b4,null))[_0x8a78('0x23')](function(_0x5d5c29){if(_0x5d5c29){_0x11ce80=_0x5d5c29['remoteUri'];var _0x52c94c=_0x11ce80[_0x8a78('0x54')](-0x1);if(_0x52c94c==='/'){_0x11ce80=_0x11ce80[_0x8a78('0x55')](0x0,_0x11ce80[_0x8a78('0x56')](_0x52c94c));}return rp({'method':_0x8a78('0x57'),'uri':util[_0x8a78('0x58')](_0x8a78('0x59'),_0x11ce80,_0x8a78('0x5a')),'headers':{'Authorization':util[_0x8a78('0x58')](_0x8a78('0x5b'),new Buffer(util[_0x8a78('0x58')]('%s:X',_0x5d5c29[_0x8a78('0x5c')]))[_0x8a78('0x5d')](_0x8a78('0x5e')))},'json':!![]});}})[_0x8a78('0x23')](function(_0x20c2e8){if(_0x20c2e8){var _0x1b43cd=[_0x8a78('0x5f'),_0x8a78('0x60'),_0x8a78('0x61'),_0x8a78('0x62'),_0x8a78('0x18'),_0x8a78('0x63'),_0x8a78('0x64'),_0x8a78('0x65'),_0x8a78('0x66'),'group','company'];_[_0x8a78('0x67')](_0x20c2e8,function(_0x5a506d){return _0x1b43cd[_0x8a78('0x68')](_0x5a506d[_0x8a78('0x26')])||!_0x5a506d[_0x8a78('0x69')]&&_0x5a506d[_0x8a78('0x2b')]!==_0x8a78('0x6a')&&_0x5a506d[_0x8a78('0x2b')]!==_0x8a78('0x6b');});return{'count':_0x20c2e8[_0x8a78('0x35')],'rows':_[_0x8a78('0x2e')](_0x20c2e8,function(_0x4f46bb){return{'id':_0x4f46bb[_0x8a78('0x26')],'name':_0x4f46bb[_0x8a78('0x6c')],'custom':!_0x4f46bb[_0x8a78('0x69')],'options':_0x4f46bb[_0x8a78('0x6d')]?_['map'](_0x4f46bb[_0x8a78('0x6d')],function(_0x22a759){return{'name':_[_0x8a78('0x6e')](_0x22a759),'value':_0x22a759};}):[]};})};}})[_0x8a78('0x23')](respondWithResult(_0x3df0b4,null))[_0x8a78('0x42')](function(_0x1f85fb){var _0x1d059d=_0x379db5['query']['test']?0x1f4:_0x1f85fb['statusCode']||0x1f4;logger[_0x8a78('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x8a78('0x53'),_0x1d059d,JSON[_0x8a78('0x6f')](_0x1f85fb));delete _0x1f85fb[_0x8a78('0x26')];if(_0x1d059d===0x191){_0x1d059d=0x190;}_0x3df0b4['status'](_0x1d059d)[_0x8a78('0x70')](_0x379db5['query'][_0x8a78('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x1f85fb[_0x8a78('0x72')]}:_0x1f85fb);});}; \ No newline at end of file +var _0x76d2=['custom_text','custom_dropdown','label','choices','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','stack','send','index','map','FreshdeskAccount','rawAttributes','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','agent','description','priority','group','source','ticket_type','company','includes','default'];(function(_0x7fd596,_0x3a2875){var _0x595292=function(_0x43d125){while(--_0x43d125){_0x7fd596['push'](_0x7fd596['shift']());}};_0x595292(++_0x3a2875);}(_0x76d2,0xf8));var _0x276d=function(_0x30c252,_0x52c751){_0x30c252=_0x30c252-0x0;var _0x141fcc=_0x76d2[_0x30c252];return _0x141fcc;};'use strict';var emlformat=require(_0x276d('0x0'));var rimraf=require(_0x276d('0x1'));var zipdir=require(_0x276d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x276d('0x3'));var moment=require(_0x276d('0x4'));var BPromise=require(_0x276d('0x5'));var Mustache=require(_0x276d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x276d('0x7'));var csv=require(_0x276d('0x8'));var ejs=require(_0x276d('0x9'));var fs=require('fs');var fs_extra=require(_0x276d('0xa'));var _=require(_0x276d('0xb'));var squel=require(_0x276d('0xc'));var crypto=require(_0x276d('0xd'));var jsforce=require(_0x276d('0xe'));var deskjs=require(_0x276d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x276d('0x10'));var Redis=require(_0x276d('0x11'));var authService=require(_0x276d('0x12'));var qs=require(_0x276d('0x13'));var as=require(_0x276d('0x14'));var hardwareService=require(_0x276d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x276d('0x16'));var config=require(_0x276d('0x17'));var licenseUtil=require(_0x276d('0x18'));var db=require(_0x276d('0x19'))['db'];var integrations=require(_0x276d('0x1a'));function respondWithStatusCode(_0x2e4374,_0x4b9f5f){_0x4b9f5f=_0x4b9f5f||0xcc;return function(_0x52a319){if(_0x52a319){return _0x2e4374[_0x276d('0x1b')](_0x4b9f5f);}return _0x2e4374[_0x276d('0x1c')](_0x4b9f5f)[_0x276d('0x1d')]();};}function respondWithResult(_0x377540,_0x3166a2){_0x3166a2=_0x3166a2||0xc8;return function(_0x276c25){if(_0x276c25){return _0x377540[_0x276d('0x1c')](_0x3166a2)[_0x276d('0x1e')](_0x276c25);}};}function respondWithFilteredResult(_0x5b23b7,_0x2165c6){return function(_0x43efeb){if(_0x43efeb){var _0x50cdfd=typeof _0x2165c6['offset']===_0x276d('0x1f')&&typeof _0x2165c6[_0x276d('0x20')]==='undefined';var _0x1d8b5f=_0x43efeb['count'];var _0x501b7b=_0x50cdfd?0x0:_0x2165c6[_0x276d('0x21')];var _0x48a275=_0x50cdfd?_0x43efeb[_0x276d('0x22')]:_0x2165c6[_0x276d('0x21')]+_0x2165c6[_0x276d('0x20')];var _0x11d8d8;if(_0x48a275>=_0x1d8b5f){_0x48a275=_0x1d8b5f;_0x11d8d8=0xc8;}else{_0x11d8d8=0xce;}_0x5b23b7['status'](_0x11d8d8);return _0x5b23b7[_0x276d('0x23')](_0x276d('0x24'),_0x501b7b+'-'+_0x48a275+'/'+_0x1d8b5f)['json'](_0x43efeb);}return null;};}function patchUpdates(_0x5e8fee){return function(_0x45709d){try{jsonpatch[_0x276d('0x25')](_0x45709d,_0x5e8fee,!![]);}catch(_0x53e20e){return BPromise[_0x276d('0x26')](_0x53e20e);}return _0x45709d[_0x276d('0x27')]();};}function saveUpdates(_0x57d4b7,_0x284160){return function(_0x5c6d44){if(_0x5c6d44){return _0x5c6d44[_0x276d('0x28')](_0x57d4b7)[_0x276d('0x29')](function(_0x5f0561){return _0x5f0561;});}return null;};}function removeEntity(_0x476671,_0x3edb3b){return function(_0x58ea98){if(_0x58ea98){return _0x58ea98['destroy']()[_0x276d('0x29')](function(){_0x476671[_0x276d('0x1c')](0xcc)[_0x276d('0x1d')]();});}};}function handleEntityNotFound(_0x3dd10b,_0x2cab84){return function(_0x49a9f9){if(!_0x49a9f9){_0x3dd10b[_0x276d('0x1b')](0x194);}return _0x49a9f9;};}function handleError(_0x4b517f,_0xc8b1cc){_0xc8b1cc=_0xc8b1cc||0x1f4;return function(_0x1f85d9){logger['error'](_0x1f85d9[_0x276d('0x2a')]);if(_0x1f85d9['name']){delete _0x1f85d9['name'];}_0x4b517f['status'](_0xc8b1cc)[_0x276d('0x2b')](_0x1f85d9);};}exports[_0x276d('0x2c')]=function(_0xf2f7d,_0x43b79b){var _0x531a88={},_0x1438c6={},_0xa97fd5={'count':0x0,'rows':[]};var _0x40e801=_[_0x276d('0x2d')](db[_0x276d('0x2e')][_0x276d('0x2f')],function(_0x1102f7){return{'name':_0x1102f7['fieldName'],'type':_0x1102f7[_0x276d('0x30')][_0x276d('0x31')]};});_0x1438c6[_0x276d('0x32')]=_[_0x276d('0x2d')](_0x40e801,_0x276d('0x33'));_0x1438c6[_0x276d('0x34')]=_[_0x276d('0x35')](_0xf2f7d['query']);_0x1438c6[_0x276d('0x36')]=_[_0x276d('0x37')](_0x1438c6[_0x276d('0x32')],_0x1438c6[_0x276d('0x34')]);_0x531a88['attributes']=_[_0x276d('0x37')](_0x1438c6['model'],qs[_0x276d('0x38')](_0xf2f7d[_0x276d('0x34')][_0x276d('0x38')]));_0x531a88[_0x276d('0x39')]=_0x531a88[_0x276d('0x39')][_0x276d('0x3a')]?_0x531a88[_0x276d('0x39')]:_0x1438c6[_0x276d('0x32')];if(!_0xf2f7d['query']['hasOwnProperty'](_0x276d('0x3b'))){_0x531a88['limit']=qs[_0x276d('0x20')](_0xf2f7d[_0x276d('0x34')][_0x276d('0x20')]);_0x531a88[_0x276d('0x21')]=qs[_0x276d('0x21')](_0xf2f7d[_0x276d('0x34')][_0x276d('0x21')]);}_0x531a88['order']=qs['sort'](_0xf2f7d[_0x276d('0x34')][_0x276d('0x3c')]);_0x531a88['where']=qs['filters'](_[_0x276d('0x3d')](_0xf2f7d[_0x276d('0x34')],_0x1438c6['filters']),_0x40e801);if(_0xf2f7d[_0x276d('0x34')][_0x276d('0x3e')]){_0x531a88[_0x276d('0x3f')]=_[_0x276d('0x40')](_0x531a88[_0x276d('0x3f')],{'$or':_[_0x276d('0x2d')](_0x40e801,function(_0x5e5166){if(_0x5e5166[_0x276d('0x30')]!==_0x276d('0x41')){var _0x53d9a7={};_0x53d9a7[_0x5e5166['name']]={'$like':'%'+_0xf2f7d['query'][_0x276d('0x3e')]+'%'};return _0x53d9a7;}})});}_0x531a88=_[_0x276d('0x40')]({},_0x531a88,_0xf2f7d['options']);var _0x4ed666={'where':_0x531a88[_0x276d('0x3f')]};return db[_0x276d('0x2e')][_0x276d('0x22')](_0x4ed666)[_0x276d('0x29')](function(_0x3a0b1c){_0xa97fd5[_0x276d('0x22')]=_0x3a0b1c;if(_0xf2f7d[_0x276d('0x34')][_0x276d('0x42')]){_0x531a88[_0x276d('0x43')]=[{'all':!![]}];}return db[_0x276d('0x2e')][_0x276d('0x44')](_0x531a88);})[_0x276d('0x29')](function(_0x41a3a8){_0xa97fd5[_0x276d('0x45')]=_0x41a3a8;return _0xa97fd5;})['then'](respondWithFilteredResult(_0x43b79b,_0x531a88))[_0x276d('0x46')](handleError(_0x43b79b,null));};exports[_0x276d('0x47')]=function(_0x10ca70,_0x266373){var _0x8ef582={'raw':![],'where':{'id':_0x10ca70[_0x276d('0x48')]['id']}},_0x445eb1={};_0x445eb1[_0x276d('0x32')]=_[_0x276d('0x35')](db['FreshdeskAccount'][_0x276d('0x2f')]);_0x445eb1[_0x276d('0x34')]=_[_0x276d('0x35')](_0x10ca70[_0x276d('0x34')]);_0x445eb1['filters']=_[_0x276d('0x37')](_0x445eb1[_0x276d('0x32')],_0x445eb1[_0x276d('0x34')]);_0x8ef582[_0x276d('0x39')]=_[_0x276d('0x37')](_0x445eb1[_0x276d('0x32')],qs['fields'](_0x10ca70[_0x276d('0x34')]['fields']));_0x8ef582[_0x276d('0x39')]=_0x8ef582[_0x276d('0x39')]['length']?_0x8ef582[_0x276d('0x39')]:_0x445eb1[_0x276d('0x32')];if(_0x10ca70['query'][_0x276d('0x42')]){_0x8ef582[_0x276d('0x43')]=[{'all':!![]}];}_0x8ef582=_['merge']({},_0x8ef582,_0x10ca70[_0x276d('0x49')]);return db[_0x276d('0x2e')][_0x276d('0x4a')](_0x8ef582)[_0x276d('0x29')](handleEntityNotFound(_0x266373,null))[_0x276d('0x29')](respondWithResult(_0x266373,null))['catch'](handleError(_0x266373,null));};exports[_0x276d('0x4b')]=function(_0x259831,_0x397a2d){return db['FreshdeskAccount'][_0x276d('0x4b')](_0x259831[_0x276d('0x4c')],{})[_0x276d('0x29')](respondWithResult(_0x397a2d,0xc9))['catch'](handleError(_0x397a2d,null));};exports[_0x276d('0x28')]=function(_0x1642d7,_0x2ad1fe){if(_0x1642d7[_0x276d('0x4c')]['id']){delete _0x1642d7['body']['id'];}return db['FreshdeskAccount'][_0x276d('0x4a')]({'where':{'id':_0x1642d7[_0x276d('0x48')]['id']}})[_0x276d('0x29')](handleEntityNotFound(_0x2ad1fe,null))[_0x276d('0x29')](saveUpdates(_0x1642d7['body'],null))[_0x276d('0x29')](respondWithResult(_0x2ad1fe,null))['catch'](handleError(_0x2ad1fe,null));};exports['destroy']=function(_0x4e8ea3,_0x525c45){return db[_0x276d('0x2e')][_0x276d('0x4a')]({'where':{'id':_0x4e8ea3[_0x276d('0x48')]['id']}})['then'](handleEntityNotFound(_0x525c45,null))['then'](removeEntity(_0x525c45,null))['catch'](handleError(_0x525c45,null));};exports[_0x276d('0x4d')]=function(_0x3c279c,_0x27e5a7,_0x75136f){var _0x4d4c97={};var _0x5de49a={};var _0x4d16ae;var _0x21d079;return db[_0x276d('0x2e')][_0x276d('0x4e')]({'where':{'id':_0x3c279c[_0x276d('0x48')]['id']}})['then'](handleEntityNotFound(_0x27e5a7,null))[_0x276d('0x29')](function(_0x2be3ef){if(_0x2be3ef){_0x4d16ae=_0x2be3ef;_0x5de49a[_0x276d('0x32')]=_[_0x276d('0x35')](db[_0x276d('0x4f')][_0x276d('0x2f')]);_0x5de49a[_0x276d('0x34')]=_[_0x276d('0x35')](_0x3c279c['query']);_0x5de49a['filters']=_[_0x276d('0x37')](_0x5de49a['model'],_0x5de49a[_0x276d('0x34')]);_0x4d4c97[_0x276d('0x39')]=_[_0x276d('0x37')](_0x5de49a[_0x276d('0x32')],qs[_0x276d('0x38')](_0x3c279c['query'][_0x276d('0x38')]));_0x4d4c97[_0x276d('0x39')]=_0x4d4c97[_0x276d('0x39')][_0x276d('0x3a')]?_0x4d4c97[_0x276d('0x39')]:_0x5de49a['model'];_0x4d4c97[_0x276d('0x50')]=qs[_0x276d('0x3c')](_0x3c279c['query'][_0x276d('0x3c')]);_0x4d4c97[_0x276d('0x3f')]=qs['filters'](_[_0x276d('0x3d')](_0x3c279c[_0x276d('0x34')],_0x5de49a[_0x276d('0x36')]));if(_0x3c279c[_0x276d('0x34')][_0x276d('0x3e')]){_0x4d4c97[_0x276d('0x3f')]=_[_0x276d('0x40')](_0x4d4c97[_0x276d('0x3f')],{'$or':_[_0x276d('0x2d')](_0x4d4c97[_0x276d('0x39')],function(_0x38e2f1){var _0x44cbd0={};_0x44cbd0[_0x38e2f1]={'$like':'%'+_0x3c279c[_0x276d('0x34')]['filter']+'%'};return _0x44cbd0;})});}_0x4d4c97=_[_0x276d('0x40')]({},_0x4d4c97,_0x3c279c[_0x276d('0x49')]);return _0x4d16ae[_0x276d('0x4d')](_0x4d4c97);}})[_0x276d('0x29')](function(_0x4876f4){if(_0x4876f4){_0x21d079=_0x4876f4['length'];if(!_0x3c279c['query'][_0x276d('0x51')](_0x276d('0x3b'))){_0x4d4c97[_0x276d('0x20')]=qs[_0x276d('0x20')](_0x3c279c['query'][_0x276d('0x20')]);_0x4d4c97[_0x276d('0x21')]=qs[_0x276d('0x21')](_0x3c279c[_0x276d('0x34')][_0x276d('0x21')]);}return _0x4d16ae[_0x276d('0x4d')](_0x4d4c97);}})[_0x276d('0x29')](function(_0x357a8c){if(_0x357a8c){return _0x357a8c?{'count':_0x21d079,'rows':_0x357a8c}:null;}})[_0x276d('0x29')](respondWithResult(_0x27e5a7,null))[_0x276d('0x46')](handleError(_0x27e5a7,null));};exports[_0x276d('0x52')]=function(_0x4f847c,_0x39b4fa,_0x3c3408){if(_0x4f847c['body']['id']){delete _0x4f847c[_0x276d('0x4c')]['id'];}return db[_0x276d('0x2e')]['findOne']({'where':{'id':_0x4f847c[_0x276d('0x48')]['id']}})[_0x276d('0x29')](handleEntityNotFound(_0x39b4fa,null))[_0x276d('0x29')](function(_0x5db132){if(_0x5db132){_0x4f847c[_0x276d('0x4c')][_0x276d('0x53')]=_0x5db132['id'];_0x4f847c[_0x276d('0x4c')][_0x276d('0x54')]=integrations[_0x276d('0x55')](_0x4f847c[_0x276d('0x4c')][_0x276d('0x56')],_0x4f847c[_0x276d('0x4c')]['type']);_0x4f847c[_0x276d('0x4c')]['Descriptions']=integrations['getDescriptions'](_0x4f847c[_0x276d('0x4c')][_0x276d('0x56')],_0x4f847c[_0x276d('0x4c')][_0x276d('0x30')]);return db['FreshdeskConfiguration'][_0x276d('0x4b')](_0x4f847c[_0x276d('0x4c')],{'include':[{'model':db[_0x276d('0x57')],'as':_0x276d('0x54')},{'model':db[_0x276d('0x57')],'as':_0x276d('0x58')}]});}return null;})[_0x276d('0x29')](respondWithResult(_0x39b4fa,null))[_0x276d('0x46')](handleError(_0x39b4fa,null));};exports[_0x276d('0x59')]=function(_0x196257,_0x298867,_0x4c910d){var _0x2db556='';return db[_0x276d('0x2e')][_0x276d('0x4e')]({'where':{'id':_0x196257[_0x276d('0x48')]['id']},'attributes':['id',_0x276d('0x5a'),_0x276d('0x5b')]})[_0x276d('0x29')](handleEntityNotFound(_0x298867,null))[_0x276d('0x29')](function(_0x240d9d){if(_0x240d9d){_0x2db556=_0x240d9d['remoteUri'];var _0x18364b=_0x2db556[_0x276d('0x5c')](-0x1);if(_0x18364b==='/'){_0x2db556=_0x2db556[_0x276d('0x5d')](0x0,_0x2db556[_0x276d('0x5e')](_0x18364b));}return rp({'method':_0x276d('0x5f'),'uri':util[_0x276d('0x60')]('%s/%s',_0x2db556,_0x276d('0x61')),'headers':{'Authorization':util[_0x276d('0x60')](_0x276d('0x62'),new Buffer(util[_0x276d('0x60')](_0x276d('0x63'),_0x240d9d['apiKey']))[_0x276d('0x64')]('base64'))},'json':!![]});}})['then'](function(_0x2963bf){if(_0x2963bf){var _0xd66b05=[_0x276d('0x65'),_0x276d('0x66'),_0x276d('0x67'),_0x276d('0x68'),_0x276d('0x1c'),_0x276d('0x69'),_0x276d('0x6a'),_0x276d('0x6b'),_0x276d('0x6c'),_0x276d('0x6a'),_0x276d('0x6d')];_['remove'](_0x2963bf,function(_0x215098){return _0xd66b05[_0x276d('0x6e')](_0x215098[_0x276d('0x33')])||!_0x215098[_0x276d('0x6f')]&&_0x215098[_0x276d('0x30')]!==_0x276d('0x70')&&_0x215098[_0x276d('0x30')]!==_0x276d('0x71');});return{'count':_0x2963bf['length'],'rows':_['map'](_0x2963bf,function(_0x35538e){return{'id':_0x35538e[_0x276d('0x33')],'name':_0x35538e[_0x276d('0x72')],'custom':!_0x35538e[_0x276d('0x6f')],'options':_0x35538e[_0x276d('0x73')]?_['map'](_0x35538e['choices'],function(_0x11d3ec){return{'name':_['capitalize'](_0x11d3ec),'value':_0x11d3ec};}):[]};})};}})[_0x276d('0x29')](respondWithResult(_0x298867,null))[_0x276d('0x46')](function(_0x346ecd){var _0x5aa634=_0x196257[_0x276d('0x34')]['test']?0x1f4:_0x346ecd[_0x276d('0x74')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5aa634,JSON[_0x276d('0x75')](_0x346ecd));delete _0x346ecd[_0x276d('0x33')];if(_0x5aa634===0x191){_0x5aa634=0x190;}_0x298867[_0x276d('0x1c')](_0x5aa634)[_0x276d('0x2b')](_0x196257[_0x276d('0x34')][_0x276d('0x76')]?{'message':_0x276d('0x77'),'statusCode':_0x346ecd[_0x276d('0x74')]}:_0x346ecd);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 44fe616..1c638c5 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 _0x9a8a=['request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','moment','bluebird'];(function(_0x473acb,_0x588b6c){var _0x1415bf=function(_0x4c4e08){while(--_0x4c4e08){_0x473acb['push'](_0x473acb['shift']());}};_0x1415bf(++_0x588b6c);}(_0x9a8a,0x175));var _0xa9a8=function(_0x23b630,_0x41d994){_0x23b630=_0x23b630-0x0;var _0x3004d5=_0x9a8a[_0x23b630];return _0x3004d5;};'use strict';var _=require(_0xa9a8('0x0'));var util=require(_0xa9a8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa9a8('0x2'));var BPromise=require(_0xa9a8('0x3'));var rp=require(_0xa9a8('0x4'));var fs=require('fs');var path=require(_0xa9a8('0x5'));var rimraf=require('rimraf');var config=require(_0xa9a8('0x6'));var attributes=require(_0xa9a8('0x7'));var integrations=require(_0xa9a8('0x8'));module[_0xa9a8('0x9')]=function(_0x41d795,_0x4a5029){return _0x41d795[_0xa9a8('0xa')](_0xa9a8('0xb'),attributes,{'tableName':_0xa9a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b9a=['bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','lodash','../../config/logger','api','moment'];(function(_0x2d9226,_0x4534d3){var _0x439a04=function(_0x39f6ae){while(--_0x39f6ae){_0x2d9226['push'](_0x2d9226['shift']());}};_0x439a04(++_0x4534d3);}(_0x2b9a,0x158));var _0xa2b9=function(_0x5a03a8,_0x290757){_0x5a03a8=_0x5a03a8-0x0;var _0x117b38=_0x2b9a[_0x5a03a8];return _0x117b38;};'use strict';var _=require(_0xa2b9('0x0'));var util=require('util');var logger=require(_0xa2b9('0x1'))(_0xa2b9('0x2'));var moment=require(_0xa2b9('0x3'));var BPromise=require(_0xa2b9('0x4'));var rp=require(_0xa2b9('0x5'));var fs=require('fs');var path=require(_0xa2b9('0x6'));var rimraf=require(_0xa2b9('0x7'));var config=require('../../config/environment');var attributes=require(_0xa2b9('0x8'));var integrations=require(_0xa2b9('0x9'));module['exports']=function(_0x4a6810,_0x5d1480){return _0x4a6810[_0xa2b9('0xa')](_0xa2b9('0xb'),attributes,{'tableName':'int_freshdesk_accounts','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 1d98838..92bb372 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 _0x4e0d=['FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','info','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','limit','include','map','attributes','model','catch','ShowFreshdeskAccount','find','where','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x4f6464,_0x19ce0b){var _0x2970c0=function(_0x30b705){while(--_0x30b705){_0x4f6464['push'](_0x4f6464['shift']());}};_0x2970c0(++_0x19ce0b);}(_0x4e0d,0x9d));var _0xd4e0=function(_0x1bf61a,_0x234997){_0x1bf61a=_0x1bf61a-0x0;var _0x1fd5c6=_0x4e0d[_0x1bf61a];return _0x1fd5c6;};'use strict';var _=require('lodash');var util=require(_0xd4e0('0x0'));var moment=require(_0xd4e0('0x1'));var BPromise=require(_0xd4e0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd4e0('0x3'));var logger=require('../../config/logger')(_0xd4e0('0x4'));var config=require(_0xd4e0('0x5'));var jayson=require(_0xd4e0('0x6'));var client=jayson[_0xd4e0('0x7')][_0xd4e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x389120,_0x36a62d,_0x54a0ad){return new BPromise(function(_0x2b1c75,_0x12ead3){return client[_0xd4e0('0x9')](_0x389120,_0x54a0ad)[_0xd4e0('0xa')](function(_0x1147ff){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x36a62d,_0xd4e0('0xb'));logger[_0xd4e0('0xc')](_0xd4e0('0xd'),_0x36a62d,_0xd4e0('0xb'),JSON['stringify'](_0x1147ff));if(_0x1147ff['error']){if(_0x1147ff[_0xd4e0('0xe')][_0xd4e0('0xf')]===0x1f4){logger[_0xd4e0('0xe')](_0xd4e0('0x10'),_0x36a62d,_0x1147ff[_0xd4e0('0xe')]['message']);return _0x12ead3(_0x1147ff[_0xd4e0('0xe')][_0xd4e0('0x11')]);}logger[_0xd4e0('0xe')](_0xd4e0('0x10'),_0x36a62d,_0x1147ff[_0xd4e0('0xe')][_0xd4e0('0x11')]);return _0x2b1c75(_0x1147ff['error'][_0xd4e0('0x11')]);}else{logger[_0xd4e0('0x12')](_0xd4e0('0x10'),_0x36a62d,_0xd4e0('0xb'));_0x2b1c75(_0x1147ff[_0xd4e0('0x13')][_0xd4e0('0x11')]);}})['catch'](function(_0x4cc1be){logger[_0xd4e0('0xe')](_0xd4e0('0x10'),_0x36a62d,_0x4cc1be);_0x12ead3(_0x4cc1be);});});}exports[_0xd4e0('0x14')]=function(_0x18a32a){var _0x4c7d7d=this;return new Promise(function(_0x22ea3a,_0x1d79cf){return db[_0xd4e0('0x15')][_0xd4e0('0x16')]({'raw':_0x18a32a[_0xd4e0('0x17')]?_0x18a32a[_0xd4e0('0x17')][_0xd4e0('0x18')]===undefined?!![]:![]:!![],'where':_0x18a32a[_0xd4e0('0x17')]?_0x18a32a['options']['where']||null:null,'attributes':_0x18a32a[_0xd4e0('0x17')]?_0x18a32a[_0xd4e0('0x17')]['attributes']||null:null,'limit':_0x18a32a['options']?_0x18a32a[_0xd4e0('0x17')][_0xd4e0('0x19')]||null:null,'include':_0x18a32a[_0xd4e0('0x17')]?_0x18a32a[_0xd4e0('0x17')][_0xd4e0('0x1a')]?_[_0xd4e0('0x1b')](_0x18a32a[_0xd4e0('0x17')]['include'],function(_0x14aa7c){return{'model':db[_0x14aa7c['model']],'as':_0x14aa7c['as'],'attributes':_0x14aa7c[_0xd4e0('0x1c')],'include':_0x14aa7c[_0xd4e0('0x1a')]?_[_0xd4e0('0x1b')](_0x14aa7c[_0xd4e0('0x1a')],function(_0x334522){return{'model':db[_0x334522[_0xd4e0('0x1d')]],'as':_0x334522['as'],'attributes':_0x334522[_0xd4e0('0x1c')],'include':_0x334522[_0xd4e0('0x1a')]?_['map'](_0x334522[_0xd4e0('0x1a')],function(_0x5cd331){return{'model':db[_0x5cd331[_0xd4e0('0x1d')]],'as':_0x5cd331['as'],'attributes':_0x5cd331['attributes']};}):[]};}):[]};}):[]:[]})[_0xd4e0('0xa')](function(_0x20e2a1){logger['info']('GetFreshdeskAccount',_0x18a32a);logger[_0xd4e0('0xc')](_0xd4e0('0x14'),_0x18a32a,JSON['stringify'](_0x20e2a1));_0x22ea3a(_0x20e2a1);})[_0xd4e0('0x1e')](function(_0x22f677){logger['error'](_0xd4e0('0x14'),_0x22f677['message'],_0x18a32a);_0x1d79cf(_0x4c7d7d[_0xd4e0('0xe')](0x1f4,_0x22f677['message']));});});};exports[_0xd4e0('0x1f')]=function(_0x2ae109){var _0x1581d1=this;return new Promise(function(_0x1a1cb5,_0x466193){return db[_0xd4e0('0x15')][_0xd4e0('0x20')]({'raw':_0x2ae109['options']?_0x2ae109[_0xd4e0('0x17')][_0xd4e0('0x18')]===undefined?!![]:![]:!![],'where':_0x2ae109['options']?_0x2ae109[_0xd4e0('0x17')][_0xd4e0('0x21')]||null:null,'attributes':_0x2ae109['options']?_0x2ae109[_0xd4e0('0x17')][_0xd4e0('0x1c')]||null:null,'include':_0x2ae109['options']?_0x2ae109['options'][_0xd4e0('0x1a')]?_[_0xd4e0('0x1b')](_0x2ae109[_0xd4e0('0x17')][_0xd4e0('0x1a')],function(_0x79b77c){return{'model':db[_0x79b77c['model']],'as':_0x79b77c['as'],'attributes':_0x79b77c[_0xd4e0('0x1c')],'include':_0x79b77c[_0xd4e0('0x1a')]?_[_0xd4e0('0x1b')](_0x79b77c[_0xd4e0('0x1a')],function(_0x4f499a){return{'model':db[_0x4f499a[_0xd4e0('0x1d')]],'as':_0x4f499a['as'],'attributes':_0x4f499a[_0xd4e0('0x1c')],'include':_0x4f499a[_0xd4e0('0x1a')]?_[_0xd4e0('0x1b')](_0x4f499a[_0xd4e0('0x1a')],function(_0x602ed5){return{'model':db[_0x602ed5[_0xd4e0('0x1d')]],'as':_0x602ed5['as'],'attributes':_0x602ed5[_0xd4e0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd4e0('0xa')](function(_0x955bbc){logger[_0xd4e0('0x12')](_0xd4e0('0x1f'),_0x2ae109);logger[_0xd4e0('0xc')](_0xd4e0('0x1f'),_0x2ae109,JSON['stringify'](_0x955bbc));_0x1a1cb5(_0x955bbc);})[_0xd4e0('0x1e')](function(_0x156073){logger[_0xd4e0('0xe')](_0xd4e0('0x1f'),_0x156073[_0xd4e0('0x11')],_0x2ae109);_0x466193(_0x1581d1[_0xd4e0('0xe')](0x1f4,_0x156073[_0xd4e0('0x11')]));});});}; \ No newline at end of file +var _0x46d7=['info','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3486fb,_0x3327ed){var _0x247a66=function(_0x3abe61){while(--_0x3abe61){_0x3486fb['push'](_0x3486fb['shift']());}};_0x247a66(++_0x3327ed);}(_0x46d7,0x1b1));var _0x746d=function(_0xee5256,_0x65f7a){_0xee5256=_0xee5256-0x0;var _0x1d7978=_0x46d7[_0xee5256];return _0x1d7978;};'use strict';var _=require(_0x746d('0x0'));var util=require(_0x746d('0x1'));var moment=require(_0x746d('0x2'));var BPromise=require(_0x746d('0x3'));var rs=require(_0x746d('0x4'));var fs=require('fs');var Redis=require(_0x746d('0x5'));var db=require(_0x746d('0x6'))['db'];var utils=require(_0x746d('0x7'));var logger=require(_0x746d('0x8'))(_0x746d('0x9'));var config=require(_0x746d('0xa'));var jayson=require(_0x746d('0xb'));var client=jayson[_0x746d('0xc')][_0x746d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x42b282,_0x54c3d5,_0x2c46de){return new BPromise(function(_0x1b7262,_0x3cc37a){return client['request'](_0x42b282,_0x2c46de)[_0x746d('0xe')](function(_0x5e60f1){logger['info'](_0x746d('0xf'),_0x54c3d5,'request\x20sent');logger[_0x746d('0x10')](_0x746d('0x11'),_0x54c3d5,_0x746d('0x12'),JSON[_0x746d('0x13')](_0x5e60f1));if(_0x5e60f1[_0x746d('0x14')]){if(_0x5e60f1[_0x746d('0x14')][_0x746d('0x15')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x54c3d5,_0x5e60f1[_0x746d('0x14')][_0x746d('0x16')]);return _0x3cc37a(_0x5e60f1['error'][_0x746d('0x16')]);}logger[_0x746d('0x14')](_0x746d('0xf'),_0x54c3d5,_0x5e60f1[_0x746d('0x14')][_0x746d('0x16')]);return _0x1b7262(_0x5e60f1['error']['message']);}else{logger[_0x746d('0x17')](_0x746d('0xf'),_0x54c3d5,_0x746d('0x12'));_0x1b7262(_0x5e60f1[_0x746d('0x18')][_0x746d('0x16')]);}})[_0x746d('0x19')](function(_0x1f1329){logger[_0x746d('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x54c3d5,_0x1f1329);_0x3cc37a(_0x1f1329);});});}exports[_0x746d('0x1a')]=function(_0xf758f1){var _0x3a581b=this;return new Promise(function(_0x1907d7,_0x55085e){return db[_0x746d('0x1b')]['findAll']({'raw':_0xf758f1[_0x746d('0x1c')]?_0xf758f1[_0x746d('0x1c')][_0x746d('0x1d')]===undefined?!![]:![]:!![],'where':_0xf758f1[_0x746d('0x1c')]?_0xf758f1[_0x746d('0x1c')][_0x746d('0x1e')]||null:null,'attributes':_0xf758f1[_0x746d('0x1c')]?_0xf758f1['options'][_0x746d('0x1f')]||null:null,'limit':_0xf758f1[_0x746d('0x1c')]?_0xf758f1[_0x746d('0x1c')][_0x746d('0x20')]||null:null,'include':_0xf758f1[_0x746d('0x1c')]?_0xf758f1[_0x746d('0x1c')][_0x746d('0x21')]?_[_0x746d('0x22')](_0xf758f1[_0x746d('0x1c')]['include'],function(_0xe0e669){return{'model':db[_0xe0e669[_0x746d('0x23')]],'as':_0xe0e669['as'],'attributes':_0xe0e669['attributes'],'include':_0xe0e669['include']?_[_0x746d('0x22')](_0xe0e669['include'],function(_0xed2ddf){return{'model':db[_0xed2ddf[_0x746d('0x23')]],'as':_0xed2ddf['as'],'attributes':_0xed2ddf[_0x746d('0x1f')],'include':_0xed2ddf[_0x746d('0x21')]?_[_0x746d('0x22')](_0xed2ddf['include'],function(_0x368ee2){return{'model':db[_0x368ee2['model']],'as':_0x368ee2['as'],'attributes':_0x368ee2['attributes']};}):[]};}):[]};}):[]:[]})[_0x746d('0xe')](function(_0x4bd3dd){logger[_0x746d('0x17')]('GetFreshdeskAccount',_0xf758f1);logger['debug'](_0x746d('0x1a'),_0xf758f1,JSON[_0x746d('0x13')](_0x4bd3dd));_0x1907d7(_0x4bd3dd);})[_0x746d('0x19')](function(_0x312df9){logger[_0x746d('0x14')](_0x746d('0x1a'),_0x312df9[_0x746d('0x16')],_0xf758f1);_0x55085e(_0x3a581b[_0x746d('0x14')](0x1f4,_0x312df9[_0x746d('0x16')]));});});};exports[_0x746d('0x24')]=function(_0x9762b7){var _0x302914=this;return new Promise(function(_0x58f952,_0x7d0baa){return db[_0x746d('0x1b')][_0x746d('0x25')]({'raw':_0x9762b7[_0x746d('0x1c')]?_0x9762b7[_0x746d('0x1c')][_0x746d('0x1d')]===undefined?!![]:![]:!![],'where':_0x9762b7['options']?_0x9762b7[_0x746d('0x1c')][_0x746d('0x1e')]||null:null,'attributes':_0x9762b7['options']?_0x9762b7[_0x746d('0x1c')][_0x746d('0x1f')]||null:null,'include':_0x9762b7[_0x746d('0x1c')]?_0x9762b7[_0x746d('0x1c')][_0x746d('0x21')]?_['map'](_0x9762b7[_0x746d('0x1c')][_0x746d('0x21')],function(_0x46bd7e){return{'model':db[_0x46bd7e[_0x746d('0x23')]],'as':_0x46bd7e['as'],'attributes':_0x46bd7e[_0x746d('0x1f')],'include':_0x46bd7e[_0x746d('0x21')]?_['map'](_0x46bd7e['include'],function(_0x5f0849){return{'model':db[_0x5f0849[_0x746d('0x23')]],'as':_0x5f0849['as'],'attributes':_0x5f0849[_0x746d('0x1f')],'include':_0x5f0849[_0x746d('0x21')]?_[_0x746d('0x22')](_0x5f0849[_0x746d('0x21')],function(_0x5c8138){return{'model':db[_0x5c8138[_0x746d('0x23')]],'as':_0x5c8138['as'],'attributes':_0x5c8138[_0x746d('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dd4f1){logger['info'](_0x746d('0x24'),_0x9762b7);logger[_0x746d('0x10')]('ShowFreshdeskAccount',_0x9762b7,JSON[_0x746d('0x13')](_0x3dd4f1));_0x58f952(_0x3dd4f1);})['catch'](function(_0x1efc2a){logger['error'](_0x746d('0x24'),_0x1efc2a[_0x746d('0x16')],_0x9762b7);_0x7d0baa(_0x302914[_0x746d('0x14')](0x1f4,_0x1efc2a[_0x746d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 2573d71..30da5f7 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 _0x8004=['get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','show'];(function(_0x197595,_0x4d42ab){var _0x1d4440=function(_0x414659){while(--_0x414659){_0x197595['push'](_0x197595['shift']());}};_0x1d4440(++_0x4d42ab);}(_0x8004,0x80));var _0x4800=function(_0x210a38,_0xd57379){_0x210a38=_0x210a38-0x0;var _0x385e3e=_0x8004[_0x210a38];return _0x385e3e;};'use strict';var multer=require(_0x4800('0x0'));var util=require(_0x4800('0x1'));var path=require(_0x4800('0x2'));var timeout=require(_0x4800('0x3'));var express=require(_0x4800('0x4'));var router=express[_0x4800('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4800('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x4800('0x7')](),controller[_0x4800('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4800('0x9')]);router[_0x4800('0xa')](_0x4800('0xb'),auth[_0x4800('0x7')](),controller[_0x4800('0xc')]);router[_0x4800('0xa')](_0x4800('0xd'),auth[_0x4800('0x7')](),controller[_0x4800('0xe')]);router[_0x4800('0xa')](_0x4800('0xf'),auth['isAuthenticated'](),controller[_0x4800('0x10')]);router[_0x4800('0xa')]('/:id/tags',auth[_0x4800('0x7')](),controller['getTags']);router[_0x4800('0x11')]('/',auth[_0x4800('0x7')](),controller[_0x4800('0x12')]);router[_0x4800('0x11')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router['put']('/:id',auth[_0x4800('0x7')](),controller['update']);router[_0x4800('0x13')](_0x4800('0x14'),auth[_0x4800('0x7')](),controller[_0x4800('0x15')]);module[_0x4800('0x16')]=router; \ No newline at end of file +var _0x3ca9=['post','create','setTags','put','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags','getTags'];(function(_0x22bff1,_0x1d964a){var _0x279396=function(_0x2573c7){while(--_0x2573c7){_0x22bff1['push'](_0x22bff1['shift']());}};_0x279396(++_0x1d964a);}(_0x3ca9,0x164));var _0x93ca=function(_0x16ff70,_0x1aa3f9){_0x16ff70=_0x16ff70-0x0;var _0x2c398d=_0x3ca9[_0x16ff70];return _0x2c398d;};'use strict';var multer=require(_0x93ca('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x93ca('0x1'));var express=require(_0x93ca('0x2'));var router=express[_0x93ca('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x93ca('0x4'));var interaction=require(_0x93ca('0x5'));var config=require(_0x93ca('0x6'));var controller=require(_0x93ca('0x7'));router[_0x93ca('0x8')]('/',auth[_0x93ca('0x9')](),controller[_0x93ca('0xa')]);router[_0x93ca('0x8')](_0x93ca('0xb'),auth[_0x93ca('0x9')](),controller[_0x93ca('0xc')]);router['get'](_0x93ca('0xd'),auth[_0x93ca('0x9')](),controller[_0x93ca('0xe')]);router[_0x93ca('0x8')](_0x93ca('0xf'),auth[_0x93ca('0x9')](),controller['getSubjects']);router[_0x93ca('0x8')](_0x93ca('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x93ca('0x11'),auth[_0x93ca('0x9')](),controller[_0x93ca('0x12')]);router[_0x93ca('0x13')]('/',auth[_0x93ca('0x9')](),controller[_0x93ca('0x14')]);router[_0x93ca('0x13')](_0x93ca('0x11'),auth[_0x93ca('0x9')](),controller[_0x93ca('0x15')]);router[_0x93ca('0x16')](_0x93ca('0xb'),auth[_0x93ca('0x9')](),controller['update']);router[_0x93ca('0x17')]('/:id',auth[_0x93ca('0x9')](),controller['destroy']);module[_0x93ca('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 50fef90..8480bc3 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 _0x5320=['exports','STRING','sequelize'];(function(_0x5a0ca8,_0x345a08){var _0x5e1088=function(_0x149075){while(--_0x149075){_0x5a0ca8['push'](_0x5a0ca8['shift']());}};_0x5e1088(++_0x345a08);}(_0x5320,0xb0));var _0x0532=function(_0x30ade3,_0x533875){_0x30ade3=_0x30ade3-0x0;var _0x288829=_0x5320[_0x30ade3];return _0x288829;};'use strict';var Sequelize=require(_0x0532('0x0'));module[_0x0532('0x1')]={'name':{'type':Sequelize[_0x0532('0x2')]},'description':{'type':Sequelize[_0x0532('0x2')]}}; \ No newline at end of file +var _0xf53e=['STRING','sequelize','exports'];(function(_0x553c18,_0x14248a){var _0x2f1bde=function(_0x62aae1){while(--_0x62aae1){_0x553c18['push'](_0x553c18['shift']());}};_0x2f1bde(++_0x14248a);}(_0xf53e,0x70));var _0xef53=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf53e[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xef53('0x0'));module[_0xef53('0x1')]={'name':{'type':Sequelize[_0xef53('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 1e09a4c..fa832c5 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 _0x2cc3=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','FreshdeskConfiguration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','FreshdeskField','length','getSubjects','order','getDescriptions','Tag','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x1846b9,_0x11e023){var _0xd1f7d5=function(_0x28502c){while(--_0x28502c){_0x1846b9['push'](_0x1846b9['shift']());}};_0xd1f7d5(++_0x11e023);}(_0x2cc3,0x13b));var _0x32cc=function(_0x2a18e4,_0x10367f){_0x2a18e4=_0x2a18e4-0x0;var _0x4f0cc1=_0x2cc3[_0x2a18e4];return _0x4f0cc1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32cc('0x0'));var zipdir=require(_0x32cc('0x1'));var jsonpatch=require(_0x32cc('0x2'));var rp=require(_0x32cc('0x3'));var moment=require('moment');var BPromise=require(_0x32cc('0x4'));var Mustache=require(_0x32cc('0x5'));var util=require(_0x32cc('0x6'));var path=require(_0x32cc('0x7'));var sox=require(_0x32cc('0x8'));var csv=require('to-csv');var ejs=require(_0x32cc('0x9'));var fs=require('fs');var fs_extra=require(_0x32cc('0xa'));var _=require('lodash');var squel=require(_0x32cc('0xb'));var crypto=require('crypto');var jsforce=require(_0x32cc('0xc'));var deskjs=require(_0x32cc('0xd'));var toCsv=require(_0x32cc('0xe'));var querystring=require(_0x32cc('0xf'));var Papa=require('papaparse');var Redis=require(_0x32cc('0x10'));var authService=require(_0x32cc('0x11'));var qs=require(_0x32cc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x32cc('0x13'))(_0x32cc('0x14'));var utils=require('../../config/utils');var config=require(_0x32cc('0x15'));var licenseUtil=require(_0x32cc('0x16'));var db=require(_0x32cc('0x17'))['db'];function respondWithStatusCode(_0x3f0d93,_0x527b79){_0x527b79=_0x527b79||0xcc;return function(_0x110a46){if(_0x110a46){return _0x3f0d93[_0x32cc('0x18')](_0x527b79);}return _0x3f0d93[_0x32cc('0x19')](_0x527b79)[_0x32cc('0x1a')]();};}function respondWithResult(_0x340567,_0x1e4356){_0x1e4356=_0x1e4356||0xc8;return function(_0x1cc221){if(_0x1cc221){return _0x340567[_0x32cc('0x19')](_0x1e4356)[_0x32cc('0x1b')](_0x1cc221);}};}function respondWithFilteredResult(_0x4cc877,_0x4dd24b){return function(_0x474c9b){if(_0x474c9b){var _0x8ff2b6=typeof _0x4dd24b[_0x32cc('0x1c')]==='undefined'&&typeof _0x4dd24b[_0x32cc('0x1d')]===_0x32cc('0x1e');var _0x2c8bce=_0x474c9b['count'];var _0x57ea30=_0x8ff2b6?0x0:_0x4dd24b[_0x32cc('0x1c')];var _0x10c5c3=_0x8ff2b6?_0x474c9b['count']:_0x4dd24b[_0x32cc('0x1c')]+_0x4dd24b[_0x32cc('0x1d')];var _0x308a30;if(_0x10c5c3>=_0x2c8bce){_0x10c5c3=_0x2c8bce;_0x308a30=0xc8;}else{_0x308a30=0xce;}_0x4cc877[_0x32cc('0x19')](_0x308a30);return _0x4cc877[_0x32cc('0x1f')](_0x32cc('0x20'),_0x57ea30+'-'+_0x10c5c3+'/'+_0x2c8bce)[_0x32cc('0x1b')](_0x474c9b);}return null;};}function patchUpdates(_0x3af772){return function(_0x491af2){try{jsonpatch[_0x32cc('0x21')](_0x491af2,_0x3af772,!![]);}catch(_0x1af205){return BPromise[_0x32cc('0x22')](_0x1af205);}return _0x491af2[_0x32cc('0x23')]();};}function saveUpdates(_0xb9cf8,_0xa49b8a){return function(_0x548f80){if(_0x548f80){return _0x548f80['update'](_0xb9cf8)[_0x32cc('0x24')](function(_0x4efd70){return _0x4efd70;});}return null;};}function removeEntity(_0x4bed15,_0x574922){return function(_0x52ec67){if(_0x52ec67){return _0x52ec67[_0x32cc('0x25')]()['then'](function(){_0x4bed15['status'](0xcc)[_0x32cc('0x1a')]();});}};}function handleEntityNotFound(_0x1a3939,_0x239724){return function(_0x136151){if(!_0x136151){_0x1a3939[_0x32cc('0x18')](0x194);}return _0x136151;};}function handleError(_0x340292,_0x5e79ad){_0x5e79ad=_0x5e79ad||0x1f4;return function(_0xbffd36){logger['error'](_0xbffd36['stack']);if(_0xbffd36[_0x32cc('0x26')]){delete _0xbffd36[_0x32cc('0x26')];}_0x340292['status'](_0x5e79ad)[_0x32cc('0x27')](_0xbffd36);};}exports[_0x32cc('0x28')]=function(_0x586a77,_0x2288b9){var _0x1eba12={},_0x2c3ebd={},_0x2cea00={'count':0x0,'rows':[]};var _0x455003=_[_0x32cc('0x29')](db[_0x32cc('0x2a')][_0x32cc('0x2b')],function(_0xf2d83d){return{'name':_0xf2d83d['fieldName'],'type':_0xf2d83d['type'][_0x32cc('0x2c')]};});_0x2c3ebd[_0x32cc('0x2d')]=_['map'](_0x455003,_0x32cc('0x26'));_0x2c3ebd[_0x32cc('0x2e')]=_[_0x32cc('0x2f')](_0x586a77[_0x32cc('0x2e')]);_0x2c3ebd[_0x32cc('0x30')]=_[_0x32cc('0x31')](_0x2c3ebd['model'],_0x2c3ebd['query']);_0x1eba12['attributes']=_['intersection'](_0x2c3ebd[_0x32cc('0x2d')],qs[_0x32cc('0x32')](_0x586a77[_0x32cc('0x2e')]['fields']));_0x1eba12[_0x32cc('0x33')]=_0x1eba12['attributes']['length']?_0x1eba12[_0x32cc('0x33')]:_0x2c3ebd[_0x32cc('0x2d')];if(!_0x586a77[_0x32cc('0x2e')][_0x32cc('0x34')](_0x32cc('0x35'))){_0x1eba12[_0x32cc('0x1d')]=qs[_0x32cc('0x1d')](_0x586a77['query'][_0x32cc('0x1d')]);_0x1eba12['offset']=qs[_0x32cc('0x1c')](_0x586a77['query'][_0x32cc('0x1c')]);}_0x1eba12['order']=qs['sort'](_0x586a77[_0x32cc('0x2e')][_0x32cc('0x36')]);_0x1eba12['where']=qs[_0x32cc('0x30')](_[_0x32cc('0x37')](_0x586a77['query'],_0x2c3ebd[_0x32cc('0x30')]),_0x455003);if(_0x586a77[_0x32cc('0x2e')]['filter']){_0x1eba12[_0x32cc('0x38')]=_[_0x32cc('0x39')](_0x1eba12['where'],{'$or':_['map'](_0x455003,function(_0x2b6c91){if(_0x2b6c91['type']!==_0x32cc('0x3a')){var _0x160983={};_0x160983[_0x2b6c91['name']]={'$like':'%'+_0x586a77['query'][_0x32cc('0x3b')]+'%'};return _0x160983;}})});}_0x1eba12=_['merge']({},_0x1eba12,_0x586a77[_0x32cc('0x3c')]);var _0x5d8f3a={'where':_0x1eba12[_0x32cc('0x38')]};return db[_0x32cc('0x2a')][_0x32cc('0x3d')](_0x5d8f3a)['then'](function(_0x46daed){_0x2cea00[_0x32cc('0x3d')]=_0x46daed;if(_0x586a77[_0x32cc('0x2e')][_0x32cc('0x3e')]){_0x1eba12[_0x32cc('0x3f')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x32cc('0x40')](_0x1eba12);})[_0x32cc('0x24')](function(_0x278a12){_0x2cea00[_0x32cc('0x41')]=_0x278a12;return _0x2cea00;})[_0x32cc('0x24')](respondWithFilteredResult(_0x2288b9,_0x1eba12))[_0x32cc('0x42')](handleError(_0x2288b9,null));};exports[_0x32cc('0x43')]=function(_0x412788,_0x3a498b){var _0xea3144={'raw':![],'where':{'id':_0x412788['params']['id']}},_0x3b3808={};_0x3b3808[_0x32cc('0x2d')]=_['keys'](db[_0x32cc('0x2a')][_0x32cc('0x2b')]);_0x3b3808[_0x32cc('0x2e')]=_['keys'](_0x412788[_0x32cc('0x2e')]);_0x3b3808[_0x32cc('0x30')]=_['intersection'](_0x3b3808[_0x32cc('0x2d')],_0x3b3808[_0x32cc('0x2e')]);_0xea3144[_0x32cc('0x33')]=_[_0x32cc('0x31')](_0x3b3808[_0x32cc('0x2d')],qs[_0x32cc('0x32')](_0x412788[_0x32cc('0x2e')][_0x32cc('0x32')]));_0xea3144[_0x32cc('0x33')]=_0xea3144[_0x32cc('0x33')]['length']?_0xea3144['attributes']:_0x3b3808[_0x32cc('0x2d')];if(_0x412788[_0x32cc('0x2e')][_0x32cc('0x3e')]){_0xea3144[_0x32cc('0x3f')]=[{'all':!![]}];}_0xea3144=_[_0x32cc('0x39')]({},_0xea3144,_0x412788[_0x32cc('0x3c')]);return db[_0x32cc('0x2a')][_0x32cc('0x44')](_0xea3144)['then'](handleEntityNotFound(_0x3a498b,null))['then'](respondWithResult(_0x3a498b,null))[_0x32cc('0x42')](handleError(_0x3a498b,null));};exports[_0x32cc('0x45')]=function(_0xf725a5,_0x1fed70){return db[_0x32cc('0x2a')][_0x32cc('0x45')](_0xf725a5['body'],{})[_0x32cc('0x24')](respondWithResult(_0x1fed70,0xc9))['catch'](handleError(_0x1fed70,null));};exports['update']=function(_0x302c75,_0x34c411){if(_0x302c75['body']['id']){delete _0x302c75[_0x32cc('0x46')]['id'];}return db['FreshdeskConfiguration'][_0x32cc('0x44')]({'where':{'id':_0x302c75['params']['id']}})[_0x32cc('0x24')](handleEntityNotFound(_0x34c411,null))[_0x32cc('0x24')](saveUpdates(_0x302c75[_0x32cc('0x46')],null))[_0x32cc('0x24')](respondWithResult(_0x34c411,null))['catch'](handleError(_0x34c411,null));};exports['destroy']=function(_0x119216,_0x41b029){return db['FreshdeskConfiguration'][_0x32cc('0x44')]({'where':{'id':_0x119216[_0x32cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x41b029,null))[_0x32cc('0x24')](removeEntity(_0x41b029,null))[_0x32cc('0x42')](handleError(_0x41b029,null));};exports[_0x32cc('0x48')]=function(_0x460d7c,_0x39dd54,_0x1c9f31){var _0x5633c1={};var _0x558f19={};var _0x53fb5d;var _0x2487e1;return db[_0x32cc('0x2a')][_0x32cc('0x49')]({'where':{'id':_0x460d7c[_0x32cc('0x47')]['id']}})[_0x32cc('0x24')](handleEntityNotFound(_0x39dd54,null))[_0x32cc('0x24')](function(_0x36e16f){if(_0x36e16f){_0x53fb5d=_0x36e16f;_0x558f19[_0x32cc('0x2d')]=_[_0x32cc('0x2f')](db[_0x32cc('0x4a')]['rawAttributes']);_0x558f19[_0x32cc('0x2e')]=_[_0x32cc('0x2f')](_0x460d7c[_0x32cc('0x2e')]);_0x558f19['filters']=_[_0x32cc('0x31')](_0x558f19[_0x32cc('0x2d')],_0x558f19[_0x32cc('0x2e')]);_0x5633c1[_0x32cc('0x33')]=_[_0x32cc('0x31')](_0x558f19[_0x32cc('0x2d')],qs[_0x32cc('0x32')](_0x460d7c[_0x32cc('0x2e')][_0x32cc('0x32')]));_0x5633c1[_0x32cc('0x33')]=_0x5633c1[_0x32cc('0x33')]['length']?_0x5633c1[_0x32cc('0x33')]:_0x558f19[_0x32cc('0x2d')];_0x5633c1['order']=qs[_0x32cc('0x36')](_0x460d7c['query'][_0x32cc('0x36')]);_0x5633c1[_0x32cc('0x38')]=qs[_0x32cc('0x30')](_[_0x32cc('0x37')](_0x460d7c[_0x32cc('0x2e')],_0x558f19[_0x32cc('0x30')]));if(_0x460d7c[_0x32cc('0x2e')][_0x32cc('0x3b')]){_0x5633c1[_0x32cc('0x38')]=_[_0x32cc('0x39')](_0x5633c1[_0x32cc('0x38')],{'$or':_[_0x32cc('0x29')](_0x5633c1['attributes'],function(_0x3c11e4){var _0x216cd3={};_0x216cd3[_0x3c11e4]={'$like':'%'+_0x460d7c['query'][_0x32cc('0x3b')]+'%'};return _0x216cd3;})});}_0x5633c1=_[_0x32cc('0x39')]({},_0x5633c1,_0x460d7c['options']);return _0x53fb5d[_0x32cc('0x48')](_0x5633c1);}})[_0x32cc('0x24')](function(_0x5502d9){if(_0x5502d9){_0x2487e1=_0x5502d9[_0x32cc('0x4b')];if(!_0x460d7c[_0x32cc('0x2e')][_0x32cc('0x34')](_0x32cc('0x35'))){_0x5633c1[_0x32cc('0x1d')]=qs['limit'](_0x460d7c[_0x32cc('0x2e')]['limit']);_0x5633c1['offset']=qs['offset'](_0x460d7c[_0x32cc('0x2e')][_0x32cc('0x1c')]);}return _0x53fb5d[_0x32cc('0x48')](_0x5633c1);}})[_0x32cc('0x24')](function(_0x410a77){if(_0x410a77){return _0x410a77?{'count':_0x2487e1,'rows':_0x410a77}:null;}})[_0x32cc('0x24')](respondWithResult(_0x39dd54,null))[_0x32cc('0x42')](handleError(_0x39dd54,null));};exports[_0x32cc('0x4c')]=function(_0xb16b74,_0x15370a,_0x76f923){var _0x362948={};var _0x4a0de8={};var _0x5efa53;var _0xd26f88;return db[_0x32cc('0x2a')]['findOne']({'where':{'id':_0xb16b74[_0x32cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x15370a,null))['then'](function(_0x408e79){if(_0x408e79){_0x5efa53=_0x408e79;_0x4a0de8[_0x32cc('0x2d')]=_['keys'](db['FreshdeskField'][_0x32cc('0x2b')]);_0x4a0de8['query']=_['keys'](_0xb16b74['query']);_0x4a0de8[_0x32cc('0x30')]=_['intersection'](_0x4a0de8[_0x32cc('0x2d')],_0x4a0de8['query']);_0x362948[_0x32cc('0x33')]=_[_0x32cc('0x31')](_0x4a0de8[_0x32cc('0x2d')],qs[_0x32cc('0x32')](_0xb16b74[_0x32cc('0x2e')][_0x32cc('0x32')]));_0x362948[_0x32cc('0x33')]=_0x362948[_0x32cc('0x33')][_0x32cc('0x4b')]?_0x362948['attributes']:_0x4a0de8[_0x32cc('0x2d')];_0x362948[_0x32cc('0x4d')]=qs['sort'](_0xb16b74[_0x32cc('0x2e')][_0x32cc('0x36')]);_0x362948['where']=qs['filters'](_[_0x32cc('0x37')](_0xb16b74['query'],_0x4a0de8[_0x32cc('0x30')]));if(_0xb16b74[_0x32cc('0x2e')][_0x32cc('0x3b')]){_0x362948[_0x32cc('0x38')]=_[_0x32cc('0x39')](_0x362948[_0x32cc('0x38')],{'$or':_[_0x32cc('0x29')](_0x362948['attributes'],function(_0x5a9196){var _0x347ab4={};_0x347ab4[_0x5a9196]={'$like':'%'+_0xb16b74[_0x32cc('0x2e')][_0x32cc('0x3b')]+'%'};return _0x347ab4;})});}_0x362948=_['merge']({},_0x362948,_0xb16b74[_0x32cc('0x3c')]);return _0x5efa53[_0x32cc('0x4c')](_0x362948);}})[_0x32cc('0x24')](function(_0x5f0025){if(_0x5f0025){_0xd26f88=_0x5f0025['length'];if(!_0xb16b74[_0x32cc('0x2e')]['hasOwnProperty'](_0x32cc('0x35'))){_0x362948[_0x32cc('0x1d')]=qs['limit'](_0xb16b74[_0x32cc('0x2e')][_0x32cc('0x1d')]);_0x362948[_0x32cc('0x1c')]=qs['offset'](_0xb16b74[_0x32cc('0x2e')][_0x32cc('0x1c')]);}return _0x5efa53[_0x32cc('0x4c')](_0x362948);}})[_0x32cc('0x24')](function(_0x2e90ba){if(_0x2e90ba){return _0x2e90ba?{'count':_0xd26f88,'rows':_0x2e90ba}:null;}})[_0x32cc('0x24')](respondWithResult(_0x15370a,null))['catch'](handleError(_0x15370a,null));};exports[_0x32cc('0x4e')]=function(_0x528804,_0x3c5cd0,_0x40af5d){var _0x45e466={};var _0x365070={};var _0x56f4b9;var _0x41ab36;return db[_0x32cc('0x2a')][_0x32cc('0x49')]({'where':{'id':_0x528804[_0x32cc('0x47')]['id']}})[_0x32cc('0x24')](handleEntityNotFound(_0x3c5cd0,null))[_0x32cc('0x24')](function(_0xb2c20b){if(_0xb2c20b){_0x56f4b9=_0xb2c20b;_0x365070[_0x32cc('0x2d')]=_[_0x32cc('0x2f')](db['FreshdeskField']['rawAttributes']);_0x365070['query']=_['keys'](_0x528804[_0x32cc('0x2e')]);_0x365070[_0x32cc('0x30')]=_[_0x32cc('0x31')](_0x365070[_0x32cc('0x2d')],_0x365070[_0x32cc('0x2e')]);_0x45e466[_0x32cc('0x33')]=_[_0x32cc('0x31')](_0x365070[_0x32cc('0x2d')],qs[_0x32cc('0x32')](_0x528804['query'][_0x32cc('0x32')]));_0x45e466[_0x32cc('0x33')]=_0x45e466[_0x32cc('0x33')][_0x32cc('0x4b')]?_0x45e466['attributes']:_0x365070[_0x32cc('0x2d')];_0x45e466['order']=qs['sort'](_0x528804[_0x32cc('0x2e')][_0x32cc('0x36')]);_0x45e466[_0x32cc('0x38')]=qs['filters'](_['pick'](_0x528804[_0x32cc('0x2e')],_0x365070[_0x32cc('0x30')]));if(_0x528804['query'][_0x32cc('0x3b')]){_0x45e466['where']=_[_0x32cc('0x39')](_0x45e466['where'],{'$or':_[_0x32cc('0x29')](_0x45e466['attributes'],function(_0x5f3530){var _0x284c00={};_0x284c00[_0x5f3530]={'$like':'%'+_0x528804[_0x32cc('0x2e')][_0x32cc('0x3b')]+'%'};return _0x284c00;})});}_0x45e466=_[_0x32cc('0x39')]({},_0x45e466,_0x528804[_0x32cc('0x3c')]);return _0x56f4b9[_0x32cc('0x4e')](_0x45e466);}})[_0x32cc('0x24')](function(_0x4f7818){if(_0x4f7818){_0x41ab36=_0x4f7818[_0x32cc('0x4b')];if(!_0x528804[_0x32cc('0x2e')][_0x32cc('0x34')](_0x32cc('0x35'))){_0x45e466[_0x32cc('0x1d')]=qs[_0x32cc('0x1d')](_0x528804[_0x32cc('0x2e')][_0x32cc('0x1d')]);_0x45e466[_0x32cc('0x1c')]=qs[_0x32cc('0x1c')](_0x528804[_0x32cc('0x2e')][_0x32cc('0x1c')]);}return _0x56f4b9[_0x32cc('0x4e')](_0x45e466);}})[_0x32cc('0x24')](function(_0x45e25c){if(_0x45e25c){return _0x45e25c?{'count':_0x41ab36,'rows':_0x45e25c}:null;}})[_0x32cc('0x24')](respondWithResult(_0x3c5cd0,null))['catch'](handleError(_0x3c5cd0,null));};exports['getTags']=function(_0x58c5dd,_0x351117,_0x1602ff){var _0x12d621={};var _0x15c1cb={};var _0x43dd80;var _0x269384;return db[_0x32cc('0x2a')][_0x32cc('0x49')]({'where':{'id':_0x58c5dd[_0x32cc('0x47')]['id']}})[_0x32cc('0x24')](handleEntityNotFound(_0x351117,null))[_0x32cc('0x24')](function(_0x1b6936){if(_0x1b6936){_0x43dd80=_0x1b6936;_0x15c1cb[_0x32cc('0x2d')]=_[_0x32cc('0x2f')](db[_0x32cc('0x4f')][_0x32cc('0x2b')]);_0x15c1cb[_0x32cc('0x2e')]=_[_0x32cc('0x2f')](_0x58c5dd[_0x32cc('0x2e')]);_0x15c1cb[_0x32cc('0x30')]=_[_0x32cc('0x31')](_0x15c1cb['model'],_0x15c1cb[_0x32cc('0x2e')]);_0x12d621[_0x32cc('0x33')]=_[_0x32cc('0x31')](_0x15c1cb['model'],qs['fields'](_0x58c5dd[_0x32cc('0x2e')][_0x32cc('0x32')]));_0x12d621['attributes']=_0x12d621[_0x32cc('0x33')][_0x32cc('0x4b')]?_0x12d621[_0x32cc('0x33')]:_0x15c1cb['model'];_0x12d621['order']=qs[_0x32cc('0x36')](_0x58c5dd[_0x32cc('0x2e')][_0x32cc('0x36')]);_0x12d621[_0x32cc('0x38')]=qs['filters'](_[_0x32cc('0x37')](_0x58c5dd['query'],_0x15c1cb[_0x32cc('0x30')]));if(_0x58c5dd['query'][_0x32cc('0x3b')]){_0x12d621[_0x32cc('0x38')]=_[_0x32cc('0x39')](_0x12d621[_0x32cc('0x38')],{'$or':_['map'](_0x12d621[_0x32cc('0x33')],function(_0x51f37b){var _0x2d9f9b={};_0x2d9f9b[_0x51f37b]={'$like':'%'+_0x58c5dd['query'][_0x32cc('0x3b')]+'%'};return _0x2d9f9b;})});}_0x12d621=_[_0x32cc('0x39')]({},_0x12d621,_0x58c5dd[_0x32cc('0x3c')]);return _0x43dd80[_0x32cc('0x50')](_0x12d621);}})[_0x32cc('0x24')](function(_0x5be8db){if(_0x5be8db){_0x269384=_0x5be8db[_0x32cc('0x4b')];if(!_0x58c5dd[_0x32cc('0x2e')][_0x32cc('0x34')](_0x32cc('0x35'))){_0x12d621['limit']=qs[_0x32cc('0x1d')](_0x58c5dd[_0x32cc('0x2e')][_0x32cc('0x1d')]);_0x12d621[_0x32cc('0x1c')]=qs[_0x32cc('0x1c')](_0x58c5dd[_0x32cc('0x2e')][_0x32cc('0x1c')]);}return _0x43dd80[_0x32cc('0x50')](_0x12d621);}})[_0x32cc('0x24')](function(_0x36cad6){if(_0x36cad6){return _0x36cad6?{'count':_0x269384,'rows':_0x36cad6}:null;}})[_0x32cc('0x24')](respondWithResult(_0x351117,null))[_0x32cc('0x42')](handleError(_0x351117,null));};exports[_0x32cc('0x51')]=function(_0x281069,_0x181cbe,_0x20cfff){if(_0x281069[_0x32cc('0x46')]['id']){delete _0x281069[_0x32cc('0x46')]['id'];}return db[_0x32cc('0x2a')][_0x32cc('0x49')]({'where':{'id':_0x281069[_0x32cc('0x47')]['id']}})[_0x32cc('0x24')](handleEntityNotFound(_0x181cbe,null))[_0x32cc('0x24')](function(_0x3ef37b){if(_0x3ef37b){return _0x3ef37b[_0x32cc('0x51')](_0x281069[_0x32cc('0x46')][_0x32cc('0x52')]||[]);}return null;})[_0x32cc('0x24')](respondWithResult(_0x181cbe,null))[_0x32cc('0x42')](handleError(_0x181cbe,null));}; \ No newline at end of file +var _0xffee=['count','limit','set','apply','reject','save','update','then','destroy','error','send','index','map','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','FreshdeskConfiguration','findAll','rows','show','params','find','catch','create','body','findOne','FreshdeskField','rawAttributes','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x455c1f,_0x462207){var _0xbc002a=function(_0xeedab8){while(--_0xeedab8){_0x455c1f['push'](_0x455c1f['shift']());}};_0xbc002a(++_0x462207);}(_0xffee,0x90));var _0xeffe=function(_0x5391f9,_0x3c7d18){_0x5391f9=_0x5391f9-0x0;var _0x20ac28=_0xffee[_0x5391f9];return _0x20ac28;};'use strict';var emlformat=require(_0xeffe('0x0'));var rimraf=require(_0xeffe('0x1'));var zipdir=require(_0xeffe('0x2'));var jsonpatch=require(_0xeffe('0x3'));var rp=require(_0xeffe('0x4'));var moment=require(_0xeffe('0x5'));var BPromise=require(_0xeffe('0x6'));var Mustache=require(_0xeffe('0x7'));var util=require(_0xeffe('0x8'));var path=require(_0xeffe('0x9'));var sox=require(_0xeffe('0xa'));var csv=require('to-csv');var ejs=require(_0xeffe('0xb'));var fs=require('fs');var fs_extra=require(_0xeffe('0xc'));var _=require('lodash');var squel=require(_0xeffe('0xd'));var crypto=require(_0xeffe('0xe'));var jsforce=require(_0xeffe('0xf'));var deskjs=require(_0xeffe('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeffe('0x11'));var Papa=require(_0xeffe('0x12'));var Redis=require(_0xeffe('0x13'));var authService=require(_0xeffe('0x14'));var qs=require(_0xeffe('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeffe('0x16'));var logger=require('../../config/logger')(_0xeffe('0x17'));var utils=require(_0xeffe('0x18'));var config=require(_0xeffe('0x19'));var licenseUtil=require(_0xeffe('0x1a'));var db=require(_0xeffe('0x1b'))['db'];function respondWithStatusCode(_0x14cf22,_0x42f0f8){_0x42f0f8=_0x42f0f8||0xcc;return function(_0x40c2bd){if(_0x40c2bd){return _0x14cf22[_0xeffe('0x1c')](_0x42f0f8);}return _0x14cf22[_0xeffe('0x1d')](_0x42f0f8)[_0xeffe('0x1e')]();};}function respondWithResult(_0x2f050f,_0x105b4f){_0x105b4f=_0x105b4f||0xc8;return function(_0x115340){if(_0x115340){return _0x2f050f[_0xeffe('0x1d')](_0x105b4f)[_0xeffe('0x1f')](_0x115340);}};}function respondWithFilteredResult(_0x560d4f,_0xf9d2c7){return function(_0x197d8e){if(_0x197d8e){var _0x26687b=typeof _0xf9d2c7[_0xeffe('0x20')]===_0xeffe('0x21')&&typeof _0xf9d2c7['limit']===_0xeffe('0x21');var _0x32e1af=_0x197d8e[_0xeffe('0x22')];var _0x49ad1d=_0x26687b?0x0:_0xf9d2c7[_0xeffe('0x20')];var _0x3f8ab3=_0x26687b?_0x197d8e['count']:_0xf9d2c7[_0xeffe('0x20')]+_0xf9d2c7[_0xeffe('0x23')];var _0x316591;if(_0x3f8ab3>=_0x32e1af){_0x3f8ab3=_0x32e1af;_0x316591=0xc8;}else{_0x316591=0xce;}_0x560d4f[_0xeffe('0x1d')](_0x316591);return _0x560d4f[_0xeffe('0x24')]('Content-Range',_0x49ad1d+'-'+_0x3f8ab3+'/'+_0x32e1af)['json'](_0x197d8e);}return null;};}function patchUpdates(_0x3dd975){return function(_0x193658){try{jsonpatch[_0xeffe('0x25')](_0x193658,_0x3dd975,!![]);}catch(_0x10da69){return BPromise[_0xeffe('0x26')](_0x10da69);}return _0x193658[_0xeffe('0x27')]();};}function saveUpdates(_0x25e24a,_0xa98155){return function(_0xa6e305){if(_0xa6e305){return _0xa6e305[_0xeffe('0x28')](_0x25e24a)[_0xeffe('0x29')](function(_0x12574f){return _0x12574f;});}return null;};}function removeEntity(_0x56482e,_0x13bae3){return function(_0x4b282d){if(_0x4b282d){return _0x4b282d[_0xeffe('0x2a')]()[_0xeffe('0x29')](function(){_0x56482e[_0xeffe('0x1d')](0xcc)[_0xeffe('0x1e')]();});}};}function handleEntityNotFound(_0x3f0162,_0x2acfa3){return function(_0x1f7d0d){if(!_0x1f7d0d){_0x3f0162[_0xeffe('0x1c')](0x194);}return _0x1f7d0d;};}function handleError(_0x1a14b1,_0x5db801){_0x5db801=_0x5db801||0x1f4;return function(_0x48c498){logger[_0xeffe('0x2b')](_0x48c498['stack']);if(_0x48c498['name']){delete _0x48c498['name'];}_0x1a14b1[_0xeffe('0x1d')](_0x5db801)[_0xeffe('0x2c')](_0x48c498);};}exports[_0xeffe('0x2d')]=function(_0x365dd3,_0x276939){var _0x3eab1f={},_0x327a77={},_0x2920e4={'count':0x0,'rows':[]};var _0x20ee4b=_[_0xeffe('0x2e')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x1bfb1b){return{'name':_0x1bfb1b[_0xeffe('0x2f')],'type':_0x1bfb1b[_0xeffe('0x30')]['key']};});_0x327a77[_0xeffe('0x31')]=_['map'](_0x20ee4b,_0xeffe('0x32'));_0x327a77[_0xeffe('0x33')]=_[_0xeffe('0x34')](_0x365dd3['query']);_0x327a77[_0xeffe('0x35')]=_[_0xeffe('0x36')](_0x327a77[_0xeffe('0x31')],_0x327a77[_0xeffe('0x33')]);_0x3eab1f['attributes']=_['intersection'](_0x327a77[_0xeffe('0x31')],qs[_0xeffe('0x37')](_0x365dd3['query'][_0xeffe('0x37')]));_0x3eab1f[_0xeffe('0x38')]=_0x3eab1f[_0xeffe('0x38')][_0xeffe('0x39')]?_0x3eab1f[_0xeffe('0x38')]:_0x327a77[_0xeffe('0x31')];if(!_0x365dd3[_0xeffe('0x33')]['hasOwnProperty'](_0xeffe('0x3a'))){_0x3eab1f[_0xeffe('0x23')]=qs[_0xeffe('0x23')](_0x365dd3['query'][_0xeffe('0x23')]);_0x3eab1f[_0xeffe('0x20')]=qs[_0xeffe('0x20')](_0x365dd3[_0xeffe('0x33')]['offset']);}_0x3eab1f[_0xeffe('0x3b')]=qs['sort'](_0x365dd3[_0xeffe('0x33')][_0xeffe('0x3c')]);_0x3eab1f['where']=qs[_0xeffe('0x35')](_[_0xeffe('0x3d')](_0x365dd3[_0xeffe('0x33')],_0x327a77[_0xeffe('0x35')]),_0x20ee4b);if(_0x365dd3[_0xeffe('0x33')][_0xeffe('0x3e')]){_0x3eab1f[_0xeffe('0x3f')]=_[_0xeffe('0x40')](_0x3eab1f[_0xeffe('0x3f')],{'$or':_[_0xeffe('0x2e')](_0x20ee4b,function(_0x3311f7){if(_0x3311f7[_0xeffe('0x30')]!==_0xeffe('0x41')){var _0x304b25={};_0x304b25[_0x3311f7['name']]={'$like':'%'+_0x365dd3[_0xeffe('0x33')][_0xeffe('0x3e')]+'%'};return _0x304b25;}})});}_0x3eab1f=_[_0xeffe('0x40')]({},_0x3eab1f,_0x365dd3[_0xeffe('0x42')]);var _0x5aef34={'where':_0x3eab1f[_0xeffe('0x3f')]};return db['FreshdeskConfiguration'][_0xeffe('0x22')](_0x5aef34)[_0xeffe('0x29')](function(_0x32af0a){_0x2920e4[_0xeffe('0x22')]=_0x32af0a;if(_0x365dd3[_0xeffe('0x33')][_0xeffe('0x43')]){_0x3eab1f[_0xeffe('0x44')]=[{'all':!![]}];}return db[_0xeffe('0x45')][_0xeffe('0x46')](_0x3eab1f);})['then'](function(_0x2c62a2){_0x2920e4[_0xeffe('0x47')]=_0x2c62a2;return _0x2920e4;})[_0xeffe('0x29')](respondWithFilteredResult(_0x276939,_0x3eab1f))['catch'](handleError(_0x276939,null));};exports[_0xeffe('0x48')]=function(_0x282eab,_0x34b05c){var _0x21c107={'raw':![],'where':{'id':_0x282eab[_0xeffe('0x49')]['id']}},_0x5a84a1={};_0x5a84a1[_0xeffe('0x31')]=_['keys'](db[_0xeffe('0x45')]['rawAttributes']);_0x5a84a1[_0xeffe('0x33')]=_[_0xeffe('0x34')](_0x282eab['query']);_0x5a84a1[_0xeffe('0x35')]=_[_0xeffe('0x36')](_0x5a84a1['model'],_0x5a84a1[_0xeffe('0x33')]);_0x21c107[_0xeffe('0x38')]=_[_0xeffe('0x36')](_0x5a84a1[_0xeffe('0x31')],qs[_0xeffe('0x37')](_0x282eab[_0xeffe('0x33')]['fields']));_0x21c107['attributes']=_0x21c107[_0xeffe('0x38')][_0xeffe('0x39')]?_0x21c107['attributes']:_0x5a84a1[_0xeffe('0x31')];if(_0x282eab[_0xeffe('0x33')][_0xeffe('0x43')]){_0x21c107[_0xeffe('0x44')]=[{'all':!![]}];}_0x21c107=_[_0xeffe('0x40')]({},_0x21c107,_0x282eab[_0xeffe('0x42')]);return db[_0xeffe('0x45')][_0xeffe('0x4a')](_0x21c107)[_0xeffe('0x29')](handleEntityNotFound(_0x34b05c,null))[_0xeffe('0x29')](respondWithResult(_0x34b05c,null))[_0xeffe('0x4b')](handleError(_0x34b05c,null));};exports[_0xeffe('0x4c')]=function(_0x5c1d36,_0x498dd0){return db[_0xeffe('0x45')][_0xeffe('0x4c')](_0x5c1d36['body'],{})[_0xeffe('0x29')](respondWithResult(_0x498dd0,0xc9))[_0xeffe('0x4b')](handleError(_0x498dd0,null));};exports[_0xeffe('0x28')]=function(_0xe675a9,_0x4e9092){if(_0xe675a9[_0xeffe('0x4d')]['id']){delete _0xe675a9[_0xeffe('0x4d')]['id'];}return db[_0xeffe('0x45')][_0xeffe('0x4a')]({'where':{'id':_0xe675a9[_0xeffe('0x49')]['id']}})['then'](handleEntityNotFound(_0x4e9092,null))[_0xeffe('0x29')](saveUpdates(_0xe675a9['body'],null))[_0xeffe('0x29')](respondWithResult(_0x4e9092,null))[_0xeffe('0x4b')](handleError(_0x4e9092,null));};exports[_0xeffe('0x2a')]=function(_0x34d429,_0x210c41){return db[_0xeffe('0x45')]['find']({'where':{'id':_0x34d429['params']['id']}})[_0xeffe('0x29')](handleEntityNotFound(_0x210c41,null))[_0xeffe('0x29')](removeEntity(_0x210c41,null))[_0xeffe('0x4b')](handleError(_0x210c41,null));};exports['getFields']=function(_0x39f962,_0x5e3f4d,_0x59c28a){var _0x39f3f={};var _0x45888b={};var _0x5bf730;var _0x4b4b32;return db[_0xeffe('0x45')][_0xeffe('0x4e')]({'where':{'id':_0x39f962['params']['id']}})[_0xeffe('0x29')](handleEntityNotFound(_0x5e3f4d,null))[_0xeffe('0x29')](function(_0x50e7aa){if(_0x50e7aa){_0x5bf730=_0x50e7aa;_0x45888b[_0xeffe('0x31')]=_[_0xeffe('0x34')](db[_0xeffe('0x4f')][_0xeffe('0x50')]);_0x45888b[_0xeffe('0x33')]=_[_0xeffe('0x34')](_0x39f962[_0xeffe('0x33')]);_0x45888b[_0xeffe('0x35')]=_[_0xeffe('0x36')](_0x45888b[_0xeffe('0x31')],_0x45888b[_0xeffe('0x33')]);_0x39f3f['attributes']=_[_0xeffe('0x36')](_0x45888b[_0xeffe('0x31')],qs[_0xeffe('0x37')](_0x39f962[_0xeffe('0x33')][_0xeffe('0x37')]));_0x39f3f[_0xeffe('0x38')]=_0x39f3f[_0xeffe('0x38')]['length']?_0x39f3f['attributes']:_0x45888b[_0xeffe('0x31')];_0x39f3f['order']=qs[_0xeffe('0x3c')](_0x39f962['query'][_0xeffe('0x3c')]);_0x39f3f[_0xeffe('0x3f')]=qs[_0xeffe('0x35')](_['pick'](_0x39f962[_0xeffe('0x33')],_0x45888b[_0xeffe('0x35')]));if(_0x39f962[_0xeffe('0x33')][_0xeffe('0x3e')]){_0x39f3f[_0xeffe('0x3f')]=_['merge'](_0x39f3f[_0xeffe('0x3f')],{'$or':_[_0xeffe('0x2e')](_0x39f3f[_0xeffe('0x38')],function(_0x80ac79){var _0x1c1341={};_0x1c1341[_0x80ac79]={'$like':'%'+_0x39f962[_0xeffe('0x33')][_0xeffe('0x3e')]+'%'};return _0x1c1341;})});}_0x39f3f=_[_0xeffe('0x40')]({},_0x39f3f,_0x39f962[_0xeffe('0x42')]);return _0x5bf730[_0xeffe('0x51')](_0x39f3f);}})[_0xeffe('0x29')](function(_0x4ac37e){if(_0x4ac37e){_0x4b4b32=_0x4ac37e[_0xeffe('0x39')];if(!_0x39f962['query'][_0xeffe('0x52')](_0xeffe('0x3a'))){_0x39f3f[_0xeffe('0x23')]=qs[_0xeffe('0x23')](_0x39f962[_0xeffe('0x33')][_0xeffe('0x23')]);_0x39f3f[_0xeffe('0x20')]=qs[_0xeffe('0x20')](_0x39f962[_0xeffe('0x33')]['offset']);}return _0x5bf730[_0xeffe('0x51')](_0x39f3f);}})[_0xeffe('0x29')](function(_0x272ad0){if(_0x272ad0){return _0x272ad0?{'count':_0x4b4b32,'rows':_0x272ad0}:null;}})[_0xeffe('0x29')](respondWithResult(_0x5e3f4d,null))[_0xeffe('0x4b')](handleError(_0x5e3f4d,null));};exports[_0xeffe('0x53')]=function(_0x39dcc2,_0x38d535,_0x70c5a9){var _0x236e7a={};var _0xd951c1={};var _0x1e2b39;var _0xb885f8;return db['FreshdeskConfiguration'][_0xeffe('0x4e')]({'where':{'id':_0x39dcc2[_0xeffe('0x49')]['id']}})[_0xeffe('0x29')](handleEntityNotFound(_0x38d535,null))[_0xeffe('0x29')](function(_0x52df3a){if(_0x52df3a){_0x1e2b39=_0x52df3a;_0xd951c1[_0xeffe('0x31')]=_[_0xeffe('0x34')](db[_0xeffe('0x4f')][_0xeffe('0x50')]);_0xd951c1['query']=_[_0xeffe('0x34')](_0x39dcc2[_0xeffe('0x33')]);_0xd951c1[_0xeffe('0x35')]=_[_0xeffe('0x36')](_0xd951c1[_0xeffe('0x31')],_0xd951c1['query']);_0x236e7a[_0xeffe('0x38')]=_['intersection'](_0xd951c1[_0xeffe('0x31')],qs[_0xeffe('0x37')](_0x39dcc2[_0xeffe('0x33')][_0xeffe('0x37')]));_0x236e7a['attributes']=_0x236e7a[_0xeffe('0x38')][_0xeffe('0x39')]?_0x236e7a[_0xeffe('0x38')]:_0xd951c1[_0xeffe('0x31')];_0x236e7a[_0xeffe('0x3b')]=qs[_0xeffe('0x3c')](_0x39dcc2['query'][_0xeffe('0x3c')]);_0x236e7a[_0xeffe('0x3f')]=qs['filters'](_[_0xeffe('0x3d')](_0x39dcc2['query'],_0xd951c1['filters']));if(_0x39dcc2[_0xeffe('0x33')][_0xeffe('0x3e')]){_0x236e7a['where']=_[_0xeffe('0x40')](_0x236e7a[_0xeffe('0x3f')],{'$or':_['map'](_0x236e7a[_0xeffe('0x38')],function(_0xb1d981){var _0x4e6228={};_0x4e6228[_0xb1d981]={'$like':'%'+_0x39dcc2['query'][_0xeffe('0x3e')]+'%'};return _0x4e6228;})});}_0x236e7a=_[_0xeffe('0x40')]({},_0x236e7a,_0x39dcc2[_0xeffe('0x42')]);return _0x1e2b39[_0xeffe('0x53')](_0x236e7a);}})['then'](function(_0x51e8db){if(_0x51e8db){_0xb885f8=_0x51e8db[_0xeffe('0x39')];if(!_0x39dcc2[_0xeffe('0x33')][_0xeffe('0x52')]('nolimit')){_0x236e7a['limit']=qs[_0xeffe('0x23')](_0x39dcc2['query'][_0xeffe('0x23')]);_0x236e7a[_0xeffe('0x20')]=qs[_0xeffe('0x20')](_0x39dcc2[_0xeffe('0x33')][_0xeffe('0x20')]);}return _0x1e2b39[_0xeffe('0x53')](_0x236e7a);}})['then'](function(_0x259c1f){if(_0x259c1f){return _0x259c1f?{'count':_0xb885f8,'rows':_0x259c1f}:null;}})[_0xeffe('0x29')](respondWithResult(_0x38d535,null))['catch'](handleError(_0x38d535,null));};exports[_0xeffe('0x54')]=function(_0x3f3fc1,_0x208cc8,_0x463f1c){var _0x4df6b3={};var _0x519a22={};var _0x38ac02;var _0x3ec996;return db[_0xeffe('0x45')]['findOne']({'where':{'id':_0x3f3fc1['params']['id']}})[_0xeffe('0x29')](handleEntityNotFound(_0x208cc8,null))[_0xeffe('0x29')](function(_0x39f3ec){if(_0x39f3ec){_0x38ac02=_0x39f3ec;_0x519a22[_0xeffe('0x31')]=_[_0xeffe('0x34')](db[_0xeffe('0x4f')][_0xeffe('0x50')]);_0x519a22[_0xeffe('0x33')]=_['keys'](_0x3f3fc1['query']);_0x519a22[_0xeffe('0x35')]=_[_0xeffe('0x36')](_0x519a22[_0xeffe('0x31')],_0x519a22['query']);_0x4df6b3['attributes']=_[_0xeffe('0x36')](_0x519a22[_0xeffe('0x31')],qs[_0xeffe('0x37')](_0x3f3fc1[_0xeffe('0x33')][_0xeffe('0x37')]));_0x4df6b3[_0xeffe('0x38')]=_0x4df6b3['attributes'][_0xeffe('0x39')]?_0x4df6b3[_0xeffe('0x38')]:_0x519a22['model'];_0x4df6b3[_0xeffe('0x3b')]=qs['sort'](_0x3f3fc1[_0xeffe('0x33')][_0xeffe('0x3c')]);_0x4df6b3[_0xeffe('0x3f')]=qs[_0xeffe('0x35')](_['pick'](_0x3f3fc1[_0xeffe('0x33')],_0x519a22['filters']));if(_0x3f3fc1[_0xeffe('0x33')][_0xeffe('0x3e')]){_0x4df6b3['where']=_[_0xeffe('0x40')](_0x4df6b3['where'],{'$or':_['map'](_0x4df6b3[_0xeffe('0x38')],function(_0x31ece0){var _0x532632={};_0x532632[_0x31ece0]={'$like':'%'+_0x3f3fc1[_0xeffe('0x33')][_0xeffe('0x3e')]+'%'};return _0x532632;})});}_0x4df6b3=_[_0xeffe('0x40')]({},_0x4df6b3,_0x3f3fc1[_0xeffe('0x42')]);return _0x38ac02[_0xeffe('0x54')](_0x4df6b3);}})[_0xeffe('0x29')](function(_0x5a704f){if(_0x5a704f){_0x3ec996=_0x5a704f[_0xeffe('0x39')];if(!_0x3f3fc1[_0xeffe('0x33')][_0xeffe('0x52')](_0xeffe('0x3a'))){_0x4df6b3[_0xeffe('0x23')]=qs[_0xeffe('0x23')](_0x3f3fc1[_0xeffe('0x33')][_0xeffe('0x23')]);_0x4df6b3['offset']=qs[_0xeffe('0x20')](_0x3f3fc1[_0xeffe('0x33')]['offset']);}return _0x38ac02[_0xeffe('0x54')](_0x4df6b3);}})['then'](function(_0x5e87cf){if(_0x5e87cf){return _0x5e87cf?{'count':_0x3ec996,'rows':_0x5e87cf}:null;}})[_0xeffe('0x29')](respondWithResult(_0x208cc8,null))[_0xeffe('0x4b')](handleError(_0x208cc8,null));};exports[_0xeffe('0x55')]=function(_0x1a2b41,_0x48e4d4,_0x2296ac){var _0x563ec6={};var _0x2014a3={};var _0x42feb6;var _0x173050;return db[_0xeffe('0x45')][_0xeffe('0x4e')]({'where':{'id':_0x1a2b41['params']['id']}})[_0xeffe('0x29')](handleEntityNotFound(_0x48e4d4,null))[_0xeffe('0x29')](function(_0x198fd9){if(_0x198fd9){_0x42feb6=_0x198fd9;_0x2014a3[_0xeffe('0x31')]=_['keys'](db[_0xeffe('0x56')][_0xeffe('0x50')]);_0x2014a3[_0xeffe('0x33')]=_[_0xeffe('0x34')](_0x1a2b41[_0xeffe('0x33')]);_0x2014a3[_0xeffe('0x35')]=_['intersection'](_0x2014a3[_0xeffe('0x31')],_0x2014a3['query']);_0x563ec6[_0xeffe('0x38')]=_[_0xeffe('0x36')](_0x2014a3[_0xeffe('0x31')],qs['fields'](_0x1a2b41[_0xeffe('0x33')][_0xeffe('0x37')]));_0x563ec6[_0xeffe('0x38')]=_0x563ec6[_0xeffe('0x38')][_0xeffe('0x39')]?_0x563ec6[_0xeffe('0x38')]:_0x2014a3['model'];_0x563ec6['order']=qs[_0xeffe('0x3c')](_0x1a2b41[_0xeffe('0x33')][_0xeffe('0x3c')]);_0x563ec6[_0xeffe('0x3f')]=qs[_0xeffe('0x35')](_['pick'](_0x1a2b41['query'],_0x2014a3[_0xeffe('0x35')]));if(_0x1a2b41[_0xeffe('0x33')]['filter']){_0x563ec6[_0xeffe('0x3f')]=_[_0xeffe('0x40')](_0x563ec6['where'],{'$or':_['map'](_0x563ec6[_0xeffe('0x38')],function(_0x2fb53d){var _0xdf4c29={};_0xdf4c29[_0x2fb53d]={'$like':'%'+_0x1a2b41[_0xeffe('0x33')]['filter']+'%'};return _0xdf4c29;})});}_0x563ec6=_[_0xeffe('0x40')]({},_0x563ec6,_0x1a2b41[_0xeffe('0x42')]);return _0x42feb6[_0xeffe('0x55')](_0x563ec6);}})[_0xeffe('0x29')](function(_0x1ff076){if(_0x1ff076){_0x173050=_0x1ff076['length'];if(!_0x1a2b41[_0xeffe('0x33')][_0xeffe('0x52')](_0xeffe('0x3a'))){_0x563ec6[_0xeffe('0x23')]=qs[_0xeffe('0x23')](_0x1a2b41[_0xeffe('0x33')]['limit']);_0x563ec6[_0xeffe('0x20')]=qs[_0xeffe('0x20')](_0x1a2b41[_0xeffe('0x33')][_0xeffe('0x20')]);}return _0x42feb6[_0xeffe('0x55')](_0x563ec6);}})['then'](function(_0x449341){if(_0x449341){return _0x449341?{'count':_0x173050,'rows':_0x449341}:null;}})[_0xeffe('0x29')](respondWithResult(_0x48e4d4,null))[_0xeffe('0x4b')](handleError(_0x48e4d4,null));};exports['setTags']=function(_0x6f9878,_0x16083c,_0xe75750){if(_0x6f9878[_0xeffe('0x4d')]['id']){delete _0x6f9878[_0xeffe('0x4d')]['id'];}return db[_0xeffe('0x45')][_0xeffe('0x4e')]({'where':{'id':_0x6f9878[_0xeffe('0x49')]['id']}})[_0xeffe('0x29')](handleEntityNotFound(_0x16083c,null))['then'](function(_0x7f9f06){if(_0x7f9f06){return _0x7f9f06[_0xeffe('0x57')](_0x6f9878[_0xeffe('0x4d')][_0xeffe('0x58')]||[]);}return null;})['then'](respondWithResult(_0x16083c,null))[_0xeffe('0x4b')](handleError(_0x16083c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 3771090..a9185de 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 _0xedae=['int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x291fab,_0x40467e){var _0x2e8352=function(_0x1d3be2){while(--_0x1d3be2){_0x291fab['push'](_0x291fab['shift']());}};_0x2e8352(++_0x40467e);}(_0xedae,0x1a3));var _0xeeda=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xedae[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0xeeda('0x0'));var util=require(_0xeeda('0x1'));var logger=require(_0xeeda('0x2'))(_0xeeda('0x3'));var moment=require(_0xeeda('0x4'));var BPromise=require(_0xeeda('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeeda('0x6'));var rimraf=require('rimraf');var config=require(_0xeeda('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xeeda('0x8')]=function(_0x46c58a,_0x57053b){return _0x46c58a[_0xeeda('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0xeeda('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43eb=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5b4928,_0x448a90){var _0x995d86=function(_0x14bafe){while(--_0x14bafe){_0x5b4928['push'](_0x5b4928['shift']());}};_0x995d86(++_0x448a90);}(_0x43eb,0x18b));var _0xb43e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x43eb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb43e('0x0'));var util=require(_0xb43e('0x1'));var logger=require(_0xb43e('0x2'))(_0xb43e('0x3'));var moment=require(_0xb43e('0x4'));var BPromise=require(_0xb43e('0x5'));var rp=require(_0xb43e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb43e('0x7'));var config=require('../../config/environment');var attributes=require(_0xb43e('0x8'));module[_0xb43e('0x9')]=function(_0xc62adc,_0x5d0f17){return _0xc62adc[_0xb43e('0xa')](_0xb43e('0xb'),attributes,{'tableName':_0xb43e('0xc'),'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 fe4a0cf..d6a6a17 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 _0xc84f=['../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','error','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc84f,0xac));var _0xfc84=function(_0x301a2f,_0x1549eb){_0x301a2f=_0x301a2f-0x0;var _0x5f05ca=_0xc84f[_0x301a2f];return _0x5f05ca;};'use strict';var _=require(_0xfc84('0x0'));var util=require('util');var moment=require(_0xfc84('0x1'));var BPromise=require(_0xfc84('0x2'));var rs=require(_0xfc84('0x3'));var fs=require('fs');var Redis=require(_0xfc84('0x4'));var db=require(_0xfc84('0x5'))['db'];var utils=require(_0xfc84('0x6'));var logger=require('../../config/logger')(_0xfc84('0x7'));var config=require(_0xfc84('0x8'));var jayson=require(_0xfc84('0x9'));var client=jayson[_0xfc84('0xa')][_0xfc84('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40b47b,_0x129c3d,_0x57a19a){return new BPromise(function(_0x1102ec,_0x1bf991){return client[_0xfc84('0xc')](_0x40b47b,_0x57a19a)['then'](function(_0x2f0bd1){logger[_0xfc84('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x129c3d,_0xfc84('0xe'));logger[_0xfc84('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x129c3d,_0xfc84('0xe'),JSON['stringify'](_0x2f0bd1));if(_0x2f0bd1[_0xfc84('0x10')]){if(_0x2f0bd1[_0xfc84('0x10')]['code']===0x1f4){logger['error'](_0xfc84('0x11'),_0x129c3d,_0x2f0bd1['error'][_0xfc84('0x12')]);return _0x1bf991(_0x2f0bd1[_0xfc84('0x10')][_0xfc84('0x12')]);}logger[_0xfc84('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x129c3d,_0x2f0bd1[_0xfc84('0x10')][_0xfc84('0x12')]);return _0x1102ec(_0x2f0bd1[_0xfc84('0x10')]['message']);}else{logger['info'](_0xfc84('0x11'),_0x129c3d,_0xfc84('0xe'));_0x1102ec(_0x2f0bd1['result'][_0xfc84('0x12')]);}})[_0xfc84('0x13')](function(_0x5ca013){logger[_0xfc84('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x129c3d,_0x5ca013);_0x1bf991(_0x5ca013);});});} \ No newline at end of file +var _0xff44=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','debug','request\x20sent','stringify','error','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x1614d4,_0x343ad0){var _0x13a293=function(_0x32529e){while(--_0x32529e){_0x1614d4['push'](_0x1614d4['shift']());}};_0x13a293(++_0x343ad0);}(_0xff44,0x76));var _0x4ff4=function(_0x3a23c1,_0x495d49){_0x3a23c1=_0x3a23c1-0x0;var _0x286863=_0xff44[_0x3a23c1];return _0x286863;};'use strict';var _=require(_0x4ff4('0x0'));var util=require(_0x4ff4('0x1'));var moment=require(_0x4ff4('0x2'));var BPromise=require('bluebird');var rs=require(_0x4ff4('0x3'));var fs=require('fs');var Redis=require(_0x4ff4('0x4'));var db=require(_0x4ff4('0x5'))['db'];var utils=require(_0x4ff4('0x6'));var logger=require(_0x4ff4('0x7'))('rpc');var config=require(_0x4ff4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ff4('0x9')][_0x4ff4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdf0fee,_0x3f7465,_0x476d93){return new BPromise(function(_0x1bdd37,_0x2cd0e7){return client['request'](_0xdf0fee,_0x476d93)[_0x4ff4('0xb')](function(_0x19bd88){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f7465,'request\x20sent');logger[_0x4ff4('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3f7465,_0x4ff4('0xd'),JSON[_0x4ff4('0xe')](_0x19bd88));if(_0x19bd88[_0x4ff4('0xf')]){if(_0x19bd88[_0x4ff4('0xf')]['code']===0x1f4){logger[_0x4ff4('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f7465,_0x19bd88['error'][_0x4ff4('0x10')]);return _0x2cd0e7(_0x19bd88[_0x4ff4('0xf')][_0x4ff4('0x10')]);}logger[_0x4ff4('0xf')](_0x4ff4('0x11'),_0x3f7465,_0x19bd88['error'][_0x4ff4('0x10')]);return _0x1bdd37(_0x19bd88[_0x4ff4('0xf')][_0x4ff4('0x10')]);}else{logger['info'](_0x4ff4('0x11'),_0x3f7465,_0x4ff4('0xd'));_0x1bdd37(_0x19bd88[_0x4ff4('0x12')][_0x4ff4('0x10')]);}})[_0x4ff4('0x13')](function(_0xcc67bd){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f7465,_0xcc67bd);_0x2cd0e7(_0xcc67bd);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index d2bbe01..486449b 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 _0xb233=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index'];(function(_0x1308ee,_0x4485d1){var _0x409568=function(_0x438f79){while(--_0x438f79){_0x1308ee['push'](_0x1308ee['shift']());}};_0x409568(++_0x4485d1);}(_0xb233,0x1ee));var _0x3b23=function(_0x49b632,_0x4157bc){_0x49b632=_0x49b632-0x0;var _0x481b93=_0xb233[_0x49b632];return _0x481b93;};'use strict';var multer=require(_0x3b23('0x0'));var util=require(_0x3b23('0x1'));var path=require('path');var timeout=require(_0x3b23('0x2'));var express=require(_0x3b23('0x3'));var router=express[_0x3b23('0x4')]();var fs_extra=require(_0x3b23('0x5'));var auth=require(_0x3b23('0x6'));var interaction=require(_0x3b23('0x7'));var config=require(_0x3b23('0x8'));var controller=require(_0x3b23('0x9'));router[_0x3b23('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b23('0xb')]);router[_0x3b23('0xa')](_0x3b23('0xc'),auth[_0x3b23('0xd')](),controller[_0x3b23('0xe')]);router[_0x3b23('0xf')]('/',auth[_0x3b23('0xd')](),controller[_0x3b23('0x10')]);router[_0x3b23('0x11')](_0x3b23('0xc'),auth[_0x3b23('0xd')](),controller[_0x3b23('0x12')]);router[_0x3b23('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3b23('0x14')]);module[_0x3b23('0x15')]=router; \ No newline at end of file +var _0xa90c=['update','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xa90c,0x15a));var _0xca90=function(_0x2e2089,_0x1c92e2){_0x2e2089=_0x2e2089-0x0;var _0x3b5b91=_0xa90c[_0x2e2089];return _0x3b5b91;};'use strict';var multer=require(_0xca90('0x0'));var util=require(_0xca90('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xca90('0x2'));var router=express['Router']();var fs_extra=require(_0xca90('0x3'));var auth=require(_0xca90('0x4'));var interaction=require(_0xca90('0x5'));var config=require('../../config/environment');var controller=require(_0xca90('0x6'));router['get']('/',auth[_0xca90('0x7')](),controller[_0xca90('0x8')]);router[_0xca90('0x9')](_0xca90('0xa'),auth['isAuthenticated'](),controller[_0xca90('0xb')]);router[_0xca90('0xc')]('/',auth['isAuthenticated'](),controller[_0xca90('0xd')]);router['put'](_0xca90('0xa'),auth[_0xca90('0x7')](),controller[_0xca90('0xe')]);router['delete']('/:id',auth[_0xca90('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 7870f33..f5aef80 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 _0xe8d0=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4ade89,_0x33f831){var _0x5edb02=function(_0x3c9f66){while(--_0x3c9f66){_0x4ade89['push'](_0x4ade89['shift']());}};_0x5edb02(++_0x33f831);}(_0xe8d0,0x19f));var _0x0e8d=function(_0x116bf5,_0x151ac5){_0x116bf5=_0x116bf5-0x0;var _0x3b21c0=_0xe8d0[_0x116bf5];return _0x3b21c0;};'use strict';var Sequelize=require(_0x0e8d('0x0'));module[_0x0e8d('0x1')]={'type':{'type':Sequelize[_0x0e8d('0x2')](_0x0e8d('0x3'),_0x0e8d('0x4'),_0x0e8d('0x5'),_0x0e8d('0x6'),_0x0e8d('0x7')),'defaultValue':_0x0e8d('0x3')},'content':{'type':Sequelize[_0x0e8d('0x8')]},'key':{'type':Sequelize[_0x0e8d('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x0e8d('0x3'),_0x0e8d('0x4'),_0x0e8d('0x5'))},'keyContent':{'type':Sequelize[_0x0e8d('0x8')]},'idField':{'type':Sequelize[_0x0e8d('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0e8d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0e8d('0x8')]}}; \ No newline at end of file +var _0x324e=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x4c5956,_0x577a04){var _0xe3a06d=function(_0x2b73bc){while(--_0x2b73bc){_0x4c5956['push'](_0x4c5956['shift']());}};_0xe3a06d(++_0x577a04);}(_0x324e,0x16d));var _0xe324=function(_0x114314,_0x3822e5){_0x114314=_0x114314-0x0;var _0x2cdd49=_0x324e[_0x114314];return _0x2cdd49;};'use strict';var Sequelize=require(_0xe324('0x0'));module[_0xe324('0x1')]={'type':{'type':Sequelize[_0xe324('0x2')](_0xe324('0x3'),_0xe324('0x4'),_0xe324('0x5'),'keyValue',_0xe324('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xe324('0x4'),_0xe324('0x5'))},'keyContent':{'type':Sequelize[_0xe324('0x7')]},'idField':{'type':Sequelize[_0xe324('0x7')]},'nameField':{'type':Sequelize[_0xe324('0x7')]},'customField':{'type':Sequelize[_0xe324('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe324('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 9f6b47e..f74e7c4 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 _0x8130=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','filters','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes'];(function(_0x2a84d6,_0x538497){var _0x55c2ea=function(_0x3f5d46){while(--_0x3f5d46){_0x2a84d6['push'](_0x2a84d6['shift']());}};_0x55c2ea(++_0x538497);}(_0x8130,0x146));var _0x0813=function(_0x465457,_0x4c5de6){_0x465457=_0x465457-0x0;var _0x3446a1=_0x8130[_0x465457];return _0x3446a1;};'use strict';var emlformat=require(_0x0813('0x0'));var rimraf=require(_0x0813('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0813('0x2'));var rp=require(_0x0813('0x3'));var moment=require(_0x0813('0x4'));var BPromise=require(_0x0813('0x5'));var Mustache=require(_0x0813('0x6'));var util=require(_0x0813('0x7'));var path=require('path');var sox=require(_0x0813('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0813('0x9'));var _=require(_0x0813('0xa'));var squel=require(_0x0813('0xb'));var crypto=require(_0x0813('0xc'));var jsforce=require(_0x0813('0xd'));var deskjs=require(_0x0813('0xe'));var toCsv=require(_0x0813('0xf'));var querystring=require('querystring');var Papa=require(_0x0813('0x10'));var Redis=require(_0x0813('0x11'));var authService=require(_0x0813('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0813('0x13'));var logger=require('../../config/logger')(_0x0813('0x14'));var utils=require('../../config/utils');var config=require(_0x0813('0x15'));var licenseUtil=require(_0x0813('0x16'));var db=require(_0x0813('0x17'))['db'];function respondWithStatusCode(_0x230ec7,_0x5b17f2){_0x5b17f2=_0x5b17f2||0xcc;return function(_0x4dcc3a){if(_0x4dcc3a){return _0x230ec7[_0x0813('0x18')](_0x5b17f2);}return _0x230ec7[_0x0813('0x19')](_0x5b17f2)['end']();};}function respondWithResult(_0x403e40,_0x4dae33){_0x4dae33=_0x4dae33||0xc8;return function(_0x58e56c){if(_0x58e56c){return _0x403e40[_0x0813('0x19')](_0x4dae33)[_0x0813('0x1a')](_0x58e56c);}};}function respondWithFilteredResult(_0x4ffaad,_0x2cf4f1){return function(_0x5793cb){if(_0x5793cb){var _0x29537f=typeof _0x2cf4f1[_0x0813('0x1b')]===_0x0813('0x1c')&&typeof _0x2cf4f1[_0x0813('0x1d')]===_0x0813('0x1c');var _0x10e29a=_0x5793cb[_0x0813('0x1e')];var _0x3e15da=_0x29537f?0x0:_0x2cf4f1['offset'];var _0x3ec7b5=_0x29537f?_0x5793cb['count']:_0x2cf4f1[_0x0813('0x1b')]+_0x2cf4f1[_0x0813('0x1d')];var _0x518923;if(_0x3ec7b5>=_0x10e29a){_0x3ec7b5=_0x10e29a;_0x518923=0xc8;}else{_0x518923=0xce;}_0x4ffaad[_0x0813('0x19')](_0x518923);return _0x4ffaad[_0x0813('0x1f')]('Content-Range',_0x3e15da+'-'+_0x3ec7b5+'/'+_0x10e29a)[_0x0813('0x1a')](_0x5793cb);}return null;};}function patchUpdates(_0x334741){return function(_0x4d7680){try{jsonpatch[_0x0813('0x20')](_0x4d7680,_0x334741,!![]);}catch(_0x3b3662){return BPromise[_0x0813('0x21')](_0x3b3662);}return _0x4d7680[_0x0813('0x22')]();};}function saveUpdates(_0xf6ee0c,_0x5a6cdc){return function(_0x2bb694){if(_0x2bb694){return _0x2bb694[_0x0813('0x23')](_0xf6ee0c)[_0x0813('0x24')](function(_0x598cf2){return _0x598cf2;});}return null;};}function removeEntity(_0x35b3d6,_0x5eabe4){return function(_0x56f4b6){if(_0x56f4b6){return _0x56f4b6[_0x0813('0x25')]()['then'](function(){_0x35b3d6['status'](0xcc)[_0x0813('0x26')]();});}};}function handleEntityNotFound(_0x2366a3,_0x1a8d2a){return function(_0x2f8849){if(!_0x2f8849){_0x2366a3[_0x0813('0x18')](0x194);}return _0x2f8849;};}function handleError(_0x1418c7,_0x42627c){_0x42627c=_0x42627c||0x1f4;return function(_0x3ac129){logger['error'](_0x3ac129[_0x0813('0x27')]);if(_0x3ac129[_0x0813('0x28')]){delete _0x3ac129[_0x0813('0x28')];}_0x1418c7[_0x0813('0x19')](_0x42627c)[_0x0813('0x29')](_0x3ac129);};}exports[_0x0813('0x2a')]=function(_0x55e115,_0xa36d86){var _0x48294b={},_0x54ed64={},_0x54bf5d={'count':0x0,'rows':[]};var _0x3c3321=_[_0x0813('0x2b')](db[_0x0813('0x2c')][_0x0813('0x2d')],function(_0x21f388){return{'name':_0x21f388[_0x0813('0x2e')],'type':_0x21f388['type'][_0x0813('0x2f')]};});_0x54ed64[_0x0813('0x30')]=_['map'](_0x3c3321,'name');_0x54ed64[_0x0813('0x31')]=_[_0x0813('0x32')](_0x55e115[_0x0813('0x31')]);_0x54ed64['filters']=_[_0x0813('0x33')](_0x54ed64[_0x0813('0x30')],_0x54ed64['query']);_0x48294b['attributes']=_[_0x0813('0x33')](_0x54ed64[_0x0813('0x30')],qs[_0x0813('0x34')](_0x55e115[_0x0813('0x31')]['fields']));_0x48294b[_0x0813('0x35')]=_0x48294b[_0x0813('0x35')][_0x0813('0x36')]?_0x48294b[_0x0813('0x35')]:_0x54ed64['model'];if(!_0x55e115['query'][_0x0813('0x37')](_0x0813('0x38'))){_0x48294b[_0x0813('0x1d')]=qs['limit'](_0x55e115[_0x0813('0x31')][_0x0813('0x1d')]);_0x48294b[_0x0813('0x1b')]=qs['offset'](_0x55e115['query'][_0x0813('0x1b')]);}_0x48294b[_0x0813('0x39')]=qs[_0x0813('0x3a')](_0x55e115[_0x0813('0x31')][_0x0813('0x3a')]);_0x48294b[_0x0813('0x3b')]=qs['filters'](_[_0x0813('0x3c')](_0x55e115['query'],_0x54ed64['filters']),_0x3c3321);if(_0x55e115['query'][_0x0813('0x3d')]){_0x48294b[_0x0813('0x3b')]=_['merge'](_0x48294b['where'],{'$or':_[_0x0813('0x2b')](_0x3c3321,function(_0x36ce6d){if(_0x36ce6d[_0x0813('0x3e')]!==_0x0813('0x3f')){var _0x36f4d5={};_0x36f4d5[_0x36ce6d[_0x0813('0x28')]]={'$like':'%'+_0x55e115[_0x0813('0x31')][_0x0813('0x3d')]+'%'};return _0x36f4d5;}})});}_0x48294b=_[_0x0813('0x40')]({},_0x48294b,_0x55e115[_0x0813('0x41')]);var _0x54b271={'where':_0x48294b['where']};return db['FreshdeskField'][_0x0813('0x1e')](_0x54b271)[_0x0813('0x24')](function(_0x5cb01b){_0x54bf5d[_0x0813('0x1e')]=_0x5cb01b;if(_0x55e115[_0x0813('0x31')][_0x0813('0x42')]){_0x48294b['include']=[{'all':!![]}];}return db[_0x0813('0x2c')][_0x0813('0x43')](_0x48294b);})[_0x0813('0x24')](function(_0x4e94b0){_0x54bf5d[_0x0813('0x44')]=_0x4e94b0;return _0x54bf5d;})[_0x0813('0x24')](respondWithFilteredResult(_0xa36d86,_0x48294b))[_0x0813('0x45')](handleError(_0xa36d86,null));};exports['show']=function(_0x22564d,_0x38dc22){var _0x47da3b={'raw':!![],'where':{'id':_0x22564d[_0x0813('0x46')]['id']}},_0x171a5e={};_0x171a5e['model']=_[_0x0813('0x32')](db['FreshdeskField'][_0x0813('0x2d')]);_0x171a5e[_0x0813('0x31')]=_[_0x0813('0x32')](_0x22564d['query']);_0x171a5e[_0x0813('0x47')]=_['intersection'](_0x171a5e[_0x0813('0x30')],_0x171a5e[_0x0813('0x31')]);_0x47da3b[_0x0813('0x35')]=_[_0x0813('0x33')](_0x171a5e[_0x0813('0x30')],qs[_0x0813('0x34')](_0x22564d['query'][_0x0813('0x34')]));_0x47da3b['attributes']=_0x47da3b[_0x0813('0x35')]['length']?_0x47da3b['attributes']:_0x171a5e['model'];if(_0x22564d[_0x0813('0x31')][_0x0813('0x42')]){_0x47da3b[_0x0813('0x48')]=[{'all':!![]}];}_0x47da3b=_[_0x0813('0x40')]({},_0x47da3b,_0x22564d[_0x0813('0x41')]);return db[_0x0813('0x2c')]['find'](_0x47da3b)['then'](handleEntityNotFound(_0x38dc22,null))[_0x0813('0x24')](respondWithResult(_0x38dc22,null))[_0x0813('0x45')](handleError(_0x38dc22,null));};exports[_0x0813('0x49')]=function(_0x3fd5f9,_0xadaead){return db[_0x0813('0x2c')][_0x0813('0x49')](_0x3fd5f9[_0x0813('0x4a')],{})['then'](respondWithResult(_0xadaead,0xc9))[_0x0813('0x45')](handleError(_0xadaead,null));};exports[_0x0813('0x23')]=function(_0x42e4e4,_0x1baf77){if(_0x42e4e4[_0x0813('0x4a')]['id']){delete _0x42e4e4[_0x0813('0x4a')]['id'];}return db['FreshdeskField'][_0x0813('0x4b')]({'where':{'id':_0x42e4e4['params']['id']}})[_0x0813('0x24')](handleEntityNotFound(_0x1baf77,null))[_0x0813('0x24')](saveUpdates(_0x42e4e4[_0x0813('0x4a')],null))[_0x0813('0x24')](respondWithResult(_0x1baf77,null))['catch'](handleError(_0x1baf77,null));};exports[_0x0813('0x25')]=function(_0x3a93eb,_0x353e25){return db[_0x0813('0x2c')]['find']({'where':{'id':_0x3a93eb[_0x0813('0x46')]['id']}})[_0x0813('0x24')](handleEntityNotFound(_0x353e25,null))['then'](removeEntity(_0x353e25,null))['catch'](handleError(_0x353e25,null));}; \ No newline at end of file +var _0x823c=['reject','save','update','destroy','then','end','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','filters','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply'];(function(_0x40bad6,_0x1a5dc8){var _0xdfd3f2=function(_0x20f7ee){while(--_0x20f7ee){_0x40bad6['push'](_0x40bad6['shift']());}};_0xdfd3f2(++_0x1a5dc8);}(_0x823c,0x143));var _0xc823=function(_0x34618a,_0x3e052b){_0x34618a=_0x34618a-0x0;var _0x38ed0d=_0x823c[_0x34618a];return _0x38ed0d;};'use strict';var emlformat=require(_0xc823('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc823('0x1'));var jsonpatch=require(_0xc823('0x2'));var rp=require(_0xc823('0x3'));var moment=require(_0xc823('0x4'));var BPromise=require(_0xc823('0x5'));var Mustache=require(_0xc823('0x6'));var util=require('util');var path=require(_0xc823('0x7'));var sox=require(_0xc823('0x8'));var csv=require(_0xc823('0x9'));var ejs=require(_0xc823('0xa'));var fs=require('fs');var fs_extra=require(_0xc823('0xb'));var _=require('lodash');var squel=require(_0xc823('0xc'));var crypto=require(_0xc823('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc823('0x9'));var querystring=require(_0xc823('0xe'));var Papa=require('papaparse');var Redis=require(_0xc823('0xf'));var authService=require(_0xc823('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc823('0x11'));var logger=require(_0xc823('0x12'))(_0xc823('0x13'));var utils=require(_0xc823('0x14'));var config=require(_0xc823('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc823('0x16'))['db'];function respondWithStatusCode(_0x80372,_0x11c0fd){_0x11c0fd=_0x11c0fd||0xcc;return function(_0x1546b9){if(_0x1546b9){return _0x80372[_0xc823('0x17')](_0x11c0fd);}return _0x80372[_0xc823('0x18')](_0x11c0fd)['end']();};}function respondWithResult(_0x1e4425,_0xff0ec2){_0xff0ec2=_0xff0ec2||0xc8;return function(_0x4daac9){if(_0x4daac9){return _0x1e4425[_0xc823('0x18')](_0xff0ec2)['json'](_0x4daac9);}};}function respondWithFilteredResult(_0x4bc9c9,_0x59749d){return function(_0x5bdfc9){if(_0x5bdfc9){var _0x565aeb=typeof _0x59749d['offset']===_0xc823('0x19')&&typeof _0x59749d[_0xc823('0x1a')]===_0xc823('0x19');var _0x2ff583=_0x5bdfc9[_0xc823('0x1b')];var _0x1aca6d=_0x565aeb?0x0:_0x59749d[_0xc823('0x1c')];var _0x58b7c7=_0x565aeb?_0x5bdfc9[_0xc823('0x1b')]:_0x59749d['offset']+_0x59749d[_0xc823('0x1a')];var _0x3aa68f;if(_0x58b7c7>=_0x2ff583){_0x58b7c7=_0x2ff583;_0x3aa68f=0xc8;}else{_0x3aa68f=0xce;}_0x4bc9c9[_0xc823('0x18')](_0x3aa68f);return _0x4bc9c9['set'](_0xc823('0x1d'),_0x1aca6d+'-'+_0x58b7c7+'/'+_0x2ff583)[_0xc823('0x1e')](_0x5bdfc9);}return null;};}function patchUpdates(_0x3a3fcd){return function(_0x599e59){try{jsonpatch[_0xc823('0x1f')](_0x599e59,_0x3a3fcd,!![]);}catch(_0x325c8a){return BPromise[_0xc823('0x20')](_0x325c8a);}return _0x599e59[_0xc823('0x21')]();};}function saveUpdates(_0x574c76,_0x414c86){return function(_0x5dcb4e){if(_0x5dcb4e){return _0x5dcb4e[_0xc823('0x22')](_0x574c76)['then'](function(_0x510460){return _0x510460;});}return null;};}function removeEntity(_0x3af14f,_0x3cead8){return function(_0x52c941){if(_0x52c941){return _0x52c941[_0xc823('0x23')]()[_0xc823('0x24')](function(){_0x3af14f[_0xc823('0x18')](0xcc)[_0xc823('0x25')]();});}};}function handleEntityNotFound(_0x263865,_0x8d6161){return function(_0x19594e){if(!_0x19594e){_0x263865[_0xc823('0x17')](0x194);}return _0x19594e;};}function handleError(_0x14bd7d,_0x26bb81){_0x26bb81=_0x26bb81||0x1f4;return function(_0x4e4bd4){logger[_0xc823('0x26')](_0x4e4bd4['stack']);if(_0x4e4bd4['name']){delete _0x4e4bd4[_0xc823('0x27')];}_0x14bd7d[_0xc823('0x18')](_0x26bb81)[_0xc823('0x28')](_0x4e4bd4);};}exports[_0xc823('0x29')]=function(_0x20d2b1,_0x182fcf){var _0x1d20c6={},_0xa5a380={},_0x12f061={'count':0x0,'rows':[]};var _0xba0f46=_[_0xc823('0x2a')](db[_0xc823('0x2b')][_0xc823('0x2c')],function(_0xda39a3){return{'name':_0xda39a3[_0xc823('0x2d')],'type':_0xda39a3['type'][_0xc823('0x2e')]};});_0xa5a380[_0xc823('0x2f')]=_[_0xc823('0x2a')](_0xba0f46,_0xc823('0x27'));_0xa5a380[_0xc823('0x30')]=_['keys'](_0x20d2b1['query']);_0xa5a380['filters']=_[_0xc823('0x31')](_0xa5a380[_0xc823('0x2f')],_0xa5a380[_0xc823('0x30')]);_0x1d20c6[_0xc823('0x32')]=_['intersection'](_0xa5a380[_0xc823('0x2f')],qs[_0xc823('0x33')](_0x20d2b1[_0xc823('0x30')][_0xc823('0x33')]));_0x1d20c6[_0xc823('0x32')]=_0x1d20c6[_0xc823('0x32')][_0xc823('0x34')]?_0x1d20c6[_0xc823('0x32')]:_0xa5a380[_0xc823('0x2f')];if(!_0x20d2b1[_0xc823('0x30')][_0xc823('0x35')](_0xc823('0x36'))){_0x1d20c6[_0xc823('0x1a')]=qs['limit'](_0x20d2b1[_0xc823('0x30')][_0xc823('0x1a')]);_0x1d20c6[_0xc823('0x1c')]=qs[_0xc823('0x1c')](_0x20d2b1[_0xc823('0x30')][_0xc823('0x1c')]);}_0x1d20c6['order']=qs[_0xc823('0x37')](_0x20d2b1[_0xc823('0x30')]['sort']);_0x1d20c6[_0xc823('0x38')]=qs['filters'](_[_0xc823('0x39')](_0x20d2b1[_0xc823('0x30')],_0xa5a380['filters']),_0xba0f46);if(_0x20d2b1[_0xc823('0x30')][_0xc823('0x3a')]){_0x1d20c6[_0xc823('0x38')]=_[_0xc823('0x3b')](_0x1d20c6[_0xc823('0x38')],{'$or':_[_0xc823('0x2a')](_0xba0f46,function(_0x1fb5a4){if(_0x1fb5a4['type']!=='VIRTUAL'){var _0x48decd={};_0x48decd[_0x1fb5a4[_0xc823('0x27')]]={'$like':'%'+_0x20d2b1[_0xc823('0x30')][_0xc823('0x3a')]+'%'};return _0x48decd;}})});}_0x1d20c6=_[_0xc823('0x3b')]({},_0x1d20c6,_0x20d2b1[_0xc823('0x3c')]);var _0x5d547f={'where':_0x1d20c6[_0xc823('0x38')]};return db[_0xc823('0x2b')][_0xc823('0x1b')](_0x5d547f)[_0xc823('0x24')](function(_0x5d6e9b){_0x12f061['count']=_0x5d6e9b;if(_0x20d2b1['query'][_0xc823('0x3d')]){_0x1d20c6[_0xc823('0x3e')]=[{'all':!![]}];}return db[_0xc823('0x2b')]['findAll'](_0x1d20c6);})[_0xc823('0x24')](function(_0x4aa160){_0x12f061[_0xc823('0x3f')]=_0x4aa160;return _0x12f061;})[_0xc823('0x24')](respondWithFilteredResult(_0x182fcf,_0x1d20c6))[_0xc823('0x40')](handleError(_0x182fcf,null));};exports[_0xc823('0x41')]=function(_0x337541,_0x26a2f2){var _0x46daca={'raw':!![],'where':{'id':_0x337541[_0xc823('0x42')]['id']}},_0x521e47={};_0x521e47['model']=_[_0xc823('0x43')](db[_0xc823('0x2b')][_0xc823('0x2c')]);_0x521e47[_0xc823('0x30')]=_[_0xc823('0x43')](_0x337541[_0xc823('0x30')]);_0x521e47[_0xc823('0x44')]=_[_0xc823('0x31')](_0x521e47['model'],_0x521e47[_0xc823('0x30')]);_0x46daca[_0xc823('0x32')]=_['intersection'](_0x521e47[_0xc823('0x2f')],qs[_0xc823('0x33')](_0x337541[_0xc823('0x30')][_0xc823('0x33')]));_0x46daca[_0xc823('0x32')]=_0x46daca[_0xc823('0x32')][_0xc823('0x34')]?_0x46daca[_0xc823('0x32')]:_0x521e47[_0xc823('0x2f')];if(_0x337541['query'][_0xc823('0x3d')]){_0x46daca[_0xc823('0x3e')]=[{'all':!![]}];}_0x46daca=_['merge']({},_0x46daca,_0x337541[_0xc823('0x3c')]);return db[_0xc823('0x2b')]['find'](_0x46daca)[_0xc823('0x24')](handleEntityNotFound(_0x26a2f2,null))['then'](respondWithResult(_0x26a2f2,null))[_0xc823('0x40')](handleError(_0x26a2f2,null));};exports[_0xc823('0x45')]=function(_0x57f4c0,_0x5e999d){return db[_0xc823('0x2b')][_0xc823('0x45')](_0x57f4c0[_0xc823('0x46')],{})[_0xc823('0x24')](respondWithResult(_0x5e999d,0xc9))[_0xc823('0x40')](handleError(_0x5e999d,null));};exports[_0xc823('0x22')]=function(_0x190a72,_0x1ae82d){if(_0x190a72['body']['id']){delete _0x190a72[_0xc823('0x46')]['id'];}return db[_0xc823('0x2b')]['find']({'where':{'id':_0x190a72['params']['id']}})[_0xc823('0x24')](handleEntityNotFound(_0x1ae82d,null))['then'](saveUpdates(_0x190a72['body'],null))['then'](respondWithResult(_0x1ae82d,null))['catch'](handleError(_0x1ae82d,null));};exports['destroy']=function(_0x511d71,_0x8f742d){return db['FreshdeskField']['find']({'where':{'id':_0x511d71[_0xc823('0x42')]['id']}})['then'](handleEntityNotFound(_0x8f742d,null))[_0xc823('0x24')](removeEntity(_0x8f742d,null))[_0xc823('0x40')](handleError(_0x8f742d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index e57d99f..9d4e987 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 _0xfd4e=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1bf441,_0x49f64b){var _0x4d7eee=function(_0x5ef734){while(--_0x5ef734){_0x1bf441['push'](_0x1bf441['shift']());}};_0x4d7eee(++_0x49f64b);}(_0xfd4e,0x100));var _0xefd4=function(_0x6d1a44,_0x2fd7ca){_0x6d1a44=_0x6d1a44-0x0;var _0x48a9ab=_0xfd4e[_0x6d1a44];return _0x48a9ab;};'use strict';var _=require(_0xefd4('0x0'));var util=require('util');var logger=require(_0xefd4('0x1'))(_0xefd4('0x2'));var moment=require('moment');var BPromise=require(_0xefd4('0x3'));var rp=require(_0xefd4('0x4'));var fs=require('fs');var path=require(_0xefd4('0x5'));var rimraf=require(_0xefd4('0x6'));var config=require(_0xefd4('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0xefd4('0x8')]=function(_0xe48af4,_0x4f16f3){return _0xe48af4[_0xefd4('0x9')]('FreshdeskField',attributes,{'tableName':_0xefd4('0xa'),'paranoid':![],'indexes':[{'name':_0xefd4('0xb'),'fields':[_0xefd4('0xc'),_0xefd4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x072f=['../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0x072f,0x1a7));var _0xf072=function(_0x2a590f,_0x412e19){_0x2a590f=_0x2a590f-0x0;var _0x4d7e42=_0x072f[_0x2a590f];return _0x4d7e42;};'use strict';var _=require('lodash');var util=require(_0xf072('0x0'));var logger=require(_0xf072('0x1'))(_0xf072('0x2'));var moment=require(_0xf072('0x3'));var BPromise=require(_0xf072('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf072('0x5'));var config=require(_0xf072('0x6'));var attributes=require(_0xf072('0x7'));module['exports']=function(_0x2b278f,_0xe1502d){return _0x2b278f[_0xf072('0x8')](_0xf072('0x9'),attributes,{'tableName':_0xf072('0xa'),'paranoid':![],'indexes':[{'name':_0xf072('0xb'),'fields':[_0xf072('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 04b1f9f..c2ed52e 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 _0x3f39=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','info','result'];(function(_0xdf7f26,_0x5c1fe1){var _0x523573=function(_0x153afc){while(--_0x153afc){_0xdf7f26['push'](_0xdf7f26['shift']());}};_0x523573(++_0x5c1fe1);}(_0x3f39,0x177));var _0x93f3=function(_0x9437ed,_0x1e58aa){_0x9437ed=_0x9437ed-0x0;var _0x2dd88c=_0x3f39[_0x9437ed];return _0x2dd88c;};'use strict';var _=require(_0x93f3('0x0'));var util=require(_0x93f3('0x1'));var moment=require(_0x93f3('0x2'));var BPromise=require('bluebird');var rs=require(_0x93f3('0x3'));var fs=require('fs');var Redis=require(_0x93f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x93f3('0x5'));var logger=require(_0x93f3('0x6'))(_0x93f3('0x7'));var config=require(_0x93f3('0x8'));var jayson=require(_0x93f3('0x9'));var client=jayson[_0x93f3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a24b7,_0x569032,_0x1fdf7c){return new BPromise(function(_0x469ede,_0x4c176a){return client['request'](_0x4a24b7,_0x1fdf7c)[_0x93f3('0xb')](function(_0x1f40de){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x569032,_0x93f3('0xc'));logger['debug'](_0x93f3('0xd'),_0x569032,_0x93f3('0xc'),JSON[_0x93f3('0xe')](_0x1f40de));if(_0x1f40de[_0x93f3('0xf')]){if(_0x1f40de['error'][_0x93f3('0x10')]===0x1f4){logger['error'](_0x93f3('0x11'),_0x569032,_0x1f40de['error'][_0x93f3('0x12')]);return _0x4c176a(_0x1f40de[_0x93f3('0xf')][_0x93f3('0x12')]);}logger[_0x93f3('0xf')](_0x93f3('0x11'),_0x569032,_0x1f40de['error'][_0x93f3('0x12')]);return _0x469ede(_0x1f40de[_0x93f3('0xf')][_0x93f3('0x12')]);}else{logger[_0x93f3('0x13')](_0x93f3('0x11'),_0x569032,_0x93f3('0xc'));_0x469ede(_0x1f40de[_0x93f3('0x14')]['message']);}})[_0x93f3('0x15')](function(_0xb0d6f){logger[_0x93f3('0xf')](_0x93f3('0x11'),_0x569032,_0xb0d6f);_0x4c176a(_0xb0d6f);});});} \ No newline at end of file +var _0x7828=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util'];(function(_0x5ab1d2,_0xcd3fae){var _0x33c329=function(_0x237be3){while(--_0x237be3){_0x5ab1d2['push'](_0x5ab1d2['shift']());}};_0x33c329(++_0xcd3fae);}(_0x7828,0xcf));var _0x8782=function(_0x3bbd82,_0x1997d9){_0x3bbd82=_0x3bbd82-0x0;var _0x47cb2e=_0x7828[_0x3bbd82];return _0x47cb2e;};'use strict';var _=require('lodash');var util=require(_0x8782('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8782('0x1'));var config=require(_0x8782('0x2'));var jayson=require(_0x8782('0x3'));var client=jayson[_0x8782('0x4')][_0x8782('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x27bfcd,_0x203689,_0x5a83f2){return new BPromise(function(_0x3d84c4,_0x321e30){return client[_0x8782('0x6')](_0x27bfcd,_0x5a83f2)[_0x8782('0x7')](function(_0x410dc4){logger[_0x8782('0x8')](_0x8782('0x9'),_0x203689,_0x8782('0xa'));logger['debug'](_0x8782('0xb'),_0x203689,_0x8782('0xa'),JSON['stringify'](_0x410dc4));if(_0x410dc4[_0x8782('0xc')]){if(_0x410dc4[_0x8782('0xc')][_0x8782('0xd')]===0x1f4){logger[_0x8782('0xc')](_0x8782('0x9'),_0x203689,_0x410dc4[_0x8782('0xc')][_0x8782('0xe')]);return _0x321e30(_0x410dc4[_0x8782('0xc')][_0x8782('0xe')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x203689,_0x410dc4['error'][_0x8782('0xe')]);return _0x3d84c4(_0x410dc4['error'][_0x8782('0xe')]);}else{logger[_0x8782('0x8')](_0x8782('0x9'),_0x203689,_0x8782('0xa'));_0x3d84c4(_0x410dc4['result'][_0x8782('0xe')]);}})[_0x8782('0xf')](function(_0x1d8ead){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x203689,_0x1d8ead);_0x321e30(_0x1d8ead);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index f91e7aa..cccb2f5 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 _0xcb91=['addConfiguration','update','delete','/:id','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0xcb91[_0x3a78a0];return _0x48e917;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/:id',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x12')](_0x1cb9('0x13'),auth[_0x1cb9('0x9')](),controller['destroy']);module[_0x1cb9('0x14')]=router; \ No newline at end of file +var _0x1be1=['getFields','post','create','addConfiguration','/:id','delete','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields'];(function(_0xc3d5f8,_0x1fb2a9){var _0x3303c1=function(_0x3c1651){while(--_0x3c1651){_0xc3d5f8['push'](_0xc3d5f8['shift']());}};_0x3303c1(++_0x1fb2a9);}(_0x1be1,0x192));var _0x11be=function(_0x1f9a1b,_0x5bb081){_0x1f9a1b=_0x1f9a1b-0x0;var _0x4c358c=_0x1be1[_0x1f9a1b];return _0x4c358c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/:id',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['getConfigurations']);router[_0x11be('0x7')](_0x11be('0xb'),auth['isAuthenticated'](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/',auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);router['post'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xf')]);router['put'](_0x11be('0x10'),auth[_0x11be('0x8')](),controller['update']);router[_0x11be('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 9747831..5aac448 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 _0xb016=['remoteUri','sequelize','exports','STRING'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0xb016,0x159));var _0x6b01=function(_0x220e55,_0x4dbbd4){_0x220e55=_0x220e55-0x0;var _0x5ca879=_0xb016[_0x220e55];return _0x5ca879;};'use strict';var Sequelize=require(_0x6b01('0x0'));module[_0x6b01('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6b01('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x6b01('0x2')]},'remoteUri':{'type':Sequelize[_0x6b01('0x2')],'unique':_0x6b01('0x3')},'serverUrl':{'type':Sequelize[_0x6b01('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0adf=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x4f9a16,_0x4783fa){_0x4f9a16=_0x4f9a16-0x0;var _0x548f95=_0x0adf[_0x4f9a16];return _0x548f95;};'use strict';var Sequelize=require(_0xf0ad('0x0'));module[_0xf0ad('0x1')]={'name':{'type':Sequelize[_0xf0ad('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf0ad('0x2')],'unique':_0xf0ad('0x3')},'apiKey':{'type':Sequelize[_0xf0ad('0x2')]},'remoteUri':{'type':Sequelize[_0xf0ad('0x2')],'unique':_0xf0ad('0x4')},'serverUrl':{'type':Sequelize[_0xf0ad('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 602c438..35817f5 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 _0xb37c=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','FreshsalesAccount','findAll','rows','catch','show','params','includeAll','include','body','destroy','find','getConfigurations','findOne','FreshsalesConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','create','FreshsalesField','getFields','username','apiKey','remoteUri','slice','GET','format','%s%s','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel'];(function(_0x259082,_0x480570){var _0x1359bd=function(_0x46d7ee){while(--_0x46d7ee){_0x259082['push'](_0x259082['shift']());}};_0x1359bd(++_0x480570);}(_0xb37c,0x178));var _0xcb37=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb37c[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb37('0x0'));var zipdir=require(_0xcb37('0x1'));var jsonpatch=require(_0xcb37('0x2'));var rp=require(_0xcb37('0x3'));var moment=require('moment');var BPromise=require(_0xcb37('0x4'));var Mustache=require(_0xcb37('0x5'));var util=require(_0xcb37('0x6'));var path=require(_0xcb37('0x7'));var sox=require(_0xcb37('0x8'));var csv=require(_0xcb37('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb37('0xa'));var _=require('lodash');var squel=require(_0xcb37('0xb'));var crypto=require('crypto');var jsforce=require(_0xcb37('0xc'));var deskjs=require(_0xcb37('0xd'));var toCsv=require(_0xcb37('0x9'));var querystring=require(_0xcb37('0xe'));var Papa=require('papaparse');var Redis=require(_0xcb37('0xf'));var authService=require(_0xcb37('0x10'));var qs=require(_0xcb37('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb37('0x12'));var logger=require(_0xcb37('0x13'))(_0xcb37('0x14'));var utils=require('../../config/utils');var config=require(_0xcb37('0x15'));var licenseUtil=require(_0xcb37('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xcb37('0x17'));function respondWithStatusCode(_0x18760e,_0x526faa){_0x526faa=_0x526faa||0xcc;return function(_0x33469b){if(_0x33469b){return _0x18760e[_0xcb37('0x18')](_0x526faa);}return _0x18760e[_0xcb37('0x19')](_0x526faa)[_0xcb37('0x1a')]();};}function respondWithResult(_0x241255,_0xe3b142){_0xe3b142=_0xe3b142||0xc8;return function(_0xd715d7){if(_0xd715d7){return _0x241255[_0xcb37('0x19')](_0xe3b142)[_0xcb37('0x1b')](_0xd715d7);}};}function respondWithFilteredResult(_0x592df4,_0x1725e5){return function(_0x5abe96){if(_0x5abe96){var _0x1ed9f2=typeof _0x1725e5[_0xcb37('0x1c')]==='undefined'&&typeof _0x1725e5[_0xcb37('0x1d')]===_0xcb37('0x1e');var _0x6a2e64=_0x5abe96['count'];var _0x4d3d55=_0x1ed9f2?0x0:_0x1725e5[_0xcb37('0x1c')];var _0xe74f89=_0x1ed9f2?_0x5abe96[_0xcb37('0x1f')]:_0x1725e5['offset']+_0x1725e5[_0xcb37('0x1d')];var _0x329a61;if(_0xe74f89>=_0x6a2e64){_0xe74f89=_0x6a2e64;_0x329a61=0xc8;}else{_0x329a61=0xce;}_0x592df4[_0xcb37('0x19')](_0x329a61);return _0x592df4[_0xcb37('0x20')]('Content-Range',_0x4d3d55+'-'+_0xe74f89+'/'+_0x6a2e64)[_0xcb37('0x1b')](_0x5abe96);}return null;};}function patchUpdates(_0x1b6af8){return function(_0x6db7b){try{jsonpatch[_0xcb37('0x21')](_0x6db7b,_0x1b6af8,!![]);}catch(_0x46e1fb){return BPromise[_0xcb37('0x22')](_0x46e1fb);}return _0x6db7b['save']();};}function saveUpdates(_0x2a52a6,_0xf8217a){return function(_0x36a5f7){if(_0x36a5f7){return _0x36a5f7[_0xcb37('0x23')](_0x2a52a6)[_0xcb37('0x24')](function(_0x403611){return _0x403611;});}return null;};}function removeEntity(_0x4adc41,_0xa53eed){return function(_0x26f19e){if(_0x26f19e){return _0x26f19e['destroy']()[_0xcb37('0x24')](function(){_0x4adc41['status'](0xcc)[_0xcb37('0x1a')]();});}};}function handleEntityNotFound(_0x75fc1,_0x3e58dd){return function(_0x4883ed){if(!_0x4883ed){_0x75fc1[_0xcb37('0x18')](0x194);}return _0x4883ed;};}function handleError(_0x347b24,_0x2c38e5){_0x2c38e5=_0x2c38e5||0x1f4;return function(_0x496453){logger[_0xcb37('0x25')](_0x496453[_0xcb37('0x26')]);if(_0x496453[_0xcb37('0x27')]){delete _0x496453[_0xcb37('0x27')];}_0x347b24[_0xcb37('0x19')](_0x2c38e5)[_0xcb37('0x28')](_0x496453);};}exports['index']=function(_0x10ab59,_0x528349){var _0x323515={},_0x110a83={},_0x30c877={'count':0x0,'rows':[]};var _0x54fa04=_[_0xcb37('0x29')](db['FreshsalesAccount'][_0xcb37('0x2a')],function(_0x40c36a){return{'name':_0x40c36a[_0xcb37('0x2b')],'type':_0x40c36a[_0xcb37('0x2c')][_0xcb37('0x2d')]};});_0x110a83[_0xcb37('0x2e')]=_[_0xcb37('0x29')](_0x54fa04,_0xcb37('0x27'));_0x110a83[_0xcb37('0x2f')]=_[_0xcb37('0x30')](_0x10ab59[_0xcb37('0x2f')]);_0x110a83['filters']=_[_0xcb37('0x31')](_0x110a83['model'],_0x110a83['query']);_0x323515[_0xcb37('0x32')]=_['intersection'](_0x110a83[_0xcb37('0x2e')],qs['fields'](_0x10ab59[_0xcb37('0x2f')][_0xcb37('0x33')]));_0x323515[_0xcb37('0x32')]=_0x323515[_0xcb37('0x32')][_0xcb37('0x34')]?_0x323515[_0xcb37('0x32')]:_0x110a83[_0xcb37('0x2e')];if(!_0x10ab59[_0xcb37('0x2f')][_0xcb37('0x35')](_0xcb37('0x36'))){_0x323515[_0xcb37('0x1d')]=qs['limit'](_0x10ab59[_0xcb37('0x2f')]['limit']);_0x323515[_0xcb37('0x1c')]=qs[_0xcb37('0x1c')](_0x10ab59[_0xcb37('0x2f')][_0xcb37('0x1c')]);}_0x323515[_0xcb37('0x37')]=qs['sort'](_0x10ab59[_0xcb37('0x2f')][_0xcb37('0x38')]);_0x323515[_0xcb37('0x39')]=qs[_0xcb37('0x3a')](_[_0xcb37('0x3b')](_0x10ab59['query'],_0x110a83[_0xcb37('0x3a')]),_0x54fa04);if(_0x10ab59['query'][_0xcb37('0x3c')]){_0x323515['where']=_['merge'](_0x323515[_0xcb37('0x39')],{'$or':_[_0xcb37('0x29')](_0x54fa04,function(_0x28e3fd){if(_0x28e3fd['type']!=='VIRTUAL'){var _0x5241b0={};_0x5241b0[_0x28e3fd[_0xcb37('0x27')]]={'$like':'%'+_0x10ab59[_0xcb37('0x2f')][_0xcb37('0x3c')]+'%'};return _0x5241b0;}})});}_0x323515=_[_0xcb37('0x3d')]({},_0x323515,_0x10ab59[_0xcb37('0x3e')]);var _0x1dd6f9={'where':_0x323515[_0xcb37('0x39')]};return db[_0xcb37('0x3f')]['count'](_0x1dd6f9)['then'](function(_0x232d53){_0x30c877[_0xcb37('0x1f')]=_0x232d53;if(_0x10ab59[_0xcb37('0x2f')]['includeAll']){_0x323515['include']=[{'all':!![]}];}return db[_0xcb37('0x3f')][_0xcb37('0x40')](_0x323515);})[_0xcb37('0x24')](function(_0x5054e6){_0x30c877[_0xcb37('0x41')]=_0x5054e6;return _0x30c877;})[_0xcb37('0x24')](respondWithFilteredResult(_0x528349,_0x323515))[_0xcb37('0x42')](handleError(_0x528349,null));};exports[_0xcb37('0x43')]=function(_0x2a7eaa,_0x3125bf){var _0x2fa791={'raw':![],'where':{'id':_0x2a7eaa[_0xcb37('0x44')]['id']}},_0x3c23a8={};_0x3c23a8[_0xcb37('0x2e')]=_[_0xcb37('0x30')](db[_0xcb37('0x3f')][_0xcb37('0x2a')]);_0x3c23a8[_0xcb37('0x2f')]=_[_0xcb37('0x30')](_0x2a7eaa[_0xcb37('0x2f')]);_0x3c23a8[_0xcb37('0x3a')]=_[_0xcb37('0x31')](_0x3c23a8['model'],_0x3c23a8[_0xcb37('0x2f')]);_0x2fa791[_0xcb37('0x32')]=_[_0xcb37('0x31')](_0x3c23a8[_0xcb37('0x2e')],qs[_0xcb37('0x33')](_0x2a7eaa['query']['fields']));_0x2fa791['attributes']=_0x2fa791[_0xcb37('0x32')][_0xcb37('0x34')]?_0x2fa791[_0xcb37('0x32')]:_0x3c23a8[_0xcb37('0x2e')];if(_0x2a7eaa[_0xcb37('0x2f')][_0xcb37('0x45')]){_0x2fa791[_0xcb37('0x46')]=[{'all':!![]}];}_0x2fa791=_[_0xcb37('0x3d')]({},_0x2fa791,_0x2a7eaa[_0xcb37('0x3e')]);return db[_0xcb37('0x3f')]['find'](_0x2fa791)[_0xcb37('0x24')](handleEntityNotFound(_0x3125bf,null))[_0xcb37('0x24')](respondWithResult(_0x3125bf,null))[_0xcb37('0x42')](handleError(_0x3125bf,null));};exports['create']=function(_0x2df3fe,_0x760863){return db['FreshsalesAccount']['create'](_0x2df3fe[_0xcb37('0x47')],{})['then'](respondWithResult(_0x760863,0xc9))[_0xcb37('0x42')](handleError(_0x760863,null));};exports[_0xcb37('0x23')]=function(_0x4d2eaa,_0x2a3466){if(_0x4d2eaa['body']['id']){delete _0x4d2eaa['body']['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x4d2eaa[_0xcb37('0x44')]['id']}})[_0xcb37('0x24')](handleEntityNotFound(_0x2a3466,null))['then'](saveUpdates(_0x4d2eaa['body'],null))[_0xcb37('0x24')](respondWithResult(_0x2a3466,null))[_0xcb37('0x42')](handleError(_0x2a3466,null));};exports[_0xcb37('0x48')]=function(_0x560379,_0x2b2605){return db[_0xcb37('0x3f')][_0xcb37('0x49')]({'where':{'id':_0x560379[_0xcb37('0x44')]['id']}})[_0xcb37('0x24')](handleEntityNotFound(_0x2b2605,null))[_0xcb37('0x24')](removeEntity(_0x2b2605,null))['catch'](handleError(_0x2b2605,null));};exports[_0xcb37('0x4a')]=function(_0x53b64f,_0xb10775,_0x1b1621){var _0x47f5c8={};var _0x20ec93={};var _0x237539;var _0x49b365;return db['FreshsalesAccount'][_0xcb37('0x4b')]({'where':{'id':_0x53b64f[_0xcb37('0x44')]['id']}})[_0xcb37('0x24')](handleEntityNotFound(_0xb10775,null))['then'](function(_0x38b319){if(_0x38b319){_0x237539=_0x38b319;_0x20ec93[_0xcb37('0x2e')]=_[_0xcb37('0x30')](db[_0xcb37('0x4c')][_0xcb37('0x2a')]);_0x20ec93[_0xcb37('0x2f')]=_[_0xcb37('0x30')](_0x53b64f[_0xcb37('0x2f')]);_0x20ec93[_0xcb37('0x3a')]=_[_0xcb37('0x31')](_0x20ec93[_0xcb37('0x2e')],_0x20ec93[_0xcb37('0x2f')]);_0x47f5c8['attributes']=_[_0xcb37('0x31')](_0x20ec93[_0xcb37('0x2e')],qs[_0xcb37('0x33')](_0x53b64f[_0xcb37('0x2f')][_0xcb37('0x33')]));_0x47f5c8[_0xcb37('0x32')]=_0x47f5c8[_0xcb37('0x32')][_0xcb37('0x34')]?_0x47f5c8[_0xcb37('0x32')]:_0x20ec93[_0xcb37('0x2e')];_0x47f5c8[_0xcb37('0x37')]=qs[_0xcb37('0x38')](_0x53b64f['query'][_0xcb37('0x38')]);_0x47f5c8[_0xcb37('0x39')]=qs[_0xcb37('0x3a')](_[_0xcb37('0x3b')](_0x53b64f[_0xcb37('0x2f')],_0x20ec93[_0xcb37('0x3a')]));if(_0x53b64f[_0xcb37('0x2f')][_0xcb37('0x3c')]){_0x47f5c8[_0xcb37('0x39')]=_['merge'](_0x47f5c8[_0xcb37('0x39')],{'$or':_[_0xcb37('0x29')](_0x47f5c8[_0xcb37('0x32')],function(_0x1eefa8){var _0x40ed24={};_0x40ed24[_0x1eefa8]={'$like':'%'+_0x53b64f[_0xcb37('0x2f')][_0xcb37('0x3c')]+'%'};return _0x40ed24;})});}_0x47f5c8=_[_0xcb37('0x3d')]({},_0x47f5c8,_0x53b64f[_0xcb37('0x3e')]);return _0x237539[_0xcb37('0x4a')](_0x47f5c8);}})[_0xcb37('0x24')](function(_0x1192f0){if(_0x1192f0){_0x49b365=_0x1192f0[_0xcb37('0x34')];if(!_0x53b64f[_0xcb37('0x2f')][_0xcb37('0x35')](_0xcb37('0x36'))){_0x47f5c8[_0xcb37('0x1d')]=qs[_0xcb37('0x1d')](_0x53b64f[_0xcb37('0x2f')][_0xcb37('0x1d')]);_0x47f5c8[_0xcb37('0x1c')]=qs[_0xcb37('0x1c')](_0x53b64f['query']['offset']);}return _0x237539[_0xcb37('0x4a')](_0x47f5c8);}})[_0xcb37('0x24')](function(_0x1395e5){if(_0x1395e5){return _0x1395e5?{'count':_0x49b365,'rows':_0x1395e5}:null;}})['then'](respondWithResult(_0xb10775,null))[_0xcb37('0x42')](handleError(_0xb10775,null));};exports['addConfiguration']=function(_0xcddbb9,_0x2f7823,_0x1014d2){if(_0xcddbb9[_0xcb37('0x47')]['id']){delete _0xcddbb9[_0xcb37('0x47')]['id'];}return db[_0xcb37('0x3f')][_0xcb37('0x4b')]({'where':{'id':_0xcddbb9[_0xcb37('0x44')]['id']}})['then'](handleEntityNotFound(_0x2f7823,null))['then'](function(_0x4dbc58){if(_0x4dbc58){_0xcddbb9[_0xcb37('0x47')][_0xcb37('0x4d')]=_0x4dbc58['id'];_0xcddbb9['body'][_0xcb37('0x4e')]=integrations['getSubjects'](_0xcddbb9['body'][_0xcb37('0x4f')],_0xcddbb9[_0xcb37('0x47')][_0xcb37('0x2c')]);_0xcddbb9[_0xcb37('0x47')][_0xcb37('0x50')]=integrations[_0xcb37('0x51')](_0xcddbb9['body'][_0xcb37('0x4f')],_0xcddbb9['body'][_0xcb37('0x2c')]);return db['FreshsalesConfiguration'][_0xcb37('0x52')](_0xcddbb9[_0xcb37('0x47')],{'include':[{'model':db[_0xcb37('0x53')],'as':_0xcb37('0x4e')},{'model':db['FreshsalesField'],'as':_0xcb37('0x50')}]});}return null;})[_0xcb37('0x24')](respondWithResult(_0x2f7823,null))[_0xcb37('0x42')](handleError(_0x2f7823,null));};exports[_0xcb37('0x54')]=function(_0x584c47,_0x1decc5,_0x7e6400){var _0x96e8e8='';var _0x498601='';return db[_0xcb37('0x3f')][_0xcb37('0x4b')]({'where':{'id':_0x584c47['params']['id']},'attributes':['id',_0xcb37('0x55'),'remoteUri',_0xcb37('0x56')]})[_0xcb37('0x24')](handleEntityNotFound(_0x1decc5,null))[_0xcb37('0x24')](function(_0x4bea7a){if(_0x4bea7a){_0x498601=_0x4bea7a[_0xcb37('0x55')];_0x96e8e8=_0x4bea7a[_0xcb37('0x57')];var _0x19b09e=_0x4bea7a[_0xcb37('0x57')][_0xcb37('0x58')](-0x1);if(_0x19b09e==='/'){_0x96e8e8=_0x96e8e8['substring'](0x0,_0x96e8e8['lastIndexOf'](_0x19b09e));}return rp({'method':_0xcb37('0x59'),'uri':util[_0xcb37('0x5a')](_0xcb37('0x5b'),_0x96e8e8,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x4bea7a['apiKey']},'json':!![]});}})['then'](function(_0x5997d1){if(_0x5997d1){var _0xb00af8=_0x5997d1['users'];var _0x27d34f=![];var _0x5a412b=null;for(_0x5a412b=0x0;_0x5a412b<_0xb00af8[_0xcb37('0x34')];_0x5a412b++){if(_0xb00af8[_0x5a412b]['email']===_0x498601){_0x27d34f=!![];}}if(_0x27d34f){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xcb37('0x5c')});}}})['then'](respondWithResult(_0x1decc5,null))['catch'](function(_0x51b583){var _0x50790d=_0x584c47[_0xcb37('0x2f')]['test']?0x1f4:_0x51b583['statusCode']||0x1f4;logger[_0xcb37('0x25')](_0xcb37('0x5d'),_0xcb37('0x54'),_0x50790d,JSON[_0xcb37('0x5e')](_0x51b583));delete _0x51b583[_0xcb37('0x27')];if(_0x50790d===0x191){_0x50790d=0x190;}_0x1decc5[_0xcb37('0x19')](_0x50790d)[_0xcb37('0x28')](_0x584c47[_0xcb37('0x2f')]['test']?{'message':_0xcb37('0x5f'),'statusCode':_0x51b583[_0xcb37('0x60')]}:_0x51b583);});}; \ No newline at end of file +var _0xf321=['include','findAll','catch','show','params','intersection','length','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','apiKey','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','statusCode','send','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll'];(function(_0x1c09ca,_0x5c89f8){var _0x37bf66=function(_0x5ebd34){while(--_0x5ebd34){_0x1c09ca['push'](_0x1c09ca['shift']());}};_0x37bf66(++_0x5c89f8);}(_0xf321,0x1c0));var _0x1f32=function(_0x546237,_0x2da97d){_0x546237=_0x546237-0x0;var _0x42c389=_0xf321[_0x546237];return _0x42c389;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f32('0x0'));var zipdir=require(_0x1f32('0x1'));var jsonpatch=require(_0x1f32('0x2'));var rp=require(_0x1f32('0x3'));var moment=require(_0x1f32('0x4'));var BPromise=require(_0x1f32('0x5'));var Mustache=require(_0x1f32('0x6'));var util=require(_0x1f32('0x7'));var path=require(_0x1f32('0x8'));var sox=require(_0x1f32('0x9'));var csv=require(_0x1f32('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f32('0xb'));var _=require(_0x1f32('0xc'));var squel=require(_0x1f32('0xd'));var crypto=require('crypto');var jsforce=require(_0x1f32('0xe'));var deskjs=require(_0x1f32('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1f32('0x10'));var Redis=require('ioredis');var authService=require(_0x1f32('0x11'));var qs=require(_0x1f32('0x12'));var as=require(_0x1f32('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1f32('0x14'));var config=require(_0x1f32('0x15'));var licenseUtil=require(_0x1f32('0x16'));var db=require(_0x1f32('0x17'))['db'];var integrations=require(_0x1f32('0x18'));function respondWithStatusCode(_0x485c32,_0x5b3321){_0x5b3321=_0x5b3321||0xcc;return function(_0x4b9743){if(_0x4b9743){return _0x485c32[_0x1f32('0x19')](_0x5b3321);}return _0x485c32[_0x1f32('0x1a')](_0x5b3321)[_0x1f32('0x1b')]();};}function respondWithResult(_0x1b2555,_0x3229b1){_0x3229b1=_0x3229b1||0xc8;return function(_0x39a731){if(_0x39a731){return _0x1b2555[_0x1f32('0x1a')](_0x3229b1)[_0x1f32('0x1c')](_0x39a731);}};}function respondWithFilteredResult(_0x473748,_0x51cd62){return function(_0x3672c1){if(_0x3672c1){var _0x579be5=typeof _0x51cd62[_0x1f32('0x1d')]===_0x1f32('0x1e')&&typeof _0x51cd62[_0x1f32('0x1f')]===_0x1f32('0x1e');var _0x5ae8ae=_0x3672c1[_0x1f32('0x20')];var _0x21cbe3=_0x579be5?0x0:_0x51cd62[_0x1f32('0x1d')];var _0x2cd003=_0x579be5?_0x3672c1['count']:_0x51cd62['offset']+_0x51cd62[_0x1f32('0x1f')];var _0xff4081;if(_0x2cd003>=_0x5ae8ae){_0x2cd003=_0x5ae8ae;_0xff4081=0xc8;}else{_0xff4081=0xce;}_0x473748[_0x1f32('0x1a')](_0xff4081);return _0x473748[_0x1f32('0x21')](_0x1f32('0x22'),_0x21cbe3+'-'+_0x2cd003+'/'+_0x5ae8ae)[_0x1f32('0x1c')](_0x3672c1);}return null;};}function patchUpdates(_0x28ac01){return function(_0x258da0){try{jsonpatch[_0x1f32('0x23')](_0x258da0,_0x28ac01,!![]);}catch(_0x90888a){return BPromise[_0x1f32('0x24')](_0x90888a);}return _0x258da0[_0x1f32('0x25')]();};}function saveUpdates(_0x1e0689,_0x590692){return function(_0x174ab2){if(_0x174ab2){return _0x174ab2[_0x1f32('0x26')](_0x1e0689)[_0x1f32('0x27')](function(_0x404355){return _0x404355;});}return null;};}function removeEntity(_0x518e60,_0x127d1d){return function(_0x5f1c22){if(_0x5f1c22){return _0x5f1c22[_0x1f32('0x28')]()[_0x1f32('0x27')](function(){_0x518e60[_0x1f32('0x1a')](0xcc)[_0x1f32('0x1b')]();});}};}function handleEntityNotFound(_0x2d9ea4,_0x2b810a){return function(_0x2e0bda){if(!_0x2e0bda){_0x2d9ea4[_0x1f32('0x19')](0x194);}return _0x2e0bda;};}function handleError(_0x4eb90e,_0x4c2c74){_0x4c2c74=_0x4c2c74||0x1f4;return function(_0x54811f){logger[_0x1f32('0x29')](_0x54811f[_0x1f32('0x2a')]);if(_0x54811f['name']){delete _0x54811f[_0x1f32('0x2b')];}_0x4eb90e[_0x1f32('0x1a')](_0x4c2c74)['send'](_0x54811f);};}exports[_0x1f32('0x2c')]=function(_0x267d58,_0x2eb827){var _0x1d40f8={},_0xd15f42={},_0x1a749b={'count':0x0,'rows':[]};var _0xbef504=_[_0x1f32('0x2d')](db[_0x1f32('0x2e')][_0x1f32('0x2f')],function(_0x4701b1){return{'name':_0x4701b1[_0x1f32('0x30')],'type':_0x4701b1['type']['key']};});_0xd15f42[_0x1f32('0x31')]=_['map'](_0xbef504,_0x1f32('0x2b'));_0xd15f42['query']=_[_0x1f32('0x32')](_0x267d58[_0x1f32('0x33')]);_0xd15f42['filters']=_['intersection'](_0xd15f42[_0x1f32('0x31')],_0xd15f42[_0x1f32('0x33')]);_0x1d40f8[_0x1f32('0x34')]=_['intersection'](_0xd15f42['model'],qs[_0x1f32('0x35')](_0x267d58[_0x1f32('0x33')][_0x1f32('0x35')]));_0x1d40f8[_0x1f32('0x34')]=_0x1d40f8[_0x1f32('0x34')]['length']?_0x1d40f8[_0x1f32('0x34')]:_0xd15f42[_0x1f32('0x31')];if(!_0x267d58[_0x1f32('0x33')][_0x1f32('0x36')](_0x1f32('0x37'))){_0x1d40f8[_0x1f32('0x1f')]=qs['limit'](_0x267d58[_0x1f32('0x33')]['limit']);_0x1d40f8[_0x1f32('0x1d')]=qs['offset'](_0x267d58[_0x1f32('0x33')][_0x1f32('0x1d')]);}_0x1d40f8[_0x1f32('0x38')]=qs[_0x1f32('0x39')](_0x267d58[_0x1f32('0x33')][_0x1f32('0x39')]);_0x1d40f8[_0x1f32('0x3a')]=qs[_0x1f32('0x3b')](_[_0x1f32('0x3c')](_0x267d58['query'],_0xd15f42[_0x1f32('0x3b')]),_0xbef504);if(_0x267d58[_0x1f32('0x33')]['filter']){_0x1d40f8[_0x1f32('0x3a')]=_[_0x1f32('0x3d')](_0x1d40f8[_0x1f32('0x3a')],{'$or':_['map'](_0xbef504,function(_0x4cbd56){if(_0x4cbd56[_0x1f32('0x3e')]!==_0x1f32('0x3f')){var _0x5b02d1={};_0x5b02d1[_0x4cbd56[_0x1f32('0x2b')]]={'$like':'%'+_0x267d58[_0x1f32('0x33')][_0x1f32('0x40')]+'%'};return _0x5b02d1;}})});}_0x1d40f8=_['merge']({},_0x1d40f8,_0x267d58[_0x1f32('0x41')]);var _0x54bcc7={'where':_0x1d40f8[_0x1f32('0x3a')]};return db[_0x1f32('0x2e')][_0x1f32('0x20')](_0x54bcc7)[_0x1f32('0x27')](function(_0x3f5a69){_0x1a749b['count']=_0x3f5a69;if(_0x267d58['query'][_0x1f32('0x42')]){_0x1d40f8[_0x1f32('0x43')]=[{'all':!![]}];}return db[_0x1f32('0x2e')][_0x1f32('0x44')](_0x1d40f8);})[_0x1f32('0x27')](function(_0xaaa3e5){_0x1a749b['rows']=_0xaaa3e5;return _0x1a749b;})[_0x1f32('0x27')](respondWithFilteredResult(_0x2eb827,_0x1d40f8))[_0x1f32('0x45')](handleError(_0x2eb827,null));};exports[_0x1f32('0x46')]=function(_0x4d21af,_0xe3eec7){var _0x2840aa={'raw':![],'where':{'id':_0x4d21af[_0x1f32('0x47')]['id']}},_0x1fdb43={};_0x1fdb43[_0x1f32('0x31')]=_[_0x1f32('0x32')](db[_0x1f32('0x2e')][_0x1f32('0x2f')]);_0x1fdb43[_0x1f32('0x33')]=_[_0x1f32('0x32')](_0x4d21af[_0x1f32('0x33')]);_0x1fdb43[_0x1f32('0x3b')]=_[_0x1f32('0x48')](_0x1fdb43[_0x1f32('0x31')],_0x1fdb43['query']);_0x2840aa[_0x1f32('0x34')]=_[_0x1f32('0x48')](_0x1fdb43['model'],qs[_0x1f32('0x35')](_0x4d21af[_0x1f32('0x33')]['fields']));_0x2840aa[_0x1f32('0x34')]=_0x2840aa[_0x1f32('0x34')][_0x1f32('0x49')]?_0x2840aa[_0x1f32('0x34')]:_0x1fdb43[_0x1f32('0x31')];if(_0x4d21af[_0x1f32('0x33')]['includeAll']){_0x2840aa[_0x1f32('0x43')]=[{'all':!![]}];}_0x2840aa=_[_0x1f32('0x3d')]({},_0x2840aa,_0x4d21af[_0x1f32('0x41')]);return db[_0x1f32('0x2e')]['find'](_0x2840aa)[_0x1f32('0x27')](handleEntityNotFound(_0xe3eec7,null))[_0x1f32('0x27')](respondWithResult(_0xe3eec7,null))[_0x1f32('0x45')](handleError(_0xe3eec7,null));};exports[_0x1f32('0x4a')]=function(_0x51c7b4,_0x4549b0){return db['FreshsalesAccount'][_0x1f32('0x4a')](_0x51c7b4[_0x1f32('0x4b')],{})[_0x1f32('0x27')](respondWithResult(_0x4549b0,0xc9))[_0x1f32('0x45')](handleError(_0x4549b0,null));};exports['update']=function(_0x5d3b56,_0x7bf63b){if(_0x5d3b56[_0x1f32('0x4b')]['id']){delete _0x5d3b56[_0x1f32('0x4b')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x5d3b56[_0x1f32('0x47')]['id']}})[_0x1f32('0x27')](handleEntityNotFound(_0x7bf63b,null))['then'](saveUpdates(_0x5d3b56['body'],null))[_0x1f32('0x27')](respondWithResult(_0x7bf63b,null))[_0x1f32('0x45')](handleError(_0x7bf63b,null));};exports[_0x1f32('0x28')]=function(_0x151450,_0x36325c){return db[_0x1f32('0x2e')][_0x1f32('0x4c')]({'where':{'id':_0x151450[_0x1f32('0x47')]['id']}})[_0x1f32('0x27')](handleEntityNotFound(_0x36325c,null))['then'](removeEntity(_0x36325c,null))['catch'](handleError(_0x36325c,null));};exports[_0x1f32('0x4d')]=function(_0x1ebe29,_0x16af28,_0x126a4c){var _0x2fd4e2={};var _0x3c4ece={};var _0x44965b;var _0x36a507;return db['FreshsalesAccount'][_0x1f32('0x4e')]({'where':{'id':_0x1ebe29[_0x1f32('0x47')]['id']}})[_0x1f32('0x27')](handleEntityNotFound(_0x16af28,null))['then'](function(_0x325c97){if(_0x325c97){_0x44965b=_0x325c97;_0x3c4ece['model']=_['keys'](db[_0x1f32('0x4f')][_0x1f32('0x2f')]);_0x3c4ece[_0x1f32('0x33')]=_['keys'](_0x1ebe29['query']);_0x3c4ece[_0x1f32('0x3b')]=_['intersection'](_0x3c4ece[_0x1f32('0x31')],_0x3c4ece[_0x1f32('0x33')]);_0x2fd4e2[_0x1f32('0x34')]=_[_0x1f32('0x48')](_0x3c4ece[_0x1f32('0x31')],qs['fields'](_0x1ebe29[_0x1f32('0x33')][_0x1f32('0x35')]));_0x2fd4e2[_0x1f32('0x34')]=_0x2fd4e2[_0x1f32('0x34')][_0x1f32('0x49')]?_0x2fd4e2['attributes']:_0x3c4ece['model'];_0x2fd4e2[_0x1f32('0x38')]=qs[_0x1f32('0x39')](_0x1ebe29[_0x1f32('0x33')][_0x1f32('0x39')]);_0x2fd4e2[_0x1f32('0x3a')]=qs[_0x1f32('0x3b')](_[_0x1f32('0x3c')](_0x1ebe29['query'],_0x3c4ece['filters']));if(_0x1ebe29[_0x1f32('0x33')][_0x1f32('0x40')]){_0x2fd4e2[_0x1f32('0x3a')]=_['merge'](_0x2fd4e2[_0x1f32('0x3a')],{'$or':_['map'](_0x2fd4e2['attributes'],function(_0x6a80ba){var _0x1d69b9={};_0x1d69b9[_0x6a80ba]={'$like':'%'+_0x1ebe29[_0x1f32('0x33')][_0x1f32('0x40')]+'%'};return _0x1d69b9;})});}_0x2fd4e2=_[_0x1f32('0x3d')]({},_0x2fd4e2,_0x1ebe29['options']);return _0x44965b[_0x1f32('0x4d')](_0x2fd4e2);}})[_0x1f32('0x27')](function(_0x56cc81){if(_0x56cc81){_0x36a507=_0x56cc81[_0x1f32('0x49')];if(!_0x1ebe29[_0x1f32('0x33')][_0x1f32('0x36')]('nolimit')){_0x2fd4e2[_0x1f32('0x1f')]=qs['limit'](_0x1ebe29['query'][_0x1f32('0x1f')]);_0x2fd4e2[_0x1f32('0x1d')]=qs[_0x1f32('0x1d')](_0x1ebe29[_0x1f32('0x33')][_0x1f32('0x1d')]);}return _0x44965b[_0x1f32('0x4d')](_0x2fd4e2);}})['then'](function(_0x58c1f4){if(_0x58c1f4){return _0x58c1f4?{'count':_0x36a507,'rows':_0x58c1f4}:null;}})['then'](respondWithResult(_0x16af28,null))[_0x1f32('0x45')](handleError(_0x16af28,null));};exports['addConfiguration']=function(_0x31552a,_0x302925,_0x94efe){if(_0x31552a[_0x1f32('0x4b')]['id']){delete _0x31552a[_0x1f32('0x4b')]['id'];}return db[_0x1f32('0x2e')][_0x1f32('0x4e')]({'where':{'id':_0x31552a[_0x1f32('0x47')]['id']}})[_0x1f32('0x27')](handleEntityNotFound(_0x302925,null))[_0x1f32('0x27')](function(_0x44467f){if(_0x44467f){_0x31552a[_0x1f32('0x4b')]['AccountId']=_0x44467f['id'];_0x31552a['body'][_0x1f32('0x50')]=integrations[_0x1f32('0x51')](_0x31552a[_0x1f32('0x4b')][_0x1f32('0x52')],_0x31552a['body'][_0x1f32('0x3e')]);_0x31552a['body'][_0x1f32('0x53')]=integrations['getDescriptions'](_0x31552a[_0x1f32('0x4b')][_0x1f32('0x52')],_0x31552a[_0x1f32('0x4b')][_0x1f32('0x3e')]);return db['FreshsalesConfiguration'][_0x1f32('0x4a')](_0x31552a[_0x1f32('0x4b')],{'include':[{'model':db[_0x1f32('0x54')],'as':_0x1f32('0x50')},{'model':db['FreshsalesField'],'as':_0x1f32('0x53')}]});}return null;})[_0x1f32('0x27')](respondWithResult(_0x302925,null))[_0x1f32('0x45')](handleError(_0x302925,null));};exports[_0x1f32('0x55')]=function(_0x3ee0b5,_0x1d1ebd,_0x833538){var _0xb3b92a='';var _0x3cc8cb='';return db[_0x1f32('0x2e')]['findOne']({'where':{'id':_0x3ee0b5[_0x1f32('0x47')]['id']},'attributes':['id','username','remoteUri',_0x1f32('0x56')]})[_0x1f32('0x27')](handleEntityNotFound(_0x1d1ebd,null))[_0x1f32('0x27')](function(_0x4a6d67){if(_0x4a6d67){_0x3cc8cb=_0x4a6d67[_0x1f32('0x57')];_0xb3b92a=_0x4a6d67[_0x1f32('0x58')];var _0x358b28=_0x4a6d67[_0x1f32('0x58')][_0x1f32('0x59')](-0x1);if(_0x358b28==='/'){_0xb3b92a=_0xb3b92a[_0x1f32('0x5a')](0x0,_0xb3b92a[_0x1f32('0x5b')](_0x358b28));}return rp({'method':_0x1f32('0x5c'),'uri':util[_0x1f32('0x5d')](_0x1f32('0x5e'),_0xb3b92a,_0x1f32('0x5f')),'headers':{'Authorization':'Token\x20token='+_0x4a6d67[_0x1f32('0x56')]},'json':!![]});}})['then'](function(_0x356f3e){if(_0x356f3e){var _0x45f5bb=_0x356f3e[_0x1f32('0x60')];var _0x23c914=![];var _0x16ebfb=null;for(_0x16ebfb=0x0;_0x16ebfb<_0x45f5bb[_0x1f32('0x49')];_0x16ebfb++){if(_0x45f5bb[_0x16ebfb][_0x1f32('0x61')]===_0x3cc8cb){_0x23c914=!![];}}if(_0x23c914){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1f32('0x62')});}}})[_0x1f32('0x27')](respondWithResult(_0x1d1ebd,null))[_0x1f32('0x45')](function(_0x2e3d6c){var _0x481a8a=_0x3ee0b5[_0x1f32('0x33')]['test']?0x1f4:_0x2e3d6c[_0x1f32('0x63')]||0x1f4;logger[_0x1f32('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x1f32('0x55'),_0x481a8a,JSON['stringify'](_0x2e3d6c));delete _0x2e3d6c[_0x1f32('0x2b')];if(_0x481a8a===0x191){_0x481a8a=0x190;}_0x1d1ebd[_0x1f32('0x1a')](_0x481a8a)[_0x1f32('0x64')](_0x3ee0b5[_0x1f32('0x33')][_0x1f32('0x65')]?{'message':_0x1f32('0x66'),'statusCode':_0x2e3d6c[_0x1f32('0x63')]}:_0x2e3d6c);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 4a75541..5df1a50 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 _0x27a0=['int_freshsales_accounts','util','../../config/logger','api','moment','bluebird','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x5b5fe2,_0x48132d){var _0x42a513=function(_0x32d22b){while(--_0x32d22b){_0x5b5fe2['push'](_0x5b5fe2['shift']());}};_0x42a513(++_0x48132d);}(_0x27a0,0xbf));var _0x027a=function(_0x4ee119,_0x4190a5){_0x4ee119=_0x4ee119-0x0;var _0x4fbf89=_0x27a0[_0x4ee119];return _0x4fbf89;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var logger=require(_0x027a('0x1'))(_0x027a('0x2'));var moment=require(_0x027a('0x3'));var BPromise=require(_0x027a('0x4'));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(_0x027a('0x5'));var integrations=require(_0x027a('0x6'));module[_0x027a('0x7')]=function(_0x639bec,_0xe233ed){return _0x639bec[_0x027a('0x8')]('FreshsalesAccount',attributes,{'tableName':_0x027a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25e7=['request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x278a4e,_0x165863){var _0x550108=function(_0xc55e4b){while(--_0xc55e4b){_0x278a4e['push'](_0x278a4e['shift']());}};_0x550108(++_0x165863);}(_0x25e7,0x1d6));var _0x725e=function(_0x2d4eba,_0x348848){_0x2d4eba=_0x2d4eba-0x0;var _0x21141d=_0x25e7[_0x2d4eba];return _0x21141d;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var logger=require(_0x725e('0x2'))(_0x725e('0x3'));var moment=require(_0x725e('0x4'));var BPromise=require(_0x725e('0x5'));var rp=require(_0x725e('0x6'));var fs=require('fs');var path=require(_0x725e('0x7'));var rimraf=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x725e('0xa')]=function(_0x480945,_0x481316){return _0x480945[_0x725e('0xb')](_0x725e('0xc'),attributes,{'tableName':_0x725e('0xd'),'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 41f4f21..f6e6c50 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 _0x7a54=['http','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','then','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x493732,_0x22412a){var _0x57b91a=function(_0x291fe1){while(--_0x291fe1){_0x493732['push'](_0x493732['shift']());}};_0x57b91a(++_0x22412a);}(_0x7a54,0x106));var _0x47a5=function(_0x22384,_0x8ff21b){_0x22384=_0x22384-0x0;var _0x3953f7=_0x7a54[_0x22384];return _0x3953f7;};'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')]('FreshsalesAccount,\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['GetFreshsalesAccount']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'limit':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['limit']||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x5247fd['options'][_0x47a5('0x1b')],function(_0x385687){return{'model':db[_0x385687['model']],'as':_0x385687['as'],'attributes':_0x385687[_0x47a5('0x1a')],'include':_0x385687[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x385687[_0x47a5('0x1b')],function(_0x3abd6a){return{'model':db[_0x3abd6a['model']],'as':_0x3abd6a['as'],'attributes':_0x3abd6a['attributes'],'include':_0x3abd6a[_0x47a5('0x1b')]?_['map'](_0x3abd6a[_0x47a5('0x1b')],function(_0x5b6c4e){return{'model':db[_0x5b6c4e[_0x47a5('0x1d')]],'as':_0x5b6c4e['as'],'attributes':_0x5b6c4e[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x1dac65){logger[_0x47a5('0xb')](_0x47a5('0x1f'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1f'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1dac65));_0xaf70a6(_0x1dac65);})[_0x47a5('0x14')](function(_0x1127f8){logger[_0x47a5('0xf')](_0x47a5('0x1f'),_0x1127f8['message'],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x1127f8['message']));});});};exports[_0x47a5('0x20')]=function(_0x9ac908){var _0x16901f=this;return new Promise(function(_0x4d6b57,_0x256650){return db[_0x47a5('0x15')][_0x47a5('0x21')]({'raw':_0x9ac908[_0x47a5('0x17')]?_0x9ac908['options']['raw']===undefined?!![]:![]:!![],'where':_0x9ac908[_0x47a5('0x17')]?_0x9ac908[_0x47a5('0x17')]['where']||null:null,'attributes':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'include':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')]['include']?_[_0x47a5('0x1c')](_0x9ac908[_0x47a5('0x17')]['include'],function(_0x4843c0){return{'model':db[_0x4843c0[_0x47a5('0x1d')]],'as':_0x4843c0['as'],'attributes':_0x4843c0['attributes'],'include':_0x4843c0[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x4843c0[_0x47a5('0x1b')],function(_0x52749b){return{'model':db[_0x52749b[_0x47a5('0x1d')]],'as':_0x52749b['as'],'attributes':_0x52749b['attributes'],'include':_0x52749b['include']?_[_0x47a5('0x1c')](_0x52749b['include'],function(_0x25cce0){return{'model':db[_0x25cce0['model']],'as':_0x25cce0['as'],'attributes':_0x25cce0[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x38c8d4){logger[_0x47a5('0xb')](_0x47a5('0x20'),_0x9ac908);logger[_0x47a5('0xd')](_0x47a5('0x20'),_0x9ac908,JSON[_0x47a5('0xe')](_0x38c8d4));_0x4d6b57(_0x38c8d4);})[_0x47a5('0x14')](function(_0x4caed5){logger[_0x47a5('0xf')](_0x47a5('0x20'),_0x4caed5['message'],_0x9ac908);_0x256650(_0x16901f[_0x47a5('0xf')](0x1f4,_0x4caed5[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x4745=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','attributes','limit','include','map','model','then','raw','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0x4745,0x1e7));var _0x5474=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x4745[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var moment=require(_0x5474('0x2'));var BPromise=require(_0x5474('0x3'));var rs=require(_0x5474('0x4'));var fs=require('fs');var Redis=require(_0x5474('0x5'));var db=require(_0x5474('0x6'))['db'];var utils=require(_0x5474('0x7'));var logger=require(_0x5474('0x8'))(_0x5474('0x9'));var config=require(_0x5474('0xa'));var jayson=require(_0x5474('0xb'));var client=jayson['client'][_0x5474('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x431f81,_0x57add7,_0x13929f){return new BPromise(function(_0x5d778b,_0x902ba8){return client[_0x5474('0xd')](_0x431f81,_0x13929f)['then'](function(_0xf876f8){logger[_0x5474('0xe')](_0x5474('0xf'),_0x57add7,_0x5474('0x10'));logger[_0x5474('0x11')](_0x5474('0x12'),_0x57add7,_0x5474('0x10'),JSON[_0x5474('0x13')](_0xf876f8));if(_0xf876f8['error']){if(_0xf876f8[_0x5474('0x14')][_0x5474('0x15')]===0x1f4){logger[_0x5474('0x14')](_0x5474('0xf'),_0x57add7,_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);return _0x902ba8(_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);}logger[_0x5474('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0x57add7,_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);return _0x5d778b(_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x57add7,'request\x20sent');_0x5d778b(_0xf876f8['result'][_0x5474('0x16')]);}})[_0x5474('0x17')](function(_0x2da774){logger['error'](_0x5474('0xf'),_0x57add7,_0x2da774);_0x902ba8(_0x2da774);});});}exports[_0x5474('0x18')]=function(_0x56dbfa){var _0x22b37d=this;return new Promise(function(_0x198fc8,_0x18b0fe){return db[_0x5474('0x19')][_0x5474('0x1a')]({'raw':_0x56dbfa['options']?_0x56dbfa[_0x5474('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x56dbfa[_0x5474('0x1b')]?_0x56dbfa[_0x5474('0x1b')]['where']||null:null,'attributes':_0x56dbfa['options']?_0x56dbfa['options'][_0x5474('0x1c')]||null:null,'limit':_0x56dbfa[_0x5474('0x1b')]?_0x56dbfa[_0x5474('0x1b')][_0x5474('0x1d')]||null:null,'include':_0x56dbfa[_0x5474('0x1b')]?_0x56dbfa[_0x5474('0x1b')][_0x5474('0x1e')]?_[_0x5474('0x1f')](_0x56dbfa[_0x5474('0x1b')][_0x5474('0x1e')],function(_0x542d1f){return{'model':db[_0x542d1f['model']],'as':_0x542d1f['as'],'attributes':_0x542d1f[_0x5474('0x1c')],'include':_0x542d1f[_0x5474('0x1e')]?_[_0x5474('0x1f')](_0x542d1f['include'],function(_0x24997a){return{'model':db[_0x24997a['model']],'as':_0x24997a['as'],'attributes':_0x24997a[_0x5474('0x1c')],'include':_0x24997a[_0x5474('0x1e')]?_['map'](_0x24997a[_0x5474('0x1e')],function(_0x5d4cd7){return{'model':db[_0x5d4cd7[_0x5474('0x20')]],'as':_0x5d4cd7['as'],'attributes':_0x5d4cd7['attributes']};}):[]};}):[]};}):[]:[]})[_0x5474('0x21')](function(_0x1384e4){logger[_0x5474('0xe')]('GetFreshsalesAccount',_0x56dbfa);logger[_0x5474('0x11')](_0x5474('0x18'),_0x56dbfa,JSON['stringify'](_0x1384e4));_0x198fc8(_0x1384e4);})['catch'](function(_0x5d2381){logger['error'](_0x5474('0x18'),_0x5d2381[_0x5474('0x16')],_0x56dbfa);_0x18b0fe(_0x22b37d['error'](0x1f4,_0x5d2381[_0x5474('0x16')]));});});};exports['ShowFreshsalesAccount']=function(_0xc1e0ce){var _0x58f27a=this;return new Promise(function(_0x70774f,_0x530cdb){return db[_0x5474('0x19')]['find']({'raw':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce[_0x5474('0x1b')][_0x5474('0x22')]===undefined?!![]:![]:!![],'where':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce['options']['where']||null:null,'attributes':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce[_0x5474('0x1b')][_0x5474('0x1c')]||null:null,'include':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce['options']['include']?_[_0x5474('0x1f')](_0xc1e0ce[_0x5474('0x1b')]['include'],function(_0x3ce359){return{'model':db[_0x3ce359[_0x5474('0x20')]],'as':_0x3ce359['as'],'attributes':_0x3ce359[_0x5474('0x1c')],'include':_0x3ce359[_0x5474('0x1e')]?_['map'](_0x3ce359[_0x5474('0x1e')],function(_0x409111){return{'model':db[_0x409111[_0x5474('0x20')]],'as':_0x409111['as'],'attributes':_0x409111['attributes'],'include':_0x409111[_0x5474('0x1e')]?_[_0x5474('0x1f')](_0x409111[_0x5474('0x1e')],function(_0x2f4589){return{'model':db[_0x2f4589['model']],'as':_0x2f4589['as'],'attributes':_0x2f4589['attributes']};}):[]};}):[]};}):[]:[]})[_0x5474('0x21')](function(_0x3eccef){logger[_0x5474('0xe')](_0x5474('0x23'),_0xc1e0ce);logger['debug'](_0x5474('0x23'),_0xc1e0ce,JSON[_0x5474('0x13')](_0x3eccef));_0x70774f(_0x3eccef);})[_0x5474('0x17')](function(_0x22009e){logger['error']('ShowFreshsalesAccount',_0x22009e['message'],_0xc1e0ce);_0x530cdb(_0x58f27a[_0x5474('0x14')](0x1f4,_0x22009e['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index fec0a0a..7a0040c 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 _0xbe29=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','/:id','destroy','exports','multer','util','path'];(function(_0x5c396c,_0x3b75c3){var _0x514f6c=function(_0x368b1a){while(--_0x368b1a){_0x5c396c['push'](_0x5c396c['shift']());}};_0x514f6c(++_0x3b75c3);}(_0xbe29,0x87));var _0x9be2=function(_0x473ee7,_0x4dd754){_0x473ee7=_0x473ee7-0x0;var _0x30f0d4=_0xbe29[_0x473ee7];return _0x30f0d4;};'use strict';var multer=require(_0x9be2('0x0'));var util=require(_0x9be2('0x1'));var path=require(_0x9be2('0x2'));var timeout=require(_0x9be2('0x3'));var express=require(_0x9be2('0x4'));var router=express[_0x9be2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9be2('0x6'));var interaction=require(_0x9be2('0x7'));var config=require(_0x9be2('0x8'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x9be2('0x9')]('/',auth['isAuthenticated'](),controller[_0x9be2('0xa')]);router[_0x9be2('0x9')]('/:id',auth[_0x9be2('0xb')](),controller['show']);router[_0x9be2('0x9')](_0x9be2('0xc'),auth[_0x9be2('0xb')](),controller[_0x9be2('0xd')]);router[_0x9be2('0x9')](_0x9be2('0xe'),auth[_0x9be2('0xb')](),controller[_0x9be2('0xf')]);router[_0x9be2('0x9')]('/:id/fields',auth[_0x9be2('0xb')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x9be2('0x10')]);router[_0x9be2('0x11')]('/:id',auth[_0x9be2('0xb')](),controller[_0x9be2('0x12')]);router[_0x9be2('0x13')](_0x9be2('0x14'),auth['isAuthenticated'](),controller[_0x9be2('0x15')]);module[_0x9be2('0x16')]=router; \ No newline at end of file +var _0xffbb=['Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','post','create','put','delete','destroy','multer','util','connect-timeout','express'];(function(_0x171a8a,_0x2c6407){var _0x178cbc=function(_0x17cec0){while(--_0x17cec0){_0x171a8a['push'](_0x171a8a['shift']());}};_0x178cbc(++_0x2c6407);}(_0xffbb,0x96));var _0xbffb=function(_0x4faab9,_0x3be36f){_0x4faab9=_0x4faab9-0x0;var _0xf7f17c=_0xffbb[_0x4faab9];return _0xf7f17c;};'use strict';var multer=require(_0xbffb('0x0'));var util=require(_0xbffb('0x1'));var path=require('path');var timeout=require(_0xbffb('0x2'));var express=require(_0xbffb('0x3'));var router=express[_0xbffb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbffb('0x5'));var interaction=require(_0xbffb('0x6'));var config=require('../../config/environment');var controller=require(_0xbffb('0x7'));router[_0xbffb('0x8')]('/',auth[_0xbffb('0x9')](),controller[_0xbffb('0xa')]);router[_0xbffb('0x8')](_0xbffb('0xb'),auth[_0xbffb('0x9')](),controller[_0xbffb('0xc')]);router[_0xbffb('0x8')](_0xbffb('0xd'),auth[_0xbffb('0x9')](),controller[_0xbffb('0xe')]);router[_0xbffb('0x8')]('/:id/descriptions',auth[_0xbffb('0x9')](),controller[_0xbffb('0xf')]);router[_0xbffb('0x8')](_0xbffb('0x10'),auth[_0xbffb('0x9')](),controller['getFields']);router[_0xbffb('0x11')]('/',auth[_0xbffb('0x9')](),controller[_0xbffb('0x12')]);router[_0xbffb('0x13')](_0xbffb('0xb'),auth[_0xbffb('0x9')](),controller['update']);router[_0xbffb('0x14')]('/:id',auth[_0xbffb('0x9')](),controller[_0xbffb('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index b4c11a4..3603829 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 _0x9f91=['sequelize','STRING'];(function(_0x2d33c7,_0x20e736){var _0x3f5a29=function(_0x41f9fb){while(--_0x41f9fb){_0x2d33c7['push'](_0x2d33c7['shift']());}};_0x3f5a29(++_0x20e736);}(_0x9f91,0x94));var _0x19f9=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x9f91[_0x20589d];return _0x422de9;};'use strict';var Sequelize=require(_0x19f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x19f9('0x1')]},'description':{'type':Sequelize[_0x19f9('0x1')]}}; \ No newline at end of file +var _0xc56d=['sequelize','exports','STRING'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0xc56d,0x1da));var _0xdc56=function(_0x92f45f,_0x5b6b02){_0x92f45f=_0x92f45f-0x0;var _0x5cfbe4=_0xc56d[_0x92f45f];return _0x5cfbe4;};'use strict';var Sequelize=require(_0xdc56('0x0'));module[_0xdc56('0x1')]={'name':{'type':Sequelize[_0xdc56('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 9836c0c..7962065 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 _0x0303=['intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','length','find','create','body','destroy','getSubjects','findOne','order','pick','FreshsalesField','getDescriptions','getFields','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','model','keys','query','filters'];(function(_0x374222,_0x198f30){var _0x42f607=function(_0x2ca49d){while(--_0x2ca49d){_0x374222['push'](_0x374222['shift']());}};_0x42f607(++_0x198f30);}(_0x0303,0x19f));var _0x3030=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0x0303[_0x39bc44];return _0x2916d8;};'use strict';var emlformat=require(_0x3030('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3030('0x1'));var rp=require('request-promise');var moment=require(_0x3030('0x2'));var BPromise=require(_0x3030('0x3'));var Mustache=require(_0x3030('0x4'));var util=require(_0x3030('0x5'));var path=require(_0x3030('0x6'));var sox=require('sox');var csv=require(_0x3030('0x7'));var ejs=require(_0x3030('0x8'));var fs=require('fs');var fs_extra=require(_0x3030('0x9'));var _=require(_0x3030('0xa'));var squel=require('squel');var crypto=require(_0x3030('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3030('0xc'));var toCsv=require(_0x3030('0x7'));var querystring=require(_0x3030('0xd'));var Papa=require(_0x3030('0xe'));var Redis=require(_0x3030('0xf'));var authService=require(_0x3030('0x10'));var qs=require(_0x3030('0x11'));var as=require(_0x3030('0x12'));var hardwareService=require(_0x3030('0x13'));var logger=require('../../config/logger')(_0x3030('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3030('0x15'));var db=require(_0x3030('0x16'))['db'];function respondWithStatusCode(_0x23b499,_0x57b72){_0x57b72=_0x57b72||0xcc;return function(_0x2cffc6){if(_0x2cffc6){return _0x23b499[_0x3030('0x17')](_0x57b72);}return _0x23b499['status'](_0x57b72)[_0x3030('0x18')]();};}function respondWithResult(_0xa456a7,_0x3db098){_0x3db098=_0x3db098||0xc8;return function(_0x2441fe){if(_0x2441fe){return _0xa456a7[_0x3030('0x19')](_0x3db098)[_0x3030('0x1a')](_0x2441fe);}};}function respondWithFilteredResult(_0x266c74,_0x57ebd3){return function(_0x265666){if(_0x265666){var _0x575dce=typeof _0x57ebd3[_0x3030('0x1b')]===_0x3030('0x1c')&&typeof _0x57ebd3[_0x3030('0x1d')]===_0x3030('0x1c');var _0xbad227=_0x265666['count'];var _0x258594=_0x575dce?0x0:_0x57ebd3['offset'];var _0xeb02de=_0x575dce?_0x265666[_0x3030('0x1e')]:_0x57ebd3[_0x3030('0x1b')]+_0x57ebd3[_0x3030('0x1d')];var _0x2502a1;if(_0xeb02de>=_0xbad227){_0xeb02de=_0xbad227;_0x2502a1=0xc8;}else{_0x2502a1=0xce;}_0x266c74[_0x3030('0x19')](_0x2502a1);return _0x266c74[_0x3030('0x1f')]('Content-Range',_0x258594+'-'+_0xeb02de+'/'+_0xbad227)['json'](_0x265666);}return null;};}function patchUpdates(_0x5eb691){return function(_0x19649f){try{jsonpatch[_0x3030('0x20')](_0x19649f,_0x5eb691,!![]);}catch(_0x159ddb){return BPromise[_0x3030('0x21')](_0x159ddb);}return _0x19649f[_0x3030('0x22')]();};}function saveUpdates(_0x193467,_0x4b45d9){return function(_0x4462d3){if(_0x4462d3){return _0x4462d3[_0x3030('0x23')](_0x193467)['then'](function(_0x3efb8b){return _0x3efb8b;});}return null;};}function removeEntity(_0x49edee,_0x39cb50){return function(_0x21e4b2){if(_0x21e4b2){return _0x21e4b2['destroy']()['then'](function(){_0x49edee[_0x3030('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a7710,_0x510b21){return function(_0x229caf){if(!_0x229caf){_0x3a7710[_0x3030('0x17')](0x194);}return _0x229caf;};}function handleError(_0x3b5666,_0x588f1c){_0x588f1c=_0x588f1c||0x1f4;return function(_0x5e6f05){logger[_0x3030('0x24')](_0x5e6f05['stack']);if(_0x5e6f05[_0x3030('0x25')]){delete _0x5e6f05[_0x3030('0x25')];}_0x3b5666['status'](_0x588f1c)[_0x3030('0x26')](_0x5e6f05);};}exports[_0x3030('0x27')]=function(_0x3927e9,_0x11c2b5){var _0x575b06={},_0x842f0e={},_0x2d088b={'count':0x0,'rows':[]};var _0x24e7c1=_[_0x3030('0x28')](db[_0x3030('0x29')][_0x3030('0x2a')],function(_0x26be82){return{'name':_0x26be82['fieldName'],'type':_0x26be82['type']['key']};});_0x842f0e[_0x3030('0x2b')]=_[_0x3030('0x28')](_0x24e7c1,_0x3030('0x25'));_0x842f0e['query']=_[_0x3030('0x2c')](_0x3927e9[_0x3030('0x2d')]);_0x842f0e[_0x3030('0x2e')]=_[_0x3030('0x2f')](_0x842f0e[_0x3030('0x2b')],_0x842f0e[_0x3030('0x2d')]);_0x575b06[_0x3030('0x30')]=_[_0x3030('0x2f')](_0x842f0e['model'],qs[_0x3030('0x31')](_0x3927e9[_0x3030('0x2d')][_0x3030('0x31')]));_0x575b06[_0x3030('0x30')]=_0x575b06['attributes']['length']?_0x575b06['attributes']:_0x842f0e[_0x3030('0x2b')];if(!_0x3927e9[_0x3030('0x2d')][_0x3030('0x32')](_0x3030('0x33'))){_0x575b06[_0x3030('0x1d')]=qs['limit'](_0x3927e9[_0x3030('0x2d')][_0x3030('0x1d')]);_0x575b06[_0x3030('0x1b')]=qs[_0x3030('0x1b')](_0x3927e9['query']['offset']);}_0x575b06['order']=qs[_0x3030('0x34')](_0x3927e9[_0x3030('0x2d')][_0x3030('0x34')]);_0x575b06['where']=qs[_0x3030('0x2e')](_['pick'](_0x3927e9[_0x3030('0x2d')],_0x842f0e[_0x3030('0x2e')]),_0x24e7c1);if(_0x3927e9[_0x3030('0x2d')][_0x3030('0x35')]){_0x575b06[_0x3030('0x36')]=_[_0x3030('0x37')](_0x575b06[_0x3030('0x36')],{'$or':_[_0x3030('0x28')](_0x24e7c1,function(_0xd212b3){if(_0xd212b3['type']!==_0x3030('0x38')){var _0x573fad={};_0x573fad[_0xd212b3[_0x3030('0x25')]]={'$like':'%'+_0x3927e9[_0x3030('0x2d')][_0x3030('0x35')]+'%'};return _0x573fad;}})});}_0x575b06=_[_0x3030('0x37')]({},_0x575b06,_0x3927e9[_0x3030('0x39')]);var _0x341cc7={'where':_0x575b06[_0x3030('0x36')]};return db[_0x3030('0x29')][_0x3030('0x1e')](_0x341cc7)[_0x3030('0x3a')](function(_0x50a95c){_0x2d088b[_0x3030('0x1e')]=_0x50a95c;if(_0x3927e9[_0x3030('0x2d')][_0x3030('0x3b')]){_0x575b06[_0x3030('0x3c')]=[{'all':!![]}];}return db[_0x3030('0x29')]['findAll'](_0x575b06);})[_0x3030('0x3a')](function(_0x4b53af){_0x2d088b[_0x3030('0x3d')]=_0x4b53af;return _0x2d088b;})[_0x3030('0x3a')](respondWithFilteredResult(_0x11c2b5,_0x575b06))[_0x3030('0x3e')](handleError(_0x11c2b5,null));};exports[_0x3030('0x3f')]=function(_0x13a39b,_0x5627c8){var _0x2dcad5={'raw':![],'where':{'id':_0x13a39b[_0x3030('0x40')]['id']}},_0x5d9e1d={};_0x5d9e1d[_0x3030('0x2b')]=_['keys'](db[_0x3030('0x29')]['rawAttributes']);_0x5d9e1d[_0x3030('0x2d')]=_[_0x3030('0x2c')](_0x13a39b[_0x3030('0x2d')]);_0x5d9e1d[_0x3030('0x2e')]=_[_0x3030('0x2f')](_0x5d9e1d[_0x3030('0x2b')],_0x5d9e1d[_0x3030('0x2d')]);_0x2dcad5[_0x3030('0x30')]=_[_0x3030('0x2f')](_0x5d9e1d['model'],qs[_0x3030('0x31')](_0x13a39b[_0x3030('0x2d')][_0x3030('0x31')]));_0x2dcad5['attributes']=_0x2dcad5[_0x3030('0x30')][_0x3030('0x41')]?_0x2dcad5[_0x3030('0x30')]:_0x5d9e1d['model'];if(_0x13a39b[_0x3030('0x2d')][_0x3030('0x3b')]){_0x2dcad5['include']=[{'all':!![]}];}_0x2dcad5=_[_0x3030('0x37')]({},_0x2dcad5,_0x13a39b[_0x3030('0x39')]);return db[_0x3030('0x29')][_0x3030('0x42')](_0x2dcad5)[_0x3030('0x3a')](handleEntityNotFound(_0x5627c8,null))['then'](respondWithResult(_0x5627c8,null))[_0x3030('0x3e')](handleError(_0x5627c8,null));};exports[_0x3030('0x43')]=function(_0x595863,_0x440ccb){return db['FreshsalesConfiguration'][_0x3030('0x43')](_0x595863[_0x3030('0x44')],{})[_0x3030('0x3a')](respondWithResult(_0x440ccb,0xc9))[_0x3030('0x3e')](handleError(_0x440ccb,null));};exports[_0x3030('0x23')]=function(_0x2c19d2,_0xe48f28){if(_0x2c19d2[_0x3030('0x44')]['id']){delete _0x2c19d2['body']['id'];}return db[_0x3030('0x29')][_0x3030('0x42')]({'where':{'id':_0x2c19d2[_0x3030('0x40')]['id']}})[_0x3030('0x3a')](handleEntityNotFound(_0xe48f28,null))[_0x3030('0x3a')](saveUpdates(_0x2c19d2[_0x3030('0x44')],null))[_0x3030('0x3a')](respondWithResult(_0xe48f28,null))[_0x3030('0x3e')](handleError(_0xe48f28,null));};exports[_0x3030('0x45')]=function(_0x4f4593,_0x15de23){return db['FreshsalesConfiguration'][_0x3030('0x42')]({'where':{'id':_0x4f4593[_0x3030('0x40')]['id']}})[_0x3030('0x3a')](handleEntityNotFound(_0x15de23,null))[_0x3030('0x3a')](removeEntity(_0x15de23,null))[_0x3030('0x3e')](handleError(_0x15de23,null));};exports[_0x3030('0x46')]=function(_0x43b63c,_0x5061e0,_0x5ccecc){var _0x4fc177={};var _0x27fe36={};var _0x49ecb1;var _0x121aa7;return db['FreshsalesConfiguration'][_0x3030('0x47')]({'where':{'id':_0x43b63c[_0x3030('0x40')]['id']}})['then'](handleEntityNotFound(_0x5061e0,null))[_0x3030('0x3a')](function(_0x2d9a82){if(_0x2d9a82){_0x49ecb1=_0x2d9a82;_0x27fe36['model']=_[_0x3030('0x2c')](db['FreshsalesField'][_0x3030('0x2a')]);_0x27fe36[_0x3030('0x2d')]=_[_0x3030('0x2c')](_0x43b63c[_0x3030('0x2d')]);_0x27fe36[_0x3030('0x2e')]=_['intersection'](_0x27fe36[_0x3030('0x2b')],_0x27fe36[_0x3030('0x2d')]);_0x4fc177[_0x3030('0x30')]=_[_0x3030('0x2f')](_0x27fe36[_0x3030('0x2b')],qs[_0x3030('0x31')](_0x43b63c[_0x3030('0x2d')][_0x3030('0x31')]));_0x4fc177[_0x3030('0x30')]=_0x4fc177['attributes'][_0x3030('0x41')]?_0x4fc177[_0x3030('0x30')]:_0x27fe36[_0x3030('0x2b')];_0x4fc177[_0x3030('0x48')]=qs[_0x3030('0x34')](_0x43b63c[_0x3030('0x2d')][_0x3030('0x34')]);_0x4fc177[_0x3030('0x36')]=qs[_0x3030('0x2e')](_[_0x3030('0x49')](_0x43b63c[_0x3030('0x2d')],_0x27fe36[_0x3030('0x2e')]));if(_0x43b63c[_0x3030('0x2d')]['filter']){_0x4fc177[_0x3030('0x36')]=_['merge'](_0x4fc177['where'],{'$or':_['map'](_0x4fc177['attributes'],function(_0x371cdc){var _0x378b7f={};_0x378b7f[_0x371cdc]={'$like':'%'+_0x43b63c['query'][_0x3030('0x35')]+'%'};return _0x378b7f;})});}_0x4fc177=_[_0x3030('0x37')]({},_0x4fc177,_0x43b63c[_0x3030('0x39')]);return _0x49ecb1['getSubjects'](_0x4fc177);}})[_0x3030('0x3a')](function(_0x231d98){if(_0x231d98){_0x121aa7=_0x231d98['length'];if(!_0x43b63c['query'][_0x3030('0x32')](_0x3030('0x33'))){_0x4fc177[_0x3030('0x1d')]=qs['limit'](_0x43b63c['query'][_0x3030('0x1d')]);_0x4fc177[_0x3030('0x1b')]=qs[_0x3030('0x1b')](_0x43b63c['query'][_0x3030('0x1b')]);}return _0x49ecb1[_0x3030('0x46')](_0x4fc177);}})[_0x3030('0x3a')](function(_0x3eeee3){if(_0x3eeee3){return _0x3eeee3?{'count':_0x121aa7,'rows':_0x3eeee3}:null;}})[_0x3030('0x3a')](respondWithResult(_0x5061e0,null))[_0x3030('0x3e')](handleError(_0x5061e0,null));};exports['getDescriptions']=function(_0x1b5293,_0x3a963f,_0x3eda44){var _0x454eda={};var _0x39ec0b={};var _0x2571c9;var _0x4c0305;return db['FreshsalesConfiguration'][_0x3030('0x47')]({'where':{'id':_0x1b5293[_0x3030('0x40')]['id']}})[_0x3030('0x3a')](handleEntityNotFound(_0x3a963f,null))[_0x3030('0x3a')](function(_0x51972a){if(_0x51972a){_0x2571c9=_0x51972a;_0x39ec0b[_0x3030('0x2b')]=_['keys'](db[_0x3030('0x4a')][_0x3030('0x2a')]);_0x39ec0b[_0x3030('0x2d')]=_[_0x3030('0x2c')](_0x1b5293[_0x3030('0x2d')]);_0x39ec0b[_0x3030('0x2e')]=_[_0x3030('0x2f')](_0x39ec0b[_0x3030('0x2b')],_0x39ec0b[_0x3030('0x2d')]);_0x454eda[_0x3030('0x30')]=_[_0x3030('0x2f')](_0x39ec0b['model'],qs[_0x3030('0x31')](_0x1b5293['query'][_0x3030('0x31')]));_0x454eda[_0x3030('0x30')]=_0x454eda[_0x3030('0x30')]['length']?_0x454eda['attributes']:_0x39ec0b[_0x3030('0x2b')];_0x454eda[_0x3030('0x48')]=qs[_0x3030('0x34')](_0x1b5293[_0x3030('0x2d')][_0x3030('0x34')]);_0x454eda['where']=qs[_0x3030('0x2e')](_[_0x3030('0x49')](_0x1b5293['query'],_0x39ec0b[_0x3030('0x2e')]));if(_0x1b5293[_0x3030('0x2d')][_0x3030('0x35')]){_0x454eda[_0x3030('0x36')]=_['merge'](_0x454eda[_0x3030('0x36')],{'$or':_['map'](_0x454eda[_0x3030('0x30')],function(_0x3d673b){var _0x48abaf={};_0x48abaf[_0x3d673b]={'$like':'%'+_0x1b5293[_0x3030('0x2d')]['filter']+'%'};return _0x48abaf;})});}_0x454eda=_['merge']({},_0x454eda,_0x1b5293[_0x3030('0x39')]);return _0x2571c9['getDescriptions'](_0x454eda);}})['then'](function(_0x38c60d){if(_0x38c60d){_0x4c0305=_0x38c60d[_0x3030('0x41')];if(!_0x1b5293[_0x3030('0x2d')][_0x3030('0x32')](_0x3030('0x33'))){_0x454eda[_0x3030('0x1d')]=qs[_0x3030('0x1d')](_0x1b5293['query'][_0x3030('0x1d')]);_0x454eda[_0x3030('0x1b')]=qs[_0x3030('0x1b')](_0x1b5293[_0x3030('0x2d')][_0x3030('0x1b')]);}return _0x2571c9[_0x3030('0x4b')](_0x454eda);}})[_0x3030('0x3a')](function(_0x404d59){if(_0x404d59){return _0x404d59?{'count':_0x4c0305,'rows':_0x404d59}:null;}})[_0x3030('0x3a')](respondWithResult(_0x3a963f,null))[_0x3030('0x3e')](handleError(_0x3a963f,null));};exports[_0x3030('0x4c')]=function(_0x2f0e71,_0x12dcd2,_0x50d2a1){var _0x354469={};var _0x22e217={};var _0x1e727b;var _0x443097;return db[_0x3030('0x29')]['findOne']({'where':{'id':_0x2f0e71[_0x3030('0x40')]['id']}})[_0x3030('0x3a')](handleEntityNotFound(_0x12dcd2,null))['then'](function(_0x2f5802){if(_0x2f5802){_0x1e727b=_0x2f5802;_0x22e217['model']=_[_0x3030('0x2c')](db['FreshsalesField'][_0x3030('0x2a')]);_0x22e217[_0x3030('0x2d')]=_[_0x3030('0x2c')](_0x2f0e71[_0x3030('0x2d')]);_0x22e217[_0x3030('0x2e')]=_[_0x3030('0x2f')](_0x22e217['model'],_0x22e217[_0x3030('0x2d')]);_0x354469['attributes']=_[_0x3030('0x2f')](_0x22e217[_0x3030('0x2b')],qs['fields'](_0x2f0e71[_0x3030('0x2d')][_0x3030('0x31')]));_0x354469['attributes']=_0x354469[_0x3030('0x30')][_0x3030('0x41')]?_0x354469[_0x3030('0x30')]:_0x22e217['model'];_0x354469[_0x3030('0x48')]=qs[_0x3030('0x34')](_0x2f0e71['query'][_0x3030('0x34')]);_0x354469[_0x3030('0x36')]=qs['filters'](_[_0x3030('0x49')](_0x2f0e71['query'],_0x22e217[_0x3030('0x2e')]));if(_0x2f0e71[_0x3030('0x2d')][_0x3030('0x35')]){_0x354469[_0x3030('0x36')]=_['merge'](_0x354469[_0x3030('0x36')],{'$or':_[_0x3030('0x28')](_0x354469[_0x3030('0x30')],function(_0x412e03){var _0x39ce86={};_0x39ce86[_0x412e03]={'$like':'%'+_0x2f0e71[_0x3030('0x2d')]['filter']+'%'};return _0x39ce86;})});}_0x354469=_[_0x3030('0x37')]({},_0x354469,_0x2f0e71[_0x3030('0x39')]);return _0x1e727b[_0x3030('0x4c')](_0x354469);}})[_0x3030('0x3a')](function(_0x3750a0){if(_0x3750a0){_0x443097=_0x3750a0['length'];if(!_0x2f0e71[_0x3030('0x2d')][_0x3030('0x32')](_0x3030('0x33'))){_0x354469[_0x3030('0x1d')]=qs[_0x3030('0x1d')](_0x2f0e71[_0x3030('0x2d')]['limit']);_0x354469['offset']=qs[_0x3030('0x1b')](_0x2f0e71[_0x3030('0x2d')]['offset']);}return _0x1e727b['getFields'](_0x354469);}})['then'](function(_0x3ab141){if(_0x3ab141){return _0x3ab141?{'count':_0x443097,'rows':_0x3ab141}:null;}})[_0x3030('0x3a')](respondWithResult(_0x12dcd2,null))[_0x3030('0x3e')](handleError(_0x12dcd2,null));}; \ No newline at end of file +var _0xb5a2=['keys','filters','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','map','rawAttributes','type','key','model','query'];(function(_0x260e77,_0xe2e3f7){var _0x3e68f6=function(_0x8f616c){while(--_0x8f616c){_0x260e77['push'](_0x260e77['shift']());}};_0x3e68f6(++_0xe2e3f7);}(_0xb5a2,0x1b0));var _0x2b5a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb5a2[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b5a('0x0'));var zipdir=require(_0x2b5a('0x1'));var jsonpatch=require(_0x2b5a('0x2'));var rp=require(_0x2b5a('0x3'));var moment=require(_0x2b5a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2b5a('0x5'));var util=require(_0x2b5a('0x6'));var path=require('path');var sox=require(_0x2b5a('0x7'));var csv=require(_0x2b5a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b5a('0x9'));var _=require(_0x2b5a('0xa'));var squel=require('squel');var crypto=require(_0x2b5a('0xb'));var jsforce=require(_0x2b5a('0xc'));var deskjs=require(_0x2b5a('0xd'));var toCsv=require(_0x2b5a('0x8'));var querystring=require(_0x2b5a('0xe'));var Papa=require('papaparse');var Redis=require(_0x2b5a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2b5a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b5a('0x11'));var logger=require(_0x2b5a('0x12'))(_0x2b5a('0x13'));var utils=require(_0x2b5a('0x14'));var config=require(_0x2b5a('0x15'));var licenseUtil=require(_0x2b5a('0x16'));var db=require(_0x2b5a('0x17'))['db'];function respondWithStatusCode(_0x1d7e72,_0x552b9d){_0x552b9d=_0x552b9d||0xcc;return function(_0x5c7227){if(_0x5c7227){return _0x1d7e72[_0x2b5a('0x18')](_0x552b9d);}return _0x1d7e72[_0x2b5a('0x19')](_0x552b9d)[_0x2b5a('0x1a')]();};}function respondWithResult(_0x16618d,_0x1ca0b4){_0x1ca0b4=_0x1ca0b4||0xc8;return function(_0x249453){if(_0x249453){return _0x16618d[_0x2b5a('0x19')](_0x1ca0b4)[_0x2b5a('0x1b')](_0x249453);}};}function respondWithFilteredResult(_0x3194f8,_0x26b9f8){return function(_0x2a0d7c){if(_0x2a0d7c){var _0x577f9a=typeof _0x26b9f8[_0x2b5a('0x1c')]===_0x2b5a('0x1d')&&typeof _0x26b9f8[_0x2b5a('0x1e')]===_0x2b5a('0x1d');var _0x3e4c15=_0x2a0d7c[_0x2b5a('0x1f')];var _0x95edcf=_0x577f9a?0x0:_0x26b9f8[_0x2b5a('0x1c')];var _0x1e035c=_0x577f9a?_0x2a0d7c['count']:_0x26b9f8['offset']+_0x26b9f8[_0x2b5a('0x1e')];var _0x324442;if(_0x1e035c>=_0x3e4c15){_0x1e035c=_0x3e4c15;_0x324442=0xc8;}else{_0x324442=0xce;}_0x3194f8[_0x2b5a('0x19')](_0x324442);return _0x3194f8[_0x2b5a('0x20')](_0x2b5a('0x21'),_0x95edcf+'-'+_0x1e035c+'/'+_0x3e4c15)[_0x2b5a('0x1b')](_0x2a0d7c);}return null;};}function patchUpdates(_0x541285){return function(_0x240a62){try{jsonpatch[_0x2b5a('0x22')](_0x240a62,_0x541285,!![]);}catch(_0x8d487d){return BPromise[_0x2b5a('0x23')](_0x8d487d);}return _0x240a62[_0x2b5a('0x24')]();};}function saveUpdates(_0x13a09c,_0x543643){return function(_0x41c39c){if(_0x41c39c){return _0x41c39c[_0x2b5a('0x25')](_0x13a09c)[_0x2b5a('0x26')](function(_0x45a023){return _0x45a023;});}return null;};}function removeEntity(_0x1adab8,_0xcbbd46){return function(_0x3c84a9){if(_0x3c84a9){return _0x3c84a9[_0x2b5a('0x27')]()[_0x2b5a('0x26')](function(){_0x1adab8[_0x2b5a('0x19')](0xcc)[_0x2b5a('0x1a')]();});}};}function handleEntityNotFound(_0x9dd69c,_0x389245){return function(_0x566bd3){if(!_0x566bd3){_0x9dd69c[_0x2b5a('0x18')](0x194);}return _0x566bd3;};}function handleError(_0x5e3176,_0x5a5325){_0x5a5325=_0x5a5325||0x1f4;return function(_0x1c997f){logger['error'](_0x1c997f['stack']);if(_0x1c997f[_0x2b5a('0x28')]){delete _0x1c997f[_0x2b5a('0x28')];}_0x5e3176[_0x2b5a('0x19')](_0x5a5325)[_0x2b5a('0x29')](_0x1c997f);};}exports['index']=function(_0x2f8e1b,_0x2a1f63){var _0x5be7fb={},_0x4184dc={},_0x5ee47e={'count':0x0,'rows':[]};var _0x511e3f=_[_0x2b5a('0x2a')](db['FreshsalesConfiguration'][_0x2b5a('0x2b')],function(_0x1e1e26){return{'name':_0x1e1e26['fieldName'],'type':_0x1e1e26[_0x2b5a('0x2c')][_0x2b5a('0x2d')]};});_0x4184dc[_0x2b5a('0x2e')]=_['map'](_0x511e3f,_0x2b5a('0x28'));_0x4184dc[_0x2b5a('0x2f')]=_[_0x2b5a('0x30')](_0x2f8e1b['query']);_0x4184dc[_0x2b5a('0x31')]=_['intersection'](_0x4184dc[_0x2b5a('0x2e')],_0x4184dc[_0x2b5a('0x2f')]);_0x5be7fb[_0x2b5a('0x32')]=_['intersection'](_0x4184dc[_0x2b5a('0x2e')],qs[_0x2b5a('0x33')](_0x2f8e1b[_0x2b5a('0x2f')][_0x2b5a('0x33')]));_0x5be7fb[_0x2b5a('0x32')]=_0x5be7fb[_0x2b5a('0x32')]['length']?_0x5be7fb['attributes']:_0x4184dc[_0x2b5a('0x2e')];if(!_0x2f8e1b['query']['hasOwnProperty'](_0x2b5a('0x34'))){_0x5be7fb[_0x2b5a('0x1e')]=qs[_0x2b5a('0x1e')](_0x2f8e1b[_0x2b5a('0x2f')][_0x2b5a('0x1e')]);_0x5be7fb[_0x2b5a('0x1c')]=qs[_0x2b5a('0x1c')](_0x2f8e1b['query'][_0x2b5a('0x1c')]);}_0x5be7fb[_0x2b5a('0x35')]=qs['sort'](_0x2f8e1b[_0x2b5a('0x2f')][_0x2b5a('0x36')]);_0x5be7fb['where']=qs[_0x2b5a('0x31')](_[_0x2b5a('0x37')](_0x2f8e1b[_0x2b5a('0x2f')],_0x4184dc[_0x2b5a('0x31')]),_0x511e3f);if(_0x2f8e1b[_0x2b5a('0x2f')][_0x2b5a('0x38')]){_0x5be7fb['where']=_['merge'](_0x5be7fb[_0x2b5a('0x39')],{'$or':_[_0x2b5a('0x2a')](_0x511e3f,function(_0x3192ad){if(_0x3192ad['type']!==_0x2b5a('0x3a')){var _0x2a7e8e={};_0x2a7e8e[_0x3192ad['name']]={'$like':'%'+_0x2f8e1b[_0x2b5a('0x2f')][_0x2b5a('0x38')]+'%'};return _0x2a7e8e;}})});}_0x5be7fb=_[_0x2b5a('0x3b')]({},_0x5be7fb,_0x2f8e1b['options']);var _0x194eda={'where':_0x5be7fb['where']};return db[_0x2b5a('0x3c')][_0x2b5a('0x1f')](_0x194eda)[_0x2b5a('0x26')](function(_0x2dfe08){_0x5ee47e[_0x2b5a('0x1f')]=_0x2dfe08;if(_0x2f8e1b['query'][_0x2b5a('0x3d')]){_0x5be7fb[_0x2b5a('0x3e')]=[{'all':!![]}];}return db[_0x2b5a('0x3c')][_0x2b5a('0x3f')](_0x5be7fb);})['then'](function(_0x36ea2d){_0x5ee47e[_0x2b5a('0x40')]=_0x36ea2d;return _0x5ee47e;})['then'](respondWithFilteredResult(_0x2a1f63,_0x5be7fb))[_0x2b5a('0x41')](handleError(_0x2a1f63,null));};exports[_0x2b5a('0x42')]=function(_0x39e5de,_0x3068a2){var _0xf160a4={'raw':![],'where':{'id':_0x39e5de[_0x2b5a('0x43')]['id']}},_0x43637e={};_0x43637e[_0x2b5a('0x2e')]=_[_0x2b5a('0x30')](db[_0x2b5a('0x3c')][_0x2b5a('0x2b')]);_0x43637e[_0x2b5a('0x2f')]=_[_0x2b5a('0x30')](_0x39e5de[_0x2b5a('0x2f')]);_0x43637e[_0x2b5a('0x31')]=_[_0x2b5a('0x44')](_0x43637e[_0x2b5a('0x2e')],_0x43637e[_0x2b5a('0x2f')]);_0xf160a4[_0x2b5a('0x32')]=_[_0x2b5a('0x44')](_0x43637e[_0x2b5a('0x2e')],qs[_0x2b5a('0x33')](_0x39e5de['query'][_0x2b5a('0x33')]));_0xf160a4[_0x2b5a('0x32')]=_0xf160a4['attributes'][_0x2b5a('0x45')]?_0xf160a4[_0x2b5a('0x32')]:_0x43637e['model'];if(_0x39e5de[_0x2b5a('0x2f')]['includeAll']){_0xf160a4[_0x2b5a('0x3e')]=[{'all':!![]}];}_0xf160a4=_['merge']({},_0xf160a4,_0x39e5de[_0x2b5a('0x46')]);return db[_0x2b5a('0x3c')][_0x2b5a('0x47')](_0xf160a4)[_0x2b5a('0x26')](handleEntityNotFound(_0x3068a2,null))[_0x2b5a('0x26')](respondWithResult(_0x3068a2,null))[_0x2b5a('0x41')](handleError(_0x3068a2,null));};exports[_0x2b5a('0x48')]=function(_0x16841c,_0x4eec21){return db[_0x2b5a('0x3c')][_0x2b5a('0x48')](_0x16841c[_0x2b5a('0x49')],{})[_0x2b5a('0x26')](respondWithResult(_0x4eec21,0xc9))[_0x2b5a('0x41')](handleError(_0x4eec21,null));};exports[_0x2b5a('0x25')]=function(_0x4267d3,_0x826d0e){if(_0x4267d3[_0x2b5a('0x49')]['id']){delete _0x4267d3['body']['id'];}return db[_0x2b5a('0x3c')][_0x2b5a('0x47')]({'where':{'id':_0x4267d3[_0x2b5a('0x43')]['id']}})[_0x2b5a('0x26')](handleEntityNotFound(_0x826d0e,null))[_0x2b5a('0x26')](saveUpdates(_0x4267d3['body'],null))['then'](respondWithResult(_0x826d0e,null))[_0x2b5a('0x41')](handleError(_0x826d0e,null));};exports[_0x2b5a('0x27')]=function(_0x16a1eb,_0x1cd833){return db[_0x2b5a('0x3c')]['find']({'where':{'id':_0x16a1eb[_0x2b5a('0x43')]['id']}})[_0x2b5a('0x26')](handleEntityNotFound(_0x1cd833,null))[_0x2b5a('0x26')](removeEntity(_0x1cd833,null))[_0x2b5a('0x41')](handleError(_0x1cd833,null));};exports[_0x2b5a('0x4a')]=function(_0x5aaf71,_0x270710,_0x2cf97e){var _0x4a42b2={};var _0x1cd59d={};var _0x47601e;var _0x35b3a2;return db['FreshsalesConfiguration'][_0x2b5a('0x4b')]({'where':{'id':_0x5aaf71[_0x2b5a('0x43')]['id']}})['then'](handleEntityNotFound(_0x270710,null))[_0x2b5a('0x26')](function(_0x4caea7){if(_0x4caea7){_0x47601e=_0x4caea7;_0x1cd59d[_0x2b5a('0x2e')]=_[_0x2b5a('0x30')](db[_0x2b5a('0x4c')][_0x2b5a('0x2b')]);_0x1cd59d[_0x2b5a('0x2f')]=_[_0x2b5a('0x30')](_0x5aaf71[_0x2b5a('0x2f')]);_0x1cd59d[_0x2b5a('0x31')]=_[_0x2b5a('0x44')](_0x1cd59d[_0x2b5a('0x2e')],_0x1cd59d[_0x2b5a('0x2f')]);_0x4a42b2[_0x2b5a('0x32')]=_[_0x2b5a('0x44')](_0x1cd59d[_0x2b5a('0x2e')],qs[_0x2b5a('0x33')](_0x5aaf71[_0x2b5a('0x2f')][_0x2b5a('0x33')]));_0x4a42b2[_0x2b5a('0x32')]=_0x4a42b2[_0x2b5a('0x32')][_0x2b5a('0x45')]?_0x4a42b2['attributes']:_0x1cd59d[_0x2b5a('0x2e')];_0x4a42b2[_0x2b5a('0x35')]=qs[_0x2b5a('0x36')](_0x5aaf71[_0x2b5a('0x2f')][_0x2b5a('0x36')]);_0x4a42b2['where']=qs[_0x2b5a('0x31')](_[_0x2b5a('0x37')](_0x5aaf71[_0x2b5a('0x2f')],_0x1cd59d[_0x2b5a('0x31')]));if(_0x5aaf71[_0x2b5a('0x2f')]['filter']){_0x4a42b2[_0x2b5a('0x39')]=_[_0x2b5a('0x3b')](_0x4a42b2[_0x2b5a('0x39')],{'$or':_[_0x2b5a('0x2a')](_0x4a42b2[_0x2b5a('0x32')],function(_0x37ddcd){var _0xab5d51={};_0xab5d51[_0x37ddcd]={'$like':'%'+_0x5aaf71[_0x2b5a('0x2f')][_0x2b5a('0x38')]+'%'};return _0xab5d51;})});}_0x4a42b2=_[_0x2b5a('0x3b')]({},_0x4a42b2,_0x5aaf71[_0x2b5a('0x46')]);return _0x47601e['getSubjects'](_0x4a42b2);}})[_0x2b5a('0x26')](function(_0x449758){if(_0x449758){_0x35b3a2=_0x449758[_0x2b5a('0x45')];if(!_0x5aaf71[_0x2b5a('0x2f')][_0x2b5a('0x4d')](_0x2b5a('0x34'))){_0x4a42b2['limit']=qs[_0x2b5a('0x1e')](_0x5aaf71[_0x2b5a('0x2f')][_0x2b5a('0x1e')]);_0x4a42b2[_0x2b5a('0x1c')]=qs[_0x2b5a('0x1c')](_0x5aaf71['query'][_0x2b5a('0x1c')]);}return _0x47601e['getSubjects'](_0x4a42b2);}})[_0x2b5a('0x26')](function(_0x13bf3a){if(_0x13bf3a){return _0x13bf3a?{'count':_0x35b3a2,'rows':_0x13bf3a}:null;}})[_0x2b5a('0x26')](respondWithResult(_0x270710,null))[_0x2b5a('0x41')](handleError(_0x270710,null));};exports[_0x2b5a('0x4e')]=function(_0x3c8311,_0xb1f598,_0x14d32f){var _0x3579ca={};var _0x1d333c={};var _0x2b591f;var _0x3c1365;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x3c8311['params']['id']}})['then'](handleEntityNotFound(_0xb1f598,null))['then'](function(_0x4a0a89){if(_0x4a0a89){_0x2b591f=_0x4a0a89;_0x1d333c[_0x2b5a('0x2e')]=_[_0x2b5a('0x30')](db[_0x2b5a('0x4c')]['rawAttributes']);_0x1d333c[_0x2b5a('0x2f')]=_[_0x2b5a('0x30')](_0x3c8311[_0x2b5a('0x2f')]);_0x1d333c[_0x2b5a('0x31')]=_[_0x2b5a('0x44')](_0x1d333c['model'],_0x1d333c[_0x2b5a('0x2f')]);_0x3579ca['attributes']=_[_0x2b5a('0x44')](_0x1d333c['model'],qs['fields'](_0x3c8311[_0x2b5a('0x2f')]['fields']));_0x3579ca[_0x2b5a('0x32')]=_0x3579ca['attributes'][_0x2b5a('0x45')]?_0x3579ca[_0x2b5a('0x32')]:_0x1d333c[_0x2b5a('0x2e')];_0x3579ca[_0x2b5a('0x35')]=qs[_0x2b5a('0x36')](_0x3c8311['query'][_0x2b5a('0x36')]);_0x3579ca[_0x2b5a('0x39')]=qs[_0x2b5a('0x31')](_['pick'](_0x3c8311[_0x2b5a('0x2f')],_0x1d333c[_0x2b5a('0x31')]));if(_0x3c8311[_0x2b5a('0x2f')][_0x2b5a('0x38')]){_0x3579ca['where']=_['merge'](_0x3579ca[_0x2b5a('0x39')],{'$or':_['map'](_0x3579ca[_0x2b5a('0x32')],function(_0x3571ed){var _0x1768ba={};_0x1768ba[_0x3571ed]={'$like':'%'+_0x3c8311[_0x2b5a('0x2f')]['filter']+'%'};return _0x1768ba;})});}_0x3579ca=_[_0x2b5a('0x3b')]({},_0x3579ca,_0x3c8311[_0x2b5a('0x46')]);return _0x2b591f[_0x2b5a('0x4e')](_0x3579ca);}})[_0x2b5a('0x26')](function(_0x407330){if(_0x407330){_0x3c1365=_0x407330[_0x2b5a('0x45')];if(!_0x3c8311[_0x2b5a('0x2f')][_0x2b5a('0x4d')]('nolimit')){_0x3579ca[_0x2b5a('0x1e')]=qs[_0x2b5a('0x1e')](_0x3c8311['query'][_0x2b5a('0x1e')]);_0x3579ca[_0x2b5a('0x1c')]=qs['offset'](_0x3c8311[_0x2b5a('0x2f')]['offset']);}return _0x2b591f[_0x2b5a('0x4e')](_0x3579ca);}})[_0x2b5a('0x26')](function(_0x1fce8c){if(_0x1fce8c){return _0x1fce8c?{'count':_0x3c1365,'rows':_0x1fce8c}:null;}})[_0x2b5a('0x26')](respondWithResult(_0xb1f598,null))[_0x2b5a('0x41')](handleError(_0xb1f598,null));};exports[_0x2b5a('0x4f')]=function(_0x3da4cd,_0x696606,_0x300586){var _0x7f06a2={};var _0x1194a3={};var _0x3f22d5;var _0x5a7f61;return db[_0x2b5a('0x3c')][_0x2b5a('0x4b')]({'where':{'id':_0x3da4cd[_0x2b5a('0x43')]['id']}})[_0x2b5a('0x26')](handleEntityNotFound(_0x696606,null))[_0x2b5a('0x26')](function(_0x207f66){if(_0x207f66){_0x3f22d5=_0x207f66;_0x1194a3[_0x2b5a('0x2e')]=_[_0x2b5a('0x30')](db['FreshsalesField'][_0x2b5a('0x2b')]);_0x1194a3[_0x2b5a('0x2f')]=_[_0x2b5a('0x30')](_0x3da4cd['query']);_0x1194a3[_0x2b5a('0x31')]=_[_0x2b5a('0x44')](_0x1194a3[_0x2b5a('0x2e')],_0x1194a3[_0x2b5a('0x2f')]);_0x7f06a2[_0x2b5a('0x32')]=_[_0x2b5a('0x44')](_0x1194a3['model'],qs[_0x2b5a('0x33')](_0x3da4cd[_0x2b5a('0x2f')][_0x2b5a('0x33')]));_0x7f06a2[_0x2b5a('0x32')]=_0x7f06a2[_0x2b5a('0x32')][_0x2b5a('0x45')]?_0x7f06a2[_0x2b5a('0x32')]:_0x1194a3[_0x2b5a('0x2e')];_0x7f06a2[_0x2b5a('0x35')]=qs[_0x2b5a('0x36')](_0x3da4cd[_0x2b5a('0x2f')][_0x2b5a('0x36')]);_0x7f06a2[_0x2b5a('0x39')]=qs[_0x2b5a('0x31')](_['pick'](_0x3da4cd['query'],_0x1194a3[_0x2b5a('0x31')]));if(_0x3da4cd['query'][_0x2b5a('0x38')]){_0x7f06a2[_0x2b5a('0x39')]=_[_0x2b5a('0x3b')](_0x7f06a2[_0x2b5a('0x39')],{'$or':_[_0x2b5a('0x2a')](_0x7f06a2[_0x2b5a('0x32')],function(_0x8bfd27){var _0x556dd8={};_0x556dd8[_0x8bfd27]={'$like':'%'+_0x3da4cd[_0x2b5a('0x2f')][_0x2b5a('0x38')]+'%'};return _0x556dd8;})});}_0x7f06a2=_[_0x2b5a('0x3b')]({},_0x7f06a2,_0x3da4cd[_0x2b5a('0x46')]);return _0x3f22d5['getFields'](_0x7f06a2);}})[_0x2b5a('0x26')](function(_0x21f6a7){if(_0x21f6a7){_0x5a7f61=_0x21f6a7[_0x2b5a('0x45')];if(!_0x3da4cd[_0x2b5a('0x2f')][_0x2b5a('0x4d')](_0x2b5a('0x34'))){_0x7f06a2[_0x2b5a('0x1e')]=qs[_0x2b5a('0x1e')](_0x3da4cd[_0x2b5a('0x2f')][_0x2b5a('0x1e')]);_0x7f06a2[_0x2b5a('0x1c')]=qs[_0x2b5a('0x1c')](_0x3da4cd[_0x2b5a('0x2f')][_0x2b5a('0x1c')]);}return _0x3f22d5[_0x2b5a('0x4f')](_0x7f06a2);}})[_0x2b5a('0x26')](function(_0x72ebf0){if(_0x72ebf0){return _0x72ebf0?{'count':_0x5a7f61,'rows':_0x72ebf0}:null;}})[_0x2b5a('0x26')](respondWithResult(_0x696606,null))[_0x2b5a('0x41')](handleError(_0x696606,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index d060872..be7292b 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 _0x9290=['util','../../config/logger','api','moment','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','lodash'];(function(_0x569f1e,_0x1d19c5){var _0x5c1d69=function(_0x48b47c){while(--_0x48b47c){_0x569f1e['push'](_0x569f1e['shift']());}};_0x5c1d69(++_0x1d19c5);}(_0x9290,0x6b));var _0x0929=function(_0x209603,_0x351b88){_0x209603=_0x209603-0x0;var _0x3e06d4=_0x9290[_0x209603];return _0x3e06d4;};'use strict';var _=require(_0x0929('0x0'));var util=require(_0x0929('0x1'));var logger=require(_0x0929('0x2'))(_0x0929('0x3'));var moment=require(_0x0929('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0929('0x5'));var config=require(_0x0929('0x6'));var attributes=require(_0x0929('0x7'));module['exports']=function(_0x49b075,_0x354aee){return _0x49b075['define'](_0x0929('0x8'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf32f=['path','rimraf','../../config/environment','define','int_freshsales_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1c6d94,_0x56f6c5){var _0x263829=function(_0x356bb2){while(--_0x356bb2){_0x1c6d94['push'](_0x1c6d94['shift']());}};_0x263829(++_0x56f6c5);}(_0xf32f,0x123));var _0xff32=function(_0x1e8f74,_0x497ae9){_0x1e8f74=_0x1e8f74-0x0;var _0x2a9d0f=_0xf32f[_0x1e8f74];return _0x2a9d0f;};'use strict';var _=require(_0xff32('0x0'));var util=require(_0xff32('0x1'));var logger=require(_0xff32('0x2'))(_0xff32('0x3'));var moment=require('moment');var BPromise=require(_0xff32('0x4'));var rp=require(_0xff32('0x5'));var fs=require('fs');var path=require(_0xff32('0x6'));var rimraf=require(_0xff32('0x7'));var config=require(_0xff32('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x4057c3,_0x44baa8){return _0x4057c3[_0xff32('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0xff32('0xa'),'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 9cf82d0..908c25a 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 _0xbefc=['moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x1cd8b8,_0x1a80a2){var _0xabf2b4=function(_0x39b584){while(--_0x39b584){_0x1cd8b8['push'](_0x1cd8b8['shift']());}};_0xabf2b4(++_0x1a80a2);}(_0xbefc,0x7c));var _0xcbef=function(_0x241bf1,_0x4f2b0d){_0x241bf1=_0x241bf1-0x0;var _0x3fd6a1=_0xbefc[_0x241bf1];return _0x3fd6a1;};'use strict';var _=require(_0xcbef('0x0'));var util=require(_0xcbef('0x1'));var moment=require(_0xcbef('0x2'));var BPromise=require(_0xcbef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcbef('0x4'))['db'];var utils=require(_0xcbef('0x5'));var logger=require('../../config/logger')(_0xcbef('0x6'));var config=require(_0xcbef('0x7'));var jayson=require(_0xcbef('0x8'));var client=jayson[_0xcbef('0x9')][_0xcbef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13bf93,_0x8fe683,_0x328fdf){return new BPromise(function(_0x5126e9,_0x316142){return client[_0xcbef('0xb')](_0x13bf93,_0x328fdf)['then'](function(_0x3753d8){logger[_0xcbef('0xc')](_0xcbef('0xd'),_0x8fe683,'request\x20sent');logger['debug'](_0xcbef('0xe'),_0x8fe683,_0xcbef('0xf'),JSON[_0xcbef('0x10')](_0x3753d8));if(_0x3753d8[_0xcbef('0x11')]){if(_0x3753d8['error']['code']===0x1f4){logger[_0xcbef('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x8fe683,_0x3753d8[_0xcbef('0x11')][_0xcbef('0x12')]);return _0x316142(_0x3753d8[_0xcbef('0x11')][_0xcbef('0x12')]);}logger[_0xcbef('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x8fe683,_0x3753d8[_0xcbef('0x11')][_0xcbef('0x12')]);return _0x5126e9(_0x3753d8[_0xcbef('0x11')][_0xcbef('0x12')]);}else{logger[_0xcbef('0xc')](_0xcbef('0xd'),_0x8fe683,_0xcbef('0xf'));_0x5126e9(_0x3753d8[_0xcbef('0x13')]['message']);}})[_0xcbef('0x14')](function(_0x42d03e){logger[_0xcbef('0x11')](_0xcbef('0xd'),_0x8fe683,_0x42d03e);_0x316142(_0x42d03e);});});} \ No newline at end of file +var _0x1f8b=['request\x20sent','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info'];(function(_0x53b93b,_0x1bfab1){var _0x485761=function(_0x41592e){while(--_0x41592e){_0x53b93b['push'](_0x53b93b['shift']());}};_0x485761(++_0x1bfab1);}(_0x1f8b,0x16f));var _0xb1f8=function(_0x47e919,_0x4d1042){_0x47e919=_0x47e919-0x0;var _0x3132b4=_0x1f8b[_0x47e919];return _0x3132b4;};'use strict';var _=require(_0xb1f8('0x0'));var util=require(_0xb1f8('0x1'));var moment=require(_0xb1f8('0x2'));var BPromise=require(_0xb1f8('0x3'));var rs=require(_0xb1f8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1f8('0x5'))['db'];var utils=require(_0xb1f8('0x6'));var logger=require(_0xb1f8('0x7'))(_0xb1f8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb1f8('0x9')][_0xb1f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cde22,_0x570e8c,_0x19ef0b){return new BPromise(function(_0x450c20,_0xa678a7){return client['request'](_0x2cde22,_0x19ef0b)[_0xb1f8('0xb')](function(_0x15bec6){logger[_0xb1f8('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x570e8c,_0xb1f8('0xd'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x570e8c,_0xb1f8('0xd'),JSON['stringify'](_0x15bec6));if(_0x15bec6[_0xb1f8('0xe')]){if(_0x15bec6[_0xb1f8('0xe')][_0xb1f8('0xf')]===0x1f4){logger[_0xb1f8('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x570e8c,_0x15bec6['error'][_0xb1f8('0x10')]);return _0xa678a7(_0x15bec6[_0xb1f8('0xe')][_0xb1f8('0x10')]);}logger[_0xb1f8('0xe')](_0xb1f8('0x11'),_0x570e8c,_0x15bec6['error']['message']);return _0x450c20(_0x15bec6['error'][_0xb1f8('0x10')]);}else{logger['info'](_0xb1f8('0x11'),_0x570e8c,_0xb1f8('0xd'));_0x450c20(_0x15bec6[_0xb1f8('0x12')][_0xb1f8('0x10')]);}})[_0xb1f8('0x13')](function(_0x307243){logger[_0xb1f8('0xe')](_0xb1f8('0x11'),_0x570e8c,_0x307243);_0xa678a7(_0x307243);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 0c61aba..31ad92b 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 _0x2060=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','isAuthenticated','index','/:id','post','create'];(function(_0x7a5efe,_0x27b521){var _0x1da481=function(_0x12edda){while(--_0x12edda){_0x7a5efe['push'](_0x7a5efe['shift']());}};_0x1da481(++_0x27b521);}(_0x2060,0x1be));var _0x0206=function(_0x136235,_0xcdfa4f){_0x136235=_0x136235-0x0;var _0x3b8a09=_0x2060[_0x136235];return _0x3b8a09;};'use strict';var multer=require(_0x0206('0x0'));var util=require('util');var path=require(_0x0206('0x1'));var timeout=require(_0x0206('0x2'));var express=require(_0x0206('0x3'));var router=express[_0x0206('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0206('0x5'));var interaction=require(_0x0206('0x6'));var config=require('../../config/environment');var controller=require(_0x0206('0x7'));router['get']('/',auth[_0x0206('0x8')](),controller[_0x0206('0x9')]);router['get'](_0x0206('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0206('0xb')]('/',auth[_0x0206('0x8')](),controller[_0x0206('0xc')]);router[_0x0206('0xd')](_0x0206('0xa'),auth[_0x0206('0x8')](),controller[_0x0206('0xe')]);router[_0x0206('0xf')](_0x0206('0xa'),auth[_0x0206('0x8')](),controller[_0x0206('0x10')]);module['exports']=router; \ No newline at end of file +var _0xc964=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','put','destroy','multer','util'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc964,0x7e));var _0x4c96=function(_0xeebdce,_0x593f50){_0xeebdce=_0xeebdce-0x0;var _0x1db57e=_0xc964[_0xeebdce];return _0x1db57e;};'use strict';var multer=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var path=require('path');var timeout=require(_0x4c96('0x2'));var express=require(_0x4c96('0x3'));var router=express[_0x4c96('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4c96('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c96('0x6'));var controller=require(_0x4c96('0x7'));router[_0x4c96('0x8')]('/',auth[_0x4c96('0x9')](),controller[_0x4c96('0xa')]);router[_0x4c96('0x8')](_0x4c96('0xb'),auth['isAuthenticated'](),controller[_0x4c96('0xc')]);router[_0x4c96('0xd')]('/',auth[_0x4c96('0x9')](),controller['create']);router[_0x4c96('0xe')](_0x4c96('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4c96('0xb'),auth[_0x4c96('0x9')](),controller[_0x4c96('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index d0fe828..8d0263c 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 _0x5b4e=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x22d159,_0x1a488f){var _0xf6114a=function(_0x284f9c){while(--_0x284f9c){_0x22d159['push'](_0x22d159['shift']());}};_0xf6114a(++_0x1a488f);}(_0x5b4e,0x14d));var _0xe5b4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5b4e[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xe5b4('0x0'));module[_0xe5b4('0x1')]={'type':{'type':Sequelize[_0xe5b4('0x2')](_0xe5b4('0x3'),_0xe5b4('0x4'),'customVariable',_0xe5b4('0x5'),_0xe5b4('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe5b4('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe5b4('0x2')]('string',_0xe5b4('0x4'),_0xe5b4('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe5b4('0x7')]},'nameField':{'type':Sequelize[_0xe5b4('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc433=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x5885fc,_0x3f3b02){var _0x43c6a8=function(_0x56066c){while(--_0x56066c){_0x5885fc['push'](_0x5885fc['shift']());}};_0x43c6a8(++_0x3f3b02);}(_0xc433,0x16a));var _0x3c43=function(_0x433eac,_0x1e51cb){_0x433eac=_0x433eac-0x0;var _0xec3a3c=_0xc433[_0x433eac];return _0xec3a3c;};'use strict';var Sequelize=require(_0x3c43('0x0'));module[_0x3c43('0x1')]={'type':{'type':Sequelize[_0x3c43('0x2')]('string',_0x3c43('0x3'),_0x3c43('0x4'),_0x3c43('0x5'),_0x3c43('0x6')),'defaultValue':_0x3c43('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3c43('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x3c43('0x7'),_0x3c43('0x3'),_0x3c43('0x4'))},'keyContent':{'type':Sequelize[_0x3c43('0x8')]},'idField':{'type':Sequelize[_0x3c43('0x8')]},'nameField':{'type':Sequelize[_0x3c43('0x8')]},'customField':{'type':Sequelize[_0x3c43('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3c43('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index a1676f1..6edc379 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 _0x779f=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','end','name','send','index','map','FreshsalesField','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x779f,0x198));var _0xf779=function(_0x5de6fb,_0x70a379){_0x5de6fb=_0x5de6fb-0x0;var _0x3a1058=_0x779f[_0x5de6fb];return _0x3a1058;};'use strict';var emlformat=require(_0xf779('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf779('0x1'));var jsonpatch=require(_0xf779('0x2'));var rp=require('request-promise');var moment=require(_0xf779('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf779('0x4'));var path=require(_0xf779('0x5'));var sox=require(_0xf779('0x6'));var csv=require(_0xf779('0x7'));var ejs=require(_0xf779('0x8'));var fs=require('fs');var fs_extra=require(_0xf779('0x9'));var _=require(_0xf779('0xa'));var squel=require(_0xf779('0xb'));var crypto=require(_0xf779('0xc'));var jsforce=require(_0xf779('0xd'));var deskjs=require(_0xf779('0xe'));var toCsv=require(_0xf779('0x7'));var querystring=require(_0xf779('0xf'));var Papa=require(_0xf779('0x10'));var Redis=require(_0xf779('0x11'));var authService=require(_0xf779('0x12'));var qs=require(_0xf779('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf779('0x14'));var logger=require(_0xf779('0x15'))(_0xf779('0x16'));var utils=require(_0xf779('0x17'));var config=require(_0xf779('0x18'));var licenseUtil=require(_0xf779('0x19'));var db=require(_0xf779('0x1a'))['db'];function respondWithStatusCode(_0x210571,_0x310f25){_0x310f25=_0x310f25||0xcc;return function(_0x1b02f){if(_0x1b02f){return _0x210571[_0xf779('0x1b')](_0x310f25);}return _0x210571['status'](_0x310f25)['end']();};}function respondWithResult(_0x5680f2,_0x595c51){_0x595c51=_0x595c51||0xc8;return function(_0x39f4cf){if(_0x39f4cf){return _0x5680f2[_0xf779('0x1c')](_0x595c51)[_0xf779('0x1d')](_0x39f4cf);}};}function respondWithFilteredResult(_0x195f17,_0x241885){return function(_0xeb179b){if(_0xeb179b){var _0x363421=typeof _0x241885[_0xf779('0x1e')]===_0xf779('0x1f')&&typeof _0x241885[_0xf779('0x20')]===_0xf779('0x1f');var _0x2a5ccc=_0xeb179b[_0xf779('0x21')];var _0x37aee6=_0x363421?0x0:_0x241885[_0xf779('0x1e')];var _0xd6051b=_0x363421?_0xeb179b[_0xf779('0x21')]:_0x241885[_0xf779('0x1e')]+_0x241885[_0xf779('0x20')];var _0xc3708b;if(_0xd6051b>=_0x2a5ccc){_0xd6051b=_0x2a5ccc;_0xc3708b=0xc8;}else{_0xc3708b=0xce;}_0x195f17[_0xf779('0x1c')](_0xc3708b);return _0x195f17['set'](_0xf779('0x22'),_0x37aee6+'-'+_0xd6051b+'/'+_0x2a5ccc)['json'](_0xeb179b);}return null;};}function patchUpdates(_0x478d90){return function(_0x1fdb5c){try{jsonpatch['apply'](_0x1fdb5c,_0x478d90,!![]);}catch(_0x5de8ad){return BPromise['reject'](_0x5de8ad);}return _0x1fdb5c[_0xf779('0x23')]();};}function saveUpdates(_0x36f394,_0x3ef426){return function(_0x33166f){if(_0x33166f){return _0x33166f[_0xf779('0x24')](_0x36f394)[_0xf779('0x25')](function(_0x22911c){return _0x22911c;});}return null;};}function removeEntity(_0x3e56c4,_0x1ff6a1){return function(_0x355d3c){if(_0x355d3c){return _0x355d3c['destroy']()[_0xf779('0x25')](function(){_0x3e56c4['status'](0xcc)[_0xf779('0x26')]();});}};}function handleEntityNotFound(_0x176d60,_0x59870a){return function(_0x3c17f7){if(!_0x3c17f7){_0x176d60[_0xf779('0x1b')](0x194);}return _0x3c17f7;};}function handleError(_0x51a5ad,_0x52e8dd){_0x52e8dd=_0x52e8dd||0x1f4;return function(_0x232873){logger['error'](_0x232873['stack']);if(_0x232873[_0xf779('0x27')]){delete _0x232873[_0xf779('0x27')];}_0x51a5ad[_0xf779('0x1c')](_0x52e8dd)[_0xf779('0x28')](_0x232873);};}exports[_0xf779('0x29')]=function(_0x437d7f,_0x451f91){var _0x136c09={},_0x21a77f={},_0x1bc1cd={'count':0x0,'rows':[]};var _0x46a053=_[_0xf779('0x2a')](db[_0xf779('0x2b')]['rawAttributes'],function(_0x4ed797){return{'name':_0x4ed797[_0xf779('0x2c')],'type':_0x4ed797['type']['key']};});_0x21a77f[_0xf779('0x2d')]=_[_0xf779('0x2a')](_0x46a053,_0xf779('0x27'));_0x21a77f['query']=_['keys'](_0x437d7f[_0xf779('0x2e')]);_0x21a77f[_0xf779('0x2f')]=_[_0xf779('0x30')](_0x21a77f[_0xf779('0x2d')],_0x21a77f[_0xf779('0x2e')]);_0x136c09[_0xf779('0x31')]=_[_0xf779('0x30')](_0x21a77f[_0xf779('0x2d')],qs[_0xf779('0x32')](_0x437d7f['query'][_0xf779('0x32')]));_0x136c09[_0xf779('0x31')]=_0x136c09[_0xf779('0x31')]['length']?_0x136c09[_0xf779('0x31')]:_0x21a77f[_0xf779('0x2d')];if(!_0x437d7f[_0xf779('0x2e')][_0xf779('0x33')]('nolimit')){_0x136c09[_0xf779('0x20')]=qs[_0xf779('0x20')](_0x437d7f[_0xf779('0x2e')][_0xf779('0x20')]);_0x136c09[_0xf779('0x1e')]=qs['offset'](_0x437d7f[_0xf779('0x2e')]['offset']);}_0x136c09['order']=qs[_0xf779('0x34')](_0x437d7f['query']['sort']);_0x136c09[_0xf779('0x35')]=qs[_0xf779('0x2f')](_[_0xf779('0x36')](_0x437d7f[_0xf779('0x2e')],_0x21a77f[_0xf779('0x2f')]),_0x46a053);if(_0x437d7f[_0xf779('0x2e')]['filter']){_0x136c09[_0xf779('0x35')]=_[_0xf779('0x37')](_0x136c09[_0xf779('0x35')],{'$or':_[_0xf779('0x2a')](_0x46a053,function(_0x2029f0){if(_0x2029f0['type']!==_0xf779('0x38')){var _0x19784f={};_0x19784f[_0x2029f0[_0xf779('0x27')]]={'$like':'%'+_0x437d7f[_0xf779('0x2e')]['filter']+'%'};return _0x19784f;}})});}_0x136c09=_['merge']({},_0x136c09,_0x437d7f[_0xf779('0x39')]);var _0x559ecd={'where':_0x136c09[_0xf779('0x35')]};return db[_0xf779('0x2b')][_0xf779('0x21')](_0x559ecd)[_0xf779('0x25')](function(_0x94cbec){_0x1bc1cd[_0xf779('0x21')]=_0x94cbec;if(_0x437d7f['query'][_0xf779('0x3a')]){_0x136c09[_0xf779('0x3b')]=[{'all':!![]}];}return db[_0xf779('0x2b')][_0xf779('0x3c')](_0x136c09);})[_0xf779('0x25')](function(_0x105e29){_0x1bc1cd['rows']=_0x105e29;return _0x1bc1cd;})[_0xf779('0x25')](respondWithFilteredResult(_0x451f91,_0x136c09))[_0xf779('0x3d')](handleError(_0x451f91,null));};exports[_0xf779('0x3e')]=function(_0x13c24d,_0xd33963){var _0x4a8e5a={'raw':!![],'where':{'id':_0x13c24d[_0xf779('0x3f')]['id']}},_0x2b49e1={};_0x2b49e1['model']=_[_0xf779('0x40')](db[_0xf779('0x2b')][_0xf779('0x41')]);_0x2b49e1[_0xf779('0x2e')]=_['keys'](_0x13c24d[_0xf779('0x2e')]);_0x2b49e1[_0xf779('0x2f')]=_['intersection'](_0x2b49e1[_0xf779('0x2d')],_0x2b49e1['query']);_0x4a8e5a[_0xf779('0x31')]=_['intersection'](_0x2b49e1[_0xf779('0x2d')],qs['fields'](_0x13c24d[_0xf779('0x2e')]['fields']));_0x4a8e5a[_0xf779('0x31')]=_0x4a8e5a[_0xf779('0x31')][_0xf779('0x42')]?_0x4a8e5a[_0xf779('0x31')]:_0x2b49e1['model'];if(_0x13c24d[_0xf779('0x2e')]['includeAll']){_0x4a8e5a['include']=[{'all':!![]}];}_0x4a8e5a=_[_0xf779('0x37')]({},_0x4a8e5a,_0x13c24d['options']);return db[_0xf779('0x2b')][_0xf779('0x43')](_0x4a8e5a)[_0xf779('0x25')](handleEntityNotFound(_0xd33963,null))[_0xf779('0x25')](respondWithResult(_0xd33963,null))[_0xf779('0x3d')](handleError(_0xd33963,null));};exports[_0xf779('0x44')]=function(_0x5cc118,_0x1cc165){return db[_0xf779('0x2b')][_0xf779('0x44')](_0x5cc118[_0xf779('0x45')],{})[_0xf779('0x25')](respondWithResult(_0x1cc165,0xc9))[_0xf779('0x3d')](handleError(_0x1cc165,null));};exports[_0xf779('0x24')]=function(_0x7fe780,_0x433da1){if(_0x7fe780[_0xf779('0x45')]['id']){delete _0x7fe780['body']['id'];}return db[_0xf779('0x2b')][_0xf779('0x43')]({'where':{'id':_0x7fe780[_0xf779('0x3f')]['id']}})['then'](handleEntityNotFound(_0x433da1,null))[_0xf779('0x25')](saveUpdates(_0x7fe780[_0xf779('0x45')],null))[_0xf779('0x25')](respondWithResult(_0x433da1,null))[_0xf779('0x3d')](handleError(_0x433da1,null));};exports[_0xf779('0x46')]=function(_0x1c2dd5,_0x69ccd0){return db[_0xf779('0x2b')][_0xf779('0x43')]({'where':{'id':_0x1c2dd5[_0xf779('0x3f')]['id']}})[_0xf779('0x25')](handleEntityNotFound(_0x69ccd0,null))[_0xf779('0x25')](removeEntity(_0x69ccd0,null))[_0xf779('0x3d')](handleError(_0x69ccd0,null));}; \ No newline at end of file +var _0xfcbc=['body','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','destroy','then','name','index','map','FreshsalesField','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create'];(function(_0x35b195,_0x8893d5){var _0x2433bf=function(_0x22be07){while(--_0x22be07){_0x35b195['push'](_0x35b195['shift']());}};_0x2433bf(++_0x8893d5);}(_0xfcbc,0x1c0));var _0xcfcb=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0xfcbc[_0x424501];return _0xb719af;};'use strict';var emlformat=require(_0xcfcb('0x0'));var rimraf=require(_0xcfcb('0x1'));var zipdir=require(_0xcfcb('0x2'));var jsonpatch=require(_0xcfcb('0x3'));var rp=require(_0xcfcb('0x4'));var moment=require('moment');var BPromise=require(_0xcfcb('0x5'));var Mustache=require(_0xcfcb('0x6'));var util=require(_0xcfcb('0x7'));var path=require(_0xcfcb('0x8'));var sox=require(_0xcfcb('0x9'));var csv=require(_0xcfcb('0xa'));var ejs=require(_0xcfcb('0xb'));var fs=require('fs');var fs_extra=require(_0xcfcb('0xc'));var _=require(_0xcfcb('0xd'));var squel=require(_0xcfcb('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcfcb('0xf'));var toCsv=require(_0xcfcb('0xa'));var querystring=require(_0xcfcb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcfcb('0x11'));var qs=require(_0xcfcb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcfcb('0x13'));var logger=require(_0xcfcb('0x14'))('api');var utils=require(_0xcfcb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xcfcb('0x16'));var db=require(_0xcfcb('0x17'))['db'];function respondWithStatusCode(_0x4f9ea9,_0x25909f){_0x25909f=_0x25909f||0xcc;return function(_0x3f9d3c){if(_0x3f9d3c){return _0x4f9ea9[_0xcfcb('0x18')](_0x25909f);}return _0x4f9ea9[_0xcfcb('0x19')](_0x25909f)[_0xcfcb('0x1a')]();};}function respondWithResult(_0x1cd2ec,_0x1e4cc6){_0x1e4cc6=_0x1e4cc6||0xc8;return function(_0x712961){if(_0x712961){return _0x1cd2ec[_0xcfcb('0x19')](_0x1e4cc6)['json'](_0x712961);}};}function respondWithFilteredResult(_0x162fb0,_0xcd3fe2){return function(_0x5dfaff){if(_0x5dfaff){var _0x4f1fee=typeof _0xcd3fe2[_0xcfcb('0x1b')]===_0xcfcb('0x1c')&&typeof _0xcd3fe2[_0xcfcb('0x1d')]===_0xcfcb('0x1c');var _0x5289f8=_0x5dfaff[_0xcfcb('0x1e')];var _0x242964=_0x4f1fee?0x0:_0xcd3fe2[_0xcfcb('0x1b')];var _0xdea26d=_0x4f1fee?_0x5dfaff['count']:_0xcd3fe2[_0xcfcb('0x1b')]+_0xcd3fe2[_0xcfcb('0x1d')];var _0x939c4;if(_0xdea26d>=_0x5289f8){_0xdea26d=_0x5289f8;_0x939c4=0xc8;}else{_0x939c4=0xce;}_0x162fb0[_0xcfcb('0x19')](_0x939c4);return _0x162fb0[_0xcfcb('0x1f')]('Content-Range',_0x242964+'-'+_0xdea26d+'/'+_0x5289f8)[_0xcfcb('0x20')](_0x5dfaff);}return null;};}function patchUpdates(_0xd8cc4d){return function(_0x2ec403){try{jsonpatch[_0xcfcb('0x21')](_0x2ec403,_0xd8cc4d,!![]);}catch(_0x56d449){return BPromise[_0xcfcb('0x22')](_0x56d449);}return _0x2ec403[_0xcfcb('0x23')]();};}function saveUpdates(_0x1438bd,_0x4108ee){return function(_0xfb6024){if(_0xfb6024){return _0xfb6024['update'](_0x1438bd)['then'](function(_0x4c6db3){return _0x4c6db3;});}return null;};}function removeEntity(_0x574f33,_0x1b6523){return function(_0x9cf7a3){if(_0x9cf7a3){return _0x9cf7a3[_0xcfcb('0x24')]()[_0xcfcb('0x25')](function(){_0x574f33[_0xcfcb('0x19')](0xcc)[_0xcfcb('0x1a')]();});}};}function handleEntityNotFound(_0x4a9901,_0x110b61){return function(_0x3bdb00){if(!_0x3bdb00){_0x4a9901[_0xcfcb('0x18')](0x194);}return _0x3bdb00;};}function handleError(_0x31b802,_0x455531){_0x455531=_0x455531||0x1f4;return function(_0x5e201f){logger['error'](_0x5e201f['stack']);if(_0x5e201f[_0xcfcb('0x26')]){delete _0x5e201f['name'];}_0x31b802[_0xcfcb('0x19')](_0x455531)['send'](_0x5e201f);};}exports[_0xcfcb('0x27')]=function(_0x3f59ec,_0x2bffa7){var _0x33ffaf={},_0x288e37={},_0x2997ea={'count':0x0,'rows':[]};var _0x5e364f=_[_0xcfcb('0x28')](db[_0xcfcb('0x29')]['rawAttributes'],function(_0x9c0a06){return{'name':_0x9c0a06[_0xcfcb('0x2a')],'type':_0x9c0a06[_0xcfcb('0x2b')][_0xcfcb('0x2c')]};});_0x288e37['model']=_[_0xcfcb('0x28')](_0x5e364f,_0xcfcb('0x26'));_0x288e37[_0xcfcb('0x2d')]=_[_0xcfcb('0x2e')](_0x3f59ec['query']);_0x288e37[_0xcfcb('0x2f')]=_['intersection'](_0x288e37[_0xcfcb('0x30')],_0x288e37[_0xcfcb('0x2d')]);_0x33ffaf[_0xcfcb('0x31')]=_[_0xcfcb('0x32')](_0x288e37[_0xcfcb('0x30')],qs[_0xcfcb('0x33')](_0x3f59ec[_0xcfcb('0x2d')][_0xcfcb('0x33')]));_0x33ffaf[_0xcfcb('0x31')]=_0x33ffaf[_0xcfcb('0x31')][_0xcfcb('0x34')]?_0x33ffaf['attributes']:_0x288e37[_0xcfcb('0x30')];if(!_0x3f59ec[_0xcfcb('0x2d')][_0xcfcb('0x35')](_0xcfcb('0x36'))){_0x33ffaf['limit']=qs[_0xcfcb('0x1d')](_0x3f59ec['query'][_0xcfcb('0x1d')]);_0x33ffaf[_0xcfcb('0x1b')]=qs[_0xcfcb('0x1b')](_0x3f59ec[_0xcfcb('0x2d')]['offset']);}_0x33ffaf[_0xcfcb('0x37')]=qs['sort'](_0x3f59ec['query'][_0xcfcb('0x38')]);_0x33ffaf[_0xcfcb('0x39')]=qs[_0xcfcb('0x2f')](_[_0xcfcb('0x3a')](_0x3f59ec[_0xcfcb('0x2d')],_0x288e37[_0xcfcb('0x2f')]),_0x5e364f);if(_0x3f59ec[_0xcfcb('0x2d')]['filter']){_0x33ffaf[_0xcfcb('0x39')]=_[_0xcfcb('0x3b')](_0x33ffaf[_0xcfcb('0x39')],{'$or':_[_0xcfcb('0x28')](_0x5e364f,function(_0x1e0bbd){if(_0x1e0bbd[_0xcfcb('0x2b')]!=='VIRTUAL'){var _0x1df864={};_0x1df864[_0x1e0bbd[_0xcfcb('0x26')]]={'$like':'%'+_0x3f59ec[_0xcfcb('0x2d')][_0xcfcb('0x3c')]+'%'};return _0x1df864;}})});}_0x33ffaf=_[_0xcfcb('0x3b')]({},_0x33ffaf,_0x3f59ec[_0xcfcb('0x3d')]);var _0x44015d={'where':_0x33ffaf[_0xcfcb('0x39')]};return db['FreshsalesField'][_0xcfcb('0x1e')](_0x44015d)['then'](function(_0xaa723f){_0x2997ea[_0xcfcb('0x1e')]=_0xaa723f;if(_0x3f59ec['query'][_0xcfcb('0x3e')]){_0x33ffaf[_0xcfcb('0x3f')]=[{'all':!![]}];}return db[_0xcfcb('0x29')][_0xcfcb('0x40')](_0x33ffaf);})['then'](function(_0x7c3a94){_0x2997ea[_0xcfcb('0x41')]=_0x7c3a94;return _0x2997ea;})[_0xcfcb('0x25')](respondWithFilteredResult(_0x2bffa7,_0x33ffaf))[_0xcfcb('0x42')](handleError(_0x2bffa7,null));};exports[_0xcfcb('0x43')]=function(_0x1d457d,_0x3959f4){var _0x459da9={'raw':!![],'where':{'id':_0x1d457d['params']['id']}},_0xfc12d7={};_0xfc12d7[_0xcfcb('0x30')]=_['keys'](db[_0xcfcb('0x29')][_0xcfcb('0x44')]);_0xfc12d7[_0xcfcb('0x2d')]=_['keys'](_0x1d457d[_0xcfcb('0x2d')]);_0xfc12d7[_0xcfcb('0x2f')]=_[_0xcfcb('0x32')](_0xfc12d7['model'],_0xfc12d7['query']);_0x459da9[_0xcfcb('0x31')]=_[_0xcfcb('0x32')](_0xfc12d7['model'],qs['fields'](_0x1d457d[_0xcfcb('0x2d')][_0xcfcb('0x33')]));_0x459da9[_0xcfcb('0x31')]=_0x459da9[_0xcfcb('0x31')][_0xcfcb('0x34')]?_0x459da9[_0xcfcb('0x31')]:_0xfc12d7[_0xcfcb('0x30')];if(_0x1d457d[_0xcfcb('0x2d')][_0xcfcb('0x3e')]){_0x459da9[_0xcfcb('0x3f')]=[{'all':!![]}];}_0x459da9=_[_0xcfcb('0x3b')]({},_0x459da9,_0x1d457d[_0xcfcb('0x3d')]);return db[_0xcfcb('0x29')]['find'](_0x459da9)[_0xcfcb('0x25')](handleEntityNotFound(_0x3959f4,null))[_0xcfcb('0x25')](respondWithResult(_0x3959f4,null))[_0xcfcb('0x42')](handleError(_0x3959f4,null));};exports['create']=function(_0x5b4f0a,_0x28dc58){return db['FreshsalesField'][_0xcfcb('0x45')](_0x5b4f0a[_0xcfcb('0x46')],{})[_0xcfcb('0x25')](respondWithResult(_0x28dc58,0xc9))[_0xcfcb('0x42')](handleError(_0x28dc58,null));};exports[_0xcfcb('0x47')]=function(_0x8a8b0c,_0xaa9ee5){if(_0x8a8b0c[_0xcfcb('0x46')]['id']){delete _0x8a8b0c[_0xcfcb('0x46')]['id'];}return db[_0xcfcb('0x29')][_0xcfcb('0x48')]({'where':{'id':_0x8a8b0c[_0xcfcb('0x49')]['id']}})['then'](handleEntityNotFound(_0xaa9ee5,null))['then'](saveUpdates(_0x8a8b0c[_0xcfcb('0x46')],null))[_0xcfcb('0x25')](respondWithResult(_0xaa9ee5,null))[_0xcfcb('0x42')](handleError(_0xaa9ee5,null));};exports['destroy']=function(_0x2269d4,_0xfeab8f){return db[_0xcfcb('0x29')][_0xcfcb('0x48')]({'where':{'id':_0x2269d4[_0xcfcb('0x49')]['id']}})[_0xcfcb('0x25')](handleEntityNotFound(_0xfeab8f,null))[_0xcfcb('0x25')](removeEntity(_0xfeab8f,null))['catch'](handleError(_0xfeab8f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 6edcdb5..7a6d4b4 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 _0x6efe=['define','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x27ffd4,_0x1764cc){var _0x220dcd=function(_0x46caa6){while(--_0x46caa6){_0x27ffd4['push'](_0x27ffd4['shift']());}};_0x220dcd(++_0x1764cc);}(_0x6efe,0xc6));var _0xe6ef=function(_0x2b24ec,_0x425452){_0x2b24ec=_0x2b24ec-0x0;var _0xe1973c=_0x6efe[_0x2b24ec];return _0xe1973c;};'use strict';var _=require(_0xe6ef('0x0'));var util=require(_0xe6ef('0x1'));var logger=require(_0xe6ef('0x2'))(_0xe6ef('0x3'));var moment=require(_0xe6ef('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6ef('0x5'));var rimraf=require(_0xe6ef('0x6'));var config=require(_0xe6ef('0x7'));var attributes=require(_0xe6ef('0x8'));module[_0xe6ef('0x9')]=function(_0x573395,_0x17fc74){return _0x573395[_0xe6ef('0xa')]('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xe6ef('0xb'),_0xe6ef('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd6f=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','int_freshsales_fields','freshsales_unique_index'];(function(_0x344d13,_0x39d8ad){var _0x22878b=function(_0x3dc129){while(--_0x3dc129){_0x344d13['push'](_0x344d13['shift']());}};_0x22878b(++_0x39d8ad);}(_0xcd6f,0x17b));var _0xfcd6=function(_0x1b2f02,_0x5a4b88){_0x1b2f02=_0x1b2f02-0x0;var _0x3cad4a=_0xcd6f[_0x1b2f02];return _0x3cad4a;};'use strict';var _=require(_0xfcd6('0x0'));var util=require(_0xfcd6('0x1'));var logger=require(_0xfcd6('0x2'))(_0xfcd6('0x3'));var moment=require(_0xfcd6('0x4'));var BPromise=require(_0xfcd6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcd6('0x6'));var rimraf=require(_0xfcd6('0x7'));var config=require(_0xfcd6('0x8'));var attributes=require(_0xfcd6('0x9'));module['exports']=function(_0x124ba8,_0x5494f3){return _0x124ba8[_0xfcd6('0xa')]('FreshsalesField',attributes,{'tableName':_0xfcd6('0xb'),'paranoid':![],'indexes':[{'name':_0xfcd6('0xc'),'fields':['idField',_0xfcd6('0xd')],'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 01150b8..1c863be 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 _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5e0d12,_0x144474){var _0x180516=function(_0x330f91){while(--_0x330f91){_0x5e0d12['push'](_0x5e0d12['shift']());}};_0x180516(++_0x144474);}(_0x33af,0xec));var _0xf33a=function(_0x57ee8c,_0xe42849){_0x57ee8c=_0x57ee8c-0x0;var _0x3a2322=_0x33af[_0x57ee8c];return _0x3a2322;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xf494,0x1c6));var _0x4f49=function(_0x3180e9,_0x59be75){_0x3180e9=_0x3180e9-0x0;var _0x5e532d=_0xf494[_0x3180e9];return _0x5e532d;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 3538543..2ddeacd 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(_0x2a6e95,_0x171b71){var _0x19578f=function(_0xe7f0de){while(--_0xe7f0de){_0x2a6e95['push'](_0x2a6e95['shift']());}};_0x19578f(++_0x171b71);}(_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 +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(_0x15bc15,_0x1dc3d1){var _0xc84274=function(_0x42aa81){while(--_0x42aa81){_0x15bc15['push'](_0x15bc15['shift']());}};_0xc84274(++_0x1dc3d1);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 1a9d5e1..ff5f687 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 _0x87d0=['ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x4f3815,_0x3460c2){var _0x32613f=function(_0x24569e){while(--_0x24569e){_0x4f3815['push'](_0x4f3815['shift']());}};_0x32613f(++_0x3460c2);}(_0x87d0,0xbd));var _0x087d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x87d0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x087d('0x0'));module[_0x087d('0x1')]={'name':{'type':Sequelize[_0x087d('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x087d('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x087d('0x2')]},'password':{'type':Sequelize[_0x087d('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x087d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x087d('0x3')](_0x087d('0x4'),_0x087d('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xfdb5=['STRING','username','integrationTab','newTab','sequelize'];(function(_0x19b981,_0x50edd4){var _0x1cd2d3=function(_0x15324c){while(--_0x15324c){_0x19b981['push'](_0x19b981['shift']());}};_0x1cd2d3(++_0x50edd4);}(_0xfdb5,0x18f));var _0x5fdb=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xfdb5[_0xfa634c];return _0x73e478;};'use strict';var Sequelize=require(_0x5fdb('0x0'));module['exports']={'name':{'type':Sequelize[_0x5fdb('0x1')]},'description':{'type':Sequelize[_0x5fdb('0x1')]},'username':{'type':Sequelize[_0x5fdb('0x1')],'unique':_0x5fdb('0x2')},'remoteUri':{'type':Sequelize[_0x5fdb('0x1')]},'password':{'type':Sequelize[_0x5fdb('0x1')]},'clientId':{'type':Sequelize[_0x5fdb('0x1')]},'clientSecret':{'type':Sequelize[_0x5fdb('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5fdb('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5fdb('0x3'),_0x5fdb('0x4')),'defaultValue':_0x5fdb('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index ce36b53..8f037d2 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 _0xc095=['includes','label','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','fast-json-patch','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','includeAll','include','findAll','catch','options','find','create','body','update','params','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','AccountId','Subjects','getDescriptions','channel','SalesforceField','Descriptions','Task','remoteUri','clientId','username','password','securityToken','slice','lastIndexOf','Connection','clientSecret','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','phone'];(function(_0x3e732d,_0x3ea556){var _0x5aaaec=function(_0x58b330){while(--_0x58b330){_0x3e732d['push'](_0x3e732d['shift']());}};_0x5aaaec(++_0x3ea556);}(_0xc095,0x87));var _0x5c09=function(_0x592033,_0x1d6856){_0x592033=_0x592033-0x0;var _0x5b7dff=_0xc095[_0x592033];return _0x5b7dff;};'use strict';var emlformat=require(_0x5c09('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5c09('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5c09('0x2'));var Mustache=require(_0x5c09('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5c09('0x4'));var ejs=require(_0x5c09('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c09('0x6'));var squel=require(_0x5c09('0x7'));var crypto=require(_0x5c09('0x8'));var jsforce=require(_0x5c09('0x9'));var deskjs=require(_0x5c09('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5c09('0xb'));var Papa=require('papaparse');var Redis=require(_0x5c09('0xc'));var authService=require(_0x5c09('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5c09('0xe'));var hardwareService=require(_0x5c09('0xf'));var logger=require(_0x5c09('0x10'))(_0x5c09('0x11'));var utils=require(_0x5c09('0x12'));var config=require(_0x5c09('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c09('0x14'))['db'];var integrations=require(_0x5c09('0x15'));function respondWithStatusCode(_0x514be8,_0x35d533){_0x35d533=_0x35d533||0xcc;return function(_0x1b4eff){if(_0x1b4eff){return _0x514be8[_0x5c09('0x16')](_0x35d533);}return _0x514be8[_0x5c09('0x17')](_0x35d533)[_0x5c09('0x18')]();};}function respondWithResult(_0x1fedfd,_0x508a8c){_0x508a8c=_0x508a8c||0xc8;return function(_0x28ee85){if(_0x28ee85){return _0x1fedfd['status'](_0x508a8c)[_0x5c09('0x19')](_0x28ee85);}};}function respondWithFilteredResult(_0x7ff8ed,_0x5c3023){return function(_0x112e6a){if(_0x112e6a){var _0xf14ce0=typeof _0x5c3023[_0x5c09('0x1a')]===_0x5c09('0x1b')&&typeof _0x5c3023[_0x5c09('0x1c')]==='undefined';var _0x1b1c01=_0x112e6a[_0x5c09('0x1d')];var _0x46801e=_0xf14ce0?0x0:_0x5c3023[_0x5c09('0x1a')];var _0xc54e9b=_0xf14ce0?_0x112e6a[_0x5c09('0x1d')]:_0x5c3023[_0x5c09('0x1a')]+_0x5c3023[_0x5c09('0x1c')];var _0x5958b5;if(_0xc54e9b>=_0x1b1c01){_0xc54e9b=_0x1b1c01;_0x5958b5=0xc8;}else{_0x5958b5=0xce;}_0x7ff8ed[_0x5c09('0x17')](_0x5958b5);return _0x7ff8ed[_0x5c09('0x1e')](_0x5c09('0x1f'),_0x46801e+'-'+_0xc54e9b+'/'+_0x1b1c01)[_0x5c09('0x19')](_0x112e6a);}return null;};}function patchUpdates(_0x1a29e0){return function(_0x1ffba2){try{jsonpatch['apply'](_0x1ffba2,_0x1a29e0,!![]);}catch(_0x29ba55){return BPromise[_0x5c09('0x20')](_0x29ba55);}return _0x1ffba2[_0x5c09('0x21')]();};}function saveUpdates(_0x1a3744,_0x43a1f3){return function(_0x512505){if(_0x512505){return _0x512505['update'](_0x1a3744)['then'](function(_0xb4dd0d){return _0xb4dd0d;});}return null;};}function removeEntity(_0x207bcf,_0x3e61a7){return function(_0x4816af){if(_0x4816af){return _0x4816af[_0x5c09('0x22')]()[_0x5c09('0x23')](function(){_0x207bcf[_0x5c09('0x17')](0xcc)[_0x5c09('0x18')]();});}};}function handleEntityNotFound(_0x1623d4,_0xf18a0e){return function(_0x5ef747){if(!_0x5ef747){_0x1623d4['sendStatus'](0x194);}return _0x5ef747;};}function handleError(_0x38ff8a,_0x573dc3){_0x573dc3=_0x573dc3||0x1f4;return function(_0x113813){logger[_0x5c09('0x24')](_0x113813[_0x5c09('0x25')]);if(_0x113813[_0x5c09('0x26')]){delete _0x113813[_0x5c09('0x26')];}_0x38ff8a[_0x5c09('0x17')](_0x573dc3)[_0x5c09('0x27')](_0x113813);};}exports[_0x5c09('0x28')]=function(_0x54c88f,_0x2207f0){var _0x2082db={},_0x37d8bd={},_0x437155={'count':0x0,'rows':[]};var _0x171a79=_[_0x5c09('0x29')](db[_0x5c09('0x2a')][_0x5c09('0x2b')],function(_0x158f41){return{'name':_0x158f41[_0x5c09('0x2c')],'type':_0x158f41[_0x5c09('0x2d')][_0x5c09('0x2e')]};});_0x37d8bd[_0x5c09('0x2f')]=_[_0x5c09('0x29')](_0x171a79,_0x5c09('0x26'));_0x37d8bd[_0x5c09('0x30')]=_[_0x5c09('0x31')](_0x54c88f[_0x5c09('0x30')]);_0x37d8bd[_0x5c09('0x32')]=_[_0x5c09('0x33')](_0x37d8bd[_0x5c09('0x2f')],_0x37d8bd[_0x5c09('0x30')]);_0x2082db[_0x5c09('0x34')]=_['intersection'](_0x37d8bd[_0x5c09('0x2f')],qs[_0x5c09('0x35')](_0x54c88f['query']['fields']));_0x2082db[_0x5c09('0x34')]=_0x2082db['attributes'][_0x5c09('0x36')]?_0x2082db[_0x5c09('0x34')]:_0x37d8bd[_0x5c09('0x2f')];if(!_0x54c88f['query'][_0x5c09('0x37')]('nolimit')){_0x2082db[_0x5c09('0x1c')]=qs['limit'](_0x54c88f[_0x5c09('0x30')][_0x5c09('0x1c')]);_0x2082db[_0x5c09('0x1a')]=qs[_0x5c09('0x1a')](_0x54c88f[_0x5c09('0x30')]['offset']);}_0x2082db[_0x5c09('0x38')]=qs[_0x5c09('0x39')](_0x54c88f['query'][_0x5c09('0x39')]);_0x2082db['where']=qs[_0x5c09('0x32')](_['pick'](_0x54c88f[_0x5c09('0x30')],_0x37d8bd[_0x5c09('0x32')]),_0x171a79);if(_0x54c88f[_0x5c09('0x30')][_0x5c09('0x3a')]){_0x2082db['where']=_['merge'](_0x2082db[_0x5c09('0x3b')],{'$or':_['map'](_0x171a79,function(_0x549e8e){if(_0x549e8e[_0x5c09('0x2d')]!==_0x5c09('0x3c')){var _0x3350e3={};_0x3350e3[_0x549e8e['name']]={'$like':'%'+_0x54c88f[_0x5c09('0x30')]['filter']+'%'};return _0x3350e3;}})});}_0x2082db=_[_0x5c09('0x3d')]({},_0x2082db,_0x54c88f['options']);var _0x517a1a={'where':_0x2082db[_0x5c09('0x3b')]};return db['SalesforceAccount']['count'](_0x517a1a)['then'](function(_0x49cc22){_0x437155['count']=_0x49cc22;if(_0x54c88f[_0x5c09('0x30')][_0x5c09('0x3e')]){_0x2082db[_0x5c09('0x3f')]=[{'all':!![]}];}return db[_0x5c09('0x2a')][_0x5c09('0x40')](_0x2082db);})[_0x5c09('0x23')](function(_0x29d1da){_0x437155['rows']=_0x29d1da;return _0x437155;})[_0x5c09('0x23')](respondWithFilteredResult(_0x2207f0,_0x2082db))[_0x5c09('0x41')](handleError(_0x2207f0,null));};exports['show']=function(_0x42cf8c,_0x3c51c1){var _0x55e1b8={'raw':![],'where':{'id':_0x42cf8c['params']['id']}},_0x4b9359={};_0x4b9359[_0x5c09('0x2f')]=_[_0x5c09('0x31')](db[_0x5c09('0x2a')]['rawAttributes']);_0x4b9359['query']=_['keys'](_0x42cf8c['query']);_0x4b9359[_0x5c09('0x32')]=_[_0x5c09('0x33')](_0x4b9359['model'],_0x4b9359[_0x5c09('0x30')]);_0x55e1b8[_0x5c09('0x34')]=_[_0x5c09('0x33')](_0x4b9359[_0x5c09('0x2f')],qs[_0x5c09('0x35')](_0x42cf8c[_0x5c09('0x30')][_0x5c09('0x35')]));_0x55e1b8[_0x5c09('0x34')]=_0x55e1b8[_0x5c09('0x34')][_0x5c09('0x36')]?_0x55e1b8[_0x5c09('0x34')]:_0x4b9359[_0x5c09('0x2f')];if(_0x42cf8c[_0x5c09('0x30')][_0x5c09('0x3e')]){_0x55e1b8['include']=[{'all':!![]}];}_0x55e1b8=_[_0x5c09('0x3d')]({},_0x55e1b8,_0x42cf8c[_0x5c09('0x42')]);return db[_0x5c09('0x2a')][_0x5c09('0x43')](_0x55e1b8)[_0x5c09('0x23')](handleEntityNotFound(_0x3c51c1,null))[_0x5c09('0x23')](respondWithResult(_0x3c51c1,null))[_0x5c09('0x41')](handleError(_0x3c51c1,null));};exports[_0x5c09('0x44')]=function(_0x276e0e,_0x583367){return db['SalesforceAccount']['create'](_0x276e0e[_0x5c09('0x45')],{})[_0x5c09('0x23')](respondWithResult(_0x583367,0xc9))[_0x5c09('0x41')](handleError(_0x583367,null));};exports[_0x5c09('0x46')]=function(_0x39f697,_0x5847ab){if(_0x39f697[_0x5c09('0x45')]['id']){delete _0x39f697[_0x5c09('0x45')]['id'];}return db[_0x5c09('0x2a')][_0x5c09('0x43')]({'where':{'id':_0x39f697[_0x5c09('0x47')]['id']}})[_0x5c09('0x23')](handleEntityNotFound(_0x5847ab,null))[_0x5c09('0x23')](saveUpdates(_0x39f697['body'],null))[_0x5c09('0x23')](respondWithResult(_0x5847ab,null))[_0x5c09('0x41')](handleError(_0x5847ab,null));};exports[_0x5c09('0x22')]=function(_0x366f96,_0x13132c){return db[_0x5c09('0x2a')][_0x5c09('0x43')]({'where':{'id':_0x366f96[_0x5c09('0x47')]['id']}})[_0x5c09('0x23')](handleEntityNotFound(_0x13132c,null))[_0x5c09('0x23')](removeEntity(_0x13132c,null))[_0x5c09('0x41')](handleError(_0x13132c,null));};exports[_0x5c09('0x48')]=function(_0x6401af,_0x4246e4,_0x548ca1){var _0x560ce0={};var _0x409663={};var _0x2e72e1;var _0xace75a;return db['SalesforceAccount'][_0x5c09('0x49')]({'where':{'id':_0x6401af[_0x5c09('0x47')]['id']}})[_0x5c09('0x23')](handleEntityNotFound(_0x4246e4,null))['then'](function(_0x2805f8){if(_0x2805f8){_0x2e72e1=_0x2805f8;_0x409663[_0x5c09('0x2f')]=_[_0x5c09('0x31')](db[_0x5c09('0x4a')][_0x5c09('0x2b')]);_0x409663[_0x5c09('0x30')]=_[_0x5c09('0x31')](_0x6401af[_0x5c09('0x30')]);_0x409663['filters']=_[_0x5c09('0x33')](_0x409663['model'],_0x409663['query']);_0x560ce0[_0x5c09('0x34')]=_[_0x5c09('0x33')](_0x409663[_0x5c09('0x2f')],qs[_0x5c09('0x35')](_0x6401af[_0x5c09('0x30')][_0x5c09('0x35')]));_0x560ce0[_0x5c09('0x34')]=_0x560ce0['attributes'][_0x5c09('0x36')]?_0x560ce0[_0x5c09('0x34')]:_0x409663[_0x5c09('0x2f')];_0x560ce0[_0x5c09('0x38')]=qs[_0x5c09('0x39')](_0x6401af[_0x5c09('0x30')]['sort']);_0x560ce0[_0x5c09('0x3b')]=qs[_0x5c09('0x32')](_['pick'](_0x6401af[_0x5c09('0x30')],_0x409663['filters']));if(_0x6401af[_0x5c09('0x30')]['filter']){_0x560ce0[_0x5c09('0x3b')]=_[_0x5c09('0x3d')](_0x560ce0[_0x5c09('0x3b')],{'$or':_[_0x5c09('0x29')](_0x560ce0[_0x5c09('0x34')],function(_0x3f6892){var _0x2ed068={};_0x2ed068[_0x3f6892]={'$like':'%'+_0x6401af[_0x5c09('0x30')][_0x5c09('0x3a')]+'%'};return _0x2ed068;})});}_0x560ce0=_[_0x5c09('0x3d')]({},_0x560ce0,_0x6401af[_0x5c09('0x42')]);return _0x2e72e1['getConfigurations'](_0x560ce0);}})[_0x5c09('0x23')](function(_0xc34b60){if(_0xc34b60){_0xace75a=_0xc34b60['length'];if(!_0x6401af[_0x5c09('0x30')][_0x5c09('0x37')](_0x5c09('0x4b'))){_0x560ce0[_0x5c09('0x1c')]=qs[_0x5c09('0x1c')](_0x6401af['query'][_0x5c09('0x1c')]);_0x560ce0[_0x5c09('0x1a')]=qs['offset'](_0x6401af['query'][_0x5c09('0x1a')]);}return _0x2e72e1[_0x5c09('0x48')](_0x560ce0);}})[_0x5c09('0x23')](function(_0xf3ca71){if(_0xf3ca71){return _0xf3ca71?{'count':_0xace75a,'rows':_0xf3ca71}:null;}})[_0x5c09('0x23')](respondWithResult(_0x4246e4,null))[_0x5c09('0x41')](handleError(_0x4246e4,null));};exports[_0x5c09('0x4c')]=function(_0x185e30,_0x9f88be,_0x5084a2){if(_0x185e30[_0x5c09('0x45')]['id']){delete _0x185e30[_0x5c09('0x45')]['id'];}return db[_0x5c09('0x2a')][_0x5c09('0x49')]({'where':{'id':_0x185e30['params']['id']}})['then'](handleEntityNotFound(_0x9f88be,null))[_0x5c09('0x23')](function(_0x2b2ddc){if(_0x2b2ddc){_0x185e30[_0x5c09('0x45')][_0x5c09('0x4d')]=_0x2b2ddc['id'];_0x185e30[_0x5c09('0x45')][_0x5c09('0x4e')]=integrations['getSubjects'](_0x185e30[_0x5c09('0x45')]['channel'],_0x185e30[_0x5c09('0x45')][_0x5c09('0x2d')]);_0x185e30['body']['Descriptions']=integrations[_0x5c09('0x4f')](_0x185e30[_0x5c09('0x45')][_0x5c09('0x50')],_0x185e30['body']['type']);return db[_0x5c09('0x4a')][_0x5c09('0x44')](_0x185e30[_0x5c09('0x45')],{'include':[{'model':db[_0x5c09('0x51')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x5c09('0x52')}]});}return null;})['then'](respondWithResult(_0x9f88be,null))[_0x5c09('0x41')](handleError(_0x9f88be,null));};exports['getFields']=function(_0x4562b5,_0x3dc8cf,_0x196016){var _0x52ba78;var _0x2cf4ea='';var _0x50534d=_0x5c09('0x53');return db[_0x5c09('0x2a')][_0x5c09('0x49')]({'where':{'id':_0x4562b5[_0x5c09('0x47')]['id']},'attributes':['id',_0x5c09('0x54'),_0x5c09('0x55'),'clientSecret',_0x5c09('0x56'),_0x5c09('0x57'),_0x5c09('0x58')]})[_0x5c09('0x23')](handleEntityNotFound(_0x3dc8cf,null))[_0x5c09('0x23')](function(_0xfc01d0){if(_0xfc01d0){_0x2cf4ea=_0xfc01d0[_0x5c09('0x54')];var _0x87955=_0x2cf4ea[_0x5c09('0x59')](-0x1);if(_0x87955==='/'){_0x2cf4ea=_0x2cf4ea['substring'](0x0,_0x2cf4ea[_0x5c09('0x5a')](_0x87955));}_0x52ba78=new jsforce[(_0x5c09('0x5b'))]({'oauth2':{'loginUrl':_0x2cf4ea,'clientId':_0xfc01d0['clientId'],'clientSecret':_0xfc01d0[_0x5c09('0x5c')]}});return _0x52ba78['login'](_0xfc01d0[_0x5c09('0x56')],_0xfc01d0[_0x5c09('0x57')][_0x5c09('0x5d')](_0xfc01d0[_0x5c09('0x58')]));}})[_0x5c09('0x23')](function(_0x1faab9){if(_0x1faab9){if(!_[_0x5c09('0x5e')](_0x4562b5[_0x5c09('0x30')][_0x5c09('0x5f')])){_0x50534d=_0x4562b5[_0x5c09('0x30')][_0x5c09('0x5f')];}return _0x52ba78[_0x5c09('0x60')](_0x50534d)[_0x5c09('0x61')]();}})[_0x5c09('0x23')](function(_0x1c72b1){var _0x56e771=[_0x5c09('0x62'),_0x5c09('0x63'),_0x5c09('0x64'),_0x5c09('0x65'),_0x5c09('0x66'),_0x5c09('0x67')];var _0xa18d48=[_0x5c09('0x68'),'int',_0x5c09('0x69'),_0x5c09('0x6a'),_0x5c09('0x6b'),'textarea',_0x5c09('0x6c')];if(_0x1c72b1){_['remove'](_0x1c72b1[_0x5c09('0x35')],function(_0x3ce5b6){return _0x56e771[_0x5c09('0x6d')](_0x3ce5b6[_0x5c09('0x26')])||!_0xa18d48[_0x5c09('0x6d')](_0x3ce5b6['type']);});return{'count':_0x1c72b1[_0x5c09('0x35')][_0x5c09('0x36')],'rows':_['map'](_0x1c72b1[_0x5c09('0x35')],function(_0x311ac0){return{'id':_0x311ac0[_0x5c09('0x26')],'name':_0x311ac0[_0x5c09('0x6e')],'custom':_0x311ac0['custom'],'options':_0x311ac0[_0x5c09('0x6f')][_0x5c09('0x36')]>0x0?_[_0x5c09('0x29')](_0x311ac0[_0x5c09('0x6f')],function(_0x3395a1){return{'name':_0x3395a1[_0x5c09('0x6e')],'value':_0x3395a1[_0x5c09('0x70')]};}):_0x311ac0[_0x5c09('0x2d')]==_0x5c09('0x6a')?[{'name':_0x5c09('0x71'),'value':_0x5c09('0x72')},{'name':_0x5c09('0x73'),'value':_0x5c09('0x74')}]:[]};})};}})[_0x5c09('0x23')](respondWithResult(_0x3dc8cf,null))[_0x5c09('0x41')](function(_0x161b1e){var _0x359e9a=_0x4562b5['query'][_0x5c09('0x75')]?0x1f4:_0x161b1e[_0x5c09('0x76')]||0x1f4;logger[_0x5c09('0x24')](_0x5c09('0x77'),_0x5c09('0x78'),_0x359e9a,JSON['stringify'](_0x161b1e));delete _0x161b1e[_0x5c09('0x26')];if(_0x359e9a===0x191){_0x359e9a=0x190;}_0x3dc8cf['status'](_0x359e9a)[_0x5c09('0x27')](_0x4562b5[_0x5c09('0x30')][_0x5c09('0x75')]?{'message':_0x5c09('0x79'),'statusCode':_0x161b1e[_0x5c09('0x76')]}:_0x161b1e);});}; \ No newline at end of file +var _0xe2d0=['json','offset','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','getConfigurations','length','pick','nolimit','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','remoteUri','clientId','clientSecret','username','password','substring','Connection','login','concat','securityToken','isNil','ticketType','sobject','describe','OwnerId','IsRecurrence','Description','string','int','picklist','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0xf9b4da,_0x136cf0){var _0x572262=function(_0x4a30bd){while(--_0x4a30bd){_0xf9b4da['push'](_0xf9b4da['shift']());}};_0x572262(++_0x136cf0);}(_0xe2d0,0x1ca));var _0x0e2d=function(_0x1be50b,_0x27c249){_0x1be50b=_0x1be50b-0x0;var _0x5a70eb=_0xe2d0[_0x1be50b];return _0x5a70eb;};'use strict';var emlformat=require(_0x0e2d('0x0'));var rimraf=require(_0x0e2d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e2d('0x2'));var rp=require(_0x0e2d('0x3'));var moment=require(_0x0e2d('0x4'));var BPromise=require(_0x0e2d('0x5'));var Mustache=require('mustache');var util=require(_0x0e2d('0x6'));var path=require(_0x0e2d('0x7'));var sox=require(_0x0e2d('0x8'));var csv=require(_0x0e2d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e2d('0xa'));var _=require(_0x0e2d('0xb'));var squel=require(_0x0e2d('0xc'));var crypto=require(_0x0e2d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0e2d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0e2d('0xf'));var Papa=require('papaparse');var Redis=require(_0x0e2d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0e2d('0x11'));var as=require(_0x0e2d('0x12'));var hardwareService=require(_0x0e2d('0x13'));var logger=require('../../config/logger')(_0x0e2d('0x14'));var utils=require(_0x0e2d('0x15'));var config=require(_0x0e2d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e2d('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4bc94e,_0xd44fb4){_0xd44fb4=_0xd44fb4||0xcc;return function(_0x435e96){if(_0x435e96){return _0x4bc94e[_0x0e2d('0x18')](_0xd44fb4);}return _0x4bc94e['status'](_0xd44fb4)['end']();};}function respondWithResult(_0x4d34c1,_0xb31bcf){_0xb31bcf=_0xb31bcf||0xc8;return function(_0x2d9b1a){if(_0x2d9b1a){return _0x4d34c1[_0x0e2d('0x19')](_0xb31bcf)[_0x0e2d('0x1a')](_0x2d9b1a);}};}function respondWithFilteredResult(_0x45c31e,_0x556bed){return function(_0x21e8fc){if(_0x21e8fc){var _0x800234=typeof _0x556bed[_0x0e2d('0x1b')]==='undefined'&&typeof _0x556bed[_0x0e2d('0x1c')]==='undefined';var _0x494fc6=_0x21e8fc[_0x0e2d('0x1d')];var _0x4e02b7=_0x800234?0x0:_0x556bed[_0x0e2d('0x1b')];var _0x423f4c=_0x800234?_0x21e8fc[_0x0e2d('0x1d')]:_0x556bed[_0x0e2d('0x1b')]+_0x556bed[_0x0e2d('0x1c')];var _0x2b6aea;if(_0x423f4c>=_0x494fc6){_0x423f4c=_0x494fc6;_0x2b6aea=0xc8;}else{_0x2b6aea=0xce;}_0x45c31e[_0x0e2d('0x19')](_0x2b6aea);return _0x45c31e['set'](_0x0e2d('0x1e'),_0x4e02b7+'-'+_0x423f4c+'/'+_0x494fc6)[_0x0e2d('0x1a')](_0x21e8fc);}return null;};}function patchUpdates(_0x1801dd){return function(_0x2de1a7){try{jsonpatch[_0x0e2d('0x1f')](_0x2de1a7,_0x1801dd,!![]);}catch(_0x5ecdaa){return BPromise[_0x0e2d('0x20')](_0x5ecdaa);}return _0x2de1a7['save']();};}function saveUpdates(_0x480754,_0x198ca4){return function(_0x4436f4){if(_0x4436f4){return _0x4436f4[_0x0e2d('0x21')](_0x480754)[_0x0e2d('0x22')](function(_0x178d9b){return _0x178d9b;});}return null;};}function removeEntity(_0x24472d,_0x2e536c){return function(_0x71f8e3){if(_0x71f8e3){return _0x71f8e3[_0x0e2d('0x23')]()['then'](function(){_0x24472d['status'](0xcc)[_0x0e2d('0x24')]();});}};}function handleEntityNotFound(_0x35f3cb,_0x5199b0){return function(_0x5e9203){if(!_0x5e9203){_0x35f3cb[_0x0e2d('0x18')](0x194);}return _0x5e9203;};}function handleError(_0x6f5c2,_0x43963){_0x43963=_0x43963||0x1f4;return function(_0x4b8260){logger[_0x0e2d('0x25')](_0x4b8260[_0x0e2d('0x26')]);if(_0x4b8260[_0x0e2d('0x27')]){delete _0x4b8260[_0x0e2d('0x27')];}_0x6f5c2['status'](_0x43963)[_0x0e2d('0x28')](_0x4b8260);};}exports[_0x0e2d('0x29')]=function(_0x31c792,_0x50fe66){var _0x333021={},_0x1a4465={},_0xea3c04={'count':0x0,'rows':[]};var _0x23de7b=_[_0x0e2d('0x2a')](db[_0x0e2d('0x2b')][_0x0e2d('0x2c')],function(_0x463cf7){return{'name':_0x463cf7[_0x0e2d('0x2d')],'type':_0x463cf7[_0x0e2d('0x2e')][_0x0e2d('0x2f')]};});_0x1a4465[_0x0e2d('0x30')]=_[_0x0e2d('0x2a')](_0x23de7b,_0x0e2d('0x27'));_0x1a4465[_0x0e2d('0x31')]=_[_0x0e2d('0x32')](_0x31c792[_0x0e2d('0x31')]);_0x1a4465[_0x0e2d('0x33')]=_[_0x0e2d('0x34')](_0x1a4465['model'],_0x1a4465[_0x0e2d('0x31')]);_0x333021[_0x0e2d('0x35')]=_[_0x0e2d('0x34')](_0x1a4465[_0x0e2d('0x30')],qs[_0x0e2d('0x36')](_0x31c792[_0x0e2d('0x31')][_0x0e2d('0x36')]));_0x333021[_0x0e2d('0x35')]=_0x333021[_0x0e2d('0x35')]['length']?_0x333021[_0x0e2d('0x35')]:_0x1a4465['model'];if(!_0x31c792[_0x0e2d('0x31')][_0x0e2d('0x37')]('nolimit')){_0x333021[_0x0e2d('0x1c')]=qs['limit'](_0x31c792[_0x0e2d('0x31')][_0x0e2d('0x1c')]);_0x333021[_0x0e2d('0x1b')]=qs[_0x0e2d('0x1b')](_0x31c792['query'][_0x0e2d('0x1b')]);}_0x333021[_0x0e2d('0x38')]=qs[_0x0e2d('0x39')](_0x31c792['query']['sort']);_0x333021[_0x0e2d('0x3a')]=qs[_0x0e2d('0x33')](_['pick'](_0x31c792[_0x0e2d('0x31')],_0x1a4465['filters']),_0x23de7b);if(_0x31c792[_0x0e2d('0x31')][_0x0e2d('0x3b')]){_0x333021[_0x0e2d('0x3a')]=_['merge'](_0x333021['where'],{'$or':_['map'](_0x23de7b,function(_0x561872){if(_0x561872[_0x0e2d('0x2e')]!=='VIRTUAL'){var _0x3c8a5e={};_0x3c8a5e[_0x561872[_0x0e2d('0x27')]]={'$like':'%'+_0x31c792['query'][_0x0e2d('0x3b')]+'%'};return _0x3c8a5e;}})});}_0x333021=_[_0x0e2d('0x3c')]({},_0x333021,_0x31c792[_0x0e2d('0x3d')]);var _0x4791af={'where':_0x333021[_0x0e2d('0x3a')]};return db[_0x0e2d('0x2b')]['count'](_0x4791af)[_0x0e2d('0x22')](function(_0x26c001){_0xea3c04[_0x0e2d('0x1d')]=_0x26c001;if(_0x31c792[_0x0e2d('0x31')][_0x0e2d('0x3e')]){_0x333021[_0x0e2d('0x3f')]=[{'all':!![]}];}return db[_0x0e2d('0x2b')][_0x0e2d('0x40')](_0x333021);})[_0x0e2d('0x22')](function(_0x1edead){_0xea3c04[_0x0e2d('0x41')]=_0x1edead;return _0xea3c04;})[_0x0e2d('0x22')](respondWithFilteredResult(_0x50fe66,_0x333021))[_0x0e2d('0x42')](handleError(_0x50fe66,null));};exports['show']=function(_0xe3de07,_0x42be46){var _0x331957={'raw':![],'where':{'id':_0xe3de07[_0x0e2d('0x43')]['id']}},_0x4a8718={};_0x4a8718[_0x0e2d('0x30')]=_[_0x0e2d('0x32')](db[_0x0e2d('0x2b')][_0x0e2d('0x2c')]);_0x4a8718[_0x0e2d('0x31')]=_[_0x0e2d('0x32')](_0xe3de07[_0x0e2d('0x31')]);_0x4a8718[_0x0e2d('0x33')]=_[_0x0e2d('0x34')](_0x4a8718[_0x0e2d('0x30')],_0x4a8718[_0x0e2d('0x31')]);_0x331957[_0x0e2d('0x35')]=_['intersection'](_0x4a8718[_0x0e2d('0x30')],qs['fields'](_0xe3de07[_0x0e2d('0x31')][_0x0e2d('0x36')]));_0x331957['attributes']=_0x331957[_0x0e2d('0x35')]['length']?_0x331957[_0x0e2d('0x35')]:_0x4a8718['model'];if(_0xe3de07['query'][_0x0e2d('0x3e')]){_0x331957[_0x0e2d('0x3f')]=[{'all':!![]}];}_0x331957=_[_0x0e2d('0x3c')]({},_0x331957,_0xe3de07[_0x0e2d('0x3d')]);return db[_0x0e2d('0x2b')]['find'](_0x331957)[_0x0e2d('0x22')](handleEntityNotFound(_0x42be46,null))['then'](respondWithResult(_0x42be46,null))[_0x0e2d('0x42')](handleError(_0x42be46,null));};exports[_0x0e2d('0x44')]=function(_0x39395a,_0x337f02){return db[_0x0e2d('0x2b')][_0x0e2d('0x44')](_0x39395a[_0x0e2d('0x45')],{})[_0x0e2d('0x22')](respondWithResult(_0x337f02,0xc9))['catch'](handleError(_0x337f02,null));};exports[_0x0e2d('0x21')]=function(_0x44e3b4,_0x21fe0){if(_0x44e3b4[_0x0e2d('0x45')]['id']){delete _0x44e3b4[_0x0e2d('0x45')]['id'];}return db[_0x0e2d('0x2b')][_0x0e2d('0x46')]({'where':{'id':_0x44e3b4[_0x0e2d('0x43')]['id']}})[_0x0e2d('0x22')](handleEntityNotFound(_0x21fe0,null))[_0x0e2d('0x22')](saveUpdates(_0x44e3b4[_0x0e2d('0x45')],null))[_0x0e2d('0x22')](respondWithResult(_0x21fe0,null))[_0x0e2d('0x42')](handleError(_0x21fe0,null));};exports[_0x0e2d('0x23')]=function(_0x502e41,_0x135bc9){return db[_0x0e2d('0x2b')][_0x0e2d('0x46')]({'where':{'id':_0x502e41[_0x0e2d('0x43')]['id']}})[_0x0e2d('0x22')](handleEntityNotFound(_0x135bc9,null))[_0x0e2d('0x22')](removeEntity(_0x135bc9,null))[_0x0e2d('0x42')](handleError(_0x135bc9,null));};exports[_0x0e2d('0x47')]=function(_0x27d229,_0x39241a,_0xe6448b){var _0x3e2f6d={};var _0x40f6d4={};var _0x1dfe48;var _0x17e65d;return db[_0x0e2d('0x2b')]['findOne']({'where':{'id':_0x27d229['params']['id']}})[_0x0e2d('0x22')](handleEntityNotFound(_0x39241a,null))[_0x0e2d('0x22')](function(_0x22ea09){if(_0x22ea09){_0x1dfe48=_0x22ea09;_0x40f6d4['model']=_[_0x0e2d('0x32')](db['SalesforceConfiguration'][_0x0e2d('0x2c')]);_0x40f6d4[_0x0e2d('0x31')]=_[_0x0e2d('0x32')](_0x27d229[_0x0e2d('0x31')]);_0x40f6d4[_0x0e2d('0x33')]=_[_0x0e2d('0x34')](_0x40f6d4['model'],_0x40f6d4[_0x0e2d('0x31')]);_0x3e2f6d[_0x0e2d('0x35')]=_[_0x0e2d('0x34')](_0x40f6d4[_0x0e2d('0x30')],qs[_0x0e2d('0x36')](_0x27d229[_0x0e2d('0x31')][_0x0e2d('0x36')]));_0x3e2f6d[_0x0e2d('0x35')]=_0x3e2f6d['attributes'][_0x0e2d('0x48')]?_0x3e2f6d[_0x0e2d('0x35')]:_0x40f6d4['model'];_0x3e2f6d[_0x0e2d('0x38')]=qs[_0x0e2d('0x39')](_0x27d229[_0x0e2d('0x31')]['sort']);_0x3e2f6d[_0x0e2d('0x3a')]=qs[_0x0e2d('0x33')](_[_0x0e2d('0x49')](_0x27d229[_0x0e2d('0x31')],_0x40f6d4['filters']));if(_0x27d229[_0x0e2d('0x31')][_0x0e2d('0x3b')]){_0x3e2f6d[_0x0e2d('0x3a')]=_[_0x0e2d('0x3c')](_0x3e2f6d[_0x0e2d('0x3a')],{'$or':_[_0x0e2d('0x2a')](_0x3e2f6d[_0x0e2d('0x35')],function(_0x137117){var _0x560de5={};_0x560de5[_0x137117]={'$like':'%'+_0x27d229[_0x0e2d('0x31')][_0x0e2d('0x3b')]+'%'};return _0x560de5;})});}_0x3e2f6d=_[_0x0e2d('0x3c')]({},_0x3e2f6d,_0x27d229[_0x0e2d('0x3d')]);return _0x1dfe48['getConfigurations'](_0x3e2f6d);}})['then'](function(_0x4c620e){if(_0x4c620e){_0x17e65d=_0x4c620e[_0x0e2d('0x48')];if(!_0x27d229[_0x0e2d('0x31')]['hasOwnProperty'](_0x0e2d('0x4a'))){_0x3e2f6d[_0x0e2d('0x1c')]=qs[_0x0e2d('0x1c')](_0x27d229[_0x0e2d('0x31')][_0x0e2d('0x1c')]);_0x3e2f6d[_0x0e2d('0x1b')]=qs[_0x0e2d('0x1b')](_0x27d229[_0x0e2d('0x31')][_0x0e2d('0x1b')]);}return _0x1dfe48[_0x0e2d('0x47')](_0x3e2f6d);}})['then'](function(_0x191ecb){if(_0x191ecb){return _0x191ecb?{'count':_0x17e65d,'rows':_0x191ecb}:null;}})[_0x0e2d('0x22')](respondWithResult(_0x39241a,null))[_0x0e2d('0x42')](handleError(_0x39241a,null));};exports[_0x0e2d('0x4b')]=function(_0x52b8f7,_0x2ddd25,_0x3ebe39){if(_0x52b8f7[_0x0e2d('0x45')]['id']){delete _0x52b8f7[_0x0e2d('0x45')]['id'];}return db[_0x0e2d('0x2b')][_0x0e2d('0x4c')]({'where':{'id':_0x52b8f7['params']['id']}})[_0x0e2d('0x22')](handleEntityNotFound(_0x2ddd25,null))[_0x0e2d('0x22')](function(_0x4b17d9){if(_0x4b17d9){_0x52b8f7[_0x0e2d('0x45')][_0x0e2d('0x4d')]=_0x4b17d9['id'];_0x52b8f7['body']['Subjects']=integrations[_0x0e2d('0x4e')](_0x52b8f7[_0x0e2d('0x45')][_0x0e2d('0x4f')],_0x52b8f7['body'][_0x0e2d('0x2e')]);_0x52b8f7[_0x0e2d('0x45')][_0x0e2d('0x50')]=integrations[_0x0e2d('0x51')](_0x52b8f7[_0x0e2d('0x45')][_0x0e2d('0x4f')],_0x52b8f7['body'][_0x0e2d('0x2e')]);return db['SalesforceConfiguration'][_0x0e2d('0x44')](_0x52b8f7[_0x0e2d('0x45')],{'include':[{'model':db[_0x0e2d('0x52')],'as':_0x0e2d('0x53')},{'model':db[_0x0e2d('0x52')],'as':_0x0e2d('0x50')}]});}return null;})[_0x0e2d('0x22')](respondWithResult(_0x2ddd25,null))[_0x0e2d('0x42')](handleError(_0x2ddd25,null));};exports[_0x0e2d('0x54')]=function(_0x288704,_0x3cc976,_0x423946){var _0x1a1788;var _0x4b29b5='';var _0x16f14d='Task';return db[_0x0e2d('0x2b')][_0x0e2d('0x4c')]({'where':{'id':_0x288704[_0x0e2d('0x43')]['id']},'attributes':['id',_0x0e2d('0x55'),_0x0e2d('0x56'),_0x0e2d('0x57'),_0x0e2d('0x58'),_0x0e2d('0x59'),'securityToken']})[_0x0e2d('0x22')](handleEntityNotFound(_0x3cc976,null))[_0x0e2d('0x22')](function(_0x2ddaf7){if(_0x2ddaf7){_0x4b29b5=_0x2ddaf7[_0x0e2d('0x55')];var _0x5b8941=_0x4b29b5['slice'](-0x1);if(_0x5b8941==='/'){_0x4b29b5=_0x4b29b5[_0x0e2d('0x5a')](0x0,_0x4b29b5['lastIndexOf'](_0x5b8941));}_0x1a1788=new jsforce[(_0x0e2d('0x5b'))]({'oauth2':{'loginUrl':_0x4b29b5,'clientId':_0x2ddaf7['clientId'],'clientSecret':_0x2ddaf7['clientSecret']}});return _0x1a1788[_0x0e2d('0x5c')](_0x2ddaf7[_0x0e2d('0x58')],_0x2ddaf7['password'][_0x0e2d('0x5d')](_0x2ddaf7[_0x0e2d('0x5e')]));}})['then'](function(_0x4ab2da){if(_0x4ab2da){if(!_[_0x0e2d('0x5f')](_0x288704[_0x0e2d('0x31')][_0x0e2d('0x60')])){_0x16f14d=_0x288704[_0x0e2d('0x31')][_0x0e2d('0x60')];}return _0x1a1788[_0x0e2d('0x61')](_0x16f14d)[_0x0e2d('0x62')]();}})[_0x0e2d('0x22')](function(_0xdacf80){var _0x2f506a=[_0x0e2d('0x63'),'ActivityDate','IsReminderSet',_0x0e2d('0x64'),'Subject',_0x0e2d('0x65')];var _0x454fa2=[_0x0e2d('0x66'),_0x0e2d('0x67'),_0x0e2d('0x68'),'boolean',_0x0e2d('0x69'),_0x0e2d('0x6a'),_0x0e2d('0x6b')];if(_0xdacf80){_[_0x0e2d('0x6c')](_0xdacf80[_0x0e2d('0x36')],function(_0x3ce2e2){return _0x2f506a[_0x0e2d('0x6d')](_0x3ce2e2[_0x0e2d('0x27')])||!_0x454fa2['includes'](_0x3ce2e2[_0x0e2d('0x2e')]);});return{'count':_0xdacf80[_0x0e2d('0x36')][_0x0e2d('0x48')],'rows':_[_0x0e2d('0x2a')](_0xdacf80[_0x0e2d('0x36')],function(_0x529743){return{'id':_0x529743[_0x0e2d('0x27')],'name':_0x529743[_0x0e2d('0x6e')],'custom':_0x529743[_0x0e2d('0x6f')],'options':_0x529743[_0x0e2d('0x70')][_0x0e2d('0x48')]>0x0?_[_0x0e2d('0x2a')](_0x529743['picklistValues'],function(_0x3f0426){return{'name':_0x3f0426[_0x0e2d('0x6e')],'value':_0x3f0426[_0x0e2d('0x71')]};}):_0x529743[_0x0e2d('0x2e')]=='boolean'?[{'name':_0x0e2d('0x72'),'value':_0x0e2d('0x73')},{'name':'False','value':_0x0e2d('0x74')}]:[]};})};}})[_0x0e2d('0x22')](respondWithResult(_0x3cc976,null))[_0x0e2d('0x42')](function(_0x346c58){var _0x50384d=_0x288704[_0x0e2d('0x31')]['test']?0x1f4:_0x346c58[_0x0e2d('0x75')]||0x1f4;logger[_0x0e2d('0x25')](_0x0e2d('0x76'),_0x0e2d('0x54'),_0x50384d,JSON[_0x0e2d('0x77')](_0x346c58));delete _0x346c58[_0x0e2d('0x27')];if(_0x50384d===0x191){_0x50384d=0x190;}_0x3cc976['status'](_0x50384d)[_0x0e2d('0x28')](_0x288704[_0x0e2d('0x31')][_0x0e2d('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x346c58[_0x0e2d('0x75')]}:_0x346c58);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 4e44dd4..a70aa9c 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 _0xdcd0=['../../config/environment','./intSalesforceAccount.attributes','exports','define','int_salesforce_accounts','lodash','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x3bcef6,_0x242a22){var _0x1020f9=function(_0x240391){while(--_0x240391){_0x3bcef6['push'](_0x3bcef6['shift']());}};_0x1020f9(++_0x242a22);}(_0xdcd0,0xb9));var _0x0dcd=function(_0x55c19d,_0x13f94c){_0x55c19d=_0x55c19d-0x0;var _0x3437c8=_0xdcd0[_0x55c19d];return _0x3437c8;};'use strict';var _=require(_0x0dcd('0x0'));var util=require('util');var logger=require(_0x0dcd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0dcd('0x2'));var rp=require(_0x0dcd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0dcd('0x4'));var config=require(_0x0dcd('0x5'));var attributes=require(_0x0dcd('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x0dcd('0x7')]=function(_0x440bdd,_0x19ac5a){return _0x440bdd[_0x0dcd('0x8')]('SalesforceAccount',attributes,{'tableName':_0x0dcd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd44e=['SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x1132a4,_0x39cddb){var _0x3a5b61=function(_0x4b5bf6){while(--_0x4b5bf6){_0x1132a4['push'](_0x1132a4['shift']());}};_0x3a5b61(++_0x39cddb);}(_0xd44e,0x1c2));var _0xed44=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd44e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xed44('0x0'));var util=require(_0xed44('0x1'));var logger=require(_0xed44('0x2'))(_0xed44('0x3'));var moment=require(_0xed44('0x4'));var BPromise=require('bluebird');var rp=require(_0xed44('0x5'));var fs=require('fs');var path=require(_0xed44('0x6'));var rimraf=require(_0xed44('0x7'));var config=require(_0xed44('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xed44('0x9'));module[_0xed44('0xa')]=function(_0x3d75fa,_0x5b172a){return _0x3d75fa[_0xed44('0xb')](_0xed44('0xc'),attributes,{'tableName':_0xed44('0xd'),'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 8f2ab98..89e5f3b 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 _0x2bce=['find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','stringify','ShowSalesforceAccount'];(function(_0x29279c,_0x570176){var _0x279b1f=function(_0xd36d1f){while(--_0xd36d1f){_0x29279c['push'](_0x29279c['shift']());}};_0x279b1f(++_0x570176);}(_0x2bce,0x6d));var _0xe2bc=function(_0x356159,_0x3f9ae1){_0x356159=_0x356159-0x0;var _0x1488c4=_0x2bce[_0x356159];return _0x1488c4;};'use strict';var _=require(_0xe2bc('0x0'));var util=require(_0xe2bc('0x1'));var moment=require(_0xe2bc('0x2'));var BPromise=require('bluebird');var rs=require(_0xe2bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2bc('0x4'))['db'];var utils=require(_0xe2bc('0x5'));var logger=require(_0xe2bc('0x6'))(_0xe2bc('0x7'));var config=require(_0xe2bc('0x8'));var jayson=require(_0xe2bc('0x9'));var client=jayson['client'][_0xe2bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x494308,_0x4f5cf,_0x43e828){return new BPromise(function(_0x13b676,_0x316fc4){return client['request'](_0x494308,_0x43e828)[_0xe2bc('0xb')](function(_0x57d41b){logger[_0xe2bc('0xc')](_0xe2bc('0xd'),_0x4f5cf,'request\x20sent');logger[_0xe2bc('0xe')](_0xe2bc('0xf'),_0x4f5cf,_0xe2bc('0x10'),JSON['stringify'](_0x57d41b));if(_0x57d41b['error']){if(_0x57d41b[_0xe2bc('0x11')][_0xe2bc('0x12')]===0x1f4){logger[_0xe2bc('0x11')](_0xe2bc('0xd'),_0x4f5cf,_0x57d41b[_0xe2bc('0x11')][_0xe2bc('0x13')]);return _0x316fc4(_0x57d41b[_0xe2bc('0x11')][_0xe2bc('0x13')]);}logger[_0xe2bc('0x11')](_0xe2bc('0xd'),_0x4f5cf,_0x57d41b['error'][_0xe2bc('0x13')]);return _0x13b676(_0x57d41b['error'][_0xe2bc('0x13')]);}else{logger[_0xe2bc('0xc')](_0xe2bc('0xd'),_0x4f5cf,_0xe2bc('0x10'));_0x13b676(_0x57d41b[_0xe2bc('0x14')][_0xe2bc('0x13')]);}})[_0xe2bc('0x15')](function(_0x59af2e){logger[_0xe2bc('0x11')](_0xe2bc('0xd'),_0x4f5cf,_0x59af2e);_0x316fc4(_0x59af2e);});});}exports['GetSalesforceAccount']=function(_0x36dbb1){var _0x152ae7=this;return new Promise(function(_0x568cf7,_0x64baa3){return db[_0xe2bc('0x16')][_0xe2bc('0x17')]({'raw':_0x36dbb1['options']?_0x36dbb1[_0xe2bc('0x18')][_0xe2bc('0x19')]===undefined?!![]:![]:!![],'where':_0x36dbb1[_0xe2bc('0x18')]?_0x36dbb1[_0xe2bc('0x18')][_0xe2bc('0x1a')]||null:null,'attributes':_0x36dbb1[_0xe2bc('0x18')]?_0x36dbb1[_0xe2bc('0x18')][_0xe2bc('0x1b')]||null:null,'limit':_0x36dbb1[_0xe2bc('0x18')]?_0x36dbb1['options'][_0xe2bc('0x1c')]||null:null,'include':_0x36dbb1['options']?_0x36dbb1[_0xe2bc('0x18')][_0xe2bc('0x1d')]?_[_0xe2bc('0x1e')](_0x36dbb1[_0xe2bc('0x18')][_0xe2bc('0x1d')],function(_0x373942){return{'model':db[_0x373942[_0xe2bc('0x1f')]],'as':_0x373942['as'],'attributes':_0x373942['attributes'],'include':_0x373942[_0xe2bc('0x1d')]?_[_0xe2bc('0x1e')](_0x373942['include'],function(_0x2a16f0){return{'model':db[_0x2a16f0[_0xe2bc('0x1f')]],'as':_0x2a16f0['as'],'attributes':_0x2a16f0[_0xe2bc('0x1b')],'include':_0x2a16f0[_0xe2bc('0x1d')]?_[_0xe2bc('0x1e')](_0x2a16f0[_0xe2bc('0x1d')],function(_0x436f20){return{'model':db[_0x436f20[_0xe2bc('0x1f')]],'as':_0x436f20['as'],'attributes':_0x436f20[_0xe2bc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b0e05){logger[_0xe2bc('0xc')](_0xe2bc('0x20'),_0x36dbb1);logger[_0xe2bc('0xe')](_0xe2bc('0x20'),_0x36dbb1,JSON[_0xe2bc('0x21')](_0x1b0e05));_0x568cf7(_0x1b0e05);})[_0xe2bc('0x15')](function(_0x10e98c){logger[_0xe2bc('0x11')](_0xe2bc('0x20'),_0x10e98c[_0xe2bc('0x13')],_0x36dbb1);_0x64baa3(_0x152ae7[_0xe2bc('0x11')](0x1f4,_0x10e98c[_0xe2bc('0x13')]));});});};exports[_0xe2bc('0x22')]=function(_0x35ebbf){var _0x2b140c=this;return new Promise(function(_0x1cb9c4,_0x704e3c){return db[_0xe2bc('0x16')][_0xe2bc('0x23')]({'raw':_0x35ebbf['options']?_0x35ebbf[_0xe2bc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x35ebbf['options']?_0x35ebbf[_0xe2bc('0x18')]['where']||null:null,'attributes':_0x35ebbf[_0xe2bc('0x18')]?_0x35ebbf[_0xe2bc('0x18')][_0xe2bc('0x1b')]||null:null,'include':_0x35ebbf['options']?_0x35ebbf[_0xe2bc('0x18')][_0xe2bc('0x1d')]?_['map'](_0x35ebbf[_0xe2bc('0x18')]['include'],function(_0x437249){return{'model':db[_0x437249[_0xe2bc('0x1f')]],'as':_0x437249['as'],'attributes':_0x437249[_0xe2bc('0x1b')],'include':_0x437249['include']?_[_0xe2bc('0x1e')](_0x437249[_0xe2bc('0x1d')],function(_0x14f151){return{'model':db[_0x14f151[_0xe2bc('0x1f')]],'as':_0x14f151['as'],'attributes':_0x14f151['attributes'],'include':_0x14f151['include']?_[_0xe2bc('0x1e')](_0x14f151[_0xe2bc('0x1d')],function(_0x45ed59){return{'model':db[_0x45ed59[_0xe2bc('0x1f')]],'as':_0x45ed59['as'],'attributes':_0x45ed59[_0xe2bc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe2bc('0xb')](function(_0x14f79a){logger[_0xe2bc('0xc')](_0xe2bc('0x22'),_0x35ebbf);logger['debug']('ShowSalesforceAccount',_0x35ebbf,JSON[_0xe2bc('0x21')](_0x14f79a));_0x1cb9c4(_0x14f79a);})[_0xe2bc('0x15')](function(_0x3ce838){logger['error'](_0xe2bc('0x22'),_0x3ce838[_0xe2bc('0x13')],_0x35ebbf);_0x704e3c(_0x2b140c[_0xe2bc('0x11')](0x1f4,_0x3ce838['message']));});});}; \ No newline at end of file +var _0x6790=['raw','where','attributes','limit','include','map','model','GetSalesforceAccount','stringify','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','SalesforceAccount','findAll','options'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x6790,0xba));var _0x0679=function(_0x35bf64,_0x589bea){_0x35bf64=_0x35bf64-0x0;var _0x2bf3c4=_0x6790[_0x35bf64];return _0x2bf3c4;};'use strict';var _=require(_0x0679('0x0'));var util=require(_0x0679('0x1'));var moment=require('moment');var BPromise=require(_0x0679('0x2'));var rs=require(_0x0679('0x3'));var fs=require('fs');var Redis=require(_0x0679('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0679('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0679('0x6'));var jayson=require(_0x0679('0x7'));var client=jayson[_0x0679('0x8')][_0x0679('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26bf7e,_0x199390,_0x34027c){return new BPromise(function(_0x20e228,_0x320bb8){return client[_0x0679('0xa')](_0x26bf7e,_0x34027c)[_0x0679('0xb')](function(_0x102f9d){logger[_0x0679('0xc')](_0x0679('0xd'),_0x199390,_0x0679('0xe'));logger[_0x0679('0xf')](_0x0679('0x10'),_0x199390,_0x0679('0xe'),JSON['stringify'](_0x102f9d));if(_0x102f9d['error']){if(_0x102f9d[_0x0679('0x11')][_0x0679('0x12')]===0x1f4){logger[_0x0679('0x11')](_0x0679('0xd'),_0x199390,_0x102f9d[_0x0679('0x11')][_0x0679('0x13')]);return _0x320bb8(_0x102f9d['error']['message']);}logger['error'](_0x0679('0xd'),_0x199390,_0x102f9d[_0x0679('0x11')]['message']);return _0x20e228(_0x102f9d[_0x0679('0x11')]['message']);}else{logger[_0x0679('0xc')](_0x0679('0xd'),_0x199390,_0x0679('0xe'));_0x20e228(_0x102f9d['result']['message']);}})[_0x0679('0x14')](function(_0x26d04b){logger[_0x0679('0x11')](_0x0679('0xd'),_0x199390,_0x26d04b);_0x320bb8(_0x26d04b);});});}exports['GetSalesforceAccount']=function(_0x868357){var _0x149257=this;return new Promise(function(_0x1ac361,_0x490cd4){return db[_0x0679('0x15')][_0x0679('0x16')]({'raw':_0x868357[_0x0679('0x17')]?_0x868357[_0x0679('0x17')][_0x0679('0x18')]===undefined?!![]:![]:!![],'where':_0x868357['options']?_0x868357[_0x0679('0x17')][_0x0679('0x19')]||null:null,'attributes':_0x868357[_0x0679('0x17')]?_0x868357['options'][_0x0679('0x1a')]||null:null,'limit':_0x868357['options']?_0x868357[_0x0679('0x17')][_0x0679('0x1b')]||null:null,'include':_0x868357[_0x0679('0x17')]?_0x868357['options'][_0x0679('0x1c')]?_[_0x0679('0x1d')](_0x868357[_0x0679('0x17')][_0x0679('0x1c')],function(_0x7b84e6){return{'model':db[_0x7b84e6['model']],'as':_0x7b84e6['as'],'attributes':_0x7b84e6[_0x0679('0x1a')],'include':_0x7b84e6['include']?_[_0x0679('0x1d')](_0x7b84e6[_0x0679('0x1c')],function(_0x34311f){return{'model':db[_0x34311f['model']],'as':_0x34311f['as'],'attributes':_0x34311f[_0x0679('0x1a')],'include':_0x34311f[_0x0679('0x1c')]?_[_0x0679('0x1d')](_0x34311f[_0x0679('0x1c')],function(_0x54af35){return{'model':db[_0x54af35[_0x0679('0x1e')]],'as':_0x54af35['as'],'attributes':_0x54af35[_0x0679('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0679('0xb')](function(_0x1ca4c2){logger[_0x0679('0xc')]('GetSalesforceAccount',_0x868357);logger[_0x0679('0xf')](_0x0679('0x1f'),_0x868357,JSON[_0x0679('0x20')](_0x1ca4c2));_0x1ac361(_0x1ca4c2);})[_0x0679('0x14')](function(_0xf92c2b){logger[_0x0679('0x11')]('GetSalesforceAccount',_0xf92c2b[_0x0679('0x13')],_0x868357);_0x490cd4(_0x149257[_0x0679('0x11')](0x1f4,_0xf92c2b['message']));});});};exports[_0x0679('0x21')]=function(_0x37becc){var _0x1efb8c=this;return new Promise(function(_0x12c4d6,_0x8ad865){return db[_0x0679('0x15')][_0x0679('0x22')]({'raw':_0x37becc['options']?_0x37becc[_0x0679('0x17')][_0x0679('0x18')]===undefined?!![]:![]:!![],'where':_0x37becc[_0x0679('0x17')]?_0x37becc[_0x0679('0x17')][_0x0679('0x19')]||null:null,'attributes':_0x37becc[_0x0679('0x17')]?_0x37becc[_0x0679('0x17')][_0x0679('0x1a')]||null:null,'include':_0x37becc[_0x0679('0x17')]?_0x37becc['options'][_0x0679('0x1c')]?_[_0x0679('0x1d')](_0x37becc[_0x0679('0x17')][_0x0679('0x1c')],function(_0x2f1957){return{'model':db[_0x2f1957['model']],'as':_0x2f1957['as'],'attributes':_0x2f1957[_0x0679('0x1a')],'include':_0x2f1957['include']?_[_0x0679('0x1d')](_0x2f1957[_0x0679('0x1c')],function(_0x15c1e1){return{'model':db[_0x15c1e1[_0x0679('0x1e')]],'as':_0x15c1e1['as'],'attributes':_0x15c1e1[_0x0679('0x1a')],'include':_0x15c1e1[_0x0679('0x1c')]?_['map'](_0x15c1e1[_0x0679('0x1c')],function(_0x505338){return{'model':db[_0x505338['model']],'as':_0x505338['as'],'attributes':_0x505338[_0x0679('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x501a53){logger[_0x0679('0xc')](_0x0679('0x21'),_0x37becc);logger[_0x0679('0xf')](_0x0679('0x21'),_0x37becc,JSON[_0x0679('0x20')](_0x501a53));_0x12c4d6(_0x501a53);})[_0x0679('0x14')](function(_0x515dc0){logger[_0x0679('0x11')](_0x0679('0x21'),_0x515dc0[_0x0679('0x13')],_0x37becc);_0x8ad865(_0x1efb8c['error'](0x1f4,_0x515dc0[_0x0679('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 4cbe92f..9db9b44 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xdb28,0x106));var _0x8db2=function(_0x1c1a48,_0x1e2638){_0x1c1a48=_0x1c1a48-0x0;var _0x579fe9=_0xdb28[_0x1c1a48];return _0x579fe9;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x3e1495,_0x224932){var _0x5670e6=function(_0x27b7e5){while(--_0x27b7e5){_0x3e1495['push'](_0x3e1495['shift']());}};_0x5670e6(++_0x224932);}(_0x2ef3,0xba));var _0x32ef=function(_0x5977fd,_0x440ca6){_0x5977fd=_0x5977fd-0x0;var _0x56a388=_0x2ef3[_0x5977fd];return _0x56a388;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 20975e4..8e665f6 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 _0x99f5=['lead','account_contact_lead','account','nothing','contact','exports','STRING','Task','ENUM','contact_lead'];(function(_0x3109e6,_0x3e0450){var _0x12aed5=function(_0x492ec2){while(--_0x492ec2){_0x3109e6['push'](_0x3109e6['shift']());}};_0x12aed5(++_0x3e0450);}(_0x99f5,0x16d));var _0x599f=function(_0x4f8835,_0x270e13){_0x4f8835=_0x4f8835-0x0;var _0x5c75fe=_0x99f5[_0x4f8835];return _0x5c75fe;};'use strict';var Sequelize=require('sequelize');module[_0x599f('0x0')]={'name':{'type':Sequelize[_0x599f('0x1')]},'description':{'type':Sequelize[_0x599f('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x599f('0x2'),'Case'),'defaultValue':_0x599f('0x2')},'moduleSearch':{'type':Sequelize[_0x599f('0x3')](_0x599f('0x4'),'contact',_0x599f('0x5'),_0x599f('0x6'),_0x599f('0x7')),'defaultValue':_0x599f('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x599f('0x8'),_0x599f('0x9'),_0x599f('0x5'),_0x599f('0x7')),'defaultValue':_0x599f('0x5')},'leadId':{'type':Sequelize[_0x599f('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x599f('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x599f('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x599f('0x1')]}}; \ No newline at end of file +var _0xe192=['lead','account_contact_lead','nothing','account','STRING','ENUM','Task','contact_lead','contact'];(function(_0x1a33bc,_0x53cb68){var _0x4e9dfa=function(_0x473265){while(--_0x473265){_0x1a33bc['push'](_0x1a33bc['shift']());}};_0x4e9dfa(++_0x53cb68);}(_0xe192,0x8b));var _0x2e19=function(_0x127619,_0x24961d){_0x127619=_0x127619-0x0;var _0x1a0ffb=_0xe192[_0x127619];return _0x1a0ffb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2e19('0x0')]},'ticketType':{'type':Sequelize[_0x2e19('0x1')](_0x2e19('0x2'),'Case'),'defaultValue':_0x2e19('0x2')},'moduleSearch':{'type':Sequelize[_0x2e19('0x1')](_0x2e19('0x3'),_0x2e19('0x4'),_0x2e19('0x5'),_0x2e19('0x6'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x2e19('0x1')](_0x2e19('0x7'),_0x2e19('0x4'),_0x2e19('0x5'),_0x2e19('0x8')),'defaultValue':_0x2e19('0x5')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x2e19('0x0')]},'additionalSearchContact':{'type':Sequelize[_0x2e19('0x0')]},'additionalSearchLead':{'type':Sequelize[_0x2e19('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 54aa09b..1364512 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 _0x4b0c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','offset','limit','undefined','count','status','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','params','includeAll','find','catch','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2729cd,_0x462966){var _0x1c259=function(_0x51f3a4){while(--_0x51f3a4){_0x2729cd['push'](_0x2729cd['shift']());}};_0x1c259(++_0x462966);}(_0x4b0c,0x138));var _0xc4b0=function(_0x5b2e9b,_0x1f80f2){_0x5b2e9b=_0x5b2e9b-0x0;var _0x49dc70=_0x4b0c[_0x5b2e9b];return _0x49dc70;};'use strict';var emlformat=require(_0xc4b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4b0('0x1'));var jsonpatch=require(_0xc4b0('0x2'));var rp=require('request-promise');var moment=require(_0xc4b0('0x3'));var BPromise=require(_0xc4b0('0x4'));var Mustache=require(_0xc4b0('0x5'));var util=require(_0xc4b0('0x6'));var path=require(_0xc4b0('0x7'));var sox=require(_0xc4b0('0x8'));var csv=require(_0xc4b0('0x9'));var ejs=require(_0xc4b0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4b0('0xb'));var squel=require(_0xc4b0('0xc'));var crypto=require(_0xc4b0('0xd'));var jsforce=require(_0xc4b0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc4b0('0x9'));var querystring=require(_0xc4b0('0xf'));var Papa=require(_0xc4b0('0x10'));var Redis=require(_0xc4b0('0x11'));var authService=require(_0xc4b0('0x12'));var qs=require(_0xc4b0('0x13'));var as=require(_0xc4b0('0x14'));var hardwareService=require(_0xc4b0('0x15'));var logger=require(_0xc4b0('0x16'))(_0xc4b0('0x17'));var utils=require(_0xc4b0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc4b0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50ed91,_0x4cccb5){_0x4cccb5=_0x4cccb5||0xcc;return function(_0x542faf){if(_0x542faf){return _0x50ed91[_0xc4b0('0x1a')](_0x4cccb5);}return _0x50ed91['status'](_0x4cccb5)[_0xc4b0('0x1b')]();};}function respondWithResult(_0x5f74ef,_0x5eba58){_0x5eba58=_0x5eba58||0xc8;return function(_0xf6cc8d){if(_0xf6cc8d){return _0x5f74ef['status'](_0x5eba58)[_0xc4b0('0x1c')](_0xf6cc8d);}};}function respondWithFilteredResult(_0x5ea045,_0x3476e0){return function(_0xa08988){if(_0xa08988){var _0x153ef1=typeof _0x3476e0[_0xc4b0('0x1d')]==='undefined'&&typeof _0x3476e0[_0xc4b0('0x1e')]===_0xc4b0('0x1f');var _0x32b3ba=_0xa08988[_0xc4b0('0x20')];var _0x2e5929=_0x153ef1?0x0:_0x3476e0[_0xc4b0('0x1d')];var _0x191d5c=_0x153ef1?_0xa08988['count']:_0x3476e0['offset']+_0x3476e0[_0xc4b0('0x1e')];var _0x236961;if(_0x191d5c>=_0x32b3ba){_0x191d5c=_0x32b3ba;_0x236961=0xc8;}else{_0x236961=0xce;}_0x5ea045[_0xc4b0('0x21')](_0x236961);return _0x5ea045['set'](_0xc4b0('0x22'),_0x2e5929+'-'+_0x191d5c+'/'+_0x32b3ba)[_0xc4b0('0x1c')](_0xa08988);}return null;};}function patchUpdates(_0x548399){return function(_0x275641){try{jsonpatch[_0xc4b0('0x23')](_0x275641,_0x548399,!![]);}catch(_0x57e782){return BPromise[_0xc4b0('0x24')](_0x57e782);}return _0x275641[_0xc4b0('0x25')]();};}function saveUpdates(_0x3a9e29,_0x3f9e11){return function(_0x248721){if(_0x248721){return _0x248721[_0xc4b0('0x26')](_0x3a9e29)['then'](function(_0x1fb4e0){return _0x1fb4e0;});}return null;};}function removeEntity(_0x1d714a,_0xdd3af6){return function(_0x5914fb){if(_0x5914fb){return _0x5914fb[_0xc4b0('0x27')]()[_0xc4b0('0x28')](function(){_0x1d714a[_0xc4b0('0x21')](0xcc)[_0xc4b0('0x1b')]();});}};}function handleEntityNotFound(_0x25e259,_0x306545){return function(_0x2fe684){if(!_0x2fe684){_0x25e259[_0xc4b0('0x1a')](0x194);}return _0x2fe684;};}function handleError(_0xe8470d,_0x87e9e){_0x87e9e=_0x87e9e||0x1f4;return function(_0x31379f){logger[_0xc4b0('0x29')](_0x31379f[_0xc4b0('0x2a')]);if(_0x31379f['name']){delete _0x31379f[_0xc4b0('0x2b')];}_0xe8470d[_0xc4b0('0x21')](_0x87e9e)[_0xc4b0('0x2c')](_0x31379f);};}exports[_0xc4b0('0x2d')]=function(_0x41c38d,_0x465e8a){var _0x2600a3={},_0x245f6f={},_0x1b1228={'count':0x0,'rows':[]};var _0x45b88c=_[_0xc4b0('0x2e')](db[_0xc4b0('0x2f')][_0xc4b0('0x30')],function(_0x59b088){return{'name':_0x59b088[_0xc4b0('0x31')],'type':_0x59b088[_0xc4b0('0x32')]['key']};});_0x245f6f[_0xc4b0('0x33')]=_[_0xc4b0('0x2e')](_0x45b88c,'name');_0x245f6f['query']=_[_0xc4b0('0x34')](_0x41c38d[_0xc4b0('0x35')]);_0x245f6f[_0xc4b0('0x36')]=_[_0xc4b0('0x37')](_0x245f6f[_0xc4b0('0x33')],_0x245f6f['query']);_0x2600a3[_0xc4b0('0x38')]=_['intersection'](_0x245f6f[_0xc4b0('0x33')],qs[_0xc4b0('0x39')](_0x41c38d['query'][_0xc4b0('0x39')]));_0x2600a3[_0xc4b0('0x38')]=_0x2600a3[_0xc4b0('0x38')][_0xc4b0('0x3a')]?_0x2600a3[_0xc4b0('0x38')]:_0x245f6f[_0xc4b0('0x33')];if(!_0x41c38d['query'][_0xc4b0('0x3b')](_0xc4b0('0x3c'))){_0x2600a3[_0xc4b0('0x1e')]=qs[_0xc4b0('0x1e')](_0x41c38d[_0xc4b0('0x35')][_0xc4b0('0x1e')]);_0x2600a3['offset']=qs[_0xc4b0('0x1d')](_0x41c38d[_0xc4b0('0x35')]['offset']);}_0x2600a3[_0xc4b0('0x3d')]=qs['sort'](_0x41c38d[_0xc4b0('0x35')][_0xc4b0('0x3e')]);_0x2600a3[_0xc4b0('0x3f')]=qs[_0xc4b0('0x36')](_[_0xc4b0('0x40')](_0x41c38d[_0xc4b0('0x35')],_0x245f6f[_0xc4b0('0x36')]),_0x45b88c);if(_0x41c38d[_0xc4b0('0x35')][_0xc4b0('0x41')]){_0x2600a3['where']=_['merge'](_0x2600a3[_0xc4b0('0x3f')],{'$or':_[_0xc4b0('0x2e')](_0x45b88c,function(_0xf1ac79){if(_0xf1ac79[_0xc4b0('0x32')]!==_0xc4b0('0x42')){var _0x310c26={};_0x310c26[_0xf1ac79[_0xc4b0('0x2b')]]={'$like':'%'+_0x41c38d[_0xc4b0('0x35')][_0xc4b0('0x41')]+'%'};return _0x310c26;}})});}_0x2600a3=_[_0xc4b0('0x43')]({},_0x2600a3,_0x41c38d[_0xc4b0('0x44')]);var _0x17bf8c={'where':_0x2600a3['where']};return db[_0xc4b0('0x2f')][_0xc4b0('0x20')](_0x17bf8c)[_0xc4b0('0x28')](function(_0x5dff89){_0x1b1228[_0xc4b0('0x20')]=_0x5dff89;if(_0x41c38d[_0xc4b0('0x35')]['includeAll']){_0x2600a3[_0xc4b0('0x45')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x2600a3);})[_0xc4b0('0x28')](function(_0x5f31b1){_0x1b1228[_0xc4b0('0x46')]=_0x5f31b1;return _0x1b1228;})[_0xc4b0('0x28')](respondWithFilteredResult(_0x465e8a,_0x2600a3))['catch'](handleError(_0x465e8a,null));};exports[_0xc4b0('0x47')]=function(_0x3db619,_0x134602){var _0x1a16de={'raw':![],'where':{'id':_0x3db619[_0xc4b0('0x48')]['id']}},_0x592c96={};_0x592c96['model']=_[_0xc4b0('0x34')](db[_0xc4b0('0x2f')]['rawAttributes']);_0x592c96[_0xc4b0('0x35')]=_[_0xc4b0('0x34')](_0x3db619[_0xc4b0('0x35')]);_0x592c96[_0xc4b0('0x36')]=_[_0xc4b0('0x37')](_0x592c96[_0xc4b0('0x33')],_0x592c96[_0xc4b0('0x35')]);_0x1a16de['attributes']=_[_0xc4b0('0x37')](_0x592c96['model'],qs[_0xc4b0('0x39')](_0x3db619[_0xc4b0('0x35')]['fields']));_0x1a16de[_0xc4b0('0x38')]=_0x1a16de[_0xc4b0('0x38')][_0xc4b0('0x3a')]?_0x1a16de['attributes']:_0x592c96[_0xc4b0('0x33')];if(_0x3db619[_0xc4b0('0x35')][_0xc4b0('0x49')]){_0x1a16de['include']=[{'all':!![]}];}_0x1a16de=_[_0xc4b0('0x43')]({},_0x1a16de,_0x3db619['options']);return db[_0xc4b0('0x2f')][_0xc4b0('0x4a')](_0x1a16de)['then'](handleEntityNotFound(_0x134602,null))['then'](respondWithResult(_0x134602,null))[_0xc4b0('0x4b')](handleError(_0x134602,null));};exports[_0xc4b0('0x4c')]=function(_0x301ecd,_0x519203){return db['SalesforceConfiguration'][_0xc4b0('0x4c')](_0x301ecd[_0xc4b0('0x4d')],{})['then'](respondWithResult(_0x519203,0xc9))[_0xc4b0('0x4b')](handleError(_0x519203,null));};exports['update']=function(_0x4a982b,_0x3291c0){if(_0x4a982b[_0xc4b0('0x4d')]['id']){delete _0x4a982b[_0xc4b0('0x4d')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x4a982b['params']['id']}})[_0xc4b0('0x28')](handleEntityNotFound(_0x3291c0,null))['then'](saveUpdates(_0x4a982b[_0xc4b0('0x4d')],null))[_0xc4b0('0x28')](respondWithResult(_0x3291c0,null))[_0xc4b0('0x4b')](handleError(_0x3291c0,null));};exports[_0xc4b0('0x27')]=function(_0x4f1211,_0x56e7e1){return db[_0xc4b0('0x2f')]['find']({'where':{'id':_0x4f1211[_0xc4b0('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e7e1,null))['then'](removeEntity(_0x56e7e1,null))[_0xc4b0('0x4b')](handleError(_0x56e7e1,null));};exports[_0xc4b0('0x4e')]=function(_0x3de769,_0x31e92f,_0x382314){var _0x7bc1d9={};var _0x1e7bf2={};var _0x571c7f;var _0x22a544;return db['SalesforceConfiguration'][_0xc4b0('0x4f')]({'where':{'id':_0x3de769[_0xc4b0('0x48')]['id']}})[_0xc4b0('0x28')](handleEntityNotFound(_0x31e92f,null))[_0xc4b0('0x28')](function(_0x507675){if(_0x507675){_0x571c7f=_0x507675;_0x1e7bf2['model']=_[_0xc4b0('0x34')](db[_0xc4b0('0x50')][_0xc4b0('0x30')]);_0x1e7bf2[_0xc4b0('0x35')]=_[_0xc4b0('0x34')](_0x3de769[_0xc4b0('0x35')]);_0x1e7bf2[_0xc4b0('0x36')]=_[_0xc4b0('0x37')](_0x1e7bf2['model'],_0x1e7bf2['query']);_0x7bc1d9[_0xc4b0('0x38')]=_[_0xc4b0('0x37')](_0x1e7bf2[_0xc4b0('0x33')],qs[_0xc4b0('0x39')](_0x3de769['query'][_0xc4b0('0x39')]));_0x7bc1d9[_0xc4b0('0x38')]=_0x7bc1d9['attributes']['length']?_0x7bc1d9['attributes']:_0x1e7bf2['model'];_0x7bc1d9['order']=qs[_0xc4b0('0x3e')](_0x3de769[_0xc4b0('0x35')][_0xc4b0('0x3e')]);_0x7bc1d9[_0xc4b0('0x3f')]=qs['filters'](_[_0xc4b0('0x40')](_0x3de769[_0xc4b0('0x35')],_0x1e7bf2[_0xc4b0('0x36')]));if(_0x3de769[_0xc4b0('0x35')]['filter']){_0x7bc1d9[_0xc4b0('0x3f')]=_['merge'](_0x7bc1d9['where'],{'$or':_['map'](_0x7bc1d9[_0xc4b0('0x38')],function(_0x52b359){var _0x2aaca1={};_0x2aaca1[_0x52b359]={'$like':'%'+_0x3de769['query'][_0xc4b0('0x41')]+'%'};return _0x2aaca1;})});}_0x7bc1d9=_[_0xc4b0('0x43')]({},_0x7bc1d9,_0x3de769[_0xc4b0('0x44')]);return _0x571c7f[_0xc4b0('0x4e')](_0x7bc1d9);}})['then'](function(_0xc90880){if(_0xc90880){_0x22a544=_0xc90880[_0xc4b0('0x3a')];if(!_0x3de769[_0xc4b0('0x35')][_0xc4b0('0x3b')]('nolimit')){_0x7bc1d9[_0xc4b0('0x1e')]=qs[_0xc4b0('0x1e')](_0x3de769[_0xc4b0('0x35')][_0xc4b0('0x1e')]);_0x7bc1d9['offset']=qs[_0xc4b0('0x1d')](_0x3de769[_0xc4b0('0x35')]['offset']);}return _0x571c7f[_0xc4b0('0x4e')](_0x7bc1d9);}})[_0xc4b0('0x28')](function(_0x319d37){if(_0x319d37){return _0x319d37?{'count':_0x22a544,'rows':_0x319d37}:null;}})[_0xc4b0('0x28')](respondWithResult(_0x31e92f,null))[_0xc4b0('0x4b')](handleError(_0x31e92f,null));};exports['getSubjects']=function(_0x550ad5,_0x454b8e,_0x5af9fc){var _0x49f267={};var _0x5d18c1={};var _0x53a534;var _0x52861f;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x550ad5['params']['id']}})[_0xc4b0('0x28')](handleEntityNotFound(_0x454b8e,null))[_0xc4b0('0x28')](function(_0x34c330){if(_0x34c330){_0x53a534=_0x34c330;_0x5d18c1[_0xc4b0('0x33')]=_['keys'](db[_0xc4b0('0x50')][_0xc4b0('0x30')]);_0x5d18c1[_0xc4b0('0x35')]=_[_0xc4b0('0x34')](_0x550ad5['query']);_0x5d18c1['filters']=_['intersection'](_0x5d18c1[_0xc4b0('0x33')],_0x5d18c1['query']);_0x49f267[_0xc4b0('0x38')]=_[_0xc4b0('0x37')](_0x5d18c1['model'],qs[_0xc4b0('0x39')](_0x550ad5[_0xc4b0('0x35')]['fields']));_0x49f267[_0xc4b0('0x38')]=_0x49f267[_0xc4b0('0x38')][_0xc4b0('0x3a')]?_0x49f267[_0xc4b0('0x38')]:_0x5d18c1[_0xc4b0('0x33')];_0x49f267['order']=qs[_0xc4b0('0x3e')](_0x550ad5[_0xc4b0('0x35')]['sort']);_0x49f267[_0xc4b0('0x3f')]=qs[_0xc4b0('0x36')](_[_0xc4b0('0x40')](_0x550ad5[_0xc4b0('0x35')],_0x5d18c1[_0xc4b0('0x36')]));if(_0x550ad5['query'][_0xc4b0('0x41')]){_0x49f267[_0xc4b0('0x3f')]=_['merge'](_0x49f267[_0xc4b0('0x3f')],{'$or':_[_0xc4b0('0x2e')](_0x49f267[_0xc4b0('0x38')],function(_0x468a06){var _0x379a33={};_0x379a33[_0x468a06]={'$like':'%'+_0x550ad5[_0xc4b0('0x35')][_0xc4b0('0x41')]+'%'};return _0x379a33;})});}_0x49f267=_[_0xc4b0('0x43')]({},_0x49f267,_0x550ad5['options']);return _0x53a534[_0xc4b0('0x51')](_0x49f267);}})['then'](function(_0x54ab07){if(_0x54ab07){_0x52861f=_0x54ab07[_0xc4b0('0x3a')];if(!_0x550ad5[_0xc4b0('0x35')][_0xc4b0('0x3b')](_0xc4b0('0x3c'))){_0x49f267[_0xc4b0('0x1e')]=qs['limit'](_0x550ad5[_0xc4b0('0x35')]['limit']);_0x49f267[_0xc4b0('0x1d')]=qs['offset'](_0x550ad5[_0xc4b0('0x35')][_0xc4b0('0x1d')]);}return _0x53a534[_0xc4b0('0x51')](_0x49f267);}})[_0xc4b0('0x28')](function(_0x98dd31){if(_0x98dd31){return _0x98dd31?{'count':_0x52861f,'rows':_0x98dd31}:null;}})[_0xc4b0('0x28')](respondWithResult(_0x454b8e,null))[_0xc4b0('0x4b')](handleError(_0x454b8e,null));};exports['getDescriptions']=function(_0x4522e8,_0x1e53b7,_0x3c83e){var _0x1042d9={};var _0x1f0634={};var _0x45bdc2;var _0x58c9db;return db[_0xc4b0('0x2f')][_0xc4b0('0x4f')]({'where':{'id':_0x4522e8[_0xc4b0('0x48')]['id']}})[_0xc4b0('0x28')](handleEntityNotFound(_0x1e53b7,null))['then'](function(_0x3c3040){if(_0x3c3040){_0x45bdc2=_0x3c3040;_0x1f0634[_0xc4b0('0x33')]=_[_0xc4b0('0x34')](db[_0xc4b0('0x50')][_0xc4b0('0x30')]);_0x1f0634[_0xc4b0('0x35')]=_[_0xc4b0('0x34')](_0x4522e8[_0xc4b0('0x35')]);_0x1f0634[_0xc4b0('0x36')]=_['intersection'](_0x1f0634[_0xc4b0('0x33')],_0x1f0634['query']);_0x1042d9['attributes']=_[_0xc4b0('0x37')](_0x1f0634['model'],qs[_0xc4b0('0x39')](_0x4522e8[_0xc4b0('0x35')]['fields']));_0x1042d9[_0xc4b0('0x38')]=_0x1042d9['attributes'][_0xc4b0('0x3a')]?_0x1042d9[_0xc4b0('0x38')]:_0x1f0634[_0xc4b0('0x33')];_0x1042d9[_0xc4b0('0x3d')]=qs[_0xc4b0('0x3e')](_0x4522e8[_0xc4b0('0x35')][_0xc4b0('0x3e')]);_0x1042d9[_0xc4b0('0x3f')]=qs['filters'](_[_0xc4b0('0x40')](_0x4522e8[_0xc4b0('0x35')],_0x1f0634['filters']));if(_0x4522e8[_0xc4b0('0x35')][_0xc4b0('0x41')]){_0x1042d9[_0xc4b0('0x3f')]=_[_0xc4b0('0x43')](_0x1042d9['where'],{'$or':_[_0xc4b0('0x2e')](_0x1042d9[_0xc4b0('0x38')],function(_0x255278){var _0x540877={};_0x540877[_0x255278]={'$like':'%'+_0x4522e8[_0xc4b0('0x35')]['filter']+'%'};return _0x540877;})});}_0x1042d9=_[_0xc4b0('0x43')]({},_0x1042d9,_0x4522e8['options']);return _0x45bdc2[_0xc4b0('0x52')](_0x1042d9);}})[_0xc4b0('0x28')](function(_0xc7987f){if(_0xc7987f){_0x58c9db=_0xc7987f[_0xc4b0('0x3a')];if(!_0x4522e8[_0xc4b0('0x35')]['hasOwnProperty'](_0xc4b0('0x3c'))){_0x1042d9[_0xc4b0('0x1e')]=qs[_0xc4b0('0x1e')](_0x4522e8[_0xc4b0('0x35')][_0xc4b0('0x1e')]);_0x1042d9['offset']=qs[_0xc4b0('0x1d')](_0x4522e8[_0xc4b0('0x35')][_0xc4b0('0x1d')]);}return _0x45bdc2[_0xc4b0('0x52')](_0x1042d9);}})[_0xc4b0('0x28')](function(_0x42915c){if(_0x42915c){return _0x42915c?{'count':_0x58c9db,'rows':_0x42915c}:null;}})[_0xc4b0('0x28')](respondWithResult(_0x1e53b7,null))['catch'](handleError(_0x1e53b7,null));}; \ No newline at end of file +var _0x32c2=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','reject','save','update','then','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','map','VIRTUAL','merge','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','destroy','getFields','findOne','SalesforceField','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3e37b3,_0x570305){var _0x47e724=function(_0x3f4884){while(--_0x3f4884){_0x3e37b3['push'](_0x3e37b3['shift']());}};_0x47e724(++_0x570305);}(_0x32c2,0x90));var _0x232c=function(_0x94ce99,_0x3dea11){_0x94ce99=_0x94ce99-0x0;var _0x2bd0d2=_0x32c2[_0x94ce99];return _0x2bd0d2;};'use strict';var emlformat=require(_0x232c('0x0'));var rimraf=require(_0x232c('0x1'));var zipdir=require(_0x232c('0x2'));var jsonpatch=require(_0x232c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x232c('0x4'));var util=require('util');var path=require(_0x232c('0x5'));var sox=require(_0x232c('0x6'));var csv=require(_0x232c('0x7'));var ejs=require(_0x232c('0x8'));var fs=require('fs');var fs_extra=require(_0x232c('0x9'));var _=require(_0x232c('0xa'));var squel=require(_0x232c('0xb'));var crypto=require(_0x232c('0xc'));var jsforce=require(_0x232c('0xd'));var deskjs=require(_0x232c('0xe'));var toCsv=require(_0x232c('0x7'));var querystring=require(_0x232c('0xf'));var Papa=require(_0x232c('0x10'));var Redis=require(_0x232c('0x11'));var authService=require(_0x232c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x232c('0x13'));var hardwareService=require(_0x232c('0x14'));var logger=require('../../config/logger')(_0x232c('0x15'));var utils=require('../../config/utils');var config=require(_0x232c('0x16'));var licenseUtil=require(_0x232c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c85f9,_0x3cb2e3){_0x3cb2e3=_0x3cb2e3||0xcc;return function(_0x1a87b1){if(_0x1a87b1){return _0x5c85f9[_0x232c('0x18')](_0x3cb2e3);}return _0x5c85f9[_0x232c('0x19')](_0x3cb2e3)[_0x232c('0x1a')]();};}function respondWithResult(_0x46073c,_0x6eccd7){_0x6eccd7=_0x6eccd7||0xc8;return function(_0xb3a102){if(_0xb3a102){return _0x46073c[_0x232c('0x19')](_0x6eccd7)[_0x232c('0x1b')](_0xb3a102);}};}function respondWithFilteredResult(_0x56dede,_0x28218b){return function(_0x4fd45c){if(_0x4fd45c){var _0x2e8d28=typeof _0x28218b['offset']===_0x232c('0x1c')&&typeof _0x28218b['limit']===_0x232c('0x1c');var _0xad4a86=_0x4fd45c[_0x232c('0x1d')];var _0x4b5648=_0x2e8d28?0x0:_0x28218b[_0x232c('0x1e')];var _0x3a4579=_0x2e8d28?_0x4fd45c[_0x232c('0x1d')]:_0x28218b[_0x232c('0x1e')]+_0x28218b['limit'];var _0x3e57b5;if(_0x3a4579>=_0xad4a86){_0x3a4579=_0xad4a86;_0x3e57b5=0xc8;}else{_0x3e57b5=0xce;}_0x56dede['status'](_0x3e57b5);return _0x56dede['set']('Content-Range',_0x4b5648+'-'+_0x3a4579+'/'+_0xad4a86)[_0x232c('0x1b')](_0x4fd45c);}return null;};}function patchUpdates(_0x28c202){return function(_0x4f51c3){try{jsonpatch['apply'](_0x4f51c3,_0x28c202,!![]);}catch(_0x2196a2){return BPromise[_0x232c('0x1f')](_0x2196a2);}return _0x4f51c3[_0x232c('0x20')]();};}function saveUpdates(_0x10d1c6,_0x1abaf6){return function(_0x3883c1){if(_0x3883c1){return _0x3883c1[_0x232c('0x21')](_0x10d1c6)[_0x232c('0x22')](function(_0x336fba){return _0x336fba;});}return null;};}function removeEntity(_0x2a1e70,_0x305c91){return function(_0x1f3cb2){if(_0x1f3cb2){return _0x1f3cb2['destroy']()[_0x232c('0x22')](function(){_0x2a1e70[_0x232c('0x19')](0xcc)[_0x232c('0x1a')]();});}};}function handleEntityNotFound(_0x5b64e1,_0x332428){return function(_0x277346){if(!_0x277346){_0x5b64e1[_0x232c('0x18')](0x194);}return _0x277346;};}function handleError(_0x178b65,_0x330604){_0x330604=_0x330604||0x1f4;return function(_0x4d8bb6){logger[_0x232c('0x23')](_0x4d8bb6[_0x232c('0x24')]);if(_0x4d8bb6[_0x232c('0x25')]){delete _0x4d8bb6[_0x232c('0x25')];}_0x178b65[_0x232c('0x19')](_0x330604)[_0x232c('0x26')](_0x4d8bb6);};}exports[_0x232c('0x27')]=function(_0x35e1b0,_0x6636ac){var _0x158460={},_0x4317ea={},_0x5752f0={'count':0x0,'rows':[]};var _0x57d665=_['map'](db[_0x232c('0x28')][_0x232c('0x29')],function(_0x232970){return{'name':_0x232970[_0x232c('0x2a')],'type':_0x232970[_0x232c('0x2b')][_0x232c('0x2c')]};});_0x4317ea[_0x232c('0x2d')]=_['map'](_0x57d665,'name');_0x4317ea[_0x232c('0x2e')]=_[_0x232c('0x2f')](_0x35e1b0[_0x232c('0x2e')]);_0x4317ea[_0x232c('0x30')]=_[_0x232c('0x31')](_0x4317ea[_0x232c('0x2d')],_0x4317ea['query']);_0x158460[_0x232c('0x32')]=_[_0x232c('0x31')](_0x4317ea[_0x232c('0x2d')],qs[_0x232c('0x33')](_0x35e1b0[_0x232c('0x2e')][_0x232c('0x33')]));_0x158460[_0x232c('0x32')]=_0x158460[_0x232c('0x32')][_0x232c('0x34')]?_0x158460[_0x232c('0x32')]:_0x4317ea[_0x232c('0x2d')];if(!_0x35e1b0[_0x232c('0x2e')]['hasOwnProperty']('nolimit')){_0x158460[_0x232c('0x35')]=qs['limit'](_0x35e1b0['query'][_0x232c('0x35')]);_0x158460[_0x232c('0x1e')]=qs[_0x232c('0x1e')](_0x35e1b0[_0x232c('0x2e')][_0x232c('0x1e')]);}_0x158460[_0x232c('0x36')]=qs['sort'](_0x35e1b0[_0x232c('0x2e')][_0x232c('0x37')]);_0x158460[_0x232c('0x38')]=qs[_0x232c('0x30')](_[_0x232c('0x39')](_0x35e1b0[_0x232c('0x2e')],_0x4317ea[_0x232c('0x30')]),_0x57d665);if(_0x35e1b0[_0x232c('0x2e')][_0x232c('0x3a')]){_0x158460[_0x232c('0x38')]=_['merge'](_0x158460[_0x232c('0x38')],{'$or':_[_0x232c('0x3b')](_0x57d665,function(_0x9e5650){if(_0x9e5650['type']!==_0x232c('0x3c')){var _0x1e0482={};_0x1e0482[_0x9e5650['name']]={'$like':'%'+_0x35e1b0['query']['filter']+'%'};return _0x1e0482;}})});}_0x158460=_[_0x232c('0x3d')]({},_0x158460,_0x35e1b0['options']);var _0x35bf9d={'where':_0x158460[_0x232c('0x38')]};return db[_0x232c('0x28')]['count'](_0x35bf9d)[_0x232c('0x22')](function(_0x7a25f5){_0x5752f0[_0x232c('0x1d')]=_0x7a25f5;if(_0x35e1b0[_0x232c('0x2e')]['includeAll']){_0x158460['include']=[{'all':!![]}];}return db[_0x232c('0x28')][_0x232c('0x3e')](_0x158460);})['then'](function(_0xc10f0b){_0x5752f0[_0x232c('0x3f')]=_0xc10f0b;return _0x5752f0;})['then'](respondWithFilteredResult(_0x6636ac,_0x158460))[_0x232c('0x40')](handleError(_0x6636ac,null));};exports[_0x232c('0x41')]=function(_0x29e674,_0x3fe0ba){var _0x2a35e1={'raw':![],'where':{'id':_0x29e674[_0x232c('0x42')]['id']}},_0x8721ff={};_0x8721ff[_0x232c('0x2d')]=_[_0x232c('0x2f')](db[_0x232c('0x28')][_0x232c('0x29')]);_0x8721ff[_0x232c('0x2e')]=_[_0x232c('0x2f')](_0x29e674[_0x232c('0x2e')]);_0x8721ff[_0x232c('0x30')]=_[_0x232c('0x31')](_0x8721ff[_0x232c('0x2d')],_0x8721ff[_0x232c('0x2e')]);_0x2a35e1[_0x232c('0x32')]=_[_0x232c('0x31')](_0x8721ff[_0x232c('0x2d')],qs['fields'](_0x29e674['query']['fields']));_0x2a35e1[_0x232c('0x32')]=_0x2a35e1[_0x232c('0x32')][_0x232c('0x34')]?_0x2a35e1[_0x232c('0x32')]:_0x8721ff[_0x232c('0x2d')];if(_0x29e674['query'][_0x232c('0x43')]){_0x2a35e1[_0x232c('0x44')]=[{'all':!![]}];}_0x2a35e1=_[_0x232c('0x3d')]({},_0x2a35e1,_0x29e674[_0x232c('0x45')]);return db[_0x232c('0x28')][_0x232c('0x46')](_0x2a35e1)[_0x232c('0x22')](handleEntityNotFound(_0x3fe0ba,null))['then'](respondWithResult(_0x3fe0ba,null))[_0x232c('0x40')](handleError(_0x3fe0ba,null));};exports[_0x232c('0x47')]=function(_0x24c209,_0x1bdd6b){return db['SalesforceConfiguration']['create'](_0x24c209[_0x232c('0x48')],{})[_0x232c('0x22')](respondWithResult(_0x1bdd6b,0xc9))[_0x232c('0x40')](handleError(_0x1bdd6b,null));};exports['update']=function(_0x186913,_0x93af6d){if(_0x186913[_0x232c('0x48')]['id']){delete _0x186913[_0x232c('0x48')]['id'];}return db[_0x232c('0x28')][_0x232c('0x46')]({'where':{'id':_0x186913['params']['id']}})[_0x232c('0x22')](handleEntityNotFound(_0x93af6d,null))[_0x232c('0x22')](saveUpdates(_0x186913[_0x232c('0x48')],null))[_0x232c('0x22')](respondWithResult(_0x93af6d,null))[_0x232c('0x40')](handleError(_0x93af6d,null));};exports[_0x232c('0x49')]=function(_0x3d5341,_0x5ea560){return db[_0x232c('0x28')][_0x232c('0x46')]({'where':{'id':_0x3d5341['params']['id']}})[_0x232c('0x22')](handleEntityNotFound(_0x5ea560,null))[_0x232c('0x22')](removeEntity(_0x5ea560,null))[_0x232c('0x40')](handleError(_0x5ea560,null));};exports[_0x232c('0x4a')]=function(_0x47adb4,_0x56b7c1,_0x2d96ac){var _0xc26138={};var _0x340339={};var _0x2c4bc9;var _0x29c7f8;return db[_0x232c('0x28')][_0x232c('0x4b')]({'where':{'id':_0x47adb4[_0x232c('0x42')]['id']}})['then'](handleEntityNotFound(_0x56b7c1,null))[_0x232c('0x22')](function(_0x2619af){if(_0x2619af){_0x2c4bc9=_0x2619af;_0x340339[_0x232c('0x2d')]=_[_0x232c('0x2f')](db[_0x232c('0x4c')]['rawAttributes']);_0x340339[_0x232c('0x2e')]=_['keys'](_0x47adb4[_0x232c('0x2e')]);_0x340339[_0x232c('0x30')]=_[_0x232c('0x31')](_0x340339[_0x232c('0x2d')],_0x340339['query']);_0xc26138[_0x232c('0x32')]=_[_0x232c('0x31')](_0x340339[_0x232c('0x2d')],qs[_0x232c('0x33')](_0x47adb4[_0x232c('0x2e')][_0x232c('0x33')]));_0xc26138['attributes']=_0xc26138[_0x232c('0x32')][_0x232c('0x34')]?_0xc26138['attributes']:_0x340339[_0x232c('0x2d')];_0xc26138[_0x232c('0x36')]=qs['sort'](_0x47adb4['query']['sort']);_0xc26138[_0x232c('0x38')]=qs[_0x232c('0x30')](_[_0x232c('0x39')](_0x47adb4['query'],_0x340339[_0x232c('0x30')]));if(_0x47adb4[_0x232c('0x2e')]['filter']){_0xc26138[_0x232c('0x38')]=_['merge'](_0xc26138[_0x232c('0x38')],{'$or':_[_0x232c('0x3b')](_0xc26138[_0x232c('0x32')],function(_0x4ff632){var _0x17e333={};_0x17e333[_0x4ff632]={'$like':'%'+_0x47adb4[_0x232c('0x2e')][_0x232c('0x3a')]+'%'};return _0x17e333;})});}_0xc26138=_[_0x232c('0x3d')]({},_0xc26138,_0x47adb4[_0x232c('0x45')]);return _0x2c4bc9['getFields'](_0xc26138);}})['then'](function(_0xdcb824){if(_0xdcb824){_0x29c7f8=_0xdcb824['length'];if(!_0x47adb4[_0x232c('0x2e')][_0x232c('0x4d')](_0x232c('0x4e'))){_0xc26138[_0x232c('0x35')]=qs['limit'](_0x47adb4[_0x232c('0x2e')][_0x232c('0x35')]);_0xc26138['offset']=qs[_0x232c('0x1e')](_0x47adb4[_0x232c('0x2e')][_0x232c('0x1e')]);}return _0x2c4bc9[_0x232c('0x4a')](_0xc26138);}})[_0x232c('0x22')](function(_0x2601c8){if(_0x2601c8){return _0x2601c8?{'count':_0x29c7f8,'rows':_0x2601c8}:null;}})[_0x232c('0x22')](respondWithResult(_0x56b7c1,null))[_0x232c('0x40')](handleError(_0x56b7c1,null));};exports[_0x232c('0x4f')]=function(_0x15478f,_0x33b5a7,_0x14f974){var _0x182eb0={};var _0x160284={};var _0x1b58d4;var _0x3a9917;return db[_0x232c('0x28')][_0x232c('0x4b')]({'where':{'id':_0x15478f['params']['id']}})[_0x232c('0x22')](handleEntityNotFound(_0x33b5a7,null))['then'](function(_0x4bf5cd){if(_0x4bf5cd){_0x1b58d4=_0x4bf5cd;_0x160284['model']=_['keys'](db[_0x232c('0x4c')][_0x232c('0x29')]);_0x160284['query']=_[_0x232c('0x2f')](_0x15478f['query']);_0x160284[_0x232c('0x30')]=_['intersection'](_0x160284[_0x232c('0x2d')],_0x160284['query']);_0x182eb0[_0x232c('0x32')]=_[_0x232c('0x31')](_0x160284[_0x232c('0x2d')],qs[_0x232c('0x33')](_0x15478f[_0x232c('0x2e')][_0x232c('0x33')]));_0x182eb0[_0x232c('0x32')]=_0x182eb0[_0x232c('0x32')][_0x232c('0x34')]?_0x182eb0[_0x232c('0x32')]:_0x160284['model'];_0x182eb0[_0x232c('0x36')]=qs['sort'](_0x15478f['query']['sort']);_0x182eb0['where']=qs[_0x232c('0x30')](_['pick'](_0x15478f[_0x232c('0x2e')],_0x160284[_0x232c('0x30')]));if(_0x15478f[_0x232c('0x2e')][_0x232c('0x3a')]){_0x182eb0['where']=_[_0x232c('0x3d')](_0x182eb0[_0x232c('0x38')],{'$or':_[_0x232c('0x3b')](_0x182eb0[_0x232c('0x32')],function(_0x295edb){var _0x1db431={};_0x1db431[_0x295edb]={'$like':'%'+_0x15478f[_0x232c('0x2e')][_0x232c('0x3a')]+'%'};return _0x1db431;})});}_0x182eb0=_[_0x232c('0x3d')]({},_0x182eb0,_0x15478f[_0x232c('0x45')]);return _0x1b58d4[_0x232c('0x4f')](_0x182eb0);}})[_0x232c('0x22')](function(_0x474e3b){if(_0x474e3b){_0x3a9917=_0x474e3b[_0x232c('0x34')];if(!_0x15478f[_0x232c('0x2e')][_0x232c('0x4d')](_0x232c('0x4e'))){_0x182eb0['limit']=qs[_0x232c('0x35')](_0x15478f[_0x232c('0x2e')][_0x232c('0x35')]);_0x182eb0[_0x232c('0x1e')]=qs['offset'](_0x15478f[_0x232c('0x2e')][_0x232c('0x1e')]);}return _0x1b58d4[_0x232c('0x4f')](_0x182eb0);}})[_0x232c('0x22')](function(_0x3c59db){if(_0x3c59db){return _0x3c59db?{'count':_0x3a9917,'rows':_0x3c59db}:null;}})[_0x232c('0x22')](respondWithResult(_0x33b5a7,null))[_0x232c('0x40')](handleError(_0x33b5a7,null));};exports[_0x232c('0x50')]=function(_0x2f3254,_0x113889,_0x2c19d4){var _0x41f638={};var _0x439906={};var _0x45a693;var _0x1996fe;return db[_0x232c('0x28')][_0x232c('0x4b')]({'where':{'id':_0x2f3254[_0x232c('0x42')]['id']}})[_0x232c('0x22')](handleEntityNotFound(_0x113889,null))[_0x232c('0x22')](function(_0xe1213d){if(_0xe1213d){_0x45a693=_0xe1213d;_0x439906[_0x232c('0x2d')]=_[_0x232c('0x2f')](db[_0x232c('0x4c')][_0x232c('0x29')]);_0x439906[_0x232c('0x2e')]=_[_0x232c('0x2f')](_0x2f3254['query']);_0x439906[_0x232c('0x30')]=_[_0x232c('0x31')](_0x439906[_0x232c('0x2d')],_0x439906[_0x232c('0x2e')]);_0x41f638[_0x232c('0x32')]=_[_0x232c('0x31')](_0x439906['model'],qs[_0x232c('0x33')](_0x2f3254[_0x232c('0x2e')]['fields']));_0x41f638[_0x232c('0x32')]=_0x41f638['attributes'][_0x232c('0x34')]?_0x41f638[_0x232c('0x32')]:_0x439906[_0x232c('0x2d')];_0x41f638[_0x232c('0x36')]=qs[_0x232c('0x37')](_0x2f3254[_0x232c('0x2e')][_0x232c('0x37')]);_0x41f638[_0x232c('0x38')]=qs[_0x232c('0x30')](_[_0x232c('0x39')](_0x2f3254[_0x232c('0x2e')],_0x439906['filters']));if(_0x2f3254[_0x232c('0x2e')][_0x232c('0x3a')]){_0x41f638[_0x232c('0x38')]=_[_0x232c('0x3d')](_0x41f638[_0x232c('0x38')],{'$or':_[_0x232c('0x3b')](_0x41f638[_0x232c('0x32')],function(_0x3974a6){var _0x4f1212={};_0x4f1212[_0x3974a6]={'$like':'%'+_0x2f3254[_0x232c('0x2e')][_0x232c('0x3a')]+'%'};return _0x4f1212;})});}_0x41f638=_[_0x232c('0x3d')]({},_0x41f638,_0x2f3254[_0x232c('0x45')]);return _0x45a693[_0x232c('0x50')](_0x41f638);}})[_0x232c('0x22')](function(_0x3565bc){if(_0x3565bc){_0x1996fe=_0x3565bc[_0x232c('0x34')];if(!_0x2f3254['query'][_0x232c('0x4d')](_0x232c('0x4e'))){_0x41f638[_0x232c('0x35')]=qs[_0x232c('0x35')](_0x2f3254[_0x232c('0x2e')][_0x232c('0x35')]);_0x41f638[_0x232c('0x1e')]=qs['offset'](_0x2f3254[_0x232c('0x2e')][_0x232c('0x1e')]);}return _0x45a693['getDescriptions'](_0x41f638);}})[_0x232c('0x22')](function(_0x279754){if(_0x279754){return _0x279754?{'count':_0x1996fe,'rows':_0x279754}:null;}})[_0x232c('0x22')](respondWithResult(_0x113889,null))[_0x232c('0x40')](handleError(_0x113889,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2397a08..fb2f534 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 _0x4c82=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations'];(function(_0xa7460,_0x2cbd51){var _0x378897=function(_0x3073c8){while(--_0x3073c8){_0xa7460['push'](_0xa7460['shift']());}};_0x378897(++_0x2cbd51);}(_0x4c82,0x15c));var _0x24c8=function(_0x4be3e7,_0x3a7f05){_0x4be3e7=_0x4be3e7-0x0;var _0x4d44a0=_0x4c82[_0x4be3e7];return _0x4d44a0;};'use strict';var _=require(_0x24c8('0x0'));var util=require(_0x24c8('0x1'));var logger=require(_0x24c8('0x2'))(_0x24c8('0x3'));var moment=require('moment');var BPromise=require(_0x24c8('0x4'));var rp=require(_0x24c8('0x5'));var fs=require('fs');var path=require(_0x24c8('0x6'));var rimraf=require(_0x24c8('0x7'));var config=require('../../config/environment');var attributes=require(_0x24c8('0x8'));module[_0x24c8('0x9')]=function(_0x8e4391,_0x13d51c){return _0x8e4391[_0x24c8('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x24c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba3d=['define','SalesforceConfiguration','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x140b15,_0x45b767){var _0xe255bf=function(_0x851e75){while(--_0x851e75){_0x140b15['push'](_0x140b15['shift']());}};_0xe255bf(++_0x45b767);}(_0xba3d,0xd4));var _0xdba3=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xba3d[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdba3('0x0'))(_0xdba3('0x1'));var moment=require(_0xdba3('0x2'));var BPromise=require(_0xdba3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdba3('0x4'));var rimraf=require(_0xdba3('0x5'));var config=require(_0xdba3('0x6'));var attributes=require(_0xdba3('0x7'));module['exports']=function(_0x1ddac8,_0x387ba4){return _0x1ddac8[_0xdba3('0x8')](_0xdba3('0x9'),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 d1675bf..c126e9b 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 _0xf0b8=['stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xe49874,_0x14b06a){var _0x2d2c68=function(_0x42b6c2){while(--_0x42b6c2){_0xe49874['push'](_0xe49874['shift']());}};_0x2d2c68(++_0x14b06a);}(_0xf0b8,0x1ea));var _0x8f0b=function(_0x16dd61,_0x7fd2b3){_0x16dd61=_0x16dd61-0x0;var _0x5ab373=_0xf0b8[_0x16dd61];return _0x5ab373;};'use strict';var _=require(_0x8f0b('0x0'));var util=require('util');var moment=require(_0x8f0b('0x1'));var BPromise=require(_0x8f0b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f0b('0x3'));var db=require(_0x8f0b('0x4'))['db'];var utils=require(_0x8f0b('0x5'));var logger=require(_0x8f0b('0x6'))(_0x8f0b('0x7'));var config=require(_0x8f0b('0x8'));var jayson=require(_0x8f0b('0x9'));var client=jayson[_0x8f0b('0xa')][_0x8f0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x360d78,_0x199c66,_0x437e6e){return new BPromise(function(_0xd24f48,_0x4f7edf){return client[_0x8f0b('0xc')](_0x360d78,_0x437e6e)[_0x8f0b('0xd')](function(_0x33ecaf){logger[_0x8f0b('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x199c66,'request\x20sent');logger['debug'](_0x8f0b('0xf'),_0x199c66,'request\x20sent',JSON[_0x8f0b('0x10')](_0x33ecaf));if(_0x33ecaf[_0x8f0b('0x11')]){if(_0x33ecaf[_0x8f0b('0x11')][_0x8f0b('0x12')]===0x1f4){logger[_0x8f0b('0x11')](_0x8f0b('0x13'),_0x199c66,_0x33ecaf[_0x8f0b('0x11')][_0x8f0b('0x14')]);return _0x4f7edf(_0x33ecaf['error'][_0x8f0b('0x14')]);}logger[_0x8f0b('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x199c66,_0x33ecaf[_0x8f0b('0x11')][_0x8f0b('0x14')]);return _0xd24f48(_0x33ecaf[_0x8f0b('0x11')][_0x8f0b('0x14')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x199c66,'request\x20sent');_0xd24f48(_0x33ecaf['result'][_0x8f0b('0x14')]);}})[_0x8f0b('0x15')](function(_0x3f44b8){logger[_0x8f0b('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x199c66,_0x3f44b8);_0x4f7edf(_0x3f44b8);});});} \ No newline at end of file +var _0x256c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x256c,0xce));var _0xc256=function(_0x26acd1,_0x5379b9){_0x26acd1=_0x26acd1-0x0;var _0x115390=_0x256c[_0x26acd1];return _0x115390;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc256('0x0'));var rs=require(_0xc256('0x1'));var fs=require('fs');var Redis=require(_0xc256('0x2'));var db=require(_0xc256('0x3'))['db'];var utils=require(_0xc256('0x4'));var logger=require(_0xc256('0x5'))(_0xc256('0x6'));var config=require(_0xc256('0x7'));var jayson=require(_0xc256('0x8'));var client=jayson['client'][_0xc256('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x387cc2,_0x8533c4,_0x52c607){return new BPromise(function(_0x582fc5,_0x4bd380){return client[_0xc256('0xa')](_0x387cc2,_0x52c607)[_0xc256('0xb')](function(_0x110274){logger[_0xc256('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x8533c4,_0xc256('0xd'));logger['debug'](_0xc256('0xe'),_0x8533c4,'request\x20sent',JSON['stringify'](_0x110274));if(_0x110274[_0xc256('0xf')]){if(_0x110274[_0xc256('0xf')][_0xc256('0x10')]===0x1f4){logger['error'](_0xc256('0x11'),_0x8533c4,_0x110274[_0xc256('0xf')]['message']);return _0x4bd380(_0x110274[_0xc256('0xf')]['message']);}logger[_0xc256('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x8533c4,_0x110274[_0xc256('0xf')]['message']);return _0x582fc5(_0x110274['error'][_0xc256('0x12')]);}else{logger[_0xc256('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x8533c4,'request\x20sent');_0x582fc5(_0x110274[_0xc256('0x13')][_0xc256('0x12')]);}})[_0xc256('0x14')](function(_0x33df51){logger[_0xc256('0xf')](_0xc256('0x11'),_0x8533c4,_0x33df51);_0x4bd380(_0x33df51);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index abc4598..d1daa22 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 _0x01e6=['express','../../components/auth/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout'];(function(_0x3a2faa,_0x3d8355){var _0x43eb8e=function(_0x5df948){while(--_0x5df948){_0x3a2faa['push'](_0x3a2faa['shift']());}};_0x43eb8e(++_0x3d8355);}(_0x01e6,0x1c7));var _0x601e=function(_0x2abe9d,_0x4a8c6e){_0x2abe9d=_0x2abe9d-0x0;var _0x135213=_0x01e6[_0x2abe9d];return _0x135213;};'use strict';var multer=require(_0x601e('0x0'));var util=require(_0x601e('0x1'));var path=require(_0x601e('0x2'));var timeout=require(_0x601e('0x3'));var express=require(_0x601e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x601e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x601e('0x6'));router[_0x601e('0x7')]('/',auth[_0x601e('0x8')](),controller[_0x601e('0x9')]);router[_0x601e('0x7')](_0x601e('0xa'),auth['isAuthenticated'](),controller[_0x601e('0xb')]);router[_0x601e('0xc')]('/',auth['isAuthenticated'](),controller[_0x601e('0xd')]);router[_0x601e('0xe')](_0x601e('0xa'),auth[_0x601e('0x8')](),controller[_0x601e('0xf')]);router['delete'](_0x601e('0xa'),auth[_0x601e('0x8')](),controller['destroy']);module[_0x601e('0x10')]=router; \ No newline at end of file +var _0x8c96=['get','isAuthenticated','index','/:id','post','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8c96,0x118));var _0x68c9=function(_0x39f18f,_0x41841a){_0x39f18f=_0x39f18f-0x0;var _0x8285b7=_0x8c96[_0x39f18f];return _0x8285b7;};'use strict';var multer=require(_0x68c9('0x0'));var util=require(_0x68c9('0x1'));var path=require(_0x68c9('0x2'));var timeout=require(_0x68c9('0x3'));var express=require(_0x68c9('0x4'));var router=express[_0x68c9('0x5')]();var fs_extra=require(_0x68c9('0x6'));var auth=require(_0x68c9('0x7'));var interaction=require(_0x68c9('0x8'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0x68c9('0x9')]('/',auth[_0x68c9('0xa')](),controller[_0x68c9('0xb')]);router['get'](_0x68c9('0xc'),auth[_0x68c9('0xa')](),controller['show']);router[_0x68c9('0xd')]('/',auth[_0x68c9('0xa')](),controller['create']);router[_0x68c9('0xe')](_0x68c9('0xc'),auth['isAuthenticated'](),controller[_0x68c9('0xf')]);router[_0x68c9('0x10')]('/:id',auth[_0x68c9('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index a0cfc25..3acfca9 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 _0xff38=['keyValue','ENUM','variable','STRING','sequelize','exports','string','customVariable'];(function(_0x14221c,_0x2c3796){var _0x170d18=function(_0x1418d5){while(--_0x1418d5){_0x14221c['push'](_0x14221c['shift']());}};_0x170d18(++_0x2c3796);}(_0xff38,0x1a4));var _0x8ff3=function(_0x1b7249,_0x13b891){_0x1b7249=_0x1b7249-0x0;var _0x3cadfb=_0xff38[_0x1b7249];return _0x3cadfb;};'use strict';var Sequelize=require(_0x8ff3('0x0'));module[_0x8ff3('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8ff3('0x2'),'variable',_0x8ff3('0x3'),_0x8ff3('0x4'),'picklist'),'defaultValue':_0x8ff3('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8ff3('0x5')](_0x8ff3('0x2'),_0x8ff3('0x6'),_0x8ff3('0x3'))},'keyContent':{'type':Sequelize[_0x8ff3('0x7')]},'idField':{'type':Sequelize[_0x8ff3('0x7')]},'variableName':{'type':Sequelize[_0x8ff3('0x7')]}}; \ No newline at end of file +var _0x6318=['STRING','ENUM','exports','variable','customVariable','keyValue','string'];(function(_0x4704dc,_0x575a5f){var _0x254d81=function(_0x3b135d){while(--_0x3b135d){_0x4704dc['push'](_0x4704dc['shift']());}};_0x254d81(++_0x575a5f);}(_0x6318,0xd4));var _0x8631=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x6318[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require('sequelize');module[_0x8631('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x8631('0x1'),_0x8631('0x2'),_0x8631('0x3'),'picklist'),'defaultValue':_0x8631('0x4')},'content':{'type':Sequelize[_0x8631('0x5')]},'key':{'type':Sequelize[_0x8631('0x5')]},'keyType':{'type':Sequelize[_0x8631('0x6')](_0x8631('0x4'),_0x8631('0x1'),_0x8631('0x2'))},'keyContent':{'type':Sequelize[_0x8631('0x5')]},'idField':{'type':Sequelize[_0x8631('0x5')]},'variableName':{'type':Sequelize[_0x8631('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 589dc66..b7d5911 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 _0x3b19=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','params','keys','include','find','create','body','destroy','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','error','name','send','index','map','SalesforceField','type','key','model'];(function(_0x316904,_0x1e8b77){var _0xfa9a21=function(_0x2b75ae){while(--_0x2b75ae){_0x316904['push'](_0x316904['shift']());}};_0xfa9a21(++_0x1e8b77);}(_0x3b19,0xa5));var _0x93b1=function(_0x20dc37,_0x81495a){_0x20dc37=_0x20dc37-0x0;var _0x389459=_0x3b19[_0x20dc37];return _0x389459;};'use strict';var emlformat=require(_0x93b1('0x0'));var rimraf=require(_0x93b1('0x1'));var zipdir=require(_0x93b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x93b1('0x3'));var BPromise=require(_0x93b1('0x4'));var Mustache=require('mustache');var util=require(_0x93b1('0x5'));var path=require(_0x93b1('0x6'));var sox=require(_0x93b1('0x7'));var csv=require(_0x93b1('0x8'));var ejs=require(_0x93b1('0x9'));var fs=require('fs');var fs_extra=require(_0x93b1('0xa'));var _=require(_0x93b1('0xb'));var squel=require(_0x93b1('0xc'));var crypto=require(_0x93b1('0xd'));var jsforce=require(_0x93b1('0xe'));var deskjs=require(_0x93b1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x93b1('0x10'));var Papa=require(_0x93b1('0x11'));var Redis=require(_0x93b1('0x12'));var authService=require(_0x93b1('0x13'));var qs=require(_0x93b1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93b1('0x15'));var logger=require('../../config/logger')(_0x93b1('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ceddd,_0x594dd2){_0x594dd2=_0x594dd2||0xcc;return function(_0x2be257){if(_0x2be257){return _0x3ceddd[_0x93b1('0x17')](_0x594dd2);}return _0x3ceddd['status'](_0x594dd2)[_0x93b1('0x18')]();};}function respondWithResult(_0xc600b6,_0x102784){_0x102784=_0x102784||0xc8;return function(_0x5b7870){if(_0x5b7870){return _0xc600b6[_0x93b1('0x19')](_0x102784)[_0x93b1('0x1a')](_0x5b7870);}};}function respondWithFilteredResult(_0x37f522,_0x4fe220){return function(_0x9082ba){if(_0x9082ba){var _0x3421c4=typeof _0x4fe220[_0x93b1('0x1b')]===_0x93b1('0x1c')&&typeof _0x4fe220[_0x93b1('0x1d')]===_0x93b1('0x1c');var _0x5b9dcb=_0x9082ba['count'];var _0x129381=_0x3421c4?0x0:_0x4fe220['offset'];var _0xd2912=_0x3421c4?_0x9082ba[_0x93b1('0x1e')]:_0x4fe220['offset']+_0x4fe220[_0x93b1('0x1d')];var _0x51eac5;if(_0xd2912>=_0x5b9dcb){_0xd2912=_0x5b9dcb;_0x51eac5=0xc8;}else{_0x51eac5=0xce;}_0x37f522[_0x93b1('0x19')](_0x51eac5);return _0x37f522[_0x93b1('0x1f')]('Content-Range',_0x129381+'-'+_0xd2912+'/'+_0x5b9dcb)['json'](_0x9082ba);}return null;};}function patchUpdates(_0x38bb37){return function(_0xa0caef){try{jsonpatch['apply'](_0xa0caef,_0x38bb37,!![]);}catch(_0x5469ad){return BPromise[_0x93b1('0x20')](_0x5469ad);}return _0xa0caef[_0x93b1('0x21')]();};}function saveUpdates(_0x6edf0a,_0x160a25){return function(_0x341131){if(_0x341131){return _0x341131[_0x93b1('0x22')](_0x6edf0a)[_0x93b1('0x23')](function(_0xed2017){return _0xed2017;});}return null;};}function removeEntity(_0x9a6400,_0x298d2b){return function(_0x1e893b){if(_0x1e893b){return _0x1e893b['destroy']()[_0x93b1('0x23')](function(){_0x9a6400[_0x93b1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5203cb,_0x384c06){return function(_0xe260c){if(!_0xe260c){_0x5203cb[_0x93b1('0x17')](0x194);}return _0xe260c;};}function handleError(_0x248e54,_0x119f55){_0x119f55=_0x119f55||0x1f4;return function(_0x150615){logger[_0x93b1('0x24')](_0x150615['stack']);if(_0x150615[_0x93b1('0x25')]){delete _0x150615[_0x93b1('0x25')];}_0x248e54[_0x93b1('0x19')](_0x119f55)[_0x93b1('0x26')](_0x150615);};}exports[_0x93b1('0x27')]=function(_0xf674ad,_0x21c36b){var _0x5df217={},_0xff929={},_0x28aef5={'count':0x0,'rows':[]};var _0x2b405e=_[_0x93b1('0x28')](db[_0x93b1('0x29')]['rawAttributes'],function(_0x3759df){return{'name':_0x3759df['fieldName'],'type':_0x3759df[_0x93b1('0x2a')][_0x93b1('0x2b')]};});_0xff929[_0x93b1('0x2c')]=_[_0x93b1('0x28')](_0x2b405e,'name');_0xff929[_0x93b1('0x2d')]=_['keys'](_0xf674ad[_0x93b1('0x2d')]);_0xff929[_0x93b1('0x2e')]=_[_0x93b1('0x2f')](_0xff929['model'],_0xff929[_0x93b1('0x2d')]);_0x5df217[_0x93b1('0x30')]=_[_0x93b1('0x2f')](_0xff929[_0x93b1('0x2c')],qs[_0x93b1('0x31')](_0xf674ad[_0x93b1('0x2d')][_0x93b1('0x31')]));_0x5df217[_0x93b1('0x30')]=_0x5df217[_0x93b1('0x30')][_0x93b1('0x32')]?_0x5df217['attributes']:_0xff929[_0x93b1('0x2c')];if(!_0xf674ad[_0x93b1('0x2d')][_0x93b1('0x33')](_0x93b1('0x34'))){_0x5df217[_0x93b1('0x1d')]=qs[_0x93b1('0x1d')](_0xf674ad[_0x93b1('0x2d')]['limit']);_0x5df217[_0x93b1('0x1b')]=qs[_0x93b1('0x1b')](_0xf674ad[_0x93b1('0x2d')][_0x93b1('0x1b')]);}_0x5df217[_0x93b1('0x35')]=qs[_0x93b1('0x36')](_0xf674ad[_0x93b1('0x2d')]['sort']);_0x5df217[_0x93b1('0x37')]=qs[_0x93b1('0x2e')](_[_0x93b1('0x38')](_0xf674ad['query'],_0xff929['filters']),_0x2b405e);if(_0xf674ad['query'][_0x93b1('0x39')]){_0x5df217[_0x93b1('0x37')]=_[_0x93b1('0x3a')](_0x5df217[_0x93b1('0x37')],{'$or':_[_0x93b1('0x28')](_0x2b405e,function(_0x1abf33){if(_0x1abf33[_0x93b1('0x2a')]!=='VIRTUAL'){var _0x55284d={};_0x55284d[_0x1abf33[_0x93b1('0x25')]]={'$like':'%'+_0xf674ad[_0x93b1('0x2d')][_0x93b1('0x39')]+'%'};return _0x55284d;}})});}_0x5df217=_['merge']({},_0x5df217,_0xf674ad[_0x93b1('0x3b')]);var _0x821805={'where':_0x5df217['where']};return db[_0x93b1('0x29')][_0x93b1('0x1e')](_0x821805)[_0x93b1('0x23')](function(_0xb2e9f1){_0x28aef5[_0x93b1('0x1e')]=_0xb2e9f1;if(_0xf674ad[_0x93b1('0x2d')][_0x93b1('0x3c')]){_0x5df217['include']=[{'all':!![]}];}return db[_0x93b1('0x29')][_0x93b1('0x3d')](_0x5df217);})['then'](function(_0x2e893a){_0x28aef5['rows']=_0x2e893a;return _0x28aef5;})[_0x93b1('0x23')](respondWithFilteredResult(_0x21c36b,_0x5df217))[_0x93b1('0x3e')](handleError(_0x21c36b,null));};exports['show']=function(_0xc3a2cb,_0x265ce4){var _0x2f3bf0={'raw':!![],'where':{'id':_0xc3a2cb[_0x93b1('0x3f')]['id']}},_0x3cb5e9={};_0x3cb5e9[_0x93b1('0x2c')]=_[_0x93b1('0x40')](db['SalesforceField']['rawAttributes']);_0x3cb5e9[_0x93b1('0x2d')]=_[_0x93b1('0x40')](_0xc3a2cb['query']);_0x3cb5e9['filters']=_[_0x93b1('0x2f')](_0x3cb5e9[_0x93b1('0x2c')],_0x3cb5e9[_0x93b1('0x2d')]);_0x2f3bf0[_0x93b1('0x30')]=_[_0x93b1('0x2f')](_0x3cb5e9[_0x93b1('0x2c')],qs[_0x93b1('0x31')](_0xc3a2cb[_0x93b1('0x2d')][_0x93b1('0x31')]));_0x2f3bf0[_0x93b1('0x30')]=_0x2f3bf0[_0x93b1('0x30')]['length']?_0x2f3bf0[_0x93b1('0x30')]:_0x3cb5e9[_0x93b1('0x2c')];if(_0xc3a2cb[_0x93b1('0x2d')][_0x93b1('0x3c')]){_0x2f3bf0[_0x93b1('0x41')]=[{'all':!![]}];}_0x2f3bf0=_[_0x93b1('0x3a')]({},_0x2f3bf0,_0xc3a2cb[_0x93b1('0x3b')]);return db['SalesforceField'][_0x93b1('0x42')](_0x2f3bf0)['then'](handleEntityNotFound(_0x265ce4,null))[_0x93b1('0x23')](respondWithResult(_0x265ce4,null))[_0x93b1('0x3e')](handleError(_0x265ce4,null));};exports[_0x93b1('0x43')]=function(_0xcef159,_0x17fc9b){return db[_0x93b1('0x29')]['create'](_0xcef159[_0x93b1('0x44')],{})[_0x93b1('0x23')](respondWithResult(_0x17fc9b,0xc9))[_0x93b1('0x3e')](handleError(_0x17fc9b,null));};exports[_0x93b1('0x22')]=function(_0x52bb69,_0x17ad3a){if(_0x52bb69[_0x93b1('0x44')]['id']){delete _0x52bb69[_0x93b1('0x44')]['id'];}return db[_0x93b1('0x29')][_0x93b1('0x42')]({'where':{'id':_0x52bb69['params']['id']}})[_0x93b1('0x23')](handleEntityNotFound(_0x17ad3a,null))[_0x93b1('0x23')](saveUpdates(_0x52bb69[_0x93b1('0x44')],null))[_0x93b1('0x23')](respondWithResult(_0x17ad3a,null))[_0x93b1('0x3e')](handleError(_0x17ad3a,null));};exports[_0x93b1('0x45')]=function(_0xa1feb1,_0x25f9d0){return db[_0x93b1('0x29')][_0x93b1('0x42')]({'where':{'id':_0xa1feb1['params']['id']}})['then'](handleEntityNotFound(_0x25f9d0,null))[_0x93b1('0x23')](removeEntity(_0x25f9d0,null))[_0x93b1('0x3e')](handleError(_0x25f9d0,null));}; \ No newline at end of file +var _0xb6b5=['offset','set','Content-Range','json','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','query','model','attributes','intersection','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','create','body','find','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count'];(function(_0x4692f0,_0x4b8d87){var _0xb798cf=function(_0x5228a2){while(--_0x5228a2){_0x4692f0['push'](_0x4692f0['shift']());}};_0xb798cf(++_0x4b8d87);}(_0xb6b5,0x1a8));var _0x5b6b=function(_0x49dc47,_0x39d322){_0x49dc47=_0x49dc47-0x0;var _0x344a30=_0xb6b5[_0x49dc47];return _0x344a30;};'use strict';var emlformat=require(_0x5b6b('0x0'));var rimraf=require(_0x5b6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b6b('0x2'));var rp=require(_0x5b6b('0x3'));var moment=require('moment');var BPromise=require(_0x5b6b('0x4'));var Mustache=require(_0x5b6b('0x5'));var util=require(_0x5b6b('0x6'));var path=require(_0x5b6b('0x7'));var sox=require(_0x5b6b('0x8'));var csv=require(_0x5b6b('0x9'));var ejs=require(_0x5b6b('0xa'));var fs=require('fs');var fs_extra=require(_0x5b6b('0xb'));var _=require(_0x5b6b('0xc'));var squel=require(_0x5b6b('0xd'));var crypto=require(_0x5b6b('0xe'));var jsforce=require(_0x5b6b('0xf'));var deskjs=require(_0x5b6b('0x10'));var toCsv=require(_0x5b6b('0x9'));var querystring=require(_0x5b6b('0x11'));var Papa=require('papaparse');var Redis=require(_0x5b6b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5b6b('0x13'));var as=require(_0x5b6b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b6b('0x15'))(_0x5b6b('0x16'));var utils=require(_0x5b6b('0x17'));var config=require(_0x5b6b('0x18'));var licenseUtil=require(_0x5b6b('0x19'));var db=require(_0x5b6b('0x1a'))['db'];function respondWithStatusCode(_0x48a279,_0x3c971d){_0x3c971d=_0x3c971d||0xcc;return function(_0x2e6948){if(_0x2e6948){return _0x48a279['sendStatus'](_0x3c971d);}return _0x48a279[_0x5b6b('0x1b')](_0x3c971d)[_0x5b6b('0x1c')]();};}function respondWithResult(_0x2b437a,_0x5155fe){_0x5155fe=_0x5155fe||0xc8;return function(_0x80b445){if(_0x80b445){return _0x2b437a[_0x5b6b('0x1b')](_0x5155fe)['json'](_0x80b445);}};}function respondWithFilteredResult(_0xf5faa9,_0x22f82c){return function(_0x1e77b1){if(_0x1e77b1){var _0x5d9d5e=typeof _0x22f82c['offset']===_0x5b6b('0x1d')&&typeof _0x22f82c[_0x5b6b('0x1e')]==='undefined';var _0x427e35=_0x1e77b1[_0x5b6b('0x1f')];var _0x3843e6=_0x5d9d5e?0x0:_0x22f82c[_0x5b6b('0x20')];var _0x5af9b6=_0x5d9d5e?_0x1e77b1[_0x5b6b('0x1f')]:_0x22f82c[_0x5b6b('0x20')]+_0x22f82c['limit'];var _0xc80d58;if(_0x5af9b6>=_0x427e35){_0x5af9b6=_0x427e35;_0xc80d58=0xc8;}else{_0xc80d58=0xce;}_0xf5faa9['status'](_0xc80d58);return _0xf5faa9[_0x5b6b('0x21')](_0x5b6b('0x22'),_0x3843e6+'-'+_0x5af9b6+'/'+_0x427e35)[_0x5b6b('0x23')](_0x1e77b1);}return null;};}function patchUpdates(_0x3a7d4b){return function(_0x565e19){try{jsonpatch['apply'](_0x565e19,_0x3a7d4b,!![]);}catch(_0x4bb736){return BPromise[_0x5b6b('0x24')](_0x4bb736);}return _0x565e19['save']();};}function saveUpdates(_0x4ae96c,_0x50ba02){return function(_0x5cb8ef){if(_0x5cb8ef){return _0x5cb8ef[_0x5b6b('0x25')](_0x4ae96c)[_0x5b6b('0x26')](function(_0x4e580a){return _0x4e580a;});}return null;};}function removeEntity(_0x723228,_0x1cfaef){return function(_0x426054){if(_0x426054){return _0x426054[_0x5b6b('0x27')]()[_0x5b6b('0x26')](function(){_0x723228[_0x5b6b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x122d46,_0x29022){return function(_0x2aadb3){if(!_0x2aadb3){_0x122d46[_0x5b6b('0x28')](0x194);}return _0x2aadb3;};}function handleError(_0x56deaf,_0x2aaf08){_0x2aaf08=_0x2aaf08||0x1f4;return function(_0x151780){logger[_0x5b6b('0x29')](_0x151780[_0x5b6b('0x2a')]);if(_0x151780[_0x5b6b('0x2b')]){delete _0x151780[_0x5b6b('0x2b')];}_0x56deaf[_0x5b6b('0x1b')](_0x2aaf08)[_0x5b6b('0x2c')](_0x151780);};}exports[_0x5b6b('0x2d')]=function(_0x57fcad,_0x1b7273){var _0x59845c={},_0x4fafb3={},_0x540fa9={'count':0x0,'rows':[]};var _0x469a47=_[_0x5b6b('0x2e')](db[_0x5b6b('0x2f')][_0x5b6b('0x30')],function(_0x34a371){return{'name':_0x34a371[_0x5b6b('0x31')],'type':_0x34a371[_0x5b6b('0x32')]['key']};});_0x4fafb3['model']=_[_0x5b6b('0x2e')](_0x469a47,_0x5b6b('0x2b'));_0x4fafb3[_0x5b6b('0x33')]=_['keys'](_0x57fcad[_0x5b6b('0x33')]);_0x4fafb3['filters']=_['intersection'](_0x4fafb3[_0x5b6b('0x34')],_0x4fafb3[_0x5b6b('0x33')]);_0x59845c[_0x5b6b('0x35')]=_[_0x5b6b('0x36')](_0x4fafb3[_0x5b6b('0x34')],qs[_0x5b6b('0x37')](_0x57fcad[_0x5b6b('0x33')]['fields']));_0x59845c['attributes']=_0x59845c[_0x5b6b('0x35')]['length']?_0x59845c['attributes']:_0x4fafb3['model'];if(!_0x57fcad[_0x5b6b('0x33')]['hasOwnProperty'](_0x5b6b('0x38'))){_0x59845c[_0x5b6b('0x1e')]=qs[_0x5b6b('0x1e')](_0x57fcad[_0x5b6b('0x33')][_0x5b6b('0x1e')]);_0x59845c[_0x5b6b('0x20')]=qs['offset'](_0x57fcad['query'][_0x5b6b('0x20')]);}_0x59845c[_0x5b6b('0x39')]=qs[_0x5b6b('0x3a')](_0x57fcad['query'][_0x5b6b('0x3a')]);_0x59845c[_0x5b6b('0x3b')]=qs[_0x5b6b('0x3c')](_['pick'](_0x57fcad[_0x5b6b('0x33')],_0x4fafb3[_0x5b6b('0x3c')]),_0x469a47);if(_0x57fcad['query'][_0x5b6b('0x3d')]){_0x59845c[_0x5b6b('0x3b')]=_[_0x5b6b('0x3e')](_0x59845c[_0x5b6b('0x3b')],{'$or':_[_0x5b6b('0x2e')](_0x469a47,function(_0x4ab38b){if(_0x4ab38b[_0x5b6b('0x32')]!==_0x5b6b('0x3f')){var _0x3bc35e={};_0x3bc35e[_0x4ab38b[_0x5b6b('0x2b')]]={'$like':'%'+_0x57fcad['query'][_0x5b6b('0x3d')]+'%'};return _0x3bc35e;}})});}_0x59845c=_[_0x5b6b('0x3e')]({},_0x59845c,_0x57fcad[_0x5b6b('0x40')]);var _0x362810={'where':_0x59845c[_0x5b6b('0x3b')]};return db[_0x5b6b('0x2f')]['count'](_0x362810)[_0x5b6b('0x26')](function(_0x2be04a){_0x540fa9['count']=_0x2be04a;if(_0x57fcad[_0x5b6b('0x33')][_0x5b6b('0x41')]){_0x59845c[_0x5b6b('0x42')]=[{'all':!![]}];}return db[_0x5b6b('0x2f')][_0x5b6b('0x43')](_0x59845c);})[_0x5b6b('0x26')](function(_0x5e0922){_0x540fa9[_0x5b6b('0x44')]=_0x5e0922;return _0x540fa9;})[_0x5b6b('0x26')](respondWithFilteredResult(_0x1b7273,_0x59845c))[_0x5b6b('0x45')](handleError(_0x1b7273,null));};exports['show']=function(_0xb8514a,_0x5af545){var _0x43a180={'raw':!![],'where':{'id':_0xb8514a[_0x5b6b('0x46')]['id']}},_0x47577d={};_0x47577d['model']=_[_0x5b6b('0x47')](db[_0x5b6b('0x2f')]['rawAttributes']);_0x47577d[_0x5b6b('0x33')]=_[_0x5b6b('0x47')](_0xb8514a[_0x5b6b('0x33')]);_0x47577d[_0x5b6b('0x3c')]=_[_0x5b6b('0x36')](_0x47577d[_0x5b6b('0x34')],_0x47577d[_0x5b6b('0x33')]);_0x43a180['attributes']=_['intersection'](_0x47577d[_0x5b6b('0x34')],qs['fields'](_0xb8514a['query'][_0x5b6b('0x37')]));_0x43a180[_0x5b6b('0x35')]=_0x43a180[_0x5b6b('0x35')][_0x5b6b('0x48')]?_0x43a180[_0x5b6b('0x35')]:_0x47577d[_0x5b6b('0x34')];if(_0xb8514a[_0x5b6b('0x33')]['includeAll']){_0x43a180[_0x5b6b('0x42')]=[{'all':!![]}];}_0x43a180=_['merge']({},_0x43a180,_0xb8514a[_0x5b6b('0x40')]);return db['SalesforceField']['find'](_0x43a180)[_0x5b6b('0x26')](handleEntityNotFound(_0x5af545,null))['then'](respondWithResult(_0x5af545,null))[_0x5b6b('0x45')](handleError(_0x5af545,null));};exports[_0x5b6b('0x49')]=function(_0x2b661c,_0x5cdf5f){return db['SalesforceField']['create'](_0x2b661c[_0x5b6b('0x4a')],{})[_0x5b6b('0x26')](respondWithResult(_0x5cdf5f,0xc9))['catch'](handleError(_0x5cdf5f,null));};exports[_0x5b6b('0x25')]=function(_0x38a5f1,_0x580a85){if(_0x38a5f1[_0x5b6b('0x4a')]['id']){delete _0x38a5f1[_0x5b6b('0x4a')]['id'];}return db[_0x5b6b('0x2f')][_0x5b6b('0x4b')]({'where':{'id':_0x38a5f1[_0x5b6b('0x46')]['id']}})[_0x5b6b('0x26')](handleEntityNotFound(_0x580a85,null))['then'](saveUpdates(_0x38a5f1[_0x5b6b('0x4a')],null))[_0x5b6b('0x26')](respondWithResult(_0x580a85,null))['catch'](handleError(_0x580a85,null));};exports[_0x5b6b('0x27')]=function(_0x29b34a,_0x119c34){return db[_0x5b6b('0x2f')][_0x5b6b('0x4b')]({'where':{'id':_0x29b34a[_0x5b6b('0x46')]['id']}})[_0x5b6b('0x26')](handleEntityNotFound(_0x119c34,null))[_0x5b6b('0x26')](removeEntity(_0x119c34,null))[_0x5b6b('0x45')](handleError(_0x119c34,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 168c2ed..1b3dfc8 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 _0xbc92=['exports','define','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes'];(function(_0x28edda,_0xbd447a){var _0x21f4a4=function(_0x5ae05e){while(--_0x5ae05e){_0x28edda['push'](_0x28edda['shift']());}};_0x21f4a4(++_0xbd447a);}(_0xbc92,0xf4));var _0x2bc9=function(_0x2aeca6,_0x565154){_0x2aeca6=_0x2aeca6-0x0;var _0x48c8c9=_0xbc92[_0x2aeca6];return _0x48c8c9;};'use strict';var _=require(_0x2bc9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2bc9('0x1'));var moment=require(_0x2bc9('0x2'));var BPromise=require(_0x2bc9('0x3'));var rp=require(_0x2bc9('0x4'));var fs=require('fs');var path=require(_0x2bc9('0x5'));var rimraf=require(_0x2bc9('0x6'));var config=require('../../config/environment');var attributes=require(_0x2bc9('0x7'));module[_0x2bc9('0x8')]=function(_0x155e87,_0x11c9a3){return _0x155e87[_0x2bc9('0x9')](_0x2bc9('0xa'),attributes,{'tableName':_0x2bc9('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x2bc9('0xc'),_0x2bc9('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57b4=['salesforce_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','int_salesforce_fields'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x57b4,0xab));var _0x457b=function(_0x58cbf7,_0x36a834){_0x58cbf7=_0x58cbf7-0x0;var _0x197367=_0x57b4[_0x58cbf7];return _0x197367;};'use strict';var _=require(_0x457b('0x0'));var util=require(_0x457b('0x1'));var logger=require(_0x457b('0x2'))(_0x457b('0x3'));var moment=require(_0x457b('0x4'));var BPromise=require('bluebird');var rp=require(_0x457b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x457b('0x6'));var config=require(_0x457b('0x7'));var attributes=require(_0x457b('0x8'));module[_0x457b('0x9')]=function(_0x212d5e,_0x2658c1){return _0x212d5e['define']('SalesforceField',attributes,{'tableName':_0x457b('0xa'),'paranoid':![],'indexes':[{'name':_0x457b('0xb'),'fields':[_0x457b('0xc'),'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 0f8d344..df5fe19 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 _0xc02a=['../../mysqldb','../../config/logger','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','catch','util','moment','bluebird'];(function(_0x51b80a,_0x355fe3){var _0x22fdf0=function(_0x152b3e){while(--_0x152b3e){_0x51b80a['push'](_0x51b80a['shift']());}};_0x22fdf0(++_0x355fe3);}(_0xc02a,0xcf));var _0xac02=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0xc02a[_0x4709c8];return _0x478cdd;};'use strict';var _=require('lodash');var util=require(_0xac02('0x0'));var moment=require(_0xac02('0x1'));var BPromise=require(_0xac02('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac02('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xac02('0x4'))(_0xac02('0x5'));var config=require('../../config/environment');var jayson=require(_0xac02('0x6'));var client=jayson[_0xac02('0x7')][_0xac02('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a6c8a,_0x882e5c,_0x169574){return new BPromise(function(_0x478cbb,_0x6ee6b5){return client[_0xac02('0x9')](_0x1a6c8a,_0x169574)['then'](function(_0x252814){logger[_0xac02('0xa')](_0xac02('0xb'),_0x882e5c,_0xac02('0xc'));logger[_0xac02('0xd')](_0xac02('0xe'),_0x882e5c,'request\x20sent',JSON[_0xac02('0xf')](_0x252814));if(_0x252814[_0xac02('0x10')]){if(_0x252814[_0xac02('0x10')][_0xac02('0x11')]===0x1f4){logger['error'](_0xac02('0xb'),_0x882e5c,_0x252814[_0xac02('0x10')][_0xac02('0x12')]);return _0x6ee6b5(_0x252814['error']['message']);}logger[_0xac02('0x10')](_0xac02('0xb'),_0x882e5c,_0x252814[_0xac02('0x10')][_0xac02('0x12')]);return _0x478cbb(_0x252814[_0xac02('0x10')]['message']);}else{logger[_0xac02('0xa')](_0xac02('0xb'),_0x882e5c,'request\x20sent');_0x478cbb(_0x252814[_0xac02('0x13')]['message']);}})[_0xac02('0x14')](function(_0x193229){logger[_0xac02('0x10')](_0xac02('0xb'),_0x882e5c,_0x193229);_0x6ee6b5(_0x193229);});});} \ No newline at end of file +var _0x8a83=['error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0x8a83,0x1a3));var _0x38a8=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0x8a83[_0x40be86];return _0xda3c3b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x38a8('0x0'));var BPromise=require(_0x38a8('0x1'));var rs=require(_0x38a8('0x2'));var fs=require('fs');var Redis=require(_0x38a8('0x3'));var db=require(_0x38a8('0x4'))['db'];var utils=require(_0x38a8('0x5'));var logger=require('../../config/logger')(_0x38a8('0x6'));var config=require(_0x38a8('0x7'));var jayson=require(_0x38a8('0x8'));var client=jayson[_0x38a8('0x9')][_0x38a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2147d4,_0x56c597,_0x2a30a3){return new BPromise(function(_0x5b7bf5,_0x160634){return client[_0x38a8('0xb')](_0x2147d4,_0x2a30a3)[_0x38a8('0xc')](function(_0x4d9a72){logger['info'](_0x38a8('0xd'),_0x56c597,_0x38a8('0xe'));logger[_0x38a8('0xf')](_0x38a8('0x10'),_0x56c597,'request\x20sent',JSON[_0x38a8('0x11')](_0x4d9a72));if(_0x4d9a72[_0x38a8('0x12')]){if(_0x4d9a72[_0x38a8('0x12')]['code']===0x1f4){logger[_0x38a8('0x12')](_0x38a8('0xd'),_0x56c597,_0x4d9a72[_0x38a8('0x12')][_0x38a8('0x13')]);return _0x160634(_0x4d9a72['error']['message']);}logger[_0x38a8('0x12')]('SalesforceField,\x20%s,\x20%s',_0x56c597,_0x4d9a72[_0x38a8('0x12')][_0x38a8('0x13')]);return _0x5b7bf5(_0x4d9a72[_0x38a8('0x12')][_0x38a8('0x13')]);}else{logger[_0x38a8('0x14')](_0x38a8('0xd'),_0x56c597,_0x38a8('0xe'));_0x5b7bf5(_0x4d9a72[_0x38a8('0x15')][_0x38a8('0x13')]);}})[_0x38a8('0x16')](function(_0x17ff59){logger[_0x38a8('0x12')](_0x38a8('0xd'),_0x56c597,_0x17ff59);_0x160634(_0x17ff59);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 1796b57..d5ad4fd 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 _0xe80d=['isAuthenticated','/:id','get','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller'];(function(_0x3f7a14,_0x3462d7){var _0x412957=function(_0x25ef87){while(--_0x25ef87){_0x3f7a14['push'](_0x3f7a14['shift']());}};_0x412957(++_0x3462d7);}(_0xe80d,0x183));var _0xde80=function(_0x1ca5a3,_0x40b024){_0x1ca5a3=_0x1ca5a3-0x0;var _0xc8acbf=_0xe80d[_0x1ca5a3];return _0xc8acbf;};'use strict';var multer=require(_0xde80('0x0'));var util=require(_0xde80('0x1'));var path=require(_0xde80('0x2'));var timeout=require('connect-timeout');var express=require(_0xde80('0x3'));var router=express[_0xde80('0x4')]();var fs_extra=require(_0xde80('0x5'));var auth=require(_0xde80('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xde80('0x7'));var controller=require(_0xde80('0x8'));router['get']('/',auth[_0xde80('0x9')](),controller['index']);router['get'](_0xde80('0xa'),auth[_0xde80('0x9')](),controller['show']);router[_0xde80('0xb')]('/:id/configurations',auth[_0xde80('0x9')](),controller[_0xde80('0xc')]);router[_0xde80('0xb')](_0xde80('0xd'),auth['isAuthenticated'](),controller[_0xde80('0xe')]);router['post']('/',auth[_0xde80('0x9')](),controller[_0xde80('0xf')]);router['post']('/:id/configurations',auth[_0xde80('0x9')](),controller[_0xde80('0x10')]);router[_0xde80('0x11')](_0xde80('0xa'),auth[_0xde80('0x9')](),controller[_0xde80('0x12')]);router[_0xde80('0x13')](_0xde80('0xa'),auth['isAuthenticated'](),controller[_0xde80('0x14')]);module[_0xde80('0x15')]=router; \ No newline at end of file +var _0x3c0d=['./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x3c0d,0xf6));var _0xd3c0=function(_0x3849ff,_0x2be8dc){_0x3849ff=_0x3849ff-0x0;var _0x497340=_0x3c0d[_0x3849ff];return _0x497340;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd3c0('0x0'));var express=require(_0xd3c0('0x1'));var router=express[_0xd3c0('0x2')]();var fs_extra=require(_0xd3c0('0x3'));var auth=require(_0xd3c0('0x4'));var interaction=require(_0xd3c0('0x5'));var config=require(_0xd3c0('0x6'));var controller=require(_0xd3c0('0x7'));router[_0xd3c0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd3c0('0x9')]);router['get'](_0xd3c0('0xa'),auth[_0xd3c0('0xb')](),controller[_0xd3c0('0xc')]);router[_0xd3c0('0x8')](_0xd3c0('0xd'),auth[_0xd3c0('0xb')](),controller[_0xd3c0('0xe')]);router[_0xd3c0('0x8')](_0xd3c0('0xf'),auth[_0xd3c0('0xb')](),controller['getFields']);router[_0xd3c0('0x10')]('/',auth[_0xd3c0('0xb')](),controller['create']);router['post'](_0xd3c0('0xd'),auth[_0xd3c0('0xb')](),controller[_0xd3c0('0x11')]);router[_0xd3c0('0x12')]('/:id',auth[_0xd3c0('0xb')](),controller[_0xd3c0('0x13')]);router[_0xd3c0('0x14')]('/:id',auth[_0xd3c0('0xb')](),controller[_0xd3c0('0x15')]);module[_0xd3c0('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b088593..c13141d 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 _0xcbee=['remoteUri','sequelize','exports','STRING','username'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcbee,0x14b));var _0xecbe=function(_0x50b31a,_0x202db){_0x50b31a=_0x50b31a-0x0;var _0x4b149b=_0xcbee[_0x50b31a];return _0x4b149b;};'use strict';var Sequelize=require(_0xecbe('0x0'));module[_0xecbe('0x1')]={'name':{'type':Sequelize[_0xecbe('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xecbe('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xecbe('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xecbe('0x4')},'serverUrl':{'type':Sequelize[_0xecbe('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd1e5=['STRING','username','sequelize','exports'];(function(_0x5e8b2d,_0x422ef9){var _0x40971b=function(_0x428940){while(--_0x428940){_0x5e8b2d['push'](_0x5e8b2d['shift']());}};_0x40971b(++_0x422ef9);}(_0xd1e5,0x17e));var _0x5d1e=function(_0x248577,_0xbdce35){_0x248577=_0x248577-0x0;var _0xae43dd=_0xd1e5[_0x248577];return _0xae43dd;};'use strict';var Sequelize=require(_0x5d1e('0x0'));module[_0x5d1e('0x1')]={'name':{'type':Sequelize[_0x5d1e('0x2')]},'description':{'type':Sequelize[_0x5d1e('0x2')]},'username':{'type':Sequelize[_0x5d1e('0x2')],'unique':_0x5d1e('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5d1e('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index d97f3ab..99a8069 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 _0xcb49=['stack','name','send','index','ServicenowAccount','rawAttributes','type','map','query','keys','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','params','length','find','body','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','channel','Descriptions','create','Subjects','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','opened_at','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','username','email','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','all','concat','test','statusCode','True','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','options','eml-format','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error'];(function(_0x1c618c,_0x216969){var _0xd42ed2=function(_0x440581){while(--_0x440581){_0x1c618c['push'](_0x1c618c['shift']());}};_0xd42ed2(++_0x216969);}(_0xcb49,0x13a));var _0x9cb4=function(_0x153faa,_0x75f2a){_0x153faa=_0x153faa-0x0;var _0x43c32a=_0xcb49[_0x153faa];return _0x43c32a;};'use strict';var emlformat=require(_0x9cb4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9cb4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9cb4('0x2'));var moment=require('moment');var BPromise=require(_0x9cb4('0x3'));var Mustache=require('mustache');var util=require(_0x9cb4('0x4'));var path=require(_0x9cb4('0x5'));var sox=require('sox');var csv=require(_0x9cb4('0x6'));var ejs=require(_0x9cb4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9cb4('0x8'));var squel=require('squel');var crypto=require(_0x9cb4('0x9'));var jsforce=require(_0x9cb4('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9cb4('0xb'));var Papa=require(_0x9cb4('0xc'));var Redis=require(_0x9cb4('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9cb4('0xe'));var as=require(_0x9cb4('0xf'));var hardwareService=require(_0x9cb4('0x10'));var logger=require(_0x9cb4('0x11'))(_0x9cb4('0x12'));var utils=require(_0x9cb4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9cb4('0x14'));var db=require(_0x9cb4('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xa4168f,_0x3e6705){_0x3e6705=_0x3e6705||0xcc;return function(_0x425f49){if(_0x425f49){return _0xa4168f['sendStatus'](_0x3e6705);}return _0xa4168f[_0x9cb4('0x16')](_0x3e6705)[_0x9cb4('0x17')]();};}function respondWithResult(_0x26b5be,_0x567b85){_0x567b85=_0x567b85||0xc8;return function(_0x5943c0){if(_0x5943c0){return _0x26b5be['status'](_0x567b85)['json'](_0x5943c0);}};}function respondWithFilteredResult(_0x326aa0,_0x1df781){return function(_0x33f8e3){if(_0x33f8e3){var _0x4536b3=typeof _0x1df781[_0x9cb4('0x18')]==='undefined'&&typeof _0x1df781['limit']==='undefined';var _0x4119dd=_0x33f8e3['count'];var _0x27e033=_0x4536b3?0x0:_0x1df781[_0x9cb4('0x18')];var _0xe35224=_0x4536b3?_0x33f8e3[_0x9cb4('0x19')]:_0x1df781[_0x9cb4('0x18')]+_0x1df781['limit'];var _0x3511a4;if(_0xe35224>=_0x4119dd){_0xe35224=_0x4119dd;_0x3511a4=0xc8;}else{_0x3511a4=0xce;}_0x326aa0[_0x9cb4('0x16')](_0x3511a4);return _0x326aa0[_0x9cb4('0x1a')](_0x9cb4('0x1b'),_0x27e033+'-'+_0xe35224+'/'+_0x4119dd)[_0x9cb4('0x1c')](_0x33f8e3);}return null;};}function patchUpdates(_0x17ea46){return function(_0x12a4f0){try{jsonpatch[_0x9cb4('0x1d')](_0x12a4f0,_0x17ea46,!![]);}catch(_0x29e04b){return BPromise[_0x9cb4('0x1e')](_0x29e04b);}return _0x12a4f0[_0x9cb4('0x1f')]();};}function saveUpdates(_0x5c4273,_0x9d830){return function(_0x42b455){if(_0x42b455){return _0x42b455[_0x9cb4('0x20')](_0x5c4273)['then'](function(_0x3f2189){return _0x3f2189;});}return null;};}function removeEntity(_0x4de970,_0x590961){return function(_0x4a0171){if(_0x4a0171){return _0x4a0171['destroy']()[_0x9cb4('0x21')](function(){_0x4de970[_0x9cb4('0x16')](0xcc)[_0x9cb4('0x17')]();});}};}function handleEntityNotFound(_0x4234af,_0x11308c){return function(_0x551e74){if(!_0x551e74){_0x4234af[_0x9cb4('0x22')](0x194);}return _0x551e74;};}function handleError(_0x28b75a,_0x1455ed){_0x1455ed=_0x1455ed||0x1f4;return function(_0x4a23b4){logger[_0x9cb4('0x23')](_0x4a23b4[_0x9cb4('0x24')]);if(_0x4a23b4['name']){delete _0x4a23b4[_0x9cb4('0x25')];}_0x28b75a[_0x9cb4('0x16')](_0x1455ed)[_0x9cb4('0x26')](_0x4a23b4);};}exports[_0x9cb4('0x27')]=function(_0xbb4c5,_0x5a9d06){var _0x378c37={},_0x5d9841={},_0x5d54f9={'count':0x0,'rows':[]};var _0x55f324=_['map'](db[_0x9cb4('0x28')][_0x9cb4('0x29')],function(_0x446cbd){return{'name':_0x446cbd['fieldName'],'type':_0x446cbd[_0x9cb4('0x2a')]['key']};});_0x5d9841['model']=_[_0x9cb4('0x2b')](_0x55f324,'name');_0x5d9841[_0x9cb4('0x2c')]=_[_0x9cb4('0x2d')](_0xbb4c5[_0x9cb4('0x2c')]);_0x5d9841[_0x9cb4('0x2e')]=_[_0x9cb4('0x2f')](_0x5d9841[_0x9cb4('0x30')],_0x5d9841[_0x9cb4('0x2c')]);_0x378c37[_0x9cb4('0x31')]=_[_0x9cb4('0x2f')](_0x5d9841[_0x9cb4('0x30')],qs[_0x9cb4('0x32')](_0xbb4c5[_0x9cb4('0x2c')]['fields']));_0x378c37[_0x9cb4('0x31')]=_0x378c37[_0x9cb4('0x31')]['length']?_0x378c37[_0x9cb4('0x31')]:_0x5d9841['model'];if(!_0xbb4c5[_0x9cb4('0x2c')]['hasOwnProperty'](_0x9cb4('0x33'))){_0x378c37[_0x9cb4('0x34')]=qs[_0x9cb4('0x34')](_0xbb4c5['query'][_0x9cb4('0x34')]);_0x378c37[_0x9cb4('0x18')]=qs[_0x9cb4('0x18')](_0xbb4c5['query'][_0x9cb4('0x18')]);}_0x378c37[_0x9cb4('0x35')]=qs[_0x9cb4('0x36')](_0xbb4c5[_0x9cb4('0x2c')][_0x9cb4('0x36')]);_0x378c37[_0x9cb4('0x37')]=qs[_0x9cb4('0x2e')](_[_0x9cb4('0x38')](_0xbb4c5['query'],_0x5d9841[_0x9cb4('0x2e')]),_0x55f324);if(_0xbb4c5[_0x9cb4('0x2c')][_0x9cb4('0x39')]){_0x378c37[_0x9cb4('0x37')]=_[_0x9cb4('0x3a')](_0x378c37[_0x9cb4('0x37')],{'$or':_[_0x9cb4('0x2b')](_0x55f324,function(_0x2852e2){if(_0x2852e2[_0x9cb4('0x2a')]!=='VIRTUAL'){var _0x244b14={};_0x244b14[_0x2852e2[_0x9cb4('0x25')]]={'$like':'%'+_0xbb4c5['query'][_0x9cb4('0x39')]+'%'};return _0x244b14;}})});}_0x378c37=_['merge']({},_0x378c37,_0xbb4c5['options']);var _0x442d22={'where':_0x378c37[_0x9cb4('0x37')]};return db[_0x9cb4('0x28')][_0x9cb4('0x19')](_0x442d22)[_0x9cb4('0x21')](function(_0x3210ff){_0x5d54f9[_0x9cb4('0x19')]=_0x3210ff;if(_0xbb4c5[_0x9cb4('0x2c')]['includeAll']){_0x378c37[_0x9cb4('0x3b')]=[{'all':!![]}];}return db[_0x9cb4('0x28')][_0x9cb4('0x3c')](_0x378c37);})[_0x9cb4('0x21')](function(_0x50aca8){_0x5d54f9[_0x9cb4('0x3d')]=_0x50aca8;return _0x5d54f9;})[_0x9cb4('0x21')](respondWithFilteredResult(_0x5a9d06,_0x378c37))[_0x9cb4('0x3e')](handleError(_0x5a9d06,null));};exports['show']=function(_0x3edbfd,_0x45965d){var _0x536b53={'raw':![],'where':{'id':_0x3edbfd[_0x9cb4('0x3f')]['id']}},_0x3c4ef0={};_0x3c4ef0[_0x9cb4('0x30')]=_[_0x9cb4('0x2d')](db[_0x9cb4('0x28')][_0x9cb4('0x29')]);_0x3c4ef0[_0x9cb4('0x2c')]=_[_0x9cb4('0x2d')](_0x3edbfd[_0x9cb4('0x2c')]);_0x3c4ef0[_0x9cb4('0x2e')]=_[_0x9cb4('0x2f')](_0x3c4ef0[_0x9cb4('0x30')],_0x3c4ef0[_0x9cb4('0x2c')]);_0x536b53[_0x9cb4('0x31')]=_['intersection'](_0x3c4ef0[_0x9cb4('0x30')],qs[_0x9cb4('0x32')](_0x3edbfd[_0x9cb4('0x2c')][_0x9cb4('0x32')]));_0x536b53[_0x9cb4('0x31')]=_0x536b53[_0x9cb4('0x31')][_0x9cb4('0x40')]?_0x536b53[_0x9cb4('0x31')]:_0x3c4ef0['model'];if(_0x3edbfd[_0x9cb4('0x2c')]['includeAll']){_0x536b53[_0x9cb4('0x3b')]=[{'all':!![]}];}_0x536b53=_[_0x9cb4('0x3a')]({},_0x536b53,_0x3edbfd['options']);return db[_0x9cb4('0x28')][_0x9cb4('0x41')](_0x536b53)[_0x9cb4('0x21')](handleEntityNotFound(_0x45965d,null))[_0x9cb4('0x21')](respondWithResult(_0x45965d,null))[_0x9cb4('0x3e')](handleError(_0x45965d,null));};exports['create']=function(_0x548596,_0x10e4c9){return db[_0x9cb4('0x28')]['create'](_0x548596['body'],{})['then'](respondWithResult(_0x10e4c9,0xc9))['catch'](handleError(_0x10e4c9,null));};exports[_0x9cb4('0x20')]=function(_0xa4d816,_0x1709ba){if(_0xa4d816[_0x9cb4('0x42')]['id']){delete _0xa4d816['body']['id'];}return db[_0x9cb4('0x28')][_0x9cb4('0x41')]({'where':{'id':_0xa4d816[_0x9cb4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1709ba,null))['then'](saveUpdates(_0xa4d816[_0x9cb4('0x42')],null))[_0x9cb4('0x21')](respondWithResult(_0x1709ba,null))[_0x9cb4('0x3e')](handleError(_0x1709ba,null));};exports[_0x9cb4('0x43')]=function(_0x3bfb07,_0x2ec628){return db[_0x9cb4('0x28')][_0x9cb4('0x41')]({'where':{'id':_0x3bfb07['params']['id']}})['then'](handleEntityNotFound(_0x2ec628,null))['then'](removeEntity(_0x2ec628,null))[_0x9cb4('0x3e')](handleError(_0x2ec628,null));};exports[_0x9cb4('0x44')]=function(_0x1699d3,_0x29d8bd,_0xec5261){var _0x327f44={};var _0x27a149={};var _0x189783;var _0x588179;return db[_0x9cb4('0x28')][_0x9cb4('0x45')]({'where':{'id':_0x1699d3[_0x9cb4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x29d8bd,null))['then'](function(_0x1e5667){if(_0x1e5667){_0x189783=_0x1e5667;_0x27a149[_0x9cb4('0x30')]=_[_0x9cb4('0x2d')](db[_0x9cb4('0x46')]['rawAttributes']);_0x27a149['query']=_[_0x9cb4('0x2d')](_0x1699d3[_0x9cb4('0x2c')]);_0x27a149[_0x9cb4('0x2e')]=_[_0x9cb4('0x2f')](_0x27a149[_0x9cb4('0x30')],_0x27a149['query']);_0x327f44[_0x9cb4('0x31')]=_[_0x9cb4('0x2f')](_0x27a149[_0x9cb4('0x30')],qs[_0x9cb4('0x32')](_0x1699d3[_0x9cb4('0x2c')]['fields']));_0x327f44['attributes']=_0x327f44[_0x9cb4('0x31')][_0x9cb4('0x40')]?_0x327f44[_0x9cb4('0x31')]:_0x27a149['model'];_0x327f44[_0x9cb4('0x35')]=qs[_0x9cb4('0x36')](_0x1699d3['query']['sort']);_0x327f44[_0x9cb4('0x37')]=qs[_0x9cb4('0x2e')](_[_0x9cb4('0x38')](_0x1699d3['query'],_0x27a149[_0x9cb4('0x2e')]));if(_0x1699d3[_0x9cb4('0x2c')][_0x9cb4('0x39')]){_0x327f44[_0x9cb4('0x37')]=_[_0x9cb4('0x3a')](_0x327f44[_0x9cb4('0x37')],{'$or':_[_0x9cb4('0x2b')](_0x327f44['attributes'],function(_0x1335b1){var _0x4409f2={};_0x4409f2[_0x1335b1]={'$like':'%'+_0x1699d3[_0x9cb4('0x2c')]['filter']+'%'};return _0x4409f2;})});}_0x327f44=_[_0x9cb4('0x3a')]({},_0x327f44,_0x1699d3['options']);return _0x189783['getConfigurations'](_0x327f44);}})[_0x9cb4('0x21')](function(_0x47eda5){if(_0x47eda5){_0x588179=_0x47eda5[_0x9cb4('0x40')];if(!_0x1699d3[_0x9cb4('0x2c')]['hasOwnProperty'](_0x9cb4('0x33'))){_0x327f44[_0x9cb4('0x34')]=qs[_0x9cb4('0x34')](_0x1699d3[_0x9cb4('0x2c')][_0x9cb4('0x34')]);_0x327f44[_0x9cb4('0x18')]=qs['offset'](_0x1699d3[_0x9cb4('0x2c')][_0x9cb4('0x18')]);}return _0x189783[_0x9cb4('0x44')](_0x327f44);}})[_0x9cb4('0x21')](function(_0x18fbf3){if(_0x18fbf3){return _0x18fbf3?{'count':_0x588179,'rows':_0x18fbf3}:null;}})[_0x9cb4('0x21')](respondWithResult(_0x29d8bd,null))[_0x9cb4('0x3e')](handleError(_0x29d8bd,null));};exports[_0x9cb4('0x47')]=function(_0x2604e2,_0x33b239,_0xc6a9b7){if(_0x2604e2[_0x9cb4('0x42')]['id']){delete _0x2604e2[_0x9cb4('0x42')]['id'];}return db[_0x9cb4('0x28')][_0x9cb4('0x45')]({'where':{'id':_0x2604e2[_0x9cb4('0x3f')]['id']}})[_0x9cb4('0x21')](handleEntityNotFound(_0x33b239,null))[_0x9cb4('0x21')](function(_0x7f5dc3){if(_0x7f5dc3){_0x2604e2[_0x9cb4('0x42')][_0x9cb4('0x48')]=_0x7f5dc3['id'];_0x2604e2[_0x9cb4('0x42')]['Subjects']=integrations['getSubjects'](_0x2604e2[_0x9cb4('0x42')][_0x9cb4('0x49')],_0x2604e2[_0x9cb4('0x42')][_0x9cb4('0x2a')]);_0x2604e2[_0x9cb4('0x42')][_0x9cb4('0x4a')]=integrations['getDescriptions'](_0x2604e2[_0x9cb4('0x42')][_0x9cb4('0x49')],_0x2604e2['body']['type']);return db[_0x9cb4('0x46')][_0x9cb4('0x4b')](_0x2604e2[_0x9cb4('0x42')],{'include':[{'model':db['ServicenowField'],'as':_0x9cb4('0x4c')},{'model':db[_0x9cb4('0x4d')],'as':_0x9cb4('0x4a')}]});}return null;})[_0x9cb4('0x21')](respondWithResult(_0x33b239,null))[_0x9cb4('0x3e')](handleError(_0x33b239,null));};exports['getFields']=function(_0x3c0f03,_0x253f69,_0x5d7ffe){var _0x2aa619=[_0x9cb4('0x4e'),_0x9cb4('0x4f'),_0x9cb4('0x50'),_0x9cb4('0x51'),_0x9cb4('0x52'),_0x9cb4('0x53'),_0x9cb4('0x54'),'severity',_0x9cb4('0x55')];var _0x5e72eb=[_0x9cb4('0x56'),'made_sla',_0x9cb4('0x57'),_0x9cb4('0x58'),'upon_reject',_0x9cb4('0x59'),_0x9cb4('0x5a'),'hold_reason',_0x9cb4('0x5b'),_0x9cb4('0x5c'),_0x9cb4('0x5d'),_0x9cb4('0x5e'),_0x9cb4('0x5f'),_0x9cb4('0x60'),_0x9cb4('0x61'),'sys_domain',_0x9cb4('0x62'),'sys_created_by',_0x9cb4('0x50'),'order',_0x9cb4('0x63'),_0x9cb4('0x64'),'cmdb_ci',_0x9cb4('0x65'),_0x9cb4('0x66'),_0x9cb4('0x67'),_0x9cb4('0x68'),_0x9cb4('0x69'),_0x9cb4('0x6a'),_0x9cb4('0x6b'),_0x9cb4('0x6c'),'time_worked',_0x9cb4('0x6d'),_0x9cb4('0x6e'),'business_duration','group_list','work_end',_0x9cb4('0x6f'),_0x9cb4('0x70'),'caller_id',_0x9cb4('0x71'),'subcategory',_0x9cb4('0x72'),_0x9cb4('0x73'),_0x9cb4('0x52'),_0x9cb4('0x74'),_0x9cb4('0x75'),_0x9cb4('0x76'),_0x9cb4('0x77'),'business_stc',_0x9cb4('0x78'),_0x9cb4('0x79'),_0x9cb4('0x7a'),_0x9cb4('0x53'),_0x9cb4('0x7b'),_0x9cb4('0x7c'),'closed_by',_0x9cb4('0x7d'),_0x9cb4('0x7e'),_0x9cb4('0x7f'),_0x9cb4('0x80'),_0x9cb4('0x81'),'incident_state',_0x9cb4('0x82'),_0x9cb4('0x83'),_0x9cb4('0x84'),'reassignment_count',_0x9cb4('0x85'),'assigned_to','severity',_0x9cb4('0x86'),_0x9cb4('0x87'),_0x9cb4('0x88'),_0x9cb4('0x89'),_0x9cb4('0x8a'),_0x9cb4('0x8b'),_0x9cb4('0x8c'),_0x9cb4('0x8d'),_0x9cb4('0x8e'),_0x9cb4('0x8f'),_0x9cb4('0x90'),'location',_0x9cb4('0x55')];var _0x137ebf='';var _0x1af344='';var _0x23ecbe=[];var _0x1533a4='';var _0x5f2541='';var _0x392c6e=[];var _0x5cff51='';var _0x4cbc21='';var _0x4a6e5b={};var _0x4078aa='';return db['ServicenowAccount'][_0x9cb4('0x45')]({'where':{'id':_0x3c0f03[_0x9cb4('0x3f')]['id']},'attributes':['id',_0x9cb4('0x91'),'password',_0x9cb4('0x92'),'remoteUri',_0x9cb4('0x93')]})[_0x9cb4('0x21')](handleEntityNotFound(_0x253f69,null))['then'](function(_0x408b70){if(_0x408b70){_0x4078aa=_0x408b70['remoteUri'];var _0x250fa7=_0x4078aa[_0x9cb4('0x94')](-0x1);if(_0x250fa7==='/'){_0x4078aa=_0x4078aa[_0x9cb4('0x95')](0x0,_0x4078aa[_0x9cb4('0x96')](_0x250fa7));}_0x4cbc21=util['format'](_0x9cb4('0x97'),_0x4078aa);_0x5cff51=util[_0x9cb4('0x98')]('%s/api/now/table/',_0x4078aa);_0x4a6e5b={'user':_0x408b70[_0x9cb4('0x91')],'pass':_0x408b70[_0x9cb4('0x99')]};var _0x1f2c05={'method':_0x9cb4('0x9a'),'uri':_0x4cbc21+_0x9cb4('0x9b'),'auth':_0x4a6e5b,'json':!![]};return rp(_0x1f2c05);}})[_0x9cb4('0x21')](function(_0x5921ae){if(_0x5921ae[_0x9cb4('0x9c')][_0x9cb4('0x40')]>0x0){_0x137ebf=_0x5921ae[_0x9cb4('0x9c')];}console[_0x9cb4('0x9d')](_0x9cb4('0x9e'),_0x137ebf);_0x392c6e=[];_0x1af344=Object[_0x9cb4('0x9f')]([],_0x137ebf);_[_0x9cb4('0xa0')](_0x1af344,function(_0xbd6c9f){return!_0x2aa619[_0x9cb4('0xa1')](_0xbd6c9f[_0x9cb4('0x25')]);});_0x1af344[_0x9cb4('0xa2')](function(_0x130b81){var _0x5dc0f8=createFieldObject(_0x5cff51,_0x4a6e5b,_0x130b81[_0x9cb4('0xa3')],_0x130b81[_0x9cb4('0x25')],_0x130b81['label'],![]);_0x392c6e[_0x9cb4('0xa4')](_0x5dc0f8);});return Promise['all'](_0x392c6e);})[_0x9cb4('0x21')](function(_0x172cf8){_0x23ecbe=_0x172cf8;_0x1533a4=Object['assign']([],_0x137ebf);console[_0x9cb4('0x9d')]('TCL:\x20_object',_0x137ebf);_[_0x9cb4('0xa0')](_0x1533a4,function(_0x2350c4){return _0x5e72eb['includes'](_0x2350c4[_0x9cb4('0x25')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x1533a4);_0x392c6e=[];_0x1533a4['forEach'](function(_0x100aae){var _0x2039fd=createFieldObject(_0x5cff51,_0x4a6e5b,_0x100aae[_0x9cb4('0xa3')],_0x100aae[_0x9cb4('0x25')],_0x100aae['label'],!![]);_0x392c6e[_0x9cb4('0xa4')](_0x2039fd);});return Promise[_0x9cb4('0xa5')](_0x392c6e);})[_0x9cb4('0x21')](function(_0x172645){_0x5f2541=_0x172645;var _0x3c9b12=_0x23ecbe[_0x9cb4('0xa6')](_0x5f2541);return{'count':_0x3c9b12[_0x9cb4('0x40')],'rows':_0x3c9b12};})[_0x9cb4('0x21')](respondWithResult(_0x253f69,null))['catch'](function(_0x254f35){console[_0x9cb4('0x9d')]('ServiceNow\x20error:\x20'+_0x254f35);var _0x58c5c5=_0x3c0f03[_0x9cb4('0x2c')][_0x9cb4('0xa7')]?0x1f4:_0x254f35[_0x9cb4('0xa8')]||0x1f4;logger['error'](_0x254f35[_0x9cb4('0x24')]);delete _0x254f35[_0x9cb4('0x25')];if(_0x58c5c5===0x191){_0x58c5c5=0x190;}_0x253f69[_0x9cb4('0x16')](_0x58c5c5)['send'](_0x3c0f03['query'][_0x9cb4('0xa7')]?{'message':'Wrong\x20credentials','statusCode':_0x254f35[_0x9cb4('0xa8')]}:_0x254f35);});};function createFieldObject(_0x17c39a,_0x3dce36,_0x4acfd2,_0x12034f,_0x50140f,_0x5a4c81){return new Promise(function(_0xf88e63,_0x1146ae){var _0x5a1965={'id':_0x12034f,'name':_0x50140f,'custom':_0x5a4c81};if(_0x4acfd2==='boolean'){_0x5a1965['options']=[{'name':_0x9cb4('0xa9'),'value':'true'},{'name':'False','value':'false'}];_0xf88e63(_0x5a1965);}else{var _0x821196={'method':_0x9cb4('0x9a'),'uri':_0x17c39a+_0x9cb4('0xaa')+_0x12034f,'auth':_0x3dce36,'json':!![]};return rp(_0x821196)[_0x9cb4('0x21')](function(_0x5a309e){var _0x54e51c=[];if(_0x5a309e[_0x9cb4('0x9c')]['length']>0x0){_0x5a309e[_0x9cb4('0x9c')][_0x9cb4('0xa2')](function(_0x2670bb){if(_0x2670bb[_0x9cb4('0xab')]===_0x9cb4('0xac')){var _0x1a5bc1={'name':_0x2670bb['label'],'value':_0x2670bb[_0x9cb4('0xad')]};_0x54e51c[_0x9cb4('0xa4')](_0x1a5bc1);}});}_0x5a1965[_0x9cb4('0xae')]=_0x54e51c;if(_0x5a1965[_0x9cb4('0xae')][_0x9cb4('0x40')]>0x0){_0xf88e63(_0x5a1965);}else{if(_0x5a4c81==![]){_0xf88e63();}else{_0xf88e63(_0x5a1965);}}});}});} \ No newline at end of file +var _0x29ec=['problem_id','reassignment_count','activity_due','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','email','remoteUri','serverUrl','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','assign','remove','internalType','label','all','includes','log','forEach','push','concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','includeAll','include','ServicenowAccount','findAll','rows','catch','show','params','options','create','body','find','getConfigurations','findOne','ServicenowConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','parent','caused_by','watch_list','upon_reject','sys_updated_on','opened_by','user_input','sys_created_on','order','calendar_stc','closed_at','cmdb_ci','active','priority','sys_domain_path','rfc','time_worked','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency'];(function(_0x231875,_0x59343d){var _0x3eb5c7=function(_0x2ef86f){while(--_0x2ef86f){_0x231875['push'](_0x231875['shift']());}};_0x3eb5c7(++_0x59343d);}(_0x29ec,0x197));var _0xc29e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29ec[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc29e('0x0'));var rimraf=require(_0xc29e('0x1'));var zipdir=require(_0xc29e('0x2'));var jsonpatch=require(_0xc29e('0x3'));var rp=require(_0xc29e('0x4'));var moment=require(_0xc29e('0x5'));var BPromise=require(_0xc29e('0x6'));var Mustache=require(_0xc29e('0x7'));var util=require(_0xc29e('0x8'));var path=require('path');var sox=require(_0xc29e('0x9'));var csv=require(_0xc29e('0xa'));var ejs=require(_0xc29e('0xb'));var fs=require('fs');var fs_extra=require(_0xc29e('0xc'));var _=require('lodash');var squel=require(_0xc29e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc29e('0xe'));var toCsv=require(_0xc29e('0xa'));var querystring=require(_0xc29e('0xf'));var Papa=require('papaparse');var Redis=require(_0xc29e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc29e('0x11'));var as=require(_0xc29e('0x12'));var hardwareService=require(_0xc29e('0x13'));var logger=require(_0xc29e('0x14'))('api');var utils=require(_0xc29e('0x15'));var config=require(_0xc29e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc29e('0x17'))['db'];var integrations=require(_0xc29e('0x18'));function respondWithStatusCode(_0x35ed83,_0x472439){_0x472439=_0x472439||0xcc;return function(_0x5567da){if(_0x5567da){return _0x35ed83[_0xc29e('0x19')](_0x472439);}return _0x35ed83[_0xc29e('0x1a')](_0x472439)[_0xc29e('0x1b')]();};}function respondWithResult(_0x1a4861,_0x1beea4){_0x1beea4=_0x1beea4||0xc8;return function(_0x5132c2){if(_0x5132c2){return _0x1a4861[_0xc29e('0x1a')](_0x1beea4)[_0xc29e('0x1c')](_0x5132c2);}};}function respondWithFilteredResult(_0x327686,_0x4a25d4){return function(_0x26b999){if(_0x26b999){var _0x40b506=typeof _0x4a25d4[_0xc29e('0x1d')]===_0xc29e('0x1e')&&typeof _0x4a25d4['limit']==='undefined';var _0x789923=_0x26b999[_0xc29e('0x1f')];var _0x29f4f5=_0x40b506?0x0:_0x4a25d4['offset'];var _0x5d891a=_0x40b506?_0x26b999[_0xc29e('0x1f')]:_0x4a25d4[_0xc29e('0x1d')]+_0x4a25d4[_0xc29e('0x20')];var _0x25aafc;if(_0x5d891a>=_0x789923){_0x5d891a=_0x789923;_0x25aafc=0xc8;}else{_0x25aafc=0xce;}_0x327686[_0xc29e('0x1a')](_0x25aafc);return _0x327686[_0xc29e('0x21')](_0xc29e('0x22'),_0x29f4f5+'-'+_0x5d891a+'/'+_0x789923)[_0xc29e('0x1c')](_0x26b999);}return null;};}function patchUpdates(_0xe3080c){return function(_0x2b1993){try{jsonpatch[_0xc29e('0x23')](_0x2b1993,_0xe3080c,!![]);}catch(_0x2663d3){return BPromise[_0xc29e('0x24')](_0x2663d3);}return _0x2b1993['save']();};}function saveUpdates(_0x2296f5,_0x4bb0bc){return function(_0x43afb0){if(_0x43afb0){return _0x43afb0[_0xc29e('0x25')](_0x2296f5)['then'](function(_0x285632){return _0x285632;});}return null;};}function removeEntity(_0x15f2bb,_0x3ea52d){return function(_0xa80ad5){if(_0xa80ad5){return _0xa80ad5[_0xc29e('0x26')]()[_0xc29e('0x27')](function(){_0x15f2bb['status'](0xcc)[_0xc29e('0x1b')]();});}};}function handleEntityNotFound(_0x8e7312,_0x470faf){return function(_0x19e480){if(!_0x19e480){_0x8e7312['sendStatus'](0x194);}return _0x19e480;};}function handleError(_0x45a084,_0xe922){_0xe922=_0xe922||0x1f4;return function(_0xfaa9ee){logger['error'](_0xfaa9ee[_0xc29e('0x28')]);if(_0xfaa9ee['name']){delete _0xfaa9ee[_0xc29e('0x29')];}_0x45a084['status'](_0xe922)[_0xc29e('0x2a')](_0xfaa9ee);};}exports[_0xc29e('0x2b')]=function(_0x1fe457,_0x4267a3){var _0xb081d0={},_0x58b605={},_0x2e60ea={'count':0x0,'rows':[]};var _0x396837=_[_0xc29e('0x2c')](db['ServicenowAccount'][_0xc29e('0x2d')],function(_0x111e77){return{'name':_0x111e77['fieldName'],'type':_0x111e77[_0xc29e('0x2e')][_0xc29e('0x2f')]};});_0x58b605[_0xc29e('0x30')]=_[_0xc29e('0x2c')](_0x396837,_0xc29e('0x29'));_0x58b605[_0xc29e('0x31')]=_[_0xc29e('0x32')](_0x1fe457[_0xc29e('0x31')]);_0x58b605[_0xc29e('0x33')]=_[_0xc29e('0x34')](_0x58b605[_0xc29e('0x30')],_0x58b605['query']);_0xb081d0[_0xc29e('0x35')]=_['intersection'](_0x58b605[_0xc29e('0x30')],qs[_0xc29e('0x36')](_0x1fe457[_0xc29e('0x31')]['fields']));_0xb081d0[_0xc29e('0x35')]=_0xb081d0[_0xc29e('0x35')][_0xc29e('0x37')]?_0xb081d0[_0xc29e('0x35')]:_0x58b605['model'];if(!_0x1fe457[_0xc29e('0x31')][_0xc29e('0x38')](_0xc29e('0x39'))){_0xb081d0[_0xc29e('0x20')]=qs[_0xc29e('0x20')](_0x1fe457[_0xc29e('0x31')][_0xc29e('0x20')]);_0xb081d0[_0xc29e('0x1d')]=qs[_0xc29e('0x1d')](_0x1fe457['query']['offset']);}_0xb081d0['order']=qs['sort'](_0x1fe457[_0xc29e('0x31')][_0xc29e('0x3a')]);_0xb081d0['where']=qs[_0xc29e('0x33')](_['pick'](_0x1fe457['query'],_0x58b605[_0xc29e('0x33')]),_0x396837);if(_0x1fe457['query'][_0xc29e('0x3b')]){_0xb081d0['where']=_[_0xc29e('0x3c')](_0xb081d0[_0xc29e('0x3d')],{'$or':_[_0xc29e('0x2c')](_0x396837,function(_0x290936){if(_0x290936[_0xc29e('0x2e')]!==_0xc29e('0x3e')){var _0x49c099={};_0x49c099[_0x290936[_0xc29e('0x29')]]={'$like':'%'+_0x1fe457[_0xc29e('0x31')]['filter']+'%'};return _0x49c099;}})});}_0xb081d0=_['merge']({},_0xb081d0,_0x1fe457['options']);var _0x96923f={'where':_0xb081d0[_0xc29e('0x3d')]};return db['ServicenowAccount'][_0xc29e('0x1f')](_0x96923f)[_0xc29e('0x27')](function(_0x2d9414){_0x2e60ea[_0xc29e('0x1f')]=_0x2d9414;if(_0x1fe457[_0xc29e('0x31')][_0xc29e('0x3f')]){_0xb081d0[_0xc29e('0x40')]=[{'all':!![]}];}return db[_0xc29e('0x41')][_0xc29e('0x42')](_0xb081d0);})[_0xc29e('0x27')](function(_0x1185ff){_0x2e60ea[_0xc29e('0x43')]=_0x1185ff;return _0x2e60ea;})[_0xc29e('0x27')](respondWithFilteredResult(_0x4267a3,_0xb081d0))[_0xc29e('0x44')](handleError(_0x4267a3,null));};exports[_0xc29e('0x45')]=function(_0x48c5f5,_0x55bc99){var _0x593c42={'raw':![],'where':{'id':_0x48c5f5[_0xc29e('0x46')]['id']}},_0x1b5cf2={};_0x1b5cf2[_0xc29e('0x30')]=_[_0xc29e('0x32')](db[_0xc29e('0x41')][_0xc29e('0x2d')]);_0x1b5cf2[_0xc29e('0x31')]=_['keys'](_0x48c5f5[_0xc29e('0x31')]);_0x1b5cf2['filters']=_['intersection'](_0x1b5cf2['model'],_0x1b5cf2[_0xc29e('0x31')]);_0x593c42[_0xc29e('0x35')]=_[_0xc29e('0x34')](_0x1b5cf2[_0xc29e('0x30')],qs['fields'](_0x48c5f5[_0xc29e('0x31')][_0xc29e('0x36')]));_0x593c42[_0xc29e('0x35')]=_0x593c42['attributes'][_0xc29e('0x37')]?_0x593c42[_0xc29e('0x35')]:_0x1b5cf2[_0xc29e('0x30')];if(_0x48c5f5['query'][_0xc29e('0x3f')]){_0x593c42[_0xc29e('0x40')]=[{'all':!![]}];}_0x593c42=_['merge']({},_0x593c42,_0x48c5f5[_0xc29e('0x47')]);return db[_0xc29e('0x41')]['find'](_0x593c42)[_0xc29e('0x27')](handleEntityNotFound(_0x55bc99,null))[_0xc29e('0x27')](respondWithResult(_0x55bc99,null))[_0xc29e('0x44')](handleError(_0x55bc99,null));};exports['create']=function(_0x187f48,_0xe726c9){return db[_0xc29e('0x41')][_0xc29e('0x48')](_0x187f48['body'],{})[_0xc29e('0x27')](respondWithResult(_0xe726c9,0xc9))[_0xc29e('0x44')](handleError(_0xe726c9,null));};exports[_0xc29e('0x25')]=function(_0x20b022,_0x1e2018){if(_0x20b022[_0xc29e('0x49')]['id']){delete _0x20b022[_0xc29e('0x49')]['id'];}return db[_0xc29e('0x41')][_0xc29e('0x4a')]({'where':{'id':_0x20b022[_0xc29e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1e2018,null))[_0xc29e('0x27')](saveUpdates(_0x20b022[_0xc29e('0x49')],null))[_0xc29e('0x27')](respondWithResult(_0x1e2018,null))['catch'](handleError(_0x1e2018,null));};exports[_0xc29e('0x26')]=function(_0x46ee0d,_0x5df9c2){return db['ServicenowAccount'][_0xc29e('0x4a')]({'where':{'id':_0x46ee0d[_0xc29e('0x46')]['id']}})[_0xc29e('0x27')](handleEntityNotFound(_0x5df9c2,null))['then'](removeEntity(_0x5df9c2,null))['catch'](handleError(_0x5df9c2,null));};exports[_0xc29e('0x4b')]=function(_0x4737f6,_0x14c093,_0x179629){var _0x41acf2={};var _0x13623c={};var _0x568b63;var _0x2f9378;return db['ServicenowAccount'][_0xc29e('0x4c')]({'where':{'id':_0x4737f6[_0xc29e('0x46')]['id']}})[_0xc29e('0x27')](handleEntityNotFound(_0x14c093,null))[_0xc29e('0x27')](function(_0x45fc5f){if(_0x45fc5f){_0x568b63=_0x45fc5f;_0x13623c[_0xc29e('0x30')]=_['keys'](db[_0xc29e('0x4d')][_0xc29e('0x2d')]);_0x13623c[_0xc29e('0x31')]=_['keys'](_0x4737f6[_0xc29e('0x31')]);_0x13623c[_0xc29e('0x33')]=_[_0xc29e('0x34')](_0x13623c[_0xc29e('0x30')],_0x13623c[_0xc29e('0x31')]);_0x41acf2[_0xc29e('0x35')]=_[_0xc29e('0x34')](_0x13623c['model'],qs['fields'](_0x4737f6[_0xc29e('0x31')]['fields']));_0x41acf2[_0xc29e('0x35')]=_0x41acf2[_0xc29e('0x35')]['length']?_0x41acf2[_0xc29e('0x35')]:_0x13623c[_0xc29e('0x30')];_0x41acf2['order']=qs[_0xc29e('0x3a')](_0x4737f6[_0xc29e('0x31')][_0xc29e('0x3a')]);_0x41acf2[_0xc29e('0x3d')]=qs['filters'](_[_0xc29e('0x4e')](_0x4737f6[_0xc29e('0x31')],_0x13623c[_0xc29e('0x33')]));if(_0x4737f6[_0xc29e('0x31')][_0xc29e('0x3b')]){_0x41acf2['where']=_[_0xc29e('0x3c')](_0x41acf2['where'],{'$or':_[_0xc29e('0x2c')](_0x41acf2[_0xc29e('0x35')],function(_0x26d37d){var _0x5ab925={};_0x5ab925[_0x26d37d]={'$like':'%'+_0x4737f6[_0xc29e('0x31')]['filter']+'%'};return _0x5ab925;})});}_0x41acf2=_['merge']({},_0x41acf2,_0x4737f6[_0xc29e('0x47')]);return _0x568b63[_0xc29e('0x4b')](_0x41acf2);}})[_0xc29e('0x27')](function(_0x5997c4){if(_0x5997c4){_0x2f9378=_0x5997c4[_0xc29e('0x37')];if(!_0x4737f6[_0xc29e('0x31')][_0xc29e('0x38')](_0xc29e('0x39'))){_0x41acf2['limit']=qs['limit'](_0x4737f6[_0xc29e('0x31')]['limit']);_0x41acf2[_0xc29e('0x1d')]=qs[_0xc29e('0x1d')](_0x4737f6[_0xc29e('0x31')][_0xc29e('0x1d')]);}return _0x568b63[_0xc29e('0x4b')](_0x41acf2);}})[_0xc29e('0x27')](function(_0x14e5f3){if(_0x14e5f3){return _0x14e5f3?{'count':_0x2f9378,'rows':_0x14e5f3}:null;}})['then'](respondWithResult(_0x14c093,null))[_0xc29e('0x44')](handleError(_0x14c093,null));};exports[_0xc29e('0x4f')]=function(_0x50a7c1,_0x1513f0,_0x262b17){if(_0x50a7c1[_0xc29e('0x49')]['id']){delete _0x50a7c1[_0xc29e('0x49')]['id'];}return db[_0xc29e('0x41')][_0xc29e('0x4c')]({'where':{'id':_0x50a7c1[_0xc29e('0x46')]['id']}})[_0xc29e('0x27')](handleEntityNotFound(_0x1513f0,null))[_0xc29e('0x27')](function(_0x57fa11){if(_0x57fa11){_0x50a7c1['body'][_0xc29e('0x50')]=_0x57fa11['id'];_0x50a7c1[_0xc29e('0x49')][_0xc29e('0x51')]=integrations[_0xc29e('0x52')](_0x50a7c1['body'][_0xc29e('0x53')],_0x50a7c1['body']['type']);_0x50a7c1[_0xc29e('0x49')]['Descriptions']=integrations[_0xc29e('0x54')](_0x50a7c1[_0xc29e('0x49')][_0xc29e('0x53')],_0x50a7c1[_0xc29e('0x49')][_0xc29e('0x2e')]);return db[_0xc29e('0x4d')]['create'](_0x50a7c1[_0xc29e('0x49')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0xc29e('0x55')}]});}return null;})[_0xc29e('0x27')](respondWithResult(_0x1513f0,null))[_0xc29e('0x44')](handleError(_0x1513f0,null));};exports['getFields']=function(_0x55a7d8,_0x407de6,_0x3a4bcb){var _0x101398=[_0xc29e('0x56'),_0xc29e('0x57'),_0xc29e('0x58'),_0xc29e('0x59'),_0xc29e('0x5a'),_0xc29e('0x5b'),_0xc29e('0x5c'),'severity','category'];var _0x4069e2=[_0xc29e('0x5d'),_0xc29e('0x56'),_0xc29e('0x5e'),_0xc29e('0x5f'),_0xc29e('0x60'),_0xc29e('0x61'),'child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by',_0xc29e('0x62'),_0xc29e('0x63'),_0xc29e('0x64'),'sys_domain','state','sys_created_by',_0xc29e('0x58'),_0xc29e('0x65'),_0xc29e('0x66'),_0xc29e('0x67'),_0xc29e('0x68'),'delivery_plan','impact',_0xc29e('0x69'),'work_notes_list','business_service',_0xc29e('0x6a'),_0xc29e('0x6b'),_0xc29e('0x6c'),_0xc29e('0x6d'),'expected_start','opened_at','business_duration',_0xc29e('0x6e'),_0xc29e('0x6f'),'reopened_time',_0xc29e('0x70'),_0xc29e('0x71'),_0xc29e('0x72'),_0xc29e('0x59'),_0xc29e('0x73'),_0xc29e('0x74'),_0xc29e('0x5a'),'correlation_display','delivery_task',_0xc29e('0x75'),_0xc29e('0x76'),_0xc29e('0x77'),'additional_assignee_list','description',_0xc29e('0x78'),_0xc29e('0x5b'),_0xc29e('0x79'),_0xc29e('0x7a'),_0xc29e('0x7b'),_0xc29e('0x7c'),_0xc29e('0x7d'),_0xc29e('0x7e'),_0xc29e('0x7f'),_0xc29e('0x80'),'incident_state',_0xc29e('0x81'),_0xc29e('0x82'),'company',_0xc29e('0x83'),_0xc29e('0x84'),'assigned_to',_0xc29e('0x85'),_0xc29e('0x86'),_0xc29e('0x87'),_0xc29e('0x88'),_0xc29e('0x89'),_0xc29e('0x8a'),_0xc29e('0x8b'),_0xc29e('0x8c'),_0xc29e('0x8d'),_0xc29e('0x8e'),_0xc29e('0x8f'),_0xc29e('0x90'),_0xc29e('0x91'),_0xc29e('0x92')];var _0x311894='';var _0x27065c='';var _0x1242b3=[];var _0x322fe3='';var _0x5e1294='';var _0x9c96c0=[];var _0x47ec1b='';var _0x311114='';var _0x1df5a2={};var _0x7a9c56='';return db[_0xc29e('0x41')][_0xc29e('0x4c')]({'where':{'id':_0x55a7d8[_0xc29e('0x46')]['id']},'attributes':['id',_0xc29e('0x93'),'password',_0xc29e('0x94'),_0xc29e('0x95'),_0xc29e('0x96')]})['then'](handleEntityNotFound(_0x407de6,null))[_0xc29e('0x27')](function(_0x1e7766){if(_0x1e7766){_0x7a9c56=_0x1e7766[_0xc29e('0x95')];var _0x1cd786=_0x7a9c56['slice'](-0x1);if(_0x1cd786==='/'){_0x7a9c56=_0x7a9c56['substring'](0x0,_0x7a9c56['lastIndexOf'](_0x1cd786));}_0x311114=util[_0xc29e('0x97')](_0xc29e('0x98'),_0x7a9c56);_0x47ec1b=util['format'](_0xc29e('0x99'),_0x7a9c56);_0x1df5a2={'user':_0x1e7766[_0xc29e('0x93')],'pass':_0x1e7766[_0xc29e('0x9a')]};var _0x4710a7={'method':_0xc29e('0x9b'),'uri':_0x311114+_0xc29e('0x9c'),'auth':_0x1df5a2,'json':!![]};return rp(_0x4710a7);}})[_0xc29e('0x27')](function(_0x57b7b9){if(_0x57b7b9['result'][_0xc29e('0x37')]>0x0){_0x311894=_0x57b7b9[_0xc29e('0x9d')];}console['log']('incident\x20table\x20objects',_0x311894);_0x9c96c0=[];_0x27065c=Object[_0xc29e('0x9e')]([],_0x311894);_[_0xc29e('0x9f')](_0x27065c,function(_0x279690){return!_0x101398['includes'](_0x279690[_0xc29e('0x29')]);});_0x27065c['forEach'](function(_0x8b6759){var _0xb25483=createFieldObject(_0x47ec1b,_0x1df5a2,_0x8b6759[_0xc29e('0xa0')],_0x8b6759[_0xc29e('0x29')],_0x8b6759[_0xc29e('0xa1')],![]);_0x9c96c0['push'](_0xb25483);});return Promise[_0xc29e('0xa2')](_0x9c96c0);})['then'](function(_0xd17742){_0x1242b3=_0xd17742;_0x322fe3=Object[_0xc29e('0x9e')]([],_0x311894);console['log']('TCL:\x20_object',_0x311894);_[_0xc29e('0x9f')](_0x322fe3,function(_0x24b209){return _0x4069e2[_0xc29e('0xa3')](_0x24b209['name']);});console[_0xc29e('0xa4')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x322fe3);_0x9c96c0=[];_0x322fe3[_0xc29e('0xa5')](function(_0x1bf436){var _0x5d558d=createFieldObject(_0x47ec1b,_0x1df5a2,_0x1bf436[_0xc29e('0xa0')],_0x1bf436[_0xc29e('0x29')],_0x1bf436[_0xc29e('0xa1')],!![]);_0x9c96c0[_0xc29e('0xa6')](_0x5d558d);});return Promise['all'](_0x9c96c0);})[_0xc29e('0x27')](function(_0x414deb){_0x5e1294=_0x414deb;var _0x5427d6=_0x1242b3[_0xc29e('0xa7')](_0x5e1294);return{'count':_0x5427d6['length'],'rows':_0x5427d6};})[_0xc29e('0x27')](respondWithResult(_0x407de6,null))[_0xc29e('0x44')](function(_0xfa4bd2){console[_0xc29e('0xa4')](_0xc29e('0xa8')+_0xfa4bd2);var _0x1fe2d5=_0x55a7d8[_0xc29e('0x31')][_0xc29e('0xa9')]?0x1f4:_0xfa4bd2[_0xc29e('0xaa')]||0x1f4;logger[_0xc29e('0xab')](_0xfa4bd2[_0xc29e('0x28')]);delete _0xfa4bd2['name'];if(_0x1fe2d5===0x191){_0x1fe2d5=0x190;}_0x407de6[_0xc29e('0x1a')](_0x1fe2d5)['send'](_0x55a7d8[_0xc29e('0x31')]['test']?{'message':_0xc29e('0xac'),'statusCode':_0xfa4bd2[_0xc29e('0xaa')]}:_0xfa4bd2);});};function createFieldObject(_0x29cf27,_0x5919f6,_0x15b802,_0x283f0b,_0x2f1f4c,_0x2c96e9){return new Promise(function(_0xa69667,_0x1ab32a){var _0x444053={'id':_0x283f0b,'name':_0x2f1f4c,'custom':_0x2c96e9};if(_0x15b802==='boolean'){_0x444053[_0xc29e('0x47')]=[{'name':_0xc29e('0xad'),'value':_0xc29e('0xae')},{'name':_0xc29e('0xaf'),'value':_0xc29e('0xb0')}];_0xa69667(_0x444053);}else{var _0x1089f1={'method':_0xc29e('0x9b'),'uri':_0x29cf27+_0xc29e('0xb1')+_0x283f0b,'auth':_0x5919f6,'json':!![]};return rp(_0x1089f1)[_0xc29e('0x27')](function(_0x3d313a){var _0x59b8b9=[];if(_0x3d313a[_0xc29e('0x9d')][_0xc29e('0x37')]>0x0){_0x3d313a['result']['forEach'](function(_0x2a960c){if(_0x2a960c['inactive']===_0xc29e('0xb0')){var _0x286678={'name':_0x2a960c[_0xc29e('0xa1')],'value':_0x2a960c[_0xc29e('0xb2')]};_0x59b8b9['push'](_0x286678);}});}_0x444053[_0xc29e('0x47')]=_0x59b8b9;if(_0x444053[_0xc29e('0x47')][_0xc29e('0x37')]>0x0){_0xa69667(_0x444053);}else{if(_0x2c96e9==![]){_0xa69667();}else{_0xa69667(_0x444053);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 8e97714..ae61d92 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 _0x7da7=['../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7da7,0x10d));var _0x77da=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0x7da7[_0x53f0db];return _0xae0a5c;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x77da('0x7'));module[_0x77da('0x8')]=function(_0x47da81,_0x30afe0){return _0x47da81['define'](_0x77da('0x9'),attributes,{'tableName':_0x77da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xf494,0x1c6));var _0x4f49=function(_0x18eff3,_0x1a3c5e){_0x18eff3=_0x18eff3-0x0;var _0x3a1a82=_0xf494[_0x18eff3];return _0x3a1a82;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));var integrations=require(_0x4f49('0xa'));module[_0x4f49('0xb')]=function(_0x413530,_0x42b0e8){return _0x413530['define']('ServicenowAccount',attributes,{'tableName':_0x4f49('0xc'),'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 8d4c120..ab1de71 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 _0x9748=['../../config/environment','jayson/promise','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowServicenowAccount','find','lodash','util','moment','randomstring','../../config/logger','rpc'];(function(_0x12d09e,_0x16be4f){var _0x564f69=function(_0x351276){while(--_0x351276){_0x12d09e['push'](_0x12d09e['shift']());}};_0x564f69(++_0x16be4f);}(_0x9748,0xe8));var _0x8974=function(_0x5883e3,_0x147e1a){_0x5883e3=_0x5883e3-0x0;var _0xcc0f20=_0x9748[_0x5883e3];return _0xcc0f20;};'use strict';var _=require(_0x8974('0x0'));var util=require(_0x8974('0x1'));var moment=require(_0x8974('0x2'));var BPromise=require('bluebird');var rs=require(_0x8974('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8974('0x4'))(_0x8974('0x5'));var config=require(_0x8974('0x6'));var jayson=require(_0x8974('0x7'));var client=jayson['client'][_0x8974('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f28d0,_0x400169,_0x5b5c05){return new BPromise(function(_0x34ff12,_0x250175){return client[_0x8974('0x9')](_0x2f28d0,_0x5b5c05)['then'](function(_0x3bdae5){logger[_0x8974('0xa')](_0x8974('0xb'),_0x400169,_0x8974('0xc'));logger[_0x8974('0xd')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x400169,_0x8974('0xc'),JSON[_0x8974('0xe')](_0x3bdae5));if(_0x3bdae5[_0x8974('0xf')]){if(_0x3bdae5[_0x8974('0xf')][_0x8974('0x10')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x400169,_0x3bdae5['error']['message']);return _0x250175(_0x3bdae5[_0x8974('0xf')][_0x8974('0x11')]);}logger[_0x8974('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x400169,_0x3bdae5[_0x8974('0xf')][_0x8974('0x11')]);return _0x34ff12(_0x3bdae5[_0x8974('0xf')][_0x8974('0x11')]);}else{logger[_0x8974('0xa')](_0x8974('0xb'),_0x400169,_0x8974('0xc'));_0x34ff12(_0x3bdae5[_0x8974('0x12')][_0x8974('0x11')]);}})[_0x8974('0x13')](function(_0x58db40){logger[_0x8974('0xf')](_0x8974('0xb'),_0x400169,_0x58db40);_0x250175(_0x58db40);});});}exports[_0x8974('0x14')]=function(_0x4ff4ee){var _0x295d2c=this;return new Promise(function(_0x4740d4,_0x55581d){return db[_0x8974('0x15')][_0x8974('0x16')]({'raw':_0x4ff4ee[_0x8974('0x17')]?_0x4ff4ee['options'][_0x8974('0x18')]===undefined?!![]:![]:!![],'where':_0x4ff4ee[_0x8974('0x17')]?_0x4ff4ee[_0x8974('0x17')][_0x8974('0x19')]||null:null,'attributes':_0x4ff4ee['options']?_0x4ff4ee[_0x8974('0x17')][_0x8974('0x1a')]||null:null,'limit':_0x4ff4ee[_0x8974('0x17')]?_0x4ff4ee[_0x8974('0x17')][_0x8974('0x1b')]||null:null,'include':_0x4ff4ee['options']?_0x4ff4ee[_0x8974('0x17')][_0x8974('0x1c')]?_[_0x8974('0x1d')](_0x4ff4ee['options']['include'],function(_0x184a6d){return{'model':db[_0x184a6d[_0x8974('0x1e')]],'as':_0x184a6d['as'],'attributes':_0x184a6d['attributes'],'include':_0x184a6d[_0x8974('0x1c')]?_['map'](_0x184a6d[_0x8974('0x1c')],function(_0x2f39a7){return{'model':db[_0x2f39a7[_0x8974('0x1e')]],'as':_0x2f39a7['as'],'attributes':_0x2f39a7[_0x8974('0x1a')],'include':_0x2f39a7['include']?_[_0x8974('0x1d')](_0x2f39a7[_0x8974('0x1c')],function(_0x41346b){return{'model':db[_0x41346b[_0x8974('0x1e')]],'as':_0x41346b['as'],'attributes':_0x41346b[_0x8974('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8974('0x1f')](function(_0x513cc8){logger['info'](_0x8974('0x14'),_0x4ff4ee);logger[_0x8974('0xd')]('GetServicenowAccount',_0x4ff4ee,JSON[_0x8974('0xe')](_0x513cc8));_0x4740d4(_0x513cc8);})[_0x8974('0x13')](function(_0x372deb){logger['error']('GetServicenowAccount',_0x372deb[_0x8974('0x11')],_0x4ff4ee);_0x55581d(_0x295d2c[_0x8974('0xf')](0x1f4,_0x372deb[_0x8974('0x11')]));});});};exports[_0x8974('0x20')]=function(_0x4491b5){var _0x1d2c91=this;return new Promise(function(_0x5310b0,_0x29c08c){return db[_0x8974('0x15')][_0x8974('0x21')]({'raw':_0x4491b5[_0x8974('0x17')]?_0x4491b5[_0x8974('0x17')][_0x8974('0x18')]===undefined?!![]:![]:!![],'where':_0x4491b5[_0x8974('0x17')]?_0x4491b5['options'][_0x8974('0x19')]||null:null,'attributes':_0x4491b5[_0x8974('0x17')]?_0x4491b5['options'][_0x8974('0x1a')]||null:null,'include':_0x4491b5[_0x8974('0x17')]?_0x4491b5[_0x8974('0x17')]['include']?_['map'](_0x4491b5[_0x8974('0x17')][_0x8974('0x1c')],function(_0x2efa02){return{'model':db[_0x2efa02['model']],'as':_0x2efa02['as'],'attributes':_0x2efa02['attributes'],'include':_0x2efa02[_0x8974('0x1c')]?_[_0x8974('0x1d')](_0x2efa02[_0x8974('0x1c')],function(_0x26238d){return{'model':db[_0x26238d[_0x8974('0x1e')]],'as':_0x26238d['as'],'attributes':_0x26238d[_0x8974('0x1a')],'include':_0x26238d[_0x8974('0x1c')]?_[_0x8974('0x1d')](_0x26238d[_0x8974('0x1c')],function(_0x46caa5){return{'model':db[_0x46caa5[_0x8974('0x1e')]],'as':_0x46caa5['as'],'attributes':_0x46caa5[_0x8974('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39e0c4){logger[_0x8974('0xa')](_0x8974('0x20'),_0x4491b5);logger[_0x8974('0xd')](_0x8974('0x20'),_0x4491b5,JSON[_0x8974('0xe')](_0x39e0c4));_0x5310b0(_0x39e0c4);})[_0x8974('0x13')](function(_0x123f87){logger['error'](_0x8974('0x20'),_0x123f87[_0x8974('0x11')],_0x4491b5);_0x29c08c(_0x1d2c91[_0x8974('0xf')](0x1f4,_0x123f87[_0x8974('0x11')]));});});}; \ No newline at end of file +var _0xb0c4=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','result','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','include','map','model','ShowServicenowAccount','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xb0c4,0x87));var _0x4b0c=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0xb0c4[_0x4d9bb2];return _0x3179fe;};'use strict';var _=require(_0x4b0c('0x0'));var util=require(_0x4b0c('0x1'));var moment=require('moment');var BPromise=require(_0x4b0c('0x2'));var rs=require(_0x4b0c('0x3'));var fs=require('fs');var Redis=require(_0x4b0c('0x4'));var db=require(_0x4b0c('0x5'))['db'];var utils=require(_0x4b0c('0x6'));var logger=require(_0x4b0c('0x7'))(_0x4b0c('0x8'));var config=require(_0x4b0c('0x9'));var jayson=require(_0x4b0c('0xa'));var client=jayson[_0x4b0c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45496d,_0x47abcf,_0x126dc0){return new BPromise(function(_0x127a25,_0x5d4e78){return client[_0x4b0c('0xc')](_0x45496d,_0x126dc0)[_0x4b0c('0xd')](function(_0x6987c3){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x47abcf,_0x4b0c('0xe'));logger[_0x4b0c('0xf')](_0x4b0c('0x10'),_0x47abcf,'request\x20sent',JSON[_0x4b0c('0x11')](_0x6987c3));if(_0x6987c3[_0x4b0c('0x12')]){if(_0x6987c3[_0x4b0c('0x12')][_0x4b0c('0x13')]===0x1f4){logger['error'](_0x4b0c('0x14'),_0x47abcf,_0x6987c3[_0x4b0c('0x12')]['message']);return _0x5d4e78(_0x6987c3[_0x4b0c('0x12')][_0x4b0c('0x15')]);}logger[_0x4b0c('0x12')](_0x4b0c('0x14'),_0x47abcf,_0x6987c3[_0x4b0c('0x12')][_0x4b0c('0x15')]);return _0x127a25(_0x6987c3['error'][_0x4b0c('0x15')]);}else{logger[_0x4b0c('0x16')]('ServicenowAccount,\x20%s,\x20%s',_0x47abcf,'request\x20sent');_0x127a25(_0x6987c3[_0x4b0c('0x17')][_0x4b0c('0x15')]);}})['catch'](function(_0x1513c0){logger[_0x4b0c('0x12')](_0x4b0c('0x14'),_0x47abcf,_0x1513c0);_0x5d4e78(_0x1513c0);});});}exports[_0x4b0c('0x18')]=function(_0x16bc1d){var _0xece07e=this;return new Promise(function(_0x5145f9,_0x59f40f){return db[_0x4b0c('0x19')][_0x4b0c('0x1a')]({'raw':_0x16bc1d['options']?_0x16bc1d[_0x4b0c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x16bc1d[_0x4b0c('0x1b')]?_0x16bc1d[_0x4b0c('0x1b')][_0x4b0c('0x1c')]||null:null,'attributes':_0x16bc1d[_0x4b0c('0x1b')]?_0x16bc1d[_0x4b0c('0x1b')][_0x4b0c('0x1d')]||null:null,'limit':_0x16bc1d[_0x4b0c('0x1b')]?_0x16bc1d[_0x4b0c('0x1b')]['limit']||null:null,'include':_0x16bc1d[_0x4b0c('0x1b')]?_0x16bc1d['options'][_0x4b0c('0x1e')]?_[_0x4b0c('0x1f')](_0x16bc1d[_0x4b0c('0x1b')]['include'],function(_0x59189f){return{'model':db[_0x59189f[_0x4b0c('0x20')]],'as':_0x59189f['as'],'attributes':_0x59189f[_0x4b0c('0x1d')],'include':_0x59189f[_0x4b0c('0x1e')]?_['map'](_0x59189f['include'],function(_0x5d27ad){return{'model':db[_0x5d27ad[_0x4b0c('0x20')]],'as':_0x5d27ad['as'],'attributes':_0x5d27ad[_0x4b0c('0x1d')],'include':_0x5d27ad[_0x4b0c('0x1e')]?_[_0x4b0c('0x1f')](_0x5d27ad[_0x4b0c('0x1e')],function(_0x286fa3){return{'model':db[_0x286fa3[_0x4b0c('0x20')]],'as':_0x286fa3['as'],'attributes':_0x286fa3[_0x4b0c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4b0c('0xd')](function(_0x4a5218){logger['info'](_0x4b0c('0x18'),_0x16bc1d);logger[_0x4b0c('0xf')](_0x4b0c('0x18'),_0x16bc1d,JSON[_0x4b0c('0x11')](_0x4a5218));_0x5145f9(_0x4a5218);})['catch'](function(_0x22d2fb){logger[_0x4b0c('0x12')](_0x4b0c('0x18'),_0x22d2fb[_0x4b0c('0x15')],_0x16bc1d);_0x59f40f(_0xece07e[_0x4b0c('0x12')](0x1f4,_0x22d2fb[_0x4b0c('0x15')]));});});};exports[_0x4b0c('0x21')]=function(_0x4ad38e){var _0x232ccd=this;return new Promise(function(_0x28f292,_0x215eb2){return db['ServicenowAccount'][_0x4b0c('0x22')]({'raw':_0x4ad38e[_0x4b0c('0x1b')]?_0x4ad38e[_0x4b0c('0x1b')][_0x4b0c('0x23')]===undefined?!![]:![]:!![],'where':_0x4ad38e['options']?_0x4ad38e[_0x4b0c('0x1b')][_0x4b0c('0x1c')]||null:null,'attributes':_0x4ad38e[_0x4b0c('0x1b')]?_0x4ad38e[_0x4b0c('0x1b')]['attributes']||null:null,'include':_0x4ad38e['options']?_0x4ad38e['options'][_0x4b0c('0x1e')]?_[_0x4b0c('0x1f')](_0x4ad38e[_0x4b0c('0x1b')][_0x4b0c('0x1e')],function(_0x59575d){return{'model':db[_0x59575d[_0x4b0c('0x20')]],'as':_0x59575d['as'],'attributes':_0x59575d['attributes'],'include':_0x59575d[_0x4b0c('0x1e')]?_['map'](_0x59575d['include'],function(_0x1d2d3a){return{'model':db[_0x1d2d3a['model']],'as':_0x1d2d3a['as'],'attributes':_0x1d2d3a[_0x4b0c('0x1d')],'include':_0x1d2d3a[_0x4b0c('0x1e')]?_['map'](_0x1d2d3a['include'],function(_0xabed2e){return{'model':db[_0xabed2e['model']],'as':_0xabed2e['as'],'attributes':_0xabed2e[_0x4b0c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f9723){logger[_0x4b0c('0x16')](_0x4b0c('0x21'),_0x4ad38e);logger[_0x4b0c('0xf')](_0x4b0c('0x21'),_0x4ad38e,JSON[_0x4b0c('0x11')](_0x1f9723));_0x28f292(_0x1f9723);})['catch'](function(_0x2b08fc){logger['error'](_0x4b0c('0x21'),_0x2b08fc['message'],_0x4ad38e);_0x215eb2(_0x232ccd[_0x4b0c('0x12')](0x1f4,_0x2b08fc['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 56759cb..922b259 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 _0x30a4=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intServicenowConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x30a4,0xd2));var _0x430a=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x30a4[_0x178856];return _0x3c7fe7;};'use strict';var multer=require(_0x430a('0x0'));var util=require(_0x430a('0x1'));var path=require(_0x430a('0x2'));var timeout=require(_0x430a('0x3'));var express=require(_0x430a('0x4'));var router=express[_0x430a('0x5')]();var fs_extra=require(_0x430a('0x6'));var auth=require(_0x430a('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x430a('0x8'));router[_0x430a('0x9')]('/',auth['isAuthenticated'](),controller[_0x430a('0xa')]);router[_0x430a('0x9')]('/:id',auth[_0x430a('0xb')](),controller[_0x430a('0xc')]);router[_0x430a('0x9')](_0x430a('0xd'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x430a('0xe'),auth[_0x430a('0xb')](),controller[_0x430a('0xf')]);router[_0x430a('0x9')](_0x430a('0x10'),auth[_0x430a('0xb')](),controller[_0x430a('0x11')]);router[_0x430a('0x12')]('/',auth[_0x430a('0xb')](),controller['create']);router[_0x430a('0x13')]('/:id',auth[_0x430a('0xb')](),controller['update']);router[_0x430a('0x14')]('/:id',auth[_0x430a('0xb')](),controller[_0x430a('0x15')]);module[_0x430a('0x16')]=router; \ No newline at end of file +var _0x2dda=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','post','create','put','delete'];(function(_0xdf3909,_0x4048da){var _0x527d04=function(_0x33ff13){while(--_0x33ff13){_0xdf3909['push'](_0xdf3909['shift']());}};_0x527d04(++_0x4048da);}(_0x2dda,0x191));var _0xa2dd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2dda[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xa2dd('0x0'));var path=require(_0xa2dd('0x1'));var timeout=require(_0xa2dd('0x2'));var express=require(_0xa2dd('0x3'));var router=express[_0xa2dd('0x4')]();var fs_extra=require(_0xa2dd('0x5'));var auth=require(_0xa2dd('0x6'));var interaction=require(_0xa2dd('0x7'));var config=require('../../config/environment');var controller=require(_0xa2dd('0x8'));router['get']('/',auth[_0xa2dd('0x9')](),controller[_0xa2dd('0xa')]);router[_0xa2dd('0xb')](_0xa2dd('0xc'),auth[_0xa2dd('0x9')](),controller[_0xa2dd('0xd')]);router[_0xa2dd('0xb')]('/:id/fields',auth[_0xa2dd('0x9')](),controller['getFields']);router[_0xa2dd('0xb')](_0xa2dd('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xa2dd('0xb')]('/:id/descriptions',auth[_0xa2dd('0x9')](),controller['getDescriptions']);router[_0xa2dd('0xf')]('/',auth['isAuthenticated'](),controller[_0xa2dd('0x10')]);router[_0xa2dd('0x11')](_0xa2dd('0xc'),auth[_0xa2dd('0x9')](),controller['update']);router[_0xa2dd('0x12')](_0xa2dd('0xc'),auth[_0xa2dd('0x9')](),controller['destroy']);module[_0xa2dd('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index b566e94..7dc76f6 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 _0xd1ad=['sequelize','STRING'];(function(_0x5697c,_0x73501d){var _0x4eb5d5=function(_0x10abb8){while(--_0x10abb8){_0x5697c['push'](_0x5697c['shift']());}};_0x4eb5d5(++_0x73501d);}(_0xd1ad,0x166));var _0xdd1a=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0xd1ad[_0x5447aa];return _0xb21e53;};'use strict';var Sequelize=require(_0xdd1a('0x0'));module['exports']={'name':{'type':Sequelize[_0xdd1a('0x1')]},'description':{'type':Sequelize[_0xdd1a('0x1')]}}; \ No newline at end of file +var _0x8736=['STRING','sequelize'];(function(_0x5691c2,_0x1a47e9){var _0xd8cb72=function(_0x27f0da){while(--_0x27f0da){_0x5691c2['push'](_0x5691c2['shift']());}};_0xd8cb72(++_0x1a47e9);}(_0x8736,0x14f));var _0x6873=function(_0x827d01,_0x5345a8){_0x827d01=_0x827d01-0x0;var _0x541521=_0x8736[_0x827d01];return _0x541521;};'use strict';var Sequelize=require(_0x6873('0x0'));module['exports']={'name':{'type':Sequelize[_0x6873('0x1')]},'description':{'type':Sequelize[_0x6873('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index ba88fcf..5a11885 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 _0xe610=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','params','include','create','body','find','destroy','getFields','findOne','rawAttributes','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','ServicenowConfiguration','type','query','keys','filters','model','attributes'];(function(_0x55433c,_0x16130d){var _0x1957ad=function(_0x271e0b){while(--_0x271e0b){_0x55433c['push'](_0x55433c['shift']());}};_0x1957ad(++_0x16130d);}(_0xe610,0x153));var _0x0e61=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe610[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x0e61('0x0'));var rimraf=require(_0x0e61('0x1'));var zipdir=require(_0x0e61('0x2'));var jsonpatch=require(_0x0e61('0x3'));var rp=require('request-promise');var moment=require(_0x0e61('0x4'));var BPromise=require(_0x0e61('0x5'));var Mustache=require(_0x0e61('0x6'));var util=require(_0x0e61('0x7'));var path=require(_0x0e61('0x8'));var sox=require(_0x0e61('0x9'));var csv=require('to-csv');var ejs=require(_0x0e61('0xa'));var fs=require('fs');var fs_extra=require(_0x0e61('0xb'));var _=require(_0x0e61('0xc'));var squel=require(_0x0e61('0xd'));var crypto=require('crypto');var jsforce=require(_0x0e61('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e61('0xf'));var querystring=require(_0x0e61('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0e61('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0e61('0x12'));var hardwareService=require(_0x0e61('0x13'));var logger=require(_0x0e61('0x14'))(_0x0e61('0x15'));var utils=require('../../config/utils');var config=require(_0x0e61('0x16'));var licenseUtil=require(_0x0e61('0x17'));var db=require(_0x0e61('0x18'))['db'];function respondWithStatusCode(_0x3dd1a8,_0x47e5a5){_0x47e5a5=_0x47e5a5||0xcc;return function(_0x580ef5){if(_0x580ef5){return _0x3dd1a8[_0x0e61('0x19')](_0x47e5a5);}return _0x3dd1a8[_0x0e61('0x1a')](_0x47e5a5)['end']();};}function respondWithResult(_0x17ea0b,_0x40d682){_0x40d682=_0x40d682||0xc8;return function(_0x40d27d){if(_0x40d27d){return _0x17ea0b['status'](_0x40d682)[_0x0e61('0x1b')](_0x40d27d);}};}function respondWithFilteredResult(_0x1a3cb8,_0x396433){return function(_0x2006c2){if(_0x2006c2){var _0x541e7f=typeof _0x396433[_0x0e61('0x1c')]===_0x0e61('0x1d')&&typeof _0x396433[_0x0e61('0x1e')]==='undefined';var _0x100756=_0x2006c2[_0x0e61('0x1f')];var _0x33cc52=_0x541e7f?0x0:_0x396433[_0x0e61('0x1c')];var _0x2e24ac=_0x541e7f?_0x2006c2[_0x0e61('0x1f')]:_0x396433[_0x0e61('0x1c')]+_0x396433[_0x0e61('0x1e')];var _0x23122f;if(_0x2e24ac>=_0x100756){_0x2e24ac=_0x100756;_0x23122f=0xc8;}else{_0x23122f=0xce;}_0x1a3cb8[_0x0e61('0x1a')](_0x23122f);return _0x1a3cb8[_0x0e61('0x20')](_0x0e61('0x21'),_0x33cc52+'-'+_0x2e24ac+'/'+_0x100756)[_0x0e61('0x1b')](_0x2006c2);}return null;};}function patchUpdates(_0x40949e){return function(_0x474906){try{jsonpatch[_0x0e61('0x22')](_0x474906,_0x40949e,!![]);}catch(_0x169db8){return BPromise[_0x0e61('0x23')](_0x169db8);}return _0x474906['save']();};}function saveUpdates(_0x4498e2,_0x307675){return function(_0x3651b0){if(_0x3651b0){return _0x3651b0[_0x0e61('0x24')](_0x4498e2)[_0x0e61('0x25')](function(_0x471996){return _0x471996;});}return null;};}function removeEntity(_0x352bc4,_0x426620){return function(_0x4a695f){if(_0x4a695f){return _0x4a695f['destroy']()[_0x0e61('0x25')](function(){_0x352bc4[_0x0e61('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x306ba5,_0x34d905){return function(_0x71d38a){if(!_0x71d38a){_0x306ba5[_0x0e61('0x19')](0x194);}return _0x71d38a;};}function handleError(_0x49d7f2,_0xfd849e){_0xfd849e=_0xfd849e||0x1f4;return function(_0x40f689){logger[_0x0e61('0x26')](_0x40f689[_0x0e61('0x27')]);if(_0x40f689[_0x0e61('0x28')]){delete _0x40f689[_0x0e61('0x28')];}_0x49d7f2[_0x0e61('0x1a')](_0xfd849e)[_0x0e61('0x29')](_0x40f689);};}exports[_0x0e61('0x2a')]=function(_0x4e915c,_0x154fca){var _0x5a57a0={},_0x26f11a={},_0x369b6a={'count':0x0,'rows':[]};var _0x423d61=_[_0x0e61('0x2b')](db[_0x0e61('0x2c')]['rawAttributes'],function(_0x547017){return{'name':_0x547017['fieldName'],'type':_0x547017[_0x0e61('0x2d')]['key']};});_0x26f11a['model']=_['map'](_0x423d61,'name');_0x26f11a[_0x0e61('0x2e')]=_[_0x0e61('0x2f')](_0x4e915c[_0x0e61('0x2e')]);_0x26f11a[_0x0e61('0x30')]=_['intersection'](_0x26f11a[_0x0e61('0x31')],_0x26f11a['query']);_0x5a57a0[_0x0e61('0x32')]=_[_0x0e61('0x33')](_0x26f11a[_0x0e61('0x31')],qs['fields'](_0x4e915c['query'][_0x0e61('0x34')]));_0x5a57a0[_0x0e61('0x32')]=_0x5a57a0['attributes'][_0x0e61('0x35')]?_0x5a57a0[_0x0e61('0x32')]:_0x26f11a[_0x0e61('0x31')];if(!_0x4e915c['query'][_0x0e61('0x36')](_0x0e61('0x37'))){_0x5a57a0['limit']=qs['limit'](_0x4e915c[_0x0e61('0x2e')][_0x0e61('0x1e')]);_0x5a57a0[_0x0e61('0x1c')]=qs[_0x0e61('0x1c')](_0x4e915c[_0x0e61('0x2e')][_0x0e61('0x1c')]);}_0x5a57a0[_0x0e61('0x38')]=qs['sort'](_0x4e915c[_0x0e61('0x2e')][_0x0e61('0x39')]);_0x5a57a0['where']=qs['filters'](_[_0x0e61('0x3a')](_0x4e915c[_0x0e61('0x2e')],_0x26f11a['filters']),_0x423d61);if(_0x4e915c[_0x0e61('0x2e')][_0x0e61('0x3b')]){_0x5a57a0[_0x0e61('0x3c')]=_['merge'](_0x5a57a0['where'],{'$or':_[_0x0e61('0x2b')](_0x423d61,function(_0x34c0e8){if(_0x34c0e8[_0x0e61('0x2d')]!==_0x0e61('0x3d')){var _0x8673f8={};_0x8673f8[_0x34c0e8[_0x0e61('0x28')]]={'$like':'%'+_0x4e915c[_0x0e61('0x2e')][_0x0e61('0x3b')]+'%'};return _0x8673f8;}})});}_0x5a57a0=_[_0x0e61('0x3e')]({},_0x5a57a0,_0x4e915c[_0x0e61('0x3f')]);var _0x18f29d={'where':_0x5a57a0['where']};return db['ServicenowConfiguration'][_0x0e61('0x1f')](_0x18f29d)[_0x0e61('0x25')](function(_0x51e7d6){_0x369b6a[_0x0e61('0x1f')]=_0x51e7d6;if(_0x4e915c[_0x0e61('0x2e')][_0x0e61('0x40')]){_0x5a57a0['include']=[{'all':!![]}];}return db[_0x0e61('0x2c')]['findAll'](_0x5a57a0);})[_0x0e61('0x25')](function(_0x40b1f1){_0x369b6a[_0x0e61('0x41')]=_0x40b1f1;return _0x369b6a;})['then'](respondWithFilteredResult(_0x154fca,_0x5a57a0))[_0x0e61('0x42')](handleError(_0x154fca,null));};exports['show']=function(_0x55e6a5,_0x409843){var _0x5752e5={'raw':![],'where':{'id':_0x55e6a5[_0x0e61('0x43')]['id']}},_0x93ac33={};_0x93ac33[_0x0e61('0x31')]=_[_0x0e61('0x2f')](db[_0x0e61('0x2c')]['rawAttributes']);_0x93ac33[_0x0e61('0x2e')]=_['keys'](_0x55e6a5['query']);_0x93ac33[_0x0e61('0x30')]=_['intersection'](_0x93ac33[_0x0e61('0x31')],_0x93ac33['query']);_0x5752e5['attributes']=_['intersection'](_0x93ac33[_0x0e61('0x31')],qs[_0x0e61('0x34')](_0x55e6a5[_0x0e61('0x2e')][_0x0e61('0x34')]));_0x5752e5[_0x0e61('0x32')]=_0x5752e5[_0x0e61('0x32')]['length']?_0x5752e5[_0x0e61('0x32')]:_0x93ac33[_0x0e61('0x31')];if(_0x55e6a5[_0x0e61('0x2e')]['includeAll']){_0x5752e5[_0x0e61('0x44')]=[{'all':!![]}];}_0x5752e5=_['merge']({},_0x5752e5,_0x55e6a5[_0x0e61('0x3f')]);return db[_0x0e61('0x2c')]['find'](_0x5752e5)['then'](handleEntityNotFound(_0x409843,null))[_0x0e61('0x25')](respondWithResult(_0x409843,null))['catch'](handleError(_0x409843,null));};exports[_0x0e61('0x45')]=function(_0x5648c7,_0x26a14d){return db[_0x0e61('0x2c')]['create'](_0x5648c7[_0x0e61('0x46')],{})[_0x0e61('0x25')](respondWithResult(_0x26a14d,0xc9))['catch'](handleError(_0x26a14d,null));};exports[_0x0e61('0x24')]=function(_0x1383c7,_0x38ba51){if(_0x1383c7[_0x0e61('0x46')]['id']){delete _0x1383c7[_0x0e61('0x46')]['id'];}return db[_0x0e61('0x2c')][_0x0e61('0x47')]({'where':{'id':_0x1383c7[_0x0e61('0x43')]['id']}})[_0x0e61('0x25')](handleEntityNotFound(_0x38ba51,null))[_0x0e61('0x25')](saveUpdates(_0x1383c7[_0x0e61('0x46')],null))[_0x0e61('0x25')](respondWithResult(_0x38ba51,null))['catch'](handleError(_0x38ba51,null));};exports[_0x0e61('0x48')]=function(_0x2db351,_0xdaa3e0){return db[_0x0e61('0x2c')]['find']({'where':{'id':_0x2db351[_0x0e61('0x43')]['id']}})[_0x0e61('0x25')](handleEntityNotFound(_0xdaa3e0,null))[_0x0e61('0x25')](removeEntity(_0xdaa3e0,null))[_0x0e61('0x42')](handleError(_0xdaa3e0,null));};exports[_0x0e61('0x49')]=function(_0x3200f5,_0x4dfc7b,_0xb9bff){var _0x28f62d={};var _0x3e79c9={};var _0x170694;var _0x430df4;return db[_0x0e61('0x2c')][_0x0e61('0x4a')]({'where':{'id':_0x3200f5[_0x0e61('0x43')]['id']}})['then'](handleEntityNotFound(_0x4dfc7b,null))[_0x0e61('0x25')](function(_0x692afc){if(_0x692afc){_0x170694=_0x692afc;_0x3e79c9[_0x0e61('0x31')]=_[_0x0e61('0x2f')](db['ServicenowField'][_0x0e61('0x4b')]);_0x3e79c9[_0x0e61('0x2e')]=_[_0x0e61('0x2f')](_0x3200f5[_0x0e61('0x2e')]);_0x3e79c9[_0x0e61('0x30')]=_['intersection'](_0x3e79c9[_0x0e61('0x31')],_0x3e79c9[_0x0e61('0x2e')]);_0x28f62d[_0x0e61('0x32')]=_['intersection'](_0x3e79c9[_0x0e61('0x31')],qs[_0x0e61('0x34')](_0x3200f5[_0x0e61('0x2e')]['fields']));_0x28f62d[_0x0e61('0x32')]=_0x28f62d[_0x0e61('0x32')][_0x0e61('0x35')]?_0x28f62d['attributes']:_0x3e79c9[_0x0e61('0x31')];_0x28f62d[_0x0e61('0x38')]=qs[_0x0e61('0x39')](_0x3200f5[_0x0e61('0x2e')][_0x0e61('0x39')]);_0x28f62d['where']=qs[_0x0e61('0x30')](_['pick'](_0x3200f5[_0x0e61('0x2e')],_0x3e79c9[_0x0e61('0x30')]));if(_0x3200f5[_0x0e61('0x2e')][_0x0e61('0x3b')]){_0x28f62d['where']=_[_0x0e61('0x3e')](_0x28f62d['where'],{'$or':_[_0x0e61('0x2b')](_0x28f62d['attributes'],function(_0x1c650c){var _0x3b91ca={};_0x3b91ca[_0x1c650c]={'$like':'%'+_0x3200f5[_0x0e61('0x2e')]['filter']+'%'};return _0x3b91ca;})});}_0x28f62d=_[_0x0e61('0x3e')]({},_0x28f62d,_0x3200f5[_0x0e61('0x3f')]);return _0x170694[_0x0e61('0x49')](_0x28f62d);}})[_0x0e61('0x25')](function(_0xffd30){if(_0xffd30){_0x430df4=_0xffd30[_0x0e61('0x35')];if(!_0x3200f5[_0x0e61('0x2e')][_0x0e61('0x36')](_0x0e61('0x37'))){_0x28f62d[_0x0e61('0x1e')]=qs[_0x0e61('0x1e')](_0x3200f5[_0x0e61('0x2e')]['limit']);_0x28f62d[_0x0e61('0x1c')]=qs[_0x0e61('0x1c')](_0x3200f5['query'][_0x0e61('0x1c')]);}return _0x170694[_0x0e61('0x49')](_0x28f62d);}})['then'](function(_0x52099d){if(_0x52099d){return _0x52099d?{'count':_0x430df4,'rows':_0x52099d}:null;}})[_0x0e61('0x25')](respondWithResult(_0x4dfc7b,null))[_0x0e61('0x42')](handleError(_0x4dfc7b,null));};exports[_0x0e61('0x4c')]=function(_0x758500,_0x5d18e8,_0x2ded3a){var _0x5dbfc6={};var _0x26c3b4={};var _0x565c99;var _0x523875;return db['ServicenowConfiguration'][_0x0e61('0x4a')]({'where':{'id':_0x758500[_0x0e61('0x43')]['id']}})[_0x0e61('0x25')](handleEntityNotFound(_0x5d18e8,null))[_0x0e61('0x25')](function(_0x5356e4){if(_0x5356e4){_0x565c99=_0x5356e4;_0x26c3b4[_0x0e61('0x31')]=_[_0x0e61('0x2f')](db['ServicenowField'][_0x0e61('0x4b')]);_0x26c3b4['query']=_[_0x0e61('0x2f')](_0x758500['query']);_0x26c3b4['filters']=_['intersection'](_0x26c3b4['model'],_0x26c3b4[_0x0e61('0x2e')]);_0x5dbfc6[_0x0e61('0x32')]=_[_0x0e61('0x33')](_0x26c3b4[_0x0e61('0x31')],qs[_0x0e61('0x34')](_0x758500[_0x0e61('0x2e')][_0x0e61('0x34')]));_0x5dbfc6[_0x0e61('0x32')]=_0x5dbfc6[_0x0e61('0x32')]['length']?_0x5dbfc6[_0x0e61('0x32')]:_0x26c3b4[_0x0e61('0x31')];_0x5dbfc6[_0x0e61('0x38')]=qs['sort'](_0x758500['query'][_0x0e61('0x39')]);_0x5dbfc6['where']=qs[_0x0e61('0x30')](_[_0x0e61('0x3a')](_0x758500[_0x0e61('0x2e')],_0x26c3b4['filters']));if(_0x758500[_0x0e61('0x2e')][_0x0e61('0x3b')]){_0x5dbfc6['where']=_[_0x0e61('0x3e')](_0x5dbfc6[_0x0e61('0x3c')],{'$or':_[_0x0e61('0x2b')](_0x5dbfc6[_0x0e61('0x32')],function(_0x94f792){var _0x39fb05={};_0x39fb05[_0x94f792]={'$like':'%'+_0x758500[_0x0e61('0x2e')][_0x0e61('0x3b')]+'%'};return _0x39fb05;})});}_0x5dbfc6=_[_0x0e61('0x3e')]({},_0x5dbfc6,_0x758500[_0x0e61('0x3f')]);return _0x565c99[_0x0e61('0x4c')](_0x5dbfc6);}})[_0x0e61('0x25')](function(_0x31e13d){if(_0x31e13d){_0x523875=_0x31e13d[_0x0e61('0x35')];if(!_0x758500[_0x0e61('0x2e')][_0x0e61('0x36')](_0x0e61('0x37'))){_0x5dbfc6[_0x0e61('0x1e')]=qs[_0x0e61('0x1e')](_0x758500[_0x0e61('0x2e')][_0x0e61('0x1e')]);_0x5dbfc6[_0x0e61('0x1c')]=qs[_0x0e61('0x1c')](_0x758500[_0x0e61('0x2e')][_0x0e61('0x1c')]);}return _0x565c99[_0x0e61('0x4c')](_0x5dbfc6);}})['then'](function(_0x2976f6){if(_0x2976f6){return _0x2976f6?{'count':_0x523875,'rows':_0x2976f6}:null;}})[_0x0e61('0x25')](respondWithResult(_0x5d18e8,null))[_0x0e61('0x42')](handleError(_0x5d18e8,null));};exports[_0x0e61('0x4d')]=function(_0xcdc616,_0x161fb7,_0x43c3c4){var _0x14360a={};var _0xcd9409={};var _0x211fb5;var _0x2f2a97;return db[_0x0e61('0x2c')][_0x0e61('0x4a')]({'where':{'id':_0xcdc616['params']['id']}})[_0x0e61('0x25')](handleEntityNotFound(_0x161fb7,null))[_0x0e61('0x25')](function(_0x18d36e){if(_0x18d36e){_0x211fb5=_0x18d36e;_0xcd9409[_0x0e61('0x31')]=_['keys'](db['ServicenowField'][_0x0e61('0x4b')]);_0xcd9409[_0x0e61('0x2e')]=_['keys'](_0xcdc616[_0x0e61('0x2e')]);_0xcd9409[_0x0e61('0x30')]=_[_0x0e61('0x33')](_0xcd9409[_0x0e61('0x31')],_0xcd9409[_0x0e61('0x2e')]);_0x14360a['attributes']=_[_0x0e61('0x33')](_0xcd9409[_0x0e61('0x31')],qs[_0x0e61('0x34')](_0xcdc616[_0x0e61('0x2e')][_0x0e61('0x34')]));_0x14360a[_0x0e61('0x32')]=_0x14360a['attributes'][_0x0e61('0x35')]?_0x14360a[_0x0e61('0x32')]:_0xcd9409['model'];_0x14360a[_0x0e61('0x38')]=qs[_0x0e61('0x39')](_0xcdc616[_0x0e61('0x2e')]['sort']);_0x14360a[_0x0e61('0x3c')]=qs[_0x0e61('0x30')](_[_0x0e61('0x3a')](_0xcdc616[_0x0e61('0x2e')],_0xcd9409[_0x0e61('0x30')]));if(_0xcdc616['query'][_0x0e61('0x3b')]){_0x14360a[_0x0e61('0x3c')]=_['merge'](_0x14360a[_0x0e61('0x3c')],{'$or':_[_0x0e61('0x2b')](_0x14360a[_0x0e61('0x32')],function(_0x427b55){var _0x2a48ee={};_0x2a48ee[_0x427b55]={'$like':'%'+_0xcdc616['query'][_0x0e61('0x3b')]+'%'};return _0x2a48ee;})});}_0x14360a=_[_0x0e61('0x3e')]({},_0x14360a,_0xcdc616['options']);return _0x211fb5[_0x0e61('0x4d')](_0x14360a);}})[_0x0e61('0x25')](function(_0xba8724){if(_0xba8724){_0x2f2a97=_0xba8724[_0x0e61('0x35')];if(!_0xcdc616[_0x0e61('0x2e')]['hasOwnProperty'](_0x0e61('0x37'))){_0x14360a['limit']=qs[_0x0e61('0x1e')](_0xcdc616['query']['limit']);_0x14360a[_0x0e61('0x1c')]=qs[_0x0e61('0x1c')](_0xcdc616[_0x0e61('0x2e')][_0x0e61('0x1c')]);}return _0x211fb5[_0x0e61('0x4d')](_0x14360a);}})['then'](function(_0x351980){if(_0x351980){return _0x351980?{'count':_0x2f2a97,'rows':_0x351980}:null;}})[_0x0e61('0x25')](respondWithResult(_0x161fb7,null))[_0x0e61('0x42')](handleError(_0x161fb7,null));}; \ No newline at end of file +var _0x88c8=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','ServicenowConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','map','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','params','create','body','catch','find','getFields','findOne','pick','filter','getSubjects','getDescriptions','ServicenowField','eml-format','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x88c8,0x125));var _0x888c=function(_0x1d1e34,_0x542eab){_0x1d1e34=_0x1d1e34-0x0;var _0x434574=_0x88c8[_0x1d1e34];return _0x434574;};'use strict';var emlformat=require(_0x888c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x888c('0x1'));var jsonpatch=require(_0x888c('0x2'));var rp=require('request-promise');var moment=require(_0x888c('0x3'));var BPromise=require(_0x888c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x888c('0x5'));var csv=require(_0x888c('0x6'));var ejs=require(_0x888c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x888c('0x8'));var squel=require(_0x888c('0x9'));var crypto=require(_0x888c('0xa'));var jsforce=require(_0x888c('0xb'));var deskjs=require(_0x888c('0xc'));var toCsv=require(_0x888c('0x6'));var querystring=require('querystring');var Papa=require(_0x888c('0xd'));var Redis=require(_0x888c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x888c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x888c('0x10'))(_0x888c('0x11'));var utils=require(_0x888c('0x12'));var config=require(_0x888c('0x13'));var licenseUtil=require(_0x888c('0x14'));var db=require(_0x888c('0x15'))['db'];function respondWithStatusCode(_0x25a3a8,_0x4e1b93){_0x4e1b93=_0x4e1b93||0xcc;return function(_0x20dada){if(_0x20dada){return _0x25a3a8[_0x888c('0x16')](_0x4e1b93);}return _0x25a3a8[_0x888c('0x17')](_0x4e1b93)[_0x888c('0x18')]();};}function respondWithResult(_0x177555,_0x49cb08){_0x49cb08=_0x49cb08||0xc8;return function(_0x328d94){if(_0x328d94){return _0x177555[_0x888c('0x17')](_0x49cb08)[_0x888c('0x19')](_0x328d94);}};}function respondWithFilteredResult(_0x2959ea,_0x2c784f){return function(_0xebd3fa){if(_0xebd3fa){var _0x29e002=typeof _0x2c784f['offset']===_0x888c('0x1a')&&typeof _0x2c784f['limit']===_0x888c('0x1a');var _0x3212a6=_0xebd3fa['count'];var _0x27f572=_0x29e002?0x0:_0x2c784f['offset'];var _0x4dd479=_0x29e002?_0xebd3fa['count']:_0x2c784f[_0x888c('0x1b')]+_0x2c784f[_0x888c('0x1c')];var _0x3925ce;if(_0x4dd479>=_0x3212a6){_0x4dd479=_0x3212a6;_0x3925ce=0xc8;}else{_0x3925ce=0xce;}_0x2959ea[_0x888c('0x17')](_0x3925ce);return _0x2959ea[_0x888c('0x1d')](_0x888c('0x1e'),_0x27f572+'-'+_0x4dd479+'/'+_0x3212a6)[_0x888c('0x19')](_0xebd3fa);}return null;};}function patchUpdates(_0x2bb564){return function(_0x2a348d){try{jsonpatch[_0x888c('0x1f')](_0x2a348d,_0x2bb564,!![]);}catch(_0x2aca2c){return BPromise['reject'](_0x2aca2c);}return _0x2a348d[_0x888c('0x20')]();};}function saveUpdates(_0x2f93b9,_0x2fb9a8){return function(_0xb42bb2){if(_0xb42bb2){return _0xb42bb2['update'](_0x2f93b9)[_0x888c('0x21')](function(_0x1fc2a4){return _0x1fc2a4;});}return null;};}function removeEntity(_0x1229f5,_0x3da386){return function(_0x5e8ccf){if(_0x5e8ccf){return _0x5e8ccf[_0x888c('0x22')]()[_0x888c('0x21')](function(){_0x1229f5[_0x888c('0x17')](0xcc)[_0x888c('0x18')]();});}};}function handleEntityNotFound(_0xeb8252,_0x25c3db){return function(_0xba8218){if(!_0xba8218){_0xeb8252['sendStatus'](0x194);}return _0xba8218;};}function handleError(_0xbb32b6,_0x313c5d){_0x313c5d=_0x313c5d||0x1f4;return function(_0x1d9c1f){logger[_0x888c('0x23')](_0x1d9c1f[_0x888c('0x24')]);if(_0x1d9c1f[_0x888c('0x25')]){delete _0x1d9c1f[_0x888c('0x25')];}_0xbb32b6['status'](_0x313c5d)[_0x888c('0x26')](_0x1d9c1f);};}exports['index']=function(_0x5d21d5,_0x2488d5){var _0x303a70={},_0x3da2dd={},_0x45faac={'count':0x0,'rows':[]};var _0x17d1a9=_['map'](db[_0x888c('0x27')][_0x888c('0x28')],function(_0x10aa5a){return{'name':_0x10aa5a[_0x888c('0x29')],'type':_0x10aa5a[_0x888c('0x2a')]['key']};});_0x3da2dd[_0x888c('0x2b')]=_['map'](_0x17d1a9,_0x888c('0x25'));_0x3da2dd['query']=_[_0x888c('0x2c')](_0x5d21d5[_0x888c('0x2d')]);_0x3da2dd[_0x888c('0x2e')]=_[_0x888c('0x2f')](_0x3da2dd['model'],_0x3da2dd[_0x888c('0x2d')]);_0x303a70[_0x888c('0x30')]=_['intersection'](_0x3da2dd[_0x888c('0x2b')],qs[_0x888c('0x31')](_0x5d21d5[_0x888c('0x2d')][_0x888c('0x31')]));_0x303a70[_0x888c('0x30')]=_0x303a70[_0x888c('0x30')][_0x888c('0x32')]?_0x303a70['attributes']:_0x3da2dd[_0x888c('0x2b')];if(!_0x5d21d5[_0x888c('0x2d')][_0x888c('0x33')](_0x888c('0x34'))){_0x303a70[_0x888c('0x1c')]=qs[_0x888c('0x1c')](_0x5d21d5[_0x888c('0x2d')][_0x888c('0x1c')]);_0x303a70['offset']=qs[_0x888c('0x1b')](_0x5d21d5[_0x888c('0x2d')][_0x888c('0x1b')]);}_0x303a70[_0x888c('0x35')]=qs[_0x888c('0x36')](_0x5d21d5[_0x888c('0x2d')][_0x888c('0x36')]);_0x303a70[_0x888c('0x37')]=qs[_0x888c('0x2e')](_['pick'](_0x5d21d5['query'],_0x3da2dd[_0x888c('0x2e')]),_0x17d1a9);if(_0x5d21d5[_0x888c('0x2d')]['filter']){_0x303a70['where']=_['merge'](_0x303a70['where'],{'$or':_[_0x888c('0x38')](_0x17d1a9,function(_0x2d611e){if(_0x2d611e[_0x888c('0x2a')]!==_0x888c('0x39')){var _0x134dee={};_0x134dee[_0x2d611e['name']]={'$like':'%'+_0x5d21d5[_0x888c('0x2d')]['filter']+'%'};return _0x134dee;}})});}_0x303a70=_[_0x888c('0x3a')]({},_0x303a70,_0x5d21d5[_0x888c('0x3b')]);var _0x9b6307={'where':_0x303a70['where']};return db[_0x888c('0x27')][_0x888c('0x3c')](_0x9b6307)[_0x888c('0x21')](function(_0x1590eb){_0x45faac[_0x888c('0x3c')]=_0x1590eb;if(_0x5d21d5[_0x888c('0x2d')][_0x888c('0x3d')]){_0x303a70[_0x888c('0x3e')]=[{'all':!![]}];}return db[_0x888c('0x27')][_0x888c('0x3f')](_0x303a70);})[_0x888c('0x21')](function(_0x42acde){_0x45faac[_0x888c('0x40')]=_0x42acde;return _0x45faac;})[_0x888c('0x21')](respondWithFilteredResult(_0x2488d5,_0x303a70))['catch'](handleError(_0x2488d5,null));};exports['show']=function(_0x2fb3b6,_0x3c0049){var _0x3270be={'raw':![],'where':{'id':_0x2fb3b6[_0x888c('0x41')]['id']}},_0x284c82={};_0x284c82['model']=_[_0x888c('0x2c')](db[_0x888c('0x27')][_0x888c('0x28')]);_0x284c82['query']=_[_0x888c('0x2c')](_0x2fb3b6[_0x888c('0x2d')]);_0x284c82['filters']=_[_0x888c('0x2f')](_0x284c82[_0x888c('0x2b')],_0x284c82[_0x888c('0x2d')]);_0x3270be[_0x888c('0x30')]=_[_0x888c('0x2f')](_0x284c82[_0x888c('0x2b')],qs[_0x888c('0x31')](_0x2fb3b6[_0x888c('0x2d')]['fields']));_0x3270be[_0x888c('0x30')]=_0x3270be[_0x888c('0x30')][_0x888c('0x32')]?_0x3270be['attributes']:_0x284c82['model'];if(_0x2fb3b6[_0x888c('0x2d')][_0x888c('0x3d')]){_0x3270be[_0x888c('0x3e')]=[{'all':!![]}];}_0x3270be=_[_0x888c('0x3a')]({},_0x3270be,_0x2fb3b6['options']);return db[_0x888c('0x27')]['find'](_0x3270be)[_0x888c('0x21')](handleEntityNotFound(_0x3c0049,null))[_0x888c('0x21')](respondWithResult(_0x3c0049,null))['catch'](handleError(_0x3c0049,null));};exports[_0x888c('0x42')]=function(_0x1e1483,_0x3d771f){return db[_0x888c('0x27')][_0x888c('0x42')](_0x1e1483[_0x888c('0x43')],{})[_0x888c('0x21')](respondWithResult(_0x3d771f,0xc9))[_0x888c('0x44')](handleError(_0x3d771f,null));};exports['update']=function(_0x56da6f,_0x43313f){if(_0x56da6f['body']['id']){delete _0x56da6f[_0x888c('0x43')]['id'];}return db[_0x888c('0x27')]['find']({'where':{'id':_0x56da6f[_0x888c('0x41')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x43313f,null))[_0x888c('0x21')](saveUpdates(_0x56da6f[_0x888c('0x43')],null))[_0x888c('0x21')](respondWithResult(_0x43313f,null))[_0x888c('0x44')](handleError(_0x43313f,null));};exports[_0x888c('0x22')]=function(_0x53137b,_0x3c30d5){return db['ServicenowConfiguration'][_0x888c('0x45')]({'where':{'id':_0x53137b[_0x888c('0x41')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x3c30d5,null))[_0x888c('0x21')](removeEntity(_0x3c30d5,null))[_0x888c('0x44')](handleError(_0x3c30d5,null));};exports[_0x888c('0x46')]=function(_0x41d0f1,_0x21f5eb,_0x12e845){var _0x50a243={};var _0x2de225={};var _0x3f5405;var _0x540ef8;return db['ServicenowConfiguration'][_0x888c('0x47')]({'where':{'id':_0x41d0f1[_0x888c('0x41')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x21f5eb,null))[_0x888c('0x21')](function(_0xf3a670){if(_0xf3a670){_0x3f5405=_0xf3a670;_0x2de225[_0x888c('0x2b')]=_['keys'](db['ServicenowField'][_0x888c('0x28')]);_0x2de225[_0x888c('0x2d')]=_[_0x888c('0x2c')](_0x41d0f1[_0x888c('0x2d')]);_0x2de225[_0x888c('0x2e')]=_['intersection'](_0x2de225[_0x888c('0x2b')],_0x2de225[_0x888c('0x2d')]);_0x50a243[_0x888c('0x30')]=_[_0x888c('0x2f')](_0x2de225[_0x888c('0x2b')],qs[_0x888c('0x31')](_0x41d0f1[_0x888c('0x2d')][_0x888c('0x31')]));_0x50a243[_0x888c('0x30')]=_0x50a243['attributes'][_0x888c('0x32')]?_0x50a243['attributes']:_0x2de225['model'];_0x50a243[_0x888c('0x35')]=qs[_0x888c('0x36')](_0x41d0f1[_0x888c('0x2d')][_0x888c('0x36')]);_0x50a243['where']=qs['filters'](_[_0x888c('0x48')](_0x41d0f1[_0x888c('0x2d')],_0x2de225[_0x888c('0x2e')]));if(_0x41d0f1['query'][_0x888c('0x49')]){_0x50a243[_0x888c('0x37')]=_[_0x888c('0x3a')](_0x50a243[_0x888c('0x37')],{'$or':_['map'](_0x50a243['attributes'],function(_0x300c7b){var _0x232e98={};_0x232e98[_0x300c7b]={'$like':'%'+_0x41d0f1[_0x888c('0x2d')][_0x888c('0x49')]+'%'};return _0x232e98;})});}_0x50a243=_[_0x888c('0x3a')]({},_0x50a243,_0x41d0f1['options']);return _0x3f5405[_0x888c('0x46')](_0x50a243);}})[_0x888c('0x21')](function(_0x5adb89){if(_0x5adb89){_0x540ef8=_0x5adb89['length'];if(!_0x41d0f1[_0x888c('0x2d')]['hasOwnProperty'](_0x888c('0x34'))){_0x50a243[_0x888c('0x1c')]=qs[_0x888c('0x1c')](_0x41d0f1['query']['limit']);_0x50a243[_0x888c('0x1b')]=qs[_0x888c('0x1b')](_0x41d0f1['query'][_0x888c('0x1b')]);}return _0x3f5405['getFields'](_0x50a243);}})[_0x888c('0x21')](function(_0x892e75){if(_0x892e75){return _0x892e75?{'count':_0x540ef8,'rows':_0x892e75}:null;}})[_0x888c('0x21')](respondWithResult(_0x21f5eb,null))[_0x888c('0x44')](handleError(_0x21f5eb,null));};exports['getSubjects']=function(_0x264f3f,_0x2ddc8c,_0x1cb454){var _0x4d956f={};var _0x409d1f={};var _0x24f682;var _0x3449c4;return db[_0x888c('0x27')][_0x888c('0x47')]({'where':{'id':_0x264f3f[_0x888c('0x41')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x2ddc8c,null))[_0x888c('0x21')](function(_0x140dfc){if(_0x140dfc){_0x24f682=_0x140dfc;_0x409d1f[_0x888c('0x2b')]=_[_0x888c('0x2c')](db['ServicenowField']['rawAttributes']);_0x409d1f['query']=_[_0x888c('0x2c')](_0x264f3f['query']);_0x409d1f[_0x888c('0x2e')]=_[_0x888c('0x2f')](_0x409d1f[_0x888c('0x2b')],_0x409d1f[_0x888c('0x2d')]);_0x4d956f[_0x888c('0x30')]=_['intersection'](_0x409d1f[_0x888c('0x2b')],qs[_0x888c('0x31')](_0x264f3f['query'][_0x888c('0x31')]));_0x4d956f[_0x888c('0x30')]=_0x4d956f[_0x888c('0x30')][_0x888c('0x32')]?_0x4d956f[_0x888c('0x30')]:_0x409d1f['model'];_0x4d956f['order']=qs['sort'](_0x264f3f['query']['sort']);_0x4d956f[_0x888c('0x37')]=qs[_0x888c('0x2e')](_[_0x888c('0x48')](_0x264f3f[_0x888c('0x2d')],_0x409d1f['filters']));if(_0x264f3f['query']['filter']){_0x4d956f[_0x888c('0x37')]=_[_0x888c('0x3a')](_0x4d956f['where'],{'$or':_[_0x888c('0x38')](_0x4d956f[_0x888c('0x30')],function(_0x2282d4){var _0x3ab260={};_0x3ab260[_0x2282d4]={'$like':'%'+_0x264f3f[_0x888c('0x2d')]['filter']+'%'};return _0x3ab260;})});}_0x4d956f=_[_0x888c('0x3a')]({},_0x4d956f,_0x264f3f[_0x888c('0x3b')]);return _0x24f682[_0x888c('0x4a')](_0x4d956f);}})[_0x888c('0x21')](function(_0x2030c3){if(_0x2030c3){_0x3449c4=_0x2030c3['length'];if(!_0x264f3f[_0x888c('0x2d')][_0x888c('0x33')]('nolimit')){_0x4d956f['limit']=qs['limit'](_0x264f3f['query'][_0x888c('0x1c')]);_0x4d956f[_0x888c('0x1b')]=qs['offset'](_0x264f3f[_0x888c('0x2d')][_0x888c('0x1b')]);}return _0x24f682[_0x888c('0x4a')](_0x4d956f);}})['then'](function(_0x1e9cd1){if(_0x1e9cd1){return _0x1e9cd1?{'count':_0x3449c4,'rows':_0x1e9cd1}:null;}})[_0x888c('0x21')](respondWithResult(_0x2ddc8c,null))['catch'](handleError(_0x2ddc8c,null));};exports[_0x888c('0x4b')]=function(_0x285a8e,_0x14b0e7,_0xf04e1b){var _0x425418={};var _0x336766={};var _0x5a86f7;var _0x2224ba;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x285a8e[_0x888c('0x41')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x14b0e7,null))[_0x888c('0x21')](function(_0x576b77){if(_0x576b77){_0x5a86f7=_0x576b77;_0x336766[_0x888c('0x2b')]=_[_0x888c('0x2c')](db[_0x888c('0x4c')]['rawAttributes']);_0x336766['query']=_[_0x888c('0x2c')](_0x285a8e['query']);_0x336766[_0x888c('0x2e')]=_[_0x888c('0x2f')](_0x336766[_0x888c('0x2b')],_0x336766[_0x888c('0x2d')]);_0x425418['attributes']=_[_0x888c('0x2f')](_0x336766[_0x888c('0x2b')],qs[_0x888c('0x31')](_0x285a8e['query'][_0x888c('0x31')]));_0x425418[_0x888c('0x30')]=_0x425418[_0x888c('0x30')][_0x888c('0x32')]?_0x425418[_0x888c('0x30')]:_0x336766['model'];_0x425418[_0x888c('0x35')]=qs[_0x888c('0x36')](_0x285a8e['query'][_0x888c('0x36')]);_0x425418[_0x888c('0x37')]=qs[_0x888c('0x2e')](_[_0x888c('0x48')](_0x285a8e[_0x888c('0x2d')],_0x336766[_0x888c('0x2e')]));if(_0x285a8e[_0x888c('0x2d')]['filter']){_0x425418[_0x888c('0x37')]=_[_0x888c('0x3a')](_0x425418[_0x888c('0x37')],{'$or':_[_0x888c('0x38')](_0x425418[_0x888c('0x30')],function(_0xc2e52f){var _0x1d8a02={};_0x1d8a02[_0xc2e52f]={'$like':'%'+_0x285a8e['query'][_0x888c('0x49')]+'%'};return _0x1d8a02;})});}_0x425418=_[_0x888c('0x3a')]({},_0x425418,_0x285a8e['options']);return _0x5a86f7[_0x888c('0x4b')](_0x425418);}})[_0x888c('0x21')](function(_0x10ed09){if(_0x10ed09){_0x2224ba=_0x10ed09[_0x888c('0x32')];if(!_0x285a8e['query'][_0x888c('0x33')](_0x888c('0x34'))){_0x425418['limit']=qs[_0x888c('0x1c')](_0x285a8e[_0x888c('0x2d')][_0x888c('0x1c')]);_0x425418[_0x888c('0x1b')]=qs[_0x888c('0x1b')](_0x285a8e[_0x888c('0x2d')][_0x888c('0x1b')]);}return _0x5a86f7[_0x888c('0x4b')](_0x425418);}})['then'](function(_0x1f53f5){if(_0x1f53f5){return _0x1f53f5?{'count':_0x2224ba,'rows':_0x1f53f5}:null;}})[_0x888c('0x21')](respondWithResult(_0x14b0e7,null))[_0x888c('0x44')](handleError(_0x14b0e7,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 2c1265c..f5baaed 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 _0x5386=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations'];(function(_0x256ec3,_0x12bdab){var _0x4764bd=function(_0x463c26){while(--_0x463c26){_0x256ec3['push'](_0x256ec3['shift']());}};_0x4764bd(++_0x12bdab);}(_0x5386,0x1e1));var _0x6538=function(_0x174a2d,_0x44cf92){_0x174a2d=_0x174a2d-0x0;var _0x3a58c3=_0x5386[_0x174a2d];return _0x3a58c3;};'use strict';var _=require(_0x6538('0x0'));var util=require(_0x6538('0x1'));var logger=require(_0x6538('0x2'))(_0x6538('0x3'));var moment=require('moment');var BPromise=require(_0x6538('0x4'));var rp=require(_0x6538('0x5'));var fs=require('fs');var path=require(_0x6538('0x6'));var rimraf=require(_0x6538('0x7'));var config=require(_0x6538('0x8'));var attributes=require(_0x6538('0x9'));module[_0x6538('0xa')]=function(_0x2433c9,_0x4ed3fa){return _0x2433c9[_0x6538('0xb')]('ServicenowConfiguration',attributes,{'tableName':_0x6538('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1aa=['moment','bluebird','rimraf','../../config/environment','exports','ServicenowConfiguration','util','../../config/logger','api'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x5b079a,_0x32d28d){_0x5b079a=_0x5b079a-0x0;var _0x2dafe4=_0xa1aa[_0x5b079a];return _0x2dafe4;};'use strict';var _=require('lodash');var util=require(_0xaa1a('0x0'));var logger=require(_0xaa1a('0x1'))(_0xaa1a('0x2'));var moment=require(_0xaa1a('0x3'));var BPromise=require(_0xaa1a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaa1a('0x5'));var config=require(_0xaa1a('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xaa1a('0x7')]=function(_0x370a4e,_0x243c15){return _0x370a4e['define'](_0xaa1a('0x8'),attributes,{'tableName':'int_servicenow_configurations','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 84d18e4..5134226 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 _0x9000=['request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','ServicenowConfiguration,\x20%s,\x20%s','message'];(function(_0x1a8532,_0x9df2ce){var _0x562d6f=function(_0x1fd53d){while(--_0x1fd53d){_0x1a8532['push'](_0x1a8532['shift']());}};_0x562d6f(++_0x9df2ce);}(_0x9000,0x173));var _0x0900=function(_0xf8886b,_0x504891){_0xf8886b=_0xf8886b-0x0;var _0x321bd5=_0x9000[_0xf8886b];return _0x321bd5;};'use strict';var _=require(_0x0900('0x0'));var util=require(_0x0900('0x1'));var moment=require('moment');var BPromise=require(_0x0900('0x2'));var rs=require(_0x0900('0x3'));var fs=require('fs');var Redis=require(_0x0900('0x4'));var db=require(_0x0900('0x5'))['db'];var utils=require(_0x0900('0x6'));var logger=require(_0x0900('0x7'))('rpc');var config=require(_0x0900('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0900('0x9')][_0x0900('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3df721,_0xa886dd,_0x2f2d4d){return new BPromise(function(_0x509cff,_0x42e0f2){return client[_0x0900('0xb')](_0x3df721,_0x2f2d4d)[_0x0900('0xc')](function(_0x2cde59){logger[_0x0900('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0xa886dd,'request\x20sent');logger[_0x0900('0xe')](_0x0900('0xf'),_0xa886dd,'request\x20sent',JSON['stringify'](_0x2cde59));if(_0x2cde59[_0x0900('0x10')]){if(_0x2cde59['error'][_0x0900('0x11')]===0x1f4){logger['error'](_0x0900('0x12'),_0xa886dd,_0x2cde59['error'][_0x0900('0x13')]);return _0x42e0f2(_0x2cde59['error'][_0x0900('0x13')]);}logger[_0x0900('0x10')](_0x0900('0x12'),_0xa886dd,_0x2cde59[_0x0900('0x10')]['message']);return _0x509cff(_0x2cde59[_0x0900('0x10')][_0x0900('0x13')]);}else{logger[_0x0900('0xd')](_0x0900('0x12'),_0xa886dd,_0x0900('0x14'));_0x509cff(_0x2cde59[_0x0900('0x15')][_0x0900('0x13')]);}})[_0x0900('0x16')](function(_0x1de1ee){logger[_0x0900('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0xa886dd,_0x1de1ee);_0x42e0f2(_0x1de1ee);});});} \ No newline at end of file +var _0xc9d9=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x42212b,_0x1086f6){var _0x6e6eeb=function(_0x1b449b){while(--_0x1b449b){_0x42212b['push'](_0x42212b['shift']());}};_0x6e6eeb(++_0x1086f6);}(_0xc9d9,0x1e1));var _0x9c9d=function(_0x25949d,_0x574a77){_0x25949d=_0x25949d-0x0;var _0x2ee88c=_0xc9d9[_0x25949d];return _0x2ee88c;};'use strict';var _=require('lodash');var util=require(_0x9c9d('0x0'));var moment=require(_0x9c9d('0x1'));var BPromise=require(_0x9c9d('0x2'));var rs=require(_0x9c9d('0x3'));var fs=require('fs');var Redis=require(_0x9c9d('0x4'));var db=require(_0x9c9d('0x5'))['db'];var utils=require(_0x9c9d('0x6'));var logger=require(_0x9c9d('0x7'))(_0x9c9d('0x8'));var config=require(_0x9c9d('0x9'));var jayson=require(_0x9c9d('0xa'));var client=jayson[_0x9c9d('0xb')][_0x9c9d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41e052,_0x15b6b2,_0x5d9dba){return new BPromise(function(_0xd1b1ba,_0x431170){return client[_0x9c9d('0xd')](_0x41e052,_0x5d9dba)[_0x9c9d('0xe')](function(_0x1a8d0c){logger[_0x9c9d('0xf')](_0x9c9d('0x10'),_0x15b6b2,_0x9c9d('0x11'));logger['debug'](_0x9c9d('0x12'),_0x15b6b2,_0x9c9d('0x11'),JSON['stringify'](_0x1a8d0c));if(_0x1a8d0c[_0x9c9d('0x13')]){if(_0x1a8d0c[_0x9c9d('0x13')][_0x9c9d('0x14')]===0x1f4){logger[_0x9c9d('0x13')](_0x9c9d('0x10'),_0x15b6b2,_0x1a8d0c[_0x9c9d('0x13')]['message']);return _0x431170(_0x1a8d0c[_0x9c9d('0x13')][_0x9c9d('0x15')]);}logger[_0x9c9d('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x15b6b2,_0x1a8d0c[_0x9c9d('0x13')]['message']);return _0xd1b1ba(_0x1a8d0c[_0x9c9d('0x13')][_0x9c9d('0x15')]);}else{logger[_0x9c9d('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x15b6b2,_0x9c9d('0x11'));_0xd1b1ba(_0x1a8d0c[_0x9c9d('0x16')][_0x9c9d('0x15')]);}})[_0x9c9d('0x17')](function(_0x214e2f){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x15b6b2,_0x214e2f);_0x431170(_0x214e2f);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 6728700..f589eb1 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 _0xbbad=['create','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','get','/:id','post'];(function(_0x26641c,_0x1ba2a5){var _0x42c01a=function(_0x15c7da){while(--_0x15c7da){_0x26641c['push'](_0x26641c['shift']());}};_0x42c01a(++_0x1ba2a5);}(_0xbbad,0x104));var _0xdbba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbad[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdbba('0x0'));var util=require(_0xdbba('0x1'));var path=require('path');var timeout=require(_0xdbba('0x2'));var express=require(_0xdbba('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdbba('0x4'));var interaction=require(_0xdbba('0x5'));var config=require(_0xdbba('0x6'));var controller=require(_0xdbba('0x7'));router['get']('/',auth[_0xdbba('0x8')](),controller['index']);router[_0xdbba('0x9')](_0xdbba('0xa'),auth[_0xdbba('0x8')](),controller['show']);router[_0xdbba('0xb')]('/',auth[_0xdbba('0x8')](),controller[_0xdbba('0xc')]);router[_0xdbba('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdbba('0xe')](_0xdbba('0xa'),auth[_0xdbba('0x8')](),controller[_0xdbba('0xf')]);module[_0xdbba('0x10')]=router; \ No newline at end of file +var _0xbd1f=['../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','create','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x342e3a,_0x38aac3){var _0x48c4db=function(_0x127f93){while(--_0x127f93){_0x342e3a['push'](_0x342e3a['shift']());}};_0x48c4db(++_0x38aac3);}(_0xbd1f,0x6a));var _0xfbd1=function(_0x4b6507,_0x5518b5){_0x4b6507=_0x4b6507-0x0;var _0x2001ec=_0xbd1f[_0x4b6507];return _0x2001ec;};'use strict';var multer=require(_0xfbd1('0x0'));var util=require(_0xfbd1('0x1'));var path=require('path');var timeout=require(_0xfbd1('0x2'));var express=require(_0xfbd1('0x3'));var router=express[_0xfbd1('0x4')]();var fs_extra=require(_0xfbd1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfbd1('0x6'));var controller=require(_0xfbd1('0x7'));router[_0xfbd1('0x8')]('/',auth['isAuthenticated'](),controller[_0xfbd1('0x9')]);router[_0xfbd1('0x8')](_0xfbd1('0xa'),auth[_0xfbd1('0xb')](),controller['show']);router['post']('/',auth[_0xfbd1('0xb')](),controller[_0xfbd1('0xc')]);router[_0xfbd1('0xd')](_0xfbd1('0xa'),auth[_0xfbd1('0xb')](),controller['update']);router[_0xfbd1('0xe')]('/:id',auth[_0xfbd1('0xb')](),controller[_0xfbd1('0xf')]);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 2320aa2..bc8cfb3 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 _0xf0dd=['string','STRING','BOOLEAN','exports','ENUM','variable','customVariable','picklist'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xf0dd,0x153));var _0xdf0d=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0xf0dd[_0x57fa7e];return _0x320671;};'use strict';var Sequelize=require('sequelize');module[_0xdf0d('0x0')]={'type':{'type':Sequelize[_0xdf0d('0x1')]('string',_0xdf0d('0x2'),_0xdf0d('0x3'),'keyValue',_0xdf0d('0x4')),'defaultValue':_0xdf0d('0x5')},'content':{'type':Sequelize[_0xdf0d('0x6')]},'key':{'type':Sequelize[_0xdf0d('0x6')]},'keyType':{'type':Sequelize[_0xdf0d('0x1')](_0xdf0d('0x5'),_0xdf0d('0x2'),_0xdf0d('0x3'))},'keyContent':{'type':Sequelize[_0xdf0d('0x6')]},'idField':{'type':Sequelize[_0xdf0d('0x6')]},'nameField':{'type':Sequelize[_0xdf0d('0x6')]},'customField':{'type':Sequelize[_0xdf0d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdf0d('0x6')]}}; \ No newline at end of file +var _0xe09c=['exports','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x2b03a2,_0xb0ac53){var _0x391599=function(_0x1ddde2){while(--_0x1ddde2){_0x2b03a2['push'](_0x2b03a2['shift']());}};_0x391599(++_0xb0ac53);}(_0xe09c,0x1ce));var _0xce09=function(_0x2368d6,_0x1bf079){_0x2368d6=_0x2368d6-0x0;var _0x1fbe61=_0xe09c[_0x2368d6];return _0x1fbe61;};'use strict';var Sequelize=require('sequelize');module[_0xce09('0x0')]={'type':{'type':Sequelize['ENUM'](_0xce09('0x1'),_0xce09('0x2'),'customVariable',_0xce09('0x3'),_0xce09('0x4')),'defaultValue':_0xce09('0x1')},'content':{'type':Sequelize[_0xce09('0x5')]},'key':{'type':Sequelize[_0xce09('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xce09('0x1'),_0xce09('0x2'),_0xce09('0x6'))},'keyContent':{'type':Sequelize[_0xce09('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xce09('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xce09('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 728a292..69c6b9b 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 _0x5445=['status','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','params','keys','includeAll','find','catch','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0xea5313,_0x5ced37){var _0x5ca006=function(_0x5d0ef3){while(--_0x5d0ef3){_0xea5313['push'](_0xea5313['shift']());}};_0x5ca006(++_0x5ced37);}(_0x5445,0x14e));var _0x5544=function(_0x3fa529,_0x3c341e){_0x3fa529=_0x3fa529-0x0;var _0x350134=_0x5445[_0x3fa529];return _0x350134;};'use strict';var emlformat=require(_0x5544('0x0'));var rimraf=require(_0x5544('0x1'));var zipdir=require(_0x5544('0x2'));var jsonpatch=require(_0x5544('0x3'));var rp=require(_0x5544('0x4'));var moment=require(_0x5544('0x5'));var BPromise=require(_0x5544('0x6'));var Mustache=require('mustache');var util=require(_0x5544('0x7'));var path=require('path');var sox=require(_0x5544('0x8'));var csv=require(_0x5544('0x9'));var ejs=require(_0x5544('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5544('0xb'));var squel=require('squel');var crypto=require(_0x5544('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5544('0xd'));var toCsv=require(_0x5544('0x9'));var querystring=require(_0x5544('0xe'));var Papa=require('papaparse');var Redis=require(_0x5544('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5544('0x10'));var as=require(_0x5544('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5544('0x12'))(_0x5544('0x13'));var utils=require(_0x5544('0x14'));var config=require(_0x5544('0x15'));var licenseUtil=require(_0x5544('0x16'));var db=require(_0x5544('0x17'))['db'];function respondWithStatusCode(_0x51b0b2,_0x12946a){_0x12946a=_0x12946a||0xcc;return function(_0x1c22a9){if(_0x1c22a9){return _0x51b0b2[_0x5544('0x18')](_0x12946a);}return _0x51b0b2['status'](_0x12946a)[_0x5544('0x19')]();};}function respondWithResult(_0xacba2d,_0x4689cc){_0x4689cc=_0x4689cc||0xc8;return function(_0x22ae91){if(_0x22ae91){return _0xacba2d[_0x5544('0x1a')](_0x4689cc)[_0x5544('0x1b')](_0x22ae91);}};}function respondWithFilteredResult(_0x40d23f,_0x4b834b){return function(_0xdfef44){if(_0xdfef44){var _0x4df400=typeof _0x4b834b['offset']==='undefined'&&typeof _0x4b834b[_0x5544('0x1c')]===_0x5544('0x1d');var _0x45a3c8=_0xdfef44[_0x5544('0x1e')];var _0x4a6516=_0x4df400?0x0:_0x4b834b[_0x5544('0x1f')];var _0x4b5210=_0x4df400?_0xdfef44[_0x5544('0x1e')]:_0x4b834b[_0x5544('0x1f')]+_0x4b834b[_0x5544('0x1c')];var _0x1afa91;if(_0x4b5210>=_0x45a3c8){_0x4b5210=_0x45a3c8;_0x1afa91=0xc8;}else{_0x1afa91=0xce;}_0x40d23f['status'](_0x1afa91);return _0x40d23f['set'](_0x5544('0x20'),_0x4a6516+'-'+_0x4b5210+'/'+_0x45a3c8)[_0x5544('0x1b')](_0xdfef44);}return null;};}function patchUpdates(_0x6f6b94){return function(_0x1fbb68){try{jsonpatch[_0x5544('0x21')](_0x1fbb68,_0x6f6b94,!![]);}catch(_0x317c86){return BPromise['reject'](_0x317c86);}return _0x1fbb68[_0x5544('0x22')]();};}function saveUpdates(_0x469992,_0x419c93){return function(_0x732e18){if(_0x732e18){return _0x732e18[_0x5544('0x23')](_0x469992)[_0x5544('0x24')](function(_0x49de67){return _0x49de67;});}return null;};}function removeEntity(_0x3bd22e,_0x1586d0){return function(_0x272094){if(_0x272094){return _0x272094['destroy']()[_0x5544('0x24')](function(){_0x3bd22e[_0x5544('0x1a')](0xcc)[_0x5544('0x19')]();});}};}function handleEntityNotFound(_0x4b3016,_0x692253){return function(_0x29adfc){if(!_0x29adfc){_0x4b3016[_0x5544('0x18')](0x194);}return _0x29adfc;};}function handleError(_0x32f59a,_0x2a7e80){_0x2a7e80=_0x2a7e80||0x1f4;return function(_0x1eb0f5){logger['error'](_0x1eb0f5[_0x5544('0x25')]);if(_0x1eb0f5['name']){delete _0x1eb0f5[_0x5544('0x26')];}_0x32f59a[_0x5544('0x1a')](_0x2a7e80)[_0x5544('0x27')](_0x1eb0f5);};}exports[_0x5544('0x28')]=function(_0x4208fb,_0x139ebb){var _0x165cbc={},_0x129e9b={},_0x593eb9={'count':0x0,'rows':[]};var _0x2ef761=_[_0x5544('0x29')](db[_0x5544('0x2a')][_0x5544('0x2b')],function(_0x505b86){return{'name':_0x505b86[_0x5544('0x2c')],'type':_0x505b86[_0x5544('0x2d')][_0x5544('0x2e')]};});_0x129e9b[_0x5544('0x2f')]=_['map'](_0x2ef761,_0x5544('0x26'));_0x129e9b['query']=_['keys'](_0x4208fb[_0x5544('0x30')]);_0x129e9b[_0x5544('0x31')]=_[_0x5544('0x32')](_0x129e9b[_0x5544('0x2f')],_0x129e9b['query']);_0x165cbc['attributes']=_[_0x5544('0x32')](_0x129e9b['model'],qs[_0x5544('0x33')](_0x4208fb['query'][_0x5544('0x33')]));_0x165cbc[_0x5544('0x34')]=_0x165cbc[_0x5544('0x34')][_0x5544('0x35')]?_0x165cbc[_0x5544('0x34')]:_0x129e9b[_0x5544('0x2f')];if(!_0x4208fb['query'][_0x5544('0x36')](_0x5544('0x37'))){_0x165cbc[_0x5544('0x1c')]=qs[_0x5544('0x1c')](_0x4208fb['query'][_0x5544('0x1c')]);_0x165cbc['offset']=qs['offset'](_0x4208fb[_0x5544('0x30')][_0x5544('0x1f')]);}_0x165cbc[_0x5544('0x38')]=qs['sort'](_0x4208fb['query'][_0x5544('0x39')]);_0x165cbc[_0x5544('0x3a')]=qs[_0x5544('0x31')](_['pick'](_0x4208fb['query'],_0x129e9b['filters']),_0x2ef761);if(_0x4208fb[_0x5544('0x30')]['filter']){_0x165cbc[_0x5544('0x3a')]=_['merge'](_0x165cbc[_0x5544('0x3a')],{'$or':_[_0x5544('0x29')](_0x2ef761,function(_0x3f8610){if(_0x3f8610[_0x5544('0x2d')]!==_0x5544('0x3b')){var _0x314ea6={};_0x314ea6[_0x3f8610[_0x5544('0x26')]]={'$like':'%'+_0x4208fb[_0x5544('0x30')][_0x5544('0x3c')]+'%'};return _0x314ea6;}})});}_0x165cbc=_[_0x5544('0x3d')]({},_0x165cbc,_0x4208fb[_0x5544('0x3e')]);var _0x15508e={'where':_0x165cbc[_0x5544('0x3a')]};return db['ServicenowField'][_0x5544('0x1e')](_0x15508e)[_0x5544('0x24')](function(_0x152f19){_0x593eb9[_0x5544('0x1e')]=_0x152f19;if(_0x4208fb['query']['includeAll']){_0x165cbc[_0x5544('0x3f')]=[{'all':!![]}];}return db[_0x5544('0x2a')][_0x5544('0x40')](_0x165cbc);})[_0x5544('0x24')](function(_0x4a1f1d){_0x593eb9['rows']=_0x4a1f1d;return _0x593eb9;})[_0x5544('0x24')](respondWithFilteredResult(_0x139ebb,_0x165cbc))['catch'](handleError(_0x139ebb,null));};exports['show']=function(_0x59608a,_0x1d5a9f){var _0xe0b475={'raw':!![],'where':{'id':_0x59608a[_0x5544('0x41')]['id']}},_0x72aba7={};_0x72aba7[_0x5544('0x2f')]=_['keys'](db[_0x5544('0x2a')]['rawAttributes']);_0x72aba7[_0x5544('0x30')]=_[_0x5544('0x42')](_0x59608a[_0x5544('0x30')]);_0x72aba7[_0x5544('0x31')]=_['intersection'](_0x72aba7[_0x5544('0x2f')],_0x72aba7[_0x5544('0x30')]);_0xe0b475[_0x5544('0x34')]=_[_0x5544('0x32')](_0x72aba7[_0x5544('0x2f')],qs['fields'](_0x59608a[_0x5544('0x30')][_0x5544('0x33')]));_0xe0b475[_0x5544('0x34')]=_0xe0b475[_0x5544('0x34')][_0x5544('0x35')]?_0xe0b475[_0x5544('0x34')]:_0x72aba7[_0x5544('0x2f')];if(_0x59608a['query'][_0x5544('0x43')]){_0xe0b475[_0x5544('0x3f')]=[{'all':!![]}];}_0xe0b475=_[_0x5544('0x3d')]({},_0xe0b475,_0x59608a[_0x5544('0x3e')]);return db[_0x5544('0x2a')][_0x5544('0x44')](_0xe0b475)[_0x5544('0x24')](handleEntityNotFound(_0x1d5a9f,null))[_0x5544('0x24')](respondWithResult(_0x1d5a9f,null))[_0x5544('0x45')](handleError(_0x1d5a9f,null));};exports['create']=function(_0x21a546,_0x1de2ab){return db[_0x5544('0x2a')]['create'](_0x21a546[_0x5544('0x46')],{})['then'](respondWithResult(_0x1de2ab,0xc9))[_0x5544('0x45')](handleError(_0x1de2ab,null));};exports[_0x5544('0x23')]=function(_0x37a1ea,_0x5096de){if(_0x37a1ea[_0x5544('0x46')]['id']){delete _0x37a1ea[_0x5544('0x46')]['id'];}return db[_0x5544('0x2a')][_0x5544('0x44')]({'where':{'id':_0x37a1ea[_0x5544('0x41')]['id']}})[_0x5544('0x24')](handleEntityNotFound(_0x5096de,null))[_0x5544('0x24')](saveUpdates(_0x37a1ea[_0x5544('0x46')],null))[_0x5544('0x24')](respondWithResult(_0x5096de,null))[_0x5544('0x45')](handleError(_0x5096de,null));};exports[_0x5544('0x47')]=function(_0x36c097,_0x3a1a59){return db[_0x5544('0x2a')][_0x5544('0x44')]({'where':{'id':_0x36c097[_0x5544('0x41')]['id']}})[_0x5544('0x24')](handleEntityNotFound(_0x3a1a59,null))[_0x5544('0x24')](removeEntity(_0x3a1a59,null))[_0x5544('0x45')](handleError(_0x3a1a59,null));}; \ No newline at end of file +var _0xbf7b=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xbf7b,0x1ce));var _0xbbf7=function(_0x5be892,_0x68238a){_0x5be892=_0x5be892-0x0;var _0x53fc35=_0xbf7b[_0x5be892];return _0x53fc35;};'use strict';var emlformat=require(_0xbbf7('0x0'));var rimraf=require(_0xbbf7('0x1'));var zipdir=require(_0xbbf7('0x2'));var jsonpatch=require(_0xbbf7('0x3'));var rp=require(_0xbbf7('0x4'));var moment=require(_0xbbf7('0x5'));var BPromise=require(_0xbbf7('0x6'));var Mustache=require(_0xbbf7('0x7'));var util=require(_0xbbf7('0x8'));var path=require(_0xbbf7('0x9'));var sox=require(_0xbbf7('0xa'));var csv=require('to-csv');var ejs=require(_0xbbf7('0xb'));var fs=require('fs');var fs_extra=require(_0xbbf7('0xc'));var _=require(_0xbbf7('0xd'));var squel=require(_0xbbf7('0xe'));var crypto=require(_0xbbf7('0xf'));var jsforce=require(_0xbbf7('0x10'));var deskjs=require(_0xbbf7('0x11'));var toCsv=require(_0xbbf7('0x12'));var querystring=require(_0xbbf7('0x13'));var Papa=require(_0xbbf7('0x14'));var Redis=require(_0xbbf7('0x15'));var authService=require(_0xbbf7('0x16'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbbf7('0x17'));var logger=require(_0xbbf7('0x18'))('api');var utils=require(_0xbbf7('0x19'));var config=require(_0xbbf7('0x1a'));var licenseUtil=require(_0xbbf7('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3552d4,_0x1bf21d){_0x1bf21d=_0x1bf21d||0xcc;return function(_0x230dfb){if(_0x230dfb){return _0x3552d4[_0xbbf7('0x1c')](_0x1bf21d);}return _0x3552d4[_0xbbf7('0x1d')](_0x1bf21d)[_0xbbf7('0x1e')]();};}function respondWithResult(_0x51c952,_0xc65d6d){_0xc65d6d=_0xc65d6d||0xc8;return function(_0xdad9d4){if(_0xdad9d4){return _0x51c952[_0xbbf7('0x1d')](_0xc65d6d)['json'](_0xdad9d4);}};}function respondWithFilteredResult(_0x4da99c,_0xbb320a){return function(_0x3f0a23){if(_0x3f0a23){var _0x3ee71c=typeof _0xbb320a['offset']===_0xbbf7('0x1f')&&typeof _0xbb320a[_0xbbf7('0x20')]===_0xbbf7('0x1f');var _0x6b4496=_0x3f0a23['count'];var _0x328596=_0x3ee71c?0x0:_0xbb320a[_0xbbf7('0x21')];var _0x6e0534=_0x3ee71c?_0x3f0a23[_0xbbf7('0x22')]:_0xbb320a['offset']+_0xbb320a[_0xbbf7('0x20')];var _0x3048fe;if(_0x6e0534>=_0x6b4496){_0x6e0534=_0x6b4496;_0x3048fe=0xc8;}else{_0x3048fe=0xce;}_0x4da99c[_0xbbf7('0x1d')](_0x3048fe);return _0x4da99c['set'](_0xbbf7('0x23'),_0x328596+'-'+_0x6e0534+'/'+_0x6b4496)[_0xbbf7('0x24')](_0x3f0a23);}return null;};}function patchUpdates(_0x2d779a){return function(_0x43dd00){try{jsonpatch[_0xbbf7('0x25')](_0x43dd00,_0x2d779a,!![]);}catch(_0xe2a7db){return BPromise[_0xbbf7('0x26')](_0xe2a7db);}return _0x43dd00[_0xbbf7('0x27')]();};}function saveUpdates(_0x145ac8,_0x441a37){return function(_0x468702){if(_0x468702){return _0x468702[_0xbbf7('0x28')](_0x145ac8)[_0xbbf7('0x29')](function(_0x1b144e){return _0x1b144e;});}return null;};}function removeEntity(_0x2bc854,_0x341e88){return function(_0x3ea8cf){if(_0x3ea8cf){return _0x3ea8cf[_0xbbf7('0x2a')]()[_0xbbf7('0x29')](function(){_0x2bc854[_0xbbf7('0x1d')](0xcc)[_0xbbf7('0x1e')]();});}};}function handleEntityNotFound(_0x19a8e8,_0x371e46){return function(_0x505002){if(!_0x505002){_0x19a8e8[_0xbbf7('0x1c')](0x194);}return _0x505002;};}function handleError(_0x52ebd6,_0x18cccd){_0x18cccd=_0x18cccd||0x1f4;return function(_0x368b5e){logger[_0xbbf7('0x2b')](_0x368b5e[_0xbbf7('0x2c')]);if(_0x368b5e[_0xbbf7('0x2d')]){delete _0x368b5e[_0xbbf7('0x2d')];}_0x52ebd6[_0xbbf7('0x1d')](_0x18cccd)[_0xbbf7('0x2e')](_0x368b5e);};}exports[_0xbbf7('0x2f')]=function(_0xba975c,_0x52dcf7){var _0x34b34a={},_0x4233ce={},_0x561789={'count':0x0,'rows':[]};var _0x1e82d3=_['map'](db[_0xbbf7('0x30')][_0xbbf7('0x31')],function(_0x28e9bc){return{'name':_0x28e9bc[_0xbbf7('0x32')],'type':_0x28e9bc[_0xbbf7('0x33')]['key']};});_0x4233ce[_0xbbf7('0x34')]=_['map'](_0x1e82d3,_0xbbf7('0x2d'));_0x4233ce[_0xbbf7('0x35')]=_[_0xbbf7('0x36')](_0xba975c['query']);_0x4233ce[_0xbbf7('0x37')]=_[_0xbbf7('0x38')](_0x4233ce[_0xbbf7('0x34')],_0x4233ce[_0xbbf7('0x35')]);_0x34b34a[_0xbbf7('0x39')]=_[_0xbbf7('0x38')](_0x4233ce[_0xbbf7('0x34')],qs['fields'](_0xba975c['query'][_0xbbf7('0x3a')]));_0x34b34a[_0xbbf7('0x39')]=_0x34b34a[_0xbbf7('0x39')][_0xbbf7('0x3b')]?_0x34b34a[_0xbbf7('0x39')]:_0x4233ce[_0xbbf7('0x34')];if(!_0xba975c[_0xbbf7('0x35')][_0xbbf7('0x3c')](_0xbbf7('0x3d'))){_0x34b34a[_0xbbf7('0x20')]=qs['limit'](_0xba975c[_0xbbf7('0x35')][_0xbbf7('0x20')]);_0x34b34a[_0xbbf7('0x21')]=qs[_0xbbf7('0x21')](_0xba975c['query']['offset']);}_0x34b34a['order']=qs[_0xbbf7('0x3e')](_0xba975c[_0xbbf7('0x35')][_0xbbf7('0x3e')]);_0x34b34a[_0xbbf7('0x3f')]=qs[_0xbbf7('0x37')](_[_0xbbf7('0x40')](_0xba975c['query'],_0x4233ce[_0xbbf7('0x37')]),_0x1e82d3);if(_0xba975c[_0xbbf7('0x35')][_0xbbf7('0x41')]){_0x34b34a[_0xbbf7('0x3f')]=_[_0xbbf7('0x42')](_0x34b34a['where'],{'$or':_[_0xbbf7('0x43')](_0x1e82d3,function(_0x4609d3){if(_0x4609d3['type']!==_0xbbf7('0x44')){var _0x661ad={};_0x661ad[_0x4609d3[_0xbbf7('0x2d')]]={'$like':'%'+_0xba975c[_0xbbf7('0x35')][_0xbbf7('0x41')]+'%'};return _0x661ad;}})});}_0x34b34a=_[_0xbbf7('0x42')]({},_0x34b34a,_0xba975c['options']);var _0x49488e={'where':_0x34b34a[_0xbbf7('0x3f')]};return db[_0xbbf7('0x30')][_0xbbf7('0x22')](_0x49488e)[_0xbbf7('0x29')](function(_0x8f71de){_0x561789[_0xbbf7('0x22')]=_0x8f71de;if(_0xba975c[_0xbbf7('0x35')][_0xbbf7('0x45')]){_0x34b34a[_0xbbf7('0x46')]=[{'all':!![]}];}return db[_0xbbf7('0x30')][_0xbbf7('0x47')](_0x34b34a);})[_0xbbf7('0x29')](function(_0x227bff){_0x561789[_0xbbf7('0x48')]=_0x227bff;return _0x561789;})['then'](respondWithFilteredResult(_0x52dcf7,_0x34b34a))[_0xbbf7('0x49')](handleError(_0x52dcf7,null));};exports[_0xbbf7('0x4a')]=function(_0xa5c005,_0x4e6543){var _0x468e2e={'raw':!![],'where':{'id':_0xa5c005[_0xbbf7('0x4b')]['id']}},_0x5652a5={};_0x5652a5[_0xbbf7('0x34')]=_[_0xbbf7('0x36')](db[_0xbbf7('0x30')]['rawAttributes']);_0x5652a5['query']=_['keys'](_0xa5c005[_0xbbf7('0x35')]);_0x5652a5[_0xbbf7('0x37')]=_[_0xbbf7('0x38')](_0x5652a5[_0xbbf7('0x34')],_0x5652a5['query']);_0x468e2e[_0xbbf7('0x39')]=_[_0xbbf7('0x38')](_0x5652a5['model'],qs['fields'](_0xa5c005['query'][_0xbbf7('0x3a')]));_0x468e2e[_0xbbf7('0x39')]=_0x468e2e[_0xbbf7('0x39')][_0xbbf7('0x3b')]?_0x468e2e[_0xbbf7('0x39')]:_0x5652a5[_0xbbf7('0x34')];if(_0xa5c005[_0xbbf7('0x35')][_0xbbf7('0x45')]){_0x468e2e[_0xbbf7('0x46')]=[{'all':!![]}];}_0x468e2e=_[_0xbbf7('0x42')]({},_0x468e2e,_0xa5c005[_0xbbf7('0x4c')]);return db[_0xbbf7('0x30')][_0xbbf7('0x4d')](_0x468e2e)[_0xbbf7('0x29')](handleEntityNotFound(_0x4e6543,null))[_0xbbf7('0x29')](respondWithResult(_0x4e6543,null))['catch'](handleError(_0x4e6543,null));};exports[_0xbbf7('0x4e')]=function(_0xad53b2,_0x302e3a){return db[_0xbbf7('0x30')][_0xbbf7('0x4e')](_0xad53b2['body'],{})[_0xbbf7('0x29')](respondWithResult(_0x302e3a,0xc9))['catch'](handleError(_0x302e3a,null));};exports[_0xbbf7('0x28')]=function(_0x18c322,_0x3f2c1f){if(_0x18c322[_0xbbf7('0x4f')]['id']){delete _0x18c322[_0xbbf7('0x4f')]['id'];}return db[_0xbbf7('0x30')]['find']({'where':{'id':_0x18c322['params']['id']}})[_0xbbf7('0x29')](handleEntityNotFound(_0x3f2c1f,null))[_0xbbf7('0x29')](saveUpdates(_0x18c322[_0xbbf7('0x4f')],null))['then'](respondWithResult(_0x3f2c1f,null))[_0xbbf7('0x49')](handleError(_0x3f2c1f,null));};exports[_0xbbf7('0x2a')]=function(_0x645854,_0x456a9e){return db[_0xbbf7('0x30')][_0xbbf7('0x4d')]({'where':{'id':_0x645854[_0xbbf7('0x4b')]['id']}})[_0xbbf7('0x29')](handleEntityNotFound(_0x456a9e,null))[_0xbbf7('0x29')](removeEntity(_0x456a9e,null))[_0xbbf7('0x49')](handleError(_0x456a9e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 68053b7..c5e7384 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 _0x374a=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x588074,_0x2523ba){var _0xa5e1ec=function(_0x48aa9a){while(--_0x48aa9a){_0x588074['push'](_0x588074['shift']());}};_0xa5e1ec(++_0x2523ba);}(_0x374a,0x92));var _0xa374=function(_0x3abd0f,_0x18f224){_0x3abd0f=_0x3abd0f-0x0;var _0x1be221=_0x374a[_0x3abd0f];return _0x1be221;};'use strict';var _=require(_0xa374('0x0'));var util=require(_0xa374('0x1'));var logger=require(_0xa374('0x2'))(_0xa374('0x3'));var moment=require('moment');var BPromise=require(_0xa374('0x4'));var rp=require(_0xa374('0x5'));var fs=require('fs');var path=require(_0xa374('0x6'));var rimraf=require(_0xa374('0x7'));var config=require(_0xa374('0x8'));var attributes=require(_0xa374('0x9'));module[_0xa374('0xa')]=function(_0x274557,_0x338e11){return _0x274557[_0xa374('0xb')](_0xa374('0xc'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xa374('0xd'),_0xa374('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9004=['path','../../config/environment','./intServicenowField.attributes','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x522fa8,_0x15eba3){var _0x2d1f6c=function(_0x169608){while(--_0x169608){_0x522fa8['push'](_0x522fa8['shift']());}};_0x2d1f6c(++_0x15eba3);}(_0x9004,0x6a));var _0x4900=function(_0x49c648,_0x541e61){_0x49c648=_0x49c648-0x0;var _0x1d7a47=_0x9004[_0x49c648];return _0x1d7a47;};'use strict';var _=require(_0x4900('0x0'));var util=require(_0x4900('0x1'));var logger=require('../../config/logger')(_0x4900('0x2'));var moment=require(_0x4900('0x3'));var BPromise=require(_0x4900('0x4'));var rp=require(_0x4900('0x5'));var fs=require('fs');var path=require(_0x4900('0x6'));var rimraf=require('rimraf');var config=require(_0x4900('0x7'));var attributes=require(_0x4900('0x8'));module['exports']=function(_0x26a93f,_0x59a9f4){return _0x26a93f[_0x4900('0x9')]('ServicenowField',attributes,{'tableName':_0x4900('0xa'),'paranoid':![],'indexes':[{'name':_0x4900('0xb'),'fields':[_0x4900('0xc'),_0x4900('0xd')],'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 97119a7..ad0b2ae 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 _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x543bdd,_0x21d49b){var _0xdc72c=function(_0x8e277){while(--_0x8e277){_0x543bdd['push'](_0x543bdd['shift']());}};_0xdc72c(++_0x21d49b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2c6172,_0xda7d5f){var _0x488031=function(_0x423139){while(--_0x423139){_0x2c6172['push'](_0x2c6172['shift']());}};_0x488031(++_0xda7d5f);}(_0xe706,0xa3));var _0x6e70=function(_0x3d9e94,_0x48136c){_0x3d9e94=_0x3d9e94-0x0;var _0x45f76e=_0xe706[_0x3d9e94];return _0x45f76e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index c141f27..0a054e3 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x29b4bb,_0x361442){var _0x39c028=function(_0x223afe){while(--_0x223afe){_0x29b4bb['push'](_0x29b4bb['shift']());}};_0x39c028(++_0x361442);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0xa516ce,_0x12871b){var _0x4f4f78=function(_0x3ee412){while(--_0x3ee412){_0xa516ce['push'](_0xa516ce['shift']());}};_0x4f4f78(++_0x12871b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index cc42000..1028cb2 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(_0x183b74,_0x3f72aa){var _0x23a747=function(_0x57afcf){while(--_0x57afcf){_0x183b74['push'](_0x183b74['shift']());}};_0x23a747(++_0x3f72aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x54dff9,_0x2a543c){var _0x153891=function(_0x46a414){while(--_0x46a414){_0x54dff9['push'](_0x54dff9['shift']());}};_0x153891(++_0x2a543c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 29a956c..de1f967 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 _0xe586=['parent_id','parent_type','parent_name','findOne','username','password','remoteUri','substring','lastIndexOf','%s%s','JSON','stringify','Invalid\x20Login','Password\x20Expired','POST','format','Calls','values','module_fields','remove','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','sendStatus','name','send','index','map','SugarcrmAccount','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','destroy','SugarcrmConfiguration','options','getConfigurations','AccountId','Subjects','getSubjects','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes'];(function(_0x575126,_0x7e3332){var _0x5c1454=function(_0x113968){while(--_0x113968){_0x575126['push'](_0x575126['shift']());}};_0x5c1454(++_0x7e3332);}(_0xe586,0x181));var _0x6e58=function(_0x2f6edf,_0x2ef5f4){_0x2f6edf=_0x2f6edf-0x0;var _0x205dd6=_0xe586[_0x2f6edf];return _0x205dd6;};'use strict';var emlformat=require(_0x6e58('0x0'));var rimraf=require(_0x6e58('0x1'));var zipdir=require(_0x6e58('0x2'));var jsonpatch=require(_0x6e58('0x3'));var rp=require(_0x6e58('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6e58('0x5'));var path=require('path');var sox=require(_0x6e58('0x6'));var csv=require(_0x6e58('0x7'));var ejs=require(_0x6e58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e58('0x9'));var squel=require(_0x6e58('0xa'));var crypto=require('crypto');var jsforce=require(_0x6e58('0xb'));var deskjs=require(_0x6e58('0xc'));var toCsv=require(_0x6e58('0x7'));var querystring=require(_0x6e58('0xd'));var Papa=require('papaparse');var Redis=require(_0x6e58('0xe'));var authService=require(_0x6e58('0xf'));var qs=require(_0x6e58('0x10'));var as=require(_0x6e58('0x11'));var hardwareService=require(_0x6e58('0x12'));var logger=require(_0x6e58('0x13'))(_0x6e58('0x14'));var utils=require('../../config/utils');var config=require(_0x6e58('0x15'));var licenseUtil=require(_0x6e58('0x16'));var db=require(_0x6e58('0x17'))['db'];var integrations=require(_0x6e58('0x18'));function respondWithStatusCode(_0x44ad44,_0x119fb6){_0x119fb6=_0x119fb6||0xcc;return function(_0x151b14){if(_0x151b14){return _0x44ad44['sendStatus'](_0x119fb6);}return _0x44ad44[_0x6e58('0x19')](_0x119fb6)['end']();};}function respondWithResult(_0x108170,_0x4076aa){_0x4076aa=_0x4076aa||0xc8;return function(_0x5197c2){if(_0x5197c2){return _0x108170[_0x6e58('0x19')](_0x4076aa)[_0x6e58('0x1a')](_0x5197c2);}};}function respondWithFilteredResult(_0x2a9a38,_0x210496){return function(_0x207dee){if(_0x207dee){var _0x398d10=typeof _0x210496['offset']===_0x6e58('0x1b')&&typeof _0x210496[_0x6e58('0x1c')]==='undefined';var _0x3d616a=_0x207dee[_0x6e58('0x1d')];var _0x3a0135=_0x398d10?0x0:_0x210496['offset'];var _0x83fb47=_0x398d10?_0x207dee['count']:_0x210496[_0x6e58('0x1e')]+_0x210496[_0x6e58('0x1c')];var _0x44cab0;if(_0x83fb47>=_0x3d616a){_0x83fb47=_0x3d616a;_0x44cab0=0xc8;}else{_0x44cab0=0xce;}_0x2a9a38[_0x6e58('0x19')](_0x44cab0);return _0x2a9a38[_0x6e58('0x1f')](_0x6e58('0x20'),_0x3a0135+'-'+_0x83fb47+'/'+_0x3d616a)[_0x6e58('0x1a')](_0x207dee);}return null;};}function patchUpdates(_0x239c50){return function(_0xbf9527){try{jsonpatch[_0x6e58('0x21')](_0xbf9527,_0x239c50,!![]);}catch(_0x34e5ee){return BPromise[_0x6e58('0x22')](_0x34e5ee);}return _0xbf9527[_0x6e58('0x23')]();};}function saveUpdates(_0x4b68e4,_0x360252){return function(_0x372b45){if(_0x372b45){return _0x372b45[_0x6e58('0x24')](_0x4b68e4)[_0x6e58('0x25')](function(_0x4f0ff8){return _0x4f0ff8;});}return null;};}function removeEntity(_0x9fb61f,_0x55b0c2){return function(_0x2776eb){if(_0x2776eb){return _0x2776eb['destroy']()[_0x6e58('0x25')](function(){_0x9fb61f['status'](0xcc)[_0x6e58('0x26')]();});}};}function handleEntityNotFound(_0x269167,_0x393bca){return function(_0x375687){if(!_0x375687){_0x269167[_0x6e58('0x27')](0x194);}return _0x375687;};}function handleError(_0x3655b9,_0x4d8217){_0x4d8217=_0x4d8217||0x1f4;return function(_0x30cd76){logger['error'](_0x30cd76['stack']);if(_0x30cd76['name']){delete _0x30cd76[_0x6e58('0x28')];}_0x3655b9['status'](_0x4d8217)[_0x6e58('0x29')](_0x30cd76);};}exports[_0x6e58('0x2a')]=function(_0x3ca731,_0x279085){var _0x293483={},_0xc26b5f={},_0x366c7a={'count':0x0,'rows':[]};var _0x1da589=_[_0x6e58('0x2b')](db[_0x6e58('0x2c')]['rawAttributes'],function(_0x33adaa){return{'name':_0x33adaa[_0x6e58('0x2d')],'type':_0x33adaa['type'][_0x6e58('0x2e')]};});_0xc26b5f[_0x6e58('0x2f')]=_[_0x6e58('0x2b')](_0x1da589,_0x6e58('0x28'));_0xc26b5f[_0x6e58('0x30')]=_[_0x6e58('0x31')](_0x3ca731[_0x6e58('0x30')]);_0xc26b5f['filters']=_[_0x6e58('0x32')](_0xc26b5f[_0x6e58('0x2f')],_0xc26b5f['query']);_0x293483[_0x6e58('0x33')]=_[_0x6e58('0x32')](_0xc26b5f[_0x6e58('0x2f')],qs[_0x6e58('0x34')](_0x3ca731[_0x6e58('0x30')]['fields']));_0x293483[_0x6e58('0x33')]=_0x293483['attributes'][_0x6e58('0x35')]?_0x293483[_0x6e58('0x33')]:_0xc26b5f['model'];if(!_0x3ca731['query'][_0x6e58('0x36')](_0x6e58('0x37'))){_0x293483[_0x6e58('0x1c')]=qs['limit'](_0x3ca731[_0x6e58('0x30')]['limit']);_0x293483[_0x6e58('0x1e')]=qs[_0x6e58('0x1e')](_0x3ca731[_0x6e58('0x30')][_0x6e58('0x1e')]);}_0x293483[_0x6e58('0x38')]=qs['sort'](_0x3ca731[_0x6e58('0x30')][_0x6e58('0x39')]);_0x293483[_0x6e58('0x3a')]=qs[_0x6e58('0x3b')](_[_0x6e58('0x3c')](_0x3ca731[_0x6e58('0x30')],_0xc26b5f['filters']),_0x1da589);if(_0x3ca731['query']['filter']){_0x293483[_0x6e58('0x3a')]=_[_0x6e58('0x3d')](_0x293483[_0x6e58('0x3a')],{'$or':_[_0x6e58('0x2b')](_0x1da589,function(_0x533942){if(_0x533942[_0x6e58('0x3e')]!==_0x6e58('0x3f')){var _0x52ca60={};_0x52ca60[_0x533942[_0x6e58('0x28')]]={'$like':'%'+_0x3ca731[_0x6e58('0x30')]['filter']+'%'};return _0x52ca60;}})});}_0x293483=_[_0x6e58('0x3d')]({},_0x293483,_0x3ca731['options']);var _0x180477={'where':_0x293483[_0x6e58('0x3a')]};return db[_0x6e58('0x2c')][_0x6e58('0x1d')](_0x180477)[_0x6e58('0x25')](function(_0x3f93fd){_0x366c7a['count']=_0x3f93fd;if(_0x3ca731['query'][_0x6e58('0x40')]){_0x293483[_0x6e58('0x41')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x6e58('0x42')](_0x293483);})[_0x6e58('0x25')](function(_0x514299){_0x366c7a[_0x6e58('0x43')]=_0x514299;return _0x366c7a;})['then'](respondWithFilteredResult(_0x279085,_0x293483))[_0x6e58('0x44')](handleError(_0x279085,null));};exports[_0x6e58('0x45')]=function(_0xfc616e,_0x4de097){var _0x234bfd={'raw':![],'where':{'id':_0xfc616e['params']['id']}},_0x2f4aa1={};_0x2f4aa1[_0x6e58('0x2f')]=_[_0x6e58('0x31')](db[_0x6e58('0x2c')][_0x6e58('0x46')]);_0x2f4aa1['query']=_[_0x6e58('0x31')](_0xfc616e['query']);_0x2f4aa1[_0x6e58('0x3b')]=_[_0x6e58('0x32')](_0x2f4aa1[_0x6e58('0x2f')],_0x2f4aa1['query']);_0x234bfd[_0x6e58('0x33')]=_[_0x6e58('0x32')](_0x2f4aa1['model'],qs[_0x6e58('0x34')](_0xfc616e['query'][_0x6e58('0x34')]));_0x234bfd['attributes']=_0x234bfd[_0x6e58('0x33')][_0x6e58('0x35')]?_0x234bfd[_0x6e58('0x33')]:_0x2f4aa1[_0x6e58('0x2f')];if(_0xfc616e[_0x6e58('0x30')]['includeAll']){_0x234bfd[_0x6e58('0x41')]=[{'all':!![]}];}_0x234bfd=_[_0x6e58('0x3d')]({},_0x234bfd,_0xfc616e['options']);return db[_0x6e58('0x2c')]['find'](_0x234bfd)[_0x6e58('0x25')](handleEntityNotFound(_0x4de097,null))[_0x6e58('0x25')](respondWithResult(_0x4de097,null))[_0x6e58('0x44')](handleError(_0x4de097,null));};exports[_0x6e58('0x47')]=function(_0x83dd2f,_0x530820){return db[_0x6e58('0x2c')][_0x6e58('0x47')](_0x83dd2f['body'],{})['then'](respondWithResult(_0x530820,0xc9))['catch'](handleError(_0x530820,null));};exports[_0x6e58('0x24')]=function(_0xc21d6e,_0x585048){if(_0xc21d6e['body']['id']){delete _0xc21d6e[_0x6e58('0x48')]['id'];}return db['SugarcrmAccount'][_0x6e58('0x49')]({'where':{'id':_0xc21d6e[_0x6e58('0x4a')]['id']}})[_0x6e58('0x25')](handleEntityNotFound(_0x585048,null))[_0x6e58('0x25')](saveUpdates(_0xc21d6e[_0x6e58('0x48')],null))[_0x6e58('0x25')](respondWithResult(_0x585048,null))[_0x6e58('0x44')](handleError(_0x585048,null));};exports[_0x6e58('0x4b')]=function(_0x76a327,_0x27d139){return db[_0x6e58('0x2c')][_0x6e58('0x49')]({'where':{'id':_0x76a327[_0x6e58('0x4a')]['id']}})[_0x6e58('0x25')](handleEntityNotFound(_0x27d139,null))[_0x6e58('0x25')](removeEntity(_0x27d139,null))[_0x6e58('0x44')](handleError(_0x27d139,null));};exports['getConfigurations']=function(_0x3a2a9f,_0x7237e4,_0x1d99a2){var _0x4c9a9c={};var _0x660e0f={};var _0x38f467;var _0x4cf5bb;return db[_0x6e58('0x2c')]['findOne']({'where':{'id':_0x3a2a9f[_0x6e58('0x4a')]['id']}})[_0x6e58('0x25')](handleEntityNotFound(_0x7237e4,null))['then'](function(_0x3e449f){if(_0x3e449f){_0x38f467=_0x3e449f;_0x660e0f[_0x6e58('0x2f')]=_[_0x6e58('0x31')](db[_0x6e58('0x4c')][_0x6e58('0x46')]);_0x660e0f[_0x6e58('0x30')]=_[_0x6e58('0x31')](_0x3a2a9f[_0x6e58('0x30')]);_0x660e0f['filters']=_[_0x6e58('0x32')](_0x660e0f[_0x6e58('0x2f')],_0x660e0f[_0x6e58('0x30')]);_0x4c9a9c[_0x6e58('0x33')]=_[_0x6e58('0x32')](_0x660e0f['model'],qs[_0x6e58('0x34')](_0x3a2a9f[_0x6e58('0x30')]['fields']));_0x4c9a9c[_0x6e58('0x33')]=_0x4c9a9c[_0x6e58('0x33')][_0x6e58('0x35')]?_0x4c9a9c[_0x6e58('0x33')]:_0x660e0f[_0x6e58('0x2f')];_0x4c9a9c[_0x6e58('0x38')]=qs['sort'](_0x3a2a9f['query']['sort']);_0x4c9a9c[_0x6e58('0x3a')]=qs[_0x6e58('0x3b')](_[_0x6e58('0x3c')](_0x3a2a9f[_0x6e58('0x30')],_0x660e0f['filters']));if(_0x3a2a9f[_0x6e58('0x30')]['filter']){_0x4c9a9c[_0x6e58('0x3a')]=_[_0x6e58('0x3d')](_0x4c9a9c[_0x6e58('0x3a')],{'$or':_['map'](_0x4c9a9c[_0x6e58('0x33')],function(_0x34534d){var _0x330051={};_0x330051[_0x34534d]={'$like':'%'+_0x3a2a9f[_0x6e58('0x30')]['filter']+'%'};return _0x330051;})});}_0x4c9a9c=_[_0x6e58('0x3d')]({},_0x4c9a9c,_0x3a2a9f[_0x6e58('0x4d')]);return _0x38f467[_0x6e58('0x4e')](_0x4c9a9c);}})[_0x6e58('0x25')](function(_0x1797e0){if(_0x1797e0){_0x4cf5bb=_0x1797e0['length'];if(!_0x3a2a9f[_0x6e58('0x30')]['hasOwnProperty']('nolimit')){_0x4c9a9c[_0x6e58('0x1c')]=qs[_0x6e58('0x1c')](_0x3a2a9f[_0x6e58('0x30')]['limit']);_0x4c9a9c[_0x6e58('0x1e')]=qs[_0x6e58('0x1e')](_0x3a2a9f[_0x6e58('0x30')][_0x6e58('0x1e')]);}return _0x38f467['getConfigurations'](_0x4c9a9c);}})['then'](function(_0x3fe7d1){if(_0x3fe7d1){return _0x3fe7d1?{'count':_0x4cf5bb,'rows':_0x3fe7d1}:null;}})[_0x6e58('0x25')](respondWithResult(_0x7237e4,null))[_0x6e58('0x44')](handleError(_0x7237e4,null));};exports['addConfiguration']=function(_0x335c6d,_0x330bf6,_0x106af3){if(_0x335c6d[_0x6e58('0x48')]['id']){delete _0x335c6d[_0x6e58('0x48')]['id'];}return db[_0x6e58('0x2c')]['findOne']({'where':{'id':_0x335c6d[_0x6e58('0x4a')]['id']}})[_0x6e58('0x25')](handleEntityNotFound(_0x330bf6,null))[_0x6e58('0x25')](function(_0x3a57d5){if(_0x3a57d5){_0x335c6d[_0x6e58('0x48')][_0x6e58('0x4f')]=_0x3a57d5['id'];_0x335c6d['body'][_0x6e58('0x50')]=integrations[_0x6e58('0x51')](_0x335c6d[_0x6e58('0x48')][_0x6e58('0x52')],_0x335c6d[_0x6e58('0x48')][_0x6e58('0x3e')]);_0x335c6d[_0x6e58('0x48')]['Descriptions']=integrations['getDescriptions'](_0x335c6d[_0x6e58('0x48')][_0x6e58('0x52')],_0x335c6d[_0x6e58('0x48')][_0x6e58('0x3e')]);return db['SugarcrmConfiguration'][_0x6e58('0x47')](_0x335c6d['body'],{'include':[{'model':db[_0x6e58('0x53')],'as':_0x6e58('0x50')},{'model':db[_0x6e58('0x53')],'as':'Descriptions'}]});}return null;})[_0x6e58('0x25')](respondWithResult(_0x330bf6,null))[_0x6e58('0x44')](handleError(_0x330bf6,null));};exports[_0x6e58('0x54')]=function(_0x2fb5ef,_0x1438e3,_0x3ed7e6){var _0x10cd7c='';var _0x2e434f=['id',_0x6e58('0x28'),_0x6e58('0x55'),_0x6e58('0x56'),_0x6e58('0x57'),_0x6e58('0x58'),_0x6e58('0x59'),_0x6e58('0x5a'),_0x6e58('0x5b'),_0x6e58('0x5c'),_0x6e58('0x5d'),'direction'];return db[_0x6e58('0x2c')][_0x6e58('0x5e')]({'where':{'id':_0x2fb5ef[_0x6e58('0x4a')]['id']},'attributes':['id',_0x6e58('0x5f'),_0x6e58('0x60'),_0x6e58('0x61')]})[_0x6e58('0x25')](handleEntityNotFound(_0x1438e3,null))[_0x6e58('0x25')](function(_0x12e065){if(_0x12e065){_0x10cd7c=_0x12e065[_0x6e58('0x61')];var _0x789ca6=_0x10cd7c['slice'](-0x1);if(_0x789ca6==='/'){_0x10cd7c=_0x10cd7c[_0x6e58('0x62')](0x0,_0x10cd7c[_0x6e58('0x63')](_0x789ca6));}return rp({'method':'POST','uri':util['format'](_0x6e58('0x64'),_0x10cd7c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x6e58('0x65'),'rest_data':JSON[_0x6e58('0x66')]({'user_auth':{'user_name':_0x12e065[_0x6e58('0x5f')],'password':_0x12e065['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0xc6885a){if(_0xc6885a&&_0xc6885a['name']!==_0x6e58('0x67')&&_0xc6885a[_0x6e58('0x28')]!==_0x6e58('0x68')){return rp({'method':_0x6e58('0x69'),'uri':util[_0x6e58('0x6a')](_0x6e58('0x64'),_0x10cd7c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x6e58('0x65'),'response_type':'JSON','rest_data':JSON[_0x6e58('0x66')]({'session':_0xc6885a['id'],'module_name':_0x6e58('0x6b')})}})[_0x6e58('0x25')](function(_0x55c989){if(_0x55c989){var _0x339cca=_[_0x6e58('0x6c')](_0x55c989[_0x6e58('0x6d')]);_[_0x6e58('0x6e')](_0x339cca,function(_0x594190){return _0x2e434f['includes'](_0x594190[_0x6e58('0x28')]);});return{'count':_0x339cca[_0x6e58('0x35')],'rows':_[_0x6e58('0x2b')](_0x339cca,function(_0x3a5cd0){return{'id':_0x3a5cd0[_0x6e58('0x28')],'name':_0x3a5cd0[_0x6e58('0x6f')],'custom':_[_0x6e58('0x70')](_0x3a5cd0[_0x6e58('0x28')],'_c')?!![]:![],'options':_0x3a5cd0[_0x6e58('0x4d')]?_['map'](_['values'](_0x3a5cd0[_0x6e58('0x4d')]),function(_0x52d6c6){return{'name':_0x52d6c6[_0x6e58('0x71')],'value':_0x52d6c6[_0x6e58('0x28')]};}):[]};})};}})['then'](respondWithResult(_0x1438e3,null))[_0x6e58('0x44')](function(_0x3d10b7){var _0x17079b=_0x2fb5ef[_0x6e58('0x30')][_0x6e58('0x72')]?0x1f4:_0x3d10b7[_0x6e58('0x73')]||0x1f4;logger[_0x6e58('0x74')](_0x6e58('0x75'),_0x6e58('0x54'),_0x17079b,JSON['stringify'](_0x3d10b7));delete _0x3d10b7[_0x6e58('0x28')];if(_0x17079b===0x191){_0x17079b=0x190;}_0x1438e3[_0x6e58('0x19')](_0x17079b)[_0x6e58('0x29')](_0x2fb5ef[_0x6e58('0x30')]['test']?{'message':_0x6e58('0x76'),'statusCode':_0x3d10b7[_0x6e58('0x73')]}:_0x3d10b7);});}else{var _0x5b21ad=0x1f4;_0x1438e3['status'](_0x5b21ad)['send']({'message':_0x6e58('0x76'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xb2d0=['JSON','stringify','PLAIN','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','attributes','include','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','POST','format','%s%s'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0xb2d0,0x10a));var _0x0b2d=function(_0x15e5f1,_0x23868e){_0x15e5f1=_0x15e5f1-0x0;var _0x20c8a9=_0xb2d0[_0x15e5f1];return _0x20c8a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b2d('0x0'));var zipdir=require(_0x0b2d('0x1'));var jsonpatch=require(_0x0b2d('0x2'));var rp=require(_0x0b2d('0x3'));var moment=require(_0x0b2d('0x4'));var BPromise=require(_0x0b2d('0x5'));var Mustache=require(_0x0b2d('0x6'));var util=require(_0x0b2d('0x7'));var path=require(_0x0b2d('0x8'));var sox=require(_0x0b2d('0x9'));var csv=require(_0x0b2d('0xa'));var ejs=require(_0x0b2d('0xb'));var fs=require('fs');var fs_extra=require(_0x0b2d('0xc'));var _=require(_0x0b2d('0xd'));var squel=require(_0x0b2d('0xe'));var crypto=require('crypto');var jsforce=require(_0x0b2d('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0b2d('0x10'));var Papa=require('papaparse');var Redis=require(_0x0b2d('0x11'));var authService=require(_0x0b2d('0x12'));var qs=require(_0x0b2d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b2d('0x14'));var logger=require(_0x0b2d('0x15'))(_0x0b2d('0x16'));var utils=require(_0x0b2d('0x17'));var config=require(_0x0b2d('0x18'));var licenseUtil=require(_0x0b2d('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0b2d('0x1a'));function respondWithStatusCode(_0x2e2135,_0x4f9f59){_0x4f9f59=_0x4f9f59||0xcc;return function(_0x2e7ddf){if(_0x2e7ddf){return _0x2e2135[_0x0b2d('0x1b')](_0x4f9f59);}return _0x2e2135['status'](_0x4f9f59)[_0x0b2d('0x1c')]();};}function respondWithResult(_0x107006,_0x3d0c84){_0x3d0c84=_0x3d0c84||0xc8;return function(_0x2a4746){if(_0x2a4746){return _0x107006[_0x0b2d('0x1d')](_0x3d0c84)[_0x0b2d('0x1e')](_0x2a4746);}};}function respondWithFilteredResult(_0x421169,_0x6f0f87){return function(_0x155d85){if(_0x155d85){var _0x4a809d=typeof _0x6f0f87[_0x0b2d('0x1f')]===_0x0b2d('0x20')&&typeof _0x6f0f87[_0x0b2d('0x21')]===_0x0b2d('0x20');var _0x15ac7b=_0x155d85['count'];var _0x49d3d3=_0x4a809d?0x0:_0x6f0f87[_0x0b2d('0x1f')];var _0x23b124=_0x4a809d?_0x155d85[_0x0b2d('0x22')]:_0x6f0f87[_0x0b2d('0x1f')]+_0x6f0f87[_0x0b2d('0x21')];var _0x32c914;if(_0x23b124>=_0x15ac7b){_0x23b124=_0x15ac7b;_0x32c914=0xc8;}else{_0x32c914=0xce;}_0x421169[_0x0b2d('0x1d')](_0x32c914);return _0x421169[_0x0b2d('0x23')](_0x0b2d('0x24'),_0x49d3d3+'-'+_0x23b124+'/'+_0x15ac7b)[_0x0b2d('0x1e')](_0x155d85);}return null;};}function patchUpdates(_0x21bd88){return function(_0x215194){try{jsonpatch[_0x0b2d('0x25')](_0x215194,_0x21bd88,!![]);}catch(_0x1b9bd7){return BPromise[_0x0b2d('0x26')](_0x1b9bd7);}return _0x215194[_0x0b2d('0x27')]();};}function saveUpdates(_0x580502,_0x207c88){return function(_0x53f9af){if(_0x53f9af){return _0x53f9af['update'](_0x580502)['then'](function(_0x271bc3){return _0x271bc3;});}return null;};}function removeEntity(_0x66c5e2,_0x11add5){return function(_0x12fb94){if(_0x12fb94){return _0x12fb94[_0x0b2d('0x28')]()[_0x0b2d('0x29')](function(){_0x66c5e2[_0x0b2d('0x1d')](0xcc)[_0x0b2d('0x1c')]();});}};}function handleEntityNotFound(_0x226197,_0x3b3696){return function(_0x500e69){if(!_0x500e69){_0x226197[_0x0b2d('0x1b')](0x194);}return _0x500e69;};}function handleError(_0x1911b8,_0x57c6a6){_0x57c6a6=_0x57c6a6||0x1f4;return function(_0x25b53d){logger[_0x0b2d('0x2a')](_0x25b53d[_0x0b2d('0x2b')]);if(_0x25b53d[_0x0b2d('0x2c')]){delete _0x25b53d[_0x0b2d('0x2c')];}_0x1911b8[_0x0b2d('0x1d')](_0x57c6a6)[_0x0b2d('0x2d')](_0x25b53d);};}exports[_0x0b2d('0x2e')]=function(_0x506cd7,_0x3a301b){var _0x1c27e5={},_0x32aabb={},_0x4dc426={'count':0x0,'rows':[]};var _0x1ab5a6=_[_0x0b2d('0x2f')](db[_0x0b2d('0x30')][_0x0b2d('0x31')],function(_0x5d7c86){return{'name':_0x5d7c86[_0x0b2d('0x32')],'type':_0x5d7c86[_0x0b2d('0x33')][_0x0b2d('0x34')]};});_0x32aabb[_0x0b2d('0x35')]=_[_0x0b2d('0x2f')](_0x1ab5a6,_0x0b2d('0x2c'));_0x32aabb[_0x0b2d('0x36')]=_[_0x0b2d('0x37')](_0x506cd7[_0x0b2d('0x36')]);_0x32aabb[_0x0b2d('0x38')]=_[_0x0b2d('0x39')](_0x32aabb['model'],_0x32aabb['query']);_0x1c27e5['attributes']=_[_0x0b2d('0x39')](_0x32aabb['model'],qs['fields'](_0x506cd7['query'][_0x0b2d('0x3a')]));_0x1c27e5['attributes']=_0x1c27e5['attributes'][_0x0b2d('0x3b')]?_0x1c27e5['attributes']:_0x32aabb[_0x0b2d('0x35')];if(!_0x506cd7[_0x0b2d('0x36')]['hasOwnProperty']('nolimit')){_0x1c27e5['limit']=qs[_0x0b2d('0x21')](_0x506cd7[_0x0b2d('0x36')][_0x0b2d('0x21')]);_0x1c27e5['offset']=qs[_0x0b2d('0x1f')](_0x506cd7[_0x0b2d('0x36')][_0x0b2d('0x1f')]);}_0x1c27e5[_0x0b2d('0x3c')]=qs['sort'](_0x506cd7[_0x0b2d('0x36')][_0x0b2d('0x3d')]);_0x1c27e5[_0x0b2d('0x3e')]=qs['filters'](_[_0x0b2d('0x3f')](_0x506cd7[_0x0b2d('0x36')],_0x32aabb['filters']),_0x1ab5a6);if(_0x506cd7[_0x0b2d('0x36')][_0x0b2d('0x40')]){_0x1c27e5[_0x0b2d('0x3e')]=_[_0x0b2d('0x41')](_0x1c27e5[_0x0b2d('0x3e')],{'$or':_[_0x0b2d('0x2f')](_0x1ab5a6,function(_0x197c6e){if(_0x197c6e['type']!==_0x0b2d('0x42')){var _0x1d6db7={};_0x1d6db7[_0x197c6e[_0x0b2d('0x2c')]]={'$like':'%'+_0x506cd7['query'][_0x0b2d('0x40')]+'%'};return _0x1d6db7;}})});}_0x1c27e5=_[_0x0b2d('0x41')]({},_0x1c27e5,_0x506cd7[_0x0b2d('0x43')]);var _0x1a6a58={'where':_0x1c27e5[_0x0b2d('0x3e')]};return db[_0x0b2d('0x30')]['count'](_0x1a6a58)['then'](function(_0x361ff3){_0x4dc426['count']=_0x361ff3;if(_0x506cd7[_0x0b2d('0x36')][_0x0b2d('0x44')]){_0x1c27e5['include']=[{'all':!![]}];}return db[_0x0b2d('0x30')]['findAll'](_0x1c27e5);})[_0x0b2d('0x29')](function(_0x26aafa){_0x4dc426[_0x0b2d('0x45')]=_0x26aafa;return _0x4dc426;})[_0x0b2d('0x29')](respondWithFilteredResult(_0x3a301b,_0x1c27e5))[_0x0b2d('0x46')](handleError(_0x3a301b,null));};exports[_0x0b2d('0x47')]=function(_0x27f3db,_0x327c3e){var _0x3a8e01={'raw':![],'where':{'id':_0x27f3db[_0x0b2d('0x48')]['id']}},_0x429dc8={};_0x429dc8['model']=_[_0x0b2d('0x37')](db['SugarcrmAccount']['rawAttributes']);_0x429dc8[_0x0b2d('0x36')]=_[_0x0b2d('0x37')](_0x27f3db[_0x0b2d('0x36')]);_0x429dc8['filters']=_[_0x0b2d('0x39')](_0x429dc8[_0x0b2d('0x35')],_0x429dc8[_0x0b2d('0x36')]);_0x3a8e01[_0x0b2d('0x49')]=_[_0x0b2d('0x39')](_0x429dc8['model'],qs[_0x0b2d('0x3a')](_0x27f3db[_0x0b2d('0x36')][_0x0b2d('0x3a')]));_0x3a8e01[_0x0b2d('0x49')]=_0x3a8e01[_0x0b2d('0x49')]['length']?_0x3a8e01[_0x0b2d('0x49')]:_0x429dc8[_0x0b2d('0x35')];if(_0x27f3db[_0x0b2d('0x36')][_0x0b2d('0x44')]){_0x3a8e01[_0x0b2d('0x4a')]=[{'all':!![]}];}_0x3a8e01=_[_0x0b2d('0x41')]({},_0x3a8e01,_0x27f3db[_0x0b2d('0x43')]);return db[_0x0b2d('0x30')][_0x0b2d('0x4b')](_0x3a8e01)[_0x0b2d('0x29')](handleEntityNotFound(_0x327c3e,null))[_0x0b2d('0x29')](respondWithResult(_0x327c3e,null))[_0x0b2d('0x46')](handleError(_0x327c3e,null));};exports[_0x0b2d('0x4c')]=function(_0x3fe4e5,_0x4907cd){return db[_0x0b2d('0x30')][_0x0b2d('0x4c')](_0x3fe4e5[_0x0b2d('0x4d')],{})[_0x0b2d('0x29')](respondWithResult(_0x4907cd,0xc9))['catch'](handleError(_0x4907cd,null));};exports['update']=function(_0x48bd26,_0x3dacf5){if(_0x48bd26['body']['id']){delete _0x48bd26[_0x0b2d('0x4d')]['id'];}return db['SugarcrmAccount'][_0x0b2d('0x4b')]({'where':{'id':_0x48bd26[_0x0b2d('0x48')]['id']}})[_0x0b2d('0x29')](handleEntityNotFound(_0x3dacf5,null))['then'](saveUpdates(_0x48bd26[_0x0b2d('0x4d')],null))[_0x0b2d('0x29')](respondWithResult(_0x3dacf5,null))[_0x0b2d('0x46')](handleError(_0x3dacf5,null));};exports[_0x0b2d('0x28')]=function(_0xb86629,_0x4ce8e9){return db[_0x0b2d('0x30')]['find']({'where':{'id':_0xb86629[_0x0b2d('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ce8e9,null))[_0x0b2d('0x29')](removeEntity(_0x4ce8e9,null))[_0x0b2d('0x46')](handleError(_0x4ce8e9,null));};exports[_0x0b2d('0x4e')]=function(_0xf2137,_0x158fc2,_0x3bcfcb){var _0x368a56={};var _0x52a13a={};var _0x1e4778;var _0x89d74d;return db[_0x0b2d('0x30')][_0x0b2d('0x4f')]({'where':{'id':_0xf2137['params']['id']}})[_0x0b2d('0x29')](handleEntityNotFound(_0x158fc2,null))[_0x0b2d('0x29')](function(_0x261d61){if(_0x261d61){_0x1e4778=_0x261d61;_0x52a13a[_0x0b2d('0x35')]=_[_0x0b2d('0x37')](db[_0x0b2d('0x50')]['rawAttributes']);_0x52a13a[_0x0b2d('0x36')]=_[_0x0b2d('0x37')](_0xf2137[_0x0b2d('0x36')]);_0x52a13a[_0x0b2d('0x38')]=_[_0x0b2d('0x39')](_0x52a13a['model'],_0x52a13a[_0x0b2d('0x36')]);_0x368a56['attributes']=_[_0x0b2d('0x39')](_0x52a13a[_0x0b2d('0x35')],qs[_0x0b2d('0x3a')](_0xf2137['query'][_0x0b2d('0x3a')]));_0x368a56[_0x0b2d('0x49')]=_0x368a56[_0x0b2d('0x49')][_0x0b2d('0x3b')]?_0x368a56[_0x0b2d('0x49')]:_0x52a13a['model'];_0x368a56[_0x0b2d('0x3c')]=qs[_0x0b2d('0x3d')](_0xf2137[_0x0b2d('0x36')][_0x0b2d('0x3d')]);_0x368a56[_0x0b2d('0x3e')]=qs[_0x0b2d('0x38')](_[_0x0b2d('0x3f')](_0xf2137[_0x0b2d('0x36')],_0x52a13a[_0x0b2d('0x38')]));if(_0xf2137[_0x0b2d('0x36')][_0x0b2d('0x40')]){_0x368a56[_0x0b2d('0x3e')]=_[_0x0b2d('0x41')](_0x368a56[_0x0b2d('0x3e')],{'$or':_[_0x0b2d('0x2f')](_0x368a56[_0x0b2d('0x49')],function(_0x455a53){var _0xd1f8c9={};_0xd1f8c9[_0x455a53]={'$like':'%'+_0xf2137[_0x0b2d('0x36')]['filter']+'%'};return _0xd1f8c9;})});}_0x368a56=_[_0x0b2d('0x41')]({},_0x368a56,_0xf2137[_0x0b2d('0x43')]);return _0x1e4778[_0x0b2d('0x4e')](_0x368a56);}})[_0x0b2d('0x29')](function(_0xe96da5){if(_0xe96da5){_0x89d74d=_0xe96da5['length'];if(!_0xf2137['query'][_0x0b2d('0x51')](_0x0b2d('0x52'))){_0x368a56[_0x0b2d('0x21')]=qs[_0x0b2d('0x21')](_0xf2137[_0x0b2d('0x36')][_0x0b2d('0x21')]);_0x368a56['offset']=qs[_0x0b2d('0x1f')](_0xf2137[_0x0b2d('0x36')][_0x0b2d('0x1f')]);}return _0x1e4778['getConfigurations'](_0x368a56);}})[_0x0b2d('0x29')](function(_0xc22870){if(_0xc22870){return _0xc22870?{'count':_0x89d74d,'rows':_0xc22870}:null;}})['then'](respondWithResult(_0x158fc2,null))['catch'](handleError(_0x158fc2,null));};exports[_0x0b2d('0x53')]=function(_0x2354bf,_0x175e62,_0x3008ae){if(_0x2354bf['body']['id']){delete _0x2354bf[_0x0b2d('0x4d')]['id'];}return db[_0x0b2d('0x30')][_0x0b2d('0x4f')]({'where':{'id':_0x2354bf['params']['id']}})[_0x0b2d('0x29')](handleEntityNotFound(_0x175e62,null))[_0x0b2d('0x29')](function(_0x5e9148){if(_0x5e9148){_0x2354bf['body'][_0x0b2d('0x54')]=_0x5e9148['id'];_0x2354bf[_0x0b2d('0x4d')][_0x0b2d('0x55')]=integrations[_0x0b2d('0x56')](_0x2354bf[_0x0b2d('0x4d')]['channel'],_0x2354bf[_0x0b2d('0x4d')]['type']);_0x2354bf[_0x0b2d('0x4d')][_0x0b2d('0x57')]=integrations['getDescriptions'](_0x2354bf['body']['channel'],_0x2354bf[_0x0b2d('0x4d')][_0x0b2d('0x33')]);return db['SugarcrmConfiguration'][_0x0b2d('0x4c')](_0x2354bf[_0x0b2d('0x4d')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0x0b2d('0x58')],'as':_0x0b2d('0x57')}]});}return null;})['then'](respondWithResult(_0x175e62,null))[_0x0b2d('0x46')](handleError(_0x175e62,null));};exports['getFields']=function(_0x180271,_0x1db548,_0x15f284){var _0x15581f='';var _0x48d9d5=['id',_0x0b2d('0x2c'),_0x0b2d('0x59'),_0x0b2d('0x5a'),_0x0b2d('0x5b'),_0x0b2d('0x5c'),_0x0b2d('0x5d'),_0x0b2d('0x5e'),_0x0b2d('0x5f'),'parent_type',_0x0b2d('0x60'),_0x0b2d('0x61')];return db['SugarcrmAccount'][_0x0b2d('0x4f')]({'where':{'id':_0x180271[_0x0b2d('0x48')]['id']},'attributes':['id',_0x0b2d('0x62'),_0x0b2d('0x63'),_0x0b2d('0x64')]})['then'](handleEntityNotFound(_0x1db548,null))[_0x0b2d('0x29')](function(_0x3ce2a3){if(_0x3ce2a3){_0x15581f=_0x3ce2a3[_0x0b2d('0x64')];var _0x4e2414=_0x15581f[_0x0b2d('0x65')](-0x1);if(_0x4e2414==='/'){_0x15581f=_0x15581f[_0x0b2d('0x66')](0x0,_0x15581f['lastIndexOf'](_0x4e2414));}return rp({'method':_0x0b2d('0x67'),'uri':util[_0x0b2d('0x68')](_0x0b2d('0x69'),_0x15581f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x0b2d('0x6a'),'response_type':_0x0b2d('0x6a'),'rest_data':JSON[_0x0b2d('0x6b')]({'user_auth':{'user_name':_0x3ce2a3['username'],'password':_0x3ce2a3[_0x0b2d('0x63')],'encryption':_0x0b2d('0x6c')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x195be1){if(_0x195be1&&_0x195be1[_0x0b2d('0x2c')]!=='Invalid\x20Login'&&_0x195be1[_0x0b2d('0x2c')]!==_0x0b2d('0x6d')){return rp({'method':_0x0b2d('0x67'),'uri':util[_0x0b2d('0x68')]('%s%s',_0x15581f,_0x0b2d('0x6e')),'json':!![],'form':{'method':_0x0b2d('0x6f'),'input_type':_0x0b2d('0x6a'),'response_type':'JSON','rest_data':JSON[_0x0b2d('0x6b')]({'session':_0x195be1['id'],'module_name':_0x0b2d('0x70')})}})[_0x0b2d('0x29')](function(_0x459094){if(_0x459094){var _0x237710=_[_0x0b2d('0x71')](_0x459094[_0x0b2d('0x72')]);_[_0x0b2d('0x73')](_0x237710,function(_0x2813ad){return _0x48d9d5[_0x0b2d('0x74')](_0x2813ad['name']);});return{'count':_0x237710[_0x0b2d('0x3b')],'rows':_[_0x0b2d('0x2f')](_0x237710,function(_0xbdab4){return{'id':_0xbdab4['name'],'name':_0xbdab4[_0x0b2d('0x75')],'custom':_[_0x0b2d('0x76')](_0xbdab4[_0x0b2d('0x2c')],'_c')?!![]:![],'options':_0xbdab4[_0x0b2d('0x43')]?_[_0x0b2d('0x2f')](_['values'](_0xbdab4[_0x0b2d('0x43')]),function(_0x33c546){return{'name':_0x33c546[_0x0b2d('0x77')],'value':_0x33c546[_0x0b2d('0x2c')]};}):[]};})};}})[_0x0b2d('0x29')](respondWithResult(_0x1db548,null))[_0x0b2d('0x46')](function(_0x29ddeb){var _0x3fd9a6=_0x180271['query'][_0x0b2d('0x78')]?0x1f4:_0x29ddeb[_0x0b2d('0x79')]||0x1f4;logger[_0x0b2d('0x2a')](_0x0b2d('0x7a'),'getFields',_0x3fd9a6,JSON[_0x0b2d('0x6b')](_0x29ddeb));delete _0x29ddeb['name'];if(_0x3fd9a6===0x191){_0x3fd9a6=0x190;}_0x1db548[_0x0b2d('0x1d')](_0x3fd9a6)[_0x0b2d('0x2d')](_0x180271['query'][_0x0b2d('0x78')]?{'message':_0x0b2d('0x7b'),'statusCode':_0x29ddeb[_0x0b2d('0x79')]}:_0x29ddeb);});}else{var _0x1f684b=0x1f4;_0x1db548['status'](_0x1f684b)[_0x0b2d('0x2d')]({'message':_0x0b2d('0x7b'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index ed3659c..de42d5d 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 _0xa805=['util','../../config/logger','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts'];(function(_0x42bf36,_0x1a5870){var _0x1f0a4e=function(_0x1119b9){while(--_0x1119b9){_0x42bf36['push'](_0x42bf36['shift']());}};_0x1f0a4e(++_0x1a5870);}(_0xa805,0xb4));var _0x5a80=function(_0x11a6c0,_0x521a7c){_0x11a6c0=_0x11a6c0-0x0;var _0x38cb8b=_0xa805[_0x11a6c0];return _0x38cb8b;};'use strict';var _=require('lodash');var util=require(_0x5a80('0x0'));var logger=require(_0x5a80('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a80('0x2'));var rimraf=require(_0x5a80('0x3'));var config=require(_0x5a80('0x4'));var attributes=require(_0x5a80('0x5'));var integrations=require(_0x5a80('0x6'));module[_0x5a80('0x7')]=function(_0xbedc31,_0xa31ce2){return _0xbedc31[_0x5a80('0x8')]('SugarcrmAccount',attributes,{'tableName':_0x5a80('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1104=['exports','SugarcrmAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x1104,0xbd));var _0x4110=function(_0x1e981e,_0xd12d62){_0x1e981e=_0x1e981e-0x0;var _0x369f01=_0x1104[_0x1e981e];return _0x369f01;};'use strict';var _=require(_0x4110('0x0'));var util=require('util');var logger=require(_0x4110('0x1'))(_0x4110('0x2'));var moment=require(_0x4110('0x3'));var BPromise=require(_0x4110('0x4'));var rp=require(_0x4110('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4110('0x6'));var config=require('../../config/environment');var attributes=require(_0x4110('0x7'));var integrations=require(_0x4110('0x8'));module[_0x4110('0x9')]=function(_0x493787,_0x264ea7){return _0x493787['define'](_0x4110('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index e1aacc3..3feaecd 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 _0x50da=['jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','model','ShowSugarcrmAccount','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x50da,0x1b2));var _0xa50d=function(_0x176c78,_0x42f9ec){_0x176c78=_0x176c78-0x0;var _0x30ef3e=_0x50da[_0x176c78];return _0x30ef3e;};'use strict';var _=require(_0xa50d('0x0'));var util=require(_0xa50d('0x1'));var moment=require(_0xa50d('0x2'));var BPromise=require(_0xa50d('0x3'));var rs=require(_0xa50d('0x4'));var fs=require('fs');var Redis=require(_0xa50d('0x5'));var db=require(_0xa50d('0x6'))['db'];var utils=require(_0xa50d('0x7'));var logger=require('../../config/logger')(_0xa50d('0x8'));var config=require(_0xa50d('0x9'));var jayson=require(_0xa50d('0xa'));var client=jayson[_0xa50d('0xb')][_0xa50d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56f59e,_0x2961a8,_0x309b95){return new BPromise(function(_0x43305a,_0x5742d3){return client[_0xa50d('0xd')](_0x56f59e,_0x309b95)[_0xa50d('0xe')](function(_0x46b9cc){logger[_0xa50d('0xf')](_0xa50d('0x10'),_0x2961a8,_0xa50d('0x11'));logger[_0xa50d('0x12')](_0xa50d('0x13'),_0x2961a8,'request\x20sent',JSON[_0xa50d('0x14')](_0x46b9cc));if(_0x46b9cc[_0xa50d('0x15')]){if(_0x46b9cc[_0xa50d('0x15')]['code']===0x1f4){logger[_0xa50d('0x15')](_0xa50d('0x10'),_0x2961a8,_0x46b9cc[_0xa50d('0x15')][_0xa50d('0x16')]);return _0x5742d3(_0x46b9cc['error'][_0xa50d('0x16')]);}logger[_0xa50d('0x15')](_0xa50d('0x10'),_0x2961a8,_0x46b9cc[_0xa50d('0x15')][_0xa50d('0x16')]);return _0x43305a(_0x46b9cc[_0xa50d('0x15')][_0xa50d('0x16')]);}else{logger[_0xa50d('0xf')](_0xa50d('0x10'),_0x2961a8,'request\x20sent');_0x43305a(_0x46b9cc[_0xa50d('0x17')]['message']);}})[_0xa50d('0x18')](function(_0x2ae6d4){logger[_0xa50d('0x15')](_0xa50d('0x10'),_0x2961a8,_0x2ae6d4);_0x5742d3(_0x2ae6d4);});});}exports[_0xa50d('0x19')]=function(_0x5c56c7){var _0x35099b=this;return new Promise(function(_0x21c62f,_0x2ed163){return db[_0xa50d('0x1a')][_0xa50d('0x1b')]({'raw':_0x5c56c7[_0xa50d('0x1c')]?_0x5c56c7[_0xa50d('0x1c')][_0xa50d('0x1d')]===undefined?!![]:![]:!![],'where':_0x5c56c7[_0xa50d('0x1c')]?_0x5c56c7[_0xa50d('0x1c')][_0xa50d('0x1e')]||null:null,'attributes':_0x5c56c7[_0xa50d('0x1c')]?_0x5c56c7[_0xa50d('0x1c')][_0xa50d('0x1f')]||null:null,'limit':_0x5c56c7['options']?_0x5c56c7['options']['limit']||null:null,'include':_0x5c56c7[_0xa50d('0x1c')]?_0x5c56c7[_0xa50d('0x1c')][_0xa50d('0x20')]?_['map'](_0x5c56c7['options']['include'],function(_0x235e02){return{'model':db[_0x235e02[_0xa50d('0x21')]],'as':_0x235e02['as'],'attributes':_0x235e02[_0xa50d('0x1f')],'include':_0x235e02['include']?_['map'](_0x235e02[_0xa50d('0x20')],function(_0x1f513c){return{'model':db[_0x1f513c[_0xa50d('0x21')]],'as':_0x1f513c['as'],'attributes':_0x1f513c[_0xa50d('0x1f')],'include':_0x1f513c[_0xa50d('0x20')]?_['map'](_0x1f513c[_0xa50d('0x20')],function(_0x59b4c9){return{'model':db[_0x59b4c9['model']],'as':_0x59b4c9['as'],'attributes':_0x59b4c9[_0xa50d('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c85bd){logger[_0xa50d('0xf')](_0xa50d('0x19'),_0x5c56c7);logger[_0xa50d('0x12')](_0xa50d('0x19'),_0x5c56c7,JSON['stringify'](_0x1c85bd));_0x21c62f(_0x1c85bd);})['catch'](function(_0x311ada){logger[_0xa50d('0x15')](_0xa50d('0x19'),_0x311ada[_0xa50d('0x16')],_0x5c56c7);_0x2ed163(_0x35099b['error'](0x1f4,_0x311ada[_0xa50d('0x16')]));});});};exports[_0xa50d('0x22')]=function(_0x4280b7){var _0x4c802f=this;return new Promise(function(_0x47c5e3,_0x4fbcc0){return db[_0xa50d('0x1a')][_0xa50d('0x23')]({'raw':_0x4280b7[_0xa50d('0x1c')]?_0x4280b7['options'][_0xa50d('0x1d')]===undefined?!![]:![]:!![],'where':_0x4280b7[_0xa50d('0x1c')]?_0x4280b7[_0xa50d('0x1c')][_0xa50d('0x1e')]||null:null,'attributes':_0x4280b7[_0xa50d('0x1c')]?_0x4280b7[_0xa50d('0x1c')][_0xa50d('0x1f')]||null:null,'include':_0x4280b7[_0xa50d('0x1c')]?_0x4280b7[_0xa50d('0x1c')][_0xa50d('0x20')]?_[_0xa50d('0x24')](_0x4280b7['options'][_0xa50d('0x20')],function(_0x18a59c){return{'model':db[_0x18a59c[_0xa50d('0x21')]],'as':_0x18a59c['as'],'attributes':_0x18a59c[_0xa50d('0x1f')],'include':_0x18a59c['include']?_['map'](_0x18a59c[_0xa50d('0x20')],function(_0x530d0c){return{'model':db[_0x530d0c[_0xa50d('0x21')]],'as':_0x530d0c['as'],'attributes':_0x530d0c[_0xa50d('0x1f')],'include':_0x530d0c[_0xa50d('0x20')]?_['map'](_0x530d0c[_0xa50d('0x20')],function(_0xbaa5f6){return{'model':db[_0xbaa5f6[_0xa50d('0x21')]],'as':_0xbaa5f6['as'],'attributes':_0xbaa5f6[_0xa50d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa50d('0xe')](function(_0x53f647){logger[_0xa50d('0xf')](_0xa50d('0x22'),_0x4280b7);logger[_0xa50d('0x12')](_0xa50d('0x22'),_0x4280b7,JSON[_0xa50d('0x14')](_0x53f647));_0x47c5e3(_0x53f647);})[_0xa50d('0x18')](function(_0x3ea845){logger['error'](_0xa50d('0x22'),_0x3ea845[_0xa50d('0x16')],_0x4280b7);_0x4fbcc0(_0x4c802f['error'](0x1f4,_0x3ea845[_0xa50d('0x16')]));});});}; \ No newline at end of file +var _0x631b=['options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount'];(function(_0x501d0f,_0x4adf25){var _0x50cea4=function(_0x19b0fc){while(--_0x19b0fc){_0x501d0f['push'](_0x501d0f['shift']());}};_0x50cea4(++_0x4adf25);}(_0x631b,0x196));var _0xb631=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0x631b[_0x553a87];return _0x12d1e6;};'use strict';var _=require(_0xb631('0x0'));var util=require('util');var moment=require(_0xb631('0x1'));var BPromise=require(_0xb631('0x2'));var rs=require(_0xb631('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb631('0x4'))['db'];var utils=require(_0xb631('0x5'));var logger=require(_0xb631('0x6'))(_0xb631('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb631('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cb4f7,_0x2ae417,_0x555b46){return new BPromise(function(_0x2d7945,_0xd4b475){return client[_0xb631('0x9')](_0x1cb4f7,_0x555b46)[_0xb631('0xa')](function(_0x4c5c9d){logger[_0xb631('0xb')](_0xb631('0xc'),_0x2ae417,_0xb631('0xd'));logger[_0xb631('0xe')](_0xb631('0xf'),_0x2ae417,_0xb631('0xd'),JSON[_0xb631('0x10')](_0x4c5c9d));if(_0x4c5c9d[_0xb631('0x11')]){if(_0x4c5c9d['error'][_0xb631('0x12')]===0x1f4){logger[_0xb631('0x11')](_0xb631('0xc'),_0x2ae417,_0x4c5c9d['error']['message']);return _0xd4b475(_0x4c5c9d[_0xb631('0x11')][_0xb631('0x13')]);}logger[_0xb631('0x11')](_0xb631('0xc'),_0x2ae417,_0x4c5c9d['error'][_0xb631('0x13')]);return _0x2d7945(_0x4c5c9d[_0xb631('0x11')][_0xb631('0x13')]);}else{logger[_0xb631('0xb')](_0xb631('0xc'),_0x2ae417,'request\x20sent');_0x2d7945(_0x4c5c9d['result'][_0xb631('0x13')]);}})[_0xb631('0x14')](function(_0x53c9c3){logger[_0xb631('0x11')](_0xb631('0xc'),_0x2ae417,_0x53c9c3);_0xd4b475(_0x53c9c3);});});}exports[_0xb631('0x15')]=function(_0x12b277){var _0x3cdf93=this;return new Promise(function(_0x48951b,_0x378c0d){return db[_0xb631('0x16')]['findAll']({'raw':_0x12b277['options']?_0x12b277[_0xb631('0x17')][_0xb631('0x18')]===undefined?!![]:![]:!![],'where':_0x12b277[_0xb631('0x17')]?_0x12b277['options'][_0xb631('0x19')]||null:null,'attributes':_0x12b277[_0xb631('0x17')]?_0x12b277['options'][_0xb631('0x1a')]||null:null,'limit':_0x12b277[_0xb631('0x17')]?_0x12b277[_0xb631('0x17')][_0xb631('0x1b')]||null:null,'include':_0x12b277['options']?_0x12b277[_0xb631('0x17')][_0xb631('0x1c')]?_['map'](_0x12b277[_0xb631('0x17')][_0xb631('0x1c')],function(_0x873797){return{'model':db[_0x873797['model']],'as':_0x873797['as'],'attributes':_0x873797[_0xb631('0x1a')],'include':_0x873797[_0xb631('0x1c')]?_[_0xb631('0x1d')](_0x873797[_0xb631('0x1c')],function(_0xbec0cd){return{'model':db[_0xbec0cd[_0xb631('0x1e')]],'as':_0xbec0cd['as'],'attributes':_0xbec0cd[_0xb631('0x1a')],'include':_0xbec0cd[_0xb631('0x1c')]?_[_0xb631('0x1d')](_0xbec0cd['include'],function(_0xf6203c){return{'model':db[_0xf6203c['model']],'as':_0xf6203c['as'],'attributes':_0xf6203c[_0xb631('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb631('0xa')](function(_0x2aaace){logger['info']('GetSugarcrmAccount',_0x12b277);logger[_0xb631('0xe')](_0xb631('0x15'),_0x12b277,JSON['stringify'](_0x2aaace));_0x48951b(_0x2aaace);})[_0xb631('0x14')](function(_0x132298){logger[_0xb631('0x11')](_0xb631('0x15'),_0x132298[_0xb631('0x13')],_0x12b277);_0x378c0d(_0x3cdf93[_0xb631('0x11')](0x1f4,_0x132298['message']));});});};exports[_0xb631('0x1f')]=function(_0x546225){var _0x3b7d87=this;return new Promise(function(_0x40b8aa,_0x5f4516){return db[_0xb631('0x16')][_0xb631('0x20')]({'raw':_0x546225[_0xb631('0x17')]?_0x546225[_0xb631('0x17')][_0xb631('0x18')]===undefined?!![]:![]:!![],'where':_0x546225['options']?_0x546225[_0xb631('0x17')][_0xb631('0x19')]||null:null,'attributes':_0x546225[_0xb631('0x17')]?_0x546225[_0xb631('0x17')][_0xb631('0x1a')]||null:null,'include':_0x546225[_0xb631('0x17')]?_0x546225[_0xb631('0x17')][_0xb631('0x1c')]?_[_0xb631('0x1d')](_0x546225[_0xb631('0x17')][_0xb631('0x1c')],function(_0x4829ab){return{'model':db[_0x4829ab['model']],'as':_0x4829ab['as'],'attributes':_0x4829ab['attributes'],'include':_0x4829ab[_0xb631('0x1c')]?_['map'](_0x4829ab[_0xb631('0x1c')],function(_0x14a71d){return{'model':db[_0x14a71d['model']],'as':_0x14a71d['as'],'attributes':_0x14a71d[_0xb631('0x1a')],'include':_0x14a71d[_0xb631('0x1c')]?_[_0xb631('0x1d')](_0x14a71d[_0xb631('0x1c')],function(_0x4746e4){return{'model':db[_0x4746e4[_0xb631('0x1e')]],'as':_0x4746e4['as'],'attributes':_0x4746e4['attributes']};}):[]};}):[]};}):[]:[]})[_0xb631('0xa')](function(_0x537e74){logger['info'](_0xb631('0x1f'),_0x546225);logger[_0xb631('0xe')]('ShowSugarcrmAccount',_0x546225,JSON[_0xb631('0x10')](_0x537e74));_0x40b8aa(_0x537e74);})[_0xb631('0x14')](function(_0x5ab4c1){logger['error'](_0xb631('0x1f'),_0x5ab4c1[_0xb631('0x13')],_0x546225);_0x5f4516(_0x3b7d87[_0xb631('0x11')](0x1f4,_0x5ab4c1[_0xb631('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 02faa69..83ea88f 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 _0x4baf=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','getDescriptions','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xe50651,_0x78b476){var _0xc8931c=function(_0x1c2902){while(--_0x1c2902){_0xe50651['push'](_0xe50651['shift']());}};_0xc8931c(++_0x78b476);}(_0x4baf,0xb8));var _0xf4ba=function(_0x3f97e0,_0xf16a13){_0x3f97e0=_0x3f97e0-0x0;var _0xae4294=_0x4baf[_0x3f97e0];return _0xae4294;};'use strict';var multer=require(_0xf4ba('0x0'));var util=require(_0xf4ba('0x1'));var path=require(_0xf4ba('0x2'));var timeout=require(_0xf4ba('0x3'));var express=require(_0xf4ba('0x4'));var router=express[_0xf4ba('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf4ba('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf4ba('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xf4ba('0x8')]('/',auth[_0xf4ba('0x9')](),controller[_0xf4ba('0xa')]);router[_0xf4ba('0x8')]('/:id',auth[_0xf4ba('0x9')](),controller[_0xf4ba('0xb')]);router['get']('/:id/fields',auth[_0xf4ba('0x9')](),controller[_0xf4ba('0xc')]);router['get'](_0xf4ba('0xd'),auth[_0xf4ba('0x9')](),controller[_0xf4ba('0xe')]);router[_0xf4ba('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf4ba('0xf')]);router['post']('/',auth[_0xf4ba('0x9')](),controller['create']);router['put'](_0xf4ba('0x10'),auth[_0xf4ba('0x9')](),controller[_0xf4ba('0x11')]);router[_0xf4ba('0x12')](_0xf4ba('0x10'),auth['isAuthenticated'](),controller[_0xf4ba('0x13')]);module[_0xf4ba('0x14')]=router; \ No newline at end of file +var _0x2e93=['/:id/descriptions','getDescriptions','post','put','destroy','path','express','fs-extra','../../components/auth/service','../../config/environment','/:id','isAuthenticated','get','getFields','getSubjects'];(function(_0x58df61,_0x263bda){var _0x2af205=function(_0x14c8aa){while(--_0x14c8aa){_0x58df61['push'](_0x58df61['shift']());}};_0x2af205(++_0x263bda);}(_0x2e93,0x1c7));var _0x32e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2e93[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x32e9('0x0'));var timeout=require('connect-timeout');var express=require(_0x32e9('0x1'));var router=express['Router']();var fs_extra=require(_0x32e9('0x2'));var auth=require(_0x32e9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x32e9('0x4'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x32e9('0x5'),auth[_0x32e9('0x6')](),controller['show']);router[_0x32e9('0x7')]('/:id/fields',auth[_0x32e9('0x6')](),controller[_0x32e9('0x8')]);router[_0x32e9('0x7')]('/:id/subjects',auth[_0x32e9('0x6')](),controller[_0x32e9('0x9')]);router[_0x32e9('0x7')](_0x32e9('0xa'),auth[_0x32e9('0x6')](),controller[_0x32e9('0xb')]);router[_0x32e9('0xc')]('/',auth[_0x32e9('0x6')](),controller['create']);router[_0x32e9('0xd')](_0x32e9('0x5'),auth[_0x32e9('0x6')](),controller['update']);router['delete'](_0x32e9('0x5'),auth[_0x32e9('0x6')](),controller[_0x32e9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index f9b6a97..c34723e 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 _0xb105=['exports','STRING','sequelize'];(function(_0x50f509,_0xcef389){var _0x4f4dba=function(_0x4a1852){while(--_0x4a1852){_0x50f509['push'](_0x50f509['shift']());}};_0x4f4dba(++_0xcef389);}(_0xb105,0x13d));var _0x5b10=function(_0x3f8568,_0x3e3cd7){_0x3f8568=_0x3f8568-0x0;var _0x18c5ae=_0xb105[_0x3f8568];return _0x18c5ae;};'use strict';var Sequelize=require(_0x5b10('0x0'));module[_0x5b10('0x1')]={'name':{'type':Sequelize[_0x5b10('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe86b=['STRING'];(function(_0x47dd05,_0x4aa69a){var _0x1ac7c7=function(_0x5dbca1){while(--_0x5dbca1){_0x47dd05['push'](_0x47dd05['shift']());}};_0x1ac7c7(++_0x4aa69a);}(_0xe86b,0xde));var _0xbe86=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe86b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbe86('0x0')]},'description':{'type':Sequelize[_0xbe86('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 3e36b72..5b3c960 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 _0x29c9=['status','end','undefined','limit','count','offset','set','Content-Range','json','reject','then','destroy','sendStatus','stack','send','index','rawAttributes','fieldName','map','name','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','include','SugarcrmConfiguration','findAll','rows','catch','show','params','includeAll','find','create','body','update','getFields','findOne','order','pick','hasOwnProperty','SugarcrmField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x29c9,0x1d2));var _0x929c=function(_0x409b0f,_0x25936f){_0x409b0f=_0x409b0f-0x0;var _0x2054ba=_0x29c9[_0x409b0f];return _0x2054ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x929c('0x0'));var zipdir=require(_0x929c('0x1'));var jsonpatch=require(_0x929c('0x2'));var rp=require(_0x929c('0x3'));var moment=require(_0x929c('0x4'));var BPromise=require(_0x929c('0x5'));var Mustache=require(_0x929c('0x6'));var util=require(_0x929c('0x7'));var path=require(_0x929c('0x8'));var sox=require(_0x929c('0x9'));var csv=require(_0x929c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x929c('0xb'));var squel=require(_0x929c('0xc'));var crypto=require(_0x929c('0xd'));var jsforce=require(_0x929c('0xe'));var deskjs=require(_0x929c('0xf'));var toCsv=require(_0x929c('0xa'));var querystring=require(_0x929c('0x10'));var Papa=require(_0x929c('0x11'));var Redis=require(_0x929c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x929c('0x13'));var as=require(_0x929c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x929c('0x15'))(_0x929c('0x16'));var utils=require(_0x929c('0x17'));var config=require(_0x929c('0x18'));var licenseUtil=require(_0x929c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe010ec,_0x5dea86){_0x5dea86=_0x5dea86||0xcc;return function(_0x48c7e2){if(_0x48c7e2){return _0xe010ec['sendStatus'](_0x5dea86);}return _0xe010ec[_0x929c('0x1a')](_0x5dea86)[_0x929c('0x1b')]();};}function respondWithResult(_0x3857b5,_0x415c8f){_0x415c8f=_0x415c8f||0xc8;return function(_0x106307){if(_0x106307){return _0x3857b5['status'](_0x415c8f)['json'](_0x106307);}};}function respondWithFilteredResult(_0x2003b8,_0x5a820b){return function(_0x9a5bef){if(_0x9a5bef){var _0x2565cd=typeof _0x5a820b['offset']===_0x929c('0x1c')&&typeof _0x5a820b[_0x929c('0x1d')]===_0x929c('0x1c');var _0x3dcafb=_0x9a5bef[_0x929c('0x1e')];var _0x4ec0f1=_0x2565cd?0x0:_0x5a820b[_0x929c('0x1f')];var _0x1f8eb8=_0x2565cd?_0x9a5bef[_0x929c('0x1e')]:_0x5a820b[_0x929c('0x1f')]+_0x5a820b[_0x929c('0x1d')];var _0x17bdbf;if(_0x1f8eb8>=_0x3dcafb){_0x1f8eb8=_0x3dcafb;_0x17bdbf=0xc8;}else{_0x17bdbf=0xce;}_0x2003b8['status'](_0x17bdbf);return _0x2003b8[_0x929c('0x20')](_0x929c('0x21'),_0x4ec0f1+'-'+_0x1f8eb8+'/'+_0x3dcafb)[_0x929c('0x22')](_0x9a5bef);}return null;};}function patchUpdates(_0x366ff3){return function(_0x503cfe){try{jsonpatch['apply'](_0x503cfe,_0x366ff3,!![]);}catch(_0x2a7359){return BPromise[_0x929c('0x23')](_0x2a7359);}return _0x503cfe['save']();};}function saveUpdates(_0x16b8b2,_0x93e849){return function(_0x588b66){if(_0x588b66){return _0x588b66['update'](_0x16b8b2)[_0x929c('0x24')](function(_0x221faf){return _0x221faf;});}return null;};}function removeEntity(_0x5ea0e8,_0x411f3a){return function(_0xcf6b84){if(_0xcf6b84){return _0xcf6b84[_0x929c('0x25')]()[_0x929c('0x24')](function(){_0x5ea0e8[_0x929c('0x1a')](0xcc)[_0x929c('0x1b')]();});}};}function handleEntityNotFound(_0xea0a90,_0x178620){return function(_0x9d3886){if(!_0x9d3886){_0xea0a90[_0x929c('0x26')](0x194);}return _0x9d3886;};}function handleError(_0x4a86a0,_0x557dc4){_0x557dc4=_0x557dc4||0x1f4;return function(_0x28e037){logger['error'](_0x28e037[_0x929c('0x27')]);if(_0x28e037['name']){delete _0x28e037['name'];}_0x4a86a0['status'](_0x557dc4)[_0x929c('0x28')](_0x28e037);};}exports[_0x929c('0x29')]=function(_0x79d347,_0x353cf8){var _0xd6f0e4={},_0x5efab0={},_0x1ad63f={'count':0x0,'rows':[]};var _0x2654a5=_['map'](db['SugarcrmConfiguration'][_0x929c('0x2a')],function(_0x674256){return{'name':_0x674256[_0x929c('0x2b')],'type':_0x674256['type']['key']};});_0x5efab0['model']=_[_0x929c('0x2c')](_0x2654a5,_0x929c('0x2d'));_0x5efab0[_0x929c('0x2e')]=_[_0x929c('0x2f')](_0x79d347[_0x929c('0x2e')]);_0x5efab0['filters']=_[_0x929c('0x30')](_0x5efab0[_0x929c('0x31')],_0x5efab0[_0x929c('0x2e')]);_0xd6f0e4[_0x929c('0x32')]=_[_0x929c('0x30')](_0x5efab0['model'],qs[_0x929c('0x33')](_0x79d347['query'][_0x929c('0x33')]));_0xd6f0e4[_0x929c('0x32')]=_0xd6f0e4[_0x929c('0x32')][_0x929c('0x34')]?_0xd6f0e4[_0x929c('0x32')]:_0x5efab0[_0x929c('0x31')];if(!_0x79d347[_0x929c('0x2e')]['hasOwnProperty'](_0x929c('0x35'))){_0xd6f0e4[_0x929c('0x1d')]=qs[_0x929c('0x1d')](_0x79d347[_0x929c('0x2e')][_0x929c('0x1d')]);_0xd6f0e4['offset']=qs[_0x929c('0x1f')](_0x79d347[_0x929c('0x2e')][_0x929c('0x1f')]);}_0xd6f0e4['order']=qs[_0x929c('0x36')](_0x79d347[_0x929c('0x2e')]['sort']);_0xd6f0e4[_0x929c('0x37')]=qs[_0x929c('0x38')](_['pick'](_0x79d347[_0x929c('0x2e')],_0x5efab0[_0x929c('0x38')]),_0x2654a5);if(_0x79d347['query'][_0x929c('0x39')]){_0xd6f0e4[_0x929c('0x37')]=_[_0x929c('0x3a')](_0xd6f0e4[_0x929c('0x37')],{'$or':_['map'](_0x2654a5,function(_0x1e90c4){if(_0x1e90c4[_0x929c('0x3b')]!==_0x929c('0x3c')){var _0x27bbd8={};_0x27bbd8[_0x1e90c4[_0x929c('0x2d')]]={'$like':'%'+_0x79d347[_0x929c('0x2e')][_0x929c('0x39')]+'%'};return _0x27bbd8;}})});}_0xd6f0e4=_['merge']({},_0xd6f0e4,_0x79d347[_0x929c('0x3d')]);var _0x26932d={'where':_0xd6f0e4[_0x929c('0x37')]};return db['SugarcrmConfiguration']['count'](_0x26932d)['then'](function(_0x1cce29){_0x1ad63f[_0x929c('0x1e')]=_0x1cce29;if(_0x79d347['query']['includeAll']){_0xd6f0e4[_0x929c('0x3e')]=[{'all':!![]}];}return db[_0x929c('0x3f')][_0x929c('0x40')](_0xd6f0e4);})['then'](function(_0xb86e58){_0x1ad63f[_0x929c('0x41')]=_0xb86e58;return _0x1ad63f;})['then'](respondWithFilteredResult(_0x353cf8,_0xd6f0e4))[_0x929c('0x42')](handleError(_0x353cf8,null));};exports[_0x929c('0x43')]=function(_0x59ca1e,_0x42f1d4){var _0x213d9f={'raw':![],'where':{'id':_0x59ca1e[_0x929c('0x44')]['id']}},_0x18afcb={};_0x18afcb[_0x929c('0x31')]=_[_0x929c('0x2f')](db['SugarcrmConfiguration'][_0x929c('0x2a')]);_0x18afcb[_0x929c('0x2e')]=_[_0x929c('0x2f')](_0x59ca1e[_0x929c('0x2e')]);_0x18afcb['filters']=_[_0x929c('0x30')](_0x18afcb[_0x929c('0x31')],_0x18afcb[_0x929c('0x2e')]);_0x213d9f[_0x929c('0x32')]=_[_0x929c('0x30')](_0x18afcb['model'],qs[_0x929c('0x33')](_0x59ca1e[_0x929c('0x2e')]['fields']));_0x213d9f[_0x929c('0x32')]=_0x213d9f[_0x929c('0x32')]['length']?_0x213d9f['attributes']:_0x18afcb[_0x929c('0x31')];if(_0x59ca1e[_0x929c('0x2e')][_0x929c('0x45')]){_0x213d9f[_0x929c('0x3e')]=[{'all':!![]}];}_0x213d9f=_[_0x929c('0x3a')]({},_0x213d9f,_0x59ca1e[_0x929c('0x3d')]);return db[_0x929c('0x3f')][_0x929c('0x46')](_0x213d9f)[_0x929c('0x24')](handleEntityNotFound(_0x42f1d4,null))[_0x929c('0x24')](respondWithResult(_0x42f1d4,null))['catch'](handleError(_0x42f1d4,null));};exports['create']=function(_0x3c6ba3,_0x379a9b){return db[_0x929c('0x3f')][_0x929c('0x47')](_0x3c6ba3[_0x929c('0x48')],{})[_0x929c('0x24')](respondWithResult(_0x379a9b,0xc9))['catch'](handleError(_0x379a9b,null));};exports[_0x929c('0x49')]=function(_0x697f6e,_0x840a74){if(_0x697f6e[_0x929c('0x48')]['id']){delete _0x697f6e[_0x929c('0x48')]['id'];}return db[_0x929c('0x3f')]['find']({'where':{'id':_0x697f6e[_0x929c('0x44')]['id']}})[_0x929c('0x24')](handleEntityNotFound(_0x840a74,null))[_0x929c('0x24')](saveUpdates(_0x697f6e[_0x929c('0x48')],null))[_0x929c('0x24')](respondWithResult(_0x840a74,null))['catch'](handleError(_0x840a74,null));};exports[_0x929c('0x25')]=function(_0x108dc9,_0x488036){return db[_0x929c('0x3f')][_0x929c('0x46')]({'where':{'id':_0x108dc9[_0x929c('0x44')]['id']}})[_0x929c('0x24')](handleEntityNotFound(_0x488036,null))[_0x929c('0x24')](removeEntity(_0x488036,null))[_0x929c('0x42')](handleError(_0x488036,null));};exports[_0x929c('0x4a')]=function(_0x4eb614,_0xb81731,_0x86b88b){var _0x5b8c0f={};var _0x49b6dc={};var _0x4cd296;var _0x1149a9;return db[_0x929c('0x3f')][_0x929c('0x4b')]({'where':{'id':_0x4eb614['params']['id']}})[_0x929c('0x24')](handleEntityNotFound(_0xb81731,null))[_0x929c('0x24')](function(_0x2b1fb6){if(_0x2b1fb6){_0x4cd296=_0x2b1fb6;_0x49b6dc[_0x929c('0x31')]=_[_0x929c('0x2f')](db['SugarcrmField'][_0x929c('0x2a')]);_0x49b6dc['query']=_['keys'](_0x4eb614[_0x929c('0x2e')]);_0x49b6dc[_0x929c('0x38')]=_[_0x929c('0x30')](_0x49b6dc[_0x929c('0x31')],_0x49b6dc[_0x929c('0x2e')]);_0x5b8c0f[_0x929c('0x32')]=_[_0x929c('0x30')](_0x49b6dc[_0x929c('0x31')],qs[_0x929c('0x33')](_0x4eb614['query']['fields']));_0x5b8c0f[_0x929c('0x32')]=_0x5b8c0f[_0x929c('0x32')]['length']?_0x5b8c0f[_0x929c('0x32')]:_0x49b6dc[_0x929c('0x31')];_0x5b8c0f[_0x929c('0x4c')]=qs[_0x929c('0x36')](_0x4eb614[_0x929c('0x2e')][_0x929c('0x36')]);_0x5b8c0f[_0x929c('0x37')]=qs[_0x929c('0x38')](_[_0x929c('0x4d')](_0x4eb614[_0x929c('0x2e')],_0x49b6dc[_0x929c('0x38')]));if(_0x4eb614[_0x929c('0x2e')][_0x929c('0x39')]){_0x5b8c0f[_0x929c('0x37')]=_[_0x929c('0x3a')](_0x5b8c0f[_0x929c('0x37')],{'$or':_[_0x929c('0x2c')](_0x5b8c0f[_0x929c('0x32')],function(_0xf0e412){var _0x1737a7={};_0x1737a7[_0xf0e412]={'$like':'%'+_0x4eb614[_0x929c('0x2e')]['filter']+'%'};return _0x1737a7;})});}_0x5b8c0f=_[_0x929c('0x3a')]({},_0x5b8c0f,_0x4eb614[_0x929c('0x3d')]);return _0x4cd296[_0x929c('0x4a')](_0x5b8c0f);}})['then'](function(_0x2779d4){if(_0x2779d4){_0x1149a9=_0x2779d4[_0x929c('0x34')];if(!_0x4eb614[_0x929c('0x2e')][_0x929c('0x4e')](_0x929c('0x35'))){_0x5b8c0f['limit']=qs[_0x929c('0x1d')](_0x4eb614[_0x929c('0x2e')][_0x929c('0x1d')]);_0x5b8c0f[_0x929c('0x1f')]=qs[_0x929c('0x1f')](_0x4eb614[_0x929c('0x2e')][_0x929c('0x1f')]);}return _0x4cd296[_0x929c('0x4a')](_0x5b8c0f);}})[_0x929c('0x24')](function(_0x1c9e50){if(_0x1c9e50){return _0x1c9e50?{'count':_0x1149a9,'rows':_0x1c9e50}:null;}})[_0x929c('0x24')](respondWithResult(_0xb81731,null))[_0x929c('0x42')](handleError(_0xb81731,null));};exports['getSubjects']=function(_0x585bf0,_0x4e782a,_0x28381b){var _0x136c43={};var _0xfe52df={};var _0x3926c3;var _0x426694;return db[_0x929c('0x3f')][_0x929c('0x4b')]({'where':{'id':_0x585bf0['params']['id']}})[_0x929c('0x24')](handleEntityNotFound(_0x4e782a,null))[_0x929c('0x24')](function(_0x3620bf){if(_0x3620bf){_0x3926c3=_0x3620bf;_0xfe52df[_0x929c('0x31')]=_['keys'](db[_0x929c('0x4f')]['rawAttributes']);_0xfe52df[_0x929c('0x2e')]=_[_0x929c('0x2f')](_0x585bf0[_0x929c('0x2e')]);_0xfe52df['filters']=_[_0x929c('0x30')](_0xfe52df[_0x929c('0x31')],_0xfe52df['query']);_0x136c43[_0x929c('0x32')]=_[_0x929c('0x30')](_0xfe52df[_0x929c('0x31')],qs[_0x929c('0x33')](_0x585bf0[_0x929c('0x2e')]['fields']));_0x136c43[_0x929c('0x32')]=_0x136c43[_0x929c('0x32')][_0x929c('0x34')]?_0x136c43[_0x929c('0x32')]:_0xfe52df[_0x929c('0x31')];_0x136c43['order']=qs[_0x929c('0x36')](_0x585bf0['query'][_0x929c('0x36')]);_0x136c43['where']=qs['filters'](_['pick'](_0x585bf0[_0x929c('0x2e')],_0xfe52df['filters']));if(_0x585bf0['query']['filter']){_0x136c43['where']=_['merge'](_0x136c43[_0x929c('0x37')],{'$or':_[_0x929c('0x2c')](_0x136c43[_0x929c('0x32')],function(_0x46b3b1){var _0x3c312a={};_0x3c312a[_0x46b3b1]={'$like':'%'+_0x585bf0[_0x929c('0x2e')][_0x929c('0x39')]+'%'};return _0x3c312a;})});}_0x136c43=_['merge']({},_0x136c43,_0x585bf0['options']);return _0x3926c3[_0x929c('0x50')](_0x136c43);}})[_0x929c('0x24')](function(_0x5a17f0){if(_0x5a17f0){_0x426694=_0x5a17f0[_0x929c('0x34')];if(!_0x585bf0[_0x929c('0x2e')][_0x929c('0x4e')](_0x929c('0x35'))){_0x136c43[_0x929c('0x1d')]=qs[_0x929c('0x1d')](_0x585bf0['query'][_0x929c('0x1d')]);_0x136c43[_0x929c('0x1f')]=qs[_0x929c('0x1f')](_0x585bf0[_0x929c('0x2e')][_0x929c('0x1f')]);}return _0x3926c3['getSubjects'](_0x136c43);}})[_0x929c('0x24')](function(_0x484910){if(_0x484910){return _0x484910?{'count':_0x426694,'rows':_0x484910}:null;}})[_0x929c('0x24')](respondWithResult(_0x4e782a,null))[_0x929c('0x42')](handleError(_0x4e782a,null));};exports[_0x929c('0x51')]=function(_0xab0d1e,_0x2a6d9d,_0x27cdb5){var _0x27e64d={};var _0x587488={};var _0x237cab;var _0x26e871;return db[_0x929c('0x3f')]['findOne']({'where':{'id':_0xab0d1e[_0x929c('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a6d9d,null))['then'](function(_0x461009){if(_0x461009){_0x237cab=_0x461009;_0x587488['model']=_[_0x929c('0x2f')](db[_0x929c('0x4f')][_0x929c('0x2a')]);_0x587488[_0x929c('0x2e')]=_[_0x929c('0x2f')](_0xab0d1e['query']);_0x587488[_0x929c('0x38')]=_['intersection'](_0x587488['model'],_0x587488[_0x929c('0x2e')]);_0x27e64d['attributes']=_[_0x929c('0x30')](_0x587488[_0x929c('0x31')],qs[_0x929c('0x33')](_0xab0d1e['query'][_0x929c('0x33')]));_0x27e64d[_0x929c('0x32')]=_0x27e64d[_0x929c('0x32')][_0x929c('0x34')]?_0x27e64d['attributes']:_0x587488[_0x929c('0x31')];_0x27e64d[_0x929c('0x4c')]=qs[_0x929c('0x36')](_0xab0d1e[_0x929c('0x2e')][_0x929c('0x36')]);_0x27e64d[_0x929c('0x37')]=qs['filters'](_[_0x929c('0x4d')](_0xab0d1e[_0x929c('0x2e')],_0x587488[_0x929c('0x38')]));if(_0xab0d1e[_0x929c('0x2e')][_0x929c('0x39')]){_0x27e64d[_0x929c('0x37')]=_['merge'](_0x27e64d[_0x929c('0x37')],{'$or':_[_0x929c('0x2c')](_0x27e64d[_0x929c('0x32')],function(_0x4d8d5b){var _0x3a6ac8={};_0x3a6ac8[_0x4d8d5b]={'$like':'%'+_0xab0d1e[_0x929c('0x2e')]['filter']+'%'};return _0x3a6ac8;})});}_0x27e64d=_[_0x929c('0x3a')]({},_0x27e64d,_0xab0d1e[_0x929c('0x3d')]);return _0x237cab[_0x929c('0x51')](_0x27e64d);}})[_0x929c('0x24')](function(_0x2f16ef){if(_0x2f16ef){_0x26e871=_0x2f16ef['length'];if(!_0xab0d1e[_0x929c('0x2e')][_0x929c('0x4e')]('nolimit')){_0x27e64d[_0x929c('0x1d')]=qs[_0x929c('0x1d')](_0xab0d1e['query']['limit']);_0x27e64d[_0x929c('0x1f')]=qs[_0x929c('0x1f')](_0xab0d1e[_0x929c('0x2e')][_0x929c('0x1f')]);}return _0x237cab['getDescriptions'](_0x27e64d);}})['then'](function(_0x59202c){if(_0x59202c){return _0x59202c?{'count':_0x26e871,'rows':_0x59202c}:null;}})[_0x929c('0x24')](respondWithResult(_0x2a6d9d,null))[_0x929c('0x42')](handleError(_0x2a6d9d,null));}; \ No newline at end of file +var _0x52b5=['error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','destroy','getFields','findOne','SugarcrmField','pick','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x39544d,_0x5d70ef){var _0x4e32a2=function(_0x352005){while(--_0x352005){_0x39544d['push'](_0x39544d['shift']());}};_0x4e32a2(++_0x5d70ef);}(_0x52b5,0x1d6));var _0x552b=function(_0x40d963,_0x4fbaa7){_0x40d963=_0x40d963-0x0;var _0x458fed=_0x52b5[_0x40d963];return _0x458fed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x552b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x552b('0x1'));var rp=require(_0x552b('0x2'));var moment=require(_0x552b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x552b('0x4'));var util=require(_0x552b('0x5'));var path=require(_0x552b('0x6'));var sox=require(_0x552b('0x7'));var csv=require(_0x552b('0x8'));var ejs=require(_0x552b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x552b('0xa'));var squel=require(_0x552b('0xb'));var crypto=require(_0x552b('0xc'));var jsforce=require(_0x552b('0xd'));var deskjs=require(_0x552b('0xe'));var toCsv=require(_0x552b('0x8'));var querystring=require(_0x552b('0xf'));var Papa=require(_0x552b('0x10'));var Redis=require('ioredis');var authService=require(_0x552b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x552b('0x12'));var hardwareService=require(_0x552b('0x13'));var logger=require(_0x552b('0x14'))(_0x552b('0x15'));var utils=require('../../config/utils');var config=require(_0x552b('0x16'));var licenseUtil=require(_0x552b('0x17'));var db=require(_0x552b('0x18'))['db'];function respondWithStatusCode(_0x2d565b,_0x1c3bcd){_0x1c3bcd=_0x1c3bcd||0xcc;return function(_0x43330e){if(_0x43330e){return _0x2d565b[_0x552b('0x19')](_0x1c3bcd);}return _0x2d565b[_0x552b('0x1a')](_0x1c3bcd)[_0x552b('0x1b')]();};}function respondWithResult(_0x3f54b1,_0x297163){_0x297163=_0x297163||0xc8;return function(_0x32f8ed){if(_0x32f8ed){return _0x3f54b1['status'](_0x297163)[_0x552b('0x1c')](_0x32f8ed);}};}function respondWithFilteredResult(_0x49d076,_0x339636){return function(_0x4d9329){if(_0x4d9329){var _0x2345d2=typeof _0x339636['offset']===_0x552b('0x1d')&&typeof _0x339636[_0x552b('0x1e')]==='undefined';var _0x266e9f=_0x4d9329[_0x552b('0x1f')];var _0xe1670d=_0x2345d2?0x0:_0x339636[_0x552b('0x20')];var _0x57de0a=_0x2345d2?_0x4d9329[_0x552b('0x1f')]:_0x339636['offset']+_0x339636['limit'];var _0x2a5ffb;if(_0x57de0a>=_0x266e9f){_0x57de0a=_0x266e9f;_0x2a5ffb=0xc8;}else{_0x2a5ffb=0xce;}_0x49d076['status'](_0x2a5ffb);return _0x49d076[_0x552b('0x21')](_0x552b('0x22'),_0xe1670d+'-'+_0x57de0a+'/'+_0x266e9f)[_0x552b('0x1c')](_0x4d9329);}return null;};}function patchUpdates(_0x239045){return function(_0x3f99dc){try{jsonpatch[_0x552b('0x23')](_0x3f99dc,_0x239045,!![]);}catch(_0x4a2b85){return BPromise[_0x552b('0x24')](_0x4a2b85);}return _0x3f99dc[_0x552b('0x25')]();};}function saveUpdates(_0x35d60c,_0x171a97){return function(_0x5e0f15){if(_0x5e0f15){return _0x5e0f15[_0x552b('0x26')](_0x35d60c)[_0x552b('0x27')](function(_0x398507){return _0x398507;});}return null;};}function removeEntity(_0x4d4aa4,_0x5c2469){return function(_0x4cb455){if(_0x4cb455){return _0x4cb455['destroy']()[_0x552b('0x27')](function(){_0x4d4aa4[_0x552b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x100a8c,_0x29224e){return function(_0x4ecd72){if(!_0x4ecd72){_0x100a8c[_0x552b('0x19')](0x194);}return _0x4ecd72;};}function handleError(_0x4ff94b,_0x575c26){_0x575c26=_0x575c26||0x1f4;return function(_0x39d37f){logger[_0x552b('0x28')](_0x39d37f[_0x552b('0x29')]);if(_0x39d37f[_0x552b('0x2a')]){delete _0x39d37f['name'];}_0x4ff94b['status'](_0x575c26)[_0x552b('0x2b')](_0x39d37f);};}exports[_0x552b('0x2c')]=function(_0x42ce3f,_0xc2f8f9){var _0xc2e320={},_0x36df36={},_0x132230={'count':0x0,'rows':[]};var _0x25614e=_[_0x552b('0x2d')](db[_0x552b('0x2e')][_0x552b('0x2f')],function(_0x2e5684){return{'name':_0x2e5684[_0x552b('0x30')],'type':_0x2e5684[_0x552b('0x31')][_0x552b('0x32')]};});_0x36df36[_0x552b('0x33')]=_[_0x552b('0x2d')](_0x25614e,_0x552b('0x2a'));_0x36df36[_0x552b('0x34')]=_[_0x552b('0x35')](_0x42ce3f[_0x552b('0x34')]);_0x36df36[_0x552b('0x36')]=_[_0x552b('0x37')](_0x36df36[_0x552b('0x33')],_0x36df36[_0x552b('0x34')]);_0xc2e320[_0x552b('0x38')]=_[_0x552b('0x37')](_0x36df36['model'],qs[_0x552b('0x39')](_0x42ce3f['query'][_0x552b('0x39')]));_0xc2e320[_0x552b('0x38')]=_0xc2e320[_0x552b('0x38')][_0x552b('0x3a')]?_0xc2e320[_0x552b('0x38')]:_0x36df36['model'];if(!_0x42ce3f['query'][_0x552b('0x3b')](_0x552b('0x3c'))){_0xc2e320[_0x552b('0x1e')]=qs[_0x552b('0x1e')](_0x42ce3f[_0x552b('0x34')][_0x552b('0x1e')]);_0xc2e320['offset']=qs['offset'](_0x42ce3f[_0x552b('0x34')][_0x552b('0x20')]);}_0xc2e320[_0x552b('0x3d')]=qs[_0x552b('0x3e')](_0x42ce3f[_0x552b('0x34')]['sort']);_0xc2e320[_0x552b('0x3f')]=qs[_0x552b('0x36')](_['pick'](_0x42ce3f['query'],_0x36df36[_0x552b('0x36')]),_0x25614e);if(_0x42ce3f[_0x552b('0x34')][_0x552b('0x40')]){_0xc2e320[_0x552b('0x3f')]=_[_0x552b('0x41')](_0xc2e320['where'],{'$or':_[_0x552b('0x2d')](_0x25614e,function(_0x1d638e){if(_0x1d638e['type']!==_0x552b('0x42')){var _0x2bd7b7={};_0x2bd7b7[_0x1d638e[_0x552b('0x2a')]]={'$like':'%'+_0x42ce3f[_0x552b('0x34')][_0x552b('0x40')]+'%'};return _0x2bd7b7;}})});}_0xc2e320=_[_0x552b('0x41')]({},_0xc2e320,_0x42ce3f['options']);var _0x5cac5f={'where':_0xc2e320[_0x552b('0x3f')]};return db[_0x552b('0x2e')][_0x552b('0x1f')](_0x5cac5f)[_0x552b('0x27')](function(_0x3ae2a3){_0x132230[_0x552b('0x1f')]=_0x3ae2a3;if(_0x42ce3f[_0x552b('0x34')][_0x552b('0x43')]){_0xc2e320['include']=[{'all':!![]}];}return db[_0x552b('0x2e')][_0x552b('0x44')](_0xc2e320);})[_0x552b('0x27')](function(_0x5421d2){_0x132230[_0x552b('0x45')]=_0x5421d2;return _0x132230;})[_0x552b('0x27')](respondWithFilteredResult(_0xc2f8f9,_0xc2e320))[_0x552b('0x46')](handleError(_0xc2f8f9,null));};exports[_0x552b('0x47')]=function(_0x459c33,_0x275deb){var _0x3ef76f={'raw':![],'where':{'id':_0x459c33[_0x552b('0x48')]['id']}},_0x531a15={};_0x531a15[_0x552b('0x33')]=_['keys'](db[_0x552b('0x2e')][_0x552b('0x2f')]);_0x531a15[_0x552b('0x34')]=_[_0x552b('0x35')](_0x459c33['query']);_0x531a15[_0x552b('0x36')]=_['intersection'](_0x531a15['model'],_0x531a15['query']);_0x3ef76f['attributes']=_[_0x552b('0x37')](_0x531a15[_0x552b('0x33')],qs[_0x552b('0x39')](_0x459c33[_0x552b('0x34')][_0x552b('0x39')]));_0x3ef76f[_0x552b('0x38')]=_0x3ef76f[_0x552b('0x38')][_0x552b('0x3a')]?_0x3ef76f[_0x552b('0x38')]:_0x531a15[_0x552b('0x33')];if(_0x459c33['query'][_0x552b('0x43')]){_0x3ef76f[_0x552b('0x49')]=[{'all':!![]}];}_0x3ef76f=_[_0x552b('0x41')]({},_0x3ef76f,_0x459c33[_0x552b('0x4a')]);return db[_0x552b('0x2e')][_0x552b('0x4b')](_0x3ef76f)['then'](handleEntityNotFound(_0x275deb,null))[_0x552b('0x27')](respondWithResult(_0x275deb,null))[_0x552b('0x46')](handleError(_0x275deb,null));};exports['create']=function(_0x181089,_0x31ea34){return db['SugarcrmConfiguration'][_0x552b('0x4c')](_0x181089['body'],{})[_0x552b('0x27')](respondWithResult(_0x31ea34,0xc9))[_0x552b('0x46')](handleError(_0x31ea34,null));};exports['update']=function(_0x2a457f,_0x18ea53){if(_0x2a457f[_0x552b('0x4d')]['id']){delete _0x2a457f['body']['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x2a457f[_0x552b('0x48')]['id']}})[_0x552b('0x27')](handleEntityNotFound(_0x18ea53,null))[_0x552b('0x27')](saveUpdates(_0x2a457f[_0x552b('0x4d')],null))['then'](respondWithResult(_0x18ea53,null))['catch'](handleError(_0x18ea53,null));};exports[_0x552b('0x4e')]=function(_0x3f9066,_0x3224fd){return db[_0x552b('0x2e')][_0x552b('0x4b')]({'where':{'id':_0x3f9066[_0x552b('0x48')]['id']}})[_0x552b('0x27')](handleEntityNotFound(_0x3224fd,null))[_0x552b('0x27')](removeEntity(_0x3224fd,null))[_0x552b('0x46')](handleError(_0x3224fd,null));};exports[_0x552b('0x4f')]=function(_0x37ab22,_0x3ac80b,_0x4e9b53){var _0x1f8ac8={};var _0x1a3960={};var _0x4f662d;var _0x2eaba3;return db[_0x552b('0x2e')][_0x552b('0x50')]({'where':{'id':_0x37ab22[_0x552b('0x48')]['id']}})[_0x552b('0x27')](handleEntityNotFound(_0x3ac80b,null))[_0x552b('0x27')](function(_0x5184ce){if(_0x5184ce){_0x4f662d=_0x5184ce;_0x1a3960[_0x552b('0x33')]=_[_0x552b('0x35')](db[_0x552b('0x51')][_0x552b('0x2f')]);_0x1a3960['query']=_[_0x552b('0x35')](_0x37ab22['query']);_0x1a3960[_0x552b('0x36')]=_[_0x552b('0x37')](_0x1a3960['model'],_0x1a3960[_0x552b('0x34')]);_0x1f8ac8[_0x552b('0x38')]=_[_0x552b('0x37')](_0x1a3960[_0x552b('0x33')],qs[_0x552b('0x39')](_0x37ab22[_0x552b('0x34')][_0x552b('0x39')]));_0x1f8ac8[_0x552b('0x38')]=_0x1f8ac8['attributes'][_0x552b('0x3a')]?_0x1f8ac8[_0x552b('0x38')]:_0x1a3960[_0x552b('0x33')];_0x1f8ac8[_0x552b('0x3d')]=qs[_0x552b('0x3e')](_0x37ab22[_0x552b('0x34')][_0x552b('0x3e')]);_0x1f8ac8['where']=qs['filters'](_[_0x552b('0x52')](_0x37ab22[_0x552b('0x34')],_0x1a3960[_0x552b('0x36')]));if(_0x37ab22[_0x552b('0x34')][_0x552b('0x40')]){_0x1f8ac8[_0x552b('0x3f')]=_['merge'](_0x1f8ac8[_0x552b('0x3f')],{'$or':_[_0x552b('0x2d')](_0x1f8ac8[_0x552b('0x38')],function(_0x19cd55){var _0x229c32={};_0x229c32[_0x19cd55]={'$like':'%'+_0x37ab22['query'][_0x552b('0x40')]+'%'};return _0x229c32;})});}_0x1f8ac8=_[_0x552b('0x41')]({},_0x1f8ac8,_0x37ab22[_0x552b('0x4a')]);return _0x4f662d[_0x552b('0x4f')](_0x1f8ac8);}})[_0x552b('0x27')](function(_0x9b2b63){if(_0x9b2b63){_0x2eaba3=_0x9b2b63[_0x552b('0x3a')];if(!_0x37ab22[_0x552b('0x34')][_0x552b('0x3b')](_0x552b('0x3c'))){_0x1f8ac8[_0x552b('0x1e')]=qs[_0x552b('0x1e')](_0x37ab22[_0x552b('0x34')][_0x552b('0x1e')]);_0x1f8ac8[_0x552b('0x20')]=qs['offset'](_0x37ab22[_0x552b('0x34')]['offset']);}return _0x4f662d[_0x552b('0x4f')](_0x1f8ac8);}})[_0x552b('0x27')](function(_0x46c57c){if(_0x46c57c){return _0x46c57c?{'count':_0x2eaba3,'rows':_0x46c57c}:null;}})['then'](respondWithResult(_0x3ac80b,null))[_0x552b('0x46')](handleError(_0x3ac80b,null));};exports[_0x552b('0x53')]=function(_0x3ffe61,_0x38d7d7,_0x3c441c){var _0x5c6199={};var _0x9023={};var _0x1f17d4;var _0x467619;return db['SugarcrmConfiguration'][_0x552b('0x50')]({'where':{'id':_0x3ffe61[_0x552b('0x48')]['id']}})['then'](handleEntityNotFound(_0x38d7d7,null))['then'](function(_0xf074b){if(_0xf074b){_0x1f17d4=_0xf074b;_0x9023[_0x552b('0x33')]=_[_0x552b('0x35')](db[_0x552b('0x51')][_0x552b('0x2f')]);_0x9023[_0x552b('0x34')]=_['keys'](_0x3ffe61[_0x552b('0x34')]);_0x9023[_0x552b('0x36')]=_[_0x552b('0x37')](_0x9023[_0x552b('0x33')],_0x9023[_0x552b('0x34')]);_0x5c6199['attributes']=_[_0x552b('0x37')](_0x9023[_0x552b('0x33')],qs[_0x552b('0x39')](_0x3ffe61[_0x552b('0x34')][_0x552b('0x39')]));_0x5c6199['attributes']=_0x5c6199[_0x552b('0x38')][_0x552b('0x3a')]?_0x5c6199[_0x552b('0x38')]:_0x9023[_0x552b('0x33')];_0x5c6199[_0x552b('0x3d')]=qs[_0x552b('0x3e')](_0x3ffe61['query']['sort']);_0x5c6199['where']=qs[_0x552b('0x36')](_['pick'](_0x3ffe61[_0x552b('0x34')],_0x9023[_0x552b('0x36')]));if(_0x3ffe61['query']['filter']){_0x5c6199['where']=_[_0x552b('0x41')](_0x5c6199[_0x552b('0x3f')],{'$or':_['map'](_0x5c6199[_0x552b('0x38')],function(_0x34fdf6){var _0x2f6934={};_0x2f6934[_0x34fdf6]={'$like':'%'+_0x3ffe61[_0x552b('0x34')][_0x552b('0x40')]+'%'};return _0x2f6934;})});}_0x5c6199=_['merge']({},_0x5c6199,_0x3ffe61['options']);return _0x1f17d4[_0x552b('0x53')](_0x5c6199);}})[_0x552b('0x27')](function(_0x3816cc){if(_0x3816cc){_0x467619=_0x3816cc['length'];if(!_0x3ffe61[_0x552b('0x34')][_0x552b('0x3b')](_0x552b('0x3c'))){_0x5c6199[_0x552b('0x1e')]=qs[_0x552b('0x1e')](_0x3ffe61[_0x552b('0x34')][_0x552b('0x1e')]);_0x5c6199[_0x552b('0x20')]=qs[_0x552b('0x20')](_0x3ffe61[_0x552b('0x34')][_0x552b('0x20')]);}return _0x1f17d4['getSubjects'](_0x5c6199);}})[_0x552b('0x27')](function(_0x55b0cf){if(_0x55b0cf){return _0x55b0cf?{'count':_0x467619,'rows':_0x55b0cf}:null;}})[_0x552b('0x27')](respondWithResult(_0x38d7d7,null))['catch'](handleError(_0x38d7d7,null));};exports[_0x552b('0x54')]=function(_0x3983cc,_0x2c9abd,_0x42b59e){var _0x56553d={};var _0x8f30da={};var _0x3a9e54;var _0x57ce36;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x3983cc[_0x552b('0x48')]['id']}})[_0x552b('0x27')](handleEntityNotFound(_0x2c9abd,null))[_0x552b('0x27')](function(_0x1ce041){if(_0x1ce041){_0x3a9e54=_0x1ce041;_0x8f30da[_0x552b('0x33')]=_['keys'](db[_0x552b('0x51')][_0x552b('0x2f')]);_0x8f30da[_0x552b('0x34')]=_[_0x552b('0x35')](_0x3983cc['query']);_0x8f30da[_0x552b('0x36')]=_[_0x552b('0x37')](_0x8f30da[_0x552b('0x33')],_0x8f30da[_0x552b('0x34')]);_0x56553d[_0x552b('0x38')]=_[_0x552b('0x37')](_0x8f30da['model'],qs['fields'](_0x3983cc['query'][_0x552b('0x39')]));_0x56553d[_0x552b('0x38')]=_0x56553d[_0x552b('0x38')]['length']?_0x56553d[_0x552b('0x38')]:_0x8f30da[_0x552b('0x33')];_0x56553d[_0x552b('0x3d')]=qs[_0x552b('0x3e')](_0x3983cc[_0x552b('0x34')][_0x552b('0x3e')]);_0x56553d[_0x552b('0x3f')]=qs['filters'](_['pick'](_0x3983cc[_0x552b('0x34')],_0x8f30da[_0x552b('0x36')]));if(_0x3983cc[_0x552b('0x34')][_0x552b('0x40')]){_0x56553d[_0x552b('0x3f')]=_[_0x552b('0x41')](_0x56553d['where'],{'$or':_[_0x552b('0x2d')](_0x56553d[_0x552b('0x38')],function(_0x4581a8){var _0x15367c={};_0x15367c[_0x4581a8]={'$like':'%'+_0x3983cc['query'][_0x552b('0x40')]+'%'};return _0x15367c;})});}_0x56553d=_[_0x552b('0x41')]({},_0x56553d,_0x3983cc[_0x552b('0x4a')]);return _0x3a9e54[_0x552b('0x54')](_0x56553d);}})[_0x552b('0x27')](function(_0x31481f){if(_0x31481f){_0x57ce36=_0x31481f[_0x552b('0x3a')];if(!_0x3983cc[_0x552b('0x34')]['hasOwnProperty'](_0x552b('0x3c'))){_0x56553d[_0x552b('0x1e')]=qs[_0x552b('0x1e')](_0x3983cc['query'][_0x552b('0x1e')]);_0x56553d[_0x552b('0x20')]=qs[_0x552b('0x20')](_0x3983cc[_0x552b('0x34')][_0x552b('0x20')]);}return _0x3a9e54[_0x552b('0x54')](_0x56553d);}})['then'](function(_0x3e3139){if(_0x3e3139){return _0x3e3139?{'count':_0x57ce36,'rows':_0x3e3139}:null;}})['then'](respondWithResult(_0x2c9abd,null))[_0x552b('0x46')](handleError(_0x2c9abd,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 0192465..b4400f3 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 _0xcdb7=['../../config/logger','api','bluebird','request-promise','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','lodash'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xcdb7,0x18b));var _0x7cdb=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xcdb7[_0x432682];return _0x463d05;};'use strict';var _=require(_0x7cdb('0x0'));var util=require('util');var logger=require(_0x7cdb('0x1'))(_0x7cdb('0x2'));var moment=require('moment');var BPromise=require(_0x7cdb('0x3'));var rp=require(_0x7cdb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7cdb('0x5'));var attributes=require(_0x7cdb('0x6'));module[_0x7cdb('0x7')]=function(_0x2f945f,_0x57f158){return _0x2f945f['define'](_0x7cdb('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4129=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','int_sugarcrm_configurations','lodash'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0x4129,0xd1));var _0x9412=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4129[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9412('0x0'));var util=require(_0x9412('0x1'));var logger=require(_0x9412('0x2'))(_0x9412('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9412('0x4'));var fs=require('fs');var path=require(_0x9412('0x5'));var rimraf=require(_0x9412('0x6'));var config=require(_0x9412('0x7'));var attributes=require(_0x9412('0x8'));module['exports']=function(_0x3b3bd8,_0x4c1438){return _0x3b3bd8['define']('SugarcrmConfiguration',attributes,{'tableName':_0x9412('0x9'),'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 9af057c..bd1d104 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 _0x0b03=['randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','util','moment'];(function(_0x2419e1,_0x12416d){var _0x38e897=function(_0x15d500){while(--_0x15d500){_0x2419e1['push'](_0x2419e1['shift']());}};_0x38e897(++_0x12416d);}(_0x0b03,0xec));var _0x30b0=function(_0x21642c,_0x4a4fed){_0x21642c=_0x21642c-0x0;var _0x20ec18=_0x0b03[_0x21642c];return _0x20ec18;};'use strict';var _=require('lodash');var util=require(_0x30b0('0x0'));var moment=require(_0x30b0('0x1'));var BPromise=require('bluebird');var rs=require(_0x30b0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30b0('0x3'))['db'];var utils=require(_0x30b0('0x4'));var logger=require(_0x30b0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x30b0('0x6'));var client=jayson[_0x30b0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd15ccd,_0x1ebbb4,_0x1bf0c4){return new BPromise(function(_0x4f00bc,_0x1e5012){return client[_0x30b0('0x8')](_0xd15ccd,_0x1bf0c4)['then'](function(_0x155577){logger['info'](_0x30b0('0x9'),_0x1ebbb4,'request\x20sent');logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x1ebbb4,_0x30b0('0xa'),JSON['stringify'](_0x155577));if(_0x155577[_0x30b0('0xb')]){if(_0x155577[_0x30b0('0xb')][_0x30b0('0xc')]===0x1f4){logger[_0x30b0('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1ebbb4,_0x155577[_0x30b0('0xb')]['message']);return _0x1e5012(_0x155577[_0x30b0('0xb')][_0x30b0('0xd')]);}logger['error'](_0x30b0('0x9'),_0x1ebbb4,_0x155577['error'][_0x30b0('0xd')]);return _0x4f00bc(_0x155577[_0x30b0('0xb')][_0x30b0('0xd')]);}else{logger[_0x30b0('0xe')](_0x30b0('0x9'),_0x1ebbb4,_0x30b0('0xa'));_0x4f00bc(_0x155577[_0x30b0('0xf')][_0x30b0('0xd')]);}})[_0x30b0('0x10')](function(_0xb15858){logger[_0x30b0('0xb')](_0x30b0('0x9'),_0x1ebbb4,_0xb15858);_0x1e5012(_0xb15858);});});} \ No newline at end of file +var _0xf080=['request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf080,0xc4));var _0x0f08=function(_0x11cc09,_0x48ce98){_0x11cc09=_0x11cc09-0x0;var _0x1fa8ad=_0xf080[_0x11cc09];return _0x1fa8ad;};'use strict';var _=require(_0x0f08('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0f08('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f08('0x2'));var db=require(_0x0f08('0x3'))['db'];var utils=require(_0x0f08('0x4'));var logger=require(_0x0f08('0x5'))(_0x0f08('0x6'));var config=require(_0x0f08('0x7'));var jayson=require(_0x0f08('0x8'));var client=jayson[_0x0f08('0x9')][_0x0f08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x960ddf,_0x30d9cd,_0x279e55){return new BPromise(function(_0x2b8034,_0x1edda1){return client[_0x0f08('0xb')](_0x960ddf,_0x279e55)['then'](function(_0x1fee34){logger[_0x0f08('0xc')](_0x0f08('0xd'),_0x30d9cd,_0x0f08('0xe'));logger[_0x0f08('0xf')](_0x0f08('0x10'),_0x30d9cd,_0x0f08('0xe'),JSON[_0x0f08('0x11')](_0x1fee34));if(_0x1fee34['error']){if(_0x1fee34[_0x0f08('0x12')][_0x0f08('0x13')]===0x1f4){logger[_0x0f08('0x12')](_0x0f08('0xd'),_0x30d9cd,_0x1fee34['error'][_0x0f08('0x14')]);return _0x1edda1(_0x1fee34[_0x0f08('0x12')]['message']);}logger[_0x0f08('0x12')](_0x0f08('0xd'),_0x30d9cd,_0x1fee34[_0x0f08('0x12')][_0x0f08('0x14')]);return _0x2b8034(_0x1fee34[_0x0f08('0x12')][_0x0f08('0x14')]);}else{logger[_0x0f08('0xc')](_0x0f08('0xd'),_0x30d9cd,_0x0f08('0xe'));_0x2b8034(_0x1fee34[_0x0f08('0x15')][_0x0f08('0x14')]);}})[_0x0f08('0x16')](function(_0x15b12b){logger[_0x0f08('0x12')](_0x0f08('0xd'),_0x30d9cd,_0x15b12b);_0x1edda1(_0x15b12b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 0027d18..be5187e 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 _0x515d=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','show','isAuthenticated','create','put','/:id','update','delete','destroy'];(function(_0x4bc7ea,_0x5e3b49){var _0x5a2f25=function(_0xd08366){while(--_0xd08366){_0x4bc7ea['push'](_0x4bc7ea['shift']());}};_0x5a2f25(++_0x5e3b49);}(_0x515d,0xa0));var _0xd515=function(_0x4d89c5,_0x88b142){_0x4d89c5=_0x4d89c5-0x0;var _0x11938b=_0x515d[_0x4d89c5];return _0x11938b;};'use strict';var multer=require('multer');var util=require(_0xd515('0x0'));var path=require(_0xd515('0x1'));var timeout=require('connect-timeout');var express=require(_0xd515('0x2'));var router=express['Router']();var fs_extra=require(_0xd515('0x3'));var auth=require(_0xd515('0x4'));var interaction=require(_0xd515('0x5'));var config=require('../../config/environment');var controller=require(_0xd515('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd515('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd515('0x8')]);router['post']('/',auth[_0xd515('0x9')](),controller[_0xd515('0xa')]);router[_0xd515('0xb')](_0xd515('0xc'),auth[_0xd515('0x9')](),controller[_0xd515('0xd')]);router[_0xd515('0xe')](_0xd515('0xc'),auth[_0xd515('0x9')](),controller[_0xd515('0xf')]);module['exports']=router; \ No newline at end of file +var _0x43bf=['show','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x53f4ec,_0x4395e2){var _0x4d0fd7=function(_0xf1f317){while(--_0xf1f317){_0x53f4ec['push'](_0x53f4ec['shift']());}};_0x4d0fd7(++_0x4395e2);}(_0x43bf,0x139));var _0xf43b=function(_0x1387b3,_0x1061d3){_0x1387b3=_0x1387b3-0x0;var _0x1d9fcb=_0x43bf[_0x1387b3];return _0x1d9fcb;};'use strict';var multer=require(_0xf43b('0x0'));var util=require(_0xf43b('0x1'));var path=require(_0xf43b('0x2'));var timeout=require('connect-timeout');var express=require(_0xf43b('0x3'));var router=express[_0xf43b('0x4')]();var fs_extra=require(_0xf43b('0x5'));var auth=require(_0xf43b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf43b('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xf43b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf43b('0x9'),auth[_0xf43b('0xa')](),controller[_0xf43b('0xb')]);router[_0xf43b('0xc')]('/',auth[_0xf43b('0xa')](),controller[_0xf43b('0xd')]);router[_0xf43b('0xe')](_0xf43b('0x9'),auth['isAuthenticated'](),controller[_0xf43b('0xf')]);router[_0xf43b('0x10')](_0xf43b('0x9'),auth[_0xf43b('0xa')](),controller['destroy']);module[_0xf43b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index b162e7a..c6aff44 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 _0x3863=['customVariable','picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string'];(function(_0x9512c2,_0x35638d){var _0x360bb7=function(_0x4bff2d){while(--_0x4bff2d){_0x9512c2['push'](_0x9512c2['shift']());}};_0x360bb7(++_0x35638d);}(_0x3863,0x11d));var _0x3386=function(_0x4178df,_0x2f471a){_0x4178df=_0x4178df-0x0;var _0x54492e=_0x3863[_0x4178df];return _0x54492e;};'use strict';var Sequelize=require(_0x3386('0x0'));module['exports']={'type':{'type':Sequelize[_0x3386('0x1')](_0x3386('0x2'),'variable',_0x3386('0x3'),'keyValue',_0x3386('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3386('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x3386('0x2'),_0x3386('0x6'),_0x3386('0x3'))},'keyContent':{'type':Sequelize[_0x3386('0x5')]},'idField':{'type':Sequelize[_0x3386('0x5')]},'nameField':{'type':Sequelize[_0x3386('0x5')]},'customField':{'type':Sequelize[_0x3386('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x09ab=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0xf5e0e9,_0x21bd62){var _0x5d7c62=function(_0x5b4a5d){while(--_0x5b4a5d){_0xf5e0e9['push'](_0xf5e0e9['shift']());}};_0x5d7c62(++_0x21bd62);}(_0x09ab,0x114));var _0xb09a=function(_0x23bfbb,_0x3b0fa2){_0x23bfbb=_0x23bfbb-0x0;var _0x383576=_0x09ab[_0x23bfbb];return _0x383576;};'use strict';var Sequelize=require('sequelize');module[_0xb09a('0x0')]={'type':{'type':Sequelize[_0xb09a('0x1')](_0xb09a('0x2'),_0xb09a('0x3'),_0xb09a('0x4'),_0xb09a('0x5'),_0xb09a('0x6')),'defaultValue':_0xb09a('0x2')},'content':{'type':Sequelize[_0xb09a('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xb09a('0x2'),_0xb09a('0x3'),_0xb09a('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb09a('0x7')]},'customField':{'type':Sequelize[_0xb09a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb09a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d45011c..bed0e3f 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 _0xf806=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xf806,0x166));var _0x6f80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf806[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f80('0x0'));var zipdir=require(_0x6f80('0x1'));var jsonpatch=require(_0x6f80('0x2'));var rp=require('request-promise');var moment=require(_0x6f80('0x3'));var BPromise=require(_0x6f80('0x4'));var Mustache=require(_0x6f80('0x5'));var util=require(_0x6f80('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6f80('0x7'));var ejs=require(_0x6f80('0x8'));var fs=require('fs');var fs_extra=require(_0x6f80('0x9'));var _=require('lodash');var squel=require(_0x6f80('0xa'));var crypto=require(_0x6f80('0xb'));var jsforce=require(_0x6f80('0xc'));var deskjs=require(_0x6f80('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6f80('0xe'));var Papa=require(_0x6f80('0xf'));var Redis=require(_0x6f80('0x10'));var authService=require(_0x6f80('0x11'));var qs=require(_0x6f80('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f80('0x13'));var logger=require(_0x6f80('0x14'))(_0x6f80('0x15'));var utils=require('../../config/utils');var config=require(_0x6f80('0x16'));var licenseUtil=require(_0x6f80('0x17'));var db=require(_0x6f80('0x18'))['db'];function respondWithStatusCode(_0x291d71,_0x537bcb){_0x537bcb=_0x537bcb||0xcc;return function(_0x885cee){if(_0x885cee){return _0x291d71[_0x6f80('0x19')](_0x537bcb);}return _0x291d71[_0x6f80('0x1a')](_0x537bcb)[_0x6f80('0x1b')]();};}function respondWithResult(_0x322a2d,_0x2c59fd){_0x2c59fd=_0x2c59fd||0xc8;return function(_0x470dc3){if(_0x470dc3){return _0x322a2d['status'](_0x2c59fd)[_0x6f80('0x1c')](_0x470dc3);}};}function respondWithFilteredResult(_0x50a993,_0x197850){return function(_0x446929){if(_0x446929){var _0x133359=typeof _0x197850[_0x6f80('0x1d')]===_0x6f80('0x1e')&&typeof _0x197850[_0x6f80('0x1f')]===_0x6f80('0x1e');var _0x37d7a3=_0x446929[_0x6f80('0x20')];var _0x206084=_0x133359?0x0:_0x197850[_0x6f80('0x1d')];var _0x596e2f=_0x133359?_0x446929['count']:_0x197850[_0x6f80('0x1d')]+_0x197850[_0x6f80('0x1f')];var _0x4d59cd;if(_0x596e2f>=_0x37d7a3){_0x596e2f=_0x37d7a3;_0x4d59cd=0xc8;}else{_0x4d59cd=0xce;}_0x50a993[_0x6f80('0x1a')](_0x4d59cd);return _0x50a993[_0x6f80('0x21')](_0x6f80('0x22'),_0x206084+'-'+_0x596e2f+'/'+_0x37d7a3)['json'](_0x446929);}return null;};}function patchUpdates(_0x4c5711){return function(_0xd8294b){try{jsonpatch[_0x6f80('0x23')](_0xd8294b,_0x4c5711,!![]);}catch(_0xf48ed6){return BPromise[_0x6f80('0x24')](_0xf48ed6);}return _0xd8294b[_0x6f80('0x25')]();};}function saveUpdates(_0x59be61,_0x26cb0b){return function(_0x47c3d3){if(_0x47c3d3){return _0x47c3d3[_0x6f80('0x26')](_0x59be61)[_0x6f80('0x27')](function(_0x3ce470){return _0x3ce470;});}return null;};}function removeEntity(_0x44b76f,_0x2074a6){return function(_0x5b1e0f){if(_0x5b1e0f){return _0x5b1e0f[_0x6f80('0x28')]()[_0x6f80('0x27')](function(){_0x44b76f[_0x6f80('0x1a')](0xcc)[_0x6f80('0x1b')]();});}};}function handleEntityNotFound(_0x56e55c,_0x55fc91){return function(_0x142ea7){if(!_0x142ea7){_0x56e55c[_0x6f80('0x19')](0x194);}return _0x142ea7;};}function handleError(_0x87810,_0x16947b){_0x16947b=_0x16947b||0x1f4;return function(_0x374b2d){logger[_0x6f80('0x29')](_0x374b2d[_0x6f80('0x2a')]);if(_0x374b2d['name']){delete _0x374b2d[_0x6f80('0x2b')];}_0x87810[_0x6f80('0x1a')](_0x16947b)[_0x6f80('0x2c')](_0x374b2d);};}exports[_0x6f80('0x2d')]=function(_0x37f0a8,_0x12d016){var _0x5090e8={},_0x166a21={},_0x27b257={'count':0x0,'rows':[]};var _0x279805=_[_0x6f80('0x2e')](db[_0x6f80('0x2f')][_0x6f80('0x30')],function(_0xc75433){return{'name':_0xc75433[_0x6f80('0x31')],'type':_0xc75433['type'][_0x6f80('0x32')]};});_0x166a21[_0x6f80('0x33')]=_['map'](_0x279805,_0x6f80('0x2b'));_0x166a21[_0x6f80('0x34')]=_['keys'](_0x37f0a8[_0x6f80('0x34')]);_0x166a21[_0x6f80('0x35')]=_['intersection'](_0x166a21['model'],_0x166a21[_0x6f80('0x34')]);_0x5090e8[_0x6f80('0x36')]=_[_0x6f80('0x37')](_0x166a21[_0x6f80('0x33')],qs[_0x6f80('0x38')](_0x37f0a8[_0x6f80('0x34')]['fields']));_0x5090e8[_0x6f80('0x36')]=_0x5090e8['attributes'][_0x6f80('0x39')]?_0x5090e8[_0x6f80('0x36')]:_0x166a21['model'];if(!_0x37f0a8[_0x6f80('0x34')][_0x6f80('0x3a')]('nolimit')){_0x5090e8[_0x6f80('0x1f')]=qs[_0x6f80('0x1f')](_0x37f0a8[_0x6f80('0x34')][_0x6f80('0x1f')]);_0x5090e8[_0x6f80('0x1d')]=qs[_0x6f80('0x1d')](_0x37f0a8[_0x6f80('0x34')][_0x6f80('0x1d')]);}_0x5090e8[_0x6f80('0x3b')]=qs[_0x6f80('0x3c')](_0x37f0a8['query'][_0x6f80('0x3c')]);_0x5090e8[_0x6f80('0x3d')]=qs[_0x6f80('0x35')](_[_0x6f80('0x3e')](_0x37f0a8[_0x6f80('0x34')],_0x166a21['filters']),_0x279805);if(_0x37f0a8[_0x6f80('0x34')]['filter']){_0x5090e8['where']=_[_0x6f80('0x3f')](_0x5090e8[_0x6f80('0x3d')],{'$or':_['map'](_0x279805,function(_0x268f14){if(_0x268f14[_0x6f80('0x40')]!=='VIRTUAL'){var _0x4d9506={};_0x4d9506[_0x268f14[_0x6f80('0x2b')]]={'$like':'%'+_0x37f0a8[_0x6f80('0x34')]['filter']+'%'};return _0x4d9506;}})});}_0x5090e8=_[_0x6f80('0x3f')]({},_0x5090e8,_0x37f0a8[_0x6f80('0x41')]);var _0x16ad79={'where':_0x5090e8['where']};return db[_0x6f80('0x2f')][_0x6f80('0x20')](_0x16ad79)[_0x6f80('0x27')](function(_0x3600fb){_0x27b257[_0x6f80('0x20')]=_0x3600fb;if(_0x37f0a8[_0x6f80('0x34')][_0x6f80('0x42')]){_0x5090e8['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x6f80('0x43')](_0x5090e8);})[_0x6f80('0x27')](function(_0x381b56){_0x27b257[_0x6f80('0x44')]=_0x381b56;return _0x27b257;})[_0x6f80('0x27')](respondWithFilteredResult(_0x12d016,_0x5090e8))[_0x6f80('0x45')](handleError(_0x12d016,null));};exports[_0x6f80('0x46')]=function(_0xb90956,_0x145425){var _0x6f933e={'raw':!![],'where':{'id':_0xb90956[_0x6f80('0x47')]['id']}},_0x3ebb7c={};_0x3ebb7c[_0x6f80('0x33')]=_[_0x6f80('0x48')](db[_0x6f80('0x2f')][_0x6f80('0x30')]);_0x3ebb7c['query']=_[_0x6f80('0x48')](_0xb90956['query']);_0x3ebb7c[_0x6f80('0x35')]=_[_0x6f80('0x37')](_0x3ebb7c[_0x6f80('0x33')],_0x3ebb7c[_0x6f80('0x34')]);_0x6f933e[_0x6f80('0x36')]=_[_0x6f80('0x37')](_0x3ebb7c['model'],qs[_0x6f80('0x38')](_0xb90956['query'][_0x6f80('0x38')]));_0x6f933e[_0x6f80('0x36')]=_0x6f933e[_0x6f80('0x36')][_0x6f80('0x39')]?_0x6f933e[_0x6f80('0x36')]:_0x3ebb7c[_0x6f80('0x33')];if(_0xb90956[_0x6f80('0x34')][_0x6f80('0x42')]){_0x6f933e[_0x6f80('0x49')]=[{'all':!![]}];}_0x6f933e=_['merge']({},_0x6f933e,_0xb90956['options']);return db['SugarcrmField'][_0x6f80('0x4a')](_0x6f933e)['then'](handleEntityNotFound(_0x145425,null))[_0x6f80('0x27')](respondWithResult(_0x145425,null))[_0x6f80('0x45')](handleError(_0x145425,null));};exports['create']=function(_0x2456b2,_0x372b4c){return db[_0x6f80('0x2f')][_0x6f80('0x4b')](_0x2456b2['body'],{})[_0x6f80('0x27')](respondWithResult(_0x372b4c,0xc9))['catch'](handleError(_0x372b4c,null));};exports[_0x6f80('0x26')]=function(_0x573371,_0x4ce36c){if(_0x573371[_0x6f80('0x4c')]['id']){delete _0x573371[_0x6f80('0x4c')]['id'];}return db[_0x6f80('0x2f')][_0x6f80('0x4a')]({'where':{'id':_0x573371[_0x6f80('0x47')]['id']}})[_0x6f80('0x27')](handleEntityNotFound(_0x4ce36c,null))[_0x6f80('0x27')](saveUpdates(_0x573371[_0x6f80('0x4c')],null))[_0x6f80('0x27')](respondWithResult(_0x4ce36c,null))[_0x6f80('0x45')](handleError(_0x4ce36c,null));};exports[_0x6f80('0x28')]=function(_0x59077a,_0x4a12a4){return db[_0x6f80('0x2f')][_0x6f80('0x4a')]({'where':{'id':_0x59077a[_0x6f80('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a12a4,null))[_0x6f80('0x27')](removeEntity(_0x4a12a4,null))[_0x6f80('0x45')](handleError(_0x4a12a4,null));}; \ No newline at end of file +var _0x56e7=['status','Content-Range','json','update','then','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','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','../../mysqldb','end','offset','undefined','count'];(function(_0x110f47,_0x2bd57e){var _0x4f5958=function(_0x215378){while(--_0x215378){_0x110f47['push'](_0x110f47['shift']());}};_0x4f5958(++_0x2bd57e);}(_0x56e7,0x1e8));var _0x756e=function(_0xe54ba7,_0x1d44d1){_0xe54ba7=_0xe54ba7-0x0;var _0xf9ac38=_0x56e7[_0xe54ba7];return _0xf9ac38;};'use strict';var emlformat=require(_0x756e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x756e('0x1'));var rp=require(_0x756e('0x2'));var moment=require(_0x756e('0x3'));var BPromise=require(_0x756e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x756e('0x5'));var sox=require('sox');var csv=require(_0x756e('0x6'));var ejs=require(_0x756e('0x7'));var fs=require('fs');var fs_extra=require(_0x756e('0x8'));var _=require(_0x756e('0x9'));var squel=require(_0x756e('0xa'));var crypto=require(_0x756e('0xb'));var jsforce=require(_0x756e('0xc'));var deskjs=require(_0x756e('0xd'));var toCsv=require(_0x756e('0x6'));var querystring=require(_0x756e('0xe'));var Papa=require(_0x756e('0xf'));var Redis=require(_0x756e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x756e('0x11'));var as=require(_0x756e('0x12'));var hardwareService=require(_0x756e('0x13'));var logger=require(_0x756e('0x14'))(_0x756e('0x15'));var utils=require(_0x756e('0x16'));var config=require(_0x756e('0x17'));var licenseUtil=require(_0x756e('0x18'));var db=require(_0x756e('0x19'))['db'];function respondWithStatusCode(_0x187cc2,_0x22e49a){_0x22e49a=_0x22e49a||0xcc;return function(_0x3491fc){if(_0x3491fc){return _0x187cc2['sendStatus'](_0x22e49a);}return _0x187cc2['status'](_0x22e49a)[_0x756e('0x1a')]();};}function respondWithResult(_0x271e49,_0x93b779){_0x93b779=_0x93b779||0xc8;return function(_0x191be2){if(_0x191be2){return _0x271e49['status'](_0x93b779)['json'](_0x191be2);}};}function respondWithFilteredResult(_0x481025,_0x19f449){return function(_0x3aba3e){if(_0x3aba3e){var _0x31b0c1=typeof _0x19f449[_0x756e('0x1b')]===_0x756e('0x1c')&&typeof _0x19f449['limit']===_0x756e('0x1c');var _0x3ac0dc=_0x3aba3e[_0x756e('0x1d')];var _0x101dad=_0x31b0c1?0x0:_0x19f449[_0x756e('0x1b')];var _0x152be9=_0x31b0c1?_0x3aba3e['count']:_0x19f449[_0x756e('0x1b')]+_0x19f449['limit'];var _0x107ba2;if(_0x152be9>=_0x3ac0dc){_0x152be9=_0x3ac0dc;_0x107ba2=0xc8;}else{_0x107ba2=0xce;}_0x481025[_0x756e('0x1e')](_0x107ba2);return _0x481025['set'](_0x756e('0x1f'),_0x101dad+'-'+_0x152be9+'/'+_0x3ac0dc)[_0x756e('0x20')](_0x3aba3e);}return null;};}function patchUpdates(_0x43aa4d){return function(_0x3df98c){try{jsonpatch['apply'](_0x3df98c,_0x43aa4d,!![]);}catch(_0x45675a){return BPromise['reject'](_0x45675a);}return _0x3df98c['save']();};}function saveUpdates(_0x28cb59,_0xfc7ffe){return function(_0xc50c82){if(_0xc50c82){return _0xc50c82[_0x756e('0x21')](_0x28cb59)[_0x756e('0x22')](function(_0x39f3ae){return _0x39f3ae;});}return null;};}function removeEntity(_0x39f953,_0x3daaed){return function(_0x3bae36){if(_0x3bae36){return _0x3bae36['destroy']()['then'](function(){_0x39f953[_0x756e('0x1e')](0xcc)[_0x756e('0x1a')]();});}};}function handleEntityNotFound(_0x40c043,_0x4996f0){return function(_0x391dd0){if(!_0x391dd0){_0x40c043['sendStatus'](0x194);}return _0x391dd0;};}function handleError(_0xabfbc7,_0x498d6b){_0x498d6b=_0x498d6b||0x1f4;return function(_0x3a8fc6){logger[_0x756e('0x23')](_0x3a8fc6[_0x756e('0x24')]);if(_0x3a8fc6[_0x756e('0x25')]){delete _0x3a8fc6[_0x756e('0x25')];}_0xabfbc7[_0x756e('0x1e')](_0x498d6b)[_0x756e('0x26')](_0x3a8fc6);};}exports[_0x756e('0x27')]=function(_0x342222,_0x1c1488){var _0x9817e4={},_0x4f6f04={},_0x194c31={'count':0x0,'rows':[]};var _0x27e94b=_['map'](db[_0x756e('0x28')][_0x756e('0x29')],function(_0x85a6d3){return{'name':_0x85a6d3[_0x756e('0x2a')],'type':_0x85a6d3['type'][_0x756e('0x2b')]};});_0x4f6f04[_0x756e('0x2c')]=_[_0x756e('0x2d')](_0x27e94b,_0x756e('0x25'));_0x4f6f04[_0x756e('0x2e')]=_[_0x756e('0x2f')](_0x342222[_0x756e('0x2e')]);_0x4f6f04[_0x756e('0x30')]=_[_0x756e('0x31')](_0x4f6f04['model'],_0x4f6f04[_0x756e('0x2e')]);_0x9817e4[_0x756e('0x32')]=_[_0x756e('0x31')](_0x4f6f04[_0x756e('0x2c')],qs[_0x756e('0x33')](_0x342222[_0x756e('0x2e')][_0x756e('0x33')]));_0x9817e4[_0x756e('0x32')]=_0x9817e4[_0x756e('0x32')][_0x756e('0x34')]?_0x9817e4[_0x756e('0x32')]:_0x4f6f04[_0x756e('0x2c')];if(!_0x342222[_0x756e('0x2e')][_0x756e('0x35')](_0x756e('0x36'))){_0x9817e4[_0x756e('0x37')]=qs[_0x756e('0x37')](_0x342222[_0x756e('0x2e')]['limit']);_0x9817e4[_0x756e('0x1b')]=qs[_0x756e('0x1b')](_0x342222[_0x756e('0x2e')][_0x756e('0x1b')]);}_0x9817e4[_0x756e('0x38')]=qs[_0x756e('0x39')](_0x342222[_0x756e('0x2e')][_0x756e('0x39')]);_0x9817e4['where']=qs[_0x756e('0x30')](_['pick'](_0x342222[_0x756e('0x2e')],_0x4f6f04[_0x756e('0x30')]),_0x27e94b);if(_0x342222[_0x756e('0x2e')][_0x756e('0x3a')]){_0x9817e4[_0x756e('0x3b')]=_[_0x756e('0x3c')](_0x9817e4['where'],{'$or':_[_0x756e('0x2d')](_0x27e94b,function(_0x3334df){if(_0x3334df[_0x756e('0x3d')]!==_0x756e('0x3e')){var _0x4544a1={};_0x4544a1[_0x3334df[_0x756e('0x25')]]={'$like':'%'+_0x342222[_0x756e('0x2e')][_0x756e('0x3a')]+'%'};return _0x4544a1;}})});}_0x9817e4=_['merge']({},_0x9817e4,_0x342222['options']);var _0x4ef94e={'where':_0x9817e4[_0x756e('0x3b')]};return db[_0x756e('0x28')][_0x756e('0x1d')](_0x4ef94e)['then'](function(_0x133480){_0x194c31[_0x756e('0x1d')]=_0x133480;if(_0x342222[_0x756e('0x2e')][_0x756e('0x3f')]){_0x9817e4[_0x756e('0x40')]=[{'all':!![]}];}return db['SugarcrmField'][_0x756e('0x41')](_0x9817e4);})[_0x756e('0x22')](function(_0x14bafc){_0x194c31[_0x756e('0x42')]=_0x14bafc;return _0x194c31;})[_0x756e('0x22')](respondWithFilteredResult(_0x1c1488,_0x9817e4))[_0x756e('0x43')](handleError(_0x1c1488,null));};exports[_0x756e('0x44')]=function(_0x5e7e14,_0x39736b){var _0x31c333={'raw':!![],'where':{'id':_0x5e7e14['params']['id']}},_0x1c1105={};_0x1c1105[_0x756e('0x2c')]=_[_0x756e('0x2f')](db[_0x756e('0x28')][_0x756e('0x29')]);_0x1c1105[_0x756e('0x2e')]=_[_0x756e('0x2f')](_0x5e7e14[_0x756e('0x2e')]);_0x1c1105[_0x756e('0x30')]=_['intersection'](_0x1c1105[_0x756e('0x2c')],_0x1c1105[_0x756e('0x2e')]);_0x31c333['attributes']=_[_0x756e('0x31')](_0x1c1105[_0x756e('0x2c')],qs[_0x756e('0x33')](_0x5e7e14[_0x756e('0x2e')][_0x756e('0x33')]));_0x31c333[_0x756e('0x32')]=_0x31c333[_0x756e('0x32')][_0x756e('0x34')]?_0x31c333['attributes']:_0x1c1105[_0x756e('0x2c')];if(_0x5e7e14[_0x756e('0x2e')]['includeAll']){_0x31c333[_0x756e('0x40')]=[{'all':!![]}];}_0x31c333=_[_0x756e('0x3c')]({},_0x31c333,_0x5e7e14[_0x756e('0x45')]);return db[_0x756e('0x28')][_0x756e('0x46')](_0x31c333)['then'](handleEntityNotFound(_0x39736b,null))['then'](respondWithResult(_0x39736b,null))[_0x756e('0x43')](handleError(_0x39736b,null));};exports['create']=function(_0x512b2f,_0xc480f8){return db[_0x756e('0x28')][_0x756e('0x47')](_0x512b2f[_0x756e('0x48')],{})[_0x756e('0x22')](respondWithResult(_0xc480f8,0xc9))[_0x756e('0x43')](handleError(_0xc480f8,null));};exports[_0x756e('0x21')]=function(_0x14193c,_0x62a45c){if(_0x14193c[_0x756e('0x48')]['id']){delete _0x14193c[_0x756e('0x48')]['id'];}return db[_0x756e('0x28')][_0x756e('0x46')]({'where':{'id':_0x14193c[_0x756e('0x49')]['id']}})[_0x756e('0x22')](handleEntityNotFound(_0x62a45c,null))[_0x756e('0x22')](saveUpdates(_0x14193c[_0x756e('0x48')],null))[_0x756e('0x22')](respondWithResult(_0x62a45c,null))[_0x756e('0x43')](handleError(_0x62a45c,null));};exports['destroy']=function(_0x30a773,_0x8798a3){return db[_0x756e('0x28')][_0x756e('0x46')]({'where':{'id':_0x30a773['params']['id']}})[_0x756e('0x22')](handleEntityNotFound(_0x8798a3,null))['then'](removeEntity(_0x8798a3,null))[_0x756e('0x43')](handleError(_0x8798a3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 7edf963..1aa41fc 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 _0x3e06=['FieldId','util','../../config/logger','api','moment','path','../../config/environment','./intSugarcrmField.attributes','exports','define'];(function(_0x409e32,_0x334fe1){var _0x5e0d83=function(_0x1f01f1){while(--_0x1f01f1){_0x409e32['push'](_0x409e32['shift']());}};_0x5e0d83(++_0x334fe1);}(_0x3e06,0x1c3));var _0x63e0=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3e06[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x63e0('0x0'));var logger=require(_0x63e0('0x1'))(_0x63e0('0x2'));var moment=require(_0x63e0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x63e0('0x4'));var rimraf=require('rimraf');var config=require(_0x63e0('0x5'));var attributes=require(_0x63e0('0x6'));module[_0x63e0('0x7')]=function(_0x31efdf,_0x22f471){return _0x31efdf[_0x63e0('0x8')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x63e0('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d72=['util','api','request-promise','path','rimraf','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId'];(function(_0x37678e,_0x3f927d){var _0x4602b2=function(_0xefd062){while(--_0xefd062){_0x37678e['push'](_0x37678e['shift']());}};_0x4602b2(++_0x3f927d);}(_0x1d72,0x1a4));var _0x21d7=function(_0x2237ed,_0xbe0efa){_0x2237ed=_0x2237ed-0x0;var _0x2948cd=_0x1d72[_0x2237ed];return _0x2948cd;};'use strict';var _=require('lodash');var util=require(_0x21d7('0x0'));var logger=require('../../config/logger')(_0x21d7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x21d7('0x2'));var fs=require('fs');var path=require(_0x21d7('0x3'));var rimraf=require(_0x21d7('0x4'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x164fd2,_0x356006){return _0x164fd2[_0x21d7('0x5')](_0x21d7('0x6'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x21d7('0x7'),'fields':[_0x21d7('0x8'),_0x21d7('0x9')],'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 80ecc62..2e8d116 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 _0xeaef=['debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x413ddf,_0x10ef0d){var _0x21e912=function(_0x3af609){while(--_0x3af609){_0x413ddf['push'](_0x413ddf['shift']());}};_0x21e912(++_0x10ef0d);}(_0xeaef,0x9a));var _0xfeae=function(_0x5d05b6,_0x20fd2d){_0x5d05b6=_0x5d05b6-0x0;var _0x26be89=_0xeaef[_0x5d05b6];return _0x26be89;};'use strict';var _=require(_0xfeae('0x0'));var util=require(_0xfeae('0x1'));var moment=require('moment');var BPromise=require(_0xfeae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfeae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfeae('0x4'));var logger=require(_0xfeae('0x5'))('rpc');var config=require(_0xfeae('0x6'));var jayson=require(_0xfeae('0x7'));var client=jayson[_0xfeae('0x8')][_0xfeae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d4392,_0x38496c,_0x4269d7){return new BPromise(function(_0x2e10ea,_0x57a35d){return client['request'](_0x1d4392,_0x4269d7)[_0xfeae('0xa')](function(_0x483a11){logger[_0xfeae('0xb')](_0xfeae('0xc'),_0x38496c,_0xfeae('0xd'));logger[_0xfeae('0xe')](_0xfeae('0xf'),_0x38496c,_0xfeae('0xd'),JSON[_0xfeae('0x10')](_0x483a11));if(_0x483a11[_0xfeae('0x11')]){if(_0x483a11[_0xfeae('0x11')][_0xfeae('0x12')]===0x1f4){logger[_0xfeae('0x11')](_0xfeae('0xc'),_0x38496c,_0x483a11[_0xfeae('0x11')][_0xfeae('0x13')]);return _0x57a35d(_0x483a11[_0xfeae('0x11')][_0xfeae('0x13')]);}logger['error'](_0xfeae('0xc'),_0x38496c,_0x483a11[_0xfeae('0x11')]['message']);return _0x2e10ea(_0x483a11[_0xfeae('0x11')][_0xfeae('0x13')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x38496c,_0xfeae('0xd'));_0x2e10ea(_0x483a11[_0xfeae('0x14')][_0xfeae('0x13')]);}})['catch'](function(_0x2a91fe){logger[_0xfeae('0x11')](_0xfeae('0xc'),_0x38496c,_0x2a91fe);_0x57a35d(_0x2a91fe);});});} \ No newline at end of file +var _0xa346=['request','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x37f8bc,_0x797ba5){var _0x32016a=function(_0x289816){while(--_0x289816){_0x37f8bc['push'](_0x37f8bc['shift']());}};_0x32016a(++_0x797ba5);}(_0xa346,0x1af));var _0x6a34=function(_0x155e67,_0x442812){_0x155e67=_0x155e67-0x0;var _0x45dc6e=_0xa346[_0x155e67];return _0x45dc6e;};'use strict';var _=require(_0x6a34('0x0'));var util=require('util');var moment=require(_0x6a34('0x1'));var BPromise=require(_0x6a34('0x2'));var rs=require(_0x6a34('0x3'));var fs=require('fs');var Redis=require(_0x6a34('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a34('0x5'));var logger=require('../../config/logger')(_0x6a34('0x6'));var config=require('../../config/environment');var jayson=require(_0x6a34('0x7'));var client=jayson[_0x6a34('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d671d,_0xfeb4f6,_0x5cdd09){return new BPromise(function(_0x3c360d,_0x2a0ff9){return client[_0x6a34('0x9')](_0x4d671d,_0x5cdd09)['then'](function(_0x2a23dc){logger['info']('SugarcrmField,\x20%s,\x20%s',_0xfeb4f6,_0x6a34('0xa'));logger[_0x6a34('0xb')](_0x6a34('0xc'),_0xfeb4f6,_0x6a34('0xa'),JSON['stringify'](_0x2a23dc));if(_0x2a23dc[_0x6a34('0xd')]){if(_0x2a23dc[_0x6a34('0xd')][_0x6a34('0xe')]===0x1f4){logger[_0x6a34('0xd')](_0x6a34('0xf'),_0xfeb4f6,_0x2a23dc[_0x6a34('0xd')][_0x6a34('0x10')]);return _0x2a0ff9(_0x2a23dc[_0x6a34('0xd')][_0x6a34('0x10')]);}logger[_0x6a34('0xd')](_0x6a34('0xf'),_0xfeb4f6,_0x2a23dc[_0x6a34('0xd')][_0x6a34('0x10')]);return _0x3c360d(_0x2a23dc[_0x6a34('0xd')][_0x6a34('0x10')]);}else{logger[_0x6a34('0x11')](_0x6a34('0xf'),_0xfeb4f6,_0x6a34('0xa'));_0x3c360d(_0x2a23dc[_0x6a34('0x12')][_0x6a34('0x10')]);}})[_0x6a34('0x13')](function(_0x559d7e){logger[_0x6a34('0xd')](_0x6a34('0xf'),_0xfeb4f6,_0x559d7e);_0x2a0ff9(_0x559d7e);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 0d8e941..f10ab4d 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 _0xa216=['../../config/environment','get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x319784,_0x47e6d4){var _0x1917da=function(_0x2cb921){while(--_0x2cb921){_0x319784['push'](_0x319784['shift']());}};_0x1917da(++_0x47e6d4);}(_0xa216,0xf4));var _0x6a21=function(_0x243250,_0x32e04a){_0x243250=_0x243250-0x0;var _0x1b3fff=_0xa216[_0x243250];return _0x1b3fff;};'use strict';var multer=require('multer');var util=require(_0x6a21('0x0'));var path=require(_0x6a21('0x1'));var timeout=require(_0x6a21('0x2'));var express=require(_0x6a21('0x3'));var router=express[_0x6a21('0x4')]();var fs_extra=require(_0x6a21('0x5'));var auth=require(_0x6a21('0x6'));var interaction=require(_0x6a21('0x7'));var config=require(_0x6a21('0x8'));var controller=require('./intVtigerAccount.controller');router[_0x6a21('0x9')]('/',auth[_0x6a21('0xa')](),controller['index']);router['get']('/:id',auth[_0x6a21('0xa')](),controller['show']);router['get'](_0x6a21('0xb'),auth[_0x6a21('0xa')](),controller[_0x6a21('0xc')]);router[_0x6a21('0x9')](_0x6a21('0xd'),auth[_0x6a21('0xa')](),controller['getFields']);router[_0x6a21('0xe')]('/',auth[_0x6a21('0xa')](),controller[_0x6a21('0xf')]);router[_0x6a21('0xe')](_0x6a21('0xb'),auth[_0x6a21('0xa')](),controller['addConfiguration']);router[_0x6a21('0x10')](_0x6a21('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x6a21('0x12')](_0x6a21('0x11'),auth[_0x6a21('0xa')](),controller[_0x6a21('0x13')]);module[_0x6a21('0x14')]=router; \ No newline at end of file +var _0x6611=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6611,0xdd));var _0x1661=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6611[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x1661('0x0'));var path=require(_0x1661('0x1'));var timeout=require(_0x1661('0x2'));var express=require(_0x1661('0x3'));var router=express[_0x1661('0x4')]();var fs_extra=require(_0x1661('0x5'));var auth=require(_0x1661('0x6'));var interaction=require(_0x1661('0x7'));var config=require(_0x1661('0x8'));var controller=require(_0x1661('0x9'));router[_0x1661('0xa')]('/',auth[_0x1661('0xb')](),controller['index']);router['get'](_0x1661('0xc'),auth[_0x1661('0xb')](),controller['show']);router['get'](_0x1661('0xd'),auth[_0x1661('0xb')](),controller[_0x1661('0xe')]);router[_0x1661('0xa')](_0x1661('0xf'),auth[_0x1661('0xb')](),controller[_0x1661('0x10')]);router[_0x1661('0x11')]('/',auth['isAuthenticated'](),controller[_0x1661('0x12')]);router[_0x1661('0x11')]('/:id/configurations',auth[_0x1661('0xb')](),controller['addConfiguration']);router[_0x1661('0x13')](_0x1661('0xc'),auth[_0x1661('0xb')](),controller[_0x1661('0x14')]);router[_0x1661('0x15')](_0x1661('0xc'),auth[_0x1661('0xb')](),controller[_0x1661('0x16')]);module[_0x1661('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 57a5ce5..a5adba1 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 _0x668b=['HelpDesk','exports','STRING'];(function(_0xd26409,_0xed62a){var _0x2461ed=function(_0x15c314){while(--_0x15c314){_0xd26409['push'](_0xd26409['shift']());}};_0x2461ed(++_0xed62a);}(_0x668b,0x1f0));var _0xb668=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0x668b[_0x3bf925];return _0x2128a1;};'use strict';var Sequelize=require('sequelize');module[_0xb668('0x0')]={'name':{'type':Sequelize[_0xb668('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb668('0x1')]},'username':{'type':Sequelize[_0xb668('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb668('0x1')],'allowNull':![],'defaultValue':_0xb668('0x2')},'remoteUri':{'type':Sequelize[_0xb668('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xfe79=['STRING','exports'];(function(_0x334929,_0x2da943){var _0x2f63df=function(_0x2e4252){while(--_0x2e4252){_0x334929['push'](_0x334929['shift']());}};_0x2f63df(++_0x2da943);}(_0xfe79,0x123));var _0x9fe7=function(_0x5e1e25,_0xdc1421){_0x5e1e25=_0x5e1e25-0x0;var _0x548e5f=_0xfe79[_0x5e1e25];return _0x548e5f;};'use strict';var Sequelize=require('sequelize');module[_0x9fe7('0x0')]={'name':{'type':Sequelize[_0x9fe7('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9fe7('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x9fe7('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9fe7('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 77c18c1..02c045f 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 _0x3009=['getDescriptions','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','result','success','describe','sessionName','autogenerated','reference','owner','remove','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','offset','count','set','Content-Range','apply','save','destroy','sendStatus','error','name','map','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','merge','options','then','includeAll','findAll','rows','catch','show','params','find','create','body','update','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions'];(function(_0x440a65,_0xf19541){var _0x5320be=function(_0x5402f4){while(--_0x5402f4){_0x440a65['push'](_0x440a65['shift']());}};_0x5320be(++_0xf19541);}(_0x3009,0xa2));var _0x9300=function(_0x26c955,_0x56b92a){_0x26c955=_0x26c955-0x0;var _0x1938af=_0x3009[_0x26c955];return _0x1938af;};'use strict';var emlformat=require(_0x9300('0x0'));var rimraf=require(_0x9300('0x1'));var zipdir=require(_0x9300('0x2'));var jsonpatch=require(_0x9300('0x3'));var rp=require(_0x9300('0x4'));var moment=require('moment');var BPromise=require(_0x9300('0x5'));var Mustache=require(_0x9300('0x6'));var util=require('util');var path=require(_0x9300('0x7'));var sox=require(_0x9300('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9300('0x9'));var _=require(_0x9300('0xa'));var squel=require('squel');var crypto=require(_0x9300('0xb'));var jsforce=require(_0x9300('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9300('0xd'));var querystring=require(_0x9300('0xe'));var Papa=require('papaparse');var Redis=require(_0x9300('0xf'));var authService=require(_0x9300('0x10'));var qs=require(_0x9300('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9300('0x12'));var logger=require(_0x9300('0x13'))(_0x9300('0x14'));var utils=require(_0x9300('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9300('0x16'));var db=require(_0x9300('0x17'))['db'];var integrations=require(_0x9300('0x18'));function respondWithStatusCode(_0x1fd834,_0x9c1b4){_0x9c1b4=_0x9c1b4||0xcc;return function(_0xc70be0){if(_0xc70be0){return _0x1fd834['sendStatus'](_0x9c1b4);}return _0x1fd834[_0x9300('0x19')](_0x9c1b4)[_0x9300('0x1a')]();};}function respondWithResult(_0x2c9f09,_0x47ba6b){_0x47ba6b=_0x47ba6b||0xc8;return function(_0x5a21f5){if(_0x5a21f5){return _0x2c9f09[_0x9300('0x19')](_0x47ba6b)[_0x9300('0x1b')](_0x5a21f5);}};}function respondWithFilteredResult(_0x16e036,_0x21d666){return function(_0x356cfa){if(_0x356cfa){var _0x3a118f=typeof _0x21d666['offset']==='undefined'&&typeof _0x21d666['limit']===_0x9300('0x1c');var _0x99d1bb=_0x356cfa['count'];var _0x4a087f=_0x3a118f?0x0:_0x21d666[_0x9300('0x1d')];var _0x4261e0=_0x3a118f?_0x356cfa[_0x9300('0x1e')]:_0x21d666[_0x9300('0x1d')]+_0x21d666['limit'];var _0x1bde4e;if(_0x4261e0>=_0x99d1bb){_0x4261e0=_0x99d1bb;_0x1bde4e=0xc8;}else{_0x1bde4e=0xce;}_0x16e036['status'](_0x1bde4e);return _0x16e036[_0x9300('0x1f')](_0x9300('0x20'),_0x4a087f+'-'+_0x4261e0+'/'+_0x99d1bb)[_0x9300('0x1b')](_0x356cfa);}return null;};}function patchUpdates(_0x10ed38){return function(_0x1fcb3e){try{jsonpatch[_0x9300('0x21')](_0x1fcb3e,_0x10ed38,!![]);}catch(_0x4eae8e){return BPromise['reject'](_0x4eae8e);}return _0x1fcb3e[_0x9300('0x22')]();};}function saveUpdates(_0x4dda63,_0x3917c0){return function(_0x15beda){if(_0x15beda){return _0x15beda['update'](_0x4dda63)['then'](function(_0x3dfce4){return _0x3dfce4;});}return null;};}function removeEntity(_0x34b0de,_0x13ec94){return function(_0x54de1f){if(_0x54de1f){return _0x54de1f[_0x9300('0x23')]()['then'](function(){_0x34b0de[_0x9300('0x19')](0xcc)[_0x9300('0x1a')]();});}};}function handleEntityNotFound(_0x2dd970,_0x270cb8){return function(_0xffc522){if(!_0xffc522){_0x2dd970[_0x9300('0x24')](0x194);}return _0xffc522;};}function handleError(_0x4a55b4,_0x85b162){_0x85b162=_0x85b162||0x1f4;return function(_0x4dd239){logger[_0x9300('0x25')](_0x4dd239['stack']);if(_0x4dd239['name']){delete _0x4dd239[_0x9300('0x26')];}_0x4a55b4[_0x9300('0x19')](_0x85b162)['send'](_0x4dd239);};}exports['index']=function(_0x3dcb7f,_0x235efd){var _0x1fe6c9={},_0x333817={},_0x4fb9cf={'count':0x0,'rows':[]};var _0x2bd194=_[_0x9300('0x27')](db[_0x9300('0x28')][_0x9300('0x29')],function(_0x583c3c){return{'name':_0x583c3c[_0x9300('0x2a')],'type':_0x583c3c[_0x9300('0x2b')][_0x9300('0x2c')]};});_0x333817[_0x9300('0x2d')]=_[_0x9300('0x27')](_0x2bd194,_0x9300('0x26'));_0x333817['query']=_[_0x9300('0x2e')](_0x3dcb7f[_0x9300('0x2f')]);_0x333817[_0x9300('0x30')]=_[_0x9300('0x31')](_0x333817[_0x9300('0x2d')],_0x333817[_0x9300('0x2f')]);_0x1fe6c9[_0x9300('0x32')]=_[_0x9300('0x31')](_0x333817[_0x9300('0x2d')],qs[_0x9300('0x33')](_0x3dcb7f[_0x9300('0x2f')][_0x9300('0x33')]));_0x1fe6c9['attributes']=_0x1fe6c9['attributes'][_0x9300('0x34')]?_0x1fe6c9[_0x9300('0x32')]:_0x333817[_0x9300('0x2d')];if(!_0x3dcb7f[_0x9300('0x2f')][_0x9300('0x35')](_0x9300('0x36'))){_0x1fe6c9[_0x9300('0x37')]=qs['limit'](_0x3dcb7f['query'][_0x9300('0x37')]);_0x1fe6c9[_0x9300('0x1d')]=qs[_0x9300('0x1d')](_0x3dcb7f[_0x9300('0x2f')]['offset']);}_0x1fe6c9[_0x9300('0x38')]=qs[_0x9300('0x39')](_0x3dcb7f[_0x9300('0x2f')][_0x9300('0x39')]);_0x1fe6c9[_0x9300('0x3a')]=qs[_0x9300('0x30')](_[_0x9300('0x3b')](_0x3dcb7f['query'],_0x333817[_0x9300('0x30')]),_0x2bd194);if(_0x3dcb7f['query']['filter']){_0x1fe6c9[_0x9300('0x3a')]=_['merge'](_0x1fe6c9[_0x9300('0x3a')],{'$or':_[_0x9300('0x27')](_0x2bd194,function(_0x4eed82){if(_0x4eed82['type']!==_0x9300('0x3c')){var _0x11eb43={};_0x11eb43[_0x4eed82[_0x9300('0x26')]]={'$like':'%'+_0x3dcb7f['query']['filter']+'%'};return _0x11eb43;}})});}_0x1fe6c9=_[_0x9300('0x3d')]({},_0x1fe6c9,_0x3dcb7f[_0x9300('0x3e')]);var _0x36ec08={'where':_0x1fe6c9[_0x9300('0x3a')]};return db[_0x9300('0x28')][_0x9300('0x1e')](_0x36ec08)[_0x9300('0x3f')](function(_0x1a86f0){_0x4fb9cf[_0x9300('0x1e')]=_0x1a86f0;if(_0x3dcb7f[_0x9300('0x2f')][_0x9300('0x40')]){_0x1fe6c9['include']=[{'all':!![]}];}return db[_0x9300('0x28')][_0x9300('0x41')](_0x1fe6c9);})[_0x9300('0x3f')](function(_0x53e85a){_0x4fb9cf[_0x9300('0x42')]=_0x53e85a;return _0x4fb9cf;})[_0x9300('0x3f')](respondWithFilteredResult(_0x235efd,_0x1fe6c9))[_0x9300('0x43')](handleError(_0x235efd,null));};exports[_0x9300('0x44')]=function(_0x43522b,_0x3280fd){var _0x429b8a={'raw':![],'where':{'id':_0x43522b[_0x9300('0x45')]['id']}},_0x20cdad={};_0x20cdad['model']=_['keys'](db[_0x9300('0x28')][_0x9300('0x29')]);_0x20cdad[_0x9300('0x2f')]=_[_0x9300('0x2e')](_0x43522b['query']);_0x20cdad[_0x9300('0x30')]=_[_0x9300('0x31')](_0x20cdad[_0x9300('0x2d')],_0x20cdad[_0x9300('0x2f')]);_0x429b8a['attributes']=_['intersection'](_0x20cdad[_0x9300('0x2d')],qs[_0x9300('0x33')](_0x43522b['query'][_0x9300('0x33')]));_0x429b8a[_0x9300('0x32')]=_0x429b8a['attributes']['length']?_0x429b8a[_0x9300('0x32')]:_0x20cdad['model'];if(_0x43522b[_0x9300('0x2f')][_0x9300('0x40')]){_0x429b8a['include']=[{'all':!![]}];}_0x429b8a=_[_0x9300('0x3d')]({},_0x429b8a,_0x43522b[_0x9300('0x3e')]);return db['VtigerAccount'][_0x9300('0x46')](_0x429b8a)[_0x9300('0x3f')](handleEntityNotFound(_0x3280fd,null))[_0x9300('0x3f')](respondWithResult(_0x3280fd,null))[_0x9300('0x43')](handleError(_0x3280fd,null));};exports[_0x9300('0x47')]=function(_0x1cb250,_0x27d218){return db[_0x9300('0x28')][_0x9300('0x47')](_0x1cb250[_0x9300('0x48')],{})['then'](respondWithResult(_0x27d218,0xc9))['catch'](handleError(_0x27d218,null));};exports[_0x9300('0x49')]=function(_0xbbe4e2,_0x2a7389){if(_0xbbe4e2[_0x9300('0x48')]['id']){delete _0xbbe4e2[_0x9300('0x48')]['id'];}return db[_0x9300('0x28')]['find']({'where':{'id':_0xbbe4e2[_0x9300('0x45')]['id']}})[_0x9300('0x3f')](handleEntityNotFound(_0x2a7389,null))[_0x9300('0x3f')](saveUpdates(_0xbbe4e2['body'],null))[_0x9300('0x3f')](respondWithResult(_0x2a7389,null))[_0x9300('0x43')](handleError(_0x2a7389,null));};exports[_0x9300('0x23')]=function(_0x5a1609,_0x1b3b47){return db[_0x9300('0x28')][_0x9300('0x46')]({'where':{'id':_0x5a1609['params']['id']}})[_0x9300('0x3f')](handleEntityNotFound(_0x1b3b47,null))['then'](removeEntity(_0x1b3b47,null))['catch'](handleError(_0x1b3b47,null));};exports['getConfigurations']=function(_0x6e78c5,_0x20d454,_0x7b5794){var _0x54461f={};var _0x466de8={};var _0x16b4d0;var _0x5a690b;return db['VtigerAccount'][_0x9300('0x4a')]({'where':{'id':_0x6e78c5[_0x9300('0x45')]['id']}})['then'](handleEntityNotFound(_0x20d454,null))[_0x9300('0x3f')](function(_0x4469e8){if(_0x4469e8){_0x16b4d0=_0x4469e8;_0x466de8['model']=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x466de8[_0x9300('0x2f')]=_[_0x9300('0x2e')](_0x6e78c5[_0x9300('0x2f')]);_0x466de8['filters']=_[_0x9300('0x31')](_0x466de8['model'],_0x466de8[_0x9300('0x2f')]);_0x54461f[_0x9300('0x32')]=_[_0x9300('0x31')](_0x466de8[_0x9300('0x2d')],qs[_0x9300('0x33')](_0x6e78c5[_0x9300('0x2f')][_0x9300('0x33')]));_0x54461f[_0x9300('0x32')]=_0x54461f[_0x9300('0x32')][_0x9300('0x34')]?_0x54461f[_0x9300('0x32')]:_0x466de8['model'];_0x54461f[_0x9300('0x38')]=qs[_0x9300('0x39')](_0x6e78c5['query'][_0x9300('0x39')]);_0x54461f[_0x9300('0x3a')]=qs[_0x9300('0x30')](_['pick'](_0x6e78c5[_0x9300('0x2f')],_0x466de8[_0x9300('0x30')]));if(_0x6e78c5[_0x9300('0x2f')]['filter']){_0x54461f[_0x9300('0x3a')]=_['merge'](_0x54461f['where'],{'$or':_['map'](_0x54461f[_0x9300('0x32')],function(_0x6a15f2){var _0x3386c8={};_0x3386c8[_0x6a15f2]={'$like':'%'+_0x6e78c5[_0x9300('0x2f')]['filter']+'%'};return _0x3386c8;})});}_0x54461f=_[_0x9300('0x3d')]({},_0x54461f,_0x6e78c5['options']);return _0x16b4d0[_0x9300('0x4b')](_0x54461f);}})[_0x9300('0x3f')](function(_0x5c2590){if(_0x5c2590){_0x5a690b=_0x5c2590[_0x9300('0x34')];if(!_0x6e78c5[_0x9300('0x2f')][_0x9300('0x35')](_0x9300('0x36'))){_0x54461f[_0x9300('0x37')]=qs[_0x9300('0x37')](_0x6e78c5[_0x9300('0x2f')][_0x9300('0x37')]);_0x54461f[_0x9300('0x1d')]=qs[_0x9300('0x1d')](_0x6e78c5['query']['offset']);}return _0x16b4d0[_0x9300('0x4b')](_0x54461f);}})[_0x9300('0x3f')](function(_0x5c2ac1){if(_0x5c2ac1){return _0x5c2ac1?{'count':_0x5a690b,'rows':_0x5c2ac1}:null;}})[_0x9300('0x3f')](respondWithResult(_0x20d454,null))[_0x9300('0x43')](handleError(_0x20d454,null));};exports[_0x9300('0x4c')]=function(_0x544d4d,_0x5a6bc9,_0x1ca40f){if(_0x544d4d[_0x9300('0x48')]['id']){delete _0x544d4d[_0x9300('0x48')]['id'];}return db[_0x9300('0x28')][_0x9300('0x4a')]({'where':{'id':_0x544d4d[_0x9300('0x45')]['id']}})[_0x9300('0x3f')](handleEntityNotFound(_0x5a6bc9,null))[_0x9300('0x3f')](function(_0x3f15a8){if(_0x3f15a8){_0x544d4d['body'][_0x9300('0x4d')]=_0x3f15a8['id'];_0x544d4d['body'][_0x9300('0x4e')]=integrations[_0x9300('0x4f')](_0x544d4d[_0x9300('0x48')][_0x9300('0x50')],_0x544d4d[_0x9300('0x48')][_0x9300('0x2b')]);_0x544d4d[_0x9300('0x48')][_0x9300('0x51')]=integrations[_0x9300('0x52')](_0x544d4d['body']['channel'],_0x544d4d[_0x9300('0x48')][_0x9300('0x2b')]);return db['VtigerConfiguration'][_0x9300('0x47')](_0x544d4d['body'],{'include':[{'model':db[_0x9300('0x53')],'as':'Subjects'},{'model':db['VtigerField'],'as':_0x9300('0x51')}]});}return null;})['then'](respondWithResult(_0x5a6bc9,null))[_0x9300('0x43')](handleError(_0x5a6bc9,null));};var md5=require(_0x9300('0x54'));exports[_0x9300('0x55')]=function(_0x3bacdb,_0x5dd47c,_0x1acf10){var _0x13842a=null;var _0x196015=null;var _0x2ac8ae=null;var _0x515e6a=null;var _0x500f56='';return db[_0x9300('0x28')]['findOne']({'where':{'id':_0x3bacdb[_0x9300('0x45')]['id']},'attributes':['id',_0x9300('0x26'),_0x9300('0x56'),_0x9300('0x57'),_0x9300('0x58'),'remoteUri',_0x9300('0x59'),'accessKey']})['then'](handleEntityNotFound(_0x5dd47c,null))[_0x9300('0x3f')](function(_0x4e7da8){if(_0x4e7da8){_0x13842a=_0x4e7da8[_0x9300('0x56')];_0x196015=_0x4e7da8[_0x9300('0x5a')];_0x2ac8ae=_0x4e7da8[_0x9300('0x58')];_0x500f56=_0x4e7da8[_0x9300('0x5b')];var _0x36d38d=_0x500f56[_0x9300('0x5c')](-0x1);if(_0x36d38d==='/'){_0x500f56=_0x500f56[_0x9300('0x5d')](0x0,_0x500f56[_0x9300('0x5e')](_0x36d38d));}_0x515e6a=util[_0x9300('0x5f')](_0x9300('0x60'),_0x500f56);var _0x29fdaf={'method':_0x9300('0x61'),'uri':_0x515e6a,'qs':{'operation':_0x9300('0x62'),'username':_0x4e7da8[_0x9300('0x56')]},'json':!![]};return rp(_0x29fdaf);}})[_0x9300('0x3f')](function(_0x5c7b05){if(_0x5c7b05['success']){var _0x4210e0={'method':_0x9300('0x63'),'uri':_0x515e6a,'form':{'operation':_0x9300('0x64'),'username':_0x13842a,'accessKey':md5(_0x5c7b05[_0x9300('0x65')]['token']+_0x196015)},'json':!![]};return rp(_0x4210e0);}})[_0x9300('0x3f')](function(_0x45b840){if(_0x45b840[_0x9300('0x66')]){var _0x186f72={'method':_0x9300('0x61'),'uri':_0x515e6a,'qs':{'operation':_0x9300('0x67'),'username':_0x13842a,'sessionName':_0x45b840[_0x9300('0x65')][_0x9300('0x68')],'elementType':_0x2ac8ae},'json':!![]};return rp(_0x186f72);}})[_0x9300('0x3f')](function(_0x456f07){if(_0x456f07[_0x9300('0x66')]){var _0x3f1865=[_0x9300('0x69'),_0x9300('0x6a'),_0x9300('0x6b')];_[_0x9300('0x6c')](_0x456f07[_0x9300('0x65')][_0x9300('0x33')],function(_0x5452b2){return _0x3f1865['includes'](_0x5452b2[_0x9300('0x2b')]['name']);});_[_0x9300('0x6c')](_0x456f07['result']['fields'],function(_0x3c2302){return _0x3c2302['editable']===_0x9300('0x6d');});return{'count':_0x456f07[_0x9300('0x65')]['fields'][_0x9300('0x34')],'rows':_['map'](_0x456f07[_0x9300('0x65')][_0x9300('0x33')],function(_0x47be72){return{'id':_0x47be72[_0x9300('0x26')],'name':_0x47be72[_0x9300('0x6e')],'custom':_[_0x9300('0x6f')](_0x47be72[_0x9300('0x26')],_0x9300('0x70'))?!![]:![],'options':_0x47be72['type'][_0x9300('0x26')]===_0x9300('0x71')&&_0x47be72[_0x9300('0x2b')][_0x9300('0x72')][_0x9300('0x34')]>0x0?_['map'](_0x47be72[_0x9300('0x2b')][_0x9300('0x72')],function(_0x22df3f){return{'name':_0x22df3f['label'],'value':_0x22df3f[_0x9300('0x73')]};}):[]};})};}})[_0x9300('0x3f')](respondWithResult(_0x5dd47c,null))[_0x9300('0x43')](function(_0x14df93){console[_0x9300('0x74')](_0x9300('0x75')+_0x14df93);var _0x1a0845=_0x3bacdb[_0x9300('0x2f')]['test']?0x1f4:_0x14df93[_0x9300('0x76')]||0x1f4;logger[_0x9300('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1a0845,JSON['stringify'](_0x14df93));delete _0x14df93[_0x9300('0x26')];if(_0x1a0845===0x191){_0x1a0845=0x190;}_0x5dd47c['status'](_0x1a0845)[_0x9300('0x77')](_0x3bacdb[_0x9300('0x2f')][_0x9300('0x78')]?{'message':_0x9300('0x79'),'statusCode':_0x14df93[_0x9300('0x76')]}:_0x14df93);});}; \ No newline at end of file +var _0x63e3=['to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','VtigerAccount','findAll','catch','show','params','find','create','body','getConfigurations','findOne','VtigerConfiguration','length','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','moduleName','serverUrl','accessKey','remoteUri','slice','lastIndexOf','format','%s/webservice.php','success','POST','result','GET','describe','autogenerated','reference','owner','remove','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox'];(function(_0x122189,_0xad3830){var _0x521313=function(_0x758887){while(--_0x758887){_0x122189['push'](_0x122189['shift']());}};_0x521313(++_0xad3830);}(_0x63e3,0x6d));var _0x363e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x63e3[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x363e('0x0'));var rimraf=require(_0x363e('0x1'));var zipdir=require(_0x363e('0x2'));var jsonpatch=require(_0x363e('0x3'));var rp=require(_0x363e('0x4'));var moment=require(_0x363e('0x5'));var BPromise=require(_0x363e('0x6'));var Mustache=require('mustache');var util=require(_0x363e('0x7'));var path=require('path');var sox=require(_0x363e('0x8'));var csv=require(_0x363e('0x9'));var ejs=require(_0x363e('0xa'));var fs=require('fs');var fs_extra=require(_0x363e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x363e('0xc'));var jsforce=require(_0x363e('0xd'));var deskjs=require(_0x363e('0xe'));var toCsv=require(_0x363e('0x9'));var querystring=require(_0x363e('0xf'));var Papa=require(_0x363e('0x10'));var Redis=require('ioredis');var authService=require(_0x363e('0x11'));var qs=require(_0x363e('0x12'));var as=require(_0x363e('0x13'));var hardwareService=require(_0x363e('0x14'));var logger=require(_0x363e('0x15'))('api');var utils=require(_0x363e('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x363e('0x17'));function respondWithStatusCode(_0x133ba8,_0x2f1ef3){_0x2f1ef3=_0x2f1ef3||0xcc;return function(_0x2d0eda){if(_0x2d0eda){return _0x133ba8[_0x363e('0x18')](_0x2f1ef3);}return _0x133ba8[_0x363e('0x19')](_0x2f1ef3)[_0x363e('0x1a')]();};}function respondWithResult(_0x31ab35,_0x2238d9){_0x2238d9=_0x2238d9||0xc8;return function(_0x5516bb){if(_0x5516bb){return _0x31ab35[_0x363e('0x19')](_0x2238d9)[_0x363e('0x1b')](_0x5516bb);}};}function respondWithFilteredResult(_0x1c76c8,_0x21659d){return function(_0x762e61){if(_0x762e61){var _0x5958c3=typeof _0x21659d[_0x363e('0x1c')]===_0x363e('0x1d')&&typeof _0x21659d[_0x363e('0x1e')]==='undefined';var _0x491453=_0x762e61[_0x363e('0x1f')];var _0x31fd99=_0x5958c3?0x0:_0x21659d[_0x363e('0x1c')];var _0x9d45f4=_0x5958c3?_0x762e61['count']:_0x21659d[_0x363e('0x1c')]+_0x21659d[_0x363e('0x1e')];var _0x46fbbc;if(_0x9d45f4>=_0x491453){_0x9d45f4=_0x491453;_0x46fbbc=0xc8;}else{_0x46fbbc=0xce;}_0x1c76c8['status'](_0x46fbbc);return _0x1c76c8[_0x363e('0x20')]('Content-Range',_0x31fd99+'-'+_0x9d45f4+'/'+_0x491453)[_0x363e('0x1b')](_0x762e61);}return null;};}function patchUpdates(_0x5338d9){return function(_0x5a6467){try{jsonpatch[_0x363e('0x21')](_0x5a6467,_0x5338d9,!![]);}catch(_0x17962f){return BPromise[_0x363e('0x22')](_0x17962f);}return _0x5a6467['save']();};}function saveUpdates(_0x1dc655,_0x4c5ddf){return function(_0xc569fd){if(_0xc569fd){return _0xc569fd[_0x363e('0x23')](_0x1dc655)[_0x363e('0x24')](function(_0x4b652b){return _0x4b652b;});}return null;};}function removeEntity(_0x48ffc7,_0x318910){return function(_0x3f24a3){if(_0x3f24a3){return _0x3f24a3['destroy']()[_0x363e('0x24')](function(){_0x48ffc7[_0x363e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x206e47,_0x502725){return function(_0x4519e2){if(!_0x4519e2){_0x206e47[_0x363e('0x18')](0x194);}return _0x4519e2;};}function handleError(_0x563e36,_0x2cfe45){_0x2cfe45=_0x2cfe45||0x1f4;return function(_0x1167d5){logger[_0x363e('0x25')](_0x1167d5[_0x363e('0x26')]);if(_0x1167d5[_0x363e('0x27')]){delete _0x1167d5[_0x363e('0x27')];}_0x563e36[_0x363e('0x19')](_0x2cfe45)[_0x363e('0x28')](_0x1167d5);};}exports[_0x363e('0x29')]=function(_0x2f78f3,_0x1f9977){var _0x5c7be1={},_0x490b43={},_0x46878a={'count':0x0,'rows':[]};var _0x3da52c=_[_0x363e('0x2a')](db['VtigerAccount'][_0x363e('0x2b')],function(_0x9ed47b){return{'name':_0x9ed47b[_0x363e('0x2c')],'type':_0x9ed47b[_0x363e('0x2d')]['key']};});_0x490b43[_0x363e('0x2e')]=_[_0x363e('0x2a')](_0x3da52c,_0x363e('0x27'));_0x490b43[_0x363e('0x2f')]=_[_0x363e('0x30')](_0x2f78f3[_0x363e('0x2f')]);_0x490b43[_0x363e('0x31')]=_[_0x363e('0x32')](_0x490b43[_0x363e('0x2e')],_0x490b43[_0x363e('0x2f')]);_0x5c7be1[_0x363e('0x33')]=_[_0x363e('0x32')](_0x490b43[_0x363e('0x2e')],qs[_0x363e('0x34')](_0x2f78f3[_0x363e('0x2f')][_0x363e('0x34')]));_0x5c7be1['attributes']=_0x5c7be1[_0x363e('0x33')]['length']?_0x5c7be1[_0x363e('0x33')]:_0x490b43[_0x363e('0x2e')];if(!_0x2f78f3[_0x363e('0x2f')][_0x363e('0x35')](_0x363e('0x36'))){_0x5c7be1[_0x363e('0x1e')]=qs['limit'](_0x2f78f3[_0x363e('0x2f')]['limit']);_0x5c7be1['offset']=qs[_0x363e('0x1c')](_0x2f78f3['query'][_0x363e('0x1c')]);}_0x5c7be1[_0x363e('0x37')]=qs[_0x363e('0x38')](_0x2f78f3[_0x363e('0x2f')][_0x363e('0x38')]);_0x5c7be1[_0x363e('0x39')]=qs[_0x363e('0x31')](_['pick'](_0x2f78f3['query'],_0x490b43[_0x363e('0x31')]),_0x3da52c);if(_0x2f78f3['query'][_0x363e('0x3a')]){_0x5c7be1[_0x363e('0x39')]=_[_0x363e('0x3b')](_0x5c7be1[_0x363e('0x39')],{'$or':_[_0x363e('0x2a')](_0x3da52c,function(_0x435437){if(_0x435437[_0x363e('0x2d')]!==_0x363e('0x3c')){var _0x18a766={};_0x18a766[_0x435437[_0x363e('0x27')]]={'$like':'%'+_0x2f78f3[_0x363e('0x2f')][_0x363e('0x3a')]+'%'};return _0x18a766;}})});}_0x5c7be1=_[_0x363e('0x3b')]({},_0x5c7be1,_0x2f78f3[_0x363e('0x3d')]);var _0x3ab39e={'where':_0x5c7be1[_0x363e('0x39')]};return db['VtigerAccount'][_0x363e('0x1f')](_0x3ab39e)[_0x363e('0x24')](function(_0x48874d){_0x46878a[_0x363e('0x1f')]=_0x48874d;if(_0x2f78f3['query'][_0x363e('0x3e')]){_0x5c7be1[_0x363e('0x3f')]=[{'all':!![]}];}return db[_0x363e('0x40')][_0x363e('0x41')](_0x5c7be1);})[_0x363e('0x24')](function(_0x63ef3){_0x46878a['rows']=_0x63ef3;return _0x46878a;})[_0x363e('0x24')](respondWithFilteredResult(_0x1f9977,_0x5c7be1))[_0x363e('0x42')](handleError(_0x1f9977,null));};exports[_0x363e('0x43')]=function(_0x19502c,_0x71601e){var _0x586f16={'raw':![],'where':{'id':_0x19502c[_0x363e('0x44')]['id']}},_0x1d06a3={};_0x1d06a3['model']=_[_0x363e('0x30')](db[_0x363e('0x40')][_0x363e('0x2b')]);_0x1d06a3[_0x363e('0x2f')]=_[_0x363e('0x30')](_0x19502c['query']);_0x1d06a3[_0x363e('0x31')]=_[_0x363e('0x32')](_0x1d06a3[_0x363e('0x2e')],_0x1d06a3[_0x363e('0x2f')]);_0x586f16[_0x363e('0x33')]=_[_0x363e('0x32')](_0x1d06a3[_0x363e('0x2e')],qs[_0x363e('0x34')](_0x19502c[_0x363e('0x2f')][_0x363e('0x34')]));_0x586f16[_0x363e('0x33')]=_0x586f16[_0x363e('0x33')]['length']?_0x586f16[_0x363e('0x33')]:_0x1d06a3[_0x363e('0x2e')];if(_0x19502c[_0x363e('0x2f')][_0x363e('0x3e')]){_0x586f16[_0x363e('0x3f')]=[{'all':!![]}];}_0x586f16=_[_0x363e('0x3b')]({},_0x586f16,_0x19502c[_0x363e('0x3d')]);return db[_0x363e('0x40')][_0x363e('0x45')](_0x586f16)['then'](handleEntityNotFound(_0x71601e,null))[_0x363e('0x24')](respondWithResult(_0x71601e,null))['catch'](handleError(_0x71601e,null));};exports[_0x363e('0x46')]=function(_0x3731a7,_0x6aa49f){return db['VtigerAccount'][_0x363e('0x46')](_0x3731a7[_0x363e('0x47')],{})[_0x363e('0x24')](respondWithResult(_0x6aa49f,0xc9))[_0x363e('0x42')](handleError(_0x6aa49f,null));};exports['update']=function(_0x46558c,_0x21f2d4){if(_0x46558c['body']['id']){delete _0x46558c[_0x363e('0x47')]['id'];}return db[_0x363e('0x40')][_0x363e('0x45')]({'where':{'id':_0x46558c[_0x363e('0x44')]['id']}})[_0x363e('0x24')](handleEntityNotFound(_0x21f2d4,null))[_0x363e('0x24')](saveUpdates(_0x46558c[_0x363e('0x47')],null))['then'](respondWithResult(_0x21f2d4,null))[_0x363e('0x42')](handleError(_0x21f2d4,null));};exports['destroy']=function(_0x48e01b,_0x4d0d86){return db[_0x363e('0x40')]['find']({'where':{'id':_0x48e01b['params']['id']}})[_0x363e('0x24')](handleEntityNotFound(_0x4d0d86,null))[_0x363e('0x24')](removeEntity(_0x4d0d86,null))[_0x363e('0x42')](handleError(_0x4d0d86,null));};exports[_0x363e('0x48')]=function(_0x238c8d,_0xe49164,_0x1c1316){var _0x161262={};var _0x4912c0={};var _0x4d34f8;var _0x2b91d3;return db['VtigerAccount'][_0x363e('0x49')]({'where':{'id':_0x238c8d['params']['id']}})[_0x363e('0x24')](handleEntityNotFound(_0xe49164,null))['then'](function(_0x598eb1){if(_0x598eb1){_0x4d34f8=_0x598eb1;_0x4912c0['model']=_[_0x363e('0x30')](db[_0x363e('0x4a')][_0x363e('0x2b')]);_0x4912c0['query']=_[_0x363e('0x30')](_0x238c8d['query']);_0x4912c0[_0x363e('0x31')]=_[_0x363e('0x32')](_0x4912c0['model'],_0x4912c0[_0x363e('0x2f')]);_0x161262[_0x363e('0x33')]=_[_0x363e('0x32')](_0x4912c0[_0x363e('0x2e')],qs['fields'](_0x238c8d['query'][_0x363e('0x34')]));_0x161262[_0x363e('0x33')]=_0x161262[_0x363e('0x33')][_0x363e('0x4b')]?_0x161262[_0x363e('0x33')]:_0x4912c0[_0x363e('0x2e')];_0x161262[_0x363e('0x37')]=qs['sort'](_0x238c8d[_0x363e('0x2f')]['sort']);_0x161262['where']=qs[_0x363e('0x31')](_[_0x363e('0x4c')](_0x238c8d[_0x363e('0x2f')],_0x4912c0[_0x363e('0x31')]));if(_0x238c8d['query'][_0x363e('0x3a')]){_0x161262[_0x363e('0x39')]=_[_0x363e('0x3b')](_0x161262['where'],{'$or':_[_0x363e('0x2a')](_0x161262[_0x363e('0x33')],function(_0x402f50){var _0x555cfc={};_0x555cfc[_0x402f50]={'$like':'%'+_0x238c8d['query'][_0x363e('0x3a')]+'%'};return _0x555cfc;})});}_0x161262=_[_0x363e('0x3b')]({},_0x161262,_0x238c8d[_0x363e('0x3d')]);return _0x4d34f8[_0x363e('0x48')](_0x161262);}})[_0x363e('0x24')](function(_0x5c90d8){if(_0x5c90d8){_0x2b91d3=_0x5c90d8[_0x363e('0x4b')];if(!_0x238c8d['query'][_0x363e('0x35')](_0x363e('0x36'))){_0x161262[_0x363e('0x1e')]=qs[_0x363e('0x1e')](_0x238c8d[_0x363e('0x2f')]['limit']);_0x161262[_0x363e('0x1c')]=qs[_0x363e('0x1c')](_0x238c8d[_0x363e('0x2f')][_0x363e('0x1c')]);}return _0x4d34f8[_0x363e('0x48')](_0x161262);}})['then'](function(_0x568d0a){if(_0x568d0a){return _0x568d0a?{'count':_0x2b91d3,'rows':_0x568d0a}:null;}})['then'](respondWithResult(_0xe49164,null))['catch'](handleError(_0xe49164,null));};exports[_0x363e('0x4d')]=function(_0xe939af,_0x9a7622,_0x25091e){if(_0xe939af['body']['id']){delete _0xe939af[_0x363e('0x47')]['id'];}return db['VtigerAccount'][_0x363e('0x49')]({'where':{'id':_0xe939af[_0x363e('0x44')]['id']}})['then'](handleEntityNotFound(_0x9a7622,null))[_0x363e('0x24')](function(_0x263e5b){if(_0x263e5b){_0xe939af[_0x363e('0x47')][_0x363e('0x4e')]=_0x263e5b['id'];_0xe939af[_0x363e('0x47')][_0x363e('0x4f')]=integrations[_0x363e('0x50')](_0xe939af[_0x363e('0x47')][_0x363e('0x51')],_0xe939af[_0x363e('0x47')]['type']);_0xe939af[_0x363e('0x47')][_0x363e('0x52')]=integrations[_0x363e('0x53')](_0xe939af[_0x363e('0x47')][_0x363e('0x51')],_0xe939af[_0x363e('0x47')][_0x363e('0x2d')]);return db[_0x363e('0x4a')][_0x363e('0x46')](_0xe939af['body'],{'include':[{'model':db[_0x363e('0x54')],'as':'Subjects'},{'model':db[_0x363e('0x54')],'as':_0x363e('0x52')}]});}return null;})['then'](respondWithResult(_0x9a7622,null))['catch'](handleError(_0x9a7622,null));};var md5=require(_0x363e('0x55'));exports[_0x363e('0x56')]=function(_0xb85ba7,_0x393345,_0x3c20ac){var _0x417b6c=null;var _0x158ebe=null;var _0x17ee2e=null;var _0x318bad=null;var _0xf8c09='';return db[_0x363e('0x40')]['findOne']({'where':{'id':_0xb85ba7[_0x363e('0x44')]['id']},'attributes':['id',_0x363e('0x27'),_0x363e('0x57'),'description',_0x363e('0x58'),'remoteUri',_0x363e('0x59'),_0x363e('0x5a')]})[_0x363e('0x24')](handleEntityNotFound(_0x393345,null))[_0x363e('0x24')](function(_0x464b8a){if(_0x464b8a){_0x417b6c=_0x464b8a[_0x363e('0x57')];_0x158ebe=_0x464b8a[_0x363e('0x5a')];_0x17ee2e=_0x464b8a[_0x363e('0x58')];_0xf8c09=_0x464b8a[_0x363e('0x5b')];var _0x15bb77=_0xf8c09[_0x363e('0x5c')](-0x1);if(_0x15bb77==='/'){_0xf8c09=_0xf8c09['substring'](0x0,_0xf8c09[_0x363e('0x5d')](_0x15bb77));}_0x318bad=util[_0x363e('0x5e')](_0x363e('0x5f'),_0xf8c09);var _0x813052={'method':'GET','uri':_0x318bad,'qs':{'operation':'getchallenge','username':_0x464b8a['username']},'json':!![]};return rp(_0x813052);}})[_0x363e('0x24')](function(_0x1ea407){if(_0x1ea407[_0x363e('0x60')]){var _0x3357e1={'method':_0x363e('0x61'),'uri':_0x318bad,'form':{'operation':'login','username':_0x417b6c,'accessKey':md5(_0x1ea407[_0x363e('0x62')]['token']+_0x158ebe)},'json':!![]};return rp(_0x3357e1);}})[_0x363e('0x24')](function(_0x52074a){if(_0x52074a[_0x363e('0x60')]){var _0x58f27a={'method':_0x363e('0x63'),'uri':_0x318bad,'qs':{'operation':_0x363e('0x64'),'username':_0x417b6c,'sessionName':_0x52074a['result']['sessionName'],'elementType':_0x17ee2e},'json':!![]};return rp(_0x58f27a);}})[_0x363e('0x24')](function(_0xceeda5){if(_0xceeda5[_0x363e('0x60')]){var _0x347e59=[_0x363e('0x65'),_0x363e('0x66'),_0x363e('0x67')];_[_0x363e('0x68')](_0xceeda5[_0x363e('0x62')]['fields'],function(_0x4353ac){return _0x347e59['includes'](_0x4353ac['type'][_0x363e('0x27')]);});_[_0x363e('0x68')](_0xceeda5[_0x363e('0x62')][_0x363e('0x34')],function(_0x3a4679){return _0x3a4679['editable']===_0x363e('0x69');});return{'count':_0xceeda5[_0x363e('0x62')][_0x363e('0x34')]['length'],'rows':_['map'](_0xceeda5[_0x363e('0x62')][_0x363e('0x34')],function(_0xe69a4b){return{'id':_0xe69a4b[_0x363e('0x27')],'name':_0xe69a4b[_0x363e('0x6a')],'custom':_[_0x363e('0x6b')](_0xe69a4b[_0x363e('0x27')],'cf_')?!![]:![],'options':_0xe69a4b['type'][_0x363e('0x27')]===_0x363e('0x6c')&&_0xe69a4b[_0x363e('0x2d')][_0x363e('0x6d')][_0x363e('0x4b')]>0x0?_[_0x363e('0x2a')](_0xe69a4b[_0x363e('0x2d')][_0x363e('0x6d')],function(_0x2c2232){return{'name':_0x2c2232[_0x363e('0x6a')],'value':_0x2c2232[_0x363e('0x6e')]};}):[]};})};}})[_0x363e('0x24')](respondWithResult(_0x393345,null))['catch'](function(_0x11a5b8){console[_0x363e('0x6f')](_0x363e('0x70')+_0x11a5b8);var _0x1327ed=_0xb85ba7[_0x363e('0x2f')]['test']?0x1f4:_0x11a5b8[_0x363e('0x71')]||0x1f4;logger[_0x363e('0x25')](_0x363e('0x72'),_0x363e('0x56'),_0x1327ed,JSON[_0x363e('0x73')](_0x11a5b8));delete _0x11a5b8[_0x363e('0x27')];if(_0x1327ed===0x191){_0x1327ed=0x190;}_0x393345[_0x363e('0x19')](_0x1327ed)[_0x363e('0x28')](_0xb85ba7['query'][_0x363e('0x74')]?{'message':_0x363e('0x75'),'statusCode':_0x11a5b8[_0x363e('0x71')]}:_0x11a5b8);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index ef5af58..34fab7c 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 _0x4da2=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3c6f79,_0x3ed502){var _0x311855=function(_0x35c843){while(--_0x35c843){_0x3c6f79['push'](_0x3c6f79['shift']());}};_0x311855(++_0x3ed502);}(_0x4da2,0xe9));var _0x24da=function(_0x240d57,_0x2af593){_0x240d57=_0x240d57-0x0;var _0x525929=_0x4da2[_0x240d57];return _0x525929;};'use strict';var _=require(_0x24da('0x0'));var util=require(_0x24da('0x1'));var logger=require('../../config/logger')(_0x24da('0x2'));var moment=require(_0x24da('0x3'));var BPromise=require(_0x24da('0x4'));var rp=require(_0x24da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x24da('0x6'));var attributes=require(_0x24da('0x7'));var integrations=require(_0x24da('0x8'));module[_0x24da('0x9')]=function(_0x50e7f0,_0x5133fd){return _0x50e7f0[_0x24da('0xa')](_0x24da('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x832b=['request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','int_vtiger_accounts','util','moment','bluebird'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x832b,0x194));var _0xb832=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x832b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb832('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb832('0x1'));var BPromise=require(_0xb832('0x2'));var rp=require(_0xb832('0x3'));var fs=require('fs');var path=require(_0xb832('0x4'));var rimraf=require(_0xb832('0x5'));var config=require(_0xb832('0x6'));var attributes=require(_0xb832('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xb832('0x8')]=function(_0x4060a0,_0x59780b){return _0x4060a0[_0xb832('0x9')]('VtigerAccount',attributes,{'tableName':_0xb832('0xa'),'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 6ba988f..1cc64e0 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 _0x1d2d=['error','code','message','result','catch','VtigerAccount','findAll','raw','where','options','attributes','limit','map','include','model','GetVtigerAccount','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x291a25,_0x31ae01){var _0x380fab=function(_0x205298){while(--_0x205298){_0x291a25['push'](_0x291a25['shift']());}};_0x380fab(++_0x31ae01);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x44ecb9,_0x9727a0){_0x44ecb9=_0x44ecb9-0x0;var _0x28aee2=_0x1d2d[_0x44ecb9];return _0x28aee2;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var moment=require(_0xd1d2('0x2'));var BPromise=require(_0xd1d2('0x3'));var rs=require(_0xd1d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1d2('0x6'));var config=require(_0xd1d2('0x7'));var jayson=require(_0xd1d2('0x8'));var client=jayson[_0xd1d2('0x9')][_0xd1d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353dbd,_0x55be7a,_0x1eaf41){return new BPromise(function(_0x21bc28,_0x35735f){return client[_0xd1d2('0xb')](_0x353dbd,_0x1eaf41)[_0xd1d2('0xc')](function(_0x59e484){logger[_0xd1d2('0xd')](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));logger[_0xd1d2('0x10')](_0xd1d2('0x11'),_0x55be7a,_0xd1d2('0xf'),JSON[_0xd1d2('0x12')](_0x59e484));if(_0x59e484['error']){if(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x14')]===0x1f4){logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);return _0x35735f(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484['error'][_0xd1d2('0x15')]);return _0x21bc28(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}else{logger['info'](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));_0x21bc28(_0x59e484[_0xd1d2('0x16')][_0xd1d2('0x15')]);}})[_0xd1d2('0x17')](function(_0x2723b3){logger[_0xd1d2('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x55be7a,_0x2723b3);_0x35735f(_0x2723b3);});});}exports['GetVtigerAccount']=function(_0x3be186){var _0x55320b=this;return new Promise(function(_0x247b3a,_0x42565b){return db[_0xd1d2('0x18')][_0xd1d2('0x19')]({'raw':_0x3be186['options']?_0x3be186['options'][_0xd1d2('0x1a')]===undefined?!![]:![]:!![],'where':_0x3be186['options']?_0x3be186['options'][_0xd1d2('0x1b')]||null:null,'attributes':_0x3be186[_0xd1d2('0x1c')]?_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x1d')]||null:null,'limit':_0x3be186['options']?_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x1e')]||null:null,'include':_0x3be186[_0xd1d2('0x1c')]?_0x3be186['options']['include']?_[_0xd1d2('0x1f')](_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x20')],function(_0x2f92ee){return{'model':db[_0x2f92ee[_0xd1d2('0x21')]],'as':_0x2f92ee['as'],'attributes':_0x2f92ee[_0xd1d2('0x1d')],'include':_0x2f92ee[_0xd1d2('0x20')]?_['map'](_0x2f92ee[_0xd1d2('0x20')],function(_0x42da6d){return{'model':db[_0x42da6d[_0xd1d2('0x21')]],'as':_0x42da6d['as'],'attributes':_0x42da6d[_0xd1d2('0x1d')],'include':_0x42da6d[_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0x42da6d[_0xd1d2('0x20')],function(_0x34faf7){return{'model':db[_0x34faf7[_0xd1d2('0x21')]],'as':_0x34faf7['as'],'attributes':_0x34faf7[_0xd1d2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1d2('0xc')](function(_0x4e1bc2){logger['info'](_0xd1d2('0x22'),_0x3be186);logger[_0xd1d2('0x10')](_0xd1d2('0x22'),_0x3be186,JSON[_0xd1d2('0x12')](_0x4e1bc2));_0x247b3a(_0x4e1bc2);})[_0xd1d2('0x17')](function(_0x48ade1){logger[_0xd1d2('0x13')](_0xd1d2('0x22'),_0x48ade1[_0xd1d2('0x15')],_0x3be186);_0x42565b(_0x55320b['error'](0x1f4,_0x48ade1[_0xd1d2('0x15')]));});});};exports[_0xd1d2('0x23')]=function(_0xbd855a){var _0x56557d=this;return new Promise(function(_0x419db7,_0x18528f){return db[_0xd1d2('0x18')][_0xd1d2('0x24')]({'raw':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1a')]===undefined?!![]:![]:!![],'where':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1b')]||null:null,'attributes':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1d')]||null:null,'include':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0xbd855a[_0xd1d2('0x1c')]['include'],function(_0x1541ff){return{'model':db[_0x1541ff[_0xd1d2('0x21')]],'as':_0x1541ff['as'],'attributes':_0x1541ff[_0xd1d2('0x1d')],'include':_0x1541ff['include']?_[_0xd1d2('0x1f')](_0x1541ff['include'],function(_0x57a7fb){return{'model':db[_0x57a7fb[_0xd1d2('0x21')]],'as':_0x57a7fb['as'],'attributes':_0x57a7fb[_0xd1d2('0x1d')],'include':_0x57a7fb[_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0x57a7fb[_0xd1d2('0x20')],function(_0x2d2d12){return{'model':db[_0x2d2d12['model']],'as':_0x2d2d12['as'],'attributes':_0x2d2d12[_0xd1d2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1d2('0xc')](function(_0x5bdf40){logger[_0xd1d2('0xd')](_0xd1d2('0x23'),_0xbd855a);logger[_0xd1d2('0x10')](_0xd1d2('0x23'),_0xbd855a,JSON['stringify'](_0x5bdf40));_0x419db7(_0x5bdf40);})['catch'](function(_0x2fd2c5){logger['error']('ShowVtigerAccount',_0x2fd2c5['message'],_0xbd855a);_0x18528f(_0x56557d[_0xd1d2('0x13')](0x1f4,_0x2fd2c5['message']));});});}; \ No newline at end of file +var _0x7334=['code','message','request\x20sent','result','GetVtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','VtigerAccount','find','ShowVtigerAccount','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7334,0x184));var _0x4733=function(_0x3c557f,_0x146a13){_0x3c557f=_0x3c557f-0x0;var _0x2b3d95=_0x7334[_0x3c557f];return _0x2b3d95;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283754,_0x12cafa,_0x43d95c){return new BPromise(function(_0x8257cf,_0x3562b7){return client[_0x4733('0xb')](_0x283754,_0x43d95c)[_0x4733('0xc')](function(_0x2d5fde){logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,'request\x20sent');logger[_0x4733('0xf')](_0x4733('0x10'),_0x12cafa,'request\x20sent',JSON[_0x4733('0x11')](_0x2d5fde));if(_0x2d5fde['error']){if(_0x2d5fde[_0x4733('0x12')][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x3562b7(_0x2d5fde[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x8257cf(_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,_0x4733('0x15'));_0x8257cf(_0x2d5fde[_0x4733('0x16')][_0x4733('0x14')]);}})['catch'](function(_0x2c0031){logger[_0x4733('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x12cafa,_0x2c0031);_0x3562b7(_0x2c0031);});});}exports[_0x4733('0x17')]=function(_0x1d2fb6){var _0x2aa223=this;return new Promise(function(_0x384e0c,_0x579f67){return db['VtigerAccount'][_0x4733('0x18')]({'raw':_0x1d2fb6[_0x4733('0x19')]?_0x1d2fb6['options'][_0x4733('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d2fb6[_0x4733('0x19')]?_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1b')]||null:null,'attributes':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1c')]||null:null,'limit':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1d')]||null:null,'include':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1e')]?_[_0x4733('0x1f')](_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1e')],function(_0x24db74){return{'model':db[_0x24db74[_0x4733('0x20')]],'as':_0x24db74['as'],'attributes':_0x24db74[_0x4733('0x1c')],'include':_0x24db74['include']?_[_0x4733('0x1f')](_0x24db74[_0x4733('0x1e')],function(_0x7884e5){return{'model':db[_0x7884e5[_0x4733('0x20')]],'as':_0x7884e5['as'],'attributes':_0x7884e5[_0x4733('0x1c')],'include':_0x7884e5[_0x4733('0x1e')]?_[_0x4733('0x1f')](_0x7884e5[_0x4733('0x1e')],function(_0x13bc12){return{'model':db[_0x13bc12[_0x4733('0x20')]],'as':_0x13bc12['as'],'attributes':_0x13bc12['attributes']};}):[]};}):[]};}):[]:[]})[_0x4733('0xc')](function(_0x4c91bc){logger['info'](_0x4733('0x17'),_0x1d2fb6);logger['debug'](_0x4733('0x17'),_0x1d2fb6,JSON['stringify'](_0x4c91bc));_0x384e0c(_0x4c91bc);})['catch'](function(_0x517c73){logger[_0x4733('0x12')](_0x4733('0x17'),_0x517c73[_0x4733('0x14')],_0x1d2fb6);_0x579f67(_0x2aa223[_0x4733('0x12')](0x1f4,_0x517c73['message']));});});};exports['ShowVtigerAccount']=function(_0x50f67e){var _0x2b2757=this;return new Promise(function(_0x56872b,_0x5a4814){return db[_0x4733('0x21')][_0x4733('0x22')]({'raw':_0x50f67e[_0x4733('0x19')]?_0x50f67e['options']['raw']===undefined?!![]:![]:!![],'where':_0x50f67e[_0x4733('0x19')]?_0x50f67e[_0x4733('0x19')][_0x4733('0x1b')]||null:null,'attributes':_0x50f67e[_0x4733('0x19')]?_0x50f67e[_0x4733('0x19')]['attributes']||null:null,'include':_0x50f67e[_0x4733('0x19')]?_0x50f67e[_0x4733('0x19')][_0x4733('0x1e')]?_[_0x4733('0x1f')](_0x50f67e[_0x4733('0x19')]['include'],function(_0x570bc6){return{'model':db[_0x570bc6[_0x4733('0x20')]],'as':_0x570bc6['as'],'attributes':_0x570bc6[_0x4733('0x1c')],'include':_0x570bc6[_0x4733('0x1e')]?_[_0x4733('0x1f')](_0x570bc6[_0x4733('0x1e')],function(_0x5e31c8){return{'model':db[_0x5e31c8[_0x4733('0x20')]],'as':_0x5e31c8['as'],'attributes':_0x5e31c8[_0x4733('0x1c')],'include':_0x5e31c8[_0x4733('0x1e')]?_['map'](_0x5e31c8[_0x4733('0x1e')],function(_0x10a5e9){return{'model':db[_0x10a5e9[_0x4733('0x20')]],'as':_0x10a5e9['as'],'attributes':_0x10a5e9[_0x4733('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4733('0xc')](function(_0x311c1d){logger[_0x4733('0xd')](_0x4733('0x23'),_0x50f67e);logger['debug'](_0x4733('0x23'),_0x50f67e,JSON['stringify'](_0x311c1d));_0x56872b(_0x311c1d);})[_0x4733('0x24')](function(_0x29db03){logger[_0x4733('0x12')](_0x4733('0x23'),_0x29db03[_0x4733('0x14')],_0x50f67e);_0x5a4814(_0x2b2757[_0x4733('0x12')](0x1f4,_0x29db03[_0x4733('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index ea89409..8252c3b 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 _0x2fd9=['connect-timeout','express','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','destroy','multer','util','path'];(function(_0x2d57a9,_0x5ae060){var _0x1b9671=function(_0x95fb4e){while(--_0x95fb4e){_0x2d57a9['push'](_0x2d57a9['shift']());}};_0x1b9671(++_0x5ae060);}(_0x2fd9,0x75));var _0x92fd=function(_0x1a3b58,_0xd5ba9a){_0x1a3b58=_0x1a3b58-0x0;var _0x1c0814=_0x2fd9[_0x1a3b58];return _0x1c0814;};'use strict';var multer=require(_0x92fd('0x0'));var util=require(_0x92fd('0x1'));var path=require(_0x92fd('0x2'));var timeout=require(_0x92fd('0x3'));var express=require(_0x92fd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x92fd('0x5'));var controller=require(_0x92fd('0x6'));router[_0x92fd('0x7')]('/',auth[_0x92fd('0x8')](),controller[_0x92fd('0x9')]);router[_0x92fd('0x7')](_0x92fd('0xa'),auth[_0x92fd('0x8')](),controller[_0x92fd('0xb')]);router[_0x92fd('0x7')]('/:id/fields',auth[_0x92fd('0x8')](),controller[_0x92fd('0xc')]);router[_0x92fd('0x7')](_0x92fd('0xd'),auth[_0x92fd('0x8')](),controller[_0x92fd('0xe')]);router[_0x92fd('0x7')](_0x92fd('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x92fd('0x10')]('/',auth[_0x92fd('0x8')](),controller['create']);router[_0x92fd('0x11')]('/:id',auth[_0x92fd('0x8')](),controller[_0x92fd('0x12')]);router['delete']('/:id',auth[_0x92fd('0x8')](),controller[_0x92fd('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0ce2=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x0ce2,0x15d));var _0x20ce=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0ce2[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x20ce('0x0'));var util=require('util');var path=require(_0x20ce('0x1'));var timeout=require(_0x20ce('0x2'));var express=require(_0x20ce('0x3'));var router=express[_0x20ce('0x4')]();var fs_extra=require(_0x20ce('0x5'));var auth=require(_0x20ce('0x6'));var interaction=require(_0x20ce('0x7'));var config=require(_0x20ce('0x8'));var controller=require(_0x20ce('0x9'));router[_0x20ce('0xa')]('/',auth['isAuthenticated'](),controller[_0x20ce('0xb')]);router[_0x20ce('0xa')](_0x20ce('0xc'),auth[_0x20ce('0xd')](),controller['show']);router[_0x20ce('0xa')](_0x20ce('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x20ce('0xa')](_0x20ce('0xf'),auth[_0x20ce('0xd')](),controller['getSubjects']);router[_0x20ce('0xa')]('/:id/descriptions',auth[_0x20ce('0xd')](),controller[_0x20ce('0x10')]);router[_0x20ce('0x11')]('/',auth[_0x20ce('0xd')](),controller[_0x20ce('0x12')]);router['put'](_0x20ce('0xc'),auth['isAuthenticated'](),controller[_0x20ce('0x13')]);router[_0x20ce('0x14')]('/:id',auth[_0x20ce('0xd')](),controller[_0x20ce('0x15')]);module[_0x20ce('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 22ff80f..77badf7 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 _0x2235=['STRING','exports'];(function(_0x509c83,_0x511882){var _0x534626=function(_0x9d21cf){while(--_0x9d21cf){_0x509c83['push'](_0x509c83['shift']());}};_0x534626(++_0x511882);}(_0x2235,0x15f));var _0x5223=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x2235[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x5223('0x0')]={'name':{'type':Sequelize[_0x5223('0x1')]},'description':{'type':Sequelize[_0x5223('0x1')]}}; \ No newline at end of file +var _0x2a49=['sequelize','exports','STRING'];(function(_0x2cc4e5,_0x3688c8){var _0x3148f5=function(_0x293e08){while(--_0x293e08){_0x2cc4e5['push'](_0x2cc4e5['shift']());}};_0x3148f5(++_0x3688c8);}(_0x2a49,0x7e));var _0x92a4=function(_0x1c8263,_0x52f869){_0x1c8263=_0x1c8263-0x0;var _0x594125=_0x2a49[_0x1c8263];return _0x594125;};'use strict';var Sequelize=require(_0x92a4('0x0'));module[_0x92a4('0x1')]={'name':{'type':Sequelize[_0x92a4('0x2')]},'description':{'type':Sequelize[_0x92a4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d1f3e8b..86b5fc5 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 _0x31ae=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','catch','show','params','includeAll','include','find','create','body','getFields','VtigerField','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x31ae,0x6b));var _0xe31a=function(_0x137ae3,_0x4e93bf){_0x137ae3=_0x137ae3-0x0;var _0x3de34c=_0x31ae[_0x137ae3];return _0x3de34c;};'use strict';var emlformat=require(_0xe31a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe31a('0x1'));var jsonpatch=require(_0xe31a('0x2'));var rp=require(_0xe31a('0x3'));var moment=require(_0xe31a('0x4'));var BPromise=require(_0xe31a('0x5'));var Mustache=require(_0xe31a('0x6'));var util=require(_0xe31a('0x7'));var path=require(_0xe31a('0x8'));var sox=require(_0xe31a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe31a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe31a('0xb'));var jsforce=require(_0xe31a('0xc'));var deskjs=require(_0xe31a('0xd'));var toCsv=require(_0xe31a('0xe'));var querystring=require(_0xe31a('0xf'));var Papa=require(_0xe31a('0x10'));var Redis=require(_0xe31a('0x11'));var authService=require(_0xe31a('0x12'));var qs=require(_0xe31a('0x13'));var as=require(_0xe31a('0x14'));var hardwareService=require(_0xe31a('0x15'));var logger=require(_0xe31a('0x16'))(_0xe31a('0x17'));var utils=require(_0xe31a('0x18'));var config=require(_0xe31a('0x19'));var licenseUtil=require(_0xe31a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c0751,_0x21cac9){_0x21cac9=_0x21cac9||0xcc;return function(_0x4c073a){if(_0x4c073a){return _0x4c0751[_0xe31a('0x1b')](_0x21cac9);}return _0x4c0751[_0xe31a('0x1c')](_0x21cac9)['end']();};}function respondWithResult(_0x559cb1,_0x29d0b3){_0x29d0b3=_0x29d0b3||0xc8;return function(_0x3c9cb9){if(_0x3c9cb9){return _0x559cb1[_0xe31a('0x1c')](_0x29d0b3)['json'](_0x3c9cb9);}};}function respondWithFilteredResult(_0x1577b4,_0x1d52b4){return function(_0x3f5a5c){if(_0x3f5a5c){var _0x482ccb=typeof _0x1d52b4[_0xe31a('0x1d')]===_0xe31a('0x1e')&&typeof _0x1d52b4['limit']===_0xe31a('0x1e');var _0xbc8e1f=_0x3f5a5c[_0xe31a('0x1f')];var _0x5a040=_0x482ccb?0x0:_0x1d52b4[_0xe31a('0x1d')];var _0x5640d2=_0x482ccb?_0x3f5a5c['count']:_0x1d52b4[_0xe31a('0x1d')]+_0x1d52b4[_0xe31a('0x20')];var _0x292c9d;if(_0x5640d2>=_0xbc8e1f){_0x5640d2=_0xbc8e1f;_0x292c9d=0xc8;}else{_0x292c9d=0xce;}_0x1577b4[_0xe31a('0x1c')](_0x292c9d);return _0x1577b4[_0xe31a('0x21')](_0xe31a('0x22'),_0x5a040+'-'+_0x5640d2+'/'+_0xbc8e1f)[_0xe31a('0x23')](_0x3f5a5c);}return null;};}function patchUpdates(_0x2915b6){return function(_0x11d929){try{jsonpatch[_0xe31a('0x24')](_0x11d929,_0x2915b6,!![]);}catch(_0xdd576c){return BPromise[_0xe31a('0x25')](_0xdd576c);}return _0x11d929[_0xe31a('0x26')]();};}function saveUpdates(_0x211638,_0x354dbc){return function(_0x18d119){if(_0x18d119){return _0x18d119[_0xe31a('0x27')](_0x211638)[_0xe31a('0x28')](function(_0x4c5bf6){return _0x4c5bf6;});}return null;};}function removeEntity(_0x3ce241,_0x43efc9){return function(_0x11f93e){if(_0x11f93e){return _0x11f93e[_0xe31a('0x29')]()[_0xe31a('0x28')](function(){_0x3ce241['status'](0xcc)[_0xe31a('0x2a')]();});}};}function handleEntityNotFound(_0x3ea149,_0x5eb9c6){return function(_0x2de01e){if(!_0x2de01e){_0x3ea149[_0xe31a('0x1b')](0x194);}return _0x2de01e;};}function handleError(_0x5ef095,_0x3bb5fc){_0x3bb5fc=_0x3bb5fc||0x1f4;return function(_0x1ea4f7){logger[_0xe31a('0x2b')](_0x1ea4f7[_0xe31a('0x2c')]);if(_0x1ea4f7['name']){delete _0x1ea4f7[_0xe31a('0x2d')];}_0x5ef095['status'](_0x3bb5fc)[_0xe31a('0x2e')](_0x1ea4f7);};}exports['index']=function(_0x316098,_0x55bddd){var _0x3a06ff={},_0x5829b6={},_0x535ae1={'count':0x0,'rows':[]};var _0x3a5a98=_[_0xe31a('0x2f')](db[_0xe31a('0x30')][_0xe31a('0x31')],function(_0x1b3aab){return{'name':_0x1b3aab[_0xe31a('0x32')],'type':_0x1b3aab[_0xe31a('0x33')][_0xe31a('0x34')]};});_0x5829b6['model']=_['map'](_0x3a5a98,_0xe31a('0x2d'));_0x5829b6[_0xe31a('0x35')]=_[_0xe31a('0x36')](_0x316098[_0xe31a('0x35')]);_0x5829b6[_0xe31a('0x37')]=_[_0xe31a('0x38')](_0x5829b6[_0xe31a('0x39')],_0x5829b6[_0xe31a('0x35')]);_0x3a06ff[_0xe31a('0x3a')]=_[_0xe31a('0x38')](_0x5829b6[_0xe31a('0x39')],qs[_0xe31a('0x3b')](_0x316098['query'][_0xe31a('0x3b')]));_0x3a06ff[_0xe31a('0x3a')]=_0x3a06ff['attributes'][_0xe31a('0x3c')]?_0x3a06ff[_0xe31a('0x3a')]:_0x5829b6['model'];if(!_0x316098[_0xe31a('0x35')][_0xe31a('0x3d')](_0xe31a('0x3e'))){_0x3a06ff[_0xe31a('0x20')]=qs[_0xe31a('0x20')](_0x316098[_0xe31a('0x35')]['limit']);_0x3a06ff[_0xe31a('0x1d')]=qs[_0xe31a('0x1d')](_0x316098[_0xe31a('0x35')][_0xe31a('0x1d')]);}_0x3a06ff[_0xe31a('0x3f')]=qs[_0xe31a('0x40')](_0x316098['query'][_0xe31a('0x40')]);_0x3a06ff[_0xe31a('0x41')]=qs[_0xe31a('0x37')](_[_0xe31a('0x42')](_0x316098['query'],_0x5829b6[_0xe31a('0x37')]),_0x3a5a98);if(_0x316098['query'][_0xe31a('0x43')]){_0x3a06ff[_0xe31a('0x41')]=_[_0xe31a('0x44')](_0x3a06ff['where'],{'$or':_['map'](_0x3a5a98,function(_0x1389e7){if(_0x1389e7[_0xe31a('0x33')]!=='VIRTUAL'){var _0x447ce3={};_0x447ce3[_0x1389e7[_0xe31a('0x2d')]]={'$like':'%'+_0x316098[_0xe31a('0x35')][_0xe31a('0x43')]+'%'};return _0x447ce3;}})});}_0x3a06ff=_[_0xe31a('0x44')]({},_0x3a06ff,_0x316098[_0xe31a('0x45')]);var _0x6ff02c={'where':_0x3a06ff['where']};return db[_0xe31a('0x30')][_0xe31a('0x1f')](_0x6ff02c)[_0xe31a('0x28')](function(_0x4bbec5){_0x535ae1[_0xe31a('0x1f')]=_0x4bbec5;if(_0x316098[_0xe31a('0x35')]['includeAll']){_0x3a06ff['include']=[{'all':!![]}];}return db[_0xe31a('0x30')][_0xe31a('0x46')](_0x3a06ff);})[_0xe31a('0x28')](function(_0x378364){_0x535ae1['rows']=_0x378364;return _0x535ae1;})[_0xe31a('0x28')](respondWithFilteredResult(_0x55bddd,_0x3a06ff))[_0xe31a('0x47')](handleError(_0x55bddd,null));};exports[_0xe31a('0x48')]=function(_0x8f5661,_0x479ed){var _0x1b2115={'raw':![],'where':{'id':_0x8f5661[_0xe31a('0x49')]['id']}},_0x8b970e={};_0x8b970e[_0xe31a('0x39')]=_['keys'](db['VtigerConfiguration'][_0xe31a('0x31')]);_0x8b970e[_0xe31a('0x35')]=_[_0xe31a('0x36')](_0x8f5661[_0xe31a('0x35')]);_0x8b970e[_0xe31a('0x37')]=_['intersection'](_0x8b970e[_0xe31a('0x39')],_0x8b970e[_0xe31a('0x35')]);_0x1b2115[_0xe31a('0x3a')]=_['intersection'](_0x8b970e[_0xe31a('0x39')],qs[_0xe31a('0x3b')](_0x8f5661['query'][_0xe31a('0x3b')]));_0x1b2115[_0xe31a('0x3a')]=_0x1b2115[_0xe31a('0x3a')][_0xe31a('0x3c')]?_0x1b2115['attributes']:_0x8b970e['model'];if(_0x8f5661['query'][_0xe31a('0x4a')]){_0x1b2115[_0xe31a('0x4b')]=[{'all':!![]}];}_0x1b2115=_[_0xe31a('0x44')]({},_0x1b2115,_0x8f5661[_0xe31a('0x45')]);return db[_0xe31a('0x30')][_0xe31a('0x4c')](_0x1b2115)[_0xe31a('0x28')](handleEntityNotFound(_0x479ed,null))[_0xe31a('0x28')](respondWithResult(_0x479ed,null))[_0xe31a('0x47')](handleError(_0x479ed,null));};exports[_0xe31a('0x4d')]=function(_0x30e3b6,_0x5c45dd){return db[_0xe31a('0x30')]['create'](_0x30e3b6['body'],{})[_0xe31a('0x28')](respondWithResult(_0x5c45dd,0xc9))['catch'](handleError(_0x5c45dd,null));};exports[_0xe31a('0x27')]=function(_0x111be2,_0x57cebe){if(_0x111be2[_0xe31a('0x4e')]['id']){delete _0x111be2[_0xe31a('0x4e')]['id'];}return db[_0xe31a('0x30')]['find']({'where':{'id':_0x111be2[_0xe31a('0x49')]['id']}})['then'](handleEntityNotFound(_0x57cebe,null))[_0xe31a('0x28')](saveUpdates(_0x111be2[_0xe31a('0x4e')],null))[_0xe31a('0x28')](respondWithResult(_0x57cebe,null))[_0xe31a('0x47')](handleError(_0x57cebe,null));};exports[_0xe31a('0x29')]=function(_0x1599cd,_0x52a93c){return db[_0xe31a('0x30')]['find']({'where':{'id':_0x1599cd['params']['id']}})[_0xe31a('0x28')](handleEntityNotFound(_0x52a93c,null))[_0xe31a('0x28')](removeEntity(_0x52a93c,null))[_0xe31a('0x47')](handleError(_0x52a93c,null));};exports[_0xe31a('0x4f')]=function(_0x126277,_0x89fc8d,_0x175765){var _0x587953={};var _0x1cb2c2={};var _0x33413e;var _0x219c49;return db[_0xe31a('0x30')]['findOne']({'where':{'id':_0x126277[_0xe31a('0x49')]['id']}})[_0xe31a('0x28')](handleEntityNotFound(_0x89fc8d,null))[_0xe31a('0x28')](function(_0x2132ed){if(_0x2132ed){_0x33413e=_0x2132ed;_0x1cb2c2[_0xe31a('0x39')]=_[_0xe31a('0x36')](db[_0xe31a('0x50')][_0xe31a('0x31')]);_0x1cb2c2[_0xe31a('0x35')]=_['keys'](_0x126277[_0xe31a('0x35')]);_0x1cb2c2[_0xe31a('0x37')]=_[_0xe31a('0x38')](_0x1cb2c2[_0xe31a('0x39')],_0x1cb2c2['query']);_0x587953[_0xe31a('0x3a')]=_[_0xe31a('0x38')](_0x1cb2c2[_0xe31a('0x39')],qs[_0xe31a('0x3b')](_0x126277[_0xe31a('0x35')][_0xe31a('0x3b')]));_0x587953[_0xe31a('0x3a')]=_0x587953[_0xe31a('0x3a')][_0xe31a('0x3c')]?_0x587953[_0xe31a('0x3a')]:_0x1cb2c2[_0xe31a('0x39')];_0x587953[_0xe31a('0x3f')]=qs['sort'](_0x126277[_0xe31a('0x35')]['sort']);_0x587953[_0xe31a('0x41')]=qs['filters'](_[_0xe31a('0x42')](_0x126277[_0xe31a('0x35')],_0x1cb2c2[_0xe31a('0x37')]));if(_0x126277[_0xe31a('0x35')][_0xe31a('0x43')]){_0x587953[_0xe31a('0x41')]=_[_0xe31a('0x44')](_0x587953[_0xe31a('0x41')],{'$or':_[_0xe31a('0x2f')](_0x587953[_0xe31a('0x3a')],function(_0x510683){var _0x4671e9={};_0x4671e9[_0x510683]={'$like':'%'+_0x126277['query'][_0xe31a('0x43')]+'%'};return _0x4671e9;})});}_0x587953=_[_0xe31a('0x44')]({},_0x587953,_0x126277[_0xe31a('0x45')]);return _0x33413e[_0xe31a('0x4f')](_0x587953);}})[_0xe31a('0x28')](function(_0x3af84f){if(_0x3af84f){_0x219c49=_0x3af84f['length'];if(!_0x126277[_0xe31a('0x35')][_0xe31a('0x3d')](_0xe31a('0x3e'))){_0x587953['limit']=qs[_0xe31a('0x20')](_0x126277['query']['limit']);_0x587953[_0xe31a('0x1d')]=qs[_0xe31a('0x1d')](_0x126277[_0xe31a('0x35')][_0xe31a('0x1d')]);}return _0x33413e['getFields'](_0x587953);}})[_0xe31a('0x28')](function(_0x28623c){if(_0x28623c){return _0x28623c?{'count':_0x219c49,'rows':_0x28623c}:null;}})['then'](respondWithResult(_0x89fc8d,null))[_0xe31a('0x47')](handleError(_0x89fc8d,null));};exports[_0xe31a('0x51')]=function(_0x5499a1,_0x1da452,_0x20faa4){var _0x5c10d4={};var _0x5c0131={};var _0x2f647c;var _0x3c8ea7;return db['VtigerConfiguration'][_0xe31a('0x52')]({'where':{'id':_0x5499a1[_0xe31a('0x49')]['id']}})[_0xe31a('0x28')](handleEntityNotFound(_0x1da452,null))[_0xe31a('0x28')](function(_0x43624e){if(_0x43624e){_0x2f647c=_0x43624e;_0x5c0131['model']=_[_0xe31a('0x36')](db[_0xe31a('0x50')]['rawAttributes']);_0x5c0131['query']=_['keys'](_0x5499a1[_0xe31a('0x35')]);_0x5c0131[_0xe31a('0x37')]=_['intersection'](_0x5c0131['model'],_0x5c0131[_0xe31a('0x35')]);_0x5c10d4[_0xe31a('0x3a')]=_[_0xe31a('0x38')](_0x5c0131[_0xe31a('0x39')],qs[_0xe31a('0x3b')](_0x5499a1[_0xe31a('0x35')][_0xe31a('0x3b')]));_0x5c10d4[_0xe31a('0x3a')]=_0x5c10d4[_0xe31a('0x3a')][_0xe31a('0x3c')]?_0x5c10d4[_0xe31a('0x3a')]:_0x5c0131[_0xe31a('0x39')];_0x5c10d4[_0xe31a('0x3f')]=qs['sort'](_0x5499a1[_0xe31a('0x35')][_0xe31a('0x40')]);_0x5c10d4[_0xe31a('0x41')]=qs['filters'](_[_0xe31a('0x42')](_0x5499a1[_0xe31a('0x35')],_0x5c0131[_0xe31a('0x37')]));if(_0x5499a1[_0xe31a('0x35')][_0xe31a('0x43')]){_0x5c10d4[_0xe31a('0x41')]=_['merge'](_0x5c10d4[_0xe31a('0x41')],{'$or':_['map'](_0x5c10d4['attributes'],function(_0x1a1876){var _0x41c6a3={};_0x41c6a3[_0x1a1876]={'$like':'%'+_0x5499a1[_0xe31a('0x35')][_0xe31a('0x43')]+'%'};return _0x41c6a3;})});}_0x5c10d4=_[_0xe31a('0x44')]({},_0x5c10d4,_0x5499a1[_0xe31a('0x45')]);return _0x2f647c[_0xe31a('0x51')](_0x5c10d4);}})[_0xe31a('0x28')](function(_0x2d9e28){if(_0x2d9e28){_0x3c8ea7=_0x2d9e28['length'];if(!_0x5499a1[_0xe31a('0x35')][_0xe31a('0x3d')]('nolimit')){_0x5c10d4[_0xe31a('0x20')]=qs[_0xe31a('0x20')](_0x5499a1[_0xe31a('0x35')][_0xe31a('0x20')]);_0x5c10d4[_0xe31a('0x1d')]=qs['offset'](_0x5499a1[_0xe31a('0x35')][_0xe31a('0x1d')]);}return _0x2f647c[_0xe31a('0x51')](_0x5c10d4);}})[_0xe31a('0x28')](function(_0x416cc7){if(_0x416cc7){return _0x416cc7?{'count':_0x3c8ea7,'rows':_0x416cc7}:null;}})[_0xe31a('0x28')](respondWithResult(_0x1da452,null))['catch'](handleError(_0x1da452,null));};exports[_0xe31a('0x53')]=function(_0x554ebd,_0x40061e,_0x37b963){var _0x2eaa32={};var _0x33bba9={};var _0x412192;var _0x53ed0e;return db[_0xe31a('0x30')][_0xe31a('0x52')]({'where':{'id':_0x554ebd['params']['id']}})[_0xe31a('0x28')](handleEntityNotFound(_0x40061e,null))[_0xe31a('0x28')](function(_0x40ee21){if(_0x40ee21){_0x412192=_0x40ee21;_0x33bba9[_0xe31a('0x39')]=_[_0xe31a('0x36')](db[_0xe31a('0x50')]['rawAttributes']);_0x33bba9['query']=_[_0xe31a('0x36')](_0x554ebd[_0xe31a('0x35')]);_0x33bba9['filters']=_[_0xe31a('0x38')](_0x33bba9[_0xe31a('0x39')],_0x33bba9['query']);_0x2eaa32[_0xe31a('0x3a')]=_['intersection'](_0x33bba9[_0xe31a('0x39')],qs['fields'](_0x554ebd['query'][_0xe31a('0x3b')]));_0x2eaa32['attributes']=_0x2eaa32[_0xe31a('0x3a')]['length']?_0x2eaa32['attributes']:_0x33bba9[_0xe31a('0x39')];_0x2eaa32[_0xe31a('0x3f')]=qs[_0xe31a('0x40')](_0x554ebd[_0xe31a('0x35')][_0xe31a('0x40')]);_0x2eaa32[_0xe31a('0x41')]=qs[_0xe31a('0x37')](_[_0xe31a('0x42')](_0x554ebd[_0xe31a('0x35')],_0x33bba9[_0xe31a('0x37')]));if(_0x554ebd['query'][_0xe31a('0x43')]){_0x2eaa32[_0xe31a('0x41')]=_['merge'](_0x2eaa32[_0xe31a('0x41')],{'$or':_[_0xe31a('0x2f')](_0x2eaa32[_0xe31a('0x3a')],function(_0x4f3516){var _0x130fbe={};_0x130fbe[_0x4f3516]={'$like':'%'+_0x554ebd[_0xe31a('0x35')][_0xe31a('0x43')]+'%'};return _0x130fbe;})});}_0x2eaa32=_[_0xe31a('0x44')]({},_0x2eaa32,_0x554ebd['options']);return _0x412192[_0xe31a('0x53')](_0x2eaa32);}})[_0xe31a('0x28')](function(_0x799639){if(_0x799639){_0x53ed0e=_0x799639[_0xe31a('0x3c')];if(!_0x554ebd[_0xe31a('0x35')][_0xe31a('0x3d')](_0xe31a('0x3e'))){_0x2eaa32[_0xe31a('0x20')]=qs[_0xe31a('0x20')](_0x554ebd[_0xe31a('0x35')][_0xe31a('0x20')]);_0x2eaa32['offset']=qs[_0xe31a('0x1d')](_0x554ebd[_0xe31a('0x35')][_0xe31a('0x1d')]);}return _0x412192[_0xe31a('0x53')](_0x2eaa32);}})[_0xe31a('0x28')](function(_0x5cd0c7){if(_0x5cd0c7){return _0x5cd0c7?{'count':_0x53ed0e,'rows':_0x5cd0c7}:null;}})[_0xe31a('0x28')](respondWithResult(_0x40061e,null))['catch'](handleError(_0x40061e,null));}; \ No newline at end of file +var _0x80a7=['keys','includeAll','find','create','body','getFields','findOne','order','filter','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params'];(function(_0x399394,_0x47adc2){var _0x43d584=function(_0x22edd8){while(--_0x22edd8){_0x399394['push'](_0x399394['shift']());}};_0x43d584(++_0x47adc2);}(_0x80a7,0xae));var _0x780a=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0x80a7[_0x30a31e];return _0x170879;};'use strict';var emlformat=require(_0x780a('0x0'));var rimraf=require(_0x780a('0x1'));var zipdir=require(_0x780a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x780a('0x3'));var moment=require(_0x780a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x780a('0x5'));var util=require('util');var path=require(_0x780a('0x6'));var sox=require(_0x780a('0x7'));var csv=require(_0x780a('0x8'));var ejs=require(_0x780a('0x9'));var fs=require('fs');var fs_extra=require(_0x780a('0xa'));var _=require(_0x780a('0xb'));var squel=require('squel');var crypto=require(_0x780a('0xc'));var jsforce=require(_0x780a('0xd'));var deskjs=require(_0x780a('0xe'));var toCsv=require(_0x780a('0x8'));var querystring=require(_0x780a('0xf'));var Papa=require(_0x780a('0x10'));var Redis=require('ioredis');var authService=require(_0x780a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x780a('0x12'));var logger=require(_0x780a('0x13'))(_0x780a('0x14'));var utils=require(_0x780a('0x15'));var config=require(_0x780a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x780a('0x17'))['db'];function respondWithStatusCode(_0x3a313d,_0x4af77a){_0x4af77a=_0x4af77a||0xcc;return function(_0x2a8957){if(_0x2a8957){return _0x3a313d['sendStatus'](_0x4af77a);}return _0x3a313d[_0x780a('0x18')](_0x4af77a)[_0x780a('0x19')]();};}function respondWithResult(_0x222d89,_0x53113f){_0x53113f=_0x53113f||0xc8;return function(_0x1bd52c){if(_0x1bd52c){return _0x222d89[_0x780a('0x18')](_0x53113f)[_0x780a('0x1a')](_0x1bd52c);}};}function respondWithFilteredResult(_0x4c113a,_0x4252a6){return function(_0x263305){if(_0x263305){var _0x223288=typeof _0x4252a6[_0x780a('0x1b')]===_0x780a('0x1c')&&typeof _0x4252a6['limit']==='undefined';var _0x2c4d4a=_0x263305['count'];var _0x4ddbaa=_0x223288?0x0:_0x4252a6['offset'];var _0x4c50f9=_0x223288?_0x263305[_0x780a('0x1d')]:_0x4252a6[_0x780a('0x1b')]+_0x4252a6[_0x780a('0x1e')];var _0x3fb619;if(_0x4c50f9>=_0x2c4d4a){_0x4c50f9=_0x2c4d4a;_0x3fb619=0xc8;}else{_0x3fb619=0xce;}_0x4c113a[_0x780a('0x18')](_0x3fb619);return _0x4c113a[_0x780a('0x1f')]('Content-Range',_0x4ddbaa+'-'+_0x4c50f9+'/'+_0x2c4d4a)['json'](_0x263305);}return null;};}function patchUpdates(_0x9f1967){return function(_0x19dae3){try{jsonpatch[_0x780a('0x20')](_0x19dae3,_0x9f1967,!![]);}catch(_0x1c93f0){return BPromise[_0x780a('0x21')](_0x1c93f0);}return _0x19dae3['save']();};}function saveUpdates(_0x864ee2,_0x217f80){return function(_0x2d1445){if(_0x2d1445){return _0x2d1445[_0x780a('0x22')](_0x864ee2)[_0x780a('0x23')](function(_0x376ec1){return _0x376ec1;});}return null;};}function removeEntity(_0x4a72c4,_0x501a4e){return function(_0x12f9eb){if(_0x12f9eb){return _0x12f9eb[_0x780a('0x24')]()[_0x780a('0x23')](function(){_0x4a72c4[_0x780a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2faf7b,_0x5eb728){return function(_0x3bfbe3){if(!_0x3bfbe3){_0x2faf7b[_0x780a('0x25')](0x194);}return _0x3bfbe3;};}function handleError(_0x55ab4a,_0x369ecf){_0x369ecf=_0x369ecf||0x1f4;return function(_0x4959d2){logger[_0x780a('0x26')](_0x4959d2[_0x780a('0x27')]);if(_0x4959d2[_0x780a('0x28')]){delete _0x4959d2[_0x780a('0x28')];}_0x55ab4a[_0x780a('0x18')](_0x369ecf)[_0x780a('0x29')](_0x4959d2);};}exports[_0x780a('0x2a')]=function(_0x45c564,_0x46d518){var _0x487fc6={},_0x365d0f={},_0x55af6b={'count':0x0,'rows':[]};var _0x442ff3=_[_0x780a('0x2b')](db[_0x780a('0x2c')][_0x780a('0x2d')],function(_0x10ab68){return{'name':_0x10ab68['fieldName'],'type':_0x10ab68[_0x780a('0x2e')][_0x780a('0x2f')]};});_0x365d0f[_0x780a('0x30')]=_[_0x780a('0x2b')](_0x442ff3,_0x780a('0x28'));_0x365d0f[_0x780a('0x31')]=_['keys'](_0x45c564[_0x780a('0x31')]);_0x365d0f[_0x780a('0x32')]=_[_0x780a('0x33')](_0x365d0f[_0x780a('0x30')],_0x365d0f[_0x780a('0x31')]);_0x487fc6[_0x780a('0x34')]=_[_0x780a('0x33')](_0x365d0f[_0x780a('0x30')],qs['fields'](_0x45c564[_0x780a('0x31')][_0x780a('0x35')]));_0x487fc6['attributes']=_0x487fc6[_0x780a('0x34')][_0x780a('0x36')]?_0x487fc6[_0x780a('0x34')]:_0x365d0f[_0x780a('0x30')];if(!_0x45c564[_0x780a('0x31')][_0x780a('0x37')](_0x780a('0x38'))){_0x487fc6['limit']=qs[_0x780a('0x1e')](_0x45c564[_0x780a('0x31')][_0x780a('0x1e')]);_0x487fc6[_0x780a('0x1b')]=qs[_0x780a('0x1b')](_0x45c564[_0x780a('0x31')][_0x780a('0x1b')]);}_0x487fc6['order']=qs['sort'](_0x45c564[_0x780a('0x31')][_0x780a('0x39')]);_0x487fc6['where']=qs[_0x780a('0x32')](_[_0x780a('0x3a')](_0x45c564['query'],_0x365d0f['filters']),_0x442ff3);if(_0x45c564['query']['filter']){_0x487fc6[_0x780a('0x3b')]=_[_0x780a('0x3c')](_0x487fc6[_0x780a('0x3b')],{'$or':_[_0x780a('0x2b')](_0x442ff3,function(_0x24108b){if(_0x24108b['type']!==_0x780a('0x3d')){var _0x3bac8f={};_0x3bac8f[_0x24108b[_0x780a('0x28')]]={'$like':'%'+_0x45c564[_0x780a('0x31')]['filter']+'%'};return _0x3bac8f;}})});}_0x487fc6=_['merge']({},_0x487fc6,_0x45c564[_0x780a('0x3e')]);var _0x16da0f={'where':_0x487fc6[_0x780a('0x3b')]};return db['VtigerConfiguration']['count'](_0x16da0f)[_0x780a('0x23')](function(_0x447e5c){_0x55af6b[_0x780a('0x1d')]=_0x447e5c;if(_0x45c564['query']['includeAll']){_0x487fc6[_0x780a('0x3f')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x780a('0x40')](_0x487fc6);})[_0x780a('0x23')](function(_0x3c382f){_0x55af6b[_0x780a('0x41')]=_0x3c382f;return _0x55af6b;})[_0x780a('0x23')](respondWithFilteredResult(_0x46d518,_0x487fc6))[_0x780a('0x42')](handleError(_0x46d518,null));};exports[_0x780a('0x43')]=function(_0x4e32e8,_0x42c55f){var _0x3858e2={'raw':![],'where':{'id':_0x4e32e8[_0x780a('0x44')]['id']}},_0x4f84fd={};_0x4f84fd[_0x780a('0x30')]=_[_0x780a('0x45')](db[_0x780a('0x2c')][_0x780a('0x2d')]);_0x4f84fd['query']=_[_0x780a('0x45')](_0x4e32e8[_0x780a('0x31')]);_0x4f84fd[_0x780a('0x32')]=_[_0x780a('0x33')](_0x4f84fd['model'],_0x4f84fd[_0x780a('0x31')]);_0x3858e2[_0x780a('0x34')]=_[_0x780a('0x33')](_0x4f84fd['model'],qs[_0x780a('0x35')](_0x4e32e8[_0x780a('0x31')]['fields']));_0x3858e2[_0x780a('0x34')]=_0x3858e2[_0x780a('0x34')][_0x780a('0x36')]?_0x3858e2[_0x780a('0x34')]:_0x4f84fd['model'];if(_0x4e32e8[_0x780a('0x31')][_0x780a('0x46')]){_0x3858e2['include']=[{'all':!![]}];}_0x3858e2=_['merge']({},_0x3858e2,_0x4e32e8[_0x780a('0x3e')]);return db[_0x780a('0x2c')][_0x780a('0x47')](_0x3858e2)['then'](handleEntityNotFound(_0x42c55f,null))[_0x780a('0x23')](respondWithResult(_0x42c55f,null))[_0x780a('0x42')](handleError(_0x42c55f,null));};exports['create']=function(_0x21839d,_0x209df6){return db['VtigerConfiguration'][_0x780a('0x48')](_0x21839d[_0x780a('0x49')],{})[_0x780a('0x23')](respondWithResult(_0x209df6,0xc9))[_0x780a('0x42')](handleError(_0x209df6,null));};exports[_0x780a('0x22')]=function(_0x3156f1,_0x254a9e){if(_0x3156f1[_0x780a('0x49')]['id']){delete _0x3156f1[_0x780a('0x49')]['id'];}return db['VtigerConfiguration'][_0x780a('0x47')]({'where':{'id':_0x3156f1[_0x780a('0x44')]['id']}})[_0x780a('0x23')](handleEntityNotFound(_0x254a9e,null))[_0x780a('0x23')](saveUpdates(_0x3156f1[_0x780a('0x49')],null))[_0x780a('0x23')](respondWithResult(_0x254a9e,null))[_0x780a('0x42')](handleError(_0x254a9e,null));};exports[_0x780a('0x24')]=function(_0x521b0f,_0xb035b8){return db[_0x780a('0x2c')][_0x780a('0x47')]({'where':{'id':_0x521b0f[_0x780a('0x44')]['id']}})['then'](handleEntityNotFound(_0xb035b8,null))['then'](removeEntity(_0xb035b8,null))['catch'](handleError(_0xb035b8,null));};exports[_0x780a('0x4a')]=function(_0x201273,_0xfaeb22,_0x32292c){var _0x551cf7={};var _0x156041={};var _0x308409;var _0x4fdbda;return db[_0x780a('0x2c')][_0x780a('0x4b')]({'where':{'id':_0x201273[_0x780a('0x44')]['id']}})[_0x780a('0x23')](handleEntityNotFound(_0xfaeb22,null))['then'](function(_0x1e2485){if(_0x1e2485){_0x308409=_0x1e2485;_0x156041[_0x780a('0x30')]=_[_0x780a('0x45')](db['VtigerField']['rawAttributes']);_0x156041[_0x780a('0x31')]=_[_0x780a('0x45')](_0x201273['query']);_0x156041['filters']=_[_0x780a('0x33')](_0x156041['model'],_0x156041[_0x780a('0x31')]);_0x551cf7['attributes']=_[_0x780a('0x33')](_0x156041[_0x780a('0x30')],qs[_0x780a('0x35')](_0x201273[_0x780a('0x31')][_0x780a('0x35')]));_0x551cf7[_0x780a('0x34')]=_0x551cf7[_0x780a('0x34')]['length']?_0x551cf7[_0x780a('0x34')]:_0x156041['model'];_0x551cf7[_0x780a('0x4c')]=qs['sort'](_0x201273[_0x780a('0x31')][_0x780a('0x39')]);_0x551cf7[_0x780a('0x3b')]=qs[_0x780a('0x32')](_[_0x780a('0x3a')](_0x201273[_0x780a('0x31')],_0x156041[_0x780a('0x32')]));if(_0x201273[_0x780a('0x31')][_0x780a('0x4d')]){_0x551cf7['where']=_[_0x780a('0x3c')](_0x551cf7[_0x780a('0x3b')],{'$or':_[_0x780a('0x2b')](_0x551cf7['attributes'],function(_0x4572fe){var _0x33fca6={};_0x33fca6[_0x4572fe]={'$like':'%'+_0x201273['query'][_0x780a('0x4d')]+'%'};return _0x33fca6;})});}_0x551cf7=_[_0x780a('0x3c')]({},_0x551cf7,_0x201273[_0x780a('0x3e')]);return _0x308409[_0x780a('0x4a')](_0x551cf7);}})[_0x780a('0x23')](function(_0x138b20){if(_0x138b20){_0x4fdbda=_0x138b20[_0x780a('0x36')];if(!_0x201273[_0x780a('0x31')]['hasOwnProperty'](_0x780a('0x38'))){_0x551cf7['limit']=qs[_0x780a('0x1e')](_0x201273[_0x780a('0x31')][_0x780a('0x1e')]);_0x551cf7[_0x780a('0x1b')]=qs['offset'](_0x201273[_0x780a('0x31')][_0x780a('0x1b')]);}return _0x308409[_0x780a('0x4a')](_0x551cf7);}})[_0x780a('0x23')](function(_0x24840d){if(_0x24840d){return _0x24840d?{'count':_0x4fdbda,'rows':_0x24840d}:null;}})[_0x780a('0x23')](respondWithResult(_0xfaeb22,null))['catch'](handleError(_0xfaeb22,null));};exports[_0x780a('0x4e')]=function(_0x17799a,_0x581823,_0x40ec8f){var _0x5d3ecd={};var _0x195ccf={};var _0x17c637;var _0x5ddc36;return db[_0x780a('0x2c')][_0x780a('0x4b')]({'where':{'id':_0x17799a[_0x780a('0x44')]['id']}})[_0x780a('0x23')](handleEntityNotFound(_0x581823,null))[_0x780a('0x23')](function(_0x11b7c6){if(_0x11b7c6){_0x17c637=_0x11b7c6;_0x195ccf[_0x780a('0x30')]=_[_0x780a('0x45')](db[_0x780a('0x4f')][_0x780a('0x2d')]);_0x195ccf[_0x780a('0x31')]=_['keys'](_0x17799a[_0x780a('0x31')]);_0x195ccf['filters']=_['intersection'](_0x195ccf[_0x780a('0x30')],_0x195ccf[_0x780a('0x31')]);_0x5d3ecd['attributes']=_['intersection'](_0x195ccf[_0x780a('0x30')],qs[_0x780a('0x35')](_0x17799a[_0x780a('0x31')][_0x780a('0x35')]));_0x5d3ecd[_0x780a('0x34')]=_0x5d3ecd[_0x780a('0x34')][_0x780a('0x36')]?_0x5d3ecd['attributes']:_0x195ccf[_0x780a('0x30')];_0x5d3ecd['order']=qs['sort'](_0x17799a[_0x780a('0x31')][_0x780a('0x39')]);_0x5d3ecd[_0x780a('0x3b')]=qs[_0x780a('0x32')](_['pick'](_0x17799a['query'],_0x195ccf['filters']));if(_0x17799a[_0x780a('0x31')][_0x780a('0x4d')]){_0x5d3ecd['where']=_[_0x780a('0x3c')](_0x5d3ecd[_0x780a('0x3b')],{'$or':_['map'](_0x5d3ecd[_0x780a('0x34')],function(_0x16e915){var _0x470796={};_0x470796[_0x16e915]={'$like':'%'+_0x17799a[_0x780a('0x31')]['filter']+'%'};return _0x470796;})});}_0x5d3ecd=_['merge']({},_0x5d3ecd,_0x17799a[_0x780a('0x3e')]);return _0x17c637[_0x780a('0x4e')](_0x5d3ecd);}})[_0x780a('0x23')](function(_0x53f00d){if(_0x53f00d){_0x5ddc36=_0x53f00d['length'];if(!_0x17799a[_0x780a('0x31')][_0x780a('0x37')]('nolimit')){_0x5d3ecd[_0x780a('0x1e')]=qs['limit'](_0x17799a['query'][_0x780a('0x1e')]);_0x5d3ecd[_0x780a('0x1b')]=qs['offset'](_0x17799a[_0x780a('0x31')][_0x780a('0x1b')]);}return _0x17c637['getSubjects'](_0x5d3ecd);}})[_0x780a('0x23')](function(_0xc04be4){if(_0xc04be4){return _0xc04be4?{'count':_0x5ddc36,'rows':_0xc04be4}:null;}})[_0x780a('0x23')](respondWithResult(_0x581823,null))[_0x780a('0x42')](handleError(_0x581823,null));};exports[_0x780a('0x50')]=function(_0x9a3c02,_0x63a04a,_0x254b10){var _0x4162e8={};var _0x395edc={};var _0x219356;var _0x1a4f5d;return db['VtigerConfiguration'][_0x780a('0x4b')]({'where':{'id':_0x9a3c02['params']['id']}})[_0x780a('0x23')](handleEntityNotFound(_0x63a04a,null))[_0x780a('0x23')](function(_0x5946d7){if(_0x5946d7){_0x219356=_0x5946d7;_0x395edc[_0x780a('0x30')]=_['keys'](db[_0x780a('0x4f')]['rawAttributes']);_0x395edc['query']=_[_0x780a('0x45')](_0x9a3c02[_0x780a('0x31')]);_0x395edc[_0x780a('0x32')]=_[_0x780a('0x33')](_0x395edc[_0x780a('0x30')],_0x395edc[_0x780a('0x31')]);_0x4162e8[_0x780a('0x34')]=_[_0x780a('0x33')](_0x395edc[_0x780a('0x30')],qs[_0x780a('0x35')](_0x9a3c02['query'][_0x780a('0x35')]));_0x4162e8[_0x780a('0x34')]=_0x4162e8[_0x780a('0x34')]['length']?_0x4162e8[_0x780a('0x34')]:_0x395edc[_0x780a('0x30')];_0x4162e8['order']=qs[_0x780a('0x39')](_0x9a3c02[_0x780a('0x31')][_0x780a('0x39')]);_0x4162e8['where']=qs[_0x780a('0x32')](_[_0x780a('0x3a')](_0x9a3c02[_0x780a('0x31')],_0x395edc[_0x780a('0x32')]));if(_0x9a3c02[_0x780a('0x31')][_0x780a('0x4d')]){_0x4162e8[_0x780a('0x3b')]=_[_0x780a('0x3c')](_0x4162e8['where'],{'$or':_[_0x780a('0x2b')](_0x4162e8[_0x780a('0x34')],function(_0x3098b8){var _0x158a91={};_0x158a91[_0x3098b8]={'$like':'%'+_0x9a3c02[_0x780a('0x31')][_0x780a('0x4d')]+'%'};return _0x158a91;})});}_0x4162e8=_[_0x780a('0x3c')]({},_0x4162e8,_0x9a3c02[_0x780a('0x3e')]);return _0x219356[_0x780a('0x50')](_0x4162e8);}})[_0x780a('0x23')](function(_0x8e7c56){if(_0x8e7c56){_0x1a4f5d=_0x8e7c56[_0x780a('0x36')];if(!_0x9a3c02[_0x780a('0x31')][_0x780a('0x37')](_0x780a('0x38'))){_0x4162e8[_0x780a('0x1e')]=qs[_0x780a('0x1e')](_0x9a3c02[_0x780a('0x31')][_0x780a('0x1e')]);_0x4162e8[_0x780a('0x1b')]=qs[_0x780a('0x1b')](_0x9a3c02[_0x780a('0x31')][_0x780a('0x1b')]);}return _0x219356[_0x780a('0x50')](_0x4162e8);}})['then'](function(_0x10debf){if(_0x10debf){return _0x10debf?{'count':_0x1a4f5d,'rows':_0x10debf}:null;}})[_0x780a('0x23')](respondWithResult(_0x63a04a,null))[_0x780a('0x42')](handleError(_0x63a04a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index c572262..fad738a 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 _0xf894=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','util'];(function(_0x38ef85,_0x317bcc){var _0x1ffa8d=function(_0x5069b0){while(--_0x5069b0){_0x38ef85['push'](_0x38ef85['shift']());}};_0x1ffa8d(++_0x317bcc);}(_0xf894,0x1e0));var _0x4f89=function(_0x3b9846,_0x16a666){_0x3b9846=_0x3b9846-0x0;var _0x495077=_0xf894[_0x3b9846];return _0x495077;};'use strict';var _=require('lodash');var util=require(_0x4f89('0x0'));var logger=require(_0x4f89('0x1'))(_0x4f89('0x2'));var moment=require(_0x4f89('0x3'));var BPromise=require(_0x4f89('0x4'));var rp=require(_0x4f89('0x5'));var fs=require('fs');var path=require(_0x4f89('0x6'));var rimraf=require(_0x4f89('0x7'));var config=require(_0x4f89('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x4f89('0x9')]=function(_0x5f13e6,_0x2e2bcc){return _0x5f13e6[_0x4f89('0xa')](_0x4f89('0xb'),attributes,{'tableName':_0x4f89('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d24=['bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x9e689c,_0x2600d8){var _0x13ee00=function(_0x60e5e2){while(--_0x60e5e2){_0x9e689c['push'](_0x9e689c['shift']());}};_0x13ee00(++_0x2600d8);}(_0x2d24,0x17f));var _0x42d2=function(_0x56bf77,_0x42edfc){_0x56bf77=_0x56bf77-0x0;var _0x13fa25=_0x2d24[_0x56bf77];return _0x13fa25;};'use strict';var _=require(_0x42d2('0x0'));var util=require(_0x42d2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x42d2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42d2('0x3'));var rimraf=require(_0x42d2('0x4'));var config=require(_0x42d2('0x5'));var attributes=require(_0x42d2('0x6'));module[_0x42d2('0x7')]=function(_0x52fc5b,_0x1732a9){return _0x52fc5b[_0x42d2('0x8')](_0x42d2('0x9'),attributes,{'tableName':_0x42d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 68eeadb..ac5e3a5 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 _0x1517=['request','then','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','code','VtigerConfiguration,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x128d97,_0x3f7514){var _0x83644e=function(_0x2edbc5){while(--_0x2edbc5){_0x128d97['push'](_0x128d97['shift']());}};_0x83644e(++_0x3f7514);}(_0x1517,0x7d));var _0x7151=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x1517[_0x38b14f];return _0x22a324;};'use strict';var _=require(_0x7151('0x0'));var util=require(_0x7151('0x1'));var moment=require(_0x7151('0x2'));var BPromise=require(_0x7151('0x3'));var rs=require(_0x7151('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7151('0x5'))['db'];var utils=require(_0x7151('0x6'));var logger=require(_0x7151('0x7'))(_0x7151('0x8'));var config=require(_0x7151('0x9'));var jayson=require(_0x7151('0xa'));var client=jayson[_0x7151('0xb')][_0x7151('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cd956,_0x1d24b5,_0x454735){return new BPromise(function(_0x40817a,_0x77f88a){return client[_0x7151('0xd')](_0x4cd956,_0x454735)[_0x7151('0xe')](function(_0x1d9156){logger[_0x7151('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x1d24b5,_0x7151('0x10'));logger['debug'](_0x7151('0x11'),_0x1d24b5,'request\x20sent',JSON['stringify'](_0x1d9156));if(_0x1d9156['error']){if(_0x1d9156['error'][_0x7151('0x12')]===0x1f4){logger['error'](_0x7151('0x13'),_0x1d24b5,_0x1d9156[_0x7151('0x14')]['message']);return _0x77f88a(_0x1d9156[_0x7151('0x14')]['message']);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x1d24b5,_0x1d9156[_0x7151('0x14')][_0x7151('0x15')]);return _0x40817a(_0x1d9156[_0x7151('0x14')][_0x7151('0x15')]);}else{logger[_0x7151('0xf')](_0x7151('0x13'),_0x1d24b5,_0x7151('0x10'));_0x40817a(_0x1d9156['result'][_0x7151('0x15')]);}})[_0x7151('0x16')](function(_0x4030df){logger['error'](_0x7151('0x13'),_0x1d24b5,_0x4030df);_0x77f88a(_0x4030df);});});} \ No newline at end of file +var _0xe612=['request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x736eb,_0x345088){var _0x30ea13=function(_0xbdab7c){while(--_0xbdab7c){_0x736eb['push'](_0x736eb['shift']());}};_0x30ea13(++_0x345088);}(_0xe612,0xc5));var _0x2e61=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe612[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2e61('0x0'));var util=require(_0x2e61('0x1'));var moment=require(_0x2e61('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e61('0x3'));var db=require(_0x2e61('0x4'))['db'];var utils=require(_0x2e61('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2e61('0x6'));var jayson=require(_0x2e61('0x7'));var client=jayson[_0x2e61('0x8')][_0x2e61('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x279d1d,_0x3a2d3b,_0x590c5d){return new BPromise(function(_0x51ce02,_0x3aee42){return client[_0x2e61('0xa')](_0x279d1d,_0x590c5d)[_0x2e61('0xb')](function(_0x376664){logger['info'](_0x2e61('0xc'),_0x3a2d3b,_0x2e61('0xd'));logger[_0x2e61('0xe')](_0x2e61('0xf'),_0x3a2d3b,_0x2e61('0xd'),JSON[_0x2e61('0x10')](_0x376664));if(_0x376664[_0x2e61('0x11')]){if(_0x376664[_0x2e61('0x11')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x3a2d3b,_0x376664[_0x2e61('0x11')]['message']);return _0x3aee42(_0x376664[_0x2e61('0x11')][_0x2e61('0x12')]);}logger[_0x2e61('0x11')](_0x2e61('0xc'),_0x3a2d3b,_0x376664[_0x2e61('0x11')]['message']);return _0x51ce02(_0x376664[_0x2e61('0x11')][_0x2e61('0x12')]);}else{logger[_0x2e61('0x13')](_0x2e61('0xc'),_0x3a2d3b,'request\x20sent');_0x51ce02(_0x376664['result']['message']);}})[_0x2e61('0x14')](function(_0x87bbcf){logger[_0x2e61('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x3a2d3b,_0x87bbcf);_0x3aee42(_0x87bbcf);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 52c4ead..e059047 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 _0x7f95=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x7f95,0x1eb));var _0x57f9=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0x7f95[_0x274638];return _0x5755df;};'use strict';var multer=require('multer');var util=require(_0x57f9('0x0'));var path=require(_0x57f9('0x1'));var timeout=require(_0x57f9('0x2'));var express=require(_0x57f9('0x3'));var router=express[_0x57f9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x57f9('0x5'));var config=require(_0x57f9('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x57f9('0x7')](),controller[_0x57f9('0x8')]);router[_0x57f9('0x9')](_0x57f9('0xa'),auth[_0x57f9('0x7')](),controller[_0x57f9('0xb')]);router[_0x57f9('0xc')]('/',auth[_0x57f9('0x7')](),controller['create']);router[_0x57f9('0xd')](_0x57f9('0xa'),auth[_0x57f9('0x7')](),controller[_0x57f9('0xe')]);router[_0x57f9('0xf')](_0x57f9('0xa'),auth[_0x57f9('0x7')](),controller[_0x57f9('0x10')]);module[_0x57f9('0x11')]=router; \ No newline at end of file +var _0x1998=['index','show','post','put','/:id','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0x1998,0x183));var _0x8199=function(_0x680f2e,_0x27f301){_0x680f2e=_0x680f2e-0x0;var _0x4d981d=_0x1998[_0x680f2e];return _0x4d981d;};'use strict';var multer=require(_0x8199('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8199('0x1'));var express=require('express');var router=express[_0x8199('0x2')]();var fs_extra=require(_0x8199('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8199('0x4'));var config=require(_0x8199('0x5'));var controller=require(_0x8199('0x6'));router[_0x8199('0x7')]('/',auth[_0x8199('0x8')](),controller[_0x8199('0x9')]);router[_0x8199('0x7')]('/:id',auth[_0x8199('0x8')](),controller[_0x8199('0xa')]);router[_0x8199('0xb')]('/',auth[_0x8199('0x8')](),controller['create']);router[_0x8199('0xc')](_0x8199('0xd'),auth[_0x8199('0x8')](),controller[_0x8199('0xe')]);router[_0x8199('0xf')](_0x8199('0xd'),auth[_0x8199('0x8')](),controller[_0x8199('0x10')]);module[_0x8199('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 5de50ab..92bd7ca 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 _0x5d15=['customVariable','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x34933a,_0x327378){var _0x36abb4=function(_0x2d6814){while(--_0x2d6814){_0x34933a['push'](_0x34933a['shift']());}};_0x36abb4(++_0x327378);}(_0x5d15,0x14a));var _0x55d1=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0x5d15[_0x26a906];return _0x495575;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x55d1('0x0')](_0x55d1('0x1'),_0x55d1('0x2'),'customVariable',_0x55d1('0x3'),_0x55d1('0x4')),'defaultValue':_0x55d1('0x1')},'content':{'type':Sequelize[_0x55d1('0x5')]},'key':{'type':Sequelize[_0x55d1('0x5')]},'keyType':{'type':Sequelize[_0x55d1('0x0')](_0x55d1('0x1'),_0x55d1('0x2'),_0x55d1('0x6'))},'keyContent':{'type':Sequelize[_0x55d1('0x5')]},'idField':{'type':Sequelize[_0x55d1('0x5')]},'nameField':{'type':Sequelize[_0x55d1('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x55d1('0x5')]}}; \ No newline at end of file +var _0x3763=['variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','string'];(function(_0x5806c3,_0x5105d8){var _0x48ac77=function(_0x4826ec){while(--_0x4826ec){_0x5806c3['push'](_0x5806c3['shift']());}};_0x48ac77(++_0x5105d8);}(_0x3763,0x1c0));var _0x3376=function(_0x12b4be,_0x3ce5d8){_0x12b4be=_0x12b4be-0x0;var _0x4c37d2=_0x3763[_0x12b4be];return _0x4c37d2;};'use strict';var Sequelize=require(_0x3376('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x3376('0x1'),_0x3376('0x2'),_0x3376('0x3'),_0x3376('0x4'),_0x3376('0x5')),'defaultValue':_0x3376('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3376('0x6')]},'keyType':{'type':Sequelize[_0x3376('0x7')](_0x3376('0x1'),_0x3376('0x2'),_0x3376('0x3'))},'keyContent':{'type':Sequelize[_0x3376('0x6')]},'idField':{'type':Sequelize[_0x3376('0x6')]},'nameField':{'type':Sequelize[_0x3376('0x6')]},'customField':{'type':Sequelize[_0x3376('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 43f0b45..8c1d343 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 _0x6a6f=['fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','VtigerField','rawAttributes'];(function(_0x45aa72,_0x8af642){var _0x75adaa=function(_0x1f6809){while(--_0x1f6809){_0x45aa72['push'](_0x45aa72['shift']());}};_0x75adaa(++_0x8af642);}(_0x6a6f,0x69));var _0xf6a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a6f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf6a6('0x0'));var rimraf=require(_0xf6a6('0x1'));var zipdir=require(_0xf6a6('0x2'));var jsonpatch=require(_0xf6a6('0x3'));var rp=require(_0xf6a6('0x4'));var moment=require(_0xf6a6('0x5'));var BPromise=require(_0xf6a6('0x6'));var Mustache=require(_0xf6a6('0x7'));var util=require('util');var path=require(_0xf6a6('0x8'));var sox=require(_0xf6a6('0x9'));var csv=require(_0xf6a6('0xa'));var ejs=require(_0xf6a6('0xb'));var fs=require('fs');var fs_extra=require(_0xf6a6('0xc'));var _=require(_0xf6a6('0xd'));var squel=require(_0xf6a6('0xe'));var crypto=require(_0xf6a6('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf6a6('0x10'));var toCsv=require(_0xf6a6('0xa'));var querystring=require(_0xf6a6('0x11'));var Papa=require(_0xf6a6('0x12'));var Redis=require(_0xf6a6('0x13'));var authService=require(_0xf6a6('0x14'));var qs=require(_0xf6a6('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6a6('0x16'))('api');var utils=require(_0xf6a6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf6a6('0x18'));var db=require(_0xf6a6('0x19'))['db'];function respondWithStatusCode(_0x424c32,_0x531f2e){_0x531f2e=_0x531f2e||0xcc;return function(_0x59fd8f){if(_0x59fd8f){return _0x424c32[_0xf6a6('0x1a')](_0x531f2e);}return _0x424c32[_0xf6a6('0x1b')](_0x531f2e)[_0xf6a6('0x1c')]();};}function respondWithResult(_0x746c51,_0x4d229){_0x4d229=_0x4d229||0xc8;return function(_0x3e3d16){if(_0x3e3d16){return _0x746c51[_0xf6a6('0x1b')](_0x4d229)[_0xf6a6('0x1d')](_0x3e3d16);}};}function respondWithFilteredResult(_0x12ed0a,_0x32ae9a){return function(_0x556ebd){if(_0x556ebd){var _0x2bc62f=typeof _0x32ae9a[_0xf6a6('0x1e')]==='undefined'&&typeof _0x32ae9a['limit']==='undefined';var _0x858cc7=_0x556ebd['count'];var _0x56b3bd=_0x2bc62f?0x0:_0x32ae9a[_0xf6a6('0x1e')];var _0x30d559=_0x2bc62f?_0x556ebd[_0xf6a6('0x1f')]:_0x32ae9a[_0xf6a6('0x1e')]+_0x32ae9a['limit'];var _0x7255aa;if(_0x30d559>=_0x858cc7){_0x30d559=_0x858cc7;_0x7255aa=0xc8;}else{_0x7255aa=0xce;}_0x12ed0a[_0xf6a6('0x1b')](_0x7255aa);return _0x12ed0a[_0xf6a6('0x20')](_0xf6a6('0x21'),_0x56b3bd+'-'+_0x30d559+'/'+_0x858cc7)[_0xf6a6('0x1d')](_0x556ebd);}return null;};}function patchUpdates(_0x241fd6){return function(_0x57cbc9){try{jsonpatch[_0xf6a6('0x22')](_0x57cbc9,_0x241fd6,!![]);}catch(_0x2643e7){return BPromise['reject'](_0x2643e7);}return _0x57cbc9[_0xf6a6('0x23')]();};}function saveUpdates(_0x21d3c8,_0x4a65d0){return function(_0x4190df){if(_0x4190df){return _0x4190df[_0xf6a6('0x24')](_0x21d3c8)['then'](function(_0x1caf94){return _0x1caf94;});}return null;};}function removeEntity(_0x46f707,_0x271e84){return function(_0x2f6706){if(_0x2f6706){return _0x2f6706[_0xf6a6('0x25')]()[_0xf6a6('0x26')](function(){_0x46f707[_0xf6a6('0x1b')](0xcc)[_0xf6a6('0x1c')]();});}};}function handleEntityNotFound(_0x472ead,_0x330446){return function(_0x26b931){if(!_0x26b931){_0x472ead[_0xf6a6('0x1a')](0x194);}return _0x26b931;};}function handleError(_0x38c121,_0xe10aa9){_0xe10aa9=_0xe10aa9||0x1f4;return function(_0x39a248){logger[_0xf6a6('0x27')](_0x39a248[_0xf6a6('0x28')]);if(_0x39a248[_0xf6a6('0x29')]){delete _0x39a248['name'];}_0x38c121['status'](_0xe10aa9)[_0xf6a6('0x2a')](_0x39a248);};}exports[_0xf6a6('0x2b')]=function(_0x26cdd5,_0x4db62d){var _0x19c43b={},_0x1406e8={},_0x3acdd0={'count':0x0,'rows':[]};var _0x53a62f=_[_0xf6a6('0x2c')](db[_0xf6a6('0x2d')][_0xf6a6('0x2e')],function(_0x78d197){return{'name':_0x78d197[_0xf6a6('0x2f')],'type':_0x78d197[_0xf6a6('0x30')][_0xf6a6('0x31')]};});_0x1406e8['model']=_[_0xf6a6('0x2c')](_0x53a62f,'name');_0x1406e8[_0xf6a6('0x32')]=_['keys'](_0x26cdd5[_0xf6a6('0x32')]);_0x1406e8['filters']=_[_0xf6a6('0x33')](_0x1406e8[_0xf6a6('0x34')],_0x1406e8['query']);_0x19c43b['attributes']=_[_0xf6a6('0x33')](_0x1406e8[_0xf6a6('0x34')],qs['fields'](_0x26cdd5[_0xf6a6('0x32')][_0xf6a6('0x35')]));_0x19c43b[_0xf6a6('0x36')]=_0x19c43b[_0xf6a6('0x36')][_0xf6a6('0x37')]?_0x19c43b[_0xf6a6('0x36')]:_0x1406e8[_0xf6a6('0x34')];if(!_0x26cdd5[_0xf6a6('0x32')][_0xf6a6('0x38')]('nolimit')){_0x19c43b['limit']=qs[_0xf6a6('0x39')](_0x26cdd5['query'][_0xf6a6('0x39')]);_0x19c43b[_0xf6a6('0x1e')]=qs['offset'](_0x26cdd5[_0xf6a6('0x32')][_0xf6a6('0x1e')]);}_0x19c43b[_0xf6a6('0x3a')]=qs[_0xf6a6('0x3b')](_0x26cdd5['query'][_0xf6a6('0x3b')]);_0x19c43b[_0xf6a6('0x3c')]=qs[_0xf6a6('0x3d')](_[_0xf6a6('0x3e')](_0x26cdd5[_0xf6a6('0x32')],_0x1406e8[_0xf6a6('0x3d')]),_0x53a62f);if(_0x26cdd5[_0xf6a6('0x32')]['filter']){_0x19c43b['where']=_[_0xf6a6('0x3f')](_0x19c43b[_0xf6a6('0x3c')],{'$or':_[_0xf6a6('0x2c')](_0x53a62f,function(_0x5b1ae2){if(_0x5b1ae2['type']!==_0xf6a6('0x40')){var _0x1ccea7={};_0x1ccea7[_0x5b1ae2[_0xf6a6('0x29')]]={'$like':'%'+_0x26cdd5['query'][_0xf6a6('0x41')]+'%'};return _0x1ccea7;}})});}_0x19c43b=_[_0xf6a6('0x3f')]({},_0x19c43b,_0x26cdd5['options']);var _0x7d333e={'where':_0x19c43b[_0xf6a6('0x3c')]};return db[_0xf6a6('0x2d')][_0xf6a6('0x1f')](_0x7d333e)[_0xf6a6('0x26')](function(_0x5b4776){_0x3acdd0[_0xf6a6('0x1f')]=_0x5b4776;if(_0x26cdd5[_0xf6a6('0x32')][_0xf6a6('0x42')]){_0x19c43b[_0xf6a6('0x43')]=[{'all':!![]}];}return db['VtigerField'][_0xf6a6('0x44')](_0x19c43b);})[_0xf6a6('0x26')](function(_0x225068){_0x3acdd0[_0xf6a6('0x45')]=_0x225068;return _0x3acdd0;})[_0xf6a6('0x26')](respondWithFilteredResult(_0x4db62d,_0x19c43b))[_0xf6a6('0x46')](handleError(_0x4db62d,null));};exports['show']=function(_0x341d2d,_0x9ecdf1){var _0x5b618b={'raw':!![],'where':{'id':_0x341d2d['params']['id']}},_0x3f8a1a={};_0x3f8a1a[_0xf6a6('0x34')]=_[_0xf6a6('0x47')](db['VtigerField'][_0xf6a6('0x2e')]);_0x3f8a1a[_0xf6a6('0x32')]=_[_0xf6a6('0x47')](_0x341d2d[_0xf6a6('0x32')]);_0x3f8a1a['filters']=_[_0xf6a6('0x33')](_0x3f8a1a[_0xf6a6('0x34')],_0x3f8a1a[_0xf6a6('0x32')]);_0x5b618b['attributes']=_[_0xf6a6('0x33')](_0x3f8a1a[_0xf6a6('0x34')],qs[_0xf6a6('0x35')](_0x341d2d[_0xf6a6('0x32')]['fields']));_0x5b618b[_0xf6a6('0x36')]=_0x5b618b[_0xf6a6('0x36')][_0xf6a6('0x37')]?_0x5b618b[_0xf6a6('0x36')]:_0x3f8a1a['model'];if(_0x341d2d[_0xf6a6('0x32')][_0xf6a6('0x42')]){_0x5b618b[_0xf6a6('0x43')]=[{'all':!![]}];}_0x5b618b=_[_0xf6a6('0x3f')]({},_0x5b618b,_0x341d2d['options']);return db[_0xf6a6('0x2d')][_0xf6a6('0x48')](_0x5b618b)['then'](handleEntityNotFound(_0x9ecdf1,null))[_0xf6a6('0x26')](respondWithResult(_0x9ecdf1,null))[_0xf6a6('0x46')](handleError(_0x9ecdf1,null));};exports[_0xf6a6('0x49')]=function(_0x4b793b,_0x59831b){return db[_0xf6a6('0x2d')]['create'](_0x4b793b[_0xf6a6('0x4a')],{})[_0xf6a6('0x26')](respondWithResult(_0x59831b,0xc9))[_0xf6a6('0x46')](handleError(_0x59831b,null));};exports[_0xf6a6('0x24')]=function(_0x55f991,_0x482a1){if(_0x55f991['body']['id']){delete _0x55f991[_0xf6a6('0x4a')]['id'];}return db[_0xf6a6('0x2d')][_0xf6a6('0x48')]({'where':{'id':_0x55f991[_0xf6a6('0x4b')]['id']}})[_0xf6a6('0x26')](handleEntityNotFound(_0x482a1,null))[_0xf6a6('0x26')](saveUpdates(_0x55f991[_0xf6a6('0x4a')],null))['then'](respondWithResult(_0x482a1,null))['catch'](handleError(_0x482a1,null));};exports['destroy']=function(_0x35f7fe,_0x3af0fa){return db[_0xf6a6('0x2d')][_0xf6a6('0x48')]({'where':{'id':_0x35f7fe[_0xf6a6('0x4b')]['id']}})[_0xf6a6('0x26')](handleEntityNotFound(_0x3af0fa,null))[_0xf6a6('0x26')](removeEntity(_0x3af0fa,null))['catch'](handleError(_0x3af0fa,null));}; \ No newline at end of file +var _0xdbfb=['end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','VtigerField','rawAttributes','fieldName','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','type','merge','options','where','include','findAll','rows','show','params','catch','create','body','find','zip-dir','request-promise','moment','mustache','path','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status'];(function(_0x4ead23,_0x537fec){var _0x36bcae=function(_0xe423ee){while(--_0xe423ee){_0x4ead23['push'](_0x4ead23['shift']());}};_0x36bcae(++_0x537fec);}(_0xdbfb,0x73));var _0xbdbf=function(_0x942f90,_0x46cb99){_0x942f90=_0x942f90-0x0;var _0x8de5f8=_0xdbfb[_0x942f90];return _0x8de5f8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbdbf('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbdbf('0x1'));var moment=require(_0xbdbf('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbdbf('0x3'));var util=require('util');var path=require(_0xbdbf('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbdbf('0x5'));var fs=require('fs');var fs_extra=require(_0xbdbf('0x6'));var _=require(_0xbdbf('0x7'));var squel=require('squel');var crypto=require(_0xbdbf('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbdbf('0x9'));var querystring=require(_0xbdbf('0xa'));var Papa=require(_0xbdbf('0xb'));var Redis=require(_0xbdbf('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xbdbf('0xd'));var as=require(_0xbdbf('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbdbf('0xf'));var utils=require(_0xbdbf('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x82eddd,_0x1f3bfe){_0x1f3bfe=_0x1f3bfe||0xcc;return function(_0x32d15e){if(_0x32d15e){return _0x82eddd[_0xbdbf('0x11')](_0x1f3bfe);}return _0x82eddd[_0xbdbf('0x12')](_0x1f3bfe)[_0xbdbf('0x13')]();};}function respondWithResult(_0x3af2d1,_0x252461){_0x252461=_0x252461||0xc8;return function(_0x4fbb6e){if(_0x4fbb6e){return _0x3af2d1[_0xbdbf('0x12')](_0x252461)[_0xbdbf('0x14')](_0x4fbb6e);}};}function respondWithFilteredResult(_0x4360c5,_0x4a55e6){return function(_0x41662a){if(_0x41662a){var _0x57082b=typeof _0x4a55e6['offset']===_0xbdbf('0x15')&&typeof _0x4a55e6['limit']===_0xbdbf('0x15');var _0x2c8a02=_0x41662a[_0xbdbf('0x16')];var _0xa97158=_0x57082b?0x0:_0x4a55e6[_0xbdbf('0x17')];var _0x285a36=_0x57082b?_0x41662a['count']:_0x4a55e6[_0xbdbf('0x17')]+_0x4a55e6[_0xbdbf('0x18')];var _0x3a8f42;if(_0x285a36>=_0x2c8a02){_0x285a36=_0x2c8a02;_0x3a8f42=0xc8;}else{_0x3a8f42=0xce;}_0x4360c5[_0xbdbf('0x12')](_0x3a8f42);return _0x4360c5[_0xbdbf('0x19')]('Content-Range',_0xa97158+'-'+_0x285a36+'/'+_0x2c8a02)[_0xbdbf('0x14')](_0x41662a);}return null;};}function patchUpdates(_0x5e412c){return function(_0x44237b){try{jsonpatch[_0xbdbf('0x1a')](_0x44237b,_0x5e412c,!![]);}catch(_0x3a1cdd){return BPromise[_0xbdbf('0x1b')](_0x3a1cdd);}return _0x44237b[_0xbdbf('0x1c')]();};}function saveUpdates(_0x55c213,_0x53b30d){return function(_0x36de49){if(_0x36de49){return _0x36de49[_0xbdbf('0x1d')](_0x55c213)[_0xbdbf('0x1e')](function(_0x174b5f){return _0x174b5f;});}return null;};}function removeEntity(_0x475488,_0x13872d){return function(_0x1149fc){if(_0x1149fc){return _0x1149fc[_0xbdbf('0x1f')]()[_0xbdbf('0x1e')](function(){_0x475488[_0xbdbf('0x12')](0xcc)[_0xbdbf('0x13')]();});}};}function handleEntityNotFound(_0x406379,_0x112c24){return function(_0x5ee217){if(!_0x5ee217){_0x406379[_0xbdbf('0x11')](0x194);}return _0x5ee217;};}function handleError(_0x598239,_0x426378){_0x426378=_0x426378||0x1f4;return function(_0xfdbe5e){logger[_0xbdbf('0x20')](_0xfdbe5e[_0xbdbf('0x21')]);if(_0xfdbe5e[_0xbdbf('0x22')]){delete _0xfdbe5e['name'];}_0x598239[_0xbdbf('0x12')](_0x426378)['send'](_0xfdbe5e);};}exports[_0xbdbf('0x23')]=function(_0x468ffa,_0xc6af9a){var _0x39b858={},_0x38d862={},_0x19bb73={'count':0x0,'rows':[]};var _0x2447e1=_['map'](db[_0xbdbf('0x24')][_0xbdbf('0x25')],function(_0x45e53e){return{'name':_0x45e53e[_0xbdbf('0x26')],'type':_0x45e53e['type'][_0xbdbf('0x27')]};});_0x38d862[_0xbdbf('0x28')]=_[_0xbdbf('0x29')](_0x2447e1,'name');_0x38d862['query']=_[_0xbdbf('0x2a')](_0x468ffa[_0xbdbf('0x2b')]);_0x38d862['filters']=_['intersection'](_0x38d862[_0xbdbf('0x28')],_0x38d862['query']);_0x39b858[_0xbdbf('0x2c')]=_[_0xbdbf('0x2d')](_0x38d862['model'],qs['fields'](_0x468ffa[_0xbdbf('0x2b')][_0xbdbf('0x2e')]));_0x39b858[_0xbdbf('0x2c')]=_0x39b858[_0xbdbf('0x2c')][_0xbdbf('0x2f')]?_0x39b858[_0xbdbf('0x2c')]:_0x38d862[_0xbdbf('0x28')];if(!_0x468ffa[_0xbdbf('0x2b')][_0xbdbf('0x30')](_0xbdbf('0x31'))){_0x39b858[_0xbdbf('0x18')]=qs[_0xbdbf('0x18')](_0x468ffa[_0xbdbf('0x2b')][_0xbdbf('0x18')]);_0x39b858[_0xbdbf('0x17')]=qs[_0xbdbf('0x17')](_0x468ffa[_0xbdbf('0x2b')][_0xbdbf('0x17')]);}_0x39b858[_0xbdbf('0x32')]=qs[_0xbdbf('0x33')](_0x468ffa[_0xbdbf('0x2b')]['sort']);_0x39b858['where']=qs['filters'](_['pick'](_0x468ffa[_0xbdbf('0x2b')],_0x38d862[_0xbdbf('0x34')]),_0x2447e1);if(_0x468ffa[_0xbdbf('0x2b')][_0xbdbf('0x35')]){_0x39b858['where']=_['merge'](_0x39b858['where'],{'$or':_[_0xbdbf('0x29')](_0x2447e1,function(_0x549fc7){if(_0x549fc7[_0xbdbf('0x36')]!=='VIRTUAL'){var _0x5f2b87={};_0x5f2b87[_0x549fc7[_0xbdbf('0x22')]]={'$like':'%'+_0x468ffa[_0xbdbf('0x2b')]['filter']+'%'};return _0x5f2b87;}})});}_0x39b858=_[_0xbdbf('0x37')]({},_0x39b858,_0x468ffa[_0xbdbf('0x38')]);var _0x27e27a={'where':_0x39b858[_0xbdbf('0x39')]};return db['VtigerField']['count'](_0x27e27a)[_0xbdbf('0x1e')](function(_0x2ee481){_0x19bb73[_0xbdbf('0x16')]=_0x2ee481;if(_0x468ffa[_0xbdbf('0x2b')]['includeAll']){_0x39b858[_0xbdbf('0x3a')]=[{'all':!![]}];}return db['VtigerField'][_0xbdbf('0x3b')](_0x39b858);})[_0xbdbf('0x1e')](function(_0x42a8fd){_0x19bb73[_0xbdbf('0x3c')]=_0x42a8fd;return _0x19bb73;})[_0xbdbf('0x1e')](respondWithFilteredResult(_0xc6af9a,_0x39b858))['catch'](handleError(_0xc6af9a,null));};exports[_0xbdbf('0x3d')]=function(_0x63ff9c,_0x1cc650){var _0x2f3eeb={'raw':!![],'where':{'id':_0x63ff9c[_0xbdbf('0x3e')]['id']}},_0xe7376f={};_0xe7376f[_0xbdbf('0x28')]=_[_0xbdbf('0x2a')](db['VtigerField'][_0xbdbf('0x25')]);_0xe7376f['query']=_[_0xbdbf('0x2a')](_0x63ff9c[_0xbdbf('0x2b')]);_0xe7376f['filters']=_[_0xbdbf('0x2d')](_0xe7376f['model'],_0xe7376f['query']);_0x2f3eeb['attributes']=_[_0xbdbf('0x2d')](_0xe7376f[_0xbdbf('0x28')],qs[_0xbdbf('0x2e')](_0x63ff9c[_0xbdbf('0x2b')][_0xbdbf('0x2e')]));_0x2f3eeb[_0xbdbf('0x2c')]=_0x2f3eeb['attributes'][_0xbdbf('0x2f')]?_0x2f3eeb[_0xbdbf('0x2c')]:_0xe7376f[_0xbdbf('0x28')];if(_0x63ff9c[_0xbdbf('0x2b')]['includeAll']){_0x2f3eeb[_0xbdbf('0x3a')]=[{'all':!![]}];}_0x2f3eeb=_[_0xbdbf('0x37')]({},_0x2f3eeb,_0x63ff9c[_0xbdbf('0x38')]);return db[_0xbdbf('0x24')]['find'](_0x2f3eeb)[_0xbdbf('0x1e')](handleEntityNotFound(_0x1cc650,null))[_0xbdbf('0x1e')](respondWithResult(_0x1cc650,null))[_0xbdbf('0x3f')](handleError(_0x1cc650,null));};exports[_0xbdbf('0x40')]=function(_0x13d5ef,_0x783457){return db['VtigerField']['create'](_0x13d5ef[_0xbdbf('0x41')],{})[_0xbdbf('0x1e')](respondWithResult(_0x783457,0xc9))['catch'](handleError(_0x783457,null));};exports['update']=function(_0x5b8a65,_0x3b606b){if(_0x5b8a65[_0xbdbf('0x41')]['id']){delete _0x5b8a65[_0xbdbf('0x41')]['id'];}return db[_0xbdbf('0x24')][_0xbdbf('0x42')]({'where':{'id':_0x5b8a65[_0xbdbf('0x3e')]['id']}})[_0xbdbf('0x1e')](handleEntityNotFound(_0x3b606b,null))[_0xbdbf('0x1e')](saveUpdates(_0x5b8a65[_0xbdbf('0x41')],null))[_0xbdbf('0x1e')](respondWithResult(_0x3b606b,null))[_0xbdbf('0x3f')](handleError(_0x3b606b,null));};exports[_0xbdbf('0x1f')]=function(_0x205bfa,_0x4aaf35){return db[_0xbdbf('0x24')][_0xbdbf('0x42')]({'where':{'id':_0x205bfa[_0xbdbf('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4aaf35,null))['then'](removeEntity(_0x4aaf35,null))[_0xbdbf('0x3f')](handleError(_0x4aaf35,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ca36da5..80ad035 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 _0x5a36=['idField','FieldId','../../config/logger','api','moment','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index'];(function(_0x169287,_0x1df3bc){var _0x35ca59=function(_0x50b78e){while(--_0x50b78e){_0x169287['push'](_0x169287['shift']());}};_0x35ca59(++_0x1df3bc);}(_0x5a36,0x1ec));var _0x65a3=function(_0x388546,_0x387a8c){_0x388546=_0x388546-0x0;var _0x59e418=_0x5a36[_0x388546];return _0x59e418;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x65a3('0x0'))(_0x65a3('0x1'));var moment=require(_0x65a3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x65a3('0x3'));var rimraf=require(_0x65a3('0x4'));var config=require(_0x65a3('0x5'));var attributes=require(_0x65a3('0x6'));module[_0x65a3('0x7')]=function(_0x4d6d95,_0x1efc14){return _0x4d6d95[_0x65a3('0x8')](_0x65a3('0x9'),attributes,{'tableName':_0x65a3('0xa'),'paranoid':![],'indexes':[{'name':_0x65a3('0xb'),'fields':[_0x65a3('0xc'),_0x65a3('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ce4=['bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0x9610e5,_0x1c88e7){var _0x349082=function(_0x18c7fe){while(--_0x18c7fe){_0x9610e5['push'](_0x9610e5['shift']());}};_0x349082(++_0x1c88e7);}(_0x3ce4,0xf3));var _0x43ce=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x3ce4[_0xcf5436];return _0xc4f5c8;};'use strict';var _=require(_0x43ce('0x0'));var util=require('util');var logger=require(_0x43ce('0x1'))(_0x43ce('0x2'));var moment=require(_0x43ce('0x3'));var BPromise=require(_0x43ce('0x4'));var rp=require(_0x43ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43ce('0x6'));var config=require(_0x43ce('0x7'));var attributes=require(_0x43ce('0x8'));module[_0x43ce('0x9')]=function(_0x3af76d,_0x30dd09){return _0x3af76d['define']('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x43ce('0xa'),'fields':[_0x43ce('0xb'),_0x43ce('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 21bc34d..968e22a 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 _0x1003=['code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4e43be,_0x3c3c67){var _0x2cce24=function(_0x41d05b){while(--_0x41d05b){_0x4e43be['push'](_0x4e43be['shift']());}};_0x2cce24(++_0x3c3c67);}(_0x1003,0x101));var _0x3100=function(_0x40495f,_0x83f995){_0x40495f=_0x40495f-0x0;var _0x2bc9bc=_0x1003[_0x40495f];return _0x2bc9bc;};'use strict';var _=require(_0x3100('0x0'));var util=require(_0x3100('0x1'));var moment=require(_0x3100('0x2'));var BPromise=require('bluebird');var rs=require(_0x3100('0x3'));var fs=require('fs');var Redis=require(_0x3100('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3100('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3100('0x6'));var client=jayson[_0x3100('0x7')][_0x3100('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5519f6,_0x157011,_0x3285d5){return new BPromise(function(_0x4b5519,_0x2ca64e){return client[_0x3100('0x9')](_0x5519f6,_0x3285d5)['then'](function(_0x2b98e9){logger[_0x3100('0xa')]('VtigerField,\x20%s,\x20%s',_0x157011,_0x3100('0xb'));logger[_0x3100('0xc')](_0x3100('0xd'),_0x157011,_0x3100('0xb'),JSON[_0x3100('0xe')](_0x2b98e9));if(_0x2b98e9[_0x3100('0xf')]){if(_0x2b98e9['error'][_0x3100('0x10')]===0x1f4){logger['error'](_0x3100('0x11'),_0x157011,_0x2b98e9[_0x3100('0xf')][_0x3100('0x12')]);return _0x2ca64e(_0x2b98e9['error'][_0x3100('0x12')]);}logger[_0x3100('0xf')](_0x3100('0x11'),_0x157011,_0x2b98e9[_0x3100('0xf')][_0x3100('0x12')]);return _0x4b5519(_0x2b98e9['error'][_0x3100('0x12')]);}else{logger[_0x3100('0xa')](_0x3100('0x11'),_0x157011,'request\x20sent');_0x4b5519(_0x2b98e9[_0x3100('0x13')][_0x3100('0x12')]);}})[_0x3100('0x14')](function(_0x5bb3f3){logger[_0x3100('0xf')](_0x3100('0x11'),_0x157011,_0x5bb3f3);_0x2ca64e(_0x5bb3f3);});});} \ No newline at end of file +var _0xcb71=['then','request\x20sent','debug','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request'];(function(_0x363da9,_0x3a0c4a){var _0xcc51c1=function(_0x3a80e4){while(--_0x3a80e4){_0x363da9['push'](_0x363da9['shift']());}};_0xcc51c1(++_0x3a0c4a);}(_0xcb71,0xe7));var _0x1cb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb71[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1cb7('0x0'));var util=require(_0x1cb7('0x1'));var moment=require(_0x1cb7('0x2'));var BPromise=require(_0x1cb7('0x3'));var rs=require(_0x1cb7('0x4'));var fs=require('fs');var Redis=require(_0x1cb7('0x5'));var db=require(_0x1cb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1cb7('0x7'))('rpc');var config=require(_0x1cb7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1cb7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f856f,_0x53e306,_0x2b1e28){return new BPromise(function(_0x163570,_0x5ec180){return client[_0x1cb7('0xa')](_0x1f856f,_0x2b1e28)[_0x1cb7('0xb')](function(_0x27513c){logger['info']('VtigerField,\x20%s,\x20%s',_0x53e306,_0x1cb7('0xc'));logger[_0x1cb7('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x53e306,_0x1cb7('0xc'),JSON[_0x1cb7('0xe')](_0x27513c));if(_0x27513c[_0x1cb7('0xf')]){if(_0x27513c['error'][_0x1cb7('0x10')]===0x1f4){logger[_0x1cb7('0xf')](_0x1cb7('0x11'),_0x53e306,_0x27513c['error'][_0x1cb7('0x12')]);return _0x5ec180(_0x27513c[_0x1cb7('0xf')][_0x1cb7('0x12')]);}logger[_0x1cb7('0xf')](_0x1cb7('0x11'),_0x53e306,_0x27513c[_0x1cb7('0xf')][_0x1cb7('0x12')]);return _0x163570(_0x27513c['error'][_0x1cb7('0x12')]);}else{logger[_0x1cb7('0x13')]('VtigerField,\x20%s,\x20%s',_0x53e306,_0x1cb7('0xc'));_0x163570(_0x27513c[_0x1cb7('0x14')][_0x1cb7('0x12')]);}})[_0x1cb7('0x15')](function(_0x2f7820){logger['error'](_0x1cb7('0x11'),_0x53e306,_0x2f7820);_0x5ec180(_0x2f7820);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index a2fb89d..a437b9d 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 _0x6177=['isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x51f113,_0x2771e3){var _0x2d60d4=function(_0x481bf5){while(--_0x481bf5){_0x51f113['push'](_0x51f113['shift']());}};_0x2d60d4(++_0x2771e3);}(_0x6177,0xf8));var _0x7617=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x6177[_0xc67528];return _0x38e26d;};'use strict';var multer=require(_0x7617('0x0'));var util=require(_0x7617('0x1'));var path=require(_0x7617('0x2'));var timeout=require(_0x7617('0x3'));var express=require(_0x7617('0x4'));var router=express[_0x7617('0x5')]();var fs_extra=require(_0x7617('0x6'));var auth=require(_0x7617('0x7'));var interaction=require(_0x7617('0x8'));var config=require(_0x7617('0x9'));var controller=require(_0x7617('0xa'));router[_0x7617('0xb')]('/',auth[_0x7617('0xc')](),controller[_0x7617('0xd')]);router[_0x7617('0xb')](_0x7617('0xe'),auth[_0x7617('0xc')](),controller[_0x7617('0xf')]);router[_0x7617('0xb')]('/:id/configurations',auth[_0x7617('0xc')](),controller[_0x7617('0x10')]);router['get'](_0x7617('0x11'),auth[_0x7617('0xc')](),controller[_0x7617('0x12')]);router[_0x7617('0x13')]('/',auth['isAuthenticated'](),controller[_0x7617('0x14')]);router[_0x7617('0x13')](_0x7617('0x15'),auth[_0x7617('0xc')](),controller[_0x7617('0x16')]);router['put'](_0x7617('0xe'),auth[_0x7617('0xc')](),controller[_0x7617('0x17')]);router[_0x7617('0x18')](_0x7617('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x7617('0x19')]=router; \ No newline at end of file +var _0xff86=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','/:id'];(function(_0x14afb9,_0x4c3bce){var _0x4f5352=function(_0x2c128f){while(--_0x2c128f){_0x14afb9['push'](_0x14afb9['shift']());}};_0x4f5352(++_0x4c3bce);}(_0xff86,0x1a4));var _0x6ff8=function(_0x5028e0,_0xcedba){_0x5028e0=_0x5028e0-0x0;var _0xc0930b=_0xff86[_0x5028e0];return _0xc0930b;};'use strict';var multer=require(_0x6ff8('0x0'));var util=require(_0x6ff8('0x1'));var path=require(_0x6ff8('0x2'));var timeout=require(_0x6ff8('0x3'));var express=require('express');var router=express[_0x6ff8('0x4')]();var fs_extra=require(_0x6ff8('0x5'));var auth=require(_0x6ff8('0x6'));var interaction=require(_0x6ff8('0x7'));var config=require(_0x6ff8('0x8'));var controller=require(_0x6ff8('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6ff8('0xa')](_0x6ff8('0xb'),auth[_0x6ff8('0xc')](),controller[_0x6ff8('0xd')]);router['get'](_0x6ff8('0xe'),auth[_0x6ff8('0xc')](),controller[_0x6ff8('0xf')]);router['get'](_0x6ff8('0x10'),auth[_0x6ff8('0xc')](),controller['getFields']);router[_0x6ff8('0x11')]('/',auth[_0x6ff8('0xc')](),controller[_0x6ff8('0x12')]);router[_0x6ff8('0x11')](_0x6ff8('0xe'),auth[_0x6ff8('0xc')](),controller[_0x6ff8('0x13')]);router[_0x6ff8('0x14')](_0x6ff8('0xb'),auth[_0x6ff8('0xc')](),controller[_0x6ff8('0x15')]);router[_0x6ff8('0x16')](_0x6ff8('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x6ff8('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5431e58..5affe13 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 _0x1a37=['remoteUri','password','ENUM','integrationTab','sequelize','exports','STRING','username'];(function(_0x59d35b,_0x2cb74d){var _0x2f2bcd=function(_0x161bf0){while(--_0x161bf0){_0x59d35b['push'](_0x59d35b['shift']());}};_0x2f2bcd(++_0x2cb74d);}(_0x1a37,0xb4));var _0x71a3=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x1a37[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require(_0x71a3('0x0'));module[_0x71a3('0x1')]={'name':{'type':Sequelize[_0x71a3('0x2')]},'description':{'type':Sequelize[_0x71a3('0x2')]},'username':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x3')},'password':{'type':Sequelize[_0x71a3('0x2')]},'token':{'type':Sequelize[_0x71a3('0x2')]},'remoteUri':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x4')},'authType':{'type':Sequelize['ENUM'](_0x71a3('0x5'),'token'),'defaultValue':_0x71a3('0x5')},'serverUrl':{'type':Sequelize[_0x71a3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x71a3('0x6')](_0x71a3('0x7'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xe928=['password','ENUM','integrationTab','sequelize','exports','STRING','remoteUri'];(function(_0x26daa0,_0x22afee){var _0x536de2=function(_0xcae85e){while(--_0xcae85e){_0x26daa0['push'](_0x26daa0['shift']());}};_0x536de2(++_0x22afee);}(_0xe928,0x145));var _0x8e92=function(_0x5b8646,_0x3e1589){_0x5b8646=_0x5b8646-0x0;var _0x363e4c=_0xe928[_0x5b8646];return _0x363e4c;};'use strict';var Sequelize=require(_0x8e92('0x0'));module[_0x8e92('0x1')]={'name':{'type':Sequelize[_0x8e92('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8e92('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x8e92('0x2')]},'token':{'type':Sequelize[_0x8e92('0x2')]},'remoteUri':{'type':Sequelize[_0x8e92('0x2')],'unique':_0x8e92('0x3')},'authType':{'type':Sequelize['ENUM'](_0x8e92('0x4'),'token'),'defaultValue':_0x8e92('0x4')},'serverUrl':{'type':Sequelize[_0x8e92('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8e92('0x5')](_0x8e92('0x6'),'newTab'),'defaultValue':_0x8e92('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 13c4eed..4d12f3f 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 _0x9ffd=['catch','show','params','rawAttributes','find','create','body','destroy','getConfigurations','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','findOne','username','password','token','authType','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','update','then','stack','name','index','map','ZendeskAccount','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x3ef550,_0x43d56c){var _0x2c97ec=function(_0x5482e6){while(--_0x5482e6){_0x3ef550['push'](_0x3ef550['shift']());}};_0x2c97ec(++_0x43d56c);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x264fdb,_0x511406){_0x264fdb=_0x264fdb-0x0;var _0x3af01b=_0x9ffd[_0x264fdb];return _0x3af01b;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x47b0d7,_0xaaf7af){_0xaaf7af=_0xaaf7af||0xcc;return function(_0x16a0d9){if(_0x16a0d9){return _0x47b0d7[_0xd9ff('0x1a')](_0xaaf7af);}return _0x47b0d7[_0xd9ff('0x1b')](_0xaaf7af)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x556aa4,_0x2f78c1){_0x2f78c1=_0x2f78c1||0xc8;return function(_0x3c9ace){if(_0x3c9ace){return _0x556aa4['status'](_0x2f78c1)[_0xd9ff('0x1d')](_0x3c9ace);}};}function respondWithFilteredResult(_0x5db010,_0x4ffe54){return function(_0x547e28){if(_0x547e28){var _0x4c5718=typeof _0x4ffe54[_0xd9ff('0x1e')]==='undefined'&&typeof _0x4ffe54[_0xd9ff('0x1f')]===_0xd9ff('0x20');var _0x39c6ce=_0x547e28[_0xd9ff('0x21')];var _0x5f45c4=_0x4c5718?0x0:_0x4ffe54[_0xd9ff('0x1e')];var _0x3ccf15=_0x4c5718?_0x547e28[_0xd9ff('0x21')]:_0x4ffe54[_0xd9ff('0x1e')]+_0x4ffe54[_0xd9ff('0x1f')];var _0x3ea97d;if(_0x3ccf15>=_0x39c6ce){_0x3ccf15=_0x39c6ce;_0x3ea97d=0xc8;}else{_0x3ea97d=0xce;}_0x5db010[_0xd9ff('0x1b')](_0x3ea97d);return _0x5db010[_0xd9ff('0x22')]('Content-Range',_0x5f45c4+'-'+_0x3ccf15+'/'+_0x39c6ce)['json'](_0x547e28);}return null;};}function patchUpdates(_0x264a3d){return function(_0x3eed13){try{jsonpatch['apply'](_0x3eed13,_0x264a3d,!![]);}catch(_0x588151){return BPromise['reject'](_0x588151);}return _0x3eed13['save']();};}function saveUpdates(_0x1f4d9e,_0x58eb5f){return function(_0x4c486a){if(_0x4c486a){return _0x4c486a[_0xd9ff('0x23')](_0x1f4d9e)[_0xd9ff('0x24')](function(_0x9f074e){return _0x9f074e;});}return null;};}function removeEntity(_0x278b66,_0x42a828){return function(_0x4b058a){if(_0x4b058a){return _0x4b058a['destroy']()[_0xd9ff('0x24')](function(){_0x278b66['status'](0xcc)[_0xd9ff('0x1c')]();});}};}function handleEntityNotFound(_0x4d86fe,_0x285002){return function(_0x5d45b3){if(!_0x5d45b3){_0x4d86fe[_0xd9ff('0x1a')](0x194);}return _0x5d45b3;};}function handleError(_0x159e56,_0x2138b4){_0x2138b4=_0x2138b4||0x1f4;return function(_0x2970e8){logger['error'](_0x2970e8[_0xd9ff('0x25')]);if(_0x2970e8[_0xd9ff('0x26')]){delete _0x2970e8[_0xd9ff('0x26')];}_0x159e56[_0xd9ff('0x1b')](_0x2138b4)['send'](_0x2970e8);};}exports[_0xd9ff('0x27')]=function(_0x3792d9,_0x44b5a7){var _0x45fb63={},_0x263d3a={},_0xe516e2={'count':0x0,'rows':[]};var _0x420ffa=_[_0xd9ff('0x28')](db[_0xd9ff('0x29')]['rawAttributes'],function(_0xcea5db){return{'name':_0xcea5db['fieldName'],'type':_0xcea5db[_0xd9ff('0x2a')][_0xd9ff('0x2b')]};});_0x263d3a[_0xd9ff('0x2c')]=_['map'](_0x420ffa,_0xd9ff('0x26'));_0x263d3a[_0xd9ff('0x2d')]=_[_0xd9ff('0x2e')](_0x3792d9[_0xd9ff('0x2d')]);_0x263d3a['filters']=_[_0xd9ff('0x2f')](_0x263d3a['model'],_0x263d3a[_0xd9ff('0x2d')]);_0x45fb63[_0xd9ff('0x30')]=_[_0xd9ff('0x2f')](_0x263d3a[_0xd9ff('0x2c')],qs[_0xd9ff('0x31')](_0x3792d9[_0xd9ff('0x2d')][_0xd9ff('0x31')]));_0x45fb63[_0xd9ff('0x30')]=_0x45fb63[_0xd9ff('0x30')][_0xd9ff('0x32')]?_0x45fb63[_0xd9ff('0x30')]:_0x263d3a[_0xd9ff('0x2c')];if(!_0x3792d9[_0xd9ff('0x2d')][_0xd9ff('0x33')]('nolimit')){_0x45fb63[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x3792d9[_0xd9ff('0x2d')]['limit']);_0x45fb63[_0xd9ff('0x1e')]=qs['offset'](_0x3792d9[_0xd9ff('0x2d')]['offset']);}_0x45fb63[_0xd9ff('0x34')]=qs['sort'](_0x3792d9[_0xd9ff('0x2d')][_0xd9ff('0x35')]);_0x45fb63[_0xd9ff('0x36')]=qs['filters'](_['pick'](_0x3792d9['query'],_0x263d3a[_0xd9ff('0x37')]),_0x420ffa);if(_0x3792d9[_0xd9ff('0x2d')][_0xd9ff('0x38')]){_0x45fb63[_0xd9ff('0x36')]=_[_0xd9ff('0x39')](_0x45fb63[_0xd9ff('0x36')],{'$or':_['map'](_0x420ffa,function(_0x4c00c2){if(_0x4c00c2['type']!==_0xd9ff('0x3a')){var _0x252edc={};_0x252edc[_0x4c00c2[_0xd9ff('0x26')]]={'$like':'%'+_0x3792d9[_0xd9ff('0x2d')]['filter']+'%'};return _0x252edc;}})});}_0x45fb63=_[_0xd9ff('0x39')]({},_0x45fb63,_0x3792d9['options']);var _0x3cff52={'where':_0x45fb63[_0xd9ff('0x36')]};return db[_0xd9ff('0x29')][_0xd9ff('0x21')](_0x3cff52)['then'](function(_0x1e34da){_0xe516e2[_0xd9ff('0x21')]=_0x1e34da;if(_0x3792d9['query'][_0xd9ff('0x3b')]){_0x45fb63[_0xd9ff('0x3c')]=[{'all':!![]}];}return db[_0xd9ff('0x29')][_0xd9ff('0x3d')](_0x45fb63);})[_0xd9ff('0x24')](function(_0x1cc848){_0xe516e2['rows']=_0x1cc848;return _0xe516e2;})[_0xd9ff('0x24')](respondWithFilteredResult(_0x44b5a7,_0x45fb63))[_0xd9ff('0x3e')](handleError(_0x44b5a7,null));};exports[_0xd9ff('0x3f')]=function(_0x39fbbb,_0x472724){var _0x52aab8={'raw':![],'where':{'id':_0x39fbbb[_0xd9ff('0x40')]['id']}},_0x3178cd={};_0x3178cd[_0xd9ff('0x2c')]=_['keys'](db['ZendeskAccount'][_0xd9ff('0x41')]);_0x3178cd[_0xd9ff('0x2d')]=_[_0xd9ff('0x2e')](_0x39fbbb[_0xd9ff('0x2d')]);_0x3178cd[_0xd9ff('0x37')]=_[_0xd9ff('0x2f')](_0x3178cd['model'],_0x3178cd[_0xd9ff('0x2d')]);_0x52aab8[_0xd9ff('0x30')]=_['intersection'](_0x3178cd[_0xd9ff('0x2c')],qs[_0xd9ff('0x31')](_0x39fbbb[_0xd9ff('0x2d')][_0xd9ff('0x31')]));_0x52aab8[_0xd9ff('0x30')]=_0x52aab8['attributes']['length']?_0x52aab8['attributes']:_0x3178cd[_0xd9ff('0x2c')];if(_0x39fbbb['query'][_0xd9ff('0x3b')]){_0x52aab8[_0xd9ff('0x3c')]=[{'all':!![]}];}_0x52aab8=_[_0xd9ff('0x39')]({},_0x52aab8,_0x39fbbb['options']);return db[_0xd9ff('0x29')][_0xd9ff('0x42')](_0x52aab8)['then'](handleEntityNotFound(_0x472724,null))[_0xd9ff('0x24')](respondWithResult(_0x472724,null))[_0xd9ff('0x3e')](handleError(_0x472724,null));};exports[_0xd9ff('0x43')]=function(_0x316854,_0x559101){return db[_0xd9ff('0x29')]['create'](_0x316854[_0xd9ff('0x44')],{})['then'](respondWithResult(_0x559101,0xc9))[_0xd9ff('0x3e')](handleError(_0x559101,null));};exports[_0xd9ff('0x23')]=function(_0x2bf37a,_0x1760c3){if(_0x2bf37a[_0xd9ff('0x44')]['id']){delete _0x2bf37a['body']['id'];}return db[_0xd9ff('0x29')][_0xd9ff('0x42')]({'where':{'id':_0x2bf37a[_0xd9ff('0x40')]['id']}})[_0xd9ff('0x24')](handleEntityNotFound(_0x1760c3,null))['then'](saveUpdates(_0x2bf37a['body'],null))['then'](respondWithResult(_0x1760c3,null))[_0xd9ff('0x3e')](handleError(_0x1760c3,null));};exports[_0xd9ff('0x45')]=function(_0x29c6bd,_0x572618){return db[_0xd9ff('0x29')][_0xd9ff('0x42')]({'where':{'id':_0x29c6bd[_0xd9ff('0x40')]['id']}})[_0xd9ff('0x24')](handleEntityNotFound(_0x572618,null))[_0xd9ff('0x24')](removeEntity(_0x572618,null))[_0xd9ff('0x3e')](handleError(_0x572618,null));};exports[_0xd9ff('0x46')]=function(_0x1e1364,_0x1ad160,_0x10d9d0){var _0x5dcb5={};var _0x3d6143={};var _0x2533d7;var _0x487b07;return db[_0xd9ff('0x29')]['findOne']({'where':{'id':_0x1e1364[_0xd9ff('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ad160,null))[_0xd9ff('0x24')](function(_0x49623d){if(_0x49623d){_0x2533d7=_0x49623d;_0x3d6143[_0xd9ff('0x2c')]=_['keys'](db[_0xd9ff('0x47')]['rawAttributes']);_0x3d6143[_0xd9ff('0x2d')]=_['keys'](_0x1e1364[_0xd9ff('0x2d')]);_0x3d6143['filters']=_[_0xd9ff('0x2f')](_0x3d6143[_0xd9ff('0x2c')],_0x3d6143[_0xd9ff('0x2d')]);_0x5dcb5[_0xd9ff('0x30')]=_['intersection'](_0x3d6143[_0xd9ff('0x2c')],qs[_0xd9ff('0x31')](_0x1e1364[_0xd9ff('0x2d')]['fields']));_0x5dcb5[_0xd9ff('0x30')]=_0x5dcb5[_0xd9ff('0x30')][_0xd9ff('0x32')]?_0x5dcb5[_0xd9ff('0x30')]:_0x3d6143[_0xd9ff('0x2c')];_0x5dcb5['order']=qs[_0xd9ff('0x35')](_0x1e1364[_0xd9ff('0x2d')][_0xd9ff('0x35')]);_0x5dcb5[_0xd9ff('0x36')]=qs[_0xd9ff('0x37')](_[_0xd9ff('0x48')](_0x1e1364[_0xd9ff('0x2d')],_0x3d6143['filters']));if(_0x1e1364[_0xd9ff('0x2d')][_0xd9ff('0x38')]){_0x5dcb5['where']=_[_0xd9ff('0x39')](_0x5dcb5[_0xd9ff('0x36')],{'$or':_['map'](_0x5dcb5[_0xd9ff('0x30')],function(_0x36d5c2){var _0x25d8d1={};_0x25d8d1[_0x36d5c2]={'$like':'%'+_0x1e1364['query']['filter']+'%'};return _0x25d8d1;})});}_0x5dcb5=_[_0xd9ff('0x39')]({},_0x5dcb5,_0x1e1364['options']);return _0x2533d7[_0xd9ff('0x46')](_0x5dcb5);}})[_0xd9ff('0x24')](function(_0x31907e){if(_0x31907e){_0x487b07=_0x31907e[_0xd9ff('0x32')];if(!_0x1e1364['query']['hasOwnProperty']('nolimit')){_0x5dcb5[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x1e1364[_0xd9ff('0x2d')][_0xd9ff('0x1f')]);_0x5dcb5[_0xd9ff('0x1e')]=qs['offset'](_0x1e1364[_0xd9ff('0x2d')]['offset']);}return _0x2533d7[_0xd9ff('0x46')](_0x5dcb5);}})[_0xd9ff('0x24')](function(_0x3f92c3){if(_0x3f92c3){return _0x3f92c3?{'count':_0x487b07,'rows':_0x3f92c3}:null;}})[_0xd9ff('0x24')](respondWithResult(_0x1ad160,null))[_0xd9ff('0x3e')](handleError(_0x1ad160,null));};exports[_0xd9ff('0x49')]=function(_0xed12df,_0xfcafbe,_0x5d633b){if(_0xed12df[_0xd9ff('0x44')]['id']){delete _0xed12df[_0xd9ff('0x44')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0xed12df[_0xd9ff('0x40')]['id']}})['then'](handleEntityNotFound(_0xfcafbe,null))[_0xd9ff('0x24')](function(_0x34fca4){if(_0x34fca4){_0xed12df['body'][_0xd9ff('0x4a')]=_0x34fca4['id'];_0xed12df[_0xd9ff('0x44')][_0xd9ff('0x4b')]=integrations[_0xd9ff('0x4c')](_0xed12df[_0xd9ff('0x44')]['channel'],_0xed12df[_0xd9ff('0x44')]['type']);_0xed12df['body'][_0xd9ff('0x4d')]=integrations[_0xd9ff('0x4e')](_0xed12df[_0xd9ff('0x44')][_0xd9ff('0x4f')],_0xed12df['body'][_0xd9ff('0x2a')]);return db[_0xd9ff('0x47')][_0xd9ff('0x43')](_0xed12df[_0xd9ff('0x44')],{'include':[{'model':db[_0xd9ff('0x50')],'as':_0xd9ff('0x4b')},{'model':db[_0xd9ff('0x50')],'as':_0xd9ff('0x4d')}]});}return null;})['then'](respondWithResult(_0xfcafbe,null))['catch'](handleError(_0xfcafbe,null));};exports['getFields']=function(_0x275fb9,_0x31db27,_0x514d59){var _0x196670='';return db[_0xd9ff('0x29')][_0xd9ff('0x51')]({'where':{'id':_0x275fb9[_0xd9ff('0x40')]['id']},'attributes':['id',_0xd9ff('0x52'),_0xd9ff('0x53'),_0xd9ff('0x54'),_0xd9ff('0x55'),'remoteUri']})[_0xd9ff('0x24')](handleEntityNotFound(_0x31db27,null))[_0xd9ff('0x24')](function(_0x228413){if(_0x228413){_0x196670=_0x228413['remoteUri'];var _0x14e936=_0x196670['slice'](-0x1);if(_0x14e936==='/'){_0x196670=_0x196670[_0xd9ff('0x56')](0x0,_0x196670[_0xd9ff('0x57')](_0x14e936));}var _0x25ee82={'method':'GET','uri':util[_0xd9ff('0x58')](_0xd9ff('0x59'),_0x196670,_0xd9ff('0x5a')),'json':!![]};switch(_0x228413[_0xd9ff('0x55')]){case'password':_0x25ee82[_0xd9ff('0x5b')]={'Authorization':util[_0xd9ff('0x58')](_0xd9ff('0x5c'),new Buffer(util['format'](_0xd9ff('0x5d'),_0x228413[_0xd9ff('0x52')],_0x228413[_0xd9ff('0x53')]))['toString'](_0xd9ff('0x5e')))};break;case _0xd9ff('0x54'):_0x25ee82[_0xd9ff('0x5b')]={'Authorization':util[_0xd9ff('0x58')](_0xd9ff('0x5c'),new Buffer(util['format'](_0xd9ff('0x5f'),_0x228413[_0xd9ff('0x52')],_0x228413['token']))[_0xd9ff('0x60')](_0xd9ff('0x5e')))};break;default:throw new db[(_0xd9ff('0x61'))]['ValidationError'](_0xd9ff('0x62'));}return rp(_0x25ee82);}})['then'](function(_0x1e46fc){if(_0x1e46fc){var _0x478e0d=[_0xd9ff('0x63'),_0xd9ff('0x64'),_0xd9ff('0x65'),_0xd9ff('0x66')];_[_0xd9ff('0x67')](_0x1e46fc[_0xd9ff('0x5a')],function(_0xda0003){return _0x478e0d[_0xd9ff('0x68')](_0xda0003[_0xd9ff('0x2a')]);});return{'count':_0x1e46fc[_0xd9ff('0x5a')]['length'],'rows':_[_0xd9ff('0x28')](_0x1e46fc[_0xd9ff('0x5a')],function(_0x1f6cb9){return{'id':_0x1f6cb9['id'],'name':_0x1f6cb9[_0xd9ff('0x69')]>0x7?_0x1f6cb9[_0xd9ff('0x6a')]:_0x1f6cb9[_0xd9ff('0x2a')],'custom':_0x1f6cb9['position']>0x7?!![]:![],'options':_0x1f6cb9['system_field_options']?_0x1f6cb9[_0xd9ff('0x6b')]:_0x1f6cb9[_0xd9ff('0x6c')]?_0x1f6cb9[_0xd9ff('0x6c')]:[]};})};}})[_0xd9ff('0x24')](respondWithResult(_0x31db27,null))[_0xd9ff('0x3e')](function(_0x183199){var _0x5b234c=_0x275fb9[_0xd9ff('0x2d')][_0xd9ff('0x6d')]?0x1f4:_0x183199[_0xd9ff('0x6e')]||0x1f4;logger[_0xd9ff('0x6f')](_0xd9ff('0x70'),_0xd9ff('0x71'),_0x5b234c,JSON['stringify'](_0x183199));delete _0x183199[_0xd9ff('0x26')];if(_0x5b234c===0x191){_0x5b234c=0x190;}_0x31db27[_0xd9ff('0x1b')](_0x5b234c)[_0xd9ff('0x72')](_0x275fb9[_0xd9ff('0x2d')][_0xd9ff('0x6d')]?{'message':_0xd9ff('0x73'),'statusCode':_0x183199[_0xd9ff('0x6e')]}:_0x183199);});}; \ No newline at end of file +var _0x97c1=['crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','ZendeskAccount','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','findOne','params','ZendeskConfiguration','getConfigurations','addConfiguration','getSubjects','channel','getDescriptions','ZendeskField','Subjects','Descriptions','getFields','authType','remoteUri','slice','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','password','base64','token','%s/token:%s','toString','Sequelize','subject','description','group','assignee','remove','position','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel'];(function(_0x3486c9,_0x3adc85){var _0x290b90=function(_0x4f1ecf){while(--_0x4f1ecf){_0x3486c9['push'](_0x3486c9['shift']());}};_0x290b90(++_0x3adc85);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];var integrations=require(_0x197c('0x17'));function respondWithStatusCode(_0x27e46f,_0x1adcfa){_0x1adcfa=_0x1adcfa||0xcc;return function(_0x567658){if(_0x567658){return _0x27e46f[_0x197c('0x18')](_0x1adcfa);}return _0x27e46f[_0x197c('0x19')](_0x1adcfa)[_0x197c('0x1a')]();};}function respondWithResult(_0xf735ce,_0x188ff2){_0x188ff2=_0x188ff2||0xc8;return function(_0x109af2){if(_0x109af2){return _0xf735ce['status'](_0x188ff2)['json'](_0x109af2);}};}function respondWithFilteredResult(_0x422dfa,_0x2bc612){return function(_0x2083d4){if(_0x2083d4){var _0x24901f=typeof _0x2bc612[_0x197c('0x1b')]===_0x197c('0x1c')&&typeof _0x2bc612[_0x197c('0x1d')]===_0x197c('0x1c');var _0x47f43b=_0x2083d4[_0x197c('0x1e')];var _0x47aaa9=_0x24901f?0x0:_0x2bc612['offset'];var _0x1725d9=_0x24901f?_0x2083d4[_0x197c('0x1e')]:_0x2bc612[_0x197c('0x1b')]+_0x2bc612[_0x197c('0x1d')];var _0x4a4994;if(_0x1725d9>=_0x47f43b){_0x1725d9=_0x47f43b;_0x4a4994=0xc8;}else{_0x4a4994=0xce;}_0x422dfa[_0x197c('0x19')](_0x4a4994);return _0x422dfa[_0x197c('0x1f')](_0x197c('0x20'),_0x47aaa9+'-'+_0x1725d9+'/'+_0x47f43b)['json'](_0x2083d4);}return null;};}function patchUpdates(_0x1adb43){return function(_0x27b3df){try{jsonpatch[_0x197c('0x21')](_0x27b3df,_0x1adb43,!![]);}catch(_0xf3aeda){return BPromise[_0x197c('0x22')](_0xf3aeda);}return _0x27b3df[_0x197c('0x23')]();};}function saveUpdates(_0x362bbf,_0x2092a0){return function(_0x8963fd){if(_0x8963fd){return _0x8963fd[_0x197c('0x24')](_0x362bbf)[_0x197c('0x25')](function(_0x177bc9){return _0x177bc9;});}return null;};}function removeEntity(_0x174942,_0x2a1310){return function(_0x37b040){if(_0x37b040){return _0x37b040[_0x197c('0x26')]()['then'](function(){_0x174942[_0x197c('0x19')](0xcc)[_0x197c('0x1a')]();});}};}function handleEntityNotFound(_0x2b6319,_0x499051){return function(_0x2c2952){if(!_0x2c2952){_0x2b6319[_0x197c('0x18')](0x194);}return _0x2c2952;};}function handleError(_0x4c3337,_0x5e7bc9){_0x5e7bc9=_0x5e7bc9||0x1f4;return function(_0x12b37b){logger['error'](_0x12b37b[_0x197c('0x27')]);if(_0x12b37b[_0x197c('0x28')]){delete _0x12b37b[_0x197c('0x28')];}_0x4c3337[_0x197c('0x19')](_0x5e7bc9)[_0x197c('0x29')](_0x12b37b);};}exports[_0x197c('0x2a')]=function(_0x2b6154,_0x215df1){var _0x4422d1={},_0x5df39e={},_0x50dea3={'count':0x0,'rows':[]};var _0x574274=_['map'](db[_0x197c('0x2b')]['rawAttributes'],function(_0x252cde){return{'name':_0x252cde[_0x197c('0x2c')],'type':_0x252cde['type'][_0x197c('0x2d')]};});_0x5df39e['model']=_[_0x197c('0x2e')](_0x574274,_0x197c('0x28'));_0x5df39e[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x2b6154[_0x197c('0x2f')]);_0x5df39e[_0x197c('0x31')]=_[_0x197c('0x32')](_0x5df39e[_0x197c('0x33')],_0x5df39e[_0x197c('0x2f')]);_0x4422d1['attributes']=_['intersection'](_0x5df39e[_0x197c('0x33')],qs[_0x197c('0x34')](_0x2b6154[_0x197c('0x2f')][_0x197c('0x34')]));_0x4422d1[_0x197c('0x35')]=_0x4422d1[_0x197c('0x35')][_0x197c('0x36')]?_0x4422d1['attributes']:_0x5df39e['model'];if(!_0x2b6154[_0x197c('0x2f')][_0x197c('0x37')]('nolimit')){_0x4422d1['limit']=qs[_0x197c('0x1d')](_0x2b6154[_0x197c('0x2f')][_0x197c('0x1d')]);_0x4422d1[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x2b6154[_0x197c('0x2f')][_0x197c('0x1b')]);}_0x4422d1[_0x197c('0x38')]=qs[_0x197c('0x39')](_0x2b6154['query'][_0x197c('0x39')]);_0x4422d1[_0x197c('0x3a')]=qs[_0x197c('0x31')](_[_0x197c('0x3b')](_0x2b6154[_0x197c('0x2f')],_0x5df39e[_0x197c('0x31')]),_0x574274);if(_0x2b6154['query'][_0x197c('0x3c')]){_0x4422d1[_0x197c('0x3a')]=_[_0x197c('0x3d')](_0x4422d1['where'],{'$or':_[_0x197c('0x2e')](_0x574274,function(_0x34dabc){if(_0x34dabc[_0x197c('0x3e')]!==_0x197c('0x3f')){var _0x2970b4={};_0x2970b4[_0x34dabc[_0x197c('0x28')]]={'$like':'%'+_0x2b6154[_0x197c('0x2f')][_0x197c('0x3c')]+'%'};return _0x2970b4;}})});}_0x4422d1=_[_0x197c('0x3d')]({},_0x4422d1,_0x2b6154[_0x197c('0x40')]);var _0x4a12fc={'where':_0x4422d1[_0x197c('0x3a')]};return db[_0x197c('0x2b')]['count'](_0x4a12fc)['then'](function(_0xa57083){_0x50dea3[_0x197c('0x1e')]=_0xa57083;if(_0x2b6154[_0x197c('0x2f')][_0x197c('0x41')]){_0x4422d1[_0x197c('0x42')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x197c('0x43')](_0x4422d1);})[_0x197c('0x25')](function(_0x7ed02b){_0x50dea3[_0x197c('0x44')]=_0x7ed02b;return _0x50dea3;})[_0x197c('0x25')](respondWithFilteredResult(_0x215df1,_0x4422d1))['catch'](handleError(_0x215df1,null));};exports[_0x197c('0x45')]=function(_0x37bb94,_0x6d7bda){var _0x197b27={'raw':![],'where':{'id':_0x37bb94['params']['id']}},_0x2f3c4b={};_0x2f3c4b[_0x197c('0x33')]=_[_0x197c('0x30')](db[_0x197c('0x2b')][_0x197c('0x46')]);_0x2f3c4b[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x37bb94[_0x197c('0x2f')]);_0x2f3c4b[_0x197c('0x31')]=_[_0x197c('0x32')](_0x2f3c4b[_0x197c('0x33')],_0x2f3c4b[_0x197c('0x2f')]);_0x197b27['attributes']=_['intersection'](_0x2f3c4b['model'],qs['fields'](_0x37bb94[_0x197c('0x2f')][_0x197c('0x34')]));_0x197b27['attributes']=_0x197b27[_0x197c('0x35')][_0x197c('0x36')]?_0x197b27['attributes']:_0x2f3c4b[_0x197c('0x33')];if(_0x37bb94[_0x197c('0x2f')]['includeAll']){_0x197b27[_0x197c('0x42')]=[{'all':!![]}];}_0x197b27=_[_0x197c('0x3d')]({},_0x197b27,_0x37bb94['options']);return db[_0x197c('0x2b')][_0x197c('0x47')](_0x197b27)[_0x197c('0x25')](handleEntityNotFound(_0x6d7bda,null))['then'](respondWithResult(_0x6d7bda,null))[_0x197c('0x48')](handleError(_0x6d7bda,null));};exports[_0x197c('0x49')]=function(_0x220909,_0x1a92d2){return db['ZendeskAccount'][_0x197c('0x49')](_0x220909[_0x197c('0x4a')],{})[_0x197c('0x25')](respondWithResult(_0x1a92d2,0xc9))['catch'](handleError(_0x1a92d2,null));};exports['update']=function(_0x3a5089,_0x332c75){if(_0x3a5089[_0x197c('0x4a')]['id']){delete _0x3a5089[_0x197c('0x4a')]['id'];}return db[_0x197c('0x2b')][_0x197c('0x47')]({'where':{'id':_0x3a5089['params']['id']}})[_0x197c('0x25')](handleEntityNotFound(_0x332c75,null))['then'](saveUpdates(_0x3a5089[_0x197c('0x4a')],null))[_0x197c('0x25')](respondWithResult(_0x332c75,null))[_0x197c('0x48')](handleError(_0x332c75,null));};exports[_0x197c('0x26')]=function(_0x34a211,_0x2ab21f){return db[_0x197c('0x2b')][_0x197c('0x47')]({'where':{'id':_0x34a211['params']['id']}})[_0x197c('0x25')](handleEntityNotFound(_0x2ab21f,null))[_0x197c('0x25')](removeEntity(_0x2ab21f,null))[_0x197c('0x48')](handleError(_0x2ab21f,null));};exports['getConfigurations']=function(_0x114ef5,_0x495c1d,_0x204592){var _0x1d2a5f={};var _0x1ec51a={};var _0x22a106;var _0x1d7cdd;return db[_0x197c('0x2b')][_0x197c('0x4b')]({'where':{'id':_0x114ef5[_0x197c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x495c1d,null))[_0x197c('0x25')](function(_0x3a9261){if(_0x3a9261){_0x22a106=_0x3a9261;_0x1ec51a[_0x197c('0x33')]=_['keys'](db[_0x197c('0x4d')][_0x197c('0x46')]);_0x1ec51a[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x114ef5[_0x197c('0x2f')]);_0x1ec51a['filters']=_['intersection'](_0x1ec51a[_0x197c('0x33')],_0x1ec51a[_0x197c('0x2f')]);_0x1d2a5f[_0x197c('0x35')]=_[_0x197c('0x32')](_0x1ec51a[_0x197c('0x33')],qs['fields'](_0x114ef5['query'][_0x197c('0x34')]));_0x1d2a5f[_0x197c('0x35')]=_0x1d2a5f['attributes'][_0x197c('0x36')]?_0x1d2a5f[_0x197c('0x35')]:_0x1ec51a[_0x197c('0x33')];_0x1d2a5f[_0x197c('0x38')]=qs[_0x197c('0x39')](_0x114ef5[_0x197c('0x2f')]['sort']);_0x1d2a5f[_0x197c('0x3a')]=qs[_0x197c('0x31')](_['pick'](_0x114ef5['query'],_0x1ec51a[_0x197c('0x31')]));if(_0x114ef5['query'][_0x197c('0x3c')]){_0x1d2a5f[_0x197c('0x3a')]=_[_0x197c('0x3d')](_0x1d2a5f['where'],{'$or':_[_0x197c('0x2e')](_0x1d2a5f[_0x197c('0x35')],function(_0x5585de){var _0x2dcbca={};_0x2dcbca[_0x5585de]={'$like':'%'+_0x114ef5[_0x197c('0x2f')][_0x197c('0x3c')]+'%'};return _0x2dcbca;})});}_0x1d2a5f=_['merge']({},_0x1d2a5f,_0x114ef5[_0x197c('0x40')]);return _0x22a106[_0x197c('0x4e')](_0x1d2a5f);}})['then'](function(_0x570d76){if(_0x570d76){_0x1d7cdd=_0x570d76[_0x197c('0x36')];if(!_0x114ef5[_0x197c('0x2f')][_0x197c('0x37')]('nolimit')){_0x1d2a5f[_0x197c('0x1d')]=qs[_0x197c('0x1d')](_0x114ef5[_0x197c('0x2f')]['limit']);_0x1d2a5f[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x114ef5[_0x197c('0x2f')][_0x197c('0x1b')]);}return _0x22a106[_0x197c('0x4e')](_0x1d2a5f);}})[_0x197c('0x25')](function(_0x8d1f3f){if(_0x8d1f3f){return _0x8d1f3f?{'count':_0x1d7cdd,'rows':_0x8d1f3f}:null;}})[_0x197c('0x25')](respondWithResult(_0x495c1d,null))[_0x197c('0x48')](handleError(_0x495c1d,null));};exports[_0x197c('0x4f')]=function(_0x5ef485,_0x1f7ad0,_0x572649){if(_0x5ef485['body']['id']){delete _0x5ef485['body']['id'];}return db['ZendeskAccount'][_0x197c('0x4b')]({'where':{'id':_0x5ef485[_0x197c('0x4c')]['id']}})[_0x197c('0x25')](handleEntityNotFound(_0x1f7ad0,null))[_0x197c('0x25')](function(_0x55b744){if(_0x55b744){_0x5ef485[_0x197c('0x4a')]['AccountId']=_0x55b744['id'];_0x5ef485[_0x197c('0x4a')]['Subjects']=integrations[_0x197c('0x50')](_0x5ef485['body'][_0x197c('0x51')],_0x5ef485[_0x197c('0x4a')][_0x197c('0x3e')]);_0x5ef485[_0x197c('0x4a')]['Descriptions']=integrations[_0x197c('0x52')](_0x5ef485[_0x197c('0x4a')][_0x197c('0x51')],_0x5ef485['body'][_0x197c('0x3e')]);return db[_0x197c('0x4d')][_0x197c('0x49')](_0x5ef485[_0x197c('0x4a')],{'include':[{'model':db[_0x197c('0x53')],'as':_0x197c('0x54')},{'model':db[_0x197c('0x53')],'as':_0x197c('0x55')}]});}return null;})[_0x197c('0x25')](respondWithResult(_0x1f7ad0,null))[_0x197c('0x48')](handleError(_0x1f7ad0,null));};exports[_0x197c('0x56')]=function(_0x25d3c1,_0x43c0b2,_0x395fce){var _0x2b1c78='';return db[_0x197c('0x2b')][_0x197c('0x4b')]({'where':{'id':_0x25d3c1[_0x197c('0x4c')]['id']},'attributes':['id','username','password','token',_0x197c('0x57'),'remoteUri']})[_0x197c('0x25')](handleEntityNotFound(_0x43c0b2,null))['then'](function(_0x5a601c){if(_0x5a601c){_0x2b1c78=_0x5a601c[_0x197c('0x58')];var _0x2c9746=_0x2b1c78[_0x197c('0x59')](-0x1);if(_0x2c9746==='/'){_0x2b1c78=_0x2b1c78['substring'](0x0,_0x2b1c78[_0x197c('0x5a')](_0x2c9746));}var _0x238092={'method':'GET','uri':util[_0x197c('0x5b')](_0x197c('0x5c'),_0x2b1c78,_0x197c('0x5d')),'json':!![]};switch(_0x5a601c[_0x197c('0x57')]){case'password':_0x238092[_0x197c('0x5e')]={'Authorization':util['format'](_0x197c('0x5f'),new Buffer(util['format'](_0x197c('0x60'),_0x5a601c[_0x197c('0x61')],_0x5a601c[_0x197c('0x62')]))['toString'](_0x197c('0x63')))};break;case _0x197c('0x64'):_0x238092[_0x197c('0x5e')]={'Authorization':util['format'](_0x197c('0x5f'),new Buffer(util[_0x197c('0x5b')](_0x197c('0x65'),_0x5a601c[_0x197c('0x61')],_0x5a601c[_0x197c('0x64')]))[_0x197c('0x66')]('base64'))};break;default:throw new db[(_0x197c('0x67'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x238092);}})[_0x197c('0x25')](function(_0x8c0d4a){if(_0x8c0d4a){var _0x58e708=[_0x197c('0x68'),_0x197c('0x69'),_0x197c('0x6a'),_0x197c('0x6b')];_[_0x197c('0x6c')](_0x8c0d4a['ticket_fields'],function(_0x5da64e){return _0x58e708['includes'](_0x5da64e['type']);});return{'count':_0x8c0d4a[_0x197c('0x5d')][_0x197c('0x36')],'rows':_['map'](_0x8c0d4a['ticket_fields'],function(_0x213e01){return{'id':_0x213e01['id'],'name':_0x213e01['position']>0x7?_0x213e01['title']:_0x213e01[_0x197c('0x3e')],'custom':_0x213e01[_0x197c('0x6d')]>0x7?!![]:![],'options':_0x213e01[_0x197c('0x6e')]?_0x213e01[_0x197c('0x6e')]:_0x213e01[_0x197c('0x6f')]?_0x213e01[_0x197c('0x6f')]:[]};})};}})['then'](respondWithResult(_0x43c0b2,null))[_0x197c('0x48')](function(_0x2321e1){var _0x43fc99=_0x25d3c1[_0x197c('0x2f')][_0x197c('0x70')]?0x1f4:_0x2321e1[_0x197c('0x71')]||0x1f4;logger[_0x197c('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0x197c('0x56'),_0x43fc99,JSON[_0x197c('0x73')](_0x2321e1));delete _0x2321e1[_0x197c('0x28')];if(_0x43fc99===0x191){_0x43fc99=0x190;}_0x43c0b2[_0x197c('0x19')](_0x43fc99)[_0x197c('0x29')](_0x25d3c1[_0x197c('0x2f')]['test']?{'message':_0x197c('0x74'),'statusCode':_0x2321e1[_0x197c('0x71')]}:_0x2321e1);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 3e7fd6f..15407bb 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 _0xbf35=['request-promise','rimraf','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','moment','bluebird'];(function(_0x2a7d55,_0x36bd70){var _0x137989=function(_0x51246a){while(--_0x51246a){_0x2a7d55['push'](_0x2a7d55['shift']());}};_0x137989(++_0x36bd70);}(_0xbf35,0x13c));var _0x5bf3=function(_0x59f6dc,_0x390dc0){_0x59f6dc=_0x59f6dc-0x0;var _0x36ea78=_0xbf35[_0x59f6dc];return _0x36ea78;};'use strict';var _=require(_0x5bf3('0x0'));var util=require(_0x5bf3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5bf3('0x2'));var BPromise=require(_0x5bf3('0x3'));var rp=require(_0x5bf3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bf3('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x5bf3('0x6')]=function(_0x3788d2,_0x26249a){return _0x3788d2[_0x5bf3('0x7')](_0x5bf3('0x8'),attributes,{'tableName':_0x5bf3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee35=['util','../../config/logger','api','moment','rimraf','./intZendeskAccount.attributes','exports','define','int_zendesk_accounts','lodash'];(function(_0x2ecfec,_0x419b9f){var _0x137963=function(_0x478ca5){while(--_0x478ca5){_0x2ecfec['push'](_0x2ecfec['shift']());}};_0x137963(++_0x419b9f);}(_0xee35,0x9f));var _0x5ee3=function(_0x828160,_0x26d5be){_0x828160=_0x828160-0x0;var _0x296b5f=_0xee35[_0x828160];return _0x296b5f;};'use strict';var _=require(_0x5ee3('0x0'));var util=require(_0x5ee3('0x1'));var logger=require(_0x5ee3('0x2'))(_0x5ee3('0x3'));var moment=require(_0x5ee3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5ee3('0x5'));var config=require('../../config/environment');var attributes=require(_0x5ee3('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x5ee3('0x7')]=function(_0x5f4bce,_0x262225){return _0x5f4bce[_0x5ee3('0x8')]('ZendeskAccount',attributes,{'tableName':_0x5ee3('0x9'),'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 7aaa3ce..bd8d1de 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 _0x16e0=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetZendeskAccount','ShowZendeskAccount','find','lodash','util','bluebird','randomstring'];(function(_0x22df3f,_0x6dd9c1){var _0x1ed10f=function(_0xd4b514){while(--_0xd4b514){_0x22df3f['push'](_0x22df3f['shift']());}};_0x1ed10f(++_0x6dd9c1);}(_0x16e0,0x124));var _0x016e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x016e('0x0'));var util=require(_0x016e('0x1'));var moment=require('moment');var BPromise=require(_0x016e('0x2'));var rs=require(_0x016e('0x3'));var fs=require('fs');var Redis=require(_0x016e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x016e('0x5'));var logger=require(_0x016e('0x6'))('rpc');var config=require(_0x016e('0x7'));var jayson=require(_0x016e('0x8'));var client=jayson[_0x016e('0x9')][_0x016e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ae05,_0x25701b,_0x38b5ae){return new BPromise(function(_0x48092c,_0xa8cf14){return client[_0x016e('0xb')](_0x57ae05,_0x38b5ae)[_0x016e('0xc')](function(_0x590603){logger['info'](_0x016e('0xd'),_0x25701b,_0x016e('0xe'));logger[_0x016e('0xf')](_0x016e('0x10'),_0x25701b,_0x016e('0xe'),JSON[_0x016e('0x11')](_0x590603));if(_0x590603[_0x016e('0x12')]){if(_0x590603['error'][_0x016e('0x13')]===0x1f4){logger[_0x016e('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x25701b,_0x590603[_0x016e('0x12')]['message']);return _0xa8cf14(_0x590603['error']['message']);}logger['error'](_0x016e('0xd'),_0x25701b,_0x590603[_0x016e('0x12')]['message']);return _0x48092c(_0x590603[_0x016e('0x12')][_0x016e('0x14')]);}else{logger[_0x016e('0x15')](_0x016e('0xd'),_0x25701b,_0x016e('0xe'));_0x48092c(_0x590603[_0x016e('0x16')][_0x016e('0x14')]);}})[_0x016e('0x17')](function(_0xab9a46){logger[_0x016e('0x12')](_0x016e('0xd'),_0x25701b,_0xab9a46);_0xa8cf14(_0xab9a46);});});}exports['GetZendeskAccount']=function(_0x406d3d){var _0x3108e9=this;return new Promise(function(_0x752c3a,_0x58f9c6){return db[_0x016e('0x18')][_0x016e('0x19')]({'raw':_0x406d3d[_0x016e('0x1a')]?_0x406d3d[_0x016e('0x1a')][_0x016e('0x1b')]===undefined?!![]:![]:!![],'where':_0x406d3d[_0x016e('0x1a')]?_0x406d3d[_0x016e('0x1a')][_0x016e('0x1c')]||null:null,'attributes':_0x406d3d['options']?_0x406d3d[_0x016e('0x1a')][_0x016e('0x1d')]||null:null,'limit':_0x406d3d['options']?_0x406d3d[_0x016e('0x1a')][_0x016e('0x1e')]||null:null,'include':_0x406d3d[_0x016e('0x1a')]?_0x406d3d[_0x016e('0x1a')]['include']?_[_0x016e('0x1f')](_0x406d3d[_0x016e('0x1a')][_0x016e('0x20')],function(_0x405219){return{'model':db[_0x405219[_0x016e('0x21')]],'as':_0x405219['as'],'attributes':_0x405219[_0x016e('0x1d')],'include':_0x405219[_0x016e('0x20')]?_[_0x016e('0x1f')](_0x405219[_0x016e('0x20')],function(_0x35c9a1){return{'model':db[_0x35c9a1[_0x016e('0x21')]],'as':_0x35c9a1['as'],'attributes':_0x35c9a1['attributes'],'include':_0x35c9a1[_0x016e('0x20')]?_[_0x016e('0x1f')](_0x35c9a1['include'],function(_0x4caff1){return{'model':db[_0x4caff1[_0x016e('0x21')]],'as':_0x4caff1['as'],'attributes':_0x4caff1[_0x016e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x016e('0xc')](function(_0x41f8e1){logger['info']('GetZendeskAccount',_0x406d3d);logger[_0x016e('0xf')]('GetZendeskAccount',_0x406d3d,JSON[_0x016e('0x11')](_0x41f8e1));_0x752c3a(_0x41f8e1);})[_0x016e('0x17')](function(_0x33de7c){logger[_0x016e('0x12')](_0x016e('0x22'),_0x33de7c[_0x016e('0x14')],_0x406d3d);_0x58f9c6(_0x3108e9[_0x016e('0x12')](0x1f4,_0x33de7c['message']));});});};exports[_0x016e('0x23')]=function(_0x2d116d){var _0x50150e=this;return new Promise(function(_0x399a4c,_0x303f88){return db['ZendeskAccount'][_0x016e('0x24')]({'raw':_0x2d116d['options']?_0x2d116d[_0x016e('0x1a')][_0x016e('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d116d['options']?_0x2d116d['options'][_0x016e('0x1c')]||null:null,'attributes':_0x2d116d[_0x016e('0x1a')]?_0x2d116d['options'][_0x016e('0x1d')]||null:null,'include':_0x2d116d['options']?_0x2d116d['options'][_0x016e('0x20')]?_['map'](_0x2d116d[_0x016e('0x1a')][_0x016e('0x20')],function(_0x1edebe){return{'model':db[_0x1edebe[_0x016e('0x21')]],'as':_0x1edebe['as'],'attributes':_0x1edebe[_0x016e('0x1d')],'include':_0x1edebe[_0x016e('0x20')]?_['map'](_0x1edebe[_0x016e('0x20')],function(_0x506de2){return{'model':db[_0x506de2[_0x016e('0x21')]],'as':_0x506de2['as'],'attributes':_0x506de2['attributes'],'include':_0x506de2[_0x016e('0x20')]?_['map'](_0x506de2['include'],function(_0x57f0f6){return{'model':db[_0x57f0f6[_0x016e('0x21')]],'as':_0x57f0f6['as'],'attributes':_0x57f0f6[_0x016e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x016e('0xc')](function(_0x145cd6){logger[_0x016e('0x15')](_0x016e('0x23'),_0x2d116d);logger[_0x016e('0xf')](_0x016e('0x23'),_0x2d116d,JSON[_0x016e('0x11')](_0x145cd6));_0x399a4c(_0x145cd6);})[_0x016e('0x17')](function(_0x4bcba8){logger[_0x016e('0x12')](_0x016e('0x23'),_0x4bcba8[_0x016e('0x14')],_0x2d116d);_0x303f88(_0x50150e[_0x016e('0x12')](0x1f4,_0x4bcba8[_0x016e('0x14')]));});});}; \ No newline at end of file +var _0x9583=['debug','catch','ShowZendeskAccount','find','raw','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','ZendeskAccount,\x20%s,\x20%s','message','info','result','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x9583,0xcb));var _0x3958=function(_0x1a9142,_0x5539e6){_0x1a9142=_0x1a9142-0x0;var _0x3f14f6=_0x9583[_0x1a9142];return _0x3f14f6;};'use strict';var _=require(_0x3958('0x0'));var util=require(_0x3958('0x1'));var moment=require(_0x3958('0x2'));var BPromise=require('bluebird');var rs=require(_0x3958('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3958('0x4'))(_0x3958('0x5'));var config=require(_0x3958('0x6'));var jayson=require(_0x3958('0x7'));var client=jayson[_0x3958('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ce826,_0x7e525e,_0x5d1980){return new BPromise(function(_0x1fed59,_0x3f362a){return client[_0x3958('0x9')](_0x1ce826,_0x5d1980)[_0x3958('0xa')](function(_0x40ce3d){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x7e525e,_0x3958('0xb'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x7e525e,_0x3958('0xb'),JSON[_0x3958('0xc')](_0x40ce3d));if(_0x40ce3d[_0x3958('0xd')]){if(_0x40ce3d['error']['code']===0x1f4){logger[_0x3958('0xd')](_0x3958('0xe'),_0x7e525e,_0x40ce3d['error']['message']);return _0x3f362a(_0x40ce3d[_0x3958('0xd')]['message']);}logger[_0x3958('0xd')](_0x3958('0xe'),_0x7e525e,_0x40ce3d['error'][_0x3958('0xf')]);return _0x1fed59(_0x40ce3d[_0x3958('0xd')][_0x3958('0xf')]);}else{logger[_0x3958('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x7e525e,'request\x20sent');_0x1fed59(_0x40ce3d[_0x3958('0x11')][_0x3958('0xf')]);}})['catch'](function(_0x4d9839){logger[_0x3958('0xd')](_0x3958('0xe'),_0x7e525e,_0x4d9839);_0x3f362a(_0x4d9839);});});}exports[_0x3958('0x12')]=function(_0x20a6bc){var _0x50e1bf=this;return new Promise(function(_0x146a70,_0x27b13d){return db[_0x3958('0x13')][_0x3958('0x14')]({'raw':_0x20a6bc['options']?_0x20a6bc['options']['raw']===undefined?!![]:![]:!![],'where':_0x20a6bc[_0x3958('0x15')]?_0x20a6bc[_0x3958('0x15')][_0x3958('0x16')]||null:null,'attributes':_0x20a6bc[_0x3958('0x15')]?_0x20a6bc[_0x3958('0x15')][_0x3958('0x17')]||null:null,'limit':_0x20a6bc[_0x3958('0x15')]?_0x20a6bc[_0x3958('0x15')][_0x3958('0x18')]||null:null,'include':_0x20a6bc[_0x3958('0x15')]?_0x20a6bc[_0x3958('0x15')][_0x3958('0x19')]?_['map'](_0x20a6bc['options'][_0x3958('0x19')],function(_0xb018db){return{'model':db[_0xb018db['model']],'as':_0xb018db['as'],'attributes':_0xb018db[_0x3958('0x17')],'include':_0xb018db[_0x3958('0x19')]?_[_0x3958('0x1a')](_0xb018db[_0x3958('0x19')],function(_0x131b33){return{'model':db[_0x131b33['model']],'as':_0x131b33['as'],'attributes':_0x131b33[_0x3958('0x17')],'include':_0x131b33['include']?_[_0x3958('0x1a')](_0x131b33['include'],function(_0x3c4ce9){return{'model':db[_0x3c4ce9[_0x3958('0x1b')]],'as':_0x3c4ce9['as'],'attributes':_0x3c4ce9[_0x3958('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3958('0xa')](function(_0x4c9db5){logger[_0x3958('0x10')](_0x3958('0x12'),_0x20a6bc);logger[_0x3958('0x1c')]('GetZendeskAccount',_0x20a6bc,JSON[_0x3958('0xc')](_0x4c9db5));_0x146a70(_0x4c9db5);})[_0x3958('0x1d')](function(_0x2e4599){logger[_0x3958('0xd')](_0x3958('0x12'),_0x2e4599[_0x3958('0xf')],_0x20a6bc);_0x27b13d(_0x50e1bf['error'](0x1f4,_0x2e4599[_0x3958('0xf')]));});});};exports[_0x3958('0x1e')]=function(_0x4d459f){var _0x663593=this;return new Promise(function(_0x3e3193,_0x1c2f79){return db[_0x3958('0x13')][_0x3958('0x1f')]({'raw':_0x4d459f['options']?_0x4d459f[_0x3958('0x15')][_0x3958('0x20')]===undefined?!![]:![]:!![],'where':_0x4d459f[_0x3958('0x15')]?_0x4d459f['options']['where']||null:null,'attributes':_0x4d459f['options']?_0x4d459f[_0x3958('0x15')][_0x3958('0x17')]||null:null,'include':_0x4d459f[_0x3958('0x15')]?_0x4d459f['options'][_0x3958('0x19')]?_['map'](_0x4d459f['options'][_0x3958('0x19')],function(_0x5cfd45){return{'model':db[_0x5cfd45[_0x3958('0x1b')]],'as':_0x5cfd45['as'],'attributes':_0x5cfd45['attributes'],'include':_0x5cfd45[_0x3958('0x19')]?_[_0x3958('0x1a')](_0x5cfd45['include'],function(_0x5abfba){return{'model':db[_0x5abfba[_0x3958('0x1b')]],'as':_0x5abfba['as'],'attributes':_0x5abfba[_0x3958('0x17')],'include':_0x5abfba[_0x3958('0x19')]?_[_0x3958('0x1a')](_0x5abfba[_0x3958('0x19')],function(_0x7f5309){return{'model':db[_0x7f5309[_0x3958('0x1b')]],'as':_0x7f5309['as'],'attributes':_0x7f5309[_0x3958('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13e529){logger[_0x3958('0x10')](_0x3958('0x1e'),_0x4d459f);logger['debug'](_0x3958('0x1e'),_0x4d459f,JSON[_0x3958('0xc')](_0x13e529));_0x3e3193(_0x13e529);})[_0x3958('0x1d')](function(_0x4705d3){logger['error'](_0x3958('0x1e'),_0x4705d3[_0x3958('0xf')],_0x4d459f);_0x1c2f79(_0x663593['error'](0x1f4,_0x4705d3[_0x3958('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 3b60b3b..9d84bae 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(_0x45fc8d,_0x53e1f7){var _0x43a493=function(_0xadf408){while(--_0xadf408){_0x45fc8d['push'](_0x45fc8d['shift']());}};_0x43a493(++_0x53e1f7);}(_0x5c00,0x17e));var _0x05c0=function(_0xf3120,_0x80a54c){_0xf3120=_0xf3120-0x0;var _0x5aa549=_0x5c00[_0xf3120];return _0x5aa549;};'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 _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x329b6b,_0x4c27bf){var _0x29702a=function(_0x183db8){while(--_0x183db8){_0x329b6b['push'](_0x329b6b['shift']());}};_0x29702a(++_0x4c27bf);}(_0x087b,0x11a));var _0xb087=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x087b[_0x9fd887];return _0x1a54ab;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 2c132dc..4e9da0f 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 _0x0edf=['sequelize','exports','STRING'];(function(_0x43f27c,_0x672013){var _0x341182=function(_0x30d092){while(--_0x30d092){_0x43f27c['push'](_0x43f27c['shift']());}};_0x341182(++_0x672013);}(_0x0edf,0x123));var _0xf0ed=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x0edf[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require(_0xf0ed('0x0'));module[_0xf0ed('0x1')]={'name':{'type':Sequelize[_0xf0ed('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaaed=['STRING','exports'];(function(_0x2e2632,_0x205b1d){var _0x925786=function(_0x43caff){while(--_0x43caff){_0x2e2632['push'](_0x2e2632['shift']());}};_0x925786(++_0x205b1d);}(_0xaaed,0x11b));var _0xdaae=function(_0x292f8a,_0x6e8591){_0x292f8a=_0x292f8a-0x0;var _0x1f027e=_0xaaed[_0x292f8a];return _0x1f027e;};'use strict';var Sequelize=require('sequelize');module[_0xdaae('0x0')]={'name':{'type':Sequelize[_0xdaae('0x1')]},'description':{'type':Sequelize[_0xdaae('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index b296f52..1020ff5 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 _0xea0d=['model','includeAll','find','create','body','catch','destroy','getFields','findOne','ZendeskField','length','sort','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','Content-Range','reject','save','then','sendStatus','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','options','include','findAll','show','params'];(function(_0x5bb248,_0x69a63a){var _0x568c03=function(_0x19acab){while(--_0x19acab){_0x5bb248['push'](_0x5bb248['shift']());}};_0x568c03(++_0x69a63a);}(_0xea0d,0x1a6));var _0xdea0=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0xea0d[_0x36de10];return _0x58100f;};'use strict';var emlformat=require(_0xdea0('0x0'));var rimraf=require(_0xdea0('0x1'));var zipdir=require(_0xdea0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdea0('0x3'));var moment=require(_0xdea0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdea0('0x5'));var sox=require(_0xdea0('0x6'));var csv=require(_0xdea0('0x7'));var ejs=require(_0xdea0('0x8'));var fs=require('fs');var fs_extra=require(_0xdea0('0x9'));var _=require(_0xdea0('0xa'));var squel=require(_0xdea0('0xb'));var crypto=require(_0xdea0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdea0('0xd'));var toCsv=require(_0xdea0('0x7'));var querystring=require('querystring');var Papa=require(_0xdea0('0xe'));var Redis=require(_0xdea0('0xf'));var authService=require(_0xdea0('0x10'));var qs=require(_0xdea0('0x11'));var as=require(_0xdea0('0x12'));var hardwareService=require(_0xdea0('0x13'));var logger=require(_0xdea0('0x14'))('api');var utils=require(_0xdea0('0x15'));var config=require(_0xdea0('0x16'));var licenseUtil=require(_0xdea0('0x17'));var db=require(_0xdea0('0x18'))['db'];function respondWithStatusCode(_0x55ec7f,_0x11fa36){_0x11fa36=_0x11fa36||0xcc;return function(_0x321244){if(_0x321244){return _0x55ec7f['sendStatus'](_0x11fa36);}return _0x55ec7f[_0xdea0('0x19')](_0x11fa36)['end']();};}function respondWithResult(_0x306bec,_0x29ce5a){_0x29ce5a=_0x29ce5a||0xc8;return function(_0x30c29c){if(_0x30c29c){return _0x306bec[_0xdea0('0x19')](_0x29ce5a)[_0xdea0('0x1a')](_0x30c29c);}};}function respondWithFilteredResult(_0x52d90f,_0x451b09){return function(_0x199bd0){if(_0x199bd0){var _0x3fe779=typeof _0x451b09[_0xdea0('0x1b')]==='undefined'&&typeof _0x451b09[_0xdea0('0x1c')]==='undefined';var _0x3e3c78=_0x199bd0[_0xdea0('0x1d')];var _0x515fc4=_0x3fe779?0x0:_0x451b09['offset'];var _0x269c15=_0x3fe779?_0x199bd0[_0xdea0('0x1d')]:_0x451b09[_0xdea0('0x1b')]+_0x451b09['limit'];var _0x1313b8;if(_0x269c15>=_0x3e3c78){_0x269c15=_0x3e3c78;_0x1313b8=0xc8;}else{_0x1313b8=0xce;}_0x52d90f[_0xdea0('0x19')](_0x1313b8);return _0x52d90f['set'](_0xdea0('0x1e'),_0x515fc4+'-'+_0x269c15+'/'+_0x3e3c78)[_0xdea0('0x1a')](_0x199bd0);}return null;};}function patchUpdates(_0x2e90b5){return function(_0x5c33c2){try{jsonpatch['apply'](_0x5c33c2,_0x2e90b5,!![]);}catch(_0x30995d){return BPromise[_0xdea0('0x1f')](_0x30995d);}return _0x5c33c2[_0xdea0('0x20')]();};}function saveUpdates(_0x41a03d,_0x25a531){return function(_0xa69fd4){if(_0xa69fd4){return _0xa69fd4['update'](_0x41a03d)[_0xdea0('0x21')](function(_0x3f56da){return _0x3f56da;});}return null;};}function removeEntity(_0x47397b,_0x154803){return function(_0x7aa49b){if(_0x7aa49b){return _0x7aa49b['destroy']()['then'](function(){_0x47397b[_0xdea0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43d29c,_0x460c9d){return function(_0x34b5f0){if(!_0x34b5f0){_0x43d29c[_0xdea0('0x22')](0x194);}return _0x34b5f0;};}function handleError(_0x15a829,_0x127d14){_0x127d14=_0x127d14||0x1f4;return function(_0x1b28fd){logger[_0xdea0('0x23')](_0x1b28fd[_0xdea0('0x24')]);if(_0x1b28fd[_0xdea0('0x25')]){delete _0x1b28fd[_0xdea0('0x25')];}_0x15a829[_0xdea0('0x19')](_0x127d14)[_0xdea0('0x26')](_0x1b28fd);};}exports[_0xdea0('0x27')]=function(_0x480078,_0x269962){var _0x31cbd8={},_0x266775={},_0x3538cf={'count':0x0,'rows':[]};var _0x243a26=_[_0xdea0('0x28')](db[_0xdea0('0x29')][_0xdea0('0x2a')],function(_0x4e3be2){return{'name':_0x4e3be2[_0xdea0('0x2b')],'type':_0x4e3be2[_0xdea0('0x2c')][_0xdea0('0x2d')]};});_0x266775['model']=_['map'](_0x243a26,_0xdea0('0x25'));_0x266775['query']=_[_0xdea0('0x2e')](_0x480078[_0xdea0('0x2f')]);_0x266775[_0xdea0('0x30')]=_['intersection'](_0x266775['model'],_0x266775[_0xdea0('0x2f')]);_0x31cbd8[_0xdea0('0x31')]=_[_0xdea0('0x32')](_0x266775['model'],qs[_0xdea0('0x33')](_0x480078[_0xdea0('0x2f')]['fields']));_0x31cbd8[_0xdea0('0x31')]=_0x31cbd8[_0xdea0('0x31')]['length']?_0x31cbd8['attributes']:_0x266775['model'];if(!_0x480078[_0xdea0('0x2f')][_0xdea0('0x34')](_0xdea0('0x35'))){_0x31cbd8['limit']=qs[_0xdea0('0x1c')](_0x480078['query']['limit']);_0x31cbd8[_0xdea0('0x1b')]=qs['offset'](_0x480078[_0xdea0('0x2f')]['offset']);}_0x31cbd8[_0xdea0('0x36')]=qs['sort'](_0x480078[_0xdea0('0x2f')]['sort']);_0x31cbd8['where']=qs['filters'](_[_0xdea0('0x37')](_0x480078[_0xdea0('0x2f')],_0x266775[_0xdea0('0x30')]),_0x243a26);if(_0x480078[_0xdea0('0x2f')][_0xdea0('0x38')]){_0x31cbd8[_0xdea0('0x39')]=_[_0xdea0('0x3a')](_0x31cbd8[_0xdea0('0x39')],{'$or':_[_0xdea0('0x28')](_0x243a26,function(_0x3e59fe){if(_0x3e59fe[_0xdea0('0x2c')]!=='VIRTUAL'){var _0x5c4134={};_0x5c4134[_0x3e59fe['name']]={'$like':'%'+_0x480078[_0xdea0('0x2f')][_0xdea0('0x38')]+'%'};return _0x5c4134;}})});}_0x31cbd8=_[_0xdea0('0x3a')]({},_0x31cbd8,_0x480078[_0xdea0('0x3b')]);var _0x1f20a4={'where':_0x31cbd8[_0xdea0('0x39')]};return db['ZendeskConfiguration']['count'](_0x1f20a4)[_0xdea0('0x21')](function(_0x5b3999){_0x3538cf[_0xdea0('0x1d')]=_0x5b3999;if(_0x480078[_0xdea0('0x2f')]['includeAll']){_0x31cbd8[_0xdea0('0x3c')]=[{'all':!![]}];}return db[_0xdea0('0x29')][_0xdea0('0x3d')](_0x31cbd8);})[_0xdea0('0x21')](function(_0xc27e4){_0x3538cf['rows']=_0xc27e4;return _0x3538cf;})[_0xdea0('0x21')](respondWithFilteredResult(_0x269962,_0x31cbd8))['catch'](handleError(_0x269962,null));};exports[_0xdea0('0x3e')]=function(_0x50d487,_0x24ab42){var _0x11777a={'raw':![],'where':{'id':_0x50d487[_0xdea0('0x3f')]['id']}},_0x4952b0={};_0x4952b0['model']=_[_0xdea0('0x2e')](db[_0xdea0('0x29')]['rawAttributes']);_0x4952b0[_0xdea0('0x2f')]=_[_0xdea0('0x2e')](_0x50d487[_0xdea0('0x2f')]);_0x4952b0[_0xdea0('0x30')]=_[_0xdea0('0x32')](_0x4952b0[_0xdea0('0x40')],_0x4952b0[_0xdea0('0x2f')]);_0x11777a[_0xdea0('0x31')]=_[_0xdea0('0x32')](_0x4952b0['model'],qs[_0xdea0('0x33')](_0x50d487[_0xdea0('0x2f')][_0xdea0('0x33')]));_0x11777a[_0xdea0('0x31')]=_0x11777a[_0xdea0('0x31')]['length']?_0x11777a[_0xdea0('0x31')]:_0x4952b0['model'];if(_0x50d487[_0xdea0('0x2f')][_0xdea0('0x41')]){_0x11777a[_0xdea0('0x3c')]=[{'all':!![]}];}_0x11777a=_['merge']({},_0x11777a,_0x50d487[_0xdea0('0x3b')]);return db['ZendeskConfiguration'][_0xdea0('0x42')](_0x11777a)[_0xdea0('0x21')](handleEntityNotFound(_0x24ab42,null))[_0xdea0('0x21')](respondWithResult(_0x24ab42,null))['catch'](handleError(_0x24ab42,null));};exports[_0xdea0('0x43')]=function(_0x4ee249,_0x97b1b0){return db[_0xdea0('0x29')][_0xdea0('0x43')](_0x4ee249[_0xdea0('0x44')],{})[_0xdea0('0x21')](respondWithResult(_0x97b1b0,0xc9))[_0xdea0('0x45')](handleError(_0x97b1b0,null));};exports['update']=function(_0x1b3ada,_0x5a0e13){if(_0x1b3ada[_0xdea0('0x44')]['id']){delete _0x1b3ada[_0xdea0('0x44')]['id'];}return db['ZendeskConfiguration'][_0xdea0('0x42')]({'where':{'id':_0x1b3ada[_0xdea0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5a0e13,null))[_0xdea0('0x21')](saveUpdates(_0x1b3ada[_0xdea0('0x44')],null))[_0xdea0('0x21')](respondWithResult(_0x5a0e13,null))[_0xdea0('0x45')](handleError(_0x5a0e13,null));};exports[_0xdea0('0x46')]=function(_0x37ca67,_0x333312){return db[_0xdea0('0x29')][_0xdea0('0x42')]({'where':{'id':_0x37ca67['params']['id']}})[_0xdea0('0x21')](handleEntityNotFound(_0x333312,null))['then'](removeEntity(_0x333312,null))['catch'](handleError(_0x333312,null));};exports[_0xdea0('0x47')]=function(_0x4c5ee8,_0x8ce55e,_0xf8e7e4){var _0x285f1f={};var _0x318dab={};var _0x27454f;var _0x3fb263;return db[_0xdea0('0x29')][_0xdea0('0x48')]({'where':{'id':_0x4c5ee8[_0xdea0('0x3f')]['id']}})[_0xdea0('0x21')](handleEntityNotFound(_0x8ce55e,null))[_0xdea0('0x21')](function(_0x3aab21){if(_0x3aab21){_0x27454f=_0x3aab21;_0x318dab[_0xdea0('0x40')]=_[_0xdea0('0x2e')](db[_0xdea0('0x49')][_0xdea0('0x2a')]);_0x318dab[_0xdea0('0x2f')]=_[_0xdea0('0x2e')](_0x4c5ee8[_0xdea0('0x2f')]);_0x318dab[_0xdea0('0x30')]=_[_0xdea0('0x32')](_0x318dab[_0xdea0('0x40')],_0x318dab[_0xdea0('0x2f')]);_0x285f1f['attributes']=_[_0xdea0('0x32')](_0x318dab[_0xdea0('0x40')],qs[_0xdea0('0x33')](_0x4c5ee8[_0xdea0('0x2f')]['fields']));_0x285f1f[_0xdea0('0x31')]=_0x285f1f['attributes'][_0xdea0('0x4a')]?_0x285f1f[_0xdea0('0x31')]:_0x318dab[_0xdea0('0x40')];_0x285f1f[_0xdea0('0x36')]=qs[_0xdea0('0x4b')](_0x4c5ee8[_0xdea0('0x2f')][_0xdea0('0x4b')]);_0x285f1f[_0xdea0('0x39')]=qs[_0xdea0('0x30')](_['pick'](_0x4c5ee8[_0xdea0('0x2f')],_0x318dab['filters']));if(_0x4c5ee8[_0xdea0('0x2f')][_0xdea0('0x38')]){_0x285f1f[_0xdea0('0x39')]=_['merge'](_0x285f1f[_0xdea0('0x39')],{'$or':_[_0xdea0('0x28')](_0x285f1f['attributes'],function(_0x42559a){var _0x2331f4={};_0x2331f4[_0x42559a]={'$like':'%'+_0x4c5ee8[_0xdea0('0x2f')][_0xdea0('0x38')]+'%'};return _0x2331f4;})});}_0x285f1f=_[_0xdea0('0x3a')]({},_0x285f1f,_0x4c5ee8['options']);return _0x27454f[_0xdea0('0x47')](_0x285f1f);}})[_0xdea0('0x21')](function(_0x2e0c76){if(_0x2e0c76){_0x3fb263=_0x2e0c76[_0xdea0('0x4a')];if(!_0x4c5ee8[_0xdea0('0x2f')][_0xdea0('0x34')](_0xdea0('0x35'))){_0x285f1f[_0xdea0('0x1c')]=qs[_0xdea0('0x1c')](_0x4c5ee8[_0xdea0('0x2f')][_0xdea0('0x1c')]);_0x285f1f[_0xdea0('0x1b')]=qs[_0xdea0('0x1b')](_0x4c5ee8['query'][_0xdea0('0x1b')]);}return _0x27454f[_0xdea0('0x47')](_0x285f1f);}})[_0xdea0('0x21')](function(_0x3d5fcb){if(_0x3d5fcb){return _0x3d5fcb?{'count':_0x3fb263,'rows':_0x3d5fcb}:null;}})['then'](respondWithResult(_0x8ce55e,null))[_0xdea0('0x45')](handleError(_0x8ce55e,null));};exports['getSubjects']=function(_0x30639d,_0x498d78,_0x5eaf65){var _0x44c421={};var _0x1b058a={};var _0x3a449b;var _0x15d8c1;return db['ZendeskConfiguration'][_0xdea0('0x48')]({'where':{'id':_0x30639d[_0xdea0('0x3f')]['id']}})[_0xdea0('0x21')](handleEntityNotFound(_0x498d78,null))[_0xdea0('0x21')](function(_0xcc59d6){if(_0xcc59d6){_0x3a449b=_0xcc59d6;_0x1b058a[_0xdea0('0x40')]=_[_0xdea0('0x2e')](db[_0xdea0('0x49')][_0xdea0('0x2a')]);_0x1b058a['query']=_[_0xdea0('0x2e')](_0x30639d[_0xdea0('0x2f')]);_0x1b058a[_0xdea0('0x30')]=_[_0xdea0('0x32')](_0x1b058a[_0xdea0('0x40')],_0x1b058a[_0xdea0('0x2f')]);_0x44c421[_0xdea0('0x31')]=_['intersection'](_0x1b058a['model'],qs[_0xdea0('0x33')](_0x30639d[_0xdea0('0x2f')][_0xdea0('0x33')]));_0x44c421['attributes']=_0x44c421[_0xdea0('0x31')]['length']?_0x44c421['attributes']:_0x1b058a['model'];_0x44c421[_0xdea0('0x36')]=qs[_0xdea0('0x4b')](_0x30639d['query'][_0xdea0('0x4b')]);_0x44c421[_0xdea0('0x39')]=qs['filters'](_['pick'](_0x30639d[_0xdea0('0x2f')],_0x1b058a[_0xdea0('0x30')]));if(_0x30639d[_0xdea0('0x2f')][_0xdea0('0x38')]){_0x44c421['where']=_[_0xdea0('0x3a')](_0x44c421[_0xdea0('0x39')],{'$or':_[_0xdea0('0x28')](_0x44c421['attributes'],function(_0x5694a4){var _0x11973d={};_0x11973d[_0x5694a4]={'$like':'%'+_0x30639d[_0xdea0('0x2f')][_0xdea0('0x38')]+'%'};return _0x11973d;})});}_0x44c421=_[_0xdea0('0x3a')]({},_0x44c421,_0x30639d[_0xdea0('0x3b')]);return _0x3a449b['getSubjects'](_0x44c421);}})[_0xdea0('0x21')](function(_0x545896){if(_0x545896){_0x15d8c1=_0x545896[_0xdea0('0x4a')];if(!_0x30639d[_0xdea0('0x2f')][_0xdea0('0x34')](_0xdea0('0x35'))){_0x44c421['limit']=qs[_0xdea0('0x1c')](_0x30639d[_0xdea0('0x2f')][_0xdea0('0x1c')]);_0x44c421[_0xdea0('0x1b')]=qs[_0xdea0('0x1b')](_0x30639d['query'][_0xdea0('0x1b')]);}return _0x3a449b[_0xdea0('0x4c')](_0x44c421);}})[_0xdea0('0x21')](function(_0x16e60b){if(_0x16e60b){return _0x16e60b?{'count':_0x15d8c1,'rows':_0x16e60b}:null;}})['then'](respondWithResult(_0x498d78,null))[_0xdea0('0x45')](handleError(_0x498d78,null));};exports[_0xdea0('0x4d')]=function(_0x2fda49,_0xa30f30,_0x390390){var _0x139b83={};var _0x56fe59={};var _0x55731f;var _0x496c39;return db[_0xdea0('0x29')]['findOne']({'where':{'id':_0x2fda49[_0xdea0('0x3f')]['id']}})[_0xdea0('0x21')](handleEntityNotFound(_0xa30f30,null))[_0xdea0('0x21')](function(_0x34215b){if(_0x34215b){_0x55731f=_0x34215b;_0x56fe59[_0xdea0('0x40')]=_[_0xdea0('0x2e')](db[_0xdea0('0x49')][_0xdea0('0x2a')]);_0x56fe59[_0xdea0('0x2f')]=_['keys'](_0x2fda49[_0xdea0('0x2f')]);_0x56fe59[_0xdea0('0x30')]=_[_0xdea0('0x32')](_0x56fe59['model'],_0x56fe59[_0xdea0('0x2f')]);_0x139b83[_0xdea0('0x31')]=_['intersection'](_0x56fe59['model'],qs[_0xdea0('0x33')](_0x2fda49[_0xdea0('0x2f')][_0xdea0('0x33')]));_0x139b83[_0xdea0('0x31')]=_0x139b83[_0xdea0('0x31')][_0xdea0('0x4a')]?_0x139b83[_0xdea0('0x31')]:_0x56fe59[_0xdea0('0x40')];_0x139b83[_0xdea0('0x36')]=qs[_0xdea0('0x4b')](_0x2fda49[_0xdea0('0x2f')][_0xdea0('0x4b')]);_0x139b83[_0xdea0('0x39')]=qs[_0xdea0('0x30')](_[_0xdea0('0x37')](_0x2fda49[_0xdea0('0x2f')],_0x56fe59[_0xdea0('0x30')]));if(_0x2fda49[_0xdea0('0x2f')]['filter']){_0x139b83[_0xdea0('0x39')]=_[_0xdea0('0x3a')](_0x139b83['where'],{'$or':_[_0xdea0('0x28')](_0x139b83[_0xdea0('0x31')],function(_0x20a2b6){var _0x635b77={};_0x635b77[_0x20a2b6]={'$like':'%'+_0x2fda49['query'][_0xdea0('0x38')]+'%'};return _0x635b77;})});}_0x139b83=_[_0xdea0('0x3a')]({},_0x139b83,_0x2fda49[_0xdea0('0x3b')]);return _0x55731f['getDescriptions'](_0x139b83);}})[_0xdea0('0x21')](function(_0x4d3c80){if(_0x4d3c80){_0x496c39=_0x4d3c80[_0xdea0('0x4a')];if(!_0x2fda49[_0xdea0('0x2f')][_0xdea0('0x34')](_0xdea0('0x35'))){_0x139b83[_0xdea0('0x1c')]=qs[_0xdea0('0x1c')](_0x2fda49[_0xdea0('0x2f')][_0xdea0('0x1c')]);_0x139b83[_0xdea0('0x1b')]=qs['offset'](_0x2fda49['query'][_0xdea0('0x1b')]);}return _0x55731f[_0xdea0('0x4d')](_0x139b83);}})[_0xdea0('0x21')](function(_0x202bdc){if(_0x202bdc){return _0x202bdc?{'count':_0x496c39,'rows':_0x202bdc}:null;}})[_0xdea0('0x21')](respondWithResult(_0xa30f30,null))['catch'](handleError(_0xa30f30,null));};exports[_0xdea0('0x4e')]=function(_0x4e22e0,_0x4c96f5,_0x20a587){var _0x64e0a8={};var _0x105d65={};var _0xdd8db9;var _0x493fd3;return db[_0xdea0('0x29')][_0xdea0('0x48')]({'where':{'id':_0x4e22e0[_0xdea0('0x3f')]['id']}})[_0xdea0('0x21')](handleEntityNotFound(_0x4c96f5,null))[_0xdea0('0x21')](function(_0x2c80c6){if(_0x2c80c6){_0xdd8db9=_0x2c80c6;_0x105d65['model']=_[_0xdea0('0x2e')](db[_0xdea0('0x4f')][_0xdea0('0x2a')]);_0x105d65[_0xdea0('0x2f')]=_[_0xdea0('0x2e')](_0x4e22e0[_0xdea0('0x2f')]);_0x105d65['filters']=_[_0xdea0('0x32')](_0x105d65[_0xdea0('0x40')],_0x105d65[_0xdea0('0x2f')]);_0x64e0a8['attributes']=_[_0xdea0('0x32')](_0x105d65['model'],qs['fields'](_0x4e22e0[_0xdea0('0x2f')][_0xdea0('0x33')]));_0x64e0a8[_0xdea0('0x31')]=_0x64e0a8[_0xdea0('0x31')][_0xdea0('0x4a')]?_0x64e0a8['attributes']:_0x105d65['model'];_0x64e0a8['order']=qs[_0xdea0('0x4b')](_0x4e22e0['query']['sort']);_0x64e0a8[_0xdea0('0x39')]=qs[_0xdea0('0x30')](_[_0xdea0('0x37')](_0x4e22e0[_0xdea0('0x2f')],_0x105d65[_0xdea0('0x30')]));if(_0x4e22e0[_0xdea0('0x2f')][_0xdea0('0x38')]){_0x64e0a8[_0xdea0('0x39')]=_[_0xdea0('0x3a')](_0x64e0a8['where'],{'$or':_[_0xdea0('0x28')](_0x64e0a8[_0xdea0('0x31')],function(_0x594a48){var _0x52210d={};_0x52210d[_0x594a48]={'$like':'%'+_0x4e22e0['query'][_0xdea0('0x38')]+'%'};return _0x52210d;})});}_0x64e0a8=_[_0xdea0('0x3a')]({},_0x64e0a8,_0x4e22e0[_0xdea0('0x3b')]);return _0xdd8db9[_0xdea0('0x4e')](_0x64e0a8);}})[_0xdea0('0x21')](function(_0x488692){if(_0x488692){_0x493fd3=_0x488692['length'];if(!_0x4e22e0[_0xdea0('0x2f')][_0xdea0('0x34')](_0xdea0('0x35'))){_0x64e0a8[_0xdea0('0x1c')]=qs[_0xdea0('0x1c')](_0x4e22e0[_0xdea0('0x2f')][_0xdea0('0x1c')]);_0x64e0a8[_0xdea0('0x1b')]=qs[_0xdea0('0x1b')](_0x4e22e0['query'][_0xdea0('0x1b')]);}return _0xdd8db9['getTags'](_0x64e0a8);}})[_0xdea0('0x21')](function(_0x29cec6){if(_0x29cec6){return _0x29cec6?{'count':_0x493fd3,'rows':_0x29cec6}:null;}})['then'](respondWithResult(_0x4c96f5,null))[_0xdea0('0x45')](handleError(_0x4c96f5,null));};exports[_0xdea0('0x50')]=function(_0x3fb9ac,_0x5142da,_0x330b8f){if(_0x3fb9ac['body']['id']){delete _0x3fb9ac[_0xdea0('0x44')]['id'];}return db[_0xdea0('0x29')][_0xdea0('0x48')]({'where':{'id':_0x3fb9ac[_0xdea0('0x3f')]['id']}})[_0xdea0('0x21')](handleEntityNotFound(_0x5142da,null))['then'](function(_0x47bb04){if(_0x47bb04){return _0x47bb04['setTags'](_0x3fb9ac['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x5142da,null))[_0xdea0('0x45')](handleError(_0x5142da,null));}; \ No newline at end of file +var _0x3170=['Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','stack','name','send','index','ZendeskConfiguration','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','catch','rawAttributes','find','create','body','params','getFields','findOne','hasOwnProperty','getSubjects','pick','getDescriptions','ZendeskField','getTags'];(function(_0x581ff8,_0x1f7b92){var _0x4e30b7=function(_0x29ba21){while(--_0x29ba21){_0x581ff8['push'](_0x581ff8['shift']());}};_0x4e30b7(++_0x1f7b92);}(_0x3170,0x1e3));var _0x0317=function(_0x47ea94,_0x5bcd10){_0x47ea94=_0x47ea94-0x0;var _0x266e19=_0x3170[_0x47ea94];return _0x266e19;};'use strict';var emlformat=require(_0x0317('0x0'));var rimraf=require(_0x0317('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0317('0x2'));var rp=require(_0x0317('0x3'));var moment=require(_0x0317('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0317('0x5'));var util=require(_0x0317('0x6'));var path=require('path');var sox=require(_0x0317('0x7'));var csv=require(_0x0317('0x8'));var ejs=require(_0x0317('0x9'));var fs=require('fs');var fs_extra=require(_0x0317('0xa'));var _=require(_0x0317('0xb'));var squel=require(_0x0317('0xc'));var crypto=require(_0x0317('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0317('0xe'));var toCsv=require(_0x0317('0x8'));var querystring=require(_0x0317('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0317('0x10'));var qs=require(_0x0317('0x11'));var as=require(_0x0317('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0317('0x13'))(_0x0317('0x14'));var utils=require('../../config/utils');var config=require(_0x0317('0x15'));var licenseUtil=require(_0x0317('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47cacb,_0x4a9213){_0x4a9213=_0x4a9213||0xcc;return function(_0x1b694c){if(_0x1b694c){return _0x47cacb[_0x0317('0x17')](_0x4a9213);}return _0x47cacb[_0x0317('0x18')](_0x4a9213)[_0x0317('0x19')]();};}function respondWithResult(_0x1e9f10,_0x481e3d){_0x481e3d=_0x481e3d||0xc8;return function(_0x12e17f){if(_0x12e17f){return _0x1e9f10[_0x0317('0x18')](_0x481e3d)[_0x0317('0x1a')](_0x12e17f);}};}function respondWithFilteredResult(_0x9e503,_0x3a3f6e){return function(_0x570937){if(_0x570937){var _0x16712e=typeof _0x3a3f6e[_0x0317('0x1b')]===_0x0317('0x1c')&&typeof _0x3a3f6e[_0x0317('0x1d')]===_0x0317('0x1c');var _0xa6b05e=_0x570937[_0x0317('0x1e')];var _0x413d52=_0x16712e?0x0:_0x3a3f6e[_0x0317('0x1b')];var _0xe8db9d=_0x16712e?_0x570937['count']:_0x3a3f6e[_0x0317('0x1b')]+_0x3a3f6e[_0x0317('0x1d')];var _0x53c8ff;if(_0xe8db9d>=_0xa6b05e){_0xe8db9d=_0xa6b05e;_0x53c8ff=0xc8;}else{_0x53c8ff=0xce;}_0x9e503[_0x0317('0x18')](_0x53c8ff);return _0x9e503['set'](_0x0317('0x1f'),_0x413d52+'-'+_0xe8db9d+'/'+_0xa6b05e)[_0x0317('0x1a')](_0x570937);}return null;};}function patchUpdates(_0xd26d7a){return function(_0x2b3222){try{jsonpatch['apply'](_0x2b3222,_0xd26d7a,!![]);}catch(_0x95e0f0){return BPromise[_0x0317('0x20')](_0x95e0f0);}return _0x2b3222['save']();};}function saveUpdates(_0x13d056,_0xa04d3a){return function(_0x29de30){if(_0x29de30){return _0x29de30[_0x0317('0x21')](_0x13d056)['then'](function(_0x11cd5d){return _0x11cd5d;});}return null;};}function removeEntity(_0x237581,_0x21e8ac){return function(_0x500893){if(_0x500893){return _0x500893[_0x0317('0x22')]()['then'](function(){_0x237581[_0x0317('0x18')](0xcc)[_0x0317('0x19')]();});}};}function handleEntityNotFound(_0x6ba0e,_0x4b2c55){return function(_0x4dd08f){if(!_0x4dd08f){_0x6ba0e['sendStatus'](0x194);}return _0x4dd08f;};}function handleError(_0x455d7f,_0x343c6b){_0x343c6b=_0x343c6b||0x1f4;return function(_0x379e52){logger['error'](_0x379e52[_0x0317('0x23')]);if(_0x379e52[_0x0317('0x24')]){delete _0x379e52[_0x0317('0x24')];}_0x455d7f[_0x0317('0x18')](_0x343c6b)[_0x0317('0x25')](_0x379e52);};}exports[_0x0317('0x26')]=function(_0x27fece,_0x212fd5){var _0x3015d2={},_0x51dce4={},_0x349119={'count':0x0,'rows':[]};var _0xc3acca=_['map'](db[_0x0317('0x27')]['rawAttributes'],function(_0x1fc6dc){return{'name':_0x1fc6dc[_0x0317('0x28')],'type':_0x1fc6dc[_0x0317('0x29')]['key']};});_0x51dce4[_0x0317('0x2a')]=_[_0x0317('0x2b')](_0xc3acca,_0x0317('0x24'));_0x51dce4[_0x0317('0x2c')]=_[_0x0317('0x2d')](_0x27fece[_0x0317('0x2c')]);_0x51dce4['filters']=_[_0x0317('0x2e')](_0x51dce4[_0x0317('0x2a')],_0x51dce4[_0x0317('0x2c')]);_0x3015d2['attributes']=_[_0x0317('0x2e')](_0x51dce4['model'],qs[_0x0317('0x2f')](_0x27fece[_0x0317('0x2c')]['fields']));_0x3015d2[_0x0317('0x30')]=_0x3015d2[_0x0317('0x30')][_0x0317('0x31')]?_0x3015d2[_0x0317('0x30')]:_0x51dce4[_0x0317('0x2a')];if(!_0x27fece[_0x0317('0x2c')]['hasOwnProperty'](_0x0317('0x32'))){_0x3015d2['limit']=qs['limit'](_0x27fece[_0x0317('0x2c')][_0x0317('0x1d')]);_0x3015d2['offset']=qs[_0x0317('0x1b')](_0x27fece[_0x0317('0x2c')][_0x0317('0x1b')]);}_0x3015d2[_0x0317('0x33')]=qs['sort'](_0x27fece[_0x0317('0x2c')][_0x0317('0x34')]);_0x3015d2[_0x0317('0x35')]=qs[_0x0317('0x36')](_['pick'](_0x27fece['query'],_0x51dce4['filters']),_0xc3acca);if(_0x27fece[_0x0317('0x2c')]['filter']){_0x3015d2[_0x0317('0x35')]=_[_0x0317('0x37')](_0x3015d2[_0x0317('0x35')],{'$or':_[_0x0317('0x2b')](_0xc3acca,function(_0x57a435){if(_0x57a435[_0x0317('0x29')]!==_0x0317('0x38')){var _0x53b6c3={};_0x53b6c3[_0x57a435[_0x0317('0x24')]]={'$like':'%'+_0x27fece[_0x0317('0x2c')][_0x0317('0x39')]+'%'};return _0x53b6c3;}})});}_0x3015d2=_[_0x0317('0x37')]({},_0x3015d2,_0x27fece[_0x0317('0x3a')]);var _0x7a7818={'where':_0x3015d2[_0x0317('0x35')]};return db['ZendeskConfiguration'][_0x0317('0x1e')](_0x7a7818)[_0x0317('0x3b')](function(_0x42803c){_0x349119['count']=_0x42803c;if(_0x27fece[_0x0317('0x2c')][_0x0317('0x3c')]){_0x3015d2[_0x0317('0x3d')]=[{'all':!![]}];}return db[_0x0317('0x27')][_0x0317('0x3e')](_0x3015d2);})['then'](function(_0x28ef74){_0x349119['rows']=_0x28ef74;return _0x349119;})[_0x0317('0x3b')](respondWithFilteredResult(_0x212fd5,_0x3015d2))[_0x0317('0x3f')](handleError(_0x212fd5,null));};exports['show']=function(_0xe88acc,_0xdea18a){var _0x662a37={'raw':![],'where':{'id':_0xe88acc['params']['id']}},_0x761e07={};_0x761e07['model']=_[_0x0317('0x2d')](db[_0x0317('0x27')][_0x0317('0x40')]);_0x761e07[_0x0317('0x2c')]=_['keys'](_0xe88acc[_0x0317('0x2c')]);_0x761e07[_0x0317('0x36')]=_['intersection'](_0x761e07[_0x0317('0x2a')],_0x761e07[_0x0317('0x2c')]);_0x662a37[_0x0317('0x30')]=_[_0x0317('0x2e')](_0x761e07[_0x0317('0x2a')],qs[_0x0317('0x2f')](_0xe88acc[_0x0317('0x2c')][_0x0317('0x2f')]));_0x662a37[_0x0317('0x30')]=_0x662a37[_0x0317('0x30')][_0x0317('0x31')]?_0x662a37['attributes']:_0x761e07[_0x0317('0x2a')];if(_0xe88acc[_0x0317('0x2c')][_0x0317('0x3c')]){_0x662a37[_0x0317('0x3d')]=[{'all':!![]}];}_0x662a37=_[_0x0317('0x37')]({},_0x662a37,_0xe88acc[_0x0317('0x3a')]);return db['ZendeskConfiguration'][_0x0317('0x41')](_0x662a37)['then'](handleEntityNotFound(_0xdea18a,null))[_0x0317('0x3b')](respondWithResult(_0xdea18a,null))['catch'](handleError(_0xdea18a,null));};exports['create']=function(_0xa004ac,_0x55f974){return db[_0x0317('0x27')][_0x0317('0x42')](_0xa004ac[_0x0317('0x43')],{})[_0x0317('0x3b')](respondWithResult(_0x55f974,0xc9))[_0x0317('0x3f')](handleError(_0x55f974,null));};exports[_0x0317('0x21')]=function(_0x95aa8a,_0x3291fc){if(_0x95aa8a['body']['id']){delete _0x95aa8a[_0x0317('0x43')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x95aa8a[_0x0317('0x44')]['id']}})[_0x0317('0x3b')](handleEntityNotFound(_0x3291fc,null))[_0x0317('0x3b')](saveUpdates(_0x95aa8a['body'],null))[_0x0317('0x3b')](respondWithResult(_0x3291fc,null))[_0x0317('0x3f')](handleError(_0x3291fc,null));};exports[_0x0317('0x22')]=function(_0x542732,_0x527125){return db[_0x0317('0x27')][_0x0317('0x41')]({'where':{'id':_0x542732[_0x0317('0x44')]['id']}})['then'](handleEntityNotFound(_0x527125,null))[_0x0317('0x3b')](removeEntity(_0x527125,null))['catch'](handleError(_0x527125,null));};exports[_0x0317('0x45')]=function(_0xca1c54,_0x5392a2,_0x1cb46c){var _0x30fae0={};var _0x2e4772={};var _0x256a8;var _0x1b63db;return db['ZendeskConfiguration'][_0x0317('0x46')]({'where':{'id':_0xca1c54[_0x0317('0x44')]['id']}})[_0x0317('0x3b')](handleEntityNotFound(_0x5392a2,null))[_0x0317('0x3b')](function(_0x2ad6da){if(_0x2ad6da){_0x256a8=_0x2ad6da;_0x2e4772[_0x0317('0x2a')]=_['keys'](db['ZendeskField'][_0x0317('0x40')]);_0x2e4772[_0x0317('0x2c')]=_['keys'](_0xca1c54['query']);_0x2e4772[_0x0317('0x36')]=_[_0x0317('0x2e')](_0x2e4772[_0x0317('0x2a')],_0x2e4772['query']);_0x30fae0[_0x0317('0x30')]=_[_0x0317('0x2e')](_0x2e4772[_0x0317('0x2a')],qs[_0x0317('0x2f')](_0xca1c54[_0x0317('0x2c')]['fields']));_0x30fae0[_0x0317('0x30')]=_0x30fae0[_0x0317('0x30')][_0x0317('0x31')]?_0x30fae0['attributes']:_0x2e4772[_0x0317('0x2a')];_0x30fae0['order']=qs[_0x0317('0x34')](_0xca1c54[_0x0317('0x2c')][_0x0317('0x34')]);_0x30fae0['where']=qs[_0x0317('0x36')](_['pick'](_0xca1c54[_0x0317('0x2c')],_0x2e4772['filters']));if(_0xca1c54[_0x0317('0x2c')]['filter']){_0x30fae0[_0x0317('0x35')]=_[_0x0317('0x37')](_0x30fae0[_0x0317('0x35')],{'$or':_[_0x0317('0x2b')](_0x30fae0[_0x0317('0x30')],function(_0xfc991b){var _0x50ac07={};_0x50ac07[_0xfc991b]={'$like':'%'+_0xca1c54['query']['filter']+'%'};return _0x50ac07;})});}_0x30fae0=_[_0x0317('0x37')]({},_0x30fae0,_0xca1c54[_0x0317('0x3a')]);return _0x256a8[_0x0317('0x45')](_0x30fae0);}})[_0x0317('0x3b')](function(_0x2f5ae2){if(_0x2f5ae2){_0x1b63db=_0x2f5ae2['length'];if(!_0xca1c54['query'][_0x0317('0x47')](_0x0317('0x32'))){_0x30fae0[_0x0317('0x1d')]=qs[_0x0317('0x1d')](_0xca1c54[_0x0317('0x2c')][_0x0317('0x1d')]);_0x30fae0[_0x0317('0x1b')]=qs[_0x0317('0x1b')](_0xca1c54['query'][_0x0317('0x1b')]);}return _0x256a8[_0x0317('0x45')](_0x30fae0);}})[_0x0317('0x3b')](function(_0x4c7564){if(_0x4c7564){return _0x4c7564?{'count':_0x1b63db,'rows':_0x4c7564}:null;}})[_0x0317('0x3b')](respondWithResult(_0x5392a2,null))['catch'](handleError(_0x5392a2,null));};exports[_0x0317('0x48')]=function(_0x23ad42,_0xc50109,_0x4a8dd8){var _0x57cee3={};var _0x1fa845={};var _0x12835c;var _0x2bf48f;return db[_0x0317('0x27')]['findOne']({'where':{'id':_0x23ad42[_0x0317('0x44')]['id']}})[_0x0317('0x3b')](handleEntityNotFound(_0xc50109,null))[_0x0317('0x3b')](function(_0x5a948d){if(_0x5a948d){_0x12835c=_0x5a948d;_0x1fa845[_0x0317('0x2a')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x1fa845[_0x0317('0x2c')]=_[_0x0317('0x2d')](_0x23ad42[_0x0317('0x2c')]);_0x1fa845['filters']=_[_0x0317('0x2e')](_0x1fa845[_0x0317('0x2a')],_0x1fa845['query']);_0x57cee3[_0x0317('0x30')]=_[_0x0317('0x2e')](_0x1fa845[_0x0317('0x2a')],qs[_0x0317('0x2f')](_0x23ad42[_0x0317('0x2c')][_0x0317('0x2f')]));_0x57cee3[_0x0317('0x30')]=_0x57cee3[_0x0317('0x30')][_0x0317('0x31')]?_0x57cee3[_0x0317('0x30')]:_0x1fa845['model'];_0x57cee3['order']=qs['sort'](_0x23ad42[_0x0317('0x2c')]['sort']);_0x57cee3[_0x0317('0x35')]=qs[_0x0317('0x36')](_[_0x0317('0x49')](_0x23ad42['query'],_0x1fa845['filters']));if(_0x23ad42[_0x0317('0x2c')][_0x0317('0x39')]){_0x57cee3['where']=_[_0x0317('0x37')](_0x57cee3[_0x0317('0x35')],{'$or':_[_0x0317('0x2b')](_0x57cee3[_0x0317('0x30')],function(_0xff4e60){var _0x4627bd={};_0x4627bd[_0xff4e60]={'$like':'%'+_0x23ad42[_0x0317('0x2c')][_0x0317('0x39')]+'%'};return _0x4627bd;})});}_0x57cee3=_['merge']({},_0x57cee3,_0x23ad42[_0x0317('0x3a')]);return _0x12835c[_0x0317('0x48')](_0x57cee3);}})[_0x0317('0x3b')](function(_0x2a5391){if(_0x2a5391){_0x2bf48f=_0x2a5391[_0x0317('0x31')];if(!_0x23ad42[_0x0317('0x2c')][_0x0317('0x47')](_0x0317('0x32'))){_0x57cee3[_0x0317('0x1d')]=qs[_0x0317('0x1d')](_0x23ad42[_0x0317('0x2c')][_0x0317('0x1d')]);_0x57cee3[_0x0317('0x1b')]=qs['offset'](_0x23ad42[_0x0317('0x2c')]['offset']);}return _0x12835c[_0x0317('0x48')](_0x57cee3);}})['then'](function(_0x20efc4){if(_0x20efc4){return _0x20efc4?{'count':_0x2bf48f,'rows':_0x20efc4}:null;}})[_0x0317('0x3b')](respondWithResult(_0xc50109,null))[_0x0317('0x3f')](handleError(_0xc50109,null));};exports[_0x0317('0x4a')]=function(_0x268643,_0x49cf46,_0x48de78){var _0x37a6b8={};var _0x41fb9a={};var _0x225d79;var _0x504982;return db['ZendeskConfiguration'][_0x0317('0x46')]({'where':{'id':_0x268643[_0x0317('0x44')]['id']}})['then'](handleEntityNotFound(_0x49cf46,null))['then'](function(_0x398f79){if(_0x398f79){_0x225d79=_0x398f79;_0x41fb9a[_0x0317('0x2a')]=_[_0x0317('0x2d')](db[_0x0317('0x4b')][_0x0317('0x40')]);_0x41fb9a[_0x0317('0x2c')]=_[_0x0317('0x2d')](_0x268643[_0x0317('0x2c')]);_0x41fb9a[_0x0317('0x36')]=_[_0x0317('0x2e')](_0x41fb9a[_0x0317('0x2a')],_0x41fb9a[_0x0317('0x2c')]);_0x37a6b8['attributes']=_[_0x0317('0x2e')](_0x41fb9a[_0x0317('0x2a')],qs['fields'](_0x268643['query'][_0x0317('0x2f')]));_0x37a6b8[_0x0317('0x30')]=_0x37a6b8[_0x0317('0x30')][_0x0317('0x31')]?_0x37a6b8[_0x0317('0x30')]:_0x41fb9a[_0x0317('0x2a')];_0x37a6b8[_0x0317('0x33')]=qs['sort'](_0x268643[_0x0317('0x2c')][_0x0317('0x34')]);_0x37a6b8['where']=qs['filters'](_[_0x0317('0x49')](_0x268643[_0x0317('0x2c')],_0x41fb9a['filters']));if(_0x268643[_0x0317('0x2c')][_0x0317('0x39')]){_0x37a6b8[_0x0317('0x35')]=_[_0x0317('0x37')](_0x37a6b8[_0x0317('0x35')],{'$or':_[_0x0317('0x2b')](_0x37a6b8[_0x0317('0x30')],function(_0x5e74d9){var _0x1711e3={};_0x1711e3[_0x5e74d9]={'$like':'%'+_0x268643[_0x0317('0x2c')][_0x0317('0x39')]+'%'};return _0x1711e3;})});}_0x37a6b8=_[_0x0317('0x37')]({},_0x37a6b8,_0x268643[_0x0317('0x3a')]);return _0x225d79['getDescriptions'](_0x37a6b8);}})[_0x0317('0x3b')](function(_0x56dc00){if(_0x56dc00){_0x504982=_0x56dc00['length'];if(!_0x268643[_0x0317('0x2c')][_0x0317('0x47')](_0x0317('0x32'))){_0x37a6b8[_0x0317('0x1d')]=qs[_0x0317('0x1d')](_0x268643['query'][_0x0317('0x1d')]);_0x37a6b8[_0x0317('0x1b')]=qs['offset'](_0x268643[_0x0317('0x2c')]['offset']);}return _0x225d79[_0x0317('0x4a')](_0x37a6b8);}})['then'](function(_0x39033f){if(_0x39033f){return _0x39033f?{'count':_0x504982,'rows':_0x39033f}:null;}})[_0x0317('0x3b')](respondWithResult(_0x49cf46,null))[_0x0317('0x3f')](handleError(_0x49cf46,null));};exports[_0x0317('0x4c')]=function(_0x15443b,_0x2b6841,_0x5685cb){var _0x2f541b={};var _0x13aecc={};var _0x3e0706;var _0x598545;return db[_0x0317('0x27')]['findOne']({'where':{'id':_0x15443b[_0x0317('0x44')]['id']}})[_0x0317('0x3b')](handleEntityNotFound(_0x2b6841,null))['then'](function(_0x4f20e4){if(_0x4f20e4){_0x3e0706=_0x4f20e4;_0x13aecc['model']=_['keys'](db[_0x0317('0x4d')][_0x0317('0x40')]);_0x13aecc['query']=_[_0x0317('0x2d')](_0x15443b[_0x0317('0x2c')]);_0x13aecc['filters']=_[_0x0317('0x2e')](_0x13aecc[_0x0317('0x2a')],_0x13aecc[_0x0317('0x2c')]);_0x2f541b[_0x0317('0x30')]=_['intersection'](_0x13aecc[_0x0317('0x2a')],qs['fields'](_0x15443b['query'][_0x0317('0x2f')]));_0x2f541b[_0x0317('0x30')]=_0x2f541b[_0x0317('0x30')][_0x0317('0x31')]?_0x2f541b[_0x0317('0x30')]:_0x13aecc[_0x0317('0x2a')];_0x2f541b['order']=qs[_0x0317('0x34')](_0x15443b['query'][_0x0317('0x34')]);_0x2f541b[_0x0317('0x35')]=qs[_0x0317('0x36')](_[_0x0317('0x49')](_0x15443b[_0x0317('0x2c')],_0x13aecc[_0x0317('0x36')]));if(_0x15443b[_0x0317('0x2c')][_0x0317('0x39')]){_0x2f541b[_0x0317('0x35')]=_[_0x0317('0x37')](_0x2f541b[_0x0317('0x35')],{'$or':_['map'](_0x2f541b[_0x0317('0x30')],function(_0x3fc4b6){var _0x39979a={};_0x39979a[_0x3fc4b6]={'$like':'%'+_0x15443b[_0x0317('0x2c')][_0x0317('0x39')]+'%'};return _0x39979a;})});}_0x2f541b=_['merge']({},_0x2f541b,_0x15443b['options']);return _0x3e0706[_0x0317('0x4c')](_0x2f541b);}})[_0x0317('0x3b')](function(_0x123b55){if(_0x123b55){_0x598545=_0x123b55[_0x0317('0x31')];if(!_0x15443b[_0x0317('0x2c')][_0x0317('0x47')]('nolimit')){_0x2f541b['limit']=qs[_0x0317('0x1d')](_0x15443b[_0x0317('0x2c')][_0x0317('0x1d')]);_0x2f541b['offset']=qs['offset'](_0x15443b[_0x0317('0x2c')]['offset']);}return _0x3e0706[_0x0317('0x4c')](_0x2f541b);}})[_0x0317('0x3b')](function(_0x183008){if(_0x183008){return _0x183008?{'count':_0x598545,'rows':_0x183008}:null;}})[_0x0317('0x3b')](respondWithResult(_0x2b6841,null))[_0x0317('0x3f')](handleError(_0x2b6841,null));};exports[_0x0317('0x4e')]=function(_0x21c885,_0x2c987e,_0x21462f){if(_0x21c885[_0x0317('0x43')]['id']){delete _0x21c885['body']['id'];}return db['ZendeskConfiguration'][_0x0317('0x46')]({'where':{'id':_0x21c885[_0x0317('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c987e,null))[_0x0317('0x3b')](function(_0x52795e){if(_0x52795e){return _0x52795e[_0x0317('0x4e')](_0x21c885['body'][_0x0317('0x4f')]||[]);}return null;})[_0x0317('0x3b')](respondWithResult(_0x2c987e,null))[_0x0317('0x3f')](handleError(_0x2c987e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index b285f4c..39d96d9 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 _0x7d25=['api','moment','bluebird','request-promise','path','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger'];(function(_0x1cc325,_0x537298){var _0x33d644=function(_0x4cd101){while(--_0x4cd101){_0x1cc325['push'](_0x1cc325['shift']());}};_0x33d644(++_0x537298);}(_0x7d25,0x8a));var _0x57d2=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x7d25[_0x5f309e];return _0x487b5e;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var logger=require(_0x57d2('0x1'))(_0x57d2('0x2'));var moment=require(_0x57d2('0x3'));var BPromise=require(_0x57d2('0x4'));var rp=require(_0x57d2('0x5'));var fs=require('fs');var path=require(_0x57d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x3c5511,_0x49cc5f){return _0x3c5511[_0x57d2('0x7')](_0x57d2('0x8'),attributes,{'tableName':_0x57d2('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(_0x52b7e6,_0x23763a){var _0x38ee64=function(_0x3700fe){while(--_0x3700fe){_0x52b7e6['push'](_0x52b7e6['shift']());}};_0x38ee64(++_0x23763a);}(_0x896e,0x1e9));var _0xe896=function(_0x45d480,_0x1aa2e6){_0x45d480=_0x45d480-0x0;var _0xe56456=_0x896e[_0x45d480];return _0xe56456;};'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 f25b27b..f68fbf5 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 _0x27a1=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x29db25,_0x457467){var _0x48b1a5=function(_0x5cb05f){while(--_0x5cb05f){_0x29db25['push'](_0x29db25['shift']());}};_0x48b1a5(++_0x457467);}(_0x27a1,0x1d8));var _0x127a=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x27a1[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x127a('0x0'));var util=require(_0x127a('0x1'));var moment=require(_0x127a('0x2'));var BPromise=require('bluebird');var rs=require(_0x127a('0x3'));var fs=require('fs');var Redis=require(_0x127a('0x4'));var db=require(_0x127a('0x5'))['db'];var utils=require(_0x127a('0x6'));var logger=require(_0x127a('0x7'))(_0x127a('0x8'));var config=require(_0x127a('0x9'));var jayson=require(_0x127a('0xa'));var client=jayson['client'][_0x127a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdbe882,_0x5ab7a8,_0x5f26b8){return new BPromise(function(_0x5d45d1,_0x4b89ff){return client[_0x127a('0xc')](_0xdbe882,_0x5f26b8)[_0x127a('0xd')](function(_0x4ecd37){logger[_0x127a('0xe')](_0x127a('0xf'),_0x5ab7a8,_0x127a('0x10'));logger[_0x127a('0x11')](_0x127a('0x12'),_0x5ab7a8,_0x127a('0x10'),JSON[_0x127a('0x13')](_0x4ecd37));if(_0x4ecd37[_0x127a('0x14')]){if(_0x4ecd37[_0x127a('0x14')][_0x127a('0x15')]===0x1f4){logger[_0x127a('0x14')](_0x127a('0xf'),_0x5ab7a8,_0x4ecd37['error'][_0x127a('0x16')]);return _0x4b89ff(_0x4ecd37[_0x127a('0x14')][_0x127a('0x16')]);}logger[_0x127a('0x14')](_0x127a('0xf'),_0x5ab7a8,_0x4ecd37['error'][_0x127a('0x16')]);return _0x5d45d1(_0x4ecd37[_0x127a('0x14')]['message']);}else{logger[_0x127a('0xe')](_0x127a('0xf'),_0x5ab7a8,'request\x20sent');_0x5d45d1(_0x4ecd37[_0x127a('0x17')][_0x127a('0x16')]);}})[_0x127a('0x18')](function(_0xda113d){logger[_0x127a('0x14')](_0x127a('0xf'),_0x5ab7a8,_0xda113d);_0x4b89ff(_0xda113d);});});} \ No newline at end of file +var _0x04cf=['http','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x04cf,0x9e));var _0xf04c=function(_0x4f1d8f,_0x2c2d01){_0x4f1d8f=_0x4f1d8f-0x0;var _0x101bcb=_0x04cf[_0x4f1d8f];return _0x101bcb;};'use strict';var _=require(_0xf04c('0x0'));var util=require(_0xf04c('0x1'));var moment=require(_0xf04c('0x2'));var BPromise=require(_0xf04c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf04c('0x4'))['db'];var utils=require(_0xf04c('0x5'));var logger=require(_0xf04c('0x6'))('rpc');var config=require(_0xf04c('0x7'));var jayson=require(_0xf04c('0x8'));var client=jayson[_0xf04c('0x9')][_0xf04c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x186b83,_0x210798,_0x358abb){return new BPromise(function(_0x18605d,_0x109e72){return client['request'](_0x186b83,_0x358abb)['then'](function(_0x529189){logger[_0xf04c('0xb')](_0xf04c('0xc'),_0x210798,_0xf04c('0xd'));logger[_0xf04c('0xe')](_0xf04c('0xf'),_0x210798,_0xf04c('0xd'),JSON[_0xf04c('0x10')](_0x529189));if(_0x529189['error']){if(_0x529189[_0xf04c('0x11')]['code']===0x1f4){logger[_0xf04c('0x11')](_0xf04c('0xc'),_0x210798,_0x529189[_0xf04c('0x11')][_0xf04c('0x12')]);return _0x109e72(_0x529189[_0xf04c('0x11')][_0xf04c('0x12')]);}logger[_0xf04c('0x11')](_0xf04c('0xc'),_0x210798,_0x529189[_0xf04c('0x11')][_0xf04c('0x12')]);return _0x18605d(_0x529189['error']['message']);}else{logger[_0xf04c('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x210798,_0xf04c('0xd'));_0x18605d(_0x529189[_0xf04c('0x13')]['message']);}})[_0xf04c('0x14')](function(_0x391b1d){logger['error'](_0xf04c('0xc'),_0x210798,_0x391b1d);_0x109e72(_0x391b1d);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index bbd1474..770985e 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 _0xb6a4=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x364be9,_0x64177c){var _0x529a0a=function(_0xfbb9ba){while(--_0xfbb9ba){_0x364be9['push'](_0x364be9['shift']());}};_0x529a0a(++_0x64177c);}(_0xb6a4,0x164));var _0x4b6a=function(_0x2ba6ad,_0x18bb40){_0x2ba6ad=_0x2ba6ad-0x0;var _0x277fe3=_0xb6a4[_0x2ba6ad];return _0x277fe3;};'use strict';var multer=require(_0x4b6a('0x0'));var util=require(_0x4b6a('0x1'));var path=require(_0x4b6a('0x2'));var timeout=require(_0x4b6a('0x3'));var express=require(_0x4b6a('0x4'));var router=express[_0x4b6a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4b6a('0x6'));var interaction=require(_0x4b6a('0x7'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x4b6a('0x8')]('/',auth[_0x4b6a('0x9')](),controller[_0x4b6a('0xa')]);router[_0x4b6a('0x8')](_0x4b6a('0xb'),auth['isAuthenticated'](),controller[_0x4b6a('0xc')]);router[_0x4b6a('0xd')]('/',auth[_0x4b6a('0x9')](),controller[_0x4b6a('0xe')]);router[_0x4b6a('0xf')](_0x4b6a('0xb'),auth[_0x4b6a('0x9')](),controller['update']);router['delete'](_0x4b6a('0xb'),auth[_0x4b6a('0x9')](),controller[_0x4b6a('0x10')]);module[_0x4b6a('0x11')]=router; \ No newline at end of file +var _0x6bcd=['show','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id'];(function(_0x2df223,_0x2a1c51){var _0x3cf13e=function(_0x442769){while(--_0x442769){_0x2df223['push'](_0x2df223['shift']());}};_0x3cf13e(++_0x2a1c51);}(_0x6bcd,0x138));var _0xd6bc=function(_0x534781,_0x269e1e){_0x534781=_0x534781-0x0;var _0x634858=_0x6bcd[_0x534781];return _0x634858;};'use strict';var multer=require(_0xd6bc('0x0'));var util=require(_0xd6bc('0x1'));var path=require(_0xd6bc('0x2'));var timeout=require(_0xd6bc('0x3'));var express=require('express');var router=express[_0xd6bc('0x4')]();var fs_extra=require(_0xd6bc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd6bc('0x6'));var config=require(_0xd6bc('0x7'));var controller=require(_0xd6bc('0x8'));router[_0xd6bc('0x9')]('/',auth[_0xd6bc('0xa')](),controller['index']);router[_0xd6bc('0x9')](_0xd6bc('0xb'),auth[_0xd6bc('0xa')](),controller[_0xd6bc('0xc')]);router[_0xd6bc('0xd')]('/',auth[_0xd6bc('0xa')](),controller['create']);router[_0xd6bc('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd6bc('0xf')]);router['delete'](_0xd6bc('0xb'),auth[_0xd6bc('0xa')](),controller[_0xd6bc('0x10')]);module[_0xd6bc('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d9cfe78..eb997e2 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 _0xa800=['keyValue','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','string','variable'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0xa800,0x176));var _0x0a80=function(_0x31db70,_0x62d245){_0x31db70=_0x31db70-0x0;var _0x5623a4=_0xa800[_0x31db70];return _0x5623a4;};'use strict';var Sequelize=require(_0x0a80('0x0'));module[_0x0a80('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0a80('0x2'),_0x0a80('0x3'),'customVariable',_0x0a80('0x4'),'picklist'),'defaultValue':_0x0a80('0x2')},'content':{'type':Sequelize[_0x0a80('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0a80('0x6')](_0x0a80('0x2'),_0x0a80('0x3'),_0x0a80('0x7'))},'keyContent':{'type':Sequelize[_0x0a80('0x5')]},'idField':{'type':Sequelize[_0x0a80('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0a80('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0a80('0x5')]}}; \ No newline at end of file +var _0x6abd=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x3b2f6a,_0x3d29d8){var _0x19985b=function(_0x432c64){while(--_0x432c64){_0x3b2f6a['push'](_0x3b2f6a['shift']());}};_0x19985b(++_0x3d29d8);}(_0x6abd,0xdc));var _0xd6ab=function(_0xa94cee,_0x6c7963){_0xa94cee=_0xa94cee-0x0;var _0x42bad3=_0x6abd[_0xa94cee];return _0x42bad3;};'use strict';var Sequelize=require(_0xd6ab('0x0'));module[_0xd6ab('0x1')]={'type':{'type':Sequelize[_0xd6ab('0x2')]('string',_0xd6ab('0x3'),_0xd6ab('0x4'),_0xd6ab('0x5'),_0xd6ab('0x6')),'defaultValue':_0xd6ab('0x7')},'content':{'type':Sequelize[_0xd6ab('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd6ab('0x2')](_0xd6ab('0x7'),'variable',_0xd6ab('0x4'))},'keyContent':{'type':Sequelize[_0xd6ab('0x8')]},'idField':{'type':Sequelize[_0xd6ab('0x8')]},'nameField':{'type':Sequelize[_0xd6ab('0x8')]},'customField':{'type':Sequelize[_0xd6ab('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 822acd1..6dc1de8 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 _0xa583=['params','keys','rawAttributes','find','create','body','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','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','undefined','count','offset','limit','set','apply','reject','save','update','then','stack','name','send','index','ZendeskField','fieldName','type','key','map','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show'];(function(_0x4048e3,_0x10f92b){var _0x4e4c8b=function(_0x84d136){while(--_0x84d136){_0x4048e3['push'](_0x4048e3['shift']());}};_0x4e4c8b(++_0x10f92b);}(_0xa583,0x127));var _0x3a58=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa583[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a58('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a58('0x1'));var rp=require(_0x3a58('0x2'));var moment=require(_0x3a58('0x3'));var BPromise=require(_0x3a58('0x4'));var Mustache=require('mustache');var util=require(_0x3a58('0x5'));var path=require(_0x3a58('0x6'));var sox=require(_0x3a58('0x7'));var csv=require(_0x3a58('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3a58('0x9'));var crypto=require('crypto');var jsforce=require(_0x3a58('0xa'));var deskjs=require(_0x3a58('0xb'));var toCsv=require(_0x3a58('0x8'));var querystring=require(_0x3a58('0xc'));var Papa=require(_0x3a58('0xd'));var Redis=require(_0x3a58('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3a58('0xf'));var hardwareService=require(_0x3a58('0x10'));var logger=require(_0x3a58('0x11'))(_0x3a58('0x12'));var utils=require(_0x3a58('0x13'));var config=require(_0x3a58('0x14'));var licenseUtil=require(_0x3a58('0x15'));var db=require(_0x3a58('0x16'))['db'];function respondWithStatusCode(_0x1cc677,_0xe51ee){_0xe51ee=_0xe51ee||0xcc;return function(_0x214c68){if(_0x214c68){return _0x1cc677[_0x3a58('0x17')](_0xe51ee);}return _0x1cc677[_0x3a58('0x18')](_0xe51ee)['end']();};}function respondWithResult(_0x4e4c93,_0x230c08){_0x230c08=_0x230c08||0xc8;return function(_0x3adf8f){if(_0x3adf8f){return _0x4e4c93[_0x3a58('0x18')](_0x230c08)['json'](_0x3adf8f);}};}function respondWithFilteredResult(_0x408133,_0x58e986){return function(_0x1a514d){if(_0x1a514d){var _0x32310b=typeof _0x58e986['offset']===_0x3a58('0x19')&&typeof _0x58e986['limit']===_0x3a58('0x19');var _0x398ce9=_0x1a514d[_0x3a58('0x1a')];var _0x92c64c=_0x32310b?0x0:_0x58e986[_0x3a58('0x1b')];var _0x487d4b=_0x32310b?_0x1a514d[_0x3a58('0x1a')]:_0x58e986['offset']+_0x58e986[_0x3a58('0x1c')];var _0x25a24f;if(_0x487d4b>=_0x398ce9){_0x487d4b=_0x398ce9;_0x25a24f=0xc8;}else{_0x25a24f=0xce;}_0x408133['status'](_0x25a24f);return _0x408133[_0x3a58('0x1d')]('Content-Range',_0x92c64c+'-'+_0x487d4b+'/'+_0x398ce9)['json'](_0x1a514d);}return null;};}function patchUpdates(_0x256118){return function(_0x325b00){try{jsonpatch[_0x3a58('0x1e')](_0x325b00,_0x256118,!![]);}catch(_0x2c3419){return BPromise[_0x3a58('0x1f')](_0x2c3419);}return _0x325b00[_0x3a58('0x20')]();};}function saveUpdates(_0x458e87,_0x2b94bb){return function(_0x4a62d0){if(_0x4a62d0){return _0x4a62d0[_0x3a58('0x21')](_0x458e87)[_0x3a58('0x22')](function(_0x59b9b8){return _0x59b9b8;});}return null;};}function removeEntity(_0x5eb7a3,_0x29cbad){return function(_0x6f40e0){if(_0x6f40e0){return _0x6f40e0['destroy']()[_0x3a58('0x22')](function(){_0x5eb7a3[_0x3a58('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55c876,_0x5593ff){return function(_0x1c9db0){if(!_0x1c9db0){_0x55c876[_0x3a58('0x17')](0x194);}return _0x1c9db0;};}function handleError(_0x4073b4,_0x325a29){_0x325a29=_0x325a29||0x1f4;return function(_0x3f24e8){logger['error'](_0x3f24e8[_0x3a58('0x23')]);if(_0x3f24e8[_0x3a58('0x24')]){delete _0x3f24e8[_0x3a58('0x24')];}_0x4073b4[_0x3a58('0x18')](_0x325a29)[_0x3a58('0x25')](_0x3f24e8);};}exports[_0x3a58('0x26')]=function(_0x11d4c7,_0x5261ef){var _0x10d692={},_0x49ef1f={},_0x55b49f={'count':0x0,'rows':[]};var _0x162278=_['map'](db[_0x3a58('0x27')]['rawAttributes'],function(_0x4b51ad){return{'name':_0x4b51ad[_0x3a58('0x28')],'type':_0x4b51ad[_0x3a58('0x29')][_0x3a58('0x2a')]};});_0x49ef1f['model']=_[_0x3a58('0x2b')](_0x162278,_0x3a58('0x24'));_0x49ef1f[_0x3a58('0x2c')]=_['keys'](_0x11d4c7[_0x3a58('0x2c')]);_0x49ef1f['filters']=_['intersection'](_0x49ef1f[_0x3a58('0x2d')],_0x49ef1f['query']);_0x10d692[_0x3a58('0x2e')]=_[_0x3a58('0x2f')](_0x49ef1f['model'],qs[_0x3a58('0x30')](_0x11d4c7[_0x3a58('0x2c')][_0x3a58('0x30')]));_0x10d692[_0x3a58('0x2e')]=_0x10d692['attributes'][_0x3a58('0x31')]?_0x10d692['attributes']:_0x49ef1f['model'];if(!_0x11d4c7[_0x3a58('0x2c')][_0x3a58('0x32')](_0x3a58('0x33'))){_0x10d692[_0x3a58('0x1c')]=qs[_0x3a58('0x1c')](_0x11d4c7[_0x3a58('0x2c')][_0x3a58('0x1c')]);_0x10d692['offset']=qs[_0x3a58('0x1b')](_0x11d4c7[_0x3a58('0x2c')][_0x3a58('0x1b')]);}_0x10d692['order']=qs[_0x3a58('0x34')](_0x11d4c7[_0x3a58('0x2c')][_0x3a58('0x34')]);_0x10d692[_0x3a58('0x35')]=qs[_0x3a58('0x36')](_['pick'](_0x11d4c7['query'],_0x49ef1f[_0x3a58('0x36')]),_0x162278);if(_0x11d4c7[_0x3a58('0x2c')]['filter']){_0x10d692[_0x3a58('0x35')]=_[_0x3a58('0x37')](_0x10d692[_0x3a58('0x35')],{'$or':_[_0x3a58('0x2b')](_0x162278,function(_0x952f0d){if(_0x952f0d[_0x3a58('0x29')]!==_0x3a58('0x38')){var _0x237b1f={};_0x237b1f[_0x952f0d[_0x3a58('0x24')]]={'$like':'%'+_0x11d4c7[_0x3a58('0x2c')][_0x3a58('0x39')]+'%'};return _0x237b1f;}})});}_0x10d692=_[_0x3a58('0x37')]({},_0x10d692,_0x11d4c7[_0x3a58('0x3a')]);var _0x1a56d8={'where':_0x10d692[_0x3a58('0x35')]};return db[_0x3a58('0x27')]['count'](_0x1a56d8)[_0x3a58('0x22')](function(_0x5b834f){_0x55b49f[_0x3a58('0x1a')]=_0x5b834f;if(_0x11d4c7[_0x3a58('0x2c')][_0x3a58('0x3b')]){_0x10d692[_0x3a58('0x3c')]=[{'all':!![]}];}return db['ZendeskField'][_0x3a58('0x3d')](_0x10d692);})[_0x3a58('0x22')](function(_0x17af3f){_0x55b49f[_0x3a58('0x3e')]=_0x17af3f;return _0x55b49f;})[_0x3a58('0x22')](respondWithFilteredResult(_0x5261ef,_0x10d692))[_0x3a58('0x3f')](handleError(_0x5261ef,null));};exports[_0x3a58('0x40')]=function(_0x1d449c,_0x5e7d45){var _0x4e7f90={'raw':!![],'where':{'id':_0x1d449c[_0x3a58('0x41')]['id']}},_0x104744={};_0x104744[_0x3a58('0x2d')]=_[_0x3a58('0x42')](db[_0x3a58('0x27')][_0x3a58('0x43')]);_0x104744[_0x3a58('0x2c')]=_[_0x3a58('0x42')](_0x1d449c[_0x3a58('0x2c')]);_0x104744[_0x3a58('0x36')]=_['intersection'](_0x104744[_0x3a58('0x2d')],_0x104744[_0x3a58('0x2c')]);_0x4e7f90[_0x3a58('0x2e')]=_[_0x3a58('0x2f')](_0x104744[_0x3a58('0x2d')],qs[_0x3a58('0x30')](_0x1d449c[_0x3a58('0x2c')][_0x3a58('0x30')]));_0x4e7f90[_0x3a58('0x2e')]=_0x4e7f90['attributes'][_0x3a58('0x31')]?_0x4e7f90[_0x3a58('0x2e')]:_0x104744[_0x3a58('0x2d')];if(_0x1d449c[_0x3a58('0x2c')][_0x3a58('0x3b')]){_0x4e7f90[_0x3a58('0x3c')]=[{'all':!![]}];}_0x4e7f90=_[_0x3a58('0x37')]({},_0x4e7f90,_0x1d449c[_0x3a58('0x3a')]);return db[_0x3a58('0x27')][_0x3a58('0x44')](_0x4e7f90)[_0x3a58('0x22')](handleEntityNotFound(_0x5e7d45,null))[_0x3a58('0x22')](respondWithResult(_0x5e7d45,null))[_0x3a58('0x3f')](handleError(_0x5e7d45,null));};exports[_0x3a58('0x45')]=function(_0x3547b0,_0x5371b0){return db[_0x3a58('0x27')]['create'](_0x3547b0[_0x3a58('0x46')],{})[_0x3a58('0x22')](respondWithResult(_0x5371b0,0xc9))[_0x3a58('0x3f')](handleError(_0x5371b0,null));};exports[_0x3a58('0x21')]=function(_0x28e519,_0x37e338){if(_0x28e519['body']['id']){delete _0x28e519['body']['id'];}return db['ZendeskField'][_0x3a58('0x44')]({'where':{'id':_0x28e519[_0x3a58('0x41')]['id']}})[_0x3a58('0x22')](handleEntityNotFound(_0x37e338,null))[_0x3a58('0x22')](saveUpdates(_0x28e519[_0x3a58('0x46')],null))[_0x3a58('0x22')](respondWithResult(_0x37e338,null))[_0x3a58('0x3f')](handleError(_0x37e338,null));};exports[_0x3a58('0x47')]=function(_0x40e3f4,_0xe87d92){return db['ZendeskField'][_0x3a58('0x44')]({'where':{'id':_0x40e3f4[_0x3a58('0x41')]['id']}})[_0x3a58('0x22')](handleEntityNotFound(_0xe87d92,null))['then'](removeEntity(_0xe87d92,null))['catch'](handleError(_0xe87d92,null));}; \ No newline at end of file +var _0xfc9f=['../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','ZendeskField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1996c9,_0x1adb43){var _0x381354=function(_0x450bb0){while(--_0x450bb0){_0x1996c9['push'](_0x1996c9['shift']());}};_0x381354(++_0x1adb43);}(_0xfc9f,0x7a));var _0xffc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc9f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xffc9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xffc9('0x1'));var jsonpatch=require(_0xffc9('0x2'));var rp=require(_0xffc9('0x3'));var moment=require(_0xffc9('0x4'));var BPromise=require(_0xffc9('0x5'));var Mustache=require(_0xffc9('0x6'));var util=require('util');var path=require('path');var sox=require(_0xffc9('0x7'));var csv=require('to-csv');var ejs=require(_0xffc9('0x8'));var fs=require('fs');var fs_extra=require(_0xffc9('0x9'));var _=require('lodash');var squel=require(_0xffc9('0xa'));var crypto=require(_0xffc9('0xb'));var jsforce=require(_0xffc9('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xffc9('0xd'));var authService=require(_0xffc9('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xffc9('0xf'));var hardwareService=require(_0xffc9('0x10'));var logger=require(_0xffc9('0x11'))(_0xffc9('0x12'));var utils=require(_0xffc9('0x13'));var config=require(_0xffc9('0x14'));var licenseUtil=require(_0xffc9('0x15'));var db=require(_0xffc9('0x16'))['db'];function respondWithStatusCode(_0x3bbc9a,_0x20ce22){_0x20ce22=_0x20ce22||0xcc;return function(_0x199ca9){if(_0x199ca9){return _0x3bbc9a[_0xffc9('0x17')](_0x20ce22);}return _0x3bbc9a[_0xffc9('0x18')](_0x20ce22)['end']();};}function respondWithResult(_0x1d787c,_0x3d9933){_0x3d9933=_0x3d9933||0xc8;return function(_0x54295f){if(_0x54295f){return _0x1d787c[_0xffc9('0x18')](_0x3d9933)['json'](_0x54295f);}};}function respondWithFilteredResult(_0x3f3317,_0x348946){return function(_0x55fdb9){if(_0x55fdb9){var _0x93976e=typeof _0x348946[_0xffc9('0x19')]===_0xffc9('0x1a')&&typeof _0x348946[_0xffc9('0x1b')]===_0xffc9('0x1a');var _0x1473af=_0x55fdb9[_0xffc9('0x1c')];var _0x3f5b02=_0x93976e?0x0:_0x348946[_0xffc9('0x19')];var _0x13867e=_0x93976e?_0x55fdb9['count']:_0x348946['offset']+_0x348946[_0xffc9('0x1b')];var _0x3c6a99;if(_0x13867e>=_0x1473af){_0x13867e=_0x1473af;_0x3c6a99=0xc8;}else{_0x3c6a99=0xce;}_0x3f3317[_0xffc9('0x18')](_0x3c6a99);return _0x3f3317['set'](_0xffc9('0x1d'),_0x3f5b02+'-'+_0x13867e+'/'+_0x1473af)['json'](_0x55fdb9);}return null;};}function patchUpdates(_0x23d640){return function(_0x5f23ee){try{jsonpatch[_0xffc9('0x1e')](_0x5f23ee,_0x23d640,!![]);}catch(_0x50813c){return BPromise[_0xffc9('0x1f')](_0x50813c);}return _0x5f23ee[_0xffc9('0x20')]();};}function saveUpdates(_0x2bf46f,_0x26cb67){return function(_0x6ac0bc){if(_0x6ac0bc){return _0x6ac0bc[_0xffc9('0x21')](_0x2bf46f)[_0xffc9('0x22')](function(_0x4cc2da){return _0x4cc2da;});}return null;};}function removeEntity(_0x32763f,_0x22c3ed){return function(_0x253901){if(_0x253901){return _0x253901[_0xffc9('0x23')]()[_0xffc9('0x22')](function(){_0x32763f[_0xffc9('0x18')](0xcc)[_0xffc9('0x24')]();});}};}function handleEntityNotFound(_0x3f30c8,_0xf62460){return function(_0x40fc2b){if(!_0x40fc2b){_0x3f30c8[_0xffc9('0x17')](0x194);}return _0x40fc2b;};}function handleError(_0x400bcf,_0x3a20f0){_0x3a20f0=_0x3a20f0||0x1f4;return function(_0x35df6c){logger[_0xffc9('0x25')](_0x35df6c['stack']);if(_0x35df6c[_0xffc9('0x26')]){delete _0x35df6c[_0xffc9('0x26')];}_0x400bcf['status'](_0x3a20f0)[_0xffc9('0x27')](_0x35df6c);};}exports['index']=function(_0x3716d1,_0x1ff5d6){var _0x28d54f={},_0x53a5d7={},_0x499c51={'count':0x0,'rows':[]};var _0x33dc2b=_['map'](db[_0xffc9('0x28')][_0xffc9('0x29')],function(_0x460d26){return{'name':_0x460d26[_0xffc9('0x2a')],'type':_0x460d26[_0xffc9('0x2b')][_0xffc9('0x2c')]};});_0x53a5d7['model']=_['map'](_0x33dc2b,_0xffc9('0x26'));_0x53a5d7[_0xffc9('0x2d')]=_[_0xffc9('0x2e')](_0x3716d1[_0xffc9('0x2d')]);_0x53a5d7[_0xffc9('0x2f')]=_[_0xffc9('0x30')](_0x53a5d7[_0xffc9('0x31')],_0x53a5d7['query']);_0x28d54f[_0xffc9('0x32')]=_[_0xffc9('0x30')](_0x53a5d7[_0xffc9('0x31')],qs['fields'](_0x3716d1[_0xffc9('0x2d')][_0xffc9('0x33')]));_0x28d54f[_0xffc9('0x32')]=_0x28d54f[_0xffc9('0x32')][_0xffc9('0x34')]?_0x28d54f['attributes']:_0x53a5d7['model'];if(!_0x3716d1[_0xffc9('0x2d')][_0xffc9('0x35')](_0xffc9('0x36'))){_0x28d54f[_0xffc9('0x1b')]=qs[_0xffc9('0x1b')](_0x3716d1[_0xffc9('0x2d')][_0xffc9('0x1b')]);_0x28d54f[_0xffc9('0x19')]=qs[_0xffc9('0x19')](_0x3716d1['query'][_0xffc9('0x19')]);}_0x28d54f[_0xffc9('0x37')]=qs['sort'](_0x3716d1['query'][_0xffc9('0x38')]);_0x28d54f[_0xffc9('0x39')]=qs[_0xffc9('0x2f')](_[_0xffc9('0x3a')](_0x3716d1[_0xffc9('0x2d')],_0x53a5d7[_0xffc9('0x2f')]),_0x33dc2b);if(_0x3716d1[_0xffc9('0x2d')]['filter']){_0x28d54f['where']=_[_0xffc9('0x3b')](_0x28d54f[_0xffc9('0x39')],{'$or':_[_0xffc9('0x3c')](_0x33dc2b,function(_0x1cd157){if(_0x1cd157[_0xffc9('0x2b')]!=='VIRTUAL'){var _0x22c6f2={};_0x22c6f2[_0x1cd157['name']]={'$like':'%'+_0x3716d1['query'][_0xffc9('0x3d')]+'%'};return _0x22c6f2;}})});}_0x28d54f=_[_0xffc9('0x3b')]({},_0x28d54f,_0x3716d1[_0xffc9('0x3e')]);var _0x204af3={'where':_0x28d54f[_0xffc9('0x39')]};return db[_0xffc9('0x28')]['count'](_0x204af3)[_0xffc9('0x22')](function(_0xe5f73e){_0x499c51[_0xffc9('0x1c')]=_0xe5f73e;if(_0x3716d1[_0xffc9('0x2d')][_0xffc9('0x3f')]){_0x28d54f[_0xffc9('0x40')]=[{'all':!![]}];}return db[_0xffc9('0x28')][_0xffc9('0x41')](_0x28d54f);})[_0xffc9('0x22')](function(_0x3eeebe){_0x499c51[_0xffc9('0x42')]=_0x3eeebe;return _0x499c51;})['then'](respondWithFilteredResult(_0x1ff5d6,_0x28d54f))[_0xffc9('0x43')](handleError(_0x1ff5d6,null));};exports['show']=function(_0x4e3df8,_0x42ff9d){var _0x3268b4={'raw':!![],'where':{'id':_0x4e3df8[_0xffc9('0x44')]['id']}},_0x23b7a0={};_0x23b7a0[_0xffc9('0x31')]=_[_0xffc9('0x2e')](db[_0xffc9('0x28')]['rawAttributes']);_0x23b7a0[_0xffc9('0x2d')]=_['keys'](_0x4e3df8['query']);_0x23b7a0[_0xffc9('0x2f')]=_[_0xffc9('0x30')](_0x23b7a0[_0xffc9('0x31')],_0x23b7a0['query']);_0x3268b4[_0xffc9('0x32')]=_[_0xffc9('0x30')](_0x23b7a0['model'],qs[_0xffc9('0x33')](_0x4e3df8['query'][_0xffc9('0x33')]));_0x3268b4[_0xffc9('0x32')]=_0x3268b4[_0xffc9('0x32')][_0xffc9('0x34')]?_0x3268b4[_0xffc9('0x32')]:_0x23b7a0[_0xffc9('0x31')];if(_0x4e3df8[_0xffc9('0x2d')][_0xffc9('0x3f')]){_0x3268b4[_0xffc9('0x40')]=[{'all':!![]}];}_0x3268b4=_[_0xffc9('0x3b')]({},_0x3268b4,_0x4e3df8[_0xffc9('0x3e')]);return db[_0xffc9('0x28')][_0xffc9('0x45')](_0x3268b4)[_0xffc9('0x22')](handleEntityNotFound(_0x42ff9d,null))[_0xffc9('0x22')](respondWithResult(_0x42ff9d,null))['catch'](handleError(_0x42ff9d,null));};exports['create']=function(_0x48015e,_0x4a00a7){return db[_0xffc9('0x28')][_0xffc9('0x46')](_0x48015e['body'],{})[_0xffc9('0x22')](respondWithResult(_0x4a00a7,0xc9))[_0xffc9('0x43')](handleError(_0x4a00a7,null));};exports['update']=function(_0x529eca,_0x14a389){if(_0x529eca[_0xffc9('0x47')]['id']){delete _0x529eca[_0xffc9('0x47')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x529eca['params']['id']}})[_0xffc9('0x22')](handleEntityNotFound(_0x14a389,null))[_0xffc9('0x22')](saveUpdates(_0x529eca['body'],null))[_0xffc9('0x22')](respondWithResult(_0x14a389,null))[_0xffc9('0x43')](handleError(_0x14a389,null));};exports['destroy']=function(_0x224a45,_0x17a94a){return db[_0xffc9('0x28')][_0xffc9('0x45')]({'where':{'id':_0x224a45[_0xffc9('0x44')]['id']}})[_0xffc9('0x22')](handleEntityNotFound(_0x17a94a,null))[_0xffc9('0x22')](removeEntity(_0x17a94a,null))[_0xffc9('0x43')](handleError(_0x17a94a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e7814e2..a43bf7f 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 _0x84ba=['zendesk_unique_index','idField','FieldId','util','api','moment','rimraf','./intZendeskField.attributes','exports','define','ZendeskField'];(function(_0x4e44f2,_0x1eefbd){var _0x2f1463=function(_0x2a1a0a){while(--_0x2a1a0a){_0x4e44f2['push'](_0x4e44f2['shift']());}};_0x2f1463(++_0x1eefbd);}(_0x84ba,0x1c6));var _0xa84b=function(_0x2e7194,_0xea768d){_0x2e7194=_0x2e7194-0x0;var _0x16d3c7=_0x84ba[_0x2e7194];return _0x16d3c7;};'use strict';var _=require('lodash');var util=require(_0xa84b('0x0'));var logger=require('../../config/logger')(_0xa84b('0x1'));var moment=require(_0xa84b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa84b('0x3'));var config=require('../../config/environment');var attributes=require(_0xa84b('0x4'));module[_0xa84b('0x5')]=function(_0x17a486,_0xda60dd){return _0x17a486[_0xa84b('0x6')](_0xa84b('0x7'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xa84b('0x8'),'fields':[_0xa84b('0x9'),_0xa84b('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc235=['int_zendesk_fields','zendesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ZendeskField'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0xc235,0x1e4));var _0x5c23=function(_0xe397b4,_0x37f1c0){_0xe397b4=_0xe397b4-0x0;var _0x384f1e=_0xc235[_0xe397b4];return _0x384f1e;};'use strict';var _=require('lodash');var util=require(_0x5c23('0x0'));var logger=require(_0x5c23('0x1'))(_0x5c23('0x2'));var moment=require(_0x5c23('0x3'));var BPromise=require(_0x5c23('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c23('0x5'));var rimraf=require(_0x5c23('0x6'));var config=require(_0x5c23('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x5c23('0x8')]=function(_0xd18f7b,_0x5e4ff2){return _0xd18f7b[_0x5c23('0x9')](_0x5c23('0xa'),attributes,{'tableName':_0x5c23('0xb'),'paranoid':![],'indexes':[{'name':_0x5c23('0xc'),'fields':[_0x5c23('0xd'),_0x5c23('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index b83c9d2..a2c8dfe 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 _0x95cf=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskField,\x20%s,\x20%s'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0x95cf,0xba));var _0xf95c=function(_0x30dca1,_0x3c89e4){_0x30dca1=_0x30dca1-0x0;var _0x1cf754=_0x95cf[_0x30dca1];return _0x1cf754;};'use strict';var _=require(_0xf95c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf95c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf95c('0x2'));var db=require(_0xf95c('0x3'))['db'];var utils=require(_0xf95c('0x4'));var logger=require(_0xf95c('0x5'))(_0xf95c('0x6'));var config=require(_0xf95c('0x7'));var jayson=require(_0xf95c('0x8'));var client=jayson['client'][_0xf95c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x301839,_0x4d69bb,_0x1f6f91){return new BPromise(function(_0x13a53d,_0xe8263b){return client['request'](_0x301839,_0x1f6f91)['then'](function(_0x162cda){logger[_0xf95c('0xa')](_0xf95c('0xb'),_0x4d69bb,_0xf95c('0xc'));logger[_0xf95c('0xd')](_0xf95c('0xe'),_0x4d69bb,_0xf95c('0xc'),JSON['stringify'](_0x162cda));if(_0x162cda['error']){if(_0x162cda[_0xf95c('0xf')][_0xf95c('0x10')]===0x1f4){logger[_0xf95c('0xf')](_0xf95c('0xb'),_0x4d69bb,_0x162cda[_0xf95c('0xf')]['message']);return _0xe8263b(_0x162cda['error'][_0xf95c('0x11')]);}logger[_0xf95c('0xf')](_0xf95c('0xb'),_0x4d69bb,_0x162cda[_0xf95c('0xf')][_0xf95c('0x11')]);return _0x13a53d(_0x162cda[_0xf95c('0xf')][_0xf95c('0x11')]);}else{logger['info'](_0xf95c('0xb'),_0x4d69bb,_0xf95c('0xc'));_0x13a53d(_0x162cda['result'][_0xf95c('0x11')]);}})['catch'](function(_0x2eef27){logger[_0xf95c('0xf')](_0xf95c('0xb'),_0x4d69bb,_0x2eef27);_0xe8263b(_0x2eef27);});});} \ No newline at end of file +var _0xde52=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1f076c,_0x177f82){var _0x4c90bd=function(_0xb77097){while(--_0xb77097){_0x1f076c['push'](_0x1f076c['shift']());}};_0x4c90bd(++_0x177f82);}(_0xde52,0x130));var _0x2de5=function(_0x2b6d46,_0x11867e){_0x2b6d46=_0x2b6d46-0x0;var _0x555bdb=_0xde52[_0x2b6d46];return _0x555bdb;};'use strict';var _=require(_0x2de5('0x0'));var util=require(_0x2de5('0x1'));var moment=require(_0x2de5('0x2'));var BPromise=require(_0x2de5('0x3'));var rs=require(_0x2de5('0x4'));var fs=require('fs');var Redis=require(_0x2de5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2de5('0x6'));var logger=require(_0x2de5('0x7'))(_0x2de5('0x8'));var config=require('../../config/environment');var jayson=require(_0x2de5('0x9'));var client=jayson[_0x2de5('0xa')][_0x2de5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31e44b,_0x355664,_0x47f710){return new BPromise(function(_0x4098ae,_0xfeccc0){return client['request'](_0x31e44b,_0x47f710)['then'](function(_0x3ab3c4){logger[_0x2de5('0xc')](_0x2de5('0xd'),_0x355664,'request\x20sent');logger[_0x2de5('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x355664,_0x2de5('0xf'),JSON[_0x2de5('0x10')](_0x3ab3c4));if(_0x3ab3c4[_0x2de5('0x11')]){if(_0x3ab3c4[_0x2de5('0x11')][_0x2de5('0x12')]===0x1f4){logger['error'](_0x2de5('0xd'),_0x355664,_0x3ab3c4[_0x2de5('0x11')]['message']);return _0xfeccc0(_0x3ab3c4['error'][_0x2de5('0x13')]);}logger[_0x2de5('0x11')](_0x2de5('0xd'),_0x355664,_0x3ab3c4['error']['message']);return _0x4098ae(_0x3ab3c4[_0x2de5('0x11')][_0x2de5('0x13')]);}else{logger[_0x2de5('0xc')](_0x2de5('0xd'),_0x355664,_0x2de5('0xf'));_0x4098ae(_0x3ab3c4[_0x2de5('0x14')][_0x2de5('0x13')]);}})[_0x2de5('0x15')](function(_0x45cd2f){logger[_0x2de5('0x11')](_0x2de5('0xd'),_0x355664,_0x45cd2f);_0xfeccc0(_0x45cd2f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 713cb26..c6651a9 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 _0x0194=['exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','update','delete','destroy'];(function(_0x4c11f7,_0x5a0447){var _0x587d6b=function(_0x5b9bbf){while(--_0x5b9bbf){_0x4c11f7['push'](_0x4c11f7['shift']());}};_0x587d6b(++_0x5a0447);}(_0x0194,0xa9));var _0x4019=function(_0x489909,_0x712d66){_0x489909=_0x489909-0x0;var _0x2b49a1=_0x0194[_0x489909];return _0x2b49a1;};'use strict';var multer=require(_0x4019('0x0'));var util=require('util');var path=require(_0x4019('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4019('0x2')]();var fs_extra=require(_0x4019('0x3'));var auth=require(_0x4019('0x4'));var interaction=require(_0x4019('0x5'));var config=require(_0x4019('0x6'));var controller=require(_0x4019('0x7'));router['get']('/',auth[_0x4019('0x8')](),controller['index']);router['get'](_0x4019('0x9'),auth[_0x4019('0x8')](),controller[_0x4019('0xa')]);router[_0x4019('0xb')](_0x4019('0xc'),auth[_0x4019('0x8')](),controller[_0x4019('0xd')]);router[_0x4019('0xb')](_0x4019('0xe'),auth[_0x4019('0x8')](),controller[_0x4019('0xf')]);router[_0x4019('0x10')]('/',auth[_0x4019('0x8')](),controller['create']);router[_0x4019('0x10')](_0x4019('0xc'),auth[_0x4019('0x8')](),controller['addConfiguration']);router['put'](_0x4019('0x9'),auth[_0x4019('0x8')](),controller[_0x4019('0x11')]);router[_0x4019('0x12')](_0x4019('0x9'),auth[_0x4019('0x8')](),controller[_0x4019('0x13')]);module[_0x4019('0x14')]=router; \ No newline at end of file +var _0x0195=['../../config/environment','./intZohoAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x0195,0x13b));var _0x5019=function(_0x717ea6,_0x50e905){_0x717ea6=_0x717ea6-0x0;var _0x27999e=_0x0195[_0x717ea6];return _0x27999e;};'use strict';var multer=require(_0x5019('0x0'));var util=require(_0x5019('0x1'));var path=require('path');var timeout=require(_0x5019('0x2'));var express=require('express');var router=express[_0x5019('0x3')]();var fs_extra=require(_0x5019('0x4'));var auth=require(_0x5019('0x5'));var interaction=require(_0x5019('0x6'));var config=require(_0x5019('0x7'));var controller=require(_0x5019('0x8'));router[_0x5019('0x9')]('/',auth['isAuthenticated'](),controller[_0x5019('0xa')]);router[_0x5019('0x9')](_0x5019('0xb'),auth[_0x5019('0xc')](),controller[_0x5019('0xd')]);router[_0x5019('0x9')](_0x5019('0xe'),auth[_0x5019('0xc')](),controller[_0x5019('0xf')]);router[_0x5019('0x9')](_0x5019('0x10'),auth['isAuthenticated'](),controller[_0x5019('0x11')]);router[_0x5019('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5019('0x12')](_0x5019('0xe'),auth[_0x5019('0xc')](),controller[_0x5019('0x13')]);router[_0x5019('0x14')](_0x5019('0xb'),auth[_0x5019('0xc')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5019('0x15')]);module[_0x5019('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a4e079a..f32f46e 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 _0x1be1=['STRING'];(function(_0x224365,_0x137b8a){var _0x3e4131=function(_0x204586){while(--_0x204586){_0x224365['push'](_0x224365['shift']());}};_0x3e4131(++_0x137b8a);}(_0x1be1,0x192));var _0x11be=function(_0x2e8bea,_0x2ce264){_0x2e8bea=_0x2e8bea-0x0;var _0x157f22=_0x1be1[_0x2e8bea];return _0x157f22;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x11be('0x0')]},'description':{'type':Sequelize[_0x11be('0x0')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x11be('0x0')]},'clientId':{'type':Sequelize[_0x11be('0x0')]},'clientSecret':{'type':Sequelize[_0x11be('0x0')]},'serverUrl':{'type':Sequelize[_0x11be('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x11be('0x0')]}}; \ No newline at end of file +var _0x9c44=['STRING'];(function(_0x47ace0,_0x5799a7){var _0x54f124=function(_0x46ecb9){while(--_0x46ecb9){_0x47ace0['push'](_0x47ace0['shift']());}};_0x54f124(++_0x5799a7);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')]},'description':{'type':Sequelize[_0x49c4('0x0')]},'host':{'type':Sequelize[_0x49c4('0x0')]},'zone':{'type':Sequelize[_0x49c4('0x0')]},'clientId':{'type':Sequelize[_0x49c4('0x0')]},'clientSecret':{'type':Sequelize[_0x49c4('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x49c4('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index ac8940d..ebf5c3e 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 _0x1d74=['findAll','rows','catch','params','rawAttributes','intersection','create','body','find','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','Descriptions','channel','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','code','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','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','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../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','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','index','ZohoAccount','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x3a99f4,_0x2a81c1){var _0xea0b42=function(_0x41f533){while(--_0x41f533){_0x3a99f4['push'](_0x3a99f4['shift']());}};_0xea0b42(++_0x2a81c1);}(_0x1d74,0xc1));var _0x41d7=function(_0x1a32fe,_0xdab6ac){_0x1a32fe=_0x1a32fe-0x0;var _0x1abca6=_0x1d74[_0x1a32fe];return _0x1abca6;};'use strict';var emlformat=require(_0x41d7('0x0'));var rimraf=require(_0x41d7('0x1'));var zipdir=require(_0x41d7('0x2'));var jsonpatch=require(_0x41d7('0x3'));var rp=require(_0x41d7('0x4'));var moment=require(_0x41d7('0x5'));var BPromise=require(_0x41d7('0x6'));var Mustache=require(_0x41d7('0x7'));var util=require(_0x41d7('0x8'));var path=require(_0x41d7('0x9'));var sox=require('sox');var csv=require(_0x41d7('0xa'));var ejs=require(_0x41d7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41d7('0xc'));var squel=require('squel');var crypto=require(_0x41d7('0xd'));var jsforce=require(_0x41d7('0xe'));var deskjs=require(_0x41d7('0xf'));var toCsv=require(_0x41d7('0xa'));var querystring=require(_0x41d7('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x41d7('0x11'));var qs=require(_0x41d7('0x12'));var as=require(_0x41d7('0x13'));var hardwareService=require(_0x41d7('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x41d7('0x15'));var config=require(_0x41d7('0x16'));var licenseUtil=require(_0x41d7('0x17'));var db=require(_0x41d7('0x18'))['db'];var integrations=require(_0x41d7('0x19'));function respondWithStatusCode(_0x5b70c0,_0x4d2f88){_0x4d2f88=_0x4d2f88||0xcc;return function(_0x4cc578){if(_0x4cc578){return _0x5b70c0[_0x41d7('0x1a')](_0x4d2f88);}return _0x5b70c0[_0x41d7('0x1b')](_0x4d2f88)[_0x41d7('0x1c')]();};}function respondWithResult(_0x1674fb,_0x2139af){_0x2139af=_0x2139af||0xc8;return function(_0x309643){if(_0x309643){return _0x1674fb['status'](_0x2139af)[_0x41d7('0x1d')](_0x309643);}};}function respondWithFilteredResult(_0x3b4c3a,_0x543c63){return function(_0x31a04a){if(_0x31a04a){var _0x248a93=typeof _0x543c63[_0x41d7('0x1e')]===_0x41d7('0x1f')&&typeof _0x543c63[_0x41d7('0x20')]===_0x41d7('0x1f');var _0x160377=_0x31a04a[_0x41d7('0x21')];var _0x1c6dae=_0x248a93?0x0:_0x543c63[_0x41d7('0x1e')];var _0x477120=_0x248a93?_0x31a04a[_0x41d7('0x21')]:_0x543c63[_0x41d7('0x1e')]+_0x543c63['limit'];var _0x15bbd7;if(_0x477120>=_0x160377){_0x477120=_0x160377;_0x15bbd7=0xc8;}else{_0x15bbd7=0xce;}_0x3b4c3a[_0x41d7('0x1b')](_0x15bbd7);return _0x3b4c3a[_0x41d7('0x22')]('Content-Range',_0x1c6dae+'-'+_0x477120+'/'+_0x160377)['json'](_0x31a04a);}return null;};}function patchUpdates(_0x5ac0af){return function(_0x1ca1a4){try{jsonpatch[_0x41d7('0x23')](_0x1ca1a4,_0x5ac0af,!![]);}catch(_0x3baf97){return BPromise['reject'](_0x3baf97);}return _0x1ca1a4[_0x41d7('0x24')]();};}function saveUpdates(_0x4ac97d,_0x208423){return function(_0x35dd83){if(_0x35dd83){return _0x35dd83[_0x41d7('0x25')](_0x4ac97d)[_0x41d7('0x26')](function(_0x33599a){return _0x33599a;});}return null;};}function removeEntity(_0x3e1cc3,_0x3f924c){return function(_0x423e9e){if(_0x423e9e){return _0x423e9e[_0x41d7('0x27')]()['then'](function(){_0x3e1cc3['status'](0xcc)[_0x41d7('0x1c')]();});}};}function handleEntityNotFound(_0xe3f385,_0x980d54){return function(_0x1b73aa){if(!_0x1b73aa){_0xe3f385['sendStatus'](0x194);}return _0x1b73aa;};}function handleError(_0x75cb5,_0x594281){_0x594281=_0x594281||0x1f4;return function(_0x2ffcbd){logger[_0x41d7('0x28')](_0x2ffcbd[_0x41d7('0x29')]);if(_0x2ffcbd[_0x41d7('0x2a')]){delete _0x2ffcbd[_0x41d7('0x2a')];}_0x75cb5[_0x41d7('0x1b')](_0x594281)['send'](_0x2ffcbd);};}exports[_0x41d7('0x2b')]=function(_0x435870,_0xe4324e){var _0x41ef66={},_0x41bb42={},_0x397db1={'count':0x0,'rows':[]};var _0x3e54b8=_['map'](db[_0x41d7('0x2c')]['rawAttributes'],function(_0x5a465a){return{'name':_0x5a465a[_0x41d7('0x2d')],'type':_0x5a465a[_0x41d7('0x2e')][_0x41d7('0x2f')]};});_0x41bb42[_0x41d7('0x30')]=_[_0x41d7('0x31')](_0x3e54b8,_0x41d7('0x2a'));_0x41bb42[_0x41d7('0x32')]=_[_0x41d7('0x33')](_0x435870[_0x41d7('0x32')]);_0x41bb42[_0x41d7('0x34')]=_['intersection'](_0x41bb42[_0x41d7('0x30')],_0x41bb42['query']);_0x41ef66[_0x41d7('0x35')]=_['intersection'](_0x41bb42['model'],qs[_0x41d7('0x36')](_0x435870[_0x41d7('0x32')]['fields']));_0x41ef66[_0x41d7('0x35')]=_0x41ef66[_0x41d7('0x35')][_0x41d7('0x37')]?_0x41ef66[_0x41d7('0x35')]:_0x41bb42[_0x41d7('0x30')];if(!_0x435870[_0x41d7('0x32')][_0x41d7('0x38')](_0x41d7('0x39'))){_0x41ef66[_0x41d7('0x20')]=qs[_0x41d7('0x20')](_0x435870['query'][_0x41d7('0x20')]);_0x41ef66[_0x41d7('0x1e')]=qs['offset'](_0x435870[_0x41d7('0x32')]['offset']);}_0x41ef66['order']=qs[_0x41d7('0x3a')](_0x435870[_0x41d7('0x32')][_0x41d7('0x3a')]);_0x41ef66[_0x41d7('0x3b')]=qs['filters'](_[_0x41d7('0x3c')](_0x435870[_0x41d7('0x32')],_0x41bb42[_0x41d7('0x34')]),_0x3e54b8);if(_0x435870[_0x41d7('0x32')]['filter']){_0x41ef66[_0x41d7('0x3b')]=_[_0x41d7('0x3d')](_0x41ef66[_0x41d7('0x3b')],{'$or':_[_0x41d7('0x31')](_0x3e54b8,function(_0x5d82eb){if(_0x5d82eb['type']!==_0x41d7('0x3e')){var _0x22ae79={};_0x22ae79[_0x5d82eb[_0x41d7('0x2a')]]={'$like':'%'+_0x435870['query'][_0x41d7('0x3f')]+'%'};return _0x22ae79;}})});}_0x41ef66=_[_0x41d7('0x3d')]({},_0x41ef66,_0x435870[_0x41d7('0x40')]);var _0x561245={'where':_0x41ef66['where']};return db[_0x41d7('0x2c')]['count'](_0x561245)[_0x41d7('0x26')](function(_0x4443ac){_0x397db1[_0x41d7('0x21')]=_0x4443ac;if(_0x435870[_0x41d7('0x32')][_0x41d7('0x41')]){_0x41ef66[_0x41d7('0x42')]=[{'all':!![]}];}return db[_0x41d7('0x2c')][_0x41d7('0x43')](_0x41ef66);})[_0x41d7('0x26')](function(_0x449a8a){_0x397db1[_0x41d7('0x44')]=_0x449a8a;return _0x397db1;})[_0x41d7('0x26')](respondWithFilteredResult(_0xe4324e,_0x41ef66))[_0x41d7('0x45')](handleError(_0xe4324e,null));};exports['show']=function(_0x4f00a1,_0x5b3497){var _0x190c7f={'raw':![],'where':{'id':_0x4f00a1[_0x41d7('0x46')]['id']}},_0xb5b69b={};_0xb5b69b[_0x41d7('0x30')]=_[_0x41d7('0x33')](db['ZohoAccount'][_0x41d7('0x47')]);_0xb5b69b[_0x41d7('0x32')]=_[_0x41d7('0x33')](_0x4f00a1[_0x41d7('0x32')]);_0xb5b69b[_0x41d7('0x34')]=_[_0x41d7('0x48')](_0xb5b69b['model'],_0xb5b69b[_0x41d7('0x32')]);_0x190c7f[_0x41d7('0x35')]=_['intersection'](_0xb5b69b[_0x41d7('0x30')],qs['fields'](_0x4f00a1[_0x41d7('0x32')][_0x41d7('0x36')]));_0x190c7f[_0x41d7('0x35')]=_0x190c7f[_0x41d7('0x35')][_0x41d7('0x37')]?_0x190c7f['attributes']:_0xb5b69b['model'];if(_0x4f00a1[_0x41d7('0x32')][_0x41d7('0x41')]){_0x190c7f[_0x41d7('0x42')]=[{'all':!![]}];}_0x190c7f=_[_0x41d7('0x3d')]({},_0x190c7f,_0x4f00a1[_0x41d7('0x40')]);return db[_0x41d7('0x2c')]['find'](_0x190c7f)[_0x41d7('0x26')](handleEntityNotFound(_0x5b3497,null))[_0x41d7('0x26')](respondWithResult(_0x5b3497,null))[_0x41d7('0x45')](handleError(_0x5b3497,null));};exports[_0x41d7('0x49')]=function(_0x2e312b,_0x261c3f){return db[_0x41d7('0x2c')]['create'](_0x2e312b[_0x41d7('0x4a')],{})[_0x41d7('0x26')](respondWithResult(_0x261c3f,0xc9))[_0x41d7('0x45')](handleError(_0x261c3f,null));};exports[_0x41d7('0x25')]=function(_0x598852,_0x4a4aff){if(_0x598852[_0x41d7('0x4a')]['id']){delete _0x598852[_0x41d7('0x4a')]['id'];}return db[_0x41d7('0x2c')][_0x41d7('0x4b')]({'where':{'id':_0x598852['params']['id']}})[_0x41d7('0x26')](handleEntityNotFound(_0x4a4aff,null))[_0x41d7('0x26')](saveUpdates(_0x598852[_0x41d7('0x4a')],null))['then'](respondWithResult(_0x4a4aff,null))[_0x41d7('0x45')](handleError(_0x4a4aff,null));};exports[_0x41d7('0x27')]=function(_0xc63ed7,_0x5aec24){return db['ZohoAccount']['find']({'where':{'id':_0xc63ed7[_0x41d7('0x46')]['id']}})[_0x41d7('0x26')](handleEntityNotFound(_0x5aec24,null))['then'](removeEntity(_0x5aec24,null))[_0x41d7('0x45')](handleError(_0x5aec24,null));};exports[_0x41d7('0x4c')]=function(_0x5ca74d,_0x5899a7,_0x97e3a6){var _0x40b39a={};var _0x5949d0={};var _0x3fb2ae;var _0x1d48c2;return db['ZohoAccount'][_0x41d7('0x4d')]({'where':{'id':_0x5ca74d[_0x41d7('0x46')]['id']}})['then'](handleEntityNotFound(_0x5899a7,null))[_0x41d7('0x26')](function(_0x413868){if(_0x413868){_0x3fb2ae=_0x413868;_0x5949d0['model']=_[_0x41d7('0x33')](db['ZohoConfiguration'][_0x41d7('0x47')]);_0x5949d0['query']=_[_0x41d7('0x33')](_0x5ca74d[_0x41d7('0x32')]);_0x5949d0['filters']=_[_0x41d7('0x48')](_0x5949d0[_0x41d7('0x30')],_0x5949d0['query']);_0x40b39a[_0x41d7('0x35')]=_[_0x41d7('0x48')](_0x5949d0['model'],qs['fields'](_0x5ca74d[_0x41d7('0x32')]['fields']));_0x40b39a[_0x41d7('0x35')]=_0x40b39a[_0x41d7('0x35')]['length']?_0x40b39a[_0x41d7('0x35')]:_0x5949d0[_0x41d7('0x30')];_0x40b39a['order']=qs['sort'](_0x5ca74d[_0x41d7('0x32')][_0x41d7('0x3a')]);_0x40b39a[_0x41d7('0x3b')]=qs[_0x41d7('0x34')](_['pick'](_0x5ca74d['query'],_0x5949d0[_0x41d7('0x34')]));if(_0x5ca74d[_0x41d7('0x32')]['filter']){_0x40b39a[_0x41d7('0x3b')]=_[_0x41d7('0x3d')](_0x40b39a['where'],{'$or':_[_0x41d7('0x31')](_0x40b39a[_0x41d7('0x35')],function(_0x2530f2){var _0x45a5b2={};_0x45a5b2[_0x2530f2]={'$like':'%'+_0x5ca74d[_0x41d7('0x32')][_0x41d7('0x3f')]+'%'};return _0x45a5b2;})});}_0x40b39a=_[_0x41d7('0x3d')]({},_0x40b39a,_0x5ca74d['options']);return _0x3fb2ae[_0x41d7('0x4c')](_0x40b39a);}})['then'](function(_0x3fecb8){if(_0x3fecb8){_0x1d48c2=_0x3fecb8[_0x41d7('0x37')];if(!_0x5ca74d[_0x41d7('0x32')][_0x41d7('0x38')](_0x41d7('0x39'))){_0x40b39a[_0x41d7('0x20')]=qs[_0x41d7('0x20')](_0x5ca74d[_0x41d7('0x32')][_0x41d7('0x20')]);_0x40b39a[_0x41d7('0x1e')]=qs[_0x41d7('0x1e')](_0x5ca74d[_0x41d7('0x32')][_0x41d7('0x1e')]);}return _0x3fb2ae['getConfigurations'](_0x40b39a);}})[_0x41d7('0x26')](function(_0x6706db){if(_0x6706db){return _0x6706db?{'count':_0x1d48c2,'rows':_0x6706db}:null;}})['then'](respondWithResult(_0x5899a7,null))[_0x41d7('0x45')](handleError(_0x5899a7,null));};exports[_0x41d7('0x4e')]=function(_0x25d24a,_0x56118e,_0x433986){if(_0x25d24a[_0x41d7('0x4a')]['id']){delete _0x25d24a['body']['id'];}return db['ZohoAccount'][_0x41d7('0x4d')]({'where':{'id':_0x25d24a[_0x41d7('0x46')]['id']}})[_0x41d7('0x26')](handleEntityNotFound(_0x56118e,null))[_0x41d7('0x26')](function(_0x88cff3){if(_0x88cff3){_0x25d24a[_0x41d7('0x4a')]['AccountId']=_0x88cff3['id'];_0x25d24a[_0x41d7('0x4a')][_0x41d7('0x4f')]=integrations[_0x41d7('0x50')](_0x25d24a[_0x41d7('0x4a')]['channel'],_0x25d24a['body'][_0x41d7('0x2e')]);_0x25d24a[_0x41d7('0x4a')][_0x41d7('0x51')]=integrations['getDescriptions'](_0x25d24a[_0x41d7('0x4a')][_0x41d7('0x52')],_0x25d24a[_0x41d7('0x4a')][_0x41d7('0x2e')]);return db['ZohoConfiguration'][_0x41d7('0x49')](_0x25d24a[_0x41d7('0x4a')],{'include':[{'model':db[_0x41d7('0x53')],'as':_0x41d7('0x4f')},{'model':db[_0x41d7('0x53')],'as':'Descriptions'}]});}return null;})[_0x41d7('0x26')](respondWithResult(_0x56118e,null))['catch'](handleError(_0x56118e,null));};function getAccessToken(_0x249765){return new Promise(function(_0x1da5cc,_0x2168d1){var _0x53f174;switch(_0x249765['zone']){case'US':_0x53f174='https://accounts.zoho.com';break;case'AU':_0x53f174=_0x41d7('0x54');break;case'EU':_0x53f174='https://accounts.zoho.eu';break;case'IN':_0x53f174=_0x41d7('0x55');break;case'CN':_0x53f174=_0x41d7('0x56');break;default:_0x53f174=_0x41d7('0x57');break;}var _0x424cea={'method':'POST','uri':_0x53f174+'/oauth/v2/token','qs':{'refresh_token':_0x249765[_0x41d7('0x58')],'client_id':_0x249765['clientId'],'client_secret':_0x249765[_0x41d7('0x59')],'grant_type':_0x41d7('0x5a')},'json':!![]};return rp(_0x424cea)['then'](function(_0x54e8b7){if(_0x54e8b7[_0x41d7('0x5b')]){_0x1da5cc(_0x54e8b7[_0x41d7('0x5b')]);}else{_0x2168d1(_0x41d7('0x5c'));}})[_0x41d7('0x45')](function(_0x4b0a55){_0x2168d1(_0x4b0a55);});});}exports[_0x41d7('0x5d')]=function(_0x1fc02b,_0x49aba2,_0x4ec4a1){var _0x63aff,_0x4b1e84,_0xb439e4,_0x4174e8,_0x535169;return db[_0x41d7('0x2c')][_0x41d7('0x4d')]({'where':{'id':_0x1fc02b[_0x41d7('0x46')]['id']},'attributes':['id',_0x41d7('0x5e'),_0x41d7('0x5f'),'clientId','clientSecret',_0x41d7('0x60'),_0x41d7('0x61'),_0x41d7('0x58')]})[_0x41d7('0x26')](handleEntityNotFound(_0x49aba2,null))[_0x41d7('0x26')](function(_0xf824c){_0x535169=_0xf824c;_0x63aff=_0x535169[_0x41d7('0x5e')];_0x4b1e84=_0x63aff===_0x41d7('0x62')?'eu':_0x41d7('0x63');_0xb439e4=_0x535169[_0x41d7('0x60')];var _0x1e57aa=_0xb439e4[_0x41d7('0x64')](-0x1);if(_0x1e57aa==='/'||_0x1e57aa==='\x5c'||_0x1e57aa===':'){_0xb439e4=_0xb439e4['substring'](0x0,_0xb439e4[_0x41d7('0x65')](_0x1e57aa));}if(!_0x535169[_0x41d7('0x58')]){throw new Error(_0x41d7('0x66'));}return getAccessToken(_0x535169);})[_0x41d7('0x26')](function(_0x43aff2){if(_0x43aff2){return rp({'method':_0x41d7('0x67'),'uri':util['format'](_0x41d7('0x68'),_0x4b1e84),'qs':{'module':_0x41d7('0x69')},'headers':{'Authorization':_0x41d7('0x6a')+_0x43aff2},'json':!![]});}})[_0x41d7('0x26')](function(_0x32271b){if(_0x32271b){if(_0x32271b[_0x41d7('0x6b')]&&_0x32271b[_0x41d7('0x6b')][_0x41d7('0x28')]){throw new Error(_0x32271b[_0x41d7('0x6b')][_0x41d7('0x28')][_0x41d7('0x6c')]);}var _0x5d35a0=[];var _0x497af0=[];var _0x16fbfe=[_0x41d7('0x6d'),_0x41d7('0x6e'),_0x41d7('0x6f'),_0x41d7('0x70'),_0x41d7('0x71'),_0x41d7('0x72'),_0x41d7('0x73'),_0x41d7('0x74')];_0x497af0=_[_0x41d7('0x75')](_0x32271b['fields'],function(_0x2f8111){return _0x16fbfe[_0x41d7('0x76')](_0x2f8111['api_name']);});for(var _0x3d307c=0x0;_0x3d307c<_0x497af0[_0x41d7('0x37')];_0x3d307c++){if(_0x497af0[_0x3d307c][_0x41d7('0x77')]===![]){_0x5d35a0[_0x41d7('0x78')]({'id':_0x497af0[_0x3d307c]['id'],'name':_0x497af0[_0x3d307c][_0x41d7('0x79')],'custom':_0x497af0[_0x3d307c]['custom_field'],'options':_0x497af0[_0x3d307c][_0x41d7('0x7a')]===_0x41d7('0x7b')&&_0x497af0[_0x3d307c][_0x41d7('0x7c')][_0x41d7('0x37')]>-0x1?_[_0x41d7('0x31')](_0x497af0[_0x3d307c][_0x41d7('0x7c')],function(_0x3cd1e8){return{'name':_0x3cd1e8,'value':_0x3cd1e8};}):[]});}}return{'count':_0x5d35a0[_0x41d7('0x37')],'rows':_0x5d35a0};}else{return{'count':0x0,'rows':[]};}})[_0x41d7('0x26')](respondWithResult(_0x49aba2,null))[_0x41d7('0x45')](function(_0x3506ca){var _0x1058a7=_0x1fc02b['query'][_0x41d7('0x7d')]?0x1f4:_0x3506ca[_0x41d7('0x7e')]||0x1f4;logger[_0x41d7('0x28')](_0x41d7('0x7f'),_0x41d7('0x5d'),_0x1058a7,JSON[_0x41d7('0x80')](_0x3506ca));delete _0x3506ca[_0x41d7('0x2a')];if(_0x1058a7===0x191){_0x1058a7=0x190;}_0x49aba2[_0x41d7('0x1b')](_0x1058a7)['send'](_0x1fc02b[_0x41d7('0x32')][_0x41d7('0x7d')]?{'message':_0x41d7('0x81'),'statusCode':_0x3506ca[_0x41d7('0x7e')]}:_0x3506ca);});}; \ No newline at end of file +var _0xcc8e=['rows','show','params','include','options','catch','create','body','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','refreshToken','slice','substring','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','api_name','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','ZohoAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll'];(function(_0x574b41,_0x272226){var _0x2ee6d8=function(_0x209cf8){while(--_0x209cf8){_0x574b41['push'](_0x574b41['shift']());}};_0x2ee6d8(++_0x272226);}(_0xcc8e,0x1c9));var _0xecc8=function(_0x3a3d3e,_0x41452a){_0x3a3d3e=_0x3a3d3e-0x0;var _0x2731f0=_0xcc8e[_0x3a3d3e];return _0x2731f0;};'use strict';var emlformat=require(_0xecc8('0x0'));var rimraf=require(_0xecc8('0x1'));var zipdir=require(_0xecc8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecc8('0x3'));var moment=require(_0xecc8('0x4'));var BPromise=require(_0xecc8('0x5'));var Mustache=require(_0xecc8('0x6'));var util=require(_0xecc8('0x7'));var path=require(_0xecc8('0x8'));var sox=require('sox');var csv=require(_0xecc8('0x9'));var ejs=require(_0xecc8('0xa'));var fs=require('fs');var fs_extra=require(_0xecc8('0xb'));var _=require(_0xecc8('0xc'));var squel=require(_0xecc8('0xd'));var crypto=require('crypto');var jsforce=require(_0xecc8('0xe'));var deskjs=require(_0xecc8('0xf'));var toCsv=require(_0xecc8('0x9'));var querystring=require('querystring');var Papa=require(_0xecc8('0x10'));var Redis=require(_0xecc8('0x11'));var authService=require(_0xecc8('0x12'));var qs=require(_0xecc8('0x13'));var as=require(_0xecc8('0x14'));var hardwareService=require(_0xecc8('0x15'));var logger=require(_0xecc8('0x16'))('api');var utils=require(_0xecc8('0x17'));var config=require(_0xecc8('0x18'));var licenseUtil=require(_0xecc8('0x19'));var db=require(_0xecc8('0x1a'))['db'];var integrations=require(_0xecc8('0x1b'));function respondWithStatusCode(_0x2e0f0e,_0x135064){_0x135064=_0x135064||0xcc;return function(_0x2a7de1){if(_0x2a7de1){return _0x2e0f0e[_0xecc8('0x1c')](_0x135064);}return _0x2e0f0e[_0xecc8('0x1d')](_0x135064)[_0xecc8('0x1e')]();};}function respondWithResult(_0x59b628,_0x5605a8){_0x5605a8=_0x5605a8||0xc8;return function(_0x51cc40){if(_0x51cc40){return _0x59b628[_0xecc8('0x1d')](_0x5605a8)[_0xecc8('0x1f')](_0x51cc40);}};}function respondWithFilteredResult(_0x52fb1d,_0x519f72){return function(_0xe1dcd3){if(_0xe1dcd3){var _0x34fe88=typeof _0x519f72[_0xecc8('0x20')]===_0xecc8('0x21')&&typeof _0x519f72[_0xecc8('0x22')]===_0xecc8('0x21');var _0x112d3b=_0xe1dcd3[_0xecc8('0x23')];var _0x3f7fc4=_0x34fe88?0x0:_0x519f72[_0xecc8('0x20')];var _0x1398c6=_0x34fe88?_0xe1dcd3[_0xecc8('0x23')]:_0x519f72['offset']+_0x519f72['limit'];var _0x4db437;if(_0x1398c6>=_0x112d3b){_0x1398c6=_0x112d3b;_0x4db437=0xc8;}else{_0x4db437=0xce;}_0x52fb1d[_0xecc8('0x1d')](_0x4db437);return _0x52fb1d[_0xecc8('0x24')](_0xecc8('0x25'),_0x3f7fc4+'-'+_0x1398c6+'/'+_0x112d3b)[_0xecc8('0x1f')](_0xe1dcd3);}return null;};}function patchUpdates(_0x1fd8ba){return function(_0x45c4a6){try{jsonpatch[_0xecc8('0x26')](_0x45c4a6,_0x1fd8ba,!![]);}catch(_0x331160){return BPromise[_0xecc8('0x27')](_0x331160);}return _0x45c4a6[_0xecc8('0x28')]();};}function saveUpdates(_0x1e36c6,_0x33e155){return function(_0x4df6b7){if(_0x4df6b7){return _0x4df6b7[_0xecc8('0x29')](_0x1e36c6)[_0xecc8('0x2a')](function(_0xb141e2){return _0xb141e2;});}return null;};}function removeEntity(_0x513c17,_0x5cbb99){return function(_0x41013c){if(_0x41013c){return _0x41013c[_0xecc8('0x2b')]()['then'](function(){_0x513c17[_0xecc8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32edd0,_0x422e6e){return function(_0x19f1a1){if(!_0x19f1a1){_0x32edd0[_0xecc8('0x1c')](0x194);}return _0x19f1a1;};}function handleError(_0x33dde2,_0x1f4524){_0x1f4524=_0x1f4524||0x1f4;return function(_0x307d35){logger['error'](_0x307d35[_0xecc8('0x2c')]);if(_0x307d35[_0xecc8('0x2d')]){delete _0x307d35[_0xecc8('0x2d')];}_0x33dde2[_0xecc8('0x1d')](_0x1f4524)[_0xecc8('0x2e')](_0x307d35);};}exports['index']=function(_0x271184,_0x131b36){var _0x560627={},_0x59b9f2={},_0x7d90b4={'count':0x0,'rows':[]};var _0x484d37=_[_0xecc8('0x2f')](db[_0xecc8('0x30')][_0xecc8('0x31')],function(_0x5a71be){return{'name':_0x5a71be['fieldName'],'type':_0x5a71be[_0xecc8('0x32')][_0xecc8('0x33')]};});_0x59b9f2[_0xecc8('0x34')]=_[_0xecc8('0x2f')](_0x484d37,_0xecc8('0x2d'));_0x59b9f2[_0xecc8('0x35')]=_[_0xecc8('0x36')](_0x271184[_0xecc8('0x35')]);_0x59b9f2[_0xecc8('0x37')]=_[_0xecc8('0x38')](_0x59b9f2[_0xecc8('0x34')],_0x59b9f2['query']);_0x560627[_0xecc8('0x39')]=_[_0xecc8('0x38')](_0x59b9f2['model'],qs[_0xecc8('0x3a')](_0x271184[_0xecc8('0x35')][_0xecc8('0x3a')]));_0x560627[_0xecc8('0x39')]=_0x560627[_0xecc8('0x39')][_0xecc8('0x3b')]?_0x560627[_0xecc8('0x39')]:_0x59b9f2[_0xecc8('0x34')];if(!_0x271184['query'][_0xecc8('0x3c')](_0xecc8('0x3d'))){_0x560627[_0xecc8('0x22')]=qs[_0xecc8('0x22')](_0x271184[_0xecc8('0x35')][_0xecc8('0x22')]);_0x560627[_0xecc8('0x20')]=qs['offset'](_0x271184['query'][_0xecc8('0x20')]);}_0x560627[_0xecc8('0x3e')]=qs[_0xecc8('0x3f')](_0x271184[_0xecc8('0x35')]['sort']);_0x560627[_0xecc8('0x40')]=qs[_0xecc8('0x37')](_[_0xecc8('0x41')](_0x271184[_0xecc8('0x35')],_0x59b9f2['filters']),_0x484d37);if(_0x271184['query'][_0xecc8('0x42')]){_0x560627['where']=_[_0xecc8('0x43')](_0x560627[_0xecc8('0x40')],{'$or':_[_0xecc8('0x2f')](_0x484d37,function(_0x5417dd){if(_0x5417dd[_0xecc8('0x32')]!==_0xecc8('0x44')){var _0x47dc13={};_0x47dc13[_0x5417dd[_0xecc8('0x2d')]]={'$like':'%'+_0x271184[_0xecc8('0x35')][_0xecc8('0x42')]+'%'};return _0x47dc13;}})});}_0x560627=_[_0xecc8('0x43')]({},_0x560627,_0x271184['options']);var _0x19d4db={'where':_0x560627['where']};return db[_0xecc8('0x30')][_0xecc8('0x23')](_0x19d4db)[_0xecc8('0x2a')](function(_0x296b9b){_0x7d90b4[_0xecc8('0x23')]=_0x296b9b;if(_0x271184[_0xecc8('0x35')][_0xecc8('0x45')]){_0x560627['include']=[{'all':!![]}];}return db[_0xecc8('0x30')][_0xecc8('0x46')](_0x560627);})[_0xecc8('0x2a')](function(_0x1e9725){_0x7d90b4[_0xecc8('0x47')]=_0x1e9725;return _0x7d90b4;})['then'](respondWithFilteredResult(_0x131b36,_0x560627))['catch'](handleError(_0x131b36,null));};exports[_0xecc8('0x48')]=function(_0x5558ae,_0x527692){var _0x40f25e={'raw':![],'where':{'id':_0x5558ae[_0xecc8('0x49')]['id']}},_0x24173d={};_0x24173d[_0xecc8('0x34')]=_[_0xecc8('0x36')](db[_0xecc8('0x30')]['rawAttributes']);_0x24173d['query']=_[_0xecc8('0x36')](_0x5558ae['query']);_0x24173d[_0xecc8('0x37')]=_[_0xecc8('0x38')](_0x24173d['model'],_0x24173d[_0xecc8('0x35')]);_0x40f25e[_0xecc8('0x39')]=_[_0xecc8('0x38')](_0x24173d[_0xecc8('0x34')],qs[_0xecc8('0x3a')](_0x5558ae[_0xecc8('0x35')][_0xecc8('0x3a')]));_0x40f25e['attributes']=_0x40f25e[_0xecc8('0x39')][_0xecc8('0x3b')]?_0x40f25e[_0xecc8('0x39')]:_0x24173d[_0xecc8('0x34')];if(_0x5558ae['query']['includeAll']){_0x40f25e[_0xecc8('0x4a')]=[{'all':!![]}];}_0x40f25e=_[_0xecc8('0x43')]({},_0x40f25e,_0x5558ae[_0xecc8('0x4b')]);return db[_0xecc8('0x30')]['find'](_0x40f25e)[_0xecc8('0x2a')](handleEntityNotFound(_0x527692,null))[_0xecc8('0x2a')](respondWithResult(_0x527692,null))[_0xecc8('0x4c')](handleError(_0x527692,null));};exports['create']=function(_0x15a122,_0x2df136){return db[_0xecc8('0x30')][_0xecc8('0x4d')](_0x15a122['body'],{})['then'](respondWithResult(_0x2df136,0xc9))['catch'](handleError(_0x2df136,null));};exports['update']=function(_0x4deaf1,_0x5520e5){if(_0x4deaf1[_0xecc8('0x4e')]['id']){delete _0x4deaf1[_0xecc8('0x4e')]['id'];}return db[_0xecc8('0x30')]['find']({'where':{'id':_0x4deaf1['params']['id']}})['then'](handleEntityNotFound(_0x5520e5,null))[_0xecc8('0x2a')](saveUpdates(_0x4deaf1[_0xecc8('0x4e')],null))['then'](respondWithResult(_0x5520e5,null))['catch'](handleError(_0x5520e5,null));};exports[_0xecc8('0x2b')]=function(_0x510516,_0x52d84c){return db[_0xecc8('0x30')]['find']({'where':{'id':_0x510516[_0xecc8('0x49')]['id']}})[_0xecc8('0x2a')](handleEntityNotFound(_0x52d84c,null))['then'](removeEntity(_0x52d84c,null))[_0xecc8('0x4c')](handleError(_0x52d84c,null));};exports[_0xecc8('0x4f')]=function(_0x3698c1,_0x5d4bd9,_0x2fd113){var _0x44266f={};var _0x5c60c0={};var _0x4c014e;var _0xc473e1;return db['ZohoAccount']['findOne']({'where':{'id':_0x3698c1[_0xecc8('0x49')]['id']}})[_0xecc8('0x2a')](handleEntityNotFound(_0x5d4bd9,null))[_0xecc8('0x2a')](function(_0x160cba){if(_0x160cba){_0x4c014e=_0x160cba;_0x5c60c0[_0xecc8('0x34')]=_[_0xecc8('0x36')](db[_0xecc8('0x50')][_0xecc8('0x31')]);_0x5c60c0['query']=_['keys'](_0x3698c1[_0xecc8('0x35')]);_0x5c60c0[_0xecc8('0x37')]=_[_0xecc8('0x38')](_0x5c60c0[_0xecc8('0x34')],_0x5c60c0[_0xecc8('0x35')]);_0x44266f[_0xecc8('0x39')]=_['intersection'](_0x5c60c0[_0xecc8('0x34')],qs['fields'](_0x3698c1[_0xecc8('0x35')][_0xecc8('0x3a')]));_0x44266f[_0xecc8('0x39')]=_0x44266f[_0xecc8('0x39')][_0xecc8('0x3b')]?_0x44266f[_0xecc8('0x39')]:_0x5c60c0[_0xecc8('0x34')];_0x44266f[_0xecc8('0x3e')]=qs['sort'](_0x3698c1['query'][_0xecc8('0x3f')]);_0x44266f[_0xecc8('0x40')]=qs[_0xecc8('0x37')](_[_0xecc8('0x41')](_0x3698c1[_0xecc8('0x35')],_0x5c60c0[_0xecc8('0x37')]));if(_0x3698c1['query'][_0xecc8('0x42')]){_0x44266f[_0xecc8('0x40')]=_[_0xecc8('0x43')](_0x44266f[_0xecc8('0x40')],{'$or':_[_0xecc8('0x2f')](_0x44266f[_0xecc8('0x39')],function(_0x5ddacf){var _0x940bb={};_0x940bb[_0x5ddacf]={'$like':'%'+_0x3698c1[_0xecc8('0x35')][_0xecc8('0x42')]+'%'};return _0x940bb;})});}_0x44266f=_[_0xecc8('0x43')]({},_0x44266f,_0x3698c1[_0xecc8('0x4b')]);return _0x4c014e[_0xecc8('0x4f')](_0x44266f);}})[_0xecc8('0x2a')](function(_0x559354){if(_0x559354){_0xc473e1=_0x559354[_0xecc8('0x3b')];if(!_0x3698c1['query'][_0xecc8('0x3c')]('nolimit')){_0x44266f['limit']=qs[_0xecc8('0x22')](_0x3698c1[_0xecc8('0x35')][_0xecc8('0x22')]);_0x44266f['offset']=qs['offset'](_0x3698c1['query'][_0xecc8('0x20')]);}return _0x4c014e[_0xecc8('0x4f')](_0x44266f);}})['then'](function(_0x424934){if(_0x424934){return _0x424934?{'count':_0xc473e1,'rows':_0x424934}:null;}})['then'](respondWithResult(_0x5d4bd9,null))[_0xecc8('0x4c')](handleError(_0x5d4bd9,null));};exports[_0xecc8('0x51')]=function(_0x2b3794,_0x2afdb0,_0x561c0a){if(_0x2b3794[_0xecc8('0x4e')]['id']){delete _0x2b3794[_0xecc8('0x4e')]['id'];}return db[_0xecc8('0x30')][_0xecc8('0x52')]({'where':{'id':_0x2b3794[_0xecc8('0x49')]['id']}})[_0xecc8('0x2a')](handleEntityNotFound(_0x2afdb0,null))[_0xecc8('0x2a')](function(_0xd2e2e7){if(_0xd2e2e7){_0x2b3794[_0xecc8('0x4e')][_0xecc8('0x53')]=_0xd2e2e7['id'];_0x2b3794['body'][_0xecc8('0x54')]=integrations[_0xecc8('0x55')](_0x2b3794[_0xecc8('0x4e')][_0xecc8('0x56')],_0x2b3794[_0xecc8('0x4e')]['type']);_0x2b3794[_0xecc8('0x4e')][_0xecc8('0x57')]=integrations[_0xecc8('0x58')](_0x2b3794[_0xecc8('0x4e')]['channel'],_0x2b3794[_0xecc8('0x4e')][_0xecc8('0x32')]);return db['ZohoConfiguration'][_0xecc8('0x4d')](_0x2b3794['body'],{'include':[{'model':db[_0xecc8('0x59')],'as':_0xecc8('0x54')},{'model':db[_0xecc8('0x59')],'as':_0xecc8('0x57')}]});}return null;})[_0xecc8('0x2a')](respondWithResult(_0x2afdb0,null))[_0xecc8('0x4c')](handleError(_0x2afdb0,null));};function getAccessToken(_0x52c3a3){return new Promise(function(_0x35de56,_0x175674){var _0x45dcbf;switch(_0x52c3a3[_0xecc8('0x5a')]){case'US':_0x45dcbf=_0xecc8('0x5b');break;case'AU':_0x45dcbf=_0xecc8('0x5c');break;case'EU':_0x45dcbf=_0xecc8('0x5d');break;case'IN':_0x45dcbf=_0xecc8('0x5e');break;case'CN':_0x45dcbf=_0xecc8('0x5f');break;default:_0x45dcbf=_0xecc8('0x5d');break;}var _0x140510={'method':_0xecc8('0x60'),'uri':_0x45dcbf+_0xecc8('0x61'),'qs':{'refresh_token':_0x52c3a3['refreshToken'],'client_id':_0x52c3a3[_0xecc8('0x62')],'client_secret':_0x52c3a3[_0xecc8('0x63')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x140510)[_0xecc8('0x2a')](function(_0x15a1b6){if(_0x15a1b6['access_token']){_0x35de56(_0x15a1b6['access_token']);}else{_0x175674(_0xecc8('0x64'));}})[_0xecc8('0x4c')](function(_0x362479){_0x175674(_0x362479);});});}exports[_0xecc8('0x65')]=function(_0x348eb1,_0x36384d,_0x4d2333){var _0x25fd0a,_0x15fd6f,_0x3f962f,_0x4cc497,_0x493e17;return db[_0xecc8('0x30')][_0xecc8('0x52')]({'where':{'id':_0x348eb1[_0xecc8('0x49')]['id']},'attributes':['id',_0xecc8('0x66'),_0xecc8('0x5a'),_0xecc8('0x62'),_0xecc8('0x63'),_0xecc8('0x67'),'code',_0xecc8('0x68')]})['then'](handleEntityNotFound(_0x36384d,null))[_0xecc8('0x2a')](function(_0x54ebb3){_0x493e17=_0x54ebb3;_0x25fd0a=_0x493e17[_0xecc8('0x66')];_0x15fd6f=_0x25fd0a==='zoho.eu'?'eu':'com';_0x3f962f=_0x493e17['serverUrl'];var _0x23fe40=_0x3f962f[_0xecc8('0x69')](-0x1);if(_0x23fe40==='/'||_0x23fe40==='\x5c'||_0x23fe40===':'){_0x3f962f=_0x3f962f[_0xecc8('0x6a')](0x0,_0x3f962f['lastIndexOf'](_0x23fe40));}if(!_0x493e17[_0xecc8('0x68')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x493e17);})['then'](function(_0x374b45){if(_0x374b45){return rp({'method':_0xecc8('0x6b'),'uri':util[_0xecc8('0x6c')](_0xecc8('0x6d'),_0x15fd6f),'qs':{'module':_0xecc8('0x6e')},'headers':{'Authorization':_0xecc8('0x6f')+_0x374b45},'json':!![]});}})['then'](function(_0x3e066e){if(_0x3e066e){if(_0x3e066e[_0xecc8('0x70')]&&_0x3e066e['response'][_0xecc8('0x71')]){throw new Error(_0x3e066e[_0xecc8('0x70')]['error'][_0xecc8('0x72')]);}var _0x2fdd2e=[];var _0x3682ec=[];var _0xdae25d=[_0xecc8('0x73'),'Subject',_0xecc8('0x74'),_0xecc8('0x75'),_0xecc8('0x76'),_0xecc8('0x77'),'Call_Start_Time',_0xecc8('0x78')];_0x3682ec=_[_0xecc8('0x79')](_0x3e066e['fields'],function(_0x309616){return _0xdae25d['includes'](_0x309616[_0xecc8('0x7a')]);});for(var _0x382f43=0x0;_0x382f43<_0x3682ec[_0xecc8('0x3b')];_0x382f43++){if(_0x3682ec[_0x382f43]['system_mandatory']===![]){_0x2fdd2e[_0xecc8('0x7b')]({'id':_0x3682ec[_0x382f43]['id'],'name':_0x3682ec[_0x382f43][_0xecc8('0x7c')],'custom':_0x3682ec[_0x382f43][_0xecc8('0x7d')],'options':_0x3682ec[_0x382f43]['data_type']===_0xecc8('0x7e')&&_0x3682ec[_0x382f43][_0xecc8('0x7f')][_0xecc8('0x3b')]>-0x1?_[_0xecc8('0x2f')](_0x3682ec[_0x382f43][_0xecc8('0x7f')],function(_0x2ec98a){return{'name':_0x2ec98a,'value':_0x2ec98a};}):[]});}}return{'count':_0x2fdd2e[_0xecc8('0x3b')],'rows':_0x2fdd2e};}else{return{'count':0x0,'rows':[]};}})[_0xecc8('0x2a')](respondWithResult(_0x36384d,null))[_0xecc8('0x4c')](function(_0xc2e84){var _0x39e594=_0x348eb1[_0xecc8('0x35')][_0xecc8('0x80')]?0x1f4:_0xc2e84[_0xecc8('0x81')]||0x1f4;logger[_0xecc8('0x71')](_0xecc8('0x82'),_0xecc8('0x65'),_0x39e594,JSON['stringify'](_0xc2e84));delete _0xc2e84[_0xecc8('0x2d')];if(_0x39e594===0x191){_0x39e594=0x190;}_0x36384d[_0xecc8('0x1d')](_0x39e594)[_0xecc8('0x2e')](_0x348eb1[_0xecc8('0x35')][_0xecc8('0x80')]?{'message':_0xecc8('0x83'),'statusCode':_0xc2e84[_0xecc8('0x81')]}:_0xc2e84);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 7278daf..727dc23 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 _0x96be=['substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','application/x-www-form-urlencoded','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','clientId','clientSecret','host','serverUrl','slice'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x96be,0x127));var _0xe96b=function(_0x4687d4,_0x1c74aa){_0x4687d4=_0x4687d4-0x0;var _0x267670=_0x96be[_0x4687d4];return _0x267670;};'use strict';var _=require(_0xe96b('0x0'));var util=require(_0xe96b('0x1'));var logger=require(_0xe96b('0x2'))(_0xe96b('0x3'));var moment=require('moment');var BPromise=require(_0xe96b('0x4'));var rp=require(_0xe96b('0x5'));var fs=require('fs');var path=require(_0xe96b('0x6'));var rimraf=require(_0xe96b('0x7'));var config=require(_0xe96b('0x8'));var attributes=require(_0xe96b('0x9'));var integrations=require(_0xe96b('0xa'));module['exports']=function(_0x41cb9d,_0x290f59){return _0x41cb9d[_0xe96b('0xb')](_0xe96b('0xc'),attributes,{'tableName':_0xe96b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5eacae,_0x434799,_0x5dd01a){if(_0x5eacae[_0xe96b('0xe')]('zone')||_0x5eacae[_0xe96b('0xe')]('serverUrl')||_0x5eacae[_0xe96b('0xe')](_0xe96b('0xf'))||_0x5eacae[_0xe96b('0xe')](_0xe96b('0x10'))||_0x5eacae[_0xe96b('0xe')]('code')||_0x5eacae['changed'](_0xe96b('0x11'))){var _0x2b07ec,_0x4855a0;_0x2b07ec=_0x5eacae[_0xe96b('0x12')];var _0x358697=_0x2b07ec[_0xe96b('0x13')](-0x1);if(_0x358697==='/'||_0x358697==='\x5c'||_0x358697===':'){_0x2b07ec=_0x2b07ec[_0xe96b('0x14')](0x0,_0x2b07ec[_0xe96b('0x15')](_0x358697));}switch(_0x5eacae[_0xe96b('0x16')]){case'US':_0x4855a0=_0xe96b('0x17');break;case'AU':_0x4855a0=_0xe96b('0x18');break;case'IN':_0x4855a0=_0xe96b('0x19');break;case'CN':_0x4855a0=_0xe96b('0x1a');break;default:_0x4855a0=_0xe96b('0x1b');break;}var _0x540652={'method':_0xe96b('0x1c'),'uri':_0x4855a0+_0xe96b('0x1d'),'form':{'grant_type':_0xe96b('0x1e'),'client_id':_0x5eacae['clientId'],'client_secret':_0x5eacae[_0xe96b('0x10')],'redirect_uri':_0x5eacae[_0xe96b('0x12')],'code':_0x5eacae[_0xe96b('0x1f')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x540652)[_0xe96b('0x20')](function(_0x54e061){var _0x429ded=JSON[_0xe96b('0x21')](_0x54e061);if(_0x429ded[_0xe96b('0x22')]){_0x5eacae[_0xe96b('0x23')]=_0x429ded[_0xe96b('0x22')];logger[_0xe96b('0x24')](util[_0xe96b('0x25')](_0xe96b('0x26'),_0x5eacae[_0xe96b('0x27')],_0x5eacae['id']));}else{logger[_0xe96b('0x28')](util[_0xe96b('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5eacae[_0xe96b('0x27')],_0x5eacae['id']),util[_0xe96b('0x29')](_0x429ded,{'showHidden':![],'depth':null}));}return _0x5dd01a(null,_0x434799);})[_0xe96b('0x2a')](function(_0x8ba80d){logger['error'](util[_0xe96b('0x25')](_0xe96b('0x2b'),_0x5eacae[_0xe96b('0x27')],_0x5eacae['id']),util[_0xe96b('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x5dd01a(_0x8ba80d);});}else{return _0x5dd01a(null,_0x434799);}},'beforeUpdate':function(_0x55c951,_0x34fc93,_0x5f0a6c){if(_0x55c951[_0xe96b('0xe')](_0xe96b('0x16'))||_0x55c951[_0xe96b('0xe')](_0xe96b('0x12'))||_0x55c951[_0xe96b('0xe')]('clientId')||_0x55c951[_0xe96b('0xe')](_0xe96b('0x10'))||_0x55c951[_0xe96b('0xe')](_0xe96b('0x1f'))||_0x55c951['changed'](_0xe96b('0x11'))){var _0x1a4f5c,_0x5e6dbc;_0x1a4f5c=_0x55c951[_0xe96b('0x12')];var _0x611846=_0x1a4f5c[_0xe96b('0x13')](-0x1);if(_0x611846==='/'||_0x611846==='\x5c'||_0x611846===':'){_0x1a4f5c=_0x1a4f5c[_0xe96b('0x14')](0x0,_0x1a4f5c[_0xe96b('0x15')](_0x611846));}switch(_0x55c951[_0xe96b('0x16')]){case'US':_0x5e6dbc='https://accounts.zoho.com';break;case'AU':_0x5e6dbc='https://accounts.zoho.com.au';break;case'IN':_0x5e6dbc='https://accounts.zoho.in';break;case'CN':_0x5e6dbc='https://accounts.zoho.com.cn';break;default:_0x5e6dbc=_0xe96b('0x1b');break;}var _0x2a28e6={'method':_0xe96b('0x1c'),'uri':_0x5e6dbc+_0xe96b('0x1d'),'form':{'grant_type':_0xe96b('0x1e'),'client_id':_0x55c951[_0xe96b('0xf')],'client_secret':_0x55c951[_0xe96b('0x10')],'redirect_uri':_0x55c951[_0xe96b('0x12')],'code':_0x55c951[_0xe96b('0x1f')]},'headers':{'Content-Type':_0xe96b('0x2c')}};return rp(_0x2a28e6)[_0xe96b('0x20')](function(_0x322139){var _0x5c9c07=JSON[_0xe96b('0x21')](_0x322139);if(_0x5c9c07[_0xe96b('0x22')]){_0x55c951[_0xe96b('0x23')]=_0x5c9c07['refresh_token'];logger[_0xe96b('0x24')](util[_0xe96b('0x25')](_0xe96b('0x26'),_0x55c951[_0xe96b('0x27')],_0x55c951['id']));}else{logger[_0xe96b('0x28')](util[_0xe96b('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x55c951[_0xe96b('0x27')],_0x55c951['id']),util[_0xe96b('0x29')](_0x5c9c07,{'showHidden':![],'depth':null}));}return _0x5f0a6c(null,_0x34fc93);})['catch'](function(_0x1c5d00){logger['error'](util[_0xe96b('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x55c951[_0xe96b('0x27')],_0x55c951['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5f0a6c(_0x1c5d00);});}else{return _0x5f0a6c(null,_0x34fc93);}}}});}; \ No newline at end of file +var _0x5f91=['https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','lastIndexOf','POST','parse','refreshToken','catch','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','changed','zone','serverUrl','clientSecret','code','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x2af276,_0xb15ec5){var _0x4c586e=function(_0x681843){while(--_0x681843){_0x2af276['push'](_0x2af276['shift']());}};_0x4c586e(++_0xb15ec5);}(_0x5f91,0xbb));var _0x15f9=function(_0x4c53af,_0x1d7aea){_0x4c53af=_0x4c53af-0x0;var _0x516275=_0x5f91[_0x4c53af];return _0x516275;};'use strict';var _=require(_0x15f9('0x0'));var util=require('util');var logger=require(_0x15f9('0x1'))(_0x15f9('0x2'));var moment=require(_0x15f9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15f9('0x4'));var rimraf=require(_0x15f9('0x5'));var config=require(_0x15f9('0x6'));var attributes=require(_0x15f9('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x15f9('0x8')]=function(_0x30f35d,_0xe06f73){return _0x30f35d[_0x15f9('0x9')](_0x15f9('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5717dd,_0x44f9c7,_0x317275){if(_0x5717dd[_0x15f9('0xb')](_0x15f9('0xc'))||_0x5717dd['changed'](_0x15f9('0xd'))||_0x5717dd[_0x15f9('0xb')]('clientId')||_0x5717dd[_0x15f9('0xb')](_0x15f9('0xe'))||_0x5717dd['changed'](_0x15f9('0xf'))||_0x5717dd[_0x15f9('0xb')](_0x15f9('0x10'))){var _0x8ca1b2,_0x1e6f03;_0x8ca1b2=_0x5717dd[_0x15f9('0xd')];var _0x38245f=_0x8ca1b2[_0x15f9('0x11')](-0x1);if(_0x38245f==='/'||_0x38245f==='\x5c'||_0x38245f===':'){_0x8ca1b2=_0x8ca1b2[_0x15f9('0x12')](0x0,_0x8ca1b2['lastIndexOf'](_0x38245f));}switch(_0x5717dd['zone']){case'US':_0x1e6f03=_0x15f9('0x13');break;case'AU':_0x1e6f03=_0x15f9('0x14');break;case'IN':_0x1e6f03=_0x15f9('0x15');break;case'CN':_0x1e6f03=_0x15f9('0x16');break;default:_0x1e6f03=_0x15f9('0x17');break;}var _0x520bbe={'method':'POST','uri':_0x1e6f03+_0x15f9('0x18'),'form':{'grant_type':_0x15f9('0x19'),'client_id':_0x5717dd[_0x15f9('0x1a')],'client_secret':_0x5717dd[_0x15f9('0xe')],'redirect_uri':_0x5717dd[_0x15f9('0xd')],'code':_0x5717dd[_0x15f9('0xf')]},'headers':{'Content-Type':_0x15f9('0x1b')}};return rp(_0x520bbe)[_0x15f9('0x1c')](function(_0x1cfcfd){var _0x774f0f=JSON['parse'](_0x1cfcfd);if(_0x774f0f[_0x15f9('0x1d')]){_0x5717dd['refreshToken']=_0x774f0f['refresh_token'];logger[_0x15f9('0x1e')](util[_0x15f9('0x1f')](_0x15f9('0x20'),_0x5717dd[_0x15f9('0x21')],_0x5717dd['id']));}else{logger[_0x15f9('0x22')](util[_0x15f9('0x1f')](_0x15f9('0x23'),_0x5717dd[_0x15f9('0x21')],_0x5717dd['id']),util[_0x15f9('0x24')](_0x774f0f,{'showHidden':![],'depth':null}));}return _0x317275(null,_0x44f9c7);})['catch'](function(_0x55a40e){logger['error'](util[_0x15f9('0x1f')](_0x15f9('0x23'),_0x5717dd[_0x15f9('0x21')],_0x5717dd['id']),util[_0x15f9('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x317275(_0x55a40e);});}else{return _0x317275(null,_0x44f9c7);}},'beforeUpdate':function(_0x58739e,_0x54a79c,_0x548918){if(_0x58739e[_0x15f9('0xb')](_0x15f9('0xc'))||_0x58739e[_0x15f9('0xb')](_0x15f9('0xd'))||_0x58739e[_0x15f9('0xb')](_0x15f9('0x1a'))||_0x58739e[_0x15f9('0xb')](_0x15f9('0xe'))||_0x58739e['changed'](_0x15f9('0xf'))||_0x58739e[_0x15f9('0xb')](_0x15f9('0x10'))){var _0x43e020,_0x506295;_0x43e020=_0x58739e[_0x15f9('0xd')];var _0x233425=_0x43e020[_0x15f9('0x11')](-0x1);if(_0x233425==='/'||_0x233425==='\x5c'||_0x233425===':'){_0x43e020=_0x43e020['substring'](0x0,_0x43e020[_0x15f9('0x25')](_0x233425));}switch(_0x58739e[_0x15f9('0xc')]){case'US':_0x506295=_0x15f9('0x13');break;case'AU':_0x506295=_0x15f9('0x14');break;case'IN':_0x506295=_0x15f9('0x15');break;case'CN':_0x506295='https://accounts.zoho.com.cn';break;default:_0x506295=_0x15f9('0x17');break;}var _0x73f3ba={'method':_0x15f9('0x26'),'uri':_0x506295+_0x15f9('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x58739e[_0x15f9('0x1a')],'client_secret':_0x58739e['clientSecret'],'redirect_uri':_0x58739e['serverUrl'],'code':_0x58739e['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x73f3ba)[_0x15f9('0x1c')](function(_0x2c2d86){var _0x6e5306=JSON[_0x15f9('0x27')](_0x2c2d86);if(_0x6e5306[_0x15f9('0x1d')]){_0x58739e[_0x15f9('0x28')]=_0x6e5306[_0x15f9('0x1d')];logger[_0x15f9('0x1e')](util[_0x15f9('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x58739e[_0x15f9('0x21')],_0x58739e['id']));}else{logger[_0x15f9('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x58739e[_0x15f9('0x21')],_0x58739e['id']),util[_0x15f9('0x24')](_0x6e5306,{'showHidden':![],'depth':null}));}return _0x548918(null,_0x54a79c);})[_0x15f9('0x29')](function(_0x4a4301){logger['error'](util[_0x15f9('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x58739e[_0x15f9('0x21')],_0x58739e['id']),util[_0x15f9('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x548918(_0x4a4301);});}else{return _0x548918(null,_0x54a79c);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0049bb8..6a6aedf 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 _0x6e1c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','ShowZohoAccount','find','lodash','bluebird','randomstring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e1c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc6e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc6e1('0x1'));var rs=require(_0xc6e1('0x2'));var fs=require('fs');var Redis=require(_0xc6e1('0x3'));var db=require(_0xc6e1('0x4'))['db'];var utils=require(_0xc6e1('0x5'));var logger=require(_0xc6e1('0x6'))(_0xc6e1('0x7'));var config=require(_0xc6e1('0x8'));var jayson=require(_0xc6e1('0x9'));var client=jayson[_0xc6e1('0xa')][_0xc6e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5247f1,_0x3ff10c,_0x1242d5){return new BPromise(function(_0x39000a,_0x2ffee0){return client[_0xc6e1('0xc')](_0x5247f1,_0x1242d5)['then'](function(_0xa29af9){logger[_0xc6e1('0xd')](_0xc6e1('0xe'),_0x3ff10c,'request\x20sent');logger['debug'](_0xc6e1('0xf'),_0x3ff10c,_0xc6e1('0x10'),JSON['stringify'](_0xa29af9));if(_0xa29af9[_0xc6e1('0x11')]){if(_0xa29af9[_0xc6e1('0x11')][_0xc6e1('0x12')]===0x1f4){logger[_0xc6e1('0x11')](_0xc6e1('0xe'),_0x3ff10c,_0xa29af9[_0xc6e1('0x11')]['message']);return _0x2ffee0(_0xa29af9[_0xc6e1('0x11')][_0xc6e1('0x13')]);}logger[_0xc6e1('0x11')](_0xc6e1('0xe'),_0x3ff10c,_0xa29af9[_0xc6e1('0x11')]['message']);return _0x39000a(_0xa29af9['error'][_0xc6e1('0x13')]);}else{logger[_0xc6e1('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x3ff10c,_0xc6e1('0x10'));_0x39000a(_0xa29af9[_0xc6e1('0x14')][_0xc6e1('0x13')]);}})['catch'](function(_0x44ef6c){logger[_0xc6e1('0x11')](_0xc6e1('0xe'),_0x3ff10c,_0x44ef6c);_0x2ffee0(_0x44ef6c);});});}exports[_0xc6e1('0x15')]=function(_0x527c70){var _0x2c9fd7=this;return new Promise(function(_0x2b8b22,_0x3f4a60){return db[_0xc6e1('0x16')][_0xc6e1('0x17')]({'raw':_0x527c70[_0xc6e1('0x18')]?_0x527c70[_0xc6e1('0x18')][_0xc6e1('0x19')]===undefined?!![]:![]:!![],'where':_0x527c70[_0xc6e1('0x18')]?_0x527c70[_0xc6e1('0x18')][_0xc6e1('0x1a')]||null:null,'attributes':_0x527c70[_0xc6e1('0x18')]?_0x527c70[_0xc6e1('0x18')][_0xc6e1('0x1b')]||null:null,'limit':_0x527c70['options']?_0x527c70[_0xc6e1('0x18')][_0xc6e1('0x1c')]||null:null,'include':_0x527c70[_0xc6e1('0x18')]?_0x527c70[_0xc6e1('0x18')][_0xc6e1('0x1d')]?_[_0xc6e1('0x1e')](_0x527c70['options'][_0xc6e1('0x1d')],function(_0x40b059){return{'model':db[_0x40b059[_0xc6e1('0x1f')]],'as':_0x40b059['as'],'attributes':_0x40b059[_0xc6e1('0x1b')],'include':_0x40b059[_0xc6e1('0x1d')]?_['map'](_0x40b059['include'],function(_0x2e284e){return{'model':db[_0x2e284e[_0xc6e1('0x1f')]],'as':_0x2e284e['as'],'attributes':_0x2e284e['attributes'],'include':_0x2e284e[_0xc6e1('0x1d')]?_[_0xc6e1('0x1e')](_0x2e284e[_0xc6e1('0x1d')],function(_0x400687){return{'model':db[_0x400687[_0xc6e1('0x1f')]],'as':_0x400687['as'],'attributes':_0x400687[_0xc6e1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc6e1('0x20')](function(_0x71fa6d){logger[_0xc6e1('0xd')]('GetZohoAccount',_0x527c70);logger[_0xc6e1('0x21')](_0xc6e1('0x15'),_0x527c70,JSON[_0xc6e1('0x22')](_0x71fa6d));_0x2b8b22(_0x71fa6d);})['catch'](function(_0xe1114b){logger[_0xc6e1('0x11')](_0xc6e1('0x15'),_0xe1114b[_0xc6e1('0x13')],_0x527c70);_0x3f4a60(_0x2c9fd7[_0xc6e1('0x11')](0x1f4,_0xe1114b['message']));});});};exports[_0xc6e1('0x23')]=function(_0x1585d4){var _0x5a7c24=this;return new Promise(function(_0x2cdb1e,_0x3d6d3d){return db[_0xc6e1('0x16')][_0xc6e1('0x24')]({'raw':_0x1585d4[_0xc6e1('0x18')]?_0x1585d4[_0xc6e1('0x18')][_0xc6e1('0x19')]===undefined?!![]:![]:!![],'where':_0x1585d4[_0xc6e1('0x18')]?_0x1585d4['options'][_0xc6e1('0x1a')]||null:null,'attributes':_0x1585d4[_0xc6e1('0x18')]?_0x1585d4[_0xc6e1('0x18')][_0xc6e1('0x1b')]||null:null,'include':_0x1585d4[_0xc6e1('0x18')]?_0x1585d4[_0xc6e1('0x18')]['include']?_['map'](_0x1585d4[_0xc6e1('0x18')][_0xc6e1('0x1d')],function(_0x1c5db9){return{'model':db[_0x1c5db9['model']],'as':_0x1c5db9['as'],'attributes':_0x1c5db9[_0xc6e1('0x1b')],'include':_0x1c5db9[_0xc6e1('0x1d')]?_['map'](_0x1c5db9[_0xc6e1('0x1d')],function(_0x51860c){return{'model':db[_0x51860c[_0xc6e1('0x1f')]],'as':_0x51860c['as'],'attributes':_0x51860c[_0xc6e1('0x1b')],'include':_0x51860c['include']?_[_0xc6e1('0x1e')](_0x51860c['include'],function(_0x253543){return{'model':db[_0x253543[_0xc6e1('0x1f')]],'as':_0x253543['as'],'attributes':_0x253543[_0xc6e1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc6e1('0x20')](function(_0x21594c){logger['info']('ShowZohoAccount',_0x1585d4);logger[_0xc6e1('0x21')](_0xc6e1('0x23'),_0x1585d4,JSON[_0xc6e1('0x22')](_0x21594c));_0x2cdb1e(_0x21594c);})['catch'](function(_0x2f9c1e){logger['error'](_0xc6e1('0x23'),_0x2f9c1e[_0xc6e1('0x13')],_0x1585d4);_0x3d6d3d(_0x5a7c24[_0xc6e1('0x11')](0x1f4,_0x2f9c1e[_0xc6e1('0x13')]));});});}; \ No newline at end of file +var _0x80c4=['message','result','catch','findAll','options','where','include','map','model','attributes','GetZohoAccount','ShowZohoAccount','ZohoAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x768479,_0x5c6c81){var _0x55ebf0=function(_0x1fa932){while(--_0x1fa932){_0x768479['push'](_0x768479['shift']());}};_0x55ebf0(++_0x5c6c81);}(_0x80c4,0xa3));var _0x480c=function(_0xeb7bb7,_0x2f288d){_0xeb7bb7=_0xeb7bb7-0x0;var _0x542735=_0x80c4[_0xeb7bb7];return _0x542735;};'use strict';var _=require(_0x480c('0x0'));var util=require('util');var moment=require(_0x480c('0x1'));var BPromise=require(_0x480c('0x2'));var rs=require(_0x480c('0x3'));var fs=require('fs');var Redis=require(_0x480c('0x4'));var db=require(_0x480c('0x5'))['db'];var utils=require(_0x480c('0x6'));var logger=require('../../config/logger')(_0x480c('0x7'));var config=require(_0x480c('0x8'));var jayson=require(_0x480c('0x9'));var client=jayson[_0x480c('0xa')][_0x480c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40a5a6,_0x3a69ec,_0x277efe){return new BPromise(function(_0x21545d,_0x510038){return client[_0x480c('0xc')](_0x40a5a6,_0x277efe)[_0x480c('0xd')](function(_0x292aca){logger[_0x480c('0xe')](_0x480c('0xf'),_0x3a69ec,_0x480c('0x10'));logger[_0x480c('0x11')](_0x480c('0x12'),_0x3a69ec,_0x480c('0x10'),JSON[_0x480c('0x13')](_0x292aca));if(_0x292aca[_0x480c('0x14')]){if(_0x292aca[_0x480c('0x14')][_0x480c('0x15')]===0x1f4){logger[_0x480c('0x14')](_0x480c('0xf'),_0x3a69ec,_0x292aca[_0x480c('0x14')][_0x480c('0x16')]);return _0x510038(_0x292aca[_0x480c('0x14')]['message']);}logger[_0x480c('0x14')](_0x480c('0xf'),_0x3a69ec,_0x292aca['error'][_0x480c('0x16')]);return _0x21545d(_0x292aca[_0x480c('0x14')][_0x480c('0x16')]);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x3a69ec,_0x480c('0x10'));_0x21545d(_0x292aca[_0x480c('0x17')][_0x480c('0x16')]);}})[_0x480c('0x18')](function(_0x93d6c5){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3a69ec,_0x93d6c5);_0x510038(_0x93d6c5);});});}exports['GetZohoAccount']=function(_0xfc8a9f){var _0x4412aa=this;return new Promise(function(_0x54750c,_0x172103){return db['ZohoAccount'][_0x480c('0x19')]({'raw':_0xfc8a9f[_0x480c('0x1a')]?_0xfc8a9f[_0x480c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xfc8a9f[_0x480c('0x1a')]?_0xfc8a9f[_0x480c('0x1a')][_0x480c('0x1b')]||null:null,'attributes':_0xfc8a9f['options']?_0xfc8a9f[_0x480c('0x1a')]['attributes']||null:null,'limit':_0xfc8a9f[_0x480c('0x1a')]?_0xfc8a9f[_0x480c('0x1a')]['limit']||null:null,'include':_0xfc8a9f[_0x480c('0x1a')]?_0xfc8a9f[_0x480c('0x1a')][_0x480c('0x1c')]?_[_0x480c('0x1d')](_0xfc8a9f['options'][_0x480c('0x1c')],function(_0x241901){return{'model':db[_0x241901[_0x480c('0x1e')]],'as':_0x241901['as'],'attributes':_0x241901[_0x480c('0x1f')],'include':_0x241901[_0x480c('0x1c')]?_[_0x480c('0x1d')](_0x241901[_0x480c('0x1c')],function(_0x12445d){return{'model':db[_0x12445d[_0x480c('0x1e')]],'as':_0x12445d['as'],'attributes':_0x12445d[_0x480c('0x1f')],'include':_0x12445d[_0x480c('0x1c')]?_[_0x480c('0x1d')](_0x12445d[_0x480c('0x1c')],function(_0x1363ef){return{'model':db[_0x1363ef['model']],'as':_0x1363ef['as'],'attributes':_0x1363ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x480c('0xd')](function(_0x4eafc7){logger['info']('GetZohoAccount',_0xfc8a9f);logger['debug'](_0x480c('0x20'),_0xfc8a9f,JSON[_0x480c('0x13')](_0x4eafc7));_0x54750c(_0x4eafc7);})[_0x480c('0x18')](function(_0x377e5c){logger['error']('GetZohoAccount',_0x377e5c['message'],_0xfc8a9f);_0x172103(_0x4412aa[_0x480c('0x14')](0x1f4,_0x377e5c[_0x480c('0x16')]));});});};exports[_0x480c('0x21')]=function(_0xe03103){var _0x48c806=this;return new Promise(function(_0x5acc0d,_0x415f68){return db[_0x480c('0x22')][_0x480c('0x23')]({'raw':_0xe03103[_0x480c('0x1a')]?_0xe03103[_0x480c('0x1a')][_0x480c('0x24')]===undefined?!![]:![]:!![],'where':_0xe03103[_0x480c('0x1a')]?_0xe03103[_0x480c('0x1a')]['where']||null:null,'attributes':_0xe03103['options']?_0xe03103[_0x480c('0x1a')][_0x480c('0x1f')]||null:null,'include':_0xe03103['options']?_0xe03103[_0x480c('0x1a')][_0x480c('0x1c')]?_[_0x480c('0x1d')](_0xe03103[_0x480c('0x1a')][_0x480c('0x1c')],function(_0x391e8d){return{'model':db[_0x391e8d[_0x480c('0x1e')]],'as':_0x391e8d['as'],'attributes':_0x391e8d[_0x480c('0x1f')],'include':_0x391e8d[_0x480c('0x1c')]?_[_0x480c('0x1d')](_0x391e8d[_0x480c('0x1c')],function(_0xafb6fa){return{'model':db[_0xafb6fa[_0x480c('0x1e')]],'as':_0xafb6fa['as'],'attributes':_0xafb6fa[_0x480c('0x1f')],'include':_0xafb6fa[_0x480c('0x1c')]?_['map'](_0xafb6fa[_0x480c('0x1c')],function(_0x15db14){return{'model':db[_0x15db14[_0x480c('0x1e')]],'as':_0x15db14['as'],'attributes':_0x15db14[_0x480c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x424060){logger[_0x480c('0xe')]('ShowZohoAccount',_0xe03103);logger[_0x480c('0x11')]('ShowZohoAccount',_0xe03103,JSON[_0x480c('0x13')](_0x424060));_0x5acc0d(_0x424060);})[_0x480c('0x18')](function(_0x261309){logger['error'](_0x480c('0x21'),_0x261309[_0x480c('0x16')],_0xe03103);_0x415f68(_0x48c806[_0x480c('0x14')](0x1f4,_0x261309[_0x480c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 62ab98c..f0fd5e4 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 _0x8c2c=['isAuthenticated','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./intZohoConfiguration.controller','get','index','/:id'];(function(_0x5306b,_0x2a7f0f){var _0x363d6e=function(_0x49dc10){while(--_0x49dc10){_0x5306b['push'](_0x5306b['shift']());}};_0x363d6e(++_0x2a7f0f);}(_0x8c2c,0x11c));var _0xc8c2=function(_0x11ced7,_0x1ea2c5){_0x11ced7=_0x11ced7-0x0;var _0x20545c=_0x8c2c[_0x11ced7];return _0x20545c;};'use strict';var multer=require(_0xc8c2('0x0'));var util=require('util');var path=require(_0xc8c2('0x1'));var timeout=require(_0xc8c2('0x2'));var express=require(_0xc8c2('0x3'));var router=express[_0xc8c2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc8c2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc8c2('0x6'));router[_0xc8c2('0x7')]('/',auth['isAuthenticated'](),controller[_0xc8c2('0x8')]);router[_0xc8c2('0x7')](_0xc8c2('0x9'),auth[_0xc8c2('0xa')](),controller[_0xc8c2('0xb')]);router[_0xc8c2('0x7')](_0xc8c2('0xc'),auth[_0xc8c2('0xa')](),controller['getFields']);router[_0xc8c2('0x7')](_0xc8c2('0xd'),auth[_0xc8c2('0xa')](),controller['getSubjects']);router[_0xc8c2('0x7')](_0xc8c2('0xe'),auth[_0xc8c2('0xa')](),controller[_0xc8c2('0xf')]);router[_0xc8c2('0x10')]('/',auth['isAuthenticated'](),controller[_0xc8c2('0x11')]);router['put'](_0xc8c2('0x9'),auth[_0xc8c2('0xa')](),controller['update']);router[_0xc8c2('0x12')](_0xc8c2('0x9'),auth[_0xc8c2('0xa')](),controller[_0xc8c2('0x13')]);module[_0xc8c2('0x14')]=router; \ No newline at end of file +var _0xe4a2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','update','delete','destroy','exports','multer'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xe4a2,0x14f));var _0x2e4a=function(_0x1d7ff1,_0x2d8290){_0x1d7ff1=_0x1d7ff1-0x0;var _0x452374=_0xe4a2[_0x1d7ff1];return _0x452374;};'use strict';var multer=require(_0x2e4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2e4a('0x1'));var express=require('express');var router=express[_0x2e4a('0x2')]();var fs_extra=require(_0x2e4a('0x3'));var auth=require(_0x2e4a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2e4a('0x5'));var controller=require(_0x2e4a('0x6'));router[_0x2e4a('0x7')]('/',auth[_0x2e4a('0x8')](),controller[_0x2e4a('0x9')]);router[_0x2e4a('0x7')](_0x2e4a('0xa'),auth[_0x2e4a('0x8')](),controller[_0x2e4a('0xb')]);router[_0x2e4a('0x7')](_0x2e4a('0xc'),auth[_0x2e4a('0x8')](),controller[_0x2e4a('0xd')]);router[_0x2e4a('0x7')]('/:id/subjects',auth[_0x2e4a('0x8')](),controller[_0x2e4a('0xe')]);router[_0x2e4a('0x7')](_0x2e4a('0xf'),auth['isAuthenticated'](),controller[_0x2e4a('0x10')]);router['post']('/',auth[_0x2e4a('0x8')](),controller['create']);router['put'](_0x2e4a('0xa'),auth[_0x2e4a('0x8')](),controller[_0x2e4a('0x11')]);router[_0x2e4a('0x12')](_0x2e4a('0xa'),auth[_0x2e4a('0x8')](),controller[_0x2e4a('0x13')]);module[_0x2e4a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 954cf50..d0217aa 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 _0x501e=['sequelize','exports','STRING','ENUM','lead','contact_lead'];(function(_0x4e0c90,_0x1822f7){var _0x26164b=function(_0x5f3548){while(--_0x5f3548){_0x4e0c90['push'](_0x4e0c90['shift']());}};_0x26164b(++_0x1822f7);}(_0x501e,0x150));var _0xe501=function(_0x18f6d3,_0x5b6a89){_0x18f6d3=_0x18f6d3-0x0;var _0x540314=_0x501e[_0x18f6d3];return _0x540314;};'use strict';var Sequelize=require(_0xe501('0x0'));module[_0xe501('0x1')]={'name':{'type':Sequelize[_0xe501('0x2')]},'moduleCreate':{'type':Sequelize[_0xe501('0x3')]('lead','contact','nothing'),'defaultValue':_0xe501('0x4')},'moduleSearch':{'type':Sequelize[_0xe501('0x3')]('contact_lead','contact',_0xe501('0x4')),'defaultValue':_0xe501('0x5')},'description':{'type':Sequelize[_0xe501('0x2')]}}; \ No newline at end of file +var _0x18ec=['STRING','sequelize','exports','ENUM','lead','contact','nothing','contact_lead'];(function(_0x50b065,_0x397cec){var _0x4189f0=function(_0x28f1fb){while(--_0x28f1fb){_0x50b065['push'](_0x50b065['shift']());}};_0x4189f0(++_0x397cec);}(_0x18ec,0x1d1));var _0xc18e=function(_0x169205,_0x4926f0){_0x169205=_0x169205-0x0;var _0x1a66fc=_0x18ec[_0x169205];return _0x1a66fc;};'use strict';var Sequelize=require(_0xc18e('0x0'));module[_0xc18e('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xc18e('0x2')](_0xc18e('0x3'),_0xc18e('0x4'),_0xc18e('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xc18e('0x2')](_0xc18e('0x6'),_0xc18e('0x4'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xc18e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index dfd83fb..7d00b6f 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 _0x6272=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','ZohoConfiguration','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','includeAll','create','body','find','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x38abce,_0x339b87){var _0x4b83a9=function(_0x1d97df){while(--_0x1d97df){_0x38abce['push'](_0x38abce['shift']());}};_0x4b83a9(++_0x339b87);}(_0x6272,0x195));var _0x2627=function(_0x518506,_0x480ad3){_0x518506=_0x518506-0x0;var _0x585617=_0x6272[_0x518506];return _0x585617;};'use strict';var emlformat=require(_0x2627('0x0'));var rimraf=require(_0x2627('0x1'));var zipdir=require(_0x2627('0x2'));var jsonpatch=require(_0x2627('0x3'));var rp=require(_0x2627('0x4'));var moment=require(_0x2627('0x5'));var BPromise=require(_0x2627('0x6'));var Mustache=require(_0x2627('0x7'));var util=require(_0x2627('0x8'));var path=require(_0x2627('0x9'));var sox=require(_0x2627('0xa'));var csv=require(_0x2627('0xb'));var ejs=require(_0x2627('0xc'));var fs=require('fs');var fs_extra=require(_0x2627('0xd'));var _=require(_0x2627('0xe'));var squel=require(_0x2627('0xf'));var crypto=require(_0x2627('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x2627('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2627('0x12'));var Papa=require(_0x2627('0x13'));var Redis=require(_0x2627('0x14'));var authService=require(_0x2627('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x2627('0x16'));var hardwareService=require(_0x2627('0x17'));var logger=require(_0x2627('0x18'))(_0x2627('0x19'));var utils=require(_0x2627('0x1a'));var config=require(_0x2627('0x1b'));var licenseUtil=require(_0x2627('0x1c'));var db=require(_0x2627('0x1d'))['db'];function respondWithStatusCode(_0x365792,_0xc6db90){_0xc6db90=_0xc6db90||0xcc;return function(_0x203007){if(_0x203007){return _0x365792['sendStatus'](_0xc6db90);}return _0x365792[_0x2627('0x1e')](_0xc6db90)[_0x2627('0x1f')]();};}function respondWithResult(_0x2eb9ee,_0x531175){_0x531175=_0x531175||0xc8;return function(_0x36e2b6){if(_0x36e2b6){return _0x2eb9ee[_0x2627('0x1e')](_0x531175)['json'](_0x36e2b6);}};}function respondWithFilteredResult(_0x2a3197,_0xdf0101){return function(_0x2442f7){if(_0x2442f7){var _0x59fcc9=typeof _0xdf0101['offset']===_0x2627('0x20')&&typeof _0xdf0101['limit']===_0x2627('0x20');var _0x3c0179=_0x2442f7[_0x2627('0x21')];var _0xa467b=_0x59fcc9?0x0:_0xdf0101[_0x2627('0x22')];var _0x176bb9=_0x59fcc9?_0x2442f7['count']:_0xdf0101[_0x2627('0x22')]+_0xdf0101['limit'];var _0x3ee4d8;if(_0x176bb9>=_0x3c0179){_0x176bb9=_0x3c0179;_0x3ee4d8=0xc8;}else{_0x3ee4d8=0xce;}_0x2a3197[_0x2627('0x1e')](_0x3ee4d8);return _0x2a3197[_0x2627('0x23')](_0x2627('0x24'),_0xa467b+'-'+_0x176bb9+'/'+_0x3c0179)['json'](_0x2442f7);}return null;};}function patchUpdates(_0x36a9f0){return function(_0x19e3a4){try{jsonpatch[_0x2627('0x25')](_0x19e3a4,_0x36a9f0,!![]);}catch(_0x5a0fa0){return BPromise[_0x2627('0x26')](_0x5a0fa0);}return _0x19e3a4[_0x2627('0x27')]();};}function saveUpdates(_0x3ee2fb,_0x434339){return function(_0x2c74db){if(_0x2c74db){return _0x2c74db[_0x2627('0x28')](_0x3ee2fb)[_0x2627('0x29')](function(_0x32c5ee){return _0x32c5ee;});}return null;};}function removeEntity(_0x1b65b1,_0x46d427){return function(_0x1ef6d2){if(_0x1ef6d2){return _0x1ef6d2[_0x2627('0x2a')]()['then'](function(){_0x1b65b1['status'](0xcc)[_0x2627('0x1f')]();});}};}function handleEntityNotFound(_0x4ad99a,_0x1c0d42){return function(_0x1ff9ef){if(!_0x1ff9ef){_0x4ad99a[_0x2627('0x2b')](0x194);}return _0x1ff9ef;};}function handleError(_0x31f9f7,_0x18ce99){_0x18ce99=_0x18ce99||0x1f4;return function(_0x3e0aa3){logger[_0x2627('0x2c')](_0x3e0aa3['stack']);if(_0x3e0aa3[_0x2627('0x2d')]){delete _0x3e0aa3[_0x2627('0x2d')];}_0x31f9f7[_0x2627('0x1e')](_0x18ce99)[_0x2627('0x2e')](_0x3e0aa3);};}exports[_0x2627('0x2f')]=function(_0x27a515,_0x39ee14){var _0x1e1e6b={},_0xeeb936={},_0x3b9003={'count':0x0,'rows':[]};var _0x56084a=_['map'](db[_0x2627('0x30')][_0x2627('0x31')],function(_0x4af73b){return{'name':_0x4af73b['fieldName'],'type':_0x4af73b[_0x2627('0x32')][_0x2627('0x33')]};});_0xeeb936['model']=_[_0x2627('0x34')](_0x56084a,_0x2627('0x2d'));_0xeeb936[_0x2627('0x35')]=_[_0x2627('0x36')](_0x27a515['query']);_0xeeb936[_0x2627('0x37')]=_[_0x2627('0x38')](_0xeeb936[_0x2627('0x39')],_0xeeb936['query']);_0x1e1e6b[_0x2627('0x3a')]=_[_0x2627('0x38')](_0xeeb936[_0x2627('0x39')],qs[_0x2627('0x3b')](_0x27a515['query'][_0x2627('0x3b')]));_0x1e1e6b['attributes']=_0x1e1e6b[_0x2627('0x3a')][_0x2627('0x3c')]?_0x1e1e6b[_0x2627('0x3a')]:_0xeeb936[_0x2627('0x39')];if(!_0x27a515[_0x2627('0x35')][_0x2627('0x3d')](_0x2627('0x3e'))){_0x1e1e6b[_0x2627('0x3f')]=qs[_0x2627('0x3f')](_0x27a515[_0x2627('0x35')][_0x2627('0x3f')]);_0x1e1e6b['offset']=qs[_0x2627('0x22')](_0x27a515[_0x2627('0x35')]['offset']);}_0x1e1e6b[_0x2627('0x40')]=qs[_0x2627('0x41')](_0x27a515[_0x2627('0x35')][_0x2627('0x41')]);_0x1e1e6b[_0x2627('0x42')]=qs[_0x2627('0x37')](_[_0x2627('0x43')](_0x27a515[_0x2627('0x35')],_0xeeb936[_0x2627('0x37')]),_0x56084a);if(_0x27a515[_0x2627('0x35')][_0x2627('0x44')]){_0x1e1e6b[_0x2627('0x42')]=_[_0x2627('0x45')](_0x1e1e6b['where'],{'$or':_[_0x2627('0x34')](_0x56084a,function(_0x389c62){if(_0x389c62['type']!=='VIRTUAL'){var _0x2dd820={};_0x2dd820[_0x389c62[_0x2627('0x2d')]]={'$like':'%'+_0x27a515[_0x2627('0x35')]['filter']+'%'};return _0x2dd820;}})});}_0x1e1e6b=_[_0x2627('0x45')]({},_0x1e1e6b,_0x27a515[_0x2627('0x46')]);var _0x3d42a8={'where':_0x1e1e6b[_0x2627('0x42')]};return db[_0x2627('0x30')][_0x2627('0x21')](_0x3d42a8)[_0x2627('0x29')](function(_0x35e280){_0x3b9003[_0x2627('0x21')]=_0x35e280;if(_0x27a515[_0x2627('0x35')]['includeAll']){_0x1e1e6b[_0x2627('0x47')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x2627('0x48')](_0x1e1e6b);})[_0x2627('0x29')](function(_0x3c3469){_0x3b9003[_0x2627('0x49')]=_0x3c3469;return _0x3b9003;})[_0x2627('0x29')](respondWithFilteredResult(_0x39ee14,_0x1e1e6b))[_0x2627('0x4a')](handleError(_0x39ee14,null));};exports['show']=function(_0x365f21,_0x3d3577){var _0x5bfea1={'raw':![],'where':{'id':_0x365f21[_0x2627('0x4b')]['id']}},_0x12f992={};_0x12f992['model']=_[_0x2627('0x36')](db[_0x2627('0x30')][_0x2627('0x31')]);_0x12f992['query']=_[_0x2627('0x36')](_0x365f21[_0x2627('0x35')]);_0x12f992[_0x2627('0x37')]=_[_0x2627('0x38')](_0x12f992[_0x2627('0x39')],_0x12f992[_0x2627('0x35')]);_0x5bfea1['attributes']=_['intersection'](_0x12f992[_0x2627('0x39')],qs[_0x2627('0x3b')](_0x365f21['query']['fields']));_0x5bfea1[_0x2627('0x3a')]=_0x5bfea1['attributes'][_0x2627('0x3c')]?_0x5bfea1[_0x2627('0x3a')]:_0x12f992[_0x2627('0x39')];if(_0x365f21[_0x2627('0x35')][_0x2627('0x4c')]){_0x5bfea1[_0x2627('0x47')]=[{'all':!![]}];}_0x5bfea1=_[_0x2627('0x45')]({},_0x5bfea1,_0x365f21[_0x2627('0x46')]);return db[_0x2627('0x30')]['find'](_0x5bfea1)[_0x2627('0x29')](handleEntityNotFound(_0x3d3577,null))[_0x2627('0x29')](respondWithResult(_0x3d3577,null))['catch'](handleError(_0x3d3577,null));};exports[_0x2627('0x4d')]=function(_0x542e3a,_0x412621){return db[_0x2627('0x30')][_0x2627('0x4d')](_0x542e3a[_0x2627('0x4e')],{})[_0x2627('0x29')](respondWithResult(_0x412621,0xc9))[_0x2627('0x4a')](handleError(_0x412621,null));};exports['update']=function(_0x4bf2b6,_0x290b29){if(_0x4bf2b6[_0x2627('0x4e')]['id']){delete _0x4bf2b6[_0x2627('0x4e')]['id'];}return db[_0x2627('0x30')][_0x2627('0x4f')]({'where':{'id':_0x4bf2b6[_0x2627('0x4b')]['id']}})[_0x2627('0x29')](handleEntityNotFound(_0x290b29,null))[_0x2627('0x29')](saveUpdates(_0x4bf2b6[_0x2627('0x4e')],null))['then'](respondWithResult(_0x290b29,null))['catch'](handleError(_0x290b29,null));};exports[_0x2627('0x2a')]=function(_0x45b437,_0xbdd0d){return db[_0x2627('0x30')][_0x2627('0x4f')]({'where':{'id':_0x45b437[_0x2627('0x4b')]['id']}})[_0x2627('0x29')](handleEntityNotFound(_0xbdd0d,null))[_0x2627('0x29')](removeEntity(_0xbdd0d,null))[_0x2627('0x4a')](handleError(_0xbdd0d,null));};exports[_0x2627('0x50')]=function(_0x73b8a0,_0x1ac4a9,_0x1d1ea7){var _0x19bcb2={};var _0x3b00f1={};var _0x1d9713;var _0x2abc05;return db['ZohoConfiguration'][_0x2627('0x51')]({'where':{'id':_0x73b8a0[_0x2627('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1ac4a9,null))[_0x2627('0x29')](function(_0x820e7){if(_0x820e7){_0x1d9713=_0x820e7;_0x3b00f1[_0x2627('0x39')]=_[_0x2627('0x36')](db[_0x2627('0x52')][_0x2627('0x31')]);_0x3b00f1[_0x2627('0x35')]=_['keys'](_0x73b8a0[_0x2627('0x35')]);_0x3b00f1[_0x2627('0x37')]=_[_0x2627('0x38')](_0x3b00f1[_0x2627('0x39')],_0x3b00f1[_0x2627('0x35')]);_0x19bcb2[_0x2627('0x3a')]=_[_0x2627('0x38')](_0x3b00f1[_0x2627('0x39')],qs[_0x2627('0x3b')](_0x73b8a0[_0x2627('0x35')][_0x2627('0x3b')]));_0x19bcb2[_0x2627('0x3a')]=_0x19bcb2[_0x2627('0x3a')][_0x2627('0x3c')]?_0x19bcb2['attributes']:_0x3b00f1[_0x2627('0x39')];_0x19bcb2[_0x2627('0x40')]=qs['sort'](_0x73b8a0[_0x2627('0x35')][_0x2627('0x41')]);_0x19bcb2['where']=qs[_0x2627('0x37')](_[_0x2627('0x43')](_0x73b8a0[_0x2627('0x35')],_0x3b00f1[_0x2627('0x37')]));if(_0x73b8a0[_0x2627('0x35')]['filter']){_0x19bcb2[_0x2627('0x42')]=_[_0x2627('0x45')](_0x19bcb2[_0x2627('0x42')],{'$or':_[_0x2627('0x34')](_0x19bcb2[_0x2627('0x3a')],function(_0x5cfb0e){var _0x76dfe0={};_0x76dfe0[_0x5cfb0e]={'$like':'%'+_0x73b8a0['query']['filter']+'%'};return _0x76dfe0;})});}_0x19bcb2=_[_0x2627('0x45')]({},_0x19bcb2,_0x73b8a0[_0x2627('0x46')]);return _0x1d9713[_0x2627('0x50')](_0x19bcb2);}})['then'](function(_0x2260bd){if(_0x2260bd){_0x2abc05=_0x2260bd[_0x2627('0x3c')];if(!_0x73b8a0[_0x2627('0x35')][_0x2627('0x3d')]('nolimit')){_0x19bcb2[_0x2627('0x3f')]=qs[_0x2627('0x3f')](_0x73b8a0[_0x2627('0x35')][_0x2627('0x3f')]);_0x19bcb2['offset']=qs[_0x2627('0x22')](_0x73b8a0[_0x2627('0x35')]['offset']);}return _0x1d9713[_0x2627('0x50')](_0x19bcb2);}})[_0x2627('0x29')](function(_0x219afc){if(_0x219afc){return _0x219afc?{'count':_0x2abc05,'rows':_0x219afc}:null;}})[_0x2627('0x29')](respondWithResult(_0x1ac4a9,null))['catch'](handleError(_0x1ac4a9,null));};exports[_0x2627('0x53')]=function(_0x380d6a,_0x34b691,_0x35b8c3){var _0x50b8cb={};var _0x1a9f09={};var _0x53298e;var _0x58d1ac;return db[_0x2627('0x30')][_0x2627('0x51')]({'where':{'id':_0x380d6a[_0x2627('0x4b')]['id']}})[_0x2627('0x29')](handleEntityNotFound(_0x34b691,null))[_0x2627('0x29')](function(_0x467669){if(_0x467669){_0x53298e=_0x467669;_0x1a9f09['model']=_[_0x2627('0x36')](db[_0x2627('0x52')][_0x2627('0x31')]);_0x1a9f09[_0x2627('0x35')]=_[_0x2627('0x36')](_0x380d6a[_0x2627('0x35')]);_0x1a9f09[_0x2627('0x37')]=_[_0x2627('0x38')](_0x1a9f09[_0x2627('0x39')],_0x1a9f09[_0x2627('0x35')]);_0x50b8cb[_0x2627('0x3a')]=_[_0x2627('0x38')](_0x1a9f09[_0x2627('0x39')],qs[_0x2627('0x3b')](_0x380d6a['query'][_0x2627('0x3b')]));_0x50b8cb[_0x2627('0x3a')]=_0x50b8cb[_0x2627('0x3a')][_0x2627('0x3c')]?_0x50b8cb[_0x2627('0x3a')]:_0x1a9f09[_0x2627('0x39')];_0x50b8cb[_0x2627('0x40')]=qs[_0x2627('0x41')](_0x380d6a['query']['sort']);_0x50b8cb[_0x2627('0x42')]=qs[_0x2627('0x37')](_[_0x2627('0x43')](_0x380d6a[_0x2627('0x35')],_0x1a9f09[_0x2627('0x37')]));if(_0x380d6a[_0x2627('0x35')]['filter']){_0x50b8cb[_0x2627('0x42')]=_['merge'](_0x50b8cb[_0x2627('0x42')],{'$or':_[_0x2627('0x34')](_0x50b8cb[_0x2627('0x3a')],function(_0x130725){var _0x1d5e6b={};_0x1d5e6b[_0x130725]={'$like':'%'+_0x380d6a['query'][_0x2627('0x44')]+'%'};return _0x1d5e6b;})});}_0x50b8cb=_[_0x2627('0x45')]({},_0x50b8cb,_0x380d6a['options']);return _0x53298e[_0x2627('0x53')](_0x50b8cb);}})[_0x2627('0x29')](function(_0x54417e){if(_0x54417e){_0x58d1ac=_0x54417e['length'];if(!_0x380d6a[_0x2627('0x35')]['hasOwnProperty'](_0x2627('0x3e'))){_0x50b8cb[_0x2627('0x3f')]=qs[_0x2627('0x3f')](_0x380d6a[_0x2627('0x35')][_0x2627('0x3f')]);_0x50b8cb['offset']=qs[_0x2627('0x22')](_0x380d6a[_0x2627('0x35')][_0x2627('0x22')]);}return _0x53298e['getSubjects'](_0x50b8cb);}})['then'](function(_0x251fcb){if(_0x251fcb){return _0x251fcb?{'count':_0x58d1ac,'rows':_0x251fcb}:null;}})['then'](respondWithResult(_0x34b691,null))[_0x2627('0x4a')](handleError(_0x34b691,null));};exports[_0x2627('0x54')]=function(_0x141db7,_0x417cf2,_0x4015e4){var _0x39b7d9={};var _0x209314={};var _0x35dc2f;var _0x25a38f;return db['ZohoConfiguration'][_0x2627('0x51')]({'where':{'id':_0x141db7['params']['id']}})[_0x2627('0x29')](handleEntityNotFound(_0x417cf2,null))[_0x2627('0x29')](function(_0x2e37d6){if(_0x2e37d6){_0x35dc2f=_0x2e37d6;_0x209314['model']=_['keys'](db['ZohoField'][_0x2627('0x31')]);_0x209314[_0x2627('0x35')]=_[_0x2627('0x36')](_0x141db7[_0x2627('0x35')]);_0x209314[_0x2627('0x37')]=_[_0x2627('0x38')](_0x209314[_0x2627('0x39')],_0x209314['query']);_0x39b7d9[_0x2627('0x3a')]=_[_0x2627('0x38')](_0x209314['model'],qs[_0x2627('0x3b')](_0x141db7[_0x2627('0x35')][_0x2627('0x3b')]));_0x39b7d9[_0x2627('0x3a')]=_0x39b7d9[_0x2627('0x3a')][_0x2627('0x3c')]?_0x39b7d9[_0x2627('0x3a')]:_0x209314[_0x2627('0x39')];_0x39b7d9['order']=qs[_0x2627('0x41')](_0x141db7[_0x2627('0x35')][_0x2627('0x41')]);_0x39b7d9[_0x2627('0x42')]=qs[_0x2627('0x37')](_['pick'](_0x141db7[_0x2627('0x35')],_0x209314[_0x2627('0x37')]));if(_0x141db7[_0x2627('0x35')][_0x2627('0x44')]){_0x39b7d9[_0x2627('0x42')]=_['merge'](_0x39b7d9['where'],{'$or':_['map'](_0x39b7d9[_0x2627('0x3a')],function(_0x4cec12){var _0x3f1108={};_0x3f1108[_0x4cec12]={'$like':'%'+_0x141db7['query'][_0x2627('0x44')]+'%'};return _0x3f1108;})});}_0x39b7d9=_['merge']({},_0x39b7d9,_0x141db7['options']);return _0x35dc2f[_0x2627('0x54')](_0x39b7d9);}})[_0x2627('0x29')](function(_0x429658){if(_0x429658){_0x25a38f=_0x429658['length'];if(!_0x141db7['query']['hasOwnProperty'](_0x2627('0x3e'))){_0x39b7d9[_0x2627('0x3f')]=qs['limit'](_0x141db7['query'][_0x2627('0x3f')]);_0x39b7d9[_0x2627('0x22')]=qs[_0x2627('0x22')](_0x141db7[_0x2627('0x35')][_0x2627('0x22')]);}return _0x35dc2f[_0x2627('0x54')](_0x39b7d9);}})[_0x2627('0x29')](function(_0x442663){if(_0x442663){return _0x442663?{'count':_0x25a38f,'rows':_0x442663}:null;}})['then'](respondWithResult(_0x417cf2,null))[_0x2627('0x4a')](handleError(_0x417cf2,null));}; \ No newline at end of file +var _0xf37b=['nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','rows','catch','params','keys','length','create','body','find','getFields','findOne','ZohoField','pick','merge','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','filters','model','query','attributes','intersection','fields','hasOwnProperty'];(function(_0x462a14,_0x1b8cdc){var _0x49951c=function(_0x5111af){while(--_0x5111af){_0x462a14['push'](_0x462a14['shift']());}};_0x49951c(++_0x1b8cdc);}(_0xf37b,0x6a));var _0xbf37=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0xf37b[_0x146484];return _0x4c7aa3;};'use strict';var emlformat=require(_0xbf37('0x0'));var rimraf=require(_0xbf37('0x1'));var zipdir=require(_0xbf37('0x2'));var jsonpatch=require(_0xbf37('0x3'));var rp=require(_0xbf37('0x4'));var moment=require(_0xbf37('0x5'));var BPromise=require(_0xbf37('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbf37('0x7'));var sox=require(_0xbf37('0x8'));var csv=require(_0xbf37('0x9'));var ejs=require(_0xbf37('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf37('0xb'));var squel=require(_0xbf37('0xc'));var crypto=require(_0xbf37('0xd'));var jsforce=require(_0xbf37('0xe'));var deskjs=require(_0xbf37('0xf'));var toCsv=require(_0xbf37('0x9'));var querystring=require(_0xbf37('0x10'));var Papa=require(_0xbf37('0x11'));var Redis=require(_0xbf37('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbf37('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf37('0x14'))(_0xbf37('0x15'));var utils=require(_0xbf37('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbf37('0x17'));var db=require(_0xbf37('0x18'))['db'];function respondWithStatusCode(_0x29e6ef,_0x359c55){_0x359c55=_0x359c55||0xcc;return function(_0x210c72){if(_0x210c72){return _0x29e6ef[_0xbf37('0x19')](_0x359c55);}return _0x29e6ef[_0xbf37('0x1a')](_0x359c55)[_0xbf37('0x1b')]();};}function respondWithResult(_0x595005,_0x50cda1){_0x50cda1=_0x50cda1||0xc8;return function(_0x2feb6b){if(_0x2feb6b){return _0x595005[_0xbf37('0x1a')](_0x50cda1)[_0xbf37('0x1c')](_0x2feb6b);}};}function respondWithFilteredResult(_0x38fc33,_0xeb51ad){return function(_0x44769a){if(_0x44769a){var _0x2cd11e=typeof _0xeb51ad['offset']==='undefined'&&typeof _0xeb51ad[_0xbf37('0x1d')]===_0xbf37('0x1e');var _0x1684aa=_0x44769a[_0xbf37('0x1f')];var _0x573789=_0x2cd11e?0x0:_0xeb51ad[_0xbf37('0x20')];var _0x3507aa=_0x2cd11e?_0x44769a[_0xbf37('0x1f')]:_0xeb51ad[_0xbf37('0x20')]+_0xeb51ad[_0xbf37('0x1d')];var _0x32bde1;if(_0x3507aa>=_0x1684aa){_0x3507aa=_0x1684aa;_0x32bde1=0xc8;}else{_0x32bde1=0xce;}_0x38fc33[_0xbf37('0x1a')](_0x32bde1);return _0x38fc33['set'](_0xbf37('0x21'),_0x573789+'-'+_0x3507aa+'/'+_0x1684aa)[_0xbf37('0x1c')](_0x44769a);}return null;};}function patchUpdates(_0xe0a3a3){return function(_0xbd7f74){try{jsonpatch[_0xbf37('0x22')](_0xbd7f74,_0xe0a3a3,!![]);}catch(_0x3248cb){return BPromise[_0xbf37('0x23')](_0x3248cb);}return _0xbd7f74[_0xbf37('0x24')]();};}function saveUpdates(_0x54fa09,_0xe255f0){return function(_0x3ea288){if(_0x3ea288){return _0x3ea288[_0xbf37('0x25')](_0x54fa09)[_0xbf37('0x26')](function(_0x3cb085){return _0x3cb085;});}return null;};}function removeEntity(_0x20ea30,_0x4b1026){return function(_0xcb44b7){if(_0xcb44b7){return _0xcb44b7[_0xbf37('0x27')]()[_0xbf37('0x26')](function(){_0x20ea30['status'](0xcc)[_0xbf37('0x1b')]();});}};}function handleEntityNotFound(_0x1121f9,_0x41da23){return function(_0x1eeb00){if(!_0x1eeb00){_0x1121f9[_0xbf37('0x19')](0x194);}return _0x1eeb00;};}function handleError(_0x173e8b,_0x35698f){_0x35698f=_0x35698f||0x1f4;return function(_0x429933){logger[_0xbf37('0x28')](_0x429933[_0xbf37('0x29')]);if(_0x429933['name']){delete _0x429933[_0xbf37('0x2a')];}_0x173e8b['status'](_0x35698f)[_0xbf37('0x2b')](_0x429933);};}exports[_0xbf37('0x2c')]=function(_0x337a8f,_0x4c0b2f){var _0x50bc48={},_0x4d7ca1={},_0x134db1={'count':0x0,'rows':[]};var _0x34367f=_[_0xbf37('0x2d')](db[_0xbf37('0x2e')][_0xbf37('0x2f')],function(_0x31d2ca){return{'name':_0x31d2ca[_0xbf37('0x30')],'type':_0x31d2ca[_0xbf37('0x31')][_0xbf37('0x32')]};});_0x4d7ca1['model']=_[_0xbf37('0x2d')](_0x34367f,_0xbf37('0x2a'));_0x4d7ca1['query']=_['keys'](_0x337a8f['query']);_0x4d7ca1[_0xbf37('0x33')]=_['intersection'](_0x4d7ca1[_0xbf37('0x34')],_0x4d7ca1[_0xbf37('0x35')]);_0x50bc48[_0xbf37('0x36')]=_[_0xbf37('0x37')](_0x4d7ca1[_0xbf37('0x34')],qs[_0xbf37('0x38')](_0x337a8f[_0xbf37('0x35')][_0xbf37('0x38')]));_0x50bc48['attributes']=_0x50bc48[_0xbf37('0x36')]['length']?_0x50bc48[_0xbf37('0x36')]:_0x4d7ca1['model'];if(!_0x337a8f[_0xbf37('0x35')][_0xbf37('0x39')](_0xbf37('0x3a'))){_0x50bc48[_0xbf37('0x1d')]=qs['limit'](_0x337a8f['query'][_0xbf37('0x1d')]);_0x50bc48['offset']=qs[_0xbf37('0x20')](_0x337a8f[_0xbf37('0x35')]['offset']);}_0x50bc48[_0xbf37('0x3b')]=qs[_0xbf37('0x3c')](_0x337a8f[_0xbf37('0x35')][_0xbf37('0x3c')]);_0x50bc48['where']=qs[_0xbf37('0x33')](_['pick'](_0x337a8f[_0xbf37('0x35')],_0x4d7ca1[_0xbf37('0x33')]),_0x34367f);if(_0x337a8f[_0xbf37('0x35')][_0xbf37('0x3d')]){_0x50bc48['where']=_['merge'](_0x50bc48[_0xbf37('0x3e')],{'$or':_[_0xbf37('0x2d')](_0x34367f,function(_0x19797c){if(_0x19797c[_0xbf37('0x31')]!==_0xbf37('0x3f')){var _0x3dd890={};_0x3dd890[_0x19797c['name']]={'$like':'%'+_0x337a8f['query'][_0xbf37('0x3d')]+'%'};return _0x3dd890;}})});}_0x50bc48=_['merge']({},_0x50bc48,_0x337a8f[_0xbf37('0x40')]);var _0x22c037={'where':_0x50bc48[_0xbf37('0x3e')]};return db[_0xbf37('0x2e')]['count'](_0x22c037)['then'](function(_0x39346c){_0x134db1[_0xbf37('0x1f')]=_0x39346c;if(_0x337a8f[_0xbf37('0x35')][_0xbf37('0x41')]){_0x50bc48[_0xbf37('0x42')]=[{'all':!![]}];}return db[_0xbf37('0x2e')]['findAll'](_0x50bc48);})['then'](function(_0x72f840){_0x134db1[_0xbf37('0x43')]=_0x72f840;return _0x134db1;})[_0xbf37('0x26')](respondWithFilteredResult(_0x4c0b2f,_0x50bc48))[_0xbf37('0x44')](handleError(_0x4c0b2f,null));};exports['show']=function(_0x3ee03b,_0x532a0b){var _0x5826b4={'raw':![],'where':{'id':_0x3ee03b[_0xbf37('0x45')]['id']}},_0x2b4c71={};_0x2b4c71[_0xbf37('0x34')]=_[_0xbf37('0x46')](db[_0xbf37('0x2e')][_0xbf37('0x2f')]);_0x2b4c71[_0xbf37('0x35')]=_[_0xbf37('0x46')](_0x3ee03b[_0xbf37('0x35')]);_0x2b4c71[_0xbf37('0x33')]=_[_0xbf37('0x37')](_0x2b4c71[_0xbf37('0x34')],_0x2b4c71[_0xbf37('0x35')]);_0x5826b4['attributes']=_['intersection'](_0x2b4c71[_0xbf37('0x34')],qs['fields'](_0x3ee03b[_0xbf37('0x35')]['fields']));_0x5826b4['attributes']=_0x5826b4[_0xbf37('0x36')][_0xbf37('0x47')]?_0x5826b4[_0xbf37('0x36')]:_0x2b4c71[_0xbf37('0x34')];if(_0x3ee03b[_0xbf37('0x35')]['includeAll']){_0x5826b4[_0xbf37('0x42')]=[{'all':!![]}];}_0x5826b4=_['merge']({},_0x5826b4,_0x3ee03b[_0xbf37('0x40')]);return db[_0xbf37('0x2e')]['find'](_0x5826b4)[_0xbf37('0x26')](handleEntityNotFound(_0x532a0b,null))[_0xbf37('0x26')](respondWithResult(_0x532a0b,null))['catch'](handleError(_0x532a0b,null));};exports[_0xbf37('0x48')]=function(_0x4489ea,_0x36762d){return db[_0xbf37('0x2e')][_0xbf37('0x48')](_0x4489ea['body'],{})[_0xbf37('0x26')](respondWithResult(_0x36762d,0xc9))[_0xbf37('0x44')](handleError(_0x36762d,null));};exports[_0xbf37('0x25')]=function(_0x5166f7,_0x379fdc){if(_0x5166f7['body']['id']){delete _0x5166f7[_0xbf37('0x49')]['id'];}return db[_0xbf37('0x2e')][_0xbf37('0x4a')]({'where':{'id':_0x5166f7[_0xbf37('0x45')]['id']}})[_0xbf37('0x26')](handleEntityNotFound(_0x379fdc,null))[_0xbf37('0x26')](saveUpdates(_0x5166f7[_0xbf37('0x49')],null))[_0xbf37('0x26')](respondWithResult(_0x379fdc,null))['catch'](handleError(_0x379fdc,null));};exports['destroy']=function(_0x16249f,_0x2f1501){return db[_0xbf37('0x2e')][_0xbf37('0x4a')]({'where':{'id':_0x16249f[_0xbf37('0x45')]['id']}})[_0xbf37('0x26')](handleEntityNotFound(_0x2f1501,null))[_0xbf37('0x26')](removeEntity(_0x2f1501,null))[_0xbf37('0x44')](handleError(_0x2f1501,null));};exports[_0xbf37('0x4b')]=function(_0x5b7d23,_0x1d959d,_0x4b9c17){var _0x12832a={};var _0x1d4edb={};var _0x22de8a;var _0x581d92;return db[_0xbf37('0x2e')][_0xbf37('0x4c')]({'where':{'id':_0x5b7d23[_0xbf37('0x45')]['id']}})['then'](handleEntityNotFound(_0x1d959d,null))['then'](function(_0x43d308){if(_0x43d308){_0x22de8a=_0x43d308;_0x1d4edb['model']=_['keys'](db[_0xbf37('0x4d')][_0xbf37('0x2f')]);_0x1d4edb[_0xbf37('0x35')]=_[_0xbf37('0x46')](_0x5b7d23['query']);_0x1d4edb['filters']=_[_0xbf37('0x37')](_0x1d4edb[_0xbf37('0x34')],_0x1d4edb[_0xbf37('0x35')]);_0x12832a[_0xbf37('0x36')]=_[_0xbf37('0x37')](_0x1d4edb[_0xbf37('0x34')],qs[_0xbf37('0x38')](_0x5b7d23[_0xbf37('0x35')][_0xbf37('0x38')]));_0x12832a[_0xbf37('0x36')]=_0x12832a['attributes']['length']?_0x12832a['attributes']:_0x1d4edb['model'];_0x12832a[_0xbf37('0x3b')]=qs[_0xbf37('0x3c')](_0x5b7d23[_0xbf37('0x35')][_0xbf37('0x3c')]);_0x12832a[_0xbf37('0x3e')]=qs['filters'](_[_0xbf37('0x4e')](_0x5b7d23[_0xbf37('0x35')],_0x1d4edb['filters']));if(_0x5b7d23['query'][_0xbf37('0x3d')]){_0x12832a[_0xbf37('0x3e')]=_[_0xbf37('0x4f')](_0x12832a[_0xbf37('0x3e')],{'$or':_[_0xbf37('0x2d')](_0x12832a[_0xbf37('0x36')],function(_0x25467f){var _0x1a25dd={};_0x1a25dd[_0x25467f]={'$like':'%'+_0x5b7d23[_0xbf37('0x35')]['filter']+'%'};return _0x1a25dd;})});}_0x12832a=_[_0xbf37('0x4f')]({},_0x12832a,_0x5b7d23[_0xbf37('0x40')]);return _0x22de8a['getFields'](_0x12832a);}})[_0xbf37('0x26')](function(_0x10b6b8){if(_0x10b6b8){_0x581d92=_0x10b6b8[_0xbf37('0x47')];if(!_0x5b7d23[_0xbf37('0x35')][_0xbf37('0x39')](_0xbf37('0x3a'))){_0x12832a[_0xbf37('0x1d')]=qs['limit'](_0x5b7d23['query']['limit']);_0x12832a['offset']=qs[_0xbf37('0x20')](_0x5b7d23['query'][_0xbf37('0x20')]);}return _0x22de8a[_0xbf37('0x4b')](_0x12832a);}})[_0xbf37('0x26')](function(_0x27b0b5){if(_0x27b0b5){return _0x27b0b5?{'count':_0x581d92,'rows':_0x27b0b5}:null;}})[_0xbf37('0x26')](respondWithResult(_0x1d959d,null))[_0xbf37('0x44')](handleError(_0x1d959d,null));};exports[_0xbf37('0x50')]=function(_0x562749,_0x49c344,_0x4ffc34){var _0xb871d5={};var _0x330ed6={};var _0x48732a;var _0x4121a9;return db['ZohoConfiguration'][_0xbf37('0x4c')]({'where':{'id':_0x562749['params']['id']}})[_0xbf37('0x26')](handleEntityNotFound(_0x49c344,null))['then'](function(_0x516d58){if(_0x516d58){_0x48732a=_0x516d58;_0x330ed6[_0xbf37('0x34')]=_[_0xbf37('0x46')](db['ZohoField'][_0xbf37('0x2f')]);_0x330ed6[_0xbf37('0x35')]=_['keys'](_0x562749[_0xbf37('0x35')]);_0x330ed6['filters']=_[_0xbf37('0x37')](_0x330ed6['model'],_0x330ed6[_0xbf37('0x35')]);_0xb871d5[_0xbf37('0x36')]=_[_0xbf37('0x37')](_0x330ed6[_0xbf37('0x34')],qs[_0xbf37('0x38')](_0x562749[_0xbf37('0x35')]['fields']));_0xb871d5[_0xbf37('0x36')]=_0xb871d5[_0xbf37('0x36')][_0xbf37('0x47')]?_0xb871d5[_0xbf37('0x36')]:_0x330ed6[_0xbf37('0x34')];_0xb871d5[_0xbf37('0x3b')]=qs[_0xbf37('0x3c')](_0x562749[_0xbf37('0x35')][_0xbf37('0x3c')]);_0xb871d5[_0xbf37('0x3e')]=qs[_0xbf37('0x33')](_[_0xbf37('0x4e')](_0x562749[_0xbf37('0x35')],_0x330ed6[_0xbf37('0x33')]));if(_0x562749[_0xbf37('0x35')][_0xbf37('0x3d')]){_0xb871d5[_0xbf37('0x3e')]=_[_0xbf37('0x4f')](_0xb871d5[_0xbf37('0x3e')],{'$or':_['map'](_0xb871d5[_0xbf37('0x36')],function(_0x1babbc){var _0x485729={};_0x485729[_0x1babbc]={'$like':'%'+_0x562749[_0xbf37('0x35')][_0xbf37('0x3d')]+'%'};return _0x485729;})});}_0xb871d5=_[_0xbf37('0x4f')]({},_0xb871d5,_0x562749[_0xbf37('0x40')]);return _0x48732a[_0xbf37('0x50')](_0xb871d5);}})[_0xbf37('0x26')](function(_0x25b47f){if(_0x25b47f){_0x4121a9=_0x25b47f[_0xbf37('0x47')];if(!_0x562749[_0xbf37('0x35')]['hasOwnProperty']('nolimit')){_0xb871d5[_0xbf37('0x1d')]=qs[_0xbf37('0x1d')](_0x562749[_0xbf37('0x35')][_0xbf37('0x1d')]);_0xb871d5[_0xbf37('0x20')]=qs['offset'](_0x562749['query'][_0xbf37('0x20')]);}return _0x48732a[_0xbf37('0x50')](_0xb871d5);}})[_0xbf37('0x26')](function(_0x49891b){if(_0x49891b){return _0x49891b?{'count':_0x4121a9,'rows':_0x49891b}:null;}})[_0xbf37('0x26')](respondWithResult(_0x49c344,null))[_0xbf37('0x44')](handleError(_0x49c344,null));};exports[_0xbf37('0x51')]=function(_0x416729,_0x2c28ee,_0x25f373){var _0x14264b={};var _0x3cc87a={};var _0x2528b9;var _0x587775;return db[_0xbf37('0x2e')]['findOne']({'where':{'id':_0x416729[_0xbf37('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c28ee,null))[_0xbf37('0x26')](function(_0x1cd526){if(_0x1cd526){_0x2528b9=_0x1cd526;_0x3cc87a[_0xbf37('0x34')]=_[_0xbf37('0x46')](db[_0xbf37('0x4d')][_0xbf37('0x2f')]);_0x3cc87a[_0xbf37('0x35')]=_[_0xbf37('0x46')](_0x416729['query']);_0x3cc87a[_0xbf37('0x33')]=_[_0xbf37('0x37')](_0x3cc87a[_0xbf37('0x34')],_0x3cc87a[_0xbf37('0x35')]);_0x14264b[_0xbf37('0x36')]=_[_0xbf37('0x37')](_0x3cc87a[_0xbf37('0x34')],qs[_0xbf37('0x38')](_0x416729['query']['fields']));_0x14264b[_0xbf37('0x36')]=_0x14264b[_0xbf37('0x36')][_0xbf37('0x47')]?_0x14264b[_0xbf37('0x36')]:_0x3cc87a['model'];_0x14264b[_0xbf37('0x3b')]=qs['sort'](_0x416729[_0xbf37('0x35')]['sort']);_0x14264b[_0xbf37('0x3e')]=qs[_0xbf37('0x33')](_['pick'](_0x416729[_0xbf37('0x35')],_0x3cc87a[_0xbf37('0x33')]));if(_0x416729[_0xbf37('0x35')][_0xbf37('0x3d')]){_0x14264b[_0xbf37('0x3e')]=_['merge'](_0x14264b[_0xbf37('0x3e')],{'$or':_['map'](_0x14264b[_0xbf37('0x36')],function(_0x1fe058){var _0x787f03={};_0x787f03[_0x1fe058]={'$like':'%'+_0x416729['query']['filter']+'%'};return _0x787f03;})});}_0x14264b=_[_0xbf37('0x4f')]({},_0x14264b,_0x416729[_0xbf37('0x40')]);return _0x2528b9['getDescriptions'](_0x14264b);}})[_0xbf37('0x26')](function(_0x22ca41){if(_0x22ca41){_0x587775=_0x22ca41[_0xbf37('0x47')];if(!_0x416729[_0xbf37('0x35')][_0xbf37('0x39')](_0xbf37('0x3a'))){_0x14264b[_0xbf37('0x1d')]=qs[_0xbf37('0x1d')](_0x416729['query'][_0xbf37('0x1d')]);_0x14264b[_0xbf37('0x20')]=qs['offset'](_0x416729[_0xbf37('0x35')][_0xbf37('0x20')]);}return _0x2528b9[_0xbf37('0x51')](_0x14264b);}})[_0xbf37('0x26')](function(_0x584454){if(_0x584454){return _0x584454?{'count':_0x587775,'rows':_0x584454}:null;}})[_0xbf37('0x26')](respondWithResult(_0x2c28ee,null))[_0xbf37('0x44')](handleError(_0x2c28ee,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 48af30f..634c031 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 _0xc6e6=['lodash','util','api','bluebird','path','rimraf','../../config/environment','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0xc6e6,0xa5));var _0x6c6e=function(_0xe88bd5,_0x327861){_0xe88bd5=_0xe88bd5-0x0;var _0x254b46=_0xc6e6[_0xe88bd5];return _0x254b46;};'use strict';var _=require(_0x6c6e('0x0'));var util=require(_0x6c6e('0x1'));var logger=require('../../config/logger')(_0x6c6e('0x2'));var moment=require('moment');var BPromise=require(_0x6c6e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c6e('0x4'));var rimraf=require(_0x6c6e('0x5'));var config=require(_0x6c6e('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x6c6e('0x7')]=function(_0x16b0b2,_0x11ab04){return _0x16b0b2[_0x6c6e('0x8')](_0x6c6e('0x9'),attributes,{'tableName':_0x6c6e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6620=['define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','request-promise','path','rimraf','exports'];(function(_0x34fab4,_0x194738){var _0x42fa5c=function(_0x453481){while(--_0x453481){_0x34fab4['push'](_0x34fab4['shift']());}};_0x42fa5c(++_0x194738);}(_0x6620,0xfd));var _0x0662=function(_0x121e71,_0x1f1780){_0x121e71=_0x121e71-0x0;var _0x383b1e=_0x6620[_0x121e71];return _0x383b1e;};'use strict';var _=require(_0x0662('0x0'));var util=require('util');var logger=require(_0x0662('0x1'))(_0x0662('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0662('0x3'));var fs=require('fs');var path=require(_0x0662('0x4'));var rimraf=require(_0x0662('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x0662('0x6')]=function(_0x36dc43,_0x4ce61f){return _0x36dc43[_0x0662('0x7')](_0x0662('0x8'),attributes,{'tableName':_0x0662('0x9'),'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 77ada19..ff75e47 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 _0x62a1=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info'];(function(_0x5dc227,_0x53b6dc){var _0x17e9ba=function(_0x2c56d8){while(--_0x2c56d8){_0x5dc227['push'](_0x5dc227['shift']());}};_0x17e9ba(++_0x53b6dc);}(_0x62a1,0x105));var _0x162a=function(_0x2c77f5,_0x2cc7c5){_0x2c77f5=_0x2c77f5-0x0;var _0x3d5f1b=_0x62a1[_0x2c77f5];return _0x3d5f1b;};'use strict';var _=require('lodash');var util=require(_0x162a('0x0'));var moment=require('moment');var BPromise=require(_0x162a('0x1'));var rs=require(_0x162a('0x2'));var fs=require('fs');var Redis=require(_0x162a('0x3'));var db=require(_0x162a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x162a('0x5'))(_0x162a('0x6'));var config=require('../../config/environment');var jayson=require(_0x162a('0x7'));var client=jayson[_0x162a('0x8')][_0x162a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x424285,_0xd46db8,_0x3f3d96){return new BPromise(function(_0x3136bd,_0x23fde9){return client[_0x162a('0xa')](_0x424285,_0x3f3d96)['then'](function(_0x241966){logger[_0x162a('0xb')](_0x162a('0xc'),_0xd46db8,_0x162a('0xd'));logger[_0x162a('0xe')](_0x162a('0xf'),_0xd46db8,'request\x20sent',JSON['stringify'](_0x241966));if(_0x241966['error']){if(_0x241966['error'][_0x162a('0x10')]===0x1f4){logger[_0x162a('0x11')](_0x162a('0xc'),_0xd46db8,_0x241966[_0x162a('0x11')][_0x162a('0x12')]);return _0x23fde9(_0x241966[_0x162a('0x11')][_0x162a('0x12')]);}logger['error'](_0x162a('0xc'),_0xd46db8,_0x241966[_0x162a('0x11')][_0x162a('0x12')]);return _0x3136bd(_0x241966[_0x162a('0x11')][_0x162a('0x12')]);}else{logger['info'](_0x162a('0xc'),_0xd46db8,_0x162a('0xd'));_0x3136bd(_0x241966[_0x162a('0x13')][_0x162a('0x12')]);}})[_0x162a('0x14')](function(_0xc312f5){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0xd46db8,_0xc312f5);_0x23fde9(_0xc312f5);});});} \ No newline at end of file +var _0xcb74=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x709665,_0x2596cb){var _0x31ef83=function(_0xc0bcd9){while(--_0xc0bcd9){_0x709665['push'](_0x709665['shift']());}};_0x31ef83(++_0x2596cb);}(_0xcb74,0x190));var _0x4cb7=function(_0x1426ae,_0x5d0efd){_0x1426ae=_0x1426ae-0x0;var _0x528e7c=_0xcb74[_0x1426ae];return _0x528e7c;};'use strict';var _=require(_0x4cb7('0x0'));var util=require(_0x4cb7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4cb7('0x2'));var fs=require('fs');var Redis=require(_0x4cb7('0x3'));var db=require(_0x4cb7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4cb7('0x5'));var jayson=require(_0x4cb7('0x6'));var client=jayson[_0x4cb7('0x7')][_0x4cb7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x246ec8,_0x905004,_0x34b972){return new BPromise(function(_0x48b8c4,_0x3eb630){return client[_0x4cb7('0x9')](_0x246ec8,_0x34b972)[_0x4cb7('0xa')](function(_0x12a228){logger[_0x4cb7('0xb')](_0x4cb7('0xc'),_0x905004,'request\x20sent');logger[_0x4cb7('0xd')](_0x4cb7('0xe'),_0x905004,_0x4cb7('0xf'),JSON[_0x4cb7('0x10')](_0x12a228));if(_0x12a228[_0x4cb7('0x11')]){if(_0x12a228['error'][_0x4cb7('0x12')]===0x1f4){logger[_0x4cb7('0x11')](_0x4cb7('0xc'),_0x905004,_0x12a228['error'][_0x4cb7('0x13')]);return _0x3eb630(_0x12a228['error'][_0x4cb7('0x13')]);}logger[_0x4cb7('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x905004,_0x12a228[_0x4cb7('0x11')][_0x4cb7('0x13')]);return _0x48b8c4(_0x12a228[_0x4cb7('0x11')][_0x4cb7('0x13')]);}else{logger[_0x4cb7('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x905004,_0x4cb7('0xf'));_0x48b8c4(_0x12a228[_0x4cb7('0x14')][_0x4cb7('0x13')]);}})[_0x4cb7('0x15')](function(_0x43e9a1){logger[_0x4cb7('0x11')](_0x4cb7('0xc'),_0x905004,_0x43e9a1);_0x3eb630(_0x43e9a1);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 5663b24..a15ba7f 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 _0x5730=['connect-timeout','../../components/interaction/service','../../config/environment','./intZohoField.controller','index','get','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports','path'];(function(_0x3c95c7,_0x548075){var _0x5e0f4e=function(_0x869d6f){while(--_0x869d6f){_0x3c95c7['push'](_0x3c95c7['shift']());}};_0x5e0f4e(++_0x548075);}(_0x5730,0x65));var _0x0573=function(_0x2ef873,_0x1538d9){_0x2ef873=_0x2ef873-0x0;var _0x262ea6=_0x5730[_0x2ef873];return _0x262ea6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0573('0x0'));var timeout=require(_0x0573('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0573('0x2'));var config=require(_0x0573('0x3'));var controller=require(_0x0573('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x0573('0x5')]);router[_0x0573('0x6')](_0x0573('0x7'),auth['isAuthenticated'](),controller[_0x0573('0x8')]);router[_0x0573('0x9')]('/',auth['isAuthenticated'](),controller[_0x0573('0xa')]);router[_0x0573('0xb')](_0x0573('0x7'),auth[_0x0573('0xc')](),controller[_0x0573('0xd')]);router[_0x0573('0xe')](_0x0573('0x7'),auth[_0x0573('0xc')](),controller[_0x0573('0xf')]);module[_0x0573('0x10')]=router; \ No newline at end of file +var _0xddb3=['./intZohoField.controller','get','isAuthenticated','index','show','post','put','/:id','update','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x23d8ed,_0x20cefa){var _0x142c0e=function(_0x488082){while(--_0x488082){_0x23d8ed['push'](_0x23d8ed['shift']());}};_0x142c0e(++_0x20cefa);}(_0xddb3,0x6b));var _0x3ddb=function(_0x43bd22,_0x2706a8){_0x43bd22=_0x43bd22-0x0;var _0xbc2a93=_0xddb3[_0x43bd22];return _0xbc2a93;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3ddb('0x0'));var express=require(_0x3ddb('0x1'));var router=express[_0x3ddb('0x2')]();var fs_extra=require(_0x3ddb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3ddb('0x4'));var config=require('../../config/environment');var controller=require(_0x3ddb('0x5'));router[_0x3ddb('0x6')]('/',auth[_0x3ddb('0x7')](),controller[_0x3ddb('0x8')]);router['get']('/:id',auth[_0x3ddb('0x7')](),controller[_0x3ddb('0x9')]);router[_0x3ddb('0xa')]('/',auth[_0x3ddb('0x7')](),controller['create']);router[_0x3ddb('0xb')](_0x3ddb('0xc'),auth[_0x3ddb('0x7')](),controller[_0x3ddb('0xd')]);router['delete'](_0x3ddb('0xc'),auth['isAuthenticated'](),controller[_0x3ddb('0xe')]);module[_0x3ddb('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 42dd1f4..060d060 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 _0x97b5=['keyValue','string','STRING','ENUM','variable','customVariable'];(function(_0x42eb51,_0xafa7f2){var _0x403569=function(_0x51d5b9){while(--_0x51d5b9){_0x42eb51['push'](_0x42eb51['shift']());}};_0x403569(++_0xafa7f2);}(_0x97b5,0x130));var _0x597b=function(_0x4fc4e7,_0x16bfc4){_0x4fc4e7=_0x4fc4e7-0x0;var _0x297133=_0x97b5[_0x4fc4e7];return _0x297133;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x597b('0x0'),_0x597b('0x1'),_0x597b('0x2'),'picklist'),'defaultValue':_0x597b('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x597b('0x4')]},'keyType':{'type':Sequelize[_0x597b('0x5')](_0x597b('0x3'),_0x597b('0x0'),_0x597b('0x1'))},'keyContent':{'type':Sequelize[_0x597b('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x597b('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x597b('0x4')]}}; \ No newline at end of file +var _0x7508=['picklist','STRING','ENUM','string','exports','variable','customVariable','keyValue'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7508,0x134));var _0x8750=function(_0x5b7fc5,_0x49392c){_0x5b7fc5=_0x5b7fc5-0x0;var _0x4e5e44=_0x7508[_0x5b7fc5];return _0x4e5e44;};'use strict';var Sequelize=require('sequelize');module[_0x8750('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x8750('0x1'),_0x8750('0x2'),_0x8750('0x3'),_0x8750('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8750('0x5')]},'keyType':{'type':Sequelize[_0x8750('0x6')](_0x8750('0x7'),_0x8750('0x1'),_0x8750('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8750('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8750('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f81118c..0166b2e 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 _0x4f17=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','then','includeAll','include','ZohoField','findAll','catch','show','find','create','body','params','eml-format','rimraf'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x4f17,0x9c));var _0x74f1=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0x4f17[_0xfb0281];return _0x408dd3;};'use strict';var emlformat=require(_0x74f1('0x0'));var rimraf=require(_0x74f1('0x1'));var zipdir=require(_0x74f1('0x2'));var jsonpatch=require(_0x74f1('0x3'));var rp=require(_0x74f1('0x4'));var moment=require(_0x74f1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x74f1('0x6'));var util=require(_0x74f1('0x7'));var path=require(_0x74f1('0x8'));var sox=require(_0x74f1('0x9'));var csv=require(_0x74f1('0xa'));var ejs=require(_0x74f1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74f1('0xc'));var squel=require(_0x74f1('0xd'));var crypto=require(_0x74f1('0xe'));var jsforce=require(_0x74f1('0xf'));var deskjs=require(_0x74f1('0x10'));var toCsv=require(_0x74f1('0xa'));var querystring=require(_0x74f1('0x11'));var Papa=require(_0x74f1('0x12'));var Redis=require(_0x74f1('0x13'));var authService=require(_0x74f1('0x14'));var qs=require(_0x74f1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74f1('0x16'));var logger=require(_0x74f1('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x74f1('0x18'));var licenseUtil=require(_0x74f1('0x19'));var db=require(_0x74f1('0x1a'))['db'];function respondWithStatusCode(_0x2a6d68,_0x32388f){_0x32388f=_0x32388f||0xcc;return function(_0xaff57f){if(_0xaff57f){return _0x2a6d68[_0x74f1('0x1b')](_0x32388f);}return _0x2a6d68[_0x74f1('0x1c')](_0x32388f)[_0x74f1('0x1d')]();};}function respondWithResult(_0x5ca6d2,_0x2b4742){_0x2b4742=_0x2b4742||0xc8;return function(_0xfe3b9d){if(_0xfe3b9d){return _0x5ca6d2[_0x74f1('0x1c')](_0x2b4742)['json'](_0xfe3b9d);}};}function respondWithFilteredResult(_0x93e29f,_0x211101){return function(_0x2d0c27){if(_0x2d0c27){var _0x351e6c=typeof _0x211101['offset']==='undefined'&&typeof _0x211101[_0x74f1('0x1e')]===_0x74f1('0x1f');var _0x4956a9=_0x2d0c27[_0x74f1('0x20')];var _0xc231f5=_0x351e6c?0x0:_0x211101[_0x74f1('0x21')];var _0x1cdc85=_0x351e6c?_0x2d0c27[_0x74f1('0x20')]:_0x211101[_0x74f1('0x21')]+_0x211101[_0x74f1('0x1e')];var _0x2001ac;if(_0x1cdc85>=_0x4956a9){_0x1cdc85=_0x4956a9;_0x2001ac=0xc8;}else{_0x2001ac=0xce;}_0x93e29f['status'](_0x2001ac);return _0x93e29f[_0x74f1('0x22')](_0x74f1('0x23'),_0xc231f5+'-'+_0x1cdc85+'/'+_0x4956a9)['json'](_0x2d0c27);}return null;};}function patchUpdates(_0x46c8cd){return function(_0x4848e1){try{jsonpatch[_0x74f1('0x24')](_0x4848e1,_0x46c8cd,!![]);}catch(_0x4c5e06){return BPromise[_0x74f1('0x25')](_0x4c5e06);}return _0x4848e1[_0x74f1('0x26')]();};}function saveUpdates(_0xd58d3c,_0x1e1cd7){return function(_0x5ce42d){if(_0x5ce42d){return _0x5ce42d[_0x74f1('0x27')](_0xd58d3c)['then'](function(_0x32d2ba){return _0x32d2ba;});}return null;};}function removeEntity(_0x460709,_0x3df55b){return function(_0x43eb92){if(_0x43eb92){return _0x43eb92[_0x74f1('0x28')]()['then'](function(){_0x460709[_0x74f1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45038e,_0x3ad817){return function(_0xe549f2){if(!_0xe549f2){_0x45038e[_0x74f1('0x1b')](0x194);}return _0xe549f2;};}function handleError(_0xf8a3c4,_0x41214a){_0x41214a=_0x41214a||0x1f4;return function(_0x37514a){logger[_0x74f1('0x29')](_0x37514a[_0x74f1('0x2a')]);if(_0x37514a[_0x74f1('0x2b')]){delete _0x37514a['name'];}_0xf8a3c4[_0x74f1('0x1c')](_0x41214a)[_0x74f1('0x2c')](_0x37514a);};}exports[_0x74f1('0x2d')]=function(_0x5e9bef,_0x4e4f8a){var _0x35bc56={},_0x53d46c={},_0x373151={'count':0x0,'rows':[]};var _0x447497=_[_0x74f1('0x2e')](db['ZohoField'][_0x74f1('0x2f')],function(_0x256fae){return{'name':_0x256fae[_0x74f1('0x30')],'type':_0x256fae['type'][_0x74f1('0x31')]};});_0x53d46c[_0x74f1('0x32')]=_['map'](_0x447497,'name');_0x53d46c[_0x74f1('0x33')]=_[_0x74f1('0x34')](_0x5e9bef[_0x74f1('0x33')]);_0x53d46c[_0x74f1('0x35')]=_[_0x74f1('0x36')](_0x53d46c[_0x74f1('0x32')],_0x53d46c[_0x74f1('0x33')]);_0x35bc56['attributes']=_['intersection'](_0x53d46c[_0x74f1('0x32')],qs[_0x74f1('0x37')](_0x5e9bef['query']['fields']));_0x35bc56[_0x74f1('0x38')]=_0x35bc56[_0x74f1('0x38')]['length']?_0x35bc56[_0x74f1('0x38')]:_0x53d46c[_0x74f1('0x32')];if(!_0x5e9bef[_0x74f1('0x33')][_0x74f1('0x39')](_0x74f1('0x3a'))){_0x35bc56[_0x74f1('0x1e')]=qs[_0x74f1('0x1e')](_0x5e9bef['query'][_0x74f1('0x1e')]);_0x35bc56[_0x74f1('0x21')]=qs[_0x74f1('0x21')](_0x5e9bef[_0x74f1('0x33')][_0x74f1('0x21')]);}_0x35bc56[_0x74f1('0x3b')]=qs['sort'](_0x5e9bef[_0x74f1('0x33')][_0x74f1('0x3c')]);_0x35bc56[_0x74f1('0x3d')]=qs['filters'](_[_0x74f1('0x3e')](_0x5e9bef[_0x74f1('0x33')],_0x53d46c[_0x74f1('0x35')]),_0x447497);if(_0x5e9bef[_0x74f1('0x33')]['filter']){_0x35bc56[_0x74f1('0x3d')]=_[_0x74f1('0x3f')](_0x35bc56[_0x74f1('0x3d')],{'$or':_['map'](_0x447497,function(_0x26b140){if(_0x26b140[_0x74f1('0x40')]!==_0x74f1('0x41')){var _0x7abc3b={};_0x7abc3b[_0x26b140['name']]={'$like':'%'+_0x5e9bef[_0x74f1('0x33')][_0x74f1('0x42')]+'%'};return _0x7abc3b;}})});}_0x35bc56=_[_0x74f1('0x3f')]({},_0x35bc56,_0x5e9bef[_0x74f1('0x43')]);var _0x1f851e={'where':_0x35bc56[_0x74f1('0x3d')]};return db['ZohoField']['count'](_0x1f851e)[_0x74f1('0x44')](function(_0x15c593){_0x373151[_0x74f1('0x20')]=_0x15c593;if(_0x5e9bef['query'][_0x74f1('0x45')]){_0x35bc56[_0x74f1('0x46')]=[{'all':!![]}];}return db[_0x74f1('0x47')][_0x74f1('0x48')](_0x35bc56);})[_0x74f1('0x44')](function(_0x483c00){_0x373151['rows']=_0x483c00;return _0x373151;})[_0x74f1('0x44')](respondWithFilteredResult(_0x4e4f8a,_0x35bc56))[_0x74f1('0x49')](handleError(_0x4e4f8a,null));};exports[_0x74f1('0x4a')]=function(_0x54015c,_0x3d8f25){var _0x4b3056={'raw':!![],'where':{'id':_0x54015c['params']['id']}},_0x16658e={};_0x16658e[_0x74f1('0x32')]=_[_0x74f1('0x34')](db[_0x74f1('0x47')][_0x74f1('0x2f')]);_0x16658e[_0x74f1('0x33')]=_[_0x74f1('0x34')](_0x54015c[_0x74f1('0x33')]);_0x16658e['filters']=_['intersection'](_0x16658e[_0x74f1('0x32')],_0x16658e[_0x74f1('0x33')]);_0x4b3056[_0x74f1('0x38')]=_[_0x74f1('0x36')](_0x16658e[_0x74f1('0x32')],qs[_0x74f1('0x37')](_0x54015c['query']['fields']));_0x4b3056['attributes']=_0x4b3056[_0x74f1('0x38')]['length']?_0x4b3056[_0x74f1('0x38')]:_0x16658e['model'];if(_0x54015c[_0x74f1('0x33')][_0x74f1('0x45')]){_0x4b3056[_0x74f1('0x46')]=[{'all':!![]}];}_0x4b3056=_[_0x74f1('0x3f')]({},_0x4b3056,_0x54015c[_0x74f1('0x43')]);return db['ZohoField'][_0x74f1('0x4b')](_0x4b3056)[_0x74f1('0x44')](handleEntityNotFound(_0x3d8f25,null))[_0x74f1('0x44')](respondWithResult(_0x3d8f25,null))[_0x74f1('0x49')](handleError(_0x3d8f25,null));};exports[_0x74f1('0x4c')]=function(_0x1b1336,_0x5210af){return db[_0x74f1('0x47')]['create'](_0x1b1336[_0x74f1('0x4d')],{})[_0x74f1('0x44')](respondWithResult(_0x5210af,0xc9))[_0x74f1('0x49')](handleError(_0x5210af,null));};exports[_0x74f1('0x27')]=function(_0x3dcb59,_0x37aad9){if(_0x3dcb59[_0x74f1('0x4d')]['id']){delete _0x3dcb59[_0x74f1('0x4d')]['id'];}return db[_0x74f1('0x47')][_0x74f1('0x4b')]({'where':{'id':_0x3dcb59['params']['id']}})[_0x74f1('0x44')](handleEntityNotFound(_0x37aad9,null))[_0x74f1('0x44')](saveUpdates(_0x3dcb59[_0x74f1('0x4d')],null))[_0x74f1('0x44')](respondWithResult(_0x37aad9,null))['catch'](handleError(_0x37aad9,null));};exports[_0x74f1('0x28')]=function(_0x27d99b,_0x1a22b4){return db[_0x74f1('0x47')]['find']({'where':{'id':_0x27d99b[_0x74f1('0x4e')]['id']}})[_0x74f1('0x44')](handleEntityNotFound(_0x1a22b4,null))['then'](removeEntity(_0x1a22b4,null))[_0x74f1('0x49')](handleError(_0x1a22b4,null));}; \ No newline at end of file +var _0x60f2=['../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils'];(function(_0x1d1219,_0x23fc71){var _0x5b5b89=function(_0x3d85e5){while(--_0x3d85e5){_0x1d1219['push'](_0x1d1219['shift']());}};_0x5b5b89(++_0x23fc71);}(_0x60f2,0x178));var _0x260f=function(_0x3faecd,_0x4f86f4){_0x3faecd=_0x3faecd-0x0;var _0x5c1ecf=_0x60f2[_0x3faecd];return _0x5c1ecf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x260f('0x0'));var jsonpatch=require(_0x260f('0x1'));var rp=require(_0x260f('0x2'));var moment=require(_0x260f('0x3'));var BPromise=require(_0x260f('0x4'));var Mustache=require(_0x260f('0x5'));var util=require(_0x260f('0x6'));var path=require(_0x260f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x260f('0x8'));var fs=require('fs');var fs_extra=require(_0x260f('0x9'));var _=require(_0x260f('0xa'));var squel=require(_0x260f('0xb'));var crypto=require(_0x260f('0xc'));var jsforce=require(_0x260f('0xd'));var deskjs=require(_0x260f('0xe'));var toCsv=require(_0x260f('0xf'));var querystring=require(_0x260f('0x10'));var Papa=require(_0x260f('0x11'));var Redis=require(_0x260f('0x12'));var authService=require(_0x260f('0x13'));var qs=require(_0x260f('0x14'));var as=require(_0x260f('0x15'));var hardwareService=require(_0x260f('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x260f('0x17'));var config=require(_0x260f('0x18'));var licenseUtil=require(_0x260f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a1ca6,_0x9f5a6){_0x9f5a6=_0x9f5a6||0xcc;return function(_0xa65050){if(_0xa65050){return _0x1a1ca6['sendStatus'](_0x9f5a6);}return _0x1a1ca6[_0x260f('0x1a')](_0x9f5a6)[_0x260f('0x1b')]();};}function respondWithResult(_0x1f4a6c,_0x4ef705){_0x4ef705=_0x4ef705||0xc8;return function(_0x52e8ac){if(_0x52e8ac){return _0x1f4a6c[_0x260f('0x1a')](_0x4ef705)[_0x260f('0x1c')](_0x52e8ac);}};}function respondWithFilteredResult(_0x55809c,_0x2b1560){return function(_0x15b706){if(_0x15b706){var _0x2dc5fc=typeof _0x2b1560[_0x260f('0x1d')]==='undefined'&&typeof _0x2b1560[_0x260f('0x1e')]===_0x260f('0x1f');var _0x527b32=_0x15b706['count'];var _0x555e6f=_0x2dc5fc?0x0:_0x2b1560['offset'];var _0xaa58fc=_0x2dc5fc?_0x15b706['count']:_0x2b1560[_0x260f('0x1d')]+_0x2b1560[_0x260f('0x1e')];var _0x32c4eb;if(_0xaa58fc>=_0x527b32){_0xaa58fc=_0x527b32;_0x32c4eb=0xc8;}else{_0x32c4eb=0xce;}_0x55809c[_0x260f('0x1a')](_0x32c4eb);return _0x55809c[_0x260f('0x20')](_0x260f('0x21'),_0x555e6f+'-'+_0xaa58fc+'/'+_0x527b32)[_0x260f('0x1c')](_0x15b706);}return null;};}function patchUpdates(_0xfb4f2f){return function(_0x56ddec){try{jsonpatch[_0x260f('0x22')](_0x56ddec,_0xfb4f2f,!![]);}catch(_0x3fd91a){return BPromise[_0x260f('0x23')](_0x3fd91a);}return _0x56ddec[_0x260f('0x24')]();};}function saveUpdates(_0x5515d9,_0xa4e150){return function(_0x27dc11){if(_0x27dc11){return _0x27dc11[_0x260f('0x25')](_0x5515d9)[_0x260f('0x26')](function(_0x23bb8e){return _0x23bb8e;});}return null;};}function removeEntity(_0xbd2b12,_0x645d70){return function(_0x47b9a8){if(_0x47b9a8){return _0x47b9a8[_0x260f('0x27')]()[_0x260f('0x26')](function(){_0xbd2b12['status'](0xcc)[_0x260f('0x1b')]();});}};}function handleEntityNotFound(_0x632da0,_0x4e3063){return function(_0x2e5800){if(!_0x2e5800){_0x632da0[_0x260f('0x28')](0x194);}return _0x2e5800;};}function handleError(_0x51690f,_0x5aa079){_0x5aa079=_0x5aa079||0x1f4;return function(_0x3194b3){logger[_0x260f('0x29')](_0x3194b3[_0x260f('0x2a')]);if(_0x3194b3[_0x260f('0x2b')]){delete _0x3194b3[_0x260f('0x2b')];}_0x51690f[_0x260f('0x1a')](_0x5aa079)[_0x260f('0x2c')](_0x3194b3);};}exports[_0x260f('0x2d')]=function(_0x1c30d6,_0x19bb62){var _0x5d138a={},_0x4fa97b={},_0x4fa171={'count':0x0,'rows':[]};var _0x4a3d65=_[_0x260f('0x2e')](db[_0x260f('0x2f')][_0x260f('0x30')],function(_0x2ca171){return{'name':_0x2ca171[_0x260f('0x31')],'type':_0x2ca171['type'][_0x260f('0x32')]};});_0x4fa97b['model']=_[_0x260f('0x2e')](_0x4a3d65,_0x260f('0x2b'));_0x4fa97b['query']=_['keys'](_0x1c30d6[_0x260f('0x33')]);_0x4fa97b[_0x260f('0x34')]=_[_0x260f('0x35')](_0x4fa97b[_0x260f('0x36')],_0x4fa97b[_0x260f('0x33')]);_0x5d138a[_0x260f('0x37')]=_['intersection'](_0x4fa97b[_0x260f('0x36')],qs[_0x260f('0x38')](_0x1c30d6[_0x260f('0x33')][_0x260f('0x38')]));_0x5d138a[_0x260f('0x37')]=_0x5d138a[_0x260f('0x37')][_0x260f('0x39')]?_0x5d138a['attributes']:_0x4fa97b[_0x260f('0x36')];if(!_0x1c30d6[_0x260f('0x33')][_0x260f('0x3a')](_0x260f('0x3b'))){_0x5d138a['limit']=qs[_0x260f('0x1e')](_0x1c30d6[_0x260f('0x33')][_0x260f('0x1e')]);_0x5d138a[_0x260f('0x1d')]=qs[_0x260f('0x1d')](_0x1c30d6[_0x260f('0x33')]['offset']);}_0x5d138a[_0x260f('0x3c')]=qs[_0x260f('0x3d')](_0x1c30d6[_0x260f('0x33')]['sort']);_0x5d138a[_0x260f('0x3e')]=qs[_0x260f('0x34')](_['pick'](_0x1c30d6[_0x260f('0x33')],_0x4fa97b[_0x260f('0x34')]),_0x4a3d65);if(_0x1c30d6[_0x260f('0x33')][_0x260f('0x3f')]){_0x5d138a[_0x260f('0x3e')]=_['merge'](_0x5d138a[_0x260f('0x3e')],{'$or':_[_0x260f('0x2e')](_0x4a3d65,function(_0x4b5ffe){if(_0x4b5ffe[_0x260f('0x40')]!==_0x260f('0x41')){var _0x5781ac={};_0x5781ac[_0x4b5ffe[_0x260f('0x2b')]]={'$like':'%'+_0x1c30d6[_0x260f('0x33')][_0x260f('0x3f')]+'%'};return _0x5781ac;}})});}_0x5d138a=_[_0x260f('0x42')]({},_0x5d138a,_0x1c30d6[_0x260f('0x43')]);var _0x4d0026={'where':_0x5d138a[_0x260f('0x3e')]};return db[_0x260f('0x2f')][_0x260f('0x44')](_0x4d0026)[_0x260f('0x26')](function(_0x2a4271){_0x4fa171['count']=_0x2a4271;if(_0x1c30d6['query'][_0x260f('0x45')]){_0x5d138a['include']=[{'all':!![]}];}return db['ZohoField'][_0x260f('0x46')](_0x5d138a);})[_0x260f('0x26')](function(_0x27872a){_0x4fa171[_0x260f('0x47')]=_0x27872a;return _0x4fa171;})[_0x260f('0x26')](respondWithFilteredResult(_0x19bb62,_0x5d138a))[_0x260f('0x48')](handleError(_0x19bb62,null));};exports[_0x260f('0x49')]=function(_0x29c8bd,_0x1edcba){var _0x5c2d86={'raw':!![],'where':{'id':_0x29c8bd[_0x260f('0x4a')]['id']}},_0x1dcb55={};_0x1dcb55[_0x260f('0x36')]=_[_0x260f('0x4b')](db[_0x260f('0x2f')][_0x260f('0x30')]);_0x1dcb55[_0x260f('0x33')]=_[_0x260f('0x4b')](_0x29c8bd[_0x260f('0x33')]);_0x1dcb55[_0x260f('0x34')]=_[_0x260f('0x35')](_0x1dcb55[_0x260f('0x36')],_0x1dcb55[_0x260f('0x33')]);_0x5c2d86['attributes']=_['intersection'](_0x1dcb55[_0x260f('0x36')],qs[_0x260f('0x38')](_0x29c8bd['query'][_0x260f('0x38')]));_0x5c2d86[_0x260f('0x37')]=_0x5c2d86[_0x260f('0x37')][_0x260f('0x39')]?_0x5c2d86[_0x260f('0x37')]:_0x1dcb55['model'];if(_0x29c8bd['query'][_0x260f('0x45')]){_0x5c2d86[_0x260f('0x4c')]=[{'all':!![]}];}_0x5c2d86=_[_0x260f('0x42')]({},_0x5c2d86,_0x29c8bd[_0x260f('0x43')]);return db['ZohoField']['find'](_0x5c2d86)[_0x260f('0x26')](handleEntityNotFound(_0x1edcba,null))['then'](respondWithResult(_0x1edcba,null))[_0x260f('0x48')](handleError(_0x1edcba,null));};exports[_0x260f('0x4d')]=function(_0x2e109d,_0xc43207){return db[_0x260f('0x2f')][_0x260f('0x4d')](_0x2e109d[_0x260f('0x4e')],{})['then'](respondWithResult(_0xc43207,0xc9))[_0x260f('0x48')](handleError(_0xc43207,null));};exports[_0x260f('0x25')]=function(_0x282c3c,_0x3e3ee3){if(_0x282c3c[_0x260f('0x4e')]['id']){delete _0x282c3c['body']['id'];}return db[_0x260f('0x2f')][_0x260f('0x4f')]({'where':{'id':_0x282c3c[_0x260f('0x4a')]['id']}})[_0x260f('0x26')](handleEntityNotFound(_0x3e3ee3,null))['then'](saveUpdates(_0x282c3c['body'],null))[_0x260f('0x26')](respondWithResult(_0x3e3ee3,null))[_0x260f('0x48')](handleError(_0x3e3ee3,null));};exports['destroy']=function(_0x25fb61,_0x389015){return db['ZohoField']['find']({'where':{'id':_0x25fb61[_0x260f('0x4a')]['id']}})[_0x260f('0x26')](handleEntityNotFound(_0x389015,null))[_0x260f('0x26')](removeEntity(_0x389015,null))[_0x260f('0x48')](handleError(_0x389015,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 2912055..fc1a8dc 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 _0x0120=['rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5a3c7b,_0x3fad44){var _0x5763f5=function(_0x238f9b){while(--_0x238f9b){_0x5a3c7b['push'](_0x5a3c7b['shift']());}};_0x5763f5(++_0x3fad44);}(_0x0120,0x6f));var _0x0012=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x0120[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var moment=require(_0x0012('0x4'));var BPromise=require(_0x0012('0x5'));var rp=require(_0x0012('0x6'));var fs=require('fs');var path=require(_0x0012('0x7'));var rimraf=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var attributes=require(_0x0012('0xa'));module[_0x0012('0xb')]=function(_0x4eaa5b,_0x4b396c){return _0x4eaa5b['define'](_0x0012('0xc'),attributes,{'tableName':_0x0012('0xd'),'paranoid':![],'indexes':[{'name':_0x0012('0xe'),'fields':[_0x0012('0xf'),_0x0012('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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(_0x5207d3,_0x1b67d4){var _0x36785c=function(_0x11a1d3){while(--_0x11a1d3){_0x5207d3['push'](_0x5207d3['shift']());}};_0x36785c(++_0x1b67d4);}(_0xf61e,0x191));var _0xef61=function(_0x584717,_0x540452){_0x584717=_0x584717-0x0;var _0x20664b=_0xf61e[_0x584717];return _0x20664b;};'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 diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 5b4b305..c4fef58 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 _0x00b6=['ZohoField,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x4007cd,_0x4e90af){var _0x4aa6f8=function(_0x271739){while(--_0x271739){_0x4007cd['push'](_0x4007cd['shift']());}};_0x4aa6f8(++_0x4e90af);}(_0x00b6,0x92));var _0x600b=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0x00b6[_0x25df80];return _0x17b6d0;};'use strict';var _=require(_0x600b('0x0'));var util=require(_0x600b('0x1'));var moment=require(_0x600b('0x2'));var BPromise=require(_0x600b('0x3'));var rs=require(_0x600b('0x4'));var fs=require('fs');var Redis=require(_0x600b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x600b('0x6'))(_0x600b('0x7'));var config=require(_0x600b('0x8'));var jayson=require(_0x600b('0x9'));var client=jayson[_0x600b('0xa')][_0x600b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x266b93,_0xa69250,_0x59f6cc){return new BPromise(function(_0x2137b9,_0xbeefb6){return client[_0x600b('0xc')](_0x266b93,_0x59f6cc)['then'](function(_0xdd173d){logger[_0x600b('0xd')](_0x600b('0xe'),_0xa69250,_0x600b('0xf'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0xa69250,'request\x20sent',JSON['stringify'](_0xdd173d));if(_0xdd173d[_0x600b('0x10')]){if(_0xdd173d[_0x600b('0x10')][_0x600b('0x11')]===0x1f4){logger['error'](_0x600b('0xe'),_0xa69250,_0xdd173d[_0x600b('0x10')][_0x600b('0x12')]);return _0xbeefb6(_0xdd173d[_0x600b('0x10')][_0x600b('0x12')]);}logger['error'](_0x600b('0xe'),_0xa69250,_0xdd173d['error'][_0x600b('0x12')]);return _0x2137b9(_0xdd173d[_0x600b('0x10')][_0x600b('0x12')]);}else{logger[_0x600b('0xd')](_0x600b('0xe'),_0xa69250,_0x600b('0xf'));_0x2137b9(_0xdd173d['result'][_0x600b('0x12')]);}})[_0x600b('0x13')](function(_0x49635c){logger['error'](_0x600b('0xe'),_0xa69250,_0x49635c);_0xbeefb6(_0x49635c);});});} \ No newline at end of file +var _0x4999=['info','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then'];(function(_0x14b1ba,_0x498d37){var _0x57314f=function(_0xb3cd37){while(--_0xb3cd37){_0x14b1ba['push'](_0x14b1ba['shift']());}};_0x57314f(++_0x498d37);}(_0x4999,0xc7));var _0x9499=function(_0x3c498f,_0x1a9eef){_0x3c498f=_0x3c498f-0x0;var _0x2104b8=_0x4999[_0x3c498f];return _0x2104b8;};'use strict';var _=require(_0x9499('0x0'));var util=require(_0x9499('0x1'));var moment=require(_0x9499('0x2'));var BPromise=require(_0x9499('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9499('0x4'));var db=require(_0x9499('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9499('0x6'));var config=require(_0x9499('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9499('0x8')][_0x9499('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x440154,_0x119009,_0x2f8b60){return new BPromise(function(_0x4e931a,_0x2b96d6){return client['request'](_0x440154,_0x2f8b60)[_0x9499('0xa')](function(_0x58207a){logger[_0x9499('0xb')]('ZohoField,\x20%s,\x20%s',_0x119009,'request\x20sent');logger[_0x9499('0xc')](_0x9499('0xd'),_0x119009,_0x9499('0xe'),JSON['stringify'](_0x58207a));if(_0x58207a[_0x9499('0xf')]){if(_0x58207a['error'][_0x9499('0x10')]===0x1f4){logger[_0x9499('0xf')](_0x9499('0x11'),_0x119009,_0x58207a[_0x9499('0xf')][_0x9499('0x12')]);return _0x2b96d6(_0x58207a[_0x9499('0xf')][_0x9499('0x12')]);}logger['error'](_0x9499('0x11'),_0x119009,_0x58207a['error'][_0x9499('0x12')]);return _0x4e931a(_0x58207a[_0x9499('0xf')][_0x9499('0x12')]);}else{logger['info'](_0x9499('0x11'),_0x119009,_0x9499('0xe'));_0x4e931a(_0x58207a[_0x9499('0x13')][_0x9499('0x12')]);}})[_0x9499('0x14')](function(_0x265b51){logger[_0x9499('0xf')](_0x9499('0x11'),_0x119009,_0x265b51);_0x2b96d6(_0x265b51);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 23c14e5..2288536 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x288d65,_0x5d384d){var _0x435590=function(_0x1d8ca8){while(--_0x1d8ca8){_0x288d65['push'](_0x288d65['shift']());}};_0x435590(++_0x5d384d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x50d84b,_0x1d7ea7){_0x50d84b=_0x50d84b-0x0;var _0x6d4270=_0xcb91[_0x50d84b];return _0x6d4270;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3adddb,_0x19cb0d){var _0x2a859b=function(_0x4db2c0){while(--_0x4db2c0){_0x3adddb['push'](_0x3adddb['shift']());}};_0x2a859b(++_0x19cb0d);}(_0xe706,0xa3));var _0x6e70=function(_0x4c974e,_0x513d9e){_0x4c974e=_0x4c974e-0x0;var _0x31327b=_0xe706[_0x4c974e];return _0x31327b;};'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 ed29212..a1d58c7 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 _0x0f0a=['app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x573542,_0x352f0f){var _0x4f709f=function(_0x52d216){while(--_0x52d216){_0x573542['push'](_0x573542['shift']());}};_0x4f709f(++_0x352f0f);}(_0x0f0a,0x6c));var _0xa0f0=function(_0x16b7e5,_0x5305e4){_0x16b7e5=_0x16b7e5-0x0;var _0x40a080=_0x0f0a[_0x16b7e5];return _0x40a080;};'use strict';var Sequelize=require(_0xa0f0('0x0'));module[_0xa0f0('0x1')]={'name':{'type':Sequelize[_0xa0f0('0x2')],'allowNull':![],'unique':_0xa0f0('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa0f0('0x3')},'main':{'type':Sequelize[_0xa0f0('0x2')],'defaultValue':_0xa0f0('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xa0f0('0x2')]},'type':{'type':Sequelize[_0xa0f0('0x2')]},'size':{'type':Sequelize[_0xa0f0('0x5')]},'active':{'type':Sequelize[_0xa0f0('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xa0f0('0x2')]},'logo':{'type':Sequelize[_0xa0f0('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xa0f0('0x7')},'description':{'type':Sequelize[_0xa0f0('0x2')]},'title':{'type':Sequelize[_0xa0f0('0x2')]},'remoteUri':{'type':Sequelize[_0xa0f0('0x2')]},'link':{'type':Sequelize[_0xa0f0('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xee58=['state','sequelize','exports','STRING','unique_name_and_version','INTEGER','BOOLEAN'];(function(_0x1843cf,_0x2f2f09){var _0x4be501=function(_0x5072c5){while(--_0x5072c5){_0x1843cf['push'](_0x1843cf['shift']());}};_0x4be501(++_0x2f2f09);}(_0xee58,0x104));var _0x8ee5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xee58[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8ee5('0x0'));module[_0x8ee5('0x1')]={'name':{'type':Sequelize[_0x8ee5('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x8ee5('0x2')],'allowNull':![],'unique':_0x8ee5('0x3')},'main':{'type':Sequelize[_0x8ee5('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x8ee5('0x2')]},'path':{'type':Sequelize[_0x8ee5('0x2')]},'type':{'type':Sequelize[_0x8ee5('0x2')]},'size':{'type':Sequelize[_0x8ee5('0x4')]},'active':{'type':Sequelize[_0x8ee5('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x8ee5('0x2')]},'logo':{'type':Sequelize[_0x8ee5('0x2')]},'state':{'type':Sequelize[_0x8ee5('0x2')],'unique':_0x8ee5('0x6')},'description':{'type':Sequelize[_0x8ee5('0x2')]},'title':{'type':Sequelize[_0x8ee5('0x2')]},'remoteUri':{'type':Sequelize[_0x8ee5('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 439e164..4e97d50 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 _0x2542=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4d247c,_0x3dff9e){var _0x42c60c=function(_0x399acd){while(--_0x399acd){_0x4d247c['push'](_0x4d247c['shift']());}};_0x42c60c(++_0x3dff9e);}(_0x2542,0x169));var _0x2254=function(_0x5e10c3,_0x3c00d7){_0x5e10c3=_0x5e10c3-0x0;var _0xd3005d=_0x2542[_0x5e10c3];return _0xd3005d;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['Integration'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));}; \ No newline at end of file +var _0x47c5=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','Integration'];(function(_0x4489b5,_0x14659c){var _0x24c873=function(_0x599280){while(--_0x599280){_0x4489b5['push'](_0x4489b5['shift']());}};_0x24c873(++_0x14659c);}(_0x47c5,0x165));var _0x547c=function(_0x1828c3,_0x36d621){_0x1828c3=_0x1828c3-0x0;var _0x2bb9a6=_0x47c5[_0x1828c3];return _0x2bb9a6;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['Integration'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['Integration']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['Integration'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['Integration'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f22cc2c..dc3c2f3 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 _0xf74b=['./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x520a1b,_0x446485){var _0x11bea9=function(_0x2241cc){while(--_0x2241cc){_0x520a1b['push'](_0x520a1b['shift']());}};_0x11bea9(++_0x446485);}(_0xf74b,0xfc));var _0xbf74=function(_0x61e2c3,_0x4957b6){_0x61e2c3=_0x61e2c3-0x0;var _0x37e9d1=_0xf74b[_0x61e2c3];return _0x37e9d1;};'use strict';var _=require(_0xbf74('0x0'));var util=require(_0xbf74('0x1'));var logger=require(_0xbf74('0x2'))(_0xbf74('0x3'));var moment=require(_0xbf74('0x4'));var BPromise=require(_0xbf74('0x5'));var rp=require(_0xbf74('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf74('0x7'));var config=require('../../config/environment');var attributes=require(_0xbf74('0x8'));module[_0xbf74('0x9')]=function(_0x5931c7,_0x29e15e){return _0x5931c7[_0xbf74('0xa')](_0xbf74('0xb'),attributes,{'tableName':_0xbf74('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3715=['path','rimraf','../../config/environment','./integration.attributes','integrations','lodash','util','../../config/logger','request-promise'];(function(_0x5f4cd7,_0x459c44){var _0x47c93f=function(_0x11f384){while(--_0x11f384){_0x5f4cd7['push'](_0x5f4cd7['shift']());}};_0x47c93f(++_0x459c44);}(_0x3715,0x1a3));var _0x5371=function(_0x387602,_0x3693aa){_0x387602=_0x387602-0x0;var _0x1b0b9d=_0x3715[_0x387602];return _0x1b0b9d;};'use strict';var _=require(_0x5371('0x0'));var util=require(_0x5371('0x1'));var logger=require(_0x5371('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5371('0x3'));var fs=require('fs');var path=require(_0x5371('0x4'));var rimraf=require(_0x5371('0x5'));var config=require(_0x5371('0x6'));var attributes=require(_0x5371('0x7'));module['exports']=function(_0x534374,_0xa89bdb){return _0x534374['define']('Integration',attributes,{'tableName':_0x5371('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 f1f0d58..ba9fe8a 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 _0xdd4f=['lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x43c974,_0x55cc7b){var _0x3bb168=function(_0x40063c){while(--_0x40063c){_0x43c974['push'](_0x43c974['shift']());}};_0x3bb168(++_0x55cc7b);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2767cc,_0x1e78e5){_0x2767cc=_0x2767cc-0x0;var _0x3a4d5b=_0xdd4f[_0x2767cc];return _0x3a4d5b;};'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);});});} \ No newline at end of file +var _0xef0f=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x43a7fd,_0xb2af6a){var _0x8547b0=function(_0x51441e){while(--_0x51441e){_0x43a7fd['push'](_0x43a7fd['shift']());}};_0x8547b0(++_0xb2af6a);}(_0xef0f,0x168));var _0xfef0=function(_0x5d8079,_0x3e56ff){_0x5d8079=_0x5d8079-0x0;var _0x1853f0=_0xef0f[_0x5d8079];return _0x1853f0;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('Integration,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index a0c7c24..b6c4b52 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 _0x66fa=['index','get','/describe','post','/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x150654,_0x22e377){var _0x28dbee=function(_0x31703f){while(--_0x31703f){_0x150654['push'](_0x150654['shift']());}};_0x28dbee(++_0x22e377);}(_0x66fa,0x117));var _0xa66f=function(_0x595594,_0x49af70){_0x595594=_0x595594-0x0;var _0x57abd2=_0x66fa[_0x595594];return _0x57abd2;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['describe']);router[_0xa66f('0xb')]('/:id',auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xe'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xf')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0x10')]=router; \ No newline at end of file +var _0x6d38=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','/:id','create','update','destroy','exports','util'];(function(_0x1e6c8c,_0x37b205){var _0x3b3998=function(_0x2e25e6){while(--_0x2e25e6){_0x1e6c8c['push'](_0x1e6c8c['shift']());}};_0x3b3998(++_0x37b205);}(_0x6d38,0x1ef));var _0x86d3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6d38[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['post']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0xc')]);router['put']('/:id',auth[_0x86d3('0x7')](),controller[_0x86d3('0xd')]);router['delete'](_0x86d3('0xb'),auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index fc1bc46..52f526b 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 _0xedf9=['DATE','BOOLEAN','TEXT','ENUM','SENDING','exports','STRING','INTEGER'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xedf9,0x85));var _0x9edf=function(_0x56ad4b,_0x208e9d){_0x56ad4b=_0x56ad4b-0x0;var _0x5992b3=_0xedf9[_0x56ad4b];return _0x5992b3;};'use strict';var Sequelize=require('sequelize');module[_0x9edf('0x0')]={'integration':{'type':Sequelize[_0x9edf('0x1')]},'eventChannel':{'type':Sequelize[_0x9edf('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x9edf('0x1')]},'integrationId':{'type':Sequelize[_0x9edf('0x2')]},'contacts':{'type':Sequelize[_0x9edf('0x1')]},'uniqueid':{'type':Sequelize[_0x9edf('0x1')]},'calleridnum':{'type':Sequelize[_0x9edf('0x1')]},'calleridname':{'type':Sequelize[_0x9edf('0x1')]},'queue':{'type':Sequelize[_0x9edf('0x1')]},'interface':{'type':Sequelize[_0x9edf('0x1')]},'membername':{'type':Sequelize[_0x9edf('0x1')]},'agentcalledAt':{'type':Sequelize[_0x9edf('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9edf('0x3')]},'holdtime':{'type':Sequelize[_0x9edf('0x2')]},'agentcomplete':{'type':Sequelize[_0x9edf('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x9edf('0x3')]},'talktime':{'type':Sequelize[_0x9edf('0x2')]},'agentacw':{'type':Sequelize[_0x9edf('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9edf('0x2')]},'reason':{'type':Sequelize[_0x9edf('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x9edf('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x9edf('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9edf('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x9edf('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edf('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9edf('0x1')]},'context':{'type':Sequelize[_0x9edf('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edf('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edf('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x9edf('0x1')]},'destcalleridname':{'type':Sequelize[_0x9edf('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x9edf('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x9edf('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x9edf('0x1')]},'destexten':{'type':Sequelize[_0x9edf('0x1')]},'destpriority':{'type':Sequelize[_0x9edf('0x1')]},'destuniqueid':{'type':Sequelize[_0x9edf('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x9edf('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x9edf('0x1')]},'to':{'type':Sequelize[_0x9edf('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x9edf('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x9edf('0x5')]},'status':{'type':Sequelize[_0x9edf('0x6')]('SENT',_0x9edf('0x7'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x9edf('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x48a3=['DATE','BOOLEAN','TEXT','SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x48a3,0x74));var _0x348a=function(_0x2e902b,_0x30f6c6){_0x2e902b=_0x2e902b-0x0;var _0x5408a3=_0x48a3[_0x2e902b];return _0x5408a3;};'use strict';var Sequelize=require(_0x348a('0x0'));module[_0x348a('0x1')]={'integration':{'type':Sequelize[_0x348a('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x348a('0x2')]},'ticketId':{'type':Sequelize[_0x348a('0x2')]},'integrationId':{'type':Sequelize[_0x348a('0x3')]},'contacts':{'type':Sequelize[_0x348a('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x348a('0x2')]},'calleridname':{'type':Sequelize[_0x348a('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x348a('0x2')]},'membername':{'type':Sequelize[_0x348a('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x348a('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x348a('0x4')]},'talktime':{'type':Sequelize[_0x348a('0x3')]},'agentacw':{'type':Sequelize[_0x348a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x348a('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x348a('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x348a('0x4')]},'agentdump':{'type':Sequelize[_0x348a('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x348a('0x2')]},'channelstate':{'type':Sequelize[_0x348a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x348a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x348a('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x348a('0x2')]},'context':{'type':Sequelize[_0x348a('0x2')]},'exten':{'type':Sequelize[_0x348a('0x2')]},'priority':{'type':Sequelize[_0x348a('0x2')]},'destchannel':{'type':Sequelize[_0x348a('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x348a('0x2')]},'destcalleridname':{'type':Sequelize[_0x348a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x348a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x348a('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x348a('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x348a('0x2')]},'destuniqueid':{'type':Sequelize[_0x348a('0x2')]},'messageId':{'type':Sequelize[_0x348a('0x2')]},'inReplyTo':{'type':Sequelize[_0x348a('0x2')]},'subject':{'type':Sequelize[_0x348a('0x2')]},'from':{'type':Sequelize[_0x348a('0x2')]},'to':{'type':Sequelize[_0x348a('0x2')]},'cc':{'type':Sequelize[_0x348a('0x2')]},'attachment':{'type':Sequelize[_0x348a('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x348a('0x6')]},'status':{'type':Sequelize['ENUM'](_0x348a('0x7'),'SENDING',_0x348a('0x8'),_0x348a('0x9'))},'url':{'type':Sequelize[_0x348a('0x2')]},'app':{'type':Sequelize[_0x348a('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x348a('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index ad4c863..0cde752 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 _0x5e44=['length','find','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','save','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0x5e44,0x134));var _0x45e4=function(_0x12bcac,_0x3a11c2){_0x12bcac=_0x12bcac-0x0;var _0x3bad58=_0x5e44[_0x12bcac];return _0x3bad58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45e4('0x0'));var zipdir=require(_0x45e4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x45e4('0x2'));var moment=require(_0x45e4('0x3'));var BPromise=require(_0x45e4('0x4'));var Mustache=require(_0x45e4('0x5'));var util=require(_0x45e4('0x6'));var path=require(_0x45e4('0x7'));var sox=require(_0x45e4('0x8'));var csv=require(_0x45e4('0x9'));var ejs=require(_0x45e4('0xa'));var fs=require('fs');var fs_extra=require(_0x45e4('0xb'));var _=require(_0x45e4('0xc'));var squel=require(_0x45e4('0xd'));var crypto=require(_0x45e4('0xe'));var jsforce=require(_0x45e4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x45e4('0x9'));var querystring=require(_0x45e4('0x10'));var Papa=require(_0x45e4('0x11'));var Redis=require(_0x45e4('0x12'));var authService=require(_0x45e4('0x13'));var qs=require(_0x45e4('0x14'));var as=require(_0x45e4('0x15'));var hardwareService=require(_0x45e4('0x16'));var logger=require('../../config/logger')(_0x45e4('0x17'));var utils=require(_0x45e4('0x18'));var config=require(_0x45e4('0x19'));var licenseUtil=require(_0x45e4('0x1a'));var db=require(_0x45e4('0x1b'))['db'];function respondWithStatusCode(_0x356dc7,_0x2cfc9e){_0x2cfc9e=_0x2cfc9e||0xcc;return function(_0x1dd606){if(_0x1dd606){return _0x356dc7[_0x45e4('0x1c')](_0x2cfc9e);}return _0x356dc7[_0x45e4('0x1d')](_0x2cfc9e)[_0x45e4('0x1e')]();};}function respondWithResult(_0x4e0b48,_0x2675ee){_0x2675ee=_0x2675ee||0xc8;return function(_0x3b63c6){if(_0x3b63c6){return _0x4e0b48[_0x45e4('0x1d')](_0x2675ee)[_0x45e4('0x1f')](_0x3b63c6);}};}function respondWithFilteredResult(_0x1b68ca,_0x366b43){return function(_0x368b63){if(_0x368b63){var _0x3d3eb9=typeof _0x366b43[_0x45e4('0x20')]==='undefined'&&typeof _0x366b43[_0x45e4('0x21')]===_0x45e4('0x22');var _0xe06576=_0x368b63[_0x45e4('0x23')];var _0x2d8776=_0x3d3eb9?0x0:_0x366b43[_0x45e4('0x20')];var _0x382d0a=_0x3d3eb9?_0x368b63['count']:_0x366b43[_0x45e4('0x20')]+_0x366b43[_0x45e4('0x21')];var _0x2d02fa;if(_0x382d0a>=_0xe06576){_0x382d0a=_0xe06576;_0x2d02fa=0xc8;}else{_0x2d02fa=0xce;}_0x1b68ca[_0x45e4('0x1d')](_0x2d02fa);return _0x1b68ca['set']('Content-Range',_0x2d8776+'-'+_0x382d0a+'/'+_0xe06576)[_0x45e4('0x1f')](_0x368b63);}return null;};}function patchUpdates(_0x5ebd51){return function(_0x81c532){try{jsonpatch[_0x45e4('0x24')](_0x81c532,_0x5ebd51,!![]);}catch(_0x271787){return BPromise['reject'](_0x271787);}return _0x81c532[_0x45e4('0x25')]();};}function saveUpdates(_0xb2d96e,_0x15da5d){return function(_0x1d0cf2){if(_0x1d0cf2){return _0x1d0cf2[_0x45e4('0x26')](_0xb2d96e)[_0x45e4('0x27')](function(_0x15ae3e){return _0x15ae3e;});}return null;};}function removeEntity(_0x11b887,_0x328eef){return function(_0xa9203c){if(_0xa9203c){return _0xa9203c[_0x45e4('0x28')]()['then'](function(){_0x11b887[_0x45e4('0x1d')](0xcc)[_0x45e4('0x1e')]();});}};}function handleEntityNotFound(_0xb2d7c,_0x3acfa2){return function(_0x9d278c){if(!_0x9d278c){_0xb2d7c[_0x45e4('0x1c')](0x194);}return _0x9d278c;};}function handleError(_0x2454fc,_0xfabdc2){_0xfabdc2=_0xfabdc2||0x1f4;return function(_0x2f8efd){logger[_0x45e4('0x29')](_0x2f8efd[_0x45e4('0x2a')]);if(_0x2f8efd[_0x45e4('0x2b')]){delete _0x2f8efd[_0x45e4('0x2b')];}_0x2454fc['status'](_0xfabdc2)[_0x45e4('0x2c')](_0x2f8efd);};}exports[_0x45e4('0x2d')]=function(_0x518a15,_0x158ada){var _0x149bed={},_0x2b09d7={},_0x360efc={'count':0x0,'rows':[]};var _0x22d27c=_[_0x45e4('0x2e')](db[_0x45e4('0x2f')][_0x45e4('0x30')],function(_0x37680f){return{'name':_0x37680f[_0x45e4('0x31')],'type':_0x37680f[_0x45e4('0x32')][_0x45e4('0x33')]};});_0x2b09d7[_0x45e4('0x34')]=_['map'](_0x22d27c,_0x45e4('0x2b'));_0x2b09d7[_0x45e4('0x35')]=_['keys'](_0x518a15[_0x45e4('0x35')]);_0x2b09d7[_0x45e4('0x36')]=_[_0x45e4('0x37')](_0x2b09d7[_0x45e4('0x34')],_0x2b09d7[_0x45e4('0x35')]);_0x149bed[_0x45e4('0x38')]=_[_0x45e4('0x37')](_0x2b09d7['model'],qs[_0x45e4('0x39')](_0x518a15['query']['fields']));_0x149bed[_0x45e4('0x38')]=_0x149bed[_0x45e4('0x38')]['length']?_0x149bed[_0x45e4('0x38')]:_0x2b09d7[_0x45e4('0x34')];if(!_0x518a15['query']['hasOwnProperty'](_0x45e4('0x3a'))){_0x149bed[_0x45e4('0x21')]=qs[_0x45e4('0x21')](_0x518a15[_0x45e4('0x35')][_0x45e4('0x21')]);_0x149bed[_0x45e4('0x20')]=qs[_0x45e4('0x20')](_0x518a15[_0x45e4('0x35')][_0x45e4('0x20')]);}_0x149bed[_0x45e4('0x3b')]=qs[_0x45e4('0x3c')](_0x518a15[_0x45e4('0x35')]['sort']);_0x149bed[_0x45e4('0x3d')]=qs[_0x45e4('0x36')](_[_0x45e4('0x3e')](_0x518a15[_0x45e4('0x35')],_0x2b09d7[_0x45e4('0x36')]),_0x22d27c);if(_0x518a15[_0x45e4('0x35')][_0x45e4('0x3f')]){_0x149bed[_0x45e4('0x3d')]=_[_0x45e4('0x40')](_0x149bed['where'],{'$or':_[_0x45e4('0x2e')](_0x22d27c,function(_0x2c2c8f){if(_0x2c2c8f[_0x45e4('0x32')]!=='VIRTUAL'){var _0x2e37c4={};_0x2e37c4[_0x2c2c8f['name']]={'$like':'%'+_0x518a15['query'][_0x45e4('0x3f')]+'%'};return _0x2e37c4;}})});}_0x149bed=_['merge']({},_0x149bed,_0x518a15[_0x45e4('0x41')]);var _0x19a0bd={'where':_0x149bed[_0x45e4('0x3d')]};return db[_0x45e4('0x2f')][_0x45e4('0x23')](_0x19a0bd)[_0x45e4('0x27')](function(_0x26544c){_0x360efc['count']=_0x26544c;if(_0x518a15[_0x45e4('0x35')][_0x45e4('0x42')]){_0x149bed[_0x45e4('0x43')]=[{'all':!![]}];}return db[_0x45e4('0x2f')][_0x45e4('0x44')](_0x149bed);})[_0x45e4('0x27')](function(_0x3db210){_0x360efc[_0x45e4('0x45')]=_0x3db210;return _0x360efc;})[_0x45e4('0x27')](respondWithFilteredResult(_0x158ada,_0x149bed))[_0x45e4('0x46')](handleError(_0x158ada,null));};exports['show']=function(_0x362345,_0x580550){var _0x508733={'raw':![],'where':{'id':_0x362345[_0x45e4('0x47')]['id']}},_0x26feb2={};_0x26feb2['model']=_['keys'](db[_0x45e4('0x2f')][_0x45e4('0x30')]);_0x26feb2[_0x45e4('0x35')]=_['keys'](_0x362345[_0x45e4('0x35')]);_0x26feb2[_0x45e4('0x36')]=_[_0x45e4('0x37')](_0x26feb2[_0x45e4('0x34')],_0x26feb2[_0x45e4('0x35')]);_0x508733[_0x45e4('0x38')]=_[_0x45e4('0x37')](_0x26feb2[_0x45e4('0x34')],qs['fields'](_0x362345[_0x45e4('0x35')][_0x45e4('0x39')]));_0x508733[_0x45e4('0x38')]=_0x508733[_0x45e4('0x38')][_0x45e4('0x48')]?_0x508733[_0x45e4('0x38')]:_0x26feb2[_0x45e4('0x34')];if(_0x362345['query'][_0x45e4('0x42')]){_0x508733[_0x45e4('0x43')]=[{'all':!![]}];}_0x508733=_[_0x45e4('0x40')]({},_0x508733,_0x362345[_0x45e4('0x41')]);return db['IntegrationReport'][_0x45e4('0x49')](_0x508733)['then'](handleEntityNotFound(_0x580550,null))[_0x45e4('0x27')](respondWithResult(_0x580550,null))[_0x45e4('0x46')](handleError(_0x580550,null));};exports['create']=function(_0x2439e7,_0x4c4d15){return db['IntegrationReport']['create'](_0x2439e7[_0x45e4('0x4a')],{})[_0x45e4('0x27')](respondWithResult(_0x4c4d15,0xc9))[_0x45e4('0x46')](handleError(_0x4c4d15,null));};exports[_0x45e4('0x26')]=function(_0x430f3c,_0x351f54){if(_0x430f3c[_0x45e4('0x4a')]['id']){delete _0x430f3c[_0x45e4('0x4a')]['id'];}return db['IntegrationReport'][_0x45e4('0x49')]({'where':{'id':_0x430f3c[_0x45e4('0x47')]['id']}})['then'](handleEntityNotFound(_0x351f54,null))[_0x45e4('0x27')](saveUpdates(_0x430f3c[_0x45e4('0x4a')],null))[_0x45e4('0x27')](respondWithResult(_0x351f54,null))['catch'](handleError(_0x351f54,null));};exports[_0x45e4('0x28')]=function(_0xdb6b13,_0x5caaf2){return db[_0x45e4('0x2f')][_0x45e4('0x49')]({'where':{'id':_0xdb6b13[_0x45e4('0x47')]['id']}})['then'](handleEntityNotFound(_0x5caaf2,null))['then'](removeEntity(_0x5caaf2,null))[_0x45e4('0x46')](handleError(_0x5caaf2,null));};exports[_0x45e4('0x4b')]=function(_0x490289,_0x19d7ef){return db[_0x45e4('0x2f')][_0x45e4('0x4b')]()[_0x45e4('0x27')](respondWithResult(_0x19d7ef,null))[_0x45e4('0x46')](handleError(_0x19d7ef,null));}; \ No newline at end of file +var _0x9886=['options','include','findAll','show','params','fields','length','includeAll','create','body','find','catch','describe','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0xc96f24,_0x45e3b8){var _0x254a3f=function(_0x182b01){while(--_0x182b01){_0xc96f24['push'](_0xc96f24['shift']());}};_0x254a3f(++_0x45e3b8);}(_0x9886,0xa3));var _0x6988=function(_0x5f4fa9,_0x16d7a8){_0x5f4fa9=_0x5f4fa9-0x0;var _0x257d7f=_0x9886[_0x5f4fa9];return _0x257d7f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6988('0x0'));var zipdir=require(_0x6988('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6988('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6988('0x3'));var util=require('util');var path=require(_0x6988('0x4'));var sox=require(_0x6988('0x5'));var csv=require(_0x6988('0x6'));var ejs=require(_0x6988('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6988('0x8'));var jsforce=require(_0x6988('0x9'));var deskjs=require(_0x6988('0xa'));var toCsv=require(_0x6988('0x6'));var querystring=require(_0x6988('0xb'));var Papa=require(_0x6988('0xc'));var Redis=require(_0x6988('0xd'));var authService=require(_0x6988('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6988('0xf'));var logger=require(_0x6988('0x10'))(_0x6988('0x11'));var utils=require(_0x6988('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x6988('0x13'));var db=require(_0x6988('0x14'))['db'];function respondWithStatusCode(_0x5cfafc,_0x471fe5){_0x471fe5=_0x471fe5||0xcc;return function(_0x4c3488){if(_0x4c3488){return _0x5cfafc[_0x6988('0x15')](_0x471fe5);}return _0x5cfafc[_0x6988('0x16')](_0x471fe5)['end']();};}function respondWithResult(_0x5d4b5c,_0x4b1cc5){_0x4b1cc5=_0x4b1cc5||0xc8;return function(_0x4c08ec){if(_0x4c08ec){return _0x5d4b5c[_0x6988('0x16')](_0x4b1cc5)['json'](_0x4c08ec);}};}function respondWithFilteredResult(_0x4d3086,_0x5245cb){return function(_0x6c15c2){if(_0x6c15c2){var _0x49dc76=typeof _0x5245cb['offset']===_0x6988('0x17')&&typeof _0x5245cb[_0x6988('0x18')]===_0x6988('0x17');var _0x32ed83=_0x6c15c2[_0x6988('0x19')];var _0x48c2f4=_0x49dc76?0x0:_0x5245cb[_0x6988('0x1a')];var _0x67f2ba=_0x49dc76?_0x6c15c2[_0x6988('0x19')]:_0x5245cb[_0x6988('0x1a')]+_0x5245cb['limit'];var _0x295553;if(_0x67f2ba>=_0x32ed83){_0x67f2ba=_0x32ed83;_0x295553=0xc8;}else{_0x295553=0xce;}_0x4d3086['status'](_0x295553);return _0x4d3086[_0x6988('0x1b')](_0x6988('0x1c'),_0x48c2f4+'-'+_0x67f2ba+'/'+_0x32ed83)[_0x6988('0x1d')](_0x6c15c2);}return null;};}function patchUpdates(_0x209252){return function(_0x545a46){try{jsonpatch[_0x6988('0x1e')](_0x545a46,_0x209252,!![]);}catch(_0x2a495f){return BPromise[_0x6988('0x1f')](_0x2a495f);}return _0x545a46[_0x6988('0x20')]();};}function saveUpdates(_0x588e5a,_0x1a128b){return function(_0x28b7d4){if(_0x28b7d4){return _0x28b7d4[_0x6988('0x21')](_0x588e5a)[_0x6988('0x22')](function(_0x2ee577){return _0x2ee577;});}return null;};}function removeEntity(_0x404b59,_0x4d9a67){return function(_0x11ed1f){if(_0x11ed1f){return _0x11ed1f[_0x6988('0x23')]()[_0x6988('0x22')](function(){_0x404b59['status'](0xcc)[_0x6988('0x24')]();});}};}function handleEntityNotFound(_0x28b030,_0x4603ed){return function(_0x326a9b){if(!_0x326a9b){_0x28b030[_0x6988('0x15')](0x194);}return _0x326a9b;};}function handleError(_0x4b3d71,_0x428e62){_0x428e62=_0x428e62||0x1f4;return function(_0x57a40f){logger[_0x6988('0x25')](_0x57a40f[_0x6988('0x26')]);if(_0x57a40f[_0x6988('0x27')]){delete _0x57a40f[_0x6988('0x27')];}_0x4b3d71[_0x6988('0x16')](_0x428e62)['send'](_0x57a40f);};}exports[_0x6988('0x28')]=function(_0x2a7256,_0x1d44f1){var _0x510ff2={},_0x8d56ee={},_0x332a68={'count':0x0,'rows':[]};var _0x1b4ab5=_[_0x6988('0x29')](db[_0x6988('0x2a')][_0x6988('0x2b')],function(_0x2478e5){return{'name':_0x2478e5[_0x6988('0x2c')],'type':_0x2478e5[_0x6988('0x2d')][_0x6988('0x2e')]};});_0x8d56ee[_0x6988('0x2f')]=_[_0x6988('0x29')](_0x1b4ab5,_0x6988('0x27'));_0x8d56ee[_0x6988('0x30')]=_[_0x6988('0x31')](_0x2a7256['query']);_0x8d56ee[_0x6988('0x32')]=_['intersection'](_0x8d56ee[_0x6988('0x2f')],_0x8d56ee[_0x6988('0x30')]);_0x510ff2[_0x6988('0x33')]=_[_0x6988('0x34')](_0x8d56ee['model'],qs['fields'](_0x2a7256['query']['fields']));_0x510ff2[_0x6988('0x33')]=_0x510ff2[_0x6988('0x33')]['length']?_0x510ff2[_0x6988('0x33')]:_0x8d56ee[_0x6988('0x2f')];if(!_0x2a7256[_0x6988('0x30')][_0x6988('0x35')](_0x6988('0x36'))){_0x510ff2[_0x6988('0x18')]=qs[_0x6988('0x18')](_0x2a7256[_0x6988('0x30')][_0x6988('0x18')]);_0x510ff2['offset']=qs[_0x6988('0x1a')](_0x2a7256[_0x6988('0x30')][_0x6988('0x1a')]);}_0x510ff2[_0x6988('0x37')]=qs[_0x6988('0x38')](_0x2a7256['query'][_0x6988('0x38')]);_0x510ff2[_0x6988('0x39')]=qs[_0x6988('0x32')](_[_0x6988('0x3a')](_0x2a7256['query'],_0x8d56ee[_0x6988('0x32')]),_0x1b4ab5);if(_0x2a7256[_0x6988('0x30')][_0x6988('0x3b')]){_0x510ff2[_0x6988('0x39')]=_[_0x6988('0x3c')](_0x510ff2[_0x6988('0x39')],{'$or':_[_0x6988('0x29')](_0x1b4ab5,function(_0x19b0b3){if(_0x19b0b3['type']!==_0x6988('0x3d')){var _0x15e0ea={};_0x15e0ea[_0x19b0b3[_0x6988('0x27')]]={'$like':'%'+_0x2a7256['query'][_0x6988('0x3b')]+'%'};return _0x15e0ea;}})});}_0x510ff2=_['merge']({},_0x510ff2,_0x2a7256[_0x6988('0x3e')]);var _0x3e2ee8={'where':_0x510ff2[_0x6988('0x39')]};return db[_0x6988('0x2a')][_0x6988('0x19')](_0x3e2ee8)[_0x6988('0x22')](function(_0x42374f){_0x332a68['count']=_0x42374f;if(_0x2a7256[_0x6988('0x30')]['includeAll']){_0x510ff2[_0x6988('0x3f')]=[{'all':!![]}];}return db[_0x6988('0x2a')][_0x6988('0x40')](_0x510ff2);})[_0x6988('0x22')](function(_0x3f440a){_0x332a68['rows']=_0x3f440a;return _0x332a68;})['then'](respondWithFilteredResult(_0x1d44f1,_0x510ff2))['catch'](handleError(_0x1d44f1,null));};exports[_0x6988('0x41')]=function(_0x25c914,_0x21d3b8){var _0xab25f5={'raw':![],'where':{'id':_0x25c914[_0x6988('0x42')]['id']}},_0x3a6042={};_0x3a6042['model']=_[_0x6988('0x31')](db[_0x6988('0x2a')]['rawAttributes']);_0x3a6042[_0x6988('0x30')]=_['keys'](_0x25c914[_0x6988('0x30')]);_0x3a6042[_0x6988('0x32')]=_[_0x6988('0x34')](_0x3a6042[_0x6988('0x2f')],_0x3a6042['query']);_0xab25f5[_0x6988('0x33')]=_[_0x6988('0x34')](_0x3a6042[_0x6988('0x2f')],qs['fields'](_0x25c914[_0x6988('0x30')][_0x6988('0x43')]));_0xab25f5[_0x6988('0x33')]=_0xab25f5[_0x6988('0x33')][_0x6988('0x44')]?_0xab25f5[_0x6988('0x33')]:_0x3a6042[_0x6988('0x2f')];if(_0x25c914[_0x6988('0x30')][_0x6988('0x45')]){_0xab25f5[_0x6988('0x3f')]=[{'all':!![]}];}_0xab25f5=_[_0x6988('0x3c')]({},_0xab25f5,_0x25c914[_0x6988('0x3e')]);return db[_0x6988('0x2a')]['find'](_0xab25f5)[_0x6988('0x22')](handleEntityNotFound(_0x21d3b8,null))[_0x6988('0x22')](respondWithResult(_0x21d3b8,null))['catch'](handleError(_0x21d3b8,null));};exports[_0x6988('0x46')]=function(_0x9f064d,_0x30c386){return db[_0x6988('0x2a')]['create'](_0x9f064d[_0x6988('0x47')],{})[_0x6988('0x22')](respondWithResult(_0x30c386,0xc9))['catch'](handleError(_0x30c386,null));};exports[_0x6988('0x21')]=function(_0x1ad9f7,_0x41c6fe){if(_0x1ad9f7[_0x6988('0x47')]['id']){delete _0x1ad9f7['body']['id'];}return db[_0x6988('0x2a')][_0x6988('0x48')]({'where':{'id':_0x1ad9f7[_0x6988('0x42')]['id']}})[_0x6988('0x22')](handleEntityNotFound(_0x41c6fe,null))[_0x6988('0x22')](saveUpdates(_0x1ad9f7['body'],null))[_0x6988('0x22')](respondWithResult(_0x41c6fe,null))[_0x6988('0x49')](handleError(_0x41c6fe,null));};exports[_0x6988('0x23')]=function(_0x5b5afd,_0x3c3e26){return db[_0x6988('0x2a')]['find']({'where':{'id':_0x5b5afd[_0x6988('0x42')]['id']}})[_0x6988('0x22')](handleEntityNotFound(_0x3c3e26,null))[_0x6988('0x22')](removeEntity(_0x3c3e26,null))[_0x6988('0x49')](handleError(_0x3c3e26,null));};exports[_0x6988('0x4a')]=function(_0x3579c1,_0x3eb199){return db[_0x6988('0x2a')][_0x6988('0x4a')]()[_0x6988('0x22')](respondWithResult(_0x3eb199,null))[_0x6988('0x49')](handleError(_0x3eb199,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 45c7eda..72c1266 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 _0x4cef=['IntegrationReport','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x4cef,0x85));var _0xf4ce=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0x4cef[_0x592e40];return _0x5d4288;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4ce('0x0'))(_0xf4ce('0x1'));var moment=require(_0xf4ce('0x2'));var BPromise=require('bluebird');var rp=require(_0xf4ce('0x3'));var fs=require('fs');var path=require(_0xf4ce('0x4'));var rimraf=require(_0xf4ce('0x5'));var config=require(_0xf4ce('0x6'));var attributes=require(_0xf4ce('0x7'));module[_0xf4ce('0x8')]=function(_0x27a422,_0x12b081){return _0x27a422[_0xf4ce('0x9')](_0xf4ce('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9f1=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_integration','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd9f1,0x1c6));var _0x1d9f=function(_0x4c1d49,_0x5ecfc1){_0x4c1d49=_0x4c1d49-0x0;var _0x389663=_0xd9f1[_0x4c1d49];return _0x389663;};'use strict';var _=require(_0x1d9f('0x0'));var util=require(_0x1d9f('0x1'));var logger=require(_0x1d9f('0x2'))(_0x1d9f('0x3'));var moment=require(_0x1d9f('0x4'));var BPromise=require(_0x1d9f('0x5'));var rp=require(_0x1d9f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d9f('0x7'));var config=require(_0x1d9f('0x8'));var attributes=require('./integrationReport.attributes');module[_0x1d9f('0x9')]=function(_0x56058a,_0xc8d87a){return _0x56058a[_0x1d9f('0xa')]('IntegrationReport',attributes,{'tableName':_0x1d9f('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 b8f0bc5..5324338 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 _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(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x53ec,0x192));var _0xc53e=function(_0x3b0265,_0x54c4b6){_0x3b0265=_0x3b0265-0x0;var _0x4d6215=_0x53ec[_0x3b0265];return _0x4d6215;};'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 +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xc2c7,0x134));var _0x7c2c=function(_0x5a2eb3,_0x10cdbc){_0x5a2eb3=_0x5a2eb3-0x0;var _0x3e5ed6=_0xc2c7[_0x5a2eb3];return _0x3e5ed6;};'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')]('IntegrationReport,\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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 4f7ad41..ad7db00 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 _0x3148=['put','update','delete','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many'];(function(_0x586480,_0x2546ca){var _0x2f51d5=function(_0x2e7ab7){while(--_0x2e7ab7){_0x586480['push'](_0x586480['shift']());}};_0x2f51d5(++_0x2546ca);}(_0x3148,0x1d3));var _0x8314=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0x3148[_0x1034bb];return _0x453fdb;};'use strict';var multer=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var path=require('path');var timeout=require(_0x8314('0x2'));var express=require(_0x8314('0x3'));var router=express[_0x8314('0x4')]();var fs_extra=require(_0x8314('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8314('0x6'));var config=require(_0x8314('0x7'));var controller=require(_0x8314('0x8'));router[_0x8314('0x9')]('/',auth[_0x8314('0xa')](),controller[_0x8314('0xb')]);router[_0x8314('0x9')]('/:id',auth[_0x8314('0xa')](),controller['show']);router[_0x8314('0x9')](_0x8314('0xc'),auth[_0x8314('0xa')](),controller[_0x8314('0xd')]);router[_0x8314('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8314('0xe')](_0x8314('0xc'),auth[_0x8314('0xa')](),controller[_0x8314('0xf')]);router['post'](_0x8314('0x10'),auth[_0x8314('0xa')](),controller['addIntervals']);router[_0x8314('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8314('0x12')]);router[_0x8314('0x13')](_0x8314('0x14'),auth[_0x8314('0xa')](),controller['destroy']);module[_0x8314('0x15')]=router; \ No newline at end of file +var _0x3ca4=['index','/:id','isAuthenticated','show','/:id/sub_intervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3ca4,0x17d));var _0x43ca=function(_0xb67a3b,_0x512911){_0xb67a3b=_0xb67a3b-0x0;var _0xf8c8c7=_0x3ca4[_0xb67a3b];return _0xf8c8c7;};'use strict';var multer=require(_0x43ca('0x0'));var util=require(_0x43ca('0x1'));var path=require(_0x43ca('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x43ca('0x3')]();var fs_extra=require(_0x43ca('0x4'));var auth=require(_0x43ca('0x5'));var interaction=require(_0x43ca('0x6'));var config=require(_0x43ca('0x7'));var controller=require(_0x43ca('0x8'));router[_0x43ca('0x9')]('/',auth['isAuthenticated'](),controller[_0x43ca('0xa')]);router[_0x43ca('0x9')](_0x43ca('0xb'),auth[_0x43ca('0xc')](),controller[_0x43ca('0xd')]);router[_0x43ca('0x9')](_0x43ca('0xe'),auth[_0x43ca('0xc')](),controller['getIntervals']);router['post']('/',auth[_0x43ca('0xc')](),controller[_0x43ca('0xf')]);router[_0x43ca('0x10')](_0x43ca('0xe'),auth['isAuthenticated'](),controller[_0x43ca('0x11')]);router[_0x43ca('0x10')](_0x43ca('0x12'),auth[_0x43ca('0xc')](),controller[_0x43ca('0x13')]);router[_0x43ca('0x14')](_0x43ca('0xb'),auth[_0x43ca('0xc')](),controller[_0x43ca('0x15')]);router['delete'](_0x43ca('0xb'),auth[_0x43ca('0xc')](),controller['destroy']);module[_0x43ca('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 8027fb9..ee19292 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 _0x309c=['exports','STRING'];(function(_0x5890b,_0x3883c7){var _0xaaed57=function(_0x270592){while(--_0x270592){_0x5890b['push'](_0x5890b['shift']());}};_0xaaed57(++_0x3883c7);}(_0x309c,0xc8));var _0xc309=function(_0x546fe6,_0x1a9263){_0x546fe6=_0x546fe6-0x0;var _0x2a3db1=_0x309c[_0x546fe6];return _0x2a3db1;};'use strict';var Sequelize=require('sequelize');module[_0xc309('0x0')]={'name':{'type':Sequelize[_0xc309('0x1')]},'description':{'type':Sequelize[_0xc309('0x1')]},'interval':{'type':Sequelize[_0xc309('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x4f1f=['sequelize','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4f1f,0x96));var _0xf4f1=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x4f1f[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0xf4f1('0x0'));module['exports']={'name':{'type':Sequelize[_0xf4f1('0x1')]},'description':{'type':Sequelize[_0xf4f1('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 88cd12f..6a88692 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 _0x7576=['index','Interval','fieldName','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','create','user','role','get','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addInterval','params','getIntervals','findOne','order','addIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','then','destroy','Intervals','UserProfileResource','name','send'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x7576,0x1d8));var _0x6757=function(_0x2e69ff,_0x1ce11a){_0x2e69ff=_0x2e69ff-0x0;var _0x3cd280=_0x7576[_0x2e69ff];return _0x3cd280;};'use strict';var emlformat=require(_0x6757('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6757('0x2'));var moment=require(_0x6757('0x3'));var BPromise=require(_0x6757('0x4'));var Mustache=require(_0x6757('0x5'));var util=require(_0x6757('0x6'));var path=require('path');var sox=require(_0x6757('0x7'));var csv=require(_0x6757('0x8'));var ejs=require(_0x6757('0x9'));var fs=require('fs');var fs_extra=require(_0x6757('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6757('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6757('0x8'));var querystring=require(_0x6757('0xc'));var Papa=require(_0x6757('0xd'));var Redis=require(_0x6757('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6757('0xf'));var as=require(_0x6757('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6757('0x11'));var utils=require(_0x6757('0x12'));var config=require(_0x6757('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6757('0x14'))['db'];var extensions=require(_0x6757('0x15'));function respondWithStatusCode(_0x548eb1,_0x32548f){_0x32548f=_0x32548f||0xcc;return function(_0x151a4e){if(_0x151a4e){return _0x548eb1[_0x6757('0x16')](_0x32548f);}return _0x548eb1[_0x6757('0x17')](_0x32548f)['end']();};}function respondWithResult(_0x5bdd15,_0x5762ad){_0x5762ad=_0x5762ad||0xc8;return function(_0x273d49){if(_0x273d49){return _0x5bdd15[_0x6757('0x17')](_0x5762ad)[_0x6757('0x18')](_0x273d49);}};}function respondWithFilteredResult(_0x14b564,_0x2b16b7){return function(_0xba31b0){if(_0xba31b0){var _0x47a994=typeof _0x2b16b7[_0x6757('0x19')]==='undefined'&&typeof _0x2b16b7[_0x6757('0x1a')]===_0x6757('0x1b');var _0xe82448=_0xba31b0[_0x6757('0x1c')];var _0xbb36a5=_0x47a994?0x0:_0x2b16b7[_0x6757('0x19')];var _0x5417ef=_0x47a994?_0xba31b0['count']:_0x2b16b7[_0x6757('0x19')]+_0x2b16b7[_0x6757('0x1a')];var _0xfeabe7;if(_0x5417ef>=_0xe82448){_0x5417ef=_0xe82448;_0xfeabe7=0xc8;}else{_0xfeabe7=0xce;}_0x14b564[_0x6757('0x17')](_0xfeabe7);return _0x14b564['set']('Content-Range',_0xbb36a5+'-'+_0x5417ef+'/'+_0xe82448)['json'](_0xba31b0);}return null;};}function patchUpdates(_0x1d5e6f){return function(_0x1a1de4){try{jsonpatch[_0x6757('0x1d')](_0x1a1de4,_0x1d5e6f,!![]);}catch(_0x426f83){return BPromise[_0x6757('0x1e')](_0x426f83);}return _0x1a1de4[_0x6757('0x1f')]();};}function saveUpdates(_0x25e609,_0x19940f){return function(_0x481717){if(_0x481717){return _0x481717['update'](_0x25e609)[_0x6757('0x20')](function(_0x23664e){return _0x23664e;});}return null;};}function removeEntity(_0x20ddc6,_0x3ed266){return function(_0x36fbfe){if(_0x36fbfe){return _0x36fbfe[_0x6757('0x21')]()[_0x6757('0x20')](function(){var _0x583ad7=_0x36fbfe['get']({'plain':!![]});var _0x11c51d=_0x6757('0x22');return db[_0x6757('0x23')][_0x6757('0x21')]({'where':{'type':_0x11c51d,'resourceId':_0x583ad7['id']}})['then'](function(){return _0x36fbfe;});})[_0x6757('0x20')](function(){_0x20ddc6[_0x6757('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x357eac,_0x46e7ca){return function(_0x1e1801){if(!_0x1e1801){_0x357eac[_0x6757('0x16')](0x194);}return _0x1e1801;};}function handleError(_0x14cf04,_0x327e7e){_0x327e7e=_0x327e7e||0x1f4;return function(_0x3df4c3){logger['error'](_0x3df4c3['stack']);if(_0x3df4c3['name']){delete _0x3df4c3[_0x6757('0x24')];}_0x14cf04[_0x6757('0x17')](_0x327e7e)[_0x6757('0x25')](_0x3df4c3);};}exports[_0x6757('0x26')]=function(_0x79645f,_0x2833ba){var _0x293534={},_0x595969={},_0x4d84ed={'count':0x0,'rows':[]};var _0x5222b5=_['map'](db[_0x6757('0x27')]['rawAttributes'],function(_0x435d32){return{'name':_0x435d32[_0x6757('0x28')],'type':_0x435d32['type']['key']};});_0x595969[_0x6757('0x29')]=_[_0x6757('0x2a')](_0x5222b5,_0x6757('0x24'));_0x595969['query']=_[_0x6757('0x2b')](_0x79645f[_0x6757('0x2c')]);_0x595969[_0x6757('0x2d')]=_[_0x6757('0x2e')](_0x595969[_0x6757('0x29')],_0x595969[_0x6757('0x2c')]);_0x293534['attributes']=_[_0x6757('0x2e')](_0x595969[_0x6757('0x29')],qs['fields'](_0x79645f[_0x6757('0x2c')][_0x6757('0x2f')]));_0x293534[_0x6757('0x30')]=_0x293534['attributes'][_0x6757('0x31')]?_0x293534[_0x6757('0x30')]:_0x595969[_0x6757('0x29')];if(!_0x79645f[_0x6757('0x2c')][_0x6757('0x32')](_0x6757('0x33'))){_0x293534[_0x6757('0x1a')]=qs[_0x6757('0x1a')](_0x79645f[_0x6757('0x2c')][_0x6757('0x1a')]);_0x293534[_0x6757('0x19')]=qs[_0x6757('0x19')](_0x79645f[_0x6757('0x2c')][_0x6757('0x19')]);}_0x293534['order']=qs[_0x6757('0x34')](_0x79645f['query'][_0x6757('0x34')]);_0x293534[_0x6757('0x35')]=qs[_0x6757('0x2d')](_[_0x6757('0x36')](_0x79645f[_0x6757('0x2c')],_0x595969[_0x6757('0x2d')]),_0x5222b5);if(_0x79645f[_0x6757('0x2c')][_0x6757('0x37')]){_0x293534[_0x6757('0x35')]=_[_0x6757('0x38')](_0x293534[_0x6757('0x35')],{'$or':_[_0x6757('0x2a')](_0x5222b5,function(_0x5ef3bf){if(_0x5ef3bf[_0x6757('0x39')]!==_0x6757('0x3a')){var _0x32bcd4={};_0x32bcd4[_0x5ef3bf[_0x6757('0x24')]]={'$like':'%'+_0x79645f[_0x6757('0x2c')][_0x6757('0x37')]+'%'};return _0x32bcd4;}})});}_0x293534=_[_0x6757('0x38')]({},_0x293534,_0x79645f[_0x6757('0x3b')]);var _0x51c750={'where':_0x293534['where']};return db[_0x6757('0x27')][_0x6757('0x1c')](_0x51c750)['then'](function(_0x21ab07){_0x4d84ed[_0x6757('0x1c')]=_0x21ab07;if(_0x79645f[_0x6757('0x2c')]['includeAll']){_0x293534[_0x6757('0x3c')]=[{'all':!![]}];}return db['Interval'][_0x6757('0x3d')](_0x293534);})[_0x6757('0x20')](function(_0x3c4e94){_0x4d84ed[_0x6757('0x3e')]=_0x3c4e94;return _0x4d84ed;})[_0x6757('0x20')](respondWithFilteredResult(_0x2833ba,_0x293534))[_0x6757('0x3f')](handleError(_0x2833ba,null));};exports[_0x6757('0x40')]=function(_0x4476df,_0x1ec0b4){var _0x4631a3={'raw':!![],'where':{'id':_0x4476df['params']['id']}},_0x303c42={};_0x303c42[_0x6757('0x29')]=_[_0x6757('0x2b')](db[_0x6757('0x27')][_0x6757('0x41')]);_0x303c42['query']=_[_0x6757('0x2b')](_0x4476df[_0x6757('0x2c')]);_0x303c42[_0x6757('0x2d')]=_[_0x6757('0x2e')](_0x303c42['model'],_0x303c42[_0x6757('0x2c')]);_0x4631a3['attributes']=_[_0x6757('0x2e')](_0x303c42[_0x6757('0x29')],qs[_0x6757('0x2f')](_0x4476df[_0x6757('0x2c')][_0x6757('0x2f')]));_0x4631a3[_0x6757('0x30')]=_0x4631a3[_0x6757('0x30')][_0x6757('0x31')]?_0x4631a3['attributes']:_0x303c42[_0x6757('0x29')];if(_0x4476df[_0x6757('0x2c')]['includeAll']){_0x4631a3['include']=[{'all':!![]}];}_0x4631a3=_[_0x6757('0x38')]({},_0x4631a3,_0x4476df['options']);return db[_0x6757('0x27')]['find'](_0x4631a3)[_0x6757('0x20')](handleEntityNotFound(_0x1ec0b4,null))[_0x6757('0x20')](respondWithResult(_0x1ec0b4,null))[_0x6757('0x3f')](handleError(_0x1ec0b4,null));};exports[_0x6757('0x42')]=function(_0x58b53a,_0x4a7185){return db['Interval'][_0x6757('0x42')](_0x58b53a['body'],{})['then'](function(_0x557d1f){var _0x2620b1=_0x58b53a[_0x6757('0x43')]['get']({'plain':!![]});if(!_0x2620b1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2620b1[_0x6757('0x44')]==='user'){var _0xc23a28=_0x557d1f[_0x6757('0x45')]({'plain':!![]});var _0x7425fb=_0x6757('0x22');return db['UserProfileSection'][_0x6757('0x46')]({'where':{'name':_0x7425fb,'userProfileId':_0x2620b1['userProfileId']},'raw':!![]})['then'](function(_0x17e6d3){if(_0x17e6d3&&_0x17e6d3[_0x6757('0x47')]===0x0){return db[_0x6757('0x23')][_0x6757('0x42')]({'name':_0xc23a28[_0x6757('0x24')],'resourceId':_0xc23a28['id'],'type':_0x17e6d3[_0x6757('0x24')],'sectionId':_0x17e6d3['id']},{})['then'](function(){return _0x557d1f;});}else{return _0x557d1f;}})[_0x6757('0x3f')](function(_0x4bc428){logger['error'](_0x6757('0x48'),_0x4bc428);throw _0x4bc428;});}return _0x557d1f;})[_0x6757('0x20')](respondWithResult(_0x4a7185,0xc9))[_0x6757('0x3f')](handleError(_0x4a7185,null));};exports[_0x6757('0x49')]=function(_0xe0c42f,_0x393043){if(_0xe0c42f[_0x6757('0x4a')]['id']){delete _0xe0c42f[_0x6757('0x4a')]['id'];}return db[_0x6757('0x27')][_0x6757('0x46')]({'where':{'id':_0xe0c42f['params']['id']}})['then'](handleEntityNotFound(_0x393043,null))['then'](saveUpdates(_0xe0c42f['body'],null))[_0x6757('0x20')](respondWithResult(_0x393043,null))[_0x6757('0x3f')](handleError(_0x393043,null));};exports[_0x6757('0x21')]=function(_0x42e2a5,_0x8e3614){return db[_0x6757('0x27')][_0x6757('0x46')]({'where':{'id':_0x42e2a5['params']['id']}})['then'](handleEntityNotFound(_0x8e3614,null))[_0x6757('0x20')](removeEntity(_0x8e3614,null))[_0x6757('0x3f')](handleError(_0x8e3614,null));};exports[_0x6757('0x4b')]=function(_0x42472d,_0x2202d9,_0x110da4){if(_0x42472d[_0x6757('0x4a')]['id']){delete _0x42472d[_0x6757('0x4a')]['id'];}return db[_0x6757('0x27')]['find']({'where':{'id':_0x42472d[_0x6757('0x4c')]['id']}})[_0x6757('0x20')](handleEntityNotFound(_0x2202d9,null))[_0x6757('0x20')](function(_0x21660d){if(_0x21660d){_0x42472d[_0x6757('0x4a')]['IntervalId']=_0x21660d['id'];return db['Interval'][_0x6757('0x42')](_0x42472d[_0x6757('0x4a')]);}})['then'](respondWithResult(_0x2202d9,null))[_0x6757('0x3f')](handleError(_0x2202d9,null));};exports[_0x6757('0x4d')]=function(_0x45e123,_0xf43344,_0x13478f){var _0x15a322={};var _0x2b441d={};var _0x362124;var _0x1248cb;return db['Interval'][_0x6757('0x4e')]({'where':{'id':_0x45e123['params']['id']}})['then'](handleEntityNotFound(_0xf43344,null))[_0x6757('0x20')](function(_0x1e0983){if(_0x1e0983){_0x362124=_0x1e0983;_0x2b441d[_0x6757('0x29')]=_['keys'](db['Interval']['rawAttributes']);_0x2b441d[_0x6757('0x2c')]=_['keys'](_0x45e123['query']);_0x2b441d[_0x6757('0x2d')]=_[_0x6757('0x2e')](_0x2b441d[_0x6757('0x29')],_0x2b441d[_0x6757('0x2c')]);_0x15a322[_0x6757('0x30')]=_[_0x6757('0x2e')](_0x2b441d[_0x6757('0x29')],qs[_0x6757('0x2f')](_0x45e123[_0x6757('0x2c')][_0x6757('0x2f')]));_0x15a322[_0x6757('0x30')]=_0x15a322[_0x6757('0x30')]['length']?_0x15a322['attributes']:_0x2b441d[_0x6757('0x29')];_0x15a322[_0x6757('0x4f')]=qs[_0x6757('0x34')](_0x45e123[_0x6757('0x2c')]['sort']);_0x15a322[_0x6757('0x35')]=qs[_0x6757('0x2d')](_[_0x6757('0x36')](_0x45e123[_0x6757('0x2c')],_0x2b441d[_0x6757('0x2d')]));if(_0x45e123['query'][_0x6757('0x37')]){_0x15a322[_0x6757('0x35')]=_['merge'](_0x15a322[_0x6757('0x35')],{'$or':_[_0x6757('0x2a')](_0x15a322[_0x6757('0x30')],function(_0x3f1b6f){var _0x2e9754={};_0x2e9754[_0x3f1b6f]={'$like':'%'+_0x45e123[_0x6757('0x2c')][_0x6757('0x37')]+'%'};return _0x2e9754;})});}_0x15a322=_[_0x6757('0x38')]({},_0x15a322,_0x45e123[_0x6757('0x3b')]);return _0x362124[_0x6757('0x4d')](_0x15a322);}})[_0x6757('0x20')](function(_0x2b1489){if(_0x2b1489){_0x1248cb=_0x2b1489[_0x6757('0x31')];if(!_0x45e123[_0x6757('0x2c')][_0x6757('0x32')](_0x6757('0x33'))){_0x15a322[_0x6757('0x1a')]=qs[_0x6757('0x1a')](_0x45e123[_0x6757('0x2c')][_0x6757('0x1a')]);_0x15a322['offset']=qs['offset'](_0x45e123[_0x6757('0x2c')]['offset']);}return _0x362124[_0x6757('0x4d')](_0x15a322);}})[_0x6757('0x20')](function(_0x5cceb8){if(_0x5cceb8){return _0x5cceb8?{'count':_0x1248cb,'rows':_0x5cceb8}:null;}})[_0x6757('0x20')](respondWithResult(_0xf43344,null))[_0x6757('0x3f')](handleError(_0xf43344,null));};exports[_0x6757('0x50')]=function(_0x271ea1,_0x2ce795,_0x1ece24){return db[_0x6757('0x27')][_0x6757('0x4e')]({'where':{'id':_0x271ea1[_0x6757('0x4c')]['id']}})[_0x6757('0x20')](handleEntityNotFound(_0x2ce795,null))[_0x6757('0x20')](function(_0x124e6c){if(_0x124e6c){return db[_0x6757('0x51')][_0x6757('0x52')](function(_0x4c8c10){return db[_0x6757('0x27')][_0x6757('0x21')]({'where':{'IntervalId':_0x271ea1[_0x6757('0x4c')]['id']},'transaction':_0x4c8c10})['then'](function(_0x5c009f){var _0xe11c41=_['map'](_0x271ea1[_0x6757('0x4a')],function(_0x642a23){delete _0x642a23['id'];_0x642a23[_0x6757('0x53')]=_0x271ea1[_0x6757('0x4c')]['id'];return _0x642a23;});return db[_0x6757('0x27')][_0x6757('0x54')](_0xe11c41,{'transaction':_0x4c8c10});});})['then'](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x271ea1['params']['id']}});});}})[_0x6757('0x20')](respondWithResult(_0x2ce795,null))[_0x6757('0x3f')](handleError(_0x2ce795,null));}; \ No newline at end of file +var _0xa0ab=['attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','rawAttributes','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addInterval','getIntervals','findOne','pick','addIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','get','Intervals','UserProfileResource','sendStatus','error','stack','name','send','index','map','Interval','fieldName','type','key','model','query','filters','intersection','fields'];(function(_0x4aa13b,_0xfa6593){var _0x46eb7a=function(_0x13493a){while(--_0x13493a){_0x4aa13b['push'](_0x4aa13b['shift']());}};_0x46eb7a(++_0xfa6593);}(_0xa0ab,0x147));var _0xba0a=function(_0x1e2e96,_0x40f571){_0x1e2e96=_0x1e2e96-0x0;var _0x9e953f=_0xa0ab[_0x1e2e96];return _0x9e953f;};'use strict';var emlformat=require(_0xba0a('0x0'));var rimraf=require(_0xba0a('0x1'));var zipdir=require(_0xba0a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba0a('0x3'));var moment=require(_0xba0a('0x4'));var BPromise=require(_0xba0a('0x5'));var Mustache=require(_0xba0a('0x6'));var util=require(_0xba0a('0x7'));var path=require('path');var sox=require(_0xba0a('0x8'));var csv=require('to-csv');var ejs=require(_0xba0a('0x9'));var fs=require('fs');var fs_extra=require(_0xba0a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xba0a('0xb'));var deskjs=require(_0xba0a('0xc'));var toCsv=require(_0xba0a('0xd'));var querystring=require(_0xba0a('0xe'));var Papa=require(_0xba0a('0xf'));var Redis=require(_0xba0a('0x10'));var authService=require(_0xba0a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xba0a('0x12'));var hardwareService=require(_0xba0a('0x13'));var logger=require(_0xba0a('0x14'))(_0xba0a('0x15'));var utils=require(_0xba0a('0x16'));var config=require(_0xba0a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xba0a('0x18'))['db'];var extensions=require(_0xba0a('0x19'));function respondWithStatusCode(_0x2a45dc,_0x254b4f){_0x254b4f=_0x254b4f||0xcc;return function(_0x51a29a){if(_0x51a29a){return _0x2a45dc['sendStatus'](_0x254b4f);}return _0x2a45dc[_0xba0a('0x1a')](_0x254b4f)[_0xba0a('0x1b')]();};}function respondWithResult(_0x244443,_0x1862a3){_0x1862a3=_0x1862a3||0xc8;return function(_0x49bf8c){if(_0x49bf8c){return _0x244443[_0xba0a('0x1a')](_0x1862a3)[_0xba0a('0x1c')](_0x49bf8c);}};}function respondWithFilteredResult(_0x2bb846,_0x2c127d){return function(_0x2ff75d){if(_0x2ff75d){var _0x1a69f6=typeof _0x2c127d[_0xba0a('0x1d')]===_0xba0a('0x1e')&&typeof _0x2c127d[_0xba0a('0x1f')]===_0xba0a('0x1e');var _0x266444=_0x2ff75d['count'];var _0x481145=_0x1a69f6?0x0:_0x2c127d[_0xba0a('0x1d')];var _0x2619fa=_0x1a69f6?_0x2ff75d[_0xba0a('0x20')]:_0x2c127d[_0xba0a('0x1d')]+_0x2c127d[_0xba0a('0x1f')];var _0x1352fd;if(_0x2619fa>=_0x266444){_0x2619fa=_0x266444;_0x1352fd=0xc8;}else{_0x1352fd=0xce;}_0x2bb846['status'](_0x1352fd);return _0x2bb846['set'](_0xba0a('0x21'),_0x481145+'-'+_0x2619fa+'/'+_0x266444)[_0xba0a('0x1c')](_0x2ff75d);}return null;};}function patchUpdates(_0x8085a1){return function(_0x56081a){try{jsonpatch['apply'](_0x56081a,_0x8085a1,!![]);}catch(_0x25d611){return BPromise[_0xba0a('0x22')](_0x25d611);}return _0x56081a[_0xba0a('0x23')]();};}function saveUpdates(_0x316dc3,_0x22e0c0){return function(_0x29c671){if(_0x29c671){return _0x29c671[_0xba0a('0x24')](_0x316dc3)[_0xba0a('0x25')](function(_0x385041){return _0x385041;});}return null;};}function removeEntity(_0x23d003,_0x1683b2){return function(_0x4a79b2){if(_0x4a79b2){return _0x4a79b2['destroy']()[_0xba0a('0x25')](function(){var _0x477761=_0x4a79b2[_0xba0a('0x26')]({'plain':!![]});var _0x8b66d2=_0xba0a('0x27');return db[_0xba0a('0x28')]['destroy']({'where':{'type':_0x8b66d2,'resourceId':_0x477761['id']}})['then'](function(){return _0x4a79b2;});})[_0xba0a('0x25')](function(){_0x23d003[_0xba0a('0x1a')](0xcc)[_0xba0a('0x1b')]();});}};}function handleEntityNotFound(_0x149833,_0x5adfbb){return function(_0x16d4c2){if(!_0x16d4c2){_0x149833[_0xba0a('0x29')](0x194);}return _0x16d4c2;};}function handleError(_0x3de861,_0x5e9d71){_0x5e9d71=_0x5e9d71||0x1f4;return function(_0x116967){logger[_0xba0a('0x2a')](_0x116967[_0xba0a('0x2b')]);if(_0x116967[_0xba0a('0x2c')]){delete _0x116967[_0xba0a('0x2c')];}_0x3de861['status'](_0x5e9d71)[_0xba0a('0x2d')](_0x116967);};}exports[_0xba0a('0x2e')]=function(_0x1dc1c4,_0x5368c2){var _0x14c44f={},_0x33d24f={},_0x2ee1a5={'count':0x0,'rows':[]};var _0x190b3a=_[_0xba0a('0x2f')](db[_0xba0a('0x30')]['rawAttributes'],function(_0x23f855){return{'name':_0x23f855[_0xba0a('0x31')],'type':_0x23f855[_0xba0a('0x32')][_0xba0a('0x33')]};});_0x33d24f[_0xba0a('0x34')]=_['map'](_0x190b3a,_0xba0a('0x2c'));_0x33d24f[_0xba0a('0x35')]=_['keys'](_0x1dc1c4['query']);_0x33d24f[_0xba0a('0x36')]=_[_0xba0a('0x37')](_0x33d24f[_0xba0a('0x34')],_0x33d24f[_0xba0a('0x35')]);_0x14c44f['attributes']=_['intersection'](_0x33d24f[_0xba0a('0x34')],qs[_0xba0a('0x38')](_0x1dc1c4['query'][_0xba0a('0x38')]));_0x14c44f[_0xba0a('0x39')]=_0x14c44f[_0xba0a('0x39')]['length']?_0x14c44f[_0xba0a('0x39')]:_0x33d24f[_0xba0a('0x34')];if(!_0x1dc1c4[_0xba0a('0x35')][_0xba0a('0x3a')](_0xba0a('0x3b'))){_0x14c44f[_0xba0a('0x1f')]=qs[_0xba0a('0x1f')](_0x1dc1c4['query']['limit']);_0x14c44f['offset']=qs[_0xba0a('0x1d')](_0x1dc1c4[_0xba0a('0x35')][_0xba0a('0x1d')]);}_0x14c44f[_0xba0a('0x3c')]=qs[_0xba0a('0x3d')](_0x1dc1c4[_0xba0a('0x35')][_0xba0a('0x3d')]);_0x14c44f[_0xba0a('0x3e')]=qs['filters'](_['pick'](_0x1dc1c4[_0xba0a('0x35')],_0x33d24f[_0xba0a('0x36')]),_0x190b3a);if(_0x1dc1c4['query'][_0xba0a('0x3f')]){_0x14c44f[_0xba0a('0x3e')]=_[_0xba0a('0x40')](_0x14c44f[_0xba0a('0x3e')],{'$or':_['map'](_0x190b3a,function(_0x3bea99){if(_0x3bea99[_0xba0a('0x32')]!==_0xba0a('0x41')){var _0x55a049={};_0x55a049[_0x3bea99['name']]={'$like':'%'+_0x1dc1c4[_0xba0a('0x35')][_0xba0a('0x3f')]+'%'};return _0x55a049;}})});}_0x14c44f=_[_0xba0a('0x40')]({},_0x14c44f,_0x1dc1c4[_0xba0a('0x42')]);var _0x26c1e3={'where':_0x14c44f[_0xba0a('0x3e')]};return db[_0xba0a('0x30')]['count'](_0x26c1e3)[_0xba0a('0x25')](function(_0x489c8a){_0x2ee1a5[_0xba0a('0x20')]=_0x489c8a;if(_0x1dc1c4[_0xba0a('0x35')]['includeAll']){_0x14c44f[_0xba0a('0x43')]=[{'all':!![]}];}return db[_0xba0a('0x30')][_0xba0a('0x44')](_0x14c44f);})['then'](function(_0x3e7ce5){_0x2ee1a5[_0xba0a('0x45')]=_0x3e7ce5;return _0x2ee1a5;})['then'](respondWithFilteredResult(_0x5368c2,_0x14c44f))[_0xba0a('0x46')](handleError(_0x5368c2,null));};exports['show']=function(_0x1303ab,_0x17a507){var _0x404f25={'raw':!![],'where':{'id':_0x1303ab[_0xba0a('0x47')]['id']}},_0x12648a={};_0x12648a['model']=_[_0xba0a('0x48')](db[_0xba0a('0x30')][_0xba0a('0x49')]);_0x12648a['query']=_[_0xba0a('0x48')](_0x1303ab[_0xba0a('0x35')]);_0x12648a[_0xba0a('0x36')]=_[_0xba0a('0x37')](_0x12648a[_0xba0a('0x34')],_0x12648a['query']);_0x404f25['attributes']=_[_0xba0a('0x37')](_0x12648a[_0xba0a('0x34')],qs['fields'](_0x1303ab[_0xba0a('0x35')][_0xba0a('0x38')]));_0x404f25[_0xba0a('0x39')]=_0x404f25[_0xba0a('0x39')][_0xba0a('0x4a')]?_0x404f25[_0xba0a('0x39')]:_0x12648a[_0xba0a('0x34')];if(_0x1303ab['query'][_0xba0a('0x4b')]){_0x404f25[_0xba0a('0x43')]=[{'all':!![]}];}_0x404f25=_['merge']({},_0x404f25,_0x1303ab['options']);return db[_0xba0a('0x30')][_0xba0a('0x4c')](_0x404f25)[_0xba0a('0x25')](handleEntityNotFound(_0x17a507,null))[_0xba0a('0x25')](respondWithResult(_0x17a507,null))[_0xba0a('0x46')](handleError(_0x17a507,null));};exports['create']=function(_0x3b6796,_0x240a2f){return db[_0xba0a('0x30')][_0xba0a('0x4d')](_0x3b6796[_0xba0a('0x4e')],{})[_0xba0a('0x25')](function(_0x4bdf55){var _0x582d00=_0x3b6796['user'][_0xba0a('0x26')]({'plain':!![]});if(!_0x582d00)throw new Error(_0xba0a('0x4f'));if(_0x582d00[_0xba0a('0x50')]===_0xba0a('0x51')){var _0x365b60=_0x4bdf55['get']({'plain':!![]});var _0xbca820='Intervals';return db[_0xba0a('0x52')][_0xba0a('0x4c')]({'where':{'name':_0xbca820,'userProfileId':_0x582d00[_0xba0a('0x53')]},'raw':!![]})[_0xba0a('0x25')](function(_0x3c056e){if(_0x3c056e&&_0x3c056e[_0xba0a('0x54')]===0x0){return db[_0xba0a('0x28')]['create']({'name':_0x365b60['name'],'resourceId':_0x365b60['id'],'type':_0x3c056e[_0xba0a('0x2c')],'sectionId':_0x3c056e['id']},{})[_0xba0a('0x25')](function(){return _0x4bdf55;});}else{return _0x4bdf55;}})[_0xba0a('0x46')](function(_0x4bb3f7){logger[_0xba0a('0x2a')](_0xba0a('0x55'),_0x4bb3f7);throw _0x4bb3f7;});}return _0x4bdf55;})[_0xba0a('0x25')](respondWithResult(_0x240a2f,0xc9))['catch'](handleError(_0x240a2f,null));};exports[_0xba0a('0x24')]=function(_0x233f62,_0x2aafea){if(_0x233f62[_0xba0a('0x4e')]['id']){delete _0x233f62[_0xba0a('0x4e')]['id'];}return db['Interval'][_0xba0a('0x4c')]({'where':{'id':_0x233f62[_0xba0a('0x47')]['id']}})[_0xba0a('0x25')](handleEntityNotFound(_0x2aafea,null))[_0xba0a('0x25')](saveUpdates(_0x233f62[_0xba0a('0x4e')],null))[_0xba0a('0x25')](respondWithResult(_0x2aafea,null))[_0xba0a('0x46')](handleError(_0x2aafea,null));};exports[_0xba0a('0x56')]=function(_0x23a308,_0x1b4103){return db[_0xba0a('0x30')][_0xba0a('0x4c')]({'where':{'id':_0x23a308[_0xba0a('0x47')]['id']}})[_0xba0a('0x25')](handleEntityNotFound(_0x1b4103,null))['then'](removeEntity(_0x1b4103,null))['catch'](handleError(_0x1b4103,null));};exports[_0xba0a('0x57')]=function(_0x48df30,_0x4b7c18,_0x3ac24e){if(_0x48df30['body']['id']){delete _0x48df30[_0xba0a('0x4e')]['id'];}return db['Interval'][_0xba0a('0x4c')]({'where':{'id':_0x48df30[_0xba0a('0x47')]['id']}})['then'](handleEntityNotFound(_0x4b7c18,null))[_0xba0a('0x25')](function(_0x2c6897){if(_0x2c6897){_0x48df30[_0xba0a('0x4e')]['IntervalId']=_0x2c6897['id'];return db[_0xba0a('0x30')][_0xba0a('0x4d')](_0x48df30['body']);}})['then'](respondWithResult(_0x4b7c18,null))[_0xba0a('0x46')](handleError(_0x4b7c18,null));};exports[_0xba0a('0x58')]=function(_0x56c5fa,_0x419621,_0x50c015){var _0x6ff566={};var _0x339204={};var _0x352554;var _0x22dfb7;return db[_0xba0a('0x30')][_0xba0a('0x59')]({'where':{'id':_0x56c5fa['params']['id']}})[_0xba0a('0x25')](handleEntityNotFound(_0x419621,null))[_0xba0a('0x25')](function(_0x32e84b){if(_0x32e84b){_0x352554=_0x32e84b;_0x339204[_0xba0a('0x34')]=_[_0xba0a('0x48')](db[_0xba0a('0x30')][_0xba0a('0x49')]);_0x339204[_0xba0a('0x35')]=_[_0xba0a('0x48')](_0x56c5fa[_0xba0a('0x35')]);_0x339204['filters']=_[_0xba0a('0x37')](_0x339204[_0xba0a('0x34')],_0x339204[_0xba0a('0x35')]);_0x6ff566[_0xba0a('0x39')]=_['intersection'](_0x339204[_0xba0a('0x34')],qs[_0xba0a('0x38')](_0x56c5fa[_0xba0a('0x35')]['fields']));_0x6ff566['attributes']=_0x6ff566['attributes'][_0xba0a('0x4a')]?_0x6ff566[_0xba0a('0x39')]:_0x339204[_0xba0a('0x34')];_0x6ff566['order']=qs[_0xba0a('0x3d')](_0x56c5fa[_0xba0a('0x35')]['sort']);_0x6ff566[_0xba0a('0x3e')]=qs[_0xba0a('0x36')](_[_0xba0a('0x5a')](_0x56c5fa[_0xba0a('0x35')],_0x339204['filters']));if(_0x56c5fa[_0xba0a('0x35')]['filter']){_0x6ff566[_0xba0a('0x3e')]=_[_0xba0a('0x40')](_0x6ff566['where'],{'$or':_[_0xba0a('0x2f')](_0x6ff566[_0xba0a('0x39')],function(_0x4aeea8){var _0x33142c={};_0x33142c[_0x4aeea8]={'$like':'%'+_0x56c5fa[_0xba0a('0x35')][_0xba0a('0x3f')]+'%'};return _0x33142c;})});}_0x6ff566=_['merge']({},_0x6ff566,_0x56c5fa[_0xba0a('0x42')]);return _0x352554['getIntervals'](_0x6ff566);}})[_0xba0a('0x25')](function(_0x2010ab){if(_0x2010ab){_0x22dfb7=_0x2010ab['length'];if(!_0x56c5fa[_0xba0a('0x35')][_0xba0a('0x3a')]('nolimit')){_0x6ff566['limit']=qs[_0xba0a('0x1f')](_0x56c5fa[_0xba0a('0x35')][_0xba0a('0x1f')]);_0x6ff566[_0xba0a('0x1d')]=qs['offset'](_0x56c5fa['query']['offset']);}return _0x352554['getIntervals'](_0x6ff566);}})[_0xba0a('0x25')](function(_0x16e060){if(_0x16e060){return _0x16e060?{'count':_0x22dfb7,'rows':_0x16e060}:null;}})[_0xba0a('0x25')](respondWithResult(_0x419621,null))[_0xba0a('0x46')](handleError(_0x419621,null));};exports[_0xba0a('0x5b')]=function(_0x39d074,_0x137d29,_0x538308){return db['Interval']['findOne']({'where':{'id':_0x39d074['params']['id']}})['then'](handleEntityNotFound(_0x137d29,null))['then'](function(_0x4ff711){if(_0x4ff711){return db[_0xba0a('0x5c')][_0xba0a('0x5d')](function(_0x56863d){return db[_0xba0a('0x30')][_0xba0a('0x56')]({'where':{'IntervalId':_0x39d074[_0xba0a('0x47')]['id']},'transaction':_0x56863d})['then'](function(_0x34cc88){var _0xa7be0d=_['map'](_0x39d074[_0xba0a('0x4e')],function(_0x59e98a){delete _0x59e98a['id'];_0x59e98a[_0xba0a('0x5e')]=_0x39d074[_0xba0a('0x47')]['id'];return _0x59e98a;});return db[_0xba0a('0x30')][_0xba0a('0x5f')](_0xa7be0d,{'transaction':_0x56863d});});})[_0xba0a('0x25')](function(){return db[_0xba0a('0x30')][_0xba0a('0x44')]({'where':{'IntervalId':_0x39d074[_0xba0a('0x47')]['id']}});});}})[_0xba0a('0x25')](respondWithResult(_0x137d29,null))[_0xba0a('0x46')](handleError(_0x137d29,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index dc8952f..2da60a2 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 _0x9b70=['interval','string','getIntervals','then','all','map','ifTime','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','Interval','tools_intervals','rewrite'];(function(_0x146e1e,_0x1bb32c){var _0x417efe=function(_0x23e740){while(--_0x23e740){_0x146e1e['push'](_0x146e1e['shift']());}};_0x417efe(++_0x1bb32c);}(_0x9b70,0x1e3));var _0x09b7=function(_0x153c6c,_0x5aa22f){_0x153c6c=_0x153c6c-0x0;var _0x3c85d3=_0x9b70[_0x153c6c];return _0x3c85d3;};'use strict';var attributes=require(_0x09b7('0x0'));var extensions=require(_0x09b7('0x1'));var iftime=require(_0x09b7('0x2'))['iftime'];module[_0x09b7('0x3')]=function(_0x29369b){return _0x29369b['define'](_0x09b7('0x4'),attributes,{'tableName':_0x09b7('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x646e18){extensions[_0x09b7('0x6')](_0x29369b,_0x646e18);},'afterBulkCreate':function(_0x225bb2,_0x164f3a,_0x330426){_0x330426();extensions[_0x09b7('0x6')](_0x29369b,_0x225bb2[0x0]);},'afterUpdate':function(_0x319cc6){extensions['rewrite'](_0x29369b,_0x319cc6);},'afterDestroy':function(_0x5e37d6){extensions['rewrite'](_0x29369b,_0x5e37d6);}},'instanceMethods':{'ifTime':function(_0x5534cd=undefined,_0x2e7ee7=new Date()){if(typeof this[_0x09b7('0x7')]===_0x09b7('0x8')){return iftime(this[_0x09b7('0x7')],_0x5534cd,_0x2e7ee7);}else{return this[_0x09b7('0x9')]()[_0x09b7('0xa')](function(_0x38349d){return Promise[_0x09b7('0xb')](_0x38349d[_0x09b7('0xc')](function(_0x3e3f2c){return _0x3e3f2c[_0x09b7('0xd')](_0x5534cd,_0x2e7ee7);}));})[_0x09b7('0xa')](function(_0x4450e2){return _0x4450e2['reduce'](function(_0x4ae00f,_0x3ac539){return _0x4ae00f||_0x3ac539;},![]);});}}}});}; \ No newline at end of file +var _0xeb58=['./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval','then','all'];(function(_0x24f9ed,_0x3a4a91){var _0x207a64=function(_0x42f461){while(--_0x42f461){_0x24f9ed['push'](_0x24f9ed['shift']());}};_0x207a64(++_0x3a4a91);}(_0xeb58,0x138));var _0x8eb5=function(_0x254dd6,_0x6040da){_0x254dd6=_0x254dd6-0x0;var _0x5a7eca=_0xeb58[_0x254dd6];return _0x5a7eca;};'use strict';var attributes=require(_0x8eb5('0x0'));var extensions=require(_0x8eb5('0x1'));var iftime=require(_0x8eb5('0x2'))[_0x8eb5('0x3')];module[_0x8eb5('0x4')]=function(_0x36ca01){return _0x36ca01[_0x8eb5('0x5')](_0x8eb5('0x6'),attributes,{'tableName':_0x8eb5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xb1ae99){extensions[_0x8eb5('0x8')](_0x36ca01,_0xb1ae99);},'afterBulkCreate':function(_0x4d73cb,_0x5dbe99,_0x1dd639){_0x1dd639();extensions[_0x8eb5('0x8')](_0x36ca01,_0x4d73cb[0x0]);},'afterUpdate':function(_0x5af387){extensions[_0x8eb5('0x8')](_0x36ca01,_0x5af387);},'afterDestroy':function(_0x536184){extensions['rewrite'](_0x36ca01,_0x536184);}},'instanceMethods':{'ifTime':function(_0xf82bb7=undefined,_0x11ef01=new Date()){if(typeof this[_0x8eb5('0x9')]==='string'){return iftime(this['interval'],_0xf82bb7,_0x11ef01);}else{return this['getIntervals']()[_0x8eb5('0xa')](function(_0xa1009a){return Promise[_0x8eb5('0xb')](_0xa1009a['map'](function(_0x4a3f70){return _0x4a3f70['ifTime'](_0xf82bb7,_0x11ef01);}));})['then'](function(_0x4888ed){return _0x4888ed['reduce'](function(_0x495967,_0x4e6b51){return _0x495967||_0x4e6b51;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 01e7c52..d0bd86d 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 _0xb4b7=['intervals','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','catch','error','message','ShowInterval','find','info','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','name','IntervalIftime','intervalIds','isArray'];(function(_0x120b0d,_0x1885ed){var _0x970527=function(_0x32ca9d){while(--_0x32ca9d){_0x120b0d['push'](_0x120b0d['shift']());}};_0x970527(++_0x1885ed);}(_0xb4b7,0x124));var _0x7b4b=function(_0x3ef29e,_0x348d91){_0x3ef29e=_0x3ef29e-0x0;var _0x4d02de=_0xb4b7[_0x3ef29e];return _0x4d02de;};'use strict';var _=require(_0x7b4b('0x0'));var util=require(_0x7b4b('0x1'));var db=require(_0x7b4b('0x2'))['db'];var iftime=require(_0x7b4b('0x3'))[_0x7b4b('0x4')];var logger=require('../../config/logger')(_0x7b4b('0x5'));exports[_0x7b4b('0x6')]=function(_0xb5dab4){var _0x363875=this;return new Promise(function(_0x1ee8cd,_0x1be118){return db[_0x7b4b('0x7')][_0x7b4b('0x8')]({'raw':_0xb5dab4[_0x7b4b('0x9')]?_0xb5dab4[_0x7b4b('0x9')][_0x7b4b('0xa')]===undefined?!![]:![]:!![],'where':_0xb5dab4[_0x7b4b('0x9')]?_0xb5dab4['options'][_0x7b4b('0xb')]||null:null,'attributes':_0xb5dab4[_0x7b4b('0x9')]?_0xb5dab4[_0x7b4b('0x9')][_0x7b4b('0xc')]||null:null,'limit':_0xb5dab4[_0x7b4b('0x9')]?_0xb5dab4[_0x7b4b('0x9')][_0x7b4b('0xd')]||null:null,'include':_0xb5dab4[_0x7b4b('0x9')]?_0xb5dab4[_0x7b4b('0x9')][_0x7b4b('0xe')]?_[_0x7b4b('0xf')](_0xb5dab4['options'][_0x7b4b('0xe')],function(_0xfbaee5){return{'model':db[_0xfbaee5[_0x7b4b('0x10')]],'as':_0xfbaee5['as'],'attributes':_0xfbaee5[_0x7b4b('0xc')],'include':_0xfbaee5[_0x7b4b('0xe')]?_['map'](_0xfbaee5['include'],function(_0x4c9011){return{'model':db[_0x4c9011[_0x7b4b('0x10')]],'as':_0x4c9011['as'],'attributes':_0x4c9011[_0x7b4b('0xc')],'include':_0x4c9011[_0x7b4b('0xe')]?_[_0x7b4b('0xf')](_0x4c9011[_0x7b4b('0xe')],function(_0x5ef5ec){return{'model':db[_0x5ef5ec['model']],'as':_0x5ef5ec['as'],'attributes':_0x5ef5ec[_0x7b4b('0xc')]};}):[]};}):[]};}):[]:[]})[_0x7b4b('0x11')](function(_0x42bb33){logger['info'](_0x7b4b('0x6'),_0xb5dab4);logger[_0x7b4b('0x12')](_0x7b4b('0x6'),_0xb5dab4,JSON[_0x7b4b('0x13')](_0x42bb33));_0x1ee8cd(_0x42bb33);})[_0x7b4b('0x14')](function(_0xffe0bf){logger[_0x7b4b('0x15')](_0x7b4b('0x6'),_0xffe0bf[_0x7b4b('0x16')],_0xb5dab4);_0x1be118(_0x363875[_0x7b4b('0x15')](0x1f4,_0xffe0bf[_0x7b4b('0x16')]));});});};exports[_0x7b4b('0x17')]=function(_0x1b48be){var _0x1c6528=this;return new Promise(function(_0x3c0aba,_0x50348d){return db[_0x7b4b('0x7')][_0x7b4b('0x18')]({'raw':_0x1b48be[_0x7b4b('0x9')]?_0x1b48be[_0x7b4b('0x9')][_0x7b4b('0xa')]===undefined?!![]:![]:!![],'where':_0x1b48be[_0x7b4b('0x9')]?_0x1b48be[_0x7b4b('0x9')][_0x7b4b('0xb')]||null:null,'attributes':_0x1b48be['options']?_0x1b48be['options']['attributes']||null:null,'include':_0x1b48be[_0x7b4b('0x9')]?_0x1b48be[_0x7b4b('0x9')]['include']?_['map'](_0x1b48be[_0x7b4b('0x9')]['include'],function(_0x2cc310){return{'model':db[_0x2cc310['model']],'as':_0x2cc310['as'],'attributes':_0x2cc310[_0x7b4b('0xc')],'include':_0x2cc310['include']?_['map'](_0x2cc310['include'],function(_0x35cdcb){return{'model':db[_0x35cdcb[_0x7b4b('0x10')]],'as':_0x35cdcb['as'],'attributes':_0x35cdcb[_0x7b4b('0xc')],'include':_0x35cdcb[_0x7b4b('0xe')]?_[_0x7b4b('0xf')](_0x35cdcb[_0x7b4b('0xe')],function(_0x509fc3){return{'model':db[_0x509fc3['model']],'as':_0x509fc3['as'],'attributes':_0x509fc3['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b4b('0x11')](function(_0x23a349){logger[_0x7b4b('0x19')](_0x7b4b('0x17'),_0x1b48be);logger[_0x7b4b('0x12')](_0x7b4b('0x17'),_0x1b48be,JSON[_0x7b4b('0x13')](_0x23a349));_0x3c0aba(_0x23a349);})['catch'](function(_0x12d614){logger[_0x7b4b('0x15')](_0x7b4b('0x17'),_0x12d614['message'],_0x1b48be);_0x50348d(_0x1c6528['error'](0x1f4,_0x12d614['message']));});});};function checkArrayOfIntervals(_0x398059,_0x319d37){var _0x9bc093=[];return db['Interval'][_0x7b4b('0x8')]({'where':{'id':_0x398059}})[_0x7b4b('0x11')](function(_0x508f52){_0x9bc093=_0x508f52;return Promise[_0x7b4b('0x1a')](_0x9bc093[_0x7b4b('0xf')](function(_0x3d9653){return _0x3d9653[_0x7b4b('0x1b')](_0x319d37);}));})[_0x7b4b('0x11')](function(_0x25f80d){var _0x2594e5=_0x25f80d[_0x7b4b('0x1c')](function(_0x3d16e9,_0x3b5db0){return _0x3d16e9||_0x3b5db0;},![]);logger[_0x7b4b('0x19')](util[_0x7b4b('0x1d')](_0x7b4b('0x1e'),_0x9bc093['map'](function(_0x24623d){return _0x24623d['name'];})[_0x7b4b('0x1f')](',\x20'),_0x9bc093[_0x7b4b('0xf')](function(_0x2f7956){return _0x2f7956['id'];})[_0x7b4b('0x1f')](',\x20')));return _0x2594e5;});}function checkSingleInterval(_0x42df3e,_0xdf84){return db[_0x7b4b('0x7')]['findById'](_0x42df3e)[_0x7b4b('0x11')](function(_0x41ba22){if(_0x41ba22){logger[_0x7b4b('0x19')](util[_0x7b4b('0x1d')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x41ba22[_0x7b4b('0x20')],_0x41ba22['id']));return _0x41ba22[_0x7b4b('0x1b')](_0xdf84);}});}exports[_0x7b4b('0x21')]=function(_0x15623e){var _0x1fc632=_0x15623e[_0x7b4b('0x22')];var _0x48b28f=Array[_0x7b4b('0x23')](_0x15623e['intervals'])?_0x15623e[_0x7b4b('0x24')]:typeof _0x15623e[_0x7b4b('0x24')]==='string'?[_0x15623e['intervals']]:[];var _0x2cab4f=_0x15623e[_0x7b4b('0x25')]||undefined;var _0x451cd3=![];if(_0x48b28f['length']){logger['info'](util[_0x7b4b('0x1d')](_0x7b4b('0x26'),_0x48b28f[_0x7b4b('0x1f')](';\x20')));}if(_0x2cab4f){logger[_0x7b4b('0x19')](util[_0x7b4b('0x1d')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x2cab4f));}logger[_0x7b4b('0x12')](_0x7b4b('0x27'),_0x451cd3);logger['silly']('IntervalIftime',_0x15623e);return Promise[_0x7b4b('0x28')]()['then'](function(){if(Array[_0x7b4b('0x23')](_0x1fc632)){return checkArrayOfIntervals(_0x1fc632,_0x2cab4f);}else if(_0x1fc632){return checkSingleInterval(_0x1fc632,_0x2cab4f);}})[_0x7b4b('0x11')](function(_0x35b625){var _0x40c947=_0x48b28f[_0x7b4b('0x1c')](function(_0x5d1bff,_0xed9065){return _0x5d1bff||iftime(_0xed9065,_0x2cab4f);},![]);_0x451cd3=_0x35b625||_0x40c947;return _0x451cd3;})[_0x7b4b('0x14')](function(_0x2916b8){logger[_0x7b4b('0x15')](_0x7b4b('0x21'),_0x15623e,_0x2916b8);throw this[_0x7b4b('0x15')](0x1f4,_0x2916b8['message']);});}; \ No newline at end of file +var _0x2893=['util','../../mysqldb','iftime','rpc','Interval','findAll','options','where','attributes','limit','map','include','model','GetInterval','debug','catch','error','message','ShowInterval','find','then','info','stringify','all','ifTime','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','reduce','lodash'];(function(_0x3a07c1,_0x34d57f){var _0x2bbe15=function(_0x5a02fb){while(--_0x5a02fb){_0x3a07c1['push'](_0x3a07c1['shift']());}};_0x2bbe15(++_0x34d57f);}(_0x2893,0x1ee));var _0x3289=function(_0x5182f9,_0x4acf0c){_0x5182f9=_0x5182f9-0x0;var _0x4c9fad=_0x2893[_0x5182f9];return _0x4c9fad;};'use strict';var _=require(_0x3289('0x0'));var util=require(_0x3289('0x1'));var db=require(_0x3289('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x3289('0x3')];var logger=require('../../config/logger')(_0x3289('0x4'));exports['GetInterval']=function(_0x502c22){var _0x2aceb9=this;return new Promise(function(_0x2b7e49,_0x8ea907){return db[_0x3289('0x5')][_0x3289('0x6')]({'raw':_0x502c22[_0x3289('0x7')]?_0x502c22[_0x3289('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x502c22[_0x3289('0x7')]?_0x502c22[_0x3289('0x7')][_0x3289('0x8')]||null:null,'attributes':_0x502c22['options']?_0x502c22[_0x3289('0x7')][_0x3289('0x9')]||null:null,'limit':_0x502c22['options']?_0x502c22[_0x3289('0x7')][_0x3289('0xa')]||null:null,'include':_0x502c22[_0x3289('0x7')]?_0x502c22[_0x3289('0x7')]['include']?_[_0x3289('0xb')](_0x502c22[_0x3289('0x7')][_0x3289('0xc')],function(_0x2fae2c){return{'model':db[_0x2fae2c[_0x3289('0xd')]],'as':_0x2fae2c['as'],'attributes':_0x2fae2c[_0x3289('0x9')],'include':_0x2fae2c[_0x3289('0xc')]?_[_0x3289('0xb')](_0x2fae2c[_0x3289('0xc')],function(_0x3cf424){return{'model':db[_0x3cf424[_0x3289('0xd')]],'as':_0x3cf424['as'],'attributes':_0x3cf424[_0x3289('0x9')],'include':_0x3cf424[_0x3289('0xc')]?_['map'](_0x3cf424[_0x3289('0xc')],function(_0x4ab09e){return{'model':db[_0x4ab09e[_0x3289('0xd')]],'as':_0x4ab09e['as'],'attributes':_0x4ab09e[_0x3289('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49efc5){logger['info'](_0x3289('0xe'),_0x502c22);logger[_0x3289('0xf')](_0x3289('0xe'),_0x502c22,JSON['stringify'](_0x49efc5));_0x2b7e49(_0x49efc5);})[_0x3289('0x10')](function(_0x4ef878){logger[_0x3289('0x11')](_0x3289('0xe'),_0x4ef878[_0x3289('0x12')],_0x502c22);_0x8ea907(_0x2aceb9['error'](0x1f4,_0x4ef878[_0x3289('0x12')]));});});};exports[_0x3289('0x13')]=function(_0x43ae62){var _0x32f7ab=this;return new Promise(function(_0x3ed4ea,_0x3d7399){return db['Interval'][_0x3289('0x14')]({'raw':_0x43ae62[_0x3289('0x7')]?_0x43ae62[_0x3289('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x43ae62['options']?_0x43ae62['options'][_0x3289('0x8')]||null:null,'attributes':_0x43ae62[_0x3289('0x7')]?_0x43ae62[_0x3289('0x7')]['attributes']||null:null,'include':_0x43ae62[_0x3289('0x7')]?_0x43ae62[_0x3289('0x7')]['include']?_[_0x3289('0xb')](_0x43ae62[_0x3289('0x7')][_0x3289('0xc')],function(_0x342333){return{'model':db[_0x342333['model']],'as':_0x342333['as'],'attributes':_0x342333[_0x3289('0x9')],'include':_0x342333[_0x3289('0xc')]?_[_0x3289('0xb')](_0x342333[_0x3289('0xc')],function(_0x30e52f){return{'model':db[_0x30e52f[_0x3289('0xd')]],'as':_0x30e52f['as'],'attributes':_0x30e52f[_0x3289('0x9')],'include':_0x30e52f[_0x3289('0xc')]?_['map'](_0x30e52f[_0x3289('0xc')],function(_0x321f5b){return{'model':db[_0x321f5b[_0x3289('0xd')]],'as':_0x321f5b['as'],'attributes':_0x321f5b[_0x3289('0x9')]};}):[]};}):[]};}):[]:[]})[_0x3289('0x15')](function(_0x515712){logger[_0x3289('0x16')](_0x3289('0x13'),_0x43ae62);logger[_0x3289('0xf')]('ShowInterval',_0x43ae62,JSON[_0x3289('0x17')](_0x515712));_0x3ed4ea(_0x515712);})[_0x3289('0x10')](function(_0x2f293e){logger[_0x3289('0x11')](_0x3289('0x13'),_0x2f293e[_0x3289('0x12')],_0x43ae62);_0x3d7399(_0x32f7ab['error'](0x1f4,_0x2f293e[_0x3289('0x12')]));});});};function checkArrayOfIntervals(_0x251405,_0x280423){var _0x14a9c9=[];return db[_0x3289('0x5')][_0x3289('0x6')]({'where':{'id':_0x251405}})['then'](function(_0x4811e6){_0x14a9c9=_0x4811e6;return Promise[_0x3289('0x18')](_0x14a9c9[_0x3289('0xb')](function(_0x325f65){return _0x325f65[_0x3289('0x19')](_0x280423);}));})[_0x3289('0x15')](function(_0x12c518){var _0x2ec278=_0x12c518['reduce'](function(_0x473842,_0x4c8562){return _0x473842||_0x4c8562;},![]);logger[_0x3289('0x16')](util['format'](_0x3289('0x1a'),_0x14a9c9[_0x3289('0xb')](function(_0x1590ca){return _0x1590ca['name'];})[_0x3289('0x1b')](',\x20'),_0x14a9c9[_0x3289('0xb')](function(_0x5256f5){return _0x5256f5['id'];})['join'](',\x20')));return _0x2ec278;});}function checkSingleInterval(_0x3d9256,_0x3ff719){return db['Interval'][_0x3289('0x1c')](_0x3d9256)[_0x3289('0x15')](function(_0x5a3740){if(_0x5a3740){logger[_0x3289('0x16')](util[_0x3289('0x1d')](_0x3289('0x1e'),_0x5a3740[_0x3289('0x1f')],_0x5a3740['id']));return _0x5a3740['ifTime'](_0x3ff719);}});}exports['IntervalIftime']=function(_0x20d308){var _0x2dbc3f=_0x20d308[_0x3289('0x20')];var _0x469f6a=Array[_0x3289('0x21')](_0x20d308[_0x3289('0x22')])?_0x20d308['intervals']:typeof _0x20d308[_0x3289('0x22')]===_0x3289('0x23')?[_0x20d308[_0x3289('0x22')]]:[];var _0xa1504a=_0x20d308[_0x3289('0x24')]||undefined;var _0x5537d5=![];if(_0x469f6a[_0x3289('0x25')]){logger[_0x3289('0x16')](util[_0x3289('0x1d')](_0x3289('0x26'),_0x469f6a[_0x3289('0x1b')](';\x20')));}if(_0xa1504a){logger[_0x3289('0x16')](util[_0x3289('0x1d')](_0x3289('0x27'),_0xa1504a));}logger[_0x3289('0xf')](_0x3289('0x28'),_0x5537d5);logger[_0x3289('0x29')](_0x3289('0x2a'),_0x20d308);return Promise[_0x3289('0x2b')]()['then'](function(){if(Array[_0x3289('0x21')](_0x2dbc3f)){return checkArrayOfIntervals(_0x2dbc3f,_0xa1504a);}else if(_0x2dbc3f){return checkSingleInterval(_0x2dbc3f,_0xa1504a);}})[_0x3289('0x15')](function(_0x42e3ab){var _0x1d565b=_0x469f6a[_0x3289('0x2c')](function(_0x23778e,_0x129703){return _0x23778e||iftime(_0x129703,_0xa1504a);},![]);_0x5537d5=_0x42e3ab||_0x1d565b;return _0x5537d5;})[_0x3289('0x10')](function(_0x2c6c63){logger[_0x3289('0x11')](_0x3289('0x2a'),_0x20d308,_0x2c6c63);throw this['error'](0x1f4,_0x2c6c63[_0x3289('0x12')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 5ef67be..0e3cfe1 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(_0x40cb91,_0xca8c09){var _0x3cd00d=function(_0xa7b2e3){while(--_0xa7b2e3){_0x40cb91['push'](_0x40cb91['shift']());}};_0x3cd00d(++_0xca8c09);}(_0x5f2f,0x73));var _0xf5f2=function(_0x184eb2,_0x2f6b87){_0x184eb2=_0x184eb2-0x0;var _0x2bcd6f=_0x5f2f[_0x184eb2];return _0x2bcd6f;};'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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x4dc2e3,_0x25cb4c){var _0x2bb9d6=function(_0x8194a0){while(--_0x8194a0){_0x4dc2e3['push'](_0x4dc2e3['shift']());}};_0x2bb9d6(++_0x25cb4c);}(_0x2ef3,0xba));var _0x32ef=function(_0x2d0513,_0x3e2f34){_0x2d0513=_0x2d0513-0x0;var _0x271e7a=_0x2ef3[_0x2d0513];return _0x271e7a;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('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 d0820cc..bce6145 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 _0x3803=['email','oldToken','customfield_11502','newToken','reason','customfield_10102','track.xcallymotion.com','POST','application/json','toString','base64','request','setEncoding','data','end','statusCode','json','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','Bug','fields','customfield_11500'];(function(_0x2e7087,_0x112eec){var _0xb5b3a6=function(_0x296310){while(--_0x296310){_0x2e7087['push'](_0x2e7087['shift']());}};_0xb5b3a6(++_0x112eec);}(_0x3803,0xf3));var _0x3380=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x3803[_0x27af45];return _0x18df21;};'use strict';var BPromise=require(_0x3380('0x0'));var https=require(_0x3380('0x1'));var logger=require(_0x3380('0x2'))(_0x3380('0x3'));var USERNAME=_0x3380('0x4');var PASSWORD=_0x3380('0x5');function openIssue(_0x52d734,_0x1570d8){var _0x474075={'fields':{'project':{'key':_0x52d734[_0x3380('0x6')]||_0x3380('0x7')},'summary':(_0x52d734[_0x3380('0x8')]||'Report')+_0x3380('0x9')+_0x52d734['ip'],'description':_0x52d734[_0x3380('0xa')]||JSON[_0x3380('0xb')](_0x52d734),'issuetype':{'name':_0x52d734['issuetype']||_0x3380('0xc')}}};_0x474075[_0x3380('0xd')][_0x3380('0xe')]=_0x52d734[_0x3380('0xf')];_0x474075[_0x3380('0xd')]['customfield_11501']=_0x52d734[_0x3380('0x10')];_0x474075[_0x3380('0xd')][_0x3380('0x11')]=_0x52d734[_0x3380('0x12')];_0x474075[_0x3380('0xd')]['customfield_11503']=_0x52d734['name'];_0x474075[_0x3380('0xd')]['customfield_11504']=_0x52d734[_0x3380('0x13')];_0x474075['fields'][_0x3380('0x14')]=_0x52d734['ip'];var _0x126585={'host':_0x3380('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x3380('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x3380('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x3380('0x18')](_0x3380('0x19'))}};var _0x272fa7=JSON[_0x3380('0xb')](_0x474075);var _0xeeccc9=https[_0x3380('0x1a')](_0x126585,function(_0x85eaa0){_0x85eaa0[_0x3380('0x1b')]('utf8');var _0x2b643a='';_0x85eaa0['on'](_0x3380('0x1c'),function(_0x295ee4){_0x2b643a+=_0x295ee4;});_0x85eaa0['on'](_0x3380('0x1d'),function(){if(_0x1570d8){return _0x1570d8['status'](_0x85eaa0[_0x3380('0x1e')])[_0x3380('0x1f')](JSON['parse'](_0x2b643a));}});});_0xeeccc9['on'](_0x3380('0x20'),function(_0x226ebe){if(_0x1570d8){return _0x1570d8[_0x3380('0x21')](0x1f4)[_0x3380('0x1f')]({'errors':[{'message':_0x3380('0x22'),'type':'api.jira'}]});}});_0xeeccc9[_0x3380('0x23')](_0x272fa7);_0xeeccc9[_0x3380('0x1d')]();}exports[_0x3380('0x24')]=openIssue;exports[_0x3380('0x25')]=function(_0x3aa8be,_0x1301a2){_0x3aa8be[_0x3380('0x26')]['ip']=_0x3aa8be['headers'][_0x3380('0x27')]||_0x3aa8be[_0x3380('0x28')]['remoteAddress']||_0x3aa8be[_0x3380('0x29')][_0x3380('0x2a')]||_0x3aa8be[_0x3380('0x28')][_0x3380('0x29')][_0x3380('0x2a')];return openIssue(_0x3aa8be['body'],_0x1301a2);}; \ No newline at end of file +var _0xf69b=['customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','setEncoding','utf8','data','end','statusCode','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','api','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0xf69b,0x1c8));var _0xbf69=function(_0x34620d,_0x1ab3a3){_0x34620d=_0x34620d-0x0;var _0x3f1b4b=_0xf69b[_0x34620d];return _0x3f1b4b;};'use strict';var BPromise=require('bluebird');var https=require(_0xbf69('0x0'));var logger=require('../../config/logger')(_0xbf69('0x1'));var USERNAME='support';var PASSWORD=_0xbf69('0x2');function openIssue(_0x2dce5c,_0xcf41a7){var _0x55591d={'fields':{'project':{'key':_0x2dce5c[_0xbf69('0x3')]||_0xbf69('0x4')},'summary':(_0x2dce5c[_0xbf69('0x5')]||'Report')+_0xbf69('0x6')+_0x2dce5c['ip'],'description':_0x2dce5c['description']||JSON[_0xbf69('0x7')](_0x2dce5c),'issuetype':{'name':_0x2dce5c[_0xbf69('0x8')]||_0xbf69('0x9')}}};_0x55591d[_0xbf69('0xa')][_0xbf69('0xb')]=_0x2dce5c[_0xbf69('0xc')];_0x55591d[_0xbf69('0xa')][_0xbf69('0xd')]=_0x2dce5c['oldToken'];_0x55591d['fields'][_0xbf69('0xe')]=_0x2dce5c[_0xbf69('0xf')];_0x55591d['fields'][_0xbf69('0x10')]=_0x2dce5c[_0xbf69('0x11')];_0x55591d['fields'][_0xbf69('0x12')]=_0x2dce5c['reason'];_0x55591d[_0xbf69('0xa')][_0xbf69('0x13')]=_0x2dce5c['ip'];var _0x97e610={'host':_0xbf69('0x14'),'port':0x1bb,'path':_0xbf69('0x15'),'method':_0xbf69('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xbf69('0x17'),'Authorization':_0xbf69('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xbf69('0x19')](_0xbf69('0x1a'))}};var _0x2904bf=JSON[_0xbf69('0x7')](_0x55591d);var _0x49de71=https['request'](_0x97e610,function(_0x55bdbd){_0x55bdbd[_0xbf69('0x1b')](_0xbf69('0x1c'));var _0x34f6ad='';_0x55bdbd['on'](_0xbf69('0x1d'),function(_0x54be9e){_0x34f6ad+=_0x54be9e;});_0x55bdbd['on'](_0xbf69('0x1e'),function(){if(_0xcf41a7){return _0xcf41a7['status'](_0x55bdbd[_0xbf69('0x1f')])[_0xbf69('0x20')](JSON[_0xbf69('0x21')](_0x34f6ad));}});});_0x49de71['on'](_0xbf69('0x22'),function(_0x320f24){if(_0xcf41a7){return _0xcf41a7[_0xbf69('0x23')](0x1f4)[_0xbf69('0x20')]({'errors':[{'message':_0xbf69('0x24'),'type':_0xbf69('0x25')}]});}});_0x49de71[_0xbf69('0x26')](_0x2904bf);_0x49de71['end']();}exports[_0xbf69('0x27')]=openIssue;exports[_0xbf69('0x28')]=function(_0xecc9f7,_0x36c8ed){_0xecc9f7[_0xbf69('0x29')]['ip']=_0xecc9f7[_0xbf69('0x2a')][_0xbf69('0x2b')]||_0xecc9f7[_0xbf69('0x2c')][_0xbf69('0x2d')]||_0xecc9f7[_0xbf69('0x2e')][_0xbf69('0x2d')]||_0xecc9f7[_0xbf69('0x2c')]['socket']['remoteAddress'];return openIssue(_0xecc9f7['body'],_0x36c8ed);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 72229e2..6ea2f5b 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 _0x6f7a=['isAuthenticated','index','/describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x19b84f,_0x16ebfd){var _0xd2355=function(_0x36c427){while(--_0x36c427){_0x19b84f['push'](_0x19b84f['shift']());}};_0xd2355(++_0x16ebfd);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x672477,_0x326d26){_0x672477=_0x672477-0x0;var _0x51f486=_0x6f7a[_0x672477];return _0x51f486;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var fs_extra=require(_0xa6f7('0x5'));var auth=require(_0xa6f7('0x6'));var interaction=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var controller=require(_0xa6f7('0x9'));router[_0xa6f7('0xa')]('/',auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xc')]);router[_0xa6f7('0xa')](_0xa6f7('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xa6f7('0xa')](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xf')]);router[_0xa6f7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa6f7('0x11')](_0xa6f7('0xe'),auth['isAuthenticated'](),controller[_0xa6f7('0x12')]);router['delete'](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0x13')]);module[_0xa6f7('0x14')]=router; \ No newline at end of file +var _0xa8a8=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0xa8a8,0xec));var _0x8a8a=function(_0x58bd4d,_0x1b4b42){_0x58bd4d=_0x58bd4d-0x0;var _0x4a6a81=_0xa8a8[_0x58bd4d];return _0x4a6a81;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var fs_extra=require(_0x8a8a('0x5'));var auth=require(_0x8a8a('0x6'));var interaction=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var controller=require(_0x8a8a('0x9'));router[_0x8a8a('0xa')]('/',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xc')]);router[_0x8a8a('0xa')](_0x8a8a('0xd'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xa')](_0x8a8a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8a8a('0x10')]('/',auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);router[_0x8a8a('0x12')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x13')]);router[_0x8a8a('0x14')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x15')]);module[_0x8a8a('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index f6b3028..56b7133 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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0xeb4319,_0x363e2f){_0xeb4319=_0xeb4319-0x0;var _0x356539=_0x7a54[_0xeb4319];return _0x356539;};'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(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x7a54,0x106));var _0x47a5=function(_0x4708c4,_0x1924ed){_0x4708c4=_0x4708c4-0x0;var _0x439c0e=_0x7a54[_0x4708c4];return _0x439c0e;};'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 2136110..37c67dc 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 _0x3435=['filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','JscriptyAnswerReport','count','includeAll','include','findAll','catch','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','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','limit','set','Content-Range','reject','save','update','then','destroy','stack','send','map','fieldName','type','key','name','query','keys'];(function(_0x4e7e72,_0x3a6fde){var _0x29554d=function(_0x298a94){while(--_0x298a94){_0x4e7e72['push'](_0x4e7e72['shift']());}};_0x29554d(++_0x3a6fde);}(_0x3435,0xfa));var _0x5343=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3435[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x5343('0x0'));var rimraf=require(_0x5343('0x1'));var zipdir=require(_0x5343('0x2'));var jsonpatch=require(_0x5343('0x3'));var rp=require(_0x5343('0x4'));var moment=require(_0x5343('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5343('0x6'));var util=require(_0x5343('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5343('0x8'));var ejs=require(_0x5343('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5343('0xa'));var crypto=require(_0x5343('0xb'));var jsforce=require(_0x5343('0xc'));var deskjs=require(_0x5343('0xd'));var toCsv=require(_0x5343('0x8'));var querystring=require('querystring');var Papa=require(_0x5343('0xe'));var Redis=require('ioredis');var authService=require(_0x5343('0xf'));var qs=require(_0x5343('0x10'));var as=require(_0x5343('0x11'));var hardwareService=require(_0x5343('0x12'));var logger=require(_0x5343('0x13'))('api');var utils=require(_0x5343('0x14'));var config=require(_0x5343('0x15'));var licenseUtil=require(_0x5343('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ddeb7,_0x5f473f){_0x5f473f=_0x5f473f||0xcc;return function(_0x82074d){if(_0x82074d){return _0x2ddeb7[_0x5343('0x17')](_0x5f473f);}return _0x2ddeb7['status'](_0x5f473f)[_0x5343('0x18')]();};}function respondWithResult(_0x4cdfae,_0x13066f){_0x13066f=_0x13066f||0xc8;return function(_0x46c3d7){if(_0x46c3d7){return _0x4cdfae[_0x5343('0x19')](_0x13066f)[_0x5343('0x1a')](_0x46c3d7);}};}function respondWithFilteredResult(_0x4dbff1,_0x446e90){return function(_0x588a96){if(_0x588a96){var _0x1df724=typeof _0x446e90[_0x5343('0x1b')]===_0x5343('0x1c')&&typeof _0x446e90[_0x5343('0x1d')]===_0x5343('0x1c');var _0x4b5852=_0x588a96['count'];var _0x432992=_0x1df724?0x0:_0x446e90[_0x5343('0x1b')];var _0x1f5098=_0x1df724?_0x588a96['count']:_0x446e90[_0x5343('0x1b')]+_0x446e90[_0x5343('0x1d')];var _0x376c35;if(_0x1f5098>=_0x4b5852){_0x1f5098=_0x4b5852;_0x376c35=0xc8;}else{_0x376c35=0xce;}_0x4dbff1[_0x5343('0x19')](_0x376c35);return _0x4dbff1[_0x5343('0x1e')](_0x5343('0x1f'),_0x432992+'-'+_0x1f5098+'/'+_0x4b5852)[_0x5343('0x1a')](_0x588a96);}return null;};}function patchUpdates(_0x40ba38){return function(_0x35d41d){try{jsonpatch['apply'](_0x35d41d,_0x40ba38,!![]);}catch(_0x287304){return BPromise[_0x5343('0x20')](_0x287304);}return _0x35d41d[_0x5343('0x21')]();};}function saveUpdates(_0x42f92d,_0xd95a5b){return function(_0x4e7c0f){if(_0x4e7c0f){return _0x4e7c0f[_0x5343('0x22')](_0x42f92d)[_0x5343('0x23')](function(_0x24c250){return _0x24c250;});}return null;};}function removeEntity(_0x380aae,_0x290ce8){return function(_0x486597){if(_0x486597){return _0x486597[_0x5343('0x24')]()[_0x5343('0x23')](function(){_0x380aae['status'](0xcc)[_0x5343('0x18')]();});}};}function handleEntityNotFound(_0x96bbf6,_0x1ab5eb){return function(_0x5e4344){if(!_0x5e4344){_0x96bbf6['sendStatus'](0x194);}return _0x5e4344;};}function handleError(_0x462cb6,_0x5871de){_0x5871de=_0x5871de||0x1f4;return function(_0x14d05a){logger['error'](_0x14d05a[_0x5343('0x25')]);if(_0x14d05a['name']){delete _0x14d05a['name'];}_0x462cb6[_0x5343('0x19')](_0x5871de)[_0x5343('0x26')](_0x14d05a);};}exports['index']=function(_0x5d597e,_0x1202bb){var _0x5d0853={},_0x2ed8c9={},_0x47d49a={'count':0x0,'rows':[]};var _0x5c689e=_[_0x5343('0x27')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x125e4c){return{'name':_0x125e4c[_0x5343('0x28')],'type':_0x125e4c[_0x5343('0x29')][_0x5343('0x2a')]};});_0x2ed8c9['model']=_['map'](_0x5c689e,_0x5343('0x2b'));_0x2ed8c9[_0x5343('0x2c')]=_[_0x5343('0x2d')](_0x5d597e[_0x5343('0x2c')]);_0x2ed8c9[_0x5343('0x2e')]=_[_0x5343('0x2f')](_0x2ed8c9[_0x5343('0x30')],_0x2ed8c9[_0x5343('0x2c')]);_0x5d0853[_0x5343('0x31')]=_[_0x5343('0x2f')](_0x2ed8c9[_0x5343('0x30')],qs[_0x5343('0x32')](_0x5d597e['query']['fields']));_0x5d0853[_0x5343('0x31')]=_0x5d0853[_0x5343('0x31')]['length']?_0x5d0853[_0x5343('0x31')]:_0x2ed8c9['model'];if(!_0x5d597e[_0x5343('0x2c')][_0x5343('0x33')](_0x5343('0x34'))){_0x5d0853[_0x5343('0x1d')]=qs['limit'](_0x5d597e['query'][_0x5343('0x1d')]);_0x5d0853['offset']=qs[_0x5343('0x1b')](_0x5d597e[_0x5343('0x2c')]['offset']);}_0x5d0853[_0x5343('0x35')]=qs['sort'](_0x5d597e['query'][_0x5343('0x36')]);_0x5d0853[_0x5343('0x37')]=qs[_0x5343('0x2e')](_[_0x5343('0x38')](_0x5d597e['query'],_0x2ed8c9['filters']),_0x5c689e);if(_0x5d597e['query']['filter']){_0x5d0853[_0x5343('0x37')]=_[_0x5343('0x39')](_0x5d0853[_0x5343('0x37')],{'$or':_[_0x5343('0x27')](_0x5c689e,function(_0x3c517a){if(_0x3c517a[_0x5343('0x29')]!==_0x5343('0x3a')){var _0x4d2951={};_0x4d2951[_0x3c517a[_0x5343('0x2b')]]={'$like':'%'+_0x5d597e['query'][_0x5343('0x3b')]+'%'};return _0x4d2951;}})});}_0x5d0853=_[_0x5343('0x39')]({},_0x5d0853,_0x5d597e[_0x5343('0x3c')]);var _0x2f004a={'where':_0x5d0853[_0x5343('0x37')]};return db[_0x5343('0x3d')][_0x5343('0x3e')](_0x2f004a)['then'](function(_0xb93d9){_0x47d49a['count']=_0xb93d9;if(_0x5d597e[_0x5343('0x2c')][_0x5343('0x3f')]){_0x5d0853[_0x5343('0x40')]=[{'all':!![]}];}return db[_0x5343('0x3d')][_0x5343('0x41')](_0x5d0853);})[_0x5343('0x23')](function(_0x2c75bd){_0x47d49a['rows']=_0x2c75bd;return _0x47d49a;})[_0x5343('0x23')](respondWithFilteredResult(_0x1202bb,_0x5d0853))[_0x5343('0x42')](handleError(_0x1202bb,null));};exports['show']=function(_0x41df61,_0x16c880){var _0x4c576d={'raw':!![],'where':{'id':_0x41df61[_0x5343('0x43')]['id']}},_0x53c3c7={};_0x53c3c7[_0x5343('0x30')]=_[_0x5343('0x2d')](db['JscriptyAnswerReport'][_0x5343('0x44')]);_0x53c3c7[_0x5343('0x2c')]=_[_0x5343('0x2d')](_0x41df61[_0x5343('0x2c')]);_0x53c3c7[_0x5343('0x2e')]=_[_0x5343('0x2f')](_0x53c3c7[_0x5343('0x30')],_0x53c3c7['query']);_0x4c576d[_0x5343('0x31')]=_[_0x5343('0x2f')](_0x53c3c7[_0x5343('0x30')],qs[_0x5343('0x32')](_0x41df61[_0x5343('0x2c')][_0x5343('0x32')]));_0x4c576d[_0x5343('0x31')]=_0x4c576d[_0x5343('0x31')][_0x5343('0x45')]?_0x4c576d[_0x5343('0x31')]:_0x53c3c7[_0x5343('0x30')];if(_0x41df61[_0x5343('0x2c')][_0x5343('0x3f')]){_0x4c576d[_0x5343('0x40')]=[{'all':!![]}];}_0x4c576d=_[_0x5343('0x39')]({},_0x4c576d,_0x41df61['options']);return db[_0x5343('0x3d')][_0x5343('0x46')](_0x4c576d)['then'](handleEntityNotFound(_0x16c880,null))[_0x5343('0x23')](respondWithResult(_0x16c880,null))[_0x5343('0x42')](handleError(_0x16c880,null));};exports[_0x5343('0x47')]=function(_0x1da1b7,_0x194316){return db['JscriptyAnswerReport'][_0x5343('0x47')](_0x1da1b7['body'],{})['then'](respondWithResult(_0x194316,0xc9))[_0x5343('0x42')](handleError(_0x194316,null));};exports[_0x5343('0x22')]=function(_0x10329c,_0x1cd4ed){if(_0x10329c['body']['id']){delete _0x10329c[_0x5343('0x48')]['id'];}return db[_0x5343('0x3d')][_0x5343('0x46')]({'where':{'id':_0x10329c[_0x5343('0x43')]['id']}})[_0x5343('0x23')](handleEntityNotFound(_0x1cd4ed,null))[_0x5343('0x23')](saveUpdates(_0x10329c[_0x5343('0x48')],null))[_0x5343('0x23')](respondWithResult(_0x1cd4ed,null))[_0x5343('0x42')](handleError(_0x1cd4ed,null));};exports[_0x5343('0x24')]=function(_0x566d71,_0x1cbf7c){return db[_0x5343('0x3d')][_0x5343('0x46')]({'where':{'id':_0x566d71[_0x5343('0x43')]['id']}})[_0x5343('0x23')](handleEntityNotFound(_0x1cbf7c,null))[_0x5343('0x23')](removeEntity(_0x1cbf7c,null))[_0x5343('0x42')](handleError(_0x1cbf7c,null));};exports[_0x5343('0x49')]=function(_0x3b3c64,_0xad51f4){return db['JscriptyAnswerReport'][_0x5343('0x49')]()['then'](respondWithResult(_0xad51f4,null))['catch'](handleError(_0xad51f4,null));}; \ No newline at end of file +var _0x28e3=['../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','name','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','intersection','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0xcb56d3,_0x34f693){var _0x714f63=function(_0x2357dd){while(--_0x2357dd){_0xcb56d3['push'](_0xcb56d3['shift']());}};_0x714f63(++_0x34f693);}(_0x28e3,0x106));var _0x328e=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x28e3[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require(_0x328e('0x0'));var rimraf=require(_0x328e('0x1'));var zipdir=require(_0x328e('0x2'));var jsonpatch=require(_0x328e('0x3'));var rp=require('request-promise');var moment=require(_0x328e('0x4'));var BPromise=require(_0x328e('0x5'));var Mustache=require(_0x328e('0x6'));var util=require(_0x328e('0x7'));var path=require(_0x328e('0x8'));var sox=require(_0x328e('0x9'));var csv=require(_0x328e('0xa'));var ejs=require(_0x328e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x328e('0xc'));var jsforce=require(_0x328e('0xd'));var deskjs=require(_0x328e('0xe'));var toCsv=require(_0x328e('0xa'));var querystring=require(_0x328e('0xf'));var Papa=require('papaparse');var Redis=require(_0x328e('0x10'));var authService=require(_0x328e('0x11'));var qs=require(_0x328e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x328e('0x13'));var utils=require(_0x328e('0x14'));var config=require(_0x328e('0x15'));var licenseUtil=require(_0x328e('0x16'));var db=require(_0x328e('0x17'))['db'];function respondWithStatusCode(_0x45cda0,_0x4699ec){_0x4699ec=_0x4699ec||0xcc;return function(_0x39338e){if(_0x39338e){return _0x45cda0[_0x328e('0x18')](_0x4699ec);}return _0x45cda0[_0x328e('0x19')](_0x4699ec)[_0x328e('0x1a')]();};}function respondWithResult(_0x4abd75,_0x89600b){_0x89600b=_0x89600b||0xc8;return function(_0x1cddc3){if(_0x1cddc3){return _0x4abd75[_0x328e('0x19')](_0x89600b)[_0x328e('0x1b')](_0x1cddc3);}};}function respondWithFilteredResult(_0x29f8bf,_0x397b16){return function(_0x2a8096){if(_0x2a8096){var _0x3c5b37=typeof _0x397b16[_0x328e('0x1c')]==='undefined'&&typeof _0x397b16[_0x328e('0x1d')]===_0x328e('0x1e');var _0x116f46=_0x2a8096[_0x328e('0x1f')];var _0xf69c0f=_0x3c5b37?0x0:_0x397b16[_0x328e('0x1c')];var _0x41a6bb=_0x3c5b37?_0x2a8096['count']:_0x397b16[_0x328e('0x1c')]+_0x397b16[_0x328e('0x1d')];var _0x448f5a;if(_0x41a6bb>=_0x116f46){_0x41a6bb=_0x116f46;_0x448f5a=0xc8;}else{_0x448f5a=0xce;}_0x29f8bf[_0x328e('0x19')](_0x448f5a);return _0x29f8bf[_0x328e('0x20')]('Content-Range',_0xf69c0f+'-'+_0x41a6bb+'/'+_0x116f46)[_0x328e('0x1b')](_0x2a8096);}return null;};}function patchUpdates(_0x1c5551){return function(_0x3d876b){try{jsonpatch['apply'](_0x3d876b,_0x1c5551,!![]);}catch(_0x35da3b){return BPromise[_0x328e('0x21')](_0x35da3b);}return _0x3d876b[_0x328e('0x22')]();};}function saveUpdates(_0x273b45,_0x233bd3){return function(_0x1c43f8){if(_0x1c43f8){return _0x1c43f8[_0x328e('0x23')](_0x273b45)[_0x328e('0x24')](function(_0x3878d7){return _0x3878d7;});}return null;};}function removeEntity(_0x5cbc7f,_0x4e1d4c){return function(_0x139ef3){if(_0x139ef3){return _0x139ef3[_0x328e('0x25')]()[_0x328e('0x24')](function(){_0x5cbc7f[_0x328e('0x19')](0xcc)[_0x328e('0x1a')]();});}};}function handleEntityNotFound(_0x4a62a8,_0x23fda2){return function(_0x48a854){if(!_0x48a854){_0x4a62a8[_0x328e('0x18')](0x194);}return _0x48a854;};}function handleError(_0x476b6a,_0x28da22){_0x28da22=_0x28da22||0x1f4;return function(_0x2fab5a){logger[_0x328e('0x26')](_0x2fab5a['stack']);if(_0x2fab5a['name']){delete _0x2fab5a[_0x328e('0x27')];}_0x476b6a['status'](_0x28da22)['send'](_0x2fab5a);};}exports[_0x328e('0x28')]=function(_0x270d58,_0x5873d1){var _0x232ec7={},_0x1fdc4d={},_0x4bdadc={'count':0x0,'rows':[]};var _0x26a204=_[_0x328e('0x29')](db[_0x328e('0x2a')][_0x328e('0x2b')],function(_0x24702c){return{'name':_0x24702c['fieldName'],'type':_0x24702c[_0x328e('0x2c')][_0x328e('0x2d')]};});_0x1fdc4d[_0x328e('0x2e')]=_[_0x328e('0x29')](_0x26a204,_0x328e('0x27'));_0x1fdc4d[_0x328e('0x2f')]=_[_0x328e('0x30')](_0x270d58[_0x328e('0x2f')]);_0x1fdc4d[_0x328e('0x31')]=_['intersection'](_0x1fdc4d['model'],_0x1fdc4d[_0x328e('0x2f')]);_0x232ec7[_0x328e('0x32')]=_['intersection'](_0x1fdc4d['model'],qs['fields'](_0x270d58[_0x328e('0x2f')][_0x328e('0x33')]));_0x232ec7[_0x328e('0x32')]=_0x232ec7[_0x328e('0x32')][_0x328e('0x34')]?_0x232ec7[_0x328e('0x32')]:_0x1fdc4d[_0x328e('0x2e')];if(!_0x270d58['query'][_0x328e('0x35')]('nolimit')){_0x232ec7['limit']=qs[_0x328e('0x1d')](_0x270d58['query'][_0x328e('0x1d')]);_0x232ec7[_0x328e('0x1c')]=qs[_0x328e('0x1c')](_0x270d58['query'][_0x328e('0x1c')]);}_0x232ec7['order']=qs[_0x328e('0x36')](_0x270d58[_0x328e('0x2f')][_0x328e('0x36')]);_0x232ec7[_0x328e('0x37')]=qs['filters'](_[_0x328e('0x38')](_0x270d58['query'],_0x1fdc4d[_0x328e('0x31')]),_0x26a204);if(_0x270d58['query']['filter']){_0x232ec7[_0x328e('0x37')]=_['merge'](_0x232ec7[_0x328e('0x37')],{'$or':_[_0x328e('0x29')](_0x26a204,function(_0x1892e0){if(_0x1892e0[_0x328e('0x2c')]!=='VIRTUAL'){var _0x676dee={};_0x676dee[_0x1892e0[_0x328e('0x27')]]={'$like':'%'+_0x270d58[_0x328e('0x2f')][_0x328e('0x39')]+'%'};return _0x676dee;}})});}_0x232ec7=_[_0x328e('0x3a')]({},_0x232ec7,_0x270d58['options']);var _0xf05003={'where':_0x232ec7[_0x328e('0x37')]};return db[_0x328e('0x2a')]['count'](_0xf05003)['then'](function(_0x59712d){_0x4bdadc[_0x328e('0x1f')]=_0x59712d;if(_0x270d58['query'][_0x328e('0x3b')]){_0x232ec7[_0x328e('0x3c')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x232ec7);})[_0x328e('0x24')](function(_0x37c24f){_0x4bdadc[_0x328e('0x3d')]=_0x37c24f;return _0x4bdadc;})[_0x328e('0x24')](respondWithFilteredResult(_0x5873d1,_0x232ec7))[_0x328e('0x3e')](handleError(_0x5873d1,null));};exports[_0x328e('0x3f')]=function(_0x2e06f1,_0x1c94e9){var _0x2a823e={'raw':!![],'where':{'id':_0x2e06f1[_0x328e('0x40')]['id']}},_0xdf4229={};_0xdf4229[_0x328e('0x2e')]=_['keys'](db[_0x328e('0x2a')]['rawAttributes']);_0xdf4229['query']=_[_0x328e('0x30')](_0x2e06f1[_0x328e('0x2f')]);_0xdf4229[_0x328e('0x31')]=_['intersection'](_0xdf4229[_0x328e('0x2e')],_0xdf4229[_0x328e('0x2f')]);_0x2a823e[_0x328e('0x32')]=_[_0x328e('0x41')](_0xdf4229[_0x328e('0x2e')],qs[_0x328e('0x33')](_0x2e06f1[_0x328e('0x2f')]['fields']));_0x2a823e['attributes']=_0x2a823e[_0x328e('0x32')][_0x328e('0x34')]?_0x2a823e['attributes']:_0xdf4229[_0x328e('0x2e')];if(_0x2e06f1[_0x328e('0x2f')][_0x328e('0x3b')]){_0x2a823e['include']=[{'all':!![]}];}_0x2a823e=_[_0x328e('0x3a')]({},_0x2a823e,_0x2e06f1[_0x328e('0x42')]);return db[_0x328e('0x2a')][_0x328e('0x43')](_0x2a823e)[_0x328e('0x24')](handleEntityNotFound(_0x1c94e9,null))[_0x328e('0x24')](respondWithResult(_0x1c94e9,null))[_0x328e('0x3e')](handleError(_0x1c94e9,null));};exports['create']=function(_0x238d47,_0x13ac38){return db[_0x328e('0x2a')]['create'](_0x238d47[_0x328e('0x44')],{})[_0x328e('0x24')](respondWithResult(_0x13ac38,0xc9))[_0x328e('0x3e')](handleError(_0x13ac38,null));};exports[_0x328e('0x23')]=function(_0x1532d7,_0x294945){if(_0x1532d7[_0x328e('0x44')]['id']){delete _0x1532d7['body']['id'];}return db[_0x328e('0x2a')][_0x328e('0x43')]({'where':{'id':_0x1532d7[_0x328e('0x40')]['id']}})[_0x328e('0x24')](handleEntityNotFound(_0x294945,null))[_0x328e('0x24')](saveUpdates(_0x1532d7[_0x328e('0x44')],null))[_0x328e('0x24')](respondWithResult(_0x294945,null))['catch'](handleError(_0x294945,null));};exports['destroy']=function(_0x4d9792,_0xcad004){return db[_0x328e('0x2a')][_0x328e('0x43')]({'where':{'id':_0x4d9792[_0x328e('0x40')]['id']}})['then'](handleEntityNotFound(_0xcad004,null))[_0x328e('0x24')](removeEntity(_0xcad004,null))['catch'](handleError(_0xcad004,null));};exports[_0x328e('0x45')]=function(_0x1c49e6,_0x287ea4){return db[_0x328e('0x2a')][_0x328e('0x45')]()[_0x328e('0x24')](respondWithResult(_0x287ea4,null))['catch'](handleError(_0x287ea4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index e6c9db0..a17e213 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 _0x8bf6=['./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3104ae,_0x2ba4bf){var _0x306c53=function(_0xef4612){while(--_0xef4612){_0x3104ae['push'](_0x3104ae['shift']());}};_0x306c53(++_0x2ba4bf);}(_0x8bf6,0x1c8));var _0x68bf=function(_0x4b2d2a,_0x267012){_0x4b2d2a=_0x4b2d2a-0x0;var _0x596fc1=_0x8bf6[_0x4b2d2a];return _0x596fc1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x68bf('0x0'))(_0x68bf('0x1'));var moment=require(_0x68bf('0x2'));var BPromise=require(_0x68bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x68bf('0x4'));var rimraf=require(_0x68bf('0x5'));var config=require('../../config/environment');var attributes=require(_0x68bf('0x6'));module[_0x68bf('0x7')]=function(_0x2c2c51,_0x31ef85){return _0x2c2c51[_0x68bf('0x8')](_0x68bf('0x9'),attributes,{'tableName':_0x68bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7adf=['exports','JscriptyAnswerReport','lodash','util','../../config/logger','bluebird','path','rimraf','./jscriptyAnswerReport.attributes'];(function(_0x33f79b,_0x2acfe8){var _0x1404a7=function(_0x5a2b50){while(--_0x5a2b50){_0x33f79b['push'](_0x33f79b['shift']());}};_0x1404a7(++_0x2acfe8);}(_0x7adf,0x146));var _0xf7ad=function(_0x41c8ec,_0xc66abb){_0x41c8ec=_0x41c8ec-0x0;var _0x22c4c4=_0x7adf[_0x41c8ec];return _0x22c4c4;};'use strict';var _=require(_0xf7ad('0x0'));var util=require(_0xf7ad('0x1'));var logger=require(_0xf7ad('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf7ad('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7ad('0x4'));var rimraf=require(_0xf7ad('0x5'));var config=require('../../config/environment');var attributes=require(_0xf7ad('0x6'));module[_0xf7ad('0x7')]=function(_0x3d4ace,_0x1e1a54){return _0x3d4ace['define'](_0xf7ad('0x8'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 4764a01..d2b92d7 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 _0x0c5c=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x0c5c,0x92));var _0xc0c5=function(_0x58cecb,_0x5e4a99){_0x58cecb=_0x58cecb-0x0;var _0x38e0a9=_0x0c5c[_0x58cecb];return _0x38e0a9;};'use strict';var _=require(_0xc0c5('0x0'));var util=require(_0xc0c5('0x1'));var moment=require(_0xc0c5('0x2'));var BPromise=require(_0xc0c5('0x3'));var rs=require(_0xc0c5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc0c5('0x5'))['db'];var utils=require(_0xc0c5('0x6'));var logger=require(_0xc0c5('0x7'))('rpc');var config=require(_0xc0c5('0x8'));var jayson=require(_0xc0c5('0x9'));var client=jayson[_0xc0c5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a3110,_0x2f5705,_0x446410){return new BPromise(function(_0xc338ac,_0x43c5c0){return client[_0xc0c5('0xb')](_0x2a3110,_0x446410)[_0xc0c5('0xc')](function(_0x5150c5){logger[_0xc0c5('0xd')](_0xc0c5('0xe'),_0x2f5705,_0xc0c5('0xf'));logger['debug'](_0xc0c5('0x10'),_0x2f5705,_0xc0c5('0xf'),JSON['stringify'](_0x5150c5));if(_0x5150c5['error']){if(_0x5150c5['error'][_0xc0c5('0x11')]===0x1f4){logger[_0xc0c5('0x12')](_0xc0c5('0xe'),_0x2f5705,_0x5150c5[_0xc0c5('0x12')]['message']);return _0x43c5c0(_0x5150c5[_0xc0c5('0x12')]['message']);}logger[_0xc0c5('0x12')](_0xc0c5('0xe'),_0x2f5705,_0x5150c5[_0xc0c5('0x12')][_0xc0c5('0x13')]);return _0xc338ac(_0x5150c5['error'][_0xc0c5('0x13')]);}else{logger['info'](_0xc0c5('0xe'),_0x2f5705,'request\x20sent');_0xc338ac(_0x5150c5[_0xc0c5('0x14')]['message']);}})['catch'](function(_0x334483){logger[_0xc0c5('0x12')](_0xc0c5('0xe'),_0x2f5705,_0x334483);_0x43c5c0(_0x334483);});});} \ No newline at end of file +var _0x2ee7=['then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x282187,_0x2c4fc5){var _0x561d20=function(_0x45c8d4){while(--_0x45c8d4){_0x282187['push'](_0x282187['shift']());}};_0x561d20(++_0x2c4fc5);}(_0x2ee7,0xe7));var _0x72ee=function(_0x278a22,_0x117ec4){_0x278a22=_0x278a22-0x0;var _0xd5ce10=_0x2ee7[_0x278a22];return _0xd5ce10;};'use strict';var _=require(_0x72ee('0x0'));var util=require(_0x72ee('0x1'));var moment=require(_0x72ee('0x2'));var BPromise=require(_0x72ee('0x3'));var rs=require(_0x72ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x72ee('0x6'))(_0x72ee('0x7'));var config=require(_0x72ee('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x72ee('0x9')][_0x72ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b8a7c,_0x42278b,_0x2a99d0){return new BPromise(function(_0x165d65,_0x2f148c){return client['request'](_0x1b8a7c,_0x2a99d0)[_0x72ee('0xb')](function(_0x41649a){logger[_0x72ee('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x42278b,_0x72ee('0xd'));logger[_0x72ee('0xe')](_0x72ee('0xf'),_0x42278b,_0x72ee('0xd'),JSON['stringify'](_0x41649a));if(_0x41649a[_0x72ee('0x10')]){if(_0x41649a[_0x72ee('0x10')][_0x72ee('0x11')]===0x1f4){logger['error'](_0x72ee('0x12'),_0x42278b,_0x41649a['error'][_0x72ee('0x13')]);return _0x2f148c(_0x41649a[_0x72ee('0x10')][_0x72ee('0x13')]);}logger[_0x72ee('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x42278b,_0x41649a[_0x72ee('0x10')][_0x72ee('0x13')]);return _0x165d65(_0x41649a[_0x72ee('0x10')][_0x72ee('0x13')]);}else{logger[_0x72ee('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x42278b,_0x72ee('0xd'));_0x165d65(_0x41649a[_0x72ee('0x14')][_0x72ee('0x13')]);}})[_0x72ee('0x15')](function(_0x53239e){logger['error'](_0x72ee('0x12'),_0x42278b,_0x53239e);_0x2f148c(_0x53239e);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index a99f357..49ed6e3 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 _0xbd2a=['/:id/clone','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','get','index','/:id','show','/:id/sessions','getSessions','/:id/answers','isAuthenticated','getAnswers','30s','getSummary','post','create'];(function(_0xe47034,_0x540251){var _0x5a9957=function(_0x34fe51){while(--_0x34fe51){_0xe47034['push'](_0xe47034['shift']());}};_0x5a9957(++_0x540251);}(_0xbd2a,0x132));var _0xabd2=function(_0x1791c9,_0x57703a){_0x1791c9=_0x1791c9-0x0;var _0x1e2528=_0xbd2a[_0x1791c9];return _0x1e2528;};'use strict';var multer=require(_0xabd2('0x0'));var util=require('util');var path=require(_0xabd2('0x1'));var timeout=require('connect-timeout');var express=require(_0xabd2('0x2'));var router=express[_0xabd2('0x3')]();var fs_extra=require(_0xabd2('0x4'));var auth=require(_0xabd2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0xabd2('0x6')]('/',auth['isAuthenticated'](),controller[_0xabd2('0x7')]);router[_0xabd2('0x6')](_0xabd2('0x8'),auth['isAuthenticated'](),controller[_0xabd2('0x9')]);router[_0xabd2('0x6')](_0xabd2('0xa'),auth['isAuthenticated'](),controller[_0xabd2('0xb')]);router['get'](_0xabd2('0xc'),auth[_0xabd2('0xd')](),controller[_0xabd2('0xe')]);router[_0xabd2('0x6')]('/:id/summary',auth[_0xabd2('0xd')](),timeout(_0xabd2('0xf')),controller[_0xabd2('0x10')]);router[_0xabd2('0x11')]('/',auth['isAuthenticated'](),controller[_0xabd2('0x12')]);router['post'](_0xabd2('0x13'),auth[_0xabd2('0xd')](),controller['clone']);router[_0xabd2('0x14')]('/:id',auth[_0xabd2('0xd')](),controller[_0xabd2('0x15')]);router[_0xabd2('0x16')](_0xabd2('0x8'),auth[_0xabd2('0xd')](),controller[_0xabd2('0x17')]);module[_0xabd2('0x18')]=router; \ No newline at end of file +var _0x0bb1=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post','clone','put','update','delete'];(function(_0x503d26,_0x460dd4){var _0x4e5b4d=function(_0x5d0afe){while(--_0x5d0afe){_0x503d26['push'](_0x503d26['shift']());}};_0x4e5b4d(++_0x460dd4);}(_0x0bb1,0x7e));var _0x10bb=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0x0bb1[_0x52121d];return _0x448627;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x10bb('0x0'));var timeout=require(_0x10bb('0x1'));var express=require(_0x10bb('0x2'));var router=express[_0x10bb('0x3')]();var fs_extra=require(_0x10bb('0x4'));var auth=require(_0x10bb('0x5'));var interaction=require(_0x10bb('0x6'));var config=require(_0x10bb('0x7'));var controller=require(_0x10bb('0x8'));router[_0x10bb('0x9')]('/',auth[_0x10bb('0xa')](),controller[_0x10bb('0xb')]);router[_0x10bb('0x9')](_0x10bb('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x10bb('0x9')]('/:id/sessions',auth['isAuthenticated'](),controller['getSessions']);router[_0x10bb('0x9')](_0x10bb('0xd'),auth[_0x10bb('0xa')](),controller[_0x10bb('0xe')]);router[_0x10bb('0x9')](_0x10bb('0xf'),auth[_0x10bb('0xa')](),timeout(_0x10bb('0x10')),controller[_0x10bb('0x11')]);router['post']('/',auth[_0x10bb('0xa')](),controller[_0x10bb('0x12')]);router[_0x10bb('0x13')]('/:id/clone',auth['isAuthenticated'](),controller[_0x10bb('0x14')]);router[_0x10bb('0x15')](_0x10bb('0xc'),auth[_0x10bb('0xa')](),controller[_0x10bb('0x16')]);router[_0x10bb('0x17')](_0x10bb('0xc'),auth[_0x10bb('0xa')](),controller[_0x10bb('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 7f4ed27..373ea00 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 _0x5919=['sequelize','lodash','util','exports','STRING','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x25f372,_0x18327c){var _0x1069b7=function(_0x4566dc){while(--_0x4566dc){_0x25f372['push'](_0x25f372['shift']());}};_0x1069b7(++_0x18327c);}(_0x5919,0x75));var _0x9591=function(_0x537baf,_0x1d08ad){_0x537baf=_0x537baf-0x0;var _0x574e77=_0x5919[_0x537baf];return _0x574e77;};'use strict';var Sequelize=require(_0x9591('0x0'));var _=require(_0x9591('0x1'));var util=require(_0x9591('0x2'));module[_0x9591('0x3')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x9591('0x4')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x46c881){if(_['isObjectLike'](_0x46c881)){this[_0x9591('0x5')](_0x9591('0x6'),JSON['stringify'](_0x46c881));}else if(_[_0x9591('0x7')](_0x46c881)){this[_0x9591('0x5')]('formData',_0x46c881);}else{this[_0x9591('0x5')](_0x9591('0x6'),util[_0x9591('0x8')](_0x9591('0x9'),this[_0x9591('0xa')]('name')||'',this[_0x9591('0xa')](_0x9591('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9591('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9591('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0xeba9=['TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name'];(function(_0x127df0,_0xa6fe59){var _0x333bdc=function(_0x16bdbb){while(--_0x16bdbb){_0x127df0['push'](_0x127df0['shift']());}};_0x333bdc(++_0xa6fe59);}(_0xeba9,0x17b));var _0x9eba=function(_0x1e679a,_0x5d93e3){_0x1e679a=_0x1e679a-0x0;var _0x35aba7=_0xeba9[_0x1e679a];return _0x35aba7;};'use strict';var Sequelize=require(_0x9eba('0x0'));var _=require(_0x9eba('0x1'));var util=require(_0x9eba('0x2'));module['exports']={'name':{'type':Sequelize[_0x9eba('0x3')],'unique':_0x9eba('0x4')},'description':{'type':Sequelize[_0x9eba('0x3')]},'formData':{'type':Sequelize[_0x9eba('0x5')](_0x9eba('0x6')),'set':function(_0xeb3755){if(_[_0x9eba('0x7')](_0xeb3755)){this[_0x9eba('0x8')](_0x9eba('0x9'),JSON[_0x9eba('0xa')](_0xeb3755));}else if(_[_0x9eba('0xb')](_0xeb3755)){this['setDataValue'](_0x9eba('0x9'),_0xeb3755);}else{this[_0x9eba('0x8')](_0x9eba('0x9'),util['format'](_0x9eba('0xc'),this[_0x9eba('0xd')](_0x9eba('0x4'))||'',this['getDataValue'](_0x9eba('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9eba('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9eba('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a7df451..e29e679 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 _0x2b84=['fromCharCode','apply','indexOf','toString','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','download','sendStatus','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Projects','UserProfileResource','error','name','index','map','JscriptyProject','rawAttributes','type','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','options','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','findOne','hasOwnProperty','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number'];(function(_0xf08375,_0x21611d){var _0x191f56=function(_0x2b1e91){while(--_0x2b1e91){_0xf08375['push'](_0xf08375['shift']());}};_0x191f56(++_0x21611d);}(_0x2b84,0x1ed));var _0x42b8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2b84[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x42b8('0x0'));var rimraf=require(_0x42b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x42b8('0x2'));var rp=require(_0x42b8('0x3'));var moment=require(_0x42b8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x42b8('0x5'));var util=require('util');var path=require(_0x42b8('0x6'));var sox=require('sox');var csv=require(_0x42b8('0x7'));var ejs=require(_0x42b8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x42b8('0x9'));var crypto=require(_0x42b8('0xa'));var jsforce=require(_0x42b8('0xb'));var deskjs=require(_0x42b8('0xc'));var toCsv=require(_0x42b8('0x7'));var querystring=require('querystring');var Papa=require(_0x42b8('0xd'));var Redis=require(_0x42b8('0xe'));var authService=require(_0x42b8('0xf'));var qs=require(_0x42b8('0x10'));var as=require(_0x42b8('0x11'));var hardwareService=require(_0x42b8('0x12'));var logger=require(_0x42b8('0x13'))(_0x42b8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x42b8('0x15'));var db=require(_0x42b8('0x16'))['db'];function respondWithStatusCode(_0x5a10b5,_0x3f7cc1){_0x3f7cc1=_0x3f7cc1||0xcc;return function(_0x54d531){if(_0x54d531){return _0x5a10b5['sendStatus'](_0x3f7cc1);}return _0x5a10b5[_0x42b8('0x17')](_0x3f7cc1)[_0x42b8('0x18')]();};}function respondWithResult(_0x15fab4,_0x1ea576){_0x1ea576=_0x1ea576||0xc8;return function(_0xf1fcc1){if(_0xf1fcc1){return _0x15fab4['status'](_0x1ea576)[_0x42b8('0x19')](_0xf1fcc1);}};}function respondWithFilteredResult(_0x48d8f9,_0x23a8f8){return function(_0x58c768){if(_0x58c768){var _0x54b74b=typeof _0x23a8f8[_0x42b8('0x1a')]===_0x42b8('0x1b')&&typeof _0x23a8f8[_0x42b8('0x1c')]===_0x42b8('0x1b');var _0x1b7701=_0x58c768[_0x42b8('0x1d')];var _0x5ef289=_0x54b74b?0x0:_0x23a8f8[_0x42b8('0x1a')];var _0x5664a4=_0x54b74b?_0x58c768['count']:_0x23a8f8[_0x42b8('0x1a')]+_0x23a8f8[_0x42b8('0x1c')];var _0x2310a2;if(_0x5664a4>=_0x1b7701){_0x5664a4=_0x1b7701;_0x2310a2=0xc8;}else{_0x2310a2=0xce;}_0x48d8f9[_0x42b8('0x17')](_0x2310a2);return _0x48d8f9[_0x42b8('0x1e')](_0x42b8('0x1f'),_0x5ef289+'-'+_0x5664a4+'/'+_0x1b7701)[_0x42b8('0x19')](_0x58c768);}return null;};}function patchUpdates(_0x3dd964){return function(_0x2a28ba){try{jsonpatch['apply'](_0x2a28ba,_0x3dd964,!![]);}catch(_0x5dbcdd){return BPromise['reject'](_0x5dbcdd);}return _0x2a28ba[_0x42b8('0x20')]();};}function saveUpdates(_0xcdbef8,_0x135bab){return function(_0x20b35f){if(_0x20b35f){return _0x20b35f['update'](_0xcdbef8)[_0x42b8('0x21')](function(_0x3434b0){return _0x3434b0;});}return null;};}function removeEntity(_0x5cbca8,_0x479b6d){return function(_0x328e72){if(_0x328e72){return _0x328e72[_0x42b8('0x22')]()[_0x42b8('0x21')](function(){var _0x183bd0=_0x328e72[_0x42b8('0x23')]({'plain':!![]});var _0x551b5e=_0x42b8('0x24');return db[_0x42b8('0x25')][_0x42b8('0x22')]({'where':{'type':_0x551b5e,'resourceId':_0x183bd0['id']}})[_0x42b8('0x21')](function(){return _0x328e72;});})[_0x42b8('0x21')](function(){_0x5cbca8['status'](0xcc)[_0x42b8('0x18')]();});}};}function handleEntityNotFound(_0x2a50aa,_0x583c70){return function(_0x471fc0){if(!_0x471fc0){_0x2a50aa['sendStatus'](0x194);}return _0x471fc0;};}function handleError(_0x1fd893,_0x124aef){_0x124aef=_0x124aef||0x1f4;return function(_0x59dc05){logger[_0x42b8('0x26')](_0x59dc05['stack']);if(_0x59dc05[_0x42b8('0x27')]){delete _0x59dc05[_0x42b8('0x27')];}_0x1fd893[_0x42b8('0x17')](_0x124aef)['send'](_0x59dc05);};}exports[_0x42b8('0x28')]=function(_0x2dcfc8,_0x81944d){var _0x45b1e1={},_0x520c4={},_0x453227={'count':0x0,'rows':[]};var _0x196e8f=_[_0x42b8('0x29')](db[_0x42b8('0x2a')][_0x42b8('0x2b')],function(_0x3a795b){return{'name':_0x3a795b['fieldName'],'type':_0x3a795b[_0x42b8('0x2c')][_0x42b8('0x2d')]};});_0x520c4['model']=_[_0x42b8('0x29')](_0x196e8f,_0x42b8('0x27'));_0x520c4[_0x42b8('0x2e')]=_[_0x42b8('0x2f')](_0x2dcfc8['query']);_0x520c4[_0x42b8('0x30')]=_['intersection'](_0x520c4[_0x42b8('0x31')],_0x520c4[_0x42b8('0x2e')]);_0x45b1e1['attributes']=_[_0x42b8('0x32')](_0x520c4[_0x42b8('0x31')],qs[_0x42b8('0x33')](_0x2dcfc8[_0x42b8('0x2e')][_0x42b8('0x33')]));_0x45b1e1[_0x42b8('0x34')]=_0x45b1e1[_0x42b8('0x34')][_0x42b8('0x35')]?_0x45b1e1['attributes']:_0x520c4[_0x42b8('0x31')];if(!_0x2dcfc8['query']['hasOwnProperty'](_0x42b8('0x36'))){_0x45b1e1[_0x42b8('0x1c')]=qs[_0x42b8('0x1c')](_0x2dcfc8[_0x42b8('0x2e')]['limit']);_0x45b1e1[_0x42b8('0x1a')]=qs['offset'](_0x2dcfc8[_0x42b8('0x2e')][_0x42b8('0x1a')]);}_0x45b1e1[_0x42b8('0x37')]=qs[_0x42b8('0x38')](_0x2dcfc8[_0x42b8('0x2e')][_0x42b8('0x38')]);_0x45b1e1[_0x42b8('0x39')]=qs['filters'](_[_0x42b8('0x3a')](_0x2dcfc8[_0x42b8('0x2e')],_0x520c4[_0x42b8('0x30')]),_0x196e8f);if(_0x2dcfc8['query'][_0x42b8('0x3b')]){_0x45b1e1['where']=_[_0x42b8('0x3c')](_0x45b1e1[_0x42b8('0x39')],{'$or':_['map'](_0x196e8f,function(_0x2025cd){if(_0x2025cd[_0x42b8('0x2c')]!==_0x42b8('0x3d')){var _0x16c419={};_0x16c419[_0x2025cd[_0x42b8('0x27')]]={'$like':'%'+_0x2dcfc8[_0x42b8('0x2e')][_0x42b8('0x3b')]+'%'};return _0x16c419;}})});}_0x45b1e1=_[_0x42b8('0x3c')]({},_0x45b1e1,_0x2dcfc8['options']);var _0x138266={'where':_0x45b1e1[_0x42b8('0x39')]};return db['JscriptyProject'][_0x42b8('0x1d')](_0x138266)[_0x42b8('0x21')](function(_0x3f8d00){_0x453227[_0x42b8('0x1d')]=_0x3f8d00;if(_0x2dcfc8['query'][_0x42b8('0x3e')]){_0x45b1e1[_0x42b8('0x3f')]=[{'all':!![]}];}return db[_0x42b8('0x2a')][_0x42b8('0x40')](_0x45b1e1);})[_0x42b8('0x21')](function(_0x5ded87){_0x453227[_0x42b8('0x41')]=_0x5ded87;return _0x453227;})[_0x42b8('0x21')](respondWithFilteredResult(_0x81944d,_0x45b1e1))[_0x42b8('0x42')](handleError(_0x81944d,null));};exports[_0x42b8('0x43')]=function(_0x5e34a4,_0x18fb14){var _0x3328a9={'raw':![],'where':{'id':_0x5e34a4['params']['id']}},_0x32d6d2={};_0x32d6d2['model']=_[_0x42b8('0x2f')](db[_0x42b8('0x2a')][_0x42b8('0x2b')]);_0x32d6d2[_0x42b8('0x2e')]=_[_0x42b8('0x2f')](_0x5e34a4[_0x42b8('0x2e')]);_0x32d6d2[_0x42b8('0x30')]=_[_0x42b8('0x32')](_0x32d6d2[_0x42b8('0x31')],_0x32d6d2[_0x42b8('0x2e')]);_0x3328a9['attributes']=_[_0x42b8('0x32')](_0x32d6d2[_0x42b8('0x31')],qs['fields'](_0x5e34a4['query']['fields']));_0x3328a9['attributes']=_0x3328a9[_0x42b8('0x34')][_0x42b8('0x35')]?_0x3328a9[_0x42b8('0x34')]:_0x32d6d2[_0x42b8('0x31')];if(_0x5e34a4[_0x42b8('0x2e')][_0x42b8('0x3e')]){_0x3328a9['include']=[{'all':!![]}];}_0x3328a9=_[_0x42b8('0x3c')]({},_0x3328a9,_0x5e34a4['options']);return db[_0x42b8('0x2a')][_0x42b8('0x44')](_0x3328a9)['then'](handleEntityNotFound(_0x18fb14,null))[_0x42b8('0x21')](respondWithResult(_0x18fb14,null))[_0x42b8('0x42')](handleError(_0x18fb14,null));};exports['create']=function(_0x47b4ec,_0x37dbdd){return db[_0x42b8('0x2a')][_0x42b8('0x45')](_0x47b4ec[_0x42b8('0x46')],{})[_0x42b8('0x21')](function(_0x24b474){var _0x2c0d4b=_0x47b4ec[_0x42b8('0x47')]['get']({'plain':!![]});if(!_0x2c0d4b)throw new Error(_0x42b8('0x48'));if(_0x2c0d4b[_0x42b8('0x49')]==='user'){var _0x404e53=_0x24b474[_0x42b8('0x23')]({'plain':!![]});var _0x5da195=_0x42b8('0x24');return db['UserProfileSection'][_0x42b8('0x44')]({'where':{'name':_0x5da195,'userProfileId':_0x2c0d4b[_0x42b8('0x4a')]},'raw':!![]})[_0x42b8('0x21')](function(_0x49eab7){if(_0x49eab7&&_0x49eab7[_0x42b8('0x4b')]===0x0){return db[_0x42b8('0x25')][_0x42b8('0x45')]({'name':_0x404e53[_0x42b8('0x27')],'resourceId':_0x404e53['id'],'type':_0x49eab7['name'],'sectionId':_0x49eab7['id']},{})[_0x42b8('0x21')](function(){return _0x24b474;});}else{return _0x24b474;}})['catch'](function(_0x353511){logger[_0x42b8('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x353511);throw _0x353511;});}return _0x24b474;})[_0x42b8('0x21')](respondWithResult(_0x37dbdd,0xc9))[_0x42b8('0x42')](handleError(_0x37dbdd,null));};exports[_0x42b8('0x4c')]=function(_0x441dfa,_0x2f1380){var _0x50465b={'where':{'id':_0x441dfa['params']['id']}},_0x2abbab={};_0x2abbab[_0x42b8('0x31')]=_['keys'](db[_0x42b8('0x2a')][_0x42b8('0x2b')]);_0x50465b[_0x42b8('0x34')]=_[_0x42b8('0x32')](_0x2abbab[_0x42b8('0x31')],qs[_0x42b8('0x33')](_0x441dfa['query'][_0x42b8('0x33')]));_0x50465b[_0x42b8('0x34')]=_0x50465b['attributes'][_0x42b8('0x35')]?_0x50465b[_0x42b8('0x34')]:_0x2abbab[_0x42b8('0x31')];if(_0x441dfa['query']['includeAll']){_0x50465b['include']=[{'all':!![]}];}_0x50465b=_[_0x42b8('0x3c')]({},_0x50465b,_0x441dfa[_0x42b8('0x4d')]);return db[_0x42b8('0x2a')][_0x42b8('0x44')](_0x50465b)['then'](handleEntityNotFound(_0x2f1380,null))[_0x42b8('0x21')](function(_0x4afdd4){if(_0x4afdd4){var _0x1c3bf3=_0x4afdd4[_0x42b8('0x23')]({'plain':!![]});_0x1c3bf3=qs[_0x42b8('0x4e')](_0x1c3bf3,['id',_0x42b8('0x4f'),'updatedAt']);_0x441dfa[_0x42b8('0x46')]=_[_0x42b8('0x4e')](_0x441dfa[_0x42b8('0x46')],['id',_0x42b8('0x4f'),_0x42b8('0x50')]);return db[_0x42b8('0x2a')]['create'](_[_0x42b8('0x3c')](_0x1c3bf3,_0x441dfa[_0x42b8('0x46')]),{'include':_0x441dfa[_0x42b8('0x2e')][_0x42b8('0x3e')]?[{'all':!![]}]:undefined})[_0x42b8('0x21')](function(_0x5e655b){var _0x67cdc5=_0x441dfa[_0x42b8('0x47')]['get']({'plain':!![]});if(!_0x67cdc5)throw new Error(_0x42b8('0x48'));if(_0x67cdc5[_0x42b8('0x49')]==='user'){var _0x1c6c5e=_0x5e655b[_0x42b8('0x23')]({'plain':!![]});var _0x3f2ff0=_0x42b8('0x24');return db[_0x42b8('0x51')][_0x42b8('0x44')]({'where':{'name':_0x3f2ff0,'userProfileId':_0x67cdc5[_0x42b8('0x4a')]},'raw':!![]})[_0x42b8('0x21')](function(_0x67ce7a){if(_0x67ce7a&&_0x67ce7a[_0x42b8('0x4b')]===0x0){return db[_0x42b8('0x25')]['create']({'name':_0x1c6c5e[_0x42b8('0x27')],'resourceId':_0x1c6c5e['id'],'type':_0x67ce7a[_0x42b8('0x27')],'sectionId':_0x67ce7a['id']},{})['then'](function(){return _0x5e655b;});}else{return _0x5e655b;}})[_0x42b8('0x42')](function(_0x4fdcfd){logger[_0x42b8('0x26')](_0x42b8('0x52'),_0x4fdcfd);throw _0x4fdcfd;});}return _0x5e655b;});}})[_0x42b8('0x21')](respondWithResult(_0x2f1380,0xc9))[_0x42b8('0x42')](handleError(_0x2f1380,null));};exports[_0x42b8('0x53')]=function(_0x248572,_0x15bf33){if(_0x248572[_0x42b8('0x46')]['id']){delete _0x248572[_0x42b8('0x46')]['id'];}return db[_0x42b8('0x2a')]['find']({'where':{'id':_0x248572[_0x42b8('0x54')]['id']}})[_0x42b8('0x21')](handleEntityNotFound(_0x15bf33,null))['then'](saveUpdates(_0x248572['body'],null))['then'](respondWithResult(_0x15bf33,null))[_0x42b8('0x42')](handleError(_0x15bf33,null));};exports[_0x42b8('0x22')]=function(_0x5d5a48,_0x32e010){return db[_0x42b8('0x2a')][_0x42b8('0x44')]({'where':{'id':_0x5d5a48[_0x42b8('0x54')]['id']}})[_0x42b8('0x21')](handleEntityNotFound(_0x32e010,null))['then'](removeEntity(_0x32e010,null))['catch'](handleError(_0x32e010,null));};exports['getSessions']=function(_0x150f9a,_0x490950,_0x22cf66){var _0xad151={'raw':!![],'where':{}};var _0x2787ac={};var _0x185b77={'count':0x0,'rows':[]};return db[_0x42b8('0x2a')][_0x42b8('0x55')]({'where':{'id':_0x150f9a['params']['id']}})['then'](handleEntityNotFound(_0x490950,null))['then'](function(_0xd12625){if(_0xd12625){_0x2787ac['model']=_[_0x42b8('0x2f')](db['JscriptySessionReport'][_0x42b8('0x2b')]);_0x2787ac[_0x42b8('0x2e')]=_['keys'](_0x150f9a[_0x42b8('0x2e')]);_0x2787ac[_0x42b8('0x30')]=_[_0x42b8('0x32')](_0x2787ac['model'],_0x2787ac[_0x42b8('0x2e')]);_0xad151[_0x42b8('0x34')]=_[_0x42b8('0x32')](_0x2787ac[_0x42b8('0x31')],qs[_0x42b8('0x33')](_0x150f9a['query'][_0x42b8('0x33')]));_0xad151[_0x42b8('0x34')]=_0xad151[_0x42b8('0x34')][_0x42b8('0x35')]?_0xad151[_0x42b8('0x34')]:_0x2787ac[_0x42b8('0x31')];if(!_0x150f9a[_0x42b8('0x2e')][_0x42b8('0x56')](_0x42b8('0x36'))){_0xad151[_0x42b8('0x1c')]=qs['limit'](_0x150f9a[_0x42b8('0x2e')][_0x42b8('0x1c')]);_0xad151[_0x42b8('0x1a')]=qs[_0x42b8('0x1a')](_0x150f9a[_0x42b8('0x2e')][_0x42b8('0x1a')]);}_0xad151[_0x42b8('0x37')]=qs[_0x42b8('0x38')](_0x150f9a[_0x42b8('0x2e')][_0x42b8('0x38')]);_0xad151[_0x42b8('0x39')]=qs[_0x42b8('0x30')](_[_0x42b8('0x3a')](_0x150f9a['query'],_0x2787ac[_0x42b8('0x30')]));_0xad151[_0x42b8('0x39')][_0x42b8('0x57')]=_0xd12625['id'];if(_0x150f9a['query']['filter']){_0xad151[_0x42b8('0x39')]=_[_0x42b8('0x3c')](_0xad151[_0x42b8('0x39')],{'$or':_[_0x42b8('0x29')](_0xad151[_0x42b8('0x34')],function(_0x1fd73c){var _0x2aa45c={};_0x2aa45c[_0x1fd73c]={'$like':'%'+_0x150f9a[_0x42b8('0x2e')][_0x42b8('0x3b')]+'%'};return _0x2aa45c;})});}_0xad151=_[_0x42b8('0x3c')]({},_0xad151,_0x150f9a['options']);return db[_0x42b8('0x58')][_0x42b8('0x1d')]({'where':_0xad151[_0x42b8('0x39')]})[_0x42b8('0x21')](function(_0x10845d){_0x185b77[_0x42b8('0x1d')]=_0x10845d;if(_0x150f9a['query'][_0x42b8('0x3e')]){_0xad151[_0x42b8('0x3f')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0xad151);})[_0x42b8('0x21')](function(_0x7ad47f){_0x185b77[_0x42b8('0x41')]=_0x7ad47f;return _0x185b77;});}})[_0x42b8('0x21')](respondWithFilteredResult(_0x490950,_0xad151))['catch'](handleError(_0x490950,null));};exports[_0x42b8('0x59')]=function(_0x1b5671,_0x5af69e,_0x5c531d){var _0x961495={'raw':!![],'where':{}};var _0x30624d={};var _0x45b80e={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x42b8('0x55')]({'where':{'id':_0x1b5671[_0x42b8('0x54')]['id']}})[_0x42b8('0x21')](handleEntityNotFound(_0x5af69e,null))[_0x42b8('0x21')](function(_0x5ede79){if(_0x5ede79){_0x30624d[_0x42b8('0x31')]=_[_0x42b8('0x2f')](db['JscriptyAnswerReport'][_0x42b8('0x2b')]);_0x30624d[_0x42b8('0x2e')]=_[_0x42b8('0x2f')](_0x1b5671[_0x42b8('0x2e')]);_0x30624d[_0x42b8('0x30')]=_[_0x42b8('0x32')](_0x30624d[_0x42b8('0x31')],_0x30624d[_0x42b8('0x2e')]);_0x961495[_0x42b8('0x34')]=_[_0x42b8('0x32')](_0x30624d['model'],qs[_0x42b8('0x33')](_0x1b5671[_0x42b8('0x2e')][_0x42b8('0x33')]));_0x961495['attributes']=_0x961495['attributes'][_0x42b8('0x35')]?_0x961495[_0x42b8('0x34')]:_0x30624d[_0x42b8('0x31')];if(!_0x1b5671[_0x42b8('0x2e')][_0x42b8('0x56')]('nolimit')){_0x961495['limit']=qs['limit'](_0x1b5671[_0x42b8('0x2e')]['limit']);_0x961495[_0x42b8('0x1a')]=qs[_0x42b8('0x1a')](_0x1b5671[_0x42b8('0x2e')][_0x42b8('0x1a')]);}_0x961495[_0x42b8('0x37')]=qs[_0x42b8('0x38')](_0x1b5671['query'][_0x42b8('0x38')]);_0x961495[_0x42b8('0x39')]=qs[_0x42b8('0x30')](_['pick'](_0x1b5671['query'],_0x30624d[_0x42b8('0x30')]));_0x961495[_0x42b8('0x39')][_0x42b8('0x57')]=_0x5ede79['id'];if(_0x1b5671['query'][_0x42b8('0x3b')]){_0x961495[_0x42b8('0x39')]=_['merge'](_0x961495['where'],{'$or':_[_0x42b8('0x29')](_0x961495[_0x42b8('0x34')],function(_0x8a5c19){var _0x5a5a2e={};_0x5a5a2e[_0x8a5c19]={'$like':'%'+_0x1b5671['query'][_0x42b8('0x3b')]+'%'};return _0x5a5a2e;})});}_0x961495=_['merge']({},_0x961495,_0x1b5671[_0x42b8('0x4d')]);return db[_0x42b8('0x5a')][_0x42b8('0x1d')]({'where':_0x961495[_0x42b8('0x39')]})[_0x42b8('0x21')](function(_0x4b43f4){_0x45b80e[_0x42b8('0x1d')]=_0x4b43f4;if(_0x1b5671[_0x42b8('0x2e')][_0x42b8('0x3e')]){_0x961495[_0x42b8('0x3f')]=[{'all':!![]}];}return db[_0x42b8('0x5a')][_0x42b8('0x40')](_0x961495);})['then'](function(_0x205b95){_0x45b80e[_0x42b8('0x41')]=_0x205b95;return _0x45b80e;});}})[_0x42b8('0x21')](respondWithFilteredResult(_0x5af69e,_0x961495))[_0x42b8('0x42')](handleError(_0x5af69e,null));};function char(_0x16fcbd){return _0x42b8('0x5b')===typeof _0x16fcbd?String[_0x42b8('0x5c')][_0x42b8('0x5d')](null,arguments):_0x16fcbd;}function needsEncapsulation(_0x5cdb9e){return!!_0x5cdb9e&&(_0x5cdb9e['toString']()[_0x42b8('0x5e')](char(0xd))>=0x0||_0x5cdb9e[_0x42b8('0x5f')]()[_0x42b8('0x5e')](char(0xa))>=0x0||_0x5cdb9e[_0x42b8('0x5f')]()[_0x42b8('0x5e')](char(0x2c))>=0x0||_0x5cdb9e[_0x42b8('0x5f')]()[_0x42b8('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x4e9f4e){var _0x49d7d4=char(0x22),_0x40d013='\x5c'+char(0x22),_0x512bb0=_0x4e9f4e[_0x42b8('0x5f')]()[_0x42b8('0x60')](new RegExp(_0x49d7d4,'g'),_0x40d013);return _0x49d7d4+_0x512bb0+_0x49d7d4;}exports[_0x42b8('0x61')]=function(_0xd10699,_0x1f62a2,_0x4c86e6){var _0x2ea580,_0xab5eb5;var _0x507731={'where':{'ProjectId':_0xd10699[_0x42b8('0x54')]['id']}};if(_0xd10699['query'][_0x42b8('0x62')]){_0x507731[_0x42b8('0x39')][_0x42b8('0x63')]=JSON['parse'](_0xd10699['query'][_0x42b8('0x62')]);}return db['JscriptySessionReport'][_0x42b8('0x40')](_0x507731)['then'](handleEntityNotFound(_0x1f62a2,null))[_0x42b8('0x21')](function(_0x55fe5d){if(_0x55fe5d){_0x2ea580=_0x55fe5d;return db[_0x42b8('0x64')][_0x42b8('0x40')]({'where':{'SessionId':{'$in':_[_0x42b8('0x29')](_0x2ea580,'id')},'ProjectId':_0xd10699[_0x42b8('0x54')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x1f62a2,null))[_0x42b8('0x21')](function(_0x5164bb){if(_0x5164bb){_0xab5eb5=_0x5164bb;var _0x4493eb={};for(var _0x3ec30c=0x0,_0x222f95=_0xab5eb5[_0x42b8('0x35')];_0x3ec30c<_0x222f95;_0x3ec30c++){if(!_0x4493eb['hasOwnProperty'](_0xab5eb5[_0x3ec30c][_0x42b8('0x65')])){_0x4493eb[_0xab5eb5[_0x3ec30c]['questionId']]=needsEncapsulation(_0xab5eb5[_0x3ec30c][_0x42b8('0x66')])?encapsulate(_0xab5eb5[_0x3ec30c]['question']):_0xab5eb5[_0x3ec30c]['question'];}}var _0xc00c7c=[],_0xe4fea5={};for(var _0x582488=0x0,_0x12d468=_0x2ea580[_0x42b8('0x35')];_0x582488<_0x12d468;_0x582488++){_0xe4fea5={'ProjectId':_0xd10699[_0x42b8('0x54')]['id'],'SessionId':_0x2ea580[_0x582488]['id'],'StartTime':moment(_0x2ea580[_0x582488][_0x42b8('0x63')])[_0x42b8('0x67')](_0x42b8('0x68'))};for(var _0x3e282c=0x0,_0x2ffe83=_0xab5eb5['length'];_0x3e282c<_0x2ffe83;_0x3e282c++){if(_0xab5eb5[_0x3e282c][_0x42b8('0x69')]==_0x2ea580[_0x582488]['id']&&_0x4493eb[_0x42b8('0x56')](_0xab5eb5[_0x3e282c][_0x42b8('0x65')])){_0xe4fea5[_0x4493eb[_0xab5eb5[_0x3e282c][_0x42b8('0x65')]]]=_0xab5eb5[_0x3e282c][_0x42b8('0x6a')];}}for(var _0x2e1fe1 in _0x4493eb){if(!_0xe4fea5[_0x42b8('0x56')](_0x4493eb[_0x2e1fe1])){_0xe4fea5[_0x4493eb[_0x2e1fe1]]=null;}}_0xc00c7c['push'](_0xe4fea5);}return _0xc00c7c;}})[_0x42b8('0x21')](function(_0x1ffb09){if(!_['isEmpty'](_0x1ffb09)){var _0x7631cb=toCsv(_0x1ffb09);var _0x53f19f=Date[_0x42b8('0x6b')]();fs[_0x42b8('0x6c')](util[_0x42b8('0x67')](_0x42b8('0x6d'),_0xd10699[_0x42b8('0x54')]['id'],_0x53f19f),_0x7631cb);_0x1f62a2['setHeader'](_0x42b8('0x6e'),_0x42b8('0x6f')+util[_0x42b8('0x67')](_0x42b8('0x70'),_0xd10699['params']['id'],_0x53f19f));_0x1f62a2[_0x42b8('0x71')](_0x42b8('0x72'),'text/csv');return _0x1f62a2[_0x42b8('0x73')](util[_0x42b8('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xd10699[_0x42b8('0x54')]['id'],_0x53f19f));}else{return _0x1f62a2[_0x42b8('0x74')](0xcc);}})['catch'](handleError(_0x1f62a2,null));}; \ No newline at end of file +var _0xa5d7=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','Projects','UserProfileResource','then','sendStatus','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','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','clone','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','nolimit','pick','JscriptyAnswerReport','number','toString','indexOf','starttime','parse','startTime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','squel','crypto','desk.js'];(function(_0x45b7d3,_0x1fe383){var _0x1363c4=function(_0x36db95){while(--_0x36db95){_0x45b7d3['push'](_0x45b7d3['shift']());}};_0x1363c4(++_0x1fe383);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x17a9a2,_0x1faea1){_0x17a9a2=_0x17a9a2-0x0;var _0xe98375=_0xa5d7[_0x17a9a2];return _0xe98375;};'use strict';var emlformat=require(_0x7a5d('0x0'));var rimraf=require(_0x7a5d('0x1'));var zipdir=require(_0x7a5d('0x2'));var jsonpatch=require(_0x7a5d('0x3'));var rp=require('request-promise');var moment=require(_0x7a5d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7a5d('0x5'));var util=require('util');var path=require(_0x7a5d('0x6'));var sox=require('sox');var csv=require(_0x7a5d('0x7'));var ejs=require(_0x7a5d('0x8'));var fs=require('fs');var fs_extra=require(_0x7a5d('0x9'));var _=require('lodash');var squel=require(_0x7a5d('0xa'));var crypto=require(_0x7a5d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7a5d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7a5d('0xd'));var Papa=require(_0x7a5d('0xe'));var Redis=require(_0x7a5d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7a5d('0x10'));var as=require(_0x7a5d('0x11'));var hardwareService=require(_0x7a5d('0x12'));var logger=require(_0x7a5d('0x13'))(_0x7a5d('0x14'));var utils=require(_0x7a5d('0x15'));var config=require(_0x7a5d('0x16'));var licenseUtil=require(_0x7a5d('0x17'));var db=require(_0x7a5d('0x18'))['db'];function respondWithStatusCode(_0xc4d232,_0x3a3344){_0x3a3344=_0x3a3344||0xcc;return function(_0x40b7e4){if(_0x40b7e4){return _0xc4d232['sendStatus'](_0x3a3344);}return _0xc4d232['status'](_0x3a3344)[_0x7a5d('0x19')]();};}function respondWithResult(_0x5335f6,_0x1e6179){_0x1e6179=_0x1e6179||0xc8;return function(_0x15a440){if(_0x15a440){return _0x5335f6[_0x7a5d('0x1a')](_0x1e6179)[_0x7a5d('0x1b')](_0x15a440);}};}function respondWithFilteredResult(_0xd9d560,_0x342f63){return function(_0x50070a){if(_0x50070a){var _0x35c72e=typeof _0x342f63[_0x7a5d('0x1c')]===_0x7a5d('0x1d')&&typeof _0x342f63[_0x7a5d('0x1e')]===_0x7a5d('0x1d');var _0x4e1973=_0x50070a[_0x7a5d('0x1f')];var _0x3488e9=_0x35c72e?0x0:_0x342f63['offset'];var _0x4ea1b5=_0x35c72e?_0x50070a[_0x7a5d('0x1f')]:_0x342f63[_0x7a5d('0x1c')]+_0x342f63['limit'];var _0x1dea47;if(_0x4ea1b5>=_0x4e1973){_0x4ea1b5=_0x4e1973;_0x1dea47=0xc8;}else{_0x1dea47=0xce;}_0xd9d560['status'](_0x1dea47);return _0xd9d560[_0x7a5d('0x20')]('Content-Range',_0x3488e9+'-'+_0x4ea1b5+'/'+_0x4e1973)[_0x7a5d('0x1b')](_0x50070a);}return null;};}function patchUpdates(_0x334d3d){return function(_0x5bedc5){try{jsonpatch[_0x7a5d('0x21')](_0x5bedc5,_0x334d3d,!![]);}catch(_0x4faec5){return BPromise[_0x7a5d('0x22')](_0x4faec5);}return _0x5bedc5['save']();};}function saveUpdates(_0x56183a,_0x1a0282){return function(_0x77f35e){if(_0x77f35e){return _0x77f35e[_0x7a5d('0x23')](_0x56183a)['then'](function(_0x7b8ce1){return _0x7b8ce1;});}return null;};}function removeEntity(_0x45377a,_0x1bd069){return function(_0x4d1af5){if(_0x4d1af5){return _0x4d1af5[_0x7a5d('0x24')]()['then'](function(){var _0x476cd2=_0x4d1af5[_0x7a5d('0x25')]({'plain':!![]});var _0xcf8578=_0x7a5d('0x26');return db[_0x7a5d('0x27')][_0x7a5d('0x24')]({'where':{'type':_0xcf8578,'resourceId':_0x476cd2['id']}})['then'](function(){return _0x4d1af5;});})[_0x7a5d('0x28')](function(){_0x45377a[_0x7a5d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c33f5,_0x431fe9){return function(_0x2b1f0b){if(!_0x2b1f0b){_0x1c33f5[_0x7a5d('0x29')](0x194);}return _0x2b1f0b;};}function handleError(_0x5c89c8,_0x1055b8){_0x1055b8=_0x1055b8||0x1f4;return function(_0x2f922d){logger[_0x7a5d('0x2a')](_0x2f922d[_0x7a5d('0x2b')]);if(_0x2f922d[_0x7a5d('0x2c')]){delete _0x2f922d[_0x7a5d('0x2c')];}_0x5c89c8[_0x7a5d('0x1a')](_0x1055b8)[_0x7a5d('0x2d')](_0x2f922d);};}exports['index']=function(_0x1af116,_0x10394a){var _0x263f61={},_0x1be64c={},_0x46d2d7={'count':0x0,'rows':[]};var _0xbeb99c=_[_0x7a5d('0x2e')](db[_0x7a5d('0x2f')][_0x7a5d('0x30')],function(_0x32778d){return{'name':_0x32778d[_0x7a5d('0x31')],'type':_0x32778d[_0x7a5d('0x32')][_0x7a5d('0x33')]};});_0x1be64c[_0x7a5d('0x34')]=_['map'](_0xbeb99c,_0x7a5d('0x2c'));_0x1be64c['query']=_[_0x7a5d('0x35')](_0x1af116[_0x7a5d('0x36')]);_0x1be64c[_0x7a5d('0x37')]=_['intersection'](_0x1be64c[_0x7a5d('0x34')],_0x1be64c[_0x7a5d('0x36')]);_0x263f61[_0x7a5d('0x38')]=_[_0x7a5d('0x39')](_0x1be64c['model'],qs[_0x7a5d('0x3a')](_0x1af116[_0x7a5d('0x36')][_0x7a5d('0x3a')]));_0x263f61[_0x7a5d('0x38')]=_0x263f61[_0x7a5d('0x38')][_0x7a5d('0x3b')]?_0x263f61['attributes']:_0x1be64c[_0x7a5d('0x34')];if(!_0x1af116[_0x7a5d('0x36')][_0x7a5d('0x3c')]('nolimit')){_0x263f61[_0x7a5d('0x1e')]=qs[_0x7a5d('0x1e')](_0x1af116[_0x7a5d('0x36')][_0x7a5d('0x1e')]);_0x263f61[_0x7a5d('0x1c')]=qs[_0x7a5d('0x1c')](_0x1af116[_0x7a5d('0x36')][_0x7a5d('0x1c')]);}_0x263f61[_0x7a5d('0x3d')]=qs[_0x7a5d('0x3e')](_0x1af116[_0x7a5d('0x36')][_0x7a5d('0x3e')]);_0x263f61[_0x7a5d('0x3f')]=qs[_0x7a5d('0x37')](_['pick'](_0x1af116[_0x7a5d('0x36')],_0x1be64c[_0x7a5d('0x37')]),_0xbeb99c);if(_0x1af116[_0x7a5d('0x36')][_0x7a5d('0x40')]){_0x263f61[_0x7a5d('0x3f')]=_[_0x7a5d('0x41')](_0x263f61[_0x7a5d('0x3f')],{'$or':_[_0x7a5d('0x2e')](_0xbeb99c,function(_0x2427d9){if(_0x2427d9['type']!==_0x7a5d('0x42')){var _0x4fd958={};_0x4fd958[_0x2427d9[_0x7a5d('0x2c')]]={'$like':'%'+_0x1af116['query'][_0x7a5d('0x40')]+'%'};return _0x4fd958;}})});}_0x263f61=_[_0x7a5d('0x41')]({},_0x263f61,_0x1af116[_0x7a5d('0x43')]);var _0x562e7c={'where':_0x263f61[_0x7a5d('0x3f')]};return db['JscriptyProject']['count'](_0x562e7c)[_0x7a5d('0x28')](function(_0x824f98){_0x46d2d7['count']=_0x824f98;if(_0x1af116[_0x7a5d('0x36')][_0x7a5d('0x44')]){_0x263f61[_0x7a5d('0x45')]=[{'all':!![]}];}return db['JscriptyProject'][_0x7a5d('0x46')](_0x263f61);})[_0x7a5d('0x28')](function(_0x4cadfe){_0x46d2d7[_0x7a5d('0x47')]=_0x4cadfe;return _0x46d2d7;})[_0x7a5d('0x28')](respondWithFilteredResult(_0x10394a,_0x263f61))[_0x7a5d('0x48')](handleError(_0x10394a,null));};exports[_0x7a5d('0x49')]=function(_0x42f33e,_0x3bf875){var _0x33f5b9={'raw':![],'where':{'id':_0x42f33e[_0x7a5d('0x4a')]['id']}},_0x5d4ab2={};_0x5d4ab2[_0x7a5d('0x34')]=_[_0x7a5d('0x35')](db[_0x7a5d('0x2f')][_0x7a5d('0x30')]);_0x5d4ab2[_0x7a5d('0x36')]=_[_0x7a5d('0x35')](_0x42f33e[_0x7a5d('0x36')]);_0x5d4ab2[_0x7a5d('0x37')]=_['intersection'](_0x5d4ab2[_0x7a5d('0x34')],_0x5d4ab2[_0x7a5d('0x36')]);_0x33f5b9[_0x7a5d('0x38')]=_[_0x7a5d('0x39')](_0x5d4ab2[_0x7a5d('0x34')],qs[_0x7a5d('0x3a')](_0x42f33e['query'][_0x7a5d('0x3a')]));_0x33f5b9[_0x7a5d('0x38')]=_0x33f5b9[_0x7a5d('0x38')]['length']?_0x33f5b9[_0x7a5d('0x38')]:_0x5d4ab2[_0x7a5d('0x34')];if(_0x42f33e['query'][_0x7a5d('0x44')]){_0x33f5b9[_0x7a5d('0x45')]=[{'all':!![]}];}_0x33f5b9=_['merge']({},_0x33f5b9,_0x42f33e[_0x7a5d('0x43')]);return db['JscriptyProject'][_0x7a5d('0x4b')](_0x33f5b9)[_0x7a5d('0x28')](handleEntityNotFound(_0x3bf875,null))['then'](respondWithResult(_0x3bf875,null))[_0x7a5d('0x48')](handleError(_0x3bf875,null));};exports['create']=function(_0x20b082,_0x2ca82c){return db[_0x7a5d('0x2f')][_0x7a5d('0x4c')](_0x20b082[_0x7a5d('0x4d')],{})[_0x7a5d('0x28')](function(_0x35583b){var _0x2da745=_0x20b082['user'][_0x7a5d('0x25')]({'plain':!![]});if(!_0x2da745)throw new Error(_0x7a5d('0x4e'));if(_0x2da745[_0x7a5d('0x4f')]===_0x7a5d('0x50')){var _0x5b2d26=_0x35583b[_0x7a5d('0x25')]({'plain':!![]});var _0x6e6b41=_0x7a5d('0x26');return db[_0x7a5d('0x51')]['find']({'where':{'name':_0x6e6b41,'userProfileId':_0x2da745[_0x7a5d('0x52')]},'raw':!![]})['then'](function(_0x1bea47){if(_0x1bea47&&_0x1bea47[_0x7a5d('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x5b2d26[_0x7a5d('0x2c')],'resourceId':_0x5b2d26['id'],'type':_0x1bea47[_0x7a5d('0x2c')],'sectionId':_0x1bea47['id']},{})[_0x7a5d('0x28')](function(){return _0x35583b;});}else{return _0x35583b;}})[_0x7a5d('0x48')](function(_0x354939){logger['error'](_0x7a5d('0x54'),_0x354939);throw _0x354939;});}return _0x35583b;})[_0x7a5d('0x28')](respondWithResult(_0x2ca82c,0xc9))[_0x7a5d('0x48')](handleError(_0x2ca82c,null));};exports[_0x7a5d('0x55')]=function(_0x427f0a,_0x110b3b){var _0x13f598={'where':{'id':_0x427f0a[_0x7a5d('0x4a')]['id']}},_0x1c60aa={};_0x1c60aa[_0x7a5d('0x34')]=_['keys'](db['JscriptyProject'][_0x7a5d('0x30')]);_0x13f598[_0x7a5d('0x38')]=_['intersection'](_0x1c60aa[_0x7a5d('0x34')],qs[_0x7a5d('0x3a')](_0x427f0a[_0x7a5d('0x36')][_0x7a5d('0x3a')]));_0x13f598[_0x7a5d('0x38')]=_0x13f598[_0x7a5d('0x38')]['length']?_0x13f598[_0x7a5d('0x38')]:_0x1c60aa[_0x7a5d('0x34')];if(_0x427f0a['query'][_0x7a5d('0x44')]){_0x13f598[_0x7a5d('0x45')]=[{'all':!![]}];}_0x13f598=_['merge']({},_0x13f598,_0x427f0a[_0x7a5d('0x43')]);return db['JscriptyProject']['find'](_0x13f598)['then'](handleEntityNotFound(_0x110b3b,null))[_0x7a5d('0x28')](function(_0x2768cf){if(_0x2768cf){var _0x413f68=_0x2768cf['get']({'plain':!![]});_0x413f68=qs[_0x7a5d('0x56')](_0x413f68,['id',_0x7a5d('0x57'),_0x7a5d('0x58')]);_0x427f0a[_0x7a5d('0x4d')]=_['omit'](_0x427f0a['body'],['id',_0x7a5d('0x57'),_0x7a5d('0x58')]);return db[_0x7a5d('0x2f')][_0x7a5d('0x4c')](_[_0x7a5d('0x41')](_0x413f68,_0x427f0a[_0x7a5d('0x4d')]),{'include':_0x427f0a['query'][_0x7a5d('0x44')]?[{'all':!![]}]:undefined})[_0x7a5d('0x28')](function(_0x22753d){var _0x382ba4=_0x427f0a[_0x7a5d('0x50')]['get']({'plain':!![]});if(!_0x382ba4)throw new Error(_0x7a5d('0x4e'));if(_0x382ba4['role']===_0x7a5d('0x50')){var _0x50b91e=_0x22753d['get']({'plain':!![]});var _0x44f1ce=_0x7a5d('0x26');return db[_0x7a5d('0x51')][_0x7a5d('0x4b')]({'where':{'name':_0x44f1ce,'userProfileId':_0x382ba4['userProfileId']},'raw':!![]})[_0x7a5d('0x28')](function(_0x4ce422){if(_0x4ce422&&_0x4ce422['autoAssociation']===0x0){return db[_0x7a5d('0x27')][_0x7a5d('0x4c')]({'name':_0x50b91e['name'],'resourceId':_0x50b91e['id'],'type':_0x4ce422[_0x7a5d('0x2c')],'sectionId':_0x4ce422['id']},{})['then'](function(){return _0x22753d;});}else{return _0x22753d;}})[_0x7a5d('0x48')](function(_0x5224cf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5224cf);throw _0x5224cf;});}return _0x22753d;});}})[_0x7a5d('0x28')](respondWithResult(_0x110b3b,0xc9))['catch'](handleError(_0x110b3b,null));};exports[_0x7a5d('0x23')]=function(_0x70bad1,_0x2e085c){if(_0x70bad1['body']['id']){delete _0x70bad1[_0x7a5d('0x4d')]['id'];}return db[_0x7a5d('0x2f')][_0x7a5d('0x4b')]({'where':{'id':_0x70bad1[_0x7a5d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2e085c,null))[_0x7a5d('0x28')](saveUpdates(_0x70bad1[_0x7a5d('0x4d')],null))[_0x7a5d('0x28')](respondWithResult(_0x2e085c,null))[_0x7a5d('0x48')](handleError(_0x2e085c,null));};exports[_0x7a5d('0x24')]=function(_0x3eb77,_0x182aa5){return db[_0x7a5d('0x2f')][_0x7a5d('0x4b')]({'where':{'id':_0x3eb77[_0x7a5d('0x4a')]['id']}})[_0x7a5d('0x28')](handleEntityNotFound(_0x182aa5,null))[_0x7a5d('0x28')](removeEntity(_0x182aa5,null))[_0x7a5d('0x48')](handleError(_0x182aa5,null));};exports[_0x7a5d('0x59')]=function(_0x2ff2d2,_0x3b263c,_0x2d2355){var _0x21e1d1={'raw':!![],'where':{}};var _0x37c3fe={};var _0x2f4a98={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x7a5d('0x5a')]({'where':{'id':_0x2ff2d2[_0x7a5d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b263c,null))[_0x7a5d('0x28')](function(_0x15f39d){if(_0x15f39d){_0x37c3fe[_0x7a5d('0x34')]=_[_0x7a5d('0x35')](db[_0x7a5d('0x5b')][_0x7a5d('0x30')]);_0x37c3fe[_0x7a5d('0x36')]=_['keys'](_0x2ff2d2[_0x7a5d('0x36')]);_0x37c3fe[_0x7a5d('0x37')]=_[_0x7a5d('0x39')](_0x37c3fe[_0x7a5d('0x34')],_0x37c3fe[_0x7a5d('0x36')]);_0x21e1d1[_0x7a5d('0x38')]=_[_0x7a5d('0x39')](_0x37c3fe['model'],qs['fields'](_0x2ff2d2[_0x7a5d('0x36')][_0x7a5d('0x3a')]));_0x21e1d1[_0x7a5d('0x38')]=_0x21e1d1[_0x7a5d('0x38')]['length']?_0x21e1d1[_0x7a5d('0x38')]:_0x37c3fe['model'];if(!_0x2ff2d2['query'][_0x7a5d('0x3c')](_0x7a5d('0x5c'))){_0x21e1d1['limit']=qs[_0x7a5d('0x1e')](_0x2ff2d2['query'][_0x7a5d('0x1e')]);_0x21e1d1[_0x7a5d('0x1c')]=qs[_0x7a5d('0x1c')](_0x2ff2d2[_0x7a5d('0x36')][_0x7a5d('0x1c')]);}_0x21e1d1['order']=qs['sort'](_0x2ff2d2[_0x7a5d('0x36')]['sort']);_0x21e1d1[_0x7a5d('0x3f')]=qs[_0x7a5d('0x37')](_['pick'](_0x2ff2d2[_0x7a5d('0x36')],_0x37c3fe[_0x7a5d('0x37')]));_0x21e1d1[_0x7a5d('0x3f')]['ProjectId']=_0x15f39d['id'];if(_0x2ff2d2['query']['filter']){_0x21e1d1['where']=_[_0x7a5d('0x41')](_0x21e1d1[_0x7a5d('0x3f')],{'$or':_[_0x7a5d('0x2e')](_0x21e1d1['attributes'],function(_0x2e6bf3){var _0x16be41={};_0x16be41[_0x2e6bf3]={'$like':'%'+_0x2ff2d2[_0x7a5d('0x36')][_0x7a5d('0x40')]+'%'};return _0x16be41;})});}_0x21e1d1=_[_0x7a5d('0x41')]({},_0x21e1d1,_0x2ff2d2['options']);return db[_0x7a5d('0x5b')][_0x7a5d('0x1f')]({'where':_0x21e1d1[_0x7a5d('0x3f')]})[_0x7a5d('0x28')](function(_0xad0f62){_0x2f4a98[_0x7a5d('0x1f')]=_0xad0f62;if(_0x2ff2d2['query'][_0x7a5d('0x44')]){_0x21e1d1['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x7a5d('0x46')](_0x21e1d1);})[_0x7a5d('0x28')](function(_0x375c3e){_0x2f4a98['rows']=_0x375c3e;return _0x2f4a98;});}})[_0x7a5d('0x28')](respondWithFilteredResult(_0x3b263c,_0x21e1d1))[_0x7a5d('0x48')](handleError(_0x3b263c,null));};exports['getAnswers']=function(_0x204b72,_0x9e29c8,_0x50ee07){var _0x4e2ec9={'raw':!![],'where':{}};var _0x1a2205={};var _0x3a29e9={'count':0x0,'rows':[]};return db[_0x7a5d('0x2f')][_0x7a5d('0x5a')]({'where':{'id':_0x204b72['params']['id']}})['then'](handleEntityNotFound(_0x9e29c8,null))[_0x7a5d('0x28')](function(_0x5dea6d){if(_0x5dea6d){_0x1a2205[_0x7a5d('0x34')]=_['keys'](db['JscriptyAnswerReport'][_0x7a5d('0x30')]);_0x1a2205['query']=_[_0x7a5d('0x35')](_0x204b72['query']);_0x1a2205['filters']=_[_0x7a5d('0x39')](_0x1a2205[_0x7a5d('0x34')],_0x1a2205[_0x7a5d('0x36')]);_0x4e2ec9['attributes']=_['intersection'](_0x1a2205['model'],qs['fields'](_0x204b72[_0x7a5d('0x36')][_0x7a5d('0x3a')]));_0x4e2ec9[_0x7a5d('0x38')]=_0x4e2ec9[_0x7a5d('0x38')][_0x7a5d('0x3b')]?_0x4e2ec9['attributes']:_0x1a2205[_0x7a5d('0x34')];if(!_0x204b72['query'][_0x7a5d('0x3c')]('nolimit')){_0x4e2ec9[_0x7a5d('0x1e')]=qs[_0x7a5d('0x1e')](_0x204b72[_0x7a5d('0x36')]['limit']);_0x4e2ec9['offset']=qs['offset'](_0x204b72[_0x7a5d('0x36')]['offset']);}_0x4e2ec9[_0x7a5d('0x3d')]=qs[_0x7a5d('0x3e')](_0x204b72[_0x7a5d('0x36')][_0x7a5d('0x3e')]);_0x4e2ec9[_0x7a5d('0x3f')]=qs[_0x7a5d('0x37')](_[_0x7a5d('0x5d')](_0x204b72[_0x7a5d('0x36')],_0x1a2205[_0x7a5d('0x37')]));_0x4e2ec9[_0x7a5d('0x3f')]['ProjectId']=_0x5dea6d['id'];if(_0x204b72['query'][_0x7a5d('0x40')]){_0x4e2ec9['where']=_[_0x7a5d('0x41')](_0x4e2ec9['where'],{'$or':_[_0x7a5d('0x2e')](_0x4e2ec9['attributes'],function(_0x12a41d){var _0x382675={};_0x382675[_0x12a41d]={'$like':'%'+_0x204b72['query'][_0x7a5d('0x40')]+'%'};return _0x382675;})});}_0x4e2ec9=_[_0x7a5d('0x41')]({},_0x4e2ec9,_0x204b72[_0x7a5d('0x43')]);return db[_0x7a5d('0x5e')]['count']({'where':_0x4e2ec9[_0x7a5d('0x3f')]})['then'](function(_0x4ba43e){_0x3a29e9['count']=_0x4ba43e;if(_0x204b72[_0x7a5d('0x36')][_0x7a5d('0x44')]){_0x4e2ec9[_0x7a5d('0x45')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x7a5d('0x46')](_0x4e2ec9);})[_0x7a5d('0x28')](function(_0xd6a969){_0x3a29e9['rows']=_0xd6a969;return _0x3a29e9;});}})[_0x7a5d('0x28')](respondWithFilteredResult(_0x9e29c8,_0x4e2ec9))[_0x7a5d('0x48')](handleError(_0x9e29c8,null));};function char(_0x5dd31b){return _0x7a5d('0x5f')===typeof _0x5dd31b?String['fromCharCode']['apply'](null,arguments):_0x5dd31b;}function needsEncapsulation(_0x471834){return!!_0x471834&&(_0x471834['toString']()['indexOf'](char(0xd))>=0x0||_0x471834[_0x7a5d('0x60')]()['indexOf'](char(0xa))>=0x0||_0x471834[_0x7a5d('0x60')]()[_0x7a5d('0x61')](char(0x2c))>=0x0||_0x471834[_0x7a5d('0x60')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x1efcc2){var _0x1868be=char(0x22),_0x37a447='\x5c'+char(0x22),_0x25f242=_0x1efcc2[_0x7a5d('0x60')]()['replace'](new RegExp(_0x1868be,'g'),_0x37a447);return _0x1868be+_0x25f242+_0x1868be;}exports['getSummary']=function(_0xd91e5c,_0x59709c,_0x5337b9){var _0x1802fc,_0x5cc344;var _0x3a4c86={'where':{'ProjectId':_0xd91e5c['params']['id']}};if(_0xd91e5c['query']['startTime']){_0x3a4c86[_0x7a5d('0x3f')][_0x7a5d('0x62')]=JSON[_0x7a5d('0x63')](_0xd91e5c['query'][_0x7a5d('0x64')]);}return db[_0x7a5d('0x5b')][_0x7a5d('0x46')](_0x3a4c86)['then'](handleEntityNotFound(_0x59709c,null))[_0x7a5d('0x28')](function(_0x1c86f2){if(_0x1c86f2){_0x1802fc=_0x1c86f2;return db[_0x7a5d('0x65')][_0x7a5d('0x46')]({'where':{'SessionId':{'$in':_['map'](_0x1802fc,'id')},'ProjectId':_0xd91e5c[_0x7a5d('0x4a')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x59709c,null))[_0x7a5d('0x28')](function(_0x1295aa){if(_0x1295aa){_0x5cc344=_0x1295aa;var _0x4e7362={};for(var _0x56cd0b=0x0,_0x359dae=_0x5cc344[_0x7a5d('0x3b')];_0x56cd0b<_0x359dae;_0x56cd0b++){if(!_0x4e7362[_0x7a5d('0x3c')](_0x5cc344[_0x56cd0b][_0x7a5d('0x66')])){_0x4e7362[_0x5cc344[_0x56cd0b]['questionId']]=needsEncapsulation(_0x5cc344[_0x56cd0b][_0x7a5d('0x67')])?encapsulate(_0x5cc344[_0x56cd0b][_0x7a5d('0x67')]):_0x5cc344[_0x56cd0b][_0x7a5d('0x67')];}}var _0x1b9e6e=[],_0x5cfc1e={};for(var _0x24db7a=0x0,_0x26331a=_0x1802fc[_0x7a5d('0x3b')];_0x24db7a<_0x26331a;_0x24db7a++){_0x5cfc1e={'ProjectId':_0xd91e5c[_0x7a5d('0x4a')]['id'],'SessionId':_0x1802fc[_0x24db7a]['id'],'StartTime':moment(_0x1802fc[_0x24db7a][_0x7a5d('0x62')])[_0x7a5d('0x68')](_0x7a5d('0x69'))};for(var _0x5c4c0e=0x0,_0x308b84=_0x5cc344[_0x7a5d('0x3b')];_0x5c4c0e<_0x308b84;_0x5c4c0e++){if(_0x5cc344[_0x5c4c0e]['SessionId']==_0x1802fc[_0x24db7a]['id']&&_0x4e7362[_0x7a5d('0x3c')](_0x5cc344[_0x5c4c0e][_0x7a5d('0x66')])){_0x5cfc1e[_0x4e7362[_0x5cc344[_0x5c4c0e][_0x7a5d('0x66')]]]=_0x5cc344[_0x5c4c0e][_0x7a5d('0x6a')];}}for(var _0x22be75 in _0x4e7362){if(!_0x5cfc1e['hasOwnProperty'](_0x4e7362[_0x22be75])){_0x5cfc1e[_0x4e7362[_0x22be75]]=null;}}_0x1b9e6e[_0x7a5d('0x6b')](_0x5cfc1e);}return _0x1b9e6e;}})[_0x7a5d('0x28')](function(_0x229bc0){if(!_['isEmpty'](_0x229bc0)){var _0x4c9e79=toCsv(_0x229bc0);var _0x61a673=Date['now']();fs[_0x7a5d('0x6c')](util[_0x7a5d('0x68')](_0x7a5d('0x6d'),_0xd91e5c['params']['id'],_0x61a673),_0x4c9e79);_0x59709c[_0x7a5d('0x6e')](_0x7a5d('0x6f'),_0x7a5d('0x70')+util[_0x7a5d('0x68')](_0x7a5d('0x71'),_0xd91e5c[_0x7a5d('0x4a')]['id'],_0x61a673));_0x59709c[_0x7a5d('0x6e')](_0x7a5d('0x72'),_0x7a5d('0x73'));return _0x59709c['download'](util[_0x7a5d('0x68')](_0x7a5d('0x6d'),_0xd91e5c[_0x7a5d('0x4a')]['id'],_0x61a673));}else{return _0x59709c[_0x7a5d('0x29')](0xcc);}})['catch'](handleError(_0x59709c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index cebe3fc..bba9f30 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 _0xb7a8=['request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','util','../../config/logger','moment','bluebird'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb7a8,0xec));var _0x8b7a=function(_0x125f89,_0x1bb4d7){_0x125f89=_0x125f89-0x0;var _0x3a2aa7=_0xb7a8[_0x125f89];return _0x3a2aa7;};'use strict';var _=require('lodash');var util=require(_0x8b7a('0x0'));var logger=require(_0x8b7a('0x1'))('api');var moment=require(_0x8b7a('0x2'));var BPromise=require(_0x8b7a('0x3'));var rp=require(_0x8b7a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b7a('0x5'));var config=require(_0x8b7a('0x6'));var attributes=require(_0x8b7a('0x7'));module[_0x8b7a('0x8')]=function(_0x1d61f3,_0x42e4c1){return _0x1d61f3[_0x8b7a('0x9')](_0x8b7a('0xa'),attributes,{'tableName':_0x8b7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0dee=['../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x45c1e7,_0x199f08){var _0x715b08=function(_0x38c6ec){while(--_0x38c6ec){_0x45c1e7['push'](_0x45c1e7['shift']());}};_0x715b08(++_0x199f08);}(_0x0dee,0xf7));var _0xe0de=function(_0xc7c26e,_0x373903){_0xc7c26e=_0xc7c26e-0x0;var _0x56f390=_0x0dee[_0xc7c26e];return _0x56f390;};'use strict';var _=require(_0xe0de('0x0'));var util=require(_0xe0de('0x1'));var logger=require('../../config/logger')(_0xe0de('0x2'));var moment=require('moment');var BPromise=require(_0xe0de('0x3'));var rp=require(_0xe0de('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0de('0x5'));var config=require(_0xe0de('0x6'));var attributes=require(_0xe0de('0x7'));module['exports']=function(_0x2fc94c,_0x4957d7){return _0x2fc94c[_0xe0de('0x8')](_0xe0de('0x9'),attributes,{'tableName':_0xe0de('0xa'),'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 cc69e0d..031b5aa 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x5500c7,_0xc64059){var _0x51e918=function(_0x58b444){while(--_0x58b444){_0x5500c7['push'](_0x5500c7['shift']());}};_0x51e918(++_0xc64059);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0xcb91[_0x59e821];return _0x5333f6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4f2ee2,_0x1828cd){_0x4f2ee2=_0x4f2ee2-0x0;var _0x3b87d9=_0xbdb7[_0x4f2ee2];return _0x3b87d9;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 34c1829..cd4e868 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 _0x21cf=['delete','/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x21cf,0x10b));var _0xf21c=function(_0x23e72b,_0x8d9c3){_0x23e72b=_0x23e72b-0x0;var _0x3aa720=_0x21cf[_0x23e72b];return _0x3aa720;};'use strict';var multer=require(_0xf21c('0x0'));var util=require(_0xf21c('0x1'));var path=require(_0xf21c('0x2'));var timeout=require(_0xf21c('0x3'));var express=require('express');var router=express[_0xf21c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf21c('0x5'));var interaction=require(_0xf21c('0x6'));var config=require(_0xf21c('0x7'));var controller=require(_0xf21c('0x8'));router['get']('/',auth[_0xf21c('0x9')](),controller[_0xf21c('0xa')]);router[_0xf21c('0xb')](_0xf21c('0xc'),auth['isAuthenticated'](),controller[_0xf21c('0xd')]);router[_0xf21c('0xb')]('/:id',auth[_0xf21c('0x9')](),controller[_0xf21c('0xe')]);router[_0xf21c('0xf')]('/',auth[_0xf21c('0x9')](),controller[_0xf21c('0x10')]);router[_0xf21c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf21c('0x12')]);router[_0xf21c('0x13')](_0xf21c('0x14'),auth[_0xf21c('0x9')](),controller['destroy']);module[_0xf21c('0x15')]=router; \ No newline at end of file +var _0xea5c=['index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xea5c,0xdc));var _0xcea5=function(_0x56c786,_0x4a6b3d){_0x56c786=_0x56c786-0x0;var _0x498832=_0xea5c[_0x56c786];return _0x498832;};'use strict';var multer=require(_0xcea5('0x0'));var util=require(_0xcea5('0x1'));var path=require(_0xcea5('0x2'));var timeout=require(_0xcea5('0x3'));var express=require('express');var router=express[_0xcea5('0x4')]();var fs_extra=require(_0xcea5('0x5'));var auth=require(_0xcea5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcea5('0x7'));var controller=require(_0xcea5('0x8'));router[_0xcea5('0x9')]('/',auth['isAuthenticated'](),controller[_0xcea5('0xa')]);router['get'](_0xcea5('0xb'),auth[_0xcea5('0xc')](),controller[_0xcea5('0xd')]);router[_0xcea5('0x9')](_0xcea5('0xe'),auth[_0xcea5('0xc')](),controller[_0xcea5('0xf')]);router[_0xcea5('0x10')]('/',auth[_0xcea5('0xc')](),controller[_0xcea5('0x11')]);router[_0xcea5('0x12')](_0xcea5('0xe'),auth[_0xcea5('0xc')](),controller[_0xcea5('0x13')]);router[_0xcea5('0x14')](_0xcea5('0xe'),auth[_0xcea5('0xc')](),controller[_0xcea5('0x15')]);module[_0xcea5('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index a0e08ce..858c7d7 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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0xa38f7,_0x1fabf7){_0xa38f7=_0xa38f7-0x0;var _0x2c53da=_0x7a54[_0xa38f7];return _0x2c53da;};'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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7a54,0x106));var _0x47a5=function(_0xff790c,_0x3c4f16){_0xff790c=_0xff790c-0x0;var _0xcf0da8=_0x7a54[_0xff790c];return _0xcf0da8;};'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 2e9b0ed..6f59697 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 _0x4fc0=['undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','status','sendStatus','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','update','params','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','json','limit'];(function(_0x4617a6,_0x587d07){var _0xc16f5d=function(_0x21a643){while(--_0x21a643){_0x4617a6['push'](_0x4617a6['shift']());}};_0xc16f5d(++_0x587d07);}(_0x4fc0,0x120));var _0x04fc=function(_0x4005f8,_0x1e5fb3){_0x4005f8=_0x4005f8-0x0;var _0x37190e=_0x4fc0[_0x4005f8];return _0x37190e;};'use strict';var emlformat=require(_0x04fc('0x0'));var rimraf=require(_0x04fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x04fc('0x2'));var moment=require(_0x04fc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x04fc('0x4'));var util=require(_0x04fc('0x5'));var path=require(_0x04fc('0x6'));var sox=require(_0x04fc('0x7'));var csv=require(_0x04fc('0x8'));var ejs=require(_0x04fc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x04fc('0xa'));var squel=require(_0x04fc('0xb'));var crypto=require(_0x04fc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x04fc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x04fc('0xe'));var Papa=require(_0x04fc('0xf'));var Redis=require(_0x04fc('0x10'));var authService=require(_0x04fc('0x11'));var qs=require(_0x04fc('0x12'));var as=require(_0x04fc('0x13'));var hardwareService=require(_0x04fc('0x14'));var logger=require(_0x04fc('0x15'))(_0x04fc('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x04fc('0x17'));var db=require(_0x04fc('0x18'))['db'];function respondWithStatusCode(_0x9dd4be,_0x1db9ba){_0x1db9ba=_0x1db9ba||0xcc;return function(_0x114e67){if(_0x114e67){return _0x9dd4be['sendStatus'](_0x1db9ba);}return _0x9dd4be['status'](_0x1db9ba)[_0x04fc('0x19')]();};}function respondWithResult(_0x16e6ee,_0x12b0f8){_0x12b0f8=_0x12b0f8||0xc8;return function(_0x2bf0fd){if(_0x2bf0fd){return _0x16e6ee['status'](_0x12b0f8)[_0x04fc('0x1a')](_0x2bf0fd);}};}function respondWithFilteredResult(_0xcb15f0,_0x3c2713){return function(_0x106e4c){if(_0x106e4c){var _0xe40c3d=typeof _0x3c2713['offset']==='undefined'&&typeof _0x3c2713[_0x04fc('0x1b')]===_0x04fc('0x1c');var _0x255b94=_0x106e4c[_0x04fc('0x1d')];var _0x55576f=_0xe40c3d?0x0:_0x3c2713['offset'];var _0x1a7aa8=_0xe40c3d?_0x106e4c[_0x04fc('0x1d')]:_0x3c2713[_0x04fc('0x1e')]+_0x3c2713[_0x04fc('0x1b')];var _0x2c7c6e;if(_0x1a7aa8>=_0x255b94){_0x1a7aa8=_0x255b94;_0x2c7c6e=0xc8;}else{_0x2c7c6e=0xce;}_0xcb15f0['status'](_0x2c7c6e);return _0xcb15f0[_0x04fc('0x1f')](_0x04fc('0x20'),_0x55576f+'-'+_0x1a7aa8+'/'+_0x255b94)[_0x04fc('0x1a')](_0x106e4c);}return null;};}function patchUpdates(_0x116702){return function(_0x3182e3){try{jsonpatch[_0x04fc('0x21')](_0x3182e3,_0x116702,!![]);}catch(_0x463a0b){return BPromise[_0x04fc('0x22')](_0x463a0b);}return _0x3182e3[_0x04fc('0x23')]();};}function saveUpdates(_0x371697,_0x295749){return function(_0x1d1275){if(_0x1d1275){return _0x1d1275['update'](_0x371697)[_0x04fc('0x24')](function(_0x579150){return _0x579150;});}return null;};}function removeEntity(_0x85a4df,_0x1946ae){return function(_0x80a647){if(_0x80a647){return _0x80a647[_0x04fc('0x25')]()[_0x04fc('0x24')](function(){_0x85a4df[_0x04fc('0x26')](0xcc)[_0x04fc('0x19')]();});}};}function handleEntityNotFound(_0x6cbed2,_0x1a0473){return function(_0x4e2dfb){if(!_0x4e2dfb){_0x6cbed2[_0x04fc('0x27')](0x194);}return _0x4e2dfb;};}function handleError(_0x3929ed,_0x17b8ed){_0x17b8ed=_0x17b8ed||0x1f4;return function(_0x592c34){logger['error'](_0x592c34[_0x04fc('0x28')]);if(_0x592c34[_0x04fc('0x29')]){delete _0x592c34['name'];}_0x3929ed[_0x04fc('0x26')](_0x17b8ed)[_0x04fc('0x2a')](_0x592c34);};}exports[_0x04fc('0x2b')]=function(_0x3ef80b,_0x5a58cb){var _0x45cf34={},_0x46ff8f={},_0x44ceec={'count':0x0,'rows':[]};var _0x28f9fa=_[_0x04fc('0x2c')](db[_0x04fc('0x2d')][_0x04fc('0x2e')],function(_0x44920f){return{'name':_0x44920f[_0x04fc('0x2f')],'type':_0x44920f[_0x04fc('0x30')][_0x04fc('0x31')]};});_0x46ff8f[_0x04fc('0x32')]=_['map'](_0x28f9fa,_0x04fc('0x29'));_0x46ff8f[_0x04fc('0x33')]=_[_0x04fc('0x34')](_0x3ef80b[_0x04fc('0x33')]);_0x46ff8f[_0x04fc('0x35')]=_[_0x04fc('0x36')](_0x46ff8f[_0x04fc('0x32')],_0x46ff8f[_0x04fc('0x33')]);_0x45cf34[_0x04fc('0x37')]=_[_0x04fc('0x36')](_0x46ff8f['model'],qs[_0x04fc('0x38')](_0x3ef80b[_0x04fc('0x33')][_0x04fc('0x38')]));_0x45cf34[_0x04fc('0x37')]=_0x45cf34[_0x04fc('0x37')][_0x04fc('0x39')]?_0x45cf34[_0x04fc('0x37')]:_0x46ff8f[_0x04fc('0x32')];if(!_0x3ef80b['query'][_0x04fc('0x3a')]('nolimit')){_0x45cf34[_0x04fc('0x1b')]=qs[_0x04fc('0x1b')](_0x3ef80b[_0x04fc('0x33')][_0x04fc('0x1b')]);_0x45cf34['offset']=qs[_0x04fc('0x1e')](_0x3ef80b[_0x04fc('0x33')]['offset']);}_0x45cf34[_0x04fc('0x3b')]=qs[_0x04fc('0x3c')](_0x3ef80b['query'][_0x04fc('0x3c')]);_0x45cf34['where']=qs[_0x04fc('0x35')](_[_0x04fc('0x3d')](_0x3ef80b[_0x04fc('0x33')],_0x46ff8f['filters']),_0x28f9fa);if(_0x3ef80b[_0x04fc('0x33')][_0x04fc('0x3e')]){_0x45cf34[_0x04fc('0x3f')]=_[_0x04fc('0x40')](_0x45cf34[_0x04fc('0x3f')],{'$or':_[_0x04fc('0x2c')](_0x28f9fa,function(_0x53e76f){if(_0x53e76f['type']!==_0x04fc('0x41')){var _0xb766c3={};_0xb766c3[_0x53e76f[_0x04fc('0x29')]]={'$like':'%'+_0x3ef80b['query'][_0x04fc('0x3e')]+'%'};return _0xb766c3;}})});}_0x45cf34=_[_0x04fc('0x40')]({},_0x45cf34,_0x3ef80b[_0x04fc('0x42')]);var _0x237abc={'where':_0x45cf34['where']};return db[_0x04fc('0x2d')][_0x04fc('0x1d')](_0x237abc)['then'](function(_0x4a0a6c){_0x44ceec[_0x04fc('0x1d')]=_0x4a0a6c;if(_0x3ef80b[_0x04fc('0x33')][_0x04fc('0x43')]){_0x45cf34['include']=[{'all':!![]}];}return db[_0x04fc('0x2d')][_0x04fc('0x44')](_0x45cf34);})[_0x04fc('0x24')](function(_0x44e3dc){_0x44ceec[_0x04fc('0x45')]=_0x44e3dc;return _0x44ceec;})['then'](respondWithFilteredResult(_0x5a58cb,_0x45cf34))[_0x04fc('0x46')](handleError(_0x5a58cb,null));};exports[_0x04fc('0x47')]=function(_0xadca82,_0x5a6ca0){var _0x45e4df={'raw':!![],'where':{'id':_0xadca82['params']['id']}},_0x908b23={};_0x908b23[_0x04fc('0x32')]=_[_0x04fc('0x34')](db[_0x04fc('0x2d')][_0x04fc('0x2e')]);_0x908b23[_0x04fc('0x33')]=_[_0x04fc('0x34')](_0xadca82[_0x04fc('0x33')]);_0x908b23[_0x04fc('0x35')]=_[_0x04fc('0x36')](_0x908b23['model'],_0x908b23['query']);_0x45e4df[_0x04fc('0x37')]=_[_0x04fc('0x36')](_0x908b23['model'],qs[_0x04fc('0x38')](_0xadca82[_0x04fc('0x33')][_0x04fc('0x38')]));_0x45e4df[_0x04fc('0x37')]=_0x45e4df[_0x04fc('0x37')][_0x04fc('0x39')]?_0x45e4df[_0x04fc('0x37')]:_0x908b23[_0x04fc('0x32')];if(_0xadca82['query'][_0x04fc('0x43')]){_0x45e4df[_0x04fc('0x48')]=[{'all':!![]}];}_0x45e4df=_[_0x04fc('0x40')]({},_0x45e4df,_0xadca82['options']);return db[_0x04fc('0x2d')][_0x04fc('0x49')](_0x45e4df)[_0x04fc('0x24')](handleEntityNotFound(_0x5a6ca0,null))[_0x04fc('0x24')](respondWithResult(_0x5a6ca0,null))[_0x04fc('0x46')](handleError(_0x5a6ca0,null));};exports[_0x04fc('0x4a')]=function(_0x245343,_0x5454b2){return db[_0x04fc('0x2d')][_0x04fc('0x4a')](_0x245343[_0x04fc('0x4b')],{})[_0x04fc('0x24')](respondWithResult(_0x5454b2,0xc9))[_0x04fc('0x46')](handleError(_0x5454b2,null));};exports[_0x04fc('0x4c')]=function(_0x2b35e8,_0x2b2a3e){if(_0x2b35e8[_0x04fc('0x4b')]['id']){delete _0x2b35e8[_0x04fc('0x4b')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x2b35e8['params']['id']}})['then'](handleEntityNotFound(_0x2b2a3e,null))[_0x04fc('0x24')](saveUpdates(_0x2b35e8[_0x04fc('0x4b')],null))[_0x04fc('0x24')](respondWithResult(_0x2b2a3e,null))[_0x04fc('0x46')](handleError(_0x2b2a3e,null));};exports[_0x04fc('0x25')]=function(_0x404422,_0x57155a){return db[_0x04fc('0x2d')][_0x04fc('0x49')]({'where':{'id':_0x404422[_0x04fc('0x4d')]['id']}})[_0x04fc('0x24')](handleEntityNotFound(_0x57155a,null))[_0x04fc('0x24')](removeEntity(_0x57155a,null))[_0x04fc('0x46')](handleError(_0x57155a,null));};exports[_0x04fc('0x4e')]=function(_0x584fbc,_0xa7e3b){return db['JscriptyQuestionReport']['describe']()[_0x04fc('0x24')](respondWithResult(_0xa7e3b,null))[_0x04fc('0x46')](handleError(_0xa7e3b,null));}; \ No newline at end of file +var _0x7846=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','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','status','json','offset'];(function(_0x4fc66c,_0x4d1b24){var _0x1343b4=function(_0x42c2e5){while(--_0x42c2e5){_0x4fc66c['push'](_0x4fc66c['shift']());}};_0x1343b4(++_0x4d1b24);}(_0x7846,0x16b));var _0x6784=function(_0x2fbd0e,_0x3460a9){_0x2fbd0e=_0x2fbd0e-0x0;var _0x481c9f=_0x7846[_0x2fbd0e];return _0x481c9f;};'use strict';var emlformat=require(_0x6784('0x0'));var rimraf=require(_0x6784('0x1'));var zipdir=require(_0x6784('0x2'));var jsonpatch=require(_0x6784('0x3'));var rp=require(_0x6784('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6784('0x5'));var path=require(_0x6784('0x6'));var sox=require(_0x6784('0x7'));var csv=require(_0x6784('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6784('0x9'));var _=require('lodash');var squel=require(_0x6784('0xa'));var crypto=require(_0x6784('0xb'));var jsforce=require(_0x6784('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6784('0xd'));var Papa=require('papaparse');var Redis=require(_0x6784('0xe'));var authService=require(_0x6784('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6784('0x10'));var hardwareService=require(_0x6784('0x11'));var logger=require(_0x6784('0x12'))(_0x6784('0x13'));var utils=require(_0x6784('0x14'));var config=require(_0x6784('0x15'));var licenseUtil=require(_0x6784('0x16'));var db=require(_0x6784('0x17'))['db'];function respondWithStatusCode(_0x31ae69,_0x1bc92b){_0x1bc92b=_0x1bc92b||0xcc;return function(_0x404857){if(_0x404857){return _0x31ae69['sendStatus'](_0x1bc92b);}return _0x31ae69[_0x6784('0x18')](_0x1bc92b)['end']();};}function respondWithResult(_0x24bb19,_0x1c1bda){_0x1c1bda=_0x1c1bda||0xc8;return function(_0x5cc0fe){if(_0x5cc0fe){return _0x24bb19[_0x6784('0x18')](_0x1c1bda)[_0x6784('0x19')](_0x5cc0fe);}};}function respondWithFilteredResult(_0x810206,_0x444055){return function(_0x1c538d){if(_0x1c538d){var _0x3a3bf4=typeof _0x444055[_0x6784('0x1a')]===_0x6784('0x1b')&&typeof _0x444055[_0x6784('0x1c')]==='undefined';var _0x52b760=_0x1c538d[_0x6784('0x1d')];var _0x3c921a=_0x3a3bf4?0x0:_0x444055['offset'];var _0x2e8be4=_0x3a3bf4?_0x1c538d['count']:_0x444055[_0x6784('0x1a')]+_0x444055['limit'];var _0x4cd94a;if(_0x2e8be4>=_0x52b760){_0x2e8be4=_0x52b760;_0x4cd94a=0xc8;}else{_0x4cd94a=0xce;}_0x810206['status'](_0x4cd94a);return _0x810206[_0x6784('0x1e')](_0x6784('0x1f'),_0x3c921a+'-'+_0x2e8be4+'/'+_0x52b760)[_0x6784('0x19')](_0x1c538d);}return null;};}function patchUpdates(_0x4d768e){return function(_0x11c8a5){try{jsonpatch[_0x6784('0x20')](_0x11c8a5,_0x4d768e,!![]);}catch(_0x52f5ef){return BPromise[_0x6784('0x21')](_0x52f5ef);}return _0x11c8a5[_0x6784('0x22')]();};}function saveUpdates(_0x3de5a9,_0xa42185){return function(_0x4cd779){if(_0x4cd779){return _0x4cd779[_0x6784('0x23')](_0x3de5a9)[_0x6784('0x24')](function(_0x599c7b){return _0x599c7b;});}return null;};}function removeEntity(_0x165751,_0x14007d){return function(_0x3cadd8){if(_0x3cadd8){return _0x3cadd8[_0x6784('0x25')]()[_0x6784('0x24')](function(){_0x165751[_0x6784('0x18')](0xcc)[_0x6784('0x26')]();});}};}function handleEntityNotFound(_0x2cfe19,_0x27d00f){return function(_0x147f36){if(!_0x147f36){_0x2cfe19[_0x6784('0x27')](0x194);}return _0x147f36;};}function handleError(_0x202df3,_0x1205b2){_0x1205b2=_0x1205b2||0x1f4;return function(_0x29ae7e){logger['error'](_0x29ae7e[_0x6784('0x28')]);if(_0x29ae7e[_0x6784('0x29')]){delete _0x29ae7e[_0x6784('0x29')];}_0x202df3[_0x6784('0x18')](_0x1205b2)[_0x6784('0x2a')](_0x29ae7e);};}exports[_0x6784('0x2b')]=function(_0x2c946e,_0x48dfc6){var _0x463da5={},_0x47e320={},_0x5e23b1={'count':0x0,'rows':[]};var _0x4b55ab=_['map'](db[_0x6784('0x2c')][_0x6784('0x2d')],function(_0x324fa6){return{'name':_0x324fa6[_0x6784('0x2e')],'type':_0x324fa6[_0x6784('0x2f')][_0x6784('0x30')]};});_0x47e320[_0x6784('0x31')]=_[_0x6784('0x32')](_0x4b55ab,_0x6784('0x29'));_0x47e320[_0x6784('0x33')]=_[_0x6784('0x34')](_0x2c946e[_0x6784('0x33')]);_0x47e320[_0x6784('0x35')]=_[_0x6784('0x36')](_0x47e320[_0x6784('0x31')],_0x47e320[_0x6784('0x33')]);_0x463da5['attributes']=_[_0x6784('0x36')](_0x47e320[_0x6784('0x31')],qs[_0x6784('0x37')](_0x2c946e[_0x6784('0x33')][_0x6784('0x37')]));_0x463da5[_0x6784('0x38')]=_0x463da5[_0x6784('0x38')][_0x6784('0x39')]?_0x463da5[_0x6784('0x38')]:_0x47e320[_0x6784('0x31')];if(!_0x2c946e['query'][_0x6784('0x3a')](_0x6784('0x3b'))){_0x463da5[_0x6784('0x1c')]=qs[_0x6784('0x1c')](_0x2c946e[_0x6784('0x33')]['limit']);_0x463da5['offset']=qs[_0x6784('0x1a')](_0x2c946e[_0x6784('0x33')][_0x6784('0x1a')]);}_0x463da5[_0x6784('0x3c')]=qs[_0x6784('0x3d')](_0x2c946e[_0x6784('0x33')][_0x6784('0x3d')]);_0x463da5[_0x6784('0x3e')]=qs[_0x6784('0x35')](_[_0x6784('0x3f')](_0x2c946e[_0x6784('0x33')],_0x47e320[_0x6784('0x35')]),_0x4b55ab);if(_0x2c946e[_0x6784('0x33')][_0x6784('0x40')]){_0x463da5['where']=_[_0x6784('0x41')](_0x463da5[_0x6784('0x3e')],{'$or':_[_0x6784('0x32')](_0x4b55ab,function(_0x229113){if(_0x229113['type']!==_0x6784('0x42')){var _0x4c96de={};_0x4c96de[_0x229113[_0x6784('0x29')]]={'$like':'%'+_0x2c946e[_0x6784('0x33')][_0x6784('0x40')]+'%'};return _0x4c96de;}})});}_0x463da5=_[_0x6784('0x41')]({},_0x463da5,_0x2c946e[_0x6784('0x43')]);var _0x250be2={'where':_0x463da5[_0x6784('0x3e')]};return db['JscriptyQuestionReport'][_0x6784('0x1d')](_0x250be2)['then'](function(_0x37d88c){_0x5e23b1[_0x6784('0x1d')]=_0x37d88c;if(_0x2c946e[_0x6784('0x33')]['includeAll']){_0x463da5[_0x6784('0x44')]=[{'all':!![]}];}return db[_0x6784('0x2c')]['findAll'](_0x463da5);})['then'](function(_0x23545a){_0x5e23b1[_0x6784('0x45')]=_0x23545a;return _0x5e23b1;})[_0x6784('0x24')](respondWithFilteredResult(_0x48dfc6,_0x463da5))['catch'](handleError(_0x48dfc6,null));};exports[_0x6784('0x46')]=function(_0x1542e0,_0x374013){var _0x23c1ca={'raw':!![],'where':{'id':_0x1542e0[_0x6784('0x47')]['id']}},_0x4b97b6={};_0x4b97b6['model']=_[_0x6784('0x34')](db[_0x6784('0x2c')][_0x6784('0x2d')]);_0x4b97b6['query']=_[_0x6784('0x34')](_0x1542e0[_0x6784('0x33')]);_0x4b97b6[_0x6784('0x35')]=_[_0x6784('0x36')](_0x4b97b6[_0x6784('0x31')],_0x4b97b6[_0x6784('0x33')]);_0x23c1ca[_0x6784('0x38')]=_['intersection'](_0x4b97b6[_0x6784('0x31')],qs[_0x6784('0x37')](_0x1542e0['query']['fields']));_0x23c1ca[_0x6784('0x38')]=_0x23c1ca[_0x6784('0x38')]['length']?_0x23c1ca[_0x6784('0x38')]:_0x4b97b6[_0x6784('0x31')];if(_0x1542e0[_0x6784('0x33')][_0x6784('0x48')]){_0x23c1ca[_0x6784('0x44')]=[{'all':!![]}];}_0x23c1ca=_[_0x6784('0x41')]({},_0x23c1ca,_0x1542e0[_0x6784('0x43')]);return db[_0x6784('0x2c')][_0x6784('0x49')](_0x23c1ca)[_0x6784('0x24')](handleEntityNotFound(_0x374013,null))[_0x6784('0x24')](respondWithResult(_0x374013,null))[_0x6784('0x4a')](handleError(_0x374013,null));};exports[_0x6784('0x4b')]=function(_0x3ce578,_0x1ef07b){return db[_0x6784('0x2c')][_0x6784('0x4b')](_0x3ce578[_0x6784('0x4c')],{})['then'](respondWithResult(_0x1ef07b,0xc9))[_0x6784('0x4a')](handleError(_0x1ef07b,null));};exports[_0x6784('0x23')]=function(_0x33b00a,_0x21e6e2){if(_0x33b00a[_0x6784('0x4c')]['id']){delete _0x33b00a[_0x6784('0x4c')]['id'];}return db['JscriptyQuestionReport'][_0x6784('0x49')]({'where':{'id':_0x33b00a[_0x6784('0x47')]['id']}})['then'](handleEntityNotFound(_0x21e6e2,null))['then'](saveUpdates(_0x33b00a[_0x6784('0x4c')],null))[_0x6784('0x24')](respondWithResult(_0x21e6e2,null))[_0x6784('0x4a')](handleError(_0x21e6e2,null));};exports['destroy']=function(_0x43a6a2,_0x4cf702){return db['JscriptyQuestionReport'][_0x6784('0x49')]({'where':{'id':_0x43a6a2[_0x6784('0x47')]['id']}})[_0x6784('0x24')](handleEntityNotFound(_0x4cf702,null))['then'](removeEntity(_0x4cf702,null))[_0x6784('0x4a')](handleError(_0x4cf702,null));};exports['describe']=function(_0x23c870,_0x2425a5){return db[_0x6784('0x2c')][_0x6784('0x4d')]()[_0x6784('0x24')](respondWithResult(_0x2425a5,null))[_0x6784('0x4a')](handleError(_0x2425a5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 83a6376..eeec218 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 _0x59c4=['path','rimraf','JscriptyQuestionReport','report_jscripty_questions','../../config/logger','request-promise'];(function(_0x43a054,_0x22109c){var _0x39b75f=function(_0x36fa3b){while(--_0x36fa3b){_0x43a054['push'](_0x43a054['shift']());}};_0x39b75f(++_0x22109c);}(_0x59c4,0x1a8));var _0x459c=function(_0x345de8,_0x45312c){_0x345de8=_0x345de8-0x0;var _0x27703f=_0x59c4[_0x345de8];return _0x27703f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x459c('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x459c('0x1'));var fs=require('fs');var path=require(_0x459c('0x2'));var rimraf=require(_0x459c('0x3'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x221380,_0x3c4a53){return _0x221380['define'](_0x459c('0x4'),attributes,{'tableName':_0x459c('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67ca=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x39ad4c,_0x2fa27e){var _0xf3314d=function(_0x4de109){while(--_0x4de109){_0x39ad4c['push'](_0x39ad4c['shift']());}};_0xf3314d(++_0x2fa27e);}(_0x67ca,0x115));var _0xa67c=function(_0x502c02,_0x5e9157){_0x502c02=_0x502c02-0x0;var _0x3bef26=_0x67ca[_0x502c02];return _0x3bef26;};'use strict';var _=require(_0xa67c('0x0'));var util=require(_0xa67c('0x1'));var logger=require(_0xa67c('0x2'))(_0xa67c('0x3'));var moment=require(_0xa67c('0x4'));var BPromise=require(_0xa67c('0x5'));var rp=require(_0xa67c('0x6'));var fs=require('fs');var path=require(_0xa67c('0x7'));var rimraf=require(_0xa67c('0x8'));var config=require(_0xa67c('0x9'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xa67c('0xa')]=function(_0x40cbe0,_0x2847cd){return _0x40cbe0[_0xa67c('0xb')](_0xa67c('0xc'),attributes,{'tableName':_0xa67c('0xd'),'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 badb8b0..8b64ba6 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 _0x6c1d=['rpc','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x358b45,_0x237da3){var _0x18dc83=function(_0x365356){while(--_0x365356){_0x358b45['push'](_0x358b45['shift']());}};_0x18dc83(++_0x237da3);}(_0x6c1d,0xdf));var _0xd6c1=function(_0x2d4392,_0x52e054){_0x2d4392=_0x2d4392-0x0;var _0x322daf=_0x6c1d[_0x2d4392];return _0x322daf;};'use strict';var _=require(_0xd6c1('0x0'));var util=require('util');var moment=require(_0xd6c1('0x1'));var BPromise=require(_0xd6c1('0x2'));var rs=require(_0xd6c1('0x3'));var fs=require('fs');var Redis=require(_0xd6c1('0x4'));var db=require(_0xd6c1('0x5'))['db'];var utils=require(_0xd6c1('0x6'));var logger=require('../../config/logger')(_0xd6c1('0x7'));var config=require('../../config/environment');var jayson=require(_0xd6c1('0x8'));var client=jayson[_0xd6c1('0x9')][_0xd6c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4131cf,_0x247150,_0x437e82){return new BPromise(function(_0x5a9a12,_0x2d5f1c){return client[_0xd6c1('0xb')](_0x4131cf,_0x437e82)[_0xd6c1('0xc')](function(_0xc88bca){logger[_0xd6c1('0xd')](_0xd6c1('0xe'),_0x247150,'request\x20sent');logger[_0xd6c1('0xf')](_0xd6c1('0x10'),_0x247150,_0xd6c1('0x11'),JSON[_0xd6c1('0x12')](_0xc88bca));if(_0xc88bca[_0xd6c1('0x13')]){if(_0xc88bca[_0xd6c1('0x13')][_0xd6c1('0x14')]===0x1f4){logger[_0xd6c1('0x13')](_0xd6c1('0xe'),_0x247150,_0xc88bca[_0xd6c1('0x13')][_0xd6c1('0x15')]);return _0x2d5f1c(_0xc88bca[_0xd6c1('0x13')][_0xd6c1('0x15')]);}logger[_0xd6c1('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x247150,_0xc88bca[_0xd6c1('0x13')][_0xd6c1('0x15')]);return _0x5a9a12(_0xc88bca[_0xd6c1('0x13')]['message']);}else{logger[_0xd6c1('0xd')](_0xd6c1('0xe'),_0x247150,_0xd6c1('0x11'));_0x5a9a12(_0xc88bca[_0xd6c1('0x16')][_0xd6c1('0x15')]);}})['catch'](function(_0x39663c){logger[_0xd6c1('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x247150,_0x39663c);_0x2d5f1c(_0x39663c);});});} \ No newline at end of file +var _0x1c3f=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x1c3f,0x1b8));var _0xf1c3=function(_0x197c29,_0x51df0d){_0x197c29=_0x197c29-0x0;var _0x4cda74=_0x1c3f[_0x197c29];return _0x4cda74;};'use strict';var _=require(_0xf1c3('0x0'));var util=require(_0xf1c3('0x1'));var moment=require(_0xf1c3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf1c3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf1c3('0x4'))['db'];var utils=require(_0xf1c3('0x5'));var logger=require(_0xf1c3('0x6'))(_0xf1c3('0x7'));var config=require(_0xf1c3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf1c3('0x9')][_0xf1c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x774788,_0x109d0a,_0x410286){return new BPromise(function(_0x159a46,_0xcb6f4e){return client[_0xf1c3('0xb')](_0x774788,_0x410286)[_0xf1c3('0xc')](function(_0x57a91a){logger[_0xf1c3('0xd')](_0xf1c3('0xe'),_0x109d0a,_0xf1c3('0xf'));logger[_0xf1c3('0x10')](_0xf1c3('0x11'),_0x109d0a,'request\x20sent',JSON['stringify'](_0x57a91a));if(_0x57a91a['error']){if(_0x57a91a[_0xf1c3('0x12')]['code']===0x1f4){logger[_0xf1c3('0x12')](_0xf1c3('0xe'),_0x109d0a,_0x57a91a[_0xf1c3('0x12')][_0xf1c3('0x13')]);return _0xcb6f4e(_0x57a91a[_0xf1c3('0x12')]['message']);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x109d0a,_0x57a91a[_0xf1c3('0x12')][_0xf1c3('0x13')]);return _0x159a46(_0x57a91a['error'][_0xf1c3('0x13')]);}else{logger[_0xf1c3('0xd')](_0xf1c3('0xe'),_0x109d0a,_0xf1c3('0xf'));_0x159a46(_0x57a91a[_0xf1c3('0x14')]['message']);}})['catch'](function(_0x5184bf){logger['error'](_0xf1c3('0xe'),_0x109d0a,_0x5184bf);_0xcb6f4e(_0x5184bf);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 8a51124..e1d41f0 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 _0x40fd=['getQuestions','post','create','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0x40fd,0x1bf));var _0xd40f=function(_0x1945a5,_0x50de54){_0x1945a5=_0x1945a5-0x0;var _0x5817a5=_0x40fd[_0x1945a5];return _0x5817a5;};'use strict';var multer=require(_0xd40f('0x0'));var util=require(_0xd40f('0x1'));var path=require(_0xd40f('0x2'));var timeout=require('connect-timeout');var express=require(_0xd40f('0x3'));var router=express[_0xd40f('0x4')]();var fs_extra=require(_0xd40f('0x5'));var auth=require(_0xd40f('0x6'));var interaction=require(_0xd40f('0x7'));var config=require(_0xd40f('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0xd40f('0x9')]('/',auth[_0xd40f('0xa')](),controller[_0xd40f('0xb')]);router['get'](_0xd40f('0xc'),auth[_0xd40f('0xa')](),controller[_0xd40f('0xd')]);router[_0xd40f('0x9')](_0xd40f('0xe'),auth[_0xd40f('0xa')](),controller['show']);router[_0xd40f('0x9')]('/:id/questions',auth[_0xd40f('0xa')](),controller[_0xd40f('0xf')]);router[_0xd40f('0x10')]('/',auth[_0xd40f('0xa')](),controller[_0xd40f('0x11')]);router[_0xd40f('0x12')](_0xd40f('0xe'),auth[_0xd40f('0xa')](),controller['update']);router[_0xd40f('0x13')](_0xd40f('0xe'),auth[_0xd40f('0xa')](),controller[_0xd40f('0x14')]);module['exports']=router; \ No newline at end of file +var _0x768d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','describe','/:id','/:id/questions','isAuthenticated','getQuestions','create','update','delete','destroy','exports'];(function(_0x560232,_0x3d3008){var _0x478ab6=function(_0x20e131){while(--_0x20e131){_0x560232['push'](_0x560232['shift']());}};_0x478ab6(++_0x3d3008);}(_0x768d,0x12b));var _0xd768=function(_0xc1dfb4,_0x43fa1b){_0xc1dfb4=_0xc1dfb4-0x0;var _0x5b19bd=_0x768d[_0xc1dfb4];return _0x5b19bd;};'use strict';var multer=require(_0xd768('0x0'));var util=require(_0xd768('0x1'));var path=require(_0xd768('0x2'));var timeout=require(_0xd768('0x3'));var express=require(_0xd768('0x4'));var router=express[_0xd768('0x5')]();var fs_extra=require(_0xd768('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd768('0x7'));var config=require(_0xd768('0x8'));var controller=require(_0xd768('0x9'));router[_0xd768('0xa')]('/',auth['isAuthenticated'](),controller[_0xd768('0xb')]);router[_0xd768('0xa')](_0xd768('0xc'),auth['isAuthenticated'](),controller[_0xd768('0xd')]);router[_0xd768('0xa')](_0xd768('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xd768('0xa')](_0xd768('0xf'),auth[_0xd768('0x10')](),controller[_0xd768('0x11')]);router['post']('/',auth[_0xd768('0x10')](),controller[_0xd768('0x12')]);router['put'](_0xd768('0xe'),auth[_0xd768('0x10')](),controller[_0xd768('0x13')]);router[_0xd768('0x14')](_0xd768('0xe'),auth[_0xd768('0x10')](),controller[_0xd768('0x15')]);module[_0xd768('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 28844bd..74c882b 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 _0xabf9=['moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0xe19b83,_0x2ca159){var _0x4b6b05=function(_0x3ebf76){while(--_0x3ebf76){_0xe19b83['push'](_0xe19b83['shift']());}};_0x4b6b05(++_0x2ca159);}(_0xabf9,0x1e4));var _0x9abf=function(_0x12c9ec,_0x603b97){_0x12c9ec=_0x12c9ec-0x0;var _0x152942=_0xabf9[_0x12c9ec];return _0x152942;};'use strict';var moment=require(_0x9abf('0x0'));var Sequelize=require(_0x9abf('0x1'));module[_0x9abf('0x2')]={'starttime':{'type':Sequelize[_0x9abf('0x3')],'set':function(_0x28cf6a){this[_0x9abf('0x4')](_0x9abf('0x5'),_0x28cf6a);this[_0x9abf('0x4')](_0x9abf('0x6'),moment()[_0x9abf('0x7')](_0x9abf('0x8')));}},'endtime':{'type':Sequelize[_0x9abf('0x3')]},'membername':{'type':Sequelize[_0x9abf('0x9')]},'projectname':{'type':Sequelize[_0x9abf('0x9')]},'queue':{'type':Sequelize[_0x9abf('0x9')]},'uniqueid':{'type':Sequelize[_0x9abf('0x9')]},'calleridname':{'type':Sequelize[_0x9abf('0x9')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x9abf('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x6688=['moment','sequelize','exports','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x202d4d,_0x4f092a){var _0x245c1f=function(_0x1a8a9e){while(--_0x1a8a9e){_0x202d4d['push'](_0x202d4d['shift']());}};_0x245c1f(++_0x4f092a);}(_0x6688,0x19e));var _0x8668=function(_0x10e084,_0x4bc3c4){_0x10e084=_0x10e084-0x0;var _0x3a493e=_0x6688[_0x10e084];return _0x3a493e;};'use strict';var moment=require(_0x8668('0x0'));var Sequelize=require(_0x8668('0x1'));module[_0x8668('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x523b2c){this[_0x8668('0x3')]('starttime',_0x523b2c);this['setDataValue'](_0x8668('0x4'),moment()[_0x8668('0x5')](_0x8668('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x8668('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8668('0x7')]},'uniqueid':{'type':Sequelize[_0x8668('0x7')]},'calleridname':{'type':Sequelize[_0x8668('0x7')]},'calleridnum':{'type':Sequelize[_0x8668('0x7')]},'completed':{'type':Sequelize[_0x8668('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 f3b30ba..e5942a6 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 _0xa3a3=['body','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','apply','save','update','destroy','error','stack','name','send','index','map','JscriptySessionReport','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','type','VIRTUAL','merge','options','where','includeAll','findAll','then','rows','catch','params','include','find','create'];(function(_0x4e0f70,_0x375e11){var _0x21e651=function(_0x2a7f92){while(--_0x2a7f92){_0x4e0f70['push'](_0x4e0f70['shift']());}};_0x21e651(++_0x375e11);}(_0xa3a3,0x13a));var _0x3a3a=function(_0x4adc66,_0xb80204){_0x4adc66=_0x4adc66-0x0;var _0x267a41=_0xa3a3[_0x4adc66];return _0x267a41;};'use strict';var emlformat=require(_0x3a3a('0x0'));var rimraf=require(_0x3a3a('0x1'));var zipdir=require(_0x3a3a('0x2'));var jsonpatch=require(_0x3a3a('0x3'));var rp=require(_0x3a3a('0x4'));var moment=require(_0x3a3a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3a3a('0x6'));var path=require('path');var sox=require(_0x3a3a('0x7'));var csv=require(_0x3a3a('0x8'));var ejs=require(_0x3a3a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3a3a('0xa'));var squel=require(_0x3a3a('0xb'));var crypto=require('crypto');var jsforce=require(_0x3a3a('0xc'));var deskjs=require(_0x3a3a('0xd'));var toCsv=require(_0x3a3a('0x8'));var querystring=require(_0x3a3a('0xe'));var Papa=require('papaparse');var Redis=require(_0x3a3a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3a3a('0x10'));var as=require(_0x3a3a('0x11'));var hardwareService=require(_0x3a3a('0x12'));var logger=require('../../config/logger')(_0x3a3a('0x13'));var utils=require('../../config/utils');var config=require(_0x3a3a('0x14'));var licenseUtil=require(_0x3a3a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f5972,_0x1ad325){_0x1ad325=_0x1ad325||0xcc;return function(_0x1397d6){if(_0x1397d6){return _0x5f5972[_0x3a3a('0x16')](_0x1ad325);}return _0x5f5972['status'](_0x1ad325)[_0x3a3a('0x17')]();};}function respondWithResult(_0x28c492,_0x492fdd){_0x492fdd=_0x492fdd||0xc8;return function(_0x1b9f1f){if(_0x1b9f1f){return _0x28c492[_0x3a3a('0x18')](_0x492fdd)[_0x3a3a('0x19')](_0x1b9f1f);}};}function respondWithFilteredResult(_0x54cc79,_0x4d82a5){return function(_0x2ea772){if(_0x2ea772){var _0x4e5848=typeof _0x4d82a5['offset']===_0x3a3a('0x1a')&&typeof _0x4d82a5[_0x3a3a('0x1b')]===_0x3a3a('0x1a');var _0x4de7e1=_0x2ea772[_0x3a3a('0x1c')];var _0x332113=_0x4e5848?0x0:_0x4d82a5[_0x3a3a('0x1d')];var _0x27b0d5=_0x4e5848?_0x2ea772[_0x3a3a('0x1c')]:_0x4d82a5[_0x3a3a('0x1d')]+_0x4d82a5[_0x3a3a('0x1b')];var _0x2cce8c;if(_0x27b0d5>=_0x4de7e1){_0x27b0d5=_0x4de7e1;_0x2cce8c=0xc8;}else{_0x2cce8c=0xce;}_0x54cc79[_0x3a3a('0x18')](_0x2cce8c);return _0x54cc79['set']('Content-Range',_0x332113+'-'+_0x27b0d5+'/'+_0x4de7e1)[_0x3a3a('0x19')](_0x2ea772);}return null;};}function patchUpdates(_0x3f9bd1){return function(_0x36ff9e){try{jsonpatch[_0x3a3a('0x1e')](_0x36ff9e,_0x3f9bd1,!![]);}catch(_0xca37f5){return BPromise['reject'](_0xca37f5);}return _0x36ff9e[_0x3a3a('0x1f')]();};}function saveUpdates(_0x79396c,_0x5d0500){return function(_0x4f8c17){if(_0x4f8c17){return _0x4f8c17[_0x3a3a('0x20')](_0x79396c)['then'](function(_0x355df3){return _0x355df3;});}return null;};}function removeEntity(_0xd35443,_0x1e462d){return function(_0x3291dd){if(_0x3291dd){return _0x3291dd[_0x3a3a('0x21')]()['then'](function(){_0xd35443[_0x3a3a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13e14f,_0x38254c){return function(_0x540f40){if(!_0x540f40){_0x13e14f[_0x3a3a('0x16')](0x194);}return _0x540f40;};}function handleError(_0x5e9336,_0x490b6c){_0x490b6c=_0x490b6c||0x1f4;return function(_0x518d07){logger[_0x3a3a('0x22')](_0x518d07[_0x3a3a('0x23')]);if(_0x518d07['name']){delete _0x518d07[_0x3a3a('0x24')];}_0x5e9336[_0x3a3a('0x18')](_0x490b6c)[_0x3a3a('0x25')](_0x518d07);};}exports[_0x3a3a('0x26')]=function(_0x52fd27,_0xa97576){var _0x4f4255={},_0xb4c6bd={},_0x563d75={'count':0x0,'rows':[]};var _0x2cd4f8=_[_0x3a3a('0x27')](db[_0x3a3a('0x28')]['rawAttributes'],function(_0x1d5fc0){return{'name':_0x1d5fc0[_0x3a3a('0x29')],'type':_0x1d5fc0['type'][_0x3a3a('0x2a')]};});_0xb4c6bd[_0x3a3a('0x2b')]=_[_0x3a3a('0x27')](_0x2cd4f8,_0x3a3a('0x24'));_0xb4c6bd[_0x3a3a('0x2c')]=_[_0x3a3a('0x2d')](_0x52fd27['query']);_0xb4c6bd[_0x3a3a('0x2e')]=_['intersection'](_0xb4c6bd[_0x3a3a('0x2b')],_0xb4c6bd[_0x3a3a('0x2c')]);_0x4f4255[_0x3a3a('0x2f')]=_[_0x3a3a('0x30')](_0xb4c6bd[_0x3a3a('0x2b')],qs[_0x3a3a('0x31')](_0x52fd27[_0x3a3a('0x2c')]['fields']));_0x4f4255[_0x3a3a('0x2f')]=_0x4f4255[_0x3a3a('0x2f')][_0x3a3a('0x32')]?_0x4f4255[_0x3a3a('0x2f')]:_0xb4c6bd[_0x3a3a('0x2b')];if(!_0x52fd27[_0x3a3a('0x2c')][_0x3a3a('0x33')](_0x3a3a('0x34'))){_0x4f4255['limit']=qs['limit'](_0x52fd27[_0x3a3a('0x2c')][_0x3a3a('0x1b')]);_0x4f4255[_0x3a3a('0x1d')]=qs['offset'](_0x52fd27[_0x3a3a('0x2c')][_0x3a3a('0x1d')]);}_0x4f4255[_0x3a3a('0x35')]=qs[_0x3a3a('0x36')](_0x52fd27['query'][_0x3a3a('0x36')]);_0x4f4255['where']=qs[_0x3a3a('0x2e')](_[_0x3a3a('0x37')](_0x52fd27[_0x3a3a('0x2c')],_0xb4c6bd[_0x3a3a('0x2e')]),_0x2cd4f8);if(_0x52fd27[_0x3a3a('0x2c')][_0x3a3a('0x38')]){_0x4f4255['where']=_['merge'](_0x4f4255['where'],{'$or':_[_0x3a3a('0x27')](_0x2cd4f8,function(_0x51518b){if(_0x51518b[_0x3a3a('0x39')]!==_0x3a3a('0x3a')){var _0x4cd2bf={};_0x4cd2bf[_0x51518b['name']]={'$like':'%'+_0x52fd27['query']['filter']+'%'};return _0x4cd2bf;}})});}_0x4f4255=_[_0x3a3a('0x3b')]({},_0x4f4255,_0x52fd27[_0x3a3a('0x3c')]);var _0x53c0ef={'where':_0x4f4255[_0x3a3a('0x3d')]};return db[_0x3a3a('0x28')]['count'](_0x53c0ef)['then'](function(_0x28c310){_0x563d75[_0x3a3a('0x1c')]=_0x28c310;if(_0x52fd27[_0x3a3a('0x2c')][_0x3a3a('0x3e')]){_0x4f4255['include']=[{'all':!![]}];}return db[_0x3a3a('0x28')][_0x3a3a('0x3f')](_0x4f4255);})[_0x3a3a('0x40')](function(_0x37e50c){_0x563d75[_0x3a3a('0x41')]=_0x37e50c;return _0x563d75;})['then'](respondWithFilteredResult(_0xa97576,_0x4f4255))[_0x3a3a('0x42')](handleError(_0xa97576,null));};exports['show']=function(_0x1d61bc,_0x59762e){var _0x470e0a={'raw':!![],'where':{'id':_0x1d61bc[_0x3a3a('0x43')]['id']}},_0x15b9d0={};_0x15b9d0[_0x3a3a('0x2b')]=_[_0x3a3a('0x2d')](db['JscriptySessionReport']['rawAttributes']);_0x15b9d0['query']=_[_0x3a3a('0x2d')](_0x1d61bc[_0x3a3a('0x2c')]);_0x15b9d0[_0x3a3a('0x2e')]=_['intersection'](_0x15b9d0[_0x3a3a('0x2b')],_0x15b9d0['query']);_0x470e0a[_0x3a3a('0x2f')]=_[_0x3a3a('0x30')](_0x15b9d0['model'],qs[_0x3a3a('0x31')](_0x1d61bc['query'][_0x3a3a('0x31')]));_0x470e0a['attributes']=_0x470e0a['attributes'][_0x3a3a('0x32')]?_0x470e0a[_0x3a3a('0x2f')]:_0x15b9d0[_0x3a3a('0x2b')];if(_0x1d61bc[_0x3a3a('0x2c')][_0x3a3a('0x3e')]){_0x470e0a[_0x3a3a('0x44')]=[{'all':!![]}];}_0x470e0a=_['merge']({},_0x470e0a,_0x1d61bc[_0x3a3a('0x3c')]);return db[_0x3a3a('0x28')][_0x3a3a('0x45')](_0x470e0a)[_0x3a3a('0x40')](handleEntityNotFound(_0x59762e,null))[_0x3a3a('0x40')](respondWithResult(_0x59762e,null))[_0x3a3a('0x42')](handleError(_0x59762e,null));};exports[_0x3a3a('0x46')]=function(_0x163902,_0x5096ef){return db[_0x3a3a('0x28')]['create'](_0x163902[_0x3a3a('0x47')],{})[_0x3a3a('0x40')](respondWithResult(_0x5096ef,0xc9))['catch'](handleError(_0x5096ef,null));};exports[_0x3a3a('0x20')]=function(_0x12dbd0,_0x1504ac){if(_0x12dbd0[_0x3a3a('0x47')]['id']){delete _0x12dbd0[_0x3a3a('0x47')]['id'];}return db['JscriptySessionReport'][_0x3a3a('0x45')]({'where':{'id':_0x12dbd0[_0x3a3a('0x43')]['id']}})['then'](handleEntityNotFound(_0x1504ac,null))[_0x3a3a('0x40')](saveUpdates(_0x12dbd0['body'],null))[_0x3a3a('0x40')](respondWithResult(_0x1504ac,null))[_0x3a3a('0x42')](handleError(_0x1504ac,null));};exports[_0x3a3a('0x21')]=function(_0x522e5e,_0x5130ca){return db[_0x3a3a('0x28')]['find']({'where':{'id':_0x522e5e[_0x3a3a('0x43')]['id']}})[_0x3a3a('0x40')](handleEntityNotFound(_0x5130ca,null))[_0x3a3a('0x40')](removeEntity(_0x5130ca,null))[_0x3a3a('0x42')](handleError(_0x5130ca,null));};exports['describe']=function(_0x4a672e,_0x20a180){return db[_0x3a3a('0x28')][_0x3a3a('0x48')]()['then'](respondWithResult(_0x20a180,null))[_0x3a3a('0x42')](handleError(_0x20a180,null));};exports[_0x3a3a('0x49')]=function(_0x3bedb6,_0x7c4fb2,_0x64ec74){var _0x36b84f={'raw':!![],'where':{}};var _0x229f2b={};var _0x529302={'count':0x0,'rows':[]};return db[_0x3a3a('0x28')][_0x3a3a('0x4a')]({'where':{'id':_0x3bedb6['params']['id']}})[_0x3a3a('0x40')](handleEntityNotFound(_0x7c4fb2,null))['then'](function(_0x1b5b6d){if(_0x1b5b6d){_0x229f2b['model']=_[_0x3a3a('0x2d')](db[_0x3a3a('0x4b')][_0x3a3a('0x4c')]);_0x229f2b[_0x3a3a('0x2c')]=_[_0x3a3a('0x2d')](_0x3bedb6[_0x3a3a('0x2c')]);_0x229f2b[_0x3a3a('0x2e')]=_['intersection'](_0x229f2b[_0x3a3a('0x2b')],_0x229f2b[_0x3a3a('0x2c')]);_0x36b84f['attributes']=_[_0x3a3a('0x30')](_0x229f2b['model'],qs[_0x3a3a('0x31')](_0x3bedb6[_0x3a3a('0x2c')][_0x3a3a('0x31')]));_0x36b84f['attributes']=_0x36b84f['attributes'][_0x3a3a('0x32')]?_0x36b84f[_0x3a3a('0x2f')]:_0x229f2b['model'];if(!_0x3bedb6[_0x3a3a('0x2c')][_0x3a3a('0x33')](_0x3a3a('0x34'))){_0x36b84f[_0x3a3a('0x1b')]=qs[_0x3a3a('0x1b')](_0x3bedb6[_0x3a3a('0x2c')]['limit']);_0x36b84f[_0x3a3a('0x1d')]=qs[_0x3a3a('0x1d')](_0x3bedb6['query'][_0x3a3a('0x1d')]);}_0x36b84f[_0x3a3a('0x35')]=qs[_0x3a3a('0x36')](_0x3bedb6['query'][_0x3a3a('0x36')]);_0x36b84f[_0x3a3a('0x3d')]=qs[_0x3a3a('0x2e')](_[_0x3a3a('0x37')](_0x3bedb6[_0x3a3a('0x2c')],_0x229f2b[_0x3a3a('0x2e')]));_0x36b84f[_0x3a3a('0x3d')]['SessionId']=_0x1b5b6d['id'];if(_0x3bedb6[_0x3a3a('0x2c')]['filter']){_0x36b84f['where']=_['merge'](_0x36b84f[_0x3a3a('0x3d')],{'$or':_['map'](_0x36b84f[_0x3a3a('0x2f')],function(_0x2a5380){var _0x2cf78d={};_0x2cf78d[_0x2a5380]={'$like':'%'+_0x3bedb6['query'][_0x3a3a('0x38')]+'%'};return _0x2cf78d;})});}_0x36b84f=_[_0x3a3a('0x3b')]({},_0x36b84f,_0x3bedb6[_0x3a3a('0x3c')]);return db[_0x3a3a('0x4b')]['count']({'where':_0x36b84f['where']})[_0x3a3a('0x40')](function(_0x11dfb0){_0x529302['count']=_0x11dfb0;if(_0x3bedb6[_0x3a3a('0x2c')][_0x3a3a('0x3e')]){_0x36b84f[_0x3a3a('0x44')]=[{'all':!![]}];}return db[_0x3a3a('0x4b')][_0x3a3a('0x3f')](_0x36b84f);})[_0x3a3a('0x40')](function(_0xb15cdb){_0x529302[_0x3a3a('0x41')]=_0xb15cdb;return _0x529302;});}})[_0x3a3a('0x40')](respondWithFilteredResult(_0x7c4fb2,_0x36b84f))['catch'](handleError(_0x7c4fb2,null));}; \ No newline at end of file +var _0xc8fa=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','catch','params','include','create','update','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','length','SessionId','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','reject','save','then','destroy','error','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xc8fa,0x72));var _0xac8f=function(_0xd39e41,_0x55d982){_0xd39e41=_0xd39e41-0x0;var _0x2139c6=_0xc8fa[_0xd39e41];return _0x2139c6;};'use strict';var emlformat=require(_0xac8f('0x0'));var rimraf=require(_0xac8f('0x1'));var zipdir=require(_0xac8f('0x2'));var jsonpatch=require(_0xac8f('0x3'));var rp=require('request-promise');var moment=require(_0xac8f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac8f('0x5'));var path=require('path');var sox=require(_0xac8f('0x6'));var csv=require('to-csv');var ejs=require(_0xac8f('0x7'));var fs=require('fs');var fs_extra=require(_0xac8f('0x8'));var _=require(_0xac8f('0x9'));var squel=require(_0xac8f('0xa'));var crypto=require(_0xac8f('0xb'));var jsforce=require(_0xac8f('0xc'));var deskjs=require(_0xac8f('0xd'));var toCsv=require(_0xac8f('0xe'));var querystring=require(_0xac8f('0xf'));var Papa=require(_0xac8f('0x10'));var Redis=require(_0xac8f('0x11'));var authService=require(_0xac8f('0x12'));var qs=require(_0xac8f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac8f('0x14'));var logger=require(_0xac8f('0x15'))(_0xac8f('0x16'));var utils=require(_0xac8f('0x17'));var config=require(_0xac8f('0x18'));var licenseUtil=require(_0xac8f('0x19'));var db=require(_0xac8f('0x1a'))['db'];function respondWithStatusCode(_0x3ab2c3,_0x4471eb){_0x4471eb=_0x4471eb||0xcc;return function(_0x86de8f){if(_0x86de8f){return _0x3ab2c3[_0xac8f('0x1b')](_0x4471eb);}return _0x3ab2c3['status'](_0x4471eb)[_0xac8f('0x1c')]();};}function respondWithResult(_0x12059a,_0x5db7ca){_0x5db7ca=_0x5db7ca||0xc8;return function(_0x1432ee){if(_0x1432ee){return _0x12059a[_0xac8f('0x1d')](_0x5db7ca)[_0xac8f('0x1e')](_0x1432ee);}};}function respondWithFilteredResult(_0x2bb0a9,_0x86d5c1){return function(_0x3b93ca){if(_0x3b93ca){var _0x1897dc=typeof _0x86d5c1[_0xac8f('0x1f')]==='undefined'&&typeof _0x86d5c1[_0xac8f('0x20')]===_0xac8f('0x21');var _0x1e0d19=_0x3b93ca[_0xac8f('0x22')];var _0x1cc6fe=_0x1897dc?0x0:_0x86d5c1[_0xac8f('0x1f')];var _0x1db4d9=_0x1897dc?_0x3b93ca[_0xac8f('0x22')]:_0x86d5c1['offset']+_0x86d5c1['limit'];var _0x388bcb;if(_0x1db4d9>=_0x1e0d19){_0x1db4d9=_0x1e0d19;_0x388bcb=0xc8;}else{_0x388bcb=0xce;}_0x2bb0a9[_0xac8f('0x1d')](_0x388bcb);return _0x2bb0a9[_0xac8f('0x23')]('Content-Range',_0x1cc6fe+'-'+_0x1db4d9+'/'+_0x1e0d19)[_0xac8f('0x1e')](_0x3b93ca);}return null;};}function patchUpdates(_0x2820f5){return function(_0x10d281){try{jsonpatch['apply'](_0x10d281,_0x2820f5,!![]);}catch(_0x21cd08){return BPromise[_0xac8f('0x24')](_0x21cd08);}return _0x10d281[_0xac8f('0x25')]();};}function saveUpdates(_0x577351,_0x170f1d){return function(_0x5ee19c){if(_0x5ee19c){return _0x5ee19c['update'](_0x577351)[_0xac8f('0x26')](function(_0x895864){return _0x895864;});}return null;};}function removeEntity(_0x45874e,_0x24bbf9){return function(_0x2c6155){if(_0x2c6155){return _0x2c6155[_0xac8f('0x27')]()[_0xac8f('0x26')](function(){_0x45874e['status'](0xcc)[_0xac8f('0x1c')]();});}};}function handleEntityNotFound(_0x3876c4,_0x41c699){return function(_0x40af38){if(!_0x40af38){_0x3876c4[_0xac8f('0x1b')](0x194);}return _0x40af38;};}function handleError(_0x3aeb74,_0x122f05){_0x122f05=_0x122f05||0x1f4;return function(_0x254651){logger[_0xac8f('0x28')](_0x254651['stack']);if(_0x254651[_0xac8f('0x29')]){delete _0x254651[_0xac8f('0x29')];}_0x3aeb74[_0xac8f('0x1d')](_0x122f05)[_0xac8f('0x2a')](_0x254651);};}exports[_0xac8f('0x2b')]=function(_0x2b52a1,_0x42afde){var _0x50e353={},_0x219629={},_0x3bfc55={'count':0x0,'rows':[]};var _0x3e933a=_['map'](db[_0xac8f('0x2c')][_0xac8f('0x2d')],function(_0xc29a9a){return{'name':_0xc29a9a[_0xac8f('0x2e')],'type':_0xc29a9a[_0xac8f('0x2f')][_0xac8f('0x30')]};});_0x219629[_0xac8f('0x31')]=_[_0xac8f('0x32')](_0x3e933a,_0xac8f('0x29'));_0x219629[_0xac8f('0x33')]=_[_0xac8f('0x34')](_0x2b52a1[_0xac8f('0x33')]);_0x219629[_0xac8f('0x35')]=_[_0xac8f('0x36')](_0x219629[_0xac8f('0x31')],_0x219629[_0xac8f('0x33')]);_0x50e353[_0xac8f('0x37')]=_[_0xac8f('0x36')](_0x219629['model'],qs[_0xac8f('0x38')](_0x2b52a1[_0xac8f('0x33')][_0xac8f('0x38')]));_0x50e353[_0xac8f('0x37')]=_0x50e353[_0xac8f('0x37')]['length']?_0x50e353[_0xac8f('0x37')]:_0x219629['model'];if(!_0x2b52a1[_0xac8f('0x33')][_0xac8f('0x39')](_0xac8f('0x3a'))){_0x50e353['limit']=qs['limit'](_0x2b52a1[_0xac8f('0x33')][_0xac8f('0x20')]);_0x50e353[_0xac8f('0x1f')]=qs[_0xac8f('0x1f')](_0x2b52a1['query'][_0xac8f('0x1f')]);}_0x50e353[_0xac8f('0x3b')]=qs['sort'](_0x2b52a1[_0xac8f('0x33')][_0xac8f('0x3c')]);_0x50e353['where']=qs['filters'](_[_0xac8f('0x3d')](_0x2b52a1['query'],_0x219629[_0xac8f('0x35')]),_0x3e933a);if(_0x2b52a1[_0xac8f('0x33')][_0xac8f('0x3e')]){_0x50e353['where']=_[_0xac8f('0x3f')](_0x50e353['where'],{'$or':_[_0xac8f('0x32')](_0x3e933a,function(_0x214b0c){if(_0x214b0c[_0xac8f('0x2f')]!==_0xac8f('0x40')){var _0x17805b={};_0x17805b[_0x214b0c[_0xac8f('0x29')]]={'$like':'%'+_0x2b52a1[_0xac8f('0x33')]['filter']+'%'};return _0x17805b;}})});}_0x50e353=_[_0xac8f('0x3f')]({},_0x50e353,_0x2b52a1[_0xac8f('0x41')]);var _0x3155c8={'where':_0x50e353[_0xac8f('0x42')]};return db[_0xac8f('0x2c')][_0xac8f('0x22')](_0x3155c8)[_0xac8f('0x26')](function(_0x3ec205){_0x3bfc55['count']=_0x3ec205;if(_0x2b52a1['query'][_0xac8f('0x43')]){_0x50e353['include']=[{'all':!![]}];}return db[_0xac8f('0x2c')]['findAll'](_0x50e353);})[_0xac8f('0x26')](function(_0x497980){_0x3bfc55['rows']=_0x497980;return _0x3bfc55;})[_0xac8f('0x26')](respondWithFilteredResult(_0x42afde,_0x50e353))[_0xac8f('0x44')](handleError(_0x42afde,null));};exports['show']=function(_0x24a78c,_0x4eb574){var _0x1f6d7c={'raw':!![],'where':{'id':_0x24a78c[_0xac8f('0x45')]['id']}},_0x518720={};_0x518720[_0xac8f('0x31')]=_[_0xac8f('0x34')](db['JscriptySessionReport'][_0xac8f('0x2d')]);_0x518720[_0xac8f('0x33')]=_['keys'](_0x24a78c[_0xac8f('0x33')]);_0x518720[_0xac8f('0x35')]=_[_0xac8f('0x36')](_0x518720[_0xac8f('0x31')],_0x518720['query']);_0x1f6d7c['attributes']=_['intersection'](_0x518720[_0xac8f('0x31')],qs[_0xac8f('0x38')](_0x24a78c['query'][_0xac8f('0x38')]));_0x1f6d7c[_0xac8f('0x37')]=_0x1f6d7c[_0xac8f('0x37')]['length']?_0x1f6d7c[_0xac8f('0x37')]:_0x518720[_0xac8f('0x31')];if(_0x24a78c[_0xac8f('0x33')]['includeAll']){_0x1f6d7c[_0xac8f('0x46')]=[{'all':!![]}];}_0x1f6d7c=_[_0xac8f('0x3f')]({},_0x1f6d7c,_0x24a78c['options']);return db[_0xac8f('0x2c')]['find'](_0x1f6d7c)[_0xac8f('0x26')](handleEntityNotFound(_0x4eb574,null))[_0xac8f('0x26')](respondWithResult(_0x4eb574,null))[_0xac8f('0x44')](handleError(_0x4eb574,null));};exports[_0xac8f('0x47')]=function(_0x57e774,_0x561fa5){return db[_0xac8f('0x2c')][_0xac8f('0x47')](_0x57e774['body'],{})[_0xac8f('0x26')](respondWithResult(_0x561fa5,0xc9))[_0xac8f('0x44')](handleError(_0x561fa5,null));};exports[_0xac8f('0x48')]=function(_0x71e807,_0x7467d4){if(_0x71e807[_0xac8f('0x49')]['id']){delete _0x71e807[_0xac8f('0x49')]['id'];}return db['JscriptySessionReport'][_0xac8f('0x4a')]({'where':{'id':_0x71e807[_0xac8f('0x45')]['id']}})[_0xac8f('0x26')](handleEntityNotFound(_0x7467d4,null))[_0xac8f('0x26')](saveUpdates(_0x71e807[_0xac8f('0x49')],null))['then'](respondWithResult(_0x7467d4,null))[_0xac8f('0x44')](handleError(_0x7467d4,null));};exports[_0xac8f('0x27')]=function(_0xa61485,_0x469ca4){return db[_0xac8f('0x2c')][_0xac8f('0x4a')]({'where':{'id':_0xa61485[_0xac8f('0x45')]['id']}})[_0xac8f('0x26')](handleEntityNotFound(_0x469ca4,null))[_0xac8f('0x26')](removeEntity(_0x469ca4,null))[_0xac8f('0x44')](handleError(_0x469ca4,null));};exports[_0xac8f('0x4b')]=function(_0x1cc31b,_0x377a7c){return db[_0xac8f('0x2c')][_0xac8f('0x4b')]()['then'](respondWithResult(_0x377a7c,null))['catch'](handleError(_0x377a7c,null));};exports[_0xac8f('0x4c')]=function(_0x3dc7c1,_0x3d5265,_0x5ecc91){var _0x564ec1={'raw':!![],'where':{}};var _0x5179c7={};var _0x3328ed={'count':0x0,'rows':[]};return db[_0xac8f('0x2c')][_0xac8f('0x4d')]({'where':{'id':_0x3dc7c1['params']['id']}})['then'](handleEntityNotFound(_0x3d5265,null))[_0xac8f('0x26')](function(_0x7790c4){if(_0x7790c4){_0x5179c7[_0xac8f('0x31')]=_[_0xac8f('0x34')](db[_0xac8f('0x4e')][_0xac8f('0x2d')]);_0x5179c7[_0xac8f('0x33')]=_[_0xac8f('0x34')](_0x3dc7c1[_0xac8f('0x33')]);_0x5179c7['filters']=_['intersection'](_0x5179c7[_0xac8f('0x31')],_0x5179c7[_0xac8f('0x33')]);_0x564ec1['attributes']=_[_0xac8f('0x36')](_0x5179c7[_0xac8f('0x31')],qs[_0xac8f('0x38')](_0x3dc7c1['query'][_0xac8f('0x38')]));_0x564ec1['attributes']=_0x564ec1[_0xac8f('0x37')][_0xac8f('0x4f')]?_0x564ec1[_0xac8f('0x37')]:_0x5179c7[_0xac8f('0x31')];if(!_0x3dc7c1[_0xac8f('0x33')][_0xac8f('0x39')]('nolimit')){_0x564ec1[_0xac8f('0x20')]=qs[_0xac8f('0x20')](_0x3dc7c1[_0xac8f('0x33')]['limit']);_0x564ec1[_0xac8f('0x1f')]=qs['offset'](_0x3dc7c1['query'][_0xac8f('0x1f')]);}_0x564ec1[_0xac8f('0x3b')]=qs[_0xac8f('0x3c')](_0x3dc7c1[_0xac8f('0x33')]['sort']);_0x564ec1[_0xac8f('0x42')]=qs[_0xac8f('0x35')](_[_0xac8f('0x3d')](_0x3dc7c1[_0xac8f('0x33')],_0x5179c7[_0xac8f('0x35')]));_0x564ec1[_0xac8f('0x42')][_0xac8f('0x50')]=_0x7790c4['id'];if(_0x3dc7c1[_0xac8f('0x33')]['filter']){_0x564ec1[_0xac8f('0x42')]=_[_0xac8f('0x3f')](_0x564ec1[_0xac8f('0x42')],{'$or':_[_0xac8f('0x32')](_0x564ec1['attributes'],function(_0x2256ce){var _0x4d9045={};_0x4d9045[_0x2256ce]={'$like':'%'+_0x3dc7c1[_0xac8f('0x33')]['filter']+'%'};return _0x4d9045;})});}_0x564ec1=_[_0xac8f('0x3f')]({},_0x564ec1,_0x3dc7c1[_0xac8f('0x41')]);return db[_0xac8f('0x4e')][_0xac8f('0x22')]({'where':_0x564ec1['where']})[_0xac8f('0x26')](function(_0xe88f19){_0x3328ed['count']=_0xe88f19;if(_0x3dc7c1[_0xac8f('0x33')]['includeAll']){_0x564ec1[_0xac8f('0x46')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xac8f('0x51')](_0x564ec1);})[_0xac8f('0x26')](function(_0x5d9dad){_0x3328ed[_0xac8f('0x52')]=_0x5d9dad;return _0x3328ed;});}})[_0xac8f('0x26')](respondWithFilteredResult(_0x3d5265,_0x564ec1))[_0xac8f('0x44')](handleError(_0x3d5265,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 5090e60..36152f8 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.model.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1883=['../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x244862,_0x3da79e){var _0x2bce23=function(_0x235ae5){while(--_0x235ae5){_0x244862['push'](_0x244862['shift']());}};_0x2bce23(++_0x3da79e);}(_0x1883,0xab));var _0x3188=function(_0x1576f1,_0xf69fb6){_0x1576f1=_0x1576f1-0x0;var _0x334b28=_0x1883[_0x1576f1];return _0x334b28;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb66=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','util'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xcb66,0x19f));var _0x6cb6=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0xcb66[_0x2718c7];return _0x59d89c;};'use strict';var _=require('lodash');var util=require(_0x6cb6('0x0'));var logger=require(_0x6cb6('0x1'))(_0x6cb6('0x2'));var moment=require(_0x6cb6('0x3'));var BPromise=require(_0x6cb6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cb6('0x5'));var rimraf=require(_0x6cb6('0x6'));var config=require(_0x6cb6('0x7'));var attributes=require(_0x6cb6('0x8'));module[_0x6cb6('0x9')]=function(_0x506d14,_0x53078d){return _0x506d14[_0x6cb6('0xa')](_0x6cb6('0xb'),attributes,{'tableName':_0x6cb6('0xc'),'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 1765573..49a3ba9 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 _0x1967=['then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x1967,0x173));var _0x7196=function(_0x56ece6,_0x4784b9){_0x56ece6=_0x56ece6-0x0;var _0x3be7bc=_0x1967[_0x56ece6];return _0x3be7bc;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x7046=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xdb46c9,_0x5f254d){var _0x111080=function(_0x31d651){while(--_0x31d651){_0xdb46c9['push'](_0xdb46c9['shift']());}};_0x111080(++_0x5f254d);}(_0x7046,0x144));var _0x6704=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7046[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4badf8,_0x5ced8,_0x49b8b6){return new BPromise(function(_0x56b1ff,_0x390ace){return client['request'](_0x4badf8,_0x49b8b6)['then'](function(_0x3ca599){logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,_0x6704('0xe'));logger[_0x6704('0xf')](_0x6704('0x10'),_0x5ced8,_0x6704('0xe'),JSON[_0x6704('0x11')](_0x3ca599));if(_0x3ca599['error']){if(_0x3ca599[_0x6704('0x12')][_0x6704('0x13')]===0x1f4){logger['error'](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x390ace(_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);}logger[_0x6704('0x12')](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x56b1ff(_0x3ca599['error'][_0x6704('0x14')]);}else{logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,'request\x20sent');_0x56b1ff(_0x3ca599[_0x6704('0x15')][_0x6704('0x14')]);}})[_0x6704('0x16')](function(_0x29fa46){logger[_0x6704('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x5ced8,_0x29fa46);_0x390ace(_0x29fa46);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 83f84b2..602255d 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 _0x8aa0=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile'];(function(_0x573990,_0x262643){var _0x4e6109=function(_0x19bce1){while(--_0x19bce1){_0x573990['push'](_0x573990['shift']());}};_0x4e6109(++_0x262643);}(_0x8aa0,0xb7));var _0x08aa=function(_0x58e631,_0x4690e3){_0x58e631=_0x58e631-0x0;var _0x40ae88=_0x8aa0[_0x58e631];return _0x40ae88;};'use strict';var multer=require(_0x08aa('0x0'));var util=require('util');var path=require(_0x08aa('0x1'));var timeout=require(_0x08aa('0x2'));var express=require(_0x08aa('0x3'));var router=express[_0x08aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x08aa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x08aa('0x6'));var controller=require('./license.controller');router['get']('/',controller[_0x08aa('0x7')]);router['put'](_0x08aa('0x8'),auth[_0x08aa('0x9')](),controller[_0x08aa('0xa')]);router['get'](_0x08aa('0xb'),auth[_0x08aa('0x9')](),controller[_0x08aa('0xc')]);module[_0x08aa('0xd')]=router; \ No newline at end of file +var _0x9757=['get','put','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller'];(function(_0x4328db,_0xf228ee){var _0x1de33a=function(_0x436f72){while(--_0x436f72){_0x4328db['push'](_0x4328db['shift']());}};_0x1de33a(++_0xf228ee);}(_0x9757,0x9d));var _0x7975=function(_0x30944f,_0xf9a9f3){_0x30944f=_0x30944f-0x0;var _0x14993c=_0x9757[_0x30944f];return _0x14993c;};'use strict';var multer=require(_0x7975('0x0'));var util=require(_0x7975('0x1'));var path=require('path');var timeout=require(_0x7975('0x2'));var express=require(_0x7975('0x3'));var router=express['Router']();var fs_extra=require(_0x7975('0x4'));var auth=require(_0x7975('0x5'));var interaction=require(_0x7975('0x6'));var config=require('../../config/environment');var controller=require(_0x7975('0x7'));router[_0x7975('0x8')]('/',controller['index']);router[_0x7975('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7975('0xa')]);router['get'](_0x7975('0xb'),auth[_0x7975('0xc')](),controller[_0x7975('0xd')]);module[_0x7975('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 8cc7412..7b749f9 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 _0x60ec=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x28f851,_0x4ef3f1){var _0x5c86d4=function(_0x31fd2d){while(--_0x31fd2d){_0x28f851['push'](_0x28f851['shift']());}};_0x5c86d4(++_0x4ef3f1);}(_0x60ec,0xfc));var _0xc60e=function(_0x1215f6,_0x466abd){_0x1215f6=_0x1215f6-0x0;var _0x38194c=_0x60ec[_0x1215f6];return _0x38194c;};'use strict';var Sequelize=require(_0xc60e('0x0'));module[_0xc60e('0x1')]={'license':{'type':Sequelize[_0xc60e('0x2')]},'data1':{'type':Sequelize[_0xc60e('0x3')]},'data2':{'type':Sequelize[_0xc60e('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xc60e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x04ec=['STRING','INTEGER','sequelize','TEXT'];(function(_0x57a114,_0x1f5a03){var _0x1af0e5=function(_0x2b94fc){while(--_0x2b94fc){_0x57a114['push'](_0x57a114['shift']());}};_0x1af0e5(++_0x1f5a03);}(_0x04ec,0x19a));var _0xc04e=function(_0x46ce98,_0x52d764){_0x46ce98=_0x46ce98-0x0;var _0x172f46=_0x04ec[_0x46ce98];return _0x172f46;};'use strict';var Sequelize=require(_0xc04e('0x0'));module['exports']={'license':{'type':Sequelize[_0xc04e('0x1')]},'data1':{'type':Sequelize[_0xc04e('0x2')]},'data2':{'type':Sequelize[_0xc04e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xc04e('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 01e9a86..498f067 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 _0x9c18=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','save','update','destroy','then','end','stack','name','send','index','model','License','query','keys','filters','intersection','attributes','fields','length','options','getLicense','catch','body','params','get','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','set','Content-Type','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis'];(function(_0x27e577,_0xb4a36){var _0x2ba541=function(_0x572777){while(--_0x572777){_0x27e577['push'](_0x27e577['shift']());}};_0x2ba541(++_0xb4a36);}(_0x9c18,0x153));var _0x89c1=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x9c18[_0x125ff8];return _0x2d9ef;};'use strict';var emlformat=require(_0x89c1('0x0'));var rimraf=require(_0x89c1('0x1'));var zipdir=require(_0x89c1('0x2'));var jsonpatch=require(_0x89c1('0x3'));var rp=require('request-promise');var moment=require(_0x89c1('0x4'));var BPromise=require(_0x89c1('0x5'));var Mustache=require(_0x89c1('0x6'));var util=require(_0x89c1('0x7'));var path=require('path');var sox=require(_0x89c1('0x8'));var csv=require(_0x89c1('0x9'));var ejs=require(_0x89c1('0xa'));var fs=require('fs');var fs_extra=require(_0x89c1('0xb'));var _=require(_0x89c1('0xc'));var squel=require(_0x89c1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x89c1('0xe'));var toCsv=require(_0x89c1('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x89c1('0xf'));var authService=require(_0x89c1('0x10'));var qs=require(_0x89c1('0x11'));var as=require(_0x89c1('0x12'));var hardwareService=require(_0x89c1('0x13'));var logger=require(_0x89c1('0x14'))('api');var utils=require(_0x89c1('0x15'));var config=require(_0x89c1('0x16'));var licenseUtil=require(_0x89c1('0x17'));var db=require(_0x89c1('0x18'))['db'];function respondWithStatusCode(_0x23f042,_0x31fd1e){_0x31fd1e=_0x31fd1e||0xcc;return function(_0x502424){if(_0x502424){return _0x23f042[_0x89c1('0x19')](_0x31fd1e);}return _0x23f042[_0x89c1('0x1a')](_0x31fd1e)['end']();};}function respondWithResult(_0x5884c7,_0x2daac1){_0x2daac1=_0x2daac1||0xc8;return function(_0x322986){if(_0x322986){return _0x5884c7[_0x89c1('0x1a')](_0x2daac1)['json'](_0x322986);}};}function respondWithFilteredResult(_0x2bf70d,_0x553f52){return function(_0x5a6a39){if(_0x5a6a39){var _0x14685a=typeof _0x553f52[_0x89c1('0x1b')]===_0x89c1('0x1c')&&typeof _0x553f52['limit']==='undefined';var _0x52235c=_0x5a6a39[_0x89c1('0x1d')];var _0x1a826a=_0x14685a?0x0:_0x553f52[_0x89c1('0x1b')];var _0x4e8300=_0x14685a?_0x5a6a39[_0x89c1('0x1d')]:_0x553f52['offset']+_0x553f52[_0x89c1('0x1e')];var _0x198c13;if(_0x4e8300>=_0x52235c){_0x4e8300=_0x52235c;_0x198c13=0xc8;}else{_0x198c13=0xce;}_0x2bf70d[_0x89c1('0x1a')](_0x198c13);return _0x2bf70d['set']('Content-Range',_0x1a826a+'-'+_0x4e8300+'/'+_0x52235c)[_0x89c1('0x1f')](_0x5a6a39);}return null;};}function patchUpdates(_0x8807d0){return function(_0x2a3dbc){try{jsonpatch[_0x89c1('0x20')](_0x2a3dbc,_0x8807d0,!![]);}catch(_0x165cf5){return BPromise[_0x89c1('0x21')](_0x165cf5);}return _0x2a3dbc[_0x89c1('0x22')]();};}function saveUpdates(_0x40af44,_0x377d7c){return function(_0x381327){if(_0x381327){return _0x381327[_0x89c1('0x23')](_0x40af44)['then'](function(_0xfb3aed){return _0xfb3aed;});}return null;};}function removeEntity(_0x387f06,_0x42f5ff){return function(_0x4e571b){if(_0x4e571b){return _0x4e571b[_0x89c1('0x24')]()[_0x89c1('0x25')](function(){_0x387f06[_0x89c1('0x1a')](0xcc)[_0x89c1('0x26')]();});}};}function handleEntityNotFound(_0xc235cd,_0x579f3e){return function(_0x33376c){if(!_0x33376c){_0xc235cd[_0x89c1('0x19')](0x194);}return _0x33376c;};}function handleError(_0x5c8dac,_0x47c7c8){_0x47c7c8=_0x47c7c8||0x1f4;return function(_0xb74115){logger['error'](_0xb74115[_0x89c1('0x27')]);if(_0xb74115[_0x89c1('0x28')]){delete _0xb74115[_0x89c1('0x28')];}_0x5c8dac['status'](_0x47c7c8)[_0x89c1('0x29')](_0xb74115);};}var utilLicense=require('../../config/license/util');exports[_0x89c1('0x2a')]=function(_0x442042,_0xb7f9b7){var _0x543749={'raw':!![],'where':{'id':0x1}},_0x1f7bc7={};_0x1f7bc7[_0x89c1('0x2b')]=_['keys'](db[_0x89c1('0x2c')]['rawAttributes']);_0x1f7bc7[_0x89c1('0x2d')]=_[_0x89c1('0x2e')](_0x442042[_0x89c1('0x2d')]);_0x1f7bc7[_0x89c1('0x2f')]=_[_0x89c1('0x30')](_0x1f7bc7[_0x89c1('0x2b')],_0x1f7bc7[_0x89c1('0x2d')]);_0x543749[_0x89c1('0x31')]=_[_0x89c1('0x30')](_0x1f7bc7[_0x89c1('0x2b')],qs['fields'](_0x442042[_0x89c1('0x2d')][_0x89c1('0x32')]));_0x543749['attributes']=_0x543749[_0x89c1('0x31')][_0x89c1('0x33')]?_0x543749[_0x89c1('0x31')]:_0x1f7bc7[_0x89c1('0x2b')];_0x543749=_['merge']({},_0x543749,_0x442042[_0x89c1('0x34')]);return utilLicense[_0x89c1('0x35')](_0x543749)['then'](respondWithResult(_0xb7f9b7,null))[_0x89c1('0x36')](handleError(_0xb7f9b7,null));};exports[_0x89c1('0x23')]=function(_0x1f5a4d,_0x52d865){if(_0x1f5a4d[_0x89c1('0x37')]['id']){delete _0x1f5a4d[_0x89c1('0x37')]['id'];}return db[_0x89c1('0x2c')]['find']({'where':{'id':_0x1f5a4d[_0x89c1('0x38')]['id']}})[_0x89c1('0x25')](handleEntityNotFound(_0x52d865,null))[_0x89c1('0x25')](function(_0x438815){var _0x1fe535=_0x438815[_0x89c1('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0x1fe535,_0x1f5a4d[_0x89c1('0x37')][_0x89c1('0x3a')]);})[_0x89c1('0x25')](function(_0x13e294){if(!_0x13e294[_0x89c1('0x3b')]){return saveUpdates(_0x1f5a4d[_0x89c1('0x37')],null);}return _0x13e294;})[_0x89c1('0x25')](respondWithResult(_0x52d865,null))['catch'](handleError(_0x52d865,null));};exports[_0x89c1('0x3c')]=function(_0x1f5c86,_0x564559){var _0x586642=_0x89c1('0x3d');var _0x1b01ec=path[_0x89c1('0x3e')](_0x89c1('0x3f'),_0x89c1('0x40'),_0x89c1('0x41'),_0x586642);_0x564559['setHeader'](_0x89c1('0x42'),_0x89c1('0x43')+_0x586642);_0x564559[_0x89c1('0x44')](_0x89c1('0x45'),'text/plain');_0x564559[_0x89c1('0x46')](_0x1b01ec);}; \ No newline at end of file +var _0xdf2d=['join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','stack','name','index','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','license-info.log'];(function(_0x243b99,_0x411584){var _0x382315=function(_0x1b3bfd){while(--_0x1b3bfd){_0x243b99['push'](_0x243b99['shift']());}};_0x382315(++_0x411584);}(_0xdf2d,0x1f4));var _0xddf2=function(_0x437a0e,_0x2957c3){_0x437a0e=_0x437a0e-0x0;var _0x19b47c=_0xdf2d[_0x437a0e];return _0x19b47c;};'use strict';var emlformat=require(_0xddf2('0x0'));var rimraf=require(_0xddf2('0x1'));var zipdir=require(_0xddf2('0x2'));var jsonpatch=require(_0xddf2('0x3'));var rp=require(_0xddf2('0x4'));var moment=require(_0xddf2('0x5'));var BPromise=require(_0xddf2('0x6'));var Mustache=require(_0xddf2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xddf2('0x8'));var csv=require(_0xddf2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddf2('0xa'));var _=require('lodash');var squel=require(_0xddf2('0xb'));var crypto=require(_0xddf2('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xddf2('0xd'));var Papa=require(_0xddf2('0xe'));var Redis=require('ioredis');var authService=require(_0xddf2('0xf'));var qs=require(_0xddf2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xddf2('0x11'))(_0xddf2('0x12'));var utils=require(_0xddf2('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xddf2('0x14'));var db=require(_0xddf2('0x15'))['db'];function respondWithStatusCode(_0x1373d6,_0x486436){_0x486436=_0x486436||0xcc;return function(_0x1d2b92){if(_0x1d2b92){return _0x1373d6[_0xddf2('0x16')](_0x486436);}return _0x1373d6[_0xddf2('0x17')](_0x486436)[_0xddf2('0x18')]();};}function respondWithResult(_0x309196,_0x2c7895){_0x2c7895=_0x2c7895||0xc8;return function(_0x196702){if(_0x196702){return _0x309196[_0xddf2('0x17')](_0x2c7895)[_0xddf2('0x19')](_0x196702);}};}function respondWithFilteredResult(_0x79338b,_0x212107){return function(_0x174fab){if(_0x174fab){var _0x3ab198=typeof _0x212107[_0xddf2('0x1a')]===_0xddf2('0x1b')&&typeof _0x212107[_0xddf2('0x1c')]===_0xddf2('0x1b');var _0x5b4841=_0x174fab[_0xddf2('0x1d')];var _0x39468b=_0x3ab198?0x0:_0x212107[_0xddf2('0x1a')];var _0x2286ea=_0x3ab198?_0x174fab[_0xddf2('0x1d')]:_0x212107['offset']+_0x212107[_0xddf2('0x1c')];var _0x3cf63b;if(_0x2286ea>=_0x5b4841){_0x2286ea=_0x5b4841;_0x3cf63b=0xc8;}else{_0x3cf63b=0xce;}_0x79338b['status'](_0x3cf63b);return _0x79338b[_0xddf2('0x1e')](_0xddf2('0x1f'),_0x39468b+'-'+_0x2286ea+'/'+_0x5b4841)[_0xddf2('0x19')](_0x174fab);}return null;};}function patchUpdates(_0x3f6335){return function(_0x1226f2){try{jsonpatch['apply'](_0x1226f2,_0x3f6335,!![]);}catch(_0x1cf642){return BPromise[_0xddf2('0x20')](_0x1cf642);}return _0x1226f2['save']();};}function saveUpdates(_0x486f80,_0x16c1a0){return function(_0x299ef0){if(_0x299ef0){return _0x299ef0['update'](_0x486f80)[_0xddf2('0x21')](function(_0x4233b2){return _0x4233b2;});}return null;};}function removeEntity(_0x50aeb0,_0x3e2a5f){return function(_0x19f3d4){if(_0x19f3d4){return _0x19f3d4[_0xddf2('0x22')]()[_0xddf2('0x21')](function(){_0x50aeb0[_0xddf2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13a027,_0x15b1ec){return function(_0x2c076b){if(!_0x2c076b){_0x13a027['sendStatus'](0x194);}return _0x2c076b;};}function handleError(_0x549736,_0x287fa4){_0x287fa4=_0x287fa4||0x1f4;return function(_0x5a7b38){logger['error'](_0x5a7b38[_0xddf2('0x23')]);if(_0x5a7b38['name']){delete _0x5a7b38[_0xddf2('0x24')];}_0x549736[_0xddf2('0x17')](_0x287fa4)['send'](_0x5a7b38);};}var utilLicense=require('../../config/license/util');exports[_0xddf2('0x25')]=function(_0x537815,_0xdb6f45){var _0x4b9afc={'raw':!![],'where':{'id':0x1}},_0x29cd32={};_0x29cd32[_0xddf2('0x26')]=_[_0xddf2('0x27')](db[_0xddf2('0x28')][_0xddf2('0x29')]);_0x29cd32[_0xddf2('0x2a')]=_[_0xddf2('0x27')](_0x537815['query']);_0x29cd32[_0xddf2('0x2b')]=_['intersection'](_0x29cd32[_0xddf2('0x26')],_0x29cd32['query']);_0x4b9afc[_0xddf2('0x2c')]=_[_0xddf2('0x2d')](_0x29cd32[_0xddf2('0x26')],qs['fields'](_0x537815['query'][_0xddf2('0x2e')]));_0x4b9afc['attributes']=_0x4b9afc[_0xddf2('0x2c')][_0xddf2('0x2f')]?_0x4b9afc[_0xddf2('0x2c')]:_0x29cd32['model'];_0x4b9afc=_[_0xddf2('0x30')]({},_0x4b9afc,_0x537815[_0xddf2('0x31')]);return utilLicense[_0xddf2('0x32')](_0x4b9afc)[_0xddf2('0x21')](respondWithResult(_0xdb6f45,null))[_0xddf2('0x33')](handleError(_0xdb6f45,null));};exports['update']=function(_0x43c8b7,_0x25c408){if(_0x43c8b7[_0xddf2('0x34')]['id']){delete _0x43c8b7['body']['id'];}return db[_0xddf2('0x28')][_0xddf2('0x35')]({'where':{'id':_0x43c8b7[_0xddf2('0x36')]['id']}})['then'](handleEntityNotFound(_0x25c408,null))[_0xddf2('0x21')](function(_0x51639d){var _0x148cdf=_0x51639d[_0xddf2('0x37')]({'plain':!![]});return utilLicense[_0xddf2('0x38')](_0x148cdf,_0x43c8b7[_0xddf2('0x34')][_0xddf2('0x39')]);})[_0xddf2('0x21')](function(_0x1096b0){if(!_0x1096b0[_0xddf2('0x3a')]){return saveUpdates(_0x43c8b7[_0xddf2('0x34')],null);}return _0x1096b0;})[_0xddf2('0x21')](respondWithResult(_0x25c408,null))['catch'](handleError(_0x25c408,null));};exports['downloadLogFile']=function(_0x142084,_0x24c118){var _0x13209f=_0xddf2('0x3b');var _0x54f807=path[_0xddf2('0x3c')](_0xddf2('0x3d'),_0xddf2('0x3e'),_0xddf2('0x3f'),_0x13209f);_0x24c118[_0xddf2('0x40')](_0xddf2('0x41'),_0xddf2('0x42')+_0x13209f);_0x24c118[_0xddf2('0x1e')](_0xddf2('0x43'),_0xddf2('0x44'));_0x24c118[_0xddf2('0x45')](_0x54f807);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 5f5df03..77712d2 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 _0xff2d=['./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x1f7972,_0x4794c1){var _0x3259f7=function(_0x8aa0ec){while(--_0x8aa0ec){_0x1f7972['push'](_0x1f7972['shift']());}};_0x3259f7(++_0x4794c1);}(_0xff2d,0x7a));var _0xdff2=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xff2d[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0xdff2('0x0'));var util=require(_0xdff2('0x1'));var logger=require(_0xdff2('0x2'))(_0xdff2('0x3'));var moment=require('moment');var BPromise=require(_0xdff2('0x4'));var rp=require(_0xdff2('0x5'));var fs=require('fs');var path=require(_0xdff2('0x6'));var rimraf=require('rimraf');var config=require(_0xdff2('0x7'));var attributes=require(_0xdff2('0x8'));module[_0xdff2('0x9')]=function(_0x51f3f9,_0x15d962){return _0x51f3f9[_0xdff2('0xa')](_0xdff2('0xb'),attributes,{'tableName':_0xdff2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1073=['rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x23402b,_0x421ac9){var _0x3a21c7=function(_0x3608ec){while(--_0x3608ec){_0x23402b['push'](_0x23402b['shift']());}};_0x3a21c7(++_0x421ac9);}(_0x1073,0x172));var _0x3107=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x1073[_0x2d486b];return _0x4291d1;};'use strict';var _=require(_0x3107('0x0'));var util=require(_0x3107('0x1'));var logger=require(_0x3107('0x2'))(_0x3107('0x3'));var moment=require(_0x3107('0x4'));var BPromise=require(_0x3107('0x5'));var rp=require(_0x3107('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3107('0x7'));var config=require(_0x3107('0x8'));var attributes=require(_0x3107('0x9'));module[_0x3107('0xa')]=function(_0x297eb0,_0x80bde0){return _0x297eb0[_0x3107('0xb')]('License',attributes,{'tableName':_0x3107('0xc'),'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 654eefd..02fa1c9 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 _0xade6=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x1b7df9,_0x4dec4b){var _0x3499b5=function(_0x4b6faf){while(--_0x4b6faf){_0x1b7df9['push'](_0x1b7df9['shift']());}};_0x3499b5(++_0x4dec4b);}(_0xade6,0xbb));var _0x6ade=function(_0x53b133,_0x176261){_0x53b133=_0x53b133-0x0;var _0x5647e0=_0xade6[_0x53b133];return _0x5647e0;};'use strict';var _=require('lodash');var util=require(_0x6ade('0x0'));var moment=require(_0x6ade('0x1'));var BPromise=require(_0x6ade('0x2'));var rs=require(_0x6ade('0x3'));var fs=require('fs');var Redis=require(_0x6ade('0x4'));var db=require(_0x6ade('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6ade('0x6'))(_0x6ade('0x7'));var config=require(_0x6ade('0x8'));var jayson=require(_0x6ade('0x9'));var client=jayson[_0x6ade('0xa')][_0x6ade('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x591f41,_0x191109,_0xe266e6){return new BPromise(function(_0x944bc5,_0x215412){return client[_0x6ade('0xc')](_0x591f41,_0xe266e6)[_0x6ade('0xd')](function(_0x534991){logger[_0x6ade('0xe')](_0x6ade('0xf'),_0x191109,_0x6ade('0x10'));logger[_0x6ade('0x11')]('License,\x20%s,\x20%s,\x20%s',_0x191109,_0x6ade('0x10'),JSON[_0x6ade('0x12')](_0x534991));if(_0x534991[_0x6ade('0x13')]){if(_0x534991[_0x6ade('0x13')][_0x6ade('0x14')]===0x1f4){logger['error'](_0x6ade('0xf'),_0x191109,_0x534991[_0x6ade('0x13')]['message']);return _0x215412(_0x534991['error'][_0x6ade('0x15')]);}logger[_0x6ade('0x13')]('License,\x20%s,\x20%s',_0x191109,_0x534991[_0x6ade('0x13')][_0x6ade('0x15')]);return _0x944bc5(_0x534991[_0x6ade('0x13')][_0x6ade('0x15')]);}else{logger[_0x6ade('0xe')](_0x6ade('0xf'),_0x191109,_0x6ade('0x10'));_0x944bc5(_0x534991[_0x6ade('0x16')][_0x6ade('0x15')]);}})[_0x6ade('0x17')](function(_0x58ac45){logger[_0x6ade('0x13')]('License,\x20%s,\x20%s',_0x191109,_0x58ac45);_0x215412(_0x58ac45);});});} \ No newline at end of file +var _0x305a=['error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','http','then','info','License,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x7f9eab,_0x34a043){var _0x2f17a4=function(_0x3af158){while(--_0x3af158){_0x7f9eab['push'](_0x7f9eab['shift']());}};_0x2f17a4(++_0x34a043);}(_0x305a,0x1b4));var _0xa305=function(_0x1dc821,_0x1f960f){_0x1dc821=_0x1dc821-0x0;var _0xeee19d=_0x305a[_0x1dc821];return _0xeee19d;};'use strict';var _=require(_0xa305('0x0'));var util=require('util');var moment=require(_0xa305('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa305('0x2'));var db=require(_0xa305('0x3'))['db'];var utils=require(_0xa305('0x4'));var logger=require('../../config/logger')(_0xa305('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa305('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4752c2,_0x1be17b,_0x490b5d){return new BPromise(function(_0x2d8668,_0x3319cf){return client['request'](_0x4752c2,_0x490b5d)[_0xa305('0x7')](function(_0x178c20){logger[_0xa305('0x8')](_0xa305('0x9'),_0x1be17b,_0xa305('0xa'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x1be17b,_0xa305('0xa'),JSON[_0xa305('0xb')](_0x178c20));if(_0x178c20[_0xa305('0xc')]){if(_0x178c20[_0xa305('0xc')][_0xa305('0xd')]===0x1f4){logger[_0xa305('0xc')](_0xa305('0x9'),_0x1be17b,_0x178c20[_0xa305('0xc')][_0xa305('0xe')]);return _0x3319cf(_0x178c20[_0xa305('0xc')][_0xa305('0xe')]);}logger[_0xa305('0xc')]('License,\x20%s,\x20%s',_0x1be17b,_0x178c20['error'][_0xa305('0xe')]);return _0x2d8668(_0x178c20[_0xa305('0xc')][_0xa305('0xe')]);}else{logger[_0xa305('0x8')]('License,\x20%s,\x20%s',_0x1be17b,_0xa305('0xa'));_0x2d8668(_0x178c20['result'][_0xa305('0xe')]);}})[_0xa305('0xf')](function(_0x3eb0c5){logger[_0xa305('0xc')](_0xa305('0x9'),_0x1be17b,_0x3eb0c5);_0x3319cf(_0x3eb0c5);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 1a87f25..9b8f6e4 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 _0xed13=['addInteraction','addApplications','/:id/send','addAgents','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addImap','addSmtp'];(function(_0x3fe1ba,_0x1a33c5){var _0x5df1b4=function(_0x55d7c3){while(--_0x55d7c3){_0x3fe1ba['push'](_0x3fe1ba['shift']());}};_0x5df1b4(++_0x1a33c5);}(_0xed13,0x198));var _0x3ed1=function(_0x21b200,_0xfce4eb){_0x21b200=_0x21b200-0x0;var _0x399a96=_0xed13[_0x21b200];return _0x399a96;};'use strict';var multer=require('multer');var util=require(_0x3ed1('0x0'));var path=require(_0x3ed1('0x1'));var timeout=require('connect-timeout');var express=require(_0x3ed1('0x2'));var router=express[_0x3ed1('0x3')]();var fs_extra=require(_0x3ed1('0x4'));var auth=require(_0x3ed1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3ed1('0x6'));var controller=require(_0x3ed1('0x7'));router['get']('/',auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x9')]);router[_0x3ed1('0xa')]('/describe',auth[_0x3ed1('0x8')](),controller[_0x3ed1('0xb')]);router['get'](_0x3ed1('0xc'),auth[_0x3ed1('0x8')](),controller[_0x3ed1('0xd')]);router[_0x3ed1('0xa')](_0x3ed1('0xe'),auth[_0x3ed1('0x8')](),controller[_0x3ed1('0xf')]);router[_0x3ed1('0xa')](_0x3ed1('0x10'),auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x11')]);router[_0x3ed1('0xa')](_0x3ed1('0x12'),auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x13')]);router[_0x3ed1('0xa')](_0x3ed1('0x14'),auth[_0x3ed1('0x8')](),controller['getSmtp']);router[_0x3ed1('0xa')](_0x3ed1('0x15'),auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x16')]);router[_0x3ed1('0xa')](_0x3ed1('0x17'),auth[_0x3ed1('0x8')](),controller['getApplications']);router[_0x3ed1('0xa')](_0x3ed1('0x18'),auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x19')]);router[_0x3ed1('0xa')]('/:id/verify',auth['isAuthenticated'](),controller['verifySmtp']);router[_0x3ed1('0xa')](_0x3ed1('0x1a'),auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x1b')]);router[_0x3ed1('0x1c')](_0x3ed1('0xe'),auth[_0x3ed1('0x8')](),controller['addDisposition']);router[_0x3ed1('0x1c')](_0x3ed1('0x10'),auth[_0x3ed1('0x8')](),controller['addAnswer']);router[_0x3ed1('0x1c')]('/',auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x1d')]);router[_0x3ed1('0x1c')](_0x3ed1('0x12'),auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x1e')]);router[_0x3ed1('0x1c')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x3ed1('0x1f')]);router[_0x3ed1('0x1c')]('/:id/interactions',auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x20')]);router[_0x3ed1('0x1c')](_0x3ed1('0x17'),auth['isAuthenticated'](),controller[_0x3ed1('0x21')]);router['post'](_0x3ed1('0x22'),auth[_0x3ed1('0x8')](),controller['send']);router[_0x3ed1('0x1c')]('/:id/users',auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x23')]);router['put'](_0x3ed1('0xc'),auth[_0x3ed1('0x8')](),controller['update']);router[_0x3ed1('0x24')](_0x3ed1('0xe'),auth['isAuthenticated'](),controller[_0x3ed1('0x25')]);router[_0x3ed1('0x24')](_0x3ed1('0x10'),auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x26')]);router[_0x3ed1('0x24')]('/:id/in_servers',auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x27')]);router[_0x3ed1('0x24')](_0x3ed1('0x14'),auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x28')]);router[_0x3ed1('0x24')]('/:id',auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x29')]);router[_0x3ed1('0x24')](_0x3ed1('0x1a'),auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x2a')]);module[_0x3ed1('0x2b')]=router; \ No newline at end of file +var _0xcd89=['./mailAccount.controller','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','/:id/interactions','addInteraction','addApplications','/:id/send','send','put','update','delete','/:id/canned_answers','removeImap','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xcd89,0x77));var _0x9cd8=function(_0xb2b3ae,_0x5f186d){_0xb2b3ae=_0xb2b3ae-0x0;var _0x2e18a3=_0xcd89[_0xb2b3ae];return _0x2e18a3;};'use strict';var multer=require(_0x9cd8('0x0'));var util=require(_0x9cd8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cd8('0x2')]();var fs_extra=require(_0x9cd8('0x3'));var auth=require(_0x9cd8('0x4'));var interaction=require(_0x9cd8('0x5'));var config=require(_0x9cd8('0x6'));var controller=require(_0x9cd8('0x7'));router[_0x9cd8('0x8')]('/',auth[_0x9cd8('0x9')](),controller['index']);router[_0x9cd8('0x8')](_0x9cd8('0xa'),auth[_0x9cd8('0x9')](),controller['describe']);router[_0x9cd8('0x8')](_0x9cd8('0xb'),auth[_0x9cd8('0x9')](),controller[_0x9cd8('0xc')]);router['get'](_0x9cd8('0xd'),auth[_0x9cd8('0x9')](),controller['getDispositions']);router[_0x9cd8('0x8')]('/:id/canned_answers',auth[_0x9cd8('0x9')](),controller[_0x9cd8('0xe')]);router[_0x9cd8('0x8')](_0x9cd8('0xf'),auth[_0x9cd8('0x9')](),controller[_0x9cd8('0x10')]);router[_0x9cd8('0x8')](_0x9cd8('0x11'),auth[_0x9cd8('0x9')](),controller[_0x9cd8('0x12')]);router[_0x9cd8('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x9cd8('0x13')]);router['get'](_0x9cd8('0x14'),auth[_0x9cd8('0x9')](),controller[_0x9cd8('0x15')]);router[_0x9cd8('0x8')](_0x9cd8('0x16'),auth[_0x9cd8('0x9')](),controller['getMessages']);router[_0x9cd8('0x8')]('/:id/verify',auth[_0x9cd8('0x9')](),controller[_0x9cd8('0x17')]);router[_0x9cd8('0x8')](_0x9cd8('0x18'),auth['isAuthenticated'](),controller[_0x9cd8('0x19')]);router[_0x9cd8('0x1a')](_0x9cd8('0xd'),auth[_0x9cd8('0x9')](),controller[_0x9cd8('0x1b')]);router['post']('/:id/canned_answers',auth[_0x9cd8('0x9')](),controller[_0x9cd8('0x1c')]);router['post']('/',auth[_0x9cd8('0x9')](),controller[_0x9cd8('0x1d')]);router[_0x9cd8('0x1a')](_0x9cd8('0xf'),auth['isAuthenticated'](),controller['addImap']);router[_0x9cd8('0x1a')](_0x9cd8('0x11'),auth[_0x9cd8('0x9')](),controller['addSmtp']);router[_0x9cd8('0x1a')](_0x9cd8('0x1e'),auth[_0x9cd8('0x9')](),controller[_0x9cd8('0x1f')]);router[_0x9cd8('0x1a')](_0x9cd8('0x14'),auth['isAuthenticated'](),controller[_0x9cd8('0x20')]);router[_0x9cd8('0x1a')](_0x9cd8('0x21'),auth['isAuthenticated'](),controller[_0x9cd8('0x22')]);router[_0x9cd8('0x1a')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x9cd8('0x23')](_0x9cd8('0xb'),auth[_0x9cd8('0x9')](),controller[_0x9cd8('0x24')]);router[_0x9cd8('0x25')](_0x9cd8('0xd'),auth[_0x9cd8('0x9')](),controller['removeDispositions']);router[_0x9cd8('0x25')](_0x9cd8('0x26'),auth[_0x9cd8('0x9')](),controller['removeAnswers']);router[_0x9cd8('0x25')](_0x9cd8('0xf'),auth[_0x9cd8('0x9')](),controller[_0x9cd8('0x27')]);router[_0x9cd8('0x25')](_0x9cd8('0x11'),auth[_0x9cd8('0x9')](),controller['removeSmtp']);router['delete'](_0x9cd8('0xb'),auth[_0x9cd8('0x9')](),controller[_0x9cd8('0x28')]);router[_0x9cd8('0x25')](_0x9cd8('0x18'),auth[_0x9cd8('0x9')](),controller['removeAgents']);module[_0x9cd8('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index ed7f0ee..88b7897 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 _0xb4b5=['sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','provider','custom','getDataValue'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb4b5,0x1cc));var _0x5b4b=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xb4b5[_0x3e2fcf];return _0x497db7;};'use strict';var Sequelize=require(_0x5b4b('0x0'));module[_0x5b4b('0x1')]={'description':{'type':Sequelize[_0x5b4b('0x2')]},'name':{'type':Sequelize[_0x5b4b('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x5b4b('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x5b4b('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x5b4b('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x5b4b('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x5b4b('0x2')],'allowNull':![],'defaultValue':_0x5b4b('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x5b4b('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5b4b('0x6')],'defaultValue':function(){return _0x5b4b('0x7');}},'notificationSound':{'type':Sequelize[_0x5b4b('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5b4b('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5b4b('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5b4b('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5b4b('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5b4b('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1c1660){if(!_0x1c1660)this[_0x5b4b('0x9')](_0x5b4b('0xa'),null);this[_0x5b4b('0x9')](_0x5b4b('0xb'),_0x1c1660);}},'provider':{'type':Sequelize[_0x5b4b('0xc')](_0x5b4b('0xd'),_0x5b4b('0xe'),_0x5b4b('0xf'),_0x5b4b('0x10')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x5b4b('0x11')))return _0x5b4b('0x12');return this[_0x5b4b('0x13')](_0x5b4b('0x11'));},'set':function(_0x28a728){if(_0x28a728===_0x5b4b('0x12'))_0x28a728=null;return this[_0x5b4b('0x9')](_0x5b4b('0x11'),_0x28a728);}}}; \ No newline at end of file +var _0xc51f=['BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','getDataValue','provider','custom','sequelize','STRING'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0xc51f,0x8e));var _0xfc51=function(_0x1e8bea,_0x47bde9){_0x1e8bea=_0x1e8bea-0x0;var _0x29f756=_0xc51f[_0x1e8bea];return _0x29f756;};'use strict';var Sequelize=require(_0xfc51('0x0'));module['exports']={'description':{'type':Sequelize[_0xfc51('0x1')]},'name':{'type':Sequelize[_0xfc51('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xfc51('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xfc51('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xfc51('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xfc51('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xfc51('0x3')]},'markAsUnread':{'type':Sequelize[_0xfc51('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xfc51('0x1')],'allowNull':![],'defaultValue':_0xfc51('0x4')},'fontSize':{'type':Sequelize[_0xfc51('0x5')](0x2)[_0xfc51('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xfc51('0x3')],'defaultValue':function(){return _0xfc51('0x7');}},'notificationSound':{'type':Sequelize[_0xfc51('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfc51('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfc51('0x5')],'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[_0xfc51('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfc51('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfc51('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfc51('0x8'),'set':function(_0x337af8){if(!_0x337af8)this[_0xfc51('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xfc51('0xa'),_0x337af8);}},'provider':{'type':Sequelize[_0xfc51('0xb')](_0xfc51('0xc'),'hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this[_0xfc51('0xd')](_0xfc51('0xe')))return _0xfc51('0xf');return this[_0xfc51('0xd')]('provider');},'set':function(_0x345988){if(_0x345988===_0xfc51('0xf'))_0x345988=null;return this[_0xfc51('0x9')](_0xfc51('0xe'),_0x345988);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index e0e5c69..8650aee 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 _0x1043=['rows','show','params','rawAttributes','find','body','provider','custom','Mail\x20Account\x20not\x20found','update','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','include','removeDispositions','ids','addAnswer','CannedAnswer','order','removeAnswers','key','email','ListId','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','removeSmtp','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','Contacts','updatedAt','DESC','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','CloudProvider','ValidationError','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','juice','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','./mailAccount.socket','register','http','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','destroy','get','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','secure','service','authentication','Imap','host','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x4972ef,_0x4c0ef2){var _0x1005b1=function(_0x13d1d7){while(--_0x13d1d7){_0x4972ef['push'](_0x4972ef['shift']());}};_0x1005b1(++_0x4c0ef2);}(_0x1043,0x123));var _0x3104=function(_0x37c70e,_0x4f3427){_0x37c70e=_0x37c70e-0x0;var _0x18dc99=_0x1043[_0x37c70e];return _0x18dc99;};'use strict';var moment=require(_0x3104('0x0'));var BPromise=require(_0x3104('0x1'));var util=require(_0x3104('0x2'));var path=require(_0x3104('0x3'));var _=require('lodash');var juice=require(_0x3104('0x4'));var Redis=require(_0x3104('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x3104('0x6'))(_0x3104('0x7'));var config=require(_0x3104('0x8'));var db=require('../../mysqldb')['db'];config[_0x3104('0x9')]=_[_0x3104('0xa')](config[_0x3104('0x9')],{'host':_0x3104('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3104('0x9')]));require(_0x3104('0xc'))[_0x3104('0xd')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x3104('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x5a36f5,_0x5f41c4,_0x455802,_0xe6dd62){return new BPromise(function(_0x3d9764,_0x29bf69){var _0x36d80c=_0xe6dd62||client;return _0x36d80c['request'](_0x5a36f5,_0x455802)[_0x3104('0xf')](function(_0x526ff5){logger['info'](_0x3104('0x10'),_0x5f41c4,_0x3104('0x11'));logger['debug'](_0x3104('0x12'),_0x5f41c4,_0x3104('0x11'),JSON[_0x3104('0x13')](_0x526ff5));if(_0x526ff5[_0x3104('0x14')]){if(_0x526ff5[_0x3104('0x14')][_0x3104('0x15')]===0x1f4){logger[_0x3104('0x14')](_0x3104('0x10'),_0x5f41c4,_0x526ff5[_0x3104('0x14')]['message']);return _0x29bf69(_0x526ff5['error']['message']);}logger[_0x3104('0x14')](_0x3104('0x10'),_0x5f41c4,_0x526ff5['error'][_0x3104('0x16')]);return _0x3d9764(_0x526ff5[_0x3104('0x14')][_0x3104('0x16')]);}else{logger[_0x3104('0x17')]('MailAccount,\x20%s,\x20%s',_0x5f41c4,_0x3104('0x11'));_0x3d9764(_0x526ff5[_0x3104('0x18')][_0x3104('0x16')]);}})[_0x3104('0x19')](function(_0xdf3095){logger[_0x3104('0x14')](_0x3104('0x10'),_0x5f41c4,_0xdf3095);_0x29bf69(_0xdf3095);});});}function respondWithStatusCode(_0x11896c,_0x4a1ada){_0x4a1ada=_0x4a1ada||0xcc;return function(_0x41a9fe){if(_0x41a9fe){return _0x11896c[_0x3104('0x1a')](_0x4a1ada);}return _0x11896c[_0x3104('0x1b')](_0x4a1ada)[_0x3104('0x1c')]();};}function respondWithResult(_0x8ec9b9,_0x433ff4){_0x433ff4=_0x433ff4||0xc8;return function(_0x59b247){if(_0x59b247){return _0x8ec9b9[_0x3104('0x1b')](_0x433ff4)[_0x3104('0x1d')](_0x59b247);}};}function respondWithFilteredResult(_0x12cce6,_0x5787c1){return function(_0x2c07a1){if(_0x2c07a1){var _0x3ee5a4=typeof _0x5787c1['offset']===_0x3104('0x1e')&&typeof _0x5787c1[_0x3104('0x1f')]===_0x3104('0x1e');var _0x44bfac=_0x2c07a1[_0x3104('0x20')];var _0x4d250d=_0x3ee5a4?0x0:_0x5787c1[_0x3104('0x21')];var _0x1244e5=_0x3ee5a4?_0x2c07a1[_0x3104('0x20')]:_0x5787c1['offset']+_0x5787c1[_0x3104('0x1f')];var _0x33f28b;if(_0x1244e5>=_0x44bfac){_0x1244e5=_0x44bfac;_0x33f28b=0xc8;}else{_0x33f28b=0xce;}_0x12cce6['status'](_0x33f28b);return _0x12cce6[_0x3104('0x22')](_0x3104('0x23'),_0x4d250d+'-'+_0x1244e5+'/'+_0x44bfac)[_0x3104('0x1d')](_0x2c07a1);}return null;};}function saveUpdates(_0x1a8383){return function(_0x3ada26){if(_0x3ada26){return _0x3ada26['update'](_0x1a8383)[_0x3104('0xf')](function(_0xe253b2){return _0xe253b2;});}return null;};}function removeEntity(_0x5b1894){return function(_0x47a6f4){if(_0x47a6f4){return _0x47a6f4[_0x3104('0x24')]()['then'](function(){var _0x239dc7=_0x47a6f4[_0x3104('0x25')]({'plain':!![]});var _0x4ddaef=_0x3104('0x26');return db['UserProfileResource'][_0x3104('0x24')]({'where':{'type':_0x4ddaef,'resourceId':_0x239dc7['id']}})[_0x3104('0xf')](function(){return _0x47a6f4;});})['then'](function(){_0x5b1894['status'](0xcc)[_0x3104('0x1c')]();});}};}function handleEntityNotFound(_0x34d498){return function(_0x47ab52){if(!_0x47ab52){_0x34d498['sendStatus'](0x194);}return _0x47ab52;};}function handleError(_0x46612f,_0x1257cc){_0x1257cc=_0x1257cc||0x1f4;return function(_0xe8afd4){logger[_0x3104('0x14')](_0xe8afd4[_0x3104('0x27')]);if(_0xe8afd4[_0x3104('0x28')]){delete _0xe8afd4[_0x3104('0x28')];}_0x46612f[_0x3104('0x1b')](_0x1257cc)[_0x3104('0x29')](_0xe8afd4);};}function getImapHost(_0x1fbc6a){switch(_0x1fbc6a){case _0x3104('0x2a'):return _0x3104('0x2b');case _0x3104('0x2c'):return'imap.mail.yahoo.com';case _0x3104('0x2d'):return _0x3104('0x2e');case'outlook365':return _0x3104('0x2f');}throw new Error(_0x3104('0x30'),_0x1fbc6a);}function getSmtpHost(_0x131147){switch(_0x131147){case _0x3104('0x2a'):return _0x3104('0x31');case _0x3104('0x2c'):return _0x3104('0x32');case _0x3104('0x2d'):return _0x3104('0x33');case _0x3104('0x34'):return _0x3104('0x35');}throw new Error(_0x3104('0x30'),_0x131147);}function getAuthenticationOptions(_0x42ad14,_0x46d6e9){var _0x5e3271={};var _0x27ead0={};if(_0x42ad14){_0x5e3271['user']=_0x27ead0[_0x3104('0x36')]=_0x46d6e9[_0x3104('0x37')];_0x5e3271[_0x3104('0x38')]=_0x27ead0[_0x3104('0x39')]=_0x46d6e9['password'];if(_0x46d6e9['modernAuthentication']){_0x5e3271['modernAuthentication']=_0x27ead0[_0x3104('0x3a')]=!![];_0x5e3271[_0x3104('0x3b')]=_0x27ead0[_0x3104('0x3b')]=_0x46d6e9[_0x3104('0x3b')];_0x5e3271['password']=_0x27ead0[_0x3104('0x39')]=null;}else{_0x5e3271[_0x3104('0x3b')]=_0x27ead0[_0x3104('0x3b')]=null;}_0x5e3271['host']=getImapHost(_0x42ad14);_0x5e3271[_0x3104('0x3c')]=0x3e1;_0x27ead0['host']=getSmtpHost(_0x42ad14);_0x27ead0['port']=0x24b;_0x27ead0[_0x3104('0x3d')]=![];_0x5e3271[_0x3104('0x3e')]=_0x27ead0['service']=null;}else{if(_0x46d6e9[_0x3104('0x3f')]){_0x5e3271['user']=_0x27ead0[_0x3104('0x36')]=_0x46d6e9['username'];_0x5e3271[_0x3104('0x38')]=_0x27ead0[_0x3104('0x39')]=_0x46d6e9[_0x3104('0x38')];}else{_0x5e3271[_0x3104('0x3f')]=_0x27ead0[_0x3104('0x3f')]=![];_0x5e3271[_0x3104('0x36')]=_0x27ead0[_0x3104('0x36')]=null;_0x5e3271[_0x3104('0x38')]=_0x27ead0['pass']=null;}_0x5e3271['host']=_0x46d6e9['Imap']['host'];_0x5e3271[_0x3104('0x3c')]=_0x46d6e9[_0x3104('0x40')]['port'];_0x27ead0[_0x3104('0x41')]=_0x46d6e9[_0x3104('0x42')][_0x3104('0x41')];_0x27ead0[_0x3104('0x3c')]=_0x46d6e9[_0x3104('0x42')]['port'];}return{'Imap':_0x5e3271,'Smtp':_0x27ead0};}exports[_0x3104('0x43')]=function(_0x29792f,_0x2672ea){var _0x39d848={'include':[{'model':db[_0x3104('0x44')],'as':_0x3104('0x40')},{'model':db[_0x3104('0x45')],'as':_0x3104('0x42')},{'model':db[_0x3104('0x46')],'as':_0x3104('0x47')}]},_0xc08153={},_0x3c4d02={'count':0x0,'rows':[]};var _0x428e1e=_[_0x3104('0x48')](db[_0x3104('0x49')]['rawAttributes'],function(_0x547fbb){return{'name':_0x547fbb['fieldName'],'type':_0x547fbb['type']['key']};});_0xc08153[_0x3104('0x4a')]=_['map'](_0x428e1e,'name');_0xc08153[_0x3104('0x4b')]=_[_0x3104('0x4c')](_0x29792f['query']);_0xc08153[_0x3104('0x4d')]=_[_0x3104('0x4e')](_0xc08153['model'],_0xc08153['query']);_0x39d848[_0x3104('0x4f')]=_[_0x3104('0x4e')](_0xc08153[_0x3104('0x4a')],qs[_0x3104('0x50')](_0x29792f[_0x3104('0x4b')]['fields']));_0x39d848[_0x3104('0x4f')]=_0x39d848[_0x3104('0x4f')][_0x3104('0x51')]?_0x39d848['attributes']:_0xc08153[_0x3104('0x4a')];if(!_0x29792f['query'][_0x3104('0x52')](_0x3104('0x53'))){_0x39d848[_0x3104('0x1f')]=qs[_0x3104('0x1f')](_0x29792f['query'][_0x3104('0x1f')]);_0x39d848['offset']=qs[_0x3104('0x21')](_0x29792f[_0x3104('0x4b')][_0x3104('0x21')]);}_0x39d848['order']=qs[_0x3104('0x54')](_0x29792f[_0x3104('0x4b')][_0x3104('0x54')]);_0x39d848[_0x3104('0x55')]=qs[_0x3104('0x4d')](_[_0x3104('0x56')](_0x29792f['query'],_0xc08153['filters']),_0x428e1e);if(_0x29792f['query'][_0x3104('0x57')]){_0x39d848[_0x3104('0x55')]=_[_0x3104('0x58')](_0x39d848[_0x3104('0x55')],{'$or':_[_0x3104('0x48')](_0x428e1e,function(_0x5f4df8){if(_0x5f4df8['type']!==_0x3104('0x59')){var _0x5fc62d={};_0x5fc62d[_0x5f4df8[_0x3104('0x28')]]={'$like':'%'+_0x29792f[_0x3104('0x4b')][_0x3104('0x57')]+'%'};return _0x5fc62d;}})});}_0x39d848=_[_0x3104('0x58')]({},_0x39d848,_0x29792f[_0x3104('0x5a')]);var _0x22d8b2={'where':_0x39d848[_0x3104('0x55')]};return db[_0x3104('0x49')][_0x3104('0x20')](_0x22d8b2)[_0x3104('0xf')](function(_0x16dffc){_0x3c4d02[_0x3104('0x20')]=_0x16dffc;if(_0x29792f['query'][_0x3104('0x5b')]){_0x39d848['include']=[{'all':!![]}];}return db[_0x3104('0x49')][_0x3104('0x5c')](_0x39d848);})['then'](function(_0x18ebbc){_0x3c4d02[_0x3104('0x5d')]=_0x18ebbc;return _0x3c4d02;})[_0x3104('0xf')](respondWithFilteredResult(_0x2672ea,_0x39d848))[_0x3104('0x19')](handleError(_0x2672ea,null));};exports[_0x3104('0x5e')]=function(_0x1b690e,_0x27cea9){var _0x418317={'raw':![],'where':{'id':_0x1b690e[_0x3104('0x5f')]['id']},'include':[{'model':db[_0x3104('0x44')],'as':_0x3104('0x40')},{'model':db[_0x3104('0x45')],'as':_0x3104('0x42')},{'model':db[_0x3104('0x46')],'as':'mandatoryDispositionPause'}]},_0x2e1d70={};_0x2e1d70[_0x3104('0x4a')]=_[_0x3104('0x4c')](db[_0x3104('0x49')][_0x3104('0x60')]);_0x2e1d70[_0x3104('0x4b')]=_[_0x3104('0x4c')](_0x1b690e[_0x3104('0x4b')]);_0x2e1d70[_0x3104('0x4d')]=_[_0x3104('0x4e')](_0x2e1d70[_0x3104('0x4a')],_0x2e1d70[_0x3104('0x4b')]);_0x418317[_0x3104('0x4f')]=_[_0x3104('0x4e')](_0x2e1d70[_0x3104('0x4a')],qs[_0x3104('0x50')](_0x1b690e[_0x3104('0x4b')][_0x3104('0x50')]));_0x418317[_0x3104('0x4f')]=_0x418317[_0x3104('0x4f')][_0x3104('0x51')]?_0x418317['attributes']:_0x2e1d70[_0x3104('0x4a')];if(_0x1b690e['query'][_0x3104('0x5b')]){_0x418317['include']=[{'all':!![]}];}_0x418317=_[_0x3104('0x58')]({},_0x418317,_0x1b690e[_0x3104('0x5a')]);return db[_0x3104('0x49')][_0x3104('0x61')](_0x418317)[_0x3104('0xf')](handleEntityNotFound(_0x27cea9,null))[_0x3104('0xf')](respondWithResult(_0x27cea9,null))['catch'](handleError(_0x27cea9,null));};exports['update']=function(_0x3c2db4,_0xf58bea){if(_0x3c2db4[_0x3104('0x62')]['id']){delete _0x3c2db4[_0x3104('0x62')]['id'];}var _0x3b178f=_0x3c2db4[_0x3104('0x62')][_0x3104('0x63')]===_0x3104('0x64')?null:_0x3c2db4[_0x3104('0x62')]['provider'];var _0x5005d5=_0x3c2db4['body'][_0x3104('0x40')]||{};var _0x130d7c=_0x3c2db4[_0x3104('0x62')][_0x3104('0x42')]||{};if(_0x3b178f){_0x5005d5['host']=getImapHost(_0x3b178f);_0x5005d5[_0x3104('0x3c')]=0x3e1;_0x130d7c[_0x3104('0x41')]=getSmtpHost(_0x3b178f);_0x130d7c['port']=0x24b;_0x130d7c[_0x3104('0x3d')]=![];}if(_0x130d7c['modernAuthentication']){_0x130d7c[_0x3104('0x3d')]=![];}else{_0x130d7c['CloudProviderId']=null;}if(!_0x5005d5['modernAuthentication'])_0x5005d5[_0x3104('0x3b')]=null;_0x3c2db4[_0x3104('0x62')][_0x3104('0x40')]=_0x5005d5;_0x3c2db4[_0x3104('0x62')][_0x3104('0x42')]=_0x130d7c;return db[_0x3104('0x49')][_0x3104('0x61')]({'where':{'id':_0x3c2db4['params']['id']},'include':[{'model':db[_0x3104('0x44')],'as':_0x3104('0x40')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x3104('0x46')],'as':_0x3104('0x47')}]})[_0x3104('0xf')](handleEntityNotFound(_0xf58bea,null))[_0x3104('0xf')](function(_0x5301f7){if(!_0x5301f7)throw new Error(_0x3104('0x65'));if(_0x5301f7[_0x3104('0x3e')])delete _0x3c2db4[_0x3104('0x62')][_0x3104('0x40')];return _0x5301f7;})[_0x3104('0xf')](saveUpdates(_0x3c2db4[_0x3104('0x62')],null))[_0x3104('0xf')](function(_0x3af4c4){if(!_0x3c2db4[_0x3104('0x62')][_0x3104('0x40')])return _0x3af4c4;return db['MailServerIn'][_0x3104('0x66')](_0x3c2db4['body'][_0x3104('0x40')],{'where':{'MailAccountId':_0x3af4c4['id']}})['then'](function(){return _0x3af4c4;});})[_0x3104('0xf')](function(_0x18c79c){if(!_0x3c2db4[_0x3104('0x62')]['Smtp'])return _0x18c79c;return db[_0x3104('0x45')]['update'](_0x3c2db4[_0x3104('0x62')]['Smtp'],{'where':{'MailAccountId':_0x18c79c['id']}})[_0x3104('0xf')](function(){return _0x18c79c;});})['then'](respondWithResult(_0xf58bea,null))[_0x3104('0x19')](handleError(_0xf58bea,null));};exports[_0x3104('0x67')]=function(_0x29fff8,_0x3649ed){return db[_0x3104('0x49')]['describe']()[_0x3104('0xf')](respondWithResult(_0x3649ed,null))['catch'](handleError(_0x3649ed,null));};exports[_0x3104('0x68')]=function(_0x24b00f,_0x2d5315){if(_0x24b00f[_0x3104('0x62')]['id']){delete _0x24b00f['body']['id'];}return db[_0x3104('0x49')][_0x3104('0x61')]({'where':{'id':_0x24b00f[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x2d5315,null))['then'](function(_0x4f064a){if(_0x4f064a){_0x24b00f[_0x3104('0x62')][_0x3104('0x69')]=_0x4f064a['id'];return db[_0x3104('0x6a')][_0x3104('0x6b')](_0x24b00f[_0x3104('0x62')]);}})[_0x3104('0xf')](respondWithResult(_0x2d5315,null))[_0x3104('0x19')](handleError(_0x2d5315,null));};exports[_0x3104('0x6c')]=function(_0x30581e,_0x17520f){var _0x5935bb={'raw':![],'where':{}};var _0x5a168d={};var _0x407dda={'count':0x0,'rows':[]};return db[_0x3104('0x49')][_0x3104('0x6d')]({'where':{'id':_0x30581e['params']['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x17520f,null))['then'](function(_0x49bd8a){if(_0x49bd8a){_0x5a168d['model']=_[_0x3104('0x4c')](db['Disposition'][_0x3104('0x60')]);_0x5a168d[_0x3104('0x4b')]=_[_0x3104('0x4c')](_0x30581e['query']);_0x5a168d[_0x3104('0x4d')]=_['intersection'](_0x5a168d[_0x3104('0x4a')],_0x5a168d[_0x3104('0x4b')]);_0x5935bb[_0x3104('0x4f')]=_['intersection'](_0x5a168d[_0x3104('0x4a')],qs[_0x3104('0x50')](_0x30581e[_0x3104('0x4b')][_0x3104('0x50')]));_0x5935bb['attributes']=_0x5935bb[_0x3104('0x4f')][_0x3104('0x51')]?_0x5935bb['attributes']:_0x5a168d[_0x3104('0x4a')];if(!_0x30581e[_0x3104('0x4b')][_0x3104('0x52')](_0x3104('0x53'))){_0x5935bb['limit']=qs[_0x3104('0x1f')](_0x30581e[_0x3104('0x4b')]['limit']);_0x5935bb[_0x3104('0x21')]=qs[_0x3104('0x21')](_0x30581e[_0x3104('0x4b')][_0x3104('0x21')]);}_0x5935bb['order']=qs[_0x3104('0x54')](_0x30581e[_0x3104('0x4b')][_0x3104('0x54')]);_0x5935bb[_0x3104('0x55')]=qs[_0x3104('0x4d')](_[_0x3104('0x56')](_0x30581e['query'],_0x5a168d['filters']));_0x5935bb[_0x3104('0x55')][_0x3104('0x69')]=_0x49bd8a['id'];if(_0x30581e[_0x3104('0x4b')]['filter']){_0x5935bb['where']=_['merge'](_0x5935bb[_0x3104('0x55')],{'$or':_[_0x3104('0x48')](_0x5935bb['attributes'],function(_0x3e6465){var _0xb2114d={};_0xb2114d[_0x3e6465]={'$like':'%'+_0x30581e['query'][_0x3104('0x57')]+'%'};return _0xb2114d;})});}_0x5935bb=_['merge']({},_0x5935bb,_0x30581e[_0x3104('0x5a')]);return db['Disposition'][_0x3104('0x20')]({'where':_0x5935bb[_0x3104('0x55')]})[_0x3104('0xf')](function(_0x4fcc92){_0x407dda['count']=_0x4fcc92;if(_0x30581e[_0x3104('0x4b')][_0x3104('0x5b')]){_0x5935bb[_0x3104('0x6e')]=[{'all':!![]}];}return db[_0x3104('0x6a')][_0x3104('0x5c')](_0x5935bb);})[_0x3104('0xf')](function(_0x514e9a){_0x407dda['rows']=_0x514e9a;return _0x407dda;});}})[_0x3104('0xf')](respondWithFilteredResult(_0x17520f,_0x5935bb))['catch'](handleError(_0x17520f,null));};exports[_0x3104('0x6f')]=function(_0xa515de,_0x3915af){return db[_0x3104('0x49')][_0x3104('0x61')]({'where':{'id':_0xa515de[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x3915af,null))[_0x3104('0xf')](function(_0x39fb7d){if(_0x39fb7d){return _0x39fb7d[_0x3104('0x6f')](_0xa515de[_0x3104('0x4b')][_0x3104('0x70')]);}})[_0x3104('0xf')](respondWithStatusCode(_0x3915af,null))[_0x3104('0x19')](handleError(_0x3915af,null));};exports[_0x3104('0x71')]=function(_0x571bea,_0x5913c5){if(_0x571bea[_0x3104('0x62')]['id']){delete _0x571bea[_0x3104('0x62')]['id'];}return db[_0x3104('0x49')][_0x3104('0x61')]({'where':{'id':_0x571bea[_0x3104('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5913c5,null))[_0x3104('0xf')](function(_0x35eb69){if(_0x35eb69){_0x571bea[_0x3104('0x62')][_0x3104('0x69')]=_0x35eb69['id'];return db[_0x3104('0x72')]['create'](_0x571bea['body']);}})['then'](respondWithResult(_0x5913c5,null))[_0x3104('0x19')](handleError(_0x5913c5,null));};exports['getAnswers']=function(_0x32fb34,_0x211a35){var _0x3f0c25={'raw':![],'where':{}};var _0x520fe6={};var _0x1a5823={'count':0x0,'rows':[]};return db[_0x3104('0x49')][_0x3104('0x6d')]({'where':{'id':_0x32fb34[_0x3104('0x5f')]['id']}})['then'](handleEntityNotFound(_0x211a35,null))[_0x3104('0xf')](function(_0x21eb4e){if(_0x21eb4e){_0x520fe6[_0x3104('0x4a')]=_[_0x3104('0x4c')](db['CannedAnswer'][_0x3104('0x60')]);_0x520fe6['query']=_[_0x3104('0x4c')](_0x32fb34[_0x3104('0x4b')]);_0x520fe6[_0x3104('0x4d')]=_['intersection'](_0x520fe6[_0x3104('0x4a')],_0x520fe6[_0x3104('0x4b')]);_0x3f0c25['attributes']=_[_0x3104('0x4e')](_0x520fe6['model'],qs[_0x3104('0x50')](_0x32fb34[_0x3104('0x4b')]['fields']));_0x3f0c25[_0x3104('0x4f')]=_0x3f0c25[_0x3104('0x4f')][_0x3104('0x51')]?_0x3f0c25[_0x3104('0x4f')]:_0x520fe6[_0x3104('0x4a')];if(!_0x32fb34[_0x3104('0x4b')][_0x3104('0x52')](_0x3104('0x53'))){_0x3f0c25['limit']=qs[_0x3104('0x1f')](_0x32fb34['query'][_0x3104('0x1f')]);_0x3f0c25[_0x3104('0x21')]=qs[_0x3104('0x21')](_0x32fb34['query'][_0x3104('0x21')]);}_0x3f0c25[_0x3104('0x73')]=qs[_0x3104('0x54')](_0x32fb34['query'][_0x3104('0x54')]);_0x3f0c25['where']=qs[_0x3104('0x4d')](_[_0x3104('0x56')](_0x32fb34['query'],_0x520fe6[_0x3104('0x4d')]));_0x3f0c25['where'][_0x3104('0x69')]=_0x21eb4e['id'];if(_0x32fb34[_0x3104('0x4b')]['filter']){_0x3f0c25[_0x3104('0x55')]=_[_0x3104('0x58')](_0x3f0c25[_0x3104('0x55')],{'$or':_[_0x3104('0x48')](_0x3f0c25['attributes'],function(_0x581d6a){var _0x130b8a={};_0x130b8a[_0x581d6a]={'$like':'%'+_0x32fb34[_0x3104('0x4b')]['filter']+'%'};return _0x130b8a;})});}_0x3f0c25=_[_0x3104('0x58')]({},_0x3f0c25,_0x32fb34[_0x3104('0x5a')]);return db[_0x3104('0x72')][_0x3104('0x20')]({'where':_0x3f0c25[_0x3104('0x55')]})[_0x3104('0xf')](function(_0x3fc717){_0x1a5823[_0x3104('0x20')]=_0x3fc717;if(_0x32fb34[_0x3104('0x4b')]['includeAll']){_0x3f0c25[_0x3104('0x6e')]=[{'all':!![]}];}return db[_0x3104('0x72')][_0x3104('0x5c')](_0x3f0c25);})['then'](function(_0x563f03){_0x1a5823[_0x3104('0x5d')]=_0x563f03;return _0x1a5823;});}})[_0x3104('0xf')](respondWithFilteredResult(_0x211a35,_0x3f0c25))['catch'](handleError(_0x211a35,null));};exports[_0x3104('0x74')]=function(_0x1e9b86,_0x2dc8f3){return db[_0x3104('0x49')][_0x3104('0x61')]({'where':{'id':_0x1e9b86[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x2dc8f3,null))[_0x3104('0xf')](function(_0x25da46){if(_0x25da46){return _0x25da46[_0x3104('0x74')](_0x1e9b86[_0x3104('0x4b')][_0x3104('0x70')]);}})[_0x3104('0xf')](respondWithStatusCode(_0x2dc8f3,null))[_0x3104('0x19')](handleError(_0x2dc8f3,null));};exports[_0x3104('0x6b')]=function(_0x29feea,_0x3ae689){var _0x371075={'name':_0x29feea[_0x3104('0x62')][_0x3104('0x28')],'key':_0x29feea[_0x3104('0x62')][_0x3104('0x75')],'provider':_0x29feea[_0x3104('0x62')][_0x3104('0x63')]===_0x3104('0x64')?null:_0x29feea[_0x3104('0x62')]['provider'],'email':_0x29feea[_0x3104('0x62')][_0x3104('0x76')],'ListId':_0x29feea[_0x3104('0x62')][_0x3104('0x77')],'active':!_['isNil'](_0x29feea[_0x3104('0x62')]['active'])?_0x29feea['body'][_0x3104('0x78')]:!![],'description':_0x29feea[_0x3104('0x62')]['description']||null};var _0x5c83a5=getAuthenticationOptions(_0x371075[_0x3104('0x63')],_0x29feea[_0x3104('0x62')]);_0x371075[_0x3104('0x40')]=_0x5c83a5[_0x3104('0x40')];_0x371075[_0x3104('0x42')]=_0x5c83a5[_0x3104('0x42')];return db['MailAccount'][_0x3104('0x6b')](_0x371075,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x3104('0x44')],'as':_0x3104('0x40')}]})[_0x3104('0xf')](function(_0x4b60ba){var _0x3841d8=_0x29feea[_0x3104('0x36')][_0x3104('0x25')]({'plain':!![]});if(!_0x3841d8)throw new Error(_0x3104('0x79'));if(_0x3841d8[_0x3104('0x7a')]===_0x3104('0x36')){var _0x2f7fc6=_0x4b60ba[_0x3104('0x25')]({'plain':!![]});return db[_0x3104('0x7b')][_0x3104('0x61')]({'where':{'name':_0x3104('0x26'),'userProfileId':_0x3841d8[_0x3104('0x7c')]},'raw':!![]})['then'](function(_0x3fea8c){if(_0x3fea8c&&_0x3fea8c[_0x3104('0x7d')]===0x0){return db['UserProfileResource'][_0x3104('0x6b')]({'name':_0x2f7fc6[_0x3104('0x28')],'resourceId':_0x2f7fc6['id'],'type':_0x3fea8c[_0x3104('0x28')],'sectionId':_0x3fea8c['id']},{})[_0x3104('0xf')](function(){return _0x4b60ba;});}else{return _0x4b60ba;}})[_0x3104('0x19')](function(_0x494f54){logger[_0x3104('0x14')](_0x3104('0x7e'),_0x494f54);throw _0x494f54;});}return _0x4b60ba;})[_0x3104('0xf')](respondWithResult(_0x3ae689,0xc9))['catch'](handleError(_0x3ae689,null));};exports['getImap']=function(_0x41398a,_0x557ae5){return db[_0x3104('0x49')]['findOne']({'where':{'id':_0x41398a['params']['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x557ae5,null))[_0x3104('0xf')](function(_0x14e661){if(_0x14e661){return _0x14e661[_0x3104('0x7f')]();}return null;})[_0x3104('0xf')](respondWithResult(_0x557ae5,null))['catch'](handleError(_0x557ae5,null));};exports[_0x3104('0x80')]=function(_0x33741e,_0x5f3031){if(_0x33741e[_0x3104('0x62')]['id']){delete _0x33741e[_0x3104('0x62')]['id'];}return db[_0x3104('0x49')][_0x3104('0x61')]({'where':{'id':_0x33741e[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x5f3031,null))['then'](function(_0x35cf18){if(_0x35cf18){_0x33741e[_0x3104('0x62')][_0x3104('0x69')]=_0x35cf18['id'];return db[_0x3104('0x44')][_0x3104('0x6b')](_0x33741e[_0x3104('0x62')]);}})[_0x3104('0xf')](respondWithResult(_0x5f3031,null))[_0x3104('0x19')](handleError(_0x5f3031,null));};exports[_0x3104('0x81')]=function(_0x5cf92d,_0x2de2b0){return db[_0x3104('0x49')][_0x3104('0x6d')]({'where':{'id':_0x5cf92d[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x2de2b0,null))[_0x3104('0xf')](function(_0x3aaf4f){if(_0x3aaf4f){return _0x3aaf4f['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x2de2b0,null))[_0x3104('0x19')](handleError(_0x2de2b0,null));};exports[_0x3104('0x82')]=function(_0x1f3e90,_0x43a0e7){return db[_0x3104('0x49')][_0x3104('0x6d')]({'where':{'id':_0x1f3e90[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x43a0e7,null))['then'](function(_0x42bc73){if(_0x42bc73){return _0x42bc73[_0x3104('0x82')]();}return null;})['then'](respondWithResult(_0x43a0e7,null))[_0x3104('0x19')](handleError(_0x43a0e7,null));};exports['addSmtp']=function(_0x54da6d,_0x4dd403){if(_0x54da6d[_0x3104('0x62')]['id']){delete _0x54da6d[_0x3104('0x62')]['id'];}return db[_0x3104('0x49')]['find']({'where':{'id':_0x54da6d[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x4dd403,null))[_0x3104('0xf')](function(_0xd66282){if(_0xd66282){_0x54da6d[_0x3104('0x62')][_0x3104('0x69')]=_0xd66282['id'];return db['MailServerOut']['create'](_0x54da6d['body']);}})[_0x3104('0xf')](respondWithResult(_0x4dd403,null))[_0x3104('0x19')](handleError(_0x4dd403,null));};exports[_0x3104('0x83')]=function(_0x322a93,_0x446ace){return db[_0x3104('0x49')]['findOne']({'where':{'id':_0x322a93[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x446ace,null))[_0x3104('0xf')](function(_0x39704e){if(_0x39704e){return _0x39704e['setSmtp'](null);}return null;})[_0x3104('0xf')](respondWithStatusCode(_0x446ace,null))[_0x3104('0x19')](handleError(_0x446ace,null));};exports['addInteraction']=function(_0x197a9d,_0x3a0dbd){return db[_0x3104('0x84')][_0x3104('0x61')]({'where':{'id':_0x197a9d[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x3a0dbd,null))[_0x3104('0xf')](function(_0x51674a){if(_0x51674a){return _0x51674a['addInteraction'](_0x197a9d['body'][_0x3104('0x70')],_[_0x3104('0x85')](_0x197a9d[_0x3104('0x62')],[_0x3104('0x70'),'id'])||{});}})['then'](respondWithResult(_0x3a0dbd,null))['catch'](handleError(_0x3a0dbd,null));};exports[_0x3104('0x86')]=function(_0xa9fde1,_0x2a9f26){var _0x431475={'raw':![],'where':{}};var _0x15db37={};var _0x9a76a={'count':0x0,'rows':[]};return db[_0x3104('0x49')][_0x3104('0x6d')]({'where':{'id':_0xa9fde1[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x2a9f26,null))['then'](function(_0x22e999){if(_0x22e999){_0x15db37[_0x3104('0x4a')]=_[_0x3104('0x4c')](db[_0x3104('0x84')]['rawAttributes']);_0x15db37[_0x3104('0x4b')]=_[_0x3104('0x4c')](_0xa9fde1[_0x3104('0x4b')]);_0x15db37[_0x3104('0x4d')]=_[_0x3104('0x4e')](_0x15db37[_0x3104('0x4a')],_0x15db37[_0x3104('0x4b')]);_0x431475[_0x3104('0x4f')]=_['intersection'](_0x15db37[_0x3104('0x4a')],qs[_0x3104('0x50')](_0xa9fde1[_0x3104('0x4b')][_0x3104('0x50')]));_0x431475[_0x3104('0x4f')]=_0x431475['attributes']['length']?_0x431475[_0x3104('0x4f')]:_0x15db37[_0x3104('0x4a')];if(!_0xa9fde1[_0x3104('0x4b')]['hasOwnProperty'](_0x3104('0x53'))){_0x431475[_0x3104('0x1f')]=qs[_0x3104('0x1f')](_0xa9fde1['query'][_0x3104('0x1f')]);_0x431475[_0x3104('0x21')]=qs['offset'](_0xa9fde1[_0x3104('0x4b')][_0x3104('0x21')]);}_0x431475['order']=qs[_0x3104('0x54')](_0xa9fde1[_0x3104('0x4b')][_0x3104('0x54')]);_0x431475['where']=qs[_0x3104('0x4d')](_['pick'](_0xa9fde1[_0x3104('0x4b')],_0x15db37['filters']));_0x431475[_0x3104('0x55')][_0x3104('0x69')]=_0x22e999['id'];if(_0xa9fde1[_0x3104('0x4b')][_0x3104('0x57')]){_0x431475[_0x3104('0x55')]=_['merge'](_0x431475[_0x3104('0x55')],{'$or':_['map'](_0x431475[_0x3104('0x4f')],function(_0x296d93){var _0x38c256={};_0x38c256[_0x296d93]={'$like':'%'+_0xa9fde1['query'][_0x3104('0x57')]+'%'};return _0x38c256;})});}_0x431475=_['merge']({},_0x431475,_0xa9fde1[_0x3104('0x5a')]);return db[_0x3104('0x84')][_0x3104('0x20')]({'where':_0x431475['where']})['then'](function(_0xbda925){_0x9a76a[_0x3104('0x20')]=_0xbda925;if(_0xa9fde1[_0x3104('0x4b')][_0x3104('0x5b')]){_0x431475[_0x3104('0x6e')]=[{'model':db[_0x3104('0x87')],'as':_0x3104('0x88'),'required':![]},{'model':db[_0x3104('0x89')],'as':_0x3104('0x8a'),'attributes':[_0x3104('0x28'),_0x3104('0x8b'),_0x3104('0x8c')],'required':![]},{'model':db['Tag'],'as':_0x3104('0x8d'),'attributes':['id',_0x3104('0x28'),_0x3104('0x8e')],'where':_0xa9fde1[_0x3104('0x4b')]['tag']?{'id':_0xa9fde1['query'][_0x3104('0x8f')]}:undefined,'required':_0xa9fde1[_0x3104('0x4b')]['tag']?!![]:![]}];}return db[_0x3104('0x84')][_0x3104('0x5c')](_0x431475);})['then'](function(_0x378cb8){_0x9a76a[_0x3104('0x5d')]=_0x378cb8;return _0x9a76a;});}})[_0x3104('0xf')](respondWithFilteredResult(_0x2a9f26,_0x431475))[_0x3104('0x19')](handleError(_0x2a9f26,null));};exports[_0x3104('0x90')]=function addApplications(_0xb4b174,_0x100fd9){var _0x59230b=_0xb4b174[_0x3104('0x5f')]['id'];var _0x1aeb6a=_0xb4b174[_0x3104('0x62')];var _0x5da82c=0xc8;var _0x582f31=null;return db[_0x3104('0x91')]['transaction']({'isolationLevel':db['sequelize'][_0x3104('0x92')][_0x3104('0x93')]['READ_COMMITTED']},function(_0x5b8303){return db[_0x3104('0x49')][_0x3104('0x6d')]({'where':{'id':_0x59230b},'transaction':_0x5b8303})[_0x3104('0xf')](function(_0x4d19b3){if(_0x4d19b3){return db[_0x3104('0x94')]['destroy']({'where':{'MailAccountId':_0x59230b},'transaction':_0x5b8303})[_0x3104('0xf')](function(){var _0xe724c0=_[_0x3104('0x48')](_0x1aeb6a,function(_0x444a7e){_0x444a7e[_0x3104('0x69')]=_0x59230b;return _0x444a7e;});return db[_0x3104('0x94')]['bulkCreate'](_0xe724c0,{'transaction':_0x5b8303});});}else{_0x5da82c=0x194;_0x582f31=[];}});})[_0x3104('0xf')](function(){if(_0x5da82c!==0x194){return db[_0x3104('0x94')][_0x3104('0x95')]({'where':{'MailAccountId':_0x59230b},'order':_0x3104('0x96')})['then'](function(_0x207811){_0x582f31=_0x207811;});}})[_0x3104('0x19')](function(_0x198a0c){_0x5da82c=0x1f4;logger[_0x3104('0x14')](_0x198a0c[_0x3104('0x27')]);if(_0x198a0c[_0x3104('0x28')]){delete _0x198a0c[_0x3104('0x28')];}_0x582f31=_0x198a0c;})['finally'](function(){if(_0x582f31===null){_0x100fd9[_0x3104('0x1a')](_0x5da82c);}else{if(_0x5da82c===0x1f4){_0x100fd9[_0x3104('0x1b')](_0x5da82c)['send'](_0x582f31);}else{_0x100fd9[_0x3104('0x1b')](_0x5da82c)['json'](_0x582f31);}}});};exports[_0x3104('0x97')]=function(_0x4af32b,_0x14ab1a){var _0x33af03={};var _0x52bb14={};var _0x44175a;var _0x58766a;return db[_0x3104('0x49')][_0x3104('0x6d')]({'where':{'id':_0x4af32b[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x14ab1a,null))[_0x3104('0xf')](function(_0x44e585){if(_0x44e585){_0x44175a=_0x44e585;_0x52bb14[_0x3104('0x4a')]=_[_0x3104('0x4c')](db['MailApplication']['rawAttributes']);_0x52bb14['query']=_['keys'](_0x4af32b[_0x3104('0x4b')]);_0x52bb14['filters']=_[_0x3104('0x4e')](_0x52bb14[_0x3104('0x4a')],_0x52bb14[_0x3104('0x4b')]);_0x33af03[_0x3104('0x4f')]=_[_0x3104('0x4e')](_0x52bb14[_0x3104('0x4a')],qs['fields'](_0x4af32b[_0x3104('0x4b')][_0x3104('0x50')]));_0x33af03['attributes']=_0x33af03['attributes'][_0x3104('0x51')]?_0x33af03['attributes']:_0x52bb14['model'];_0x33af03[_0x3104('0x73')]=qs[_0x3104('0x54')](_0x4af32b[_0x3104('0x4b')][_0x3104('0x54')]);_0x33af03[_0x3104('0x55')]=qs[_0x3104('0x4d')](_['pick'](_0x4af32b[_0x3104('0x4b')],_0x52bb14[_0x3104('0x4d')]));if(_0x4af32b[_0x3104('0x4b')][_0x3104('0x57')]){_0x33af03[_0x3104('0x55')]=_[_0x3104('0x58')](_0x33af03['where'],{'$or':_[_0x3104('0x48')](_0x33af03[_0x3104('0x4f')],function(_0x56845c){var _0x54c7aa={};_0x54c7aa[_0x56845c]={'$like':'%'+_0x4af32b[_0x3104('0x4b')][_0x3104('0x57')]+'%'};return _0x54c7aa;})});}_0x33af03=_[_0x3104('0x58')]({},_0x33af03,_0x4af32b[_0x3104('0x5a')]);return _0x44175a['getApplications'](_0x33af03);}})[_0x3104('0xf')](function(_0x1aeea0){if(_0x1aeea0){_0x58766a=_0x1aeea0[_0x3104('0x51')];if(!_0x4af32b[_0x3104('0x4b')][_0x3104('0x52')](_0x3104('0x53'))){_0x33af03[_0x3104('0x1f')]=qs[_0x3104('0x1f')](_0x4af32b['query'][_0x3104('0x1f')]);_0x33af03[_0x3104('0x21')]=qs[_0x3104('0x21')](_0x4af32b[_0x3104('0x4b')]['offset']);}return _0x44175a['getApplications'](_0x33af03);}})['then'](function(_0x37015e){if(_0x37015e){return _0x37015e?{'count':_0x58766a,'rows':_0x37015e}:null;}})[_0x3104('0xf')](respondWithResult(_0x14ab1a,null))[_0x3104('0x19')](handleError(_0x14ab1a,null));};exports[_0x3104('0x98')]=function(_0x4841e1,_0x5f3607){var _0x1a417f={'raw':!![],'where':{}};var _0x3e3e1c={};var _0x1c0c08={'count':0x0,'rows':[]};return db[_0x3104('0x49')][_0x3104('0x6d')]({'where':{'id':_0x4841e1['params']['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x5f3607,null))[_0x3104('0xf')](function(_0x2fb8c8){if(_0x2fb8c8){_0x3e3e1c[_0x3104('0x4a')]=_[_0x3104('0x4c')](db[_0x3104('0x99')][_0x3104('0x60')]);_0x3e3e1c[_0x3104('0x4b')]=_[_0x3104('0x4c')](_0x4841e1['query']);_0x3e3e1c[_0x3104('0x4d')]=_[_0x3104('0x4e')](_0x3e3e1c[_0x3104('0x4a')],_0x3e3e1c['query']);_0x1a417f[_0x3104('0x4f')]=_[_0x3104('0x4e')](_0x3e3e1c[_0x3104('0x4a')],qs[_0x3104('0x50')](_0x4841e1[_0x3104('0x4b')][_0x3104('0x50')]));_0x1a417f['attributes']=_0x1a417f['attributes']['length']?_0x1a417f[_0x3104('0x4f')]:_0x3e3e1c[_0x3104('0x4a')];if(!_0x4841e1[_0x3104('0x4b')]['hasOwnProperty']('nolimit')){_0x1a417f[_0x3104('0x1f')]=qs[_0x3104('0x1f')](_0x4841e1['query'][_0x3104('0x1f')]);_0x1a417f[_0x3104('0x21')]=qs[_0x3104('0x21')](_0x4841e1[_0x3104('0x4b')][_0x3104('0x21')]);}_0x1a417f[_0x3104('0x73')]=qs[_0x3104('0x54')](_0x4841e1[_0x3104('0x4b')][_0x3104('0x54')]);_0x1a417f[_0x3104('0x55')]=qs[_0x3104('0x4d')](_[_0x3104('0x56')](_0x4841e1[_0x3104('0x4b')],_0x3e3e1c[_0x3104('0x4d')]));_0x1a417f[_0x3104('0x55')][_0x3104('0x69')]=_0x2fb8c8['id'];if(_0x4841e1[_0x3104('0x4b')][_0x3104('0x57')]){_0x1a417f[_0x3104('0x55')]=_['merge'](_0x1a417f[_0x3104('0x55')],{'$or':_[_0x3104('0x48')](_0x1a417f[_0x3104('0x4f')],function(_0xf974b4){var _0x660e23={};_0x660e23[_0xf974b4]={'$like':'%'+_0x4841e1[_0x3104('0x4b')][_0x3104('0x57')]+'%'};return _0x660e23;})});}if(_0x4841e1['query'][_0x3104('0x9a')]){var _0x447b0d=_0x4841e1[_0x3104('0x4b')][_0x3104('0x9a')][_0x3104('0x9b')](',');var _0x45be46={};_0x45be46[_0x447b0d[0x0]]={'$gte':moment(_0x447b0d[0x1])[_0x3104('0x9c')](_0x3104('0x9d'))};_0x1a417f[_0x3104('0x55')]=_[_0x3104('0x58')](_0x1a417f[_0x3104('0x55')],_0x45be46);}_0x1a417f=_['merge']({},_0x1a417f,_0x4841e1[_0x3104('0x5a')]);return db[_0x3104('0x99')][_0x3104('0x20')]({'where':_0x1a417f[_0x3104('0x55')]})[_0x3104('0xf')](function(_0xf883a7){_0x1c0c08[_0x3104('0x20')]=_0xf883a7;if(_0x4841e1[_0x3104('0x4b')]['includeAll']){_0x1a417f[_0x3104('0x6e')]=[{'all':!![]}];}return db[_0x3104('0x99')][_0x3104('0x5c')](_0x1a417f);})['then'](function(_0x50dd77){if(_0x4841e1[_0x3104('0x4b')][_0x3104('0x9e')]===_0x3104('0x9f')){for(var _0xca999c=0x0;_0xca999c<_0x50dd77['length'];_0xca999c++){_0x50dd77[_0xca999c][_0x3104('0x62')]=juice(_0x50dd77[_0xca999c]['body']);}}_0x1c0c08['rows']=_0x50dd77;return _0x1c0c08;});}})[_0x3104('0xf')](respondWithFilteredResult(_0x5f3607,_0x1a417f))[_0x3104('0x19')](handleError(_0x5f3607,null));};exports[_0x3104('0x29')]=function(_0x55316e,_0x50fe4b){var _0x4f3c35,_0x6e1107={},_0x5ca090;if(_0x55316e['body']['to']){_0x5ca090=_0x55316e[_0x3104('0x62')]['to'][_0x3104('0x9b')](',')[0x0];}return db[_0x3104('0x49')][_0x3104('0x61')]({'where':{'id':_0x55316e['params']['id']},'include':[{'model':db['CmList'],'as':_0x3104('0xa0'),'include':[{'model':db[_0x3104('0x87')],'as':_0x3104('0xa1'),'where':{'email':_0x5ca090},'limit':0x1,'order':[[_0x3104('0xa2'),_0x3104('0xa3')]]}]},{'model':db[_0x3104('0x45')],'as':_0x3104('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x50fe4b,null))[_0x3104('0xf')](function(_0x3fa770){if(!_0x3fa770)return;_0x4f3c35=_0x3fa770;if(!_0x3fa770[_0x3104('0x42')])throw new Error(_0x3104('0xa4'));if(_[_0x3104('0xa5')](_0x55316e[_0x3104('0x62')][_0x3104('0xa6')])){_0x55316e[_0x3104('0x62')][_0x3104('0xa6')]=util[_0x3104('0x9c')](_0x3104('0xa7'),_0x3fa770[_0x3104('0x28')],_0x3fa770[_0x3104('0x76')]||_0x3fa770[_0x3104('0x42')]['user']);}if(_0x55316e['body'][_0x3104('0xa8')]&&_0x55316e[_0x3104('0x62')]['attachments']['length']){for(var _0x212871=0x0;_0x212871<_0x55316e[_0x3104('0x62')][_0x3104('0xa8')][_0x3104('0x51')];_0x212871+=0x1){_0x55316e[_0x3104('0x62')][_0x3104('0xa8')][_0x212871]={'filename':_0x55316e[_0x3104('0x62')]['attachments'][_0x212871][_0x3104('0x28')],'path':path[_0x3104('0xa9')](config[_0x3104('0xaa')],_0x3104('0xab'),_0x55316e[_0x3104('0x62')][_0x3104('0xa8')][_0x212871]['basename'])};}}var _0x2b5095=_0x3fa770[_0x3104('0xac')]();return respondWithRpcPromise(_0x3104('0xad'),_0x3104('0xae'),{'account':_0x2b5095,'message':_0x55316e[_0x3104('0x62')]});})['then'](function(_0x2cbfd2){if(!_0x2cbfd2)return;_0x6e1107=_0x2cbfd2;if(!_0x4f3c35[_0x3104('0xa0')])throw new Error(_0x3104('0xaf'));if(_0x4f3c35['List']['Contacts'][_0x3104('0x51')])return _0x4f3c35[_0x3104('0xa0')][_0x3104('0xa1')][0x0];return db[_0x3104('0x87')][_0x3104('0x6b')](_[_0x3104('0xa')](_0x55316e[_0x3104('0x62')],{'firstName':_0x55316e[_0x3104('0x62')]['to'],'email':_0x55316e[_0x3104('0x62')]['to'],'phone':_0x55316e[_0x3104('0x62')]['to'],'ListId':_0x4f3c35[_0x3104('0x77')]}));})[_0x3104('0xf')](function(_0x1b3b5a){if(!_0x1b3b5a)return;var _0x174702={'UserId':_0x55316e[_0x3104('0x36')]['id'],'ContactId':_0x1b3b5a['id'],'MailAccountId':_0x4f3c35['id'],'inReplyTo':_0x6e1107[_0x3104('0xb0')],'to':_0x55316e['body'][_0x3104('0xa6')],'cc':_0x55316e[_0x3104('0x62')]['cc'],'subject':_0x55316e[_0x3104('0x62')][_0x3104('0xb1')],'attach':_0x55316e['body'][_0x3104('0xb2')],'firstMsgDirection':_0x3104('0xb3'),'lastMsgAt':moment()[_0x3104('0x9c')](_0x3104('0x9d')),'lastMsgDirection':'out','Messages':[_[_0x3104('0x58')](_0x55316e[_0x3104('0x62')],{'messageId':_0x6e1107[_0x3104('0xb0')],'sentAt':moment()[_0x3104('0x9c')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x4f3c35['id'],'UserId':_0x55316e[_0x3104('0x36')]['id'],'ContactId':_0x1b3b5a['id']})]};if(_0x55316e[_0x3104('0x62')][_0x3104('0xb4')]){_0x174702=_[_0x3104('0x58')](_0x174702,_0x55316e['body'][_0x3104('0xb4')]);}return db[_0x3104('0x84')][_0x3104('0x6b')](_0x174702,{'include':[{'model':db[_0x3104('0x99')],'as':_0x3104('0xb5')}]});})[_0x3104('0xf')](respondWithResult(_0x50fe4b,null))[_0x3104('0x19')](handleError(_0x50fe4b,null));};exports[_0x3104('0xb6')]=function(_0x1b1de1,_0x42372e){return db['MailAccount'][_0x3104('0x61')]({'where':{'id':_0x1b1de1[_0x3104('0x5f')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x3104('0x42'),'raw':!![],'include':[{'model':db[_0x3104('0xb7')],'as':_0x3104('0xb7'),'raw':!![]}]}]})[_0x3104('0xf')](handleEntityNotFound(_0x42372e,null))[_0x3104('0xf')](function(_0x198a3a){if(!_0x198a3a[_0x3104('0x42')])return;var _0x119d57=_0x198a3a[_0x3104('0xac')]();return respondWithRpcPromise('VerifySmtp',_0x3104('0xb6'),{'account':_0x119d57});})[_0x3104('0xf')](respondWithResult(_0x42372e,null))[_0x3104('0x19')](handleError(_0x42372e,null));};exports[_0x3104('0x24')]=function(_0x2ab16f,_0x20731a){return db[_0x3104('0x49')][_0x3104('0x61')]({'where':{'id':_0x2ab16f[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x20731a,null))['then'](function(_0x17d668){if(_0x17d668&&_0x17d668[_0x3104('0x3e')]){throw new db['Sequelize'][(_0x3104('0xb8'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x17d668;})['then'](removeEntity(_0x20731a,null))['catch'](handleError(_0x20731a,null));};exports[_0x3104('0xb9')]=function(_0x334f93,_0x470fcf){return db[_0x3104('0x49')][_0x3104('0x61')]({'where':{'id':_0x334f93[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x470fcf,null))['then'](function(_0x37435b){if(_0x37435b){return _0x37435b['addAgents'](_0x334f93[_0x3104('0x62')][_0x3104('0x70')],_[_0x3104('0x85')](_0x334f93[_0x3104('0x62')],['ids','id'])||{})['spread'](function(_0x54fc61){for(var _0x1bb6a0=0x0;_0x1bb6a0<_0x334f93[_0x3104('0x62')][_0x3104('0x70')]['length'];_0x1bb6a0+=0x1){socket[_0x3104('0xba')](_0x3104('0xbb'),{'UserId':Number(_0x334f93[_0x3104('0x62')]['ids'][_0x1bb6a0]),'MailAccountId':Number(_0x334f93[_0x3104('0x5f')]['id'])});}return _0x54fc61;});}})[_0x3104('0xf')](respondWithResult(_0x470fcf,null))[_0x3104('0x19')](handleError(_0x470fcf,null));};exports[_0x3104('0xbc')]=function(_0xf2aff7,_0x312ca3){return db['MailAccount'][_0x3104('0x61')]({'where':{'id':_0xf2aff7['params']['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x312ca3,null))['then'](function(_0x24ee08){if(_0x24ee08){return _0x24ee08[_0x3104('0xbc')](_0xf2aff7[_0x3104('0x4b')]['ids'])[_0x3104('0xf')](function(){if(_[_0x3104('0xbd')](_0xf2aff7[_0x3104('0x4b')][_0x3104('0x70')])){for(var _0x514354=0x0;_0x514354<_0xf2aff7[_0x3104('0x4b')][_0x3104('0x70')][_0x3104('0x51')];_0x514354+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0xf2aff7[_0x3104('0x4b')][_0x3104('0x70')][_0x514354]),'MailAccountId':Number(_0xf2aff7[_0x3104('0x5f')]['id'])});}}else{socket['emit'](_0x3104('0xbe'),{'UserId':Number(_0xf2aff7['query'][_0x3104('0x70')]),'MailAccountId':Number(_0xf2aff7[_0x3104('0x5f')]['id'])});}});}})[_0x3104('0xf')](respondWithStatusCode(_0x312ca3,null))[_0x3104('0x19')](handleError(_0x312ca3,null));};exports['getAgents']=function(_0x32b5bd,_0x46f2b8){var _0x302c98={};var _0x5864b2={};var _0xa0f188;var _0x31bc72;return db[_0x3104('0x49')][_0x3104('0x6d')]({'where':{'id':_0x32b5bd[_0x3104('0x5f')]['id']}})[_0x3104('0xf')](handleEntityNotFound(_0x46f2b8,null))[_0x3104('0xf')](function(_0x57ebfa){if(_0x57ebfa){_0xa0f188=_0x57ebfa;_0x5864b2[_0x3104('0x4a')]=_[_0x3104('0x4c')](db[_0x3104('0x89')][_0x3104('0x60')]);_0x5864b2[_0x3104('0x4b')]=_[_0x3104('0x4c')](_0x32b5bd['query']);_0x5864b2['filters']=_[_0x3104('0x4e')](_0x5864b2[_0x3104('0x4a')],_0x5864b2['query']);_0x302c98[_0x3104('0x4f')]=_[_0x3104('0x4e')](_0x5864b2[_0x3104('0x4a')],qs[_0x3104('0x50')](_0x32b5bd[_0x3104('0x4b')][_0x3104('0x50')]));_0x302c98[_0x3104('0x4f')]=_0x302c98[_0x3104('0x4f')][_0x3104('0x51')]?_0x302c98[_0x3104('0x4f')]:_0x5864b2[_0x3104('0x4a')];_0x302c98['order']=qs[_0x3104('0x54')](_0x32b5bd[_0x3104('0x4b')][_0x3104('0x54')]);_0x302c98[_0x3104('0x55')]=qs[_0x3104('0x4d')](_[_0x3104('0x56')](_0x32b5bd['query'],_0x5864b2['filters']));if(_0x32b5bd[_0x3104('0x4b')][_0x3104('0x57')]){_0x302c98[_0x3104('0x55')]=_[_0x3104('0x58')](_0x302c98[_0x3104('0x55')],{'$or':_['map'](_0x302c98[_0x3104('0x4f')],function(_0x2dbf99){var _0x584ac8={};_0x584ac8[_0x2dbf99]={'$like':'%'+_0x32b5bd[_0x3104('0x4b')][_0x3104('0x57')]+'%'};return _0x584ac8;})});}_0x302c98=_[_0x3104('0x58')]({},_0x302c98,_0x32b5bd[_0x3104('0x5a')]);return _0xa0f188[_0x3104('0xbf')](_0x302c98);}})[_0x3104('0xf')](function(_0x4c83c9){if(_0x4c83c9){_0x31bc72=_0x4c83c9[_0x3104('0x51')];if(!_0x32b5bd[_0x3104('0x4b')][_0x3104('0x52')]('nolimit')){_0x302c98[_0x3104('0x1f')]=qs[_0x3104('0x1f')](_0x32b5bd[_0x3104('0x4b')][_0x3104('0x1f')]);_0x302c98[_0x3104('0x21')]=qs['offset'](_0x32b5bd[_0x3104('0x4b')][_0x3104('0x21')]);}return _0xa0f188[_0x3104('0xbf')](_0x302c98);}})[_0x3104('0xf')](function(_0x21142e){if(_0x21142e){return _0x21142e?{'count':_0x31bc72,'rows':_0x21142e}:null;}})[_0x3104('0xf')](respondWithResult(_0x46f2b8,null))[_0x3104('0x19')](handleError(_0x46f2b8,null));}; \ No newline at end of file +var _0xbd06=['removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','setSmtp','MailInteraction','getInteractions','User','Owner','fullname','internal','Tag','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','$gte','split','format','MailMessage','true','CmList','List','CmContact','updatedAt','CloudProvider','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','sendMail','List\x20not\x20found','Contacts','defaults','ListId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','../../config/logger','../../mysqldb','redis','localhost','./mailAccount.socket','register','jayson/promise','http','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','MailAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','MailAccounts','UserProfileResource','stack','name','send','imap.gmail.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','index','MailServerIn','MailServerOut','Smtp','map','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','MailAccount','includeAll','include','rows','Pause','keys','filters','update','body','provider','custom','secure','params','mandatoryDispositionPause','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','pick','findAll','find'];(function(_0x605fe8,_0x2ae0c7){var _0x32cb0b=function(_0x189467){while(--_0x189467){_0x605fe8['push'](_0x605fe8['shift']());}};_0x32cb0b(++_0x2ae0c7);}(_0xbd06,0x103));var _0x6bd0=function(_0x3b32b8,_0x446402){_0x3b32b8=_0x3b32b8-0x0;var _0x4c3fc0=_0xbd06[_0x3b32b8];return _0x4c3fc0;};'use strict';var moment=require('moment');var BPromise=require(_0x6bd0('0x0'));var util=require(_0x6bd0('0x1'));var path=require(_0x6bd0('0x2'));var _=require(_0x6bd0('0x3'));var juice=require(_0x6bd0('0x4'));var Redis=require(_0x6bd0('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x6bd0('0x6'))('api');var config=require('../../config/environment');var db=require(_0x6bd0('0x7'))['db'];config[_0x6bd0('0x8')]=_['defaults'](config['redis'],{'host':_0x6bd0('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6bd0('0x8')]));require(_0x6bd0('0xa'))[_0x6bd0('0xb')](socket);var jayson=require(_0x6bd0('0xc'));var client=jayson['client'][_0x6bd0('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x3fde07,_0x356467,_0x3dd3f7,_0x48177a){return new BPromise(function(_0x8f205d,_0x1bfd18){var _0x29de99=_0x48177a||client;return _0x29de99[_0x6bd0('0xe')](_0x3fde07,_0x3dd3f7)[_0x6bd0('0xf')](function(_0x25b252){logger['info']('MailAccount,\x20%s,\x20%s',_0x356467,_0x6bd0('0x10'));logger[_0x6bd0('0x11')](_0x6bd0('0x12'),_0x356467,'request\x20sent',JSON[_0x6bd0('0x13')](_0x25b252));if(_0x25b252['error']){if(_0x25b252[_0x6bd0('0x14')][_0x6bd0('0x15')]===0x1f4){logger[_0x6bd0('0x14')]('MailAccount,\x20%s,\x20%s',_0x356467,_0x25b252[_0x6bd0('0x14')][_0x6bd0('0x16')]);return _0x1bfd18(_0x25b252[_0x6bd0('0x14')][_0x6bd0('0x16')]);}logger[_0x6bd0('0x14')]('MailAccount,\x20%s,\x20%s',_0x356467,_0x25b252[_0x6bd0('0x14')]['message']);return _0x8f205d(_0x25b252[_0x6bd0('0x14')]['message']);}else{logger[_0x6bd0('0x17')](_0x6bd0('0x18'),_0x356467,_0x6bd0('0x10'));_0x8f205d(_0x25b252[_0x6bd0('0x19')][_0x6bd0('0x16')]);}})[_0x6bd0('0x1a')](function(_0x5c2416){logger[_0x6bd0('0x14')](_0x6bd0('0x18'),_0x356467,_0x5c2416);_0x1bfd18(_0x5c2416);});});}function respondWithStatusCode(_0x7640d,_0x4b16ca){_0x4b16ca=_0x4b16ca||0xcc;return function(_0x47a8fa){if(_0x47a8fa){return _0x7640d[_0x6bd0('0x1b')](_0x4b16ca);}return _0x7640d[_0x6bd0('0x1c')](_0x4b16ca)[_0x6bd0('0x1d')]();};}function respondWithResult(_0x1c45a8,_0x45cd60){_0x45cd60=_0x45cd60||0xc8;return function(_0x1efbb2){if(_0x1efbb2){return _0x1c45a8['status'](_0x45cd60)[_0x6bd0('0x1e')](_0x1efbb2);}};}function respondWithFilteredResult(_0x3fe7e2,_0x4d3fd0){return function(_0x2c2ea9){if(_0x2c2ea9){var _0x1209c6=typeof _0x4d3fd0[_0x6bd0('0x1f')]===_0x6bd0('0x20')&&typeof _0x4d3fd0[_0x6bd0('0x21')]===_0x6bd0('0x20');var _0x4c4074=_0x2c2ea9[_0x6bd0('0x22')];var _0x179c31=_0x1209c6?0x0:_0x4d3fd0['offset'];var _0x341337=_0x1209c6?_0x2c2ea9[_0x6bd0('0x22')]:_0x4d3fd0[_0x6bd0('0x1f')]+_0x4d3fd0[_0x6bd0('0x21')];var _0x39d455;if(_0x341337>=_0x4c4074){_0x341337=_0x4c4074;_0x39d455=0xc8;}else{_0x39d455=0xce;}_0x3fe7e2[_0x6bd0('0x1c')](_0x39d455);return _0x3fe7e2[_0x6bd0('0x23')](_0x6bd0('0x24'),_0x179c31+'-'+_0x341337+'/'+_0x4c4074)[_0x6bd0('0x1e')](_0x2c2ea9);}return null;};}function saveUpdates(_0x4d4868){return function(_0x94b9a4){if(_0x94b9a4){return _0x94b9a4['update'](_0x4d4868)['then'](function(_0x2ee251){return _0x2ee251;});}return null;};}function removeEntity(_0x1f9d7f){return function(_0x239038){if(_0x239038){return _0x239038[_0x6bd0('0x25')]()[_0x6bd0('0xf')](function(){var _0x3b71f5=_0x239038[_0x6bd0('0x26')]({'plain':!![]});var _0x1da5b8=_0x6bd0('0x27');return db[_0x6bd0('0x28')][_0x6bd0('0x25')]({'where':{'type':_0x1da5b8,'resourceId':_0x3b71f5['id']}})[_0x6bd0('0xf')](function(){return _0x239038;});})[_0x6bd0('0xf')](function(){_0x1f9d7f[_0x6bd0('0x1c')](0xcc)[_0x6bd0('0x1d')]();});}};}function handleEntityNotFound(_0x348558){return function(_0x403fbc){if(!_0x403fbc){_0x348558[_0x6bd0('0x1b')](0x194);}return _0x403fbc;};}function handleError(_0x312701,_0x539426){_0x539426=_0x539426||0x1f4;return function(_0x15ffc4){logger[_0x6bd0('0x14')](_0x15ffc4[_0x6bd0('0x29')]);if(_0x15ffc4[_0x6bd0('0x2a')]){delete _0x15ffc4['name'];}_0x312701[_0x6bd0('0x1c')](_0x539426)[_0x6bd0('0x2b')](_0x15ffc4);};}function getImapHost(_0x1500c8){switch(_0x1500c8){case'gmail':return _0x6bd0('0x2c');case'yahoo':return'imap.mail.yahoo.com';case _0x6bd0('0x2d'):return'imap-mail.outlook.com';case _0x6bd0('0x2e'):return _0x6bd0('0x2f');}throw new Error(_0x6bd0('0x30'),_0x1500c8);}function getSmtpHost(_0x205a1a){switch(_0x205a1a){case'gmail':return _0x6bd0('0x31');case'yahoo':return'smtp.mail.yahoo.com';case'hotmail':return _0x6bd0('0x32');case _0x6bd0('0x2e'):return _0x6bd0('0x33');}throw new Error(_0x6bd0('0x30'),_0x205a1a);}function getAuthenticationOptions(_0xd45a33,_0x4bd58b){var _0x3a96d5={};var _0x1c7bcf={};if(_0xd45a33){_0x3a96d5['user']=_0x1c7bcf[_0x6bd0('0x34')]=_0x4bd58b[_0x6bd0('0x35')];_0x3a96d5[_0x6bd0('0x36')]=_0x1c7bcf[_0x6bd0('0x37')]=_0x4bd58b[_0x6bd0('0x36')];if(_0x4bd58b[_0x6bd0('0x38')]){_0x3a96d5['modernAuthentication']=_0x1c7bcf[_0x6bd0('0x38')]=!![];_0x3a96d5[_0x6bd0('0x39')]=_0x1c7bcf[_0x6bd0('0x39')]=_0x4bd58b[_0x6bd0('0x39')];_0x3a96d5[_0x6bd0('0x36')]=_0x1c7bcf[_0x6bd0('0x37')]=null;}else{_0x3a96d5['CloudProviderId']=_0x1c7bcf[_0x6bd0('0x39')]=null;}_0x3a96d5[_0x6bd0('0x3a')]=getImapHost(_0xd45a33);_0x3a96d5[_0x6bd0('0x3b')]=0x3e1;_0x1c7bcf[_0x6bd0('0x3a')]=getSmtpHost(_0xd45a33);_0x1c7bcf[_0x6bd0('0x3b')]=0x24b;_0x1c7bcf['secure']=![];_0x3a96d5[_0x6bd0('0x3c')]=_0x1c7bcf[_0x6bd0('0x3c')]=null;}else{if(_0x4bd58b['authentication']){_0x3a96d5['user']=_0x1c7bcf[_0x6bd0('0x34')]=_0x4bd58b[_0x6bd0('0x35')];_0x3a96d5[_0x6bd0('0x36')]=_0x1c7bcf[_0x6bd0('0x37')]=_0x4bd58b[_0x6bd0('0x36')];}else{_0x3a96d5[_0x6bd0('0x3d')]=_0x1c7bcf[_0x6bd0('0x3d')]=![];_0x3a96d5['user']=_0x1c7bcf[_0x6bd0('0x34')]=null;_0x3a96d5[_0x6bd0('0x36')]=_0x1c7bcf['pass']=null;}_0x3a96d5[_0x6bd0('0x3a')]=_0x4bd58b[_0x6bd0('0x3e')][_0x6bd0('0x3a')];_0x3a96d5[_0x6bd0('0x3b')]=_0x4bd58b[_0x6bd0('0x3e')][_0x6bd0('0x3b')];_0x1c7bcf[_0x6bd0('0x3a')]=_0x4bd58b['Smtp']['host'];_0x1c7bcf[_0x6bd0('0x3b')]=_0x4bd58b['Smtp'][_0x6bd0('0x3b')];}return{'Imap':_0x3a96d5,'Smtp':_0x1c7bcf};}exports[_0x6bd0('0x3f')]=function(_0x4f39c3,_0x5944f9){var _0x534131={'include':[{'model':db[_0x6bd0('0x40')],'as':_0x6bd0('0x3e')},{'model':db[_0x6bd0('0x41')],'as':_0x6bd0('0x42')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1892f3={},_0xefa0c4={'count':0x0,'rows':[]};var _0x26ab2b=_[_0x6bd0('0x43')](db['MailAccount'][_0x6bd0('0x44')],function(_0x18e8c2){return{'name':_0x18e8c2[_0x6bd0('0x45')],'type':_0x18e8c2['type'][_0x6bd0('0x46')]};});_0x1892f3['model']=_[_0x6bd0('0x43')](_0x26ab2b,_0x6bd0('0x2a'));_0x1892f3[_0x6bd0('0x47')]=_['keys'](_0x4f39c3['query']);_0x1892f3['filters']=_[_0x6bd0('0x48')](_0x1892f3[_0x6bd0('0x49')],_0x1892f3[_0x6bd0('0x47')]);_0x534131[_0x6bd0('0x4a')]=_['intersection'](_0x1892f3[_0x6bd0('0x49')],qs[_0x6bd0('0x4b')](_0x4f39c3[_0x6bd0('0x47')]['fields']));_0x534131['attributes']=_0x534131[_0x6bd0('0x4a')][_0x6bd0('0x4c')]?_0x534131[_0x6bd0('0x4a')]:_0x1892f3[_0x6bd0('0x49')];if(!_0x4f39c3[_0x6bd0('0x47')][_0x6bd0('0x4d')](_0x6bd0('0x4e'))){_0x534131['limit']=qs[_0x6bd0('0x21')](_0x4f39c3[_0x6bd0('0x47')]['limit']);_0x534131[_0x6bd0('0x1f')]=qs[_0x6bd0('0x1f')](_0x4f39c3[_0x6bd0('0x47')][_0x6bd0('0x1f')]);}_0x534131[_0x6bd0('0x4f')]=qs['sort'](_0x4f39c3[_0x6bd0('0x47')][_0x6bd0('0x50')]);_0x534131['where']=qs['filters'](_['pick'](_0x4f39c3[_0x6bd0('0x47')],_0x1892f3['filters']),_0x26ab2b);if(_0x4f39c3[_0x6bd0('0x47')][_0x6bd0('0x51')]){_0x534131[_0x6bd0('0x52')]=_[_0x6bd0('0x53')](_0x534131[_0x6bd0('0x52')],{'$or':_[_0x6bd0('0x43')](_0x26ab2b,function(_0x5b2cec){if(_0x5b2cec['type']!==_0x6bd0('0x54')){var _0x179a0d={};_0x179a0d[_0x5b2cec['name']]={'$like':'%'+_0x4f39c3['query'][_0x6bd0('0x51')]+'%'};return _0x179a0d;}})});}_0x534131=_['merge']({},_0x534131,_0x4f39c3[_0x6bd0('0x55')]);var _0x555d01={'where':_0x534131[_0x6bd0('0x52')]};return db[_0x6bd0('0x56')]['count'](_0x555d01)[_0x6bd0('0xf')](function(_0x80a5f2){_0xefa0c4[_0x6bd0('0x22')]=_0x80a5f2;if(_0x4f39c3[_0x6bd0('0x47')][_0x6bd0('0x57')]){_0x534131[_0x6bd0('0x58')]=[{'all':!![]}];}return db[_0x6bd0('0x56')]['findAll'](_0x534131);})[_0x6bd0('0xf')](function(_0x9741a5){_0xefa0c4[_0x6bd0('0x59')]=_0x9741a5;return _0xefa0c4;})[_0x6bd0('0xf')](respondWithFilteredResult(_0x5944f9,_0x534131))[_0x6bd0('0x1a')](handleError(_0x5944f9,null));};exports['show']=function(_0x4fff8c,_0x14defd){var _0xdd4d={'raw':![],'where':{'id':_0x4fff8c['params']['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x6bd0('0x41')],'as':_0x6bd0('0x42')},{'model':db[_0x6bd0('0x5a')],'as':'mandatoryDispositionPause'}]},_0x50bf49={};_0x50bf49[_0x6bd0('0x49')]=_[_0x6bd0('0x5b')](db[_0x6bd0('0x56')][_0x6bd0('0x44')]);_0x50bf49[_0x6bd0('0x47')]=_[_0x6bd0('0x5b')](_0x4fff8c[_0x6bd0('0x47')]);_0x50bf49[_0x6bd0('0x5c')]=_[_0x6bd0('0x48')](_0x50bf49[_0x6bd0('0x49')],_0x50bf49[_0x6bd0('0x47')]);_0xdd4d[_0x6bd0('0x4a')]=_[_0x6bd0('0x48')](_0x50bf49['model'],qs[_0x6bd0('0x4b')](_0x4fff8c[_0x6bd0('0x47')][_0x6bd0('0x4b')]));_0xdd4d[_0x6bd0('0x4a')]=_0xdd4d[_0x6bd0('0x4a')][_0x6bd0('0x4c')]?_0xdd4d[_0x6bd0('0x4a')]:_0x50bf49[_0x6bd0('0x49')];if(_0x4fff8c['query'][_0x6bd0('0x57')]){_0xdd4d['include']=[{'all':!![]}];}_0xdd4d=_[_0x6bd0('0x53')]({},_0xdd4d,_0x4fff8c[_0x6bd0('0x55')]);return db[_0x6bd0('0x56')]['find'](_0xdd4d)[_0x6bd0('0xf')](handleEntityNotFound(_0x14defd,null))[_0x6bd0('0xf')](respondWithResult(_0x14defd,null))['catch'](handleError(_0x14defd,null));};exports[_0x6bd0('0x5d')]=function(_0x38d9eb,_0x1d0969){if(_0x38d9eb[_0x6bd0('0x5e')]['id']){delete _0x38d9eb['body']['id'];}var _0x338e05=_0x38d9eb[_0x6bd0('0x5e')][_0x6bd0('0x5f')]===_0x6bd0('0x60')?null:_0x38d9eb[_0x6bd0('0x5e')][_0x6bd0('0x5f')];var _0x242262=_0x38d9eb[_0x6bd0('0x5e')]['Imap']||{};var _0x400473=_0x38d9eb[_0x6bd0('0x5e')][_0x6bd0('0x42')]||{};if(_0x338e05){_0x242262[_0x6bd0('0x3a')]=getImapHost(_0x338e05);_0x242262[_0x6bd0('0x3b')]=0x3e1;_0x400473[_0x6bd0('0x3a')]=getSmtpHost(_0x338e05);_0x400473[_0x6bd0('0x3b')]=0x24b;_0x400473['secure']=![];}if(_0x400473[_0x6bd0('0x38')]){_0x400473[_0x6bd0('0x61')]=![];}else{_0x400473[_0x6bd0('0x39')]=null;}if(!_0x242262[_0x6bd0('0x38')])_0x242262[_0x6bd0('0x39')]=null;_0x38d9eb['body'][_0x6bd0('0x3e')]=_0x242262;_0x38d9eb[_0x6bd0('0x5e')][_0x6bd0('0x42')]=_0x400473;return db[_0x6bd0('0x56')]['find']({'where':{'id':_0x38d9eb[_0x6bd0('0x62')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x6bd0('0x3e')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x6bd0('0x5a')],'as':_0x6bd0('0x63')}]})['then'](handleEntityNotFound(_0x1d0969,null))[_0x6bd0('0xf')](function(_0x2c9453){if(!_0x2c9453)throw new Error(_0x6bd0('0x64'));if(_0x2c9453[_0x6bd0('0x3c')])delete _0x38d9eb[_0x6bd0('0x5e')][_0x6bd0('0x3e')];return _0x2c9453;})[_0x6bd0('0xf')](saveUpdates(_0x38d9eb[_0x6bd0('0x5e')],null))[_0x6bd0('0xf')](function(_0x201773){if(!_0x38d9eb[_0x6bd0('0x5e')][_0x6bd0('0x3e')])return _0x201773;return db[_0x6bd0('0x40')]['update'](_0x38d9eb['body'][_0x6bd0('0x3e')],{'where':{'MailAccountId':_0x201773['id']}})[_0x6bd0('0xf')](function(){return _0x201773;});})[_0x6bd0('0xf')](function(_0x19e657){if(!_0x38d9eb[_0x6bd0('0x5e')]['Smtp'])return _0x19e657;return db['MailServerOut']['update'](_0x38d9eb[_0x6bd0('0x5e')]['Smtp'],{'where':{'MailAccountId':_0x19e657['id']}})[_0x6bd0('0xf')](function(){return _0x19e657;});})[_0x6bd0('0xf')](respondWithResult(_0x1d0969,null))[_0x6bd0('0x1a')](handleError(_0x1d0969,null));};exports[_0x6bd0('0x65')]=function(_0x42b8fd,_0x52e648){return db['MailAccount'][_0x6bd0('0x65')]()[_0x6bd0('0xf')](respondWithResult(_0x52e648,null))[_0x6bd0('0x1a')](handleError(_0x52e648,null));};exports[_0x6bd0('0x66')]=function(_0x13311f,_0x274368){if(_0x13311f['body']['id']){delete _0x13311f['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x13311f[_0x6bd0('0x62')]['id']}})['then'](handleEntityNotFound(_0x274368,null))[_0x6bd0('0xf')](function(_0x4e0a01){if(_0x4e0a01){_0x13311f[_0x6bd0('0x5e')][_0x6bd0('0x67')]=_0x4e0a01['id'];return db[_0x6bd0('0x68')][_0x6bd0('0x69')](_0x13311f[_0x6bd0('0x5e')]);}})[_0x6bd0('0xf')](respondWithResult(_0x274368,null))[_0x6bd0('0x1a')](handleError(_0x274368,null));};exports[_0x6bd0('0x6a')]=function(_0x1a7bc6,_0x4aa47d){var _0x4bcf2e={'raw':![],'where':{}};var _0x4e526b={};var _0x100f3c={'count':0x0,'rows':[]};return db[_0x6bd0('0x56')][_0x6bd0('0x6b')]({'where':{'id':_0x1a7bc6[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x4aa47d,null))[_0x6bd0('0xf')](function(_0x2200f7){if(_0x2200f7){_0x4e526b['model']=_[_0x6bd0('0x5b')](db[_0x6bd0('0x68')][_0x6bd0('0x44')]);_0x4e526b['query']=_[_0x6bd0('0x5b')](_0x1a7bc6[_0x6bd0('0x47')]);_0x4e526b[_0x6bd0('0x5c')]=_[_0x6bd0('0x48')](_0x4e526b[_0x6bd0('0x49')],_0x4e526b[_0x6bd0('0x47')]);_0x4bcf2e[_0x6bd0('0x4a')]=_[_0x6bd0('0x48')](_0x4e526b[_0x6bd0('0x49')],qs[_0x6bd0('0x4b')](_0x1a7bc6[_0x6bd0('0x47')]['fields']));_0x4bcf2e['attributes']=_0x4bcf2e[_0x6bd0('0x4a')][_0x6bd0('0x4c')]?_0x4bcf2e[_0x6bd0('0x4a')]:_0x4e526b[_0x6bd0('0x49')];if(!_0x1a7bc6['query'][_0x6bd0('0x4d')]('nolimit')){_0x4bcf2e[_0x6bd0('0x21')]=qs[_0x6bd0('0x21')](_0x1a7bc6[_0x6bd0('0x47')]['limit']);_0x4bcf2e[_0x6bd0('0x1f')]=qs['offset'](_0x1a7bc6[_0x6bd0('0x47')]['offset']);}_0x4bcf2e[_0x6bd0('0x4f')]=qs[_0x6bd0('0x50')](_0x1a7bc6[_0x6bd0('0x47')][_0x6bd0('0x50')]);_0x4bcf2e[_0x6bd0('0x52')]=qs[_0x6bd0('0x5c')](_[_0x6bd0('0x6c')](_0x1a7bc6[_0x6bd0('0x47')],_0x4e526b[_0x6bd0('0x5c')]));_0x4bcf2e[_0x6bd0('0x52')]['MailAccountId']=_0x2200f7['id'];if(_0x1a7bc6[_0x6bd0('0x47')][_0x6bd0('0x51')]){_0x4bcf2e['where']=_[_0x6bd0('0x53')](_0x4bcf2e['where'],{'$or':_[_0x6bd0('0x43')](_0x4bcf2e[_0x6bd0('0x4a')],function(_0x5479a7){var _0x5ebcb2={};_0x5ebcb2[_0x5479a7]={'$like':'%'+_0x1a7bc6['query'][_0x6bd0('0x51')]+'%'};return _0x5ebcb2;})});}_0x4bcf2e=_[_0x6bd0('0x53')]({},_0x4bcf2e,_0x1a7bc6['options']);return db[_0x6bd0('0x68')][_0x6bd0('0x22')]({'where':_0x4bcf2e['where']})[_0x6bd0('0xf')](function(_0x4950b2){_0x100f3c['count']=_0x4950b2;if(_0x1a7bc6[_0x6bd0('0x47')][_0x6bd0('0x57')]){_0x4bcf2e['include']=[{'all':!![]}];}return db[_0x6bd0('0x68')][_0x6bd0('0x6d')](_0x4bcf2e);})['then'](function(_0x34fae6){_0x100f3c['rows']=_0x34fae6;return _0x100f3c;});}})[_0x6bd0('0xf')](respondWithFilteredResult(_0x4aa47d,_0x4bcf2e))[_0x6bd0('0x1a')](handleError(_0x4aa47d,null));};exports['removeDispositions']=function(_0x17c9bf,_0x57cbed){return db[_0x6bd0('0x56')][_0x6bd0('0x6e')]({'where':{'id':_0x17c9bf[_0x6bd0('0x62')]['id']}})['then'](handleEntityNotFound(_0x57cbed,null))[_0x6bd0('0xf')](function(_0x4be777){if(_0x4be777){return _0x4be777[_0x6bd0('0x6f')](_0x17c9bf[_0x6bd0('0x47')][_0x6bd0('0x70')]);}})[_0x6bd0('0xf')](respondWithStatusCode(_0x57cbed,null))[_0x6bd0('0x1a')](handleError(_0x57cbed,null));};exports['addAnswer']=function(_0x28c33f,_0x5a72fb){if(_0x28c33f[_0x6bd0('0x5e')]['id']){delete _0x28c33f['body']['id'];}return db['MailAccount'][_0x6bd0('0x6e')]({'where':{'id':_0x28c33f[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x5a72fb,null))[_0x6bd0('0xf')](function(_0x320743){if(_0x320743){_0x28c33f[_0x6bd0('0x5e')][_0x6bd0('0x67')]=_0x320743['id'];return db[_0x6bd0('0x71')][_0x6bd0('0x69')](_0x28c33f[_0x6bd0('0x5e')]);}})[_0x6bd0('0xf')](respondWithResult(_0x5a72fb,null))[_0x6bd0('0x1a')](handleError(_0x5a72fb,null));};exports[_0x6bd0('0x72')]=function(_0x574cfa,_0x228bae){var _0x17d59e={'raw':![],'where':{}};var _0x1620a4={};var _0x4755a9={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x574cfa[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x228bae,null))[_0x6bd0('0xf')](function(_0x1a6893){if(_0x1a6893){_0x1620a4[_0x6bd0('0x49')]=_[_0x6bd0('0x5b')](db[_0x6bd0('0x71')]['rawAttributes']);_0x1620a4[_0x6bd0('0x47')]=_[_0x6bd0('0x5b')](_0x574cfa['query']);_0x1620a4[_0x6bd0('0x5c')]=_[_0x6bd0('0x48')](_0x1620a4[_0x6bd0('0x49')],_0x1620a4[_0x6bd0('0x47')]);_0x17d59e[_0x6bd0('0x4a')]=_[_0x6bd0('0x48')](_0x1620a4[_0x6bd0('0x49')],qs[_0x6bd0('0x4b')](_0x574cfa[_0x6bd0('0x47')]['fields']));_0x17d59e[_0x6bd0('0x4a')]=_0x17d59e[_0x6bd0('0x4a')][_0x6bd0('0x4c')]?_0x17d59e[_0x6bd0('0x4a')]:_0x1620a4[_0x6bd0('0x49')];if(!_0x574cfa['query'][_0x6bd0('0x4d')]('nolimit')){_0x17d59e['limit']=qs[_0x6bd0('0x21')](_0x574cfa[_0x6bd0('0x47')][_0x6bd0('0x21')]);_0x17d59e['offset']=qs[_0x6bd0('0x1f')](_0x574cfa[_0x6bd0('0x47')][_0x6bd0('0x1f')]);}_0x17d59e[_0x6bd0('0x4f')]=qs[_0x6bd0('0x50')](_0x574cfa[_0x6bd0('0x47')][_0x6bd0('0x50')]);_0x17d59e[_0x6bd0('0x52')]=qs[_0x6bd0('0x5c')](_['pick'](_0x574cfa[_0x6bd0('0x47')],_0x1620a4[_0x6bd0('0x5c')]));_0x17d59e[_0x6bd0('0x52')][_0x6bd0('0x67')]=_0x1a6893['id'];if(_0x574cfa[_0x6bd0('0x47')][_0x6bd0('0x51')]){_0x17d59e[_0x6bd0('0x52')]=_[_0x6bd0('0x53')](_0x17d59e[_0x6bd0('0x52')],{'$or':_[_0x6bd0('0x43')](_0x17d59e[_0x6bd0('0x4a')],function(_0xd13a4e){var _0x262476={};_0x262476[_0xd13a4e]={'$like':'%'+_0x574cfa[_0x6bd0('0x47')][_0x6bd0('0x51')]+'%'};return _0x262476;})});}_0x17d59e=_[_0x6bd0('0x53')]({},_0x17d59e,_0x574cfa[_0x6bd0('0x55')]);return db['CannedAnswer'][_0x6bd0('0x22')]({'where':_0x17d59e['where']})['then'](function(_0x3d0a36){_0x4755a9[_0x6bd0('0x22')]=_0x3d0a36;if(_0x574cfa[_0x6bd0('0x47')][_0x6bd0('0x57')]){_0x17d59e[_0x6bd0('0x58')]=[{'all':!![]}];}return db[_0x6bd0('0x71')][_0x6bd0('0x6d')](_0x17d59e);})[_0x6bd0('0xf')](function(_0x1d1711){_0x4755a9[_0x6bd0('0x59')]=_0x1d1711;return _0x4755a9;});}})[_0x6bd0('0xf')](respondWithFilteredResult(_0x228bae,_0x17d59e))[_0x6bd0('0x1a')](handleError(_0x228bae,null));};exports[_0x6bd0('0x73')]=function(_0x5eff79,_0x4ac670){return db['MailAccount'][_0x6bd0('0x6e')]({'where':{'id':_0x5eff79[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x4ac670,null))[_0x6bd0('0xf')](function(_0x5a1bbb){if(_0x5a1bbb){return _0x5a1bbb['removeAnswers'](_0x5eff79[_0x6bd0('0x47')]['ids']);}})[_0x6bd0('0xf')](respondWithStatusCode(_0x4ac670,null))[_0x6bd0('0x1a')](handleError(_0x4ac670,null));};exports[_0x6bd0('0x69')]=function(_0x5fa47,_0x8cb021){var _0x30a1d0={'name':_0x5fa47[_0x6bd0('0x5e')][_0x6bd0('0x2a')],'key':_0x5fa47[_0x6bd0('0x5e')][_0x6bd0('0x46')],'provider':_0x5fa47[_0x6bd0('0x5e')]['provider']===_0x6bd0('0x60')?null:_0x5fa47['body'][_0x6bd0('0x5f')],'email':_0x5fa47['body']['email'],'ListId':_0x5fa47['body']['ListId'],'active':!_[_0x6bd0('0x74')](_0x5fa47['body'][_0x6bd0('0x75')])?_0x5fa47[_0x6bd0('0x5e')][_0x6bd0('0x75')]:!![],'description':_0x5fa47[_0x6bd0('0x5e')]['description']||null};var _0x4bfdf9=getAuthenticationOptions(_0x30a1d0['provider'],_0x5fa47[_0x6bd0('0x5e')]);_0x30a1d0['Imap']=_0x4bfdf9[_0x6bd0('0x3e')];_0x30a1d0[_0x6bd0('0x42')]=_0x4bfdf9[_0x6bd0('0x42')];return db[_0x6bd0('0x56')][_0x6bd0('0x69')](_0x30a1d0,{'include':[{'model':db[_0x6bd0('0x41')],'as':_0x6bd0('0x42')},{'model':db[_0x6bd0('0x40')],'as':_0x6bd0('0x3e')}]})[_0x6bd0('0xf')](function(_0x65c789){var _0x3d4551=_0x5fa47[_0x6bd0('0x34')][_0x6bd0('0x26')]({'plain':!![]});if(!_0x3d4551)throw new Error(_0x6bd0('0x76'));if(_0x3d4551[_0x6bd0('0x77')]===_0x6bd0('0x34')){var _0x269ca3=_0x65c789[_0x6bd0('0x26')]({'plain':!![]});return db[_0x6bd0('0x78')][_0x6bd0('0x6e')]({'where':{'name':_0x6bd0('0x27'),'userProfileId':_0x3d4551['userProfileId']},'raw':!![]})[_0x6bd0('0xf')](function(_0x5e55ca){if(_0x5e55ca&&_0x5e55ca[_0x6bd0('0x79')]===0x0){return db[_0x6bd0('0x28')]['create']({'name':_0x269ca3['name'],'resourceId':_0x269ca3['id'],'type':_0x5e55ca[_0x6bd0('0x2a')],'sectionId':_0x5e55ca['id']},{})[_0x6bd0('0xf')](function(){return _0x65c789;});}else{return _0x65c789;}})[_0x6bd0('0x1a')](function(_0x3ea652){logger[_0x6bd0('0x14')](_0x6bd0('0x7a'),_0x3ea652);throw _0x3ea652;});}return _0x65c789;})[_0x6bd0('0xf')](respondWithResult(_0x8cb021,0xc9))[_0x6bd0('0x1a')](handleError(_0x8cb021,null));};exports[_0x6bd0('0x7b')]=function(_0x58c98f,_0x23228c){return db[_0x6bd0('0x56')][_0x6bd0('0x6b')]({'where':{'id':_0x58c98f[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x23228c,null))['then'](function(_0x56392a){if(_0x56392a){return _0x56392a['getImap']();}return null;})[_0x6bd0('0xf')](respondWithResult(_0x23228c,null))[_0x6bd0('0x1a')](handleError(_0x23228c,null));};exports[_0x6bd0('0x7c')]=function(_0x41a8b6,_0x1703c0){if(_0x41a8b6[_0x6bd0('0x5e')]['id']){delete _0x41a8b6[_0x6bd0('0x5e')]['id'];}return db['MailAccount'][_0x6bd0('0x6e')]({'where':{'id':_0x41a8b6['params']['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x1703c0,null))[_0x6bd0('0xf')](function(_0x280d5b){if(_0x280d5b){_0x41a8b6[_0x6bd0('0x5e')]['MailAccountId']=_0x280d5b['id'];return db[_0x6bd0('0x40')][_0x6bd0('0x69')](_0x41a8b6[_0x6bd0('0x5e')]);}})[_0x6bd0('0xf')](respondWithResult(_0x1703c0,null))[_0x6bd0('0x1a')](handleError(_0x1703c0,null));};exports[_0x6bd0('0x7d')]=function(_0x5a3e96,_0x234cbe){return db[_0x6bd0('0x56')][_0x6bd0('0x6b')]({'where':{'id':_0x5a3e96[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x234cbe,null))['then'](function(_0x1aa0c7){if(_0x1aa0c7){return _0x1aa0c7['setImap'](null);}return null;})[_0x6bd0('0xf')](respondWithStatusCode(_0x234cbe,null))[_0x6bd0('0x1a')](handleError(_0x234cbe,null));};exports[_0x6bd0('0x7e')]=function(_0x60258c,_0x4bcbc2){return db['MailAccount']['findOne']({'where':{'id':_0x60258c[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x4bcbc2,null))[_0x6bd0('0xf')](function(_0x357e6f){if(_0x357e6f){return _0x357e6f[_0x6bd0('0x7e')]();}return null;})[_0x6bd0('0xf')](respondWithResult(_0x4bcbc2,null))['catch'](handleError(_0x4bcbc2,null));};exports['addSmtp']=function(_0x18b4a7,_0x2b1748){if(_0x18b4a7[_0x6bd0('0x5e')]['id']){delete _0x18b4a7[_0x6bd0('0x5e')]['id'];}return db[_0x6bd0('0x56')][_0x6bd0('0x6e')]({'where':{'id':_0x18b4a7[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x2b1748,null))[_0x6bd0('0xf')](function(_0x57e1cf){if(_0x57e1cf){_0x18b4a7[_0x6bd0('0x5e')][_0x6bd0('0x67')]=_0x57e1cf['id'];return db['MailServerOut'][_0x6bd0('0x69')](_0x18b4a7[_0x6bd0('0x5e')]);}})[_0x6bd0('0xf')](respondWithResult(_0x2b1748,null))[_0x6bd0('0x1a')](handleError(_0x2b1748,null));};exports['removeSmtp']=function(_0x3e86e0,_0x2414e2){return db[_0x6bd0('0x56')][_0x6bd0('0x6b')]({'where':{'id':_0x3e86e0[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x2414e2,null))[_0x6bd0('0xf')](function(_0xcbefef){if(_0xcbefef){return _0xcbefef[_0x6bd0('0x7f')](null);}return null;})[_0x6bd0('0xf')](respondWithStatusCode(_0x2414e2,null))[_0x6bd0('0x1a')](handleError(_0x2414e2,null));};exports['addInteraction']=function(_0x3fc8ea,_0x451e5a){return db[_0x6bd0('0x80')][_0x6bd0('0x6e')]({'where':{'id':_0x3fc8ea[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x451e5a,null))[_0x6bd0('0xf')](function(_0xde34f4){if(_0xde34f4){return _0xde34f4['addInteraction'](_0x3fc8ea[_0x6bd0('0x5e')][_0x6bd0('0x70')],_['omit'](_0x3fc8ea[_0x6bd0('0x5e')],[_0x6bd0('0x70'),'id'])||{});}})[_0x6bd0('0xf')](respondWithResult(_0x451e5a,null))['catch'](handleError(_0x451e5a,null));};exports[_0x6bd0('0x81')]=function(_0x57644f,_0x543d83){var _0x5f4f60={'raw':![],'where':{}};var _0x10e249={};var _0x4cfefd={'count':0x0,'rows':[]};return db[_0x6bd0('0x56')][_0x6bd0('0x6b')]({'where':{'id':_0x57644f['params']['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x543d83,null))[_0x6bd0('0xf')](function(_0x371414){if(_0x371414){_0x10e249[_0x6bd0('0x49')]=_[_0x6bd0('0x5b')](db[_0x6bd0('0x80')][_0x6bd0('0x44')]);_0x10e249[_0x6bd0('0x47')]=_[_0x6bd0('0x5b')](_0x57644f[_0x6bd0('0x47')]);_0x10e249[_0x6bd0('0x5c')]=_[_0x6bd0('0x48')](_0x10e249['model'],_0x10e249[_0x6bd0('0x47')]);_0x5f4f60[_0x6bd0('0x4a')]=_['intersection'](_0x10e249[_0x6bd0('0x49')],qs[_0x6bd0('0x4b')](_0x57644f[_0x6bd0('0x47')][_0x6bd0('0x4b')]));_0x5f4f60[_0x6bd0('0x4a')]=_0x5f4f60[_0x6bd0('0x4a')][_0x6bd0('0x4c')]?_0x5f4f60[_0x6bd0('0x4a')]:_0x10e249[_0x6bd0('0x49')];if(!_0x57644f[_0x6bd0('0x47')][_0x6bd0('0x4d')](_0x6bd0('0x4e'))){_0x5f4f60[_0x6bd0('0x21')]=qs['limit'](_0x57644f[_0x6bd0('0x47')][_0x6bd0('0x21')]);_0x5f4f60[_0x6bd0('0x1f')]=qs[_0x6bd0('0x1f')](_0x57644f['query'][_0x6bd0('0x1f')]);}_0x5f4f60[_0x6bd0('0x4f')]=qs[_0x6bd0('0x50')](_0x57644f[_0x6bd0('0x47')][_0x6bd0('0x50')]);_0x5f4f60[_0x6bd0('0x52')]=qs['filters'](_[_0x6bd0('0x6c')](_0x57644f['query'],_0x10e249['filters']));_0x5f4f60[_0x6bd0('0x52')][_0x6bd0('0x67')]=_0x371414['id'];if(_0x57644f[_0x6bd0('0x47')][_0x6bd0('0x51')]){_0x5f4f60['where']=_[_0x6bd0('0x53')](_0x5f4f60[_0x6bd0('0x52')],{'$or':_['map'](_0x5f4f60[_0x6bd0('0x4a')],function(_0x35b11b){var _0x162a20={};_0x162a20[_0x35b11b]={'$like':'%'+_0x57644f[_0x6bd0('0x47')][_0x6bd0('0x51')]+'%'};return _0x162a20;})});}_0x5f4f60=_[_0x6bd0('0x53')]({},_0x5f4f60,_0x57644f[_0x6bd0('0x55')]);return db['MailInteraction'][_0x6bd0('0x22')]({'where':_0x5f4f60[_0x6bd0('0x52')]})[_0x6bd0('0xf')](function(_0x46307c){_0x4cfefd[_0x6bd0('0x22')]=_0x46307c;if(_0x57644f[_0x6bd0('0x47')]['includeAll']){_0x5f4f60[_0x6bd0('0x58')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x6bd0('0x82')],'as':_0x6bd0('0x83'),'attributes':[_0x6bd0('0x2a'),_0x6bd0('0x84'),_0x6bd0('0x85')],'required':![]},{'model':db[_0x6bd0('0x86')],'as':'Tags','attributes':['id','name',_0x6bd0('0x87')],'where':_0x57644f[_0x6bd0('0x47')]['tag']?{'id':_0x57644f[_0x6bd0('0x47')]['tag']}:undefined,'required':_0x57644f[_0x6bd0('0x47')][_0x6bd0('0x88')]?!![]:![]}];}return db[_0x6bd0('0x80')]['findAll'](_0x5f4f60);})[_0x6bd0('0xf')](function(_0x2e0bab){_0x4cfefd[_0x6bd0('0x59')]=_0x2e0bab;return _0x4cfefd;});}})[_0x6bd0('0xf')](respondWithFilteredResult(_0x543d83,_0x5f4f60))[_0x6bd0('0x1a')](handleError(_0x543d83,null));};exports['addApplications']=function addApplications(_0x2f11c1,_0x15ffa9){var _0x5c7035=_0x2f11c1[_0x6bd0('0x62')]['id'];var _0x55ec9a=_0x2f11c1['body'];var _0x147f5d=0xc8;var _0x3162ce=null;return db[_0x6bd0('0x89')][_0x6bd0('0x8a')]({'isolationLevel':db[_0x6bd0('0x89')][_0x6bd0('0x8b')][_0x6bd0('0x8c')]['READ_COMMITTED']},function(_0x21cdc7){return db['MailAccount'][_0x6bd0('0x6b')]({'where':{'id':_0x5c7035},'transaction':_0x21cdc7})['then'](function(_0x22af91){if(_0x22af91){return db['MailApplication'][_0x6bd0('0x25')]({'where':{'MailAccountId':_0x5c7035},'transaction':_0x21cdc7})[_0x6bd0('0xf')](function(){var _0x77d0e2=_['map'](_0x55ec9a,function(_0x3271b4){_0x3271b4[_0x6bd0('0x67')]=_0x5c7035;return _0x3271b4;});return db[_0x6bd0('0x8d')][_0x6bd0('0x8e')](_0x77d0e2,{'transaction':_0x21cdc7});});}else{_0x147f5d=0x194;_0x3162ce=[];}});})[_0x6bd0('0xf')](function(){if(_0x147f5d!==0x194){return db[_0x6bd0('0x8d')][_0x6bd0('0x8f')]({'where':{'MailAccountId':_0x5c7035},'order':'priority'})[_0x6bd0('0xf')](function(_0x3f8b7b){_0x3162ce=_0x3f8b7b;});}})['catch'](function(_0x540c64){_0x147f5d=0x1f4;logger[_0x6bd0('0x14')](_0x540c64[_0x6bd0('0x29')]);if(_0x540c64['name']){delete _0x540c64[_0x6bd0('0x2a')];}_0x3162ce=_0x540c64;})['finally'](function(){if(_0x3162ce===null){_0x15ffa9[_0x6bd0('0x1b')](_0x147f5d);}else{if(_0x147f5d===0x1f4){_0x15ffa9['status'](_0x147f5d)[_0x6bd0('0x2b')](_0x3162ce);}else{_0x15ffa9[_0x6bd0('0x1c')](_0x147f5d)[_0x6bd0('0x1e')](_0x3162ce);}}});};exports[_0x6bd0('0x90')]=function(_0x2d4beb,_0x524c4e){var _0x26cb7a={};var _0x202675={};var _0x4ee696;var _0xf7cc3c;return db[_0x6bd0('0x56')][_0x6bd0('0x6b')]({'where':{'id':_0x2d4beb[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x524c4e,null))[_0x6bd0('0xf')](function(_0x1321ba){if(_0x1321ba){_0x4ee696=_0x1321ba;_0x202675[_0x6bd0('0x49')]=_[_0x6bd0('0x5b')](db[_0x6bd0('0x8d')]['rawAttributes']);_0x202675[_0x6bd0('0x47')]=_['keys'](_0x2d4beb['query']);_0x202675['filters']=_[_0x6bd0('0x48')](_0x202675[_0x6bd0('0x49')],_0x202675['query']);_0x26cb7a[_0x6bd0('0x4a')]=_['intersection'](_0x202675[_0x6bd0('0x49')],qs[_0x6bd0('0x4b')](_0x2d4beb[_0x6bd0('0x47')][_0x6bd0('0x4b')]));_0x26cb7a[_0x6bd0('0x4a')]=_0x26cb7a[_0x6bd0('0x4a')][_0x6bd0('0x4c')]?_0x26cb7a[_0x6bd0('0x4a')]:_0x202675[_0x6bd0('0x49')];_0x26cb7a[_0x6bd0('0x4f')]=qs[_0x6bd0('0x50')](_0x2d4beb[_0x6bd0('0x47')][_0x6bd0('0x50')]);_0x26cb7a['where']=qs['filters'](_[_0x6bd0('0x6c')](_0x2d4beb[_0x6bd0('0x47')],_0x202675['filters']));if(_0x2d4beb[_0x6bd0('0x47')][_0x6bd0('0x51')]){_0x26cb7a[_0x6bd0('0x52')]=_['merge'](_0x26cb7a[_0x6bd0('0x52')],{'$or':_[_0x6bd0('0x43')](_0x26cb7a[_0x6bd0('0x4a')],function(_0x4772e5){var _0x4cc13a={};_0x4cc13a[_0x4772e5]={'$like':'%'+_0x2d4beb['query']['filter']+'%'};return _0x4cc13a;})});}_0x26cb7a=_['merge']({},_0x26cb7a,_0x2d4beb['options']);return _0x4ee696[_0x6bd0('0x90')](_0x26cb7a);}})['then'](function(_0xc8b19f){if(_0xc8b19f){_0xf7cc3c=_0xc8b19f[_0x6bd0('0x4c')];if(!_0x2d4beb['query'][_0x6bd0('0x4d')](_0x6bd0('0x4e'))){_0x26cb7a[_0x6bd0('0x21')]=qs[_0x6bd0('0x21')](_0x2d4beb[_0x6bd0('0x47')][_0x6bd0('0x21')]);_0x26cb7a[_0x6bd0('0x1f')]=qs[_0x6bd0('0x1f')](_0x2d4beb[_0x6bd0('0x47')]['offset']);}return _0x4ee696[_0x6bd0('0x90')](_0x26cb7a);}})['then'](function(_0x3c4b89){if(_0x3c4b89){return _0x3c4b89?{'count':_0xf7cc3c,'rows':_0x3c4b89}:null;}})[_0x6bd0('0xf')](respondWithResult(_0x524c4e,null))[_0x6bd0('0x1a')](handleError(_0x524c4e,null));};exports[_0x6bd0('0x91')]=function(_0x5cd880,_0x110e10){var _0x55c52c={'raw':!![],'where':{}};var _0x172bff={};var _0x5ce2aa={'count':0x0,'rows':[]};return db[_0x6bd0('0x56')]['findOne']({'where':{'id':_0x5cd880[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x110e10,null))[_0x6bd0('0xf')](function(_0x47b846){if(_0x47b846){_0x172bff[_0x6bd0('0x49')]=_[_0x6bd0('0x5b')](db['MailMessage']['rawAttributes']);_0x172bff[_0x6bd0('0x47')]=_[_0x6bd0('0x5b')](_0x5cd880['query']);_0x172bff[_0x6bd0('0x5c')]=_[_0x6bd0('0x48')](_0x172bff[_0x6bd0('0x49')],_0x172bff[_0x6bd0('0x47')]);_0x55c52c[_0x6bd0('0x4a')]=_['intersection'](_0x172bff[_0x6bd0('0x49')],qs[_0x6bd0('0x4b')](_0x5cd880[_0x6bd0('0x47')][_0x6bd0('0x4b')]));_0x55c52c[_0x6bd0('0x4a')]=_0x55c52c[_0x6bd0('0x4a')]['length']?_0x55c52c[_0x6bd0('0x4a')]:_0x172bff[_0x6bd0('0x49')];if(!_0x5cd880[_0x6bd0('0x47')][_0x6bd0('0x4d')]('nolimit')){_0x55c52c['limit']=qs[_0x6bd0('0x21')](_0x5cd880['query']['limit']);_0x55c52c[_0x6bd0('0x1f')]=qs['offset'](_0x5cd880[_0x6bd0('0x47')][_0x6bd0('0x1f')]);}_0x55c52c[_0x6bd0('0x4f')]=qs[_0x6bd0('0x50')](_0x5cd880[_0x6bd0('0x47')]['sort']);_0x55c52c[_0x6bd0('0x52')]=qs[_0x6bd0('0x5c')](_['pick'](_0x5cd880[_0x6bd0('0x47')],_0x172bff['filters']));_0x55c52c[_0x6bd0('0x52')][_0x6bd0('0x67')]=_0x47b846['id'];if(_0x5cd880[_0x6bd0('0x47')][_0x6bd0('0x51')]){_0x55c52c[_0x6bd0('0x52')]=_[_0x6bd0('0x53')](_0x55c52c[_0x6bd0('0x52')],{'$or':_[_0x6bd0('0x43')](_0x55c52c[_0x6bd0('0x4a')],function(_0x170d85){var _0x4fde8b={};_0x4fde8b[_0x170d85]={'$like':'%'+_0x5cd880[_0x6bd0('0x47')][_0x6bd0('0x51')]+'%'};return _0x4fde8b;})});}if(_0x5cd880[_0x6bd0('0x47')][_0x6bd0('0x92')]){var _0x481109=_0x5cd880[_0x6bd0('0x47')]['$gte'][_0x6bd0('0x93')](',');var _0x9c9621={};_0x9c9621[_0x481109[0x0]]={'$gte':moment(_0x481109[0x1])[_0x6bd0('0x94')]('YYYY-MM-DD\x20HH:mm:ss')};_0x55c52c[_0x6bd0('0x52')]=_[_0x6bd0('0x53')](_0x55c52c[_0x6bd0('0x52')],_0x9c9621);}_0x55c52c=_['merge']({},_0x55c52c,_0x5cd880[_0x6bd0('0x55')]);return db['MailMessage']['count']({'where':_0x55c52c['where']})[_0x6bd0('0xf')](function(_0x1be624){_0x5ce2aa[_0x6bd0('0x22')]=_0x1be624;if(_0x5cd880[_0x6bd0('0x47')]['includeAll']){_0x55c52c[_0x6bd0('0x58')]=[{'all':!![]}];}return db[_0x6bd0('0x95')]['findAll'](_0x55c52c);})[_0x6bd0('0xf')](function(_0x53a646){if(_0x5cd880[_0x6bd0('0x47')]['inlineCss']===_0x6bd0('0x96')){for(var _0x5c8334=0x0;_0x5c8334<_0x53a646[_0x6bd0('0x4c')];_0x5c8334++){_0x53a646[_0x5c8334][_0x6bd0('0x5e')]=juice(_0x53a646[_0x5c8334][_0x6bd0('0x5e')]);}}_0x5ce2aa[_0x6bd0('0x59')]=_0x53a646;return _0x5ce2aa;});}})[_0x6bd0('0xf')](respondWithFilteredResult(_0x110e10,_0x55c52c))[_0x6bd0('0x1a')](handleError(_0x110e10,null));};exports[_0x6bd0('0x2b')]=function(_0x3991fb,_0x114fb2){var _0x1c8d55,_0x223e5d={},_0x3190a8;if(_0x3991fb['body']['to']){_0x3190a8=_0x3991fb['body']['to'][_0x6bd0('0x93')](',')[0x0];}return db[_0x6bd0('0x56')][_0x6bd0('0x6e')]({'where':{'id':_0x3991fb[_0x6bd0('0x62')]['id']},'include':[{'model':db[_0x6bd0('0x97')],'as':_0x6bd0('0x98'),'include':[{'model':db[_0x6bd0('0x99')],'as':'Contacts','where':{'email':_0x3190a8},'limit':0x1,'order':[[_0x6bd0('0x9a'),'DESC']]}]},{'model':db[_0x6bd0('0x41')],'as':_0x6bd0('0x42'),'raw':!![],'include':[{'model':db[_0x6bd0('0x9b')],'as':_0x6bd0('0x9b'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x114fb2,null))[_0x6bd0('0xf')](function(_0x1c47f9){if(!_0x1c47f9)return;_0x1c8d55=_0x1c47f9;if(!_0x1c47f9[_0x6bd0('0x42')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x3991fb['body']['from'])){_0x3991fb[_0x6bd0('0x5e')][_0x6bd0('0x9c')]=util[_0x6bd0('0x94')](_0x6bd0('0x9d'),_0x1c47f9[_0x6bd0('0x2a')],_0x1c47f9['email']||_0x1c47f9['Smtp'][_0x6bd0('0x34')]);}if(_0x3991fb['body'][_0x6bd0('0x9e')]&&_0x3991fb[_0x6bd0('0x5e')][_0x6bd0('0x9e')][_0x6bd0('0x4c')]){for(var _0x89fbc7=0x0;_0x89fbc7<_0x3991fb[_0x6bd0('0x5e')][_0x6bd0('0x9e')][_0x6bd0('0x4c')];_0x89fbc7+=0x1){_0x3991fb[_0x6bd0('0x5e')][_0x6bd0('0x9e')][_0x89fbc7]={'filename':_0x3991fb['body'][_0x6bd0('0x9e')][_0x89fbc7][_0x6bd0('0x2a')],'path':path[_0x6bd0('0x9f')](config[_0x6bd0('0xa0')],_0x6bd0('0xa1'),_0x3991fb[_0x6bd0('0x5e')][_0x6bd0('0x9e')][_0x89fbc7][_0x6bd0('0xa2')])};}}var _0x4454c0=_0x1c47f9[_0x6bd0('0xa3')]();return respondWithRpcPromise('SendMail',_0x6bd0('0xa4'),{'account':_0x4454c0,'message':_0x3991fb[_0x6bd0('0x5e')]});})[_0x6bd0('0xf')](function(_0x3679ad){if(!_0x3679ad)return;_0x223e5d=_0x3679ad;if(!_0x1c8d55['List'])throw new Error(_0x6bd0('0xa5'));if(_0x1c8d55[_0x6bd0('0x98')][_0x6bd0('0xa6')][_0x6bd0('0x4c')])return _0x1c8d55[_0x6bd0('0x98')]['Contacts'][0x0];return db[_0x6bd0('0x99')][_0x6bd0('0x69')](_[_0x6bd0('0xa7')](_0x3991fb[_0x6bd0('0x5e')],{'firstName':_0x3991fb[_0x6bd0('0x5e')]['to'],'email':_0x3991fb[_0x6bd0('0x5e')]['to'],'phone':_0x3991fb['body']['to'],'ListId':_0x1c8d55[_0x6bd0('0xa8')]}));})[_0x6bd0('0xf')](function(_0x475ef7){if(!_0x475ef7)return;var _0xcb0ff1={'UserId':_0x3991fb['user']['id'],'ContactId':_0x475ef7['id'],'MailAccountId':_0x1c8d55['id'],'inReplyTo':_0x223e5d['messageId'],'to':_0x3991fb[_0x6bd0('0x5e')][_0x6bd0('0x9c')],'cc':_0x3991fb[_0x6bd0('0x5e')]['cc'],'subject':_0x3991fb[_0x6bd0('0x5e')][_0x6bd0('0xa9')],'attach':_0x3991fb[_0x6bd0('0x5e')][_0x6bd0('0xaa')],'firstMsgDirection':_0x6bd0('0xab'),'lastMsgAt':moment()[_0x6bd0('0x94')](_0x6bd0('0xac')),'lastMsgDirection':'out','Messages':[_[_0x6bd0('0x53')](_0x3991fb[_0x6bd0('0x5e')],{'messageId':_0x223e5d[_0x6bd0('0xad')],'sentAt':moment()[_0x6bd0('0x94')](_0x6bd0('0xac')),'read':!![],'MailAccountId':_0x1c8d55['id'],'UserId':_0x3991fb['user']['id'],'ContactId':_0x475ef7['id']})]};if(_0x3991fb[_0x6bd0('0x5e')][_0x6bd0('0xae')]){_0xcb0ff1=_[_0x6bd0('0x53')](_0xcb0ff1,_0x3991fb[_0x6bd0('0x5e')]['Interaction']);}return db[_0x6bd0('0x80')][_0x6bd0('0x69')](_0xcb0ff1,{'include':[{'model':db[_0x6bd0('0x95')],'as':'Messages'}]});})['then'](respondWithResult(_0x114fb2,null))[_0x6bd0('0x1a')](handleError(_0x114fb2,null));};exports[_0x6bd0('0xaf')]=function(_0x11e206,_0x4bfacb){return db[_0x6bd0('0x56')]['find']({'where':{'id':_0x11e206['params']['id']},'include':[{'model':db[_0x6bd0('0x41')],'as':_0x6bd0('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6bd0('0x9b'),'raw':!![]}]}]})[_0x6bd0('0xf')](handleEntityNotFound(_0x4bfacb,null))[_0x6bd0('0xf')](function(_0x3bc7a3){if(!_0x3bc7a3['Smtp'])return;var _0x3a5128=_0x3bc7a3['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x3a5128});})[_0x6bd0('0xf')](respondWithResult(_0x4bfacb,null))[_0x6bd0('0x1a')](handleError(_0x4bfacb,null));};exports[_0x6bd0('0x25')]=function(_0x189cc5,_0x50de9f){return db['MailAccount'][_0x6bd0('0x6e')]({'where':{'id':_0x189cc5[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x50de9f,null))[_0x6bd0('0xf')](function(_0x35e4df){if(_0x35e4df&&_0x35e4df[_0x6bd0('0x3c')]){throw new db[(_0x6bd0('0xb0'))][(_0x6bd0('0xb1'))](_0x6bd0('0xb2'));}return _0x35e4df;})['then'](removeEntity(_0x50de9f,null))[_0x6bd0('0x1a')](handleError(_0x50de9f,null));};exports['addAgents']=function(_0x1c5ac4,_0x311c77){return db[_0x6bd0('0x56')][_0x6bd0('0x6e')]({'where':{'id':_0x1c5ac4[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x311c77,null))[_0x6bd0('0xf')](function(_0x28a6ba){if(_0x28a6ba){return _0x28a6ba['addAgents'](_0x1c5ac4['body'][_0x6bd0('0x70')],_['omit'](_0x1c5ac4['body'],[_0x6bd0('0x70'),'id'])||{})[_0x6bd0('0xb3')](function(_0x56d15e){for(var _0x1cfd2b=0x0;_0x1cfd2b<_0x1c5ac4['body']['ids'][_0x6bd0('0x4c')];_0x1cfd2b+=0x1){socket[_0x6bd0('0xb4')](_0x6bd0('0xb5'),{'UserId':Number(_0x1c5ac4[_0x6bd0('0x5e')]['ids'][_0x1cfd2b]),'MailAccountId':Number(_0x1c5ac4[_0x6bd0('0x62')]['id'])});}return _0x56d15e;});}})['then'](respondWithResult(_0x311c77,null))[_0x6bd0('0x1a')](handleError(_0x311c77,null));};exports[_0x6bd0('0xb6')]=function(_0x117e5c,_0xc9d963){return db[_0x6bd0('0x56')][_0x6bd0('0x6e')]({'where':{'id':_0x117e5c[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0xc9d963,null))['then'](function(_0x545421){if(_0x545421){return _0x545421[_0x6bd0('0xb6')](_0x117e5c['query'][_0x6bd0('0x70')])[_0x6bd0('0xf')](function(){if(_['isArray'](_0x117e5c[_0x6bd0('0x47')]['ids'])){for(var _0xe4e68=0x0;_0xe4e68<_0x117e5c['query'][_0x6bd0('0x70')][_0x6bd0('0x4c')];_0xe4e68+=0x1){socket[_0x6bd0('0xb4')](_0x6bd0('0xb7'),{'UserId':Number(_0x117e5c[_0x6bd0('0x47')][_0x6bd0('0x70')][_0xe4e68]),'MailAccountId':Number(_0x117e5c[_0x6bd0('0x62')]['id'])});}}else{socket[_0x6bd0('0xb4')]('userMailAccount:remove',{'UserId':Number(_0x117e5c[_0x6bd0('0x47')][_0x6bd0('0x70')]),'MailAccountId':Number(_0x117e5c['params']['id'])});}});}})['then'](respondWithStatusCode(_0xc9d963,null))['catch'](handleError(_0xc9d963,null));};exports['getAgents']=function(_0x1f7c92,_0x2f38d7){var _0x269caa={};var _0x3cfaa9={};var _0x2f4aaf;var _0x3bf970;return db[_0x6bd0('0x56')][_0x6bd0('0x6b')]({'where':{'id':_0x1f7c92[_0x6bd0('0x62')]['id']}})[_0x6bd0('0xf')](handleEntityNotFound(_0x2f38d7,null))[_0x6bd0('0xf')](function(_0x5eecb7){if(_0x5eecb7){_0x2f4aaf=_0x5eecb7;_0x3cfaa9['model']=_['keys'](db[_0x6bd0('0x82')][_0x6bd0('0x44')]);_0x3cfaa9[_0x6bd0('0x47')]=_[_0x6bd0('0x5b')](_0x1f7c92[_0x6bd0('0x47')]);_0x3cfaa9['filters']=_['intersection'](_0x3cfaa9[_0x6bd0('0x49')],_0x3cfaa9[_0x6bd0('0x47')]);_0x269caa[_0x6bd0('0x4a')]=_[_0x6bd0('0x48')](_0x3cfaa9[_0x6bd0('0x49')],qs[_0x6bd0('0x4b')](_0x1f7c92['query'][_0x6bd0('0x4b')]));_0x269caa[_0x6bd0('0x4a')]=_0x269caa['attributes'][_0x6bd0('0x4c')]?_0x269caa[_0x6bd0('0x4a')]:_0x3cfaa9[_0x6bd0('0x49')];_0x269caa[_0x6bd0('0x4f')]=qs[_0x6bd0('0x50')](_0x1f7c92[_0x6bd0('0x47')][_0x6bd0('0x50')]);_0x269caa['where']=qs[_0x6bd0('0x5c')](_['pick'](_0x1f7c92[_0x6bd0('0x47')],_0x3cfaa9[_0x6bd0('0x5c')]));if(_0x1f7c92[_0x6bd0('0x47')][_0x6bd0('0x51')]){_0x269caa['where']=_[_0x6bd0('0x53')](_0x269caa[_0x6bd0('0x52')],{'$or':_['map'](_0x269caa['attributes'],function(_0x4d32b5){var _0x46201a={};_0x46201a[_0x4d32b5]={'$like':'%'+_0x1f7c92[_0x6bd0('0x47')][_0x6bd0('0x51')]+'%'};return _0x46201a;})});}_0x269caa=_[_0x6bd0('0x53')]({},_0x269caa,_0x1f7c92[_0x6bd0('0x55')]);return _0x2f4aaf[_0x6bd0('0xb8')](_0x269caa);}})[_0x6bd0('0xf')](function(_0x51deee){if(_0x51deee){_0x3bf970=_0x51deee['length'];if(!_0x1f7c92[_0x6bd0('0x47')][_0x6bd0('0x4d')](_0x6bd0('0x4e'))){_0x269caa[_0x6bd0('0x21')]=qs['limit'](_0x1f7c92[_0x6bd0('0x47')][_0x6bd0('0x21')]);_0x269caa[_0x6bd0('0x1f')]=qs['offset'](_0x1f7c92[_0x6bd0('0x47')][_0x6bd0('0x1f')]);}return _0x2f4aaf['getAgents'](_0x269caa);}})[_0x6bd0('0xf')](function(_0x58dd96){if(_0x58dd96){return _0x58dd96?{'count':_0x3bf970,'rows':_0x58dd96}:null;}})['then'](respondWithResult(_0x2f38d7,null))['catch'](handleError(_0x2f38d7,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index cf7ec8f..56b86f2 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 _0x2a07=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x1db558,_0x519349){var _0xf5dd19=function(_0x216fe5){while(--_0x216fe5){_0x1db558['push'](_0x1db558['shift']());}};_0xf5dd19(++_0x519349);}(_0x2a07,0x74));var _0x72a0=function(_0x1f96d7,_0x20d141){_0x1f96d7=_0x1f96d7-0x0;var _0x728705=_0x2a07[_0x1f96d7];return _0x728705;};'use strict';var EventEmitter=require(_0x72a0('0x0'));var MailAccount=require(_0x72a0('0x1'))['db'][_0x72a0('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x72a0('0x3')](0x0);var events={'afterCreate':_0x72a0('0x4'),'afterUpdate':'update','afterDestroy':_0x72a0('0x5')};function emitEvent(_0x5f7f29){return function(_0x135982,_0x45b155,_0x431f65){MailAccountEvents[_0x72a0('0x6')](_0x5f7f29+':'+_0x135982['id'],_0x135982);MailAccountEvents[_0x72a0('0x6')](_0x5f7f29,_0x135982);_0x431f65(null);};}for(var e in events){if(events[_0x72a0('0x7')](e)){var event=events[e];MailAccount[_0x72a0('0x8')](e,emitEvent(event));}}module[_0x72a0('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x6c20=['hasOwnProperty','hook','exports','events','../../mysqldb','save','emit'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x6c20,0x88));var _0x06c2=function(_0x157dca,_0x4f74f1){_0x157dca=_0x157dca-0x0;var _0x3908ae=_0x6c20[_0x157dca];return _0x3908ae;};'use strict';var EventEmitter=require(_0x06c2('0x0'));var MailAccount=require(_0x06c2('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x06c2('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x6beb91){return function(_0xecb676,_0x169412,_0x2c7843){MailAccountEvents[_0x06c2('0x3')](_0x6beb91+':'+_0xecb676['id'],_0xecb676);MailAccountEvents[_0x06c2('0x3')](_0x6beb91,_0xecb676);_0x2c7843(null);};}for(var e in events){if(events[_0x06c2('0x4')](e)){var event=events[e];MailAccount[_0x06c2('0x5')](e,emitEvent(event));}}module[_0x06c2('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 03af0eb..1dcac08 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 _0x98f0=['modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','CloudProvider','data5','pass','./mailAccount.attributes','exports','mail_accounts','service','provider','host','Smtp','port','secure','authentication'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x98f0,0x6d));var _0x098f=function(_0x4ae3fd,_0x1d3481){_0x4ae3fd=_0x4ae3fd-0x0;var _0x491024=_0x98f0[_0x4ae3fd];return _0x491024;};'use strict';var attributes=require(_0x098f('0x0'));module[_0x098f('0x1')]=function(_0x37b29b){return _0x37b29b['define']('MailAccount',attributes,{'tableName':_0x098f('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x376970=this;var _0x50afc9={'id':_0x376970['id'],'tls':{'rejectUnauthorized':![]}};if(_0x376970['provider']!=='custom'){_0x50afc9[_0x098f('0x3')]=_0x376970[_0x098f('0x4')];}else{_0x50afc9[_0x098f('0x5')]=_0x376970[_0x098f('0x6')][_0x098f('0x5')];_0x50afc9[_0x098f('0x7')]=_0x376970['Smtp']['port'];_0x50afc9['secure']=_0x376970[_0x098f('0x6')][_0x098f('0x8')];}if(_0x376970[_0x098f('0x6')][_0x098f('0x9')]){if(_0x376970[_0x098f('0x6')][_0x098f('0xa')]){if(!_0x376970[_0x098f('0x6')]['CloudProvider'])throw new Error(_0x098f('0xb'));_0x50afc9[_0x098f('0xc')]={'type':'OAuth2','user':_0x376970['Smtp'][_0x098f('0xd')],'accessToken':_0x376970['Smtp'][_0x098f('0xe')][_0x098f('0xf')]};}else{_0x50afc9['auth']={'user':_0x376970['Smtp'][_0x098f('0xd')],'pass':_0x376970['Smtp'][_0x098f('0x10')]};}}return _0x50afc9;}}});}; \ No newline at end of file +var _0x2bba=['define','MailAccount','mail_accounts','provider','custom','host','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','./mailAccount.attributes','exports'];(function(_0x5cca46,_0x17c558){var _0xc8264f=function(_0x3d03f8){while(--_0x3d03f8){_0x5cca46['push'](_0x5cca46['shift']());}};_0xc8264f(++_0x17c558);}(_0x2bba,0x12e));var _0xa2bb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2bba[_0x17d9e3];return _0x14192d;};'use strict';var attributes=require(_0xa2bb('0x0'));module[_0xa2bb('0x1')]=function(_0x384c46){return _0x384c46[_0xa2bb('0x2')](_0xa2bb('0x3'),attributes,{'tableName':_0xa2bb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x45a9c5=this;var _0x1e7832={'id':_0x45a9c5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x45a9c5[_0xa2bb('0x5')]!==_0xa2bb('0x6')){_0x1e7832['service']=_0x45a9c5[_0xa2bb('0x5')];}else{_0x1e7832[_0xa2bb('0x7')]=_0x45a9c5[_0xa2bb('0x8')][_0xa2bb('0x7')];_0x1e7832[_0xa2bb('0x9')]=_0x45a9c5[_0xa2bb('0x8')][_0xa2bb('0x9')];_0x1e7832['secure']=_0x45a9c5[_0xa2bb('0x8')][_0xa2bb('0xa')];}if(_0x45a9c5['Smtp']['authentication']){if(_0x45a9c5[_0xa2bb('0x8')][_0xa2bb('0xb')]){if(!_0x45a9c5['Smtp'][_0xa2bb('0xc')])throw new Error(_0xa2bb('0xd'));_0x1e7832[_0xa2bb('0xe')]={'type':'OAuth2','user':_0x45a9c5[_0xa2bb('0x8')][_0xa2bb('0xf')],'accessToken':_0x45a9c5[_0xa2bb('0x8')][_0xa2bb('0xc')]['data5']};}else{_0x1e7832[_0xa2bb('0xe')]={'user':_0x45a9c5[_0xa2bb('0x8')][_0xa2bb('0xf')],'pass':_0x45a9c5['Smtp']['pass']};}}return _0x1e7832;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index a469dcf..01221a0 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 _0x5f2f=['Attachments','UserId','User','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','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','message','result','catch','GetMailAccount','options','where','limit','include','model','attributes','map','MailAccount','find','raw','then','smtp','smtpOptions','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','applications','Applications','priority','asc','autoclose','push','close','Contacts','length','create','messageId','subject','format','MailMessage','Messages','inReplyTo','MailInteraction','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','contact','attachments','originCc','originChannel','Email','ChatOfflineMessageId','Attachment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4e4255,_0x3e4f0c){_0x4e4255=_0x4e4255-0x0;var _0x19faa3=_0x5f2f[_0x4e4255];return _0x19faa3;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var BPromise=require(_0xf5f2('0x2'));var rs=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var db=require(_0xf5f2('0x5'))['db'];var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5f2('0x8')][_0xf5f2('0x9')]({'port':0x232c});config[_0xf5f2('0xa')]=_[_0xf5f2('0xb')](config[_0xf5f2('0xa')],{'host':_0xf5f2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5f2('0xa')]));require(_0xf5f2('0xd'))[_0xf5f2('0xe')](socket);function respondWithRpcPromise(_0x56a69f,_0x375da4,_0x15dd7c){return new BPromise(function(_0x218ae3,_0x4e0e6b){return client[_0xf5f2('0xf')](_0x56a69f,_0x15dd7c)['then'](function(_0x53fb33){logger[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x375da4,'request\x20sent');logger[_0xf5f2('0x12')](_0xf5f2('0x13'),_0x375da4,_0xf5f2('0x14'),JSON[_0xf5f2('0x15')](_0x53fb33));if(_0x53fb33[_0xf5f2('0x16')]){if(_0x53fb33[_0xf5f2('0x16')]['code']===0x1f4){logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);return _0x4e0e6b(_0x53fb33[_0xf5f2('0x16')]['message']);}logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);return _0x218ae3(_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);}else{logger[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x375da4,_0xf5f2('0x14'));_0x218ae3(_0x53fb33[_0xf5f2('0x18')][_0xf5f2('0x17')]);}})[_0xf5f2('0x19')](function(_0x4ff59b){logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x4ff59b);_0x4e0e6b(_0x4ff59b);});});}exports[_0xf5f2('0x1a')]=function(_0x1bf655){var _0x56acc5=this;return new Promise(function(_0x34706d,_0x47101e){return db['MailAccount']['findAll']({'raw':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1c')]||null:null,'attributes':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['attributes']||null:null,'limit':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1d')]||null:null,'include':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['include']?_['map'](_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')],'include':_0x294414[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x294414[_0xf5f2('0x1e')],function(_0x198c73){return{'model':db[_0x198c73[_0xf5f2('0x1f')]],'as':_0x198c73['as'],'attributes':_0x198c73['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22c826){logger[_0xf5f2('0x10')](_0xf5f2('0x1a'),_0x1bf655);logger['debug']('GetMailAccount',_0x1bf655,JSON[_0xf5f2('0x15')](_0x22c826));_0x34706d(_0x22c826);})[_0xf5f2('0x19')](function(_0x17394a){logger[_0xf5f2('0x16')](_0xf5f2('0x1a'),_0x17394a['message'],_0x1bf655);_0x47101e(_0x56acc5['error'](0x1f4,_0x17394a[_0xf5f2('0x17')]));});});};exports['ShowMailAccount']=function(_0xb744b9){var _0x58a4df=this;return new Promise(function(_0x45b643,_0x31087c){return db[_0xf5f2('0x22')][_0xf5f2('0x23')]({'raw':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x24')]===undefined?!![]:![]:!![],'where':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9['options'][_0xf5f2('0x1c')]||null:null,'attributes':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null,'include':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x1e')]?_['map'](_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes'],'include':_0x2e3cca[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x2e3cca[_0xf5f2('0x1e')],function(_0x4ec8fb){return{'model':db[_0x4ec8fb[_0xf5f2('0x1f')]],'as':_0x4ec8fb['as'],'attributes':_0x4ec8fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x25')](function(_0x566c47){if(_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x26')]===!![])_0x566c47['setDataValue'](_0xf5f2('0x27'),_0x566c47[_0xf5f2('0x28')]());logger[_0xf5f2('0x10')](_0xf5f2('0x29'),_0xb744b9);logger['debug']('ShowMailAccount',_0xb744b9,JSON[_0xf5f2('0x15')](_0x566c47));_0x45b643(_0x566c47);})[_0xf5f2('0x19')](function(_0x22b20c){logger[_0xf5f2('0x16')](_0xf5f2('0x29'),_0x22b20c[_0xf5f2('0x17')],_0xb744b9);_0x31087c(_0x58a4df[_0xf5f2('0x16')](0x1f4,_0x22b20c['message']));});});};exports[_0xf5f2('0x2a')]=function(_0x3b4ea6){var _0x536501=this;return new Promise(function(_0xc6a1ae,_0x3f3895){var _0x71b0e7={'body':_0x3b4ea6[_0xf5f2('0x2b')],'channel':_0xf5f2('0x2c')};var _0x3b6372=_[_0xf5f2('0x2d')](_[_0xf5f2('0x2e')](db['CmContact'][_0xf5f2('0x2f')]),[_0xf5f2('0x30'),_0xf5f2('0x31'),'CompanyId','ListId']);var _0x59eb00=![];if(_0x3b4ea6[_0xf5f2('0x2b')]['id']){delete _0x3b4ea6[_0xf5f2('0x2b')]['id'];}if(_['isNil'](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')])){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x33')));}if(_[_0xf5f2('0x34')](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')])||_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')]===''){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x35')));}if(_[_0xf5f2('0x34')](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x36')])){return _0x3f3895(_0x536501['error'](0x1f4,_0xf5f2('0x37')+_0x3b6372));}if(!_['includes'](_0x3b6372,_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x36')])){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x38')+_0x3b6372));}var _0x31bf0e={};_0x31bf0e[_0x3b4ea6[_0xf5f2('0x2b')]['mapKey']]=_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')];return db[_0xf5f2('0x22')][_0xf5f2('0x23')]({'where':{'id':_0x3b4ea6[_0xf5f2('0x39')]['id']},'include':[{'model':db[_0xf5f2('0x3a')],'as':_0xf5f2('0x3b'),'include':[{'model':db[_0xf5f2('0x3c')],'as':'Contacts','where':_0x31bf0e,'limit':0x1,'order':[[_0xf5f2('0x31'),_0xf5f2('0x3d')]]}]},{'model':db[_0xf5f2('0x3e')],'as':'Applications'},{'model':db[_0xf5f2('0x3f')],'as':_0xf5f2('0x40'),'include':[{'model':db[_0xf5f2('0x41')],'as':'CloudProvider'}]}]})['then'](function(_0x7bb942){if(_0x7bb942&&_0x7bb942[_0xf5f2('0x3b')]){var _0x5db519=_0x7bb942[_0xf5f2('0x42')]({'plain':!![]});_0x71b0e7['account']=_[_0xf5f2('0x43')](_0x5db519,['Applications',_0xf5f2('0x3b')]);_0x71b0e7['account'][_0xf5f2('0x27')]=_0x7bb942[_0xf5f2('0x28')]();_0x71b0e7[_0xf5f2('0x44')]=_0x5db519[_0xf5f2('0x45')];_0x71b0e7['list']=_0x5db519[_0xf5f2('0x3b')];_0x71b0e7[_0xf5f2('0x44')]=_['orderBy'](_0x71b0e7['applications'],[_0xf5f2('0x46')],[_0xf5f2('0x47')]);if(_0x71b0e7['account']&&_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x48')]){_0x71b0e7[_0xf5f2('0x44')][_0xf5f2('0x49')]({'id':0x0,'priority':_0x71b0e7['applications']['length']+0x1,'app':_0xf5f2('0x4a'),'appdata':_0xf5f2('0x48'),'interval':'*,*,*,*'});}if(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x45')]){delete _0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x45')];}if(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x3b')]){delete _0x71b0e7[_0xf5f2('0x39')]['List'];}if(_0x5db519['List'][_0xf5f2('0x4b')][_0xf5f2('0x4c')]){return _0x5db519[_0xf5f2('0x3b')][_0xf5f2('0x4b')][0x0];}var _0x21b0d3=_['defaults'](_0x3b4ea6[_0xf5f2('0x2b')],{'firstName':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')],'ListId':_0x5db519['ListId']});_0x21b0d3[_0x3b4ea6[_0xf5f2('0x2b')]['mapKey']]=_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')];return db[_0xf5f2('0x3c')][_0xf5f2('0x4d')](_0x21b0d3);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x756f1f){_0x71b0e7['contact']=_0x756f1f;if(_0x756f1f){if(!_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['messageId']){_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4e')]=rs['generate']()+'\x20'+_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')];}var _0x4579f4={'ContactId':_0x756f1f['id'],'MailAccountId':_0x3b4ea6['account']['id'],'inReplyTo':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x4e')],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')],'cc':_0x3b4ea6[_0xf5f2('0x2b')]['message']['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['attach'],'lastMsgAt':moment()[_0xf5f2('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0xf5f2('0x23')]({'where':{'closed':![],'MailAccountId':_0x3b4ea6['account']['id']},'include':[{'model':db[_0xf5f2('0x51')],'as':_0xf5f2('0x52'),'attributes':[_0xf5f2('0x4e')],'where':{'messageId':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x53')]}}]})[_0xf5f2('0x25')](function(_0x1ec682){if(_0x1ec682){return[_0x1ec682,![]];}return db[_0xf5f2('0x54')][_0xf5f2('0x4d')](_0x4579f4)[_0xf5f2('0x25')](function(_0x158768){return[_0x158768,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf5f2('0x55')](function(_0x2d171d,_0xb39a6e){if(_0x2d171d){_0x59eb00=_0xb39a6e;if(!_0xb39a6e){return _0x2d171d[_0xf5f2('0x56')]({'inReplyTo':_0x3b4ea6['body'][_0xf5f2('0x17')]['messageId'],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['from'],'cc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x2d171d['attach']?_0x2d171d[_0xf5f2('0x57')]:_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x57')],'substatus':null,'substatusAt':moment()[_0xf5f2('0x50')](_0xf5f2('0x58')),'lastMsgAt':moment()['format'](_0xf5f2('0x58')),'lastMsgDirection':'in'});}else{return _0x2d171d;}}})[_0xf5f2('0x25')](function(_0x4800fe){_0x71b0e7[_0xf5f2('0x59')]=_0x4800fe[_0xf5f2('0x42')]({'plain':!![]});_0x71b0e7[_0xf5f2('0x59')]['created']=_0x59eb00;return db['MailMessage']['create']({'body':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')],'MailAccountId':_0x3b4ea6[_0xf5f2('0x39')]['id'],'MailInteractionId':_0x4800fe['id'],'direction':'in','ContactId':_0x71b0e7[_0xf5f2('0x5a')]['id'],'messageId':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x4e')],'from':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['to'],'cc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x3b4ea6['body']['message']['attach'],'Attachments':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5b')],'originTo':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['originTo'],'originCc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5c')],'bcc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['bcc'],'ChatWebsiteId':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['ChatWebsiteId']||null,'originChannel':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5d')]||_0xf5f2('0x5e'),'ChatOfflineMessageId':_0x3b4ea6['body'][_0xf5f2('0x17')][_0xf5f2('0x5f')]||null},{'include':[{'model':db[_0xf5f2('0x60')],'as':_0xf5f2('0x61')}]});})[_0xf5f2('0x25')](function(_0x4f47e1){_0x71b0e7['message']=_0x4f47e1;if(_0x71b0e7[_0xf5f2('0x59')][_0xf5f2('0x62')]){return db[_0xf5f2('0x63')][_0xf5f2('0x23')]({'attributes':['id','name'],'where':{'id':_0x71b0e7['interaction'][_0xf5f2('0x62')]}})['then'](function(_0x4c4420){if(_0x4c4420){_0x71b0e7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xf5f2('0x64'),'appdata':_0x4c4420[_0xf5f2('0x65')]+','+(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x66')]||0xa),'interval':_0xf5f2('0x67')});}return respondWithRpcPromise(_0xf5f2('0x68'),_0xf5f2('0x69'),_0x71b0e7);});}return respondWithRpcPromise(_0xf5f2('0x68'),_0xf5f2('0x69'),_0x71b0e7);})[_0xf5f2('0x25')](function(_0x9afb3c){_0xc6a1ae(_0x9afb3c);})[_0xf5f2('0x19')](function(_0x1ba503){_0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0x1ba503[_0xf5f2('0x17')]));});});}; \ No newline at end of file +var _0x2542=['MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','asc','push','length','*,*,*,*','Contacts','contact','messageId','generate','attach','format','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originCc','ChatWebsiteId','originChannel','Email','Attachment','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','map','include','model','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication','Applications'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x2542,0x169));var _0x2254=function(_0x52cf93,_0x4864a0){_0x52cf93=_0x52cf93-0x0;var _0x3bfa06=_0x2542[_0x52cf93];return _0x3bfa06;};'use strict';var _=require(_0x2254('0x0'));var moment=require(_0x2254('0x1'));var BPromise=require(_0x2254('0x2'));var rs=require(_0x2254('0x3'));var Redis=require('ioredis');var db=require(_0x2254('0x4'))['db'];var logger=require('../../config/logger')(_0x2254('0x5'));var config=require(_0x2254('0x6'));var jayson=require(_0x2254('0x7'));var client=jayson[_0x2254('0x8')][_0x2254('0x9')]({'port':0x232c});config['redis']=_[_0x2254('0xa')](config[_0x2254('0xb')],{'host':_0x2254('0xc'),'port':0x18eb});var socket=require(_0x2254('0xd'))(new Redis(config[_0x2254('0xb')]));require(_0x2254('0xe'))[_0x2254('0xf')](socket);function respondWithRpcPromise(_0xbf1c18,_0xb395da,_0x1ae415){return new BPromise(function(_0x38fb2b,_0x5b1ab9){return client[_0x2254('0x10')](_0xbf1c18,_0x1ae415)[_0x2254('0x11')](function(_0x506abe){logger[_0x2254('0x12')]('MailAccount,\x20%s,\x20%s',_0xb395da,'request\x20sent');logger[_0x2254('0x13')](_0x2254('0x14'),_0xb395da,_0x2254('0x15'),JSON[_0x2254('0x16')](_0x506abe));if(_0x506abe[_0x2254('0x17')]){if(_0x506abe[_0x2254('0x17')]['code']===0x1f4){logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe['error'][_0x2254('0x19')]);return _0x5b1ab9(_0x506abe[_0x2254('0x17')][_0x2254('0x19')]);}logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe[_0x2254('0x17')]['message']);return _0x38fb2b(_0x506abe[_0x2254('0x17')]['message']);}else{logger[_0x2254('0x12')](_0x2254('0x18'),_0xb395da,_0x2254('0x15'));_0x38fb2b(_0x506abe[_0x2254('0x1a')][_0x2254('0x19')]);}})[_0x2254('0x1b')](function(_0x497724){logger['error']('MailAccount,\x20%s,\x20%s',_0xb395da,_0x497724);_0x5b1ab9(_0x497724);});});}exports[_0x2254('0x1c')]=function(_0x3a79f8){var _0x3c3a98=this;return new Promise(function(_0x1f1163,_0x2801d9){return db[_0x2254('0x1d')]['findAll']({'raw':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a79f8['options']?_0x3a79f8['options']['where']||null:null,'attributes':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'limit':_0x3a79f8['options']?_0x3a79f8['options']['limit']||null:null,'include':_0x3a79f8['options']?_0x3a79f8['options']['include']?_[_0x2254('0x21')](_0x3a79f8[_0x2254('0x1e')][_0x2254('0x22')],function(_0x265467){return{'model':db[_0x265467[_0x2254('0x23')]],'as':_0x265467['as'],'attributes':_0x265467[_0x2254('0x20')],'include':_0x265467['include']?_['map'](_0x265467[_0x2254('0x22')],function(_0x4f6877){return{'model':db[_0x4f6877[_0x2254('0x23')]],'as':_0x4f6877['as'],'attributes':_0x4f6877[_0x2254('0x20')],'include':_0x4f6877[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4f6877[_0x2254('0x22')],function(_0x482688){return{'model':db[_0x482688[_0x2254('0x23')]],'as':_0x482688['as'],'attributes':_0x482688[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x37af8b){logger[_0x2254('0x12')](_0x2254('0x1c'),_0x3a79f8);logger[_0x2254('0x13')](_0x2254('0x1c'),_0x3a79f8,JSON[_0x2254('0x16')](_0x37af8b));_0x1f1163(_0x37af8b);})[_0x2254('0x1b')](function(_0x21c641){logger[_0x2254('0x17')](_0x2254('0x1c'),_0x21c641[_0x2254('0x19')],_0x3a79f8);_0x2801d9(_0x3c3a98[_0x2254('0x17')](0x1f4,_0x21c641[_0x2254('0x19')]));});});};exports[_0x2254('0x24')]=function(_0x291894){var _0x2f32f8=this;return new Promise(function(_0x4e3658,_0xe29526){return db[_0x2254('0x1d')][_0x2254('0x25')]({'raw':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x26')]||null:null,'attributes':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'include':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x22')]?_[_0x2254('0x21')](_0x291894[_0x2254('0x1e')]['include'],function(_0x4a2df0){return{'model':db[_0x4a2df0[_0x2254('0x23')]],'as':_0x4a2df0['as'],'attributes':_0x4a2df0['attributes'],'include':_0x4a2df0[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4a2df0[_0x2254('0x22')],function(_0x141ddc){return{'model':db[_0x141ddc[_0x2254('0x23')]],'as':_0x141ddc['as'],'attributes':_0x141ddc[_0x2254('0x20')],'include':_0x141ddc[_0x2254('0x22')]?_['map'](_0x141ddc[_0x2254('0x22')],function(_0x192e9f){return{'model':db[_0x192e9f[_0x2254('0x23')]],'as':_0x192e9f['as'],'attributes':_0x192e9f[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x3f6007){if(_0x291894[_0x2254('0x1e')][_0x2254('0x27')]===!![])_0x3f6007[_0x2254('0x28')](_0x2254('0x29'),_0x3f6007['getSmtpOptions']());logger[_0x2254('0x12')](_0x2254('0x24'),_0x291894);logger[_0x2254('0x13')](_0x2254('0x24'),_0x291894,JSON['stringify'](_0x3f6007));_0x4e3658(_0x3f6007);})[_0x2254('0x1b')](function(_0x160fec){logger[_0x2254('0x17')](_0x2254('0x24'),_0x160fec[_0x2254('0x19')],_0x291894);_0xe29526(_0x2f32f8[_0x2254('0x17')](0x1f4,_0x160fec[_0x2254('0x19')]));});});};exports[_0x2254('0x2a')]=function(_0x4db9a8){var _0x362ad1=this;return new Promise(function(_0x5c15d7,_0x1df9c3){var _0x19b580={'body':_0x4db9a8[_0x2254('0x2b')],'channel':_0x2254('0x2c')};var _0x460bb3=_[_0x2254('0x2d')](_[_0x2254('0x2e')](db['CmContact'][_0x2254('0x2f')]),[_0x2254('0x30'),_0x2254('0x31'),_0x2254('0x32'),_0x2254('0x33')]);var _0x57cda2=![];if(_0x4db9a8[_0x2254('0x2b')]['id']){delete _0x4db9a8[_0x2254('0x2b')]['id'];}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')])){return _0x1df9c3(_0x362ad1['error'](0x1f4,_0x2254('0x36')));}if(_['isNil'](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')])||_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')]===''){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x37')));}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x39')+_0x460bb3));}if(!_[_0x2254('0x3a')](_0x460bb3,_0x4db9a8[_0x2254('0x2b')]['mapKey'])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x3b')+_0x460bb3));}var _0x2c5609={};_0x2c5609[_0x4db9a8['body'][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x1d')][_0x2254('0x25')]({'where':{'id':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x3d')],'as':_0x2254('0x3e'),'include':[{'model':db[_0x2254('0x3f')],'as':'Contacts','where':_0x2c5609,'limit':0x1,'order':[[_0x2254('0x31'),_0x2254('0x40')]]}]},{'model':db[_0x2254('0x41')],'as':_0x2254('0x42')},{'model':db[_0x2254('0x43')],'as':_0x2254('0x44'),'include':[{'model':db[_0x2254('0x45')],'as':_0x2254('0x45')}]}]})[_0x2254('0x11')](function(_0xa103ea){if(_0xa103ea&&_0xa103ea['List']){var _0x36b977=_0xa103ea[_0x2254('0x46')]({'plain':!![]});_0x19b580['account']=_[_0x2254('0x47')](_0x36b977,[_0x2254('0x42'),_0x2254('0x3e')]);_0x19b580[_0x2254('0x3c')]['smtpOptions']=_0xa103ea[_0x2254('0x48')]();_0x19b580[_0x2254('0x49')]=_0x36b977['Applications'];_0x19b580[_0x2254('0x4a')]=_0x36b977[_0x2254('0x3e')];_0x19b580[_0x2254('0x49')]=_[_0x2254('0x4b')](_0x19b580['applications'],[_0x2254('0x4c')],[_0x2254('0x4d')]);if(_0x19b580[_0x2254('0x3c')]&&_0x19b580['account']['autoclose']){_0x19b580[_0x2254('0x49')][_0x2254('0x4e')]({'id':0x0,'priority':_0x19b580['applications'][_0x2254('0x4f')]+0x1,'app':'close','appdata':'autoclose','interval':_0x2254('0x50')});}if(_0x19b580[_0x2254('0x3c')][_0x2254('0x42')]){delete _0x19b580[_0x2254('0x3c')][_0x2254('0x42')];}if(_0x19b580['account']['List']){delete _0x19b580[_0x2254('0x3c')]['List'];}if(_0x36b977[_0x2254('0x3e')][_0x2254('0x51')][_0x2254('0x4f')]){return _0x36b977[_0x2254('0x3e')]['Contacts'][0x0];}var _0xd5fb20=_[_0x2254('0xa')](_0x4db9a8['body'],{'firstName':_0x4db9a8['body'][_0x2254('0x35')],'ListId':_0x36b977['ListId']});_0xd5fb20[_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x3f')]['create'](_0xd5fb20);}else{throw new Error('List\x20not\x20found');}})[_0x2254('0x11')](function(_0x5b1bd8){_0x19b580[_0x2254('0x52')]=_0x5b1bd8;if(_0x5b1bd8){if(!_0x4db9a8['body']['message']['messageId']){_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')]=rs[_0x2254('0x54')]()+'\x20'+_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')];}var _0x25137c={'ContactId':_0x5b1bd8['id'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')],'to':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'lastMsgAt':moment()[_0x2254('0x56')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x2254('0x25')]({'where':{'closed':![],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x57')],'as':_0x2254('0x58'),'attributes':[_0x2254('0x53')],'where':{'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x59')]}}]})[_0x2254('0x11')](function(_0x4a7d36){if(_0x4a7d36){return[_0x4a7d36,![]];}return db['MailInteraction'][_0x2254('0x5a')](_0x25137c)['then'](function(_0x294931){return[_0x294931,!![]];});});}else{throw new Error(_0x2254('0x5b'));}})['spread'](function(_0x3c091e,_0x1b154f){if(_0x3c091e){_0x57cda2=_0x1b154f;if(!_0x1b154f){return _0x3c091e['update']({'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['messageId'],'to':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8['body']['message']['cc'],'subject':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x5c')],'attach':_0x3c091e['attach']?_0x3c091e[_0x2254('0x55')]:_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'substatus':null,'substatusAt':moment()['format'](_0x2254('0x5d')),'lastMsgAt':moment()['format'](_0x2254('0x5d')),'lastMsgDirection':'in'});}else{return _0x3c091e;}}})[_0x2254('0x11')](function(_0x5ed07f){_0x19b580[_0x2254('0x5e')]=_0x5ed07f[_0x2254('0x46')]({'plain':!![]});_0x19b580['interaction'][_0x2254('0x5f')]=_0x57cda2;return db[_0x2254('0x57')][_0x2254('0x5a')]({'body':_0x4db9a8[_0x2254('0x2b')]['body'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'MailInteractionId':_0x5ed07f['id'],'direction':'in','ContactId':_0x19b580[_0x2254('0x52')]['id'],'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x53')],'from':_0x4db9a8['body'][_0x2254('0x19')]['from'],'to':_0x4db9a8[_0x2254('0x2b')]['message']['to'],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8['body'][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'Attachments':_0x4db9a8['body'][_0x2254('0x19')]['attachments'],'originTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['originTo'],'originCc':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x60')],'bcc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['bcc'],'ChatWebsiteId':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x61')]||null,'originChannel':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x62')]||_0x2254('0x63'),'ChatOfflineMessageId':_0x4db9a8['body'][_0x2254('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x2254('0x64')],'as':'Attachments'}]});})['then'](function(_0x4efb07){_0x19b580[_0x2254('0x19')]=_0x4efb07;if(_0x19b580['interaction'][_0x2254('0x65')]){return db[_0x2254('0x66')]['find']({'attributes':['id',_0x2254('0x67')],'where':{'id':_0x19b580[_0x2254('0x5e')][_0x2254('0x65')]}})[_0x2254('0x11')](function(_0x259e10){if(_0x259e10){_0x19b580[_0x2254('0x49')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x259e10[_0x2254('0x67')]+','+(_0x19b580[_0x2254('0x3c')][_0x2254('0x68')]||0xa),'interval':_0x2254('0x50')});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);})[_0x2254('0x11')](function(_0x39b95b){_0x5c15d7(_0x39b95b);})['catch'](function(_0x25eb17){_0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x25eb17['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 590c941..1b46c1e 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 _0x4e5c=['remove','removeListener','register','length','mailAccount:','./mailAccount.events'];(function(_0xc8c5e1,_0x533470){var _0x572dd1=function(_0x247abe){while(--_0x247abe){_0xc8c5e1['push'](_0xc8c5e1['shift']());}};_0x572dd1(++_0x533470);}(_0x4e5c,0x149));var _0xc4e5=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x4e5c[_0x279d37];return _0x530173;};'use strict';var MailAccountEvents=require(_0xc4e5('0x0'));var events=['save',_0xc4e5('0x1'),'update'];function createListener(_0x31e94d,_0x27a49f){return function(_0x253810){_0x27a49f['emit'](_0x31e94d,_0x253810);};}function removeListener(_0x4cd665,_0x4ecd96){return function(){MailAccountEvents[_0xc4e5('0x2')](_0x4cd665,_0x4ecd96);};}exports[_0xc4e5('0x3')]=function(_0x3b4b2c){for(var _0x81444b=0x0,_0x36da95=events[_0xc4e5('0x4')];_0x81444b<_0x36da95;_0x81444b++){var _0x40c9df=events[_0x81444b];var _0x3fb6b7=createListener(_0xc4e5('0x5')+_0x40c9df,_0x3b4b2c);MailAccountEvents['on'](_0x40c9df,_0x3fb6b7);}}; \ No newline at end of file +var _0x0729=['update','emit','removeListener','register','length','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0729,0x98));var _0x9072=function(_0x787ef0,_0x5f165f){_0x787ef0=_0x787ef0-0x0;var _0x21b092=_0x0729[_0x787ef0];return _0x21b092;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x9072('0x0'),_0x9072('0x1'),_0x9072('0x2')];function createListener(_0x242e40,_0x4c0a1b){return function(_0x3ed9cf){_0x4c0a1b[_0x9072('0x3')](_0x242e40,_0x3ed9cf);};}function removeListener(_0x26d82a,_0x2c5fed){return function(){MailAccountEvents[_0x9072('0x4')](_0x26d82a,_0x2c5fed);};}exports[_0x9072('0x5')]=function(_0x1d04ac){for(var _0x5d1585=0x0,_0x2dcea8=events[_0x9072('0x6')];_0x5d1585<_0x2dcea8;_0x5d1585++){var _0x4034f2=events[_0x5d1585];var _0x2d068f=createListener('mailAccount:'+_0x4034f2,_0x1d04ac);MailAccountEvents['on'](_0x4034f2,_0x2d068f);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 6b66a69..da7906a 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 _0x285e=['express','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x18e005,_0x33ef44){var _0x3ebd6b=function(_0x2010cc){while(--_0x2010cc){_0x18e005['push'](_0x18e005['shift']());}};_0x3ebd6b(++_0x33ef44);}(_0x285e,0x14c));var _0xe285=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x285e[_0xbeb808];return _0x5d6909;};'use strict';var multer=require(_0xe285('0x0'));var util=require(_0xe285('0x1'));var path=require(_0xe285('0x2'));var timeout=require(_0xe285('0x3'));var express=require(_0xe285('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe285('0x5'));var config=require(_0xe285('0x6'));var controller=require(_0xe285('0x7'));router['get'](_0xe285('0x8'),auth[_0xe285('0x9')](),controller[_0xe285('0xa')]);router[_0xe285('0xb')]('/:id',auth[_0xe285('0x9')](),controller[_0xe285('0xc')]);router['delete'](_0xe285('0x8'),auth[_0xe285('0x9')](),controller[_0xe285('0xd')]);module['exports']=router; \ No newline at end of file +var _0xfe0f=['fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','put','update','delete','isAuthenticated','util','connect-timeout','Router'];(function(_0x494974,_0x127746){var _0xb4b664=function(_0x11d0a9){while(--_0x11d0a9){_0x494974['push'](_0x494974['shift']());}};_0xb4b664(++_0x127746);}(_0xfe0f,0x1c4));var _0xffe0=function(_0x35b331,_0x1808e4){_0x35b331=_0x35b331-0x0;var _0x72eda6=_0xfe0f[_0x35b331];return _0x72eda6;};'use strict';var multer=require('multer');var util=require(_0xffe0('0x0'));var path=require('path');var timeout=require(_0xffe0('0x1'));var express=require('express');var router=express[_0xffe0('0x2')]();var fs_extra=require(_0xffe0('0x3'));var auth=require(_0xffe0('0x4'));var interaction=require(_0xffe0('0x5'));var config=require('../../config/environment');var controller=require(_0xffe0('0x6'));router[_0xffe0('0x7')](_0xffe0('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xffe0('0x9')](_0xffe0('0x8'),auth['isAuthenticated'](),controller[_0xffe0('0xa')]);router[_0xffe0('0xb')](_0xffe0('0x8'),auth[_0xffe0('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index f764fa8..e617397 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 _0x825f=['noop','TEXT','*,*,*,*','exports','STRING'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x825f,0xbc));var _0xf825=function(_0x4a6322,_0x1dac50){_0x4a6322=_0x4a6322-0x0;var _0x4c4f0d=_0x825f[_0x4a6322];return _0x4c4f0d;};'use strict';var Sequelize=require('sequelize');module[_0xf825('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf825('0x1')],'allowNull':![],'defaultValue':_0xf825('0x2')},'appdata':{'type':Sequelize[_0xf825('0x3')]()},'description':{'type':Sequelize[_0xf825('0x1')]},'interval':{'type':Sequelize[_0xf825('0x1')],'defaultValue':_0xf825('0x4')}}; \ No newline at end of file +var _0xf0d0=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x54c683,_0xa4f327){var _0x92c875=function(_0x508714){while(--_0x508714){_0x54c683['push'](_0x54c683['shift']());}};_0x92c875(++_0xa4f327);}(_0xf0d0,0x79));var _0x0f0d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf0d0[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x0f0d('0x0'));module[_0x0f0d('0x1')]={'priority':{'type':Sequelize[_0x0f0d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0f0d('0x3')],'allowNull':![],'defaultValue':_0x0f0d('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0f0d('0x3')]},'interval':{'type':Sequelize[_0x0f0d('0x3')],'defaultValue':_0x0f0d('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 26f7a8d..ade0c8c 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 _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x9a7d08,_0xe9048){_0x9a7d08=_0x9a7d08-0x0;var _0x58e6e8=_0xbdb7[_0x9a7d08];return _0x58e6e8;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file +var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x5ff517,_0x3e4ee0){var _0x19a245=function(_0x4c00ac){while(--_0x4c00ac){_0x5ff517['push'](_0x5ff517['shift']());}};_0x19a245(++_0x3e4ee0);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x133e3b,_0x443cd6){_0x133e3b=_0x133e3b-0x0;var _0x199e72=_0xbdb7[_0x133e3b];return _0x199e72;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1c447df..a34e089 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 _0x9782=['exports','define','mail_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./mailApplication.attributes'];(function(_0x527732,_0x3ebc05){var _0x2470df=function(_0x307b31){while(--_0x307b31){_0x527732['push'](_0x527732['shift']());}};_0x2470df(++_0x3ebc05);}(_0x9782,0x13c));var _0x2978=function(_0x4621c7,_0x24f171){_0x4621c7=_0x4621c7-0x0;var _0x2a83d6=_0x9782[_0x4621c7];return _0x2a83d6;};'use strict';var _=require(_0x2978('0x0'));var util=require(_0x2978('0x1'));var logger=require(_0x2978('0x2'))('api');var moment=require(_0x2978('0x3'));var BPromise=require(_0x2978('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2978('0x5'));var rimraf=require('rimraf');var config=require(_0x2978('0x6'));var attributes=require(_0x2978('0x7'));module[_0x2978('0x8')]=function(_0x1d2fb2,_0x45748d){return _0x1d2fb2[_0x2978('0x9')]('MailApplication',attributes,{'tableName':_0x2978('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2978('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x03a9=['../../config/logger','api','request-promise','rimraf','../../config/environment','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x03a9,0xaf));var _0x903a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x03a9[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x903a('0x0'));var util=require('util');var logger=require(_0x903a('0x1'))(_0x903a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x903a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x903a('0x4'));var config=require(_0x903a('0x5'));var attributes=require('./mailApplication.attributes');module[_0x903a('0x6')]=function(_0x2699dc,_0x525a69){return _0x2699dc[_0x903a('0x7')]('MailApplication',attributes,{'tableName':_0x903a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x903a('0x9'),'collate':_0x903a('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index a64e04e..a3e0484 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 _0xd3ca=['error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','then','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s'];(function(_0x548c98,_0x46a69f){var _0x1c9f1b=function(_0x199fb8){while(--_0x199fb8){_0x548c98['push'](_0x548c98['shift']());}};_0x1c9f1b(++_0x46a69f);}(_0xd3ca,0xc2));var _0xad3c=function(_0x5643ae,_0x58470a){_0x5643ae=_0x5643ae-0x0;var _0x33cfec=_0xd3ca[_0x5643ae];return _0x33cfec;};'use strict';var _=require('lodash');var util=require(_0xad3c('0x0'));var moment=require('moment');var BPromise=require(_0xad3c('0x1'));var rs=require(_0xad3c('0x2'));var fs=require('fs');var Redis=require(_0xad3c('0x3'));var db=require(_0xad3c('0x4'))['db'];var utils=require(_0xad3c('0x5'));var logger=require(_0xad3c('0x6'))('rpc');var config=require(_0xad3c('0x7'));var jayson=require(_0xad3c('0x8'));var client=jayson['client'][_0xad3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x191110,_0x543fd2,_0x4592fb){return new BPromise(function(_0x483b05,_0xfce8d8){return client[_0xad3c('0xa')](_0x191110,_0x4592fb)['then'](function(_0x339819){logger[_0xad3c('0xb')](_0xad3c('0xc'),_0x543fd2,_0xad3c('0xd'));logger[_0xad3c('0xe')](_0xad3c('0xf'),_0x543fd2,'request\x20sent',JSON['stringify'](_0x339819));if(_0x339819[_0xad3c('0x10')]){if(_0x339819[_0xad3c('0x10')][_0xad3c('0x11')]===0x1f4){logger[_0xad3c('0x10')]('MailApplication,\x20%s,\x20%s',_0x543fd2,_0x339819[_0xad3c('0x10')]['message']);return _0xfce8d8(_0x339819['error']['message']);}logger['error']('MailApplication,\x20%s,\x20%s',_0x543fd2,_0x339819[_0xad3c('0x10')][_0xad3c('0x12')]);return _0x483b05(_0x339819[_0xad3c('0x10')][_0xad3c('0x12')]);}else{logger[_0xad3c('0xb')](_0xad3c('0xc'),_0x543fd2,'request\x20sent');_0x483b05(_0x339819[_0xad3c('0x13')]['message']);}})[_0xad3c('0x14')](function(_0x24504d){logger[_0xad3c('0x10')](_0xad3c('0xc'),_0x543fd2,_0x24504d);_0xfce8d8(_0x24504d);});});}exports[_0xad3c('0x15')]=function(_0x158d01){var _0x47a987=this;return new Promise(function(_0x44b47d,_0x4b3749){return db[_0xad3c('0x16')][_0xad3c('0x17')](_0x158d01[_0xad3c('0x18')],{'raw':_0x158d01['options']?_0x158d01[_0xad3c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x158d01['options']?_0x158d01['options'][_0xad3c('0x1a')]||null:null,'attributes':_0x158d01['options']?_0x158d01['options'][_0xad3c('0x1b')]||null:null,'limit':_0x158d01[_0xad3c('0x19')]?_0x158d01[_0xad3c('0x19')]['limit']||null:null})[_0xad3c('0x1c')](function(_0xfa5078){logger[_0xad3c('0xb')]('UpdateMailApplication',_0x158d01);logger[_0xad3c('0xe')](_0xad3c('0x15'),_0x158d01,JSON[_0xad3c('0x1d')](_0xfa5078));_0x44b47d(_0xfa5078);})[_0xad3c('0x14')](function(_0xff66b7){logger[_0xad3c('0x10')]('UpdateMailApplication',_0xff66b7[_0xad3c('0x12')],_0x158d01);_0x4b3749(_0x47a987['error'](0x1f4,_0xff66b7[_0xad3c('0x12')]));});});}; \ No newline at end of file +var _0x57f9=['update','options','raw','where','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication'];(function(_0x1275e8,_0x40ab85){var _0x2bfdbd=function(_0x3424c7){while(--_0x3424c7){_0x1275e8['push'](_0x1275e8['shift']());}};_0x2bfdbd(++_0x40ab85);}(_0x57f9,0xa1));var _0x957f=function(_0x8e9210,_0x5e1e19){_0x8e9210=_0x8e9210-0x0;var _0x351118=_0x57f9[_0x8e9210];return _0x351118;};'use strict';var _=require(_0x957f('0x0'));var util=require(_0x957f('0x1'));var moment=require(_0x957f('0x2'));var BPromise=require(_0x957f('0x3'));var rs=require(_0x957f('0x4'));var fs=require('fs');var Redis=require(_0x957f('0x5'));var db=require(_0x957f('0x6'))['db'];var utils=require(_0x957f('0x7'));var logger=require(_0x957f('0x8'))(_0x957f('0x9'));var config=require('../../config/environment');var jayson=require(_0x957f('0xa'));var client=jayson[_0x957f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe6979,_0x41d435,_0x3d974c){return new BPromise(function(_0x180e4c,_0x5022ba){return client[_0x957f('0xc')](_0xfe6979,_0x3d974c)['then'](function(_0x1909f3){logger[_0x957f('0xd')](_0x957f('0xe'),_0x41d435,_0x957f('0xf'));logger[_0x957f('0x10')](_0x957f('0x11'),_0x41d435,'request\x20sent',JSON[_0x957f('0x12')](_0x1909f3));if(_0x1909f3[_0x957f('0x13')]){if(_0x1909f3[_0x957f('0x13')][_0x957f('0x14')]===0x1f4){logger[_0x957f('0x13')](_0x957f('0xe'),_0x41d435,_0x1909f3[_0x957f('0x13')]['message']);return _0x5022ba(_0x1909f3[_0x957f('0x13')][_0x957f('0x15')]);}logger['error'](_0x957f('0xe'),_0x41d435,_0x1909f3[_0x957f('0x13')][_0x957f('0x15')]);return _0x180e4c(_0x1909f3['error'][_0x957f('0x15')]);}else{logger[_0x957f('0xd')]('MailApplication,\x20%s,\x20%s',_0x41d435,'request\x20sent');_0x180e4c(_0x1909f3[_0x957f('0x16')][_0x957f('0x15')]);}})[_0x957f('0x17')](function(_0x1e3846){logger['error']('MailApplication,\x20%s,\x20%s',_0x41d435,_0x1e3846);_0x5022ba(_0x1e3846);});});}exports[_0x957f('0x18')]=function(_0x447b33){var _0x38888a=this;return new Promise(function(_0x515d40,_0x3e8f74){return db['MailApplication'][_0x957f('0x19')](_0x447b33['body'],{'raw':_0x447b33[_0x957f('0x1a')]?_0x447b33[_0x957f('0x1a')][_0x957f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x447b33[_0x957f('0x1a')]?_0x447b33[_0x957f('0x1a')][_0x957f('0x1c')]||null:null,'attributes':_0x447b33[_0x957f('0x1a')]?_0x447b33['options'][_0x957f('0x1d')]||null:null,'limit':_0x447b33[_0x957f('0x1a')]?_0x447b33[_0x957f('0x1a')]['limit']||null:null})[_0x957f('0x1e')](function(_0x21c8be){logger[_0x957f('0xd')](_0x957f('0x18'),_0x447b33);logger[_0x957f('0x10')]('UpdateMailApplication',_0x447b33,JSON['stringify'](_0x21c8be));_0x515d40(_0x21c8be);})['catch'](function(_0x24658b){logger[_0x957f('0x13')](_0x957f('0x18'),_0x24658b[_0x957f('0x15')],_0x447b33);_0x3e8f74(_0x38888a[_0x957f('0x13')](0x1f4,_0x24658b[_0x957f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 561005b..235b3d5 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 _0x78bd=['download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','/describe','/:id','show','/:id/messages','/:id/download'];(function(_0x2aa8d9,_0x5a9132){var _0x50d4b0=function(_0x56e36d){while(--_0x56e36d){_0x2aa8d9['push'](_0x2aa8d9['shift']());}};_0x50d4b0(++_0x5a9132);}(_0x78bd,0x18e));var _0xd78b=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x78bd[_0x5834bc];return _0x3e183a;};'use strict';var express=require(_0xd78b('0x0'));var router=express[_0xd78b('0x1')]();var auth=require(_0xd78b('0x2'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router[_0xd78b('0x3')]('/',auth[_0xd78b('0x4')](),controller['index']);router[_0xd78b('0x3')](_0xd78b('0x5'),auth[_0xd78b('0x4')](),controller['describe']);router[_0xd78b('0x3')](_0xd78b('0x6'),auth[_0xd78b('0x4')](),controller[_0xd78b('0x7')]);router[_0xd78b('0x3')](_0xd78b('0x8'),auth[_0xd78b('0x4')](),controller['getMessages']);router['get'](_0xd78b('0x9'),auth['isAuthenticated'](),controller[_0xd78b('0xa')]);router[_0xd78b('0xb')]('/',auth[_0xd78b('0x4')](),controller[_0xd78b('0xc')]);router['post'](_0xd78b('0x8'),auth[_0xd78b('0x4')](),controller[_0xd78b('0xd')]);router['post'](_0xd78b('0xe'),auth[_0xd78b('0x4')](),interaction[_0xd78b('0xf')](_0xd78b('0x10'),_0xd78b('0x11')),controller['addTags']);router[_0xd78b('0x12')](_0xd78b('0x6'),auth[_0xd78b('0x4')](),interaction[_0xd78b('0xf')](_0xd78b('0x10'),_0xd78b('0x13')),controller[_0xd78b('0x14')]);router[_0xd78b('0x15')](_0xd78b('0x6'),auth[_0xd78b('0x4')](),interaction['tracked'](_0xd78b('0x10'),'mailinteraction:destroy'),controller[_0xd78b('0x16')]);router[_0xd78b('0x15')](_0xd78b('0xe'),auth[_0xd78b('0x4')](),controller['removeTags']);module[_0xd78b('0x17')]=router; \ No newline at end of file +var _0x5a5c=['/:id/download','download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages'];(function(_0x3e478c,_0x152670){var _0x29ef89=function(_0x3d0d77){while(--_0x3d0d77){_0x3e478c['push'](_0x3e478c['shift']());}};_0x29ef89(++_0x152670);}(_0x5a5c,0x112));var _0xc5a5=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x5a5c[_0x32b993];return _0x482780;};'use strict';var express=require(_0xc5a5('0x0'));var router=express['Router']();var auth=require(_0xc5a5('0x1'));var interaction=require(_0xc5a5('0x2'));var controller=require(_0xc5a5('0x3'));router[_0xc5a5('0x4')]('/',auth[_0xc5a5('0x5')](),controller['index']);router['get'](_0xc5a5('0x6'),auth[_0xc5a5('0x5')](),controller[_0xc5a5('0x7')]);router[_0xc5a5('0x4')](_0xc5a5('0x8'),auth[_0xc5a5('0x5')](),controller[_0xc5a5('0x9')]);router['get'](_0xc5a5('0xa'),auth['isAuthenticated'](),controller[_0xc5a5('0xb')]);router[_0xc5a5('0x4')](_0xc5a5('0xc'),auth[_0xc5a5('0x5')](),controller[_0xc5a5('0xd')]);router['post']('/',auth[_0xc5a5('0x5')](),controller['create']);router[_0xc5a5('0xe')](_0xc5a5('0xa'),auth[_0xc5a5('0x5')](),controller[_0xc5a5('0xf')]);router['post'](_0xc5a5('0x10'),auth[_0xc5a5('0x5')](),interaction[_0xc5a5('0x11')](_0xc5a5('0x12'),_0xc5a5('0x13')),controller[_0xc5a5('0x14')]);router[_0xc5a5('0x15')](_0xc5a5('0x8'),auth[_0xc5a5('0x5')](),interaction['tracked'](_0xc5a5('0x12'),_0xc5a5('0x16')),controller[_0xc5a5('0x17')]);router[_0xc5a5('0x18')]('/:id',auth['isAuthenticated'](),interaction[_0xc5a5('0x11')](_0xc5a5('0x12'),'mailinteraction:destroy'),controller['destroy']);router[_0xc5a5('0x18')](_0xc5a5('0x10'),auth[_0xc5a5('0x5')](),controller['removeTags']);module[_0xc5a5('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 3ed908b..5cffe4a 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 _0x27e7=['DATE','STRING','TEXT','long','BOOLEAN','ENUM','out','sequelize'];(function(_0x15e59c,_0x350fb3){var _0x57f29f=function(_0x55c2d8){while(--_0x55c2d8){_0x15e59c['push'](_0x15e59c['shift']());}};_0x57f29f(++_0x350fb3);}(_0x27e7,0x67));var _0x727e=function(_0x3905b1,_0x362645){_0x3905b1=_0x3905b1-0x0;var _0x48a651=_0x27e7[_0x3905b1];return _0x48a651;};'use strict';var Sequelize=require(_0x727e('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x727e('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x727e('0x2')]},'note':{'type':Sequelize[_0x727e('0x2')]},'inReplyTo':{'type':Sequelize[_0x727e('0x2')](0x1fe)},'to':{'type':Sequelize[_0x727e('0x2')]},'cc':{'type':Sequelize[_0x727e('0x3')](_0x727e('0x4'))},'subject':{'type':Sequelize[_0x727e('0x3')]()},'attach':{'type':Sequelize[_0x727e('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x727e('0x1')]},'substatus':{'type':Sequelize[_0x727e('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x727e('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x727e('0x6')]('in',_0x727e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x727e('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x727e('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x1744=['exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out','sequelize'];(function(_0x5b7cc2,_0x2b4334){var _0x56573e=function(_0x3a4a93){while(--_0x3a4a93){_0x5b7cc2['push'](_0x5b7cc2['shift']());}};_0x56573e(++_0x2b4334);}(_0x1744,0xa1));var _0x4174=function(_0x198885,_0x2f71b6){_0x198885=_0x198885-0x0;var _0x3b0ca0=_0x1744[_0x198885];return _0x3b0ca0;};'use strict';var Sequelize=require(_0x4174('0x0'));var iconv=require('iconv');module[_0x4174('0x1')]={'closed':{'type':Sequelize[_0x4174('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4174('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4174('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4174('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x4174('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x4174('0x5'))},'subject':{'type':Sequelize[_0x4174('0x6')]()},'attach':{'type':Sequelize[_0x4174('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4174('0x3')]},'substatus':{'type':Sequelize[_0x4174('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x4174('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4174('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4174('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4174('0x7')]('in',_0x4174('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4174('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 49e679a..e754df6 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 _0x1d95=['$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','options','includeAll','findAll','inlineCss','rows','addTags','setTags','omit','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','root','files','tmp','join','server','attachments','transcript-%d-%s.zip','push','Attachment','from','createdAt','get','mkdirSync','each','Messages','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','Attachments','basename','existsSync','readFileSync','build','message%d.eml','unlinkSync','rimraf','zip-dir','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','status','json','undefined','limit','count','offset','set','Content-Range','update','then','end','sendStatus','error','name','index','map','MailInteraction','fieldName','type','key','getOptions','mail','query','user','model','keys','filters','intersection','attributes','fields','length','include','find','create','body','catch','destroy','params','MailMessage','ids','getMessages','findOne','rawAttributes','nolimit','order','sort','where','pick','MailInteractionId','filter'];(function(_0x4cee32,_0x5988a2){var _0x593d85=function(_0x1e97ef){while(--_0x1e97ef){_0x4cee32['push'](_0x4cee32['shift']());}};_0x593d85(++_0x5988a2);}(_0x1d95,0x114));var _0x51d9=function(_0x2139c9,_0x413dc4){_0x2139c9=_0x2139c9-0x0;var _0x2fddb6=_0x1d95[_0x2139c9];return _0x2fddb6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51d9('0x0'));var zipdir=require(_0x51d9('0x1'));var moment=require('moment');var BPromise=require(_0x51d9('0x2'));var util=require('util');var path=require(_0x51d9('0x3'));var fs=require('fs');var _=require(_0x51d9('0x4'));var juice=require(_0x51d9('0x5'));var Redis=require(_0x51d9('0x6'));var interaction=require(_0x51d9('0x7'));var qs=require(_0x51d9('0x8'));var logger=require(_0x51d9('0x9'))(_0x51d9('0xa'));var config=require('../../config/environment');var db=require(_0x51d9('0xb'))['db'];var htmlEntities=require('html-entities');config[_0x51d9('0xc')]=_['defaults'](config[_0x51d9('0xc')],{'host':_0x51d9('0xd'),'port':0x18eb});var socket=require(_0x51d9('0xe'))(new Redis(config[_0x51d9('0xc')]));require(_0x51d9('0xf'))['register'](socket);function respondWithStatusCode(_0x42a12c,_0x182184){_0x182184=_0x182184||0xcc;return function(_0x163fb7){if(_0x163fb7){return _0x42a12c['sendStatus'](_0x182184);}return _0x42a12c[_0x51d9('0x10')](_0x182184)['end']();};}function respondWithResult(_0x173102,_0x1bc02e){_0x1bc02e=_0x1bc02e||0xc8;return function(_0x15b8d6){if(_0x15b8d6){return _0x173102['status'](_0x1bc02e)[_0x51d9('0x11')](_0x15b8d6);}};}function respondWithFilteredResult(_0x4472df,_0x6b529){return function(_0x42f6ca){if(_0x42f6ca){var _0x4dc0e1=typeof _0x6b529['offset']===_0x51d9('0x12')&&typeof _0x6b529[_0x51d9('0x13')]===_0x51d9('0x12');var _0x3db6bb=_0x42f6ca[_0x51d9('0x14')];var _0x496ca5=_0x4dc0e1?0x0:_0x6b529['offset'];var _0x1d245c=_0x4dc0e1?_0x42f6ca[_0x51d9('0x14')]:_0x6b529[_0x51d9('0x15')]+_0x6b529[_0x51d9('0x13')];var _0x571dee;if(_0x1d245c>=_0x3db6bb){_0x1d245c=_0x3db6bb;_0x571dee=0xc8;}else{_0x571dee=0xce;}_0x4472df[_0x51d9('0x10')](_0x571dee);return _0x4472df[_0x51d9('0x16')](_0x51d9('0x17'),_0x496ca5+'-'+_0x1d245c+'/'+_0x3db6bb)[_0x51d9('0x11')](_0x42f6ca);}return null;};}function saveUpdates(_0x5b57b5){return function(_0x315cac){if(_0x315cac){return _0x315cac[_0x51d9('0x18')](_0x5b57b5)[_0x51d9('0x19')](function(_0x43b6be){return _0x43b6be;});}return null;};}function removeEntity(_0x14b7e6){return function(_0x103046){if(_0x103046){return _0x103046['destroy']()[_0x51d9('0x19')](function(){_0x14b7e6[_0x51d9('0x10')](0xcc)[_0x51d9('0x1a')]();});}};}function handleEntityNotFound(_0x17ca65){return function(_0x8db9cc){if(!_0x8db9cc){_0x17ca65[_0x51d9('0x1b')](0x194);}return _0x8db9cc;};}function handleError(_0x471280,_0x69f8fc){_0x69f8fc=_0x69f8fc||0x1f4;return function(_0x49cc6b){logger[_0x51d9('0x1c')](_0x49cc6b['stack']);if(_0x49cc6b['name']){delete _0x49cc6b[_0x51d9('0x1d')];}_0x471280[_0x51d9('0x10')](_0x69f8fc)['send'](_0x49cc6b);};}exports[_0x51d9('0x1e')]=function(_0x5dbf3f,_0x4c65d0){var _0x456ff0={};var _0x459c2c=_[_0x51d9('0x1f')](db[_0x51d9('0x20')]['rawAttributes'],function(_0x349138){return{'name':_0x349138[_0x51d9('0x21')],'type':_0x349138[_0x51d9('0x22')][_0x51d9('0x23')]};});_0x456ff0=qs[_0x51d9('0x24')](_0x459c2c,_0x5dbf3f);return interaction['findAll'](_0x51d9('0x25'),_0x5dbf3f[_0x51d9('0x26')],_0x5dbf3f[_0x51d9('0x27')],_0x456ff0,_0x459c2c)[_0x51d9('0x19')](respondWithFilteredResult(_0x4c65d0,_0x456ff0))['catch'](handleError(_0x4c65d0,null));};exports['show']=function(_0x42c0c7,_0x35b7e6){var _0x5a4c0c={'raw':![],'where':{'id':_0x42c0c7['params']['id']}},_0x19d37b={};_0x19d37b[_0x51d9('0x28')]=_['keys'](db[_0x51d9('0x20')]['rawAttributes']);_0x19d37b[_0x51d9('0x26')]=_[_0x51d9('0x29')](_0x42c0c7[_0x51d9('0x26')]);_0x19d37b[_0x51d9('0x2a')]=_[_0x51d9('0x2b')](_0x19d37b[_0x51d9('0x28')],_0x19d37b[_0x51d9('0x26')]);_0x5a4c0c[_0x51d9('0x2c')]=_['intersection'](_0x19d37b['model'],qs[_0x51d9('0x2d')](_0x42c0c7[_0x51d9('0x26')][_0x51d9('0x2d')]));_0x5a4c0c[_0x51d9('0x2c')]=_0x5a4c0c['attributes'][_0x51d9('0x2e')]?_0x5a4c0c[_0x51d9('0x2c')]:_0x19d37b['model'];if(_0x42c0c7[_0x51d9('0x26')]['includeAll']){_0x5a4c0c[_0x51d9('0x2f')]=[{'all':!![]}];}_0x5a4c0c=_['merge']({},_0x5a4c0c,_0x42c0c7['options']);return db[_0x51d9('0x20')][_0x51d9('0x30')](_0x5a4c0c)[_0x51d9('0x19')](handleEntityNotFound(_0x35b7e6,null))['then'](respondWithResult(_0x35b7e6,null))['catch'](handleError(_0x35b7e6,null));};exports['create']=function(_0x88b6bf,_0x467c5){return db[_0x51d9('0x20')][_0x51d9('0x31')](_0x88b6bf['body'],{})[_0x51d9('0x19')](respondWithResult(_0x467c5,0xc9))['catch'](handleError(_0x467c5,null));};exports[_0x51d9('0x18')]=function(_0x8cb076,_0x1c2748){if(_0x8cb076[_0x51d9('0x32')]['id']){delete _0x8cb076[_0x51d9('0x32')]['id'];}return db[_0x51d9('0x20')][_0x51d9('0x30')]({'where':{'id':_0x8cb076['params']['id']}})['then'](handleEntityNotFound(_0x1c2748,null))['then'](saveUpdates(_0x8cb076[_0x51d9('0x32')],null))['then'](respondWithResult(_0x1c2748,null))[_0x51d9('0x33')](handleError(_0x1c2748,null));};exports[_0x51d9('0x34')]=function(_0x3f392e,_0x2700cc){return db[_0x51d9('0x20')]['find']({'where':{'id':_0x3f392e[_0x51d9('0x35')]['id']}})[_0x51d9('0x19')](handleEntityNotFound(_0x2700cc,null))[_0x51d9('0x19')](removeEntity(_0x2700cc,null))[_0x51d9('0x33')](handleError(_0x2700cc,null));};exports['describe']=function(_0x57aba6,_0x52c52f){return db['MailInteraction']['describe']()[_0x51d9('0x19')](respondWithResult(_0x52c52f,null))['catch'](handleError(_0x52c52f,null));};exports['addMessage']=function(_0x4bb376,_0xe3b477){return db[_0x51d9('0x36')][_0x51d9('0x30')]({'where':{'id':_0x4bb376[_0x51d9('0x35')]['id']}})[_0x51d9('0x19')](handleEntityNotFound(_0xe3b477,null))[_0x51d9('0x19')](function(_0x1c4671){if(_0x1c4671){return _0x1c4671['addMessage'](_0x4bb376[_0x51d9('0x32')][_0x51d9('0x37')],_['omit'](_0x4bb376[_0x51d9('0x32')],[_0x51d9('0x37'),'id'])||{});}})[_0x51d9('0x19')](respondWithResult(_0xe3b477,null))[_0x51d9('0x33')](handleError(_0xe3b477,null));};exports[_0x51d9('0x38')]=function(_0x5e22b5,_0x2d7a35){var _0x5126c3={'raw':![],'where':{}};var _0x5578bb={};var _0x5ca0bd={'count':0x0,'rows':[]};return db[_0x51d9('0x20')][_0x51d9('0x39')]({'where':{'id':_0x5e22b5[_0x51d9('0x35')]['id']}})[_0x51d9('0x19')](handleEntityNotFound(_0x2d7a35,null))[_0x51d9('0x19')](function(_0x288201){if(_0x288201){_0x5578bb['model']=_[_0x51d9('0x29')](db[_0x51d9('0x36')][_0x51d9('0x3a')]);_0x5578bb[_0x51d9('0x26')]=_[_0x51d9('0x29')](_0x5e22b5[_0x51d9('0x26')]);_0x5578bb[_0x51d9('0x2a')]=_[_0x51d9('0x2b')](_0x5578bb[_0x51d9('0x28')],_0x5578bb[_0x51d9('0x26')]);_0x5126c3[_0x51d9('0x2c')]=_[_0x51d9('0x2b')](_0x5578bb[_0x51d9('0x28')],qs['fields'](_0x5e22b5[_0x51d9('0x26')]['fields']));_0x5126c3[_0x51d9('0x2c')]=_0x5126c3['attributes'][_0x51d9('0x2e')]?_0x5126c3[_0x51d9('0x2c')]:_0x5578bb[_0x51d9('0x28')];if(!_0x5e22b5[_0x51d9('0x26')]['hasOwnProperty'](_0x51d9('0x3b'))){_0x5126c3['limit']=qs[_0x51d9('0x13')](_0x5e22b5[_0x51d9('0x26')][_0x51d9('0x13')]);_0x5126c3[_0x51d9('0x15')]=qs[_0x51d9('0x15')](_0x5e22b5[_0x51d9('0x26')][_0x51d9('0x15')]);}_0x5126c3[_0x51d9('0x3c')]=qs[_0x51d9('0x3d')](_0x5e22b5[_0x51d9('0x26')][_0x51d9('0x3d')]);_0x5126c3[_0x51d9('0x3e')]=qs[_0x51d9('0x2a')](_[_0x51d9('0x3f')](_0x5e22b5['query'],_0x5578bb[_0x51d9('0x2a')]));_0x5126c3[_0x51d9('0x3e')][_0x51d9('0x40')]=_0x288201['id'];if(_0x5e22b5['query']['filter']){_0x5126c3['where']=_['merge'](_0x5126c3[_0x51d9('0x3e')],{'$or':_[_0x51d9('0x1f')](_0x5126c3[_0x51d9('0x2c')],function(_0x255da4){var _0x599321={};_0x599321[_0x255da4]={'$like':'%'+_0x5e22b5[_0x51d9('0x26')][_0x51d9('0x41')]+'%'};return _0x599321;})});}if(_0x5e22b5[_0x51d9('0x26')][_0x51d9('0x42')]){var _0x2f8c63=_0x5e22b5['query'][_0x51d9('0x42')][_0x51d9('0x43')](',');var _0x9bacbe={};_0x9bacbe[_0x2f8c63[0x0]]={'$gte':moment(_0x2f8c63[0x1])[_0x51d9('0x44')](_0x51d9('0x45'))};_0x5126c3[_0x51d9('0x3e')]=_['merge'](_0x5126c3[_0x51d9('0x3e')],_0x9bacbe);}_0x5126c3=_[_0x51d9('0x46')]({},_0x5126c3,_0x5e22b5[_0x51d9('0x47')]);return db[_0x51d9('0x36')][_0x51d9('0x14')]({'where':_0x5126c3['where']})[_0x51d9('0x19')](function(_0x5cd26b){_0x5ca0bd[_0x51d9('0x14')]=_0x5cd26b;if(_0x5e22b5[_0x51d9('0x26')][_0x51d9('0x48')]){_0x5126c3['include']=[{'all':!![]}];}return db[_0x51d9('0x36')][_0x51d9('0x49')](_0x5126c3);})[_0x51d9('0x19')](function(_0x40bf29){if(_0x5e22b5[_0x51d9('0x26')][_0x51d9('0x4a')]==='true'){for(var _0x188e30=0x0;_0x188e30<_0x40bf29[_0x51d9('0x2e')];_0x188e30++){_0x40bf29[_0x188e30][_0x51d9('0x32')]=juice(_0x40bf29[_0x188e30][_0x51d9('0x32')]);}}_0x5ca0bd[_0x51d9('0x4b')]=_0x40bf29;return _0x5ca0bd;});}})[_0x51d9('0x19')](respondWithFilteredResult(_0x2d7a35,_0x5126c3))[_0x51d9('0x33')](handleError(_0x2d7a35,null));};exports[_0x51d9('0x4c')]=function(_0x4891da,_0x5b6832){return db[_0x51d9('0x20')]['find']({'where':{'id':_0x4891da[_0x51d9('0x35')]['id']}})[_0x51d9('0x19')](handleEntityNotFound(_0x5b6832,null))[_0x51d9('0x19')](function(_0x9c915e){if(_0x9c915e){return _0x9c915e[_0x51d9('0x4d')](_0x4891da[_0x51d9('0x32')][_0x51d9('0x37')],_[_0x51d9('0x4e')](_0x4891da[_0x51d9('0x32')],[_0x51d9('0x37'),'id'])||{})[_0x51d9('0x4f')](function(){return db[_0x51d9('0x50')][_0x51d9('0x49')]({'attributes':['id',_0x51d9('0x1d'),_0x51d9('0x51')],'where':{'id':_0x4891da[_0x51d9('0x32')]['ids']}});})['then'](function(_0x3e0a9c){socket['emit'](_0x51d9('0x52'),{'id':Number(_0x4891da[_0x51d9('0x35')]['id']),'tags':_0x3e0a9c||[]});return{'id':Number(_0x4891da[_0x51d9('0x35')]['id']),'tags':_0x3e0a9c||[]};});}})[_0x51d9('0x19')](respondWithResult(_0x5b6832,null))[_0x51d9('0x33')](handleError(_0x5b6832,null));};exports[_0x51d9('0x53')]=function(_0x20d34e,_0x7f0af1){return db[_0x51d9('0x20')]['find']({'where':{'id':_0x20d34e[_0x51d9('0x35')]['id']}})['then'](handleEntityNotFound(_0x7f0af1,null))[_0x51d9('0x19')](function(_0xdb803a){if(_0xdb803a){return _0xdb803a['removeTags'](_0x20d34e['query'][_0x51d9('0x37')]);}})[_0x51d9('0x19')](respondWithStatusCode(_0x7f0af1,null))[_0x51d9('0x33')](handleError(_0x7f0af1,null));};exports[_0x51d9('0x54')]=function(_0x3f48f3,_0x5bc74d){var _0x376b12=moment()[_0x51d9('0x55')]()['toString']();var _0x1c9397=path['join'](config[_0x51d9('0x56')],'server',_0x51d9('0x57'),_0x51d9('0x58'));var _0x288867=path[_0x51d9('0x59')](config[_0x51d9('0x56')],_0x51d9('0x5a'),_0x51d9('0x57'),_0x51d9('0x5b'));var _0x2bbec5=path[_0x51d9('0x59')](_0x1c9397,_0x376b12);var _0x40a242=util[_0x51d9('0x44')](_0x51d9('0x5c'),_0x3f48f3[_0x51d9('0x35')]['id'],_0x376b12);var _0x3552de=path[_0x51d9('0x59')](_0x1c9397,_0x40a242);var _0x2252bd=[];if(_0x3f48f3[_0x51d9('0x26')][_0x51d9('0x5b')]){_0x2252bd[_0x51d9('0x5d')]({'model':db[_0x51d9('0x5e')],'as':'Attachments','raw':!![]});}var _0x50f609=[{'model':db[_0x51d9('0x36')],'as':'Messages','attributes':['id',_0x51d9('0x32'),_0x51d9('0x5f'),'to','cc','bcc','subject',_0x51d9('0x60')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x2252bd}];return db['MailInteraction'][_0x51d9('0x30')]({'where':{'id':_0x3f48f3['params']['id']},'include':_0x50f609})[_0x51d9('0x19')](handleEntityNotFound(_0x5bc74d,null))[_0x51d9('0x19')](function(_0x29d729){if(_0x29d729&&_0x29d729['Messages']){var _0x34699b=_0x29d729[_0x51d9('0x61')]({'plain':!![]});fs[_0x51d9('0x62')](_0x2bbec5);return BPromise[_0x51d9('0x63')](_0x34699b[_0x51d9('0x64')],function(_0x1e9216,_0x534f7a){var _0x25e047={'from':_0x1e9216[_0x51d9('0x5f')],'to':_0x1e9216['to']||'missing.recipient@your.company.com','subject':_0x1e9216[_0x51d9('0x65')],'html':htmlEntities[_0x51d9('0x66')](_0x1e9216[_0x51d9('0x32')]),'headers':{'Date':moment(_0x1e9216['createdAt'])[_0x51d9('0x44')](_0x51d9('0x67'))},'attachments':[]};if(_0x1e9216['cc']){_0x25e047[_0x51d9('0x68')]['Cc']=_0x1e9216['cc'];}if(_0x1e9216[_0x51d9('0x69')]){_0x25e047[_0x51d9('0x68')][_0x51d9('0x6a')]=_0x1e9216[_0x51d9('0x69')];}return new BPromise(function(_0x1e4db3,_0x4d4e5b){if(_0x1e9216[_0x51d9('0x6b')]){for(var _0x113bc4=0x0;_0x113bc4<_0x1e9216['Attachments'][_0x51d9('0x2e')];_0x113bc4++){var _0x763f93=_0x1e9216[_0x51d9('0x6b')][_0x113bc4];var _0x7811a3=path['join'](_0x288867,_0x763f93[_0x51d9('0x6c')]);if(fs[_0x51d9('0x6d')](_0x7811a3)){_0x25e047['attachments']['push']({'name':_0x763f93['name'],'contentType':_0x763f93[_0x51d9('0x22')],'data':fs[_0x51d9('0x6e')](_0x7811a3)});}}}emlformat[_0x51d9('0x6f')](_0x25e047,function(_0x151eb2,_0x33f690){if(_0x151eb2)return _0x4d4e5b(_0x151eb2);fs['writeFileSync'](path[_0x51d9('0x59')](_0x2bbec5,util[_0x51d9('0x44')](_0x51d9('0x70'),_0x534f7a)),_0x33f690);return _0x1e4db3(_0x33f690);});});})[_0x51d9('0x19')](function(){return new BPromise(function(_0x3f3cb6,_0x19af8a){zipdir(_0x2bbec5,{'saveTo':_0x3552de},function(_0x3fe49c,_0x21bb32){if(_0x3fe49c)return _0x19af8a(_0x3fe49c);return _0x3f3cb6(_0x21bb32);});})['then'](function(){return new BPromise(function(_0x49bfe5,_0x1b94ea){rimraf(_0x2bbec5,function(_0x247a7b){if(_0x247a7b)_0x1b94ea(_0x247a7b);return _0x49bfe5();});});})[_0x51d9('0x19')](function(){return _0x5bc74d[_0x51d9('0x54')](_0x3552de,_0x40a242,function(_0x1113ce){if(!_0x1113ce)fs[_0x51d9('0x71')](_0x3552de);});});});}else{return _0x5bc74d[_0x51d9('0x1b')](0xc8);}})[_0x51d9('0x33')](handleError(_0x5bc74d,null));}; \ No newline at end of file +var _0xbf98=['query','user','catch','show','model','keys','MailInteraction','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','update','params','describe','addMessage','MailMessage','ids','getMessages','hasOwnProperty','nolimit','sort','pick','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','rows','addTags','omit','spread','findAll','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','attachments','push','Attachment','Attachments','Messages','from','subject','createdAt','get','mkdirSync','each','decode','headers','bcc','basename','existsSync','build','writeFileSync','message%d.eml','unlinkSync','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','sendStatus','status','end','json','offset','limit','count','set','then','destroy','name','send','index','map','rawAttributes','fieldName','type','getOptions','mail'];(function(_0x426f07,_0x54f0b2){var _0x48b9f6=function(_0x312444){while(--_0x312444){_0x426f07['push'](_0x426f07['shift']());}};_0x48b9f6(++_0x54f0b2);}(_0xbf98,0x11a));var _0x8bf9=function(_0x2f003f,_0x45d36f){_0x2f003f=_0x2f003f-0x0;var _0x38442a=_0xbf98[_0x2f003f];return _0x38442a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x8bf9('0x0'));var util=require(_0x8bf9('0x1'));var path=require(_0x8bf9('0x2'));var fs=require('fs');var _=require('lodash');var juice=require(_0x8bf9('0x3'));var Redis=require(_0x8bf9('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x8bf9('0x5'));var logger=require(_0x8bf9('0x6'))(_0x8bf9('0x7'));var config=require('../../config/environment');var db=require(_0x8bf9('0x8'))['db'];var htmlEntities=require('html-entities');config[_0x8bf9('0x9')]=_['defaults'](config[_0x8bf9('0x9')],{'host':_0x8bf9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0xdb6d32,_0xc6f4cb){_0xc6f4cb=_0xc6f4cb||0xcc;return function(_0x2698b7){if(_0x2698b7){return _0xdb6d32[_0x8bf9('0xb')](_0xc6f4cb);}return _0xdb6d32[_0x8bf9('0xc')](_0xc6f4cb)[_0x8bf9('0xd')]();};}function respondWithResult(_0x19e4e9,_0x479cce){_0x479cce=_0x479cce||0xc8;return function(_0x3d1121){if(_0x3d1121){return _0x19e4e9[_0x8bf9('0xc')](_0x479cce)[_0x8bf9('0xe')](_0x3d1121);}};}function respondWithFilteredResult(_0x21f161,_0x4a9386){return function(_0x102fa6){if(_0x102fa6){var _0x51ee11=typeof _0x4a9386[_0x8bf9('0xf')]==='undefined'&&typeof _0x4a9386[_0x8bf9('0x10')]==='undefined';var _0xec1cd3=_0x102fa6['count'];var _0x2cf238=_0x51ee11?0x0:_0x4a9386['offset'];var _0x4ead0c=_0x51ee11?_0x102fa6[_0x8bf9('0x11')]:_0x4a9386[_0x8bf9('0xf')]+_0x4a9386[_0x8bf9('0x10')];var _0x53431b;if(_0x4ead0c>=_0xec1cd3){_0x4ead0c=_0xec1cd3;_0x53431b=0xc8;}else{_0x53431b=0xce;}_0x21f161[_0x8bf9('0xc')](_0x53431b);return _0x21f161[_0x8bf9('0x12')]('Content-Range',_0x2cf238+'-'+_0x4ead0c+'/'+_0xec1cd3)[_0x8bf9('0xe')](_0x102fa6);}return null;};}function saveUpdates(_0x146010){return function(_0x570416){if(_0x570416){return _0x570416['update'](_0x146010)[_0x8bf9('0x13')](function(_0x177c3e){return _0x177c3e;});}return null;};}function removeEntity(_0x5ef836){return function(_0x35459a){if(_0x35459a){return _0x35459a[_0x8bf9('0x14')]()['then'](function(){_0x5ef836[_0x8bf9('0xc')](0xcc)[_0x8bf9('0xd')]();});}};}function handleEntityNotFound(_0x400eac){return function(_0x4d4713){if(!_0x4d4713){_0x400eac[_0x8bf9('0xb')](0x194);}return _0x4d4713;};}function handleError(_0x3c625f,_0x5486b8){_0x5486b8=_0x5486b8||0x1f4;return function(_0x493c4c){logger['error'](_0x493c4c['stack']);if(_0x493c4c[_0x8bf9('0x15')]){delete _0x493c4c[_0x8bf9('0x15')];}_0x3c625f[_0x8bf9('0xc')](_0x5486b8)[_0x8bf9('0x16')](_0x493c4c);};}exports[_0x8bf9('0x17')]=function(_0x338456,_0x346338){var _0xb1e084={};var _0x28bf02=_[_0x8bf9('0x18')](db['MailInteraction'][_0x8bf9('0x19')],function(_0x2482e0){return{'name':_0x2482e0[_0x8bf9('0x1a')],'type':_0x2482e0[_0x8bf9('0x1b')]['key']};});_0xb1e084=qs[_0x8bf9('0x1c')](_0x28bf02,_0x338456);return interaction['findAll'](_0x8bf9('0x1d'),_0x338456[_0x8bf9('0x1e')],_0x338456[_0x8bf9('0x1f')],_0xb1e084,_0x28bf02)[_0x8bf9('0x13')](respondWithFilteredResult(_0x346338,_0xb1e084))[_0x8bf9('0x20')](handleError(_0x346338,null));};exports[_0x8bf9('0x21')]=function(_0x1a1aae,_0x3d62c5){var _0x2fcdd0={'raw':![],'where':{'id':_0x1a1aae['params']['id']}},_0x16805d={};_0x16805d[_0x8bf9('0x22')]=_[_0x8bf9('0x23')](db[_0x8bf9('0x24')][_0x8bf9('0x19')]);_0x16805d['query']=_[_0x8bf9('0x23')](_0x1a1aae[_0x8bf9('0x1e')]);_0x16805d[_0x8bf9('0x25')]=_[_0x8bf9('0x26')](_0x16805d[_0x8bf9('0x22')],_0x16805d[_0x8bf9('0x1e')]);_0x2fcdd0['attributes']=_[_0x8bf9('0x26')](_0x16805d[_0x8bf9('0x22')],qs[_0x8bf9('0x27')](_0x1a1aae[_0x8bf9('0x1e')][_0x8bf9('0x27')]));_0x2fcdd0[_0x8bf9('0x28')]=_0x2fcdd0[_0x8bf9('0x28')][_0x8bf9('0x29')]?_0x2fcdd0['attributes']:_0x16805d['model'];if(_0x1a1aae[_0x8bf9('0x1e')][_0x8bf9('0x2a')]){_0x2fcdd0[_0x8bf9('0x2b')]=[{'all':!![]}];}_0x2fcdd0=_[_0x8bf9('0x2c')]({},_0x2fcdd0,_0x1a1aae[_0x8bf9('0x2d')]);return db['MailInteraction'][_0x8bf9('0x2e')](_0x2fcdd0)[_0x8bf9('0x13')](handleEntityNotFound(_0x3d62c5,null))[_0x8bf9('0x13')](respondWithResult(_0x3d62c5,null))[_0x8bf9('0x20')](handleError(_0x3d62c5,null));};exports[_0x8bf9('0x2f')]=function(_0x27cb1d,_0x42ec31){return db[_0x8bf9('0x24')]['create'](_0x27cb1d[_0x8bf9('0x30')],{})[_0x8bf9('0x13')](respondWithResult(_0x42ec31,0xc9))[_0x8bf9('0x20')](handleError(_0x42ec31,null));};exports[_0x8bf9('0x31')]=function(_0x4651a8,_0xe2e5a4){if(_0x4651a8[_0x8bf9('0x30')]['id']){delete _0x4651a8[_0x8bf9('0x30')]['id'];}return db[_0x8bf9('0x24')]['find']({'where':{'id':_0x4651a8['params']['id']}})[_0x8bf9('0x13')](handleEntityNotFound(_0xe2e5a4,null))[_0x8bf9('0x13')](saveUpdates(_0x4651a8[_0x8bf9('0x30')],null))[_0x8bf9('0x13')](respondWithResult(_0xe2e5a4,null))[_0x8bf9('0x20')](handleError(_0xe2e5a4,null));};exports[_0x8bf9('0x14')]=function(_0x404220,_0x3fbe96){return db[_0x8bf9('0x24')][_0x8bf9('0x2e')]({'where':{'id':_0x404220[_0x8bf9('0x32')]['id']}})[_0x8bf9('0x13')](handleEntityNotFound(_0x3fbe96,null))['then'](removeEntity(_0x3fbe96,null))[_0x8bf9('0x20')](handleError(_0x3fbe96,null));};exports['describe']=function(_0x55e1c6,_0x33070a){return db[_0x8bf9('0x24')][_0x8bf9('0x33')]()[_0x8bf9('0x13')](respondWithResult(_0x33070a,null))[_0x8bf9('0x20')](handleError(_0x33070a,null));};exports[_0x8bf9('0x34')]=function(_0xf3a33,_0x5b7c9b){return db[_0x8bf9('0x35')][_0x8bf9('0x2e')]({'where':{'id':_0xf3a33[_0x8bf9('0x32')]['id']}})['then'](handleEntityNotFound(_0x5b7c9b,null))[_0x8bf9('0x13')](function(_0x2acd27){if(_0x2acd27){return _0x2acd27[_0x8bf9('0x34')](_0xf3a33['body'][_0x8bf9('0x36')],_['omit'](_0xf3a33[_0x8bf9('0x30')],[_0x8bf9('0x36'),'id'])||{});}})[_0x8bf9('0x13')](respondWithResult(_0x5b7c9b,null))[_0x8bf9('0x20')](handleError(_0x5b7c9b,null));};exports[_0x8bf9('0x37')]=function(_0x13a25f,_0x14e65f){var _0x3d687a={'raw':![],'where':{}};var _0x2b7793={};var _0x17891e={'count':0x0,'rows':[]};return db[_0x8bf9('0x24')]['findOne']({'where':{'id':_0x13a25f[_0x8bf9('0x32')]['id']}})[_0x8bf9('0x13')](handleEntityNotFound(_0x14e65f,null))[_0x8bf9('0x13')](function(_0x5c2e23){if(_0x5c2e23){_0x2b7793[_0x8bf9('0x22')]=_['keys'](db[_0x8bf9('0x35')]['rawAttributes']);_0x2b7793['query']=_[_0x8bf9('0x23')](_0x13a25f['query']);_0x2b7793[_0x8bf9('0x25')]=_['intersection'](_0x2b7793[_0x8bf9('0x22')],_0x2b7793['query']);_0x3d687a[_0x8bf9('0x28')]=_[_0x8bf9('0x26')](_0x2b7793['model'],qs[_0x8bf9('0x27')](_0x13a25f[_0x8bf9('0x1e')][_0x8bf9('0x27')]));_0x3d687a[_0x8bf9('0x28')]=_0x3d687a['attributes']['length']?_0x3d687a[_0x8bf9('0x28')]:_0x2b7793[_0x8bf9('0x22')];if(!_0x13a25f[_0x8bf9('0x1e')][_0x8bf9('0x38')](_0x8bf9('0x39'))){_0x3d687a[_0x8bf9('0x10')]=qs['limit'](_0x13a25f[_0x8bf9('0x1e')][_0x8bf9('0x10')]);_0x3d687a['offset']=qs[_0x8bf9('0xf')](_0x13a25f['query'][_0x8bf9('0xf')]);}_0x3d687a['order']=qs[_0x8bf9('0x3a')](_0x13a25f[_0x8bf9('0x1e')][_0x8bf9('0x3a')]);_0x3d687a['where']=qs[_0x8bf9('0x25')](_[_0x8bf9('0x3b')](_0x13a25f[_0x8bf9('0x1e')],_0x2b7793[_0x8bf9('0x25')]));_0x3d687a[_0x8bf9('0x3c')][_0x8bf9('0x3d')]=_0x5c2e23['id'];if(_0x13a25f[_0x8bf9('0x1e')][_0x8bf9('0x3e')]){_0x3d687a[_0x8bf9('0x3c')]=_[_0x8bf9('0x2c')](_0x3d687a[_0x8bf9('0x3c')],{'$or':_[_0x8bf9('0x18')](_0x3d687a[_0x8bf9('0x28')],function(_0x53f1ec){var _0x2fd152={};_0x2fd152[_0x53f1ec]={'$like':'%'+_0x13a25f['query'][_0x8bf9('0x3e')]+'%'};return _0x2fd152;})});}if(_0x13a25f[_0x8bf9('0x1e')][_0x8bf9('0x3f')]){var _0x1b29a2=_0x13a25f[_0x8bf9('0x1e')][_0x8bf9('0x3f')][_0x8bf9('0x40')](',');var _0x8e756e={};_0x8e756e[_0x1b29a2[0x0]]={'$gte':moment(_0x1b29a2[0x1])[_0x8bf9('0x41')](_0x8bf9('0x42'))};_0x3d687a[_0x8bf9('0x3c')]=_[_0x8bf9('0x2c')](_0x3d687a['where'],_0x8e756e);}_0x3d687a=_[_0x8bf9('0x2c')]({},_0x3d687a,_0x13a25f[_0x8bf9('0x2d')]);return db[_0x8bf9('0x35')][_0x8bf9('0x11')]({'where':_0x3d687a['where']})[_0x8bf9('0x13')](function(_0x43b3cb){_0x17891e[_0x8bf9('0x11')]=_0x43b3cb;if(_0x13a25f[_0x8bf9('0x1e')][_0x8bf9('0x2a')]){_0x3d687a[_0x8bf9('0x2b')]=[{'all':!![]}];}return db[_0x8bf9('0x35')]['findAll'](_0x3d687a);})['then'](function(_0x2c8667){if(_0x13a25f[_0x8bf9('0x1e')][_0x8bf9('0x43')]==='true'){for(var _0x13323a=0x0;_0x13323a<_0x2c8667[_0x8bf9('0x29')];_0x13323a++){_0x2c8667[_0x13323a][_0x8bf9('0x30')]=juice(_0x2c8667[_0x13323a][_0x8bf9('0x30')]);}}_0x17891e[_0x8bf9('0x44')]=_0x2c8667;return _0x17891e;});}})[_0x8bf9('0x13')](respondWithFilteredResult(_0x14e65f,_0x3d687a))['catch'](handleError(_0x14e65f,null));};exports[_0x8bf9('0x45')]=function(_0x592f15,_0x464f67){return db['MailInteraction']['find']({'where':{'id':_0x592f15[_0x8bf9('0x32')]['id']}})[_0x8bf9('0x13')](handleEntityNotFound(_0x464f67,null))[_0x8bf9('0x13')](function(_0x5f3fc0){if(_0x5f3fc0){return _0x5f3fc0['setTags'](_0x592f15[_0x8bf9('0x30')][_0x8bf9('0x36')],_[_0x8bf9('0x46')](_0x592f15[_0x8bf9('0x30')],[_0x8bf9('0x36'),'id'])||{})[_0x8bf9('0x47')](function(){return db['Tag'][_0x8bf9('0x48')]({'attributes':['id','name',_0x8bf9('0x49')],'where':{'id':_0x592f15[_0x8bf9('0x30')][_0x8bf9('0x36')]}});})[_0x8bf9('0x13')](function(_0x5cfbc4){socket[_0x8bf9('0x4a')](_0x8bf9('0x4b'),{'id':Number(_0x592f15[_0x8bf9('0x32')]['id']),'tags':_0x5cfbc4||[]});return{'id':Number(_0x592f15['params']['id']),'tags':_0x5cfbc4||[]};});}})['then'](respondWithResult(_0x464f67,null))[_0x8bf9('0x20')](handleError(_0x464f67,null));};exports[_0x8bf9('0x4c')]=function(_0x6784e2,_0x1dde60){return db[_0x8bf9('0x24')]['find']({'where':{'id':_0x6784e2[_0x8bf9('0x32')]['id']}})[_0x8bf9('0x13')](handleEntityNotFound(_0x1dde60,null))[_0x8bf9('0x13')](function(_0xc8ad46){if(_0xc8ad46){return _0xc8ad46[_0x8bf9('0x4c')](_0x6784e2[_0x8bf9('0x1e')]['ids']);}})['then'](respondWithStatusCode(_0x1dde60,null))[_0x8bf9('0x20')](handleError(_0x1dde60,null));};exports[_0x8bf9('0x4d')]=function(_0x169a7b,_0xccea1c){var _0x3d7788=moment()[_0x8bf9('0x4e')]()[_0x8bf9('0x4f')]();var _0x3afe14=path[_0x8bf9('0x50')](config['root'],_0x8bf9('0x51'),_0x8bf9('0x52'),_0x8bf9('0x53'));var _0x3ae061=path[_0x8bf9('0x50')](config['root'],_0x8bf9('0x51'),'files','attachments');var _0x45728b=path['join'](_0x3afe14,_0x3d7788);var _0x2f6dca=util['format']('transcript-%d-%s.zip',_0x169a7b[_0x8bf9('0x32')]['id'],_0x3d7788);var _0x35ed1a=path[_0x8bf9('0x50')](_0x3afe14,_0x2f6dca);var _0x3df0a6=[];if(_0x169a7b['query'][_0x8bf9('0x54')]){_0x3df0a6[_0x8bf9('0x55')]({'model':db[_0x8bf9('0x56')],'as':_0x8bf9('0x57'),'raw':!![]});}var _0x30f85e=[{'model':db[_0x8bf9('0x35')],'as':_0x8bf9('0x58'),'attributes':['id',_0x8bf9('0x30'),_0x8bf9('0x59'),'to','cc','bcc',_0x8bf9('0x5a'),_0x8bf9('0x5b')],'where':{'secret':![]},'order':qs[_0x8bf9('0x3a')]('id'),'include':_0x3df0a6}];return db[_0x8bf9('0x24')]['find']({'where':{'id':_0x169a7b[_0x8bf9('0x32')]['id']},'include':_0x30f85e})['then'](handleEntityNotFound(_0xccea1c,null))[_0x8bf9('0x13')](function(_0x3fa2ae){if(_0x3fa2ae&&_0x3fa2ae[_0x8bf9('0x58')]){var _0xfe33c2=_0x3fa2ae[_0x8bf9('0x5c')]({'plain':!![]});fs[_0x8bf9('0x5d')](_0x45728b);return BPromise[_0x8bf9('0x5e')](_0xfe33c2[_0x8bf9('0x58')],function(_0x16cfc9,_0x5d843a){var _0x156c11={'from':_0x16cfc9['from'],'to':_0x16cfc9['to']||'missing.recipient@your.company.com','subject':_0x16cfc9[_0x8bf9('0x5a')],'html':htmlEntities[_0x8bf9('0x5f')](_0x16cfc9[_0x8bf9('0x30')]),'headers':{'Date':moment(_0x16cfc9[_0x8bf9('0x5b')])[_0x8bf9('0x41')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x16cfc9['cc']){_0x156c11[_0x8bf9('0x60')]['Cc']=_0x16cfc9['cc'];}if(_0x16cfc9[_0x8bf9('0x61')]){_0x156c11[_0x8bf9('0x60')]['Bcc']=_0x16cfc9[_0x8bf9('0x61')];}return new BPromise(function(_0x22149f,_0x5452bb){if(_0x16cfc9[_0x8bf9('0x57')]){for(var _0x28638f=0x0;_0x28638f<_0x16cfc9[_0x8bf9('0x57')][_0x8bf9('0x29')];_0x28638f++){var _0x5a23c8=_0x16cfc9[_0x8bf9('0x57')][_0x28638f];var _0xab6005=path[_0x8bf9('0x50')](_0x3ae061,_0x5a23c8[_0x8bf9('0x62')]);if(fs[_0x8bf9('0x63')](_0xab6005)){_0x156c11[_0x8bf9('0x54')][_0x8bf9('0x55')]({'name':_0x5a23c8[_0x8bf9('0x15')],'contentType':_0x5a23c8[_0x8bf9('0x1b')],'data':fs['readFileSync'](_0xab6005)});}}}emlformat[_0x8bf9('0x64')](_0x156c11,function(_0x21e5d4,_0x4f1fa4){if(_0x21e5d4)return _0x5452bb(_0x21e5d4);fs[_0x8bf9('0x65')](path[_0x8bf9('0x50')](_0x45728b,util[_0x8bf9('0x41')](_0x8bf9('0x66'),_0x5d843a)),_0x4f1fa4);return _0x22149f(_0x4f1fa4);});});})['then'](function(){return new BPromise(function(_0x28985f,_0x31f3ca){zipdir(_0x45728b,{'saveTo':_0x35ed1a},function(_0x171df5,_0x25c64f){if(_0x171df5)return _0x31f3ca(_0x171df5);return _0x28985f(_0x25c64f);});})[_0x8bf9('0x13')](function(){return new BPromise(function(_0x55ce84,_0x1aa8b4){rimraf(_0x45728b,function(_0x49c640){if(_0x49c640)_0x1aa8b4(_0x49c640);return _0x55ce84();});});})[_0x8bf9('0x13')](function(){return _0xccea1c[_0x8bf9('0x4d')](_0x35ed1a,_0x2f6dca,function(_0x40cd8e){if(!_0x40cd8e)fs[_0x8bf9('0x67')](_0x35ed1a);});});});}else{return _0xccea1c['sendStatus'](0xc8);}})[_0x8bf9('0x20')](handleError(_0xccea1c,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 046eacd..df169a0 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 _0x21b4=['catch','hasOwnProperty','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','then','setDataValue','map','length','emit'];(function(_0x56a290,_0x4d000c){var _0x576584=function(_0xd7a76e){while(--_0xd7a76e){_0x56a290['push'](_0x56a290['shift']());}};_0x576584(++_0x4d000c);}(_0x21b4,0x15b));var _0x421b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21b4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x421b('0x0'));var MailInteraction=require(_0x421b('0x1'))['db'][_0x421b('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x421b('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x421b('0x4')](0x0);var events={'afterCreate':_0x421b('0x5'),'afterUpdate':_0x421b('0x6'),'afterDestroy':_0x421b('0x7')};function emitEvent(_0x2b2775){return function(_0xd580d6,_0x3a9a70,_0x6056e1){_0xd580d6['getUsers']({'attributes':['id'],'raw':!![]})[_0x421b('0x8')](function(_0xefe3d7){_0xd580d6[_0x421b('0x9')]('Users',_0xefe3d7[_0x421b('0xa')](function(_0x38f603){return{'id':_0x38f603['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0xd580d6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xaeb4b6){_0xd580d6[_0x421b('0x9')]('unreadMessages',_0xaeb4b6[_0x421b('0xb')]);MailInteractionEvents[_0x421b('0xc')](_0x2b2775+':'+_0xd580d6['id'],_0xd580d6);MailInteractionEvents[_0x421b('0xc')](_0x2b2775,_0xd580d6);_0x6056e1(null);})[_0x421b('0xd')](_0x6056e1(null));};}for(var e in events){if(events[_0x421b('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x804b=['map','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','MailInteraction','MailMessage','update','remove','getUsers','setDataValue','Users'];(function(_0xacf8c,_0x1d484b){var _0x21fd7b=function(_0x10b1bf){while(--_0x10b1bf){_0xacf8c['push'](_0xacf8c['shift']());}};_0x21fd7b(++_0x1d484b);}(_0x804b,0x16f));var _0xb804=function(_0x25519f,_0x4adb82){_0x25519f=_0x25519f-0x0;var _0x5779fe=_0x804b[_0x25519f];return _0x5779fe;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xb804('0x0'))['db'][_0xb804('0x1')];var MailMessage=require(_0xb804('0x0'))['db'][_0xb804('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb804('0x3'),'afterDestroy':_0xb804('0x4')};function emitEvent(_0x43e790){return function(_0x5d262c,_0x12dc4e,_0x27b415){_0x5d262c[_0xb804('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x289753){_0x5d262c[_0xb804('0x6')](_0xb804('0x7'),_0x289753[_0xb804('0x8')](function(_0x15a49a){return{'id':_0x15a49a['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5d262c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1c2e77){_0x5d262c[_0xb804('0x6')](_0xb804('0x9'),_0x1c2e77[_0xb804('0xa')]);MailInteractionEvents[_0xb804('0xb')](_0x43e790+':'+_0x5d262c['id'],_0x5d262c);MailInteractionEvents['emit'](_0x43e790,_0x5d262c);_0x27b415(null);})[_0xb804('0xc')](_0x27b415(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xb804('0xd')](e,emitEvent(event));}}module[_0xb804('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 07d1f8c..f84c71f 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 _0xa054=['request-promise','path','rimraf','../../config/environment','exports','define','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x327e55,_0x2767ad){var _0x7a1a9e=function(_0x2e1fef){while(--_0x2e1fef){_0x327e55['push'](_0x327e55['shift']());}};_0x7a1a9e(++_0x2767ad);}(_0xa054,0x124));var _0x4a05=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0xa054[_0x252328];return _0xaa85b7;};'use strict';var _=require(_0x4a05('0x0'));var util=require(_0x4a05('0x1'));var logger=require(_0x4a05('0x2'))(_0x4a05('0x3'));var moment=require('moment');var BPromise=require(_0x4a05('0x4'));var rp=require(_0x4a05('0x5'));var fs=require('fs');var path=require(_0x4a05('0x6'));var rimraf=require(_0x4a05('0x7'));var config=require(_0x4a05('0x8'));var attributes=require('./mailInteraction.attributes');module[_0x4a05('0x9')]=function(_0x213ffc,_0xb3cc40){return _0x213ffc[_0x4a05('0xa')]('MailInteraction',attributes,{'tableName':_0x4a05('0xb'),'paranoid':![],'indexes':[{'name':_0x4a05('0xc'),'fields':[_0x4a05('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x14e08d,_0x5c252e,_0x55739d){if(_0x14e08d[_0x4a05('0xe')]){_0x14e08d[_0x4a05('0xf')]=moment()[_0x4a05('0x10')](_0x4a05('0x11'));}if(_0x14e08d[_0x4a05('0x12')]){_0x14e08d[_0x4a05('0x13')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x55739d(null,_0x5c252e);},'beforeUpdate':function(_0x2cf21f,_0x21f33b,_0x5f0bc4){if(_0x2cf21f[_0x4a05('0x14')](_0x4a05('0xe'))){_0x2cf21f[_0x4a05('0xf')]=_0x2cf21f['substatus']?moment()[_0x4a05('0x10')](_0x4a05('0x11')):null;}if(_0x2cf21f[_0x4a05('0x14')](_0x4a05('0x12'))){_0x2cf21f[_0x4a05('0x13')]=moment()[_0x4a05('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x2cf21f[_0x4a05('0xe')]=null;_0x2cf21f[_0x4a05('0xf')]=null;}_0x5f0bc4(null,_0x2cf21f);},'afterUpdate':function(_0x3dff90,_0x5408f2,_0x11f08e){var _0x37c795=_0x213ffc[_0x4a05('0x15')];var _0x374980=_0x3dff90['get']({'plain':!![]});if(_0x374980[_0x4a05('0x12')]){return _0x37c795[_0x4a05('0x16')][_0x4a05('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x374980['id']}})[_0x4a05('0x18')](function(){_0x11f08e();})[_0x4a05('0x19')](function(_0x36ad90){_0x11f08e(_0x36ad90);});}else{_0x11f08e();}}},'charset':'utf8mb4','collate':_0x4a05('0x1a')});}; \ No newline at end of file +var _0x59bd=['YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt','closed','closedAt','models','get','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','lodash','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','format'];(function(_0x59a38a,_0x5a0eb0){var _0x4d8d05=function(_0x283c24){while(--_0x283c24){_0x59a38a['push'](_0x59a38a['shift']());}};_0x4d8d05(++_0x5a0eb0);}(_0x59bd,0xba));var _0xd59b=function(_0x7d436e,_0x464307){_0x7d436e=_0x7d436e-0x0;var _0x309fb2=_0x59bd[_0x7d436e];return _0x309fb2;};'use strict';var _=require(_0xd59b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd59b('0x1'));var rp=require(_0xd59b('0x2'));var fs=require('fs');var path=require(_0xd59b('0x3'));var rimraf=require(_0xd59b('0x4'));var config=require('../../config/environment');var attributes=require(_0xd59b('0x5'));module[_0xd59b('0x6')]=function(_0xe8c230,_0x2c3413){return _0xe8c230[_0xd59b('0x7')](_0xd59b('0x8'),attributes,{'tableName':_0xd59b('0x9'),'paranoid':![],'indexes':[{'name':_0xd59b('0xa'),'fields':['subject','to'],'type':_0xd59b('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47e0f2,_0x42eaef,_0x15ffb1){if(_0x47e0f2[_0xd59b('0xc')]){_0x47e0f2['substatusAt']=moment()[_0xd59b('0xd')](_0xd59b('0xe'));}if(_0x47e0f2['closed']){_0x47e0f2['closedAt']=moment()[_0xd59b('0xd')](_0xd59b('0xe'));}_0x15ffb1(null,_0x42eaef);},'beforeUpdate':function(_0x4ac103,_0x4dc86e,_0x2c0d27){if(_0x4ac103[_0xd59b('0xf')](_0xd59b('0xc'))){_0x4ac103[_0xd59b('0x10')]=_0x4ac103['substatus']?moment()[_0xd59b('0xd')](_0xd59b('0xe')):null;}if(_0x4ac103[_0xd59b('0xf')](_0xd59b('0x11'))){_0x4ac103[_0xd59b('0x12')]=moment()[_0xd59b('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ac103['substatus']=null;_0x4ac103[_0xd59b('0x10')]=null;}_0x2c0d27(null,_0x4ac103);},'afterUpdate':function(_0x3c6146,_0x502585,_0x4eaa1f){var _0x2af675=_0xe8c230[_0xd59b('0x13')];var _0x4c3b08=_0x3c6146[_0xd59b('0x14')]({'plain':!![]});if(_0x4c3b08[_0xd59b('0x11')]){return _0x2af675[_0xd59b('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x4c3b08['id']}})[_0xd59b('0x16')](function(){_0x4eaa1f();})['catch'](function(_0xb9d3ec){_0x4eaa1f(_0xb9d3ec);});}else{_0x4eaa1f();}}},'charset':_0xd59b('0x17'),'collate':_0xd59b('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b4b07c7..e58bf02 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 _0xefe9=['catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','addTags','body','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','then','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','MailInteraction,\x20%s,\x20%s','info'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xefe9,0x83));var _0x9efe=function(_0x1cf1c6,_0x378916){_0x1cf1c6=_0x1cf1c6-0x0;var _0x2e08af=_0xefe9[_0x1cf1c6];return _0x2e08af;};'use strict';var _=require(_0x9efe('0x0'));var util=require('util');var moment=require(_0x9efe('0x1'));var BPromise=require('bluebird');var rs=require(_0x9efe('0x2'));var fs=require('fs');var Redis=require(_0x9efe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9efe('0x4'));var logger=require('../../config/logger')(_0x9efe('0x5'));var config=require(_0x9efe('0x6'));var jayson=require(_0x9efe('0x7'));var client=jayson[_0x9efe('0x8')][_0x9efe('0x9')]({'port':0x232a});config[_0x9efe('0xa')]=_[_0x9efe('0xb')](config['redis'],{'host':_0x9efe('0xc'),'port':0x18eb});var socket=require(_0x9efe('0xd'))(new Redis(config[_0x9efe('0xa')]));require(_0x9efe('0xe'))[_0x9efe('0xf')](socket);function respondWithRpcPromise(_0x46470b,_0x1d3a65,_0xcc0b43){return new BPromise(function(_0x1ba171,_0x6f12c7){return client['request'](_0x46470b,_0xcc0b43)[_0x9efe('0x10')](function(_0x33a695){logger['info']('MailInteraction,\x20%s,\x20%s',_0x1d3a65,'request\x20sent');logger[_0x9efe('0x11')](_0x9efe('0x12'),_0x1d3a65,_0x9efe('0x13'),JSON[_0x9efe('0x14')](_0x33a695));if(_0x33a695[_0x9efe('0x15')]){if(_0x33a695[_0x9efe('0x15')]['code']===0x1f4){logger[_0x9efe('0x15')]('MailInteraction,\x20%s,\x20%s',_0x1d3a65,_0x33a695[_0x9efe('0x15')][_0x9efe('0x16')]);return _0x6f12c7(_0x33a695[_0x9efe('0x15')]['message']);}logger[_0x9efe('0x15')](_0x9efe('0x17'),_0x1d3a65,_0x33a695[_0x9efe('0x15')][_0x9efe('0x16')]);return _0x1ba171(_0x33a695['error']['message']);}else{logger[_0x9efe('0x18')](_0x9efe('0x17'),_0x1d3a65,'request\x20sent');_0x1ba171(_0x33a695['result'][_0x9efe('0x16')]);}})[_0x9efe('0x19')](function(_0x5eb084){logger['error'](_0x9efe('0x17'),_0x1d3a65,_0x5eb084);_0x6f12c7(_0x5eb084);});});}exports[_0x9efe('0x1a')]=function(_0xd7673d){var _0x391f80=this;return new Promise(function(_0x1d8e24,_0x3a1f41){return db[_0x9efe('0x1b')][_0x9efe('0x1c')](_0xd7673d['body'],{'raw':_0xd7673d[_0x9efe('0x1d')]?_0xd7673d[_0x9efe('0x1d')][_0x9efe('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd7673d[_0x9efe('0x1d')]?_0xd7673d[_0x9efe('0x1d')][_0x9efe('0x1f')]||null:null,'attributes':_0xd7673d[_0x9efe('0x1d')]?_0xd7673d['options'][_0x9efe('0x20')]||null:null,'limit':_0xd7673d[_0x9efe('0x1d')]?_0xd7673d[_0x9efe('0x1d')]['limit']||null:null})[_0x9efe('0x10')](function(_0x5160b4){logger[_0x9efe('0x18')]('UpdateMailInteraction',_0xd7673d);logger[_0x9efe('0x11')]('UpdateMailInteraction',_0xd7673d,JSON[_0x9efe('0x14')](_0x5160b4));_0x1d8e24(_0x5160b4);})[_0x9efe('0x19')](function(_0x9fd63b){logger[_0x9efe('0x15')]('UpdateMailInteraction',_0x9fd63b[_0x9efe('0x16')],_0xd7673d);_0x3a1f41(_0x391f80[_0x9efe('0x15')](0x1f4,_0x9fd63b[_0x9efe('0x16')]));});});};exports['AddTagsToMailInteraction']=function(_0xee7d5d){return new Promise(function(_0x5640aa,_0x3d0f6c){return db['MailInteraction']['find']({'where':_0xee7d5d[_0x9efe('0x1d')]?_0xee7d5d[_0x9efe('0x1d')][_0x9efe('0x1f')]||null:null})[_0x9efe('0x10')](function(_0x297931){if(_0x297931){return _0x297931[_0x9efe('0x21')](_0xee7d5d[_0x9efe('0x22')][_0x9efe('0x23')],_[_0x9efe('0x24')](_0xee7d5d[_0x9efe('0x22')],[_0x9efe('0x23'),'id'])||{});}})[_0x9efe('0x25')](function(_0xde9b38){logger[_0x9efe('0x18')](_0x9efe('0x26'),_0xee7d5d);logger[_0x9efe('0x11')](_0x9efe('0x26'),_0xee7d5d,JSON[_0x9efe('0x14')](_0xde9b38));_0x5640aa(_0xde9b38);})[_0x9efe('0x19')](function(_0x61403e){logger['error'](_0x9efe('0x26'),_0x61403e[_0x9efe('0x16')],_0xee7d5d);_0x3d0f6c(_this[_0x9efe('0x15')](0x1f4,_0x61403e[_0x9efe('0x16')]));});});}; \ No newline at end of file +var _0x0721=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','result','catch','UpdateMailInteraction','options','raw','where','attributes','limit','AddTagsToMailInteraction','MailInteraction','find','addTags','body','ids','omit','AddTags','util','moment','randomstring'];(function(_0x2d6290,_0x3cae64){var _0x508d0f=function(_0x3dc0a4){while(--_0x3dc0a4){_0x2d6290['push'](_0x2d6290['shift']());}};_0x508d0f(++_0x3cae64);}(_0x0721,0x9d));var _0x1072=function(_0x373db9,_0x5819cd){_0x373db9=_0x373db9-0x0;var _0x3b423f=_0x0721[_0x373db9];return _0x3b423f;};'use strict';var _=require('lodash');var util=require(_0x1072('0x0'));var moment=require(_0x1072('0x1'));var BPromise=require('bluebird');var rs=require(_0x1072('0x2'));var fs=require('fs');var Redis=require(_0x1072('0x3'));var db=require(_0x1072('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1072('0x5'))(_0x1072('0x6'));var config=require('../../config/environment');var jayson=require(_0x1072('0x7'));var client=jayson['client'][_0x1072('0x8')]({'port':0x232a});config[_0x1072('0x9')]=_['defaults'](config[_0x1072('0x9')],{'host':_0x1072('0xa'),'port':0x18eb});var socket=require(_0x1072('0xb'))(new Redis(config[_0x1072('0x9')]));require(_0x1072('0xc'))[_0x1072('0xd')](socket);function respondWithRpcPromise(_0x147532,_0xd4165e,_0x155ee2){return new BPromise(function(_0x392471,_0x25cb50){return client[_0x1072('0xe')](_0x147532,_0x155ee2)[_0x1072('0xf')](function(_0x4f7bc9){logger[_0x1072('0x10')]('MailInteraction,\x20%s,\x20%s',_0xd4165e,_0x1072('0x11'));logger[_0x1072('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0xd4165e,_0x1072('0x11'),JSON[_0x1072('0x13')](_0x4f7bc9));if(_0x4f7bc9['error']){if(_0x4f7bc9[_0x1072('0x14')][_0x1072('0x15')]===0x1f4){logger[_0x1072('0x14')]('MailInteraction,\x20%s,\x20%s',_0xd4165e,_0x4f7bc9[_0x1072('0x14')]['message']);return _0x25cb50(_0x4f7bc9[_0x1072('0x14')][_0x1072('0x16')]);}logger[_0x1072('0x14')](_0x1072('0x17'),_0xd4165e,_0x4f7bc9[_0x1072('0x14')][_0x1072('0x16')]);return _0x392471(_0x4f7bc9[_0x1072('0x14')][_0x1072('0x16')]);}else{logger['info'](_0x1072('0x17'),_0xd4165e,'request\x20sent');_0x392471(_0x4f7bc9[_0x1072('0x18')][_0x1072('0x16')]);}})[_0x1072('0x19')](function(_0x31c12b){logger[_0x1072('0x14')](_0x1072('0x17'),_0xd4165e,_0x31c12b);_0x25cb50(_0x31c12b);});});}exports[_0x1072('0x1a')]=function(_0x37953e){var _0x26b333=this;return new Promise(function(_0x26959e,_0x14db18){return db['MailInteraction']['update'](_0x37953e['body'],{'raw':_0x37953e[_0x1072('0x1b')]?_0x37953e[_0x1072('0x1b')][_0x1072('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37953e['options']?_0x37953e[_0x1072('0x1b')][_0x1072('0x1d')]||null:null,'attributes':_0x37953e[_0x1072('0x1b')]?_0x37953e[_0x1072('0x1b')][_0x1072('0x1e')]||null:null,'limit':_0x37953e[_0x1072('0x1b')]?_0x37953e[_0x1072('0x1b')][_0x1072('0x1f')]||null:null})[_0x1072('0xf')](function(_0x3c29c9){logger[_0x1072('0x10')](_0x1072('0x1a'),_0x37953e);logger[_0x1072('0x12')](_0x1072('0x1a'),_0x37953e,JSON['stringify'](_0x3c29c9));_0x26959e(_0x3c29c9);})[_0x1072('0x19')](function(_0x1a8dad){logger['error'](_0x1072('0x1a'),_0x1a8dad['message'],_0x37953e);_0x14db18(_0x26b333[_0x1072('0x14')](0x1f4,_0x1a8dad[_0x1072('0x16')]));});});};exports[_0x1072('0x20')]=function(_0xc5e1a2){return new Promise(function(_0x30535c,_0x430c50){return db[_0x1072('0x21')][_0x1072('0x22')]({'where':_0xc5e1a2[_0x1072('0x1b')]?_0xc5e1a2[_0x1072('0x1b')]['where']||null:null})[_0x1072('0xf')](function(_0x27a60c){if(_0x27a60c){return _0x27a60c[_0x1072('0x23')](_0xc5e1a2[_0x1072('0x24')][_0x1072('0x25')],_[_0x1072('0x26')](_0xc5e1a2[_0x1072('0x24')],['ids','id'])||{});}})['spread'](function(_0x3089e7){logger[_0x1072('0x10')](_0x1072('0x27'),_0xc5e1a2);logger[_0x1072('0x12')](_0x1072('0x27'),_0xc5e1a2,JSON['stringify'](_0x3089e7));_0x30535c(_0x3089e7);})[_0x1072('0x19')](function(_0x26ce17){logger[_0x1072('0x14')]('AddTags',_0x26ce17[_0x1072('0x16')],_0xc5e1a2);_0x430c50(_this[_0x1072('0x14')](0x1f4,_0x26ce17[_0x1072('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 91c9765..4a9a7f6 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 _0x6439=['mailInteraction:','./mailInteraction.events','save','update','emit','removeListener','register'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0x6439,0x158));var _0x9643=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6439[_0x167cc1];return _0x10bc4b;};'use strict';var MailInteractionEvents=require(_0x9643('0x0'));var events=[_0x9643('0x1'),'remove',_0x9643('0x2')];function createListener(_0xd0375c,_0x5c455f){return function(_0x1e665c){_0x5c455f[_0x9643('0x3')](_0xd0375c,_0x1e665c);};}function removeListener(_0x4e1054,_0x1ab471){return function(){MailInteractionEvents[_0x9643('0x4')](_0x4e1054,_0x1ab471);};}exports[_0x9643('0x5')]=function(_0x431c32){for(var _0x5d68c1=0x0,_0x3a3d62=events['length'];_0x5d68c1<_0x3a3d62;_0x5d68c1++){var _0x414cd0=events[_0x5d68c1];var _0x36b5dd=createListener(_0x9643('0x6')+_0x414cd0,_0x431c32);MailInteractionEvents['on'](_0x414cd0,_0x36b5dd);}}; \ No newline at end of file +var _0xd030=['removeListener','register','length','remove','update'];(function(_0x323132,_0x20a048){var _0x5c6334=function(_0x37dc43){while(--_0x37dc43){_0x323132['push'](_0x323132['shift']());}};_0x5c6334(++_0x20a048);}(_0xd030,0x8a));var _0x0d03=function(_0x483d12,_0x5468e8){_0x483d12=_0x483d12-0x0;var _0x6f3aac=_0xd030[_0x483d12];return _0x6f3aac;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x0d03('0x0'),_0x0d03('0x1')];function createListener(_0x81ea01,_0x1c1e44){return function(_0x4113d3){_0x1c1e44['emit'](_0x81ea01,_0x4113d3);};}function removeListener(_0x400341,_0x5bffdb){return function(){MailInteractionEvents[_0x0d03('0x2')](_0x400341,_0x5bffdb);};}exports[_0x0d03('0x3')]=function(_0x2e063d){for(var _0x398e6d=0x0,_0xe2820f=events[_0x0d03('0x4')];_0x398e6d<_0xe2820f;_0x398e6d++){var _0x37cf1a=events[_0x398e6d];var _0x4346a6=createListener('mailInteraction:'+_0x37cf1a,_0x2e063d);MailInteractionEvents['on'](_0x37cf1a,_0x4346a6);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index e7f5c6b..81d9a5e 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 _0xe148=['/:id/accept','accept','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','/describe','isAuthenticated','show','/:id/download','download','post','mail','create','put','/:id','update'];(function(_0x29f0b0,_0x320941){var _0x2d8df4=function(_0x434191){while(--_0x434191){_0x29f0b0['push'](_0x29f0b0['shift']());}};_0x2d8df4(++_0x320941);}(_0xe148,0x109));var _0x8e14=function(_0x9105f4,_0x3bf6f7){_0x9105f4=_0x9105f4-0x0;var _0x57a818=_0xe148[_0x9105f4];return _0x57a818;};'use strict';var multer=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var path=require(_0x8e14('0x2'));var timeout=require(_0x8e14('0x3'));var express=require(_0x8e14('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8e14('0x5'));var interaction=require(_0x8e14('0x6'));var config=require(_0x8e14('0x7'));var controller=require(_0x8e14('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8e14('0x9')](_0x8e14('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x8e14('0x9')]('/:id',auth[_0x8e14('0xb')](),controller[_0x8e14('0xc')]);router[_0x8e14('0x9')](_0x8e14('0xd'),auth[_0x8e14('0xb')](),controller[_0x8e14('0xe')]);router[_0x8e14('0xf')]('/',auth[_0x8e14('0xb')](),interaction['tracked'](_0x8e14('0x10'),'mailmessage:create'),controller[_0x8e14('0x11')]);router[_0x8e14('0x12')](_0x8e14('0x13'),auth[_0x8e14('0xb')](),controller[_0x8e14('0x14')]);router['put'](_0x8e14('0x15'),auth[_0x8e14('0xb')](),controller[_0x8e14('0x16')]);router[_0x8e14('0x12')]('/:id/reject',auth[_0x8e14('0xb')](),controller['reject']);router[_0x8e14('0x17')](_0x8e14('0x13'),auth[_0x8e14('0xb')](),controller[_0x8e14('0x18')]);module[_0x8e14('0x19')]=router; \ No newline at end of file +var _0xd49c=['fs-extra','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','mail','mailmessage:create','create','update','put','accept','/:id/reject','reject','delete','util','connect-timeout','express'];(function(_0xcc63ee,_0x21c385){var _0x5213e7=function(_0x6da353){while(--_0x6da353){_0xcc63ee['push'](_0xcc63ee['shift']());}};_0x5213e7(++_0x21c385);}(_0xd49c,0x1d8));var _0xcd49=function(_0x474318,_0x17998e){_0x474318=_0x474318-0x0;var _0x20b1c7=_0xd49c[_0x474318];return _0x20b1c7;};'use strict';var multer=require('multer');var util=require(_0xcd49('0x0'));var path=require('path');var timeout=require(_0xcd49('0x1'));var express=require(_0xcd49('0x2'));var router=express['Router']();var fs_extra=require(_0xcd49('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcd49('0x4'));var config=require('../../config/environment');var controller=require(_0xcd49('0x5'));router[_0xcd49('0x6')]('/',auth[_0xcd49('0x7')](),controller[_0xcd49('0x8')]);router[_0xcd49('0x6')](_0xcd49('0x9'),auth[_0xcd49('0x7')](),controller[_0xcd49('0xa')]);router[_0xcd49('0x6')](_0xcd49('0xb'),auth[_0xcd49('0x7')](),controller['show']);router[_0xcd49('0x6')](_0xcd49('0xc'),auth[_0xcd49('0x7')](),controller[_0xcd49('0xd')]);router[_0xcd49('0xe')]('/',auth[_0xcd49('0x7')](),interaction[_0xcd49('0xf')](_0xcd49('0x10'),_0xcd49('0x11')),controller[_0xcd49('0x12')]);router['put']('/:id',auth[_0xcd49('0x7')](),controller[_0xcd49('0x13')]);router[_0xcd49('0x14')]('/:id/accept',auth[_0xcd49('0x7')](),controller[_0xcd49('0x15')]);router['put'](_0xcd49('0x16'),auth[_0xcd49('0x7')](),controller[_0xcd49('0x17')]);router[_0xcd49('0x18')](_0xcd49('0xb'),auth[_0xcd49('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 335138f..92ac2fd 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 _0xf4ae=['lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat'];(function(_0x764079,_0x377a6a){var _0x50b1d2=function(_0x1f9b0c){while(--_0x1f9b0c){_0x764079['push'](_0x764079['shift']());}};_0x50b1d2(++_0x377a6a);}(_0xf4ae,0x193));var _0xef4a=function(_0x1d30a3,_0x5f428c){_0x1d30a3=_0x1d30a3-0x0;var _0x32bba1=_0xf4ae[_0x1d30a3];return _0x32bba1;};'use strict';var Sequelize=require('sequelize');var _=require(_0xef4a('0x0'));module[_0xef4a('0x1')]={'body':{'type':Sequelize[_0xef4a('0x2')](_0xef4a('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xef4a('0x2')](_0xef4a('0x4'))},'read':{'type':Sequelize[_0xef4a('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xef4a('0x6')]('in',_0xef4a('0x7')),'defaultValue':_0xef4a('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xef4a('0x8')](0x1fe)},'from':{'type':Sequelize[_0xef4a('0x8')]},'to':{'type':Sequelize[_0xef4a('0x2')](_0xef4a('0x3'))},'cc':{'type':Sequelize[_0xef4a('0x2')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xef4a('0x3'))},'subject':{'type':Sequelize[_0xef4a('0x2')]},'sentAt':{'type':Sequelize[_0xef4a('0x9')]},'attach':{'type':Sequelize[_0xef4a('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xef4a('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xef4a('0x9')]},'originTo':{'type':Sequelize[_0xef4a('0x2')](_0xef4a('0x3'))},'originCc':{'type':Sequelize[_0xef4a('0x2')](_0xef4a('0x3'))},'originChannel':{'type':Sequelize[_0xef4a('0x6')](_0xef4a('0xb'),_0xef4a('0xc')),'defaultValue':_0xef4a('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x7eba=['long','DATE','Chat','Email','lodash','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x5e6ee1,_0x138d50){var _0x16e387=function(_0x57de4f){while(--_0x57de4f){_0x5e6ee1['push'](_0x5e6ee1['shift']());}};_0x16e387(++_0x138d50);}(_0x7eba,0x67));var _0xa7eb=function(_0x1b3388,_0x5e9b8c){_0x1b3388=_0x1b3388-0x0;var _0x95160d=_0x7eba[_0x1b3388];return _0x95160d;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa7eb('0x0'));module[_0xa7eb('0x1')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa7eb('0x2')]('medium')},'read':{'type':Sequelize[_0xa7eb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa7eb('0x4')]('in',_0xa7eb('0x5')),'defaultValue':_0xa7eb('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xa7eb('0x6')]},'to':{'type':Sequelize[_0xa7eb('0x2')](_0xa7eb('0x7'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0xa7eb('0x2')](_0xa7eb('0x7'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa7eb('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa7eb('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xa7eb('0x7'))},'originCc':{'type':Sequelize[_0xa7eb('0x2')](_0xa7eb('0x7'))},'originChannel':{'type':Sequelize[_0xa7eb('0x4')]('Email',_0xa7eb('0x9')),'defaultValue':_0xa7eb('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0302165..4db49d8 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 _0xadee=['html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','offset','undefined','count','limit','status','json','destroy','end','sendStatus','stack','name','index','map','MailMessage','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','update','body','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','CmContact','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','List','Contacts','ListId','List\x20not\x20found','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','user','agent','UserId','MailInteraction','MailInteractionId','isNil','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','download','unix','toString','files','server','message-%s.eml','from','bcc','subject','createdAt','decode','headers','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','eml-format','bluebird','util','path','lodash','ioredis'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xadee,0x1e0));var _0xeade=function(_0x4ce976,_0x244b80){_0x4ce976=_0x4ce976-0x0;var _0x414f10=_0xadee[_0x4ce976];return _0x414f10;};'use strict';var emlformat=require(_0xeade('0x0'));var moment=require('moment');var BPromise=require(_0xeade('0x1'));var util=require(_0xeade('0x2'));var path=require(_0xeade('0x3'));var fs=require('fs');var _=require(_0xeade('0x4'));var Redis=require(_0xeade('0x5'));var htmlToText=require(_0xeade('0x6'));var qs=require(_0xeade('0x7'));var logger=require(_0xeade('0x8'))(_0xeade('0x9'));var interaction_log=require(_0xeade('0x8'))(_0xeade('0xa'));var config=require(_0xeade('0xb'));var db=require(_0xeade('0xc'))['db'];config[_0xeade('0xd')]=_[_0xeade('0xe')](config[_0xeade('0xd')],{'host':_0xeade('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeade('0xd')]));var htmlEntities=require(_0xeade('0x10'));require(_0xeade('0x11'))[_0xeade('0x12')](socket);var jayson=require('jayson/promise');var client=jayson[_0xeade('0x13')][_0xeade('0x14')]({'port':0x232c});var client9003=jayson[_0xeade('0x13')][_0xeade('0x14')]({'port':0x232b});var client9002=jayson[_0xeade('0x13')][_0xeade('0x14')]({'port':0x232a});function respondWithRpcPromise(_0xe62fcc,_0x2a98c9,_0x38e15a,_0x1bdc80){return new BPromise(function(_0xb45c58,_0x234af6){var _0x4911e6=_0x1bdc80||client;return _0x4911e6[_0xeade('0x15')](_0xe62fcc,_0x38e15a)[_0xeade('0x16')](function(_0x6c6524){logger[_0xeade('0x17')](_0xeade('0x18'),_0x2a98c9,_0xeade('0x19'));logger[_0xeade('0x1a')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2a98c9,_0xeade('0x19'),JSON[_0xeade('0x1b')](_0x6c6524));if(_0x6c6524[_0xeade('0x1c')]){if(_0x6c6524[_0xeade('0x1c')][_0xeade('0x1d')]===0x1f4){logger['error'](_0xeade('0x18'),_0x2a98c9,_0x6c6524[_0xeade('0x1c')]['message']);return _0x234af6(_0x6c6524[_0xeade('0x1c')][_0xeade('0x1e')]);}logger[_0xeade('0x1c')]('MailMessage,\x20%s,\x20%s',_0x2a98c9,_0x6c6524['error'][_0xeade('0x1e')]);return _0xb45c58(_0x6c6524[_0xeade('0x1c')]['message']);}else{logger[_0xeade('0x17')](_0xeade('0x18'),_0x2a98c9,_0xeade('0x19'));_0xb45c58(_0x6c6524[_0xeade('0x1f')][_0xeade('0x1e')]);}})[_0xeade('0x20')](function(_0x46ca46){logger[_0xeade('0x1c')](_0xeade('0x18'),_0x2a98c9,_0x46ca46);_0x234af6(_0x46ca46);});});}function respondWithResult(_0x2e121c,_0x1b58df){_0x1b58df=_0x1b58df||0xc8;return function(_0x177e02){if(_0x177e02){return _0x2e121c['status'](_0x1b58df)['json'](_0x177e02);}};}function respondWithFilteredResult(_0x5e9799,_0x4d45fd){return function(_0x16e42e){if(_0x16e42e){var _0x250d26=typeof _0x4d45fd[_0xeade('0x21')]===_0xeade('0x22')&&typeof _0x4d45fd['limit']==='undefined';var _0x372ec1=_0x16e42e[_0xeade('0x23')];var _0x352e97=_0x250d26?0x0:_0x4d45fd['offset'];var _0x239c3b=_0x250d26?_0x16e42e[_0xeade('0x23')]:_0x4d45fd[_0xeade('0x21')]+_0x4d45fd[_0xeade('0x24')];var _0x4f0671;if(_0x239c3b>=_0x372ec1){_0x239c3b=_0x372ec1;_0x4f0671=0xc8;}else{_0x4f0671=0xce;}_0x5e9799[_0xeade('0x25')](_0x4f0671);return _0x5e9799['set']('Content-Range',_0x352e97+'-'+_0x239c3b+'/'+_0x372ec1)[_0xeade('0x26')](_0x16e42e);}return null;};}function saveUpdates(_0x4eae17){return function(_0x42e227){if(_0x42e227){return _0x42e227['update'](_0x4eae17)['then'](function(_0xb32e71){return _0xb32e71;});}return null;};}function removeEntity(_0x1eb781){return function(_0x2834e8){if(_0x2834e8){return _0x2834e8[_0xeade('0x27')]()[_0xeade('0x16')](function(){_0x1eb781[_0xeade('0x25')](0xcc)[_0xeade('0x28')]();});}};}function handleEntityNotFound(_0x1fb2eb){return function(_0x5c77c7){if(!_0x5c77c7){_0x1fb2eb[_0xeade('0x29')](0x194);}return _0x5c77c7;};}function handleError(_0x4d8f0a,_0x1fdad1){_0x1fdad1=_0x1fdad1||0x1f4;return function(_0x1fbbcb){logger[_0xeade('0x1c')](_0x1fbbcb[_0xeade('0x2a')]);if(_0x1fbbcb[_0xeade('0x2b')]){delete _0x1fbbcb[_0xeade('0x2b')];}_0x4d8f0a[_0xeade('0x25')](_0x1fdad1)['send'](_0x1fbbcb);};}exports[_0xeade('0x2c')]=function(_0x48ed8e,_0x11cfc3){var _0x209b1c={},_0x209fa7={},_0x5c47e8={'count':0x0,'rows':[]};var _0x478832=_[_0xeade('0x2d')](db[_0xeade('0x2e')]['rawAttributes'],function(_0x5b95ff){return{'name':_0x5b95ff[_0xeade('0x2f')],'type':_0x5b95ff[_0xeade('0x30')][_0xeade('0x31')]};});_0x209fa7['model']=_['map'](_0x478832,_0xeade('0x2b'));_0x209fa7[_0xeade('0x32')]=_[_0xeade('0x33')](_0x48ed8e[_0xeade('0x32')]);_0x209fa7[_0xeade('0x34')]=_[_0xeade('0x35')](_0x209fa7[_0xeade('0x36')],_0x209fa7[_0xeade('0x32')]);_0x209b1c['attributes']=_[_0xeade('0x35')](_0x209fa7[_0xeade('0x36')],qs[_0xeade('0x37')](_0x48ed8e[_0xeade('0x32')][_0xeade('0x37')]));_0x209b1c[_0xeade('0x38')]=_0x209b1c[_0xeade('0x38')][_0xeade('0x39')]?_0x209b1c[_0xeade('0x38')]:_0x209fa7[_0xeade('0x36')];if(!_0x48ed8e[_0xeade('0x32')][_0xeade('0x3a')]('nolimit')){_0x209b1c[_0xeade('0x24')]=qs[_0xeade('0x24')](_0x48ed8e[_0xeade('0x32')]['limit']);_0x209b1c['offset']=qs['offset'](_0x48ed8e['query'][_0xeade('0x21')]);}_0x209b1c[_0xeade('0x3b')]=qs['sort'](_0x48ed8e[_0xeade('0x32')][_0xeade('0x3c')]);_0x209b1c['where']=qs[_0xeade('0x34')](_[_0xeade('0x3d')](_0x48ed8e[_0xeade('0x32')],_0x209fa7[_0xeade('0x34')]),_0x478832);if(_0x48ed8e[_0xeade('0x32')][_0xeade('0x3e')]){_0x209b1c[_0xeade('0x3f')]=_[_0xeade('0x40')](_0x209b1c[_0xeade('0x3f')],{'$or':_[_0xeade('0x2d')](_0x478832,function(_0x5c0a09){if(_0x5c0a09[_0xeade('0x30')]!==_0xeade('0x41')){var _0x113792={};_0x113792[_0x5c0a09[_0xeade('0x2b')]]={'$like':'%'+_0x48ed8e[_0xeade('0x32')]['filter']+'%'};return _0x113792;}})});}_0x209b1c=_[_0xeade('0x40')]({},_0x209b1c,_0x48ed8e[_0xeade('0x42')]);var _0x2a4b86={'where':_0x209b1c[_0xeade('0x3f')]};return db[_0xeade('0x2e')][_0xeade('0x23')](_0x2a4b86)[_0xeade('0x16')](function(_0x53b36c){_0x5c47e8[_0xeade('0x23')]=_0x53b36c;if(_0x48ed8e[_0xeade('0x32')][_0xeade('0x43')]){_0x209b1c[_0xeade('0x44')]=[{'all':!![]}];}return db['MailMessage'][_0xeade('0x45')](_0x209b1c);})[_0xeade('0x16')](function(_0x3ea073){_0x5c47e8[_0xeade('0x46')]=_0x3ea073;return _0x5c47e8;})[_0xeade('0x16')](respondWithFilteredResult(_0x11cfc3,_0x209b1c))[_0xeade('0x20')](handleError(_0x11cfc3,null));};exports[_0xeade('0x47')]=function(_0x492772,_0x2f4b92){var _0x11cc1f={'raw':!![],'where':{'id':_0x492772[_0xeade('0x48')]['id']}},_0x50785e={};_0x50785e['model']=_[_0xeade('0x33')](db[_0xeade('0x2e')][_0xeade('0x49')]);_0x50785e[_0xeade('0x32')]=_['keys'](_0x492772[_0xeade('0x32')]);_0x50785e[_0xeade('0x34')]=_['intersection'](_0x50785e['model'],_0x50785e[_0xeade('0x32')]);_0x11cc1f[_0xeade('0x38')]=_[_0xeade('0x35')](_0x50785e[_0xeade('0x36')],qs[_0xeade('0x37')](_0x492772[_0xeade('0x32')][_0xeade('0x37')]));_0x11cc1f[_0xeade('0x38')]=_0x11cc1f['attributes'][_0xeade('0x39')]?_0x11cc1f[_0xeade('0x38')]:_0x50785e['model'];if(_0x492772['query']['includeAll']){_0x11cc1f[_0xeade('0x44')]=[{'all':!![]}];}_0x11cc1f=_[_0xeade('0x40')]({},_0x11cc1f,_0x492772[_0xeade('0x42')]);return db[_0xeade('0x2e')][_0xeade('0x4a')](_0x11cc1f)['then'](handleEntityNotFound(_0x2f4b92,null))['then'](respondWithResult(_0x2f4b92,null))['catch'](handleError(_0x2f4b92,null));};exports[_0xeade('0x4b')]=function(_0x219c73,_0x5b8d1f){if(_0x219c73[_0xeade('0x4c')]['id']){delete _0x219c73[_0xeade('0x4c')]['id'];}return db[_0xeade('0x2e')][_0xeade('0x4a')]({'where':{'id':_0x219c73[_0xeade('0x48')]['id']}})[_0xeade('0x16')](handleEntityNotFound(_0x5b8d1f,null))[_0xeade('0x16')](saveUpdates(_0x219c73[_0xeade('0x4c')],null))[_0xeade('0x16')](respondWithResult(_0x5b8d1f,null))[_0xeade('0x20')](handleError(_0x5b8d1f,null));};exports['destroy']=function(_0x4a0519,_0x4c0b9e){return db[_0xeade('0x2e')]['find']({'where':{'id':_0x4a0519['params']['id']}})[_0xeade('0x16')](handleEntityNotFound(_0x4c0b9e,null))[_0xeade('0x16')](removeEntity(_0x4c0b9e,null))[_0xeade('0x20')](handleError(_0x4c0b9e,null));};exports[_0xeade('0x4d')]=function(_0x3d59db,_0x1d2ef7){return db[_0xeade('0x2e')]['describe']()[_0xeade('0x16')](respondWithResult(_0x1d2ef7,null))[_0xeade('0x20')](handleError(_0x1d2ef7,null));};exports[_0xeade('0x4e')]=function(_0x3f157c,_0x4506c4){return db[_0xeade('0x2e')][_0xeade('0x4e')](_0x3f157c[_0xeade('0x4c')])[_0xeade('0x16')](function(_0x559b9c){if(_0x559b9c){if(_0x559b9c[_0xeade('0x4f')]===_0xeade('0x50')&&!_0x559b9c['secret']){var _0x3d0158,_0x2066f3,_0x3dc99b;if(_0x3f157c[_0xeade('0x4c')]['to']){_0x2066f3=_0x3f157c[_0xeade('0x4c')]['to'][_0xeade('0x51')](',')[0x0];}return db[_0xeade('0x52')][_0xeade('0x53')]({'where':{'id':_0x559b9c[_0xeade('0x54')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xeade('0x55')],'as':'Contacts','where':{'email':_0x2066f3},'limit':0x1,'order':[['updatedAt',_0xeade('0x56')]]}]},{'model':db[_0xeade('0x57')],'as':_0xeade('0x58'),'raw':!![],'include':[{'model':db[_0xeade('0x59')],'as':_0xeade('0x59'),'raw':!![]}]}]})[_0xeade('0x16')](function(_0x230d63){_0x3d0158=_0x230d63;if(!_0x3d0158||!_0x3d0158['Smtp'])return;var _0x86fe66=_0x3d0158[_0xeade('0x5a')]();if(_0x3f157c[_0xeade('0x4c')][_0xeade('0x5b')]&&_0x3f157c[_0xeade('0x4c')][_0xeade('0x5b')][_0xeade('0x39')]){for(var _0x192af5=0x0;_0x192af5<_0x3f157c[_0xeade('0x4c')]['attachments'][_0xeade('0x39')];_0x192af5+=0x1){_0x3f157c['body'][_0xeade('0x5b')][_0x192af5]={'filename':_0x3f157c['body'][_0xeade('0x5b')][_0x192af5]['name'],'path':path[_0xeade('0x5c')](config[_0xeade('0x5d')],'server/files/attachments',_0x3f157c[_0xeade('0x4c')][_0xeade('0x5b')][_0x192af5][_0xeade('0x5e')])};}}_0x3dc99b={'account':_0x86fe66,'message':_0x3f157c[_0xeade('0x4c')]};return;})[_0xeade('0x16')](function(){if(_0x3d0158[_0xeade('0x5f')]){if(_0x3d0158[_0xeade('0x5f')][_0xeade('0x60')]['length']){return _0x3d0158[_0xeade('0x5f')][_0xeade('0x60')][0x0];}else{return db[_0xeade('0x55')][_0xeade('0x4e')](_['defaults'](_0x3f157c[_0xeade('0x4c')],{'firstName':_0x3f157c[_0xeade('0x4c')]['to'],'email':_0x3f157c[_0xeade('0x4c')]['to'],'phone':_0x3f157c[_0xeade('0x4c')]['to'],'ListId':_0x3d0158[_0xeade('0x61')]}));}}else{throw new Error(_0xeade('0x62'));}})['then'](function(){if(_0x3dc99b){return respondWithRpcPromise('SendMail','sendMail',_0x3dc99b,client9003)['then'](function(_0x1cc609){return _0x559b9c[_0xeade('0x4b')]({'read':!![],'messageId':_0x1cc609[_0xeade('0x63')],'sentAt':moment()[_0xeade('0x64')](_0xeade('0x65'))});})[_0xeade('0x20')](function(_0x4fece4){logger['error']('%s',JSON[_0xeade('0x1b')](_0x4fece4));return _0x559b9c;});}return _0x559b9c;});}return _0x559b9c;}})[_0xeade('0x16')](respondWithResult(_0x4506c4,0xc9))[_0xeade('0x20')](handleError(_0x4506c4,null));};exports[_0xeade('0x66')]=function(_0xfb1b26,_0x460c17){var _0x1e2d49={'agent':{},'channel':_0xeade('0x67')};if(_0xfb1b26[_0xeade('0x4c')]['id']){delete _0xfb1b26[_0xeade('0x4c')]['id'];}_0xfb1b26['body'][_0xeade('0x68')]=!![];_0xfb1b26[_0xeade('0x4c')][_0xeade('0x69')]=moment()[_0xeade('0x64')](_0xeade('0x65'));_0xfb1b26['body']['UserId']=_0xfb1b26['body']['UserId']||_0xfb1b26[_0xeade('0x6a')]['id'];_0x1e2d49[_0xeade('0x6b')]['id']=_0xfb1b26[_0xeade('0x4c')][_0xeade('0x6c')];return db[_0xeade('0x2e')][_0xeade('0x4a')]({'where':{'id':_0xfb1b26[_0xeade('0x48')]['id'],'UserId':null}})[_0xeade('0x16')](handleEntityNotFound(_0x460c17,null))[_0xeade('0x16')](saveUpdates(_0xfb1b26[_0xeade('0x4c')],null))[_0xeade('0x16')](function(_0x5adedc){if(_0x5adedc){_0x1e2d49[_0xeade('0x1e')]=_0x5adedc['get']({'plain':!![]});return db[_0xeade('0x6d')][_0xeade('0x4a')]({'where':{'id':_0x5adedc[_0xeade('0x6e')]}});}return null;})[_0xeade('0x16')](handleEntityNotFound(_0x460c17,null))[_0xeade('0x16')](function(_0x4401ca){if(_0x4401ca){return _0x4401ca[_0xeade('0x4b')]({'UserId':_0xfb1b26[_0xeade('0x4c')][_0xeade('0x6c')],'read1stAt':_[_0xeade('0x6f')](_0x4401ca[_0xeade('0x70')])?moment()[_0xeade('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xeade('0x16')](function(_0x22415a){if(_0x22415a){_0x1e2d49['interaction']=_0x22415a[_0xeade('0x71')]({'plain':!![]});interaction_log[_0xeade('0x17')](_0xeade('0x72'),_0xfb1b26['user']['id'],_0xfb1b26[_0xeade('0x6a')]['name'],_0xfb1b26[_0xeade('0x6a')][_0xeade('0x73')],_0x1e2d49[_0xeade('0x74')]['id'],_0xfb1b26['body']?JSON[_0xeade('0x1b')](_0xfb1b26[_0xeade('0x4c')]):_0xeade('0x75'));return respondWithRpcPromise(_0xeade('0x76'),_0xeade('0x77'),_0x1e2d49);}return null;})['then'](function(_0x25ea38){var _0x29f487=_0xeade('0x78')+_0x25ea38[_0xeade('0x1e')][_0xeade('0x79')];return db[_0xeade('0x7a')][_0xeade('0x32')](_0x29f487,{'type':db[_0xeade('0x7b')][_0xeade('0x7c')][_0xeade('0x7d')],'raw':!![]})['then'](function(_0x110d62){return _0x110d62;});})[_0xeade('0x16')](function(_0x4c8198){if(_0x4c8198){_0x1e2d49[_0xeade('0x1e')][_0xeade('0x7e')]=_0x4c8198[0x0];if(!_0xfb1b26[_0xeade('0x4c')][_0xeade('0x6c')])return;return db[_0xeade('0x7f')][_0xeade('0x4a')]({'where':{'id':_0xfb1b26[_0xeade('0x4c')][_0xeade('0x6c')],'role':_0xeade('0x6b')},'attributes':['id',_0xeade('0x2b'),_0xeade('0x80'),_0xeade('0x81'),'internal'],'raw':!![]});}return null;})[_0xeade('0x16')](function(_0x34c234){if(!_0x34c234)return null;_0x1e2d49[_0xeade('0x1e')][_0xeade('0x6b')]=_0x34c234;return _0x1e2d49;})[_0xeade('0x16')](function(_0x14f976){if(_0x14f976){if(_0xfb1b26['body'][_0xeade('0x82')]){_0x1e2d49[_0xeade('0x1e')][_0xeade('0x83')]=util[_0xeade('0x64')](_0xeade('0x84'),_0xfb1b26['user'][_0xeade('0x2b')]);_0x1e2d49['message'][_0xeade('0x85')]=_0x1e2d49['channel'];_0x1e2d49[_0xeade('0x1e')][_0xeade('0x86')]=_0x1e2d49[_0xeade('0x85')];_0x1e2d49['message'][_0xeade('0x87')]=_0xeade('0x66');_0x1e2d49[_0xeade('0x1e')]['body']=htmlToText[_0xeade('0x88')](_0x1e2d49['message'][_0xeade('0x4c')]);return respondWithRpcPromise('EventManager',_0xeade('0x89'),{'event':_0xeade('0x8a'),'message':_0x1e2d49['message']},client9002)[_0xeade('0x16')](function(){return _0x1e2d49;});}return _0x1e2d49;}return null;})[_0xeade('0x16')](respondWithResult(_0x460c17,null))[_0xeade('0x20')](handleError(_0x460c17,null));};exports[_0xeade('0x8b')]=function(_0x2377cd,_0x2b2591){var _0x5e689e={'agent':{},'channel':'mail'};if(_0x2377cd[_0xeade('0x4c')]['id']){delete _0x2377cd[_0xeade('0x4c')]['id'];}_0x2377cd[_0xeade('0x4c')][_0xeade('0x6c')]=_0x2377cd[_0xeade('0x4c')][_0xeade('0x6c')]||_0x2377cd[_0xeade('0x6a')]['id'];_0x5e689e['agent']['id']=_0x2377cd[_0xeade('0x4c')][_0xeade('0x6c')];return db['MailMessage'][_0xeade('0x4a')]({'where':{'id':_0x2377cd['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b2591,null))['then'](function(_0x56c30f){if(_0x56c30f){_0x5e689e[_0xeade('0x1e')]=_0x56c30f[_0xeade('0x71')]({'plain':!![]});return db['MailInteraction'][_0xeade('0x4a')]({'where':{'id':_0x56c30f['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2b2591,null))[_0xeade('0x16')](function(_0x606fea){if(_0x606fea){_0x5e689e[_0xeade('0x74')]=_0x606fea[_0xeade('0x71')]({'plain':!![]});interaction_log[_0xeade('0x17')](_0xeade('0x8c'),_0x2377cd[_0xeade('0x6a')]['id'],_0x2377cd['user']['name'],_0x2377cd[_0xeade('0x6a')]['role'],_0x5e689e[_0xeade('0x74')]['id'],_0x2377cd['body']?JSON[_0xeade('0x1b')](_0x2377cd['body']):'null');return respondWithRpcPromise(_0xeade('0x8d'),'rejectMessage',_0x5e689e);}return null;})[_0xeade('0x16')](function(_0x54b5a7){var _0x194538=_0xeade('0x78')+_0x54b5a7[_0xeade('0x1e')]['ContactId'];return db[_0xeade('0x7a')][_0xeade('0x32')](_0x194538,{'type':db[_0xeade('0x7b')][_0xeade('0x7c')]['SELECT'],'raw':!![]})[_0xeade('0x16')](function(_0x5d5de9){return _0x5d5de9;});})[_0xeade('0x16')](function(_0x211dfc){if(_0x211dfc){_0x5e689e[_0xeade('0x1e')]['contact']=_0x211dfc[0x0];if(!_0x2377cd[_0xeade('0x4c')]['UserId'])return;return db[_0xeade('0x7f')]['find']({'where':{'id':_0x2377cd[_0xeade('0x4c')]['UserId'],'role':_0xeade('0x6b')},'attributes':['id','name','fullname',_0xeade('0x81'),'internal'],'raw':!![]});}return null;})[_0xeade('0x16')](function(_0xdd3aed){if(!_0xdd3aed)return null;_0x5e689e['message'][_0xeade('0x6b')]=_0xdd3aed;return _0x5e689e;})['then'](function(_0x4bb81f){if(_0x4bb81f){_0x4bb81f[_0xeade('0x1e')]['interface']=util['format']('SIP/%s',_0x2377cd[_0xeade('0x6a')][_0xeade('0x2b')]);_0x4bb81f[_0xeade('0x1e')][_0xeade('0x85')]=_0x5e689e[_0xeade('0x85')];_0x4bb81f['message'][_0xeade('0x86')]=_0x5e689e[_0xeade('0x85')];_0x4bb81f['message'][_0xeade('0x87')]='reject';_0x4bb81f[_0xeade('0x1e')][_0xeade('0x4c')]=htmlToText[_0xeade('0x88')](_0x5e689e[_0xeade('0x1e')][_0xeade('0x4c')]);respondWithRpcPromise(_0xeade('0x89'),_0xeade('0x89'),{'event':_0xeade('0x8e'),'message':_0x4bb81f['message']},client9002);return _0x5e689e;}return null;})['then'](respondWithResult(_0x2b2591,null))[_0xeade('0x20')](handleError(_0x2b2591,null));};exports[_0xeade('0x8f')]=function(_0x11067f,_0x1ca063){var _0x2bcf16=moment()[_0xeade('0x90')]()[_0xeade('0x91')]();var _0x4bc14a=path['join'](config['root'],'server',_0xeade('0x92'),'tmp');var _0x4a72d1=path[_0xeade('0x5c')](config[_0xeade('0x5d')],_0xeade('0x93'),_0xeade('0x92'),_0xeade('0x5b'));var _0x580686=util[_0xeade('0x64')](_0xeade('0x94'),_0x2bcf16);return db[_0xeade('0x2e')][_0xeade('0x4a')]({'where':{'id':_0x11067f[_0xeade('0x48')]['id']},'attributes':['id','body',_0xeade('0x95'),'to','cc',_0xeade('0x96'),_0xeade('0x97'),_0xeade('0x98')],'include':_0x11067f['query'][_0xeade('0x5b')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0xeade('0x16')](handleEntityNotFound(_0x1ca063,null))[_0xeade('0x16')](function(_0x5cc618){if(_0x5cc618){var _0x2f73de=_0x5cc618;var _0x21d69a={'from':_0x2f73de[_0xeade('0x95')],'to':_0x2f73de['to'],'subject':_0x2f73de['subject'],'html':htmlEntities[_0xeade('0x99')](_0x2f73de[_0xeade('0x4c')]),'headers':{'Date':moment(_0x2f73de['createdAt'])[_0xeade('0x64')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x5cc618['cc']){_0x21d69a['headers']['Cc']=_0x5cc618['cc'];}if(_0x5cc618[_0xeade('0x96')]){_0x21d69a[_0xeade('0x9a')][_0xeade('0x9b')]=_0x5cc618[_0xeade('0x96')];}return new BPromise(function(_0x2a7fe0,_0x1cc63b){if(_0x5cc618[_0xeade('0x9c')]){for(var _0x27171c=0x0;_0x27171c<_0x5cc618[_0xeade('0x9c')][_0xeade('0x39')];_0x27171c++){var _0x2948a1=_0x5cc618[_0xeade('0x9c')][_0x27171c];var _0x22d86f=path[_0xeade('0x5c')](_0x4a72d1,_0x2948a1[_0xeade('0x5e')]);if(fs[_0xeade('0x9d')](_0x22d86f)){_0x21d69a['attachments'][_0xeade('0x9e')]({'name':_0x2948a1[_0xeade('0x2b')],'contentType':_0x2948a1[_0xeade('0x30')],'data':fs[_0xeade('0x9f')](_0x22d86f)});}}}emlformat[_0xeade('0xa0')](_0x21d69a,function(_0x5733d,_0x1fad46){if(_0x5733d)return _0x1cc63b(_0x5733d);fs[_0xeade('0xa1')](path[_0xeade('0x5c')](_0x4bc14a,_0x580686),_0x1fad46);return _0x2a7fe0(_0x1fad46);});});}})[_0xeade('0x16')](function(_0x10f2e2){if(_0x10f2e2){return _0x1ca063[_0xeade('0x8f')](path[_0xeade('0x5c')](_0x4bc14a,_0x580686),_0x580686,function(_0x33da9e){if(!_0x33da9e)fs['unlinkSync'](path[_0xeade('0x5c')](_0x4bc14a,_0x580686));});}})[_0xeade('0x20')](handleError(_0x1ca063,null));}; \ No newline at end of file +var _0x9917=['event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','SELECT','User','email','interface','reject','rejectmessage','download','toString','join','server','files','tmp','from','bcc','subject','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','readFileSync','build','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','status','json','offset','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','body','find','describe','create','direction','out','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','basename','List','defaults','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','fullname','internal','manual','channel','motionChannel'];(function(_0x265462,_0x5c817d){var _0x5b0090=function(_0x4a601f){while(--_0x4a601f){_0x265462['push'](_0x265462['shift']());}};_0x5b0090(++_0x5c817d);}(_0x9917,0xbf));var _0x7991=function(_0x268d1b,_0x54cd9d){_0x268d1b=_0x268d1b-0x0;var _0x321e07=_0x9917[_0x268d1b];return _0x321e07;};'use strict';var emlformat=require(_0x7991('0x0'));var moment=require(_0x7991('0x1'));var BPromise=require(_0x7991('0x2'));var util=require(_0x7991('0x3'));var path=require(_0x7991('0x4'));var fs=require('fs');var _=require(_0x7991('0x5'));var Redis=require(_0x7991('0x6'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7991('0x7'));var interaction_log=require('../../config/logger')(_0x7991('0x8'));var config=require(_0x7991('0x9'));var db=require(_0x7991('0xa'))['db'];config[_0x7991('0xb')]=_['defaults'](config[_0x7991('0xb')],{'host':_0x7991('0xc'),'port':0x18eb});var socket=require(_0x7991('0xd'))(new Redis(config[_0x7991('0xb')]));var htmlEntities=require('html-entities');require(_0x7991('0xe'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x7991('0xf')][_0x7991('0x10')]({'port':0x232c});var client9003=jayson[_0x7991('0xf')]['http']({'port':0x232b});var client9002=jayson['client'][_0x7991('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x4ae9e6,_0x77b7b8,_0x3047af,_0x294cdc){return new BPromise(function(_0x2f202d,_0x4fda8a){var _0x35cef7=_0x294cdc||client;return _0x35cef7[_0x7991('0x11')](_0x4ae9e6,_0x3047af)[_0x7991('0x12')](function(_0x684c98){logger['info'](_0x7991('0x13'),_0x77b7b8,_0x7991('0x14'));logger[_0x7991('0x15')](_0x7991('0x16'),_0x77b7b8,_0x7991('0x14'),JSON[_0x7991('0x17')](_0x684c98));if(_0x684c98['error']){if(_0x684c98[_0x7991('0x18')][_0x7991('0x19')]===0x1f4){logger[_0x7991('0x18')](_0x7991('0x13'),_0x77b7b8,_0x684c98[_0x7991('0x18')][_0x7991('0x1a')]);return _0x4fda8a(_0x684c98['error'][_0x7991('0x1a')]);}logger[_0x7991('0x18')]('MailMessage,\x20%s,\x20%s',_0x77b7b8,_0x684c98[_0x7991('0x18')][_0x7991('0x1a')]);return _0x2f202d(_0x684c98[_0x7991('0x18')][_0x7991('0x1a')]);}else{logger[_0x7991('0x1b')]('MailMessage,\x20%s,\x20%s',_0x77b7b8,_0x7991('0x14'));_0x2f202d(_0x684c98['result'][_0x7991('0x1a')]);}})['catch'](function(_0x41c6dc){logger['error']('MailMessage,\x20%s,\x20%s',_0x77b7b8,_0x41c6dc);_0x4fda8a(_0x41c6dc);});});}function respondWithResult(_0xd9d24b,_0xf3ee2d){_0xf3ee2d=_0xf3ee2d||0xc8;return function(_0x22b20e){if(_0x22b20e){return _0xd9d24b[_0x7991('0x1c')](_0xf3ee2d)[_0x7991('0x1d')](_0x22b20e);}};}function respondWithFilteredResult(_0x6ade7b,_0x29bf26){return function(_0x491d13){if(_0x491d13){var _0x46b92b=typeof _0x29bf26[_0x7991('0x1e')]===_0x7991('0x1f')&&typeof _0x29bf26['limit']===_0x7991('0x1f');var _0x1ed2db=_0x491d13[_0x7991('0x20')];var _0x53a900=_0x46b92b?0x0:_0x29bf26[_0x7991('0x1e')];var _0x26f3e6=_0x46b92b?_0x491d13[_0x7991('0x20')]:_0x29bf26[_0x7991('0x1e')]+_0x29bf26['limit'];var _0x2f9d63;if(_0x26f3e6>=_0x1ed2db){_0x26f3e6=_0x1ed2db;_0x2f9d63=0xc8;}else{_0x2f9d63=0xce;}_0x6ade7b[_0x7991('0x1c')](_0x2f9d63);return _0x6ade7b[_0x7991('0x21')](_0x7991('0x22'),_0x53a900+'-'+_0x26f3e6+'/'+_0x1ed2db)['json'](_0x491d13);}return null;};}function saveUpdates(_0x3eee14){return function(_0x41b893){if(_0x41b893){return _0x41b893[_0x7991('0x23')](_0x3eee14)[_0x7991('0x12')](function(_0x9fd92c){return _0x9fd92c;});}return null;};}function removeEntity(_0x275beb){return function(_0x1f6b97){if(_0x1f6b97){return _0x1f6b97[_0x7991('0x24')]()['then'](function(){_0x275beb[_0x7991('0x1c')](0xcc)[_0x7991('0x25')]();});}};}function handleEntityNotFound(_0x230c93){return function(_0x5f25f0){if(!_0x5f25f0){_0x230c93[_0x7991('0x26')](0x194);}return _0x5f25f0;};}function handleError(_0x5edea2,_0x5a82a6){_0x5a82a6=_0x5a82a6||0x1f4;return function(_0xab47bc){logger[_0x7991('0x18')](_0xab47bc[_0x7991('0x27')]);if(_0xab47bc[_0x7991('0x28')]){delete _0xab47bc['name'];}_0x5edea2[_0x7991('0x1c')](_0x5a82a6)['send'](_0xab47bc);};}exports[_0x7991('0x29')]=function(_0x5a36d0,_0x1e0e80){var _0x121c03={},_0x9dda38={},_0x1e43f2={'count':0x0,'rows':[]};var _0x552a90=_[_0x7991('0x2a')](db[_0x7991('0x2b')][_0x7991('0x2c')],function(_0x541cf7){return{'name':_0x541cf7[_0x7991('0x2d')],'type':_0x541cf7[_0x7991('0x2e')][_0x7991('0x2f')]};});_0x9dda38[_0x7991('0x30')]=_['map'](_0x552a90,'name');_0x9dda38[_0x7991('0x31')]=_[_0x7991('0x32')](_0x5a36d0[_0x7991('0x31')]);_0x9dda38['filters']=_[_0x7991('0x33')](_0x9dda38[_0x7991('0x30')],_0x9dda38['query']);_0x121c03[_0x7991('0x34')]=_[_0x7991('0x33')](_0x9dda38[_0x7991('0x30')],qs[_0x7991('0x35')](_0x5a36d0[_0x7991('0x31')][_0x7991('0x35')]));_0x121c03['attributes']=_0x121c03[_0x7991('0x34')][_0x7991('0x36')]?_0x121c03[_0x7991('0x34')]:_0x9dda38[_0x7991('0x30')];if(!_0x5a36d0[_0x7991('0x31')][_0x7991('0x37')]('nolimit')){_0x121c03[_0x7991('0x38')]=qs[_0x7991('0x38')](_0x5a36d0['query'][_0x7991('0x38')]);_0x121c03[_0x7991('0x1e')]=qs[_0x7991('0x1e')](_0x5a36d0['query'][_0x7991('0x1e')]);}_0x121c03[_0x7991('0x39')]=qs['sort'](_0x5a36d0['query']['sort']);_0x121c03[_0x7991('0x3a')]=qs[_0x7991('0x3b')](_[_0x7991('0x3c')](_0x5a36d0[_0x7991('0x31')],_0x9dda38['filters']),_0x552a90);if(_0x5a36d0['query'][_0x7991('0x3d')]){_0x121c03[_0x7991('0x3a')]=_[_0x7991('0x3e')](_0x121c03['where'],{'$or':_[_0x7991('0x2a')](_0x552a90,function(_0x1fb118){if(_0x1fb118['type']!==_0x7991('0x3f')){var _0x2f79b2={};_0x2f79b2[_0x1fb118[_0x7991('0x28')]]={'$like':'%'+_0x5a36d0[_0x7991('0x31')][_0x7991('0x3d')]+'%'};return _0x2f79b2;}})});}_0x121c03=_['merge']({},_0x121c03,_0x5a36d0[_0x7991('0x40')]);var _0x30a739={'where':_0x121c03[_0x7991('0x3a')]};return db[_0x7991('0x2b')]['count'](_0x30a739)['then'](function(_0x53bc74){_0x1e43f2['count']=_0x53bc74;if(_0x5a36d0[_0x7991('0x31')][_0x7991('0x41')]){_0x121c03[_0x7991('0x42')]=[{'all':!![]}];}return db[_0x7991('0x2b')][_0x7991('0x43')](_0x121c03);})[_0x7991('0x12')](function(_0x44f8fa){_0x1e43f2[_0x7991('0x44')]=_0x44f8fa;return _0x1e43f2;})['then'](respondWithFilteredResult(_0x1e0e80,_0x121c03))[_0x7991('0x45')](handleError(_0x1e0e80,null));};exports['show']=function(_0x27c71f,_0x422ed9){var _0x4203b3={'raw':!![],'where':{'id':_0x27c71f[_0x7991('0x46')]['id']}},_0x52a9cd={};_0x52a9cd['model']=_[_0x7991('0x32')](db['MailMessage'][_0x7991('0x2c')]);_0x52a9cd[_0x7991('0x31')]=_[_0x7991('0x32')](_0x27c71f[_0x7991('0x31')]);_0x52a9cd[_0x7991('0x3b')]=_[_0x7991('0x33')](_0x52a9cd[_0x7991('0x30')],_0x52a9cd[_0x7991('0x31')]);_0x4203b3[_0x7991('0x34')]=_[_0x7991('0x33')](_0x52a9cd[_0x7991('0x30')],qs[_0x7991('0x35')](_0x27c71f[_0x7991('0x31')][_0x7991('0x35')]));_0x4203b3['attributes']=_0x4203b3[_0x7991('0x34')][_0x7991('0x36')]?_0x4203b3[_0x7991('0x34')]:_0x52a9cd[_0x7991('0x30')];if(_0x27c71f[_0x7991('0x31')][_0x7991('0x41')]){_0x4203b3[_0x7991('0x42')]=[{'all':!![]}];}_0x4203b3=_[_0x7991('0x3e')]({},_0x4203b3,_0x27c71f[_0x7991('0x40')]);return db[_0x7991('0x2b')]['find'](_0x4203b3)[_0x7991('0x12')](handleEntityNotFound(_0x422ed9,null))[_0x7991('0x12')](respondWithResult(_0x422ed9,null))['catch'](handleError(_0x422ed9,null));};exports[_0x7991('0x23')]=function(_0x202575,_0x31bf80){if(_0x202575['body']['id']){delete _0x202575[_0x7991('0x47')]['id'];}return db[_0x7991('0x2b')][_0x7991('0x48')]({'where':{'id':_0x202575[_0x7991('0x46')]['id']}})['then'](handleEntityNotFound(_0x31bf80,null))[_0x7991('0x12')](saveUpdates(_0x202575[_0x7991('0x47')],null))[_0x7991('0x12')](respondWithResult(_0x31bf80,null))['catch'](handleError(_0x31bf80,null));};exports['destroy']=function(_0x406686,_0x317911){return db['MailMessage'][_0x7991('0x48')]({'where':{'id':_0x406686[_0x7991('0x46')]['id']}})[_0x7991('0x12')](handleEntityNotFound(_0x317911,null))[_0x7991('0x12')](removeEntity(_0x317911,null))['catch'](handleError(_0x317911,null));};exports[_0x7991('0x49')]=function(_0x2abbe4,_0x5b9eee){return db['MailMessage'][_0x7991('0x49')]()[_0x7991('0x12')](respondWithResult(_0x5b9eee,null))[_0x7991('0x45')](handleError(_0x5b9eee,null));};exports[_0x7991('0x4a')]=function(_0x395d96,_0x1b4125){return db['MailMessage'][_0x7991('0x4a')](_0x395d96['body'])[_0x7991('0x12')](function(_0x39e4e1){if(_0x39e4e1){if(_0x39e4e1[_0x7991('0x4b')]===_0x7991('0x4c')&&!_0x39e4e1['secret']){var _0x58430e,_0x390108,_0x1f99f4;if(_0x395d96[_0x7991('0x47')]['to']){_0x390108=_0x395d96[_0x7991('0x47')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x7991('0x4d')]({'where':{'id':_0x39e4e1[_0x7991('0x4e')]},'include':[{'model':db[_0x7991('0x4f')],'as':'List','include':[{'model':db[_0x7991('0x50')],'as':_0x7991('0x51'),'where':{'email':_0x390108},'limit':0x1,'order':[[_0x7991('0x52'),_0x7991('0x53')]]}]},{'model':db[_0x7991('0x54')],'as':_0x7991('0x55'),'raw':!![],'include':[{'model':db[_0x7991('0x56')],'as':_0x7991('0x56'),'raw':!![]}]}]})[_0x7991('0x12')](function(_0x278e9b){_0x58430e=_0x278e9b;if(!_0x58430e||!_0x58430e[_0x7991('0x55')])return;var _0xd1c651=_0x58430e[_0x7991('0x57')]();if(_0x395d96[_0x7991('0x47')][_0x7991('0x58')]&&_0x395d96[_0x7991('0x47')][_0x7991('0x58')]['length']){for(var _0x4e93de=0x0;_0x4e93de<_0x395d96[_0x7991('0x47')][_0x7991('0x58')][_0x7991('0x36')];_0x4e93de+=0x1){_0x395d96['body'][_0x7991('0x58')][_0x4e93de]={'filename':_0x395d96['body'][_0x7991('0x58')][_0x4e93de][_0x7991('0x28')],'path':path['join'](config[_0x7991('0x59')],_0x7991('0x5a'),_0x395d96[_0x7991('0x47')][_0x7991('0x58')][_0x4e93de][_0x7991('0x5b')])};}}_0x1f99f4={'account':_0xd1c651,'message':_0x395d96[_0x7991('0x47')]};return;})[_0x7991('0x12')](function(){if(_0x58430e[_0x7991('0x5c')]){if(_0x58430e[_0x7991('0x5c')]['Contacts'][_0x7991('0x36')]){return _0x58430e[_0x7991('0x5c')]['Contacts'][0x0];}else{return db[_0x7991('0x50')][_0x7991('0x4a')](_[_0x7991('0x5d')](_0x395d96[_0x7991('0x47')],{'firstName':_0x395d96[_0x7991('0x47')]['to'],'email':_0x395d96[_0x7991('0x47')]['to'],'phone':_0x395d96[_0x7991('0x47')]['to'],'ListId':_0x58430e[_0x7991('0x5e')]}));}}else{throw new Error(_0x7991('0x5f'));}})[_0x7991('0x12')](function(){if(_0x1f99f4){return respondWithRpcPromise('SendMail',_0x7991('0x60'),_0x1f99f4,client9003)[_0x7991('0x12')](function(_0x3c88ea){return _0x39e4e1['update']({'read':!![],'messageId':_0x3c88ea[_0x7991('0x61')],'sentAt':moment()[_0x7991('0x62')](_0x7991('0x63'))});})[_0x7991('0x45')](function(_0x12a545){logger[_0x7991('0x18')]('%s',JSON[_0x7991('0x17')](_0x12a545));return _0x39e4e1;});}return _0x39e4e1;});}return _0x39e4e1;}})['then'](respondWithResult(_0x1b4125,0xc9))['catch'](handleError(_0x1b4125,null));};exports[_0x7991('0x64')]=function(_0x25633b,_0x51a33b){var _0x42bc0a={'agent':{},'channel':_0x7991('0x65')};if(_0x25633b['body']['id']){delete _0x25633b['body']['id'];}_0x25633b['body']['read']=!![];_0x25633b[_0x7991('0x47')][_0x7991('0x66')]=moment()[_0x7991('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x25633b[_0x7991('0x47')][_0x7991('0x67')]=_0x25633b[_0x7991('0x47')][_0x7991('0x67')]||_0x25633b['user']['id'];_0x42bc0a[_0x7991('0x68')]['id']=_0x25633b[_0x7991('0x47')]['UserId'];return db[_0x7991('0x2b')][_0x7991('0x48')]({'where':{'id':_0x25633b['params']['id'],'UserId':null}})[_0x7991('0x12')](handleEntityNotFound(_0x51a33b,null))[_0x7991('0x12')](saveUpdates(_0x25633b[_0x7991('0x47')],null))[_0x7991('0x12')](function(_0x2e53ad){if(_0x2e53ad){_0x42bc0a[_0x7991('0x1a')]=_0x2e53ad[_0x7991('0x69')]({'plain':!![]});return db[_0x7991('0x6a')]['find']({'where':{'id':_0x2e53ad[_0x7991('0x6b')]}});}return null;})[_0x7991('0x12')](handleEntityNotFound(_0x51a33b,null))[_0x7991('0x12')](function(_0x2e62cf){if(_0x2e62cf){return _0x2e62cf[_0x7991('0x23')]({'UserId':_0x25633b['body']['UserId'],'read1stAt':_[_0x7991('0x6c')](_0x2e62cf[_0x7991('0x6d')])?moment()[_0x7991('0x62')](_0x7991('0x63')):undefined});}return null;})[_0x7991('0x12')](function(_0x162db6){if(_0x162db6){_0x42bc0a[_0x7991('0x6e')]=_0x162db6[_0x7991('0x69')]({'plain':!![]});interaction_log[_0x7991('0x1b')](_0x7991('0x6f'),_0x25633b[_0x7991('0x70')]['id'],_0x25633b[_0x7991('0x70')][_0x7991('0x28')],_0x25633b[_0x7991('0x70')][_0x7991('0x71')],_0x42bc0a[_0x7991('0x6e')]['id'],_0x25633b[_0x7991('0x47')]?JSON[_0x7991('0x17')](_0x25633b[_0x7991('0x47')]):_0x7991('0x72'));return respondWithRpcPromise(_0x7991('0x73'),_0x7991('0x74'),_0x42bc0a);}return null;})['then'](function(_0x19c606){var _0x313552=_0x7991('0x75')+_0x19c606['message']['ContactId'];return db[_0x7991('0x76')][_0x7991('0x31')](_0x313552,{'type':db[_0x7991('0x77')][_0x7991('0x78')]['SELECT'],'raw':!![]})[_0x7991('0x12')](function(_0x8d9c21){return _0x8d9c21;});})[_0x7991('0x12')](function(_0x232ad4){if(_0x232ad4){_0x42bc0a[_0x7991('0x1a')][_0x7991('0x79')]=_0x232ad4[0x0];if(!_0x25633b['body'][_0x7991('0x67')])return;return db['User'][_0x7991('0x48')]({'where':{'id':_0x25633b[_0x7991('0x47')][_0x7991('0x67')],'role':_0x7991('0x68')},'attributes':['id',_0x7991('0x28'),_0x7991('0x7a'),'email',_0x7991('0x7b')],'raw':!![]});}return null;})[_0x7991('0x12')](function(_0x4bd10e){if(!_0x4bd10e)return null;_0x42bc0a['message'][_0x7991('0x68')]=_0x4bd10e;return _0x42bc0a;})['then'](function(_0x33575b){if(_0x33575b){if(_0x25633b[_0x7991('0x47')][_0x7991('0x7c')]){_0x42bc0a[_0x7991('0x1a')]['interface']=util['format']('SIP/%s',_0x25633b[_0x7991('0x70')][_0x7991('0x28')]);_0x42bc0a[_0x7991('0x1a')][_0x7991('0x7d')]=_0x42bc0a[_0x7991('0x7d')];_0x42bc0a[_0x7991('0x1a')][_0x7991('0x7e')]=_0x42bc0a[_0x7991('0x7d')];_0x42bc0a[_0x7991('0x1a')][_0x7991('0x7f')]=_0x7991('0x64');_0x42bc0a['message'][_0x7991('0x47')]=htmlToText[_0x7991('0x80')](_0x42bc0a[_0x7991('0x1a')][_0x7991('0x47')]);return respondWithRpcPromise(_0x7991('0x81'),'EventManager',{'event':_0x7991('0x82'),'message':_0x42bc0a[_0x7991('0x1a')]},client9002)[_0x7991('0x12')](function(){return _0x42bc0a;});}return _0x42bc0a;}return null;})[_0x7991('0x12')](respondWithResult(_0x51a33b,null))[_0x7991('0x45')](handleError(_0x51a33b,null));};exports['reject']=function(_0x41fb4a,_0x410d37){var _0x1d103f={'agent':{},'channel':_0x7991('0x65')};if(_0x41fb4a[_0x7991('0x47')]['id']){delete _0x41fb4a['body']['id'];}_0x41fb4a[_0x7991('0x47')][_0x7991('0x67')]=_0x41fb4a['body'][_0x7991('0x67')]||_0x41fb4a[_0x7991('0x70')]['id'];_0x1d103f[_0x7991('0x68')]['id']=_0x41fb4a[_0x7991('0x47')][_0x7991('0x67')];return db[_0x7991('0x2b')][_0x7991('0x48')]({'where':{'id':_0x41fb4a[_0x7991('0x46')]['id'],'UserId':null}})[_0x7991('0x12')](handleEntityNotFound(_0x410d37,null))[_0x7991('0x12')](function(_0x4b7f83){if(_0x4b7f83){_0x1d103f[_0x7991('0x1a')]=_0x4b7f83[_0x7991('0x69')]({'plain':!![]});return db[_0x7991('0x6a')]['find']({'where':{'id':_0x4b7f83[_0x7991('0x6b')]}});}return null;})[_0x7991('0x12')](handleEntityNotFound(_0x410d37,null))[_0x7991('0x12')](function(_0x42231f){if(_0x42231f){_0x1d103f[_0x7991('0x6e')]=_0x42231f[_0x7991('0x69')]({'plain':!![]});interaction_log[_0x7991('0x1b')](_0x7991('0x83'),_0x41fb4a[_0x7991('0x70')]['id'],_0x41fb4a['user'][_0x7991('0x28')],_0x41fb4a[_0x7991('0x70')][_0x7991('0x71')],_0x1d103f[_0x7991('0x6e')]['id'],_0x41fb4a[_0x7991('0x47')]?JSON[_0x7991('0x17')](_0x41fb4a[_0x7991('0x47')]):_0x7991('0x72'));return respondWithRpcPromise('RejectMessage',_0x7991('0x84'),_0x1d103f);}return null;})['then'](function(_0x3e4613){var _0x57ce45=_0x7991('0x75')+_0x3e4613[_0x7991('0x1a')][_0x7991('0x85')];return db[_0x7991('0x76')][_0x7991('0x31')](_0x57ce45,{'type':db[_0x7991('0x77')][_0x7991('0x78')][_0x7991('0x86')],'raw':!![]})['then'](function(_0x300c2d){return _0x300c2d;});})[_0x7991('0x12')](function(_0x513981){if(_0x513981){_0x1d103f[_0x7991('0x1a')][_0x7991('0x79')]=_0x513981[0x0];if(!_0x41fb4a[_0x7991('0x47')][_0x7991('0x67')])return;return db[_0x7991('0x87')][_0x7991('0x48')]({'where':{'id':_0x41fb4a[_0x7991('0x47')][_0x7991('0x67')],'role':_0x7991('0x68')},'attributes':['id',_0x7991('0x28'),_0x7991('0x7a'),_0x7991('0x88'),'internal'],'raw':!![]});}return null;})[_0x7991('0x12')](function(_0x545463){if(!_0x545463)return null;_0x1d103f[_0x7991('0x1a')][_0x7991('0x68')]=_0x545463;return _0x1d103f;})[_0x7991('0x12')](function(_0x21ec74){if(_0x21ec74){_0x21ec74['message'][_0x7991('0x89')]=util[_0x7991('0x62')]('SIP/%s',_0x41fb4a[_0x7991('0x70')][_0x7991('0x28')]);_0x21ec74[_0x7991('0x1a')]['channel']=_0x1d103f[_0x7991('0x7d')];_0x21ec74['message'][_0x7991('0x7e')]=_0x1d103f['channel'];_0x21ec74[_0x7991('0x1a')][_0x7991('0x7f')]=_0x7991('0x8a');_0x21ec74['message']['body']=htmlToText[_0x7991('0x80')](_0x1d103f[_0x7991('0x1a')][_0x7991('0x47')]);respondWithRpcPromise(_0x7991('0x81'),_0x7991('0x81'),{'event':_0x7991('0x8b'),'message':_0x21ec74[_0x7991('0x1a')]},client9002);return _0x1d103f;}return null;})[_0x7991('0x12')](respondWithResult(_0x410d37,null))[_0x7991('0x45')](handleError(_0x410d37,null));};exports[_0x7991('0x8c')]=function(_0x59e4b7,_0x47a1d5){var _0x27dd7f=moment()['unix']()[_0x7991('0x8d')]();var _0x151fde=path[_0x7991('0x8e')](config[_0x7991('0x59')],_0x7991('0x8f'),_0x7991('0x90'),_0x7991('0x91'));var _0x124117=path[_0x7991('0x8e')](config[_0x7991('0x59')],'server',_0x7991('0x90'),'attachments');var _0x2c3dfe=util[_0x7991('0x62')]('message-%s.eml',_0x27dd7f);return db[_0x7991('0x2b')][_0x7991('0x48')]({'where':{'id':_0x59e4b7['params']['id']},'attributes':['id','body',_0x7991('0x92'),'to','cc',_0x7991('0x93'),_0x7991('0x94'),_0x7991('0x95')],'include':_0x59e4b7[_0x7991('0x31')][_0x7991('0x58')]?[{'model':db[_0x7991('0x96')],'as':'Attachments'}]:undefined})[_0x7991('0x12')](handleEntityNotFound(_0x47a1d5,null))[_0x7991('0x12')](function(_0x279881){if(_0x279881){var _0x2e7d93=_0x279881;var _0x55af8e={'from':_0x2e7d93[_0x7991('0x92')],'to':_0x2e7d93['to'],'subject':_0x2e7d93['subject'],'html':htmlEntities['decode'](_0x2e7d93['body']),'headers':{'Date':moment(_0x2e7d93[_0x7991('0x95')])[_0x7991('0x62')](_0x7991('0x97'))},'attachments':[]};if(_0x279881['cc']){_0x55af8e[_0x7991('0x98')]['Cc']=_0x279881['cc'];}if(_0x279881[_0x7991('0x93')]){_0x55af8e[_0x7991('0x98')][_0x7991('0x99')]=_0x279881['bcc'];}return new BPromise(function(_0x11215d,_0x39d5f5){if(_0x279881[_0x7991('0x9a')]){for(var _0x3398da=0x0;_0x3398da<_0x279881[_0x7991('0x9a')][_0x7991('0x36')];_0x3398da++){var _0xffd3aa=_0x279881[_0x7991('0x9a')][_0x3398da];var _0x5d0fbd=path[_0x7991('0x8e')](_0x124117,_0xffd3aa['basename']);if(fs[_0x7991('0x9b')](_0x5d0fbd)){_0x55af8e[_0x7991('0x58')]['push']({'name':_0xffd3aa[_0x7991('0x28')],'contentType':_0xffd3aa[_0x7991('0x2e')],'data':fs[_0x7991('0x9c')](_0x5d0fbd)});}}}emlformat[_0x7991('0x9d')](_0x55af8e,function(_0x3b2ee8,_0x4e9816){if(_0x3b2ee8)return _0x39d5f5(_0x3b2ee8);fs['writeFileSync'](path[_0x7991('0x8e')](_0x151fde,_0x2c3dfe),_0x4e9816);return _0x11215d(_0x4e9816);});});}})['then'](function(_0x5f2925){if(_0x5f2925){return _0x47a1d5['download'](path[_0x7991('0x8e')](_0x151fde,_0x2c3dfe),_0x2c3dfe,function(_0x4a2047){if(!_0x4a2047)fs[_0x7991('0x9e')](path[_0x7991('0x8e')](_0x151fde,_0x2c3dfe));});}})[_0x7991('0x45')](handleError(_0x47a1d5,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e30a095..93f8917 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 _0x5d80=['MailMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3492c8,_0x5a40aa){var _0xf3e965=function(_0x4f7ee9){while(--_0x4f7ee9){_0x3492c8['push'](_0x3492c8['shift']());}};_0xf3e965(++_0x5a40aa);}(_0x5d80,0x1a2));var _0x05d8=function(_0x4a25c0,_0x3034ca){_0x4a25c0=_0x4a25c0-0x0;var _0x478f0c=_0x5d80[_0x4a25c0];return _0x478f0c;};'use strict';var EventEmitter=require(_0x05d8('0x0'));var MailMessage=require(_0x05d8('0x1'))['db'][_0x05d8('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x05d8('0x3')](0x0);var events={'afterCreate':_0x05d8('0x4'),'afterUpdate':_0x05d8('0x5'),'afterDestroy':'remove'};function emitEvent(_0xefbe4){return function(_0x8745f8,_0x143679,_0x277680){MailMessageEvents[_0x05d8('0x6')](_0xefbe4+':'+_0x8745f8['id'],_0x8745f8);MailMessageEvents[_0x05d8('0x6')](_0xefbe4,_0x8745f8);_0x277680(null);};}for(var e in events){if(events[_0x05d8('0x7')](e)){var event=events[e];MailMessage[_0x05d8('0x8')](e,emitEvent(event));}}module[_0x05d8('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x87ed=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x24b896,_0x586c4c){var _0x27b957=function(_0x597def){while(--_0x597def){_0x24b896['push'](_0x24b896['shift']());}};_0x27b957(++_0x586c4c);}(_0x87ed,0xda));var _0xd87e=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0x87ed[_0x51bda1];return _0x1ce08c;};'use strict';var EventEmitter=require(_0xd87e('0x0'));var MailMessage=require(_0xd87e('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd87e('0x2'),'afterUpdate':_0xd87e('0x3'),'afterDestroy':_0xd87e('0x4')};function emitEvent(_0x4059a1){return function(_0x3b68de,_0x5b5172,_0x4d6227){MailMessageEvents['emit'](_0x4059a1+':'+_0x3b68de['id'],_0x3b68de);MailMessageEvents[_0xd87e('0x5')](_0x4059a1,_0x3b68de);_0x4d6227(null);};}for(var e in events){if(events[_0xd87e('0x6')](e)){var event=events[e];MailMessage[_0xd87e('0x7')](e,emitEvent(event));}}module[_0xd87e('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 1ccca61..cd7eaa6 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 _0x69f1=['./mailMessage.attributes','MailMessage','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','toLowerCase','direction','out','findOne','MailInteractionId','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment'];(function(_0x25837e,_0x44da6e){var _0x594854=function(_0x4f287d){while(--_0x4f287d){_0x25837e['push'](_0x25837e['shift']());}};_0x594854(++_0x44da6e);}(_0x69f1,0x135));var _0x169f=function(_0xd2e60e,_0x1465bc){_0xd2e60e=_0xd2e60e-0x0;var _0x1c767a=_0x69f1[_0xd2e60e];return _0x1c767a;};'use strict';var _=require(_0x169f('0x0'));var util=require(_0x169f('0x1'));var logger=require(_0x169f('0x2'))(_0x169f('0x3'));var moment=require(_0x169f('0x4'));var BPromise=require(_0x169f('0x5'));var rp=require(_0x169f('0x6'));var htmlToText=require(_0x169f('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0x169f('0x8'));var config=require(_0x169f('0x9'));var attributes=require(_0x169f('0xa'));module['exports']=function(_0x451916,_0x299b4f){return _0x451916['define'](_0x169f('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x169f('0xc'),'fields':[_0x169f('0xd'),_0x169f('0xe')],'type':_0x169f('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2cb237,_0x5a02ce,_0x5b16b5){if(_0x2cb237[_0x169f('0x10')]){_0x2cb237[_0x169f('0xd')]=htmlToText[_0x169f('0x11')](_0x2cb237[_0x169f('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5b16b5(null,_0x5a02ce);},'afterCreate':function(_0x13d985,_0x9d15b3,_0x593426){var _0x17b10e=_0x451916[_0x169f('0x12')];var _0x219075=_0x13d985[_0x169f('0x13')]({'plain':!![]});if(_0x219075['direction'][_0x169f('0x14')]()==='in'||_0x219075[_0x169f('0x15')]['toLowerCase']()===_0x169f('0x16')&&!_0x219075['secret']&&!_['isNil'](_0x219075['UserId'])){_0x17b10e['MailInteraction'][_0x169f('0x17')]({'where':{'id':_0x219075[_0x169f('0x18')]}})[_0x169f('0x19')](function(_0x17a890){if(_0x17a890){_0x17a890['update']({'lastMsgAt':_0x219075['createdAt'],'lastMsgDirection':_0x219075[_0x169f('0x15')][_0x169f('0x14')]()});}})[_0x169f('0x1a')](function(_0x17bcd0){console['error'](_0x17bcd0);});}_0x593426();}},'charset':_0x169f('0x1b'),'collate':_0x169f('0x1c')});}; \ No newline at end of file +var _0x4d2d=['./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf'];(function(_0x41b9a6,_0x1ff916){var _0xd145d9=function(_0x57b19f){while(--_0x57b19f){_0x41b9a6['push'](_0x41b9a6['shift']());}};_0xd145d9(++_0x1ff916);}(_0x4d2d,0xbd));var _0xd4d2=function(_0x23ac30,_0x2a1d00){_0x23ac30=_0x23ac30-0x0;var _0x208fec=_0x4d2d[_0x23ac30];return _0x208fec;};'use strict';var _=require(_0xd4d2('0x0'));var util=require('util');var logger=require(_0xd4d2('0x1'))(_0xd4d2('0x2'));var moment=require(_0xd4d2('0x3'));var BPromise=require(_0xd4d2('0x4'));var rp=require(_0xd4d2('0x5'));var htmlToText=require(_0xd4d2('0x6'));var fs=require('fs');var path=require(_0xd4d2('0x7'));var rimraf=require(_0xd4d2('0x8'));var config=require('../../config/environment');var attributes=require(_0xd4d2('0x9'));module[_0xd4d2('0xa')]=function(_0x41d703,_0x2f155a){return _0x41d703[_0xd4d2('0xb')](_0xd4d2('0xc'),attributes,{'tableName':_0xd4d2('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd4d2('0xe')]},{'name':'fti_mail_messages','fields':[_0xd4d2('0xf'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4129a6,_0x353b59,_0x18670b){if(_0x4129a6[_0xd4d2('0x10')]){_0x4129a6[_0xd4d2('0xf')]=htmlToText[_0xd4d2('0x11')](_0x4129a6[_0xd4d2('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x18670b(null,_0x353b59);},'afterCreate':function(_0xf93fce,_0xfb653a,_0x100b38){var _0xac723d=_0x41d703[_0xd4d2('0x12')];var _0x3dd2f1=_0xf93fce[_0xd4d2('0x13')]({'plain':!![]});if(_0x3dd2f1[_0xd4d2('0x14')][_0xd4d2('0x15')]()==='in'||_0x3dd2f1[_0xd4d2('0x14')]['toLowerCase']()===_0xd4d2('0x16')&&!_0x3dd2f1[_0xd4d2('0x17')]&&!_[_0xd4d2('0x18')](_0x3dd2f1[_0xd4d2('0x19')])){_0xac723d['MailInteraction'][_0xd4d2('0x1a')]({'where':{'id':_0x3dd2f1[_0xd4d2('0x1b')]}})[_0xd4d2('0x1c')](function(_0x15c68c){if(_0x15c68c){_0x15c68c['update']({'lastMsgAt':_0x3dd2f1[_0xd4d2('0x1d')],'lastMsgDirection':_0x3dd2f1['direction'][_0xd4d2('0x15')]()});}})['catch'](function(_0x286e96){console[_0xd4d2('0x1e')](_0x286e96);});}_0x100b38();}},'charset':_0xd4d2('0x1f'),'collate':_0xd4d2('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index dca6590..6018212 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 _0xcf66=['redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','MailMessage,\x20%s,\x20%s','info','catch','CreateMailMessage','MailMessage','body','options','raw','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','defaults'];(function(_0x3a40c7,_0x3b5303){var _0x527d6d=function(_0x3e08f5){while(--_0x3e08f5){_0x3a40c7['push'](_0x3a40c7['shift']());}};_0x527d6d(++_0x3b5303);}(_0xcf66,0x71));var _0x6cf6=function(_0x30bf36,_0x334413){_0x30bf36=_0x30bf36-0x0;var _0x5c1eba=_0xcf66[_0x30bf36];return _0x5c1eba;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cf6('0x3'));var fs=require('fs');var Redis=require(_0x6cf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6cf6('0x5'))(_0x6cf6('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cf6('0x7'));var client=jayson[_0x6cf6('0x8')][_0x6cf6('0x9')]({'port':0x232a});config['redis']=_[_0x6cf6('0xa')](config[_0x6cf6('0xb')],{'host':_0x6cf6('0xc'),'port':0x18eb});var socket=require(_0x6cf6('0xd'))(new Redis(config[_0x6cf6('0xb')]));require(_0x6cf6('0xe'))['register'](socket);function respondWithRpcPromise(_0x58378c,_0x5b7f4e,_0x8e90e){return new BPromise(function(_0x504c98,_0x1fdf80){return client[_0x6cf6('0xf')](_0x58378c,_0x8e90e)[_0x6cf6('0x10')](function(_0x3f7fc1){logger['info']('MailMessage,\x20%s,\x20%s',_0x5b7f4e,'request\x20sent');logger[_0x6cf6('0x11')](_0x6cf6('0x12'),_0x5b7f4e,_0x6cf6('0x13'),JSON[_0x6cf6('0x14')](_0x3f7fc1));if(_0x3f7fc1[_0x6cf6('0x15')]){if(_0x3f7fc1[_0x6cf6('0x15')]['code']===0x1f4){logger[_0x6cf6('0x15')]('MailMessage,\x20%s,\x20%s',_0x5b7f4e,_0x3f7fc1[_0x6cf6('0x15')][_0x6cf6('0x16')]);return _0x1fdf80(_0x3f7fc1['error'][_0x6cf6('0x16')]);}logger[_0x6cf6('0x15')](_0x6cf6('0x17'),_0x5b7f4e,_0x3f7fc1[_0x6cf6('0x15')][_0x6cf6('0x16')]);return _0x504c98(_0x3f7fc1[_0x6cf6('0x15')][_0x6cf6('0x16')]);}else{logger[_0x6cf6('0x18')](_0x6cf6('0x17'),_0x5b7f4e,_0x6cf6('0x13'));_0x504c98(_0x3f7fc1['result'][_0x6cf6('0x16')]);}})[_0x6cf6('0x19')](function(_0x22ab0){logger['error'](_0x6cf6('0x17'),_0x5b7f4e,_0x22ab0);_0x1fdf80(_0x22ab0);});});}exports[_0x6cf6('0x1a')]=function(_0x101e39){var _0x2995b3=this;return new Promise(function(_0x440634,_0x21e903){return db[_0x6cf6('0x1b')]['create'](_0x101e39[_0x6cf6('0x1c')],{'raw':_0x101e39[_0x6cf6('0x1d')]?_0x101e39[_0x6cf6('0x1d')][_0x6cf6('0x1e')]===undefined?!![]:![]:!![]})[_0x6cf6('0x10')](function(_0x470ea4){logger[_0x6cf6('0x18')](_0x6cf6('0x1a'),_0x101e39);logger['debug']('CreateMailMessage',_0x101e39,JSON[_0x6cf6('0x14')](_0x470ea4));_0x440634(_0x470ea4);})['catch'](function(_0x45ce6e){logger[_0x6cf6('0x15')](_0x6cf6('0x1a'),_0x45ce6e[_0x6cf6('0x16')],_0x101e39);_0x21e903(_0x2995b3[_0x6cf6('0x15')](0x1f4,_0x45ce6e[_0x6cf6('0x16')]));});});}; \ No newline at end of file +var _0x4024=['debug','stringify','error','code','message','info','catch','CreateMailMessage','MailMessage','create','body','options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','then','MailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x54c362,_0xa9322d){var _0x2c7fdd=function(_0x33e6b1){while(--_0x33e6b1){_0x54c362['push'](_0x54c362['shift']());}};_0x2c7fdd(++_0xa9322d);}(_0x4024,0x89));var _0x4402=function(_0x1fc318,_0x57f410){_0x1fc318=_0x1fc318-0x0;var _0x9fe831=_0x4024[_0x1fc318];return _0x9fe831;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});config[_0x4402('0x9')]=_['defaults'](config[_0x4402('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4402('0x9')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x30fd34,_0x4f56aa,_0x1a4a47){return new BPromise(function(_0x4e1a7e,_0x34b4a6){return client['request'](_0x30fd34,_0x1a4a47)[_0x4402('0xa')](function(_0x251286){logger['info'](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));logger[_0x4402('0xd')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x4f56aa,_0x4402('0xc'),JSON[_0x4402('0xe')](_0x251286));if(_0x251286[_0x4402('0xf')]){if(_0x251286[_0x4402('0xf')][_0x4402('0x10')]===0x1f4){logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x34b4a6(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x4e1a7e(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}else{logger[_0x4402('0x12')](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));_0x4e1a7e(_0x251286['result']['message']);}})[_0x4402('0x13')](function(_0x2a7afc){logger['error'](_0x4402('0xb'),_0x4f56aa,_0x2a7afc);_0x34b4a6(_0x2a7afc);});});}exports[_0x4402('0x14')]=function(_0x5cb0c5){var _0x38b459=this;return new Promise(function(_0x4e0340,_0x55cc8c){return db[_0x4402('0x15')][_0x4402('0x16')](_0x5cb0c5[_0x4402('0x17')],{'raw':_0x5cb0c5['options']?_0x5cb0c5[_0x4402('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x6f1f72){logger[_0x4402('0x12')](_0x4402('0x14'),_0x5cb0c5);logger[_0x4402('0xd')](_0x4402('0x14'),_0x5cb0c5,JSON[_0x4402('0xe')](_0x6f1f72));_0x4e0340(_0x6f1f72);})[_0x4402('0x13')](function(_0x6b1fc5){logger[_0x4402('0xf')]('CreateMailMessage',_0x6b1fc5[_0x4402('0x11')],_0x5cb0c5);_0x55cc8c(_0x38b459['error'](0x1f4,_0x6b1fc5[_0x4402('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7a2a71a..1c86685 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 _0xa8ff=['mailMessage:','./mailMessage.events','emit','removeListener','register','length'];(function(_0x12d82d,_0x40a7ab){var _0x5fde95=function(_0x432761){while(--_0x432761){_0x12d82d['push'](_0x12d82d['shift']());}};_0x5fde95(++_0x40a7ab);}(_0xa8ff,0x1ab));var _0xfa8f=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xa8ff[_0x2070da];return _0x4f9fe1;};'use strict';var MailMessageEvents=require(_0xfa8f('0x0'));var events=['save','remove','update'];function createListener(_0x4b88d8,_0x1370f2){return function(_0x528d40){_0x1370f2[_0xfa8f('0x1')](_0x4b88d8,_0x528d40);};}function removeListener(_0x4985f9,_0x4e0613){return function(){MailMessageEvents[_0xfa8f('0x2')](_0x4985f9,_0x4e0613);};}exports[_0xfa8f('0x3')]=function(_0x5cdf23){for(var _0x1dcc61=0x0,_0x42f1d7=events[_0xfa8f('0x4')];_0x1dcc61<_0x42f1d7;_0x1dcc61++){var _0xc6ec97=events[_0x1dcc61];var _0xb43311=createListener(_0xfa8f('0x5')+_0xc6ec97,_0x5cdf23);MailMessageEvents['on'](_0xc6ec97,_0xb43311);}}; \ No newline at end of file +var _0x025c=['emit','register','mailMessage:','save','remove','update'];(function(_0x1a50c2,_0x58c1bd){var _0x43b9e8=function(_0x4ba0f3){while(--_0x4ba0f3){_0x1a50c2['push'](_0x1a50c2['shift']());}};_0x43b9e8(++_0x58c1bd);}(_0x025c,0x1ad));var _0xc025=function(_0x18aa50,_0x245c62){_0x18aa50=_0x18aa50-0x0;var _0x146fd8=_0x025c[_0x18aa50];return _0x146fd8;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xc025('0x0'),_0xc025('0x1'),_0xc025('0x2')];function createListener(_0x8c9ed8,_0x245029){return function(_0x3821d1){_0x245029[_0xc025('0x3')](_0x8c9ed8,_0x3821d1);};}function removeListener(_0x2b7c26,_0x30e3a8){return function(){MailMessageEvents['removeListener'](_0x2b7c26,_0x30e3a8);};}exports[_0xc025('0x4')]=function(_0x48ca2f){for(var _0x5e373d=0x0,_0x50cee1=events['length'];_0x5e373d<_0x50cee1;_0x5e373d++){var _0x289f2f=events[_0x5e373d];var _0x4b368f=createListener(_0xc025('0x5')+_0x289f2f,_0x48ca2f);MailMessageEvents['on'](_0x289f2f,_0x4b368f);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 8626f2a..3aca194 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 _0x4a12=['addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x4a12,0x15d));var _0x24a1=function(_0x20e295,_0x308599){_0x20e295=_0x20e295-0x0;var _0x33ffbe=_0x4a12[_0x20e295];return _0x33ffbe;};'use strict';var multer=require(_0x24a1('0x0'));var util=require(_0x24a1('0x1'));var path=require(_0x24a1('0x2'));var timeout=require(_0x24a1('0x3'));var express=require(_0x24a1('0x4'));var router=express[_0x24a1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x24a1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24a1('0x7'));var controller=require(_0x24a1('0x8'));router['get']('/',auth[_0x24a1('0x9')](),controller[_0x24a1('0xa')]);router[_0x24a1('0xb')](_0x24a1('0xc'),auth[_0x24a1('0x9')](),controller[_0x24a1('0xd')]);router[_0x24a1('0xb')](_0x24a1('0xe'),auth[_0x24a1('0x9')](),controller[_0x24a1('0xf')]);router['get'](_0x24a1('0x10'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x24a1('0x11'),auth[_0x24a1('0x9')](),controller[_0x24a1('0x12')]);router[_0x24a1('0xb')](_0x24a1('0x13'),auth[_0x24a1('0x9')](),controller[_0x24a1('0x14')]);router[_0x24a1('0x15')]('/',auth[_0x24a1('0x9')](),controller[_0x24a1('0x16')]);router[_0x24a1('0x15')](_0x24a1('0x11'),auth['isAuthenticated'](),controller[_0x24a1('0x17')]);router['post'](_0x24a1('0x13'),auth['isAuthenticated'](),controller[_0x24a1('0x18')]);router['put']('/:id',auth[_0x24a1('0x9')](),controller[_0x24a1('0x19')]);router[_0x24a1('0x1a')](_0x24a1('0xe'),auth[_0x24a1('0x9')](),controller[_0x24a1('0x1b')]);router[_0x24a1('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0x24a1('0x1c')]);router['delete'](_0x24a1('0x13'),auth[_0x24a1('0x9')](),controller[_0x24a1('0x1d')]);module[_0x24a1('0x1e')]=router; \ No newline at end of file +var _0x28e8=['show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','destroy','delete','removeAgents','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x22d7d0,_0x10c1ba){var _0x5b2d51=function(_0x255ee0){while(--_0x255ee0){_0x22d7d0['push'](_0x22d7d0['shift']());}};_0x5b2d51(++_0x10c1ba);}(_0x28e8,0x1c3));var _0x828e=function(_0x372d05,_0x497ac2){_0x372d05=_0x372d05-0x0;var _0x151927=_0x28e8[_0x372d05];return _0x151927;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x828e('0x0'));var express=require('express');var router=express[_0x828e('0x1')]();var fs_extra=require(_0x828e('0x2'));var auth=require(_0x828e('0x3'));var interaction=require(_0x828e('0x4'));var config=require(_0x828e('0x5'));var controller=require(_0x828e('0x6'));router[_0x828e('0x7')]('/',auth[_0x828e('0x8')](),controller[_0x828e('0x9')]);router['get'](_0x828e('0xa'),auth[_0x828e('0x8')](),controller[_0x828e('0xb')]);router['get'](_0x828e('0xc'),auth['isAuthenticated'](),controller[_0x828e('0xd')]);router[_0x828e('0x7')](_0x828e('0xe'),auth[_0x828e('0x8')](),controller[_0x828e('0xf')]);router['get']('/:id/teams',auth[_0x828e('0x8')](),controller[_0x828e('0x10')]);router[_0x828e('0x7')](_0x828e('0x11'),auth[_0x828e('0x8')](),controller[_0x828e('0x12')]);router[_0x828e('0x13')]('/',auth[_0x828e('0x8')](),controller[_0x828e('0x14')]);router[_0x828e('0x13')](_0x828e('0x15'),auth[_0x828e('0x8')](),controller[_0x828e('0x16')]);router[_0x828e('0x13')](_0x828e('0x11'),auth[_0x828e('0x8')](),controller['addAgents']);router[_0x828e('0x17')](_0x828e('0xc'),auth[_0x828e('0x8')](),controller[_0x828e('0x18')]);router['delete'](_0x828e('0xc'),auth['isAuthenticated'](),controller[_0x828e('0x19')]);router[_0x828e('0x1a')](_0x828e('0x15'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x828e('0x1a')](_0x828e('0x11'),auth[_0x828e('0x8')](),controller[_0x828e('0x1b')]);module[_0x828e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 8566278..000e382 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 _0x9151=['ENUM','rrmemory','exports','STRING','name'];(function(_0x472eb8,_0x118204){var _0x13788e=function(_0x253601){while(--_0x253601){_0x472eb8['push'](_0x472eb8['shift']());}};_0x13788e(++_0x118204);}(_0x9151,0x124));var _0x1915=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0x9151[_0x1c3370];return _0xa9b358;};'use strict';var Sequelize=require('sequelize');module[_0x1915('0x0')]={'name':{'type':Sequelize[_0x1915('0x1')],'unique':_0x1915('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1915('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1915('0x3')](_0x1915('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x711a=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x110ec3,_0x54df75){var _0x2d46bc=function(_0x31586b){while(--_0x31586b){_0x110ec3['push'](_0x110ec3['shift']());}};_0x2d46bc(++_0x54df75);}(_0x711a,0xd3));var _0xa711=function(_0x5c2a1a,_0x14ffc2){_0x5c2a1a=_0x5c2a1a-0x0;var _0x5c2e8d=_0x711a[_0x5c2a1a];return _0x5c2e8d;};'use strict';var Sequelize=require(_0xa711('0x0'));module[_0xa711('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa711('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa711('0x3')]},'timeout':{'type':Sequelize[_0xa711('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa711('0x5')](_0xa711('0x6'),_0xa711('0x7'),_0xa711('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 69f911b..56781da 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 _0x1261=['fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','end','json','offset','limit','undefined','count','status','apply','reject','save','update','destroy','then','get','MailQueues','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','MailQueue','includeAll','findAll','rows','show','params','include','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','describe','getMembers','findOne','UserMailQueue','pick','MailQueueId','filter','User','agent','updatedAt','%s/%s','SIP','mailPause','createdAt','Team','getTeams','addTeams','ids','online','voicePause','interface','sequelize','transaction','each','forEach','userMailQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','emit','getAgents','eml-format','rimraf'];(function(_0x4caccf,_0x1255d8){var _0x4596ab=function(_0x898a4c){while(--_0x898a4c){_0x4caccf['push'](_0x4caccf['shift']());}};_0x4596ab(++_0x1255d8);}(_0x1261,0x1a8));var _0x1126=function(_0x67e9ca,_0x419250){_0x67e9ca=_0x67e9ca-0x0;var _0x1b81d6=_0x1261[_0x67e9ca];return _0x1b81d6;};'use strict';var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1126('0x2'));var rp=require('request-promise');var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var Mustache=require(_0x1126('0x5'));var util=require('util');var path=require(_0x1126('0x6'));var sox=require(_0x1126('0x7'));var csv=require(_0x1126('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1126('0x9'));var squel=require('squel');var crypto=require(_0x1126('0xa'));var jsforce=require(_0x1126('0xb'));var deskjs=require(_0x1126('0xc'));var toCsv=require(_0x1126('0x8'));var querystring=require(_0x1126('0xd'));var Papa=require(_0x1126('0xe'));var Redis=require('ioredis');var authService=require(_0x1126('0xf'));var qs=require(_0x1126('0x10'));var as=require(_0x1126('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1126('0x12'))(_0x1126('0x13'));var utils=require(_0x1126('0x14'));var config=require(_0x1126('0x15'));var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];config[_0x1126('0x18')]=_[_0x1126('0x19')](config[_0x1126('0x18')],{'host':_0x1126('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1126('0x18')]));require(_0x1126('0x1b'))[_0x1126('0x1c')](socket);function respondWithStatusCode(_0x2d39ca,_0x39ce31){_0x39ce31=_0x39ce31||0xcc;return function(_0x15b3c7){if(_0x15b3c7){return _0x2d39ca['sendStatus'](_0x39ce31);}return _0x2d39ca['status'](_0x39ce31)[_0x1126('0x1d')]();};}function respondWithResult(_0x1a84f6,_0x16b463){_0x16b463=_0x16b463||0xc8;return function(_0x5dbe86){if(_0x5dbe86){return _0x1a84f6['status'](_0x16b463)[_0x1126('0x1e')](_0x5dbe86);}};}function respondWithFilteredResult(_0x1cab76,_0x5f3eec){return function(_0x178bd1){if(_0x178bd1){var _0x52640b=typeof _0x5f3eec[_0x1126('0x1f')]==='undefined'&&typeof _0x5f3eec[_0x1126('0x20')]===_0x1126('0x21');var _0x37c994=_0x178bd1[_0x1126('0x22')];var _0x236b56=_0x52640b?0x0:_0x5f3eec[_0x1126('0x1f')];var _0x30f5ba=_0x52640b?_0x178bd1[_0x1126('0x22')]:_0x5f3eec[_0x1126('0x1f')]+_0x5f3eec[_0x1126('0x20')];var _0x6e2bbd;if(_0x30f5ba>=_0x37c994){_0x30f5ba=_0x37c994;_0x6e2bbd=0xc8;}else{_0x6e2bbd=0xce;}_0x1cab76[_0x1126('0x23')](_0x6e2bbd);return _0x1cab76['set']('Content-Range',_0x236b56+'-'+_0x30f5ba+'/'+_0x37c994)[_0x1126('0x1e')](_0x178bd1);}return null;};}function patchUpdates(_0x2acd14){return function(_0x426d97){try{jsonpatch[_0x1126('0x24')](_0x426d97,_0x2acd14,!![]);}catch(_0x1bf9e0){return BPromise[_0x1126('0x25')](_0x1bf9e0);}return _0x426d97[_0x1126('0x26')]();};}function saveUpdates(_0x3e13a1,_0x5e25d3){return function(_0x2d03b3){if(_0x2d03b3){return _0x2d03b3[_0x1126('0x27')](_0x3e13a1)['then'](function(_0x4c00d){return _0x4c00d;});}return null;};}function removeEntity(_0x2ff0d0,_0x32602f){return function(_0x5ea27e){if(_0x5ea27e){return _0x5ea27e[_0x1126('0x28')]()[_0x1126('0x29')](function(){var _0x20a39d=_0x5ea27e[_0x1126('0x2a')]({'plain':!![]});var _0x51f821=_0x1126('0x2b');return db['UserProfileResource'][_0x1126('0x28')]({'where':{'type':_0x51f821,'resourceId':_0x20a39d['id']}})['then'](function(){return _0x5ea27e;});})['then'](function(){_0x2ff0d0[_0x1126('0x23')](0xcc)[_0x1126('0x1d')]();});}};}function handleEntityNotFound(_0x4f18a0,_0xad0f84){return function(_0x39d615){if(!_0x39d615){_0x4f18a0[_0x1126('0x2c')](0x194);}return _0x39d615;};}function handleError(_0x327519,_0x99912d){_0x99912d=_0x99912d||0x1f4;return function(_0x73dc08){logger[_0x1126('0x2d')](_0x73dc08[_0x1126('0x2e')]);if(_0x73dc08['name']){delete _0x73dc08[_0x1126('0x2f')];}_0x327519[_0x1126('0x23')](_0x99912d)[_0x1126('0x30')](_0x73dc08);};}exports[_0x1126('0x31')]=function(_0x7769ce,_0x300d79){var _0x47ebe1={},_0x50a009={},_0x56c6a1={'count':0x0,'rows':[]};var _0x1b0294=_[_0x1126('0x32')](db['MailQueue'][_0x1126('0x33')],function(_0x3fcd44){return{'name':_0x3fcd44['fieldName'],'type':_0x3fcd44[_0x1126('0x34')][_0x1126('0x35')]};});_0x50a009[_0x1126('0x36')]=_[_0x1126('0x32')](_0x1b0294,_0x1126('0x2f'));_0x50a009[_0x1126('0x37')]=_[_0x1126('0x38')](_0x7769ce['query']);_0x50a009[_0x1126('0x39')]=_[_0x1126('0x3a')](_0x50a009[_0x1126('0x36')],_0x50a009['query']);_0x47ebe1[_0x1126('0x3b')]=_[_0x1126('0x3a')](_0x50a009[_0x1126('0x36')],qs[_0x1126('0x3c')](_0x7769ce['query'][_0x1126('0x3c')]));_0x47ebe1['attributes']=_0x47ebe1[_0x1126('0x3b')][_0x1126('0x3d')]?_0x47ebe1[_0x1126('0x3b')]:_0x50a009['model'];if(!_0x7769ce[_0x1126('0x37')][_0x1126('0x3e')](_0x1126('0x3f'))){_0x47ebe1[_0x1126('0x20')]=qs['limit'](_0x7769ce['query'][_0x1126('0x20')]);_0x47ebe1['offset']=qs[_0x1126('0x1f')](_0x7769ce['query'][_0x1126('0x1f')]);}_0x47ebe1[_0x1126('0x40')]=qs[_0x1126('0x41')](_0x7769ce[_0x1126('0x37')][_0x1126('0x41')]);_0x47ebe1[_0x1126('0x42')]=qs[_0x1126('0x39')](_['pick'](_0x7769ce['query'],_0x50a009[_0x1126('0x39')]),_0x1b0294);if(_0x7769ce[_0x1126('0x37')]['filter']){_0x47ebe1[_0x1126('0x42')]=_['merge'](_0x47ebe1[_0x1126('0x42')],{'$or':_[_0x1126('0x32')](_0x1b0294,function(_0x131655){if(_0x131655['type']!==_0x1126('0x43')){var _0x224f1d={};_0x224f1d[_0x131655['name']]={'$like':'%'+_0x7769ce[_0x1126('0x37')]['filter']+'%'};return _0x224f1d;}})});}_0x47ebe1=_[_0x1126('0x44')]({},_0x47ebe1,_0x7769ce['options']);var _0x49b6d3={'where':_0x47ebe1[_0x1126('0x42')]};return db[_0x1126('0x45')][_0x1126('0x22')](_0x49b6d3)['then'](function(_0x55fcea){_0x56c6a1['count']=_0x55fcea;if(_0x7769ce['query'][_0x1126('0x46')]){_0x47ebe1['include']=[{'all':!![]}];}return db[_0x1126('0x45')][_0x1126('0x47')](_0x47ebe1);})[_0x1126('0x29')](function(_0x3d9354){_0x56c6a1[_0x1126('0x48')]=_0x3d9354;return _0x56c6a1;})[_0x1126('0x29')](respondWithFilteredResult(_0x300d79,_0x47ebe1))['catch'](handleError(_0x300d79,null));};exports[_0x1126('0x49')]=function(_0x40385e,_0x2f5085){var _0x6f1524={'raw':!![],'where':{'id':_0x40385e[_0x1126('0x4a')]['id']}},_0x476815={};_0x476815[_0x1126('0x36')]=_[_0x1126('0x38')](db[_0x1126('0x45')][_0x1126('0x33')]);_0x476815[_0x1126('0x37')]=_['keys'](_0x40385e[_0x1126('0x37')]);_0x476815[_0x1126('0x39')]=_[_0x1126('0x3a')](_0x476815[_0x1126('0x36')],_0x476815[_0x1126('0x37')]);_0x6f1524['attributes']=_[_0x1126('0x3a')](_0x476815[_0x1126('0x36')],qs[_0x1126('0x3c')](_0x40385e[_0x1126('0x37')][_0x1126('0x3c')]));_0x6f1524[_0x1126('0x3b')]=_0x6f1524['attributes']['length']?_0x6f1524[_0x1126('0x3b')]:_0x476815[_0x1126('0x36')];if(_0x40385e[_0x1126('0x37')]['includeAll']){_0x6f1524[_0x1126('0x4b')]=[{'all':!![]}];}_0x6f1524=_[_0x1126('0x44')]({},_0x6f1524,_0x40385e[_0x1126('0x4c')]);return db['MailQueue']['find'](_0x6f1524)[_0x1126('0x29')](handleEntityNotFound(_0x2f5085,null))['then'](respondWithResult(_0x2f5085,null))[_0x1126('0x4d')](handleError(_0x2f5085,null));};exports['create']=function(_0x113e6f,_0x402d1c){return db[_0x1126('0x45')][_0x1126('0x4e')](_0x113e6f[_0x1126('0x4f')],{})[_0x1126('0x29')](function(_0x42cd6e){var _0x5ef272=_0x113e6f[_0x1126('0x50')]['get']({'plain':!![]});if(!_0x5ef272)throw new Error(_0x1126('0x51'));if(_0x5ef272[_0x1126('0x52')]===_0x1126('0x50')){var _0x950b39=_0x42cd6e[_0x1126('0x2a')]({'plain':!![]});var _0x55044b=_0x1126('0x2b');return db[_0x1126('0x53')][_0x1126('0x54')]({'where':{'name':_0x55044b,'userProfileId':_0x5ef272[_0x1126('0x55')]},'raw':!![]})[_0x1126('0x29')](function(_0x51be8b){if(_0x51be8b&&_0x51be8b[_0x1126('0x56')]===0x0){return db['UserProfileResource'][_0x1126('0x4e')]({'name':_0x950b39[_0x1126('0x2f')],'resourceId':_0x950b39['id'],'type':_0x51be8b[_0x1126('0x2f')],'sectionId':_0x51be8b['id']},{})[_0x1126('0x29')](function(){return _0x42cd6e;});}else{return _0x42cd6e;}})['catch'](function(_0x19ab52){logger[_0x1126('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19ab52);throw _0x19ab52;});}return _0x42cd6e;})[_0x1126('0x29')](respondWithResult(_0x402d1c,0xc9))[_0x1126('0x4d')](handleError(_0x402d1c,null));};exports[_0x1126('0x27')]=function(_0x2757f6,_0x3f1330){if(_0x2757f6[_0x1126('0x4f')]['id']){delete _0x2757f6[_0x1126('0x4f')]['id'];}return db['MailQueue'][_0x1126('0x54')]({'where':{'id':_0x2757f6['params']['id']}})['then'](handleEntityNotFound(_0x3f1330,null))['then'](saveUpdates(_0x2757f6[_0x1126('0x4f')],null))[_0x1126('0x29')](respondWithResult(_0x3f1330,null))['catch'](handleError(_0x3f1330,null));};exports[_0x1126('0x28')]=function(_0x50e46c,_0xcc22b0){return db['MailQueue'][_0x1126('0x54')]({'where':{'id':_0x50e46c[_0x1126('0x4a')]['id']}})['then'](handleEntityNotFound(_0xcc22b0,null))[_0x1126('0x29')](removeEntity(_0xcc22b0,null))[_0x1126('0x4d')](handleError(_0xcc22b0,null));};exports[_0x1126('0x57')]=function(_0x57f5b2,_0x3a53da){return db[_0x1126('0x45')][_0x1126('0x57')]()['then'](respondWithResult(_0x3a53da,null))[_0x1126('0x4d')](handleError(_0x3a53da,null));};exports[_0x1126('0x58')]=function(_0x3dc469,_0x236129,_0x459ba2){var _0x4b23f9={'raw':!![],'where':{}},_0x429667={},_0x38e152;return db[_0x1126('0x45')][_0x1126('0x59')]({'where':{'id':_0x3dc469[_0x1126('0x4a')]['id']}})[_0x1126('0x29')](handleEntityNotFound(_0x236129,null))[_0x1126('0x29')](function(_0x23bcca){if(_0x23bcca){_0x38e152=_0x23bcca[_0x1126('0x2a')]({'plain':!![]});_0x429667[_0x1126('0x36')]=_[_0x1126('0x38')](db[_0x1126('0x5a')]['rawAttributes']);_0x429667[_0x1126('0x37')]=_['keys'](_0x3dc469['query']);_0x429667[_0x1126('0x39')]=_[_0x1126('0x3a')](_0x429667[_0x1126('0x36')],_0x429667[_0x1126('0x37')]);_0x4b23f9[_0x1126('0x3b')]=_[_0x1126('0x3a')](_0x429667[_0x1126('0x36')],qs['fields'](_0x3dc469[_0x1126('0x37')]['fields']));_0x4b23f9[_0x1126('0x3b')]=_0x4b23f9[_0x1126('0x3b')][_0x1126('0x3d')]?_0x4b23f9['attributes']:_0x429667[_0x1126('0x36')];if(!_0x3dc469[_0x1126('0x37')]['hasOwnProperty'](_0x1126('0x3f'))){_0x4b23f9['limit']=qs[_0x1126('0x20')](_0x3dc469[_0x1126('0x37')][_0x1126('0x20')]);_0x4b23f9['offset']=qs[_0x1126('0x1f')](_0x3dc469[_0x1126('0x37')]['offset']);}_0x4b23f9['order']=qs[_0x1126('0x41')](_0x3dc469[_0x1126('0x37')][_0x1126('0x41')]);_0x4b23f9['where']=qs[_0x1126('0x39')](_[_0x1126('0x5b')](_0x3dc469[_0x1126('0x37')],_0x429667[_0x1126('0x39')]));_0x4b23f9[_0x1126('0x42')][_0x1126('0x5c')]=_0x23bcca['id'];if(_0x3dc469[_0x1126('0x37')]['filter']){_0x4b23f9[_0x1126('0x42')]=_['merge'](_0x4b23f9[_0x1126('0x42')],{'$or':_[_0x1126('0x32')](_0x4b23f9[_0x1126('0x3b')],function(_0x100c02){var _0x5cc79c={};_0x5cc79c[_0x100c02]={'$like':'%'+_0x3dc469['query'][_0x1126('0x5d')]+'%'};return _0x5cc79c;})});}_0x4b23f9=_['merge']({},_0x4b23f9,_0x3dc469[_0x1126('0x4c')]);return db[_0x1126('0x5a')][_0x1126('0x47')](_0x4b23f9);}})[_0x1126('0x29')](function(_0x369899){if(_0x369899){return db[_0x1126('0x5e')]['findAndCountAll']({'where':{'id':_[_0x1126('0x32')](_0x369899,'UserId'),'role':_0x1126('0x5f')},'attributes':['id',_0x1126('0x2f'),'mailPause',_0x1126('0x60'),'createdAt']});}})[_0x1126('0x29')](function(_0x314467){if(_0x314467){return{'count':_0x314467['count'],'rows':_[_0x1126('0x32')](_0x314467[_0x1126('0x48')],function(_0x579482){return{'membername':_0x579482[_0x1126('0x2f')],'UserId':_0x579482['id'],'queue_name':_0x38e152[_0x1126('0x2f')],'MailQueueId':_0x38e152['id'],'interface':util['format'](_0x1126('0x61'),_0x1126('0x62'),_0x579482[_0x1126('0x2f')]),'penalty':0x0,'paused':_0x579482[_0x1126('0x63')],'createdAt':_0x579482[_0x1126('0x64')],'updatedAt':_0x579482[_0x1126('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1126('0x29')](respondWithFilteredResult(_0x236129,_0x4b23f9))[_0x1126('0x4d')](handleError(_0x236129,null));};exports['getTeams']=function(_0x1df4e4,_0x532a37,_0x2de3b7){var _0x11109f={};var _0x4dcb26={};var _0x3975a4;var _0x454abd;return db[_0x1126('0x45')]['findOne']({'where':{'id':_0x1df4e4[_0x1126('0x4a')]['id']}})[_0x1126('0x29')](handleEntityNotFound(_0x532a37,null))[_0x1126('0x29')](function(_0x11e9cb){if(_0x11e9cb){_0x3975a4=_0x11e9cb;_0x4dcb26[_0x1126('0x36')]=_[_0x1126('0x38')](db[_0x1126('0x65')][_0x1126('0x33')]);_0x4dcb26[_0x1126('0x37')]=_[_0x1126('0x38')](_0x1df4e4[_0x1126('0x37')]);_0x4dcb26[_0x1126('0x39')]=_['intersection'](_0x4dcb26[_0x1126('0x36')],_0x4dcb26[_0x1126('0x37')]);_0x11109f[_0x1126('0x3b')]=_[_0x1126('0x3a')](_0x4dcb26[_0x1126('0x36')],qs['fields'](_0x1df4e4[_0x1126('0x37')]['fields']));_0x11109f[_0x1126('0x3b')]=_0x11109f[_0x1126('0x3b')][_0x1126('0x3d')]?_0x11109f[_0x1126('0x3b')]:_0x4dcb26[_0x1126('0x36')];_0x11109f[_0x1126('0x40')]=qs[_0x1126('0x41')](_0x1df4e4[_0x1126('0x37')]['sort']);_0x11109f['where']=qs[_0x1126('0x39')](_[_0x1126('0x5b')](_0x1df4e4[_0x1126('0x37')],_0x4dcb26[_0x1126('0x39')]));if(_0x1df4e4['query'][_0x1126('0x5d')]){_0x11109f[_0x1126('0x42')]=_[_0x1126('0x44')](_0x11109f['where'],{'$or':_['map'](_0x11109f[_0x1126('0x3b')],function(_0x579acd){var _0x138b62={};_0x138b62[_0x579acd]={'$like':'%'+_0x1df4e4['query']['filter']+'%'};return _0x138b62;})});}_0x11109f=_['merge']({},_0x11109f,_0x1df4e4[_0x1126('0x4c')]);return _0x3975a4[_0x1126('0x66')](_0x11109f);}})['then'](function(_0xd0fd63){if(_0xd0fd63){_0x454abd=_0xd0fd63[_0x1126('0x3d')];if(!_0x1df4e4[_0x1126('0x37')][_0x1126('0x3e')](_0x1126('0x3f'))){_0x11109f['limit']=qs['limit'](_0x1df4e4['query'][_0x1126('0x20')]);_0x11109f[_0x1126('0x1f')]=qs[_0x1126('0x1f')](_0x1df4e4[_0x1126('0x37')][_0x1126('0x1f')]);}return _0x3975a4[_0x1126('0x66')](_0x11109f);}})[_0x1126('0x29')](function(_0x195520){if(_0x195520){return _0x195520?{'count':_0x454abd,'rows':_0x195520}:null;}})[_0x1126('0x29')](respondWithResult(_0x532a37,null))[_0x1126('0x4d')](handleError(_0x532a37,null));};exports[_0x1126('0x67')]=function(_0x3a7cad,_0x5b7b59,_0x5c882e){var _0x38b4a3=_0x3a7cad['body'][_0x1126('0x68')];return db['Team']['findAll']({'where':{'id':_0x38b4a3},'attributes':['id'],'include':[{'model':db[_0x1126('0x5e')],'as':'Agents','attributes':['id','name',_0x1126('0x69'),_0x1126('0x6a'),_0x1126('0x6b')],'raw':!![]}]})['then'](function(_0x48118b){if(_0x48118b){var _0x12ffdb=_['flatMap'](_0x48118b,function(_0x323f19){var _0x5aaf77=_0x323f19['get']({'plain':!![]});return _0x5aaf77['Agents'];});return db['MailQueue'][_0x1126('0x54')]({'where':{'id':_0x3a7cad['params']['id']}})[_0x1126('0x29')](function(_0x197760){return db[_0x1126('0x6c')][_0x1126('0x6d')](function(_0x50a4ba){return _0x197760[_0x1126('0x67')](_0x38b4a3,{'transaction':_0x50a4ba})['then'](function(){return BPromise[_0x1126('0x6e')](_0x12ffdb,function(_0x160c9c){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x160c9c['id'],'MailQueueId':_0x3a7cad[_0x1126('0x4a')]['id']},'transaction':_0x50a4ba});});})[_0x1126('0x29')](function(){_0x12ffdb[_0x1126('0x6f')](function(_0x2fa607){socket['emit'](_0x1126('0x70'),{'UserId':_0x2fa607['id'],'MailQueueId':_0x197760['id']});});});});});}})[_0x1126('0x29')](respondWithStatusCode(_0x5b7b59,null))['catch'](handleError(_0x5b7b59,null));};exports[_0x1126('0x71')]=function(_0x4336a5,_0x3af11c,_0x350557){return db[_0x1126('0x65')][_0x1126('0x47')]({'where':{'id':_0x4336a5['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1126('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3af11c,null))['then'](function(_0x23ec6d){var _0x5e5a34=_[_0x1126('0x32')](_0x23ec6d,'id');var _0xe25bcf=[];var _0xa8e05b=[];var _0xdab4d=squel[_0x1126('0x73')]();_0xdab4d[_0x1126('0x74')](_0x1126('0x75'))[_0x1126('0x76')](_0x1126('0x77'),'tq')[_0x1126('0x78')](_0x1126('0x79'),'ut',_0x1126('0x7a'))[_0x1126('0x42')](_0x1126('0x7b'),_0x4336a5[_0x1126('0x4a')]['id']);for(var _0x547b91=0x0;_0x547b91<_0x23ec6d[_0x1126('0x3d')];_0x547b91+=0x1){let _0x47b5d8=_0x23ec6d[_0x547b91];for(var _0x5a9abe=0x0;_0x5a9abe<_0x47b5d8[_0x1126('0x72')]['length'];_0x5a9abe+=0x1){let _0x3411ab=_0x47b5d8[_0x1126('0x72')][_0x5a9abe];var _0x3072c4=_0xdab4d[_0x1126('0x7c')]();_0x3072c4[_0x1126('0x42')]('ut.UserId\x20=\x20?',_0x3411ab['id']);_0xa8e05b['push'](db[_0x1126('0x6c')][_0x1126('0x37')](_0x3072c4[_0x1126('0x7d')](),{'type':db[_0x1126('0x6c')]['QueryTypes'][_0x1126('0x7e')]})['then'](function(_0x33ac16){if(_0x33ac16[_0x1126('0x3d')]===0x1){return _0x3411ab['id'];}else{var _0x3a3989=_[_0x1126('0x7f')](_[_0x1126('0x32')](_0x33ac16,_0x1126('0x80')),function(_0x2522b0){return _['includes'](_0x5e5a34,_0x2522b0);});if(_0x3a3989){return _0x3411ab['id'];}}}));}}return BPromise[_0x1126('0x81')](_0xa8e05b)[_0x1126('0x29')](function(_0x1578b6){_0xe25bcf=_(_0xe25bcf)[_0x1126('0x82')](_0x1578b6)[_0x1126('0x83')]()[_0x1126('0x84')]();return db[_0x1126('0x45')][_0x1126('0x54')]({'where':{'id':_0x4336a5['params']['id']}})[_0x1126('0x29')](function(_0xd3f7ac){return db[_0x1126('0x6c')][_0x1126('0x6d')](function(_0x2e4693){return _0xd3f7ac[_0x1126('0x71')](_0x4336a5[_0x1126('0x37')][_0x1126('0x68')],{'transaction':_0x2e4693})[_0x1126('0x29')](function(){if(!_[_0x1126('0x85')](_0xe25bcf)){return _0xd3f7ac[_0x1126('0x86')](_0xe25bcf,{'transaction':_0x2e4693});}})[_0x1126('0x29')](function(){_0xe25bcf['forEach'](function(_0x2648a6){socket['emit'](_0x1126('0x87'),{'UserId':_0x2648a6,'MailQueueId':_0xd3f7ac['id']});});});});});});})['then'](respondWithStatusCode(_0x3af11c,null))['catch'](handleError(_0x3af11c,null));};exports[_0x1126('0x88')]=function(_0x3c7b90,_0x353f86,_0xb4e7ad){return db[_0x1126('0x45')]['find']({'where':{'id':_0x3c7b90['params']['id']}})[_0x1126('0x29')](handleEntityNotFound(_0x353f86,null))['then'](function(_0x1dd343){if(_0x1dd343){return _0x1dd343[_0x1126('0x88')](_0x3c7b90[_0x1126('0x4f')][_0x1126('0x68')],_[_0x1126('0x89')](_0x3c7b90[_0x1126('0x4f')],[_0x1126('0x68'),'id'])||{})[_0x1126('0x8a')](function(_0x166ebd){for(var _0x3d7a4=0x0;_0x3d7a4<_0x3c7b90[_0x1126('0x4f')][_0x1126('0x68')]['length'];_0x3d7a4+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x3c7b90['body']['ids'][_0x3d7a4]),'MailQueueId':Number(_0x3c7b90['params']['id'])});}return _0x166ebd;});}})['then'](respondWithResult(_0x353f86,null))[_0x1126('0x4d')](handleError(_0x353f86,null));};exports['removeAgents']=function(_0x3e30c0,_0x510e85,_0x582652){return db['MailQueue']['find']({'where':{'id':_0x3e30c0[_0x1126('0x4a')]['id']}})[_0x1126('0x29')](handleEntityNotFound(_0x510e85,null))[_0x1126('0x29')](function(_0xf2342d){if(_0xf2342d){return _0xf2342d[_0x1126('0x86')](_0x3e30c0[_0x1126('0x37')][_0x1126('0x68')])[_0x1126('0x29')](function(){if(_[_0x1126('0x8b')](_0x3e30c0['query'][_0x1126('0x68')])){for(var _0x49750a=0x0;_0x49750a<_0x3e30c0[_0x1126('0x37')][_0x1126('0x68')][_0x1126('0x3d')];_0x49750a+=0x1){socket['emit'](_0x1126('0x87'),{'UserId':Number(_0x3e30c0[_0x1126('0x37')][_0x1126('0x68')][_0x49750a]),'MailQueueId':Number(_0x3e30c0[_0x1126('0x4a')]['id'])});}}else{socket[_0x1126('0x8c')](_0x1126('0x87'),{'UserId':Number(_0x3e30c0[_0x1126('0x37')][_0x1126('0x68')]),'MailQueueId':Number(_0x3e30c0[_0x1126('0x4a')]['id'])});}});}})[_0x1126('0x29')](respondWithStatusCode(_0x510e85,null))[_0x1126('0x4d')](handleError(_0x510e85,null));};exports[_0x1126('0x8d')]=function(_0x14eae4,_0x3b6e2a,_0x1598d5){var _0x3bbbc4={};var _0x29e56a={};var _0x3aa4b1;var _0x2c2871;return db[_0x1126('0x45')]['findOne']({'where':{'id':_0x14eae4[_0x1126('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b6e2a,null))['then'](function(_0xafaba8){if(_0xafaba8){_0x3aa4b1=_0xafaba8;_0x29e56a[_0x1126('0x36')]=_['keys'](db['User'][_0x1126('0x33')]);_0x29e56a['query']=_[_0x1126('0x38')](_0x14eae4['query']);_0x29e56a[_0x1126('0x39')]=_[_0x1126('0x3a')](_0x29e56a[_0x1126('0x36')],_0x29e56a[_0x1126('0x37')]);_0x3bbbc4[_0x1126('0x3b')]=_[_0x1126('0x3a')](_0x29e56a[_0x1126('0x36')],qs[_0x1126('0x3c')](_0x14eae4['query'][_0x1126('0x3c')]));_0x3bbbc4[_0x1126('0x3b')]=_0x3bbbc4[_0x1126('0x3b')][_0x1126('0x3d')]?_0x3bbbc4[_0x1126('0x3b')]:_0x29e56a['model'];_0x3bbbc4['order']=qs[_0x1126('0x41')](_0x14eae4['query']['sort']);_0x3bbbc4[_0x1126('0x42')]=qs[_0x1126('0x39')](_[_0x1126('0x5b')](_0x14eae4['query'],_0x29e56a[_0x1126('0x39')]));if(_0x14eae4[_0x1126('0x37')]['filter']){_0x3bbbc4[_0x1126('0x42')]=_[_0x1126('0x44')](_0x3bbbc4[_0x1126('0x42')],{'$or':_[_0x1126('0x32')](_0x3bbbc4[_0x1126('0x3b')],function(_0x24bc73){var _0x2bd7c7={};_0x2bd7c7[_0x24bc73]={'$like':'%'+_0x14eae4[_0x1126('0x37')][_0x1126('0x5d')]+'%'};return _0x2bd7c7;})});}_0x3bbbc4=_[_0x1126('0x44')]({},_0x3bbbc4,_0x14eae4[_0x1126('0x4c')]);return _0x3aa4b1[_0x1126('0x8d')](_0x3bbbc4);}})[_0x1126('0x29')](function(_0x1965d7){if(_0x1965d7){_0x2c2871=_0x1965d7[_0x1126('0x3d')];if(!_0x14eae4[_0x1126('0x37')][_0x1126('0x3e')](_0x1126('0x3f'))){_0x3bbbc4[_0x1126('0x20')]=qs['limit'](_0x14eae4[_0x1126('0x37')][_0x1126('0x20')]);_0x3bbbc4[_0x1126('0x1f')]=qs[_0x1126('0x1f')](_0x14eae4[_0x1126('0x37')][_0x1126('0x1f')]);}return _0x3aa4b1[_0x1126('0x8d')](_0x3bbbc4);}})['then'](function(_0x3b02e5){if(_0x3b02e5){return _0x3b02e5?{'count':_0x2c2871,'rows':_0x3b02e5}:null;}})[_0x1126('0x29')](respondWithResult(_0x3b6e2a,null))[_0x1126('0x4d')](handleError(_0x3b6e2a,null));}; \ No newline at end of file +var _0x79f7=['UserMailQueue','order','pick','MailQueueId','User','findAndCountAll','UserId','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','nolimit','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','field','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','userMailQueue:save','removeAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','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/environment','../../config/license/util','socket.io-emitter','redis','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','options','MailQueue','include','findAll','rows','catch','show','params','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','update','describe','getMembers','findOne'];(function(_0x392904,_0x4d9c19){var _0x33d9d2=function(_0x5533c2){while(--_0x5533c2){_0x392904['push'](_0x392904['shift']());}};_0x33d9d2(++_0x4d9c19);}(_0x79f7,0xbb));var _0x779f=function(_0x12dd14,_0x2268ff){_0x12dd14=_0x12dd14-0x0;var _0x436659=_0x79f7[_0x12dd14];return _0x436659;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x779f('0x0'));var zipdir=require(_0x779f('0x1'));var jsonpatch=require(_0x779f('0x2'));var rp=require('request-promise');var moment=require(_0x779f('0x3'));var BPromise=require(_0x779f('0x4'));var Mustache=require('mustache');var util=require(_0x779f('0x5'));var path=require(_0x779f('0x6'));var sox=require(_0x779f('0x7'));var csv=require(_0x779f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x779f('0x9'));var _=require(_0x779f('0xa'));var squel=require(_0x779f('0xb'));var crypto=require(_0x779f('0xc'));var jsforce=require(_0x779f('0xd'));var deskjs=require(_0x779f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x779f('0xf'));var Papa=require(_0x779f('0x10'));var Redis=require(_0x779f('0x11'));var authService=require(_0x779f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x779f('0x13'));var hardwareService=require(_0x779f('0x14'));var logger=require(_0x779f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x779f('0x16'));var licenseUtil=require(_0x779f('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x779f('0x18'))(new Redis(config[_0x779f('0x19')]));require(_0x779f('0x1a'))['register'](socket);function respondWithStatusCode(_0x470afe,_0x3e3942){_0x3e3942=_0x3e3942||0xcc;return function(_0x1dec84){if(_0x1dec84){return _0x470afe[_0x779f('0x1b')](_0x3e3942);}return _0x470afe[_0x779f('0x1c')](_0x3e3942)[_0x779f('0x1d')]();};}function respondWithResult(_0xbfb1f8,_0x5aedca){_0x5aedca=_0x5aedca||0xc8;return function(_0x15c3e2){if(_0x15c3e2){return _0xbfb1f8[_0x779f('0x1c')](_0x5aedca)[_0x779f('0x1e')](_0x15c3e2);}};}function respondWithFilteredResult(_0x48d383,_0x18a08f){return function(_0xd9967){if(_0xd9967){var _0x38c5f7=typeof _0x18a08f[_0x779f('0x1f')]===_0x779f('0x20')&&typeof _0x18a08f[_0x779f('0x21')]===_0x779f('0x20');var _0x2d03ce=_0xd9967[_0x779f('0x22')];var _0xdc2d78=_0x38c5f7?0x0:_0x18a08f[_0x779f('0x1f')];var _0x5b66a9=_0x38c5f7?_0xd9967[_0x779f('0x22')]:_0x18a08f[_0x779f('0x1f')]+_0x18a08f[_0x779f('0x21')];var _0x460803;if(_0x5b66a9>=_0x2d03ce){_0x5b66a9=_0x2d03ce;_0x460803=0xc8;}else{_0x460803=0xce;}_0x48d383['status'](_0x460803);return _0x48d383[_0x779f('0x23')](_0x779f('0x24'),_0xdc2d78+'-'+_0x5b66a9+'/'+_0x2d03ce)[_0x779f('0x1e')](_0xd9967);}return null;};}function patchUpdates(_0x293c81){return function(_0xecb76a){try{jsonpatch[_0x779f('0x25')](_0xecb76a,_0x293c81,!![]);}catch(_0x4f2a7b){return BPromise['reject'](_0x4f2a7b);}return _0xecb76a[_0x779f('0x26')]();};}function saveUpdates(_0x409ee6,_0xec3412){return function(_0x5baebb){if(_0x5baebb){return _0x5baebb['update'](_0x409ee6)[_0x779f('0x27')](function(_0x48032d){return _0x48032d;});}return null;};}function removeEntity(_0x48393e,_0x541c46){return function(_0x478f54){if(_0x478f54){return _0x478f54[_0x779f('0x28')]()[_0x779f('0x27')](function(){var _0x4bb45d=_0x478f54['get']({'plain':!![]});var _0xc52aae='MailQueues';return db['UserProfileResource'][_0x779f('0x28')]({'where':{'type':_0xc52aae,'resourceId':_0x4bb45d['id']}})['then'](function(){return _0x478f54;});})[_0x779f('0x27')](function(){_0x48393e[_0x779f('0x1c')](0xcc)[_0x779f('0x1d')]();});}};}function handleEntityNotFound(_0x54815d,_0x56ecd7){return function(_0x412778){if(!_0x412778){_0x54815d[_0x779f('0x1b')](0x194);}return _0x412778;};}function handleError(_0xc35171,_0x22c4ea){_0x22c4ea=_0x22c4ea||0x1f4;return function(_0x2f5982){logger[_0x779f('0x29')](_0x2f5982[_0x779f('0x2a')]);if(_0x2f5982[_0x779f('0x2b')]){delete _0x2f5982[_0x779f('0x2b')];}_0xc35171[_0x779f('0x1c')](_0x22c4ea)[_0x779f('0x2c')](_0x2f5982);};}exports[_0x779f('0x2d')]=function(_0x289a55,_0x114471){var _0xd07094={},_0x33da35={},_0x58ee01={'count':0x0,'rows':[]};var _0x1900c8=_[_0x779f('0x2e')](db['MailQueue'][_0x779f('0x2f')],function(_0x34cf26){return{'name':_0x34cf26[_0x779f('0x30')],'type':_0x34cf26[_0x779f('0x31')][_0x779f('0x32')]};});_0x33da35[_0x779f('0x33')]=_[_0x779f('0x2e')](_0x1900c8,_0x779f('0x2b'));_0x33da35[_0x779f('0x34')]=_[_0x779f('0x35')](_0x289a55['query']);_0x33da35['filters']=_[_0x779f('0x36')](_0x33da35[_0x779f('0x33')],_0x33da35[_0x779f('0x34')]);_0xd07094[_0x779f('0x37')]=_[_0x779f('0x36')](_0x33da35[_0x779f('0x33')],qs['fields'](_0x289a55[_0x779f('0x34')][_0x779f('0x38')]));_0xd07094[_0x779f('0x37')]=_0xd07094[_0x779f('0x37')][_0x779f('0x39')]?_0xd07094[_0x779f('0x37')]:_0x33da35[_0x779f('0x33')];if(!_0x289a55[_0x779f('0x34')][_0x779f('0x3a')]('nolimit')){_0xd07094[_0x779f('0x21')]=qs[_0x779f('0x21')](_0x289a55[_0x779f('0x34')][_0x779f('0x21')]);_0xd07094[_0x779f('0x1f')]=qs['offset'](_0x289a55[_0x779f('0x34')][_0x779f('0x1f')]);}_0xd07094['order']=qs[_0x779f('0x3b')](_0x289a55['query'][_0x779f('0x3b')]);_0xd07094[_0x779f('0x3c')]=qs[_0x779f('0x3d')](_['pick'](_0x289a55[_0x779f('0x34')],_0x33da35[_0x779f('0x3d')]),_0x1900c8);if(_0x289a55['query'][_0x779f('0x3e')]){_0xd07094[_0x779f('0x3c')]=_['merge'](_0xd07094[_0x779f('0x3c')],{'$or':_['map'](_0x1900c8,function(_0x285d11){if(_0x285d11['type']!=='VIRTUAL'){var _0x15f9e3={};_0x15f9e3[_0x285d11[_0x779f('0x2b')]]={'$like':'%'+_0x289a55[_0x779f('0x34')][_0x779f('0x3e')]+'%'};return _0x15f9e3;}})});}_0xd07094=_['merge']({},_0xd07094,_0x289a55[_0x779f('0x3f')]);var _0x43ac5d={'where':_0xd07094['where']};return db[_0x779f('0x40')]['count'](_0x43ac5d)[_0x779f('0x27')](function(_0x547509){_0x58ee01[_0x779f('0x22')]=_0x547509;if(_0x289a55[_0x779f('0x34')]['includeAll']){_0xd07094[_0x779f('0x41')]=[{'all':!![]}];}return db[_0x779f('0x40')][_0x779f('0x42')](_0xd07094);})['then'](function(_0x5121cc){_0x58ee01[_0x779f('0x43')]=_0x5121cc;return _0x58ee01;})[_0x779f('0x27')](respondWithFilteredResult(_0x114471,_0xd07094))[_0x779f('0x44')](handleError(_0x114471,null));};exports[_0x779f('0x45')]=function(_0x1803e7,_0x369911){var _0x443c54={'raw':!![],'where':{'id':_0x1803e7[_0x779f('0x46')]['id']}},_0x1745f4={};_0x1745f4[_0x779f('0x33')]=_[_0x779f('0x35')](db[_0x779f('0x40')]['rawAttributes']);_0x1745f4[_0x779f('0x34')]=_[_0x779f('0x35')](_0x1803e7['query']);_0x1745f4[_0x779f('0x3d')]=_[_0x779f('0x36')](_0x1745f4['model'],_0x1745f4[_0x779f('0x34')]);_0x443c54[_0x779f('0x37')]=_[_0x779f('0x36')](_0x1745f4[_0x779f('0x33')],qs[_0x779f('0x38')](_0x1803e7[_0x779f('0x34')][_0x779f('0x38')]));_0x443c54[_0x779f('0x37')]=_0x443c54['attributes'][_0x779f('0x39')]?_0x443c54[_0x779f('0x37')]:_0x1745f4['model'];if(_0x1803e7[_0x779f('0x34')]['includeAll']){_0x443c54[_0x779f('0x41')]=[{'all':!![]}];}_0x443c54=_[_0x779f('0x47')]({},_0x443c54,_0x1803e7[_0x779f('0x3f')]);return db[_0x779f('0x40')][_0x779f('0x48')](_0x443c54)['then'](handleEntityNotFound(_0x369911,null))[_0x779f('0x27')](respondWithResult(_0x369911,null))[_0x779f('0x44')](handleError(_0x369911,null));};exports[_0x779f('0x49')]=function(_0x1abad6,_0x2179a8){return db[_0x779f('0x40')]['create'](_0x1abad6[_0x779f('0x4a')],{})[_0x779f('0x27')](function(_0x39c620){var _0x466a16=_0x1abad6['user'][_0x779f('0x4b')]({'plain':!![]});if(!_0x466a16)throw new Error(_0x779f('0x4c'));if(_0x466a16[_0x779f('0x4d')]==='user'){var _0x1201da=_0x39c620['get']({'plain':!![]});var _0x3540a1='MailQueues';return db[_0x779f('0x4e')]['find']({'where':{'name':_0x3540a1,'userProfileId':_0x466a16[_0x779f('0x4f')]},'raw':!![]})['then'](function(_0x415b2a){if(_0x415b2a&&_0x415b2a['autoAssociation']===0x0){return db[_0x779f('0x50')]['create']({'name':_0x1201da[_0x779f('0x2b')],'resourceId':_0x1201da['id'],'type':_0x415b2a[_0x779f('0x2b')],'sectionId':_0x415b2a['id']},{})[_0x779f('0x27')](function(){return _0x39c620;});}else{return _0x39c620;}})[_0x779f('0x44')](function(_0x54f668){logger[_0x779f('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54f668);throw _0x54f668;});}return _0x39c620;})['then'](respondWithResult(_0x2179a8,0xc9))[_0x779f('0x44')](handleError(_0x2179a8,null));};exports[_0x779f('0x51')]=function(_0x3c9966,_0x2206d5){if(_0x3c9966[_0x779f('0x4a')]['id']){delete _0x3c9966[_0x779f('0x4a')]['id'];}return db[_0x779f('0x40')][_0x779f('0x48')]({'where':{'id':_0x3c9966['params']['id']}})['then'](handleEntityNotFound(_0x2206d5,null))[_0x779f('0x27')](saveUpdates(_0x3c9966[_0x779f('0x4a')],null))[_0x779f('0x27')](respondWithResult(_0x2206d5,null))[_0x779f('0x44')](handleError(_0x2206d5,null));};exports[_0x779f('0x28')]=function(_0xf17806,_0x4826c1){return db[_0x779f('0x40')]['find']({'where':{'id':_0xf17806['params']['id']}})['then'](handleEntityNotFound(_0x4826c1,null))[_0x779f('0x27')](removeEntity(_0x4826c1,null))['catch'](handleError(_0x4826c1,null));};exports[_0x779f('0x52')]=function(_0x3fc557,_0x419902){return db[_0x779f('0x40')]['describe']()['then'](respondWithResult(_0x419902,null))['catch'](handleError(_0x419902,null));};exports[_0x779f('0x53')]=function(_0x653a65,_0x24579c,_0x4555c7){var _0xe9d3e0={'raw':!![],'where':{}},_0x216a56={},_0x3a8e83;return db[_0x779f('0x40')][_0x779f('0x54')]({'where':{'id':_0x653a65[_0x779f('0x46')]['id']}})[_0x779f('0x27')](handleEntityNotFound(_0x24579c,null))[_0x779f('0x27')](function(_0x3f2bbd){if(_0x3f2bbd){_0x3a8e83=_0x3f2bbd['get']({'plain':!![]});_0x216a56[_0x779f('0x33')]=_[_0x779f('0x35')](db[_0x779f('0x55')][_0x779f('0x2f')]);_0x216a56[_0x779f('0x34')]=_[_0x779f('0x35')](_0x653a65[_0x779f('0x34')]);_0x216a56[_0x779f('0x3d')]=_['intersection'](_0x216a56['model'],_0x216a56[_0x779f('0x34')]);_0xe9d3e0[_0x779f('0x37')]=_[_0x779f('0x36')](_0x216a56[_0x779f('0x33')],qs['fields'](_0x653a65['query']['fields']));_0xe9d3e0['attributes']=_0xe9d3e0[_0x779f('0x37')]['length']?_0xe9d3e0[_0x779f('0x37')]:_0x216a56[_0x779f('0x33')];if(!_0x653a65['query'][_0x779f('0x3a')]('nolimit')){_0xe9d3e0['limit']=qs[_0x779f('0x21')](_0x653a65[_0x779f('0x34')][_0x779f('0x21')]);_0xe9d3e0[_0x779f('0x1f')]=qs[_0x779f('0x1f')](_0x653a65[_0x779f('0x34')][_0x779f('0x1f')]);}_0xe9d3e0[_0x779f('0x56')]=qs[_0x779f('0x3b')](_0x653a65[_0x779f('0x34')][_0x779f('0x3b')]);_0xe9d3e0[_0x779f('0x3c')]=qs['filters'](_[_0x779f('0x57')](_0x653a65[_0x779f('0x34')],_0x216a56[_0x779f('0x3d')]));_0xe9d3e0[_0x779f('0x3c')][_0x779f('0x58')]=_0x3f2bbd['id'];if(_0x653a65[_0x779f('0x34')][_0x779f('0x3e')]){_0xe9d3e0[_0x779f('0x3c')]=_[_0x779f('0x47')](_0xe9d3e0[_0x779f('0x3c')],{'$or':_[_0x779f('0x2e')](_0xe9d3e0[_0x779f('0x37')],function(_0x13cb77){var _0x5a4045={};_0x5a4045[_0x13cb77]={'$like':'%'+_0x653a65[_0x779f('0x34')][_0x779f('0x3e')]+'%'};return _0x5a4045;})});}_0xe9d3e0=_[_0x779f('0x47')]({},_0xe9d3e0,_0x653a65[_0x779f('0x3f')]);return db[_0x779f('0x55')][_0x779f('0x42')](_0xe9d3e0);}})['then'](function(_0x1fd085){if(_0x1fd085){return db[_0x779f('0x59')][_0x779f('0x5a')]({'where':{'id':_[_0x779f('0x2e')](_0x1fd085,_0x779f('0x5b')),'role':'agent'},'attributes':['id',_0x779f('0x2b'),_0x779f('0x5c'),'updatedAt',_0x779f('0x5d')]});}})[_0x779f('0x27')](function(_0x2e3657){if(_0x2e3657){return{'count':_0x2e3657[_0x779f('0x22')],'rows':_[_0x779f('0x2e')](_0x2e3657['rows'],function(_0x233187){return{'membername':_0x233187[_0x779f('0x2b')],'UserId':_0x233187['id'],'queue_name':_0x3a8e83['name'],'MailQueueId':_0x3a8e83['id'],'interface':util[_0x779f('0x5e')](_0x779f('0x5f'),_0x779f('0x60'),_0x233187['name']),'penalty':0x0,'paused':_0x233187[_0x779f('0x5c')],'createdAt':_0x233187[_0x779f('0x5d')],'updatedAt':_0x233187[_0x779f('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x779f('0x27')](respondWithFilteredResult(_0x24579c,_0xe9d3e0))[_0x779f('0x44')](handleError(_0x24579c,null));};exports[_0x779f('0x62')]=function(_0x5eed19,_0x1ea2bb,_0x39cd08){var _0x301aeb={};var _0x4ec259={};var _0x235731;var _0x2a4786;return db[_0x779f('0x40')][_0x779f('0x54')]({'where':{'id':_0x5eed19[_0x779f('0x46')]['id']}})[_0x779f('0x27')](handleEntityNotFound(_0x1ea2bb,null))['then'](function(_0x249d38){if(_0x249d38){_0x235731=_0x249d38;_0x4ec259[_0x779f('0x33')]=_[_0x779f('0x35')](db['Team'][_0x779f('0x2f')]);_0x4ec259[_0x779f('0x34')]=_[_0x779f('0x35')](_0x5eed19['query']);_0x4ec259[_0x779f('0x3d')]=_[_0x779f('0x36')](_0x4ec259['model'],_0x4ec259[_0x779f('0x34')]);_0x301aeb[_0x779f('0x37')]=_[_0x779f('0x36')](_0x4ec259[_0x779f('0x33')],qs['fields'](_0x5eed19[_0x779f('0x34')][_0x779f('0x38')]));_0x301aeb[_0x779f('0x37')]=_0x301aeb[_0x779f('0x37')][_0x779f('0x39')]?_0x301aeb[_0x779f('0x37')]:_0x4ec259[_0x779f('0x33')];_0x301aeb[_0x779f('0x56')]=qs[_0x779f('0x3b')](_0x5eed19[_0x779f('0x34')]['sort']);_0x301aeb[_0x779f('0x3c')]=qs[_0x779f('0x3d')](_[_0x779f('0x57')](_0x5eed19[_0x779f('0x34')],_0x4ec259[_0x779f('0x3d')]));if(_0x5eed19['query'][_0x779f('0x3e')]){_0x301aeb['where']=_[_0x779f('0x47')](_0x301aeb['where'],{'$or':_[_0x779f('0x2e')](_0x301aeb[_0x779f('0x37')],function(_0x42e078){var _0x21a82c={};_0x21a82c[_0x42e078]={'$like':'%'+_0x5eed19[_0x779f('0x34')]['filter']+'%'};return _0x21a82c;})});}_0x301aeb=_[_0x779f('0x47')]({},_0x301aeb,_0x5eed19[_0x779f('0x3f')]);return _0x235731[_0x779f('0x62')](_0x301aeb);}})[_0x779f('0x27')](function(_0xe434b){if(_0xe434b){_0x2a4786=_0xe434b['length'];if(!_0x5eed19['query'][_0x779f('0x3a')](_0x779f('0x63'))){_0x301aeb['limit']=qs[_0x779f('0x21')](_0x5eed19[_0x779f('0x34')][_0x779f('0x21')]);_0x301aeb[_0x779f('0x1f')]=qs['offset'](_0x5eed19[_0x779f('0x34')][_0x779f('0x1f')]);}return _0x235731[_0x779f('0x62')](_0x301aeb);}})[_0x779f('0x27')](function(_0x560bc1){if(_0x560bc1){return _0x560bc1?{'count':_0x2a4786,'rows':_0x560bc1}:null;}})[_0x779f('0x27')](respondWithResult(_0x1ea2bb,null))[_0x779f('0x44')](handleError(_0x1ea2bb,null));};exports[_0x779f('0x64')]=function(_0x38557f,_0x149e45,_0x14e79e){var _0x1dc7b7=_0x38557f[_0x779f('0x4a')][_0x779f('0x65')];return db[_0x779f('0x66')][_0x779f('0x42')]({'where':{'id':_0x1dc7b7},'attributes':['id'],'include':[{'model':db[_0x779f('0x59')],'as':_0x779f('0x67'),'attributes':['id',_0x779f('0x2b'),'online',_0x779f('0x68'),'interface'],'raw':!![]}]})['then'](function(_0x323797){if(_0x323797){var _0x319e9f=_[_0x779f('0x69')](_0x323797,function(_0x15e9ba){var _0x5a41aa=_0x15e9ba[_0x779f('0x4b')]({'plain':!![]});return _0x5a41aa[_0x779f('0x67')];});return db[_0x779f('0x40')][_0x779f('0x48')]({'where':{'id':_0x38557f[_0x779f('0x46')]['id']}})['then'](function(_0x450b19){return db[_0x779f('0x6a')][_0x779f('0x6b')](function(_0xa1ae8){return _0x450b19[_0x779f('0x64')](_0x1dc7b7,{'transaction':_0xa1ae8})[_0x779f('0x27')](function(){return BPromise[_0x779f('0x6c')](_0x319e9f,function(_0x3afc33){return db['UserMailQueue'][_0x779f('0x6d')]({'where':{'UserId':_0x3afc33['id'],'MailQueueId':_0x38557f[_0x779f('0x46')]['id']},'transaction':_0xa1ae8});});})[_0x779f('0x27')](function(){_0x319e9f[_0x779f('0x6e')](function(_0x59a28d){socket[_0x779f('0x6f')]('userMailQueue:save',{'UserId':_0x59a28d['id'],'MailQueueId':_0x450b19['id']});});});});});}})[_0x779f('0x27')](respondWithStatusCode(_0x149e45,null))[_0x779f('0x44')](handleError(_0x149e45,null));};exports[_0x779f('0x70')]=function(_0x412c2a,_0x34761c,_0x212149){return db[_0x779f('0x66')]['findAll']({'where':{'id':_0x412c2a[_0x779f('0x34')][_0x779f('0x65')]},'attributes':['id'],'include':[{'model':db[_0x779f('0x59')],'as':_0x779f('0x67'),'attributes':['id'],'raw':!![]}]})[_0x779f('0x27')](handleEntityNotFound(_0x34761c,null))[_0x779f('0x27')](function(_0x39a5e2){var _0x18fc45=_[_0x779f('0x2e')](_0x39a5e2,'id');var _0x61dd7b=[];var _0x4df20b=[];var _0x37936c=squel['select']();_0x37936c[_0x779f('0x71')]('tq.TeamId')[_0x779f('0x72')](_0x779f('0x73'),'tq')['join'](_0x779f('0x74'),'ut',_0x779f('0x75'))[_0x779f('0x3c')](_0x779f('0x76'),_0x412c2a[_0x779f('0x46')]['id']);for(var _0x49d01e=0x0;_0x49d01e<_0x39a5e2[_0x779f('0x39')];_0x49d01e+=0x1){let _0x308150=_0x39a5e2[_0x49d01e];for(var _0x596d8c=0x0;_0x596d8c<_0x308150[_0x779f('0x67')][_0x779f('0x39')];_0x596d8c+=0x1){let _0x2bae2e=_0x308150['Agents'][_0x596d8c];var _0x411dc9=_0x37936c['clone']();_0x411dc9[_0x779f('0x3c')](_0x779f('0x77'),_0x2bae2e['id']);_0x4df20b[_0x779f('0x78')](db[_0x779f('0x6a')][_0x779f('0x34')](_0x411dc9[_0x779f('0x79')](),{'type':db[_0x779f('0x6a')][_0x779f('0x7a')][_0x779f('0x7b')]})['then'](function(_0x50101b){if(_0x50101b[_0x779f('0x39')]===0x1){return _0x2bae2e['id'];}else{var _0x422f9e=_['every'](_[_0x779f('0x2e')](_0x50101b,_0x779f('0x7c')),function(_0x1640c2){return _['includes'](_0x18fc45,_0x1640c2);});if(_0x422f9e){return _0x2bae2e['id'];}}}));}}return BPromise[_0x779f('0x7d')](_0x4df20b)[_0x779f('0x27')](function(_0x192441){_0x61dd7b=_(_0x61dd7b)['union'](_0x192441)[_0x779f('0x7e')]()[_0x779f('0x7f')]();return db[_0x779f('0x40')]['find']({'where':{'id':_0x412c2a[_0x779f('0x46')]['id']}})[_0x779f('0x27')](function(_0x31e336){return db[_0x779f('0x6a')][_0x779f('0x6b')](function(_0x42f726){return _0x31e336['removeTeams'](_0x412c2a[_0x779f('0x34')]['ids'],{'transaction':_0x42f726})[_0x779f('0x27')](function(){if(!_[_0x779f('0x80')](_0x61dd7b)){return _0x31e336['removeAgents'](_0x61dd7b,{'transaction':_0x42f726});}})['then'](function(){_0x61dd7b[_0x779f('0x6e')](function(_0x4e5dc9){socket[_0x779f('0x6f')](_0x779f('0x81'),{'UserId':_0x4e5dc9,'MailQueueId':_0x31e336['id']});});});});});});})['then'](respondWithStatusCode(_0x34761c,null))[_0x779f('0x44')](handleError(_0x34761c,null));};exports[_0x779f('0x82')]=function(_0x4bdffc,_0x3c637f,_0x253672){return db[_0x779f('0x40')][_0x779f('0x48')]({'where':{'id':_0x4bdffc['params']['id']}})[_0x779f('0x27')](handleEntityNotFound(_0x3c637f,null))[_0x779f('0x27')](function(_0x20991d){if(_0x20991d){return _0x20991d['addAgents'](_0x4bdffc[_0x779f('0x4a')][_0x779f('0x65')],_[_0x779f('0x83')](_0x4bdffc[_0x779f('0x4a')],[_0x779f('0x65'),'id'])||{})['spread'](function(_0x435f38){for(var _0x3e2262=0x0;_0x3e2262<_0x4bdffc[_0x779f('0x4a')][_0x779f('0x65')][_0x779f('0x39')];_0x3e2262+=0x1){socket[_0x779f('0x6f')](_0x779f('0x84'),{'UserId':Number(_0x4bdffc[_0x779f('0x4a')][_0x779f('0x65')][_0x3e2262]),'MailQueueId':Number(_0x4bdffc[_0x779f('0x46')]['id'])});}return _0x435f38;});}})['then'](respondWithResult(_0x3c637f,null))[_0x779f('0x44')](handleError(_0x3c637f,null));};exports[_0x779f('0x85')]=function(_0x3cf91e,_0x1941aa,_0x27c1d4){return db[_0x779f('0x40')][_0x779f('0x48')]({'where':{'id':_0x3cf91e[_0x779f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1941aa,null))[_0x779f('0x27')](function(_0x5c11fb){if(_0x5c11fb){return _0x5c11fb[_0x779f('0x85')](_0x3cf91e[_0x779f('0x34')][_0x779f('0x65')])['then'](function(){if(_[_0x779f('0x86')](_0x3cf91e[_0x779f('0x34')][_0x779f('0x65')])){for(var _0x4b9746=0x0;_0x4b9746<_0x3cf91e[_0x779f('0x34')][_0x779f('0x65')][_0x779f('0x39')];_0x4b9746+=0x1){socket[_0x779f('0x6f')](_0x779f('0x81'),{'UserId':Number(_0x3cf91e[_0x779f('0x34')][_0x779f('0x65')][_0x4b9746]),'MailQueueId':Number(_0x3cf91e[_0x779f('0x46')]['id'])});}}else{socket[_0x779f('0x6f')](_0x779f('0x81'),{'UserId':Number(_0x3cf91e[_0x779f('0x34')][_0x779f('0x65')]),'MailQueueId':Number(_0x3cf91e[_0x779f('0x46')]['id'])});}});}})[_0x779f('0x27')](respondWithStatusCode(_0x1941aa,null))[_0x779f('0x44')](handleError(_0x1941aa,null));};exports[_0x779f('0x87')]=function(_0x4cf7b8,_0x19923b,_0xdcf39){var _0x2bc27d={};var _0x109df2={};var _0x78ad2d;var _0x25883e;return db['MailQueue'][_0x779f('0x54')]({'where':{'id':_0x4cf7b8[_0x779f('0x46')]['id']}})[_0x779f('0x27')](handleEntityNotFound(_0x19923b,null))['then'](function(_0xd36541){if(_0xd36541){_0x78ad2d=_0xd36541;_0x109df2['model']=_['keys'](db['User'][_0x779f('0x2f')]);_0x109df2[_0x779f('0x34')]=_['keys'](_0x4cf7b8[_0x779f('0x34')]);_0x109df2['filters']=_[_0x779f('0x36')](_0x109df2['model'],_0x109df2[_0x779f('0x34')]);_0x2bc27d['attributes']=_[_0x779f('0x36')](_0x109df2[_0x779f('0x33')],qs[_0x779f('0x38')](_0x4cf7b8[_0x779f('0x34')][_0x779f('0x38')]));_0x2bc27d[_0x779f('0x37')]=_0x2bc27d['attributes'][_0x779f('0x39')]?_0x2bc27d[_0x779f('0x37')]:_0x109df2[_0x779f('0x33')];_0x2bc27d[_0x779f('0x56')]=qs[_0x779f('0x3b')](_0x4cf7b8[_0x779f('0x34')][_0x779f('0x3b')]);_0x2bc27d['where']=qs[_0x779f('0x3d')](_[_0x779f('0x57')](_0x4cf7b8[_0x779f('0x34')],_0x109df2[_0x779f('0x3d')]));if(_0x4cf7b8[_0x779f('0x34')]['filter']){_0x2bc27d[_0x779f('0x3c')]=_['merge'](_0x2bc27d[_0x779f('0x3c')],{'$or':_[_0x779f('0x2e')](_0x2bc27d[_0x779f('0x37')],function(_0x37e093){var _0x4e47ac={};_0x4e47ac[_0x37e093]={'$like':'%'+_0x4cf7b8[_0x779f('0x34')][_0x779f('0x3e')]+'%'};return _0x4e47ac;})});}_0x2bc27d=_[_0x779f('0x47')]({},_0x2bc27d,_0x4cf7b8[_0x779f('0x3f')]);return _0x78ad2d[_0x779f('0x87')](_0x2bc27d);}})[_0x779f('0x27')](function(_0x65fcd3){if(_0x65fcd3){_0x25883e=_0x65fcd3[_0x779f('0x39')];if(!_0x4cf7b8['query'][_0x779f('0x3a')](_0x779f('0x63'))){_0x2bc27d[_0x779f('0x21')]=qs[_0x779f('0x21')](_0x4cf7b8[_0x779f('0x34')][_0x779f('0x21')]);_0x2bc27d['offset']=qs[_0x779f('0x1f')](_0x4cf7b8[_0x779f('0x34')][_0x779f('0x1f')]);}return _0x78ad2d[_0x779f('0x87')](_0x2bc27d);}})[_0x779f('0x27')](function(_0x2cb67c){if(_0x2cb67c){return _0x2cb67c?{'count':_0x25883e,'rows':_0x2cb67c}:null;}})[_0x779f('0x27')](respondWithResult(_0x19923b,null))['catch'](handleError(_0x19923b,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 3cec316..649a9bf 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 _0xc1c3=['MailQueue','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3a5bc0,_0x830b35){var _0xad3a6d=function(_0x16112c){while(--_0x16112c){_0x3a5bc0['push'](_0x3a5bc0['shift']());}};_0xad3a6d(++_0x830b35);}(_0xc1c3,0x142));var _0x3c1c=function(_0x23263f,_0xb04623){_0x23263f=_0x23263f-0x0;var _0x54fea6=_0xc1c3[_0x23263f];return _0x54fea6;};'use strict';var EventEmitter=require(_0x3c1c('0x0'));var MailQueue=require(_0x3c1c('0x1'))['db'][_0x3c1c('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3c1c('0x3'),'afterUpdate':_0x3c1c('0x4'),'afterDestroy':_0x3c1c('0x5')};function emitEvent(_0x1e419f){return function(_0x270be4,_0x5db95a,_0x525abf){MailQueueEvents[_0x3c1c('0x6')](_0x1e419f+':'+_0x270be4['id'],_0x270be4);MailQueueEvents['emit'](_0x1e419f,_0x270be4);_0x525abf(null);};}for(var e in events){if(events[_0x3c1c('0x7')](e)){var event=events[e];MailQueue[_0x3c1c('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xf5fe=['MailQueue','setMaxListeners','update','remove','hook','exports','events'];(function(_0x4f62a0,_0x123de1){var _0x237b9d=function(_0x5aa882){while(--_0x5aa882){_0x4f62a0['push'](_0x4f62a0['shift']());}};_0x237b9d(++_0x123de1);}(_0xf5fe,0x1f0));var _0xef5f=function(_0x152c7b,_0xec72d9){_0x152c7b=_0x152c7b-0x0;var _0x572d41=_0xf5fe[_0x152c7b];return _0x572d41;};'use strict';var EventEmitter=require(_0xef5f('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xef5f('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xef5f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xef5f('0x3'),'afterDestroy':_0xef5f('0x4')};function emitEvent(_0x111456){return function(_0x42a4a9,_0x5dc34d,_0x503a52){MailQueueEvents['emit'](_0x111456+':'+_0x42a4a9['id'],_0x42a4a9);MailQueueEvents['emit'](_0x111456,_0x42a4a9);_0x503a52(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xef5f('0x5')](e,emitEvent(event));}}module[_0xef5f('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 9337c11..8181e7f 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 _0xf621=['../../config/environment','./mailQueue.attributes','define','MailQueue','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x350c87,_0x2b44ef){var _0x163800=function(_0xb99c9){while(--_0xb99c9){_0x350c87['push'](_0x350c87['shift']());}};_0x163800(++_0x2b44ef);}(_0xf621,0x88));var _0x1f62=function(_0x257017,_0x330627){_0x257017=_0x257017-0x0;var _0x38536d=_0xf621[_0x257017];return _0x38536d;};'use strict';var _=require(_0x1f62('0x0'));var util=require(_0x1f62('0x1'));var logger=require(_0x1f62('0x2'))(_0x1f62('0x3'));var moment=require(_0x1f62('0x4'));var BPromise=require(_0x1f62('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f62('0x6'));var rimraf=require(_0x1f62('0x7'));var config=require(_0x1f62('0x8'));var attributes=require(_0x1f62('0x9'));module['exports']=function(_0xe1081,_0x4af5a9){return _0xe1081[_0x1f62('0xa')](_0x1f62('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfab3=['mail_queues','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue'];(function(_0x5b2b64,_0x35db2b){var _0x185cd0=function(_0x571cb4){while(--_0x571cb4){_0x5b2b64['push'](_0x5b2b64['shift']());}};_0x185cd0(++_0x35db2b);}(_0xfab3,0x1b1));var _0x3fab=function(_0x4651f1,_0x5b775a){_0x4651f1=_0x4651f1-0x0;var _0x276b53=_0xfab3[_0x4651f1];return _0x276b53;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3fab('0x0'));var moment=require(_0x3fab('0x1'));var BPromise=require(_0x3fab('0x2'));var rp=require(_0x3fab('0x3'));var fs=require('fs');var path=require(_0x3fab('0x4'));var rimraf=require(_0x3fab('0x5'));var config=require(_0x3fab('0x6'));var attributes=require(_0x3fab('0x7'));module[_0x3fab('0x8')]=function(_0xe844f0,_0x2e0a7c){return _0xe844f0[_0x3fab('0x9')](_0x3fab('0xa'),attributes,{'tableName':_0x3fab('0xb'),'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 04e839a..7b62a05 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 _0x2e31=['MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','attributes','include','map','model','GetMailQueue','ShowMailQueue','MailQueue','find','where','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info'];(function(_0x584f9e,_0x11d9c7){var _0x29d129=function(_0x2620ad){while(--_0x2620ad){_0x584f9e['push'](_0x584f9e['shift']());}};_0x29d129(++_0x11d9c7);}(_0x2e31,0x145));var _0x12e3=function(_0x215a89,_0xfddaf7){_0x215a89=_0x215a89-0x0;var _0xb8c79e=_0x2e31[_0x215a89];return _0xb8c79e;};'use strict';var _=require(_0x12e3('0x0'));var util=require(_0x12e3('0x1'));var moment=require(_0x12e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x12e3('0x3'));var fs=require('fs');var Redis=require(_0x12e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x12e3('0x5'))(_0x12e3('0x6'));var config=require(_0x12e3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x12e3('0x8')][_0x12e3('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x12e3('0xa')],{'host':_0x12e3('0xb'),'port':0x18eb});var socket=require(_0x12e3('0xc'))(new Redis(config[_0x12e3('0xa')]));require('./mailQueue.socket')[_0x12e3('0xd')](socket);function respondWithRpcPromise(_0x3ec880,_0x40bf58,_0x5208d6){return new BPromise(function(_0x5901b3,_0x3e7283){return client[_0x12e3('0xe')](_0x3ec880,_0x5208d6)[_0x12e3('0xf')](function(_0x3d6c3c){logger[_0x12e3('0x10')](_0x12e3('0x11'),_0x40bf58,_0x12e3('0x12'));logger[_0x12e3('0x13')](_0x12e3('0x14'),_0x40bf58,_0x12e3('0x12'),JSON[_0x12e3('0x15')](_0x3d6c3c));if(_0x3d6c3c[_0x12e3('0x16')]){if(_0x3d6c3c['error'][_0x12e3('0x17')]===0x1f4){logger[_0x12e3('0x16')](_0x12e3('0x11'),_0x40bf58,_0x3d6c3c['error'][_0x12e3('0x18')]);return _0x3e7283(_0x3d6c3c[_0x12e3('0x16')]['message']);}logger['error']('MailQueue,\x20%s,\x20%s',_0x40bf58,_0x3d6c3c[_0x12e3('0x16')]['message']);return _0x5901b3(_0x3d6c3c[_0x12e3('0x16')][_0x12e3('0x18')]);}else{logger[_0x12e3('0x10')](_0x12e3('0x11'),_0x40bf58,_0x12e3('0x12'));_0x5901b3(_0x3d6c3c[_0x12e3('0x19')]['message']);}})[_0x12e3('0x1a')](function(_0x199e1d){logger['error']('MailQueue,\x20%s,\x20%s',_0x40bf58,_0x199e1d);_0x3e7283(_0x199e1d);});});}exports['GetMailQueue']=function(_0x2e5f1a){var _0x577b74=this;return new Promise(function(_0x3db972,_0x2ddfbf){return db['MailQueue']['findAll']({'raw':_0x2e5f1a[_0x12e3('0x1b')]?_0x2e5f1a[_0x12e3('0x1b')][_0x12e3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e5f1a[_0x12e3('0x1b')]?_0x2e5f1a['options']['where']||null:null,'attributes':_0x2e5f1a[_0x12e3('0x1b')]?_0x2e5f1a[_0x12e3('0x1b')][_0x12e3('0x1d')]||null:null,'limit':_0x2e5f1a[_0x12e3('0x1b')]?_0x2e5f1a[_0x12e3('0x1b')]['limit']||null:null,'include':_0x2e5f1a[_0x12e3('0x1b')]?_0x2e5f1a[_0x12e3('0x1b')][_0x12e3('0x1e')]?_[_0x12e3('0x1f')](_0x2e5f1a[_0x12e3('0x1b')][_0x12e3('0x1e')],function(_0x578681){return{'model':db[_0x578681[_0x12e3('0x20')]],'as':_0x578681['as'],'attributes':_0x578681[_0x12e3('0x1d')],'include':_0x578681[_0x12e3('0x1e')]?_[_0x12e3('0x1f')](_0x578681['include'],function(_0x1609ea){return{'model':db[_0x1609ea[_0x12e3('0x20')]],'as':_0x1609ea['as'],'attributes':_0x1609ea[_0x12e3('0x1d')],'include':_0x1609ea['include']?_[_0x12e3('0x1f')](_0x1609ea[_0x12e3('0x1e')],function(_0x329d32){return{'model':db[_0x329d32[_0x12e3('0x20')]],'as':_0x329d32['as'],'attributes':_0x329d32['attributes']};}):[]};}):[]};}):[]:[]})[_0x12e3('0xf')](function(_0x2859d2){logger[_0x12e3('0x10')]('GetMailQueue',_0x2e5f1a);logger[_0x12e3('0x13')]('GetMailQueue',_0x2e5f1a,JSON[_0x12e3('0x15')](_0x2859d2));_0x3db972(_0x2859d2);})[_0x12e3('0x1a')](function(_0x286676){logger[_0x12e3('0x16')](_0x12e3('0x21'),_0x286676[_0x12e3('0x18')],_0x2e5f1a);_0x2ddfbf(_0x577b74['error'](0x1f4,_0x286676[_0x12e3('0x18')]));});});};exports[_0x12e3('0x22')]=function(_0x5d731c){var _0xf4647c=this;return new Promise(function(_0x4212cc,_0x4929f9){return db[_0x12e3('0x23')][_0x12e3('0x24')]({'raw':_0x5d731c['options']?_0x5d731c[_0x12e3('0x1b')][_0x12e3('0x1c')]===undefined?!![]:![]:!![],'where':_0x5d731c[_0x12e3('0x1b')]?_0x5d731c['options'][_0x12e3('0x25')]||null:null,'attributes':_0x5d731c[_0x12e3('0x1b')]?_0x5d731c[_0x12e3('0x1b')][_0x12e3('0x1d')]||null:null,'include':_0x5d731c[_0x12e3('0x1b')]?_0x5d731c[_0x12e3('0x1b')][_0x12e3('0x1e')]?_[_0x12e3('0x1f')](_0x5d731c[_0x12e3('0x1b')][_0x12e3('0x1e')],function(_0x19d331){return{'model':db[_0x19d331[_0x12e3('0x20')]],'as':_0x19d331['as'],'attributes':_0x19d331[_0x12e3('0x1d')],'include':_0x19d331['include']?_[_0x12e3('0x1f')](_0x19d331['include'],function(_0xbdde8a){return{'model':db[_0xbdde8a['model']],'as':_0xbdde8a['as'],'attributes':_0xbdde8a[_0x12e3('0x1d')],'include':_0xbdde8a[_0x12e3('0x1e')]?_['map'](_0xbdde8a[_0x12e3('0x1e')],function(_0x31910f){return{'model':db[_0x31910f['model']],'as':_0x31910f['as'],'attributes':_0x31910f[_0x12e3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x12e3('0xf')](function(_0x1f1ed3){logger['info'](_0x12e3('0x22'),_0x5d731c);logger[_0x12e3('0x13')](_0x12e3('0x22'),_0x5d731c,JSON['stringify'](_0x1f1ed3));_0x4212cc(_0x1f1ed3);})[_0x12e3('0x1a')](function(_0x4d6bdd){logger['error'](_0x12e3('0x22'),_0x4d6bdd[_0x12e3('0x18')],_0x5d731c);_0x4929f9(_0xf4647c[_0x12e3('0x16')](0x1f4,_0x4d6bdd['message']));});});}; \ No newline at end of file +var _0x49e9=['bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','find','catch','lodash','util'];(function(_0x3c53a2,_0x3bbc48){var _0x24ac08=function(_0x18c221){while(--_0x18c221){_0x3c53a2['push'](_0x3c53a2['shift']());}};_0x24ac08(++_0x3bbc48);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var moment=require('moment');var BPromise=require(_0x949e('0x2'));var rs=require(_0x949e('0x3'));var fs=require('fs');var Redis=require(_0x949e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x949e('0x5'))('rpc');var config=require(_0x949e('0x6'));var jayson=require(_0x949e('0x7'));var client=jayson[_0x949e('0x8')]['http']({'port':0x232a});config[_0x949e('0x9')]=_[_0x949e('0xa')](config[_0x949e('0x9')],{'host':_0x949e('0xb'),'port':0x18eb});var socket=require(_0x949e('0xc'))(new Redis(config[_0x949e('0x9')]));require(_0x949e('0xd'))['register'](socket);function respondWithRpcPromise(_0x394859,_0x50ca96,_0x422dcc){return new BPromise(function(_0x3d0674,_0x255814){return client['request'](_0x394859,_0x422dcc)[_0x949e('0xe')](function(_0x1935a3){logger[_0x949e('0xf')](_0x949e('0x10'),_0x50ca96,_0x949e('0x11'));logger[_0x949e('0x12')](_0x949e('0x13'),_0x50ca96,_0x949e('0x11'),JSON[_0x949e('0x14')](_0x1935a3));if(_0x1935a3[_0x949e('0x15')]){if(_0x1935a3[_0x949e('0x15')][_0x949e('0x16')]===0x1f4){logger[_0x949e('0x15')](_0x949e('0x10'),_0x50ca96,_0x1935a3[_0x949e('0x15')]['message']);return _0x255814(_0x1935a3[_0x949e('0x15')][_0x949e('0x17')]);}logger[_0x949e('0x15')](_0x949e('0x10'),_0x50ca96,_0x1935a3['error'][_0x949e('0x17')]);return _0x3d0674(_0x1935a3[_0x949e('0x15')]['message']);}else{logger[_0x949e('0xf')](_0x949e('0x10'),_0x50ca96,_0x949e('0x11'));_0x3d0674(_0x1935a3[_0x949e('0x18')][_0x949e('0x17')]);}})['catch'](function(_0x31a2ad){logger[_0x949e('0x15')](_0x949e('0x10'),_0x50ca96,_0x31a2ad);_0x255814(_0x31a2ad);});});}exports[_0x949e('0x19')]=function(_0xf319f1){var _0x141bc1=this;return new Promise(function(_0x354e89,_0x2f21bd){return db[_0x949e('0x1a')][_0x949e('0x1b')]({'raw':_0xf319f1[_0x949e('0x1c')]?_0xf319f1[_0x949e('0x1c')][_0x949e('0x1d')]===undefined?!![]:![]:!![],'where':_0xf319f1[_0x949e('0x1c')]?_0xf319f1[_0x949e('0x1c')][_0x949e('0x1e')]||null:null,'attributes':_0xf319f1['options']?_0xf319f1[_0x949e('0x1c')][_0x949e('0x1f')]||null:null,'limit':_0xf319f1['options']?_0xf319f1['options'][_0x949e('0x20')]||null:null,'include':_0xf319f1[_0x949e('0x1c')]?_0xf319f1[_0x949e('0x1c')][_0x949e('0x21')]?_[_0x949e('0x22')](_0xf319f1[_0x949e('0x1c')][_0x949e('0x21')],function(_0x255b11){return{'model':db[_0x255b11[_0x949e('0x23')]],'as':_0x255b11['as'],'attributes':_0x255b11[_0x949e('0x1f')],'include':_0x255b11['include']?_[_0x949e('0x22')](_0x255b11[_0x949e('0x21')],function(_0x59b3a1){return{'model':db[_0x59b3a1[_0x949e('0x23')]],'as':_0x59b3a1['as'],'attributes':_0x59b3a1[_0x949e('0x1f')],'include':_0x59b3a1['include']?_[_0x949e('0x22')](_0x59b3a1[_0x949e('0x21')],function(_0x5b9f28){return{'model':db[_0x5b9f28[_0x949e('0x23')]],'as':_0x5b9f28['as'],'attributes':_0x5b9f28['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e169d){logger['info']('GetMailQueue',_0xf319f1);logger[_0x949e('0x12')](_0x949e('0x19'),_0xf319f1,JSON[_0x949e('0x14')](_0x4e169d));_0x354e89(_0x4e169d);})['catch'](function(_0x4ca7ae){logger['error']('GetMailQueue',_0x4ca7ae[_0x949e('0x17')],_0xf319f1);_0x2f21bd(_0x141bc1[_0x949e('0x15')](0x1f4,_0x4ca7ae[_0x949e('0x17')]));});});};exports[_0x949e('0x24')]=function(_0x5b88de){var _0x2cb0c3=this;return new Promise(function(_0x1d9ce6,_0xad8500){return db['MailQueue'][_0x949e('0x25')]({'raw':_0x5b88de[_0x949e('0x1c')]?_0x5b88de[_0x949e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5b88de['options']?_0x5b88de[_0x949e('0x1c')][_0x949e('0x1e')]||null:null,'attributes':_0x5b88de[_0x949e('0x1c')]?_0x5b88de[_0x949e('0x1c')]['attributes']||null:null,'include':_0x5b88de[_0x949e('0x1c')]?_0x5b88de[_0x949e('0x1c')][_0x949e('0x21')]?_[_0x949e('0x22')](_0x5b88de[_0x949e('0x1c')][_0x949e('0x21')],function(_0x3d84ba){return{'model':db[_0x3d84ba[_0x949e('0x23')]],'as':_0x3d84ba['as'],'attributes':_0x3d84ba['attributes'],'include':_0x3d84ba['include']?_[_0x949e('0x22')](_0x3d84ba['include'],function(_0x52a1ca){return{'model':db[_0x52a1ca[_0x949e('0x23')]],'as':_0x52a1ca['as'],'attributes':_0x52a1ca[_0x949e('0x1f')],'include':_0x52a1ca[_0x949e('0x21')]?_[_0x949e('0x22')](_0x52a1ca[_0x949e('0x21')],function(_0x461a8a){return{'model':db[_0x461a8a[_0x949e('0x23')]],'as':_0x461a8a['as'],'attributes':_0x461a8a[_0x949e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x949e('0xe')](function(_0x34db2a){logger[_0x949e('0xf')](_0x949e('0x24'),_0x5b88de);logger[_0x949e('0x12')](_0x949e('0x24'),_0x5b88de,JSON[_0x949e('0x14')](_0x34db2a));_0x1d9ce6(_0x34db2a);})[_0x949e('0x26')](function(_0x251414){logger['error'](_0x949e('0x24'),_0x251414['message'],_0x5b88de);_0xad8500(_0x2cb0c3[_0x949e('0x15')](0x1f4,_0x251414[_0x949e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 80b970c..afcc9a9 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 _0x4708=['register','length','./mailQueue.events','save','removeListener'];(function(_0x72c219,_0xb5b8e6){var _0xf3f820=function(_0x182292){while(--_0x182292){_0x72c219['push'](_0x72c219['shift']());}};_0xf3f820(++_0xb5b8e6);}(_0x4708,0xa7));var _0x8470=function(_0xc0f0ab,_0x40105a){_0xc0f0ab=_0xc0f0ab-0x0;var _0x5793e4=_0x4708[_0xc0f0ab];return _0x5793e4;};'use strict';var MailQueueEvents=require(_0x8470('0x0'));var events=[_0x8470('0x1'),'remove','update'];function createListener(_0x5232fd,_0x98d703){return function(_0x945cd0){_0x98d703['emit'](_0x5232fd,_0x945cd0);};}function removeListener(_0x29d013,_0x214e6c){return function(){MailQueueEvents[_0x8470('0x2')](_0x29d013,_0x214e6c);};}exports[_0x8470('0x3')]=function(_0x310710){for(var _0x45206e=0x0,_0x35934b=events[_0x8470('0x4')];_0x45206e<_0x35934b;_0x45206e++){var _0x29fa35=events[_0x45206e];var _0xe4f518=createListener('mailQueue:'+_0x29fa35,_0x310710);MailQueueEvents['on'](_0x29fa35,_0xe4f518);}}; \ No newline at end of file +var _0x6d0c=['emit','removeListener','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0xb0304e,_0x3866b7){var _0xbfa28a=function(_0x5e1e5e){while(--_0x5e1e5e){_0xb0304e['push'](_0xb0304e['shift']());}};_0xbfa28a(++_0x3866b7);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x1e98fc,_0x196cda){_0x1e98fc=_0x1e98fc-0x0;var _0x4c8041=_0x6d0c[_0x1e98fc];return _0x4c8041;};'use strict';var MailQueueEvents=require(_0xc6d0('0x0'));var events=[_0xc6d0('0x1'),_0xc6d0('0x2'),_0xc6d0('0x3')];function createListener(_0xc8bedb,_0x350d3a){return function(_0x487187){_0x350d3a[_0xc6d0('0x4')](_0xc8bedb,_0x487187);};}function removeListener(_0x5e2eb1,_0x5e5db2){return function(){MailQueueEvents[_0xc6d0('0x5')](_0x5e2eb1,_0x5e5db2);};}exports['register']=function(_0x589214){for(var _0xdae4c3=0x0,_0x40ba33=events[_0xc6d0('0x6')];_0xdae4c3<_0x40ba33;_0xdae4c3++){var _0x39e8be=events[_0xdae4c3];var _0xbd2213=createListener(_0xc6d0('0x7')+_0x39e8be,_0x589214);MailQueueEvents['on'](_0x39e8be,_0xbd2213);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 81233c3..80b39c8 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 _0x4222=['post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','/describe','isAuthenticated','/:id'];(function(_0x2b0163,_0x1cc981){var _0x2da9fb=function(_0x1b5b01){while(--_0x1b5b01){_0x2b0163['push'](_0x2b0163['shift']());}};_0x2da9fb(++_0x1cc981);}(_0x4222,0x1d2));var _0x2422=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x4222[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x2422('0x0'));var util=require(_0x2422('0x1'));var path=require(_0x2422('0x2'));var timeout=require('connect-timeout');var express=require(_0x2422('0x3'));var router=express[_0x2422('0x4')]();var fs_extra=require(_0x2422('0x5'));var auth=require(_0x2422('0x6'));var interaction=require(_0x2422('0x7'));var config=require(_0x2422('0x8'));var controller=require(_0x2422('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2422('0xa')](_0x2422('0xb'),auth[_0x2422('0xc')](),controller['describe']);router[_0x2422('0xa')](_0x2422('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x2422('0xe')]('/',auth[_0x2422('0xc')](),controller[_0x2422('0xf')]);router[_0x2422('0x10')]('/:id',auth[_0x2422('0xc')](),controller['update']);router[_0x2422('0x11')](_0x2422('0xd'),auth[_0x2422('0xc')](),controller[_0x2422('0x12')]);module[_0x2422('0x13')]=router; \ No newline at end of file +var _0xe0b6=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x5746a1,_0x11eab1){var _0x551a43=function(_0x7ddcbe){while(--_0x7ddcbe){_0x5746a1['push'](_0x5746a1['shift']());}};_0x551a43(++_0x11eab1);}(_0xe0b6,0x195));var _0x6e0b=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0xe0b6[_0x1db831];return _0x39ba56;};'use strict';var multer=require(_0x6e0b('0x0'));var util=require(_0x6e0b('0x1'));var path=require(_0x6e0b('0x2'));var timeout=require(_0x6e0b('0x3'));var express=require(_0x6e0b('0x4'));var router=express[_0x6e0b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6e0b('0x6'));var config=require('../../config/environment');var controller=require(_0x6e0b('0x7'));router[_0x6e0b('0x8')]('/',auth['isAuthenticated'](),controller[_0x6e0b('0x9')]);router[_0x6e0b('0x8')](_0x6e0b('0xa'),auth[_0x6e0b('0xb')](),controller[_0x6e0b('0xc')]);router[_0x6e0b('0x8')]('/:id',auth[_0x6e0b('0xb')](),controller['show']);router[_0x6e0b('0xd')]('/',auth[_0x6e0b('0xb')](),controller['create']);router[_0x6e0b('0xe')]('/:id',auth[_0x6e0b('0xb')](),controller[_0x6e0b('0xf')]);router[_0x6e0b('0x10')]('/:id',auth[_0x6e0b('0xb')](),controller[_0x6e0b('0x11')]);module[_0x6e0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 3a2d0b7..d15a2ec 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 _0xcab7=['DATE','moment','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcab7,0x163));var _0x7cab=function(_0x573c9e,_0xd4ab71){_0x573c9e=_0x573c9e-0x0;var _0x5d0714=_0xcab7[_0x573c9e];return _0x5d0714;};'use strict';var moment=require(_0x7cab('0x0'));var Sequelize=require(_0x7cab('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7cab('0x2')]},'leaveAt':{'type':Sequelize[_0x7cab('0x2')]},'acceptAt':{'type':Sequelize[_0x7cab('0x2')]},'exitAt':{'type':Sequelize[_0x7cab('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6ba5=['sequelize','STRING','DATE','moment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6ba5,0x1ef));var _0x56ba=function(_0x367dd3,_0xd1d1bf){_0x367dd3=_0x367dd3-0x0;var _0x5b7728=_0x6ba5[_0x367dd3];return _0x5b7728;};'use strict';var moment=require(_0x56ba('0x0'));var Sequelize=require(_0x56ba('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x56ba('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x56ba('0x3')]},'acceptAt':{'type':Sequelize[_0x56ba('0x3')]},'exitAt':{'type':Sequelize[_0x56ba('0x3')]},'reason':{'type':Sequelize[_0x56ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 6772b08..833fd53 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 _0x8e3f=['save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','merge','filter','options','MailQueueReport','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8e3f[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xf8e3('0x0'));var rimraf=require(_0xf8e3('0x1'));var zipdir=require(_0xf8e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8e3('0x3'));var moment=require(_0xf8e3('0x4'));var BPromise=require(_0xf8e3('0x5'));var Mustache=require('mustache');var util=require(_0xf8e3('0x6'));var path=require(_0xf8e3('0x7'));var sox=require('sox');var csv=require(_0xf8e3('0x8'));var ejs=require(_0xf8e3('0x9'));var fs=require('fs');var fs_extra=require(_0xf8e3('0xa'));var _=require(_0xf8e3('0xb'));var squel=require('squel');var crypto=require(_0xf8e3('0xc'));var jsforce=require(_0xf8e3('0xd'));var deskjs=require(_0xf8e3('0xe'));var toCsv=require(_0xf8e3('0x8'));var querystring=require(_0xf8e3('0xf'));var Papa=require(_0xf8e3('0x10'));var Redis=require(_0xf8e3('0x11'));var authService=require(_0xf8e3('0x12'));var qs=require(_0xf8e3('0x13'));var as=require(_0xf8e3('0x14'));var hardwareService=require(_0xf8e3('0x15'));var logger=require(_0xf8e3('0x16'))('api');var utils=require(_0xf8e3('0x17'));var config=require(_0xf8e3('0x18'));var licenseUtil=require(_0xf8e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ae02,_0x41f85e){_0x41f85e=_0x41f85e||0xcc;return function(_0x336790){if(_0x336790){return _0x40ae02[_0xf8e3('0x1a')](_0x41f85e);}return _0x40ae02['status'](_0x41f85e)[_0xf8e3('0x1b')]();};}function respondWithResult(_0xa856f5,_0x2fe631){_0x2fe631=_0x2fe631||0xc8;return function(_0x4af736){if(_0x4af736){return _0xa856f5[_0xf8e3('0x1c')](_0x2fe631)['json'](_0x4af736);}};}function respondWithFilteredResult(_0x1ec773,_0x40c196){return function(_0x460629){if(_0x460629){var _0x570ee3=typeof _0x40c196['offset']===_0xf8e3('0x1d')&&typeof _0x40c196[_0xf8e3('0x1e')]===_0xf8e3('0x1d');var _0x3b01ac=_0x460629[_0xf8e3('0x1f')];var _0x11d4cc=_0x570ee3?0x0:_0x40c196[_0xf8e3('0x20')];var _0x2e27e3=_0x570ee3?_0x460629[_0xf8e3('0x1f')]:_0x40c196[_0xf8e3('0x20')]+_0x40c196['limit'];var _0x20cc64;if(_0x2e27e3>=_0x3b01ac){_0x2e27e3=_0x3b01ac;_0x20cc64=0xc8;}else{_0x20cc64=0xce;}_0x1ec773[_0xf8e3('0x1c')](_0x20cc64);return _0x1ec773[_0xf8e3('0x21')](_0xf8e3('0x22'),_0x11d4cc+'-'+_0x2e27e3+'/'+_0x3b01ac)[_0xf8e3('0x23')](_0x460629);}return null;};}function patchUpdates(_0x11c58e){return function(_0x1cae53){try{jsonpatch[_0xf8e3('0x24')](_0x1cae53,_0x11c58e,!![]);}catch(_0x5b99b1){return BPromise[_0xf8e3('0x25')](_0x5b99b1);}return _0x1cae53[_0xf8e3('0x26')]();};}function saveUpdates(_0x3c636d,_0xccbcc0){return function(_0x4a1e5f){if(_0x4a1e5f){return _0x4a1e5f[_0xf8e3('0x27')](_0x3c636d)['then'](function(_0x286059){return _0x286059;});}return null;};}function removeEntity(_0x225a1b,_0x33d526){return function(_0x2dc856){if(_0x2dc856){return _0x2dc856[_0xf8e3('0x28')]()[_0xf8e3('0x29')](function(){_0x225a1b['status'](0xcc)[_0xf8e3('0x1b')]();});}};}function handleEntityNotFound(_0x2fc674,_0x3373ca){return function(_0x417b42){if(!_0x417b42){_0x2fc674[_0xf8e3('0x1a')](0x194);}return _0x417b42;};}function handleError(_0x3b41a1,_0x2963ed){_0x2963ed=_0x2963ed||0x1f4;return function(_0x157a2d){logger['error'](_0x157a2d[_0xf8e3('0x2a')]);if(_0x157a2d[_0xf8e3('0x2b')]){delete _0x157a2d[_0xf8e3('0x2b')];}_0x3b41a1[_0xf8e3('0x1c')](_0x2963ed)[_0xf8e3('0x2c')](_0x157a2d);};}exports[_0xf8e3('0x2d')]=function(_0x16485e,_0xfaf15d){var _0x4f2ae9={},_0x21e1c0={},_0x243e28={'count':0x0,'rows':[]};var _0x492694=_[_0xf8e3('0x2e')](db['MailQueueReport'][_0xf8e3('0x2f')],function(_0x10cf28){return{'name':_0x10cf28[_0xf8e3('0x30')],'type':_0x10cf28[_0xf8e3('0x31')][_0xf8e3('0x32')]};});_0x21e1c0[_0xf8e3('0x33')]=_[_0xf8e3('0x2e')](_0x492694,_0xf8e3('0x2b'));_0x21e1c0['query']=_[_0xf8e3('0x34')](_0x16485e[_0xf8e3('0x35')]);_0x21e1c0['filters']=_['intersection'](_0x21e1c0['model'],_0x21e1c0[_0xf8e3('0x35')]);_0x4f2ae9['attributes']=_[_0xf8e3('0x36')](_0x21e1c0[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x16485e[_0xf8e3('0x35')]['fields']));_0x4f2ae9['attributes']=_0x4f2ae9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0x4f2ae9[_0xf8e3('0x38')]:_0x21e1c0[_0xf8e3('0x33')];if(!_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x3a')]('nolimit')){_0x4f2ae9[_0xf8e3('0x1e')]=qs['limit'](_0x16485e['query'][_0xf8e3('0x1e')]);_0x4f2ae9[_0xf8e3('0x20')]=qs[_0xf8e3('0x20')](_0x16485e[_0xf8e3('0x35')]['offset']);}_0x4f2ae9['order']=qs[_0xf8e3('0x3b')](_0x16485e[_0xf8e3('0x35')]['sort']);_0x4f2ae9[_0xf8e3('0x3c')]=qs[_0xf8e3('0x3d')](_[_0xf8e3('0x3e')](_0x16485e[_0xf8e3('0x35')],_0x21e1c0['filters']),_0x492694);if(_0x16485e['query']['filter']){_0x4f2ae9[_0xf8e3('0x3c')]=_[_0xf8e3('0x3f')](_0x4f2ae9[_0xf8e3('0x3c')],{'$or':_[_0xf8e3('0x2e')](_0x492694,function(_0x53160a){if(_0x53160a[_0xf8e3('0x31')]!=='VIRTUAL'){var _0x20909b={};_0x20909b[_0x53160a[_0xf8e3('0x2b')]]={'$like':'%'+_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x40')]+'%'};return _0x20909b;}})});}_0x4f2ae9=_[_0xf8e3('0x3f')]({},_0x4f2ae9,_0x16485e[_0xf8e3('0x41')]);var _0x82e778={'where':_0x4f2ae9[_0xf8e3('0x3c')]};return db[_0xf8e3('0x42')]['count'](_0x82e778)[_0xf8e3('0x29')](function(_0x537089){_0x243e28[_0xf8e3('0x1f')]=_0x537089;if(_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x43')]){_0x4f2ae9[_0xf8e3('0x44')]=[{'all':!![]}];}return db[_0xf8e3('0x42')][_0xf8e3('0x45')](_0x4f2ae9);})[_0xf8e3('0x29')](function(_0x2f05b7){_0x243e28['rows']=_0x2f05b7;return _0x243e28;})[_0xf8e3('0x29')](respondWithFilteredResult(_0xfaf15d,_0x4f2ae9))[_0xf8e3('0x46')](handleError(_0xfaf15d,null));};exports[_0xf8e3('0x47')]=function(_0x382dbb,_0x6dd110){var _0xe7fcb9={'raw':!![],'where':{'id':_0x382dbb[_0xf8e3('0x48')]['id']}},_0x792190={};_0x792190['model']=_['keys'](db['MailQueueReport'][_0xf8e3('0x2f')]);_0x792190[_0xf8e3('0x35')]=_['keys'](_0x382dbb[_0xf8e3('0x35')]);_0x792190['filters']=_[_0xf8e3('0x36')](_0x792190[_0xf8e3('0x33')],_0x792190['query']);_0xe7fcb9[_0xf8e3('0x38')]=_['intersection'](_0x792190[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x382dbb['query'][_0xf8e3('0x37')]));_0xe7fcb9[_0xf8e3('0x38')]=_0xe7fcb9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0xe7fcb9['attributes']:_0x792190['model'];if(_0x382dbb['query'][_0xf8e3('0x43')]){_0xe7fcb9[_0xf8e3('0x44')]=[{'all':!![]}];}_0xe7fcb9=_[_0xf8e3('0x3f')]({},_0xe7fcb9,_0x382dbb['options']);return db[_0xf8e3('0x42')]['find'](_0xe7fcb9)[_0xf8e3('0x29')](handleEntityNotFound(_0x6dd110,null))[_0xf8e3('0x29')](respondWithResult(_0x6dd110,null))['catch'](handleError(_0x6dd110,null));};exports['create']=function(_0x128234,_0x2939e6){return db[_0xf8e3('0x42')][_0xf8e3('0x49')](_0x128234[_0xf8e3('0x4a')],{})[_0xf8e3('0x29')](respondWithResult(_0x2939e6,0xc9))[_0xf8e3('0x46')](handleError(_0x2939e6,null));};exports[_0xf8e3('0x27')]=function(_0xdc2430,_0x81898e){if(_0xdc2430[_0xf8e3('0x4a')]['id']){delete _0xdc2430['body']['id'];}return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0xdc2430[_0xf8e3('0x48')]['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x81898e,null))[_0xf8e3('0x29')](saveUpdates(_0xdc2430[_0xf8e3('0x4a')],null))['then'](respondWithResult(_0x81898e,null))[_0xf8e3('0x46')](handleError(_0x81898e,null));};exports[_0xf8e3('0x28')]=function(_0x39caae,_0x3e60a6){return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0x39caae['params']['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x3e60a6,null))[_0xf8e3('0x29')](removeEntity(_0x3e60a6,null))[_0xf8e3('0x46')](handleError(_0x3e60a6,null));};exports[_0xf8e3('0x4c')]=function(_0x113404,_0x2fef16){return db['MailQueueReport'][_0xf8e3('0x4c')]()[_0xf8e3('0x29')](respondWithResult(_0x2fef16,null))[_0xf8e3('0x46')](handleError(_0x2fef16,null));}; \ No newline at end of file +var _0x1893=['query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','map','VIRTUAL','filter','includeAll','include','catch','keys','merge','find','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','send','index','MailQueueReport','rawAttributes','type','key','model','name'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x1893,0xa2));var _0x3189=function(_0x599d7f,_0xc586e8){_0x599d7f=_0x599d7f-0x0;var _0x3346d3=_0x1893[_0x599d7f];return _0x3346d3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];function respondWithStatusCode(_0x5d9fff,_0x22b11e){_0x22b11e=_0x22b11e||0xcc;return function(_0x353b17){if(_0x353b17){return _0x5d9fff[_0x3189('0x19')](_0x22b11e);}return _0x5d9fff[_0x3189('0x1a')](_0x22b11e)[_0x3189('0x1b')]();};}function respondWithResult(_0x20dcc2,_0xef438){_0xef438=_0xef438||0xc8;return function(_0x25a917){if(_0x25a917){return _0x20dcc2['status'](_0xef438)[_0x3189('0x1c')](_0x25a917);}};}function respondWithFilteredResult(_0xb3e4c2,_0x1c209b){return function(_0x2fb62b){if(_0x2fb62b){var _0x486dd2=typeof _0x1c209b[_0x3189('0x1d')]==='undefined'&&typeof _0x1c209b['limit']===_0x3189('0x1e');var _0x49b1bc=_0x2fb62b[_0x3189('0x1f')];var _0xf8aed7=_0x486dd2?0x0:_0x1c209b[_0x3189('0x1d')];var _0x9905c4=_0x486dd2?_0x2fb62b['count']:_0x1c209b[_0x3189('0x1d')]+_0x1c209b[_0x3189('0x20')];var _0x16edd7;if(_0x9905c4>=_0x49b1bc){_0x9905c4=_0x49b1bc;_0x16edd7=0xc8;}else{_0x16edd7=0xce;}_0xb3e4c2['status'](_0x16edd7);return _0xb3e4c2[_0x3189('0x21')](_0x3189('0x22'),_0xf8aed7+'-'+_0x9905c4+'/'+_0x49b1bc)[_0x3189('0x1c')](_0x2fb62b);}return null;};}function patchUpdates(_0x2c1e59){return function(_0x29b275){try{jsonpatch['apply'](_0x29b275,_0x2c1e59,!![]);}catch(_0x1771a8){return BPromise[_0x3189('0x23')](_0x1771a8);}return _0x29b275[_0x3189('0x24')]();};}function saveUpdates(_0x539e12,_0x309c6e){return function(_0x47abb4){if(_0x47abb4){return _0x47abb4[_0x3189('0x25')](_0x539e12)[_0x3189('0x26')](function(_0x200f16){return _0x200f16;});}return null;};}function removeEntity(_0x38e56a,_0x1cbe33){return function(_0x393fcb){if(_0x393fcb){return _0x393fcb['destroy']()['then'](function(){_0x38e56a[_0x3189('0x1a')](0xcc)[_0x3189('0x1b')]();});}};}function handleEntityNotFound(_0x1dc1c8,_0x3cc1e5){return function(_0x103de4){if(!_0x103de4){_0x1dc1c8[_0x3189('0x19')](0x194);}return _0x103de4;};}function handleError(_0xdda38b,_0x379a48){_0x379a48=_0x379a48||0x1f4;return function(_0x17b540){logger[_0x3189('0x27')](_0x17b540['stack']);if(_0x17b540['name']){delete _0x17b540['name'];}_0xdda38b[_0x3189('0x1a')](_0x379a48)[_0x3189('0x28')](_0x17b540);};}exports[_0x3189('0x29')]=function(_0x90c31,_0x36b258){var _0x2f7504={},_0x4d453a={},_0x1ab94b={'count':0x0,'rows':[]};var _0x37b9ec=_['map'](db[_0x3189('0x2a')][_0x3189('0x2b')],function(_0x39c5e4){return{'name':_0x39c5e4['fieldName'],'type':_0x39c5e4[_0x3189('0x2c')][_0x3189('0x2d')]};});_0x4d453a[_0x3189('0x2e')]=_['map'](_0x37b9ec,_0x3189('0x2f'));_0x4d453a[_0x3189('0x30')]=_['keys'](_0x90c31[_0x3189('0x30')]);_0x4d453a[_0x3189('0x31')]=_[_0x3189('0x32')](_0x4d453a[_0x3189('0x2e')],_0x4d453a[_0x3189('0x30')]);_0x2f7504['attributes']=_['intersection'](_0x4d453a[_0x3189('0x2e')],qs['fields'](_0x90c31[_0x3189('0x30')][_0x3189('0x33')]));_0x2f7504[_0x3189('0x34')]=_0x2f7504[_0x3189('0x34')][_0x3189('0x35')]?_0x2f7504[_0x3189('0x34')]:_0x4d453a[_0x3189('0x2e')];if(!_0x90c31[_0x3189('0x30')][_0x3189('0x36')]('nolimit')){_0x2f7504[_0x3189('0x20')]=qs[_0x3189('0x20')](_0x90c31[_0x3189('0x30')][_0x3189('0x20')]);_0x2f7504[_0x3189('0x1d')]=qs[_0x3189('0x1d')](_0x90c31[_0x3189('0x30')]['offset']);}_0x2f7504['order']=qs[_0x3189('0x37')](_0x90c31['query'][_0x3189('0x37')]);_0x2f7504[_0x3189('0x38')]=qs['filters'](_[_0x3189('0x39')](_0x90c31[_0x3189('0x30')],_0x4d453a[_0x3189('0x31')]),_0x37b9ec);if(_0x90c31[_0x3189('0x30')]['filter']){_0x2f7504[_0x3189('0x38')]=_['merge'](_0x2f7504['where'],{'$or':_[_0x3189('0x3a')](_0x37b9ec,function(_0xed3041){if(_0xed3041[_0x3189('0x2c')]!==_0x3189('0x3b')){var _0x12dee0={};_0x12dee0[_0xed3041[_0x3189('0x2f')]]={'$like':'%'+_0x90c31[_0x3189('0x30')][_0x3189('0x3c')]+'%'};return _0x12dee0;}})});}_0x2f7504=_['merge']({},_0x2f7504,_0x90c31['options']);var _0x407e0a={'where':_0x2f7504[_0x3189('0x38')]};return db[_0x3189('0x2a')][_0x3189('0x1f')](_0x407e0a)[_0x3189('0x26')](function(_0xb52c70){_0x1ab94b['count']=_0xb52c70;if(_0x90c31[_0x3189('0x30')][_0x3189('0x3d')]){_0x2f7504[_0x3189('0x3e')]=[{'all':!![]}];}return db[_0x3189('0x2a')]['findAll'](_0x2f7504);})[_0x3189('0x26')](function(_0x2f0d49){_0x1ab94b['rows']=_0x2f0d49;return _0x1ab94b;})['then'](respondWithFilteredResult(_0x36b258,_0x2f7504))[_0x3189('0x3f')](handleError(_0x36b258,null));};exports['show']=function(_0x376787,_0x3074b9){var _0x38bf83={'raw':!![],'where':{'id':_0x376787['params']['id']}},_0x9593f3={};_0x9593f3[_0x3189('0x2e')]=_[_0x3189('0x40')](db['MailQueueReport'][_0x3189('0x2b')]);_0x9593f3[_0x3189('0x30')]=_[_0x3189('0x40')](_0x376787[_0x3189('0x30')]);_0x9593f3[_0x3189('0x31')]=_['intersection'](_0x9593f3['model'],_0x9593f3[_0x3189('0x30')]);_0x38bf83['attributes']=_[_0x3189('0x32')](_0x9593f3[_0x3189('0x2e')],qs[_0x3189('0x33')](_0x376787['query'][_0x3189('0x33')]));_0x38bf83[_0x3189('0x34')]=_0x38bf83[_0x3189('0x34')]['length']?_0x38bf83[_0x3189('0x34')]:_0x9593f3[_0x3189('0x2e')];if(_0x376787[_0x3189('0x30')][_0x3189('0x3d')]){_0x38bf83[_0x3189('0x3e')]=[{'all':!![]}];}_0x38bf83=_[_0x3189('0x41')]({},_0x38bf83,_0x376787['options']);return db['MailQueueReport'][_0x3189('0x42')](_0x38bf83)['then'](handleEntityNotFound(_0x3074b9,null))['then'](respondWithResult(_0x3074b9,null))[_0x3189('0x3f')](handleError(_0x3074b9,null));};exports['create']=function(_0x2d58fd,_0x1b6f09){return db[_0x3189('0x2a')]['create'](_0x2d58fd[_0x3189('0x43')],{})['then'](respondWithResult(_0x1b6f09,0xc9))[_0x3189('0x3f')](handleError(_0x1b6f09,null));};exports['update']=function(_0x49c4a8,_0x244166){if(_0x49c4a8['body']['id']){delete _0x49c4a8[_0x3189('0x43')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x49c4a8[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x244166,null))[_0x3189('0x26')](saveUpdates(_0x49c4a8[_0x3189('0x43')],null))[_0x3189('0x26')](respondWithResult(_0x244166,null))[_0x3189('0x3f')](handleError(_0x244166,null));};exports['destroy']=function(_0x21d446,_0x549bc7){return db['MailQueueReport'][_0x3189('0x42')]({'where':{'id':_0x21d446[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x549bc7,null))[_0x3189('0x26')](removeEntity(_0x549bc7,null))[_0x3189('0x3f')](handleError(_0x549bc7,null));};exports[_0x3189('0x45')]=function(_0x556ee5,_0x5117fb){return db['MailQueueReport'][_0x3189('0x45')]()[_0x3189('0x26')](respondWithResult(_0x5117fb,null))[_0x3189('0x3f')](handleError(_0x5117fb,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 6afd0c4..6b83bc1 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 _0xd386=['path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd386,0x10c));var _0x6d38=function(_0x200aa5,_0x197802){_0x200aa5=_0x200aa5-0x0;var _0x458200=_0xd386[_0x200aa5];return _0x458200;};'use strict';var _=require(_0x6d38('0x0'));var util=require(_0x6d38('0x1'));var logger=require(_0x6d38('0x2'))('api');var moment=require(_0x6d38('0x3'));var BPromise=require(_0x6d38('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d38('0x5'));var rimraf=require(_0x6d38('0x6'));var config=require(_0x6d38('0x7'));var attributes=require(_0x6d38('0x8'));module['exports']=function(_0x1a54fa,_0x25eef5){return _0x1a54fa[_0x6d38('0x9')](_0x6d38('0xa'),attributes,{'tableName':_0x6d38('0xb'),'paranoid':![],'indexes':[{'name':_0x6d38('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfbad=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbad,0x129));var _0xdfba=function(_0x468074,_0x334477){_0x468074=_0x468074-0x0;var _0x27a84d=_0xfbad[_0x468074];return _0x27a84d;};'use strict';var _=require(_0xdfba('0x0'));var util=require(_0xdfba('0x1'));var logger=require(_0xdfba('0x2'))(_0xdfba('0x3'));var moment=require(_0xdfba('0x4'));var BPromise=require(_0xdfba('0x5'));var rp=require(_0xdfba('0x6'));var fs=require('fs');var path=require(_0xdfba('0x7'));var rimraf=require(_0xdfba('0x8'));var config=require(_0xdfba('0x9'));var attributes=require(_0xdfba('0xa'));module[_0xdfba('0xb')]=function(_0x3ab62d,_0x51e9d8){return _0x3ab62d[_0xdfba('0xc')](_0xdfba('0xd'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xdfba('0xe'),'fields':[_0xdfba('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 319bb8b..8e74f76 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x112513,_0x2a7c77){var _0x528b2e=function(_0x2bbf15){while(--_0x2bbf15){_0x112513['push'](_0x112513['shift']());}};_0x528b2e(++_0x2a7c77);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _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(_0x32e94b,_0x38c7a7){var _0x3b1567=function(_0x282670){while(--_0x282670){_0x32e94b['push'](_0x32e94b['shift']());}};_0x3b1567(++_0x38c7a7);}(_0x2ef3,0xba));var _0x32ef=function(_0x1cce26,_0x205e20){_0x1cce26=_0x1cce26-0x0;var _0x4c0720=_0x2ef3[_0x1cce26];return _0x4c0720;};'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 f173a13..1c05f64 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x54e76c,_0x4dda43){var _0x37037f=function(_0x5e4952){while(--_0x5e4952){_0x54e76c['push'](_0x54e76c['shift']());}};_0x37037f(++_0x4dda43);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4f3e33,_0x5704a8){var _0x1a070c=function(_0x2a385a){while(--_0x2a385a){_0x4f3e33['push'](_0x4f3e33['shift']());}};_0x1a070c(++_0x5704a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 3607ce2..aed4696 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 _0x49c1=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0x2790ed,_0x2e6f9e){var _0x5a6850=function(_0x1afb8b){while(--_0x1afb8b){_0x2790ed['push'](_0x2790ed['shift']());}};_0x5a6850(++_0x2e6f9e);}(_0x49c1,0x154));var _0x149c=function(_0x53baf6,_0x18912e){_0x53baf6=_0x53baf6-0x0;var _0xf501d5=_0x49c1[_0x53baf6];return _0xf501d5;};'use strict';var Sequelize=require(_0x149c('0x0'));module[_0x149c('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x149c('0x2')]},'authentication':{'type':Sequelize[_0x149c('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x149c('0x2')]},'password':{'type':Sequelize[_0x149c('0x2')]},'port':{'type':Sequelize[_0x149c('0x4')]},'tls':{'type':Sequelize[_0x149c('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x149c('0x2')],'defaultValue':_0x149c('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x149c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd5f1=['sequelize','exports','BOOLEAN','STRING','INTEGER','INBOX'];(function(_0x37a1e6,_0x536b85){var _0x115a59=function(_0x4173a7){while(--_0x4173a7){_0x37a1e6['push'](_0x37a1e6['shift']());}};_0x115a59(++_0x536b85);}(_0xd5f1,0x126));var _0x1d5f=function(_0x466613,_0x56a7e3){_0x466613=_0x466613-0x0;var _0x13a954=_0xd5f1[_0x466613];return _0x13a954;};'use strict';var Sequelize=require(_0x1d5f('0x0'));module[_0x1d5f('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x1d5f('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1d5f('0x3')]},'port':{'type':Sequelize[_0x1d5f('0x4')]},'tls':{'type':Sequelize[_0x1d5f('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1d5f('0x3')],'defaultValue':_0x1d5f('0x5')},'connTimeout':{'type':Sequelize[_0x1d5f('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1d5f('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x1d5f('0x3')]},'modernAuthentication':{'type':Sequelize[_0x1d5f('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 3b5587b..e7cbfb5 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 _0x43f1=['./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3f5238,_0x39e5b6){var _0x115624=function(_0x57db3a){while(--_0x57db3a){_0x3f5238['push'](_0x3f5238['shift']());}};_0x115624(++_0x39e5b6);}(_0x43f1,0x7d));var _0x143f=function(_0x5cc3d4,_0xbcbf9b){_0x5cc3d4=_0x5cc3d4-0x0;var _0x17ca31=_0x43f1[_0x5cc3d4];return _0x17ca31;};'use strict';var _=require(_0x143f('0x0'));var util=require('util');var logger=require(_0x143f('0x1'))('api');var moment=require(_0x143f('0x2'));var BPromise=require(_0x143f('0x3'));var rp=require(_0x143f('0x4'));var fs=require('fs');var path=require(_0x143f('0x5'));var rimraf=require('rimraf');var config=require(_0x143f('0x6'));var attributes=require(_0x143f('0x7'));module[_0x143f('0x8')]=function(_0x49b470,_0x1bd608){return _0x49b470[_0x143f('0x9')](_0x143f('0xa'),attributes,{'tableName':_0x143f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7dc=['../../config/environment','./mailServerIn.attributes','mail_servers_in','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xd16df9,_0x18db96){var _0x141b04=function(_0x5f44ad){while(--_0x5f44ad){_0xd16df9['push'](_0xd16df9['shift']());}};_0x141b04(++_0x18db96);}(_0xb7dc,0x16e));var _0xcb7d=function(_0x43904a,_0xe0c75e){_0x43904a=_0x43904a-0x0;var _0xe4c56c=_0xb7dc[_0x43904a];return _0xe4c56c;};'use strict';var _=require(_0xcb7d('0x0'));var util=require(_0xcb7d('0x1'));var logger=require(_0xcb7d('0x2'))(_0xcb7d('0x3'));var moment=require(_0xcb7d('0x4'));var BPromise=require('bluebird');var rp=require(_0xcb7d('0x5'));var fs=require('fs');var path=require(_0xcb7d('0x6'));var rimraf=require(_0xcb7d('0x7'));var config=require(_0xcb7d('0x8'));var attributes=require(_0xcb7d('0x9'));module['exports']=function(_0x2b7a7f,_0x5d9990){return _0x2b7a7f['define']('MailServerIn',attributes,{'tableName':_0xcb7d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 324c039..0890bd1 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 _0xe735=['randomstring','ioredis','../../mysqldb','../../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','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','options','raw','attributes','limit','include','model','map','lodash','bluebird'];(function(_0x1aeb9e,_0x38e5de){var _0xad8e0a=function(_0x5a1721){while(--_0x5a1721){_0x1aeb9e['push'](_0x1aeb9e['shift']());}};_0xad8e0a(++_0x38e5de);}(_0xe735,0xc4));var _0x5e73=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0xe735[_0x4af01e];return _0x178c11;};'use strict';var _=require(_0x5e73('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5e73('0x1'));var rs=require(_0x5e73('0x2'));var fs=require('fs');var Redis=require(_0x5e73('0x3'));var db=require(_0x5e73('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e73('0x5'))(_0x5e73('0x6'));var config=require(_0x5e73('0x7'));var jayson=require(_0x5e73('0x8'));var client=jayson[_0x5e73('0x9')][_0x5e73('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17e271,_0x3d7356,_0xeeb8ac){return new BPromise(function(_0x4bc989,_0x11856d){return client[_0x5e73('0xb')](_0x17e271,_0xeeb8ac)[_0x5e73('0xc')](function(_0x465402){logger[_0x5e73('0xd')](_0x5e73('0xe'),_0x3d7356,_0x5e73('0xf'));logger[_0x5e73('0x10')](_0x5e73('0x11'),_0x3d7356,_0x5e73('0xf'),JSON[_0x5e73('0x12')](_0x465402));if(_0x465402[_0x5e73('0x13')]){if(_0x465402['error'][_0x5e73('0x14')]===0x1f4){logger[_0x5e73('0x13')](_0x5e73('0xe'),_0x3d7356,_0x465402['error'][_0x5e73('0x15')]);return _0x11856d(_0x465402[_0x5e73('0x13')][_0x5e73('0x15')]);}logger[_0x5e73('0x13')]('MailServerIn,\x20%s,\x20%s',_0x3d7356,_0x465402['error']['message']);return _0x4bc989(_0x465402[_0x5e73('0x13')][_0x5e73('0x15')]);}else{logger[_0x5e73('0xd')](_0x5e73('0xe'),_0x3d7356,'request\x20sent');_0x4bc989(_0x465402[_0x5e73('0x16')][_0x5e73('0x15')]);}})[_0x5e73('0x17')](function(_0x2f204c){logger[_0x5e73('0x13')]('MailServerIn,\x20%s,\x20%s',_0x3d7356,_0x2f204c);_0x11856d(_0x2f204c);});});}exports[_0x5e73('0x18')]=function(_0x5128a0){var _0x3ffbf8=this;return new Promise(function(_0x4e72ba,_0x4d1e7e){return db[_0x5e73('0x19')]['findAll']({'raw':_0x5128a0[_0x5e73('0x1a')]?_0x5128a0[_0x5e73('0x1a')][_0x5e73('0x1b')]===undefined?!![]:![]:!![],'where':_0x5128a0['options']?_0x5128a0['options']['where']||null:null,'attributes':_0x5128a0['options']?_0x5128a0[_0x5e73('0x1a')][_0x5e73('0x1c')]||null:null,'limit':_0x5128a0[_0x5e73('0x1a')]?_0x5128a0['options'][_0x5e73('0x1d')]||null:null,'include':_0x5128a0[_0x5e73('0x1a')]?_0x5128a0[_0x5e73('0x1a')][_0x5e73('0x1e')]?_['map'](_0x5128a0[_0x5e73('0x1a')][_0x5e73('0x1e')],function(_0x35f7dd){return{'model':db[_0x35f7dd[_0x5e73('0x1f')]],'as':_0x35f7dd['as'],'attributes':_0x35f7dd['attributes'],'include':_0x35f7dd[_0x5e73('0x1e')]?_[_0x5e73('0x20')](_0x35f7dd['include'],function(_0x402deb){return{'model':db[_0x402deb['model']],'as':_0x402deb['as'],'attributes':_0x402deb[_0x5e73('0x1c')],'include':_0x402deb[_0x5e73('0x1e')]?_[_0x5e73('0x20')](_0x402deb[_0x5e73('0x1e')],function(_0x41633b){return{'model':db[_0x41633b[_0x5e73('0x1f')]],'as':_0x41633b['as'],'attributes':_0x41633b['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e73('0xc')](function(_0x4efa01){logger[_0x5e73('0xd')]('GetMailServerIn',_0x5128a0);logger[_0x5e73('0x10')]('GetMailServerIn',_0x5128a0,JSON[_0x5e73('0x12')](_0x4efa01));_0x4e72ba(_0x4efa01);})[_0x5e73('0x17')](function(_0x45a988){logger[_0x5e73('0x13')](_0x5e73('0x18'),_0x45a988['message'],_0x5128a0);_0x4d1e7e(_0x3ffbf8[_0x5e73('0x13')](0x1f4,_0x45a988['message']));});});}; \ No newline at end of file +var _0x9f9f=['include','map','model','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit'];(function(_0xf2267d,_0x10c87c){var _0x207e0d=function(_0x12b23d){while(--_0x12b23d){_0xf2267d['push'](_0xf2267d['shift']());}};_0x207e0d(++_0x10c87c);}(_0x9f9f,0x100));var _0xf9f9=function(_0xe6682e,_0x1288c5){_0xe6682e=_0xe6682e-0x0;var _0x2e9645=_0x9f9f[_0xe6682e];return _0x2e9645;};'use strict';var _=require(_0xf9f9('0x0'));var util=require(_0xf9f9('0x1'));var moment=require('moment');var BPromise=require(_0xf9f9('0x2'));var rs=require(_0xf9f9('0x3'));var fs=require('fs');var Redis=require(_0xf9f9('0x4'));var db=require(_0xf9f9('0x5'))['db'];var utils=require(_0xf9f9('0x6'));var logger=require(_0xf9f9('0x7'))(_0xf9f9('0x8'));var config=require(_0xf9f9('0x9'));var jayson=require(_0xf9f9('0xa'));var client=jayson['client'][_0xf9f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13ac68,_0x55c8cd,_0x1c3a9f){return new BPromise(function(_0x196a0a,_0x2f2a98){return client[_0xf9f9('0xc')](_0x13ac68,_0x1c3a9f)['then'](function(_0x3684d8){logger[_0xf9f9('0xd')](_0xf9f9('0xe'),_0x55c8cd,_0xf9f9('0xf'));logger[_0xf9f9('0x10')](_0xf9f9('0x11'),_0x55c8cd,'request\x20sent',JSON[_0xf9f9('0x12')](_0x3684d8));if(_0x3684d8['error']){if(_0x3684d8[_0xf9f9('0x13')][_0xf9f9('0x14')]===0x1f4){logger[_0xf9f9('0x13')]('MailServerIn,\x20%s,\x20%s',_0x55c8cd,_0x3684d8[_0xf9f9('0x13')]['message']);return _0x2f2a98(_0x3684d8[_0xf9f9('0x13')]['message']);}logger[_0xf9f9('0x13')](_0xf9f9('0xe'),_0x55c8cd,_0x3684d8[_0xf9f9('0x13')][_0xf9f9('0x15')]);return _0x196a0a(_0x3684d8[_0xf9f9('0x13')]['message']);}else{logger['info'](_0xf9f9('0xe'),_0x55c8cd,_0xf9f9('0xf'));_0x196a0a(_0x3684d8[_0xf9f9('0x16')][_0xf9f9('0x15')]);}})[_0xf9f9('0x17')](function(_0x5b4c21){logger['error'](_0xf9f9('0xe'),_0x55c8cd,_0x5b4c21);_0x2f2a98(_0x5b4c21);});});}exports[_0xf9f9('0x18')]=function(_0x40f305){var _0x2550c8=this;return new Promise(function(_0xd0a3d,_0xbd0d03){return db[_0xf9f9('0x19')][_0xf9f9('0x1a')]({'raw':_0x40f305[_0xf9f9('0x1b')]?_0x40f305['options'][_0xf9f9('0x1c')]===undefined?!![]:![]:!![],'where':_0x40f305['options']?_0x40f305['options'][_0xf9f9('0x1d')]||null:null,'attributes':_0x40f305[_0xf9f9('0x1b')]?_0x40f305[_0xf9f9('0x1b')][_0xf9f9('0x1e')]||null:null,'limit':_0x40f305['options']?_0x40f305['options'][_0xf9f9('0x1f')]||null:null,'include':_0x40f305[_0xf9f9('0x1b')]?_0x40f305[_0xf9f9('0x1b')][_0xf9f9('0x20')]?_[_0xf9f9('0x21')](_0x40f305[_0xf9f9('0x1b')][_0xf9f9('0x20')],function(_0x5be6d5){return{'model':db[_0x5be6d5[_0xf9f9('0x22')]],'as':_0x5be6d5['as'],'attributes':_0x5be6d5[_0xf9f9('0x1e')],'include':_0x5be6d5[_0xf9f9('0x20')]?_[_0xf9f9('0x21')](_0x5be6d5[_0xf9f9('0x20')],function(_0x2946b6){return{'model':db[_0x2946b6[_0xf9f9('0x22')]],'as':_0x2946b6['as'],'attributes':_0x2946b6[_0xf9f9('0x1e')],'include':_0x2946b6[_0xf9f9('0x20')]?_[_0xf9f9('0x21')](_0x2946b6[_0xf9f9('0x20')],function(_0x2d3ba7){return{'model':db[_0x2d3ba7['model']],'as':_0x2d3ba7['as'],'attributes':_0x2d3ba7['attributes']};}):[]};}):[]};}):[]:[]})[_0xf9f9('0x23')](function(_0x564f02){logger[_0xf9f9('0xd')](_0xf9f9('0x18'),_0x40f305);logger['debug']('GetMailServerIn',_0x40f305,JSON[_0xf9f9('0x12')](_0x564f02));_0xd0a3d(_0x564f02);})[_0xf9f9('0x17')](function(_0x4ce389){logger['error'](_0xf9f9('0x18'),_0x4ce389[_0xf9f9('0x15')],_0x40f305);_0xbd0d03(_0x2550c8['error'](0x1f4,_0x4ce389[_0xf9f9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index bb2bcda..1b451b7 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 9f22415..c9d0de9 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 _0xb58b=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x525abe,_0x2f2fde){var _0x58e5ce=function(_0x42e2c9){while(--_0x42e2c9){_0x525abe['push'](_0x525abe['shift']());}};_0x58e5ce(++_0x2f2fde);}(_0xb58b,0x1f1));var _0xbb58=function(_0x44f3db,_0x3075c2){_0x44f3db=_0x44f3db-0x0;var _0x38e91f=_0xb58b[_0x44f3db];return _0x38e91f;};'use strict';var Sequelize=require('sequelize');module[_0xbb58('0x0')]={'description':{'type':Sequelize[_0xbb58('0x1')]},'host':{'type':Sequelize[_0xbb58('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xbb58('0x1')]},'port':{'type':Sequelize[_0xbb58('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xbb58('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xbb58('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd4f4=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x26fe38,_0x29f0ca){var _0x32ae97=function(_0x2f64a4){while(--_0x2f64a4){_0x26fe38['push'](_0x26fe38['shift']());}};_0x32ae97(++_0x29f0ca);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x24fd3f,_0x2e8ec6){_0x24fd3f=_0x24fd3f-0x0;var _0xdc28a0=_0xd4f4[_0x24fd3f];return _0xdc28a0;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'description':{'type':Sequelize[_0x4d4f('0x2')]},'host':{'type':Sequelize[_0x4d4f('0x2')]},'user':{'type':Sequelize[_0x4d4f('0x2')]},'pass':{'type':Sequelize[_0x4d4f('0x2')]},'port':{'type':Sequelize[_0x4d4f('0x3')]},'secure':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x4d4f('0x2')]},'authentication':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 78ec031..d1e7b2c 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 _0xee19=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','body','find','eml-format','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status'];(function(_0x57911f,_0x1baf91){var _0x3061cb=function(_0x44f643){while(--_0x44f643){_0x57911f['push'](_0x57911f['shift']());}};_0x3061cb(++_0x1baf91);}(_0xee19,0x110));var _0x9ee1=function(_0x4fa0ff,_0x3bfabe){_0x4fa0ff=_0x4fa0ff-0x0;var _0xf76b8e=_0xee19[_0x4fa0ff];return _0xf76b8e;};'use strict';var emlformat=require(_0x9ee1('0x0'));var rimraf=require(_0x9ee1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ee1('0x2'));var rp=require(_0x9ee1('0x3'));var moment=require(_0x9ee1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9ee1('0x5'));var util=require(_0x9ee1('0x6'));var path=require(_0x9ee1('0x7'));var sox=require('sox');var csv=require(_0x9ee1('0x8'));var ejs=require(_0x9ee1('0x9'));var fs=require('fs');var fs_extra=require(_0x9ee1('0xa'));var _=require(_0x9ee1('0xb'));var squel=require(_0x9ee1('0xc'));var crypto=require(_0x9ee1('0xd'));var jsforce=require(_0x9ee1('0xe'));var deskjs=require(_0x9ee1('0xf'));var toCsv=require(_0x9ee1('0x8'));var querystring=require(_0x9ee1('0x10'));var Papa=require(_0x9ee1('0x11'));var Redis=require(_0x9ee1('0x12'));var authService=require(_0x9ee1('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ee1('0x14'));var logger=require(_0x9ee1('0x15'))(_0x9ee1('0x16'));var utils=require(_0x9ee1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9ee1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cbf87,_0x5c03fa){_0x5c03fa=_0x5c03fa||0xcc;return function(_0x231d62){if(_0x231d62){return _0x1cbf87[_0x9ee1('0x19')](_0x5c03fa);}return _0x1cbf87['status'](_0x5c03fa)[_0x9ee1('0x1a')]();};}function respondWithResult(_0x492fc0,_0x5f11de){_0x5f11de=_0x5f11de||0xc8;return function(_0x1bba18){if(_0x1bba18){return _0x492fc0[_0x9ee1('0x1b')](_0x5f11de)['json'](_0x1bba18);}};}function respondWithFilteredResult(_0x424b70,_0x359c9f){return function(_0x45981f){if(_0x45981f){var _0x5db215=typeof _0x359c9f[_0x9ee1('0x1c')]===_0x9ee1('0x1d')&&typeof _0x359c9f[_0x9ee1('0x1e')]===_0x9ee1('0x1d');var _0x3da34e=_0x45981f[_0x9ee1('0x1f')];var _0x421b5a=_0x5db215?0x0:_0x359c9f['offset'];var _0x55bdb3=_0x5db215?_0x45981f['count']:_0x359c9f[_0x9ee1('0x1c')]+_0x359c9f[_0x9ee1('0x1e')];var _0x71008a;if(_0x55bdb3>=_0x3da34e){_0x55bdb3=_0x3da34e;_0x71008a=0xc8;}else{_0x71008a=0xce;}_0x424b70['status'](_0x71008a);return _0x424b70[_0x9ee1('0x20')](_0x9ee1('0x21'),_0x421b5a+'-'+_0x55bdb3+'/'+_0x3da34e)[_0x9ee1('0x22')](_0x45981f);}return null;};}function patchUpdates(_0xf89683){return function(_0x52a744){try{jsonpatch[_0x9ee1('0x23')](_0x52a744,_0xf89683,!![]);}catch(_0x5b54f2){return BPromise[_0x9ee1('0x24')](_0x5b54f2);}return _0x52a744['save']();};}function saveUpdates(_0x42fe53,_0xba2cda){return function(_0x2d4490){if(_0x2d4490){return _0x2d4490[_0x9ee1('0x25')](_0x42fe53)[_0x9ee1('0x26')](function(_0x28cccf){return _0x28cccf;});}return null;};}function removeEntity(_0x33d9bb,_0xf3f3b3){return function(_0x5ecb85){if(_0x5ecb85){return _0x5ecb85[_0x9ee1('0x27')]()[_0x9ee1('0x26')](function(){_0x33d9bb[_0x9ee1('0x1b')](0xcc)[_0x9ee1('0x1a')]();});}};}function handleEntityNotFound(_0x5d5f16,_0x3f227c){return function(_0x5775e8){if(!_0x5775e8){_0x5d5f16[_0x9ee1('0x19')](0x194);}return _0x5775e8;};}function handleError(_0x39b437,_0x3f7146){_0x3f7146=_0x3f7146||0x1f4;return function(_0x74b3d7){logger[_0x9ee1('0x28')](_0x74b3d7[_0x9ee1('0x29')]);if(_0x74b3d7[_0x9ee1('0x2a')]){delete _0x74b3d7[_0x9ee1('0x2a')];}_0x39b437[_0x9ee1('0x1b')](_0x3f7146)[_0x9ee1('0x2b')](_0x74b3d7);};}exports[_0x9ee1('0x2c')]=function(_0x184db3,_0x162b5d){var _0x4b9b26={},_0x14405a={},_0x2aa0bb={'count':0x0,'rows':[]};var _0x1ced56=_[_0x9ee1('0x2d')](db[_0x9ee1('0x2e')][_0x9ee1('0x2f')],function(_0x3a7955){return{'name':_0x3a7955[_0x9ee1('0x30')],'type':_0x3a7955[_0x9ee1('0x31')]['key']};});_0x14405a[_0x9ee1('0x32')]=_[_0x9ee1('0x2d')](_0x1ced56,_0x9ee1('0x2a'));_0x14405a[_0x9ee1('0x33')]=_[_0x9ee1('0x34')](_0x184db3[_0x9ee1('0x33')]);_0x14405a['filters']=_[_0x9ee1('0x35')](_0x14405a[_0x9ee1('0x32')],_0x14405a[_0x9ee1('0x33')]);_0x4b9b26[_0x9ee1('0x36')]=_[_0x9ee1('0x35')](_0x14405a[_0x9ee1('0x32')],qs[_0x9ee1('0x37')](_0x184db3[_0x9ee1('0x33')][_0x9ee1('0x37')]));_0x4b9b26['attributes']=_0x4b9b26[_0x9ee1('0x36')][_0x9ee1('0x38')]?_0x4b9b26['attributes']:_0x14405a[_0x9ee1('0x32')];if(!_0x184db3[_0x9ee1('0x33')][_0x9ee1('0x39')](_0x9ee1('0x3a'))){_0x4b9b26['limit']=qs[_0x9ee1('0x1e')](_0x184db3[_0x9ee1('0x33')][_0x9ee1('0x1e')]);_0x4b9b26[_0x9ee1('0x1c')]=qs['offset'](_0x184db3[_0x9ee1('0x33')][_0x9ee1('0x1c')]);}_0x4b9b26[_0x9ee1('0x3b')]=qs[_0x9ee1('0x3c')](_0x184db3['query'][_0x9ee1('0x3c')]);_0x4b9b26['where']=qs[_0x9ee1('0x3d')](_['pick'](_0x184db3[_0x9ee1('0x33')],_0x14405a['filters']),_0x1ced56);if(_0x184db3[_0x9ee1('0x33')][_0x9ee1('0x3e')]){_0x4b9b26['where']=_[_0x9ee1('0x3f')](_0x4b9b26['where'],{'$or':_[_0x9ee1('0x2d')](_0x1ced56,function(_0x288426){if(_0x288426['type']!==_0x9ee1('0x40')){var _0x1441b8={};_0x1441b8[_0x288426['name']]={'$like':'%'+_0x184db3[_0x9ee1('0x33')][_0x9ee1('0x3e')]+'%'};return _0x1441b8;}})});}_0x4b9b26=_['merge']({},_0x4b9b26,_0x184db3[_0x9ee1('0x41')]);var _0x23b61d={'where':_0x4b9b26['where']};return db[_0x9ee1('0x2e')]['count'](_0x23b61d)[_0x9ee1('0x26')](function(_0x1a581b){_0x2aa0bb[_0x9ee1('0x1f')]=_0x1a581b;if(_0x184db3[_0x9ee1('0x33')][_0x9ee1('0x42')]){_0x4b9b26['include']=[{'all':!![]}];}return db[_0x9ee1('0x2e')][_0x9ee1('0x43')](_0x4b9b26);})[_0x9ee1('0x26')](function(_0x39bdbc){_0x2aa0bb[_0x9ee1('0x44')]=_0x39bdbc;return _0x2aa0bb;})[_0x9ee1('0x26')](respondWithFilteredResult(_0x162b5d,_0x4b9b26))[_0x9ee1('0x45')](handleError(_0x162b5d,null));};exports[_0x9ee1('0x46')]=function(_0xa244ed,_0xcf8382){var _0x268390={'raw':!![],'where':{'id':_0xa244ed[_0x9ee1('0x47')]['id']}},_0x48bf28={};_0x48bf28[_0x9ee1('0x32')]=_['keys'](db[_0x9ee1('0x2e')][_0x9ee1('0x2f')]);_0x48bf28[_0x9ee1('0x33')]=_['keys'](_0xa244ed[_0x9ee1('0x33')]);_0x48bf28[_0x9ee1('0x3d')]=_['intersection'](_0x48bf28[_0x9ee1('0x32')],_0x48bf28['query']);_0x268390['attributes']=_['intersection'](_0x48bf28[_0x9ee1('0x32')],qs[_0x9ee1('0x37')](_0xa244ed[_0x9ee1('0x33')][_0x9ee1('0x37')]));_0x268390['attributes']=_0x268390[_0x9ee1('0x36')]['length']?_0x268390[_0x9ee1('0x36')]:_0x48bf28['model'];if(_0xa244ed[_0x9ee1('0x33')][_0x9ee1('0x42')]){_0x268390[_0x9ee1('0x48')]=[{'all':!![]}];}_0x268390=_['merge']({},_0x268390,_0xa244ed[_0x9ee1('0x41')]);return db[_0x9ee1('0x2e')]['find'](_0x268390)[_0x9ee1('0x26')](handleEntityNotFound(_0xcf8382,null))[_0x9ee1('0x26')](respondWithResult(_0xcf8382,null))[_0x9ee1('0x45')](handleError(_0xcf8382,null));};exports['create']=function(_0x1eea56,_0x239e82){return db['MailServerOut']['create'](_0x1eea56['body'],{})[_0x9ee1('0x26')](respondWithResult(_0x239e82,0xc9))[_0x9ee1('0x45')](handleError(_0x239e82,null));};exports[_0x9ee1('0x25')]=function(_0x60c66,_0x1be276){if(_0x60c66[_0x9ee1('0x49')]['id']){delete _0x60c66['body']['id'];}return db[_0x9ee1('0x2e')][_0x9ee1('0x4a')]({'where':{'id':_0x60c66[_0x9ee1('0x47')]['id']}})[_0x9ee1('0x26')](handleEntityNotFound(_0x1be276,null))[_0x9ee1('0x26')](saveUpdates(_0x60c66[_0x9ee1('0x49')],null))[_0x9ee1('0x26')](respondWithResult(_0x1be276,null))[_0x9ee1('0x45')](handleError(_0x1be276,null));};exports[_0x9ee1('0x27')]=function(_0x5c3856,_0x56bc09){return db['MailServerOut'][_0x9ee1('0x4a')]({'where':{'id':_0x5c3856[_0x9ee1('0x47')]['id']}})['then'](handleEntityNotFound(_0x56bc09,null))['then'](removeEntity(_0x56bc09,null))[_0x9ee1('0x45')](handleError(_0x56bc09,null));}; \ No newline at end of file +var _0x47a9=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','filters','intersection','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4e7245,_0x5f132e){var _0x2a3c85=function(_0x5634bb){while(--_0x5634bb){_0x4e7245['push'](_0x4e7245['shift']());}};_0x2a3c85(++_0x5f132e);}(_0x47a9,0xd6));var _0x947a=function(_0x45f974,_0x5be881){_0x45f974=_0x45f974-0x0;var _0x53a4c1=_0x47a9[_0x45f974];return _0x53a4c1;};'use strict';var emlformat=require(_0x947a('0x0'));var rimraf=require(_0x947a('0x1'));var zipdir=require(_0x947a('0x2'));var jsonpatch=require(_0x947a('0x3'));var rp=require(_0x947a('0x4'));var moment=require(_0x947a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x947a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x947a('0x7'));var csv=require(_0x947a('0x8'));var ejs=require(_0x947a('0x9'));var fs=require('fs');var fs_extra=require(_0x947a('0xa'));var _=require('lodash');var squel=require(_0x947a('0xb'));var crypto=require(_0x947a('0xc'));var jsforce=require(_0x947a('0xd'));var deskjs=require(_0x947a('0xe'));var toCsv=require(_0x947a('0x8'));var querystring=require(_0x947a('0xf'));var Papa=require(_0x947a('0x10'));var Redis=require('ioredis');var authService=require(_0x947a('0x11'));var qs=require(_0x947a('0x12'));var as=require(_0x947a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x947a('0x14'))(_0x947a('0x15'));var utils=require(_0x947a('0x16'));var config=require(_0x947a('0x17'));var licenseUtil=require(_0x947a('0x18'));var db=require(_0x947a('0x19'))['db'];function respondWithStatusCode(_0x447584,_0x8d707e){_0x8d707e=_0x8d707e||0xcc;return function(_0x42c61b){if(_0x42c61b){return _0x447584['sendStatus'](_0x8d707e);}return _0x447584['status'](_0x8d707e)[_0x947a('0x1a')]();};}function respondWithResult(_0x4139b1,_0x27cf37){_0x27cf37=_0x27cf37||0xc8;return function(_0x4b8d5d){if(_0x4b8d5d){return _0x4139b1['status'](_0x27cf37)[_0x947a('0x1b')](_0x4b8d5d);}};}function respondWithFilteredResult(_0x45d913,_0x1b06ec){return function(_0x2d8d59){if(_0x2d8d59){var _0x150531=typeof _0x1b06ec[_0x947a('0x1c')]===_0x947a('0x1d')&&typeof _0x1b06ec[_0x947a('0x1e')]===_0x947a('0x1d');var _0x44b765=_0x2d8d59[_0x947a('0x1f')];var _0x383e02=_0x150531?0x0:_0x1b06ec[_0x947a('0x1c')];var _0x57fe8a=_0x150531?_0x2d8d59[_0x947a('0x1f')]:_0x1b06ec[_0x947a('0x1c')]+_0x1b06ec[_0x947a('0x1e')];var _0x50e757;if(_0x57fe8a>=_0x44b765){_0x57fe8a=_0x44b765;_0x50e757=0xc8;}else{_0x50e757=0xce;}_0x45d913[_0x947a('0x20')](_0x50e757);return _0x45d913[_0x947a('0x21')](_0x947a('0x22'),_0x383e02+'-'+_0x57fe8a+'/'+_0x44b765)[_0x947a('0x1b')](_0x2d8d59);}return null;};}function patchUpdates(_0x51667c){return function(_0x138d87){try{jsonpatch[_0x947a('0x23')](_0x138d87,_0x51667c,!![]);}catch(_0x1b5a6c){return BPromise[_0x947a('0x24')](_0x1b5a6c);}return _0x138d87[_0x947a('0x25')]();};}function saveUpdates(_0x37ab6e,_0x3ab6a9){return function(_0x4b0fba){if(_0x4b0fba){return _0x4b0fba[_0x947a('0x26')](_0x37ab6e)[_0x947a('0x27')](function(_0xfe75ef){return _0xfe75ef;});}return null;};}function removeEntity(_0x66e444,_0x4a530d){return function(_0x4a1793){if(_0x4a1793){return _0x4a1793[_0x947a('0x28')]()[_0x947a('0x27')](function(){_0x66e444[_0x947a('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37ce6a,_0x114021){return function(_0x1304b1){if(!_0x1304b1){_0x37ce6a['sendStatus'](0x194);}return _0x1304b1;};}function handleError(_0x429071,_0x49790a){_0x49790a=_0x49790a||0x1f4;return function(_0x26d121){logger[_0x947a('0x29')](_0x26d121[_0x947a('0x2a')]);if(_0x26d121[_0x947a('0x2b')]){delete _0x26d121[_0x947a('0x2b')];}_0x429071[_0x947a('0x20')](_0x49790a)[_0x947a('0x2c')](_0x26d121);};}exports[_0x947a('0x2d')]=function(_0x7d1274,_0x2f931b){var _0x4ddfc1={},_0x175965={},_0x231b4f={'count':0x0,'rows':[]};var _0x520b90=_['map'](db[_0x947a('0x2e')][_0x947a('0x2f')],function(_0xb4f86f){return{'name':_0xb4f86f[_0x947a('0x30')],'type':_0xb4f86f[_0x947a('0x31')][_0x947a('0x32')]};});_0x175965[_0x947a('0x33')]=_['map'](_0x520b90,_0x947a('0x2b'));_0x175965['query']=_[_0x947a('0x34')](_0x7d1274[_0x947a('0x35')]);_0x175965['filters']=_['intersection'](_0x175965[_0x947a('0x33')],_0x175965[_0x947a('0x35')]);_0x4ddfc1[_0x947a('0x36')]=_['intersection'](_0x175965['model'],qs[_0x947a('0x37')](_0x7d1274[_0x947a('0x35')][_0x947a('0x37')]));_0x4ddfc1[_0x947a('0x36')]=_0x4ddfc1[_0x947a('0x36')][_0x947a('0x38')]?_0x4ddfc1[_0x947a('0x36')]:_0x175965[_0x947a('0x33')];if(!_0x7d1274[_0x947a('0x35')][_0x947a('0x39')](_0x947a('0x3a'))){_0x4ddfc1[_0x947a('0x1e')]=qs[_0x947a('0x1e')](_0x7d1274[_0x947a('0x35')][_0x947a('0x1e')]);_0x4ddfc1['offset']=qs[_0x947a('0x1c')](_0x7d1274['query']['offset']);}_0x4ddfc1['order']=qs[_0x947a('0x3b')](_0x7d1274['query'][_0x947a('0x3b')]);_0x4ddfc1[_0x947a('0x3c')]=qs['filters'](_[_0x947a('0x3d')](_0x7d1274[_0x947a('0x35')],_0x175965['filters']),_0x520b90);if(_0x7d1274[_0x947a('0x35')][_0x947a('0x3e')]){_0x4ddfc1['where']=_[_0x947a('0x3f')](_0x4ddfc1['where'],{'$or':_['map'](_0x520b90,function(_0x4b7619){if(_0x4b7619['type']!==_0x947a('0x40')){var _0x1c5292={};_0x1c5292[_0x4b7619[_0x947a('0x2b')]]={'$like':'%'+_0x7d1274[_0x947a('0x35')][_0x947a('0x3e')]+'%'};return _0x1c5292;}})});}_0x4ddfc1=_[_0x947a('0x3f')]({},_0x4ddfc1,_0x7d1274[_0x947a('0x41')]);var _0x2ca126={'where':_0x4ddfc1['where']};return db[_0x947a('0x2e')][_0x947a('0x1f')](_0x2ca126)[_0x947a('0x27')](function(_0x595b78){_0x231b4f[_0x947a('0x1f')]=_0x595b78;if(_0x7d1274[_0x947a('0x35')][_0x947a('0x42')]){_0x4ddfc1['include']=[{'all':!![]}];}return db['MailServerOut'][_0x947a('0x43')](_0x4ddfc1);})[_0x947a('0x27')](function(_0x385276){_0x231b4f['rows']=_0x385276;return _0x231b4f;})['then'](respondWithFilteredResult(_0x2f931b,_0x4ddfc1))[_0x947a('0x44')](handleError(_0x2f931b,null));};exports[_0x947a('0x45')]=function(_0x5edec8,_0x50e685){var _0x34f7f7={'raw':!![],'where':{'id':_0x5edec8['params']['id']}},_0x2e677e={};_0x2e677e[_0x947a('0x33')]=_[_0x947a('0x34')](db[_0x947a('0x2e')][_0x947a('0x2f')]);_0x2e677e[_0x947a('0x35')]=_[_0x947a('0x34')](_0x5edec8[_0x947a('0x35')]);_0x2e677e[_0x947a('0x46')]=_[_0x947a('0x47')](_0x2e677e[_0x947a('0x33')],_0x2e677e[_0x947a('0x35')]);_0x34f7f7['attributes']=_[_0x947a('0x47')](_0x2e677e[_0x947a('0x33')],qs[_0x947a('0x37')](_0x5edec8[_0x947a('0x35')][_0x947a('0x37')]));_0x34f7f7[_0x947a('0x36')]=_0x34f7f7[_0x947a('0x36')][_0x947a('0x38')]?_0x34f7f7['attributes']:_0x2e677e[_0x947a('0x33')];if(_0x5edec8[_0x947a('0x35')][_0x947a('0x42')]){_0x34f7f7[_0x947a('0x48')]=[{'all':!![]}];}_0x34f7f7=_[_0x947a('0x3f')]({},_0x34f7f7,_0x5edec8[_0x947a('0x41')]);return db[_0x947a('0x2e')][_0x947a('0x49')](_0x34f7f7)[_0x947a('0x27')](handleEntityNotFound(_0x50e685,null))[_0x947a('0x27')](respondWithResult(_0x50e685,null))[_0x947a('0x44')](handleError(_0x50e685,null));};exports[_0x947a('0x4a')]=function(_0x5b4312,_0x2f7fb3){return db[_0x947a('0x2e')][_0x947a('0x4a')](_0x5b4312[_0x947a('0x4b')],{})['then'](respondWithResult(_0x2f7fb3,0xc9))['catch'](handleError(_0x2f7fb3,null));};exports[_0x947a('0x26')]=function(_0xfbc20c,_0xd3f188){if(_0xfbc20c[_0x947a('0x4b')]['id']){delete _0xfbc20c[_0x947a('0x4b')]['id'];}return db[_0x947a('0x2e')]['find']({'where':{'id':_0xfbc20c[_0x947a('0x4c')]['id']}})[_0x947a('0x27')](handleEntityNotFound(_0xd3f188,null))[_0x947a('0x27')](saveUpdates(_0xfbc20c[_0x947a('0x4b')],null))[_0x947a('0x27')](respondWithResult(_0xd3f188,null))[_0x947a('0x44')](handleError(_0xd3f188,null));};exports[_0x947a('0x28')]=function(_0xf2925f,_0x4de322){return db[_0x947a('0x2e')]['find']({'where':{'id':_0xf2925f[_0x947a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4de322,null))[_0x947a('0x27')](removeEntity(_0x4de322,null))[_0x947a('0x44')](handleError(_0x4de322,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4ab0d8c..60eae74 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 _0x8959=['mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./mailServerOut.attributes','MailServerOut'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8959,0x1d7));var _0x9895=function(_0x13342f,_0x3d6303){_0x13342f=_0x13342f-0x0;var _0x2fc1fc=_0x8959[_0x13342f];return _0x2fc1fc;};'use strict';var _=require(_0x9895('0x0'));var util=require(_0x9895('0x1'));var logger=require(_0x9895('0x2'))(_0x9895('0x3'));var moment=require(_0x9895('0x4'));var BPromise=require(_0x9895('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9895('0x6'));var config=require('../../config/environment');var attributes=require(_0x9895('0x7'));module['exports']=function(_0x49e26f,_0x5dc7c5){return _0x49e26f['define'](_0x9895('0x8'),attributes,{'tableName':_0x9895('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb313=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','define','MailServerOut','lodash','util','api'];(function(_0x2a2955,_0x32d0f1){var _0x2a37f6=function(_0x170cc0){while(--_0x170cc0){_0x2a2955['push'](_0x2a2955['shift']());}};_0x2a37f6(++_0x32d0f1);}(_0xb313,0x81));var _0x3b31=function(_0x4166fe,_0x313c65){_0x4166fe=_0x4166fe-0x0;var _0x14d5bd=_0xb313[_0x4166fe];return _0x14d5bd;};'use strict';var _=require(_0x3b31('0x0'));var util=require(_0x3b31('0x1'));var logger=require('../../config/logger')(_0x3b31('0x2'));var moment=require(_0x3b31('0x3'));var BPromise=require(_0x3b31('0x4'));var rp=require(_0x3b31('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b31('0x6'));var config=require(_0x3b31('0x7'));var attributes=require(_0x3b31('0x8'));module['exports']=function(_0x3dfcbd,_0x12a2b4){return _0x3dfcbd[_0x3b31('0x9')](_0x3b31('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 2f3dd1c..7c84e6e 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x14ddd4,_0x5b527d){var _0x421616=function(_0x4f0a42){while(--_0x4f0a42){_0x14ddd4['push'](_0x14ddd4['shift']());}};_0x421616(++_0x5b527d);}(_0xadb5,0xad));var _0x5adb=function(_0xe96b4d,_0xe557a8){_0xe96b4d=_0xe96b4d-0x0;var _0x1c8dc0=_0xadb5[_0xe96b4d];return _0x1c8dc0;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1f75f6,_0x3654e1){var _0x5c06c1=function(_0x21b3ba){while(--_0x21b3ba){_0x1f75f6['push'](_0x1f75f6['shift']());}};_0x5c06c1(++_0x3654e1);}(_0xadb5,0xad));var _0x5adb=function(_0x144b5f,_0x22a325){_0x144b5f=_0x144b5f-0x0;var _0x54c743=_0xadb5[_0x144b5f];return _0x54c743;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index b55714b..b982a89 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 _0xe048=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','get','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x37597b,_0x46e807){var _0x1b10a4=function(_0x3c2f82){while(--_0x3c2f82){_0x37597b['push'](_0x37597b['shift']());}};_0x1b10a4(++_0x46e807);}(_0xe048,0x68));var _0x8e04=function(_0x41d515,_0x4bda68){_0x41d515=_0x41d515-0x0;var _0x45b796=_0xe048[_0x41d515];return _0x45b796;};'use strict';var multer=require(_0x8e04('0x0'));var util=require(_0x8e04('0x1'));var path=require(_0x8e04('0x2'));var timeout=require(_0x8e04('0x3'));var express=require('express');var router=express[_0x8e04('0x4')]();var fs_extra=require(_0x8e04('0x5'));var auth=require(_0x8e04('0x6'));var interaction=require(_0x8e04('0x7'));var config=require(_0x8e04('0x8'));var controller=require(_0x8e04('0x9'));router['get']('/',auth[_0x8e04('0xa')](),controller['index']);router[_0x8e04('0xb')](_0x8e04('0xc'),auth[_0x8e04('0xa')](),controller['describe']);router[_0x8e04('0xb')](_0x8e04('0xd'),auth[_0x8e04('0xa')](),controller[_0x8e04('0xe')]);router[_0x8e04('0xf')]('/',auth[_0x8e04('0xa')](),controller[_0x8e04('0x10')]);router[_0x8e04('0x11')](_0x8e04('0xd'),auth[_0x8e04('0xa')](),controller[_0x8e04('0x12')]);router[_0x8e04('0x13')](_0x8e04('0xd'),auth[_0x8e04('0xa')](),controller[_0x8e04('0x14')]);module[_0x8e04('0x15')]=router; \ No newline at end of file +var _0x75a6=['show','create','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x160c95,_0x46b199){var _0x4c0a61=function(_0x4ba6b0){while(--_0x4ba6b0){_0x160c95['push'](_0x160c95['shift']());}};_0x4c0a61(++_0x46b199);}(_0x75a6,0x136));var _0x675a=function(_0x26e167,_0x3ef126){_0x26e167=_0x26e167-0x0;var _0x4c0e9c=_0x75a6[_0x26e167];return _0x4c0e9c;};'use strict';var multer=require(_0x675a('0x0'));var util=require(_0x675a('0x1'));var path=require(_0x675a('0x2'));var timeout=require(_0x675a('0x3'));var express=require(_0x675a('0x4'));var router=express[_0x675a('0x5')]();var fs_extra=require(_0x675a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x675a('0x7'));var config=require(_0x675a('0x8'));var controller=require('./mailSubstatus.controller');router[_0x675a('0x9')]('/',auth[_0x675a('0xa')](),controller[_0x675a('0xb')]);router[_0x675a('0x9')]('/describe',auth[_0x675a('0xa')](),controller[_0x675a('0xc')]);router['get'](_0x675a('0xd'),auth['isAuthenticated'](),controller[_0x675a('0xe')]);router['post']('/',auth[_0x675a('0xa')](),controller[_0x675a('0xf')]);router['put'](_0x675a('0xd'),auth[_0x675a('0xa')](),controller[_0x675a('0x10')]);router[_0x675a('0x11')](_0x675a('0xd'),auth[_0x675a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 06469b2..77904bd 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 _0x0af5=['STRING','name','exports'];(function(_0x3b4922,_0x2fa365){var _0x239729=function(_0x82fd7){while(--_0x82fd7){_0x3b4922['push'](_0x3b4922['shift']());}};_0x239729(++_0x2fa365);}(_0x0af5,0x158));var _0x50af=function(_0x73be99,_0x5bc606){_0x73be99=_0x73be99-0x0;var _0x15f44d=_0x0af5[_0x73be99];return _0x15f44d;};'use strict';var Sequelize=require('sequelize');module[_0x50af('0x0')]={'name':{'type':Sequelize[_0x50af('0x1')],'unique':_0x50af('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x50af('0x1')]}}; \ No newline at end of file +var _0xe714=['name','sequelize','STRING'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xe714,0xe2));var _0x4e71=function(_0x598fd7,_0x5f514d){_0x598fd7=_0x598fd7-0x0;var _0x344439=_0xe714[_0x598fd7];return _0x344439;};'use strict';var Sequelize=require(_0x4e71('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e71('0x1')],'unique':_0x4e71('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4e71('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d6b4bd8..f0966ca 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 _0x067d=['describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','index','map','MailSubstatus','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','where','merge','filter','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','update'];(function(_0x2912f0,_0x208e8d){var _0x33b9ca=function(_0x422756){while(--_0x422756){_0x2912f0['push'](_0x2912f0['shift']());}};_0x33b9ca(++_0x208e8d);}(_0x067d,0x8d));var _0xd067=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0x067d[_0x57cb4f];return _0x29bb45;};'use strict';var emlformat=require(_0xd067('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd067('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd067('0x2'));var moment=require(_0xd067('0x3'));var BPromise=require(_0xd067('0x4'));var Mustache=require(_0xd067('0x5'));var util=require(_0xd067('0x6'));var path=require(_0xd067('0x7'));var sox=require(_0xd067('0x8'));var csv=require('to-csv');var ejs=require(_0xd067('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd067('0xa'));var squel=require(_0xd067('0xb'));var crypto=require(_0xd067('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd067('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd067('0xe'));var Redis=require(_0xd067('0xf'));var authService=require(_0xd067('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd067('0x11'));var logger=require('../../config/logger')(_0xd067('0x12'));var utils=require(_0xd067('0x13'));var config=require(_0xd067('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd067('0x15'))['db'];function respondWithStatusCode(_0x27b1e5,_0x3db8de){_0x3db8de=_0x3db8de||0xcc;return function(_0x310543){if(_0x310543){return _0x27b1e5[_0xd067('0x16')](_0x3db8de);}return _0x27b1e5[_0xd067('0x17')](_0x3db8de)['end']();};}function respondWithResult(_0x2c6ce6,_0x4ce515){_0x4ce515=_0x4ce515||0xc8;return function(_0x302fb4){if(_0x302fb4){return _0x2c6ce6[_0xd067('0x17')](_0x4ce515)[_0xd067('0x18')](_0x302fb4);}};}function respondWithFilteredResult(_0x1c18be,_0x596a75){return function(_0x257899){if(_0x257899){var _0xd8800d=typeof _0x596a75[_0xd067('0x19')]===_0xd067('0x1a')&&typeof _0x596a75[_0xd067('0x1b')]===_0xd067('0x1a');var _0x41af79=_0x257899[_0xd067('0x1c')];var _0x35c7f0=_0xd8800d?0x0:_0x596a75[_0xd067('0x19')];var _0x422e99=_0xd8800d?_0x257899[_0xd067('0x1c')]:_0x596a75[_0xd067('0x19')]+_0x596a75[_0xd067('0x1b')];var _0x665c1b;if(_0x422e99>=_0x41af79){_0x422e99=_0x41af79;_0x665c1b=0xc8;}else{_0x665c1b=0xce;}_0x1c18be[_0xd067('0x17')](_0x665c1b);return _0x1c18be[_0xd067('0x1d')](_0xd067('0x1e'),_0x35c7f0+'-'+_0x422e99+'/'+_0x41af79)[_0xd067('0x18')](_0x257899);}return null;};}function patchUpdates(_0x4c0c7d){return function(_0x31c491){try{jsonpatch[_0xd067('0x1f')](_0x31c491,_0x4c0c7d,!![]);}catch(_0x157a4b){return BPromise['reject'](_0x157a4b);}return _0x31c491[_0xd067('0x20')]();};}function saveUpdates(_0x2429d3,_0x4b8db6){return function(_0x47005b){if(_0x47005b){return _0x47005b['update'](_0x2429d3)[_0xd067('0x21')](function(_0x5f1a22){return _0x5f1a22;});}return null;};}function removeEntity(_0x2d869b,_0x27b652){return function(_0x4605ff){if(_0x4605ff){return _0x4605ff[_0xd067('0x22')]()[_0xd067('0x21')](function(){_0x2d869b[_0xd067('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x277573,_0x47fe59){return function(_0x3e95c1){if(!_0x3e95c1){_0x277573['sendStatus'](0x194);}return _0x3e95c1;};}function handleError(_0x1fb617,_0x4974b6){_0x4974b6=_0x4974b6||0x1f4;return function(_0x231481){logger['error'](_0x231481[_0xd067('0x23')]);if(_0x231481['name']){delete _0x231481[_0xd067('0x24')];}_0x1fb617[_0xd067('0x17')](_0x4974b6)['send'](_0x231481);};}exports[_0xd067('0x25')]=function(_0x1d89a2,_0xb593ec){var _0x4e9a5c={},_0x4e53ce={},_0x5d5817={'count':0x0,'rows':[]};var _0x286900=_[_0xd067('0x26')](db[_0xd067('0x27')]['rawAttributes'],function(_0x3f5f05){return{'name':_0x3f5f05['fieldName'],'type':_0x3f5f05[_0xd067('0x28')][_0xd067('0x29')]};});_0x4e53ce[_0xd067('0x2a')]=_[_0xd067('0x26')](_0x286900,'name');_0x4e53ce[_0xd067('0x2b')]=_['keys'](_0x1d89a2[_0xd067('0x2b')]);_0x4e53ce['filters']=_[_0xd067('0x2c')](_0x4e53ce[_0xd067('0x2a')],_0x4e53ce['query']);_0x4e9a5c['attributes']=_[_0xd067('0x2c')](_0x4e53ce['model'],qs[_0xd067('0x2d')](_0x1d89a2[_0xd067('0x2b')][_0xd067('0x2d')]));_0x4e9a5c['attributes']=_0x4e9a5c[_0xd067('0x2e')][_0xd067('0x2f')]?_0x4e9a5c[_0xd067('0x2e')]:_0x4e53ce['model'];if(!_0x1d89a2[_0xd067('0x2b')][_0xd067('0x30')]('nolimit')){_0x4e9a5c[_0xd067('0x1b')]=qs['limit'](_0x1d89a2[_0xd067('0x2b')][_0xd067('0x1b')]);_0x4e9a5c[_0xd067('0x19')]=qs[_0xd067('0x19')](_0x1d89a2[_0xd067('0x2b')][_0xd067('0x19')]);}_0x4e9a5c['order']=qs['sort'](_0x1d89a2[_0xd067('0x2b')][_0xd067('0x31')]);_0x4e9a5c['where']=qs[_0xd067('0x32')](_[_0xd067('0x33')](_0x1d89a2[_0xd067('0x2b')],_0x4e53ce['filters']),_0x286900);if(_0x1d89a2['query']['filter']){_0x4e9a5c[_0xd067('0x34')]=_[_0xd067('0x35')](_0x4e9a5c[_0xd067('0x34')],{'$or':_[_0xd067('0x26')](_0x286900,function(_0xb85433){if(_0xb85433[_0xd067('0x28')]!=='VIRTUAL'){var _0x4fccc3={};_0x4fccc3[_0xb85433[_0xd067('0x24')]]={'$like':'%'+_0x1d89a2[_0xd067('0x2b')][_0xd067('0x36')]+'%'};return _0x4fccc3;}})});}_0x4e9a5c=_[_0xd067('0x35')]({},_0x4e9a5c,_0x1d89a2[_0xd067('0x37')]);var _0x48c098={'where':_0x4e9a5c[_0xd067('0x34')]};return db['MailSubstatus'][_0xd067('0x1c')](_0x48c098)[_0xd067('0x21')](function(_0x1b2ba1){_0x5d5817[_0xd067('0x1c')]=_0x1b2ba1;if(_0x1d89a2[_0xd067('0x2b')][_0xd067('0x38')]){_0x4e9a5c['include']=[{'all':!![]}];}return db[_0xd067('0x27')][_0xd067('0x39')](_0x4e9a5c);})[_0xd067('0x21')](function(_0x332616){_0x5d5817[_0xd067('0x3a')]=_0x332616;return _0x5d5817;})[_0xd067('0x21')](respondWithFilteredResult(_0xb593ec,_0x4e9a5c))[_0xd067('0x3b')](handleError(_0xb593ec,null));};exports[_0xd067('0x3c')]=function(_0x55ca63,_0xa610bc){var _0x484d46={'raw':!![],'where':{'id':_0x55ca63[_0xd067('0x3d')]['id']}},_0xbb0e26={};_0xbb0e26[_0xd067('0x2a')]=_[_0xd067('0x3e')](db['MailSubstatus'][_0xd067('0x3f')]);_0xbb0e26[_0xd067('0x2b')]=_['keys'](_0x55ca63[_0xd067('0x2b')]);_0xbb0e26[_0xd067('0x32')]=_[_0xd067('0x2c')](_0xbb0e26[_0xd067('0x2a')],_0xbb0e26[_0xd067('0x2b')]);_0x484d46['attributes']=_[_0xd067('0x2c')](_0xbb0e26[_0xd067('0x2a')],qs[_0xd067('0x2d')](_0x55ca63[_0xd067('0x2b')]['fields']));_0x484d46[_0xd067('0x2e')]=_0x484d46[_0xd067('0x2e')][_0xd067('0x2f')]?_0x484d46[_0xd067('0x2e')]:_0xbb0e26[_0xd067('0x2a')];if(_0x55ca63[_0xd067('0x2b')]['includeAll']){_0x484d46[_0xd067('0x40')]=[{'all':!![]}];}_0x484d46=_['merge']({},_0x484d46,_0x55ca63[_0xd067('0x37')]);return db['MailSubstatus'][_0xd067('0x41')](_0x484d46)['then'](handleEntityNotFound(_0xa610bc,null))['then'](respondWithResult(_0xa610bc,null))['catch'](handleError(_0xa610bc,null));};exports[_0xd067('0x42')]=function(_0x2eef72,_0x52b2d0){return db['MailSubstatus'][_0xd067('0x42')](_0x2eef72[_0xd067('0x43')],{})[_0xd067('0x21')](respondWithResult(_0x52b2d0,0xc9))['catch'](handleError(_0x52b2d0,null));};exports[_0xd067('0x44')]=function(_0x5ffbd6,_0x4629af){if(_0x5ffbd6[_0xd067('0x43')]['id']){delete _0x5ffbd6[_0xd067('0x43')]['id'];}return db[_0xd067('0x27')][_0xd067('0x41')]({'where':{'id':_0x5ffbd6[_0xd067('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4629af,null))[_0xd067('0x21')](saveUpdates(_0x5ffbd6[_0xd067('0x43')],null))[_0xd067('0x21')](respondWithResult(_0x4629af,null))[_0xd067('0x3b')](handleError(_0x4629af,null));};exports[_0xd067('0x22')]=function(_0x1ec7d8,_0x9d930c){return db[_0xd067('0x27')][_0xd067('0x41')]({'where':{'id':_0x1ec7d8[_0xd067('0x3d')]['id']}})[_0xd067('0x21')](handleEntityNotFound(_0x9d930c,null))[_0xd067('0x21')](removeEntity(_0x9d930c,null))[_0xd067('0x3b')](handleError(_0x9d930c,null));};exports[_0xd067('0x45')]=function(_0x2f2435,_0x2a16aa){return db['MailSubstatus'][_0xd067('0x45')]()['then'](respondWithResult(_0x2a16aa,null))['catch'](handleError(_0x2a16aa,null));}; \ No newline at end of file +var _0xe6f6=['offset','undefined','limit','count','set','Content-Range','reject','save','then','end','sendStatus','stack','name','send','index','map','MailSubstatus','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','options','includeAll','rows','catch','show','params','rawAttributes','include','create','update','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','status','json'];(function(_0x1551af,_0x5223c3){var _0xd8eb82=function(_0x4b133a){while(--_0x4b133a){_0x1551af['push'](_0x1551af['shift']());}};_0xd8eb82(++_0x5223c3);}(_0xe6f6,0x76));var _0x6e6f=function(_0x5a15bf,_0x1eedec){_0x5a15bf=_0x5a15bf-0x0;var _0x5bc508=_0xe6f6[_0x5a15bf];return _0x5bc508;};'use strict';var emlformat=require(_0x6e6f('0x0'));var rimraf=require(_0x6e6f('0x1'));var zipdir=require(_0x6e6f('0x2'));var jsonpatch=require(_0x6e6f('0x3'));var rp=require(_0x6e6f('0x4'));var moment=require(_0x6e6f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6e6f('0x6'));var util=require('util');var path=require(_0x6e6f('0x7'));var sox=require(_0x6e6f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e6f('0x9'));var _=require(_0x6e6f('0xa'));var squel=require(_0x6e6f('0xb'));var crypto=require('crypto');var jsforce=require(_0x6e6f('0xc'));var deskjs=require(_0x6e6f('0xd'));var toCsv=require(_0x6e6f('0xe'));var querystring=require(_0x6e6f('0xf'));var Papa=require('papaparse');var Redis=require(_0x6e6f('0x10'));var authService=require(_0x6e6f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e6f('0x12'));var logger=require('../../config/logger')(_0x6e6f('0x13'));var utils=require(_0x6e6f('0x14'));var config=require(_0x6e6f('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x433f0d,_0x42074b){_0x42074b=_0x42074b||0xcc;return function(_0x5c0090){if(_0x5c0090){return _0x433f0d['sendStatus'](_0x42074b);}return _0x433f0d[_0x6e6f('0x16')](_0x42074b)['end']();};}function respondWithResult(_0x37a69b,_0x2c653c){_0x2c653c=_0x2c653c||0xc8;return function(_0x1dc29b){if(_0x1dc29b){return _0x37a69b['status'](_0x2c653c)[_0x6e6f('0x17')](_0x1dc29b);}};}function respondWithFilteredResult(_0xe7eeba,_0x139ffb){return function(_0x575f9e){if(_0x575f9e){var _0x528b61=typeof _0x139ffb[_0x6e6f('0x18')]===_0x6e6f('0x19')&&typeof _0x139ffb[_0x6e6f('0x1a')]===_0x6e6f('0x19');var _0x4062dc=_0x575f9e['count'];var _0xb1f5de=_0x528b61?0x0:_0x139ffb[_0x6e6f('0x18')];var _0x3fa4b8=_0x528b61?_0x575f9e[_0x6e6f('0x1b')]:_0x139ffb['offset']+_0x139ffb[_0x6e6f('0x1a')];var _0x773b29;if(_0x3fa4b8>=_0x4062dc){_0x3fa4b8=_0x4062dc;_0x773b29=0xc8;}else{_0x773b29=0xce;}_0xe7eeba[_0x6e6f('0x16')](_0x773b29);return _0xe7eeba[_0x6e6f('0x1c')](_0x6e6f('0x1d'),_0xb1f5de+'-'+_0x3fa4b8+'/'+_0x4062dc)['json'](_0x575f9e);}return null;};}function patchUpdates(_0x8123d0){return function(_0x818005){try{jsonpatch['apply'](_0x818005,_0x8123d0,!![]);}catch(_0xd91750){return BPromise[_0x6e6f('0x1e')](_0xd91750);}return _0x818005[_0x6e6f('0x1f')]();};}function saveUpdates(_0x196fbd,_0x26bd5a){return function(_0x380693){if(_0x380693){return _0x380693['update'](_0x196fbd)[_0x6e6f('0x20')](function(_0x39fc5e){return _0x39fc5e;});}return null;};}function removeEntity(_0x483d6c,_0x44fa5d){return function(_0x1bbdff){if(_0x1bbdff){return _0x1bbdff['destroy']()['then'](function(){_0x483d6c[_0x6e6f('0x16')](0xcc)[_0x6e6f('0x21')]();});}};}function handleEntityNotFound(_0x5e3a94,_0x4ff495){return function(_0x3d520a){if(!_0x3d520a){_0x5e3a94[_0x6e6f('0x22')](0x194);}return _0x3d520a;};}function handleError(_0x45d6be,_0x18c4d4){_0x18c4d4=_0x18c4d4||0x1f4;return function(_0x1a582e){logger['error'](_0x1a582e[_0x6e6f('0x23')]);if(_0x1a582e[_0x6e6f('0x24')]){delete _0x1a582e[_0x6e6f('0x24')];}_0x45d6be[_0x6e6f('0x16')](_0x18c4d4)[_0x6e6f('0x25')](_0x1a582e);};}exports[_0x6e6f('0x26')]=function(_0x464f05,_0x3271c2){var _0x2527a5={},_0x419c6d={},_0x1028b3={'count':0x0,'rows':[]};var _0x1c9757=_[_0x6e6f('0x27')](db[_0x6e6f('0x28')]['rawAttributes'],function(_0x2f3689){return{'name':_0x2f3689[_0x6e6f('0x29')],'type':_0x2f3689[_0x6e6f('0x2a')]['key']};});_0x419c6d[_0x6e6f('0x2b')]=_['map'](_0x1c9757,_0x6e6f('0x24'));_0x419c6d[_0x6e6f('0x2c')]=_[_0x6e6f('0x2d')](_0x464f05[_0x6e6f('0x2c')]);_0x419c6d[_0x6e6f('0x2e')]=_[_0x6e6f('0x2f')](_0x419c6d['model'],_0x419c6d[_0x6e6f('0x2c')]);_0x2527a5['attributes']=_[_0x6e6f('0x2f')](_0x419c6d[_0x6e6f('0x2b')],qs[_0x6e6f('0x30')](_0x464f05['query'][_0x6e6f('0x30')]));_0x2527a5[_0x6e6f('0x31')]=_0x2527a5[_0x6e6f('0x31')][_0x6e6f('0x32')]?_0x2527a5[_0x6e6f('0x31')]:_0x419c6d[_0x6e6f('0x2b')];if(!_0x464f05['query']['hasOwnProperty'](_0x6e6f('0x33'))){_0x2527a5['limit']=qs[_0x6e6f('0x1a')](_0x464f05[_0x6e6f('0x2c')][_0x6e6f('0x1a')]);_0x2527a5[_0x6e6f('0x18')]=qs['offset'](_0x464f05[_0x6e6f('0x2c')][_0x6e6f('0x18')]);}_0x2527a5[_0x6e6f('0x34')]=qs[_0x6e6f('0x35')](_0x464f05[_0x6e6f('0x2c')]['sort']);_0x2527a5[_0x6e6f('0x36')]=qs[_0x6e6f('0x2e')](_[_0x6e6f('0x37')](_0x464f05[_0x6e6f('0x2c')],_0x419c6d['filters']),_0x1c9757);if(_0x464f05[_0x6e6f('0x2c')]['filter']){_0x2527a5[_0x6e6f('0x36')]=_[_0x6e6f('0x38')](_0x2527a5['where'],{'$or':_[_0x6e6f('0x27')](_0x1c9757,function(_0x21ea2d){if(_0x21ea2d[_0x6e6f('0x2a')]!=='VIRTUAL'){var _0x1e60ba={};_0x1e60ba[_0x21ea2d[_0x6e6f('0x24')]]={'$like':'%'+_0x464f05[_0x6e6f('0x2c')]['filter']+'%'};return _0x1e60ba;}})});}_0x2527a5=_['merge']({},_0x2527a5,_0x464f05[_0x6e6f('0x39')]);var _0x24cada={'where':_0x2527a5[_0x6e6f('0x36')]};return db['MailSubstatus']['count'](_0x24cada)[_0x6e6f('0x20')](function(_0x340b1e){_0x1028b3[_0x6e6f('0x1b')]=_0x340b1e;if(_0x464f05[_0x6e6f('0x2c')][_0x6e6f('0x3a')]){_0x2527a5['include']=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x2527a5);})[_0x6e6f('0x20')](function(_0x1187ab){_0x1028b3[_0x6e6f('0x3b')]=_0x1187ab;return _0x1028b3;})['then'](respondWithFilteredResult(_0x3271c2,_0x2527a5))[_0x6e6f('0x3c')](handleError(_0x3271c2,null));};exports[_0x6e6f('0x3d')]=function(_0x25d2d2,_0x27f637){var _0xd81791={'raw':!![],'where':{'id':_0x25d2d2[_0x6e6f('0x3e')]['id']}},_0x117813={};_0x117813['model']=_[_0x6e6f('0x2d')](db[_0x6e6f('0x28')][_0x6e6f('0x3f')]);_0x117813['query']=_[_0x6e6f('0x2d')](_0x25d2d2[_0x6e6f('0x2c')]);_0x117813[_0x6e6f('0x2e')]=_[_0x6e6f('0x2f')](_0x117813['model'],_0x117813[_0x6e6f('0x2c')]);_0xd81791['attributes']=_['intersection'](_0x117813['model'],qs['fields'](_0x25d2d2[_0x6e6f('0x2c')]['fields']));_0xd81791[_0x6e6f('0x31')]=_0xd81791['attributes'][_0x6e6f('0x32')]?_0xd81791['attributes']:_0x117813['model'];if(_0x25d2d2[_0x6e6f('0x2c')][_0x6e6f('0x3a')]){_0xd81791[_0x6e6f('0x40')]=[{'all':!![]}];}_0xd81791=_[_0x6e6f('0x38')]({},_0xd81791,_0x25d2d2['options']);return db[_0x6e6f('0x28')]['find'](_0xd81791)[_0x6e6f('0x20')](handleEntityNotFound(_0x27f637,null))[_0x6e6f('0x20')](respondWithResult(_0x27f637,null))['catch'](handleError(_0x27f637,null));};exports['create']=function(_0x104d44,_0x2ae115){return db[_0x6e6f('0x28')][_0x6e6f('0x41')](_0x104d44['body'],{})[_0x6e6f('0x20')](respondWithResult(_0x2ae115,0xc9))['catch'](handleError(_0x2ae115,null));};exports[_0x6e6f('0x42')]=function(_0x1bab92,_0x3df54f){if(_0x1bab92[_0x6e6f('0x43')]['id']){delete _0x1bab92[_0x6e6f('0x43')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x1bab92[_0x6e6f('0x3e')]['id']}})[_0x6e6f('0x20')](handleEntityNotFound(_0x3df54f,null))[_0x6e6f('0x20')](saveUpdates(_0x1bab92['body'],null))[_0x6e6f('0x20')](respondWithResult(_0x3df54f,null))[_0x6e6f('0x3c')](handleError(_0x3df54f,null));};exports[_0x6e6f('0x44')]=function(_0x5477f0,_0x20e354){return db[_0x6e6f('0x28')][_0x6e6f('0x45')]({'where':{'id':_0x5477f0[_0x6e6f('0x3e')]['id']}})[_0x6e6f('0x20')](handleEntityNotFound(_0x20e354,null))[_0x6e6f('0x20')](removeEntity(_0x20e354,null))[_0x6e6f('0x3c')](handleError(_0x20e354,null));};exports[_0x6e6f('0x46')]=function(_0x5e66d7,_0x7919ac){return db[_0x6e6f('0x28')][_0x6e6f('0x46')]()[_0x6e6f('0x20')](respondWithResult(_0x7919ac,null))[_0x6e6f('0x3c')](handleError(_0x7919ac,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 6a81131..956393d 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 _0xb50f=['../../mysqldb','MailSubstatus','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2c5d95,_0x1dff74){var _0x58bbfb=function(_0x2003dd){while(--_0x2003dd){_0x2c5d95['push'](_0x2c5d95['shift']());}};_0x58bbfb(++_0x1dff74);}(_0xb50f,0x177));var _0xfb50=function(_0x4628a1,_0x55ff29){_0x4628a1=_0x4628a1-0x0;var _0x492347=_0xb50f[_0x4628a1];return _0x492347;};'use strict';var EventEmitter=require(_0xfb50('0x0'));var MailSubstatus=require(_0xfb50('0x1'))['db'][_0xfb50('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xfb50('0x3')};function emitEvent(_0x48bc33){return function(_0x5b5511,_0x335765,_0x260a0c){MailSubstatusEvents['emit'](_0x48bc33+':'+_0x5b5511['id'],_0x5b5511);MailSubstatusEvents[_0xfb50('0x4')](_0x48bc33,_0x5b5511);_0x260a0c(null);};}for(var e in events){if(events[_0xfb50('0x5')](e)){var event=events[e];MailSubstatus[_0xfb50('0x6')](e,emitEvent(event));}}module[_0xfb50('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xd584=['exports','../../mysqldb','setMaxListeners','update','emit','hook'];(function(_0x254d47,_0x50ae3b){var _0x377bd0=function(_0x3c31bb){while(--_0x3c31bb){_0x254d47['push'](_0x254d47['shift']());}};_0x377bd0(++_0x50ae3b);}(_0xd584,0x1ed));var _0x4d58=function(_0x2c8ce8,_0x37ae0a){_0x2c8ce8=_0x2c8ce8-0x0;var _0x9f1f44=_0xd584[_0x2c8ce8];return _0x9f1f44;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x4d58('0x0'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x4d58('0x1')](0x0);var events={'afterUpdate':_0x4d58('0x2')};function emitEvent(_0x4277cf){return function(_0x14686d,_0x388e9e,_0x51692c){MailSubstatusEvents[_0x4d58('0x3')](_0x4277cf+':'+_0x14686d['id'],_0x14686d);MailSubstatusEvents[_0x4d58('0x3')](_0x4277cf,_0x14686d);_0x51692c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x4d58('0x4')](e,emitEvent(event));}}module[_0x4d58('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 ee303d7..d2401c7 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 _0x7f23=['Condition','name','mailSubstatus','then','catch','./mailSubstatus.attributes','exports','models','MailSubstatus','mail_substatuses'];(function(_0x396248,_0x5b7ff2){var _0x568f77=function(_0x4a5108){while(--_0x4a5108){_0x396248['push'](_0x396248['shift']());}};_0x568f77(++_0x5b7ff2);}(_0x7f23,0x1ef));var _0x37f2=function(_0x15fd55,_0x1532e0){_0x15fd55=_0x15fd55-0x0;var _0x3c208a=_0x7f23[_0x15fd55];return _0x3c208a;};'use strict';var attributes=require(_0x37f2('0x0'));module[_0x37f2('0x1')]=function(_0xa26812){var _0x3ed2f7=_0xa26812[_0x37f2('0x2')];return _0xa26812['define'](_0x37f2('0x3'),attributes,{'tableName':_0x37f2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x25da16,_0x427bda,_0x3f8316){return _0x3ed2f7[_0x37f2('0x5')]['update']({'value':_0x25da16[_0x37f2('0x6')]},{'where':{'field':_0x37f2('0x7'),'value':_0x25da16['_previousDataValues']['name']}})[_0x37f2('0x8')](function(){_0x3f8316();})[_0x37f2('0x9')](function(_0x4da98a){_0x3f8316(_0x4da98a);});}}});}; \ No newline at end of file +var _0x0a0c=['define','MailSubstatus','Condition','update','name','_previousDataValues','then','./mailSubstatus.attributes'];(function(_0x440c26,_0x183591){var _0x41bba0=function(_0x53a132){while(--_0x53a132){_0x440c26['push'](_0x440c26['shift']());}};_0x41bba0(++_0x183591);}(_0x0a0c,0xd7));var _0xc0a0=function(_0x15184c,_0x35a6e){_0x15184c=_0x15184c-0x0;var _0x35ca27=_0x0a0c[_0x15184c];return _0x35ca27;};'use strict';var attributes=require(_0xc0a0('0x0'));module['exports']=function(_0x2eae4d){var _0x5b048c=_0x2eae4d['models'];return _0x2eae4d[_0xc0a0('0x1')](_0xc0a0('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x284502,_0x8a1951,_0x317b7b){return _0x5b048c[_0xc0a0('0x3')][_0xc0a0('0x4')]({'value':_0x284502[_0xc0a0('0x5')]},{'where':{'field':'mailSubstatus','value':_0x284502[_0xc0a0('0x6')][_0xc0a0('0x5')]}})[_0xc0a0('0x7')](function(){_0x317b7b();})['catch'](function(_0x53a974){_0x317b7b(_0x53a974);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d5c22ac..9de6cfc 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 _0xc20c=['lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc20c,0x73));var _0xcc20=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0xc20c[_0x4d8666];return _0x37175b;};'use strict';var _=require(_0xcc20('0x0'));var util=require('util');var moment=require(_0xcc20('0x1'));var BPromise=require(_0xcc20('0x2'));var rs=require(_0xcc20('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcc20('0x4'));var logger=require(_0xcc20('0x5'))(_0xcc20('0x6'));var config=require(_0xcc20('0x7'));var jayson=require(_0xcc20('0x8'));var client=jayson[_0xcc20('0x9')][_0xcc20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x132d4a,_0x561f8e,_0x38b650){return new BPromise(function(_0xb45670,_0x4ea38d){return client[_0xcc20('0xb')](_0x132d4a,_0x38b650)[_0xcc20('0xc')](function(_0x48bcbd){logger['info'](_0xcc20('0xd'),_0x561f8e,_0xcc20('0xe'));logger[_0xcc20('0xf')](_0xcc20('0x10'),_0x561f8e,_0xcc20('0xe'),JSON['stringify'](_0x48bcbd));if(_0x48bcbd['error']){if(_0x48bcbd[_0xcc20('0x11')][_0xcc20('0x12')]===0x1f4){logger[_0xcc20('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x561f8e,_0x48bcbd['error'][_0xcc20('0x13')]);return _0x4ea38d(_0x48bcbd[_0xcc20('0x11')][_0xcc20('0x13')]);}logger[_0xcc20('0x11')](_0xcc20('0xd'),_0x561f8e,_0x48bcbd[_0xcc20('0x11')][_0xcc20('0x13')]);return _0xb45670(_0x48bcbd['error'][_0xcc20('0x13')]);}else{logger[_0xcc20('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x561f8e,'request\x20sent');_0xb45670(_0x48bcbd[_0xcc20('0x15')][_0xcc20('0x13')]);}})[_0xcc20('0x16')](function(_0x5a7353){logger['error'](_0xcc20('0xd'),_0x561f8e,_0x5a7353);_0x4ea38d(_0x5a7353);});});} \ No newline at end of file +var _0xba12=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','MailSubstatus,\x20%s,\x20%s'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xba12,0xa4));var _0x2ba1=function(_0x40de6f,_0x3d5f9c){_0x40de6f=_0x40de6f-0x0;var _0x44a887=_0xba12[_0x40de6f];return _0x44a887;};'use strict';var _=require('lodash');var util=require(_0x2ba1('0x0'));var moment=require('moment');var BPromise=require(_0x2ba1('0x1'));var rs=require(_0x2ba1('0x2'));var fs=require('fs');var Redis=require(_0x2ba1('0x3'));var db=require(_0x2ba1('0x4'))['db'];var utils=require(_0x2ba1('0x5'));var logger=require(_0x2ba1('0x6'))(_0x2ba1('0x7'));var config=require('../../config/environment');var jayson=require(_0x2ba1('0x8'));var client=jayson[_0x2ba1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ed09b,_0x175148,_0x3d8914){return new BPromise(function(_0xc9fce7,_0x41825f){return client['request'](_0x1ed09b,_0x3d8914)[_0x2ba1('0xa')](function(_0x2bf3cd){logger['info'](_0x2ba1('0xb'),_0x175148,'request\x20sent');logger[_0x2ba1('0xc')](_0x2ba1('0xd'),_0x175148,_0x2ba1('0xe'),JSON[_0x2ba1('0xf')](_0x2bf3cd));if(_0x2bf3cd[_0x2ba1('0x10')]){if(_0x2bf3cd[_0x2ba1('0x10')][_0x2ba1('0x11')]===0x1f4){logger[_0x2ba1('0x10')](_0x2ba1('0xb'),_0x175148,_0x2bf3cd[_0x2ba1('0x10')][_0x2ba1('0x12')]);return _0x41825f(_0x2bf3cd[_0x2ba1('0x10')][_0x2ba1('0x12')]);}logger[_0x2ba1('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x175148,_0x2bf3cd[_0x2ba1('0x10')][_0x2ba1('0x12')]);return _0xc9fce7(_0x2bf3cd[_0x2ba1('0x10')]['message']);}else{logger[_0x2ba1('0x13')](_0x2ba1('0xb'),_0x175148,_0x2ba1('0xe'));_0xc9fce7(_0x2bf3cd[_0x2ba1('0x14')]['message']);}})[_0x2ba1('0x15')](function(_0x35c30a){logger[_0x2ba1('0x10')](_0x2ba1('0xb'),_0x175148,_0x35c30a);_0x41825f(_0x35c30a);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6787d9b..f998e4c 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 _0x2282=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','delete','destroy','exports','multer'];(function(_0x12e1c4,_0x157f1b){var _0x59e7bb=function(_0x15cb84){while(--_0x15cb84){_0x12e1c4['push'](_0x12e1c4['shift']());}};_0x59e7bb(++_0x157f1b);}(_0x2282,0xf6));var _0x2228=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0x2282[_0x4733d3];return _0x1b9a44;};'use strict';var multer=require(_0x2228('0x0'));var util=require('util');var path=require(_0x2228('0x1'));var timeout=require(_0x2228('0x2'));var express=require(_0x2228('0x3'));var router=express[_0x2228('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2228('0x5'));var interaction=require(_0x2228('0x6'));var config=require('../../config/environment');var controller=require(_0x2228('0x7'));router[_0x2228('0x8')]('/',auth[_0x2228('0x9')](),controller[_0x2228('0xa')]);router['get'](_0x2228('0xb'),auth[_0x2228('0x9')](),controller[_0x2228('0xc')]);router[_0x2228('0x8')](_0x2228('0xd'),auth[_0x2228('0x9')](),controller['show']);router[_0x2228('0xe')]('/',auth[_0x2228('0x9')](),controller['create']);router[_0x2228('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2228('0x10')](_0x2228('0xd'),auth[_0x2228('0x9')](),controller[_0x2228('0x11')]);module[_0x2228('0x12')]=router; \ No newline at end of file +var _0x57ac=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x2c0ef8,_0xed3b6b){var _0x3e2d27=function(_0x35ef6e){while(--_0x35ef6e){_0x2c0ef8['push'](_0x2c0ef8['shift']());}};_0x3e2d27(++_0xed3b6b);}(_0x57ac,0x15c));var _0xc57a=function(_0xd70adc,_0x61e40f){_0xd70adc=_0xd70adc-0x0;var _0x2c407e=_0x57ac[_0xd70adc];return _0x2c407e;};'use strict';var multer=require(_0xc57a('0x0'));var util=require('util');var path=require(_0xc57a('0x1'));var timeout=require(_0xc57a('0x2'));var express=require(_0xc57a('0x3'));var router=express['Router']();var fs_extra=require(_0xc57a('0x4'));var auth=require(_0xc57a('0x5'));var interaction=require(_0xc57a('0x6'));var config=require(_0xc57a('0x7'));var controller=require(_0xc57a('0x8'));router[_0xc57a('0x9')]('/',auth[_0xc57a('0xa')](),controller[_0xc57a('0xb')]);router[_0xc57a('0x9')](_0xc57a('0xc'),auth['isAuthenticated'](),controller[_0xc57a('0xd')]);router['get'](_0xc57a('0xe'),auth[_0xc57a('0xa')](),controller[_0xc57a('0xf')]);router[_0xc57a('0x10')]('/',auth[_0xc57a('0xa')](),controller[_0xc57a('0x11')]);router[_0xc57a('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xc57a('0xe'),auth['isAuthenticated'](),controller[_0xc57a('0x13')]);module[_0xc57a('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index e701692..b591d4a 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x118139,_0x7ce965){var _0x2fece9=function(_0xd145a4){while(--_0xd145a4){_0x118139['push'](_0x118139['shift']());}};_0x2fece9(++_0x7ce965);}(_0x008c,0x188));var _0xc008=function(_0x36211c,_0x178508){_0x36211c=_0x36211c-0x0;var _0xd2487b=_0x008c[_0x36211c];return _0xd2487b;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x17c283,_0x587fcc){var _0x4e0800=function(_0x537bc3){while(--_0x537bc3){_0x17c283['push'](_0x17c283['shift']());}};_0x4e0800(++_0x587fcc);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'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 diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index d14688e..db4dbb4 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 _0xf946=['sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','rows','catch','show','params','keys','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','map','query','filters','intersection','attributes','model','fields','hasOwnProperty','offset','order'];(function(_0x37e0b3,_0x1940f1){var _0x35e903=function(_0x3f8ad5){while(--_0x3f8ad5){_0x37e0b3['push'](_0x37e0b3['shift']());}};_0x35e903(++_0x1940f1);}(_0xf946,0x18d));var _0x6f94=function(_0x564c3f,_0x563c13){_0x564c3f=_0x564c3f-0x0;var _0xdeb099=_0xf946[_0x564c3f];return _0xdeb099;};'use strict';var emlformat=require(_0x6f94('0x0'));var rimraf=require(_0x6f94('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f94('0x2'));var rp=require(_0x6f94('0x3'));var moment=require(_0x6f94('0x4'));var BPromise=require(_0x6f94('0x5'));var Mustache=require(_0x6f94('0x6'));var util=require('util');var path=require(_0x6f94('0x7'));var sox=require(_0x6f94('0x8'));var csv=require('to-csv');var ejs=require(_0x6f94('0x9'));var fs=require('fs');var fs_extra=require(_0x6f94('0xa'));var _=require(_0x6f94('0xb'));var squel=require('squel');var crypto=require(_0x6f94('0xc'));var jsforce=require(_0x6f94('0xd'));var deskjs=require(_0x6f94('0xe'));var toCsv=require(_0x6f94('0xf'));var querystring=require('querystring');var Papa=require(_0x6f94('0x10'));var Redis=require(_0x6f94('0x11'));var authService=require(_0x6f94('0x12'));var qs=require(_0x6f94('0x13'));var as=require(_0x6f94('0x14'));var hardwareService=require(_0x6f94('0x15'));var logger=require(_0x6f94('0x16'))(_0x6f94('0x17'));var utils=require(_0x6f94('0x18'));var config=require(_0x6f94('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f94('0x1a'))['db'];function respondWithStatusCode(_0x3671d7,_0x18ef81){_0x18ef81=_0x18ef81||0xcc;return function(_0x48ab5f){if(_0x48ab5f){return _0x3671d7[_0x6f94('0x1b')](_0x18ef81);}return _0x3671d7[_0x6f94('0x1c')](_0x18ef81)[_0x6f94('0x1d')]();};}function respondWithResult(_0x106113,_0x4ff6cb){_0x4ff6cb=_0x4ff6cb||0xc8;return function(_0x41124d){if(_0x41124d){return _0x106113[_0x6f94('0x1c')](_0x4ff6cb)['json'](_0x41124d);}};}function respondWithFilteredResult(_0x1214a4,_0x5322ff){return function(_0x4a1b09){if(_0x4a1b09){var _0x3ce04e=typeof _0x5322ff['offset']===_0x6f94('0x1e')&&typeof _0x5322ff[_0x6f94('0x1f')]==='undefined';var _0x28ccbe=_0x4a1b09['count'];var _0x12bd75=_0x3ce04e?0x0:_0x5322ff['offset'];var _0x3a787d=_0x3ce04e?_0x4a1b09[_0x6f94('0x20')]:_0x5322ff['offset']+_0x5322ff[_0x6f94('0x1f')];var _0x27c1bf;if(_0x3a787d>=_0x28ccbe){_0x3a787d=_0x28ccbe;_0x27c1bf=0xc8;}else{_0x27c1bf=0xce;}_0x1214a4['status'](_0x27c1bf);return _0x1214a4[_0x6f94('0x21')](_0x6f94('0x22'),_0x12bd75+'-'+_0x3a787d+'/'+_0x28ccbe)['json'](_0x4a1b09);}return null;};}function patchUpdates(_0xbfd35a){return function(_0x326c1e){try{jsonpatch[_0x6f94('0x23')](_0x326c1e,_0xbfd35a,!![]);}catch(_0x266d7a){return BPromise[_0x6f94('0x24')](_0x266d7a);}return _0x326c1e['save']();};}function saveUpdates(_0x32fa58,_0x32517c){return function(_0x3e6c16){if(_0x3e6c16){return _0x3e6c16[_0x6f94('0x25')](_0x32fa58)[_0x6f94('0x26')](function(_0x5b85a4){return _0x5b85a4;});}return null;};}function removeEntity(_0x190405,_0x31c8a4){return function(_0x13ffda){if(_0x13ffda){return _0x13ffda[_0x6f94('0x27')]()[_0x6f94('0x26')](function(){_0x190405[_0x6f94('0x1c')](0xcc)[_0x6f94('0x1d')]();});}};}function handleEntityNotFound(_0x22434e,_0x1857fe){return function(_0x1db07f){if(!_0x1db07f){_0x22434e[_0x6f94('0x1b')](0x194);}return _0x1db07f;};}function handleError(_0x2d38e0,_0x512d7f){_0x512d7f=_0x512d7f||0x1f4;return function(_0x38661d){logger[_0x6f94('0x28')](_0x38661d[_0x6f94('0x29')]);if(_0x38661d[_0x6f94('0x2a')]){delete _0x38661d['name'];}_0x2d38e0[_0x6f94('0x1c')](_0x512d7f)[_0x6f94('0x2b')](_0x38661d);};}exports[_0x6f94('0x2c')]=function(_0x149ce4,_0x2026f7){var _0x6562d6={},_0x4a2a98={},_0x45a31d={'count':0x0,'rows':[]};var _0x31191f=_['map'](db[_0x6f94('0x2d')][_0x6f94('0x2e')],function(_0x172f78){return{'name':_0x172f78[_0x6f94('0x2f')],'type':_0x172f78[_0x6f94('0x30')]['key']};});_0x4a2a98['model']=_[_0x6f94('0x31')](_0x31191f,_0x6f94('0x2a'));_0x4a2a98['query']=_['keys'](_0x149ce4[_0x6f94('0x32')]);_0x4a2a98[_0x6f94('0x33')]=_[_0x6f94('0x34')](_0x4a2a98['model'],_0x4a2a98['query']);_0x6562d6[_0x6f94('0x35')]=_[_0x6f94('0x34')](_0x4a2a98[_0x6f94('0x36')],qs[_0x6f94('0x37')](_0x149ce4[_0x6f94('0x32')][_0x6f94('0x37')]));_0x6562d6['attributes']=_0x6562d6[_0x6f94('0x35')]['length']?_0x6562d6['attributes']:_0x4a2a98['model'];if(!_0x149ce4['query'][_0x6f94('0x38')]('nolimit')){_0x6562d6['limit']=qs['limit'](_0x149ce4[_0x6f94('0x32')][_0x6f94('0x1f')]);_0x6562d6['offset']=qs[_0x6f94('0x39')](_0x149ce4['query']['offset']);}_0x6562d6[_0x6f94('0x3a')]=qs[_0x6f94('0x3b')](_0x149ce4[_0x6f94('0x32')][_0x6f94('0x3b')]);_0x6562d6[_0x6f94('0x3c')]=qs[_0x6f94('0x33')](_[_0x6f94('0x3d')](_0x149ce4[_0x6f94('0x32')],_0x4a2a98[_0x6f94('0x33')]),_0x31191f);if(_0x149ce4[_0x6f94('0x32')]['filter']){_0x6562d6[_0x6f94('0x3c')]=_['merge'](_0x6562d6[_0x6f94('0x3c')],{'$or':_[_0x6f94('0x31')](_0x31191f,function(_0x15ce7c){if(_0x15ce7c['type']!==_0x6f94('0x3e')){var _0x2094d3={};_0x2094d3[_0x15ce7c[_0x6f94('0x2a')]]={'$like':'%'+_0x149ce4[_0x6f94('0x32')][_0x6f94('0x3f')]+'%'};return _0x2094d3;}})});}_0x6562d6=_[_0x6f94('0x40')]({},_0x6562d6,_0x149ce4['options']);var _0x5a4ba9={'where':_0x6562d6[_0x6f94('0x3c')]};return db['MailTransferReport']['count'](_0x5a4ba9)[_0x6f94('0x26')](function(_0x1f4274){_0x45a31d['count']=_0x1f4274;if(_0x149ce4[_0x6f94('0x32')][_0x6f94('0x41')]){_0x6562d6['include']=[{'all':!![]}];}return db[_0x6f94('0x2d')][_0x6f94('0x42')](_0x6562d6);})['then'](function(_0x448518){_0x45a31d[_0x6f94('0x43')]=_0x448518;return _0x45a31d;})['then'](respondWithFilteredResult(_0x2026f7,_0x6562d6))[_0x6f94('0x44')](handleError(_0x2026f7,null));};exports[_0x6f94('0x45')]=function(_0x3a5dfc,_0x15eaef){var _0x25c1cd={'raw':!![],'where':{'id':_0x3a5dfc[_0x6f94('0x46')]['id']}},_0x3074f0={};_0x3074f0['model']=_[_0x6f94('0x47')](db['MailTransferReport'][_0x6f94('0x2e')]);_0x3074f0['query']=_['keys'](_0x3a5dfc['query']);_0x3074f0['filters']=_['intersection'](_0x3074f0[_0x6f94('0x36')],_0x3074f0[_0x6f94('0x32')]);_0x25c1cd[_0x6f94('0x35')]=_[_0x6f94('0x34')](_0x3074f0[_0x6f94('0x36')],qs[_0x6f94('0x37')](_0x3a5dfc[_0x6f94('0x32')][_0x6f94('0x37')]));_0x25c1cd[_0x6f94('0x35')]=_0x25c1cd['attributes']['length']?_0x25c1cd[_0x6f94('0x35')]:_0x3074f0[_0x6f94('0x36')];if(_0x3a5dfc['query'][_0x6f94('0x41')]){_0x25c1cd['include']=[{'all':!![]}];}_0x25c1cd=_[_0x6f94('0x40')]({},_0x25c1cd,_0x3a5dfc[_0x6f94('0x48')]);return db['MailTransferReport'][_0x6f94('0x49')](_0x25c1cd)['then'](handleEntityNotFound(_0x15eaef,null))[_0x6f94('0x26')](respondWithResult(_0x15eaef,null))[_0x6f94('0x44')](handleError(_0x15eaef,null));};exports[_0x6f94('0x4a')]=function(_0x3dadc4,_0x2933e6){return db[_0x6f94('0x2d')][_0x6f94('0x4a')](_0x3dadc4[_0x6f94('0x4b')],{})[_0x6f94('0x26')](respondWithResult(_0x2933e6,0xc9))[_0x6f94('0x44')](handleError(_0x2933e6,null));};exports[_0x6f94('0x25')]=function(_0x416867,_0x32b111){if(_0x416867[_0x6f94('0x4b')]['id']){delete _0x416867['body']['id'];}return db[_0x6f94('0x2d')][_0x6f94('0x49')]({'where':{'id':_0x416867[_0x6f94('0x46')]['id']}})[_0x6f94('0x26')](handleEntityNotFound(_0x32b111,null))[_0x6f94('0x26')](saveUpdates(_0x416867['body'],null))[_0x6f94('0x26')](respondWithResult(_0x32b111,null))[_0x6f94('0x44')](handleError(_0x32b111,null));};exports[_0x6f94('0x27')]=function(_0x21ea27,_0x5173d9){return db[_0x6f94('0x2d')]['find']({'where':{'id':_0x21ea27[_0x6f94('0x46')]['id']}})[_0x6f94('0x26')](handleEntityNotFound(_0x5173d9,null))[_0x6f94('0x26')](removeEntity(_0x5173d9,null))[_0x6f94('0x44')](handleError(_0x5173d9,null));};exports['describe']=function(_0x1c52f0,_0x455aee){return db[_0x6f94('0x2d')]['describe']()[_0x6f94('0x26')](respondWithResult(_0x455aee,null))[_0x6f94('0x44')](handleError(_0x455aee,null));}; \ No newline at end of file +var _0x916f=['filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','MailTransferReport','includeAll','include','findAll','rows','show','params','intersection','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0x3e6443,_0x444aa0){var _0x534aa9=function(_0x1c8fac){while(--_0x1c8fac){_0x3e6443['push'](_0x3e6443['shift']());}};_0x534aa9(++_0x444aa0);}(_0x916f,0x1e8));var _0xf916=function(_0x18353c,_0x3218c4){_0x18353c=_0x18353c-0x0;var _0x48462d=_0x916f[_0x18353c];return _0x48462d;};'use strict';var emlformat=require(_0xf916('0x0'));var rimraf=require(_0xf916('0x1'));var zipdir=require(_0xf916('0x2'));var jsonpatch=require(_0xf916('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf916('0x4'));var Mustache=require('mustache');var util=require(_0xf916('0x5'));var path=require('path');var sox=require(_0xf916('0x6'));var csv=require('to-csv');var ejs=require(_0xf916('0x7'));var fs=require('fs');var fs_extra=require(_0xf916('0x8'));var _=require(_0xf916('0x9'));var squel=require(_0xf916('0xa'));var crypto=require(_0xf916('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf916('0xc'));var toCsv=require(_0xf916('0xd'));var querystring=require(_0xf916('0xe'));var Papa=require(_0xf916('0xf'));var Redis=require(_0xf916('0x10'));var authService=require(_0xf916('0x11'));var qs=require(_0xf916('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf916('0x13'));var logger=require(_0xf916('0x14'))(_0xf916('0x15'));var utils=require(_0xf916('0x16'));var config=require(_0xf916('0x17'));var licenseUtil=require(_0xf916('0x18'));var db=require(_0xf916('0x19'))['db'];function respondWithStatusCode(_0x2b400e,_0x3d7ad7){_0x3d7ad7=_0x3d7ad7||0xcc;return function(_0x493031){if(_0x493031){return _0x2b400e[_0xf916('0x1a')](_0x3d7ad7);}return _0x2b400e['status'](_0x3d7ad7)['end']();};}function respondWithResult(_0x5bcd41,_0x563d02){_0x563d02=_0x563d02||0xc8;return function(_0xc766e2){if(_0xc766e2){return _0x5bcd41[_0xf916('0x1b')](_0x563d02)[_0xf916('0x1c')](_0xc766e2);}};}function respondWithFilteredResult(_0x58e239,_0x352f31){return function(_0x1c39a1){if(_0x1c39a1){var _0x2f1faf=typeof _0x352f31[_0xf916('0x1d')]===_0xf916('0x1e')&&typeof _0x352f31[_0xf916('0x1f')]===_0xf916('0x1e');var _0x1e0154=_0x1c39a1[_0xf916('0x20')];var _0x1eca9f=_0x2f1faf?0x0:_0x352f31[_0xf916('0x1d')];var _0x3bb7bf=_0x2f1faf?_0x1c39a1['count']:_0x352f31[_0xf916('0x1d')]+_0x352f31['limit'];var _0x11fbc6;if(_0x3bb7bf>=_0x1e0154){_0x3bb7bf=_0x1e0154;_0x11fbc6=0xc8;}else{_0x11fbc6=0xce;}_0x58e239[_0xf916('0x1b')](_0x11fbc6);return _0x58e239[_0xf916('0x21')](_0xf916('0x22'),_0x1eca9f+'-'+_0x3bb7bf+'/'+_0x1e0154)[_0xf916('0x1c')](_0x1c39a1);}return null;};}function patchUpdates(_0x200adb){return function(_0xae782e){try{jsonpatch['apply'](_0xae782e,_0x200adb,!![]);}catch(_0x338a5d){return BPromise['reject'](_0x338a5d);}return _0xae782e['save']();};}function saveUpdates(_0x1d9925,_0x1a7b01){return function(_0x272870){if(_0x272870){return _0x272870[_0xf916('0x23')](_0x1d9925)[_0xf916('0x24')](function(_0x43ae04){return _0x43ae04;});}return null;};}function removeEntity(_0x2e952c,_0x3bda8c){return function(_0x52960c){if(_0x52960c){return _0x52960c[_0xf916('0x25')]()[_0xf916('0x24')](function(){_0x2e952c[_0xf916('0x1b')](0xcc)[_0xf916('0x26')]();});}};}function handleEntityNotFound(_0xbf6b8e,_0x3a3e38){return function(_0x3f7970){if(!_0x3f7970){_0xbf6b8e[_0xf916('0x1a')](0x194);}return _0x3f7970;};}function handleError(_0x4b43fc,_0x48e4b1){_0x48e4b1=_0x48e4b1||0x1f4;return function(_0xb22d62){logger['error'](_0xb22d62[_0xf916('0x27')]);if(_0xb22d62[_0xf916('0x28')]){delete _0xb22d62[_0xf916('0x28')];}_0x4b43fc[_0xf916('0x1b')](_0x48e4b1)[_0xf916('0x29')](_0xb22d62);};}exports[_0xf916('0x2a')]=function(_0x28d210,_0x10e742){var _0x22d64a={},_0x3248ee={},_0x1c81d7={'count':0x0,'rows':[]};var _0x42aa5b=_['map'](db['MailTransferReport'][_0xf916('0x2b')],function(_0x3e24c5){return{'name':_0x3e24c5[_0xf916('0x2c')],'type':_0x3e24c5[_0xf916('0x2d')][_0xf916('0x2e')]};});_0x3248ee[_0xf916('0x2f')]=_[_0xf916('0x30')](_0x42aa5b,_0xf916('0x28'));_0x3248ee[_0xf916('0x31')]=_[_0xf916('0x32')](_0x28d210['query']);_0x3248ee[_0xf916('0x33')]=_['intersection'](_0x3248ee[_0xf916('0x2f')],_0x3248ee[_0xf916('0x31')]);_0x22d64a[_0xf916('0x34')]=_['intersection'](_0x3248ee[_0xf916('0x2f')],qs[_0xf916('0x35')](_0x28d210[_0xf916('0x31')][_0xf916('0x35')]));_0x22d64a[_0xf916('0x34')]=_0x22d64a[_0xf916('0x34')][_0xf916('0x36')]?_0x22d64a[_0xf916('0x34')]:_0x3248ee[_0xf916('0x2f')];if(!_0x28d210['query'][_0xf916('0x37')](_0xf916('0x38'))){_0x22d64a[_0xf916('0x1f')]=qs[_0xf916('0x1f')](_0x28d210[_0xf916('0x31')][_0xf916('0x1f')]);_0x22d64a['offset']=qs[_0xf916('0x1d')](_0x28d210[_0xf916('0x31')][_0xf916('0x1d')]);}_0x22d64a[_0xf916('0x39')]=qs[_0xf916('0x3a')](_0x28d210[_0xf916('0x31')][_0xf916('0x3a')]);_0x22d64a[_0xf916('0x3b')]=qs['filters'](_[_0xf916('0x3c')](_0x28d210[_0xf916('0x31')],_0x3248ee[_0xf916('0x33')]),_0x42aa5b);if(_0x28d210['query'][_0xf916('0x3d')]){_0x22d64a[_0xf916('0x3b')]=_[_0xf916('0x3e')](_0x22d64a[_0xf916('0x3b')],{'$or':_[_0xf916('0x30')](_0x42aa5b,function(_0x5e30b4){if(_0x5e30b4[_0xf916('0x2d')]!==_0xf916('0x3f')){var _0x33a1b5={};_0x33a1b5[_0x5e30b4['name']]={'$like':'%'+_0x28d210[_0xf916('0x31')][_0xf916('0x3d')]+'%'};return _0x33a1b5;}})});}_0x22d64a=_[_0xf916('0x3e')]({},_0x22d64a,_0x28d210['options']);var _0x890ef1={'where':_0x22d64a[_0xf916('0x3b')]};return db[_0xf916('0x40')][_0xf916('0x20')](_0x890ef1)[_0xf916('0x24')](function(_0x45dac8){_0x1c81d7[_0xf916('0x20')]=_0x45dac8;if(_0x28d210[_0xf916('0x31')][_0xf916('0x41')]){_0x22d64a[_0xf916('0x42')]=[{'all':!![]}];}return db['MailTransferReport'][_0xf916('0x43')](_0x22d64a);})[_0xf916('0x24')](function(_0x1164b9){_0x1c81d7[_0xf916('0x44')]=_0x1164b9;return _0x1c81d7;})[_0xf916('0x24')](respondWithFilteredResult(_0x10e742,_0x22d64a))['catch'](handleError(_0x10e742,null));};exports[_0xf916('0x45')]=function(_0x17f513,_0x424050){var _0xba1d24={'raw':!![],'where':{'id':_0x17f513[_0xf916('0x46')]['id']}},_0x2cdbe5={};_0x2cdbe5[_0xf916('0x2f')]=_[_0xf916('0x32')](db['MailTransferReport'][_0xf916('0x2b')]);_0x2cdbe5[_0xf916('0x31')]=_[_0xf916('0x32')](_0x17f513['query']);_0x2cdbe5[_0xf916('0x33')]=_['intersection'](_0x2cdbe5[_0xf916('0x2f')],_0x2cdbe5['query']);_0xba1d24[_0xf916('0x34')]=_[_0xf916('0x47')](_0x2cdbe5['model'],qs[_0xf916('0x35')](_0x17f513[_0xf916('0x31')]['fields']));_0xba1d24[_0xf916('0x34')]=_0xba1d24['attributes'][_0xf916('0x36')]?_0xba1d24[_0xf916('0x34')]:_0x2cdbe5[_0xf916('0x2f')];if(_0x17f513['query'][_0xf916('0x41')]){_0xba1d24[_0xf916('0x42')]=[{'all':!![]}];}_0xba1d24=_[_0xf916('0x3e')]({},_0xba1d24,_0x17f513[_0xf916('0x48')]);return db[_0xf916('0x40')][_0xf916('0x49')](_0xba1d24)['then'](handleEntityNotFound(_0x424050,null))[_0xf916('0x24')](respondWithResult(_0x424050,null))[_0xf916('0x4a')](handleError(_0x424050,null));};exports[_0xf916('0x4b')]=function(_0x470714,_0x1390ac){return db[_0xf916('0x40')][_0xf916('0x4b')](_0x470714[_0xf916('0x4c')],{})['then'](respondWithResult(_0x1390ac,0xc9))['catch'](handleError(_0x1390ac,null));};exports[_0xf916('0x23')]=function(_0x48f762,_0x2e01ec){if(_0x48f762[_0xf916('0x4c')]['id']){delete _0x48f762['body']['id'];}return db[_0xf916('0x40')][_0xf916('0x49')]({'where':{'id':_0x48f762[_0xf916('0x46')]['id']}})[_0xf916('0x24')](handleEntityNotFound(_0x2e01ec,null))[_0xf916('0x24')](saveUpdates(_0x48f762[_0xf916('0x4c')],null))['then'](respondWithResult(_0x2e01ec,null))[_0xf916('0x4a')](handleError(_0x2e01ec,null));};exports[_0xf916('0x25')]=function(_0x1ba097,_0x132029){return db['MailTransferReport'][_0xf916('0x49')]({'where':{'id':_0x1ba097[_0xf916('0x46')]['id']}})[_0xf916('0x24')](handleEntityNotFound(_0x132029,null))[_0xf916('0x24')](removeEntity(_0x132029,null))[_0xf916('0x4a')](handleError(_0x132029,null));};exports['describe']=function(_0x2629da,_0x2df59d){return db[_0xf916('0x40')]['describe']()[_0xf916('0x24')](respondWithResult(_0x2df59d,null))[_0xf916('0x4a')](handleError(_0x2df59d,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 2a4da0a..b258fd1 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 _0xb957=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','../../config/logger'];(function(_0x4011c7,_0x4d3d71){var _0x32a078=function(_0x2aaede){while(--_0x2aaede){_0x4011c7['push'](_0x4011c7['shift']());}};_0x32a078(++_0x4d3d71);}(_0xb957,0x6d));var _0x7b95=function(_0xe2b604,_0x73cc8b){_0xe2b604=_0xe2b604-0x0;var _0x53b580=_0xb957[_0xe2b604];return _0x53b580;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7b95('0x0'))('api');var moment=require(_0x7b95('0x1'));var BPromise=require(_0x7b95('0x2'));var rp=require(_0x7b95('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b95('0x4'));var config=require(_0x7b95('0x5'));var attributes=require(_0x7b95('0x6'));module[_0x7b95('0x7')]=function(_0x19ff14,_0x518099){return _0x19ff14[_0x7b95('0x8')](_0x7b95('0x9'),attributes,{'tableName':_0x7b95('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0a2=['report_mail_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport'];(function(_0x58f8a7,_0xbd36a7){var _0x149b97=function(_0x1def61){while(--_0x1def61){_0x58f8a7['push'](_0x58f8a7['shift']());}};_0x149b97(++_0xbd36a7);}(_0xd0a2,0x128));var _0x2d0a=function(_0x5b1003,_0x4bfeb9){_0x5b1003=_0x5b1003-0x0;var _0x4a3ca8=_0xd0a2[_0x5b1003];return _0x4a3ca8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d0a('0x0'))(_0x2d0a('0x1'));var moment=require(_0x2d0a('0x2'));var BPromise=require(_0x2d0a('0x3'));var rp=require(_0x2d0a('0x4'));var fs=require('fs');var path=require(_0x2d0a('0x5'));var rimraf=require(_0x2d0a('0x6'));var config=require(_0x2d0a('0x7'));var attributes=require(_0x2d0a('0x8'));module[_0x2d0a('0x9')]=function(_0x2c76e2,_0x129a7e){return _0x2c76e2[_0x2d0a('0xa')](_0x2d0a('0xb'),attributes,{'tableName':_0x2d0a('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2d0a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index d957f34..bde504f 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 _0x6356=['MailTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x261044,_0x1ebcbe){var _0x243393=function(_0x227861){while(--_0x227861){_0x261044['push'](_0x261044['shift']());}};_0x243393(++_0x1ebcbe);}(_0x6356,0x102));var _0x6635=function(_0x168478,_0x323a27){_0x168478=_0x168478-0x0;var _0x29c2f8=_0x6356[_0x168478];return _0x29c2f8;};'use strict';var _=require(_0x6635('0x0'));var util=require(_0x6635('0x1'));var moment=require(_0x6635('0x2'));var BPromise=require(_0x6635('0x3'));var rs=require(_0x6635('0x4'));var fs=require('fs');var Redis=require(_0x6635('0x5'));var db=require(_0x6635('0x6'))['db'];var utils=require(_0x6635('0x7'));var logger=require(_0x6635('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6635('0x9')][_0x6635('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51453d,_0x164391,_0x1f72b3){return new BPromise(function(_0x1c8c20,_0x452c8c){return client[_0x6635('0xb')](_0x51453d,_0x1f72b3)[_0x6635('0xc')](function(_0xb77dca){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x164391,_0x6635('0xd'));logger[_0x6635('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x164391,_0x6635('0xd'),JSON[_0x6635('0xf')](_0xb77dca));if(_0xb77dca[_0x6635('0x10')]){if(_0xb77dca[_0x6635('0x10')][_0x6635('0x11')]===0x1f4){logger[_0x6635('0x10')](_0x6635('0x12'),_0x164391,_0xb77dca[_0x6635('0x10')][_0x6635('0x13')]);return _0x452c8c(_0xb77dca[_0x6635('0x10')][_0x6635('0x13')]);}logger[_0x6635('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x164391,_0xb77dca[_0x6635('0x10')][_0x6635('0x13')]);return _0x1c8c20(_0xb77dca[_0x6635('0x10')][_0x6635('0x13')]);}else{logger[_0x6635('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x164391,_0x6635('0xd'));_0x1c8c20(_0xb77dca[_0x6635('0x15')][_0x6635('0x13')]);}})[_0x6635('0x16')](function(_0x50a602){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x164391,_0x50a602);_0x452c8c(_0x50a602);});});} \ No newline at end of file +var _0xde16=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xde16,0x108));var _0x6de1=function(_0x2ee7c0,_0x52632c){_0x2ee7c0=_0x2ee7c0-0x0;var _0x42e7c3=_0xde16[_0x2ee7c0];return _0x42e7c3;};'use strict';var _=require(_0x6de1('0x0'));var util=require(_0x6de1('0x1'));var moment=require(_0x6de1('0x2'));var BPromise=require(_0x6de1('0x3'));var rs=require(_0x6de1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6de1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6de1('0x6'))(_0x6de1('0x7'));var config=require(_0x6de1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6de1('0x9')][_0x6de1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41649e,_0xc6c16,_0x5b504b){return new BPromise(function(_0x18bdf4,_0x3f05ae){return client[_0x6de1('0xb')](_0x41649e,_0x5b504b)[_0x6de1('0xc')](function(_0x5563a4){logger[_0x6de1('0xd')](_0x6de1('0xe'),_0xc6c16,_0x6de1('0xf'));logger[_0x6de1('0x10')](_0x6de1('0x11'),_0xc6c16,'request\x20sent',JSON['stringify'](_0x5563a4));if(_0x5563a4[_0x6de1('0x12')]){if(_0x5563a4[_0x6de1('0x12')][_0x6de1('0x13')]===0x1f4){logger[_0x6de1('0x12')](_0x6de1('0xe'),_0xc6c16,_0x5563a4['error'][_0x6de1('0x14')]);return _0x3f05ae(_0x5563a4['error'][_0x6de1('0x14')]);}logger[_0x6de1('0x12')](_0x6de1('0xe'),_0xc6c16,_0x5563a4[_0x6de1('0x12')][_0x6de1('0x14')]);return _0x18bdf4(_0x5563a4[_0x6de1('0x12')][_0x6de1('0x14')]);}else{logger[_0x6de1('0xd')](_0x6de1('0xe'),_0xc6c16,_0x6de1('0xf'));_0x18bdf4(_0x5563a4[_0x6de1('0x15')]['message']);}})['catch'](function(_0xb59173){logger[_0x6de1('0x12')]('MailTransferReport,\x20%s,\x20%s',_0xc6c16,_0xb59173);_0x3f05ae(_0xb59173);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 68d0438..314fab9 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 _0xcecb=['update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0xcecb,0x114));var _0xbcec=function(_0x417baa,_0x3923d0){_0x417baa=_0x417baa-0x0;var _0x42724f=_0xcecb[_0x417baa];return _0x42724f;};'use strict';var multer=require(_0xbcec('0x0'));var util=require(_0xbcec('0x1'));var path=require('path');var timeout=require(_0xbcec('0x2'));var express=require(_0xbcec('0x3'));var router=express[_0xbcec('0x4')]();var fs_extra=require(_0xbcec('0x5'));var auth=require(_0xbcec('0x6'));var interaction=require(_0xbcec('0x7'));var config=require('../../config/environment');var controller=require(_0xbcec('0x8'));router[_0xbcec('0x9')]('/',auth[_0xbcec('0xa')](),controller[_0xbcec('0xb')]);router[_0xbcec('0x9')](_0xbcec('0xc'),auth['isAuthenticated'](),controller[_0xbcec('0xd')]);router['get'](_0xbcec('0xe'),auth[_0xbcec('0xa')](),controller[_0xbcec('0xf')]);router[_0xbcec('0x10')]('/',auth[_0xbcec('0xa')](),controller['create']);router[_0xbcec('0x11')](_0xbcec('0xe'),auth[_0xbcec('0xa')](),controller[_0xbcec('0x12')]);router[_0xbcec('0x13')]('/:id',auth[_0xbcec('0xa')](),controller[_0xbcec('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1951=['/describe','isAuthenticated','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x581960,_0x1232ff){var _0x4ee892=function(_0x2a920d){while(--_0x2a920d){_0x581960['push'](_0x581960['shift']());}};_0x4ee892(++_0x1232ff);}(_0x1951,0x105));var _0x1195=function(_0x121211,_0x3addc6){_0x121211=_0x121211-0x0;var _0x4f900b=_0x1951[_0x121211];return _0x4f900b;};'use strict';var multer=require(_0x1195('0x0'));var util=require(_0x1195('0x1'));var path=require(_0x1195('0x2'));var timeout=require(_0x1195('0x3'));var express=require(_0x1195('0x4'));var router=express[_0x1195('0x5')]();var fs_extra=require(_0x1195('0x6'));var auth=require(_0x1195('0x7'));var interaction=require(_0x1195('0x8'));var config=require(_0x1195('0x9'));var controller=require('./memberReport.controller');router[_0x1195('0xa')]('/',auth['isAuthenticated'](),controller[_0x1195('0xb')]);router[_0x1195('0xa')](_0x1195('0xc'),auth[_0x1195('0xd')](),controller['describe']);router[_0x1195('0xa')](_0x1195('0xe'),auth[_0x1195('0xd')](),controller['show']);router[_0x1195('0xf')]('/',auth[_0x1195('0xd')](),controller[_0x1195('0x10')]);router[_0x1195('0x11')](_0x1195('0xe'),auth[_0x1195('0xd')](),controller[_0x1195('0x12')]);router[_0x1195('0x13')](_0x1195('0xe'),auth[_0x1195('0xd')](),controller['destroy']);module[_0x1195('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index c529784..82dcd01 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 _0xdede=['exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','exitAt','setDataValue','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment'];(function(_0x174650,_0x2d67be){var _0x285d4d=function(_0x4bbd0a){while(--_0x4bbd0a){_0x174650['push'](_0x174650['shift']());}};_0x285d4d(++_0x2d67be);}(_0xdede,0x6b));var _0xeded=function(_0x5270f8,_0x2dc0c0){_0x5270f8=_0x5270f8-0x0;var _0x432ed0=_0xdede[_0x5270f8];return _0x432ed0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xeded('0x0'));module[_0xeded('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xeded('0x2')]},'interface':{'type':Sequelize[_0xeded('0x2')]},'type':{'type':Sequelize[_0xeded('0x2')],'defaultValue':_0xeded('0x3'),'comment':_0xeded('0x4')},'duration':{'type':Sequelize[_0xeded('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xeded('0x6')],'set':function(_0x79b0ba){var _0x2db1b6=moment(_0x79b0ba);var _0x2b957d=moment(this[_0xeded('0x7')](_0xeded('0x8')));var _0x37faea=_0x2db1b6[_0xeded('0x9')](_0x2b957d,_0xeded('0xa'));this['setDataValue'](_0xeded('0xb'),_0x79b0ba);this[_0xeded('0xc')](_0xeded('0xd'),_0x37faea>=0x0?_0x37faea:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xeded('0x2')],'comment':_0xeded('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0xeded('0xf')},'data4':{'type':Sequelize[_0xeded('0x2')],'comment':_0xeded('0x10')},'data5':{'type':Sequelize[_0xeded('0x2')],'comment':_0xeded('0x11')},'role':{'type':Sequelize[_0xeded('0x2')]},'internal':{'type':Sequelize[_0xeded('0x5')]},'uniqueid':{'type':Sequelize[_0xeded('0x2')]}}; \ No newline at end of file +var _0x675c=['talk:[start]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x675c,0x189));var _0xc675=function(_0x41aea2,_0xe6414c){_0x41aea2=_0x41aea2-0x0;var _0x4b63cc=_0x675c[_0x41aea2];return _0x4b63cc;};'use strict';var Sequelize=require(_0xc675('0x0'));var moment=require(_0xc675('0x1'));module[_0xc675('0x2')]={'channel':{'type':Sequelize[_0xc675('0x3')]},'membername':{'type':Sequelize[_0xc675('0x3')]},'interface':{'type':Sequelize[_0xc675('0x3')]},'type':{'type':Sequelize[_0xc675('0x3')],'defaultValue':_0xc675('0x4'),'comment':_0xc675('0x5')},'duration':{'type':Sequelize[_0xc675('0x6')]},'enterAt':{'type':Sequelize[_0xc675('0x7')]},'exitAt':{'type':Sequelize[_0xc675('0x7')],'set':function(_0x28f7da){var _0x2145a9=moment(_0x28f7da);var _0x4824b3=moment(this[_0xc675('0x8')]('enterAt'));var _0x174e32=_0x2145a9[_0xc675('0x9')](_0x4824b3,_0xc675('0xa'));this[_0xc675('0xb')](_0xc675('0xc'),_0x28f7da);this['setDataValue'](_0xc675('0xd'),_0x174e32>=0x0?_0x174e32:null);}},'data1':{'type':Sequelize[_0xc675('0x3')],'comment':_0xc675('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0xc675('0xf')},'data3':{'type':Sequelize[_0xc675('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xc675('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xc675('0x3')],'comment':_0xc675('0x10')},'role':{'type':Sequelize[_0xc675('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xc675('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 1319674..a44b725 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x34e8,0x12c));var _0x834e=function(_0x4edf69,_0xeb11b9){_0x4edf69=_0x4edf69-0x0;var _0x35aa8d=_0x34e8[_0x4edf69];return _0x35aa8d;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x4139b8,_0x554564){var _0x40c6d6=function(_0x4a743b){while(--_0x4a743b){_0x4139b8['push'](_0x4139b8['shift']());}};_0x40c6d6(++_0x554564);}(_0x008c,0x188));var _0xc008=function(_0x91e807,_0x4ce3d7){_0x91e807=_0x91e807-0x0;var _0x272a99=_0x008c[_0x91e807];return _0x272a99;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index e6a8419..97620f5 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 _0x522b=['lodash','util','api','request-promise','path','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','interface'];(function(_0x12187e,_0x3ac0b2){var _0x4e5cf9=function(_0x12438b){while(--_0x12438b){_0x12187e['push'](_0x12187e['shift']());}};_0x4e5cf9(++_0x3ac0b2);}(_0x522b,0x1c3));var _0xb522=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x522b[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xb522('0x0'));var util=require(_0xb522('0x1'));var logger=require('../../config/logger')(_0xb522('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb522('0x3'));var fs=require('fs');var path=require(_0xb522('0x4'));var rimraf=require('rimraf');var config=require(_0xb522('0x5'));var attributes=require(_0xb522('0x6'));module[_0xb522('0x7')]=function(_0x2fca5b,_0x47bd53){return _0x2fca5b['define'](_0xb522('0x8'),attributes,{'tableName':_0xb522('0x9'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0xb522('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2462=['../../config/environment','exports','define','report_member','membername','interface','lodash','util','moment','bluebird','rimraf'];(function(_0x3ffd40,_0x4c65b8){var _0x14309d=function(_0x48886e){while(--_0x48886e){_0x3ffd40['push'](_0x3ffd40['shift']());}};_0x14309d(++_0x4c65b8);}(_0x2462,0x10e));var _0x2246=function(_0x2cfb49,_0x1d13bc){_0x2cfb49=_0x2cfb49-0x0;var _0x2404b0=_0x2462[_0x2cfb49];return _0x2404b0;};'use strict';var _=require(_0x2246('0x0'));var util=require(_0x2246('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2246('0x2'));var BPromise=require(_0x2246('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2246('0x4'));var config=require(_0x2246('0x5'));var attributes=require('./memberReport.attributes');module[_0x2246('0x6')]=function(_0x10e825,_0x298a25){return _0x10e825[_0x2246('0x7')]('MemberReport',attributes,{'tableName':_0x2246('0x8'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x2246('0x9'),_0x2246('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 908cd21..ae8196e 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 _0x965d=['where','limit','include','model','attributes','map','stringify','create','body','CreateMemberReport','UpdateMemberReport','MemberReport','update','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','code','error','message','MemberReport,\x20%s,\x20%s','result','GetMemberReport','options','raw'];(function(_0x4c10a9,_0x514b23){var _0x40e058=function(_0x34a519){while(--_0x34a519){_0x4c10a9['push'](_0x4c10a9['shift']());}};_0x40e058(++_0x514b23);}(_0x965d,0x1be));var _0xd965=function(_0x566c0d,_0x1d01cf){_0x566c0d=_0x566c0d-0x0;var _0x1f2416=_0x965d[_0x566c0d];return _0x1f2416;};'use strict';var _=require(_0xd965('0x0'));var util=require(_0xd965('0x1'));var moment=require('moment');var BPromise=require(_0xd965('0x2'));var rs=require(_0xd965('0x3'));var fs=require('fs');var Redis=require(_0xd965('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd965('0x5'));var logger=require(_0xd965('0x6'))(_0xd965('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f9b86,_0x368f36,_0x5772e3){return new BPromise(function(_0x427868,_0x563c33){return client[_0xd965('0x8')](_0x2f9b86,_0x5772e3)[_0xd965('0x9')](function(_0xa4f9f9){logger[_0xd965('0xa')]('MemberReport,\x20%s,\x20%s',_0x368f36,_0xd965('0xb'));logger[_0xd965('0xc')](_0xd965('0xd'),_0x368f36,'request\x20sent',JSON['stringify'](_0xa4f9f9));if(_0xa4f9f9['error']){if(_0xa4f9f9['error'][_0xd965('0xe')]===0x1f4){logger[_0xd965('0xf')]('MemberReport,\x20%s,\x20%s',_0x368f36,_0xa4f9f9[_0xd965('0xf')][_0xd965('0x10')]);return _0x563c33(_0xa4f9f9[_0xd965('0xf')][_0xd965('0x10')]);}logger[_0xd965('0xf')]('MemberReport,\x20%s,\x20%s',_0x368f36,_0xa4f9f9[_0xd965('0xf')][_0xd965('0x10')]);return _0x427868(_0xa4f9f9['error']['message']);}else{logger['info'](_0xd965('0x11'),_0x368f36,_0xd965('0xb'));_0x427868(_0xa4f9f9[_0xd965('0x12')][_0xd965('0x10')]);}})['catch'](function(_0x439eca){logger[_0xd965('0xf')](_0xd965('0x11'),_0x368f36,_0x439eca);_0x563c33(_0x439eca);});});}exports[_0xd965('0x13')]=function(_0x45f930){var _0x5dbaff=this;return new Promise(function(_0x1321c1,_0x5e4659){return db['MemberReport']['findAll']({'raw':_0x45f930[_0xd965('0x14')]?_0x45f930[_0xd965('0x14')][_0xd965('0x15')]===undefined?!![]:![]:!![],'where':_0x45f930[_0xd965('0x14')]?_0x45f930['options'][_0xd965('0x16')]||null:null,'attributes':_0x45f930[_0xd965('0x14')]?_0x45f930[_0xd965('0x14')]['attributes']||null:null,'limit':_0x45f930['options']?_0x45f930['options'][_0xd965('0x17')]||null:null,'include':_0x45f930['options']?_0x45f930[_0xd965('0x14')][_0xd965('0x18')]?_['map'](_0x45f930['options'][_0xd965('0x18')],function(_0x140000){return{'model':db[_0x140000[_0xd965('0x19')]],'as':_0x140000['as'],'attributes':_0x140000[_0xd965('0x1a')],'include':_0x140000[_0xd965('0x18')]?_[_0xd965('0x1b')](_0x140000[_0xd965('0x18')],function(_0x1a7367){return{'model':db[_0x1a7367[_0xd965('0x19')]],'as':_0x1a7367['as'],'attributes':_0x1a7367[_0xd965('0x1a')],'include':_0x1a7367[_0xd965('0x18')]?_[_0xd965('0x1b')](_0x1a7367['include'],function(_0x3d8899){return{'model':db[_0x3d8899[_0xd965('0x19')]],'as':_0x3d8899['as'],'attributes':_0x3d8899['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d6a07){logger['info']('GetMemberReport',_0x45f930);logger[_0xd965('0xc')](_0xd965('0x13'),_0x45f930,JSON[_0xd965('0x1c')](_0x4d6a07));_0x1321c1(_0x4d6a07);})['catch'](function(_0x20b8b9){logger[_0xd965('0xf')](_0xd965('0x13'),_0x20b8b9['message'],_0x45f930);_0x5e4659(_0x5dbaff[_0xd965('0xf')](0x1f4,_0x20b8b9['message']));});});};exports['CreateMemberReport']=function(_0x5ac01e){var _0x26379d=this;return new Promise(function(_0x5d2d32,_0x29b600){return db['MemberReport'][_0xd965('0x1d')](_0x5ac01e[_0xd965('0x1e')],{'raw':_0x5ac01e[_0xd965('0x14')]?_0x5ac01e[_0xd965('0x14')]['raw']===undefined?!![]:![]:!![]})[_0xd965('0x9')](function(_0x1eb100){logger['info'](_0xd965('0x1f'),_0x5ac01e);logger[_0xd965('0xc')]('CreateMemberReport',_0x5ac01e,JSON[_0xd965('0x1c')](_0x1eb100));_0x5d2d32(_0x1eb100);})['catch'](function(_0x3c3246){logger[_0xd965('0xf')](_0xd965('0x1f'),_0x3c3246[_0xd965('0x10')],_0x5ac01e);_0x29b600(_0x26379d['error'](0x1f4,_0x3c3246[_0xd965('0x10')]));});});};exports[_0xd965('0x20')]=function(_0x4e974a){var _0x259543=this;return new Promise(function(_0x15286,_0x3dd72d){return db[_0xd965('0x21')][_0xd965('0x22')](_0x4e974a[_0xd965('0x1e')],{'raw':_0x4e974a['options']?_0x4e974a[_0xd965('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e974a[_0xd965('0x14')]?_0x4e974a[_0xd965('0x14')]['where']||null:null,'attributes':_0x4e974a[_0xd965('0x14')]?_0x4e974a[_0xd965('0x14')][_0xd965('0x1a')]||null:null,'limit':_0x4e974a[_0xd965('0x14')]?_0x4e974a[_0xd965('0x14')][_0xd965('0x17')]||null:null})[_0xd965('0x9')](function(_0xdd22bb){logger[_0xd965('0xa')](_0xd965('0x20'),_0x4e974a);logger['debug'](_0xd965('0x20'),_0x4e974a,JSON[_0xd965('0x1c')](_0xdd22bb));_0x15286(_0xdd22bb);})[_0xd965('0x23')](function(_0x48115b){logger['error']('UpdateMemberReport',_0x48115b[_0xd965('0x10')],_0x4e974a);_0x3dd72d(_0x259543[_0xd965('0xf')](0x1f4,_0x48115b[_0xd965('0x10')]));});});}; \ No newline at end of file +var _0xaa37=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','catch','CreateMemberReport','create','body','UpdateMemberReport','update','lodash'];(function(_0x29ecc8,_0x2d815b){var _0x3ffa33=function(_0x5606e9){while(--_0x5606e9){_0x29ecc8['push'](_0x29ecc8['shift']());}};_0x3ffa33(++_0x2d815b);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xaa37[_0x279d37];return _0x530173;};'use strict';var _=require(_0x7aa3('0x0'));var util=require(_0x7aa3('0x1'));var moment=require(_0x7aa3('0x2'));var BPromise=require(_0x7aa3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7aa3('0x4'));var db=require(_0x7aa3('0x5'))['db'];var utils=require(_0x7aa3('0x6'));var logger=require(_0x7aa3('0x7'))(_0x7aa3('0x8'));var config=require(_0x7aa3('0x9'));var jayson=require(_0x7aa3('0xa'));var client=jayson['client'][_0x7aa3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbbcc8a,_0x5d1627,_0x100894){return new BPromise(function(_0x390c82,_0x394097){return client['request'](_0xbbcc8a,_0x100894)[_0x7aa3('0xc')](function(_0xd0fe4){logger[_0x7aa3('0xd')](_0x7aa3('0xe'),_0x5d1627,_0x7aa3('0xf'));logger[_0x7aa3('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x5d1627,'request\x20sent',JSON[_0x7aa3('0x11')](_0xd0fe4));if(_0xd0fe4['error']){if(_0xd0fe4[_0x7aa3('0x12')][_0x7aa3('0x13')]===0x1f4){logger['error'](_0x7aa3('0xe'),_0x5d1627,_0xd0fe4[_0x7aa3('0x12')]['message']);return _0x394097(_0xd0fe4['error']['message']);}logger[_0x7aa3('0x12')](_0x7aa3('0xe'),_0x5d1627,_0xd0fe4[_0x7aa3('0x12')][_0x7aa3('0x14')]);return _0x390c82(_0xd0fe4[_0x7aa3('0x12')]['message']);}else{logger[_0x7aa3('0xd')](_0x7aa3('0xe'),_0x5d1627,_0x7aa3('0xf'));_0x390c82(_0xd0fe4[_0x7aa3('0x15')]['message']);}})['catch'](function(_0x3fab08){logger['error'](_0x7aa3('0xe'),_0x5d1627,_0x3fab08);_0x394097(_0x3fab08);});});}exports[_0x7aa3('0x16')]=function(_0x4dcefa){var _0x11ded1=this;return new Promise(function(_0xe5e683,_0x1a4f95){return db[_0x7aa3('0x17')][_0x7aa3('0x18')]({'raw':_0x4dcefa['options']?_0x4dcefa[_0x7aa3('0x19')][_0x7aa3('0x1a')]===undefined?!![]:![]:!![],'where':_0x4dcefa[_0x7aa3('0x19')]?_0x4dcefa[_0x7aa3('0x19')][_0x7aa3('0x1b')]||null:null,'attributes':_0x4dcefa[_0x7aa3('0x19')]?_0x4dcefa['options'][_0x7aa3('0x1c')]||null:null,'limit':_0x4dcefa[_0x7aa3('0x19')]?_0x4dcefa[_0x7aa3('0x19')][_0x7aa3('0x1d')]||null:null,'include':_0x4dcefa[_0x7aa3('0x19')]?_0x4dcefa['options'][_0x7aa3('0x1e')]?_[_0x7aa3('0x1f')](_0x4dcefa[_0x7aa3('0x19')][_0x7aa3('0x1e')],function(_0x3b382d){return{'model':db[_0x3b382d[_0x7aa3('0x20')]],'as':_0x3b382d['as'],'attributes':_0x3b382d[_0x7aa3('0x1c')],'include':_0x3b382d[_0x7aa3('0x1e')]?_[_0x7aa3('0x1f')](_0x3b382d[_0x7aa3('0x1e')],function(_0x44377a){return{'model':db[_0x44377a[_0x7aa3('0x20')]],'as':_0x44377a['as'],'attributes':_0x44377a[_0x7aa3('0x1c')],'include':_0x44377a['include']?_[_0x7aa3('0x1f')](_0x44377a[_0x7aa3('0x1e')],function(_0x3c1422){return{'model':db[_0x3c1422[_0x7aa3('0x20')]],'as':_0x3c1422['as'],'attributes':_0x3c1422[_0x7aa3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7aa3('0xc')](function(_0x47cf18){logger[_0x7aa3('0xd')](_0x7aa3('0x16'),_0x4dcefa);logger[_0x7aa3('0x10')]('GetMemberReport',_0x4dcefa,JSON[_0x7aa3('0x11')](_0x47cf18));_0xe5e683(_0x47cf18);})[_0x7aa3('0x21')](function(_0x539ec0){logger[_0x7aa3('0x12')](_0x7aa3('0x16'),_0x539ec0[_0x7aa3('0x14')],_0x4dcefa);_0x1a4f95(_0x11ded1[_0x7aa3('0x12')](0x1f4,_0x539ec0[_0x7aa3('0x14')]));});});};exports[_0x7aa3('0x22')]=function(_0x3adc17){var _0x3f2be1=this;return new Promise(function(_0x92de40,_0x41f981){return db[_0x7aa3('0x17')][_0x7aa3('0x23')](_0x3adc17[_0x7aa3('0x24')],{'raw':_0x3adc17[_0x7aa3('0x19')]?_0x3adc17[_0x7aa3('0x19')][_0x7aa3('0x1a')]===undefined?!![]:![]:!![]})[_0x7aa3('0xc')](function(_0x25935c){logger[_0x7aa3('0xd')](_0x7aa3('0x22'),_0x3adc17);logger[_0x7aa3('0x10')]('CreateMemberReport',_0x3adc17,JSON[_0x7aa3('0x11')](_0x25935c));_0x92de40(_0x25935c);})[_0x7aa3('0x21')](function(_0x46c4d9){logger[_0x7aa3('0x12')](_0x7aa3('0x22'),_0x46c4d9[_0x7aa3('0x14')],_0x3adc17);_0x41f981(_0x3f2be1[_0x7aa3('0x12')](0x1f4,_0x46c4d9[_0x7aa3('0x14')]));});});};exports[_0x7aa3('0x25')]=function(_0x287ca4){var _0x29e90a=this;return new Promise(function(_0x589abc,_0x3d6125){return db[_0x7aa3('0x17')][_0x7aa3('0x26')](_0x287ca4[_0x7aa3('0x24')],{'raw':_0x287ca4[_0x7aa3('0x19')]?_0x287ca4[_0x7aa3('0x19')][_0x7aa3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ca4[_0x7aa3('0x19')]?_0x287ca4[_0x7aa3('0x19')][_0x7aa3('0x1b')]||null:null,'attributes':_0x287ca4[_0x7aa3('0x19')]?_0x287ca4[_0x7aa3('0x19')][_0x7aa3('0x1c')]||null:null,'limit':_0x287ca4[_0x7aa3('0x19')]?_0x287ca4['options'][_0x7aa3('0x1d')]||null:null})[_0x7aa3('0xc')](function(_0xbdc351){logger[_0x7aa3('0xd')]('UpdateMemberReport',_0x287ca4);logger[_0x7aa3('0x10')]('UpdateMemberReport',_0x287ca4,JSON[_0x7aa3('0x11')](_0xbdc351));_0x589abc(_0xbdc351);})[_0x7aa3('0x21')](function(_0x63b4a9){logger[_0x7aa3('0x12')](_0x7aa3('0x25'),_0x63b4a9[_0x7aa3('0x14')],_0x287ca4);_0x3d6125(_0x29e90a[_0x7aa3('0x12')](0x1f4,_0x63b4a9[_0x7aa3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 9a3e5a5..ee20c44 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 _0x4b5b=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','exports','util'];(function(_0x166b97,_0x21bd32){var _0x4dcd02=function(_0x5133e8){while(--_0x5133e8){_0x166b97['push'](_0x166b97['shift']());}};_0x4dcd02(++_0x21bd32);}(_0x4b5b,0x1c1));var _0xb4b5=function(_0x2ad646,_0x116355){_0x2ad646=_0x2ad646-0x0;var _0x2d2bcd=_0x4b5b[_0x2ad646];return _0x2d2bcd;};'use strict';var multer=require('multer');var util=require(_0xb4b5('0x0'));var path=require(_0xb4b5('0x1'));var timeout=require(_0xb4b5('0x2'));var express=require(_0xb4b5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb4b5('0x4'));var interaction=require(_0xb4b5('0x5'));var config=require(_0xb4b5('0x6'));var controller=require(_0xb4b5('0x7'));router[_0xb4b5('0x8')]('/',controller['index']);module[_0xb4b5('0x9')]=router; \ No newline at end of file +var _0x2e63=['get','index','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller'];(function(_0x4bd4f2,_0x16c911){var _0x258c41=function(_0x42af96){while(--_0x42af96){_0x4bd4f2['push'](_0x4bd4f2['shift']());}};_0x258c41(++_0x16c911);}(_0x2e63,0x6f));var _0x32e6=function(_0x27b1da,_0xc8abcf){_0x27b1da=_0x27b1da-0x0;var _0x27f050=_0x2e63[_0x27b1da];return _0x27f050;};'use strict';var multer=require('multer');var util=require(_0x32e6('0x0'));var path=require(_0x32e6('0x1'));var timeout=require(_0x32e6('0x2'));var express=require(_0x32e6('0x3'));var router=express[_0x32e6('0x4')]();var fs_extra=require(_0x32e6('0x5'));var auth=require(_0x32e6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x32e6('0x7'));var controller=require(_0x32e6('0x8'));router[_0x32e6('0x9')]('/',controller[_0x32e6('0xa')]);module[_0x32e6('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 245bcee..f547ea6 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 _0x7d68=['version','exports'];(function(_0x5b13e0,_0x248ca4){var _0x5ac9a0=function(_0x29bb6f){while(--_0x29bb6f){_0x5b13e0['push'](_0x5b13e0['shift']());}};_0x5ac9a0(++_0x248ca4);}(_0x7d68,0x99));var _0x87d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d68[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x87d6('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x87d6('0x1')}}; \ No newline at end of file +var _0x94f8=['STRING','version','sequelize','exports'];(function(_0x38edaf,_0x399972){var _0x1b11f8=function(_0x1b45fb){while(--_0x1b45fb){_0x38edaf['push'](_0x38edaf['shift']());}};_0x1b11f8(++_0x399972);}(_0x94f8,0x19e));var _0x894f=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0x94f8[_0x1e9424];return _0x1bd96c;};'use strict';var Sequelize=require(_0x894f('0x0'));module[_0x894f('0x1')]={'version':{'type':Sequelize[_0x894f('0x2')],'unique':_0x894f('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 6bd65fa..d5d08dd 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 _0x33a4=['where','merge','VIRTUAL','include','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','Migration','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','length','attributes','hasOwnProperty','sort','filters','pick','filter'];(function(_0x37c32e,_0xb05ce4){var _0x2440d8=function(_0x3a4779){while(--_0x3a4779){_0x37c32e['push'](_0x37c32e['shift']());}};_0x2440d8(++_0xb05ce4);}(_0x33a4,0x1c4));var _0x433a=function(_0x17c1ef,_0x541b39){_0x17c1ef=_0x17c1ef-0x0;var _0x49e779=_0x33a4[_0x17c1ef];return _0x49e779;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x433a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x433a('0x1'));var moment=require('moment');var BPromise=require(_0x433a('0x2'));var Mustache=require(_0x433a('0x3'));var util=require(_0x433a('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x433a('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x433a('0x6'));var _=require(_0x433a('0x7'));var squel=require(_0x433a('0x8'));var crypto=require(_0x433a('0x9'));var jsforce=require(_0x433a('0xa'));var deskjs=require(_0x433a('0xb'));var toCsv=require(_0x433a('0x5'));var querystring=require(_0x433a('0xc'));var Papa=require(_0x433a('0xd'));var Redis=require(_0x433a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x433a('0xf'));var as=require(_0x433a('0x10'));var hardwareService=require(_0x433a('0x11'));var logger=require(_0x433a('0x12'))(_0x433a('0x13'));var utils=require(_0x433a('0x14'));var config=require(_0x433a('0x15'));var licenseUtil=require(_0x433a('0x16'));var db=require(_0x433a('0x17'))['db'];function respondWithStatusCode(_0x5e1464,_0x51bcb5){_0x51bcb5=_0x51bcb5||0xcc;return function(_0x5f33b1){if(_0x5f33b1){return _0x5e1464[_0x433a('0x18')](_0x51bcb5);}return _0x5e1464[_0x433a('0x19')](_0x51bcb5)[_0x433a('0x1a')]();};}function respondWithResult(_0x4281e2,_0x12cb0d){_0x12cb0d=_0x12cb0d||0xc8;return function(_0x3cb460){if(_0x3cb460){return _0x4281e2[_0x433a('0x19')](_0x12cb0d)[_0x433a('0x1b')](_0x3cb460);}};}function respondWithFilteredResult(_0x52d0c1,_0x361037){return function(_0x5c6854){if(_0x5c6854){var _0x1c1aa3=typeof _0x361037[_0x433a('0x1c')]===_0x433a('0x1d')&&typeof _0x361037[_0x433a('0x1e')]==='undefined';var _0x3ad9fb=_0x5c6854[_0x433a('0x1f')];var _0x114790=_0x1c1aa3?0x0:_0x361037['offset'];var _0x5aac09=_0x1c1aa3?_0x5c6854[_0x433a('0x1f')]:_0x361037[_0x433a('0x1c')]+_0x361037[_0x433a('0x1e')];var _0x114e95;if(_0x5aac09>=_0x3ad9fb){_0x5aac09=_0x3ad9fb;_0x114e95=0xc8;}else{_0x114e95=0xce;}_0x52d0c1[_0x433a('0x19')](_0x114e95);return _0x52d0c1[_0x433a('0x20')](_0x433a('0x21'),_0x114790+'-'+_0x5aac09+'/'+_0x3ad9fb)['json'](_0x5c6854);}return null;};}function patchUpdates(_0x144c25){return function(_0x260f14){try{jsonpatch['apply'](_0x260f14,_0x144c25,!![]);}catch(_0x4e1bd7){return BPromise['reject'](_0x4e1bd7);}return _0x260f14[_0x433a('0x22')]();};}function saveUpdates(_0x2e5ff8,_0x24adef){return function(_0x428afa){if(_0x428afa){return _0x428afa[_0x433a('0x23')](_0x2e5ff8)[_0x433a('0x24')](function(_0x13c213){return _0x13c213;});}return null;};}function removeEntity(_0x50e784,_0x183250){return function(_0x4db894){if(_0x4db894){return _0x4db894[_0x433a('0x25')]()[_0x433a('0x24')](function(){_0x50e784[_0x433a('0x19')](0xcc)[_0x433a('0x1a')]();});}};}function handleEntityNotFound(_0x5cc51c,_0x3edcc0){return function(_0x9995d9){if(!_0x9995d9){_0x5cc51c['sendStatus'](0x194);}return _0x9995d9;};}function handleError(_0x489da3,_0x186fa2){_0x186fa2=_0x186fa2||0x1f4;return function(_0x154d3d){logger[_0x433a('0x26')](_0x154d3d[_0x433a('0x27')]);if(_0x154d3d['name']){delete _0x154d3d[_0x433a('0x28')];}_0x489da3[_0x433a('0x19')](_0x186fa2)['send'](_0x154d3d);};}exports[_0x433a('0x29')]=function(_0x273ee9,_0x3c20a7){var _0x34b93c={},_0x4f8fea={},_0x168fde={'count':0x0,'rows':[]};var _0x31eaa0=_[_0x433a('0x2a')](db[_0x433a('0x2b')][_0x433a('0x2c')],function(_0x20e0ca){return{'name':_0x20e0ca[_0x433a('0x2d')],'type':_0x20e0ca[_0x433a('0x2e')][_0x433a('0x2f')]};});_0x4f8fea[_0x433a('0x30')]=_['map'](_0x31eaa0,_0x433a('0x28'));_0x4f8fea['query']=_[_0x433a('0x31')](_0x273ee9['query']);_0x4f8fea['filters']=_['intersection'](_0x4f8fea[_0x433a('0x30')],_0x4f8fea[_0x433a('0x32')]);_0x34b93c['attributes']=_[_0x433a('0x33')](_0x4f8fea[_0x433a('0x30')],qs[_0x433a('0x34')](_0x273ee9[_0x433a('0x32')]['fields']));_0x34b93c['attributes']=_0x34b93c['attributes'][_0x433a('0x35')]?_0x34b93c[_0x433a('0x36')]:_0x4f8fea['model'];if(!_0x273ee9['query'][_0x433a('0x37')]('nolimit')){_0x34b93c['limit']=qs[_0x433a('0x1e')](_0x273ee9['query'][_0x433a('0x1e')]);_0x34b93c[_0x433a('0x1c')]=qs[_0x433a('0x1c')](_0x273ee9[_0x433a('0x32')][_0x433a('0x1c')]);}_0x34b93c['order']=qs['sort'](_0x273ee9[_0x433a('0x32')][_0x433a('0x38')]);_0x34b93c['where']=qs[_0x433a('0x39')](_[_0x433a('0x3a')](_0x273ee9[_0x433a('0x32')],_0x4f8fea['filters']),_0x31eaa0);if(_0x273ee9[_0x433a('0x32')][_0x433a('0x3b')]){_0x34b93c[_0x433a('0x3c')]=_[_0x433a('0x3d')](_0x34b93c[_0x433a('0x3c')],{'$or':_['map'](_0x31eaa0,function(_0xf9bc53){if(_0xf9bc53[_0x433a('0x2e')]!==_0x433a('0x3e')){var _0x11f7e8={};_0x11f7e8[_0xf9bc53[_0x433a('0x28')]]={'$like':'%'+_0x273ee9[_0x433a('0x32')][_0x433a('0x3b')]+'%'};return _0x11f7e8;}})});}_0x34b93c=_[_0x433a('0x3d')]({},_0x34b93c,_0x273ee9['options']);var _0x566c4a={'where':_0x34b93c[_0x433a('0x3c')]};return db[_0x433a('0x2b')][_0x433a('0x1f')](_0x566c4a)[_0x433a('0x24')](function(_0x38330c){_0x168fde[_0x433a('0x1f')]=_0x38330c;if(_0x273ee9[_0x433a('0x32')]['includeAll']){_0x34b93c[_0x433a('0x3f')]=[{'all':!![]}];}return db[_0x433a('0x2b')]['findAll'](_0x34b93c);})[_0x433a('0x24')](function(_0x2eac58){_0x168fde['rows']=_0x2eac58;return _0x168fde;})['then'](respondWithFilteredResult(_0x3c20a7,_0x34b93c))['catch'](handleError(_0x3c20a7,null));}; \ No newline at end of file +var _0x1512=['mustache','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','index','Migration','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','rimraf','fast-json-patch','request-promise','moment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1512,0xd4));var _0x2151=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1512[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2151('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2151('0x1'));var rp=require(_0x2151('0x2'));var moment=require(_0x2151('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2151('0x4'));var util=require('util');var path=require(_0x2151('0x5'));var sox=require(_0x2151('0x6'));var csv=require('to-csv');var ejs=require(_0x2151('0x7'));var fs=require('fs');var fs_extra=require(_0x2151('0x8'));var _=require(_0x2151('0x9'));var squel=require(_0x2151('0xa'));var crypto=require(_0x2151('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2151('0xc'));var toCsv=require(_0x2151('0xd'));var querystring=require(_0x2151('0xe'));var Papa=require(_0x2151('0xf'));var Redis=require(_0x2151('0x10'));var authService=require(_0x2151('0x11'));var qs=require(_0x2151('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2151('0x13'));var logger=require(_0x2151('0x14'))(_0x2151('0x15'));var utils=require(_0x2151('0x16'));var config=require(_0x2151('0x17'));var licenseUtil=require(_0x2151('0x18'));var db=require(_0x2151('0x19'))['db'];function respondWithStatusCode(_0x160945,_0x4b0835){_0x4b0835=_0x4b0835||0xcc;return function(_0x1a50d5){if(_0x1a50d5){return _0x160945[_0x2151('0x1a')](_0x4b0835);}return _0x160945[_0x2151('0x1b')](_0x4b0835)['end']();};}function respondWithResult(_0x5ce0b1,_0x5602fa){_0x5602fa=_0x5602fa||0xc8;return function(_0x52ef26){if(_0x52ef26){return _0x5ce0b1[_0x2151('0x1b')](_0x5602fa)['json'](_0x52ef26);}};}function respondWithFilteredResult(_0x168f2e,_0x19d4da){return function(_0x2579a1){if(_0x2579a1){var _0x3ee031=typeof _0x19d4da['offset']===_0x2151('0x1c')&&typeof _0x19d4da[_0x2151('0x1d')]===_0x2151('0x1c');var _0x26a35d=_0x2579a1[_0x2151('0x1e')];var _0x5a8b60=_0x3ee031?0x0:_0x19d4da[_0x2151('0x1f')];var _0x37fed4=_0x3ee031?_0x2579a1[_0x2151('0x1e')]:_0x19d4da['offset']+_0x19d4da[_0x2151('0x1d')];var _0x14a773;if(_0x37fed4>=_0x26a35d){_0x37fed4=_0x26a35d;_0x14a773=0xc8;}else{_0x14a773=0xce;}_0x168f2e['status'](_0x14a773);return _0x168f2e[_0x2151('0x20')](_0x2151('0x21'),_0x5a8b60+'-'+_0x37fed4+'/'+_0x26a35d)[_0x2151('0x22')](_0x2579a1);}return null;};}function patchUpdates(_0x3bad05){return function(_0x28a2c5){try{jsonpatch[_0x2151('0x23')](_0x28a2c5,_0x3bad05,!![]);}catch(_0x1c53e3){return BPromise[_0x2151('0x24')](_0x1c53e3);}return _0x28a2c5[_0x2151('0x25')]();};}function saveUpdates(_0x11ad2f,_0x448c46){return function(_0xf43488){if(_0xf43488){return _0xf43488[_0x2151('0x26')](_0x11ad2f)[_0x2151('0x27')](function(_0x2808eb){return _0x2808eb;});}return null;};}function removeEntity(_0x117d76,_0x31803b){return function(_0x40ed30){if(_0x40ed30){return _0x40ed30['destroy']()['then'](function(){_0x117d76[_0x2151('0x1b')](0xcc)[_0x2151('0x28')]();});}};}function handleEntityNotFound(_0x538e80,_0x332f95){return function(_0x4de4ec){if(!_0x4de4ec){_0x538e80['sendStatus'](0x194);}return _0x4de4ec;};}function handleError(_0x47e094,_0x230150){_0x230150=_0x230150||0x1f4;return function(_0x1b0f3b){logger[_0x2151('0x29')](_0x1b0f3b[_0x2151('0x2a')]);if(_0x1b0f3b[_0x2151('0x2b')]){delete _0x1b0f3b['name'];}_0x47e094[_0x2151('0x1b')](_0x230150)['send'](_0x1b0f3b);};}exports[_0x2151('0x2c')]=function(_0x5e6c15,_0x2b7767){var _0x41ffa7={},_0x4ab6a5={},_0x251cde={'count':0x0,'rows':[]};var _0x1463da=_['map'](db[_0x2151('0x2d')][_0x2151('0x2e')],function(_0x40996f){return{'name':_0x40996f[_0x2151('0x2f')],'type':_0x40996f['type']['key']};});_0x4ab6a5[_0x2151('0x30')]=_['map'](_0x1463da,'name');_0x4ab6a5[_0x2151('0x31')]=_[_0x2151('0x32')](_0x5e6c15[_0x2151('0x31')]);_0x4ab6a5['filters']=_[_0x2151('0x33')](_0x4ab6a5[_0x2151('0x30')],_0x4ab6a5[_0x2151('0x31')]);_0x41ffa7[_0x2151('0x34')]=_[_0x2151('0x33')](_0x4ab6a5[_0x2151('0x30')],qs[_0x2151('0x35')](_0x5e6c15[_0x2151('0x31')][_0x2151('0x35')]));_0x41ffa7[_0x2151('0x34')]=_0x41ffa7['attributes'][_0x2151('0x36')]?_0x41ffa7[_0x2151('0x34')]:_0x4ab6a5[_0x2151('0x30')];if(!_0x5e6c15[_0x2151('0x31')][_0x2151('0x37')](_0x2151('0x38'))){_0x41ffa7[_0x2151('0x1d')]=qs['limit'](_0x5e6c15['query'][_0x2151('0x1d')]);_0x41ffa7[_0x2151('0x1f')]=qs[_0x2151('0x1f')](_0x5e6c15[_0x2151('0x31')][_0x2151('0x1f')]);}_0x41ffa7[_0x2151('0x39')]=qs['sort'](_0x5e6c15[_0x2151('0x31')][_0x2151('0x3a')]);_0x41ffa7[_0x2151('0x3b')]=qs['filters'](_[_0x2151('0x3c')](_0x5e6c15[_0x2151('0x31')],_0x4ab6a5['filters']),_0x1463da);if(_0x5e6c15['query'][_0x2151('0x3d')]){_0x41ffa7['where']=_['merge'](_0x41ffa7['where'],{'$or':_[_0x2151('0x3e')](_0x1463da,function(_0x559cae){if(_0x559cae[_0x2151('0x3f')]!==_0x2151('0x40')){var _0x2326bc={};_0x2326bc[_0x559cae[_0x2151('0x2b')]]={'$like':'%'+_0x5e6c15[_0x2151('0x31')][_0x2151('0x3d')]+'%'};return _0x2326bc;}})});}_0x41ffa7=_[_0x2151('0x41')]({},_0x41ffa7,_0x5e6c15[_0x2151('0x42')]);var _0x40883f={'where':_0x41ffa7[_0x2151('0x3b')]};return db[_0x2151('0x2d')][_0x2151('0x1e')](_0x40883f)[_0x2151('0x27')](function(_0x42c7df){_0x251cde[_0x2151('0x1e')]=_0x42c7df;if(_0x5e6c15[_0x2151('0x31')][_0x2151('0x43')]){_0x41ffa7[_0x2151('0x44')]=[{'all':!![]}];}return db[_0x2151('0x2d')][_0x2151('0x45')](_0x41ffa7);})[_0x2151('0x27')](function(_0x39adde){_0x251cde[_0x2151('0x46')]=_0x39adde;return _0x251cde;})[_0x2151('0x27')](respondWithFilteredResult(_0x2b7767,_0x41ffa7))[_0x2151('0x47')](handleError(_0x2b7767,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 7b12999..8934581 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 _0x14e7=['rimraf','./migration.attributes','exports','Migration','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4b7fbf,_0x2e3831){var _0x33bb60=function(_0x48fdf3){while(--_0x48fdf3){_0x4b7fbf['push'](_0x4b7fbf['shift']());}};_0x33bb60(++_0x2e3831);}(_0x14e7,0x16f));var _0x714e=function(_0xd2010a,_0x1780c2){_0xd2010a=_0xd2010a-0x0;var _0x4c4704=_0x14e7[_0xd2010a];return _0x4c4704;};'use strict';var _=require(_0x714e('0x0'));var util=require(_0x714e('0x1'));var logger=require(_0x714e('0x2'))(_0x714e('0x3'));var moment=require(_0x714e('0x4'));var BPromise=require(_0x714e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x714e('0x6'));var rimraf=require(_0x714e('0x7'));var config=require('../../config/environment');var attributes=require(_0x714e('0x8'));module[_0x714e('0x9')]=function(_0x2b76b0,_0x37f3b1){return _0x2b76b0['define'](_0x714e('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bea=['migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define'];(function(_0x516eba,_0x2efa70){var _0x184bf4=function(_0x57a318){while(--_0x57a318){_0x516eba['push'](_0x516eba['shift']());}};_0x184bf4(++_0x2efa70);}(_0x8bea,0x151));var _0xa8be=function(_0xeb879e,_0x5b8ed8){_0xeb879e=_0xeb879e-0x0;var _0x2c4ba5=_0x8bea[_0xeb879e];return _0x2c4ba5;};'use strict';var _=require(_0xa8be('0x0'));var util=require(_0xa8be('0x1'));var logger=require(_0xa8be('0x2'))(_0xa8be('0x3'));var moment=require(_0xa8be('0x4'));var BPromise=require(_0xa8be('0x5'));var rp=require(_0xa8be('0x6'));var fs=require('fs');var path=require(_0xa8be('0x7'));var rimraf=require(_0xa8be('0x8'));var config=require(_0xa8be('0x9'));var attributes=require(_0xa8be('0xa'));module[_0xa8be('0xb')]=function(_0x1d44e6,_0x45401c){return _0x1d44e6[_0xa8be('0xc')]('Migration',attributes,{'tableName':_0xa8be('0xd'),'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 33b9290..239c768 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 _0x3cfb=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0xd1805a,_0x3ea5cb){var _0x1b06f3=function(_0x67ceb9){while(--_0x67ceb9){_0xd1805a['push'](_0xd1805a['shift']());}};_0x1b06f3(++_0x3ea5cb);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x51b8dd,_0x8c9886){_0x51b8dd=_0x51b8dd-0x0;var _0x549961=_0x3cfb[_0x51b8dd];return _0x549961;};'use strict';var _=require(_0xb3cf('0x0'));var util=require(_0xb3cf('0x1'));var moment=require(_0xb3cf('0x2'));var BPromise=require(_0xb3cf('0x3'));var rs=require(_0xb3cf('0x4'));var fs=require('fs');var Redis=require(_0xb3cf('0x5'));var db=require(_0xb3cf('0x6'))['db'];var utils=require(_0xb3cf('0x7'));var logger=require('../../config/logger')(_0xb3cf('0x8'));var config=require(_0xb3cf('0x9'));var jayson=require(_0xb3cf('0xa'));var client=jayson['client'][_0xb3cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b7131,_0x42ce15,_0x53be8c){return new BPromise(function(_0x19ed7d,_0x4e4cc8){return client['request'](_0x1b7131,_0x53be8c)[_0xb3cf('0xc')](function(_0x44a55d){logger[_0xb3cf('0xd')](_0xb3cf('0xe'),_0x42ce15,_0xb3cf('0xf'));logger[_0xb3cf('0x10')](_0xb3cf('0x11'),_0x42ce15,_0xb3cf('0xf'),JSON[_0xb3cf('0x12')](_0x44a55d));if(_0x44a55d[_0xb3cf('0x13')]){if(_0x44a55d[_0xb3cf('0x13')][_0xb3cf('0x14')]===0x1f4){logger[_0xb3cf('0x13')](_0xb3cf('0xe'),_0x42ce15,_0x44a55d[_0xb3cf('0x13')]['message']);return _0x4e4cc8(_0x44a55d['error'][_0xb3cf('0x15')]);}logger[_0xb3cf('0x13')]('Migration,\x20%s,\x20%s',_0x42ce15,_0x44a55d[_0xb3cf('0x13')]['message']);return _0x19ed7d(_0x44a55d['error'][_0xb3cf('0x15')]);}else{logger[_0xb3cf('0xd')](_0xb3cf('0xe'),_0x42ce15,'request\x20sent');_0x19ed7d(_0x44a55d[_0xb3cf('0x16')][_0xb3cf('0x15')]);}})[_0xb3cf('0x17')](function(_0x442fd6){logger[_0xb3cf('0x13')](_0xb3cf('0xe'),_0x42ce15,_0x442fd6);_0x4e4cc8(_0x442fd6);});});} \ No newline at end of file +var _0x195e=['info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x394268,_0x13f0ff){var _0x736a21=function(_0x71e22d){while(--_0x71e22d){_0x394268['push'](_0x394268['shift']());}};_0x736a21(++_0x13f0ff);}(_0x195e,0xfb));var _0xe195=function(_0x4694e9,_0x466e18){_0x4694e9=_0x4694e9-0x0;var _0x2e855e=_0x195e[_0x4694e9];return _0x2e855e;};'use strict';var _=require(_0xe195('0x0'));var util=require(_0xe195('0x1'));var moment=require(_0xe195('0x2'));var BPromise=require(_0xe195('0x3'));var rs=require(_0xe195('0x4'));var fs=require('fs');var Redis=require(_0xe195('0x5'));var db=require(_0xe195('0x6'))['db'];var utils=require(_0xe195('0x7'));var logger=require(_0xe195('0x8'))(_0xe195('0x9'));var config=require(_0xe195('0xa'));var jayson=require(_0xe195('0xb'));var client=jayson[_0xe195('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a1acc,_0x663106,_0x2ead59){return new BPromise(function(_0x28c1a9,_0x3164c3){return client['request'](_0x2a1acc,_0x2ead59)['then'](function(_0x5f333b){logger[_0xe195('0xd')](_0xe195('0xe'),_0x663106,_0xe195('0xf'));logger[_0xe195('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x663106,_0xe195('0xf'),JSON[_0xe195('0x11')](_0x5f333b));if(_0x5f333b[_0xe195('0x12')]){if(_0x5f333b['error'][_0xe195('0x13')]===0x1f4){logger[_0xe195('0x12')]('Migration,\x20%s,\x20%s',_0x663106,_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);return _0x3164c3(_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);}logger['error'](_0xe195('0xe'),_0x663106,_0x5f333b[_0xe195('0x12')]['message']);return _0x28c1a9(_0x5f333b['error'][_0xe195('0x14')]);}else{logger['info'](_0xe195('0xe'),_0x663106,'request\x20sent');_0x28c1a9(_0x5f333b['result'][_0xe195('0x14')]);}})[_0xe195('0x15')](function(_0x277362){logger[_0xe195('0x12')](_0xe195('0xe'),_0x663106,_0x277362);_0x3164c3(_0x277362);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 2043d8d..360d162 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 _0x65cb=['../../config/environment','./network.controller','isAuthenticated','index','get','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x371e8f,_0x16584e){var _0x3c031a=function(_0x23a589){while(--_0x23a589){_0x371e8f['push'](_0x371e8f['shift']());}};_0x3c031a(++_0x16584e);}(_0x65cb,0xa4));var _0xb65c=function(_0x6f287a,_0xc92ab4){_0x6f287a=_0x6f287a-0x0;var _0x51df4e=_0x65cb[_0x6f287a];return _0x51df4e;};'use strict';var multer=require(_0xb65c('0x0'));var util=require('util');var path=require(_0xb65c('0x1'));var timeout=require(_0xb65c('0x2'));var express=require(_0xb65c('0x3'));var router=express['Router']();var fs_extra=require(_0xb65c('0x4'));var auth=require(_0xb65c('0x5'));var interaction=require(_0xb65c('0x6'));var config=require(_0xb65c('0x7'));var controller=require(_0xb65c('0x8'));router['get']('/',auth[_0xb65c('0x9')](),controller[_0xb65c('0xa')]);router[_0xb65c('0xb')](_0xb65c('0xc'),auth[_0xb65c('0x9')](),controller[_0xb65c('0xd')]);router[_0xb65c('0xe')]('/',auth[_0xb65c('0x9')](),controller['create']);router[_0xb65c('0xf')](_0xb65c('0xc'),auth[_0xb65c('0x9')](),controller[_0xb65c('0x10')]);router['delete'](_0xb65c('0xc'),auth['isAuthenticated'](),controller[_0xb65c('0x11')]);module[_0xb65c('0x12')]=router; \ No newline at end of file +var _0x9d76=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x9d76,0x76));var _0x69d7=function(_0x179fa5,_0x2f23d1){_0x179fa5=_0x179fa5-0x0;var _0x105a03=_0x9d76[_0x179fa5];return _0x105a03;};'use strict';var multer=require(_0x69d7('0x0'));var util=require('util');var path=require(_0x69d7('0x1'));var timeout=require(_0x69d7('0x2'));var express=require(_0x69d7('0x3'));var router=express[_0x69d7('0x4')]();var fs_extra=require(_0x69d7('0x5'));var auth=require(_0x69d7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x69d7('0x7'));router[_0x69d7('0x8')]('/',auth[_0x69d7('0x9')](),controller[_0x69d7('0xa')]);router['get'](_0x69d7('0xb'),auth[_0x69d7('0x9')](),controller[_0x69d7('0xc')]);router[_0x69d7('0xd')]('/',auth[_0x69d7('0x9')](),controller[_0x69d7('0xe')]);router[_0x69d7('0xf')](_0x69d7('0xb'),auth['isAuthenticated'](),controller[_0x69d7('0x10')]);router[_0x69d7('0x11')](_0x69d7('0xb'),auth[_0x69d7('0x9')](),controller[_0x69d7('0x12')]);module[_0x69d7('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 5533181..6dbddb2 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 _0x2766=['stun','turn','STRING','sequelize','exports','ENUM'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2766,0x177));var _0x6276=function(_0x16b334,_0x58bd7f){_0x16b334=_0x16b334-0x0;var _0x54aff2=_0x2766[_0x16b334];return _0x54aff2;};'use strict';var Sequelize=require(_0x6276('0x0'));module[_0x6276('0x1')]={'type':{'type':Sequelize[_0x6276('0x2')]('localnet','externip',_0x6276('0x3'),_0x6276('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x6276('0x5')]}}; \ No newline at end of file +var _0x60f7=['ENUM','localnet','externip','stun','turn','STRING','sequelize','exports'];(function(_0x2731bf,_0x2c9cae){var _0x11f19b=function(_0x3048bb){while(--_0x3048bb){_0x2731bf['push'](_0x2731bf['shift']());}};_0x11f19b(++_0x2c9cae);}(_0x60f7,0xd6));var _0x760f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x60f7[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x760f('0x0'));module[_0x760f('0x1')]={'type':{'type':Sequelize[_0x760f('0x2')](_0x760f('0x3'),_0x760f('0x4'),_0x760f('0x5'),_0x760f('0x6'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x760f('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 0029deb..db3aef1 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 _0x3a86=['toUpperCase','TURN','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','format','STUN','toLowerCase','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','status','offset','undefined','limit','count','update','then','destroy','sendStatus','stack','name','index','rawAttributes','fieldName','key','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','type','VIRTUAL','filter','merge','options','Network','includeAll','include','rows','show','params','find','create','body','findAll','readFileSync','join','root','utf8','render','/etc/asterisk/stun_xcally.conf'];(function(_0x4d7a61,_0x3fb6e6){var _0x186f73=function(_0x4eeeeb){while(--_0x4eeeeb){_0x4d7a61['push'](_0x4d7a61['shift']());}};_0x186f73(++_0x3fb6e6);}(_0x3a86,0x1b7));var _0x63a8=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x3a86[_0x23e7c1];return _0x1add43;};'use strict';var util=require(_0x63a8('0x0'));var path=require(_0x63a8('0x1'));var ejs=require(_0x63a8('0x2'));var fs=require('fs');var _=require(_0x63a8('0x3'));var qs=require(_0x63a8('0x4'));var logger=require(_0x63a8('0x5'))(_0x63a8('0x6'));var config=require(_0x63a8('0x7'));var db=require(_0x63a8('0x8'))['db'];var jayson=require(_0x63a8('0x9'));var client=jayson[_0x63a8('0xa')][_0x63a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b1e4e,_0x145a50,_0x3c1492,_0xe30b49){return new Promise(function(_0x4cc411,_0x587171){var _0x512cf3=_0xe30b49||client;return _0x512cf3[_0x63a8('0xc')](_0x1b1e4e,_0x3c1492)['then'](function(_0x1d85a1){logger[_0x63a8('0xd')](_0x63a8('0xe'),_0x145a50,'request\x20sent');logger[_0x63a8('0xf')]('Network,\x20%s,\x20%s,\x20%s',_0x145a50,'request\x20sent',JSON[_0x63a8('0x10')](_0x1d85a1));if(_0x1d85a1[_0x63a8('0x11')]){if(_0x1d85a1[_0x63a8('0x11')][_0x63a8('0x12')]===0x1f4){logger[_0x63a8('0x11')](_0x63a8('0xe'),_0x145a50,_0x1d85a1['error'][_0x63a8('0x13')]);return _0x587171(_0x1d85a1['error'][_0x63a8('0x13')]);}logger[_0x63a8('0x11')]('Network,\x20%s,\x20%s',_0x145a50,_0x1d85a1['error'][_0x63a8('0x13')]);return _0x4cc411(_0x1d85a1[_0x63a8('0x11')]['message']);}else{logger[_0x63a8('0xd')]('Network,\x20%s,\x20%s',_0x145a50,_0x63a8('0x14'));_0x4cc411(_0x1d85a1[_0x63a8('0x15')]['message']);}})[_0x63a8('0x16')](function(_0x5112a8){logger[_0x63a8('0x11')](_0x63a8('0xe'),_0x145a50,_0x5112a8);_0x587171(_0x5112a8);});});}function respondWithResult(_0x1e93ae,_0x593bcf){_0x593bcf=_0x593bcf||0xc8;return function(_0x2f40a0){if(_0x2f40a0){return _0x1e93ae[_0x63a8('0x17')](_0x593bcf)['json'](_0x2f40a0);}};}function respondWithFilteredResult(_0x17a13d,_0x3e7d33){return function(_0x3c9eb8){if(_0x3c9eb8){var _0x3ba199=typeof _0x3e7d33[_0x63a8('0x18')]===_0x63a8('0x19')&&typeof _0x3e7d33[_0x63a8('0x1a')]===_0x63a8('0x19');var _0x3f6b50=_0x3c9eb8[_0x63a8('0x1b')];var _0x23976e=_0x3ba199?0x0:_0x3e7d33['offset'];var _0x2ec060=_0x3ba199?_0x3c9eb8[_0x63a8('0x1b')]:_0x3e7d33[_0x63a8('0x18')]+_0x3e7d33['limit'];var _0x42d512;if(_0x2ec060>=_0x3f6b50){_0x2ec060=_0x3f6b50;_0x42d512=0xc8;}else{_0x42d512=0xce;}_0x17a13d['status'](_0x42d512);return _0x17a13d['set']('Content-Range',_0x23976e+'-'+_0x2ec060+'/'+_0x3f6b50)['json'](_0x3c9eb8);}return null;};}function saveUpdates(_0x26536c){return function(_0xffd1f3){if(_0xffd1f3){return _0xffd1f3[_0x63a8('0x1c')](_0x26536c)[_0x63a8('0x1d')](function(_0x99c0f0){return _0x99c0f0;});}return null;};}function removeEntity(_0x34accb){return function(_0x331b79){if(_0x331b79){return _0x331b79[_0x63a8('0x1e')]()[_0x63a8('0x1d')](function(){_0x34accb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x334cec){return function(_0x40dd5a){if(!_0x40dd5a){_0x334cec[_0x63a8('0x1f')](0x194);}return _0x40dd5a;};}function handleError(_0x23b420,_0x152a6f){_0x152a6f=_0x152a6f||0x1f4;return function(_0x289e85){logger[_0x63a8('0x11')](_0x289e85[_0x63a8('0x20')]);if(_0x289e85[_0x63a8('0x21')]){delete _0x289e85[_0x63a8('0x21')];}_0x23b420[_0x63a8('0x17')](_0x152a6f)['send'](_0x289e85);};}exports[_0x63a8('0x22')]=function(_0x2c1f14,_0x5ec95a){var _0x4de6e4={},_0x3d8894={},_0x47ecc8={'count':0x0,'rows':[]};var _0x5bb8f5=_['map'](db['Network'][_0x63a8('0x23')],function(_0x3a3ede){return{'name':_0x3a3ede[_0x63a8('0x24')],'type':_0x3a3ede['type'][_0x63a8('0x25')]};});_0x3d8894['model']=_[_0x63a8('0x26')](_0x5bb8f5,_0x63a8('0x21'));_0x3d8894[_0x63a8('0x27')]=_[_0x63a8('0x28')](_0x2c1f14[_0x63a8('0x27')]);_0x3d8894['filters']=_[_0x63a8('0x29')](_0x3d8894[_0x63a8('0x2a')],_0x3d8894[_0x63a8('0x27')]);_0x4de6e4['attributes']=_['intersection'](_0x3d8894[_0x63a8('0x2a')],qs[_0x63a8('0x2b')](_0x2c1f14[_0x63a8('0x27')][_0x63a8('0x2b')]));_0x4de6e4[_0x63a8('0x2c')]=_0x4de6e4['attributes']['length']?_0x4de6e4[_0x63a8('0x2c')]:_0x3d8894[_0x63a8('0x2a')];if(!_0x2c1f14[_0x63a8('0x27')][_0x63a8('0x2d')](_0x63a8('0x2e'))){_0x4de6e4[_0x63a8('0x1a')]=qs[_0x63a8('0x1a')](_0x2c1f14['query'][_0x63a8('0x1a')]);_0x4de6e4['offset']=qs['offset'](_0x2c1f14[_0x63a8('0x27')]['offset']);}_0x4de6e4['order']=qs[_0x63a8('0x2f')](_0x2c1f14[_0x63a8('0x27')][_0x63a8('0x2f')]);_0x4de6e4[_0x63a8('0x30')]=qs[_0x63a8('0x31')](_['pick'](_0x2c1f14[_0x63a8('0x27')],_0x3d8894['filters']),_0x5bb8f5);if(_0x2c1f14[_0x63a8('0x27')]['filter']){_0x4de6e4['where']=_['merge'](_0x4de6e4[_0x63a8('0x30')],{'$or':_[_0x63a8('0x26')](_0x5bb8f5,function(_0x5f2dfb){if(_0x5f2dfb[_0x63a8('0x32')]!==_0x63a8('0x33')){var _0x33827d={};_0x33827d[_0x5f2dfb['name']]={'$like':'%'+_0x2c1f14[_0x63a8('0x27')][_0x63a8('0x34')]+'%'};return _0x33827d;}})});}_0x4de6e4=_[_0x63a8('0x35')]({},_0x4de6e4,_0x2c1f14[_0x63a8('0x36')]);var _0x1dc669={'where':_0x4de6e4[_0x63a8('0x30')]};return db[_0x63a8('0x37')][_0x63a8('0x1b')](_0x1dc669)[_0x63a8('0x1d')](function(_0x1b5396){_0x47ecc8[_0x63a8('0x1b')]=_0x1b5396;if(_0x2c1f14[_0x63a8('0x27')][_0x63a8('0x38')]){_0x4de6e4[_0x63a8('0x39')]=[{'all':!![]}];}return db[_0x63a8('0x37')]['findAll'](_0x4de6e4);})[_0x63a8('0x1d')](function(_0x5b3127){_0x47ecc8[_0x63a8('0x3a')]=_0x5b3127;return _0x47ecc8;})[_0x63a8('0x1d')](respondWithFilteredResult(_0x5ec95a,_0x4de6e4))[_0x63a8('0x16')](handleError(_0x5ec95a,null));};exports[_0x63a8('0x3b')]=function(_0x5b947,_0x17c1e2){var _0x3f77cd={'raw':!![],'where':{'id':_0x5b947[_0x63a8('0x3c')]['id']}},_0x270448={};_0x270448['model']=_[_0x63a8('0x28')](db[_0x63a8('0x37')]['rawAttributes']);_0x270448[_0x63a8('0x27')]=_[_0x63a8('0x28')](_0x5b947['query']);_0x270448[_0x63a8('0x31')]=_[_0x63a8('0x29')](_0x270448['model'],_0x270448['query']);_0x3f77cd[_0x63a8('0x2c')]=_[_0x63a8('0x29')](_0x270448[_0x63a8('0x2a')],qs['fields'](_0x5b947[_0x63a8('0x27')][_0x63a8('0x2b')]));_0x3f77cd[_0x63a8('0x2c')]=_0x3f77cd[_0x63a8('0x2c')]['length']?_0x3f77cd['attributes']:_0x270448[_0x63a8('0x2a')];if(_0x5b947[_0x63a8('0x27')][_0x63a8('0x38')]){_0x3f77cd[_0x63a8('0x39')]=[{'all':!![]}];}_0x3f77cd=_['merge']({},_0x3f77cd,_0x5b947['options']);return db['Network'][_0x63a8('0x3d')](_0x3f77cd)[_0x63a8('0x1d')](handleEntityNotFound(_0x17c1e2,null))[_0x63a8('0x1d')](respondWithResult(_0x17c1e2,null))[_0x63a8('0x16')](handleError(_0x17c1e2,null));};exports['create']=function(_0x4f51f4,_0x2f2960){var _0x4d9a10;return db[_0x63a8('0x37')][_0x63a8('0x3e')](_0x4f51f4[_0x63a8('0x3f')],{'raw':!![]})[_0x63a8('0x1d')](function(_0x332798){_0x4d9a10=_0x332798;return db['Network'][_0x63a8('0x40')]({'where':{'type':_0x4f51f4[_0x63a8('0x3f')][_0x63a8('0x32')]},'raw':!![]});})[_0x63a8('0x1d')](function(_0x2d5ca8){if(_0x4d9a10[_0x63a8('0x32')]['toUpperCase']()=='STUN'){var _0x1cc3bd=fs[_0x63a8('0x41')](path[_0x63a8('0x42')](config[_0x63a8('0x43')],'server/files/templates/stun_multiple.ejs'),_0x63a8('0x44'));var _0x25bcfd=ejs[_0x63a8('0x45')](_0x1cc3bd,{'networks':_0x2d5ca8||[]});fs['writeFileSync'](_0x63a8('0x46'),_0x25bcfd);return respondWithRpcPromise('Reload',_0x63a8('0x3e'),{'module':'res_stun_monitor.so'});}else if(_0x4d9a10['type'][_0x63a8('0x47')]()==_0x63a8('0x48')){var _0x137df7=fs['readFileSync'](path['join'](config[_0x63a8('0x43')],'server/files/templates/turn_multiple.ejs'),_0x63a8('0x44'));var _0x15f1a8=ejs[_0x63a8('0x45')](_0x137df7,{'networks':_0x2d5ca8||[]});fs[_0x63a8('0x49')](_0x63a8('0x4a'),_0x15f1a8);return respondWithRpcPromise(_0x63a8('0x4b'),_0x63a8('0x3e'),{'module':_0x63a8('0x4c')});}else{var _0x507055=fs[_0x63a8('0x41')](path['join'](config[_0x63a8('0x43')],_0x63a8('0x4d')),_0x63a8('0x44'));var _0x2177f9=ejs[_0x63a8('0x45')](_0x507055,{'networks':_0x2d5ca8||[]});fs[_0x63a8('0x49')](util['format'](_0x63a8('0x4e'),_0x4f51f4[_0x63a8('0x3f')]['type']['toLowerCase']()),_0x2177f9);return respondWithRpcPromise(_0x63a8('0x4b'),'create',{'module':_0x63a8('0x4f')});}})[_0x63a8('0x1d')](function(){return _0x4d9a10;})[_0x63a8('0x1d')](respondWithResult(_0x2f2960,0xc9))[_0x63a8('0x16')](handleError(_0x2f2960,null));};exports[_0x63a8('0x1c')]=function(_0x4ad36d,_0x4692e6){var _0x3f4757;return db['Network'][_0x63a8('0x3d')]({'where':{'id':_0x4ad36d[_0x63a8('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4692e6,null))[_0x63a8('0x1d')](saveUpdates(_0x4ad36d['body'],null))[_0x63a8('0x1d')](function(_0x229ae0){if(_0x229ae0){_0x3f4757=_0x229ae0;return db[_0x63a8('0x37')][_0x63a8('0x40')]({'where':{'type':_0x3f4757[_0x63a8('0x32')]},'raw':!![]});}return null;})['then'](function(_0x55060a){if(_0x3f4757[_0x63a8('0x32')][_0x63a8('0x47')]()=='STUN'){var _0x18eb4d=fs[_0x63a8('0x41')](path[_0x63a8('0x42')](config[_0x63a8('0x43')],_0x63a8('0x50')),_0x63a8('0x44'));var _0x1356fb=ejs[_0x63a8('0x45')](_0x18eb4d,{'networks':_0x55060a||[]});fs[_0x63a8('0x49')]('/etc/asterisk/stun_xcally.conf',_0x1356fb);return respondWithRpcPromise(_0x63a8('0x4b'),_0x63a8('0x1c'),{'module':_0x63a8('0x4c')});}else if(_0x3f4757[_0x63a8('0x32')][_0x63a8('0x47')]()==_0x63a8('0x48')){var _0x27d22e=fs[_0x63a8('0x41')](path[_0x63a8('0x42')](config[_0x63a8('0x43')],_0x63a8('0x51')),_0x63a8('0x44'));var _0x1eb0c5=ejs[_0x63a8('0x45')](_0x27d22e,{'networks':_0x55060a||[]});fs[_0x63a8('0x49')](_0x63a8('0x4a'),_0x1eb0c5);return respondWithRpcPromise(_0x63a8('0x4b'),'update',{'module':_0x63a8('0x4c')});}else{var _0x1c9fe3=fs[_0x63a8('0x41')](path['join'](config['root'],_0x63a8('0x4d')),_0x63a8('0x44'));var _0x4266b3=ejs['render'](_0x1c9fe3,{'networks':_0x55060a||[]});fs[_0x63a8('0x49')](util[_0x63a8('0x52')]('/etc/asterisk/sip_xcally_%s.conf',_0x4ad36d[_0x63a8('0x3f')][_0x63a8('0x32')]['toLowerCase']()),_0x4266b3);return respondWithRpcPromise(_0x63a8('0x4b'),_0x63a8('0x1c'),{'module':'chan_sip.so'});}})['then'](function(_0xba09ee){if(_0xba09ee){return _0x3f4757;}return null;})[_0x63a8('0x1d')](respondWithResult(_0x4692e6,null))[_0x63a8('0x16')](handleError(_0x4692e6,null));};exports[_0x63a8('0x1e')]=function(_0x2436ae,_0x31b014){var _0x22e754;return db[_0x63a8('0x37')]['find']({'where':{'id':_0x2436ae[_0x63a8('0x3c')]['id']}})['then'](function(_0x16a575){_0x22e754=_0x16a575;return _0x16a575;})['then'](handleEntityNotFound(_0x31b014,null))[_0x63a8('0x1d')](removeEntity(_0x31b014,null))[_0x63a8('0x1d')](function(){if(_0x22e754){return db[_0x63a8('0x37')][_0x63a8('0x40')]({'where':{'type':_0x22e754[_0x63a8('0x32')]},'raw':!![]});}})[_0x63a8('0x1d')](function(_0x509f84){if(_0x22e754['type'][_0x63a8('0x47')]()==_0x63a8('0x53')){var _0x44317c=fs[_0x63a8('0x41')](path[_0x63a8('0x42')](config['root'],_0x63a8('0x50')),_0x63a8('0x44'));var _0x155cd5=ejs[_0x63a8('0x45')](_0x44317c,{'networks':_0x509f84||[]});fs[_0x63a8('0x49')]('/etc/asterisk/stun_xcally.conf',_0x155cd5);return respondWithRpcPromise(_0x63a8('0x4b'),_0x63a8('0x1e'),{'module':_0x63a8('0x4c')});}else if(_0x22e754[_0x63a8('0x32')]['toUpperCase']()==_0x63a8('0x48')){var _0x48adbf=fs[_0x63a8('0x41')](path[_0x63a8('0x42')](config[_0x63a8('0x43')],_0x63a8('0x51')),'utf8');var _0x56860f=ejs[_0x63a8('0x45')](_0x48adbf,{'networks':_0x509f84||[]});fs[_0x63a8('0x49')]('/etc/asterisk/turn_xcally.conf',_0x56860f);return respondWithRpcPromise('Reload',_0x63a8('0x1e'),{'module':_0x63a8('0x4c')});}else{var _0xe26c17=fs[_0x63a8('0x41')](path[_0x63a8('0x42')](config[_0x63a8('0x43')],_0x63a8('0x4d')),_0x63a8('0x44'));var _0x39b79c=ejs[_0x63a8('0x45')](_0xe26c17,{'networks':_0x509f84||[]});fs[_0x63a8('0x49')](util[_0x63a8('0x52')](_0x63a8('0x4e'),_0x22e754[_0x63a8('0x32')][_0x63a8('0x54')]()),_0x39b79c);return respondWithRpcPromise(_0x63a8('0x4b'),_0x63a8('0x1e'),{'module':'chan_sip.so'});}})[_0x63a8('0x16')](handleError(_0x31b014,null));}; \ No newline at end of file +var _0xa93a=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Network','include','findAll','rows','catch','show','keys','find','create','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','writeFileSync','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','STUN','/etc/asterisk/turn_xcally.conf','toLowerCase','params','util','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','client','http','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa93a,0x7e));var _0xaa93=function(_0x567fdd,_0x5ed514){_0x567fdd=_0x567fdd-0x0;var _0x372380=_0xa93a[_0x567fdd];return _0x372380;};'use strict';var util=require(_0xaa93('0x0'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0xaa93('0x1'));var logger=require(_0xaa93('0x2'))('api');var config=require(_0xaa93('0x3'));var db=require(_0xaa93('0x4'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xaa93('0x5')][_0xaa93('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4870ab,_0x735206,_0x4afa05,_0x246a38){return new Promise(function(_0x4438a5,_0x1c158c){var _0x3514a2=_0x246a38||client;return _0x3514a2['request'](_0x4870ab,_0x4afa05)[_0xaa93('0x7')](function(_0x2d13c9){logger[_0xaa93('0x8')](_0xaa93('0x9'),_0x735206,'request\x20sent');logger[_0xaa93('0xa')](_0xaa93('0xb'),_0x735206,_0xaa93('0xc'),JSON[_0xaa93('0xd')](_0x2d13c9));if(_0x2d13c9[_0xaa93('0xe')]){if(_0x2d13c9['error'][_0xaa93('0xf')]===0x1f4){logger[_0xaa93('0xe')]('Network,\x20%s,\x20%s',_0x735206,_0x2d13c9[_0xaa93('0xe')][_0xaa93('0x10')]);return _0x1c158c(_0x2d13c9['error'][_0xaa93('0x10')]);}logger[_0xaa93('0xe')](_0xaa93('0x9'),_0x735206,_0x2d13c9[_0xaa93('0xe')]['message']);return _0x4438a5(_0x2d13c9[_0xaa93('0xe')][_0xaa93('0x10')]);}else{logger[_0xaa93('0x8')](_0xaa93('0x9'),_0x735206,_0xaa93('0xc'));_0x4438a5(_0x2d13c9['result'][_0xaa93('0x10')]);}})['catch'](function(_0x4c1547){logger[_0xaa93('0xe')](_0xaa93('0x9'),_0x735206,_0x4c1547);_0x1c158c(_0x4c1547);});});}function respondWithResult(_0x3cdab3,_0x92259){_0x92259=_0x92259||0xc8;return function(_0x452cf4){if(_0x452cf4){return _0x3cdab3[_0xaa93('0x11')](_0x92259)[_0xaa93('0x12')](_0x452cf4);}};}function respondWithFilteredResult(_0x59db34,_0x184c4d){return function(_0x31c1fb){if(_0x31c1fb){var _0x12f2b3=typeof _0x184c4d[_0xaa93('0x13')]===_0xaa93('0x14')&&typeof _0x184c4d[_0xaa93('0x15')]===_0xaa93('0x14');var _0x28e712=_0x31c1fb[_0xaa93('0x16')];var _0x1381c4=_0x12f2b3?0x0:_0x184c4d[_0xaa93('0x13')];var _0x5ae1d0=_0x12f2b3?_0x31c1fb[_0xaa93('0x16')]:_0x184c4d[_0xaa93('0x13')]+_0x184c4d[_0xaa93('0x15')];var _0x57416b;if(_0x5ae1d0>=_0x28e712){_0x5ae1d0=_0x28e712;_0x57416b=0xc8;}else{_0x57416b=0xce;}_0x59db34[_0xaa93('0x11')](_0x57416b);return _0x59db34[_0xaa93('0x17')](_0xaa93('0x18'),_0x1381c4+'-'+_0x5ae1d0+'/'+_0x28e712)[_0xaa93('0x12')](_0x31c1fb);}return null;};}function saveUpdates(_0x178f9f){return function(_0x50fe05){if(_0x50fe05){return _0x50fe05[_0xaa93('0x19')](_0x178f9f)[_0xaa93('0x7')](function(_0x5cdf1a){return _0x5cdf1a;});}return null;};}function removeEntity(_0x403687){return function(_0x1debae){if(_0x1debae){return _0x1debae[_0xaa93('0x1a')]()[_0xaa93('0x7')](function(){_0x403687[_0xaa93('0x11')](0xcc)[_0xaa93('0x1b')]();});}};}function handleEntityNotFound(_0x3a02d6){return function(_0x255979){if(!_0x255979){_0x3a02d6['sendStatus'](0x194);}return _0x255979;};}function handleError(_0x4187f1,_0x3f3bc9){_0x3f3bc9=_0x3f3bc9||0x1f4;return function(_0x303fc4){logger[_0xaa93('0xe')](_0x303fc4[_0xaa93('0x1c')]);if(_0x303fc4['name']){delete _0x303fc4[_0xaa93('0x1d')];}_0x4187f1[_0xaa93('0x11')](_0x3f3bc9)[_0xaa93('0x1e')](_0x303fc4);};}exports[_0xaa93('0x1f')]=function(_0x233c71,_0x1ce831){var _0x593267={},_0x1a24b9={},_0x21ea46={'count':0x0,'rows':[]};var _0x2f7ee=_[_0xaa93('0x20')](db['Network'][_0xaa93('0x21')],function(_0x2ae9ee){return{'name':_0x2ae9ee[_0xaa93('0x22')],'type':_0x2ae9ee[_0xaa93('0x23')]['key']};});_0x1a24b9[_0xaa93('0x24')]=_[_0xaa93('0x20')](_0x2f7ee,'name');_0x1a24b9[_0xaa93('0x25')]=_['keys'](_0x233c71[_0xaa93('0x25')]);_0x1a24b9[_0xaa93('0x26')]=_[_0xaa93('0x27')](_0x1a24b9['model'],_0x1a24b9['query']);_0x593267['attributes']=_[_0xaa93('0x27')](_0x1a24b9[_0xaa93('0x24')],qs['fields'](_0x233c71[_0xaa93('0x25')][_0xaa93('0x28')]));_0x593267[_0xaa93('0x29')]=_0x593267[_0xaa93('0x29')][_0xaa93('0x2a')]?_0x593267[_0xaa93('0x29')]:_0x1a24b9[_0xaa93('0x24')];if(!_0x233c71['query'][_0xaa93('0x2b')](_0xaa93('0x2c'))){_0x593267['limit']=qs[_0xaa93('0x15')](_0x233c71[_0xaa93('0x25')][_0xaa93('0x15')]);_0x593267[_0xaa93('0x13')]=qs[_0xaa93('0x13')](_0x233c71[_0xaa93('0x25')][_0xaa93('0x13')]);}_0x593267[_0xaa93('0x2d')]=qs[_0xaa93('0x2e')](_0x233c71['query']['sort']);_0x593267[_0xaa93('0x2f')]=qs[_0xaa93('0x26')](_[_0xaa93('0x30')](_0x233c71[_0xaa93('0x25')],_0x1a24b9['filters']),_0x2f7ee);if(_0x233c71[_0xaa93('0x25')][_0xaa93('0x31')]){_0x593267[_0xaa93('0x2f')]=_[_0xaa93('0x32')](_0x593267[_0xaa93('0x2f')],{'$or':_[_0xaa93('0x20')](_0x2f7ee,function(_0x31cb05){if(_0x31cb05[_0xaa93('0x23')]!==_0xaa93('0x33')){var _0x4bfb20={};_0x4bfb20[_0x31cb05['name']]={'$like':'%'+_0x233c71[_0xaa93('0x25')][_0xaa93('0x31')]+'%'};return _0x4bfb20;}})});}_0x593267=_[_0xaa93('0x32')]({},_0x593267,_0x233c71[_0xaa93('0x34')]);var _0x2c65e5={'where':_0x593267['where']};return db[_0xaa93('0x35')][_0xaa93('0x16')](_0x2c65e5)[_0xaa93('0x7')](function(_0x2188e6){_0x21ea46['count']=_0x2188e6;if(_0x233c71[_0xaa93('0x25')]['includeAll']){_0x593267[_0xaa93('0x36')]=[{'all':!![]}];}return db[_0xaa93('0x35')][_0xaa93('0x37')](_0x593267);})[_0xaa93('0x7')](function(_0x4a6d73){_0x21ea46[_0xaa93('0x38')]=_0x4a6d73;return _0x21ea46;})[_0xaa93('0x7')](respondWithFilteredResult(_0x1ce831,_0x593267))[_0xaa93('0x39')](handleError(_0x1ce831,null));};exports[_0xaa93('0x3a')]=function(_0x128d49,_0x1d5e9b){var _0x2ee1={'raw':!![],'where':{'id':_0x128d49['params']['id']}},_0x54d0b8={};_0x54d0b8[_0xaa93('0x24')]=_['keys'](db[_0xaa93('0x35')][_0xaa93('0x21')]);_0x54d0b8['query']=_[_0xaa93('0x3b')](_0x128d49[_0xaa93('0x25')]);_0x54d0b8[_0xaa93('0x26')]=_['intersection'](_0x54d0b8['model'],_0x54d0b8[_0xaa93('0x25')]);_0x2ee1['attributes']=_[_0xaa93('0x27')](_0x54d0b8[_0xaa93('0x24')],qs['fields'](_0x128d49[_0xaa93('0x25')]['fields']));_0x2ee1['attributes']=_0x2ee1[_0xaa93('0x29')]['length']?_0x2ee1[_0xaa93('0x29')]:_0x54d0b8[_0xaa93('0x24')];if(_0x128d49[_0xaa93('0x25')]['includeAll']){_0x2ee1[_0xaa93('0x36')]=[{'all':!![]}];}_0x2ee1=_['merge']({},_0x2ee1,_0x128d49[_0xaa93('0x34')]);return db[_0xaa93('0x35')][_0xaa93('0x3c')](_0x2ee1)[_0xaa93('0x7')](handleEntityNotFound(_0x1d5e9b,null))['then'](respondWithResult(_0x1d5e9b,null))['catch'](handleError(_0x1d5e9b,null));};exports[_0xaa93('0x3d')]=function(_0x267e53,_0x90f3b9){var _0x1d4599;return db[_0xaa93('0x35')][_0xaa93('0x3d')](_0x267e53['body'],{'raw':!![]})['then'](function(_0x37aaf5){_0x1d4599=_0x37aaf5;return db['Network'][_0xaa93('0x37')]({'where':{'type':_0x267e53[_0xaa93('0x3e')]['type']},'raw':!![]});})[_0xaa93('0x7')](function(_0x584d14){if(_0x1d4599['type'][_0xaa93('0x3f')]()=='STUN'){var _0x1f9aed=fs[_0xaa93('0x40')](path[_0xaa93('0x41')](config[_0xaa93('0x42')],_0xaa93('0x43')),_0xaa93('0x44'));var _0x1a17a7=ejs['render'](_0x1f9aed,{'networks':_0x584d14||[]});fs['writeFileSync'](_0xaa93('0x45'),_0x1a17a7);return respondWithRpcPromise(_0xaa93('0x46'),_0xaa93('0x3d'),{'module':_0xaa93('0x47')});}else if(_0x1d4599['type']['toUpperCase']()==_0xaa93('0x48')){var _0x558599=fs[_0xaa93('0x40')](path[_0xaa93('0x41')](config[_0xaa93('0x42')],_0xaa93('0x49')),_0xaa93('0x44'));var _0x41bcce=ejs[_0xaa93('0x4a')](_0x558599,{'networks':_0x584d14||[]});fs[_0xaa93('0x4b')]('/etc/asterisk/turn_xcally.conf',_0x41bcce);return respondWithRpcPromise(_0xaa93('0x46'),_0xaa93('0x3d'),{'module':_0xaa93('0x47')});}else{var _0x26c86f=fs[_0xaa93('0x40')](path['join'](config[_0xaa93('0x42')],_0xaa93('0x4c')),'utf8');var _0x42482c=ejs['render'](_0x26c86f,{'networks':_0x584d14||[]});fs[_0xaa93('0x4b')](util[_0xaa93('0x4d')](_0xaa93('0x4e'),_0x267e53[_0xaa93('0x3e')][_0xaa93('0x23')]['toLowerCase']()),_0x42482c);return respondWithRpcPromise(_0xaa93('0x46'),_0xaa93('0x3d'),{'module':_0xaa93('0x4f')});}})[_0xaa93('0x7')](function(){return _0x1d4599;})[_0xaa93('0x7')](respondWithResult(_0x90f3b9,0xc9))[_0xaa93('0x39')](handleError(_0x90f3b9,null));};exports['update']=function(_0x4945a2,_0x3ed856){var _0x24c298;return db[_0xaa93('0x35')]['find']({'where':{'id':_0x4945a2['params']['id']}})[_0xaa93('0x7')](handleEntityNotFound(_0x3ed856,null))[_0xaa93('0x7')](saveUpdates(_0x4945a2[_0xaa93('0x3e')],null))[_0xaa93('0x7')](function(_0x5cada3){if(_0x5cada3){_0x24c298=_0x5cada3;return db['Network']['findAll']({'where':{'type':_0x24c298[_0xaa93('0x23')]},'raw':!![]});}return null;})[_0xaa93('0x7')](function(_0x3899da){if(_0x24c298['type'][_0xaa93('0x3f')]()==_0xaa93('0x50')){var _0x128f67=fs[_0xaa93('0x40')](path[_0xaa93('0x41')](config[_0xaa93('0x42')],_0xaa93('0x43')),_0xaa93('0x44'));var _0x4a45f6=ejs[_0xaa93('0x4a')](_0x128f67,{'networks':_0x3899da||[]});fs[_0xaa93('0x4b')]('/etc/asterisk/stun_xcally.conf',_0x4a45f6);return respondWithRpcPromise(_0xaa93('0x46'),_0xaa93('0x19'),{'module':'res_stun_monitor.so'});}else if(_0x24c298[_0xaa93('0x23')][_0xaa93('0x3f')]()==_0xaa93('0x48')){var _0x533b91=fs[_0xaa93('0x40')](path[_0xaa93('0x41')](config[_0xaa93('0x42')],_0xaa93('0x49')),_0xaa93('0x44'));var _0x6eab8b=ejs['render'](_0x533b91,{'networks':_0x3899da||[]});fs[_0xaa93('0x4b')](_0xaa93('0x51'),_0x6eab8b);return respondWithRpcPromise(_0xaa93('0x46'),'update',{'module':_0xaa93('0x47')});}else{var _0x4c3594=fs[_0xaa93('0x40')](path[_0xaa93('0x41')](config[_0xaa93('0x42')],_0xaa93('0x4c')),_0xaa93('0x44'));var _0x3c9edf=ejs[_0xaa93('0x4a')](_0x4c3594,{'networks':_0x3899da||[]});fs['writeFileSync'](util['format'](_0xaa93('0x4e'),_0x4945a2[_0xaa93('0x3e')][_0xaa93('0x23')][_0xaa93('0x52')]()),_0x3c9edf);return respondWithRpcPromise(_0xaa93('0x46'),'update',{'module':_0xaa93('0x4f')});}})[_0xaa93('0x7')](function(_0x41f492){if(_0x41f492){return _0x24c298;}return null;})[_0xaa93('0x7')](respondWithResult(_0x3ed856,null))[_0xaa93('0x39')](handleError(_0x3ed856,null));};exports[_0xaa93('0x1a')]=function(_0x501a57,_0x58270a){var _0x1eade7;return db['Network'][_0xaa93('0x3c')]({'where':{'id':_0x501a57[_0xaa93('0x53')]['id']}})[_0xaa93('0x7')](function(_0x5e5729){_0x1eade7=_0x5e5729;return _0x5e5729;})[_0xaa93('0x7')](handleEntityNotFound(_0x58270a,null))['then'](removeEntity(_0x58270a,null))[_0xaa93('0x7')](function(){if(_0x1eade7){return db[_0xaa93('0x35')]['findAll']({'where':{'type':_0x1eade7[_0xaa93('0x23')]},'raw':!![]});}})['then'](function(_0x3d617e){if(_0x1eade7[_0xaa93('0x23')][_0xaa93('0x3f')]()==_0xaa93('0x50')){var _0x357c65=fs[_0xaa93('0x40')](path[_0xaa93('0x41')](config[_0xaa93('0x42')],_0xaa93('0x43')),_0xaa93('0x44'));var _0x579fe5=ejs[_0xaa93('0x4a')](_0x357c65,{'networks':_0x3d617e||[]});fs[_0xaa93('0x4b')](_0xaa93('0x45'),_0x579fe5);return respondWithRpcPromise(_0xaa93('0x46'),_0xaa93('0x1a'),{'module':_0xaa93('0x47')});}else if(_0x1eade7[_0xaa93('0x23')][_0xaa93('0x3f')]()=='TURN'){var _0x2f640b=fs[_0xaa93('0x40')](path[_0xaa93('0x41')](config['root'],_0xaa93('0x49')),_0xaa93('0x44'));var _0x47c3cd=ejs['render'](_0x2f640b,{'networks':_0x3d617e||[]});fs[_0xaa93('0x4b')](_0xaa93('0x51'),_0x47c3cd);return respondWithRpcPromise(_0xaa93('0x46'),_0xaa93('0x1a'),{'module':_0xaa93('0x47')});}else{var _0x4a3672=fs[_0xaa93('0x40')](path['join'](config[_0xaa93('0x42')],'server/files/templates/network.ejs'),_0xaa93('0x44'));var _0xf91858=ejs['render'](_0x4a3672,{'networks':_0x3d617e||[]});fs['writeFileSync'](util[_0xaa93('0x4d')](_0xaa93('0x4e'),_0x1eade7[_0xaa93('0x23')][_0xaa93('0x52')]()),_0xf91858);return respondWithRpcPromise(_0xaa93('0x46'),'destroy',{'module':_0xaa93('0x4f')});}})['catch'](handleError(_0x58270a,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 432104b..664293b 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 _0x9099=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','lodash'];(function(_0x2149ff,_0x2f55a6){var _0x4555cf=function(_0x4c4a8e){while(--_0x4c4a8e){_0x2149ff['push'](_0x2149ff['shift']());}};_0x4555cf(++_0x2f55a6);}(_0x9099,0x1ac));var _0x9909=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0x9099[_0x39bc44];return _0x2916d8;};'use strict';var _=require(_0x9909('0x0'));var util=require('util');var logger=require(_0x9909('0x1'))(_0x9909('0x2'));var moment=require(_0x9909('0x3'));var BPromise=require(_0x9909('0x4'));var rp=require(_0x9909('0x5'));var fs=require('fs');var path=require(_0x9909('0x6'));var rimraf=require(_0x9909('0x7'));var config=require(_0x9909('0x8'));var attributes=require(_0x9909('0x9'));module[_0x9909('0xa')]=function(_0x3947ed,_0x41c07e){return _0x3947ed[_0x9909('0xb')](_0x9909('0xc'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6b1=['../../config/logger','moment','bluebird','path','../../config/environment','./network.attributes','exports','define','network','lodash'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0xb6b1[_0x2b305c];return _0x5d8c85;};'use strict';var _=require(_0x1b6b('0x0'));var util=require('util');var logger=require(_0x1b6b('0x1'))('api');var moment=require(_0x1b6b('0x2'));var BPromise=require(_0x1b6b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b6b('0x4'));var rimraf=require('rimraf');var config=require(_0x1b6b('0x5'));var attributes=require(_0x1b6b('0x6'));module[_0x1b6b('0x7')]=function(_0xdbbe22,_0x5870ca){return _0xdbbe22[_0x1b6b('0x8')]('Network',attributes,{'tableName':_0x1b6b('0x9'),'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 4102911..a427602 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x17764f,_0x581b4a){var _0x5deb84=function(_0x53f81f){while(--_0x53f81f){_0x17764f['push'](_0x17764f['shift']());}};_0x5deb84(++_0x581b4a);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x531659,_0x3b0d19){_0x531659=_0x531659-0x0;var _0x352bcf=_0x7a54[_0x531659];return _0x352bcf;};'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 a166656..0a76a96 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 _0x0c92=['getAnswers','getApplications','getInteractions','getAgents','post','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','update','delete','/:id','destroy','removeDispositions','removeAnswers','/:id/users','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','/describe','show','/:id/dispositions','/:id/canned_answers'];(function(_0x5987ac,_0x121671){var _0x4df7a2=function(_0x5998b7){while(--_0x5998b7){_0x5987ac['push'](_0x5987ac['shift']());}};_0x4df7a2(++_0x121671);}(_0x0c92,0x145));var _0x20c9=function(_0x16b667,_0xadec02){_0x16b667=_0x16b667-0x0;var _0x58620e=_0x0c92[_0x16b667];return _0x58620e;};'use strict';var multer=require(_0x20c9('0x0'));var util=require(_0x20c9('0x1'));var path=require(_0x20c9('0x2'));var timeout=require(_0x20c9('0x3'));var express=require('express');var router=express[_0x20c9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x20c9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x20c9('0x6'));var controller=require(_0x20c9('0x7'));router['get']('/',auth[_0x20c9('0x8')](),controller[_0x20c9('0x9')]);router[_0x20c9('0xa')](_0x20c9('0xb'),auth[_0x20c9('0x8')](),controller['describe']);router[_0x20c9('0xa')]('/:id',auth[_0x20c9('0x8')](),controller[_0x20c9('0xc')]);router['get'](_0x20c9('0xd'),auth[_0x20c9('0x8')](),controller['getDispositions']);router[_0x20c9('0xa')](_0x20c9('0xe'),auth['isAuthenticated'](),controller[_0x20c9('0xf')]);router[_0x20c9('0xa')]('/:id/applications',auth[_0x20c9('0x8')](),controller[_0x20c9('0x10')]);router['get']('/:id/interactions',auth[_0x20c9('0x8')](),controller[_0x20c9('0x11')]);router[_0x20c9('0xa')]('/:id/users',auth[_0x20c9('0x8')](),controller[_0x20c9('0x12')]);router[_0x20c9('0x13')]('/',auth[_0x20c9('0x8')](),controller['create']);router[_0x20c9('0x13')](_0x20c9('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x20c9('0x13')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x20c9('0x13')](_0x20c9('0x14'),controller[_0x20c9('0x15')]);router[_0x20c9('0x13')](_0x20c9('0x16'),auth[_0x20c9('0x8')](),controller[_0x20c9('0x17')]);router[_0x20c9('0x13')]('/:id/users',auth[_0x20c9('0x8')](),controller['addAgents']);router['post'](_0x20c9('0x18'),auth[_0x20c9('0x8')](),controller[_0x20c9('0x19')]);router['put']('/:id',auth[_0x20c9('0x8')](),controller[_0x20c9('0x1a')]);router[_0x20c9('0x1b')](_0x20c9('0x1c'),auth['isAuthenticated'](),controller[_0x20c9('0x1d')]);router[_0x20c9('0x1b')](_0x20c9('0xd'),auth[_0x20c9('0x8')](),controller[_0x20c9('0x1e')]);router[_0x20c9('0x1b')]('/:id/canned_answers',auth[_0x20c9('0x8')](),controller[_0x20c9('0x1f')]);router[_0x20c9('0x1b')](_0x20c9('0x20'),auth[_0x20c9('0x8')](),controller['removeAgents']);module[_0x20c9('0x21')]=router; \ No newline at end of file +var _0xf78e=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','addAgents','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe'];(function(_0x2ae283,_0x9e4f67){var _0x8c7385=function(_0x501f88){while(--_0x501f88){_0x2ae283['push'](_0x2ae283['shift']());}};_0x8c7385(++_0x9e4f67);}(_0xf78e,0x1af));var _0xef78=function(_0x21d6e5,_0x38f9cd){_0x21d6e5=_0x21d6e5-0x0;var _0x66a736=_0xf78e[_0x21d6e5];return _0x66a736;};'use strict';var multer=require(_0xef78('0x0'));var util=require(_0xef78('0x1'));var path=require('path');var timeout=require(_0xef78('0x2'));var express=require('express');var router=express[_0xef78('0x3')]();var fs_extra=require(_0xef78('0x4'));var auth=require(_0xef78('0x5'));var interaction=require(_0xef78('0x6'));var config=require(_0xef78('0x7'));var controller=require(_0xef78('0x8'));router[_0xef78('0x9')]('/',auth[_0xef78('0xa')](),controller[_0xef78('0xb')]);router['get'](_0xef78('0xc'),auth[_0xef78('0xa')](),controller[_0xef78('0xd')]);router['get'](_0xef78('0xe'),auth[_0xef78('0xa')](),controller[_0xef78('0xf')]);router[_0xef78('0x9')](_0xef78('0x10'),auth['isAuthenticated'](),controller[_0xef78('0x11')]);router[_0xef78('0x9')](_0xef78('0x12'),auth[_0xef78('0xa')](),controller[_0xef78('0x13')]);router['get'](_0xef78('0x14'),auth[_0xef78('0xa')](),controller['getApplications']);router[_0xef78('0x9')](_0xef78('0x15'),auth[_0xef78('0xa')](),controller['getInteractions']);router[_0xef78('0x9')](_0xef78('0x16'),auth[_0xef78('0xa')](),controller[_0xef78('0x17')]);router[_0xef78('0x18')]('/',auth[_0xef78('0xa')](),controller['create']);router[_0xef78('0x18')](_0xef78('0x10'),auth[_0xef78('0xa')](),controller[_0xef78('0x19')]);router[_0xef78('0x18')](_0xef78('0x12'),auth[_0xef78('0xa')](),controller[_0xef78('0x1a')]);router[_0xef78('0x18')](_0xef78('0x1b'),controller[_0xef78('0x1c')]);router['post'](_0xef78('0x14'),auth[_0xef78('0xa')](),controller['addApplications']);router[_0xef78('0x18')](_0xef78('0x16'),auth[_0xef78('0xa')](),controller[_0xef78('0x1d')]);router[_0xef78('0x18')](_0xef78('0x1e'),auth['isAuthenticated'](),controller['send']);router[_0xef78('0x1f')](_0xef78('0xe'),auth[_0xef78('0xa')](),controller[_0xef78('0x20')]);router['delete']('/:id',auth[_0xef78('0xa')](),controller[_0xef78('0x21')]);router[_0xef78('0x22')](_0xef78('0x10'),auth['isAuthenticated'](),controller[_0xef78('0x23')]);router[_0xef78('0x22')]('/:id/canned_answers',auth[_0xef78('0xa')](),controller[_0xef78('0x24')]);router[_0xef78('0x22')](_0xef78('0x16'),auth[_0xef78('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index c946e37..df8fb3e 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 _0x8190=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','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'];(function(_0x48f103,_0x31830a){var _0x3ad793=function(_0x526b95){while(--_0x526b95){_0x48f103['push'](_0x48f103['shift']());}};_0x3ad793(++_0x31830a);}(_0x8190,0x13c));var _0x0819=function(_0x4c204e,_0x8ac9a0){_0x4c204e=_0x4c204e-0x0;var _0x35cf52=_0x8190[_0x4c204e];return _0x35cf52;};'use strict';var Sequelize=require(_0x0819('0x0'));var rs=require('randomstring');module[_0x0819('0x1')]={'name':{'type':Sequelize[_0x0819('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x0819('0x2')],'defaultValue':function(){return rs[_0x0819('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x0819('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0819('0x4')],'defaultValue':function(){return _0x0819('0x5');}},'notificationSound':{'type':Sequelize[_0x0819('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0819('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0819('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x0819('0x2')]},'queueTransfer':{'type':Sequelize[_0x0819('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0819('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0819('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0819('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x0819('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x0819('0x6')],'defaultValue':![],'comment':_0x0819('0x9'),'set':function(_0x51c387){if(!_0x51c387)this['setDataValue'](_0x0819('0xa'),null);this[_0x0819('0xb')](_0x0819('0xc'),_0x51c387);}}}; \ No newline at end of file +var _0xdbdc=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','TEXT'];(function(_0x567393,_0xd3099c){var _0x896eb2=function(_0x2805da){while(--_0x2805da){_0x567393['push'](_0x567393['shift']());}};_0x896eb2(++_0xd3099c);}(_0xdbdc,0x1e8));var _0xcdbd=function(_0x52ccb2,_0x3ce12a){_0x52ccb2=_0x52ccb2-0x0;var _0x4def9b=_0xdbdc[_0x52ccb2];return _0x4def9b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcdbd('0x0'));module[_0xcdbd('0x1')]={'name':{'type':Sequelize[_0xcdbd('0x2')],'unique':_0xcdbd('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xcdbd('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xcdbd('0x4')]();}},'replyUri':{'type':Sequelize[_0xcdbd('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xcdbd('0x5')],'defaultValue':function(){return _0xcdbd('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcdbd('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xcdbd('0x2')]},'queueTransfer':{'type':Sequelize[_0xcdbd('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcdbd('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcdbd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcdbd('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xcdbd('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xcdbd('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3471f0){if(!_0x3471f0)this[_0xcdbd('0xa')](_0xcdbd('0xb'),null);this['setDataValue'](_0xcdbd('0xc'),_0x3471f0);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index fa3b40f..ce3f01d 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 _0xb7a0=['keys','query','filters','model','intersection','fields','length','attributes','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','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','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','notify','openchannel','Sequelize','difference','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','defaults','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','UserId','forcedOwnership','Start','startRouting','EventManager','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','emit','userOpenchannelAccount:remove','getAgents','User','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','Pause','OpenchannelAccount','fieldName','key','map'];(function(_0x44f2b7,_0x9c567f){var _0xb7fdb9=function(_0x3a9c41){while(--_0x3a9c41){_0x44f2b7['push'](_0x44f2b7['shift']());}};_0xb7fdb9(++_0x9c567f);}(_0xb7a0,0x13b));var _0x0b7a=function(_0x12ebc7,_0x36e69b){_0x12ebc7=_0x12ebc7-0x0;var _0x32b23f=_0xb7a0[_0x12ebc7];return _0x32b23f;};'use strict';var emlformat=require(_0x0b7a('0x0'));var rimraf=require(_0x0b7a('0x1'));var zipdir=require(_0x0b7a('0x2'));var jsonpatch=require(_0x0b7a('0x3'));var rp=require('request-promise');var moment=require(_0x0b7a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0b7a('0x5'));var util=require('util');var path=require(_0x0b7a('0x6'));var sox=require(_0x0b7a('0x7'));var csv=require(_0x0b7a('0x8'));var ejs=require(_0x0b7a('0x9'));var fs=require('fs');var fs_extra=require(_0x0b7a('0xa'));var _=require(_0x0b7a('0xb'));var squel=require(_0x0b7a('0xc'));var crypto=require(_0x0b7a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0b7a('0x8'));var querystring=require(_0x0b7a('0xe'));var Papa=require('papaparse');var Redis=require(_0x0b7a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b7a('0x10'));var logger=require(_0x0b7a('0x11'))(_0x0b7a('0x12'));var utils=require(_0x0b7a('0x13'));var config=require(_0x0b7a('0x14'));var licenseUtil=require(_0x0b7a('0x15'));var db=require(_0x0b7a('0x16'))['db'];config[_0x0b7a('0x17')]=_['defaults'](config[_0x0b7a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b7a('0x18'))(new Redis(config[_0x0b7a('0x17')]));require(_0x0b7a('0x19'))[_0x0b7a('0x1a')](socket);var jayson=require(_0x0b7a('0x1b'));var client=jayson[_0x0b7a('0x1c')][_0x0b7a('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x0b7a('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x215915,_0x24303b,_0x5b4d5c,_0x46c2de){return new BPromise(function(_0x122a25,_0x4269c5){var _0xb2e4aa=_0x46c2de||client;return _0xb2e4aa[_0x0b7a('0x1e')](_0x215915,_0x5b4d5c)[_0x0b7a('0x1f')](function(_0x4a6db8){logger[_0x0b7a('0x20')](_0x0b7a('0x21'),_0x24303b,_0x0b7a('0x22'));logger[_0x0b7a('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x24303b,_0x0b7a('0x22'),JSON[_0x0b7a('0x24')](_0x4a6db8));if(_0x4a6db8[_0x0b7a('0x25')]){if(_0x4a6db8[_0x0b7a('0x25')][_0x0b7a('0x26')]===0x1f4){logger[_0x0b7a('0x25')](_0x0b7a('0x21'),_0x24303b,_0x4a6db8[_0x0b7a('0x25')]['message']);return _0x4269c5(_0x4a6db8[_0x0b7a('0x25')][_0x0b7a('0x27')]);}logger[_0x0b7a('0x25')](_0x0b7a('0x21'),_0x24303b,_0x4a6db8[_0x0b7a('0x25')][_0x0b7a('0x27')]);return _0x122a25(_0x4a6db8['error'][_0x0b7a('0x27')]);}else{logger[_0x0b7a('0x20')](_0x0b7a('0x21'),_0x24303b,_0x0b7a('0x22'));_0x122a25(_0x4a6db8['result'][_0x0b7a('0x27')]);}})[_0x0b7a('0x28')](function(_0x1223ee){logger[_0x0b7a('0x25')](_0x0b7a('0x21'),_0x24303b,_0x1223ee);_0x4269c5(_0x1223ee);});});}function respondWithStatusCode(_0x3aedf3,_0x2f2f76){_0x2f2f76=_0x2f2f76||0xcc;return function(_0x4e5e0a){if(_0x4e5e0a){return _0x3aedf3[_0x0b7a('0x29')](_0x2f2f76);}return _0x3aedf3[_0x0b7a('0x2a')](_0x2f2f76)[_0x0b7a('0x2b')]();};}function respondWithResult(_0x4618f1,_0x405ca9){_0x405ca9=_0x405ca9||0xc8;return function(_0x5eb6a7){if(_0x5eb6a7){return _0x4618f1[_0x0b7a('0x2a')](_0x405ca9)[_0x0b7a('0x2c')](_0x5eb6a7);}};}function respondWithFilteredResult(_0x19f5b7,_0x2f458e){return function(_0xd28086){if(_0xd28086){var _0x3d8cb6=typeof _0x2f458e[_0x0b7a('0x2d')]===_0x0b7a('0x2e')&&typeof _0x2f458e['limit']===_0x0b7a('0x2e');var _0x73d849=_0xd28086[_0x0b7a('0x2f')];var _0x32469c=_0x3d8cb6?0x0:_0x2f458e[_0x0b7a('0x2d')];var _0x181d3f=_0x3d8cb6?_0xd28086['count']:_0x2f458e['offset']+_0x2f458e[_0x0b7a('0x30')];var _0x196dc0;if(_0x181d3f>=_0x73d849){_0x181d3f=_0x73d849;_0x196dc0=0xc8;}else{_0x196dc0=0xce;}_0x19f5b7[_0x0b7a('0x2a')](_0x196dc0);return _0x19f5b7[_0x0b7a('0x31')]('Content-Range',_0x32469c+'-'+_0x181d3f+'/'+_0x73d849)[_0x0b7a('0x2c')](_0xd28086);}return null;};}function patchUpdates(_0x2287d5){return function(_0x22350a){try{jsonpatch[_0x0b7a('0x32')](_0x22350a,_0x2287d5,!![]);}catch(_0x529d6f){return BPromise[_0x0b7a('0x33')](_0x529d6f);}return _0x22350a['save']();};}function saveUpdates(_0x2c0b83,_0x112687){return function(_0x1744cd){if(_0x1744cd){return _0x1744cd[_0x0b7a('0x34')](_0x2c0b83)[_0x0b7a('0x1f')](function(_0x3591d6){return _0x3591d6;});}return null;};}function removeEntity(_0x503fa6,_0x11622e){return function(_0x20e5d4){if(_0x20e5d4){return _0x20e5d4[_0x0b7a('0x35')]()[_0x0b7a('0x1f')](function(){var _0x132ce2=_0x20e5d4[_0x0b7a('0x36')]({'plain':!![]});var _0x532472=_0x0b7a('0x37');return db[_0x0b7a('0x38')][_0x0b7a('0x35')]({'where':{'type':_0x532472,'resourceId':_0x132ce2['id']}})[_0x0b7a('0x1f')](function(){return _0x20e5d4;});})[_0x0b7a('0x1f')](function(){_0x503fa6[_0x0b7a('0x2a')](0xcc)[_0x0b7a('0x2b')]();});}};}function handleEntityNotFound(_0x21b1ed,_0x4f556b){return function(_0x25ccbc){if(!_0x25ccbc){_0x21b1ed[_0x0b7a('0x29')](0x194);}return _0x25ccbc;};}function handleError(_0x73f1c4,_0x49800e){_0x49800e=_0x49800e||0x1f4;return function(_0x711be6){logger['error'](_0x711be6['stack']);if(_0x711be6[_0x0b7a('0x39')]){delete _0x711be6[_0x0b7a('0x39')];}_0x73f1c4[_0x0b7a('0x2a')](_0x49800e)[_0x0b7a('0x3a')](_0x711be6);};}exports[_0x0b7a('0x3b')]=function(_0x3d43cc,_0x5abf37){var _0x41e80a={'include':[{'model':db[_0x0b7a('0x3c')],'as':'mandatoryDispositionPause'}]},_0xf45b68={},_0x2c9030={'count':0x0,'rows':[]};var _0x3b06ed=_['map'](db[_0x0b7a('0x3d')]['rawAttributes'],function(_0x2292d1){return{'name':_0x2292d1[_0x0b7a('0x3e')],'type':_0x2292d1['type'][_0x0b7a('0x3f')]};});_0xf45b68['model']=_[_0x0b7a('0x40')](_0x3b06ed,'name');_0xf45b68['query']=_[_0x0b7a('0x41')](_0x3d43cc[_0x0b7a('0x42')]);_0xf45b68[_0x0b7a('0x43')]=_['intersection'](_0xf45b68[_0x0b7a('0x44')],_0xf45b68[_0x0b7a('0x42')]);_0x41e80a['attributes']=_[_0x0b7a('0x45')](_0xf45b68['model'],qs[_0x0b7a('0x46')](_0x3d43cc[_0x0b7a('0x42')][_0x0b7a('0x46')]));_0x41e80a['attributes']=_0x41e80a['attributes'][_0x0b7a('0x47')]?_0x41e80a[_0x0b7a('0x48')]:_0xf45b68['model'];if(!_0x3d43cc[_0x0b7a('0x42')]['hasOwnProperty']('nolimit')){_0x41e80a['limit']=qs[_0x0b7a('0x30')](_0x3d43cc[_0x0b7a('0x42')]['limit']);_0x41e80a[_0x0b7a('0x2d')]=qs[_0x0b7a('0x2d')](_0x3d43cc[_0x0b7a('0x42')][_0x0b7a('0x2d')]);}_0x41e80a[_0x0b7a('0x49')]=qs['sort'](_0x3d43cc[_0x0b7a('0x42')][_0x0b7a('0x4a')]);_0x41e80a[_0x0b7a('0x4b')]=qs[_0x0b7a('0x43')](_[_0x0b7a('0x4c')](_0x3d43cc['query'],_0xf45b68['filters']),_0x3b06ed);if(_0x3d43cc[_0x0b7a('0x42')][_0x0b7a('0x4d')]){_0x41e80a[_0x0b7a('0x4b')]=_[_0x0b7a('0x4e')](_0x41e80a[_0x0b7a('0x4b')],{'$or':_[_0x0b7a('0x40')](_0x3b06ed,function(_0x1774a8){if(_0x1774a8[_0x0b7a('0x4f')]!==_0x0b7a('0x50')){var _0x4346c3={};_0x4346c3[_0x1774a8[_0x0b7a('0x39')]]={'$like':'%'+_0x3d43cc['query'][_0x0b7a('0x4d')]+'%'};return _0x4346c3;}})});}_0x41e80a=_[_0x0b7a('0x4e')]({},_0x41e80a,_0x3d43cc['options']);var _0x2557ca={'where':_0x41e80a[_0x0b7a('0x4b')]};return db[_0x0b7a('0x3d')][_0x0b7a('0x2f')](_0x2557ca)[_0x0b7a('0x1f')](function(_0x1728c2){_0x2c9030[_0x0b7a('0x2f')]=_0x1728c2;if(_0x3d43cc['query'][_0x0b7a('0x51')]){_0x41e80a[_0x0b7a('0x52')]=[{'all':!![]}];}return db[_0x0b7a('0x3d')][_0x0b7a('0x53')](_0x41e80a);})['then'](function(_0x22662e){_0x2c9030[_0x0b7a('0x54')]=_0x22662e;return _0x2c9030;})[_0x0b7a('0x1f')](respondWithFilteredResult(_0x5abf37,_0x41e80a))['catch'](handleError(_0x5abf37,null));};exports[_0x0b7a('0x55')]=function(_0x9c97ed,_0x53061a){var _0xc69ba4={'raw':![],'where':{'id':_0x9c97ed[_0x0b7a('0x56')]['id']},'include':[{'model':db[_0x0b7a('0x3c')],'as':_0x0b7a('0x57')}]},_0x489cf4={};_0x489cf4['model']=_[_0x0b7a('0x41')](db[_0x0b7a('0x3d')][_0x0b7a('0x58')]);_0x489cf4[_0x0b7a('0x42')]=_[_0x0b7a('0x41')](_0x9c97ed[_0x0b7a('0x42')]);_0x489cf4[_0x0b7a('0x43')]=_[_0x0b7a('0x45')](_0x489cf4[_0x0b7a('0x44')],_0x489cf4['query']);_0xc69ba4[_0x0b7a('0x48')]=_[_0x0b7a('0x45')](_0x489cf4[_0x0b7a('0x44')],qs['fields'](_0x9c97ed[_0x0b7a('0x42')][_0x0b7a('0x46')]));_0xc69ba4[_0x0b7a('0x48')]=_0xc69ba4['attributes'][_0x0b7a('0x47')]?_0xc69ba4[_0x0b7a('0x48')]:_0x489cf4['model'];if(_0x9c97ed[_0x0b7a('0x42')][_0x0b7a('0x51')]){_0xc69ba4[_0x0b7a('0x52')]=[{'all':!![]}];}_0xc69ba4=_[_0x0b7a('0x4e')]({},_0xc69ba4,_0x9c97ed[_0x0b7a('0x59')]);return db['OpenchannelAccount'][_0x0b7a('0x5a')](_0xc69ba4)[_0x0b7a('0x1f')](handleEntityNotFound(_0x53061a,null))[_0x0b7a('0x1f')](respondWithResult(_0x53061a,null))[_0x0b7a('0x28')](handleError(_0x53061a,null));};exports[_0x0b7a('0x5b')]=function(_0x34037a,_0x10bc44){return db[_0x0b7a('0x3d')][_0x0b7a('0x5b')](_0x34037a[_0x0b7a('0x5c')],{})['then'](function(_0x179a96){var _0x10b54e=_0x34037a['user']['get']({'plain':!![]});if(!_0x10b54e)throw new Error(_0x0b7a('0x5d'));if(_0x10b54e[_0x0b7a('0x5e')]===_0x0b7a('0x5f')){var _0x5a8738=_0x179a96[_0x0b7a('0x36')]({'plain':!![]});var _0x3d72cf=_0x0b7a('0x37');return db[_0x0b7a('0x60')][_0x0b7a('0x5a')]({'where':{'name':_0x3d72cf,'userProfileId':_0x10b54e[_0x0b7a('0x61')]},'raw':!![]})[_0x0b7a('0x1f')](function(_0x185133){if(_0x185133&&_0x185133[_0x0b7a('0x62')]===0x0){return db[_0x0b7a('0x38')][_0x0b7a('0x5b')]({'name':_0x5a8738[_0x0b7a('0x39')],'resourceId':_0x5a8738['id'],'type':_0x185133['name'],'sectionId':_0x185133['id']},{})[_0x0b7a('0x1f')](function(){return _0x179a96;});}else{return _0x179a96;}})['catch'](function(_0x4dd708){logger[_0x0b7a('0x25')](_0x0b7a('0x63'),_0x4dd708);throw _0x4dd708;});}return _0x179a96;})[_0x0b7a('0x1f')](respondWithResult(_0x10bc44,0xc9))[_0x0b7a('0x28')](handleError(_0x10bc44,null));};exports[_0x0b7a('0x34')]=function(_0x5af3a4,_0x3c15dd){if(_0x5af3a4[_0x0b7a('0x5c')]['id']){delete _0x5af3a4[_0x0b7a('0x5c')]['id'];}return db['OpenchannelAccount'][_0x0b7a('0x5a')]({'where':{'id':_0x5af3a4[_0x0b7a('0x56')]['id']},'include':[{'model':db[_0x0b7a('0x3c')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x3c15dd,null))['then'](saveUpdates(_0x5af3a4['body'],null))[_0x0b7a('0x1f')](respondWithResult(_0x3c15dd,null))['catch'](handleError(_0x3c15dd,null));};exports['destroy']=function(_0x255747,_0x161efc){return db[_0x0b7a('0x3d')][_0x0b7a('0x5a')]({'where':{'id':_0x255747['params']['id']}})['then'](handleEntityNotFound(_0x161efc,null))[_0x0b7a('0x1f')](removeEntity(_0x161efc,null))[_0x0b7a('0x28')](handleError(_0x161efc,null));};exports[_0x0b7a('0x64')]=function(_0x5bdf03,_0x58c5f5){return db[_0x0b7a('0x3d')][_0x0b7a('0x64')]()[_0x0b7a('0x1f')](respondWithResult(_0x58c5f5,null))[_0x0b7a('0x28')](handleError(_0x58c5f5,null));};exports[_0x0b7a('0x65')]=function(_0x316bf4,_0x441530,_0x21ed18){if(_0x316bf4[_0x0b7a('0x5c')]['id']){delete _0x316bf4[_0x0b7a('0x5c')]['id'];}return db[_0x0b7a('0x3d')][_0x0b7a('0x5a')]({'where':{'id':_0x316bf4[_0x0b7a('0x56')]['id']}})['then'](handleEntityNotFound(_0x441530,null))['then'](function(_0x31ddf6){if(_0x31ddf6){_0x316bf4['body'][_0x0b7a('0x66')]=_0x31ddf6['id'];return db[_0x0b7a('0x67')]['create'](_0x316bf4['body']);}})[_0x0b7a('0x1f')](respondWithResult(_0x441530,null))[_0x0b7a('0x28')](handleError(_0x441530,null));};exports[_0x0b7a('0x68')]=function(_0x2fcab4,_0x49a45a,_0x2910fc){var _0x35b133={'raw':![],'where':{}};var _0x1d089a={};var _0x4f9eb8={'count':0x0,'rows':[]};return db[_0x0b7a('0x3d')][_0x0b7a('0x69')]({'where':{'id':_0x2fcab4[_0x0b7a('0x56')]['id']}})[_0x0b7a('0x1f')](handleEntityNotFound(_0x49a45a,null))['then'](function(_0x1ae8b4){if(_0x1ae8b4){_0x1d089a[_0x0b7a('0x44')]=_['keys'](db[_0x0b7a('0x67')]['rawAttributes']);_0x1d089a['query']=_['keys'](_0x2fcab4[_0x0b7a('0x42')]);_0x1d089a['filters']=_[_0x0b7a('0x45')](_0x1d089a['model'],_0x1d089a[_0x0b7a('0x42')]);_0x35b133[_0x0b7a('0x48')]=_[_0x0b7a('0x45')](_0x1d089a[_0x0b7a('0x44')],qs[_0x0b7a('0x46')](_0x2fcab4[_0x0b7a('0x42')][_0x0b7a('0x46')]));_0x35b133[_0x0b7a('0x48')]=_0x35b133[_0x0b7a('0x48')][_0x0b7a('0x47')]?_0x35b133[_0x0b7a('0x48')]:_0x1d089a[_0x0b7a('0x44')];if(!_0x2fcab4['query']['hasOwnProperty'](_0x0b7a('0x6a'))){_0x35b133[_0x0b7a('0x30')]=qs['limit'](_0x2fcab4['query'][_0x0b7a('0x30')]);_0x35b133[_0x0b7a('0x2d')]=qs[_0x0b7a('0x2d')](_0x2fcab4['query'][_0x0b7a('0x2d')]);}_0x35b133[_0x0b7a('0x49')]=qs['sort'](_0x2fcab4[_0x0b7a('0x42')][_0x0b7a('0x4a')]);_0x35b133['where']=qs[_0x0b7a('0x43')](_[_0x0b7a('0x4c')](_0x2fcab4['query'],_0x1d089a[_0x0b7a('0x43')]));_0x35b133[_0x0b7a('0x4b')][_0x0b7a('0x66')]=_0x1ae8b4['id'];if(_0x2fcab4[_0x0b7a('0x42')][_0x0b7a('0x4d')]){_0x35b133['where']=_[_0x0b7a('0x4e')](_0x35b133[_0x0b7a('0x4b')],{'$or':_['map'](_0x35b133[_0x0b7a('0x48')],function(_0x38092b){var _0x247cfe={};_0x247cfe[_0x38092b]={'$like':'%'+_0x2fcab4[_0x0b7a('0x42')][_0x0b7a('0x4d')]+'%'};return _0x247cfe;})});}_0x35b133=_[_0x0b7a('0x4e')]({},_0x35b133,_0x2fcab4[_0x0b7a('0x59')]);return db[_0x0b7a('0x67')][_0x0b7a('0x2f')]({'where':_0x35b133[_0x0b7a('0x4b')]})[_0x0b7a('0x1f')](function(_0x33f6f5){_0x4f9eb8[_0x0b7a('0x2f')]=_0x33f6f5;if(_0x2fcab4[_0x0b7a('0x42')]['includeAll']){_0x35b133[_0x0b7a('0x52')]=[{'all':!![]}];}return db['Disposition'][_0x0b7a('0x53')](_0x35b133);})[_0x0b7a('0x1f')](function(_0xd872e4){_0x4f9eb8['rows']=_0xd872e4;return _0x4f9eb8;});}})['then'](respondWithFilteredResult(_0x49a45a,_0x35b133))[_0x0b7a('0x28')](handleError(_0x49a45a,null));};exports[_0x0b7a('0x6b')]=function(_0x2041c0,_0x7f39da,_0x545c50){return db[_0x0b7a('0x3d')][_0x0b7a('0x5a')]({'where':{'id':_0x2041c0[_0x0b7a('0x56')]['id']}})[_0x0b7a('0x1f')](handleEntityNotFound(_0x7f39da,null))[_0x0b7a('0x1f')](function(_0x9dfd4d){if(_0x9dfd4d){return _0x9dfd4d[_0x0b7a('0x6b')](_0x2041c0['query'][_0x0b7a('0x6c')]);}})[_0x0b7a('0x1f')](respondWithStatusCode(_0x7f39da,null))[_0x0b7a('0x28')](handleError(_0x7f39da,null));};exports[_0x0b7a('0x6d')]=function(_0x226871,_0x376d07,_0x3d9e72){if(_0x226871[_0x0b7a('0x5c')]['id']){delete _0x226871[_0x0b7a('0x5c')]['id'];}return db[_0x0b7a('0x3d')][_0x0b7a('0x5a')]({'where':{'id':_0x226871[_0x0b7a('0x56')]['id']}})[_0x0b7a('0x1f')](handleEntityNotFound(_0x376d07,null))[_0x0b7a('0x1f')](function(_0x3ec809){if(_0x3ec809){_0x226871['body'][_0x0b7a('0x66')]=_0x3ec809['id'];return db[_0x0b7a('0x6e')][_0x0b7a('0x5b')](_0x226871[_0x0b7a('0x5c')]);}})[_0x0b7a('0x1f')](respondWithResult(_0x376d07,null))[_0x0b7a('0x28')](handleError(_0x376d07,null));};exports[_0x0b7a('0x6f')]=function(_0x3b0f25,_0x31033a,_0x474268){var _0x313723={'raw':![],'where':{}};var _0x4a61ae={};var _0x5a4030={'count':0x0,'rows':[]};return db[_0x0b7a('0x3d')]['findOne']({'where':{'id':_0x3b0f25[_0x0b7a('0x56')]['id']}})['then'](handleEntityNotFound(_0x31033a,null))[_0x0b7a('0x1f')](function(_0x1112a6){if(_0x1112a6){_0x4a61ae[_0x0b7a('0x44')]=_[_0x0b7a('0x41')](db['CannedAnswer']['rawAttributes']);_0x4a61ae[_0x0b7a('0x42')]=_[_0x0b7a('0x41')](_0x3b0f25[_0x0b7a('0x42')]);_0x4a61ae[_0x0b7a('0x43')]=_[_0x0b7a('0x45')](_0x4a61ae[_0x0b7a('0x44')],_0x4a61ae['query']);_0x313723['attributes']=_[_0x0b7a('0x45')](_0x4a61ae[_0x0b7a('0x44')],qs[_0x0b7a('0x46')](_0x3b0f25[_0x0b7a('0x42')][_0x0b7a('0x46')]));_0x313723[_0x0b7a('0x48')]=_0x313723['attributes'][_0x0b7a('0x47')]?_0x313723[_0x0b7a('0x48')]:_0x4a61ae[_0x0b7a('0x44')];if(!_0x3b0f25[_0x0b7a('0x42')][_0x0b7a('0x70')](_0x0b7a('0x6a'))){_0x313723[_0x0b7a('0x30')]=qs[_0x0b7a('0x30')](_0x3b0f25['query']['limit']);_0x313723[_0x0b7a('0x2d')]=qs['offset'](_0x3b0f25[_0x0b7a('0x42')][_0x0b7a('0x2d')]);}_0x313723[_0x0b7a('0x49')]=qs[_0x0b7a('0x4a')](_0x3b0f25[_0x0b7a('0x42')][_0x0b7a('0x4a')]);_0x313723[_0x0b7a('0x4b')]=qs[_0x0b7a('0x43')](_[_0x0b7a('0x4c')](_0x3b0f25[_0x0b7a('0x42')],_0x4a61ae[_0x0b7a('0x43')]));_0x313723[_0x0b7a('0x4b')]['OpenchannelAccountId']=_0x1112a6['id'];if(_0x3b0f25['query'][_0x0b7a('0x4d')]){_0x313723[_0x0b7a('0x4b')]=_[_0x0b7a('0x4e')](_0x313723[_0x0b7a('0x4b')],{'$or':_[_0x0b7a('0x40')](_0x313723['attributes'],function(_0x10a86f){var _0x3fd0f1={};_0x3fd0f1[_0x10a86f]={'$like':'%'+_0x3b0f25[_0x0b7a('0x42')][_0x0b7a('0x4d')]+'%'};return _0x3fd0f1;})});}_0x313723=_[_0x0b7a('0x4e')]({},_0x313723,_0x3b0f25[_0x0b7a('0x59')]);return db[_0x0b7a('0x6e')][_0x0b7a('0x2f')]({'where':_0x313723[_0x0b7a('0x4b')]})[_0x0b7a('0x1f')](function(_0x474e46){_0x5a4030[_0x0b7a('0x2f')]=_0x474e46;if(_0x3b0f25[_0x0b7a('0x42')][_0x0b7a('0x51')]){_0x313723[_0x0b7a('0x52')]=[{'all':!![]}];}return db[_0x0b7a('0x6e')][_0x0b7a('0x53')](_0x313723);})[_0x0b7a('0x1f')](function(_0x34fc7e){_0x5a4030[_0x0b7a('0x54')]=_0x34fc7e;return _0x5a4030;});}})[_0x0b7a('0x1f')](respondWithFilteredResult(_0x31033a,_0x313723))['catch'](handleError(_0x31033a,null));};exports[_0x0b7a('0x71')]=function(_0x173048,_0xe260c8,_0x4f76bd){return db[_0x0b7a('0x3d')][_0x0b7a('0x5a')]({'where':{'id':_0x173048[_0x0b7a('0x56')]['id']}})['then'](handleEntityNotFound(_0xe260c8,null))['then'](function(_0x3aa1fa){if(_0x3aa1fa){return _0x3aa1fa[_0x0b7a('0x71')](_0x173048[_0x0b7a('0x42')]['ids']);}})[_0x0b7a('0x1f')](respondWithStatusCode(_0xe260c8,null))[_0x0b7a('0x28')](handleError(_0xe260c8,null));};exports[_0x0b7a('0x72')]=function(_0x2a57a5,_0x230f5c,_0x495f17){var _0x46913a={'body':_0x2a57a5[_0x0b7a('0x5c')],'channel':_0x0b7a('0x73')};var _0x460d60=[];var _0x47cde7=[];var _0x5b2d2b={};var _0x56c8b3=![];return db['CmContact'][_0x0b7a('0x64')]()[_0x0b7a('0x1f')](function(_0x773bba){if(!_0x773bba){throw new db[(_0x0b7a('0x74'))]['ValidationError']('no\x20available\x20attributes');}_0x460d60=_[_0x0b7a('0x75')](_[_0x0b7a('0x41')](_0x773bba),['createdAt',_0x0b7a('0x76')]);_0x47cde7=_[_0x0b7a('0x75')](_[_0x0b7a('0x41')](_0x773bba),['createdAt',_0x0b7a('0x76'),_0x0b7a('0x77'),_0x0b7a('0x78')]);if(_0x2a57a5[_0x0b7a('0x5c')]['id']){delete _0x2a57a5['body']['id'];}if(_[_0x0b7a('0x79')](_0x2a57a5[_0x0b7a('0x5c')][_0x0b7a('0x7a')])){throw new db['Sequelize'][(_0x0b7a('0x7b'))](_0x0b7a('0x7c'));}if(_['isNil'](_0x2a57a5[_0x0b7a('0x5c')][_0x0b7a('0x5c')])||_0x2a57a5['body']['body']===''){throw new db[(_0x0b7a('0x74'))][(_0x0b7a('0x7b'))](_0x0b7a('0x7d'));}if(_['isNil'](_0x2a57a5[_0x0b7a('0x5c')][_0x0b7a('0x7e')])){throw new db['Sequelize'][(_0x0b7a('0x7b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47cde7);}if(!_['includes'](_0x47cde7,_0x2a57a5['body']['mapKey'])){throw new db[(_0x0b7a('0x74'))][(_0x0b7a('0x7b'))](_0x0b7a('0x7f')+_0x47cde7);}_0x5b2d2b[_0x2a57a5[_0x0b7a('0x5c')]['mapKey']]=_0x2a57a5[_0x0b7a('0x5c')]['from'];})['then'](function(){return db[_0x0b7a('0x3d')][_0x0b7a('0x5a')]({'where':{'id':_0x2a57a5[_0x0b7a('0x56')]['id']},'include':[{'model':db[_0x0b7a('0x80')],'as':_0x0b7a('0x81'),'include':[{'model':db[_0x0b7a('0x82')],'as':'Contacts','where':_0x5b2d2b,'limit':0x1,'order':[[_0x0b7a('0x76'),_0x0b7a('0x83')]]}]},{'model':db[_0x0b7a('0x84')],'as':_0x0b7a('0x85')}]});})['then'](handleEntityNotFound(_0x230f5c,null))['then'](function(_0x74f2cd){if(_0x74f2cd&&_0x74f2cd[_0x0b7a('0x81')]){_0x46913a[_0x0b7a('0x86')]=_0x74f2cd;_0x46913a[_0x0b7a('0x87')]=_0x74f2cd[_0x0b7a('0x85')];_0x46913a[_0x0b7a('0x88')]=_0x74f2cd['List'];_0x46913a['applications']=_[_0x0b7a('0x89')](_0x46913a[_0x0b7a('0x87')],[_0x0b7a('0x8a')],[_0x0b7a('0x8b')]);if(_0x46913a[_0x0b7a('0x86')][_0x0b7a('0x85')]){delete _0x46913a['account'][_0x0b7a('0x85')];}if(_0x46913a[_0x0b7a('0x86')][_0x0b7a('0x81')]&&_0x46913a['account'][_0x0b7a('0x81')][_0x0b7a('0x8c')]['length']){return _0x46913a[_0x0b7a('0x86')]['List'][_0x0b7a('0x8c')][0x0];}var _0x4553ac=_[_0x0b7a('0x8d')](_0x2a57a5[_0x0b7a('0x5c')],{'firstName':_0x2a57a5[_0x0b7a('0x5c')][_0x0b7a('0x7a')],'ListId':_0x74f2cd[_0x0b7a('0x78')]});_0x4553ac[_0x2a57a5[_0x0b7a('0x5c')][_0x0b7a('0x7e')]]=_0x2a57a5[_0x0b7a('0x5c')][_0x0b7a('0x7a')];return db[_0x0b7a('0x82')][_0x0b7a('0x5b')](_0x4553ac,{'fields':_0x460d60,'raw':!![]});}})['then'](handleEntityNotFound(_0x230f5c,null))[_0x0b7a('0x1f')](function(_0x217671){_0x46913a['contact']=_0x217671;if(_0x217671){var _0x1de58c={'ContactId':_0x217671['id'],'OpenchannelAccountId':_0x2a57a5['params']['id'],'from':(_0x217671[_0x0b7a('0x8e')]||'')+'\x20'+(_0x217671[_0x0b7a('0x8f')]||'')};var _0x1d3d81={'OpenchannelAccountId':_0x2a57a5[_0x0b7a('0x56')]['id'],'closed':![]};if(_0x2a57a5['body'][_0x0b7a('0x90')]){_0x1d3d81[_0x0b7a('0x90')]=_0x2a57a5[_0x0b7a('0x5c')][_0x0b7a('0x90')];return db[_0x0b7a('0x91')][_0x0b7a('0x5a')]({'where':_0x1d3d81})['then'](function(_0x335380){if(_0x335380){return[_0x335380,![]];}_0x1de58c[_0x0b7a('0x90')]=_0x2a57a5[_0x0b7a('0x5c')][_0x0b7a('0x90')];_0x1de58c[_0x0b7a('0x92')]=_0x2a57a5[_0x0b7a('0x5c')][_0x0b7a('0x92')];return db[_0x0b7a('0x91')]['create'](_0x1de58c)[_0x0b7a('0x1f')](function(_0x2c168d){return[_0x2c168d,!![]];});});}else{_0x1d3d81[_0x0b7a('0x90')]=null;}_0x1d3d81[_0x0b7a('0x93')]=_0x217671['id'];return db[_0x0b7a('0x91')][_0x0b7a('0x5a')]({'where':_0x1d3d81})[_0x0b7a('0x1f')](function(_0x2092c0){if(_0x2092c0){return[_0x2092c0,![]];}return db['OpenchannelInteraction']['create'](_0x1de58c)[_0x0b7a('0x1f')](function(_0x35afff){return[_0x35afff,!![]];});});}})[_0x0b7a('0x94')](function(_0x8e78a2,_0x28f15b){if(_0x8e78a2){_0x56c8b3=_0x28f15b;if(!_0x28f15b){var _0x38c9e3={'from':(_0x46913a[_0x0b7a('0x95')][_0x0b7a('0x8e')]||'')+'\x20'+(_0x46913a[_0x0b7a('0x95')][_0x0b7a('0x8f')]||'')};if(_0x2a57a5['body'][_0x0b7a('0x90')]&&_0x2a57a5[_0x0b7a('0x5c')][_0x0b7a('0x96')]&&_0x2a57a5[_0x0b7a('0x5c')]['threadId']!=_0x2a57a5[_0x0b7a('0x5c')][_0x0b7a('0x96')]){_0x38c9e3[_0x0b7a('0x90')]=_0x2a57a5[_0x0b7a('0x5c')][_0x0b7a('0x96')];}return _0x8e78a2[_0x0b7a('0x34')](_0x38c9e3);}else{return _0x8e78a2;}}})[_0x0b7a('0x1f')](function(_0x34f094){_0x46913a['interaction']=_0x34f094['get']({'plain':!![]});_0x46913a[_0x0b7a('0x97')]['created']=_0x56c8b3;if(_0x46913a[_0x0b7a('0x97')]['created']){if(_0x46913a[_0x0b7a('0x86')][_0x0b7a('0x98')]){_0x46913a[_0x0b7a('0x87')][_0x0b7a('0x99')]({'id':0x0,'priority':_0x46913a[_0x0b7a('0x87')][_0x0b7a('0x47')]+0x1,'app':'close','appdata':_0x0b7a('0x9a'),'interval':_0x0b7a('0x9b')});}}return db[_0x0b7a('0x9c')][_0x0b7a('0x5b')]({'body':_0x2a57a5[_0x0b7a('0x5c')]['body'],'OpenchannelAccountId':_0x2a57a5[_0x0b7a('0x56')]['id'],'OpenchannelInteractionId':_0x34f094['id'],'direction':'in','ContactId':_0x46913a['contact']['id'],'AttachmentId':_0x2a57a5['body']['AttachmentId']});})['then'](function(_0x1f00da){_0x46913a[_0x0b7a('0x27')]=_0x1f00da;if(_0x46913a[_0x0b7a('0x97')][_0x0b7a('0x9d')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x46913a[_0x0b7a('0x97')][_0x0b7a('0x9d')]}})[_0x0b7a('0x1f')](function(_0x489161){if(_0x489161){_0x46913a[_0x0b7a('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x489161[_0x0b7a('0x39')]+','+(_0x46913a[_0x0b7a('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0x0b7a('0x9b')});_0x46913a[_0x0b7a('0x9e')]=![];}return respondWithRpcPromise(_0x0b7a('0x9f'),'startRouting',_0x46913a);});}return respondWithRpcPromise('Start',_0x0b7a('0xa0'),_0x46913a);})[_0x0b7a('0x1f')](function(_0x5cccad){respondWithRpcPromise(_0x0b7a('0xa1'),_0x0b7a('0xa1'),{'event':'notify','message':_0x5cccad},client9002);return _0x5cccad;})['then'](respondWithResult(_0x230f5c,null))[_0x0b7a('0x28')](handleError(_0x230f5c,null));};exports['addApplications']=function(_0x2d2d4e,_0x4154a7){var _0x35fee5=_0x2d2d4e[_0x0b7a('0x56')]['id'];var _0x5898d2=_0x2d2d4e[_0x0b7a('0x5c')];var _0x40c9be=0xc8;var _0xb2f688=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x0b7a('0xa2')][_0x0b7a('0xa3')][_0x0b7a('0xa4')][_0x0b7a('0xa5')]},function(_0xfe629f){return db[_0x0b7a('0x3d')][_0x0b7a('0x69')]({'where':{'id':_0x35fee5},'transaction':_0xfe629f})['then'](function(_0x473ec8){if(_0x473ec8){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x35fee5},'transaction':_0xfe629f})[_0x0b7a('0x1f')](function(){var _0x41fc99=_[_0x0b7a('0x40')](_0x5898d2,function(_0x2d19e1){_0x2d19e1[_0x0b7a('0x66')]=_0x35fee5;return _0x2d19e1;});return db[_0x0b7a('0x84')][_0x0b7a('0xa6')](_0x41fc99,{'transaction':_0xfe629f});});}else{_0x40c9be=0x194;_0xb2f688=[];}});})['then'](function(){if(_0x40c9be!==0x194){return db['OpenchannelApplication'][_0x0b7a('0xa7')]({'where':{'OpenchannelAccountId':_0x35fee5},'order':'priority'})[_0x0b7a('0x1f')](function(_0x97d99b){_0xb2f688=_0x97d99b;});}})['catch'](function(_0x311ce0){_0x40c9be=0x1f4;logger[_0x0b7a('0x25')](_0x311ce0[_0x0b7a('0xa8')]);if(_0x311ce0[_0x0b7a('0x39')]){delete _0x311ce0[_0x0b7a('0x39')];}_0xb2f688=_0x311ce0;})[_0x0b7a('0xa9')](function(){if(_0xb2f688===null){_0x4154a7[_0x0b7a('0x29')](_0x40c9be);}else{if(_0x40c9be===0x1f4){_0x4154a7[_0x0b7a('0x2a')](_0x40c9be)[_0x0b7a('0x3a')](_0xb2f688);}else{_0x4154a7[_0x0b7a('0x2a')](_0x40c9be)[_0x0b7a('0x2c')](_0xb2f688);}}});};exports[_0x0b7a('0xaa')]=function(_0x186858,_0xb16071,_0x4152d7){var _0x2e6c3b={};var _0x4bacf6={};var _0x5924dd;var _0x567a78;return db[_0x0b7a('0x3d')][_0x0b7a('0x69')]({'where':{'id':_0x186858['params']['id']}})[_0x0b7a('0x1f')](handleEntityNotFound(_0xb16071,null))[_0x0b7a('0x1f')](function(_0x4d2914){if(_0x4d2914){_0x5924dd=_0x4d2914;_0x4bacf6[_0x0b7a('0x44')]=_[_0x0b7a('0x41')](db['OpenchannelApplication'][_0x0b7a('0x58')]);_0x4bacf6[_0x0b7a('0x42')]=_['keys'](_0x186858[_0x0b7a('0x42')]);_0x4bacf6[_0x0b7a('0x43')]=_[_0x0b7a('0x45')](_0x4bacf6[_0x0b7a('0x44')],_0x4bacf6[_0x0b7a('0x42')]);_0x2e6c3b[_0x0b7a('0x48')]=_[_0x0b7a('0x45')](_0x4bacf6[_0x0b7a('0x44')],qs[_0x0b7a('0x46')](_0x186858['query'][_0x0b7a('0x46')]));_0x2e6c3b[_0x0b7a('0x48')]=_0x2e6c3b[_0x0b7a('0x48')][_0x0b7a('0x47')]?_0x2e6c3b[_0x0b7a('0x48')]:_0x4bacf6[_0x0b7a('0x44')];_0x2e6c3b[_0x0b7a('0x49')]=qs[_0x0b7a('0x4a')](_0x186858[_0x0b7a('0x42')][_0x0b7a('0x4a')]);_0x2e6c3b[_0x0b7a('0x4b')]=qs[_0x0b7a('0x43')](_[_0x0b7a('0x4c')](_0x186858['query'],_0x4bacf6[_0x0b7a('0x43')]));if(_0x186858[_0x0b7a('0x42')][_0x0b7a('0x4d')]){_0x2e6c3b['where']=_[_0x0b7a('0x4e')](_0x2e6c3b['where'],{'$or':_['map'](_0x2e6c3b['attributes'],function(_0x3c5581){var _0xb40570={};_0xb40570[_0x3c5581]={'$like':'%'+_0x186858[_0x0b7a('0x42')]['filter']+'%'};return _0xb40570;})});}_0x2e6c3b=_['merge']({},_0x2e6c3b,_0x186858[_0x0b7a('0x59')]);return _0x5924dd[_0x0b7a('0xaa')](_0x2e6c3b);}})['then'](function(_0x44a327){if(_0x44a327){_0x567a78=_0x44a327[_0x0b7a('0x47')];if(!_0x186858['query'][_0x0b7a('0x70')](_0x0b7a('0x6a'))){_0x2e6c3b[_0x0b7a('0x30')]=qs[_0x0b7a('0x30')](_0x186858['query'][_0x0b7a('0x30')]);_0x2e6c3b[_0x0b7a('0x2d')]=qs[_0x0b7a('0x2d')](_0x186858['query'][_0x0b7a('0x2d')]);}return _0x5924dd['getApplications'](_0x2e6c3b);}})['then'](function(_0x3687ca){if(_0x3687ca){return _0x3687ca?{'count':_0x567a78,'rows':_0x3687ca}:null;}})[_0x0b7a('0x1f')](respondWithResult(_0xb16071,null))[_0x0b7a('0x28')](handleError(_0xb16071,null));};exports[_0x0b7a('0xab')]=function(_0x432b40,_0x25fd0e,_0x2f3e5a){var _0x50c6f3={'raw':![],'where':{}};var _0x14e813={};var _0x5b9463={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0b7a('0x69')]({'where':{'id':_0x432b40['params']['id']}})['then'](handleEntityNotFound(_0x25fd0e,null))['then'](function(_0x5a265c){if(_0x5a265c){_0x14e813[_0x0b7a('0x44')]=_[_0x0b7a('0x41')](db[_0x0b7a('0x91')][_0x0b7a('0x58')]);_0x14e813[_0x0b7a('0x42')]=_[_0x0b7a('0x41')](_0x432b40[_0x0b7a('0x42')]);_0x14e813['filters']=_['intersection'](_0x14e813['model'],_0x14e813[_0x0b7a('0x42')]);_0x50c6f3[_0x0b7a('0x48')]=_['intersection'](_0x14e813[_0x0b7a('0x44')],qs[_0x0b7a('0x46')](_0x432b40[_0x0b7a('0x42')][_0x0b7a('0x46')]));_0x50c6f3[_0x0b7a('0x48')]=_0x50c6f3[_0x0b7a('0x48')][_0x0b7a('0x47')]?_0x50c6f3[_0x0b7a('0x48')]:_0x14e813[_0x0b7a('0x44')];if(!_0x432b40['query'][_0x0b7a('0x70')](_0x0b7a('0x6a'))){_0x50c6f3[_0x0b7a('0x30')]=qs['limit'](_0x432b40['query']['limit']);_0x50c6f3[_0x0b7a('0x2d')]=qs[_0x0b7a('0x2d')](_0x432b40[_0x0b7a('0x42')][_0x0b7a('0x2d')]);}_0x50c6f3['order']=qs[_0x0b7a('0x4a')](_0x432b40['query'][_0x0b7a('0x4a')]);_0x50c6f3[_0x0b7a('0x4b')]=qs[_0x0b7a('0x43')](_[_0x0b7a('0x4c')](_0x432b40[_0x0b7a('0x42')],_0x14e813['filters']));_0x50c6f3['where']['OpenchannelAccountId']=_0x5a265c['id'];if(_0x432b40[_0x0b7a('0x42')]['filter']){_0x50c6f3[_0x0b7a('0x4b')]=_[_0x0b7a('0x4e')](_0x50c6f3[_0x0b7a('0x4b')],{'$or':_[_0x0b7a('0x40')](_0x50c6f3[_0x0b7a('0x48')],function(_0x1023b3){var _0x83c58={};_0x83c58[_0x1023b3]={'$like':'%'+_0x432b40['query']['filter']+'%'};return _0x83c58;})});}_0x50c6f3=_[_0x0b7a('0x4e')]({},_0x50c6f3,_0x432b40['options']);return db['OpenchannelInteraction']['count']({'where':_0x50c6f3['where']})[_0x0b7a('0x1f')](function(_0xf6cf59){_0x5b9463[_0x0b7a('0x2f')]=_0xf6cf59;if(_0x432b40[_0x0b7a('0x42')]['includeAll']){_0x50c6f3['include']=[{'model':db[_0x0b7a('0x82')],'as':_0x0b7a('0xac'),'required':![]},{'model':db['User'],'as':_0x0b7a('0xad'),'attributes':['name',_0x0b7a('0xae'),_0x0b7a('0xaf')],'required':![]},{'model':db[_0x0b7a('0xb0')],'as':'Tags','attributes':['id',_0x0b7a('0x39'),_0x0b7a('0xb1')],'where':_0x432b40[_0x0b7a('0x42')][_0x0b7a('0xb2')]?{'id':_0x432b40[_0x0b7a('0x42')][_0x0b7a('0xb2')]}:undefined,'required':_0x432b40[_0x0b7a('0x42')]['tag']?!![]:![]}];}return db[_0x0b7a('0x91')][_0x0b7a('0x53')](_0x50c6f3);})[_0x0b7a('0x1f')](function(_0x53cae1){_0x5b9463[_0x0b7a('0x54')]=_0x53cae1;return _0x5b9463;});}})[_0x0b7a('0x1f')](respondWithFilteredResult(_0x25fd0e,_0x50c6f3))['catch'](handleError(_0x25fd0e,null));};exports[_0x0b7a('0xb3')]=function(_0x2c1cb7,_0x3e0314,_0x4665b2){return db[_0x0b7a('0x3d')][_0x0b7a('0x5a')]({'where':{'id':_0x2c1cb7[_0x0b7a('0x56')]['id']}})[_0x0b7a('0x1f')](handleEntityNotFound(_0x3e0314,null))[_0x0b7a('0x1f')](function(_0x39d0a4){if(_0x39d0a4){return _0x39d0a4[_0x0b7a('0xb3')](_0x2c1cb7[_0x0b7a('0x5c')][_0x0b7a('0x6c')],_[_0x0b7a('0xb4')](_0x2c1cb7[_0x0b7a('0x5c')],[_0x0b7a('0x6c'),'id'])||{})[_0x0b7a('0x94')](function(_0x196b8f){for(var _0xb5509c=0x0;_0xb5509c<_0x2c1cb7[_0x0b7a('0x5c')][_0x0b7a('0x6c')][_0x0b7a('0x47')];_0xb5509c+=0x1){socket['emit'](_0x0b7a('0xb5'),{'UserId':Number(_0x2c1cb7[_0x0b7a('0x5c')][_0x0b7a('0x6c')][_0xb5509c]),'OpenchannelAccountId':Number(_0x2c1cb7[_0x0b7a('0x56')]['id'])});}return _0x196b8f;});}})[_0x0b7a('0x1f')](respondWithResult(_0x3e0314,null))[_0x0b7a('0x28')](handleError(_0x3e0314,null));};exports[_0x0b7a('0xb6')]=function(_0x7526c5,_0x45e0c7,_0x319541){return db['OpenchannelAccount']['find']({'where':{'id':_0x7526c5[_0x0b7a('0x56')]['id']}})[_0x0b7a('0x1f')](handleEntityNotFound(_0x45e0c7,null))['then'](function(_0xa5b46){if(_0xa5b46){return _0xa5b46[_0x0b7a('0xb6')](_0x7526c5['query'][_0x0b7a('0x6c')])[_0x0b7a('0x1f')](function(){if(_['isArray'](_0x7526c5[_0x0b7a('0x42')][_0x0b7a('0x6c')])){for(var _0x2051dd=0x0;_0x2051dd<_0x7526c5['query']['ids'][_0x0b7a('0x47')];_0x2051dd+=0x1){socket[_0x0b7a('0xb7')](_0x0b7a('0xb8'),{'UserId':Number(_0x7526c5[_0x0b7a('0x42')]['ids'][_0x2051dd]),'OpenchannelAccountId':Number(_0x7526c5[_0x0b7a('0x56')]['id'])});}}else{socket['emit'](_0x0b7a('0xb8'),{'UserId':Number(_0x7526c5[_0x0b7a('0x42')][_0x0b7a('0x6c')]),'OpenchannelAccountId':Number(_0x7526c5[_0x0b7a('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x45e0c7,null))['catch'](handleError(_0x45e0c7,null));};exports[_0x0b7a('0xb9')]=function(_0x23d6e5,_0x5f5c3e,_0x10c779){var _0x51faaa={};var _0x57d9fa={};var _0x2df28d;var _0x26d8db;return db[_0x0b7a('0x3d')][_0x0b7a('0x69')]({'where':{'id':_0x23d6e5[_0x0b7a('0x56')]['id']}})[_0x0b7a('0x1f')](handleEntityNotFound(_0x5f5c3e,null))['then'](function(_0x13d9bb){if(_0x13d9bb){_0x2df28d=_0x13d9bb;_0x57d9fa[_0x0b7a('0x44')]=_['keys'](db[_0x0b7a('0xba')][_0x0b7a('0x58')]);_0x57d9fa[_0x0b7a('0x42')]=_[_0x0b7a('0x41')](_0x23d6e5[_0x0b7a('0x42')]);_0x57d9fa[_0x0b7a('0x43')]=_['intersection'](_0x57d9fa[_0x0b7a('0x44')],_0x57d9fa[_0x0b7a('0x42')]);_0x51faaa[_0x0b7a('0x48')]=_[_0x0b7a('0x45')](_0x57d9fa[_0x0b7a('0x44')],qs[_0x0b7a('0x46')](_0x23d6e5[_0x0b7a('0x42')][_0x0b7a('0x46')]));_0x51faaa[_0x0b7a('0x48')]=_0x51faaa[_0x0b7a('0x48')][_0x0b7a('0x47')]?_0x51faaa[_0x0b7a('0x48')]:_0x57d9fa[_0x0b7a('0x44')];_0x51faaa[_0x0b7a('0x49')]=qs[_0x0b7a('0x4a')](_0x23d6e5[_0x0b7a('0x42')][_0x0b7a('0x4a')]);_0x51faaa['where']=qs[_0x0b7a('0x43')](_[_0x0b7a('0x4c')](_0x23d6e5['query'],_0x57d9fa[_0x0b7a('0x43')]));if(_0x23d6e5[_0x0b7a('0x42')][_0x0b7a('0x4d')]){_0x51faaa[_0x0b7a('0x4b')]=_[_0x0b7a('0x4e')](_0x51faaa[_0x0b7a('0x4b')],{'$or':_['map'](_0x51faaa[_0x0b7a('0x48')],function(_0x5d9b0d){var _0x30d8b3={};_0x30d8b3[_0x5d9b0d]={'$like':'%'+_0x23d6e5[_0x0b7a('0x42')][_0x0b7a('0x4d')]+'%'};return _0x30d8b3;})});}_0x51faaa=_['merge']({},_0x51faaa,_0x23d6e5['options']);return _0x2df28d[_0x0b7a('0xb9')](_0x51faaa);}})[_0x0b7a('0x1f')](function(_0xce5d71){if(_0xce5d71){_0x26d8db=_0xce5d71[_0x0b7a('0x47')];if(!_0x23d6e5[_0x0b7a('0x42')][_0x0b7a('0x70')]('nolimit')){_0x51faaa[_0x0b7a('0x30')]=qs[_0x0b7a('0x30')](_0x23d6e5[_0x0b7a('0x42')]['limit']);_0x51faaa[_0x0b7a('0x2d')]=qs['offset'](_0x23d6e5[_0x0b7a('0x42')][_0x0b7a('0x2d')]);}return _0x2df28d['getAgents'](_0x51faaa);}})['then'](function(_0x2266cf){if(_0x2266cf){return _0x2266cf?{'count':_0x26d8db,'rows':_0x2266cf}:null;}})[_0x0b7a('0x1f')](respondWithResult(_0x5f5c3e,null))[_0x0b7a('0x28')](handleError(_0x5f5c3e,null));};exports[_0x0b7a('0x3a')]=function(_0x19a048,_0x2fe376,_0x20f740){var _0x577466,_0x33d4e3,_0x26d28e;if(_[_0x0b7a('0x79')](_0x19a048[_0x0b7a('0x5c')][_0x0b7a('0x5c')])||_0x19a048[_0x0b7a('0x5c')][_0x0b7a('0x5c')]===''){throw new db[(_0x0b7a('0x74'))][(_0x0b7a('0x7b'))](_0x0b7a('0x7d'));}if(_[_0x0b7a('0x79')](_0x19a048['body']['to'])){}_0x577466=_0x19a048[_0x0b7a('0x5c')]['to'];return db[_0x0b7a('0x3d')][_0x0b7a('0x69')]({'where':{'id':_0x19a048[_0x0b7a('0x56')]['id']}})[_0x0b7a('0x1f')](handleEntityNotFound(_0x2fe376,null))['then'](function(_0xd1a7ab){if(_0xd1a7ab){return db[_0x0b7a('0x3d')][_0x0b7a('0x5a')]({'where':{'id':_0xd1a7ab['id']},'include':[{'model':db['CmList'],'as':_0x0b7a('0x81'),'include':[{'model':db[_0x0b7a('0x82')],'as':_0x0b7a('0x8c'),'where':{[_0xd1a7ab[_0x0b7a('0x7e')]]:_0x577466},'limit':0x1,'order':[[_0x0b7a('0x76'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2fe376,null))[_0x0b7a('0x1f')](function(_0x205d71){if(_0x205d71&&_0x205d71[_0x0b7a('0x81')]){_0x33d4e3=_0x205d71[_0x0b7a('0x36')]({'plain':!![]});if(_0x33d4e3[_0x0b7a('0x81')]&&_0x33d4e3[_0x0b7a('0x81')][_0x0b7a('0x8c')]['length']){return _0x33d4e3[_0x0b7a('0x81')]['Contacts'][0x0];}return db[_0x0b7a('0x82')]['create'](_['defaults'](_0x19a048[_0x0b7a('0x5c')],{'firstName':_0x577466,[_0x205d71[_0x0b7a('0x7e')]]:_0x577466,'phone':_0x577466,'ListId':_0x33d4e3[_0x0b7a('0x78')]}));}})[_0x0b7a('0x1f')](handleEntityNotFound(_0x2fe376,null))[_0x0b7a('0x1f')](function(_0x7470bd){if(_0x7470bd){_0x26d28e=_0x7470bd;return db[_0x0b7a('0x91')][_0x0b7a('0x5a')]({'where':{'ContactId':_0x26d28e['id'],'closed':![],'OpenchannelAccountId':_0x33d4e3['id']}})[_0x0b7a('0x1f')](function(_0x207d82){if(_0x207d82){return[_0x207d82,![]];}return db[_0x0b7a('0x91')][_0x0b7a('0x5b')]({'UserId':_0x19a048[_0x0b7a('0x5f')]['id'],'ContactId':_0x26d28e['id'],'OpenchannelAccountId':_0x33d4e3['id'],'lastMsgDirection':'out','firstMsgDirection':_0x0b7a('0xbb'),'Messages':[_[_0x0b7a('0x4e')](_0x19a048['body'],{'read':![],'body':_0x19a048[_0x0b7a('0x5c')][_0x0b7a('0x5c')],'OpenchannelAccountId':_0x33d4e3['id'],'UserId':_0x19a048[_0x0b7a('0x5f')]['id'],'ContactId':_0x26d28e['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x0b7a('0xbc')}]})['then'](function(_0x16e704){return[_0x16e704,!![]];});});}})[_0x0b7a('0x94')](function(_0x7704bc,_0x7bac97){if(_0x7bac97){return _0x7704bc;}return db['OpenchannelMessage']['create'](_[_0x0b7a('0x4e')](_0x19a048['body'],{'read':![],'body':_0x19a048['body'][_0x0b7a('0x5c')],'OpenchannelAccountId':_0x33d4e3['id'],'OpenchannelInteractionId':_0x7704bc['id'],'UserId':_0x19a048[_0x0b7a('0x5f')]['id'],'ContactId':_0x26d28e['id']}))['then'](function(_0x47e392){_0x7704bc[_0x0b7a('0xbd')]['Messages']=[];_0x7704bc['dataValues'][_0x0b7a('0xbc')]['push'](_0x47e392['dataValues']);return _0x7704bc;});});}})[_0x0b7a('0x1f')](respondWithResult(_0x2fe376,null))[_0x0b7a('0x28')](handleError(_0x2fe376,null));}; \ No newline at end of file +var _0xcbdd=['lastName','messageId','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','priority','finally','getInteractions','Contact','fullname','internal','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','OpenchannelAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','Disposition','findOne','hasOwnProperty','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','nolimit','removeAnswers','notify','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','ListId','mapKey','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread'];(function(_0x5e8d97,_0x376a53){var _0x448308=function(_0x4fd359){while(--_0x4fd359){_0x5e8d97['push'](_0x5e8d97['shift']());}};_0x448308(++_0x376a53);}(_0xcbdd,0xec));var _0xdcbd=function(_0x2727d4,_0x517ee2){_0x2727d4=_0x2727d4-0x0;var _0x29d8df=_0xcbdd[_0x2727d4];return _0x29d8df;};'use strict';var emlformat=require(_0xdcbd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcbd('0x1'));var jsonpatch=require(_0xdcbd('0x2'));var rp=require(_0xdcbd('0x3'));var moment=require('moment');var BPromise=require(_0xdcbd('0x4'));var Mustache=require(_0xdcbd('0x5'));var util=require(_0xdcbd('0x6'));var path=require('path');var sox=require(_0xdcbd('0x7'));var csv=require('to-csv');var ejs=require(_0xdcbd('0x8'));var fs=require('fs');var fs_extra=require(_0xdcbd('0x9'));var _=require(_0xdcbd('0xa'));var squel=require(_0xdcbd('0xb'));var crypto=require(_0xdcbd('0xc'));var jsforce=require(_0xdcbd('0xd'));var deskjs=require(_0xdcbd('0xe'));var toCsv=require(_0xdcbd('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdcbd('0x10'));var authService=require(_0xdcbd('0x11'));var qs=require(_0xdcbd('0x12'));var as=require(_0xdcbd('0x13'));var hardwareService=require(_0xdcbd('0x14'));var logger=require(_0xdcbd('0x15'))(_0xdcbd('0x16'));var utils=require(_0xdcbd('0x17'));var config=require(_0xdcbd('0x18'));var licenseUtil=require(_0xdcbd('0x19'));var db=require(_0xdcbd('0x1a'))['db'];config[_0xdcbd('0x1b')]=_[_0xdcbd('0x1c')](config[_0xdcbd('0x1b')],{'host':_0xdcbd('0x1d'),'port':0x18eb});var socket=require(_0xdcbd('0x1e'))(new Redis(config[_0xdcbd('0x1b')]));require(_0xdcbd('0x1f'))[_0xdcbd('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdcbd('0x21')][_0xdcbd('0x22')]({'port':0x232c});var client9002=jayson[_0xdcbd('0x21')][_0xdcbd('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2a355a,_0x4c2eb2,_0x34df49,_0x5dd38d){return new BPromise(function(_0x2ab84c,_0x5a4cc2){var _0x55b094=_0x5dd38d||client;return _0x55b094[_0xdcbd('0x23')](_0x2a355a,_0x34df49)['then'](function(_0x3da27a){logger['info'](_0xdcbd('0x24'),_0x4c2eb2,_0xdcbd('0x25'));logger[_0xdcbd('0x26')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4c2eb2,'request\x20sent',JSON[_0xdcbd('0x27')](_0x3da27a));if(_0x3da27a[_0xdcbd('0x28')]){if(_0x3da27a[_0xdcbd('0x28')][_0xdcbd('0x29')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4c2eb2,_0x3da27a[_0xdcbd('0x28')][_0xdcbd('0x2a')]);return _0x5a4cc2(_0x3da27a['error']['message']);}logger[_0xdcbd('0x28')](_0xdcbd('0x24'),_0x4c2eb2,_0x3da27a['error'][_0xdcbd('0x2a')]);return _0x2ab84c(_0x3da27a[_0xdcbd('0x28')][_0xdcbd('0x2a')]);}else{logger[_0xdcbd('0x2b')](_0xdcbd('0x24'),_0x4c2eb2,_0xdcbd('0x25'));_0x2ab84c(_0x3da27a['result'][_0xdcbd('0x2a')]);}})[_0xdcbd('0x2c')](function(_0x503294){logger[_0xdcbd('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x4c2eb2,_0x503294);_0x5a4cc2(_0x503294);});});}function respondWithStatusCode(_0x166579,_0x19617d){_0x19617d=_0x19617d||0xcc;return function(_0x3edeb8){if(_0x3edeb8){return _0x166579[_0xdcbd('0x2d')](_0x19617d);}return _0x166579[_0xdcbd('0x2e')](_0x19617d)['end']();};}function respondWithResult(_0x58532a,_0x55950b){_0x55950b=_0x55950b||0xc8;return function(_0x541b41){if(_0x541b41){return _0x58532a['status'](_0x55950b)[_0xdcbd('0x2f')](_0x541b41);}};}function respondWithFilteredResult(_0x13bf63,_0x32900d){return function(_0x11e7c6){if(_0x11e7c6){var _0x493311=typeof _0x32900d[_0xdcbd('0x30')]===_0xdcbd('0x31')&&typeof _0x32900d[_0xdcbd('0x32')]===_0xdcbd('0x31');var _0x1f2781=_0x11e7c6['count'];var _0x47105e=_0x493311?0x0:_0x32900d[_0xdcbd('0x30')];var _0x8e1b19=_0x493311?_0x11e7c6[_0xdcbd('0x33')]:_0x32900d[_0xdcbd('0x30')]+_0x32900d[_0xdcbd('0x32')];var _0x34a473;if(_0x8e1b19>=_0x1f2781){_0x8e1b19=_0x1f2781;_0x34a473=0xc8;}else{_0x34a473=0xce;}_0x13bf63[_0xdcbd('0x2e')](_0x34a473);return _0x13bf63[_0xdcbd('0x34')](_0xdcbd('0x35'),_0x47105e+'-'+_0x8e1b19+'/'+_0x1f2781)[_0xdcbd('0x2f')](_0x11e7c6);}return null;};}function patchUpdates(_0xa275f4){return function(_0x5f2cac){try{jsonpatch['apply'](_0x5f2cac,_0xa275f4,!![]);}catch(_0x2ecc91){return BPromise[_0xdcbd('0x36')](_0x2ecc91);}return _0x5f2cac['save']();};}function saveUpdates(_0x41cda1,_0x1e7c16){return function(_0x4634e2){if(_0x4634e2){return _0x4634e2[_0xdcbd('0x37')](_0x41cda1)['then'](function(_0x2710b7){return _0x2710b7;});}return null;};}function removeEntity(_0x2f5816,_0x18cdd3){return function(_0x3f8459){if(_0x3f8459){return _0x3f8459['destroy']()[_0xdcbd('0x38')](function(){var _0x367d2f=_0x3f8459['get']({'plain':!![]});var _0x2900f2=_0xdcbd('0x39');return db[_0xdcbd('0x3a')][_0xdcbd('0x3b')]({'where':{'type':_0x2900f2,'resourceId':_0x367d2f['id']}})[_0xdcbd('0x38')](function(){return _0x3f8459;});})[_0xdcbd('0x38')](function(){_0x2f5816[_0xdcbd('0x2e')](0xcc)[_0xdcbd('0x3c')]();});}};}function handleEntityNotFound(_0x4d8671,_0x2ef973){return function(_0x2da9cd){if(!_0x2da9cd){_0x4d8671[_0xdcbd('0x2d')](0x194);}return _0x2da9cd;};}function handleError(_0x4ef512,_0x53b361){_0x53b361=_0x53b361||0x1f4;return function(_0x51e096){logger[_0xdcbd('0x28')](_0x51e096[_0xdcbd('0x3d')]);if(_0x51e096[_0xdcbd('0x3e')]){delete _0x51e096[_0xdcbd('0x3e')];}_0x4ef512['status'](_0x53b361)[_0xdcbd('0x3f')](_0x51e096);};}exports[_0xdcbd('0x40')]=function(_0x1410ea,_0x562b16){var _0x40ad0e={'include':[{'model':db[_0xdcbd('0x41')],'as':_0xdcbd('0x42')}]},_0x2ae2e7={},_0x2a6a60={'count':0x0,'rows':[]};var _0x4bb9d7=_[_0xdcbd('0x43')](db[_0xdcbd('0x44')][_0xdcbd('0x45')],function(_0x3c3e6c){return{'name':_0x3c3e6c[_0xdcbd('0x46')],'type':_0x3c3e6c[_0xdcbd('0x47')][_0xdcbd('0x48')]};});_0x2ae2e7[_0xdcbd('0x49')]=_[_0xdcbd('0x43')](_0x4bb9d7,_0xdcbd('0x3e'));_0x2ae2e7[_0xdcbd('0x4a')]=_['keys'](_0x1410ea['query']);_0x2ae2e7[_0xdcbd('0x4b')]=_[_0xdcbd('0x4c')](_0x2ae2e7[_0xdcbd('0x49')],_0x2ae2e7[_0xdcbd('0x4a')]);_0x40ad0e[_0xdcbd('0x4d')]=_[_0xdcbd('0x4c')](_0x2ae2e7['model'],qs[_0xdcbd('0x4e')](_0x1410ea[_0xdcbd('0x4a')]['fields']));_0x40ad0e[_0xdcbd('0x4d')]=_0x40ad0e[_0xdcbd('0x4d')][_0xdcbd('0x4f')]?_0x40ad0e[_0xdcbd('0x4d')]:_0x2ae2e7['model'];if(!_0x1410ea[_0xdcbd('0x4a')]['hasOwnProperty']('nolimit')){_0x40ad0e[_0xdcbd('0x32')]=qs[_0xdcbd('0x32')](_0x1410ea[_0xdcbd('0x4a')]['limit']);_0x40ad0e[_0xdcbd('0x30')]=qs[_0xdcbd('0x30')](_0x1410ea[_0xdcbd('0x4a')][_0xdcbd('0x30')]);}_0x40ad0e[_0xdcbd('0x50')]=qs['sort'](_0x1410ea[_0xdcbd('0x4a')][_0xdcbd('0x51')]);_0x40ad0e[_0xdcbd('0x52')]=qs[_0xdcbd('0x4b')](_[_0xdcbd('0x53')](_0x1410ea[_0xdcbd('0x4a')],_0x2ae2e7[_0xdcbd('0x4b')]),_0x4bb9d7);if(_0x1410ea[_0xdcbd('0x4a')][_0xdcbd('0x54')]){_0x40ad0e[_0xdcbd('0x52')]=_[_0xdcbd('0x55')](_0x40ad0e[_0xdcbd('0x52')],{'$or':_['map'](_0x4bb9d7,function(_0x1730e4){if(_0x1730e4['type']!==_0xdcbd('0x56')){var _0x27e3fe={};_0x27e3fe[_0x1730e4[_0xdcbd('0x3e')]]={'$like':'%'+_0x1410ea[_0xdcbd('0x4a')][_0xdcbd('0x54')]+'%'};return _0x27e3fe;}})});}_0x40ad0e=_[_0xdcbd('0x55')]({},_0x40ad0e,_0x1410ea[_0xdcbd('0x57')]);var _0x5e5fcc={'where':_0x40ad0e['where']};return db[_0xdcbd('0x44')][_0xdcbd('0x33')](_0x5e5fcc)['then'](function(_0x206c1f){_0x2a6a60[_0xdcbd('0x33')]=_0x206c1f;if(_0x1410ea['query'][_0xdcbd('0x58')]){_0x40ad0e[_0xdcbd('0x59')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xdcbd('0x5a')](_0x40ad0e);})[_0xdcbd('0x38')](function(_0x2667dd){_0x2a6a60[_0xdcbd('0x5b')]=_0x2667dd;return _0x2a6a60;})[_0xdcbd('0x38')](respondWithFilteredResult(_0x562b16,_0x40ad0e))[_0xdcbd('0x2c')](handleError(_0x562b16,null));};exports['show']=function(_0x3667e5,_0x481ab7){var _0x22ba96={'raw':![],'where':{'id':_0x3667e5[_0xdcbd('0x5c')]['id']},'include':[{'model':db[_0xdcbd('0x41')],'as':_0xdcbd('0x42')}]},_0x5998cf={};_0x5998cf['model']=_[_0xdcbd('0x5d')](db[_0xdcbd('0x44')]['rawAttributes']);_0x5998cf['query']=_[_0xdcbd('0x5d')](_0x3667e5[_0xdcbd('0x4a')]);_0x5998cf['filters']=_[_0xdcbd('0x4c')](_0x5998cf[_0xdcbd('0x49')],_0x5998cf[_0xdcbd('0x4a')]);_0x22ba96[_0xdcbd('0x4d')]=_['intersection'](_0x5998cf['model'],qs[_0xdcbd('0x4e')](_0x3667e5[_0xdcbd('0x4a')]['fields']));_0x22ba96[_0xdcbd('0x4d')]=_0x22ba96[_0xdcbd('0x4d')][_0xdcbd('0x4f')]?_0x22ba96[_0xdcbd('0x4d')]:_0x5998cf[_0xdcbd('0x49')];if(_0x3667e5[_0xdcbd('0x4a')][_0xdcbd('0x58')]){_0x22ba96[_0xdcbd('0x59')]=[{'all':!![]}];}_0x22ba96=_[_0xdcbd('0x55')]({},_0x22ba96,_0x3667e5[_0xdcbd('0x57')]);return db[_0xdcbd('0x44')][_0xdcbd('0x5e')](_0x22ba96)[_0xdcbd('0x38')](handleEntityNotFound(_0x481ab7,null))[_0xdcbd('0x38')](respondWithResult(_0x481ab7,null))['catch'](handleError(_0x481ab7,null));};exports[_0xdcbd('0x5f')]=function(_0x2db17e,_0x133e8c){return db[_0xdcbd('0x44')][_0xdcbd('0x5f')](_0x2db17e['body'],{})[_0xdcbd('0x38')](function(_0x3b8af8){var _0x219d51=_0x2db17e[_0xdcbd('0x60')][_0xdcbd('0x61')]({'plain':!![]});if(!_0x219d51)throw new Error(_0xdcbd('0x62'));if(_0x219d51[_0xdcbd('0x63')]===_0xdcbd('0x60')){var _0x14af14=_0x3b8af8[_0xdcbd('0x61')]({'plain':!![]});var _0x245730=_0xdcbd('0x39');return db[_0xdcbd('0x64')][_0xdcbd('0x5e')]({'where':{'name':_0x245730,'userProfileId':_0x219d51[_0xdcbd('0x65')]},'raw':!![]})[_0xdcbd('0x38')](function(_0x25267e){if(_0x25267e&&_0x25267e[_0xdcbd('0x66')]===0x0){return db[_0xdcbd('0x3a')][_0xdcbd('0x5f')]({'name':_0x14af14[_0xdcbd('0x3e')],'resourceId':_0x14af14['id'],'type':_0x25267e[_0xdcbd('0x3e')],'sectionId':_0x25267e['id']},{})[_0xdcbd('0x38')](function(){return _0x3b8af8;});}else{return _0x3b8af8;}})[_0xdcbd('0x2c')](function(_0x3d0187){logger[_0xdcbd('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d0187);throw _0x3d0187;});}return _0x3b8af8;})[_0xdcbd('0x38')](respondWithResult(_0x133e8c,0xc9))[_0xdcbd('0x2c')](handleError(_0x133e8c,null));};exports[_0xdcbd('0x37')]=function(_0x35b564,_0x37399d){if(_0x35b564[_0xdcbd('0x67')]['id']){delete _0x35b564['body']['id'];}return db[_0xdcbd('0x44')]['find']({'where':{'id':_0x35b564[_0xdcbd('0x5c')]['id']},'include':[{'model':db[_0xdcbd('0x41')],'as':_0xdcbd('0x42')}]})[_0xdcbd('0x38')](handleEntityNotFound(_0x37399d,null))[_0xdcbd('0x38')](saveUpdates(_0x35b564[_0xdcbd('0x67')],null))[_0xdcbd('0x38')](respondWithResult(_0x37399d,null))[_0xdcbd('0x2c')](handleError(_0x37399d,null));};exports[_0xdcbd('0x3b')]=function(_0x43765b,_0x50e779){return db[_0xdcbd('0x44')][_0xdcbd('0x5e')]({'where':{'id':_0x43765b[_0xdcbd('0x5c')]['id']}})[_0xdcbd('0x38')](handleEntityNotFound(_0x50e779,null))['then'](removeEntity(_0x50e779,null))[_0xdcbd('0x2c')](handleError(_0x50e779,null));};exports[_0xdcbd('0x68')]=function(_0x3d07ef,_0x4e8338){return db[_0xdcbd('0x44')]['describe']()[_0xdcbd('0x38')](respondWithResult(_0x4e8338,null))['catch'](handleError(_0x4e8338,null));};exports[_0xdcbd('0x69')]=function(_0x2d3ce3,_0x55e5ab,_0x311ca5){if(_0x2d3ce3[_0xdcbd('0x67')]['id']){delete _0x2d3ce3[_0xdcbd('0x67')]['id'];}return db[_0xdcbd('0x44')][_0xdcbd('0x5e')]({'where':{'id':_0x2d3ce3[_0xdcbd('0x5c')]['id']}})['then'](handleEntityNotFound(_0x55e5ab,null))[_0xdcbd('0x38')](function(_0x31b576){if(_0x31b576){_0x2d3ce3[_0xdcbd('0x67')]['OpenchannelAccountId']=_0x31b576['id'];return db[_0xdcbd('0x6a')][_0xdcbd('0x5f')](_0x2d3ce3[_0xdcbd('0x67')]);}})[_0xdcbd('0x38')](respondWithResult(_0x55e5ab,null))[_0xdcbd('0x2c')](handleError(_0x55e5ab,null));};exports['getDispositions']=function(_0x6dc87,_0x1d89e8,_0x2a0013){var _0x36ce2e={'raw':![],'where':{}};var _0x2cc8d0={};var _0x2f098c={'count':0x0,'rows':[]};return db[_0xdcbd('0x44')][_0xdcbd('0x6b')]({'where':{'id':_0x6dc87[_0xdcbd('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1d89e8,null))[_0xdcbd('0x38')](function(_0x7ba76e){if(_0x7ba76e){_0x2cc8d0[_0xdcbd('0x49')]=_['keys'](db[_0xdcbd('0x6a')]['rawAttributes']);_0x2cc8d0[_0xdcbd('0x4a')]=_[_0xdcbd('0x5d')](_0x6dc87[_0xdcbd('0x4a')]);_0x2cc8d0[_0xdcbd('0x4b')]=_[_0xdcbd('0x4c')](_0x2cc8d0[_0xdcbd('0x49')],_0x2cc8d0['query']);_0x36ce2e['attributes']=_['intersection'](_0x2cc8d0[_0xdcbd('0x49')],qs[_0xdcbd('0x4e')](_0x6dc87[_0xdcbd('0x4a')]['fields']));_0x36ce2e[_0xdcbd('0x4d')]=_0x36ce2e['attributes'][_0xdcbd('0x4f')]?_0x36ce2e[_0xdcbd('0x4d')]:_0x2cc8d0[_0xdcbd('0x49')];if(!_0x6dc87[_0xdcbd('0x4a')][_0xdcbd('0x6c')]('nolimit')){_0x36ce2e['limit']=qs[_0xdcbd('0x32')](_0x6dc87['query']['limit']);_0x36ce2e[_0xdcbd('0x30')]=qs[_0xdcbd('0x30')](_0x6dc87[_0xdcbd('0x4a')][_0xdcbd('0x30')]);}_0x36ce2e[_0xdcbd('0x50')]=qs[_0xdcbd('0x51')](_0x6dc87[_0xdcbd('0x4a')]['sort']);_0x36ce2e[_0xdcbd('0x52')]=qs[_0xdcbd('0x4b')](_[_0xdcbd('0x53')](_0x6dc87['query'],_0x2cc8d0[_0xdcbd('0x4b')]));_0x36ce2e[_0xdcbd('0x52')][_0xdcbd('0x6d')]=_0x7ba76e['id'];if(_0x6dc87[_0xdcbd('0x4a')][_0xdcbd('0x54')]){_0x36ce2e[_0xdcbd('0x52')]=_[_0xdcbd('0x55')](_0x36ce2e[_0xdcbd('0x52')],{'$or':_['map'](_0x36ce2e[_0xdcbd('0x4d')],function(_0x3795b5){var _0x5ec588={};_0x5ec588[_0x3795b5]={'$like':'%'+_0x6dc87[_0xdcbd('0x4a')][_0xdcbd('0x54')]+'%'};return _0x5ec588;})});}_0x36ce2e=_[_0xdcbd('0x55')]({},_0x36ce2e,_0x6dc87[_0xdcbd('0x57')]);return db[_0xdcbd('0x6a')][_0xdcbd('0x33')]({'where':_0x36ce2e[_0xdcbd('0x52')]})[_0xdcbd('0x38')](function(_0x18d41d){_0x2f098c['count']=_0x18d41d;if(_0x6dc87[_0xdcbd('0x4a')][_0xdcbd('0x58')]){_0x36ce2e['include']=[{'all':!![]}];}return db[_0xdcbd('0x6a')]['findAll'](_0x36ce2e);})[_0xdcbd('0x38')](function(_0x73fa9){_0x2f098c['rows']=_0x73fa9;return _0x2f098c;});}})['then'](respondWithFilteredResult(_0x1d89e8,_0x36ce2e))[_0xdcbd('0x2c')](handleError(_0x1d89e8,null));};exports[_0xdcbd('0x6e')]=function(_0x3e7d07,_0x1851da,_0x3de36f){return db[_0xdcbd('0x44')][_0xdcbd('0x5e')]({'where':{'id':_0x3e7d07[_0xdcbd('0x5c')]['id']}})[_0xdcbd('0x38')](handleEntityNotFound(_0x1851da,null))['then'](function(_0x58ffa0){if(_0x58ffa0){return _0x58ffa0['removeDispositions'](_0x3e7d07[_0xdcbd('0x4a')][_0xdcbd('0x6f')]);}})[_0xdcbd('0x38')](respondWithStatusCode(_0x1851da,null))['catch'](handleError(_0x1851da,null));};exports[_0xdcbd('0x70')]=function(_0x34a067,_0x486867,_0x11fd16){if(_0x34a067[_0xdcbd('0x67')]['id']){delete _0x34a067[_0xdcbd('0x67')]['id'];}return db['OpenchannelAccount'][_0xdcbd('0x5e')]({'where':{'id':_0x34a067[_0xdcbd('0x5c')]['id']}})[_0xdcbd('0x38')](handleEntityNotFound(_0x486867,null))[_0xdcbd('0x38')](function(_0x1dbc0d){if(_0x1dbc0d){_0x34a067[_0xdcbd('0x67')][_0xdcbd('0x6d')]=_0x1dbc0d['id'];return db[_0xdcbd('0x71')][_0xdcbd('0x5f')](_0x34a067['body']);}})[_0xdcbd('0x38')](respondWithResult(_0x486867,null))[_0xdcbd('0x2c')](handleError(_0x486867,null));};exports['getAnswers']=function(_0x2d2939,_0x23df44,_0x7d6199){var _0x4547d5={'raw':![],'where':{}};var _0x1b93e6={};var _0x2b9859={'count':0x0,'rows':[]};return db[_0xdcbd('0x44')][_0xdcbd('0x6b')]({'where':{'id':_0x2d2939['params']['id']}})[_0xdcbd('0x38')](handleEntityNotFound(_0x23df44,null))[_0xdcbd('0x38')](function(_0x18be5e){if(_0x18be5e){_0x1b93e6[_0xdcbd('0x49')]=_[_0xdcbd('0x5d')](db[_0xdcbd('0x71')][_0xdcbd('0x45')]);_0x1b93e6['query']=_['keys'](_0x2d2939[_0xdcbd('0x4a')]);_0x1b93e6['filters']=_[_0xdcbd('0x4c')](_0x1b93e6[_0xdcbd('0x49')],_0x1b93e6[_0xdcbd('0x4a')]);_0x4547d5[_0xdcbd('0x4d')]=_[_0xdcbd('0x4c')](_0x1b93e6[_0xdcbd('0x49')],qs[_0xdcbd('0x4e')](_0x2d2939[_0xdcbd('0x4a')]['fields']));_0x4547d5[_0xdcbd('0x4d')]=_0x4547d5['attributes'][_0xdcbd('0x4f')]?_0x4547d5[_0xdcbd('0x4d')]:_0x1b93e6[_0xdcbd('0x49')];if(!_0x2d2939[_0xdcbd('0x4a')][_0xdcbd('0x6c')](_0xdcbd('0x72'))){_0x4547d5[_0xdcbd('0x32')]=qs[_0xdcbd('0x32')](_0x2d2939[_0xdcbd('0x4a')][_0xdcbd('0x32')]);_0x4547d5['offset']=qs[_0xdcbd('0x30')](_0x2d2939[_0xdcbd('0x4a')][_0xdcbd('0x30')]);}_0x4547d5[_0xdcbd('0x50')]=qs[_0xdcbd('0x51')](_0x2d2939[_0xdcbd('0x4a')][_0xdcbd('0x51')]);_0x4547d5[_0xdcbd('0x52')]=qs[_0xdcbd('0x4b')](_[_0xdcbd('0x53')](_0x2d2939['query'],_0x1b93e6['filters']));_0x4547d5['where'][_0xdcbd('0x6d')]=_0x18be5e['id'];if(_0x2d2939[_0xdcbd('0x4a')][_0xdcbd('0x54')]){_0x4547d5[_0xdcbd('0x52')]=_[_0xdcbd('0x55')](_0x4547d5[_0xdcbd('0x52')],{'$or':_[_0xdcbd('0x43')](_0x4547d5['attributes'],function(_0x5d5b6d){var _0x37c5ac={};_0x37c5ac[_0x5d5b6d]={'$like':'%'+_0x2d2939[_0xdcbd('0x4a')][_0xdcbd('0x54')]+'%'};return _0x37c5ac;})});}_0x4547d5=_[_0xdcbd('0x55')]({},_0x4547d5,_0x2d2939[_0xdcbd('0x57')]);return db['CannedAnswer'][_0xdcbd('0x33')]({'where':_0x4547d5[_0xdcbd('0x52')]})[_0xdcbd('0x38')](function(_0x29dc88){_0x2b9859[_0xdcbd('0x33')]=_0x29dc88;if(_0x2d2939['query']['includeAll']){_0x4547d5[_0xdcbd('0x59')]=[{'all':!![]}];}return db[_0xdcbd('0x71')]['findAll'](_0x4547d5);})[_0xdcbd('0x38')](function(_0xd69d49){_0x2b9859[_0xdcbd('0x5b')]=_0xd69d49;return _0x2b9859;});}})[_0xdcbd('0x38')](respondWithFilteredResult(_0x23df44,_0x4547d5))[_0xdcbd('0x2c')](handleError(_0x23df44,null));};exports[_0xdcbd('0x73')]=function(_0x412998,_0x3fc0c3,_0x671e4c){return db[_0xdcbd('0x44')][_0xdcbd('0x5e')]({'where':{'id':_0x412998[_0xdcbd('0x5c')]['id']}})[_0xdcbd('0x38')](handleEntityNotFound(_0x3fc0c3,null))[_0xdcbd('0x38')](function(_0x4c4320){if(_0x4c4320){return _0x4c4320[_0xdcbd('0x73')](_0x412998[_0xdcbd('0x4a')][_0xdcbd('0x6f')]);}})['then'](respondWithStatusCode(_0x3fc0c3,null))[_0xdcbd('0x2c')](handleError(_0x3fc0c3,null));};exports[_0xdcbd('0x74')]=function(_0x4142b5,_0x10c5c4,_0x5ecde9){var _0x138bd1={'body':_0x4142b5['body'],'channel':'openchannel'};var _0x37c968=[];var _0x12595a=[];var _0x147554={};var _0x44b4e9=![];return db['CmContact'][_0xdcbd('0x68')]()[_0xdcbd('0x38')](function(_0x42ad84){if(!_0x42ad84){throw new db[(_0xdcbd('0x75'))][(_0xdcbd('0x76'))](_0xdcbd('0x77'));}_0x37c968=_[_0xdcbd('0x78')](_[_0xdcbd('0x5d')](_0x42ad84),[_0xdcbd('0x79'),_0xdcbd('0x7a')]);_0x12595a=_[_0xdcbd('0x78')](_[_0xdcbd('0x5d')](_0x42ad84),[_0xdcbd('0x79'),_0xdcbd('0x7a'),_0xdcbd('0x7b'),'ListId']);if(_0x4142b5[_0xdcbd('0x67')]['id']){delete _0x4142b5[_0xdcbd('0x67')]['id'];}if(_[_0xdcbd('0x7c')](_0x4142b5[_0xdcbd('0x67')][_0xdcbd('0x7d')])){throw new db[(_0xdcbd('0x75'))][(_0xdcbd('0x76'))](_0xdcbd('0x7e'));}if(_[_0xdcbd('0x7c')](_0x4142b5[_0xdcbd('0x67')]['body'])||_0x4142b5[_0xdcbd('0x67')][_0xdcbd('0x67')]===''){throw new db[(_0xdcbd('0x75'))][(_0xdcbd('0x76'))](_0xdcbd('0x7f'));}if(_[_0xdcbd('0x7c')](_0x4142b5[_0xdcbd('0x67')]['mapKey'])){throw new db[(_0xdcbd('0x75'))][(_0xdcbd('0x76'))](_0xdcbd('0x80')+_0x12595a);}if(!_[_0xdcbd('0x81')](_0x12595a,_0x4142b5[_0xdcbd('0x67')]['mapKey'])){throw new db[(_0xdcbd('0x75'))][(_0xdcbd('0x76'))](_0xdcbd('0x82')+_0x12595a);}_0x147554[_0x4142b5['body']['mapKey']]=_0x4142b5[_0xdcbd('0x67')]['from'];})[_0xdcbd('0x38')](function(){return db[_0xdcbd('0x44')][_0xdcbd('0x5e')]({'where':{'id':_0x4142b5[_0xdcbd('0x5c')]['id']},'include':[{'model':db[_0xdcbd('0x83')],'as':_0xdcbd('0x84'),'include':[{'model':db[_0xdcbd('0x85')],'as':_0xdcbd('0x86'),'where':_0x147554,'limit':0x1,'order':[[_0xdcbd('0x7a'),_0xdcbd('0x87')]]}]},{'model':db[_0xdcbd('0x88')],'as':_0xdcbd('0x89')}]});})['then'](handleEntityNotFound(_0x10c5c4,null))[_0xdcbd('0x38')](function(_0x1963e1){if(_0x1963e1&&_0x1963e1[_0xdcbd('0x84')]){_0x138bd1[_0xdcbd('0x8a')]=_0x1963e1;_0x138bd1[_0xdcbd('0x8b')]=_0x1963e1['Applications'];_0x138bd1[_0xdcbd('0x8c')]=_0x1963e1[_0xdcbd('0x84')];_0x138bd1['applications']=_[_0xdcbd('0x8d')](_0x138bd1[_0xdcbd('0x8b')],['priority'],[_0xdcbd('0x8e')]);if(_0x138bd1[_0xdcbd('0x8a')][_0xdcbd('0x89')]){delete _0x138bd1[_0xdcbd('0x8a')]['Applications'];}if(_0x138bd1[_0xdcbd('0x8a')][_0xdcbd('0x84')]&&_0x138bd1[_0xdcbd('0x8a')]['List'][_0xdcbd('0x86')]['length']){return _0x138bd1['account'][_0xdcbd('0x84')][_0xdcbd('0x86')][0x0];}var _0x593954=_[_0xdcbd('0x1c')](_0x4142b5[_0xdcbd('0x67')],{'firstName':_0x4142b5[_0xdcbd('0x67')][_0xdcbd('0x7d')],'ListId':_0x1963e1[_0xdcbd('0x8f')]});_0x593954[_0x4142b5['body'][_0xdcbd('0x90')]]=_0x4142b5['body'][_0xdcbd('0x7d')];return db['CmContact'][_0xdcbd('0x5f')](_0x593954,{'fields':_0x37c968,'raw':!![]});}})['then'](handleEntityNotFound(_0x10c5c4,null))[_0xdcbd('0x38')](function(_0x749376){_0x138bd1[_0xdcbd('0x91')]=_0x749376;if(_0x749376){var _0x3fc755={'ContactId':_0x749376['id'],'OpenchannelAccountId':_0x4142b5[_0xdcbd('0x5c')]['id'],'from':(_0x749376[_0xdcbd('0x92')]||'')+'\x20'+(_0x749376['lastName']||'')};var _0x45a379={'OpenchannelAccountId':_0x4142b5[_0xdcbd('0x5c')]['id'],'closed':![]};if(_0x4142b5[_0xdcbd('0x67')]['threadId']){_0x45a379['threadId']=_0x4142b5[_0xdcbd('0x67')][_0xdcbd('0x93')];return db[_0xdcbd('0x94')][_0xdcbd('0x5e')]({'where':_0x45a379})['then'](function(_0x36a96e){if(_0x36a96e){return[_0x36a96e,![]];}_0x3fc755[_0xdcbd('0x93')]=_0x4142b5[_0xdcbd('0x67')][_0xdcbd('0x93')];_0x3fc755[_0xdcbd('0x95')]=_0x4142b5['body'][_0xdcbd('0x95')];return db[_0xdcbd('0x94')][_0xdcbd('0x5f')](_0x3fc755)[_0xdcbd('0x38')](function(_0xb65f85){return[_0xb65f85,!![]];});});}else{_0x45a379[_0xdcbd('0x93')]=null;}_0x45a379[_0xdcbd('0x96')]=_0x749376['id'];return db['OpenchannelInteraction'][_0xdcbd('0x5e')]({'where':_0x45a379})[_0xdcbd('0x38')](function(_0x352f9b){if(_0x352f9b){return[_0x352f9b,![]];}return db[_0xdcbd('0x94')][_0xdcbd('0x5f')](_0x3fc755)[_0xdcbd('0x38')](function(_0x1113f9){return[_0x1113f9,!![]];});});}})[_0xdcbd('0x97')](function(_0x3608b9,_0x23c466){if(_0x3608b9){_0x44b4e9=_0x23c466;if(!_0x23c466){var _0x120708={'from':(_0x138bd1[_0xdcbd('0x91')][_0xdcbd('0x92')]||'')+'\x20'+(_0x138bd1[_0xdcbd('0x91')][_0xdcbd('0x98')]||'')};if(_0x4142b5['body'][_0xdcbd('0x93')]&&_0x4142b5[_0xdcbd('0x67')][_0xdcbd('0x99')]&&_0x4142b5['body'][_0xdcbd('0x93')]!=_0x4142b5['body'][_0xdcbd('0x99')]){_0x120708[_0xdcbd('0x93')]=_0x4142b5[_0xdcbd('0x67')][_0xdcbd('0x99')];}return _0x3608b9['update'](_0x120708);}else{return _0x3608b9;}}})[_0xdcbd('0x38')](function(_0x251b37){_0x138bd1[_0xdcbd('0x9a')]=_0x251b37[_0xdcbd('0x61')]({'plain':!![]});_0x138bd1[_0xdcbd('0x9a')][_0xdcbd('0x9b')]=_0x44b4e9;if(_0x138bd1[_0xdcbd('0x9a')][_0xdcbd('0x9b')]){if(_0x138bd1[_0xdcbd('0x8a')][_0xdcbd('0x9c')]){_0x138bd1[_0xdcbd('0x8b')][_0xdcbd('0x9d')]({'id':0x0,'priority':_0x138bd1[_0xdcbd('0x8b')][_0xdcbd('0x4f')]+0x1,'app':_0xdcbd('0x9e'),'appdata':'unmanaged','interval':_0xdcbd('0x9f')});}}return db['OpenchannelMessage'][_0xdcbd('0x5f')]({'body':_0x4142b5[_0xdcbd('0x67')][_0xdcbd('0x67')],'OpenchannelAccountId':_0x4142b5[_0xdcbd('0x5c')]['id'],'OpenchannelInteractionId':_0x251b37['id'],'direction':'in','ContactId':_0x138bd1[_0xdcbd('0x91')]['id'],'AttachmentId':_0x4142b5[_0xdcbd('0x67')][_0xdcbd('0xa0')]});})[_0xdcbd('0x38')](function(_0x4d6bd5){_0x138bd1[_0xdcbd('0x2a')]=_0x4d6bd5;if(_0x138bd1[_0xdcbd('0x9a')][_0xdcbd('0xa1')]){return db[_0xdcbd('0xa2')][_0xdcbd('0x5e')]({'attributes':['id',_0xdcbd('0x3e')],'where':{'id':_0x138bd1['interaction']['UserId']}})[_0xdcbd('0x38')](function(_0x956211){if(_0x956211){_0x138bd1[_0xdcbd('0x8b')][_0xdcbd('0xa3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x956211[_0xdcbd('0x3e')]+','+(_0x138bd1[_0xdcbd('0x8a')][_0xdcbd('0xa4')]||0xa),'interval':_0xdcbd('0x9f')});_0x138bd1['forcedOwnership']=![];}return respondWithRpcPromise(_0xdcbd('0xa5'),_0xdcbd('0xa6'),_0x138bd1);});}return respondWithRpcPromise(_0xdcbd('0xa5'),_0xdcbd('0xa6'),_0x138bd1);})[_0xdcbd('0x38')](function(_0x2971d6){respondWithRpcPromise(_0xdcbd('0xa7'),'EventManager',{'event':_0xdcbd('0x74'),'message':_0x2971d6},client9002);return _0x2971d6;})[_0xdcbd('0x38')](respondWithResult(_0x10c5c4,null))['catch'](handleError(_0x10c5c4,null));};exports[_0xdcbd('0xa8')]=function(_0x24e95d,_0x5a8da5){var _0x1ca56a=_0x24e95d[_0xdcbd('0x5c')]['id'];var _0x430424=_0x24e95d[_0xdcbd('0x67')];var _0x32916a=0xc8;var _0x37dc95=null;return db[_0xdcbd('0xa9')][_0xdcbd('0xaa')]({'isolationLevel':db['sequelize'][_0xdcbd('0xab')][_0xdcbd('0xac')]['READ_COMMITTED']},function(_0x415568){return db[_0xdcbd('0x44')][_0xdcbd('0x6b')]({'where':{'id':_0x1ca56a},'transaction':_0x415568})['then'](function(_0x3d4d76){if(_0x3d4d76){return db[_0xdcbd('0x88')][_0xdcbd('0x3b')]({'where':{'OpenchannelAccountId':_0x1ca56a},'transaction':_0x415568})['then'](function(){var _0x520968=_[_0xdcbd('0x43')](_0x430424,function(_0x14c285){_0x14c285[_0xdcbd('0x6d')]=_0x1ca56a;return _0x14c285;});return db[_0xdcbd('0x88')][_0xdcbd('0xad')](_0x520968,{'transaction':_0x415568});});}else{_0x32916a=0x194;_0x37dc95=[];}});})[_0xdcbd('0x38')](function(){if(_0x32916a!==0x194){return db[_0xdcbd('0x88')][_0xdcbd('0xae')]({'where':{'OpenchannelAccountId':_0x1ca56a},'order':_0xdcbd('0xaf')})['then'](function(_0x3d2681){_0x37dc95=_0x3d2681;});}})[_0xdcbd('0x2c')](function(_0x38b6aa){_0x32916a=0x1f4;logger[_0xdcbd('0x28')](_0x38b6aa[_0xdcbd('0x3d')]);if(_0x38b6aa['name']){delete _0x38b6aa[_0xdcbd('0x3e')];}_0x37dc95=_0x38b6aa;})[_0xdcbd('0xb0')](function(){if(_0x37dc95===null){_0x5a8da5['sendStatus'](_0x32916a);}else{if(_0x32916a===0x1f4){_0x5a8da5['status'](_0x32916a)['send'](_0x37dc95);}else{_0x5a8da5['status'](_0x32916a)[_0xdcbd('0x2f')](_0x37dc95);}}});};exports['getApplications']=function(_0x2e9df3,_0x5710be,_0x278c7e){var _0x1526b0={};var _0x3d57b5={};var _0x3db672;var _0x4f59ae;return db[_0xdcbd('0x44')][_0xdcbd('0x6b')]({'where':{'id':_0x2e9df3['params']['id']}})[_0xdcbd('0x38')](handleEntityNotFound(_0x5710be,null))['then'](function(_0x10bd7f){if(_0x10bd7f){_0x3db672=_0x10bd7f;_0x3d57b5[_0xdcbd('0x49')]=_[_0xdcbd('0x5d')](db[_0xdcbd('0x88')][_0xdcbd('0x45')]);_0x3d57b5[_0xdcbd('0x4a')]=_[_0xdcbd('0x5d')](_0x2e9df3[_0xdcbd('0x4a')]);_0x3d57b5[_0xdcbd('0x4b')]=_[_0xdcbd('0x4c')](_0x3d57b5[_0xdcbd('0x49')],_0x3d57b5['query']);_0x1526b0[_0xdcbd('0x4d')]=_[_0xdcbd('0x4c')](_0x3d57b5[_0xdcbd('0x49')],qs['fields'](_0x2e9df3[_0xdcbd('0x4a')][_0xdcbd('0x4e')]));_0x1526b0['attributes']=_0x1526b0[_0xdcbd('0x4d')][_0xdcbd('0x4f')]?_0x1526b0[_0xdcbd('0x4d')]:_0x3d57b5[_0xdcbd('0x49')];_0x1526b0['order']=qs[_0xdcbd('0x51')](_0x2e9df3['query'][_0xdcbd('0x51')]);_0x1526b0[_0xdcbd('0x52')]=qs[_0xdcbd('0x4b')](_['pick'](_0x2e9df3['query'],_0x3d57b5[_0xdcbd('0x4b')]));if(_0x2e9df3[_0xdcbd('0x4a')]['filter']){_0x1526b0[_0xdcbd('0x52')]=_[_0xdcbd('0x55')](_0x1526b0[_0xdcbd('0x52')],{'$or':_[_0xdcbd('0x43')](_0x1526b0['attributes'],function(_0x1cafce){var _0xf07fa7={};_0xf07fa7[_0x1cafce]={'$like':'%'+_0x2e9df3[_0xdcbd('0x4a')]['filter']+'%'};return _0xf07fa7;})});}_0x1526b0=_[_0xdcbd('0x55')]({},_0x1526b0,_0x2e9df3[_0xdcbd('0x57')]);return _0x3db672['getApplications'](_0x1526b0);}})['then'](function(_0x44b449){if(_0x44b449){_0x4f59ae=_0x44b449['length'];if(!_0x2e9df3[_0xdcbd('0x4a')][_0xdcbd('0x6c')]('nolimit')){_0x1526b0[_0xdcbd('0x32')]=qs['limit'](_0x2e9df3[_0xdcbd('0x4a')][_0xdcbd('0x32')]);_0x1526b0['offset']=qs[_0xdcbd('0x30')](_0x2e9df3[_0xdcbd('0x4a')]['offset']);}return _0x3db672['getApplications'](_0x1526b0);}})['then'](function(_0x3cf176){if(_0x3cf176){return _0x3cf176?{'count':_0x4f59ae,'rows':_0x3cf176}:null;}})[_0xdcbd('0x38')](respondWithResult(_0x5710be,null))['catch'](handleError(_0x5710be,null));};exports[_0xdcbd('0xb1')]=function(_0xb48572,_0x40c5f6,_0x1db382){var _0x31159a={'raw':![],'where':{}};var _0x40a018={};var _0x4be34d={'count':0x0,'rows':[]};return db[_0xdcbd('0x44')]['findOne']({'where':{'id':_0xb48572[_0xdcbd('0x5c')]['id']}})['then'](handleEntityNotFound(_0x40c5f6,null))[_0xdcbd('0x38')](function(_0x392d76){if(_0x392d76){_0x40a018[_0xdcbd('0x49')]=_[_0xdcbd('0x5d')](db[_0xdcbd('0x94')][_0xdcbd('0x45')]);_0x40a018[_0xdcbd('0x4a')]=_[_0xdcbd('0x5d')](_0xb48572['query']);_0x40a018[_0xdcbd('0x4b')]=_['intersection'](_0x40a018[_0xdcbd('0x49')],_0x40a018['query']);_0x31159a[_0xdcbd('0x4d')]=_['intersection'](_0x40a018[_0xdcbd('0x49')],qs[_0xdcbd('0x4e')](_0xb48572[_0xdcbd('0x4a')][_0xdcbd('0x4e')]));_0x31159a['attributes']=_0x31159a['attributes'][_0xdcbd('0x4f')]?_0x31159a[_0xdcbd('0x4d')]:_0x40a018[_0xdcbd('0x49')];if(!_0xb48572[_0xdcbd('0x4a')][_0xdcbd('0x6c')](_0xdcbd('0x72'))){_0x31159a[_0xdcbd('0x32')]=qs[_0xdcbd('0x32')](_0xb48572['query'][_0xdcbd('0x32')]);_0x31159a[_0xdcbd('0x30')]=qs[_0xdcbd('0x30')](_0xb48572[_0xdcbd('0x4a')]['offset']);}_0x31159a[_0xdcbd('0x50')]=qs[_0xdcbd('0x51')](_0xb48572[_0xdcbd('0x4a')][_0xdcbd('0x51')]);_0x31159a[_0xdcbd('0x52')]=qs[_0xdcbd('0x4b')](_[_0xdcbd('0x53')](_0xb48572[_0xdcbd('0x4a')],_0x40a018[_0xdcbd('0x4b')]));_0x31159a['where'][_0xdcbd('0x6d')]=_0x392d76['id'];if(_0xb48572[_0xdcbd('0x4a')]['filter']){_0x31159a['where']=_['merge'](_0x31159a[_0xdcbd('0x52')],{'$or':_[_0xdcbd('0x43')](_0x31159a[_0xdcbd('0x4d')],function(_0x442b35){var _0x12926c={};_0x12926c[_0x442b35]={'$like':'%'+_0xb48572['query']['filter']+'%'};return _0x12926c;})});}_0x31159a=_[_0xdcbd('0x55')]({},_0x31159a,_0xb48572[_0xdcbd('0x57')]);return db[_0xdcbd('0x94')]['count']({'where':_0x31159a['where']})[_0xdcbd('0x38')](function(_0x8c7904){_0x4be34d['count']=_0x8c7904;if(_0xb48572[_0xdcbd('0x4a')][_0xdcbd('0x58')]){_0x31159a['include']=[{'model':db['CmContact'],'as':_0xdcbd('0xb2'),'required':![]},{'model':db[_0xdcbd('0xa2')],'as':'Owner','attributes':[_0xdcbd('0x3e'),_0xdcbd('0xb3'),_0xdcbd('0xb4')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xdcbd('0x3e'),_0xdcbd('0xb5')],'where':_0xb48572[_0xdcbd('0x4a')][_0xdcbd('0xb6')]?{'id':_0xb48572['query']['tag']}:undefined,'required':_0xb48572['query']['tag']?!![]:![]}];}return db[_0xdcbd('0x94')][_0xdcbd('0x5a')](_0x31159a);})['then'](function(_0x54d144){_0x4be34d[_0xdcbd('0x5b')]=_0x54d144;return _0x4be34d;});}})[_0xdcbd('0x38')](respondWithFilteredResult(_0x40c5f6,_0x31159a))[_0xdcbd('0x2c')](handleError(_0x40c5f6,null));};exports[_0xdcbd('0xb7')]=function(_0x5f49f3,_0x444d1f,_0xb512d1){return db[_0xdcbd('0x44')][_0xdcbd('0x5e')]({'where':{'id':_0x5f49f3[_0xdcbd('0x5c')]['id']}})[_0xdcbd('0x38')](handleEntityNotFound(_0x444d1f,null))[_0xdcbd('0x38')](function(_0x57b954){if(_0x57b954){return _0x57b954[_0xdcbd('0xb7')](_0x5f49f3[_0xdcbd('0x67')][_0xdcbd('0x6f')],_[_0xdcbd('0xb8')](_0x5f49f3[_0xdcbd('0x67')],['ids','id'])||{})[_0xdcbd('0x97')](function(_0x40f5ed){for(var _0xa9f5e7=0x0;_0xa9f5e7<_0x5f49f3[_0xdcbd('0x67')][_0xdcbd('0x6f')]['length'];_0xa9f5e7+=0x1){socket[_0xdcbd('0xb9')]('userOpenchannelAccount:save',{'UserId':Number(_0x5f49f3['body'][_0xdcbd('0x6f')][_0xa9f5e7]),'OpenchannelAccountId':Number(_0x5f49f3[_0xdcbd('0x5c')]['id'])});}return _0x40f5ed;});}})[_0xdcbd('0x38')](respondWithResult(_0x444d1f,null))[_0xdcbd('0x2c')](handleError(_0x444d1f,null));};exports[_0xdcbd('0xba')]=function(_0x4e2b87,_0x2f1d61,_0x8a3845){return db['OpenchannelAccount'][_0xdcbd('0x5e')]({'where':{'id':_0x4e2b87[_0xdcbd('0x5c')]['id']}})[_0xdcbd('0x38')](handleEntityNotFound(_0x2f1d61,null))[_0xdcbd('0x38')](function(_0x9807e0){if(_0x9807e0){return _0x9807e0[_0xdcbd('0xba')](_0x4e2b87[_0xdcbd('0x4a')][_0xdcbd('0x6f')])[_0xdcbd('0x38')](function(){if(_[_0xdcbd('0xbb')](_0x4e2b87[_0xdcbd('0x4a')][_0xdcbd('0x6f')])){for(var _0x2376e7=0x0;_0x2376e7<_0x4e2b87[_0xdcbd('0x4a')][_0xdcbd('0x6f')][_0xdcbd('0x4f')];_0x2376e7+=0x1){socket['emit'](_0xdcbd('0xbc'),{'UserId':Number(_0x4e2b87[_0xdcbd('0x4a')][_0xdcbd('0x6f')][_0x2376e7]),'OpenchannelAccountId':Number(_0x4e2b87['params']['id'])});}}else{socket[_0xdcbd('0xb9')](_0xdcbd('0xbc'),{'UserId':Number(_0x4e2b87[_0xdcbd('0x4a')]['ids']),'OpenchannelAccountId':Number(_0x4e2b87[_0xdcbd('0x5c')]['id'])});}});}})[_0xdcbd('0x38')](respondWithStatusCode(_0x2f1d61,null))[_0xdcbd('0x2c')](handleError(_0x2f1d61,null));};exports[_0xdcbd('0xbd')]=function(_0x5c8574,_0x11a32d,_0x83b8c9){var _0x1d3817={};var _0x23fc35={};var _0x24819e;var _0xc3bd04;return db[_0xdcbd('0x44')][_0xdcbd('0x6b')]({'where':{'id':_0x5c8574[_0xdcbd('0x5c')]['id']}})[_0xdcbd('0x38')](handleEntityNotFound(_0x11a32d,null))['then'](function(_0x6bd3d4){if(_0x6bd3d4){_0x24819e=_0x6bd3d4;_0x23fc35['model']=_[_0xdcbd('0x5d')](db[_0xdcbd('0xa2')]['rawAttributes']);_0x23fc35[_0xdcbd('0x4a')]=_[_0xdcbd('0x5d')](_0x5c8574[_0xdcbd('0x4a')]);_0x23fc35['filters']=_[_0xdcbd('0x4c')](_0x23fc35['model'],_0x23fc35[_0xdcbd('0x4a')]);_0x1d3817[_0xdcbd('0x4d')]=_[_0xdcbd('0x4c')](_0x23fc35['model'],qs[_0xdcbd('0x4e')](_0x5c8574[_0xdcbd('0x4a')][_0xdcbd('0x4e')]));_0x1d3817[_0xdcbd('0x4d')]=_0x1d3817[_0xdcbd('0x4d')]['length']?_0x1d3817['attributes']:_0x23fc35[_0xdcbd('0x49')];_0x1d3817[_0xdcbd('0x50')]=qs['sort'](_0x5c8574[_0xdcbd('0x4a')][_0xdcbd('0x51')]);_0x1d3817[_0xdcbd('0x52')]=qs[_0xdcbd('0x4b')](_['pick'](_0x5c8574['query'],_0x23fc35[_0xdcbd('0x4b')]));if(_0x5c8574['query'][_0xdcbd('0x54')]){_0x1d3817[_0xdcbd('0x52')]=_[_0xdcbd('0x55')](_0x1d3817['where'],{'$or':_[_0xdcbd('0x43')](_0x1d3817[_0xdcbd('0x4d')],function(_0x20c4a3){var _0x13d6dc={};_0x13d6dc[_0x20c4a3]={'$like':'%'+_0x5c8574[_0xdcbd('0x4a')]['filter']+'%'};return _0x13d6dc;})});}_0x1d3817=_[_0xdcbd('0x55')]({},_0x1d3817,_0x5c8574[_0xdcbd('0x57')]);return _0x24819e['getAgents'](_0x1d3817);}})[_0xdcbd('0x38')](function(_0x4ed72a){if(_0x4ed72a){_0xc3bd04=_0x4ed72a[_0xdcbd('0x4f')];if(!_0x5c8574[_0xdcbd('0x4a')][_0xdcbd('0x6c')](_0xdcbd('0x72'))){_0x1d3817[_0xdcbd('0x32')]=qs['limit'](_0x5c8574[_0xdcbd('0x4a')][_0xdcbd('0x32')]);_0x1d3817[_0xdcbd('0x30')]=qs[_0xdcbd('0x30')](_0x5c8574['query'][_0xdcbd('0x30')]);}return _0x24819e[_0xdcbd('0xbd')](_0x1d3817);}})['then'](function(_0x5c459d){if(_0x5c459d){return _0x5c459d?{'count':_0xc3bd04,'rows':_0x5c459d}:null;}})[_0xdcbd('0x38')](respondWithResult(_0x11a32d,null))[_0xdcbd('0x2c')](handleError(_0x11a32d,null));};exports[_0xdcbd('0x3f')]=function(_0x4c8c4e,_0x3d5680,_0x5a666c){var _0x327bf2,_0x513ddb,_0x34e4d8;if(_[_0xdcbd('0x7c')](_0x4c8c4e[_0xdcbd('0x67')][_0xdcbd('0x67')])||_0x4c8c4e[_0xdcbd('0x67')][_0xdcbd('0x67')]===''){throw new db[(_0xdcbd('0x75'))][(_0xdcbd('0x76'))](_0xdcbd('0x7f'));}if(_['isNil'](_0x4c8c4e['body']['to'])){}_0x327bf2=_0x4c8c4e[_0xdcbd('0x67')]['to'];return db[_0xdcbd('0x44')]['findOne']({'where':{'id':_0x4c8c4e[_0xdcbd('0x5c')]['id']}})[_0xdcbd('0x38')](handleEntityNotFound(_0x3d5680,null))[_0xdcbd('0x38')](function(_0x4d5486){if(_0x4d5486){return db[_0xdcbd('0x44')][_0xdcbd('0x5e')]({'where':{'id':_0x4d5486['id']},'include':[{'model':db['CmList'],'as':_0xdcbd('0x84'),'include':[{'model':db['CmContact'],'as':_0xdcbd('0x86'),'where':{[_0x4d5486[_0xdcbd('0x90')]]:_0x327bf2},'limit':0x1,'order':[['updatedAt',_0xdcbd('0x87')]]}]}]})['then'](handleEntityNotFound(_0x3d5680,null))[_0xdcbd('0x38')](function(_0x5ba1c9){if(_0x5ba1c9&&_0x5ba1c9[_0xdcbd('0x84')]){_0x513ddb=_0x5ba1c9[_0xdcbd('0x61')]({'plain':!![]});if(_0x513ddb['List']&&_0x513ddb['List'][_0xdcbd('0x86')]['length']){return _0x513ddb[_0xdcbd('0x84')][_0xdcbd('0x86')][0x0];}return db['CmContact']['create'](_[_0xdcbd('0x1c')](_0x4c8c4e[_0xdcbd('0x67')],{'firstName':_0x327bf2,[_0x5ba1c9[_0xdcbd('0x90')]]:_0x327bf2,'phone':_0x327bf2,'ListId':_0x513ddb[_0xdcbd('0x8f')]}));}})[_0xdcbd('0x38')](handleEntityNotFound(_0x3d5680,null))['then'](function(_0x3d92ff){if(_0x3d92ff){_0x34e4d8=_0x3d92ff;return db['OpenchannelInteraction'][_0xdcbd('0x5e')]({'where':{'ContactId':_0x34e4d8['id'],'closed':![],'OpenchannelAccountId':_0x513ddb['id']}})['then'](function(_0x1c8dd2){if(_0x1c8dd2){return[_0x1c8dd2,![]];}return db[_0xdcbd('0x94')][_0xdcbd('0x5f')]({'UserId':_0x4c8c4e['user']['id'],'ContactId':_0x34e4d8['id'],'OpenchannelAccountId':_0x513ddb['id'],'lastMsgDirection':_0xdcbd('0xbe'),'firstMsgDirection':'out','Messages':[_['merge'](_0x4c8c4e[_0xdcbd('0x67')],{'read':![],'body':_0x4c8c4e[_0xdcbd('0x67')][_0xdcbd('0x67')],'OpenchannelAccountId':_0x513ddb['id'],'UserId':_0x4c8c4e['user']['id'],'ContactId':_0x34e4d8['id']})]},{'include':[{'model':db[_0xdcbd('0xbf')],'as':_0xdcbd('0xc0')}]})[_0xdcbd('0x38')](function(_0x478374){return[_0x478374,!![]];});});}})[_0xdcbd('0x97')](function(_0x55f29f,_0x1a2745){if(_0x1a2745){return _0x55f29f;}return db[_0xdcbd('0xbf')][_0xdcbd('0x5f')](_['merge'](_0x4c8c4e[_0xdcbd('0x67')],{'read':![],'body':_0x4c8c4e[_0xdcbd('0x67')][_0xdcbd('0x67')],'OpenchannelAccountId':_0x513ddb['id'],'OpenchannelInteractionId':_0x55f29f['id'],'UserId':_0x4c8c4e[_0xdcbd('0x60')]['id'],'ContactId':_0x34e4d8['id']}))[_0xdcbd('0x38')](function(_0x5de93d){_0x55f29f[_0xdcbd('0xc1')]['Messages']=[];_0x55f29f['dataValues'][_0xdcbd('0xc0')][_0xdcbd('0x9d')](_0x5de93d[_0xdcbd('0xc1')]);return _0x55f29f;});});}})[_0xdcbd('0x38')](respondWithResult(_0x3d5680,null))[_0xdcbd('0x2c')](handleError(_0x3d5680,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ebb2879..ed4b4f3 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 _0xac4a=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','emit','hook','events'];(function(_0x33b910,_0xf2751e){var _0x3d7deb=function(_0x2ebbb0){while(--_0x2ebbb0){_0x33b910['push'](_0x33b910['shift']());}};_0x3d7deb(++_0xf2751e);}(_0xac4a,0x13f));var _0xaac4=function(_0x4c4eb0,_0x120d16){_0x4c4eb0=_0x4c4eb0-0x0;var _0x437d8a=_0xac4a[_0x4c4eb0];return _0x437d8a;};'use strict';var EventEmitter=require(_0xaac4('0x0'));var OpenchannelAccount=require(_0xaac4('0x1'))['db'][_0xaac4('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xaac4('0x3')](0x0);var events={'afterCreate':_0xaac4('0x4'),'afterUpdate':_0xaac4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58626e){return function(_0x2af0f6,_0x2a5762,_0x32d34c){OpenchannelAccountEvents['emit'](_0x58626e+':'+_0x2af0f6['id'],_0x2af0f6);OpenchannelAccountEvents[_0xaac4('0x6')](_0x58626e,_0x2af0f6);_0x32d34c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xaac4('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x4522=['OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3466ef,_0x59deff){var _0x91adf6=function(_0x4e07bc){while(--_0x4e07bc){_0x3466ef['push'](_0x3466ef['shift']());}};_0x91adf6(++_0x59deff);}(_0x4522,0x1a0));var _0x2452=function(_0x10c69a,_0x2b339e){_0x10c69a=_0x10c69a-0x0;var _0x54497a=_0x4522[_0x10c69a];return _0x54497a;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x2452('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x2452('0x1')](0x0);var events={'afterCreate':_0x2452('0x2'),'afterUpdate':'update','afterDestroy':_0x2452('0x3')};function emitEvent(_0x1fdf5b){return function(_0x35e30a,_0x2f21dc,_0x34ff44){OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b+':'+_0x35e30a['id'],_0x35e30a);OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b,_0x35e30a);_0x34ff44(null);};}for(var e in events){if(events[_0x2452('0x5')](e)){var event=events[e];OpenchannelAccount[_0x2452('0x6')](e,emitEvent(event));}}module[_0x2452('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index bdace79..91c00ee 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(_0x30ff42,_0x59b4fd){var _0x441a2d=function(_0x298eef){while(--_0x298eef){_0x30ff42['push'](_0x30ff42['shift']());}};_0x441a2d(++_0x59b4fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x432f7e,_0x5883cd){var _0x50da29=function(_0x3f828b){while(--_0x3f828b){_0x432f7e['push'](_0x432f7e['shift']());}};_0x50da29(++_0x5883cd);}(_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 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 482de65..741935b 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 _0x422f=['socket.io-emitter','./openchannelAccount.socket','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x422f,0x1c7));var _0xf422=function(_0x466f76,_0x4a4b7d){_0x466f76=_0x466f76-0x0;var _0x119bec=_0x422f[_0x466f76];return _0x119bec;};'use strict';var _=require('lodash');var util=require(_0xf422('0x0'));var moment=require('moment');var BPromise=require(_0xf422('0x1'));var rs=require(_0xf422('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf422('0x3'))['db'];var utils=require(_0xf422('0x4'));var logger=require(_0xf422('0x5'))(_0xf422('0x6'));var config=require(_0xf422('0x7'));var jayson=require(_0xf422('0x8'));var client=jayson[_0xf422('0x9')][_0xf422('0xa')]({'port':0x232a});config[_0xf422('0xb')]=_['defaults'](config[_0xf422('0xb')],{'host':_0xf422('0xc'),'port':0x18eb});var socket=require(_0xf422('0xd'))(new Redis(config[_0xf422('0xb')]));require(_0xf422('0xe'))['register'](socket);function respondWithRpcPromise(_0x419ec4,_0x526c03,_0x599177){return new BPromise(function(_0x85cccc,_0x39f67b){return client[_0xf422('0xf')](_0x419ec4,_0x599177)[_0xf422('0x10')](function(_0x22eeb2){logger['info'](_0xf422('0x11'),_0x526c03,_0xf422('0x12'));logger['debug'](_0xf422('0x13'),_0x526c03,_0xf422('0x12'),JSON[_0xf422('0x14')](_0x22eeb2));if(_0x22eeb2[_0xf422('0x15')]){if(_0x22eeb2[_0xf422('0x15')][_0xf422('0x16')]===0x1f4){logger[_0xf422('0x15')](_0xf422('0x11'),_0x526c03,_0x22eeb2[_0xf422('0x15')]['message']);return _0x39f67b(_0x22eeb2['error']['message']);}logger[_0xf422('0x15')](_0xf422('0x11'),_0x526c03,_0x22eeb2[_0xf422('0x15')][_0xf422('0x17')]);return _0x85cccc(_0x22eeb2['error'][_0xf422('0x17')]);}else{logger[_0xf422('0x18')](_0xf422('0x11'),_0x526c03,_0xf422('0x12'));_0x85cccc(_0x22eeb2[_0xf422('0x19')][_0xf422('0x17')]);}})['catch'](function(_0x502976){logger[_0xf422('0x15')](_0xf422('0x11'),_0x526c03,_0x502976);_0x39f67b(_0x502976);});});} \ No newline at end of file +var _0x9d5b=['register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket'];(function(_0x3fa6d4,_0x3d4641){var _0xe68a4b=function(_0x422c6c){while(--_0x422c6c){_0x3fa6d4['push'](_0x3fa6d4['shift']());}};_0xe68a4b(++_0x3d4641);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x252076,_0x1347a8){_0x252076=_0x252076-0x0;var _0x53ee79=_0x9d5b[_0x252076];return _0x53ee79;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var moment=require(_0xb9d5('0x1'));var BPromise=require(_0xb9d5('0x2'));var rs=require(_0xb9d5('0x3'));var fs=require('fs');var Redis=require(_0xb9d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9d5('0x5'));var logger=require('../../config/logger')(_0xb9d5('0x6'));var config=require(_0xb9d5('0x7'));var jayson=require(_0xb9d5('0x8'));var client=jayson[_0xb9d5('0x9')][_0xb9d5('0xa')]({'port':0x232a});config['redis']=_[_0xb9d5('0xb')](config[_0xb9d5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9d5('0xd'))(new Redis(config[_0xb9d5('0xc')]));require(_0xb9d5('0xe'))[_0xb9d5('0xf')](socket);function respondWithRpcPromise(_0x5d0fc6,_0x1aec1b,_0x1ae073){return new BPromise(function(_0x4c1ce3,_0x35d69f){return client[_0xb9d5('0x10')](_0x5d0fc6,_0x1ae073)[_0xb9d5('0x11')](function(_0x422b36){logger[_0xb9d5('0x12')](_0xb9d5('0x13'),_0x1aec1b,_0xb9d5('0x14'));logger[_0xb9d5('0x15')](_0xb9d5('0x16'),_0x1aec1b,_0xb9d5('0x14'),JSON[_0xb9d5('0x17')](_0x422b36));if(_0x422b36['error']){if(_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x19')]===0x1f4){logger['error'](_0xb9d5('0x13'),_0x1aec1b,_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);return _0x35d69f(_0x422b36['error'][_0xb9d5('0x1a')]);}logger[_0xb9d5('0x18')](_0xb9d5('0x13'),_0x1aec1b,_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);return _0x4c1ce3(_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);}else{logger[_0xb9d5('0x12')](_0xb9d5('0x13'),_0x1aec1b,_0xb9d5('0x14'));_0x4c1ce3(_0x422b36[_0xb9d5('0x1b')][_0xb9d5('0x1a')]);}})[_0xb9d5('0x1c')](function(_0x171487){logger['error'](_0xb9d5('0x13'),_0x1aec1b,_0x171487);_0x35d69f(_0x171487);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index b6c81da..f2a853a 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 _0xcd31=['openchannelAccount:','save','remove','update','emit','removeListener'];(function(_0x5f37ce,_0x407d3b){var _0x132b02=function(_0x41638f){while(--_0x41638f){_0x5f37ce['push'](_0x5f37ce['shift']());}};_0x132b02(++_0x407d3b);}(_0xcd31,0x15d));var _0x1cd3=function(_0x4f90c4,_0x3bc9d4){_0x4f90c4=_0x4f90c4-0x0;var _0x44c184=_0xcd31[_0x4f90c4];return _0x44c184;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x1cd3('0x0'),_0x1cd3('0x1'),_0x1cd3('0x2')];function createListener(_0x5708ef,_0x3da1e3){return function(_0x19dd0c){_0x3da1e3[_0x1cd3('0x3')](_0x5708ef,_0x19dd0c);};}function removeListener(_0x28c67f,_0x295933){return function(){OpenchannelAccountEvents[_0x1cd3('0x4')](_0x28c67f,_0x295933);};}exports['register']=function(_0x26ffcb){for(var _0x1ca151=0x0,_0xedb6d1=events['length'];_0x1ca151<_0xedb6d1;_0x1ca151++){var _0x45cc24=events[_0x1ca151];var _0x11b139=createListener(_0x1cd3('0x5')+_0x45cc24,_0x26ffcb);OpenchannelAccountEvents['on'](_0x45cc24,_0x11b139);}}; \ No newline at end of file +var _0xffdc=['length','./openchannelAccount.events','save','update','emit','removeListener'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xffdc,0x7f));var _0xcffd=function(_0x5ddc90,_0x1a9989){_0x5ddc90=_0x5ddc90-0x0;var _0x1f2b57=_0xffdc[_0x5ddc90];return _0x1f2b57;};'use strict';var OpenchannelAccountEvents=require(_0xcffd('0x0'));var events=[_0xcffd('0x1'),'remove',_0xcffd('0x2')];function createListener(_0x2df854,_0x5d6a91){return function(_0x31166d){_0x5d6a91[_0xcffd('0x3')](_0x2df854,_0x31166d);};}function removeListener(_0x37c566,_0x3a2c59){return function(){OpenchannelAccountEvents[_0xcffd('0x4')](_0x37c566,_0x3a2c59);};}exports['register']=function(_0x1a1bce){for(var _0x963fad=0x0,_0x12e830=events[_0xcffd('0x5')];_0x963fad<_0x12e830;_0x963fad++){var _0x199df3=events[_0x963fad];var _0x463334=createListener('openchannelAccount:'+_0x199df3,_0x1a1bce);OpenchannelAccountEvents['on'](_0x199df3,_0x463334);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 6857214..5659c99 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 _0x2ba7=['create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post'];(function(_0x484f0e,_0x546288){var _0x2670b5=function(_0x1e73e4){while(--_0x1e73e4){_0x484f0e['push'](_0x484f0e['shift']());}};_0x2670b5(++_0x546288);}(_0x2ba7,0x195));var _0x72ba=function(_0x55f2c9,_0x4b40c4){_0x55f2c9=_0x55f2c9-0x0;var _0xdf374=_0x2ba7[_0x55f2c9];return _0xdf374;};'use strict';var multer=require(_0x72ba('0x0'));var util=require('util');var path=require(_0x72ba('0x1'));var timeout=require(_0x72ba('0x2'));var express=require(_0x72ba('0x3'));var router=express[_0x72ba('0x4')]();var fs_extra=require(_0x72ba('0x5'));var auth=require(_0x72ba('0x6'));var interaction=require(_0x72ba('0x7'));var config=require(_0x72ba('0x8'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x72ba('0x9')](),controller[_0x72ba('0xa')]);router[_0x72ba('0xb')](_0x72ba('0xc'),auth[_0x72ba('0x9')](),controller[_0x72ba('0xd')]);router[_0x72ba('0xe')]('/',auth[_0x72ba('0x9')](),controller[_0x72ba('0xf')]);router[_0x72ba('0x10')](_0x72ba('0xc'),auth[_0x72ba('0x9')](),controller[_0x72ba('0x11')]);router[_0x72ba('0x12')](_0x72ba('0xc'),auth[_0x72ba('0x9')](),controller[_0x72ba('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5fa8=['fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x5fa8,0x194));var _0x85fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5fa8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x85fa('0x0'));var util=require('util');var path=require(_0x85fa('0x1'));var timeout=require(_0x85fa('0x2'));var express=require(_0x85fa('0x3'));var router=express['Router']();var fs_extra=require(_0x85fa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x85fa('0x5'));var controller=require('./openchannelApplication.controller');router[_0x85fa('0x6')]('/',auth[_0x85fa('0x7')](),controller[_0x85fa('0x8')]);router[_0x85fa('0x6')](_0x85fa('0x9'),auth['isAuthenticated'](),controller[_0x85fa('0xa')]);router[_0x85fa('0xb')]('/',auth[_0x85fa('0x7')](),controller[_0x85fa('0xc')]);router[_0x85fa('0xd')](_0x85fa('0x9'),auth[_0x85fa('0x7')](),controller[_0x85fa('0xe')]);router['delete'](_0x85fa('0x9'),auth[_0x85fa('0x7')](),controller[_0x85fa('0xf')]);module[_0x85fa('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 6f86b3f..7f86c2f 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 _0x44da=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x4bb98d,_0x1b7aec){var _0x4bb669=function(_0x332736){while(--_0x332736){_0x4bb98d['push'](_0x4bb98d['shift']());}};_0x4bb669(++_0x1b7aec);}(_0x44da,0x85));var _0xa44d=function(_0x44676a,_0x347442){_0x44676a=_0x44676a-0x0;var _0x465ed1=_0x44da[_0x44676a];return _0x465ed1;};'use strict';var Sequelize=require(_0xa44d('0x0'));module[_0xa44d('0x1')]={'priority':{'type':Sequelize[_0xa44d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa44d('0x3')],'allowNull':![],'defaultValue':_0xa44d('0x4')},'appdata':{'type':Sequelize[_0xa44d('0x5')]()},'description':{'type':Sequelize[_0xa44d('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa44d('0x6')}}; \ No newline at end of file +var _0xee00=['sequelize','exports','STRING','noop'];(function(_0x50a03,_0x127f16){var _0x32d06f=function(_0x2814bf){while(--_0x2814bf){_0x50a03['push'](_0x50a03['shift']());}};_0x32d06f(++_0x127f16);}(_0xee00,0x100));var _0x0ee0=function(_0x21c06e,_0x39e8e7){_0x21c06e=_0x21c06e-0x0;var _0x3dfd4d=_0xee00[_0x21c06e];return _0x3dfd4d;};'use strict';var Sequelize=require(_0x0ee0('0x0'));module[_0x0ee0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0ee0('0x2')],'allowNull':![],'defaultValue':_0x0ee0('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0ee0('0x2')]},'interval':{'type':Sequelize[_0x0ee0('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 64995a6..5d51e90 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 _0xb26e=['send','index','map','OpenchannelApplication','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name'];(function(_0x13d343,_0xff2df3){var _0x55d49a=function(_0x1585a){while(--_0x1585a){_0x13d343['push'](_0x13d343['shift']());}};_0x55d49a(++_0xff2df3);}(_0xb26e,0x1e7));var _0xeb26=function(_0x177f58,_0x7eb824){_0x177f58=_0x177f58-0x0;var _0x30c13d=_0xb26e[_0x177f58];return _0x30c13d;};'use strict';var emlformat=require(_0xeb26('0x0'));var rimraf=require(_0xeb26('0x1'));var zipdir=require(_0xeb26('0x2'));var jsonpatch=require(_0xeb26('0x3'));var rp=require(_0xeb26('0x4'));var moment=require(_0xeb26('0x5'));var BPromise=require(_0xeb26('0x6'));var Mustache=require(_0xeb26('0x7'));var util=require(_0xeb26('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xeb26('0x9'));var ejs=require(_0xeb26('0xa'));var fs=require('fs');var fs_extra=require(_0xeb26('0xb'));var _=require('lodash');var squel=require(_0xeb26('0xc'));var crypto=require(_0xeb26('0xd'));var jsforce=require(_0xeb26('0xe'));var deskjs=require(_0xeb26('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb26('0x10'));var Papa=require(_0xeb26('0x11'));var Redis=require(_0xeb26('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeb26('0x13'));var hardwareService=require(_0xeb26('0x14'));var logger=require(_0xeb26('0x15'))(_0xeb26('0x16'));var utils=require(_0xeb26('0x17'));var config=require(_0xeb26('0x18'));var licenseUtil=require(_0xeb26('0x19'));var db=require(_0xeb26('0x1a'))['db'];function respondWithStatusCode(_0x124ce2,_0x16409b){_0x16409b=_0x16409b||0xcc;return function(_0x72bba5){if(_0x72bba5){return _0x124ce2[_0xeb26('0x1b')](_0x16409b);}return _0x124ce2[_0xeb26('0x1c')](_0x16409b)[_0xeb26('0x1d')]();};}function respondWithResult(_0x42777e,_0x50f8a){_0x50f8a=_0x50f8a||0xc8;return function(_0x10ad2c){if(_0x10ad2c){return _0x42777e[_0xeb26('0x1c')](_0x50f8a)[_0xeb26('0x1e')](_0x10ad2c);}};}function respondWithFilteredResult(_0x4a26b3,_0x570327){return function(_0x3dbb9c){if(_0x3dbb9c){var _0x28675e=typeof _0x570327[_0xeb26('0x1f')]===_0xeb26('0x20')&&typeof _0x570327[_0xeb26('0x21')]==='undefined';var _0x5afa6d=_0x3dbb9c[_0xeb26('0x22')];var _0x3b41f5=_0x28675e?0x0:_0x570327[_0xeb26('0x1f')];var _0x19e9db=_0x28675e?_0x3dbb9c[_0xeb26('0x22')]:_0x570327[_0xeb26('0x1f')]+_0x570327[_0xeb26('0x21')];var _0x1f63f0;if(_0x19e9db>=_0x5afa6d){_0x19e9db=_0x5afa6d;_0x1f63f0=0xc8;}else{_0x1f63f0=0xce;}_0x4a26b3[_0xeb26('0x1c')](_0x1f63f0);return _0x4a26b3[_0xeb26('0x23')](_0xeb26('0x24'),_0x3b41f5+'-'+_0x19e9db+'/'+_0x5afa6d)[_0xeb26('0x1e')](_0x3dbb9c);}return null;};}function patchUpdates(_0x21dca2){return function(_0x546795){try{jsonpatch[_0xeb26('0x25')](_0x546795,_0x21dca2,!![]);}catch(_0x1fccf2){return BPromise[_0xeb26('0x26')](_0x1fccf2);}return _0x546795[_0xeb26('0x27')]();};}function saveUpdates(_0x5899f0,_0x3d304c){return function(_0x58f4f4){if(_0x58f4f4){return _0x58f4f4['update'](_0x5899f0)[_0xeb26('0x28')](function(_0x20ef71){return _0x20ef71;});}return null;};}function removeEntity(_0xabb7e2,_0x51435a){return function(_0xd57cca){if(_0xd57cca){return _0xd57cca[_0xeb26('0x29')]()[_0xeb26('0x28')](function(){_0xabb7e2[_0xeb26('0x1c')](0xcc)[_0xeb26('0x1d')]();});}};}function handleEntityNotFound(_0x14d6ca,_0x5a3b3b){return function(_0x2780b8){if(!_0x2780b8){_0x14d6ca[_0xeb26('0x1b')](0x194);}return _0x2780b8;};}function handleError(_0x4aeca3,_0x415df3){_0x415df3=_0x415df3||0x1f4;return function(_0x1e642b){logger[_0xeb26('0x2a')](_0x1e642b[_0xeb26('0x2b')]);if(_0x1e642b['name']){delete _0x1e642b[_0xeb26('0x2c')];}_0x4aeca3[_0xeb26('0x1c')](_0x415df3)[_0xeb26('0x2d')](_0x1e642b);};}exports[_0xeb26('0x2e')]=function(_0x8703fa,_0x26ca62){var _0x4a2285={},_0x224a80={},_0x74cacf={'count':0x0,'rows':[]};var _0x68b42f=_[_0xeb26('0x2f')](db[_0xeb26('0x30')][_0xeb26('0x31')],function(_0x3327b7){return{'name':_0x3327b7['fieldName'],'type':_0x3327b7[_0xeb26('0x32')]['key']};});_0x224a80[_0xeb26('0x33')]=_['map'](_0x68b42f,_0xeb26('0x2c'));_0x224a80[_0xeb26('0x34')]=_[_0xeb26('0x35')](_0x8703fa['query']);_0x224a80[_0xeb26('0x36')]=_[_0xeb26('0x37')](_0x224a80[_0xeb26('0x33')],_0x224a80[_0xeb26('0x34')]);_0x4a2285[_0xeb26('0x38')]=_[_0xeb26('0x37')](_0x224a80['model'],qs['fields'](_0x8703fa[_0xeb26('0x34')][_0xeb26('0x39')]));_0x4a2285[_0xeb26('0x38')]=_0x4a2285['attributes'][_0xeb26('0x3a')]?_0x4a2285[_0xeb26('0x38')]:_0x224a80[_0xeb26('0x33')];if(!_0x8703fa[_0xeb26('0x34')]['hasOwnProperty'](_0xeb26('0x3b'))){_0x4a2285['limit']=qs[_0xeb26('0x21')](_0x8703fa[_0xeb26('0x34')][_0xeb26('0x21')]);_0x4a2285['offset']=qs[_0xeb26('0x1f')](_0x8703fa[_0xeb26('0x34')][_0xeb26('0x1f')]);}_0x4a2285[_0xeb26('0x3c')]=qs[_0xeb26('0x3d')](_0x8703fa['query']['sort']);_0x4a2285[_0xeb26('0x3e')]=qs[_0xeb26('0x36')](_['pick'](_0x8703fa[_0xeb26('0x34')],_0x224a80[_0xeb26('0x36')]),_0x68b42f);if(_0x8703fa[_0xeb26('0x34')][_0xeb26('0x3f')]){_0x4a2285['where']=_[_0xeb26('0x40')](_0x4a2285[_0xeb26('0x3e')],{'$or':_[_0xeb26('0x2f')](_0x68b42f,function(_0xaa0b68){if(_0xaa0b68[_0xeb26('0x32')]!==_0xeb26('0x41')){var _0x2acebb={};_0x2acebb[_0xaa0b68[_0xeb26('0x2c')]]={'$like':'%'+_0x8703fa[_0xeb26('0x34')][_0xeb26('0x3f')]+'%'};return _0x2acebb;}})});}_0x4a2285=_[_0xeb26('0x40')]({},_0x4a2285,_0x8703fa[_0xeb26('0x42')]);var _0x1f79d5={'where':_0x4a2285[_0xeb26('0x3e')]};return db[_0xeb26('0x30')]['count'](_0x1f79d5)[_0xeb26('0x28')](function(_0x1c4b49){_0x74cacf[_0xeb26('0x22')]=_0x1c4b49;if(_0x8703fa['query']['includeAll']){_0x4a2285[_0xeb26('0x43')]=[{'all':!![]}];}return db[_0xeb26('0x30')][_0xeb26('0x44')](_0x4a2285);})[_0xeb26('0x28')](function(_0x476b33){_0x74cacf[_0xeb26('0x45')]=_0x476b33;return _0x74cacf;})[_0xeb26('0x28')](respondWithFilteredResult(_0x26ca62,_0x4a2285))[_0xeb26('0x46')](handleError(_0x26ca62,null));};exports['show']=function(_0x3cabc0,_0x13235a){var _0x44c569={'raw':!![],'where':{'id':_0x3cabc0[_0xeb26('0x47')]['id']}},_0x289226={};_0x289226[_0xeb26('0x33')]=_['keys'](db['OpenchannelApplication'][_0xeb26('0x31')]);_0x289226['query']=_[_0xeb26('0x35')](_0x3cabc0[_0xeb26('0x34')]);_0x289226[_0xeb26('0x36')]=_[_0xeb26('0x37')](_0x289226['model'],_0x289226['query']);_0x44c569['attributes']=_[_0xeb26('0x37')](_0x289226[_0xeb26('0x33')],qs['fields'](_0x3cabc0[_0xeb26('0x34')][_0xeb26('0x39')]));_0x44c569[_0xeb26('0x38')]=_0x44c569[_0xeb26('0x38')][_0xeb26('0x3a')]?_0x44c569[_0xeb26('0x38')]:_0x289226[_0xeb26('0x33')];if(_0x3cabc0[_0xeb26('0x34')]['includeAll']){_0x44c569[_0xeb26('0x43')]=[{'all':!![]}];}_0x44c569=_[_0xeb26('0x40')]({},_0x44c569,_0x3cabc0[_0xeb26('0x42')]);return db[_0xeb26('0x30')][_0xeb26('0x48')](_0x44c569)['then'](handleEntityNotFound(_0x13235a,null))[_0xeb26('0x28')](respondWithResult(_0x13235a,null))[_0xeb26('0x46')](handleError(_0x13235a,null));};exports['create']=function(_0x2acd40,_0x5c5fe2){return db[_0xeb26('0x30')][_0xeb26('0x49')](_0x2acd40[_0xeb26('0x4a')],{})['then'](respondWithResult(_0x5c5fe2,0xc9))['catch'](handleError(_0x5c5fe2,null));};exports[_0xeb26('0x4b')]=function(_0x12edbe,_0x5f073a){if(_0x12edbe[_0xeb26('0x4a')]['id']){delete _0x12edbe[_0xeb26('0x4a')]['id'];}return db[_0xeb26('0x30')][_0xeb26('0x48')]({'where':{'id':_0x12edbe[_0xeb26('0x47')]['id']}})[_0xeb26('0x28')](handleEntityNotFound(_0x5f073a,null))[_0xeb26('0x28')](saveUpdates(_0x12edbe['body'],null))[_0xeb26('0x28')](respondWithResult(_0x5f073a,null))[_0xeb26('0x46')](handleError(_0x5f073a,null));};exports['destroy']=function(_0xda9eaa,_0x21a275){return db[_0xeb26('0x30')][_0xeb26('0x48')]({'where':{'id':_0xda9eaa[_0xeb26('0x47')]['id']}})[_0xeb26('0x28')](handleEntityNotFound(_0x21a275,null))[_0xeb26('0x28')](removeEntity(_0x21a275,null))[_0xeb26('0x46')](handleError(_0x21a275,null));}; \ No newline at end of file +var _0x96f9=['status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','options','OpenchannelApplication','include','rows','catch','show','params','rawAttributes','includeAll','create','body','find','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','limit'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x96f9,0x112));var _0x996f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x96f9[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x996f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x996f('0x1'));var moment=require(_0x996f('0x2'));var BPromise=require(_0x996f('0x3'));var Mustache=require(_0x996f('0x4'));var util=require(_0x996f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x996f('0x6'));var ejs=require(_0x996f('0x7'));var fs=require('fs');var fs_extra=require(_0x996f('0x8'));var _=require(_0x996f('0x9'));var squel=require(_0x996f('0xa'));var crypto=require(_0x996f('0xb'));var jsforce=require(_0x996f('0xc'));var deskjs=require(_0x996f('0xd'));var toCsv=require(_0x996f('0x6'));var querystring=require(_0x996f('0xe'));var Papa=require('papaparse');var Redis=require(_0x996f('0xf'));var authService=require(_0x996f('0x10'));var qs=require(_0x996f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x996f('0x12'))(_0x996f('0x13'));var utils=require(_0x996f('0x14'));var config=require(_0x996f('0x15'));var licenseUtil=require(_0x996f('0x16'));var db=require(_0x996f('0x17'))['db'];function respondWithStatusCode(_0x48be9c,_0x368901){_0x368901=_0x368901||0xcc;return function(_0x38b891){if(_0x38b891){return _0x48be9c['sendStatus'](_0x368901);}return _0x48be9c['status'](_0x368901)[_0x996f('0x18')]();};}function respondWithResult(_0x15089d,_0x5ba907){_0x5ba907=_0x5ba907||0xc8;return function(_0x86994f){if(_0x86994f){return _0x15089d['status'](_0x5ba907)[_0x996f('0x19')](_0x86994f);}};}function respondWithFilteredResult(_0x3df9e3,_0x4d79ea){return function(_0x343980){if(_0x343980){var _0x5bd98d=typeof _0x4d79ea[_0x996f('0x1a')]===_0x996f('0x1b')&&typeof _0x4d79ea['limit']===_0x996f('0x1b');var _0x136710=_0x343980[_0x996f('0x1c')];var _0x1773af=_0x5bd98d?0x0:_0x4d79ea[_0x996f('0x1a')];var _0x3fee31=_0x5bd98d?_0x343980[_0x996f('0x1c')]:_0x4d79ea[_0x996f('0x1a')]+_0x4d79ea[_0x996f('0x1d')];var _0x1e14ca;if(_0x3fee31>=_0x136710){_0x3fee31=_0x136710;_0x1e14ca=0xc8;}else{_0x1e14ca=0xce;}_0x3df9e3[_0x996f('0x1e')](_0x1e14ca);return _0x3df9e3[_0x996f('0x1f')](_0x996f('0x20'),_0x1773af+'-'+_0x3fee31+'/'+_0x136710)[_0x996f('0x19')](_0x343980);}return null;};}function patchUpdates(_0x400a0c){return function(_0x46944d){try{jsonpatch[_0x996f('0x21')](_0x46944d,_0x400a0c,!![]);}catch(_0x5c8f1b){return BPromise[_0x996f('0x22')](_0x5c8f1b);}return _0x46944d[_0x996f('0x23')]();};}function saveUpdates(_0x22b180,_0x353541){return function(_0x129cf6){if(_0x129cf6){return _0x129cf6[_0x996f('0x24')](_0x22b180)[_0x996f('0x25')](function(_0x3ca2b2){return _0x3ca2b2;});}return null;};}function removeEntity(_0x1f807c,_0x25f5b9){return function(_0x525421){if(_0x525421){return _0x525421[_0x996f('0x26')]()[_0x996f('0x25')](function(){_0x1f807c[_0x996f('0x1e')](0xcc)[_0x996f('0x18')]();});}};}function handleEntityNotFound(_0xb34d29,_0x3abb92){return function(_0x2cd1fa){if(!_0x2cd1fa){_0xb34d29[_0x996f('0x27')](0x194);}return _0x2cd1fa;};}function handleError(_0x569282,_0x3ababd){_0x3ababd=_0x3ababd||0x1f4;return function(_0x1d9583){logger[_0x996f('0x28')](_0x1d9583[_0x996f('0x29')]);if(_0x1d9583[_0x996f('0x2a')]){delete _0x1d9583[_0x996f('0x2a')];}_0x569282['status'](_0x3ababd)[_0x996f('0x2b')](_0x1d9583);};}exports[_0x996f('0x2c')]=function(_0x5f591f,_0x140a0a){var _0x6625e0={},_0x563cec={},_0x1110e8={'count':0x0,'rows':[]};var _0x1883a0=_[_0x996f('0x2d')](db['OpenchannelApplication']['rawAttributes'],function(_0x33d52d){return{'name':_0x33d52d[_0x996f('0x2e')],'type':_0x33d52d[_0x996f('0x2f')][_0x996f('0x30')]};});_0x563cec['model']=_[_0x996f('0x2d')](_0x1883a0,_0x996f('0x2a'));_0x563cec[_0x996f('0x31')]=_[_0x996f('0x32')](_0x5f591f[_0x996f('0x31')]);_0x563cec[_0x996f('0x33')]=_[_0x996f('0x34')](_0x563cec[_0x996f('0x35')],_0x563cec['query']);_0x6625e0[_0x996f('0x36')]=_[_0x996f('0x34')](_0x563cec[_0x996f('0x35')],qs[_0x996f('0x37')](_0x5f591f[_0x996f('0x31')][_0x996f('0x37')]));_0x6625e0[_0x996f('0x36')]=_0x6625e0[_0x996f('0x36')][_0x996f('0x38')]?_0x6625e0['attributes']:_0x563cec[_0x996f('0x35')];if(!_0x5f591f[_0x996f('0x31')][_0x996f('0x39')]('nolimit')){_0x6625e0[_0x996f('0x1d')]=qs['limit'](_0x5f591f[_0x996f('0x31')][_0x996f('0x1d')]);_0x6625e0[_0x996f('0x1a')]=qs[_0x996f('0x1a')](_0x5f591f[_0x996f('0x31')][_0x996f('0x1a')]);}_0x6625e0['order']=qs['sort'](_0x5f591f['query'][_0x996f('0x3a')]);_0x6625e0['where']=qs[_0x996f('0x33')](_[_0x996f('0x3b')](_0x5f591f['query'],_0x563cec[_0x996f('0x33')]),_0x1883a0);if(_0x5f591f[_0x996f('0x31')]['filter']){_0x6625e0[_0x996f('0x3c')]=_[_0x996f('0x3d')](_0x6625e0[_0x996f('0x3c')],{'$or':_[_0x996f('0x2d')](_0x1883a0,function(_0x18c908){if(_0x18c908[_0x996f('0x2f')]!==_0x996f('0x3e')){var _0x252b86={};_0x252b86[_0x18c908[_0x996f('0x2a')]]={'$like':'%'+_0x5f591f[_0x996f('0x31')][_0x996f('0x3f')]+'%'};return _0x252b86;}})});}_0x6625e0=_['merge']({},_0x6625e0,_0x5f591f[_0x996f('0x40')]);var _0x59ed4b={'where':_0x6625e0[_0x996f('0x3c')]};return db[_0x996f('0x41')]['count'](_0x59ed4b)[_0x996f('0x25')](function(_0x111a2a){_0x1110e8[_0x996f('0x1c')]=_0x111a2a;if(_0x5f591f['query']['includeAll']){_0x6625e0[_0x996f('0x42')]=[{'all':!![]}];}return db[_0x996f('0x41')]['findAll'](_0x6625e0);})[_0x996f('0x25')](function(_0x15c465){_0x1110e8[_0x996f('0x43')]=_0x15c465;return _0x1110e8;})[_0x996f('0x25')](respondWithFilteredResult(_0x140a0a,_0x6625e0))[_0x996f('0x44')](handleError(_0x140a0a,null));};exports[_0x996f('0x45')]=function(_0x2d56a6,_0x3447a1){var _0x372b3a={'raw':!![],'where':{'id':_0x2d56a6[_0x996f('0x46')]['id']}},_0x4f4eb0={};_0x4f4eb0[_0x996f('0x35')]=_[_0x996f('0x32')](db[_0x996f('0x41')][_0x996f('0x47')]);_0x4f4eb0[_0x996f('0x31')]=_[_0x996f('0x32')](_0x2d56a6[_0x996f('0x31')]);_0x4f4eb0[_0x996f('0x33')]=_['intersection'](_0x4f4eb0[_0x996f('0x35')],_0x4f4eb0[_0x996f('0x31')]);_0x372b3a['attributes']=_[_0x996f('0x34')](_0x4f4eb0[_0x996f('0x35')],qs[_0x996f('0x37')](_0x2d56a6[_0x996f('0x31')]['fields']));_0x372b3a['attributes']=_0x372b3a[_0x996f('0x36')][_0x996f('0x38')]?_0x372b3a[_0x996f('0x36')]:_0x4f4eb0[_0x996f('0x35')];if(_0x2d56a6[_0x996f('0x31')][_0x996f('0x48')]){_0x372b3a[_0x996f('0x42')]=[{'all':!![]}];}_0x372b3a=_[_0x996f('0x3d')]({},_0x372b3a,_0x2d56a6[_0x996f('0x40')]);return db['OpenchannelApplication']['find'](_0x372b3a)['then'](handleEntityNotFound(_0x3447a1,null))[_0x996f('0x25')](respondWithResult(_0x3447a1,null))[_0x996f('0x44')](handleError(_0x3447a1,null));};exports[_0x996f('0x49')]=function(_0x165f10,_0xb612a3){return db[_0x996f('0x41')][_0x996f('0x49')](_0x165f10[_0x996f('0x4a')],{})[_0x996f('0x25')](respondWithResult(_0xb612a3,0xc9))[_0x996f('0x44')](handleError(_0xb612a3,null));};exports[_0x996f('0x24')]=function(_0x5ed627,_0x1c79cb){if(_0x5ed627[_0x996f('0x4a')]['id']){delete _0x5ed627[_0x996f('0x4a')]['id'];}return db[_0x996f('0x41')][_0x996f('0x4b')]({'where':{'id':_0x5ed627[_0x996f('0x46')]['id']}})[_0x996f('0x25')](handleEntityNotFound(_0x1c79cb,null))[_0x996f('0x25')](saveUpdates(_0x5ed627['body'],null))['then'](respondWithResult(_0x1c79cb,null))[_0x996f('0x44')](handleError(_0x1c79cb,null));};exports[_0x996f('0x26')]=function(_0x41da6b,_0x2b5eeb){return db['OpenchannelApplication'][_0x996f('0x4b')]({'where':{'id':_0x41da6b['params']['id']}})[_0x996f('0x25')](handleEntityNotFound(_0x2b5eeb,null))[_0x996f('0x25')](removeEntity(_0x2b5eeb,null))[_0x996f('0x44')](handleError(_0x2b5eeb,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 83b62e7..ff40321 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 _0xb59e=['rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb59e,0x102));var _0xeb59=function(_0x15278c,_0x259d51){_0x15278c=_0x15278c-0x0;var _0x54af63=_0xb59e[_0x15278c];return _0x54af63;};'use strict';var _=require(_0xeb59('0x0'));var util=require(_0xeb59('0x1'));var logger=require(_0xeb59('0x2'))(_0xeb59('0x3'));var moment=require(_0xeb59('0x4'));var BPromise=require(_0xeb59('0x5'));var rp=require(_0xeb59('0x6'));var fs=require('fs');var path=require(_0xeb59('0x7'));var rimraf=require(_0xeb59('0x8'));var config=require(_0xeb59('0x9'));var attributes=require('./openchannelApplication.attributes');module[_0xeb59('0xa')]=function(_0x156666,_0x5a2af0){return _0x156666[_0xeb59('0xb')](_0xeb59('0xc'),attributes,{'tableName':_0xeb59('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3769=['bluebird','request-promise','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3769,0x11b));var _0x9376=function(_0x5aed95,_0x16ed07){_0x5aed95=_0x5aed95-0x0;var _0x11e865=_0x3769[_0x5aed95];return _0x11e865;};'use strict';var _=require(_0x9376('0x0'));var util=require('util');var logger=require(_0x9376('0x1'))(_0x9376('0x2'));var moment=require('moment');var BPromise=require(_0x9376('0x3'));var rp=require(_0x9376('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9376('0x5'));var attributes=require(_0x9376('0x6'));module['exports']=function(_0x566048,_0x577e3c){return _0x566048[_0x9376('0x7')](_0x9376('0x8'),attributes,{'tableName':_0x9376('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9376('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index bfa1f8b..4b5811b 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 _0x66ae=['stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s'];(function(_0x426059,_0x5be0cd){var _0x5a68da=function(_0x1a813c){while(--_0x1a813c){_0x426059['push'](_0x426059['shift']());}};_0x5a68da(++_0x5be0cd);}(_0x66ae,0x117));var _0xe66a=function(_0x592ffa,_0x2fe78a){_0x592ffa=_0x592ffa-0x0;var _0x5cb513=_0x66ae[_0x592ffa];return _0x5cb513;};'use strict';var _=require(_0xe66a('0x0'));var util=require(_0xe66a('0x1'));var moment=require(_0xe66a('0x2'));var BPromise=require(_0xe66a('0x3'));var rs=require(_0xe66a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe66a('0x5'))['db'];var utils=require(_0xe66a('0x6'));var logger=require(_0xe66a('0x7'))(_0xe66a('0x8'));var config=require(_0xe66a('0x9'));var jayson=require(_0xe66a('0xa'));var client=jayson[_0xe66a('0xb')][_0xe66a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e30a3,_0x2a27ea,_0xb9d0c9){return new BPromise(function(_0xb242e4,_0x34793c){return client[_0xe66a('0xd')](_0x1e30a3,_0xb9d0c9)[_0xe66a('0xe')](function(_0x1c2e50){logger[_0xe66a('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x2a27ea,_0xe66a('0x10'));logger['debug'](_0xe66a('0x11'),_0x2a27ea,_0xe66a('0x10'),JSON[_0xe66a('0x12')](_0x1c2e50));if(_0x1c2e50['error']){if(_0x1c2e50[_0xe66a('0x13')]['code']===0x1f4){logger[_0xe66a('0x13')](_0xe66a('0x14'),_0x2a27ea,_0x1c2e50[_0xe66a('0x13')]['message']);return _0x34793c(_0x1c2e50['error'][_0xe66a('0x15')]);}logger[_0xe66a('0x13')](_0xe66a('0x14'),_0x2a27ea,_0x1c2e50['error'][_0xe66a('0x15')]);return _0xb242e4(_0x1c2e50[_0xe66a('0x13')][_0xe66a('0x15')]);}else{logger[_0xe66a('0xf')](_0xe66a('0x14'),_0x2a27ea,_0xe66a('0x10'));_0xb242e4(_0x1c2e50[_0xe66a('0x16')][_0xe66a('0x15')]);}})['catch'](function(_0x5825e3){logger[_0xe66a('0x13')](_0xe66a('0x14'),_0x2a27ea,_0x5825e3);_0x34793c(_0x5825e3);});});}exports[_0xe66a('0x17')]=function(_0x36deb8){var _0x4ee07f=this;return new Promise(function(_0x1850b1,_0x43d7f4){return db[_0xe66a('0x18')][_0xe66a('0x19')](_0x36deb8[_0xe66a('0x1a')],{'raw':_0x36deb8['options']?_0x36deb8[_0xe66a('0x1b')][_0xe66a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36deb8[_0xe66a('0x1b')]?_0x36deb8[_0xe66a('0x1b')]['where']||null:null,'attributes':_0x36deb8[_0xe66a('0x1b')]?_0x36deb8[_0xe66a('0x1b')][_0xe66a('0x1d')]||null:null,'limit':_0x36deb8['options']?_0x36deb8[_0xe66a('0x1b')][_0xe66a('0x1e')]||null:null})[_0xe66a('0xe')](function(_0x22ebc9){logger['info'](_0xe66a('0x17'),_0x36deb8);logger[_0xe66a('0x1f')](_0xe66a('0x17'),_0x36deb8,JSON[_0xe66a('0x12')](_0x22ebc9));_0x1850b1(_0x22ebc9);})[_0xe66a('0x20')](function(_0x4445ef){logger[_0xe66a('0x13')](_0xe66a('0x17'),_0x4445ef[_0xe66a('0x15')],_0x36deb8);_0x43d7f4(_0x4ee07f[_0xe66a('0x13')](0x1f4,_0x4445ef[_0xe66a('0x15')]));});});}; \ No newline at end of file +var _0xef48=['attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','options','raw','where'];(function(_0xae9024,_0x17f58e){var _0x23e7d3=function(_0x5911fb){while(--_0x5911fb){_0xae9024['push'](_0xae9024['shift']());}};_0x23e7d3(++_0x17f58e);}(_0xef48,0xe2));var _0x8ef4=function(_0x493269,_0x405cfe){_0x493269=_0x493269-0x0;var _0x4362f0=_0xef48[_0x493269];return _0x4362f0;};'use strict';var _=require(_0x8ef4('0x0'));var util=require('util');var moment=require(_0x8ef4('0x1'));var BPromise=require(_0x8ef4('0x2'));var rs=require(_0x8ef4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ef4('0x4'))['db'];var utils=require(_0x8ef4('0x5'));var logger=require('../../config/logger')(_0x8ef4('0x6'));var config=require(_0x8ef4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8ef4('0x8')][_0x8ef4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x468993,_0x52bcc8,_0x5e813c){return new BPromise(function(_0x29057e,_0x1f5d01){return client[_0x8ef4('0xa')](_0x468993,_0x5e813c)[_0x8ef4('0xb')](function(_0x4f9322){logger['info'](_0x8ef4('0xc'),_0x52bcc8,_0x8ef4('0xd'));logger['debug'](_0x8ef4('0xe'),_0x52bcc8,_0x8ef4('0xd'),JSON[_0x8ef4('0xf')](_0x4f9322));if(_0x4f9322[_0x8ef4('0x10')]){if(_0x4f9322['error'][_0x8ef4('0x11')]===0x1f4){logger[_0x8ef4('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x52bcc8,_0x4f9322[_0x8ef4('0x10')][_0x8ef4('0x12')]);return _0x1f5d01(_0x4f9322['error']['message']);}logger[_0x8ef4('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x52bcc8,_0x4f9322['error'][_0x8ef4('0x12')]);return _0x29057e(_0x4f9322[_0x8ef4('0x10')][_0x8ef4('0x12')]);}else{logger['info'](_0x8ef4('0xc'),_0x52bcc8,_0x8ef4('0xd'));_0x29057e(_0x4f9322[_0x8ef4('0x13')][_0x8ef4('0x12')]);}})[_0x8ef4('0x14')](function(_0x2d2d02){logger[_0x8ef4('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x52bcc8,_0x2d2d02);_0x1f5d01(_0x2d2d02);});});}exports[_0x8ef4('0x15')]=function(_0xd2c443){var _0x572262=this;return new Promise(function(_0x584ce6,_0x42e59f){return db[_0x8ef4('0x16')]['update'](_0xd2c443['body'],{'raw':_0xd2c443[_0x8ef4('0x17')]?_0xd2c443[_0x8ef4('0x17')][_0x8ef4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd2c443[_0x8ef4('0x17')]?_0xd2c443[_0x8ef4('0x17')][_0x8ef4('0x19')]||null:null,'attributes':_0xd2c443[_0x8ef4('0x17')]?_0xd2c443[_0x8ef4('0x17')][_0x8ef4('0x1a')]||null:null,'limit':_0xd2c443['options']?_0xd2c443['options'][_0x8ef4('0x1b')]||null:null})[_0x8ef4('0xb')](function(_0x3809a){logger['info'](_0x8ef4('0x15'),_0xd2c443);logger['debug'](_0x8ef4('0x15'),_0xd2c443,JSON[_0x8ef4('0xf')](_0x3809a));_0x584ce6(_0x3809a);})[_0x8ef4('0x14')](function(_0x10905a){logger[_0x8ef4('0x10')](_0x8ef4('0x15'),_0x10905a[_0x8ef4('0x12')],_0xd2c443);_0x42e59f(_0x572262[_0x8ef4('0x10')](0x1f4,_0x10905a['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 623c061..dfe504d 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 _0x01e9=['/describe','describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','openchannel','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get'];(function(_0xa77f04,_0x5e142c){var _0x36531f=function(_0x10f2c3){while(--_0x10f2c3){_0xa77f04['push'](_0xa77f04['shift']());}};_0x36531f(++_0x5e142c);}(_0x01e9,0x135));var _0x901e=function(_0x2e6ce1,_0x39e46d){_0x2e6ce1=_0x2e6ce1-0x0;var _0x247c23=_0x01e9[_0x2e6ce1];return _0x247c23;};'use strict';var multer=require(_0x901e('0x0'));var util=require(_0x901e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x901e('0x2'));var router=express[_0x901e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x901e('0x4'));var interaction=require(_0x901e('0x5'));var config=require(_0x901e('0x6'));var controller=require(_0x901e('0x7'));router['get']('/',auth[_0x901e('0x8')](),controller[_0x901e('0x9')]);router[_0x901e('0xa')](_0x901e('0xb'),auth['isAuthenticated'](),controller[_0x901e('0xc')]);router['get'](_0x901e('0xd'),auth[_0x901e('0x8')](),controller[_0x901e('0xe')]);router[_0x901e('0xa')](_0x901e('0xf'),auth['isAuthenticated'](),controller[_0x901e('0x10')]);router[_0x901e('0xa')]('/:id/download',auth[_0x901e('0x8')](),controller[_0x901e('0x11')]);router[_0x901e('0x12')]('/',auth[_0x901e('0x8')](),controller['create']);router[_0x901e('0x12')](_0x901e('0xf'),auth['isAuthenticated'](),controller[_0x901e('0x13')]);router[_0x901e('0x12')](_0x901e('0x14'),auth[_0x901e('0x8')](),interaction[_0x901e('0x15')](_0x901e('0x16'),'openchannelinteraction:addtags'),controller[_0x901e('0x17')]);router[_0x901e('0x18')](_0x901e('0xd'),auth['isAuthenticated'](),interaction[_0x901e('0x15')](_0x901e('0x16'),_0x901e('0x19')),controller[_0x901e('0x1a')]);router[_0x901e('0x1b')]('/:id',auth[_0x901e('0x8')](),interaction[_0x901e('0x15')](_0x901e('0x16'),_0x901e('0x1c')),controller[_0x901e('0x1d')]);router['delete'](_0x901e('0x14'),auth['isAuthenticated'](),controller[_0x901e('0x1e')]);module[_0x901e('0x1f')]=router; \ No newline at end of file +var _0x7a33=['get','/describe','/:id','show','/:id/messages','/:id/download','download','create','post','/:id/tags','tracked','openchannel','addTags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index'];(function(_0x3fa7d3,_0x37f83c){var _0x4c51bd=function(_0x59e85b){while(--_0x59e85b){_0x3fa7d3['push'](_0x3fa7d3['shift']());}};_0x4c51bd(++_0x37f83c);}(_0x7a33,0x1ef));var _0x37a3=function(_0x3b79c5,_0x4f2b0d){_0x3b79c5=_0x3b79c5-0x0;var _0x479fdf=_0x7a33[_0x3b79c5];return _0x479fdf;};'use strict';var multer=require(_0x37a3('0x0'));var util=require(_0x37a3('0x1'));var path=require('path');var timeout=require(_0x37a3('0x2'));var express=require('express');var router=express[_0x37a3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x37a3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x37a3('0x5'));var controller=require(_0x37a3('0x6'));router['get']('/',auth[_0x37a3('0x7')](),controller[_0x37a3('0x8')]);router[_0x37a3('0x9')](_0x37a3('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x37a3('0xb'),auth['isAuthenticated'](),controller[_0x37a3('0xc')]);router[_0x37a3('0x9')](_0x37a3('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0x37a3('0x9')](_0x37a3('0xe'),auth['isAuthenticated'](),controller[_0x37a3('0xf')]);router['post']('/',auth[_0x37a3('0x7')](),controller[_0x37a3('0x10')]);router[_0x37a3('0x11')](_0x37a3('0xd'),auth[_0x37a3('0x7')](),controller['addMessage']);router[_0x37a3('0x11')](_0x37a3('0x12'),auth['isAuthenticated'](),interaction[_0x37a3('0x13')](_0x37a3('0x14'),'openchannelinteraction:addtags'),controller[_0x37a3('0x15')]);router['put'](_0x37a3('0xb'),auth['isAuthenticated'](),interaction[_0x37a3('0x13')]('openchannel',_0x37a3('0x16')),controller[_0x37a3('0x17')]);router[_0x37a3('0x18')](_0x37a3('0xb'),auth[_0x37a3('0x7')](),interaction[_0x37a3('0x13')](_0x37a3('0x14'),_0x37a3('0x19')),controller['destroy']);router['delete'](_0x37a3('0x12'),auth[_0x37a3('0x7')](),controller[_0x37a3('0x1a')]);module[_0x37a3('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index f445d9e..51c9fa8 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 _0x80ce=['ENUM','out','DATE','STRING'];(function(_0x45d923,_0xf7c0b4){var _0x21b24c=function(_0x5593a4){while(--_0x5593a4){_0x45d923['push'](_0x45d923['shift']());}};_0x21b24c(++_0xf7c0b4);}(_0x80ce,0xae));var _0xe80c=function(_0x321511,_0xe134e7){_0x321511=_0x321511-0x0;var _0x5d6bd1=_0x80ce[_0x321511];return _0x5d6bd1;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe80c('0x0')]},'disposition':{'type':Sequelize[_0xe80c('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe80c('0x1')]},'note':{'type':Sequelize[_0xe80c('0x1')]},'read1stAt':{'type':Sequelize[_0xe80c('0x0')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe80c('0x2')]('in',_0xe80c('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xe80c('0x2')]('in',_0xe80c('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6611=['BOOLEAN','DATE','STRING','ENUM','out','exports'];(function(_0x378e9e,_0x316083){var _0x5355e0=function(_0x148f46){while(--_0x148f46){_0x378e9e['push'](_0x378e9e['shift']());}};_0x5355e0(++_0x316083);}(_0x6611,0xdd));var _0x1661=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6611[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x1661('0x0')]={'closed':{'type':Sequelize[_0x1661('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1661('0x2')]},'disposition':{'type':Sequelize[_0x1661('0x3')]},'secondDisposition':{'type':Sequelize[_0x1661('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1661('0x3')]},'note':{'type':Sequelize[_0x1661('0x3')]},'read1stAt':{'type':Sequelize[_0x1661('0x2')]},'threadId':{'type':Sequelize[_0x1661('0x3')]},'externalUrl':{'type':Sequelize[_0x1661('0x3')]},'lastMsgAt':{'type':Sequelize[_0x1661('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x1661('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1661('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1661('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index f904d3b..d1a306b 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 _0xfc87=['YYYY-MM-DD\x20HH:mm:ss','disposition','Public','Private','basename','createReadStream','direction','out','System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','path','ioredis','../../components/parsers/qs','../../components/export/pdf','api','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','update','then','destroy','stack','name','send','index','map','OpenchannelInteraction','fieldName','key','findAll','openchannel','query','user','show','type','from','params','model','keys','rawAttributes','filters','intersection','attributes','includeAll','include','options','find','catch','body','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','length','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','merge','$gte','split','format','rows','addTags','setTags','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','fullname','CmContact','Contact','lastName','push','Attachment','Messages','createdAt','secret','OpenchannelAccount','Account','User','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt'];(function(_0x1ed2af,_0x35b554){var _0x444c90=function(_0x56348e){while(--_0x56348e){_0x1ed2af['push'](_0x1ed2af['shift']());}};_0x444c90(++_0x35b554);}(_0xfc87,0x116));var _0x7fc8=function(_0x27f2eb,_0x3c2f16){_0x27f2eb=_0x27f2eb-0x0;var _0x2f0891=_0xfc87[_0x27f2eb];return _0x2f0891;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x7fc8('0x0'));var moment=require(_0x7fc8('0x1'));var util=require(_0x7fc8('0x2'));var path=require(_0x7fc8('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x7fc8('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x7fc8('0x5'));var pdf=require(_0x7fc8('0x6'));var logger=require('../../config/logger')(_0x7fc8('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x7fc8('0x8')]=_[_0x7fc8('0x9')](config[_0x7fc8('0x8')],{'host':_0x7fc8('0xa'),'port':0x18eb});var socket=require(_0x7fc8('0xb'))(new Redis(config[_0x7fc8('0x8')]));require(_0x7fc8('0xc'))[_0x7fc8('0xd')](socket);function respondWithStatusCode(_0x51d51c,_0x34c8a3){_0x34c8a3=_0x34c8a3||0xcc;return function(_0x5a2430){if(_0x5a2430){return _0x51d51c[_0x7fc8('0xe')](_0x34c8a3);}return _0x51d51c[_0x7fc8('0xf')](_0x34c8a3)[_0x7fc8('0x10')]();};}function respondWithResult(_0x1b936e,_0x3aab89){_0x3aab89=_0x3aab89||0xc8;return function(_0x2b1c5d){if(_0x2b1c5d){return _0x1b936e[_0x7fc8('0xf')](_0x3aab89)['json'](_0x2b1c5d);}};}function respondWithFilteredResult(_0x2af3e1,_0x2cfc79){return function(_0x548112){if(_0x548112){var _0x4b7606=typeof _0x2cfc79[_0x7fc8('0x11')]==='undefined'&&typeof _0x2cfc79[_0x7fc8('0x12')]===_0x7fc8('0x13');var _0x9ce559=_0x548112[_0x7fc8('0x14')];var _0x3eceed=_0x4b7606?0x0:_0x2cfc79[_0x7fc8('0x11')];var _0x462be7=_0x4b7606?_0x548112[_0x7fc8('0x14')]:_0x2cfc79[_0x7fc8('0x11')]+_0x2cfc79[_0x7fc8('0x12')];var _0xe133fb;if(_0x462be7>=_0x9ce559){_0x462be7=_0x9ce559;_0xe133fb=0xc8;}else{_0xe133fb=0xce;}_0x2af3e1[_0x7fc8('0xf')](_0xe133fb);return _0x2af3e1[_0x7fc8('0x15')](_0x7fc8('0x16'),_0x3eceed+'-'+_0x462be7+'/'+_0x9ce559)[_0x7fc8('0x17')](_0x548112);}return null;};}function saveUpdates(_0x756f9c){return function(_0x32a2a3){if(_0x32a2a3){return _0x32a2a3[_0x7fc8('0x18')](_0x756f9c)[_0x7fc8('0x19')](function(_0xfa9960){return _0xfa9960;});}return null;};}function removeEntity(_0x1b1fc7){return function(_0x2827ac){if(_0x2827ac){return _0x2827ac[_0x7fc8('0x1a')]()[_0x7fc8('0x19')](function(){_0x1b1fc7[_0x7fc8('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a2546){return function(_0x2e6450){if(!_0x2e6450){_0x4a2546[_0x7fc8('0xe')](0x194);}return _0x2e6450;};}function handleError(_0xfcb3ed,_0xa8b3a8){_0xa8b3a8=_0xa8b3a8||0x1f4;return function(_0x3ca44b){logger['error'](_0x3ca44b[_0x7fc8('0x1b')]);if(_0x3ca44b['name']){delete _0x3ca44b[_0x7fc8('0x1c')];}_0xfcb3ed[_0x7fc8('0xf')](_0xa8b3a8)[_0x7fc8('0x1d')](_0x3ca44b);};}exports[_0x7fc8('0x1e')]=function(_0x2c9af7,_0x34e3e8){var _0x766108={};var _0x5cc4ef=_[_0x7fc8('0x1f')](db[_0x7fc8('0x20')]['rawAttributes'],function(_0x508d24){return{'name':_0x508d24[_0x7fc8('0x21')],'type':_0x508d24['type'][_0x7fc8('0x22')]};});_0x766108=qs['getOptions'](_0x5cc4ef,_0x2c9af7);return interaction[_0x7fc8('0x23')](_0x7fc8('0x24'),_0x2c9af7[_0x7fc8('0x25')],_0x2c9af7[_0x7fc8('0x26')],_0x766108,_0x5cc4ef)['then'](respondWithFilteredResult(_0x34e3e8,_0x766108))['catch'](handleError(_0x34e3e8,null));};exports[_0x7fc8('0x27')]=function(_0x566491,_0x74bad4){var _0xd33f14={};if(_0x566491[_0x7fc8('0x25')][_0x7fc8('0x28')]&&_0x566491[_0x7fc8('0x25')][_0x7fc8('0x28')]===_0x7fc8('0x29')){_0xd33f14[_0x7fc8('0x29')]=_0x566491[_0x7fc8('0x2a')]['id'];}else{_0xd33f14['id']=_0x566491[_0x7fc8('0x2a')]['id'];}var _0x1acc9c={'raw':![],'where':_0xd33f14},_0x2e23d8={};_0x2e23d8[_0x7fc8('0x2b')]=_[_0x7fc8('0x2c')](db[_0x7fc8('0x20')][_0x7fc8('0x2d')]);_0x2e23d8[_0x7fc8('0x25')]=_[_0x7fc8('0x2c')](_0x566491[_0x7fc8('0x25')]);_0x2e23d8[_0x7fc8('0x2e')]=_[_0x7fc8('0x2f')](_0x2e23d8[_0x7fc8('0x2b')],_0x2e23d8[_0x7fc8('0x25')]);_0x1acc9c[_0x7fc8('0x30')]=_[_0x7fc8('0x2f')](_0x2e23d8[_0x7fc8('0x2b')],qs['fields'](_0x566491['query']['fields']));_0x1acc9c[_0x7fc8('0x30')]=_0x1acc9c[_0x7fc8('0x30')]['length']?_0x1acc9c[_0x7fc8('0x30')]:_0x2e23d8[_0x7fc8('0x2b')];if(_0x566491['query'][_0x7fc8('0x31')]){_0x1acc9c[_0x7fc8('0x32')]=[{'all':!![]}];}_0x1acc9c=_['merge']({},_0x1acc9c,_0x566491[_0x7fc8('0x33')]);return db[_0x7fc8('0x20')][_0x7fc8('0x34')](_0x1acc9c)[_0x7fc8('0x19')](handleEntityNotFound(_0x74bad4,null))[_0x7fc8('0x19')](respondWithResult(_0x74bad4,null))[_0x7fc8('0x35')](handleError(_0x74bad4,null));};exports['create']=function(_0x24fcf4,_0x49d672){return db[_0x7fc8('0x20')]['create'](_0x24fcf4[_0x7fc8('0x36')],{})[_0x7fc8('0x19')](respondWithResult(_0x49d672,0xc9))[_0x7fc8('0x35')](handleError(_0x49d672,null));};exports['update']=function(_0x486cea,_0x201219){if(_0x486cea[_0x7fc8('0x36')]['id']){delete _0x486cea[_0x7fc8('0x36')]['id'];}return db[_0x7fc8('0x20')][_0x7fc8('0x34')]({'where':{'id':_0x486cea[_0x7fc8('0x2a')]['id']}})['then'](handleEntityNotFound(_0x201219,null))[_0x7fc8('0x19')](saveUpdates(_0x486cea[_0x7fc8('0x36')],null))[_0x7fc8('0x19')](respondWithResult(_0x201219,null))[_0x7fc8('0x35')](handleError(_0x201219,null));};exports[_0x7fc8('0x1a')]=function(_0x7b6f69,_0x363e35){return db['OpenchannelInteraction'][_0x7fc8('0x34')]({'where':{'id':_0x7b6f69[_0x7fc8('0x2a')]['id']}})[_0x7fc8('0x19')](handleEntityNotFound(_0x363e35,null))[_0x7fc8('0x19')](removeEntity(_0x363e35,null))[_0x7fc8('0x35')](handleError(_0x363e35,null));};exports[_0x7fc8('0x37')]=function(_0x3ea269,_0x28517a){return db[_0x7fc8('0x20')]['describe']()[_0x7fc8('0x19')](respondWithResult(_0x28517a,null))[_0x7fc8('0x35')](handleError(_0x28517a,null));};exports[_0x7fc8('0x38')]=function(_0x5051ea,_0x236247){return db['OpenchannelMessage'][_0x7fc8('0x34')]({'where':{'id':_0x5051ea['params']['id']}})[_0x7fc8('0x19')](handleEntityNotFound(_0x236247,null))[_0x7fc8('0x19')](function(_0x3a0ddd){if(_0x3a0ddd){return _0x3a0ddd[_0x7fc8('0x38')](_0x5051ea[_0x7fc8('0x36')][_0x7fc8('0x39')],_[_0x7fc8('0x3a')](_0x5051ea[_0x7fc8('0x36')],[_0x7fc8('0x39'),'id'])||{});}})[_0x7fc8('0x19')](respondWithResult(_0x236247,null))[_0x7fc8('0x35')](handleError(_0x236247,null));};exports[_0x7fc8('0x3b')]=function(_0x179d0e,_0x54af65){var _0x5a0bab={'raw':![],'where':{}};var _0x2b8478={};var _0x3d9a84={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x7fc8('0x3c')]({'where':{'id':_0x179d0e[_0x7fc8('0x2a')]['id']}})['then'](handleEntityNotFound(_0x54af65,null))[_0x7fc8('0x19')](function(_0x4f280a){if(_0x4f280a){_0x2b8478[_0x7fc8('0x2b')]=_[_0x7fc8('0x2c')](db[_0x7fc8('0x3d')][_0x7fc8('0x2d')]);_0x2b8478['query']=_['keys'](_0x179d0e[_0x7fc8('0x25')]);_0x2b8478['filters']=_[_0x7fc8('0x2f')](_0x2b8478[_0x7fc8('0x2b')],_0x2b8478[_0x7fc8('0x25')]);_0x5a0bab['attributes']=_[_0x7fc8('0x2f')](_0x2b8478['model'],qs['fields'](_0x179d0e['query']['fields']));_0x5a0bab['attributes']=_0x5a0bab['attributes'][_0x7fc8('0x3e')]?_0x5a0bab[_0x7fc8('0x30')]:_0x2b8478[_0x7fc8('0x2b')];if(!_0x179d0e['query'][_0x7fc8('0x3f')](_0x7fc8('0x40'))){_0x5a0bab[_0x7fc8('0x12')]=qs[_0x7fc8('0x12')](_0x179d0e[_0x7fc8('0x25')]['limit']);_0x5a0bab[_0x7fc8('0x11')]=qs[_0x7fc8('0x11')](_0x179d0e[_0x7fc8('0x25')]['offset']);}_0x5a0bab[_0x7fc8('0x41')]=qs[_0x7fc8('0x42')](_0x179d0e[_0x7fc8('0x25')]['sort']);_0x5a0bab[_0x7fc8('0x43')]=qs[_0x7fc8('0x2e')](_[_0x7fc8('0x44')](_0x179d0e[_0x7fc8('0x25')],_0x2b8478['filters']));_0x5a0bab[_0x7fc8('0x43')][_0x7fc8('0x45')]=_0x4f280a['id'];if(_0x179d0e[_0x7fc8('0x25')][_0x7fc8('0x46')]){_0x5a0bab[_0x7fc8('0x43')]=_[_0x7fc8('0x47')](_0x5a0bab[_0x7fc8('0x43')],{'$or':_[_0x7fc8('0x1f')](_0x5a0bab['attributes'],function(_0x537ce1){var _0x3b9e48={};_0x3b9e48[_0x537ce1]={'$like':'%'+_0x179d0e[_0x7fc8('0x25')][_0x7fc8('0x46')]+'%'};return _0x3b9e48;})});}if(_0x179d0e[_0x7fc8('0x25')][_0x7fc8('0x48')]){var _0x16e22a=_0x179d0e[_0x7fc8('0x25')][_0x7fc8('0x48')][_0x7fc8('0x49')](',');var _0x4994ba={};_0x4994ba[_0x16e22a[0x0]]={'$gte':moment(_0x16e22a[0x1])[_0x7fc8('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5a0bab[_0x7fc8('0x43')]=_[_0x7fc8('0x47')](_0x5a0bab[_0x7fc8('0x43')],_0x4994ba);}_0x5a0bab=_[_0x7fc8('0x47')]({},_0x5a0bab,_0x179d0e['options']);return db[_0x7fc8('0x3d')][_0x7fc8('0x14')]({'where':_0x5a0bab[_0x7fc8('0x43')]})[_0x7fc8('0x19')](function(_0x515ac0){_0x3d9a84[_0x7fc8('0x14')]=_0x515ac0;if(_0x179d0e[_0x7fc8('0x25')]['includeAll']){_0x5a0bab['include']=[{'all':!![]}];}return db[_0x7fc8('0x3d')][_0x7fc8('0x23')](_0x5a0bab);})[_0x7fc8('0x19')](function(_0xe17f0b){_0x3d9a84[_0x7fc8('0x4b')]=_0xe17f0b;return _0x3d9a84;});}})[_0x7fc8('0x19')](respondWithFilteredResult(_0x54af65,_0x5a0bab))[_0x7fc8('0x35')](handleError(_0x54af65,null));};exports[_0x7fc8('0x4c')]=function(_0x329168,_0x5fe267){return db['OpenchannelInteraction'][_0x7fc8('0x34')]({'where':{'id':_0x329168[_0x7fc8('0x2a')]['id']}})[_0x7fc8('0x19')](handleEntityNotFound(_0x5fe267,null))[_0x7fc8('0x19')](function(_0xc9766b){if(_0xc9766b){return _0xc9766b[_0x7fc8('0x4d')](_0x329168['body'][_0x7fc8('0x39')],_[_0x7fc8('0x3a')](_0x329168[_0x7fc8('0x36')],[_0x7fc8('0x39'),'id'])||{})['spread'](function(){return db['Tag'][_0x7fc8('0x23')]({'attributes':['id','name','color'],'where':{'id':_0x329168['body'][_0x7fc8('0x39')]}});})['then'](function(_0x3fdf37){socket[_0x7fc8('0x4e')](_0x7fc8('0x4f'),{'id':Number(_0x329168[_0x7fc8('0x2a')]['id']),'tags':_0x3fdf37||[]});return{'id':Number(_0x329168[_0x7fc8('0x2a')]['id']),'tags':_0x3fdf37||[]};});}})[_0x7fc8('0x19')](respondWithResult(_0x5fe267,null))[_0x7fc8('0x35')](handleError(_0x5fe267,null));};exports[_0x7fc8('0x50')]=function(_0x4d7645,_0x1fa4d1){return db[_0x7fc8('0x20')][_0x7fc8('0x34')]({'where':{'id':_0x4d7645[_0x7fc8('0x2a')]['id']}})[_0x7fc8('0x19')](handleEntityNotFound(_0x1fa4d1,null))[_0x7fc8('0x19')](function(_0x447725){if(_0x447725){return _0x447725[_0x7fc8('0x50')](_0x4d7645[_0x7fc8('0x25')][_0x7fc8('0x39')]);}})[_0x7fc8('0x19')](respondWithStatusCode(_0x1fa4d1,null))[_0x7fc8('0x35')](handleError(_0x1fa4d1,null));};exports[_0x7fc8('0x51')]=function(_0x441abc,_0x3beee5){var _0x53d07d=moment()[_0x7fc8('0x52')]()[_0x7fc8('0x53')]();var _0x3f53e5=path['join'](config[_0x7fc8('0x54')],_0x7fc8('0x55'),_0x7fc8('0x56'),_0x7fc8('0x57'));var _0x562840=path[_0x7fc8('0x58')](config[_0x7fc8('0x54')],_0x7fc8('0x55'),'files',_0x7fc8('0x59'));var _0x49c037=path[_0x7fc8('0x58')](_0x3f53e5,_0x53d07d);var _0xc8d333=util[_0x7fc8('0x4a')]('transcript-%d-%s.zip',_0x441abc[_0x7fc8('0x2a')]['id'],_0x53d07d);var _0x3cd135=path[_0x7fc8('0x58')](_0x3f53e5,_0xc8d333);var _0x38624a=[];_0x38624a['push']({'model':db['User'],'as':'User','attributes':['id',_0x7fc8('0x5a')],'raw':!![]});_0x38624a['push']({'model':db[_0x7fc8('0x5b')],'as':_0x7fc8('0x5c'),'attributes':['id','firstName',_0x7fc8('0x5d')],'raw':!![]});if(_0x441abc[_0x7fc8('0x25')][_0x7fc8('0x59')]){_0x38624a[_0x7fc8('0x5e')]({'model':db[_0x7fc8('0x5f')],'as':_0x7fc8('0x5f'),'raw':!![]});}var _0x517c55=[{'model':db['OpenchannelMessage'],'as':_0x7fc8('0x60'),'attributes':['id','body',_0x7fc8('0x61'),'direction',_0x7fc8('0x62'),'read'],'include':_0x38624a}];_0x517c55[_0x7fc8('0x5e')]({'model':db[_0x7fc8('0x63')],'as':_0x7fc8('0x64'),'attributes':['id','name']});_0x517c55[_0x7fc8('0x5e')]({'model':db[_0x7fc8('0x65')],'as':_0x7fc8('0x66'),'attributes':['id',_0x7fc8('0x5a')]});return db['OpenchannelInteraction'][_0x7fc8('0x34')]({'where':{'id':_0x441abc[_0x7fc8('0x2a')]['id']},'include':_0x517c55})[_0x7fc8('0x19')](handleEntityNotFound(_0x3beee5,null))[_0x7fc8('0x19')](function(_0x309e88){if(_0x309e88){var _0x5e2c46=_0x309e88[_0x7fc8('0x67')]({'plain':!![]});fs[_0x7fc8('0x68')](_0x49c037);var _0x39ecd1={'channel':_0x7fc8('0x69'),'account':_0x5e2c46['Account'][_0x7fc8('0x1c')],'agent':_0x5e2c46['Owner']?_0x5e2c46[_0x7fc8('0x66')]['fullname']:_0x7fc8('0x6a'),'createdAt':moment(_0x5e2c46[_0x7fc8('0x61')])[_0x7fc8('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7fc8('0x53')](),'closedAt':_0x5e2c46[_0x7fc8('0x6b')]?moment(_0x5e2c46[_0x7fc8('0x6c')])['format'](_0x7fc8('0x6d'))['toString']():'','disposition':_0x5e2c46[_0x7fc8('0x6e')],'visibility':_0x5e2c46['threadId']?_0x7fc8('0x6f'):_0x7fc8('0x70'),'messages':_(_0x5e2c46[_0x7fc8('0x60')])[_0x7fc8('0x46')]({'secret':![]})['map'](function(_0x1507fa){if(_0x1507fa[_0x7fc8('0x5f')]){var _0xa43e7a=path[_0x7fc8('0x58')](_0x562840,_0x1507fa['Attachment'][_0x7fc8('0x71')]);if(fs['existsSync'](_0xa43e7a)){fs[_0x7fc8('0x72')](_0xa43e7a)['pipe'](fs['createWriteStream'](path[_0x7fc8('0x58')](_0x49c037,_0x1507fa[_0x7fc8('0x5f')]['basename'])));}}return{'date':moment(_0x1507fa['createdAt'])[_0x7fc8('0x4a')](_0x7fc8('0x6d'))[_0x7fc8('0x53')](),'sender':_0x1507fa[_0x7fc8('0x73')]===_0x7fc8('0x74')?_0x1507fa[_0x7fc8('0x65')]?_0x1507fa[_0x7fc8('0x65')][_0x7fc8('0x5a')]:_0x7fc8('0x75'):_0x1507fa[_0x7fc8('0x5c')]['firstName']+(_0x1507fa[_0x7fc8('0x5c')]['lastName']?'\x20'+_0x1507fa[_0x7fc8('0x5c')][_0x7fc8('0x5d')]:''),'body':_0x1507fa[_0x7fc8('0x5f')]?_0x1507fa[_0x7fc8('0x5f')][_0x7fc8('0x71')]:_0x1507fa['body'],'direction':_0x1507fa['direction']===_0x7fc8('0x74')?'A':'C','secret':_0x1507fa[_0x7fc8('0x62')],'read':_0x1507fa[_0x7fc8('0x76')],'attachment':_0x1507fa[_0x7fc8('0x5f')]};})[_0x7fc8('0x77')]()};return ejs[_0x7fc8('0x78')](path[_0x7fc8('0x58')](config[_0x7fc8('0x54')],_0x7fc8('0x55'),_0x7fc8('0x79'),_0x7fc8('0x7a')),{'interaction':_0x39ecd1})[_0x7fc8('0x19')](function(_0x201b0a){var _0x2b8bd0=path[_0x7fc8('0x58')](_0x49c037,_0x7fc8('0x7b')+_0x5e2c46['id']+'-'+_0x53d07d+_0x7fc8('0x7c'));var _0x395c12={'path':_0x2b8bd0,'channel':_0x7fc8('0x69'),'interactionId':_0x5e2c46['id']};return pdf[_0x7fc8('0x7d')](_0x201b0a,_0x395c12);})[_0x7fc8('0x19')](function(){return new Promise(function(_0x3c7f19,_0x13a684){zipdir(_0x49c037,{'saveTo':_0x3cd135},function(_0x47d828,_0xcdebac){if(_0x47d828)return _0x13a684(_0x47d828);return _0x3c7f19(_0xcdebac);});})[_0x7fc8('0x19')](function(){return new Promise(function(_0xb43bee,_0x4d58d3){rimraf(_0x49c037,function(_0x1a5ef1){if(_0x1a5ef1)_0x4d58d3(_0x1a5ef1);return _0xb43bee();});});})[_0x7fc8('0x19')](function(){return _0x3beee5[_0x7fc8('0x51')](_0x3cd135,_0xc8d333,function(_0x4fc91c){if(_0x4fc91c){logger[_0x7fc8('0x7e')](_0x7fc8('0x7f'),_0x4fc91c);}else{fs[_0x7fc8('0x80')](_0x3cd135);}});});});}else{return _0x3beee5['sendStatus'](0xc8);}})[_0x7fc8('0x35')](handleError(_0x3beee5,null));}; \ No newline at end of file +var _0xa2f8=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','index','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','from','params','keys','OpenchannelInteraction','rawAttributes','model','attributes','intersection','fields','length','includeAll','include','options','find','create','body','update','describe','addMessage','ids','omit','getMessages','nolimit','order','sort','where','filters','pick','OpenchannelInteractionId','merge','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','addTags','setTags','Tag','color','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','root','attachments','push','User','fullname','CmContact','Contact','Attachment','Messages','direction','secret','read','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','createdAt','toString','closedAt','disposition','Public','Private','basename','createReadStream','pipe','createWriteStream','out','System','firstName','lastName','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa2f8,0x71));var _0x8a2f=function(_0x4c6fb5,_0x32c84b){_0x4c6fb5=_0x4c6fb5-0x0;var _0x2d42b2=_0xa2f8[_0x4c6fb5];return _0x2d42b2;};'use strict';var rimraf=require(_0x8a2f('0x0'));var zipdir=require(_0x8a2f('0x1'));var moment=require('moment');var util=require(_0x8a2f('0x2'));var path=require('path');var ejs=require(_0x8a2f('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x8a2f('0x4'));var interaction=require(_0x8a2f('0x5'));var qs=require(_0x8a2f('0x6'));var pdf=require(_0x8a2f('0x7'));var logger=require(_0x8a2f('0x8'))(_0x8a2f('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x8a2f('0xa')]=_[_0x8a2f('0xb')](config[_0x8a2f('0xa')],{'host':_0x8a2f('0xc'),'port':0x18eb});var socket=require(_0x8a2f('0xd'))(new Redis(config['redis']));require(_0x8a2f('0xe'))['register'](socket);function respondWithStatusCode(_0x31ad9d,_0x28d04c){_0x28d04c=_0x28d04c||0xcc;return function(_0x47bfa2){if(_0x47bfa2){return _0x31ad9d[_0x8a2f('0xf')](_0x28d04c);}return _0x31ad9d[_0x8a2f('0x10')](_0x28d04c)[_0x8a2f('0x11')]();};}function respondWithResult(_0x1237f2,_0x5392cb){_0x5392cb=_0x5392cb||0xc8;return function(_0x7ab74d){if(_0x7ab74d){return _0x1237f2['status'](_0x5392cb)[_0x8a2f('0x12')](_0x7ab74d);}};}function respondWithFilteredResult(_0x3a9f39,_0x20ff70){return function(_0x4e11e2){if(_0x4e11e2){var _0x33c99a=typeof _0x20ff70[_0x8a2f('0x13')]===_0x8a2f('0x14')&&typeof _0x20ff70[_0x8a2f('0x15')]==='undefined';var _0x664cac=_0x4e11e2[_0x8a2f('0x16')];var _0x4d1426=_0x33c99a?0x0:_0x20ff70['offset'];var _0x5d3233=_0x33c99a?_0x4e11e2[_0x8a2f('0x16')]:_0x20ff70[_0x8a2f('0x13')]+_0x20ff70[_0x8a2f('0x15')];var _0x1e761f;if(_0x5d3233>=_0x664cac){_0x5d3233=_0x664cac;_0x1e761f=0xc8;}else{_0x1e761f=0xce;}_0x3a9f39[_0x8a2f('0x10')](_0x1e761f);return _0x3a9f39[_0x8a2f('0x17')](_0x8a2f('0x18'),_0x4d1426+'-'+_0x5d3233+'/'+_0x664cac)[_0x8a2f('0x12')](_0x4e11e2);}return null;};}function saveUpdates(_0x1eb868){return function(_0x18aec6){if(_0x18aec6){return _0x18aec6['update'](_0x1eb868)[_0x8a2f('0x19')](function(_0x36cc41){return _0x36cc41;});}return null;};}function removeEntity(_0x3d645a){return function(_0x93c08a){if(_0x93c08a){return _0x93c08a[_0x8a2f('0x1a')]()[_0x8a2f('0x19')](function(){_0x3d645a[_0x8a2f('0x10')](0xcc)[_0x8a2f('0x11')]();});}};}function handleEntityNotFound(_0xc9005){return function(_0x3791a9){if(!_0x3791a9){_0xc9005['sendStatus'](0x194);}return _0x3791a9;};}function handleError(_0x356f14,_0x2a4a6a){_0x2a4a6a=_0x2a4a6a||0x1f4;return function(_0x91c89f){logger[_0x8a2f('0x1b')](_0x91c89f[_0x8a2f('0x1c')]);if(_0x91c89f[_0x8a2f('0x1d')]){delete _0x91c89f['name'];}_0x356f14[_0x8a2f('0x10')](_0x2a4a6a)[_0x8a2f('0x1e')](_0x91c89f);};}exports[_0x8a2f('0x1f')]=function(_0x57ca58,_0x5d2c91){var _0x3a9e6f={};var _0x433129=_['map'](db['OpenchannelInteraction']['rawAttributes'],function(_0x42d218){return{'name':_0x42d218[_0x8a2f('0x20')],'type':_0x42d218[_0x8a2f('0x21')][_0x8a2f('0x22')]};});_0x3a9e6f=qs[_0x8a2f('0x23')](_0x433129,_0x57ca58);return interaction[_0x8a2f('0x24')](_0x8a2f('0x25'),_0x57ca58[_0x8a2f('0x26')],_0x57ca58[_0x8a2f('0x27')],_0x3a9e6f,_0x433129)[_0x8a2f('0x19')](respondWithFilteredResult(_0x5d2c91,_0x3a9e6f))[_0x8a2f('0x28')](handleError(_0x5d2c91,null));};exports['show']=function(_0x45c7e5,_0xde614a){var _0x48e236={};if(_0x45c7e5[_0x8a2f('0x26')]['type']&&_0x45c7e5[_0x8a2f('0x26')]['type']===_0x8a2f('0x29')){_0x48e236[_0x8a2f('0x29')]=_0x45c7e5[_0x8a2f('0x2a')]['id'];}else{_0x48e236['id']=_0x45c7e5[_0x8a2f('0x2a')]['id'];}var _0x16f981={'raw':![],'where':_0x48e236},_0x3ff13a={};_0x3ff13a['model']=_[_0x8a2f('0x2b')](db[_0x8a2f('0x2c')][_0x8a2f('0x2d')]);_0x3ff13a[_0x8a2f('0x26')]=_['keys'](_0x45c7e5[_0x8a2f('0x26')]);_0x3ff13a['filters']=_['intersection'](_0x3ff13a[_0x8a2f('0x2e')],_0x3ff13a['query']);_0x16f981[_0x8a2f('0x2f')]=_[_0x8a2f('0x30')](_0x3ff13a[_0x8a2f('0x2e')],qs['fields'](_0x45c7e5[_0x8a2f('0x26')][_0x8a2f('0x31')]));_0x16f981[_0x8a2f('0x2f')]=_0x16f981['attributes'][_0x8a2f('0x32')]?_0x16f981['attributes']:_0x3ff13a[_0x8a2f('0x2e')];if(_0x45c7e5[_0x8a2f('0x26')][_0x8a2f('0x33')]){_0x16f981[_0x8a2f('0x34')]=[{'all':!![]}];}_0x16f981=_['merge']({},_0x16f981,_0x45c7e5[_0x8a2f('0x35')]);return db[_0x8a2f('0x2c')][_0x8a2f('0x36')](_0x16f981)[_0x8a2f('0x19')](handleEntityNotFound(_0xde614a,null))[_0x8a2f('0x19')](respondWithResult(_0xde614a,null))[_0x8a2f('0x28')](handleError(_0xde614a,null));};exports[_0x8a2f('0x37')]=function(_0x3d366c,_0x311f98){return db['OpenchannelInteraction']['create'](_0x3d366c[_0x8a2f('0x38')],{})['then'](respondWithResult(_0x311f98,0xc9))[_0x8a2f('0x28')](handleError(_0x311f98,null));};exports[_0x8a2f('0x39')]=function(_0x34ad40,_0x314cfc){if(_0x34ad40[_0x8a2f('0x38')]['id']){delete _0x34ad40[_0x8a2f('0x38')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x34ad40[_0x8a2f('0x2a')]['id']}})[_0x8a2f('0x19')](handleEntityNotFound(_0x314cfc,null))[_0x8a2f('0x19')](saveUpdates(_0x34ad40[_0x8a2f('0x38')],null))['then'](respondWithResult(_0x314cfc,null))[_0x8a2f('0x28')](handleError(_0x314cfc,null));};exports[_0x8a2f('0x1a')]=function(_0x8d5012,_0xf8c27){return db[_0x8a2f('0x2c')][_0x8a2f('0x36')]({'where':{'id':_0x8d5012[_0x8a2f('0x2a')]['id']}})[_0x8a2f('0x19')](handleEntityNotFound(_0xf8c27,null))[_0x8a2f('0x19')](removeEntity(_0xf8c27,null))[_0x8a2f('0x28')](handleError(_0xf8c27,null));};exports[_0x8a2f('0x3a')]=function(_0x35cabc,_0x3271c7){return db[_0x8a2f('0x2c')]['describe']()[_0x8a2f('0x19')](respondWithResult(_0x3271c7,null))[_0x8a2f('0x28')](handleError(_0x3271c7,null));};exports['addMessage']=function(_0x2c9bc3,_0x271a40){return db['OpenchannelMessage'][_0x8a2f('0x36')]({'where':{'id':_0x2c9bc3[_0x8a2f('0x2a')]['id']}})[_0x8a2f('0x19')](handleEntityNotFound(_0x271a40,null))[_0x8a2f('0x19')](function(_0x38540b){if(_0x38540b){return _0x38540b[_0x8a2f('0x3b')](_0x2c9bc3[_0x8a2f('0x38')][_0x8a2f('0x3c')],_[_0x8a2f('0x3d')](_0x2c9bc3[_0x8a2f('0x38')],['ids','id'])||{});}})[_0x8a2f('0x19')](respondWithResult(_0x271a40,null))[_0x8a2f('0x28')](handleError(_0x271a40,null));};exports[_0x8a2f('0x3e')]=function(_0x17561e,_0x17036a){var _0xdb5026={'raw':![],'where':{}};var _0x273347={};var _0xe35ea4={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x17561e['params']['id']}})[_0x8a2f('0x19')](handleEntityNotFound(_0x17036a,null))[_0x8a2f('0x19')](function(_0x4ce14e){if(_0x4ce14e){_0x273347['model']=_[_0x8a2f('0x2b')](db['OpenchannelMessage'][_0x8a2f('0x2d')]);_0x273347[_0x8a2f('0x26')]=_[_0x8a2f('0x2b')](_0x17561e[_0x8a2f('0x26')]);_0x273347['filters']=_['intersection'](_0x273347['model'],_0x273347[_0x8a2f('0x26')]);_0xdb5026[_0x8a2f('0x2f')]=_[_0x8a2f('0x30')](_0x273347['model'],qs['fields'](_0x17561e[_0x8a2f('0x26')]['fields']));_0xdb5026['attributes']=_0xdb5026[_0x8a2f('0x2f')]['length']?_0xdb5026[_0x8a2f('0x2f')]:_0x273347['model'];if(!_0x17561e[_0x8a2f('0x26')]['hasOwnProperty'](_0x8a2f('0x3f'))){_0xdb5026[_0x8a2f('0x15')]=qs[_0x8a2f('0x15')](_0x17561e[_0x8a2f('0x26')][_0x8a2f('0x15')]);_0xdb5026[_0x8a2f('0x13')]=qs[_0x8a2f('0x13')](_0x17561e['query'][_0x8a2f('0x13')]);}_0xdb5026[_0x8a2f('0x40')]=qs[_0x8a2f('0x41')](_0x17561e[_0x8a2f('0x26')][_0x8a2f('0x41')]);_0xdb5026[_0x8a2f('0x42')]=qs[_0x8a2f('0x43')](_[_0x8a2f('0x44')](_0x17561e[_0x8a2f('0x26')],_0x273347['filters']));_0xdb5026[_0x8a2f('0x42')][_0x8a2f('0x45')]=_0x4ce14e['id'];if(_0x17561e['query']['filter']){_0xdb5026[_0x8a2f('0x42')]=_[_0x8a2f('0x46')](_0xdb5026[_0x8a2f('0x42')],{'$or':_[_0x8a2f('0x47')](_0xdb5026[_0x8a2f('0x2f')],function(_0x33a9ff){var _0x737454={};_0x737454[_0x33a9ff]={'$like':'%'+_0x17561e['query'][_0x8a2f('0x48')]+'%'};return _0x737454;})});}if(_0x17561e['query']['$gte']){var _0x500587=_0x17561e[_0x8a2f('0x26')][_0x8a2f('0x49')][_0x8a2f('0x4a')](',');var _0x4518f6={};_0x4518f6[_0x500587[0x0]]={'$gte':moment(_0x500587[0x1])[_0x8a2f('0x4b')](_0x8a2f('0x4c'))};_0xdb5026[_0x8a2f('0x42')]=_['merge'](_0xdb5026[_0x8a2f('0x42')],_0x4518f6);}_0xdb5026=_[_0x8a2f('0x46')]({},_0xdb5026,_0x17561e['options']);return db[_0x8a2f('0x4d')]['count']({'where':_0xdb5026[_0x8a2f('0x42')]})[_0x8a2f('0x19')](function(_0x3541bd){_0xe35ea4[_0x8a2f('0x16')]=_0x3541bd;if(_0x17561e[_0x8a2f('0x26')][_0x8a2f('0x33')]){_0xdb5026[_0x8a2f('0x34')]=[{'all':!![]}];}return db[_0x8a2f('0x4d')][_0x8a2f('0x24')](_0xdb5026);})[_0x8a2f('0x19')](function(_0x2f6746){_0xe35ea4['rows']=_0x2f6746;return _0xe35ea4;});}})[_0x8a2f('0x19')](respondWithFilteredResult(_0x17036a,_0xdb5026))['catch'](handleError(_0x17036a,null));};exports[_0x8a2f('0x4e')]=function(_0x51f174,_0x3f54f6){return db[_0x8a2f('0x2c')][_0x8a2f('0x36')]({'where':{'id':_0x51f174[_0x8a2f('0x2a')]['id']}})[_0x8a2f('0x19')](handleEntityNotFound(_0x3f54f6,null))[_0x8a2f('0x19')](function(_0x437e59){if(_0x437e59){return _0x437e59[_0x8a2f('0x4f')](_0x51f174['body'][_0x8a2f('0x3c')],_['omit'](_0x51f174[_0x8a2f('0x38')],[_0x8a2f('0x3c'),'id'])||{})['spread'](function(){return db[_0x8a2f('0x50')][_0x8a2f('0x24')]({'attributes':['id',_0x8a2f('0x1d'),_0x8a2f('0x51')],'where':{'id':_0x51f174[_0x8a2f('0x38')][_0x8a2f('0x3c')]}});})[_0x8a2f('0x19')](function(_0x332544){socket['emit'](_0x8a2f('0x52'),{'id':Number(_0x51f174[_0x8a2f('0x2a')]['id']),'tags':_0x332544||[]});return{'id':Number(_0x51f174[_0x8a2f('0x2a')]['id']),'tags':_0x332544||[]};});}})['then'](respondWithResult(_0x3f54f6,null))[_0x8a2f('0x28')](handleError(_0x3f54f6,null));};exports[_0x8a2f('0x53')]=function(_0x17d813,_0x9903a5){return db[_0x8a2f('0x2c')][_0x8a2f('0x36')]({'where':{'id':_0x17d813[_0x8a2f('0x2a')]['id']}})[_0x8a2f('0x19')](handleEntityNotFound(_0x9903a5,null))[_0x8a2f('0x19')](function(_0x25996c){if(_0x25996c){return _0x25996c[_0x8a2f('0x53')](_0x17d813[_0x8a2f('0x26')][_0x8a2f('0x3c')]);}})[_0x8a2f('0x19')](respondWithStatusCode(_0x9903a5,null))[_0x8a2f('0x28')](handleError(_0x9903a5,null));};exports[_0x8a2f('0x54')]=function(_0x4abd9d,_0x4f638b){var _0x4f3e59=moment()[_0x8a2f('0x55')]()['toString']();var _0x5b74c9=path[_0x8a2f('0x56')](config['root'],_0x8a2f('0x57'),_0x8a2f('0x58'),'tmp');var _0x1fcb12=path[_0x8a2f('0x56')](config[_0x8a2f('0x59')],'server',_0x8a2f('0x58'),_0x8a2f('0x5a'));var _0x5b07fa=path['join'](_0x5b74c9,_0x4f3e59);var _0x3b63a9=util['format']('transcript-%d-%s.zip',_0x4abd9d[_0x8a2f('0x2a')]['id'],_0x4f3e59);var _0x76c9e2=path[_0x8a2f('0x56')](_0x5b74c9,_0x3b63a9);var _0xa4e58a=[];_0xa4e58a[_0x8a2f('0x5b')]({'model':db[_0x8a2f('0x5c')],'as':_0x8a2f('0x5c'),'attributes':['id',_0x8a2f('0x5d')],'raw':!![]});_0xa4e58a['push']({'model':db[_0x8a2f('0x5e')],'as':_0x8a2f('0x5f'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x4abd9d[_0x8a2f('0x26')]['attachments']){_0xa4e58a['push']({'model':db[_0x8a2f('0x60')],'as':'Attachment','raw':!![]});}var _0x2a8294=[{'model':db[_0x8a2f('0x4d')],'as':_0x8a2f('0x61'),'attributes':['id',_0x8a2f('0x38'),'createdAt',_0x8a2f('0x62'),_0x8a2f('0x63'),_0x8a2f('0x64')],'include':_0xa4e58a}];_0x2a8294[_0x8a2f('0x5b')]({'model':db[_0x8a2f('0x65')],'as':_0x8a2f('0x66'),'attributes':['id',_0x8a2f('0x1d')]});_0x2a8294[_0x8a2f('0x5b')]({'model':db['User'],'as':_0x8a2f('0x67'),'attributes':['id',_0x8a2f('0x5d')]});return db['OpenchannelInteraction'][_0x8a2f('0x36')]({'where':{'id':_0x4abd9d[_0x8a2f('0x2a')]['id']},'include':_0x2a8294})[_0x8a2f('0x19')](handleEntityNotFound(_0x4f638b,null))['then'](function(_0x38f6ef){if(_0x38f6ef){var _0x478a8c=_0x38f6ef[_0x8a2f('0x68')]({'plain':!![]});fs['mkdirSync'](_0x5b07fa);var _0x2850fd={'channel':_0x8a2f('0x69'),'account':_0x478a8c[_0x8a2f('0x66')][_0x8a2f('0x1d')],'agent':_0x478a8c['Owner']?_0x478a8c['Owner'][_0x8a2f('0x5d')]:_0x8a2f('0x6a'),'createdAt':moment(_0x478a8c[_0x8a2f('0x6b')])[_0x8a2f('0x4b')](_0x8a2f('0x4c'))[_0x8a2f('0x6c')](),'closedAt':_0x478a8c['closed']?moment(_0x478a8c[_0x8a2f('0x6d')])[_0x8a2f('0x4b')](_0x8a2f('0x4c'))[_0x8a2f('0x6c')]():'','disposition':_0x478a8c[_0x8a2f('0x6e')],'visibility':_0x478a8c['threadId']?_0x8a2f('0x6f'):_0x8a2f('0x70'),'messages':_(_0x478a8c['Messages'])[_0x8a2f('0x48')]({'secret':![]})[_0x8a2f('0x47')](function(_0x1b3977){if(_0x1b3977[_0x8a2f('0x60')]){var _0x5c3a30=path['join'](_0x1fcb12,_0x1b3977['Attachment'][_0x8a2f('0x71')]);if(fs['existsSync'](_0x5c3a30)){fs[_0x8a2f('0x72')](_0x5c3a30)[_0x8a2f('0x73')](fs[_0x8a2f('0x74')](path[_0x8a2f('0x56')](_0x5b07fa,_0x1b3977[_0x8a2f('0x60')]['basename'])));}}return{'date':moment(_0x1b3977[_0x8a2f('0x6b')])['format'](_0x8a2f('0x4c'))[_0x8a2f('0x6c')](),'sender':_0x1b3977['direction']===_0x8a2f('0x75')?_0x1b3977[_0x8a2f('0x5c')]?_0x1b3977[_0x8a2f('0x5c')]['fullname']:_0x8a2f('0x76'):_0x1b3977[_0x8a2f('0x5f')][_0x8a2f('0x77')]+(_0x1b3977[_0x8a2f('0x5f')][_0x8a2f('0x78')]?'\x20'+_0x1b3977[_0x8a2f('0x5f')]['lastName']:''),'body':_0x1b3977['Attachment']?_0x1b3977[_0x8a2f('0x60')]['basename']:_0x1b3977[_0x8a2f('0x38')],'direction':_0x1b3977['direction']==='out'?'A':'C','secret':_0x1b3977['secret'],'read':_0x1b3977[_0x8a2f('0x64')],'attachment':_0x1b3977[_0x8a2f('0x60')]};})[_0x8a2f('0x79')]()};return ejs[_0x8a2f('0x7a')](path['join'](config[_0x8a2f('0x59')],_0x8a2f('0x57'),_0x8a2f('0x7b'),_0x8a2f('0x7c')),{'interaction':_0x2850fd})[_0x8a2f('0x19')](function(_0xf87ac1){var _0x39eba7=path[_0x8a2f('0x56')](_0x5b07fa,'transcript-'+_0x478a8c['id']+'-'+_0x4f3e59+_0x8a2f('0x7d'));var _0x23e0e4={'path':_0x39eba7,'channel':_0x8a2f('0x69'),'interactionId':_0x478a8c['id']};return pdf[_0x8a2f('0x7e')](_0xf87ac1,_0x23e0e4);})[_0x8a2f('0x19')](function(){return new Promise(function(_0x4640b6,_0x10829a){zipdir(_0x5b07fa,{'saveTo':_0x76c9e2},function(_0x509afa,_0x20bfce){if(_0x509afa)return _0x10829a(_0x509afa);return _0x4640b6(_0x20bfce);});})['then'](function(){return new Promise(function(_0x26a2d4,_0x34cd64){rimraf(_0x5b07fa,function(_0x22c08e){if(_0x22c08e)_0x34cd64(_0x22c08e);return _0x26a2d4();});});})[_0x8a2f('0x19')](function(){return _0x4f638b['download'](_0x76c9e2,_0x3b63a9,function(_0xb566a9){if(_0xb566a9){logger[_0x8a2f('0x1b')](_0x8a2f('0x7f'),_0xb566a9);}else{fs['unlinkSync'](_0x76c9e2);}});});});}else{return _0x4f638b[_0x8a2f('0xf')](0xc8);}})['catch'](handleError(_0x4f638b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 04b7d56..499c6f9 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 _0xfc44=['hook','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfc44,0x1aa));var _0x4fc4=function(_0x399a22,_0x46261f){_0x399a22=_0x399a22-0x0;var _0x23af05=_0xfc44[_0x399a22];return _0x23af05;};'use strict';var EventEmitter=require(_0x4fc4('0x0'));var OpenchannelInteraction=require(_0x4fc4('0x1'))['db'][_0x4fc4('0x2')];var OpenchannelMessage=require(_0x4fc4('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4fc4('0x3')](0x0);var events={'afterCreate':_0x4fc4('0x4'),'afterUpdate':_0x4fc4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4fc09a){return function(_0x4f1303,_0x3b5cb0,_0x48c23d){_0x4f1303[_0x4fc4('0x6')]({'attributes':['id'],'raw':!![]})[_0x4fc4('0x7')](function(_0x1c5ce1){_0x4f1303[_0x4fc4('0x8')](_0x4fc4('0x9'),_0x1c5ce1[_0x4fc4('0xa')](function(_0x3c0296){return{'id':_0x3c0296['id']};}));return OpenchannelMessage[_0x4fc4('0xb')]({'where':{'OpenchannelInteractionId':_0x4f1303['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4fc4('0x7')](function(_0x42b387){_0x4f1303['setDataValue'](_0x4fc4('0xc'),_0x42b387[_0x4fc4('0xd')]);OpenchannelInteractionEvents[_0x4fc4('0xe')](_0x4fc09a+':'+_0x4f1303['id'],_0x4f1303);OpenchannelInteractionEvents['emit'](_0x4fc09a,_0x4f1303);_0x48c23d(null);})['catch'](_0x48c23d(null));};}for(var e in events){if(events[_0x4fc4('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x4fc4('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x635f=['exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','emit','hasOwnProperty','hook'];(function(_0x1dbc47,_0x249330){var _0x53ab78=function(_0x51cedd){while(--_0x51cedd){_0x1dbc47['push'](_0x1dbc47['shift']());}};_0x53ab78(++_0x249330);}(_0x635f,0xde));var _0xf635=function(_0x380968,_0x10dcc1){_0x380968=_0x380968-0x0;var _0x38a146=_0x635f[_0x380968];return _0x38a146;};'use strict';var EventEmitter=require(_0xf635('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xf635('0x1')];var OpenchannelMessage=require(_0xf635('0x2'))['db'][_0xf635('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf635('0x4')](0x0);var events={'afterCreate':_0xf635('0x5'),'afterUpdate':_0xf635('0x6'),'afterDestroy':'remove'};function emitEvent(_0x145172){return function(_0x105519,_0x4070f4,_0x1a1870){_0x105519[_0xf635('0x7')]({'attributes':['id'],'raw':!![]})[_0xf635('0x8')](function(_0x237f74){_0x105519[_0xf635('0x9')](_0xf635('0xa'),_0x237f74[_0xf635('0xb')](function(_0x33605a){return{'id':_0x33605a['id']};}));return OpenchannelMessage[_0xf635('0xc')]({'where':{'OpenchannelInteractionId':_0x105519['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf635('0x8')](function(_0x3c2972){_0x105519[_0xf635('0x9')]('unreadMessages',_0x3c2972['length']);OpenchannelInteractionEvents['emit'](_0x145172+':'+_0x105519['id'],_0x105519);OpenchannelInteractionEvents[_0xf635('0xd')](_0x145172,_0x105519);_0x1a1870(null);})['catch'](_0x1a1870(null));};}for(var e in events){if(events[_0xf635('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xf635('0xf')](e,emitEvent(event));}}module[_0xf635('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 55789d2..f5aea5d 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 _0x589e=['api','bluebird','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger'];(function(_0xa983c9,_0x12f0a5){var _0x54d4fa=function(_0x28be0e){while(--_0x28be0e){_0xa983c9['push'](_0xa983c9['shift']());}};_0x54d4fa(++_0x12f0a5);}(_0x589e,0x7e));var _0xe589=function(_0x57d3cf,_0x327774){_0x57d3cf=_0x57d3cf-0x0;var _0x2368ff=_0x589e[_0x57d3cf];return _0x2368ff;};'use strict';var _=require('lodash');var util=require(_0xe589('0x0'));var logger=require(_0xe589('0x1'))(_0xe589('0x2'));var moment=require('moment');var BPromise=require(_0xe589('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe589('0x4'));var config=require(_0xe589('0x5'));var attributes=require(_0xe589('0x6'));module[_0xe589('0x7')]=function(_0x4e4a9c,_0x3dee0f){return _0x4e4a9c[_0xe589('0x8')]('OpenchannelInteraction',attributes,{'tableName':_0xe589('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe589('0xa'),'collate':_0xe589('0xb'),'hooks':{'beforeUpdate':function(_0x3f1fc9,_0x16a3b2,_0x23a51b){if(_0x3f1fc9[_0xe589('0xc')]('closed')){_0x3f1fc9[_0xe589('0xd')]=moment()[_0xe589('0xe')](_0xe589('0xf'));}_0x23a51b(null,_0x3f1fc9);}}});}; \ No newline at end of file +var _0xed63=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','lodash','util'];(function(_0x20a0c9,_0x40eda4){var _0x56316d=function(_0x5b8370){while(--_0x5b8370){_0x20a0c9['push'](_0x20a0c9['shift']());}};_0x56316d(++_0x40eda4);}(_0xed63,0x154));var _0x3ed6=function(_0x527719,_0x4a6f2a){_0x527719=_0x527719-0x0;var _0x518cb4=_0xed63[_0x527719];return _0x518cb4;};'use strict';var _=require(_0x3ed6('0x0'));var util=require(_0x3ed6('0x1'));var logger=require(_0x3ed6('0x2'))(_0x3ed6('0x3'));var moment=require('moment');var BPromise=require(_0x3ed6('0x4'));var rp=require(_0x3ed6('0x5'));var fs=require('fs');var path=require(_0x3ed6('0x6'));var rimraf=require(_0x3ed6('0x7'));var config=require(_0x3ed6('0x8'));var attributes=require(_0x3ed6('0x9'));module['exports']=function(_0x59dc78,_0x1ebd97){return _0x59dc78[_0x3ed6('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0x3ed6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3ed6('0xc'),'collate':_0x3ed6('0xd'),'hooks':{'beforeUpdate':function(_0x9eab55,_0x454d59,_0x171bac){if(_0x9eab55[_0x3ed6('0xe')](_0x3ed6('0xf'))){_0x9eab55[_0x3ed6('0x10')]=moment()[_0x3ed6('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x171bac(null,_0x9eab55);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 2b7e0fc..bab142d 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 _0xe2b5=['stringify','error','code','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','limit','then','AddTagsToOpenchannelInteraction','find','addTags','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x5582a7,_0x4c88f6){var _0x533fc5=function(_0x3cfd19){while(--_0x3cfd19){_0x5582a7['push'](_0x5582a7['shift']());}};_0x533fc5(++_0x4c88f6);}(_0xe2b5,0xed));var _0x5e2b=function(_0x531b1e,_0x301978){_0x531b1e=_0x531b1e-0x0;var _0x1208b6=_0xe2b5[_0x531b1e];return _0x1208b6;};'use strict';var _=require(_0x5e2b('0x0'));var util=require(_0x5e2b('0x1'));var moment=require(_0x5e2b('0x2'));var BPromise=require(_0x5e2b('0x3'));var rs=require(_0x5e2b('0x4'));var fs=require('fs');var Redis=require(_0x5e2b('0x5'));var db=require(_0x5e2b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e2b('0x7'))(_0x5e2b('0x8'));var config=require(_0x5e2b('0x9'));var jayson=require(_0x5e2b('0xa'));var client=jayson[_0x5e2b('0xb')][_0x5e2b('0xc')]({'port':0x232a});config[_0x5e2b('0xd')]=_[_0x5e2b('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5e2b('0xf'))(new Redis(config[_0x5e2b('0xd')]));require('./openchannelInteraction.socket')[_0x5e2b('0x10')](socket);function respondWithRpcPromise(_0x47f0c0,_0x225e71,_0x1ccac3){return new BPromise(function(_0x404506,_0x1953c8){return client['request'](_0x47f0c0,_0x1ccac3)['then'](function(_0x48e504){logger['info'](_0x5e2b('0x11'),_0x225e71,_0x5e2b('0x12'));logger[_0x5e2b('0x13')](_0x5e2b('0x14'),_0x225e71,'request\x20sent',JSON[_0x5e2b('0x15')](_0x48e504));if(_0x48e504[_0x5e2b('0x16')]){if(_0x48e504['error'][_0x5e2b('0x17')]===0x1f4){logger[_0x5e2b('0x16')](_0x5e2b('0x11'),_0x225e71,_0x48e504[_0x5e2b('0x16')][_0x5e2b('0x18')]);return _0x1953c8(_0x48e504[_0x5e2b('0x16')][_0x5e2b('0x18')]);}logger[_0x5e2b('0x16')](_0x5e2b('0x11'),_0x225e71,_0x48e504[_0x5e2b('0x16')]['message']);return _0x404506(_0x48e504[_0x5e2b('0x16')][_0x5e2b('0x18')]);}else{logger[_0x5e2b('0x19')](_0x5e2b('0x11'),_0x225e71,'request\x20sent');_0x404506(_0x48e504[_0x5e2b('0x1a')][_0x5e2b('0x18')]);}})[_0x5e2b('0x1b')](function(_0x4077dc){logger[_0x5e2b('0x16')](_0x5e2b('0x11'),_0x225e71,_0x4077dc);_0x1953c8(_0x4077dc);});});}exports[_0x5e2b('0x1c')]=function(_0x198e20){var _0x2bc3e1=this;return new Promise(function(_0x178eb7,_0x583532){return db[_0x5e2b('0x1d')]['update'](_0x198e20[_0x5e2b('0x1e')],{'raw':_0x198e20[_0x5e2b('0x1f')]?_0x198e20[_0x5e2b('0x1f')][_0x5e2b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x198e20[_0x5e2b('0x1f')]?_0x198e20[_0x5e2b('0x1f')][_0x5e2b('0x21')]||null:null,'attributes':_0x198e20['options']?_0x198e20['options'][_0x5e2b('0x22')]||null:null,'limit':_0x198e20['options']?_0x198e20[_0x5e2b('0x1f')][_0x5e2b('0x23')]||null:null})[_0x5e2b('0x24')](function(_0x2a5e22){logger[_0x5e2b('0x19')](_0x5e2b('0x1c'),_0x198e20);logger[_0x5e2b('0x13')](_0x5e2b('0x1c'),_0x198e20,JSON[_0x5e2b('0x15')](_0x2a5e22));_0x178eb7(_0x2a5e22);})[_0x5e2b('0x1b')](function(_0x27b037){logger[_0x5e2b('0x16')](_0x5e2b('0x1c'),_0x27b037[_0x5e2b('0x18')],_0x198e20);_0x583532(_0x2bc3e1[_0x5e2b('0x16')](0x1f4,_0x27b037['message']));});});};exports[_0x5e2b('0x25')]=function(_0x1f7d39){return new Promise(function(_0x1fc443,_0xe43359){return db[_0x5e2b('0x1d')][_0x5e2b('0x26')]({'where':_0x1f7d39[_0x5e2b('0x1f')]?_0x1f7d39[_0x5e2b('0x1f')][_0x5e2b('0x21')]||null:null})[_0x5e2b('0x24')](function(_0x4741ba){if(_0x4741ba){return _0x4741ba[_0x5e2b('0x27')](_0x1f7d39['body']['ids'],_[_0x5e2b('0x28')](_0x1f7d39[_0x5e2b('0x1e')],['ids','id'])||{});}})[_0x5e2b('0x29')](function(_0x473d8d){logger[_0x5e2b('0x19')](_0x5e2b('0x2a'),_0x1f7d39);logger[_0x5e2b('0x13')](_0x5e2b('0x2a'),_0x1f7d39,JSON[_0x5e2b('0x15')](_0x473d8d));_0x1fc443(_0x473d8d);})[_0x5e2b('0x1b')](function(_0x120b63){logger[_0x5e2b('0x16')](_0x5e2b('0x2a'),_0x120b63['message'],_0x1f7d39);_0xe43359(_this['error'](0x1f4,_0x120b63['message']));});});}; \ No newline at end of file +var _0x46eb=['socket.io-emitter','register','request','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','limit','then','stringify','ids','omit','spread','AddTags','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x21f0f4,_0x16bcc8){var _0x43aec2=function(_0x162d66){while(--_0x162d66){_0x21f0f4['push'](_0x21f0f4['shift']());}};_0x43aec2(++_0x16bcc8);}(_0x46eb,0x18b));var _0xb46e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x46eb[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xb46e('0x0'));var moment=require(_0xb46e('0x1'));var BPromise=require(_0xb46e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb46e('0x3'))['db'];var utils=require(_0xb46e('0x4'));var logger=require(_0xb46e('0x5'))('rpc');var config=require(_0xb46e('0x6'));var jayson=require(_0xb46e('0x7'));var client=jayson[_0xb46e('0x8')]['http']({'port':0x232a});config[_0xb46e('0x9')]=_[_0xb46e('0xa')](config['redis'],{'host':_0xb46e('0xb'),'port':0x18eb});var socket=require(_0xb46e('0xc'))(new Redis(config[_0xb46e('0x9')]));require('./openchannelInteraction.socket')[_0xb46e('0xd')](socket);function respondWithRpcPromise(_0xe34d91,_0x2e571f,_0x5983d4){return new BPromise(function(_0x59f962,_0x3d060a){return client[_0xb46e('0xe')](_0xe34d91,_0x5983d4)['then'](function(_0x40e58f){logger['info'](_0xb46e('0xf'),_0x2e571f,_0xb46e('0x10'));logger[_0xb46e('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x2e571f,'request\x20sent',JSON['stringify'](_0x40e58f));if(_0x40e58f[_0xb46e('0x12')]){if(_0x40e58f[_0xb46e('0x12')][_0xb46e('0x13')]===0x1f4){logger['error'](_0xb46e('0xf'),_0x2e571f,_0x40e58f[_0xb46e('0x12')]['message']);return _0x3d060a(_0x40e58f[_0xb46e('0x12')][_0xb46e('0x14')]);}logger['error'](_0xb46e('0xf'),_0x2e571f,_0x40e58f[_0xb46e('0x12')][_0xb46e('0x14')]);return _0x59f962(_0x40e58f[_0xb46e('0x12')][_0xb46e('0x14')]);}else{logger[_0xb46e('0x15')](_0xb46e('0xf'),_0x2e571f,_0xb46e('0x10'));_0x59f962(_0x40e58f[_0xb46e('0x16')]['message']);}})['catch'](function(_0xf80e88){logger['error'](_0xb46e('0xf'),_0x2e571f,_0xf80e88);_0x3d060a(_0xf80e88);});});}exports[_0xb46e('0x17')]=function(_0x40ab65){var _0x477b7e=this;return new Promise(function(_0x53019d,_0x344f46){return db[_0xb46e('0x18')]['update'](_0x40ab65[_0xb46e('0x19')],{'raw':_0x40ab65[_0xb46e('0x1a')]?_0x40ab65[_0xb46e('0x1a')][_0xb46e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40ab65[_0xb46e('0x1a')]?_0x40ab65[_0xb46e('0x1a')][_0xb46e('0x1c')]||null:null,'attributes':_0x40ab65[_0xb46e('0x1a')]?_0x40ab65[_0xb46e('0x1a')][_0xb46e('0x1d')]||null:null,'limit':_0x40ab65[_0xb46e('0x1a')]?_0x40ab65['options'][_0xb46e('0x1e')]||null:null})[_0xb46e('0x1f')](function(_0x44fda5){logger[_0xb46e('0x15')](_0xb46e('0x17'),_0x40ab65);logger[_0xb46e('0x11')]('UpdateOpenchannelInteraction',_0x40ab65,JSON[_0xb46e('0x20')](_0x44fda5));_0x53019d(_0x44fda5);})['catch'](function(_0x5f449f){logger['error'](_0xb46e('0x17'),_0x5f449f[_0xb46e('0x14')],_0x40ab65);_0x344f46(_0x477b7e[_0xb46e('0x12')](0x1f4,_0x5f449f['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x567a21){return new Promise(function(_0x4fc6cc,_0x56285a){return db[_0xb46e('0x18')]['find']({'where':_0x567a21[_0xb46e('0x1a')]?_0x567a21['options'][_0xb46e('0x1c')]||null:null})[_0xb46e('0x1f')](function(_0x44e168){if(_0x44e168){return _0x44e168['addTags'](_0x567a21[_0xb46e('0x19')][_0xb46e('0x21')],_[_0xb46e('0x22')](_0x567a21[_0xb46e('0x19')],[_0xb46e('0x21'),'id'])||{});}})[_0xb46e('0x23')](function(_0x3ff2d2){logger[_0xb46e('0x15')](_0xb46e('0x24'),_0x567a21);logger[_0xb46e('0x11')](_0xb46e('0x24'),_0x567a21,JSON[_0xb46e('0x20')](_0x3ff2d2));_0x4fc6cc(_0x3ff2d2);})['catch'](function(_0x2479ea){logger[_0xb46e('0x12')](_0xb46e('0x24'),_0x2479ea[_0xb46e('0x14')],_0x567a21);_0x56285a(_this[_0xb46e('0x12')](0x1f4,_0x2479ea[_0xb46e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 137cedf..1cc1e1a 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 _0x457b=['length','openchannelInteraction:','./openchannelInteraction.events','update','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x457b,0x1e2));var _0xb457=function(_0x1233d2,_0x5efbb1){_0x1233d2=_0x1233d2-0x0;var _0x44af31=_0x457b[_0x1233d2];return _0x44af31;};'use strict';var OpenchannelInteractionEvents=require(_0xb457('0x0'));var events=['save','remove',_0xb457('0x1')];function createListener(_0x5b1074,_0x5b94df){return function(_0x4427bb){_0x5b94df['emit'](_0x5b1074,_0x4427bb);};}function removeListener(_0x2c579c,_0x430893){return function(){OpenchannelInteractionEvents[_0xb457('0x2')](_0x2c579c,_0x430893);};}exports[_0xb457('0x3')]=function(_0x411f5a){for(var _0x41571d=0x0,_0x40c6ac=events[_0xb457('0x4')];_0x41571d<_0x40c6ac;_0x41571d++){var _0x9f504f=events[_0x41571d];var _0x1626fd=createListener(_0xb457('0x5')+_0x9f504f,_0x411f5a);OpenchannelInteractionEvents['on'](_0x9f504f,_0x1626fd);}}; \ No newline at end of file +var _0x3bab=['update','emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','remove'];(function(_0xe37e3f,_0x2a3be6){var _0x189f83=function(_0x4033f1){while(--_0x4033f1){_0xe37e3f['push'](_0xe37e3f['shift']());}};_0x189f83(++_0x2a3be6);}(_0x3bab,0x83));var _0xb3ba=function(_0x5d7d0f,_0x77623d){_0x5d7d0f=_0x5d7d0f-0x0;var _0x1b1e77=_0x3bab[_0x5d7d0f];return _0x1b1e77;};'use strict';var OpenchannelInteractionEvents=require(_0xb3ba('0x0'));var events=['save',_0xb3ba('0x1'),_0xb3ba('0x2')];function createListener(_0x262492,_0x42ad73){return function(_0x541049){_0x42ad73[_0xb3ba('0x3')](_0x262492,_0x541049);};}function removeListener(_0x11249a,_0x1d3948){return function(){OpenchannelInteractionEvents[_0xb3ba('0x4')](_0x11249a,_0x1d3948);};}exports['register']=function(_0x47b774){for(var _0xf4086b=0x0,_0x2a959a=events[_0xb3ba('0x5')];_0xf4086b<_0x2a959a;_0xf4086b++){var _0x3a6052=events[_0xf4086b];var _0x457a2a=createListener(_0xb3ba('0x6')+_0x3a6052,_0x47b774);OpenchannelInteractionEvents['on'](_0x3a6052,_0x457a2a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 0e9b056..c96d5aa 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(_0x2bdad4,_0x374f36){var _0x52397a=function(_0x47f186){while(--_0x47f186){_0x2bdad4['push'](_0x2bdad4['shift']());}};_0x52397a(++_0x374f36);}(_0xe706,0xa3));var _0x6e70=function(_0x3cab38,_0x439e61){_0x3cab38=_0x3cab38-0x0;var _0x187d60=_0xe706[_0x3cab38];return _0x187d60;};'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(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./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 9cd0aaa..849360c 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 _0xbc9d=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x40b66c,_0x578758){var _0x2fd22b=function(_0x3b721b){while(--_0x3b721b){_0x40b66c['push'](_0x40b66c['shift']());}};_0x2fd22b(++_0x578758);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x2c180d,_0x4501f0){_0x2c180d=_0x2c180d-0x0;var _0x51fe51=_0xbc9d[_0x2c180d];return _0x51fe51;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'body':{'type':Sequelize[_0xdbc9('0x2')](_0xdbc9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdbc9('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xdbc9('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xdbc9('0x6')]},'providerName':{'type':Sequelize[_0xdbc9('0x7')]},'providerResponse':{'type':Sequelize[_0xdbc9('0x2')]}}; \ No newline at end of file +var _0x4b17=['STRING','sequelize','TEXT','BOOLEAN','out'];(function(_0x4d5fcf,_0x5ed693){var _0x2aa1a0=function(_0x4745a3){while(--_0x4745a3){_0x4d5fcf['push'](_0x4d5fcf['shift']());}};_0x2aa1a0(++_0x5ed693);}(_0x4b17,0x10f));var _0x74b1=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0x4b17[_0x53a7a8];return _0x555f71;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'body':{'type':Sequelize[_0x74b1('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x74b1('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x74b1('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x74b1('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x74b1('0x4')]},'providerResponse':{'type':Sequelize[_0x74b1('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 932a7e8..0a37705 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 _0x70e2=['manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','email','internal','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','client','http','request','then','request\x20sent','debug','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','end','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','update','describe','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname'];(function(_0x4312cf,_0x2ef01b){var _0x2d88fd=function(_0x46a207){while(--_0x46a207){_0x4312cf['push'](_0x4312cf['shift']());}};_0x2d88fd(++_0x2ef01b);}(_0x70e2,0x119));var _0x270e=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x70e2[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x270e('0x0'));var rimraf=require(_0x270e('0x1'));var zipdir=require(_0x270e('0x2'));var jsonpatch=require(_0x270e('0x3'));var rp=require(_0x270e('0x4'));var moment=require(_0x270e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x270e('0x6'));var util=require(_0x270e('0x7'));var path=require(_0x270e('0x8'));var sox=require(_0x270e('0x9'));var csv=require(_0x270e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x270e('0xb'));var _=require(_0x270e('0xc'));var squel=require(_0x270e('0xd'));var crypto=require(_0x270e('0xe'));var jsforce=require(_0x270e('0xf'));var deskjs=require(_0x270e('0x10'));var toCsv=require(_0x270e('0xa'));var querystring=require(_0x270e('0x11'));var Papa=require(_0x270e('0x12'));var Redis=require(_0x270e('0x13'));var authService=require(_0x270e('0x14'));var qs=require(_0x270e('0x15'));var as=require(_0x270e('0x16'));var hardwareService=require(_0x270e('0x17'));var logger=require(_0x270e('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x270e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x270e('0x1a'))['db'];config[_0x270e('0x1b')]=_['defaults'](config[_0x270e('0x1b')],{'host':_0x270e('0x1c'),'port':0x18eb});var socket=require(_0x270e('0x1d'))(new Redis(config['redis']));require(_0x270e('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x270e('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x270e('0x1f')][_0x270e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x49fbca,_0x3ccd08,_0x4ab29b,_0x34a7e1){return new BPromise(function(_0x2ffde3,_0x6d87da){var _0x4479cc=_0x34a7e1||client;return _0x4479cc[_0x270e('0x21')](_0x49fbca,_0x4ab29b)[_0x270e('0x22')](function(_0x691bde){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x3ccd08,_0x270e('0x23'));logger[_0x270e('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3ccd08,'request\x20sent',JSON[_0x270e('0x25')](_0x691bde));if(_0x691bde['error']){if(_0x691bde[_0x270e('0x26')][_0x270e('0x27')]===0x1f4){logger[_0x270e('0x26')](_0x270e('0x28'),_0x3ccd08,_0x691bde[_0x270e('0x26')][_0x270e('0x29')]);return _0x6d87da(_0x691bde[_0x270e('0x26')][_0x270e('0x29')]);}logger[_0x270e('0x26')](_0x270e('0x28'),_0x3ccd08,_0x691bde['error']['message']);return _0x2ffde3(_0x691bde[_0x270e('0x26')][_0x270e('0x29')]);}else{logger[_0x270e('0x2a')](_0x270e('0x28'),_0x3ccd08,_0x270e('0x23'));_0x2ffde3(_0x691bde[_0x270e('0x2b')][_0x270e('0x29')]);}})['catch'](function(_0x2747aa){logger['error'](_0x270e('0x28'),_0x3ccd08,_0x2747aa);_0x6d87da(_0x2747aa);});});}function respondWithStatusCode(_0x510912,_0x37fc56){_0x37fc56=_0x37fc56||0xcc;return function(_0x238c7a){if(_0x238c7a){return _0x510912[_0x270e('0x2c')](_0x37fc56);}return _0x510912[_0x270e('0x2d')](_0x37fc56)['end']();};}function respondWithResult(_0x3197bd,_0x113c55){_0x113c55=_0x113c55||0xc8;return function(_0x483919){if(_0x483919){return _0x3197bd[_0x270e('0x2d')](_0x113c55)[_0x270e('0x2e')](_0x483919);}};}function respondWithFilteredResult(_0x3ae22b,_0x28ed3e){return function(_0x4b716b){if(_0x4b716b){var _0x40dfbf=typeof _0x28ed3e[_0x270e('0x2f')]===_0x270e('0x30')&&typeof _0x28ed3e[_0x270e('0x31')]==='undefined';var _0x3bb9e7=_0x4b716b[_0x270e('0x32')];var _0x545352=_0x40dfbf?0x0:_0x28ed3e[_0x270e('0x2f')];var _0x2ec720=_0x40dfbf?_0x4b716b[_0x270e('0x32')]:_0x28ed3e[_0x270e('0x2f')]+_0x28ed3e['limit'];var _0x1e565c;if(_0x2ec720>=_0x3bb9e7){_0x2ec720=_0x3bb9e7;_0x1e565c=0xc8;}else{_0x1e565c=0xce;}_0x3ae22b['status'](_0x1e565c);return _0x3ae22b[_0x270e('0x33')]('Content-Range',_0x545352+'-'+_0x2ec720+'/'+_0x3bb9e7)[_0x270e('0x2e')](_0x4b716b);}return null;};}function patchUpdates(_0x3b0bf7){return function(_0x5cc52d){try{jsonpatch[_0x270e('0x34')](_0x5cc52d,_0x3b0bf7,!![]);}catch(_0x5b5a72){return BPromise[_0x270e('0x35')](_0x5b5a72);}return _0x5cc52d[_0x270e('0x36')]();};}function saveUpdates(_0x503db9,_0x5092e9){return function(_0x9695dc){if(_0x9695dc){return _0x9695dc['update'](_0x503db9)[_0x270e('0x22')](function(_0x2cb096){return _0x2cb096;});}return null;};}function removeEntity(_0x21c104,_0x2c4e28){return function(_0x36f8b5){if(_0x36f8b5){return _0x36f8b5[_0x270e('0x37')]()[_0x270e('0x22')](function(){_0x21c104[_0x270e('0x2d')](0xcc)[_0x270e('0x38')]();});}};}function handleEntityNotFound(_0x3fc6a5,_0x58ab7b){return function(_0x29476c){if(!_0x29476c){_0x3fc6a5[_0x270e('0x2c')](0x194);}return _0x29476c;};}function handleError(_0x1064be,_0x410b45){_0x410b45=_0x410b45||0x1f4;return function(_0x480773){logger[_0x270e('0x26')](_0x480773[_0x270e('0x39')]);if(_0x480773[_0x270e('0x3a')]){delete _0x480773['name'];}_0x1064be[_0x270e('0x2d')](_0x410b45)[_0x270e('0x3b')](_0x480773);};}exports['index']=function(_0x48189e,_0x1c6271){var _0x466eb1={},_0x5b0cd={},_0x432200={'count':0x0,'rows':[]};var _0x46771e=_[_0x270e('0x3c')](db[_0x270e('0x3d')][_0x270e('0x3e')],function(_0x5f2b1a){return{'name':_0x5f2b1a[_0x270e('0x3f')],'type':_0x5f2b1a[_0x270e('0x40')][_0x270e('0x41')]};});_0x5b0cd['model']=_[_0x270e('0x3c')](_0x46771e,_0x270e('0x3a'));_0x5b0cd['query']=_[_0x270e('0x42')](_0x48189e['query']);_0x5b0cd[_0x270e('0x43')]=_[_0x270e('0x44')](_0x5b0cd[_0x270e('0x45')],_0x5b0cd[_0x270e('0x46')]);_0x466eb1[_0x270e('0x47')]=_['intersection'](_0x5b0cd[_0x270e('0x45')],qs[_0x270e('0x48')](_0x48189e[_0x270e('0x46')][_0x270e('0x48')]));_0x466eb1[_0x270e('0x47')]=_0x466eb1[_0x270e('0x47')][_0x270e('0x49')]?_0x466eb1[_0x270e('0x47')]:_0x5b0cd[_0x270e('0x45')];if(!_0x48189e[_0x270e('0x46')][_0x270e('0x4a')]('nolimit')){_0x466eb1[_0x270e('0x31')]=qs[_0x270e('0x31')](_0x48189e[_0x270e('0x46')][_0x270e('0x31')]);_0x466eb1[_0x270e('0x2f')]=qs[_0x270e('0x2f')](_0x48189e[_0x270e('0x46')][_0x270e('0x2f')]);}_0x466eb1[_0x270e('0x4b')]=qs[_0x270e('0x4c')](_0x48189e['query'][_0x270e('0x4c')]);_0x466eb1[_0x270e('0x4d')]=qs[_0x270e('0x43')](_[_0x270e('0x4e')](_0x48189e[_0x270e('0x46')],_0x5b0cd[_0x270e('0x43')]),_0x46771e);if(_0x48189e['query'][_0x270e('0x4f')]){_0x466eb1[_0x270e('0x4d')]=_[_0x270e('0x50')](_0x466eb1[_0x270e('0x4d')],{'$or':_[_0x270e('0x3c')](_0x46771e,function(_0xa003dd){if(_0xa003dd['type']!=='VIRTUAL'){var _0xd488e={};_0xd488e[_0xa003dd['name']]={'$like':'%'+_0x48189e[_0x270e('0x46')][_0x270e('0x4f')]+'%'};return _0xd488e;}})});}_0x466eb1=_[_0x270e('0x50')]({},_0x466eb1,_0x48189e[_0x270e('0x51')]);var _0x1532df={'where':_0x466eb1[_0x270e('0x4d')]};return db[_0x270e('0x3d')][_0x270e('0x32')](_0x1532df)[_0x270e('0x22')](function(_0x81eff2){_0x432200[_0x270e('0x32')]=_0x81eff2;if(_0x48189e['query'][_0x270e('0x52')]){_0x466eb1[_0x270e('0x53')]=[{'all':!![]}];}return db[_0x270e('0x3d')][_0x270e('0x54')](_0x466eb1);})['then'](function(_0x392bfb){_0x432200['rows']=_0x392bfb;return _0x432200;})[_0x270e('0x22')](respondWithFilteredResult(_0x1c6271,_0x466eb1))[_0x270e('0x55')](handleError(_0x1c6271,null));};exports['show']=function(_0x4e9534,_0x4a4e96){var _0x34ed66={'raw':!![],'where':{'id':_0x4e9534[_0x270e('0x56')]['id']}},_0x156f8d={};_0x156f8d[_0x270e('0x45')]=_[_0x270e('0x42')](db[_0x270e('0x3d')][_0x270e('0x3e')]);_0x156f8d[_0x270e('0x46')]=_['keys'](_0x4e9534[_0x270e('0x46')]);_0x156f8d[_0x270e('0x43')]=_[_0x270e('0x44')](_0x156f8d[_0x270e('0x45')],_0x156f8d[_0x270e('0x46')]);_0x34ed66[_0x270e('0x47')]=_[_0x270e('0x44')](_0x156f8d[_0x270e('0x45')],qs[_0x270e('0x48')](_0x4e9534[_0x270e('0x46')][_0x270e('0x48')]));_0x34ed66['attributes']=_0x34ed66[_0x270e('0x47')][_0x270e('0x49')]?_0x34ed66[_0x270e('0x47')]:_0x156f8d['model'];if(_0x4e9534[_0x270e('0x46')][_0x270e('0x52')]){_0x34ed66['include']=[{'all':!![]}];}_0x34ed66=_[_0x270e('0x50')]({},_0x34ed66,_0x4e9534['options']);return db['OpenchannelMessage'][_0x270e('0x57')](_0x34ed66)[_0x270e('0x22')](handleEntityNotFound(_0x4a4e96,null))[_0x270e('0x22')](respondWithResult(_0x4a4e96,null))[_0x270e('0x55')](handleError(_0x4a4e96,null));};exports['create']=function(_0x5de83e,_0x7aa676){return db[_0x270e('0x3d')][_0x270e('0x58')](_0x5de83e[_0x270e('0x59')],{})[_0x270e('0x22')](respondWithResult(_0x7aa676,0xc9))[_0x270e('0x55')](handleError(_0x7aa676,null));};exports[_0x270e('0x5a')]=function(_0x42a15e,_0x1de1e8){if(_0x42a15e[_0x270e('0x59')]['id']){delete _0x42a15e['body']['id'];}return db['OpenchannelMessage'][_0x270e('0x57')]({'where':{'id':_0x42a15e[_0x270e('0x56')]['id']}})[_0x270e('0x22')](handleEntityNotFound(_0x1de1e8,null))[_0x270e('0x22')](saveUpdates(_0x42a15e[_0x270e('0x59')],null))[_0x270e('0x22')](respondWithResult(_0x1de1e8,null))[_0x270e('0x55')](handleError(_0x1de1e8,null));};exports[_0x270e('0x37')]=function(_0x12cd7b,_0xb22964){return db[_0x270e('0x3d')][_0x270e('0x57')]({'where':{'id':_0x12cd7b[_0x270e('0x56')]['id']}})['then'](handleEntityNotFound(_0xb22964,null))[_0x270e('0x22')](removeEntity(_0xb22964,null))[_0x270e('0x55')](handleError(_0xb22964,null));};exports[_0x270e('0x5b')]=function(_0x29369c,_0x50bf7f){return db['OpenchannelMessage'][_0x270e('0x5b')]()[_0x270e('0x22')](respondWithResult(_0x50bf7f,null))[_0x270e('0x55')](handleError(_0x50bf7f,null));};var interaction_log=require(_0x270e('0x18'))('openchannel-interactions');exports[_0x270e('0x5c')]=function(_0x399f91,_0x5862e6,_0xc78e0b){var _0xb4c406={'agent':{},'channel':_0x270e('0x5d')};if(_0x399f91['body']['id']){delete _0x399f91[_0x270e('0x59')]['id'];}_0x399f91[_0x270e('0x59')][_0x270e('0x5e')]=!![];_0x399f91['body'][_0x270e('0x5f')]=moment()['format'](_0x270e('0x60'));_0x399f91['body'][_0x270e('0x61')]=_0x399f91[_0x270e('0x59')][_0x270e('0x61')]||_0x399f91[_0x270e('0x62')]['id'];_0xb4c406[_0x270e('0x63')]['id']=_0x399f91[_0x270e('0x59')][_0x270e('0x61')];return db['OpenchannelMessage'][_0x270e('0x57')]({'where':{'id':_0x399f91['params']['id'],'UserId':null}})[_0x270e('0x22')](handleEntityNotFound(_0x5862e6,null))[_0x270e('0x22')](saveUpdates(_0x399f91[_0x270e('0x59')],null))[_0x270e('0x22')](function(_0x890779){if(_0x890779){_0xb4c406[_0x270e('0x29')]=_0x890779[_0x270e('0x64')]({'plain':!![]});return db[_0x270e('0x65')][_0x270e('0x57')]({'where':{'id':_0x890779[_0x270e('0x66')]}});}return null;})[_0x270e('0x22')](handleEntityNotFound(_0x5862e6,null))[_0x270e('0x22')](function(_0x3b3955){if(_0x3b3955){return _0x3b3955[_0x270e('0x5a')]({'UserId':_0x399f91[_0x270e('0x59')][_0x270e('0x61')],'read1stAt':_['isNil'](_0x3b3955[_0x270e('0x67')])?moment()[_0x270e('0x68')](_0x270e('0x60')):undefined});}return null;})[_0x270e('0x22')](function(_0x2d464c){if(_0x2d464c){_0xb4c406[_0x270e('0x69')]=_0x2d464c[_0x270e('0x64')]({'plain':!![]});interaction_log[_0x270e('0x2a')](_0x270e('0x6a'),_0x399f91[_0x270e('0x62')]['id'],_0x399f91[_0x270e('0x62')][_0x270e('0x3a')],_0x399f91[_0x270e('0x62')][_0x270e('0x6b')],_0xb4c406['interaction']['id'],_0x399f91['body']?JSON[_0x270e('0x25')](_0x399f91['body']):_0x270e('0x6c'));return respondWithRpcPromise(_0x270e('0x6d'),_0x270e('0x6e'),_0xb4c406);}return null;})[_0x270e('0x22')](function(_0x35fc73){var _0x535ef1=_0x270e('0x6f')+_0x35fc73['message']['ContactId'];return db[_0x270e('0x70')][_0x270e('0x46')](_0x535ef1,{'type':db[_0x270e('0x71')][_0x270e('0x72')][_0x270e('0x73')],'raw':!![]})[_0x270e('0x22')](function(_0x5a0cde){return _0x5a0cde;});})[_0x270e('0x22')](function(_0x2f451c){if(_0x2f451c){_0xb4c406[_0x270e('0x29')][_0x270e('0x74')]=_0x2f451c[0x0];if(!_0x399f91['body'][_0x270e('0x61')])return;return db['User'][_0x270e('0x57')]({'where':{'id':_0x399f91['body'][_0x270e('0x61')],'role':'agent'},'attributes':['id',_0x270e('0x3a'),_0x270e('0x75'),'email','internal'],'raw':!![]});}return null;})[_0x270e('0x22')](function(_0x23001d){if(!_0x23001d)return null;_0xb4c406['message'][_0x270e('0x63')]=_0x23001d;return _0xb4c406;})[_0x270e('0x22')](function(_0x151cf9){if(_0x151cf9){if(_0x399f91[_0x270e('0x59')][_0x270e('0x76')]){_0xb4c406[_0x270e('0x29')][_0x270e('0x77')]=util['format'](_0x270e('0x78'),_0x399f91[_0x270e('0x62')][_0x270e('0x3a')]);_0xb4c406[_0x270e('0x29')][_0x270e('0x79')]=_0xb4c406[_0x270e('0x79')];_0xb4c406[_0x270e('0x29')][_0x270e('0x7a')]=_0xb4c406[_0x270e('0x79')];_0xb4c406[_0x270e('0x29')][_0x270e('0x7b')]='accept';return respondWithRpcPromise('EventManager',_0x270e('0x7c'),{'event':_0x270e('0x7d'),'message':_0xb4c406['message']},client9002)['then'](function(){return _0xb4c406;});}return _0xb4c406;}return null;})[_0x270e('0x22')](respondWithResult(_0x5862e6,null))[_0x270e('0x55')](handleError(_0x5862e6,null));};var interaction_log=require('../../config/logger')(_0x270e('0x7e'));exports[_0x270e('0x35')]=function(_0x3cd782,_0x5a9f8b,_0x581068){var _0x2403ef={'agent':{},'channel':_0x270e('0x5d')};if(_0x3cd782[_0x270e('0x59')]['id']){delete _0x3cd782[_0x270e('0x59')]['id'];}_0x3cd782[_0x270e('0x59')][_0x270e('0x61')]=_0x3cd782[_0x270e('0x59')][_0x270e('0x61')]||_0x3cd782[_0x270e('0x62')]['id'];_0x2403ef[_0x270e('0x63')]['id']=_0x3cd782[_0x270e('0x59')][_0x270e('0x61')];return db['OpenchannelMessage'][_0x270e('0x57')]({'where':{'id':_0x3cd782[_0x270e('0x56')]['id'],'UserId':null}})[_0x270e('0x22')](handleEntityNotFound(_0x5a9f8b,null))[_0x270e('0x22')](function(_0x308650){if(_0x308650){_0x2403ef[_0x270e('0x29')]=_0x308650[_0x270e('0x64')]({'plain':!![]});return db[_0x270e('0x65')][_0x270e('0x57')]({'where':{'id':_0x308650[_0x270e('0x66')]}});}return null;})[_0x270e('0x22')](handleEntityNotFound(_0x5a9f8b,null))[_0x270e('0x22')](function(_0x125171){if(_0x125171){_0x2403ef[_0x270e('0x69')]=_0x125171[_0x270e('0x64')]({'plain':!![]});interaction_log['info'](_0x270e('0x7f'),_0x3cd782['user']['id'],_0x3cd782[_0x270e('0x62')][_0x270e('0x3a')],_0x3cd782['user'][_0x270e('0x6b')],_0x2403ef[_0x270e('0x69')]['id'],_0x3cd782[_0x270e('0x59')]?JSON[_0x270e('0x25')](_0x3cd782[_0x270e('0x59')]):_0x270e('0x6c'));return respondWithRpcPromise('RejectMessage',_0x270e('0x80'),_0x2403ef);}return null;})['then'](function(_0x289e9e){var _0x16306a=_0x270e('0x6f')+_0x289e9e[_0x270e('0x29')][_0x270e('0x81')];return db[_0x270e('0x70')][_0x270e('0x46')](_0x16306a,{'type':db['Sequelize'][_0x270e('0x72')][_0x270e('0x73')],'raw':!![]})['then'](function(_0x202d7){return _0x202d7;});})[_0x270e('0x22')](function(_0x3090e2){if(_0x3090e2){_0x2403ef[_0x270e('0x29')][_0x270e('0x74')]=_0x3090e2[0x0];if(!_0x3cd782[_0x270e('0x59')]['UserId'])return;return db['User'][_0x270e('0x57')]({'where':{'id':_0x3cd782[_0x270e('0x59')][_0x270e('0x61')],'role':_0x270e('0x63')},'attributes':['id','name',_0x270e('0x75'),_0x270e('0x82'),_0x270e('0x83')],'raw':!![]});}return null;})[_0x270e('0x22')](function(_0x5918e3){if(!_0x5918e3)return null;_0x2403ef[_0x270e('0x29')][_0x270e('0x63')]=_0x5918e3;return _0x2403ef;})[_0x270e('0x22')](function(_0x2ab800){if(_0x2ab800){_0x2ab800[_0x270e('0x29')][_0x270e('0x77')]=util['format'](_0x270e('0x78'),_0x3cd782[_0x270e('0x62')][_0x270e('0x3a')]);_0x2ab800[_0x270e('0x29')][_0x270e('0x79')]=_0x2403ef[_0x270e('0x79')];_0x2ab800[_0x270e('0x29')][_0x270e('0x7a')]=_0x2403ef[_0x270e('0x79')];_0x2ab800['message'][_0x270e('0x7b')]='reject';respondWithRpcPromise('EventManager',_0x270e('0x7c'),{'event':_0x270e('0x84'),'message':_0x2ab800['message']},client9002);return _0x2403ef;}return null;})[_0x270e('0x22')](respondWithResult(_0x5a9f8b,null))[_0x270e('0x55')](handleError(_0x5a9f8b,null));}; \ No newline at end of file +var _0x2a17=['format','interaction','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','email','internal','manual','interface','SIP/%s','channel','EventManager','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SELECT','motionChannel','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','http','request','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','status','end','limit','undefined','offset','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','find','create','body','params','describe','../../config/logger','openchannel-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x2a17,0x113));var _0x72a1=function(_0x20f475,_0x39b7bf){_0x20f475=_0x20f475-0x0;var _0x5936d9=_0x2a17[_0x20f475];return _0x5936d9;};'use strict';var emlformat=require(_0x72a1('0x0'));var rimraf=require(_0x72a1('0x1'));var zipdir=require(_0x72a1('0x2'));var jsonpatch=require(_0x72a1('0x3'));var rp=require(_0x72a1('0x4'));var moment=require(_0x72a1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x72a1('0x6'));var util=require(_0x72a1('0x7'));var path=require('path');var sox=require(_0x72a1('0x8'));var csv=require(_0x72a1('0x9'));var ejs=require(_0x72a1('0xa'));var fs=require('fs');var fs_extra=require(_0x72a1('0xb'));var _=require(_0x72a1('0xc'));var squel=require('squel');var crypto=require(_0x72a1('0xd'));var jsforce=require(_0x72a1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x72a1('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x72a1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x72a1('0x10'));var hardwareService=require(_0x72a1('0x11'));var logger=require('../../config/logger')(_0x72a1('0x12'));var utils=require(_0x72a1('0x13'));var config=require(_0x72a1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a1('0x15'))['db'];config[_0x72a1('0x16')]=_['defaults'](config[_0x72a1('0x16')],{'host':_0x72a1('0x17'),'port':0x18eb});var socket=require(_0x72a1('0x18'))(new Redis(config[_0x72a1('0x16')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x72a1('0x19'));var client=jayson['client'][_0x72a1('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0x72a1('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1da8c8,_0x263161,_0x4bb32b,_0x4e3705){return new BPromise(function(_0x41166f,_0x2f7b04){var _0x454b61=_0x4e3705||client;return _0x454b61[_0x72a1('0x1b')](_0x1da8c8,_0x4bb32b)['then'](function(_0x4ab1f6){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x263161,_0x72a1('0x1c'));logger[_0x72a1('0x1d')](_0x72a1('0x1e'),_0x263161,_0x72a1('0x1c'),JSON['stringify'](_0x4ab1f6));if(_0x4ab1f6['error']){if(_0x4ab1f6[_0x72a1('0x1f')][_0x72a1('0x20')]===0x1f4){logger[_0x72a1('0x1f')](_0x72a1('0x21'),_0x263161,_0x4ab1f6[_0x72a1('0x1f')]['message']);return _0x2f7b04(_0x4ab1f6[_0x72a1('0x1f')][_0x72a1('0x22')]);}logger[_0x72a1('0x1f')](_0x72a1('0x21'),_0x263161,_0x4ab1f6['error'][_0x72a1('0x22')]);return _0x41166f(_0x4ab1f6[_0x72a1('0x1f')][_0x72a1('0x22')]);}else{logger[_0x72a1('0x23')](_0x72a1('0x21'),_0x263161,_0x72a1('0x1c'));_0x41166f(_0x4ab1f6['result']['message']);}})['catch'](function(_0x250154){logger[_0x72a1('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x263161,_0x250154);_0x2f7b04(_0x250154);});});}function respondWithStatusCode(_0x3fc8a4,_0x2e5368){_0x2e5368=_0x2e5368||0xcc;return function(_0x5ab44d){if(_0x5ab44d){return _0x3fc8a4['sendStatus'](_0x2e5368);}return _0x3fc8a4[_0x72a1('0x24')](_0x2e5368)[_0x72a1('0x25')]();};}function respondWithResult(_0x16d35c,_0x543517){_0x543517=_0x543517||0xc8;return function(_0x5e9b12){if(_0x5e9b12){return _0x16d35c[_0x72a1('0x24')](_0x543517)['json'](_0x5e9b12);}};}function respondWithFilteredResult(_0x4edc37,_0x28331f){return function(_0x3df330){if(_0x3df330){var _0x31c5bb=typeof _0x28331f['offset']==='undefined'&&typeof _0x28331f[_0x72a1('0x26')]===_0x72a1('0x27');var _0x8cf17f=_0x3df330['count'];var _0x504f1d=_0x31c5bb?0x0:_0x28331f[_0x72a1('0x28')];var _0x93045b=_0x31c5bb?_0x3df330[_0x72a1('0x29')]:_0x28331f[_0x72a1('0x28')]+_0x28331f[_0x72a1('0x26')];var _0x10ef74;if(_0x93045b>=_0x8cf17f){_0x93045b=_0x8cf17f;_0x10ef74=0xc8;}else{_0x10ef74=0xce;}_0x4edc37[_0x72a1('0x24')](_0x10ef74);return _0x4edc37['set'](_0x72a1('0x2a'),_0x504f1d+'-'+_0x93045b+'/'+_0x8cf17f)[_0x72a1('0x2b')](_0x3df330);}return null;};}function patchUpdates(_0x580f16){return function(_0x4d771f){try{jsonpatch[_0x72a1('0x2c')](_0x4d771f,_0x580f16,!![]);}catch(_0x5477ba){return BPromise[_0x72a1('0x2d')](_0x5477ba);}return _0x4d771f[_0x72a1('0x2e')]();};}function saveUpdates(_0x171b06,_0x2fcaab){return function(_0x2f2e61){if(_0x2f2e61){return _0x2f2e61[_0x72a1('0x2f')](_0x171b06)[_0x72a1('0x30')](function(_0x229fd1){return _0x229fd1;});}return null;};}function removeEntity(_0x28e760,_0x4554d7){return function(_0x27f71b){if(_0x27f71b){return _0x27f71b[_0x72a1('0x31')]()['then'](function(){_0x28e760['status'](0xcc)[_0x72a1('0x25')]();});}};}function handleEntityNotFound(_0x394bb9,_0x328fe1){return function(_0x3b66e5){if(!_0x3b66e5){_0x394bb9[_0x72a1('0x32')](0x194);}return _0x3b66e5;};}function handleError(_0x358b4d,_0x41405d){_0x41405d=_0x41405d||0x1f4;return function(_0x5b5809){logger['error'](_0x5b5809[_0x72a1('0x33')]);if(_0x5b5809[_0x72a1('0x34')]){delete _0x5b5809['name'];}_0x358b4d[_0x72a1('0x24')](_0x41405d)[_0x72a1('0x35')](_0x5b5809);};}exports['index']=function(_0xa4de6c,_0x214e54){var _0x30851a={},_0x26512e={},_0x3191d6={'count':0x0,'rows':[]};var _0x55baf2=_[_0x72a1('0x36')](db[_0x72a1('0x37')][_0x72a1('0x38')],function(_0x17b93c){return{'name':_0x17b93c[_0x72a1('0x39')],'type':_0x17b93c['type']['key']};});_0x26512e[_0x72a1('0x3a')]=_[_0x72a1('0x36')](_0x55baf2,_0x72a1('0x34'));_0x26512e['query']=_[_0x72a1('0x3b')](_0xa4de6c[_0x72a1('0x3c')]);_0x26512e[_0x72a1('0x3d')]=_['intersection'](_0x26512e['model'],_0x26512e[_0x72a1('0x3c')]);_0x30851a[_0x72a1('0x3e')]=_[_0x72a1('0x3f')](_0x26512e[_0x72a1('0x3a')],qs[_0x72a1('0x40')](_0xa4de6c[_0x72a1('0x3c')][_0x72a1('0x40')]));_0x30851a[_0x72a1('0x3e')]=_0x30851a[_0x72a1('0x3e')][_0x72a1('0x41')]?_0x30851a[_0x72a1('0x3e')]:_0x26512e[_0x72a1('0x3a')];if(!_0xa4de6c['query']['hasOwnProperty'](_0x72a1('0x42'))){_0x30851a[_0x72a1('0x26')]=qs[_0x72a1('0x26')](_0xa4de6c[_0x72a1('0x3c')][_0x72a1('0x26')]);_0x30851a[_0x72a1('0x28')]=qs[_0x72a1('0x28')](_0xa4de6c[_0x72a1('0x3c')][_0x72a1('0x28')]);}_0x30851a[_0x72a1('0x43')]=qs[_0x72a1('0x44')](_0xa4de6c[_0x72a1('0x3c')][_0x72a1('0x44')]);_0x30851a[_0x72a1('0x45')]=qs[_0x72a1('0x3d')](_[_0x72a1('0x46')](_0xa4de6c[_0x72a1('0x3c')],_0x26512e[_0x72a1('0x3d')]),_0x55baf2);if(_0xa4de6c[_0x72a1('0x3c')][_0x72a1('0x47')]){_0x30851a[_0x72a1('0x45')]=_[_0x72a1('0x48')](_0x30851a[_0x72a1('0x45')],{'$or':_[_0x72a1('0x36')](_0x55baf2,function(_0x5ebfd6){if(_0x5ebfd6['type']!==_0x72a1('0x49')){var _0x1ecc22={};_0x1ecc22[_0x5ebfd6[_0x72a1('0x34')]]={'$like':'%'+_0xa4de6c[_0x72a1('0x3c')]['filter']+'%'};return _0x1ecc22;}})});}_0x30851a=_['merge']({},_0x30851a,_0xa4de6c['options']);var _0x5c9655={'where':_0x30851a['where']};return db[_0x72a1('0x37')][_0x72a1('0x29')](_0x5c9655)[_0x72a1('0x30')](function(_0x27f72e){_0x3191d6['count']=_0x27f72e;if(_0xa4de6c['query'][_0x72a1('0x4a')]){_0x30851a[_0x72a1('0x4b')]=[{'all':!![]}];}return db[_0x72a1('0x37')][_0x72a1('0x4c')](_0x30851a);})[_0x72a1('0x30')](function(_0x3b946f){_0x3191d6['rows']=_0x3b946f;return _0x3191d6;})[_0x72a1('0x30')](respondWithFilteredResult(_0x214e54,_0x30851a))[_0x72a1('0x4d')](handleError(_0x214e54,null));};exports[_0x72a1('0x4e')]=function(_0x442198,_0x267ce5){var _0xf8e192={'raw':!![],'where':{'id':_0x442198['params']['id']}},_0x32601a={};_0x32601a[_0x72a1('0x3a')]=_[_0x72a1('0x3b')](db[_0x72a1('0x37')]['rawAttributes']);_0x32601a[_0x72a1('0x3c')]=_[_0x72a1('0x3b')](_0x442198['query']);_0x32601a[_0x72a1('0x3d')]=_['intersection'](_0x32601a['model'],_0x32601a[_0x72a1('0x3c')]);_0xf8e192[_0x72a1('0x3e')]=_['intersection'](_0x32601a[_0x72a1('0x3a')],qs['fields'](_0x442198[_0x72a1('0x3c')][_0x72a1('0x40')]));_0xf8e192[_0x72a1('0x3e')]=_0xf8e192[_0x72a1('0x3e')][_0x72a1('0x41')]?_0xf8e192[_0x72a1('0x3e')]:_0x32601a[_0x72a1('0x3a')];if(_0x442198[_0x72a1('0x3c')]['includeAll']){_0xf8e192[_0x72a1('0x4b')]=[{'all':!![]}];}_0xf8e192=_[_0x72a1('0x48')]({},_0xf8e192,_0x442198['options']);return db[_0x72a1('0x37')][_0x72a1('0x4f')](_0xf8e192)['then'](handleEntityNotFound(_0x267ce5,null))['then'](respondWithResult(_0x267ce5,null))[_0x72a1('0x4d')](handleError(_0x267ce5,null));};exports[_0x72a1('0x50')]=function(_0x4b9f17,_0x10e088){return db['OpenchannelMessage'][_0x72a1('0x50')](_0x4b9f17['body'],{})['then'](respondWithResult(_0x10e088,0xc9))[_0x72a1('0x4d')](handleError(_0x10e088,null));};exports[_0x72a1('0x2f')]=function(_0x48bdc5,_0xe3f59c){if(_0x48bdc5[_0x72a1('0x51')]['id']){delete _0x48bdc5[_0x72a1('0x51')]['id'];}return db[_0x72a1('0x37')][_0x72a1('0x4f')]({'where':{'id':_0x48bdc5['params']['id']}})[_0x72a1('0x30')](handleEntityNotFound(_0xe3f59c,null))['then'](saveUpdates(_0x48bdc5[_0x72a1('0x51')],null))['then'](respondWithResult(_0xe3f59c,null))[_0x72a1('0x4d')](handleError(_0xe3f59c,null));};exports[_0x72a1('0x31')]=function(_0x227d5b,_0x254827){return db[_0x72a1('0x37')][_0x72a1('0x4f')]({'where':{'id':_0x227d5b[_0x72a1('0x52')]['id']}})[_0x72a1('0x30')](handleEntityNotFound(_0x254827,null))[_0x72a1('0x30')](removeEntity(_0x254827,null))[_0x72a1('0x4d')](handleError(_0x254827,null));};exports[_0x72a1('0x53')]=function(_0x2d587a,_0x346fd7){return db['OpenchannelMessage'][_0x72a1('0x53')]()['then'](respondWithResult(_0x346fd7,null))['catch'](handleError(_0x346fd7,null));};var interaction_log=require(_0x72a1('0x54'))(_0x72a1('0x55'));exports[_0x72a1('0x56')]=function(_0x315dc0,_0x29ee34,_0x2a5679){var _0x386763={'agent':{},'channel':'openchannel'};if(_0x315dc0[_0x72a1('0x51')]['id']){delete _0x315dc0[_0x72a1('0x51')]['id'];}_0x315dc0[_0x72a1('0x51')][_0x72a1('0x57')]=!![];_0x315dc0[_0x72a1('0x51')][_0x72a1('0x58')]=moment()['format'](_0x72a1('0x59'));_0x315dc0['body'][_0x72a1('0x5a')]=_0x315dc0[_0x72a1('0x51')][_0x72a1('0x5a')]||_0x315dc0[_0x72a1('0x5b')]['id'];_0x386763[_0x72a1('0x5c')]['id']=_0x315dc0[_0x72a1('0x51')][_0x72a1('0x5a')];return db[_0x72a1('0x37')][_0x72a1('0x4f')]({'where':{'id':_0x315dc0[_0x72a1('0x52')]['id'],'UserId':null}})[_0x72a1('0x30')](handleEntityNotFound(_0x29ee34,null))[_0x72a1('0x30')](saveUpdates(_0x315dc0[_0x72a1('0x51')],null))[_0x72a1('0x30')](function(_0x2baf75){if(_0x2baf75){_0x386763[_0x72a1('0x22')]=_0x2baf75[_0x72a1('0x5d')]({'plain':!![]});return db[_0x72a1('0x5e')]['find']({'where':{'id':_0x2baf75['OpenchannelInteractionId']}});}return null;})[_0x72a1('0x30')](handleEntityNotFound(_0x29ee34,null))[_0x72a1('0x30')](function(_0x11105e){if(_0x11105e){return _0x11105e[_0x72a1('0x2f')]({'UserId':_0x315dc0[_0x72a1('0x51')][_0x72a1('0x5a')],'read1stAt':_[_0x72a1('0x5f')](_0x11105e[_0x72a1('0x60')])?moment()[_0x72a1('0x61')](_0x72a1('0x59')):undefined});}return null;})[_0x72a1('0x30')](function(_0x332bd4){if(_0x332bd4){_0x386763[_0x72a1('0x62')]=_0x332bd4[_0x72a1('0x5d')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x315dc0[_0x72a1('0x5b')]['id'],_0x315dc0[_0x72a1('0x5b')]['name'],_0x315dc0[_0x72a1('0x5b')][_0x72a1('0x63')],_0x386763[_0x72a1('0x62')]['id'],_0x315dc0[_0x72a1('0x51')]?JSON[_0x72a1('0x64')](_0x315dc0[_0x72a1('0x51')]):_0x72a1('0x65'));return respondWithRpcPromise(_0x72a1('0x66'),_0x72a1('0x67'),_0x386763);}return null;})[_0x72a1('0x30')](function(_0x7fd156){var _0x3c4a1e=_0x72a1('0x68')+_0x7fd156[_0x72a1('0x22')][_0x72a1('0x69')];return db[_0x72a1('0x6a')]['query'](_0x3c4a1e,{'type':db[_0x72a1('0x6b')][_0x72a1('0x6c')]['SELECT'],'raw':!![]})[_0x72a1('0x30')](function(_0x41f3b9){return _0x41f3b9;});})[_0x72a1('0x30')](function(_0x47dbc9){if(_0x47dbc9){_0x386763[_0x72a1('0x22')][_0x72a1('0x6d')]=_0x47dbc9[0x0];if(!_0x315dc0[_0x72a1('0x51')]['UserId'])return;return db[_0x72a1('0x6e')][_0x72a1('0x4f')]({'where':{'id':_0x315dc0[_0x72a1('0x51')][_0x72a1('0x5a')],'role':_0x72a1('0x5c')},'attributes':['id',_0x72a1('0x34'),'fullname',_0x72a1('0x6f'),_0x72a1('0x70')],'raw':!![]});}return null;})[_0x72a1('0x30')](function(_0x5855f5){if(!_0x5855f5)return null;_0x386763[_0x72a1('0x22')][_0x72a1('0x5c')]=_0x5855f5;return _0x386763;})[_0x72a1('0x30')](function(_0x1c5389){if(_0x1c5389){if(_0x315dc0[_0x72a1('0x51')][_0x72a1('0x71')]){_0x386763[_0x72a1('0x22')][_0x72a1('0x72')]=util[_0x72a1('0x61')](_0x72a1('0x73'),_0x315dc0[_0x72a1('0x5b')]['name']);_0x386763[_0x72a1('0x22')][_0x72a1('0x74')]=_0x386763['channel'];_0x386763[_0x72a1('0x22')]['motionChannel']=_0x386763[_0x72a1('0x74')];_0x386763[_0x72a1('0x22')]['event']=_0x72a1('0x56');return respondWithRpcPromise(_0x72a1('0x75'),_0x72a1('0x75'),{'event':'acceptmessage','message':_0x386763[_0x72a1('0x22')]},client9002)[_0x72a1('0x30')](function(){return _0x386763;});}return _0x386763;}return null;})[_0x72a1('0x30')](respondWithResult(_0x29ee34,null))[_0x72a1('0x4d')](handleError(_0x29ee34,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x72a1('0x2d')]=function(_0x31ebd5,_0x17a1c0,_0x4ddcd0){var _0x1649e5={'agent':{},'channel':'openchannel'};if(_0x31ebd5[_0x72a1('0x51')]['id']){delete _0x31ebd5[_0x72a1('0x51')]['id'];}_0x31ebd5[_0x72a1('0x51')][_0x72a1('0x5a')]=_0x31ebd5[_0x72a1('0x51')][_0x72a1('0x5a')]||_0x31ebd5['user']['id'];_0x1649e5[_0x72a1('0x5c')]['id']=_0x31ebd5['body'][_0x72a1('0x5a')];return db[_0x72a1('0x37')][_0x72a1('0x4f')]({'where':{'id':_0x31ebd5[_0x72a1('0x52')]['id'],'UserId':null}})[_0x72a1('0x30')](handleEntityNotFound(_0x17a1c0,null))[_0x72a1('0x30')](function(_0x24f703){if(_0x24f703){_0x1649e5[_0x72a1('0x22')]=_0x24f703[_0x72a1('0x5d')]({'plain':!![]});return db[_0x72a1('0x5e')]['find']({'where':{'id':_0x24f703[_0x72a1('0x76')]}});}return null;})[_0x72a1('0x30')](handleEntityNotFound(_0x17a1c0,null))[_0x72a1('0x30')](function(_0x4fad05){if(_0x4fad05){_0x1649e5['interaction']=_0x4fad05[_0x72a1('0x5d')]({'plain':!![]});interaction_log['info'](_0x72a1('0x77'),_0x31ebd5['user']['id'],_0x31ebd5[_0x72a1('0x5b')][_0x72a1('0x34')],_0x31ebd5[_0x72a1('0x5b')][_0x72a1('0x63')],_0x1649e5['interaction']['id'],_0x31ebd5[_0x72a1('0x51')]?JSON[_0x72a1('0x64')](_0x31ebd5[_0x72a1('0x51')]):_0x72a1('0x65'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1649e5);}return null;})[_0x72a1('0x30')](function(_0x321bf8){var _0x3bda1a=_0x72a1('0x68')+_0x321bf8[_0x72a1('0x22')]['ContactId'];return db[_0x72a1('0x6a')]['query'](_0x3bda1a,{'type':db['Sequelize']['QueryTypes'][_0x72a1('0x78')],'raw':!![]})[_0x72a1('0x30')](function(_0x56e965){return _0x56e965;});})['then'](function(_0x3a44cb){if(_0x3a44cb){_0x1649e5[_0x72a1('0x22')][_0x72a1('0x6d')]=_0x3a44cb[0x0];if(!_0x31ebd5['body'][_0x72a1('0x5a')])return;return db[_0x72a1('0x6e')][_0x72a1('0x4f')]({'where':{'id':_0x31ebd5[_0x72a1('0x51')][_0x72a1('0x5a')],'role':_0x72a1('0x5c')},'attributes':['id',_0x72a1('0x34'),'fullname',_0x72a1('0x6f'),_0x72a1('0x70')],'raw':!![]});}return null;})[_0x72a1('0x30')](function(_0x5698ca){if(!_0x5698ca)return null;_0x1649e5[_0x72a1('0x22')][_0x72a1('0x5c')]=_0x5698ca;return _0x1649e5;})[_0x72a1('0x30')](function(_0x280bb7){if(_0x280bb7){_0x280bb7['message'][_0x72a1('0x72')]=util[_0x72a1('0x61')](_0x72a1('0x73'),_0x31ebd5['user'][_0x72a1('0x34')]);_0x280bb7[_0x72a1('0x22')][_0x72a1('0x74')]=_0x1649e5[_0x72a1('0x74')];_0x280bb7[_0x72a1('0x22')][_0x72a1('0x79')]=_0x1649e5['channel'];_0x280bb7[_0x72a1('0x22')][_0x72a1('0x7a')]=_0x72a1('0x2d');respondWithRpcPromise('EventManager',_0x72a1('0x75'),{'event':_0x72a1('0x7b'),'message':_0x280bb7[_0x72a1('0x22')]},client9002);return _0x1649e5;}return null;})[_0x72a1('0x30')](respondWithResult(_0x17a1c0,null))['catch'](handleError(_0x17a1c0,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index af0e655..1ff69fc 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 _0x9547=['OpenchannelMessage','setMaxListeners','save','remove','emit','exports','events'];(function(_0x1ff2d0,_0x24399b){var _0x591a17=function(_0x2f85d7){while(--_0x2f85d7){_0x1ff2d0['push'](_0x1ff2d0['shift']());}};_0x591a17(++_0x24399b);}(_0x9547,0x19c));var _0x7954=function(_0x23ab1e,_0x52a364){_0x23ab1e=_0x23ab1e-0x0;var _0x486ee7=_0x9547[_0x23ab1e];return _0x486ee7;};'use strict';var EventEmitter=require(_0x7954('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x7954('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7954('0x2')](0x0);var events={'afterCreate':_0x7954('0x3'),'afterUpdate':'update','afterDestroy':_0x7954('0x4')};function emitEvent(_0x500960){return function(_0x1d10a4,_0xbc9014,_0x3c1330){OpenchannelMessageEvents[_0x7954('0x5')](_0x500960+':'+_0x1d10a4['id'],_0x1d10a4);OpenchannelMessageEvents[_0x7954('0x5')](_0x500960,_0x1d10a4);_0x3c1330(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x7954('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x17e2=['OpenchannelMessage','setMaxListeners','remove','emit','hook','events'];(function(_0x224cee,_0x4a381a){var _0x130d49=function(_0x28dddb){while(--_0x28dddb){_0x224cee['push'](_0x224cee['shift']());}};_0x130d49(++_0x4a381a);}(_0x17e2,0x101));var _0x217e=function(_0x2313f0,_0x5b93c6){_0x2313f0=_0x2313f0-0x0;var _0x4574d7=_0x17e2[_0x2313f0];return _0x4574d7;};'use strict';var EventEmitter=require(_0x217e('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x217e('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x217e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x217e('0x3')};function emitEvent(_0x399840){return function(_0x3d2008,_0x2f8384,_0x422bec){OpenchannelMessageEvents[_0x217e('0x4')](_0x399840+':'+_0x3d2008['id'],_0x3d2008);OpenchannelMessageEvents[_0x217e('0x4')](_0x399840,_0x3d2008);_0x422bec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x217e('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index d1a8671..1f7ea52 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 _0x7584=['length','omit','POST','method','body','threadId','OpenchannelInteraction','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','models','get','toLowerCase','direction','out','isNil','findOne','OpenchannelInteractionId','then','update','catch','error','secret','CmContact','describe','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s'];(function(_0x3b4369,_0x33b3d5){var _0xe9f642=function(_0x57c20a){while(--_0x57c20a){_0x3b4369['push'](_0x3b4369['shift']());}};_0xe9f642(++_0x33b3d5);}(_0x7584,0x12c));var _0x4758=function(_0x337724,_0x27924e){_0x337724=_0x337724-0x0;var _0x1a9e88=_0x7584[_0x337724];return _0x1a9e88;};'use strict';var _=require(_0x4758('0x0'));var util=require(_0x4758('0x1'));var logger=require(_0x4758('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4758('0x3'));var rp=require(_0x4758('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4758('0x5'));module[_0x4758('0x6')]=function(_0x5ec537,_0xb7e5ba){return _0x5ec537[_0x4758('0x7')]('OpenchannelMessage',attributes,{'tableName':_0x4758('0x8'),'paranoid':![],'indexes':[{'name':_0x4758('0x9'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x29843f,_0x2aa003,_0x258194){var _0x218761=_0x5ec537[_0x4758('0xa')];var _0x23919a=_0x29843f[_0x4758('0xb')]({'plain':!![]});if(_0x23919a['direction'][_0x4758('0xc')]()==='in'||_0x23919a[_0x4758('0xd')][_0x4758('0xc')]()===_0x4758('0xe')&&!_0x23919a['secret']&&!_[_0x4758('0xf')](_0x23919a['UserId'])){_0x218761['OpenchannelInteraction'][_0x4758('0x10')]({'where':{'id':_0x23919a[_0x4758('0x11')]}})[_0x4758('0x12')](function(_0x5ef197){if(_0x5ef197){_0x5ef197[_0x4758('0x13')]({'lastMsgAt':_0x23919a['createdAt'],'lastMsgDirection':_0x23919a[_0x4758('0xd')][_0x4758('0xc')]()});}})[_0x4758('0x14')](function(_0x2b355b){console[_0x4758('0x15')](_0x2b355b);});}if(_0x23919a[_0x4758('0xd')]===_0x4758('0xe')&&!_0x23919a[_0x4758('0x16')]){var _0x5415fc;_0x218761[_0x4758('0x17')][_0x4758('0x18')]()[_0x4758('0x12')](function(_0x5ca7d3){return _0x218761['OpenchannelAccount'][_0x4758('0x19')]({'where':{'id':_0x23919a[_0x4758('0x1a')]},'include':[{'model':_0x218761['OpenchannelInteraction'],'as':_0x4758('0x1b'),'where':{'id':_0x23919a[_0x4758('0x11')]},'limit':0x1,'include':[{'model':_0x218761['CmContact'],'as':_0x4758('0x1c'),'attributes':_[_0x4758('0x1d')](_0x5ca7d3)}]}]});})[_0x4758('0x12')](function(_0x154955){_0x5415fc=_0x154955['get']({'plain':!![]});if(_0x5415fc&&_0x5415fc[_0x4758('0x1e')]){logger[_0x4758('0x1f')](_0x4758('0x20'),_0x4758('0x21'),util[_0x4758('0x22')](_0x4758('0x23'),_0x23919a['id'],_0x5415fc[_0x4758('0x1e')]));if(_0x5415fc[_0x4758('0x1b')]&&_0x5415fc[_0x4758('0x1b')][_0x4758('0x24')]){_0x23919a['Interaction']=_[_0x4758('0x25')](_0x5415fc['Interactions'][0x0],_0x4758('0x1c'));_0x23919a[_0x4758('0x1c')]=_0x5415fc[_0x4758('0x1b')][0x0][_0x4758('0x1c')];}var _0x2aa003={'method':_0x4758('0x26'),'uri':encodeURI(_0x5415fc['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2aa003[_0x4758('0x27')]){case'GET':_0x2aa003['qs']=_0x23919a;break;case'POST':_0x2aa003[_0x4758('0x28')]=_0x23919a;break;}return rp(_0x2aa003)['then'](function(_0x5327bf){logger[_0x4758('0x1f')](_0x4758('0x20'),_0x4758('0x21'),util[_0x4758('0x22')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x23919a['id'],_0x5415fc[_0x4758('0x1e')]));if(_0x5327bf['body'][_0x4758('0x29')]&&_0x5327bf[_0x4758('0x28')]['threadId']!=_0x23919a['Interaction'][_0x4758('0x29')]){return _0x218761[_0x4758('0x2a')][_0x4758('0x13')]({'threadId':_0x5327bf[_0x4758('0x28')][_0x4758('0x29')]},{'where':{'id':_0x23919a[_0x4758('0x2b')]['id']}});}else{return;}})[_0x4758('0x12')](function(){return _0x29843f[_0x4758('0x13')]({'read':!![]});})[_0x4758('0x14')](function(_0x57303c){logger[_0x4758('0x15')](_0x4758('0x20'),_0x4758('0x21'),util[_0x4758('0x2c')](_0x57303c,{'showHidden':![],'depth':null}));_0x258194();});}else{_0x258194();}})[_0x4758('0x2d')](function(){_0x258194();});}else{_0x258194();}}},'charset':_0x4758('0x2e'),'collate':_0x4758('0x2f')});}; \ No newline at end of file +var _0x74bb=['OpenchannelInteractionId','then','catch','error','describe','OpenchannelAccount','find','OpenchannelInteraction','Interactions','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','omit','method','POST','format','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','Interaction','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x3a0c80,_0x2e613b){var _0x1f0486=function(_0x5cdfab){while(--_0x5cdfab){_0x3a0c80['push'](_0x3a0c80['shift']());}};_0x1f0486(++_0x2e613b);}(_0x74bb,0x165));var _0xb74b=function(_0xbf2f5,_0x576dd5){_0xbf2f5=_0xbf2f5-0x0;var _0x52c3db=_0x74bb[_0xbf2f5];return _0x52c3db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb74b('0x0'))(_0xb74b('0x1'));var moment=require(_0xb74b('0x2'));var BPromise=require(_0xb74b('0x3'));var rp=require(_0xb74b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb74b('0x5'));var attributes=require(_0xb74b('0x6'));module[_0xb74b('0x7')]=function(_0x9d6243,_0x2ea9b0){return _0x9d6243[_0xb74b('0x8')]('OpenchannelMessage',attributes,{'tableName':_0xb74b('0x9'),'paranoid':![],'indexes':[{'name':_0xb74b('0xa'),'fields':['body'],'type':_0xb74b('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22d4eb,_0x4700ca,_0x1e6a38){var _0x3b7b69=_0x9d6243[_0xb74b('0xc')];var _0x5e322b=_0x22d4eb['get']({'plain':!![]});if(_0x5e322b[_0xb74b('0xd')][_0xb74b('0xe')]()==='in'||_0x5e322b[_0xb74b('0xd')]['toLowerCase']()===_0xb74b('0xf')&&!_0x5e322b[_0xb74b('0x10')]&&!_[_0xb74b('0x11')](_0x5e322b[_0xb74b('0x12')])){_0x3b7b69['OpenchannelInteraction']['findOne']({'where':{'id':_0x5e322b[_0xb74b('0x13')]}})[_0xb74b('0x14')](function(_0x586e61){if(_0x586e61){_0x586e61['update']({'lastMsgAt':_0x5e322b['createdAt'],'lastMsgDirection':_0x5e322b[_0xb74b('0xd')][_0xb74b('0xe')]()});}})[_0xb74b('0x15')](function(_0x51d940){console[_0xb74b('0x16')](_0x51d940);});}if(_0x5e322b['direction']===_0xb74b('0xf')&&!_0x5e322b[_0xb74b('0x10')]){var _0x5de1fe;_0x3b7b69['CmContact'][_0xb74b('0x17')]()['then'](function(_0x449af1){return _0x3b7b69[_0xb74b('0x18')][_0xb74b('0x19')]({'where':{'id':_0x5e322b['OpenchannelAccountId']},'include':[{'model':_0x3b7b69[_0xb74b('0x1a')],'as':_0xb74b('0x1b'),'where':{'id':_0x5e322b['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x3b7b69['CmContact'],'as':_0xb74b('0x1c'),'attributes':_[_0xb74b('0x1d')](_0x449af1)}]}]});})[_0xb74b('0x14')](function(_0xfb0df0){_0x5de1fe=_0xfb0df0[_0xb74b('0x1e')]({'plain':!![]});if(_0x5de1fe&&_0x5de1fe[_0xb74b('0x1f')]){logger[_0xb74b('0x20')](_0xb74b('0x21'),_0xb74b('0x22'),util['format'](_0xb74b('0x23'),_0x5e322b['id'],_0x5de1fe[_0xb74b('0x1f')]));if(_0x5de1fe[_0xb74b('0x1b')]&&_0x5de1fe[_0xb74b('0x1b')]['length']){_0x5e322b['Interaction']=_[_0xb74b('0x24')](_0x5de1fe[_0xb74b('0x1b')][0x0],_0xb74b('0x1c'));_0x5e322b[_0xb74b('0x1c')]=_0x5de1fe['Interactions'][0x0][_0xb74b('0x1c')];}var _0x4700ca={'method':'POST','uri':encodeURI(_0x5de1fe[_0xb74b('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4700ca[_0xb74b('0x25')]){case'GET':_0x4700ca['qs']=_0x5e322b;break;case _0xb74b('0x26'):_0x4700ca['body']=_0x5e322b;break;}return rp(_0x4700ca)['then'](function(_0x4b01aa){logger[_0xb74b('0x20')](_0xb74b('0x21'),_0xb74b('0x22'),util[_0xb74b('0x27')](_0xb74b('0x28'),_0x5e322b['id'],_0x5de1fe[_0xb74b('0x1f')]));if(_0x4b01aa[_0xb74b('0x29')][_0xb74b('0x2a')]&&_0x4b01aa[_0xb74b('0x29')][_0xb74b('0x2a')]!=_0x5e322b[_0xb74b('0x2b')]['threadId']){return _0x3b7b69[_0xb74b('0x1a')]['update']({'threadId':_0x4b01aa[_0xb74b('0x29')][_0xb74b('0x2a')]},{'where':{'id':_0x5e322b['Interaction']['id']}});}else{return;}})[_0xb74b('0x14')](function(){return _0x22d4eb['update']({'read':!![]});})['catch'](function(_0x1de6ab){logger[_0xb74b('0x16')](_0xb74b('0x21'),_0xb74b('0x22'),util['inspect'](_0x1de6ab,{'showHidden':![],'depth':null}));_0x1e6a38();});}else{_0x1e6a38();}})[_0xb74b('0x2c')](function(){_0x1e6a38();});}else{_0x1e6a38();}}},'charset':_0xb74b('0x2d'),'collate':_0xb74b('0x2e')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 88e3809..ab08ce9 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(_0x34c26b,_0x5e279b){var _0x2f9f58=function(_0x273abe){while(--_0x273abe){_0x34c26b['push'](_0x34c26b['shift']());}};_0x2f9f58(++_0x5e279b);}(_0xdb28,0x106));var _0x8db2=function(_0x47da76,_0x1fc80e){_0x47da76=_0x47da76-0x0;var _0x131b82=_0xdb28[_0x47da76];return _0x131b82;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x10a68e,_0x53a4fe){var _0x188a4d=function(_0x372e7d){while(--_0x372e7d){_0x10a68e['push'](_0x10a68e['shift']());}};_0x188a4d(++_0x53a4fe);}(_0x7a54,0x106));var _0x47a5=function(_0x2d0ba3,_0xd248a){_0x2d0ba3=_0x2d0ba3-0x0;var _0x159a72=_0x7a54[_0x2d0ba3];return _0x159a72;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 110e3a8..4c02d6a 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 _0x5e1e=['removeListener','register','length','openchannelMessage:','./openchannelMessage.events','update','emit'];(function(_0x701847,_0xba95a2){var _0x58c8f2=function(_0x37dafa){while(--_0x37dafa){_0x701847['push'](_0x701847['shift']());}};_0x58c8f2(++_0xba95a2);}(_0x5e1e,0xe4));var _0xe5e1=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x5e1e[_0x47e7cb];return _0x2a8874;};'use strict';var OpenchannelMessageEvents=require(_0xe5e1('0x0'));var events=['save','remove',_0xe5e1('0x1')];function createListener(_0x4d6f52,_0xb30aa8){return function(_0x32ceeb){_0xb30aa8[_0xe5e1('0x2')](_0x4d6f52,_0x32ceeb);};}function removeListener(_0x176ea4,_0x2cd81d){return function(){OpenchannelMessageEvents[_0xe5e1('0x3')](_0x176ea4,_0x2cd81d);};}exports[_0xe5e1('0x4')]=function(_0x12b807){for(var _0x53bea9=0x0,_0x18d438=events[_0xe5e1('0x5')];_0x53bea9<_0x18d438;_0x53bea9++){var _0x585a31=events[_0x53bea9];var _0x221ea4=createListener(_0xe5e1('0x6')+_0x585a31,_0x12b807);OpenchannelMessageEvents['on'](_0x585a31,_0x221ea4);}}; \ No newline at end of file +var _0x576b=['emit','removeListener','register','length','openchannelMessage:','update'];(function(_0x8980,_0x3e943b){var _0x3491a6=function(_0x1acbf3){while(--_0x1acbf3){_0x8980['push'](_0x8980['shift']());}};_0x3491a6(++_0x3e943b);}(_0x576b,0x1d9));var _0xb576=function(_0x3856f1,_0x2ad59d){_0x3856f1=_0x3856f1-0x0;var _0x3f0f72=_0x576b[_0x3856f1];return _0x3f0f72;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save','remove',_0xb576('0x0')];function createListener(_0x1cb118,_0x5db0de){return function(_0x2c3737){_0x5db0de[_0xb576('0x1')](_0x1cb118,_0x2c3737);};}function removeListener(_0x4e022a,_0x20cb85){return function(){OpenchannelMessageEvents[_0xb576('0x2')](_0x4e022a,_0x20cb85);};}exports[_0xb576('0x3')]=function(_0x3039d9){for(var _0x11427a=0x0,_0x22cbae=events[_0xb576('0x4')];_0x11427a<_0x22cbae;_0x11427a++){var _0x42f2c0=events[_0x11427a];var _0xe6d2fd=createListener(_0xb576('0x5')+_0x42f2c0,_0x3039d9);OpenchannelMessageEvents['on'](_0x42f2c0,_0xe6d2fd);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 8d370c8..863f5dc 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 _0x61b2=['show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe'];(function(_0x916e5b,_0x1b6634){var _0x2126f1=function(_0x492372){while(--_0x492372){_0x916e5b['push'](_0x916e5b['shift']());}};_0x2126f1(++_0x1b6634);}(_0x61b2,0x1b5));var _0x261b=function(_0x2ef32f,_0x51fda1){_0x2ef32f=_0x2ef32f-0x0;var _0x55ac81=_0x61b2[_0x2ef32f];return _0x55ac81;};'use strict';var multer=require(_0x261b('0x0'));var util=require(_0x261b('0x1'));var path=require(_0x261b('0x2'));var timeout=require(_0x261b('0x3'));var express=require('express');var router=express[_0x261b('0x4')]();var fs_extra=require(_0x261b('0x5'));var auth=require(_0x261b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x261b('0x7')]('/',auth[_0x261b('0x8')](),controller[_0x261b('0x9')]);router[_0x261b('0x7')](_0x261b('0xa'),auth[_0x261b('0x8')](),controller['describe']);router[_0x261b('0x7')]('/:id',auth[_0x261b('0x8')](),controller[_0x261b('0xb')]);router[_0x261b('0x7')]('/:id/members',auth[_0x261b('0x8')](),controller['getMembers']);router['get'](_0x261b('0xc'),auth[_0x261b('0x8')](),controller[_0x261b('0xd')]);router['get'](_0x261b('0xe'),auth['isAuthenticated'](),controller[_0x261b('0xf')]);router[_0x261b('0x10')]('/',auth[_0x261b('0x8')](),controller[_0x261b('0x11')]);router['post'](_0x261b('0xc'),auth['isAuthenticated'](),controller[_0x261b('0x12')]);router[_0x261b('0x10')]('/:id/users',auth[_0x261b('0x8')](),controller[_0x261b('0x13')]);router[_0x261b('0x14')](_0x261b('0x15'),auth[_0x261b('0x8')](),controller[_0x261b('0x16')]);router[_0x261b('0x17')]('/:id',auth[_0x261b('0x8')](),controller[_0x261b('0x18')]);router[_0x261b('0x17')](_0x261b('0xc'),auth[_0x261b('0x8')](),controller[_0x261b('0x19')]);router[_0x261b('0x17')](_0x261b('0xe'),auth[_0x261b('0x8')](),controller[_0x261b('0x1a')]);module[_0x261b('0x1b')]=router; \ No newline at end of file +var _0x8c05=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router'];(function(_0x2431d6,_0x25189a){var _0x4d0f9b=function(_0x52cd84){while(--_0x52cd84){_0x2431d6['push'](_0x2431d6['shift']());}};_0x4d0f9b(++_0x25189a);}(_0x8c05,0x6e));var _0x58c0=function(_0x117a65,_0x7d7131){_0x117a65=_0x117a65-0x0;var _0x41fbf3=_0x8c05[_0x117a65];return _0x41fbf3;};'use strict';var multer=require(_0x58c0('0x0'));var util=require(_0x58c0('0x1'));var path=require(_0x58c0('0x2'));var timeout=require(_0x58c0('0x3'));var express=require(_0x58c0('0x4'));var router=express[_0x58c0('0x5')]();var fs_extra=require(_0x58c0('0x6'));var auth=require(_0x58c0('0x7'));var interaction=require(_0x58c0('0x8'));var config=require(_0x58c0('0x9'));var controller=require('./openchannelQueue.controller');router[_0x58c0('0xa')]('/',auth[_0x58c0('0xb')](),controller[_0x58c0('0xc')]);router['get'](_0x58c0('0xd'),auth[_0x58c0('0xb')](),controller['describe']);router[_0x58c0('0xa')](_0x58c0('0xe'),auth['isAuthenticated'](),controller[_0x58c0('0xf')]);router[_0x58c0('0xa')](_0x58c0('0x10'),auth[_0x58c0('0xb')](),controller['getMembers']);router[_0x58c0('0xa')](_0x58c0('0x11'),auth[_0x58c0('0xb')](),controller['getTeams']);router[_0x58c0('0xa')](_0x58c0('0x12'),auth[_0x58c0('0xb')](),controller[_0x58c0('0x13')]);router[_0x58c0('0x14')]('/',auth[_0x58c0('0xb')](),controller[_0x58c0('0x15')]);router['post']('/:id/teams',auth[_0x58c0('0xb')](),controller[_0x58c0('0x16')]);router[_0x58c0('0x14')](_0x58c0('0x12'),auth[_0x58c0('0xb')](),controller[_0x58c0('0x17')]);router[_0x58c0('0x18')](_0x58c0('0xe'),auth[_0x58c0('0xb')](),controller[_0x58c0('0x19')]);router[_0x58c0('0x1a')](_0x58c0('0xe'),auth[_0x58c0('0xb')](),controller[_0x58c0('0x1b')]);router['delete'](_0x58c0('0x11'),auth[_0x58c0('0xb')](),controller['removeTeams']);router[_0x58c0('0x1a')](_0x58c0('0x12'),auth[_0x58c0('0xb')](),controller[_0x58c0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index a57e354..18212fa 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 _0x38fd=['roundrobin','exports','STRING','ENUM','rrmemory'];(function(_0x39c747,_0x297706){var _0x523e66=function(_0x170198){while(--_0x170198){_0x39c747['push'](_0x39c747['shift']());}};_0x523e66(++_0x297706);}(_0x38fd,0x1af));var _0xd38f=function(_0x5b6fc5,_0x529e88){_0x5b6fc5=_0x5b6fc5-0x0;var _0x4e85d0=_0x38fd[_0x5b6fc5];return _0x4e85d0;};'use strict';var Sequelize=require('sequelize');module[_0xd38f('0x0')]={'name':{'type':Sequelize[_0xd38f('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd38f('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd38f('0x2')](_0xd38f('0x3'),'beepall',_0xd38f('0x4'))}}; \ No newline at end of file +var _0xb4c1=['beepall','sequelize','exports','STRING','name','ENUM'];(function(_0x25e732,_0x525016){var _0x44092d=function(_0x1be270){while(--_0x1be270){_0x25e732['push'](_0x25e732['shift']());}};_0x44092d(++_0x525016);}(_0xb4c1,0x1bd));var _0x1b4c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb4c1[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x1b4c('0x0'));module[_0x1b4c('0x1')]={'name':{'type':Sequelize[_0x1b4c('0x2')],'unique':_0x1b4c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1b4c('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1b4c('0x4')]('rrmemory',_0x1b4c('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 5487421..b5f31d1 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 _0x23f7=['every','includes','all','union','compact','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userOpenchannelQueue:save','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','getMembers','UserOpenchannelQueue','order','OpenchannelQueueId','User','UserId','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','findAll','Agents','online','voicePause','flatMap','sequelize','transaction','each','emit','removeTeams','ids','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT'];(function(_0x38c303,_0x30cc3e){var _0x3aceb7=function(_0x3cbc5e){while(--_0x3cbc5e){_0x38c303['push'](_0x38c303['shift']());}};_0x3aceb7(++_0x30cc3e);}(_0x23f7,0x126));var _0x723f=function(_0x3d5bfe,_0x5b285e){_0x3d5bfe=_0x3d5bfe-0x0;var _0x1111f9=_0x23f7[_0x3d5bfe];return _0x1111f9;};'use strict';var emlformat=require(_0x723f('0x0'));var rimraf=require(_0x723f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x723f('0x2'));var BPromise=require(_0x723f('0x3'));var Mustache=require(_0x723f('0x4'));var util=require(_0x723f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x723f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x723f('0x7'));var _=require(_0x723f('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x723f('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x723f('0xa'));var Papa=require(_0x723f('0xb'));var Redis=require(_0x723f('0xc'));var authService=require(_0x723f('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x723f('0xe'));var logger=require(_0x723f('0xf'))(_0x723f('0x10'));var utils=require(_0x723f('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x723f('0x12'))['db'];config['redis']=_[_0x723f('0x13')](config[_0x723f('0x14')],{'host':_0x723f('0x15'),'port':0x18eb});var socket=require(_0x723f('0x16'))(new Redis(config['redis']));require(_0x723f('0x17'))[_0x723f('0x18')](socket);function respondWithStatusCode(_0x1555ad,_0x438b65){_0x438b65=_0x438b65||0xcc;return function(_0xcdbfd4){if(_0xcdbfd4){return _0x1555ad[_0x723f('0x19')](_0x438b65);}return _0x1555ad[_0x723f('0x1a')](_0x438b65)['end']();};}function respondWithResult(_0xf94b08,_0x151d9d){_0x151d9d=_0x151d9d||0xc8;return function(_0x42915b){if(_0x42915b){return _0xf94b08[_0x723f('0x1a')](_0x151d9d)[_0x723f('0x1b')](_0x42915b);}};}function respondWithFilteredResult(_0x257cdf,_0x423540){return function(_0x7d1e4f){if(_0x7d1e4f){var _0xd4ff50=typeof _0x423540[_0x723f('0x1c')]===_0x723f('0x1d')&&typeof _0x423540['limit']===_0x723f('0x1d');var _0x28148f=_0x7d1e4f[_0x723f('0x1e')];var _0x4e84d6=_0xd4ff50?0x0:_0x423540[_0x723f('0x1c')];var _0xe42436=_0xd4ff50?_0x7d1e4f['count']:_0x423540[_0x723f('0x1c')]+_0x423540[_0x723f('0x1f')];var _0x630b32;if(_0xe42436>=_0x28148f){_0xe42436=_0x28148f;_0x630b32=0xc8;}else{_0x630b32=0xce;}_0x257cdf[_0x723f('0x1a')](_0x630b32);return _0x257cdf[_0x723f('0x20')](_0x723f('0x21'),_0x4e84d6+'-'+_0xe42436+'/'+_0x28148f)[_0x723f('0x1b')](_0x7d1e4f);}return null;};}function patchUpdates(_0x32bf1f){return function(_0x1fb199){try{jsonpatch[_0x723f('0x22')](_0x1fb199,_0x32bf1f,!![]);}catch(_0x4de8fe){return BPromise[_0x723f('0x23')](_0x4de8fe);}return _0x1fb199[_0x723f('0x24')]();};}function saveUpdates(_0x1a4de3,_0x7933a4){return function(_0x433269){if(_0x433269){return _0x433269['update'](_0x1a4de3)['then'](function(_0x5900a7){return _0x5900a7;});}return null;};}function removeEntity(_0xd92ed2,_0x2c6883){return function(_0xa73a45){if(_0xa73a45){return _0xa73a45[_0x723f('0x25')]()[_0x723f('0x26')](function(){var _0x318256=_0xa73a45['get']({'plain':!![]});var _0x1bc681=_0x723f('0x27');return db[_0x723f('0x28')][_0x723f('0x25')]({'where':{'type':_0x1bc681,'resourceId':_0x318256['id']}})[_0x723f('0x26')](function(){return _0xa73a45;});})[_0x723f('0x26')](function(){_0xd92ed2[_0x723f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41bcdd,_0x21afed){return function(_0x2b6088){if(!_0x2b6088){_0x41bcdd[_0x723f('0x19')](0x194);}return _0x2b6088;};}function handleError(_0x22dc8b,_0x2616f8){_0x2616f8=_0x2616f8||0x1f4;return function(_0x4615e2){logger[_0x723f('0x29')](_0x4615e2[_0x723f('0x2a')]);if(_0x4615e2[_0x723f('0x2b')]){delete _0x4615e2[_0x723f('0x2b')];}_0x22dc8b['status'](_0x2616f8)[_0x723f('0x2c')](_0x4615e2);};}exports[_0x723f('0x2d')]=function(_0x501e77,_0x4fffc6){var _0x4f4533={},_0x126477={},_0x3dde32={'count':0x0,'rows':[]};var _0x4d4bdd=_[_0x723f('0x2e')](db[_0x723f('0x2f')][_0x723f('0x30')],function(_0x1134ba){return{'name':_0x1134ba[_0x723f('0x31')],'type':_0x1134ba['type']['key']};});_0x126477[_0x723f('0x32')]=_[_0x723f('0x2e')](_0x4d4bdd,_0x723f('0x2b'));_0x126477[_0x723f('0x33')]=_[_0x723f('0x34')](_0x501e77[_0x723f('0x33')]);_0x126477[_0x723f('0x35')]=_[_0x723f('0x36')](_0x126477['model'],_0x126477['query']);_0x4f4533[_0x723f('0x37')]=_['intersection'](_0x126477[_0x723f('0x32')],qs[_0x723f('0x38')](_0x501e77[_0x723f('0x33')][_0x723f('0x38')]));_0x4f4533[_0x723f('0x37')]=_0x4f4533[_0x723f('0x37')][_0x723f('0x39')]?_0x4f4533[_0x723f('0x37')]:_0x126477[_0x723f('0x32')];if(!_0x501e77['query'][_0x723f('0x3a')](_0x723f('0x3b'))){_0x4f4533[_0x723f('0x1f')]=qs[_0x723f('0x1f')](_0x501e77[_0x723f('0x33')]['limit']);_0x4f4533[_0x723f('0x1c')]=qs[_0x723f('0x1c')](_0x501e77[_0x723f('0x33')][_0x723f('0x1c')]);}_0x4f4533['order']=qs[_0x723f('0x3c')](_0x501e77['query']['sort']);_0x4f4533[_0x723f('0x3d')]=qs[_0x723f('0x35')](_[_0x723f('0x3e')](_0x501e77[_0x723f('0x33')],_0x126477[_0x723f('0x35')]),_0x4d4bdd);if(_0x501e77[_0x723f('0x33')]['filter']){_0x4f4533[_0x723f('0x3d')]=_[_0x723f('0x3f')](_0x4f4533['where'],{'$or':_[_0x723f('0x2e')](_0x4d4bdd,function(_0x3e3b5a){if(_0x3e3b5a[_0x723f('0x40')]!==_0x723f('0x41')){var _0x97cf90={};_0x97cf90[_0x3e3b5a[_0x723f('0x2b')]]={'$like':'%'+_0x501e77[_0x723f('0x33')][_0x723f('0x42')]+'%'};return _0x97cf90;}})});}_0x4f4533=_['merge']({},_0x4f4533,_0x501e77[_0x723f('0x43')]);var _0x3bc0a5={'where':_0x4f4533[_0x723f('0x3d')]};return db[_0x723f('0x2f')][_0x723f('0x1e')](_0x3bc0a5)[_0x723f('0x26')](function(_0x73aeb9){_0x3dde32[_0x723f('0x1e')]=_0x73aeb9;if(_0x501e77[_0x723f('0x33')]['includeAll']){_0x4f4533[_0x723f('0x44')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x4f4533);})[_0x723f('0x26')](function(_0xd3e288){_0x3dde32[_0x723f('0x45')]=_0xd3e288;return _0x3dde32;})[_0x723f('0x26')](respondWithFilteredResult(_0x4fffc6,_0x4f4533))[_0x723f('0x46')](handleError(_0x4fffc6,null));};exports[_0x723f('0x47')]=function(_0xce9512,_0x36c0be){var _0x460155={'raw':!![],'where':{'id':_0xce9512[_0x723f('0x48')]['id']}},_0x3b2b31={};_0x3b2b31[_0x723f('0x32')]=_[_0x723f('0x34')](db[_0x723f('0x2f')][_0x723f('0x30')]);_0x3b2b31['query']=_['keys'](_0xce9512[_0x723f('0x33')]);_0x3b2b31[_0x723f('0x35')]=_['intersection'](_0x3b2b31[_0x723f('0x32')],_0x3b2b31[_0x723f('0x33')]);_0x460155[_0x723f('0x37')]=_[_0x723f('0x36')](_0x3b2b31['model'],qs[_0x723f('0x38')](_0xce9512[_0x723f('0x33')][_0x723f('0x38')]));_0x460155[_0x723f('0x37')]=_0x460155['attributes'][_0x723f('0x39')]?_0x460155[_0x723f('0x37')]:_0x3b2b31[_0x723f('0x32')];if(_0xce9512[_0x723f('0x33')][_0x723f('0x49')]){_0x460155['include']=[{'all':!![]}];}_0x460155=_[_0x723f('0x3f')]({},_0x460155,_0xce9512[_0x723f('0x43')]);return db['OpenchannelQueue'][_0x723f('0x4a')](_0x460155)[_0x723f('0x26')](handleEntityNotFound(_0x36c0be,null))[_0x723f('0x26')](respondWithResult(_0x36c0be,null))[_0x723f('0x46')](handleError(_0x36c0be,null));};exports[_0x723f('0x4b')]=function(_0x43cbbf,_0x599c0d){return db['OpenchannelQueue'][_0x723f('0x4b')](_0x43cbbf[_0x723f('0x4c')],{})[_0x723f('0x26')](function(_0x4dd31d){var _0x5287f5=_0x43cbbf[_0x723f('0x4d')][_0x723f('0x4e')]({'plain':!![]});if(!_0x5287f5)throw new Error(_0x723f('0x4f'));if(_0x5287f5[_0x723f('0x50')]==='user'){var _0x565d77=_0x4dd31d[_0x723f('0x4e')]({'plain':!![]});var _0x4917db='OpenchannelQueues';return db['UserProfileSection']['find']({'where':{'name':_0x4917db,'userProfileId':_0x5287f5[_0x723f('0x51')]},'raw':!![]})[_0x723f('0x26')](function(_0x1706d6){if(_0x1706d6&&_0x1706d6[_0x723f('0x52')]===0x0){return db[_0x723f('0x28')]['create']({'name':_0x565d77[_0x723f('0x2b')],'resourceId':_0x565d77['id'],'type':_0x1706d6[_0x723f('0x2b')],'sectionId':_0x1706d6['id']},{})[_0x723f('0x26')](function(){return _0x4dd31d;});}else{return _0x4dd31d;}})['catch'](function(_0x238c9c){logger[_0x723f('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x238c9c);throw _0x238c9c;});}return _0x4dd31d;})[_0x723f('0x26')](respondWithResult(_0x599c0d,0xc9))[_0x723f('0x46')](handleError(_0x599c0d,null));};exports[_0x723f('0x53')]=function(_0x5ddce0,_0x207b83){if(_0x5ddce0['body']['id']){delete _0x5ddce0[_0x723f('0x4c')]['id'];}return db[_0x723f('0x2f')][_0x723f('0x4a')]({'where':{'id':_0x5ddce0[_0x723f('0x48')]['id']}})[_0x723f('0x26')](handleEntityNotFound(_0x207b83,null))['then'](saveUpdates(_0x5ddce0[_0x723f('0x4c')],null))[_0x723f('0x26')](respondWithResult(_0x207b83,null))[_0x723f('0x46')](handleError(_0x207b83,null));};exports['destroy']=function(_0x31ca21,_0x5ef95d){return db[_0x723f('0x2f')][_0x723f('0x4a')]({'where':{'id':_0x31ca21[_0x723f('0x48')]['id']}})['then'](handleEntityNotFound(_0x5ef95d,null))['then'](removeEntity(_0x5ef95d,null))[_0x723f('0x46')](handleError(_0x5ef95d,null));};exports['describe']=function(_0x1c2e6d,_0x824974){return db[_0x723f('0x2f')]['describe']()[_0x723f('0x26')](respondWithResult(_0x824974,null))['catch'](handleError(_0x824974,null));};exports[_0x723f('0x54')]=function(_0xa32a47,_0x5a2725,_0x495d7f){var _0x5180c5={'raw':!![],'where':{}},_0x200522={},_0x41e608;return db['OpenchannelQueue']['findOne']({'where':{'id':_0xa32a47[_0x723f('0x48')]['id']}})[_0x723f('0x26')](handleEntityNotFound(_0x5a2725,null))[_0x723f('0x26')](function(_0x52207c){if(_0x52207c){_0x41e608=_0x52207c['get']({'plain':!![]});_0x200522[_0x723f('0x32')]=_['keys'](db[_0x723f('0x55')]['rawAttributes']);_0x200522['query']=_['keys'](_0xa32a47[_0x723f('0x33')]);_0x200522[_0x723f('0x35')]=_[_0x723f('0x36')](_0x200522[_0x723f('0x32')],_0x200522[_0x723f('0x33')]);_0x5180c5[_0x723f('0x37')]=_[_0x723f('0x36')](_0x200522['model'],qs[_0x723f('0x38')](_0xa32a47[_0x723f('0x33')]['fields']));_0x5180c5[_0x723f('0x37')]=_0x5180c5['attributes'][_0x723f('0x39')]?_0x5180c5['attributes']:_0x200522[_0x723f('0x32')];if(!_0xa32a47[_0x723f('0x33')][_0x723f('0x3a')](_0x723f('0x3b'))){_0x5180c5['limit']=qs[_0x723f('0x1f')](_0xa32a47[_0x723f('0x33')][_0x723f('0x1f')]);_0x5180c5['offset']=qs['offset'](_0xa32a47[_0x723f('0x33')]['offset']);}_0x5180c5[_0x723f('0x56')]=qs[_0x723f('0x3c')](_0xa32a47[_0x723f('0x33')]['sort']);_0x5180c5['where']=qs[_0x723f('0x35')](_[_0x723f('0x3e')](_0xa32a47[_0x723f('0x33')],_0x200522['filters']));_0x5180c5[_0x723f('0x3d')][_0x723f('0x57')]=_0x52207c['id'];if(_0xa32a47['query'][_0x723f('0x42')]){_0x5180c5[_0x723f('0x3d')]=_['merge'](_0x5180c5['where'],{'$or':_[_0x723f('0x2e')](_0x5180c5[_0x723f('0x37')],function(_0x3e4791){var _0x28f114={};_0x28f114[_0x3e4791]={'$like':'%'+_0xa32a47[_0x723f('0x33')][_0x723f('0x42')]+'%'};return _0x28f114;})});}_0x5180c5=_[_0x723f('0x3f')]({},_0x5180c5,_0xa32a47[_0x723f('0x43')]);return db['UserOpenchannelQueue']['findAll'](_0x5180c5);}})[_0x723f('0x26')](function(_0x49fbe7){if(_0x49fbe7){return db[_0x723f('0x58')]['findAndCountAll']({'where':{'id':_[_0x723f('0x2e')](_0x49fbe7,_0x723f('0x59')),'role':'agent'},'attributes':['id',_0x723f('0x2b'),_0x723f('0x5a'),_0x723f('0x5b'),_0x723f('0x5c')]});}})[_0x723f('0x26')](function(_0x59471b){if(_0x59471b){return{'count':_0x59471b['count'],'rows':_['map'](_0x59471b[_0x723f('0x45')],function(_0x368d3e){return{'membername':_0x368d3e[_0x723f('0x2b')],'UserId':_0x368d3e['id'],'queue_name':_0x41e608[_0x723f('0x2b')],'OpenchannelQueueId':_0x41e608['id'],'interface':util[_0x723f('0x5d')](_0x723f('0x5e'),_0x723f('0x5f'),_0x368d3e[_0x723f('0x2b')]),'penalty':0x0,'paused':_0x368d3e[_0x723f('0x5a')],'createdAt':_0x368d3e['createdAt'],'updatedAt':_0x368d3e[_0x723f('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x723f('0x26')](respondWithFilteredResult(_0x5a2725,_0x5180c5))[_0x723f('0x46')](handleError(_0x5a2725,null));};exports[_0x723f('0x60')]=function(_0xdb4b1d,_0xb989ed,_0x25e772){var _0x146540={};var _0x2a71a3={};var _0x1165b5;var _0x59f686;return db[_0x723f('0x2f')][_0x723f('0x61')]({'where':{'id':_0xdb4b1d['params']['id']}})[_0x723f('0x26')](handleEntityNotFound(_0xb989ed,null))['then'](function(_0x2e8cd2){if(_0x2e8cd2){_0x1165b5=_0x2e8cd2;_0x2a71a3['model']=_[_0x723f('0x34')](db[_0x723f('0x62')][_0x723f('0x30')]);_0x2a71a3['query']=_['keys'](_0xdb4b1d['query']);_0x2a71a3[_0x723f('0x35')]=_[_0x723f('0x36')](_0x2a71a3[_0x723f('0x32')],_0x2a71a3[_0x723f('0x33')]);_0x146540[_0x723f('0x37')]=_['intersection'](_0x2a71a3[_0x723f('0x32')],qs[_0x723f('0x38')](_0xdb4b1d[_0x723f('0x33')][_0x723f('0x38')]));_0x146540[_0x723f('0x37')]=_0x146540[_0x723f('0x37')]['length']?_0x146540['attributes']:_0x2a71a3[_0x723f('0x32')];_0x146540[_0x723f('0x56')]=qs[_0x723f('0x3c')](_0xdb4b1d[_0x723f('0x33')][_0x723f('0x3c')]);_0x146540[_0x723f('0x3d')]=qs[_0x723f('0x35')](_['pick'](_0xdb4b1d['query'],_0x2a71a3[_0x723f('0x35')]));if(_0xdb4b1d[_0x723f('0x33')][_0x723f('0x42')]){_0x146540[_0x723f('0x3d')]=_['merge'](_0x146540['where'],{'$or':_[_0x723f('0x2e')](_0x146540[_0x723f('0x37')],function(_0x46f0b7){var _0x2ffdaa={};_0x2ffdaa[_0x46f0b7]={'$like':'%'+_0xdb4b1d['query'][_0x723f('0x42')]+'%'};return _0x2ffdaa;})});}_0x146540=_[_0x723f('0x3f')]({},_0x146540,_0xdb4b1d[_0x723f('0x43')]);return _0x1165b5[_0x723f('0x60')](_0x146540);}})[_0x723f('0x26')](function(_0x15dc28){if(_0x15dc28){_0x59f686=_0x15dc28[_0x723f('0x39')];if(!_0xdb4b1d[_0x723f('0x33')][_0x723f('0x3a')](_0x723f('0x3b'))){_0x146540[_0x723f('0x1f')]=qs['limit'](_0xdb4b1d['query'][_0x723f('0x1f')]);_0x146540[_0x723f('0x1c')]=qs['offset'](_0xdb4b1d[_0x723f('0x33')][_0x723f('0x1c')]);}return _0x1165b5[_0x723f('0x60')](_0x146540);}})[_0x723f('0x26')](function(_0x37386d){if(_0x37386d){return _0x37386d?{'count':_0x59f686,'rows':_0x37386d}:null;}})['then'](respondWithResult(_0xb989ed,null))[_0x723f('0x46')](handleError(_0xb989ed,null));};exports[_0x723f('0x63')]=function(_0x1dffb8,_0x316ebd,_0x51fd70){var _0x7e1bb0=_0x1dffb8[_0x723f('0x4c')]['ids'];return db[_0x723f('0x62')][_0x723f('0x64')]({'where':{'id':_0x7e1bb0},'attributes':['id'],'include':[{'model':db[_0x723f('0x58')],'as':_0x723f('0x65'),'attributes':['id',_0x723f('0x2b'),_0x723f('0x66'),_0x723f('0x67'),'interface'],'raw':!![]}]})[_0x723f('0x26')](function(_0x510ad6){if(_0x510ad6){var _0x30f6a0=_[_0x723f('0x68')](_0x510ad6,function(_0x3742a3){var _0x393f5b=_0x3742a3['get']({'plain':!![]});return _0x393f5b[_0x723f('0x65')];});return db[_0x723f('0x2f')][_0x723f('0x4a')]({'where':{'id':_0x1dffb8[_0x723f('0x48')]['id']}})[_0x723f('0x26')](function(_0x37e84a){return db[_0x723f('0x69')][_0x723f('0x6a')](function(_0x46c0d2){return _0x37e84a[_0x723f('0x63')](_0x7e1bb0,{'transaction':_0x46c0d2})[_0x723f('0x26')](function(){return BPromise[_0x723f('0x6b')](_0x30f6a0,function(_0x18c9aa){return db[_0x723f('0x55')]['findOrCreate']({'where':{'UserId':_0x18c9aa['id'],'OpenchannelQueueId':_0x1dffb8[_0x723f('0x48')]['id']},'transaction':_0x46c0d2});});})['then'](function(){_0x30f6a0['forEach'](function(_0x575225){socket[_0x723f('0x6c')]('userOpenchannelQueue:save',{'UserId':_0x575225['id'],'OpenchannelQueueId':_0x37e84a['id']});});});});});}})[_0x723f('0x26')](respondWithStatusCode(_0x316ebd,null))[_0x723f('0x46')](handleError(_0x316ebd,null));};exports[_0x723f('0x6d')]=function(_0x5aad52,_0x2626d9,_0x291805){return db[_0x723f('0x62')][_0x723f('0x64')]({'where':{'id':_0x5aad52[_0x723f('0x33')][_0x723f('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x723f('0x58')],'as':_0x723f('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2626d9,null))[_0x723f('0x26')](function(_0x2a0d62){var _0x658ddc=_[_0x723f('0x2e')](_0x2a0d62,'id');var _0x2749f9=[];var _0x55ec8d=[];var _0x58e1b9=squel[_0x723f('0x6f')]();_0x58e1b9[_0x723f('0x70')](_0x723f('0x71'))['from'](_0x723f('0x72'),'tq')[_0x723f('0x73')](_0x723f('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x723f('0x3d')](_0x723f('0x75'),_0x5aad52['params']['id']);for(var _0x9d67b0=0x0;_0x9d67b0<_0x2a0d62['length'];_0x9d67b0+=0x1){let _0x2576b8=_0x2a0d62[_0x9d67b0];for(var _0x29c927=0x0;_0x29c927<_0x2576b8['Agents'][_0x723f('0x39')];_0x29c927+=0x1){let _0x3bf3c6=_0x2576b8[_0x723f('0x65')][_0x29c927];var _0x554835=_0x58e1b9[_0x723f('0x76')]();_0x554835[_0x723f('0x3d')]('ut.UserId\x20=\x20?',_0x3bf3c6['id']);_0x55ec8d[_0x723f('0x77')](db[_0x723f('0x69')][_0x723f('0x33')](_0x554835[_0x723f('0x78')](),{'type':db['sequelize'][_0x723f('0x79')][_0x723f('0x7a')]})[_0x723f('0x26')](function(_0x404ef1){if(_0x404ef1[_0x723f('0x39')]===0x1){return _0x3bf3c6['id'];}else{var _0xf21d96=_[_0x723f('0x7b')](_[_0x723f('0x2e')](_0x404ef1,'TeamId'),function(_0x1f130e){return _[_0x723f('0x7c')](_0x658ddc,_0x1f130e);});if(_0xf21d96){return _0x3bf3c6['id'];}}}));}}return BPromise[_0x723f('0x7d')](_0x55ec8d)[_0x723f('0x26')](function(_0x543da9){_0x2749f9=_(_0x2749f9)[_0x723f('0x7e')](_0x543da9)[_0x723f('0x7f')]()[_0x723f('0x80')]();return db[_0x723f('0x2f')]['find']({'where':{'id':_0x5aad52['params']['id']}})[_0x723f('0x26')](function(_0x17205f){return db['sequelize'][_0x723f('0x6a')](function(_0x5f3ae1){return _0x17205f['removeTeams'](_0x5aad52['query'][_0x723f('0x6e')],{'transaction':_0x5f3ae1})[_0x723f('0x26')](function(){if(!_[_0x723f('0x81')](_0x2749f9)){return _0x17205f[_0x723f('0x82')](_0x2749f9,{'transaction':_0x5f3ae1});}})[_0x723f('0x26')](function(){_0x2749f9[_0x723f('0x83')](function(_0x59f2c1){socket[_0x723f('0x6c')]('userOpenchannelQueue:remove',{'UserId':_0x59f2c1,'OpenchannelQueueId':_0x17205f['id']});});});});});});})[_0x723f('0x26')](respondWithStatusCode(_0x2626d9,null))[_0x723f('0x46')](handleError(_0x2626d9,null));};exports[_0x723f('0x84')]=function(_0x51a52c,_0x43358b,_0x3a1962){return db[_0x723f('0x2f')][_0x723f('0x4a')]({'where':{'id':_0x51a52c[_0x723f('0x48')]['id']}})[_0x723f('0x26')](handleEntityNotFound(_0x43358b,null))['then'](function(_0x49ddd4){if(_0x49ddd4){return _0x49ddd4[_0x723f('0x84')](_0x51a52c[_0x723f('0x4c')]['ids'],_[_0x723f('0x85')](_0x51a52c[_0x723f('0x4c')],[_0x723f('0x6e'),'id'])||{})[_0x723f('0x86')](function(_0x2d8d8c){for(var _0x25a5a7=0x0;_0x25a5a7<_0x51a52c['body'][_0x723f('0x6e')][_0x723f('0x39')];_0x25a5a7+=0x1){socket[_0x723f('0x6c')](_0x723f('0x87'),{'UserId':Number(_0x51a52c[_0x723f('0x4c')][_0x723f('0x6e')][_0x25a5a7]),'OpenchannelQueueId':Number(_0x51a52c['params']['id'])});}return _0x2d8d8c;});}})[_0x723f('0x26')](respondWithResult(_0x43358b,null))['catch'](handleError(_0x43358b,null));};exports[_0x723f('0x82')]=function(_0x38cbac,_0x4602f8,_0x39f84f){return db[_0x723f('0x2f')][_0x723f('0x4a')]({'where':{'id':_0x38cbac[_0x723f('0x48')]['id']}})[_0x723f('0x26')](handleEntityNotFound(_0x4602f8,null))[_0x723f('0x26')](function(_0x988101){if(_0x988101){return _0x988101[_0x723f('0x82')](_0x38cbac['query'][_0x723f('0x6e')])[_0x723f('0x26')](function(){if(_[_0x723f('0x88')](_0x38cbac[_0x723f('0x33')][_0x723f('0x6e')])){for(var _0x41de7b=0x0;_0x41de7b<_0x38cbac[_0x723f('0x33')][_0x723f('0x6e')][_0x723f('0x39')];_0x41de7b+=0x1){socket[_0x723f('0x6c')](_0x723f('0x89'),{'UserId':Number(_0x38cbac['query'][_0x723f('0x6e')][_0x41de7b]),'OpenchannelQueueId':Number(_0x38cbac[_0x723f('0x48')]['id'])});}}else{socket[_0x723f('0x6c')](_0x723f('0x89'),{'UserId':Number(_0x38cbac[_0x723f('0x33')]['ids']),'OpenchannelQueueId':Number(_0x38cbac[_0x723f('0x48')]['id'])});}});}})[_0x723f('0x26')](respondWithStatusCode(_0x4602f8,null))[_0x723f('0x46')](handleError(_0x4602f8,null));};exports[_0x723f('0x8a')]=function(_0xc5b2e4,_0x40a270,_0x59afcd){var _0x9c96e7={};var _0x1b821c={};var _0x25bd36;var _0x1892c3;return db[_0x723f('0x2f')][_0x723f('0x61')]({'where':{'id':_0xc5b2e4[_0x723f('0x48')]['id']}})[_0x723f('0x26')](handleEntityNotFound(_0x40a270,null))[_0x723f('0x26')](function(_0x334d4b){if(_0x334d4b){_0x25bd36=_0x334d4b;_0x1b821c[_0x723f('0x32')]=_['keys'](db[_0x723f('0x58')][_0x723f('0x30')]);_0x1b821c['query']=_[_0x723f('0x34')](_0xc5b2e4[_0x723f('0x33')]);_0x1b821c[_0x723f('0x35')]=_[_0x723f('0x36')](_0x1b821c[_0x723f('0x32')],_0x1b821c[_0x723f('0x33')]);_0x9c96e7[_0x723f('0x37')]=_[_0x723f('0x36')](_0x1b821c['model'],qs[_0x723f('0x38')](_0xc5b2e4[_0x723f('0x33')]['fields']));_0x9c96e7[_0x723f('0x37')]=_0x9c96e7[_0x723f('0x37')][_0x723f('0x39')]?_0x9c96e7[_0x723f('0x37')]:_0x1b821c[_0x723f('0x32')];_0x9c96e7['order']=qs[_0x723f('0x3c')](_0xc5b2e4['query'][_0x723f('0x3c')]);_0x9c96e7[_0x723f('0x3d')]=qs[_0x723f('0x35')](_[_0x723f('0x3e')](_0xc5b2e4[_0x723f('0x33')],_0x1b821c[_0x723f('0x35')]));if(_0xc5b2e4[_0x723f('0x33')][_0x723f('0x42')]){_0x9c96e7[_0x723f('0x3d')]=_[_0x723f('0x3f')](_0x9c96e7['where'],{'$or':_[_0x723f('0x2e')](_0x9c96e7[_0x723f('0x37')],function(_0x570b77){var _0x4be654={};_0x4be654[_0x570b77]={'$like':'%'+_0xc5b2e4['query'][_0x723f('0x42')]+'%'};return _0x4be654;})});}_0x9c96e7=_[_0x723f('0x3f')]({},_0x9c96e7,_0xc5b2e4['options']);return _0x25bd36[_0x723f('0x8a')](_0x9c96e7);}})['then'](function(_0x178bf3){if(_0x178bf3){_0x1892c3=_0x178bf3[_0x723f('0x39')];if(!_0xc5b2e4['query']['hasOwnProperty'](_0x723f('0x3b'))){_0x9c96e7[_0x723f('0x1f')]=qs['limit'](_0xc5b2e4[_0x723f('0x33')][_0x723f('0x1f')]);_0x9c96e7[_0x723f('0x1c')]=qs['offset'](_0xc5b2e4['query']['offset']);}return _0x25bd36[_0x723f('0x8a')](_0x9c96e7);}})[_0x723f('0x26')](function(_0x5eb6b8){if(_0x5eb6b8){return _0x5eb6b8?{'count':_0x1892c3,'rows':_0x5eb6b8}:null;}})['then'](respondWithResult(_0x40a270,null))[_0x723f('0x46')](handleError(_0x40a270,null));}; \ No newline at end of file +var _0x0660=['includeAll','findAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','pick','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Team','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','getAgents','rimraf','moment','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','options'];(function(_0x35e19d,_0x57ccef){var _0x5b87c6=function(_0x422ff7){while(--_0x422ff7){_0x35e19d['push'](_0x35e19d['shift']());}};_0x5b87c6(++_0x57ccef);}(_0x0660,0x162));var _0x0066=function(_0x16ae78,_0x53e2e9){_0x16ae78=_0x16ae78-0x0;var _0x79cee9=_0x0660[_0x16ae78];return _0x79cee9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0066('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0066('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x0066('0x2'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0066('0x3'));var fs=require('fs');var fs_extra=require(_0x0066('0x4'));var _=require(_0x0066('0x5'));var squel=require(_0x0066('0x6'));var crypto=require(_0x0066('0x7'));var jsforce=require(_0x0066('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0066('0x9'));var Redis=require(_0x0066('0xa'));var authService=require(_0x0066('0xb'));var qs=require(_0x0066('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0066('0xd'));var logger=require('../../config/logger')(_0x0066('0xe'));var utils=require(_0x0066('0xf'));var config=require(_0x0066('0x10'));var licenseUtil=require(_0x0066('0x11'));var db=require(_0x0066('0x12'))['db'];config[_0x0066('0x13')]=_[_0x0066('0x14')](config[_0x0066('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x0066('0x15'))(new Redis(config[_0x0066('0x13')]));require(_0x0066('0x16'))['register'](socket);function respondWithStatusCode(_0x10ed33,_0x435e97){_0x435e97=_0x435e97||0xcc;return function(_0x81bb4d){if(_0x81bb4d){return _0x10ed33[_0x0066('0x17')](_0x435e97);}return _0x10ed33['status'](_0x435e97)[_0x0066('0x18')]();};}function respondWithResult(_0x3999a6,_0x453054){_0x453054=_0x453054||0xc8;return function(_0x38b75c){if(_0x38b75c){return _0x3999a6[_0x0066('0x19')](_0x453054)[_0x0066('0x1a')](_0x38b75c);}};}function respondWithFilteredResult(_0x2fa0f0,_0x51de6d){return function(_0x424793){if(_0x424793){var _0x3972f1=typeof _0x51de6d[_0x0066('0x1b')]===_0x0066('0x1c')&&typeof _0x51de6d[_0x0066('0x1d')]===_0x0066('0x1c');var _0x239509=_0x424793[_0x0066('0x1e')];var _0x52c6f0=_0x3972f1?0x0:_0x51de6d[_0x0066('0x1b')];var _0xd4c869=_0x3972f1?_0x424793[_0x0066('0x1e')]:_0x51de6d[_0x0066('0x1b')]+_0x51de6d[_0x0066('0x1d')];var _0x5a538a;if(_0xd4c869>=_0x239509){_0xd4c869=_0x239509;_0x5a538a=0xc8;}else{_0x5a538a=0xce;}_0x2fa0f0['status'](_0x5a538a);return _0x2fa0f0[_0x0066('0x1f')](_0x0066('0x20'),_0x52c6f0+'-'+_0xd4c869+'/'+_0x239509)[_0x0066('0x1a')](_0x424793);}return null;};}function patchUpdates(_0x2a45f9){return function(_0x487276){try{jsonpatch[_0x0066('0x21')](_0x487276,_0x2a45f9,!![]);}catch(_0x508087){return BPromise[_0x0066('0x22')](_0x508087);}return _0x487276[_0x0066('0x23')]();};}function saveUpdates(_0x20ef9d,_0x3b2a71){return function(_0x30223e){if(_0x30223e){return _0x30223e[_0x0066('0x24')](_0x20ef9d)[_0x0066('0x25')](function(_0x2d98d3){return _0x2d98d3;});}return null;};}function removeEntity(_0x5cf931,_0xa33585){return function(_0x4b2858){if(_0x4b2858){return _0x4b2858[_0x0066('0x26')]()[_0x0066('0x25')](function(){var _0x5d5a89=_0x4b2858[_0x0066('0x27')]({'plain':!![]});var _0x584d6f='OpenchannelQueues';return db[_0x0066('0x28')][_0x0066('0x26')]({'where':{'type':_0x584d6f,'resourceId':_0x5d5a89['id']}})[_0x0066('0x25')](function(){return _0x4b2858;});})[_0x0066('0x25')](function(){_0x5cf931[_0x0066('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc94154,_0x2ed208){return function(_0x1842a3){if(!_0x1842a3){_0xc94154[_0x0066('0x17')](0x194);}return _0x1842a3;};}function handleError(_0x102e8c,_0x8a378e){_0x8a378e=_0x8a378e||0x1f4;return function(_0x16e13c){logger['error'](_0x16e13c[_0x0066('0x29')]);if(_0x16e13c[_0x0066('0x2a')]){delete _0x16e13c[_0x0066('0x2a')];}_0x102e8c[_0x0066('0x19')](_0x8a378e)[_0x0066('0x2b')](_0x16e13c);};}exports[_0x0066('0x2c')]=function(_0x3fd1ee,_0xdd6f25){var _0x5eec12={},_0x4a534f={},_0x42ffac={'count':0x0,'rows':[]};var _0x2fbd51=_[_0x0066('0x2d')](db[_0x0066('0x2e')][_0x0066('0x2f')],function(_0x9b0e36){return{'name':_0x9b0e36[_0x0066('0x30')],'type':_0x9b0e36[_0x0066('0x31')][_0x0066('0x32')]};});_0x4a534f[_0x0066('0x33')]=_[_0x0066('0x2d')](_0x2fbd51,_0x0066('0x2a'));_0x4a534f[_0x0066('0x34')]=_[_0x0066('0x35')](_0x3fd1ee['query']);_0x4a534f[_0x0066('0x36')]=_['intersection'](_0x4a534f[_0x0066('0x33')],_0x4a534f[_0x0066('0x34')]);_0x5eec12['attributes']=_[_0x0066('0x37')](_0x4a534f['model'],qs[_0x0066('0x38')](_0x3fd1ee[_0x0066('0x34')][_0x0066('0x38')]));_0x5eec12[_0x0066('0x39')]=_0x5eec12[_0x0066('0x39')]['length']?_0x5eec12[_0x0066('0x39')]:_0x4a534f[_0x0066('0x33')];if(!_0x3fd1ee['query'][_0x0066('0x3a')](_0x0066('0x3b'))){_0x5eec12[_0x0066('0x1d')]=qs[_0x0066('0x1d')](_0x3fd1ee[_0x0066('0x34')][_0x0066('0x1d')]);_0x5eec12[_0x0066('0x1b')]=qs[_0x0066('0x1b')](_0x3fd1ee[_0x0066('0x34')][_0x0066('0x1b')]);}_0x5eec12[_0x0066('0x3c')]=qs[_0x0066('0x3d')](_0x3fd1ee['query'][_0x0066('0x3d')]);_0x5eec12['where']=qs['filters'](_['pick'](_0x3fd1ee[_0x0066('0x34')],_0x4a534f[_0x0066('0x36')]),_0x2fbd51);if(_0x3fd1ee[_0x0066('0x34')]['filter']){_0x5eec12[_0x0066('0x3e')]=_[_0x0066('0x3f')](_0x5eec12[_0x0066('0x3e')],{'$or':_[_0x0066('0x2d')](_0x2fbd51,function(_0x5e100e){if(_0x5e100e[_0x0066('0x31')]!=='VIRTUAL'){var _0x4d9c01={};_0x4d9c01[_0x5e100e[_0x0066('0x2a')]]={'$like':'%'+_0x3fd1ee[_0x0066('0x34')][_0x0066('0x40')]+'%'};return _0x4d9c01;}})});}_0x5eec12=_[_0x0066('0x3f')]({},_0x5eec12,_0x3fd1ee[_0x0066('0x41')]);var _0x405aed={'where':_0x5eec12[_0x0066('0x3e')]};return db[_0x0066('0x2e')]['count'](_0x405aed)[_0x0066('0x25')](function(_0x1fc420){_0x42ffac[_0x0066('0x1e')]=_0x1fc420;if(_0x3fd1ee['query'][_0x0066('0x42')]){_0x5eec12['include']=[{'all':!![]}];}return db[_0x0066('0x2e')][_0x0066('0x43')](_0x5eec12);})[_0x0066('0x25')](function(_0x5b2a45){_0x42ffac[_0x0066('0x44')]=_0x5b2a45;return _0x42ffac;})['then'](respondWithFilteredResult(_0xdd6f25,_0x5eec12))[_0x0066('0x45')](handleError(_0xdd6f25,null));};exports[_0x0066('0x46')]=function(_0x3e0319,_0x31122f){var _0x1d238d={'raw':!![],'where':{'id':_0x3e0319['params']['id']}},_0x2dd567={};_0x2dd567[_0x0066('0x33')]=_['keys'](db[_0x0066('0x2e')][_0x0066('0x2f')]);_0x2dd567[_0x0066('0x34')]=_[_0x0066('0x35')](_0x3e0319[_0x0066('0x34')]);_0x2dd567[_0x0066('0x36')]=_[_0x0066('0x37')](_0x2dd567['model'],_0x2dd567['query']);_0x1d238d[_0x0066('0x39')]=_[_0x0066('0x37')](_0x2dd567[_0x0066('0x33')],qs['fields'](_0x3e0319[_0x0066('0x34')][_0x0066('0x38')]));_0x1d238d[_0x0066('0x39')]=_0x1d238d[_0x0066('0x39')][_0x0066('0x47')]?_0x1d238d['attributes']:_0x2dd567[_0x0066('0x33')];if(_0x3e0319['query'][_0x0066('0x42')]){_0x1d238d[_0x0066('0x48')]=[{'all':!![]}];}_0x1d238d=_[_0x0066('0x3f')]({},_0x1d238d,_0x3e0319[_0x0066('0x41')]);return db[_0x0066('0x2e')][_0x0066('0x49')](_0x1d238d)['then'](handleEntityNotFound(_0x31122f,null))[_0x0066('0x25')](respondWithResult(_0x31122f,null))[_0x0066('0x45')](handleError(_0x31122f,null));};exports[_0x0066('0x4a')]=function(_0x35d7a7,_0x4dff7d){return db[_0x0066('0x2e')]['create'](_0x35d7a7['body'],{})[_0x0066('0x25')](function(_0x4cd7c3){var _0x419dac=_0x35d7a7['user']['get']({'plain':!![]});if(!_0x419dac)throw new Error(_0x0066('0x4b'));if(_0x419dac[_0x0066('0x4c')]==='user'){var _0x7238b2=_0x4cd7c3[_0x0066('0x27')]({'plain':!![]});var _0x53e2ee=_0x0066('0x4d');return db[_0x0066('0x4e')]['find']({'where':{'name':_0x53e2ee,'userProfileId':_0x419dac[_0x0066('0x4f')]},'raw':!![]})[_0x0066('0x25')](function(_0x55fbb0){if(_0x55fbb0&&_0x55fbb0[_0x0066('0x50')]===0x0){return db[_0x0066('0x28')]['create']({'name':_0x7238b2['name'],'resourceId':_0x7238b2['id'],'type':_0x55fbb0['name'],'sectionId':_0x55fbb0['id']},{})['then'](function(){return _0x4cd7c3;});}else{return _0x4cd7c3;}})[_0x0066('0x45')](function(_0x4c17da){logger[_0x0066('0x51')](_0x0066('0x52'),_0x4c17da);throw _0x4c17da;});}return _0x4cd7c3;})['then'](respondWithResult(_0x4dff7d,0xc9))[_0x0066('0x45')](handleError(_0x4dff7d,null));};exports[_0x0066('0x24')]=function(_0x312ca6,_0x4fd0ed){if(_0x312ca6[_0x0066('0x53')]['id']){delete _0x312ca6[_0x0066('0x53')]['id'];}return db[_0x0066('0x2e')][_0x0066('0x49')]({'where':{'id':_0x312ca6[_0x0066('0x54')]['id']}})['then'](handleEntityNotFound(_0x4fd0ed,null))[_0x0066('0x25')](saveUpdates(_0x312ca6[_0x0066('0x53')],null))[_0x0066('0x25')](respondWithResult(_0x4fd0ed,null))[_0x0066('0x45')](handleError(_0x4fd0ed,null));};exports[_0x0066('0x26')]=function(_0x4851b5,_0x381ec7){return db[_0x0066('0x2e')][_0x0066('0x49')]({'where':{'id':_0x4851b5[_0x0066('0x54')]['id']}})['then'](handleEntityNotFound(_0x381ec7,null))['then'](removeEntity(_0x381ec7,null))['catch'](handleError(_0x381ec7,null));};exports[_0x0066('0x55')]=function(_0x5b9af4,_0x12d02d){return db[_0x0066('0x2e')][_0x0066('0x55')]()[_0x0066('0x25')](respondWithResult(_0x12d02d,null))['catch'](handleError(_0x12d02d,null));};exports[_0x0066('0x56')]=function(_0x2c5e4d,_0x4e3e78,_0x4fdc03){var _0x515352={'raw':!![],'where':{}},_0x43545c={},_0xac0a4d;return db[_0x0066('0x2e')][_0x0066('0x57')]({'where':{'id':_0x2c5e4d['params']['id']}})[_0x0066('0x25')](handleEntityNotFound(_0x4e3e78,null))['then'](function(_0x18e00d){if(_0x18e00d){_0xac0a4d=_0x18e00d[_0x0066('0x27')]({'plain':!![]});_0x43545c[_0x0066('0x33')]=_[_0x0066('0x35')](db['UserOpenchannelQueue'][_0x0066('0x2f')]);_0x43545c[_0x0066('0x34')]=_[_0x0066('0x35')](_0x2c5e4d[_0x0066('0x34')]);_0x43545c[_0x0066('0x36')]=_[_0x0066('0x37')](_0x43545c[_0x0066('0x33')],_0x43545c[_0x0066('0x34')]);_0x515352[_0x0066('0x39')]=_[_0x0066('0x37')](_0x43545c[_0x0066('0x33')],qs[_0x0066('0x38')](_0x2c5e4d['query'][_0x0066('0x38')]));_0x515352[_0x0066('0x39')]=_0x515352[_0x0066('0x39')][_0x0066('0x47')]?_0x515352[_0x0066('0x39')]:_0x43545c['model'];if(!_0x2c5e4d[_0x0066('0x34')][_0x0066('0x3a')](_0x0066('0x3b'))){_0x515352[_0x0066('0x1d')]=qs[_0x0066('0x1d')](_0x2c5e4d[_0x0066('0x34')]['limit']);_0x515352[_0x0066('0x1b')]=qs['offset'](_0x2c5e4d[_0x0066('0x34')][_0x0066('0x1b')]);}_0x515352[_0x0066('0x3c')]=qs[_0x0066('0x3d')](_0x2c5e4d['query'][_0x0066('0x3d')]);_0x515352[_0x0066('0x3e')]=qs['filters'](_[_0x0066('0x58')](_0x2c5e4d[_0x0066('0x34')],_0x43545c[_0x0066('0x36')]));_0x515352['where'][_0x0066('0x59')]=_0x18e00d['id'];if(_0x2c5e4d[_0x0066('0x34')][_0x0066('0x40')]){_0x515352[_0x0066('0x3e')]=_['merge'](_0x515352[_0x0066('0x3e')],{'$or':_[_0x0066('0x2d')](_0x515352[_0x0066('0x39')],function(_0x27a5cf){var _0x5395b6={};_0x5395b6[_0x27a5cf]={'$like':'%'+_0x2c5e4d[_0x0066('0x34')][_0x0066('0x40')]+'%'};return _0x5395b6;})});}_0x515352=_[_0x0066('0x3f')]({},_0x515352,_0x2c5e4d[_0x0066('0x41')]);return db[_0x0066('0x5a')][_0x0066('0x43')](_0x515352);}})['then'](function(_0x22e3f9){if(_0x22e3f9){return db[_0x0066('0x5b')][_0x0066('0x5c')]({'where':{'id':_[_0x0066('0x2d')](_0x22e3f9,_0x0066('0x5d')),'role':_0x0066('0x5e')},'attributes':['id',_0x0066('0x2a'),_0x0066('0x5f'),_0x0066('0x60'),_0x0066('0x61')]});}})['then'](function(_0x428bb3){if(_0x428bb3){return{'count':_0x428bb3[_0x0066('0x1e')],'rows':_[_0x0066('0x2d')](_0x428bb3['rows'],function(_0x7c9149){return{'membername':_0x7c9149['name'],'UserId':_0x7c9149['id'],'queue_name':_0xac0a4d[_0x0066('0x2a')],'OpenchannelQueueId':_0xac0a4d['id'],'interface':util[_0x0066('0x62')](_0x0066('0x63'),_0x0066('0x64'),_0x7c9149[_0x0066('0x2a')]),'penalty':0x0,'paused':_0x7c9149[_0x0066('0x5f')],'createdAt':_0x7c9149[_0x0066('0x61')],'updatedAt':_0x7c9149[_0x0066('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0066('0x25')](respondWithFilteredResult(_0x4e3e78,_0x515352))[_0x0066('0x45')](handleError(_0x4e3e78,null));};exports[_0x0066('0x65')]=function(_0x57aa38,_0x150d02,_0x5a3be0){var _0xdf9983={};var _0x509b7c={};var _0x3e84d5;var _0x26c5f6;return db[_0x0066('0x2e')][_0x0066('0x57')]({'where':{'id':_0x57aa38[_0x0066('0x54')]['id']}})['then'](handleEntityNotFound(_0x150d02,null))[_0x0066('0x25')](function(_0x310f55){if(_0x310f55){_0x3e84d5=_0x310f55;_0x509b7c[_0x0066('0x33')]=_['keys'](db['Team'][_0x0066('0x2f')]);_0x509b7c[_0x0066('0x34')]=_[_0x0066('0x35')](_0x57aa38[_0x0066('0x34')]);_0x509b7c['filters']=_['intersection'](_0x509b7c[_0x0066('0x33')],_0x509b7c[_0x0066('0x34')]);_0xdf9983[_0x0066('0x39')]=_[_0x0066('0x37')](_0x509b7c[_0x0066('0x33')],qs[_0x0066('0x38')](_0x57aa38['query'][_0x0066('0x38')]));_0xdf9983[_0x0066('0x39')]=_0xdf9983[_0x0066('0x39')]['length']?_0xdf9983[_0x0066('0x39')]:_0x509b7c['model'];_0xdf9983['order']=qs['sort'](_0x57aa38[_0x0066('0x34')][_0x0066('0x3d')]);_0xdf9983['where']=qs[_0x0066('0x36')](_['pick'](_0x57aa38['query'],_0x509b7c['filters']));if(_0x57aa38[_0x0066('0x34')][_0x0066('0x40')]){_0xdf9983[_0x0066('0x3e')]=_[_0x0066('0x3f')](_0xdf9983[_0x0066('0x3e')],{'$or':_['map'](_0xdf9983['attributes'],function(_0x46728b){var _0x16a03d={};_0x16a03d[_0x46728b]={'$like':'%'+_0x57aa38[_0x0066('0x34')]['filter']+'%'};return _0x16a03d;})});}_0xdf9983=_[_0x0066('0x3f')]({},_0xdf9983,_0x57aa38['options']);return _0x3e84d5[_0x0066('0x65')](_0xdf9983);}})[_0x0066('0x25')](function(_0x247d0d){if(_0x247d0d){_0x26c5f6=_0x247d0d[_0x0066('0x47')];if(!_0x57aa38[_0x0066('0x34')][_0x0066('0x3a')](_0x0066('0x3b'))){_0xdf9983[_0x0066('0x1d')]=qs[_0x0066('0x1d')](_0x57aa38['query']['limit']);_0xdf9983[_0x0066('0x1b')]=qs[_0x0066('0x1b')](_0x57aa38[_0x0066('0x34')][_0x0066('0x1b')]);}return _0x3e84d5[_0x0066('0x65')](_0xdf9983);}})[_0x0066('0x25')](function(_0xf6a305){if(_0xf6a305){return _0xf6a305?{'count':_0x26c5f6,'rows':_0xf6a305}:null;}})['then'](respondWithResult(_0x150d02,null))[_0x0066('0x45')](handleError(_0x150d02,null));};exports[_0x0066('0x66')]=function(_0x37d492,_0x449bd9,_0x590323){var _0x54bc92=_0x37d492['body'][_0x0066('0x67')];return db['Team'][_0x0066('0x43')]({'where':{'id':_0x54bc92},'attributes':['id'],'include':[{'model':db[_0x0066('0x5b')],'as':_0x0066('0x68'),'attributes':['id',_0x0066('0x2a'),'online',_0x0066('0x69'),'interface'],'raw':!![]}]})[_0x0066('0x25')](function(_0x1b9262){if(_0x1b9262){var _0x31bf18=_[_0x0066('0x6a')](_0x1b9262,function(_0x2656fb){var _0x305c2c=_0x2656fb[_0x0066('0x27')]({'plain':!![]});return _0x305c2c[_0x0066('0x68')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x37d492[_0x0066('0x54')]['id']}})['then'](function(_0x53af6d){return db[_0x0066('0x6b')][_0x0066('0x6c')](function(_0x1ed7ec){return _0x53af6d['addTeams'](_0x54bc92,{'transaction':_0x1ed7ec})[_0x0066('0x25')](function(){return BPromise[_0x0066('0x6d')](_0x31bf18,function(_0x2f06d5){return db[_0x0066('0x5a')][_0x0066('0x6e')]({'where':{'UserId':_0x2f06d5['id'],'OpenchannelQueueId':_0x37d492[_0x0066('0x54')]['id']},'transaction':_0x1ed7ec});});})[_0x0066('0x25')](function(){_0x31bf18[_0x0066('0x6f')](function(_0x379f2d){socket[_0x0066('0x70')](_0x0066('0x71'),{'UserId':_0x379f2d['id'],'OpenchannelQueueId':_0x53af6d['id']});});});});});}})['then'](respondWithStatusCode(_0x449bd9,null))[_0x0066('0x45')](handleError(_0x449bd9,null));};exports[_0x0066('0x72')]=function(_0x20e74b,_0x5e5391,_0x6df605){return db[_0x0066('0x73')][_0x0066('0x43')]({'where':{'id':_0x20e74b['query'][_0x0066('0x67')]},'attributes':['id'],'include':[{'model':db[_0x0066('0x5b')],'as':_0x0066('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5e5391,null))[_0x0066('0x25')](function(_0x27a73d){var _0x15fcb1=_[_0x0066('0x2d')](_0x27a73d,'id');var _0x3d2649=[];var _0x4b69cb=[];var _0x131a5e=squel['select']();_0x131a5e[_0x0066('0x74')]('tq.TeamId')[_0x0066('0x75')](_0x0066('0x76'),'tq')[_0x0066('0x77')](_0x0066('0x78'),'ut',_0x0066('0x79'))[_0x0066('0x3e')](_0x0066('0x7a'),_0x20e74b[_0x0066('0x54')]['id']);for(var _0x46e106=0x0;_0x46e106<_0x27a73d['length'];_0x46e106+=0x1){let _0x15ac44=_0x27a73d[_0x46e106];for(var _0x37a337=0x0;_0x37a337<_0x15ac44[_0x0066('0x68')]['length'];_0x37a337+=0x1){let _0x2f3e02=_0x15ac44[_0x0066('0x68')][_0x37a337];var _0x1ac592=_0x131a5e[_0x0066('0x7b')]();_0x1ac592[_0x0066('0x3e')](_0x0066('0x7c'),_0x2f3e02['id']);_0x4b69cb[_0x0066('0x7d')](db[_0x0066('0x6b')]['query'](_0x1ac592[_0x0066('0x7e')](),{'type':db['sequelize'][_0x0066('0x7f')][_0x0066('0x80')]})[_0x0066('0x25')](function(_0x287e75){if(_0x287e75[_0x0066('0x47')]===0x1){return _0x2f3e02['id'];}else{var _0x324c48=_['every'](_[_0x0066('0x2d')](_0x287e75,_0x0066('0x81')),function(_0x3ccd95){return _['includes'](_0x15fcb1,_0x3ccd95);});if(_0x324c48){return _0x2f3e02['id'];}}}));}}return BPromise[_0x0066('0x82')](_0x4b69cb)['then'](function(_0x761d6f){_0x3d2649=_(_0x3d2649)[_0x0066('0x83')](_0x761d6f)[_0x0066('0x84')]()[_0x0066('0x85')]();return db['OpenchannelQueue'][_0x0066('0x49')]({'where':{'id':_0x20e74b[_0x0066('0x54')]['id']}})[_0x0066('0x25')](function(_0x343fd6){return db[_0x0066('0x6b')]['transaction'](function(_0x1ca352){return _0x343fd6[_0x0066('0x72')](_0x20e74b[_0x0066('0x34')][_0x0066('0x67')],{'transaction':_0x1ca352})['then'](function(){if(!_[_0x0066('0x86')](_0x3d2649)){return _0x343fd6[_0x0066('0x87')](_0x3d2649,{'transaction':_0x1ca352});}})[_0x0066('0x25')](function(){_0x3d2649[_0x0066('0x6f')](function(_0x5faf5b){socket['emit'](_0x0066('0x88'),{'UserId':_0x5faf5b,'OpenchannelQueueId':_0x343fd6['id']});});});});});});})[_0x0066('0x25')](respondWithStatusCode(_0x5e5391,null))[_0x0066('0x45')](handleError(_0x5e5391,null));};exports[_0x0066('0x89')]=function(_0x4ca907,_0x4c2b31,_0x3778cf){return db[_0x0066('0x2e')][_0x0066('0x49')]({'where':{'id':_0x4ca907['params']['id']}})[_0x0066('0x25')](handleEntityNotFound(_0x4c2b31,null))[_0x0066('0x25')](function(_0x296027){if(_0x296027){return _0x296027[_0x0066('0x89')](_0x4ca907[_0x0066('0x53')]['ids'],_[_0x0066('0x8a')](_0x4ca907['body'],['ids','id'])||{})['spread'](function(_0xcc13a9){for(var _0x23143f=0x0;_0x23143f<_0x4ca907[_0x0066('0x53')][_0x0066('0x67')]['length'];_0x23143f+=0x1){socket[_0x0066('0x70')](_0x0066('0x71'),{'UserId':Number(_0x4ca907['body'][_0x0066('0x67')][_0x23143f]),'OpenchannelQueueId':Number(_0x4ca907['params']['id'])});}return _0xcc13a9;});}})[_0x0066('0x25')](respondWithResult(_0x4c2b31,null))[_0x0066('0x45')](handleError(_0x4c2b31,null));};exports[_0x0066('0x87')]=function(_0x111f11,_0xa6b835,_0x445b3d){return db[_0x0066('0x2e')][_0x0066('0x49')]({'where':{'id':_0x111f11['params']['id']}})[_0x0066('0x25')](handleEntityNotFound(_0xa6b835,null))[_0x0066('0x25')](function(_0x1fd265){if(_0x1fd265){return _0x1fd265['removeAgents'](_0x111f11['query']['ids'])[_0x0066('0x25')](function(){if(_['isArray'](_0x111f11[_0x0066('0x34')][_0x0066('0x67')])){for(var _0x33d045=0x0;_0x33d045<_0x111f11['query']['ids'][_0x0066('0x47')];_0x33d045+=0x1){socket['emit'](_0x0066('0x88'),{'UserId':Number(_0x111f11[_0x0066('0x34')]['ids'][_0x33d045]),'OpenchannelQueueId':Number(_0x111f11[_0x0066('0x54')]['id'])});}}else{socket[_0x0066('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x111f11['query'][_0x0066('0x67')]),'OpenchannelQueueId':Number(_0x111f11[_0x0066('0x54')]['id'])});}});}})[_0x0066('0x25')](respondWithStatusCode(_0xa6b835,null))[_0x0066('0x45')](handleError(_0xa6b835,null));};exports[_0x0066('0x8b')]=function(_0x3c5e9d,_0x2234a8,_0x477e97){var _0x5a9b46={};var _0x3a75f5={};var _0x27c18c;var _0x2b19e5;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x3c5e9d[_0x0066('0x54')]['id']}})[_0x0066('0x25')](handleEntityNotFound(_0x2234a8,null))[_0x0066('0x25')](function(_0x46c3bc){if(_0x46c3bc){_0x27c18c=_0x46c3bc;_0x3a75f5[_0x0066('0x33')]=_[_0x0066('0x35')](db['User'][_0x0066('0x2f')]);_0x3a75f5[_0x0066('0x34')]=_[_0x0066('0x35')](_0x3c5e9d['query']);_0x3a75f5[_0x0066('0x36')]=_[_0x0066('0x37')](_0x3a75f5[_0x0066('0x33')],_0x3a75f5[_0x0066('0x34')]);_0x5a9b46[_0x0066('0x39')]=_[_0x0066('0x37')](_0x3a75f5['model'],qs['fields'](_0x3c5e9d[_0x0066('0x34')]['fields']));_0x5a9b46[_0x0066('0x39')]=_0x5a9b46[_0x0066('0x39')]['length']?_0x5a9b46[_0x0066('0x39')]:_0x3a75f5['model'];_0x5a9b46[_0x0066('0x3c')]=qs[_0x0066('0x3d')](_0x3c5e9d[_0x0066('0x34')]['sort']);_0x5a9b46[_0x0066('0x3e')]=qs['filters'](_['pick'](_0x3c5e9d[_0x0066('0x34')],_0x3a75f5[_0x0066('0x36')]));if(_0x3c5e9d['query'][_0x0066('0x40')]){_0x5a9b46[_0x0066('0x3e')]=_[_0x0066('0x3f')](_0x5a9b46[_0x0066('0x3e')],{'$or':_[_0x0066('0x2d')](_0x5a9b46[_0x0066('0x39')],function(_0x1a6fc9){var _0x25843d={};_0x25843d[_0x1a6fc9]={'$like':'%'+_0x3c5e9d[_0x0066('0x34')]['filter']+'%'};return _0x25843d;})});}_0x5a9b46=_['merge']({},_0x5a9b46,_0x3c5e9d[_0x0066('0x41')]);return _0x27c18c['getAgents'](_0x5a9b46);}})[_0x0066('0x25')](function(_0x4dbcd1){if(_0x4dbcd1){_0x2b19e5=_0x4dbcd1['length'];if(!_0x3c5e9d['query'][_0x0066('0x3a')](_0x0066('0x3b'))){_0x5a9b46[_0x0066('0x1d')]=qs[_0x0066('0x1d')](_0x3c5e9d[_0x0066('0x34')][_0x0066('0x1d')]);_0x5a9b46[_0x0066('0x1b')]=qs['offset'](_0x3c5e9d[_0x0066('0x34')][_0x0066('0x1b')]);}return _0x27c18c[_0x0066('0x8b')](_0x5a9b46);}})[_0x0066('0x25')](function(_0x860bb1){if(_0x860bb1){return _0x860bb1?{'count':_0x2b19e5,'rows':_0x860bb1}:null;}})[_0x0066('0x25')](respondWithResult(_0x2234a8,null))[_0x0066('0x45')](handleError(_0x2234a8,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d9c69d4..945e6c0 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 _0x749a=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x291c99,_0x593edb){var _0x1b7c08=function(_0x3c9960){while(--_0x3c9960){_0x291c99['push'](_0x291c99['shift']());}};_0x1b7c08(++_0x593edb);}(_0x749a,0x135));var _0xa749=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x749a[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xa749('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa749('0x1')](0x0);var events={'afterCreate':_0xa749('0x2'),'afterUpdate':_0xa749('0x3'),'afterDestroy':_0xa749('0x4')};function emitEvent(_0x5d5c24){return function(_0x2f365c,_0x425c54,_0x592b2c){OpenchannelQueueEvents[_0xa749('0x5')](_0x5d5c24+':'+_0x2f365c['id'],_0x2f365c);OpenchannelQueueEvents[_0xa749('0x5')](_0x5d5c24,_0x2f365c);_0x592b2c(null);};}for(var e in events){if(events[_0xa749('0x6')](e)){var event=events[e];OpenchannelQueue[_0xa749('0x7')](e,emitEvent(event));}}module[_0xa749('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x0f84=['hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0xea539c,_0xd8aa12){var _0x10dd69=function(_0x44b497){while(--_0x44b497){_0xea539c['push'](_0xea539c['shift']());}};_0x10dd69(++_0xd8aa12);}(_0x0f84,0x1cd));var _0x40f8=function(_0xed3708,_0x2cda44){_0xed3708=_0xed3708-0x0;var _0xf8528f=_0x0f84[_0xed3708];return _0xf8528f;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x40f8('0x0'))['db'][_0x40f8('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x40f8('0x2')](0x0);var events={'afterCreate':_0x40f8('0x3'),'afterUpdate':'update','afterDestroy':_0x40f8('0x4')};function emitEvent(_0x24e7c1){return function(_0x376f28,_0x33d13a,_0x56dcd8){OpenchannelQueueEvents[_0x40f8('0x5')](_0x24e7c1+':'+_0x376f28['id'],_0x376f28);OpenchannelQueueEvents[_0x40f8('0x5')](_0x24e7c1,_0x376f28);_0x56dcd8(null);};}for(var e in events){if(events[_0x40f8('0x6')](e)){var event=events[e];OpenchannelQueue[_0x40f8('0x7')](e,emitEvent(event));}}module[_0x40f8('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 8622908..9d88d8b 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 _0xf03b=['bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues','lodash','api','moment'];(function(_0x30c23c,_0x643d71){var _0x16c2dd=function(_0x4bb1a0){while(--_0x4bb1a0){_0x30c23c['push'](_0x30c23c['shift']());}};_0x16c2dd(++_0x643d71);}(_0xf03b,0xb8));var _0xbf03=function(_0x1f9344,_0x56a893){_0x1f9344=_0x1f9344-0x0;var _0x683225=_0xf03b[_0x1f9344];return _0x683225;};'use strict';var _=require(_0xbf03('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbf03('0x1'));var moment=require(_0xbf03('0x2'));var BPromise=require(_0xbf03('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf03('0x4'));var rimraf=require(_0xbf03('0x5'));var config=require(_0xbf03('0x6'));var attributes=require(_0xbf03('0x7'));module[_0xbf03('0x8')]=function(_0x9376eb,_0x4ef717){return _0x9376eb['define'](_0xbf03('0x9'),attributes,{'tableName':_0xbf03('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05ed=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash','util'];(function(_0x2e80d8,_0x20dec8){var _0x2b54ea=function(_0x74f057){while(--_0x74f057){_0x2e80d8['push'](_0x2e80d8['shift']());}};_0x2b54ea(++_0x20dec8);}(_0x05ed,0x73));var _0xd05e=function(_0x483888,_0x2ff778){_0x483888=_0x483888-0x0;var _0x4be161=_0x05ed[_0x483888];return _0x4be161;};'use strict';var _=require(_0xd05e('0x0'));var util=require(_0xd05e('0x1'));var logger=require('../../config/logger')(_0xd05e('0x2'));var moment=require(_0xd05e('0x3'));var BPromise=require(_0xd05e('0x4'));var rp=require(_0xd05e('0x5'));var fs=require('fs');var path=require(_0xd05e('0x6'));var rimraf=require(_0xd05e('0x7'));var config=require(_0xd05e('0x8'));var attributes=require(_0xd05e('0x9'));module['exports']=function(_0x21963c,_0x1066a7){return _0x21963c[_0xd05e('0xa')](_0xd05e('0xb'),attributes,{'tableName':_0xd05e('0xc'),'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 a69d638..270e66d 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 _0x5bc0=['redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','map','include','model','debug','catch','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x511a19,_0x417e36){var _0x499aa6=function(_0x270874){while(--_0x270874){_0x511a19['push'](_0x511a19['shift']());}};_0x499aa6(++_0x417e36);}(_0x5bc0,0x144));var _0x05bc=function(_0x56e028,_0x3e7924){_0x56e028=_0x56e028-0x0;var _0x4af25e=_0x5bc0[_0x56e028];return _0x4af25e;};'use strict';var _=require(_0x05bc('0x0'));var util=require(_0x05bc('0x1'));var moment=require(_0x05bc('0x2'));var BPromise=require(_0x05bc('0x3'));var rs=require(_0x05bc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05bc('0x5'))['db'];var utils=require(_0x05bc('0x6'));var logger=require(_0x05bc('0x7'))(_0x05bc('0x8'));var config=require(_0x05bc('0x9'));var jayson=require(_0x05bc('0xa'));var client=jayson['client'][_0x05bc('0xb')]({'port':0x232a});config[_0x05bc('0xc')]=_[_0x05bc('0xd')](config[_0x05bc('0xc')],{'host':_0x05bc('0xe'),'port':0x18eb});var socket=require(_0x05bc('0xf'))(new Redis(config[_0x05bc('0xc')]));require(_0x05bc('0x10'))[_0x05bc('0x11')](socket);function respondWithRpcPromise(_0x37df32,_0xc11a07,_0x1175ab){return new BPromise(function(_0x3f7444,_0x33a4f7){return client[_0x05bc('0x12')](_0x37df32,_0x1175ab)[_0x05bc('0x13')](function(_0x5d9be1){logger[_0x05bc('0x14')](_0x05bc('0x15'),_0xc11a07,_0x05bc('0x16'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xc11a07,_0x05bc('0x16'),JSON[_0x05bc('0x17')](_0x5d9be1));if(_0x5d9be1[_0x05bc('0x18')]){if(_0x5d9be1[_0x05bc('0x18')][_0x05bc('0x19')]===0x1f4){logger[_0x05bc('0x18')](_0x05bc('0x15'),_0xc11a07,_0x5d9be1[_0x05bc('0x18')][_0x05bc('0x1a')]);return _0x33a4f7(_0x5d9be1['error'][_0x05bc('0x1a')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0xc11a07,_0x5d9be1[_0x05bc('0x18')][_0x05bc('0x1a')]);return _0x3f7444(_0x5d9be1[_0x05bc('0x18')][_0x05bc('0x1a')]);}else{logger[_0x05bc('0x14')](_0x05bc('0x15'),_0xc11a07,_0x05bc('0x16'));_0x3f7444(_0x5d9be1['result'][_0x05bc('0x1a')]);}})['catch'](function(_0x356f0e){logger['error'](_0x05bc('0x15'),_0xc11a07,_0x356f0e);_0x33a4f7(_0x356f0e);});});}exports[_0x05bc('0x1b')]=function(_0x1df002){var _0x1a08cd=this;return new Promise(function(_0x4685e2,_0x47eb9e){return db[_0x05bc('0x1c')][_0x05bc('0x1d')]({'raw':_0x1df002[_0x05bc('0x1e')]?_0x1df002[_0x05bc('0x1e')][_0x05bc('0x1f')]===undefined?!![]:![]:!![],'where':_0x1df002[_0x05bc('0x1e')]?_0x1df002[_0x05bc('0x1e')][_0x05bc('0x20')]||null:null,'attributes':_0x1df002['options']?_0x1df002['options'][_0x05bc('0x21')]||null:null,'limit':_0x1df002[_0x05bc('0x1e')]?_0x1df002[_0x05bc('0x1e')][_0x05bc('0x22')]||null:null,'include':_0x1df002[_0x05bc('0x1e')]?_0x1df002['options']['include']?_[_0x05bc('0x23')](_0x1df002[_0x05bc('0x1e')][_0x05bc('0x24')],function(_0x5bb9d7){return{'model':db[_0x5bb9d7[_0x05bc('0x25')]],'as':_0x5bb9d7['as'],'attributes':_0x5bb9d7[_0x05bc('0x21')],'include':_0x5bb9d7['include']?_['map'](_0x5bb9d7[_0x05bc('0x24')],function(_0x30b51f){return{'model':db[_0x30b51f[_0x05bc('0x25')]],'as':_0x30b51f['as'],'attributes':_0x30b51f[_0x05bc('0x21')],'include':_0x30b51f['include']?_[_0x05bc('0x23')](_0x30b51f[_0x05bc('0x24')],function(_0x14ef9f){return{'model':db[_0x14ef9f[_0x05bc('0x25')]],'as':_0x14ef9f['as'],'attributes':_0x14ef9f[_0x05bc('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55c9fa){logger[_0x05bc('0x14')]('GetOpenchannelQueue',_0x1df002);logger[_0x05bc('0x26')]('GetOpenchannelQueue',_0x1df002,JSON[_0x05bc('0x17')](_0x55c9fa));_0x4685e2(_0x55c9fa);})[_0x05bc('0x27')](function(_0x3ee25b){logger[_0x05bc('0x18')](_0x05bc('0x1b'),_0x3ee25b['message'],_0x1df002);_0x47eb9e(_0x1a08cd['error'](0x1f4,_0x3ee25b[_0x05bc('0x1a')]));});});};exports[_0x05bc('0x28')]=function(_0x323d7d){var _0x22e38b=this;return new Promise(function(_0x4da603,_0x433204){return db[_0x05bc('0x1c')][_0x05bc('0x29')]({'raw':_0x323d7d[_0x05bc('0x1e')]?_0x323d7d[_0x05bc('0x1e')][_0x05bc('0x1f')]===undefined?!![]:![]:!![],'where':_0x323d7d[_0x05bc('0x1e')]?_0x323d7d[_0x05bc('0x1e')][_0x05bc('0x20')]||null:null,'attributes':_0x323d7d[_0x05bc('0x1e')]?_0x323d7d[_0x05bc('0x1e')]['attributes']||null:null,'include':_0x323d7d[_0x05bc('0x1e')]?_0x323d7d['options']['include']?_[_0x05bc('0x23')](_0x323d7d[_0x05bc('0x1e')][_0x05bc('0x24')],function(_0x50e3a8){return{'model':db[_0x50e3a8[_0x05bc('0x25')]],'as':_0x50e3a8['as'],'attributes':_0x50e3a8[_0x05bc('0x21')],'include':_0x50e3a8[_0x05bc('0x24')]?_[_0x05bc('0x23')](_0x50e3a8[_0x05bc('0x24')],function(_0x1a1a23){return{'model':db[_0x1a1a23[_0x05bc('0x25')]],'as':_0x1a1a23['as'],'attributes':_0x1a1a23[_0x05bc('0x21')],'include':_0x1a1a23['include']?_['map'](_0x1a1a23['include'],function(_0x3f4a99){return{'model':db[_0x3f4a99['model']],'as':_0x3f4a99['as'],'attributes':_0x3f4a99[_0x05bc('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f5c0f){logger['info'](_0x05bc('0x28'),_0x323d7d);logger[_0x05bc('0x26')]('ShowOpenchannelQueue',_0x323d7d,JSON[_0x05bc('0x17')](_0x4f5c0f));_0x4da603(_0x4f5c0f);})[_0x05bc('0x27')](function(_0x34bf38){logger['error'](_0x05bc('0x28'),_0x34bf38[_0x05bc('0x1a')],_0x323d7d);_0x433204(_0x22e38b[_0x05bc('0x18')](0x1f4,_0x34bf38[_0x05bc('0x1a')]));});});}; \ No newline at end of file +var _0xd03b=['result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','then','ShowOpenchannelQueue','find','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','request\x20sent','debug','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message'];(function(_0x260f45,_0x404e99){var _0x56a249=function(_0x412589){while(--_0x412589){_0x260f45['push'](_0x260f45['shift']());}};_0x56a249(++_0x404e99);}(_0xd03b,0x193));var _0xbd03=function(_0x276960,_0x476f9e){_0x276960=_0x276960-0x0;var _0x219503=_0xd03b[_0x276960];return _0x219503;};'use strict';var _=require('lodash');var util=require(_0xbd03('0x0'));var moment=require(_0xbd03('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd03('0x2'));var fs=require('fs');var Redis=require(_0xbd03('0x3'));var db=require(_0xbd03('0x4'))['db'];var utils=require(_0xbd03('0x5'));var logger=require(_0xbd03('0x6'))(_0xbd03('0x7'));var config=require(_0xbd03('0x8'));var jayson=require(_0xbd03('0x9'));var client=jayson[_0xbd03('0xa')][_0xbd03('0xb')]({'port':0x232a});config[_0xbd03('0xc')]=_[_0xbd03('0xd')](config[_0xbd03('0xc')],{'host':_0xbd03('0xe'),'port':0x18eb});var socket=require(_0xbd03('0xf'))(new Redis(config['redis']));require(_0xbd03('0x10'))[_0xbd03('0x11')](socket);function respondWithRpcPromise(_0x2550d0,_0x1483b8,_0x4252bd){return new BPromise(function(_0x27f3e7,_0x2fa7f7){return client[_0xbd03('0x12')](_0x2550d0,_0x4252bd)['then'](function(_0x29e4c8){logger[_0xbd03('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x1483b8,_0xbd03('0x14'));logger[_0xbd03('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1483b8,'request\x20sent',JSON[_0xbd03('0x16')](_0x29e4c8));if(_0x29e4c8[_0xbd03('0x17')]){if(_0x29e4c8[_0xbd03('0x17')][_0xbd03('0x18')]===0x1f4){logger[_0xbd03('0x17')](_0xbd03('0x19'),_0x1483b8,_0x29e4c8[_0xbd03('0x17')][_0xbd03('0x1a')]);return _0x2fa7f7(_0x29e4c8['error'][_0xbd03('0x1a')]);}logger[_0xbd03('0x17')](_0xbd03('0x19'),_0x1483b8,_0x29e4c8[_0xbd03('0x17')]['message']);return _0x27f3e7(_0x29e4c8['error']['message']);}else{logger[_0xbd03('0x13')](_0xbd03('0x19'),_0x1483b8,_0xbd03('0x14'));_0x27f3e7(_0x29e4c8[_0xbd03('0x1b')][_0xbd03('0x1a')]);}})[_0xbd03('0x1c')](function(_0x4b453b){logger[_0xbd03('0x17')](_0xbd03('0x19'),_0x1483b8,_0x4b453b);_0x2fa7f7(_0x4b453b);});});}exports[_0xbd03('0x1d')]=function(_0x1bd083){var _0x59d1d1=this;return new Promise(function(_0xa27316,_0x5dd3ed){return db[_0xbd03('0x1e')][_0xbd03('0x1f')]({'raw':_0x1bd083['options']?_0x1bd083[_0xbd03('0x20')][_0xbd03('0x21')]===undefined?!![]:![]:!![],'where':_0x1bd083[_0xbd03('0x20')]?_0x1bd083[_0xbd03('0x20')]['where']||null:null,'attributes':_0x1bd083[_0xbd03('0x20')]?_0x1bd083[_0xbd03('0x20')][_0xbd03('0x22')]||null:null,'limit':_0x1bd083['options']?_0x1bd083['options'][_0xbd03('0x23')]||null:null,'include':_0x1bd083['options']?_0x1bd083[_0xbd03('0x20')][_0xbd03('0x24')]?_[_0xbd03('0x25')](_0x1bd083['options'][_0xbd03('0x24')],function(_0x338ca4){return{'model':db[_0x338ca4[_0xbd03('0x26')]],'as':_0x338ca4['as'],'attributes':_0x338ca4[_0xbd03('0x22')],'include':_0x338ca4[_0xbd03('0x24')]?_[_0xbd03('0x25')](_0x338ca4[_0xbd03('0x24')],function(_0x3d5147){return{'model':db[_0x3d5147[_0xbd03('0x26')]],'as':_0x3d5147['as'],'attributes':_0x3d5147[_0xbd03('0x22')],'include':_0x3d5147[_0xbd03('0x24')]?_['map'](_0x3d5147[_0xbd03('0x24')],function(_0x2c52d4){return{'model':db[_0x2c52d4[_0xbd03('0x26')]],'as':_0x2c52d4['as'],'attributes':_0x2c52d4[_0xbd03('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbd03('0x27')](function(_0x3a64c0){logger[_0xbd03('0x13')](_0xbd03('0x1d'),_0x1bd083);logger[_0xbd03('0x15')]('GetOpenchannelQueue',_0x1bd083,JSON[_0xbd03('0x16')](_0x3a64c0));_0xa27316(_0x3a64c0);})[_0xbd03('0x1c')](function(_0x2162b6){logger['error'](_0xbd03('0x1d'),_0x2162b6[_0xbd03('0x1a')],_0x1bd083);_0x5dd3ed(_0x59d1d1['error'](0x1f4,_0x2162b6[_0xbd03('0x1a')]));});});};exports[_0xbd03('0x28')]=function(_0x558f5e){var _0xf43d99=this;return new Promise(function(_0xb5ea26,_0x31a755){return db[_0xbd03('0x1e')][_0xbd03('0x29')]({'raw':_0x558f5e[_0xbd03('0x20')]?_0x558f5e[_0xbd03('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x558f5e[_0xbd03('0x20')]?_0x558f5e[_0xbd03('0x20')][_0xbd03('0x2a')]||null:null,'attributes':_0x558f5e['options']?_0x558f5e[_0xbd03('0x20')][_0xbd03('0x22')]||null:null,'include':_0x558f5e[_0xbd03('0x20')]?_0x558f5e['options'][_0xbd03('0x24')]?_['map'](_0x558f5e[_0xbd03('0x20')][_0xbd03('0x24')],function(_0x1ac1b3){return{'model':db[_0x1ac1b3[_0xbd03('0x26')]],'as':_0x1ac1b3['as'],'attributes':_0x1ac1b3[_0xbd03('0x22')],'include':_0x1ac1b3[_0xbd03('0x24')]?_[_0xbd03('0x25')](_0x1ac1b3[_0xbd03('0x24')],function(_0x53dc17){return{'model':db[_0x53dc17[_0xbd03('0x26')]],'as':_0x53dc17['as'],'attributes':_0x53dc17[_0xbd03('0x22')],'include':_0x53dc17['include']?_[_0xbd03('0x25')](_0x53dc17[_0xbd03('0x24')],function(_0x4f514d){return{'model':db[_0x4f514d['model']],'as':_0x4f514d['as'],'attributes':_0x4f514d[_0xbd03('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbd03('0x27')](function(_0x323833){logger[_0xbd03('0x13')](_0xbd03('0x28'),_0x558f5e);logger[_0xbd03('0x15')]('ShowOpenchannelQueue',_0x558f5e,JSON[_0xbd03('0x16')](_0x323833));_0xb5ea26(_0x323833);})[_0xbd03('0x1c')](function(_0x4b422e){logger[_0xbd03('0x17')](_0xbd03('0x28'),_0x4b422e[_0xbd03('0x1a')],_0x558f5e);_0x31a755(_0xf43d99['error'](0x1f4,_0x4b422e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 6900dae..e2151ee 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 _0x2b82=['./openchannelQueue.events','update','emit','removeListener','register','length','openchannelQueue:'];(function(_0x1685f1,_0x1a418d){var _0x5c0c79=function(_0x4b036c){while(--_0x4b036c){_0x1685f1['push'](_0x1685f1['shift']());}};_0x5c0c79(++_0x1a418d);}(_0x2b82,0x1b9));var _0x22b8=function(_0x441b4c,_0x3768c8){_0x441b4c=_0x441b4c-0x0;var _0x3f3a5c=_0x2b82[_0x441b4c];return _0x3f3a5c;};'use strict';var OpenchannelQueueEvents=require(_0x22b8('0x0'));var events=['save','remove',_0x22b8('0x1')];function createListener(_0x540a1c,_0x5d0149){return function(_0x52be01){_0x5d0149[_0x22b8('0x2')](_0x540a1c,_0x52be01);};}function removeListener(_0x3e19fe,_0xa6c54){return function(){OpenchannelQueueEvents[_0x22b8('0x3')](_0x3e19fe,_0xa6c54);};}exports[_0x22b8('0x4')]=function(_0x3458a0){for(var _0x3270e3=0x0,_0x4a7dce=events[_0x22b8('0x5')];_0x3270e3<_0x4a7dce;_0x3270e3++){var _0xcfe186=events[_0x3270e3];var _0x35891f=createListener(_0x22b8('0x6')+_0xcfe186,_0x3458a0);OpenchannelQueueEvents['on'](_0xcfe186,_0x35891f);}}; \ No newline at end of file +var _0xd675=['openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd675,0x1c1));var _0x5d67=function(_0x3f69ba,_0x2a831b){_0x3f69ba=_0x3f69ba-0x0;var _0x61254d=_0xd675[_0x3f69ba];return _0x61254d;};'use strict';var OpenchannelQueueEvents=require(_0x5d67('0x0'));var events=[_0x5d67('0x1'),_0x5d67('0x2'),_0x5d67('0x3')];function createListener(_0x52c7d9,_0x3766d7){return function(_0xdd6d56){_0x3766d7[_0x5d67('0x4')](_0x52c7d9,_0xdd6d56);};}function removeListener(_0x194d91,_0x2800e2){return function(){OpenchannelQueueEvents[_0x5d67('0x5')](_0x194d91,_0x2800e2);};}exports['register']=function(_0x328bf7){for(var _0x1eb3ca=0x0,_0x405f9b=events[_0x5d67('0x6')];_0x1eb3ca<_0x405f9b;_0x1eb3ca++){var _0x63fa99=events[_0x1eb3ca];var _0x17069b=createListener(_0x5d67('0x7')+_0x63fa99,_0x328bf7);OpenchannelQueueEvents['on'](_0x63fa99,_0x17069b);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index bd40a7c..5617b1a 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 _0xbf8f=['get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xbf8f,0x15d));var _0xfbf8=function(_0x40e222,_0x43284c){_0x40e222=_0x40e222-0x0;var _0x36f57f=_0xbf8f[_0x40e222];return _0x36f57f;};'use strict';var multer=require('multer');var util=require(_0xfbf8('0x0'));var path=require(_0xfbf8('0x1'));var timeout=require(_0xfbf8('0x2'));var express=require(_0xfbf8('0x3'));var router=express[_0xfbf8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfbf8('0x5'));var interaction=require(_0xfbf8('0x6'));var config=require('../../config/environment');var controller=require(_0xfbf8('0x7'));router[_0xfbf8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfbf8('0x8')](_0xfbf8('0x9'),auth[_0xfbf8('0xa')](),controller[_0xfbf8('0xb')]);router['get'](_0xfbf8('0xc'),auth['isAuthenticated'](),controller[_0xfbf8('0xd')]);router[_0xfbf8('0xe')]('/',auth[_0xfbf8('0xa')](),controller[_0xfbf8('0xf')]);router[_0xfbf8('0x10')](_0xfbf8('0xc'),auth['isAuthenticated'](),controller[_0xfbf8('0x11')]);router[_0xfbf8('0x12')](_0xfbf8('0xc'),auth['isAuthenticated'](),controller[_0xfbf8('0x13')]);module[_0xfbf8('0x14')]=router; \ No newline at end of file +var _0xb165=['post','create','put','/:id','update','delete','destroy','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x216a8d,_0x5473bb){var _0xb21f7b=function(_0x3cf6e9){while(--_0x3cf6e9){_0x216a8d['push'](_0x216a8d['shift']());}};_0xb21f7b(++_0x5473bb);}(_0xb165,0xe3));var _0x5b16=function(_0x4275d5,_0x4a0e7f){_0x4275d5=_0x4275d5-0x0;var _0x4876ef=_0xb165[_0x4275d5];return _0x4876ef;};'use strict';var multer=require(_0x5b16('0x0'));var util=require(_0x5b16('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5b16('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5b16('0x3'));var interaction=require(_0x5b16('0x4'));var config=require(_0x5b16('0x5'));var controller=require(_0x5b16('0x6'));router[_0x5b16('0x7')]('/',auth[_0x5b16('0x8')](),controller[_0x5b16('0x9')]);router[_0x5b16('0x7')](_0x5b16('0xa'),auth['isAuthenticated'](),controller[_0x5b16('0xb')]);router[_0x5b16('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x5b16('0xc')]);router[_0x5b16('0xd')]('/',auth[_0x5b16('0x8')](),controller[_0x5b16('0xe')]);router[_0x5b16('0xf')](_0x5b16('0x10'),auth[_0x5b16('0x8')](),controller[_0x5b16('0x11')]);router[_0x5b16('0x12')](_0x5b16('0x10'),auth[_0x5b16('0x8')](),controller[_0x5b16('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index cb08cd0..281415e 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 _0x34c3=['DATE','moment','sequelize','exports','STRING'];(function(_0x3a5df9,_0x4f233c){var _0x45eff5=function(_0xdf36ef){while(--_0xdf36ef){_0x3a5df9['push'](_0x3a5df9['shift']());}};_0x45eff5(++_0x4f233c);}(_0x34c3,0x1e1));var _0x334c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x34c3[_0x502c7d];return _0x30b7ed;};'use strict';var moment=require(_0x334c('0x0'));var Sequelize=require(_0x334c('0x1'));module[_0x334c('0x2')]={'uniqueid':{'type':Sequelize[_0x334c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x334c('0x3')]},'joinAt':{'type':Sequelize[_0x334c('0x4')]},'leaveAt':{'type':Sequelize[_0x334c('0x4')]},'acceptAt':{'type':Sequelize[_0x334c('0x4')]},'exitAt':{'type':Sequelize[_0x334c('0x4')]},'reason':{'type':Sequelize[_0x334c('0x3')]}}; \ No newline at end of file +var _0x85b3=['moment','exports','STRING','DATE'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x85b3,0x90));var _0x385b=function(_0x339f92,_0x51a944){_0x339f92=_0x339f92-0x0;var _0x4f5ce6=_0x85b3[_0x339f92];return _0x4f5ce6;};'use strict';var moment=require(_0x385b('0x0'));var Sequelize=require('sequelize');module[_0x385b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x385b('0x2')]},'joinAt':{'type':Sequelize[_0x385b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x385b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x385b('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 828cb13..3c2477e 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 _0x1a9d=['../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','show','params','keys','includeAll','catch','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment'];(function(_0x436b41,_0x26e3d3){var _0xfaa7d0=function(_0x5d054a){while(--_0x5d054a){_0x436b41['push'](_0x436b41['shift']());}};_0xfaa7d0(++_0x26e3d3);}(_0x1a9d,0x10d));var _0xd1a9=function(_0x5099c4,_0x289449){_0x5099c4=_0x5099c4-0x0;var _0x21d3ed=_0x1a9d[_0x5099c4];return _0x21d3ed;};'use strict';var emlformat=require(_0xd1a9('0x0'));var rimraf=require(_0xd1a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1a9('0x2'));var rp=require(_0xd1a9('0x3'));var moment=require(_0xd1a9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd1a9('0x5'));var util=require('util');var path=require(_0xd1a9('0x6'));var sox=require(_0xd1a9('0x7'));var csv=require(_0xd1a9('0x8'));var ejs=require(_0xd1a9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1a9('0xa'));var squel=require('squel');var crypto=require(_0xd1a9('0xb'));var jsforce=require(_0xd1a9('0xc'));var deskjs=require(_0xd1a9('0xd'));var toCsv=require(_0xd1a9('0x8'));var querystring=require('querystring');var Papa=require(_0xd1a9('0xe'));var Redis=require(_0xd1a9('0xf'));var authService=require(_0xd1a9('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1a9('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd1a9('0x12'));var licenseUtil=require(_0xd1a9('0x13'));var db=require(_0xd1a9('0x14'))['db'];function respondWithStatusCode(_0x1e3ba4,_0x18544a){_0x18544a=_0x18544a||0xcc;return function(_0x2bd31e){if(_0x2bd31e){return _0x1e3ba4[_0xd1a9('0x15')](_0x18544a);}return _0x1e3ba4[_0xd1a9('0x16')](_0x18544a)[_0xd1a9('0x17')]();};}function respondWithResult(_0x44115c,_0x38065c){_0x38065c=_0x38065c||0xc8;return function(_0x5e948e){if(_0x5e948e){return _0x44115c[_0xd1a9('0x16')](_0x38065c)['json'](_0x5e948e);}};}function respondWithFilteredResult(_0x1ae929,_0x4b9b1c){return function(_0x441107){if(_0x441107){var _0x42f6d0=typeof _0x4b9b1c['offset']===_0xd1a9('0x18')&&typeof _0x4b9b1c['limit']==='undefined';var _0x3b0c0a=_0x441107[_0xd1a9('0x19')];var _0x28c270=_0x42f6d0?0x0:_0x4b9b1c[_0xd1a9('0x1a')];var _0x4d4427=_0x42f6d0?_0x441107['count']:_0x4b9b1c[_0xd1a9('0x1a')]+_0x4b9b1c[_0xd1a9('0x1b')];var _0x3c3122;if(_0x4d4427>=_0x3b0c0a){_0x4d4427=_0x3b0c0a;_0x3c3122=0xc8;}else{_0x3c3122=0xce;}_0x1ae929[_0xd1a9('0x16')](_0x3c3122);return _0x1ae929['set'](_0xd1a9('0x1c'),_0x28c270+'-'+_0x4d4427+'/'+_0x3b0c0a)[_0xd1a9('0x1d')](_0x441107);}return null;};}function patchUpdates(_0x4bcc39){return function(_0x18aed6){try{jsonpatch[_0xd1a9('0x1e')](_0x18aed6,_0x4bcc39,!![]);}catch(_0xd689ea){return BPromise[_0xd1a9('0x1f')](_0xd689ea);}return _0x18aed6['save']();};}function saveUpdates(_0x5269fd,_0xb30d46){return function(_0x28bbf3){if(_0x28bbf3){return _0x28bbf3[_0xd1a9('0x20')](_0x5269fd)['then'](function(_0x58fdf7){return _0x58fdf7;});}return null;};}function removeEntity(_0x5db446,_0x15af32){return function(_0x57cff8){if(_0x57cff8){return _0x57cff8['destroy']()[_0xd1a9('0x21')](function(){_0x5db446[_0xd1a9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x477b60,_0x4c99d7){return function(_0x70e1df){if(!_0x70e1df){_0x477b60[_0xd1a9('0x15')](0x194);}return _0x70e1df;};}function handleError(_0x529361,_0x143e40){_0x143e40=_0x143e40||0x1f4;return function(_0xb6806d){logger[_0xd1a9('0x22')](_0xb6806d[_0xd1a9('0x23')]);if(_0xb6806d[_0xd1a9('0x24')]){delete _0xb6806d[_0xd1a9('0x24')];}_0x529361['status'](_0x143e40)[_0xd1a9('0x25')](_0xb6806d);};}exports[_0xd1a9('0x26')]=function(_0x2459fb,_0x2e8a9f){var _0x15a2b7={},_0x387b26={},_0x4bba64={'count':0x0,'rows':[]};var _0x1a22b9=_[_0xd1a9('0x27')](db[_0xd1a9('0x28')][_0xd1a9('0x29')],function(_0x17a340){return{'name':_0x17a340[_0xd1a9('0x2a')],'type':_0x17a340[_0xd1a9('0x2b')][_0xd1a9('0x2c')]};});_0x387b26[_0xd1a9('0x2d')]=_[_0xd1a9('0x27')](_0x1a22b9,'name');_0x387b26[_0xd1a9('0x2e')]=_['keys'](_0x2459fb[_0xd1a9('0x2e')]);_0x387b26[_0xd1a9('0x2f')]=_[_0xd1a9('0x30')](_0x387b26[_0xd1a9('0x2d')],_0x387b26[_0xd1a9('0x2e')]);_0x15a2b7[_0xd1a9('0x31')]=_[_0xd1a9('0x30')](_0x387b26['model'],qs['fields'](_0x2459fb[_0xd1a9('0x2e')][_0xd1a9('0x32')]));_0x15a2b7[_0xd1a9('0x31')]=_0x15a2b7[_0xd1a9('0x31')][_0xd1a9('0x33')]?_0x15a2b7[_0xd1a9('0x31')]:_0x387b26[_0xd1a9('0x2d')];if(!_0x2459fb[_0xd1a9('0x2e')]['hasOwnProperty'](_0xd1a9('0x34'))){_0x15a2b7[_0xd1a9('0x1b')]=qs[_0xd1a9('0x1b')](_0x2459fb[_0xd1a9('0x2e')][_0xd1a9('0x1b')]);_0x15a2b7[_0xd1a9('0x1a')]=qs['offset'](_0x2459fb[_0xd1a9('0x2e')]['offset']);}_0x15a2b7[_0xd1a9('0x35')]=qs[_0xd1a9('0x36')](_0x2459fb['query'][_0xd1a9('0x36')]);_0x15a2b7['where']=qs[_0xd1a9('0x2f')](_[_0xd1a9('0x37')](_0x2459fb[_0xd1a9('0x2e')],_0x387b26[_0xd1a9('0x2f')]),_0x1a22b9);if(_0x2459fb[_0xd1a9('0x2e')][_0xd1a9('0x38')]){_0x15a2b7[_0xd1a9('0x39')]=_[_0xd1a9('0x3a')](_0x15a2b7[_0xd1a9('0x39')],{'$or':_[_0xd1a9('0x27')](_0x1a22b9,function(_0x4e69e2){if(_0x4e69e2[_0xd1a9('0x2b')]!=='VIRTUAL'){var _0x785e27={};_0x785e27[_0x4e69e2[_0xd1a9('0x24')]]={'$like':'%'+_0x2459fb[_0xd1a9('0x2e')][_0xd1a9('0x38')]+'%'};return _0x785e27;}})});}_0x15a2b7=_[_0xd1a9('0x3a')]({},_0x15a2b7,_0x2459fb['options']);var _0x164316={'where':_0x15a2b7[_0xd1a9('0x39')]};return db[_0xd1a9('0x28')]['count'](_0x164316)[_0xd1a9('0x21')](function(_0x5d1330){_0x4bba64[_0xd1a9('0x19')]=_0x5d1330;if(_0x2459fb['query']['includeAll']){_0x15a2b7[_0xd1a9('0x3b')]=[{'all':!![]}];}return db[_0xd1a9('0x28')][_0xd1a9('0x3c')](_0x15a2b7);})[_0xd1a9('0x21')](function(_0x9bcd3a){_0x4bba64[_0xd1a9('0x3d')]=_0x9bcd3a;return _0x4bba64;})[_0xd1a9('0x21')](respondWithFilteredResult(_0x2e8a9f,_0x15a2b7))['catch'](handleError(_0x2e8a9f,null));};exports[_0xd1a9('0x3e')]=function(_0x337a6f,_0x1c20d){var _0x4d963f={'raw':!![],'where':{'id':_0x337a6f[_0xd1a9('0x3f')]['id']}},_0x2a74da={};_0x2a74da[_0xd1a9('0x2d')]=_[_0xd1a9('0x40')](db[_0xd1a9('0x28')]['rawAttributes']);_0x2a74da[_0xd1a9('0x2e')]=_[_0xd1a9('0x40')](_0x337a6f[_0xd1a9('0x2e')]);_0x2a74da[_0xd1a9('0x2f')]=_[_0xd1a9('0x30')](_0x2a74da[_0xd1a9('0x2d')],_0x2a74da[_0xd1a9('0x2e')]);_0x4d963f[_0xd1a9('0x31')]=_[_0xd1a9('0x30')](_0x2a74da[_0xd1a9('0x2d')],qs[_0xd1a9('0x32')](_0x337a6f[_0xd1a9('0x2e')][_0xd1a9('0x32')]));_0x4d963f[_0xd1a9('0x31')]=_0x4d963f[_0xd1a9('0x31')][_0xd1a9('0x33')]?_0x4d963f[_0xd1a9('0x31')]:_0x2a74da[_0xd1a9('0x2d')];if(_0x337a6f['query'][_0xd1a9('0x41')]){_0x4d963f['include']=[{'all':!![]}];}_0x4d963f=_[_0xd1a9('0x3a')]({},_0x4d963f,_0x337a6f['options']);return db[_0xd1a9('0x28')]['find'](_0x4d963f)[_0xd1a9('0x21')](handleEntityNotFound(_0x1c20d,null))['then'](respondWithResult(_0x1c20d,null))[_0xd1a9('0x42')](handleError(_0x1c20d,null));};exports[_0xd1a9('0x43')]=function(_0x794fac,_0x4e7e0c){return db[_0xd1a9('0x28')][_0xd1a9('0x43')](_0x794fac[_0xd1a9('0x44')],{})[_0xd1a9('0x21')](respondWithResult(_0x4e7e0c,0xc9))[_0xd1a9('0x42')](handleError(_0x4e7e0c,null));};exports[_0xd1a9('0x20')]=function(_0x19fdf7,_0xa4c7b){if(_0x19fdf7[_0xd1a9('0x44')]['id']){delete _0x19fdf7[_0xd1a9('0x44')]['id'];}return db[_0xd1a9('0x28')][_0xd1a9('0x45')]({'where':{'id':_0x19fdf7[_0xd1a9('0x3f')]['id']}})[_0xd1a9('0x21')](handleEntityNotFound(_0xa4c7b,null))['then'](saveUpdates(_0x19fdf7[_0xd1a9('0x44')],null))['then'](respondWithResult(_0xa4c7b,null))[_0xd1a9('0x42')](handleError(_0xa4c7b,null));};exports[_0xd1a9('0x46')]=function(_0x526aef,_0x5c4eff){return db[_0xd1a9('0x28')][_0xd1a9('0x45')]({'where':{'id':_0x526aef[_0xd1a9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5c4eff,null))[_0xd1a9('0x21')](removeEntity(_0x5c4eff,null))[_0xd1a9('0x42')](handleError(_0x5c4eff,null));};exports[_0xd1a9('0x47')]=function(_0x4bef5e,_0x3b5456){return db[_0xd1a9('0x28')][_0xd1a9('0x47')]()[_0xd1a9('0x21')](respondWithResult(_0x3b5456,null))[_0xd1a9('0x42')](handleError(_0x3b5456,null));}; \ No newline at end of file +var _0x9bf6=['end','index','map','OpenchannelQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','rawAttributes','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x22cb10,_0x20db4f){var _0x38a6f8=function(_0xdb4b16){while(--_0xdb4b16){_0x22cb10['push'](_0x22cb10['shift']());}};_0x38a6f8(++_0x20db4f);}(_0x9bf6,0x175));var _0x69bf=function(_0x10a27f,_0x5885c2){_0x10a27f=_0x10a27f-0x0;var _0x228a1a=_0x9bf6[_0x10a27f];return _0x228a1a;};'use strict';var emlformat=require(_0x69bf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69bf('0x1'));var jsonpatch=require(_0x69bf('0x2'));var rp=require('request-promise');var moment=require(_0x69bf('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x69bf('0x4'));var sox=require('sox');var csv=require(_0x69bf('0x5'));var ejs=require(_0x69bf('0x6'));var fs=require('fs');var fs_extra=require(_0x69bf('0x7'));var _=require(_0x69bf('0x8'));var squel=require('squel');var crypto=require(_0x69bf('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x69bf('0xa'));var toCsv=require(_0x69bf('0x5'));var querystring=require(_0x69bf('0xb'));var Papa=require(_0x69bf('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x69bf('0xd'));var as=require(_0x69bf('0xe'));var hardwareService=require(_0x69bf('0xf'));var logger=require(_0x69bf('0x10'))('api');var utils=require(_0x69bf('0x11'));var config=require(_0x69bf('0x12'));var licenseUtil=require(_0x69bf('0x13'));var db=require(_0x69bf('0x14'))['db'];function respondWithStatusCode(_0x11bbc1,_0x3f7972){_0x3f7972=_0x3f7972||0xcc;return function(_0x501f6c){if(_0x501f6c){return _0x11bbc1[_0x69bf('0x15')](_0x3f7972);}return _0x11bbc1[_0x69bf('0x16')](_0x3f7972)['end']();};}function respondWithResult(_0xa2ee01,_0x531331){_0x531331=_0x531331||0xc8;return function(_0x5e147b){if(_0x5e147b){return _0xa2ee01[_0x69bf('0x16')](_0x531331)['json'](_0x5e147b);}};}function respondWithFilteredResult(_0x541ec5,_0x2df405){return function(_0x525c29){if(_0x525c29){var _0x2cad81=typeof _0x2df405[_0x69bf('0x17')]==='undefined'&&typeof _0x2df405[_0x69bf('0x18')]===_0x69bf('0x19');var _0x283358=_0x525c29[_0x69bf('0x1a')];var _0x17ae19=_0x2cad81?0x0:_0x2df405[_0x69bf('0x17')];var _0x4eec9e=_0x2cad81?_0x525c29['count']:_0x2df405[_0x69bf('0x17')]+_0x2df405['limit'];var _0x118048;if(_0x4eec9e>=_0x283358){_0x4eec9e=_0x283358;_0x118048=0xc8;}else{_0x118048=0xce;}_0x541ec5['status'](_0x118048);return _0x541ec5[_0x69bf('0x1b')](_0x69bf('0x1c'),_0x17ae19+'-'+_0x4eec9e+'/'+_0x283358)['json'](_0x525c29);}return null;};}function patchUpdates(_0x41ecf9){return function(_0x5e924f){try{jsonpatch[_0x69bf('0x1d')](_0x5e924f,_0x41ecf9,!![]);}catch(_0x29279d){return BPromise[_0x69bf('0x1e')](_0x29279d);}return _0x5e924f[_0x69bf('0x1f')]();};}function saveUpdates(_0x41dea2,_0xc021e3){return function(_0x3b34a3){if(_0x3b34a3){return _0x3b34a3[_0x69bf('0x20')](_0x41dea2)['then'](function(_0x3b17e3){return _0x3b17e3;});}return null;};}function removeEntity(_0x92f9d8,_0xde01e1){return function(_0x58891c){if(_0x58891c){return _0x58891c[_0x69bf('0x21')]()[_0x69bf('0x22')](function(){_0x92f9d8['status'](0xcc)[_0x69bf('0x23')]();});}};}function handleEntityNotFound(_0x5e7303,_0x53d294){return function(_0x51d624){if(!_0x51d624){_0x5e7303[_0x69bf('0x15')](0x194);}return _0x51d624;};}function handleError(_0x3a4ece,_0x10368f){_0x10368f=_0x10368f||0x1f4;return function(_0x26e57c){logger['error'](_0x26e57c['stack']);if(_0x26e57c['name']){delete _0x26e57c['name'];}_0x3a4ece[_0x69bf('0x16')](_0x10368f)['send'](_0x26e57c);};}exports[_0x69bf('0x24')]=function(_0x1c499c,_0x33c886){var _0x4c4731={},_0x249bb3={},_0x2a3d1b={'count':0x0,'rows':[]};var _0x24a87b=_[_0x69bf('0x25')](db[_0x69bf('0x26')]['rawAttributes'],function(_0x2a5028){return{'name':_0x2a5028['fieldName'],'type':_0x2a5028[_0x69bf('0x27')][_0x69bf('0x28')]};});_0x249bb3[_0x69bf('0x29')]=_['map'](_0x24a87b,'name');_0x249bb3[_0x69bf('0x2a')]=_[_0x69bf('0x2b')](_0x1c499c[_0x69bf('0x2a')]);_0x249bb3[_0x69bf('0x2c')]=_[_0x69bf('0x2d')](_0x249bb3[_0x69bf('0x29')],_0x249bb3[_0x69bf('0x2a')]);_0x4c4731[_0x69bf('0x2e')]=_[_0x69bf('0x2d')](_0x249bb3['model'],qs['fields'](_0x1c499c['query'][_0x69bf('0x2f')]));_0x4c4731[_0x69bf('0x2e')]=_0x4c4731[_0x69bf('0x2e')][_0x69bf('0x30')]?_0x4c4731[_0x69bf('0x2e')]:_0x249bb3[_0x69bf('0x29')];if(!_0x1c499c[_0x69bf('0x2a')]['hasOwnProperty'](_0x69bf('0x31'))){_0x4c4731[_0x69bf('0x18')]=qs[_0x69bf('0x18')](_0x1c499c[_0x69bf('0x2a')][_0x69bf('0x18')]);_0x4c4731[_0x69bf('0x17')]=qs['offset'](_0x1c499c[_0x69bf('0x2a')][_0x69bf('0x17')]);}_0x4c4731[_0x69bf('0x32')]=qs['sort'](_0x1c499c[_0x69bf('0x2a')][_0x69bf('0x33')]);_0x4c4731[_0x69bf('0x34')]=qs[_0x69bf('0x2c')](_['pick'](_0x1c499c[_0x69bf('0x2a')],_0x249bb3[_0x69bf('0x2c')]),_0x24a87b);if(_0x1c499c[_0x69bf('0x2a')][_0x69bf('0x35')]){_0x4c4731[_0x69bf('0x34')]=_[_0x69bf('0x36')](_0x4c4731[_0x69bf('0x34')],{'$or':_[_0x69bf('0x25')](_0x24a87b,function(_0x135b41){if(_0x135b41['type']!==_0x69bf('0x37')){var _0x1907af={};_0x1907af[_0x135b41[_0x69bf('0x38')]]={'$like':'%'+_0x1c499c[_0x69bf('0x2a')][_0x69bf('0x35')]+'%'};return _0x1907af;}})});}_0x4c4731=_[_0x69bf('0x36')]({},_0x4c4731,_0x1c499c[_0x69bf('0x39')]);var _0x3e1a52={'where':_0x4c4731[_0x69bf('0x34')]};return db['OpenchannelQueueReport']['count'](_0x3e1a52)['then'](function(_0x4a2180){_0x2a3d1b['count']=_0x4a2180;if(_0x1c499c[_0x69bf('0x2a')][_0x69bf('0x3a')]){_0x4c4731[_0x69bf('0x3b')]=[{'all':!![]}];}return db[_0x69bf('0x26')][_0x69bf('0x3c')](_0x4c4731);})[_0x69bf('0x22')](function(_0x3919d7){_0x2a3d1b[_0x69bf('0x3d')]=_0x3919d7;return _0x2a3d1b;})[_0x69bf('0x22')](respondWithFilteredResult(_0x33c886,_0x4c4731))['catch'](handleError(_0x33c886,null));};exports['show']=function(_0x45b6d5,_0x27ea6a){var _0x3655c2={'raw':!![],'where':{'id':_0x45b6d5['params']['id']}},_0x3b3f65={};_0x3b3f65['model']=_[_0x69bf('0x2b')](db[_0x69bf('0x26')][_0x69bf('0x3e')]);_0x3b3f65[_0x69bf('0x2a')]=_['keys'](_0x45b6d5[_0x69bf('0x2a')]);_0x3b3f65[_0x69bf('0x2c')]=_[_0x69bf('0x2d')](_0x3b3f65[_0x69bf('0x29')],_0x3b3f65[_0x69bf('0x2a')]);_0x3655c2['attributes']=_[_0x69bf('0x2d')](_0x3b3f65['model'],qs[_0x69bf('0x2f')](_0x45b6d5['query']['fields']));_0x3655c2['attributes']=_0x3655c2[_0x69bf('0x2e')][_0x69bf('0x30')]?_0x3655c2[_0x69bf('0x2e')]:_0x3b3f65[_0x69bf('0x29')];if(_0x45b6d5[_0x69bf('0x2a')][_0x69bf('0x3a')]){_0x3655c2[_0x69bf('0x3b')]=[{'all':!![]}];}_0x3655c2=_[_0x69bf('0x36')]({},_0x3655c2,_0x45b6d5[_0x69bf('0x39')]);return db[_0x69bf('0x26')][_0x69bf('0x3f')](_0x3655c2)[_0x69bf('0x22')](handleEntityNotFound(_0x27ea6a,null))[_0x69bf('0x22')](respondWithResult(_0x27ea6a,null))[_0x69bf('0x40')](handleError(_0x27ea6a,null));};exports[_0x69bf('0x41')]=function(_0x2e3a2d,_0x4687a1){return db[_0x69bf('0x26')][_0x69bf('0x41')](_0x2e3a2d[_0x69bf('0x42')],{})[_0x69bf('0x22')](respondWithResult(_0x4687a1,0xc9))['catch'](handleError(_0x4687a1,null));};exports[_0x69bf('0x20')]=function(_0x2ef5cc,_0x3862df){if(_0x2ef5cc['body']['id']){delete _0x2ef5cc['body']['id'];}return db[_0x69bf('0x26')][_0x69bf('0x3f')]({'where':{'id':_0x2ef5cc['params']['id']}})[_0x69bf('0x22')](handleEntityNotFound(_0x3862df,null))[_0x69bf('0x22')](saveUpdates(_0x2ef5cc['body'],null))[_0x69bf('0x22')](respondWithResult(_0x3862df,null))[_0x69bf('0x40')](handleError(_0x3862df,null));};exports[_0x69bf('0x21')]=function(_0x3b21e8,_0xc58d84){return db[_0x69bf('0x26')][_0x69bf('0x3f')]({'where':{'id':_0x3b21e8['params']['id']}})[_0x69bf('0x22')](handleEntityNotFound(_0xc58d84,null))[_0x69bf('0x22')](removeEntity(_0xc58d84,null))[_0x69bf('0x40')](handleError(_0xc58d84,null));};exports['describe']=function(_0x57f4d5,_0x597fd0){return db[_0x69bf('0x26')][_0x69bf('0x43')]()[_0x69bf('0x22')](respondWithResult(_0x597fd0,null))[_0x69bf('0x40')](handleError(_0x597fd0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index ede4ecb..fdb01a3 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x15e43b,_0x2a3132){var _0x537fcf=function(_0x8d67d2){while(--_0x8d67d2){_0x15e43b['push'](_0x15e43b['shift']());}};_0x537fcf(++_0x2a3132);}(_0x2ef3,0xba));var _0x32ef=function(_0x270b8c,_0x4047da){_0x270b8c=_0x270b8c-0x0;var _0xefeba4=_0x2ef3[_0x270b8c];return _0xefeba4;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x3f1bc2,_0x3b95cb){var _0x4b3c51=function(_0x31ccc1){while(--_0x31ccc1){_0x3f1bc2['push'](_0x3f1bc2['shift']());}};_0x4b3c51(++_0x3b95cb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1e03a6,_0xf0349){_0x1e03a6=_0x1e03a6-0x0;var _0x295b64=_0x5fc3[_0x1e03a6];return _0x295b64;};'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 3b18cae..ec3821b 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 _0x4024=['http','request','info','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','debug','UpdateOpenchannelQueueReport','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x4024,0x89));var _0x4402=function(_0x59270d,_0x22344e){_0x59270d=_0x59270d-0x0;var _0x14ae2b=_0x4024[_0x59270d];return _0x14ae2b;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x168acd,_0x4ed77d,_0x3045ae){return new BPromise(function(_0x5d7ca4,_0x5c0b70){return client[_0x4402('0x9')](_0x168acd,_0x3045ae)['then'](function(_0x4d2882){logger[_0x4402('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4ed77d,_0x4402('0xb'));logger['debug'](_0x4402('0xc'),_0x4ed77d,'request\x20sent',JSON[_0x4402('0xd')](_0x4d2882));if(_0x4d2882[_0x4402('0xe')]){if(_0x4d2882['error'][_0x4402('0xf')]===0x1f4){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882['error'][_0x4402('0x11')]);return _0x5c0b70(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);return _0x5d7ca4(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}else{logger[_0x4402('0xa')](_0x4402('0x10'),_0x4ed77d,_0x4402('0xb'));_0x5d7ca4(_0x4d2882[_0x4402('0x12')][_0x4402('0x11')]);}})[_0x4402('0x13')](function(_0x30c390){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x30c390);_0x5c0b70(_0x30c390);});});}exports[_0x4402('0x14')]=function(_0x231382){var _0x5b127f=this;return new Promise(function(_0x494389,_0x663ab7){return db[_0x4402('0x15')]['create'](_0x231382[_0x4402('0x16')],{'raw':_0x231382[_0x4402('0x17')]?_0x231382['options'][_0x4402('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55cc8c){logger[_0x4402('0xa')](_0x4402('0x14'),_0x231382);logger[_0x4402('0x19')]('CreateOpenchannelQueueReport',_0x231382,JSON[_0x4402('0xd')](_0x55cc8c));_0x494389(_0x55cc8c);})['catch'](function(_0x47ab54){logger[_0x4402('0xe')](_0x4402('0x14'),_0x47ab54[_0x4402('0x11')],_0x231382);_0x663ab7(_0x5b127f[_0x4402('0xe')](0x1f4,_0x47ab54[_0x4402('0x11')]));});});};exports[_0x4402('0x1a')]=function(_0x289a3e){var _0x6b1fc5=this;return new Promise(function(_0x24a9b8,_0x4d6846){return db[_0x4402('0x15')]['update'](_0x289a3e[_0x4402('0x16')],{'raw':_0x289a3e[_0x4402('0x17')]?_0x289a3e[_0x4402('0x17')][_0x4402('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x289a3e['options']?_0x289a3e[_0x4402('0x17')]['where']||null:null,'attributes':_0x289a3e['options']?_0x289a3e[_0x4402('0x17')][_0x4402('0x1b')]||null:null,'limit':_0x289a3e[_0x4402('0x17')]?_0x289a3e[_0x4402('0x17')][_0x4402('0x1c')]||null:null})['then'](function(_0x41de44){logger['info'](_0x4402('0x1a'),_0x289a3e);logger[_0x4402('0x19')](_0x4402('0x1a'),_0x289a3e,JSON['stringify'](_0x41de44));_0x24a9b8(_0x41de44);})[_0x4402('0x13')](function(_0x6c87f6){logger[_0x4402('0xe')](_0x4402('0x1a'),_0x6c87f6[_0x4402('0x11')],_0x289a3e);_0x4d6846(_0x6b1fc5[_0x4402('0xe')](0x1f4,_0x6c87f6[_0x4402('0x11')]));});});}; \ No newline at end of file +var _0x1775=['info','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['create'](_0x1b4102[_0x5177('0x1c')],{'raw':_0x1b4102['options']?_0x1b4102[_0x5177('0x1d')][_0x5177('0x1e')]===undefined?!![]:![]:!![]})[_0x5177('0xe')](function(_0x27b732){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON[_0x5177('0x13')](_0x27b732));_0x3e6944(_0x27b732);})[_0x5177('0x19')](function(_0x23dad2){logger[_0x5177('0x14')]('CreateOpenchannelQueueReport',_0x23dad2[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4['error'](0x1f4,_0x23dad2[_0x5177('0x17')]));});});};exports[_0x5177('0x1f')]=function(_0x3b39b5){var _0x2d51d0=this;return new Promise(function(_0x4bc8e2,_0x2503ef){return db['OpenchannelQueueReport']['update'](_0x3b39b5[_0x5177('0x1c')],{'raw':_0x3b39b5[_0x5177('0x1d')]?_0x3b39b5['options'][_0x5177('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b39b5['options']?_0x3b39b5[_0x5177('0x1d')][_0x5177('0x20')]||null:null,'attributes':_0x3b39b5['options']?_0x3b39b5[_0x5177('0x1d')][_0x5177('0x21')]||null:null,'limit':_0x3b39b5[_0x5177('0x1d')]?_0x3b39b5[_0x5177('0x1d')][_0x5177('0x22')]||null:null})[_0x5177('0xe')](function(_0x5577bb){logger['info'](_0x5177('0x1f'),_0x3b39b5);logger[_0x5177('0x10')](_0x5177('0x1f'),_0x3b39b5,JSON[_0x5177('0x13')](_0x5577bb));_0x4bc8e2(_0x5577bb);})[_0x5177('0x19')](function(_0x8134f9){logger[_0x5177('0x14')](_0x5177('0x1f'),_0x8134f9['message'],_0x3b39b5);_0x2503ef(_0x2d51d0[_0x5177('0x14')](0x1f4,_0x8134f9[_0x5177('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index ba94503..7123012 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 _0xb2d6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','delete','destroy','multer','util','path','Router','fs-extra'];(function(_0x3358a0,_0x305225){var _0x20691d=function(_0x281b60){while(--_0x281b60){_0x3358a0['push'](_0x3358a0['shift']());}};_0x20691d(++_0x305225);}(_0xb2d6,0x1bd));var _0x6b2d=function(_0x32c40c,_0x5a48c1){_0x32c40c=_0x32c40c-0x0;var _0x56e979=_0xb2d6[_0x32c40c];return _0x56e979;};'use strict';var multer=require(_0x6b2d('0x0'));var util=require(_0x6b2d('0x1'));var path=require(_0x6b2d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6b2d('0x3')]();var fs_extra=require(_0x6b2d('0x4'));var auth=require(_0x6b2d('0x5'));var interaction=require(_0x6b2d('0x6'));var config=require(_0x6b2d('0x7'));var controller=require(_0x6b2d('0x8'));router[_0x6b2d('0x9')]('/',auth[_0x6b2d('0xa')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6b2d('0xb')]);router['get'](_0x6b2d('0xc'),auth[_0x6b2d('0xa')](),controller[_0x6b2d('0xd')]);router[_0x6b2d('0xe')]('/',auth[_0x6b2d('0xa')](),controller[_0x6b2d('0xf')]);router['put']('/:id',auth[_0x6b2d('0xa')](),controller['update']);router[_0x6b2d('0x10')]('/:id',auth[_0x6b2d('0xa')](),controller[_0x6b2d('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4584=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x2fe192,_0x2cbe1b){var _0x31e892=function(_0x2f303b){while(--_0x2f303b){_0x2fe192['push'](_0x2fe192['shift']());}};_0x31e892(++_0x2cbe1b);}(_0x4584,0x12d));var _0x4458=function(_0x4e2806,_0x29bddf){_0x4e2806=_0x4e2806-0x0;var _0xd5a5a1=_0x4584[_0x4e2806];return _0xd5a5a1;};'use strict';var multer=require(_0x4458('0x0'));var util=require(_0x4458('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4458('0x2')]();var fs_extra=require(_0x4458('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4458('0x4'));var config=require(_0x4458('0x5'));var controller=require('./openchannelTransferReport.controller');router[_0x4458('0x6')]('/',auth[_0x4458('0x7')](),controller[_0x4458('0x8')]);router['get'](_0x4458('0x9'),auth[_0x4458('0x7')](),controller[_0x4458('0xa')]);router[_0x4458('0x6')](_0x4458('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4458('0xc')]);router[_0x4458('0xd')](_0x4458('0xb'),auth[_0x4458('0x7')](),controller[_0x4458('0xe')]);router['delete'](_0x4458('0xb'),auth[_0x4458('0x7')](),controller[_0x4458('0xf')]);module[_0x4458('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index d421a97..90c48b1 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x1e5cb9,_0x3a4498){var _0x153fe6=function(_0x3e57b8){while(--_0x3e57b8){_0x1e5cb9['push'](_0x1e5cb9['shift']());}};_0x153fe6(++_0x3a4498);}(_0x00bb,0x1d8));var _0xb00b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x00bb[_0xbca1b1];return _0x4e1686;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x25bbd6,_0x18f6d3){var _0x3a4c78=function(_0x277579){while(--_0x277579){_0x25bbd6['push'](_0x25bbd6['shift']());}};_0x3a4c78(++_0x18f6d3);}(_0x34e8,0x12c));var _0x834e=function(_0x29e956,_0x13c241){_0x29e956=_0x29e956-0x0;var _0x40e04e=_0x34e8[_0x29e956];return _0x40e04e;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 7d23dd3..5a18c22 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 _0x2b9a=['ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','offset','count','limit','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelTransferReport','include','findAll','show','params','includeAll','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv'];(function(_0x3d2297,_0x239f81){var _0x7b3c96=function(_0x52453e){while(--_0x52453e){_0x3d2297['push'](_0x3d2297['shift']());}};_0x7b3c96(++_0x239f81);}(_0x2b9a,0x1cc));var _0xa2b9=function(_0xc65818,_0x5cd044){_0xc65818=_0xc65818-0x0;var _0x18c3ac=_0x2b9a[_0xc65818];return _0x18c3ac;};'use strict';var emlformat=require(_0xa2b9('0x0'));var rimraf=require(_0xa2b9('0x1'));var zipdir=require(_0xa2b9('0x2'));var jsonpatch=require(_0xa2b9('0x3'));var rp=require(_0xa2b9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa2b9('0x5'));var path=require(_0xa2b9('0x6'));var sox=require('sox');var csv=require(_0xa2b9('0x7'));var ejs=require(_0xa2b9('0x8'));var fs=require('fs');var fs_extra=require(_0xa2b9('0x9'));var _=require(_0xa2b9('0xa'));var squel=require('squel');var crypto=require(_0xa2b9('0xb'));var jsforce=require(_0xa2b9('0xc'));var deskjs=require(_0xa2b9('0xd'));var toCsv=require(_0xa2b9('0x7'));var querystring=require(_0xa2b9('0xe'));var Papa=require(_0xa2b9('0xf'));var Redis=require(_0xa2b9('0x10'));var authService=require(_0xa2b9('0x11'));var qs=require(_0xa2b9('0x12'));var as=require(_0xa2b9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2b9('0x14'))(_0xa2b9('0x15'));var utils=require(_0xa2b9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa2b9('0x17'));var db=require(_0xa2b9('0x18'))['db'];function respondWithStatusCode(_0x52f4db,_0xb837d0){_0xb837d0=_0xb837d0||0xcc;return function(_0x143f1c){if(_0x143f1c){return _0x52f4db[_0xa2b9('0x19')](_0xb837d0);}return _0x52f4db['status'](_0xb837d0)[_0xa2b9('0x1a')]();};}function respondWithResult(_0x44deee,_0x473f86){_0x473f86=_0x473f86||0xc8;return function(_0x36af1b){if(_0x36af1b){return _0x44deee[_0xa2b9('0x1b')](_0x473f86)[_0xa2b9('0x1c')](_0x36af1b);}};}function respondWithFilteredResult(_0x42a249,_0x317f76){return function(_0xd47477){if(_0xd47477){var _0x3d623e=typeof _0x317f76['offset']===_0xa2b9('0x1d')&&typeof _0x317f76['limit']===_0xa2b9('0x1d');var _0xb2bef6=_0xd47477['count'];var _0x100579=_0x3d623e?0x0:_0x317f76[_0xa2b9('0x1e')];var _0x27790b=_0x3d623e?_0xd47477[_0xa2b9('0x1f')]:_0x317f76[_0xa2b9('0x1e')]+_0x317f76[_0xa2b9('0x20')];var _0x5eee68;if(_0x27790b>=_0xb2bef6){_0x27790b=_0xb2bef6;_0x5eee68=0xc8;}else{_0x5eee68=0xce;}_0x42a249['status'](_0x5eee68);return _0x42a249['set'](_0xa2b9('0x21'),_0x100579+'-'+_0x27790b+'/'+_0xb2bef6)[_0xa2b9('0x1c')](_0xd47477);}return null;};}function patchUpdates(_0x5a814a){return function(_0x575904){try{jsonpatch[_0xa2b9('0x22')](_0x575904,_0x5a814a,!![]);}catch(_0xac206c){return BPromise[_0xa2b9('0x23')](_0xac206c);}return _0x575904['save']();};}function saveUpdates(_0x3a3d92,_0xde482){return function(_0x50acab){if(_0x50acab){return _0x50acab[_0xa2b9('0x24')](_0x3a3d92)[_0xa2b9('0x25')](function(_0x240095){return _0x240095;});}return null;};}function removeEntity(_0x277536,_0x5bf4d3){return function(_0x343a79){if(_0x343a79){return _0x343a79['destroy']()['then'](function(){_0x277536[_0xa2b9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39cb82,_0x2f92fb){return function(_0x5e5a49){if(!_0x5e5a49){_0x39cb82[_0xa2b9('0x19')](0x194);}return _0x5e5a49;};}function handleError(_0xa2366b,_0x242af9){_0x242af9=_0x242af9||0x1f4;return function(_0x3a9c4e){logger[_0xa2b9('0x26')](_0x3a9c4e[_0xa2b9('0x27')]);if(_0x3a9c4e[_0xa2b9('0x28')]){delete _0x3a9c4e[_0xa2b9('0x28')];}_0xa2366b[_0xa2b9('0x1b')](_0x242af9)[_0xa2b9('0x29')](_0x3a9c4e);};}exports[_0xa2b9('0x2a')]=function(_0x388626,_0x3f758e){var _0x53c24c={},_0x51f29e={},_0x391a65={'count':0x0,'rows':[]};var _0x271219=_['map'](db['OpenchannelTransferReport'][_0xa2b9('0x2b')],function(_0x121ce0){return{'name':_0x121ce0[_0xa2b9('0x2c')],'type':_0x121ce0[_0xa2b9('0x2d')][_0xa2b9('0x2e')]};});_0x51f29e['model']=_[_0xa2b9('0x2f')](_0x271219,_0xa2b9('0x28'));_0x51f29e[_0xa2b9('0x30')]=_[_0xa2b9('0x31')](_0x388626[_0xa2b9('0x30')]);_0x51f29e[_0xa2b9('0x32')]=_[_0xa2b9('0x33')](_0x51f29e[_0xa2b9('0x34')],_0x51f29e[_0xa2b9('0x30')]);_0x53c24c[_0xa2b9('0x35')]=_[_0xa2b9('0x33')](_0x51f29e[_0xa2b9('0x34')],qs[_0xa2b9('0x36')](_0x388626[_0xa2b9('0x30')][_0xa2b9('0x36')]));_0x53c24c[_0xa2b9('0x35')]=_0x53c24c['attributes'][_0xa2b9('0x37')]?_0x53c24c[_0xa2b9('0x35')]:_0x51f29e[_0xa2b9('0x34')];if(!_0x388626[_0xa2b9('0x30')][_0xa2b9('0x38')](_0xa2b9('0x39'))){_0x53c24c[_0xa2b9('0x20')]=qs['limit'](_0x388626[_0xa2b9('0x30')][_0xa2b9('0x20')]);_0x53c24c['offset']=qs['offset'](_0x388626[_0xa2b9('0x30')][_0xa2b9('0x1e')]);}_0x53c24c[_0xa2b9('0x3a')]=qs[_0xa2b9('0x3b')](_0x388626[_0xa2b9('0x30')][_0xa2b9('0x3b')]);_0x53c24c[_0xa2b9('0x3c')]=qs[_0xa2b9('0x32')](_[_0xa2b9('0x3d')](_0x388626[_0xa2b9('0x30')],_0x51f29e[_0xa2b9('0x32')]),_0x271219);if(_0x388626[_0xa2b9('0x30')][_0xa2b9('0x3e')]){_0x53c24c[_0xa2b9('0x3c')]=_[_0xa2b9('0x3f')](_0x53c24c[_0xa2b9('0x3c')],{'$or':_[_0xa2b9('0x2f')](_0x271219,function(_0x133eb){if(_0x133eb['type']!==_0xa2b9('0x40')){var _0x16d108={};_0x16d108[_0x133eb[_0xa2b9('0x28')]]={'$like':'%'+_0x388626[_0xa2b9('0x30')][_0xa2b9('0x3e')]+'%'};return _0x16d108;}})});}_0x53c24c=_['merge']({},_0x53c24c,_0x388626[_0xa2b9('0x41')]);var _0x2c68d7={'where':_0x53c24c['where']};return db[_0xa2b9('0x42')]['count'](_0x2c68d7)[_0xa2b9('0x25')](function(_0x4780da){_0x391a65[_0xa2b9('0x1f')]=_0x4780da;if(_0x388626['query']['includeAll']){_0x53c24c[_0xa2b9('0x43')]=[{'all':!![]}];}return db[_0xa2b9('0x42')][_0xa2b9('0x44')](_0x53c24c);})[_0xa2b9('0x25')](function(_0x5df660){_0x391a65['rows']=_0x5df660;return _0x391a65;})[_0xa2b9('0x25')](respondWithFilteredResult(_0x3f758e,_0x53c24c))['catch'](handleError(_0x3f758e,null));};exports[_0xa2b9('0x45')]=function(_0x2de12a,_0x148563){var _0x3cb24b={'raw':!![],'where':{'id':_0x2de12a[_0xa2b9('0x46')]['id']}},_0x34621d={};_0x34621d[_0xa2b9('0x34')]=_[_0xa2b9('0x31')](db[_0xa2b9('0x42')][_0xa2b9('0x2b')]);_0x34621d[_0xa2b9('0x30')]=_[_0xa2b9('0x31')](_0x2de12a[_0xa2b9('0x30')]);_0x34621d[_0xa2b9('0x32')]=_[_0xa2b9('0x33')](_0x34621d[_0xa2b9('0x34')],_0x34621d[_0xa2b9('0x30')]);_0x3cb24b[_0xa2b9('0x35')]=_[_0xa2b9('0x33')](_0x34621d['model'],qs[_0xa2b9('0x36')](_0x2de12a[_0xa2b9('0x30')][_0xa2b9('0x36')]));_0x3cb24b[_0xa2b9('0x35')]=_0x3cb24b[_0xa2b9('0x35')][_0xa2b9('0x37')]?_0x3cb24b[_0xa2b9('0x35')]:_0x34621d[_0xa2b9('0x34')];if(_0x2de12a[_0xa2b9('0x30')][_0xa2b9('0x47')]){_0x3cb24b[_0xa2b9('0x43')]=[{'all':!![]}];}_0x3cb24b=_[_0xa2b9('0x3f')]({},_0x3cb24b,_0x2de12a[_0xa2b9('0x41')]);return db[_0xa2b9('0x42')][_0xa2b9('0x48')](_0x3cb24b)[_0xa2b9('0x25')](handleEntityNotFound(_0x148563,null))[_0xa2b9('0x25')](respondWithResult(_0x148563,null))[_0xa2b9('0x49')](handleError(_0x148563,null));};exports[_0xa2b9('0x4a')]=function(_0x1e6f42,_0x33d7a2){return db[_0xa2b9('0x42')]['create'](_0x1e6f42[_0xa2b9('0x4b')],{})[_0xa2b9('0x25')](respondWithResult(_0x33d7a2,0xc9))[_0xa2b9('0x49')](handleError(_0x33d7a2,null));};exports[_0xa2b9('0x24')]=function(_0x803f39,_0x11aeeb){if(_0x803f39[_0xa2b9('0x4b')]['id']){delete _0x803f39[_0xa2b9('0x4b')]['id'];}return db['OpenchannelTransferReport'][_0xa2b9('0x48')]({'where':{'id':_0x803f39[_0xa2b9('0x46')]['id']}})[_0xa2b9('0x25')](handleEntityNotFound(_0x11aeeb,null))[_0xa2b9('0x25')](saveUpdates(_0x803f39[_0xa2b9('0x4b')],null))['then'](respondWithResult(_0x11aeeb,null))['catch'](handleError(_0x11aeeb,null));};exports[_0xa2b9('0x4c')]=function(_0x49365e,_0x3957f9){return db[_0xa2b9('0x42')]['find']({'where':{'id':_0x49365e['params']['id']}})[_0xa2b9('0x25')](handleEntityNotFound(_0x3957f9,null))[_0xa2b9('0x25')](removeEntity(_0x3957f9,null))[_0xa2b9('0x49')](handleError(_0x3957f9,null));};exports[_0xa2b9('0x4d')]=function(_0x3e8485,_0x5f04ab){return db[_0xa2b9('0x42')][_0xa2b9('0x4d')]()[_0xa2b9('0x25')](respondWithResult(_0x5f04ab,null))[_0xa2b9('0x49')](handleError(_0x5f04ab,null));}; \ No newline at end of file +var _0xb658=['length','hasOwnProperty','limit','offset','order','sort','where','pick','merge','filter','options','includeAll','include','catch','show','params','keys','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','set','Content-Range','json','apply','update','then','end','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields'];(function(_0xe5065b,_0x50c032){var _0x34c12=function(_0x94eed7){while(--_0x94eed7){_0xe5065b['push'](_0xe5065b['shift']());}};_0x34c12(++_0x50c032);}(_0xb658,0x1de));var _0x8b65=function(_0x26b97a,_0x180d2f){_0x26b97a=_0x26b97a-0x0;var _0x5b4b85=_0xb658[_0x26b97a];return _0x5b4b85;};'use strict';var emlformat=require(_0x8b65('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b65('0x1'));var rp=require(_0x8b65('0x2'));var moment=require(_0x8b65('0x3'));var BPromise=require(_0x8b65('0x4'));var Mustache=require(_0x8b65('0x5'));var util=require('util');var path=require(_0x8b65('0x6'));var sox=require(_0x8b65('0x7'));var csv=require(_0x8b65('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b65('0x9'));var _=require(_0x8b65('0xa'));var squel=require('squel');var crypto=require(_0x8b65('0xb'));var jsforce=require(_0x8b65('0xc'));var deskjs=require(_0x8b65('0xd'));var toCsv=require(_0x8b65('0x8'));var querystring=require(_0x8b65('0xe'));var Papa=require(_0x8b65('0xf'));var Redis=require(_0x8b65('0x10'));var authService=require(_0x8b65('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b65('0x12'));var hardwareService=require(_0x8b65('0x13'));var logger=require(_0x8b65('0x14'))(_0x8b65('0x15'));var utils=require(_0x8b65('0x16'));var config=require(_0x8b65('0x17'));var licenseUtil=require(_0x8b65('0x18'));var db=require(_0x8b65('0x19'))['db'];function respondWithStatusCode(_0x46c616,_0x2540f9){_0x2540f9=_0x2540f9||0xcc;return function(_0x382518){if(_0x382518){return _0x46c616['sendStatus'](_0x2540f9);}return _0x46c616[_0x8b65('0x1a')](_0x2540f9)['end']();};}function respondWithResult(_0x3d2e15,_0x2d22bc){_0x2d22bc=_0x2d22bc||0xc8;return function(_0x104869){if(_0x104869){return _0x3d2e15[_0x8b65('0x1a')](_0x2d22bc)['json'](_0x104869);}};}function respondWithFilteredResult(_0x2eb575,_0xd67db0){return function(_0x5b85aa){if(_0x5b85aa){var _0x5921d7=typeof _0xd67db0['offset']===_0x8b65('0x1b')&&typeof _0xd67db0['limit']===_0x8b65('0x1b');var _0x2d6e65=_0x5b85aa[_0x8b65('0x1c')];var _0x463f45=_0x5921d7?0x0:_0xd67db0['offset'];var _0x18f8b4=_0x5921d7?_0x5b85aa['count']:_0xd67db0['offset']+_0xd67db0['limit'];var _0x4df2f8;if(_0x18f8b4>=_0x2d6e65){_0x18f8b4=_0x2d6e65;_0x4df2f8=0xc8;}else{_0x4df2f8=0xce;}_0x2eb575[_0x8b65('0x1a')](_0x4df2f8);return _0x2eb575[_0x8b65('0x1d')](_0x8b65('0x1e'),_0x463f45+'-'+_0x18f8b4+'/'+_0x2d6e65)[_0x8b65('0x1f')](_0x5b85aa);}return null;};}function patchUpdates(_0x1a3e3b){return function(_0x3ba81e){try{jsonpatch[_0x8b65('0x20')](_0x3ba81e,_0x1a3e3b,!![]);}catch(_0x5da736){return BPromise['reject'](_0x5da736);}return _0x3ba81e['save']();};}function saveUpdates(_0x126f39,_0x3d684f){return function(_0x11f874){if(_0x11f874){return _0x11f874[_0x8b65('0x21')](_0x126f39)[_0x8b65('0x22')](function(_0x408908){return _0x408908;});}return null;};}function removeEntity(_0x3f58e8,_0x995223){return function(_0x3d2511){if(_0x3d2511){return _0x3d2511['destroy']()[_0x8b65('0x22')](function(){_0x3f58e8[_0x8b65('0x1a')](0xcc)[_0x8b65('0x23')]();});}};}function handleEntityNotFound(_0x4eceec,_0x8e8607){return function(_0xef0f33){if(!_0xef0f33){_0x4eceec[_0x8b65('0x24')](0x194);}return _0xef0f33;};}function handleError(_0x1329b8,_0x5a44ee){_0x5a44ee=_0x5a44ee||0x1f4;return function(_0x5660af){logger[_0x8b65('0x25')](_0x5660af[_0x8b65('0x26')]);if(_0x5660af[_0x8b65('0x27')]){delete _0x5660af['name'];}_0x1329b8[_0x8b65('0x1a')](_0x5a44ee)[_0x8b65('0x28')](_0x5660af);};}exports[_0x8b65('0x29')]=function(_0x40a67f,_0x18ed33){var _0x170a3c={},_0x3985db={},_0x4345b7={'count':0x0,'rows':[]};var _0x4a5321=_[_0x8b65('0x2a')](db[_0x8b65('0x2b')][_0x8b65('0x2c')],function(_0x2a6831){return{'name':_0x2a6831[_0x8b65('0x2d')],'type':_0x2a6831[_0x8b65('0x2e')][_0x8b65('0x2f')]};});_0x3985db['model']=_[_0x8b65('0x2a')](_0x4a5321,_0x8b65('0x27'));_0x3985db['query']=_['keys'](_0x40a67f[_0x8b65('0x30')]);_0x3985db[_0x8b65('0x31')]=_[_0x8b65('0x32')](_0x3985db['model'],_0x3985db[_0x8b65('0x30')]);_0x170a3c[_0x8b65('0x33')]=_[_0x8b65('0x32')](_0x3985db[_0x8b65('0x34')],qs[_0x8b65('0x35')](_0x40a67f[_0x8b65('0x30')][_0x8b65('0x35')]));_0x170a3c[_0x8b65('0x33')]=_0x170a3c['attributes'][_0x8b65('0x36')]?_0x170a3c[_0x8b65('0x33')]:_0x3985db[_0x8b65('0x34')];if(!_0x40a67f[_0x8b65('0x30')][_0x8b65('0x37')]('nolimit')){_0x170a3c['limit']=qs[_0x8b65('0x38')](_0x40a67f['query']['limit']);_0x170a3c[_0x8b65('0x39')]=qs[_0x8b65('0x39')](_0x40a67f['query'][_0x8b65('0x39')]);}_0x170a3c[_0x8b65('0x3a')]=qs[_0x8b65('0x3b')](_0x40a67f[_0x8b65('0x30')][_0x8b65('0x3b')]);_0x170a3c[_0x8b65('0x3c')]=qs[_0x8b65('0x31')](_[_0x8b65('0x3d')](_0x40a67f[_0x8b65('0x30')],_0x3985db[_0x8b65('0x31')]),_0x4a5321);if(_0x40a67f['query']['filter']){_0x170a3c[_0x8b65('0x3c')]=_[_0x8b65('0x3e')](_0x170a3c['where'],{'$or':_[_0x8b65('0x2a')](_0x4a5321,function(_0x3b3e37){if(_0x3b3e37[_0x8b65('0x2e')]!=='VIRTUAL'){var _0x576269={};_0x576269[_0x3b3e37[_0x8b65('0x27')]]={'$like':'%'+_0x40a67f[_0x8b65('0x30')][_0x8b65('0x3f')]+'%'};return _0x576269;}})});}_0x170a3c=_['merge']({},_0x170a3c,_0x40a67f[_0x8b65('0x40')]);var _0x3cd434={'where':_0x170a3c['where']};return db['OpenchannelTransferReport'][_0x8b65('0x1c')](_0x3cd434)['then'](function(_0x383ed7){_0x4345b7[_0x8b65('0x1c')]=_0x383ed7;if(_0x40a67f[_0x8b65('0x30')][_0x8b65('0x41')]){_0x170a3c[_0x8b65('0x42')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x170a3c);})[_0x8b65('0x22')](function(_0xea4aa9){_0x4345b7['rows']=_0xea4aa9;return _0x4345b7;})[_0x8b65('0x22')](respondWithFilteredResult(_0x18ed33,_0x170a3c))[_0x8b65('0x43')](handleError(_0x18ed33,null));};exports[_0x8b65('0x44')]=function(_0x48c2d4,_0x312c15){var _0x4af489={'raw':!![],'where':{'id':_0x48c2d4[_0x8b65('0x45')]['id']}},_0x3f7fa5={};_0x3f7fa5[_0x8b65('0x34')]=_[_0x8b65('0x46')](db[_0x8b65('0x2b')][_0x8b65('0x2c')]);_0x3f7fa5[_0x8b65('0x30')]=_['keys'](_0x48c2d4[_0x8b65('0x30')]);_0x3f7fa5[_0x8b65('0x31')]=_[_0x8b65('0x32')](_0x3f7fa5[_0x8b65('0x34')],_0x3f7fa5['query']);_0x4af489[_0x8b65('0x33')]=_[_0x8b65('0x32')](_0x3f7fa5[_0x8b65('0x34')],qs[_0x8b65('0x35')](_0x48c2d4[_0x8b65('0x30')][_0x8b65('0x35')]));_0x4af489[_0x8b65('0x33')]=_0x4af489[_0x8b65('0x33')][_0x8b65('0x36')]?_0x4af489[_0x8b65('0x33')]:_0x3f7fa5[_0x8b65('0x34')];if(_0x48c2d4['query'][_0x8b65('0x41')]){_0x4af489[_0x8b65('0x42')]=[{'all':!![]}];}_0x4af489=_[_0x8b65('0x3e')]({},_0x4af489,_0x48c2d4[_0x8b65('0x40')]);return db[_0x8b65('0x2b')][_0x8b65('0x47')](_0x4af489)[_0x8b65('0x22')](handleEntityNotFound(_0x312c15,null))[_0x8b65('0x22')](respondWithResult(_0x312c15,null))[_0x8b65('0x43')](handleError(_0x312c15,null));};exports[_0x8b65('0x48')]=function(_0x28879d,_0x2b6ed9){return db[_0x8b65('0x2b')][_0x8b65('0x48')](_0x28879d['body'],{})['then'](respondWithResult(_0x2b6ed9,0xc9))[_0x8b65('0x43')](handleError(_0x2b6ed9,null));};exports[_0x8b65('0x21')]=function(_0x2118a4,_0x4bf35a){if(_0x2118a4[_0x8b65('0x49')]['id']){delete _0x2118a4[_0x8b65('0x49')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x2118a4[_0x8b65('0x45')]['id']}})['then'](handleEntityNotFound(_0x4bf35a,null))[_0x8b65('0x22')](saveUpdates(_0x2118a4[_0x8b65('0x49')],null))['then'](respondWithResult(_0x4bf35a,null))[_0x8b65('0x43')](handleError(_0x4bf35a,null));};exports[_0x8b65('0x4a')]=function(_0x86c840,_0xe4f6e8){return db[_0x8b65('0x2b')][_0x8b65('0x47')]({'where':{'id':_0x86c840['params']['id']}})[_0x8b65('0x22')](handleEntityNotFound(_0xe4f6e8,null))[_0x8b65('0x22')](removeEntity(_0xe4f6e8,null))[_0x8b65('0x43')](handleError(_0xe4f6e8,null));};exports[_0x8b65('0x4b')]=function(_0x444a84,_0x55a025){return db[_0x8b65('0x2b')][_0x8b65('0x4b')]()[_0x8b65('0x22')](respondWithResult(_0x55a025,null))[_0x8b65('0x43')](handleError(_0x55a025,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 84f7c06..f75a8b7 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 _0x65a4=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','report_openchannel_transfer','uniqueid'];(function(_0x32a884,_0x183853){var _0x242f9b=function(_0x556c63){while(--_0x556c63){_0x32a884['push'](_0x32a884['shift']());}};_0x242f9b(++_0x183853);}(_0x65a4,0xdd));var _0x465a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x65a4[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x465a('0x0'));var util=require(_0x465a('0x1'));var logger=require('../../config/logger')(_0x465a('0x2'));var moment=require(_0x465a('0x3'));var BPromise=require(_0x465a('0x4'));var rp=require(_0x465a('0x5'));var fs=require('fs');var path=require(_0x465a('0x6'));var rimraf=require(_0x465a('0x7'));var config=require(_0x465a('0x8'));var attributes=require(_0x465a('0x9'));module['exports']=function(_0x4c5084,_0x36828b){return _0x4c5084[_0x465a('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x465a('0xb'),'paranoid':![],'indexes':[{'name':_0x465a('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x89fb=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','moment','bluebird','request-promise'];(function(_0x3f4fb8,_0x1046cc){var _0x377228=function(_0x5db42c){while(--_0x5db42c){_0x3f4fb8['push'](_0x3f4fb8['shift']());}};_0x377228(++_0x1046cc);}(_0x89fb,0x127));var _0xb89f=function(_0x481d53,_0x5b2b1a){_0x481d53=_0x481d53-0x0;var _0x520f01=_0x89fb[_0x481d53];return _0x520f01;};'use strict';var _=require('lodash');var util=require(_0xb89f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb89f('0x1'));var BPromise=require(_0xb89f('0x2'));var rp=require(_0xb89f('0x3'));var fs=require('fs');var path=require(_0xb89f('0x4'));var rimraf=require(_0xb89f('0x5'));var config=require(_0xb89f('0x6'));var attributes=require(_0xb89f('0x7'));module[_0xb89f('0x8')]=function(_0x168318,_0x17e43c){return _0x168318[_0xb89f('0x9')](_0xb89f('0xa'),attributes,{'tableName':_0xb89f('0xb'),'paranoid':![],'indexes':[{'name':_0xb89f('0xc'),'fields':[_0xb89f('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 bf576b5..79581ba 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 _0x1c88=['request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x464d1b,_0x4d4525){var _0x1b21c0=function(_0x43ab20){while(--_0x43ab20){_0x464d1b['push'](_0x464d1b['shift']());}};_0x1b21c0(++_0x4d4525);}(_0x1c88,0x1a9));var _0x81c8=function(_0x673ea4,_0x449076){_0x673ea4=_0x673ea4-0x0;var _0x3e5938=_0x1c88[_0x673ea4];return _0x3e5938;};'use strict';var _=require(_0x81c8('0x0'));var util=require('util');var moment=require(_0x81c8('0x1'));var BPromise=require(_0x81c8('0x2'));var rs=require(_0x81c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x81c8('0x4'));var logger=require(_0x81c8('0x5'))(_0x81c8('0x6'));var config=require(_0x81c8('0x7'));var jayson=require(_0x81c8('0x8'));var client=jayson[_0x81c8('0x9')][_0x81c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x182e47,_0x3a1778,_0x2111ca){return new BPromise(function(_0x191c40,_0x1ba4cb){return client[_0x81c8('0xb')](_0x182e47,_0x2111ca)['then'](function(_0x34ddaf){logger[_0x81c8('0xc')](_0x81c8('0xd'),_0x3a1778,'request\x20sent');logger['debug'](_0x81c8('0xe'),_0x3a1778,_0x81c8('0xf'),JSON[_0x81c8('0x10')](_0x34ddaf));if(_0x34ddaf['error']){if(_0x34ddaf[_0x81c8('0x11')][_0x81c8('0x12')]===0x1f4){logger['error'](_0x81c8('0xd'),_0x3a1778,_0x34ddaf[_0x81c8('0x11')][_0x81c8('0x13')]);return _0x1ba4cb(_0x34ddaf[_0x81c8('0x11')]['message']);}logger[_0x81c8('0x11')](_0x81c8('0xd'),_0x3a1778,_0x34ddaf[_0x81c8('0x11')]['message']);return _0x191c40(_0x34ddaf[_0x81c8('0x11')][_0x81c8('0x13')]);}else{logger[_0x81c8('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a1778,_0x81c8('0xf'));_0x191c40(_0x34ddaf[_0x81c8('0x14')][_0x81c8('0x13')]);}})[_0x81c8('0x15')](function(_0x311b6c){logger['error'](_0x81c8('0xd'),_0x3a1778,_0x311b6c);_0x1ba4cb(_0x311b6c);});});} \ No newline at end of file +var _0x64f5=['result','catch','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x2fbcf6,_0x2e7155){var _0x3e7265=function(_0x15a3c3){while(--_0x15a3c3){_0x2fbcf6['push'](_0x2fbcf6['shift']());}};_0x3e7265(++_0x2e7155);}(_0x64f5,0x17e));var _0x564f=function(_0x1600c8,_0x23c338){_0x1600c8=_0x1600c8-0x0;var _0x5c9a2f=_0x64f5[_0x1600c8];return _0x5c9a2f;};'use strict';var _=require(_0x564f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x564f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x564f('0x2'))['db'];var utils=require(_0x564f('0x3'));var logger=require('../../config/logger')(_0x564f('0x4'));var config=require(_0x564f('0x5'));var jayson=require(_0x564f('0x6'));var client=jayson[_0x564f('0x7')][_0x564f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d3dae,_0x26f14e,_0x28db5a){return new BPromise(function(_0x275bd6,_0x26fd74){return client[_0x564f('0x9')](_0x4d3dae,_0x28db5a)[_0x564f('0xa')](function(_0x2e2b5c){logger[_0x564f('0xb')](_0x564f('0xc'),_0x26f14e,_0x564f('0xd'));logger[_0x564f('0xe')](_0x564f('0xf'),_0x26f14e,_0x564f('0xd'),JSON['stringify'](_0x2e2b5c));if(_0x2e2b5c['error']){if(_0x2e2b5c[_0x564f('0x10')]['code']===0x1f4){logger[_0x564f('0x10')](_0x564f('0xc'),_0x26f14e,_0x2e2b5c[_0x564f('0x10')]['message']);return _0x26fd74(_0x2e2b5c[_0x564f('0x10')][_0x564f('0x11')]);}logger[_0x564f('0x10')](_0x564f('0xc'),_0x26f14e,_0x2e2b5c[_0x564f('0x10')]['message']);return _0x275bd6(_0x2e2b5c['error'][_0x564f('0x11')]);}else{logger[_0x564f('0xb')](_0x564f('0xc'),_0x26f14e,_0x564f('0xd'));_0x275bd6(_0x2e2b5c[_0x564f('0x12')][_0x564f('0x11')]);}})[_0x564f('0x13')](function(_0x15d9d7){logger[_0x564f('0x10')](_0x564f('0xc'),_0x26f14e,_0x15d9d7);_0x26fd74(_0x15d9d7);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index a802814..b597acc 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 _0xee9a=['get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x25e620,_0x2d558c){var _0x1785f3=function(_0x1a258f){while(--_0x1a258f){_0x25e620['push'](_0x25e620['shift']());}};_0x1785f3(++_0x2d558c);}(_0xee9a,0x12a));var _0xaee9=function(_0x16ceb4,_0x9a6429){_0x16ceb4=_0x16ceb4-0x0;var _0x79a778=_0xee9a[_0x16ceb4];return _0x79a778;};'use strict';var multer=require('multer');var util=require(_0xaee9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaee9('0x1'));var router=express[_0xaee9('0x2')]();var fs_extra=require(_0xaee9('0x3'));var auth=require(_0xaee9('0x4'));var interaction=require(_0xaee9('0x5'));var config=require(_0xaee9('0x6'));var controller=require(_0xaee9('0x7'));router[_0xaee9('0x8')]('/',auth[_0xaee9('0x9')](),controller[_0xaee9('0xa')]);router[_0xaee9('0x8')]('/:id',auth[_0xaee9('0x9')](),controller['show']);router[_0xaee9('0xb')]('/',auth[_0xaee9('0x9')](),controller[_0xaee9('0xc')]);router[_0xaee9('0xd')](_0xaee9('0xe'),auth[_0xaee9('0x9')](),controller[_0xaee9('0xf')]);router[_0xaee9('0x10')]('/:id',auth[_0xaee9('0x9')](),controller[_0xaee9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7ba8=['exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy'];(function(_0x210b46,_0x52a05f){var _0x203df2=function(_0x3421ea){while(--_0x3421ea){_0x210b46['push'](_0x210b46['shift']());}};_0x203df2(++_0x52a05f);}(_0x7ba8,0x17d));var _0x87ba=function(_0x395d74,_0x455c53){_0x395d74=_0x395d74-0x0;var _0x5187f2=_0x7ba8[_0x395d74];return _0x5187f2;};'use strict';var multer=require('multer');var util=require(_0x87ba('0x0'));var path=require(_0x87ba('0x1'));var timeout=require(_0x87ba('0x2'));var express=require(_0x87ba('0x3'));var router=express[_0x87ba('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x87ba('0x5'));var config=require(_0x87ba('0x6'));var controller=require(_0x87ba('0x7'));router[_0x87ba('0x8')]('/',auth[_0x87ba('0x9')](),controller[_0x87ba('0xa')]);router[_0x87ba('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x87ba('0xb')]);router['post']('/',auth[_0x87ba('0x9')](),controller[_0x87ba('0xc')]);router[_0x87ba('0xd')](_0x87ba('0xe'),auth[_0x87ba('0x9')](),controller[_0x87ba('0xf')]);router[_0x87ba('0x10')](_0x87ba('0xe'),auth['isAuthenticated'](),controller[_0x87ba('0x11')]);module[_0x87ba('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 8c030a6..b4ead04 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 _0x3b6d=['exports','STRING','sequelize'];(function(_0x49cf88,_0x5aa395){var _0x4bd501=function(_0x4d2937){while(--_0x4d2937){_0x49cf88['push'](_0x49cf88['shift']());}};_0x4bd501(++_0x5aa395);}(_0x3b6d,0x98));var _0xd3b6=function(_0x1d5e5e,_0x3730d9){_0x1d5e5e=_0x1d5e5e-0x0;var _0x44981a=_0x3b6d[_0x1d5e5e];return _0x44981a;};'use strict';var Sequelize=require(_0xd3b6('0x0'));module[_0xd3b6('0x1')]={'name':{'type':Sequelize[_0xd3b6('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xd3b6('0x2')]}}; \ No newline at end of file +var _0x67e6=['exports','STRING','name','sequelize'];(function(_0x188719,_0x239a5a){var _0x2bcf5d=function(_0xfd71e7){while(--_0xfd71e7){_0x188719['push'](_0x188719['shift']());}};_0x2bcf5d(++_0x239a5a);}(_0x67e6,0x1cf));var _0x667e=function(_0x1e863e,_0x47ac05){_0x1e863e=_0x1e863e-0x0;var _0x3323b7=_0x67e6[_0x1e863e];return _0x3323b7;};'use strict';var Sequelize=require(_0x667e('0x0'));module[_0x667e('0x1')]={'name':{'type':Sequelize[_0x667e('0x2')],'unique':_0x667e('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x667e('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 080a116..7bc2208 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 _0x8b14=['keys','intersection','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','get','Pauses','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query'];(function(_0x233da7,_0x1e416e){var _0x1a9c19=function(_0x5797c3){while(--_0x5797c3){_0x233da7['push'](_0x233da7['shift']());}};_0x1a9c19(++_0x1e416e);}(_0x8b14,0x1d3));var _0x48b1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8b14[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x48b1('0x0'));var rimraf=require(_0x48b1('0x1'));var zipdir=require(_0x48b1('0x2'));var jsonpatch=require(_0x48b1('0x3'));var rp=require(_0x48b1('0x4'));var moment=require(_0x48b1('0x5'));var BPromise=require(_0x48b1('0x6'));var Mustache=require(_0x48b1('0x7'));var util=require(_0x48b1('0x8'));var path=require(_0x48b1('0x9'));var sox=require(_0x48b1('0xa'));var csv=require(_0x48b1('0xb'));var ejs=require(_0x48b1('0xc'));var fs=require('fs');var fs_extra=require(_0x48b1('0xd'));var _=require('lodash');var squel=require(_0x48b1('0xe'));var crypto=require('crypto');var jsforce=require(_0x48b1('0xf'));var deskjs=require(_0x48b1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x48b1('0x11'));var Papa=require(_0x48b1('0x12'));var Redis=require(_0x48b1('0x13'));var authService=require(_0x48b1('0x14'));var qs=require(_0x48b1('0x15'));var as=require(_0x48b1('0x16'));var hardwareService=require(_0x48b1('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x48b1('0x18'));var config=require(_0x48b1('0x19'));var licenseUtil=require(_0x48b1('0x1a'));var db=require(_0x48b1('0x1b'))['db'];function respondWithStatusCode(_0x2ae97d,_0x235955){_0x235955=_0x235955||0xcc;return function(_0x1314b5){if(_0x1314b5){return _0x2ae97d[_0x48b1('0x1c')](_0x235955);}return _0x2ae97d['status'](_0x235955)[_0x48b1('0x1d')]();};}function respondWithResult(_0x555cd6,_0x37e030){_0x37e030=_0x37e030||0xc8;return function(_0x3e0705){if(_0x3e0705){return _0x555cd6[_0x48b1('0x1e')](_0x37e030)[_0x48b1('0x1f')](_0x3e0705);}};}function respondWithFilteredResult(_0x3eb0e8,_0x410fb1){return function(_0x17a1be){if(_0x17a1be){var _0x52a732=typeof _0x410fb1[_0x48b1('0x20')]===_0x48b1('0x21')&&typeof _0x410fb1[_0x48b1('0x22')]===_0x48b1('0x21');var _0x3a23ed=_0x17a1be[_0x48b1('0x23')];var _0x367259=_0x52a732?0x0:_0x410fb1[_0x48b1('0x20')];var _0x4f80e1=_0x52a732?_0x17a1be['count']:_0x410fb1['offset']+_0x410fb1[_0x48b1('0x22')];var _0x2aa3b1;if(_0x4f80e1>=_0x3a23ed){_0x4f80e1=_0x3a23ed;_0x2aa3b1=0xc8;}else{_0x2aa3b1=0xce;}_0x3eb0e8[_0x48b1('0x1e')](_0x2aa3b1);return _0x3eb0e8['set'](_0x48b1('0x24'),_0x367259+'-'+_0x4f80e1+'/'+_0x3a23ed)[_0x48b1('0x1f')](_0x17a1be);}return null;};}function patchUpdates(_0x447b47){return function(_0x5bacf8){try{jsonpatch[_0x48b1('0x25')](_0x5bacf8,_0x447b47,!![]);}catch(_0x17028f){return BPromise[_0x48b1('0x26')](_0x17028f);}return _0x5bacf8['save']();};}function saveUpdates(_0x52b603,_0x249d16){return function(_0x2dd905){if(_0x2dd905){return _0x2dd905['update'](_0x52b603)[_0x48b1('0x27')](function(_0x526c71){return _0x526c71;});}return null;};}function removeEntity(_0x49198e,_0x562206){return function(_0x393293){if(_0x393293){return _0x393293[_0x48b1('0x28')]()[_0x48b1('0x27')](function(){var _0x269297=_0x393293[_0x48b1('0x29')]({'plain':!![]});var _0x398bc3=_0x48b1('0x2a');return db['UserProfileResource'][_0x48b1('0x28')]({'where':{'type':_0x398bc3,'resourceId':_0x269297['id']}})['then'](function(){return _0x393293;});})[_0x48b1('0x27')](function(){_0x49198e['status'](0xcc)[_0x48b1('0x1d')]();});}};}function handleEntityNotFound(_0x5673be,_0x293c25){return function(_0x55f539){if(!_0x55f539){_0x5673be['sendStatus'](0x194);}return _0x55f539;};}function handleError(_0x24b7c7,_0x1bc0d3){_0x1bc0d3=_0x1bc0d3||0x1f4;return function(_0x12ec83){logger['error'](_0x12ec83[_0x48b1('0x2b')]);if(_0x12ec83[_0x48b1('0x2c')]){delete _0x12ec83[_0x48b1('0x2c')];}_0x24b7c7[_0x48b1('0x1e')](_0x1bc0d3)[_0x48b1('0x2d')](_0x12ec83);};}exports[_0x48b1('0x2e')]=function(_0x683f90,_0x53a4d6){var _0x105a12={},_0x11b847={},_0x23600a={'count':0x0,'rows':[]};var _0x26b5ec=_[_0x48b1('0x2f')](db[_0x48b1('0x30')][_0x48b1('0x31')],function(_0x582861){return{'name':_0x582861[_0x48b1('0x32')],'type':_0x582861[_0x48b1('0x33')][_0x48b1('0x34')]};});_0x11b847[_0x48b1('0x35')]=_[_0x48b1('0x2f')](_0x26b5ec,_0x48b1('0x2c'));_0x11b847[_0x48b1('0x36')]=_[_0x48b1('0x37')](_0x683f90[_0x48b1('0x36')]);_0x11b847['filters']=_[_0x48b1('0x38')](_0x11b847[_0x48b1('0x35')],_0x11b847[_0x48b1('0x36')]);_0x105a12[_0x48b1('0x39')]=_['intersection'](_0x11b847[_0x48b1('0x35')],qs['fields'](_0x683f90['query']['fields']));_0x105a12[_0x48b1('0x39')]=_0x105a12[_0x48b1('0x39')][_0x48b1('0x3a')]?_0x105a12[_0x48b1('0x39')]:_0x11b847[_0x48b1('0x35')];if(!_0x683f90[_0x48b1('0x36')]['hasOwnProperty'](_0x48b1('0x3b'))){_0x105a12[_0x48b1('0x22')]=qs[_0x48b1('0x22')](_0x683f90['query']['limit']);_0x105a12[_0x48b1('0x20')]=qs['offset'](_0x683f90[_0x48b1('0x36')]['offset']);}_0x105a12[_0x48b1('0x3c')]=qs[_0x48b1('0x3d')](_0x683f90[_0x48b1('0x36')][_0x48b1('0x3d')]);_0x105a12[_0x48b1('0x3e')]=qs[_0x48b1('0x3f')](_[_0x48b1('0x40')](_0x683f90[_0x48b1('0x36')],_0x11b847['filters']),_0x26b5ec);if(_0x683f90[_0x48b1('0x36')][_0x48b1('0x41')]){_0x105a12['where']=_[_0x48b1('0x42')](_0x105a12[_0x48b1('0x3e')],{'$or':_[_0x48b1('0x2f')](_0x26b5ec,function(_0x27dd7c){if(_0x27dd7c[_0x48b1('0x33')]!==_0x48b1('0x43')){var _0x1a3af2={};_0x1a3af2[_0x27dd7c[_0x48b1('0x2c')]]={'$like':'%'+_0x683f90[_0x48b1('0x36')][_0x48b1('0x41')]+'%'};return _0x1a3af2;}})});}_0x105a12=_[_0x48b1('0x42')]({},_0x105a12,_0x683f90[_0x48b1('0x44')]);var _0x16c85c={'where':_0x105a12['where']};return db[_0x48b1('0x30')][_0x48b1('0x23')](_0x16c85c)['then'](function(_0x5822ec){_0x23600a[_0x48b1('0x23')]=_0x5822ec;if(_0x683f90[_0x48b1('0x36')][_0x48b1('0x45')]){_0x105a12[_0x48b1('0x46')]=[{'all':!![]}];}return db['Pause'][_0x48b1('0x47')](_0x105a12);})[_0x48b1('0x27')](function(_0x290c11){_0x23600a[_0x48b1('0x48')]=_0x290c11;return _0x23600a;})[_0x48b1('0x27')](respondWithFilteredResult(_0x53a4d6,_0x105a12))['catch'](handleError(_0x53a4d6,null));};exports[_0x48b1('0x49')]=function(_0x42a7ff,_0x4352a6){var _0x81ede6={'raw':!![],'where':{'id':_0x42a7ff[_0x48b1('0x4a')]['id']}},_0x153791={};_0x153791[_0x48b1('0x35')]=_[_0x48b1('0x37')](db[_0x48b1('0x30')]['rawAttributes']);_0x153791[_0x48b1('0x36')]=_[_0x48b1('0x37')](_0x42a7ff[_0x48b1('0x36')]);_0x153791['filters']=_['intersection'](_0x153791[_0x48b1('0x35')],_0x153791[_0x48b1('0x36')]);_0x81ede6[_0x48b1('0x39')]=_[_0x48b1('0x38')](_0x153791[_0x48b1('0x35')],qs[_0x48b1('0x4b')](_0x42a7ff[_0x48b1('0x36')][_0x48b1('0x4b')]));_0x81ede6[_0x48b1('0x39')]=_0x81ede6[_0x48b1('0x39')][_0x48b1('0x3a')]?_0x81ede6['attributes']:_0x153791[_0x48b1('0x35')];if(_0x42a7ff[_0x48b1('0x36')][_0x48b1('0x45')]){_0x81ede6[_0x48b1('0x46')]=[{'all':!![]}];}_0x81ede6=_[_0x48b1('0x42')]({},_0x81ede6,_0x42a7ff['options']);return db[_0x48b1('0x30')][_0x48b1('0x4c')](_0x81ede6)['then'](handleEntityNotFound(_0x4352a6,null))[_0x48b1('0x27')](respondWithResult(_0x4352a6,null))['catch'](handleError(_0x4352a6,null));};exports[_0x48b1('0x4d')]=function(_0x110d5d,_0x569f1c){return db[_0x48b1('0x30')][_0x48b1('0x4d')](_0x110d5d[_0x48b1('0x4e')],{})[_0x48b1('0x27')](function(_0xd80df9){var _0x3de297=_0x110d5d[_0x48b1('0x4f')]['get']({'plain':!![]});if(!_0x3de297)throw new Error(_0x48b1('0x50'));if(_0x3de297[_0x48b1('0x51')]===_0x48b1('0x4f')){var _0x86ac28=_0xd80df9[_0x48b1('0x29')]({'plain':!![]});var _0x550779=_0x48b1('0x2a');return db['UserProfileSection'][_0x48b1('0x4c')]({'where':{'name':_0x550779,'userProfileId':_0x3de297[_0x48b1('0x52')]},'raw':!![]})[_0x48b1('0x27')](function(_0x7afbdd){if(_0x7afbdd&&_0x7afbdd[_0x48b1('0x53')]===0x0){return db[_0x48b1('0x54')][_0x48b1('0x4d')]({'name':_0x86ac28[_0x48b1('0x2c')],'resourceId':_0x86ac28['id'],'type':_0x7afbdd['name'],'sectionId':_0x7afbdd['id']},{})[_0x48b1('0x27')](function(){return _0xd80df9;});}else{return _0xd80df9;}})[_0x48b1('0x55')](function(_0x3bff0e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bff0e);throw _0x3bff0e;});}return _0xd80df9;})[_0x48b1('0x27')](respondWithResult(_0x569f1c,0xc9))['catch'](handleError(_0x569f1c,null));};exports[_0x48b1('0x56')]=function(_0x3a3c3a,_0x17607d){if(_0x3a3c3a[_0x48b1('0x4e')]['id']){delete _0x3a3c3a[_0x48b1('0x4e')]['id'];}return db['Pause'][_0x48b1('0x4c')]({'where':{'id':_0x3a3c3a[_0x48b1('0x4a')]['id']}})[_0x48b1('0x27')](handleEntityNotFound(_0x17607d,null))['then'](saveUpdates(_0x3a3c3a[_0x48b1('0x4e')],null))['then'](respondWithResult(_0x17607d,null))[_0x48b1('0x55')](handleError(_0x17607d,null));};exports[_0x48b1('0x28')]=function(_0x2bbcc6,_0x33c221){return db['Pause']['find']({'where':{'id':_0x2bbcc6[_0x48b1('0x4a')]['id']}})[_0x48b1('0x27')](handleEntityNotFound(_0x33c221,null))[_0x48b1('0x27')](removeEntity(_0x33c221,null))['catch'](handleError(_0x33c221,null));}; \ No newline at end of file +var _0x0b93=['role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Pauses','UserProfileResource','stack','name','send','index','map','Pause','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create'];(function(_0x410278,_0x4fc3bf){var _0x2478a6=function(_0x2e3024){while(--_0x2e3024){_0x410278['push'](_0x410278['shift']());}};_0x2478a6(++_0x4fc3bf);}(_0x0b93,0x110));var _0x30b9=function(_0x22a25e,_0x254323){_0x22a25e=_0x22a25e-0x0;var _0x20a06f=_0x0b93[_0x22a25e];return _0x20a06f;};'use strict';var emlformat=require(_0x30b9('0x0'));var rimraf=require(_0x30b9('0x1'));var zipdir=require(_0x30b9('0x2'));var jsonpatch=require(_0x30b9('0x3'));var rp=require(_0x30b9('0x4'));var moment=require(_0x30b9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x30b9('0x6'));var util=require('util');var path=require(_0x30b9('0x7'));var sox=require(_0x30b9('0x8'));var csv=require(_0x30b9('0x9'));var ejs=require(_0x30b9('0xa'));var fs=require('fs');var fs_extra=require(_0x30b9('0xb'));var _=require(_0x30b9('0xc'));var squel=require(_0x30b9('0xd'));var crypto=require(_0x30b9('0xe'));var jsforce=require(_0x30b9('0xf'));var deskjs=require(_0x30b9('0x10'));var toCsv=require(_0x30b9('0x9'));var querystring=require(_0x30b9('0x11'));var Papa=require(_0x30b9('0x12'));var Redis=require('ioredis');var authService=require(_0x30b9('0x13'));var qs=require(_0x30b9('0x14'));var as=require(_0x30b9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x30b9('0x16'))(_0x30b9('0x17'));var utils=require(_0x30b9('0x18'));var config=require(_0x30b9('0x19'));var licenseUtil=require(_0x30b9('0x1a'));var db=require(_0x30b9('0x1b'))['db'];function respondWithStatusCode(_0x4ed2df,_0x54adf0){_0x54adf0=_0x54adf0||0xcc;return function(_0x26f61c){if(_0x26f61c){return _0x4ed2df[_0x30b9('0x1c')](_0x54adf0);}return _0x4ed2df[_0x30b9('0x1d')](_0x54adf0)[_0x30b9('0x1e')]();};}function respondWithResult(_0x394451,_0x3d93e0){_0x3d93e0=_0x3d93e0||0xc8;return function(_0x4e7c54){if(_0x4e7c54){return _0x394451[_0x30b9('0x1d')](_0x3d93e0)[_0x30b9('0x1f')](_0x4e7c54);}};}function respondWithFilteredResult(_0x2d304d,_0x3360dc){return function(_0x4d2957){if(_0x4d2957){var _0x100aad=typeof _0x3360dc[_0x30b9('0x20')]==='undefined'&&typeof _0x3360dc[_0x30b9('0x21')]===_0x30b9('0x22');var _0x32d6e0=_0x4d2957[_0x30b9('0x23')];var _0xa1f0fe=_0x100aad?0x0:_0x3360dc[_0x30b9('0x20')];var _0x5ed2c6=_0x100aad?_0x4d2957[_0x30b9('0x23')]:_0x3360dc['offset']+_0x3360dc[_0x30b9('0x21')];var _0x4b2104;if(_0x5ed2c6>=_0x32d6e0){_0x5ed2c6=_0x32d6e0;_0x4b2104=0xc8;}else{_0x4b2104=0xce;}_0x2d304d[_0x30b9('0x1d')](_0x4b2104);return _0x2d304d[_0x30b9('0x24')](_0x30b9('0x25'),_0xa1f0fe+'-'+_0x5ed2c6+'/'+_0x32d6e0)['json'](_0x4d2957);}return null;};}function patchUpdates(_0x3e0b7d){return function(_0xed90e0){try{jsonpatch[_0x30b9('0x26')](_0xed90e0,_0x3e0b7d,!![]);}catch(_0x472376){return BPromise[_0x30b9('0x27')](_0x472376);}return _0xed90e0[_0x30b9('0x28')]();};}function saveUpdates(_0x54a5cb,_0x9b2eb7){return function(_0x5dc841){if(_0x5dc841){return _0x5dc841[_0x30b9('0x29')](_0x54a5cb)[_0x30b9('0x2a')](function(_0x195a1c){return _0x195a1c;});}return null;};}function removeEntity(_0x583123,_0x649c20){return function(_0x37c8a7){if(_0x37c8a7){return _0x37c8a7['destroy']()[_0x30b9('0x2a')](function(){var _0x519c47=_0x37c8a7[_0x30b9('0x2b')]({'plain':!![]});var _0x498ee7=_0x30b9('0x2c');return db[_0x30b9('0x2d')]['destroy']({'where':{'type':_0x498ee7,'resourceId':_0x519c47['id']}})[_0x30b9('0x2a')](function(){return _0x37c8a7;});})[_0x30b9('0x2a')](function(){_0x583123[_0x30b9('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f0eda,_0x339377){return function(_0x54e575){if(!_0x54e575){_0x2f0eda['sendStatus'](0x194);}return _0x54e575;};}function handleError(_0x99d6f1,_0x61db1b){_0x61db1b=_0x61db1b||0x1f4;return function(_0x3d857c){logger['error'](_0x3d857c[_0x30b9('0x2e')]);if(_0x3d857c[_0x30b9('0x2f')]){delete _0x3d857c[_0x30b9('0x2f')];}_0x99d6f1[_0x30b9('0x1d')](_0x61db1b)[_0x30b9('0x30')](_0x3d857c);};}exports[_0x30b9('0x31')]=function(_0x3f47f0,_0x5647db){var _0x9c5a64={},_0x4da4d8={},_0x1f2bd5={'count':0x0,'rows':[]};var _0x5340e9=_[_0x30b9('0x32')](db[_0x30b9('0x33')][_0x30b9('0x34')],function(_0x4db216){return{'name':_0x4db216[_0x30b9('0x35')],'type':_0x4db216['type'][_0x30b9('0x36')]};});_0x4da4d8['model']=_[_0x30b9('0x32')](_0x5340e9,_0x30b9('0x2f'));_0x4da4d8[_0x30b9('0x37')]=_[_0x30b9('0x38')](_0x3f47f0[_0x30b9('0x37')]);_0x4da4d8[_0x30b9('0x39')]=_[_0x30b9('0x3a')](_0x4da4d8[_0x30b9('0x3b')],_0x4da4d8[_0x30b9('0x37')]);_0x9c5a64['attributes']=_[_0x30b9('0x3a')](_0x4da4d8[_0x30b9('0x3b')],qs['fields'](_0x3f47f0[_0x30b9('0x37')][_0x30b9('0x3c')]));_0x9c5a64[_0x30b9('0x3d')]=_0x9c5a64[_0x30b9('0x3d')][_0x30b9('0x3e')]?_0x9c5a64[_0x30b9('0x3d')]:_0x4da4d8[_0x30b9('0x3b')];if(!_0x3f47f0[_0x30b9('0x37')][_0x30b9('0x3f')](_0x30b9('0x40'))){_0x9c5a64[_0x30b9('0x21')]=qs[_0x30b9('0x21')](_0x3f47f0[_0x30b9('0x37')][_0x30b9('0x21')]);_0x9c5a64[_0x30b9('0x20')]=qs[_0x30b9('0x20')](_0x3f47f0[_0x30b9('0x37')][_0x30b9('0x20')]);}_0x9c5a64['order']=qs[_0x30b9('0x41')](_0x3f47f0[_0x30b9('0x37')]['sort']);_0x9c5a64['where']=qs[_0x30b9('0x39')](_['pick'](_0x3f47f0[_0x30b9('0x37')],_0x4da4d8[_0x30b9('0x39')]),_0x5340e9);if(_0x3f47f0[_0x30b9('0x37')][_0x30b9('0x42')]){_0x9c5a64[_0x30b9('0x43')]=_[_0x30b9('0x44')](_0x9c5a64[_0x30b9('0x43')],{'$or':_[_0x30b9('0x32')](_0x5340e9,function(_0x8211bf){if(_0x8211bf[_0x30b9('0x45')]!==_0x30b9('0x46')){var _0x27b0a8={};_0x27b0a8[_0x8211bf[_0x30b9('0x2f')]]={'$like':'%'+_0x3f47f0['query'][_0x30b9('0x42')]+'%'};return _0x27b0a8;}})});}_0x9c5a64=_[_0x30b9('0x44')]({},_0x9c5a64,_0x3f47f0['options']);var _0x59e84e={'where':_0x9c5a64[_0x30b9('0x43')]};return db['Pause'][_0x30b9('0x23')](_0x59e84e)[_0x30b9('0x2a')](function(_0x57c8f2){_0x1f2bd5['count']=_0x57c8f2;if(_0x3f47f0[_0x30b9('0x37')][_0x30b9('0x47')]){_0x9c5a64[_0x30b9('0x48')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x9c5a64);})[_0x30b9('0x2a')](function(_0x1e3a9f){_0x1f2bd5[_0x30b9('0x49')]=_0x1e3a9f;return _0x1f2bd5;})['then'](respondWithFilteredResult(_0x5647db,_0x9c5a64))[_0x30b9('0x4a')](handleError(_0x5647db,null));};exports[_0x30b9('0x4b')]=function(_0x24b4d6,_0x493f19){var _0x2d97a5={'raw':!![],'where':{'id':_0x24b4d6[_0x30b9('0x4c')]['id']}},_0x5ef040={};_0x5ef040[_0x30b9('0x3b')]=_['keys'](db[_0x30b9('0x33')][_0x30b9('0x34')]);_0x5ef040[_0x30b9('0x37')]=_[_0x30b9('0x38')](_0x24b4d6[_0x30b9('0x37')]);_0x5ef040[_0x30b9('0x39')]=_[_0x30b9('0x3a')](_0x5ef040[_0x30b9('0x3b')],_0x5ef040[_0x30b9('0x37')]);_0x2d97a5[_0x30b9('0x3d')]=_['intersection'](_0x5ef040[_0x30b9('0x3b')],qs[_0x30b9('0x3c')](_0x24b4d6[_0x30b9('0x37')][_0x30b9('0x3c')]));_0x2d97a5[_0x30b9('0x3d')]=_0x2d97a5[_0x30b9('0x3d')][_0x30b9('0x3e')]?_0x2d97a5[_0x30b9('0x3d')]:_0x5ef040[_0x30b9('0x3b')];if(_0x24b4d6['query'][_0x30b9('0x47')]){_0x2d97a5[_0x30b9('0x48')]=[{'all':!![]}];}_0x2d97a5=_['merge']({},_0x2d97a5,_0x24b4d6[_0x30b9('0x4d')]);return db[_0x30b9('0x33')][_0x30b9('0x4e')](_0x2d97a5)[_0x30b9('0x2a')](handleEntityNotFound(_0x493f19,null))[_0x30b9('0x2a')](respondWithResult(_0x493f19,null))[_0x30b9('0x4a')](handleError(_0x493f19,null));};exports['create']=function(_0x5a922c,_0x117088){return db[_0x30b9('0x33')][_0x30b9('0x4f')](_0x5a922c['body'],{})[_0x30b9('0x2a')](function(_0x4fa5c3){var _0x4b714e=_0x5a922c['user'][_0x30b9('0x2b')]({'plain':!![]});if(!_0x4b714e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b714e[_0x30b9('0x50')]==='user'){var _0x58af5a=_0x4fa5c3['get']({'plain':!![]});var _0x8059a3=_0x30b9('0x2c');return db[_0x30b9('0x51')][_0x30b9('0x4e')]({'where':{'name':_0x8059a3,'userProfileId':_0x4b714e[_0x30b9('0x52')]},'raw':!![]})['then'](function(_0x3dabbc){if(_0x3dabbc&&_0x3dabbc[_0x30b9('0x53')]===0x0){return db[_0x30b9('0x2d')][_0x30b9('0x4f')]({'name':_0x58af5a[_0x30b9('0x2f')],'resourceId':_0x58af5a['id'],'type':_0x3dabbc[_0x30b9('0x2f')],'sectionId':_0x3dabbc['id']},{})['then'](function(){return _0x4fa5c3;});}else{return _0x4fa5c3;}})[_0x30b9('0x4a')](function(_0x575652){logger[_0x30b9('0x54')](_0x30b9('0x55'),_0x575652);throw _0x575652;});}return _0x4fa5c3;})[_0x30b9('0x2a')](respondWithResult(_0x117088,0xc9))[_0x30b9('0x4a')](handleError(_0x117088,null));};exports[_0x30b9('0x29')]=function(_0x406c42,_0x1428d1){if(_0x406c42[_0x30b9('0x56')]['id']){delete _0x406c42[_0x30b9('0x56')]['id'];}return db['Pause'][_0x30b9('0x4e')]({'where':{'id':_0x406c42[_0x30b9('0x4c')]['id']}})[_0x30b9('0x2a')](handleEntityNotFound(_0x1428d1,null))[_0x30b9('0x2a')](saveUpdates(_0x406c42[_0x30b9('0x56')],null))[_0x30b9('0x2a')](respondWithResult(_0x1428d1,null))[_0x30b9('0x4a')](handleError(_0x1428d1,null));};exports[_0x30b9('0x57')]=function(_0x590085,_0x96cd49){return db['Pause'][_0x30b9('0x4e')]({'where':{'id':_0x590085[_0x30b9('0x4c')]['id']}})[_0x30b9('0x2a')](handleEntityNotFound(_0x96cd49,null))[_0x30b9('0x2a')](removeEntity(_0x96cd49,null))[_0x30b9('0x4a')](handleError(_0x96cd49,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 74651fa..7901436 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 _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6aa7,0x178));var _0x76aa=function(_0x40c0f5,_0x5734ab){_0x40c0f5=_0x40c0f5-0x0;var _0x554ea6=_0x6aa7[_0x40c0f5];return _0x554ea6;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var 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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 1291e31..15cc11e 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x89510e,_0x5dc9ce){var _0x3714d9=function(_0x304401){while(--_0x304401){_0x89510e['push'](_0x89510e['shift']());}};_0x3714d9(++_0x5dc9ce);}(_0x7a54,0x106));var _0x47a5=function(_0x4c946b,_0x5b0b7d){_0x4c946b=_0x4c946b-0x0;var _0x2c718e=_0x7a54[_0x4c946b];return _0x2c718e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x48a8dc,_0xd6ca2b){var _0x42c575=function(_0x65d7dc){while(--_0x65d7dc){_0x48a8dc['push'](_0x48a8dc['shift']());}};_0x42c575(++_0xd6ca2b);}(_0xb10b,0x12a));var _0xbb10=function(_0xf61c79,_0x43c6fa){_0xf61c79=_0xf61c79-0x0;var _0x127d26=_0xb10b[_0xf61c79];return _0x127d26;};'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 efb389a..5fac563 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 _0x1cc7=['path','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/webhook','webhookGet','/:id','show','/:id/download','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','webhookPost','put','delete','exports','multer','util'];(function(_0x4fe35d,_0x21fee1){var _0x5bb28e=function(_0x214051){while(--_0x214051){_0x4fe35d['push'](_0x4fe35d['shift']());}};_0x5bb28e(++_0x21fee1);}(_0x1cc7,0x15a));var _0x71cc=function(_0x491a1b,_0x345b25){_0x491a1b=_0x491a1b-0x0;var _0x112170=_0x1cc7[_0x491a1b];return _0x112170;};'use strict';var multer=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var path=require(_0x71cc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x71cc('0x3'));var auth=require(_0x71cc('0x4'));var interaction=require(_0x71cc('0x5'));var config=require('../../config/environment');var controller=require('./plugin.controller');router['get']('/',auth[_0x71cc('0x6')](),controller['index']);router[_0x71cc('0x7')](_0x71cc('0x8'),controller[_0x71cc('0x9')]);router[_0x71cc('0x7')](_0x71cc('0xa'),auth['isAuthenticated'](),controller[_0x71cc('0xb')]);router[_0x71cc('0x7')](_0x71cc('0xc'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4b7514,_0xeb4747,_0x2db190){_0x2db190(null,path[_0x71cc('0xd')](config['root'],_0x71cc('0xe')));},'filename':function(_0x550b3c,_0x1aad83,_0x4f9c5c){_0x1aad83[_0x71cc('0xf')]=_0x1aad83['originalname'][_0x71cc('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4f9c5c(null,util[_0x71cc('0x11')](_0x71cc('0x12'),path[_0x71cc('0x13')](_0x1aad83[_0x71cc('0xf')],path['extname'](_0x1aad83[_0x71cc('0xf')])),Date[_0x71cc('0x14')](),path[_0x71cc('0x15')](_0x1aad83[_0x71cc('0xf')])));}})});router[_0x71cc('0x16')]('/',upload[_0x71cc('0x17')](_0x71cc('0x18')),controller['upload']);router[_0x71cc('0x16')](_0x71cc('0x8'),controller[_0x71cc('0x19')]);router[_0x71cc('0x1a')](_0x71cc('0xa'),auth[_0x71cc('0x6')](),controller['update']);router[_0x71cc('0x1b')](_0x71cc('0xa'),auth['isAuthenticated'](),controller['delete']);module[_0x71cc('0x1c')]=router; \ No newline at end of file +var _0x0ba7=['../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','diskStorage','server/files/plugins','originalname','format','basename','extname','now','post','single','file','upload','webhookPost','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x11db47,_0x3e2d60){var _0x572492=function(_0x2c3075){while(--_0x2c3075){_0x11db47['push'](_0x11db47['shift']());}};_0x572492(++_0x3e2d60);}(_0x0ba7,0x16d));var _0x70ba=function(_0x3fb131,_0x49c5b0){_0x3fb131=_0x3fb131-0x0;var _0x5df3b5=_0x0ba7[_0x3fb131];return _0x5df3b5;};'use strict';var multer=require(_0x70ba('0x0'));var util=require('util');var path=require(_0x70ba('0x1'));var timeout=require(_0x70ba('0x2'));var express=require(_0x70ba('0x3'));var router=express[_0x70ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70ba('0x5'));var interaction=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var controller=require(_0x70ba('0x8'));router[_0x70ba('0x9')]('/',auth[_0x70ba('0xa')](),controller[_0x70ba('0xb')]);router[_0x70ba('0x9')](_0x70ba('0xc'),controller[_0x70ba('0xd')]);router[_0x70ba('0x9')](_0x70ba('0xe'),auth[_0x70ba('0xa')](),controller[_0x70ba('0xf')]);router[_0x70ba('0x9')]('/:id/download',auth[_0x70ba('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x70ba('0x10')]({'destination':function(_0x258604,_0xfc4de3,_0x3cf8ab){_0x3cf8ab(null,path['join'](config['root'],_0x70ba('0x11')));},'filename':function(_0x4a2c2e,_0xd6580e,_0x5e94c7){_0xd6580e[_0x70ba('0x12')]=_0xd6580e[_0x70ba('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5e94c7(null,util[_0x70ba('0x13')]('%s-%s%s',path[_0x70ba('0x14')](_0xd6580e[_0x70ba('0x12')],path[_0x70ba('0x15')](_0xd6580e[_0x70ba('0x12')])),Date[_0x70ba('0x16')](),path[_0x70ba('0x15')](_0xd6580e[_0x70ba('0x12')])));}})});router[_0x70ba('0x17')]('/',upload[_0x70ba('0x18')](_0x70ba('0x19')),controller[_0x70ba('0x1a')]);router[_0x70ba('0x17')](_0x70ba('0xc'),controller[_0x70ba('0x1b')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x70ba('0x1c')]);router[_0x70ba('0x1d')](_0x70ba('0xe'),auth[_0x70ba('0xa')](),controller[_0x70ba('0x1d')]);module[_0x70ba('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 48065b5..2afed13 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 _0x236a=['sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x236a,0x96));var _0xa236=function(_0x445979,_0x18811a){_0x445979=_0x445979-0x0;var _0x117b2d=_0x236a[_0x445979];return _0x117b2d;};'use strict';var Sequelize=require(_0xa236('0x0'));module[_0xa236('0x1')]={'name':{'type':Sequelize[_0xa236('0x2')]},'type':{'type':Sequelize[_0xa236('0x3')](_0xa236('0x4'),_0xa236('0x5'))},'description':{'type':Sequelize[_0xa236('0x6')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0xa236('0x7')},'active':{'type':Sequelize[_0xa236('0x8')],'defaultValue':0x0,'comment':_0xa236('0x9')},'sidebar':{'type':Sequelize['ENUM'](_0xa236('0xa'),_0xa236('0xb'),'always',_0xa236('0xc')),'defaultValue':_0xa236('0xd'),'comment':_0xa236('0xe')},'icon':{'type':Sequelize[_0xa236('0x2')]},'adminUrl':{'type':Sequelize[_0xa236('0x2')]},'agentUrl':{'type':Sequelize[_0xa236('0x2')]},'scriptName':{'type':Sequelize[_0xa236('0x2')]},'scriptPath':{'type':Sequelize[_0xa236('0x2')]}}; \ No newline at end of file +var _0x8463=['script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html'];(function(_0x54501d,_0x42e8a6){var _0x2b9b2c=function(_0x2828fa){while(--_0x2828fa){_0x54501d['push'](_0x54501d['shift']());}};_0x2b9b2c(++_0x42e8a6);}(_0x8463,0x11b));var _0x3846=function(_0x38c00d,_0x19e81e){_0x38c00d=_0x38c00d-0x0;var _0x520b64=_0x8463[_0x38c00d];return _0x520b64;};'use strict';var Sequelize=require(_0x3846('0x0'));module[_0x3846('0x1')]={'name':{'type':Sequelize[_0x3846('0x2')]},'type':{'type':Sequelize[_0x3846('0x3')](_0x3846('0x4'),_0x3846('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x3846('0x6')]},'path':{'type':Sequelize[_0x3846('0x2')],'comment':_0x3846('0x7')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3846('0x8')},'sidebar':{'type':Sequelize[_0x3846('0x3')]('adminOnly',_0x3846('0x9'),'always','never'),'defaultValue':_0x3846('0xa'),'comment':_0x3846('0xb')},'icon':{'type':Sequelize[_0x3846('0x2')]},'adminUrl':{'type':Sequelize[_0x3846('0x2')]},'agentUrl':{'type':Sequelize[_0x3846('0x2')]},'scriptName':{'type':Sequelize[_0x3846('0x2')]},'scriptPath':{'type':Sequelize[_0x3846('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 9e40280..882f0a7 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 _0xc24c=['path','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','extname','filename','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','agent','Warning:\x20agent\x20view\x20not\x20specified','plugins','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Plugins','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-type','endsWith','statusCode','webhookPost','content-length','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','download'];(function(_0x5bfea9,_0xcaedd){var _0x460a21=function(_0x53bb37){while(--_0x53bb37){_0x5bfea9['push'](_0x5bfea9['shift']());}};_0x460a21(++_0xcaedd);}(_0xc24c,0x102));var _0xcc24=function(_0x5e0198,_0x1c04cd){_0x5e0198=_0x5e0198-0x0;var _0x2b0610=_0xc24c[_0x5e0198];return _0x2b0610;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc24('0x0'));var zipdir=require(_0xcc24('0x1'));var jsonpatch=require(_0xcc24('0x2'));var rp=require(_0xcc24('0x3'));var moment=require('moment');var BPromise=require(_0xcc24('0x4'));var Mustache=require(_0xcc24('0x5'));var util=require(_0xcc24('0x6'));var path=require('path');var sox=require(_0xcc24('0x7'));var csv=require(_0xcc24('0x8'));var ejs=require(_0xcc24('0x9'));var fs=require('fs');var fs_extra=require(_0xcc24('0xa'));var _=require('lodash');var squel=require(_0xcc24('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcc24('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0xcc24('0x0'));var archiver=require('archiver');var Redis=require(_0xcc24('0xd'));var authService=require(_0xcc24('0xe'));var qs=require(_0xcc24('0xf'));var as=require(_0xcc24('0x10'));var hardwareService=require(_0xcc24('0x11'));var logger=require(_0xcc24('0x12'))(_0xcc24('0x13'));var utils=require('../../config/utils');var config=require(_0xcc24('0x14'));var licenseUtil=require(_0xcc24('0x15'));var db=require(_0xcc24('0x16'))['db'];config[_0xcc24('0x17')]=_[_0xcc24('0x18')](config['redis'],{'host':_0xcc24('0x19'),'port':0x18eb});var socket=require(_0xcc24('0x1a'))(new Redis(config['redis']));require(_0xcc24('0x1b'))[_0xcc24('0x1c')](socket);function respondWithStatusCode(_0x28b422,_0x315066){_0x315066=_0x315066||0xcc;return function(_0x14badf){if(_0x14badf){return _0x28b422[_0xcc24('0x1d')](_0x315066);}return _0x28b422[_0xcc24('0x1e')](_0x315066)['end']();};}function respondWithResult(_0x7a5ce0,_0x323e93){_0x323e93=_0x323e93||0xc8;return function(_0x5583ae){if(_0x5583ae){return _0x7a5ce0[_0xcc24('0x1e')](_0x323e93)['json'](_0x5583ae);}};}function respondWithFilteredResult(_0x595bf3,_0x2faa05){return function(_0xc93968){if(_0xc93968){var _0x261280=typeof _0x2faa05[_0xcc24('0x1f')]===_0xcc24('0x20')&&typeof _0x2faa05[_0xcc24('0x21')]===_0xcc24('0x20');var _0x69062e=_0xc93968[_0xcc24('0x22')];var _0x38c5ac=_0x261280?0x0:_0x2faa05[_0xcc24('0x1f')];var _0x25ee16=_0x261280?_0xc93968['count']:_0x2faa05[_0xcc24('0x1f')]+_0x2faa05['limit'];var _0x4f0209;if(_0x25ee16>=_0x69062e){_0x25ee16=_0x69062e;_0x4f0209=0xc8;}else{_0x4f0209=0xce;}_0x595bf3[_0xcc24('0x1e')](_0x4f0209);return _0x595bf3[_0xcc24('0x23')](_0xcc24('0x24'),_0x38c5ac+'-'+_0x25ee16+'/'+_0x69062e)[_0xcc24('0x25')](_0xc93968);}return null;};}function patchUpdates(_0x361135){return function(_0xf65dd6){try{jsonpatch[_0xcc24('0x26')](_0xf65dd6,_0x361135,!![]);}catch(_0x1d8415){return BPromise['reject'](_0x1d8415);}return _0xf65dd6[_0xcc24('0x27')]();};}function saveUpdates(_0x753939,_0x2ad75a){return function(_0x42593d){if(_0x42593d){return _0x42593d[_0xcc24('0x28')](_0x753939)[_0xcc24('0x29')](function(_0x1bbd5b){return _0x1bbd5b;});}return null;};}function removeEntity(_0x59d580,_0x2577fa){return function(_0x4af5db){if(_0x4af5db){return _0x4af5db[_0xcc24('0x2a')]()['then'](function(){var _0x2f6987=_0x4af5db[_0xcc24('0x2b')]({'plain':!![]});var _0xeeeca6='Plugins';return db['UserProfileResource']['destroy']({'where':{'type':_0xeeeca6,'resourceId':_0x2f6987['id']}})[_0xcc24('0x29')](function(){return _0x4af5db;});})[_0xcc24('0x29')](function(){_0x59d580[_0xcc24('0x1e')](0xcc)[_0xcc24('0x2c')]();});}};}function handleEntityNotFound(_0x243757,_0x11f606){return function(_0x4c2ebe){if(!_0x4c2ebe){_0x243757[_0xcc24('0x1d')](0x194);}return _0x4c2ebe;};}function handleError(_0x45f50c,_0x50f4c2){_0x50f4c2=_0x50f4c2||0x1f4;return function(_0x2591ef){logger[_0xcc24('0x2d')](_0x2591ef[_0xcc24('0x2e')]);if(_0x2591ef['name']){delete _0x2591ef[_0xcc24('0x2f')];}_0x45f50c['status'](_0x50f4c2)[_0xcc24('0x30')](_0x2591ef);};}exports[_0xcc24('0x31')]=function(_0x1ba7fc,_0x22e50b){var _0x5dd0bd={},_0x174e43={},_0x1aef27={'count':0x0,'rows':[]};var _0x18142b=_[_0xcc24('0x32')](db[_0xcc24('0x33')][_0xcc24('0x34')],function(_0x24348c){return{'name':_0x24348c[_0xcc24('0x35')],'type':_0x24348c[_0xcc24('0x36')][_0xcc24('0x37')]};});_0x174e43[_0xcc24('0x38')]=_[_0xcc24('0x32')](_0x18142b,_0xcc24('0x2f'));_0x174e43[_0xcc24('0x39')]=_[_0xcc24('0x3a')](_0x1ba7fc[_0xcc24('0x39')]);_0x174e43[_0xcc24('0x3b')]=_['intersection'](_0x174e43[_0xcc24('0x38')],_0x174e43[_0xcc24('0x39')]);_0x5dd0bd['attributes']=_[_0xcc24('0x3c')](_0x174e43['model'],qs['fields'](_0x1ba7fc[_0xcc24('0x39')][_0xcc24('0x3d')]));_0x5dd0bd[_0xcc24('0x3e')]=_0x5dd0bd[_0xcc24('0x3e')][_0xcc24('0x3f')]?_0x5dd0bd['attributes']:_0x174e43[_0xcc24('0x38')];if(!_0x1ba7fc['query'][_0xcc24('0x40')](_0xcc24('0x41'))){_0x5dd0bd[_0xcc24('0x21')]=qs[_0xcc24('0x21')](_0x1ba7fc[_0xcc24('0x39')][_0xcc24('0x21')]);_0x5dd0bd[_0xcc24('0x1f')]=qs[_0xcc24('0x1f')](_0x1ba7fc[_0xcc24('0x39')][_0xcc24('0x1f')]);}_0x5dd0bd[_0xcc24('0x42')]=qs[_0xcc24('0x43')](_0x1ba7fc[_0xcc24('0x39')][_0xcc24('0x43')]);_0x5dd0bd[_0xcc24('0x44')]=qs[_0xcc24('0x3b')](_[_0xcc24('0x45')](_0x1ba7fc['query'],_0x174e43[_0xcc24('0x3b')]),_0x18142b);if(_0x1ba7fc[_0xcc24('0x39')][_0xcc24('0x46')]){_0x5dd0bd[_0xcc24('0x44')]=_[_0xcc24('0x47')](_0x5dd0bd[_0xcc24('0x44')],{'$or':_['map'](_0x18142b,function(_0x72cbff){if(_0x72cbff[_0xcc24('0x36')]!==_0xcc24('0x48')){var _0x2b40aa={};_0x2b40aa[_0x72cbff[_0xcc24('0x2f')]]={'$like':'%'+_0x1ba7fc['query'][_0xcc24('0x46')]+'%'};return _0x2b40aa;}})});}_0x5dd0bd=_[_0xcc24('0x47')]({},_0x5dd0bd,_0x1ba7fc['options']);var _0x2e0e6b={'where':_0x5dd0bd[_0xcc24('0x44')]};return db[_0xcc24('0x33')]['count'](_0x2e0e6b)[_0xcc24('0x29')](function(_0x22ca5f){_0x1aef27[_0xcc24('0x22')]=_0x22ca5f;if(_0x1ba7fc[_0xcc24('0x39')][_0xcc24('0x49')]){_0x5dd0bd[_0xcc24('0x4a')]=[{'all':!![]}];}return db[_0xcc24('0x33')][_0xcc24('0x4b')](_0x5dd0bd);})[_0xcc24('0x29')](function(_0x534695){_0x1aef27[_0xcc24('0x4c')]=_0x534695;return _0x1aef27;})['then'](respondWithFilteredResult(_0x22e50b,_0x5dd0bd))[_0xcc24('0x4d')](handleError(_0x22e50b,null));};exports['show']=function(_0x3c0e0d,_0x40e0e0){var _0x558b57={'raw':!![],'where':{'id':_0x3c0e0d[_0xcc24('0x4e')]['id']}},_0xaea2f0={};_0xaea2f0[_0xcc24('0x38')]=_[_0xcc24('0x3a')](db[_0xcc24('0x33')][_0xcc24('0x34')]);_0xaea2f0['query']=_['keys'](_0x3c0e0d[_0xcc24('0x39')]);_0xaea2f0[_0xcc24('0x3b')]=_[_0xcc24('0x3c')](_0xaea2f0[_0xcc24('0x38')],_0xaea2f0['query']);_0x558b57['attributes']=_[_0xcc24('0x3c')](_0xaea2f0[_0xcc24('0x38')],qs[_0xcc24('0x3d')](_0x3c0e0d['query']['fields']));_0x558b57[_0xcc24('0x3e')]=_0x558b57[_0xcc24('0x3e')][_0xcc24('0x3f')]?_0x558b57['attributes']:_0xaea2f0[_0xcc24('0x38')];if(_0x3c0e0d[_0xcc24('0x39')][_0xcc24('0x49')]){_0x558b57[_0xcc24('0x4a')]=[{'all':!![]}];}_0x558b57=_[_0xcc24('0x47')]({},_0x558b57,_0x3c0e0d[_0xcc24('0x4f')]);return db[_0xcc24('0x33')][_0xcc24('0x50')](_0x558b57)[_0xcc24('0x29')](handleEntityNotFound(_0x40e0e0,null))[_0xcc24('0x29')](respondWithResult(_0x40e0e0,null))['catch'](handleError(_0x40e0e0,null));};exports[_0xcc24('0x51')]=function(_0x774a42,_0x388555,_0x3dfaab){return db[_0xcc24('0x33')]['find']({'where':{'id':_0x774a42[_0xcc24('0x4e')]['id']},'attributes':[_0xcc24('0x2f'),_0xcc24('0x52')],'raw':!![]})[_0xcc24('0x29')](handleEntityNotFound(_0x388555,null))[_0xcc24('0x29')](function(_0x400d6c){if(_0x400d6c){var _0x28b885=path[_0xcc24('0x53')](config[_0xcc24('0x54')],_0xcc24('0x55'),util[_0xcc24('0x56')](_0xcc24('0x57'),path[_0xcc24('0x58')](_0x400d6c[_0xcc24('0x52')])));var _0x2876cb=fs['createWriteStream'](_0x28b885);var _0xdbde51=archiver(_0xcc24('0x59'),{'zlib':{'level':0x9}});_0xdbde51['on'](_0xcc24('0x5a'),function(_0x4bb05e){if(_0x4bb05e[_0xcc24('0x5b')]===_0xcc24('0x5c')){logger[_0xcc24('0x2d')](_0x4bb05e);}else{throw new db[(_0xcc24('0x5d'))][(_0xcc24('0x5e'))](_0xcc24('0x5f'));}});_0xdbde51['on'](_0xcc24('0x2d'),function(_0x4c22c7){throw new db[(_0xcc24('0x5d'))][(_0xcc24('0x5e'))](_0xcc24('0x5f'));});_0xdbde51['pipe'](_0x2876cb);_0xdbde51[_0xcc24('0x60')](_0xcc24('0x61'),{'cwd':path['join'](config['root'],_0xcc24('0x55'),path[_0xcc24('0x62')](_0x400d6c[_0xcc24('0x52')])),'ignore':[path[_0xcc24('0x53')](path[_0xcc24('0x58')](_0x400d6c['path']),_0xcc24('0x63')),path[_0xcc24('0x53')](path[_0xcc24('0x58')](_0x400d6c['path']),_0xcc24('0x64'))],'nodir':!![]})['finalize']();_0x2876cb['on'](_0xcc24('0x65'),function(){if(!fs[_0xcc24('0x66')](_0x28b885)){throw new db['Sequelize'][(_0xcc24('0x5e'))]('Plugin\x20not\x20found');}return _0x388555['download'](_0x28b885,util['format'](_0xcc24('0x57'),path['basename'](_0x400d6c[_0xcc24('0x52')])),function(_0x513025){if(_0x513025){throw new db[(_0xcc24('0x5d'))][(_0xcc24('0x5e'))](_0xcc24('0x67'));}fs[_0xcc24('0x68')](_0x28b885);logger[_0xcc24('0x69')](_0xcc24('0x6a'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0xcc24('0x4d')](handleError(_0x388555,null));};exports[_0xcc24('0x6b')]=function(_0x307ed4,_0x3fd1b2,_0x59685b){var _0x55d6c1=path['basename'](_0x307ed4['file']['filename'],path[_0xcc24('0x6c')](_0x307ed4['file'][_0xcc24('0x6d')]));var _0x1608e7=path[_0xcc24('0x53')](config['root'],_0xcc24('0x55'),_0x307ed4['file'][_0xcc24('0x6d')]);var _0x12817a=path[_0xcc24('0x53')](config['root'],_0xcc24('0x55'),_0x55d6c1);logger[_0xcc24('0x69')]('Plugin\x20upload\x20filepath:\x20%s',_0x1608e7);logger[_0xcc24('0x69')]('Plugin\x20upload\x20destination:\x20%s',_0x12817a);try{fs[_0xcc24('0x6e')](_0x1608e7,parseInt(_0xcc24('0x6f'),0x8));extract(_0x1608e7,{'dir':_0x12817a},function(_0x4f0557){if(_0x4f0557){logger[_0xcc24('0x2d')](_0x4f0557);handleError(_0x4f0557,!![]);};var _0x2449cd=fs[_0xcc24('0x70')](_0x12817a);if(_0x2449cd[_0xcc24('0x3f')]>0x1){removeReferences(_0x1608e7,_0x12817a);logger[_0xcc24('0x2d')](_0xcc24('0x71'));return _0x59685b(new Error('Invalid\x20plugin\x20structure'));}var _0x20e989=fs['lstatSync'](path[_0xcc24('0x53')](_0x12817a,_0x2449cd[0x0]));if(_0x20e989[_0xcc24('0x72')]()){removeReferences(_0x1608e7,_0x12817a);logger[_0xcc24('0x2d')]('Invalid\x20plugin\x20structure');return _0x59685b(new Error(_0xcc24('0x71')));}if(_0x20e989[_0xcc24('0x73')]()){var _0x146dd0=fs['readdirSync'](path[_0xcc24('0x53')](_0x12817a,_0x2449cd[0x0]));if(_0x146dd0[_0xcc24('0x3f')]===0x0){removeReferences(_0x1608e7,_0x12817a);logger[_0xcc24('0x2d')](_0xcc24('0x71'));return _0x59685b(new Error(_0xcc24('0x71')));}var _0x2fdd96=_0x146dd0[_0xcc24('0x74')](function(_0x10b56a){return _0x10b56a===_0xcc24('0x75');});if(!_0x2fdd96){return _0x59685b(new Error('Plugin\x20manifest\x20missing'));}var _0x59d291=fs[_0xcc24('0x76')](path['join'](_0x12817a,_0x2449cd[0x0],_0xcc24('0x75')));var _0x95204a=JSON[_0xcc24('0x77')](_0x59d291);if('undefined'==typeof _0x95204a[_0xcc24('0x2f')]){return _0x59685b(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xcc24('0x20')==typeof _0x95204a[_0xcc24('0x36')]){return _0x59685b(new Error(_0xcc24('0x78')));}if(_0xcc24('0x20')==typeof _0x95204a[_0xcc24('0x79')]){return _0x59685b(new Error(_0xcc24('0x7a')));}if('undefined'==typeof _0x95204a[_0xcc24('0x7b')]){return _0x59685b(new Error(_0xcc24('0x7c')));}if(_0x95204a[_0xcc24('0x36')]===_0xcc24('0x7d')){if(_0xcc24('0x20')==typeof _0x95204a['parameters'][_0xcc24('0x7e')]){return _0x59685b(new Error(_0xcc24('0x7f')));}if(_0xcc24('0x20')==typeof _0x95204a[_0xcc24('0x7b')][_0xcc24('0x7e')][_0xcc24('0x80')]&&'undefined'==typeof _0x95204a[_0xcc24('0x7b')][_0xcc24('0x7e')]['agent']){return _0x59685b(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x95204a['type']===_0xcc24('0x81')){if(_0xcc24('0x20')==typeof _0x95204a['parameters'][_0xcc24('0x82')]){return _0x59685b(new Error(_0xcc24('0x83')));}if(_0xcc24('0x20')==typeof _0x95204a[_0xcc24('0x7b')][_0xcc24('0x84')]){return _0x59685b(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x59685b(new Error(_0xcc24('0x85')));}var _0x1aa9a3=_0x95204a[_0xcc24('0x2f')];var _0x5afc63=_0x95204a[_0xcc24('0x86')];var _0x414e5f=_0x95204a[_0xcc24('0x36')];var _0x11f166=_0x95204a[_0xcc24('0x87')]?_0x95204a['sidebar']:_0xcc24('0x88');var _0x39d961=_0x95204a[_0xcc24('0x89')]?_0x95204a[_0xcc24('0x89')]:_0xcc24('0x8a');var _0x24c1ce='';var _0x20cf28='';var _0x30db91='';var _0x14af97='';var _0x3435bd=_0x95204a[_0xcc24('0x79')];if(_0x414e5f===_0xcc24('0x7d')){if(_0xcc24('0x20')!=typeof _0x95204a[_0xcc24('0x7b')][_0xcc24('0x7e')][_0xcc24('0x80')]){var _0x213684=_0x95204a[_0xcc24('0x7b')][_0xcc24('0x7e')][_0xcc24('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xcc24('0x8b')](_0x213684)){_0x24c1ce=path[_0xcc24('0x53')]('plugins',_0x55d6c1,_0x2449cd[0x0],_0x213684);}else{_0x24c1ce=_0x213684;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x95204a['parameters']['views'][_0xcc24('0x8c')]){var _0x22f6ff=_0x95204a[_0xcc24('0x7b')]['views'][_0xcc24('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0xcc24('0x8b')](_0x22f6ff)){_0x20cf28=path[_0xcc24('0x53')]('plugins',_0x55d6c1,_0x2449cd[0x0],_0x22f6ff);}else{_0x20cf28=_0x22f6ff;}}else{logger[_0xcc24('0x69')](_0xcc24('0x8d'));}}else if(_0x414e5f===_0xcc24('0x81')){_0x30db91=_0x95204a[_0xcc24('0x7b')][_0xcc24('0x82')];_0x14af97=_0x95204a[_0xcc24('0x7b')][_0xcc24('0x84')];if(_0xcc24('0x20')!=typeof _0x95204a[_0xcc24('0x7b')]['views']){if(_0xcc24('0x20')!=typeof _0x95204a[_0xcc24('0x7b')][_0xcc24('0x7e')]['admin']){var _0x213684=_0x95204a[_0xcc24('0x7b')][_0xcc24('0x7e')][_0xcc24('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x213684)){_0x24c1ce=path[_0xcc24('0x53')](_0xcc24('0x8e'),_0x55d6c1,_0x2449cd[0x0],_0x213684);}else{_0x24c1ce=_0x213684;}}if(_0xcc24('0x20')!=typeof _0x95204a[_0xcc24('0x7b')][_0xcc24('0x7e')]['agent']){var _0x22f6ff=_0x95204a[_0xcc24('0x7b')][_0xcc24('0x7e')][_0xcc24('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x22f6ff)){_0x20cf28=path['join'](_0xcc24('0x8e'),_0x55d6c1,_0x2449cd[0x0],_0x22f6ff);}else{_0x20cf28=_0x22f6ff;}}}}var _0x4453bc={'name':_0x1aa9a3,'description':_0x5afc63,'path':path['join'](_0x55d6c1,_0x2449cd[0x0]),'type':_0x414e5f,'sidebar':_0x11f166,'icon':_0x39d961,'adminUrl':_0x24c1ce,'agentUrl':_0x20cf28,'scriptName':_0x30db91,'scriptPath':_0x14af97,'version':_0x3435bd};removeReferences(_0x1608e7,null);return db['Plugin'][_0xcc24('0x8f')](_0x4453bc)[_0xcc24('0x29')](function(_0x3424d2){var _0x5950b0={'role':_0x307ed4[_0xcc24('0x90')][_0xcc24('0x91')],'userProfileId':_0x307ed4['body'][_0xcc24('0x92')]};if(!_0x5950b0)throw new Error(_0xcc24('0x93'));if(_0x5950b0['role']===_0xcc24('0x94')){var _0x11d699=_0x3424d2[_0xcc24('0x2b')]({'plain':!![]});return db['UserProfileSection'][_0xcc24('0x50')]({'where':{'name':_0xcc24('0x95'),'userProfileId':_0x5950b0['userProfileId']},'raw':!![]})[_0xcc24('0x29')](function(_0x3b5c7f){if(_0x3b5c7f&&_0x3b5c7f['autoAssociation']===0x0){return db[_0xcc24('0x96')][_0xcc24('0x8f')]({'name':_0x11d699[_0xcc24('0x2f')],'resourceId':_0x11d699['id'],'type':_0x3b5c7f['name'],'sectionId':_0x3b5c7f['id']},{})['then'](function(){return _0x3424d2;});}else{return _0x3424d2;}})[_0xcc24('0x4d')](function(_0x249e3f){logger[_0xcc24('0x2d')](_0xcc24('0x97'),_0x249e3f);throw _0x249e3f;});}return _0x3424d2;})['then'](respondWithResult(_0x3fd1b2,null))[_0xcc24('0x4d')](handleError(_0x3fd1b2,null));}});}catch(_0x5be4dc){_0x3fd1b2[_0xcc24('0x1e')](0x1f4)[_0xcc24('0x30')](_0x5be4dc);}};function removeReferences(_0x569b03,_0x5e510d){try{if(_0x569b03){fs[_0xcc24('0x68')](_0x569b03);logger['info'](_0xcc24('0x98'));}if(_0x5e510d){rimraf(_0x5e510d,function(){});logger[_0xcc24('0x69')](_0xcc24('0x99'));}}catch(_0x27962f){logger[_0xcc24('0x2d')](_0x27962f);}}exports['update']=function(_0x153de9,_0x394775,_0x410b84){return db[_0xcc24('0x33')][_0xcc24('0x50')]({'where':{'id':_0x153de9[_0xcc24('0x4e')]['id']}})[_0xcc24('0x29')](handleEntityNotFound(_0x394775,null))[_0xcc24('0x29')](saveUpdates(_0x153de9[_0xcc24('0x90')],null))['then'](respondWithResult(_0x394775,null))[_0xcc24('0x4d')](handleError(_0x394775,null));};exports[_0xcc24('0x9a')]=function(_0x1c8716,_0x17ff2e,_0x27bb3f){return db[_0xcc24('0x33')][_0xcc24('0x50')]({'where':{'id':_0x1c8716['params']['id']}})['then'](function(_0x48d84b){if(_0x48d84b){return _0x48d84b[_0xcc24('0x2a')]();}})['then'](function(_0xc17097){rimraf(path['join'](config[_0xcc24('0x54')],_0xcc24('0x55'),path[_0xcc24('0x62')](_0xc17097[_0xcc24('0x52')])),function(){});return _0xc17097;})['then'](handleEntityNotFound(_0x17ff2e,null))[_0xcc24('0x29')](respondWithStatusCode(_0x17ff2e,null))[_0xcc24('0x4d')](handleError(_0x17ff2e,null));};exports['webhookGet']=function(_0x4c97c1,_0x8a1ff0,_0x21c3b2){return BPromise[_0xcc24('0x9b')]()[_0xcc24('0x29')](function(){if(!_0x4c97c1['query'][_0xcc24('0x52')]){throw new Error(_0xcc24('0x9c'));}if(!_0x4c97c1['query'][_0xcc24('0x9d')]){throw new Error(_0xcc24('0x9e'));}var _0xa40636=_0x4c97c1[_0xcc24('0x39')][_0xcc24('0x9f')]?_0x4c97c1[_0xcc24('0x39')]['hostname']+':'+_0x4c97c1[_0xcc24('0x39')]['port']:_0xcc24('0xa0')+_0x4c97c1[_0xcc24('0x39')][_0xcc24('0x9d')];var _0x2af4f6=_0x4c97c1[_0xcc24('0x39')][_0xcc24('0x25')]?_0x4c97c1[_0xcc24('0x39')][_0xcc24('0x25')]:!![];var _0x5c7ada=_0x4c97c1[_0xcc24('0x39')][_0xcc24('0xa1')]?_0x4c97c1['query'][_0xcc24('0xa1')]:null;var _0x5d0230={'method':_0x4c97c1[_0xcc24('0xa2')],'uri':util[_0xcc24('0x56')](_0xcc24('0xa3'),_0xa40636,_0x4c97c1[_0xcc24('0x39')][_0xcc24('0x52')]),'json':_0x2af4f6,'resolveWithFullResponse':!![],'encoding':_0x5c7ada,'qs':_0x4c97c1[_0xcc24('0x39')]};if(_0x4c97c1[_0xcc24('0xa4')]){_0x5d0230[_0xcc24('0xa4')]=_0x4c97c1[_0xcc24('0xa4')];if(_0x5d0230[_0xcc24('0xa4')]['content-length']){delete _0x5d0230[_0xcc24('0xa4')]['content-length'];}}if(_0x5d0230['headers'][_0xcc24('0xa5')]){delete _0x5d0230[_0xcc24('0xa4')][_0xcc24('0xa5')];}return rp(_0x5d0230);})[_0xcc24('0x29')](function(_0x35379c){if(_0x35379c){_0x8a1ff0[_0xcc24('0x23')](_0x35379c['headers']);logger[_0xcc24('0x69')](_0x35379c[_0xcc24('0x90')]);if(_[_0xcc24('0xa6')](_0x4c97c1[_0xcc24('0x39')][_0xcc24('0x52')],'download')&&_0x35379c[_0xcc24('0xa7')]==0x1f4){return _0x8a1ff0[_0xcc24('0x1d')](_0x35379c['statusCode']);}else{return _0x8a1ff0[_0xcc24('0x1e')](_0x35379c['statusCode'])[_0xcc24('0x30')](_0x35379c[_0xcc24('0x90')]);}}else{return _0x8a1ff0['sendStatus'](0xc8);}})[_0xcc24('0x4d')](handleError(_0x8a1ff0,null));};exports[_0xcc24('0xa8')]=function(_0x1556e7,_0x570d8e,_0x2f4d4a){return BPromise[_0xcc24('0x9b')]()[_0xcc24('0x29')](function(){if(!_0x1556e7['query']['path']){throw new Error(_0xcc24('0x9c'));}if(!_0x1556e7[_0xcc24('0x39')][_0xcc24('0x9d')]){throw new Error(_0xcc24('0x9e'));}var _0x1df81e=_0x1556e7[_0xcc24('0x39')][_0xcc24('0x9f')]?_0x1556e7[_0xcc24('0x39')][_0xcc24('0x9f')]+':'+_0x1556e7[_0xcc24('0x39')][_0xcc24('0x9d')]:_0xcc24('0xa0')+_0x1556e7[_0xcc24('0x39')][_0xcc24('0x9d')];var _0x4dc587=_0x1556e7[_0xcc24('0x39')][_0xcc24('0x25')]?_0x1556e7[_0xcc24('0x39')][_0xcc24('0x25')]:!![];var _0x1f0313=_0x1556e7[_0xcc24('0x39')]['encoding']?_0x1556e7[_0xcc24('0x39')][_0xcc24('0xa1')]:null;var _0x222278={'method':_0x1556e7['method'],'uri':util[_0xcc24('0x56')](_0xcc24('0xa3'),_0x1df81e,_0x1556e7[_0xcc24('0x39')][_0xcc24('0x52')]),'json':_0x4dc587,'resolveWithFullResponse':!![],'encoding':_0x1f0313,'body':_0x1556e7[_0xcc24('0x90')]};if(_0x1556e7['headers']){_0x222278['headers']=_0x1556e7['headers'];if(_0x222278[_0xcc24('0xa4')][_0xcc24('0xa9')]){delete _0x222278[_0xcc24('0xa4')][_0xcc24('0xa9')];}}if(_0x222278[_0xcc24('0xa4')][_0xcc24('0xa5')]){delete _0x222278['headers']['content-type'];}return rp(_0x222278);})[_0xcc24('0x29')](function(_0x5904a0){if(_0x5904a0){_0x570d8e[_0xcc24('0x23')](_0x5904a0[_0xcc24('0xa4')]);logger[_0xcc24('0x69')](_0x5904a0[_0xcc24('0x90')]);return _0x570d8e[_0xcc24('0x1e')](_0x5904a0[_0xcc24('0xa7')])[_0xcc24('0x30')](_0x5904a0[_0xcc24('0x90')]);}else{return _0x570d8e['sendStatus'](0xc8);}})[_0xcc24('0x4d')](handleError(_0x570d8e,null));}; \ No newline at end of file +var _0x8926=['headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','options','find','params','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','join','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method'];(function(_0x4ec1c9,_0x3e8698){var _0x4c8c8c=function(_0x432814){while(--_0x432814){_0x4ec1c9['push'](_0x4ec1c9['shift']());}};_0x4c8c8c(++_0x3e8698);}(_0x8926,0xb0));var _0x6892=function(_0x304b22,_0x4f5339){_0x304b22=_0x304b22-0x0;var _0x245ac1=_0x8926[_0x304b22];return _0x245ac1;};'use strict';var emlformat=require(_0x6892('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6892('0x1'));var jsonpatch=require(_0x6892('0x2'));var rp=require(_0x6892('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6892('0x4'));var path=require(_0x6892('0x5'));var sox=require(_0x6892('0x6'));var csv=require(_0x6892('0x7'));var ejs=require(_0x6892('0x8'));var fs=require('fs');var fs_extra=require(_0x6892('0x9'));var _=require(_0x6892('0xa'));var squel=require('squel');var crypto=require(_0x6892('0xb'));var jsforce=require(_0x6892('0xc'));var deskjs=require(_0x6892('0xd'));var toCsv=require(_0x6892('0x7'));var querystring=require(_0x6892('0xe'));var Papa=require(_0x6892('0xf'));var extract=require(_0x6892('0x10'));var rimraf=require(_0x6892('0x11'));var archiver=require('archiver');var Redis=require(_0x6892('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6892('0x13'));var as=require(_0x6892('0x14'));var hardwareService=require(_0x6892('0x15'));var logger=require(_0x6892('0x16'))(_0x6892('0x17'));var utils=require(_0x6892('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6892('0x19')]=_['defaults'](config[_0x6892('0x19')],{'host':_0x6892('0x1a'),'port':0x18eb});var socket=require(_0x6892('0x1b'))(new Redis(config['redis']));require('./plugin.socket')[_0x6892('0x1c')](socket);function respondWithStatusCode(_0x2a6352,_0x87d390){_0x87d390=_0x87d390||0xcc;return function(_0x13a968){if(_0x13a968){return _0x2a6352[_0x6892('0x1d')](_0x87d390);}return _0x2a6352[_0x6892('0x1e')](_0x87d390)[_0x6892('0x1f')]();};}function respondWithResult(_0x35ecda,_0x478ce3){_0x478ce3=_0x478ce3||0xc8;return function(_0x48d892){if(_0x48d892){return _0x35ecda['status'](_0x478ce3)[_0x6892('0x20')](_0x48d892);}};}function respondWithFilteredResult(_0x5632a0,_0x3b999f){return function(_0x5916ba){if(_0x5916ba){var _0x9e5585=typeof _0x3b999f['offset']===_0x6892('0x21')&&typeof _0x3b999f['limit']===_0x6892('0x21');var _0x381f62=_0x5916ba[_0x6892('0x22')];var _0x14145f=_0x9e5585?0x0:_0x3b999f[_0x6892('0x23')];var _0x13c891=_0x9e5585?_0x5916ba[_0x6892('0x22')]:_0x3b999f[_0x6892('0x23')]+_0x3b999f[_0x6892('0x24')];var _0x33c20f;if(_0x13c891>=_0x381f62){_0x13c891=_0x381f62;_0x33c20f=0xc8;}else{_0x33c20f=0xce;}_0x5632a0['status'](_0x33c20f);return _0x5632a0[_0x6892('0x25')](_0x6892('0x26'),_0x14145f+'-'+_0x13c891+'/'+_0x381f62)[_0x6892('0x20')](_0x5916ba);}return null;};}function patchUpdates(_0x12c168){return function(_0x4660cb){try{jsonpatch[_0x6892('0x27')](_0x4660cb,_0x12c168,!![]);}catch(_0x38ccfc){return BPromise[_0x6892('0x28')](_0x38ccfc);}return _0x4660cb[_0x6892('0x29')]();};}function saveUpdates(_0x586eb5,_0x40d34e){return function(_0x28694e){if(_0x28694e){return _0x28694e[_0x6892('0x2a')](_0x586eb5)['then'](function(_0x11420f){return _0x11420f;});}return null;};}function removeEntity(_0x445d01,_0x2d0145){return function(_0x2fe9b5){if(_0x2fe9b5){return _0x2fe9b5[_0x6892('0x2b')]()[_0x6892('0x2c')](function(){var _0x971470=_0x2fe9b5[_0x6892('0x2d')]({'plain':!![]});var _0x47818e=_0x6892('0x2e');return db[_0x6892('0x2f')][_0x6892('0x2b')]({'where':{'type':_0x47818e,'resourceId':_0x971470['id']}})['then'](function(){return _0x2fe9b5;});})[_0x6892('0x2c')](function(){_0x445d01[_0x6892('0x1e')](0xcc)[_0x6892('0x1f')]();});}};}function handleEntityNotFound(_0x56cec8,_0x459143){return function(_0x11d3c6){if(!_0x11d3c6){_0x56cec8[_0x6892('0x1d')](0x194);}return _0x11d3c6;};}function handleError(_0x30b7cf,_0x165d56){_0x165d56=_0x165d56||0x1f4;return function(_0x4fa1e5){logger[_0x6892('0x30')](_0x4fa1e5[_0x6892('0x31')]);if(_0x4fa1e5[_0x6892('0x32')]){delete _0x4fa1e5[_0x6892('0x32')];}_0x30b7cf[_0x6892('0x1e')](_0x165d56)[_0x6892('0x33')](_0x4fa1e5);};}exports[_0x6892('0x34')]=function(_0x18351f,_0x44b06c){var _0x11ab8e={},_0x2fa8ec={},_0x26d717={'count':0x0,'rows':[]};var _0x2a5bb3=_[_0x6892('0x35')](db[_0x6892('0x36')][_0x6892('0x37')],function(_0x5e3b7){return{'name':_0x5e3b7[_0x6892('0x38')],'type':_0x5e3b7[_0x6892('0x39')][_0x6892('0x3a')]};});_0x2fa8ec[_0x6892('0x3b')]=_[_0x6892('0x35')](_0x2a5bb3,_0x6892('0x32'));_0x2fa8ec['query']=_[_0x6892('0x3c')](_0x18351f[_0x6892('0x3d')]);_0x2fa8ec['filters']=_[_0x6892('0x3e')](_0x2fa8ec[_0x6892('0x3b')],_0x2fa8ec[_0x6892('0x3d')]);_0x11ab8e[_0x6892('0x3f')]=_['intersection'](_0x2fa8ec[_0x6892('0x3b')],qs[_0x6892('0x40')](_0x18351f[_0x6892('0x3d')][_0x6892('0x40')]));_0x11ab8e['attributes']=_0x11ab8e[_0x6892('0x3f')][_0x6892('0x41')]?_0x11ab8e[_0x6892('0x3f')]:_0x2fa8ec[_0x6892('0x3b')];if(!_0x18351f[_0x6892('0x3d')][_0x6892('0x42')]('nolimit')){_0x11ab8e[_0x6892('0x24')]=qs[_0x6892('0x24')](_0x18351f[_0x6892('0x3d')][_0x6892('0x24')]);_0x11ab8e[_0x6892('0x23')]=qs['offset'](_0x18351f[_0x6892('0x3d')][_0x6892('0x23')]);}_0x11ab8e[_0x6892('0x43')]=qs[_0x6892('0x44')](_0x18351f[_0x6892('0x3d')][_0x6892('0x44')]);_0x11ab8e[_0x6892('0x45')]=qs[_0x6892('0x46')](_['pick'](_0x18351f[_0x6892('0x3d')],_0x2fa8ec[_0x6892('0x46')]),_0x2a5bb3);if(_0x18351f[_0x6892('0x3d')][_0x6892('0x47')]){_0x11ab8e[_0x6892('0x45')]=_[_0x6892('0x48')](_0x11ab8e['where'],{'$or':_['map'](_0x2a5bb3,function(_0x406ddd){if(_0x406ddd[_0x6892('0x39')]!==_0x6892('0x49')){var _0x1eb633={};_0x1eb633[_0x406ddd[_0x6892('0x32')]]={'$like':'%'+_0x18351f[_0x6892('0x3d')][_0x6892('0x47')]+'%'};return _0x1eb633;}})});}_0x11ab8e=_[_0x6892('0x48')]({},_0x11ab8e,_0x18351f['options']);var _0x4e82cb={'where':_0x11ab8e[_0x6892('0x45')]};return db[_0x6892('0x36')][_0x6892('0x22')](_0x4e82cb)[_0x6892('0x2c')](function(_0x5f1dad){_0x26d717[_0x6892('0x22')]=_0x5f1dad;if(_0x18351f[_0x6892('0x3d')][_0x6892('0x4a')]){_0x11ab8e[_0x6892('0x4b')]=[{'all':!![]}];}return db[_0x6892('0x36')][_0x6892('0x4c')](_0x11ab8e);})[_0x6892('0x2c')](function(_0x163e0b){_0x26d717[_0x6892('0x4d')]=_0x163e0b;return _0x26d717;})[_0x6892('0x2c')](respondWithFilteredResult(_0x44b06c,_0x11ab8e))[_0x6892('0x4e')](handleError(_0x44b06c,null));};exports['show']=function(_0x578f00,_0x53b769){var _0x155c11={'raw':!![],'where':{'id':_0x578f00['params']['id']}},_0x153a2d={};_0x153a2d['model']=_[_0x6892('0x3c')](db[_0x6892('0x36')]['rawAttributes']);_0x153a2d[_0x6892('0x3d')]=_[_0x6892('0x3c')](_0x578f00['query']);_0x153a2d['filters']=_[_0x6892('0x3e')](_0x153a2d[_0x6892('0x3b')],_0x153a2d[_0x6892('0x3d')]);_0x155c11[_0x6892('0x3f')]=_[_0x6892('0x3e')](_0x153a2d[_0x6892('0x3b')],qs[_0x6892('0x40')](_0x578f00[_0x6892('0x3d')][_0x6892('0x40')]));_0x155c11['attributes']=_0x155c11[_0x6892('0x3f')]['length']?_0x155c11['attributes']:_0x153a2d[_0x6892('0x3b')];if(_0x578f00[_0x6892('0x3d')]['includeAll']){_0x155c11[_0x6892('0x4b')]=[{'all':!![]}];}_0x155c11=_['merge']({},_0x155c11,_0x578f00[_0x6892('0x4f')]);return db[_0x6892('0x36')][_0x6892('0x50')](_0x155c11)['then'](handleEntityNotFound(_0x53b769,null))[_0x6892('0x2c')](respondWithResult(_0x53b769,null))[_0x6892('0x4e')](handleError(_0x53b769,null));};exports['download']=function(_0x12bde7,_0x25fbdf,_0x195c36){return db[_0x6892('0x36')][_0x6892('0x50')]({'where':{'id':_0x12bde7[_0x6892('0x51')]['id']},'attributes':[_0x6892('0x32'),_0x6892('0x5')],'raw':!![]})['then'](handleEntityNotFound(_0x25fbdf,null))['then'](function(_0x17dde4){if(_0x17dde4){var _0x7dbbe6=path['join'](config[_0x6892('0x52')],_0x6892('0x53'),util[_0x6892('0x54')](_0x6892('0x55'),path[_0x6892('0x56')](_0x17dde4[_0x6892('0x5')])));var _0x346738=fs[_0x6892('0x57')](_0x7dbbe6);var _0x3853e2=archiver('zip',{'zlib':{'level':0x9}});_0x3853e2['on'](_0x6892('0x58'),function(_0x5f22fe){if(_0x5f22fe[_0x6892('0x59')]==='ENOENT'){logger[_0x6892('0x30')](_0x5f22fe);}else{throw new db[(_0x6892('0x5a'))][(_0x6892('0x5b'))](_0x6892('0x5c'));}});_0x3853e2['on'](_0x6892('0x30'),function(_0x4fa5ec){throw new db[(_0x6892('0x5a'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x3853e2['pipe'](_0x346738);_0x3853e2[_0x6892('0x5d')]('**/*',{'cwd':path[_0x6892('0x5e')](config['root'],_0x6892('0x53'),path['dirname'](_0x17dde4[_0x6892('0x5')])),'ignore':[path[_0x6892('0x5e')](path[_0x6892('0x56')](_0x17dde4['path']),_0x6892('0x5f')),path[_0x6892('0x5e')](path[_0x6892('0x56')](_0x17dde4[_0x6892('0x5')]),_0x6892('0x60'))],'nodir':!![]})['finalize']();_0x346738['on'](_0x6892('0x61'),function(){if(!fs[_0x6892('0x62')](_0x7dbbe6)){throw new db[(_0x6892('0x5a'))][(_0x6892('0x5b'))](_0x6892('0x63'));}return _0x25fbdf['download'](_0x7dbbe6,util[_0x6892('0x54')](_0x6892('0x55'),path[_0x6892('0x56')](_0x17dde4[_0x6892('0x5')])),function(_0x3f53f8){if(_0x3f53f8){throw new db[(_0x6892('0x5a'))][(_0x6892('0x5b'))](_0x6892('0x64'));}fs[_0x6892('0x65')](_0x7dbbe6);logger[_0x6892('0x66')](_0x6892('0x67'));logger[_0x6892('0x66')](_0x6892('0x68'));});});}return null;})[_0x6892('0x4e')](handleError(_0x25fbdf,null));};exports[_0x6892('0x69')]=function(_0x352ec3,_0x15e47c,_0x3b4aac){var _0x416fda=path[_0x6892('0x56')](_0x352ec3['file'][_0x6892('0x6a')],path[_0x6892('0x6b')](_0x352ec3[_0x6892('0x6c')][_0x6892('0x6a')]));var _0x386bbc=path[_0x6892('0x5e')](config[_0x6892('0x52')],_0x6892('0x53'),_0x352ec3['file'][_0x6892('0x6a')]);var _0x388796=path['join'](config[_0x6892('0x52')],_0x6892('0x53'),_0x416fda);logger[_0x6892('0x66')](_0x6892('0x6d'),_0x386bbc);logger['info'](_0x6892('0x6e'),_0x388796);try{fs[_0x6892('0x6f')](_0x386bbc,parseInt(_0x6892('0x70'),0x8));extract(_0x386bbc,{'dir':_0x388796},function(_0x2707b2){if(_0x2707b2){logger[_0x6892('0x30')](_0x2707b2);handleError(_0x2707b2,!![]);};var _0x2ea5e0=fs[_0x6892('0x71')](_0x388796);if(_0x2ea5e0[_0x6892('0x41')]>0x1){removeReferences(_0x386bbc,_0x388796);logger['error'](_0x6892('0x72'));return _0x3b4aac(new Error(_0x6892('0x72')));}var _0x9779eb=fs['lstatSync'](path[_0x6892('0x5e')](_0x388796,_0x2ea5e0[0x0]));if(_0x9779eb['isFile']()){removeReferences(_0x386bbc,_0x388796);logger[_0x6892('0x30')](_0x6892('0x72'));return _0x3b4aac(new Error(_0x6892('0x72')));}if(_0x9779eb[_0x6892('0x73')]()){var _0x2bdd25=fs[_0x6892('0x71')](path[_0x6892('0x5e')](_0x388796,_0x2ea5e0[0x0]));if(_0x2bdd25[_0x6892('0x41')]===0x0){removeReferences(_0x386bbc,_0x388796);logger[_0x6892('0x30')](_0x6892('0x72'));return _0x3b4aac(new Error('Invalid\x20plugin\x20structure'));}var _0x5af522=_0x2bdd25[_0x6892('0x74')](function(_0x3dc766){return _0x3dc766===_0x6892('0x75');});if(!_0x5af522){return _0x3b4aac(new Error(_0x6892('0x76')));}var _0x2c40ee=fs[_0x6892('0x77')](path[_0x6892('0x5e')](_0x388796,_0x2ea5e0[0x0],'manifest.json'));var _0x471e8f=JSON[_0x6892('0x78')](_0x2c40ee);if(_0x6892('0x21')==typeof _0x471e8f[_0x6892('0x32')]){return _0x3b4aac(new Error(_0x6892('0x79')));}if('undefined'==typeof _0x471e8f[_0x6892('0x39')]){return _0x3b4aac(new Error(_0x6892('0x7a')));}if(_0x6892('0x21')==typeof _0x471e8f[_0x6892('0x7b')]){return _0x3b4aac(new Error(_0x6892('0x7c')));}if(_0x6892('0x21')==typeof _0x471e8f[_0x6892('0x7d')]){return _0x3b4aac(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x471e8f[_0x6892('0x39')]===_0x6892('0x7e')){if(_0x6892('0x21')==typeof _0x471e8f[_0x6892('0x7d')][_0x6892('0x7f')]){return _0x3b4aac(new Error(_0x6892('0x80')));}if('undefined'==typeof _0x471e8f[_0x6892('0x7d')]['views'][_0x6892('0x81')]&&_0x6892('0x21')==typeof _0x471e8f['parameters'][_0x6892('0x7f')][_0x6892('0x82')]){return _0x3b4aac(new Error(_0x6892('0x83')));}}else if(_0x471e8f[_0x6892('0x39')]===_0x6892('0x84')){if(_0x6892('0x21')==typeof _0x471e8f[_0x6892('0x7d')][_0x6892('0x85')]){return _0x3b4aac(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x6892('0x21')==typeof _0x471e8f[_0x6892('0x7d')][_0x6892('0x86')]){return _0x3b4aac(new Error(_0x6892('0x87')));}}else{return _0x3b4aac(new Error(_0x6892('0x88')));}var _0x2f5682=_0x471e8f[_0x6892('0x32')];var _0x46ecab=_0x471e8f['description'];var _0x5e6c65=_0x471e8f[_0x6892('0x39')];var _0x453f18=_0x471e8f[_0x6892('0x89')]?_0x471e8f['sidebar']:_0x6892('0x8a');var _0x3c850a=_0x471e8f[_0x6892('0x8b')]?_0x471e8f[_0x6892('0x8b')]:'icon-apps';var _0x19d7f0='';var _0x9e9304='';var _0x1fe63d='';var _0x48425d='';var _0x2e1c66=_0x471e8f[_0x6892('0x7b')];if(_0x5e6c65==='html'){if(_0x6892('0x21')!=typeof _0x471e8f[_0x6892('0x7d')]['views']['admin']){var _0x22fba3=_0x471e8f[_0x6892('0x7d')][_0x6892('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x6892('0x8c')](_0x22fba3)){_0x19d7f0=path[_0x6892('0x5e')]('plugins',_0x416fda,_0x2ea5e0[0x0],_0x22fba3);}else{_0x19d7f0=_0x22fba3;}}else{logger[_0x6892('0x66')](_0x6892('0x8d'));}if(_0x6892('0x21')!=typeof _0x471e8f['parameters']['views'][_0x6892('0x82')]){var _0x5191a5=_0x471e8f[_0x6892('0x7d')][_0x6892('0x7f')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x6892('0x8c')](_0x5191a5)){_0x9e9304=path[_0x6892('0x5e')](_0x6892('0x8e'),_0x416fda,_0x2ea5e0[0x0],_0x5191a5);}else{_0x9e9304=_0x5191a5;}}else{logger[_0x6892('0x66')](_0x6892('0x8f'));}}else if(_0x5e6c65===_0x6892('0x84')){_0x1fe63d=_0x471e8f[_0x6892('0x7d')]['scriptName'];_0x48425d=_0x471e8f[_0x6892('0x7d')][_0x6892('0x86')];if('undefined'!=typeof _0x471e8f[_0x6892('0x7d')][_0x6892('0x7f')]){if('undefined'!=typeof _0x471e8f[_0x6892('0x7d')][_0x6892('0x7f')][_0x6892('0x81')]){var _0x22fba3=_0x471e8f[_0x6892('0x7d')]['views'][_0x6892('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x6892('0x8c')](_0x22fba3)){_0x19d7f0=path[_0x6892('0x5e')](_0x6892('0x8e'),_0x416fda,_0x2ea5e0[0x0],_0x22fba3);}else{_0x19d7f0=_0x22fba3;}}if(_0x6892('0x21')!=typeof _0x471e8f[_0x6892('0x7d')][_0x6892('0x7f')][_0x6892('0x82')]){var _0x5191a5=_0x471e8f['parameters']['views'][_0x6892('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x6892('0x8c')](_0x5191a5)){_0x9e9304=path[_0x6892('0x5e')](_0x6892('0x8e'),_0x416fda,_0x2ea5e0[0x0],_0x5191a5);}else{_0x9e9304=_0x5191a5;}}}}var _0x2ccd63={'name':_0x2f5682,'description':_0x46ecab,'path':path[_0x6892('0x5e')](_0x416fda,_0x2ea5e0[0x0]),'type':_0x5e6c65,'sidebar':_0x453f18,'icon':_0x3c850a,'adminUrl':_0x19d7f0,'agentUrl':_0x9e9304,'scriptName':_0x1fe63d,'scriptPath':_0x48425d,'version':_0x2e1c66};removeReferences(_0x386bbc,null);return db[_0x6892('0x36')][_0x6892('0x90')](_0x2ccd63)['then'](function(_0x561237){var _0x274d41={'role':_0x352ec3['body'][_0x6892('0x91')],'userProfileId':_0x352ec3[_0x6892('0x92')][_0x6892('0x93')]};if(!_0x274d41)throw new Error(_0x6892('0x94'));if(_0x274d41[_0x6892('0x91')]===_0x6892('0x95')){var _0x34a914=_0x561237['get']({'plain':!![]});return db['UserProfileSection'][_0x6892('0x50')]({'where':{'name':_0x6892('0x2e'),'userProfileId':_0x274d41[_0x6892('0x93')]},'raw':!![]})[_0x6892('0x2c')](function(_0x40facb){if(_0x40facb&&_0x40facb[_0x6892('0x96')]===0x0){return db[_0x6892('0x2f')][_0x6892('0x90')]({'name':_0x34a914[_0x6892('0x32')],'resourceId':_0x34a914['id'],'type':_0x40facb['name'],'sectionId':_0x40facb['id']},{})[_0x6892('0x2c')](function(){return _0x561237;});}else{return _0x561237;}})[_0x6892('0x4e')](function(_0x2fbacb){logger[_0x6892('0x30')](_0x6892('0x97'),_0x2fbacb);throw _0x2fbacb;});}return _0x561237;})['then'](respondWithResult(_0x15e47c,null))[_0x6892('0x4e')](handleError(_0x15e47c,null));}});}catch(_0xfad187){_0x15e47c[_0x6892('0x1e')](0x1f4)['send'](_0xfad187);}};function removeReferences(_0x160997,_0x23c753){try{if(_0x160997){fs['unlinkSync'](_0x160997);logger['info'](_0x6892('0x98'));}if(_0x23c753){rimraf(_0x23c753,function(){});logger[_0x6892('0x66')](_0x6892('0x99'));}}catch(_0x376c81){logger[_0x6892('0x30')](_0x376c81);}}exports['update']=function(_0x355fef,_0x29ce53,_0x2b0f00){return db[_0x6892('0x36')][_0x6892('0x50')]({'where':{'id':_0x355fef['params']['id']}})['then'](handleEntityNotFound(_0x29ce53,null))[_0x6892('0x2c')](saveUpdates(_0x355fef[_0x6892('0x92')],null))[_0x6892('0x2c')](respondWithResult(_0x29ce53,null))[_0x6892('0x4e')](handleError(_0x29ce53,null));};exports['delete']=function(_0x657e3a,_0xdb0f77,_0x5a98a8){return db[_0x6892('0x36')][_0x6892('0x50')]({'where':{'id':_0x657e3a[_0x6892('0x51')]['id']}})[_0x6892('0x2c')](function(_0x3ce2da){if(_0x3ce2da){return _0x3ce2da[_0x6892('0x2b')]();}})[_0x6892('0x2c')](function(_0x558a47){rimraf(path[_0x6892('0x5e')](config[_0x6892('0x52')],_0x6892('0x53'),path[_0x6892('0x9a')](_0x558a47[_0x6892('0x5')])),function(){});return _0x558a47;})[_0x6892('0x2c')](handleEntityNotFound(_0xdb0f77,null))[_0x6892('0x2c')](respondWithStatusCode(_0xdb0f77,null))[_0x6892('0x4e')](handleError(_0xdb0f77,null));};exports[_0x6892('0x9b')]=function(_0x1f679c,_0x1befb3,_0x4becb3){return BPromise[_0x6892('0x9c')]()[_0x6892('0x2c')](function(){if(!_0x1f679c[_0x6892('0x3d')][_0x6892('0x5')]){throw new Error(_0x6892('0x9d'));}if(!_0x1f679c['query'][_0x6892('0x9e')]){throw new Error(_0x6892('0x9f'));}var _0x5d16b0=_0x1f679c[_0x6892('0x3d')][_0x6892('0xa0')]?_0x1f679c[_0x6892('0x3d')][_0x6892('0xa0')]+':'+_0x1f679c[_0x6892('0x3d')][_0x6892('0x9e')]:_0x6892('0xa1')+_0x1f679c[_0x6892('0x3d')][_0x6892('0x9e')];var _0x13dfcf=_0x1f679c[_0x6892('0x3d')]['json']?_0x1f679c['query'][_0x6892('0x20')]:!![];var _0xa861fe=_0x1f679c[_0x6892('0x3d')][_0x6892('0xa2')]?_0x1f679c['query'][_0x6892('0xa2')]:null;var _0x10514e={'method':_0x1f679c[_0x6892('0xa3')],'uri':util[_0x6892('0x54')]('%s%s',_0x5d16b0,_0x1f679c[_0x6892('0x3d')][_0x6892('0x5')]),'json':_0x13dfcf,'resolveWithFullResponse':!![],'encoding':_0xa861fe,'qs':_0x1f679c[_0x6892('0x3d')]};if(_0x1f679c[_0x6892('0xa4')]){_0x10514e[_0x6892('0xa4')]=_0x1f679c[_0x6892('0xa4')];if(_0x10514e[_0x6892('0xa4')][_0x6892('0xa5')]){delete _0x10514e['headers']['content-length'];}}if(_0x10514e[_0x6892('0xa4')]['content-type']){delete _0x10514e[_0x6892('0xa4')][_0x6892('0xa6')];}return rp(_0x10514e);})[_0x6892('0x2c')](function(_0x5b7642){if(_0x5b7642){_0x1befb3[_0x6892('0x25')](_0x5b7642[_0x6892('0xa4')]);logger[_0x6892('0x66')](_0x5b7642['body']);if(_[_0x6892('0xa7')](_0x1f679c[_0x6892('0x3d')]['path'],'download')&&_0x5b7642['statusCode']==0x1f4){return _0x1befb3[_0x6892('0x1d')](_0x5b7642[_0x6892('0xa8')]);}else{return _0x1befb3[_0x6892('0x1e')](_0x5b7642['statusCode'])[_0x6892('0x33')](_0x5b7642[_0x6892('0x92')]);}}else{return _0x1befb3[_0x6892('0x1d')](0xc8);}})[_0x6892('0x4e')](handleError(_0x1befb3,null));};exports[_0x6892('0xa9')]=function(_0xfa5713,_0x2796c8,_0x431406){return BPromise['resolve']()[_0x6892('0x2c')](function(){if(!_0xfa5713[_0x6892('0x3d')][_0x6892('0x5')]){throw new Error(_0x6892('0x9d'));}if(!_0xfa5713[_0x6892('0x3d')][_0x6892('0x9e')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x314933=_0xfa5713['query'][_0x6892('0xa0')]?_0xfa5713[_0x6892('0x3d')]['hostname']+':'+_0xfa5713['query'][_0x6892('0x9e')]:'http://localhost:'+_0xfa5713[_0x6892('0x3d')][_0x6892('0x9e')];var _0x4a6560=_0xfa5713[_0x6892('0x3d')][_0x6892('0x20')]?_0xfa5713[_0x6892('0x3d')][_0x6892('0x20')]:!![];var _0xc8a022=_0xfa5713['query'][_0x6892('0xa2')]?_0xfa5713['query'][_0x6892('0xa2')]:null;var _0x226d6d={'method':_0xfa5713[_0x6892('0xa3')],'uri':util['format']('%s%s',_0x314933,_0xfa5713[_0x6892('0x3d')]['path']),'json':_0x4a6560,'resolveWithFullResponse':!![],'encoding':_0xc8a022,'body':_0xfa5713['body']};if(_0xfa5713[_0x6892('0xa4')]){_0x226d6d[_0x6892('0xa4')]=_0xfa5713[_0x6892('0xa4')];if(_0x226d6d[_0x6892('0xa4')]['content-length']){delete _0x226d6d['headers'][_0x6892('0xa5')];}}if(_0x226d6d[_0x6892('0xa4')]['content-type']){delete _0x226d6d[_0x6892('0xa4')][_0x6892('0xa6')];}return rp(_0x226d6d);})[_0x6892('0x2c')](function(_0x1e2417){if(_0x1e2417){_0x2796c8[_0x6892('0x25')](_0x1e2417['headers']);logger[_0x6892('0x66')](_0x1e2417[_0x6892('0x92')]);return _0x2796c8[_0x6892('0x1e')](_0x1e2417['statusCode'])[_0x6892('0x33')](_0x1e2417[_0x6892('0x92')]);}else{return _0x2796c8['sendStatus'](0xc8);}})[_0x6892('0x4e')](handleError(_0x2796c8,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a7f366d..2af4cf2 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 _0x8838=['events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4af78d,_0x10b5e1){var _0x1892da=function(_0x45d2a9){while(--_0x45d2a9){_0x4af78d['push'](_0x4af78d['shift']());}};_0x1892da(++_0x10b5e1);}(_0x8838,0x90));var _0x8883=function(_0x84dd5d,_0x4b96d7){_0x84dd5d=_0x84dd5d-0x0;var _0x48e59f=_0x8838[_0x84dd5d];return _0x48e59f;};'use strict';var EventEmitter=require(_0x8883('0x0'));var Plugin=require(_0x8883('0x1'))['db'][_0x8883('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x8883('0x3')](0x0);var events={'afterCreate':_0x8883('0x4'),'afterUpdate':_0x8883('0x5'),'afterDestroy':_0x8883('0x6')};function emitEvent(_0x87a65f){return function(_0x3df479,_0x2d7568,_0x4c489){PluginEvents[_0x8883('0x7')](_0x87a65f+':'+_0x3df479['id'],_0x3df479);PluginEvents['emit'](_0x87a65f,_0x3df479);_0x4c489(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x8883('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x0295=['remove','emit','hasOwnProperty','hook','events','setMaxListeners'];(function(_0x2b1229,_0x365664){var _0x38c02b=function(_0x5e2c71){while(--_0x5e2c71){_0x2b1229['push'](_0x2b1229['shift']());}};_0x38c02b(++_0x365664);}(_0x0295,0x1f0));var _0x5029=function(_0x5069f7,_0x4b5f46){_0x5069f7=_0x5069f7-0x0;var _0x519491=_0x0295[_0x5069f7];return _0x519491;};'use strict';var EventEmitter=require(_0x5029('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x5029('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5029('0x2')};function emitEvent(_0x36335d){return function(_0x157a4f,_0x3d0af1,_0x170504){PluginEvents[_0x5029('0x3')](_0x36335d+':'+_0x157a4f['id'],_0x157a4f);PluginEvents[_0x5029('0x3')](_0x36335d,_0x157a4f);_0x170504(null);};}for(var e in events){if(events[_0x5029('0x4')](e)){var event=events[e];Plugin[_0x5029('0x5')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 5dbc82c..2774ef5 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 _0x7f4b=['Plugin','plugins','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x353ad8,_0x19766d){var _0x1aed7d=function(_0x592d77){while(--_0x592d77){_0x353ad8['push'](_0x353ad8['shift']());}};_0x1aed7d(++_0x19766d);}(_0x7f4b,0x154));var _0xb7f4=function(_0x42c6f1,_0x338d7b){_0x42c6f1=_0x42c6f1-0x0;var _0x3c7398=_0x7f4b[_0x42c6f1];return _0x3c7398;};'use strict';var _=require('lodash');var util=require(_0xb7f4('0x0'));var logger=require(_0xb7f4('0x1'))(_0xb7f4('0x2'));var moment=require(_0xb7f4('0x3'));var BPromise=require(_0xb7f4('0x4'));var rp=require(_0xb7f4('0x5'));var fs=require('fs');var path=require(_0xb7f4('0x6'));var rimraf=require(_0xb7f4('0x7'));var config=require(_0xb7f4('0x8'));var attributes=require(_0xb7f4('0x9'));module[_0xb7f4('0xa')]=function(_0x11f512,_0x100b0e){return _0x11f512['define'](_0xb7f4('0xb'),attributes,{'tableName':_0xb7f4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x485e=['../../config/environment','./plugin.attributes','exports','plugins','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xf9f3cd,_0x41adfe){var _0x6f6a37=function(_0x55e9a2){while(--_0x55e9a2){_0xf9f3cd['push'](_0xf9f3cd['shift']());}};_0x6f6a37(++_0x41adfe);}(_0x485e,0x1f3));var _0xe485=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x485e[_0x411add];return _0x238242;};'use strict';var _=require(_0xe485('0x0'));var util=require(_0xe485('0x1'));var logger=require('../../config/logger')(_0xe485('0x2'));var moment=require(_0xe485('0x3'));var BPromise=require(_0xe485('0x4'));var rp=require(_0xe485('0x5'));var fs=require('fs');var path=require(_0xe485('0x6'));var rimraf=require('rimraf');var config=require(_0xe485('0x7'));var attributes=require(_0xe485('0x8'));module[_0xe485('0x9')]=function(_0x2bf466,_0x249f9e){return _0x2bf466['define']('Plugin',attributes,{'tableName':_0xe485('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 0fdac09..12e5e05 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 _0x9f7b=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./plugin.socket','request','then','info','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','debug','lodash','moment','bluebird','ioredis'];(function(_0x5db5e4,_0x3d990f){var _0x3e8ae0=function(_0x27876b){while(--_0x27876b){_0x5db5e4['push'](_0x5db5e4['shift']());}};_0x3e8ae0(++_0x3d990f);}(_0x9f7b,0x12e));var _0xb9f7=function(_0x1ef6aa,_0x350db0){_0x1ef6aa=_0x1ef6aa-0x0;var _0x27488d=_0x9f7b[_0x1ef6aa];return _0x27488d;};'use strict';var _=require(_0xb9f7('0x0'));var util=require('util');var moment=require(_0xb9f7('0x1'));var BPromise=require(_0xb9f7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9f7('0x3'));var db=require(_0xb9f7('0x4'))['db'];var utils=require(_0xb9f7('0x5'));var logger=require(_0xb9f7('0x6'))(_0xb9f7('0x7'));var config=require('../../config/environment');var jayson=require(_0xb9f7('0x8'));var client=jayson[_0xb9f7('0x9')][_0xb9f7('0xa')]({'port':0x232a});config[_0xb9f7('0xb')]=_['defaults'](config[_0xb9f7('0xb')],{'host':_0xb9f7('0xc'),'port':0x18eb});var socket=require(_0xb9f7('0xd'))(new Redis(config['redis']));require(_0xb9f7('0xe'))['register'](socket);function respondWithRpcPromise(_0x3d662a,_0x2e86fc,_0x31ac9d){return new BPromise(function(_0x1a0dc0,_0x3d1800){return client[_0xb9f7('0xf')](_0x3d662a,_0x31ac9d)[_0xb9f7('0x10')](function(_0x591429){logger[_0xb9f7('0x11')]('Plugin,\x20%s,\x20%s',_0x2e86fc,_0xb9f7('0x12'));logger['debug'](_0xb9f7('0x13'),_0x2e86fc,_0xb9f7('0x12'),JSON[_0xb9f7('0x14')](_0x591429));if(_0x591429[_0xb9f7('0x15')]){if(_0x591429[_0xb9f7('0x15')][_0xb9f7('0x16')]===0x1f4){logger[_0xb9f7('0x15')](_0xb9f7('0x17'),_0x2e86fc,_0x591429[_0xb9f7('0x15')]['message']);return _0x3d1800(_0x591429[_0xb9f7('0x15')][_0xb9f7('0x18')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x2e86fc,_0x591429['error'][_0xb9f7('0x18')]);return _0x1a0dc0(_0x591429[_0xb9f7('0x15')]['message']);}else{logger['info'](_0xb9f7('0x17'),_0x2e86fc,_0xb9f7('0x12'));_0x1a0dc0(_0x591429[_0xb9f7('0x19')][_0xb9f7('0x18')]);}})[_0xb9f7('0x1a')](function(_0x2d2475){logger[_0xb9f7('0x15')](_0xb9f7('0x17'),_0x2e86fc,_0x2d2475);_0x3d1800(_0x2d2475);});});}exports[_0xb9f7('0x1b')]=function(_0x5d8e12){var _0x1ff3a2=this;return new Promise(function(_0x3a799e,_0x8d446f){return db[_0xb9f7('0x1c')][_0xb9f7('0x1d')](_0x5d8e12[_0xb9f7('0x1e')],{'raw':_0x5d8e12[_0xb9f7('0x1f')]?_0x5d8e12[_0xb9f7('0x1f')][_0xb9f7('0x20')]===undefined?!![]:![]:!![]})[_0xb9f7('0x10')](function(_0x207453){logger['info'](_0xb9f7('0x1b'),_0x5d8e12);logger[_0xb9f7('0x21')](_0xb9f7('0x1b'),_0x5d8e12,JSON[_0xb9f7('0x14')](_0x207453));_0x3a799e(_0x207453);})['catch'](function(_0x2585bb){logger['error'](_0xb9f7('0x1b'),_0x2585bb[_0xb9f7('0x18')],_0x5d8e12);_0x8d446f(_0x1ff3a2[_0xb9f7('0x15')](0x1f4,_0x2585bb[_0xb9f7('0x18')]));});});}; \ No newline at end of file +var _0xebda=['http','redis','localhost','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','create','body','options','raw','CreatePlugin','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x490726,_0x4728a6){var _0x55d52e=function(_0x451e19){while(--_0x451e19){_0x490726['push'](_0x490726['shift']());}};_0x55d52e(++_0x4728a6);}(_0xebda,0xa9));var _0xaebd=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xebda[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require(_0xaebd('0x0'));var moment=require(_0xaebd('0x1'));var BPromise=require(_0xaebd('0x2'));var rs=require(_0xaebd('0x3'));var fs=require('fs');var Redis=require(_0xaebd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaebd('0x5'));var logger=require(_0xaebd('0x6'))(_0xaebd('0x7'));var config=require(_0xaebd('0x8'));var jayson=require(_0xaebd('0x9'));var client=jayson[_0xaebd('0xa')][_0xaebd('0xb')]({'port':0x232a});config[_0xaebd('0xc')]=_['defaults'](config[_0xaebd('0xc')],{'host':_0xaebd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaebd('0xc')]));require(_0xaebd('0xe'))['register'](socket);function respondWithRpcPromise(_0x25e7e7,_0x3ccb52,_0x15902d){return new BPromise(function(_0x31c3db,_0x414f7f){return client[_0xaebd('0xf')](_0x25e7e7,_0x15902d)[_0xaebd('0x10')](function(_0x2dba91){logger[_0xaebd('0x11')](_0xaebd('0x12'),_0x3ccb52,_0xaebd('0x13'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x3ccb52,_0xaebd('0x13'),JSON[_0xaebd('0x14')](_0x2dba91));if(_0x2dba91[_0xaebd('0x15')]){if(_0x2dba91[_0xaebd('0x15')][_0xaebd('0x16')]===0x1f4){logger[_0xaebd('0x15')](_0xaebd('0x12'),_0x3ccb52,_0x2dba91[_0xaebd('0x15')][_0xaebd('0x17')]);return _0x414f7f(_0x2dba91[_0xaebd('0x15')]['message']);}logger[_0xaebd('0x15')](_0xaebd('0x12'),_0x3ccb52,_0x2dba91[_0xaebd('0x15')][_0xaebd('0x17')]);return _0x31c3db(_0x2dba91['error'][_0xaebd('0x17')]);}else{logger['info'](_0xaebd('0x12'),_0x3ccb52,_0xaebd('0x13'));_0x31c3db(_0x2dba91['result'][_0xaebd('0x17')]);}})[_0xaebd('0x18')](function(_0x539f1e){logger['error']('Plugin,\x20%s,\x20%s',_0x3ccb52,_0x539f1e);_0x414f7f(_0x539f1e);});});}exports['CreatePlugin']=function(_0x579ac3){var _0x33df65=this;return new Promise(function(_0x210453,_0x202319){return db['Plugin'][_0xaebd('0x19')](_0x579ac3[_0xaebd('0x1a')],{'raw':_0x579ac3[_0xaebd('0x1b')]?_0x579ac3['options'][_0xaebd('0x1c')]===undefined?!![]:![]:!![]})[_0xaebd('0x10')](function(_0x43baeb){logger[_0xaebd('0x11')](_0xaebd('0x1d'),_0x579ac3);logger['debug'](_0xaebd('0x1d'),_0x579ac3,JSON['stringify'](_0x43baeb));_0x210453(_0x43baeb);})[_0xaebd('0x18')](function(_0x59289a){logger[_0xaebd('0x15')](_0xaebd('0x1d'),_0x59289a[_0xaebd('0x17')],_0x579ac3);_0x202319(_0x33df65['error'](0x1f4,_0x59289a['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 32424d6..2d0ba95 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 _0x1ac4=['./plugin.events','save','update','emit','removeListener','register','plugin:'];(function(_0x1f3a33,_0x4234e2){var _0x3ce1db=function(_0x599f2b){while(--_0x599f2b){_0x1f3a33['push'](_0x1f3a33['shift']());}};_0x3ce1db(++_0x4234e2);}(_0x1ac4,0x11f));var _0x41ac=function(_0x49c445,_0x350b54){_0x49c445=_0x49c445-0x0;var _0x118bb4=_0x1ac4[_0x49c445];return _0x118bb4;};'use strict';var PluginEvents=require(_0x41ac('0x0'));var events=[_0x41ac('0x1'),'remove',_0x41ac('0x2')];function createListener(_0xd1738a,_0x147d13){return function(_0x163bac){_0x147d13[_0x41ac('0x3')](_0xd1738a,_0x163bac);};}function removeListener(_0xab79c9,_0x499a53){return function(){PluginEvents[_0x41ac('0x4')](_0xab79c9,_0x499a53);};}exports[_0x41ac('0x5')]=function(_0x4b34b8){for(var _0x5c2d88=0x0,_0x5e4c7a=events['length'];_0x5c2d88<_0x5e4c7a;_0x5c2d88++){var _0x1a4073=events[_0x5c2d88];var _0xc1b4f8=createListener(_0x41ac('0x6')+_0x1a4073,_0x4b34b8);PluginEvents['on'](_0x1a4073,_0xc1b4f8);}}; \ No newline at end of file +var _0x442e=['register','length','save','remove','update'];(function(_0x5cc8a6,_0x4b0dab){var _0x46857f=function(_0x25f9ca){while(--_0x25f9ca){_0x5cc8a6['push'](_0x5cc8a6['shift']());}};_0x46857f(++_0x4b0dab);}(_0x442e,0x179));var _0xe442=function(_0x52b142,_0x34122b){_0x52b142=_0x52b142-0x0;var _0x3958fe=_0x442e[_0x52b142];return _0x3958fe;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xe442('0x0'),_0xe442('0x1'),_0xe442('0x2')];function createListener(_0x2b809e,_0x5ae1e9){return function(_0x10b627){_0x5ae1e9['emit'](_0x2b809e,_0x10b627);};}function removeListener(_0x417dcd,_0x970d93){return function(){PluginEvents['removeListener'](_0x417dcd,_0x970d93);};}exports[_0xe442('0x3')]=function(_0x1ca937){for(var _0x4f5383=0x0,_0x2a2bc9=events[_0xe442('0x4')];_0x4f5383<_0x2a2bc9;_0x4f5383++){var _0x309dae=events[_0x4f5383];var _0x4cf870=createListener('plugin:'+_0x309dae,_0x1ca937);PluginEvents['on'](_0x309dae,_0x4cf870);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 43b8bc4..7081291 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(_0x44451e,_0x3e0201){var _0x2a4582=function(_0x57dac9){while(--_0x57dac9){_0x44451e['push'](_0x44451e['shift']());}};_0x2a4582(++_0x3e0201);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x2bb174,_0x4e70a3){var _0x2f584a=function(_0x34f32c){while(--_0x34f32c){_0x2bb174['push'](_0x2bb174['shift']());}};_0x2f584a(++_0x4e70a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 daaef76..8cd946c 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 _0x6c76=['status','npm\x20install','info','error','index','list','then','reject','motion2','length','catch','params','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','send','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','sendStatus','stack','name'];(function(_0x1c6fda,_0xaf122e){var _0x4d0e83=function(_0xe8b308){while(--_0xe8b308){_0x1c6fda['push'](_0x1c6fda['shift']());}};_0x4d0e83(++_0xaf122e);}(_0x6c76,0x184));var _0x66c7=function(_0x219aef,_0x46555b){_0x219aef=_0x219aef-0x0;var _0x4405dd=_0x6c76[_0x219aef];return _0x4405dd;};'use strict';var _=require(_0x66c7('0x0'));var pm2=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var path=require(_0x66c7('0x3'));var exec=require(_0x66c7('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x2f6db7,_0x2b7cf3){return function(_0x49d437){if(!_0x49d437){_0x2f6db7[_0x66c7('0x5')](0x194);;}return _0x49d437;};}function respondWithResult(_0x45b0a5,_0x52f71b){_0x52f71b=_0x52f71b||0xc8;return function(_0x23408c){if(_0x23408c){return _0x45b0a5['status'](_0x52f71b)['json'](_0x23408c);}return null;};}function handleError(_0x208d06,_0x2b0065){_0x2b0065=_0x2b0065||0x1f4;return function(_0x24349f){logger['error'](_0x24349f[_0x66c7('0x6')]);if(_0x24349f[_0x66c7('0x7')]){delete _0x24349f[_0x66c7('0x7')];}_0x208d06[_0x66c7('0x8')](_0x2b0065)['send'](_0x24349f);};}function execChildProcess(){return new BPromise(function(_0x464085,_0x45db57){exec(_0x66c7('0x9'),function(_0x187e00,_0x21fb64,_0x406e41){logger[_0x66c7('0xa')](_0x21fb64);logger['info'](_0x406e41);if(_0x187e00){logger[_0x66c7('0xb')](_0x187e00);return _0x45db57(_0x187e00);}return _0x464085(_0x21fb64);});});}exports[_0x66c7('0xc')]=function(_0x35cbc2,_0xea3f56){return pm2[_0x66c7('0xd')]()[_0x66c7('0xe')](function(_0x618bd7){if(_0x618bd7){var _0xf3b04=_[_0x66c7('0xf')](_0x618bd7,function(_0x5d44e1){return _0x5d44e1[_0x66c7('0x7')]==='express'||_0x5d44e1[_0x66c7('0x7')]===_0x66c7('0x10');});return{'rows':_0xf3b04,'count':_0xf3b04[_0x66c7('0x11')]};}return null;})[_0x66c7('0xe')](respondWithResult(_0xea3f56,null))[_0x66c7('0x12')](handleError(_0xea3f56,null));};exports['show']=function(_0x5cf913,_0x53fb36){return pm2['describe'](_0x5cf913[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](respondWithResult(_0x53fb36,null))['then'](handleEntityNotFound(_0x53fb36,null))['catch'](handleError(_0x53fb36,null));};exports[_0x66c7('0x14')]=function(_0x9b65cf,_0x4756f7){if(_0x9b65cf[_0x66c7('0x15')]['name']&&_0x9b65cf['body'][_0x66c7('0x16')]){var _0x237177=path[_0x66c7('0x17')](__dirname,_0x66c7('0x18'),_0x9b65cf[_0x66c7('0x15')][_0x66c7('0x16')]);var _0x4804cf=process[_0x66c7('0x19')]();process[_0x66c7('0x1a')](path['dirname'](_0x237177));return execChildProcess()[_0x66c7('0xe')](function(_0x8b96b1){process[_0x66c7('0x1a')](_0x4804cf);return pm2[_0x66c7('0x1b')]({'name':_0x9b65cf['body'][_0x66c7('0x7')],'script':_0x237177});})[_0x66c7('0xe')](function(_0x5b28e6){pm2[_0x66c7('0x1c')]();return _0x5b28e6[0x0];})[_0x66c7('0xe')](respondWithResult(_0x4756f7,0xc9))[_0x66c7('0x12')](handleError(_0x4756f7,null));}else{return _0x4756f7[_0x66c7('0x8')](0x1f4)[_0x66c7('0x1d')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x4e514a,_0x2dd131){if(_0x4e514a[_0x66c7('0x15')]['id']){delete _0x4e514a['body']['id'];}var _0x9afd50={'online':_0x66c7('0x1e'),'stopped':_0x66c7('0x1f')};if(_0x9afd50[_0x66c7('0x20')](_0x4e514a[_0x66c7('0x15')][_0x66c7('0x8')])){return pm2[_0x9afd50[_0x4e514a['body'][_0x66c7('0x8')]]](_0x4e514a[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](respondWithResult(_0x2dd131,0xc8))[_0x66c7('0x12')](handleError(_0x2dd131,null));}else{return _0x2dd131[_0x66c7('0x8')](0x1f4)['send']({'message':_0x66c7('0x21')});}};exports['destroy']=function(_0xfbd97,_0x543fbf){if(_0xfbd97[_0x66c7('0x15')]['id']){delete _0xfbd97[_0x66c7('0x15')]['id'];}if(_0xfbd97[_0x66c7('0x13')]['id']){return pm2[_0x66c7('0x22')](_0xfbd97[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](function(_0x559ab9){pm2['dump']();return _0x559ab9[0x0];})[_0x66c7('0xe')](respondWithResult(_0x543fbf,null))[_0x66c7('0x12')](handleError(_0x543fbf,null));}else{return _0x543fbf[_0x66c7('0x8')](0x1f4)[_0x66c7('0x1d')]({'message':_0x66c7('0x23')});}}; \ No newline at end of file +var _0x44a3=['hasOwnProperty','params','Unknown\x20status','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','error','stack','name','status','send','info','index','list','then','reject','express','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop'];(function(_0x7dae0c,_0xeb5dfe){var _0xb84008=function(_0x28499c){while(--_0x28499c){_0x7dae0c['push'](_0x7dae0c['shift']());}};_0xb84008(++_0xeb5dfe);}(_0x44a3,0x1a9));var _0x344a=function(_0x3ce937,_0x568d7d){_0x3ce937=_0x3ce937-0x0;var _0x41d2fa=_0x44a3[_0x3ce937];return _0x41d2fa;};'use strict';var _=require(_0x344a('0x0'));var pm2=require(_0x344a('0x1'));var logger=require(_0x344a('0x2'))(_0x344a('0x3'));var path=require(_0x344a('0x4'));var exec=require(_0x344a('0x5'))[_0x344a('0x6')];var BPromise=require(_0x344a('0x7'));function handleEntityNotFound(_0x528a13,_0x23004c){return function(_0x1bc716){if(!_0x1bc716){_0x528a13[_0x344a('0x8')](0x194);;}return _0x1bc716;};}function respondWithResult(_0x28b51e,_0x39984a){_0x39984a=_0x39984a||0xc8;return function(_0x504bd1){if(_0x504bd1){return _0x28b51e['status'](_0x39984a)['json'](_0x504bd1);}return null;};}function handleError(_0x484661,_0x475dab){_0x475dab=_0x475dab||0x1f4;return function(_0x2f9486){logger[_0x344a('0x9')](_0x2f9486[_0x344a('0xa')]);if(_0x2f9486[_0x344a('0xb')]){delete _0x2f9486['name'];}_0x484661[_0x344a('0xc')](_0x475dab)[_0x344a('0xd')](_0x2f9486);};}function execChildProcess(){return new BPromise(function(_0x559406,_0x2734ec){exec('npm\x20install',function(_0x397476,_0x5e6c98,_0xd53a4f){logger[_0x344a('0xe')](_0x5e6c98);logger['info'](_0xd53a4f);if(_0x397476){logger['error'](_0x397476);return _0x2734ec(_0x397476);}return _0x559406(_0x5e6c98);});});}exports[_0x344a('0xf')]=function(_0x2ad7eb,_0x3a974e){return pm2[_0x344a('0x10')]()[_0x344a('0x11')](function(_0x133ad4){if(_0x133ad4){var _0x4ee562=_[_0x344a('0x12')](_0x133ad4,function(_0x2360e9){return _0x2360e9[_0x344a('0xb')]===_0x344a('0x13')||_0x2360e9['name']==='motion2';});return{'rows':_0x4ee562,'count':_0x4ee562[_0x344a('0x14')]};}return null;})[_0x344a('0x11')](respondWithResult(_0x3a974e,null))[_0x344a('0x15')](handleError(_0x3a974e,null));};exports[_0x344a('0x16')]=function(_0x48b3ab,_0x397de6){return pm2[_0x344a('0x17')](_0x48b3ab['params']['id'])[_0x344a('0x11')](respondWithResult(_0x397de6,null))[_0x344a('0x11')](handleEntityNotFound(_0x397de6,null))[_0x344a('0x15')](handleError(_0x397de6,null));};exports[_0x344a('0x18')]=function(_0x13b382,_0x43fa0f){if(_0x13b382[_0x344a('0x19')][_0x344a('0xb')]&&_0x13b382[_0x344a('0x19')][_0x344a('0x1a')]){var _0x4b3552=path[_0x344a('0x1b')](__dirname,_0x344a('0x1c'),_0x13b382[_0x344a('0x19')][_0x344a('0x1a')]);var _0x240be3=process[_0x344a('0x1d')]();process[_0x344a('0x1e')](path[_0x344a('0x1f')](_0x4b3552));return execChildProcess()[_0x344a('0x11')](function(_0x27f527){process[_0x344a('0x1e')](_0x240be3);return pm2[_0x344a('0x20')]({'name':_0x13b382[_0x344a('0x19')][_0x344a('0xb')],'script':_0x4b3552});})['then'](function(_0x6ccfba){pm2['dump']();return _0x6ccfba[0x0];})[_0x344a('0x11')](respondWithResult(_0x43fa0f,0xc9))['catch'](handleError(_0x43fa0f,null));}else{return _0x43fa0f[_0x344a('0xc')](0x1f4)[_0x344a('0xd')]({'message':_0x344a('0x21')});}};exports[_0x344a('0x22')]=function(_0x26f059,_0x28749b){if(_0x26f059[_0x344a('0x19')]['id']){delete _0x26f059[_0x344a('0x19')]['id'];}var _0x4f2499={'online':_0x344a('0x23'),'stopped':_0x344a('0x24')};if(_0x4f2499[_0x344a('0x25')](_0x26f059[_0x344a('0x19')][_0x344a('0xc')])){return pm2[_0x4f2499[_0x26f059[_0x344a('0x19')]['status']]](_0x26f059[_0x344a('0x26')]['id'])['then'](respondWithResult(_0x28749b,0xc8))['catch'](handleError(_0x28749b,null));}else{return _0x28749b[_0x344a('0xc')](0x1f4)[_0x344a('0xd')]({'message':_0x344a('0x27')});}};exports['destroy']=function(_0x5cd9c6,_0x5cafd2){if(_0x5cd9c6[_0x344a('0x19')]['id']){delete _0x5cd9c6[_0x344a('0x19')]['id'];}if(_0x5cd9c6[_0x344a('0x26')]['id']){return pm2['delete'](_0x5cd9c6[_0x344a('0x26')]['id'])[_0x344a('0x11')](function(_0x71f3ec){pm2[_0x344a('0x28')]();return _0x71f3ec[0x0];})[_0x344a('0x11')](respondWithResult(_0x5cafd2,null))[_0x344a('0x15')](handleError(_0x5cafd2,null));}else{return _0x5cafd2[_0x344a('0xc')](0x1f4)['send']({'message':_0x344a('0x29')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 082af96..a9a573c 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 _0x134d=['Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','exports','express'];(function(_0x2b6677,_0x1dab11){var _0x56ca1a=function(_0x2c8f44){while(--_0x2c8f44){_0x2b6677['push'](_0x2b6677['shift']());}};_0x56ca1a(++_0x1dab11);}(_0x134d,0x95));var _0xd134=function(_0x3aa0c9,_0x7c73bb){_0x3aa0c9=_0x3aa0c9-0x0;var _0x1207ec=_0x134d[_0x3aa0c9];return _0x1207ec;};'use strict';var express=require(_0xd134('0x0'));var router=express[_0xd134('0x1')]();var auth=require(_0xd134('0x2'));var controller=require(_0xd134('0x3'));router[_0xd134('0x4')](_0xd134('0x5'),auth[_0xd134('0x6')](),controller[_0xd134('0x7')]);router[_0xd134('0x4')](_0xd134('0x8'),auth[_0xd134('0x6')](),controller['getQueues']);module[_0xd134('0x9')]=router; \ No newline at end of file +var _0x5c7b=['./realtime.controller','get','isAuthenticated','getAgents','/queues','getQueues','exports','express','../../components/auth/service'];(function(_0x5220fc,_0x5dbbfb){var _0x2f50c0=function(_0x4e457e){while(--_0x4e457e){_0x5220fc['push'](_0x5220fc['shift']());}};_0x2f50c0(++_0x5dbbfb);}(_0x5c7b,0xcd));var _0xb5c7=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x5c7b[_0x2dadb9];return _0x2f0097;};'use strict';var express=require(_0xb5c7('0x0'));var router=express['Router']();var auth=require(_0xb5c7('0x1'));var controller=require(_0xb5c7('0x2'));router[_0xb5c7('0x3')]('/agents',auth[_0xb5c7('0x4')](),controller[_0xb5c7('0x5')]);router[_0xb5c7('0x3')](_0xb5c7('0x6'),auth[_0xb5c7('0x4')](),controller[_0xb5c7('0x7')]);module[_0xb5c7('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 212bf5d..80bb0d0 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 _0x54ad=['pause','*pause','resolve','then','query','isValidChannel','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','includes','sort','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','rawAttributes','fieldName','type','key','role','agent','online','getOptions','raw','push','literal','FIELD(id,','forEach','Pause','where','merge','user','extraQueryConditions','assign','UserProfile','count','map','find','globalStatus','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','toLowerCase','startCase','Queue','name','voice','outbound','dialActive','userProfileId','QueueCampaigns','filter','getResources','findAndCountAll','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','status','set','Content-Range','json','getAgents','getChannels','globalQueueFilter','globalStatusFilter','pauseTypeFilter'];(function(_0x3a27ec,_0x57451f){var _0x4815ad=function(_0x4bae9a){while(--_0x4bae9a){_0x3a27ec['push'](_0x3a27ec['shift']());}};_0x4815ad(++_0x57451f);}(_0x54ad,0xf0));var _0xd54a=function(_0x5efe17,_0x4543bc){_0x5efe17=_0x5efe17-0x0;var _0x55694c=_0x54ad[_0x5efe17];return _0x55694c;};'use strict';var _=require(_0xd54a('0x0'));var util=require(_0xd54a('0x1'));var rta=require(_0xd54a('0x2'));var rtq=require(_0xd54a('0x3'));var qs=require(_0xd54a('0x4'));var utils=require(_0xd54a('0x5'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0xd54a('0x6'))[_0xd54a('0x7')];var APIHandleError=require(_0xd54a('0x6'))[_0xd54a('0x8')];function respondWithFilteredResult(_0xba2178,_0x1da8be){return function(_0xc5f599){if(_0xc5f599){var _0x3f4cc5=typeof _0x1da8be[_0xd54a('0x9')]===_0xd54a('0xa')&&typeof _0x1da8be[_0xd54a('0xb')]===_0xd54a('0xa');var _0x342ecd=_0xc5f599['count'];var _0x6766e0=_0x3f4cc5?0x0:_0x1da8be[_0xd54a('0x9')];var _0x2f8b83=_0x3f4cc5?_0xc5f599['count']:_0x1da8be[_0xd54a('0x9')]+_0x1da8be['limit'];var _0x411678;if(_0x2f8b83>=_0x342ecd){_0x2f8b83=_0x342ecd;_0x411678=0xc8;}else{_0x411678=0xce;}_0xba2178[_0xd54a('0xc')](_0x411678);return _0xba2178[_0xd54a('0xd')](_0xd54a('0xe'),_0x6766e0+'-'+_0x2f8b83+'/'+_0x342ecd)[_0xd54a('0xf')](_0xc5f599);}return null;};}exports[_0xd54a('0x10')]=function(_0x4f27c2,_0xe88c2a){var _0x24bf42={'count':0x0,'rows':[]};var _0x1f4fa0={};var _0x3f69ec;var _0x1156de=utils[_0xd54a('0x11')]();var _0x517a2b;var _0x29e5b4;var _0x333f23=_0x4f27c2['query'][_0xd54a('0x12')];var _0x377cb4=_0x4f27c2['query'][_0xd54a('0x13')];var _0x5054ad=_0x4f27c2['query'][_0xd54a('0x14')];var _0x135223=_0x377cb4===_0xd54a('0x15')||_0x377cb4===_0xd54a('0x16')?!![]:![];var _0x4b208a=[];var _0xde907d;var _0x5e4c08;Promise[_0xd54a('0x17')]()[_0xd54a('0x18')](function(){if(_0x4f27c2[_0xd54a('0x19')]['channel']){if(!utils[_0xd54a('0x1a')](_0x4f27c2[_0xd54a('0x19')][_0xd54a('0x1b')])){throw new APIBadRequestError(util[_0xd54a('0x1c')](_0xd54a('0x1d'),_0x4f27c2[_0xd54a('0x19')][_0xd54a('0x1b')]));}_0x3f69ec=_0x4f27c2[_0xd54a('0x19')][_0xd54a('0x1b')]['toLowerCase']();}if(!_0x4f27c2[_0xd54a('0x19')]['sort']||!_0x4f27c2['query']['sort'][_0xd54a('0x1e')]('globalStatus')){_0x4f27c2[_0xd54a('0x19')][_0xd54a('0x1f')]=rta['validateSortParameter'](_0x4f27c2[_0xd54a('0x19')][_0xd54a('0x1f')]);return;}var _0x167a85=rta[_0xd54a('0x20')](_0x4f27c2[_0xd54a('0x19')][_0xd54a('0x1f')]);_0x4f27c2[_0xd54a('0x19')][_0xd54a('0x1f')]=_0x167a85[_0xd54a('0x21')][_0xd54a('0x22')](',');_0xde907d=_0x167a85[_0xd54a('0x23')];})[_0xd54a('0x18')](function(){if(!_0x333f23){return[];}return rta[_0xd54a('0x24')](_0x333f23,_0x3f69ec);})[_0xd54a('0x18')](function(_0x28126c){_0x4b208a=_0x28126c;return rta[_0xd54a('0x25')]();})[_0xd54a('0x18')](function(_0x410f05){_0x29e5b4=_0x410f05[_0xd54a('0x26')];if((!_0x377cb4||_0x135223)&&!_0xde907d){return _0x4b208a;}if(_0xde907d&&!_0x377cb4){return rta[_0xd54a('0x27')](_0x29e5b4,_0x4b208a,_0xde907d);}else{return rta[_0xd54a('0x28')](_0x29e5b4,_0x4b208a,_0x377cb4);}})[_0xd54a('0x18')](function(_0x588a21){_0x4b208a=_0x588a21;var _0x5082dd=![];if(_0x4b208a[_0xd54a('0x29')]===0x0){if(_0x333f23||_0x377cb4){_0x5082dd=!![];}if(_0x135223){_0x5082dd=![];}}if(_0x5082dd){return _0x24bf42;}var _0x4975c4=_['map'](db[_0xd54a('0x2a')][_0xd54a('0x2b')],function(_0x38c0e5){return{'name':_0x38c0e5[_0xd54a('0x2c')],'type':_0x38c0e5[_0xd54a('0x2d')][_0xd54a('0x2e')]};});_0x4f27c2[_0xd54a('0x19')][_0xd54a('0x2f')]=_0xd54a('0x30');_0x4f27c2[_0xd54a('0x19')][_0xd54a('0x31')]=!![];_0x1f4fa0=qs[_0xd54a('0x32')](_0x4975c4,_0x4f27c2);_0x1f4fa0[_0xd54a('0x33')]=!![];var _0x1cdb1a=[];if(_0x4b208a[_0xd54a('0x29')]>0x0){_0x1cdb1a[_0xd54a('0x34')]({'id':{'$in':_0x4b208a}});if(_0xde907d&&!_0x377cb4){_0x5e4c08=[db['sequelize'][_0xd54a('0x35')](_0xd54a('0x36')+_0x4b208a+')')];_0x1f4fa0['order']=_0x5e4c08;}}if(_0x135223){_0x1156de[_0xd54a('0x37')](function(_0x3eceea){var _0x5d65d2=!![];if(_0x377cb4===_0xd54a('0x16')&&_0x3f69ec!==_0x3eceea){_0x5d65d2=![];}_0x1cdb1a[_0xd54a('0x34')]({[_0x3eceea+_0xd54a('0x38')]:_0x5d65d2});});if(_0x5054ad){_0x1cdb1a[_0xd54a('0x34')]({'pauseType':_0x5054ad});}}else if(_0x377cb4){_0x1156de[_0xd54a('0x37')](function(_0x2ee04e){_0x1cdb1a[_0xd54a('0x34')]({[_0x2ee04e+'Pause']:![]});});}_0x1f4fa0[_0xd54a('0x39')]=_[_0xd54a('0x3a')](_0x1f4fa0[_0xd54a('0x39')],{'$and':_0x1cdb1a});if(_0x4f27c2[_0xd54a('0x3b')][_0xd54a('0x2f')]===_0xd54a('0x3b')){var _0x12104b={'params':{'id':_0x4f27c2['user']['userProfileId']},'query':{'section':'Agents','role':'agent','online':!![],'raw':!![],'ids':_0x4b208a,'customSorting':_0x5e4c08}};if(_0x135223){_0x12104b[_0xd54a('0x19')][_0xd54a('0x3c')]=_0x1cdb1a;}_0x12104b[_0xd54a('0x19')]=Object[_0xd54a('0x3d')](_0x12104b[_0xd54a('0x19')],_0x4f27c2[_0xd54a('0x19')]);delete _0x12104b[_0xd54a('0x19')]['id'];return db[_0xd54a('0x3e')]['getResources'](_0x12104b);}return db[_0xd54a('0x2a')]['findAndCountAll'](_0x1f4fa0);})[_0xd54a('0x18')](function(_0x4c371f){_0x24bf42[_0xd54a('0x3f')]=_0x4c371f[_0xd54a('0x3f')];_0x517a2b=_0x4c371f['rows'];return _0x517a2b[_0xd54a('0x40')](function(_0x519679){var _0x3cfad6=_[_0xd54a('0x41')](_0x29e5b4,['id',_0x519679['id']]);if(_0x3cfad6){var _0x5a8c1e=rta['filterAgentAttributes'](_0x3cfad6);_['merge'](_0x519679,_0x5a8c1e);}_0x519679['globalStatus']=rta['getAgentStatus'](_0x519679);if(_0x519679[_0xd54a('0x42')]['includes']('pause')){_0x1156de[_0xd54a('0x37')](function(_0x297870){if(_0x519679[_0x297870+_0xd54a('0x38')]){if(_0x297870==='voice'){if(_0x519679[_0xd54a('0x43')]!=='talking'){_0x519679['voiceStatus']=_0xd54a('0x15');}}else{_0x519679[_0x297870+_0xd54a('0x44')]='pause';}}});}return _0x519679;});})[_0xd54a('0x18')](function(_0x20c00f){if(!_0xde907d||_0x5e4c08){return _0x20c00f;}return rta[_0xd54a('0x45')](_0x20c00f,_0xde907d);})[_0xd54a('0x18')](function(_0x197cc2){var _0x9ff0d2=null;if(_0x4f27c2[_0xd54a('0x19')][_0xd54a('0x21')]){var _0xe357f9=_0x4f27c2[_0xd54a('0x19')][_0xd54a('0x21')]['split'](',');_0x9ff0d2=_0x197cc2[_0xd54a('0x40')](function(_0x3b084c){return _[_0xd54a('0x46')](_0x3b084c,_0xe357f9);});}_0x24bf42[_0xd54a('0x26')]=_0x9ff0d2||_0x197cc2;return _0x24bf42;})[_0xd54a('0x18')](respondWithFilteredResult(_0xe88c2a,_0x1f4fa0))[_0xd54a('0x47')](APIHandleError(_0xe88c2a));};exports[_0xd54a('0x48')]=function(_0x488127,_0x1464f7){var _0x375421={'count':0x0,'rows':[]};var _0x3d98f7={};var _0x43bf28;var _0x4cd478;var _0x531dd8;Promise[_0xd54a('0x17')]()[_0xd54a('0x18')](function(){if(_0x488127['query'][_0xd54a('0x1b')]){if(!utils[_0xd54a('0x1a')](_0x488127['query']['channel'])){throw new APIBadRequestError(util[_0xd54a('0x1c')](_0xd54a('0x1d'),_0x488127[_0xd54a('0x19')][_0xd54a('0x1b')]));}_0x43bf28=_0x488127[_0xd54a('0x19')][_0xd54a('0x1b')][_0xd54a('0x49')]();}var _0x240be9=_[_0xd54a('0x4a')](_0x43bf28)+_0xd54a('0x4b');var _0x2bacd1=_[_0xd54a('0x40')](db[_0x240be9]['rawAttributes'],function(_0x3a046f){return{'name':_0x3a046f[_0xd54a('0x2c')],'type':_0x3a046f[_0xd54a('0x2d')][_0xd54a('0x2e')]};});if(!_0x488127[_0xd54a('0x19')]['fields']){var _0x1e92b0=['id',_0xd54a('0x4c')];if(_0x43bf28===_0xd54a('0x4d')){_0x1e92b0[_0xd54a('0x34')](_0xd54a('0x2d'));if(_0x488127[_0xd54a('0x19')][_0xd54a('0x2d')]===_0xd54a('0x4e')){_0x1e92b0[_0xd54a('0x34')]([_0xd54a('0x4f'),'dialMethod']);}}_0x488127['query']['fields']=_0x1e92b0[_0xd54a('0x22')](',');}_0x3d98f7=qs[_0xd54a('0x32')](_0x2bacd1,_0x488127);if(_0x488127[_0xd54a('0x3b')][_0xd54a('0x2f')]===_0xd54a('0x3b')){var _0x374bae={'params':{'id':_0x488127[_0xd54a('0x3b')][_0xd54a('0x50')]},'query':{'section':_0x43bf28==='voice'&&_0x488127[_0xd54a('0x19')]['type']===_0xd54a('0x4e')?_0xd54a('0x51'):_[_0xd54a('0x4a')](_0x43bf28)+'Queues','type':_0x488127['query'][_0xd54a('0x2d')],'nolimit':!![],'sort':_0xd54a('0x4c'),'filter':_0x488127[_0xd54a('0x19')][_0xd54a('0x52')]}};_0x374bae['query']=Object[_0xd54a('0x3d')](_0x374bae['query'],_0x488127[_0xd54a('0x19')]);delete _0x374bae['query']['id'];return db[_0xd54a('0x3e')][_0xd54a('0x53')](_0x374bae);}return db[_0x240be9][_0xd54a('0x54')](_0x3d98f7);})[_0xd54a('0x18')](function(_0x4b1288){_0x375421[_0xd54a('0x3f')]=_0x4b1288['count'];_0x4cd478=_0x4b1288[_0xd54a('0x26')];return rtq[_0xd54a('0x55')](_0x488127,_0x43bf28);})['then'](function(_0x2a76b4){_0x531dd8=_0x2a76b4[_0xd54a('0x26')];return rtq[_0xd54a('0x56')](_0x4cd478,_0x531dd8,_0x43bf28,_0x488127[_0xd54a('0x19')][_0xd54a('0x2d')]);})[_0xd54a('0x18')](function(_0x50eb74){_0x375421[_0xd54a('0x26')]=_0x50eb74;return _0x375421;})['then'](respondWithFilteredResult(_0x1464f7,_0x3d98f7))['catch'](APIHandleError(_0x1464f7));}; \ No newline at end of file +var _0x8d78=['FIELD(id,','Pause','forEach','merge','user','userProfileId','agent','extraQueryConditions','assign','getResources','find','filterAgentAttributes','getAgentStatus','pause','voice','talking','voiceStatus','Status','sortAgentsByStatus','split','catch','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','rawAttributes','fieldName','name','outbound','dialActive','dialMethod','Queues','UserProfile','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','Content-Range','json','getAgents','getChannels','query','pauseTypeFilter','resolve','then','isValidChannel','channel','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','length','map','User','type','key','role','getOptions','push','sequelize','literal'];(function(_0x4773d7,_0x223196){var _0x54f100=function(_0x597947){while(--_0x597947){_0x4773d7['push'](_0x4773d7['shift']());}};_0x54f100(++_0x223196);}(_0x8d78,0x1b1));var _0x88d7=function(_0x1d576a,_0x1664c2){_0x1d576a=_0x1d576a-0x0;var _0x32de5e=_0x8d78[_0x1d576a];return _0x32de5e;};'use strict';var _=require(_0x88d7('0x0'));var util=require(_0x88d7('0x1'));var rta=require(_0x88d7('0x2'));var rtq=require(_0x88d7('0x3'));var qs=require(_0x88d7('0x4'));var utils=require(_0x88d7('0x5'));var db=require(_0x88d7('0x6'))['db'];var APIBadRequestError=require(_0x88d7('0x7'))[_0x88d7('0x8')];var APIHandleError=require(_0x88d7('0x7'))[_0x88d7('0x9')];function respondWithFilteredResult(_0xc9034b,_0x513f21){return function(_0x47068c){if(_0x47068c){var _0x12a0c9=typeof _0x513f21[_0x88d7('0xa')]===_0x88d7('0xb')&&typeof _0x513f21[_0x88d7('0xc')]===_0x88d7('0xb');var _0x288a3c=_0x47068c[_0x88d7('0xd')];var _0x222f31=_0x12a0c9?0x0:_0x513f21[_0x88d7('0xa')];var _0x5df504=_0x12a0c9?_0x47068c[_0x88d7('0xd')]:_0x513f21[_0x88d7('0xa')]+_0x513f21[_0x88d7('0xc')];var _0x40e602;if(_0x5df504>=_0x288a3c){_0x5df504=_0x288a3c;_0x40e602=0xc8;}else{_0x40e602=0xce;}_0xc9034b[_0x88d7('0xe')](_0x40e602);return _0xc9034b['set'](_0x88d7('0xf'),_0x222f31+'-'+_0x5df504+'/'+_0x288a3c)[_0x88d7('0x10')](_0x47068c);}return null;};}exports[_0x88d7('0x11')]=function(_0x42513c,_0x10a79f){var _0xb10743={'count':0x0,'rows':[]};var _0x4db474={};var _0x55f427;var _0x4e26bb=utils[_0x88d7('0x12')]();var _0x5dd871;var _0xec9d49;var _0x4a9de8=_0x42513c[_0x88d7('0x13')]['globalQueueFilter'];var _0x4c564d=_0x42513c[_0x88d7('0x13')]['globalStatusFilter'];var _0x3014f3=_0x42513c['query'][_0x88d7('0x14')];var _0x3fb33f=_0x4c564d==='pause'||_0x4c564d==='*pause'?!![]:![];var _0x1fa1e0=[];var _0x5d5240;var _0x1d46cf;Promise[_0x88d7('0x15')]()[_0x88d7('0x16')](function(){if(_0x42513c[_0x88d7('0x13')]['channel']){if(!utils[_0x88d7('0x17')](_0x42513c[_0x88d7('0x13')][_0x88d7('0x18')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x42513c[_0x88d7('0x13')][_0x88d7('0x18')]));}_0x55f427=_0x42513c[_0x88d7('0x13')][_0x88d7('0x18')][_0x88d7('0x19')]();}if(!_0x42513c[_0x88d7('0x13')]['sort']||!_0x42513c['query'][_0x88d7('0x1a')][_0x88d7('0x1b')](_0x88d7('0x1c'))){_0x42513c['query'][_0x88d7('0x1a')]=rta[_0x88d7('0x1d')](_0x42513c[_0x88d7('0x13')][_0x88d7('0x1a')]);return;}var _0x2e19de=rta['getUpdatedSortOptions'](_0x42513c[_0x88d7('0x13')][_0x88d7('0x1a')]);_0x42513c[_0x88d7('0x13')][_0x88d7('0x1a')]=_0x2e19de[_0x88d7('0x1e')][_0x88d7('0x1f')](',');_0x5d5240=_0x2e19de[_0x88d7('0x20')];})[_0x88d7('0x16')](function(){if(!_0x4a9de8){return[];}return rta[_0x88d7('0x21')](_0x4a9de8,_0x55f427);})[_0x88d7('0x16')](function(_0x22283a){_0x1fa1e0=_0x22283a;return rta[_0x88d7('0x22')]();})['then'](function(_0x39cd5f){_0xec9d49=_0x39cd5f[_0x88d7('0x23')];if((!_0x4c564d||_0x3fb33f)&&!_0x5d5240){return _0x1fa1e0;}if(_0x5d5240&&!_0x4c564d){return rta['getSortedAgentsIdsByStatus'](_0xec9d49,_0x1fa1e0,_0x5d5240);}else{return rta[_0x88d7('0x24')](_0xec9d49,_0x1fa1e0,_0x4c564d);}})['then'](function(_0x4d0ed1){_0x1fa1e0=_0x4d0ed1;var _0x355132=![];if(_0x1fa1e0[_0x88d7('0x25')]===0x0){if(_0x4a9de8||_0x4c564d){_0x355132=!![];}if(_0x3fb33f){_0x355132=![];}}if(_0x355132){return _0xb10743;}var _0x4c1652=_[_0x88d7('0x26')](db[_0x88d7('0x27')]['rawAttributes'],function(_0x3ae900){return{'name':_0x3ae900['fieldName'],'type':_0x3ae900[_0x88d7('0x28')][_0x88d7('0x29')]};});_0x42513c[_0x88d7('0x13')][_0x88d7('0x2a')]='agent';_0x42513c[_0x88d7('0x13')]['online']=!![];_0x4db474=qs[_0x88d7('0x2b')](_0x4c1652,_0x42513c);_0x4db474['raw']=!![];var _0x5b4d19=[];if(_0x1fa1e0[_0x88d7('0x25')]>0x0){_0x5b4d19[_0x88d7('0x2c')]({'id':{'$in':_0x1fa1e0}});if(_0x5d5240&&!_0x4c564d){_0x1d46cf=[db[_0x88d7('0x2d')][_0x88d7('0x2e')](_0x88d7('0x2f')+_0x1fa1e0+')')];_0x4db474[_0x88d7('0x20')]=_0x1d46cf;}}if(_0x3fb33f){_0x4e26bb['forEach'](function(_0x1f1162){var _0x4de5eb=!![];if(_0x4c564d==='*pause'&&_0x55f427!==_0x1f1162){_0x4de5eb=![];}_0x5b4d19[_0x88d7('0x2c')]({[_0x1f1162+_0x88d7('0x30')]:_0x4de5eb});});if(_0x3014f3){_0x5b4d19[_0x88d7('0x2c')]({'pauseType':_0x3014f3});}}else if(_0x4c564d){_0x4e26bb[_0x88d7('0x31')](function(_0x1092bb){_0x5b4d19['push']({[_0x1092bb+_0x88d7('0x30')]:![]});});}_0x4db474['where']=_[_0x88d7('0x32')](_0x4db474['where'],{'$and':_0x5b4d19});if(_0x42513c[_0x88d7('0x33')]['role']===_0x88d7('0x33')){var _0x4cbc2a={'params':{'id':_0x42513c['user'][_0x88d7('0x34')]},'query':{'section':'Agents','role':_0x88d7('0x35'),'online':!![],'raw':!![],'ids':_0x1fa1e0,'customSorting':_0x1d46cf}};if(_0x3fb33f){_0x4cbc2a[_0x88d7('0x13')][_0x88d7('0x36')]=_0x5b4d19;}_0x4cbc2a[_0x88d7('0x13')]=Object[_0x88d7('0x37')](_0x4cbc2a['query'],_0x42513c['query']);delete _0x4cbc2a['query']['id'];return db['UserProfile'][_0x88d7('0x38')](_0x4cbc2a);}return db[_0x88d7('0x27')]['findAndCountAll'](_0x4db474);})[_0x88d7('0x16')](function(_0x1d0916){_0xb10743[_0x88d7('0xd')]=_0x1d0916[_0x88d7('0xd')];_0x5dd871=_0x1d0916[_0x88d7('0x23')];return _0x5dd871[_0x88d7('0x26')](function(_0x559a3d){var _0x14968d=_[_0x88d7('0x39')](_0xec9d49,['id',_0x559a3d['id']]);if(_0x14968d){var _0x1ebbb2=rta[_0x88d7('0x3a')](_0x14968d);_['merge'](_0x559a3d,_0x1ebbb2);}_0x559a3d[_0x88d7('0x1c')]=rta[_0x88d7('0x3b')](_0x559a3d);if(_0x559a3d['globalStatus']['includes'](_0x88d7('0x3c'))){_0x4e26bb[_0x88d7('0x31')](function(_0x3e7b8c){if(_0x559a3d[_0x3e7b8c+_0x88d7('0x30')]){if(_0x3e7b8c===_0x88d7('0x3d')){if(_0x559a3d['voiceStatus']!==_0x88d7('0x3e')){_0x559a3d[_0x88d7('0x3f')]=_0x88d7('0x3c');}}else{_0x559a3d[_0x3e7b8c+_0x88d7('0x40')]=_0x88d7('0x3c');}}});}return _0x559a3d;});})['then'](function(_0x34f850){if(!_0x5d5240||_0x1d46cf){return _0x34f850;}return rta[_0x88d7('0x41')](_0x34f850,_0x5d5240);})['then'](function(_0xc2e658){var _0x472db2=null;if(_0x42513c[_0x88d7('0x13')][_0x88d7('0x1e')]){var _0x3967ab=_0x42513c['query'][_0x88d7('0x1e')][_0x88d7('0x42')](',');_0x472db2=_0xc2e658[_0x88d7('0x26')](function(_0x46fc36){return _['pick'](_0x46fc36,_0x3967ab);});}_0xb10743[_0x88d7('0x23')]=_0x472db2||_0xc2e658;return _0xb10743;})[_0x88d7('0x16')](respondWithFilteredResult(_0x10a79f,_0x4db474))[_0x88d7('0x43')](APIHandleError(_0x10a79f));};exports['getQueues']=function(_0x5f685c,_0x1b6cbb){var _0x1f86fe={'count':0x0,'rows':[]};var _0x4d1ce5={};var _0xebb250;var _0x4d31cf;var _0x158234;Promise['resolve']()[_0x88d7('0x16')](function(){if(_0x5f685c[_0x88d7('0x13')][_0x88d7('0x18')]){if(!utils[_0x88d7('0x17')](_0x5f685c['query']['channel'])){throw new APIBadRequestError(util['format'](_0x88d7('0x44'),_0x5f685c[_0x88d7('0x13')]['channel']));}_0xebb250=_0x5f685c['query'][_0x88d7('0x18')][_0x88d7('0x19')]();}var _0x245b6f=_[_0x88d7('0x45')](_0xebb250)+'Queue';var _0x2f4981=_[_0x88d7('0x26')](db[_0x245b6f][_0x88d7('0x46')],function(_0x2decef){return{'name':_0x2decef[_0x88d7('0x47')],'type':_0x2decef['type'][_0x88d7('0x29')]};});if(!_0x5f685c[_0x88d7('0x13')][_0x88d7('0x1e')]){var _0x48701b=['id',_0x88d7('0x48')];if(_0xebb250===_0x88d7('0x3d')){_0x48701b['push'](_0x88d7('0x28'));if(_0x5f685c[_0x88d7('0x13')]['type']===_0x88d7('0x49')){_0x48701b[_0x88d7('0x2c')]([_0x88d7('0x4a'),_0x88d7('0x4b')]);}}_0x5f685c[_0x88d7('0x13')][_0x88d7('0x1e')]=_0x48701b[_0x88d7('0x1f')](',');}_0x4d1ce5=qs[_0x88d7('0x2b')](_0x2f4981,_0x5f685c);if(_0x5f685c[_0x88d7('0x33')][_0x88d7('0x2a')]===_0x88d7('0x33')){var _0x4a0cb1={'params':{'id':_0x5f685c[_0x88d7('0x33')][_0x88d7('0x34')]},'query':{'section':_0xebb250===_0x88d7('0x3d')&&_0x5f685c[_0x88d7('0x13')][_0x88d7('0x28')]===_0x88d7('0x49')?'QueueCampaigns':_[_0x88d7('0x45')](_0xebb250)+_0x88d7('0x4c'),'type':_0x5f685c[_0x88d7('0x13')][_0x88d7('0x28')],'nolimit':!![],'sort':_0x88d7('0x48'),'filter':_0x5f685c[_0x88d7('0x13')]['filter']}};_0x4a0cb1[_0x88d7('0x13')]=Object[_0x88d7('0x37')](_0x4a0cb1[_0x88d7('0x13')],_0x5f685c[_0x88d7('0x13')]);delete _0x4a0cb1['query']['id'];return db[_0x88d7('0x4d')][_0x88d7('0x38')](_0x4a0cb1);}return db[_0x245b6f]['findAndCountAll'](_0x4d1ce5);})[_0x88d7('0x16')](function(_0x5753d9){_0x1f86fe[_0x88d7('0xd')]=_0x5753d9['count'];_0x4d31cf=_0x5753d9[_0x88d7('0x23')];return rtq[_0x88d7('0x4e')](_0x5f685c,_0xebb250);})['then'](function(_0x26589f){_0x158234=_0x26589f[_0x88d7('0x23')];return rtq[_0x88d7('0x4f')](_0x4d31cf,_0x158234,_0xebb250,_0x5f685c[_0x88d7('0x13')]['type']);})[_0x88d7('0x16')](function(_0x382e48){_0x1f86fe['rows']=_0x382e48;return _0x1f86fe;})[_0x88d7('0x16')](respondWithFilteredResult(_0x1b6cbb,_0x4d1ce5))[_0x88d7('0x43')](APIHandleError(_0x1b6cbb));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index bb5143b..2ec32b4 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x501ca1,_0x6c6edc){var _0x2a99c4=function(_0x542cad){while(--_0x542cad){_0x501ca1['push'](_0x501ca1['shift']());}};_0x2a99c4(++_0x6c6edc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x35bc1b,_0x42a8ac){var _0x529575=function(_0x527156){while(--_0x527156){_0x35bc1b['push'](_0x35bc1b['shift']());}};_0x529575(++_0x42a8ac);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0xcb91[_0x3f94f9];return _0x46f84f;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index c66d95f..54fa47f 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 _0x510e=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0xf62e6c,_0x160938){var _0x14234f=function(_0x16fe1d){while(--_0x16fe1d){_0xf62e6c['push'](_0xf62e6c['shift']());}};_0x14234f(++_0x160938);}(_0x510e,0x1ed));var _0xe510=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x510e[_0x382e89];return _0x3a1318;};'use strict';var Sequelize=require(_0xe510('0x0'));module[_0xe510('0x1')]={'state':{'type':Sequelize[_0xe510('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe510('0x3')]},'scheduledat':{'type':Sequelize[_0xe510('0x4')]},'uniqueid':{'type':Sequelize[_0xe510('0x3')]},'starttime':{'type':Sequelize[_0xe510('0x4')]},'responsetime':{'type':Sequelize[_0xe510('0x4')]},'ringtime':{'type':Sequelize[_0xe510('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xe510('0x3')]},'membername':{'type':Sequelize[_0xe510('0x3')]}}; \ No newline at end of file +var _0x8d0a=['DATE','sequelize','INTEGER','STRING'];(function(_0x466a32,_0x447404){var _0xcef13e=function(_0x3281dd){while(--_0x3281dd){_0x466a32['push'](_0x466a32['shift']());}};_0xcef13e(++_0x447404);}(_0x8d0a,0x65));var _0xa8d0=function(_0x96030e,_0x5db4f6){_0x96030e=_0x96030e-0x0;var _0x75aa5=_0x8d0a[_0x96030e];return _0x75aa5;};'use strict';var Sequelize=require(_0xa8d0('0x0'));module['exports']={'state':{'type':Sequelize[_0xa8d0('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa8d0('0x2')]},'scheduledat':{'type':Sequelize[_0xa8d0('0x3')]},'uniqueid':{'type':Sequelize[_0xa8d0('0x2')]},'starttime':{'type':Sequelize[_0xa8d0('0x3')]},'responsetime':{'type':Sequelize[_0xa8d0('0x3')]},'ringtime':{'type':Sequelize[_0xa8d0('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xa8d0('0x2')]},'campaigntype':{'type':Sequelize[_0xa8d0('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 62b1fea..013dfb2 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 _0xffcd=['path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x32cd25,_0x5abf21){var _0x423f41=function(_0x16072b){while(--_0x16072b){_0x32cd25['push'](_0x32cd25['shift']());}};_0x423f41(++_0x5abf21);}(_0xffcd,0x126));var _0xdffc=function(_0x595984,_0x30cb32){_0x595984=_0x595984-0x0;var _0x3b253f=_0xffcd[_0x595984];return _0x3b253f;};'use strict';var _=require(_0xdffc('0x0'));var util=require(_0xdffc('0x1'));var logger=require(_0xdffc('0x2'))(_0xdffc('0x3'));var moment=require(_0xdffc('0x4'));var BPromise=require('bluebird');var rp=require(_0xdffc('0x5'));var fs=require('fs');var path=require(_0xdffc('0x6'));var rimraf=require(_0xdffc('0x7'));var config=require(_0xdffc('0x8'));var attributes=require(_0xdffc('0x9'));module[_0xdffc('0xa')]=function(_0x300316,_0x3b0e74){return _0x300316[_0xdffc('0xb')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bec=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x3ed67f,_0x1e357e){var _0x3bcbf5=function(_0x3b933c){while(--_0x3b933c){_0x3ed67f['push'](_0x3ed67f['shift']());}};_0x3bcbf5(++_0x1e357e);}(_0x0bec,0x1cd));var _0xc0be=function(_0x343fa8,_0x3c263d){_0x343fa8=_0x343fa8-0x0;var _0x546f73=_0x0bec[_0x343fa8];return _0x546f73;};'use strict';var _=require(_0xc0be('0x0'));var util=require(_0xc0be('0x1'));var logger=require(_0xc0be('0x2'))(_0xc0be('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc0be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0be('0x5'));var config=require(_0xc0be('0x6'));var attributes=require(_0xc0be('0x7'));module[_0xc0be('0x8')]=function(_0x4e0e0c,_0x2a1b70){return _0x4e0e0c[_0xc0be('0x9')](_0xc0be('0xa'),attributes,{'tableName':_0xc0be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 6d27962..5113860 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 _0x5443=['code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','options','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x5443,0x120));var _0x3544=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5443[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x3544('0x0'));var util=require(_0x3544('0x1'));var moment=require(_0x3544('0x2'));var BPromise=require('bluebird');var rs=require(_0x3544('0x3'));var fs=require('fs');var Redis=require(_0x3544('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3544('0x5'));var logger=require(_0x3544('0x6'))(_0x3544('0x7'));var config=require('../../config/environment');var jayson=require(_0x3544('0x8'));var client=jayson[_0x3544('0x9')][_0x3544('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ca9c,_0x42615f,_0x483f79){return new BPromise(function(_0x2350f5,_0x17d2be){return client[_0x3544('0xb')](_0x1ca9c,_0x483f79)[_0x3544('0xc')](function(_0x256263){logger[_0x3544('0xd')](_0x3544('0xe'),_0x42615f,_0x3544('0xf'));logger[_0x3544('0x10')](_0x3544('0x11'),_0x42615f,_0x3544('0xf'),JSON[_0x3544('0x12')](_0x256263));if(_0x256263[_0x3544('0x13')]){if(_0x256263['error'][_0x3544('0x14')]===0x1f4){logger[_0x3544('0x13')](_0x3544('0xe'),_0x42615f,_0x256263[_0x3544('0x13')][_0x3544('0x15')]);return _0x17d2be(_0x256263[_0x3544('0x13')][_0x3544('0x15')]);}logger['error'](_0x3544('0xe'),_0x42615f,_0x256263[_0x3544('0x13')][_0x3544('0x15')]);return _0x2350f5(_0x256263[_0x3544('0x13')]['message']);}else{logger[_0x3544('0xd')](_0x3544('0xe'),_0x42615f,_0x3544('0xf'));_0x2350f5(_0x256263[_0x3544('0x16')][_0x3544('0x15')]);}})[_0x3544('0x17')](function(_0x1b40ea){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x42615f,_0x1b40ea);_0x17d2be(_0x1b40ea);});});}exports[_0x3544('0x18')]=function(_0x376579){var _0x5bf749=this;return new Promise(function(_0x199721,_0x48fc33){return db[_0x3544('0x19')]['create'](_0x376579['body'],{'raw':_0x376579['options']?_0x376579[_0x3544('0x1a')][_0x3544('0x1b')]===undefined?!![]:![]:!![]})[_0x3544('0xc')](function(_0x56b1b7){logger[_0x3544('0xd')](_0x3544('0x18'),_0x376579);logger['debug'](_0x3544('0x18'),_0x376579,JSON[_0x3544('0x12')](_0x56b1b7));_0x199721(_0x56b1b7);})['catch'](function(_0x1511e3){logger[_0x3544('0x13')](_0x3544('0x18'),_0x1511e3['message'],_0x376579);_0x48fc33(_0x5bf749['error'](0x1f4,_0x1511e3['message']));});});}; \ No newline at end of file +var _0x0721=['message','result','catch','create','body','CreateReportAgentPreview','lodash','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2bdbf6,_0x2c751d){var _0x16b2e0=function(_0x2a37fc){while(--_0x2a37fc){_0x2bdbf6['push'](_0x2bdbf6['shift']());}};_0x16b2e0(++_0x2c751d);}(_0x0721,0xbe));var _0x1072=function(_0x28089e,_0x530f8a){_0x28089e=_0x28089e-0x0;var _0x46a73c=_0x0721[_0x28089e];return _0x46a73c;};'use strict';var _=require(_0x1072('0x0'));var util=require('util');var moment=require(_0x1072('0x1'));var BPromise=require('bluebird');var rs=require(_0x1072('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1072('0x3'));var logger=require(_0x1072('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1072('0x5'));var client=jayson[_0x1072('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e859e,_0x2e5899,_0xe92288){return new BPromise(function(_0x535815,_0x2d6980){return client[_0x1072('0x7')](_0x2e859e,_0xe92288)[_0x1072('0x8')](function(_0x2136ce){logger[_0x1072('0x9')](_0x1072('0xa'),_0x2e5899,_0x1072('0xb'));logger[_0x1072('0xc')](_0x1072('0xd'),_0x2e5899,'request\x20sent',JSON[_0x1072('0xe')](_0x2136ce));if(_0x2136ce[_0x1072('0xf')]){if(_0x2136ce['error'][_0x1072('0x10')]===0x1f4){logger[_0x1072('0xf')](_0x1072('0xa'),_0x2e5899,_0x2136ce[_0x1072('0xf')][_0x1072('0x11')]);return _0x2d6980(_0x2136ce[_0x1072('0xf')][_0x1072('0x11')]);}logger['error'](_0x1072('0xa'),_0x2e5899,_0x2136ce[_0x1072('0xf')][_0x1072('0x11')]);return _0x535815(_0x2136ce['error'][_0x1072('0x11')]);}else{logger['info'](_0x1072('0xa'),_0x2e5899,'request\x20sent');_0x535815(_0x2136ce[_0x1072('0x12')][_0x1072('0x11')]);}})[_0x1072('0x13')](function(_0x546a74){logger[_0x1072('0xf')](_0x1072('0xa'),_0x2e5899,_0x546a74);_0x2d6980(_0x546a74);});});}exports['CreateReportAgentPreview']=function(_0x19e2d0){var _0x49574f=this;return new Promise(function(_0x393a29,_0x4b0277){return db['ReportAgentPreview'][_0x1072('0x14')](_0x19e2d0[_0x1072('0x15')],{'raw':_0x19e2d0['options']?_0x19e2d0['options']['raw']===undefined?!![]:![]:!![]})[_0x1072('0x8')](function(_0x912646){logger['info']('CreateReportAgentPreview',_0x19e2d0);logger[_0x1072('0xc')](_0x1072('0x16'),_0x19e2d0,JSON[_0x1072('0xe')](_0x912646));_0x393a29(_0x912646);})[_0x1072('0x13')](function(_0x387bae){logger[_0x1072('0xf')](_0x1072('0x16'),_0x387bae[_0x1072('0x11')],_0x19e2d0);_0x4b0277(_0x49574f[_0x1072('0xf')](0x1f4,_0x387bae[_0x1072('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 2645222..3031df4 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 _0x786e=['/voice/queues/preview/:id','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','../../components/auth/service','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','smsQueues','/whatsapp/queues','/fax/queues','faxQueues'];(function(_0x4dbba7,_0x34d6d1){var _0x43ef83=function(_0x27acf1){while(--_0x27acf1){_0x4dbba7['push'](_0x4dbba7['shift']());}};_0x43ef83(++_0x34d6d1);}(_0x786e,0x1bc));var _0xe786=function(_0x168478,_0x323a27){_0x168478=_0x168478-0x0;var _0x29c2f8=_0x786e[_0x168478];return _0x29c2f8;};'use strict';var multer=require(_0xe786('0x0'));var util=require(_0xe786('0x1'));var path=require('path');var express=require(_0xe786('0x2'));var router=express[_0xe786('0x3')]();var auth=require(_0xe786('0x4'));var controller=require('./rpc.controller');router[_0xe786('0x5')](_0xe786('0x6'),auth['isAuthenticated'](),controller[_0xe786('0x7')]);router[_0xe786('0x5')](_0xe786('0x8'),auth[_0xe786('0x9')](),controller[_0xe786('0xa')]);router[_0xe786('0x5')](_0xe786('0xb'),auth[_0xe786('0x9')](),controller[_0xe786('0xc')]);router[_0xe786('0x5')](_0xe786('0xd'),auth[_0xe786('0x9')](),controller[_0xe786('0xe')]);router[_0xe786('0x5')](_0xe786('0xf'),auth['isAuthenticated'](),controller[_0xe786('0x10')]);router[_0xe786('0x5')]('/mail/queues',auth['isAuthenticated'](),controller[_0xe786('0x11')]);router[_0xe786('0x5')](_0xe786('0x12'),auth[_0xe786('0x9')](),controller[_0xe786('0x13')]);router[_0xe786('0x5')]('/openchannel/queues',auth[_0xe786('0x9')](),controller['openchannelQueues']);router[_0xe786('0x5')]('/sms/queues',auth[_0xe786('0x9')](),controller[_0xe786('0x14')]);router[_0xe786('0x5')](_0xe786('0x15'),auth[_0xe786('0x9')](),controller['whatsappQueues']);router[_0xe786('0x5')](_0xe786('0x16'),auth[_0xe786('0x9')](),controller[_0xe786('0x17')]);router[_0xe786('0x5')](_0xe786('0x18'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0xe786('0x5')]('/voice/queues/channels',auth[_0xe786('0x9')](),controller[_0xe786('0x19')]);router[_0xe786('0x5')](_0xe786('0x1a'),auth[_0xe786('0x9')](),controller['voiceQueuesChannel']);router[_0xe786('0x5')](_0xe786('0x1b'),auth[_0xe786('0x9')](),controller[_0xe786('0x1c')]);router[_0xe786('0x5')](_0xe786('0x1d'),auth[_0xe786('0x9')](),controller[_0xe786('0x1e')]);router[_0xe786('0x5')](_0xe786('0x1f'),auth[_0xe786('0x9')](),controller['showVoiceQueues']);router['put'](_0xe786('0x1f'),auth[_0xe786('0x9')](),controller[_0xe786('0x20')]);router[_0xe786('0x5')](_0xe786('0x21'),auth[_0xe786('0x9')](),controller[_0xe786('0x22')]);router[_0xe786('0x5')]('/outbound/channels',auth[_0xe786('0x9')](),controller[_0xe786('0x23')]);router['get'](_0xe786('0x24'),auth['isAuthenticated'](),controller['agents']);router[_0xe786('0x25')](_0xe786('0x26'),auth[_0xe786('0x9')](),controller[_0xe786('0x27')]);router[_0xe786('0x5')](_0xe786('0x28'),auth[_0xe786('0x9')](),controller[_0xe786('0x29')]);router[_0xe786('0x5')](_0xe786('0x2a'),auth[_0xe786('0x9')](),controller['trunks']);router[_0xe786('0x5')](_0xe786('0x2b'),auth[_0xe786('0x9')](),controller['campaigns']);router[_0xe786('0x5')](_0xe786('0x2c'),auth[_0xe786('0x9')](),controller[_0xe786('0x2d')]);router[_0xe786('0x5')](_0xe786('0x2e'),auth[_0xe786('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0xe786('0x5')](_0xe786('0x2f'),auth[_0xe786('0x9')](),controller['mailQueuesWaitingInteractions']);router['get'](_0xe786('0x30'),auth[_0xe786('0x9')](),controller[_0xe786('0x31')]);router[_0xe786('0x5')](_0xe786('0x32'),auth[_0xe786('0x9')](),controller[_0xe786('0x33')]);router['get'](_0xe786('0x34'),auth[_0xe786('0x9')](),controller[_0xe786('0x35')]);router[_0xe786('0x5')](_0xe786('0x36'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0xe786('0x5')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xe786('0x37')]);router[_0xe786('0x38')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0xe786('0x39')](_0xe786('0x3a')));router[_0xe786('0x5')]('/mail/queues/:id',auth[_0xe786('0x9')](),controller[_0xe786('0x3b')]);router[_0xe786('0x38')](_0xe786('0x3c'),auth[_0xe786('0x9')](),controller[_0xe786('0x39')]('chat'));router[_0xe786('0x5')](_0xe786('0x3d'),auth['isAuthenticated'](),controller[_0xe786('0x3e')]);router[_0xe786('0x38')](_0xe786('0x3f'),auth[_0xe786('0x9')](),controller[_0xe786('0x39')](_0xe786('0x40')));router[_0xe786('0x5')](_0xe786('0x41'),auth[_0xe786('0x9')](),controller['showFaxQueues']);router[_0xe786('0x38')](_0xe786('0x42'),auth[_0xe786('0x9')](),controller[_0xe786('0x39')]('openchannel'));router['get'](_0xe786('0x43'),auth[_0xe786('0x9')](),controller['showOpenchannelQueues']);router[_0xe786('0x38')](_0xe786('0x44'),auth[_0xe786('0x9')](),controller[_0xe786('0x39')](_0xe786('0x45')));router[_0xe786('0x38')](_0xe786('0x46'),auth[_0xe786('0x9')](),controller[_0xe786('0x39')](_0xe786('0x47')));router['get'](_0xe786('0x48'),auth['isAuthenticated'](),controller[_0xe786('0x49')]);router[_0xe786('0x5')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0xe786('0x4a')]);router[_0xe786('0x38')](_0xe786('0x4b'),auth[_0xe786('0x9')](),controller[_0xe786('0x4c')]);module[_0xe786('0x4d')]=router; \ No newline at end of file +var _0x081f=['chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','multer','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','mail','/mail/queues/:id','showMailQueues','queueNotify'];(function(_0x136c26,_0x25b3e8){var _0x5f0a7a=function(_0x18ade0){while(--_0x18ade0){_0x136c26['push'](_0x136c26['shift']());}};_0x5f0a7a(++_0x25b3e8);}(_0x081f,0x14a));var _0xf081=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x081f[_0x3cb6dc];return _0x47ec89;};'use strict';var multer=require(_0xf081('0x0'));var util=require('util');var path=require('path');var express=require(_0xf081('0x1'));var router=express[_0xf081('0x2')]();var auth=require(_0xf081('0x3'));var controller=require(_0xf081('0x4'));router[_0xf081('0x5')]('/voice/channels',auth[_0xf081('0x6')](),controller[_0xf081('0x7')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0xf081('0x6')](),controller['voiceChannelMixMonitor']);router[_0xf081('0x5')](_0xf081('0x8'),auth[_0xf081('0x6')](),controller[_0xf081('0x9')]);router['get'](_0xf081('0xa'),auth[_0xf081('0x6')](),controller[_0xf081('0xb')]);router[_0xf081('0x5')](_0xf081('0xc'),auth[_0xf081('0x6')](),controller[_0xf081('0xd')]);router[_0xf081('0x5')](_0xf081('0xe'),auth['isAuthenticated'](),controller['mailQueues']);router[_0xf081('0x5')](_0xf081('0xf'),auth[_0xf081('0x6')](),controller[_0xf081('0x10')]);router[_0xf081('0x5')]('/openchannel/queues',auth[_0xf081('0x6')](),controller[_0xf081('0x11')]);router[_0xf081('0x5')](_0xf081('0x12'),auth[_0xf081('0x6')](),controller[_0xf081('0x13')]);router[_0xf081('0x5')](_0xf081('0x14'),auth[_0xf081('0x6')](),controller[_0xf081('0x15')]);router['get']('/fax/queues',auth[_0xf081('0x6')](),controller[_0xf081('0x16')]);router['get']('/voice/queues/preview/:id',auth[_0xf081('0x6')](),controller[_0xf081('0x17')]);router[_0xf081('0x5')]('/voice/queues/channels',auth[_0xf081('0x6')](),controller['voiceQueuesChannels']);router[_0xf081('0x5')](_0xf081('0x18'),auth['isAuthenticated'](),controller[_0xf081('0x19')]);router[_0xf081('0x5')](_0xf081('0x1a'),auth[_0xf081('0x6')](),controller['voiceQueuesChannelHangup']);router[_0xf081('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xf081('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0xf081('0x5')](_0xf081('0x1b'),auth[_0xf081('0x6')](),controller[_0xf081('0x1c')]);router[_0xf081('0x1d')](_0xf081('0x1b'),auth[_0xf081('0x6')](),controller[_0xf081('0x1e')]);router[_0xf081('0x5')](_0xf081('0x1f'),auth[_0xf081('0x6')](),controller[_0xf081('0x20')]);router[_0xf081('0x5')](_0xf081('0x21'),auth[_0xf081('0x6')](),controller[_0xf081('0x22')]);router[_0xf081('0x5')](_0xf081('0x23'),auth[_0xf081('0x6')](),controller[_0xf081('0x24')]);router[_0xf081('0x1d')](_0xf081('0x25'),auth[_0xf081('0x6')](),controller[_0xf081('0x26')]);router[_0xf081('0x5')](_0xf081('0x27'),auth[_0xf081('0x6')](),controller[_0xf081('0x28')]);router[_0xf081('0x5')]('/trunks',auth[_0xf081('0x6')](),controller['trunks']);router[_0xf081('0x5')](_0xf081('0x29'),auth[_0xf081('0x6')](),controller[_0xf081('0x2a')]);router['get']('/fax/accounts',auth[_0xf081('0x6')](),controller[_0xf081('0x2b')]);router[_0xf081('0x5')](_0xf081('0x2c'),auth[_0xf081('0x6')](),controller[_0xf081('0x2d')]);router['get'](_0xf081('0x2e'),auth['isAuthenticated'](),controller[_0xf081('0x2f')]);router[_0xf081('0x5')](_0xf081('0x30'),auth[_0xf081('0x6')](),controller[_0xf081('0x31')]);router[_0xf081('0x5')]('/openchannel/queues/:id/waitinginteractions',auth[_0xf081('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xf081('0x5')]('/sms/queues/waitinginteractions',auth[_0xf081('0x6')](),controller[_0xf081('0x32')]);router['get'](_0xf081('0x33'),auth[_0xf081('0x6')](),controller[_0xf081('0x34')]);router['get'](_0xf081('0x35'),auth[_0xf081('0x6')](),controller[_0xf081('0x36')]);router[_0xf081('0x37')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xf081('0x38')));router[_0xf081('0x5')](_0xf081('0x39'),auth[_0xf081('0x6')](),controller[_0xf081('0x3a')]);router[_0xf081('0x37')]('/chat/queues/:id/notify',auth[_0xf081('0x6')](),controller[_0xf081('0x3b')](_0xf081('0x3c')));router[_0xf081('0x5')]('/chat/queues/:id',auth[_0xf081('0x6')](),controller[_0xf081('0x3d')]);router[_0xf081('0x37')](_0xf081('0x3e'),auth[_0xf081('0x6')](),controller[_0xf081('0x3b')](_0xf081('0x3f')));router[_0xf081('0x5')](_0xf081('0x40'),auth[_0xf081('0x6')](),controller[_0xf081('0x41')]);router[_0xf081('0x37')](_0xf081('0x42'),auth[_0xf081('0x6')](),controller[_0xf081('0x3b')](_0xf081('0x43')));router['get'](_0xf081('0x44'),auth[_0xf081('0x6')](),controller[_0xf081('0x45')]);router[_0xf081('0x37')](_0xf081('0x46'),auth['isAuthenticated'](),controller[_0xf081('0x3b')](_0xf081('0x47')));router['post'](_0xf081('0x48'),auth['isAuthenticated'](),controller[_0xf081('0x3b')](_0xf081('0x49')));router['get']('/sms/queues/:id',auth[_0xf081('0x6')](),controller[_0xf081('0x4a')]);router['get'](_0xf081('0x4b'),auth[_0xf081('0x6')](),controller['showWhatsappQueues']);router['post'](_0xf081('0x4c'),auth['isAuthenticated'](),controller[_0xf081('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 767b779..7de3bc9 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 _0xb191=['voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','merge','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','internal','AgentCapacity','capacity','telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','TransferReport','Start','queueTransferTimeout','agentNotify','channel','agent','Message','create','agentTransferTimeout','*,*,*,*','bluebird','lodash','util','../../mysqldb','client','http','request','then','error','message','catch','status','json','sendStatus','stack','name','send','isNil','rows'];(function(_0x2598fe,_0x3cd886){var _0x12f073=function(_0x5f46ba){while(--_0x5f46ba){_0x2598fe['push'](_0x2598fe['shift']());}};_0x12f073(++_0x3cd886);}(_0xb191,0x1c5));var _0x1b19=function(_0x14dbcc,_0x2979ca){_0x14dbcc=_0x14dbcc-0x0;var _0x4b2481=_0xb191[_0x14dbcc];return _0x4b2481;};'use strict';var BPromise=require(_0x1b19('0x0'));var moment=require('moment');var _=require(_0x1b19('0x1'));var util=require(_0x1b19('0x2'));var db=require(_0x1b19('0x3'))['db'];var logger=require('../../config/logger')('api');var jayson=require('jayson/promise');var amiClient=jayson[_0x1b19('0x4')]['http']({'port':0x232a});var mailClient=jayson['client'][_0x1b19('0x5')]({'port':0x232b});var routingClient=jayson[_0x1b19('0x4')][_0x1b19('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x3d8b14,_0x24b83a,_0x11ab65){return new BPromise(function(_0x443c50,_0x45f93e){var _0x21e15e=_0x11ab65?_0x11ab65:amiClient;return _0x21e15e[_0x1b19('0x6')](_0x3d8b14,_0x24b83a)[_0x1b19('0x7')](function(_0x2d024d){if(_0x2d024d[_0x1b19('0x8')]){if(_0x2d024d[_0x1b19('0x8')]['code']===0x1f4){return _0x45f93e(_0x2d024d['error'][_0x1b19('0x9')]);}return _0x443c50(_0x2d024d[_0x1b19('0x8')]['message']);}else{_0x443c50(_0x2d024d['result']);}})[_0x1b19('0xa')](function(_0x364bd2){_0x45f93e(_0x364bd2);});});}function respondWithResult(_0xb42319,_0x310b1e){_0x310b1e=_0x310b1e||0xc8;return function(_0x4cf9f6){if(_0x4cf9f6){return _0xb42319[_0x1b19('0xb')](_0x310b1e)[_0x1b19('0xc')](_0x4cf9f6);}return _0xb42319[_0x1b19('0xd')](0x194);};}function handleError(_0x352db2,_0x3164d8){_0x3164d8=_0x3164d8||0x1f4;return function(_0x11c483){logger[_0x1b19('0x8')](_0x11c483[_0x1b19('0xe')]);if(_0x11c483[_0x1b19('0xf')]){delete _0x11c483['name'];}_0x352db2[_0x1b19('0xb')](_0x3164d8)[_0x1b19('0x10')](_0x11c483);};}function findById(_0x4e05cf){return function(_0x337ad7){if(!_[_0x1b19('0x11')](_0x4e05cf)&&!_[_0x1b19('0x11')](_0x337ad7)&&!_[_0x1b19('0x11')](_0x337ad7[_0x1b19('0x12')])){return _['find'](_0x337ad7['rows'],function(_0x3227b3){return _0x3227b3['id']==_0x4e05cf;});}return null;};}exports[_0x1b19('0x13')]=function(_0x32c261,_0x3d0847){return respondWithRpcPromise(_0x1b19('0x14'),_0x32c261[_0x1b19('0x15')])['then'](respondWithResult(_0x3d0847,null))[_0x1b19('0xa')](handleError(_0x3d0847,null));};exports[_0x1b19('0x16')]=function(_0x4d25d,_0x541c69){return respondWithRpcPromise(_0x1b19('0x17'),_['merge'](_0x4d25d[_0x1b19('0x15')],_0x4d25d['params']))[_0x1b19('0x7')](respondWithResult(_0x541c69,null))['catch'](handleError(_0x541c69,null));};exports[_0x1b19('0x18')]=function(_0x33b0be,_0x35480d){return respondWithRpcPromise(_0x1b19('0x19'),_['merge'](_0x33b0be['query'],_0x33b0be[_0x1b19('0x1a')]))['then'](respondWithResult(_0x35480d,null))[_0x1b19('0xa')](handleError(_0x35480d,null));};exports['voiceQueues']=function(_0x1196bd,_0x3d2cb6){return respondWithRpcPromise(_0x1b19('0x1b'),_0x1196bd[_0x1b19('0x15')])[_0x1b19('0x7')](respondWithResult(_0x3d2cb6,null))[_0x1b19('0xa')](handleError(_0x3d2cb6,null));};exports[_0x1b19('0x1c')]=function(_0xc9b5ab,_0x4f7ffb){return respondWithRpcPromise(_0x1b19('0x1b'),_0xc9b5ab[_0x1b19('0x15')])['then'](findById(_0xc9b5ab[_0x1b19('0x1a')]['id']))[_0x1b19('0x7')](respondWithResult(_0x4f7ffb,null))['catch'](handleError(_0x4f7ffb,null));};exports[_0x1b19('0x1d')]=function(_0x53d9bb,_0x3a3823){return respondWithRpcPromise(_0x1b19('0x1e'),_[_0x1b19('0x1f')](_0x53d9bb[_0x1b19('0x20')],_0x53d9bb[_0x1b19('0x1a')]))[_0x1b19('0x7')](respondWithResult(_0x3a3823,null))[_0x1b19('0xa')](handleError(_0x3a3823,null));};exports['voiceQueuesPreview']=function(_0x178548,_0x20c5f4){return respondWithRpcPromise(_0x1b19('0x21'),_[_0x1b19('0x1f')](_0x178548[_0x1b19('0x15')],_0x178548[_0x1b19('0x1a')]))[_0x1b19('0x7')](respondWithResult(_0x20c5f4,null))[_0x1b19('0xa')](handleError(_0x20c5f4,null));};exports[_0x1b19('0x22')]=function(_0x41c549,_0x347f0c){return respondWithRpcPromise(_0x1b19('0x23'),_0x41c549[_0x1b19('0x15')])['then'](respondWithResult(_0x347f0c,null))['catch'](handleError(_0x347f0c,null));};exports[_0x1b19('0x24')]=function(_0x191314,_0x4d310e){return respondWithRpcPromise(_0x1b19('0x25'),_['merge'](_0x191314[_0x1b19('0x15')],_0x191314[_0x1b19('0x1a')]))[_0x1b19('0x7')](respondWithResult(_0x4d310e,null))[_0x1b19('0xa')](handleError(_0x4d310e,null));};exports[_0x1b19('0x26')]=function(_0x31d36d,_0x4f4d39){return respondWithRpcPromise(_0x1b19('0x27'),_['merge'](_0x31d36d[_0x1b19('0x15')],_0x31d36d[_0x1b19('0x1a')]))['then'](respondWithResult(_0x4f4d39,null))[_0x1b19('0xa')](handleError(_0x4f4d39,null));};exports['voiceQueuesChannelRedirect']=function(_0x16d98a,_0x5de302){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x1b19('0x1f')](_0x16d98a[_0x1b19('0x15')],_0x16d98a['params']))[_0x1b19('0x7')](respondWithResult(_0x5de302,null))[_0x1b19('0xa')](handleError(_0x5de302,null));};exports['outbound']=function(_0x344252,_0x518e6f){return respondWithRpcPromise(_0x1b19('0x28'),_0x344252['query'])['then'](respondWithResult(_0x518e6f,null))[_0x1b19('0xa')](handleError(_0x518e6f,null));};exports[_0x1b19('0x29')]=function(_0x56c7c8,_0x1cef70){return respondWithRpcPromise(_0x1b19('0x2a'),_0x56c7c8[_0x1b19('0x15')])[_0x1b19('0x7')](respondWithResult(_0x1cef70,null))[_0x1b19('0xa')](handleError(_0x1cef70,null));};exports['agents']=function(_0x56288d,_0x20d087){var _0x24e72;return respondWithRpcPromise(_0x1b19('0x2b'),_0x56288d[_0x1b19('0x15')])['then'](function(_0xa3030){_0x24e72=_0xa3030;return respondWithRpcPromise(_0x1b19('0x2b'),_0x56288d[_0x1b19('0x15')],routingClient);})[_0x1b19('0x7')](function(_0x719137){return _[_0x1b19('0x1f')]({},_0x719137,_0x24e72);})[_0x1b19('0x7')](respondWithResult(_0x20d087,null))['catch'](handleError(_0x20d087,null));};exports[_0x1b19('0x2c')]=function(_0x508a2e,_0x28d8df){if(_0x508a2e[_0x1b19('0x20')]&&_0x508a2e[_0x1b19('0x20')][_0x1b19('0x2d')]&&_0x508a2e[_0x1b19('0x2e')]&&_0x508a2e[_0x1b19('0x2e')][_0x1b19('0xf')]){for(var _0x290988 in _0x508a2e['body']['interaction']){if(_0x508a2e[_0x1b19('0x20')][_0x1b19('0x2d')][_0x1b19('0x2f')](_0x290988)){db['MemberReport']['findAll']({'where':{'channel':_0x290988,'membername':_0x508a2e[_0x1b19('0x2e')][_0x1b19('0xf')],'type':_0x1b19('0x30'),'exitAt':null,'uniqueid':_0x508a2e[_0x1b19('0x20')][_0x1b19('0x2d')][_0x290988]&&_0x508a2e['body'][_0x1b19('0x2d')][_0x290988][_0x1b19('0x31')]?{'$notIn':_0x508a2e[_0x1b19('0x20')][_0x1b19('0x2d')][_0x290988]}:{'$ne':null}}})['then'](function(_0x39e2fa){var _0x490c55=moment()[_0x1b19('0x32')](_0x1b19('0x33'));for(var _0x3d3227=0x0,_0x23fb82=_0x39e2fa['length'];_0x3d3227<_0x23fb82;_0x3d3227+=0x1){_0x39e2fa[_0x3d3227][_0x1b19('0x34')]({'exitAt':_0x490c55});}});for(var _0xc7a472=0x0;_0xc7a472<_0x508a2e['body'][_0x1b19('0x2d')][_0x290988][_0x1b19('0x31')];_0xc7a472+=0x1){db['MemberReport'][_0x1b19('0x35')]({'where':{'channel':_0x290988,'membername':_0x508a2e['user'][_0x1b19('0xf')],'type':_0x1b19('0x30'),'uniqueid':_0x508a2e['body'][_0x1b19('0x2d')][_0x290988][_0xc7a472],'exitAt':null},'defaults':{'channel':_0x290988,'membername':_0x508a2e[_0x1b19('0x2e')][_0x1b19('0xf')],'interface':_[_0x1b19('0x11')](_0x508a2e['user'][_0x1b19('0x36')])?util['format']('SIP/%s',_0x508a2e[_0x1b19('0x2e')]['name']):_0x508a2e[_0x1b19('0x2e')]['interface'],'type':_0x1b19('0x30'),'enterAt':moment()[_0x1b19('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x508a2e[_0x1b19('0x2e')][_0x1b19('0x37')],'uniqueid':_0x508a2e[_0x1b19('0x20')][_0x1b19('0x2d')][_0x290988][_0xc7a472]}});}}}}return respondWithRpcPromise(_0x1b19('0x38'),{'id':_0x508a2e[_0x1b19('0x1a')]['id'],'capacity':_0x508a2e[_0x1b19('0x20')][_0x1b19('0x39')]},routingClient)[_0x1b19('0x7')](respondWithResult(_0x28d8df,null))[_0x1b19('0xa')](handleError(_0x28d8df,null));};exports[_0x1b19('0x3a')]=function(_0x2bb773,_0x58a531){return respondWithRpcPromise('Telephones',_0x2bb773['query'])[_0x1b19('0x7')](respondWithResult(_0x58a531,null))[_0x1b19('0xa')](handleError(_0x58a531,null));};exports[_0x1b19('0x3b')]=function(_0x940b13,_0x1c1a76){return respondWithRpcPromise(_0x1b19('0x3c'),_0x940b13[_0x1b19('0x15')])[_0x1b19('0x7')](respondWithResult(_0x1c1a76,null))['catch'](handleError(_0x1c1a76,null));};exports[_0x1b19('0x3d')]=function(_0x111f40,_0x50eda2){return respondWithRpcPromise(_0x1b19('0x3e'),_0x111f40['query'])['then'](respondWithResult(_0x50eda2,null))['catch'](handleError(_0x50eda2,null));};exports['chatQueues']=function(_0x146d75,_0x2adc56){return respondWithRpcPromise(_0x1b19('0x3f'),_0x146d75[_0x1b19('0x15')],routingClient)[_0x1b19('0x7')](respondWithResult(_0x2adc56,null))['catch'](handleError(_0x2adc56,null));};exports[_0x1b19('0x40')]=function(_0x2ef49a,_0x2cbac8){return respondWithRpcPromise('ChatQueues',_0x2ef49a[_0x1b19('0x15')],routingClient)[_0x1b19('0x7')](findById(_0x2ef49a[_0x1b19('0x1a')]['id']))['then'](respondWithResult(_0x2cbac8,null))[_0x1b19('0xa')](handleError(_0x2cbac8,null));};exports[_0x1b19('0x41')]=function(_0x39d84d,_0x59594c){return respondWithRpcPromise(_0x1b19('0x42'),_0x39d84d['query'],routingClient)[_0x1b19('0x7')](respondWithResult(_0x59594c,null))[_0x1b19('0xa')](handleError(_0x59594c,null));};exports[_0x1b19('0x43')]=function(_0x4e46e1,_0x16191e){return respondWithRpcPromise(_0x1b19('0x42'),_0x4e46e1['query'],routingClient)['then'](findById(_0x4e46e1[_0x1b19('0x1a')]['id']))[_0x1b19('0x7')](respondWithResult(_0x16191e,null))[_0x1b19('0xa')](handleError(_0x16191e,null));};exports[_0x1b19('0x44')]=function(_0x4e2a8b,_0x5491b4){return respondWithRpcPromise('MailAccounts',_0x4e2a8b[_0x1b19('0x15')],mailClient)[_0x1b19('0x7')](respondWithResult(_0x5491b4,null))[_0x1b19('0xa')](handleError(_0x5491b4,null));};exports[_0x1b19('0x45')]=function(_0x349ab8,_0x18d0fd){return respondWithRpcPromise('OpenchannelQueues',_0x349ab8['query'],routingClient)[_0x1b19('0x7')](respondWithResult(_0x18d0fd,null))[_0x1b19('0xa')](handleError(_0x18d0fd,null));};exports[_0x1b19('0x46')]=function(_0x256b6f,_0x3123b8){return respondWithRpcPromise('OpenchannelQueues',_0x256b6f[_0x1b19('0x15')],routingClient)['then'](findById(_0x256b6f[_0x1b19('0x1a')]['id']))[_0x1b19('0x7')](respondWithResult(_0x3123b8,null))['catch'](handleError(_0x3123b8,null));};exports[_0x1b19('0x47')]=function(_0x2f667d,_0x5115a4){return respondWithRpcPromise(_0x1b19('0x48'),_0x2f667d['query'],routingClient)[_0x1b19('0x7')](respondWithResult(_0x5115a4,null))[_0x1b19('0xa')](handleError(_0x5115a4,null));};exports[_0x1b19('0x49')]=function(_0xc4d48c,_0x4ace39){return respondWithRpcPromise(_0x1b19('0x48'),_0xc4d48c[_0x1b19('0x15')],routingClient)[_0x1b19('0x7')](findById(_0xc4d48c[_0x1b19('0x1a')]['id']))[_0x1b19('0x7')](respondWithResult(_0x4ace39,null))['catch'](handleError(_0x4ace39,null));};exports[_0x1b19('0x4a')]=function(_0x3c62d9,_0x4ddb78){return respondWithRpcPromise('WhatsappQueues',_0x3c62d9['query'],routingClient)[_0x1b19('0x7')](respondWithResult(_0x4ddb78,null))[_0x1b19('0xa')](handleError(_0x4ddb78,null));};exports[_0x1b19('0x4b')]=function(_0x2a1737,_0x2cf4ec){return respondWithRpcPromise(_0x1b19('0x4c'),_0x2a1737[_0x1b19('0x15')],routingClient)[_0x1b19('0x7')](findById(_0x2a1737[_0x1b19('0x1a')]['id']))[_0x1b19('0x7')](respondWithResult(_0x2cf4ec,null))[_0x1b19('0xa')](handleError(_0x2cf4ec,null));};exports[_0x1b19('0x4d')]=function(_0x141637,_0x2d684c){return respondWithRpcPromise('FaxQueues',_0x141637[_0x1b19('0x15')],routingClient)['then'](respondWithResult(_0x2d684c,null))[_0x1b19('0xa')](handleError(_0x2d684c,null));};exports[_0x1b19('0x4e')]=function(_0x2a82f0,_0x7905b9){return respondWithRpcPromise(_0x1b19('0x4f'),_0x2a82f0[_0x1b19('0x15')],routingClient)[_0x1b19('0x7')](findById(_0x2a82f0[_0x1b19('0x1a')]['id']))[_0x1b19('0x7')](respondWithResult(_0x7905b9,null))[_0x1b19('0xa')](handleError(_0x7905b9,null));};exports[_0x1b19('0x50')]=function(_0x253a65,_0x367de7){return respondWithRpcPromise(_0x1b19('0x51'),_0x253a65[_0x1b19('0x15')])['then'](respondWithResult(_0x367de7,null))[_0x1b19('0xa')](handleError(_0x367de7,null));};exports['chatQueuesWaitingInteractions']=function(_0x8b777d,_0x380cbc){return respondWithRpcPromise(_0x1b19('0x52'),_0x8b777d[_0x1b19('0x15')],routingClient)['then'](respondWithResult(_0x380cbc,null))['catch'](handleError(_0x380cbc,null));};exports['mailQueuesWaitingInteractions']=function(_0x2082e,_0x55c74e){return respondWithRpcPromise(_0x1b19('0x53'),_0x2082e[_0x1b19('0x15')],routingClient)[_0x1b19('0x7')](respondWithResult(_0x55c74e,null))[_0x1b19('0xa')](handleError(_0x55c74e,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x218e83,_0x4dfc6a){return respondWithRpcPromise(_0x1b19('0x54'),_0x218e83[_0x1b19('0x15')],routingClient)[_0x1b19('0x7')](respondWithResult(_0x4dfc6a,null))['catch'](handleError(_0x4dfc6a,null));};exports[_0x1b19('0x55')]=function(_0x4ca38d,_0x11b49e){return respondWithRpcPromise(_0x1b19('0x54'),_0x4ca38d[_0x1b19('0x15')],routingClient)[_0x1b19('0x7')](function(_0x257b7d){if(_0x4ca38d['query'][_0x1b19('0x56')]!==undefined){var _0x18883c=_(_0x257b7d['rows'])[_0x1b19('0x57')]([_0x4ca38d[_0x1b19('0x15')]['type'],_0x4ca38d[_0x1b19('0x1a')]['id']])[_0x1b19('0x58')](_0x1b19('0x59'))[_0x1b19('0x5a')]()['value']();return _0x257b7d['rows'][_0x1b19('0x57')](function(_0x34ffaf){return _0x18883c['indexOf'](_0x34ffaf[_0x1b19('0x59')])>-0x1;});}else{return _0x257b7d[_0x1b19('0x12')][_0x1b19('0x57')](function(_0x1b2a56){return _0x1b2a56[_0x1b19('0x59')]===parseInt(_0x4ca38d[_0x1b19('0x1a')]['id']);});}})[_0x1b19('0x7')](respondWithResult(_0x11b49e,null))[_0x1b19('0xa')](handleError(_0x11b49e,null));};exports['smsQueuesWaitingInteractions']=function(_0x2e0952,_0x2cf6ef){return respondWithRpcPromise(_0x1b19('0x5b'),_0x2e0952[_0x1b19('0x15')],routingClient)[_0x1b19('0x7')](respondWithResult(_0x2cf6ef,null))['catch'](handleError(_0x2cf6ef,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x489eb3,_0x2c70c6){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x489eb3[_0x1b19('0x15')],routingClient)[_0x1b19('0x7')](respondWithResult(_0x2c70c6,null))[_0x1b19('0xa')](handleError(_0x2c70c6,null));};exports[_0x1b19('0x5c')]=function(_0x19943b,_0x409b6c){return respondWithRpcPromise(_0x1b19('0x5d'),_0x19943b['query'],routingClient)[_0x1b19('0x7')](respondWithResult(_0x409b6c,null))[_0x1b19('0xa')](handleError(_0x409b6c,null));};exports['queueNotify']=function(_0x42d8a2){return function(_0x3b2aaa,_0x28ed32){var _0x12e420,_0x4dedc4;var _0x5f44a0=_[_0x1b19('0x5e')](_0x42d8a2);var _0x2671fb=_0x42d8a2===_0x1b19('0x5f')?_0x1b19('0x60'):_0x1b19('0x61');return db[_0x5f44a0+_0x1b19('0x62')][_0x1b19('0x63')]({'raw':!![],'where':{'id':_0x3b2aaa['params']['id']}})[_0x1b19('0x7')](function(_0x30a8bc){if(_[_0x1b19('0x11')](_0x30a8bc)){throw new Error(_0x5f44a0+_0x1b19('0x64'));}_0x12e420=_0x30a8bc;return db[_0x5f44a0+'Message']['findOne']({'where':{'id':_0x3b2aaa[_0x1b19('0x20')][_0x1b19('0x65')]},'include':[{'model':db[_0x5f44a0+_0x1b19('0x66')],'as':'Interaction'},{'model':db[_0x5f44a0+_0x2671fb],'as':_0x1b19('0x61')}]});})['then'](function(_0x24859e){if(_[_0x1b19('0x11')](_0x24859e)){throw new Error(_0x5f44a0+_0x1b19('0x67'));}_0x4dedc4=_0x24859e;return _0x24859e[_0x1b19('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1b19('0x7')](function(){var _0x5436dc={'uniqueid':_0x42d8a2+'.'+_0x4dedc4['id']+'.'+_0x4dedc4[_0x1b19('0x66')]['id'],'FromUserId':_0x3b2aaa[_0x1b19('0x2e')]['id'],'type':'queue'};_0x5436dc[_0x5f44a0+_0x1b19('0x69')]=_0x4dedc4['id'];_0x5436dc[_0x5f44a0+_0x1b19('0x6a')]=_0x4dedc4[_0x1b19('0x66')]['id'];_0x5436dc[_0x1b19('0x6b')+_0x5f44a0+_0x2671fb+'Id']=_0x4dedc4[_0x1b19('0x61')]['id'];_0x5436dc['To'+_0x5f44a0+'QueueId']=_0x12e420['id'];return db[_0x5f44a0+_0x1b19('0x6c')]['create'](_0x5436dc);})[_0x1b19('0x7')](function(){return respondWithRpcPromise(_0x1b19('0x6d'),{'channel':_0x42d8a2,'interaction':_0x4dedc4['Interaction'],'message':_0x4dedc4,'account':_0x4dedc4[_0x1b19('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x12e420[_0x1b19('0xf')]+','+(_0x4dedc4[_0x1b19('0x61')][_0x1b19('0x6e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x1b19('0x7')](respondWithResult(_0x28ed32,null))[_0x1b19('0xa')](handleError(_0x28ed32,null));};};exports[_0x1b19('0x6f')]=function(_0x21c0ea,_0x115af1){var _0x4deac6,_0xe6beb2;if(_[_0x1b19('0x11')](_0x21c0ea['body'][_0x1b19('0x70')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x112891=_0x21c0ea[_0x1b19('0x20')][_0x1b19('0x70')];var _0x84da5a=_['capitalize'](_0x112891);var _0x5ac58f=_0x112891===_0x1b19('0x5f')?_0x1b19('0x60'):_0x1b19('0x61');return db['User'][_0x1b19('0x63')]({'raw':!![],'where':{'id':_0x21c0ea[_0x1b19('0x1a')]['id'],'role':_0x1b19('0x71')}})[_0x1b19('0x7')](function(_0x2d3c16){if(_['isNil'](_0x2d3c16)){throw new Error('Agent\x20not\x20found');}_0x4deac6=_0x2d3c16;return db[_0x84da5a+_0x1b19('0x72')][_0x1b19('0x63')]({'where':{'id':_0x21c0ea[_0x1b19('0x20')][_0x1b19('0x65')]},'include':[{'model':db[_0x84da5a+'Interaction'],'as':_0x1b19('0x66')},{'model':db[_0x84da5a+_0x5ac58f],'as':_0x1b19('0x61')}]});})[_0x1b19('0x7')](function(_0x1efa37){if(_[_0x1b19('0x11')](_0x1efa37)){throw new Error(_0x84da5a+_0x1b19('0x67'));}_0xe6beb2=_0x1efa37;return _0x1efa37[_0x1b19('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1b19('0x7')](function(){var _0x1c5a4f={'uniqueid':_0x112891+'.'+_0xe6beb2['id']+'.'+_0xe6beb2[_0x1b19('0x66')]['id'],'FromUserId':_0x21c0ea[_0x1b19('0x2e')]['id'],'type':_0x1b19('0x71'),'ToUserId':_0x4deac6['id']};_0x1c5a4f[_0x84da5a+'MessageId']=_0xe6beb2['id'];_0x1c5a4f[_0x84da5a+'InteractionId']=_0xe6beb2[_0x1b19('0x66')]['id'];_0x1c5a4f['From'+_0x84da5a+_0x5ac58f+'Id']=_0xe6beb2[_0x1b19('0x61')]['id'];return db[_0x84da5a+'TransferReport'][_0x1b19('0x73')](_0x1c5a4f);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x112891,'interaction':_0xe6beb2[_0x1b19('0x66')],'message':_0xe6beb2,'account':_0xe6beb2[_0x1b19('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1b19('0x71'),'appdata':_0x4deac6[_0x1b19('0xf')]+','+(_0xe6beb2[_0x1b19('0x61')][_0x1b19('0x74')]||0x12c),'interval':_0x1b19('0x75')}]},routingClient);})[_0x1b19('0x7')](respondWithResult(_0x115af1,null))[_0x1b19('0xa')](handleError(_0x115af1,null));}; \ No newline at end of file +var _0x1463=['\x20Message\x20not\x20found','queue','MessageId','InteractionId','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','Channel\x20field\x20is\x20mandatory','User','update','From','agentTransferTimeout','*,*,*,*','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','find','rows','merge','query','params','then','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','uniq','indexOf','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction'];(function(_0x257a44,_0x445bdd){var _0x2b97da=function(_0x564cf2){while(--_0x564cf2){_0x257a44['push'](_0x257a44['shift']());}};_0x2b97da(++_0x445bdd);}(_0x1463,0x10a));var _0x3146=function(_0x17bdb8,_0x5e789d){_0x17bdb8=_0x17bdb8-0x0;var _0x164dcf=_0x1463[_0x17bdb8];return _0x164dcf;};'use strict';var BPromise=require(_0x3146('0x0'));var moment=require(_0x3146('0x1'));var _=require(_0x3146('0x2'));var util=require(_0x3146('0x3'));var db=require(_0x3146('0x4'))['db'];var logger=require(_0x3146('0x5'))(_0x3146('0x6'));var jayson=require(_0x3146('0x7'));var amiClient=jayson[_0x3146('0x8')][_0x3146('0x9')]({'port':0x232a});var mailClient=jayson[_0x3146('0x8')][_0x3146('0x9')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x65e3a1,_0x507964,_0x47f8ee){return new BPromise(function(_0x337f2d,_0x1358eb){var _0x10c6d4=_0x47f8ee?_0x47f8ee:amiClient;return _0x10c6d4['request'](_0x65e3a1,_0x507964)['then'](function(_0x4255e1){if(_0x4255e1[_0x3146('0xa')]){if(_0x4255e1[_0x3146('0xa')][_0x3146('0xb')]===0x1f4){return _0x1358eb(_0x4255e1[_0x3146('0xa')][_0x3146('0xc')]);}return _0x337f2d(_0x4255e1[_0x3146('0xa')]['message']);}else{_0x337f2d(_0x4255e1[_0x3146('0xd')]);}})[_0x3146('0xe')](function(_0x5a46a2){_0x1358eb(_0x5a46a2);});});}function respondWithResult(_0x2e1bf8,_0x5e60a3){_0x5e60a3=_0x5e60a3||0xc8;return function(_0x521481){if(_0x521481){return _0x2e1bf8[_0x3146('0xf')](_0x5e60a3)[_0x3146('0x10')](_0x521481);}return _0x2e1bf8[_0x3146('0x11')](0x194);};}function handleError(_0x59ad47,_0xe65f89){_0xe65f89=_0xe65f89||0x1f4;return function(_0x48fb35){logger['error'](_0x48fb35[_0x3146('0x12')]);if(_0x48fb35['name']){delete _0x48fb35[_0x3146('0x13')];}_0x59ad47[_0x3146('0xf')](_0xe65f89)[_0x3146('0x14')](_0x48fb35);};}function findById(_0x3e7121){return function(_0x13481e){if(!_[_0x3146('0x15')](_0x3e7121)&&!_['isNil'](_0x13481e)&&!_[_0x3146('0x15')](_0x13481e['rows'])){return _[_0x3146('0x16')](_0x13481e[_0x3146('0x17')],function(_0x19fbcd){return _0x19fbcd['id']==_0x3e7121;});}return null;};}exports['voiceChannels']=function(_0x3013b7,_0x2bcae4){return respondWithRpcPromise('VoiceChannels',_0x3013b7['query'])['then'](respondWithResult(_0x2bcae4,null))[_0x3146('0xe')](handleError(_0x2bcae4,null));};exports['voiceChannelMixMonitor']=function(_0x494e98,_0x50129c){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x3146('0x18')](_0x494e98[_0x3146('0x19')],_0x494e98[_0x3146('0x1a')]))[_0x3146('0x1b')](respondWithResult(_0x50129c,null))['catch'](handleError(_0x50129c,null));};exports[_0x3146('0x1c')]=function(_0x169239,_0x12c339){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x3146('0x18')](_0x169239[_0x3146('0x19')],_0x169239['params']))[_0x3146('0x1b')](respondWithResult(_0x12c339,null))[_0x3146('0xe')](handleError(_0x12c339,null));};exports[_0x3146('0x1d')]=function(_0x387fd8,_0x49dcff){return respondWithRpcPromise(_0x3146('0x1e'),_0x387fd8[_0x3146('0x19')])[_0x3146('0x1b')](respondWithResult(_0x49dcff,null))[_0x3146('0xe')](handleError(_0x49dcff,null));};exports['showVoiceQueues']=function(_0x40135b,_0x40d253){return respondWithRpcPromise('VoiceQueues',_0x40135b[_0x3146('0x19')])[_0x3146('0x1b')](findById(_0x40135b[_0x3146('0x1a')]['id']))[_0x3146('0x1b')](respondWithResult(_0x40d253,null))['catch'](handleError(_0x40d253,null));};exports[_0x3146('0x1f')]=function(_0xcefd83,_0x240f56){return respondWithRpcPromise(_0x3146('0x20'),_[_0x3146('0x18')](_0xcefd83['body'],_0xcefd83[_0x3146('0x1a')]))['then'](respondWithResult(_0x240f56,null))[_0x3146('0xe')](handleError(_0x240f56,null));};exports['voiceQueuesPreview']=function(_0x185e1e,_0x18308e){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x3146('0x18')](_0x185e1e[_0x3146('0x19')],_0x185e1e['params']))[_0x3146('0x1b')](respondWithResult(_0x18308e,null))[_0x3146('0xe')](handleError(_0x18308e,null));};exports[_0x3146('0x21')]=function(_0x5b9913,_0x3d4d99){return respondWithRpcPromise('VoiceQueuesChannels',_0x5b9913[_0x3146('0x19')])[_0x3146('0x1b')](respondWithResult(_0x3d4d99,null))[_0x3146('0xe')](handleError(_0x3d4d99,null));};exports[_0x3146('0x22')]=function(_0xd35b3,_0x290727){return respondWithRpcPromise(_0x3146('0x23'),_[_0x3146('0x18')](_0xd35b3[_0x3146('0x19')],_0xd35b3[_0x3146('0x1a')]))[_0x3146('0x1b')](respondWithResult(_0x290727,null))[_0x3146('0xe')](handleError(_0x290727,null));};exports[_0x3146('0x24')]=function(_0xa771a,_0x4f131e){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x3146('0x18')](_0xa771a[_0x3146('0x19')],_0xa771a[_0x3146('0x1a')]))[_0x3146('0x1b')](respondWithResult(_0x4f131e,null))[_0x3146('0xe')](handleError(_0x4f131e,null));};exports[_0x3146('0x25')]=function(_0x326fad,_0x341714){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x326fad[_0x3146('0x19')],_0x326fad['params']))[_0x3146('0x1b')](respondWithResult(_0x341714,null))['catch'](handleError(_0x341714,null));};exports[_0x3146('0x26')]=function(_0x539d24,_0x79a6bc){return respondWithRpcPromise('Outbound',_0x539d24[_0x3146('0x19')])[_0x3146('0x1b')](respondWithResult(_0x79a6bc,null))['catch'](handleError(_0x79a6bc,null));};exports[_0x3146('0x27')]=function(_0x8570b8,_0x76f417){return respondWithRpcPromise(_0x3146('0x28'),_0x8570b8[_0x3146('0x19')])[_0x3146('0x1b')](respondWithResult(_0x76f417,null))[_0x3146('0xe')](handleError(_0x76f417,null));};exports[_0x3146('0x29')]=function(_0x433e75,_0xc85b22){var _0x3433e7;return respondWithRpcPromise(_0x3146('0x2a'),_0x433e75[_0x3146('0x19')])[_0x3146('0x1b')](function(_0x4b1993){_0x3433e7=_0x4b1993;return respondWithRpcPromise(_0x3146('0x2a'),_0x433e75[_0x3146('0x19')],routingClient);})[_0x3146('0x1b')](function(_0x23453c){return _[_0x3146('0x18')]({},_0x23453c,_0x3433e7);})[_0x3146('0x1b')](respondWithResult(_0xc85b22,null))[_0x3146('0xe')](handleError(_0xc85b22,null));};exports['agentCapacity']=function(_0x4792aa,_0x1f9d45){if(_0x4792aa[_0x3146('0x2b')]&&_0x4792aa[_0x3146('0x2b')][_0x3146('0x2c')]&&_0x4792aa[_0x3146('0x2d')]&&_0x4792aa[_0x3146('0x2d')]['name']){for(var _0x3aace1 in _0x4792aa[_0x3146('0x2b')]['interaction']){if(_0x4792aa[_0x3146('0x2b')][_0x3146('0x2c')][_0x3146('0x2e')](_0x3aace1)){db[_0x3146('0x2f')][_0x3146('0x30')]({'where':{'channel':_0x3aace1,'membername':_0x4792aa[_0x3146('0x2d')][_0x3146('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4792aa[_0x3146('0x2b')][_0x3146('0x2c')][_0x3aace1]&&_0x4792aa['body']['interaction'][_0x3aace1][_0x3146('0x31')]?{'$notIn':_0x4792aa['body'][_0x3146('0x2c')][_0x3aace1]}:{'$ne':null}}})['then'](function(_0x3fde46){var _0x33f8b8=moment()[_0x3146('0x32')](_0x3146('0x33'));for(var _0x406142=0x0,_0x363401=_0x3fde46['length'];_0x406142<_0x363401;_0x406142+=0x1){_0x3fde46[_0x406142][_0x3146('0x34')]({'exitAt':_0x33f8b8});}});for(var _0x489868=0x0;_0x489868<_0x4792aa[_0x3146('0x2b')][_0x3146('0x2c')][_0x3aace1][_0x3146('0x31')];_0x489868+=0x1){db['MemberReport'][_0x3146('0x35')]({'where':{'channel':_0x3aace1,'membername':_0x4792aa[_0x3146('0x2d')][_0x3146('0x13')],'type':_0x3146('0x36'),'uniqueid':_0x4792aa[_0x3146('0x2b')]['interaction'][_0x3aace1][_0x489868],'exitAt':null},'defaults':{'channel':_0x3aace1,'membername':_0x4792aa['user']['name'],'interface':_[_0x3146('0x15')](_0x4792aa[_0x3146('0x2d')][_0x3146('0x37')])?util[_0x3146('0x32')](_0x3146('0x38'),_0x4792aa[_0x3146('0x2d')][_0x3146('0x13')]):_0x4792aa[_0x3146('0x2d')]['interface'],'type':_0x3146('0x36'),'enterAt':moment()[_0x3146('0x32')](_0x3146('0x33')),'role':_0x3146('0x39'),'internal':_0x4792aa[_0x3146('0x2d')][_0x3146('0x3a')],'uniqueid':_0x4792aa['body'][_0x3146('0x2c')][_0x3aace1][_0x489868]}});}}}}return respondWithRpcPromise(_0x3146('0x3b'),{'id':_0x4792aa[_0x3146('0x1a')]['id'],'capacity':_0x4792aa[_0x3146('0x2b')][_0x3146('0x3c')]},routingClient)['then'](respondWithResult(_0x1f9d45,null))[_0x3146('0xe')](handleError(_0x1f9d45,null));};exports[_0x3146('0x3d')]=function(_0x351cb0,_0x118c5e){return respondWithRpcPromise('Telephones',_0x351cb0[_0x3146('0x19')])[_0x3146('0x1b')](respondWithResult(_0x118c5e,null))[_0x3146('0xe')](handleError(_0x118c5e,null));};exports[_0x3146('0x3e')]=function(_0x19e22f,_0x3da8a8){return respondWithRpcPromise('Trunks',_0x19e22f[_0x3146('0x19')])[_0x3146('0x1b')](respondWithResult(_0x3da8a8,null))[_0x3146('0xe')](handleError(_0x3da8a8,null));};exports['campaigns']=function(_0x4a81c3,_0x4b7afa){return respondWithRpcPromise(_0x3146('0x3f'),_0x4a81c3[_0x3146('0x19')])[_0x3146('0x1b')](respondWithResult(_0x4b7afa,null))[_0x3146('0xe')](handleError(_0x4b7afa,null));};exports[_0x3146('0x40')]=function(_0x252ded,_0x51caca){return respondWithRpcPromise(_0x3146('0x41'),_0x252ded[_0x3146('0x19')],routingClient)[_0x3146('0x1b')](respondWithResult(_0x51caca,null))[_0x3146('0xe')](handleError(_0x51caca,null));};exports[_0x3146('0x42')]=function(_0xf6e49b,_0x206dc1){return respondWithRpcPromise(_0x3146('0x41'),_0xf6e49b[_0x3146('0x19')],routingClient)[_0x3146('0x1b')](findById(_0xf6e49b[_0x3146('0x1a')]['id']))[_0x3146('0x1b')](respondWithResult(_0x206dc1,null))[_0x3146('0xe')](handleError(_0x206dc1,null));};exports[_0x3146('0x43')]=function(_0x3e00ae,_0x291a4e){return respondWithRpcPromise(_0x3146('0x44'),_0x3e00ae[_0x3146('0x19')],routingClient)[_0x3146('0x1b')](respondWithResult(_0x291a4e,null))[_0x3146('0xe')](handleError(_0x291a4e,null));};exports[_0x3146('0x45')]=function(_0x36b7d8,_0x47d64c){return respondWithRpcPromise(_0x3146('0x44'),_0x36b7d8[_0x3146('0x19')],routingClient)[_0x3146('0x1b')](findById(_0x36b7d8[_0x3146('0x1a')]['id']))['then'](respondWithResult(_0x47d64c,null))['catch'](handleError(_0x47d64c,null));};exports['mailAccounts']=function(_0x5e1f43,_0x57b8b7){return respondWithRpcPromise(_0x3146('0x46'),_0x5e1f43[_0x3146('0x19')],mailClient)['then'](respondWithResult(_0x57b8b7,null))['catch'](handleError(_0x57b8b7,null));};exports[_0x3146('0x47')]=function(_0x1ccff3,_0x334944){return respondWithRpcPromise('OpenchannelQueues',_0x1ccff3['query'],routingClient)['then'](respondWithResult(_0x334944,null))[_0x3146('0xe')](handleError(_0x334944,null));};exports[_0x3146('0x48')]=function(_0x5d278d,_0x41f851){return respondWithRpcPromise(_0x3146('0x49'),_0x5d278d[_0x3146('0x19')],routingClient)['then'](findById(_0x5d278d[_0x3146('0x1a')]['id']))[_0x3146('0x1b')](respondWithResult(_0x41f851,null))['catch'](handleError(_0x41f851,null));};exports['smsQueues']=function(_0x3e4934,_0x360bcd){return respondWithRpcPromise(_0x3146('0x4a'),_0x3e4934[_0x3146('0x19')],routingClient)[_0x3146('0x1b')](respondWithResult(_0x360bcd,null))[_0x3146('0xe')](handleError(_0x360bcd,null));};exports[_0x3146('0x4b')]=function(_0x294fbc,_0x4632ed){return respondWithRpcPromise(_0x3146('0x4a'),_0x294fbc['query'],routingClient)[_0x3146('0x1b')](findById(_0x294fbc[_0x3146('0x1a')]['id']))[_0x3146('0x1b')](respondWithResult(_0x4632ed,null))[_0x3146('0xe')](handleError(_0x4632ed,null));};exports[_0x3146('0x4c')]=function(_0x680b9a,_0xc985b7){return respondWithRpcPromise(_0x3146('0x4d'),_0x680b9a[_0x3146('0x19')],routingClient)[_0x3146('0x1b')](respondWithResult(_0xc985b7,null))[_0x3146('0xe')](handleError(_0xc985b7,null));};exports[_0x3146('0x4e')]=function(_0x148399,_0x480bae){return respondWithRpcPromise(_0x3146('0x4d'),_0x148399['query'],routingClient)[_0x3146('0x1b')](findById(_0x148399[_0x3146('0x1a')]['id']))[_0x3146('0x1b')](respondWithResult(_0x480bae,null))[_0x3146('0xe')](handleError(_0x480bae,null));};exports['faxQueues']=function(_0x2d6931,_0x4547f2){return respondWithRpcPromise(_0x3146('0x4f'),_0x2d6931[_0x3146('0x19')],routingClient)[_0x3146('0x1b')](respondWithResult(_0x4547f2,null))['catch'](handleError(_0x4547f2,null));};exports[_0x3146('0x50')]=function(_0x1e38cd,_0x43d7e0){return respondWithRpcPromise(_0x3146('0x4f'),_0x1e38cd[_0x3146('0x19')],routingClient)['then'](findById(_0x1e38cd[_0x3146('0x1a')]['id']))[_0x3146('0x1b')](respondWithResult(_0x43d7e0,null))[_0x3146('0xe')](handleError(_0x43d7e0,null));};exports[_0x3146('0x51')]=function(_0x337b2b,_0x4c5965){return respondWithRpcPromise(_0x3146('0x52'),_0x337b2b['query'])['then'](respondWithResult(_0x4c5965,null))['catch'](handleError(_0x4c5965,null));};exports['chatQueuesWaitingInteractions']=function(_0xfc02ce,_0xf321a6){return respondWithRpcPromise(_0x3146('0x53'),_0xfc02ce[_0x3146('0x19')],routingClient)[_0x3146('0x1b')](respondWithResult(_0xf321a6,null))[_0x3146('0xe')](handleError(_0xf321a6,null));};exports['mailQueuesWaitingInteractions']=function(_0xa0798d,_0x15c472){return respondWithRpcPromise(_0x3146('0x54'),_0xa0798d[_0x3146('0x19')],routingClient)[_0x3146('0x1b')](respondWithResult(_0x15c472,null))['catch'](handleError(_0x15c472,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x3862bb,_0x5d4579){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3862bb[_0x3146('0x19')],routingClient)[_0x3146('0x1b')](respondWithResult(_0x5d4579,null))[_0x3146('0xe')](handleError(_0x5d4579,null));};exports[_0x3146('0x55')]=function(_0x3b1075,_0x39e5a0){return respondWithRpcPromise(_0x3146('0x56'),_0x3b1075[_0x3146('0x19')],routingClient)[_0x3146('0x1b')](function(_0x2437bf){if(_0x3b1075[_0x3146('0x19')]['type']!==undefined){var _0x48584f=_(_0x2437bf['rows'])['filter']([_0x3b1075[_0x3146('0x19')][_0x3146('0x57')],_0x3b1075[_0x3146('0x1a')]['id']])[_0x3146('0x58')](_0x3146('0x59'))[_0x3146('0x5a')]()['value']();return _0x2437bf[_0x3146('0x17')]['filter'](function(_0x2feaee){return _0x48584f[_0x3146('0x5b')](_0x2feaee['queue_id'])>-0x1;});}else{return _0x2437bf[_0x3146('0x17')][_0x3146('0x5c')](function(_0x4971d6){return _0x4971d6['queue_id']===parseInt(_0x3b1075[_0x3146('0x1a')]['id']);});}})[_0x3146('0x1b')](respondWithResult(_0x39e5a0,null))[_0x3146('0xe')](handleError(_0x39e5a0,null));};exports[_0x3146('0x5d')]=function(_0x49ebe2,_0x3474fb){return respondWithRpcPromise(_0x3146('0x5e'),_0x49ebe2[_0x3146('0x19')],routingClient)['then'](respondWithResult(_0x3474fb,null))[_0x3146('0xe')](handleError(_0x3474fb,null));};exports[_0x3146('0x5f')]=function(_0x9336e0,_0x4727e1){return respondWithRpcPromise(_0x3146('0x60'),_0x9336e0[_0x3146('0x19')],routingClient)[_0x3146('0x1b')](respondWithResult(_0x4727e1,null))[_0x3146('0xe')](handleError(_0x4727e1,null));};exports[_0x3146('0x61')]=function(_0x599b92,_0xdd3b92){return respondWithRpcPromise(_0x3146('0x62'),_0x599b92[_0x3146('0x19')],routingClient)[_0x3146('0x1b')](respondWithResult(_0xdd3b92,null))['catch'](handleError(_0xdd3b92,null));};exports['queueNotify']=function(_0x416bd0){return function(_0x56ee4d,_0x124f49){var _0x2f1f69,_0x310749;var _0x313113=_[_0x3146('0x63')](_0x416bd0);var _0x4522cd=_0x416bd0===_0x3146('0x64')?_0x3146('0x65'):_0x3146('0x66');return db[_0x313113+_0x3146('0x67')]['findOne']({'raw':!![],'where':{'id':_0x56ee4d[_0x3146('0x1a')]['id']}})[_0x3146('0x1b')](function(_0x17f860){if(_[_0x3146('0x15')](_0x17f860)){throw new Error(_0x313113+_0x3146('0x68'));}_0x2f1f69=_0x17f860;return db[_0x313113+_0x3146('0x69')][_0x3146('0x6a')]({'where':{'id':_0x56ee4d[_0x3146('0x2b')][_0x3146('0x6b')]},'include':[{'model':db[_0x313113+_0x3146('0x6c')],'as':'Interaction'},{'model':db[_0x313113+_0x4522cd],'as':_0x3146('0x66')}]});})[_0x3146('0x1b')](function(_0xe0020b){if(_['isNil'](_0xe0020b)){throw new Error(_0x313113+_0x3146('0x6d'));}_0x310749=_0xe0020b;return _0xe0020b['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x3146('0x1b')](function(){var _0x552e28={'uniqueid':_0x416bd0+'.'+_0x310749['id']+'.'+_0x310749[_0x3146('0x6c')]['id'],'FromUserId':_0x56ee4d[_0x3146('0x2d')]['id'],'type':_0x3146('0x6e')};_0x552e28[_0x313113+_0x3146('0x6f')]=_0x310749['id'];_0x552e28[_0x313113+_0x3146('0x70')]=_0x310749['Interaction']['id'];_0x552e28['From'+_0x313113+_0x4522cd+'Id']=_0x310749[_0x3146('0x66')]['id'];_0x552e28['To'+_0x313113+_0x3146('0x71')]=_0x2f1f69['id'];return db[_0x313113+_0x3146('0x72')][_0x3146('0x73')](_0x552e28);})[_0x3146('0x1b')](function(){return respondWithRpcPromise(_0x3146('0x74'),{'channel':_0x416bd0,'interaction':_0x310749[_0x3146('0x6c')],'message':_0x310749,'account':_0x310749['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2f1f69[_0x3146('0x13')]+','+(_0x310749[_0x3146('0x66')][_0x3146('0x75')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x3146('0x1b')](respondWithResult(_0x124f49,null))[_0x3146('0xe')](handleError(_0x124f49,null));};};exports[_0x3146('0x76')]=function(_0x2e392c,_0x2c2efc){var _0x100a8c,_0x38fcf3;if(_[_0x3146('0x15')](_0x2e392c[_0x3146('0x2b')]['channel'])){throw new Error(_0x3146('0x77'));}var _0x107177=_0x2e392c['body']['channel'];var _0x4a2cab=_['capitalize'](_0x107177);var _0x9dc664=_0x107177===_0x3146('0x64')?_0x3146('0x65'):_0x3146('0x66');return db[_0x3146('0x78')][_0x3146('0x6a')]({'raw':!![],'where':{'id':_0x2e392c['params']['id'],'role':_0x3146('0x39')}})['then'](function(_0x412eaf){if(_[_0x3146('0x15')](_0x412eaf)){throw new Error('Agent\x20not\x20found');}_0x100a8c=_0x412eaf;return db[_0x4a2cab+_0x3146('0x69')][_0x3146('0x6a')]({'where':{'id':_0x2e392c[_0x3146('0x2b')][_0x3146('0x6b')]},'include':[{'model':db[_0x4a2cab+_0x3146('0x6c')],'as':'Interaction'},{'model':db[_0x4a2cab+_0x9dc664],'as':_0x3146('0x66')}]});})['then'](function(_0x1043d8){if(_[_0x3146('0x15')](_0x1043d8)){throw new Error(_0x4a2cab+_0x3146('0x6d'));}_0x38fcf3=_0x1043d8;return _0x1043d8[_0x3146('0x79')]({'read':0x0,'readAt':null,'UserId':null});})[_0x3146('0x1b')](function(){var _0x10fb40={'uniqueid':_0x107177+'.'+_0x38fcf3['id']+'.'+_0x38fcf3[_0x3146('0x6c')]['id'],'FromUserId':_0x2e392c['user']['id'],'type':'agent','ToUserId':_0x100a8c['id']};_0x10fb40[_0x4a2cab+_0x3146('0x6f')]=_0x38fcf3['id'];_0x10fb40[_0x4a2cab+'InteractionId']=_0x38fcf3[_0x3146('0x6c')]['id'];_0x10fb40[_0x3146('0x7a')+_0x4a2cab+_0x9dc664+'Id']=_0x38fcf3[_0x3146('0x66')]['id'];return db[_0x4a2cab+'TransferReport'][_0x3146('0x73')](_0x10fb40);})[_0x3146('0x1b')](function(){return respondWithRpcPromise('Start',{'channel':_0x107177,'interaction':_0x38fcf3[_0x3146('0x6c')],'message':_0x38fcf3,'account':_0x38fcf3['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x100a8c[_0x3146('0x13')]+','+(_0x38fcf3['Account'][_0x3146('0x7b')]||0x12c),'interval':_0x3146('0x7c')}]},routingClient);})[_0x3146('0x1b')](respondWithResult(_0x2c2efc,null))['catch'](handleError(_0x2c2efc,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index d56e062..9ec6b9a 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 _0xd9fb=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/run','run','post','create','update','destroy','exports','multer','util'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xd9fb,0xa0));var _0xbd9f=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xd9fb[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0xbd9f('0x0'));var util=require(_0xbd9f('0x1'));var path=require('path');var timeout=require(_0xbd9f('0x2'));var express=require(_0xbd9f('0x3'));var router=express[_0xbd9f('0x4')]();var fs_extra=require(_0xbd9f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbd9f('0x6'));var config=require(_0xbd9f('0x7'));var controller=require('./schedule.controller');router[_0xbd9f('0x8')]('/',auth[_0xbd9f('0x9')](),controller['index']);router[_0xbd9f('0x8')](_0xbd9f('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xbd9f('0xb'),auth[_0xbd9f('0x9')](),controller[_0xbd9f('0xc')]);router[_0xbd9f('0xd')]('/',auth[_0xbd9f('0x9')](),controller[_0xbd9f('0xe')]);router['put'](_0xbd9f('0xa'),auth[_0xbd9f('0x9')](),controller[_0xbd9f('0xf')]);router['delete'](_0xbd9f('0xa'),auth[_0xbd9f('0x9')](),controller[_0xbd9f('0x10')]);module[_0xbd9f('0x11')]=router; \ No newline at end of file +var _0xecd2=['run','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','isAuthenticated','show'];(function(_0x5a57a3,_0x2a7018){var _0x2ef960=function(_0x9de98f){while(--_0x9de98f){_0x5a57a3['push'](_0x5a57a3['shift']());}};_0x2ef960(++_0x2a7018);}(_0xecd2,0x70));var _0x2ecd=function(_0x580ef7,_0x248901){_0x580ef7=_0x580ef7-0x0;var _0x3f14cb=_0xecd2[_0x580ef7];return _0x3f14cb;};'use strict';var multer=require(_0x2ecd('0x0'));var util=require(_0x2ecd('0x1'));var path=require(_0x2ecd('0x2'));var timeout=require(_0x2ecd('0x3'));var express=require(_0x2ecd('0x4'));var router=express[_0x2ecd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2ecd('0x6'));var interaction=require(_0x2ecd('0x7'));var config=require(_0x2ecd('0x8'));var controller=require(_0x2ecd('0x9'));router[_0x2ecd('0xa')]('/',auth['isAuthenticated'](),controller[_0x2ecd('0xb')]);router[_0x2ecd('0xa')]('/:id',auth[_0x2ecd('0xc')](),controller[_0x2ecd('0xd')]);router[_0x2ecd('0xa')]('/:id/run',auth[_0x2ecd('0xc')](),controller[_0x2ecd('0xe')]);router['post']('/',auth[_0x2ecd('0xc')](),controller['create']);router[_0x2ecd('0xf')](_0x2ecd('0x10'),auth[_0x2ecd('0xc')](),controller[_0x2ecd('0x11')]);router[_0x2ecd('0x12')](_0x2ecd('0x10'),auth[_0x2ecd('0xc')](),controller[_0x2ecd('0x13')]);module[_0x2ecd('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 32c9f1b..cf50e39 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 _0xcdaa=['0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','hours','csv','pdf','xlsx','custom','default','TEXT','exports','STRING','BOOLEAN'];(function(_0x23b6d4,_0x4e78c2){var _0x468e0f=function(_0x37a134){while(--_0x37a134){_0x23b6d4['push'](_0x23b6d4['shift']());}};_0x468e0f(++_0x4e78c2);}(_0xcdaa,0x177));var _0xacda=function(_0x41a29f,_0xa52db8){_0x41a29f=_0x41a29f-0x0;var _0x576b3e=_0xcdaa[_0x41a29f];return _0x576b3e;};'use strict';var Sequelize=require('sequelize');module[_0xacda('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xacda('0x1')]},'active':{'type':Sequelize[_0xacda('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xacda('0x1')],'allowNull':![],'defaultValue':_0xacda('0x3')},'startAt':{'type':Sequelize[_0xacda('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xacda('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xacda('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xacda('0x6')](_0xacda('0x7'),_0xacda('0x8'),_0xacda('0x9'),'weeks',_0xacda('0xa'),_0xacda('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xacda('0xa')},'output':{'type':Sequelize[_0xacda('0x6')](_0xacda('0xc'),_0xacda('0xd'),_0xacda('0xe')),'allowNull':![],'defaultValue':_0xacda('0xc')},'type':{'type':Sequelize[_0xacda('0x6')](_0xacda('0xf'),_0xacda('0x10')),'allowNull':![],'defaultValue':_0xacda('0xf')},'sendMail':{'type':Sequelize[_0xacda('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xacda('0x11')]},'bcc':{'type':Sequelize[_0xacda('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xacda('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x03ed=['months','weeks','hours','minutes','days','csv','pdf','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x58ff0e,_0x3a913a){var _0x48347f=function(_0x32783a){while(--_0x32783a){_0x58ff0e['push'](_0x58ff0e['shift']());}};_0x48347f(++_0x3a913a);}(_0x03ed,0x1c3));var _0xd03e=function(_0x431d42,_0x5b7535){_0x431d42=_0x431d42-0x0;var _0x4dfe0e=_0x03ed[_0x431d42];return _0x4dfe0e;};'use strict';var Sequelize=require(_0xd03e('0x0'));module[_0xd03e('0x1')]={'name':{'type':Sequelize[_0xd03e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd03e('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd03e('0x2')],'allowNull':![],'defaultValue':_0xd03e('0x3')},'startAt':{'type':Sequelize[_0xd03e('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xd03e('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd03e('0x6')](_0xd03e('0x7'),_0xd03e('0x8'),_0xd03e('0x9'),_0xd03e('0xa'),'days',_0xd03e('0xb'),_0xd03e('0xc')),'allowNull':![],'defaultValue':_0xd03e('0xd')},'output':{'type':Sequelize[_0xd03e('0x6')](_0xd03e('0xe'),_0xd03e('0xf'),'xlsx'),'allowNull':![],'defaultValue':_0xd03e('0xe')},'type':{'type':Sequelize['ENUM'](_0xd03e('0x10'),_0xd03e('0x11')),'allowNull':![],'defaultValue':_0xd03e('0x10')},'sendMail':{'type':Sequelize[_0xd03e('0x12')],'defaultValue':![]},'email':{'type':Sequelize[_0xd03e('0x2')]},'cc':{'type':Sequelize[_0xd03e('0x13')]},'bcc':{'type':Sequelize[_0xd03e('0x13')]},'sendIfEmpty':{'type':Sequelize[_0xd03e('0x12')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 2121b61..c2a794e 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 _0xd12a=['name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','sendStatus','error','stack'];(function(_0x4f3dee,_0x46bb90){var _0x291aad=function(_0x3ca8f5){while(--_0x3ca8f5){_0x4f3dee['push'](_0x4f3dee['shift']());}};_0x291aad(++_0x46bb90);}(_0xd12a,0x1dd));var _0xad12=function(_0x18c6ca,_0xe39ee7){_0x18c6ca=_0x18c6ca-0x0;var _0x445129=_0xd12a[_0x18c6ca];return _0x445129;};'use strict';var emlformat=require(_0xad12('0x0'));var rimraf=require(_0xad12('0x1'));var zipdir=require(_0xad12('0x2'));var jsonpatch=require(_0xad12('0x3'));var rp=require(_0xad12('0x4'));var moment=require(_0xad12('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xad12('0x6'));var util=require(_0xad12('0x7'));var path=require(_0xad12('0x8'));var sox=require(_0xad12('0x9'));var csv=require(_0xad12('0xa'));var ejs=require(_0xad12('0xb'));var fs=require('fs');var fs_extra=require(_0xad12('0xc'));var _=require(_0xad12('0xd'));var squel=require(_0xad12('0xe'));var crypto=require(_0xad12('0xf'));var jsforce=require(_0xad12('0x10'));var deskjs=require(_0xad12('0x11'));var toCsv=require('to-csv');var querystring=require(_0xad12('0x12'));var Papa=require(_0xad12('0x13'));var Redis=require(_0xad12('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xad12('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad12('0x16'));var logger=require(_0xad12('0x17'))(_0xad12('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x320d31,_0x459f89){_0x459f89=_0x459f89||0xcc;return function(_0x376b31){if(_0x376b31){return _0x320d31['sendStatus'](_0x459f89);}return _0x320d31['status'](_0x459f89)[_0xad12('0x19')]();};}function respondWithResult(_0xc873f7,_0x291719){_0x291719=_0x291719||0xc8;return function(_0x160b08){if(_0x160b08){return _0xc873f7[_0xad12('0x1a')](_0x291719)[_0xad12('0x1b')](_0x160b08);}};}function respondWithFilteredResult(_0x2512ec,_0x2cdb2c){return function(_0x5f2cbd){if(_0x5f2cbd){var _0x36aaf0=typeof _0x2cdb2c[_0xad12('0x1c')]===_0xad12('0x1d')&&typeof _0x2cdb2c[_0xad12('0x1e')]===_0xad12('0x1d');var _0x34c652=_0x5f2cbd[_0xad12('0x1f')];var _0xd36057=_0x36aaf0?0x0:_0x2cdb2c['offset'];var _0x2741a3=_0x36aaf0?_0x5f2cbd[_0xad12('0x1f')]:_0x2cdb2c[_0xad12('0x1c')]+_0x2cdb2c['limit'];var _0x11f3dc;if(_0x2741a3>=_0x34c652){_0x2741a3=_0x34c652;_0x11f3dc=0xc8;}else{_0x11f3dc=0xce;}_0x2512ec[_0xad12('0x1a')](_0x11f3dc);return _0x2512ec['set'](_0xad12('0x20'),_0xd36057+'-'+_0x2741a3+'/'+_0x34c652)[_0xad12('0x1b')](_0x5f2cbd);}return null;};}function patchUpdates(_0x28f1d7){return function(_0x2d344b){try{jsonpatch[_0xad12('0x21')](_0x2d344b,_0x28f1d7,!![]);}catch(_0x241e17){return BPromise[_0xad12('0x22')](_0x241e17);}return _0x2d344b[_0xad12('0x23')]();};}function saveUpdates(_0x471434,_0x3c2c50){return function(_0x5d5493){if(_0x5d5493){return _0x5d5493[_0xad12('0x24')](_0x471434)[_0xad12('0x25')](function(_0x92d503){return _0x92d503;});}return null;};}function removeEntity(_0x419fde,_0x2ac80b){return function(_0xc137f1){if(_0xc137f1){return _0xc137f1['destroy']()['then'](function(){var _0x1e1b84=_0xc137f1[_0xad12('0x26')]({'plain':!![]});var _0xd576ad=_0xad12('0x27');return db[_0xad12('0x28')][_0xad12('0x29')]({'where':{'type':_0xd576ad,'resourceId':_0x1e1b84['id']}})['then'](function(){return _0xc137f1;});})[_0xad12('0x25')](function(){_0x419fde[_0xad12('0x1a')](0xcc)[_0xad12('0x19')]();});}};}function handleEntityNotFound(_0x71a7d1,_0x4177ba){return function(_0x3cfeb1){if(!_0x3cfeb1){_0x71a7d1[_0xad12('0x2a')](0x194);}return _0x3cfeb1;};}function handleError(_0x12cd86,_0x1aa002){_0x1aa002=_0x1aa002||0x1f4;return function(_0x59ba8e){logger[_0xad12('0x2b')](_0x59ba8e[_0xad12('0x2c')]);if(_0x59ba8e[_0xad12('0x2d')]){delete _0x59ba8e[_0xad12('0x2d')];}_0x12cd86['status'](_0x1aa002)[_0xad12('0x2e')](_0x59ba8e);};}exports[_0xad12('0x2f')]=function(_0x33721f,_0x193803){var _0x3e3022={},_0x5b7c5a={},_0x523955={'count':0x0,'rows':[]};var _0x447e74=_[_0xad12('0x30')](db[_0xad12('0x31')][_0xad12('0x32')],function(_0x22a7a9){return{'name':_0x22a7a9[_0xad12('0x33')],'type':_0x22a7a9[_0xad12('0x34')][_0xad12('0x35')]};});_0x5b7c5a[_0xad12('0x36')]=_[_0xad12('0x30')](_0x447e74,_0xad12('0x2d'));_0x5b7c5a[_0xad12('0x37')]=_[_0xad12('0x38')](_0x33721f[_0xad12('0x37')]);_0x5b7c5a[_0xad12('0x39')]=_['intersection'](_0x5b7c5a[_0xad12('0x36')],_0x5b7c5a['query']);_0x3e3022[_0xad12('0x3a')]=_[_0xad12('0x3b')](_0x5b7c5a[_0xad12('0x36')],qs[_0xad12('0x3c')](_0x33721f[_0xad12('0x37')][_0xad12('0x3c')]));_0x3e3022[_0xad12('0x3a')]=_0x3e3022[_0xad12('0x3a')][_0xad12('0x3d')]?_0x3e3022[_0xad12('0x3a')]:_0x5b7c5a[_0xad12('0x36')];if(!_0x33721f['query']['hasOwnProperty'](_0xad12('0x3e'))){_0x3e3022[_0xad12('0x1e')]=qs['limit'](_0x33721f[_0xad12('0x37')][_0xad12('0x1e')]);_0x3e3022[_0xad12('0x1c')]=qs[_0xad12('0x1c')](_0x33721f[_0xad12('0x37')]['offset']);}_0x3e3022[_0xad12('0x3f')]=qs[_0xad12('0x40')](_0x33721f['query'][_0xad12('0x40')]);_0x3e3022[_0xad12('0x41')]=qs[_0xad12('0x39')](_['pick'](_0x33721f[_0xad12('0x37')],_0x5b7c5a[_0xad12('0x39')]),_0x447e74);if(_0x33721f[_0xad12('0x37')][_0xad12('0x42')]){_0x3e3022[_0xad12('0x41')]=_[_0xad12('0x43')](_0x3e3022[_0xad12('0x41')],{'$or':_[_0xad12('0x30')](_0x447e74,function(_0x38801d){if(_0x38801d[_0xad12('0x34')]!=='VIRTUAL'){var _0x2f99b6={};_0x2f99b6[_0x38801d[_0xad12('0x2d')]]={'$like':'%'+_0x33721f[_0xad12('0x37')]['filter']+'%'};return _0x2f99b6;}})});}_0x3e3022=_[_0xad12('0x43')]({},_0x3e3022,_0x33721f[_0xad12('0x44')]);var _0x4356f8={'where':_0x3e3022[_0xad12('0x41')]};return db['Schedule']['count'](_0x4356f8)[_0xad12('0x25')](function(_0x3fdddf){_0x523955[_0xad12('0x1f')]=_0x3fdddf;if(_0x33721f[_0xad12('0x37')][_0xad12('0x45')]){_0x3e3022['include']=[{'all':!![]}];}return db[_0xad12('0x31')][_0xad12('0x46')](_0x3e3022);})['then'](function(_0x5314d4){_0x523955[_0xad12('0x47')]=_0x5314d4;return _0x523955;})[_0xad12('0x25')](respondWithFilteredResult(_0x193803,_0x3e3022))[_0xad12('0x48')](handleError(_0x193803,null));};exports[_0xad12('0x49')]=function(_0x5a60a8,_0x260185){var _0x156fbd={'raw':![],'where':{'id':_0x5a60a8[_0xad12('0x4a')]['id']}},_0x3183eb={};_0x3183eb['model']=_['keys'](db[_0xad12('0x31')][_0xad12('0x32')]);_0x3183eb['query']=_[_0xad12('0x38')](_0x5a60a8[_0xad12('0x37')]);_0x3183eb['filters']=_[_0xad12('0x3b')](_0x3183eb[_0xad12('0x36')],_0x3183eb[_0xad12('0x37')]);_0x156fbd['attributes']=_['intersection'](_0x3183eb[_0xad12('0x36')],qs[_0xad12('0x3c')](_0x5a60a8['query']['fields']));_0x156fbd[_0xad12('0x3a')]=_0x156fbd[_0xad12('0x3a')][_0xad12('0x3d')]?_0x156fbd[_0xad12('0x3a')]:_0x3183eb[_0xad12('0x36')];if(_0x5a60a8['query']['includeAll']){_0x156fbd['include']=[{'all':!![]}];}_0x156fbd=_[_0xad12('0x43')]({},_0x156fbd,_0x5a60a8[_0xad12('0x44')]);return db[_0xad12('0x31')][_0xad12('0x4b')](_0x156fbd)[_0xad12('0x25')](handleEntityNotFound(_0x260185,null))[_0xad12('0x25')](respondWithResult(_0x260185,null))['catch'](handleError(_0x260185,null));};exports[_0xad12('0x4c')]=function(_0x3885e8,_0x35e209){return db[_0xad12('0x31')][_0xad12('0x4c')](_0x3885e8[_0xad12('0x4d')],{})[_0xad12('0x25')](function(_0x9ecee2){var _0xacc88b=_0x3885e8[_0xad12('0x4e')]['get']({'plain':!![]});if(!_0xacc88b)throw new Error(_0xad12('0x4f'));if(_0xacc88b[_0xad12('0x50')]===_0xad12('0x4e')){var _0x2f035b=_0x9ecee2[_0xad12('0x26')]({'plain':!![]});var _0x53ffb6='Scheduler';return db[_0xad12('0x51')][_0xad12('0x4b')]({'where':{'name':_0x53ffb6,'userProfileId':_0xacc88b[_0xad12('0x52')]},'raw':!![]})[_0xad12('0x25')](function(_0x369ae5){if(_0x369ae5&&_0x369ae5[_0xad12('0x53')]===0x0){return db[_0xad12('0x28')][_0xad12('0x4c')]({'name':_0x2f035b[_0xad12('0x2d')],'resourceId':_0x2f035b['id'],'type':_0x369ae5[_0xad12('0x2d')],'sectionId':_0x369ae5['id']},{})['then'](function(){return _0x9ecee2;});}else{return _0x9ecee2;}})[_0xad12('0x48')](function(_0x7f061){logger[_0xad12('0x2b')](_0xad12('0x54'),_0x7f061);throw _0x7f061;});}return _0x9ecee2;})[_0xad12('0x25')](respondWithResult(_0x35e209,0xc9))[_0xad12('0x48')](handleError(_0x35e209,null));};exports[_0xad12('0x24')]=function(_0x1f6f89,_0x44fe08){if(_0x1f6f89[_0xad12('0x4d')]['id']){delete _0x1f6f89[_0xad12('0x4d')]['id'];}return db['Schedule']['find']({'where':{'id':_0x1f6f89[_0xad12('0x4a')]['id']}})[_0xad12('0x25')](handleEntityNotFound(_0x44fe08,null))[_0xad12('0x25')](saveUpdates(_0x1f6f89['body'],null))[_0xad12('0x25')](respondWithResult(_0x44fe08,null))[_0xad12('0x48')](handleError(_0x44fe08,null));};exports['destroy']=function(_0x443a61,_0xb0c9){return db[_0xad12('0x31')]['find']({'where':{'id':_0x443a61[_0xad12('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb0c9,null))['then'](removeEntity(_0xb0c9,null))[_0xad12('0x48')](handleError(_0xb0c9,null));};exports[_0xad12('0x55')]=function(_0x50a72d,_0x35b00e,_0x13aecb){var _0x12da4a=require(_0xad12('0x56'));return db[_0xad12('0x31')][_0xad12('0x4b')]({'where':{'id':_0x50a72d[_0xad12('0x4a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x35b00e,null))[_0xad12('0x25')](function(){_0x12da4a['run'](_0x50a72d[_0xad12('0x4a')]['id']);})[_0xad12('0x25')](respondWithStatusCode(_0x35b00e,null))[_0xad12('0x48')](handleError(_0x35b00e,null));}; \ No newline at end of file +var _0x32e9=['util','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','stack','name','send','index','map','Schedule','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','keys','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x2ba7f4,_0x2fbe08){var _0x531e12=function(_0x2ed116){while(--_0x2ed116){_0x2ba7f4['push'](_0x2ba7f4['shift']());}};_0x531e12(++_0x2fbe08);}(_0x32e9,0xa6));var _0x932e=function(_0x3c62ab,_0x33f23d){_0x3c62ab=_0x3c62ab-0x0;var _0x536970=_0x32e9[_0x3c62ab];return _0x536970;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x932e('0x0'));var zipdir=require(_0x932e('0x1'));var jsonpatch=require(_0x932e('0x2'));var rp=require(_0x932e('0x3'));var moment=require(_0x932e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x932e('0x5'));var util=require(_0x932e('0x6'));var path=require('path');var sox=require(_0x932e('0x7'));var csv=require('to-csv');var ejs=require(_0x932e('0x8'));var fs=require('fs');var fs_extra=require(_0x932e('0x9'));var _=require(_0x932e('0xa'));var squel=require(_0x932e('0xb'));var crypto=require(_0x932e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x932e('0xd'));var querystring=require(_0x932e('0xe'));var Papa=require(_0x932e('0xf'));var Redis=require(_0x932e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x932e('0x11'));var as=require(_0x932e('0x12'));var hardwareService=require(_0x932e('0x13'));var logger=require(_0x932e('0x14'))('api');var utils=require(_0x932e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x932e('0x16'));var db=require(_0x932e('0x17'))['db'];function respondWithStatusCode(_0x2dc464,_0x2998a9){_0x2998a9=_0x2998a9||0xcc;return function(_0x17faf8){if(_0x17faf8){return _0x2dc464['sendStatus'](_0x2998a9);}return _0x2dc464[_0x932e('0x18')](_0x2998a9)[_0x932e('0x19')]();};}function respondWithResult(_0x425940,_0x4fea1d){_0x4fea1d=_0x4fea1d||0xc8;return function(_0x11f2ee){if(_0x11f2ee){return _0x425940['status'](_0x4fea1d)[_0x932e('0x1a')](_0x11f2ee);}};}function respondWithFilteredResult(_0x45f456,_0x1f386a){return function(_0x461e52){if(_0x461e52){var _0x3c906b=typeof _0x1f386a[_0x932e('0x1b')]==='undefined'&&typeof _0x1f386a[_0x932e('0x1c')]==='undefined';var _0x28b8c0=_0x461e52[_0x932e('0x1d')];var _0x35e099=_0x3c906b?0x0:_0x1f386a['offset'];var _0x15034a=_0x3c906b?_0x461e52['count']:_0x1f386a[_0x932e('0x1b')]+_0x1f386a['limit'];var _0x55c8fc;if(_0x15034a>=_0x28b8c0){_0x15034a=_0x28b8c0;_0x55c8fc=0xc8;}else{_0x55c8fc=0xce;}_0x45f456['status'](_0x55c8fc);return _0x45f456[_0x932e('0x1e')](_0x932e('0x1f'),_0x35e099+'-'+_0x15034a+'/'+_0x28b8c0)[_0x932e('0x1a')](_0x461e52);}return null;};}function patchUpdates(_0x3c9fad){return function(_0x4204ad){try{jsonpatch[_0x932e('0x20')](_0x4204ad,_0x3c9fad,!![]);}catch(_0xd31e2a){return BPromise[_0x932e('0x21')](_0xd31e2a);}return _0x4204ad[_0x932e('0x22')]();};}function saveUpdates(_0x1d089a,_0xcb46ed){return function(_0x52f29d){if(_0x52f29d){return _0x52f29d[_0x932e('0x23')](_0x1d089a)[_0x932e('0x24')](function(_0x18acf5){return _0x18acf5;});}return null;};}function removeEntity(_0x260da8,_0x26d9cf){return function(_0x5aeacc){if(_0x5aeacc){return _0x5aeacc[_0x932e('0x25')]()[_0x932e('0x24')](function(){var _0x435083=_0x5aeacc[_0x932e('0x26')]({'plain':!![]});var _0x3ead14='Scheduler';return db['UserProfileResource']['destroy']({'where':{'type':_0x3ead14,'resourceId':_0x435083['id']}})[_0x932e('0x24')](function(){return _0x5aeacc;});})[_0x932e('0x24')](function(){_0x260da8[_0x932e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x591b30,_0x4d98bc){return function(_0x363343){if(!_0x363343){_0x591b30[_0x932e('0x27')](0x194);}return _0x363343;};}function handleError(_0x5759d8,_0x31ec32){_0x31ec32=_0x31ec32||0x1f4;return function(_0x556b3a){logger[_0x932e('0x28')](_0x556b3a[_0x932e('0x29')]);if(_0x556b3a['name']){delete _0x556b3a[_0x932e('0x2a')];}_0x5759d8[_0x932e('0x18')](_0x31ec32)[_0x932e('0x2b')](_0x556b3a);};}exports[_0x932e('0x2c')]=function(_0x3736be,_0x59eda3){var _0x5870b9={},_0x27eaf9={},_0x33c403={'count':0x0,'rows':[]};var _0x2fe595=_[_0x932e('0x2d')](db[_0x932e('0x2e')][_0x932e('0x2f')],function(_0x162f11){return{'name':_0x162f11['fieldName'],'type':_0x162f11['type'][_0x932e('0x30')]};});_0x27eaf9[_0x932e('0x31')]=_[_0x932e('0x2d')](_0x2fe595,'name');_0x27eaf9[_0x932e('0x32')]=_['keys'](_0x3736be[_0x932e('0x32')]);_0x27eaf9['filters']=_[_0x932e('0x33')](_0x27eaf9[_0x932e('0x31')],_0x27eaf9[_0x932e('0x32')]);_0x5870b9[_0x932e('0x34')]=_[_0x932e('0x33')](_0x27eaf9[_0x932e('0x31')],qs[_0x932e('0x35')](_0x3736be['query'][_0x932e('0x35')]));_0x5870b9[_0x932e('0x34')]=_0x5870b9[_0x932e('0x34')][_0x932e('0x36')]?_0x5870b9[_0x932e('0x34')]:_0x27eaf9[_0x932e('0x31')];if(!_0x3736be[_0x932e('0x32')][_0x932e('0x37')]('nolimit')){_0x5870b9[_0x932e('0x1c')]=qs['limit'](_0x3736be['query']['limit']);_0x5870b9[_0x932e('0x1b')]=qs[_0x932e('0x1b')](_0x3736be[_0x932e('0x32')][_0x932e('0x1b')]);}_0x5870b9[_0x932e('0x38')]=qs[_0x932e('0x39')](_0x3736be['query'][_0x932e('0x39')]);_0x5870b9['where']=qs[_0x932e('0x3a')](_[_0x932e('0x3b')](_0x3736be[_0x932e('0x32')],_0x27eaf9[_0x932e('0x3a')]),_0x2fe595);if(_0x3736be[_0x932e('0x32')][_0x932e('0x3c')]){_0x5870b9[_0x932e('0x3d')]=_[_0x932e('0x3e')](_0x5870b9[_0x932e('0x3d')],{'$or':_[_0x932e('0x2d')](_0x2fe595,function(_0x174d15){if(_0x174d15['type']!==_0x932e('0x3f')){var _0x3b1991={};_0x3b1991[_0x174d15[_0x932e('0x2a')]]={'$like':'%'+_0x3736be[_0x932e('0x32')]['filter']+'%'};return _0x3b1991;}})});}_0x5870b9=_[_0x932e('0x3e')]({},_0x5870b9,_0x3736be['options']);var _0x2c38ae={'where':_0x5870b9[_0x932e('0x3d')]};return db[_0x932e('0x2e')][_0x932e('0x1d')](_0x2c38ae)['then'](function(_0x495a3a){_0x33c403[_0x932e('0x1d')]=_0x495a3a;if(_0x3736be[_0x932e('0x32')]['includeAll']){_0x5870b9[_0x932e('0x40')]=[{'all':!![]}];}return db[_0x932e('0x2e')][_0x932e('0x41')](_0x5870b9);})[_0x932e('0x24')](function(_0x30c529){_0x33c403[_0x932e('0x42')]=_0x30c529;return _0x33c403;})[_0x932e('0x24')](respondWithFilteredResult(_0x59eda3,_0x5870b9))[_0x932e('0x43')](handleError(_0x59eda3,null));};exports[_0x932e('0x44')]=function(_0x328c60,_0x228b83){var _0x152acb={'raw':![],'where':{'id':_0x328c60['params']['id']}},_0xb59270={};_0xb59270[_0x932e('0x31')]=_[_0x932e('0x45')](db[_0x932e('0x2e')]['rawAttributes']);_0xb59270[_0x932e('0x32')]=_[_0x932e('0x45')](_0x328c60['query']);_0xb59270['filters']=_[_0x932e('0x33')](_0xb59270[_0x932e('0x31')],_0xb59270[_0x932e('0x32')]);_0x152acb[_0x932e('0x34')]=_[_0x932e('0x33')](_0xb59270[_0x932e('0x31')],qs['fields'](_0x328c60['query'][_0x932e('0x35')]));_0x152acb[_0x932e('0x34')]=_0x152acb[_0x932e('0x34')]['length']?_0x152acb['attributes']:_0xb59270[_0x932e('0x31')];if(_0x328c60[_0x932e('0x32')][_0x932e('0x46')]){_0x152acb[_0x932e('0x40')]=[{'all':!![]}];}_0x152acb=_[_0x932e('0x3e')]({},_0x152acb,_0x328c60[_0x932e('0x47')]);return db[_0x932e('0x2e')]['find'](_0x152acb)[_0x932e('0x24')](handleEntityNotFound(_0x228b83,null))[_0x932e('0x24')](respondWithResult(_0x228b83,null))['catch'](handleError(_0x228b83,null));};exports['create']=function(_0x380625,_0x449703){return db['Schedule'][_0x932e('0x48')](_0x380625[_0x932e('0x49')],{})[_0x932e('0x24')](function(_0x43bad6){var _0x14c26c=_0x380625[_0x932e('0x4a')]['get']({'plain':!![]});if(!_0x14c26c)throw new Error(_0x932e('0x4b'));if(_0x14c26c[_0x932e('0x4c')]==='user'){var _0x1499a8=_0x43bad6['get']({'plain':!![]});var _0xdd2022=_0x932e('0x4d');return db[_0x932e('0x4e')][_0x932e('0x4f')]({'where':{'name':_0xdd2022,'userProfileId':_0x14c26c[_0x932e('0x50')]},'raw':!![]})[_0x932e('0x24')](function(_0x935cd1){if(_0x935cd1&&_0x935cd1['autoAssociation']===0x0){return db[_0x932e('0x51')][_0x932e('0x48')]({'name':_0x1499a8[_0x932e('0x2a')],'resourceId':_0x1499a8['id'],'type':_0x935cd1[_0x932e('0x2a')],'sectionId':_0x935cd1['id']},{})[_0x932e('0x24')](function(){return _0x43bad6;});}else{return _0x43bad6;}})[_0x932e('0x43')](function(_0x4d783a){logger['error'](_0x932e('0x52'),_0x4d783a);throw _0x4d783a;});}return _0x43bad6;})[_0x932e('0x24')](respondWithResult(_0x449703,0xc9))['catch'](handleError(_0x449703,null));};exports[_0x932e('0x23')]=function(_0x5da042,_0x3ad1aa){if(_0x5da042['body']['id']){delete _0x5da042[_0x932e('0x49')]['id'];}return db[_0x932e('0x2e')][_0x932e('0x4f')]({'where':{'id':_0x5da042['params']['id']}})[_0x932e('0x24')](handleEntityNotFound(_0x3ad1aa,null))['then'](saveUpdates(_0x5da042[_0x932e('0x49')],null))['then'](respondWithResult(_0x3ad1aa,null))[_0x932e('0x43')](handleError(_0x3ad1aa,null));};exports['destroy']=function(_0x2d4e7f,_0x8bcb44){return db[_0x932e('0x2e')][_0x932e('0x4f')]({'where':{'id':_0x2d4e7f[_0x932e('0x53')]['id']}})[_0x932e('0x24')](handleEntityNotFound(_0x8bcb44,null))['then'](removeEntity(_0x8bcb44,null))['catch'](handleError(_0x8bcb44,null));};exports[_0x932e('0x54')]=function(_0x293fc5,_0x2ce25b,_0x13e83e){var _0x5378e0=require(_0x932e('0x55'));return db[_0x932e('0x2e')][_0x932e('0x4f')]({'where':{'id':_0x293fc5[_0x932e('0x53')]['id']},'raw':!![]})[_0x932e('0x24')](handleEntityNotFound(_0x2ce25b,null))[_0x932e('0x24')](function(){_0x5378e0[_0x932e('0x54')](_0x293fc5['params']['id']);})['then'](respondWithStatusCode(_0x2ce25b,null))[_0x932e('0x43')](handleError(_0x2ce25b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 9b810e5..20f1ebc 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 _0x15f1=['request-promise','path','rimraf','./schedule.attributes','define','Schedule','lodash','moment','bluebird'];(function(_0xe10cff,_0x3816a3){var _0x252c74=function(_0x560f46){while(--_0x560f46){_0xe10cff['push'](_0xe10cff['shift']());}};_0x252c74(++_0x3816a3);}(_0x15f1,0xa8));var _0x115f=function(_0x3d28b8,_0x4ee274){_0x3d28b8=_0x3d28b8-0x0;var _0x18834b=_0x15f1[_0x3d28b8];return _0x18834b;};'use strict';var _=require(_0x115f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x115f('0x1'));var BPromise=require(_0x115f('0x2'));var rp=require(_0x115f('0x3'));var fs=require('fs');var path=require(_0x115f('0x4'));var rimraf=require(_0x115f('0x5'));var config=require('../../config/environment');var attributes=require(_0x115f('0x6'));module['exports']=function(_0x1478fd,_0x3391bc){return _0x1478fd[_0x115f('0x7')](_0x115f('0x8'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb11=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb11,0x6c));var _0x1db1=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb11[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1db1('0x0'));var util=require('util');var logger=require(_0x1db1('0x1'))(_0x1db1('0x2'));var moment=require(_0x1db1('0x3'));var BPromise=require(_0x1db1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1db1('0x5'));var rimraf=require(_0x1db1('0x6'));var config=require(_0x1db1('0x7'));var attributes=require(_0x1db1('0x8'));module[_0x1db1('0x9')]=function(_0x50e31b,_0x1a29a9){return _0x50e31b[_0x1db1('0xa')](_0x1db1('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 9d26a03..120e31f 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 _0x51b3=['rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','Schedule,\x20%s,\x20%s','info','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x43f939,_0xcb2598){var _0x1be640=function(_0x2a6bb0){while(--_0x2a6bb0){_0x43f939['push'](_0x43f939['shift']());}};_0x1be640(++_0xcb2598);}(_0x51b3,0x86));var _0x351b=function(_0x3981fb,_0x5c1a52){_0x3981fb=_0x3981fb-0x0;var _0x1f0d29=_0x51b3[_0x3981fb];return _0x1f0d29;};'use strict';var _=require(_0x351b('0x0'));var util=require(_0x351b('0x1'));var moment=require('moment');var BPromise=require(_0x351b('0x2'));var rs=require(_0x351b('0x3'));var fs=require('fs');var Redis=require(_0x351b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x351b('0x5'));var logger=require('../../config/logger')(_0x351b('0x6'));var config=require(_0x351b('0x7'));var jayson=require(_0x351b('0x8'));var client=jayson[_0x351b('0x9')][_0x351b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10522e,_0x163980,_0x46b518){return new BPromise(function(_0x2bcfd5,_0x3889a1){return client['request'](_0x10522e,_0x46b518)['then'](function(_0x5e3845){logger['info']('Schedule,\x20%s,\x20%s',_0x163980,_0x351b('0xb'));logger[_0x351b('0xc')](_0x351b('0xd'),_0x163980,'request\x20sent',JSON['stringify'](_0x5e3845));if(_0x5e3845[_0x351b('0xe')]){if(_0x5e3845['error'][_0x351b('0xf')]===0x1f4){logger[_0x351b('0xe')]('Schedule,\x20%s,\x20%s',_0x163980,_0x5e3845[_0x351b('0xe')][_0x351b('0x10')]);return _0x3889a1(_0x5e3845[_0x351b('0xe')][_0x351b('0x10')]);}logger[_0x351b('0xe')](_0x351b('0x11'),_0x163980,_0x5e3845[_0x351b('0xe')][_0x351b('0x10')]);return _0x2bcfd5(_0x5e3845[_0x351b('0xe')][_0x351b('0x10')]);}else{logger[_0x351b('0x12')](_0x351b('0x11'),_0x163980,_0x351b('0xb'));_0x2bcfd5(_0x5e3845['result'][_0x351b('0x10')]);}})[_0x351b('0x13')](function(_0x5d9321){logger[_0x351b('0xe')](_0x351b('0x11'),_0x163980,_0x5d9321);_0x3889a1(_0x5d9321);});});} \ No newline at end of file +var _0xd28a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','Schedule,\x20%s,\x20%s','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b6032,_0x4abe29){var _0x3a9055=function(_0x276e17){while(--_0x276e17){_0x5b6032['push'](_0x5b6032['shift']());}};_0x3a9055(++_0x4abe29);}(_0xd28a,0x186));var _0xad28=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xd28a[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0xad28('0x0'));var moment=require(_0xad28('0x1'));var BPromise=require(_0xad28('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad28('0x3'));var db=require(_0xad28('0x4'))['db'];var utils=require(_0xad28('0x5'));var logger=require(_0xad28('0x6'))(_0xad28('0x7'));var config=require(_0xad28('0x8'));var jayson=require(_0xad28('0x9'));var client=jayson[_0xad28('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1edc53,_0x1f4b02,_0x497279){return new BPromise(function(_0x2fe806,_0x1d50b8){return client[_0xad28('0xb')](_0x1edc53,_0x497279)[_0xad28('0xc')](function(_0x234248){logger[_0xad28('0xd')]('Schedule,\x20%s,\x20%s',_0x1f4b02,_0xad28('0xe'));logger[_0xad28('0xf')](_0xad28('0x10'),_0x1f4b02,'request\x20sent',JSON[_0xad28('0x11')](_0x234248));if(_0x234248[_0xad28('0x12')]){if(_0x234248['error']['code']===0x1f4){logger[_0xad28('0x12')](_0xad28('0x13'),_0x1f4b02,_0x234248[_0xad28('0x12')][_0xad28('0x14')]);return _0x1d50b8(_0x234248[_0xad28('0x12')]['message']);}logger[_0xad28('0x12')]('Schedule,\x20%s,\x20%s',_0x1f4b02,_0x234248[_0xad28('0x12')]['message']);return _0x2fe806(_0x234248['error'][_0xad28('0x14')]);}else{logger[_0xad28('0xd')](_0xad28('0x13'),_0x1f4b02,_0xad28('0xe'));_0x2fe806(_0x234248[_0xad28('0x15')][_0xad28('0x14')]);}})['catch'](function(_0x471c5a){logger[_0xad28('0x12')](_0xad28('0x13'),_0x1f4b02,_0x471c5a);_0x1d50b8(_0x471c5a);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 3af2554..ee21966 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 _0x5323=['get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller'];(function(_0x5618dd,_0x55f766){var _0x46f223=function(_0x4b6f81){while(--_0x4b6f81){_0x5618dd['push'](_0x5618dd['shift']());}};_0x46f223(++_0x55f766);}(_0x5323,0x6e));var _0x3532=function(_0x27ea1c,_0x6dc6db){_0x27ea1c=_0x27ea1c-0x0;var _0x35711a=_0x5323[_0x27ea1c];return _0x35711a;};'use strict';var multer=require(_0x3532('0x0'));var util=require(_0x3532('0x1'));var path=require(_0x3532('0x2'));var timeout=require(_0x3532('0x3'));var express=require(_0x3532('0x4'));var router=express[_0x3532('0x5')]();var fs_extra=require(_0x3532('0x6'));var auth=require(_0x3532('0x7'));var interaction=require(_0x3532('0x8'));var config=require('../../config/environment');var controller=require(_0x3532('0x9'));router[_0x3532('0xa')]('/',auth[_0x3532('0xb')](),controller[_0x3532('0xc')]);router[_0x3532('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x3532('0xd')]);router[_0x3532('0xa')](_0x3532('0xe'),auth[_0x3532('0xb')](),controller[_0x3532('0xf')]);router[_0x3532('0xa')](_0x3532('0x10'),auth[_0x3532('0xb')](),controller[_0x3532('0x11')]);router[_0x3532('0x12')]('/',auth[_0x3532('0xb')](),controller['create']);router[_0x3532('0x13')](_0x3532('0xe'),auth[_0x3532('0xb')](),controller[_0x3532('0x14')]);router[_0x3532('0x15')](_0x3532('0xe'),auth['isAuthenticated'](),controller[_0x3532('0x16')]);module[_0x3532('0x17')]=router; \ No newline at end of file +var _0x81e8=['./screenRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x199b8a,_0x183586){var _0x4f5766=function(_0x4fad4f){while(--_0x4fad4f){_0x199b8a['push'](_0x199b8a['shift']());}};_0x4f5766(++_0x183586);}(_0x81e8,0x10b));var _0x881e=function(_0x32264d,_0x21dda3){_0x32264d=_0x32264d-0x0;var _0x4e96a0=_0x81e8[_0x32264d];return _0x4e96a0;};'use strict';var multer=require(_0x881e('0x0'));var util=require(_0x881e('0x1'));var path=require(_0x881e('0x2'));var timeout=require(_0x881e('0x3'));var express=require(_0x881e('0x4'));var router=express[_0x881e('0x5')]();var fs_extra=require(_0x881e('0x6'));var auth=require(_0x881e('0x7'));var interaction=require(_0x881e('0x8'));var config=require('../../config/environment');var controller=require(_0x881e('0x9'));router[_0x881e('0xa')]('/',auth[_0x881e('0xb')](),controller[_0x881e('0xc')]);router[_0x881e('0xa')]('/describe',auth[_0x881e('0xb')](),controller[_0x881e('0xd')]);router[_0x881e('0xa')](_0x881e('0xe'),auth[_0x881e('0xb')](),controller[_0x881e('0xf')]);router['get'](_0x881e('0x10'),auth['isAuthenticated'](),controller[_0x881e('0x11')]);router[_0x881e('0x12')]('/',auth[_0x881e('0xb')](),controller[_0x881e('0x13')]);router['put'](_0x881e('0xe'),auth[_0x881e('0xb')](),controller['update']);router[_0x881e('0x14')]('/:id',auth[_0x881e('0xb')](),controller[_0x881e('0x15')]);module[_0x881e('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 2c148ef..4e66689 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 _0x7e27=['value','STRING','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','extname'];(function(_0x127db2,_0x17a1c6){var _0x4a075f=function(_0x41ac05){while(--_0x41ac05){_0x127db2['push'](_0x127db2['shift']());}};_0x4a075f(++_0x17a1c6);}(_0x7e27,0xdd));var _0x77e2=function(_0xb291f8,_0x275b03){_0xb291f8=_0xb291f8-0x0;var _0xf55b5=_0x7e27[_0xb291f8];return _0xf55b5;};'use strict';var Sequelize=require(_0x77e2('0x0'));var moment=require(_0x77e2('0x1'));var path=require('path');var config=require(_0x77e2('0x2'));module[_0x77e2('0x3')]={'format':{'type':Sequelize[_0x77e2('0x4')],'get':function(){return this[_0x77e2('0x5')]('value')?path[_0x77e2('0x6')](this[_0x77e2('0x5')](_0x77e2('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x77e2('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x101e56){var _0x137a61=_0x101e56['replace'](/\\/g,'/');this[_0x77e2('0x9')](_0x77e2('0x7'),_0x137a61);}},'rating':{'type':Sequelize[_0x77e2('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x77e2('0xa')],'set':function(_0x3802ce){this[_0x77e2('0x9')](_0x77e2('0xb'),moment()['subtract'](_0x3802ce,'ms'));this['setDataValue'](_0x77e2('0xc'),moment());this['setDataValue'](_0x77e2('0xd'),_0x3802ce);}},'startedAt':{'type':Sequelize[_0x77e2('0xe')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x77e2('0xf')](_0x77e2('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0x77e2('0xe')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x77e2('0xf')](_0x77e2('0x10'))[_0x77e2('0x11')]();}},'createdAt':{'type':Sequelize[_0x77e2('0xe')],'get':function(){return moment(this[_0x77e2('0x5')]('createdAt'))[_0x77e2('0xf')](_0x77e2('0x10'))['toString']();}},'updatedAt':{'type':Sequelize[_0x77e2('0xe')],'get':function(){return moment(this[_0x77e2('0x5')](_0x77e2('0x12')))[_0x77e2('0xf')](_0x77e2('0x10'))[_0x77e2('0x11')]();}}}; \ No newline at end of file +var _0xc74c=['extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','exports','VIRTUAL','value'];(function(_0x35a140,_0x3aeac6){var _0x30ab82=function(_0x15a7c3){while(--_0x15a7c3){_0x35a140['push'](_0x35a140['shift']());}};_0x30ab82(++_0x3aeac6);}(_0xc74c,0x163));var _0xcc74=function(_0x19aaa0,_0x3e0ed1){_0x19aaa0=_0x19aaa0-0x0;var _0x1d1ce0=_0xc74c[_0x19aaa0];return _0x1d1ce0;};'use strict';var Sequelize=require(_0xcc74('0x0'));var moment=require(_0xcc74('0x1'));var path=require('path');var config=require('../../config/environment');module[_0xcc74('0x2')]={'format':{'type':Sequelize[_0xcc74('0x3')],'get':function(){return this['getDataValue'](_0xcc74('0x4'))?path[_0xcc74('0x5')](this[_0xcc74('0x6')](_0xcc74('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xcc74('0x7')]},'channel':{'type':Sequelize[_0xcc74('0x7')]},'value':{'type':Sequelize[_0xcc74('0x7')],'set':function(_0x5d46a6){var _0x15248f=_0x5d46a6[_0xcc74('0x8')](/\\/g,'/');this[_0xcc74('0x9')](_0xcc74('0x4'),_0x15248f);}},'rating':{'type':Sequelize[_0xcc74('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4b4534){this[_0xcc74('0x9')](_0xcc74('0xb'),moment()[_0xcc74('0xc')](_0x4b4534,'ms'));this['setDataValue'](_0xcc74('0xd'),moment());this[_0xcc74('0x9')](_0xcc74('0xe'),_0x4b4534);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xcc74('0x6')]('startedAt'))[_0xcc74('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xcc74('0x6')](_0xcc74('0xd')))[_0xcc74('0xf')](_0xcc74('0x10'))[_0xcc74('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xcc74('0x6')](_0xcc74('0x12')))[_0xcc74('0xf')](_0xcc74('0x10'))[_0xcc74('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xcc74('0x6')](_0xcc74('0x13')))[_0xcc74('0xf')](_0xcc74('0x10'))[_0xcc74('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index fe6e3cd..81695e7 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 _0x5075=['send','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','end','error','name','index','map','ScreenRecording','rawAttributes','fieldName','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message'];(function(_0x46b3cc,_0x160bd7){var _0x1825b0=function(_0x35fd73){while(--_0x35fd73){_0x46b3cc['push'](_0x46b3cc['shift']());}};_0x1825b0(++_0x160bd7);}(_0x5075,0x73));var _0x5507=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5075[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x5507('0x0'));var rimraf=require(_0x5507('0x1'));var zipdir=require(_0x5507('0x2'));var jsonpatch=require(_0x5507('0x3'));var rp=require(_0x5507('0x4'));var moment=require(_0x5507('0x5'));var BPromise=require(_0x5507('0x6'));var Mustache=require('mustache');var util=require(_0x5507('0x7'));var path=require(_0x5507('0x8'));var sox=require(_0x5507('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5507('0xa'));var _=require(_0x5507('0xb'));var squel=require('squel');var crypto=require(_0x5507('0xc'));var jsforce=require(_0x5507('0xd'));var deskjs=require(_0x5507('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5507('0xf'));var Redis=require(_0x5507('0x10'));var authService=require(_0x5507('0x11'));var qs=require(_0x5507('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5507('0x13'));var logger=require(_0x5507('0x14'))('api');var utils=require(_0x5507('0x15'));var config=require(_0x5507('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5507('0x17'))['db'];function respondWithStatusCode(_0x2a2ea0,_0x32c872){_0x32c872=_0x32c872||0xcc;return function(_0x267f27){if(_0x267f27){return _0x2a2ea0[_0x5507('0x18')](_0x32c872);}return _0x2a2ea0[_0x5507('0x19')](_0x32c872)['end']();};}function respondWithResult(_0x9cc3f9,_0x2b7c43){_0x2b7c43=_0x2b7c43||0xc8;return function(_0xc828e5){if(_0xc828e5){return _0x9cc3f9[_0x5507('0x19')](_0x2b7c43)['json'](_0xc828e5);}};}function respondWithFilteredResult(_0x49e400,_0x10d7b9){return function(_0x2dfd06){if(_0x2dfd06){var _0x1ab167=typeof _0x10d7b9[_0x5507('0x1a')]===_0x5507('0x1b')&&typeof _0x10d7b9[_0x5507('0x1c')]===_0x5507('0x1b');var _0x3d1619=_0x2dfd06[_0x5507('0x1d')];var _0x233b6a=_0x1ab167?0x0:_0x10d7b9[_0x5507('0x1a')];var _0x3822dd=_0x1ab167?_0x2dfd06['count']:_0x10d7b9[_0x5507('0x1a')]+_0x10d7b9[_0x5507('0x1c')];var _0x4054c6;if(_0x3822dd>=_0x3d1619){_0x3822dd=_0x3d1619;_0x4054c6=0xc8;}else{_0x4054c6=0xce;}_0x49e400[_0x5507('0x19')](_0x4054c6);return _0x49e400['set'](_0x5507('0x1e'),_0x233b6a+'-'+_0x3822dd+'/'+_0x3d1619)[_0x5507('0x1f')](_0x2dfd06);}return null;};}function patchUpdates(_0x1a54b0){return function(_0x3ca1f7){try{jsonpatch[_0x5507('0x20')](_0x3ca1f7,_0x1a54b0,!![]);}catch(_0x1be8b1){return BPromise['reject'](_0x1be8b1);}return _0x3ca1f7[_0x5507('0x21')]();};}function saveUpdates(_0x105535,_0x1f6325){return function(_0xa3e2cf){if(_0xa3e2cf){return _0xa3e2cf[_0x5507('0x22')](_0x105535)[_0x5507('0x23')](function(_0x1fcc8d){return _0x1fcc8d;});}return null;};}function removeEntity(_0x10f149,_0x398911){return function(_0xa47641){if(_0xa47641){return _0xa47641[_0x5507('0x24')]()[_0x5507('0x23')](function(){_0x10f149[_0x5507('0x19')](0xcc)[_0x5507('0x25')]();});}};}function handleEntityNotFound(_0x1a2203,_0x4915ed){return function(_0x4e8906){if(!_0x4e8906){_0x1a2203['sendStatus'](0x194);}return _0x4e8906;};}function handleError(_0x26335e,_0x4ea271){_0x4ea271=_0x4ea271||0x1f4;return function(_0xa66a01){logger[_0x5507('0x26')](_0xa66a01['stack']);if(_0xa66a01['name']){delete _0xa66a01[_0x5507('0x27')];}_0x26335e[_0x5507('0x19')](_0x4ea271)['send'](_0xa66a01);};}exports[_0x5507('0x28')]=function(_0x24574b,_0x85d383){var _0x38f4d9={},_0x1e5ce6={},_0x14fdea={'count':0x0,'rows':[]};var _0x55e889=_[_0x5507('0x29')](db[_0x5507('0x2a')][_0x5507('0x2b')],function(_0x38f0f5){return{'name':_0x38f0f5[_0x5507('0x2c')],'type':_0x38f0f5['type']['key']};});_0x1e5ce6[_0x5507('0x2d')]=_[_0x5507('0x2e')](_[_0x5507('0x29')](_0x55e889,_0x5507('0x27')),['format']);_0x1e5ce6[_0x5507('0x2f')]=_[_0x5507('0x30')](_0x24574b[_0x5507('0x2f')]);_0x1e5ce6[_0x5507('0x31')]=_[_0x5507('0x32')](_0x1e5ce6[_0x5507('0x2d')],_0x1e5ce6[_0x5507('0x2f')]);_0x38f4d9[_0x5507('0x33')]=_['intersection'](_0x1e5ce6[_0x5507('0x2d')],qs[_0x5507('0x34')](_0x24574b[_0x5507('0x2f')]['fields']));_0x38f4d9['attributes']=_0x38f4d9[_0x5507('0x33')][_0x5507('0x35')]?_0x38f4d9[_0x5507('0x33')]:_0x1e5ce6[_0x5507('0x2d')];if(!_0x24574b[_0x5507('0x2f')]['hasOwnProperty']('nolimit')){_0x38f4d9[_0x5507('0x1c')]=qs[_0x5507('0x1c')](_0x24574b[_0x5507('0x2f')][_0x5507('0x1c')]);_0x38f4d9['offset']=qs['offset'](_0x24574b[_0x5507('0x2f')]['offset']);}_0x38f4d9[_0x5507('0x36')]=qs[_0x5507('0x37')](_0x24574b[_0x5507('0x2f')][_0x5507('0x37')]);_0x38f4d9[_0x5507('0x38')]=qs[_0x5507('0x31')](_[_0x5507('0x39')](_0x24574b[_0x5507('0x2f')],_0x1e5ce6[_0x5507('0x31')]),_0x55e889);if(_0x24574b[_0x5507('0x2f')]['filter']){_0x38f4d9['where']=_['merge'](_0x38f4d9['where'],{'$or':_[_0x5507('0x29')](_0x55e889,function(_0x2cf512){if(_0x2cf512[_0x5507('0x3a')]!==_0x5507('0x3b')){var _0x2b32a5={};_0x2b32a5[_0x2cf512[_0x5507('0x27')]]={'$like':'%'+_0x24574b[_0x5507('0x2f')][_0x5507('0x3c')]+'%'};return _0x2b32a5;}})});}_0x38f4d9=_[_0x5507('0x3d')]({},_0x38f4d9,_0x24574b[_0x5507('0x3e')]);var _0x3ec0ed={'where':_0x38f4d9[_0x5507('0x38')]};return db[_0x5507('0x2a')][_0x5507('0x1d')](_0x3ec0ed)['then'](function(_0x53b3f3){_0x14fdea['count']=_0x53b3f3;if(_0x24574b[_0x5507('0x2f')][_0x5507('0x3f')]){_0x38f4d9[_0x5507('0x40')]=[{'all':!![]}];}return db[_0x5507('0x2a')][_0x5507('0x41')](_0x38f4d9);})[_0x5507('0x23')](function(_0x340c4c){_0x14fdea[_0x5507('0x42')]=_0x340c4c;return _0x14fdea;})[_0x5507('0x23')](respondWithFilteredResult(_0x85d383,_0x38f4d9))[_0x5507('0x43')](handleError(_0x85d383,null));};exports[_0x5507('0x44')]=function(_0x192a00,_0x24d7b5){var _0x25496b={'raw':![],'where':{'id':_0x192a00[_0x5507('0x45')]['id']}},_0x1b3006={};_0x1b3006[_0x5507('0x2d')]=_[_0x5507('0x30')](db[_0x5507('0x2a')]['rawAttributes']);_0x1b3006[_0x5507('0x2f')]=_[_0x5507('0x30')](_0x192a00['query']);_0x1b3006['filters']=_[_0x5507('0x32')](_0x1b3006[_0x5507('0x2d')],_0x1b3006[_0x5507('0x2f')]);_0x25496b[_0x5507('0x33')]=_[_0x5507('0x32')](_0x1b3006['model'],qs[_0x5507('0x34')](_0x192a00[_0x5507('0x2f')][_0x5507('0x34')]));_0x25496b['attributes']=_0x25496b[_0x5507('0x33')][_0x5507('0x35')]?_0x25496b[_0x5507('0x33')]:_0x1b3006[_0x5507('0x2d')];if(_0x192a00[_0x5507('0x2f')]['includeAll']){_0x25496b[_0x5507('0x40')]=[{'all':!![]}];}_0x25496b=_['merge']({},_0x25496b,_0x192a00[_0x5507('0x3e')]);return db[_0x5507('0x2a')][_0x5507('0x46')](_0x25496b)[_0x5507('0x23')](handleEntityNotFound(_0x24d7b5,null))[_0x5507('0x23')](respondWithResult(_0x24d7b5,null))[_0x5507('0x43')](handleError(_0x24d7b5,null));};exports[_0x5507('0x47')]=function(_0x3452e4,_0x549cf0){return db[_0x5507('0x2a')][_0x5507('0x47')](_0x3452e4['body'],{})['then'](respondWithResult(_0x549cf0,0xc9))['catch'](handleError(_0x549cf0,null));};exports[_0x5507('0x22')]=function(_0x5961fd,_0x403d03){if(_0x5961fd['body']['id']){delete _0x5961fd[_0x5507('0x48')]['id'];}delete _0x5961fd['body']['duration'];delete _0x5961fd[_0x5507('0x48')][_0x5507('0x49')];delete _0x5961fd[_0x5507('0x48')][_0x5507('0x4a')];delete _0x5961fd[_0x5507('0x48')][_0x5507('0x4b')];return db['ScreenRecording'][_0x5507('0x46')]({'where':{'id':_0x5961fd[_0x5507('0x45')]['id']}})[_0x5507('0x23')](handleEntityNotFound(_0x403d03,null))['then'](saveUpdates(_0x5961fd[_0x5507('0x48')],null))[_0x5507('0x23')](respondWithResult(_0x403d03,null))[_0x5507('0x43')](handleError(_0x403d03,null));};exports[_0x5507('0x4c')]=function(_0x300c9f,_0x3af70f){return db[_0x5507('0x2a')][_0x5507('0x4c')]()[_0x5507('0x23')](respondWithResult(_0x3af70f,null))[_0x5507('0x43')](handleError(_0x3af70f,null));};exports[_0x5507('0x4d')]=function(_0x49a2f8,_0x570928,_0x1992fa){var _0x5d7753=require(_0x5507('0x4e'));var _0x1b34c8=![];var _0xce851d={};if(_0x49a2f8[_0x5507('0x2f')][_0x5507('0x3a')]&&_0x49a2f8[_0x5507('0x2f')][_0x5507('0x3a')]===_0x5507('0x4f')){_0xce851d[_0x5507('0x4f')]=_0x49a2f8[_0x5507('0x45')]['id'];}else{_0xce851d['id']=_0x49a2f8[_0x5507('0x45')]['id'];}return db[_0x5507('0x2a')][_0x5507('0x46')]({'where':_0xce851d,'attributes':['id',_0x5507('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x570928,null))[_0x5507('0x23')](function(_0x56e0cd){if(_0x56e0cd){var _0x5af5f5=path[_0x5507('0x50')](config[_0x5507('0x51')],_0x5507('0x52'),_0x56e0cd[_0x5507('0x4b')]);var _0x52b9f2=util[_0x5507('0x53')](_0x5507('0x54'),_0x5af5f5);if(fs[_0x5507('0x55')](_0x52b9f2)){_0x1b34c8=!![];return _0x5d7753[_0x5507('0x56')](_0x52b9f2,_0x5af5f5,config[_0x5507('0x57')][_0x5507('0x58')])['then'](function(){return _0x56e0cd;});}return _0x56e0cd;}})[_0x5507('0x23')](function(_0x46e589){if(_0x46e589){var _0x3a2f9f=path['join'](config['root'],_0x5507('0x52'),_0x46e589['value']);if(!fs[_0x5507('0x55')](_0x3a2f9f)){throw new db[(_0x5507('0x59'))]['ValidationError'](_0x5507('0x5a'));}if(_0x46e589[_0x5507('0x5b')]){return _0x570928[_0x5507('0x4d')](_0x3a2f9f,_0x46e589[_0x5507('0x5b')]+path[_0x5507('0x5c')](_0x3a2f9f),function(){if(_0x1b34c8){fs[_0x5507('0x5d')](_0x3a2f9f);}});}else{return _0x570928[_0x5507('0x4d')](_0x3a2f9f,function(_0x2928f2){if(_0x1b34c8){fs[_0x5507('0x5d')](_0x3a2f9f);}});}}})[_0x5507('0x43')](function(_0x1453f1){if(_0x1453f1[_0x5507('0x5e')]==='ScreenRecording\x20not\x20found'){_0x570928[_0x5507('0x19')](0x194)[_0x5507('0x5f')](_0x5507('0x60'));}else{return handleError(_0x570928,null);}});};exports[_0x5507('0x24')]=function(_0x3c4422,_0x5183ae){return db[_0x5507('0x2a')]['find']({'where':{'id':_0x3c4422[_0x5507('0x45')]['id']}})[_0x5507('0x23')](function(_0x241733){if(_['isNil'](_0x241733)){throw new ReferenceError(_0x5507('0x61'));}return _0x241733;})[_0x5507('0x23')](function(_0x2a9672){var _0x56632b=path[_0x5507('0x50')](config['root'],_0x5507('0x52'),_0x2a9672['value']);logger['info'](_0x5507('0x62'),_0x56632b);if(!_[_0x5507('0x63')](_0x2a9672[_0x5507('0x4b')])&&fs[_0x5507('0x55')](_0x56632b)){logger[_0x5507('0x64')](_0x5507('0x65')+_0x56632b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x56632b);}_0x56632b=_0x56632b+_0x5507('0x66');if(!_[_0x5507('0x63')](_0x2a9672[_0x5507('0x4b')])&&fs[_0x5507('0x55')](_0x56632b)){logger['info'](_0x5507('0x65')+_0x56632b+_0x5507('0x67'));fs[_0x5507('0x68')](_0x56632b);}return _0x2a9672;})[_0x5507('0x23')](function(_0x296cf5){if(!_0x296cf5)throw new InternalError();return _0x296cf5[_0x5507('0x24')]();})[_0x5507('0x23')](function(){_0x5183ae['status'](0xcc)[_0x5507('0x25')]();})[_0x5507('0x43')](handleError(_0x5183ae,null));}; \ No newline at end of file +var _0xd0bb=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','fieldName','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x16bfae,_0x36ed25){_0x16bfae=_0x16bfae-0x0;var _0x3870f5=_0xd0bb[_0x16bfae];return _0x3870f5;};'use strict';var emlformat=require(_0xbd0b('0x0'));var rimraf=require(_0xbd0b('0x1'));var zipdir=require(_0xbd0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd0b('0x3'));var moment=require('moment');var BPromise=require(_0xbd0b('0x4'));var Mustache=require(_0xbd0b('0x5'));var util=require('util');var path=require(_0xbd0b('0x6'));var sox=require('sox');var csv=require(_0xbd0b('0x7'));var ejs=require(_0xbd0b('0x8'));var fs=require('fs');var fs_extra=require(_0xbd0b('0x9'));var _=require(_0xbd0b('0xa'));var squel=require(_0xbd0b('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd0b('0xc'));var deskjs=require(_0xbd0b('0xd'));var toCsv=require(_0xbd0b('0x7'));var querystring=require(_0xbd0b('0xe'));var Papa=require(_0xbd0b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd0b('0x10'));var as=require(_0xbd0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd0b('0x12'))(_0xbd0b('0x13'));var utils=require('../../config/utils');var config=require(_0xbd0b('0x14'));var licenseUtil=require(_0xbd0b('0x15'));var db=require(_0xbd0b('0x16'))['db'];function respondWithStatusCode(_0x315ed9,_0x2621bf){_0x2621bf=_0x2621bf||0xcc;return function(_0x42a96b){if(_0x42a96b){return _0x315ed9[_0xbd0b('0x17')](_0x2621bf);}return _0x315ed9[_0xbd0b('0x18')](_0x2621bf)[_0xbd0b('0x19')]();};}function respondWithResult(_0x1c10c1,_0x2d4664){_0x2d4664=_0x2d4664||0xc8;return function(_0x57077a){if(_0x57077a){return _0x1c10c1[_0xbd0b('0x18')](_0x2d4664)['json'](_0x57077a);}};}function respondWithFilteredResult(_0x4a8014,_0x36d1ca){return function(_0x4c0e52){if(_0x4c0e52){var _0x3183cf=typeof _0x36d1ca[_0xbd0b('0x1a')]===_0xbd0b('0x1b')&&typeof _0x36d1ca['limit']==='undefined';var _0x2136ef=_0x4c0e52[_0xbd0b('0x1c')];var _0x1f2a6e=_0x3183cf?0x0:_0x36d1ca[_0xbd0b('0x1a')];var _0x1c0a7c=_0x3183cf?_0x4c0e52[_0xbd0b('0x1c')]:_0x36d1ca['offset']+_0x36d1ca[_0xbd0b('0x1d')];var _0x49499f;if(_0x1c0a7c>=_0x2136ef){_0x1c0a7c=_0x2136ef;_0x49499f=0xc8;}else{_0x49499f=0xce;}_0x4a8014[_0xbd0b('0x18')](_0x49499f);return _0x4a8014[_0xbd0b('0x1e')](_0xbd0b('0x1f'),_0x1f2a6e+'-'+_0x1c0a7c+'/'+_0x2136ef)[_0xbd0b('0x20')](_0x4c0e52);}return null;};}function patchUpdates(_0x4b312d){return function(_0x403c91){try{jsonpatch[_0xbd0b('0x21')](_0x403c91,_0x4b312d,!![]);}catch(_0x40b021){return BPromise['reject'](_0x40b021);}return _0x403c91[_0xbd0b('0x22')]();};}function saveUpdates(_0x560db4,_0xc66b8){return function(_0x3c4938){if(_0x3c4938){return _0x3c4938[_0xbd0b('0x23')](_0x560db4)[_0xbd0b('0x24')](function(_0x297c85){return _0x297c85;});}return null;};}function removeEntity(_0x539359,_0x75909f){return function(_0x58a721){if(_0x58a721){return _0x58a721[_0xbd0b('0x25')]()[_0xbd0b('0x24')](function(){_0x539359[_0xbd0b('0x18')](0xcc)[_0xbd0b('0x19')]();});}};}function handleEntityNotFound(_0xfd9f82,_0xb06342){return function(_0x4fe9ed){if(!_0x4fe9ed){_0xfd9f82[_0xbd0b('0x17')](0x194);}return _0x4fe9ed;};}function handleError(_0x1b46a3,_0x33b752){_0x33b752=_0x33b752||0x1f4;return function(_0x1b5a00){logger[_0xbd0b('0x26')](_0x1b5a00[_0xbd0b('0x27')]);if(_0x1b5a00['name']){delete _0x1b5a00[_0xbd0b('0x28')];}_0x1b46a3[_0xbd0b('0x18')](_0x33b752)[_0xbd0b('0x29')](_0x1b5a00);};}exports['index']=function(_0x4dfe76,_0x2187a5){var _0x684b09={},_0x14e5a3={},_0xf4ba04={'count':0x0,'rows':[]};var _0x4e2149=_[_0xbd0b('0x2a')](db[_0xbd0b('0x2b')]['rawAttributes'],function(_0x45f7d6){return{'name':_0x45f7d6[_0xbd0b('0x2c')],'type':_0x45f7d6['type']['key']};});_0x14e5a3[_0xbd0b('0x2d')]=_[_0xbd0b('0x2e')](_['map'](_0x4e2149,_0xbd0b('0x28')),[_0xbd0b('0x2f')]);_0x14e5a3[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x4dfe76[_0xbd0b('0x30')]);_0x14e5a3[_0xbd0b('0x32')]=_['intersection'](_0x14e5a3[_0xbd0b('0x2d')],_0x14e5a3[_0xbd0b('0x30')]);_0x684b09[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0x14e5a3[_0xbd0b('0x2d')],qs[_0xbd0b('0x35')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x684b09[_0xbd0b('0x33')]=_0x684b09[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x684b09[_0xbd0b('0x33')]:_0x14e5a3[_0xbd0b('0x2d')];if(!_0x4dfe76[_0xbd0b('0x30')]['hasOwnProperty'](_0xbd0b('0x37'))){_0x684b09[_0xbd0b('0x1d')]=qs['limit'](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1d')]);_0x684b09[_0xbd0b('0x1a')]=qs[_0xbd0b('0x1a')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1a')]);}_0x684b09['order']=qs[_0xbd0b('0x38')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x38')]);_0x684b09[_0xbd0b('0x39')]=qs[_0xbd0b('0x32')](_['pick'](_0x4dfe76['query'],_0x14e5a3[_0xbd0b('0x32')]),_0x4e2149);if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]){_0x684b09[_0xbd0b('0x39')]=_['merge'](_0x684b09['where'],{'$or':_[_0xbd0b('0x2a')](_0x4e2149,function(_0x4d8237){if(_0x4d8237[_0xbd0b('0x3b')]!==_0xbd0b('0x3c')){var _0x3f34dc={};_0x3f34dc[_0x4d8237[_0xbd0b('0x28')]]={'$like':'%'+_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]+'%'};return _0x3f34dc;}})});}_0x684b09=_[_0xbd0b('0x3d')]({},_0x684b09,_0x4dfe76[_0xbd0b('0x3e')]);var _0x2acc9f={'where':_0x684b09[_0xbd0b('0x39')]};return db[_0xbd0b('0x2b')][_0xbd0b('0x1c')](_0x2acc9f)[_0xbd0b('0x24')](function(_0x425c8a){_0xf4ba04[_0xbd0b('0x1c')]=_0x425c8a;if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x684b09[_0xbd0b('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0xbd0b('0x41')](_0x684b09);})[_0xbd0b('0x24')](function(_0x89b5ea){_0xf4ba04[_0xbd0b('0x42')]=_0x89b5ea;return _0xf4ba04;})[_0xbd0b('0x24')](respondWithFilteredResult(_0x2187a5,_0x684b09))[_0xbd0b('0x43')](handleError(_0x2187a5,null));};exports[_0xbd0b('0x44')]=function(_0x1b4497,_0x2a1a1d){var _0x4d72f={'raw':![],'where':{'id':_0x1b4497[_0xbd0b('0x45')]['id']}},_0xa252a2={};_0xa252a2['model']=_[_0xbd0b('0x31')](db['ScreenRecording']['rawAttributes']);_0xa252a2[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x1b4497[_0xbd0b('0x30')]);_0xa252a2['filters']=_[_0xbd0b('0x34')](_0xa252a2[_0xbd0b('0x2d')],_0xa252a2[_0xbd0b('0x30')]);_0x4d72f[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0xa252a2['model'],qs[_0xbd0b('0x35')](_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x4d72f[_0xbd0b('0x33')]=_0x4d72f[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x4d72f['attributes']:_0xa252a2[_0xbd0b('0x2d')];if(_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x4d72f[_0xbd0b('0x40')]=[{'all':!![]}];}_0x4d72f=_[_0xbd0b('0x3d')]({},_0x4d72f,_0x1b4497[_0xbd0b('0x3e')]);return db[_0xbd0b('0x2b')][_0xbd0b('0x46')](_0x4d72f)[_0xbd0b('0x24')](handleEntityNotFound(_0x2a1a1d,null))[_0xbd0b('0x24')](respondWithResult(_0x2a1a1d,null))[_0xbd0b('0x43')](handleError(_0x2a1a1d,null));};exports[_0xbd0b('0x47')]=function(_0x222ee1,_0x30f77e){return db[_0xbd0b('0x2b')][_0xbd0b('0x47')](_0x222ee1[_0xbd0b('0x48')],{})[_0xbd0b('0x24')](respondWithResult(_0x30f77e,0xc9))[_0xbd0b('0x43')](handleError(_0x30f77e,null));};exports[_0xbd0b('0x23')]=function(_0x3cfb52,_0xbd64e2){if(_0x3cfb52[_0xbd0b('0x48')]['id']){delete _0x3cfb52['body']['id'];}delete _0x3cfb52[_0xbd0b('0x48')][_0xbd0b('0x49')];delete _0x3cfb52['body']['createdAt'];delete _0x3cfb52['body'][_0xbd0b('0x4a')];delete _0x3cfb52['body'][_0xbd0b('0x4b')];return db[_0xbd0b('0x2b')][_0xbd0b('0x46')]({'where':{'id':_0x3cfb52[_0xbd0b('0x45')]['id']}})['then'](handleEntityNotFound(_0xbd64e2,null))[_0xbd0b('0x24')](saveUpdates(_0x3cfb52['body'],null))[_0xbd0b('0x24')](respondWithResult(_0xbd64e2,null))['catch'](handleError(_0xbd64e2,null));};exports['describe']=function(_0x80d89a,_0x22f741){return db[_0xbd0b('0x2b')][_0xbd0b('0x4c')]()[_0xbd0b('0x24')](respondWithResult(_0x22f741,null))[_0xbd0b('0x43')](handleError(_0x22f741,null));};exports[_0xbd0b('0x4d')]=function(_0x2a7252,_0x4cc013,_0x48a78c){var _0x2d13fd=require(_0xbd0b('0x4e'));var _0x5094bd=![];var _0x514985={};if(_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]&&_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]==='uniqueid'){_0x514985[_0xbd0b('0x4f')]=_0x2a7252[_0xbd0b('0x45')]['id'];}else{_0x514985['id']=_0x2a7252[_0xbd0b('0x45')]['id'];}return db[_0xbd0b('0x2b')]['find']({'where':_0x514985,'attributes':['id',_0xbd0b('0x4b')],'raw':!![]})[_0xbd0b('0x24')](handleEntityNotFound(_0x4cc013,null))['then'](function(_0x122a19){if(_0x122a19){var _0x1ea443=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],_0xbd0b('0x52'),_0x122a19[_0xbd0b('0x4b')]);var _0x3a526a=util[_0xbd0b('0x2f')]('%s.cypher',_0x1ea443);if(fs[_0xbd0b('0x53')](_0x3a526a)){_0x5094bd=!![];return _0x2d13fd[_0xbd0b('0x54')](_0x3a526a,_0x1ea443,config[_0xbd0b('0x55')][_0xbd0b('0x56')])[_0xbd0b('0x24')](function(){return _0x122a19;});}return _0x122a19;}})[_0xbd0b('0x24')](function(_0x49b7a6){if(_0x49b7a6){var _0x570648=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x49b7a6[_0xbd0b('0x4b')]);if(!fs[_0xbd0b('0x53')](_0x570648)){throw new db[(_0xbd0b('0x57'))][(_0xbd0b('0x58'))](_0xbd0b('0x59'));}if(_0x49b7a6['filename']){return _0x4cc013[_0xbd0b('0x4d')](_0x570648,_0x49b7a6[_0xbd0b('0x5a')]+path[_0xbd0b('0x5b')](_0x570648),function(){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}else{return _0x4cc013[_0xbd0b('0x4d')](_0x570648,function(_0xa08f72){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}}})[_0xbd0b('0x43')](function(_0x429534){if(_0x429534[_0xbd0b('0x5d')]===_0xbd0b('0x59')){_0x4cc013[_0xbd0b('0x18')](0x194)[_0xbd0b('0x29')](_0xbd0b('0x5e'));}else{return handleError(_0x4cc013,null);}});};exports[_0xbd0b('0x25')]=function(_0x1fefd5,_0x1e0beb){return db['ScreenRecording'][_0xbd0b('0x46')]({'where':{'id':_0x1fefd5[_0xbd0b('0x45')]['id']}})[_0xbd0b('0x24')](function(_0x2c935c){if(_['isNil'](_0x2c935c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2c935c;})[_0xbd0b('0x24')](function(_0x45c6b5){var _0x4317f0=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x45c6b5[_0xbd0b('0x4b')]);logger['info'](_0xbd0b('0x5f'),_0x4317f0);if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs[_0xbd0b('0x53')](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbd0b('0x63')](_0x4317f0);}_0x4317f0=_0x4317f0+_0xbd0b('0x64');if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs['existsSync'](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+_0xbd0b('0x65'));fs[_0xbd0b('0x63')](_0x4317f0);}return _0x45c6b5;})[_0xbd0b('0x24')](function(_0x4df3df){if(!_0x4df3df)throw new InternalError();return _0x4df3df['destroy']();})[_0xbd0b('0x24')](function(){_0x1e0beb['status'](0xcc)[_0xbd0b('0x19')]();})[_0xbd0b('0x43')](handleError(_0x1e0beb,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index c9ffd30..f3bc25d 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 _0x0c57=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0c57,0x84));var _0x70c5=function(_0x3ef17b,_0x370e39){_0x3ef17b=_0x3ef17b-0x0;var _0x108471=_0x0c57[_0x3ef17b];return _0x108471;};'use strict';var _=require(_0x70c5('0x0'));var util=require(_0x70c5('0x1'));var logger=require('../../config/logger')(_0x70c5('0x2'));var moment=require(_0x70c5('0x3'));var BPromise=require(_0x70c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x70c5('0x5'));var config=require(_0x70c5('0x6'));var attributes=require(_0x70c5('0x7'));module[_0x70c5('0x8')]=function(_0x314f07,_0x3a98e1){return _0x314f07['define'](_0x70c5('0x9'),attributes,{'tableName':_0x70c5('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x42f9=['path','rimraf','../../config/environment','./screenRecording.attributes','exports','screen_recordings','interactionid','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x42f9,0x11b));var _0x942f=function(_0x3c1bed,_0x473e6d){_0x3c1bed=_0x3c1bed-0x0;var _0x7b8a4d=_0x42f9[_0x3c1bed];return _0x7b8a4d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x942f('0x0'))(_0x942f('0x1'));var moment=require(_0x942f('0x2'));var BPromise=require(_0x942f('0x3'));var rp=require(_0x942f('0x4'));var fs=require('fs');var path=require(_0x942f('0x5'));var rimraf=require(_0x942f('0x6'));var config=require(_0x942f('0x7'));var attributes=require(_0x942f('0x8'));module[_0x942f('0x9')]=function(_0x404962,_0x4c982e){return _0x404962['define']('ScreenRecording',attributes,{'tableName':_0x942f('0xa'),'paranoid':![],'indexes':[{'name':_0x942f('0xb'),'fields':[_0x942f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 14a818c..c231ccc 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 _0x810e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x379fd8,_0x247c30){var _0x2d8502=function(_0x11a2b5){while(--_0x11a2b5){_0x379fd8['push'](_0x379fd8['shift']());}};_0x2d8502(++_0x247c30);}(_0x810e,0x7d));var _0xe810=function(_0x55ec86,_0x1047ba){_0x55ec86=_0x55ec86-0x0;var _0x54340d=_0x810e[_0x55ec86];return _0x54340d;};'use strict';var _=require(_0xe810('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe810('0x1'));var fs=require('fs');var Redis=require(_0xe810('0x2'));var db=require(_0xe810('0x3'))['db'];var utils=require(_0xe810('0x4'));var logger=require(_0xe810('0x5'))(_0xe810('0x6'));var config=require(_0xe810('0x7'));var jayson=require(_0xe810('0x8'));var client=jayson[_0xe810('0x9')][_0xe810('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175ab0,_0x3cf888,_0x4ef9c9){return new BPromise(function(_0x4bbc17,_0x4ca579){return client['request'](_0x175ab0,_0x4ef9c9)['then'](function(_0x3a4a1c){logger[_0xe810('0xb')](_0xe810('0xc'),_0x3cf888,_0xe810('0xd'));logger[_0xe810('0xe')](_0xe810('0xf'),_0x3cf888,'request\x20sent',JSON[_0xe810('0x10')](_0x3a4a1c));if(_0x3a4a1c['error']){if(_0x3a4a1c[_0xe810('0x11')][_0xe810('0x12')]===0x1f4){logger[_0xe810('0x11')](_0xe810('0xc'),_0x3cf888,_0x3a4a1c['error'][_0xe810('0x13')]);return _0x4ca579(_0x3a4a1c[_0xe810('0x11')][_0xe810('0x13')]);}logger[_0xe810('0x11')](_0xe810('0xc'),_0x3cf888,_0x3a4a1c[_0xe810('0x11')][_0xe810('0x13')]);return _0x4bbc17(_0x3a4a1c[_0xe810('0x11')]['message']);}else{logger[_0xe810('0xb')](_0xe810('0xc'),_0x3cf888,'request\x20sent');_0x4bbc17(_0x3a4a1c['result'][_0xe810('0x13')]);}})[_0xe810('0x14')](function(_0x5f27ab){logger[_0xe810('0x11')](_0xe810('0xc'),_0x3cf888,_0x5f27ab);_0x4ca579(_0x5f27ab);});});} \ No newline at end of file +var _0xed9b=['../../config/utils','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x134557,_0x19ea33){var _0x1ab4eb=function(_0x39231d){while(--_0x39231d){_0x134557['push'](_0x134557['shift']());}};_0x1ab4eb(++_0x19ea33);}(_0xed9b,0x19d));var _0xbed9=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xed9b[_0x1a9204];return _0x17ca68;};'use strict';var _=require(_0xbed9('0x0'));var util=require(_0xbed9('0x1'));var moment=require('moment');var BPromise=require(_0xbed9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbed9('0x3'));var db=require(_0xbed9('0x4'))['db'];var utils=require(_0xbed9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbed9('0x6'));var jayson=require(_0xbed9('0x7'));var client=jayson['client'][_0xbed9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x123dc4,_0x26b125,_0x27b119){return new BPromise(function(_0x22f008,_0x323a9d){return client[_0xbed9('0x9')](_0x123dc4,_0x27b119)[_0xbed9('0xa')](function(_0x2f536c){logger[_0xbed9('0xb')](_0xbed9('0xc'),_0x26b125,_0xbed9('0xd'));logger[_0xbed9('0xe')](_0xbed9('0xf'),_0x26b125,'request\x20sent',JSON[_0xbed9('0x10')](_0x2f536c));if(_0x2f536c[_0xbed9('0x11')]){if(_0x2f536c[_0xbed9('0x11')][_0xbed9('0x12')]===0x1f4){logger[_0xbed9('0x11')](_0xbed9('0xc'),_0x26b125,_0x2f536c[_0xbed9('0x11')][_0xbed9('0x13')]);return _0x323a9d(_0x2f536c[_0xbed9('0x11')][_0xbed9('0x13')]);}logger[_0xbed9('0x11')](_0xbed9('0xc'),_0x26b125,_0x2f536c[_0xbed9('0x11')][_0xbed9('0x13')]);return _0x22f008(_0x2f536c[_0xbed9('0x11')][_0xbed9('0x13')]);}else{logger[_0xbed9('0xb')](_0xbed9('0xc'),_0x26b125,_0xbed9('0xd'));_0x22f008(_0x2f536c[_0xbed9('0x14')]['message']);}})[_0xbed9('0x15')](function(_0x44828e){logger[_0xbed9('0x11')](_0xbed9('0xc'),_0x26b125,_0x44828e);_0x323a9d(_0x44828e);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 1b6aff9..0d193f2 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 _0x2542=['gdpr','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','extname','originalname','post','single','file','addLogo','format','logologin','/:id/logo_login','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','addFavicon','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr'];(function(_0x3fbb30,_0x5d6fc8){var _0x42551c=function(_0x3603f6){while(--_0x3603f6){_0x3fbb30['push'](_0x3fbb30['shift']());}};_0x42551c(++_0x5d6fc8);}(_0x2542,0x114));var _0x2254=function(_0xe011cd,_0x279c15){_0xe011cd=_0xe011cd-0x0;var _0x1c2c5f=_0x2542[_0xe011cd];return _0x1c2c5f;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require('path');var timeout=require(_0x2254('0x2'));var express=require('express');var router=express[_0x2254('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x4'));var interaction=require(_0x2254('0x5'));var config=require(_0x2254('0x6'));var controller=require(_0x2254('0x7'));router[_0x2254('0x8')]('/',auth[_0x2254('0x9')](),controller[_0x2254('0xa')]);router[_0x2254('0x8')](_0x2254('0xb'),controller['getDate']);router[_0x2254('0x8')](_0x2254('0xc'),controller[_0x2254('0xd')]);router[_0x2254('0x8')](_0x2254('0xe'),controller[_0x2254('0xf')]);router[_0x2254('0x8')]('/:id/logo_login',controller[_0x2254('0x10')]);router[_0x2254('0x8')](_0x2254('0x11'),controller[_0x2254('0x12')]);router['get']('/:id/preferred',controller['getPreferred']);router[_0x2254('0x8')](_0x2254('0x13'),controller[_0x2254('0x14')]);var upload=multer({'storage':multer[_0x2254('0x15')]({'destination':function(_0x265df9,_0x9275cb,_0x3b4957){_0x3b4957(null,path[_0x2254('0x16')](config[_0x2254('0x17')],_0x2254('0x18')));},'filename':function(_0x6ddce1,_0x116c28,_0x3c605b){_0x3c605b(null,util['format'](_0x2254('0x19'),'logo',path[_0x2254('0x1a')](_0x116c28[_0x2254('0x1b')])));}})});router[_0x2254('0x1c')]('/:id/logo',upload[_0x2254('0x1d')](_0x2254('0x1e')),controller[_0x2254('0x1f')]);var upload=multer({'storage':multer[_0x2254('0x15')]({'destination':function(_0x20aec1,_0x21af96,_0x41f67b){_0x41f67b(null,path[_0x2254('0x16')](config[_0x2254('0x17')],_0x2254('0x18')));},'filename':function(_0x465c2a,_0x147e35,_0x1132fe){_0x1132fe(null,util[_0x2254('0x20')]('%s%s',_0x2254('0x21'),path[_0x2254('0x1a')](_0x147e35[_0x2254('0x1b')])));}})});router[_0x2254('0x1c')](_0x2254('0x22'),upload[_0x2254('0x1d')](_0x2254('0x1e')),controller[_0x2254('0x23')]);var upload=multer({'storage':multer[_0x2254('0x15')]({'destination':function(_0x33ed98,_0x3341fe,_0x41e908){_0x41e908(null,path[_0x2254('0x16')](config[_0x2254('0x17')],'server/files/images/logos/'));},'filename':function(_0x2cca69,_0x30ae9b,_0x8f79f0){_0x8f79f0(null,util[_0x2254('0x20')](_0x2254('0x19'),_0x2254('0x24'),path['extname'](_0x30ae9b[_0x2254('0x1b')])));}})});router[_0x2254('0x1c')](_0x2254('0x25'),upload['single']('file'),controller[_0x2254('0x26')]);var upload=multer({'storage':multer[_0x2254('0x15')]({'destination':function(_0x104bbe,_0x5abb6f,_0x5c5496){_0x5c5496(null,path[_0x2254('0x16')](config['root'],'server/files/images/logos/'));},'filename':function(_0x24cd79,_0x54cfbc,_0x396afb){_0x396afb(null,util['format'](_0x2254('0x19'),_0x2254('0x27'),path[_0x2254('0x1a')](_0x54cfbc[_0x2254('0x1b')])));}})});router[_0x2254('0x1c')](_0x2254('0x13'),upload['single'](_0x2254('0x1e')),controller[_0x2254('0x28')]);router['put'](_0x2254('0xc'),auth[_0x2254('0x9')](),controller['update']);module[_0x2254('0x29')]=router; \ No newline at end of file +var _0x514b=['getFavicon','join','root','server/files/images/logos/','%s%s','logo','extname','post','single','file','addLogo','diskStorage','format','logologin','originalname','/:id/logo_login','addLogoLogin','preferred','addPreferred','/:id/favicon','addFavicon','/:id','update','exports','multer','util','connect-timeout','express','fs-extra','./setting.controller','get','index','/now','getDate','show','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred'];(function(_0x10a0bd,_0x4afbdb){var _0x3cfaac=function(_0x37b3f7){while(--_0x37b3f7){_0x10a0bd['push'](_0x10a0bd['shift']());}};_0x3cfaac(++_0x4afbdb);}(_0x514b,0x129));var _0xb514=function(_0x41ec0e,_0x1099b8){_0x41ec0e=_0x41ec0e-0x0;var _0x49ce13=_0x514b[_0x41ec0e];return _0x49ce13;};'use strict';var multer=require(_0xb514('0x0'));var util=require(_0xb514('0x1'));var path=require('path');var timeout=require(_0xb514('0x2'));var express=require(_0xb514('0x3'));var router=express['Router']();var fs_extra=require(_0xb514('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb514('0x5'));router[_0xb514('0x6')]('/',auth['isAuthenticated'](),controller[_0xb514('0x7')]);router['get'](_0xb514('0x8'),controller[_0xb514('0x9')]);router[_0xb514('0x6')]('/:id',controller[_0xb514('0xa')]);router['get']('/:id/logo',controller['getLogo']);router[_0xb514('0x6')]('/:id/logo_login',controller[_0xb514('0xb')]);router[_0xb514('0x6')](_0xb514('0xc'),controller[_0xb514('0xd')]);router['get'](_0xb514('0xe'),controller['getPreferred']);router[_0xb514('0x6')]('/:id/favicon',controller[_0xb514('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4aeb4a,_0x496486,_0x5296c1){_0x5296c1(null,path[_0xb514('0x10')](config[_0xb514('0x11')],_0xb514('0x12')));},'filename':function(_0x342ce3,_0xd53026,_0x12f7ca){_0x12f7ca(null,util['format'](_0xb514('0x13'),_0xb514('0x14'),path[_0xb514('0x15')](_0xd53026['originalname'])));}})});router[_0xb514('0x16')]('/:id/logo',upload[_0xb514('0x17')](_0xb514('0x18')),controller[_0xb514('0x19')]);var upload=multer({'storage':multer[_0xb514('0x1a')]({'destination':function(_0x1c6072,_0x55e6,_0x3411b1){_0x3411b1(null,path[_0xb514('0x10')](config[_0xb514('0x11')],_0xb514('0x12')));},'filename':function(_0x4d4caa,_0x457956,_0x224c89){_0x224c89(null,util[_0xb514('0x1b')](_0xb514('0x13'),_0xb514('0x1c'),path[_0xb514('0x15')](_0x457956[_0xb514('0x1d')])));}})});router['post'](_0xb514('0x1e'),upload['single'](_0xb514('0x18')),controller[_0xb514('0x1f')]);var upload=multer({'storage':multer[_0xb514('0x1a')]({'destination':function(_0x7c5fb0,_0x450fcc,_0xb9f0d5){_0xb9f0d5(null,path['join'](config[_0xb514('0x11')],_0xb514('0x12')));},'filename':function(_0x24cb0c,_0x358775,_0x28e858){_0x28e858(null,util[_0xb514('0x1b')]('%s%s',_0xb514('0x20'),path[_0xb514('0x15')](_0x358775[_0xb514('0x1d')])));}})});router['post'](_0xb514('0xe'),upload[_0xb514('0x17')](_0xb514('0x18')),controller[_0xb514('0x21')]);var upload=multer({'storage':multer[_0xb514('0x1a')]({'destination':function(_0x2bb83e,_0x34e74d,_0x1f1c44){_0x1f1c44(null,path[_0xb514('0x10')](config[_0xb514('0x11')],_0xb514('0x12')));},'filename':function(_0x5411a0,_0x3fd50d,_0x4b442e){_0x4b442e(null,util[_0xb514('0x1b')](_0xb514('0x13'),'favicon',path['extname'](_0x3fd50d[_0xb514('0x1d')])));}})});router['post'](_0xb514('0x22'),upload[_0xb514('0x17')](_0xb514('0x18')),controller[_0xb514('0x23')]);router['put'](_0xb514('0x24'),auth['isAuthenticated'](),controller[_0xb514('0x25')]);module[_0xb514('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index b9a7302..95802c7 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x36aeda,_0x1a7415){var _0x15cd3b=function(_0x5eea7f){while(--_0x5eea7f){_0x36aeda['push'](_0x36aeda['shift']());}};_0x15cd3b(++_0x1a7415);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x56c1e8,_0x114517){var _0x21e2ab=function(_0x9823c5){while(--_0x9823c5){_0x56c1e8['push'](_0x56c1e8['shift']());}};_0x21e2ab(++_0x114517);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 45ff139..adf09bd 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 _0x572b=['query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','Setting','includeAll','findAll','rows','catch','show','rawAttributes','fields','include','options','find','body','addLogo','file','filename','logo','params','addLogoLogin','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultFavicon','existsSync','join','root','toLower','upperFirst','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','loginLogo','defaultLoginLogo','defaultPreferred','default_loginLogo.svg','default','custom','gdpr','securePassword','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','client','http','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','index','map','fieldName','type','key','model'];(function(_0x4639a8,_0x5b2661){var _0x4bcee0=function(_0x197a6a){while(--_0x197a6a){_0x4639a8['push'](_0x4639a8['shift']());}};_0x4bcee0(++_0x5b2661);}(_0x572b,0x1b2));var _0xb572=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x572b[_0x95411e];return _0x2c8718;};'use strict';var emlformat=require(_0xb572('0x0'));var rimraf=require(_0xb572('0x1'));var zipdir=require(_0xb572('0x2'));var jsonpatch=require(_0xb572('0x3'));var rp=require(_0xb572('0x4'));var moment=require('moment');var BPromise=require(_0xb572('0x5'));var Mustache=require(_0xb572('0x6'));var util=require(_0xb572('0x7'));var path=require('path');var sox=require(_0xb572('0x8'));var csv=require(_0xb572('0x9'));var ejs=require(_0xb572('0xa'));var fs=require('fs');var fs_extra=require(_0xb572('0xb'));var _=require(_0xb572('0xc'));var squel=require(_0xb572('0xd'));var crypto=require(_0xb572('0xe'));var jsforce=require(_0xb572('0xf'));var deskjs=require(_0xb572('0x10'));var toCsv=require(_0xb572('0x9'));var querystring=require('querystring');var Papa=require(_0xb572('0x11'));var Redis=require('ioredis');var authService=require(_0xb572('0x12'));var qs=require(_0xb572('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb572('0x14'))(_0xb572('0x15'));var utils=require(_0xb572('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb572('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb572('0x18')][_0xb572('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3666e5,_0x47f137,_0x175ef8,_0x13f015){return new BPromise(function(_0x23a8cb,_0x4e99a6){var _0xd6e108=_0x13f015||client;return _0xd6e108['request'](_0x3666e5,_0x175ef8)['then'](function(_0x57023a){logger[_0xb572('0x1a')](_0xb572('0x1b'),_0x47f137,_0xb572('0x1c'));logger['debug'](_0xb572('0x1d'),_0x47f137,_0xb572('0x1c'),JSON[_0xb572('0x1e')](_0x57023a));if(_0x57023a[_0xb572('0x1f')]){if(_0x57023a['error'][_0xb572('0x20')]===0x1f4){logger[_0xb572('0x1f')]('Setting,\x20%s,\x20%s',_0x47f137,_0x57023a['error'][_0xb572('0x21')]);return _0x4e99a6(_0x57023a[_0xb572('0x1f')]['message']);}logger[_0xb572('0x1f')]('Setting,\x20%s,\x20%s',_0x47f137,_0x57023a[_0xb572('0x1f')]['message']);return _0x23a8cb(_0x57023a[_0xb572('0x1f')][_0xb572('0x21')]);}else{logger[_0xb572('0x1a')]('Setting,\x20%s,\x20%s',_0x47f137,_0xb572('0x1c'));_0x23a8cb(_0x57023a[_0xb572('0x22')][_0xb572('0x21')]);}})['catch'](function(_0x190675){logger[_0xb572('0x1f')](_0xb572('0x1b'),_0x47f137,_0x190675);_0x4e99a6(_0x190675);});});}function respondWithStatusCode(_0x4b7cc6,_0x3775b9){_0x3775b9=_0x3775b9||0xcc;return function(_0x377ed7){if(_0x377ed7){return _0x4b7cc6[_0xb572('0x23')](_0x3775b9);}return _0x4b7cc6[_0xb572('0x24')](_0x3775b9)['end']();};}function respondWithResult(_0x383f4d,_0x1b4ad5){_0x1b4ad5=_0x1b4ad5||0xc8;return function(_0x2cd917){if(_0x2cd917){return _0x383f4d[_0xb572('0x24')](_0x1b4ad5)['json'](_0x2cd917);}};}function respondWithFilteredResult(_0x34bfe8,_0x25fa72){return function(_0x3a6e07){if(_0x3a6e07){var _0x2f25ca=typeof _0x25fa72['offset']===_0xb572('0x25')&&typeof _0x25fa72['limit']===_0xb572('0x25');var _0x574990=_0x3a6e07[_0xb572('0x26')];var _0x2c4b07=_0x2f25ca?0x0:_0x25fa72[_0xb572('0x27')];var _0x3c6dfa=_0x2f25ca?_0x3a6e07[_0xb572('0x26')]:_0x25fa72[_0xb572('0x27')]+_0x25fa72[_0xb572('0x28')];var _0x1b60a5;if(_0x3c6dfa>=_0x574990){_0x3c6dfa=_0x574990;_0x1b60a5=0xc8;}else{_0x1b60a5=0xce;}_0x34bfe8[_0xb572('0x24')](_0x1b60a5);return _0x34bfe8['set'](_0xb572('0x29'),_0x2c4b07+'-'+_0x3c6dfa+'/'+_0x574990)[_0xb572('0x2a')](_0x3a6e07);}return null;};}function patchUpdates(_0x36563d){return function(_0x363782){try{jsonpatch[_0xb572('0x2b')](_0x363782,_0x36563d,!![]);}catch(_0x53ef84){return BPromise[_0xb572('0x2c')](_0x53ef84);}return _0x363782[_0xb572('0x2d')]();};}function saveUpdates(_0x213f57,_0x56350e){return function(_0x45678d){if(_0x45678d){return _0x45678d[_0xb572('0x2e')](_0x213f57)[_0xb572('0x2f')](function(_0x3484fe){return _0x3484fe;});}return null;};}function removeEntity(_0x1c7972,_0x474678){return function(_0x29b897){if(_0x29b897){return _0x29b897[_0xb572('0x30')]()['then'](function(){_0x1c7972[_0xb572('0x24')](0xcc)[_0xb572('0x31')]();});}};}function handleEntityNotFound(_0x240f11,_0x234bc7){return function(_0x195427){if(!_0x195427){_0x240f11[_0xb572('0x23')](0x194);}return _0x195427;};}function handleError(_0x597ec0,_0x376cca){_0x376cca=_0x376cca||0x1f4;return function(_0x25661b){logger[_0xb572('0x1f')](_0x25661b['stack']);if(_0x25661b[_0xb572('0x32')]){delete _0x25661b[_0xb572('0x32')];}_0x597ec0['status'](_0x376cca)[_0xb572('0x33')](_0x25661b);};}exports[_0xb572('0x34')]=function(_0x55dcf3,_0x191a6c){var _0x2e6916={},_0x22caba={},_0x723115={'count':0x0,'rows':[]};var _0x58b119=_[_0xb572('0x35')](db['Setting']['rawAttributes'],function(_0x555e1e){return{'name':_0x555e1e[_0xb572('0x36')],'type':_0x555e1e[_0xb572('0x37')][_0xb572('0x38')]};});_0x22caba[_0xb572('0x39')]=_[_0xb572('0x35')](_0x58b119,_0xb572('0x32'));_0x22caba[_0xb572('0x3a')]=_[_0xb572('0x3b')](_0x55dcf3[_0xb572('0x3a')]);_0x22caba[_0xb572('0x3c')]=_[_0xb572('0x3d')](_0x22caba[_0xb572('0x39')],_0x22caba['query']);_0x2e6916['attributes']=_[_0xb572('0x3d')](_0x22caba[_0xb572('0x39')],qs['fields'](_0x55dcf3[_0xb572('0x3a')]['fields']));_0x2e6916[_0xb572('0x3e')]=_0x2e6916[_0xb572('0x3e')]['length']?_0x2e6916[_0xb572('0x3e')]:_0x22caba[_0xb572('0x39')];if(!_0x55dcf3[_0xb572('0x3a')][_0xb572('0x3f')]('nolimit')){_0x2e6916[_0xb572('0x28')]=qs[_0xb572('0x28')](_0x55dcf3[_0xb572('0x3a')][_0xb572('0x28')]);_0x2e6916[_0xb572('0x27')]=qs['offset'](_0x55dcf3[_0xb572('0x3a')][_0xb572('0x27')]);}_0x2e6916[_0xb572('0x40')]=qs[_0xb572('0x41')](_0x55dcf3[_0xb572('0x3a')][_0xb572('0x41')]);_0x2e6916[_0xb572('0x42')]=qs[_0xb572('0x3c')](_[_0xb572('0x43')](_0x55dcf3[_0xb572('0x3a')],_0x22caba[_0xb572('0x3c')]),_0x58b119);if(_0x55dcf3[_0xb572('0x3a')][_0xb572('0x44')]){_0x2e6916[_0xb572('0x42')]=_[_0xb572('0x45')](_0x2e6916[_0xb572('0x42')],{'$or':_[_0xb572('0x35')](_0x58b119,function(_0x35301c){if(_0x35301c['type']!==_0xb572('0x46')){var _0x5628c4={};_0x5628c4[_0x35301c[_0xb572('0x32')]]={'$like':'%'+_0x55dcf3[_0xb572('0x3a')][_0xb572('0x44')]+'%'};return _0x5628c4;}})});}_0x2e6916=_[_0xb572('0x45')]({},_0x2e6916,_0x55dcf3['options']);var _0x18073b={'where':_0x2e6916[_0xb572('0x42')]};return db[_0xb572('0x47')][_0xb572('0x26')](_0x18073b)[_0xb572('0x2f')](function(_0x60dcec){_0x723115['count']=_0x60dcec;if(_0x55dcf3[_0xb572('0x3a')][_0xb572('0x48')]){_0x2e6916['include']=[{'all':!![]}];}return db[_0xb572('0x47')][_0xb572('0x49')](_0x2e6916);})[_0xb572('0x2f')](function(_0x551c39){_0x723115[_0xb572('0x4a')]=_0x551c39;return _0x723115;})['then'](respondWithFilteredResult(_0x191a6c,_0x2e6916))[_0xb572('0x4b')](handleError(_0x191a6c,null));};exports[_0xb572('0x4c')]=function(_0x545e17,_0x9116ab){var _0x4e4cdb={'raw':![],'where':{'id':_0x545e17['params']['id']}},_0x162ec9={};_0x162ec9[_0xb572('0x39')]=_[_0xb572('0x3b')](db[_0xb572('0x47')][_0xb572('0x4d')]);_0x162ec9[_0xb572('0x3a')]=_[_0xb572('0x3b')](_0x545e17['query']);_0x162ec9[_0xb572('0x3c')]=_[_0xb572('0x3d')](_0x162ec9[_0xb572('0x39')],_0x162ec9[_0xb572('0x3a')]);_0x4e4cdb[_0xb572('0x3e')]=_[_0xb572('0x3d')](_0x162ec9[_0xb572('0x39')],qs[_0xb572('0x4e')](_0x545e17[_0xb572('0x3a')][_0xb572('0x4e')]));_0x4e4cdb['attributes']=_0x4e4cdb['attributes']['length']?_0x4e4cdb['attributes']:_0x162ec9[_0xb572('0x39')];if(_0x545e17['query'][_0xb572('0x48')]){_0x4e4cdb[_0xb572('0x4f')]=[{'all':!![]}];}_0x4e4cdb=_[_0xb572('0x45')]({},_0x4e4cdb,_0x545e17[_0xb572('0x50')]);return db[_0xb572('0x47')][_0xb572('0x51')](_0x4e4cdb)[_0xb572('0x2f')](handleEntityNotFound(_0x9116ab,null))[_0xb572('0x2f')](respondWithResult(_0x9116ab,null))[_0xb572('0x4b')](handleError(_0x9116ab,null));};exports[_0xb572('0x2e')]=function(_0x2f8af5,_0x54a0c0){if(_0x2f8af5[_0xb572('0x52')]['id']){delete _0x2f8af5[_0xb572('0x52')]['id'];}return db[_0xb572('0x47')][_0xb572('0x51')]({'where':{'id':_0x2f8af5['params']['id']}})[_0xb572('0x2f')](handleEntityNotFound(_0x54a0c0,null))[_0xb572('0x2f')](saveUpdates(_0x2f8af5['body'],null))[_0xb572('0x2f')](respondWithResult(_0x54a0c0,null))[_0xb572('0x4b')](handleError(_0x54a0c0,null));};exports[_0xb572('0x53')]=function(_0x17ce6e,_0xe23510,_0x47465b){if(_0x17ce6e[_0xb572('0x54')]&&_0x17ce6e[_0xb572('0x54')][_0xb572('0x55')]){_0x17ce6e['body'][_0xb572('0x56')]=_0x17ce6e[_0xb572('0x54')]['filename'];}return db['Setting'][_0xb572('0x51')]({'where':{'id':_0x17ce6e[_0xb572('0x57')]['id']}})[_0xb572('0x2f')](handleEntityNotFound(_0xe23510,null))[_0xb572('0x2f')](saveUpdates(_0x17ce6e['body'],null))['then'](respondWithResult(_0xe23510,null))[_0xb572('0x4b')](handleError(_0xe23510,null));};exports[_0xb572('0x58')]=function(_0x3f2ce6,_0x3afa24,_0x16a61f){if(_0x3f2ce6[_0xb572('0x54')]&&_0x3f2ce6[_0xb572('0x54')][_0xb572('0x55')]){_0x3f2ce6[_0xb572('0x52')]['loginLogo']=_0x3f2ce6[_0xb572('0x54')][_0xb572('0x55')];}return db[_0xb572('0x47')][_0xb572('0x51')]({'where':{'id':_0x3f2ce6[_0xb572('0x57')]['id']}})[_0xb572('0x2f')](handleEntityNotFound(_0x3afa24,null))[_0xb572('0x2f')](saveUpdates(_0x3f2ce6['body'],null))['then'](respondWithResult(_0x3afa24,null))[_0xb572('0x4b')](handleError(_0x3afa24,null));};var utilLicense=require(_0xb572('0x59'));exports[_0xb572('0x5a')]=function(_0x3a6e08,_0x3c46b8,_0x11e821){var _0x43d219=_0xb572('0x5b');var _0x49d689={'custom':![]};return utilLicense[_0xb572('0x5c')]()[_0xb572('0x2f')](function(_0x4edc2c){if(_0x4edc2c){_0x49d689=_0x4edc2c;}return db[_0xb572('0x47')][_0xb572('0x51')]({'where':{'id':_0x3a6e08[_0xb572('0x57')]['id']},'attributes':[_0xb572('0x56'),'loginLogo',_0xb572('0x5d'),_0xb572('0x5e'),_0xb572('0x5f'),'defaultLoginLogo','defaultPreferred',_0xb572('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x3c46b8,null))[_0xb572('0x2f')](function(_0x43c1e6){if(_0x43c1e6){var _0x338a7d=_0x43c1e6[_0xb572('0x56')]&&fs[_0xb572('0x61')](path[_0xb572('0x62')](config[_0xb572('0x63')],_0x43d219,_['toLower'](_0x43c1e6[_0xb572('0x56')])))?path[_0xb572('0x62')](config['root'],_0x43d219,_[_0xb572('0x64')](_0x43c1e6['logo'])):path['join'](config[_0xb572('0x63')],_0x43d219,_['toLower']('default_logo.svg'));var _0xe68cc6='default'+_[_0xb572('0x65')](_0xb572('0x56'));if(_0x43c1e6[_0xe68cc6]||!_0x49d689['custom']){_0x338a7d=path[_0xb572('0x62')](config[_0xb572('0x63')],_0x43d219,_[_0xb572('0x64')](_0xb572('0x66')));}if(!fs[_0xb572('0x61')](_0x338a7d)){throw new db[(_0xb572('0x67'))][(_0xb572('0x68'))](_['upperFirst'](_0xb572('0x56'))+_0xb572('0x69'));}return _0x3c46b8[_0xb572('0x6a')](_0x338a7d);}})[_0xb572('0x4b')](handleError(_0x3c46b8,null));};var utilLicense=require('../../config/license/util');exports[_0xb572('0x6b')]=function(_0x7d50b3,_0x53a6fe,_0x402a7e){var _0x331e9a=_0xb572('0x5b');var _0x50b113={'custom':![]};return utilLicense[_0xb572('0x5c')]()['then'](function(_0x12dbf7){if(_0x12dbf7){_0x50b113=_0x12dbf7;}return db[_0xb572('0x47')]['find']({'where':{'id':_0x7d50b3['params']['id']},'attributes':[_0xb572('0x56'),_0xb572('0x6c'),_0xb572('0x5d'),'favicon',_0xb572('0x5f'),_0xb572('0x6d'),_0xb572('0x6e'),_0xb572('0x60')],'raw':!![]});})[_0xb572('0x2f')](handleEntityNotFound(_0x53a6fe,null))[_0xb572('0x2f')](function(_0x555704){if(_0x555704){var _0x3fd712=_0x555704[_0xb572('0x6c')]&&fs[_0xb572('0x61')](path[_0xb572('0x62')](config[_0xb572('0x63')],_0x331e9a,_[_0xb572('0x64')](_0x555704[_0xb572('0x6c')])))?path['join'](config[_0xb572('0x63')],_0x331e9a,_[_0xb572('0x64')](_0x555704[_0xb572('0x6c')])):path[_0xb572('0x62')](config[_0xb572('0x63')],_0x331e9a,_[_0xb572('0x64')](_0xb572('0x6f')));var _0x5d53dc=_0xb572('0x70')+_[_0xb572('0x65')]('loginLogo');if(_0x555704[_0x5d53dc]||!_0x50b113[_0xb572('0x71')]){_0x3fd712=path[_0xb572('0x62')](config['root'],_0x331e9a,_[_0xb572('0x64')](_0xb572('0x6f')));}if(!fs[_0xb572('0x61')](_0x3fd712)){throw new db[(_0xb572('0x67'))][(_0xb572('0x68'))](_[_0xb572('0x65')](_0xb572('0x6c'))+'\x20not\x20found');}return _0x53a6fe[_0xb572('0x6a')](_0x3fd712);}})['catch'](handleError(_0x53a6fe,null));};exports[_0xb572('0x72')]=function(_0x394123,_0x5c7c4a){return db[_0xb572('0x47')][_0xb572('0x51')]({'where':{'id':_0x394123[_0xb572('0x57')]['id']},'attributes':[_0xb572('0x73')]})[_0xb572('0x2f')](respondWithResult(_0x5c7c4a,null))['catch'](handleError(_0x5c7c4a,null));};exports['addPreferred']=function(_0x3cffc1,_0x19796c,_0x2710ae){if(_0x3cffc1['file']&&_0x3cffc1[_0xb572('0x54')]['filename']){_0x3cffc1[_0xb572('0x52')][_0xb572('0x5d')]=_0x3cffc1[_0xb572('0x54')][_0xb572('0x55')];}return db['Setting'][_0xb572('0x51')]({'where':{'id':_0x3cffc1[_0xb572('0x57')]['id']}})[_0xb572('0x2f')](handleEntityNotFound(_0x19796c,null))[_0xb572('0x2f')](saveUpdates(_0x3cffc1[_0xb572('0x52')],null))[_0xb572('0x2f')](respondWithResult(_0x19796c,null))[_0xb572('0x4b')](handleError(_0x19796c,null));};var utilLicense=require(_0xb572('0x59'));exports[_0xb572('0x74')]=function(_0x2504fe,_0x229bfe,_0x4a3a68){var _0x3bafaf='server/files/images/logos';var _0x4d82fa={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4449ff){if(_0x4449ff){_0x4d82fa=_0x4449ff;}return db['Setting']['find']({'where':{'id':_0x2504fe['params']['id']},'attributes':[_0xb572('0x56'),_0xb572('0x6c'),_0xb572('0x5d'),'favicon','defaultLogo','defaultLoginLogo',_0xb572('0x6e'),_0xb572('0x60')],'raw':!![]});})[_0xb572('0x2f')](handleEntityNotFound(_0x229bfe,null))[_0xb572('0x2f')](function(_0x1c1481){if(_0x1c1481){var _0x4a0546=_0x1c1481[_0xb572('0x5d')]&&fs['existsSync'](path[_0xb572('0x62')](config['root'],_0x3bafaf,_[_0xb572('0x64')](_0x1c1481[_0xb572('0x5d')])))?path[_0xb572('0x62')](config['root'],_0x3bafaf,_[_0xb572('0x64')](_0x1c1481['preferred'])):path['join'](config['root'],_0x3bafaf,_['toLower'](_0xb572('0x75')));var _0x8ea9df='default'+_[_0xb572('0x65')](_0xb572('0x5d'));if(_0x1c1481[_0x8ea9df]||!_0x4d82fa[_0xb572('0x71')]||!_0x4d82fa[_0xb572('0x5d')]){_0x4a0546=path['join'](config['root'],_0x3bafaf,_[_0xb572('0x64')](_0xb572('0x75')));}if(!fs['existsSync'](_0x4a0546)){throw new db['Sequelize'][(_0xb572('0x68'))](_[_0xb572('0x65')](_0xb572('0x5d'))+_0xb572('0x69'));}return _0x229bfe[_0xb572('0x6a')](_0x4a0546);}})['catch'](handleError(_0x229bfe,null));};exports['addFavicon']=function(_0x363e8f,_0x3d4347,_0x241113){if(_0x363e8f['file']&&_0x363e8f[_0xb572('0x54')]['filename']){_0x363e8f[_0xb572('0x52')]['favicon']=_0x363e8f['file'][_0xb572('0x55')];}return db[_0xb572('0x47')]['find']({'where':{'id':_0x363e8f[_0xb572('0x57')]['id']}})['then'](handleEntityNotFound(_0x3d4347,null))[_0xb572('0x2f')](saveUpdates(_0x363e8f[_0xb572('0x52')],null))[_0xb572('0x2f')](respondWithResult(_0x3d4347,null))[_0xb572('0x4b')](handleError(_0x3d4347,null));};var utilLicense=require('../../config/license/util');exports[_0xb572('0x76')]=function(_0x5ab9e7,_0x500b34,_0x26b1e8){var _0x3dd7b6=_0xb572('0x5b');var _0x1d6bc3={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2f1854){if(_0x2f1854){_0x1d6bc3=_0x2f1854;}return db[_0xb572('0x47')][_0xb572('0x51')]({'where':{'id':_0x5ab9e7[_0xb572('0x57')]['id']},'attributes':['logo',_0xb572('0x6c'),_0xb572('0x5d'),_0xb572('0x5e'),'defaultLogo',_0xb572('0x6d'),_0xb572('0x6e'),_0xb572('0x60')],'raw':!![]});})[_0xb572('0x2f')](handleEntityNotFound(_0x500b34,null))['then'](function(_0x4aa513){if(_0x4aa513){var _0x8eee7e=_0x4aa513[_0xb572('0x5e')]&&fs[_0xb572('0x61')](path['join'](config['root'],_0x3dd7b6,_[_0xb572('0x64')](_0x4aa513[_0xb572('0x5e')])))?path[_0xb572('0x62')](config[_0xb572('0x63')],_0x3dd7b6,_[_0xb572('0x64')](_0x4aa513[_0xb572('0x5e')])):path[_0xb572('0x62')](config[_0xb572('0x63')],_0x3dd7b6,_['toLower'](_0xb572('0x77')));var _0x39dbda=_0xb572('0x70')+_['upperFirst'](_0xb572('0x5e'));if(_0x4aa513[_0x39dbda]||!_0x1d6bc3[_0xb572('0x71')]){_0x8eee7e=path[_0xb572('0x62')](config['root'],_0x3dd7b6,_[_0xb572('0x64')]('default_favicon.ico'));}if(!fs[_0xb572('0x61')](_0x8eee7e)){throw new db[(_0xb572('0x67'))]['ValidationError'](_[_0xb572('0x65')]('favicon')+_0xb572('0x69'));}return _0x500b34[_0xb572('0x6a')](_0x8eee7e);}})[_0xb572('0x4b')](handleError(_0x500b34,null));};exports[_0xb572('0x78')]=function(_0x1b1d54,_0x1b33d2){var _0x3b823a={'offset':moment()['utcOffset']()};_0x3b823a['now']=moment()['utcOffset'](_0x3b823a['offset'])[_0xb572('0x79')](_0xb572('0x7a'));return _0x1b33d2[_0xb572('0x24')](0xc8)[_0xb572('0x33')](_0x3b823a);}; \ No newline at end of file +var _0x55fd=['apply','reject','save','update','destroy','name','send','map','Setting','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','addLogo','file','filename','addLogoLogin','loginLogo','server/files/images/logos','logo','preferred','favicon','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLicense','defaultLogo','default_loginLogo.svg','gdpr','securePassword','defaultLoginLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x128bef,_0xc7a0af){var _0x1ba862=function(_0x4858e8){while(--_0x4858e8){_0x128bef['push'](_0x128bef['shift']());}};_0x1ba862(++_0xc7a0af);}(_0x55fd,0xbf));var _0xd55f=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x55fd[_0x4d07cc];return _0x42de3b;};'use strict';var emlformat=require(_0xd55f('0x0'));var rimraf=require(_0xd55f('0x1'));var zipdir=require(_0xd55f('0x2'));var jsonpatch=require(_0xd55f('0x3'));var rp=require('request-promise');var moment=require(_0xd55f('0x4'));var BPromise=require(_0xd55f('0x5'));var Mustache=require('mustache');var util=require(_0xd55f('0x6'));var path=require('path');var sox=require(_0xd55f('0x7'));var csv=require(_0xd55f('0x8'));var ejs=require(_0xd55f('0x9'));var fs=require('fs');var fs_extra=require(_0xd55f('0xa'));var _=require(_0xd55f('0xb'));var squel=require('squel');var crypto=require(_0xd55f('0xc'));var jsforce=require(_0xd55f('0xd'));var deskjs=require(_0xd55f('0xe'));var toCsv=require(_0xd55f('0x8'));var querystring=require(_0xd55f('0xf'));var Papa=require('papaparse');var Redis=require(_0xd55f('0x10'));var authService=require(_0xd55f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd55f('0x12'));var hardwareService=require(_0xd55f('0x13'));var logger=require(_0xd55f('0x14'))(_0xd55f('0x15'));var utils=require('../../config/utils');var config=require(_0xd55f('0x16'));var licenseUtil=require(_0xd55f('0x17'));var db=require(_0xd55f('0x18'))['db'];var jayson=require(_0xd55f('0x19'));var client=jayson[_0xd55f('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ad9d1,_0x282bb8,_0x8b215d,_0x5eacba){return new BPromise(function(_0x5d2970,_0x20cc63){var _0x4d5773=_0x5eacba||client;return _0x4d5773['request'](_0x3ad9d1,_0x8b215d)[_0xd55f('0x1b')](function(_0x4e4981){logger[_0xd55f('0x1c')](_0xd55f('0x1d'),_0x282bb8,_0xd55f('0x1e'));logger['debug'](_0xd55f('0x1f'),_0x282bb8,'request\x20sent',JSON[_0xd55f('0x20')](_0x4e4981));if(_0x4e4981[_0xd55f('0x21')]){if(_0x4e4981[_0xd55f('0x21')][_0xd55f('0x22')]===0x1f4){logger[_0xd55f('0x21')]('Setting,\x20%s,\x20%s',_0x282bb8,_0x4e4981[_0xd55f('0x21')][_0xd55f('0x23')]);return _0x20cc63(_0x4e4981[_0xd55f('0x21')][_0xd55f('0x23')]);}logger[_0xd55f('0x21')]('Setting,\x20%s,\x20%s',_0x282bb8,_0x4e4981[_0xd55f('0x21')][_0xd55f('0x23')]);return _0x5d2970(_0x4e4981[_0xd55f('0x21')][_0xd55f('0x23')]);}else{logger[_0xd55f('0x1c')](_0xd55f('0x1d'),_0x282bb8,_0xd55f('0x1e'));_0x5d2970(_0x4e4981['result']['message']);}})[_0xd55f('0x24')](function(_0x2fb3c8){logger[_0xd55f('0x21')](_0xd55f('0x1d'),_0x282bb8,_0x2fb3c8);_0x20cc63(_0x2fb3c8);});});}function respondWithStatusCode(_0x44f496,_0x3807b1){_0x3807b1=_0x3807b1||0xcc;return function(_0x1940e6){if(_0x1940e6){return _0x44f496[_0xd55f('0x25')](_0x3807b1);}return _0x44f496[_0xd55f('0x26')](_0x3807b1)[_0xd55f('0x27')]();};}function respondWithResult(_0x49e0b6,_0x569e8c){_0x569e8c=_0x569e8c||0xc8;return function(_0xa906b){if(_0xa906b){return _0x49e0b6[_0xd55f('0x26')](_0x569e8c)[_0xd55f('0x28')](_0xa906b);}};}function respondWithFilteredResult(_0x3ffc06,_0x15f4bc){return function(_0x22c1a7){if(_0x22c1a7){var _0x3adced=typeof _0x15f4bc[_0xd55f('0x29')]==='undefined'&&typeof _0x15f4bc[_0xd55f('0x2a')]===_0xd55f('0x2b');var _0x32bd59=_0x22c1a7['count'];var _0x33b400=_0x3adced?0x0:_0x15f4bc[_0xd55f('0x29')];var _0x41c9b6=_0x3adced?_0x22c1a7[_0xd55f('0x2c')]:_0x15f4bc[_0xd55f('0x29')]+_0x15f4bc[_0xd55f('0x2a')];var _0x10cbd0;if(_0x41c9b6>=_0x32bd59){_0x41c9b6=_0x32bd59;_0x10cbd0=0xc8;}else{_0x10cbd0=0xce;}_0x3ffc06[_0xd55f('0x26')](_0x10cbd0);return _0x3ffc06['set']('Content-Range',_0x33b400+'-'+_0x41c9b6+'/'+_0x32bd59)['json'](_0x22c1a7);}return null;};}function patchUpdates(_0x36dad9){return function(_0x4d8058){try{jsonpatch[_0xd55f('0x2d')](_0x4d8058,_0x36dad9,!![]);}catch(_0x7ca246){return BPromise[_0xd55f('0x2e')](_0x7ca246);}return _0x4d8058[_0xd55f('0x2f')]();};}function saveUpdates(_0x346997,_0x4b82cd){return function(_0x5bd962){if(_0x5bd962){return _0x5bd962[_0xd55f('0x30')](_0x346997)[_0xd55f('0x1b')](function(_0x4034bb){return _0x4034bb;});}return null;};}function removeEntity(_0x364ae8,_0x4f8258){return function(_0x2d00c6){if(_0x2d00c6){return _0x2d00c6[_0xd55f('0x31')]()[_0xd55f('0x1b')](function(){_0x364ae8[_0xd55f('0x26')](0xcc)[_0xd55f('0x27')]();});}};}function handleEntityNotFound(_0x8828a6,_0x5a5fab){return function(_0x37ba33){if(!_0x37ba33){_0x8828a6['sendStatus'](0x194);}return _0x37ba33;};}function handleError(_0x2dbf0f,_0x3675e8){_0x3675e8=_0x3675e8||0x1f4;return function(_0x3df347){logger[_0xd55f('0x21')](_0x3df347['stack']);if(_0x3df347[_0xd55f('0x32')]){delete _0x3df347[_0xd55f('0x32')];}_0x2dbf0f[_0xd55f('0x26')](_0x3675e8)[_0xd55f('0x33')](_0x3df347);};}exports['index']=function(_0x21f7f1,_0x49600f){var _0x28448c={},_0x31d347={},_0x7dc01={'count':0x0,'rows':[]};var _0x383e6d=_[_0xd55f('0x34')](db[_0xd55f('0x35')]['rawAttributes'],function(_0x3d5dcf){return{'name':_0x3d5dcf[_0xd55f('0x36')],'type':_0x3d5dcf[_0xd55f('0x37')][_0xd55f('0x38')]};});_0x31d347['model']=_['map'](_0x383e6d,_0xd55f('0x32'));_0x31d347['query']=_[_0xd55f('0x39')](_0x21f7f1[_0xd55f('0x3a')]);_0x31d347['filters']=_[_0xd55f('0x3b')](_0x31d347[_0xd55f('0x3c')],_0x31d347[_0xd55f('0x3a')]);_0x28448c[_0xd55f('0x3d')]=_['intersection'](_0x31d347['model'],qs[_0xd55f('0x3e')](_0x21f7f1[_0xd55f('0x3a')][_0xd55f('0x3e')]));_0x28448c[_0xd55f('0x3d')]=_0x28448c[_0xd55f('0x3d')][_0xd55f('0x3f')]?_0x28448c[_0xd55f('0x3d')]:_0x31d347[_0xd55f('0x3c')];if(!_0x21f7f1[_0xd55f('0x3a')]['hasOwnProperty'](_0xd55f('0x40'))){_0x28448c['limit']=qs[_0xd55f('0x2a')](_0x21f7f1[_0xd55f('0x3a')][_0xd55f('0x2a')]);_0x28448c[_0xd55f('0x29')]=qs[_0xd55f('0x29')](_0x21f7f1[_0xd55f('0x3a')][_0xd55f('0x29')]);}_0x28448c[_0xd55f('0x41')]=qs[_0xd55f('0x42')](_0x21f7f1[_0xd55f('0x3a')]['sort']);_0x28448c[_0xd55f('0x43')]=qs[_0xd55f('0x44')](_['pick'](_0x21f7f1[_0xd55f('0x3a')],_0x31d347['filters']),_0x383e6d);if(_0x21f7f1[_0xd55f('0x3a')][_0xd55f('0x45')]){_0x28448c['where']=_['merge'](_0x28448c['where'],{'$or':_[_0xd55f('0x34')](_0x383e6d,function(_0xec1de7){if(_0xec1de7[_0xd55f('0x37')]!==_0xd55f('0x46')){var _0x58e9a4={};_0x58e9a4[_0xec1de7[_0xd55f('0x32')]]={'$like':'%'+_0x21f7f1['query'][_0xd55f('0x45')]+'%'};return _0x58e9a4;}})});}_0x28448c=_[_0xd55f('0x47')]({},_0x28448c,_0x21f7f1[_0xd55f('0x48')]);var _0x500a75={'where':_0x28448c[_0xd55f('0x43')]};return db[_0xd55f('0x35')][_0xd55f('0x2c')](_0x500a75)[_0xd55f('0x1b')](function(_0x57118d){_0x7dc01[_0xd55f('0x2c')]=_0x57118d;if(_0x21f7f1[_0xd55f('0x3a')][_0xd55f('0x49')]){_0x28448c[_0xd55f('0x4a')]=[{'all':!![]}];}return db[_0xd55f('0x35')][_0xd55f('0x4b')](_0x28448c);})[_0xd55f('0x1b')](function(_0x38de65){_0x7dc01[_0xd55f('0x4c')]=_0x38de65;return _0x7dc01;})[_0xd55f('0x1b')](respondWithFilteredResult(_0x49600f,_0x28448c))[_0xd55f('0x24')](handleError(_0x49600f,null));};exports[_0xd55f('0x4d')]=function(_0x1bc73e,_0x2a6e77){var _0x371f58={'raw':![],'where':{'id':_0x1bc73e[_0xd55f('0x4e')]['id']}},_0x8365d1={};_0x8365d1['model']=_[_0xd55f('0x39')](db[_0xd55f('0x35')][_0xd55f('0x4f')]);_0x8365d1['query']=_[_0xd55f('0x39')](_0x1bc73e[_0xd55f('0x3a')]);_0x8365d1[_0xd55f('0x44')]=_[_0xd55f('0x3b')](_0x8365d1[_0xd55f('0x3c')],_0x8365d1[_0xd55f('0x3a')]);_0x371f58[_0xd55f('0x3d')]=_[_0xd55f('0x3b')](_0x8365d1[_0xd55f('0x3c')],qs['fields'](_0x1bc73e['query'][_0xd55f('0x3e')]));_0x371f58['attributes']=_0x371f58[_0xd55f('0x3d')][_0xd55f('0x3f')]?_0x371f58['attributes']:_0x8365d1['model'];if(_0x1bc73e[_0xd55f('0x3a')][_0xd55f('0x49')]){_0x371f58['include']=[{'all':!![]}];}_0x371f58=_['merge']({},_0x371f58,_0x1bc73e[_0xd55f('0x48')]);return db[_0xd55f('0x35')][_0xd55f('0x50')](_0x371f58)[_0xd55f('0x1b')](handleEntityNotFound(_0x2a6e77,null))[_0xd55f('0x1b')](respondWithResult(_0x2a6e77,null))[_0xd55f('0x24')](handleError(_0x2a6e77,null));};exports[_0xd55f('0x30')]=function(_0x53bb67,_0x25991c){if(_0x53bb67[_0xd55f('0x51')]['id']){delete _0x53bb67['body']['id'];}return db[_0xd55f('0x35')][_0xd55f('0x50')]({'where':{'id':_0x53bb67[_0xd55f('0x4e')]['id']}})[_0xd55f('0x1b')](handleEntityNotFound(_0x25991c,null))[_0xd55f('0x1b')](saveUpdates(_0x53bb67[_0xd55f('0x51')],null))['then'](respondWithResult(_0x25991c,null))[_0xd55f('0x24')](handleError(_0x25991c,null));};exports[_0xd55f('0x52')]=function(_0x8859bd,_0x37ee32,_0x2b97f5){if(_0x8859bd['file']&&_0x8859bd[_0xd55f('0x53')][_0xd55f('0x54')]){_0x8859bd[_0xd55f('0x51')]['logo']=_0x8859bd[_0xd55f('0x53')][_0xd55f('0x54')];}return db[_0xd55f('0x35')][_0xd55f('0x50')]({'where':{'id':_0x8859bd[_0xd55f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x37ee32,null))[_0xd55f('0x1b')](saveUpdates(_0x8859bd[_0xd55f('0x51')],null))[_0xd55f('0x1b')](respondWithResult(_0x37ee32,null))[_0xd55f('0x24')](handleError(_0x37ee32,null));};exports[_0xd55f('0x55')]=function(_0x3ab60f,_0x4ac30c,_0x3c291d){if(_0x3ab60f[_0xd55f('0x53')]&&_0x3ab60f['file'][_0xd55f('0x54')]){_0x3ab60f[_0xd55f('0x51')][_0xd55f('0x56')]=_0x3ab60f[_0xd55f('0x53')][_0xd55f('0x54')];}return db[_0xd55f('0x35')][_0xd55f('0x50')]({'where':{'id':_0x3ab60f[_0xd55f('0x4e')]['id']}})[_0xd55f('0x1b')](handleEntityNotFound(_0x4ac30c,null))[_0xd55f('0x1b')](saveUpdates(_0x3ab60f['body'],null))[_0xd55f('0x1b')](respondWithResult(_0x4ac30c,null))[_0xd55f('0x24')](handleError(_0x4ac30c,null));};var utilLicense=require(_0xd55f('0x17'));exports['getLogo']=function(_0x4f2a43,_0x159625,_0x4ba03){var _0x418abb=_0xd55f('0x57');var _0xcefb89={'custom':![]};return utilLicense['getLicense']()[_0xd55f('0x1b')](function(_0x523cf3){if(_0x523cf3){_0xcefb89=_0x523cf3;}return db[_0xd55f('0x35')][_0xd55f('0x50')]({'where':{'id':_0x4f2a43[_0xd55f('0x4e')]['id']},'attributes':[_0xd55f('0x58'),_0xd55f('0x56'),_0xd55f('0x59'),_0xd55f('0x5a'),'defaultLogo','defaultLoginLogo',_0xd55f('0x5b'),_0xd55f('0x5c')],'raw':!![]});})[_0xd55f('0x1b')](handleEntityNotFound(_0x159625,null))[_0xd55f('0x1b')](function(_0x76fdec){if(_0x76fdec){var _0x55e2f6=_0x76fdec['logo']&&fs[_0xd55f('0x5d')](path[_0xd55f('0x5e')](config[_0xd55f('0x5f')],_0x418abb,_[_0xd55f('0x60')](_0x76fdec[_0xd55f('0x58')])))?path[_0xd55f('0x5e')](config[_0xd55f('0x5f')],_0x418abb,_[_0xd55f('0x60')](_0x76fdec[_0xd55f('0x58')])):path[_0xd55f('0x5e')](config[_0xd55f('0x5f')],_0x418abb,_[_0xd55f('0x60')](_0xd55f('0x61')));var _0x596842=_0xd55f('0x62')+_[_0xd55f('0x63')](_0xd55f('0x58'));if(_0x76fdec[_0x596842]||!_0xcefb89[_0xd55f('0x64')]){_0x55e2f6=path[_0xd55f('0x5e')](config[_0xd55f('0x5f')],_0x418abb,_['toLower']('default_logo.svg'));}if(!fs[_0xd55f('0x5d')](_0x55e2f6)){throw new db[(_0xd55f('0x65'))][(_0xd55f('0x66'))](_[_0xd55f('0x63')](_0xd55f('0x58'))+_0xd55f('0x67'));}return _0x159625[_0xd55f('0x68')](_0x55e2f6);}})[_0xd55f('0x24')](handleError(_0x159625,null));};var utilLicense=require(_0xd55f('0x17'));exports['getLogoLogin']=function(_0x4c8249,_0x1fe814,_0x4fcd4d){var _0x22b39a=_0xd55f('0x57');var _0x113494={'custom':![]};return utilLicense[_0xd55f('0x69')]()[_0xd55f('0x1b')](function(_0x2debd8){if(_0x2debd8){_0x113494=_0x2debd8;}return db[_0xd55f('0x35')]['find']({'where':{'id':_0x4c8249['params']['id']},'attributes':[_0xd55f('0x58'),_0xd55f('0x56'),_0xd55f('0x59'),_0xd55f('0x5a'),_0xd55f('0x6a'),'defaultLoginLogo',_0xd55f('0x5b'),_0xd55f('0x5c')],'raw':!![]});})[_0xd55f('0x1b')](handleEntityNotFound(_0x1fe814,null))[_0xd55f('0x1b')](function(_0x4c3b90){if(_0x4c3b90){var _0x1ed73f=_0x4c3b90[_0xd55f('0x56')]&&fs['existsSync'](path[_0xd55f('0x5e')](config[_0xd55f('0x5f')],_0x22b39a,_[_0xd55f('0x60')](_0x4c3b90['loginLogo'])))?path[_0xd55f('0x5e')](config['root'],_0x22b39a,_[_0xd55f('0x60')](_0x4c3b90[_0xd55f('0x56')])):path[_0xd55f('0x5e')](config[_0xd55f('0x5f')],_0x22b39a,_[_0xd55f('0x60')]('default_loginLogo.svg'));var _0x55ecb7=_0xd55f('0x62')+_[_0xd55f('0x63')](_0xd55f('0x56'));if(_0x4c3b90[_0x55ecb7]||!_0x113494[_0xd55f('0x64')]){_0x1ed73f=path['join'](config[_0xd55f('0x5f')],_0x22b39a,_[_0xd55f('0x60')](_0xd55f('0x6b')));}if(!fs['existsSync'](_0x1ed73f)){throw new db[(_0xd55f('0x65'))][(_0xd55f('0x66'))](_[_0xd55f('0x63')](_0xd55f('0x56'))+'\x20not\x20found');}return _0x1fe814[_0xd55f('0x68')](_0x1ed73f);}})[_0xd55f('0x24')](handleError(_0x1fe814,null));};exports[_0xd55f('0x6c')]=function(_0x1d57fd,_0x1ff536){return db[_0xd55f('0x35')][_0xd55f('0x50')]({'where':{'id':_0x1d57fd[_0xd55f('0x4e')]['id']},'attributes':[_0xd55f('0x6d')]})[_0xd55f('0x1b')](respondWithResult(_0x1ff536,null))[_0xd55f('0x24')](handleError(_0x1ff536,null));};exports['addPreferred']=function(_0x99dd3c,_0x4115c5,_0x267678){if(_0x99dd3c[_0xd55f('0x53')]&&_0x99dd3c[_0xd55f('0x53')]['filename']){_0x99dd3c[_0xd55f('0x51')][_0xd55f('0x59')]=_0x99dd3c[_0xd55f('0x53')][_0xd55f('0x54')];}return db['Setting'][_0xd55f('0x50')]({'where':{'id':_0x99dd3c[_0xd55f('0x4e')]['id']}})[_0xd55f('0x1b')](handleEntityNotFound(_0x4115c5,null))['then'](saveUpdates(_0x99dd3c['body'],null))[_0xd55f('0x1b')](respondWithResult(_0x4115c5,null))['catch'](handleError(_0x4115c5,null));};var utilLicense=require(_0xd55f('0x17'));exports['getPreferred']=function(_0x2e0177,_0x48d05b,_0x1f6c59){var _0xc590bc=_0xd55f('0x57');var _0x312562={'custom':![]};return utilLicense[_0xd55f('0x69')]()['then'](function(_0x1ea5e9){if(_0x1ea5e9){_0x312562=_0x1ea5e9;}return db[_0xd55f('0x35')][_0xd55f('0x50')]({'where':{'id':_0x2e0177[_0xd55f('0x4e')]['id']},'attributes':[_0xd55f('0x58'),_0xd55f('0x56'),'preferred','favicon',_0xd55f('0x6a'),_0xd55f('0x6e'),_0xd55f('0x5b'),_0xd55f('0x5c')],'raw':!![]});})[_0xd55f('0x1b')](handleEntityNotFound(_0x48d05b,null))[_0xd55f('0x1b')](function(_0x2b955f){if(_0x2b955f){var _0x1f42e7=_0x2b955f[_0xd55f('0x59')]&&fs[_0xd55f('0x5d')](path[_0xd55f('0x5e')](config['root'],_0xc590bc,_[_0xd55f('0x60')](_0x2b955f[_0xd55f('0x59')])))?path[_0xd55f('0x5e')](config[_0xd55f('0x5f')],_0xc590bc,_['toLower'](_0x2b955f[_0xd55f('0x59')])):path[_0xd55f('0x5e')](config[_0xd55f('0x5f')],_0xc590bc,_[_0xd55f('0x60')]('default_preferred.png'));var _0x4ee987=_0xd55f('0x62')+_[_0xd55f('0x63')](_0xd55f('0x59'));if(_0x2b955f[_0x4ee987]||!_0x312562[_0xd55f('0x64')]||!_0x312562[_0xd55f('0x59')]){_0x1f42e7=path[_0xd55f('0x5e')](config['root'],_0xc590bc,_[_0xd55f('0x60')](_0xd55f('0x6f')));}if(!fs[_0xd55f('0x5d')](_0x1f42e7)){throw new db[(_0xd55f('0x65'))][(_0xd55f('0x66'))](_[_0xd55f('0x63')](_0xd55f('0x59'))+_0xd55f('0x67'));}return _0x48d05b[_0xd55f('0x68')](_0x1f42e7);}})['catch'](handleError(_0x48d05b,null));};exports[_0xd55f('0x70')]=function(_0xbe9823,_0x33c5a1,_0x2da48b){if(_0xbe9823[_0xd55f('0x53')]&&_0xbe9823['file']['filename']){_0xbe9823['body'][_0xd55f('0x5a')]=_0xbe9823[_0xd55f('0x53')]['filename'];}return db[_0xd55f('0x35')][_0xd55f('0x50')]({'where':{'id':_0xbe9823[_0xd55f('0x4e')]['id']}})[_0xd55f('0x1b')](handleEntityNotFound(_0x33c5a1,null))['then'](saveUpdates(_0xbe9823['body'],null))['then'](respondWithResult(_0x33c5a1,null))[_0xd55f('0x24')](handleError(_0x33c5a1,null));};var utilLicense=require(_0xd55f('0x17'));exports[_0xd55f('0x71')]=function(_0x2d9425,_0x405e46,_0x22e614){var _0x4e06d0=_0xd55f('0x57');var _0x79caab={'custom':![]};return utilLicense[_0xd55f('0x69')]()[_0xd55f('0x1b')](function(_0x1d5a66){if(_0x1d5a66){_0x79caab=_0x1d5a66;}return db['Setting'][_0xd55f('0x50')]({'where':{'id':_0x2d9425[_0xd55f('0x4e')]['id']},'attributes':[_0xd55f('0x58'),_0xd55f('0x56'),_0xd55f('0x59'),_0xd55f('0x5a'),'defaultLogo',_0xd55f('0x6e'),_0xd55f('0x5b'),_0xd55f('0x5c')],'raw':!![]});})[_0xd55f('0x1b')](handleEntityNotFound(_0x405e46,null))['then'](function(_0x1530c2){if(_0x1530c2){var _0x10303c=_0x1530c2[_0xd55f('0x5a')]&&fs['existsSync'](path[_0xd55f('0x5e')](config[_0xd55f('0x5f')],_0x4e06d0,_[_0xd55f('0x60')](_0x1530c2[_0xd55f('0x5a')])))?path['join'](config[_0xd55f('0x5f')],_0x4e06d0,_['toLower'](_0x1530c2[_0xd55f('0x5a')])):path['join'](config[_0xd55f('0x5f')],_0x4e06d0,_[_0xd55f('0x60')]('default_favicon.ico'));var _0x15f89c=_0xd55f('0x62')+_['upperFirst'](_0xd55f('0x5a'));if(_0x1530c2[_0x15f89c]||!_0x79caab[_0xd55f('0x64')]){_0x10303c=path[_0xd55f('0x5e')](config[_0xd55f('0x5f')],_0x4e06d0,_['toLower'](_0xd55f('0x72')));}if(!fs[_0xd55f('0x5d')](_0x10303c)){throw new db[(_0xd55f('0x65'))][(_0xd55f('0x66'))](_[_0xd55f('0x63')](_0xd55f('0x5a'))+_0xd55f('0x67'));}return _0x405e46[_0xd55f('0x68')](_0x10303c);}})[_0xd55f('0x24')](handleError(_0x405e46,null));};exports[_0xd55f('0x73')]=function(_0x48ace4,_0x424639){var _0x2f68fb={'offset':moment()[_0xd55f('0x74')]()};_0x2f68fb[_0xd55f('0x75')]=moment()[_0xd55f('0x74')](_0x2f68fb[_0xd55f('0x29')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x424639[_0xd55f('0x26')](0xc8)[_0xd55f('0x33')](_0x2f68fb);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 30f65d6..58e25aa 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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x166d74,_0x1bf07e){var _0x13a80f=function(_0x282172){while(--_0x282172){_0x166d74['push'](_0x166d74['shift']());}};_0x13a80f(++_0x1bf07e);}(_0x3e74,0x175));var _0x43e7=function(_0x2ead36,_0x283e34){_0x2ead36=_0x2ead36-0x0;var _0x5a203c=_0x3e74[_0x2ead36];return _0x5a203c;};'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 +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x1f54e2,_0x53e7e1){var _0x5e9f98=function(_0xbe91ea){while(--_0xbe91ea){_0x1f54e2['push'](_0x1f54e2['shift']());}};_0x5e9f98(++_0x53e7e1);}(_0xedd9,0xfc));var _0x9edd=function(_0x33f36d,_0x27d5a7){_0x33f36d=_0x33f36d-0x0;var _0x59a26b=_0xedd9[_0x33f36d];return _0x59a26b;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 44d5f53..cb11538 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 _0x27e5=['debug','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model'];(function(_0xb8df4a,_0x43ae53){var _0x32dfde=function(_0x40b645){while(--_0x40b645){_0xb8df4a['push'](_0xb8df4a['shift']());}};_0x32dfde(++_0x43ae53);}(_0x27e5,0xa7));var _0x527e=function(_0xc7bd03,_0x90594b){_0xc7bd03=_0xc7bd03-0x0;var _0x124627=_0x27e5[_0xc7bd03];return _0x124627;};'use strict';var _=require(_0x527e('0x0'));var util=require(_0x527e('0x1'));var moment=require('moment');var BPromise=require(_0x527e('0x2'));var rs=require(_0x527e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x527e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x527e('0x5'))(_0x527e('0x6'));var config=require(_0x527e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x527e('0x8')][_0x527e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa88a58,_0x44a8ee,_0x24cd8b){return new BPromise(function(_0x213cc0,_0x9cd087){return client[_0x527e('0xa')](_0xa88a58,_0x24cd8b)[_0x527e('0xb')](function(_0x466c95){logger[_0x527e('0xc')](_0x527e('0xd'),_0x44a8ee,_0x527e('0xe'));logger['debug'](_0x527e('0xf'),_0x44a8ee,_0x527e('0xe'),JSON['stringify'](_0x466c95));if(_0x466c95[_0x527e('0x10')]){if(_0x466c95['error'][_0x527e('0x11')]===0x1f4){logger[_0x527e('0x10')](_0x527e('0xd'),_0x44a8ee,_0x466c95[_0x527e('0x10')]['message']);return _0x9cd087(_0x466c95[_0x527e('0x10')]['message']);}logger['error'](_0x527e('0xd'),_0x44a8ee,_0x466c95[_0x527e('0x10')]['message']);return _0x213cc0(_0x466c95[_0x527e('0x10')][_0x527e('0x12')]);}else{logger[_0x527e('0xc')](_0x527e('0xd'),_0x44a8ee,_0x527e('0xe'));_0x213cc0(_0x466c95[_0x527e('0x13')][_0x527e('0x12')]);}})[_0x527e('0x14')](function(_0x5ddbb9){logger['error'](_0x527e('0xd'),_0x44a8ee,_0x5ddbb9);_0x9cd087(_0x5ddbb9);});});}exports[_0x527e('0x15')]=function(_0x26fc6f){var _0x24518b=this;return new Promise(function(_0x4704ff,_0x31a3c9){return db[_0x527e('0x16')][_0x527e('0x17')]({'raw':_0x26fc6f[_0x527e('0x18')]?_0x26fc6f[_0x527e('0x18')][_0x527e('0x19')]===undefined?!![]:![]:!![],'where':_0x26fc6f[_0x527e('0x18')]?_0x26fc6f[_0x527e('0x18')][_0x527e('0x1a')]||null:null,'attributes':_0x26fc6f[_0x527e('0x18')]?_0x26fc6f['options'][_0x527e('0x1b')]||null:null,'include':_0x26fc6f[_0x527e('0x18')]?_0x26fc6f[_0x527e('0x18')][_0x527e('0x1c')]?_[_0x527e('0x1d')](_0x26fc6f[_0x527e('0x18')][_0x527e('0x1c')],function(_0x47ff0e){return{'model':db[_0x47ff0e[_0x527e('0x1e')]],'as':_0x47ff0e['as'],'attributes':_0x47ff0e['attributes'],'include':_0x47ff0e[_0x527e('0x1c')]?_[_0x527e('0x1d')](_0x47ff0e[_0x527e('0x1c')],function(_0x86bf32){return{'model':db[_0x86bf32[_0x527e('0x1e')]],'as':_0x86bf32['as'],'attributes':_0x86bf32[_0x527e('0x1b')],'include':_0x86bf32[_0x527e('0x1c')]?_[_0x527e('0x1d')](_0x86bf32['include'],function(_0x195b43){return{'model':db[_0x195b43[_0x527e('0x1e')]],'as':_0x195b43['as'],'attributes':_0x195b43[_0x527e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27d606){logger['info']('ShowSetting',_0x26fc6f);logger[_0x527e('0x1f')]('ShowSetting',_0x26fc6f,JSON[_0x527e('0x20')](_0x27d606));_0x4704ff(_0x27d606);})[_0x527e('0x14')](function(_0x4465c2){logger[_0x527e('0x10')](_0x527e('0x15'),_0x4465c2['message'],_0x26fc6f);_0x31a3c9(_0x24518b[_0x527e('0x10')](0x1f4,_0x4465c2[_0x527e('0x12')]));});});}; \ No newline at end of file +var _0xb100=['raw','where','attributes','map','include','model','ShowSetting','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','Setting','find','options'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xb100,0x168));var _0x0b10=function(_0x3b2e0a,_0x49a3f9){_0x3b2e0a=_0x3b2e0a-0x0;var _0x4a84bd=_0xb100[_0x3b2e0a];return _0x4a84bd;};'use strict';var _=require(_0x0b10('0x0'));var util=require(_0x0b10('0x1'));var moment=require(_0x0b10('0x2'));var BPromise=require(_0x0b10('0x3'));var rs=require(_0x0b10('0x4'));var fs=require('fs');var Redis=require(_0x0b10('0x5'));var db=require(_0x0b10('0x6'))['db'];var utils=require(_0x0b10('0x7'));var logger=require('../../config/logger')(_0x0b10('0x8'));var config=require('../../config/environment');var jayson=require(_0x0b10('0x9'));var client=jayson['client'][_0x0b10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41a944,_0x4790b9,_0x1d4aa6){return new BPromise(function(_0x1d86ac,_0x27d478){return client['request'](_0x41a944,_0x1d4aa6)[_0x0b10('0xb')](function(_0x14d758){logger['info']('Setting,\x20%s,\x20%s',_0x4790b9,_0x0b10('0xc'));logger[_0x0b10('0xd')](_0x0b10('0xe'),_0x4790b9,_0x0b10('0xc'),JSON[_0x0b10('0xf')](_0x14d758));if(_0x14d758[_0x0b10('0x10')]){if(_0x14d758[_0x0b10('0x10')][_0x0b10('0x11')]===0x1f4){logger[_0x0b10('0x10')](_0x0b10('0x12'),_0x4790b9,_0x14d758[_0x0b10('0x10')][_0x0b10('0x13')]);return _0x27d478(_0x14d758[_0x0b10('0x10')][_0x0b10('0x13')]);}logger[_0x0b10('0x10')](_0x0b10('0x12'),_0x4790b9,_0x14d758[_0x0b10('0x10')][_0x0b10('0x13')]);return _0x1d86ac(_0x14d758['error'][_0x0b10('0x13')]);}else{logger['info'](_0x0b10('0x12'),_0x4790b9,_0x0b10('0xc'));_0x1d86ac(_0x14d758[_0x0b10('0x14')][_0x0b10('0x13')]);}})['catch'](function(_0x32ef7a){logger['error']('Setting,\x20%s,\x20%s',_0x4790b9,_0x32ef7a);_0x27d478(_0x32ef7a);});});}exports['ShowSetting']=function(_0x169f0c){var _0x2e9b7a=this;return new Promise(function(_0x5c9d7b,_0x1efbb6){return db[_0x0b10('0x15')][_0x0b10('0x16')]({'raw':_0x169f0c[_0x0b10('0x17')]?_0x169f0c[_0x0b10('0x17')][_0x0b10('0x18')]===undefined?!![]:![]:!![],'where':_0x169f0c['options']?_0x169f0c['options'][_0x0b10('0x19')]||null:null,'attributes':_0x169f0c[_0x0b10('0x17')]?_0x169f0c['options'][_0x0b10('0x1a')]||null:null,'include':_0x169f0c[_0x0b10('0x17')]?_0x169f0c[_0x0b10('0x17')]['include']?_[_0x0b10('0x1b')](_0x169f0c[_0x0b10('0x17')][_0x0b10('0x1c')],function(_0x25a0e3){return{'model':db[_0x25a0e3[_0x0b10('0x1d')]],'as':_0x25a0e3['as'],'attributes':_0x25a0e3[_0x0b10('0x1a')],'include':_0x25a0e3[_0x0b10('0x1c')]?_[_0x0b10('0x1b')](_0x25a0e3[_0x0b10('0x1c')],function(_0x52220e){return{'model':db[_0x52220e[_0x0b10('0x1d')]],'as':_0x52220e['as'],'attributes':_0x52220e[_0x0b10('0x1a')],'include':_0x52220e['include']?_[_0x0b10('0x1b')](_0x52220e[_0x0b10('0x1c')],function(_0x11c8af){return{'model':db[_0x11c8af[_0x0b10('0x1d')]],'as':_0x11c8af['as'],'attributes':_0x11c8af[_0x0b10('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0b10('0xb')](function(_0x4b5be0){logger['info'](_0x0b10('0x1e'),_0x169f0c);logger['debug'](_0x0b10('0x1e'),_0x169f0c,JSON[_0x0b10('0xf')](_0x4b5be0));_0x5c9d7b(_0x4b5be0);})[_0x0b10('0x1f')](function(_0x2ee201){logger[_0x0b10('0x10')](_0x0b10('0x1e'),_0x2ee201[_0x0b10('0x13')],_0x169f0c);_0x1efbb6(_0x2e9b7a[_0x0b10('0x10')](0x1f4,_0x2ee201[_0x0b10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index b16e8ef..f008766 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 _0x1cb9=['/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addAnswer','/:id/notify','notify','/:id/applications','/:id/send','/:id/status','status','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5425b8,_0x265626){_0x5425b8=_0x5425b8-0x0;var _0x55a317=_0x1cb9[_0x5425b8];return _0x55a317;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0x8')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x8')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x8')]('/:id/applications',auth[_0x91cb('0x9')](),controller[_0x91cb('0x13')]);router['get'](_0x91cb('0x14'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x15')]);router[_0x91cb('0x8')]('/:id/status',controller['statusGet']);router[_0x91cb('0x8')](_0x91cb('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0x91cb('0x17')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x18')]);router['post'](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller['addDisposition']);router[_0x91cb('0x17')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x19')]);router['post'](_0x91cb('0x1a'),controller[_0x91cb('0x1b')]);router['post'](_0x91cb('0x1c'),auth['isAuthenticated'](),controller['addApplications']);router[_0x91cb('0x17')](_0x91cb('0x1d'),auth['isAuthenticated'](),controller['send']);router['post'](_0x91cb('0x1e'),controller[_0x91cb('0x1f')]);router[_0x91cb('0x17')](_0x91cb('0x16'),auth['isAuthenticated'](),controller[_0x91cb('0x20')]);router[_0x91cb('0x21')](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0x22')]);router[_0x91cb('0x23')](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x24')]);router[_0x91cb('0x23')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x25')]);router['delete']('/:id/canned_answers',auth[_0x91cb('0x9')](),controller['removeAnswers']);router[_0x91cb('0x23')](_0x91cb('0x16'),auth[_0x91cb('0x9')](),controller['removeAgents']);module[_0x91cb('0x26')]=router; \ No newline at end of file +var _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x21891b,_0x4c945b){var _0x3d90f5=function(_0x5251c3){while(--_0x5251c3){_0x21891b['push'](_0x21891b['shift']());}};_0x3d90f5(++_0x4c945b);}(_0x53ec,0x192));var _0xc53e=function(_0x1ab35d,_0x3f401d){_0x1ab35d=_0x1ab35d-0x0;var _0x133d6d=_0x53ec[_0x1ab35d];return _0x133d6d;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index c3e05df..39c0e2e 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 _0x499d=['plivo','bandwidth','csc','infobip','intelepeer','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','BOOLEAN','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','skebby','connectel','clicksend'];(function(_0x4b7adb,_0x30a94f){var _0x2722cf=function(_0x115f43){while(--_0x115f43){_0x4b7adb['push'](_0x4b7adb['shift']());}};_0x2722cf(++_0x30a94f);}(_0x499d,0xd3));var _0xd499=function(_0x54939f,_0x5482a6){_0x54939f=_0x54939f-0x0;var _0xedf635=_0x499d[_0x54939f];return _0xedf635;};'use strict';var Sequelize=require(_0xd499('0x0'));var rs=require(_0xd499('0x1'));module[_0xd499('0x2')]={'name':{'type':Sequelize[_0xd499('0x3')],'unique':_0xd499('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xd499('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xd499('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xd499('0x3')]},'type':{'type':Sequelize[_0xd499('0x5')]('twilio',_0xd499('0x6'),_0xd499('0x7'),_0xd499('0x8'),_0xd499('0x9'),'clickatell',_0xd499('0xa'),_0xd499('0xb'),_0xd499('0xc'),_0xd499('0xd'))},'accountSid':{'type':Sequelize[_0xd499('0x3')]},'authId':{'type':Sequelize[_0xd499('0x3')]},'authToken':{'type':Sequelize[_0xd499('0x3')]},'smsMethod':{'type':Sequelize[_0xd499('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd499('0x3')]},'password':{'type':Sequelize[_0xd499('0x3')]},'apiKey':{'type':Sequelize[_0xd499('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xd499('0x3')]},'senderString':{'type':Sequelize[_0xd499('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xd499('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd499('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd499('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd499('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd499('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xd499('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x360e9e){if(!_0x360e9e)this['setDataValue'](_0xd499('0x11'),null);this[_0xd499('0x12')](_0xd499('0x13'),_0x360e9e);}}}; \ No newline at end of file +var _0x1179=['INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','skebby','connectel','clickatell','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x5471f6,_0x701b78){var _0x20d5e5=function(_0x216fde){while(--_0x216fde){_0x5471f6['push'](_0x5471f6['shift']());}};_0x20d5e5(++_0x701b78);}(_0x1179,0x19c));var _0x9117=function(_0x136b57,_0x31ee69){_0x136b57=_0x136b57-0x0;var _0x3e4036=_0x1179[_0x136b57];return _0x3e4036;};'use strict';var Sequelize=require(_0x9117('0x0'));var rs=require(_0x9117('0x1'));module[_0x9117('0x2')]={'name':{'type':Sequelize[_0x9117('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x9117('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x9117('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9117('0x4')]();}},'phone':{'type':Sequelize[_0x9117('0x3')]},'type':{'type':Sequelize[_0x9117('0x5')]('twilio',_0x9117('0x6'),_0x9117('0x7'),'clicksend','plivo',_0x9117('0x8'),'bandwidth','csc',_0x9117('0x9'),_0x9117('0xa'))},'accountSid':{'type':Sequelize[_0x9117('0x3')]},'authId':{'type':Sequelize[_0x9117('0x3')]},'authToken':{'type':Sequelize[_0x9117('0x3')]},'smsMethod':{'type':Sequelize[_0x9117('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9117('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x9117('0x3')]},'accountId':{'type':Sequelize[_0x9117('0x3')]},'senderString':{'type':Sequelize[_0x9117('0x3')]},'deliveryReport':{'type':Sequelize[_0x9117('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x9117('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9117('0xc');}},'notificationSound':{'type':Sequelize[_0x9117('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9117('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9117('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9117('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9117('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9117('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9117('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x318139){if(!_0x318139)this[_0x9117('0xe')](_0x9117('0xf'),null);this[_0x9117('0xe')](_0x9117('0x10'),_0x318139);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 6b2b719..7f713b0 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 _0xab9a=['where','pick','filter','merge','options','includeAll','rows','show','Pause','mandatoryDispositionPause','rawAttributes','intersection','fields','include','create','body','user','role','get','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','SmsAccountId','Disposition','findOne','hasOwnProperty','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','Body','MessageSid','skebby','sender','text','connectel','clicksend','messageId','plivo','Text','MessageUUID','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','SmsMessage','ContactId','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','stringify','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','internal','color','tag','to\x20is\x20mandatory','List','ListId','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','message_id','status_code','infobip','groupName','DELIVERED','redif','update','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','csc','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','SmsAccounts','destroy','end','name','send','index','map','SmsAccount','fieldName','type','key','keys','filters','model','query','attributes','length','nolimit','order','sort'];(function(_0x3a1b36,_0x483009){var _0x25350e=function(_0x523fbb){while(--_0x523fbb){_0x3a1b36['push'](_0x3a1b36['shift']());}};_0x25350e(++_0x483009);}(_0xab9a,0x182));var _0xaab9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xab9a[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xaab9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaab9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaab9('0x2'));var moment=require(_0xaab9('0x3'));var BPromise=require(_0xaab9('0x4'));var Mustache=require(_0xaab9('0x5'));var util=require('util');var path=require('path');var sox=require(_0xaab9('0x6'));var csv=require(_0xaab9('0x7'));var ejs=require(_0xaab9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaab9('0x9'));var crypto=require(_0xaab9('0xa'));var jsforce=require(_0xaab9('0xb'));var deskjs=require(_0xaab9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaab9('0xd'));var Papa=require(_0xaab9('0xe'));var Redis=require(_0xaab9('0xf'));var authService=require(_0xaab9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaab9('0x11'));var hardwareService=require(_0xaab9('0x12'));var logger=require('../../config/logger')(_0xaab9('0x13'));var utils=require(_0xaab9('0x14'));var config=require(_0xaab9('0x15'));var licenseUtil=require(_0xaab9('0x16'));var db=require(_0xaab9('0x17'))['db'];config[_0xaab9('0x18')]=_[_0xaab9('0x19')](config['redis'],{'host':_0xaab9('0x1a'),'port':0x18eb});var socket=require(_0xaab9('0x1b'))(new Redis(config[_0xaab9('0x18')]));require(_0xaab9('0x1c'))[_0xaab9('0x1d')](socket);var jayson=require(_0xaab9('0x1e'));var client=jayson[_0xaab9('0x1f')][_0xaab9('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x196c96,_0x3f8540,_0xae7d30,_0x27a7ea){return new BPromise(function(_0x5363ee,_0x185443){var _0x4881d9=_0x27a7ea||client;return _0x4881d9[_0xaab9('0x21')](_0x196c96,_0xae7d30)[_0xaab9('0x22')](function(_0x474f29){logger['info'](_0xaab9('0x23'),_0x3f8540,'request\x20sent');logger[_0xaab9('0x24')](_0xaab9('0x25'),_0x3f8540,_0xaab9('0x26'),JSON['stringify'](_0x474f29));if(_0x474f29[_0xaab9('0x27')]){if(_0x474f29[_0xaab9('0x27')][_0xaab9('0x28')]===0x1f4){logger['error'](_0xaab9('0x23'),_0x3f8540,_0x474f29['error'][_0xaab9('0x29')]);return _0x185443(_0x474f29[_0xaab9('0x27')][_0xaab9('0x29')]);}logger['error'](_0xaab9('0x23'),_0x3f8540,_0x474f29['error']['message']);return _0x5363ee(_0x474f29['error'][_0xaab9('0x29')]);}else{logger[_0xaab9('0x2a')]('SmsAccount,\x20%s,\x20%s',_0x3f8540,_0xaab9('0x26'));_0x5363ee(_0x474f29['result'][_0xaab9('0x29')]);}})[_0xaab9('0x2b')](function(_0x347868){logger[_0xaab9('0x27')](_0xaab9('0x23'),_0x3f8540,_0x347868);_0x185443(_0x347868);});});}function respondWithStatusCode(_0x1c82e0,_0x300014){_0x300014=_0x300014||0xcc;return function(_0x5e83b8){if(_0x5e83b8){return _0x1c82e0[_0xaab9('0x2c')](_0x300014);}return _0x1c82e0[_0xaab9('0x2d')](_0x300014)['end']();};}function respondWithResult(_0x297050,_0x560842){_0x560842=_0x560842||0xc8;return function(_0x2aad4c){if(_0x2aad4c){return _0x297050[_0xaab9('0x2d')](_0x560842)[_0xaab9('0x2e')](_0x2aad4c);}};}function respondWithFilteredResult(_0x1f1eef,_0x5916fd){return function(_0x5c7ef3){if(_0x5c7ef3){var _0x2bfce7=typeof _0x5916fd[_0xaab9('0x2f')]===_0xaab9('0x30')&&typeof _0x5916fd[_0xaab9('0x31')]===_0xaab9('0x30');var _0x1d601f=_0x5c7ef3[_0xaab9('0x32')];var _0x539a5f=_0x2bfce7?0x0:_0x5916fd['offset'];var _0x2a30af=_0x2bfce7?_0x5c7ef3[_0xaab9('0x32')]:_0x5916fd['offset']+_0x5916fd[_0xaab9('0x31')];var _0x16fb10;if(_0x2a30af>=_0x1d601f){_0x2a30af=_0x1d601f;_0x16fb10=0xc8;}else{_0x16fb10=0xce;}_0x1f1eef[_0xaab9('0x2d')](_0x16fb10);return _0x1f1eef[_0xaab9('0x33')](_0xaab9('0x34'),_0x539a5f+'-'+_0x2a30af+'/'+_0x1d601f)[_0xaab9('0x2e')](_0x5c7ef3);}return null;};}function patchUpdates(_0x1b54d5){return function(_0x14c7d6){try{jsonpatch[_0xaab9('0x35')](_0x14c7d6,_0x1b54d5,!![]);}catch(_0x1c3b9d){return BPromise[_0xaab9('0x36')](_0x1c3b9d);}return _0x14c7d6[_0xaab9('0x37')]();};}function saveUpdates(_0x4e54dd,_0x5ebc43){return function(_0x5042b1){if(_0x5042b1){return _0x5042b1['update'](_0x4e54dd)[_0xaab9('0x22')](function(_0x29747b){return _0x29747b;});}return null;};}function removeEntity(_0x483b62,_0xe491b1){return function(_0x551754){if(_0x551754){return _0x551754['destroy']()[_0xaab9('0x22')](function(){var _0x3ae8ff=_0x551754['get']({'plain':!![]});var _0xd9e8ee=_0xaab9('0x38');return db['UserProfileResource'][_0xaab9('0x39')]({'where':{'type':_0xd9e8ee,'resourceId':_0x3ae8ff['id']}})[_0xaab9('0x22')](function(){return _0x551754;});})[_0xaab9('0x22')](function(){_0x483b62[_0xaab9('0x2d')](0xcc)[_0xaab9('0x3a')]();});}};}function handleEntityNotFound(_0x404bc8,_0x396a8c){return function(_0x56ed11){if(!_0x56ed11){_0x404bc8['sendStatus'](0x194);}return _0x56ed11;};}function handleError(_0x1946ad,_0x2bb45d){_0x2bb45d=_0x2bb45d||0x1f4;return function(_0x23fd1f){logger[_0xaab9('0x27')](_0x23fd1f['stack']);if(_0x23fd1f[_0xaab9('0x3b')]){delete _0x23fd1f['name'];}_0x1946ad[_0xaab9('0x2d')](_0x2bb45d)[_0xaab9('0x3c')](_0x23fd1f);};}exports[_0xaab9('0x3d')]=function(_0x4c2145,_0x9bc02b){var _0x52d3a6={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4a48bb={},_0x2a6b4f={'count':0x0,'rows':[]};var _0x412523=_[_0xaab9('0x3e')](db[_0xaab9('0x3f')]['rawAttributes'],function(_0x26a94e){return{'name':_0x26a94e[_0xaab9('0x40')],'type':_0x26a94e[_0xaab9('0x41')][_0xaab9('0x42')]};});_0x4a48bb['model']=_[_0xaab9('0x3e')](_0x412523,_0xaab9('0x3b'));_0x4a48bb['query']=_[_0xaab9('0x43')](_0x4c2145['query']);_0x4a48bb[_0xaab9('0x44')]=_['intersection'](_0x4a48bb[_0xaab9('0x45')],_0x4a48bb[_0xaab9('0x46')]);_0x52d3a6[_0xaab9('0x47')]=_['intersection'](_0x4a48bb[_0xaab9('0x45')],qs['fields'](_0x4c2145[_0xaab9('0x46')]['fields']));_0x52d3a6[_0xaab9('0x47')]=_0x52d3a6[_0xaab9('0x47')][_0xaab9('0x48')]?_0x52d3a6[_0xaab9('0x47')]:_0x4a48bb[_0xaab9('0x45')];if(!_0x4c2145[_0xaab9('0x46')]['hasOwnProperty'](_0xaab9('0x49'))){_0x52d3a6['limit']=qs['limit'](_0x4c2145[_0xaab9('0x46')]['limit']);_0x52d3a6[_0xaab9('0x2f')]=qs[_0xaab9('0x2f')](_0x4c2145[_0xaab9('0x46')][_0xaab9('0x2f')]);}_0x52d3a6[_0xaab9('0x4a')]=qs[_0xaab9('0x4b')](_0x4c2145[_0xaab9('0x46')][_0xaab9('0x4b')]);_0x52d3a6[_0xaab9('0x4c')]=qs[_0xaab9('0x44')](_[_0xaab9('0x4d')](_0x4c2145[_0xaab9('0x46')],_0x4a48bb[_0xaab9('0x44')]),_0x412523);if(_0x4c2145[_0xaab9('0x46')][_0xaab9('0x4e')]){_0x52d3a6[_0xaab9('0x4c')]=_['merge'](_0x52d3a6['where'],{'$or':_[_0xaab9('0x3e')](_0x412523,function(_0x581110){if(_0x581110['type']!=='VIRTUAL'){var _0x1635a2={};_0x1635a2[_0x581110[_0xaab9('0x3b')]]={'$like':'%'+_0x4c2145[_0xaab9('0x46')][_0xaab9('0x4e')]+'%'};return _0x1635a2;}})});}_0x52d3a6=_[_0xaab9('0x4f')]({},_0x52d3a6,_0x4c2145[_0xaab9('0x50')]);var _0x410cc5={'where':_0x52d3a6[_0xaab9('0x4c')]};return db[_0xaab9('0x3f')]['count'](_0x410cc5)[_0xaab9('0x22')](function(_0x44b03c){_0x2a6b4f['count']=_0x44b03c;if(_0x4c2145[_0xaab9('0x46')][_0xaab9('0x51')]){_0x52d3a6['include']=[{'all':!![]}];}return db[_0xaab9('0x3f')]['findAll'](_0x52d3a6);})[_0xaab9('0x22')](function(_0x59a8a6){_0x2a6b4f[_0xaab9('0x52')]=_0x59a8a6;return _0x2a6b4f;})[_0xaab9('0x22')](respondWithFilteredResult(_0x9bc02b,_0x52d3a6))['catch'](handleError(_0x9bc02b,null));};exports[_0xaab9('0x53')]=function(_0x3e1c3a,_0x2610e7){var _0x1a8049={'raw':![],'where':{'id':_0x3e1c3a['params']['id']},'include':[{'model':db[_0xaab9('0x54')],'as':_0xaab9('0x55')}]},_0xb0577d={};_0xb0577d[_0xaab9('0x45')]=_['keys'](db[_0xaab9('0x3f')][_0xaab9('0x56')]);_0xb0577d[_0xaab9('0x46')]=_[_0xaab9('0x43')](_0x3e1c3a[_0xaab9('0x46')]);_0xb0577d[_0xaab9('0x44')]=_[_0xaab9('0x57')](_0xb0577d[_0xaab9('0x45')],_0xb0577d[_0xaab9('0x46')]);_0x1a8049['attributes']=_[_0xaab9('0x57')](_0xb0577d[_0xaab9('0x45')],qs[_0xaab9('0x58')](_0x3e1c3a[_0xaab9('0x46')][_0xaab9('0x58')]));_0x1a8049[_0xaab9('0x47')]=_0x1a8049[_0xaab9('0x47')][_0xaab9('0x48')]?_0x1a8049[_0xaab9('0x47')]:_0xb0577d[_0xaab9('0x45')];if(_0x3e1c3a[_0xaab9('0x46')][_0xaab9('0x51')]){_0x1a8049[_0xaab9('0x59')]=[{'all':!![]}];}_0x1a8049=_[_0xaab9('0x4f')]({},_0x1a8049,_0x3e1c3a['options']);return db[_0xaab9('0x3f')]['find'](_0x1a8049)[_0xaab9('0x22')](handleEntityNotFound(_0x2610e7,null))[_0xaab9('0x22')](respondWithResult(_0x2610e7,null))[_0xaab9('0x2b')](handleError(_0x2610e7,null));};exports[_0xaab9('0x5a')]=function(_0x59535d,_0x12ef02){return db[_0xaab9('0x3f')][_0xaab9('0x5a')](_0x59535d[_0xaab9('0x5b')],{})[_0xaab9('0x22')](function(_0x4e54f2){var _0x1b6b75=_0x59535d[_0xaab9('0x5c')]['get']({'plain':!![]});if(!_0x1b6b75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b6b75[_0xaab9('0x5d')]===_0xaab9('0x5c')){var _0x416a8e=_0x4e54f2[_0xaab9('0x5e')]({'plain':!![]});var _0x2d6af4=_0xaab9('0x38');return db['UserProfileSection'][_0xaab9('0x5f')]({'where':{'name':_0x2d6af4,'userProfileId':_0x1b6b75['userProfileId']},'raw':!![]})['then'](function(_0x1f69dc){if(_0x1f69dc&&_0x1f69dc['autoAssociation']===0x0){return db[_0xaab9('0x60')]['create']({'name':_0x416a8e[_0xaab9('0x3b')],'resourceId':_0x416a8e['id'],'type':_0x1f69dc[_0xaab9('0x3b')],'sectionId':_0x1f69dc['id']},{})['then'](function(){return _0x4e54f2;});}else{return _0x4e54f2;}})[_0xaab9('0x2b')](function(_0x13f4fe){logger[_0xaab9('0x27')](_0xaab9('0x61'),_0x13f4fe);throw _0x13f4fe;});}return _0x4e54f2;})[_0xaab9('0x22')](respondWithResult(_0x12ef02,0xc9))[_0xaab9('0x2b')](handleError(_0x12ef02,null));};exports['update']=function(_0x5b0d9f,_0xf4463c){if(_0x5b0d9f[_0xaab9('0x5b')]['id']){delete _0x5b0d9f['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x5b0d9f[_0xaab9('0x62')]['id']},'include':[{'model':db[_0xaab9('0x54')],'as':_0xaab9('0x55')}]})[_0xaab9('0x22')](handleEntityNotFound(_0xf4463c,null))[_0xaab9('0x22')](saveUpdates(_0x5b0d9f[_0xaab9('0x5b')],null))['then'](respondWithResult(_0xf4463c,null))[_0xaab9('0x2b')](handleError(_0xf4463c,null));};exports['destroy']=function(_0x1b9143,_0x1f6693){return db['SmsAccount'][_0xaab9('0x5f')]({'where':{'id':_0x1b9143[_0xaab9('0x62')]['id']}})['then'](handleEntityNotFound(_0x1f6693,null))[_0xaab9('0x22')](removeEntity(_0x1f6693,null))[_0xaab9('0x2b')](handleError(_0x1f6693,null));};exports[_0xaab9('0x63')]=function(_0x378ecd,_0x525d72){return db[_0xaab9('0x3f')][_0xaab9('0x63')]()[_0xaab9('0x22')](respondWithResult(_0x525d72,null))[_0xaab9('0x2b')](handleError(_0x525d72,null));};exports['addDisposition']=function(_0x19f786,_0x5ba2db,_0x3f605f){if(_0x19f786['body']['id']){delete _0x19f786['body']['id'];}return db[_0xaab9('0x3f')][_0xaab9('0x5f')]({'where':{'id':_0x19f786['params']['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x5ba2db,null))[_0xaab9('0x22')](function(_0x1c18bb){if(_0x1c18bb){_0x19f786[_0xaab9('0x5b')][_0xaab9('0x64')]=_0x1c18bb['id'];return db[_0xaab9('0x65')][_0xaab9('0x5a')](_0x19f786['body']);}})[_0xaab9('0x22')](respondWithResult(_0x5ba2db,null))[_0xaab9('0x2b')](handleError(_0x5ba2db,null));};exports['getDispositions']=function(_0x15c0e6,_0x54a7c1,_0x2eae34){var _0x44e11e={'raw':![],'where':{}};var _0x5dd549={};var _0x48316a={'count':0x0,'rows':[]};return db['SmsAccount'][_0xaab9('0x66')]({'where':{'id':_0x15c0e6['params']['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x54a7c1,null))[_0xaab9('0x22')](function(_0x235708){if(_0x235708){_0x5dd549[_0xaab9('0x45')]=_['keys'](db[_0xaab9('0x65')][_0xaab9('0x56')]);_0x5dd549[_0xaab9('0x46')]=_['keys'](_0x15c0e6['query']);_0x5dd549[_0xaab9('0x44')]=_[_0xaab9('0x57')](_0x5dd549[_0xaab9('0x45')],_0x5dd549['query']);_0x44e11e['attributes']=_[_0xaab9('0x57')](_0x5dd549[_0xaab9('0x45')],qs[_0xaab9('0x58')](_0x15c0e6[_0xaab9('0x46')][_0xaab9('0x58')]));_0x44e11e[_0xaab9('0x47')]=_0x44e11e[_0xaab9('0x47')][_0xaab9('0x48')]?_0x44e11e[_0xaab9('0x47')]:_0x5dd549[_0xaab9('0x45')];if(!_0x15c0e6[_0xaab9('0x46')][_0xaab9('0x67')](_0xaab9('0x49'))){_0x44e11e[_0xaab9('0x31')]=qs[_0xaab9('0x31')](_0x15c0e6['query'][_0xaab9('0x31')]);_0x44e11e[_0xaab9('0x2f')]=qs[_0xaab9('0x2f')](_0x15c0e6['query'][_0xaab9('0x2f')]);}_0x44e11e[_0xaab9('0x4a')]=qs['sort'](_0x15c0e6[_0xaab9('0x46')]['sort']);_0x44e11e[_0xaab9('0x4c')]=qs[_0xaab9('0x44')](_[_0xaab9('0x4d')](_0x15c0e6[_0xaab9('0x46')],_0x5dd549[_0xaab9('0x44')]));_0x44e11e[_0xaab9('0x4c')][_0xaab9('0x64')]=_0x235708['id'];if(_0x15c0e6[_0xaab9('0x46')]['filter']){_0x44e11e['where']=_[_0xaab9('0x4f')](_0x44e11e[_0xaab9('0x4c')],{'$or':_[_0xaab9('0x3e')](_0x44e11e['attributes'],function(_0x3c9d24){var _0x5441ec={};_0x5441ec[_0x3c9d24]={'$like':'%'+_0x15c0e6[_0xaab9('0x46')]['filter']+'%'};return _0x5441ec;})});}_0x44e11e=_['merge']({},_0x44e11e,_0x15c0e6['options']);return db[_0xaab9('0x65')][_0xaab9('0x32')]({'where':_0x44e11e[_0xaab9('0x4c')]})[_0xaab9('0x22')](function(_0xa02b17){_0x48316a[_0xaab9('0x32')]=_0xa02b17;if(_0x15c0e6['query'][_0xaab9('0x51')]){_0x44e11e[_0xaab9('0x59')]=[{'all':!![]}];}return db[_0xaab9('0x65')][_0xaab9('0x68')](_0x44e11e);})[_0xaab9('0x22')](function(_0x3456de){_0x48316a[_0xaab9('0x52')]=_0x3456de;return _0x48316a;});}})['then'](respondWithFilteredResult(_0x54a7c1,_0x44e11e))['catch'](handleError(_0x54a7c1,null));};exports[_0xaab9('0x69')]=function(_0x19872d,_0x473abf,_0x235415){return db[_0xaab9('0x3f')]['find']({'where':{'id':_0x19872d[_0xaab9('0x62')]['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x473abf,null))[_0xaab9('0x22')](function(_0x348085){if(_0x348085){return _0x348085[_0xaab9('0x69')](_0x19872d[_0xaab9('0x46')][_0xaab9('0x6a')]);}})[_0xaab9('0x22')](respondWithStatusCode(_0x473abf,null))[_0xaab9('0x2b')](handleError(_0x473abf,null));};exports[_0xaab9('0x6b')]=function(_0xce966d,_0x2bc2fd,_0x2e2c75){if(_0xce966d[_0xaab9('0x5b')]['id']){delete _0xce966d[_0xaab9('0x5b')]['id'];}return db[_0xaab9('0x3f')][_0xaab9('0x5f')]({'where':{'id':_0xce966d[_0xaab9('0x62')]['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x2bc2fd,null))[_0xaab9('0x22')](function(_0x1cff05){if(_0x1cff05){_0xce966d[_0xaab9('0x5b')]['SmsAccountId']=_0x1cff05['id'];return db[_0xaab9('0x6c')]['create'](_0xce966d['body']);}})[_0xaab9('0x22')](respondWithResult(_0x2bc2fd,null))[_0xaab9('0x2b')](handleError(_0x2bc2fd,null));};exports[_0xaab9('0x6d')]=function(_0x828a5f,_0x129ffe,_0xbaacc1){var _0x37d170={'raw':![],'where':{}};var _0x192567={};var _0x217414={'count':0x0,'rows':[]};return db[_0xaab9('0x3f')][_0xaab9('0x66')]({'where':{'id':_0x828a5f['params']['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x129ffe,null))[_0xaab9('0x22')](function(_0x392753){if(_0x392753){_0x192567[_0xaab9('0x45')]=_[_0xaab9('0x43')](db[_0xaab9('0x6c')][_0xaab9('0x56')]);_0x192567[_0xaab9('0x46')]=_[_0xaab9('0x43')](_0x828a5f[_0xaab9('0x46')]);_0x192567[_0xaab9('0x44')]=_[_0xaab9('0x57')](_0x192567[_0xaab9('0x45')],_0x192567[_0xaab9('0x46')]);_0x37d170[_0xaab9('0x47')]=_['intersection'](_0x192567[_0xaab9('0x45')],qs[_0xaab9('0x58')](_0x828a5f['query'][_0xaab9('0x58')]));_0x37d170[_0xaab9('0x47')]=_0x37d170['attributes'][_0xaab9('0x48')]?_0x37d170[_0xaab9('0x47')]:_0x192567[_0xaab9('0x45')];if(!_0x828a5f[_0xaab9('0x46')][_0xaab9('0x67')]('nolimit')){_0x37d170[_0xaab9('0x31')]=qs[_0xaab9('0x31')](_0x828a5f[_0xaab9('0x46')][_0xaab9('0x31')]);_0x37d170[_0xaab9('0x2f')]=qs[_0xaab9('0x2f')](_0x828a5f['query'][_0xaab9('0x2f')]);}_0x37d170[_0xaab9('0x4a')]=qs[_0xaab9('0x4b')](_0x828a5f[_0xaab9('0x46')]['sort']);_0x37d170[_0xaab9('0x4c')]=qs[_0xaab9('0x44')](_[_0xaab9('0x4d')](_0x828a5f[_0xaab9('0x46')],_0x192567[_0xaab9('0x44')]));_0x37d170[_0xaab9('0x4c')][_0xaab9('0x64')]=_0x392753['id'];if(_0x828a5f[_0xaab9('0x46')][_0xaab9('0x4e')]){_0x37d170[_0xaab9('0x4c')]=_[_0xaab9('0x4f')](_0x37d170[_0xaab9('0x4c')],{'$or':_['map'](_0x37d170[_0xaab9('0x47')],function(_0x3af124){var _0x3d5a35={};_0x3d5a35[_0x3af124]={'$like':'%'+_0x828a5f[_0xaab9('0x46')][_0xaab9('0x4e')]+'%'};return _0x3d5a35;})});}_0x37d170=_[_0xaab9('0x4f')]({},_0x37d170,_0x828a5f[_0xaab9('0x50')]);return db[_0xaab9('0x6c')][_0xaab9('0x32')]({'where':_0x37d170['where']})[_0xaab9('0x22')](function(_0x3b2c92){_0x217414[_0xaab9('0x32')]=_0x3b2c92;if(_0x828a5f[_0xaab9('0x46')][_0xaab9('0x51')]){_0x37d170[_0xaab9('0x59')]=[{'all':!![]}];}return db[_0xaab9('0x6c')][_0xaab9('0x68')](_0x37d170);})['then'](function(_0x531037){_0x217414[_0xaab9('0x52')]=_0x531037;return _0x217414;});}})['then'](respondWithFilteredResult(_0x129ffe,_0x37d170))[_0xaab9('0x2b')](handleError(_0x129ffe,null));};exports[_0xaab9('0x6e')]=function(_0xb1d9cc,_0x274d78,_0x346f9d){return db['SmsAccount'][_0xaab9('0x5f')]({'where':{'id':_0xb1d9cc[_0xaab9('0x62')]['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x274d78,null))[_0xaab9('0x22')](function(_0x549a5a){if(_0x549a5a){return _0x549a5a[_0xaab9('0x6e')](_0xb1d9cc[_0xaab9('0x46')][_0xaab9('0x6a')]);}})[_0xaab9('0x22')](respondWithStatusCode(_0x274d78,null))[_0xaab9('0x2b')](handleError(_0x274d78,null));};exports[_0xaab9('0x6f')]=function(_0xd23351,_0x140666,_0x377a04){var _0x100a34={'channel':_0xaab9('0x70')};var _0x3dd283=[];var _0x5d7d30=[];var _0x4de873={};return db['SmsAccount'][_0xaab9('0x5f')]({'where':{'id':_0xd23351[_0xaab9('0x62')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xaab9('0x71')}]})['then'](handleEntityNotFound(_0x140666,null))[_0xaab9('0x22')](function(_0x529911){_0x100a34[_0xaab9('0x72')]=_0x529911;_0x100a34[_0xaab9('0x73')]=_[_0xaab9('0x74')](_0x529911[_0xaab9('0x71')],[_0xaab9('0x75')],[_0xaab9('0x76')]);if(_0x100a34[_0xaab9('0x72')][_0xaab9('0x71')]){delete _0x100a34['account']['Applications'];}return db['CmContact'][_0xaab9('0x63')]();})['then'](function(_0xbc4d78){if(!_0xbc4d78){throw new db[(_0xaab9('0x77'))]['ValidationError'](_0xaab9('0x78'));}_0x3dd283=_[_0xaab9('0x79')](_['keys'](_0xbc4d78),[_0xaab9('0x7a'),_0xaab9('0x7b')]);_0x5d7d30=_['difference'](_[_0xaab9('0x43')](_0xbc4d78),[_0xaab9('0x7a'),_0xaab9('0x7b'),_0xaab9('0x7c'),'ListId']);_0x100a34[_0xaab9('0x5b')]={'mapKey':'mobile'};if(_0x100a34[_0xaab9('0x72')][_0xaab9('0x41')]){switch(_0x100a34['account'][_0xaab9('0x41')]){case _0xaab9('0x7d'):_0x100a34[_0xaab9('0x5b')][_0xaab9('0x7e')]=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x7f')];_0x100a34[_0xaab9('0x5b')][_0xaab9('0x5b')]=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x80')];_0x100a34['body']['messageId']=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x81')];break;case _0xaab9('0x82'):_0x100a34[_0xaab9('0x5b')][_0xaab9('0x7e')]='+'+_0xd23351[_0xaab9('0x5b')][_0xaab9('0x83')];_0x100a34[_0xaab9('0x5b')]['body']=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x84')];break;case _0xaab9('0x85'):_0x100a34['body'][_0xaab9('0x7e')]=_0xd23351['body'][_0xaab9('0x7e')];_0x100a34[_0xaab9('0x5b')][_0xaab9('0x5b')]=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x29')];break;case _0xaab9('0x86'):_0x100a34[_0xaab9('0x5b')]['from']=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x7e')];_0x100a34[_0xaab9('0x5b')]['body']=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x5b')];_0x100a34[_0xaab9('0x5b')][_0xaab9('0x87')]=_0xd23351['body']['message_id'];break;case _0xaab9('0x88'):_0x100a34['body'][_0xaab9('0x7e')]=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x7f')];_0x100a34[_0xaab9('0x5b')]['body']=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x89')];_0x100a34[_0xaab9('0x5b')]['messageId']=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x8a')];break;case'infobip':_0x100a34[_0xaab9('0x5b')]['from']='+'+_0xd23351[_0xaab9('0x5b')]['results'][0x0]['from'];_0x100a34['body']['body']=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x8b')][0x0][_0xaab9('0x84')];_0x100a34[_0xaab9('0x5b')]['messageId']=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x8b')][0x0][_0xaab9('0x87')];break;case'csc':_0x100a34[_0xaab9('0x5b')][_0xaab9('0x7e')]=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x8c')];_0x100a34[_0xaab9('0x5b')]['body']=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x8d')]['message'];break;case _0xaab9('0x8e'):_0x100a34['body']['from']=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x8f')];_0x100a34['body'][_0xaab9('0x5b')]=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x84')];_0x100a34[_0xaab9('0x5b')][_0xaab9('0x87')]=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x90')];break;case _0xaab9('0x91'):_0x100a34[_0xaab9('0x5b')]['messageId']=_0xd23351[_0xaab9('0x5b')][0x0][_0xaab9('0x29')]['id'];_0x100a34['body'][_0xaab9('0x7e')]=_0xd23351[_0xaab9('0x5b')][0x0][_0xaab9('0x29')][_0xaab9('0x7e')];_0x100a34[_0xaab9('0x5b')]['body']=_0xd23351[_0xaab9('0x5b')][0x0][_0xaab9('0x29')][_0xaab9('0x84')];break;case _0xaab9('0x92'):_0x100a34[_0xaab9('0x5b')][_0xaab9('0x7e')]=_0xd23351[_0xaab9('0x5b')][_0xaab9('0x7e')];_0x100a34[_0xaab9('0x5b')]['body']=_0xd23351['body']['message'];_0x100a34[_0xaab9('0x5b')][_0xaab9('0x87')]=_0xd23351[_0xaab9('0x5b')]['refid'];break;}}if(_0x100a34[_0xaab9('0x5b')]['id']){delete _0x100a34['body']['id'];}if(_[_0xaab9('0x93')](_0x100a34['body']['from'])){throw new db[(_0xaab9('0x77'))][(_0xaab9('0x94'))](_0xaab9('0x95'));}if(_[_0xaab9('0x93')](_0x100a34[_0xaab9('0x5b')]['body'])||_0x100a34['body'][_0xaab9('0x5b')]===''){throw new db['Sequelize'][(_0xaab9('0x94'))](_0xaab9('0x96'));}if(_[_0xaab9('0x93')](_0x100a34['body'][_0xaab9('0x97')])){throw new db[(_0xaab9('0x77'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5d7d30);}if(!_[_0xaab9('0x98')](_0x5d7d30,_0x100a34[_0xaab9('0x5b')][_0xaab9('0x97')])){throw new db['Sequelize'][(_0xaab9('0x94'))](_0xaab9('0x99')+_0x5d7d30);}_0x4de873[_0x100a34[_0xaab9('0x5b')][_0xaab9('0x97')]]=_0x100a34[_0xaab9('0x5b')]['from'];return db[_0xaab9('0x9a')]['find']({'where':{'id':_0x100a34[_0xaab9('0x72')]['ListId']},'include':[{'model':db[_0xaab9('0x9b')],'as':_0xaab9('0x9c'),'where':_0x4de873,'limit':0x1,'order':[[_0xaab9('0x7b'),_0xaab9('0x9d')]]}]});})['then'](handleEntityNotFound(_0x140666,null))[_0xaab9('0x22')](function(_0x21ed25){if(_0x21ed25){_0x100a34[_0xaab9('0x9e')]=_[_0xaab9('0x9f')](_0x21ed25,[_0xaab9('0x9c')]);if(_0x21ed25[_0xaab9('0x9c')]['length']){return _0x21ed25[_0xaab9('0x9c')][0x0];}var _0x3d997e=_[_0xaab9('0x19')](_0x100a34[_0xaab9('0x5b')],{'firstName':_0x100a34[_0xaab9('0x5b')][_0xaab9('0x7e')],'ListId':_0x21ed25['id']});_0x3d997e[_0x100a34[_0xaab9('0x5b')][_0xaab9('0x97')]]=_0x100a34['body'][_0xaab9('0x7e')];return db[_0xaab9('0x9b')][_0xaab9('0x5a')](_0x3d997e,{'fields':_0x3dd283,'raw':!![]});}})[_0xaab9('0x22')](handleEntityNotFound(_0x140666,null))[_0xaab9('0x22')](function(_0x527067){if(_0x527067){_0x100a34[_0xaab9('0xa0')]=_0x527067;var _0x59e93e={'ContactId':_0x527067['id'],'phone':_0x100a34[_0xaab9('0x5b')][_0xaab9('0x7e')],'SmsAccountId':_0xd23351[_0xaab9('0x62')]['id']};var _0x53b6ec={'ContactId':_0x527067['id'],'SmsAccountId':_0xd23351['params']['id'],'closed':![]};return db['SmsInteraction'][_0xaab9('0x5f')]({'where':_0x53b6ec})[_0xaab9('0x22')](function(_0x3f66cd){if(_0x3f66cd){return[_0x3f66cd,![]];}return db[_0xaab9('0xa1')][_0xaab9('0x5a')](_0x59e93e)[_0xaab9('0x22')](function(_0x33f672){return[_0x33f672,!![]];});});}})[_0xaab9('0xa2')](function(_0xca459a,_0x2e9868){_0x100a34[_0xaab9('0xa3')]=_0xca459a[_0xaab9('0x5e')]({'plain':!![]});_0x100a34[_0xaab9('0xa3')][_0xaab9('0xa4')]=![];if(_0x2e9868){if(_0x100a34[_0xaab9('0x72')][_0xaab9('0xa5')]){_0x100a34[_0xaab9('0x73')][_0xaab9('0xa6')]({'id':0x0,'priority':_0x100a34[_0xaab9('0x73')][_0xaab9('0x48')]+0x1,'app':_0xaab9('0xa7'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x100a34['interaction'][_0xaab9('0xa4')]=!![];}return db[_0xaab9('0xa8')][_0xaab9('0x5a')]({'phone':_0x100a34[_0xaab9('0x5b')][_0xaab9('0x7e')],'messageId':_0x100a34[_0xaab9('0x5b')][_0xaab9('0x87')],'body':_0x100a34[_0xaab9('0x5b')]['body'],'SmsAccountId':_0xd23351[_0xaab9('0x62')]['id'],'SmsInteractionId':_0xca459a['id'],'direction':'in','ContactId':_0xca459a[_0xaab9('0xa9')],'AttachmentId':_0x100a34[_0xaab9('0x5b')][_0xaab9('0xaa')]});})['then'](function(_0x549766){_0x100a34['message']=_0x549766;if(_0x100a34[_0xaab9('0xa3')]['UserId']){return db[_0xaab9('0xab')][_0xaab9('0x5f')]({'attributes':['id','name'],'where':{'id':_0x100a34[_0xaab9('0xa3')][_0xaab9('0xac')]}})[_0xaab9('0x22')](function(_0x12be09){if(_0x12be09){_0x100a34[_0xaab9('0x73')]['unshift']({'id':0x0,'priority':0x0,'app':_0xaab9('0xad'),'appdata':_0x12be09[_0xaab9('0x3b')]+','+(_0x100a34[_0xaab9('0x72')][_0xaab9('0xae')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xaab9('0xaf'),_0x100a34);});}return respondWithRpcPromise('Start',_0xaab9('0xaf'),_0x100a34);})[_0xaab9('0x22')](function(_0x2cd550){if(_0x2cd550){var _0x58bd40=0xc8;var _0x1073c3=_0xaab9('0xb0');logger[_0xaab9('0x2a')](_0xaab9('0x25'),_0x1073c3,_0x58bd40,_0xaab9('0xb1'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1073c3,_0x58bd40,_0xaab9('0xb1'),JSON[_0xaab9('0xb2')](_0x2cd550));if(_0x100a34[_0xaab9('0x72')][_0xaab9('0x41')]===_0xaab9('0x7d')){return _0x140666[_0xaab9('0x2d')](_0x58bd40)[_0xaab9('0x33')]('Content-Type',_0xaab9('0xb3'))[_0xaab9('0x3c')](_0xaab9('0xb4'));}else{return _0x140666['status'](_0x58bd40)[_0xaab9('0x2e')](_0x2cd550);}}})['catch'](handleError(_0x140666,null));};exports[_0xaab9('0xb5')]=function(_0x4ae8cd,_0x1d26f8){var _0x49d0ef=_0x4ae8cd[_0xaab9('0x62')]['id'];var _0x4baf41=_0x4ae8cd['body'];var _0x475003=0xc8;var _0x361188=null;return db['sequelize'][_0xaab9('0xb6')]({'isolationLevel':db[_0xaab9('0xb7')][_0xaab9('0xb8')][_0xaab9('0xb9')][_0xaab9('0xba')]},function(_0x380258){return db[_0xaab9('0x3f')]['findOne']({'where':{'id':_0x49d0ef},'transaction':_0x380258})[_0xaab9('0x22')](function(_0x382164){if(_0x382164){return db[_0xaab9('0xbb')]['destroy']({'where':{'SmsAccountId':_0x49d0ef},'transaction':_0x380258})[_0xaab9('0x22')](function(){var _0x344c2a=_[_0xaab9('0x3e')](_0x4baf41,function(_0x2654d2){_0x2654d2[_0xaab9('0x64')]=_0x49d0ef;return _0x2654d2;});return db[_0xaab9('0xbb')][_0xaab9('0xbc')](_0x344c2a,{'transaction':_0x380258});});}else{_0x475003=0x194;_0x361188=[];}});})[_0xaab9('0x22')](function(){if(_0x475003!==0x194){return db[_0xaab9('0xbb')][_0xaab9('0xbd')]({'where':{'SmsAccountId':_0x49d0ef},'order':_0xaab9('0x75')})[_0xaab9('0x22')](function(_0x2e57ab){_0x361188=_0x2e57ab;});}})[_0xaab9('0x2b')](function(_0x7e3a95){_0x475003=0x1f4;logger[_0xaab9('0x27')](_0x7e3a95['stack']);if(_0x7e3a95[_0xaab9('0x3b')]){delete _0x7e3a95['name'];}_0x361188=_0x7e3a95;})[_0xaab9('0xbe')](function(){if(_0x361188===null){_0x1d26f8['sendStatus'](_0x475003);}else{if(_0x475003===0x1f4){_0x1d26f8[_0xaab9('0x2d')](_0x475003)[_0xaab9('0x3c')](_0x361188);}else{_0x1d26f8[_0xaab9('0x2d')](_0x475003)[_0xaab9('0x2e')](_0x361188);}}});};exports[_0xaab9('0xbf')]=function(_0x298090,_0x493645,_0x558ce2){var _0x49559a={};var _0x52309d={};var _0x461690;var _0x3dd24e;return db[_0xaab9('0x3f')][_0xaab9('0x66')]({'where':{'id':_0x298090[_0xaab9('0x62')]['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x493645,null))[_0xaab9('0x22')](function(_0xfed38e){if(_0xfed38e){_0x461690=_0xfed38e;_0x52309d[_0xaab9('0x45')]=_['keys'](db['SmsApplication'][_0xaab9('0x56')]);_0x52309d[_0xaab9('0x46')]=_[_0xaab9('0x43')](_0x298090[_0xaab9('0x46')]);_0x52309d[_0xaab9('0x44')]=_[_0xaab9('0x57')](_0x52309d['model'],_0x52309d[_0xaab9('0x46')]);_0x49559a[_0xaab9('0x47')]=_[_0xaab9('0x57')](_0x52309d[_0xaab9('0x45')],qs[_0xaab9('0x58')](_0x298090[_0xaab9('0x46')]['fields']));_0x49559a[_0xaab9('0x47')]=_0x49559a[_0xaab9('0x47')]['length']?_0x49559a[_0xaab9('0x47')]:_0x52309d[_0xaab9('0x45')];_0x49559a['order']=qs['sort'](_0x298090['query']['sort']);_0x49559a['where']=qs['filters'](_['pick'](_0x298090[_0xaab9('0x46')],_0x52309d[_0xaab9('0x44')]));if(_0x298090['query'][_0xaab9('0x4e')]){_0x49559a[_0xaab9('0x4c')]=_[_0xaab9('0x4f')](_0x49559a[_0xaab9('0x4c')],{'$or':_[_0xaab9('0x3e')](_0x49559a[_0xaab9('0x47')],function(_0x485fbb){var _0x2dca93={};_0x2dca93[_0x485fbb]={'$like':'%'+_0x298090[_0xaab9('0x46')][_0xaab9('0x4e')]+'%'};return _0x2dca93;})});}_0x49559a=_['merge']({},_0x49559a,_0x298090[_0xaab9('0x50')]);return _0x461690[_0xaab9('0xbf')](_0x49559a);}})[_0xaab9('0x22')](function(_0xca2889){if(_0xca2889){_0x3dd24e=_0xca2889[_0xaab9('0x48')];if(!_0x298090[_0xaab9('0x46')][_0xaab9('0x67')](_0xaab9('0x49'))){_0x49559a[_0xaab9('0x31')]=qs['limit'](_0x298090[_0xaab9('0x46')]['limit']);_0x49559a[_0xaab9('0x2f')]=qs[_0xaab9('0x2f')](_0x298090[_0xaab9('0x46')][_0xaab9('0x2f')]);}return _0x461690[_0xaab9('0xbf')](_0x49559a);}})[_0xaab9('0x22')](function(_0x2cdf59){if(_0x2cdf59){return _0x2cdf59?{'count':_0x3dd24e,'rows':_0x2cdf59}:null;}})[_0xaab9('0x22')](respondWithResult(_0x493645,null))['catch'](handleError(_0x493645,null));};exports[_0xaab9('0xc0')]=function(_0x5669be,_0x39d5cd,_0x57fb2d){var _0x59a2c9={'raw':![],'where':{}};var _0x209923={};var _0x2a535b={'count':0x0,'rows':[]};return db[_0xaab9('0x3f')][_0xaab9('0x66')]({'where':{'id':_0x5669be['params']['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x39d5cd,null))[_0xaab9('0x22')](function(_0x20d9fc){if(_0x20d9fc){_0x209923[_0xaab9('0x45')]=_[_0xaab9('0x43')](db[_0xaab9('0xa1')][_0xaab9('0x56')]);_0x209923['query']=_[_0xaab9('0x43')](_0x5669be[_0xaab9('0x46')]);_0x209923[_0xaab9('0x44')]=_[_0xaab9('0x57')](_0x209923[_0xaab9('0x45')],_0x209923[_0xaab9('0x46')]);_0x59a2c9[_0xaab9('0x47')]=_[_0xaab9('0x57')](_0x209923[_0xaab9('0x45')],qs[_0xaab9('0x58')](_0x5669be[_0xaab9('0x46')][_0xaab9('0x58')]));_0x59a2c9[_0xaab9('0x47')]=_0x59a2c9[_0xaab9('0x47')]['length']?_0x59a2c9[_0xaab9('0x47')]:_0x209923[_0xaab9('0x45')];if(!_0x5669be['query'][_0xaab9('0x67')]('nolimit')){_0x59a2c9[_0xaab9('0x31')]=qs[_0xaab9('0x31')](_0x5669be['query'][_0xaab9('0x31')]);_0x59a2c9['offset']=qs[_0xaab9('0x2f')](_0x5669be[_0xaab9('0x46')]['offset']);}_0x59a2c9[_0xaab9('0x4a')]=qs['sort'](_0x5669be[_0xaab9('0x46')][_0xaab9('0x4b')]);_0x59a2c9[_0xaab9('0x4c')]=qs[_0xaab9('0x44')](_['pick'](_0x5669be[_0xaab9('0x46')],_0x209923[_0xaab9('0x44')]));_0x59a2c9[_0xaab9('0x4c')][_0xaab9('0x64')]=_0x20d9fc['id'];if(_0x5669be[_0xaab9('0x46')][_0xaab9('0x4e')]){_0x59a2c9['where']=_['merge'](_0x59a2c9['where'],{'$or':_['map'](_0x59a2c9['attributes'],function(_0x36c97f){var _0x289d82={};_0x289d82[_0x36c97f]={'$like':'%'+_0x5669be[_0xaab9('0x46')][_0xaab9('0x4e')]+'%'};return _0x289d82;})});}_0x59a2c9=_['merge']({},_0x59a2c9,_0x5669be['options']);return db[_0xaab9('0xa1')]['count']({'where':_0x59a2c9[_0xaab9('0x4c')]})['then'](function(_0xeb9050){_0x2a535b['count']=_0xeb9050;if(_0x5669be['query'][_0xaab9('0x51')]){_0x59a2c9['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xaab9('0xab')],'as':_0xaab9('0xc1'),'attributes':[_0xaab9('0x3b'),_0xaab9('0xc2'),_0xaab9('0xc3')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xaab9('0xc4')],'where':_0x5669be[_0xaab9('0x46')][_0xaab9('0xc5')]?{'id':_0x5669be[_0xaab9('0x46')][_0xaab9('0xc5')]}:undefined,'required':_0x5669be['query'][_0xaab9('0xc5')]?!![]:![]}];}return db[_0xaab9('0xa1')][_0xaab9('0x68')](_0x59a2c9);})[_0xaab9('0x22')](function(_0x36c595){_0x2a535b[_0xaab9('0x52')]=_0x36c595;return _0x2a535b;});}})[_0xaab9('0x22')](respondWithFilteredResult(_0x39d5cd,_0x59a2c9))[_0xaab9('0x2b')](handleError(_0x39d5cd,null));};exports[_0xaab9('0x3c')]=function(_0x46267f,_0x5e48c4,_0x3d0328){var _0x4b1a63,_0x4957a1,_0x4cfdb8;if(_[_0xaab9('0x93')](_0x46267f[_0xaab9('0x5b')][_0xaab9('0x5b')])||_0x46267f[_0xaab9('0x5b')][_0xaab9('0x5b')]===''){throw new db[(_0xaab9('0x77'))][(_0xaab9('0x94'))](_0xaab9('0x96'));}if(_[_0xaab9('0x93')](_0x46267f['body']['to'])){throw new db[(_0xaab9('0x77'))]['ValidationError'](_0xaab9('0xc6'));}_0x4b1a63=_0x46267f[_0xaab9('0x5b')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x46267f[_0xaab9('0x62')]['id']},'include':[{'model':db[_0xaab9('0x9a')],'as':_0xaab9('0xc7'),'include':[{'model':db[_0xaab9('0x9b')],'as':_0xaab9('0x9c'),'where':{'mobile':_0x4b1a63},'limit':0x1,'order':[[_0xaab9('0x7b'),_0xaab9('0x9d')]]}]}]})[_0xaab9('0x22')](handleEntityNotFound(_0x5e48c4,null))['then'](function(_0x331177){if(_0x331177&&_0x331177[_0xaab9('0xc7')]){_0x4957a1=_0x331177['get']({'plain':!![]});if(_0x4957a1[_0xaab9('0xc7')]&&_0x4957a1[_0xaab9('0xc7')][_0xaab9('0x9c')][_0xaab9('0x48')]){return _0x4957a1[_0xaab9('0xc7')][_0xaab9('0x9c')][0x0];}return db[_0xaab9('0x9b')][_0xaab9('0x5a')](_[_0xaab9('0x19')](_0x46267f['body'],{'firstName':_0x4b1a63,'mobile':_0x4b1a63,'phone':_0x4b1a63,'ListId':_0x4957a1[_0xaab9('0xc8')]}));}})[_0xaab9('0x22')](handleEntityNotFound(_0x5e48c4,null))[_0xaab9('0x22')](function(_0x198b01){if(_0x198b01){_0x4cfdb8=_0x198b01;return db[_0xaab9('0xa1')][_0xaab9('0x5f')]({'where':{'ContactId':_0x4cfdb8['id'],'closed':![],'SmsAccountId':_0x4957a1['id']}})[_0xaab9('0x22')](function(_0x1fc5e6){if(_0x1fc5e6){return[_0x1fc5e6,![]];}return db[_0xaab9('0xa1')]['create']({'UserId':_0x46267f[_0xaab9('0x5c')]['id'],'ContactId':_0x4cfdb8['id'],'SmsAccountId':_0x4957a1['id'],'phone':_0x4b1a63,'firstMsgDirection':_0xaab9('0xc9'),'Messages':[_[_0xaab9('0x4f')](_0x46267f[_0xaab9('0x5b')],{'read':![],'body':_0x46267f[_0xaab9('0x5b')]['body'],'phone':_0x4b1a63,'SmsAccountId':_0x4957a1['id'],'UserId':_0x46267f[_0xaab9('0x5c')]['id'],'ContactId':_0x4cfdb8['id']})]},{'include':[{'model':db[_0xaab9('0xa8')],'as':_0xaab9('0xca')}]})[_0xaab9('0x22')](function(_0x486d0b){return[_0x486d0b,!![]];});});}})[_0xaab9('0xa2')](function(_0x17a060,_0x1e9f6b){if(_0x1e9f6b){return _0x17a060;}return db[_0xaab9('0xa8')][_0xaab9('0x5a')](_[_0xaab9('0x4f')](_0x46267f['body'],{'read':![],'body':_0x46267f[_0xaab9('0x5b')]['body'],'phone':_0x4b1a63,'SmsAccountId':_0x4957a1['id'],'SmsInteractionId':_0x17a060['id'],'UserId':_0x46267f[_0xaab9('0x5c')]['id'],'ContactId':_0x4cfdb8['id']}))[_0xaab9('0x22')](function(_0x3c6fc8){_0x17a060[_0xaab9('0xcb')]['Messages']=[];_0x17a060[_0xaab9('0xcb')]['Messages']['push'](_0x3c6fc8['dataValues']);return _0x17a060;});})[_0xaab9('0x22')](respondWithResult(_0x5e48c4,null))['catch'](handleError(_0x5e48c4,null));};exports[_0xaab9('0x2d')]=function(_0x101ca9,_0x4d2c5d,_0x2fd774){if(_0x101ca9['body']['id']){delete _0x101ca9['body']['id'];}var _0x31bca3,_0x145271,_0x345423;return db['SmsAccount'][_0xaab9('0x5f')]({'where':{'id':_0x101ca9[_0xaab9('0x62')]['id']}})['then'](handleEntityNotFound(_0x4d2c5d,null))[_0xaab9('0x22')](function(_0x2a7b48){if(_0x2a7b48){_0x345423=_0x2a7b48;logger[_0xaab9('0x24')](_0xaab9('0x25'),'status',_0xaab9('0xcc'),_0x2a7b48[_0xaab9('0x41')],util['inspect'](_0x101ca9['body'],{'showHidden':![],'depth':null}));switch(_0x2a7b48['type']){case _0xaab9('0x82'):if(_0x101ca9[_0xaab9('0x5b')][_0xaab9('0xcd')]&&_0x101ca9[_0xaab9('0x5b')][_0xaab9('0x2d')]){_0x145271=_0x101ca9['body'][_0xaab9('0x2d')];return db[_0xaab9('0xa8')][_0xaab9('0x5f')]({'where':{'messageId':_0x101ca9['body'][_0xaab9('0xcd')]}});}break;case _0xaab9('0x85'):if(_0x101ca9['body'][_0xaab9('0xce')]&&_0x101ca9[_0xaab9('0x5b')][_0xaab9('0xcf')]){_0x145271=_0x101ca9[_0xaab9('0x5b')]['statusInt'];return db['SmsMessage'][_0xaab9('0x5f')]({'where':{'messageId':_0x101ca9[_0xaab9('0x5b')][_0xaab9('0xce')]}});}break;case _0xaab9('0x86'):if(_0x101ca9[_0xaab9('0x5b')][_0xaab9('0xd0')]&&_0x101ca9[_0xaab9('0x5b')][_0xaab9('0xd1')]){_0x145271=_0x101ca9[_0xaab9('0x5b')][_0xaab9('0xd1')];return db[_0xaab9('0xa8')][_0xaab9('0x5f')]({'where':{'messageId':_0x101ca9[_0xaab9('0x5b')][_0xaab9('0xd0')]}});}break;case _0xaab9('0xd2'):var _0x49b79b=_0x101ca9[_0xaab9('0x5b')][_0xaab9('0x8b')][0x0];if(_0x49b79b[_0xaab9('0x87')]&&_0x49b79b[_0xaab9('0x2d')][_0xaab9('0xd3')]===_0xaab9('0xd4')){_0x145271=_0x49b79b[_0xaab9('0x2d')][_0xaab9('0xd3')];return db[_0xaab9('0xa8')][_0xaab9('0x5f')]({'where':{'messageId':_0x49b79b[_0xaab9('0x87')]}});}break;case _0xaab9('0x8e'):if(_0x101ca9[_0xaab9('0x5b')][_0xaab9('0x87')]&&_0x101ca9[_0xaab9('0x5b')][_0xaab9('0x2d')]){_0x145271=_0x101ca9[_0xaab9('0x5b')][_0xaab9('0x2d')];return db[_0xaab9('0xa8')][_0xaab9('0x5f')]({'where':{'messageId':_0x101ca9[_0xaab9('0x5b')][_0xaab9('0x87')]}});}break;case'bandwidth':if(_0x101ca9[_0xaab9('0x5b')][0x0][_0xaab9('0x29')]['id']){_0x145271=_0x101ca9[_0xaab9('0x5b')][0x0][_0xaab9('0x41')];return db[_0xaab9('0xa8')][_0xaab9('0x5f')]({'where':{'messageId':_0x101ca9[_0xaab9('0x5b')][0x0]['message']['id']}});}break;case _0xaab9('0x92'):if(_0x101ca9[_0xaab9('0x5b')][_0xaab9('0xd5')]&&_0x101ca9['body'][_0xaab9('0x2d')]){_0x145271=_0x101ca9['body'][_0xaab9('0x2d')];return db[_0xaab9('0xa8')][_0xaab9('0x5f')]({'where':{'messageId':_0x101ca9[_0xaab9('0x5b')][_0xaab9('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x4d2c5d,null))['then'](function(_0x5452c0){if(_0x5452c0){_0x31bca3=_0x5452c0;switch(_0x345423[_0xaab9('0x41')]){case _0xaab9('0x82'):if(_0x145271==='DELIVERED'){return _0x31bca3[_0xaab9('0xd6')]({'read':!![]});}else{logger['error'](_0xaab9('0x25'),_0xaab9('0x2d'),_0xaab9('0x82'),util[_0xaab9('0xd7')](_0x101ca9[_0xaab9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xaab9('0x85'):if(_0x145271==='1'){return _0x31bca3[_0xaab9('0xd6')]({'read':!![]});}else{logger[_0xaab9('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaab9('0x2d'),_0xaab9('0x82'),util[_0xaab9('0xd7')](_0x101ca9['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x101ca9[_0xaab9('0x5b')][_0xaab9('0xd8')]&&_0x145271>=0xc8&&_0x145271<=0xce){return _0x31bca3[_0xaab9('0xd6')]({'read':!![]});}else{logger[_0xaab9('0x27')](_0xaab9('0x25'),_0xaab9('0x2d'),'clicksend',util[_0xaab9('0xd7')](_0x101ca9['body'],{'showHidden':![],'depth':null}));}break;case _0xaab9('0xd2'):var _0x1597e5=_0x101ca9[_0xaab9('0x5b')][_0xaab9('0x8b')][0x0];if(_0x1597e5[_0xaab9('0x2d')]['groupName']===_0xaab9('0xd4')){return _0x31bca3[_0xaab9('0xd6')]({'read':!![]});}else{logger[_0xaab9('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaab9('0x2d'),_0xaab9('0xd2'),util['inspect'](_0x101ca9[_0xaab9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xaab9('0x8e'):if(_0x145271==_0xaab9('0xd9')||_0x145271==_0xaab9('0xda')){return _0x31bca3['update']({'read':!![]});}else{logger[_0xaab9('0x27')](_0xaab9('0x25'),_0xaab9('0x2d'),_0xaab9('0x8e'),util[_0xaab9('0xd7')](_0x101ca9[_0xaab9('0x5b')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x145271==_0xaab9('0xdb')){return _0x31bca3['update']({'read':!![]});}else{logger[_0xaab9('0x27')](_0xaab9('0x25'),_0xaab9('0x2d'),_0xaab9('0x91'),util[_0xaab9('0xd7')](_0x101ca9['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x145271==='DELIVRD'||_0x145271===_0xaab9('0xdc')){return _0x31bca3['update']({'read':!![]});}else{logger[_0xaab9('0x27')](_0xaab9('0x25'),_0xaab9('0x2d'),_0xaab9('0x92'),util[_0xaab9('0xd7')](_0x101ca9['body'],{'showHidden':![],'depth':null}));}break;}return _0x31bca3;}})['then'](respondWithResult(_0x4d2c5d,null))[_0xaab9('0x2b')](handleError(_0x4d2c5d,null));};exports[_0xaab9('0xdd')]=function(_0x71034e,_0x4aeb92,_0x33a63f){var _0x42e624,_0xa6bbd9,_0x140ef9;return db[_0xaab9('0x3f')][_0xaab9('0x5f')]({'where':{'id':_0x71034e['params']['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x4aeb92,null))[_0xaab9('0x22')](function(_0x451a63){if(_0x451a63){_0x140ef9=_0x451a63;logger[_0xaab9('0x24')](_0xaab9('0x25'),'status',_0xaab9('0xcc'),_0x451a63[_0xaab9('0x41')],util['inspect'](_0x71034e[_0xaab9('0x46')],{'showHidden':![],'depth':null}));switch(_0x451a63[_0xaab9('0x41')]){case _0xaab9('0xde'):if(_0x71034e[_0xaab9('0x46')]['message-id']&&_0x71034e[_0xaab9('0x46')][_0xaab9('0xdf')]){_0xa6bbd9=_0x71034e[_0xaab9('0x46')][_0xaab9('0xdf')];return db[_0xaab9('0xa8')][_0xaab9('0x5f')]({'where':{'messageId':_0x71034e[_0xaab9('0x46')]['message-id']}});}break;}}})[_0xaab9('0x22')](handleEntityNotFound(_0x4aeb92,null))[_0xaab9('0x22')](function(_0x3ff09a){if(_0x3ff09a){_0x42e624=_0x3ff09a;switch(_0x140ef9[_0xaab9('0x41')]){case _0xaab9('0xde'):if(_0xa6bbd9==='2'||_0xa6bbd9==='6'){return _0x42e624[_0xaab9('0xd6')]({'read':!![]});}else{logger[_0xaab9('0x27')](_0xaab9('0x25'),_0xaab9('0x2d'),_0xaab9('0xde'),util[_0xaab9('0xd7')](_0x71034e['query'],{'showHidden':![],'depth':null}));};break;}return _0x42e624;}})['then'](respondWithResult(_0x4aeb92,null))['catch'](handleError(_0x4aeb92,null));};exports[_0xaab9('0xe0')]=function(_0xf105c0,_0x41a4c7,_0x56705a){return db['SmsAccount']['find']({'where':{'id':_0xf105c0[_0xaab9('0x62')]['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x41a4c7,null))[_0xaab9('0x22')](function(_0x31200f){if(_0x31200f){return _0x31200f[_0xaab9('0xe0')](_0xf105c0[_0xaab9('0x5b')]['ids'],_[_0xaab9('0x9f')](_0xf105c0[_0xaab9('0x5b')],[_0xaab9('0x6a'),'id'])||{})[_0xaab9('0xa2')](function(_0x3f9d47){for(var _0x67290c=0x0;_0x67290c<_0xf105c0['body']['ids'][_0xaab9('0x48')];_0x67290c+=0x1){socket[_0xaab9('0xe1')](_0xaab9('0xe2'),{'UserId':Number(_0xf105c0[_0xaab9('0x5b')][_0xaab9('0x6a')][_0x67290c]),'SmsAccountId':Number(_0xf105c0[_0xaab9('0x62')]['id'])});}return _0x3f9d47;});}})[_0xaab9('0x22')](respondWithResult(_0x41a4c7,null))[_0xaab9('0x2b')](handleError(_0x41a4c7,null));};exports[_0xaab9('0xe3')]=function(_0x333db6,_0x1b4eb7,_0x566005){return db[_0xaab9('0x3f')][_0xaab9('0x5f')]({'where':{'id':_0x333db6[_0xaab9('0x62')]['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x1b4eb7,null))[_0xaab9('0x22')](function(_0xd8f603){if(_0xd8f603){return _0xd8f603[_0xaab9('0xe3')](_0x333db6[_0xaab9('0x46')][_0xaab9('0x6a')])[_0xaab9('0x22')](function(){if(_[_0xaab9('0xe4')](_0x333db6[_0xaab9('0x46')][_0xaab9('0x6a')])){for(var _0x5827b7=0x0;_0x5827b7<_0x333db6[_0xaab9('0x46')]['ids'][_0xaab9('0x48')];_0x5827b7+=0x1){socket['emit'](_0xaab9('0xe5'),{'UserId':Number(_0x333db6[_0xaab9('0x46')][_0xaab9('0x6a')][_0x5827b7]),'SmsAccountId':Number(_0x333db6[_0xaab9('0x62')]['id'])});}}else{socket[_0xaab9('0xe1')](_0xaab9('0xe5'),{'UserId':Number(_0x333db6['query'][_0xaab9('0x6a')]),'SmsAccountId':Number(_0x333db6[_0xaab9('0x62')]['id'])});}});}})[_0xaab9('0x22')](respondWithStatusCode(_0x1b4eb7,null))[_0xaab9('0x2b')](handleError(_0x1b4eb7,null));};exports[_0xaab9('0xe6')]=function(_0x392ee8,_0x4fd467,_0x28e16a){var _0x113b9f={};var _0x2dd4ed={};var _0x201cec;var _0x3315c5;return db[_0xaab9('0x3f')][_0xaab9('0x66')]({'where':{'id':_0x392ee8[_0xaab9('0x62')]['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x4fd467,null))[_0xaab9('0x22')](function(_0x5ac626){if(_0x5ac626){_0x201cec=_0x5ac626;_0x2dd4ed[_0xaab9('0x45')]=_[_0xaab9('0x43')](db[_0xaab9('0xab')][_0xaab9('0x56')]);_0x2dd4ed[_0xaab9('0x46')]=_[_0xaab9('0x43')](_0x392ee8[_0xaab9('0x46')]);_0x2dd4ed['filters']=_[_0xaab9('0x57')](_0x2dd4ed[_0xaab9('0x45')],_0x2dd4ed['query']);_0x113b9f[_0xaab9('0x47')]=_[_0xaab9('0x57')](_0x2dd4ed[_0xaab9('0x45')],qs[_0xaab9('0x58')](_0x392ee8[_0xaab9('0x46')][_0xaab9('0x58')]));_0x113b9f[_0xaab9('0x47')]=_0x113b9f['attributes'][_0xaab9('0x48')]?_0x113b9f[_0xaab9('0x47')]:_0x2dd4ed[_0xaab9('0x45')];_0x113b9f[_0xaab9('0x4a')]=qs[_0xaab9('0x4b')](_0x392ee8['query'][_0xaab9('0x4b')]);_0x113b9f[_0xaab9('0x4c')]=qs[_0xaab9('0x44')](_['pick'](_0x392ee8['query'],_0x2dd4ed[_0xaab9('0x44')]));if(_0x392ee8[_0xaab9('0x46')][_0xaab9('0x4e')]){_0x113b9f[_0xaab9('0x4c')]=_[_0xaab9('0x4f')](_0x113b9f['where'],{'$or':_[_0xaab9('0x3e')](_0x113b9f['attributes'],function(_0x16c2b5){var _0x150d5d={};_0x150d5d[_0x16c2b5]={'$like':'%'+_0x392ee8['query'][_0xaab9('0x4e')]+'%'};return _0x150d5d;})});}_0x113b9f=_[_0xaab9('0x4f')]({},_0x113b9f,_0x392ee8[_0xaab9('0x50')]);return _0x201cec[_0xaab9('0xe6')](_0x113b9f);}})[_0xaab9('0x22')](function(_0x58c4b2){if(_0x58c4b2){_0x3315c5=_0x58c4b2['length'];if(!_0x392ee8[_0xaab9('0x46')]['hasOwnProperty'](_0xaab9('0x49'))){_0x113b9f[_0xaab9('0x31')]=qs[_0xaab9('0x31')](_0x392ee8['query'][_0xaab9('0x31')]);_0x113b9f[_0xaab9('0x2f')]=qs[_0xaab9('0x2f')](_0x392ee8[_0xaab9('0x46')][_0xaab9('0x2f')]);}return _0x201cec[_0xaab9('0xe6')](_0x113b9f);}})[_0xaab9('0x22')](function(_0x9bb381){if(_0x9bb381){return _0x9bb381?{'count':_0x3315c5,'rows':_0x9bb381}:null;}})['then'](respondWithResult(_0x4fd467,null))['catch'](handleError(_0x4fd467,null));}; \ No newline at end of file +var _0x8066=['ACCEPTD','statusGet','message-id','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','Disposition','findOne','order','filter','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','notify','sms','SmsApplication','account','applications','orderBy','priority','asc','Applications','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','type','twilio','Body','messageId','skebby','from','sender','clicksend','message_id','From','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','fromNumber','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','Owner','internal','Tags','color','tag','to\x20is\x20mandatory','CmList','List','user','out','SmsMessage','Messages','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','statusInt','status_code','groupName','DELIVERED','clickatell','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x8066,0x1c2));var _0x6806=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x8066[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x6806('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6806('0x1'));var rp=require('request-promise');var moment=require(_0x6806('0x2'));var BPromise=require(_0x6806('0x3'));var Mustache=require(_0x6806('0x4'));var util=require(_0x6806('0x5'));var path=require(_0x6806('0x6'));var sox=require(_0x6806('0x7'));var csv=require(_0x6806('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6806('0x9'));var _=require(_0x6806('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6806('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6806('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6806('0xc'));var as=require(_0x6806('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6806('0xe'))(_0x6806('0xf'));var utils=require(_0x6806('0x10'));var config=require(_0x6806('0x11'));var licenseUtil=require(_0x6806('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6806('0x13')](config[_0x6806('0x14')],{'host':_0x6806('0x15'),'port':0x18eb});var socket=require(_0x6806('0x16'))(new Redis(config[_0x6806('0x14')]));require(_0x6806('0x17'))[_0x6806('0x18')](socket);var jayson=require(_0x6806('0x19'));var client=jayson['client'][_0x6806('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x17369a,_0x5d570e,_0x20cb74,_0x11f03f){return new BPromise(function(_0x40e42e,_0x23d96f){var _0x71c7cd=_0x11f03f||client;return _0x71c7cd[_0x6806('0x1b')](_0x17369a,_0x20cb74)[_0x6806('0x1c')](function(_0x3894dc){logger[_0x6806('0x1d')]('SmsAccount,\x20%s,\x20%s',_0x5d570e,_0x6806('0x1e'));logger[_0x6806('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5d570e,_0x6806('0x1e'),JSON['stringify'](_0x3894dc));if(_0x3894dc[_0x6806('0x20')]){if(_0x3894dc[_0x6806('0x20')][_0x6806('0x21')]===0x1f4){logger['error'](_0x6806('0x22'),_0x5d570e,_0x3894dc[_0x6806('0x20')]['message']);return _0x23d96f(_0x3894dc['error']['message']);}logger[_0x6806('0x20')]('SmsAccount,\x20%s,\x20%s',_0x5d570e,_0x3894dc[_0x6806('0x20')][_0x6806('0x23')]);return _0x40e42e(_0x3894dc[_0x6806('0x20')][_0x6806('0x23')]);}else{logger[_0x6806('0x1d')](_0x6806('0x22'),_0x5d570e,_0x6806('0x1e'));_0x40e42e(_0x3894dc[_0x6806('0x24')][_0x6806('0x23')]);}})[_0x6806('0x25')](function(_0x2bfb8f){logger[_0x6806('0x20')](_0x6806('0x22'),_0x5d570e,_0x2bfb8f);_0x23d96f(_0x2bfb8f);});});}function respondWithStatusCode(_0x31a09a,_0x45fb79){_0x45fb79=_0x45fb79||0xcc;return function(_0x76630){if(_0x76630){return _0x31a09a[_0x6806('0x26')](_0x45fb79);}return _0x31a09a[_0x6806('0x27')](_0x45fb79)[_0x6806('0x28')]();};}function respondWithResult(_0x5a90f7,_0x381e29){_0x381e29=_0x381e29||0xc8;return function(_0x2a1c28){if(_0x2a1c28){return _0x5a90f7['status'](_0x381e29)[_0x6806('0x29')](_0x2a1c28);}};}function respondWithFilteredResult(_0x14849e,_0x30fa93){return function(_0x1b52e3){if(_0x1b52e3){var _0x2a1a4d=typeof _0x30fa93[_0x6806('0x2a')]===_0x6806('0x2b')&&typeof _0x30fa93[_0x6806('0x2c')]===_0x6806('0x2b');var _0xf1388e=_0x1b52e3['count'];var _0x51f741=_0x2a1a4d?0x0:_0x30fa93[_0x6806('0x2a')];var _0x154862=_0x2a1a4d?_0x1b52e3[_0x6806('0x2d')]:_0x30fa93['offset']+_0x30fa93[_0x6806('0x2c')];var _0x2b0b98;if(_0x154862>=_0xf1388e){_0x154862=_0xf1388e;_0x2b0b98=0xc8;}else{_0x2b0b98=0xce;}_0x14849e['status'](_0x2b0b98);return _0x14849e[_0x6806('0x2e')](_0x6806('0x2f'),_0x51f741+'-'+_0x154862+'/'+_0xf1388e)['json'](_0x1b52e3);}return null;};}function patchUpdates(_0x42b9eb){return function(_0x159686){try{jsonpatch[_0x6806('0x30')](_0x159686,_0x42b9eb,!![]);}catch(_0x21a255){return BPromise[_0x6806('0x31')](_0x21a255);}return _0x159686[_0x6806('0x32')]();};}function saveUpdates(_0x161f3a,_0x3824db){return function(_0x2f2090){if(_0x2f2090){return _0x2f2090[_0x6806('0x33')](_0x161f3a)[_0x6806('0x1c')](function(_0x574003){return _0x574003;});}return null;};}function removeEntity(_0x2da5a1,_0x54ae44){return function(_0x5b0007){if(_0x5b0007){return _0x5b0007[_0x6806('0x34')]()[_0x6806('0x1c')](function(){var _0x496e46=_0x5b0007[_0x6806('0x35')]({'plain':!![]});var _0x582fea=_0x6806('0x36');return db['UserProfileResource'][_0x6806('0x34')]({'where':{'type':_0x582fea,'resourceId':_0x496e46['id']}})[_0x6806('0x1c')](function(){return _0x5b0007;});})[_0x6806('0x1c')](function(){_0x2da5a1[_0x6806('0x27')](0xcc)[_0x6806('0x28')]();});}};}function handleEntityNotFound(_0x2200e4,_0x145667){return function(_0x6b14f8){if(!_0x6b14f8){_0x2200e4[_0x6806('0x26')](0x194);}return _0x6b14f8;};}function handleError(_0x5c6c61,_0xe104b8){_0xe104b8=_0xe104b8||0x1f4;return function(_0x298834){logger[_0x6806('0x20')](_0x298834[_0x6806('0x37')]);if(_0x298834['name']){delete _0x298834[_0x6806('0x38')];}_0x5c6c61[_0x6806('0x27')](_0xe104b8)[_0x6806('0x39')](_0x298834);};}exports[_0x6806('0x3a')]=function(_0x2fa6a4,_0x4feeef){var _0x4bf224={'include':[{'model':db[_0x6806('0x3b')],'as':_0x6806('0x3c')}]},_0x53b980={},_0x12c173={'count':0x0,'rows':[]};var _0xaf4197=_[_0x6806('0x3d')](db[_0x6806('0x3e')][_0x6806('0x3f')],function(_0x580b67){return{'name':_0x580b67[_0x6806('0x40')],'type':_0x580b67['type'][_0x6806('0x41')]};});_0x53b980[_0x6806('0x42')]=_[_0x6806('0x3d')](_0xaf4197,_0x6806('0x38'));_0x53b980[_0x6806('0x43')]=_[_0x6806('0x44')](_0x2fa6a4['query']);_0x53b980[_0x6806('0x45')]=_[_0x6806('0x46')](_0x53b980[_0x6806('0x42')],_0x53b980[_0x6806('0x43')]);_0x4bf224[_0x6806('0x47')]=_[_0x6806('0x46')](_0x53b980['model'],qs[_0x6806('0x48')](_0x2fa6a4['query']['fields']));_0x4bf224['attributes']=_0x4bf224[_0x6806('0x47')][_0x6806('0x49')]?_0x4bf224[_0x6806('0x47')]:_0x53b980[_0x6806('0x42')];if(!_0x2fa6a4[_0x6806('0x43')][_0x6806('0x4a')](_0x6806('0x4b'))){_0x4bf224[_0x6806('0x2c')]=qs[_0x6806('0x2c')](_0x2fa6a4[_0x6806('0x43')][_0x6806('0x2c')]);_0x4bf224[_0x6806('0x2a')]=qs[_0x6806('0x2a')](_0x2fa6a4[_0x6806('0x43')]['offset']);}_0x4bf224['order']=qs[_0x6806('0x4c')](_0x2fa6a4[_0x6806('0x43')][_0x6806('0x4c')]);_0x4bf224[_0x6806('0x4d')]=qs[_0x6806('0x45')](_[_0x6806('0x4e')](_0x2fa6a4['query'],_0x53b980[_0x6806('0x45')]),_0xaf4197);if(_0x2fa6a4[_0x6806('0x43')]['filter']){_0x4bf224['where']=_[_0x6806('0x4f')](_0x4bf224[_0x6806('0x4d')],{'$or':_[_0x6806('0x3d')](_0xaf4197,function(_0x29948a){if(_0x29948a['type']!==_0x6806('0x50')){var _0x4c5bef={};_0x4c5bef[_0x29948a[_0x6806('0x38')]]={'$like':'%'+_0x2fa6a4[_0x6806('0x43')]['filter']+'%'};return _0x4c5bef;}})});}_0x4bf224=_[_0x6806('0x4f')]({},_0x4bf224,_0x2fa6a4[_0x6806('0x51')]);var _0x6b5d74={'where':_0x4bf224[_0x6806('0x4d')]};return db[_0x6806('0x3e')][_0x6806('0x2d')](_0x6b5d74)[_0x6806('0x1c')](function(_0xfad534){_0x12c173[_0x6806('0x2d')]=_0xfad534;if(_0x2fa6a4[_0x6806('0x43')][_0x6806('0x52')]){_0x4bf224[_0x6806('0x53')]=[{'all':!![]}];}return db[_0x6806('0x3e')][_0x6806('0x54')](_0x4bf224);})[_0x6806('0x1c')](function(_0x182b8d){_0x12c173[_0x6806('0x55')]=_0x182b8d;return _0x12c173;})[_0x6806('0x1c')](respondWithFilteredResult(_0x4feeef,_0x4bf224))[_0x6806('0x25')](handleError(_0x4feeef,null));};exports['show']=function(_0x2210f,_0x558c30){var _0x16585c={'raw':![],'where':{'id':_0x2210f[_0x6806('0x56')]['id']},'include':[{'model':db[_0x6806('0x3b')],'as':_0x6806('0x3c')}]},_0x2e7714={};_0x2e7714['model']=_[_0x6806('0x44')](db[_0x6806('0x3e')]['rawAttributes']);_0x2e7714[_0x6806('0x43')]=_[_0x6806('0x44')](_0x2210f[_0x6806('0x43')]);_0x2e7714[_0x6806('0x45')]=_[_0x6806('0x46')](_0x2e7714[_0x6806('0x42')],_0x2e7714[_0x6806('0x43')]);_0x16585c[_0x6806('0x47')]=_[_0x6806('0x46')](_0x2e7714[_0x6806('0x42')],qs[_0x6806('0x48')](_0x2210f['query'][_0x6806('0x48')]));_0x16585c['attributes']=_0x16585c[_0x6806('0x47')][_0x6806('0x49')]?_0x16585c[_0x6806('0x47')]:_0x2e7714['model'];if(_0x2210f['query'][_0x6806('0x52')]){_0x16585c[_0x6806('0x53')]=[{'all':!![]}];}_0x16585c=_[_0x6806('0x4f')]({},_0x16585c,_0x2210f['options']);return db['SmsAccount'][_0x6806('0x57')](_0x16585c)[_0x6806('0x1c')](handleEntityNotFound(_0x558c30,null))['then'](respondWithResult(_0x558c30,null))[_0x6806('0x25')](handleError(_0x558c30,null));};exports['create']=function(_0x242b37,_0x505e24){return db['SmsAccount'][_0x6806('0x58')](_0x242b37[_0x6806('0x59')],{})[_0x6806('0x1c')](function(_0x4b681f){var _0x35cda5=_0x242b37['user'][_0x6806('0x35')]({'plain':!![]});if(!_0x35cda5)throw new Error(_0x6806('0x5a'));if(_0x35cda5[_0x6806('0x5b')]==='user'){var _0x156eec=_0x4b681f[_0x6806('0x35')]({'plain':!![]});var _0x3ac4f7=_0x6806('0x36');return db['UserProfileSection'][_0x6806('0x57')]({'where':{'name':_0x3ac4f7,'userProfileId':_0x35cda5[_0x6806('0x5c')]},'raw':!![]})[_0x6806('0x1c')](function(_0x1cee89){if(_0x1cee89&&_0x1cee89[_0x6806('0x5d')]===0x0){return db[_0x6806('0x5e')][_0x6806('0x58')]({'name':_0x156eec[_0x6806('0x38')],'resourceId':_0x156eec['id'],'type':_0x1cee89[_0x6806('0x38')],'sectionId':_0x1cee89['id']},{})['then'](function(){return _0x4b681f;});}else{return _0x4b681f;}})[_0x6806('0x25')](function(_0x342b4e){logger[_0x6806('0x20')](_0x6806('0x5f'),_0x342b4e);throw _0x342b4e;});}return _0x4b681f;})[_0x6806('0x1c')](respondWithResult(_0x505e24,0xc9))[_0x6806('0x25')](handleError(_0x505e24,null));};exports[_0x6806('0x33')]=function(_0x2ab41b,_0x41a106){if(_0x2ab41b[_0x6806('0x59')]['id']){delete _0x2ab41b[_0x6806('0x59')]['id'];}return db[_0x6806('0x3e')]['find']({'where':{'id':_0x2ab41b[_0x6806('0x56')]['id']},'include':[{'model':db[_0x6806('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x6806('0x1c')](handleEntityNotFound(_0x41a106,null))[_0x6806('0x1c')](saveUpdates(_0x2ab41b['body'],null))[_0x6806('0x1c')](respondWithResult(_0x41a106,null))[_0x6806('0x25')](handleError(_0x41a106,null));};exports[_0x6806('0x34')]=function(_0x423982,_0x34cc6d){return db['SmsAccount'][_0x6806('0x57')]({'where':{'id':_0x423982[_0x6806('0x56')]['id']}})[_0x6806('0x1c')](handleEntityNotFound(_0x34cc6d,null))[_0x6806('0x1c')](removeEntity(_0x34cc6d,null))['catch'](handleError(_0x34cc6d,null));};exports['describe']=function(_0x7d6689,_0x4e2584){return db[_0x6806('0x3e')][_0x6806('0x60')]()[_0x6806('0x1c')](respondWithResult(_0x4e2584,null))[_0x6806('0x25')](handleError(_0x4e2584,null));};exports['addDisposition']=function(_0x26cc4c,_0x49dc4d,_0x2b1669){if(_0x26cc4c[_0x6806('0x59')]['id']){delete _0x26cc4c[_0x6806('0x59')]['id'];}return db[_0x6806('0x3e')][_0x6806('0x57')]({'where':{'id':_0x26cc4c[_0x6806('0x56')]['id']}})[_0x6806('0x1c')](handleEntityNotFound(_0x49dc4d,null))['then'](function(_0x38e88a){if(_0x38e88a){_0x26cc4c['body'][_0x6806('0x61')]=_0x38e88a['id'];return db[_0x6806('0x62')][_0x6806('0x58')](_0x26cc4c[_0x6806('0x59')]);}})[_0x6806('0x1c')](respondWithResult(_0x49dc4d,null))[_0x6806('0x25')](handleError(_0x49dc4d,null));};exports['getDispositions']=function(_0x4a861f,_0xd49ce6,_0x78d040){var _0x551034={'raw':![],'where':{}};var _0xe63d12={};var _0x5087f1={'count':0x0,'rows':[]};return db[_0x6806('0x3e')][_0x6806('0x63')]({'where':{'id':_0x4a861f[_0x6806('0x56')]['id']}})['then'](handleEntityNotFound(_0xd49ce6,null))['then'](function(_0x3c5c0e){if(_0x3c5c0e){_0xe63d12[_0x6806('0x42')]=_[_0x6806('0x44')](db[_0x6806('0x62')]['rawAttributes']);_0xe63d12[_0x6806('0x43')]=_[_0x6806('0x44')](_0x4a861f[_0x6806('0x43')]);_0xe63d12[_0x6806('0x45')]=_[_0x6806('0x46')](_0xe63d12['model'],_0xe63d12['query']);_0x551034['attributes']=_[_0x6806('0x46')](_0xe63d12[_0x6806('0x42')],qs[_0x6806('0x48')](_0x4a861f[_0x6806('0x43')][_0x6806('0x48')]));_0x551034[_0x6806('0x47')]=_0x551034[_0x6806('0x47')][_0x6806('0x49')]?_0x551034[_0x6806('0x47')]:_0xe63d12[_0x6806('0x42')];if(!_0x4a861f[_0x6806('0x43')][_0x6806('0x4a')]('nolimit')){_0x551034['limit']=qs[_0x6806('0x2c')](_0x4a861f['query']['limit']);_0x551034[_0x6806('0x2a')]=qs[_0x6806('0x2a')](_0x4a861f[_0x6806('0x43')][_0x6806('0x2a')]);}_0x551034[_0x6806('0x64')]=qs[_0x6806('0x4c')](_0x4a861f[_0x6806('0x43')][_0x6806('0x4c')]);_0x551034['where']=qs[_0x6806('0x45')](_[_0x6806('0x4e')](_0x4a861f[_0x6806('0x43')],_0xe63d12[_0x6806('0x45')]));_0x551034['where']['SmsAccountId']=_0x3c5c0e['id'];if(_0x4a861f[_0x6806('0x43')][_0x6806('0x65')]){_0x551034[_0x6806('0x4d')]=_[_0x6806('0x4f')](_0x551034[_0x6806('0x4d')],{'$or':_['map'](_0x551034[_0x6806('0x47')],function(_0x57cc69){var _0x3593c8={};_0x3593c8[_0x57cc69]={'$like':'%'+_0x4a861f[_0x6806('0x43')][_0x6806('0x65')]+'%'};return _0x3593c8;})});}_0x551034=_[_0x6806('0x4f')]({},_0x551034,_0x4a861f['options']);return db['Disposition'][_0x6806('0x2d')]({'where':_0x551034[_0x6806('0x4d')]})[_0x6806('0x1c')](function(_0x389375){_0x5087f1[_0x6806('0x2d')]=_0x389375;if(_0x4a861f[_0x6806('0x43')][_0x6806('0x52')]){_0x551034[_0x6806('0x53')]=[{'all':!![]}];}return db[_0x6806('0x62')]['findAll'](_0x551034);})['then'](function(_0x2c4c71){_0x5087f1[_0x6806('0x55')]=_0x2c4c71;return _0x5087f1;});}})[_0x6806('0x1c')](respondWithFilteredResult(_0xd49ce6,_0x551034))['catch'](handleError(_0xd49ce6,null));};exports['removeDispositions']=function(_0x4c50f3,_0x58f172,_0x4fba0b){return db[_0x6806('0x3e')][_0x6806('0x57')]({'where':{'id':_0x4c50f3[_0x6806('0x56')]['id']}})['then'](handleEntityNotFound(_0x58f172,null))['then'](function(_0x6b84c5){if(_0x6b84c5){return _0x6b84c5[_0x6806('0x66')](_0x4c50f3['query']['ids']);}})['then'](respondWithStatusCode(_0x58f172,null))['catch'](handleError(_0x58f172,null));};exports[_0x6806('0x67')]=function(_0x4611ad,_0x4704b6,_0x3e84d7){if(_0x4611ad[_0x6806('0x59')]['id']){delete _0x4611ad['body']['id'];}return db[_0x6806('0x3e')][_0x6806('0x57')]({'where':{'id':_0x4611ad[_0x6806('0x56')]['id']}})[_0x6806('0x1c')](handleEntityNotFound(_0x4704b6,null))[_0x6806('0x1c')](function(_0x53a97f){if(_0x53a97f){_0x4611ad[_0x6806('0x59')]['SmsAccountId']=_0x53a97f['id'];return db[_0x6806('0x68')][_0x6806('0x58')](_0x4611ad['body']);}})[_0x6806('0x1c')](respondWithResult(_0x4704b6,null))[_0x6806('0x25')](handleError(_0x4704b6,null));};exports['getAnswers']=function(_0x76c6b2,_0x1e14a4,_0x48f69c){var _0x36fa79={'raw':![],'where':{}};var _0x1fa397={};var _0x114fcb={'count':0x0,'rows':[]};return db[_0x6806('0x3e')]['findOne']({'where':{'id':_0x76c6b2[_0x6806('0x56')]['id']}})[_0x6806('0x1c')](handleEntityNotFound(_0x1e14a4,null))[_0x6806('0x1c')](function(_0x50e6dc){if(_0x50e6dc){_0x1fa397[_0x6806('0x42')]=_[_0x6806('0x44')](db[_0x6806('0x68')][_0x6806('0x3f')]);_0x1fa397[_0x6806('0x43')]=_[_0x6806('0x44')](_0x76c6b2[_0x6806('0x43')]);_0x1fa397[_0x6806('0x45')]=_[_0x6806('0x46')](_0x1fa397[_0x6806('0x42')],_0x1fa397[_0x6806('0x43')]);_0x36fa79[_0x6806('0x47')]=_['intersection'](_0x1fa397[_0x6806('0x42')],qs[_0x6806('0x48')](_0x76c6b2['query'][_0x6806('0x48')]));_0x36fa79[_0x6806('0x47')]=_0x36fa79[_0x6806('0x47')][_0x6806('0x49')]?_0x36fa79['attributes']:_0x1fa397[_0x6806('0x42')];if(!_0x76c6b2[_0x6806('0x43')]['hasOwnProperty']('nolimit')){_0x36fa79[_0x6806('0x2c')]=qs[_0x6806('0x2c')](_0x76c6b2[_0x6806('0x43')][_0x6806('0x2c')]);_0x36fa79['offset']=qs[_0x6806('0x2a')](_0x76c6b2[_0x6806('0x43')][_0x6806('0x2a')]);}_0x36fa79['order']=qs['sort'](_0x76c6b2[_0x6806('0x43')][_0x6806('0x4c')]);_0x36fa79['where']=qs[_0x6806('0x45')](_[_0x6806('0x4e')](_0x76c6b2['query'],_0x1fa397[_0x6806('0x45')]));_0x36fa79['where'][_0x6806('0x61')]=_0x50e6dc['id'];if(_0x76c6b2[_0x6806('0x43')]['filter']){_0x36fa79[_0x6806('0x4d')]=_[_0x6806('0x4f')](_0x36fa79[_0x6806('0x4d')],{'$or':_[_0x6806('0x3d')](_0x36fa79[_0x6806('0x47')],function(_0x58a2aa){var _0x507500={};_0x507500[_0x58a2aa]={'$like':'%'+_0x76c6b2[_0x6806('0x43')][_0x6806('0x65')]+'%'};return _0x507500;})});}_0x36fa79=_['merge']({},_0x36fa79,_0x76c6b2[_0x6806('0x51')]);return db[_0x6806('0x68')]['count']({'where':_0x36fa79[_0x6806('0x4d')]})[_0x6806('0x1c')](function(_0x152734){_0x114fcb['count']=_0x152734;if(_0x76c6b2[_0x6806('0x43')][_0x6806('0x52')]){_0x36fa79[_0x6806('0x53')]=[{'all':!![]}];}return db[_0x6806('0x68')][_0x6806('0x54')](_0x36fa79);})[_0x6806('0x1c')](function(_0x33deff){_0x114fcb[_0x6806('0x55')]=_0x33deff;return _0x114fcb;});}})[_0x6806('0x1c')](respondWithFilteredResult(_0x1e14a4,_0x36fa79))[_0x6806('0x25')](handleError(_0x1e14a4,null));};exports[_0x6806('0x69')]=function(_0x37432c,_0x1c0ff6,_0x10208d){return db[_0x6806('0x3e')][_0x6806('0x57')]({'where':{'id':_0x37432c[_0x6806('0x56')]['id']}})['then'](handleEntityNotFound(_0x1c0ff6,null))[_0x6806('0x1c')](function(_0x3054b2){if(_0x3054b2){return _0x3054b2[_0x6806('0x69')](_0x37432c['query'][_0x6806('0x6a')]);}})[_0x6806('0x1c')](respondWithStatusCode(_0x1c0ff6,null))[_0x6806('0x25')](handleError(_0x1c0ff6,null));};exports[_0x6806('0x6b')]=function(_0x2d166f,_0x34413d,_0x3ee2e1){var _0x117a54={'channel':_0x6806('0x6c')};var _0xc32b87=[];var _0x486cce=[];var _0x20e2b1={};return db[_0x6806('0x3e')][_0x6806('0x57')]({'where':{'id':_0x2d166f['params']['id']},'include':[{'model':db[_0x6806('0x6d')],'as':'Applications'}]})[_0x6806('0x1c')](handleEntityNotFound(_0x34413d,null))[_0x6806('0x1c')](function(_0x1d0569){_0x117a54[_0x6806('0x6e')]=_0x1d0569;_0x117a54[_0x6806('0x6f')]=_[_0x6806('0x70')](_0x1d0569['Applications'],[_0x6806('0x71')],[_0x6806('0x72')]);if(_0x117a54[_0x6806('0x6e')][_0x6806('0x73')]){delete _0x117a54[_0x6806('0x6e')]['Applications'];}return db['CmContact'][_0x6806('0x60')]();})[_0x6806('0x1c')](function(_0x588d7b){if(!_0x588d7b){throw new db['Sequelize'][(_0x6806('0x74'))](_0x6806('0x75'));}_0xc32b87=_[_0x6806('0x76')](_[_0x6806('0x44')](_0x588d7b),[_0x6806('0x77'),_0x6806('0x78')]);_0x486cce=_[_0x6806('0x76')](_[_0x6806('0x44')](_0x588d7b),['createdAt',_0x6806('0x78'),_0x6806('0x79'),_0x6806('0x7a')]);_0x117a54[_0x6806('0x59')]={'mapKey':'mobile'};if(_0x117a54['account'][_0x6806('0x7b')]){switch(_0x117a54[_0x6806('0x6e')]['type']){case _0x6806('0x7c'):_0x117a54['body']['from']=_0x2d166f[_0x6806('0x59')]['From'];_0x117a54['body'][_0x6806('0x59')]=_0x2d166f['body'][_0x6806('0x7d')];_0x117a54[_0x6806('0x59')][_0x6806('0x7e')]=_0x2d166f[_0x6806('0x59')]['MessageSid'];break;case _0x6806('0x7f'):_0x117a54[_0x6806('0x59')][_0x6806('0x80')]='+'+_0x2d166f[_0x6806('0x59')][_0x6806('0x81')];_0x117a54[_0x6806('0x59')]['body']=_0x2d166f[_0x6806('0x59')]['text'];break;case'connectel':_0x117a54[_0x6806('0x59')][_0x6806('0x80')]=_0x2d166f[_0x6806('0x59')]['from'];_0x117a54['body']['body']=_0x2d166f[_0x6806('0x59')]['message'];break;case _0x6806('0x82'):_0x117a54[_0x6806('0x59')][_0x6806('0x80')]=_0x2d166f[_0x6806('0x59')][_0x6806('0x80')];_0x117a54[_0x6806('0x59')][_0x6806('0x59')]=_0x2d166f['body']['body'];_0x117a54[_0x6806('0x59')][_0x6806('0x7e')]=_0x2d166f[_0x6806('0x59')][_0x6806('0x83')];break;case'plivo':_0x117a54[_0x6806('0x59')][_0x6806('0x80')]=_0x2d166f[_0x6806('0x59')][_0x6806('0x84')];_0x117a54['body']['body']=_0x2d166f['body']['Text'];_0x117a54[_0x6806('0x59')][_0x6806('0x7e')]=_0x2d166f['body'][_0x6806('0x85')];break;case _0x6806('0x86'):_0x117a54[_0x6806('0x59')][_0x6806('0x80')]='+'+_0x2d166f[_0x6806('0x59')][_0x6806('0x87')][0x0][_0x6806('0x80')];_0x117a54[_0x6806('0x59')][_0x6806('0x59')]=_0x2d166f['body'][_0x6806('0x87')][0x0][_0x6806('0x88')];_0x117a54[_0x6806('0x59')]['messageId']=_0x2d166f['body'][_0x6806('0x87')][0x0][_0x6806('0x7e')];break;case _0x6806('0x89'):_0x117a54[_0x6806('0x59')][_0x6806('0x80')]=_0x2d166f[_0x6806('0x59')][_0x6806('0x8a')];_0x117a54[_0x6806('0x59')][_0x6806('0x59')]=_0x2d166f[_0x6806('0x59')][_0x6806('0x8b')][_0x6806('0x23')];break;case'clickatell':_0x117a54['body']['from']=_0x2d166f[_0x6806('0x59')][_0x6806('0x8c')];_0x117a54[_0x6806('0x59')][_0x6806('0x59')]=_0x2d166f[_0x6806('0x59')][_0x6806('0x88')];_0x117a54[_0x6806('0x59')][_0x6806('0x7e')]=_0x2d166f[_0x6806('0x59')]['replyMessageId'];break;case _0x6806('0x8d'):_0x117a54[_0x6806('0x59')][_0x6806('0x7e')]=_0x2d166f[_0x6806('0x59')][0x0]['message']['id'];_0x117a54[_0x6806('0x59')][_0x6806('0x80')]=_0x2d166f[_0x6806('0x59')][0x0]['message'][_0x6806('0x80')];_0x117a54[_0x6806('0x59')][_0x6806('0x59')]=_0x2d166f[_0x6806('0x59')][0x0]['message']['text'];break;case _0x6806('0x8e'):_0x117a54[_0x6806('0x59')][_0x6806('0x80')]=_0x2d166f[_0x6806('0x59')][_0x6806('0x80')];_0x117a54[_0x6806('0x59')][_0x6806('0x59')]=_0x2d166f[_0x6806('0x59')]['message'];_0x117a54['body'][_0x6806('0x7e')]=_0x2d166f[_0x6806('0x59')][_0x6806('0x8f')];break;}}if(_0x117a54['body']['id']){delete _0x117a54[_0x6806('0x59')]['id'];}if(_[_0x6806('0x90')](_0x117a54['body'][_0x6806('0x80')])){throw new db[(_0x6806('0x91'))][(_0x6806('0x74'))](_0x6806('0x92'));}if(_[_0x6806('0x90')](_0x117a54[_0x6806('0x59')][_0x6806('0x59')])||_0x117a54[_0x6806('0x59')][_0x6806('0x59')]===''){throw new db['Sequelize'][(_0x6806('0x74'))](_0x6806('0x93'));}if(_[_0x6806('0x90')](_0x117a54['body'][_0x6806('0x94')])){throw new db[(_0x6806('0x91'))][(_0x6806('0x74'))](_0x6806('0x95')+_0x486cce);}if(!_['includes'](_0x486cce,_0x117a54['body'][_0x6806('0x94')])){throw new db[(_0x6806('0x91'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x486cce);}_0x20e2b1[_0x117a54[_0x6806('0x59')]['mapKey']]=_0x117a54[_0x6806('0x59')]['from'];return db['CmList'][_0x6806('0x57')]({'where':{'id':_0x117a54[_0x6806('0x6e')][_0x6806('0x7a')]},'include':[{'model':db[_0x6806('0x96')],'as':_0x6806('0x97'),'where':_0x20e2b1,'limit':0x1,'order':[[_0x6806('0x78'),_0x6806('0x98')]]}]});})[_0x6806('0x1c')](handleEntityNotFound(_0x34413d,null))[_0x6806('0x1c')](function(_0x5715bc){if(_0x5715bc){_0x117a54[_0x6806('0x99')]=_[_0x6806('0x9a')](_0x5715bc,['Contacts']);if(_0x5715bc[_0x6806('0x97')][_0x6806('0x49')]){return _0x5715bc[_0x6806('0x97')][0x0];}var _0x15e0a9=_[_0x6806('0x13')](_0x117a54['body'],{'firstName':_0x117a54[_0x6806('0x59')]['from'],'ListId':_0x5715bc['id']});_0x15e0a9[_0x117a54['body']['mapKey']]=_0x117a54[_0x6806('0x59')][_0x6806('0x80')];return db['CmContact']['create'](_0x15e0a9,{'fields':_0xc32b87,'raw':!![]});}})['then'](handleEntityNotFound(_0x34413d,null))['then'](function(_0x46726d){if(_0x46726d){_0x117a54[_0x6806('0x9b')]=_0x46726d;var _0x1bc1a4={'ContactId':_0x46726d['id'],'phone':_0x117a54['body']['from'],'SmsAccountId':_0x2d166f[_0x6806('0x56')]['id']};var _0x2d1474={'ContactId':_0x46726d['id'],'SmsAccountId':_0x2d166f[_0x6806('0x56')]['id'],'closed':![]};return db[_0x6806('0x9c')][_0x6806('0x57')]({'where':_0x2d1474})[_0x6806('0x1c')](function(_0xe69f14){if(_0xe69f14){return[_0xe69f14,![]];}return db['SmsInteraction'][_0x6806('0x58')](_0x1bc1a4)['then'](function(_0x10ce7a){return[_0x10ce7a,!![]];});});}})[_0x6806('0x9d')](function(_0x4f3f06,_0x2be4f9){_0x117a54[_0x6806('0x9e')]=_0x4f3f06[_0x6806('0x35')]({'plain':!![]});_0x117a54[_0x6806('0x9e')][_0x6806('0x9f')]=![];if(_0x2be4f9){if(_0x117a54[_0x6806('0x6e')][_0x6806('0xa0')]){_0x117a54[_0x6806('0x6f')][_0x6806('0xa1')]({'id':0x0,'priority':_0x117a54[_0x6806('0x6f')]['length']+0x1,'app':_0x6806('0xa2'),'appdata':_0x6806('0xa3'),'interval':_0x6806('0xa4')});}_0x117a54[_0x6806('0x9e')][_0x6806('0x9f')]=!![];}return db['SmsMessage'][_0x6806('0x58')]({'phone':_0x117a54[_0x6806('0x59')]['from'],'messageId':_0x117a54[_0x6806('0x59')][_0x6806('0x7e')],'body':_0x117a54[_0x6806('0x59')][_0x6806('0x59')],'SmsAccountId':_0x2d166f[_0x6806('0x56')]['id'],'SmsInteractionId':_0x4f3f06['id'],'direction':'in','ContactId':_0x4f3f06[_0x6806('0xa5')],'AttachmentId':_0x117a54['body'][_0x6806('0xa6')]});})[_0x6806('0x1c')](function(_0x4e1d5b){_0x117a54['message']=_0x4e1d5b;if(_0x117a54['interaction'][_0x6806('0xa7')]){return db[_0x6806('0xa8')][_0x6806('0x57')]({'attributes':['id',_0x6806('0x38')],'where':{'id':_0x117a54[_0x6806('0x9e')][_0x6806('0xa7')]}})[_0x6806('0x1c')](function(_0xf73ea0){if(_0xf73ea0){_0x117a54[_0x6806('0x6f')][_0x6806('0xa9')]({'id':0x0,'priority':0x0,'app':_0x6806('0xaa'),'appdata':_0xf73ea0[_0x6806('0x38')]+','+(_0x117a54['account'][_0x6806('0xab')]||0xa),'interval':_0x6806('0xa4')});}return respondWithRpcPromise(_0x6806('0xac'),'startRouting',_0x117a54);});}return respondWithRpcPromise(_0x6806('0xac'),'startRouting',_0x117a54);})[_0x6806('0x1c')](function(_0x59620e){if(_0x59620e){var _0x4c27a1=0xc8;var _0x193f88=_0x6806('0xad');logger[_0x6806('0x1d')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x193f88,_0x4c27a1,_0x6806('0xae'));logger['debug'](_0x6806('0xaf'),_0x193f88,_0x4c27a1,_0x6806('0xae'),JSON[_0x6806('0xb0')](_0x59620e));if(_0x117a54['account'][_0x6806('0x7b')]==='twilio'){return _0x34413d['status'](_0x4c27a1)[_0x6806('0x2e')](_0x6806('0xb1'),'text/xml')[_0x6806('0x39')]('\x0a');}else{return _0x34413d[_0x6806('0x27')](_0x4c27a1)['json'](_0x59620e);}}})['catch'](handleError(_0x34413d,null));};exports[_0x6806('0xb2')]=function(_0x428d7a,_0x20c49e){var _0x500800=_0x428d7a[_0x6806('0x56')]['id'];var _0x3db9b1=_0x428d7a[_0x6806('0x59')];var _0x4caad=0xc8;var _0xc50355=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x6806('0xb3')][_0x6806('0xb4')][_0x6806('0xb5')]['READ_COMMITTED']},function(_0x29ea8c){return db[_0x6806('0x3e')][_0x6806('0x63')]({'where':{'id':_0x500800},'transaction':_0x29ea8c})[_0x6806('0x1c')](function(_0x9555c1){if(_0x9555c1){return db['SmsApplication'][_0x6806('0x34')]({'where':{'SmsAccountId':_0x500800},'transaction':_0x29ea8c})[_0x6806('0x1c')](function(){var _0x236a56=_[_0x6806('0x3d')](_0x3db9b1,function(_0x32bba9){_0x32bba9['SmsAccountId']=_0x500800;return _0x32bba9;});return db['SmsApplication']['bulkCreate'](_0x236a56,{'transaction':_0x29ea8c});});}else{_0x4caad=0x194;_0xc50355=[];}});})[_0x6806('0x1c')](function(){if(_0x4caad!==0x194){return db[_0x6806('0x6d')][_0x6806('0xb6')]({'where':{'SmsAccountId':_0x500800},'order':_0x6806('0x71')})['then'](function(_0x46c5a6){_0xc50355=_0x46c5a6;});}})[_0x6806('0x25')](function(_0x228b75){_0x4caad=0x1f4;logger[_0x6806('0x20')](_0x228b75[_0x6806('0x37')]);if(_0x228b75['name']){delete _0x228b75[_0x6806('0x38')];}_0xc50355=_0x228b75;})[_0x6806('0xb7')](function(){if(_0xc50355===null){_0x20c49e[_0x6806('0x26')](_0x4caad);}else{if(_0x4caad===0x1f4){_0x20c49e[_0x6806('0x27')](_0x4caad)['send'](_0xc50355);}else{_0x20c49e[_0x6806('0x27')](_0x4caad)[_0x6806('0x29')](_0xc50355);}}});};exports[_0x6806('0xb8')]=function(_0x57637b,_0x3d0d97,_0x987e46){var _0x3a6268={};var _0x1fb677={};var _0x2fbafc;var _0x313cb6;return db[_0x6806('0x3e')][_0x6806('0x63')]({'where':{'id':_0x57637b['params']['id']}})[_0x6806('0x1c')](handleEntityNotFound(_0x3d0d97,null))[_0x6806('0x1c')](function(_0x30582c){if(_0x30582c){_0x2fbafc=_0x30582c;_0x1fb677[_0x6806('0x42')]=_[_0x6806('0x44')](db[_0x6806('0x6d')][_0x6806('0x3f')]);_0x1fb677[_0x6806('0x43')]=_[_0x6806('0x44')](_0x57637b[_0x6806('0x43')]);_0x1fb677[_0x6806('0x45')]=_[_0x6806('0x46')](_0x1fb677[_0x6806('0x42')],_0x1fb677[_0x6806('0x43')]);_0x3a6268[_0x6806('0x47')]=_['intersection'](_0x1fb677[_0x6806('0x42')],qs[_0x6806('0x48')](_0x57637b[_0x6806('0x43')][_0x6806('0x48')]));_0x3a6268[_0x6806('0x47')]=_0x3a6268['attributes'][_0x6806('0x49')]?_0x3a6268[_0x6806('0x47')]:_0x1fb677[_0x6806('0x42')];_0x3a6268[_0x6806('0x64')]=qs['sort'](_0x57637b[_0x6806('0x43')][_0x6806('0x4c')]);_0x3a6268[_0x6806('0x4d')]=qs[_0x6806('0x45')](_['pick'](_0x57637b['query'],_0x1fb677[_0x6806('0x45')]));if(_0x57637b[_0x6806('0x43')][_0x6806('0x65')]){_0x3a6268[_0x6806('0x4d')]=_[_0x6806('0x4f')](_0x3a6268[_0x6806('0x4d')],{'$or':_['map'](_0x3a6268[_0x6806('0x47')],function(_0x6763a6){var _0x2f57aa={};_0x2f57aa[_0x6763a6]={'$like':'%'+_0x57637b[_0x6806('0x43')]['filter']+'%'};return _0x2f57aa;})});}_0x3a6268=_['merge']({},_0x3a6268,_0x57637b['options']);return _0x2fbafc[_0x6806('0xb8')](_0x3a6268);}})[_0x6806('0x1c')](function(_0x2f33fd){if(_0x2f33fd){_0x313cb6=_0x2f33fd[_0x6806('0x49')];if(!_0x57637b[_0x6806('0x43')]['hasOwnProperty']('nolimit')){_0x3a6268[_0x6806('0x2c')]=qs['limit'](_0x57637b['query'][_0x6806('0x2c')]);_0x3a6268[_0x6806('0x2a')]=qs[_0x6806('0x2a')](_0x57637b[_0x6806('0x43')][_0x6806('0x2a')]);}return _0x2fbafc['getApplications'](_0x3a6268);}})[_0x6806('0x1c')](function(_0x1befd2){if(_0x1befd2){return _0x1befd2?{'count':_0x313cb6,'rows':_0x1befd2}:null;}})[_0x6806('0x1c')](respondWithResult(_0x3d0d97,null))[_0x6806('0x25')](handleError(_0x3d0d97,null));};exports['getInteractions']=function(_0x19ee83,_0x31ba68,_0x5e171b){var _0x3f2690={'raw':![],'where':{}};var _0x508857={};var _0x4d3c60={'count':0x0,'rows':[]};return db[_0x6806('0x3e')][_0x6806('0x63')]({'where':{'id':_0x19ee83[_0x6806('0x56')]['id']}})['then'](handleEntityNotFound(_0x31ba68,null))[_0x6806('0x1c')](function(_0x225d8c){if(_0x225d8c){_0x508857[_0x6806('0x42')]=_[_0x6806('0x44')](db[_0x6806('0x9c')][_0x6806('0x3f')]);_0x508857[_0x6806('0x43')]=_['keys'](_0x19ee83[_0x6806('0x43')]);_0x508857[_0x6806('0x45')]=_['intersection'](_0x508857[_0x6806('0x42')],_0x508857[_0x6806('0x43')]);_0x3f2690[_0x6806('0x47')]=_[_0x6806('0x46')](_0x508857[_0x6806('0x42')],qs[_0x6806('0x48')](_0x19ee83[_0x6806('0x43')][_0x6806('0x48')]));_0x3f2690[_0x6806('0x47')]=_0x3f2690[_0x6806('0x47')]['length']?_0x3f2690[_0x6806('0x47')]:_0x508857[_0x6806('0x42')];if(!_0x19ee83[_0x6806('0x43')][_0x6806('0x4a')](_0x6806('0x4b'))){_0x3f2690[_0x6806('0x2c')]=qs['limit'](_0x19ee83[_0x6806('0x43')][_0x6806('0x2c')]);_0x3f2690[_0x6806('0x2a')]=qs[_0x6806('0x2a')](_0x19ee83['query'][_0x6806('0x2a')]);}_0x3f2690[_0x6806('0x64')]=qs[_0x6806('0x4c')](_0x19ee83['query'][_0x6806('0x4c')]);_0x3f2690[_0x6806('0x4d')]=qs[_0x6806('0x45')](_['pick'](_0x19ee83[_0x6806('0x43')],_0x508857['filters']));_0x3f2690[_0x6806('0x4d')][_0x6806('0x61')]=_0x225d8c['id'];if(_0x19ee83[_0x6806('0x43')][_0x6806('0x65')]){_0x3f2690[_0x6806('0x4d')]=_[_0x6806('0x4f')](_0x3f2690[_0x6806('0x4d')],{'$or':_[_0x6806('0x3d')](_0x3f2690['attributes'],function(_0x13ccc2){var _0x403af8={};_0x403af8[_0x13ccc2]={'$like':'%'+_0x19ee83[_0x6806('0x43')][_0x6806('0x65')]+'%'};return _0x403af8;})});}_0x3f2690=_[_0x6806('0x4f')]({},_0x3f2690,_0x19ee83['options']);return db['SmsInteraction'][_0x6806('0x2d')]({'where':_0x3f2690[_0x6806('0x4d')]})[_0x6806('0x1c')](function(_0x24e2d4){_0x4d3c60[_0x6806('0x2d')]=_0x24e2d4;if(_0x19ee83['query'][_0x6806('0x52')]){_0x3f2690[_0x6806('0x53')]=[{'model':db[_0x6806('0x96')],'as':'Contact','required':![]},{'model':db[_0x6806('0xa8')],'as':_0x6806('0xb9'),'attributes':['name','fullname',_0x6806('0xba')],'required':![]},{'model':db['Tag'],'as':_0x6806('0xbb'),'attributes':['id',_0x6806('0x38'),_0x6806('0xbc')],'where':_0x19ee83['query'][_0x6806('0xbd')]?{'id':_0x19ee83[_0x6806('0x43')][_0x6806('0xbd')]}:undefined,'required':_0x19ee83[_0x6806('0x43')][_0x6806('0xbd')]?!![]:![]}];}return db[_0x6806('0x9c')][_0x6806('0x54')](_0x3f2690);})['then'](function(_0xb23620){_0x4d3c60[_0x6806('0x55')]=_0xb23620;return _0x4d3c60;});}})[_0x6806('0x1c')](respondWithFilteredResult(_0x31ba68,_0x3f2690))[_0x6806('0x25')](handleError(_0x31ba68,null));};exports[_0x6806('0x39')]=function(_0x43e457,_0x58d0f6,_0x1cb8fd){var _0xd47ce6,_0x29a84f,_0x1e9669;if(_[_0x6806('0x90')](_0x43e457[_0x6806('0x59')][_0x6806('0x59')])||_0x43e457[_0x6806('0x59')][_0x6806('0x59')]===''){throw new db[(_0x6806('0x91'))][(_0x6806('0x74'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6806('0x90')](_0x43e457['body']['to'])){throw new db['Sequelize'][(_0x6806('0x74'))](_0x6806('0xbe'));}_0xd47ce6=_0x43e457[_0x6806('0x59')]['to'];return db['SmsAccount'][_0x6806('0x57')]({'where':{'id':_0x43e457[_0x6806('0x56')]['id']},'include':[{'model':db[_0x6806('0xbf')],'as':_0x6806('0xc0'),'include':[{'model':db[_0x6806('0x96')],'as':'Contacts','where':{'mobile':_0xd47ce6},'limit':0x1,'order':[['updatedAt',_0x6806('0x98')]]}]}]})[_0x6806('0x1c')](handleEntityNotFound(_0x58d0f6,null))[_0x6806('0x1c')](function(_0x312adf){if(_0x312adf&&_0x312adf[_0x6806('0xc0')]){_0x29a84f=_0x312adf[_0x6806('0x35')]({'plain':!![]});if(_0x29a84f[_0x6806('0xc0')]&&_0x29a84f[_0x6806('0xc0')]['Contacts'][_0x6806('0x49')]){return _0x29a84f['List'][_0x6806('0x97')][0x0];}return db['CmContact']['create'](_[_0x6806('0x13')](_0x43e457['body'],{'firstName':_0xd47ce6,'mobile':_0xd47ce6,'phone':_0xd47ce6,'ListId':_0x29a84f[_0x6806('0x7a')]}));}})[_0x6806('0x1c')](handleEntityNotFound(_0x58d0f6,null))[_0x6806('0x1c')](function(_0xe83dda){if(_0xe83dda){_0x1e9669=_0xe83dda;return db[_0x6806('0x9c')]['find']({'where':{'ContactId':_0x1e9669['id'],'closed':![],'SmsAccountId':_0x29a84f['id']}})['then'](function(_0x5443fb){if(_0x5443fb){return[_0x5443fb,![]];}return db[_0x6806('0x9c')][_0x6806('0x58')]({'UserId':_0x43e457[_0x6806('0xc1')]['id'],'ContactId':_0x1e9669['id'],'SmsAccountId':_0x29a84f['id'],'phone':_0xd47ce6,'firstMsgDirection':_0x6806('0xc2'),'Messages':[_[_0x6806('0x4f')](_0x43e457['body'],{'read':![],'body':_0x43e457['body']['body'],'phone':_0xd47ce6,'SmsAccountId':_0x29a84f['id'],'UserId':_0x43e457[_0x6806('0xc1')]['id'],'ContactId':_0x1e9669['id']})]},{'include':[{'model':db[_0x6806('0xc3')],'as':_0x6806('0xc4')}]})['then'](function(_0x132d42){return[_0x132d42,!![]];});});}})[_0x6806('0x9d')](function(_0x1462b1,_0x177459){if(_0x177459){return _0x1462b1;}return db[_0x6806('0xc3')][_0x6806('0x58')](_[_0x6806('0x4f')](_0x43e457[_0x6806('0x59')],{'read':![],'body':_0x43e457['body'][_0x6806('0x59')],'phone':_0xd47ce6,'SmsAccountId':_0x29a84f['id'],'SmsInteractionId':_0x1462b1['id'],'UserId':_0x43e457['user']['id'],'ContactId':_0x1e9669['id']}))[_0x6806('0x1c')](function(_0x4e4030){_0x1462b1[_0x6806('0xc5')][_0x6806('0xc4')]=[];_0x1462b1['dataValues'][_0x6806('0xc4')][_0x6806('0xa1')](_0x4e4030['dataValues']);return _0x1462b1;});})[_0x6806('0x1c')](respondWithResult(_0x58d0f6,null))['catch'](handleError(_0x58d0f6,null));};exports['status']=function(_0x345517,_0x5b1c79,_0x269959){if(_0x345517[_0x6806('0x59')]['id']){delete _0x345517[_0x6806('0x59')]['id'];}var _0x1ef669,_0x157820,_0x4853f0;return db[_0x6806('0x3e')]['find']({'where':{'id':_0x345517['params']['id']}})[_0x6806('0x1c')](handleEntityNotFound(_0x5b1c79,null))['then'](function(_0x2b5104){if(_0x2b5104){_0x4853f0=_0x2b5104;logger['debug'](_0x6806('0xc6'),_0x6806('0x27'),_0x6806('0xc7'),_0x2b5104[_0x6806('0x7b')],util[_0x6806('0xc8')](_0x345517[_0x6806('0x59')],{'showHidden':![],'depth':null}));switch(_0x2b5104[_0x6806('0x7b')]){case _0x6806('0x7f'):if(_0x345517[_0x6806('0x59')][_0x6806('0xc9')]&&_0x345517[_0x6806('0x59')]['status']){_0x157820=_0x345517[_0x6806('0x59')][_0x6806('0x27')];return db[_0x6806('0xc3')][_0x6806('0x57')]({'where':{'messageId':_0x345517[_0x6806('0x59')]['skebby_dispatch_id']}});}break;case _0x6806('0xca'):if(_0x345517['body']['requestid']&&_0x345517['body'][_0x6806('0xcb')]){_0x157820=_0x345517[_0x6806('0x59')]['statusInt'];return db[_0x6806('0xc3')][_0x6806('0x57')]({'where':{'messageId':_0x345517[_0x6806('0x59')]['requestid']}});}break;case'clicksend':if(_0x345517['body'][_0x6806('0x83')]&&_0x345517['body'][_0x6806('0xcc')]){_0x157820=_0x345517[_0x6806('0x59')][_0x6806('0xcc')];return db[_0x6806('0xc3')][_0x6806('0x57')]({'where':{'messageId':_0x345517[_0x6806('0x59')][_0x6806('0x83')]}});}break;case _0x6806('0x86'):var _0x4eb58d=_0x345517[_0x6806('0x59')][_0x6806('0x87')][0x0];if(_0x4eb58d[_0x6806('0x7e')]&&_0x4eb58d[_0x6806('0x27')][_0x6806('0xcd')]===_0x6806('0xce')){_0x157820=_0x4eb58d['status'][_0x6806('0xcd')];return db[_0x6806('0xc3')][_0x6806('0x57')]({'where':{'messageId':_0x4eb58d[_0x6806('0x7e')]}});}break;case _0x6806('0xcf'):if(_0x345517['body'][_0x6806('0x7e')]&&_0x345517['body'][_0x6806('0x27')]){_0x157820=_0x345517[_0x6806('0x59')][_0x6806('0x27')];return db[_0x6806('0xc3')][_0x6806('0x57')]({'where':{'messageId':_0x345517[_0x6806('0x59')][_0x6806('0x7e')]}});}break;case'bandwidth':if(_0x345517[_0x6806('0x59')][0x0][_0x6806('0x23')]['id']){_0x157820=_0x345517['body'][0x0]['type'];return db[_0x6806('0xc3')][_0x6806('0x57')]({'where':{'messageId':_0x345517[_0x6806('0x59')][0x0]['message']['id']}});}break;case _0x6806('0x8e'):if(_0x345517[_0x6806('0x59')][_0x6806('0xd0')]&&_0x345517[_0x6806('0x59')][_0x6806('0x27')]){_0x157820=_0x345517['body'][_0x6806('0x27')];return db[_0x6806('0xc3')][_0x6806('0x57')]({'where':{'messageId':_0x345517[_0x6806('0x59')]['redif']}});}break;}}})[_0x6806('0x1c')](handleEntityNotFound(_0x5b1c79,null))['then'](function(_0x23c6b1){if(_0x23c6b1){_0x1ef669=_0x23c6b1;switch(_0x4853f0[_0x6806('0x7b')]){case _0x6806('0x7f'):if(_0x157820===_0x6806('0xce')){return _0x1ef669[_0x6806('0x33')]({'read':!![]});}else{logger[_0x6806('0x20')](_0x6806('0xc6'),_0x6806('0x27'),_0x6806('0x7f'),util[_0x6806('0xc8')](_0x345517[_0x6806('0x59')],{'showHidden':![],'depth':null}));}break;case _0x6806('0xca'):if(_0x157820==='1'){return _0x1ef669[_0x6806('0x33')]({'read':!![]});}else{logger[_0x6806('0x20')](_0x6806('0xc6'),_0x6806('0x27'),'skebby',util['inspect'](_0x345517[_0x6806('0x59')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x345517['body'][_0x6806('0xd1')]&&_0x157820>=0xc8&&_0x157820<=0xce){return _0x1ef669[_0x6806('0x33')]({'read':!![]});}else{logger[_0x6806('0x20')](_0x6806('0xc6'),'status','clicksend',util['inspect'](_0x345517[_0x6806('0x59')],{'showHidden':![],'depth':null}));}break;case _0x6806('0x86'):var _0x31be58=_0x345517[_0x6806('0x59')][_0x6806('0x87')][0x0];if(_0x31be58['status'][_0x6806('0xcd')]===_0x6806('0xce')){return _0x1ef669['update']({'read':!![]});}else{logger[_0x6806('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6806('0x27'),_0x6806('0x86'),util[_0x6806('0xc8')](_0x345517[_0x6806('0x59')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x157820==_0x6806('0xd2')||_0x157820==_0x6806('0xd3')){return _0x1ef669[_0x6806('0x33')]({'read':!![]});}else{logger[_0x6806('0x20')](_0x6806('0xc6'),_0x6806('0x27'),_0x6806('0xcf'),util[_0x6806('0xc8')](_0x345517['body'],{'showHidden':![],'depth':null}));}break;case _0x6806('0x8d'):if(_0x157820==_0x6806('0xd4')){return _0x1ef669['update']({'read':!![]});}else{logger[_0x6806('0x20')](_0x6806('0xc6'),'status',_0x6806('0x8d'),util[_0x6806('0xc8')](_0x345517[_0x6806('0x59')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x157820==='DELIVRD'||_0x157820===_0x6806('0xd5')){return _0x1ef669[_0x6806('0x33')]({'read':!![]});}else{logger['error'](_0x6806('0xc6'),_0x6806('0x27'),'intelepeer',util[_0x6806('0xc8')](_0x345517['body'],{'showHidden':![],'depth':null}));}break;}return _0x1ef669;}})[_0x6806('0x1c')](respondWithResult(_0x5b1c79,null))[_0x6806('0x25')](handleError(_0x5b1c79,null));};exports[_0x6806('0xd6')]=function(_0x20031d,_0x58bc4a,_0x1d8a89){var _0x297698,_0x1df8bb,_0x11cc41;return db[_0x6806('0x3e')]['find']({'where':{'id':_0x20031d[_0x6806('0x56')]['id']}})[_0x6806('0x1c')](handleEntityNotFound(_0x58bc4a,null))[_0x6806('0x1c')](function(_0x5ad9fb){if(_0x5ad9fb){_0x11cc41=_0x5ad9fb;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6806('0x27'),_0x6806('0xc7'),_0x5ad9fb[_0x6806('0x7b')],util[_0x6806('0xc8')](_0x20031d['query'],{'showHidden':![],'depth':null}));switch(_0x5ad9fb[_0x6806('0x7b')]){case _0x6806('0x89'):if(_0x20031d[_0x6806('0x43')][_0x6806('0xd7')]&&_0x20031d['query']['state']){_0x1df8bb=_0x20031d[_0x6806('0x43')]['state'];return db[_0x6806('0xc3')][_0x6806('0x57')]({'where':{'messageId':_0x20031d[_0x6806('0x43')]['message-id']}});}break;}}})[_0x6806('0x1c')](handleEntityNotFound(_0x58bc4a,null))['then'](function(_0x4a94ac){if(_0x4a94ac){_0x297698=_0x4a94ac;switch(_0x11cc41['type']){case _0x6806('0x89'):if(_0x1df8bb==='2'||_0x1df8bb==='6'){return _0x297698['update']({'read':!![]});}else{logger[_0x6806('0x20')](_0x6806('0xc6'),_0x6806('0x27'),'csc',util['inspect'](_0x20031d[_0x6806('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x297698;}})[_0x6806('0x1c')](respondWithResult(_0x58bc4a,null))[_0x6806('0x25')](handleError(_0x58bc4a,null));};exports['addAgents']=function(_0x150d64,_0x59fbf2,_0x2e8e41){return db[_0x6806('0x3e')][_0x6806('0x57')]({'where':{'id':_0x150d64[_0x6806('0x56')]['id']}})[_0x6806('0x1c')](handleEntityNotFound(_0x59fbf2,null))[_0x6806('0x1c')](function(_0x7eda7c){if(_0x7eda7c){return _0x7eda7c['addAgents'](_0x150d64[_0x6806('0x59')]['ids'],_[_0x6806('0x9a')](_0x150d64[_0x6806('0x59')],[_0x6806('0x6a'),'id'])||{})[_0x6806('0x9d')](function(_0x4d0623){for(var _0x1168bf=0x0;_0x1168bf<_0x150d64['body'][_0x6806('0x6a')]['length'];_0x1168bf+=0x1){socket[_0x6806('0xd8')]('userSmsAccount:save',{'UserId':Number(_0x150d64[_0x6806('0x59')][_0x6806('0x6a')][_0x1168bf]),'SmsAccountId':Number(_0x150d64[_0x6806('0x56')]['id'])});}return _0x4d0623;});}})[_0x6806('0x1c')](respondWithResult(_0x59fbf2,null))[_0x6806('0x25')](handleError(_0x59fbf2,null));};exports[_0x6806('0xd9')]=function(_0x16df90,_0x1e85e2,_0x4ea190){return db[_0x6806('0x3e')][_0x6806('0x57')]({'where':{'id':_0x16df90['params']['id']}})['then'](handleEntityNotFound(_0x1e85e2,null))['then'](function(_0xb653cf){if(_0xb653cf){return _0xb653cf[_0x6806('0xd9')](_0x16df90[_0x6806('0x43')][_0x6806('0x6a')])[_0x6806('0x1c')](function(){if(_[_0x6806('0xda')](_0x16df90[_0x6806('0x43')]['ids'])){for(var _0x252313=0x0;_0x252313<_0x16df90[_0x6806('0x43')][_0x6806('0x6a')][_0x6806('0x49')];_0x252313+=0x1){socket[_0x6806('0xd8')](_0x6806('0xdb'),{'UserId':Number(_0x16df90[_0x6806('0x43')][_0x6806('0x6a')][_0x252313]),'SmsAccountId':Number(_0x16df90['params']['id'])});}}else{socket[_0x6806('0xd8')](_0x6806('0xdb'),{'UserId':Number(_0x16df90[_0x6806('0x43')][_0x6806('0x6a')]),'SmsAccountId':Number(_0x16df90[_0x6806('0x56')]['id'])});}});}})[_0x6806('0x1c')](respondWithStatusCode(_0x1e85e2,null))[_0x6806('0x25')](handleError(_0x1e85e2,null));};exports[_0x6806('0xdc')]=function(_0x5a4697,_0x510150,_0x586651){var _0x8b54a1={};var _0xb971bf={};var _0x143c70;var _0x2285e5;return db['SmsAccount'][_0x6806('0x63')]({'where':{'id':_0x5a4697[_0x6806('0x56')]['id']}})['then'](handleEntityNotFound(_0x510150,null))['then'](function(_0x1b1693){if(_0x1b1693){_0x143c70=_0x1b1693;_0xb971bf['model']=_['keys'](db[_0x6806('0xa8')]['rawAttributes']);_0xb971bf[_0x6806('0x43')]=_[_0x6806('0x44')](_0x5a4697[_0x6806('0x43')]);_0xb971bf[_0x6806('0x45')]=_[_0x6806('0x46')](_0xb971bf[_0x6806('0x42')],_0xb971bf[_0x6806('0x43')]);_0x8b54a1[_0x6806('0x47')]=_['intersection'](_0xb971bf['model'],qs[_0x6806('0x48')](_0x5a4697['query'][_0x6806('0x48')]));_0x8b54a1[_0x6806('0x47')]=_0x8b54a1[_0x6806('0x47')][_0x6806('0x49')]?_0x8b54a1[_0x6806('0x47')]:_0xb971bf[_0x6806('0x42')];_0x8b54a1[_0x6806('0x64')]=qs[_0x6806('0x4c')](_0x5a4697[_0x6806('0x43')][_0x6806('0x4c')]);_0x8b54a1[_0x6806('0x4d')]=qs[_0x6806('0x45')](_[_0x6806('0x4e')](_0x5a4697[_0x6806('0x43')],_0xb971bf[_0x6806('0x45')]));if(_0x5a4697['query'][_0x6806('0x65')]){_0x8b54a1[_0x6806('0x4d')]=_[_0x6806('0x4f')](_0x8b54a1[_0x6806('0x4d')],{'$or':_['map'](_0x8b54a1[_0x6806('0x47')],function(_0x5ca40f){var _0x2bc203={};_0x2bc203[_0x5ca40f]={'$like':'%'+_0x5a4697[_0x6806('0x43')][_0x6806('0x65')]+'%'};return _0x2bc203;})});}_0x8b54a1=_[_0x6806('0x4f')]({},_0x8b54a1,_0x5a4697['options']);return _0x143c70[_0x6806('0xdc')](_0x8b54a1);}})[_0x6806('0x1c')](function(_0x1b18d1){if(_0x1b18d1){_0x2285e5=_0x1b18d1[_0x6806('0x49')];if(!_0x5a4697[_0x6806('0x43')][_0x6806('0x4a')](_0x6806('0x4b'))){_0x8b54a1['limit']=qs['limit'](_0x5a4697[_0x6806('0x43')][_0x6806('0x2c')]);_0x8b54a1[_0x6806('0x2a')]=qs[_0x6806('0x2a')](_0x5a4697[_0x6806('0x43')][_0x6806('0x2a')]);}return _0x143c70[_0x6806('0xdc')](_0x8b54a1);}})[_0x6806('0x1c')](function(_0x401901){if(_0x401901){return _0x401901?{'count':_0x2285e5,'rows':_0x401901}:null;}})[_0x6806('0x1c')](respondWithResult(_0x510150,null))['catch'](handleError(_0x510150,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 5c5cef8..baf0ea0 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 _0x385a=['save','emit','hook','exports','setMaxListeners'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0x385a,0x14e));var _0xa385=function(_0x4490d9,_0x4d061e){_0x4490d9=_0x4490d9-0x0;var _0x557a28=_0x385a[_0x4490d9];return _0x557a28;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa385('0x0')](0x0);var events={'afterCreate':_0xa385('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e1bed){return function(_0x1c475d,_0x22c497,_0x4a23d3){SmsAccountEvents[_0xa385('0x2')](_0x2e1bed+':'+_0x1c475d['id'],_0x1c475d);SmsAccountEvents['emit'](_0x2e1bed,_0x1c475d);_0x4a23d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xa385('0x3')](e,emitEvent(event));}}module[_0xa385('0x4')]=SmsAccountEvents; \ No newline at end of file +var _0xe4d0=['SmsAccount','save','update','remove','emit','hasOwnProperty','events'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xe4d0,0x8b));var _0x0e4d=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0xe4d0[_0x427217];return _0x5b28fb;};'use strict';var EventEmitter=require(_0x0e4d('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x0e4d('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e4d('0x2'),'afterUpdate':_0x0e4d('0x3'),'afterDestroy':_0x0e4d('0x4')};function emitEvent(_0x1afd8c){return function(_0xccee5b,_0x2b424b,_0x5322a3){SmsAccountEvents[_0x0e4d('0x5')](_0x1afd8c+':'+_0xccee5b['id'],_0xccee5b);SmsAccountEvents[_0x0e4d('0x5')](_0x1afd8c,_0xccee5b);_0x5322a3(null);};}for(var e in events){if(events[_0x0e4d('0x6')](e)){var event=events[e];SmsAccount['hook'](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 696b8d0..2bcb30e 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 _0xd06e=['define','SmsAccount','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0x57a2a3,_0x4fc852){var _0x4dc9f8=function(_0x11063f){while(--_0x11063f){_0x57a2a3['push'](_0x57a2a3['shift']());}};_0x4dc9f8(++_0x4fc852);}(_0xd06e,0x10a));var _0xed06=function(_0x1c9513,_0x28e040){_0x1c9513=_0x1c9513-0x0;var _0x2affc1=_0xd06e[_0x1c9513];return _0x2affc1;};'use strict';var _=require('lodash');var util=require(_0xed06('0x0'));var logger=require(_0xed06('0x1'))(_0xed06('0x2'));var moment=require(_0xed06('0x3'));var BPromise=require('bluebird');var rp=require(_0xed06('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed06('0x5'));var config=require(_0xed06('0x6'));var attributes=require(_0xed06('0x7'));module[_0xed06('0x8')]=function(_0x32f893,_0x37b988){return _0x32f893[_0xed06('0x9')](_0xed06('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8c9=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts'];(function(_0x3a833e,_0x5a1878){var _0xdff445=function(_0x1715a3){while(--_0x1715a3){_0x3a833e['push'](_0x3a833e['shift']());}};_0xdff445(++_0x5a1878);}(_0xb8c9,0x145));var _0x9b8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8c9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9b8c('0x0'));var util=require(_0x9b8c('0x1'));var logger=require(_0x9b8c('0x2'))(_0x9b8c('0x3'));var moment=require(_0x9b8c('0x4'));var BPromise=require(_0x9b8c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b8c('0x6'));var rimraf=require(_0x9b8c('0x7'));var config=require(_0x9b8c('0x8'));var attributes=require(_0x9b8c('0x9'));module[_0x9b8c('0xa')]=function(_0x84aae,_0x352ad8){return _0x84aae['define'](_0x9b8c('0xb'),attributes,{'tableName':_0x9b8c('0xc'),'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 8e09f9c..6202eee 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 _0x27bd=['SmsAccount','find','options','raw','where','include','map','model','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','ShowSmsAccount'];(function(_0x2e903c,_0x3c2157){var _0xb65f6b=function(_0x556552){while(--_0x556552){_0x2e903c['push'](_0x2e903c['shift']());}};_0xb65f6b(++_0x3c2157);}(_0x27bd,0x7b));var _0xd27b=function(_0xe59246,_0x58b419){_0xe59246=_0xe59246-0x0;var _0x575237=_0x27bd[_0xe59246];return _0x575237;};'use strict';var _=require(_0xd27b('0x0'));var util=require('util');var moment=require(_0xd27b('0x1'));var BPromise=require(_0xd27b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd27b('0x3'));var db=require(_0xd27b('0x4'))['db'];var utils=require(_0xd27b('0x5'));var logger=require('../../config/logger')(_0xd27b('0x6'));var config=require(_0xd27b('0x7'));var jayson=require(_0xd27b('0x8'));var client=jayson[_0xd27b('0x9')][_0xd27b('0xa')]({'port':0x232a});config[_0xd27b('0xb')]=_[_0xd27b('0xc')](config[_0xd27b('0xb')],{'host':_0xd27b('0xd'),'port':0x18eb});var socket=require(_0xd27b('0xe'))(new Redis(config[_0xd27b('0xb')]));require(_0xd27b('0xf'))['register'](socket);function respondWithRpcPromise(_0x5c8a2f,_0x47c3bb,_0x214ad6){return new BPromise(function(_0x48a9a9,_0x515087){return client[_0xd27b('0x10')](_0x5c8a2f,_0x214ad6)['then'](function(_0x3ed035){logger[_0xd27b('0x11')]('SmsAccount,\x20%s,\x20%s',_0x47c3bb,_0xd27b('0x12'));logger[_0xd27b('0x13')](_0xd27b('0x14'),_0x47c3bb,_0xd27b('0x12'),JSON[_0xd27b('0x15')](_0x3ed035));if(_0x3ed035[_0xd27b('0x16')]){if(_0x3ed035[_0xd27b('0x16')][_0xd27b('0x17')]===0x1f4){logger[_0xd27b('0x16')]('SmsAccount,\x20%s,\x20%s',_0x47c3bb,_0x3ed035[_0xd27b('0x16')][_0xd27b('0x18')]);return _0x515087(_0x3ed035[_0xd27b('0x16')][_0xd27b('0x18')]);}logger[_0xd27b('0x16')](_0xd27b('0x19'),_0x47c3bb,_0x3ed035[_0xd27b('0x16')][_0xd27b('0x18')]);return _0x48a9a9(_0x3ed035[_0xd27b('0x16')][_0xd27b('0x18')]);}else{logger[_0xd27b('0x11')]('SmsAccount,\x20%s,\x20%s',_0x47c3bb,_0xd27b('0x12'));_0x48a9a9(_0x3ed035[_0xd27b('0x1a')][_0xd27b('0x18')]);}})[_0xd27b('0x1b')](function(_0x3bf918){logger[_0xd27b('0x16')]('SmsAccount,\x20%s,\x20%s',_0x47c3bb,_0x3bf918);_0x515087(_0x3bf918);});});}exports[_0xd27b('0x1c')]=function(_0x4b2656){var _0x33dac2=this;return new Promise(function(_0x1755d7,_0x5953b4){return db[_0xd27b('0x1d')][_0xd27b('0x1e')]({'raw':_0x4b2656[_0xd27b('0x1f')]?_0x4b2656[_0xd27b('0x1f')][_0xd27b('0x20')]===undefined?!![]:![]:!![],'where':_0x4b2656[_0xd27b('0x1f')]?_0x4b2656[_0xd27b('0x1f')][_0xd27b('0x21')]||null:null,'attributes':_0x4b2656['options']?_0x4b2656[_0xd27b('0x1f')]['attributes']||null:null,'include':_0x4b2656[_0xd27b('0x1f')]?_0x4b2656[_0xd27b('0x1f')]['include']?_['map'](_0x4b2656[_0xd27b('0x1f')][_0xd27b('0x22')],function(_0x3d77dd){return{'model':db[_0x3d77dd['model']],'as':_0x3d77dd['as'],'attributes':_0x3d77dd['attributes'],'include':_0x3d77dd[_0xd27b('0x22')]?_[_0xd27b('0x23')](_0x3d77dd[_0xd27b('0x22')],function(_0x2d05b6){return{'model':db[_0x2d05b6[_0xd27b('0x24')]],'as':_0x2d05b6['as'],'attributes':_0x2d05b6[_0xd27b('0x25')],'include':_0x2d05b6['include']?_[_0xd27b('0x23')](_0x2d05b6['include'],function(_0x425b82){return{'model':db[_0x425b82['model']],'as':_0x425b82['as'],'attributes':_0x425b82['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bfdc7){logger['info'](_0xd27b('0x1c'),_0x4b2656);logger[_0xd27b('0x13')]('ShowSmsAccount',_0x4b2656,JSON['stringify'](_0x2bfdc7));_0x1755d7(_0x2bfdc7);})[_0xd27b('0x1b')](function(_0x58025b){logger[_0xd27b('0x16')]('ShowSmsAccount',_0x58025b[_0xd27b('0x18')],_0x4b2656);_0x5953b4(_0x33dac2[_0xd27b('0x16')](0x1f4,_0x58025b[_0xd27b('0x18')]));});});}; \ No newline at end of file +var _0x4fd1=['where','attributes','map','include','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options'];(function(_0x298de3,_0x43e88d){var _0x2bcf0a=function(_0x4ac970){while(--_0x4ac970){_0x298de3['push'](_0x298de3['shift']());}};_0x2bcf0a(++_0x43e88d);}(_0x4fd1,0x108));var _0x14fd=function(_0x46ec28,_0x311121){_0x46ec28=_0x46ec28-0x0;var _0x2501b8=_0x4fd1[_0x46ec28];return _0x2501b8;};'use strict';var _=require('lodash');var util=require(_0x14fd('0x0'));var moment=require(_0x14fd('0x1'));var BPromise=require(_0x14fd('0x2'));var rs=require(_0x14fd('0x3'));var fs=require('fs');var Redis=require(_0x14fd('0x4'));var db=require(_0x14fd('0x5'))['db'];var utils=require(_0x14fd('0x6'));var logger=require(_0x14fd('0x7'))(_0x14fd('0x8'));var config=require(_0x14fd('0x9'));var jayson=require(_0x14fd('0xa'));var client=jayson[_0x14fd('0xb')][_0x14fd('0xc')]({'port':0x232a});config[_0x14fd('0xd')]=_[_0x14fd('0xe')](config[_0x14fd('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x14fd('0xd')]));require('./smsAccount.socket')[_0x14fd('0xf')](socket);function respondWithRpcPromise(_0x1f065a,_0x8546b4,_0x291854){return new BPromise(function(_0x43d1dc,_0x4a7a04){return client[_0x14fd('0x10')](_0x1f065a,_0x291854)[_0x14fd('0x11')](function(_0x5339f4){logger[_0x14fd('0x12')](_0x14fd('0x13'),_0x8546b4,_0x14fd('0x14'));logger[_0x14fd('0x15')](_0x14fd('0x16'),_0x8546b4,_0x14fd('0x14'),JSON['stringify'](_0x5339f4));if(_0x5339f4[_0x14fd('0x17')]){if(_0x5339f4['error'][_0x14fd('0x18')]===0x1f4){logger[_0x14fd('0x17')](_0x14fd('0x13'),_0x8546b4,_0x5339f4[_0x14fd('0x17')][_0x14fd('0x19')]);return _0x4a7a04(_0x5339f4[_0x14fd('0x17')]['message']);}logger['error'](_0x14fd('0x13'),_0x8546b4,_0x5339f4[_0x14fd('0x17')][_0x14fd('0x19')]);return _0x43d1dc(_0x5339f4['error'][_0x14fd('0x19')]);}else{logger[_0x14fd('0x12')](_0x14fd('0x13'),_0x8546b4,_0x14fd('0x14'));_0x43d1dc(_0x5339f4[_0x14fd('0x1a')][_0x14fd('0x19')]);}})[_0x14fd('0x1b')](function(_0x272a14){logger[_0x14fd('0x17')](_0x14fd('0x13'),_0x8546b4,_0x272a14);_0x4a7a04(_0x272a14);});});}exports[_0x14fd('0x1c')]=function(_0xa25923){var _0x66ed62=this;return new Promise(function(_0x1ff7a5,_0x2c6718){return db[_0x14fd('0x1d')][_0x14fd('0x1e')]({'raw':_0xa25923[_0x14fd('0x1f')]?_0xa25923[_0x14fd('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xa25923[_0x14fd('0x1f')]?_0xa25923['options'][_0x14fd('0x20')]||null:null,'attributes':_0xa25923['options']?_0xa25923['options'][_0x14fd('0x21')]||null:null,'include':_0xa25923[_0x14fd('0x1f')]?_0xa25923[_0x14fd('0x1f')]['include']?_[_0x14fd('0x22')](_0xa25923[_0x14fd('0x1f')][_0x14fd('0x23')],function(_0x2ce03a){return{'model':db[_0x2ce03a['model']],'as':_0x2ce03a['as'],'attributes':_0x2ce03a[_0x14fd('0x21')],'include':_0x2ce03a[_0x14fd('0x23')]?_[_0x14fd('0x22')](_0x2ce03a['include'],function(_0x843a3a){return{'model':db[_0x843a3a[_0x14fd('0x24')]],'as':_0x843a3a['as'],'attributes':_0x843a3a[_0x14fd('0x21')],'include':_0x843a3a['include']?_[_0x14fd('0x22')](_0x843a3a[_0x14fd('0x23')],function(_0x54f6c3){return{'model':db[_0x54f6c3[_0x14fd('0x24')]],'as':_0x54f6c3['as'],'attributes':_0x54f6c3['attributes']};}):[]};}):[]};}):[]:[]})[_0x14fd('0x11')](function(_0x6c02f4){logger[_0x14fd('0x12')](_0x14fd('0x1c'),_0xa25923);logger[_0x14fd('0x15')](_0x14fd('0x1c'),_0xa25923,JSON['stringify'](_0x6c02f4));_0x1ff7a5(_0x6c02f4);})[_0x14fd('0x1b')](function(_0x541080){logger[_0x14fd('0x17')](_0x14fd('0x1c'),_0x541080[_0x14fd('0x19')],_0xa25923);_0x2c6718(_0x66ed62[_0x14fd('0x17')](0x1f4,_0x541080[_0x14fd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 3a4954b..79dff94 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 d4bbc86..ff6e269 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x2ed06c,_0xa53b83){var _0x1598b3=function(_0x2817a0){while(--_0x2817a0){_0x2ed06c['push'](_0x2ed06c['shift']());}};_0x1598b3(++_0xa53b83);}(_0x55ca,0x126));var _0xa55c=function(_0x5528c3,_0x35a416){_0x5528c3=_0x5528c3-0x0;var _0x47ec1b=_0x55ca[_0x5528c3];return _0x47ec1b;};'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')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x171d6b,_0x348bec){var _0x2772a7=function(_0x436e90){while(--_0x436e90){_0x171d6b['push'](_0x171d6b['shift']());}};_0x2772a7(++_0x348bec);}(_0x008c,0x188));var _0xc008=function(_0xf7c93e,_0x586f4b){_0xf7c93e=_0xf7c93e-0x0;var _0x2e3b2a=_0x008c[_0xf7c93e];return _0x2e3b2a;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 50c40bc..cef10ba 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 _0xc742=['exports','noop','TEXT','STRING','sequelize'];(function(_0x578982,_0x5b32ba){var _0x46b40a=function(_0xfc6ad9){while(--_0xfc6ad9){_0x578982['push'](_0x578982['shift']());}};_0x46b40a(++_0x5b32ba);}(_0xc742,0x86));var _0x2c74=function(_0x239056,_0x26c26){_0x239056=_0x239056-0x0;var _0x13ae6c=_0xc742[_0x239056];return _0x13ae6c;};'use strict';var Sequelize=require(_0x2c74('0x0'));module[_0x2c74('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2c74('0x2')},'appdata':{'type':Sequelize[_0x2c74('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2c74('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x925a=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x925a,0x109));var _0xa925=function(_0x24939a,_0x3026bc){_0x24939a=_0x24939a-0x0;var _0x5027a1=_0x925a[_0x24939a];return _0x5027a1;};'use strict';var Sequelize=require(_0xa925('0x0'));module[_0xa925('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa925('0x2')],'allowNull':![],'defaultValue':_0xa925('0x3')},'appdata':{'type':Sequelize[_0xa925('0x4')]()},'description':{'type':Sequelize[_0xa925('0x2')]},'interval':{'type':Sequelize[_0xa925('0x2')],'defaultValue':_0xa925('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index f307d84..d8f0a86 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 _0xcb43=['zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','SmsApplication','find','create','body','eml-format'];(function(_0x1865a3,_0x3d1624){var _0x3c6a68=function(_0x441d53){while(--_0x441d53){_0x1865a3['push'](_0x1865a3['shift']());}};_0x3c6a68(++_0x3d1624);}(_0xcb43,0x8d));var _0x3cb4=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0xcb43[_0x41d02a];return _0x4c3983;};'use strict';var emlformat=require(_0x3cb4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3cb4('0x1'));var jsonpatch=require(_0x3cb4('0x2'));var rp=require('request-promise');var moment=require(_0x3cb4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3cb4('0x4'));var util=require(_0x3cb4('0x5'));var path=require('path');var sox=require(_0x3cb4('0x6'));var csv=require(_0x3cb4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3cb4('0x8'));var squel=require(_0x3cb4('0x9'));var crypto=require('crypto');var jsforce=require(_0x3cb4('0xa'));var deskjs=require(_0x3cb4('0xb'));var toCsv=require(_0x3cb4('0x7'));var querystring=require(_0x3cb4('0xc'));var Papa=require(_0x3cb4('0xd'));var Redis=require(_0x3cb4('0xe'));var authService=require(_0x3cb4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3cb4('0x10'));var hardwareService=require(_0x3cb4('0x11'));var logger=require(_0x3cb4('0x12'))(_0x3cb4('0x13'));var utils=require(_0x3cb4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3cb4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e04e0,_0x4187c8){_0x4187c8=_0x4187c8||0xcc;return function(_0x1dd0cc){if(_0x1dd0cc){return _0x5e04e0[_0x3cb4('0x16')](_0x4187c8);}return _0x5e04e0[_0x3cb4('0x17')](_0x4187c8)['end']();};}function respondWithResult(_0x428bd3,_0x45d6f5){_0x45d6f5=_0x45d6f5||0xc8;return function(_0x13300b){if(_0x13300b){return _0x428bd3['status'](_0x45d6f5)[_0x3cb4('0x18')](_0x13300b);}};}function respondWithFilteredResult(_0x5d9983,_0x13b328){return function(_0x3bc4c3){if(_0x3bc4c3){var _0x5656e5=typeof _0x13b328['offset']===_0x3cb4('0x19')&&typeof _0x13b328[_0x3cb4('0x1a')]==='undefined';var _0x3570d6=_0x3bc4c3['count'];var _0x5ba392=_0x5656e5?0x0:_0x13b328['offset'];var _0x4fe28e=_0x5656e5?_0x3bc4c3[_0x3cb4('0x1b')]:_0x13b328[_0x3cb4('0x1c')]+_0x13b328[_0x3cb4('0x1a')];var _0x5915f1;if(_0x4fe28e>=_0x3570d6){_0x4fe28e=_0x3570d6;_0x5915f1=0xc8;}else{_0x5915f1=0xce;}_0x5d9983[_0x3cb4('0x17')](_0x5915f1);return _0x5d9983[_0x3cb4('0x1d')](_0x3cb4('0x1e'),_0x5ba392+'-'+_0x4fe28e+'/'+_0x3570d6)[_0x3cb4('0x18')](_0x3bc4c3);}return null;};}function patchUpdates(_0x2b2ca2){return function(_0x283227){try{jsonpatch[_0x3cb4('0x1f')](_0x283227,_0x2b2ca2,!![]);}catch(_0x10687d){return BPromise[_0x3cb4('0x20')](_0x10687d);}return _0x283227[_0x3cb4('0x21')]();};}function saveUpdates(_0x593615,_0x2fb558){return function(_0x3c2b2c){if(_0x3c2b2c){return _0x3c2b2c[_0x3cb4('0x22')](_0x593615)[_0x3cb4('0x23')](function(_0x2ed200){return _0x2ed200;});}return null;};}function removeEntity(_0x4156ee,_0x20b471){return function(_0x68c231){if(_0x68c231){return _0x68c231[_0x3cb4('0x24')]()[_0x3cb4('0x23')](function(){_0x4156ee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4411ea,_0x172d6d){return function(_0x5a6845){if(!_0x5a6845){_0x4411ea[_0x3cb4('0x16')](0x194);}return _0x5a6845;};}function handleError(_0x3dafec,_0x41039e){_0x41039e=_0x41039e||0x1f4;return function(_0x289116){logger[_0x3cb4('0x25')](_0x289116[_0x3cb4('0x26')]);if(_0x289116['name']){delete _0x289116[_0x3cb4('0x27')];}_0x3dafec[_0x3cb4('0x17')](_0x41039e)[_0x3cb4('0x28')](_0x289116);};}exports['index']=function(_0x398a48,_0x38edb8){var _0x5eb9e6={},_0x17bee8={},_0x320606={'count':0x0,'rows':[]};var _0x36dc4b=_['map'](db['SmsApplication']['rawAttributes'],function(_0x1eb6ee){return{'name':_0x1eb6ee[_0x3cb4('0x29')],'type':_0x1eb6ee[_0x3cb4('0x2a')]['key']};});_0x17bee8[_0x3cb4('0x2b')]=_['map'](_0x36dc4b,'name');_0x17bee8[_0x3cb4('0x2c')]=_[_0x3cb4('0x2d')](_0x398a48[_0x3cb4('0x2c')]);_0x17bee8[_0x3cb4('0x2e')]=_[_0x3cb4('0x2f')](_0x17bee8['model'],_0x17bee8[_0x3cb4('0x2c')]);_0x5eb9e6['attributes']=_['intersection'](_0x17bee8[_0x3cb4('0x2b')],qs[_0x3cb4('0x30')](_0x398a48[_0x3cb4('0x2c')][_0x3cb4('0x30')]));_0x5eb9e6[_0x3cb4('0x31')]=_0x5eb9e6[_0x3cb4('0x31')][_0x3cb4('0x32')]?_0x5eb9e6[_0x3cb4('0x31')]:_0x17bee8[_0x3cb4('0x2b')];if(!_0x398a48['query'][_0x3cb4('0x33')]('nolimit')){_0x5eb9e6['limit']=qs['limit'](_0x398a48[_0x3cb4('0x2c')]['limit']);_0x5eb9e6[_0x3cb4('0x1c')]=qs['offset'](_0x398a48[_0x3cb4('0x2c')]['offset']);}_0x5eb9e6['order']=qs[_0x3cb4('0x34')](_0x398a48[_0x3cb4('0x2c')][_0x3cb4('0x34')]);_0x5eb9e6[_0x3cb4('0x35')]=qs[_0x3cb4('0x2e')](_[_0x3cb4('0x36')](_0x398a48[_0x3cb4('0x2c')],_0x17bee8[_0x3cb4('0x2e')]),_0x36dc4b);if(_0x398a48[_0x3cb4('0x2c')][_0x3cb4('0x37')]){_0x5eb9e6[_0x3cb4('0x35')]=_['merge'](_0x5eb9e6['where'],{'$or':_[_0x3cb4('0x38')](_0x36dc4b,function(_0x3897b3){if(_0x3897b3['type']!==_0x3cb4('0x39')){var _0x4553fd={};_0x4553fd[_0x3897b3[_0x3cb4('0x27')]]={'$like':'%'+_0x398a48[_0x3cb4('0x2c')][_0x3cb4('0x37')]+'%'};return _0x4553fd;}})});}_0x5eb9e6=_[_0x3cb4('0x3a')]({},_0x5eb9e6,_0x398a48[_0x3cb4('0x3b')]);var _0x1299f4={'where':_0x5eb9e6[_0x3cb4('0x35')]};return db['SmsApplication'][_0x3cb4('0x1b')](_0x1299f4)[_0x3cb4('0x23')](function(_0x52aa0c){_0x320606[_0x3cb4('0x1b')]=_0x52aa0c;if(_0x398a48['query'][_0x3cb4('0x3c')]){_0x5eb9e6[_0x3cb4('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0x3cb4('0x3e')](_0x5eb9e6);})[_0x3cb4('0x23')](function(_0x9de2ec){_0x320606[_0x3cb4('0x3f')]=_0x9de2ec;return _0x320606;})[_0x3cb4('0x23')](respondWithFilteredResult(_0x38edb8,_0x5eb9e6))[_0x3cb4('0x40')](handleError(_0x38edb8,null));};exports[_0x3cb4('0x41')]=function(_0x935a7d,_0x1e2330){var _0x570b87={'raw':!![],'where':{'id':_0x935a7d[_0x3cb4('0x42')]['id']}},_0x5c6ab8={};_0x5c6ab8[_0x3cb4('0x2b')]=_[_0x3cb4('0x2d')](db[_0x3cb4('0x43')]['rawAttributes']);_0x5c6ab8['query']=_[_0x3cb4('0x2d')](_0x935a7d['query']);_0x5c6ab8[_0x3cb4('0x2e')]=_[_0x3cb4('0x2f')](_0x5c6ab8[_0x3cb4('0x2b')],_0x5c6ab8[_0x3cb4('0x2c')]);_0x570b87[_0x3cb4('0x31')]=_[_0x3cb4('0x2f')](_0x5c6ab8[_0x3cb4('0x2b')],qs['fields'](_0x935a7d[_0x3cb4('0x2c')][_0x3cb4('0x30')]));_0x570b87['attributes']=_0x570b87[_0x3cb4('0x31')][_0x3cb4('0x32')]?_0x570b87[_0x3cb4('0x31')]:_0x5c6ab8[_0x3cb4('0x2b')];if(_0x935a7d[_0x3cb4('0x2c')]['includeAll']){_0x570b87[_0x3cb4('0x3d')]=[{'all':!![]}];}_0x570b87=_[_0x3cb4('0x3a')]({},_0x570b87,_0x935a7d[_0x3cb4('0x3b')]);return db[_0x3cb4('0x43')][_0x3cb4('0x44')](_0x570b87)['then'](handleEntityNotFound(_0x1e2330,null))[_0x3cb4('0x23')](respondWithResult(_0x1e2330,null))[_0x3cb4('0x40')](handleError(_0x1e2330,null));};exports[_0x3cb4('0x45')]=function(_0x5b48fc,_0x524466){return db[_0x3cb4('0x43')]['create'](_0x5b48fc[_0x3cb4('0x46')],{})['then'](respondWithResult(_0x524466,0xc9))[_0x3cb4('0x40')](handleError(_0x524466,null));};exports[_0x3cb4('0x22')]=function(_0x28e2a8,_0x53ccd6){if(_0x28e2a8[_0x3cb4('0x46')]['id']){delete _0x28e2a8[_0x3cb4('0x46')]['id'];}return db[_0x3cb4('0x43')]['find']({'where':{'id':_0x28e2a8['params']['id']}})[_0x3cb4('0x23')](handleEntityNotFound(_0x53ccd6,null))[_0x3cb4('0x23')](saveUpdates(_0x28e2a8[_0x3cb4('0x46')],null))[_0x3cb4('0x23')](respondWithResult(_0x53ccd6,null))['catch'](handleError(_0x53ccd6,null));};exports[_0x3cb4('0x24')]=function(_0x5af3ac,_0x12d4b1){return db[_0x3cb4('0x43')]['find']({'where':{'id':_0x5af3ac[_0x3cb4('0x42')]['id']}})[_0x3cb4('0x23')](handleEntityNotFound(_0x12d4b1,null))['then'](removeEntity(_0x12d4b1,null))[_0x3cb4('0x40')](handleError(_0x12d4b1,null));}; \ No newline at end of file +var _0x5353=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','merge','create','body','find','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','reject','update','destroy','then','error','stack','name','send','index','map','SmsApplication','fieldName','type','key','model','query','filters','intersection'];(function(_0x4d4b24,_0xcbda8b){var _0x5e2592=function(_0x55e9bb){while(--_0x55e9bb){_0x4d4b24['push'](_0x4d4b24['shift']());}};_0x5e2592(++_0xcbda8b);}(_0x5353,0x1d5));var _0x3535=function(_0x566993,_0x25bf19){_0x566993=_0x566993-0x0;var _0x189cda=_0x5353[_0x566993];return _0x189cda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3535('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3535('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3535('0x2'));var Mustache=require(_0x3535('0x3'));var util=require(_0x3535('0x4'));var path=require('path');var sox=require(_0x3535('0x5'));var csv=require(_0x3535('0x6'));var ejs=require(_0x3535('0x7'));var fs=require('fs');var fs_extra=require(_0x3535('0x8'));var _=require(_0x3535('0x9'));var squel=require('squel');var crypto=require(_0x3535('0xa'));var jsforce=require(_0x3535('0xb'));var deskjs=require(_0x3535('0xc'));var toCsv=require(_0x3535('0x6'));var querystring=require(_0x3535('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3535('0xe'));var as=require(_0x3535('0xf'));var hardwareService=require(_0x3535('0x10'));var logger=require(_0x3535('0x11'))(_0x3535('0x12'));var utils=require(_0x3535('0x13'));var config=require(_0x3535('0x14'));var licenseUtil=require(_0x3535('0x15'));var db=require(_0x3535('0x16'))['db'];function respondWithStatusCode(_0x19ca8e,_0x360e47){_0x360e47=_0x360e47||0xcc;return function(_0x107bad){if(_0x107bad){return _0x19ca8e[_0x3535('0x17')](_0x360e47);}return _0x19ca8e[_0x3535('0x18')](_0x360e47)[_0x3535('0x19')]();};}function respondWithResult(_0x44022c,_0x570a26){_0x570a26=_0x570a26||0xc8;return function(_0x1c6f1f){if(_0x1c6f1f){return _0x44022c[_0x3535('0x18')](_0x570a26)[_0x3535('0x1a')](_0x1c6f1f);}};}function respondWithFilteredResult(_0x6b16cc,_0x95ecdc){return function(_0x125dcb){if(_0x125dcb){var _0x301822=typeof _0x95ecdc['offset']===_0x3535('0x1b')&&typeof _0x95ecdc[_0x3535('0x1c')]==='undefined';var _0x4f6eef=_0x125dcb['count'];var _0x22846e=_0x301822?0x0:_0x95ecdc[_0x3535('0x1d')];var _0x2fb38d=_0x301822?_0x125dcb[_0x3535('0x1e')]:_0x95ecdc['offset']+_0x95ecdc[_0x3535('0x1c')];var _0x161415;if(_0x2fb38d>=_0x4f6eef){_0x2fb38d=_0x4f6eef;_0x161415=0xc8;}else{_0x161415=0xce;}_0x6b16cc['status'](_0x161415);return _0x6b16cc['set']('Content-Range',_0x22846e+'-'+_0x2fb38d+'/'+_0x4f6eef)[_0x3535('0x1a')](_0x125dcb);}return null;};}function patchUpdates(_0x1e8874){return function(_0x33c226){try{jsonpatch['apply'](_0x33c226,_0x1e8874,!![]);}catch(_0x5ad3fc){return BPromise[_0x3535('0x1f')](_0x5ad3fc);}return _0x33c226['save']();};}function saveUpdates(_0x5f0f52,_0x87bdee){return function(_0x257302){if(_0x257302){return _0x257302[_0x3535('0x20')](_0x5f0f52)['then'](function(_0x54180d){return _0x54180d;});}return null;};}function removeEntity(_0x437a08,_0x570d0d){return function(_0xadaff0){if(_0xadaff0){return _0xadaff0[_0x3535('0x21')]()[_0x3535('0x22')](function(){_0x437a08[_0x3535('0x18')](0xcc)[_0x3535('0x19')]();});}};}function handleEntityNotFound(_0x2aa139,_0x160013){return function(_0x50123b){if(!_0x50123b){_0x2aa139[_0x3535('0x17')](0x194);}return _0x50123b;};}function handleError(_0x3f4801,_0x18b142){_0x18b142=_0x18b142||0x1f4;return function(_0x1d3f3f){logger[_0x3535('0x23')](_0x1d3f3f[_0x3535('0x24')]);if(_0x1d3f3f[_0x3535('0x25')]){delete _0x1d3f3f[_0x3535('0x25')];}_0x3f4801['status'](_0x18b142)[_0x3535('0x26')](_0x1d3f3f);};}exports[_0x3535('0x27')]=function(_0x15c83f,_0x10a53f){var _0x1f02fe={},_0x5295e7={},_0x270933={'count':0x0,'rows':[]};var _0x4b92f8=_[_0x3535('0x28')](db[_0x3535('0x29')]['rawAttributes'],function(_0xd926dc){return{'name':_0xd926dc[_0x3535('0x2a')],'type':_0xd926dc[_0x3535('0x2b')][_0x3535('0x2c')]};});_0x5295e7[_0x3535('0x2d')]=_[_0x3535('0x28')](_0x4b92f8,_0x3535('0x25'));_0x5295e7['query']=_['keys'](_0x15c83f[_0x3535('0x2e')]);_0x5295e7[_0x3535('0x2f')]=_[_0x3535('0x30')](_0x5295e7[_0x3535('0x2d')],_0x5295e7[_0x3535('0x2e')]);_0x1f02fe[_0x3535('0x31')]=_['intersection'](_0x5295e7[_0x3535('0x2d')],qs['fields'](_0x15c83f[_0x3535('0x2e')][_0x3535('0x32')]));_0x1f02fe[_0x3535('0x31')]=_0x1f02fe['attributes'][_0x3535('0x33')]?_0x1f02fe[_0x3535('0x31')]:_0x5295e7[_0x3535('0x2d')];if(!_0x15c83f[_0x3535('0x2e')][_0x3535('0x34')](_0x3535('0x35'))){_0x1f02fe['limit']=qs[_0x3535('0x1c')](_0x15c83f[_0x3535('0x2e')][_0x3535('0x1c')]);_0x1f02fe[_0x3535('0x1d')]=qs['offset'](_0x15c83f[_0x3535('0x2e')][_0x3535('0x1d')]);}_0x1f02fe[_0x3535('0x36')]=qs[_0x3535('0x37')](_0x15c83f[_0x3535('0x2e')][_0x3535('0x37')]);_0x1f02fe[_0x3535('0x38')]=qs[_0x3535('0x2f')](_[_0x3535('0x39')](_0x15c83f[_0x3535('0x2e')],_0x5295e7[_0x3535('0x2f')]),_0x4b92f8);if(_0x15c83f['query'][_0x3535('0x3a')]){_0x1f02fe[_0x3535('0x38')]=_['merge'](_0x1f02fe[_0x3535('0x38')],{'$or':_[_0x3535('0x28')](_0x4b92f8,function(_0xac2463){if(_0xac2463[_0x3535('0x2b')]!==_0x3535('0x3b')){var _0x1b5449={};_0x1b5449[_0xac2463['name']]={'$like':'%'+_0x15c83f[_0x3535('0x2e')][_0x3535('0x3a')]+'%'};return _0x1b5449;}})});}_0x1f02fe=_['merge']({},_0x1f02fe,_0x15c83f[_0x3535('0x3c')]);var _0x5c9fc8={'where':_0x1f02fe[_0x3535('0x38')]};return db[_0x3535('0x29')][_0x3535('0x1e')](_0x5c9fc8)['then'](function(_0xb100c0){_0x270933[_0x3535('0x1e')]=_0xb100c0;if(_0x15c83f[_0x3535('0x2e')][_0x3535('0x3d')]){_0x1f02fe[_0x3535('0x3e')]=[{'all':!![]}];}return db[_0x3535('0x29')][_0x3535('0x3f')](_0x1f02fe);})['then'](function(_0x3579b4){_0x270933[_0x3535('0x40')]=_0x3579b4;return _0x270933;})[_0x3535('0x22')](respondWithFilteredResult(_0x10a53f,_0x1f02fe))[_0x3535('0x41')](handleError(_0x10a53f,null));};exports[_0x3535('0x42')]=function(_0x2c0406,_0x439c09){var _0x5217ab={'raw':!![],'where':{'id':_0x2c0406[_0x3535('0x43')]['id']}},_0x4f6ded={};_0x4f6ded[_0x3535('0x2d')]=_['keys'](db['SmsApplication'][_0x3535('0x44')]);_0x4f6ded[_0x3535('0x2e')]=_[_0x3535('0x45')](_0x2c0406[_0x3535('0x2e')]);_0x4f6ded[_0x3535('0x2f')]=_['intersection'](_0x4f6ded['model'],_0x4f6ded[_0x3535('0x2e')]);_0x5217ab[_0x3535('0x31')]=_[_0x3535('0x30')](_0x4f6ded[_0x3535('0x2d')],qs['fields'](_0x2c0406[_0x3535('0x2e')][_0x3535('0x32')]));_0x5217ab[_0x3535('0x31')]=_0x5217ab[_0x3535('0x31')][_0x3535('0x33')]?_0x5217ab['attributes']:_0x4f6ded[_0x3535('0x2d')];if(_0x2c0406['query'][_0x3535('0x3d')]){_0x5217ab[_0x3535('0x3e')]=[{'all':!![]}];}_0x5217ab=_[_0x3535('0x46')]({},_0x5217ab,_0x2c0406[_0x3535('0x3c')]);return db['SmsApplication']['find'](_0x5217ab)[_0x3535('0x22')](handleEntityNotFound(_0x439c09,null))[_0x3535('0x22')](respondWithResult(_0x439c09,null))[_0x3535('0x41')](handleError(_0x439c09,null));};exports['create']=function(_0x395598,_0x4c5e8b){return db[_0x3535('0x29')][_0x3535('0x47')](_0x395598[_0x3535('0x48')],{})[_0x3535('0x22')](respondWithResult(_0x4c5e8b,0xc9))['catch'](handleError(_0x4c5e8b,null));};exports[_0x3535('0x20')]=function(_0x1dbb62,_0x28ab99){if(_0x1dbb62[_0x3535('0x48')]['id']){delete _0x1dbb62['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x1dbb62[_0x3535('0x43')]['id']}})[_0x3535('0x22')](handleEntityNotFound(_0x28ab99,null))['then'](saveUpdates(_0x1dbb62[_0x3535('0x48')],null))[_0x3535('0x22')](respondWithResult(_0x28ab99,null))[_0x3535('0x41')](handleError(_0x28ab99,null));};exports[_0x3535('0x21')]=function(_0xf74e26,_0x19c2ed){return db[_0x3535('0x29')][_0x3535('0x49')]({'where':{'id':_0xf74e26['params']['id']}})[_0x3535('0x22')](handleEntityNotFound(_0x19c2ed,null))[_0x3535('0x22')](removeEntity(_0x19c2ed,null))[_0x3535('0x41')](handleError(_0x19c2ed,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a308f83..846a0bf 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 _0x6138=['path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x327df9,_0x43de0d){var _0x28fd8d=function(_0x1d8127){while(--_0x1d8127){_0x327df9['push'](_0x327df9['shift']());}};_0x28fd8d(++_0x43de0d);}(_0x6138,0xbe));var _0x8613=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6138[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x8613('0x0'));var logger=require(_0x8613('0x1'))(_0x8613('0x2'));var moment=require(_0x8613('0x3'));var BPromise=require(_0x8613('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8613('0x5'));var rimraf=require(_0x8613('0x6'));var config=require(_0x8613('0x7'));var attributes=require(_0x8613('0x8'));module[_0x8613('0x9')]=function(_0x2b8f55,_0xdfba09){return _0x2b8f55[_0x8613('0xa')](_0x8613('0xb'),attributes,{'tableName':_0x8613('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8613('0xd'),'collate':_0x8613('0xe')});}; \ No newline at end of file +var _0x6688=['SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6688,0x10e));var _0x8668=function(_0x6e38ff,_0x4cdb72){_0x6e38ff=_0x6e38ff-0x0;var _0x134114=_0x6688[_0x6e38ff];return _0x134114;};'use strict';var _=require(_0x8668('0x0'));var util=require(_0x8668('0x1'));var logger=require(_0x8668('0x2'))('api');var moment=require(_0x8668('0x3'));var BPromise=require(_0x8668('0x4'));var rp=require(_0x8668('0x5'));var fs=require('fs');var path=require(_0x8668('0x6'));var rimraf=require(_0x8668('0x7'));var config=require(_0x8668('0x8'));var attributes=require(_0x8668('0x9'));module['exports']=function(_0x2a6329,_0x2e1b7b){return _0x2a6329['define'](_0x8668('0xa'),attributes,{'tableName':_0x8668('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8668('0xc'),'collate':_0x8668('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 1dbe4fb..c6e9fa9 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 _0x2581=['request','then','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','SmsApplication,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x594e65,_0xa04fc3){var _0x54b44f=function(_0x1806d7){while(--_0x1806d7){_0x594e65['push'](_0x594e65['shift']());}};_0x54b44f(++_0xa04fc3);}(_0x2581,0xcb));var _0x1258=function(_0x17950a,_0x4688cc){_0x17950a=_0x17950a-0x0;var _0x33b4e0=_0x2581[_0x17950a];return _0x33b4e0;};'use strict';var _=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var moment=require(_0x1258('0x2'));var BPromise=require(_0x1258('0x3'));var rs=require(_0x1258('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1258('0x5'))['db'];var utils=require(_0x1258('0x6'));var logger=require(_0x1258('0x7'))(_0x1258('0x8'));var config=require(_0x1258('0x9'));var jayson=require(_0x1258('0xa'));var client=jayson[_0x1258('0xb')][_0x1258('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x582ed7,_0x3e1044,_0x21cd98){return new BPromise(function(_0x468494,_0x18bbac){return client[_0x1258('0xd')](_0x582ed7,_0x21cd98)[_0x1258('0xe')](function(_0x429efc){logger['info']('SmsApplication,\x20%s,\x20%s',_0x3e1044,_0x1258('0xf'));logger[_0x1258('0x10')](_0x1258('0x11'),_0x3e1044,_0x1258('0xf'),JSON['stringify'](_0x429efc));if(_0x429efc[_0x1258('0x12')]){if(_0x429efc[_0x1258('0x12')][_0x1258('0x13')]===0x1f4){logger[_0x1258('0x12')]('SmsApplication,\x20%s,\x20%s',_0x3e1044,_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);return _0x18bbac(_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);}logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x429efc[_0x1258('0x12')]['message']);return _0x468494(_0x429efc[_0x1258('0x12')]['message']);}else{logger[_0x1258('0x16')](_0x1258('0x15'),_0x3e1044,_0x1258('0xf'));_0x468494(_0x429efc[_0x1258('0x17')][_0x1258('0x14')]);}})['catch'](function(_0x1645a6){logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x1645a6);_0x18bbac(_0x1645a6);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5d4117,_0x25ecbc){var _0x1456ce=function(_0x547c33){while(--_0x547c33){_0x5d4117['push'](_0x5d4117['shift']());}};_0x1456ce(++_0x25ecbc);}(_0x57ca,0x108));var _0xa57c=function(_0x472f7d,_0x2ee136){_0x472f7d=_0x472f7d-0x0;var _0x39c94a=_0x57ca[_0x472f7d];return _0x39c94a;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('SmsApplication,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('SmsApplication,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 3bce11d..759ac4f 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 _0x9c00=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','destroy','removeTags'];(function(_0x358efd,_0x1937c9){var _0x56c2d9=function(_0x4f088e){while(--_0x4f088e){_0x358efd['push'](_0x358efd['shift']());}};_0x56c2d9(++_0x1937c9);}(_0x9c00,0x1a0));var _0x09c0=function(_0x46a563,_0x586712){_0x46a563=_0x46a563-0x0;var _0x10aa22=_0x9c00[_0x46a563];return _0x10aa22;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0x8')]('/:id',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router[_0x09c0('0x8')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0x8')](_0x09c0('0xf'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x10')]);router[_0x09c0('0x11')]('/',auth[_0x09c0('0xa')](),controller[_0x09c0('0x12')]);router[_0x09c0('0x11')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x13')]);router[_0x09c0('0x11')](_0x09c0('0x14'),auth[_0x09c0('0xa')](),interaction[_0x09c0('0x15')](_0x09c0('0x16'),_0x09c0('0x17')),controller[_0x09c0('0x18')]);router[_0x09c0('0x19')](_0x09c0('0x1a'),auth['isAuthenticated'](),interaction['tracked']('sms',_0x09c0('0x1b')),controller[_0x09c0('0x1c')]);router[_0x09c0('0x1d')](_0x09c0('0x1a'),auth['isAuthenticated'](),interaction[_0x09c0('0x15')]('sms','smsinteraction:destroy'),controller[_0x09c0('0x1e')]);router['delete'](_0x09c0('0x14'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x1f')]);module['exports']=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(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_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 cf33eeb..60a5f94 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 _0x4b19=['DATE','STRING','ENUM','sequelize','exports','BOOLEAN'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4b19,0x195));var _0x94b1=function(_0x535503,_0xc9b0fc){_0x535503=_0x535503-0x0;var _0x4bf177=_0x4b19[_0x535503];return _0x4bf177;};'use strict';var Sequelize=require(_0x94b1('0x0'));var moment=require('moment');module[_0x94b1('0x1')]={'closed':{'type':Sequelize[_0x94b1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x94b1('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x94b1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x94b1('0x4')]},'note':{'type':Sequelize[_0x94b1('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x94b1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x94b1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x94b1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x94b1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x94b1('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xbcc7=['STRING','ENUM','out','DATE','sequelize','moment','BOOLEAN'];(function(_0xfff28b,_0x204443){var _0x13c9f0=function(_0x4d9f58){while(--_0x4d9f58){_0xfff28b['push'](_0xfff28b['shift']());}};_0x13c9f0(++_0x204443);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x204709,_0xf50c4b){_0x204709=_0x204709-0x0;var _0x1be958=_0xbcc7[_0x204709];return _0x1be958;};'use strict';var Sequelize=require(_0x7bcc('0x0'));var moment=require(_0x7bcc('0x1'));module['exports']={'closed':{'type':Sequelize[_0x7bcc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7bcc('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7bcc('0x3')]},'phone':{'type':Sequelize[_0x7bcc('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x7bcc('0x4')]('in',_0x7bcc('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7bcc('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x7bcc('0x4')]('in',_0x7bcc('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7bcc('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index ef0f6bd..2a288d0 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 _0x966d=['views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','then','destroy','error','stack','name','send','map','SmsInteraction','rawAttributes','key','getOptions','findAll','sms','query','user','catch','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','create','update','body','params','describe','addMessage','SmsMessage','find','omit','ids','getMessages','findOne','hasOwnProperty','order','sort','where','SmsInteractionId','$gte','split','format','rows','addTags','spread','Tag','color','removeTags','download','unix','toString','join','server','files','tmp','User','push','CmContact','Contact','firstName','lastName','Messages','createdAt','read','SmsAccount','Account','fullname','get','mkdirSync','Sms','Owner','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','filter','direction','out','System','secret','root'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x966d,0x1e3));var _0xd966=function(_0xc48763,_0x43b8e5){_0xc48763=_0xc48763-0x0;var _0x55c1ac=_0x966d[_0xc48763];return _0x55c1ac;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xd966('0x0'));var moment=require(_0xd966('0x1'));var BPromise=require(_0xd966('0x2'));var util=require(_0xd966('0x3'));var path=require(_0xd966('0x4'));var ejs=require(_0xd966('0x5'));var fs=require('fs');var _=require(_0xd966('0x6'));var Redis=require(_0xd966('0x7'));var interaction=require(_0xd966('0x8'));var qs=require(_0xd966('0x9'));var pdf=require(_0xd966('0xa'));var logger=require(_0xd966('0xb'))(_0xd966('0xc'));var config=require('../../config/environment');var db=require(_0xd966('0xd'))['db'];config[_0xd966('0xe')]=_[_0xd966('0xf')](config[_0xd966('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xd966('0x10'))(new Redis(config[_0xd966('0xe')]));require(_0xd966('0x11'))['register'](socket);function respondWithStatusCode(_0x411332,_0x79c87a){_0x79c87a=_0x79c87a||0xcc;return function(_0x5cc81a){if(_0x5cc81a){return _0x411332[_0xd966('0x12')](_0x79c87a);}return _0x411332['status'](_0x79c87a)[_0xd966('0x13')]();};}function respondWithResult(_0x1ebf12,_0x41f0c8){_0x41f0c8=_0x41f0c8||0xc8;return function(_0x1f59fe){if(_0x1f59fe){return _0x1ebf12[_0xd966('0x14')](_0x41f0c8)[_0xd966('0x15')](_0x1f59fe);}};}function respondWithFilteredResult(_0x27a391,_0x4eab9a){return function(_0x490314){if(_0x490314){var _0x4b05d7=typeof _0x4eab9a['offset']===_0xd966('0x16')&&typeof _0x4eab9a['limit']===_0xd966('0x16');var _0x15e025=_0x490314[_0xd966('0x17')];var _0x462b9c=_0x4b05d7?0x0:_0x4eab9a[_0xd966('0x18')];var _0x40ff08=_0x4b05d7?_0x490314['count']:_0x4eab9a['offset']+_0x4eab9a[_0xd966('0x19')];var _0x66b24e;if(_0x40ff08>=_0x15e025){_0x40ff08=_0x15e025;_0x66b24e=0xc8;}else{_0x66b24e=0xce;}_0x27a391[_0xd966('0x14')](_0x66b24e);return _0x27a391[_0xd966('0x1a')](_0xd966('0x1b'),_0x462b9c+'-'+_0x40ff08+'/'+_0x15e025)[_0xd966('0x15')](_0x490314);}return null;};}function saveUpdates(_0x327bb3){return function(_0x3b96c3){if(_0x3b96c3){return _0x3b96c3['update'](_0x327bb3)[_0xd966('0x1c')](function(_0x5e6362){return _0x5e6362;});}return null;};}function removeEntity(_0x1d04bd){return function(_0x16dc3e){if(_0x16dc3e){return _0x16dc3e[_0xd966('0x1d')]()[_0xd966('0x1c')](function(){_0x1d04bd['status'](0xcc)[_0xd966('0x13')]();});}};}function handleEntityNotFound(_0x28f1cf){return function(_0x2d64a3){if(!_0x2d64a3){_0x28f1cf[_0xd966('0x12')](0x194);}return _0x2d64a3;};}function handleError(_0x451386,_0x516a1b){_0x516a1b=_0x516a1b||0x1f4;return function(_0xcdef4a){logger[_0xd966('0x1e')](_0xcdef4a[_0xd966('0x1f')]);if(_0xcdef4a[_0xd966('0x20')]){delete _0xcdef4a['name'];}_0x451386['status'](_0x516a1b)[_0xd966('0x21')](_0xcdef4a);};}exports['index']=function(_0x5e0664,_0xe40e0e){var _0x548756={};var _0xc8f0ee=_[_0xd966('0x22')](db[_0xd966('0x23')][_0xd966('0x24')],function(_0x4ffcf3){return{'name':_0x4ffcf3['fieldName'],'type':_0x4ffcf3['type'][_0xd966('0x25')]};});_0x548756=qs[_0xd966('0x26')](_0xc8f0ee,_0x5e0664);return interaction[_0xd966('0x27')](_0xd966('0x28'),_0x5e0664[_0xd966('0x29')],_0x5e0664[_0xd966('0x2a')],_0x548756,_0xc8f0ee)[_0xd966('0x1c')](respondWithFilteredResult(_0xe40e0e,_0x548756))[_0xd966('0x2b')](handleError(_0xe40e0e,null));};exports['show']=function(_0x266b95,_0x3044ec){var _0xd32416={'raw':![],'where':{'id':_0x266b95['params']['id']}},_0x343786={};_0x343786[_0xd966('0x2c')]=_[_0xd966('0x2d')](db[_0xd966('0x23')][_0xd966('0x24')]);_0x343786[_0xd966('0x29')]=_['keys'](_0x266b95[_0xd966('0x29')]);_0x343786[_0xd966('0x2e')]=_[_0xd966('0x2f')](_0x343786[_0xd966('0x2c')],_0x343786[_0xd966('0x29')]);_0xd32416[_0xd966('0x30')]=_[_0xd966('0x2f')](_0x343786[_0xd966('0x2c')],qs[_0xd966('0x31')](_0x266b95[_0xd966('0x29')][_0xd966('0x31')]));_0xd32416[_0xd966('0x30')]=_0xd32416[_0xd966('0x30')]['length']?_0xd32416[_0xd966('0x30')]:_0x343786[_0xd966('0x2c')];if(_0x266b95[_0xd966('0x29')][_0xd966('0x32')]){_0xd32416[_0xd966('0x33')]=[{'all':!![]}];}_0xd32416=_[_0xd966('0x34')]({},_0xd32416,_0x266b95[_0xd966('0x35')]);return db['SmsInteraction']['find'](_0xd32416)[_0xd966('0x1c')](handleEntityNotFound(_0x3044ec,null))[_0xd966('0x1c')](respondWithResult(_0x3044ec,null))['catch'](handleError(_0x3044ec,null));};exports[_0xd966('0x36')]=function(_0x225eb8,_0xe66933){return db[_0xd966('0x23')][_0xd966('0x36')](_0x225eb8['body'],{})['then'](respondWithResult(_0xe66933,0xc9))['catch'](handleError(_0xe66933,null));};exports[_0xd966('0x37')]=function(_0x2131b6,_0x12bf65){if(_0x2131b6[_0xd966('0x38')]['id']){delete _0x2131b6[_0xd966('0x38')]['id'];}return db[_0xd966('0x23')]['find']({'where':{'id':_0x2131b6[_0xd966('0x39')]['id']}})['then'](handleEntityNotFound(_0x12bf65,null))['then'](saveUpdates(_0x2131b6[_0xd966('0x38')],null))[_0xd966('0x1c')](respondWithResult(_0x12bf65,null))[_0xd966('0x2b')](handleError(_0x12bf65,null));};exports['destroy']=function(_0x55cfdb,_0x83745e){return db[_0xd966('0x23')]['find']({'where':{'id':_0x55cfdb[_0xd966('0x39')]['id']}})[_0xd966('0x1c')](handleEntityNotFound(_0x83745e,null))[_0xd966('0x1c')](removeEntity(_0x83745e,null))[_0xd966('0x2b')](handleError(_0x83745e,null));};exports[_0xd966('0x3a')]=function(_0x79d03a,_0x522a99){return db['SmsInteraction']['describe']()[_0xd966('0x1c')](respondWithResult(_0x522a99,null))[_0xd966('0x2b')](handleError(_0x522a99,null));};exports[_0xd966('0x3b')]=function(_0xc06bd1,_0x39c4b2){return db[_0xd966('0x3c')][_0xd966('0x3d')]({'where':{'id':_0xc06bd1[_0xd966('0x39')]['id']}})[_0xd966('0x1c')](handleEntityNotFound(_0x39c4b2,null))[_0xd966('0x1c')](function(_0x364ed3){if(_0x364ed3){return _0x364ed3['addMessage'](_0xc06bd1[_0xd966('0x38')]['ids'],_[_0xd966('0x3e')](_0xc06bd1[_0xd966('0x38')],[_0xd966('0x3f'),'id'])||{});}})[_0xd966('0x1c')](respondWithResult(_0x39c4b2,null))[_0xd966('0x2b')](handleError(_0x39c4b2,null));};exports[_0xd966('0x40')]=function(_0x586364,_0x165aa1){var _0x282218={'raw':![],'where':{}};var _0x32b9fc={};var _0x23a658={'count':0x0,'rows':[]};return db[_0xd966('0x23')][_0xd966('0x41')]({'where':{'id':_0x586364['params']['id']}})[_0xd966('0x1c')](handleEntityNotFound(_0x165aa1,null))['then'](function(_0x5cbafe){if(_0x5cbafe){_0x32b9fc[_0xd966('0x2c')]=_['keys'](db[_0xd966('0x3c')][_0xd966('0x24')]);_0x32b9fc[_0xd966('0x29')]=_[_0xd966('0x2d')](_0x586364[_0xd966('0x29')]);_0x32b9fc[_0xd966('0x2e')]=_['intersection'](_0x32b9fc[_0xd966('0x2c')],_0x32b9fc[_0xd966('0x29')]);_0x282218[_0xd966('0x30')]=_['intersection'](_0x32b9fc[_0xd966('0x2c')],qs[_0xd966('0x31')](_0x586364[_0xd966('0x29')]['fields']));_0x282218[_0xd966('0x30')]=_0x282218[_0xd966('0x30')]['length']?_0x282218['attributes']:_0x32b9fc[_0xd966('0x2c')];if(!_0x586364[_0xd966('0x29')][_0xd966('0x42')]('nolimit')){_0x282218[_0xd966('0x19')]=qs[_0xd966('0x19')](_0x586364[_0xd966('0x29')]['limit']);_0x282218['offset']=qs[_0xd966('0x18')](_0x586364['query'][_0xd966('0x18')]);}_0x282218[_0xd966('0x43')]=qs[_0xd966('0x44')](_0x586364['query'][_0xd966('0x44')]);_0x282218[_0xd966('0x45')]=qs['filters'](_['pick'](_0x586364[_0xd966('0x29')],_0x32b9fc[_0xd966('0x2e')]));_0x282218['where'][_0xd966('0x46')]=_0x5cbafe['id'];if(_0x586364[_0xd966('0x29')]['filter']){_0x282218['where']=_[_0xd966('0x34')](_0x282218[_0xd966('0x45')],{'$or':_[_0xd966('0x22')](_0x282218['attributes'],function(_0x5445e0){var _0x48ef4b={};_0x48ef4b[_0x5445e0]={'$like':'%'+_0x586364[_0xd966('0x29')]['filter']+'%'};return _0x48ef4b;})});}if(_0x586364[_0xd966('0x29')][_0xd966('0x47')]){var _0x432721=_0x586364[_0xd966('0x29')][_0xd966('0x47')][_0xd966('0x48')](',');var _0x3b300a={};_0x3b300a[_0x432721[0x0]]={'$gte':moment(_0x432721[0x1])[_0xd966('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x282218['where']=_['merge'](_0x282218['where'],_0x3b300a);}_0x282218=_[_0xd966('0x34')]({},_0x282218,_0x586364['options']);return db['SmsMessage'][_0xd966('0x17')]({'where':_0x282218[_0xd966('0x45')]})['then'](function(_0xcfd7e4){_0x23a658[_0xd966('0x17')]=_0xcfd7e4;if(_0x586364[_0xd966('0x29')][_0xd966('0x32')]){_0x282218[_0xd966('0x33')]=[{'all':!![]}];}return db['SmsMessage'][_0xd966('0x27')](_0x282218);})['then'](function(_0x54be76){_0x23a658[_0xd966('0x4a')]=_0x54be76;return _0x23a658;});}})[_0xd966('0x1c')](respondWithFilteredResult(_0x165aa1,_0x282218))['catch'](handleError(_0x165aa1,null));};exports[_0xd966('0x4b')]=function(_0x26ac76,_0xa69602){return db[_0xd966('0x23')][_0xd966('0x3d')]({'where':{'id':_0x26ac76[_0xd966('0x39')]['id']}})['then'](handleEntityNotFound(_0xa69602,null))[_0xd966('0x1c')](function(_0x2fd494){if(_0x2fd494){return _0x2fd494['setTags'](_0x26ac76[_0xd966('0x38')][_0xd966('0x3f')],_[_0xd966('0x3e')](_0x26ac76[_0xd966('0x38')],['ids','id'])||{})[_0xd966('0x4c')](function(){return db[_0xd966('0x4d')]['findAll']({'attributes':['id',_0xd966('0x20'),_0xd966('0x4e')],'where':{'id':_0x26ac76[_0xd966('0x38')][_0xd966('0x3f')]}});})[_0xd966('0x1c')](function(_0x4d2fca){socket['emit']('smsInteractionTags:save',{'id':Number(_0x26ac76['params']['id']),'tags':_0x4d2fca||[]});return{'id':Number(_0x26ac76[_0xd966('0x39')]['id']),'tags':_0x4d2fca||[]};});}})[_0xd966('0x1c')](respondWithResult(_0xa69602,null))[_0xd966('0x2b')](handleError(_0xa69602,null));};exports[_0xd966('0x4f')]=function(_0x13a5c1,_0x5113b2){return db['SmsInteraction'][_0xd966('0x3d')]({'where':{'id':_0x13a5c1[_0xd966('0x39')]['id']}})[_0xd966('0x1c')](handleEntityNotFound(_0x5113b2,null))[_0xd966('0x1c')](function(_0xcf412b){if(_0xcf412b){return _0xcf412b[_0xd966('0x4f')](_0x13a5c1[_0xd966('0x29')][_0xd966('0x3f')]);}})[_0xd966('0x1c')](respondWithStatusCode(_0x5113b2,null))[_0xd966('0x2b')](handleError(_0x5113b2,null));};exports[_0xd966('0x50')]=function(_0x48004d,_0x3becb4){var _0xd03126=moment()[_0xd966('0x51')]()[_0xd966('0x52')]();var _0x2cc553=path[_0xd966('0x53')](config['root'],_0xd966('0x54'),_0xd966('0x55'),_0xd966('0x56'));var _0x357002=path[_0xd966('0x53')](_0x2cc553,_0xd03126);var _0x364133=util[_0xd966('0x49')]('transcript-%d-%s.zip',_0x48004d[_0xd966('0x39')]['id'],_0xd03126);var _0x51de3e=path[_0xd966('0x53')](_0x2cc553,_0x364133);var _0x4b42ed=[];_0x4b42ed['push']({'model':db[_0xd966('0x57')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x4b42ed[_0xd966('0x58')]({'model':db[_0xd966('0x59')],'as':_0xd966('0x5a'),'attributes':['id',_0xd966('0x5b'),_0xd966('0x5c')],'raw':!![]});var _0x3fe2a3=[{'model':db[_0xd966('0x3c')],'as':_0xd966('0x5d'),'attributes':['id',_0xd966('0x38'),_0xd966('0x5e'),'direction','secret',_0xd966('0x5f')],'include':_0x4b42ed}];_0x3fe2a3['push']({'model':db[_0xd966('0x60')],'as':_0xd966('0x61'),'attributes':['id',_0xd966('0x20')]});_0x3fe2a3[_0xd966('0x58')]({'model':db[_0xd966('0x57')],'as':'Owner','attributes':['id',_0xd966('0x62')]});return db['SmsInteraction']['find']({'where':{'id':_0x48004d[_0xd966('0x39')]['id']},'include':_0x3fe2a3})[_0xd966('0x1c')](handleEntityNotFound(_0x3becb4,null))[_0xd966('0x1c')](function(_0x136067){if(_0x136067){var _0x6ee756=_0x136067[_0xd966('0x63')]({'plain':!![]});fs[_0xd966('0x64')](_0x357002);var _0x2485cb={'channel':_0xd966('0x65'),'account':_0x6ee756['Account'][_0xd966('0x20')],'agent':_0x6ee756[_0xd966('0x66')]?_0x6ee756[_0xd966('0x66')]['fullname']:'N.A.','createdAt':moment(_0x6ee756['createdAt'])[_0xd966('0x49')](_0xd966('0x67'))[_0xd966('0x52')](),'closedAt':_0x6ee756[_0xd966('0x68')]?moment(_0x6ee756[_0xd966('0x69')])['format'](_0xd966('0x67'))[_0xd966('0x52')]():'','disposition':_0x6ee756['disposition'],'messages':_(_0x6ee756[_0xd966('0x5d')])[_0xd966('0x6a')]({'secret':![]})['map'](function(_0x4c3b04){return{'date':moment(_0x4c3b04[_0xd966('0x5e')])[_0xd966('0x49')](_0xd966('0x67'))[_0xd966('0x52')](),'sender':_0x4c3b04[_0xd966('0x6b')]===_0xd966('0x6c')?_0x4c3b04['User']?_0x4c3b04[_0xd966('0x57')][_0xd966('0x62')]:_0xd966('0x6d'):_0x4c3b04['Contact'][_0xd966('0x5b')]+(_0x4c3b04['Contact'][_0xd966('0x5c')]?'\x20'+_0x4c3b04['Contact'][_0xd966('0x5c')]:''),'body':_0x4c3b04[_0xd966('0x38')],'direction':_0x4c3b04['direction']===_0xd966('0x6c')?'A':'C','secret':_0x4c3b04[_0xd966('0x6e')],'read':_0x4c3b04['read']};})['value']()};return ejs['renderFile'](path['join'](config[_0xd966('0x6f')],_0xd966('0x54'),_0xd966('0x70'),'downloadInteraction.ejs'),{'interaction':_0x2485cb})[_0xd966('0x1c')](function(_0x234fd7){var _0x2ecc95=path['join'](_0x357002,_0xd966('0x71')+_0x6ee756['id']+'-'+_0xd03126+_0xd966('0x72'));var _0x4b26de={'path':_0x2ecc95,'channel':_0xd966('0x65'),'interactionId':_0x6ee756['id']};return pdf[_0xd966('0x73')](_0x234fd7,_0x4b26de);})[_0xd966('0x1c')](function(){return new BPromise(function(_0x3305f5,_0x35cdde){zipdir(_0x357002,{'saveTo':_0x51de3e},function(_0x2ec852,_0x46645c){if(_0x2ec852)return _0x35cdde(_0x2ec852);return _0x3305f5(_0x46645c);});})['then'](function(){return new BPromise(function(_0x539ae9,_0x4df738){rimraf(_0x357002,function(_0x42f94a){if(_0x42f94a)_0x4df738(_0x42f94a);return _0x539ae9();});});})[_0xd966('0x1c')](function(){return _0x3becb4[_0xd966('0x50')](_0x51de3e,_0x364133,function(_0x443884){if(_0x443884){console[_0xd966('0x74')](_0xd966('0x75'),_0x443884);}else{fs[_0xd966('0x76')](_0x51de3e);}});});});}else{return _0x3becb4[_0xd966('0x12')](0xc8);}})[_0xd966('0x2b')](handleError(_0x3becb4,null));}; \ No newline at end of file +var _0xb584=['tmp','join','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','createdAt','direction','secret','read','SmsAccount','Account','fullname','mkdirSync','Sms','Owner','N.A.','closed','closedAt','toString','disposition','Messages','out','System','value','views','createPdfFromHTML','download','log','sendStatus','rimraf','moment','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','status','end','json','undefined','limit','count','offset','then','destroy','name','send','map','SmsInteraction','rawAttributes','type','getOptions','findAll','sms','query','user','catch','show','params','keys','filters','intersection','attributes','model','fields','length','include','merge','find','create','body','update','describe','addMessage','SmsMessage','omit','ids','findOne','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','root','server'];(function(_0x2dd3ae,_0x22f1c1){var _0x3adf5d=function(_0x482f12){while(--_0x482f12){_0x2dd3ae['push'](_0x2dd3ae['shift']());}};_0x3adf5d(++_0x22f1c1);}(_0xb584,0x16e));var _0x4b58=function(_0x794c3b,_0x44d384){_0x794c3b=_0x794c3b-0x0;var _0x14a0be=_0xb584[_0x794c3b];return _0x14a0be;};'use strict';var rimraf=require(_0x4b58('0x0'));var zipdir=require('zip-dir');var moment=require(_0x4b58('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x4b58('0x2'));var interaction=require(_0x4b58('0x3'));var qs=require(_0x4b58('0x4'));var pdf=require(_0x4b58('0x5'));var logger=require(_0x4b58('0x6'))(_0x4b58('0x7'));var config=require(_0x4b58('0x8'));var db=require(_0x4b58('0x9'))['db'];config[_0x4b58('0xa')]=_[_0x4b58('0xb')](config[_0x4b58('0xa')],{'host':_0x4b58('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4b58('0xd'))['register'](socket);function respondWithStatusCode(_0x3649a8,_0x5ddd85){_0x5ddd85=_0x5ddd85||0xcc;return function(_0x355df7){if(_0x355df7){return _0x3649a8['sendStatus'](_0x5ddd85);}return _0x3649a8[_0x4b58('0xe')](_0x5ddd85)[_0x4b58('0xf')]();};}function respondWithResult(_0x5ead16,_0x55e7a3){_0x55e7a3=_0x55e7a3||0xc8;return function(_0x58667e){if(_0x58667e){return _0x5ead16[_0x4b58('0xe')](_0x55e7a3)[_0x4b58('0x10')](_0x58667e);}};}function respondWithFilteredResult(_0x10d171,_0xd37355){return function(_0x47f4b1){if(_0x47f4b1){var _0x4a2b03=typeof _0xd37355['offset']===_0x4b58('0x11')&&typeof _0xd37355[_0x4b58('0x12')]===_0x4b58('0x11');var _0x4d788a=_0x47f4b1[_0x4b58('0x13')];var _0xc20c46=_0x4a2b03?0x0:_0xd37355[_0x4b58('0x14')];var _0x522823=_0x4a2b03?_0x47f4b1[_0x4b58('0x13')]:_0xd37355['offset']+_0xd37355['limit'];var _0x83f410;if(_0x522823>=_0x4d788a){_0x522823=_0x4d788a;_0x83f410=0xc8;}else{_0x83f410=0xce;}_0x10d171[_0x4b58('0xe')](_0x83f410);return _0x10d171['set']('Content-Range',_0xc20c46+'-'+_0x522823+'/'+_0x4d788a)['json'](_0x47f4b1);}return null;};}function saveUpdates(_0x59f016){return function(_0x3218f3){if(_0x3218f3){return _0x3218f3['update'](_0x59f016)[_0x4b58('0x15')](function(_0x4b4b7d){return _0x4b4b7d;});}return null;};}function removeEntity(_0x2945e6){return function(_0x255dec){if(_0x255dec){return _0x255dec[_0x4b58('0x16')]()[_0x4b58('0x15')](function(){_0x2945e6['status'](0xcc)[_0x4b58('0xf')]();});}};}function handleEntityNotFound(_0x53e7f2){return function(_0x46579e){if(!_0x46579e){_0x53e7f2['sendStatus'](0x194);}return _0x46579e;};}function handleError(_0x46c0fd,_0x35a59e){_0x35a59e=_0x35a59e||0x1f4;return function(_0x1016ad){logger['error'](_0x1016ad['stack']);if(_0x1016ad[_0x4b58('0x17')]){delete _0x1016ad[_0x4b58('0x17')];}_0x46c0fd[_0x4b58('0xe')](_0x35a59e)[_0x4b58('0x18')](_0x1016ad);};}exports['index']=function(_0x124cfd,_0x4f1f10){var _0x39f473={};var _0x492ff9=_[_0x4b58('0x19')](db[_0x4b58('0x1a')][_0x4b58('0x1b')],function(_0x3f2f5a){return{'name':_0x3f2f5a['fieldName'],'type':_0x3f2f5a[_0x4b58('0x1c')]['key']};});_0x39f473=qs[_0x4b58('0x1d')](_0x492ff9,_0x124cfd);return interaction[_0x4b58('0x1e')](_0x4b58('0x1f'),_0x124cfd[_0x4b58('0x20')],_0x124cfd[_0x4b58('0x21')],_0x39f473,_0x492ff9)[_0x4b58('0x15')](respondWithFilteredResult(_0x4f1f10,_0x39f473))[_0x4b58('0x22')](handleError(_0x4f1f10,null));};exports[_0x4b58('0x23')]=function(_0x20dba8,_0x35d8f5){var _0x3e355c={'raw':![],'where':{'id':_0x20dba8[_0x4b58('0x24')]['id']}},_0x5ce839={};_0x5ce839['model']=_[_0x4b58('0x25')](db[_0x4b58('0x1a')][_0x4b58('0x1b')]);_0x5ce839[_0x4b58('0x20')]=_['keys'](_0x20dba8[_0x4b58('0x20')]);_0x5ce839[_0x4b58('0x26')]=_[_0x4b58('0x27')](_0x5ce839['model'],_0x5ce839[_0x4b58('0x20')]);_0x3e355c[_0x4b58('0x28')]=_[_0x4b58('0x27')](_0x5ce839[_0x4b58('0x29')],qs['fields'](_0x20dba8[_0x4b58('0x20')][_0x4b58('0x2a')]));_0x3e355c[_0x4b58('0x28')]=_0x3e355c[_0x4b58('0x28')][_0x4b58('0x2b')]?_0x3e355c['attributes']:_0x5ce839[_0x4b58('0x29')];if(_0x20dba8[_0x4b58('0x20')]['includeAll']){_0x3e355c[_0x4b58('0x2c')]=[{'all':!![]}];}_0x3e355c=_[_0x4b58('0x2d')]({},_0x3e355c,_0x20dba8['options']);return db[_0x4b58('0x1a')][_0x4b58('0x2e')](_0x3e355c)[_0x4b58('0x15')](handleEntityNotFound(_0x35d8f5,null))[_0x4b58('0x15')](respondWithResult(_0x35d8f5,null))[_0x4b58('0x22')](handleError(_0x35d8f5,null));};exports[_0x4b58('0x2f')]=function(_0x55402f,_0x22399f){return db['SmsInteraction'][_0x4b58('0x2f')](_0x55402f[_0x4b58('0x30')],{})[_0x4b58('0x15')](respondWithResult(_0x22399f,0xc9))[_0x4b58('0x22')](handleError(_0x22399f,null));};exports[_0x4b58('0x31')]=function(_0x2e69a9,_0x1c5e37){if(_0x2e69a9['body']['id']){delete _0x2e69a9[_0x4b58('0x30')]['id'];}return db[_0x4b58('0x1a')]['find']({'where':{'id':_0x2e69a9[_0x4b58('0x24')]['id']}})['then'](handleEntityNotFound(_0x1c5e37,null))[_0x4b58('0x15')](saveUpdates(_0x2e69a9[_0x4b58('0x30')],null))[_0x4b58('0x15')](respondWithResult(_0x1c5e37,null))[_0x4b58('0x22')](handleError(_0x1c5e37,null));};exports[_0x4b58('0x16')]=function(_0xd228e1,_0xb35829){return db['SmsInteraction'][_0x4b58('0x2e')]({'where':{'id':_0xd228e1[_0x4b58('0x24')]['id']}})['then'](handleEntityNotFound(_0xb35829,null))['then'](removeEntity(_0xb35829,null))['catch'](handleError(_0xb35829,null));};exports[_0x4b58('0x32')]=function(_0x2296f2,_0x10dbd0){return db[_0x4b58('0x1a')][_0x4b58('0x32')]()[_0x4b58('0x15')](respondWithResult(_0x10dbd0,null))['catch'](handleError(_0x10dbd0,null));};exports[_0x4b58('0x33')]=function(_0x2d9315,_0x195117){return db[_0x4b58('0x34')][_0x4b58('0x2e')]({'where':{'id':_0x2d9315[_0x4b58('0x24')]['id']}})[_0x4b58('0x15')](handleEntityNotFound(_0x195117,null))[_0x4b58('0x15')](function(_0x23ff9f){if(_0x23ff9f){return _0x23ff9f[_0x4b58('0x33')](_0x2d9315[_0x4b58('0x30')]['ids'],_[_0x4b58('0x35')](_0x2d9315[_0x4b58('0x30')],[_0x4b58('0x36'),'id'])||{});}})[_0x4b58('0x15')](respondWithResult(_0x195117,null))[_0x4b58('0x22')](handleError(_0x195117,null));};exports['getMessages']=function(_0x55a1a3,_0x1e16e8){var _0x4f59b0={'raw':![],'where':{}};var _0x3a92b7={};var _0x482ec8={'count':0x0,'rows':[]};return db[_0x4b58('0x1a')][_0x4b58('0x37')]({'where':{'id':_0x55a1a3[_0x4b58('0x24')]['id']}})[_0x4b58('0x15')](handleEntityNotFound(_0x1e16e8,null))[_0x4b58('0x15')](function(_0x2bbe18){if(_0x2bbe18){_0x3a92b7[_0x4b58('0x29')]=_['keys'](db['SmsMessage'][_0x4b58('0x1b')]);_0x3a92b7[_0x4b58('0x20')]=_[_0x4b58('0x25')](_0x55a1a3[_0x4b58('0x20')]);_0x3a92b7[_0x4b58('0x26')]=_[_0x4b58('0x27')](_0x3a92b7[_0x4b58('0x29')],_0x3a92b7[_0x4b58('0x20')]);_0x4f59b0['attributes']=_[_0x4b58('0x27')](_0x3a92b7[_0x4b58('0x29')],qs[_0x4b58('0x2a')](_0x55a1a3['query'][_0x4b58('0x2a')]));_0x4f59b0[_0x4b58('0x28')]=_0x4f59b0[_0x4b58('0x28')][_0x4b58('0x2b')]?_0x4f59b0['attributes']:_0x3a92b7[_0x4b58('0x29')];if(!_0x55a1a3[_0x4b58('0x20')]['hasOwnProperty'](_0x4b58('0x38'))){_0x4f59b0[_0x4b58('0x12')]=qs[_0x4b58('0x12')](_0x55a1a3[_0x4b58('0x20')]['limit']);_0x4f59b0['offset']=qs[_0x4b58('0x14')](_0x55a1a3[_0x4b58('0x20')][_0x4b58('0x14')]);}_0x4f59b0[_0x4b58('0x39')]=qs[_0x4b58('0x3a')](_0x55a1a3[_0x4b58('0x20')]['sort']);_0x4f59b0[_0x4b58('0x3b')]=qs[_0x4b58('0x26')](_[_0x4b58('0x3c')](_0x55a1a3[_0x4b58('0x20')],_0x3a92b7[_0x4b58('0x26')]));_0x4f59b0[_0x4b58('0x3b')][_0x4b58('0x3d')]=_0x2bbe18['id'];if(_0x55a1a3[_0x4b58('0x20')][_0x4b58('0x3e')]){_0x4f59b0['where']=_['merge'](_0x4f59b0[_0x4b58('0x3b')],{'$or':_[_0x4b58('0x19')](_0x4f59b0[_0x4b58('0x28')],function(_0x5e8a99){var _0x5dbacb={};_0x5dbacb[_0x5e8a99]={'$like':'%'+_0x55a1a3[_0x4b58('0x20')]['filter']+'%'};return _0x5dbacb;})});}if(_0x55a1a3[_0x4b58('0x20')][_0x4b58('0x3f')]){var _0x140cb4=_0x55a1a3[_0x4b58('0x20')][_0x4b58('0x3f')][_0x4b58('0x40')](',');var _0x3eff9c={};_0x3eff9c[_0x140cb4[0x0]]={'$gte':moment(_0x140cb4[0x1])[_0x4b58('0x41')](_0x4b58('0x42'))};_0x4f59b0[_0x4b58('0x3b')]=_[_0x4b58('0x2d')](_0x4f59b0[_0x4b58('0x3b')],_0x3eff9c);}_0x4f59b0=_[_0x4b58('0x2d')]({},_0x4f59b0,_0x55a1a3[_0x4b58('0x43')]);return db[_0x4b58('0x34')][_0x4b58('0x13')]({'where':_0x4f59b0[_0x4b58('0x3b')]})[_0x4b58('0x15')](function(_0x56233e){_0x482ec8[_0x4b58('0x13')]=_0x56233e;if(_0x55a1a3[_0x4b58('0x20')]['includeAll']){_0x4f59b0[_0x4b58('0x2c')]=[{'all':!![]}];}return db[_0x4b58('0x34')][_0x4b58('0x1e')](_0x4f59b0);})['then'](function(_0xa88e03){_0x482ec8[_0x4b58('0x44')]=_0xa88e03;return _0x482ec8;});}})[_0x4b58('0x15')](respondWithFilteredResult(_0x1e16e8,_0x4f59b0))[_0x4b58('0x22')](handleError(_0x1e16e8,null));};exports[_0x4b58('0x45')]=function(_0x58a276,_0x93f526){return db[_0x4b58('0x1a')]['find']({'where':{'id':_0x58a276[_0x4b58('0x24')]['id']}})[_0x4b58('0x15')](handleEntityNotFound(_0x93f526,null))[_0x4b58('0x15')](function(_0x58feb0){if(_0x58feb0){return _0x58feb0[_0x4b58('0x46')](_0x58a276[_0x4b58('0x30')][_0x4b58('0x36')],_[_0x4b58('0x35')](_0x58a276[_0x4b58('0x30')],[_0x4b58('0x36'),'id'])||{})[_0x4b58('0x47')](function(){return db[_0x4b58('0x48')][_0x4b58('0x1e')]({'attributes':['id',_0x4b58('0x17'),'color'],'where':{'id':_0x58a276[_0x4b58('0x30')]['ids']}});})[_0x4b58('0x15')](function(_0x49f9d1){socket[_0x4b58('0x49')](_0x4b58('0x4a'),{'id':Number(_0x58a276[_0x4b58('0x24')]['id']),'tags':_0x49f9d1||[]});return{'id':Number(_0x58a276[_0x4b58('0x24')]['id']),'tags':_0x49f9d1||[]};});}})[_0x4b58('0x15')](respondWithResult(_0x93f526,null))[_0x4b58('0x22')](handleError(_0x93f526,null));};exports[_0x4b58('0x4b')]=function(_0x1b5559,_0x2656a4){return db[_0x4b58('0x1a')]['find']({'where':{'id':_0x1b5559[_0x4b58('0x24')]['id']}})[_0x4b58('0x15')](handleEntityNotFound(_0x2656a4,null))[_0x4b58('0x15')](function(_0xe4009d){if(_0xe4009d){return _0xe4009d[_0x4b58('0x4b')](_0x1b5559[_0x4b58('0x20')][_0x4b58('0x36')]);}})['then'](respondWithStatusCode(_0x2656a4,null))[_0x4b58('0x22')](handleError(_0x2656a4,null));};exports['download']=function(_0x358406,_0x582e3){var _0x3ef820=moment()['unix']()['toString']();var _0x3e1d9c=path['join'](config[_0x4b58('0x4c')],_0x4b58('0x4d'),'files',_0x4b58('0x4e'));var _0xb7ac13=path[_0x4b58('0x4f')](_0x3e1d9c,_0x3ef820);var _0x228efb=util[_0x4b58('0x41')](_0x4b58('0x50'),_0x358406[_0x4b58('0x24')]['id'],_0x3ef820);var _0x305cba=path[_0x4b58('0x4f')](_0x3e1d9c,_0x228efb);var _0x3c9158=[];_0x3c9158[_0x4b58('0x51')]({'model':db[_0x4b58('0x52')],'as':_0x4b58('0x52'),'attributes':['id','fullname'],'raw':!![]});_0x3c9158['push']({'model':db[_0x4b58('0x53')],'as':_0x4b58('0x54'),'attributes':['id',_0x4b58('0x55'),_0x4b58('0x56')],'raw':!![]});var _0x35b940=[{'model':db[_0x4b58('0x34')],'as':'Messages','attributes':['id','body',_0x4b58('0x57'),_0x4b58('0x58'),_0x4b58('0x59'),_0x4b58('0x5a')],'include':_0x3c9158}];_0x35b940[_0x4b58('0x51')]({'model':db[_0x4b58('0x5b')],'as':_0x4b58('0x5c'),'attributes':['id',_0x4b58('0x17')]});_0x35b940[_0x4b58('0x51')]({'model':db['User'],'as':'Owner','attributes':['id',_0x4b58('0x5d')]});return db[_0x4b58('0x1a')][_0x4b58('0x2e')]({'where':{'id':_0x358406[_0x4b58('0x24')]['id']},'include':_0x35b940})['then'](handleEntityNotFound(_0x582e3,null))[_0x4b58('0x15')](function(_0x54bbd6){if(_0x54bbd6){var _0x49fc3d=_0x54bbd6['get']({'plain':!![]});fs[_0x4b58('0x5e')](_0xb7ac13);var _0x4bd06c={'channel':_0x4b58('0x5f'),'account':_0x49fc3d[_0x4b58('0x5c')][_0x4b58('0x17')],'agent':_0x49fc3d[_0x4b58('0x60')]?_0x49fc3d[_0x4b58('0x60')][_0x4b58('0x5d')]:_0x4b58('0x61'),'createdAt':moment(_0x49fc3d[_0x4b58('0x57')])['format'](_0x4b58('0x42'))['toString'](),'closedAt':_0x49fc3d[_0x4b58('0x62')]?moment(_0x49fc3d[_0x4b58('0x63')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4b58('0x64')]():'','disposition':_0x49fc3d[_0x4b58('0x65')],'messages':_(_0x49fc3d[_0x4b58('0x66')])[_0x4b58('0x3e')]({'secret':![]})[_0x4b58('0x19')](function(_0x807a66){return{'date':moment(_0x807a66[_0x4b58('0x57')])['format'](_0x4b58('0x42'))[_0x4b58('0x64')](),'sender':_0x807a66['direction']===_0x4b58('0x67')?_0x807a66[_0x4b58('0x52')]?_0x807a66[_0x4b58('0x52')][_0x4b58('0x5d')]:_0x4b58('0x68'):_0x807a66['Contact'][_0x4b58('0x55')]+(_0x807a66[_0x4b58('0x54')][_0x4b58('0x56')]?'\x20'+_0x807a66[_0x4b58('0x54')]['lastName']:''),'body':_0x807a66[_0x4b58('0x30')],'direction':_0x807a66[_0x4b58('0x58')]===_0x4b58('0x67')?'A':'C','secret':_0x807a66[_0x4b58('0x59')],'read':_0x807a66[_0x4b58('0x5a')]};})[_0x4b58('0x69')]()};return ejs['renderFile'](path[_0x4b58('0x4f')](config[_0x4b58('0x4c')],_0x4b58('0x4d'),_0x4b58('0x6a'),'downloadInteraction.ejs'),{'interaction':_0x4bd06c})[_0x4b58('0x15')](function(_0x184358){var _0xa582aa=path[_0x4b58('0x4f')](_0xb7ac13,'transcript-'+_0x49fc3d['id']+'-'+_0x3ef820+'.pdf');var _0x3a4ec9={'path':_0xa582aa,'channel':'Sms','interactionId':_0x49fc3d['id']};return pdf[_0x4b58('0x6b')](_0x184358,_0x3a4ec9);})[_0x4b58('0x15')](function(){return new BPromise(function(_0x52cc2f,_0x4edb2d){zipdir(_0xb7ac13,{'saveTo':_0x305cba},function(_0x40dbd7,_0x223a58){if(_0x40dbd7)return _0x4edb2d(_0x40dbd7);return _0x52cc2f(_0x223a58);});})[_0x4b58('0x15')](function(){return new BPromise(function(_0x3203cf,_0x22480d){rimraf(_0xb7ac13,function(_0x4bd923){if(_0x4bd923)_0x22480d(_0x4bd923);return _0x3203cf();});});})[_0x4b58('0x15')](function(){return _0x582e3[_0x4b58('0x6c')](_0x305cba,_0x228efb,function(_0x231fbb){if(_0x231fbb){console[_0x4b58('0x6d')]('err',_0x231fbb);}else{fs['unlinkSync'](_0x305cba);}});});});}else{return _0x582e3[_0x4b58('0x6e')](0xc8);}})[_0x4b58('0x22')](handleError(_0x582e3,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index efbcee3..e288898 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 _0xfcbb=['catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x10c97f,_0x1ba134){_0x10c97f=_0x10c97f-0x0;var _0x547285=_0xfcbb[_0x10c97f];return _0x547285;};'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 +var _0x3de3=['length','emit','catch','hasOwnProperty','hook','exports','events','SmsInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','findAll','then','unreadMessages'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x3de3,0x1ce));var _0x33de=function(_0x496ac3,_0x1656cc){_0x496ac3=_0x496ac3-0x0;var _0x232407=_0x3de3[_0x496ac3];return _0x232407;};'use strict';var EventEmitter=require(_0x33de('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x33de('0x1')];var SmsMessage=require(_0x33de('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x33de('0x3')](0x0);var events={'afterCreate':_0x33de('0x4'),'afterUpdate':_0x33de('0x5'),'afterDestroy':_0x33de('0x6')};function emitEvent(_0x56b413){return function(_0x11c87e,_0x9382cb,_0x558f98){_0x11c87e[_0x33de('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x13afea){_0x11c87e[_0x33de('0x8')](_0x33de('0x9'),_0x13afea['map'](function(_0x2074fe){return{'id':_0x2074fe['id']};}));return SmsMessage[_0x33de('0xa')]({'where':{'SmsInteractionId':_0x11c87e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x33de('0xb')](function(_0x5e1be7){_0x11c87e[_0x33de('0x8')](_0x33de('0xc'),_0x5e1be7[_0x33de('0xd')]);SmsInteractionEvents[_0x33de('0xe')](_0x56b413+':'+_0x11c87e['id'],_0x11c87e);SmsInteractionEvents[_0x33de('0xe')](_0x56b413,_0x11c87e);_0x558f98(null);})[_0x33de('0xf')](_0x558f98(null));};}for(var e in events){if(events[_0x33de('0x10')](e)){var event=events[e];SmsInteraction[_0x33de('0x11')](e,emitEvent(event));}}module[_0x33de('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 ae93970..b0455e0 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 _0xc1e4=['SmsInteraction','changed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./smsInteraction.attributes','exports','define'];(function(_0x305c8f,_0xc5f7fb){var _0x5ddc30=function(_0x1aed6f){while(--_0x1aed6f){_0x305c8f['push'](_0x305c8f['shift']());}};_0x5ddc30(++_0xc5f7fb);}(_0xc1e4,0xb9));var _0x4c1e=function(_0x5ac1f9,_0x3f706a){_0x5ac1f9=_0x5ac1f9-0x0;var _0x1e136f=_0xc1e4[_0x5ac1f9];return _0x1e136f;};'use strict';var _=require(_0x4c1e('0x0'));var util=require(_0x4c1e('0x1'));var logger=require(_0x4c1e('0x2'))(_0x4c1e('0x3'));var moment=require(_0x4c1e('0x4'));var BPromise=require(_0x4c1e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c1e('0x6'));var rimraf=require(_0x4c1e('0x7'));var config=require('../../config/environment');var attributes=require(_0x4c1e('0x8'));module[_0x4c1e('0x9')]=function(_0x5ca8ed,_0x40e563){return _0x5ca8ed[_0x4c1e('0xa')](_0x4c1e('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc1c6da,_0x463f4b,_0x3caf96){if(_0xc1c6da[_0x4c1e('0xc')]('closed')){_0xc1c6da['closedAt']=moment()['format'](_0x4c1e('0xd'));}_0x3caf96(null,_0xc1c6da);}}});}; \ No newline at end of file +var _0x3492=['path','rimraf','exports','define','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3492,0xdb));var _0x2349=function(_0x51c64d,_0x29ef02){_0x51c64d=_0x51c64d-0x0;var _0x2226a4=_0x3492[_0x51c64d];return _0x2226a4;};'use strict';var _=require(_0x2349('0x0'));var util=require(_0x2349('0x1'));var logger=require('../../config/logger')(_0x2349('0x2'));var moment=require(_0x2349('0x3'));var BPromise=require(_0x2349('0x4'));var rp=require(_0x2349('0x5'));var fs=require('fs');var path=require(_0x2349('0x6'));var rimraf=require(_0x2349('0x7'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0x2349('0x8')]=function(_0x31a65e,_0x410efb){return _0x31a65e[_0x2349('0x9')]('SmsInteraction',attributes,{'tableName':_0x2349('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x334b64,_0x9efe2e,_0x284b24){if(_0x334b64[_0x2349('0xb')]('closed')){_0x334b64[_0x2349('0xc')]=moment()[_0x2349('0xd')](_0x2349('0xe'));}_0x284b24(null,_0x334b64);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3cbff48..1099bd9 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 _0xe17c=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','request\x20sent','debug','stringify','error','code','message','result','SmsInteraction,\x20%s,\x20%s','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToSmsInteraction','addTags','ids','omit','AddTags','lodash','util'];(function(_0x98a7f4,_0x26a940){var _0x1d8a5a=function(_0x47c3a8){while(--_0x47c3a8){_0x98a7f4['push'](_0x98a7f4['shift']());}};_0x1d8a5a(++_0x26a940);}(_0xe17c,0xf4));var _0xce17=function(_0x3a6bfa,_0xdac091){_0x3a6bfa=_0x3a6bfa-0x0;var _0x40a37b=_0xe17c[_0x3a6bfa];return _0x40a37b;};'use strict';var _=require(_0xce17('0x0'));var util=require(_0xce17('0x1'));var moment=require(_0xce17('0x2'));var BPromise=require(_0xce17('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce17('0x4'));var db=require(_0xce17('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xce17('0x6'))('rpc');var config=require(_0xce17('0x7'));var jayson=require(_0xce17('0x8'));var client=jayson[_0xce17('0x9')]['http']({'port':0x232a});config['redis']=_[_0xce17('0xa')](config[_0xce17('0xb')],{'host':_0xce17('0xc'),'port':0x18eb});var socket=require(_0xce17('0xd'))(new Redis(config[_0xce17('0xb')]));require(_0xce17('0xe'))['register'](socket);function respondWithRpcPromise(_0x2ff181,_0x52d250,_0x5d8ab8){return new BPromise(function(_0x2f5c1a,_0x8fa57d){return client[_0xce17('0xf')](_0x2ff181,_0x5d8ab8)[_0xce17('0x10')](function(_0x57a83d){logger[_0xce17('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x52d250,_0xce17('0x12'));logger[_0xce17('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x52d250,_0xce17('0x12'),JSON[_0xce17('0x14')](_0x57a83d));if(_0x57a83d[_0xce17('0x15')]){if(_0x57a83d[_0xce17('0x15')][_0xce17('0x16')]===0x1f4){logger[_0xce17('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x52d250,_0x57a83d[_0xce17('0x15')][_0xce17('0x17')]);return _0x8fa57d(_0x57a83d[_0xce17('0x15')][_0xce17('0x17')]);}logger[_0xce17('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x52d250,_0x57a83d[_0xce17('0x15')][_0xce17('0x17')]);return _0x2f5c1a(_0x57a83d[_0xce17('0x15')]['message']);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x52d250,_0xce17('0x12'));_0x2f5c1a(_0x57a83d[_0xce17('0x18')][_0xce17('0x17')]);}})['catch'](function(_0x53d12e){logger[_0xce17('0x15')](_0xce17('0x19'),_0x52d250,_0x53d12e);_0x8fa57d(_0x53d12e);});});}exports[_0xce17('0x1a')]=function(_0x39f40a){var _0xd1069=this;return new Promise(function(_0x5a50fd,_0x2ecf34){return db[_0xce17('0x1b')][_0xce17('0x1c')](_0x39f40a[_0xce17('0x1d')],{'raw':_0x39f40a['options']?_0x39f40a[_0xce17('0x1e')][_0xce17('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39f40a[_0xce17('0x1e')]?_0x39f40a['options'][_0xce17('0x20')]||null:null,'attributes':_0x39f40a[_0xce17('0x1e')]?_0x39f40a[_0xce17('0x1e')][_0xce17('0x21')]||null:null,'limit':_0x39f40a[_0xce17('0x1e')]?_0x39f40a[_0xce17('0x1e')][_0xce17('0x22')]||null:null})[_0xce17('0x10')](function(_0x356792){logger[_0xce17('0x11')](_0xce17('0x1a'),_0x39f40a);logger[_0xce17('0x13')](_0xce17('0x1a'),_0x39f40a,JSON['stringify'](_0x356792));_0x5a50fd(_0x356792);})[_0xce17('0x23')](function(_0x36b617){logger[_0xce17('0x15')](_0xce17('0x1a'),_0x36b617[_0xce17('0x17')],_0x39f40a);_0x2ecf34(_0xd1069[_0xce17('0x15')](0x1f4,_0x36b617[_0xce17('0x17')]));});});};exports[_0xce17('0x24')]=function(_0x479688){return new Promise(function(_0x5db5a6,_0x26110e){return db[_0xce17('0x1b')]['find']({'where':_0x479688[_0xce17('0x1e')]?_0x479688['options'][_0xce17('0x20')]||null:null})['then'](function(_0x18dddd){if(_0x18dddd){return _0x18dddd[_0xce17('0x25')](_0x479688['body'][_0xce17('0x26')],_[_0xce17('0x27')](_0x479688['body'],['ids','id'])||{});}})['spread'](function(_0x4ecf85){logger[_0xce17('0x11')](_0xce17('0x28'),_0x479688);logger[_0xce17('0x13')](_0xce17('0x28'),_0x479688,JSON[_0xce17('0x14')](_0x4ecf85));_0x5db5a6(_0x4ecf85);})['catch'](function(_0x3205ec){logger[_0xce17('0x15')](_0xce17('0x28'),_0x3205ec['message'],_0x479688);_0x26110e(_this[_0xce17('0x15')](0x1f4,_0x3205ec[_0xce17('0x17')]));});});}; \ No newline at end of file +var _0x8716=['message','info','result','SmsInteraction','update','body','options','limit','UpdateSmsInteraction','catch','AddTagsToSmsInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsInteraction.socket','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0x8716,0x172));var _0x6871=function(_0x299ba7,_0x1dac64){_0x299ba7=_0x299ba7-0x0;var _0x12a9f5=_0x8716[_0x299ba7];return _0x12a9f5;};'use strict';var _=require(_0x6871('0x0'));var util=require(_0x6871('0x1'));var moment=require(_0x6871('0x2'));var BPromise=require('bluebird');var rs=require(_0x6871('0x3'));var fs=require('fs');var Redis=require(_0x6871('0x4'));var db=require(_0x6871('0x5'))['db'];var utils=require(_0x6871('0x6'));var logger=require(_0x6871('0x7'))(_0x6871('0x8'));var config=require(_0x6871('0x9'));var jayson=require(_0x6871('0xa'));var client=jayson[_0x6871('0xb')][_0x6871('0xc')]({'port':0x232a});config['redis']=_[_0x6871('0xd')](config[_0x6871('0xe')],{'host':_0x6871('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6871('0xe')]));require(_0x6871('0x10'))['register'](socket);function respondWithRpcPromise(_0x2cbe9f,_0x36b264,_0x444c14){return new BPromise(function(_0x39f0be,_0x40641e){return client[_0x6871('0x11')](_0x2cbe9f,_0x444c14)[_0x6871('0x12')](function(_0x50eb08){logger['info'](_0x6871('0x13'),_0x36b264,_0x6871('0x14'));logger[_0x6871('0x15')](_0x6871('0x16'),_0x36b264,_0x6871('0x14'),JSON[_0x6871('0x17')](_0x50eb08));if(_0x50eb08['error']){if(_0x50eb08['error'][_0x6871('0x18')]===0x1f4){logger['error'](_0x6871('0x13'),_0x36b264,_0x50eb08[_0x6871('0x19')][_0x6871('0x1a')]);return _0x40641e(_0x50eb08[_0x6871('0x19')][_0x6871('0x1a')]);}logger[_0x6871('0x19')](_0x6871('0x13'),_0x36b264,_0x50eb08['error'][_0x6871('0x1a')]);return _0x39f0be(_0x50eb08[_0x6871('0x19')][_0x6871('0x1a')]);}else{logger[_0x6871('0x1b')](_0x6871('0x13'),_0x36b264,_0x6871('0x14'));_0x39f0be(_0x50eb08[_0x6871('0x1c')][_0x6871('0x1a')]);}})['catch'](function(_0x130b90){logger[_0x6871('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x36b264,_0x130b90);_0x40641e(_0x130b90);});});}exports['UpdateSmsInteraction']=function(_0x358254){var _0x3f5c17=this;return new Promise(function(_0x2d593a,_0x449bfe){return db[_0x6871('0x1d')][_0x6871('0x1e')](_0x358254[_0x6871('0x1f')],{'raw':_0x358254[_0x6871('0x20')]?_0x358254['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x358254['options']?_0x358254[_0x6871('0x20')]['where']||null:null,'attributes':_0x358254[_0x6871('0x20')]?_0x358254[_0x6871('0x20')]['attributes']||null:null,'limit':_0x358254[_0x6871('0x20')]?_0x358254['options'][_0x6871('0x21')]||null:null})[_0x6871('0x12')](function(_0x4b2d9f){logger['info']('UpdateSmsInteraction',_0x358254);logger[_0x6871('0x15')](_0x6871('0x22'),_0x358254,JSON[_0x6871('0x17')](_0x4b2d9f));_0x2d593a(_0x4b2d9f);})[_0x6871('0x23')](function(_0x4010f5){logger['error'](_0x6871('0x22'),_0x4010f5[_0x6871('0x1a')],_0x358254);_0x449bfe(_0x3f5c17[_0x6871('0x19')](0x1f4,_0x4010f5[_0x6871('0x1a')]));});});};exports[_0x6871('0x24')]=function(_0x4e36ec){return new Promise(function(_0x52dca5,_0x1fc897){return db[_0x6871('0x1d')][_0x6871('0x25')]({'where':_0x4e36ec['options']?_0x4e36ec[_0x6871('0x20')][_0x6871('0x26')]||null:null})[_0x6871('0x12')](function(_0x3d78c7){if(_0x3d78c7){return _0x3d78c7[_0x6871('0x27')](_0x4e36ec[_0x6871('0x1f')][_0x6871('0x28')],_[_0x6871('0x29')](_0x4e36ec[_0x6871('0x1f')],[_0x6871('0x28'),'id'])||{});}})[_0x6871('0x2a')](function(_0x559ea6){logger['info'](_0x6871('0x2b'),_0x4e36ec);logger['debug'](_0x6871('0x2b'),_0x4e36ec,JSON[_0x6871('0x17')](_0x559ea6));_0x52dca5(_0x559ea6);})[_0x6871('0x23')](function(_0x469a0a){logger[_0x6871('0x19')](_0x6871('0x2b'),_0x469a0a[_0x6871('0x1a')],_0x4e36ec);_0x1fc897(_this[_0x6871('0x19')](0x1f4,_0x469a0a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 8e66233..cb750c8 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 _0xf423=['save','remove','emit','removeListener','register','smsInteraction:','./smsInteraction.events'];(function(_0x13c1bd,_0x65e2b0){var _0x5094b4=function(_0x40e476){while(--_0x40e476){_0x13c1bd['push'](_0x13c1bd['shift']());}};_0x5094b4(++_0x65e2b0);}(_0xf423,0x1f0));var _0x3f42=function(_0x1e58fe,_0x3665ed){_0x1e58fe=_0x1e58fe-0x0;var _0x1521ea=_0xf423[_0x1e58fe];return _0x1521ea;};'use strict';var SmsInteractionEvents=require(_0x3f42('0x0'));var events=[_0x3f42('0x1'),_0x3f42('0x2'),'update'];function createListener(_0x3d1235,_0x404230){return function(_0x44799c){_0x404230[_0x3f42('0x3')](_0x3d1235,_0x44799c);};}function removeListener(_0x337725,_0x4f0b67){return function(){SmsInteractionEvents[_0x3f42('0x4')](_0x337725,_0x4f0b67);};}exports[_0x3f42('0x5')]=function(_0x299ced){for(var _0x16102e=0x0,_0xb17b2a=events['length'];_0x16102e<_0xb17b2a;_0x16102e++){var _0x20a4f8=events[_0x16102e];var _0x5a661a=createListener(_0x3f42('0x6')+_0x20a4f8,_0x299ced);SmsInteractionEvents['on'](_0x20a4f8,_0x5a661a);}}; \ No newline at end of file +var _0x2cbf=['emit','removeListener','length','smsInteraction:','./smsInteraction.events','save','remove','update'];(function(_0x2998b7,_0x24db75){var _0x1eca7f=function(_0x597bec){while(--_0x597bec){_0x2998b7['push'](_0x2998b7['shift']());}};_0x1eca7f(++_0x24db75);}(_0x2cbf,0x114));var _0xf2cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2cbf[_0x3dd15e];return _0x231fd0;};'use strict';var SmsInteractionEvents=require(_0xf2cb('0x0'));var events=[_0xf2cb('0x1'),_0xf2cb('0x2'),_0xf2cb('0x3')];function createListener(_0x5eb0d2,_0x467d9c){return function(_0x2194f9){_0x467d9c[_0xf2cb('0x4')](_0x5eb0d2,_0x2194f9);};}function removeListener(_0x11cae5,_0xac5986){return function(){SmsInteractionEvents[_0xf2cb('0x5')](_0x11cae5,_0xac5986);};}exports['register']=function(_0xffebcf){for(var _0x5f55ac=0x0,_0x2cc413=events[_0xf2cb('0x6')];_0x5f55ac<_0x2cc413;_0x5f55ac++){var _0x602302=events[_0x5f55ac];var _0x51bb30=createListener(_0xf2cb('0x7')+_0x602302,_0xffebcf);SmsInteractionEvents['on'](_0x602302,_0x51bb30);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 0c190b0..0a53c08 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 _0xb8a1=['index','/describe','describe','/:id','show','post','tracked','/:id/status','status','put','update','accept','reject','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated'];(function(_0x18bb53,_0x1aaa44){var _0x3b1df5=function(_0x9b2ba6){while(--_0x9b2ba6){_0x18bb53['push'](_0x18bb53['shift']());}};_0x3b1df5(++_0x1aaa44);}(_0xb8a1,0x12d));var _0x1b8a=function(_0x145a99,_0x3b77ee){_0x145a99=_0x145a99-0x0;var _0x5ed6cf=_0xb8a1[_0x145a99];return _0x5ed6cf;};'use strict';var multer=require(_0x1b8a('0x0'));var util=require(_0x1b8a('0x1'));var path=require('path');var timeout=require(_0x1b8a('0x2'));var express=require(_0x1b8a('0x3'));var router=express['Router']();var fs_extra=require(_0x1b8a('0x4'));var auth=require(_0x1b8a('0x5'));var interaction=require(_0x1b8a('0x6'));var config=require(_0x1b8a('0x7'));var controller=require(_0x1b8a('0x8'));router[_0x1b8a('0x9')]('/',auth[_0x1b8a('0xa')](),controller[_0x1b8a('0xb')]);router[_0x1b8a('0x9')](_0x1b8a('0xc'),auth['isAuthenticated'](),controller[_0x1b8a('0xd')]);router[_0x1b8a('0x9')](_0x1b8a('0xe'),auth[_0x1b8a('0xa')](),controller[_0x1b8a('0xf')]);router[_0x1b8a('0x10')]('/',auth[_0x1b8a('0xa')](),interaction[_0x1b8a('0x11')]('sms','smsmessage:create'),controller['create']);router['post'](_0x1b8a('0x12'),controller[_0x1b8a('0x13')]);router[_0x1b8a('0x14')](_0x1b8a('0xe'),auth['isAuthenticated'](),controller[_0x1b8a('0x15')]);router[_0x1b8a('0x14')]('/:id/accept',auth[_0x1b8a('0xa')](),controller[_0x1b8a('0x16')]);router[_0x1b8a('0x14')]('/:id/reject',auth[_0x1b8a('0xa')](),controller[_0x1b8a('0x17')]);router['delete']('/:id',auth[_0x1b8a('0xa')](),controller[_0x1b8a('0x18')]);module[_0x1b8a('0x19')]=router; \ No newline at end of file +var _0x4110=['smsmessage:create','create','post','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','isAuthenticated','describe','/:id','show','tracked','sms'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x4110,0xac));var _0x0411=function(_0x5bb0e8,_0x42f844){_0x5bb0e8=_0x5bb0e8-0x0;var _0x506838=_0x4110[_0x5bb0e8];return _0x506838;};'use strict';var multer=require(_0x0411('0x0'));var util=require(_0x0411('0x1'));var path=require(_0x0411('0x2'));var timeout=require(_0x0411('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0411('0x4'));var auth=require(_0x0411('0x5'));var interaction=require(_0x0411('0x6'));var config=require(_0x0411('0x7'));var controller=require(_0x0411('0x8'));router[_0x0411('0x9')]('/',auth['isAuthenticated'](),controller[_0x0411('0xa')]);router['get']('/describe',auth[_0x0411('0xb')](),controller[_0x0411('0xc')]);router['get'](_0x0411('0xd'),auth['isAuthenticated'](),controller[_0x0411('0xe')]);router['post']('/',auth[_0x0411('0xb')](),interaction[_0x0411('0xf')](_0x0411('0x10'),_0x0411('0x11')),controller[_0x0411('0x12')]);router[_0x0411('0x13')]('/:id/status',controller['status']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0411('0x14')]('/:id/accept',auth[_0x0411('0xb')](),controller[_0x0411('0x15')]);router[_0x0411('0x14')](_0x0411('0x16'),auth[_0x0411('0xb')](),controller[_0x0411('0x17')]);router[_0x0411('0x18')](_0x0411('0xd'),auth[_0x0411('0xb')](),controller[_0x0411('0x19')]);module[_0x0411('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 3c8fd58..bee4e52 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 _0xac95=['sequelize','exports','TEXT','medium','out','STRING','DATE'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xac95,0xa8));var _0x5ac9=function(_0x59e13b,_0x5aca2e){_0x59e13b=_0x59e13b-0x0;var _0x19742c=_0xac95[_0x59e13b];return _0x19742c;};'use strict';var Sequelize=require(_0x5ac9('0x0'));module[_0x5ac9('0x1')]={'body':{'type':Sequelize[_0x5ac9('0x2')](_0x5ac9('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5ac9('0x4')),'defaultValue':_0x5ac9('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x5ac9('0x5')]},'readAt':{'type':Sequelize[_0x5ac9('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5ac9('0x5')]},'providerResponse':{'type':Sequelize[_0x5ac9('0x2')]}}; \ No newline at end of file +var _0x359a=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x359a,0x153));var _0xa359=function(_0x4764a6,_0x85faa7){_0x4764a6=_0x4764a6-0x0;var _0x5a7bb8=_0x359a[_0x4764a6];return _0x5a7bb8;};'use strict';var Sequelize=require(_0xa359('0x0'));module[_0xa359('0x1')]={'body':{'type':Sequelize[_0xa359('0x2')](_0xa359('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa359('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa359('0x5')),'defaultValue':_0xa359('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa359('0x6')](0xbe)},'phone':{'type':Sequelize[_0xa359('0x6')]},'readAt':{'type':Sequelize[_0xa359('0x7')]},'secret':{'type':Sequelize[_0xa359('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa359('0x6')]},'providerResponse':{'type':Sequelize[_0xa359('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index e8c496b..fa20a2b 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 _0xc692=['read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','read1stAt','format','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','Sequelize','SELECT','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','inspect','MessageUUID','indexOf','sent','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsMessage.socket','register','jayson/promise','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','include','rows','show','params','keys','find','create','body','accept','sms'];(function(_0x2479b3,_0x2a30f6){var _0x57e011=function(_0x11bcdf){while(--_0x11bcdf){_0x2479b3['push'](_0x2479b3['shift']());}};_0x57e011(++_0x2a30f6);}(_0xc692,0x15f));var _0x2c69=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xc692[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0x2c69('0x0'));var rimraf=require(_0x2c69('0x1'));var zipdir=require(_0x2c69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2c69('0x3'));var BPromise=require(_0x2c69('0x4'));var Mustache=require(_0x2c69('0x5'));var util=require(_0x2c69('0x6'));var path=require(_0x2c69('0x7'));var sox=require(_0x2c69('0x8'));var csv=require(_0x2c69('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c69('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2c69('0xb'));var jsforce=require(_0x2c69('0xc'));var deskjs=require(_0x2c69('0xd'));var toCsv=require(_0x2c69('0x9'));var querystring=require(_0x2c69('0xe'));var Papa=require(_0x2c69('0xf'));var Redis=require('ioredis');var authService=require(_0x2c69('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2c69('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c69('0x12'))(_0x2c69('0x13'));var utils=require(_0x2c69('0x14'));var config=require(_0x2c69('0x15'));var licenseUtil=require(_0x2c69('0x16'));var db=require(_0x2c69('0x17'))['db'];config['redis']=_[_0x2c69('0x18')](config['redis'],{'host':_0x2c69('0x19'),'port':0x18eb});var socket=require(_0x2c69('0x1a'))(new Redis(config[_0x2c69('0x1b')]));require(_0x2c69('0x1c'))[_0x2c69('0x1d')](socket);var jayson=require(_0x2c69('0x1e'));var client=jayson['client'][_0x2c69('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b9bdd,_0x4cabe5,_0x11649b,_0x5f5bd5){return new BPromise(function(_0x59e48a,_0x5bb8ee){var _0x3bd4a3=_0x5f5bd5||client;return _0x3bd4a3[_0x2c69('0x20')](_0x2b9bdd,_0x11649b)[_0x2c69('0x21')](function(_0x5b4ca0){logger['info'](_0x2c69('0x22'),_0x4cabe5,_0x2c69('0x23'));logger[_0x2c69('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4cabe5,_0x2c69('0x23'),JSON['stringify'](_0x5b4ca0));if(_0x5b4ca0[_0x2c69('0x25')]){if(_0x5b4ca0[_0x2c69('0x25')][_0x2c69('0x26')]===0x1f4){logger[_0x2c69('0x25')]('SmsMessage,\x20%s,\x20%s',_0x4cabe5,_0x5b4ca0[_0x2c69('0x25')][_0x2c69('0x27')]);return _0x5bb8ee(_0x5b4ca0[_0x2c69('0x25')]['message']);}logger[_0x2c69('0x25')]('SmsMessage,\x20%s,\x20%s',_0x4cabe5,_0x5b4ca0['error'][_0x2c69('0x27')]);return _0x59e48a(_0x5b4ca0[_0x2c69('0x25')][_0x2c69('0x27')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x4cabe5,_0x2c69('0x23'));_0x59e48a(_0x5b4ca0[_0x2c69('0x28')][_0x2c69('0x27')]);}})[_0x2c69('0x29')](function(_0x12dbca){logger[_0x2c69('0x25')](_0x2c69('0x22'),_0x4cabe5,_0x12dbca);_0x5bb8ee(_0x12dbca);});});}function respondWithStatusCode(_0x2a0569,_0x461784){_0x461784=_0x461784||0xcc;return function(_0x51a470){if(_0x51a470){return _0x2a0569[_0x2c69('0x2a')](_0x461784);}return _0x2a0569[_0x2c69('0x2b')](_0x461784)['end']();};}function respondWithResult(_0x1b29b8,_0xd85b20){_0xd85b20=_0xd85b20||0xc8;return function(_0x2238a9){if(_0x2238a9){return _0x1b29b8['status'](_0xd85b20)[_0x2c69('0x2c')](_0x2238a9);}};}function respondWithFilteredResult(_0xfe88bf,_0x4fa8eb){return function(_0x2ae236){if(_0x2ae236){var _0x3d6e87=typeof _0x4fa8eb[_0x2c69('0x2d')]===_0x2c69('0x2e')&&typeof _0x4fa8eb['limit']===_0x2c69('0x2e');var _0x77babf=_0x2ae236['count'];var _0x5c56a9=_0x3d6e87?0x0:_0x4fa8eb['offset'];var _0x41d912=_0x3d6e87?_0x2ae236['count']:_0x4fa8eb['offset']+_0x4fa8eb[_0x2c69('0x2f')];var _0x21f0bf;if(_0x41d912>=_0x77babf){_0x41d912=_0x77babf;_0x21f0bf=0xc8;}else{_0x21f0bf=0xce;}_0xfe88bf[_0x2c69('0x2b')](_0x21f0bf);return _0xfe88bf[_0x2c69('0x30')](_0x2c69('0x31'),_0x5c56a9+'-'+_0x41d912+'/'+_0x77babf)['json'](_0x2ae236);}return null;};}function patchUpdates(_0x302d3e){return function(_0xe0295c){try{jsonpatch[_0x2c69('0x32')](_0xe0295c,_0x302d3e,!![]);}catch(_0x402241){return BPromise['reject'](_0x402241);}return _0xe0295c[_0x2c69('0x33')]();};}function saveUpdates(_0xb27d5c,_0x4e276a){return function(_0x3ed129){if(_0x3ed129){return _0x3ed129[_0x2c69('0x34')](_0xb27d5c)['then'](function(_0x12570f){return _0x12570f;});}return null;};}function removeEntity(_0x43d084,_0x285584){return function(_0x1bbd99){if(_0x1bbd99){return _0x1bbd99[_0x2c69('0x35')]()[_0x2c69('0x21')](function(){_0x43d084['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fbf98,_0x11472b){return function(_0xa9d150){if(!_0xa9d150){_0x3fbf98['sendStatus'](0x194);}return _0xa9d150;};}function handleError(_0x43d1a0,_0xe24085){_0xe24085=_0xe24085||0x1f4;return function(_0x387d02){logger['error'](_0x387d02[_0x2c69('0x36')]);if(_0x387d02[_0x2c69('0x37')]){delete _0x387d02[_0x2c69('0x37')];}_0x43d1a0[_0x2c69('0x2b')](_0xe24085)[_0x2c69('0x38')](_0x387d02);};}exports['index']=function(_0x45cca4,_0x229def){var _0x2f3e17={},_0x4452c3={},_0x2fdf72={'count':0x0,'rows':[]};var _0x569989=_[_0x2c69('0x39')](db[_0x2c69('0x3a')][_0x2c69('0x3b')],function(_0xb14e44){return{'name':_0xb14e44[_0x2c69('0x3c')],'type':_0xb14e44[_0x2c69('0x3d')][_0x2c69('0x3e')]};});_0x4452c3[_0x2c69('0x3f')]=_['map'](_0x569989,_0x2c69('0x37'));_0x4452c3['query']=_['keys'](_0x45cca4['query']);_0x4452c3[_0x2c69('0x40')]=_[_0x2c69('0x41')](_0x4452c3['model'],_0x4452c3[_0x2c69('0x42')]);_0x2f3e17[_0x2c69('0x43')]=_[_0x2c69('0x41')](_0x4452c3['model'],qs['fields'](_0x45cca4[_0x2c69('0x42')][_0x2c69('0x44')]));_0x2f3e17['attributes']=_0x2f3e17['attributes'][_0x2c69('0x45')]?_0x2f3e17[_0x2c69('0x43')]:_0x4452c3[_0x2c69('0x3f')];if(!_0x45cca4['query'][_0x2c69('0x46')](_0x2c69('0x47'))){_0x2f3e17[_0x2c69('0x2f')]=qs['limit'](_0x45cca4[_0x2c69('0x42')][_0x2c69('0x2f')]);_0x2f3e17['offset']=qs[_0x2c69('0x2d')](_0x45cca4[_0x2c69('0x42')][_0x2c69('0x2d')]);}_0x2f3e17['order']=qs[_0x2c69('0x48')](_0x45cca4['query'][_0x2c69('0x48')]);_0x2f3e17['where']=qs[_0x2c69('0x40')](_[_0x2c69('0x49')](_0x45cca4['query'],_0x4452c3[_0x2c69('0x40')]),_0x569989);if(_0x45cca4[_0x2c69('0x42')][_0x2c69('0x4a')]){_0x2f3e17[_0x2c69('0x4b')]=_[_0x2c69('0x4c')](_0x2f3e17[_0x2c69('0x4b')],{'$or':_['map'](_0x569989,function(_0x33e848){if(_0x33e848['type']!==_0x2c69('0x4d')){var _0x3598dc={};_0x3598dc[_0x33e848[_0x2c69('0x37')]]={'$like':'%'+_0x45cca4[_0x2c69('0x42')]['filter']+'%'};return _0x3598dc;}})});}_0x2f3e17=_[_0x2c69('0x4c')]({},_0x2f3e17,_0x45cca4[_0x2c69('0x4e')]);var _0x4a7eed={'where':_0x2f3e17['where']};return db[_0x2c69('0x3a')][_0x2c69('0x4f')](_0x4a7eed)[_0x2c69('0x21')](function(_0x44e333){_0x2fdf72[_0x2c69('0x4f')]=_0x44e333;if(_0x45cca4['query']['includeAll']){_0x2f3e17[_0x2c69('0x50')]=[{'all':!![]}];}return db[_0x2c69('0x3a')]['findAll'](_0x2f3e17);})[_0x2c69('0x21')](function(_0x1b8ff2){_0x2fdf72[_0x2c69('0x51')]=_0x1b8ff2;return _0x2fdf72;})[_0x2c69('0x21')](respondWithFilteredResult(_0x229def,_0x2f3e17))[_0x2c69('0x29')](handleError(_0x229def,null));};exports[_0x2c69('0x52')]=function(_0x3ca9ff,_0x114beb){var _0x97c019={'raw':!![],'where':{'id':_0x3ca9ff[_0x2c69('0x53')]['id']}},_0x465e45={};_0x465e45[_0x2c69('0x3f')]=_[_0x2c69('0x54')](db[_0x2c69('0x3a')][_0x2c69('0x3b')]);_0x465e45['query']=_[_0x2c69('0x54')](_0x3ca9ff[_0x2c69('0x42')]);_0x465e45['filters']=_[_0x2c69('0x41')](_0x465e45['model'],_0x465e45[_0x2c69('0x42')]);_0x97c019[_0x2c69('0x43')]=_['intersection'](_0x465e45[_0x2c69('0x3f')],qs[_0x2c69('0x44')](_0x3ca9ff[_0x2c69('0x42')][_0x2c69('0x44')]));_0x97c019[_0x2c69('0x43')]=_0x97c019[_0x2c69('0x43')][_0x2c69('0x45')]?_0x97c019[_0x2c69('0x43')]:_0x465e45[_0x2c69('0x3f')];if(_0x3ca9ff[_0x2c69('0x42')]['includeAll']){_0x97c019[_0x2c69('0x50')]=[{'all':!![]}];}_0x97c019=_[_0x2c69('0x4c')]({},_0x97c019,_0x3ca9ff[_0x2c69('0x4e')]);return db[_0x2c69('0x3a')][_0x2c69('0x55')](_0x97c019)[_0x2c69('0x21')](handleEntityNotFound(_0x114beb,null))[_0x2c69('0x21')](respondWithResult(_0x114beb,null))['catch'](handleError(_0x114beb,null));};exports[_0x2c69('0x56')]=function(_0x3e8444,_0x503423){return db['SmsMessage']['create'](_0x3e8444[_0x2c69('0x57')],{})[_0x2c69('0x21')](respondWithResult(_0x503423,0xc9))[_0x2c69('0x29')](handleError(_0x503423,null));};exports['update']=function(_0x5eadf4,_0x2c0f27){if(_0x5eadf4['body']['id']){delete _0x5eadf4[_0x2c69('0x57')]['id'];}return db[_0x2c69('0x3a')][_0x2c69('0x55')]({'where':{'id':_0x5eadf4[_0x2c69('0x53')]['id']}})[_0x2c69('0x21')](handleEntityNotFound(_0x2c0f27,null))[_0x2c69('0x21')](saveUpdates(_0x5eadf4[_0x2c69('0x57')],null))[_0x2c69('0x21')](respondWithResult(_0x2c0f27,null))['catch'](handleError(_0x2c0f27,null));};exports[_0x2c69('0x35')]=function(_0x422f2c,_0xf98abe){return db[_0x2c69('0x3a')]['find']({'where':{'id':_0x422f2c[_0x2c69('0x53')]['id']}})[_0x2c69('0x21')](handleEntityNotFound(_0xf98abe,null))[_0x2c69('0x21')](removeEntity(_0xf98abe,null))[_0x2c69('0x29')](handleError(_0xf98abe,null));};exports['describe']=function(_0x1b122f,_0x12f224){return db[_0x2c69('0x3a')]['describe']()[_0x2c69('0x21')](respondWithResult(_0x12f224,null))[_0x2c69('0x29')](handleError(_0x12f224,null));};var interaction_log=require(_0x2c69('0x12'))('sms-interactions');exports[_0x2c69('0x58')]=function(_0xffb257,_0x3b9f47,_0x5c297e){var _0x1111c8={'agent':{},'channel':_0x2c69('0x59')};if(_0xffb257[_0x2c69('0x57')]['id']){delete _0xffb257[_0x2c69('0x57')]['id'];}_0xffb257['body'][_0x2c69('0x5a')]=!![];_0xffb257['body'][_0x2c69('0x5b')]=moment()['format'](_0x2c69('0x5c'));_0xffb257[_0x2c69('0x57')]['UserId']=_0xffb257[_0x2c69('0x57')][_0x2c69('0x5d')]||_0xffb257[_0x2c69('0x5e')]['id'];_0x1111c8[_0x2c69('0x5f')]['id']=_0xffb257[_0x2c69('0x57')][_0x2c69('0x5d')];return db['SmsMessage'][_0x2c69('0x55')]({'where':{'id':_0xffb257[_0x2c69('0x53')]['id'],'UserId':null}})[_0x2c69('0x21')](handleEntityNotFound(_0x3b9f47,null))[_0x2c69('0x21')](saveUpdates(_0xffb257['body'],null))['then'](function(_0x1264fc){if(_0x1264fc){_0x1111c8[_0x2c69('0x27')]=_0x1264fc[_0x2c69('0x60')]({'plain':!![]});return db[_0x2c69('0x61')][_0x2c69('0x55')]({'where':{'id':_0x1264fc[_0x2c69('0x62')]}});}return null;})[_0x2c69('0x21')](handleEntityNotFound(_0x3b9f47,null))[_0x2c69('0x21')](function(_0x50fbcd){if(_0x50fbcd){return _0x50fbcd['update']({'UserId':_0xffb257[_0x2c69('0x57')][_0x2c69('0x5d')],'read1stAt':_['isNil'](_0x50fbcd[_0x2c69('0x63')])?moment()[_0x2c69('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x27719c){if(_0x27719c){_0x1111c8[_0x2c69('0x65')]=_0x27719c[_0x2c69('0x60')]({'plain':!![]});interaction_log[_0x2c69('0x66')](_0x2c69('0x67'),_0xffb257[_0x2c69('0x5e')]['id'],_0xffb257[_0x2c69('0x5e')]['name'],_0xffb257['user'][_0x2c69('0x68')],_0x1111c8[_0x2c69('0x65')]['id'],_0xffb257[_0x2c69('0x57')]?JSON[_0x2c69('0x69')](_0xffb257[_0x2c69('0x57')]):_0x2c69('0x6a'));return respondWithRpcPromise(_0x2c69('0x6b'),'acceptMessage',_0x1111c8);}return null;})[_0x2c69('0x21')](function(_0x1d42a0){var _0xb3e43f=_0x2c69('0x6c')+_0x1d42a0[_0x2c69('0x27')][_0x2c69('0x6d')];return db['sequelize']['query'](_0xb3e43f,{'type':db['Sequelize'][_0x2c69('0x6e')]['SELECT'],'raw':!![]})[_0x2c69('0x21')](function(_0x25dc56){return _0x25dc56;});})[_0x2c69('0x21')](function(_0x8a86f6){if(_0x8a86f6){_0x1111c8[_0x2c69('0x27')]['contact']=_0x8a86f6[0x0];if(!_0xffb257[_0x2c69('0x57')][_0x2c69('0x5d')])return;return db[_0x2c69('0x6f')]['find']({'where':{'id':_0xffb257['body'][_0x2c69('0x5d')],'role':_0x2c69('0x5f')},'attributes':['id','name',_0x2c69('0x70'),_0x2c69('0x71'),_0x2c69('0x72')],'raw':!![]});}return null;})[_0x2c69('0x21')](function(_0x1ef843){if(!_0x1ef843)return null;_0x1111c8[_0x2c69('0x27')][_0x2c69('0x5f')]=_0x1ef843;return _0x1111c8;})[_0x2c69('0x21')](function(_0x27a153){if(_0x27a153){if(_0xffb257['body'][_0x2c69('0x73')]){_0x1111c8[_0x2c69('0x27')][_0x2c69('0x74')]=util[_0x2c69('0x64')](_0x2c69('0x75'),_0xffb257[_0x2c69('0x5e')][_0x2c69('0x37')]);_0x1111c8[_0x2c69('0x27')][_0x2c69('0x76')]=_0x1111c8['channel'];_0x1111c8['message'][_0x2c69('0x77')]=_0x1111c8['channel'];_0x1111c8['message'][_0x2c69('0x78')]=_0x2c69('0x58');return respondWithRpcPromise(_0x2c69('0x79'),_0x2c69('0x79'),{'event':_0x2c69('0x7a'),'message':_0x1111c8[_0x2c69('0x27')]},client9002)[_0x2c69('0x21')](function(){return _0x1111c8;});}return _0x1111c8;}return null;})[_0x2c69('0x21')](respondWithResult(_0x3b9f47,null))['catch'](handleError(_0x3b9f47,null));};var interaction_log=require(_0x2c69('0x12'))(_0x2c69('0x7b'));exports['reject']=function(_0x59e4f6,_0x240797,_0xfd8ff1){var _0x37dfbb={'agent':{},'channel':_0x2c69('0x59')};if(_0x59e4f6[_0x2c69('0x57')]['id']){delete _0x59e4f6['body']['id'];}_0x59e4f6[_0x2c69('0x57')][_0x2c69('0x5d')]=_0x59e4f6[_0x2c69('0x57')][_0x2c69('0x5d')]||_0x59e4f6[_0x2c69('0x5e')]['id'];_0x37dfbb[_0x2c69('0x5f')]['id']=_0x59e4f6['body'][_0x2c69('0x5d')];return db[_0x2c69('0x3a')]['find']({'where':{'id':_0x59e4f6[_0x2c69('0x53')]['id'],'UserId':null}})[_0x2c69('0x21')](handleEntityNotFound(_0x240797,null))[_0x2c69('0x21')](function(_0xf71c2d){if(_0xf71c2d){_0x37dfbb[_0x2c69('0x27')]=_0xf71c2d['get']({'plain':!![]});return db[_0x2c69('0x61')][_0x2c69('0x55')]({'where':{'id':_0xf71c2d[_0x2c69('0x62')]}});}return null;})[_0x2c69('0x21')](handleEntityNotFound(_0x240797,null))['then'](function(_0x33e202){if(_0x33e202){_0x37dfbb[_0x2c69('0x65')]=_0x33e202[_0x2c69('0x60')]({'plain':!![]});interaction_log[_0x2c69('0x66')](_0x2c69('0x7c'),_0x59e4f6['user']['id'],_0x59e4f6['user']['name'],_0x59e4f6[_0x2c69('0x5e')][_0x2c69('0x68')],_0x37dfbb[_0x2c69('0x65')]['id'],_0x59e4f6[_0x2c69('0x57')]?JSON[_0x2c69('0x69')](_0x59e4f6['body']):_0x2c69('0x6a'));return respondWithRpcPromise(_0x2c69('0x7d'),_0x2c69('0x7e'),_0x37dfbb);}return null;})['then'](function(_0x5bcc1b){var _0x3af47f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5bcc1b[_0x2c69('0x27')][_0x2c69('0x6d')];return db[_0x2c69('0x7f')][_0x2c69('0x42')](_0x3af47f,{'type':db[_0x2c69('0x80')][_0x2c69('0x6e')][_0x2c69('0x81')],'raw':!![]})[_0x2c69('0x21')](function(_0x4a12c0){return _0x4a12c0;});})[_0x2c69('0x21')](function(_0x197c9b){if(_0x197c9b){_0x37dfbb[_0x2c69('0x27')]['contact']=_0x197c9b[0x0];if(!_0x59e4f6['body'][_0x2c69('0x5d')])return;return db[_0x2c69('0x6f')]['find']({'where':{'id':_0x59e4f6['body'][_0x2c69('0x5d')],'role':_0x2c69('0x5f')},'attributes':['id','name',_0x2c69('0x70'),'email',_0x2c69('0x72')],'raw':!![]});}return null;})[_0x2c69('0x21')](function(_0x56a436){if(!_0x56a436)return null;_0x37dfbb[_0x2c69('0x27')][_0x2c69('0x5f')]=_0x56a436;return _0x37dfbb;})[_0x2c69('0x21')](function(_0x360df4){if(_0x360df4){_0x360df4[_0x2c69('0x27')]['interface']=util[_0x2c69('0x64')](_0x2c69('0x75'),_0x59e4f6[_0x2c69('0x5e')]['name']);_0x360df4[_0x2c69('0x27')]['channel']=_0x37dfbb[_0x2c69('0x76')];_0x360df4['message'][_0x2c69('0x77')]=_0x37dfbb[_0x2c69('0x76')];_0x360df4['message']['event']='reject';respondWithRpcPromise(_0x2c69('0x79'),'EventManager',{'event':_0x2c69('0x82'),'message':_0x360df4[_0x2c69('0x27')]},client9002);return _0x37dfbb;}return null;})[_0x2c69('0x21')](respondWithResult(_0x240797,null))[_0x2c69('0x29')](handleError(_0x240797,null));};exports[_0x2c69('0x2b')]=function(_0x193035,_0x32cc7a,_0x204ced){if(_0x193035['body']['id']){delete _0x193035[_0x2c69('0x57')]['id'];}var _0x1acf10;return db['SmsMessage'][_0x2c69('0x55')]({'where':{'id':_0x193035[_0x2c69('0x53')]['id']}})[_0x2c69('0x21')](handleEntityNotFound(_0x32cc7a,null))[_0x2c69('0x21')](function(_0x1c9960){if(_0x1c9960){_0x1acf10=_0x1c9960;return db[_0x2c69('0x83')][_0x2c69('0x55')]({'where':{'id':_0x1c9960[_0x2c69('0x84')]}});}})['then'](handleEntityNotFound(_0x32cc7a,null))[_0x2c69('0x21')](function(_0x20ed19){if(_0x20ed19){logger['debug'](_0x2c69('0x85'),_0x2c69('0x2b'),'received\x20delivery\x20report\x20from',_0x20ed19['type'],util['inspect'](_0x193035[_0x2c69('0x57')],{'showHidden':![],'depth':null}));switch(_0x20ed19[_0x2c69('0x3d')]){case _0x2c69('0x86'):if(_0x193035[_0x2c69('0x57')][_0x2c69('0x87')]&&_0x193035[_0x2c69('0x57')]['MessageSid']===_0x1acf10[_0x2c69('0x88')]){return _0x1acf10[_0x2c69('0x34')]({'read':!![]});}else{logger[_0x2c69('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2c69('0x2b'),_0x2c69('0x86'),util[_0x2c69('0x89')](_0x193035[_0x2c69('0x57')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x193035[_0x2c69('0x57')]['MessageUUID']&&_0x193035[_0x2c69('0x57')][_0x2c69('0x8a')]===_0x1acf10['messageId']&&_[_0x2c69('0x8b')]([_0x2c69('0x8c'),'delivered'],_0x193035[_0x2c69('0x57')][_0x2c69('0x8d')])>=0x0){return _0x1acf10[_0x2c69('0x34')]({'read':!![]});}else{logger['error'](_0x2c69('0x8e'),_0x2c69('0x2b'),_0x2c69('0x8f'),util[_0x2c69('0x89')](_0x193035[_0x2c69('0x57')],{'showHidden':![],'depth':null}));}break;case _0x2c69('0x90'):var _0x489328=_0x193035[_0x2c69('0x57')][_0x2c69('0x91')][0x0];if(_0x489328[_0x2c69('0x2b')][_0x2c69('0x92')]==='DELIVERED'){return _0x1acf10[_0x2c69('0x34')]({'read':!![]});}else{logger[_0x2c69('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2c69('0x2b'),'infobip',util[_0x2c69('0x89')](_0x193035[_0x2c69('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x1acf10;}})['then'](respondWithResult(_0x32cc7a,null))[_0x2c69('0x29')](handleError(_0x32cc7a,null));}; \ No newline at end of file +var _0x276d=['include','findAll','rows','show','params','rawAttributes','includeAll','merge','create','find','body','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','email','internal','agent','manual','SIP/%s','channel','motionChannel','event','EventManager','reject','RejectMessage','rejectMessage','ContactId','SELECT','fullname','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','update','destroy','stack','name','send','index','map','fieldName','model','keys','filters','intersection','query','attributes','fields','length','nolimit','limit','where','pick','filter','type','VIRTUAL','options','SmsMessage'];(function(_0x1b0f92,_0x73a56a){var _0x23fb32=function(_0x55a572){while(--_0x55a572){_0x1b0f92['push'](_0x1b0f92['shift']());}};_0x23fb32(++_0x73a56a);}(_0x276d,0xe3));var _0xd276=function(_0x2f3874,_0x3befe3){_0x2f3874=_0x2f3874-0x0;var _0x3eeb70=_0x276d[_0x2f3874];return _0x3eeb70;};'use strict';var emlformat=require(_0xd276('0x0'));var rimraf=require(_0xd276('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd276('0x2'));var rp=require(_0xd276('0x3'));var moment=require(_0xd276('0x4'));var BPromise=require(_0xd276('0x5'));var Mustache=require(_0xd276('0x6'));var util=require(_0xd276('0x7'));var path=require('path');var sox=require(_0xd276('0x8'));var csv=require(_0xd276('0x9'));var ejs=require(_0xd276('0xa'));var fs=require('fs');var fs_extra=require(_0xd276('0xb'));var _=require(_0xd276('0xc'));var squel=require(_0xd276('0xd'));var crypto=require(_0xd276('0xe'));var jsforce=require(_0xd276('0xf'));var deskjs=require(_0xd276('0x10'));var toCsv=require(_0xd276('0x9'));var querystring=require(_0xd276('0x11'));var Papa=require(_0xd276('0x12'));var Redis=require(_0xd276('0x13'));var authService=require(_0xd276('0x14'));var qs=require(_0xd276('0x15'));var as=require(_0xd276('0x16'));var hardwareService=require(_0xd276('0x17'));var logger=require('../../config/logger')(_0xd276('0x18'));var utils=require(_0xd276('0x19'));var config=require(_0xd276('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd276('0x1b'))['db'];config['redis']=_[_0xd276('0x1c')](config[_0xd276('0x1d')],{'host':_0xd276('0x1e'),'port':0x18eb});var socket=require(_0xd276('0x1f'))(new Redis(config[_0xd276('0x1d')]));require(_0xd276('0x20'))['register'](socket);var jayson=require(_0xd276('0x21'));var client=jayson[_0xd276('0x22')]['http']({'port':0x232c});var client9002=jayson[_0xd276('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17149b,_0x5e313f,_0x262421,_0x55ab67){return new BPromise(function(_0x58c1b4,_0x4750a8){var _0x45e372=_0x55ab67||client;return _0x45e372[_0xd276('0x23')](_0x17149b,_0x262421)[_0xd276('0x24')](function(_0x3773af){logger[_0xd276('0x25')](_0xd276('0x26'),_0x5e313f,_0xd276('0x27'));logger[_0xd276('0x28')](_0xd276('0x29'),_0x5e313f,_0xd276('0x27'),JSON[_0xd276('0x2a')](_0x3773af));if(_0x3773af[_0xd276('0x2b')]){if(_0x3773af[_0xd276('0x2b')][_0xd276('0x2c')]===0x1f4){logger['error'](_0xd276('0x26'),_0x5e313f,_0x3773af['error'][_0xd276('0x2d')]);return _0x4750a8(_0x3773af[_0xd276('0x2b')][_0xd276('0x2d')]);}logger[_0xd276('0x2b')](_0xd276('0x26'),_0x5e313f,_0x3773af[_0xd276('0x2b')][_0xd276('0x2d')]);return _0x58c1b4(_0x3773af[_0xd276('0x2b')][_0xd276('0x2d')]);}else{logger[_0xd276('0x25')]('SmsMessage,\x20%s,\x20%s',_0x5e313f,'request\x20sent');_0x58c1b4(_0x3773af[_0xd276('0x2e')][_0xd276('0x2d')]);}})[_0xd276('0x2f')](function(_0x57512e){logger[_0xd276('0x2b')](_0xd276('0x26'),_0x5e313f,_0x57512e);_0x4750a8(_0x57512e);});});}function respondWithStatusCode(_0x14e3a9,_0x44dd84){_0x44dd84=_0x44dd84||0xcc;return function(_0xcb542d){if(_0xcb542d){return _0x14e3a9[_0xd276('0x30')](_0x44dd84);}return _0x14e3a9[_0xd276('0x31')](_0x44dd84)[_0xd276('0x32')]();};}function respondWithResult(_0x1feace,_0x17819f){_0x17819f=_0x17819f||0xc8;return function(_0x54041e){if(_0x54041e){return _0x1feace[_0xd276('0x31')](_0x17819f)[_0xd276('0x33')](_0x54041e);}};}function respondWithFilteredResult(_0x929d9a,_0x6d9cd5){return function(_0x252acc){if(_0x252acc){var _0x58193f=typeof _0x6d9cd5[_0xd276('0x34')]===_0xd276('0x35')&&typeof _0x6d9cd5['limit']==='undefined';var _0xee5357=_0x252acc[_0xd276('0x36')];var _0x13e4cc=_0x58193f?0x0:_0x6d9cd5[_0xd276('0x34')];var _0x3d238b=_0x58193f?_0x252acc[_0xd276('0x36')]:_0x6d9cd5['offset']+_0x6d9cd5['limit'];var _0x4f2e41;if(_0x3d238b>=_0xee5357){_0x3d238b=_0xee5357;_0x4f2e41=0xc8;}else{_0x4f2e41=0xce;}_0x929d9a[_0xd276('0x31')](_0x4f2e41);return _0x929d9a['set'](_0xd276('0x37'),_0x13e4cc+'-'+_0x3d238b+'/'+_0xee5357)[_0xd276('0x33')](_0x252acc);}return null;};}function patchUpdates(_0x1204b0){return function(_0x85d5f2){try{jsonpatch[_0xd276('0x38')](_0x85d5f2,_0x1204b0,!![]);}catch(_0x1600eb){return BPromise['reject'](_0x1600eb);}return _0x85d5f2[_0xd276('0x39')]();};}function saveUpdates(_0x141aa2,_0x4752b8){return function(_0x495a9f){if(_0x495a9f){return _0x495a9f[_0xd276('0x3a')](_0x141aa2)[_0xd276('0x24')](function(_0x4aee1d){return _0x4aee1d;});}return null;};}function removeEntity(_0x42f1b5,_0x19a048){return function(_0xede458){if(_0xede458){return _0xede458[_0xd276('0x3b')]()[_0xd276('0x24')](function(){_0x42f1b5[_0xd276('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13fc4f,_0x13336d){return function(_0x5d7180){if(!_0x5d7180){_0x13fc4f[_0xd276('0x30')](0x194);}return _0x5d7180;};}function handleError(_0x2ff2e9,_0x1c840c){_0x1c840c=_0x1c840c||0x1f4;return function(_0xea2fb4){logger[_0xd276('0x2b')](_0xea2fb4[_0xd276('0x3c')]);if(_0xea2fb4[_0xd276('0x3d')]){delete _0xea2fb4[_0xd276('0x3d')];}_0x2ff2e9[_0xd276('0x31')](_0x1c840c)[_0xd276('0x3e')](_0xea2fb4);};}exports[_0xd276('0x3f')]=function(_0x22cb89,_0x123b34){var _0x5bfaf6={},_0x395afa={},_0x44d7e3={'count':0x0,'rows':[]};var _0x56b82f=_[_0xd276('0x40')](db['SmsMessage']['rawAttributes'],function(_0x225f85){return{'name':_0x225f85[_0xd276('0x41')],'type':_0x225f85['type']['key']};});_0x395afa[_0xd276('0x42')]=_[_0xd276('0x40')](_0x56b82f,'name');_0x395afa['query']=_[_0xd276('0x43')](_0x22cb89['query']);_0x395afa[_0xd276('0x44')]=_[_0xd276('0x45')](_0x395afa['model'],_0x395afa[_0xd276('0x46')]);_0x5bfaf6[_0xd276('0x47')]=_[_0xd276('0x45')](_0x395afa['model'],qs[_0xd276('0x48')](_0x22cb89[_0xd276('0x46')][_0xd276('0x48')]));_0x5bfaf6[_0xd276('0x47')]=_0x5bfaf6['attributes'][_0xd276('0x49')]?_0x5bfaf6[_0xd276('0x47')]:_0x395afa['model'];if(!_0x22cb89[_0xd276('0x46')]['hasOwnProperty'](_0xd276('0x4a'))){_0x5bfaf6[_0xd276('0x4b')]=qs['limit'](_0x22cb89[_0xd276('0x46')]['limit']);_0x5bfaf6[_0xd276('0x34')]=qs['offset'](_0x22cb89['query']['offset']);}_0x5bfaf6['order']=qs['sort'](_0x22cb89['query']['sort']);_0x5bfaf6[_0xd276('0x4c')]=qs[_0xd276('0x44')](_[_0xd276('0x4d')](_0x22cb89[_0xd276('0x46')],_0x395afa[_0xd276('0x44')]),_0x56b82f);if(_0x22cb89['query'][_0xd276('0x4e')]){_0x5bfaf6['where']=_['merge'](_0x5bfaf6[_0xd276('0x4c')],{'$or':_[_0xd276('0x40')](_0x56b82f,function(_0x4d3ae9){if(_0x4d3ae9[_0xd276('0x4f')]!==_0xd276('0x50')){var _0x346f86={};_0x346f86[_0x4d3ae9[_0xd276('0x3d')]]={'$like':'%'+_0x22cb89['query'][_0xd276('0x4e')]+'%'};return _0x346f86;}})});}_0x5bfaf6=_['merge']({},_0x5bfaf6,_0x22cb89[_0xd276('0x51')]);var _0x560248={'where':_0x5bfaf6[_0xd276('0x4c')]};return db[_0xd276('0x52')][_0xd276('0x36')](_0x560248)[_0xd276('0x24')](function(_0x1908ba){_0x44d7e3[_0xd276('0x36')]=_0x1908ba;if(_0x22cb89[_0xd276('0x46')]['includeAll']){_0x5bfaf6[_0xd276('0x53')]=[{'all':!![]}];}return db[_0xd276('0x52')][_0xd276('0x54')](_0x5bfaf6);})['then'](function(_0x37cc4b){_0x44d7e3[_0xd276('0x55')]=_0x37cc4b;return _0x44d7e3;})[_0xd276('0x24')](respondWithFilteredResult(_0x123b34,_0x5bfaf6))[_0xd276('0x2f')](handleError(_0x123b34,null));};exports[_0xd276('0x56')]=function(_0x23d4af,_0x2a24dc){var _0x13ae83={'raw':!![],'where':{'id':_0x23d4af[_0xd276('0x57')]['id']}},_0x23777f={};_0x23777f[_0xd276('0x42')]=_['keys'](db[_0xd276('0x52')][_0xd276('0x58')]);_0x23777f[_0xd276('0x46')]=_[_0xd276('0x43')](_0x23d4af['query']);_0x23777f[_0xd276('0x44')]=_[_0xd276('0x45')](_0x23777f['model'],_0x23777f['query']);_0x13ae83[_0xd276('0x47')]=_[_0xd276('0x45')](_0x23777f[_0xd276('0x42')],qs[_0xd276('0x48')](_0x23d4af[_0xd276('0x46')][_0xd276('0x48')]));_0x13ae83[_0xd276('0x47')]=_0x13ae83[_0xd276('0x47')][_0xd276('0x49')]?_0x13ae83['attributes']:_0x23777f['model'];if(_0x23d4af[_0xd276('0x46')][_0xd276('0x59')]){_0x13ae83[_0xd276('0x53')]=[{'all':!![]}];}_0x13ae83=_[_0xd276('0x5a')]({},_0x13ae83,_0x23d4af[_0xd276('0x51')]);return db[_0xd276('0x52')]['find'](_0x13ae83)['then'](handleEntityNotFound(_0x2a24dc,null))[_0xd276('0x24')](respondWithResult(_0x2a24dc,null))[_0xd276('0x2f')](handleError(_0x2a24dc,null));};exports['create']=function(_0xb5426c,_0x47ffed){return db['SmsMessage'][_0xd276('0x5b')](_0xb5426c['body'],{})[_0xd276('0x24')](respondWithResult(_0x47ffed,0xc9))['catch'](handleError(_0x47ffed,null));};exports['update']=function(_0x1391ed,_0x5dfc87){if(_0x1391ed['body']['id']){delete _0x1391ed['body']['id'];}return db[_0xd276('0x52')][_0xd276('0x5c')]({'where':{'id':_0x1391ed[_0xd276('0x57')]['id']}})[_0xd276('0x24')](handleEntityNotFound(_0x5dfc87,null))['then'](saveUpdates(_0x1391ed[_0xd276('0x5d')],null))[_0xd276('0x24')](respondWithResult(_0x5dfc87,null))[_0xd276('0x2f')](handleError(_0x5dfc87,null));};exports[_0xd276('0x3b')]=function(_0x2f8a0a,_0x5effa7){return db['SmsMessage']['find']({'where':{'id':_0x2f8a0a[_0xd276('0x57')]['id']}})['then'](handleEntityNotFound(_0x5effa7,null))[_0xd276('0x24')](removeEntity(_0x5effa7,null))[_0xd276('0x2f')](handleError(_0x5effa7,null));};exports['describe']=function(_0x2e07c4,_0x445bd6){return db[_0xd276('0x52')][_0xd276('0x5e')]()[_0xd276('0x24')](respondWithResult(_0x445bd6,null))[_0xd276('0x2f')](handleError(_0x445bd6,null));};var interaction_log=require(_0xd276('0x5f'))(_0xd276('0x60'));exports[_0xd276('0x61')]=function(_0x1a28da,_0x274f86,_0x3a1967){var _0x271ecf={'agent':{},'channel':_0xd276('0x62')};if(_0x1a28da[_0xd276('0x5d')]['id']){delete _0x1a28da['body']['id'];}_0x1a28da[_0xd276('0x5d')][_0xd276('0x63')]=!![];_0x1a28da[_0xd276('0x5d')][_0xd276('0x64')]=moment()[_0xd276('0x65')](_0xd276('0x66'));_0x1a28da[_0xd276('0x5d')][_0xd276('0x67')]=_0x1a28da['body']['UserId']||_0x1a28da[_0xd276('0x68')]['id'];_0x271ecf['agent']['id']=_0x1a28da[_0xd276('0x5d')]['UserId'];return db[_0xd276('0x52')]['find']({'where':{'id':_0x1a28da[_0xd276('0x57')]['id'],'UserId':null}})[_0xd276('0x24')](handleEntityNotFound(_0x274f86,null))[_0xd276('0x24')](saveUpdates(_0x1a28da['body'],null))['then'](function(_0x5b305d){if(_0x5b305d){_0x271ecf[_0xd276('0x2d')]=_0x5b305d[_0xd276('0x69')]({'plain':!![]});return db[_0xd276('0x6a')][_0xd276('0x5c')]({'where':{'id':_0x5b305d['SmsInteractionId']}});}return null;})[_0xd276('0x24')](handleEntityNotFound(_0x274f86,null))[_0xd276('0x24')](function(_0x10c81a){if(_0x10c81a){return _0x10c81a['update']({'UserId':_0x1a28da['body'][_0xd276('0x67')],'read1stAt':_[_0xd276('0x6b')](_0x10c81a[_0xd276('0x6c')])?moment()[_0xd276('0x65')](_0xd276('0x66')):undefined});}return null;})[_0xd276('0x24')](function(_0x2d563f){if(_0x2d563f){_0x271ecf[_0xd276('0x6d')]=_0x2d563f['get']({'plain':!![]});interaction_log[_0xd276('0x25')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1a28da['user']['id'],_0x1a28da[_0xd276('0x68')]['name'],_0x1a28da[_0xd276('0x68')][_0xd276('0x6e')],_0x271ecf['interaction']['id'],_0x1a28da['body']?JSON[_0xd276('0x2a')](_0x1a28da[_0xd276('0x5d')]):_0xd276('0x6f'));return respondWithRpcPromise(_0xd276('0x70'),_0xd276('0x71'),_0x271ecf);}return null;})[_0xd276('0x24')](function(_0x45f25f){var _0x43d9b5=_0xd276('0x72')+_0x45f25f[_0xd276('0x2d')]['ContactId'];return db[_0xd276('0x73')][_0xd276('0x46')](_0x43d9b5,{'type':db[_0xd276('0x74')][_0xd276('0x75')]['SELECT'],'raw':!![]})['then'](function(_0x3d08ec){return _0x3d08ec;});})['then'](function(_0x444577){if(_0x444577){_0x271ecf[_0xd276('0x2d')][_0xd276('0x76')]=_0x444577[0x0];if(!_0x1a28da[_0xd276('0x5d')][_0xd276('0x67')])return;return db[_0xd276('0x77')][_0xd276('0x5c')]({'where':{'id':_0x1a28da[_0xd276('0x5d')][_0xd276('0x67')],'role':'agent'},'attributes':['id',_0xd276('0x3d'),'fullname',_0xd276('0x78'),_0xd276('0x79')],'raw':!![]});}return null;})[_0xd276('0x24')](function(_0x1cf414){if(!_0x1cf414)return null;_0x271ecf[_0xd276('0x2d')][_0xd276('0x7a')]=_0x1cf414;return _0x271ecf;})[_0xd276('0x24')](function(_0x540b1a){if(_0x540b1a){if(_0x1a28da[_0xd276('0x5d')][_0xd276('0x7b')]){_0x271ecf[_0xd276('0x2d')]['interface']=util[_0xd276('0x65')](_0xd276('0x7c'),_0x1a28da[_0xd276('0x68')][_0xd276('0x3d')]);_0x271ecf[_0xd276('0x2d')][_0xd276('0x7d')]=_0x271ecf[_0xd276('0x7d')];_0x271ecf[_0xd276('0x2d')][_0xd276('0x7e')]=_0x271ecf[_0xd276('0x7d')];_0x271ecf[_0xd276('0x2d')][_0xd276('0x7f')]=_0xd276('0x61');return respondWithRpcPromise(_0xd276('0x80'),_0xd276('0x80'),{'event':'acceptmessage','message':_0x271ecf[_0xd276('0x2d')]},client9002)[_0xd276('0x24')](function(){return _0x271ecf;});}return _0x271ecf;}return null;})['then'](respondWithResult(_0x274f86,null))[_0xd276('0x2f')](handleError(_0x274f86,null));};var interaction_log=require(_0xd276('0x5f'))(_0xd276('0x60'));exports[_0xd276('0x81')]=function(_0x1988d3,_0x1a2a8c,_0x86e4e5){var _0x40db82={'agent':{},'channel':'sms'};if(_0x1988d3[_0xd276('0x5d')]['id']){delete _0x1988d3[_0xd276('0x5d')]['id'];}_0x1988d3[_0xd276('0x5d')][_0xd276('0x67')]=_0x1988d3[_0xd276('0x5d')][_0xd276('0x67')]||_0x1988d3[_0xd276('0x68')]['id'];_0x40db82[_0xd276('0x7a')]['id']=_0x1988d3[_0xd276('0x5d')][_0xd276('0x67')];return db[_0xd276('0x52')][_0xd276('0x5c')]({'where':{'id':_0x1988d3[_0xd276('0x57')]['id'],'UserId':null}})[_0xd276('0x24')](handleEntityNotFound(_0x1a2a8c,null))[_0xd276('0x24')](function(_0x3a67b4){if(_0x3a67b4){_0x40db82[_0xd276('0x2d')]=_0x3a67b4[_0xd276('0x69')]({'plain':!![]});return db[_0xd276('0x6a')][_0xd276('0x5c')]({'where':{'id':_0x3a67b4['SmsInteractionId']}});}return null;})[_0xd276('0x24')](handleEntityNotFound(_0x1a2a8c,null))[_0xd276('0x24')](function(_0x4ab084){if(_0x4ab084){_0x40db82[_0xd276('0x6d')]=_0x4ab084['get']({'plain':!![]});interaction_log[_0xd276('0x25')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1988d3['user']['id'],_0x1988d3[_0xd276('0x68')][_0xd276('0x3d')],_0x1988d3[_0xd276('0x68')]['role'],_0x40db82[_0xd276('0x6d')]['id'],_0x1988d3['body']?JSON[_0xd276('0x2a')](_0x1988d3[_0xd276('0x5d')]):_0xd276('0x6f'));return respondWithRpcPromise(_0xd276('0x82'),_0xd276('0x83'),_0x40db82);}return null;})[_0xd276('0x24')](function(_0x59dbd4){var _0x502ebc=_0xd276('0x72')+_0x59dbd4[_0xd276('0x2d')][_0xd276('0x84')];return db[_0xd276('0x73')][_0xd276('0x46')](_0x502ebc,{'type':db[_0xd276('0x74')][_0xd276('0x75')][_0xd276('0x85')],'raw':!![]})['then'](function(_0x35ead1){return _0x35ead1;});})['then'](function(_0x560d2c){if(_0x560d2c){_0x40db82[_0xd276('0x2d')][_0xd276('0x76')]=_0x560d2c[0x0];if(!_0x1988d3[_0xd276('0x5d')][_0xd276('0x67')])return;return db[_0xd276('0x77')][_0xd276('0x5c')]({'where':{'id':_0x1988d3[_0xd276('0x5d')][_0xd276('0x67')],'role':_0xd276('0x7a')},'attributes':['id',_0xd276('0x3d'),_0xd276('0x86'),'email',_0xd276('0x79')],'raw':!![]});}return null;})[_0xd276('0x24')](function(_0x2c1bd5){if(!_0x2c1bd5)return null;_0x40db82[_0xd276('0x2d')]['agent']=_0x2c1bd5;return _0x40db82;})[_0xd276('0x24')](function(_0x1e7de3){if(_0x1e7de3){_0x1e7de3[_0xd276('0x2d')]['interface']=util[_0xd276('0x65')](_0xd276('0x7c'),_0x1988d3['user'][_0xd276('0x3d')]);_0x1e7de3[_0xd276('0x2d')]['channel']=_0x40db82['channel'];_0x1e7de3[_0xd276('0x2d')][_0xd276('0x7e')]=_0x40db82['channel'];_0x1e7de3[_0xd276('0x2d')][_0xd276('0x7f')]='reject';respondWithRpcPromise(_0xd276('0x80'),_0xd276('0x80'),{'event':_0xd276('0x87'),'message':_0x1e7de3['message']},client9002);return _0x40db82;}return null;})[_0xd276('0x24')](respondWithResult(_0x1a2a8c,null))[_0xd276('0x2f')](handleError(_0x1a2a8c,null));};exports[_0xd276('0x31')]=function(_0x293910,_0x1e27ed,_0x3c8fbd){if(_0x293910[_0xd276('0x5d')]['id']){delete _0x293910['body']['id'];}var _0x24dc8f;return db[_0xd276('0x52')]['find']({'where':{'id':_0x293910[_0xd276('0x57')]['id']}})[_0xd276('0x24')](handleEntityNotFound(_0x1e27ed,null))[_0xd276('0x24')](function(_0x4965ea){if(_0x4965ea){_0x24dc8f=_0x4965ea;return db[_0xd276('0x88')][_0xd276('0x5c')]({'where':{'id':_0x4965ea[_0xd276('0x89')]}});}})[_0xd276('0x24')](handleEntityNotFound(_0x1e27ed,null))['then'](function(_0x1cccf9){if(_0x1cccf9){logger[_0xd276('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xd276('0x8a'),_0x1cccf9['type'],util[_0xd276('0x8b')](_0x293910[_0xd276('0x5d')],{'showHidden':![],'depth':null}));switch(_0x1cccf9['type']){case _0xd276('0x8c'):if(_0x293910[_0xd276('0x5d')][_0xd276('0x8d')]&&_0x293910['body'][_0xd276('0x8d')]===_0x24dc8f[_0xd276('0x8e')]){return _0x24dc8f['update']({'read':!![]});}else{logger[_0xd276('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd276('0x31'),_0xd276('0x8c'),util[_0xd276('0x8b')](_0x293910[_0xd276('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xd276('0x8f'):if(_0x293910[_0xd276('0x5d')]['MessageUUID']&&_0x293910[_0xd276('0x5d')][_0xd276('0x90')]===_0x24dc8f[_0xd276('0x8e')]&&_[_0xd276('0x91')]([_0xd276('0x92'),_0xd276('0x93')],_0x293910[_0xd276('0x5d')][_0xd276('0x94')])>=0x0){return _0x24dc8f['update']({'read':!![]});}else{logger[_0xd276('0x2b')](_0xd276('0x95'),_0xd276('0x31'),_0xd276('0x96'),util[_0xd276('0x8b')](_0x293910[_0xd276('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xd276('0x97'):var _0x42d21a=_0x293910['body'][_0xd276('0x98')][0x0];if(_0x42d21a[_0xd276('0x31')][_0xd276('0x99')]===_0xd276('0x9a')){return _0x24dc8f[_0xd276('0x3a')]({'read':!![]});}else{logger['error'](_0xd276('0x95'),_0xd276('0x31'),'infobip',util[_0xd276('0x8b')](_0x293910[_0xd276('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x24dc8f;}})[_0xd276('0x24')](respondWithResult(_0x1e27ed,null))[_0xd276('0x2f')](handleError(_0x1e27ed,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 6a39ac8..521faaf 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 _0x3890=['emit','hook','events','save','update','remove'];(function(_0x3e7876,_0x3adc33){var _0x36c2ff=function(_0x12250f){while(--_0x12250f){_0x3e7876['push'](_0x3e7876['shift']());}};_0x36c2ff(++_0x3adc33);}(_0x3890,0xb6));var _0x0389=function(_0x4abd7c,_0x21672a){_0x4abd7c=_0x4abd7c-0x0;var _0x1dc9e4=_0x3890[_0x4abd7c];return _0x1dc9e4;};'use strict';var EventEmitter=require(_0x0389('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0389('0x1'),'afterUpdate':_0x0389('0x2'),'afterDestroy':_0x0389('0x3')};function emitEvent(_0x2da8a5){return function(_0x296892,_0x23cdb8,_0x39e74c){SmsMessageEvents[_0x0389('0x4')](_0x2da8a5+':'+_0x296892['id'],_0x296892);SmsMessageEvents[_0x0389('0x4')](_0x2da8a5,_0x296892);_0x39e74c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x0389('0x5')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xadc9=['events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x25b926,_0x341f07){var _0x4edf2d=function(_0x25aa07){while(--_0x25aa07){_0x25b926['push'](_0x25b926['shift']());}};_0x4edf2d(++_0x341f07);}(_0xadc9,0x1f4));var _0x9adc=function(_0xc810df,_0x54e865){_0xc810df=_0xc810df-0x0;var _0x4ef5e1=_0xadc9[_0xc810df];return _0x4ef5e1;};'use strict';var EventEmitter=require(_0x9adc('0x0'));var SmsMessage=require(_0x9adc('0x1'))['db'][_0x9adc('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x9adc('0x3')](0x0);var events={'afterCreate':_0x9adc('0x4'),'afterUpdate':_0x9adc('0x5'),'afterDestroy':_0x9adc('0x6')};function emitEvent(_0x2fd555){return function(_0x54e7bb,_0xf7e50e,_0x5781b3){SmsMessageEvents[_0x9adc('0x7')](_0x2fd555+':'+_0x54e7bb['id'],_0x54e7bb);SmsMessageEvents[_0x9adc('0x7')](_0x2fd555,_0x54e7bb);_0x5781b3(null);};}for(var e in events){if(events[_0x9adc('0x8')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x9adc('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 1464200..db4d93f 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 _0x4b00=['define','SmsMessage','sms_messages','messageId','fti_sms_messages','models','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','body','smsMethod','login?username=','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','head','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','plivo','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','csc','crypto','apiKey','login','text','timestamp','sort','length','createHash','digest','hex','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','application/json','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','request-promise','path','../../config/environment','./smsMessage.attributes'];(function(_0x231654,_0x132b62){var _0x448af3=function(_0xd482b9){while(--_0xd482b9){_0x231654['push'](_0x231654['shift']());}};_0x448af3(++_0x132b62);}(_0x4b00,0x77));var _0x04b0=function(_0x5df830,_0x5e2506){_0x5df830=_0x5df830-0x0;var _0x1deb62=_0x4b00[_0x5df830];return _0x1deb62;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x04b0('0x0'))('api');var moment=require(_0x04b0('0x1'));var BPromise=require('bluebird');var rp=require(_0x04b0('0x2'));var fs=require('fs');var path=require(_0x04b0('0x3'));var rimraf=require('rimraf');var config=require(_0x04b0('0x4'));var attributes=require(_0x04b0('0x5'));module['exports']=function(_0x1a972f,_0x4cea82){return _0x1a972f[_0x04b0('0x6')](_0x04b0('0x7'),attributes,{'tableName':_0x04b0('0x8'),'paranoid':![],'indexes':[{'name':_0x04b0('0x9'),'fields':[_0x04b0('0x9')]},{'name':_0x04b0('0xa'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x311cb7,_0x1e2306,_0x26369b){var _0x34b92f=_0x1a972f[_0x04b0('0xb')];var _0x46271b=_0x311cb7[_0x04b0('0xc')]({'plain':!![]});if(_0x46271b[_0x04b0('0xd')][_0x04b0('0xe')]()==='in'||_0x46271b[_0x04b0('0xd')][_0x04b0('0xe')]()===_0x04b0('0xf')&&!_0x46271b[_0x04b0('0x10')]&&!_[_0x04b0('0x11')](_0x46271b['UserId'])&&!_[_0x04b0('0x11')](_0x46271b[_0x04b0('0x12')])){_0x34b92f[_0x04b0('0x13')][_0x04b0('0x14')]({'where':{'id':_0x46271b[_0x04b0('0x12')]}})[_0x04b0('0x15')](function(_0x2c6d1d){if(_0x2c6d1d){_0x2c6d1d[_0x04b0('0x16')]({'lastMsgAt':_0x46271b[_0x04b0('0x17')],'lastMsgDirection':_0x46271b[_0x04b0('0xd')]['toLowerCase']()});}})[_0x04b0('0x18')](function(_0x706ffa){console['error'](_0x706ffa);});}if(_0x46271b[_0x04b0('0xd')]==='out'&&!_0x46271b['secret']){var _0x5a6a47;_0x34b92f[_0x04b0('0x19')][_0x04b0('0x1a')]({'where':{'id':_0x46271b[_0x04b0('0x1b')]},'raw':!![]})[_0x04b0('0x15')](function(_0x3dfa01){_0x5a6a47=_0x3dfa01;if(_0x5a6a47&&_0x5a6a47[_0x04b0('0x1c')]){switch(_0x5a6a47[_0x04b0('0x1c')]){case _0x04b0('0x1d'):var _0x839ff6=require('twilio');if(_0x5a6a47[_0x04b0('0x1e')]&&_0x5a6a47['authToken']&&_0x5a6a47[_0x04b0('0x1f')]){var _0x4726ae=new _0x839ff6(_0x5a6a47[_0x04b0('0x1e')],_0x5a6a47[_0x04b0('0x20')]);_0x4726ae[_0x04b0('0x21')][_0x04b0('0x22')]({'body':_0x46271b['body'],'to':_0x46271b['phone'],'from':_0x5a6a47[_0x04b0('0x1f')],'statusCallback':_0x5a6a47[_0x04b0('0x23')]+_0x04b0('0x24')+_0x46271b['id']+_0x04b0('0x25')+_0x5a6a47[_0x04b0('0x26')]})[_0x04b0('0x15')](function(_0x1b1dd9){if(_0x1b1dd9[_0x04b0('0x27')]){return _0x311cb7[_0x04b0('0x16')]({'messageId':_0x1b1dd9[_0x04b0('0x27')]});}})['catch'](function(_0x45042b){logger[_0x04b0('0x28')](_0x04b0('0x29'),'afterCreate','twilio',util[_0x04b0('0x2a')](_0x45042b,{'showHidden':![],'depth':null}));});}else{logger[_0x04b0('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x04b0('0x2b'),_0x04b0('0x1d'),_0x04b0('0x2c'));}break;case _0x04b0('0x2d'):var _0x2c49b3=_0x04b0('0x2e');if(_0x5a6a47[_0x04b0('0x2f')]&&_0x5a6a47[_0x04b0('0x30')]){var _0x2d7423={'recipient':[_0x46271b[_0x04b0('0x1f')]],'message':_0x46271b[_0x04b0('0x31')],'message_type':_0x5a6a47['smsMethod']};if(_0x5a6a47[_0x04b0('0x32')]&&_0x5a6a47['smsMethod']!=='SI'){_0x2d7423['sender']=_0x5a6a47['phone'];}var _0x3720d7={'url':_0x2c49b3+_0x04b0('0x33')+_0x5a6a47[_0x04b0('0x2f')]+'&password='+_0x5a6a47['password'],'method':_0x04b0('0x34')};rp(_0x3720d7)['then'](function(_0x5599ff){var _0x5131a7=_0x5599ff[_0x04b0('0x35')](';');var _0x26d146={'user_key':_0x5131a7[0x0],'session_key':_0x5131a7[0x1]};_0x3720d7={'url':_0x2c49b3+_0x04b0('0x36'),'method':_0x04b0('0x37'),'headers':{'user_key':_0x26d146[_0x04b0('0x38')],'Session_key':_0x26d146[_0x04b0('0x39')]},'json':!![],'body':_0x2d7423};return rp(_0x3720d7);})[_0x04b0('0x15')](function(_0x37c1f8){if(_0x37c1f8[_0x04b0('0x3a')]>=0x1){var _0x103597={'messageId':_0x37c1f8['internal_order_id']};if(_0x5a6a47[_0x04b0('0x32')]!=='GP'||!_0x5a6a47[_0x04b0('0x3b')]){_0x103597[_0x04b0('0x3c')]=!![];}return _0x311cb7['update'](_0x103597);}else{return logger[_0x04b0('0x28')](_0x04b0('0x29'),_0x04b0('0x2b'),'skebby',util['inspect'](_0x37c1f8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x18bb61){return logger[_0x04b0('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x04b0('0x2b'),'skebby',util[_0x04b0('0x2a')](_0x18bb61,{'showHidden':![],'depth':null}));});}else{logger[_0x04b0('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x04b0('0x2b'),'skebby',_0x04b0('0x3d'));}break;case'connectel':if(_0x5a6a47[_0x04b0('0x20')]){var _0x941765={'recipient':_0x46271b['phone'],'message':_0x46271b[_0x04b0('0x31')],'sender':_0x5a6a47[_0x04b0('0x3e')]||_0x5a6a47[_0x04b0('0x1f')],'authorization':_0x5a6a47[_0x04b0('0x20')]};var _0x1e2306={'method':_0x04b0('0x37'),'uri':_0x04b0('0x3f'),'body':_0x941765,'json':!![]};rp(_0x1e2306)[_0x04b0('0x15')](function(_0x13ddd2){var _0x4bb8fd={'messageId':_0x13ddd2[_0x04b0('0x40')]};if(!_0x5a6a47['deliveryReport']){_0x4bb8fd[_0x04b0('0x3c')]=!![];}return _0x311cb7[_0x04b0('0x16')](_0x4bb8fd);})[_0x04b0('0x18')](function(_0x40b740){logger['error'](_0x04b0('0x29'),'afterCreate',_0x04b0('0x41'),util[_0x04b0('0x2a')](_0x40b740,{'showHidden':![],'depth':null}));});}else{logger[_0x04b0('0x28')](_0x04b0('0x29'),_0x04b0('0x2b'),_0x04b0('0x41'),_0x04b0('0x42'));}break;case _0x04b0('0x43'):if(_0x5a6a47[_0x04b0('0x2f')]&&_0x5a6a47[_0x04b0('0x30')]){var _0x941765={'messages':[{'source':_0x04b0('0x44'),'to':_0x46271b[_0x04b0('0x1f')],'body':_0x46271b['body'],'from':_0x5a6a47[_0x04b0('0x3e')]||_0x5a6a47[_0x04b0('0x1f')]}]};var _0xa38444=util[_0x04b0('0x45')](_0x04b0('0x46'),_0x5a6a47[_0x04b0('0x2f')],_0x5a6a47[_0x04b0('0x30')]);var _0x1e2306={'method':'POST','uri':_0x04b0('0x47'),'body':_0x941765,'headers':{'Authorization':util[_0x04b0('0x45')]('Basic\x20%s',new Buffer(_0xa38444)[_0x04b0('0x48')](_0x04b0('0x49')))},'json':!![]};rp(_0x1e2306)[_0x04b0('0x15')](function(_0x1b8848){if(_0x1b8848[_0x04b0('0x4a')]>=0xc8&&_0x1b8848[_0x04b0('0x4a')]<=0xce){if(_0x1b8848[_0x04b0('0x4b')]&&_0x1b8848['data']['queued_count']>0x0){var _0x231625=_[_0x04b0('0x4c')](_0x1b8848[_0x04b0('0x4b')][_0x04b0('0x21')]);var _0x5bd8f2={'messageId':_0x231625[_0x04b0('0x4d')]};if(!_0x5a6a47[_0x04b0('0x3b')]){_0x5bd8f2[_0x04b0('0x3c')]=!![];}return _0x311cb7[_0x04b0('0x16')](_0x5bd8f2);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x04b0('0x2b'),_0x04b0('0x4e'),util['inspect'](_0x1b8848,{'showHidden':![],'depth':null}));}}else{logger[_0x04b0('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x04b0('0x2b'),_0x04b0('0x4e'),util[_0x04b0('0x2a')](_0x1b8848,{'showHidden':![],'depth':null}));}})[_0x04b0('0x18')](function(_0x23b618){logger[_0x04b0('0x28')](_0x04b0('0x29'),_0x04b0('0x2b'),'clickSend',util[_0x04b0('0x2a')](_0x23b618,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x04b0('0x29'),_0x04b0('0x2b'),_0x04b0('0x4e'),_0x04b0('0x3d'));}break;case'plivo':if(_0x5a6a47[_0x04b0('0x4f')]&&_0x5a6a47[_0x04b0('0x20')]){var _0x941765={'dst':_0x46271b[_0x04b0('0x1f')],'text':_0x46271b[_0x04b0('0x31')],'src':_0x5a6a47[_0x04b0('0x3e')]||_0x5a6a47[_0x04b0('0x1f')],'url':_0x5a6a47['remote']+'/api/sms/messages/'+_0x46271b['id']+'/status?token='+_0x5a6a47[_0x04b0('0x26')]};var _0xa38444=util[_0x04b0('0x45')](_0x04b0('0x46'),_0x5a6a47[_0x04b0('0x4f')],_0x5a6a47[_0x04b0('0x20')]);var _0x1e2306={'method':_0x04b0('0x37'),'uri':util[_0x04b0('0x45')](_0x04b0('0x50'),_0x5a6a47[_0x04b0('0x4f')]),'body':_0x941765,'headers':{'Authorization':util[_0x04b0('0x45')](_0x04b0('0x51'),new Buffer(_0xa38444)['toString'](_0x04b0('0x49')))},'json':!![]};rp(_0x1e2306)[_0x04b0('0x15')](function(_0x2e7974){var _0x34c861={'messageId':_0x2e7974['message_uuid'][0x0]};return _0x311cb7['update'](_0x34c861);})[_0x04b0('0x18')](function(_0x34ee26){logger[_0x04b0('0x28')](_0x04b0('0x29'),_0x04b0('0x2b'),_0x04b0('0x52'),util[_0x04b0('0x2a')](_0x34ee26,{'showHidden':![],'depth':null}));});}else{logger[_0x04b0('0x28')](_0x04b0('0x29'),'afterCreate',_0x04b0('0x52'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x04b0('0x53'):if(_0x5a6a47[_0x04b0('0x2f')]&&_0x5a6a47[_0x04b0('0x30')]){if(_0x5a6a47[_0x04b0('0x54')]){var _0x97a76b={'method':'POST','uri':_0x5a6a47[_0x04b0('0x54')]+_0x04b0('0x55'),'body':{'username':_0x5a6a47[_0x04b0('0x2f')],'password':_0x5a6a47[_0x04b0('0x30')]},'json':!![]};return rp(_0x97a76b)['then'](function(_0x3e5c76){var _0x7c21ba={'method':_0x04b0('0x37'),'uri':_0x5a6a47[_0x04b0('0x54')]+_0x04b0('0x56'),'body':{'messages':[{'from':_0x5a6a47[_0x04b0('0x1f')],'destinations':[{'to':_0x46271b['phone']}],'text':_0x46271b[_0x04b0('0x31')],'notifyUrl':_0x5a6a47[_0x04b0('0x23')]+_0x04b0('0x24')+_0x46271b['id']+'/status?token='+_0x5a6a47[_0x04b0('0x26')],'notifyContentType':'application/json','callbackData':_0x5a6a47[_0x04b0('0x1f')]+';'+_0x46271b[_0x04b0('0x31')]}]},'headers':{'Authorization':_0x04b0('0x57')+_0x3e5c76[_0x04b0('0x26')]},'json':!![]};return rp(_0x7c21ba)[_0x04b0('0x15')](function(_0x327a8a){if(_0x327a8a[_0x04b0('0x21')]){var _0x237535={'messageId':_0x327a8a['messages'][0x0]['messageId']};if(!_0x5a6a47[_0x04b0('0x3b')]){_0x237535['read']=!![];}return _0x311cb7[_0x04b0('0x16')](_0x237535);}else{return logger[_0x04b0('0x28')](_0x04b0('0x29'),_0x04b0('0x2b'),_0x04b0('0x53'),util['inspect'](_0x327a8a,{'showHidden':![],'depth':null}));}});})[_0x04b0('0x18')](function(_0x53af58){return logger[_0x04b0('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x04b0('0x2b'),'infobip',util['inspect'](_0x53af58,{'showHidden':![],'depth':null}));});}else{logger[_0x04b0('0x28')](_0x04b0('0x29'),'afterCreate','infobip','Missing\x20parameters:\x20base_url');}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x04b0('0x2b'),'infobip',_0x04b0('0x3d'));}break;case _0x04b0('0x58'):var _0x5354d7=require(_0x04b0('0x59'));if(_0x5a6a47[_0x04b0('0x5a')]){var _0x51035d={};_0x51035d[_0x04b0('0x5b')]=_0x5a6a47[_0x04b0('0x2f')];_0x51035d['phone']=_0x46271b['phone'];_0x51035d['sender']=_0x5a6a47[_0x04b0('0x1f')];_0x51035d[_0x04b0('0x5c')]=_0x46271b[_0x04b0('0x31')];_0x51035d[_0x04b0('0x5d')]=+new Date();var _0x5bcffa='';var _0x370025='';var _0x4e5e35=Object['keys'](_0x51035d);_0x4e5e35[_0x04b0('0x5e')]();for(var _0xb036fc=0x0;_0xb036fc<_0x4e5e35[_0x04b0('0x5f')];_0xb036fc++){if(_0x5bcffa!=''){_0x5bcffa+='&';}_0x5bcffa+=_0x4e5e35[_0xb036fc]+'='+encodeURIComponent(_0x51035d[_0x4e5e35[_0xb036fc]]);_0x370025+=_0x51035d[_0x4e5e35[_0xb036fc]];}_0x370025+=_0x5a6a47[_0x04b0('0x5a')];_0x370025=_0x5354d7[_0x04b0('0x60')]('md5')[_0x04b0('0x16')](_0x370025)[_0x04b0('0x61')](_0x04b0('0x62'));if(_0x5bcffa!==''){_0x5bcffa+='&';}_0x5bcffa+=_0x04b0('0x63')+_0x370025;var _0x3720d7={'method':_0x04b0('0x34'),'uri':_0x5a6a47[_0x04b0('0x54')]+_0x04b0('0x64')+_0x5bcffa,'json':!![]};return rp(_0x3720d7)['then'](function(_0x5e6df1){var _0x3b6846=Object[_0x04b0('0x65')](_0x5e6df1);if(_0x5e6df1[_0x3b6846[0x0]]['error']&&parseInt(_0x5e6df1[_0x3b6846[0x0]][_0x04b0('0x28')])===0x0){var _0x436036={'messageId':_0x5e6df1[_0x3b6846[0x0]][_0x04b0('0x66')]};if(!_0x5a6a47[_0x04b0('0x3b')]){_0x436036['read']=!![];}return _0x311cb7['update'](_0x436036);}else{return logger['error'](_0x04b0('0x29'),_0x04b0('0x2b'),_0x04b0('0x58'),util[_0x04b0('0x2a')](_0x5e6df1[_0x04b0('0x28')],{'showHidden':![],'depth':null}));}})[_0x04b0('0x18')](function(_0x42a65b){return logger[_0x04b0('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x04b0('0x2b'),_0x04b0('0x58'),util['inspect'](_0x42a65b,{'showHidden':![],'depth':null}));});}else{logger[_0x04b0('0x28')](_0x04b0('0x29'),'afterCreate',_0x04b0('0x58'),_0x04b0('0x67'));}break;case'clickatell':if(_0x5a6a47[_0x04b0('0x5a')]){var _0x3a4d41={'method':_0x04b0('0x37'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x5a6a47[_0x04b0('0x5a')]},'body':{'content':_0x46271b['body'],'to':[_0x46271b[_0x04b0('0x1f')]],'from':_0x5a6a47['phone'],'binary':![],'clientMessageId':_0x04b0('0x68'),'charset':_0x04b0('0x69')},'json':!![]};rp(_0x3a4d41)[_0x04b0('0x15')](function(_0x2de623){if(!_0x2de623[_0x04b0('0x28')]){var _0x851b52={'messageId':_0x2de623['messages'][0x0][_0x04b0('0x6a')]};if(!_0x5a6a47[_0x04b0('0x3b')]){_0x851b52[_0x04b0('0x3c')]=!![];}return _0x311cb7[_0x04b0('0x16')](_0x851b52);}else{return logger[_0x04b0('0x28')](_0x04b0('0x29'),'afterCreate',_0x04b0('0x6b'),util['inspect'](_0x2de623[_0x04b0('0x28')],{'showHidden':![],'depth':null}));}})[_0x04b0('0x18')](function(_0x4f5260){return logger['error'](_0x04b0('0x29'),_0x04b0('0x2b'),_0x04b0('0x6b'),util['inspect'](_0x4f5260,{'showHidden':![],'depth':null}));});}else{logger[_0x04b0('0x28')](_0x04b0('0x29'),'afterCreate','clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x04b0('0x6c'):if(_0x5a6a47['username']&&_0x5a6a47[_0x04b0('0x30')]){var _0xa38444=util[_0x04b0('0x45')](_0x04b0('0x46'),_0x5a6a47['username'],_0x5a6a47['password']);var _0x1e2306={'method':_0x04b0('0x37'),'uri':_0x04b0('0x6d')+_0x5a6a47[_0x04b0('0x6e')]+_0x04b0('0x6f'),'body':{'to':[_0x46271b[_0x04b0('0x1f')]],'text':_0x46271b[_0x04b0('0x31')],'from':_0x5a6a47[_0x04b0('0x1f')],'applicationId':_0x5a6a47[_0x04b0('0x70')]},'headers':{'Authorization':util[_0x04b0('0x45')](_0x04b0('0x51'),new Buffer(_0xa38444)[_0x04b0('0x48')]('base64'))},'json':!![]};rp(_0x1e2306)[_0x04b0('0x15')](function(_0x87fe6f){if(_0x87fe6f['id']){var _0x5917e3={'messageId':_0x87fe6f['id']};return _0x311cb7[_0x04b0('0x16')](_0x5917e3);}else{logger[_0x04b0('0x28')](_0x04b0('0x29'),_0x04b0('0x2b'),_0x04b0('0x6c'),util[_0x04b0('0x2a')](_0x87fe6f,{'showHidden':![],'depth':null}));}})[_0x04b0('0x18')](function(_0x3e0fe2){logger['error'](_0x04b0('0x29'),_0x04b0('0x2b'),'bandwidth',util[_0x04b0('0x2a')](_0x3e0fe2,{'showHidden':![],'depth':null}));});}else{logger[_0x04b0('0x28')](_0x04b0('0x29'),'afterCreate',_0x04b0('0x6c'),_0x04b0('0x3d'));}break;case _0x04b0('0x71'):if(_0x5a6a47[_0x04b0('0x5a')]){var _0x31ff74={};var _0x3720d7={'method':_0x04b0('0x37'),'uri':_0x04b0('0x72'),'headers':{'Authorization':_0x04b0('0x73')+_0x5a6a47['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x5a6a47[_0x04b0('0x1f')],'to':_0x46271b[_0x04b0('0x1f')],'text':_0x46271b[_0x04b0('0x31')]},'json':!![]};return rp(_0x3720d7)[_0x04b0('0x15')](function(_0x4b5dd2){if(_0x4b5dd2[_0x04b0('0x74')]==0xca){_0x31ff74[_0x04b0('0x75')]=_0x4b5dd2;var _0xd1f225={'method':_0x04b0('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x5a6a47[_0x04b0('0x5a')],'Content-Type':_0x04b0('0x76')},'body':{'refid':_0x31ff74['message'][_0x04b0('0x77')]},'json':!![]};return rp(_0xd1f225)['then'](function(_0x13499a){_0x31ff74[_0x04b0('0x78')]=_0x13499a;var _0x37d147={'messageId':_0x31ff74[_0x04b0('0x75')]['refid'],'read':!![]};return _0x311cb7['update'](_0x37d147);});}else{return logger[_0x04b0('0x28')](_0x04b0('0x29'),'afterCreate',_0x04b0('0x71'),util[_0x04b0('0x2a')](_0x4b5dd2,{'showHidden':![],'depth':null}));}})['catch'](function(_0x22a3b3){return logger[_0x04b0('0x28')](_0x04b0('0x29'),'afterCreate',_0x04b0('0x71'),util[_0x04b0('0x2a')](_0x22a3b3,{'showHidden':![],'depth':null}));});}else{return logger[_0x04b0('0x28')](_0x04b0('0x29'),_0x04b0('0x2b'),_0x04b0('0x71'),_0x04b0('0x79'));}break;}}})[_0x04b0('0x7a')](function(){_0x26369b();});}else{_0x26369b();}}},'charset':_0x04b0('0x7b'),'collate':_0x04b0('0x7c')});}; \ No newline at end of file +var _0x105b=['Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','crypto','apiKey','login','text','keys','sort','length','digest','hex','signature=','GET','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','split','sms','user_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','format','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','data','queued_count','head','clickSend','plivo','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid'];(function(_0xa180e,_0x563612){var _0x2a3210=function(_0x2cee9d){while(--_0x2cee9d){_0xa180e['push'](_0xa180e['shift']());}};_0x2a3210(++_0x563612);}(_0x105b,0x11f));var _0xb105=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x105b[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xb105('0x0'));var util=require(_0xb105('0x1'));var logger=require(_0xb105('0x2'))(_0xb105('0x3'));var moment=require(_0xb105('0x4'));var BPromise=require(_0xb105('0x5'));var rp=require(_0xb105('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb105('0x7'));var config=require(_0xb105('0x8'));var attributes=require('./smsMessage.attributes');module[_0xb105('0x9')]=function(_0x534873,_0x1c7ae3){return _0x534873[_0xb105('0xa')](_0xb105('0xb'),attributes,{'tableName':_0xb105('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xb105('0xd')]},{'name':_0xb105('0xe'),'fields':[_0xb105('0xf')],'type':_0xb105('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41feef,_0x2ae852,_0x874dc){var _0x53ce99=_0x534873['models'];var _0x2be20c=_0x41feef['get']({'plain':!![]});if(_0x2be20c[_0xb105('0x11')]['toLowerCase']()==='in'||_0x2be20c[_0xb105('0x11')][_0xb105('0x12')]()===_0xb105('0x13')&&!_0x2be20c[_0xb105('0x14')]&&!_[_0xb105('0x15')](_0x2be20c[_0xb105('0x16')])&&!_[_0xb105('0x15')](_0x2be20c['SmsInteractionId'])){_0x53ce99[_0xb105('0x17')]['findOne']({'where':{'id':_0x2be20c[_0xb105('0x18')]}})[_0xb105('0x19')](function(_0x106996){if(_0x106996){_0x106996[_0xb105('0x1a')]({'lastMsgAt':_0x2be20c[_0xb105('0x1b')],'lastMsgDirection':_0x2be20c['direction'][_0xb105('0x12')]()});}})['catch'](function(_0x58159b){console['error'](_0x58159b);});}if(_0x2be20c[_0xb105('0x11')]===_0xb105('0x13')&&!_0x2be20c[_0xb105('0x14')]){var _0x4f0532;_0x53ce99['SmsAccount']['find']({'where':{'id':_0x2be20c[_0xb105('0x1c')]},'raw':!![]})[_0xb105('0x19')](function(_0x454be6){_0x4f0532=_0x454be6;if(_0x4f0532&&_0x4f0532[_0xb105('0x1d')]){switch(_0x4f0532['type']){case _0xb105('0x1e'):var _0x49a810=require('twilio');if(_0x4f0532[_0xb105('0x1f')]&&_0x4f0532[_0xb105('0x20')]&&_0x4f0532[_0xb105('0x21')]){var _0x24a6bd=new _0x49a810(_0x4f0532['accountSid'],_0x4f0532[_0xb105('0x20')]);_0x24a6bd[_0xb105('0x22')][_0xb105('0x23')]({'body':_0x2be20c[_0xb105('0xf')],'to':_0x2be20c[_0xb105('0x21')],'from':_0x4f0532[_0xb105('0x21')],'statusCallback':_0x4f0532[_0xb105('0x24')]+_0xb105('0x25')+_0x2be20c['id']+_0xb105('0x26')+_0x4f0532[_0xb105('0x27')]})['then'](function(_0x4174a2){if(_0x4174a2[_0xb105('0x28')]){return _0x41feef[_0xb105('0x1a')]({'messageId':_0x4174a2[_0xb105('0x28')]});}})[_0xb105('0x29')](function(_0x294af8){logger[_0xb105('0x2a')](_0xb105('0x2b'),_0xb105('0x2c'),_0xb105('0x1e'),util[_0xb105('0x2d')](_0x294af8,{'showHidden':![],'depth':null}));});}else{logger[_0xb105('0x2a')](_0xb105('0x2b'),_0xb105('0x2c'),_0xb105('0x1e'),_0xb105('0x2e'));}break;case _0xb105('0x2f'):var _0x4262f6=_0xb105('0x30');if(_0x4f0532[_0xb105('0x31')]&&_0x4f0532[_0xb105('0x32')]){var _0x53fb07={'recipient':[_0x2be20c[_0xb105('0x21')]],'message':_0x2be20c[_0xb105('0xf')],'message_type':_0x4f0532[_0xb105('0x33')]};if(_0x4f0532['smsMethod']&&_0x4f0532['smsMethod']!=='SI'){_0x53fb07[_0xb105('0x34')]=_0x4f0532[_0xb105('0x21')];}var _0x516fda={'url':_0x4262f6+_0xb105('0x35')+_0x4f0532[_0xb105('0x31')]+'&password='+_0x4f0532[_0xb105('0x32')],'method':'GET'};rp(_0x516fda)[_0xb105('0x19')](function(_0x4a94a7){var _0x4a6260=_0x4a94a7[_0xb105('0x36')](';');var _0x1e22f8={'user_key':_0x4a6260[0x0],'session_key':_0x4a6260[0x1]};_0x516fda={'url':_0x4262f6+_0xb105('0x37'),'method':'POST','headers':{'user_key':_0x1e22f8[_0xb105('0x38')],'Session_key':_0x1e22f8['session_key']},'json':!![],'body':_0x53fb07};return rp(_0x516fda);})['then'](function(_0x525c42){if(_0x525c42[_0xb105('0x39')]>=0x1){var _0x24280e={'messageId':_0x525c42[_0xb105('0x3a')]};if(_0x4f0532[_0xb105('0x33')]!=='GP'||!_0x4f0532[_0xb105('0x3b')]){_0x24280e[_0xb105('0x3c')]=!![];}return _0x41feef[_0xb105('0x1a')](_0x24280e);}else{return logger['error'](_0xb105('0x2b'),_0xb105('0x2c'),_0xb105('0x2f'),util[_0xb105('0x2d')](_0x525c42,{'showHidden':![],'depth':null}));}})['catch'](function(_0x7692d){return logger[_0xb105('0x2a')](_0xb105('0x2b'),_0xb105('0x2c'),'skebby',util['inspect'](_0x7692d,{'showHidden':![],'depth':null}));});}else{logger[_0xb105('0x2a')](_0xb105('0x2b'),_0xb105('0x2c'),_0xb105('0x2f'),_0xb105('0x3d'));}break;case _0xb105('0x3e'):if(_0x4f0532['authToken']){var _0x4725d0={'recipient':_0x2be20c[_0xb105('0x21')],'message':_0x2be20c[_0xb105('0xf')],'sender':_0x4f0532[_0xb105('0x3f')]||_0x4f0532[_0xb105('0x21')],'authorization':_0x4f0532[_0xb105('0x20')]};var _0x2ae852={'method':'POST','uri':_0xb105('0x40'),'body':_0x4725d0,'json':!![]};rp(_0x2ae852)[_0xb105('0x19')](function(_0xdfd48){var _0x35d9fc={'messageId':_0xdfd48['requestid']};if(!_0x4f0532[_0xb105('0x3b')]){_0x35d9fc[_0xb105('0x3c')]=!![];}return _0x41feef[_0xb105('0x1a')](_0x35d9fc);})['catch'](function(_0x79a74c){logger[_0xb105('0x2a')](_0xb105('0x2b'),_0xb105('0x2c'),_0xb105('0x3e'),util[_0xb105('0x2d')](_0x79a74c,{'showHidden':![],'depth':null}));});}else{logger[_0xb105('0x2a')](_0xb105('0x2b'),_0xb105('0x2c'),_0xb105('0x3e'),_0xb105('0x41'));}break;case _0xb105('0x42'):if(_0x4f0532[_0xb105('0x31')]&&_0x4f0532[_0xb105('0x32')]){var _0x4725d0={'messages':[{'source':'xCALLY\x20Motion','to':_0x2be20c[_0xb105('0x21')],'body':_0x2be20c[_0xb105('0xf')],'from':_0x4f0532[_0xb105('0x3f')]||_0x4f0532[_0xb105('0x21')]}]};var _0x1b0ee2=util[_0xb105('0x43')]('%s:%s',_0x4f0532[_0xb105('0x31')],_0x4f0532[_0xb105('0x32')]);var _0x2ae852={'method':_0xb105('0x44'),'uri':_0xb105('0x45'),'body':_0x4725d0,'headers':{'Authorization':util[_0xb105('0x43')](_0xb105('0x46'),new Buffer(_0x1b0ee2)[_0xb105('0x47')](_0xb105('0x48')))},'json':!![]};rp(_0x2ae852)[_0xb105('0x19')](function(_0x2c85bd){if(_0x2c85bd['http_code']>=0xc8&&_0x2c85bd['http_code']<=0xce){if(_0x2c85bd[_0xb105('0x49')]&&_0x2c85bd[_0xb105('0x49')][_0xb105('0x4a')]>0x0){var _0x613b20=_[_0xb105('0x4b')](_0x2c85bd[_0xb105('0x49')]['messages']);var _0x5c64b1={'messageId':_0x613b20['message_id']};if(!_0x4f0532[_0xb105('0x3b')]){_0x5c64b1[_0xb105('0x3c')]=!![];}return _0x41feef[_0xb105('0x1a')](_0x5c64b1);}else{logger[_0xb105('0x2a')](_0xb105('0x2b'),_0xb105('0x2c'),_0xb105('0x4c'),util[_0xb105('0x2d')](_0x2c85bd,{'showHidden':![],'depth':null}));}}else{logger[_0xb105('0x2a')](_0xb105('0x2b'),'afterCreate',_0xb105('0x4c'),util[_0xb105('0x2d')](_0x2c85bd,{'showHidden':![],'depth':null}));}})[_0xb105('0x29')](function(_0x1573bc){logger['error'](_0xb105('0x2b'),'afterCreate',_0xb105('0x4c'),util[_0xb105('0x2d')](_0x1573bc,{'showHidden':![],'depth':null}));});}else{logger[_0xb105('0x2a')](_0xb105('0x2b'),_0xb105('0x2c'),_0xb105('0x4c'),_0xb105('0x3d'));}break;case _0xb105('0x4d'):if(_0x4f0532[_0xb105('0x4e')]&&_0x4f0532[_0xb105('0x20')]){var _0x4725d0={'dst':_0x2be20c['phone'],'text':_0x2be20c['body'],'src':_0x4f0532[_0xb105('0x3f')]||_0x4f0532[_0xb105('0x21')],'url':_0x4f0532['remote']+'/api/sms/messages/'+_0x2be20c['id']+_0xb105('0x26')+_0x4f0532[_0xb105('0x27')]};var _0x1b0ee2=util[_0xb105('0x43')](_0xb105('0x4f'),_0x4f0532[_0xb105('0x4e')],_0x4f0532[_0xb105('0x20')]);var _0x2ae852={'method':'POST','uri':util['format'](_0xb105('0x50'),_0x4f0532['authId']),'body':_0x4725d0,'headers':{'Authorization':util[_0xb105('0x43')](_0xb105('0x46'),new Buffer(_0x1b0ee2)[_0xb105('0x47')](_0xb105('0x48')))},'json':!![]};rp(_0x2ae852)[_0xb105('0x19')](function(_0x2c619b){var _0x1ce6d4={'messageId':_0x2c619b[_0xb105('0x51')][0x0]};return _0x41feef[_0xb105('0x1a')](_0x1ce6d4);})[_0xb105('0x29')](function(_0x52dad9){logger[_0xb105('0x2a')](_0xb105('0x2b'),_0xb105('0x2c'),_0xb105('0x4d'),util[_0xb105('0x2d')](_0x52dad9,{'showHidden':![],'depth':null}));});}else{logger[_0xb105('0x2a')](_0xb105('0x2b'),_0xb105('0x2c'),'plivo',_0xb105('0x52'));}break;case _0xb105('0x53'):if(_0x4f0532[_0xb105('0x31')]&&_0x4f0532[_0xb105('0x32')]){if(_0x4f0532['baseUrl']){var _0x3ea056={'method':_0xb105('0x44'),'uri':_0x4f0532[_0xb105('0x54')]+_0xb105('0x55'),'body':{'username':_0x4f0532[_0xb105('0x31')],'password':_0x4f0532[_0xb105('0x32')]},'json':!![]};return rp(_0x3ea056)['then'](function(_0x54e90e){var _0x1916b8={'method':_0xb105('0x44'),'uri':_0x4f0532[_0xb105('0x54')]+_0xb105('0x56'),'body':{'messages':[{'from':_0x4f0532[_0xb105('0x21')],'destinations':[{'to':_0x2be20c[_0xb105('0x21')]}],'text':_0x2be20c[_0xb105('0xf')],'notifyUrl':_0x4f0532[_0xb105('0x24')]+'/api/sms/messages/'+_0x2be20c['id']+'/status?token='+_0x4f0532[_0xb105('0x27')],'notifyContentType':_0xb105('0x57'),'callbackData':_0x4f0532[_0xb105('0x21')]+';'+_0x2be20c[_0xb105('0xf')]}]},'headers':{'Authorization':_0xb105('0x58')+_0x54e90e[_0xb105('0x27')]},'json':!![]};return rp(_0x1916b8)[_0xb105('0x19')](function(_0x197b71){if(_0x197b71[_0xb105('0x22')]){var _0x4f279e={'messageId':_0x197b71[_0xb105('0x22')][0x0][_0xb105('0xd')]};if(!_0x4f0532[_0xb105('0x3b')]){_0x4f279e['read']=!![];}return _0x41feef[_0xb105('0x1a')](_0x4f279e);}else{return logger['error'](_0xb105('0x2b'),_0xb105('0x2c'),_0xb105('0x53'),util[_0xb105('0x2d')](_0x197b71,{'showHidden':![],'depth':null}));}});})[_0xb105('0x29')](function(_0x4bde6b){return logger['error'](_0xb105('0x2b'),_0xb105('0x2c'),'infobip',util['inspect'](_0x4bde6b,{'showHidden':![],'depth':null}));});}else{logger[_0xb105('0x2a')](_0xb105('0x2b'),_0xb105('0x2c'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',_0xb105('0x3d'));}break;case'csc':var _0x58fa2b=require(_0xb105('0x59'));if(_0x4f0532[_0xb105('0x5a')]){var _0x419da2={};_0x419da2[_0xb105('0x5b')]=_0x4f0532[_0xb105('0x31')];_0x419da2['phone']=_0x2be20c[_0xb105('0x21')];_0x419da2[_0xb105('0x34')]=_0x4f0532[_0xb105('0x21')];_0x419da2[_0xb105('0x5c')]=_0x2be20c[_0xb105('0xf')];_0x419da2['timestamp']=+new Date();var _0x273b58='';var _0x409803='';var _0x2aa1fb=Object[_0xb105('0x5d')](_0x419da2);_0x2aa1fb[_0xb105('0x5e')]();for(var _0x238437=0x0;_0x238437<_0x2aa1fb[_0xb105('0x5f')];_0x238437++){if(_0x273b58!=''){_0x273b58+='&';}_0x273b58+=_0x2aa1fb[_0x238437]+'='+encodeURIComponent(_0x419da2[_0x2aa1fb[_0x238437]]);_0x409803+=_0x419da2[_0x2aa1fb[_0x238437]];}_0x409803+=_0x4f0532[_0xb105('0x5a')];_0x409803=_0x58fa2b['createHash']('md5')[_0xb105('0x1a')](_0x409803)[_0xb105('0x60')](_0xb105('0x61'));if(_0x273b58!==''){_0x273b58+='&';}_0x273b58+=_0xb105('0x62')+_0x409803;var _0x516fda={'method':_0xb105('0x63'),'uri':_0x4f0532[_0xb105('0x54')]+_0xb105('0x64')+_0x273b58,'json':!![]};return rp(_0x516fda)[_0xb105('0x19')](function(_0x447d5a){var _0x565189=Object[_0xb105('0x5d')](_0x447d5a);if(_0x447d5a[_0x565189[0x0]][_0xb105('0x2a')]&&parseInt(_0x447d5a[_0x565189[0x0]][_0xb105('0x2a')])===0x0){var _0x5ea244={'messageId':_0x447d5a[_0x565189[0x0]][_0xb105('0x65')]};if(!_0x4f0532[_0xb105('0x3b')]){_0x5ea244['read']=!![];}return _0x41feef[_0xb105('0x1a')](_0x5ea244);}else{return logger[_0xb105('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb105('0x66'),util[_0xb105('0x2d')](_0x447d5a[_0xb105('0x2a')],{'showHidden':![],'depth':null}));}})[_0xb105('0x29')](function(_0x14b52a){return logger[_0xb105('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb105('0x2c'),_0xb105('0x66'),util[_0xb105('0x2d')](_0x14b52a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb105('0x2b'),_0xb105('0x2c'),'csc',_0xb105('0x67'));}break;case'clickatell':if(_0x4f0532[_0xb105('0x5a')]){var _0x494e0e={'method':_0xb105('0x44'),'uri':_0xb105('0x68'),'headers':{'Authorization':_0x4f0532[_0xb105('0x5a')]},'body':{'content':_0x2be20c[_0xb105('0xf')],'to':[_0x2be20c[_0xb105('0x21')]],'from':_0x4f0532[_0xb105('0x21')],'binary':![],'clientMessageId':'uuid','charset':_0xb105('0x69')},'json':!![]};rp(_0x494e0e)[_0xb105('0x19')](function(_0x799946){if(!_0x799946[_0xb105('0x2a')]){var _0x51bf8d={'messageId':_0x799946[_0xb105('0x22')][0x0][_0xb105('0x6a')]};if(!_0x4f0532[_0xb105('0x3b')]){_0x51bf8d[_0xb105('0x3c')]=!![];}return _0x41feef[_0xb105('0x1a')](_0x51bf8d);}else{return logger[_0xb105('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb105('0x2c'),_0xb105('0x6b'),util['inspect'](_0x799946['error'],{'showHidden':![],'depth':null}));}})[_0xb105('0x29')](function(_0x37f601){return logger[_0xb105('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb105('0x2c'),_0xb105('0x6b'),util[_0xb105('0x2d')](_0x37f601,{'showHidden':![],'depth':null}));});}else{logger[_0xb105('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb105('0x2c'),_0xb105('0x6b'),'Missing\x20parameters:\x20apiKey');}break;case _0xb105('0x6c'):if(_0x4f0532[_0xb105('0x31')]&&_0x4f0532[_0xb105('0x32')]){var _0x1b0ee2=util['format'](_0xb105('0x4f'),_0x4f0532['username'],_0x4f0532['password']);var _0x2ae852={'method':_0xb105('0x44'),'uri':_0xb105('0x6d')+_0x4f0532['accountId']+_0xb105('0x6e'),'body':{'to':[_0x2be20c['phone']],'text':_0x2be20c[_0xb105('0xf')],'from':_0x4f0532['phone'],'applicationId':_0x4f0532[_0xb105('0x6f')]},'headers':{'Authorization':util[_0xb105('0x43')](_0xb105('0x46'),new Buffer(_0x1b0ee2)[_0xb105('0x47')](_0xb105('0x48')))},'json':!![]};rp(_0x2ae852)['then'](function(_0x9f6dbe){if(_0x9f6dbe['id']){var _0x5aaac8={'messageId':_0x9f6dbe['id']};return _0x41feef[_0xb105('0x1a')](_0x5aaac8);}else{logger['error'](_0xb105('0x2b'),'afterCreate',_0xb105('0x6c'),util[_0xb105('0x2d')](_0x9f6dbe,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e48de){logger['error'](_0xb105('0x2b'),_0xb105('0x2c'),_0xb105('0x6c'),util['inspect'](_0x1e48de,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb105('0x2c'),_0xb105('0x6c'),_0xb105('0x3d'));}break;case _0xb105('0x70'):if(_0x4f0532[_0xb105('0x5a')]){var _0x594ea8={};var _0x516fda={'method':_0xb105('0x44'),'uri':_0xb105('0x71'),'headers':{'Authorization':_0xb105('0x72')+_0x4f0532['apiKey'],'Content-Type':_0xb105('0x57')},'body':{'from':_0x4f0532['phone'],'to':_0x2be20c[_0xb105('0x21')],'text':_0x2be20c[_0xb105('0xf')]},'json':!![]};return rp(_0x516fda)[_0xb105('0x19')](function(_0x520369){if(_0x520369['code']==0xca){_0x594ea8[_0xb105('0x73')]=_0x520369;var _0x5a0030={'method':_0xb105('0x44'),'uri':_0xb105('0x74'),'headers':{'Authorization':_0xb105('0x72')+_0x4f0532[_0xb105('0x5a')],'Content-Type':_0xb105('0x57')},'body':{'refid':_0x594ea8['message'][_0xb105('0x75')]},'json':!![]};return rp(_0x5a0030)[_0xb105('0x19')](function(_0x2e78e1){_0x594ea8[_0xb105('0x76')]=_0x2e78e1;var _0x525a66={'messageId':_0x594ea8['message']['refid'],'read':!![]};return _0x41feef[_0xb105('0x1a')](_0x525a66);});}else{return logger['error'](_0xb105('0x2b'),_0xb105('0x2c'),_0xb105('0x70'),util['inspect'](_0x520369,{'showHidden':![],'depth':null}));}})[_0xb105('0x29')](function(_0x18fa7d){return logger[_0xb105('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb105('0x2c'),_0xb105('0x70'),util[_0xb105('0x2d')](_0x18fa7d,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xb105('0x2b'),_0xb105('0x2c'),'intelepeer',_0xb105('0x77'));}break;}}})[_0xb105('0x78')](function(){_0x874dc();});}else{_0x874dc();}}},'charset':_0xb105('0x79'),'collate':_0xb105('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 637e4df..0fdde90 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 _0xe20d=['request\x20sent','stringify','error','SmsMessage,\x20%s,\x20%s','message','CreateSmsMessage','SmsMessage','create','body','raw','then','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','info'];(function(_0x2b1c95,_0x116f52){var _0x1d16e2=function(_0x42227b){while(--_0x42227b){_0x2b1c95['push'](_0x2b1c95['shift']());}};_0x1d16e2(++_0x116f52);}(_0xe20d,0x11b));var _0xde20=function(_0x464f27,_0x45af44){_0x464f27=_0x464f27-0x0;var _0x350713=_0xe20d[_0x464f27];return _0x350713;};'use strict';var _=require('lodash');var util=require(_0xde20('0x0'));var moment=require(_0xde20('0x1'));var BPromise=require(_0xde20('0x2'));var rs=require(_0xde20('0x3'));var fs=require('fs');var Redis=require(_0xde20('0x4'));var db=require(_0xde20('0x5'))['db'];var utils=require(_0xde20('0x6'));var logger=require(_0xde20('0x7'))(_0xde20('0x8'));var config=require(_0xde20('0x9'));var jayson=require(_0xde20('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xde20('0xb')]=_[_0xde20('0xc')](config['redis'],{'host':_0xde20('0xd'),'port':0x18eb});var socket=require(_0xde20('0xe'))(new Redis(config['redis']));require(_0xde20('0xf'))['register'](socket);function respondWithRpcPromise(_0x2e8eb0,_0x206def,_0x45e986){return new BPromise(function(_0x2a0298,_0x172e0d){return client['request'](_0x2e8eb0,_0x45e986)['then'](function(_0x2484c0){logger[_0xde20('0x10')]('SmsMessage,\x20%s,\x20%s',_0x206def,_0xde20('0x11'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x206def,'request\x20sent',JSON[_0xde20('0x12')](_0x2484c0));if(_0x2484c0['error']){if(_0x2484c0['error']['code']===0x1f4){logger[_0xde20('0x13')](_0xde20('0x14'),_0x206def,_0x2484c0[_0xde20('0x13')][_0xde20('0x15')]);return _0x172e0d(_0x2484c0['error'][_0xde20('0x15')]);}logger['error'](_0xde20('0x14'),_0x206def,_0x2484c0[_0xde20('0x13')][_0xde20('0x15')]);return _0x2a0298(_0x2484c0['error'][_0xde20('0x15')]);}else{logger[_0xde20('0x10')](_0xde20('0x14'),_0x206def,_0xde20('0x11'));_0x2a0298(_0x2484c0['result'][_0xde20('0x15')]);}})['catch'](function(_0x335941){logger['error']('SmsMessage,\x20%s,\x20%s',_0x206def,_0x335941);_0x172e0d(_0x335941);});});}exports[_0xde20('0x16')]=function(_0x4263e0){var _0x46a623=this;return new Promise(function(_0xb7bfb5,_0x36ea36){return db[_0xde20('0x17')][_0xde20('0x18')](_0x4263e0[_0xde20('0x19')],{'raw':_0x4263e0['options']?_0x4263e0['options'][_0xde20('0x1a')]===undefined?!![]:![]:!![]})[_0xde20('0x1b')](function(_0x216527){logger[_0xde20('0x10')]('CreateSmsMessage',_0x4263e0);logger[_0xde20('0x1c')](_0xde20('0x16'),_0x4263e0,JSON['stringify'](_0x216527));_0xb7bfb5(_0x216527);})[_0xde20('0x1d')](function(_0x198710){logger['error'](_0xde20('0x16'),_0x198710[_0xde20('0x15')],_0x4263e0);_0x36ea36(_0x46a623[_0xde20('0x13')](0x1f4,_0x198710[_0xde20('0x15')]));});});}; \ No newline at end of file +var _0x5517=['code','SmsMessage,\x20%s,\x20%s','message','result','CreateSmsMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0x5517,0xb9));var _0x7551=function(_0x25d952,_0x5ef576){_0x25d952=_0x25d952-0x0;var _0xd3653c=_0x5517[_0x25d952];return _0xd3653c;};'use strict';var _=require(_0x7551('0x0'));var util=require(_0x7551('0x1'));var moment=require(_0x7551('0x2'));var BPromise=require(_0x7551('0x3'));var rs=require(_0x7551('0x4'));var fs=require('fs');var Redis=require(_0x7551('0x5'));var db=require(_0x7551('0x6'))['db'];var utils=require(_0x7551('0x7'));var logger=require(_0x7551('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7551('0x9'));var client=jayson[_0x7551('0xa')]['http']({'port':0x232a});config[_0x7551('0xb')]=_[_0x7551('0xc')](config['redis'],{'host':_0x7551('0xd'),'port':0x18eb});var socket=require(_0x7551('0xe'))(new Redis(config[_0x7551('0xb')]));require(_0x7551('0xf'))[_0x7551('0x10')](socket);function respondWithRpcPromise(_0x10a50f,_0x5b6fc1,_0x5d031b){return new BPromise(function(_0x326a97,_0x5a9de8){return client[_0x7551('0x11')](_0x10a50f,_0x5d031b)[_0x7551('0x12')](function(_0x52820c){logger[_0x7551('0x13')]('SmsMessage,\x20%s,\x20%s',_0x5b6fc1,_0x7551('0x14'));logger[_0x7551('0x15')](_0x7551('0x16'),_0x5b6fc1,'request\x20sent',JSON[_0x7551('0x17')](_0x52820c));if(_0x52820c['error']){if(_0x52820c[_0x7551('0x18')][_0x7551('0x19')]===0x1f4){logger[_0x7551('0x18')](_0x7551('0x1a'),_0x5b6fc1,_0x52820c[_0x7551('0x18')][_0x7551('0x1b')]);return _0x5a9de8(_0x52820c['error'][_0x7551('0x1b')]);}logger[_0x7551('0x18')]('SmsMessage,\x20%s,\x20%s',_0x5b6fc1,_0x52820c[_0x7551('0x18')][_0x7551('0x1b')]);return _0x326a97(_0x52820c[_0x7551('0x18')][_0x7551('0x1b')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x5b6fc1,_0x7551('0x14'));_0x326a97(_0x52820c[_0x7551('0x1c')][_0x7551('0x1b')]);}})['catch'](function(_0x397971){logger[_0x7551('0x18')]('SmsMessage,\x20%s,\x20%s',_0x5b6fc1,_0x397971);_0x5a9de8(_0x397971);});});}exports[_0x7551('0x1d')]=function(_0x4ed0c5){var _0x1afbda=this;return new Promise(function(_0x449a25,_0x3a85b8){return db['SmsMessage'][_0x7551('0x1e')](_0x4ed0c5[_0x7551('0x1f')],{'raw':_0x4ed0c5[_0x7551('0x20')]?_0x4ed0c5[_0x7551('0x20')][_0x7551('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x1da111){logger[_0x7551('0x13')](_0x7551('0x1d'),_0x4ed0c5);logger['debug'](_0x7551('0x1d'),_0x4ed0c5,JSON[_0x7551('0x17')](_0x1da111));_0x449a25(_0x1da111);})[_0x7551('0x22')](function(_0x3bc455){logger[_0x7551('0x18')](_0x7551('0x1d'),_0x3bc455[_0x7551('0x1b')],_0x4ed0c5);_0x3a85b8(_0x1afbda['error'](0x1f4,_0x3bc455['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 2d082f1..bd899e7 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 _0x1575=['./smsMessage.events','remove','emit','removeListener','register','smsMessage:'];(function(_0x1a7f18,_0x23b671){var _0x1709bc=function(_0x4a6648){while(--_0x4a6648){_0x1a7f18['push'](_0x1a7f18['shift']());}};_0x1709bc(++_0x23b671);}(_0x1575,0x9c));var _0x5157=function(_0x4652e3,_0x5348a7){_0x4652e3=_0x4652e3-0x0;var _0x1b55c1=_0x1575[_0x4652e3];return _0x1b55c1;};'use strict';var SmsMessageEvents=require(_0x5157('0x0'));var events=['save',_0x5157('0x1'),'update'];function createListener(_0x723453,_0xd293b9){return function(_0x54760d){_0xd293b9[_0x5157('0x2')](_0x723453,_0x54760d);};}function removeListener(_0x4213ef,_0x3b21ee){return function(){SmsMessageEvents[_0x5157('0x3')](_0x4213ef,_0x3b21ee);};}exports[_0x5157('0x4')]=function(_0x543f90){for(var _0x47f5ad=0x0,_0x5a61a2=events['length'];_0x47f5ad<_0x5a61a2;_0x47f5ad++){var _0x58a49d=events[_0x47f5ad];var _0x2eb9a6=createListener(_0x5157('0x5')+_0x58a49d,_0x543f90);SmsMessageEvents['on'](_0x58a49d,_0x2eb9a6);}}; \ No newline at end of file +var _0xec13=['smsMessage:','./smsMessage.events','save','emit','removeListener','length'];(function(_0xff26e7,_0x38ae8a){var _0x577667=function(_0x3cd8ba){while(--_0x3cd8ba){_0xff26e7['push'](_0xff26e7['shift']());}};_0x577667(++_0x38ae8a);}(_0xec13,0x10f));var _0x3ec1=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xec13[_0x5bd426];return _0x23a7eb;};'use strict';var SmsMessageEvents=require(_0x3ec1('0x0'));var events=[_0x3ec1('0x1'),'remove','update'];function createListener(_0x589929,_0x2e29b4){return function(_0x1de2b1){_0x2e29b4[_0x3ec1('0x2')](_0x589929,_0x1de2b1);};}function removeListener(_0x743751,_0xf82e7d){return function(){SmsMessageEvents[_0x3ec1('0x3')](_0x743751,_0xf82e7d);};}exports['register']=function(_0x1e28bb){for(var _0x42e5b4=0x0,_0x382df1=events[_0x3ec1('0x4')];_0x42e5b4<_0x382df1;_0x42e5b4++){var _0xf0e3b3=events[_0x42e5b4];var _0x4e3583=createListener(_0x3ec1('0x5')+_0xf0e3b3,_0x1e28bb);SmsMessageEvents['on'](_0xf0e3b3,_0x4e3583);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index c70d053..269cd7d 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 _0x0763=['isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','destroy','removeTeams','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get'];(function(_0x379178,_0x28e964){var _0x3b191c=function(_0x1ff220){while(--_0x1ff220){_0x379178['push'](_0x379178['shift']());}};_0x3b191c(++_0x28e964);}(_0x0763,0x88));var _0x3076=function(_0x495b3d,_0x4d3da4){_0x495b3d=_0x495b3d-0x0;var _0x4cb329=_0x0763[_0x495b3d];return _0x4cb329;};'use strict';var multer=require(_0x3076('0x0'));var util=require('util');var path=require(_0x3076('0x1'));var timeout=require(_0x3076('0x2'));var express=require(_0x3076('0x3'));var router=express[_0x3076('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3076('0x5'));var config=require(_0x3076('0x6'));var controller=require(_0x3076('0x7'));router[_0x3076('0x8')]('/',auth[_0x3076('0x9')](),controller[_0x3076('0xa')]);router['get'](_0x3076('0xb'),auth[_0x3076('0x9')](),controller[_0x3076('0xc')]);router[_0x3076('0x8')]('/:id',auth[_0x3076('0x9')](),controller[_0x3076('0xd')]);router['get'](_0x3076('0xe'),auth[_0x3076('0x9')](),controller[_0x3076('0xf')]);router['get'](_0x3076('0x10'),auth[_0x3076('0x9')](),controller[_0x3076('0x11')]);router[_0x3076('0x8')](_0x3076('0x12'),auth[_0x3076('0x9')](),controller[_0x3076('0x13')]);router[_0x3076('0x14')]('/',auth[_0x3076('0x9')](),controller[_0x3076('0x15')]);router[_0x3076('0x14')](_0x3076('0x10'),auth[_0x3076('0x9')](),controller[_0x3076('0x16')]);router['post'](_0x3076('0x12'),auth[_0x3076('0x9')](),controller['addAgents']);router[_0x3076('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3076('0x18')]);router['delete'](_0x3076('0x10'),auth['isAuthenticated'](),controller[_0x3076('0x19')]);router[_0x3076('0x1a')](_0x3076('0x12'),auth[_0x3076('0x9')](),controller[_0x3076('0x1b')]);module[_0x3076('0x1c')]=router; \ No newline at end of file +var _0xf110=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','describe','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','/:id','update','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','fs-extra'];(function(_0x2c17dc,_0x28bc8f){var _0x4f46b3=function(_0x431960){while(--_0x431960){_0x2c17dc['push'](_0x2c17dc['shift']());}};_0x4f46b3(++_0x28bc8f);}(_0xf110,0x88));var _0x0f11=function(_0x45595c,_0x35641d){_0x45595c=_0x45595c-0x0;var _0x37c5c3=_0xf110[_0x45595c];return _0x37c5c3;};'use strict';var multer=require(_0x0f11('0x0'));var util=require('util');var path=require(_0x0f11('0x1'));var timeout=require(_0x0f11('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0f11('0x3'));var auth=require(_0x0f11('0x4'));var interaction=require(_0x0f11('0x5'));var config=require(_0x0f11('0x6'));var controller=require(_0x0f11('0x7'));router['get']('/',auth[_0x0f11('0x8')](),controller[_0x0f11('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x0f11('0xa')]);router['get']('/:id',auth[_0x0f11('0x8')](),controller['show']);router[_0x0f11('0xb')](_0x0f11('0xc'),auth[_0x0f11('0x8')](),controller[_0x0f11('0xd')]);router[_0x0f11('0xb')](_0x0f11('0xe'),auth[_0x0f11('0x8')](),controller[_0x0f11('0xf')]);router[_0x0f11('0xb')](_0x0f11('0x10'),auth['isAuthenticated'](),controller[_0x0f11('0x11')]);router['post']('/',auth[_0x0f11('0x8')](),controller[_0x0f11('0x12')]);router[_0x0f11('0x13')]('/:id/teams',auth[_0x0f11('0x8')](),controller[_0x0f11('0x14')]);router[_0x0f11('0x13')]('/:id/users',auth[_0x0f11('0x8')](),controller['addAgents']);router[_0x0f11('0x15')](_0x0f11('0x16'),auth[_0x0f11('0x8')](),controller[_0x0f11('0x17')]);router[_0x0f11('0x18')]('/:id',auth[_0x0f11('0x8')](),controller['destroy']);router[_0x0f11('0x18')](_0x0f11('0xe'),auth[_0x0f11('0x8')](),controller[_0x0f11('0x19')]);router[_0x0f11('0x18')]('/:id/users',auth[_0x0f11('0x8')](),controller[_0x0f11('0x1a')]);module[_0x0f11('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7c8da46..c918452 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 _0x2e19=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x23deb6,_0x2b4d1f){var _0x5ce9a7=function(_0x5f0e01){while(--_0x5f0e01){_0x23deb6['push'](_0x23deb6['shift']());}};_0x5ce9a7(++_0x2b4d1f);}(_0x2e19,0x194));var _0x92e1=function(_0x335132,_0x34604b){_0x335132=_0x335132-0x0;var _0x371e5d=_0x2e19[_0x335132];return _0x371e5d;};'use strict';var Sequelize=require(_0x92e1('0x0'));module[_0x92e1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x92e1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x92e1('0x3')]},'timeout':{'type':Sequelize[_0x92e1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x92e1('0x5'),_0x92e1('0x6'),_0x92e1('0x7'))}}; \ No newline at end of file +var _0xc693=['sequelize','exports','STRING','INTEGER','rrmemory'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xc693,0x109));var _0x3c69=function(_0x33e63f,_0x20c78c){_0x33e63f=_0x33e63f-0x0;var _0x2c628d=_0xc693[_0x33e63f];return _0x2c628d;};'use strict';var Sequelize=require(_0x3c69('0x0'));module[_0x3c69('0x1')]={'name':{'type':Sequelize[_0x3c69('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3c69('0x2')]},'timeout':{'type':Sequelize[_0x3c69('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3c69('0x4'),'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 17bbec6..e2cfe53 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 _0x24ee=['SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','all','union','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','end','error','stack','name','index','map','SmsQueue','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','merge','options','where','includeAll','include','findAll','rows','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','catch','describe','getMembers','UserSmsQueue','order','pick','User','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','interface','flatMap','each','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x24ee,0x1b2));var _0xe24e=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0x24ee[_0x2fff83];return _0xa2a722;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe24e('0x0'));var moment=require(_0xe24e('0x1'));var BPromise=require(_0xe24e('0x2'));var Mustache=require(_0xe24e('0x3'));var util=require(_0xe24e('0x4'));var path=require(_0xe24e('0x5'));var sox=require(_0xe24e('0x6'));var csv=require(_0xe24e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe24e('0x8'));var _=require(_0xe24e('0x9'));var squel=require(_0xe24e('0xa'));var crypto=require(_0xe24e('0xb'));var jsforce=require(_0xe24e('0xc'));var deskjs=require(_0xe24e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe24e('0xe'));var Papa=require(_0xe24e('0xf'));var Redis=require('ioredis');var authService=require(_0xe24e('0x10'));var qs=require(_0xe24e('0x11'));var as=require(_0xe24e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe24e('0x13'))('api');var utils=require(_0xe24e('0x14'));var config=require(_0xe24e('0x15'));var licenseUtil=require(_0xe24e('0x16'));var db=require(_0xe24e('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe24e('0x18'))(new Redis(config['redis']));require(_0xe24e('0x19'))[_0xe24e('0x1a')](socket);function respondWithStatusCode(_0x4967e9,_0x1580f5){_0x1580f5=_0x1580f5||0xcc;return function(_0x61110a){if(_0x61110a){return _0x4967e9[_0xe24e('0x1b')](_0x1580f5);}return _0x4967e9[_0xe24e('0x1c')](_0x1580f5)['end']();};}function respondWithResult(_0x3aa137,_0x4ef24c){_0x4ef24c=_0x4ef24c||0xc8;return function(_0x2acc80){if(_0x2acc80){return _0x3aa137[_0xe24e('0x1c')](_0x4ef24c)[_0xe24e('0x1d')](_0x2acc80);}};}function respondWithFilteredResult(_0x175162,_0x252124){return function(_0x1b164d){if(_0x1b164d){var _0x33d59f=typeof _0x252124[_0xe24e('0x1e')]==='undefined'&&typeof _0x252124[_0xe24e('0x1f')]===_0xe24e('0x20');var _0x2e844c=_0x1b164d[_0xe24e('0x21')];var _0x4bb36b=_0x33d59f?0x0:_0x252124[_0xe24e('0x1e')];var _0x463fe7=_0x33d59f?_0x1b164d[_0xe24e('0x21')]:_0x252124[_0xe24e('0x1e')]+_0x252124[_0xe24e('0x1f')];var _0x2710b5;if(_0x463fe7>=_0x2e844c){_0x463fe7=_0x2e844c;_0x2710b5=0xc8;}else{_0x2710b5=0xce;}_0x175162[_0xe24e('0x1c')](_0x2710b5);return _0x175162[_0xe24e('0x22')](_0xe24e('0x23'),_0x4bb36b+'-'+_0x463fe7+'/'+_0x2e844c)[_0xe24e('0x1d')](_0x1b164d);}return null;};}function patchUpdates(_0x497d1f){return function(_0x15193c){try{jsonpatch[_0xe24e('0x24')](_0x15193c,_0x497d1f,!![]);}catch(_0x19ac7a){return BPromise[_0xe24e('0x25')](_0x19ac7a);}return _0x15193c[_0xe24e('0x26')]();};}function saveUpdates(_0xd1a30a,_0x3b5599){return function(_0x54818e){if(_0x54818e){return _0x54818e[_0xe24e('0x27')](_0xd1a30a)['then'](function(_0x1f845d){return _0x1f845d;});}return null;};}function removeEntity(_0x502a30,_0x3f1e0d){return function(_0x2f50d7){if(_0x2f50d7){return _0x2f50d7[_0xe24e('0x28')]()[_0xe24e('0x29')](function(){var _0x51b75c=_0x2f50d7[_0xe24e('0x2a')]({'plain':!![]});var _0x41daa2='SmsQueues';return db['UserProfileResource'][_0xe24e('0x28')]({'where':{'type':_0x41daa2,'resourceId':_0x51b75c['id']}})[_0xe24e('0x29')](function(){return _0x2f50d7;});})[_0xe24e('0x29')](function(){_0x502a30[_0xe24e('0x1c')](0xcc)[_0xe24e('0x2b')]();});}};}function handleEntityNotFound(_0x3e01c4,_0x5c3efc){return function(_0x42cdba){if(!_0x42cdba){_0x3e01c4['sendStatus'](0x194);}return _0x42cdba;};}function handleError(_0xe5559d,_0x11e0b6){_0x11e0b6=_0x11e0b6||0x1f4;return function(_0x56cbdb){logger[_0xe24e('0x2c')](_0x56cbdb[_0xe24e('0x2d')]);if(_0x56cbdb[_0xe24e('0x2e')]){delete _0x56cbdb[_0xe24e('0x2e')];}_0xe5559d[_0xe24e('0x1c')](_0x11e0b6)['send'](_0x56cbdb);};}exports[_0xe24e('0x2f')]=function(_0x1a3f09,_0x4c39f1){var _0x51ce81={},_0x575a91={},_0x39954d={'count':0x0,'rows':[]};var _0xb73a5c=_[_0xe24e('0x30')](db[_0xe24e('0x31')][_0xe24e('0x32')],function(_0xa6f433){return{'name':_0xa6f433['fieldName'],'type':_0xa6f433[_0xe24e('0x33')][_0xe24e('0x34')]};});_0x575a91[_0xe24e('0x35')]=_[_0xe24e('0x30')](_0xb73a5c,_0xe24e('0x2e'));_0x575a91[_0xe24e('0x36')]=_[_0xe24e('0x37')](_0x1a3f09[_0xe24e('0x36')]);_0x575a91[_0xe24e('0x38')]=_[_0xe24e('0x39')](_0x575a91[_0xe24e('0x35')],_0x575a91[_0xe24e('0x36')]);_0x51ce81['attributes']=_[_0xe24e('0x39')](_0x575a91[_0xe24e('0x35')],qs[_0xe24e('0x3a')](_0x1a3f09[_0xe24e('0x36')]['fields']));_0x51ce81['attributes']=_0x51ce81[_0xe24e('0x3b')]['length']?_0x51ce81['attributes']:_0x575a91[_0xe24e('0x35')];if(!_0x1a3f09[_0xe24e('0x36')][_0xe24e('0x3c')](_0xe24e('0x3d'))){_0x51ce81['limit']=qs[_0xe24e('0x1f')](_0x1a3f09[_0xe24e('0x36')][_0xe24e('0x1f')]);_0x51ce81[_0xe24e('0x1e')]=qs[_0xe24e('0x1e')](_0x1a3f09['query'][_0xe24e('0x1e')]);}_0x51ce81['order']=qs[_0xe24e('0x3e')](_0x1a3f09[_0xe24e('0x36')][_0xe24e('0x3e')]);_0x51ce81['where']=qs[_0xe24e('0x38')](_['pick'](_0x1a3f09['query'],_0x575a91[_0xe24e('0x38')]),_0xb73a5c);if(_0x1a3f09['query'][_0xe24e('0x3f')]){_0x51ce81['where']=_[_0xe24e('0x40')](_0x51ce81['where'],{'$or':_[_0xe24e('0x30')](_0xb73a5c,function(_0x45fb01){if(_0x45fb01[_0xe24e('0x33')]!=='VIRTUAL'){var _0x13e35b={};_0x13e35b[_0x45fb01[_0xe24e('0x2e')]]={'$like':'%'+_0x1a3f09[_0xe24e('0x36')]['filter']+'%'};return _0x13e35b;}})});}_0x51ce81=_['merge']({},_0x51ce81,_0x1a3f09[_0xe24e('0x41')]);var _0x1510a9={'where':_0x51ce81[_0xe24e('0x42')]};return db[_0xe24e('0x31')]['count'](_0x1510a9)[_0xe24e('0x29')](function(_0x3a6879){_0x39954d[_0xe24e('0x21')]=_0x3a6879;if(_0x1a3f09[_0xe24e('0x36')][_0xe24e('0x43')]){_0x51ce81[_0xe24e('0x44')]=[{'all':!![]}];}return db['SmsQueue'][_0xe24e('0x45')](_0x51ce81);})['then'](function(_0x498082){_0x39954d[_0xe24e('0x46')]=_0x498082;return _0x39954d;})['then'](respondWithFilteredResult(_0x4c39f1,_0x51ce81))['catch'](handleError(_0x4c39f1,null));};exports[_0xe24e('0x47')]=function(_0x595b7d,_0x40f393){var _0x1512ed={'raw':!![],'where':{'id':_0x595b7d['params']['id']}},_0x1c0d16={};_0x1c0d16[_0xe24e('0x35')]=_[_0xe24e('0x37')](db[_0xe24e('0x31')][_0xe24e('0x32')]);_0x1c0d16['query']=_[_0xe24e('0x37')](_0x595b7d[_0xe24e('0x36')]);_0x1c0d16[_0xe24e('0x38')]=_['intersection'](_0x1c0d16[_0xe24e('0x35')],_0x1c0d16['query']);_0x1512ed[_0xe24e('0x3b')]=_[_0xe24e('0x39')](_0x1c0d16[_0xe24e('0x35')],qs['fields'](_0x595b7d[_0xe24e('0x36')][_0xe24e('0x3a')]));_0x1512ed[_0xe24e('0x3b')]=_0x1512ed['attributes'][_0xe24e('0x48')]?_0x1512ed[_0xe24e('0x3b')]:_0x1c0d16[_0xe24e('0x35')];if(_0x595b7d[_0xe24e('0x36')][_0xe24e('0x43')]){_0x1512ed[_0xe24e('0x44')]=[{'all':!![]}];}_0x1512ed=_[_0xe24e('0x40')]({},_0x1512ed,_0x595b7d[_0xe24e('0x41')]);return db[_0xe24e('0x31')][_0xe24e('0x49')](_0x1512ed)['then'](handleEntityNotFound(_0x40f393,null))[_0xe24e('0x29')](respondWithResult(_0x40f393,null))['catch'](handleError(_0x40f393,null));};exports['create']=function(_0x118b0d,_0x4deed3){return db[_0xe24e('0x31')][_0xe24e('0x4a')](_0x118b0d[_0xe24e('0x4b')],{})[_0xe24e('0x29')](function(_0x3e8799){var _0x4df023=_0x118b0d[_0xe24e('0x4c')]['get']({'plain':!![]});if(!_0x4df023)throw new Error(_0xe24e('0x4d'));if(_0x4df023[_0xe24e('0x4e')]===_0xe24e('0x4c')){var _0x24c0ec=_0x3e8799[_0xe24e('0x2a')]({'plain':!![]});var _0x5d3a08=_0xe24e('0x4f');return db[_0xe24e('0x50')][_0xe24e('0x49')]({'where':{'name':_0x5d3a08,'userProfileId':_0x4df023['userProfileId']},'raw':!![]})['then'](function(_0x3fc78e){if(_0x3fc78e&&_0x3fc78e[_0xe24e('0x51')]===0x0){return db[_0xe24e('0x52')][_0xe24e('0x4a')]({'name':_0x24c0ec[_0xe24e('0x2e')],'resourceId':_0x24c0ec['id'],'type':_0x3fc78e[_0xe24e('0x2e')],'sectionId':_0x3fc78e['id']},{})[_0xe24e('0x29')](function(){return _0x3e8799;});}else{return _0x3e8799;}})['catch'](function(_0x18512e){logger[_0xe24e('0x2c')](_0xe24e('0x53'),_0x18512e);throw _0x18512e;});}return _0x3e8799;})[_0xe24e('0x29')](respondWithResult(_0x4deed3,0xc9))['catch'](handleError(_0x4deed3,null));};exports['update']=function(_0x5bc106,_0x1a8f9f){if(_0x5bc106['body']['id']){delete _0x5bc106[_0xe24e('0x4b')]['id'];}return db[_0xe24e('0x31')][_0xe24e('0x49')]({'where':{'id':_0x5bc106[_0xe24e('0x54')]['id']}})[_0xe24e('0x29')](handleEntityNotFound(_0x1a8f9f,null))['then'](saveUpdates(_0x5bc106[_0xe24e('0x4b')],null))['then'](respondWithResult(_0x1a8f9f,null))[_0xe24e('0x55')](handleError(_0x1a8f9f,null));};exports[_0xe24e('0x28')]=function(_0x2bc40e,_0x2bd97b){return db[_0xe24e('0x31')]['find']({'where':{'id':_0x2bc40e['params']['id']}})[_0xe24e('0x29')](handleEntityNotFound(_0x2bd97b,null))[_0xe24e('0x29')](removeEntity(_0x2bd97b,null))[_0xe24e('0x55')](handleError(_0x2bd97b,null));};exports[_0xe24e('0x56')]=function(_0x57ce82,_0x4136e5){return db[_0xe24e('0x31')][_0xe24e('0x56')]()[_0xe24e('0x29')](respondWithResult(_0x4136e5,null))[_0xe24e('0x55')](handleError(_0x4136e5,null));};exports[_0xe24e('0x57')]=function(_0x1dc5ae,_0x4d7eba,_0x3d41ee){var _0x56db84={'raw':!![],'where':{}},_0x1a0eaf={},_0x2d7f28;return db['SmsQueue']['findOne']({'where':{'id':_0x1dc5ae['params']['id']}})[_0xe24e('0x29')](handleEntityNotFound(_0x4d7eba,null))[_0xe24e('0x29')](function(_0x41c65f){if(_0x41c65f){_0x2d7f28=_0x41c65f[_0xe24e('0x2a')]({'plain':!![]});_0x1a0eaf['model']=_[_0xe24e('0x37')](db[_0xe24e('0x58')][_0xe24e('0x32')]);_0x1a0eaf[_0xe24e('0x36')]=_[_0xe24e('0x37')](_0x1dc5ae[_0xe24e('0x36')]);_0x1a0eaf[_0xe24e('0x38')]=_[_0xe24e('0x39')](_0x1a0eaf[_0xe24e('0x35')],_0x1a0eaf[_0xe24e('0x36')]);_0x56db84[_0xe24e('0x3b')]=_[_0xe24e('0x39')](_0x1a0eaf[_0xe24e('0x35')],qs[_0xe24e('0x3a')](_0x1dc5ae[_0xe24e('0x36')]['fields']));_0x56db84[_0xe24e('0x3b')]=_0x56db84[_0xe24e('0x3b')]['length']?_0x56db84['attributes']:_0x1a0eaf[_0xe24e('0x35')];if(!_0x1dc5ae['query'][_0xe24e('0x3c')](_0xe24e('0x3d'))){_0x56db84['limit']=qs[_0xe24e('0x1f')](_0x1dc5ae[_0xe24e('0x36')][_0xe24e('0x1f')]);_0x56db84[_0xe24e('0x1e')]=qs[_0xe24e('0x1e')](_0x1dc5ae['query'][_0xe24e('0x1e')]);}_0x56db84[_0xe24e('0x59')]=qs[_0xe24e('0x3e')](_0x1dc5ae[_0xe24e('0x36')][_0xe24e('0x3e')]);_0x56db84['where']=qs[_0xe24e('0x38')](_[_0xe24e('0x5a')](_0x1dc5ae[_0xe24e('0x36')],_0x1a0eaf['filters']));_0x56db84[_0xe24e('0x42')]['SmsQueueId']=_0x41c65f['id'];if(_0x1dc5ae[_0xe24e('0x36')][_0xe24e('0x3f')]){_0x56db84[_0xe24e('0x42')]=_[_0xe24e('0x40')](_0x56db84[_0xe24e('0x42')],{'$or':_[_0xe24e('0x30')](_0x56db84[_0xe24e('0x3b')],function(_0x20f59d){var _0xe5908a={};_0xe5908a[_0x20f59d]={'$like':'%'+_0x1dc5ae['query'][_0xe24e('0x3f')]+'%'};return _0xe5908a;})});}_0x56db84=_[_0xe24e('0x40')]({},_0x56db84,_0x1dc5ae[_0xe24e('0x41')]);return db[_0xe24e('0x58')][_0xe24e('0x45')](_0x56db84);}})[_0xe24e('0x29')](function(_0x5b0924){if(_0x5b0924){return db[_0xe24e('0x5b')]['findAndCountAll']({'where':{'id':_['map'](_0x5b0924,'UserId'),'role':_0xe24e('0x5c')},'attributes':['id',_0xe24e('0x2e'),_0xe24e('0x5d'),_0xe24e('0x5e'),_0xe24e('0x5f')]});}})[_0xe24e('0x29')](function(_0x373aad){if(_0x373aad){return{'count':_0x373aad[_0xe24e('0x21')],'rows':_['map'](_0x373aad['rows'],function(_0x5e84af){return{'membername':_0x5e84af[_0xe24e('0x2e')],'UserId':_0x5e84af['id'],'queue_name':_0x2d7f28['name'],'SmsQueueId':_0x2d7f28['id'],'interface':util[_0xe24e('0x60')]('%s/%s',_0xe24e('0x61'),_0x5e84af[_0xe24e('0x2e')]),'penalty':0x0,'paused':_0x5e84af['smsPause'],'createdAt':_0x5e84af['createdAt'],'updatedAt':_0x5e84af['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe24e('0x29')](respondWithFilteredResult(_0x4d7eba,_0x56db84))[_0xe24e('0x55')](handleError(_0x4d7eba,null));};exports[_0xe24e('0x62')]=function(_0x282a09,_0x46a6c4,_0xf7a689){var _0x3e92a6={};var _0x30867b={};var _0x5f1470;var _0x5d0b27;return db[_0xe24e('0x31')][_0xe24e('0x63')]({'where':{'id':_0x282a09['params']['id']}})[_0xe24e('0x29')](handleEntityNotFound(_0x46a6c4,null))[_0xe24e('0x29')](function(_0xa655db){if(_0xa655db){_0x5f1470=_0xa655db;_0x30867b['model']=_[_0xe24e('0x37')](db[_0xe24e('0x64')][_0xe24e('0x32')]);_0x30867b['query']=_[_0xe24e('0x37')](_0x282a09[_0xe24e('0x36')]);_0x30867b[_0xe24e('0x38')]=_[_0xe24e('0x39')](_0x30867b[_0xe24e('0x35')],_0x30867b['query']);_0x3e92a6[_0xe24e('0x3b')]=_[_0xe24e('0x39')](_0x30867b[_0xe24e('0x35')],qs[_0xe24e('0x3a')](_0x282a09[_0xe24e('0x36')][_0xe24e('0x3a')]));_0x3e92a6[_0xe24e('0x3b')]=_0x3e92a6[_0xe24e('0x3b')][_0xe24e('0x48')]?_0x3e92a6[_0xe24e('0x3b')]:_0x30867b[_0xe24e('0x35')];_0x3e92a6['order']=qs[_0xe24e('0x3e')](_0x282a09[_0xe24e('0x36')]['sort']);_0x3e92a6['where']=qs[_0xe24e('0x38')](_[_0xe24e('0x5a')](_0x282a09['query'],_0x30867b[_0xe24e('0x38')]));if(_0x282a09[_0xe24e('0x36')]['filter']){_0x3e92a6[_0xe24e('0x42')]=_['merge'](_0x3e92a6[_0xe24e('0x42')],{'$or':_[_0xe24e('0x30')](_0x3e92a6[_0xe24e('0x3b')],function(_0x520a1e){var _0x4705ac={};_0x4705ac[_0x520a1e]={'$like':'%'+_0x282a09[_0xe24e('0x36')][_0xe24e('0x3f')]+'%'};return _0x4705ac;})});}_0x3e92a6=_[_0xe24e('0x40')]({},_0x3e92a6,_0x282a09[_0xe24e('0x41')]);return _0x5f1470['getTeams'](_0x3e92a6);}})[_0xe24e('0x29')](function(_0x5958b4){if(_0x5958b4){_0x5d0b27=_0x5958b4['length'];if(!_0x282a09[_0xe24e('0x36')][_0xe24e('0x3c')]('nolimit')){_0x3e92a6[_0xe24e('0x1f')]=qs[_0xe24e('0x1f')](_0x282a09[_0xe24e('0x36')][_0xe24e('0x1f')]);_0x3e92a6[_0xe24e('0x1e')]=qs[_0xe24e('0x1e')](_0x282a09[_0xe24e('0x36')][_0xe24e('0x1e')]);}return _0x5f1470['getTeams'](_0x3e92a6);}})[_0xe24e('0x29')](function(_0x16f23d){if(_0x16f23d){return _0x16f23d?{'count':_0x5d0b27,'rows':_0x16f23d}:null;}})[_0xe24e('0x29')](respondWithResult(_0x46a6c4,null))['catch'](handleError(_0x46a6c4,null));};exports[_0xe24e('0x65')]=function(_0x5acaf1,_0xa07f6b,_0x268a7a){var _0x582b4e=_0x5acaf1[_0xe24e('0x4b')][_0xe24e('0x66')];return db[_0xe24e('0x64')][_0xe24e('0x45')]({'where':{'id':_0x582b4e},'attributes':['id'],'include':[{'model':db[_0xe24e('0x5b')],'as':_0xe24e('0x67'),'attributes':['id',_0xe24e('0x2e'),_0xe24e('0x68'),'voicePause',_0xe24e('0x69')],'raw':!![]}]})[_0xe24e('0x29')](function(_0x48e58a){if(_0x48e58a){var _0x51e974=_[_0xe24e('0x6a')](_0x48e58a,function(_0x66af45){var _0x423217=_0x66af45[_0xe24e('0x2a')]({'plain':!![]});return _0x423217['Agents'];});return db[_0xe24e('0x31')][_0xe24e('0x49')]({'where':{'id':_0x5acaf1['params']['id']}})['then'](function(_0x4755c7){return db['sequelize']['transaction'](function(_0x34ced6){return _0x4755c7[_0xe24e('0x65')](_0x582b4e,{'transaction':_0x34ced6})[_0xe24e('0x29')](function(){return BPromise[_0xe24e('0x6b')](_0x51e974,function(_0x76b698){return db[_0xe24e('0x58')]['findOrCreate']({'where':{'UserId':_0x76b698['id'],'SmsQueueId':_0x5acaf1['params']['id']},'transaction':_0x34ced6});});})[_0xe24e('0x29')](function(){_0x51e974[_0xe24e('0x6c')](function(_0x4887d7){socket[_0xe24e('0x6d')](_0xe24e('0x6e'),{'UserId':_0x4887d7['id'],'SmsQueueId':_0x4755c7['id']});});});});});}})[_0xe24e('0x29')](respondWithStatusCode(_0xa07f6b,null))[_0xe24e('0x55')](handleError(_0xa07f6b,null));};exports[_0xe24e('0x6f')]=function(_0x59c605,_0xebc38c,_0x167720){return db[_0xe24e('0x64')][_0xe24e('0x45')]({'where':{'id':_0x59c605[_0xe24e('0x36')][_0xe24e('0x66')]},'attributes':['id'],'include':[{'model':db[_0xe24e('0x5b')],'as':_0xe24e('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xebc38c,null))['then'](function(_0x267eae){var _0x450b7c=_['map'](_0x267eae,'id');var _0x444578=[];var _0x422928=[];var _0x3b68d1=squel[_0xe24e('0x70')]();_0x3b68d1[_0xe24e('0x71')](_0xe24e('0x72'))[_0xe24e('0x73')]('team_has_sms_queues','tq')[_0xe24e('0x74')](_0xe24e('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe24e('0x42')](_0xe24e('0x76'),_0x59c605[_0xe24e('0x54')]['id']);for(var _0x1ee8f7=0x0;_0x1ee8f7<_0x267eae[_0xe24e('0x48')];_0x1ee8f7+=0x1){let _0x160609=_0x267eae[_0x1ee8f7];for(var _0x20bcf0=0x0;_0x20bcf0<_0x160609[_0xe24e('0x67')]['length'];_0x20bcf0+=0x1){let _0x417fd4=_0x160609[_0xe24e('0x67')][_0x20bcf0];var _0x3ba0ee=_0x3b68d1[_0xe24e('0x77')]();_0x3ba0ee['where'](_0xe24e('0x78'),_0x417fd4['id']);_0x422928[_0xe24e('0x79')](db[_0xe24e('0x7a')]['query'](_0x3ba0ee['toString'](),{'type':db[_0xe24e('0x7a')][_0xe24e('0x7b')][_0xe24e('0x7c')]})[_0xe24e('0x29')](function(_0x5974b5){if(_0x5974b5[_0xe24e('0x48')]===0x1){return _0x417fd4['id'];}else{var _0x30d38a=_[_0xe24e('0x7d')](_[_0xe24e('0x30')](_0x5974b5,'TeamId'),function(_0x36ed39){return _[_0xe24e('0x7e')](_0x450b7c,_0x36ed39);});if(_0x30d38a){return _0x417fd4['id'];}}}));}}return BPromise[_0xe24e('0x7f')](_0x422928)[_0xe24e('0x29')](function(_0x2916a3){_0x444578=_(_0x444578)[_0xe24e('0x80')](_0x2916a3)['compact']()['value']();return db[_0xe24e('0x31')][_0xe24e('0x49')]({'where':{'id':_0x59c605[_0xe24e('0x54')]['id']}})[_0xe24e('0x29')](function(_0x2ca8c6){return db['sequelize'][_0xe24e('0x81')](function(_0x55b0f5){return _0x2ca8c6[_0xe24e('0x6f')](_0x59c605[_0xe24e('0x36')][_0xe24e('0x66')],{'transaction':_0x55b0f5})[_0xe24e('0x29')](function(){if(!_[_0xe24e('0x82')](_0x444578)){return _0x2ca8c6[_0xe24e('0x83')](_0x444578,{'transaction':_0x55b0f5});}})[_0xe24e('0x29')](function(){_0x444578[_0xe24e('0x6c')](function(_0x55caa5){socket[_0xe24e('0x6d')](_0xe24e('0x84'),{'UserId':_0x55caa5,'SmsQueueId':_0x2ca8c6['id']});});});});});});})['then'](respondWithStatusCode(_0xebc38c,null))['catch'](handleError(_0xebc38c,null));};exports['addAgents']=function(_0x41b473,_0x2a3868,_0x57c25f){return db[_0xe24e('0x31')][_0xe24e('0x49')]({'where':{'id':_0x41b473[_0xe24e('0x54')]['id']}})[_0xe24e('0x29')](handleEntityNotFound(_0x2a3868,null))['then'](function(_0x5819b9){if(_0x5819b9){return _0x5819b9[_0xe24e('0x85')](_0x41b473[_0xe24e('0x4b')]['ids'],_[_0xe24e('0x86')](_0x41b473['body'],['ids','id'])||{})[_0xe24e('0x87')](function(_0x59145b){for(var _0x3f0517=0x0;_0x3f0517<_0x41b473[_0xe24e('0x4b')]['ids']['length'];_0x3f0517+=0x1){socket[_0xe24e('0x6d')](_0xe24e('0x6e'),{'UserId':Number(_0x41b473['body'][_0xe24e('0x66')][_0x3f0517]),'SmsQueueId':Number(_0x41b473[_0xe24e('0x54')]['id'])});}return _0x59145b;});}})['then'](respondWithResult(_0x2a3868,null))[_0xe24e('0x55')](handleError(_0x2a3868,null));};exports[_0xe24e('0x83')]=function(_0xbba1,_0x5ea08a,_0x514105){return db[_0xe24e('0x31')]['find']({'where':{'id':_0xbba1[_0xe24e('0x54')]['id']}})['then'](handleEntityNotFound(_0x5ea08a,null))[_0xe24e('0x29')](function(_0x1760a5){if(_0x1760a5){return _0x1760a5[_0xe24e('0x83')](_0xbba1[_0xe24e('0x36')][_0xe24e('0x66')])['then'](function(){if(_[_0xe24e('0x88')](_0xbba1[_0xe24e('0x36')][_0xe24e('0x66')])){for(var _0x409212=0x0;_0x409212<_0xbba1['query'][_0xe24e('0x66')][_0xe24e('0x48')];_0x409212+=0x1){socket[_0xe24e('0x6d')](_0xe24e('0x84'),{'UserId':Number(_0xbba1[_0xe24e('0x36')][_0xe24e('0x66')][_0x409212]),'SmsQueueId':Number(_0xbba1[_0xe24e('0x54')]['id'])});}}else{socket[_0xe24e('0x6d')](_0xe24e('0x84'),{'UserId':Number(_0xbba1['query'][_0xe24e('0x66')]),'SmsQueueId':Number(_0xbba1[_0xe24e('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x5ea08a,null))[_0xe24e('0x55')](handleError(_0x5ea08a,null));};exports['getAgents']=function(_0x53e6ba,_0xbb83a7,_0x148ece){var _0x319b87={};var _0x4a4fe0={};var _0x2030a1;var _0x27f389;return db['SmsQueue'][_0xe24e('0x63')]({'where':{'id':_0x53e6ba['params']['id']}})[_0xe24e('0x29')](handleEntityNotFound(_0xbb83a7,null))['then'](function(_0x374a2c){if(_0x374a2c){_0x2030a1=_0x374a2c;_0x4a4fe0[_0xe24e('0x35')]=_[_0xe24e('0x37')](db[_0xe24e('0x5b')][_0xe24e('0x32')]);_0x4a4fe0[_0xe24e('0x36')]=_['keys'](_0x53e6ba['query']);_0x4a4fe0[_0xe24e('0x38')]=_[_0xe24e('0x39')](_0x4a4fe0[_0xe24e('0x35')],_0x4a4fe0[_0xe24e('0x36')]);_0x319b87[_0xe24e('0x3b')]=_[_0xe24e('0x39')](_0x4a4fe0[_0xe24e('0x35')],qs[_0xe24e('0x3a')](_0x53e6ba[_0xe24e('0x36')]['fields']));_0x319b87[_0xe24e('0x3b')]=_0x319b87[_0xe24e('0x3b')][_0xe24e('0x48')]?_0x319b87[_0xe24e('0x3b')]:_0x4a4fe0[_0xe24e('0x35')];_0x319b87['order']=qs[_0xe24e('0x3e')](_0x53e6ba[_0xe24e('0x36')]['sort']);_0x319b87['where']=qs['filters'](_['pick'](_0x53e6ba[_0xe24e('0x36')],_0x4a4fe0[_0xe24e('0x38')]));if(_0x53e6ba[_0xe24e('0x36')][_0xe24e('0x3f')]){_0x319b87[_0xe24e('0x42')]=_[_0xe24e('0x40')](_0x319b87[_0xe24e('0x42')],{'$or':_[_0xe24e('0x30')](_0x319b87[_0xe24e('0x3b')],function(_0x442f02){var _0x587a4c={};_0x587a4c[_0x442f02]={'$like':'%'+_0x53e6ba[_0xe24e('0x36')][_0xe24e('0x3f')]+'%'};return _0x587a4c;})});}_0x319b87=_['merge']({},_0x319b87,_0x53e6ba[_0xe24e('0x41')]);return _0x2030a1[_0xe24e('0x89')](_0x319b87);}})['then'](function(_0xc83e33){if(_0xc83e33){_0x27f389=_0xc83e33['length'];if(!_0x53e6ba[_0xe24e('0x36')][_0xe24e('0x3c')](_0xe24e('0x3d'))){_0x319b87[_0xe24e('0x1f')]=qs[_0xe24e('0x1f')](_0x53e6ba[_0xe24e('0x36')][_0xe24e('0x1f')]);_0x319b87[_0xe24e('0x1e')]=qs[_0xe24e('0x1e')](_0x53e6ba['query'][_0xe24e('0x1e')]);}return _0x2030a1['getAgents'](_0x319b87);}})[_0xe24e('0x29')](function(_0x55b3d9){if(_0x55b3d9){return _0x55b3d9?{'count':_0x27f389,'rows':_0x55b3d9}:null;}})[_0xe24e('0x29')](respondWithResult(_0xbb83a7,null))[_0xe24e('0x55')](handleError(_0xbb83a7,null));}; \ No newline at end of file +var _0x756f=['tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','SmsQueues','UserProfileResource','status','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','SmsQueue','includeAll','findAll','rows','show','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','body','params','describe','getMembers','findOne','hasOwnProperty','pick','options','UserSmsQueue','User','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','addTeams','Team','Agents','online','voicePause','interface','sequelize','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','field'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x756f,0x137));var _0xf756=function(_0x5ba96b,_0x11f92f){_0x5ba96b=_0x5ba96b-0x0;var _0x445684=_0x756f[_0x5ba96b];return _0x445684;};'use strict';var emlformat=require(_0xf756('0x0'));var rimraf=require(_0xf756('0x1'));var zipdir=require(_0xf756('0x2'));var jsonpatch=require(_0xf756('0x3'));var rp=require('request-promise');var moment=require(_0xf756('0x4'));var BPromise=require(_0xf756('0x5'));var Mustache=require(_0xf756('0x6'));var util=require(_0xf756('0x7'));var path=require(_0xf756('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf756('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf756('0xa'));var squel=require(_0xf756('0xb'));var crypto=require(_0xf756('0xc'));var jsforce=require(_0xf756('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf756('0xe'));var Papa=require(_0xf756('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf756('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf756('0x11'));var logger=require(_0xf756('0x12'))(_0xf756('0x13'));var utils=require(_0xf756('0x14'));var config=require(_0xf756('0x15'));var licenseUtil=require(_0xf756('0x16'));var db=require(_0xf756('0x17'))['db'];config[_0xf756('0x18')]=_[_0xf756('0x19')](config[_0xf756('0x18')],{'host':_0xf756('0x1a'),'port':0x18eb});var socket=require(_0xf756('0x1b'))(new Redis(config['redis']));require(_0xf756('0x1c'))[_0xf756('0x1d')](socket);function respondWithStatusCode(_0x31e27e,_0x4d402d){_0x4d402d=_0x4d402d||0xcc;return function(_0x50d640){if(_0x50d640){return _0x31e27e['sendStatus'](_0x4d402d);}return _0x31e27e['status'](_0x4d402d)['end']();};}function respondWithResult(_0x4a340f,_0x3753bf){_0x3753bf=_0x3753bf||0xc8;return function(_0x57d979){if(_0x57d979){return _0x4a340f['status'](_0x3753bf)[_0xf756('0x1e')](_0x57d979);}};}function respondWithFilteredResult(_0x2bcea4,_0x3c95d3){return function(_0x2b6430){if(_0x2b6430){var _0x204951=typeof _0x3c95d3[_0xf756('0x1f')]==='undefined'&&typeof _0x3c95d3[_0xf756('0x20')]===_0xf756('0x21');var _0x3b32f8=_0x2b6430[_0xf756('0x22')];var _0x44651d=_0x204951?0x0:_0x3c95d3['offset'];var _0x7a7e9d=_0x204951?_0x2b6430[_0xf756('0x22')]:_0x3c95d3[_0xf756('0x1f')]+_0x3c95d3[_0xf756('0x20')];var _0x56c9d4;if(_0x7a7e9d>=_0x3b32f8){_0x7a7e9d=_0x3b32f8;_0x56c9d4=0xc8;}else{_0x56c9d4=0xce;}_0x2bcea4['status'](_0x56c9d4);return _0x2bcea4[_0xf756('0x23')](_0xf756('0x24'),_0x44651d+'-'+_0x7a7e9d+'/'+_0x3b32f8)[_0xf756('0x1e')](_0x2b6430);}return null;};}function patchUpdates(_0x1af286){return function(_0xcb495){try{jsonpatch[_0xf756('0x25')](_0xcb495,_0x1af286,!![]);}catch(_0x252112){return BPromise[_0xf756('0x26')](_0x252112);}return _0xcb495[_0xf756('0x27')]();};}function saveUpdates(_0x58117d,_0x83bf0){return function(_0xe3dc28){if(_0xe3dc28){return _0xe3dc28[_0xf756('0x28')](_0x58117d)[_0xf756('0x29')](function(_0x22eb27){return _0x22eb27;});}return null;};}function removeEntity(_0x126dc1,_0x53cdcb){return function(_0x4223cf){if(_0x4223cf){return _0x4223cf[_0xf756('0x2a')]()[_0xf756('0x29')](function(){var _0x2fb858=_0x4223cf['get']({'plain':!![]});var _0x26f952=_0xf756('0x2b');return db[_0xf756('0x2c')][_0xf756('0x2a')]({'where':{'type':_0x26f952,'resourceId':_0x2fb858['id']}})[_0xf756('0x29')](function(){return _0x4223cf;});})['then'](function(){_0x126dc1[_0xf756('0x2d')](0xcc)[_0xf756('0x2e')]();});}};}function handleEntityNotFound(_0x2da963,_0x2d84f4){return function(_0x100e92){if(!_0x100e92){_0x2da963['sendStatus'](0x194);}return _0x100e92;};}function handleError(_0x549f42,_0x31e8e4){_0x31e8e4=_0x31e8e4||0x1f4;return function(_0x414308){logger['error'](_0x414308[_0xf756('0x2f')]);if(_0x414308[_0xf756('0x30')]){delete _0x414308[_0xf756('0x30')];}_0x549f42[_0xf756('0x2d')](_0x31e8e4)[_0xf756('0x31')](_0x414308);};}exports[_0xf756('0x32')]=function(_0x5417a,_0x457619){var _0x147557={},_0x55a1f8={},_0xf3c2fb={'count':0x0,'rows':[]};var _0x5adce1=_[_0xf756('0x33')](db['SmsQueue'][_0xf756('0x34')],function(_0x5e21d6){return{'name':_0x5e21d6[_0xf756('0x35')],'type':_0x5e21d6[_0xf756('0x36')]['key']};});_0x55a1f8[_0xf756('0x37')]=_[_0xf756('0x33')](_0x5adce1,_0xf756('0x30'));_0x55a1f8[_0xf756('0x38')]=_[_0xf756('0x39')](_0x5417a[_0xf756('0x38')]);_0x55a1f8[_0xf756('0x3a')]=_[_0xf756('0x3b')](_0x55a1f8[_0xf756('0x37')],_0x55a1f8[_0xf756('0x38')]);_0x147557[_0xf756('0x3c')]=_['intersection'](_0x55a1f8[_0xf756('0x37')],qs[_0xf756('0x3d')](_0x5417a[_0xf756('0x38')][_0xf756('0x3d')]));_0x147557['attributes']=_0x147557[_0xf756('0x3c')][_0xf756('0x3e')]?_0x147557[_0xf756('0x3c')]:_0x55a1f8[_0xf756('0x37')];if(!_0x5417a[_0xf756('0x38')]['hasOwnProperty'](_0xf756('0x3f'))){_0x147557[_0xf756('0x20')]=qs[_0xf756('0x20')](_0x5417a[_0xf756('0x38')][_0xf756('0x20')]);_0x147557[_0xf756('0x1f')]=qs[_0xf756('0x1f')](_0x5417a[_0xf756('0x38')][_0xf756('0x1f')]);}_0x147557[_0xf756('0x40')]=qs[_0xf756('0x41')](_0x5417a[_0xf756('0x38')][_0xf756('0x41')]);_0x147557[_0xf756('0x42')]=qs[_0xf756('0x3a')](_['pick'](_0x5417a[_0xf756('0x38')],_0x55a1f8[_0xf756('0x3a')]),_0x5adce1);if(_0x5417a['query']['filter']){_0x147557[_0xf756('0x42')]=_[_0xf756('0x43')](_0x147557[_0xf756('0x42')],{'$or':_[_0xf756('0x33')](_0x5adce1,function(_0x82edbb){if(_0x82edbb['type']!==_0xf756('0x44')){var _0x42c892={};_0x42c892[_0x82edbb[_0xf756('0x30')]]={'$like':'%'+_0x5417a[_0xf756('0x38')][_0xf756('0x45')]+'%'};return _0x42c892;}})});}_0x147557=_['merge']({},_0x147557,_0x5417a['options']);var _0x3a7e71={'where':_0x147557['where']};return db[_0xf756('0x46')][_0xf756('0x22')](_0x3a7e71)['then'](function(_0xa3804d){_0xf3c2fb[_0xf756('0x22')]=_0xa3804d;if(_0x5417a[_0xf756('0x38')][_0xf756('0x47')]){_0x147557['include']=[{'all':!![]}];}return db[_0xf756('0x46')][_0xf756('0x48')](_0x147557);})[_0xf756('0x29')](function(_0x5ccadc){_0xf3c2fb[_0xf756('0x49')]=_0x5ccadc;return _0xf3c2fb;})[_0xf756('0x29')](respondWithFilteredResult(_0x457619,_0x147557))['catch'](handleError(_0x457619,null));};exports[_0xf756('0x4a')]=function(_0x3be1e6,_0x4926b3){var _0x104513={'raw':!![],'where':{'id':_0x3be1e6['params']['id']}},_0x537e45={};_0x537e45[_0xf756('0x37')]=_[_0xf756('0x39')](db['SmsQueue'][_0xf756('0x34')]);_0x537e45[_0xf756('0x38')]=_['keys'](_0x3be1e6['query']);_0x537e45[_0xf756('0x3a')]=_[_0xf756('0x3b')](_0x537e45[_0xf756('0x37')],_0x537e45[_0xf756('0x38')]);_0x104513[_0xf756('0x3c')]=_[_0xf756('0x3b')](_0x537e45[_0xf756('0x37')],qs['fields'](_0x3be1e6['query'][_0xf756('0x3d')]));_0x104513[_0xf756('0x3c')]=_0x104513[_0xf756('0x3c')][_0xf756('0x3e')]?_0x104513[_0xf756('0x3c')]:_0x537e45['model'];if(_0x3be1e6['query'][_0xf756('0x47')]){_0x104513['include']=[{'all':!![]}];}_0x104513=_[_0xf756('0x43')]({},_0x104513,_0x3be1e6['options']);return db[_0xf756('0x46')][_0xf756('0x4b')](_0x104513)[_0xf756('0x29')](handleEntityNotFound(_0x4926b3,null))['then'](respondWithResult(_0x4926b3,null))[_0xf756('0x4c')](handleError(_0x4926b3,null));};exports[_0xf756('0x4d')]=function(_0x42fb69,_0x56a4fe){return db[_0xf756('0x46')][_0xf756('0x4d')](_0x42fb69['body'],{})['then'](function(_0x56045b){var _0x2b4336=_0x42fb69['user'][_0xf756('0x4e')]({'plain':!![]});if(!_0x2b4336)throw new Error(_0xf756('0x4f'));if(_0x2b4336[_0xf756('0x50')]===_0xf756('0x51')){var _0x2ba823=_0x56045b[_0xf756('0x4e')]({'plain':!![]});var _0x1b4512=_0xf756('0x2b');return db[_0xf756('0x52')][_0xf756('0x4b')]({'where':{'name':_0x1b4512,'userProfileId':_0x2b4336[_0xf756('0x53')]},'raw':!![]})[_0xf756('0x29')](function(_0x2abdf5){if(_0x2abdf5&&_0x2abdf5[_0xf756('0x54')]===0x0){return db[_0xf756('0x2c')][_0xf756('0x4d')]({'name':_0x2ba823[_0xf756('0x30')],'resourceId':_0x2ba823['id'],'type':_0x2abdf5[_0xf756('0x30')],'sectionId':_0x2abdf5['id']},{})[_0xf756('0x29')](function(){return _0x56045b;});}else{return _0x56045b;}})[_0xf756('0x4c')](function(_0x3257f4){logger[_0xf756('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3257f4);throw _0x3257f4;});}return _0x56045b;})[_0xf756('0x29')](respondWithResult(_0x56a4fe,0xc9))[_0xf756('0x4c')](handleError(_0x56a4fe,null));};exports['update']=function(_0x151fd6,_0x58df3f){if(_0x151fd6['body']['id']){delete _0x151fd6[_0xf756('0x56')]['id'];}return db[_0xf756('0x46')][_0xf756('0x4b')]({'where':{'id':_0x151fd6['params']['id']}})[_0xf756('0x29')](handleEntityNotFound(_0x58df3f,null))[_0xf756('0x29')](saveUpdates(_0x151fd6['body'],null))[_0xf756('0x29')](respondWithResult(_0x58df3f,null))[_0xf756('0x4c')](handleError(_0x58df3f,null));};exports[_0xf756('0x2a')]=function(_0x3178ab,_0x206860){return db[_0xf756('0x46')][_0xf756('0x4b')]({'where':{'id':_0x3178ab[_0xf756('0x57')]['id']}})[_0xf756('0x29')](handleEntityNotFound(_0x206860,null))['then'](removeEntity(_0x206860,null))[_0xf756('0x4c')](handleError(_0x206860,null));};exports[_0xf756('0x58')]=function(_0x420782,_0x483242){return db[_0xf756('0x46')][_0xf756('0x58')]()[_0xf756('0x29')](respondWithResult(_0x483242,null))[_0xf756('0x4c')](handleError(_0x483242,null));};exports[_0xf756('0x59')]=function(_0x4c213b,_0x500c1c,_0x32b19e){var _0x1ecd90={'raw':!![],'where':{}},_0x4d5db3={},_0x2a4661;return db[_0xf756('0x46')][_0xf756('0x5a')]({'where':{'id':_0x4c213b[_0xf756('0x57')]['id']}})[_0xf756('0x29')](handleEntityNotFound(_0x500c1c,null))[_0xf756('0x29')](function(_0x2b0d8d){if(_0x2b0d8d){_0x2a4661=_0x2b0d8d['get']({'plain':!![]});_0x4d5db3[_0xf756('0x37')]=_[_0xf756('0x39')](db['UserSmsQueue']['rawAttributes']);_0x4d5db3[_0xf756('0x38')]=_['keys'](_0x4c213b[_0xf756('0x38')]);_0x4d5db3['filters']=_[_0xf756('0x3b')](_0x4d5db3[_0xf756('0x37')],_0x4d5db3['query']);_0x1ecd90[_0xf756('0x3c')]=_[_0xf756('0x3b')](_0x4d5db3[_0xf756('0x37')],qs[_0xf756('0x3d')](_0x4c213b[_0xf756('0x38')][_0xf756('0x3d')]));_0x1ecd90[_0xf756('0x3c')]=_0x1ecd90['attributes'][_0xf756('0x3e')]?_0x1ecd90[_0xf756('0x3c')]:_0x4d5db3[_0xf756('0x37')];if(!_0x4c213b['query'][_0xf756('0x5b')]('nolimit')){_0x1ecd90[_0xf756('0x20')]=qs[_0xf756('0x20')](_0x4c213b[_0xf756('0x38')][_0xf756('0x20')]);_0x1ecd90['offset']=qs['offset'](_0x4c213b[_0xf756('0x38')]['offset']);}_0x1ecd90[_0xf756('0x40')]=qs[_0xf756('0x41')](_0x4c213b['query'][_0xf756('0x41')]);_0x1ecd90[_0xf756('0x42')]=qs[_0xf756('0x3a')](_[_0xf756('0x5c')](_0x4c213b[_0xf756('0x38')],_0x4d5db3['filters']));_0x1ecd90[_0xf756('0x42')]['SmsQueueId']=_0x2b0d8d['id'];if(_0x4c213b[_0xf756('0x38')][_0xf756('0x45')]){_0x1ecd90['where']=_[_0xf756('0x43')](_0x1ecd90[_0xf756('0x42')],{'$or':_[_0xf756('0x33')](_0x1ecd90['attributes'],function(_0x5cdc7d){var _0x5b9463={};_0x5b9463[_0x5cdc7d]={'$like':'%'+_0x4c213b[_0xf756('0x38')][_0xf756('0x45')]+'%'};return _0x5b9463;})});}_0x1ecd90=_[_0xf756('0x43')]({},_0x1ecd90,_0x4c213b[_0xf756('0x5d')]);return db[_0xf756('0x5e')][_0xf756('0x48')](_0x1ecd90);}})[_0xf756('0x29')](function(_0x470212){if(_0x470212){return db[_0xf756('0x5f')]['findAndCountAll']({'where':{'id':_['map'](_0x470212,_0xf756('0x60')),'role':_0xf756('0x61')},'attributes':['id','name',_0xf756('0x62'),_0xf756('0x63'),_0xf756('0x64')]});}})[_0xf756('0x29')](function(_0xa8b2c3){if(_0xa8b2c3){return{'count':_0xa8b2c3[_0xf756('0x22')],'rows':_[_0xf756('0x33')](_0xa8b2c3[_0xf756('0x49')],function(_0x2735ef){return{'membername':_0x2735ef[_0xf756('0x30')],'UserId':_0x2735ef['id'],'queue_name':_0x2a4661[_0xf756('0x30')],'SmsQueueId':_0x2a4661['id'],'interface':util[_0xf756('0x65')]('%s/%s',_0xf756('0x66'),_0x2735ef['name']),'penalty':0x0,'paused':_0x2735ef[_0xf756('0x62')],'createdAt':_0x2735ef['createdAt'],'updatedAt':_0x2735ef[_0xf756('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf756('0x29')](respondWithFilteredResult(_0x500c1c,_0x1ecd90))[_0xf756('0x4c')](handleError(_0x500c1c,null));};exports['getTeams']=function(_0x3c3de1,_0x16b6f3,_0x3c1e3c){var _0x5ae55a={};var _0x24be85={};var _0x2c851d;var _0x715e56;return db[_0xf756('0x46')]['findOne']({'where':{'id':_0x3c3de1['params']['id']}})[_0xf756('0x29')](handleEntityNotFound(_0x16b6f3,null))['then'](function(_0x299b5b){if(_0x299b5b){_0x2c851d=_0x299b5b;_0x24be85[_0xf756('0x37')]=_[_0xf756('0x39')](db['Team'][_0xf756('0x34')]);_0x24be85['query']=_[_0xf756('0x39')](_0x3c3de1[_0xf756('0x38')]);_0x24be85['filters']=_['intersection'](_0x24be85[_0xf756('0x37')],_0x24be85[_0xf756('0x38')]);_0x5ae55a[_0xf756('0x3c')]=_[_0xf756('0x3b')](_0x24be85['model'],qs[_0xf756('0x3d')](_0x3c3de1[_0xf756('0x38')][_0xf756('0x3d')]));_0x5ae55a[_0xf756('0x3c')]=_0x5ae55a['attributes'][_0xf756('0x3e')]?_0x5ae55a['attributes']:_0x24be85[_0xf756('0x37')];_0x5ae55a[_0xf756('0x40')]=qs[_0xf756('0x41')](_0x3c3de1[_0xf756('0x38')][_0xf756('0x41')]);_0x5ae55a[_0xf756('0x42')]=qs[_0xf756('0x3a')](_[_0xf756('0x5c')](_0x3c3de1[_0xf756('0x38')],_0x24be85[_0xf756('0x3a')]));if(_0x3c3de1[_0xf756('0x38')][_0xf756('0x45')]){_0x5ae55a[_0xf756('0x42')]=_[_0xf756('0x43')](_0x5ae55a[_0xf756('0x42')],{'$or':_[_0xf756('0x33')](_0x5ae55a[_0xf756('0x3c')],function(_0x114a42){var _0x10d47d={};_0x10d47d[_0x114a42]={'$like':'%'+_0x3c3de1['query']['filter']+'%'};return _0x10d47d;})});}_0x5ae55a=_['merge']({},_0x5ae55a,_0x3c3de1['options']);return _0x2c851d['getTeams'](_0x5ae55a);}})[_0xf756('0x29')](function(_0x11f921){if(_0x11f921){_0x715e56=_0x11f921['length'];if(!_0x3c3de1[_0xf756('0x38')]['hasOwnProperty'](_0xf756('0x3f'))){_0x5ae55a[_0xf756('0x20')]=qs[_0xf756('0x20')](_0x3c3de1[_0xf756('0x38')][_0xf756('0x20')]);_0x5ae55a[_0xf756('0x1f')]=qs['offset'](_0x3c3de1[_0xf756('0x38')][_0xf756('0x1f')]);}return _0x2c851d['getTeams'](_0x5ae55a);}})[_0xf756('0x29')](function(_0x207abf){if(_0x207abf){return _0x207abf?{'count':_0x715e56,'rows':_0x207abf}:null;}})['then'](respondWithResult(_0x16b6f3,null))[_0xf756('0x4c')](handleError(_0x16b6f3,null));};exports[_0xf756('0x67')]=function(_0x350d9f,_0x3897af,_0x3dc9ec){var _0x1ae908=_0x350d9f[_0xf756('0x56')]['ids'];return db[_0xf756('0x68')][_0xf756('0x48')]({'where':{'id':_0x1ae908},'attributes':['id'],'include':[{'model':db[_0xf756('0x5f')],'as':_0xf756('0x69'),'attributes':['id',_0xf756('0x30'),_0xf756('0x6a'),_0xf756('0x6b'),_0xf756('0x6c')],'raw':!![]}]})[_0xf756('0x29')](function(_0x10715c){if(_0x10715c){var _0xc03224=_['flatMap'](_0x10715c,function(_0x3c2ad7){var _0x32d49a=_0x3c2ad7[_0xf756('0x4e')]({'plain':!![]});return _0x32d49a[_0xf756('0x69')];});return db[_0xf756('0x46')][_0xf756('0x4b')]({'where':{'id':_0x350d9f[_0xf756('0x57')]['id']}})[_0xf756('0x29')](function(_0x42a083){return db[_0xf756('0x6d')]['transaction'](function(_0x5bc96e){return _0x42a083[_0xf756('0x67')](_0x1ae908,{'transaction':_0x5bc96e})[_0xf756('0x29')](function(){return BPromise['each'](_0xc03224,function(_0x6f757a){return db['UserSmsQueue'][_0xf756('0x6e')]({'where':{'UserId':_0x6f757a['id'],'SmsQueueId':_0x350d9f[_0xf756('0x57')]['id']},'transaction':_0x5bc96e});});})[_0xf756('0x29')](function(){_0xc03224[_0xf756('0x6f')](function(_0x423d7f){socket[_0xf756('0x70')](_0xf756('0x71'),{'UserId':_0x423d7f['id'],'SmsQueueId':_0x42a083['id']});});});});});}})[_0xf756('0x29')](respondWithStatusCode(_0x3897af,null))[_0xf756('0x4c')](handleError(_0x3897af,null));};exports[_0xf756('0x72')]=function(_0x4a93e4,_0x17c996,_0x2d9e98){return db[_0xf756('0x68')][_0xf756('0x48')]({'where':{'id':_0x4a93e4['query'][_0xf756('0x73')]},'attributes':['id'],'include':[{'model':db[_0xf756('0x5f')],'as':_0xf756('0x69'),'attributes':['id'],'raw':!![]}]})[_0xf756('0x29')](handleEntityNotFound(_0x17c996,null))['then'](function(_0x123d26){var _0x37744b=_[_0xf756('0x33')](_0x123d26,'id');var _0x1ccb40=[];var _0x190520=[];var _0xa66ab6=squel[_0xf756('0x74')]();_0xa66ab6[_0xf756('0x75')](_0xf756('0x76'))[_0xf756('0x77')](_0xf756('0x78'),'tq')[_0xf756('0x79')](_0xf756('0x7a'),'ut',_0xf756('0x7b'))[_0xf756('0x42')]('SmsQueueId\x20=\x20?',_0x4a93e4['params']['id']);for(var _0x5e1358=0x0;_0x5e1358<_0x123d26[_0xf756('0x3e')];_0x5e1358+=0x1){let _0x24e641=_0x123d26[_0x5e1358];for(var _0x45c7c7=0x0;_0x45c7c7<_0x24e641[_0xf756('0x69')][_0xf756('0x3e')];_0x45c7c7+=0x1){let _0x3f0e63=_0x24e641[_0xf756('0x69')][_0x45c7c7];var _0x56fd03=_0xa66ab6[_0xf756('0x7c')]();_0x56fd03[_0xf756('0x42')](_0xf756('0x7d'),_0x3f0e63['id']);_0x190520[_0xf756('0x7e')](db[_0xf756('0x6d')][_0xf756('0x38')](_0x56fd03['toString'](),{'type':db[_0xf756('0x6d')][_0xf756('0x7f')][_0xf756('0x80')]})['then'](function(_0x597958){if(_0x597958[_0xf756('0x3e')]===0x1){return _0x3f0e63['id'];}else{var _0x104d9b=_[_0xf756('0x81')](_[_0xf756('0x33')](_0x597958,_0xf756('0x82')),function(_0x471392){return _[_0xf756('0x83')](_0x37744b,_0x471392);});if(_0x104d9b){return _0x3f0e63['id'];}}}));}}return BPromise[_0xf756('0x84')](_0x190520)[_0xf756('0x29')](function(_0x3f75b8){_0x1ccb40=_(_0x1ccb40)[_0xf756('0x85')](_0x3f75b8)[_0xf756('0x86')]()['value']();return db[_0xf756('0x46')][_0xf756('0x4b')]({'where':{'id':_0x4a93e4['params']['id']}})[_0xf756('0x29')](function(_0x538bda){return db[_0xf756('0x6d')][_0xf756('0x87')](function(_0x43424b){return _0x538bda[_0xf756('0x72')](_0x4a93e4[_0xf756('0x38')][_0xf756('0x73')],{'transaction':_0x43424b})[_0xf756('0x29')](function(){if(!_['isEmpty'](_0x1ccb40)){return _0x538bda[_0xf756('0x88')](_0x1ccb40,{'transaction':_0x43424b});}})[_0xf756('0x29')](function(){_0x1ccb40[_0xf756('0x6f')](function(_0x2ad755){socket[_0xf756('0x70')](_0xf756('0x89'),{'UserId':_0x2ad755,'SmsQueueId':_0x538bda['id']});});});});});});})['then'](respondWithStatusCode(_0x17c996,null))['catch'](handleError(_0x17c996,null));};exports[_0xf756('0x8a')]=function(_0x4675c7,_0x5070d3,_0x53b7eb){return db['SmsQueue'][_0xf756('0x4b')]({'where':{'id':_0x4675c7[_0xf756('0x57')]['id']}})[_0xf756('0x29')](handleEntityNotFound(_0x5070d3,null))['then'](function(_0x4d1f19){if(_0x4d1f19){return _0x4d1f19[_0xf756('0x8a')](_0x4675c7[_0xf756('0x56')][_0xf756('0x73')],_[_0xf756('0x8b')](_0x4675c7[_0xf756('0x56')],[_0xf756('0x73'),'id'])||{})[_0xf756('0x8c')](function(_0x52461c){for(var _0x52f235=0x0;_0x52f235<_0x4675c7[_0xf756('0x56')][_0xf756('0x73')][_0xf756('0x3e')];_0x52f235+=0x1){socket[_0xf756('0x70')]('userSmsQueue:save',{'UserId':Number(_0x4675c7[_0xf756('0x56')][_0xf756('0x73')][_0x52f235]),'SmsQueueId':Number(_0x4675c7[_0xf756('0x57')]['id'])});}return _0x52461c;});}})[_0xf756('0x29')](respondWithResult(_0x5070d3,null))[_0xf756('0x4c')](handleError(_0x5070d3,null));};exports[_0xf756('0x88')]=function(_0x57a79e,_0x14fd20,_0x55c503){return db[_0xf756('0x46')][_0xf756('0x4b')]({'where':{'id':_0x57a79e['params']['id']}})['then'](handleEntityNotFound(_0x14fd20,null))[_0xf756('0x29')](function(_0x4de6b7){if(_0x4de6b7){return _0x4de6b7['removeAgents'](_0x57a79e[_0xf756('0x38')][_0xf756('0x73')])[_0xf756('0x29')](function(){if(_[_0xf756('0x8d')](_0x57a79e[_0xf756('0x38')][_0xf756('0x73')])){for(var _0x12419f=0x0;_0x12419f<_0x57a79e[_0xf756('0x38')]['ids'][_0xf756('0x3e')];_0x12419f+=0x1){socket[_0xf756('0x70')](_0xf756('0x89'),{'UserId':Number(_0x57a79e['query']['ids'][_0x12419f]),'SmsQueueId':Number(_0x57a79e[_0xf756('0x57')]['id'])});}}else{socket[_0xf756('0x70')](_0xf756('0x89'),{'UserId':Number(_0x57a79e[_0xf756('0x38')]['ids']),'SmsQueueId':Number(_0x57a79e['params']['id'])});}});}})[_0xf756('0x29')](respondWithStatusCode(_0x14fd20,null))['catch'](handleError(_0x14fd20,null));};exports[_0xf756('0x8e')]=function(_0x5ecc8a,_0x408c90,_0x3500a9){var _0x44766b={};var _0x4fcefc={};var _0x4a9892;var _0x543cc3;return db[_0xf756('0x46')]['findOne']({'where':{'id':_0x5ecc8a[_0xf756('0x57')]['id']}})[_0xf756('0x29')](handleEntityNotFound(_0x408c90,null))['then'](function(_0x502cf9){if(_0x502cf9){_0x4a9892=_0x502cf9;_0x4fcefc[_0xf756('0x37')]=_['keys'](db[_0xf756('0x5f')]['rawAttributes']);_0x4fcefc['query']=_['keys'](_0x5ecc8a[_0xf756('0x38')]);_0x4fcefc[_0xf756('0x3a')]=_['intersection'](_0x4fcefc['model'],_0x4fcefc[_0xf756('0x38')]);_0x44766b[_0xf756('0x3c')]=_['intersection'](_0x4fcefc[_0xf756('0x37')],qs[_0xf756('0x3d')](_0x5ecc8a[_0xf756('0x38')][_0xf756('0x3d')]));_0x44766b[_0xf756('0x3c')]=_0x44766b['attributes'][_0xf756('0x3e')]?_0x44766b[_0xf756('0x3c')]:_0x4fcefc[_0xf756('0x37')];_0x44766b[_0xf756('0x40')]=qs[_0xf756('0x41')](_0x5ecc8a[_0xf756('0x38')][_0xf756('0x41')]);_0x44766b[_0xf756('0x42')]=qs['filters'](_[_0xf756('0x5c')](_0x5ecc8a[_0xf756('0x38')],_0x4fcefc[_0xf756('0x3a')]));if(_0x5ecc8a['query'][_0xf756('0x45')]){_0x44766b[_0xf756('0x42')]=_[_0xf756('0x43')](_0x44766b[_0xf756('0x42')],{'$or':_[_0xf756('0x33')](_0x44766b[_0xf756('0x3c')],function(_0x5f18cf){var _0x4bc772={};_0x4bc772[_0x5f18cf]={'$like':'%'+_0x5ecc8a[_0xf756('0x38')][_0xf756('0x45')]+'%'};return _0x4bc772;})});}_0x44766b=_[_0xf756('0x43')]({},_0x44766b,_0x5ecc8a[_0xf756('0x5d')]);return _0x4a9892[_0xf756('0x8e')](_0x44766b);}})[_0xf756('0x29')](function(_0x4287fd){if(_0x4287fd){_0x543cc3=_0x4287fd[_0xf756('0x3e')];if(!_0x5ecc8a['query'][_0xf756('0x5b')](_0xf756('0x3f'))){_0x44766b[_0xf756('0x20')]=qs['limit'](_0x5ecc8a[_0xf756('0x38')][_0xf756('0x20')]);_0x44766b[_0xf756('0x1f')]=qs[_0xf756('0x1f')](_0x5ecc8a['query']['offset']);}return _0x4a9892[_0xf756('0x8e')](_0x44766b);}})[_0xf756('0x29')](function(_0x4f3ce4){if(_0x4f3ce4){return _0x4f3ce4?{'count':_0x543cc3,'rows':_0x4f3ce4}:null;}})['then'](respondWithResult(_0x408c90,null))[_0xf756('0x4c')](handleError(_0x408c90,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 9f3d9c6..9e0b494 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 _0x3e9b=['save','update','remove','emit','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x3e9b,0x1e2));var _0xb3e9=function(_0x35746a,_0x1c9025){_0x35746a=_0x35746a-0x0;var _0x4cdf06=_0x3e9b[_0x35746a];return _0x4cdf06;};'use strict';var EventEmitter=require(_0xb3e9('0x0'));var SmsQueue=require(_0xb3e9('0x1'))['db'][_0xb3e9('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb3e9('0x3')](0x0);var events={'afterCreate':_0xb3e9('0x4'),'afterUpdate':_0xb3e9('0x5'),'afterDestroy':_0xb3e9('0x6')};function emitEvent(_0x44fb1e){return function(_0x5bb3b6,_0x35b95a,_0x456d64){SmsQueueEvents[_0xb3e9('0x7')](_0x44fb1e+':'+_0x5bb3b6['id'],_0x5bb3b6);SmsQueueEvents['emit'](_0x44fb1e,_0x5bb3b6);_0x456d64(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xb3e9('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xafe2=['hasOwnProperty','../../mysqldb','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafe2,0x6d));var _0x2afe=function(_0x4bcce8,_0x4c09a6){_0x4bcce8=_0x4bcce8-0x0;var _0x4c7ef9=_0xafe2[_0x4bcce8];return _0x4c7ef9;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x2afe('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2afe('0x1'),'afterUpdate':_0x2afe('0x2'),'afterDestroy':_0x2afe('0x3')};function emitEvent(_0x5458ea){return function(_0x11de9d,_0x1474f1,_0x159e0e){SmsQueueEvents['emit'](_0x5458ea+':'+_0x11de9d['id'],_0x11de9d);SmsQueueEvents[_0x2afe('0x4')](_0x5458ea,_0x11de9d);_0x159e0e(null);};}for(var e in events){if(events[_0x2afe('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index ecc24db..781953e 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 _0xe0ba=['moment','request-promise','path','rimraf','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe0ba,0x97));var _0xae0b=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xe0ba[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xae0b('0x0'));var util=require(_0xae0b('0x1'));var logger=require(_0xae0b('0x2'))('api');var moment=require(_0xae0b('0x3'));var BPromise=require('bluebird');var rp=require(_0xae0b('0x4'));var fs=require('fs');var path=require(_0xae0b('0x5'));var rimraf=require(_0xae0b('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0xae0b('0x7')]=function(_0x4920c3,_0x9eb25c){return _0x4920c3[_0xae0b('0x8')](_0xae0b('0x9'),attributes,{'tableName':_0xae0b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ce8=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','sms_queues','util','../../config/logger'];(function(_0x37fcda,_0x2f5aa1){var _0xf5ed91=function(_0x3c3241){while(--_0x3c3241){_0x37fcda['push'](_0x37fcda['shift']());}};_0xf5ed91(++_0x2f5aa1);}(_0x1ce8,0x116));var _0x81ce=function(_0x5ab25e,_0x3f50f2){_0x5ab25e=_0x5ab25e-0x0;var _0x1cd5d7=_0x1ce8[_0x5ab25e];return _0x1cd5d7;};'use strict';var _=require('lodash');var util=require(_0x81ce('0x0'));var logger=require(_0x81ce('0x1'))('api');var moment=require(_0x81ce('0x2'));var BPromise=require(_0x81ce('0x3'));var rp=require(_0x81ce('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x81ce('0x5'));var config=require(_0x81ce('0x6'));var attributes=require('./smsQueue.attributes');module[_0x81ce('0x7')]=function(_0x56eb00,_0x50cc5b){return _0x56eb00[_0x81ce('0x8')]('SmsQueue',attributes,{'tableName':_0x81ce('0x9'),'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 4fcb856..215bc4d 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 _0xe978=['find','raw','where','map','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetSmsQueue','SmsQueue','findAll','options','limit','include','model','attributes','debug','ShowSmsQueue'];(function(_0x2c848a,_0x30bdb0){var _0x43cd06=function(_0x317374){while(--_0x317374){_0x2c848a['push'](_0x2c848a['shift']());}};_0x43cd06(++_0x30bdb0);}(_0xe978,0x176));var _0x8e97=function(_0x119d23,_0x423788){_0x119d23=_0x119d23-0x0;var _0x59cbeb=_0xe978[_0x119d23];return _0x59cbeb;};'use strict';var _=require(_0x8e97('0x0'));var util=require(_0x8e97('0x1'));var moment=require(_0x8e97('0x2'));var BPromise=require(_0x8e97('0x3'));var rs=require(_0x8e97('0x4'));var fs=require('fs');var Redis=require(_0x8e97('0x5'));var db=require(_0x8e97('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8e97('0x7'));var config=require(_0x8e97('0x8'));var jayson=require(_0x8e97('0x9'));var client=jayson['client'][_0x8e97('0xa')]({'port':0x232a});config[_0x8e97('0xb')]=_[_0x8e97('0xc')](config[_0x8e97('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e97('0xd'))(new Redis(config[_0x8e97('0xb')]));require(_0x8e97('0xe'))[_0x8e97('0xf')](socket);function respondWithRpcPromise(_0x119ac7,_0x55042a,_0x1a41d5){return new BPromise(function(_0x3d41c8,_0x3e0dda){return client[_0x8e97('0x10')](_0x119ac7,_0x1a41d5)[_0x8e97('0x11')](function(_0x6d5d9d){logger[_0x8e97('0x12')](_0x8e97('0x13'),_0x55042a,_0x8e97('0x14'));logger['debug'](_0x8e97('0x15'),_0x55042a,_0x8e97('0x14'),JSON[_0x8e97('0x16')](_0x6d5d9d));if(_0x6d5d9d[_0x8e97('0x17')]){if(_0x6d5d9d[_0x8e97('0x17')]['code']===0x1f4){logger[_0x8e97('0x17')](_0x8e97('0x13'),_0x55042a,_0x6d5d9d[_0x8e97('0x17')][_0x8e97('0x18')]);return _0x3e0dda(_0x6d5d9d[_0x8e97('0x17')][_0x8e97('0x18')]);}logger[_0x8e97('0x17')](_0x8e97('0x13'),_0x55042a,_0x6d5d9d[_0x8e97('0x17')][_0x8e97('0x18')]);return _0x3d41c8(_0x6d5d9d['error']['message']);}else{logger[_0x8e97('0x12')](_0x8e97('0x13'),_0x55042a,_0x8e97('0x14'));_0x3d41c8(_0x6d5d9d[_0x8e97('0x19')][_0x8e97('0x18')]);}})['catch'](function(_0x1f10b5){logger[_0x8e97('0x17')](_0x8e97('0x13'),_0x55042a,_0x1f10b5);_0x3e0dda(_0x1f10b5);});});}exports[_0x8e97('0x1a')]=function(_0x405670){var _0x44c574=this;return new Promise(function(_0x582c1a,_0x11c931){return db[_0x8e97('0x1b')][_0x8e97('0x1c')]({'raw':_0x405670[_0x8e97('0x1d')]?_0x405670[_0x8e97('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x405670['options']?_0x405670[_0x8e97('0x1d')]['where']||null:null,'attributes':_0x405670['options']?_0x405670[_0x8e97('0x1d')]['attributes']||null:null,'limit':_0x405670[_0x8e97('0x1d')]?_0x405670[_0x8e97('0x1d')][_0x8e97('0x1e')]||null:null,'include':_0x405670[_0x8e97('0x1d')]?_0x405670['options']['include']?_['map'](_0x405670['options'][_0x8e97('0x1f')],function(_0x2ff771){return{'model':db[_0x2ff771[_0x8e97('0x20')]],'as':_0x2ff771['as'],'attributes':_0x2ff771[_0x8e97('0x21')],'include':_0x2ff771[_0x8e97('0x1f')]?_['map'](_0x2ff771[_0x8e97('0x1f')],function(_0x10d032){return{'model':db[_0x10d032[_0x8e97('0x20')]],'as':_0x10d032['as'],'attributes':_0x10d032[_0x8e97('0x21')],'include':_0x10d032[_0x8e97('0x1f')]?_['map'](_0x10d032['include'],function(_0x3925b4){return{'model':db[_0x3925b4[_0x8e97('0x20')]],'as':_0x3925b4['as'],'attributes':_0x3925b4[_0x8e97('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8e97('0x11')](function(_0x49f3af){logger['info'](_0x8e97('0x1a'),_0x405670);logger[_0x8e97('0x22')](_0x8e97('0x1a'),_0x405670,JSON[_0x8e97('0x16')](_0x49f3af));_0x582c1a(_0x49f3af);})['catch'](function(_0x5ccf5b){logger['error']('GetSmsQueue',_0x5ccf5b[_0x8e97('0x18')],_0x405670);_0x11c931(_0x44c574[_0x8e97('0x17')](0x1f4,_0x5ccf5b['message']));});});};exports[_0x8e97('0x23')]=function(_0x13e386){var _0x410c41=this;return new Promise(function(_0x2c17a5,_0x51c4f7){return db[_0x8e97('0x1b')][_0x8e97('0x24')]({'raw':_0x13e386['options']?_0x13e386['options'][_0x8e97('0x25')]===undefined?!![]:![]:!![],'where':_0x13e386[_0x8e97('0x1d')]?_0x13e386[_0x8e97('0x1d')][_0x8e97('0x26')]||null:null,'attributes':_0x13e386[_0x8e97('0x1d')]?_0x13e386['options']['attributes']||null:null,'include':_0x13e386['options']?_0x13e386[_0x8e97('0x1d')][_0x8e97('0x1f')]?_[_0x8e97('0x27')](_0x13e386[_0x8e97('0x1d')][_0x8e97('0x1f')],function(_0x1e45e6){return{'model':db[_0x1e45e6[_0x8e97('0x20')]],'as':_0x1e45e6['as'],'attributes':_0x1e45e6[_0x8e97('0x21')],'include':_0x1e45e6['include']?_[_0x8e97('0x27')](_0x1e45e6[_0x8e97('0x1f')],function(_0x52c4da){return{'model':db[_0x52c4da['model']],'as':_0x52c4da['as'],'attributes':_0x52c4da[_0x8e97('0x21')],'include':_0x52c4da[_0x8e97('0x1f')]?_[_0x8e97('0x27')](_0x52c4da['include'],function(_0x2e6105){return{'model':db[_0x2e6105['model']],'as':_0x2e6105['as'],'attributes':_0x2e6105[_0x8e97('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8e97('0x11')](function(_0x1c3091){logger['info'](_0x8e97('0x23'),_0x13e386);logger[_0x8e97('0x22')](_0x8e97('0x23'),_0x13e386,JSON[_0x8e97('0x16')](_0x1c3091));_0x2c17a5(_0x1c3091);})[_0x8e97('0x28')](function(_0x4c2f56){logger[_0x8e97('0x17')]('ShowSmsQueue',_0x4c2f56['message'],_0x13e386);_0x51c4f7(_0x410c41['error'](0x1f4,_0x4c2f56[_0x8e97('0x18')]));});});}; \ No newline at end of file +var _0x167a=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','request\x20sent','debug','error','code','SmsQueue,\x20%s,\x20%s','message','result','findAll','options','raw','where','attributes','limit','include','map','model','then','GetSmsQueue','catch','SmsQueue','find','ShowSmsQueue','stringify'];(function(_0x3675e4,_0x2b4d73){var _0x3dbaa8=function(_0x58ac9d){while(--_0x58ac9d){_0x3675e4['push'](_0x3675e4['shift']());}};_0x3dbaa8(++_0x2b4d73);}(_0x167a,0x118));var _0xa167=function(_0x5858b9,_0x1d3a42){_0x5858b9=_0x5858b9-0x0;var _0x2d4edb=_0x167a[_0x5858b9];return _0x2d4edb;};'use strict';var _=require(_0xa167('0x0'));var util=require(_0xa167('0x1'));var moment=require(_0xa167('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa167('0x3'));var db=require(_0xa167('0x4'))['db'];var utils=require(_0xa167('0x5'));var logger=require(_0xa167('0x6'))(_0xa167('0x7'));var config=require(_0xa167('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xa167('0x9')](config[_0xa167('0xa')],{'host':_0xa167('0xb'),'port':0x18eb});var socket=require(_0xa167('0xc'))(new Redis(config[_0xa167('0xa')]));require(_0xa167('0xd'))[_0xa167('0xe')](socket);function respondWithRpcPromise(_0x4e88a8,_0x5b99e6,_0x498cbf){return new BPromise(function(_0x56abbd,_0x1fdcc7){return client[_0xa167('0xf')](_0x4e88a8,_0x498cbf)['then'](function(_0x41b6bf){logger[_0xa167('0x10')]('SmsQueue,\x20%s,\x20%s',_0x5b99e6,_0xa167('0x11'));logger[_0xa167('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x5b99e6,_0xa167('0x11'),JSON['stringify'](_0x41b6bf));if(_0x41b6bf[_0xa167('0x13')]){if(_0x41b6bf[_0xa167('0x13')][_0xa167('0x14')]===0x1f4){logger[_0xa167('0x13')](_0xa167('0x15'),_0x5b99e6,_0x41b6bf[_0xa167('0x13')][_0xa167('0x16')]);return _0x1fdcc7(_0x41b6bf[_0xa167('0x13')][_0xa167('0x16')]);}logger[_0xa167('0x13')]('SmsQueue,\x20%s,\x20%s',_0x5b99e6,_0x41b6bf[_0xa167('0x13')][_0xa167('0x16')]);return _0x56abbd(_0x41b6bf[_0xa167('0x13')][_0xa167('0x16')]);}else{logger[_0xa167('0x10')]('SmsQueue,\x20%s,\x20%s',_0x5b99e6,_0xa167('0x11'));_0x56abbd(_0x41b6bf[_0xa167('0x17')][_0xa167('0x16')]);}})['catch'](function(_0x5a73e4){logger[_0xa167('0x13')](_0xa167('0x15'),_0x5b99e6,_0x5a73e4);_0x1fdcc7(_0x5a73e4);});});}exports['GetSmsQueue']=function(_0x2aba20){var _0x3a710f=this;return new Promise(function(_0x300038,_0x524707){return db['SmsQueue'][_0xa167('0x18')]({'raw':_0x2aba20[_0xa167('0x19')]?_0x2aba20[_0xa167('0x19')][_0xa167('0x1a')]===undefined?!![]:![]:!![],'where':_0x2aba20[_0xa167('0x19')]?_0x2aba20['options'][_0xa167('0x1b')]||null:null,'attributes':_0x2aba20[_0xa167('0x19')]?_0x2aba20[_0xa167('0x19')][_0xa167('0x1c')]||null:null,'limit':_0x2aba20['options']?_0x2aba20[_0xa167('0x19')][_0xa167('0x1d')]||null:null,'include':_0x2aba20[_0xa167('0x19')]?_0x2aba20[_0xa167('0x19')][_0xa167('0x1e')]?_[_0xa167('0x1f')](_0x2aba20[_0xa167('0x19')]['include'],function(_0x220a49){return{'model':db[_0x220a49['model']],'as':_0x220a49['as'],'attributes':_0x220a49[_0xa167('0x1c')],'include':_0x220a49[_0xa167('0x1e')]?_[_0xa167('0x1f')](_0x220a49[_0xa167('0x1e')],function(_0x47a997){return{'model':db[_0x47a997['model']],'as':_0x47a997['as'],'attributes':_0x47a997['attributes'],'include':_0x47a997[_0xa167('0x1e')]?_[_0xa167('0x1f')](_0x47a997[_0xa167('0x1e')],function(_0x44eb66){return{'model':db[_0x44eb66[_0xa167('0x20')]],'as':_0x44eb66['as'],'attributes':_0x44eb66['attributes']};}):[]};}):[]};}):[]:[]})[_0xa167('0x21')](function(_0x5e76be){logger[_0xa167('0x10')](_0xa167('0x22'),_0x2aba20);logger[_0xa167('0x12')](_0xa167('0x22'),_0x2aba20,JSON['stringify'](_0x5e76be));_0x300038(_0x5e76be);})[_0xa167('0x23')](function(_0x5c4b34){logger[_0xa167('0x13')](_0xa167('0x22'),_0x5c4b34['message'],_0x2aba20);_0x524707(_0x3a710f[_0xa167('0x13')](0x1f4,_0x5c4b34[_0xa167('0x16')]));});});};exports['ShowSmsQueue']=function(_0x42c98b){var _0xb3e5b0=this;return new Promise(function(_0x15673c,_0x488e21){return db[_0xa167('0x24')][_0xa167('0x25')]({'raw':_0x42c98b[_0xa167('0x19')]?_0x42c98b[_0xa167('0x19')][_0xa167('0x1a')]===undefined?!![]:![]:!![],'where':_0x42c98b['options']?_0x42c98b['options'][_0xa167('0x1b')]||null:null,'attributes':_0x42c98b['options']?_0x42c98b[_0xa167('0x19')][_0xa167('0x1c')]||null:null,'include':_0x42c98b[_0xa167('0x19')]?_0x42c98b[_0xa167('0x19')]['include']?_[_0xa167('0x1f')](_0x42c98b[_0xa167('0x19')]['include'],function(_0x546581){return{'model':db[_0x546581[_0xa167('0x20')]],'as':_0x546581['as'],'attributes':_0x546581['attributes'],'include':_0x546581[_0xa167('0x1e')]?_[_0xa167('0x1f')](_0x546581[_0xa167('0x1e')],function(_0x13dd4b){return{'model':db[_0x13dd4b[_0xa167('0x20')]],'as':_0x13dd4b['as'],'attributes':_0x13dd4b[_0xa167('0x1c')],'include':_0x13dd4b[_0xa167('0x1e')]?_[_0xa167('0x1f')](_0x13dd4b[_0xa167('0x1e')],function(_0x50cf63){return{'model':db[_0x50cf63['model']],'as':_0x50cf63['as'],'attributes':_0x50cf63['attributes']};}):[]};}):[]};}):[]:[]})[_0xa167('0x21')](function(_0x2e98e8){logger[_0xa167('0x10')]('ShowSmsQueue',_0x42c98b);logger[_0xa167('0x12')](_0xa167('0x26'),_0x42c98b,JSON[_0xa167('0x27')](_0x2e98e8));_0x15673c(_0x2e98e8);})['catch'](function(_0x306e09){logger[_0xa167('0x13')](_0xa167('0x26'),_0x306e09['message'],_0x42c98b);_0x488e21(_0xb3e5b0[_0xa167('0x13')](0x1f4,_0x306e09['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index b39a079..1d7cdab 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 _0x9385=['smsQueue:','./smsQueue.events','update','emit','register'];(function(_0x1c4f23,_0x3a5c9a){var _0x50bb54=function(_0x1ec32f){while(--_0x1ec32f){_0x1c4f23['push'](_0x1c4f23['shift']());}};_0x50bb54(++_0x3a5c9a);}(_0x9385,0x119));var _0x5938=function(_0x529419,_0x58fd78){_0x529419=_0x529419-0x0;var _0x3b84e0=_0x9385[_0x529419];return _0x3b84e0;};'use strict';var SmsQueueEvents=require(_0x5938('0x0'));var events=['save','remove',_0x5938('0x1')];function createListener(_0x254371,_0x3e63a4){return function(_0x1fc882){_0x3e63a4[_0x5938('0x2')](_0x254371,_0x1fc882);};}function removeListener(_0x382dd5,_0x461f99){return function(){SmsQueueEvents['removeListener'](_0x382dd5,_0x461f99);};}exports[_0x5938('0x3')]=function(_0x5e2e25){for(var _0x9a6aa4=0x0,_0x25d9f4=events['length'];_0x9a6aa4<_0x25d9f4;_0x9a6aa4++){var _0x3f9cde=events[_0x9a6aa4];var _0x51456f=createListener(_0x5938('0x4')+_0x3f9cde,_0x5e2e25);SmsQueueEvents['on'](_0x3f9cde,_0x51456f);}}; \ No newline at end of file +var _0xfea2=['./smsQueue.events','save','remove','update','emit','removeListener','length','smsQueue:'];(function(_0x2f0ed9,_0x2ed6ba){var _0x3874e6=function(_0x12956b){while(--_0x12956b){_0x2f0ed9['push'](_0x2f0ed9['shift']());}};_0x3874e6(++_0x2ed6ba);}(_0xfea2,0xc8));var _0x2fea=function(_0x470be7,_0x181dfe){_0x470be7=_0x470be7-0x0;var _0x32063c=_0xfea2[_0x470be7];return _0x32063c;};'use strict';var SmsQueueEvents=require(_0x2fea('0x0'));var events=[_0x2fea('0x1'),_0x2fea('0x2'),_0x2fea('0x3')];function createListener(_0x543451,_0x33d77f){return function(_0x4db768){_0x33d77f[_0x2fea('0x4')](_0x543451,_0x4db768);};}function removeListener(_0x4d8955,_0x45b3b6){return function(){SmsQueueEvents[_0x2fea('0x5')](_0x4d8955,_0x45b3b6);};}exports['register']=function(_0x55a0e9){for(var _0x251fe5=0x0,_0x148016=events[_0x2fea('0x6')];_0x251fe5<_0x148016;_0x251fe5++){var _0x473242=events[_0x251fe5];var _0x4520f8=createListener(_0x2fea('0x7')+_0x473242,_0x55a0e9);SmsQueueEvents['on'](_0x473242,_0x4520f8);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 3559798..77c5cf3 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 _0xf3ff=['../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','index','isAuthenticated','describe','show','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x4439ac,_0x5d0890){var _0x35c093=function(_0x3285b1){while(--_0x3285b1){_0x4439ac['push'](_0x4439ac['shift']());}};_0x35c093(++_0x5d0890);}(_0xf3ff,0xae));var _0xff3f=function(_0x2bb7ba,_0x1accf8){_0x2bb7ba=_0x2bb7ba-0x0;var _0xc49f9e=_0xf3ff[_0x2bb7ba];return _0xc49f9e;};'use strict';var multer=require(_0xff3f('0x0'));var util=require('util');var path=require(_0xff3f('0x1'));var timeout=require(_0xff3f('0x2'));var express=require(_0xff3f('0x3'));var router=express[_0xff3f('0x4')]();var fs_extra=require(_0xff3f('0x5'));var auth=require(_0xff3f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xff3f('0x7'));var controller=require(_0xff3f('0x8'));router[_0xff3f('0x9')]('/',auth['isAuthenticated'](),controller[_0xff3f('0xa')]);router[_0xff3f('0x9')]('/describe',auth[_0xff3f('0xb')](),controller[_0xff3f('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xff3f('0xd')]);router['post']('/',auth[_0xff3f('0xb')](),controller['create']);router[_0xff3f('0xe')](_0xff3f('0xf'),auth[_0xff3f('0xb')](),controller[_0xff3f('0x10')]);router[_0xff3f('0x11')](_0xff3f('0xf'),auth[_0xff3f('0xb')](),controller[_0xff3f('0x12')]);module[_0xff3f('0x13')]=router; \ No newline at end of file +var _0x3aa1=['/describe','describe','show','post','create','put','/:id','isAuthenticated','delete','destroy','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x16e1d8,_0x4387e1){var _0x41f0e6=function(_0x51939b){while(--_0x51939b){_0x16e1d8['push'](_0x16e1d8['shift']());}};_0x41f0e6(++_0x4387e1);}(_0x3aa1,0xdb));var _0x13aa=function(_0x55db31,_0x4094d5){_0x55db31=_0x55db31-0x0;var _0x5bd0b1=_0x3aa1[_0x55db31];return _0x5bd0b1;};'use strict';var multer=require('multer');var util=require(_0x13aa('0x0'));var path=require(_0x13aa('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x13aa('0x2')]();var fs_extra=require(_0x13aa('0x3'));var auth=require(_0x13aa('0x4'));var interaction=require(_0x13aa('0x5'));var config=require(_0x13aa('0x6'));var controller=require('./smsQueueReport.controller');router[_0x13aa('0x7')]('/',auth['isAuthenticated'](),controller[_0x13aa('0x8')]);router[_0x13aa('0x7')](_0x13aa('0x9'),auth['isAuthenticated'](),controller[_0x13aa('0xa')]);router[_0x13aa('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x13aa('0xb')]);router[_0x13aa('0xc')]('/',auth['isAuthenticated'](),controller[_0x13aa('0xd')]);router[_0x13aa('0xe')](_0x13aa('0xf'),auth[_0x13aa('0x10')](),controller['update']);router[_0x13aa('0x11')]('/:id',auth[_0x13aa('0x10')](),controller[_0x13aa('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 7e12a2e..1b1dc50 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 _0xecd0=['sequelize','exports','STRING','DATE','moment'];(function(_0x26c756,_0x630de1){var _0x17d39c=function(_0x2d1943){while(--_0x2d1943){_0x26c756['push'](_0x26c756['shift']());}};_0x17d39c(++_0x630de1);}(_0xecd0,0x162));var _0x0ecd=function(_0x538c70,_0x35531f){_0x538c70=_0x538c70-0x0;var _0x42ae01=_0xecd0[_0x538c70];return _0x42ae01;};'use strict';var moment=require(_0x0ecd('0x0'));var Sequelize=require(_0x0ecd('0x1'));module[_0x0ecd('0x2')]={'uniqueid':{'type':Sequelize[_0x0ecd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0ecd('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0ecd('0x4')]},'acceptAt':{'type':Sequelize[_0x0ecd('0x4')]},'exitAt':{'type':Sequelize[_0x0ecd('0x4')]},'reason':{'type':Sequelize[_0x0ecd('0x3')]}}; \ No newline at end of file +var _0x2af6=['STRING','DATE','exports'];(function(_0x65534a,_0x35c471){var _0x507c32=function(_0xd1f001){while(--_0xd1f001){_0x65534a['push'](_0x65534a['shift']());}};_0x507c32(++_0x35c471);}(_0x2af6,0x170));var _0x62af=function(_0x3e4065,_0x11f393){_0x3e4065=_0x3e4065-0x0;var _0x30ceb8=_0x2af6[_0x3e4065];return _0x30ceb8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x62af('0x0')]={'uniqueid':{'type':Sequelize[_0x62af('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x62af('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x62af('0x2')]},'exitAt':{'type':Sequelize[_0x62af('0x2')]},'reason':{'type':Sequelize[_0x62af('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 2f1a3c2..e17fc63 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 _0x640c=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query'];(function(_0x52f463,_0x35ae2b){var _0x539935=function(_0x36b3b4){while(--_0x36b3b4){_0x52f463['push'](_0x52f463['shift']());}};_0x539935(++_0x35ae2b);}(_0x640c,0x100));var _0xc640=function(_0x2262f5,_0x5a409f){_0x2262f5=_0x2262f5-0x0;var _0x25fc8c=_0x640c[_0x2262f5];return _0x25fc8c;};'use strict';var emlformat=require(_0xc640('0x0'));var rimraf=require(_0xc640('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc640('0x2'));var rp=require(_0xc640('0x3'));var moment=require(_0xc640('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc640('0x5'));var util=require('util');var path=require(_0xc640('0x6'));var sox=require(_0xc640('0x7'));var csv=require('to-csv');var ejs=require(_0xc640('0x8'));var fs=require('fs');var fs_extra=require(_0xc640('0x9'));var _=require(_0xc640('0xa'));var squel=require(_0xc640('0xb'));var crypto=require(_0xc640('0xc'));var jsforce=require(_0xc640('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc640('0xe'));var Papa=require('papaparse');var Redis=require(_0xc640('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc640('0x10'));var as=require(_0xc640('0x11'));var hardwareService=require(_0xc640('0x12'));var logger=require('../../config/logger')(_0xc640('0x13'));var utils=require('../../config/utils');var config=require(_0xc640('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc640('0x15'))['db'];function respondWithStatusCode(_0x22f82a,_0x15ecd9){_0x15ecd9=_0x15ecd9||0xcc;return function(_0x42038b){if(_0x42038b){return _0x22f82a['sendStatus'](_0x15ecd9);}return _0x22f82a['status'](_0x15ecd9)[_0xc640('0x16')]();};}function respondWithResult(_0x2e0832,_0x17aae5){_0x17aae5=_0x17aae5||0xc8;return function(_0xbe78f7){if(_0xbe78f7){return _0x2e0832[_0xc640('0x17')](_0x17aae5)['json'](_0xbe78f7);}};}function respondWithFilteredResult(_0x38c793,_0x2f1c38){return function(_0x5e1b1f){if(_0x5e1b1f){var _0x49c02c=typeof _0x2f1c38[_0xc640('0x18')]===_0xc640('0x19')&&typeof _0x2f1c38[_0xc640('0x1a')]===_0xc640('0x19');var _0x5299d4=_0x5e1b1f[_0xc640('0x1b')];var _0x6fda56=_0x49c02c?0x0:_0x2f1c38['offset'];var _0x4b14c6=_0x49c02c?_0x5e1b1f['count']:_0x2f1c38[_0xc640('0x18')]+_0x2f1c38['limit'];var _0x58df0b;if(_0x4b14c6>=_0x5299d4){_0x4b14c6=_0x5299d4;_0x58df0b=0xc8;}else{_0x58df0b=0xce;}_0x38c793[_0xc640('0x17')](_0x58df0b);return _0x38c793[_0xc640('0x1c')](_0xc640('0x1d'),_0x6fda56+'-'+_0x4b14c6+'/'+_0x5299d4)['json'](_0x5e1b1f);}return null;};}function patchUpdates(_0x319e48){return function(_0x528e9f){try{jsonpatch[_0xc640('0x1e')](_0x528e9f,_0x319e48,!![]);}catch(_0x16bd35){return BPromise[_0xc640('0x1f')](_0x16bd35);}return _0x528e9f[_0xc640('0x20')]();};}function saveUpdates(_0x281916,_0x2b2fbb){return function(_0x5e602d){if(_0x5e602d){return _0x5e602d[_0xc640('0x21')](_0x281916)[_0xc640('0x22')](function(_0x21077e){return _0x21077e;});}return null;};}function removeEntity(_0x56591c,_0x235451){return function(_0x3ef7d9){if(_0x3ef7d9){return _0x3ef7d9['destroy']()[_0xc640('0x22')](function(){_0x56591c[_0xc640('0x17')](0xcc)[_0xc640('0x16')]();});}};}function handleEntityNotFound(_0x54bcfc,_0x5f1667){return function(_0x416567){if(!_0x416567){_0x54bcfc[_0xc640('0x23')](0x194);}return _0x416567;};}function handleError(_0x2e2c33,_0x125929){_0x125929=_0x125929||0x1f4;return function(_0x53e865){logger[_0xc640('0x24')](_0x53e865[_0xc640('0x25')]);if(_0x53e865[_0xc640('0x26')]){delete _0x53e865[_0xc640('0x26')];}_0x2e2c33[_0xc640('0x17')](_0x125929)[_0xc640('0x27')](_0x53e865);};}exports[_0xc640('0x28')]=function(_0x5a35f7,_0x4834e8){var _0x4efd15={},_0x3c3407={},_0x386d64={'count':0x0,'rows':[]};var _0x29a153=_[_0xc640('0x29')](db[_0xc640('0x2a')]['rawAttributes'],function(_0x2fa572){return{'name':_0x2fa572[_0xc640('0x2b')],'type':_0x2fa572[_0xc640('0x2c')][_0xc640('0x2d')]};});_0x3c3407[_0xc640('0x2e')]=_[_0xc640('0x29')](_0x29a153,'name');_0x3c3407[_0xc640('0x2f')]=_[_0xc640('0x30')](_0x5a35f7['query']);_0x3c3407[_0xc640('0x31')]=_[_0xc640('0x32')](_0x3c3407[_0xc640('0x2e')],_0x3c3407[_0xc640('0x2f')]);_0x4efd15[_0xc640('0x33')]=_[_0xc640('0x32')](_0x3c3407[_0xc640('0x2e')],qs[_0xc640('0x34')](_0x5a35f7[_0xc640('0x2f')][_0xc640('0x34')]));_0x4efd15[_0xc640('0x33')]=_0x4efd15[_0xc640('0x33')][_0xc640('0x35')]?_0x4efd15[_0xc640('0x33')]:_0x3c3407[_0xc640('0x2e')];if(!_0x5a35f7['query'][_0xc640('0x36')](_0xc640('0x37'))){_0x4efd15[_0xc640('0x1a')]=qs[_0xc640('0x1a')](_0x5a35f7[_0xc640('0x2f')][_0xc640('0x1a')]);_0x4efd15[_0xc640('0x18')]=qs[_0xc640('0x18')](_0x5a35f7[_0xc640('0x2f')][_0xc640('0x18')]);}_0x4efd15['order']=qs[_0xc640('0x38')](_0x5a35f7[_0xc640('0x2f')][_0xc640('0x38')]);_0x4efd15[_0xc640('0x39')]=qs[_0xc640('0x31')](_[_0xc640('0x3a')](_0x5a35f7[_0xc640('0x2f')],_0x3c3407['filters']),_0x29a153);if(_0x5a35f7[_0xc640('0x2f')][_0xc640('0x3b')]){_0x4efd15[_0xc640('0x39')]=_[_0xc640('0x3c')](_0x4efd15[_0xc640('0x39')],{'$or':_[_0xc640('0x29')](_0x29a153,function(_0x23be75){if(_0x23be75[_0xc640('0x2c')]!==_0xc640('0x3d')){var _0x2139ad={};_0x2139ad[_0x23be75['name']]={'$like':'%'+_0x5a35f7[_0xc640('0x2f')][_0xc640('0x3b')]+'%'};return _0x2139ad;}})});}_0x4efd15=_[_0xc640('0x3c')]({},_0x4efd15,_0x5a35f7[_0xc640('0x3e')]);var _0x5d97fd={'where':_0x4efd15[_0xc640('0x39')]};return db[_0xc640('0x2a')][_0xc640('0x1b')](_0x5d97fd)[_0xc640('0x22')](function(_0x1f8484){_0x386d64[_0xc640('0x1b')]=_0x1f8484;if(_0x5a35f7['query'][_0xc640('0x3f')]){_0x4efd15[_0xc640('0x40')]=[{'all':!![]}];}return db[_0xc640('0x2a')][_0xc640('0x41')](_0x4efd15);})[_0xc640('0x22')](function(_0x36b3c0){_0x386d64[_0xc640('0x42')]=_0x36b3c0;return _0x386d64;})[_0xc640('0x22')](respondWithFilteredResult(_0x4834e8,_0x4efd15))[_0xc640('0x43')](handleError(_0x4834e8,null));};exports[_0xc640('0x44')]=function(_0x2b763b,_0x13b186){var _0x142a8d={'raw':!![],'where':{'id':_0x2b763b['params']['id']}},_0x82a7fc={};_0x82a7fc[_0xc640('0x2e')]=_[_0xc640('0x30')](db[_0xc640('0x2a')][_0xc640('0x45')]);_0x82a7fc[_0xc640('0x2f')]=_[_0xc640('0x30')](_0x2b763b[_0xc640('0x2f')]);_0x82a7fc['filters']=_[_0xc640('0x32')](_0x82a7fc[_0xc640('0x2e')],_0x82a7fc[_0xc640('0x2f')]);_0x142a8d[_0xc640('0x33')]=_[_0xc640('0x32')](_0x82a7fc[_0xc640('0x2e')],qs[_0xc640('0x34')](_0x2b763b[_0xc640('0x2f')][_0xc640('0x34')]));_0x142a8d[_0xc640('0x33')]=_0x142a8d[_0xc640('0x33')][_0xc640('0x35')]?_0x142a8d[_0xc640('0x33')]:_0x82a7fc['model'];if(_0x2b763b[_0xc640('0x2f')][_0xc640('0x3f')]){_0x142a8d[_0xc640('0x40')]=[{'all':!![]}];}_0x142a8d=_[_0xc640('0x3c')]({},_0x142a8d,_0x2b763b['options']);return db[_0xc640('0x2a')][_0xc640('0x46')](_0x142a8d)[_0xc640('0x22')](handleEntityNotFound(_0x13b186,null))[_0xc640('0x22')](respondWithResult(_0x13b186,null))['catch'](handleError(_0x13b186,null));};exports[_0xc640('0x47')]=function(_0x533750,_0x88547){return db[_0xc640('0x2a')][_0xc640('0x47')](_0x533750[_0xc640('0x48')],{})[_0xc640('0x22')](respondWithResult(_0x88547,0xc9))['catch'](handleError(_0x88547,null));};exports[_0xc640('0x21')]=function(_0x54612b,_0x1ff3fd){if(_0x54612b[_0xc640('0x48')]['id']){delete _0x54612b['body']['id'];}return db[_0xc640('0x2a')][_0xc640('0x46')]({'where':{'id':_0x54612b[_0xc640('0x49')]['id']}})['then'](handleEntityNotFound(_0x1ff3fd,null))['then'](saveUpdates(_0x54612b['body'],null))[_0xc640('0x22')](respondWithResult(_0x1ff3fd,null))[_0xc640('0x43')](handleError(_0x1ff3fd,null));};exports[_0xc640('0x4a')]=function(_0xeda03,_0xb942e8){return db[_0xc640('0x2a')][_0xc640('0x46')]({'where':{'id':_0xeda03[_0xc640('0x49')]['id']}})[_0xc640('0x22')](handleEntityNotFound(_0xb942e8,null))[_0xc640('0x22')](removeEntity(_0xb942e8,null))[_0xc640('0x43')](handleError(_0xb942e8,null));};exports[_0xc640('0x4b')]=function(_0x4170c0,_0x140356){return db[_0xc640('0x2a')]['describe']()['then'](respondWithResult(_0x140356,null))[_0xc640('0x43')](handleError(_0x140356,null));}; \ No newline at end of file +var _0x8c10=['body','find','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','create'];(function(_0x2cad83,_0x3c93da){var _0x4e606d=function(_0x1a3330){while(--_0x1a3330){_0x2cad83['push'](_0x2cad83['shift']());}};_0x4e606d(++_0x3c93da);}(_0x8c10,0x129));var _0x08c1=function(_0x43a5e5,_0x39a2ae){_0x43a5e5=_0x43a5e5-0x0;var _0x5b873b=_0x8c10[_0x43a5e5];return _0x5b873b;};'use strict';var emlformat=require(_0x08c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x08c1('0x1'));var jsonpatch=require(_0x08c1('0x2'));var rp=require(_0x08c1('0x3'));var moment=require(_0x08c1('0x4'));var BPromise=require(_0x08c1('0x5'));var Mustache=require(_0x08c1('0x6'));var util=require('util');var path=require(_0x08c1('0x7'));var sox=require(_0x08c1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x08c1('0x9'));var _=require(_0x08c1('0xa'));var squel=require(_0x08c1('0xb'));var crypto=require(_0x08c1('0xc'));var jsforce=require(_0x08c1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x08c1('0xe'));var Papa=require(_0x08c1('0xf'));var Redis=require('ioredis');var authService=require(_0x08c1('0x10'));var qs=require(_0x08c1('0x11'));var as=require(_0x08c1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x08c1('0x13'))(_0x08c1('0x14'));var utils=require(_0x08c1('0x15'));var config=require(_0x08c1('0x16'));var licenseUtil=require(_0x08c1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59e97c,_0x10b751){_0x10b751=_0x10b751||0xcc;return function(_0x28dddc){if(_0x28dddc){return _0x59e97c[_0x08c1('0x18')](_0x10b751);}return _0x59e97c[_0x08c1('0x19')](_0x10b751)[_0x08c1('0x1a')]();};}function respondWithResult(_0x4d695b,_0x2558f7){_0x2558f7=_0x2558f7||0xc8;return function(_0x2d9d0e){if(_0x2d9d0e){return _0x4d695b['status'](_0x2558f7)[_0x08c1('0x1b')](_0x2d9d0e);}};}function respondWithFilteredResult(_0x5c4fad,_0x228240){return function(_0x3b9012){if(_0x3b9012){var _0x380d8c=typeof _0x228240[_0x08c1('0x1c')]===_0x08c1('0x1d')&&typeof _0x228240[_0x08c1('0x1e')]==='undefined';var _0x27a624=_0x3b9012[_0x08c1('0x1f')];var _0x1bafa5=_0x380d8c?0x0:_0x228240[_0x08c1('0x1c')];var _0x473d74=_0x380d8c?_0x3b9012[_0x08c1('0x1f')]:_0x228240[_0x08c1('0x1c')]+_0x228240[_0x08c1('0x1e')];var _0x4bb182;if(_0x473d74>=_0x27a624){_0x473d74=_0x27a624;_0x4bb182=0xc8;}else{_0x4bb182=0xce;}_0x5c4fad[_0x08c1('0x19')](_0x4bb182);return _0x5c4fad[_0x08c1('0x20')](_0x08c1('0x21'),_0x1bafa5+'-'+_0x473d74+'/'+_0x27a624)['json'](_0x3b9012);}return null;};}function patchUpdates(_0x1b6492){return function(_0x5f4099){try{jsonpatch[_0x08c1('0x22')](_0x5f4099,_0x1b6492,!![]);}catch(_0x2f7395){return BPromise['reject'](_0x2f7395);}return _0x5f4099['save']();};}function saveUpdates(_0x4000a3,_0x4729fb){return function(_0x29742f){if(_0x29742f){return _0x29742f[_0x08c1('0x23')](_0x4000a3)['then'](function(_0x5db19f){return _0x5db19f;});}return null;};}function removeEntity(_0x4950f8,_0x5a4ae1){return function(_0x546b54){if(_0x546b54){return _0x546b54['destroy']()[_0x08c1('0x24')](function(){_0x4950f8[_0x08c1('0x19')](0xcc)[_0x08c1('0x1a')]();});}};}function handleEntityNotFound(_0x482c05,_0x18b46d){return function(_0x2f95ae){if(!_0x2f95ae){_0x482c05['sendStatus'](0x194);}return _0x2f95ae;};}function handleError(_0x599932,_0x427055){_0x427055=_0x427055||0x1f4;return function(_0x13cb6f){logger['error'](_0x13cb6f[_0x08c1('0x25')]);if(_0x13cb6f[_0x08c1('0x26')]){delete _0x13cb6f[_0x08c1('0x26')];}_0x599932[_0x08c1('0x19')](_0x427055)['send'](_0x13cb6f);};}exports[_0x08c1('0x27')]=function(_0x62c160,_0x44fec0){var _0x40c17d={},_0x1c45cb={},_0x500d6a={'count':0x0,'rows':[]};var _0x3f0cb5=_[_0x08c1('0x28')](db[_0x08c1('0x29')][_0x08c1('0x2a')],function(_0x1198b3){return{'name':_0x1198b3[_0x08c1('0x2b')],'type':_0x1198b3[_0x08c1('0x2c')][_0x08c1('0x2d')]};});_0x1c45cb[_0x08c1('0x2e')]=_[_0x08c1('0x28')](_0x3f0cb5,'name');_0x1c45cb[_0x08c1('0x2f')]=_[_0x08c1('0x30')](_0x62c160[_0x08c1('0x2f')]);_0x1c45cb[_0x08c1('0x31')]=_[_0x08c1('0x32')](_0x1c45cb['model'],_0x1c45cb[_0x08c1('0x2f')]);_0x40c17d[_0x08c1('0x33')]=_[_0x08c1('0x32')](_0x1c45cb[_0x08c1('0x2e')],qs[_0x08c1('0x34')](_0x62c160[_0x08c1('0x2f')]['fields']));_0x40c17d[_0x08c1('0x33')]=_0x40c17d[_0x08c1('0x33')][_0x08c1('0x35')]?_0x40c17d[_0x08c1('0x33')]:_0x1c45cb[_0x08c1('0x2e')];if(!_0x62c160[_0x08c1('0x2f')]['hasOwnProperty'](_0x08c1('0x36'))){_0x40c17d['limit']=qs['limit'](_0x62c160[_0x08c1('0x2f')][_0x08c1('0x1e')]);_0x40c17d[_0x08c1('0x1c')]=qs[_0x08c1('0x1c')](_0x62c160['query']['offset']);}_0x40c17d[_0x08c1('0x37')]=qs[_0x08c1('0x38')](_0x62c160['query'][_0x08c1('0x38')]);_0x40c17d[_0x08c1('0x39')]=qs[_0x08c1('0x31')](_[_0x08c1('0x3a')](_0x62c160[_0x08c1('0x2f')],_0x1c45cb[_0x08c1('0x31')]),_0x3f0cb5);if(_0x62c160[_0x08c1('0x2f')][_0x08c1('0x3b')]){_0x40c17d[_0x08c1('0x39')]=_[_0x08c1('0x3c')](_0x40c17d[_0x08c1('0x39')],{'$or':_['map'](_0x3f0cb5,function(_0x3e8fcd){if(_0x3e8fcd[_0x08c1('0x2c')]!==_0x08c1('0x3d')){var _0x59db11={};_0x59db11[_0x3e8fcd['name']]={'$like':'%'+_0x62c160['query'][_0x08c1('0x3b')]+'%'};return _0x59db11;}})});}_0x40c17d=_[_0x08c1('0x3c')]({},_0x40c17d,_0x62c160[_0x08c1('0x3e')]);var _0x4f35df={'where':_0x40c17d['where']};return db[_0x08c1('0x29')][_0x08c1('0x1f')](_0x4f35df)[_0x08c1('0x24')](function(_0x250793){_0x500d6a[_0x08c1('0x1f')]=_0x250793;if(_0x62c160[_0x08c1('0x2f')][_0x08c1('0x3f')]){_0x40c17d[_0x08c1('0x40')]=[{'all':!![]}];}return db[_0x08c1('0x29')]['findAll'](_0x40c17d);})[_0x08c1('0x24')](function(_0x1193ca){_0x500d6a[_0x08c1('0x41')]=_0x1193ca;return _0x500d6a;})[_0x08c1('0x24')](respondWithFilteredResult(_0x44fec0,_0x40c17d))[_0x08c1('0x42')](handleError(_0x44fec0,null));};exports['show']=function(_0x56f76b,_0x43736a){var _0x3bc927={'raw':!![],'where':{'id':_0x56f76b['params']['id']}},_0x1b1965={};_0x1b1965[_0x08c1('0x2e')]=_[_0x08c1('0x30')](db[_0x08c1('0x29')][_0x08c1('0x2a')]);_0x1b1965['query']=_['keys'](_0x56f76b[_0x08c1('0x2f')]);_0x1b1965[_0x08c1('0x31')]=_[_0x08c1('0x32')](_0x1b1965[_0x08c1('0x2e')],_0x1b1965[_0x08c1('0x2f')]);_0x3bc927[_0x08c1('0x33')]=_[_0x08c1('0x32')](_0x1b1965['model'],qs[_0x08c1('0x34')](_0x56f76b[_0x08c1('0x2f')][_0x08c1('0x34')]));_0x3bc927[_0x08c1('0x33')]=_0x3bc927[_0x08c1('0x33')][_0x08c1('0x35')]?_0x3bc927[_0x08c1('0x33')]:_0x1b1965[_0x08c1('0x2e')];if(_0x56f76b[_0x08c1('0x2f')]['includeAll']){_0x3bc927[_0x08c1('0x40')]=[{'all':!![]}];}_0x3bc927=_['merge']({},_0x3bc927,_0x56f76b[_0x08c1('0x3e')]);return db[_0x08c1('0x29')]['find'](_0x3bc927)[_0x08c1('0x24')](handleEntityNotFound(_0x43736a,null))[_0x08c1('0x24')](respondWithResult(_0x43736a,null))[_0x08c1('0x42')](handleError(_0x43736a,null));};exports['create']=function(_0x3e34b2,_0x1b7a99){return db['SmsQueueReport'][_0x08c1('0x43')](_0x3e34b2['body'],{})[_0x08c1('0x24')](respondWithResult(_0x1b7a99,0xc9))[_0x08c1('0x42')](handleError(_0x1b7a99,null));};exports[_0x08c1('0x23')]=function(_0xe14de8,_0x3dfcc7){if(_0xe14de8[_0x08c1('0x44')]['id']){delete _0xe14de8[_0x08c1('0x44')]['id'];}return db['SmsQueueReport'][_0x08c1('0x45')]({'where':{'id':_0xe14de8[_0x08c1('0x46')]['id']}})[_0x08c1('0x24')](handleEntityNotFound(_0x3dfcc7,null))[_0x08c1('0x24')](saveUpdates(_0xe14de8['body'],null))[_0x08c1('0x24')](respondWithResult(_0x3dfcc7,null))[_0x08c1('0x42')](handleError(_0x3dfcc7,null));};exports[_0x08c1('0x47')]=function(_0x2cd6ea,_0x24f580){return db['SmsQueueReport'][_0x08c1('0x45')]({'where':{'id':_0x2cd6ea[_0x08c1('0x46')]['id']}})[_0x08c1('0x24')](handleEntityNotFound(_0x24f580,null))['then'](removeEntity(_0x24f580,null))['catch'](handleError(_0x24f580,null));};exports['describe']=function(_0xaeea00,_0x5e8e1c){return db['SmsQueueReport'][_0x08c1('0x48')]()[_0x08c1('0x24')](respondWithResult(_0x5e8e1c,null))['catch'](handleError(_0x5e8e1c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 39905c6..2c718ff 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 _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x2fa45f,_0x1c5bec){var _0x31c97e=function(_0x2f2c9b){while(--_0x2f2c9b){_0x2fa45f['push'](_0x2fa45f['shift']());}};_0x31c97e(++_0x1c5bec);}(_0x70e0,0x17b));var _0x070e=function(_0x4fb32a,_0x108696){_0x4fb32a=_0x4fb32a-0x0;var _0x28cb03=_0x70e0[_0x4fb32a];return _0x28cb03;};'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']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x4311e7,_0x292dac){var _0x468650=function(_0x2cd3fb){while(--_0x2cd3fb){_0x4311e7['push'](_0x4311e7['shift']());}};_0x468650(++_0x292dac);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0xcb91[_0x2181fc];return _0x315da1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 61bab77..e8c6d19 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 _0xf8dd=['request\x20sent','code','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','stringify','UpdateSmsQueueReport','where','attributes','limit','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x18cf42,_0x16b184){var _0x1faa26=function(_0x4a9b07){while(--_0x4a9b07){_0x18cf42['push'](_0x18cf42['shift']());}};_0x1faa26(++_0x16b184);}(_0xf8dd,0x9d));var _0xdf8d=function(_0x792c95,_0x221970){_0x792c95=_0x792c95-0x0;var _0x14ea01=_0xf8dd[_0x792c95];return _0x14ea01;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xdf8d('0x0'));var rs=require(_0xdf8d('0x1'));var fs=require('fs');var Redis=require(_0xdf8d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf8d('0x3'));var logger=require(_0xdf8d('0x4'))('rpc');var config=require(_0xdf8d('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4da58c,_0x50511f,_0x2c571f){return new BPromise(function(_0x3ea464,_0x3126de){return client['request'](_0x4da58c,_0x2c571f)[_0xdf8d('0x6')](function(_0x2eacf3){logger[_0xdf8d('0x7')](_0xdf8d('0x8'),_0x50511f,'request\x20sent');logger[_0xdf8d('0x9')](_0xdf8d('0xa'),_0x50511f,_0xdf8d('0xb'),JSON['stringify'](_0x2eacf3));if(_0x2eacf3['error']){if(_0x2eacf3['error'][_0xdf8d('0xc')]===0x1f4){logger[_0xdf8d('0xd')](_0xdf8d('0x8'),_0x50511f,_0x2eacf3['error']['message']);return _0x3126de(_0x2eacf3[_0xdf8d('0xd')][_0xdf8d('0xe')]);}logger[_0xdf8d('0xd')](_0xdf8d('0x8'),_0x50511f,_0x2eacf3[_0xdf8d('0xd')]['message']);return _0x3ea464(_0x2eacf3['error'][_0xdf8d('0xe')]);}else{logger[_0xdf8d('0x7')]('SmsQueueReport,\x20%s,\x20%s',_0x50511f,'request\x20sent');_0x3ea464(_0x2eacf3[_0xdf8d('0xf')][_0xdf8d('0xe')]);}})[_0xdf8d('0x10')](function(_0x3f6056){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x50511f,_0x3f6056);_0x3126de(_0x3f6056);});});}exports[_0xdf8d('0x11')]=function(_0x3573b3){var _0x13da41=this;return new Promise(function(_0x2fe348,_0x56ba52){return db[_0xdf8d('0x12')][_0xdf8d('0x13')](_0x3573b3[_0xdf8d('0x14')],{'raw':_0x3573b3[_0xdf8d('0x15')]?_0x3573b3['options'][_0xdf8d('0x16')]===undefined?!![]:![]:!![]})[_0xdf8d('0x6')](function(_0x3471a4){logger[_0xdf8d('0x7')]('CreateSmsQueueReport',_0x3573b3);logger[_0xdf8d('0x9')](_0xdf8d('0x11'),_0x3573b3,JSON[_0xdf8d('0x17')](_0x3471a4));_0x2fe348(_0x3471a4);})[_0xdf8d('0x10')](function(_0x1c989a){logger[_0xdf8d('0xd')]('CreateSmsQueueReport',_0x1c989a[_0xdf8d('0xe')],_0x3573b3);_0x56ba52(_0x13da41['error'](0x1f4,_0x1c989a[_0xdf8d('0xe')]));});});};exports[_0xdf8d('0x18')]=function(_0x1475ac){var _0x106042=this;return new Promise(function(_0x428660,_0x33d127){return db[_0xdf8d('0x12')]['update'](_0x1475ac[_0xdf8d('0x14')],{'raw':_0x1475ac[_0xdf8d('0x15')]?_0x1475ac[_0xdf8d('0x15')][_0xdf8d('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1475ac[_0xdf8d('0x15')]?_0x1475ac[_0xdf8d('0x15')][_0xdf8d('0x19')]||null:null,'attributes':_0x1475ac[_0xdf8d('0x15')]?_0x1475ac[_0xdf8d('0x15')][_0xdf8d('0x1a')]||null:null,'limit':_0x1475ac['options']?_0x1475ac[_0xdf8d('0x15')][_0xdf8d('0x1b')]||null:null})[_0xdf8d('0x6')](function(_0x106fd3){logger[_0xdf8d('0x7')]('UpdateSmsQueueReport',_0x1475ac);logger['debug']('UpdateSmsQueueReport',_0x1475ac,JSON[_0xdf8d('0x17')](_0x106fd3));_0x428660(_0x106fd3);})[_0xdf8d('0x10')](function(_0x352216){logger[_0xdf8d('0xd')](_0xdf8d('0x18'),_0x352216[_0xdf8d('0xe')],_0x1475ac);_0x33d127(_0x106042[_0xdf8d('0xd')](0x1f4,_0x352216['message']));});});}; \ No newline at end of file +var _0xd268=['jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsQueueReport','options','debug','UpdateSmsQueueReport','SmsQueueReport','update','body','raw','where','attributes','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment'];(function(_0x145552,_0x10b1c7){var _0x26a2dd=function(_0xc28ff5){while(--_0xc28ff5){_0x145552['push'](_0x145552['shift']());}};_0x26a2dd(++_0x10b1c7);}(_0xd268,0x108));var _0x8d26=function(_0x5a1cd4,_0x43ceff){_0x5a1cd4=_0x5a1cd4-0x0;var _0xd7a6d9=_0xd268[_0x5a1cd4];return _0xd7a6d9;};'use strict';var _=require('lodash');var util=require(_0x8d26('0x0'));var moment=require('moment');var BPromise=require(_0x8d26('0x1'));var rs=require(_0x8d26('0x2'));var fs=require('fs');var Redis=require(_0x8d26('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d26('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x8d26('0x5'));var jayson=require(_0x8d26('0x6'));var client=jayson[_0x8d26('0x7')][_0x8d26('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1966d8,_0x4cc9d7,_0x30a4c3){return new BPromise(function(_0x24f136,_0x5d7b46){return client[_0x8d26('0x9')](_0x1966d8,_0x30a4c3)[_0x8d26('0xa')](function(_0x370e1e){logger[_0x8d26('0xb')](_0x8d26('0xc'),_0x4cc9d7,_0x8d26('0xd'));logger['debug'](_0x8d26('0xe'),_0x4cc9d7,_0x8d26('0xd'),JSON[_0x8d26('0xf')](_0x370e1e));if(_0x370e1e[_0x8d26('0x10')]){if(_0x370e1e[_0x8d26('0x10')][_0x8d26('0x11')]===0x1f4){logger[_0x8d26('0x10')](_0x8d26('0xc'),_0x4cc9d7,_0x370e1e[_0x8d26('0x10')][_0x8d26('0x12')]);return _0x5d7b46(_0x370e1e[_0x8d26('0x10')][_0x8d26('0x12')]);}logger[_0x8d26('0x10')](_0x8d26('0xc'),_0x4cc9d7,_0x370e1e[_0x8d26('0x10')][_0x8d26('0x12')]);return _0x24f136(_0x370e1e[_0x8d26('0x10')]['message']);}else{logger[_0x8d26('0xb')](_0x8d26('0xc'),_0x4cc9d7,_0x8d26('0xd'));_0x24f136(_0x370e1e['result']['message']);}})[_0x8d26('0x13')](function(_0x49093e){logger[_0x8d26('0x10')](_0x8d26('0xc'),_0x4cc9d7,_0x49093e);_0x5d7b46(_0x49093e);});});}exports[_0x8d26('0x14')]=function(_0x2e2abc){var _0x4f001e=this;return new Promise(function(_0x4d2972,_0x115fe2){return db['SmsQueueReport']['create'](_0x2e2abc['body'],{'raw':_0x2e2abc[_0x8d26('0x15')]?_0x2e2abc[_0x8d26('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x223bf7){logger['info'](_0x8d26('0x14'),_0x2e2abc);logger[_0x8d26('0x16')](_0x8d26('0x14'),_0x2e2abc,JSON[_0x8d26('0xf')](_0x223bf7));_0x4d2972(_0x223bf7);})['catch'](function(_0x9adc29){logger[_0x8d26('0x10')](_0x8d26('0x14'),_0x9adc29['message'],_0x2e2abc);_0x115fe2(_0x4f001e[_0x8d26('0x10')](0x1f4,_0x9adc29[_0x8d26('0x12')]));});});};exports[_0x8d26('0x17')]=function(_0x1563c1){var _0x2c0e23=this;return new Promise(function(_0x583d80,_0x401ea7){return db[_0x8d26('0x18')][_0x8d26('0x19')](_0x1563c1[_0x8d26('0x1a')],{'raw':_0x1563c1[_0x8d26('0x15')]?_0x1563c1[_0x8d26('0x15')][_0x8d26('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1563c1['options']?_0x1563c1[_0x8d26('0x15')][_0x8d26('0x1c')]||null:null,'attributes':_0x1563c1[_0x8d26('0x15')]?_0x1563c1['options'][_0x8d26('0x1d')]||null:null,'limit':_0x1563c1[_0x8d26('0x15')]?_0x1563c1[_0x8d26('0x15')]['limit']||null:null})[_0x8d26('0xa')](function(_0x5e3511){logger[_0x8d26('0xb')](_0x8d26('0x17'),_0x1563c1);logger[_0x8d26('0x16')](_0x8d26('0x17'),_0x1563c1,JSON[_0x8d26('0xf')](_0x5e3511));_0x583d80(_0x5e3511);})[_0x8d26('0x13')](function(_0x1b3106){logger['error'](_0x8d26('0x17'),_0x1b3106[_0x8d26('0x12')],_0x1563c1);_0x401ea7(_0x2c0e23[_0x8d26('0x10')](0x1f4,_0x1b3106[_0x8d26('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index f0f3eab..df3a5ab 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 _0xbfe8=['describe','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x26efa2,_0x5096d2){_0x26efa2=_0x26efa2-0x0;var _0x1784bd=_0xbfe8[_0x26efa2];return _0x1784bd;};'use strict';var multer=require('multer');var util=require(_0x8bfe('0x0'));var path=require('path');var timeout=require(_0x8bfe('0x1'));var express=require(_0x8bfe('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8bfe('0x3'));var interaction=require(_0x8bfe('0x4'));var config=require('../../config/environment');var controller=require(_0x8bfe('0x5'));router[_0x8bfe('0x6')]('/',auth[_0x8bfe('0x7')](),controller['index']);router[_0x8bfe('0x6')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0x9')]);router[_0x8bfe('0x6')](_0x8bfe('0xa'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xb')]);router[_0x8bfe('0xc')]('/',auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xd')]);router[_0x8bfe('0xe')](_0x8bfe('0xa'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xf')]);router['delete'](_0x8bfe('0xa'),auth['isAuthenticated'](),controller[_0x8bfe('0x10')]);module[_0x8bfe('0x11')]=router; \ No newline at end of file +var _0xcb99=['create','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x389c24,_0x353c08){var _0x19b3d2=function(_0x163640){while(--_0x163640){_0x389c24['push'](_0x389c24['shift']());}};_0x19b3d2(++_0x353c08);}(_0xcb99,0x8b));var _0x9cb9=function(_0x4fc476,_0xb7cdfd){_0x4fc476=_0x4fc476-0x0;var _0x2de7d8=_0xcb99[_0x4fc476];return _0x2de7d8;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require('util');var path=require(_0x9cb9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cb9('0x2')]();var fs_extra=require(_0x9cb9('0x3'));var auth=require(_0x9cb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9cb9('0x5'));var controller=require(_0x9cb9('0x6'));router['get']('/',auth[_0x9cb9('0x7')](),controller['index']);router[_0x9cb9('0x8')](_0x9cb9('0x9'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xa')]);router[_0x9cb9('0x8')](_0x9cb9('0xb'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9cb9('0xd')]);router[_0x9cb9('0xe')](_0x9cb9('0xb'),auth['isAuthenticated'](),controller[_0x9cb9('0xf')]);router[_0x9cb9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x11')]);module[_0x9cb9('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 7a3cd4c..215a7af 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x1858e4,_0x32905c){var _0x24c04d=function(_0x1d71d5){while(--_0x1d71d5){_0x1858e4['push'](_0x1858e4['shift']());}};_0x24c04d(++_0x32905c);}(_0x70e0,0x17b));var _0x070e=function(_0x1777a9,_0x300d36){_0x1777a9=_0x1777a9-0x0;var _0x5eced8=_0x70e0[_0x1777a9];return _0x5eced8;};'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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5cd1c8,_0x47f808){var _0xa7ad0f=function(_0x3bdd1b){while(--_0x3bdd1b){_0x5cd1c8['push'](_0x5cd1c8['shift']());}};_0xa7ad0f(++_0x47f808);}(_0x008c,0x188));var _0xc008=function(_0x2295fa,_0x53f01b){_0x2295fa=_0x2295fa-0x0;var _0xcdd3b7=_0x008c[_0x2295fa];return _0xcdd3b7;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index f5b8ef0..7eea5a9 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 _0xdc35=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','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','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','sendStatus','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick'];(function(_0x85d209,_0x3eb77b){var _0x25a56d=function(_0x3ea23e){while(--_0x3ea23e){_0x85d209['push'](_0x85d209['shift']());}};_0x25a56d(++_0x3eb77b);}(_0xdc35,0x133));var _0x5dc3=function(_0x2c4c64,_0x4e72d7){_0x2c4c64=_0x2c4c64-0x0;var _0x2916be=_0xdc35[_0x2c4c64];return _0x2916be;};'use strict';var emlformat=require(_0x5dc3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5dc3('0x1'));var jsonpatch=require(_0x5dc3('0x2'));var rp=require(_0x5dc3('0x3'));var moment=require('moment');var BPromise=require(_0x5dc3('0x4'));var Mustache=require(_0x5dc3('0x5'));var util=require(_0x5dc3('0x6'));var path=require(_0x5dc3('0x7'));var sox=require('sox');var csv=require(_0x5dc3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5dc3('0x9'));var _=require(_0x5dc3('0xa'));var squel=require(_0x5dc3('0xb'));var crypto=require(_0x5dc3('0xc'));var jsforce=require(_0x5dc3('0xd'));var deskjs=require(_0x5dc3('0xe'));var toCsv=require(_0x5dc3('0x8'));var querystring=require('querystring');var Papa=require(_0x5dc3('0xf'));var Redis=require(_0x5dc3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5dc3('0x11'));var as=require(_0x5dc3('0x12'));var hardwareService=require(_0x5dc3('0x13'));var logger=require(_0x5dc3('0x14'))(_0x5dc3('0x15'));var utils=require('../../config/utils');var config=require(_0x5dc3('0x16'));var licenseUtil=require(_0x5dc3('0x17'));var db=require(_0x5dc3('0x18'))['db'];function respondWithStatusCode(_0x51b4a2,_0x15a798){_0x15a798=_0x15a798||0xcc;return function(_0x2c4625){if(_0x2c4625){return _0x51b4a2['sendStatus'](_0x15a798);}return _0x51b4a2[_0x5dc3('0x19')](_0x15a798)[_0x5dc3('0x1a')]();};}function respondWithResult(_0x101a23,_0x488ae7){_0x488ae7=_0x488ae7||0xc8;return function(_0x318f89){if(_0x318f89){return _0x101a23[_0x5dc3('0x19')](_0x488ae7)[_0x5dc3('0x1b')](_0x318f89);}};}function respondWithFilteredResult(_0x5b4b8a,_0x30ee25){return function(_0x18ff8e){if(_0x18ff8e){var _0x3a1ec2=typeof _0x30ee25[_0x5dc3('0x1c')]===_0x5dc3('0x1d')&&typeof _0x30ee25[_0x5dc3('0x1e')]===_0x5dc3('0x1d');var _0x1f1e80=_0x18ff8e[_0x5dc3('0x1f')];var _0x56474f=_0x3a1ec2?0x0:_0x30ee25[_0x5dc3('0x1c')];var _0x32510b=_0x3a1ec2?_0x18ff8e[_0x5dc3('0x1f')]:_0x30ee25['offset']+_0x30ee25['limit'];var _0x49341b;if(_0x32510b>=_0x1f1e80){_0x32510b=_0x1f1e80;_0x49341b=0xc8;}else{_0x49341b=0xce;}_0x5b4b8a[_0x5dc3('0x19')](_0x49341b);return _0x5b4b8a[_0x5dc3('0x20')]('Content-Range',_0x56474f+'-'+_0x32510b+'/'+_0x1f1e80)[_0x5dc3('0x1b')](_0x18ff8e);}return null;};}function patchUpdates(_0x9f75e9){return function(_0x39b627){try{jsonpatch[_0x5dc3('0x21')](_0x39b627,_0x9f75e9,!![]);}catch(_0x4b13df){return BPromise['reject'](_0x4b13df);}return _0x39b627['save']();};}function saveUpdates(_0xcaddf0,_0x76a16e){return function(_0x14a68e){if(_0x14a68e){return _0x14a68e[_0x5dc3('0x22')](_0xcaddf0)[_0x5dc3('0x23')](function(_0x16ed7e){return _0x16ed7e;});}return null;};}function removeEntity(_0x8ae971,_0x1abad7){return function(_0x18deb4){if(_0x18deb4){return _0x18deb4[_0x5dc3('0x24')]()[_0x5dc3('0x23')](function(){_0x8ae971[_0x5dc3('0x19')](0xcc)[_0x5dc3('0x1a')]();});}};}function handleEntityNotFound(_0x4f665f,_0x9434ab){return function(_0x1fddea){if(!_0x1fddea){_0x4f665f[_0x5dc3('0x25')](0x194);}return _0x1fddea;};}function handleError(_0x5b5f6a,_0x5484a0){_0x5484a0=_0x5484a0||0x1f4;return function(_0x584464){logger['error'](_0x584464['stack']);if(_0x584464[_0x5dc3('0x26')]){delete _0x584464[_0x5dc3('0x26')];}_0x5b5f6a[_0x5dc3('0x19')](_0x5484a0)['send'](_0x584464);};}exports[_0x5dc3('0x27')]=function(_0x135e6a,_0x3728a8){var _0x379e3a={},_0x39ee5f={},_0x2387b0={'count':0x0,'rows':[]};var _0x2655ec=_[_0x5dc3('0x28')](db[_0x5dc3('0x29')][_0x5dc3('0x2a')],function(_0x3a96cf){return{'name':_0x3a96cf[_0x5dc3('0x2b')],'type':_0x3a96cf[_0x5dc3('0x2c')][_0x5dc3('0x2d')]};});_0x39ee5f['model']=_[_0x5dc3('0x28')](_0x2655ec,_0x5dc3('0x26'));_0x39ee5f[_0x5dc3('0x2e')]=_[_0x5dc3('0x2f')](_0x135e6a['query']);_0x39ee5f['filters']=_[_0x5dc3('0x30')](_0x39ee5f[_0x5dc3('0x31')],_0x39ee5f[_0x5dc3('0x2e')]);_0x379e3a[_0x5dc3('0x32')]=_[_0x5dc3('0x30')](_0x39ee5f[_0x5dc3('0x31')],qs['fields'](_0x135e6a[_0x5dc3('0x2e')][_0x5dc3('0x33')]));_0x379e3a['attributes']=_0x379e3a['attributes'][_0x5dc3('0x34')]?_0x379e3a['attributes']:_0x39ee5f[_0x5dc3('0x31')];if(!_0x135e6a[_0x5dc3('0x2e')]['hasOwnProperty'](_0x5dc3('0x35'))){_0x379e3a[_0x5dc3('0x1e')]=qs[_0x5dc3('0x1e')](_0x135e6a[_0x5dc3('0x2e')][_0x5dc3('0x1e')]);_0x379e3a[_0x5dc3('0x1c')]=qs[_0x5dc3('0x1c')](_0x135e6a[_0x5dc3('0x2e')]['offset']);}_0x379e3a['order']=qs[_0x5dc3('0x36')](_0x135e6a['query']['sort']);_0x379e3a[_0x5dc3('0x37')]=qs[_0x5dc3('0x38')](_[_0x5dc3('0x39')](_0x135e6a['query'],_0x39ee5f[_0x5dc3('0x38')]),_0x2655ec);if(_0x135e6a[_0x5dc3('0x2e')][_0x5dc3('0x3a')]){_0x379e3a['where']=_[_0x5dc3('0x3b')](_0x379e3a['where'],{'$or':_[_0x5dc3('0x28')](_0x2655ec,function(_0x389310){if(_0x389310[_0x5dc3('0x2c')]!==_0x5dc3('0x3c')){var _0x21fb5c={};_0x21fb5c[_0x389310[_0x5dc3('0x26')]]={'$like':'%'+_0x135e6a['query'][_0x5dc3('0x3a')]+'%'};return _0x21fb5c;}})});}_0x379e3a=_['merge']({},_0x379e3a,_0x135e6a[_0x5dc3('0x3d')]);var _0x2f6f68={'where':_0x379e3a[_0x5dc3('0x37')]};return db[_0x5dc3('0x29')][_0x5dc3('0x1f')](_0x2f6f68)[_0x5dc3('0x23')](function(_0x509c36){_0x2387b0[_0x5dc3('0x1f')]=_0x509c36;if(_0x135e6a[_0x5dc3('0x2e')][_0x5dc3('0x3e')]){_0x379e3a[_0x5dc3('0x3f')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x5dc3('0x40')](_0x379e3a);})['then'](function(_0x3e32f4){_0x2387b0[_0x5dc3('0x41')]=_0x3e32f4;return _0x2387b0;})[_0x5dc3('0x23')](respondWithFilteredResult(_0x3728a8,_0x379e3a))[_0x5dc3('0x42')](handleError(_0x3728a8,null));};exports[_0x5dc3('0x43')]=function(_0x400eb6,_0x5a9802){var _0x29bf4a={'raw':!![],'where':{'id':_0x400eb6[_0x5dc3('0x44')]['id']}},_0x5a8a01={};_0x5a8a01[_0x5dc3('0x31')]=_[_0x5dc3('0x2f')](db[_0x5dc3('0x29')][_0x5dc3('0x2a')]);_0x5a8a01[_0x5dc3('0x2e')]=_[_0x5dc3('0x2f')](_0x400eb6[_0x5dc3('0x2e')]);_0x5a8a01[_0x5dc3('0x38')]=_[_0x5dc3('0x30')](_0x5a8a01[_0x5dc3('0x31')],_0x5a8a01[_0x5dc3('0x2e')]);_0x29bf4a[_0x5dc3('0x32')]=_[_0x5dc3('0x30')](_0x5a8a01[_0x5dc3('0x31')],qs[_0x5dc3('0x33')](_0x400eb6[_0x5dc3('0x2e')][_0x5dc3('0x33')]));_0x29bf4a[_0x5dc3('0x32')]=_0x29bf4a['attributes'][_0x5dc3('0x34')]?_0x29bf4a[_0x5dc3('0x32')]:_0x5a8a01[_0x5dc3('0x31')];if(_0x400eb6[_0x5dc3('0x2e')]['includeAll']){_0x29bf4a[_0x5dc3('0x3f')]=[{'all':!![]}];}_0x29bf4a=_['merge']({},_0x29bf4a,_0x400eb6['options']);return db[_0x5dc3('0x29')][_0x5dc3('0x45')](_0x29bf4a)[_0x5dc3('0x23')](handleEntityNotFound(_0x5a9802,null))[_0x5dc3('0x23')](respondWithResult(_0x5a9802,null))['catch'](handleError(_0x5a9802,null));};exports[_0x5dc3('0x46')]=function(_0x1f5a3,_0x3d0dcf){return db['SmsTransferReport']['create'](_0x1f5a3[_0x5dc3('0x47')],{})[_0x5dc3('0x23')](respondWithResult(_0x3d0dcf,0xc9))[_0x5dc3('0x42')](handleError(_0x3d0dcf,null));};exports[_0x5dc3('0x22')]=function(_0x3880b4,_0x20f2c1){if(_0x3880b4[_0x5dc3('0x47')]['id']){delete _0x3880b4[_0x5dc3('0x47')]['id'];}return db[_0x5dc3('0x29')]['find']({'where':{'id':_0x3880b4[_0x5dc3('0x44')]['id']}})[_0x5dc3('0x23')](handleEntityNotFound(_0x20f2c1,null))[_0x5dc3('0x23')](saveUpdates(_0x3880b4['body'],null))[_0x5dc3('0x23')](respondWithResult(_0x20f2c1,null))[_0x5dc3('0x42')](handleError(_0x20f2c1,null));};exports[_0x5dc3('0x24')]=function(_0x5b28bd,_0x355178){return db[_0x5dc3('0x29')][_0x5dc3('0x45')]({'where':{'id':_0x5b28bd[_0x5dc3('0x44')]['id']}})[_0x5dc3('0x23')](handleEntityNotFound(_0x355178,null))[_0x5dc3('0x23')](removeEntity(_0x355178,null))['catch'](handleError(_0x355178,null));};exports[_0x5dc3('0x48')]=function(_0x2dfd08,_0x2fc795){return db[_0x5dc3('0x29')][_0x5dc3('0x48')]()[_0x5dc3('0x23')](respondWithResult(_0x2fc795,null))[_0x5dc3('0x42')](handleError(_0x2fc795,null));}; \ No newline at end of file +var _0xc449=['../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','SmsTransferReport','include','rows','catch','show','fields','length','options','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x43f458,_0x1304d6){var _0x5e6672=function(_0x576608){while(--_0x576608){_0x43f458['push'](_0x43f458['shift']());}};_0x5e6672(++_0x1304d6);}(_0xc449,0x81));var _0x9c44=function(_0x39129d,_0x31c6ff){_0x39129d=_0x39129d-0x0;var _0x1be13d=_0xc449[_0x39129d];return _0x1be13d;};'use strict';var emlformat=require(_0x9c44('0x0'));var rimraf=require(_0x9c44('0x1'));var zipdir=require(_0x9c44('0x2'));var jsonpatch=require(_0x9c44('0x3'));var rp=require(_0x9c44('0x4'));var moment=require(_0x9c44('0x5'));var BPromise=require(_0x9c44('0x6'));var Mustache=require(_0x9c44('0x7'));var util=require(_0x9c44('0x8'));var path=require('path');var sox=require(_0x9c44('0x9'));var csv=require(_0x9c44('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c44('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c44('0xc'));var jsforce=require(_0x9c44('0xd'));var deskjs=require(_0x9c44('0xe'));var toCsv=require(_0x9c44('0xa'));var querystring=require(_0x9c44('0xf'));var Papa=require(_0x9c44('0x10'));var Redis=require(_0x9c44('0x11'));var authService=require(_0x9c44('0x12'));var qs=require(_0x9c44('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c44('0x14'));var logger=require(_0x9c44('0x15'))(_0x9c44('0x16'));var utils=require(_0x9c44('0x17'));var config=require(_0x9c44('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f1785,_0x5e8d4f){_0x5e8d4f=_0x5e8d4f||0xcc;return function(_0x3d7d4b){if(_0x3d7d4b){return _0x2f1785[_0x9c44('0x19')](_0x5e8d4f);}return _0x2f1785[_0x9c44('0x1a')](_0x5e8d4f)['end']();};}function respondWithResult(_0x24b386,_0x56edb6){_0x56edb6=_0x56edb6||0xc8;return function(_0x1430a6){if(_0x1430a6){return _0x24b386['status'](_0x56edb6)['json'](_0x1430a6);}};}function respondWithFilteredResult(_0x9cb2d6,_0x4c7ff9){return function(_0x48b0e0){if(_0x48b0e0){var _0x587bba=typeof _0x4c7ff9[_0x9c44('0x1b')]===_0x9c44('0x1c')&&typeof _0x4c7ff9[_0x9c44('0x1d')]===_0x9c44('0x1c');var _0x532365=_0x48b0e0[_0x9c44('0x1e')];var _0x752d38=_0x587bba?0x0:_0x4c7ff9[_0x9c44('0x1b')];var _0x3f01d5=_0x587bba?_0x48b0e0[_0x9c44('0x1e')]:_0x4c7ff9[_0x9c44('0x1b')]+_0x4c7ff9[_0x9c44('0x1d')];var _0x1f04b6;if(_0x3f01d5>=_0x532365){_0x3f01d5=_0x532365;_0x1f04b6=0xc8;}else{_0x1f04b6=0xce;}_0x9cb2d6[_0x9c44('0x1a')](_0x1f04b6);return _0x9cb2d6[_0x9c44('0x1f')]('Content-Range',_0x752d38+'-'+_0x3f01d5+'/'+_0x532365)[_0x9c44('0x20')](_0x48b0e0);}return null;};}function patchUpdates(_0x2985a6){return function(_0x56cf99){try{jsonpatch[_0x9c44('0x21')](_0x56cf99,_0x2985a6,!![]);}catch(_0x246de8){return BPromise[_0x9c44('0x22')](_0x246de8);}return _0x56cf99[_0x9c44('0x23')]();};}function saveUpdates(_0xfebe7e,_0x4f45d1){return function(_0x47294e){if(_0x47294e){return _0x47294e[_0x9c44('0x24')](_0xfebe7e)[_0x9c44('0x25')](function(_0x398108){return _0x398108;});}return null;};}function removeEntity(_0x2b46ac,_0x691712){return function(_0x24985c){if(_0x24985c){return _0x24985c[_0x9c44('0x26')]()[_0x9c44('0x25')](function(){_0x2b46ac[_0x9c44('0x1a')](0xcc)[_0x9c44('0x27')]();});}};}function handleEntityNotFound(_0x50b1e1,_0x6531c){return function(_0x2f60b9){if(!_0x2f60b9){_0x50b1e1[_0x9c44('0x19')](0x194);}return _0x2f60b9;};}function handleError(_0x3db7c5,_0x4761f7){_0x4761f7=_0x4761f7||0x1f4;return function(_0x500571){logger[_0x9c44('0x28')](_0x500571[_0x9c44('0x29')]);if(_0x500571[_0x9c44('0x2a')]){delete _0x500571[_0x9c44('0x2a')];}_0x3db7c5[_0x9c44('0x1a')](_0x4761f7)[_0x9c44('0x2b')](_0x500571);};}exports[_0x9c44('0x2c')]=function(_0x4d1fe9,_0x44f876){var _0xa654cf={},_0x324be9={},_0x12dc53={'count':0x0,'rows':[]};var _0x50c37f=_[_0x9c44('0x2d')](db['SmsTransferReport'][_0x9c44('0x2e')],function(_0x5014cf){return{'name':_0x5014cf['fieldName'],'type':_0x5014cf[_0x9c44('0x2f')][_0x9c44('0x30')]};});_0x324be9[_0x9c44('0x31')]=_[_0x9c44('0x2d')](_0x50c37f,_0x9c44('0x2a'));_0x324be9[_0x9c44('0x32')]=_[_0x9c44('0x33')](_0x4d1fe9[_0x9c44('0x32')]);_0x324be9[_0x9c44('0x34')]=_[_0x9c44('0x35')](_0x324be9[_0x9c44('0x31')],_0x324be9[_0x9c44('0x32')]);_0xa654cf[_0x9c44('0x36')]=_[_0x9c44('0x35')](_0x324be9['model'],qs['fields'](_0x4d1fe9[_0x9c44('0x32')]['fields']));_0xa654cf['attributes']=_0xa654cf['attributes']['length']?_0xa654cf[_0x9c44('0x36')]:_0x324be9[_0x9c44('0x31')];if(!_0x4d1fe9[_0x9c44('0x32')][_0x9c44('0x37')]('nolimit')){_0xa654cf[_0x9c44('0x1d')]=qs[_0x9c44('0x1d')](_0x4d1fe9[_0x9c44('0x32')]['limit']);_0xa654cf[_0x9c44('0x1b')]=qs['offset'](_0x4d1fe9['query'][_0x9c44('0x1b')]);}_0xa654cf[_0x9c44('0x38')]=qs[_0x9c44('0x39')](_0x4d1fe9[_0x9c44('0x32')][_0x9c44('0x39')]);_0xa654cf[_0x9c44('0x3a')]=qs[_0x9c44('0x34')](_[_0x9c44('0x3b')](_0x4d1fe9[_0x9c44('0x32')],_0x324be9['filters']),_0x50c37f);if(_0x4d1fe9[_0x9c44('0x32')][_0x9c44('0x3c')]){_0xa654cf[_0x9c44('0x3a')]=_[_0x9c44('0x3d')](_0xa654cf['where'],{'$or':_[_0x9c44('0x2d')](_0x50c37f,function(_0x2ad0fe){if(_0x2ad0fe['type']!==_0x9c44('0x3e')){var _0xbdf5bf={};_0xbdf5bf[_0x2ad0fe[_0x9c44('0x2a')]]={'$like':'%'+_0x4d1fe9[_0x9c44('0x32')]['filter']+'%'};return _0xbdf5bf;}})});}_0xa654cf=_[_0x9c44('0x3d')]({},_0xa654cf,_0x4d1fe9['options']);var _0xd1f876={'where':_0xa654cf['where']};return db[_0x9c44('0x3f')]['count'](_0xd1f876)[_0x9c44('0x25')](function(_0x4a381c){_0x12dc53[_0x9c44('0x1e')]=_0x4a381c;if(_0x4d1fe9['query']['includeAll']){_0xa654cf[_0x9c44('0x40')]=[{'all':!![]}];}return db[_0x9c44('0x3f')]['findAll'](_0xa654cf);})['then'](function(_0x1e45fc){_0x12dc53[_0x9c44('0x41')]=_0x1e45fc;return _0x12dc53;})[_0x9c44('0x25')](respondWithFilteredResult(_0x44f876,_0xa654cf))[_0x9c44('0x42')](handleError(_0x44f876,null));};exports[_0x9c44('0x43')]=function(_0x2a56ee,_0x5cafe7){var _0x2bdef4={'raw':!![],'where':{'id':_0x2a56ee['params']['id']}},_0x2f0b55={};_0x2f0b55[_0x9c44('0x31')]=_[_0x9c44('0x33')](db[_0x9c44('0x3f')][_0x9c44('0x2e')]);_0x2f0b55[_0x9c44('0x32')]=_['keys'](_0x2a56ee[_0x9c44('0x32')]);_0x2f0b55[_0x9c44('0x34')]=_[_0x9c44('0x35')](_0x2f0b55[_0x9c44('0x31')],_0x2f0b55[_0x9c44('0x32')]);_0x2bdef4[_0x9c44('0x36')]=_[_0x9c44('0x35')](_0x2f0b55[_0x9c44('0x31')],qs['fields'](_0x2a56ee[_0x9c44('0x32')][_0x9c44('0x44')]));_0x2bdef4[_0x9c44('0x36')]=_0x2bdef4[_0x9c44('0x36')][_0x9c44('0x45')]?_0x2bdef4[_0x9c44('0x36')]:_0x2f0b55['model'];if(_0x2a56ee['query']['includeAll']){_0x2bdef4[_0x9c44('0x40')]=[{'all':!![]}];}_0x2bdef4=_['merge']({},_0x2bdef4,_0x2a56ee[_0x9c44('0x46')]);return db['SmsTransferReport']['find'](_0x2bdef4)[_0x9c44('0x25')](handleEntityNotFound(_0x5cafe7,null))['then'](respondWithResult(_0x5cafe7,null))[_0x9c44('0x42')](handleError(_0x5cafe7,null));};exports[_0x9c44('0x47')]=function(_0x19b398,_0x20d583){return db[_0x9c44('0x3f')][_0x9c44('0x47')](_0x19b398[_0x9c44('0x48')],{})[_0x9c44('0x25')](respondWithResult(_0x20d583,0xc9))[_0x9c44('0x42')](handleError(_0x20d583,null));};exports[_0x9c44('0x24')]=function(_0x31c960,_0x1b0f20){if(_0x31c960[_0x9c44('0x48')]['id']){delete _0x31c960['body']['id'];}return db[_0x9c44('0x3f')][_0x9c44('0x49')]({'where':{'id':_0x31c960[_0x9c44('0x4a')]['id']}})[_0x9c44('0x25')](handleEntityNotFound(_0x1b0f20,null))[_0x9c44('0x25')](saveUpdates(_0x31c960[_0x9c44('0x48')],null))['then'](respondWithResult(_0x1b0f20,null))[_0x9c44('0x42')](handleError(_0x1b0f20,null));};exports[_0x9c44('0x26')]=function(_0x3ac8d3,_0xce549){return db[_0x9c44('0x3f')][_0x9c44('0x49')]({'where':{'id':_0x3ac8d3[_0x9c44('0x4a')]['id']}})[_0x9c44('0x25')](handleEntityNotFound(_0xce549,null))[_0x9c44('0x25')](removeEntity(_0xce549,null))['catch'](handleError(_0xce549,null));};exports[_0x9c44('0x4b')]=function(_0x1b182e,_0x103323){return db[_0x9c44('0x3f')][_0x9c44('0x4b')]()['then'](respondWithResult(_0x103323,null))[_0x9c44('0x42')](handleError(_0x103323,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d89c7f5..3bcfadb 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 _0xdbfb=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','api','moment','request-promise','path','rimraf','exports','define'];(function(_0xcd2f34,_0x4c6fe4){var _0x578b1f=function(_0xa79595){while(--_0xa79595){_0xcd2f34['push'](_0xcd2f34['shift']());}};_0x578b1f(++_0x4c6fe4);}(_0xdbfb,0x16b));var _0xbdbf=function(_0x32abf7,_0x22c097){_0x32abf7=_0x32abf7-0x0;var _0x2720bc=_0xdbfb[_0x32abf7];return _0x2720bc;};'use strict';var _=require(_0xbdbf('0x0'));var util=require(_0xbdbf('0x1'));var logger=require('../../config/logger')(_0xbdbf('0x2'));var moment=require(_0xbdbf('0x3'));var BPromise=require('bluebird');var rp=require(_0xbdbf('0x4'));var fs=require('fs');var path=require(_0xbdbf('0x5'));var rimraf=require(_0xbdbf('0x6'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0xbdbf('0x7')]=function(_0x1dd17f,_0x37e176){return _0x1dd17f[_0xbdbf('0x8')](_0xbdbf('0x9'),attributes,{'tableName':_0xbdbf('0xa'),'paranoid':![],'indexes':[{'name':_0xbdbf('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7ec=['../../config/logger','api','path','rimraf','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util'];(function(_0x184099,_0x5152f4){var _0x5b4804=function(_0x51324e){while(--_0x51324e){_0x184099['push'](_0x184099['shift']());}};_0x5b4804(++_0x5152f4);}(_0xa7ec,0x14b));var _0xca7e=function(_0x2ccb03,_0x213b27){_0x2ccb03=_0x2ccb03-0x0;var _0x38ff55=_0xa7ec[_0x2ccb03];return _0x38ff55;};'use strict';var _=require(_0xca7e('0x0'));var util=require(_0xca7e('0x1'));var logger=require(_0xca7e('0x2'))(_0xca7e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xca7e('0x4'));var rimraf=require(_0xca7e('0x5'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x2f8fb5,_0x2f3afd){return _0x2f8fb5['define'](_0xca7e('0x6'),attributes,{'tableName':_0xca7e('0x7'),'paranoid':![],'indexes':[{'name':_0xca7e('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 3e08594..a7f5593 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 _0xde6c=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5eca6f,_0x76ec15){var _0x4c34b7=function(_0x52cbe1){while(--_0x52cbe1){_0x5eca6f['push'](_0x5eca6f['shift']());}};_0x4c34b7(++_0x76ec15);}(_0xde6c,0x119));var _0xcde6=function(_0x31cc6e,_0x4da430){_0x31cc6e=_0x31cc6e-0x0;var _0x39a234=_0xde6c[_0x31cc6e];return _0x39a234;};'use strict';var _=require(_0xcde6('0x0'));var util=require(_0xcde6('0x1'));var moment=require('moment');var BPromise=require(_0xcde6('0x2'));var rs=require(_0xcde6('0x3'));var fs=require('fs');var Redis=require(_0xcde6('0x4'));var db=require(_0xcde6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcde6('0x6'))(_0xcde6('0x7'));var config=require(_0xcde6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcde6('0x9')][_0xcde6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5543d9,_0x4c37b1,_0x2f7de6){return new BPromise(function(_0x4f07e8,_0x19d6b2){return client[_0xcde6('0xb')](_0x5543d9,_0x2f7de6)[_0xcde6('0xc')](function(_0x353b84){logger['info'](_0xcde6('0xd'),_0x4c37b1,_0xcde6('0xe'));logger['debug'](_0xcde6('0xf'),_0x4c37b1,_0xcde6('0xe'),JSON[_0xcde6('0x10')](_0x353b84));if(_0x353b84[_0xcde6('0x11')]){if(_0x353b84[_0xcde6('0x11')][_0xcde6('0x12')]===0x1f4){logger[_0xcde6('0x11')](_0xcde6('0xd'),_0x4c37b1,_0x353b84[_0xcde6('0x11')][_0xcde6('0x13')]);return _0x19d6b2(_0x353b84['error'][_0xcde6('0x13')]);}logger[_0xcde6('0x11')](_0xcde6('0xd'),_0x4c37b1,_0x353b84[_0xcde6('0x11')][_0xcde6('0x13')]);return _0x4f07e8(_0x353b84[_0xcde6('0x11')][_0xcde6('0x13')]);}else{logger[_0xcde6('0x14')](_0xcde6('0xd'),_0x4c37b1,_0xcde6('0xe'));_0x4f07e8(_0x353b84['result'][_0xcde6('0x13')]);}})[_0xcde6('0x15')](function(_0x38f82a){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x4c37b1,_0x38f82a);_0x19d6b2(_0x38f82a);});});} \ No newline at end of file +var _0x1928=['jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1a2c07,_0x2a653f){var _0x2d05e5=function(_0x150c77){while(--_0x150c77){_0x1a2c07['push'](_0x1a2c07['shift']());}};_0x2d05e5(++_0x2a653f);}(_0x1928,0x138));var _0x8192=function(_0x28679f,_0x4dfc6d){_0x28679f=_0x28679f-0x0;var _0x10be26=_0x1928[_0x28679f];return _0x10be26;};'use strict';var _=require(_0x8192('0x0'));var util=require(_0x8192('0x1'));var moment=require(_0x8192('0x2'));var BPromise=require('bluebird');var rs=require(_0x8192('0x3'));var fs=require('fs');var Redis=require(_0x8192('0x4'));var db=require(_0x8192('0x5'))['db'];var utils=require(_0x8192('0x6'));var logger=require(_0x8192('0x7'))(_0x8192('0x8'));var config=require(_0x8192('0x9'));var jayson=require(_0x8192('0xa'));var client=jayson[_0x8192('0xb')][_0x8192('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d6b3d,_0x23ddef,_0x2cf769){return new BPromise(function(_0x1ad518,_0x59708f){return client[_0x8192('0xd')](_0x1d6b3d,_0x2cf769)['then'](function(_0x265f5e){logger[_0x8192('0xe')](_0x8192('0xf'),_0x23ddef,_0x8192('0x10'));logger['debug'](_0x8192('0x11'),_0x23ddef,_0x8192('0x10'),JSON[_0x8192('0x12')](_0x265f5e));if(_0x265f5e[_0x8192('0x13')]){if(_0x265f5e[_0x8192('0x13')]['code']===0x1f4){logger[_0x8192('0x13')](_0x8192('0xf'),_0x23ddef,_0x265f5e[_0x8192('0x13')][_0x8192('0x14')]);return _0x59708f(_0x265f5e[_0x8192('0x13')][_0x8192('0x14')]);}logger[_0x8192('0x13')](_0x8192('0xf'),_0x23ddef,_0x265f5e[_0x8192('0x13')][_0x8192('0x14')]);return _0x1ad518(_0x265f5e[_0x8192('0x13')]['message']);}else{logger[_0x8192('0xe')](_0x8192('0xf'),_0x23ddef,_0x8192('0x10'));_0x1ad518(_0x265f5e[_0x8192('0x15')]['message']);}})[_0x8192('0x16')](function(_0x459a92){logger[_0x8192('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x23ddef,_0x459a92);_0x59708f(_0x459a92);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 4524036..17d3765 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 _0x95d9=['server/files/sounds/original/','originalname','replace','format','basename','extname','post','single','file','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./sound.controller','get','isAuthenticated','/:id','root'];(function(_0x188be5,_0x58d066){var _0x464205=function(_0x398e35){while(--_0x398e35){_0x188be5['push'](_0x188be5['shift']());}};_0x464205(++_0x58d066);}(_0x95d9,0x138));var _0x995d=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x95d9[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x995d('0x0'));var util=require(_0x995d('0x1'));var path=require(_0x995d('0x2'));var timeout=require(_0x995d('0x3'));var express=require(_0x995d('0x4'));var router=express[_0x995d('0x5')]();var fs_extra=require(_0x995d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x995d('0x7'));var config=require('../../config/environment');var controller=require(_0x995d('0x8'));router[_0x995d('0x9')]('/',auth[_0x995d('0xa')](),controller['index']);router[_0x995d('0x9')](_0x995d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x995d('0x9')]('/:id/download',auth[_0x995d('0xa')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4572d6,_0x47cf9d,_0x54984d){_0x54984d(null,path['join'](config[_0x995d('0xc')],_0x995d('0xd')));},'filename':function(_0x50de6a,_0x440e41,_0x1517b7){_0x440e41[_0x995d('0xe')]=_0x440e41['originalname'][_0x995d('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1517b7(null,util[_0x995d('0x10')]('%s-%s%s',path[_0x995d('0x11')](_0x440e41[_0x995d('0xe')],path[_0x995d('0x12')](_0x440e41[_0x995d('0xe')])),Date['now'](),path['extname'](_0x440e41[_0x995d('0xe')])));}})});router[_0x995d('0x13')]('/',upload[_0x995d('0x14')](_0x995d('0x15')),controller['create']);router[_0x995d('0x16')](_0x995d('0xb'),auth['isAuthenticated'](),controller[_0x995d('0x17')]);router[_0x995d('0x18')](_0x995d('0xb'),auth[_0x995d('0xa')](),controller[_0x995d('0x18')]);module['exports']=router; \ No newline at end of file +var _0x4aa1=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','now','post','single','file','create','put','update','delete','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1274ba,_0x3f7962){var _0x21d5cb=function(_0x223acf){while(--_0x223acf){_0x1274ba['push'](_0x1274ba['shift']());}};_0x21d5cb(++_0x3f7962);}(_0x4aa1,0x174));var _0x14aa=function(_0x9e3e9d,_0x4658d6){_0x9e3e9d=_0x9e3e9d-0x0;var _0x1d1a34=_0x4aa1[_0x9e3e9d];return _0x1d1a34;};'use strict';var multer=require('multer');var util=require(_0x14aa('0x0'));var path=require('path');var timeout=require(_0x14aa('0x1'));var express=require(_0x14aa('0x2'));var router=express['Router']();var fs_extra=require(_0x14aa('0x3'));var auth=require(_0x14aa('0x4'));var interaction=require(_0x14aa('0x5'));var config=require(_0x14aa('0x6'));var controller=require('./sound.controller');router[_0x14aa('0x7')]('/',auth[_0x14aa('0x8')](),controller[_0x14aa('0x9')]);router['get'](_0x14aa('0xa'),auth[_0x14aa('0x8')](),controller['show']);router[_0x14aa('0x7')](_0x14aa('0xb'),auth[_0x14aa('0x8')](),controller[_0x14aa('0xc')]);var upload=multer({'storage':multer[_0x14aa('0xd')]({'destination':function(_0x3eb6da,_0x53f60e,_0x29b34e){_0x29b34e(null,path[_0x14aa('0xe')](config[_0x14aa('0xf')],_0x14aa('0x10')));},'filename':function(_0x1f7031,_0x35e588,_0x2b5c89){_0x35e588['originalname']=_0x35e588[_0x14aa('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2b5c89(null,util[_0x14aa('0x12')](_0x14aa('0x13'),path[_0x14aa('0x14')](_0x35e588[_0x14aa('0x11')],path['extname'](_0x35e588['originalname'])),Date[_0x14aa('0x15')](),path['extname'](_0x35e588[_0x14aa('0x11')])));}})});router[_0x14aa('0x16')]('/',upload[_0x14aa('0x17')](_0x14aa('0x18')),controller[_0x14aa('0x19')]);router[_0x14aa('0x1a')](_0x14aa('0xa'),auth[_0x14aa('0x8')](),controller[_0x14aa('0x1b')]);router[_0x14aa('0x1c')]('/:id',auth[_0x14aa('0x8')](),controller[_0x14aa('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 184934a..0b2ae57 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 _0x6561=['INTEGER','sequelize','STRING','name','BIGINT'];(function(_0x426c24,_0x4ea696){var _0x1e0dda=function(_0x19ceed){while(--_0x19ceed){_0x426c24['push'](_0x426c24['shift']());}};_0x1e0dda(++_0x4ea696);}(_0x6561,0xba));var _0x1656=function(_0x498b38,_0x2d9583){_0x498b38=_0x498b38-0x0;var _0x10feb7=_0x6561[_0x498b38];return _0x10feb7;};'use strict';var Sequelize=require(_0x1656('0x0'));module['exports']={'name':{'type':Sequelize[_0x1656('0x1')],'unique':_0x1656('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x1656('0x1')]},'display_name':{'type':Sequelize[_0x1656('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x1656('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x1656('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x1656('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x1656('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x1656('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x1656('0x4')]}}; \ No newline at end of file +var _0x38a2=['FLOAT','INTEGER','BIGINT','sequelize','exports','STRING'];(function(_0x3e1350,_0x5c0140){var _0x4294bb=function(_0x5b9fc8){while(--_0x5b9fc8){_0x3e1350['push'](_0x3e1350['shift']());}};_0x4294bb(++_0x5c0140);}(_0x38a2,0x1ef));var _0x238a=function(_0x4935bf,_0x401f41){_0x4935bf=_0x4935bf-0x0;var _0x4bdb8c=_0x38a2[_0x4935bf];return _0x4bdb8c;};'use strict';var Sequelize=require(_0x238a('0x0'));module[_0x238a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x238a('0x2')]},'display_name':{'type':Sequelize[_0x238a('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x238a('0x2')]},'original_duration':{'type':Sequelize[_0x238a('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x238a('0x4')]},'original_bitRate':{'type':Sequelize[_0x238a('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x238a('0x2')]},'converted_duration':{'type':Sequelize[_0x238a('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x238a('0x5')]},'converted_channelCount':{'type':Sequelize[_0x238a('0x4')]},'converted_bitRate':{'type':Sequelize[_0x238a('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x238a('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0294bfb..9adcef9 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 _0x8230=['autoAssociation','start','update','description','delete','server/files/sounds/original','original_format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','Sounds','UserProfileResource','error','name','send','map','Sound','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','catch','save_name','existsSync','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','download','join','format','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','root','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','find'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0x8230,0x101));var _0x0823=function(_0x264662,_0x3b66be){_0x264662=_0x264662-0x0;var _0x3c4792=_0x8230[_0x264662];return _0x3c4792;};'use strict';var emlformat=require(_0x0823('0x0'));var rimraf=require(_0x0823('0x1'));var zipdir=require(_0x0823('0x2'));var jsonpatch=require(_0x0823('0x3'));var rp=require('request-promise');var moment=require(_0x0823('0x4'));var BPromise=require(_0x0823('0x5'));var Mustache=require(_0x0823('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0823('0x7'));var csv=require('to-csv');var ejs=require(_0x0823('0x8'));var fs=require('fs');var fs_extra=require(_0x0823('0x9'));var _=require(_0x0823('0xa'));var squel=require(_0x0823('0xb'));var crypto=require(_0x0823('0xc'));var jsforce=require(_0x0823('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0823('0xe'));var querystring=require(_0x0823('0xf'));var Papa=require(_0x0823('0x10'));var Redis=require('ioredis');var authService=require(_0x0823('0x11'));var qs=require(_0x0823('0x12'));var as=require(_0x0823('0x13'));var hardwareService=require(_0x0823('0x14'));var logger=require(_0x0823('0x15'))('api');var utils=require(_0x0823('0x16'));var config=require(_0x0823('0x17'));var licenseUtil=require(_0x0823('0x18'));var db=require(_0x0823('0x19'))['db'];function respondWithStatusCode(_0x298d5f,_0x2c5a7f){_0x2c5a7f=_0x2c5a7f||0xcc;return function(_0xe10190){if(_0xe10190){return _0x298d5f[_0x0823('0x1a')](_0x2c5a7f);}return _0x298d5f[_0x0823('0x1b')](_0x2c5a7f)[_0x0823('0x1c')]();};}function respondWithResult(_0x3a7b1b,_0x387aba){_0x387aba=_0x387aba||0xc8;return function(_0x5b1d6e){if(_0x5b1d6e){return _0x3a7b1b[_0x0823('0x1b')](_0x387aba)[_0x0823('0x1d')](_0x5b1d6e);}};}function respondWithFilteredResult(_0x42b987,_0x264d23){return function(_0x24aaf4){if(_0x24aaf4){var _0x3fdfd0=typeof _0x264d23[_0x0823('0x1e')]===_0x0823('0x1f')&&typeof _0x264d23[_0x0823('0x20')]===_0x0823('0x1f');var _0x4826ec=_0x24aaf4[_0x0823('0x21')];var _0x3ae16e=_0x3fdfd0?0x0:_0x264d23[_0x0823('0x1e')];var _0xf7868=_0x3fdfd0?_0x24aaf4['count']:_0x264d23[_0x0823('0x1e')]+_0x264d23[_0x0823('0x20')];var _0x40835d;if(_0xf7868>=_0x4826ec){_0xf7868=_0x4826ec;_0x40835d=0xc8;}else{_0x40835d=0xce;}_0x42b987[_0x0823('0x1b')](_0x40835d);return _0x42b987[_0x0823('0x22')](_0x0823('0x23'),_0x3ae16e+'-'+_0xf7868+'/'+_0x4826ec)[_0x0823('0x1d')](_0x24aaf4);}return null;};}function patchUpdates(_0x3a8d33){return function(_0xd6ffdc){try{jsonpatch[_0x0823('0x24')](_0xd6ffdc,_0x3a8d33,!![]);}catch(_0x5851b8){return BPromise[_0x0823('0x25')](_0x5851b8);}return _0xd6ffdc['save']();};}function saveUpdates(_0x1f99ab,_0x3e5855){return function(_0x48a1f2){if(_0x48a1f2){return _0x48a1f2['update'](_0x1f99ab)[_0x0823('0x26')](function(_0x3e6eac){return _0x3e6eac;});}return null;};}function removeEntity(_0x5f1893,_0x36ab12){return function(_0x417f68){if(_0x417f68){return _0x417f68['destroy']()[_0x0823('0x26')](function(){var _0x1eae00=_0x417f68[_0x0823('0x27')]({'plain':!![]});var _0x12b3b0=_0x0823('0x28');return db[_0x0823('0x29')]['destroy']({'where':{'type':_0x12b3b0,'resourceId':_0x1eae00['id']}})[_0x0823('0x26')](function(){return _0x417f68;});})[_0x0823('0x26')](function(){_0x5f1893[_0x0823('0x1b')](0xcc)[_0x0823('0x1c')]();});}};}function handleEntityNotFound(_0x44a423,_0x513ead){return function(_0xd424c1){if(!_0xd424c1){_0x44a423[_0x0823('0x1a')](0x194);}return _0xd424c1;};}function handleError(_0x3aa7b6,_0x117305){_0x117305=_0x117305||0x1f4;return function(_0x58c548){logger[_0x0823('0x2a')](_0x58c548['stack']);if(_0x58c548[_0x0823('0x2b')]){delete _0x58c548[_0x0823('0x2b')];}_0x3aa7b6[_0x0823('0x1b')](_0x117305)[_0x0823('0x2c')](_0x58c548);};}exports['index']=function(_0x5ddf5c,_0x3f60c0){var _0x41c5f0={},_0x233418={},_0x3f3c32={'count':0x0,'rows':[]};var _0x1620b7=_[_0x0823('0x2d')](db[_0x0823('0x2e')]['rawAttributes'],function(_0x58cc57){return{'name':_0x58cc57[_0x0823('0x2f')],'type':_0x58cc57['type'][_0x0823('0x30')]};});_0x233418[_0x0823('0x31')]=_[_0x0823('0x2d')](_0x1620b7,_0x0823('0x2b'));_0x233418[_0x0823('0x32')]=_[_0x0823('0x33')](_0x5ddf5c[_0x0823('0x32')]);_0x233418[_0x0823('0x34')]=_[_0x0823('0x35')](_0x233418[_0x0823('0x31')],_0x233418['query']);_0x41c5f0['attributes']=_[_0x0823('0x35')](_0x233418[_0x0823('0x31')],qs['fields'](_0x5ddf5c['query'][_0x0823('0x36')]));_0x41c5f0[_0x0823('0x37')]=_0x41c5f0['attributes'][_0x0823('0x38')]?_0x41c5f0[_0x0823('0x37')]:_0x233418[_0x0823('0x31')];if(!_0x5ddf5c[_0x0823('0x32')][_0x0823('0x39')](_0x0823('0x3a'))){_0x41c5f0[_0x0823('0x20')]=qs[_0x0823('0x20')](_0x5ddf5c[_0x0823('0x32')][_0x0823('0x20')]);_0x41c5f0['offset']=qs[_0x0823('0x1e')](_0x5ddf5c[_0x0823('0x32')][_0x0823('0x1e')]);}_0x41c5f0['order']=qs[_0x0823('0x3b')](_0x5ddf5c[_0x0823('0x32')]['sort']);_0x41c5f0['where']=qs[_0x0823('0x34')](_[_0x0823('0x3c')](_0x5ddf5c[_0x0823('0x32')],_0x233418[_0x0823('0x34')]),_0x1620b7);if(_0x5ddf5c['query'][_0x0823('0x3d')]){_0x41c5f0[_0x0823('0x3e')]=_[_0x0823('0x3f')](_0x41c5f0[_0x0823('0x3e')],{'$or':_[_0x0823('0x2d')](_0x1620b7,function(_0x6ee89b){if(_0x6ee89b[_0x0823('0x40')]!==_0x0823('0x41')){var _0x4e9cac={};_0x4e9cac[_0x6ee89b[_0x0823('0x2b')]]={'$like':'%'+_0x5ddf5c['query']['filter']+'%'};return _0x4e9cac;}})});}_0x41c5f0=_[_0x0823('0x3f')]({},_0x41c5f0,_0x5ddf5c[_0x0823('0x42')]);var _0x5bcaa2={'where':_0x41c5f0['where']};return db[_0x0823('0x2e')][_0x0823('0x21')](_0x5bcaa2)[_0x0823('0x26')](function(_0xb6986f){_0x3f3c32[_0x0823('0x21')]=_0xb6986f;if(_0x5ddf5c[_0x0823('0x32')][_0x0823('0x43')]){_0x41c5f0[_0x0823('0x44')]=[{'all':!![]}];}return db['Sound'][_0x0823('0x45')](_0x41c5f0);})[_0x0823('0x26')](function(_0xbcbc6){_0x3f3c32['rows']=_0xbcbc6;return _0x3f3c32;})['then'](respondWithFilteredResult(_0x3f60c0,_0x41c5f0))['catch'](handleError(_0x3f60c0,null));};exports[_0x0823('0x46')]=function(_0xd98a7b,_0x431e93){var _0x216718={'raw':!![],'where':{'id':_0xd98a7b[_0x0823('0x47')]['id']}},_0xf12a4b={};_0xf12a4b['model']=_[_0x0823('0x33')](db[_0x0823('0x2e')][_0x0823('0x48')]);_0xf12a4b['query']=_[_0x0823('0x33')](_0xd98a7b['query']);_0xf12a4b[_0x0823('0x34')]=_[_0x0823('0x35')](_0xf12a4b[_0x0823('0x31')],_0xf12a4b['query']);_0x216718[_0x0823('0x37')]=_['intersection'](_0xf12a4b['model'],qs['fields'](_0xd98a7b[_0x0823('0x32')][_0x0823('0x36')]));_0x216718[_0x0823('0x37')]=_0x216718[_0x0823('0x37')][_0x0823('0x38')]?_0x216718[_0x0823('0x37')]:_0xf12a4b[_0x0823('0x31')];if(_0xd98a7b['query']['includeAll']){_0x216718[_0x0823('0x44')]=[{'all':!![]}];}_0x216718=_[_0x0823('0x3f')]({},_0x216718,_0xd98a7b[_0x0823('0x42')]);return db[_0x0823('0x2e')]['find'](_0x216718)[_0x0823('0x26')](handleEntityNotFound(_0x431e93,null))[_0x0823('0x26')](respondWithResult(_0x431e93,null))[_0x0823('0x49')](handleError(_0x431e93,null));};exports['download']=function(_0x4c5943,_0xebd30f,_0x291fbd){return db[_0x0823('0x2e')]['find']({'where':{'id':_0x4c5943[_0x0823('0x47')]['id']},'attributes':['name',_0x0823('0x4a'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0xebd30f,null))['then'](function(_0x26509d){if(_0x26509d){if(!fs[_0x0823('0x4b')](path['join'](config['root'],_0x0823('0x4c'),_0x26509d['save_name']+'.'+_0x26509d[_0x0823('0x4d')]))){throw new db[(_0x0823('0x4e'))][(_0x0823('0x4f'))](_0x0823('0x50'));}return _0xebd30f[_0x0823('0x51')](path[_0x0823('0x52')](config['root'],_0x0823('0x4c'),util[_0x0823('0x53')](_0x0823('0x54'),_0x26509d[_0x0823('0x4a')],_0x26509d[_0x0823('0x4d')])),util[_0x0823('0x53')](_0x0823('0x54'),_0x26509d[_0x0823('0x2b')],_0x26509d[_0x0823('0x4d')]));}return null;})['catch'](handleError(_0xebd30f,null));};exports[_0x0823('0x55')]=function(_0x324e60,_0x24443e,_0x56e15d){var _0x1f277c={'name':path[_0x0823('0x56')](_0x324e60[_0x0823('0x57')][_0x0823('0x58')],path['extname'](_0x324e60[_0x0823('0x57')][_0x0823('0x58')])),'save_name':path[_0x0823('0x56')](_0x324e60['file'][_0x0823('0x59')],path[_0x0823('0x5a')](_0x324e60['file'][_0x0823('0x59')])),'original_format':path[_0x0823('0x5a')](_0x324e60[_0x0823('0x57')][_0x0823('0x58')])[_0x0823('0x5b')](0x1),'converted_format':_0x0823('0x5c')};var _0x42dbc6=path[_0x0823('0x52')](config[_0x0823('0x5d')],'server/files/sounds/original',_0x324e60[_0x0823('0x57')][_0x0823('0x59')]);var _0x288ab1=path[_0x0823('0x52')](config[_0x0823('0x5d')],_0x0823('0x4c'),util[_0x0823('0x53')](_0x0823('0x54'),path[_0x0823('0x56')](_0x324e60[_0x0823('0x57')][_0x0823('0x59')],path[_0x0823('0x5a')](_0x324e60['file'][_0x0823('0x59')])),_0x1f277c['converted_format']));logger[_0x0823('0x5e')](_0x0823('0x5f'),_0x42dbc6);logger['info'](_0x0823('0x60'),_0x288ab1);try{fs[_0x0823('0x61')](_0x42dbc6,parseInt('0777',0x8));var _0x5dea28=sox[_0x0823('0x62')](_0x42dbc6,_0x288ab1,{'sampleRate':0x1f40,'format':_0x0823('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5dea28['on']('error',function(_0x2a112d){fs['unlinkSync'](_0x42dbc6);_0x24443e[_0x0823('0x1b')](0x1f4)[_0x0823('0x2c')](_0x2a112d);});_0x5dea28['on'](_0x0823('0x63'),function(_0x4a9d88){_0x1f277c[_0x0823('0x64')]=isNaN(_0x4a9d88[_0x0823('0x65')])?null:_0x4a9d88[_0x0823('0x65')]*0x3e8;_0x1f277c[_0x0823('0x66')]=isNaN(_0x4a9d88[_0x0823('0x67')])?null:_0x4a9d88[_0x0823('0x67')];_0x1f277c['original_channelCount']=isNaN(_0x4a9d88[_0x0823('0x68')])?null:_0x4a9d88[_0x0823('0x68')];_0x1f277c[_0x0823('0x69')]=isNaN(_0x4a9d88[_0x0823('0x6a')])?null:_0x4a9d88[_0x0823('0x6a')];_0x1f277c[_0x0823('0x6b')]=isNaN(_0x4a9d88[_0x0823('0x6c')])?null:_0x4a9d88[_0x0823('0x6c')];});_0x5dea28['on'](_0x0823('0x6d'),function(_0x375bc4){_0x1f277c['converted_duration']=isNaN(_0x375bc4[_0x0823('0x65')])?null:_0x375bc4['duration']*0x3e8;_0x1f277c[_0x0823('0x6e')]=isNaN(_0x375bc4[_0x0823('0x67')])?null:_0x375bc4[_0x0823('0x67')];_0x1f277c[_0x0823('0x6f')]=isNaN(_0x375bc4['channelCount'])?null:_0x375bc4['channelCount'];_0x1f277c['converted_bitRate']=isNaN(_0x375bc4[_0x0823('0x6a')])?null:_0x375bc4[_0x0823('0x6a')];_0x1f277c[_0x0823('0x70')]=isNaN(_0x375bc4[_0x0823('0x6c')])?null:_0x375bc4[_0x0823('0x6c')];});_0x5dea28['on']('end',function(){fs[_0x0823('0x61')](_0x288ab1,parseInt('0777',0x8));return db['Sound'][_0x0823('0x55')](_0x1f277c)[_0x0823('0x26')](function(_0x523211){var _0x907292={'role':_0x324e60[_0x0823('0x71')][_0x0823('0x72')],'userProfileId':_0x324e60[_0x0823('0x71')][_0x0823('0x73')]};if(!_0x907292)throw new Error(_0x0823('0x74'));if(_0x907292[_0x0823('0x72')]==='user'){var _0xd0a031=_0x523211[_0x0823('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x0823('0x75')]({'where':{'name':_0x0823('0x28'),'userProfileId':_0x907292[_0x0823('0x73')]},'raw':!![]})['then'](function(_0x17bf2d){if(_0x17bf2d&&_0x17bf2d[_0x0823('0x76')]===0x0){return db[_0x0823('0x29')][_0x0823('0x55')]({'name':_0xd0a031[_0x0823('0x2b')],'resourceId':_0xd0a031['id'],'type':_0x17bf2d[_0x0823('0x2b')],'sectionId':_0x17bf2d['id']},{})[_0x0823('0x26')](function(){return _0x523211;});}else{return _0x523211;}})[_0x0823('0x49')](function(_0x12430a){logger[_0x0823('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12430a);throw _0x12430a;});}return _0x523211;})['then'](respondWithResult(_0x24443e,null))['catch'](handleError(_0x24443e,null));});_0x5dea28[_0x0823('0x77')]();}catch(_0x44abf5){_0x24443e[_0x0823('0x1b')](0x1f4)[_0x0823('0x2c')](_0x44abf5);}};exports[_0x0823('0x78')]=function(_0xe01606,_0xcca25c,_0x2606e3){return db['Sound'][_0x0823('0x75')]({'where':{'id':_0xe01606[_0x0823('0x47')]['id']}})['then'](handleEntityNotFound(_0xcca25c,null))['then'](saveUpdates(_[_0x0823('0x3c')](_0xe01606[_0x0823('0x71')],[_0x0823('0x2b'),_0x0823('0x79')]),null))[_0x0823('0x26')](respondWithResult(_0xcca25c,null))[_0x0823('0x49')](handleError(_0xcca25c,null));};exports[_0x0823('0x7a')]=function(_0x5507f2,_0x330878,_0x192615){return db[_0x0823('0x2e')]['find']({'where':{'id':_0x5507f2['params']['id']}})[_0x0823('0x26')](function(_0x3d7ce5){if(_0x3d7ce5){return _0x3d7ce5['destroy']();}})['then'](function(_0x29e483){var _0x4c72d6=path['join'](config[_0x0823('0x5d')],_0x0823('0x7b'),util[_0x0823('0x53')](_0x0823('0x54'),_0x29e483[_0x0823('0x4a')],_0x29e483[_0x0823('0x7c')]));var _0x1e07e1=path[_0x0823('0x52')](config[_0x0823('0x5d')],'server/files/sounds/converted',util[_0x0823('0x53')](_0x0823('0x54'),_0x29e483[_0x0823('0x4a')],_0x29e483[_0x0823('0x4d')]));fs['unlinkSync'](_0x4c72d6);fs['unlinkSync'](_0x1e07e1);return _0x29e483;})[_0x0823('0x26')](function(_0x3216f4){if(_0x3216f4){return _0x330878[_0x0823('0x1b')](0xcc)['end']();}})[_0x0823('0x26')](handleEntityNotFound(_0x330878,null))[_0x0823('0x49')](handleError(_0x330878,null));}; \ No newline at end of file +var _0xefe9=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','Sounds','UserProfileResource','error','name','send','index','Sound','rawAttributes','fieldName','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','options','findAll','rows','show','params','keys','intersection','includeAll','include','catch','download','find','save_name','converted_format','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','delete','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','crypto'];(function(_0x384070,_0x56cd7f){var _0x2fe1bb=function(_0x1f6dea){while(--_0x1f6dea){_0x384070['push'](_0x384070['shift']());}};_0x2fe1bb(++_0x56cd7f);}(_0xefe9,0x15a));var _0x9efe=function(_0x3f7db6,_0x40efe2){_0x3f7db6=_0x3f7db6-0x0;var _0x415e96=_0xefe9[_0x3f7db6];return _0x415e96;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9efe('0x0'));var rp=require('request-promise');var moment=require(_0x9efe('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x9efe('0x2'));var util=require('util');var path=require(_0x9efe('0x3'));var sox=require(_0x9efe('0x4'));var csv=require(_0x9efe('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9efe('0x6'));var squel=require('squel');var crypto=require(_0x9efe('0x7'));var jsforce=require(_0x9efe('0x8'));var deskjs=require(_0x9efe('0x9'));var toCsv=require(_0x9efe('0x5'));var querystring=require(_0x9efe('0xa'));var Papa=require('papaparse');var Redis=require(_0x9efe('0xb'));var authService=require(_0x9efe('0xc'));var qs=require(_0x9efe('0xd'));var as=require(_0x9efe('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9efe('0xf'))('api');var utils=require(_0x9efe('0x10'));var config=require(_0x9efe('0x11'));var licenseUtil=require(_0x9efe('0x12'));var db=require(_0x9efe('0x13'))['db'];function respondWithStatusCode(_0x34cfc0,_0x54613b){_0x54613b=_0x54613b||0xcc;return function(_0x5e3503){if(_0x5e3503){return _0x34cfc0[_0x9efe('0x14')](_0x54613b);}return _0x34cfc0[_0x9efe('0x15')](_0x54613b)[_0x9efe('0x16')]();};}function respondWithResult(_0x3b6caa,_0x2bb430){_0x2bb430=_0x2bb430||0xc8;return function(_0x245ded){if(_0x245ded){return _0x3b6caa[_0x9efe('0x15')](_0x2bb430)[_0x9efe('0x17')](_0x245ded);}};}function respondWithFilteredResult(_0x58152f,_0x5c62e4){return function(_0x2a0309){if(_0x2a0309){var _0xa88639=typeof _0x5c62e4[_0x9efe('0x18')]===_0x9efe('0x19')&&typeof _0x5c62e4[_0x9efe('0x1a')]===_0x9efe('0x19');var _0x1d5970=_0x2a0309['count'];var _0x31e273=_0xa88639?0x0:_0x5c62e4[_0x9efe('0x18')];var _0x152c9b=_0xa88639?_0x2a0309[_0x9efe('0x1b')]:_0x5c62e4[_0x9efe('0x18')]+_0x5c62e4[_0x9efe('0x1a')];var _0x17f8e8;if(_0x152c9b>=_0x1d5970){_0x152c9b=_0x1d5970;_0x17f8e8=0xc8;}else{_0x17f8e8=0xce;}_0x58152f['status'](_0x17f8e8);return _0x58152f[_0x9efe('0x1c')](_0x9efe('0x1d'),_0x31e273+'-'+_0x152c9b+'/'+_0x1d5970)[_0x9efe('0x17')](_0x2a0309);}return null;};}function patchUpdates(_0x275a45){return function(_0x2fcba6){try{jsonpatch['apply'](_0x2fcba6,_0x275a45,!![]);}catch(_0x314db4){return BPromise[_0x9efe('0x1e')](_0x314db4);}return _0x2fcba6[_0x9efe('0x1f')]();};}function saveUpdates(_0x3f3183,_0x4d7e26){return function(_0x596673){if(_0x596673){return _0x596673['update'](_0x3f3183)[_0x9efe('0x20')](function(_0x5a169d){return _0x5a169d;});}return null;};}function removeEntity(_0x29f438,_0x41569d){return function(_0x1b3569){if(_0x1b3569){return _0x1b3569[_0x9efe('0x21')]()[_0x9efe('0x20')](function(){var _0x27b5c3=_0x1b3569[_0x9efe('0x22')]({'plain':!![]});var _0x131fcb=_0x9efe('0x23');return db[_0x9efe('0x24')][_0x9efe('0x21')]({'where':{'type':_0x131fcb,'resourceId':_0x27b5c3['id']}})['then'](function(){return _0x1b3569;});})[_0x9efe('0x20')](function(){_0x29f438[_0x9efe('0x15')](0xcc)[_0x9efe('0x16')]();});}};}function handleEntityNotFound(_0x11df53,_0x47ccc3){return function(_0x278d6a){if(!_0x278d6a){_0x11df53[_0x9efe('0x14')](0x194);}return _0x278d6a;};}function handleError(_0x7d52ea,_0x4fb6dc){_0x4fb6dc=_0x4fb6dc||0x1f4;return function(_0x4f5adb){logger[_0x9efe('0x25')](_0x4f5adb['stack']);if(_0x4f5adb[_0x9efe('0x26')]){delete _0x4f5adb[_0x9efe('0x26')];}_0x7d52ea[_0x9efe('0x15')](_0x4fb6dc)[_0x9efe('0x27')](_0x4f5adb);};}exports[_0x9efe('0x28')]=function(_0x4daf5a,_0x149475){var _0xd63234={},_0x189140={},_0x51f20e={'count':0x0,'rows':[]};var _0x5a1b49=_['map'](db[_0x9efe('0x29')][_0x9efe('0x2a')],function(_0x4a8d30){return{'name':_0x4a8d30[_0x9efe('0x2b')],'type':_0x4a8d30['type'][_0x9efe('0x2c')]};});_0x189140[_0x9efe('0x2d')]=_[_0x9efe('0x2e')](_0x5a1b49,_0x9efe('0x26'));_0x189140[_0x9efe('0x2f')]=_['keys'](_0x4daf5a[_0x9efe('0x2f')]);_0x189140[_0x9efe('0x30')]=_['intersection'](_0x189140[_0x9efe('0x2d')],_0x189140[_0x9efe('0x2f')]);_0xd63234[_0x9efe('0x31')]=_['intersection'](_0x189140[_0x9efe('0x2d')],qs[_0x9efe('0x32')](_0x4daf5a['query'][_0x9efe('0x32')]));_0xd63234['attributes']=_0xd63234['attributes'][_0x9efe('0x33')]?_0xd63234[_0x9efe('0x31')]:_0x189140[_0x9efe('0x2d')];if(!_0x4daf5a['query'][_0x9efe('0x34')]('nolimit')){_0xd63234[_0x9efe('0x1a')]=qs['limit'](_0x4daf5a['query']['limit']);_0xd63234[_0x9efe('0x18')]=qs['offset'](_0x4daf5a[_0x9efe('0x2f')][_0x9efe('0x18')]);}_0xd63234['order']=qs['sort'](_0x4daf5a[_0x9efe('0x2f')][_0x9efe('0x35')]);_0xd63234[_0x9efe('0x36')]=qs[_0x9efe('0x30')](_[_0x9efe('0x37')](_0x4daf5a['query'],_0x189140[_0x9efe('0x30')]),_0x5a1b49);if(_0x4daf5a[_0x9efe('0x2f')][_0x9efe('0x38')]){_0xd63234[_0x9efe('0x36')]=_[_0x9efe('0x39')](_0xd63234[_0x9efe('0x36')],{'$or':_[_0x9efe('0x2e')](_0x5a1b49,function(_0xb67159){if(_0xb67159[_0x9efe('0x3a')]!=='VIRTUAL'){var _0x239104={};_0x239104[_0xb67159[_0x9efe('0x26')]]={'$like':'%'+_0x4daf5a[_0x9efe('0x2f')][_0x9efe('0x38')]+'%'};return _0x239104;}})});}_0xd63234=_[_0x9efe('0x39')]({},_0xd63234,_0x4daf5a[_0x9efe('0x3b')]);var _0x43ad64={'where':_0xd63234[_0x9efe('0x36')]};return db[_0x9efe('0x29')][_0x9efe('0x1b')](_0x43ad64)['then'](function(_0x2220b2){_0x51f20e[_0x9efe('0x1b')]=_0x2220b2;if(_0x4daf5a[_0x9efe('0x2f')]['includeAll']){_0xd63234['include']=[{'all':!![]}];}return db[_0x9efe('0x29')][_0x9efe('0x3c')](_0xd63234);})[_0x9efe('0x20')](function(_0x441a0a){_0x51f20e[_0x9efe('0x3d')]=_0x441a0a;return _0x51f20e;})[_0x9efe('0x20')](respondWithFilteredResult(_0x149475,_0xd63234))['catch'](handleError(_0x149475,null));};exports[_0x9efe('0x3e')]=function(_0x2e98d6,_0x115276){var _0x1e9989={'raw':!![],'where':{'id':_0x2e98d6[_0x9efe('0x3f')]['id']}},_0x256d55={};_0x256d55[_0x9efe('0x2d')]=_[_0x9efe('0x40')](db[_0x9efe('0x29')][_0x9efe('0x2a')]);_0x256d55[_0x9efe('0x2f')]=_[_0x9efe('0x40')](_0x2e98d6[_0x9efe('0x2f')]);_0x256d55['filters']=_[_0x9efe('0x41')](_0x256d55[_0x9efe('0x2d')],_0x256d55[_0x9efe('0x2f')]);_0x1e9989[_0x9efe('0x31')]=_['intersection'](_0x256d55[_0x9efe('0x2d')],qs['fields'](_0x2e98d6[_0x9efe('0x2f')][_0x9efe('0x32')]));_0x1e9989[_0x9efe('0x31')]=_0x1e9989['attributes'][_0x9efe('0x33')]?_0x1e9989[_0x9efe('0x31')]:_0x256d55[_0x9efe('0x2d')];if(_0x2e98d6['query'][_0x9efe('0x42')]){_0x1e9989[_0x9efe('0x43')]=[{'all':!![]}];}_0x1e9989=_[_0x9efe('0x39')]({},_0x1e9989,_0x2e98d6['options']);return db[_0x9efe('0x29')]['find'](_0x1e9989)[_0x9efe('0x20')](handleEntityNotFound(_0x115276,null))['then'](respondWithResult(_0x115276,null))[_0x9efe('0x44')](handleError(_0x115276,null));};exports[_0x9efe('0x45')]=function(_0x26b299,_0x15293d,_0x40a5d0){return db[_0x9efe('0x29')][_0x9efe('0x46')]({'where':{'id':_0x26b299['params']['id']},'attributes':[_0x9efe('0x26'),_0x9efe('0x47'),_0x9efe('0x48')],'raw':!![]})[_0x9efe('0x20')](handleEntityNotFound(_0x15293d,null))['then'](function(_0x1f06b5){if(_0x1f06b5){if(!fs['existsSync'](path['join'](config[_0x9efe('0x49')],_0x9efe('0x4a'),_0x1f06b5[_0x9efe('0x47')]+'.'+_0x1f06b5[_0x9efe('0x48')]))){throw new db[(_0x9efe('0x4b'))][(_0x9efe('0x4c'))](_0x9efe('0x4d'));}return _0x15293d[_0x9efe('0x45')](path[_0x9efe('0x4e')](config[_0x9efe('0x49')],_0x9efe('0x4a'),util[_0x9efe('0x4f')](_0x9efe('0x50'),_0x1f06b5['save_name'],_0x1f06b5[_0x9efe('0x48')])),util[_0x9efe('0x4f')](_0x9efe('0x50'),_0x1f06b5[_0x9efe('0x26')],_0x1f06b5['converted_format']));}return null;})[_0x9efe('0x44')](handleError(_0x15293d,null));};exports['create']=function(_0x223eaa,_0x2ac20d,_0x36b1b6){var _0x4bb40a={'name':path[_0x9efe('0x51')](_0x223eaa[_0x9efe('0x52')][_0x9efe('0x53')],path[_0x9efe('0x54')](_0x223eaa[_0x9efe('0x52')][_0x9efe('0x53')])),'save_name':path[_0x9efe('0x51')](_0x223eaa[_0x9efe('0x52')][_0x9efe('0x55')],path[_0x9efe('0x54')](_0x223eaa[_0x9efe('0x52')][_0x9efe('0x55')])),'original_format':path[_0x9efe('0x54')](_0x223eaa['file'][_0x9efe('0x53')])[_0x9efe('0x56')](0x1),'converted_format':_0x9efe('0x57')};var _0x30693c=path[_0x9efe('0x4e')](config[_0x9efe('0x49')],_0x9efe('0x58'),_0x223eaa[_0x9efe('0x52')][_0x9efe('0x55')]);var _0xa47af3=path[_0x9efe('0x4e')](config[_0x9efe('0x49')],'server/files/sounds/converted',util['format']('%s.%s',path[_0x9efe('0x51')](_0x223eaa[_0x9efe('0x52')]['filename'],path[_0x9efe('0x54')](_0x223eaa['file'][_0x9efe('0x55')])),_0x4bb40a[_0x9efe('0x48')]));logger[_0x9efe('0x59')](_0x9efe('0x5a'),_0x30693c);logger[_0x9efe('0x59')]('Sound\x20upload\x20destination:\x20%s',_0xa47af3);try{fs[_0x9efe('0x5b')](_0x30693c,parseInt('0777',0x8));var _0x30555f=sox['transcode'](_0x30693c,_0xa47af3,{'sampleRate':0x1f40,'format':_0x9efe('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x30555f['on'](_0x9efe('0x25'),function(_0x5724f0){fs[_0x9efe('0x5c')](_0x30693c);_0x2ac20d[_0x9efe('0x15')](0x1f4)[_0x9efe('0x27')](_0x5724f0);});_0x30555f['on'](_0x9efe('0x5d'),function(_0x5ad2d2){_0x4bb40a[_0x9efe('0x5e')]=isNaN(_0x5ad2d2[_0x9efe('0x5f')])?null:_0x5ad2d2[_0x9efe('0x5f')]*0x3e8;_0x4bb40a[_0x9efe('0x60')]=isNaN(_0x5ad2d2[_0x9efe('0x61')])?null:_0x5ad2d2['sampleCount'];_0x4bb40a[_0x9efe('0x62')]=isNaN(_0x5ad2d2[_0x9efe('0x63')])?null:_0x5ad2d2[_0x9efe('0x63')];_0x4bb40a[_0x9efe('0x64')]=isNaN(_0x5ad2d2[_0x9efe('0x65')])?null:_0x5ad2d2['bitRate'];_0x4bb40a[_0x9efe('0x66')]=isNaN(_0x5ad2d2[_0x9efe('0x67')])?null:_0x5ad2d2['sampleRate'];});_0x30555f['on'](_0x9efe('0x68'),function(_0x48537e){_0x4bb40a[_0x9efe('0x69')]=isNaN(_0x48537e['duration'])?null:_0x48537e[_0x9efe('0x5f')]*0x3e8;_0x4bb40a[_0x9efe('0x6a')]=isNaN(_0x48537e['sampleCount'])?null:_0x48537e[_0x9efe('0x61')];_0x4bb40a['converted_channelCount']=isNaN(_0x48537e[_0x9efe('0x63')])?null:_0x48537e[_0x9efe('0x63')];_0x4bb40a[_0x9efe('0x6b')]=isNaN(_0x48537e[_0x9efe('0x65')])?null:_0x48537e[_0x9efe('0x65')];_0x4bb40a[_0x9efe('0x6c')]=isNaN(_0x48537e[_0x9efe('0x67')])?null:_0x48537e[_0x9efe('0x67')];});_0x30555f['on']('end',function(){fs[_0x9efe('0x5b')](_0xa47af3,parseInt('0777',0x8));return db[_0x9efe('0x29')]['create'](_0x4bb40a)['then'](function(_0x4b0084){var _0x1949dd={'role':_0x223eaa[_0x9efe('0x6d')]['role'],'userProfileId':_0x223eaa[_0x9efe('0x6d')]['userProfileId']};if(!_0x1949dd)throw new Error(_0x9efe('0x6e'));if(_0x1949dd['role']==='user'){var _0x576b6c=_0x4b0084[_0x9efe('0x22')]({'plain':!![]});return db['UserProfileSection'][_0x9efe('0x46')]({'where':{'name':_0x9efe('0x23'),'userProfileId':_0x1949dd[_0x9efe('0x6f')]},'raw':!![]})[_0x9efe('0x20')](function(_0xf08bb1){if(_0xf08bb1&&_0xf08bb1[_0x9efe('0x70')]===0x0){return db[_0x9efe('0x24')][_0x9efe('0x71')]({'name':_0x576b6c['name'],'resourceId':_0x576b6c['id'],'type':_0xf08bb1['name'],'sectionId':_0xf08bb1['id']},{})['then'](function(){return _0x4b0084;});}else{return _0x4b0084;}})['catch'](function(_0x351b4c){logger['error'](_0x9efe('0x72'),_0x351b4c);throw _0x351b4c;});}return _0x4b0084;})['then'](respondWithResult(_0x2ac20d,null))['catch'](handleError(_0x2ac20d,null));});_0x30555f[_0x9efe('0x73')]();}catch(_0xe604){_0x2ac20d[_0x9efe('0x15')](0x1f4)[_0x9efe('0x27')](_0xe604);}};exports[_0x9efe('0x74')]=function(_0x131038,_0x1ac716,_0x42ed25){return db[_0x9efe('0x29')]['find']({'where':{'id':_0x131038[_0x9efe('0x3f')]['id']}})[_0x9efe('0x20')](handleEntityNotFound(_0x1ac716,null))[_0x9efe('0x20')](saveUpdates(_[_0x9efe('0x37')](_0x131038[_0x9efe('0x6d')],[_0x9efe('0x26'),'description']),null))[_0x9efe('0x20')](respondWithResult(_0x1ac716,null))[_0x9efe('0x44')](handleError(_0x1ac716,null));};exports[_0x9efe('0x75')]=function(_0x1ec485,_0x9b26e1,_0x2d7dd4){return db[_0x9efe('0x29')][_0x9efe('0x46')]({'where':{'id':_0x1ec485[_0x9efe('0x3f')]['id']}})[_0x9efe('0x20')](function(_0x1a576e){if(_0x1a576e){return _0x1a576e['destroy']();}})[_0x9efe('0x20')](function(_0x32619b){var _0x55854d=path[_0x9efe('0x4e')](config[_0x9efe('0x49')],'server/files/sounds/original',util[_0x9efe('0x4f')]('%s.%s',_0x32619b[_0x9efe('0x47')],_0x32619b['original_format']));var _0x89b6af=path[_0x9efe('0x4e')](config[_0x9efe('0x49')],_0x9efe('0x4a'),util['format'](_0x9efe('0x50'),_0x32619b[_0x9efe('0x47')],_0x32619b[_0x9efe('0x48')]));fs['unlinkSync'](_0x55854d);fs['unlinkSync'](_0x89b6af);return _0x32619b;})[_0x9efe('0x20')](function(_0x78f337){if(_0x78f337){return _0x9b26e1[_0x9efe('0x15')](0xcc)[_0x9efe('0x16')]();}})['then'](handleEntityNotFound(_0x9b26e1,null))[_0x9efe('0x44')](handleError(_0x9b26e1,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index ca78b2a..2e76026 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 _0x5fd3=['./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x3e5661,_0x1298cf){var _0xd97ed=function(_0x2161cf){while(--_0x2161cf){_0x3e5661['push'](_0x3e5661['shift']());}};_0xd97ed(++_0x1298cf);}(_0x5fd3,0x191));var _0x35fd=function(_0x12fff8,_0x16a13a){_0x12fff8=_0x12fff8-0x0;var _0x122703=_0x5fd3[_0x12fff8];return _0x122703;};'use strict';var _=require('lodash');var util=require(_0x35fd('0x0'));var logger=require(_0x35fd('0x1'))(_0x35fd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x35fd('0x3'));var fs=require('fs');var path=require(_0x35fd('0x4'));var rimraf=require(_0x35fd('0x5'));var config=require('../../config/environment');var attributes=require(_0x35fd('0x6'));module[_0x35fd('0x7')]=function(_0x3fb530,_0x4f3995){return _0x3fb530[_0x35fd('0x8')](_0x35fd('0x9'),attributes,{'tableName':_0x35fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x572c=['bluebird','request-promise','path','rimraf','./sound.attributes','define','tools_sounds','lodash','util','../../config/logger','api'];(function(_0x31ef7b,_0x3296ab){var _0x4acf4d=function(_0x4fe478){while(--_0x4fe478){_0x31ef7b['push'](_0x31ef7b['shift']());}};_0x4acf4d(++_0x3296ab);}(_0x572c,0xc2));var _0xc572=function(_0xc14e80,_0x12408a){_0xc14e80=_0xc14e80-0x0;var _0x30c3c4=_0x572c[_0xc14e80];return _0x30c3c4;};'use strict';var _=require(_0xc572('0x0'));var util=require(_0xc572('0x1'));var logger=require(_0xc572('0x2'))(_0xc572('0x3'));var moment=require('moment');var BPromise=require(_0xc572('0x4'));var rp=require(_0xc572('0x5'));var fs=require('fs');var path=require(_0xc572('0x6'));var rimraf=require(_0xc572('0x7'));var config=require('../../config/environment');var attributes=require(_0xc572('0x8'));module['exports']=function(_0x289174,_0x1f6c02){return _0x289174[_0xc572('0x9')]('Sound',attributes,{'tableName':_0xc572('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 00e4ec1..3faeda8 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 _0xc9fc=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Sound,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','ShowSound','Sound','find','options','raw','where','include','map','model','attributes','info','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3ed070,_0x107a02){var _0x40a997=function(_0xc1be3a){while(--_0xc1be3a){_0x3ed070['push'](_0x3ed070['shift']());}};_0x40a997(++_0x107a02);}(_0xc9fc,0x1bb));var _0xcc9f=function(_0x3517dc,_0x47b8cb){_0x3517dc=_0x3517dc-0x0;var _0x1949f6=_0xc9fc[_0x3517dc];return _0x1949f6;};'use strict';var _=require(_0xcc9f('0x0'));var util=require('util');var moment=require(_0xcc9f('0x1'));var BPromise=require(_0xcc9f('0x2'));var rs=require(_0xcc9f('0x3'));var fs=require('fs');var Redis=require(_0xcc9f('0x4'));var db=require(_0xcc9f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc9f('0x6'))(_0xcc9f('0x7'));var config=require(_0xcc9f('0x8'));var jayson=require(_0xcc9f('0x9'));var client=jayson[_0xcc9f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2855cd,_0x2b353a,_0x2a69fc){return new BPromise(function(_0x1e10d1,_0xd3796f){return client[_0xcc9f('0xb')](_0x2855cd,_0x2a69fc)[_0xcc9f('0xc')](function(_0x41835b){logger['info'](_0xcc9f('0xd'),_0x2b353a,'request\x20sent');logger[_0xcc9f('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x2b353a,'request\x20sent',JSON[_0xcc9f('0xf')](_0x41835b));if(_0x41835b[_0xcc9f('0x10')]){if(_0x41835b['error'][_0xcc9f('0x11')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x2b353a,_0x41835b[_0xcc9f('0x10')][_0xcc9f('0x12')]);return _0xd3796f(_0x41835b[_0xcc9f('0x10')][_0xcc9f('0x12')]);}logger[_0xcc9f('0x10')](_0xcc9f('0xd'),_0x2b353a,_0x41835b[_0xcc9f('0x10')]['message']);return _0x1e10d1(_0x41835b[_0xcc9f('0x10')]['message']);}else{logger['info'](_0xcc9f('0xd'),_0x2b353a,_0xcc9f('0x13'));_0x1e10d1(_0x41835b['result']['message']);}})['catch'](function(_0x579891){logger[_0xcc9f('0x10')](_0xcc9f('0xd'),_0x2b353a,_0x579891);_0xd3796f(_0x579891);});});}exports[_0xcc9f('0x14')]=function(_0x289b14){var _0x51134a=this;return new Promise(function(_0x26d666,_0x22c829){return db[_0xcc9f('0x15')][_0xcc9f('0x16')]({'raw':_0x289b14[_0xcc9f('0x17')]?_0x289b14['options'][_0xcc9f('0x18')]===undefined?!![]:![]:!![],'where':_0x289b14['options']?_0x289b14[_0xcc9f('0x17')][_0xcc9f('0x19')]||null:null,'attributes':_0x289b14['options']?_0x289b14[_0xcc9f('0x17')]['attributes']||null:null,'include':_0x289b14['options']?_0x289b14[_0xcc9f('0x17')][_0xcc9f('0x1a')]?_[_0xcc9f('0x1b')](_0x289b14['options'][_0xcc9f('0x1a')],function(_0x385578){return{'model':db[_0x385578[_0xcc9f('0x1c')]],'as':_0x385578['as'],'attributes':_0x385578[_0xcc9f('0x1d')],'include':_0x385578['include']?_[_0xcc9f('0x1b')](_0x385578['include'],function(_0x101d91){return{'model':db[_0x101d91[_0xcc9f('0x1c')]],'as':_0x101d91['as'],'attributes':_0x101d91[_0xcc9f('0x1d')],'include':_0x101d91[_0xcc9f('0x1a')]?_['map'](_0x101d91[_0xcc9f('0x1a')],function(_0x4594fe){return{'model':db[_0x4594fe[_0xcc9f('0x1c')]],'as':_0x4594fe['as'],'attributes':_0x4594fe[_0xcc9f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcc9f('0xc')](function(_0x27b88c){logger[_0xcc9f('0x1e')](_0xcc9f('0x14'),_0x289b14);logger[_0xcc9f('0xe')](_0xcc9f('0x14'),_0x289b14,JSON['stringify'](_0x27b88c));_0x26d666(_0x27b88c);})[_0xcc9f('0x1f')](function(_0x2210e5){logger['error'](_0xcc9f('0x14'),_0x2210e5[_0xcc9f('0x12')],_0x289b14);_0x22c829(_0x51134a[_0xcc9f('0x10')](0x1f4,_0x2210e5[_0xcc9f('0x12')]));});});}; \ No newline at end of file +var _0xeb25=['result','catch','Sound','find','options','raw','attributes','include','model','map','ShowSound','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message'];(function(_0x3f6d14,_0x3b66e3){var _0xa2678d=function(_0x2a2728){while(--_0x2a2728){_0x3f6d14['push'](_0x3f6d14['shift']());}};_0xa2678d(++_0x3b66e3);}(_0xeb25,0x17f));var _0x5eb2=function(_0x3325c8,_0x5701c2){_0x3325c8=_0x3325c8-0x0;var _0x3526f9=_0xeb25[_0x3325c8];return _0x3526f9;};'use strict';var _=require('lodash');var util=require(_0x5eb2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5eb2('0x1'));var db=require(_0x5eb2('0x2'))['db'];var utils=require(_0x5eb2('0x3'));var logger=require('../../config/logger')(_0x5eb2('0x4'));var config=require(_0x5eb2('0x5'));var jayson=require(_0x5eb2('0x6'));var client=jayson[_0x5eb2('0x7')][_0x5eb2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50f652,_0x52aa1f,_0x591621){return new BPromise(function(_0x242d0a,_0x47dda5){return client[_0x5eb2('0x9')](_0x50f652,_0x591621)[_0x5eb2('0xa')](function(_0x46c177){logger[_0x5eb2('0xb')]('Sound,\x20%s,\x20%s',_0x52aa1f,_0x5eb2('0xc'));logger[_0x5eb2('0xd')](_0x5eb2('0xe'),_0x52aa1f,_0x5eb2('0xc'),JSON[_0x5eb2('0xf')](_0x46c177));if(_0x46c177['error']){if(_0x46c177[_0x5eb2('0x10')][_0x5eb2('0x11')]===0x1f4){logger[_0x5eb2('0x10')](_0x5eb2('0x12'),_0x52aa1f,_0x46c177[_0x5eb2('0x10')][_0x5eb2('0x13')]);return _0x47dda5(_0x46c177[_0x5eb2('0x10')][_0x5eb2('0x13')]);}logger[_0x5eb2('0x10')](_0x5eb2('0x12'),_0x52aa1f,_0x46c177['error'][_0x5eb2('0x13')]);return _0x242d0a(_0x46c177['error'][_0x5eb2('0x13')]);}else{logger[_0x5eb2('0xb')](_0x5eb2('0x12'),_0x52aa1f,_0x5eb2('0xc'));_0x242d0a(_0x46c177[_0x5eb2('0x14')][_0x5eb2('0x13')]);}})[_0x5eb2('0x15')](function(_0x41eb73){logger[_0x5eb2('0x10')](_0x5eb2('0x12'),_0x52aa1f,_0x41eb73);_0x47dda5(_0x41eb73);});});}exports['ShowSound']=function(_0x5a71bd){var _0x1eb2fa=this;return new Promise(function(_0x5e161d,_0x4ded88){return db[_0x5eb2('0x16')][_0x5eb2('0x17')]({'raw':_0x5a71bd[_0x5eb2('0x18')]?_0x5a71bd['options'][_0x5eb2('0x19')]===undefined?!![]:![]:!![],'where':_0x5a71bd[_0x5eb2('0x18')]?_0x5a71bd[_0x5eb2('0x18')]['where']||null:null,'attributes':_0x5a71bd[_0x5eb2('0x18')]?_0x5a71bd[_0x5eb2('0x18')][_0x5eb2('0x1a')]||null:null,'include':_0x5a71bd[_0x5eb2('0x18')]?_0x5a71bd[_0x5eb2('0x18')][_0x5eb2('0x1b')]?_['map'](_0x5a71bd[_0x5eb2('0x18')]['include'],function(_0x35dced){return{'model':db[_0x35dced[_0x5eb2('0x1c')]],'as':_0x35dced['as'],'attributes':_0x35dced[_0x5eb2('0x1a')],'include':_0x35dced[_0x5eb2('0x1b')]?_['map'](_0x35dced[_0x5eb2('0x1b')],function(_0xcfbb03){return{'model':db[_0xcfbb03['model']],'as':_0xcfbb03['as'],'attributes':_0xcfbb03[_0x5eb2('0x1a')],'include':_0xcfbb03[_0x5eb2('0x1b')]?_[_0x5eb2('0x1d')](_0xcfbb03['include'],function(_0x3578b9){return{'model':db[_0x3578b9[_0x5eb2('0x1c')]],'as':_0x3578b9['as'],'attributes':_0x3578b9[_0x5eb2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5eb2('0xa')](function(_0x5a7a5d){logger[_0x5eb2('0xb')](_0x5eb2('0x1e'),_0x5a71bd);logger['debug'](_0x5eb2('0x1e'),_0x5a71bd,JSON[_0x5eb2('0xf')](_0x5a7a5d));_0x5e161d(_0x5a7a5d);})[_0x5eb2('0x15')](function(_0xb2dfe){logger[_0x5eb2('0x10')](_0x5eb2('0x1e'),_0xb2dfe['message'],_0x5a71bd);_0x4ded88(_0x1eb2fa[_0x5eb2('0x10')](0x1f4,_0xb2dfe[_0x5eb2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 1de32eb..fad199a 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 _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb6bddf,_0x2372c3){var _0x1a7749=function(_0x3e020e){while(--_0x3e020e){_0xb6bddf['push'](_0xb6bddf['shift']());}};_0x1a7749(++_0x2372c3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x486008,_0x2b2d05){_0x486008=_0x486008-0x0;var _0x2fefc7=_0x0b0e[_0x486008];return _0x2fefc7;};'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('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x107a92,_0x4fbfc0){var _0x54a267=function(_0x2cdc3d){while(--_0x2cdc3d){_0x107a92['push'](_0x107a92['shift']());}};_0x54a267(++_0x4fbfc0);}(_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('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 905a06a..5cf58cc 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 _0x67ec=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x225083,_0x530396){var _0x1e2ed6=function(_0x2474f4){while(--_0x2474f4){_0x225083['push'](_0x225083['shift']());}};_0x1e2ed6(++_0x530396);}(_0x67ec,0x11c));var _0xc67e=function(_0x532da0,_0x274e0a){_0x532da0=_0x532da0-0x0;var _0x2e4930=_0x67ec[_0x532da0];return _0x2e4930;};'use strict';var Sequelize=require(_0xc67e('0x0'));module[_0xc67e('0x1')]={'uniqueid':{'type':Sequelize[_0xc67e('0x2')]},'body':{'type':Sequelize[_0xc67e('0x3')](_0xc67e('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xc67e('0x5')]('in',_0xc67e('0x6')),'defaultValue':_0xc67e('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc67e('0x3')]}}; \ No newline at end of file +var _0x4409=['TEXT','sequelize','exports','STRING','ENUM','out'];(function(_0x45d48a,_0xc2538f){var _0x93e5d0=function(_0x2524f6){while(--_0x2524f6){_0x45d48a['push'](_0x45d48a['shift']());}};_0x93e5d0(++_0xc2538f);}(_0x4409,0x1c3));var _0x9440=function(_0xf8ff1c,_0x19a16){_0xf8ff1c=_0xf8ff1c-0x0;var _0x4a4b56=_0x4409[_0xf8ff1c];return _0x4a4b56;};'use strict';var Sequelize=require(_0x9440('0x0'));module[_0x9440('0x1')]={'uniqueid':{'type':Sequelize[_0x9440('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x9440('0x3')]('in',_0x9440('0x4')),'defaultValue':_0x9440('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x9440('0x2')]},'providerResponse':{'type':Sequelize[_0x9440('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index ebb6796..49fae1b 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 _0xa833=['query','keys','filters','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','name','merge','options','includeAll','include','catch','show','params','intersection','length','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','index','map','SquareMessage','rawAttributes','fieldName','type','model'];(function(_0x5060d1,_0x50d698){var _0x4bf964=function(_0x481a13){while(--_0x481a13){_0x5060d1['push'](_0x5060d1['shift']());}};_0x4bf964(++_0x50d698);}(_0xa833,0x139));var _0x3a83=function(_0x25e079,_0x539734){_0x25e079=_0x25e079-0x0;var _0x4be00e=_0xa833[_0x25e079];return _0x4be00e;};'use strict';var emlformat=require(_0x3a83('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3a83('0x1'));var rp=require(_0x3a83('0x2'));var moment=require(_0x3a83('0x3'));var BPromise=require(_0x3a83('0x4'));var Mustache=require(_0x3a83('0x5'));var util=require('util');var path=require(_0x3a83('0x6'));var sox=require('sox');var csv=require(_0x3a83('0x7'));var ejs=require(_0x3a83('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3a83('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x3a83('0xa'));var toCsv=require(_0x3a83('0x7'));var querystring=require(_0x3a83('0xb'));var Papa=require(_0x3a83('0xc'));var Redis=require(_0x3a83('0xd'));var authService=require(_0x3a83('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3a83('0xf'));var hardwareService=require(_0x3a83('0x10'));var logger=require(_0x3a83('0x11'))(_0x3a83('0x12'));var utils=require(_0x3a83('0x13'));var config=require(_0x3a83('0x14'));var licenseUtil=require(_0x3a83('0x15'));var db=require(_0x3a83('0x16'))['db'];function respondWithStatusCode(_0x35db6a,_0x360f1f){_0x360f1f=_0x360f1f||0xcc;return function(_0x49f752){if(_0x49f752){return _0x35db6a[_0x3a83('0x17')](_0x360f1f);}return _0x35db6a[_0x3a83('0x18')](_0x360f1f)[_0x3a83('0x19')]();};}function respondWithResult(_0x56c5aa,_0x2690af){_0x2690af=_0x2690af||0xc8;return function(_0x29f7b6){if(_0x29f7b6){return _0x56c5aa[_0x3a83('0x18')](_0x2690af)[_0x3a83('0x1a')](_0x29f7b6);}};}function respondWithFilteredResult(_0x557729,_0x39ebd1){return function(_0x1be7fa){if(_0x1be7fa){var _0x332fd8=typeof _0x39ebd1[_0x3a83('0x1b')]===_0x3a83('0x1c')&&typeof _0x39ebd1[_0x3a83('0x1d')]===_0x3a83('0x1c');var _0x534002=_0x1be7fa[_0x3a83('0x1e')];var _0x5ad54a=_0x332fd8?0x0:_0x39ebd1['offset'];var _0x3d7bdb=_0x332fd8?_0x1be7fa[_0x3a83('0x1e')]:_0x39ebd1[_0x3a83('0x1b')]+_0x39ebd1['limit'];var _0x2c21b1;if(_0x3d7bdb>=_0x534002){_0x3d7bdb=_0x534002;_0x2c21b1=0xc8;}else{_0x2c21b1=0xce;}_0x557729[_0x3a83('0x18')](_0x2c21b1);return _0x557729[_0x3a83('0x1f')](_0x3a83('0x20'),_0x5ad54a+'-'+_0x3d7bdb+'/'+_0x534002)[_0x3a83('0x1a')](_0x1be7fa);}return null;};}function patchUpdates(_0x5b1bd5){return function(_0x4b06ae){try{jsonpatch[_0x3a83('0x21')](_0x4b06ae,_0x5b1bd5,!![]);}catch(_0x1646bd){return BPromise[_0x3a83('0x22')](_0x1646bd);}return _0x4b06ae[_0x3a83('0x23')]();};}function saveUpdates(_0x2d9939,_0x50485d){return function(_0x23d0e2){if(_0x23d0e2){return _0x23d0e2[_0x3a83('0x24')](_0x2d9939)[_0x3a83('0x25')](function(_0x9733e7){return _0x9733e7;});}return null;};}function removeEntity(_0x527a3d,_0x325cab){return function(_0x487b22){if(_0x487b22){return _0x487b22[_0x3a83('0x26')]()[_0x3a83('0x25')](function(){_0x527a3d[_0x3a83('0x18')](0xcc)[_0x3a83('0x19')]();});}};}function handleEntityNotFound(_0x3379aa,_0x58dd46){return function(_0x608648){if(!_0x608648){_0x3379aa[_0x3a83('0x17')](0x194);}return _0x608648;};}function handleError(_0x2098c6,_0x50a597){_0x50a597=_0x50a597||0x1f4;return function(_0x5d1110){logger[_0x3a83('0x27')](_0x5d1110['stack']);if(_0x5d1110['name']){delete _0x5d1110['name'];}_0x2098c6['status'](_0x50a597)['send'](_0x5d1110);};}exports[_0x3a83('0x28')]=function(_0x18c2a2,_0xa968e9){var _0x4daf2a={},_0x375031={},_0x15e968={'count':0x0,'rows':[]};var _0x190db9=_[_0x3a83('0x29')](db[_0x3a83('0x2a')][_0x3a83('0x2b')],function(_0x19fa0a){return{'name':_0x19fa0a[_0x3a83('0x2c')],'type':_0x19fa0a[_0x3a83('0x2d')]['key']};});_0x375031[_0x3a83('0x2e')]=_[_0x3a83('0x29')](_0x190db9,'name');_0x375031[_0x3a83('0x2f')]=_[_0x3a83('0x30')](_0x18c2a2[_0x3a83('0x2f')]);_0x375031[_0x3a83('0x31')]=_['intersection'](_0x375031['model'],_0x375031[_0x3a83('0x2f')]);_0x4daf2a['attributes']=_['intersection'](_0x375031[_0x3a83('0x2e')],qs[_0x3a83('0x32')](_0x18c2a2[_0x3a83('0x2f')][_0x3a83('0x32')]));_0x4daf2a['attributes']=_0x4daf2a[_0x3a83('0x33')]['length']?_0x4daf2a[_0x3a83('0x33')]:_0x375031[_0x3a83('0x2e')];if(!_0x18c2a2['query'][_0x3a83('0x34')]('nolimit')){_0x4daf2a['limit']=qs[_0x3a83('0x1d')](_0x18c2a2[_0x3a83('0x2f')]['limit']);_0x4daf2a[_0x3a83('0x1b')]=qs[_0x3a83('0x1b')](_0x18c2a2['query']['offset']);}_0x4daf2a[_0x3a83('0x35')]=qs[_0x3a83('0x36')](_0x18c2a2[_0x3a83('0x2f')]['sort']);_0x4daf2a[_0x3a83('0x37')]=qs[_0x3a83('0x31')](_[_0x3a83('0x38')](_0x18c2a2[_0x3a83('0x2f')],_0x375031['filters']),_0x190db9);if(_0x18c2a2[_0x3a83('0x2f')][_0x3a83('0x39')]){_0x4daf2a[_0x3a83('0x37')]=_['merge'](_0x4daf2a[_0x3a83('0x37')],{'$or':_['map'](_0x190db9,function(_0xd0e730){if(_0xd0e730['type']!==_0x3a83('0x3a')){var _0xb0c42f={};_0xb0c42f[_0xd0e730[_0x3a83('0x3b')]]={'$like':'%'+_0x18c2a2[_0x3a83('0x2f')][_0x3a83('0x39')]+'%'};return _0xb0c42f;}})});}_0x4daf2a=_[_0x3a83('0x3c')]({},_0x4daf2a,_0x18c2a2[_0x3a83('0x3d')]);var _0x406eee={'where':_0x4daf2a['where']};return db[_0x3a83('0x2a')]['count'](_0x406eee)[_0x3a83('0x25')](function(_0x1b3172){_0x15e968['count']=_0x1b3172;if(_0x18c2a2['query'][_0x3a83('0x3e')]){_0x4daf2a[_0x3a83('0x3f')]=[{'all':!![]}];}return db[_0x3a83('0x2a')]['findAll'](_0x4daf2a);})[_0x3a83('0x25')](function(_0xff922d){_0x15e968['rows']=_0xff922d;return _0x15e968;})[_0x3a83('0x25')](respondWithFilteredResult(_0xa968e9,_0x4daf2a))[_0x3a83('0x40')](handleError(_0xa968e9,null));};exports[_0x3a83('0x41')]=function(_0x205a42,_0x2acccd){var _0x34dab4={'raw':!![],'where':{'id':_0x205a42[_0x3a83('0x42')]['id']}},_0x4226a5={};_0x4226a5[_0x3a83('0x2e')]=_[_0x3a83('0x30')](db[_0x3a83('0x2a')][_0x3a83('0x2b')]);_0x4226a5[_0x3a83('0x2f')]=_['keys'](_0x205a42['query']);_0x4226a5['filters']=_[_0x3a83('0x43')](_0x4226a5[_0x3a83('0x2e')],_0x4226a5['query']);_0x34dab4['attributes']=_[_0x3a83('0x43')](_0x4226a5[_0x3a83('0x2e')],qs[_0x3a83('0x32')](_0x205a42[_0x3a83('0x2f')]['fields']));_0x34dab4[_0x3a83('0x33')]=_0x34dab4[_0x3a83('0x33')][_0x3a83('0x44')]?_0x34dab4[_0x3a83('0x33')]:_0x4226a5[_0x3a83('0x2e')];if(_0x205a42[_0x3a83('0x2f')][_0x3a83('0x3e')]){_0x34dab4[_0x3a83('0x3f')]=[{'all':!![]}];}_0x34dab4=_[_0x3a83('0x3c')]({},_0x34dab4,_0x205a42[_0x3a83('0x3d')]);return db[_0x3a83('0x2a')][_0x3a83('0x45')](_0x34dab4)[_0x3a83('0x25')](handleEntityNotFound(_0x2acccd,null))['then'](respondWithResult(_0x2acccd,null))[_0x3a83('0x40')](handleError(_0x2acccd,null));};exports[_0x3a83('0x46')]=function(_0x664007,_0x5d7403){return db[_0x3a83('0x2a')][_0x3a83('0x46')](_0x664007[_0x3a83('0x47')],{})['then'](respondWithResult(_0x5d7403,0xc9))[_0x3a83('0x40')](handleError(_0x5d7403,null));};exports['update']=function(_0x4e1a15,_0x1b5369){if(_0x4e1a15[_0x3a83('0x47')]['id']){delete _0x4e1a15[_0x3a83('0x47')]['id'];}return db[_0x3a83('0x2a')][_0x3a83('0x45')]({'where':{'id':_0x4e1a15[_0x3a83('0x42')]['id']}})['then'](handleEntityNotFound(_0x1b5369,null))[_0x3a83('0x25')](saveUpdates(_0x4e1a15[_0x3a83('0x47')],null))[_0x3a83('0x25')](respondWithResult(_0x1b5369,null))[_0x3a83('0x40')](handleError(_0x1b5369,null));};exports[_0x3a83('0x26')]=function(_0x1de746,_0x11dd61){return db['SquareMessage'][_0x3a83('0x45')]({'where':{'id':_0x1de746[_0x3a83('0x42')]['id']}})[_0x3a83('0x25')](handleEntityNotFound(_0x11dd61,null))[_0x3a83('0x25')](removeEntity(_0x11dd61,null))[_0x3a83('0x40')](handleError(_0x11dd61,null));}; \ No newline at end of file +var _0x6d0c=['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','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','fs-extra','lodash'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x46596a,_0x2a464e){_0x46596a=_0x46596a-0x0;var _0x17b8a6=_0x6d0c[_0x46596a];return _0x17b8a6;};'use strict';var emlformat=require(_0xc6d0('0x0'));var rimraf=require(_0xc6d0('0x1'));var zipdir=require(_0xc6d0('0x2'));var jsonpatch=require(_0xc6d0('0x3'));var rp=require(_0xc6d0('0x4'));var moment=require(_0xc6d0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc6d0('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc6d0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6d0('0x8'));var _=require(_0xc6d0('0x9'));var squel=require(_0xc6d0('0xa'));var crypto=require(_0xc6d0('0xb'));var jsforce=require(_0xc6d0('0xc'));var deskjs=require(_0xc6d0('0xd'));var toCsv=require(_0xc6d0('0xe'));var querystring=require(_0xc6d0('0xf'));var Papa=require(_0xc6d0('0x10'));var Redis=require(_0xc6d0('0x11'));var authService=require(_0xc6d0('0x12'));var qs=require(_0xc6d0('0x13'));var as=require(_0xc6d0('0x14'));var hardwareService=require(_0xc6d0('0x15'));var logger=require(_0xc6d0('0x16'))(_0xc6d0('0x17'));var utils=require(_0xc6d0('0x18'));var config=require(_0xc6d0('0x19'));var licenseUtil=require(_0xc6d0('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x562ae9,_0x170c38){_0x170c38=_0x170c38||0xcc;return function(_0x3b3a05){if(_0x3b3a05){return _0x562ae9['sendStatus'](_0x170c38);}return _0x562ae9[_0xc6d0('0x1b')](_0x170c38)[_0xc6d0('0x1c')]();};}function respondWithResult(_0x16170e,_0x58393c){_0x58393c=_0x58393c||0xc8;return function(_0x5c4521){if(_0x5c4521){return _0x16170e[_0xc6d0('0x1b')](_0x58393c)[_0xc6d0('0x1d')](_0x5c4521);}};}function respondWithFilteredResult(_0x17afb5,_0x501260){return function(_0x2e1ba2){if(_0x2e1ba2){var _0x49ef8e=typeof _0x501260[_0xc6d0('0x1e')]===_0xc6d0('0x1f')&&typeof _0x501260[_0xc6d0('0x20')]===_0xc6d0('0x1f');var _0x3acff1=_0x2e1ba2['count'];var _0x4b178c=_0x49ef8e?0x0:_0x501260['offset'];var _0x1fa160=_0x49ef8e?_0x2e1ba2[_0xc6d0('0x21')]:_0x501260[_0xc6d0('0x1e')]+_0x501260['limit'];var _0x278552;if(_0x1fa160>=_0x3acff1){_0x1fa160=_0x3acff1;_0x278552=0xc8;}else{_0x278552=0xce;}_0x17afb5['status'](_0x278552);return _0x17afb5['set'](_0xc6d0('0x22'),_0x4b178c+'-'+_0x1fa160+'/'+_0x3acff1)[_0xc6d0('0x1d')](_0x2e1ba2);}return null;};}function patchUpdates(_0x2121f2){return function(_0x42d2d7){try{jsonpatch[_0xc6d0('0x23')](_0x42d2d7,_0x2121f2,!![]);}catch(_0x7a0604){return BPromise[_0xc6d0('0x24')](_0x7a0604);}return _0x42d2d7[_0xc6d0('0x25')]();};}function saveUpdates(_0x4e88b2,_0x411faa){return function(_0x2fbbd9){if(_0x2fbbd9){return _0x2fbbd9[_0xc6d0('0x26')](_0x4e88b2)[_0xc6d0('0x27')](function(_0x4b48f3){return _0x4b48f3;});}return null;};}function removeEntity(_0x5e7a68,_0x321a97){return function(_0x55b44d){if(_0x55b44d){return _0x55b44d[_0xc6d0('0x28')]()[_0xc6d0('0x27')](function(){_0x5e7a68[_0xc6d0('0x1b')](0xcc)[_0xc6d0('0x1c')]();});}};}function handleEntityNotFound(_0x2cc17e,_0x47182b){return function(_0x420cf4){if(!_0x420cf4){_0x2cc17e[_0xc6d0('0x29')](0x194);}return _0x420cf4;};}function handleError(_0x345c58,_0x1126fa){_0x1126fa=_0x1126fa||0x1f4;return function(_0x2bb7a8){logger['error'](_0x2bb7a8['stack']);if(_0x2bb7a8[_0xc6d0('0x2a')]){delete _0x2bb7a8[_0xc6d0('0x2a')];}_0x345c58[_0xc6d0('0x1b')](_0x1126fa)[_0xc6d0('0x2b')](_0x2bb7a8);};}exports['index']=function(_0xa457fa,_0x4720d7){var _0x1e2a03={},_0x3dcc61={},_0x6d0d94={'count':0x0,'rows':[]};var _0x4b7013=_[_0xc6d0('0x2c')](db[_0xc6d0('0x2d')][_0xc6d0('0x2e')],function(_0x8463ab){return{'name':_0x8463ab[_0xc6d0('0x2f')],'type':_0x8463ab[_0xc6d0('0x30')]['key']};});_0x3dcc61[_0xc6d0('0x31')]=_[_0xc6d0('0x2c')](_0x4b7013,_0xc6d0('0x2a'));_0x3dcc61[_0xc6d0('0x32')]=_[_0xc6d0('0x33')](_0xa457fa['query']);_0x3dcc61['filters']=_[_0xc6d0('0x34')](_0x3dcc61[_0xc6d0('0x31')],_0x3dcc61['query']);_0x1e2a03[_0xc6d0('0x35')]=_[_0xc6d0('0x34')](_0x3dcc61[_0xc6d0('0x31')],qs[_0xc6d0('0x36')](_0xa457fa[_0xc6d0('0x32')][_0xc6d0('0x36')]));_0x1e2a03['attributes']=_0x1e2a03[_0xc6d0('0x35')]['length']?_0x1e2a03['attributes']:_0x3dcc61[_0xc6d0('0x31')];if(!_0xa457fa[_0xc6d0('0x32')][_0xc6d0('0x37')]('nolimit')){_0x1e2a03['limit']=qs[_0xc6d0('0x20')](_0xa457fa[_0xc6d0('0x32')]['limit']);_0x1e2a03['offset']=qs[_0xc6d0('0x1e')](_0xa457fa[_0xc6d0('0x32')]['offset']);}_0x1e2a03[_0xc6d0('0x38')]=qs[_0xc6d0('0x39')](_0xa457fa[_0xc6d0('0x32')]['sort']);_0x1e2a03['where']=qs[_0xc6d0('0x3a')](_[_0xc6d0('0x3b')](_0xa457fa[_0xc6d0('0x32')],_0x3dcc61['filters']),_0x4b7013);if(_0xa457fa['query']['filter']){_0x1e2a03[_0xc6d0('0x3c')]=_[_0xc6d0('0x3d')](_0x1e2a03[_0xc6d0('0x3c')],{'$or':_['map'](_0x4b7013,function(_0x50a30e){if(_0x50a30e[_0xc6d0('0x30')]!==_0xc6d0('0x3e')){var _0xcd19fa={};_0xcd19fa[_0x50a30e['name']]={'$like':'%'+_0xa457fa[_0xc6d0('0x32')][_0xc6d0('0x3f')]+'%'};return _0xcd19fa;}})});}_0x1e2a03=_['merge']({},_0x1e2a03,_0xa457fa[_0xc6d0('0x40')]);var _0x1d812f={'where':_0x1e2a03[_0xc6d0('0x3c')]};return db[_0xc6d0('0x2d')][_0xc6d0('0x21')](_0x1d812f)['then'](function(_0x3718c0){_0x6d0d94[_0xc6d0('0x21')]=_0x3718c0;if(_0xa457fa['query'][_0xc6d0('0x41')]){_0x1e2a03[_0xc6d0('0x42')]=[{'all':!![]}];}return db[_0xc6d0('0x2d')][_0xc6d0('0x43')](_0x1e2a03);})['then'](function(_0x4a3cd8){_0x6d0d94[_0xc6d0('0x44')]=_0x4a3cd8;return _0x6d0d94;})[_0xc6d0('0x27')](respondWithFilteredResult(_0x4720d7,_0x1e2a03))[_0xc6d0('0x45')](handleError(_0x4720d7,null));};exports[_0xc6d0('0x46')]=function(_0x2e7c85,_0x1d4962){var _0x5776bf={'raw':!![],'where':{'id':_0x2e7c85[_0xc6d0('0x47')]['id']}},_0x3c54fc={};_0x3c54fc[_0xc6d0('0x31')]=_[_0xc6d0('0x33')](db['SquareMessage'][_0xc6d0('0x2e')]);_0x3c54fc['query']=_[_0xc6d0('0x33')](_0x2e7c85['query']);_0x3c54fc[_0xc6d0('0x3a')]=_[_0xc6d0('0x34')](_0x3c54fc[_0xc6d0('0x31')],_0x3c54fc[_0xc6d0('0x32')]);_0x5776bf['attributes']=_[_0xc6d0('0x34')](_0x3c54fc['model'],qs[_0xc6d0('0x36')](_0x2e7c85['query'][_0xc6d0('0x36')]));_0x5776bf[_0xc6d0('0x35')]=_0x5776bf[_0xc6d0('0x35')]['length']?_0x5776bf[_0xc6d0('0x35')]:_0x3c54fc[_0xc6d0('0x31')];if(_0x2e7c85[_0xc6d0('0x32')][_0xc6d0('0x41')]){_0x5776bf['include']=[{'all':!![]}];}_0x5776bf=_[_0xc6d0('0x3d')]({},_0x5776bf,_0x2e7c85[_0xc6d0('0x40')]);return db[_0xc6d0('0x2d')][_0xc6d0('0x48')](_0x5776bf)['then'](handleEntityNotFound(_0x1d4962,null))['then'](respondWithResult(_0x1d4962,null))['catch'](handleError(_0x1d4962,null));};exports[_0xc6d0('0x49')]=function(_0x45f786,_0x1f7320){return db['SquareMessage'][_0xc6d0('0x49')](_0x45f786[_0xc6d0('0x4a')],{})[_0xc6d0('0x27')](respondWithResult(_0x1f7320,0xc9))[_0xc6d0('0x45')](handleError(_0x1f7320,null));};exports['update']=function(_0x530472,_0x47ec13){if(_0x530472[_0xc6d0('0x4a')]['id']){delete _0x530472['body']['id'];}return db['SquareMessage'][_0xc6d0('0x48')]({'where':{'id':_0x530472[_0xc6d0('0x47')]['id']}})['then'](handleEntityNotFound(_0x47ec13,null))['then'](saveUpdates(_0x530472['body'],null))['then'](respondWithResult(_0x47ec13,null))[_0xc6d0('0x45')](handleError(_0x47ec13,null));};exports['destroy']=function(_0x234783,_0x212ce8){return db[_0xc6d0('0x2d')][_0xc6d0('0x48')]({'where':{'id':_0x234783['params']['id']}})['then'](handleEntityNotFound(_0x212ce8,null))['then'](removeEntity(_0x212ce8,null))[_0xc6d0('0x45')](handleError(_0x212ce8,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 5b79341..1c05edd 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 _0xc808=['lodash','../../config/logger','moment','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc808,0xc6));var _0x8c80=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0xc808[_0x4687df];return _0x32eaef;};'use strict';var _=require(_0x8c80('0x0'));var util=require('util');var logger=require(_0x8c80('0x1'))('api');var moment=require(_0x8c80('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8c80('0x3'));var config=require(_0x8c80('0x4'));var attributes=require(_0x8c80('0x5'));module[_0x8c80('0x6')]=function(_0x241c7b,_0x322739){return _0x241c7b[_0x8c80('0x7')](_0x8c80('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f22=['util','../../config/logger','api','moment','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash'];(function(_0x17044c,_0x208790){var _0x5e6db0=function(_0x3f5f50){while(--_0x3f5f50){_0x17044c['push'](_0x17044c['shift']());}};_0x5e6db0(++_0x208790);}(_0x2f22,0x154));var _0x22f2=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2f22[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x22f2('0x0'));var util=require(_0x22f2('0x1'));var logger=require(_0x22f2('0x2'))(_0x22f2('0x3'));var moment=require(_0x22f2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x22f2('0x5'));var config=require(_0x22f2('0x6'));var attributes=require(_0x22f2('0x7'));module[_0x22f2('0x8')]=function(_0x47beca,_0x455b3e){return _0x47beca[_0x22f2('0x9')](_0x22f2('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 3eb1c38..5b97851 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 _0x2939=['../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','SquareMessage','create','body','options','raw','CreateSquareMessage','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x563512,_0x413768){var _0x463189=function(_0x554256){while(--_0x554256){_0x563512['push'](_0x563512['shift']());}};_0x463189(++_0x413768);}(_0x2939,0x1f3));var _0x9293=function(_0x4790b3,_0x2a4df5){_0x4790b3=_0x4790b3-0x0;var _0x79ab=_0x2939[_0x4790b3];return _0x79ab;};'use strict';var _=require(_0x9293('0x0'));var util=require(_0x9293('0x1'));var moment=require(_0x9293('0x2'));var BPromise=require('bluebird');var rs=require(_0x9293('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9293('0x4'))['db'];var utils=require(_0x9293('0x5'));var logger=require(_0x9293('0x6'))(_0x9293('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9293('0x8')][_0x9293('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x357608,_0x4a5aa1,_0x5c8534){return new BPromise(function(_0x393adf,_0x446e38){return client[_0x9293('0xa')](_0x357608,_0x5c8534)[_0x9293('0xb')](function(_0x9b85e7){logger[_0x9293('0xc')]('SquareMessage,\x20%s,\x20%s',_0x4a5aa1,_0x9293('0xd'));logger[_0x9293('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4a5aa1,_0x9293('0xd'),JSON[_0x9293('0xf')](_0x9b85e7));if(_0x9b85e7[_0x9293('0x10')]){if(_0x9b85e7['error'][_0x9293('0x11')]===0x1f4){logger[_0x9293('0x10')](_0x9293('0x12'),_0x4a5aa1,_0x9b85e7[_0x9293('0x10')]['message']);return _0x446e38(_0x9b85e7[_0x9293('0x10')]['message']);}logger[_0x9293('0x10')](_0x9293('0x12'),_0x4a5aa1,_0x9b85e7[_0x9293('0x10')][_0x9293('0x13')]);return _0x393adf(_0x9b85e7[_0x9293('0x10')]['message']);}else{logger[_0x9293('0xc')]('SquareMessage,\x20%s,\x20%s',_0x4a5aa1,_0x9293('0xd'));_0x393adf(_0x9b85e7[_0x9293('0x14')][_0x9293('0x13')]);}})[_0x9293('0x15')](function(_0x57a57f){logger[_0x9293('0x10')]('SquareMessage,\x20%s,\x20%s',_0x4a5aa1,_0x57a57f);_0x446e38(_0x57a57f);});});}exports['CreateSquareMessage']=function(_0x5ad73d){var _0x514efa=this;return new Promise(function(_0x96a97,_0x55cc28){return db[_0x9293('0x16')][_0x9293('0x17')](_0x5ad73d[_0x9293('0x18')],{'raw':_0x5ad73d[_0x9293('0x19')]?_0x5ad73d[_0x9293('0x19')][_0x9293('0x1a')]===undefined?!![]:![]:!![]})[_0x9293('0xb')](function(_0x414b62){logger['info'](_0x9293('0x1b'),_0x5ad73d);logger[_0x9293('0xe')](_0x9293('0x1b'),_0x5ad73d,JSON[_0x9293('0xf')](_0x414b62));_0x96a97(_0x414b62);})[_0x9293('0x15')](function(_0x316db7){logger[_0x9293('0x10')](_0x9293('0x1b'),_0x316db7[_0x9293('0x13')],_0x5ad73d);_0x55cc28(_0x514efa[_0x9293('0x10')](0x1f4,_0x316db7[_0x9293('0x13')]));});});}; \ No newline at end of file +var _0xd420=['message','request\x20sent','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','request','then','info','SquareMessage,\x20%s,\x20%s','stringify','error','code'];(function(_0x5b7b7d,_0x5ba437){var _0x5bd495=function(_0x544c24){while(--_0x544c24){_0x5b7b7d['push'](_0x5b7b7d['shift']());}};_0x5bd495(++_0x5ba437);}(_0xd420,0x1b3));var _0x0d42=function(_0x5f3424,_0x1d0938){_0x5f3424=_0x5f3424-0x0;var _0x220804=_0xd420[_0x5f3424];return _0x220804;};'use strict';var _=require(_0x0d42('0x0'));var util=require(_0x0d42('0x1'));var moment=require(_0x0d42('0x2'));var BPromise=require(_0x0d42('0x3'));var rs=require(_0x0d42('0x4'));var fs=require('fs');var Redis=require(_0x0d42('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0d42('0x6'));var config=require(_0x0d42('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f6d07,_0x4adabb,_0x2206ac){return new BPromise(function(_0x41796c,_0x187ab5){return client[_0x0d42('0x8')](_0x2f6d07,_0x2206ac)[_0x0d42('0x9')](function(_0x3d7174){logger[_0x0d42('0xa')](_0x0d42('0xb'),_0x4adabb,'request\x20sent');logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4adabb,'request\x20sent',JSON[_0x0d42('0xc')](_0x3d7174));if(_0x3d7174[_0x0d42('0xd')]){if(_0x3d7174[_0x0d42('0xd')][_0x0d42('0xe')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x4adabb,_0x3d7174[_0x0d42('0xd')][_0x0d42('0xf')]);return _0x187ab5(_0x3d7174[_0x0d42('0xd')][_0x0d42('0xf')]);}logger[_0x0d42('0xd')]('SquareMessage,\x20%s,\x20%s',_0x4adabb,_0x3d7174['error'][_0x0d42('0xf')]);return _0x41796c(_0x3d7174[_0x0d42('0xd')][_0x0d42('0xf')]);}else{logger[_0x0d42('0xa')](_0x0d42('0xb'),_0x4adabb,_0x0d42('0x10'));_0x41796c(_0x3d7174[_0x0d42('0x11')][_0x0d42('0xf')]);}})[_0x0d42('0x12')](function(_0x550df5){logger['error']('SquareMessage,\x20%s,\x20%s',_0x4adabb,_0x550df5);_0x187ab5(_0x550df5);});});}exports[_0x0d42('0x13')]=function(_0x24e1e5){var _0xba7a16=this;return new Promise(function(_0x66fed6,_0x343afc){return db[_0x0d42('0x14')]['create'](_0x24e1e5[_0x0d42('0x15')],{'raw':_0x24e1e5['options']?_0x24e1e5[_0x0d42('0x16')][_0x0d42('0x17')]===undefined?!![]:![]:!![]})[_0x0d42('0x9')](function(_0x31b50f){logger[_0x0d42('0xa')](_0x0d42('0x13'),_0x24e1e5);logger[_0x0d42('0x18')](_0x0d42('0x13'),_0x24e1e5,JSON[_0x0d42('0xc')](_0x31b50f));_0x66fed6(_0x31b50f);})[_0x0d42('0x12')](function(_0x351956){logger[_0x0d42('0xd')](_0x0d42('0x13'),_0x351956[_0x0d42('0xf')],_0x24e1e5);_0x343afc(_0xba7a16[_0x0d42('0xd')](0x1f4,_0x351956['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 781e46c..8332432 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 _0x315b=['isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./squareOdbc.controller','get'];(function(_0x2ba9ac,_0xa1fdc4){var _0x1b0fc9=function(_0x4343de){while(--_0x4343de){_0x2ba9ac['push'](_0x2ba9ac['shift']());}};_0x1b0fc9(++_0xa1fdc4);}(_0x315b,0xdf));var _0xb315=function(_0x57ed36,_0x360d31){_0x57ed36=_0x57ed36-0x0;var _0x4e6ee3=_0x315b[_0x57ed36];return _0x4e6ee3;};'use strict';var multer=require('multer');var util=require(_0xb315('0x0'));var path=require('path');var timeout=require(_0xb315('0x1'));var express=require(_0xb315('0x2'));var router=express[_0xb315('0x3')]();var fs_extra=require(_0xb315('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb315('0x5'));var config=require('../../config/environment');var controller=require(_0xb315('0x6'));router[_0xb315('0x7')]('/',auth[_0xb315('0x8')](),controller[_0xb315('0x9')]);router[_0xb315('0x7')](_0xb315('0xa'),auth['isAuthenticated'](),controller[_0xb315('0xb')]);router[_0xb315('0x7')](_0xb315('0xc'),auth[_0xb315('0x8')](),timeout(_0xb315('0xd')),controller[_0xb315('0xe')]);router[_0xb315('0xf')]('/',auth['isAuthenticated'](),controller[_0xb315('0x10')]);router[_0xb315('0x11')]('/:id',auth[_0xb315('0x8')](),controller[_0xb315('0x12')]);router[_0xb315('0x13')]('/:id',auth[_0xb315('0x8')](),controller['destroy']);module[_0xb315('0x14')]=router; \ No newline at end of file +var _0x8268=['path','connect-timeout','express','fs-extra','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','15s','test','post','create','put','/:id','update','destroy','exports','util'];(function(_0x3b29a8,_0x65bc44){var _0x3e25dd=function(_0x38f7b6){while(--_0x38f7b6){_0x3b29a8['push'](_0x3b29a8['shift']());}};_0x3e25dd(++_0x65bc44);}(_0x8268,0x1b8));var _0x8826=function(_0x61df42,_0x336f9e){_0x61df42=_0x61df42-0x0;var _0x5f26f2=_0x8268[_0x61df42];return _0x5f26f2;};'use strict';var multer=require('multer');var util=require(_0x8826('0x0'));var path=require(_0x8826('0x1'));var timeout=require(_0x8826('0x2'));var express=require(_0x8826('0x3'));var router=express['Router']();var fs_extra=require(_0x8826('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8826('0x5'));var controller=require(_0x8826('0x6'));router[_0x8826('0x7')]('/',auth[_0x8826('0x8')](),controller[_0x8826('0x9')]);router[_0x8826('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8826('0xa')]);router[_0x8826('0x7')](_0x8826('0xb'),auth[_0x8826('0x8')](),timeout(_0x8826('0xc')),controller[_0x8826('0xd')]);router[_0x8826('0xe')]('/',auth[_0x8826('0x8')](),controller[_0x8826('0xf')]);router[_0x8826('0x10')](_0x8826('0x11'),auth[_0x8826('0x8')](),controller[_0x8826('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8826('0x13')]);module[_0x8826('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 3b4799b..9505bdc 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 _0x9d00=['name','exports','STRING'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x9d00,0x11b));var _0x09d0=function(_0x559010,_0x193ed6){_0x559010=_0x559010-0x0;var _0x542337=_0x9d00[_0x559010];return _0x542337;};'use strict';var Sequelize=require('sequelize');module[_0x09d0('0x0')]={'name':{'type':Sequelize[_0x09d0('0x1')],'unique':_0x09d0('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x09d0('0x1')]},'description':{'type':Sequelize[_0x09d0('0x1')]}}; \ No newline at end of file +var _0x67e1=['name','sequelize','exports','STRING'];(function(_0x3cef2a,_0x48bc9d){var _0x4a303b=function(_0x4a270e){while(--_0x4a270e){_0x3cef2a['push'](_0x3cef2a['shift']());}};_0x4a303b(++_0x48bc9d);}(_0x67e1,0x1b9));var _0x167e=function(_0x444807,_0x3957d3){_0x444807=_0x444807-0x0;var _0x2b02e4=_0x67e1[_0x444807];return _0x2b02e4;};'use strict';var Sequelize=require(_0x167e('0x0'));module[_0x167e('0x1')]={'name':{'type':Sequelize[_0x167e('0x2')],'unique':_0x167e('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x167e('0x2')]},'description':{'type':Sequelize[_0x167e('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 7f93a99..6893597 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 _0x10cf=['params','test','dsn','odbc','openSync','closeSync','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','includeAll','SquareOdbc','findAll','rows','catch','show','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x509dad,_0x1f995f){var _0x21e122=function(_0x2a9b90){while(--_0x2a9b90){_0x509dad['push'](_0x509dad['shift']());}};_0x21e122(++_0x1f995f);}(_0x10cf,0xb4));var _0xf10c=function(_0x1a56a1,_0x4e48f6){_0x1a56a1=_0x1a56a1-0x0;var _0x2ab5eb=_0x10cf[_0x1a56a1];return _0x2ab5eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf10c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf10c('0x1'));var rp=require(_0xf10c('0x2'));var moment=require(_0xf10c('0x3'));var BPromise=require(_0xf10c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf10c('0x5'));var csv=require('to-csv');var ejs=require(_0xf10c('0x6'));var fs=require('fs');var fs_extra=require(_0xf10c('0x7'));var _=require('lodash');var squel=require(_0xf10c('0x8'));var crypto=require(_0xf10c('0x9'));var jsforce=require(_0xf10c('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf10c('0xb'));var Papa=require('papaparse');var Redis=require(_0xf10c('0xc'));var authService=require(_0xf10c('0xd'));var qs=require(_0xf10c('0xe'));var as=require(_0xf10c('0xf'));var hardwareService=require(_0xf10c('0x10'));var logger=require(_0xf10c('0x11'))(_0xf10c('0x12'));var utils=require(_0xf10c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf10c('0x14'));var db=require(_0xf10c('0x15'))['db'];function respondWithStatusCode(_0x71bf54,_0x29baa0){_0x29baa0=_0x29baa0||0xcc;return function(_0x52a31d){if(_0x52a31d){return _0x71bf54['sendStatus'](_0x29baa0);}return _0x71bf54[_0xf10c('0x16')](_0x29baa0)[_0xf10c('0x17')]();};}function respondWithResult(_0xeda918,_0x3f402b){_0x3f402b=_0x3f402b||0xc8;return function(_0x37794d){if(_0x37794d){return _0xeda918[_0xf10c('0x16')](_0x3f402b)['json'](_0x37794d);}};}function respondWithFilteredResult(_0x5e565d,_0x47b9ea){return function(_0x2751fc){if(_0x2751fc){var _0x5b04ca=typeof _0x47b9ea[_0xf10c('0x18')]===_0xf10c('0x19')&&typeof _0x47b9ea[_0xf10c('0x1a')]===_0xf10c('0x19');var _0x3c3d8f=_0x2751fc[_0xf10c('0x1b')];var _0x520719=_0x5b04ca?0x0:_0x47b9ea[_0xf10c('0x18')];var _0x541dbf=_0x5b04ca?_0x2751fc[_0xf10c('0x1b')]:_0x47b9ea[_0xf10c('0x18')]+_0x47b9ea[_0xf10c('0x1a')];var _0x13c676;if(_0x541dbf>=_0x3c3d8f){_0x541dbf=_0x3c3d8f;_0x13c676=0xc8;}else{_0x13c676=0xce;}_0x5e565d[_0xf10c('0x16')](_0x13c676);return _0x5e565d[_0xf10c('0x1c')](_0xf10c('0x1d'),_0x520719+'-'+_0x541dbf+'/'+_0x3c3d8f)[_0xf10c('0x1e')](_0x2751fc);}return null;};}function patchUpdates(_0x55abb5){return function(_0x2bd61b){try{jsonpatch['apply'](_0x2bd61b,_0x55abb5,!![]);}catch(_0x3aada5){return BPromise[_0xf10c('0x1f')](_0x3aada5);}return _0x2bd61b[_0xf10c('0x20')]();};}function saveUpdates(_0x53a8a9,_0x378ad7){return function(_0x25d1ad){if(_0x25d1ad){return _0x25d1ad['update'](_0x53a8a9)[_0xf10c('0x21')](function(_0x30564c){return _0x30564c;});}return null;};}function removeEntity(_0x86f1a5,_0x13caea){return function(_0x533178){if(_0x533178){return _0x533178[_0xf10c('0x22')]()[_0xf10c('0x21')](function(){var _0x36d8bc=_0x533178[_0xf10c('0x23')]({'plain':!![]});var _0x8db8fc='ODBC';return db[_0xf10c('0x24')][_0xf10c('0x22')]({'where':{'type':_0x8db8fc,'resourceId':_0x36d8bc['id']}})[_0xf10c('0x21')](function(){return _0x533178;});})[_0xf10c('0x21')](function(){_0x86f1a5[_0xf10c('0x16')](0xcc)[_0xf10c('0x17')]();});}};}function handleEntityNotFound(_0x2d759d,_0x58ab48){return function(_0x4d9466){if(!_0x4d9466){_0x2d759d[_0xf10c('0x25')](0x194);}return _0x4d9466;};}function handleError(_0x4ba67b,_0x1fe853){_0x1fe853=_0x1fe853||0x1f4;return function(_0xfdbbc5){logger[_0xf10c('0x26')](_0xfdbbc5[_0xf10c('0x27')]);if(_0xfdbbc5[_0xf10c('0x28')]){delete _0xfdbbc5['name'];}_0x4ba67b['status'](_0x1fe853)[_0xf10c('0x29')](_0xfdbbc5);};}exports[_0xf10c('0x2a')]=function(_0x35583b,_0x174c67){var _0x2b7bf5={},_0x156873={},_0x4d45f4={'count':0x0,'rows':[]};var _0x418195=_[_0xf10c('0x2b')](db['SquareOdbc'][_0xf10c('0x2c')],function(_0x268451){return{'name':_0x268451[_0xf10c('0x2d')],'type':_0x268451[_0xf10c('0x2e')][_0xf10c('0x2f')]};});_0x156873[_0xf10c('0x30')]=_[_0xf10c('0x2b')](_0x418195,_0xf10c('0x28'));_0x156873['query']=_[_0xf10c('0x31')](_0x35583b[_0xf10c('0x32')]);_0x156873['filters']=_[_0xf10c('0x33')](_0x156873[_0xf10c('0x30')],_0x156873[_0xf10c('0x32')]);_0x2b7bf5[_0xf10c('0x34')]=_[_0xf10c('0x33')](_0x156873['model'],qs['fields'](_0x35583b[_0xf10c('0x32')][_0xf10c('0x35')]));_0x2b7bf5[_0xf10c('0x34')]=_0x2b7bf5['attributes'][_0xf10c('0x36')]?_0x2b7bf5[_0xf10c('0x34')]:_0x156873[_0xf10c('0x30')];if(!_0x35583b[_0xf10c('0x32')][_0xf10c('0x37')]('nolimit')){_0x2b7bf5[_0xf10c('0x1a')]=qs[_0xf10c('0x1a')](_0x35583b[_0xf10c('0x32')][_0xf10c('0x1a')]);_0x2b7bf5[_0xf10c('0x18')]=qs[_0xf10c('0x18')](_0x35583b[_0xf10c('0x32')][_0xf10c('0x18')]);}_0x2b7bf5[_0xf10c('0x38')]=qs['sort'](_0x35583b[_0xf10c('0x32')][_0xf10c('0x39')]);_0x2b7bf5['where']=qs[_0xf10c('0x3a')](_['pick'](_0x35583b['query'],_0x156873['filters']),_0x418195);if(_0x35583b['query'][_0xf10c('0x3b')]){_0x2b7bf5[_0xf10c('0x3c')]=_[_0xf10c('0x3d')](_0x2b7bf5[_0xf10c('0x3c')],{'$or':_[_0xf10c('0x2b')](_0x418195,function(_0x1f0346){if(_0x1f0346[_0xf10c('0x2e')]!=='VIRTUAL'){var _0x2c91c4={};_0x2c91c4[_0x1f0346[_0xf10c('0x28')]]={'$like':'%'+_0x35583b[_0xf10c('0x32')]['filter']+'%'};return _0x2c91c4;}})});}_0x2b7bf5=_[_0xf10c('0x3d')]({},_0x2b7bf5,_0x35583b['options']);var _0x5830d2={'where':_0x2b7bf5[_0xf10c('0x3c')]};return db['SquareOdbc'][_0xf10c('0x1b')](_0x5830d2)['then'](function(_0xcf520a){_0x4d45f4[_0xf10c('0x1b')]=_0xcf520a;if(_0x35583b[_0xf10c('0x32')][_0xf10c('0x3e')]){_0x2b7bf5['include']=[{'all':!![]}];}return db[_0xf10c('0x3f')][_0xf10c('0x40')](_0x2b7bf5);})[_0xf10c('0x21')](function(_0x4bff5f){_0x4d45f4[_0xf10c('0x41')]=_0x4bff5f;return _0x4d45f4;})[_0xf10c('0x21')](respondWithFilteredResult(_0x174c67,_0x2b7bf5))[_0xf10c('0x42')](handleError(_0x174c67,null));};exports[_0xf10c('0x43')]=function(_0x92461e,_0x4a5530){var _0x2c8635={'raw':!![],'where':{'id':_0x92461e['params']['id']}},_0x2115bd={};_0x2115bd[_0xf10c('0x30')]=_[_0xf10c('0x31')](db[_0xf10c('0x3f')][_0xf10c('0x2c')]);_0x2115bd[_0xf10c('0x32')]=_[_0xf10c('0x31')](_0x92461e[_0xf10c('0x32')]);_0x2115bd['filters']=_['intersection'](_0x2115bd[_0xf10c('0x30')],_0x2115bd['query']);_0x2c8635['attributes']=_[_0xf10c('0x33')](_0x2115bd[_0xf10c('0x30')],qs[_0xf10c('0x35')](_0x92461e[_0xf10c('0x32')]['fields']));_0x2c8635[_0xf10c('0x34')]=_0x2c8635[_0xf10c('0x34')][_0xf10c('0x36')]?_0x2c8635['attributes']:_0x2115bd[_0xf10c('0x30')];if(_0x92461e[_0xf10c('0x32')][_0xf10c('0x3e')]){_0x2c8635[_0xf10c('0x44')]=[{'all':!![]}];}_0x2c8635=_[_0xf10c('0x3d')]({},_0x2c8635,_0x92461e['options']);return db[_0xf10c('0x3f')]['find'](_0x2c8635)['then'](handleEntityNotFound(_0x4a5530,null))[_0xf10c('0x21')](respondWithResult(_0x4a5530,null))['catch'](handleError(_0x4a5530,null));};exports[_0xf10c('0x45')]=function(_0x2cc4bc,_0x30123b){return db[_0xf10c('0x3f')][_0xf10c('0x45')](_0x2cc4bc[_0xf10c('0x46')],{})[_0xf10c('0x21')](function(_0x2a49c7){var _0x2b27e4=_0x2cc4bc[_0xf10c('0x47')][_0xf10c('0x23')]({'plain':!![]});if(!_0x2b27e4)throw new Error(_0xf10c('0x48'));if(_0x2b27e4[_0xf10c('0x49')]==='user'){var _0x508f44=_0x2a49c7[_0xf10c('0x23')]({'plain':!![]});var _0x4d6ac6=_0xf10c('0x4a');return db[_0xf10c('0x4b')][_0xf10c('0x4c')]({'where':{'name':_0x4d6ac6,'userProfileId':_0x2b27e4[_0xf10c('0x4d')]},'raw':!![]})['then'](function(_0x31e6f4){if(_0x31e6f4&&_0x31e6f4[_0xf10c('0x4e')]===0x0){return db[_0xf10c('0x24')][_0xf10c('0x45')]({'name':_0x508f44[_0xf10c('0x28')],'resourceId':_0x508f44['id'],'type':_0x31e6f4[_0xf10c('0x28')],'sectionId':_0x31e6f4['id']},{})[_0xf10c('0x21')](function(){return _0x2a49c7;});}else{return _0x2a49c7;}})[_0xf10c('0x42')](function(_0x2e2aa0){logger[_0xf10c('0x26')](_0xf10c('0x4f'),_0x2e2aa0);throw _0x2e2aa0;});}return _0x2a49c7;})['then'](respondWithResult(_0x30123b,0xc9))['catch'](handleError(_0x30123b,null));};exports[_0xf10c('0x50')]=function(_0x144caf,_0x21e68e){if(_0x144caf[_0xf10c('0x46')]['id']){delete _0x144caf[_0xf10c('0x46')]['id'];}return db[_0xf10c('0x3f')][_0xf10c('0x4c')]({'where':{'id':_0x144caf[_0xf10c('0x51')]['id']}})[_0xf10c('0x21')](handleEntityNotFound(_0x21e68e,null))[_0xf10c('0x21')](saveUpdates(_0x144caf[_0xf10c('0x46')],null))[_0xf10c('0x21')](respondWithResult(_0x21e68e,null))[_0xf10c('0x42')](handleError(_0x21e68e,null));};exports['destroy']=function(_0x25fe91,_0x154415){return db[_0xf10c('0x3f')][_0xf10c('0x4c')]({'where':{'id':_0x25fe91[_0xf10c('0x51')]['id']}})[_0xf10c('0x21')](handleEntityNotFound(_0x154415,null))[_0xf10c('0x21')](removeEntity(_0x154415,null))[_0xf10c('0x42')](handleError(_0x154415,null));};exports[_0xf10c('0x52')]=function(_0x45f00c,_0x560ce6,_0x7d56e){var _0x109fd1;return db[_0xf10c('0x3f')][_0xf10c('0x4c')]({'where':{'id':_0x45f00c[_0xf10c('0x51')]['id']},'attributes':['id',_0xf10c('0x53')]})[_0xf10c('0x21')](handleEntityNotFound(_0x560ce6,null))[_0xf10c('0x21')](function(_0x29c1b3){if(_0x29c1b3){var _0x4bdc43=require(_0xf10c('0x54'))();_0x4bdc43[_0xf10c('0x55')](_0x29c1b3['dsn']);_0x4bdc43[_0xf10c('0x56')]();return _0x29c1b3;}})[_0xf10c('0x21')](respondWithResult(_0x560ce6,null))['catch'](handleError(_0x560ce6,null));}; \ No newline at end of file +var _0xe124=['then','destroy','ODBC','UserProfileResource','stack','name','send','index','map','rawAttributes','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','SquareOdbc','includeAll','include','findAll','rows','catch','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update'];(function(_0x4e7bb4,_0x149462){var _0x561f24=function(_0x285e77){while(--_0x285e77){_0x4e7bb4['push'](_0x4e7bb4['shift']());}};_0x561f24(++_0x149462);}(_0xe124,0x182));var _0x4e12=function(_0x4cc1c7,_0x55cb2b){_0x4cc1c7=_0x4cc1c7-0x0;var _0x364c60=_0xe124[_0x4cc1c7];return _0x364c60;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e12('0x0'));var zipdir=require(_0x4e12('0x1'));var jsonpatch=require(_0x4e12('0x2'));var rp=require(_0x4e12('0x3'));var moment=require('moment');var BPromise=require(_0x4e12('0x4'));var Mustache=require('mustache');var util=require(_0x4e12('0x5'));var path=require(_0x4e12('0x6'));var sox=require(_0x4e12('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e12('0x8'));var _=require(_0x4e12('0x9'));var squel=require(_0x4e12('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4e12('0xb'));var toCsv=require(_0x4e12('0xc'));var querystring=require(_0x4e12('0xd'));var Papa=require('papaparse');var Redis=require(_0x4e12('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4e12('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e12('0x10'));var logger=require(_0x4e12('0x11'))(_0x4e12('0x12'));var utils=require(_0x4e12('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4e12('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c00a7,_0xcc8d7b){_0xcc8d7b=_0xcc8d7b||0xcc;return function(_0x3d8917){if(_0x3d8917){return _0x3c00a7[_0x4e12('0x15')](_0xcc8d7b);}return _0x3c00a7[_0x4e12('0x16')](_0xcc8d7b)[_0x4e12('0x17')]();};}function respondWithResult(_0x490194,_0x2b28da){_0x2b28da=_0x2b28da||0xc8;return function(_0x5a8c2e){if(_0x5a8c2e){return _0x490194[_0x4e12('0x16')](_0x2b28da)['json'](_0x5a8c2e);}};}function respondWithFilteredResult(_0x1e1f11,_0xd4dbce){return function(_0x47d20c){if(_0x47d20c){var _0x42395d=typeof _0xd4dbce[_0x4e12('0x18')]===_0x4e12('0x19')&&typeof _0xd4dbce[_0x4e12('0x1a')]===_0x4e12('0x19');var _0x5ebe31=_0x47d20c[_0x4e12('0x1b')];var _0x1a34ac=_0x42395d?0x0:_0xd4dbce[_0x4e12('0x18')];var _0x79128e=_0x42395d?_0x47d20c[_0x4e12('0x1b')]:_0xd4dbce['offset']+_0xd4dbce['limit'];var _0x4c320d;if(_0x79128e>=_0x5ebe31){_0x79128e=_0x5ebe31;_0x4c320d=0xc8;}else{_0x4c320d=0xce;}_0x1e1f11[_0x4e12('0x16')](_0x4c320d);return _0x1e1f11[_0x4e12('0x1c')](_0x4e12('0x1d'),_0x1a34ac+'-'+_0x79128e+'/'+_0x5ebe31)[_0x4e12('0x1e')](_0x47d20c);}return null;};}function patchUpdates(_0x4e2aa4){return function(_0x546673){try{jsonpatch[_0x4e12('0x1f')](_0x546673,_0x4e2aa4,!![]);}catch(_0xb82cde){return BPromise['reject'](_0xb82cde);}return _0x546673[_0x4e12('0x20')]();};}function saveUpdates(_0x196b59,_0x2574bc){return function(_0x37e214){if(_0x37e214){return _0x37e214[_0x4e12('0x21')](_0x196b59)[_0x4e12('0x22')](function(_0x534d43){return _0x534d43;});}return null;};}function removeEntity(_0x119291,_0x187fbe){return function(_0xd85219){if(_0xd85219){return _0xd85219[_0x4e12('0x23')]()[_0x4e12('0x22')](function(){var _0x19d3c9=_0xd85219['get']({'plain':!![]});var _0x240a9f=_0x4e12('0x24');return db[_0x4e12('0x25')][_0x4e12('0x23')]({'where':{'type':_0x240a9f,'resourceId':_0x19d3c9['id']}})[_0x4e12('0x22')](function(){return _0xd85219;});})[_0x4e12('0x22')](function(){_0x119291[_0x4e12('0x16')](0xcc)[_0x4e12('0x17')]();});}};}function handleEntityNotFound(_0x51a1d8,_0xabada4){return function(_0x5a317b){if(!_0x5a317b){_0x51a1d8[_0x4e12('0x15')](0x194);}return _0x5a317b;};}function handleError(_0x290b4d,_0x1e41a4){_0x1e41a4=_0x1e41a4||0x1f4;return function(_0x575488){logger['error'](_0x575488[_0x4e12('0x26')]);if(_0x575488[_0x4e12('0x27')]){delete _0x575488['name'];}_0x290b4d['status'](_0x1e41a4)[_0x4e12('0x28')](_0x575488);};}exports[_0x4e12('0x29')]=function(_0x75ac4b,_0x16a0ab){var _0x3b4b0e={},_0x3831ce={},_0x476ae2={'count':0x0,'rows':[]};var _0x4b3bcc=_[_0x4e12('0x2a')](db['SquareOdbc'][_0x4e12('0x2b')],function(_0xb11c65){return{'name':_0xb11c65['fieldName'],'type':_0xb11c65['type']['key']};});_0x3831ce[_0x4e12('0x2c')]=_['map'](_0x4b3bcc,_0x4e12('0x27'));_0x3831ce[_0x4e12('0x2d')]=_['keys'](_0x75ac4b[_0x4e12('0x2d')]);_0x3831ce['filters']=_['intersection'](_0x3831ce['model'],_0x3831ce[_0x4e12('0x2d')]);_0x3b4b0e[_0x4e12('0x2e')]=_[_0x4e12('0x2f')](_0x3831ce['model'],qs[_0x4e12('0x30')](_0x75ac4b[_0x4e12('0x2d')][_0x4e12('0x30')]));_0x3b4b0e[_0x4e12('0x2e')]=_0x3b4b0e[_0x4e12('0x2e')][_0x4e12('0x31')]?_0x3b4b0e[_0x4e12('0x2e')]:_0x3831ce[_0x4e12('0x2c')];if(!_0x75ac4b[_0x4e12('0x2d')]['hasOwnProperty'](_0x4e12('0x32'))){_0x3b4b0e[_0x4e12('0x1a')]=qs[_0x4e12('0x1a')](_0x75ac4b['query'][_0x4e12('0x1a')]);_0x3b4b0e['offset']=qs['offset'](_0x75ac4b['query']['offset']);}_0x3b4b0e[_0x4e12('0x33')]=qs[_0x4e12('0x34')](_0x75ac4b[_0x4e12('0x2d')][_0x4e12('0x34')]);_0x3b4b0e[_0x4e12('0x35')]=qs[_0x4e12('0x36')](_[_0x4e12('0x37')](_0x75ac4b['query'],_0x3831ce[_0x4e12('0x36')]),_0x4b3bcc);if(_0x75ac4b[_0x4e12('0x2d')]['filter']){_0x3b4b0e['where']=_['merge'](_0x3b4b0e[_0x4e12('0x35')],{'$or':_[_0x4e12('0x2a')](_0x4b3bcc,function(_0x4d99dd){if(_0x4d99dd[_0x4e12('0x38')]!==_0x4e12('0x39')){var _0x476bae={};_0x476bae[_0x4d99dd[_0x4e12('0x27')]]={'$like':'%'+_0x75ac4b[_0x4e12('0x2d')][_0x4e12('0x3a')]+'%'};return _0x476bae;}})});}_0x3b4b0e=_[_0x4e12('0x3b')]({},_0x3b4b0e,_0x75ac4b[_0x4e12('0x3c')]);var _0x2c7e2d={'where':_0x3b4b0e['where']};return db[_0x4e12('0x3d')][_0x4e12('0x1b')](_0x2c7e2d)['then'](function(_0x400d89){_0x476ae2[_0x4e12('0x1b')]=_0x400d89;if(_0x75ac4b[_0x4e12('0x2d')][_0x4e12('0x3e')]){_0x3b4b0e[_0x4e12('0x3f')]=[{'all':!![]}];}return db[_0x4e12('0x3d')][_0x4e12('0x40')](_0x3b4b0e);})['then'](function(_0x283e25){_0x476ae2[_0x4e12('0x41')]=_0x283e25;return _0x476ae2;})[_0x4e12('0x22')](respondWithFilteredResult(_0x16a0ab,_0x3b4b0e))[_0x4e12('0x42')](handleError(_0x16a0ab,null));};exports['show']=function(_0x4c1f67,_0x469d0e){var _0x2308b3={'raw':!![],'where':{'id':_0x4c1f67[_0x4e12('0x43')]['id']}},_0x534c99={};_0x534c99[_0x4e12('0x2c')]=_['keys'](db[_0x4e12('0x3d')][_0x4e12('0x2b')]);_0x534c99[_0x4e12('0x2d')]=_['keys'](_0x4c1f67['query']);_0x534c99[_0x4e12('0x36')]=_[_0x4e12('0x2f')](_0x534c99[_0x4e12('0x2c')],_0x534c99['query']);_0x2308b3['attributes']=_[_0x4e12('0x2f')](_0x534c99[_0x4e12('0x2c')],qs['fields'](_0x4c1f67[_0x4e12('0x2d')][_0x4e12('0x30')]));_0x2308b3[_0x4e12('0x2e')]=_0x2308b3[_0x4e12('0x2e')][_0x4e12('0x31')]?_0x2308b3[_0x4e12('0x2e')]:_0x534c99[_0x4e12('0x2c')];if(_0x4c1f67[_0x4e12('0x2d')]['includeAll']){_0x2308b3[_0x4e12('0x3f')]=[{'all':!![]}];}_0x2308b3=_[_0x4e12('0x3b')]({},_0x2308b3,_0x4c1f67[_0x4e12('0x3c')]);return db[_0x4e12('0x3d')][_0x4e12('0x44')](_0x2308b3)['then'](handleEntityNotFound(_0x469d0e,null))['then'](respondWithResult(_0x469d0e,null))[_0x4e12('0x42')](handleError(_0x469d0e,null));};exports[_0x4e12('0x45')]=function(_0x11a9e5,_0x446b63){return db[_0x4e12('0x3d')][_0x4e12('0x45')](_0x11a9e5['body'],{})[_0x4e12('0x22')](function(_0x4489bc){var _0x2a03d9=_0x11a9e5[_0x4e12('0x46')][_0x4e12('0x47')]({'plain':!![]});if(!_0x2a03d9)throw new Error(_0x4e12('0x48'));if(_0x2a03d9[_0x4e12('0x49')]===_0x4e12('0x46')){var _0x52498e=_0x4489bc[_0x4e12('0x47')]({'plain':!![]});var _0x236c48=_0x4e12('0x24');return db[_0x4e12('0x4a')]['find']({'where':{'name':_0x236c48,'userProfileId':_0x2a03d9[_0x4e12('0x4b')]},'raw':!![]})[_0x4e12('0x22')](function(_0x584b6a){if(_0x584b6a&&_0x584b6a[_0x4e12('0x4c')]===0x0){return db[_0x4e12('0x25')][_0x4e12('0x45')]({'name':_0x52498e[_0x4e12('0x27')],'resourceId':_0x52498e['id'],'type':_0x584b6a[_0x4e12('0x27')],'sectionId':_0x584b6a['id']},{})[_0x4e12('0x22')](function(){return _0x4489bc;});}else{return _0x4489bc;}})['catch'](function(_0x245d68){logger['error'](_0x4e12('0x4d'),_0x245d68);throw _0x245d68;});}return _0x4489bc;})[_0x4e12('0x22')](respondWithResult(_0x446b63,0xc9))[_0x4e12('0x42')](handleError(_0x446b63,null));};exports[_0x4e12('0x21')]=function(_0x37a21,_0x40fa6e){if(_0x37a21[_0x4e12('0x4e')]['id']){delete _0x37a21[_0x4e12('0x4e')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x37a21[_0x4e12('0x43')]['id']}})[_0x4e12('0x22')](handleEntityNotFound(_0x40fa6e,null))[_0x4e12('0x22')](saveUpdates(_0x37a21[_0x4e12('0x4e')],null))[_0x4e12('0x22')](respondWithResult(_0x40fa6e,null))[_0x4e12('0x42')](handleError(_0x40fa6e,null));};exports[_0x4e12('0x23')]=function(_0x362acc,_0x259180){return db[_0x4e12('0x3d')][_0x4e12('0x44')]({'where':{'id':_0x362acc[_0x4e12('0x43')]['id']}})[_0x4e12('0x22')](handleEntityNotFound(_0x259180,null))[_0x4e12('0x22')](removeEntity(_0x259180,null))[_0x4e12('0x42')](handleError(_0x259180,null));};exports[_0x4e12('0x4f')]=function(_0x5c866a,_0x25972a,_0x5270f9){var _0x4b31bb;return db[_0x4e12('0x3d')][_0x4e12('0x44')]({'where':{'id':_0x5c866a[_0x4e12('0x43')]['id']},'attributes':['id',_0x4e12('0x50')]})[_0x4e12('0x22')](handleEntityNotFound(_0x25972a,null))['then'](function(_0x42eaf2){if(_0x42eaf2){var _0x5f5144=require(_0x4e12('0x51'))();_0x5f5144[_0x4e12('0x52')](_0x42eaf2['dsn']);_0x5f5144[_0x4e12('0x53')]();return _0x42eaf2;}})[_0x4e12('0x22')](respondWithResult(_0x25972a,null))[_0x4e12('0x42')](handleError(_0x25972a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 0d2b244..fb89e86 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 _0x468c=['square_odbc','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x3a15ed,_0x5d4993){var _0x47fdb4=function(_0x551850){while(--_0x551850){_0x3a15ed['push'](_0x3a15ed['shift']());}};_0x47fdb4(++_0x5d4993);}(_0x468c,0x112));var _0xc468=function(_0x377adb,_0x4b1e5d){_0x377adb=_0x377adb-0x0;var _0x532855=_0x468c[_0x377adb];return _0x532855;};'use strict';var _=require(_0xc468('0x0'));var util=require(_0xc468('0x1'));var logger=require(_0xc468('0x2'))(_0xc468('0x3'));var moment=require('moment');var BPromise=require(_0xc468('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc468('0x5'));var rimraf=require(_0xc468('0x6'));var config=require(_0xc468('0x7'));var attributes=require(_0xc468('0x8'));module[_0xc468('0x9')]=function(_0x5155c0,_0x59b269){return _0x5155c0[_0xc468('0xa')](_0xc468('0xb'),attributes,{'tableName':_0xc468('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f32=['request-promise','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','moment'];(function(_0x4fa08c,_0x30cac4){var _0x7a920a=function(_0x213fd1){while(--_0x213fd1){_0x4fa08c['push'](_0x4fa08c['shift']());}};_0x7a920a(++_0x30cac4);}(_0x9f32,0x8b));var _0x29f3=function(_0x269d99,_0x5cc9c8){_0x269d99=_0x269d99-0x0;var _0x152653=_0x9f32[_0x269d99];return _0x152653;};'use strict';var _=require(_0x29f3('0x0'));var util=require(_0x29f3('0x1'));var logger=require(_0x29f3('0x2'))('api');var moment=require(_0x29f3('0x3'));var BPromise=require('bluebird');var rp=require(_0x29f3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x29f3('0x5'));var config=require('../../config/environment');var attributes=require(_0x29f3('0x6'));module[_0x29f3('0x7')]=function(_0x4fc4ec,_0x42ca79){return _0x4fc4ec[_0x29f3('0x8')](_0x29f3('0x9'),attributes,{'tableName':_0x29f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 268fd15..be8a7cb 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 _0xd078=['raw','where','attributes','include','map','model','debug','ShowSquareOdbc','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','find','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd078,0x189));var _0x8d07=function(_0x1d046a,_0x30db41){_0x1d046a=_0x1d046a-0x0;var _0x2c0b0c=_0xd078[_0x1d046a];return _0x2c0b0c;};'use strict';var _=require(_0x8d07('0x0'));var util=require(_0x8d07('0x1'));var moment=require(_0x8d07('0x2'));var BPromise=require(_0x8d07('0x3'));var rs=require(_0x8d07('0x4'));var fs=require('fs');var Redis=require(_0x8d07('0x5'));var db=require(_0x8d07('0x6'))['db'];var utils=require(_0x8d07('0x7'));var logger=require(_0x8d07('0x8'))('rpc');var config=require(_0x8d07('0x9'));var jayson=require(_0x8d07('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x187af0,_0x23de70,_0xd01dad){return new BPromise(function(_0x45e6b7,_0x409172){return client[_0x8d07('0xb')](_0x187af0,_0xd01dad)[_0x8d07('0xc')](function(_0x3cfa44){logger['info'](_0x8d07('0xd'),_0x23de70,_0x8d07('0xe'));logger['debug'](_0x8d07('0xf'),_0x23de70,_0x8d07('0xe'),JSON[_0x8d07('0x10')](_0x3cfa44));if(_0x3cfa44['error']){if(_0x3cfa44['error'][_0x8d07('0x11')]===0x1f4){logger[_0x8d07('0x12')](_0x8d07('0xd'),_0x23de70,_0x3cfa44[_0x8d07('0x12')][_0x8d07('0x13')]);return _0x409172(_0x3cfa44[_0x8d07('0x12')][_0x8d07('0x13')]);}logger[_0x8d07('0x12')](_0x8d07('0xd'),_0x23de70,_0x3cfa44[_0x8d07('0x12')][_0x8d07('0x13')]);return _0x45e6b7(_0x3cfa44[_0x8d07('0x12')][_0x8d07('0x13')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x23de70,_0x8d07('0xe'));_0x45e6b7(_0x3cfa44[_0x8d07('0x14')][_0x8d07('0x13')]);}})['catch'](function(_0x5ed7c5){logger['error'](_0x8d07('0xd'),_0x23de70,_0x5ed7c5);_0x409172(_0x5ed7c5);});});}exports['ShowSquareOdbc']=function(_0x514b69){var _0x92a03b=this;return new Promise(function(_0x552b0d,_0x2f00ca){return db['SquareOdbc'][_0x8d07('0x15')]({'raw':_0x514b69[_0x8d07('0x16')]?_0x514b69[_0x8d07('0x16')][_0x8d07('0x17')]===undefined?!![]:![]:!![],'where':_0x514b69[_0x8d07('0x16')]?_0x514b69[_0x8d07('0x16')][_0x8d07('0x18')]||null:null,'attributes':_0x514b69['options']?_0x514b69[_0x8d07('0x16')][_0x8d07('0x19')]||null:null,'include':_0x514b69[_0x8d07('0x16')]?_0x514b69[_0x8d07('0x16')][_0x8d07('0x1a')]?_[_0x8d07('0x1b')](_0x514b69[_0x8d07('0x16')][_0x8d07('0x1a')],function(_0x35367c){return{'model':db[_0x35367c[_0x8d07('0x1c')]],'as':_0x35367c['as'],'attributes':_0x35367c[_0x8d07('0x19')],'include':_0x35367c[_0x8d07('0x1a')]?_[_0x8d07('0x1b')](_0x35367c[_0x8d07('0x1a')],function(_0x16559f){return{'model':db[_0x16559f[_0x8d07('0x1c')]],'as':_0x16559f['as'],'attributes':_0x16559f[_0x8d07('0x19')],'include':_0x16559f[_0x8d07('0x1a')]?_[_0x8d07('0x1b')](_0x16559f[_0x8d07('0x1a')],function(_0x2a2810){return{'model':db[_0x2a2810[_0x8d07('0x1c')]],'as':_0x2a2810['as'],'attributes':_0x2a2810[_0x8d07('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8d07('0xc')](function(_0x42ea73){logger['info']('ShowSquareOdbc',_0x514b69);logger[_0x8d07('0x1d')](_0x8d07('0x1e'),_0x514b69,JSON[_0x8d07('0x10')](_0x42ea73));_0x552b0d(_0x42ea73);})[_0x8d07('0x1f')](function(_0x582078){logger['error'](_0x8d07('0x1e'),_0x582078['message'],_0x514b69);_0x2f00ca(_0x92a03b['error'](0x1f4,_0x582078[_0x8d07('0x13')]));});});}; \ No newline at end of file +var _0x3a03=['result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','include','map','attributes','model','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../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','message'];(function(_0x52fd80,_0x530f19){var _0x204f51=function(_0x360aab){while(--_0x360aab){_0x52fd80['push'](_0x52fd80['shift']());}};_0x204f51(++_0x530f19);}(_0x3a03,0x134));var _0x33a0=function(_0x3aac90,_0x8b566f){_0x3aac90=_0x3aac90-0x0;var _0x5c137d=_0x3a03[_0x3aac90];return _0x5c137d;};'use strict';var _=require('lodash');var util=require(_0x33a0('0x0'));var moment=require(_0x33a0('0x1'));var BPromise=require(_0x33a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33a0('0x3'));var db=require(_0x33a0('0x4'))['db'];var utils=require(_0x33a0('0x5'));var logger=require(_0x33a0('0x6'))('rpc');var config=require(_0x33a0('0x7'));var jayson=require(_0x33a0('0x8'));var client=jayson[_0x33a0('0x9')][_0x33a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xffd343,_0xbaee1f,_0x5aeb32){return new BPromise(function(_0x5f5914,_0x47392c){return client[_0x33a0('0xb')](_0xffd343,_0x5aeb32)[_0x33a0('0xc')](function(_0x4f4913){logger[_0x33a0('0xd')](_0x33a0('0xe'),_0xbaee1f,_0x33a0('0xf'));logger[_0x33a0('0x10')](_0x33a0('0x11'),_0xbaee1f,_0x33a0('0xf'),JSON[_0x33a0('0x12')](_0x4f4913));if(_0x4f4913[_0x33a0('0x13')]){if(_0x4f4913[_0x33a0('0x13')][_0x33a0('0x14')]===0x1f4){logger[_0x33a0('0x13')]('SquareOdbc,\x20%s,\x20%s',_0xbaee1f,_0x4f4913[_0x33a0('0x13')]['message']);return _0x47392c(_0x4f4913[_0x33a0('0x13')][_0x33a0('0x15')]);}logger[_0x33a0('0x13')](_0x33a0('0xe'),_0xbaee1f,_0x4f4913['error']['message']);return _0x5f5914(_0x4f4913[_0x33a0('0x13')][_0x33a0('0x15')]);}else{logger[_0x33a0('0xd')]('SquareOdbc,\x20%s,\x20%s',_0xbaee1f,'request\x20sent');_0x5f5914(_0x4f4913[_0x33a0('0x16')][_0x33a0('0x15')]);}})[_0x33a0('0x17')](function(_0x15fcd5){logger['error'](_0x33a0('0xe'),_0xbaee1f,_0x15fcd5);_0x47392c(_0x15fcd5);});});}exports[_0x33a0('0x18')]=function(_0x480be8){var _0x58f6e4=this;return new Promise(function(_0x41386a,_0x13c9c0){return db[_0x33a0('0x19')][_0x33a0('0x1a')]({'raw':_0x480be8[_0x33a0('0x1b')]?_0x480be8['options']['raw']===undefined?!![]:![]:!![],'where':_0x480be8[_0x33a0('0x1b')]?_0x480be8[_0x33a0('0x1b')][_0x33a0('0x1c')]||null:null,'attributes':_0x480be8[_0x33a0('0x1b')]?_0x480be8[_0x33a0('0x1b')]['attributes']||null:null,'include':_0x480be8[_0x33a0('0x1b')]?_0x480be8['options'][_0x33a0('0x1d')]?_[_0x33a0('0x1e')](_0x480be8[_0x33a0('0x1b')][_0x33a0('0x1d')],function(_0x2da5a2){return{'model':db[_0x2da5a2['model']],'as':_0x2da5a2['as'],'attributes':_0x2da5a2[_0x33a0('0x1f')],'include':_0x2da5a2[_0x33a0('0x1d')]?_[_0x33a0('0x1e')](_0x2da5a2[_0x33a0('0x1d')],function(_0x1fd859){return{'model':db[_0x1fd859[_0x33a0('0x20')]],'as':_0x1fd859['as'],'attributes':_0x1fd859['attributes'],'include':_0x1fd859['include']?_[_0x33a0('0x1e')](_0x1fd859[_0x33a0('0x1d')],function(_0x2886ab){return{'model':db[_0x2886ab['model']],'as':_0x2886ab['as'],'attributes':_0x2886ab['attributes']};}):[]};}):[]};}):[]:[]})[_0x33a0('0xc')](function(_0x3f4988){logger[_0x33a0('0xd')](_0x33a0('0x18'),_0x480be8);logger[_0x33a0('0x10')](_0x33a0('0x18'),_0x480be8,JSON[_0x33a0('0x12')](_0x3f4988));_0x41386a(_0x3f4988);})[_0x33a0('0x17')](function(_0x3073a8){logger[_0x33a0('0x13')](_0x33a0('0x18'),_0x3073a8[_0x33a0('0x15')],_0x480be8);_0x13c9c0(_0x58f6e4[_0x33a0('0x13')](0x1f4,_0x3073a8['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index cca1280..fdb80b4 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 _0x733a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','post','put','/:id','update','delete','destroy','util','connect-timeout','express','Router','fs-extra'];(function(_0xfd0a,_0x2daa13){var _0x5e5c58=function(_0x40892a){while(--_0x40892a){_0xfd0a['push'](_0xfd0a['shift']());}};_0x5e5c58(++_0x2daa13);}(_0x733a,0x151));var _0xa733=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x733a[_0x46698a];return _0x356db0;};'use strict';var multer=require('multer');var util=require(_0xa733('0x0'));var path=require('path');var timeout=require(_0xa733('0x1'));var express=require(_0xa733('0x2'));var router=express[_0xa733('0x3')]();var fs_extra=require(_0xa733('0x4'));var auth=require(_0xa733('0x5'));var interaction=require(_0xa733('0x6'));var config=require(_0xa733('0x7'));var controller=require(_0xa733('0x8'));router[_0xa733('0x9')]('/',auth[_0xa733('0xa')](),controller[_0xa733('0xb')]);router[_0xa733('0x9')]('/:id',auth[_0xa733('0xa')](),controller['show']);router[_0xa733('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa733('0xd')](_0xa733('0xe'),auth[_0xa733('0xa')](),controller[_0xa733('0xf')]);router[_0xa733('0x10')]('/:id',auth[_0xa733('0xa')](),controller[_0xa733('0x11')]);module['exports']=router; \ No newline at end of file +var _0x254a=['../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x254a,0x67));var _0xa254=function(_0x2fe8e1,_0x3552bf){_0x2fe8e1=_0x2fe8e1-0x0;var _0x89bd52=_0x254a[_0x2fe8e1];return _0x89bd52;};'use strict';var multer=require(_0xa254('0x0'));var util=require(_0xa254('0x1'));var path=require(_0xa254('0x2'));var timeout=require('connect-timeout');var express=require(_0xa254('0x3'));var router=express[_0xa254('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa254('0x5'));var config=require(_0xa254('0x6'));var controller=require(_0xa254('0x7'));router[_0xa254('0x8')]('/',auth[_0xa254('0x9')](),controller[_0xa254('0xa')]);router[_0xa254('0x8')]('/:id',auth[_0xa254('0x9')](),controller[_0xa254('0xb')]);router[_0xa254('0xc')]('/',auth[_0xa254('0x9')](),controller[_0xa254('0xd')]);router['put']('/:id',auth[_0xa254('0x9')](),controller[_0xa254('0xe')]);router[_0xa254('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa254('0x10')]);module[_0xa254('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index cdbd252..128b5bd 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 _0x3a1a=['production','utf8','DATE','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString'];(function(_0x272a42,_0x41ff3e){var _0x45c141=function(_0x585c8d){while(--_0x585c8d){_0x272a42['push'](_0x272a42['shift']());}};_0x45c141(++_0x41ff3e);}(_0x3a1a,0x15f));var _0xa3a1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3a1a[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xa3a1('0x0')]={'name':{'type':Sequelize[_0xa3a1('0x1')],'unique':_0xa3a1('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa3a1('0x1')]},'notes':{'type':Sequelize[_0xa3a1('0x3')]},'preproduction':{'type':Sequelize[_0xa3a1('0x4')](_0xa3a1('0x5')),'get':function(){if(this[_0xa3a1('0x6')]('preproduction')){return this[_0xa3a1('0x6')](_0xa3a1('0x7'))[_0xa3a1('0x8')]('utf8');}}},'production':{'type':Sequelize[_0xa3a1('0x4')](_0xa3a1('0x5')),'get':function(){if(this['getDataValue'](_0xa3a1('0x9'))){return this['getDataValue'](_0xa3a1('0x9'))['toString'](_0xa3a1('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xa3a1('0xb')]}}; \ No newline at end of file +var _0x2d8e=['long','getDataValue','utf8','production','toString','DATE','sequelize','exports','STRING','name','TEXT','BLOB'];(function(_0x23a1ad,_0x4ddeed){var _0x4da4be=function(_0x549558){while(--_0x549558){_0x23a1ad['push'](_0x23a1ad['shift']());}};_0x4da4be(++_0x4ddeed);}(_0x2d8e,0x17a));var _0xe2d8=function(_0x303ea0,_0x32b6ff){_0x303ea0=_0x303ea0-0x0;var _0x5d142b=_0x2d8e[_0x303ea0];return _0x5d142b;};'use strict';var Sequelize=require(_0xe2d8('0x0'));module[_0xe2d8('0x1')]={'name':{'type':Sequelize[_0xe2d8('0x2')],'unique':_0xe2d8('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xe2d8('0x2')]},'notes':{'type':Sequelize[_0xe2d8('0x4')]},'preproduction':{'type':Sequelize[_0xe2d8('0x5')](_0xe2d8('0x6')),'get':function(){if(this[_0xe2d8('0x7')]('preproduction')){return this[_0xe2d8('0x7')]('preproduction')['toString'](_0xe2d8('0x8'));}}},'production':{'type':Sequelize[_0xe2d8('0x5')](_0xe2d8('0x6')),'get':function(){if(this[_0xe2d8('0x7')](_0xe2d8('0x9'))){return this['getDataValue'](_0xe2d8('0x9'))[_0xe2d8('0xa')](_0xe2d8('0x8'));}}},'savedAt':{'type':Sequelize[_0xe2d8('0xb')]},'publishedAt':{'type':Sequelize[_0xe2d8('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index f62b684..6e535e6 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 _0xca8e=['rows','catch','show','params','rawAttributes','fields','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','agi','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','socket.io-emitter','status','json','offset','count','limit','set','update','then','SquareProjects','UserProfileResource','destroy','publish','stringify','end','sendStatus','error','name','send','index','map','SquareProject','type','key','keys','query','model','attributes','intersection','length','order','sort','where','filters','merge','filter','options','includeAll','include','findAll'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0xca8e,0x91));var _0xeca8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca8e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xeca8('0x0'));var Redis=require(_0xeca8('0x1'));var qs=require(_0xeca8('0x2'));var logger=require(_0xeca8('0x3'))(_0xeca8('0x4'));var config=require(_0xeca8('0x5'));var db=require('../../mysqldb')['db'];config[_0xeca8('0x6')]=_['defaults'](config[_0xeca8('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xeca8('0x7'))(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);function respondWithResult(_0xf9291e,_0x27f500){_0x27f500=_0x27f500||0xc8;return function(_0x5f406a){if(_0x5f406a){return _0xf9291e[_0xeca8('0x8')](_0x27f500)[_0xeca8('0x9')](_0x5f406a);}};}function respondWithFilteredResult(_0x1d8b92,_0x52df1b){return function(_0x2ae93a){if(_0x2ae93a){var _0x26cfca=typeof _0x52df1b[_0xeca8('0xa')]==='undefined'&&typeof _0x52df1b['limit']==='undefined';var _0x1bdd0a=_0x2ae93a[_0xeca8('0xb')];var _0x597fba=_0x26cfca?0x0:_0x52df1b[_0xeca8('0xa')];var _0x4fb2ab=_0x26cfca?_0x2ae93a[_0xeca8('0xb')]:_0x52df1b[_0xeca8('0xa')]+_0x52df1b[_0xeca8('0xc')];var _0x4aede9;if(_0x4fb2ab>=_0x1bdd0a){_0x4fb2ab=_0x1bdd0a;_0x4aede9=0xc8;}else{_0x4aede9=0xce;}_0x1d8b92[_0xeca8('0x8')](_0x4aede9);return _0x1d8b92[_0xeca8('0xd')]('Content-Range',_0x597fba+'-'+_0x4fb2ab+'/'+_0x1bdd0a)['json'](_0x2ae93a);}return null;};}function saveUpdates(_0x528147){return function(_0x198c38){if(_0x198c38){return _0x198c38[_0xeca8('0xe')](_0x528147)['then'](function(_0x419ea0){return _0x419ea0;});}return null;};}function removeEntity(_0x36a82c){return function(_0x36aee8){if(_0x36aee8){return _0x36aee8['destroy']()[_0xeca8('0xf')](function(){var _0x20842c=_0x36aee8['get']({'plain':!![]});var _0x41bbd2=_0xeca8('0x10');return db[_0xeca8('0x11')][_0xeca8('0x12')]({'where':{'type':_0x41bbd2,'resourceId':_0x20842c['id']}})['then'](function(){return _0x36aee8;});})[_0xeca8('0xf')](function(){var _0x527049=new Redis(config[_0xeca8('0x6')]);_0x527049[_0xeca8('0x13')]('agi',JSON[_0xeca8('0x14')]({'id':_0x36aee8['id'],'deleted':!![]}));})[_0xeca8('0xf')](function(){_0x36a82c[_0xeca8('0x8')](0xcc)[_0xeca8('0x15')]();});}};}function handleEntityNotFound(_0x3363e8){return function(_0x19ff2c){if(!_0x19ff2c){_0x3363e8[_0xeca8('0x16')](0x194);}return _0x19ff2c;};}function handleError(_0x520b80,_0x384470){_0x384470=_0x384470||0x1f4;return function(_0x46e6c9){logger[_0xeca8('0x17')](_0x46e6c9['stack']);if(_0x46e6c9[_0xeca8('0x18')]){delete _0x46e6c9[_0xeca8('0x18')];}_0x520b80[_0xeca8('0x8')](_0x384470)[_0xeca8('0x19')](_0x46e6c9);};}exports[_0xeca8('0x1a')]=function(_0x2c9ace,_0xad8e9a){var _0x44b938={},_0x5be309={},_0x3988c0={'count':0x0,'rows':[]};var _0x46d2b8=_[_0xeca8('0x1b')](db[_0xeca8('0x1c')]['rawAttributes'],function(_0x32c0ee){return{'name':_0x32c0ee['fieldName'],'type':_0x32c0ee[_0xeca8('0x1d')][_0xeca8('0x1e')]};});_0x5be309['model']=_[_0xeca8('0x1b')](_0x46d2b8,'name');_0x5be309['query']=_[_0xeca8('0x1f')](_0x2c9ace[_0xeca8('0x20')]);_0x5be309['filters']=_['intersection'](_0x5be309[_0xeca8('0x21')],_0x5be309[_0xeca8('0x20')]);_0x44b938[_0xeca8('0x22')]=_[_0xeca8('0x23')](_0x5be309[_0xeca8('0x21')],qs['fields'](_0x2c9ace[_0xeca8('0x20')]['fields']));_0x44b938[_0xeca8('0x22')]=_0x44b938[_0xeca8('0x22')][_0xeca8('0x24')]?_0x44b938[_0xeca8('0x22')]:_0x5be309['model'];if(!_0x2c9ace[_0xeca8('0x20')]['hasOwnProperty']('nolimit')){_0x44b938['limit']=qs[_0xeca8('0xc')](_0x2c9ace[_0xeca8('0x20')]['limit']);_0x44b938['offset']=qs[_0xeca8('0xa')](_0x2c9ace['query']['offset']);}_0x44b938[_0xeca8('0x25')]=qs[_0xeca8('0x26')](_0x2c9ace['query'][_0xeca8('0x26')]);_0x44b938[_0xeca8('0x27')]=qs['filters'](_['pick'](_0x2c9ace[_0xeca8('0x20')],_0x5be309[_0xeca8('0x28')]),_0x46d2b8);if(_0x2c9ace[_0xeca8('0x20')]['filter']){_0x44b938[_0xeca8('0x27')]=_[_0xeca8('0x29')](_0x44b938[_0xeca8('0x27')],{'$or':_['map'](_0x46d2b8,function(_0x142263){if(_0x142263[_0xeca8('0x1d')]!=='VIRTUAL'){var _0x5c31ca={};_0x5c31ca[_0x142263[_0xeca8('0x18')]]={'$like':'%'+_0x2c9ace[_0xeca8('0x20')][_0xeca8('0x2a')]+'%'};return _0x5c31ca;}})});}_0x44b938=_['merge']({},_0x44b938,_0x2c9ace[_0xeca8('0x2b')]);var _0x2014e2={'where':_0x44b938['where']};return db[_0xeca8('0x1c')][_0xeca8('0xb')](_0x2014e2)[_0xeca8('0xf')](function(_0x343df1){_0x3988c0[_0xeca8('0xb')]=_0x343df1;if(_0x2c9ace[_0xeca8('0x20')][_0xeca8('0x2c')]){_0x44b938[_0xeca8('0x2d')]=[{'all':!![]}];}return db[_0xeca8('0x1c')][_0xeca8('0x2e')](_0x44b938);})[_0xeca8('0xf')](function(_0x4c42e1){_0x3988c0[_0xeca8('0x2f')]=_0x4c42e1;return _0x3988c0;})[_0xeca8('0xf')](respondWithFilteredResult(_0xad8e9a,_0x44b938))[_0xeca8('0x30')](handleError(_0xad8e9a,null));};exports[_0xeca8('0x31')]=function(_0x13c5a7,_0x1efd13){var _0x27e8a4={'raw':![],'where':{'id':_0x13c5a7[_0xeca8('0x32')]['id']}},_0xcbd115={};_0xcbd115[_0xeca8('0x21')]=_[_0xeca8('0x1f')](db['SquareProject'][_0xeca8('0x33')]);_0xcbd115['query']=_['keys'](_0x13c5a7[_0xeca8('0x20')]);_0xcbd115[_0xeca8('0x28')]=_[_0xeca8('0x23')](_0xcbd115[_0xeca8('0x21')],_0xcbd115[_0xeca8('0x20')]);_0x27e8a4['attributes']=_[_0xeca8('0x23')](_0xcbd115[_0xeca8('0x21')],qs['fields'](_0x13c5a7['query'][_0xeca8('0x34')]));_0x27e8a4[_0xeca8('0x22')]=_0x27e8a4[_0xeca8('0x22')]['length']?_0x27e8a4['attributes']:_0xcbd115[_0xeca8('0x21')];if(_0x13c5a7[_0xeca8('0x20')][_0xeca8('0x2c')]){_0x27e8a4[_0xeca8('0x2d')]=[{'all':!![]}];}_0x27e8a4=_[_0xeca8('0x29')]({},_0x27e8a4,_0x13c5a7['options']);return db[_0xeca8('0x1c')][_0xeca8('0x35')](_0x27e8a4)[_0xeca8('0xf')](handleEntityNotFound(_0x1efd13,null))[_0xeca8('0xf')](respondWithResult(_0x1efd13,null))[_0xeca8('0x30')](handleError(_0x1efd13,null));};exports['create']=function(_0x5561c1,_0x12b777){return db['SquareProject'][_0xeca8('0x36')](_0x5561c1['body'],{})[_0xeca8('0xf')](function(_0x5b5f61){var _0xa7a078=_0x5561c1[_0xeca8('0x37')][_0xeca8('0x38')]({'plain':!![]});if(!_0xa7a078)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa7a078[_0xeca8('0x39')]===_0xeca8('0x37')){var _0xf41e85=_0x5b5f61[_0xeca8('0x38')]({'plain':!![]});var _0x3feba5=_0xeca8('0x10');return db[_0xeca8('0x3a')][_0xeca8('0x35')]({'where':{'name':_0x3feba5,'userProfileId':_0xa7a078[_0xeca8('0x3b')]},'raw':!![]})[_0xeca8('0xf')](function(_0x3c0b6e){if(_0x3c0b6e&&_0x3c0b6e[_0xeca8('0x3c')]===0x0){return db[_0xeca8('0x11')][_0xeca8('0x36')]({'name':_0xf41e85['name'],'resourceId':_0xf41e85['id'],'type':_0x3c0b6e['name'],'sectionId':_0x3c0b6e['id']},{})[_0xeca8('0xf')](function(){return _0x5b5f61;});}else{return _0x5b5f61;}})[_0xeca8('0x30')](function(_0x1338cc){logger[_0xeca8('0x17')](_0xeca8('0x3d'),_0x1338cc);throw _0x1338cc;});}return _0x5b5f61;})[_0xeca8('0xf')](respondWithResult(_0x12b777,0xc9))[_0xeca8('0x30')](handleError(_0x12b777,null));};exports[_0xeca8('0xe')]=function(_0x1c2d97,_0x38f9aa){if(_0x1c2d97['body']['id']){delete _0x1c2d97['body']['id'];}return db[_0xeca8('0x1c')]['find']({'where':{'id':_0x1c2d97[_0xeca8('0x32')]['id']}})[_0xeca8('0xf')](handleEntityNotFound(_0x38f9aa,null))[_0xeca8('0xf')](saveUpdates(_0x1c2d97[_0xeca8('0x3e')],null))['then'](function(_0x74b80c){if(!_0x74b80c)return;var _0x122e34=_0x74b80c[_0xeca8('0x38')]({'plain':!![]});return _0x122e34;})[_0xeca8('0xf')](function(_0xb6feba){var _0x2ab9c9=new Redis(config['redis']);_0x2ab9c9['publish'](_0xeca8('0x3f'),JSON[_0xeca8('0x14')](_['pick'](_0xb6feba,['id',_0xeca8('0x18'),'production'])));return _0xb6feba;})[_0xeca8('0xf')](respondWithResult(_0x38f9aa,null))[_0xeca8('0x30')](handleError(_0x38f9aa,null));};exports[_0xeca8('0x12')]=function(_0x301a5b,_0x41afeb){return db[_0xeca8('0x1c')][_0xeca8('0x35')]({'where':{'id':_0x301a5b[_0xeca8('0x32')]['id']}})[_0xeca8('0xf')](handleEntityNotFound(_0x41afeb,null))[_0xeca8('0xf')](removeEntity(_0x41afeb,null))[_0xeca8('0x30')](handleError(_0x41afeb,null));}; \ No newline at end of file +var _0x4bfb=['../../mysqldb','redis','localhost','socket.io-emitter','register','json','offset','limit','undefined','count','status','Content-Range','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','findAll','rows','catch','show','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','update','pick','production','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x127d6a,_0x1bf8e9){var _0x4b3422=function(_0x5d6c36){while(--_0x5d6c36){_0x127d6a['push'](_0x127d6a['shift']());}};_0x4b3422(++_0x1bf8e9);}(_0x4bfb,0x154));var _0xb4bf=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x4bfb[_0x496333];return _0x44256e;};'use strict';var _=require(_0xb4bf('0x0'));var Redis=require('ioredis');var qs=require(_0xb4bf('0x1'));var logger=require(_0xb4bf('0x2'))(_0xb4bf('0x3'));var config=require(_0xb4bf('0x4'));var db=require(_0xb4bf('0x5'))['db'];config[_0xb4bf('0x6')]=_['defaults'](config[_0xb4bf('0x6')],{'host':_0xb4bf('0x7'),'port':0x18eb});var socket=require(_0xb4bf('0x8'))(new Redis(config[_0xb4bf('0x6')]));require('./squareProject.socket')[_0xb4bf('0x9')](socket);function respondWithResult(_0x508720,_0x2b6a02){_0x2b6a02=_0x2b6a02||0xc8;return function(_0x5effc7){if(_0x5effc7){return _0x508720['status'](_0x2b6a02)[_0xb4bf('0xa')](_0x5effc7);}};}function respondWithFilteredResult(_0x577faa,_0x21e061){return function(_0x163fb5){if(_0x163fb5){var _0x455b6b=typeof _0x21e061[_0xb4bf('0xb')]==='undefined'&&typeof _0x21e061[_0xb4bf('0xc')]===_0xb4bf('0xd');var _0x488cb4=_0x163fb5[_0xb4bf('0xe')];var _0x9cd669=_0x455b6b?0x0:_0x21e061['offset'];var _0xad24fe=_0x455b6b?_0x163fb5[_0xb4bf('0xe')]:_0x21e061[_0xb4bf('0xb')]+_0x21e061[_0xb4bf('0xc')];var _0x191834;if(_0xad24fe>=_0x488cb4){_0xad24fe=_0x488cb4;_0x191834=0xc8;}else{_0x191834=0xce;}_0x577faa[_0xb4bf('0xf')](_0x191834);return _0x577faa['set'](_0xb4bf('0x10'),_0x9cd669+'-'+_0xad24fe+'/'+_0x488cb4)['json'](_0x163fb5);}return null;};}function saveUpdates(_0x23d3a3){return function(_0xbee05f){if(_0xbee05f){return _0xbee05f['update'](_0x23d3a3)[_0xb4bf('0x11')](function(_0xc0e867){return _0xc0e867;});}return null;};}function removeEntity(_0x1e066f){return function(_0x1cfd0c){if(_0x1cfd0c){return _0x1cfd0c[_0xb4bf('0x12')]()[_0xb4bf('0x11')](function(){var _0x55b0ef=_0x1cfd0c[_0xb4bf('0x13')]({'plain':!![]});var _0x3a4863=_0xb4bf('0x14');return db[_0xb4bf('0x15')][_0xb4bf('0x12')]({'where':{'type':_0x3a4863,'resourceId':_0x55b0ef['id']}})['then'](function(){return _0x1cfd0c;});})[_0xb4bf('0x11')](function(){var _0x5a02ac=new Redis(config[_0xb4bf('0x6')]);_0x5a02ac[_0xb4bf('0x16')](_0xb4bf('0x17'),JSON[_0xb4bf('0x18')]({'id':_0x1cfd0c['id'],'deleted':!![]}));})[_0xb4bf('0x11')](function(){_0x1e066f['status'](0xcc)[_0xb4bf('0x19')]();});}};}function handleEntityNotFound(_0x1b28f4){return function(_0x12a798){if(!_0x12a798){_0x1b28f4[_0xb4bf('0x1a')](0x194);}return _0x12a798;};}function handleError(_0x549065,_0x2508d7){_0x2508d7=_0x2508d7||0x1f4;return function(_0x3d5ecd){logger['error'](_0x3d5ecd[_0xb4bf('0x1b')]);if(_0x3d5ecd[_0xb4bf('0x1c')]){delete _0x3d5ecd['name'];}_0x549065[_0xb4bf('0xf')](_0x2508d7)[_0xb4bf('0x1d')](_0x3d5ecd);};}exports[_0xb4bf('0x1e')]=function(_0x3f6618,_0x4aa17a){var _0x2673a5={},_0x4d8b19={},_0x15924b={'count':0x0,'rows':[]};var _0x4d4fd1=_[_0xb4bf('0x1f')](db[_0xb4bf('0x20')][_0xb4bf('0x21')],function(_0xaf1c0f){return{'name':_0xaf1c0f[_0xb4bf('0x22')],'type':_0xaf1c0f[_0xb4bf('0x23')][_0xb4bf('0x24')]};});_0x4d8b19[_0xb4bf('0x25')]=_['map'](_0x4d4fd1,'name');_0x4d8b19['query']=_['keys'](_0x3f6618[_0xb4bf('0x26')]);_0x4d8b19[_0xb4bf('0x27')]=_['intersection'](_0x4d8b19['model'],_0x4d8b19[_0xb4bf('0x26')]);_0x2673a5[_0xb4bf('0x28')]=_[_0xb4bf('0x29')](_0x4d8b19['model'],qs[_0xb4bf('0x2a')](_0x3f6618[_0xb4bf('0x26')]['fields']));_0x2673a5['attributes']=_0x2673a5['attributes'][_0xb4bf('0x2b')]?_0x2673a5['attributes']:_0x4d8b19[_0xb4bf('0x25')];if(!_0x3f6618[_0xb4bf('0x26')]['hasOwnProperty']('nolimit')){_0x2673a5[_0xb4bf('0xc')]=qs['limit'](_0x3f6618[_0xb4bf('0x26')][_0xb4bf('0xc')]);_0x2673a5['offset']=qs[_0xb4bf('0xb')](_0x3f6618[_0xb4bf('0x26')][_0xb4bf('0xb')]);}_0x2673a5[_0xb4bf('0x2c')]=qs[_0xb4bf('0x2d')](_0x3f6618[_0xb4bf('0x26')][_0xb4bf('0x2d')]);_0x2673a5[_0xb4bf('0x2e')]=qs[_0xb4bf('0x27')](_['pick'](_0x3f6618[_0xb4bf('0x26')],_0x4d8b19[_0xb4bf('0x27')]),_0x4d4fd1);if(_0x3f6618[_0xb4bf('0x26')][_0xb4bf('0x2f')]){_0x2673a5[_0xb4bf('0x2e')]=_[_0xb4bf('0x30')](_0x2673a5['where'],{'$or':_['map'](_0x4d4fd1,function(_0x4cc5c3){if(_0x4cc5c3['type']!=='VIRTUAL'){var _0x1393b5={};_0x1393b5[_0x4cc5c3[_0xb4bf('0x1c')]]={'$like':'%'+_0x3f6618[_0xb4bf('0x26')]['filter']+'%'};return _0x1393b5;}})});}_0x2673a5=_[_0xb4bf('0x30')]({},_0x2673a5,_0x3f6618['options']);var _0x5793f0={'where':_0x2673a5['where']};return db[_0xb4bf('0x20')][_0xb4bf('0xe')](_0x5793f0)[_0xb4bf('0x11')](function(_0x16a60e){_0x15924b['count']=_0x16a60e;if(_0x3f6618[_0xb4bf('0x26')]['includeAll']){_0x2673a5['include']=[{'all':!![]}];}return db[_0xb4bf('0x20')][_0xb4bf('0x31')](_0x2673a5);})['then'](function(_0x277378){_0x15924b[_0xb4bf('0x32')]=_0x277378;return _0x15924b;})[_0xb4bf('0x11')](respondWithFilteredResult(_0x4aa17a,_0x2673a5))[_0xb4bf('0x33')](handleError(_0x4aa17a,null));};exports[_0xb4bf('0x34')]=function(_0x2a900f,_0x30ca95){var _0x2d814b={'raw':![],'where':{'id':_0x2a900f[_0xb4bf('0x35')]['id']}},_0xe9083b={};_0xe9083b[_0xb4bf('0x25')]=_['keys'](db['SquareProject']['rawAttributes']);_0xe9083b[_0xb4bf('0x26')]=_[_0xb4bf('0x36')](_0x2a900f[_0xb4bf('0x26')]);_0xe9083b[_0xb4bf('0x27')]=_[_0xb4bf('0x29')](_0xe9083b['model'],_0xe9083b[_0xb4bf('0x26')]);_0x2d814b[_0xb4bf('0x28')]=_[_0xb4bf('0x29')](_0xe9083b[_0xb4bf('0x25')],qs['fields'](_0x2a900f[_0xb4bf('0x26')][_0xb4bf('0x2a')]));_0x2d814b[_0xb4bf('0x28')]=_0x2d814b[_0xb4bf('0x28')][_0xb4bf('0x2b')]?_0x2d814b[_0xb4bf('0x28')]:_0xe9083b[_0xb4bf('0x25')];if(_0x2a900f[_0xb4bf('0x26')][_0xb4bf('0x37')]){_0x2d814b['include']=[{'all':!![]}];}_0x2d814b=_['merge']({},_0x2d814b,_0x2a900f['options']);return db[_0xb4bf('0x20')]['find'](_0x2d814b)[_0xb4bf('0x11')](handleEntityNotFound(_0x30ca95,null))[_0xb4bf('0x11')](respondWithResult(_0x30ca95,null))[_0xb4bf('0x33')](handleError(_0x30ca95,null));};exports[_0xb4bf('0x38')]=function(_0x598ce4,_0x274cfe){return db['SquareProject'][_0xb4bf('0x38')](_0x598ce4[_0xb4bf('0x39')],{})[_0xb4bf('0x11')](function(_0x4ce83b){var _0x6eaf68=_0x598ce4[_0xb4bf('0x3a')][_0xb4bf('0x13')]({'plain':!![]});if(!_0x6eaf68)throw new Error(_0xb4bf('0x3b'));if(_0x6eaf68[_0xb4bf('0x3c')]===_0xb4bf('0x3a')){var _0x303360=_0x4ce83b[_0xb4bf('0x13')]({'plain':!![]});var _0x23b9a9='SquareProjects';return db[_0xb4bf('0x3d')][_0xb4bf('0x3e')]({'where':{'name':_0x23b9a9,'userProfileId':_0x6eaf68[_0xb4bf('0x3f')]},'raw':!![]})[_0xb4bf('0x11')](function(_0x107b14){if(_0x107b14&&_0x107b14[_0xb4bf('0x40')]===0x0){return db[_0xb4bf('0x15')][_0xb4bf('0x38')]({'name':_0x303360[_0xb4bf('0x1c')],'resourceId':_0x303360['id'],'type':_0x107b14[_0xb4bf('0x1c')],'sectionId':_0x107b14['id']},{})['then'](function(){return _0x4ce83b;});}else{return _0x4ce83b;}})['catch'](function(_0x31d986){logger[_0xb4bf('0x41')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31d986);throw _0x31d986;});}return _0x4ce83b;})[_0xb4bf('0x11')](respondWithResult(_0x274cfe,0xc9))[_0xb4bf('0x33')](handleError(_0x274cfe,null));};exports[_0xb4bf('0x42')]=function(_0xe8b7dc,_0x23b689){if(_0xe8b7dc['body']['id']){delete _0xe8b7dc[_0xb4bf('0x39')]['id'];}return db[_0xb4bf('0x20')][_0xb4bf('0x3e')]({'where':{'id':_0xe8b7dc[_0xb4bf('0x35')]['id']}})['then'](handleEntityNotFound(_0x23b689,null))[_0xb4bf('0x11')](saveUpdates(_0xe8b7dc['body'],null))[_0xb4bf('0x11')](function(_0x7ebece){if(!_0x7ebece)return;var _0x3a46ee=_0x7ebece[_0xb4bf('0x13')]({'plain':!![]});return _0x3a46ee;})[_0xb4bf('0x11')](function(_0x7896ea){var _0x33d935=new Redis(config[_0xb4bf('0x6')]);_0x33d935[_0xb4bf('0x16')](_0xb4bf('0x17'),JSON[_0xb4bf('0x18')](_[_0xb4bf('0x43')](_0x7896ea,['id','name',_0xb4bf('0x44')])));return _0x7896ea;})[_0xb4bf('0x11')](respondWithResult(_0x23b689,null))[_0xb4bf('0x33')](handleError(_0x23b689,null));};exports['destroy']=function(_0x1090f1,_0xb345f7){return db[_0xb4bf('0x20')]['find']({'where':{'id':_0x1090f1['params']['id']}})['then'](handleEntityNotFound(_0xb345f7,null))[_0xb4bf('0x11')](removeEntity(_0xb345f7,null))[_0xb4bf('0x33')](handleError(_0xb345f7,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 6b2cb27..bf4a09e 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 _0xfc53=['emit','hook','exports','events','../../mysqldb','SquareProject','save','update'];(function(_0x3fffeb,_0x13b026){var _0x3a6321=function(_0x3f318d){while(--_0x3f318d){_0x3fffeb['push'](_0x3fffeb['shift']());}};_0x3a6321(++_0x13b026);}(_0xfc53,0x15b));var _0x3fc5=function(_0x3fc218,_0x503866){_0x3fc218=_0x3fc218-0x0;var _0x1e7532=_0xfc53[_0x3fc218];return _0x1e7532;};'use strict';var EventEmitter=require(_0x3fc5('0x0'));var SquareProject=require(_0x3fc5('0x1'))['db'][_0x3fc5('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3fc5('0x3'),'afterUpdate':_0x3fc5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x36faae){return function(_0x43bc8c,_0x2c5628,_0x2b0cf9){SquareProjectEvents[_0x3fc5('0x5')](_0x36faae+':'+_0x43bc8c['id'],_0x43bc8c);SquareProjectEvents[_0x3fc5('0x5')](_0x36faae,_0x43bc8c);_0x2b0cf9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x3fc5('0x6')](e,emitEvent(event));}}module[_0x3fc5('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xec3b=['SquareProject','setMaxListeners','update','remove','emit','events','../../mysqldb'];(function(_0x21086f,_0x163900){var _0x2325ae=function(_0x30833f){while(--_0x30833f){_0x21086f['push'](_0x21086f['shift']());}};_0x2325ae(++_0x163900);}(_0xec3b,0xd7));var _0xbec3=function(_0x48a398,_0x38204a){_0x48a398=_0x48a398-0x0;var _0xf1fe1f=_0xec3b[_0x48a398];return _0xf1fe1f;};'use strict';var EventEmitter=require(_0xbec3('0x0'));var SquareProject=require(_0xbec3('0x1'))['db'][_0xbec3('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xbec3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbec3('0x4'),'afterDestroy':_0xbec3('0x5')};function emitEvent(_0x2267c1){return function(_0x338d4c,_0x347fcc,_0x3832f1){SquareProjectEvents[_0xbec3('0x6')](_0x2267c1+':'+_0x338d4c['id'],_0x338d4c);SquareProjectEvents['emit'](_0x2267c1,_0x338d4c);_0x3832f1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](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 c236a86..bda0579 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 _0x7c9b=['production','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format'];(function(_0x32a032,_0x1b373b){var _0x24a388=function(_0x51daca){while(--_0x51daca){_0x32a032['push'](_0x32a032['shift']());}};_0x24a388(++_0x1b373b);}(_0x7c9b,0xbc));var _0xb7c9=function(_0x395a70,_0x59aacc){_0x395a70=_0x395a70-0x0;var _0x2c294f=_0x7c9b[_0x395a70];return _0x2c294f;};'use strict';var _=require(_0xb7c9('0x0'));var util=require('util');var logger=require(_0xb7c9('0x1'))(_0xb7c9('0x2'));var moment=require(_0xb7c9('0x3'));var BPromise=require(_0xb7c9('0x4'));var rp=require(_0xb7c9('0x5'));var fs=require('fs');var path=require(_0xb7c9('0x6'));var rimraf=require('rimraf');var config=require(_0xb7c9('0x7'));var attributes=require('./squareProject.attributes');module[_0xb7c9('0x8')]=function(_0x2e977d,_0x2c3afb){return _0x2e977d[_0xb7c9('0x9')](_0xb7c9('0xa'),attributes,{'tableName':_0xb7c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a1124,_0x3f46ef,_0x20856d){if(_0x3a1124[_0xb7c9('0xc')](_0xb7c9('0xd'))){_0x3a1124[_0xb7c9('0xe')]=moment()[_0xb7c9('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3a1124[_0xb7c9('0xc')](_0xb7c9('0x10'))){_0x3a1124['publishedAt']=moment()[_0xb7c9('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x20856d(null,_0x3a1124);}}});}; \ No newline at end of file +var _0x3cc1=['request-promise','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','util','../../config/logger','moment','bluebird'];(function(_0x535f62,_0x528d73){var _0xf490dd=function(_0x34099a){while(--_0x34099a){_0x535f62['push'](_0x535f62['shift']());}};_0xf490dd(++_0x528d73);}(_0x3cc1,0x74));var _0x13cc=function(_0x295028,_0x1e25d1){_0x295028=_0x295028-0x0;var _0x34bf4a=_0x3cc1[_0x295028];return _0x34bf4a;};'use strict';var _=require('lodash');var util=require(_0x13cc('0x0'));var logger=require(_0x13cc('0x1'))('api');var moment=require(_0x13cc('0x2'));var BPromise=require(_0x13cc('0x3'));var rp=require(_0x13cc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x13cc('0x5'));module[_0x13cc('0x6')]=function(_0xe2ab92,_0x2a4448){return _0xe2ab92['define'](_0x13cc('0x7'),attributes,{'tableName':_0x13cc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x524c8b,_0x3c1937,_0x561b3a){if(_0x524c8b[_0x13cc('0x9')](_0x13cc('0xa'))){_0x524c8b[_0x13cc('0xb')]=moment()[_0x13cc('0xc')](_0x13cc('0xd'));}if(_0x524c8b[_0x13cc('0x9')]('production')){_0x524c8b[_0x13cc('0xe')]=moment()[_0x13cc('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x561b3a(null,_0x524c8b);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 372b7fc..b31b862 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 _0x5fce=['limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','lodash','ioredis','../../mysqldb','rpc','redis','./squareProject.socket','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes'];(function(_0x4a50bf,_0x424e7b){var _0x405516=function(_0x3c9f3d){while(--_0x3c9f3d){_0x4a50bf['push'](_0x4a50bf['shift']());}};_0x405516(++_0x424e7b);}(_0x5fce,0xed));var _0xe5fc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5fce[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xe5fc('0x0'));var Redis=require(_0xe5fc('0x1'));var db=require(_0xe5fc('0x2'))['db'];var logger=require('../../config/logger')(_0xe5fc('0x3'));var config=require('../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5fc('0x4')]));require(_0xe5fc('0x5'))['register'](socket);exports[_0xe5fc('0x6')]=function(_0x252836){var _0xfa54e9=this;return new Promise(function(_0x191553,_0x4c0c3a){return db[_0xe5fc('0x7')][_0xe5fc('0x8')]({'raw':_0x252836[_0xe5fc('0x9')]?_0x252836[_0xe5fc('0x9')][_0xe5fc('0xa')]===undefined?!![]:![]:!![],'where':_0x252836[_0xe5fc('0x9')]?_0x252836[_0xe5fc('0x9')][_0xe5fc('0xb')]||null:null,'attributes':_0x252836['options']?_0x252836[_0xe5fc('0x9')][_0xe5fc('0xc')]||null:null,'limit':_0x252836[_0xe5fc('0x9')]?_0x252836[_0xe5fc('0x9')][_0xe5fc('0xd')]||null:null,'include':_0x252836[_0xe5fc('0x9')]?_0x252836[_0xe5fc('0x9')][_0xe5fc('0xe')]?_[_0xe5fc('0xf')](_0x252836[_0xe5fc('0x9')][_0xe5fc('0xe')],function(_0x10afc6){return{'model':db[_0x10afc6[_0xe5fc('0x10')]],'as':_0x10afc6['as'],'attributes':_0x10afc6['attributes'],'include':_0x10afc6[_0xe5fc('0xe')]?_[_0xe5fc('0xf')](_0x10afc6[_0xe5fc('0xe')],function(_0x38b285){return{'model':db[_0x38b285['model']],'as':_0x38b285['as'],'attributes':_0x38b285['attributes'],'include':_0x38b285['include']?_[_0xe5fc('0xf')](_0x38b285['include'],function(_0x5a88ed){return{'model':db[_0x5a88ed[_0xe5fc('0x10')]],'as':_0x5a88ed['as'],'attributes':_0x5a88ed['attributes']};}):[]};}):[]};}):[]:[]})[_0xe5fc('0x11')](function(_0x3a67d8){logger[_0xe5fc('0x12')](_0xe5fc('0x6'),_0x252836);logger[_0xe5fc('0x13')](_0xe5fc('0x6'),_0x252836,JSON[_0xe5fc('0x14')](_0x3a67d8));_0x191553(_0x3a67d8);})[_0xe5fc('0x15')](function(_0x2e93ec){logger[_0xe5fc('0x16')](_0xe5fc('0x6'),_0x2e93ec[_0xe5fc('0x17')],_0x252836);_0x4c0c3a(_0xfa54e9[_0xe5fc('0x16')](0x1f4,_0x2e93ec[_0xe5fc('0x17')]));});});};exports[_0xe5fc('0x18')]=function(_0x2743f5){var _0x75ed9d=this;return new Promise(function(_0x51ada6,_0x4e996c){return db[_0xe5fc('0x7')]['find']({'raw':_0x2743f5[_0xe5fc('0x9')]?_0x2743f5['options'][_0xe5fc('0xa')]===undefined?!![]:![]:!![],'where':_0x2743f5['options']?_0x2743f5[_0xe5fc('0x9')]['where']||null:null,'attributes':_0x2743f5[_0xe5fc('0x9')]?_0x2743f5[_0xe5fc('0x9')]['attributes']||null:null,'include':_0x2743f5['options']?_0x2743f5[_0xe5fc('0x9')]['include']?_[_0xe5fc('0xf')](_0x2743f5[_0xe5fc('0x9')][_0xe5fc('0xe')],function(_0x1f4d31){return{'model':db[_0x1f4d31[_0xe5fc('0x10')]],'as':_0x1f4d31['as'],'attributes':_0x1f4d31[_0xe5fc('0xc')],'include':_0x1f4d31[_0xe5fc('0xe')]?_['map'](_0x1f4d31[_0xe5fc('0xe')],function(_0x110c36){return{'model':db[_0x110c36[_0xe5fc('0x10')]],'as':_0x110c36['as'],'attributes':_0x110c36[_0xe5fc('0xc')],'include':_0x110c36[_0xe5fc('0xe')]?_[_0xe5fc('0xf')](_0x110c36[_0xe5fc('0xe')],function(_0x4bc725){return{'model':db[_0x4bc725[_0xe5fc('0x10')]],'as':_0x4bc725['as'],'attributes':_0x4bc725['attributes']};}):[]};}):[]};}):[]:[]})[_0xe5fc('0x11')](function(_0x1c99f2){logger[_0xe5fc('0x12')](_0xe5fc('0x18'),_0x2743f5);logger[_0xe5fc('0x13')](_0xe5fc('0x18'),_0x2743f5,JSON[_0xe5fc('0x14')](_0x1c99f2));_0x51ada6(_0x1c99f2);})[_0xe5fc('0x15')](function(_0x21d7e3){logger['error']('ShowSquareProject',_0x21d7e3[_0xe5fc('0x17')],_0x2743f5);_0x4e996c(_0x75ed9d[_0xe5fc('0x16')](0x1f4,_0x21d7e3[_0xe5fc('0x17')]));});});}; \ No newline at end of file +var _0xff49=['include','map','model','then','info','debug','stringify','catch','error','ShowSquareProject','message','../../mysqldb','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects','SquareProject','findAll','options','where','attributes','limit'];(function(_0xddccb1,_0x468b7a){var _0x44ad80=function(_0x38ac38){while(--_0x38ac38){_0xddccb1['push'](_0xddccb1['shift']());}};_0x44ad80(++_0x468b7a);}(_0xff49,0x191));var _0x9ff4=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xff49[_0x3070dc];return _0x431489;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0x9ff4('0x0'))['db'];var logger=require('../../config/logger')(_0x9ff4('0x1'));var config=require(_0x9ff4('0x2'));config['redis']=_[_0x9ff4('0x3')](config[_0x9ff4('0x4')],{'host':_0x9ff4('0x5'),'port':0x18eb});var socket=require(_0x9ff4('0x6'))(new Redis(config[_0x9ff4('0x4')]));require(_0x9ff4('0x7'))['register'](socket);exports[_0x9ff4('0x8')]=function(_0x37104d){var _0x745e1b=this;return new Promise(function(_0x527d21,_0x5bb489){return db[_0x9ff4('0x9')][_0x9ff4('0xa')]({'raw':_0x37104d['options']?_0x37104d[_0x9ff4('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x37104d[_0x9ff4('0xb')]?_0x37104d[_0x9ff4('0xb')][_0x9ff4('0xc')]||null:null,'attributes':_0x37104d['options']?_0x37104d['options'][_0x9ff4('0xd')]||null:null,'limit':_0x37104d[_0x9ff4('0xb')]?_0x37104d['options'][_0x9ff4('0xe')]||null:null,'include':_0x37104d[_0x9ff4('0xb')]?_0x37104d['options'][_0x9ff4('0xf')]?_[_0x9ff4('0x10')](_0x37104d[_0x9ff4('0xb')][_0x9ff4('0xf')],function(_0x1c989b){return{'model':db[_0x1c989b[_0x9ff4('0x11')]],'as':_0x1c989b['as'],'attributes':_0x1c989b[_0x9ff4('0xd')],'include':_0x1c989b[_0x9ff4('0xf')]?_[_0x9ff4('0x10')](_0x1c989b['include'],function(_0x15d60d){return{'model':db[_0x15d60d['model']],'as':_0x15d60d['as'],'attributes':_0x15d60d['attributes'],'include':_0x15d60d[_0x9ff4('0xf')]?_['map'](_0x15d60d[_0x9ff4('0xf')],function(_0x3ea74c){return{'model':db[_0x3ea74c[_0x9ff4('0x11')]],'as':_0x3ea74c['as'],'attributes':_0x3ea74c[_0x9ff4('0xd')]};}):[]};}):[]};}):[]:[]})[_0x9ff4('0x12')](function(_0x399272){logger[_0x9ff4('0x13')](_0x9ff4('0x8'),_0x37104d);logger[_0x9ff4('0x14')](_0x9ff4('0x8'),_0x37104d,JSON[_0x9ff4('0x15')](_0x399272));_0x527d21(_0x399272);})[_0x9ff4('0x16')](function(_0x9b6cae){logger[_0x9ff4('0x17')](_0x9ff4('0x8'),_0x9b6cae['message'],_0x37104d);_0x5bb489(_0x745e1b['error'](0x1f4,_0x9b6cae['message']));});});};exports[_0x9ff4('0x18')]=function(_0x273fb1){var _0x1566de=this;return new Promise(function(_0x53053f,_0x224ae9){return db['SquareProject']['find']({'raw':_0x273fb1['options']?_0x273fb1['options']['raw']===undefined?!![]:![]:!![],'where':_0x273fb1[_0x9ff4('0xb')]?_0x273fb1['options'][_0x9ff4('0xc')]||null:null,'attributes':_0x273fb1[_0x9ff4('0xb')]?_0x273fb1[_0x9ff4('0xb')][_0x9ff4('0xd')]||null:null,'include':_0x273fb1['options']?_0x273fb1[_0x9ff4('0xb')][_0x9ff4('0xf')]?_[_0x9ff4('0x10')](_0x273fb1['options'][_0x9ff4('0xf')],function(_0x352e4b){return{'model':db[_0x352e4b['model']],'as':_0x352e4b['as'],'attributes':_0x352e4b[_0x9ff4('0xd')],'include':_0x352e4b[_0x9ff4('0xf')]?_[_0x9ff4('0x10')](_0x352e4b[_0x9ff4('0xf')],function(_0x4a9fa1){return{'model':db[_0x4a9fa1[_0x9ff4('0x11')]],'as':_0x4a9fa1['as'],'attributes':_0x4a9fa1[_0x9ff4('0xd')],'include':_0x4a9fa1['include']?_[_0x9ff4('0x10')](_0x4a9fa1['include'],function(_0x35b1e2){return{'model':db[_0x35b1e2[_0x9ff4('0x11')]],'as':_0x35b1e2['as'],'attributes':_0x35b1e2[_0x9ff4('0xd')]};}):[]};}):[]};}):[]:[]})[_0x9ff4('0x12')](function(_0x5b4733){logger[_0x9ff4('0x13')](_0x9ff4('0x18'),_0x273fb1);logger['debug'](_0x9ff4('0x18'),_0x273fb1,JSON[_0x9ff4('0x15')](_0x5b4733));_0x53053f(_0x5b4733);})['catch'](function(_0x5af9b3){logger[_0x9ff4('0x17')]('ShowSquareProject',_0x5af9b3['message'],_0x273fb1);_0x224ae9(_0x1566de[_0x9ff4('0x17')](0x1f4,_0x5af9b3[_0x9ff4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 4fd8065..33be1bf 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 _0x77d9=['length','squareProject:','save','update'];(function(_0x3c9f41,_0x8e3665){var _0xbc4407=function(_0x1fbd58){while(--_0x1fbd58){_0x3c9f41['push'](_0x3c9f41['shift']());}};_0xbc4407(++_0x8e3665);}(_0x77d9,0x1b2));var _0x977d=function(_0x895ad0,_0xf67203){_0x895ad0=_0x895ad0-0x0;var _0x3d32f9=_0x77d9[_0x895ad0];return _0x3d32f9;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x977d('0x0'),'remove',_0x977d('0x1')];function createListener(_0x438d49,_0x3f715c){return function(_0xb9293){_0x3f715c['emit'](_0x438d49,_0xb9293);};}function removeListener(_0x47308d,_0x2c48b1){return function(){SquareProjectEvents['removeListener'](_0x47308d,_0x2c48b1);};}exports['register']=function(_0x285b0d){for(var _0x2eca21=0x0,_0x9e97cc=events[_0x977d('0x2')];_0x2eca21<_0x9e97cc;_0x2eca21++){var _0x2d41f9=events[_0x2eca21];var _0x1c40fc=createListener(_0x977d('0x3')+_0x2d41f9,_0x285b0d);SquareProjectEvents['on'](_0x2d41f9,_0x1c40fc);}}; \ No newline at end of file +var _0x9c76=['update','removeListener','length','./squareProject.events','save'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9c76,0x67));var _0x69c7=function(_0x79ac34,_0x975345){_0x79ac34=_0x79ac34-0x0;var _0xd311b4=_0x9c76[_0x79ac34];return _0xd311b4;};'use strict';var SquareProjectEvents=require(_0x69c7('0x0'));var events=[_0x69c7('0x1'),'remove',_0x69c7('0x2')];function createListener(_0x52b4c3,_0x2edae9){return function(_0xcfe40e){_0x2edae9['emit'](_0x52b4c3,_0xcfe40e);};}function removeListener(_0x1313e8,_0x547c87){return function(){SquareProjectEvents[_0x69c7('0x3')](_0x1313e8,_0x547c87);};}exports['register']=function(_0x3973ab){for(var _0xbf149f=0x0,_0x4c1616=events[_0x69c7('0x4')];_0xbf149f<_0x4c1616;_0xbf149f++){var _0x5023ec=events[_0xbf149f];var _0x8da6b0=createListener('squareProject:'+_0x5023ec,_0x3973ab);SquareProjectEvents['on'](_0x5023ec,_0x8da6b0);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 78a5f73..752063c 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4c3911,_0x51b94a){var _0x2fee87=function(_0x3ff647){while(--_0x3ff647){_0x4c3911['push'](_0x4c3911['shift']());}};_0x2fee87(++_0x51b94a);}(_0x4975,0x86));var _0x5497=function(_0x3a8b00,_0x3a239f){_0x3a8b00=_0x3a8b00-0x0;var _0x7b9f79=_0x4975[_0x3a8b00];return _0x7b9f79;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xe15243,_0x167e94){var _0x1107ea=function(_0x35be4b){while(--_0x35be4b){_0xe15243['push'](_0xe15243['shift']());}};_0x1107ea(++_0x167e94);}(_0xf494,0x1c6));var _0x4f49=function(_0x10386d,_0x487b9c){_0x10386d=_0x10386d-0x0;var _0xfe9741=_0xf494[_0x10386d];return _0xfe9741;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9323e40..0e20ba5 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 _0x425d=['getDataValue','savePath','substring','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x29f781,_0x4867ae){var _0xaa0331=function(_0x2f8a55){while(--_0x2f8a55){_0x29f781['push'](_0x29f781['shift']());}};_0xaa0331(++_0x4867ae);}(_0x425d,0x1e0));var _0xd425=function(_0x343e70,_0xe5f373){_0x343e70=_0x343e70-0x0;var _0x2742fd=_0x425d[_0x343e70];return _0x2742fd;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'callerid':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'extension':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd425('0x1')]},'saveName':{'type':Sequelize[_0xd425('0x1')]},'filename':{'type':Sequelize[_0xd425('0x1')]},'savePath':{'type':Sequelize[_0xd425('0x1')]},'format':{'type':Sequelize[_0xd425('0x2')],'get':function(){var _0x1d2ed0='';var _0x50b061=this[_0xd425('0x3')](_0xd425('0x4'));if(_0x50b061){_0x1d2ed0=_0x50b061[_0xd425('0x5')](_0x50b061[_0xd425('0x6')]('.'));}return _0x1d2ed0;}}}; \ No newline at end of file +var _0xbd51=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','STRING'];(function(_0x449a30,_0x58fc65){var _0x7d38ca=function(_0x875037){while(--_0x875037){_0x449a30['push'](_0x449a30['shift']());}};_0x7d38ca(++_0x58fc65);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x306bdb,_0x409e20){_0x306bdb=_0x306bdb-0x0;var _0xef8e7f=_0xbd51[_0x306bdb];return _0xef8e7f;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1bd5('0x1')]},'callerid':{'type':Sequelize[_0x1bd5('0x1')]},'calleridname':{'type':Sequelize[_0x1bd5('0x1')]},'context':{'type':Sequelize[_0x1bd5('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x1bd5('0x1')]},'saveName':{'type':Sequelize[_0x1bd5('0x1')]},'filename':{'type':Sequelize[_0x1bd5('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1bd5('0x2')],'get':function(){var _0x30a385='';var _0x19077c=this[_0x1bd5('0x3')](_0x1bd5('0x4'));if(_0x19077c){_0x30a385=_0x19077c['substring'](_0x19077c[_0x1bd5('0x5')]('.'));}return _0x30a385;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 8799fa1..fb22ab1 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 _0xdc5e=['params','keys','filters','includeAll','merge','find','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','unlink','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','.cypher','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','findAll','rows','catch'];(function(_0x313b77,_0x579e14){var _0x2a35ab=function(_0x1fe8c7){while(--_0x1fe8c7){_0x313b77['push'](_0x313b77['shift']());}};_0x2a35ab(++_0x579e14);}(_0xdc5e,0x131));var _0xedc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc5e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedc5('0x0'));var zipdir=require(_0xedc5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xedc5('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xedc5('0x3'));var util=require(_0xedc5('0x4'));var path=require(_0xedc5('0x5'));var sox=require(_0xedc5('0x6'));var csv=require(_0xedc5('0x7'));var ejs=require(_0xedc5('0x8'));var fs=require('fs');var fs_extra=require(_0xedc5('0x9'));var _=require('lodash');var squel=require(_0xedc5('0xa'));var crypto=require(_0xedc5('0xb'));var jsforce=require(_0xedc5('0xc'));var deskjs=require(_0xedc5('0xd'));var toCsv=require(_0xedc5('0x7'));var querystring=require(_0xedc5('0xe'));var Papa=require(_0xedc5('0xf'));var Redis=require(_0xedc5('0x10'));var authService=require(_0xedc5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xedc5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedc5('0x13'));var utils=require(_0xedc5('0x14'));var config=require(_0xedc5('0x15'));var licenseUtil=require(_0xedc5('0x16'));var db=require(_0xedc5('0x17'))['db'];function respondWithStatusCode(_0x1debe0,_0x40bc34){_0x40bc34=_0x40bc34||0xcc;return function(_0x5f3369){if(_0x5f3369){return _0x1debe0[_0xedc5('0x18')](_0x40bc34);}return _0x1debe0[_0xedc5('0x19')](_0x40bc34)[_0xedc5('0x1a')]();};}function respondWithResult(_0x439f2b,_0x1b00de){_0x1b00de=_0x1b00de||0xc8;return function(_0x583b4f){if(_0x583b4f){return _0x439f2b['status'](_0x1b00de)[_0xedc5('0x1b')](_0x583b4f);}};}function respondWithFilteredResult(_0x1fd4cf,_0x439b62){return function(_0x5edc3c){if(_0x5edc3c){var _0x3efaa3=typeof _0x439b62[_0xedc5('0x1c')]===_0xedc5('0x1d')&&typeof _0x439b62[_0xedc5('0x1e')]===_0xedc5('0x1d');var _0x1a8e4f=_0x5edc3c[_0xedc5('0x1f')];var _0x1cab67=_0x3efaa3?0x0:_0x439b62[_0xedc5('0x1c')];var _0x2711ef=_0x3efaa3?_0x5edc3c[_0xedc5('0x1f')]:_0x439b62[_0xedc5('0x1c')]+_0x439b62[_0xedc5('0x1e')];var _0x708e71;if(_0x2711ef>=_0x1a8e4f){_0x2711ef=_0x1a8e4f;_0x708e71=0xc8;}else{_0x708e71=0xce;}_0x1fd4cf[_0xedc5('0x19')](_0x708e71);return _0x1fd4cf[_0xedc5('0x20')](_0xedc5('0x21'),_0x1cab67+'-'+_0x2711ef+'/'+_0x1a8e4f)[_0xedc5('0x1b')](_0x5edc3c);}return null;};}function patchUpdates(_0x1165a4){return function(_0x33d21e){try{jsonpatch[_0xedc5('0x22')](_0x33d21e,_0x1165a4,!![]);}catch(_0xf24ecb){return BPromise[_0xedc5('0x23')](_0xf24ecb);}return _0x33d21e[_0xedc5('0x24')]();};}function saveUpdates(_0x1a559c,_0x1916a0){return function(_0x3db89d){if(_0x3db89d){return _0x3db89d[_0xedc5('0x25')](_0x1a559c)[_0xedc5('0x26')](function(_0x3a138e){return _0x3a138e;});}return null;};}function removeEntity(_0x150ba2,_0x578c49){return function(_0xa3d311){if(_0xa3d311){return _0xa3d311[_0xedc5('0x27')]()[_0xedc5('0x26')](function(){_0x150ba2[_0xedc5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ab6fb,_0x202954){return function(_0x1f8901){if(!_0x1f8901){_0x2ab6fb[_0xedc5('0x18')](0x194);}return _0x1f8901;};}function handleError(_0x2084c4,_0x29665a){_0x29665a=_0x29665a||0x1f4;return function(_0x14a5d6){logger[_0xedc5('0x28')](_0x14a5d6[_0xedc5('0x29')]);if(_0x14a5d6[_0xedc5('0x2a')]){delete _0x14a5d6['name'];}_0x2084c4[_0xedc5('0x19')](_0x29665a)[_0xedc5('0x2b')](_0x14a5d6);};}exports['index']=function(_0x2987d7,_0x206ec6){var _0x1370c9={},_0x563169={},_0x5300cb={'count':0x0,'rows':[]};var _0x53fc09=_[_0xedc5('0x2c')](db[_0xedc5('0x2d')][_0xedc5('0x2e')],function(_0x41d425){return{'name':_0x41d425[_0xedc5('0x2f')],'type':_0x41d425[_0xedc5('0x30')][_0xedc5('0x31')]};});_0x563169[_0xedc5('0x32')]=_[_0xedc5('0x2c')](_0x53fc09,_0xedc5('0x2a'));_0x563169[_0xedc5('0x33')]=_['keys'](_0x2987d7[_0xedc5('0x33')]);_0x563169['filters']=_[_0xedc5('0x34')](_0x563169['model'],_0x563169[_0xedc5('0x33')]);_0x1370c9[_0xedc5('0x35')]=_[_0xedc5('0x34')](_0x563169['model'],qs[_0xedc5('0x36')](_0x2987d7['query'][_0xedc5('0x36')]));_0x1370c9[_0xedc5('0x35')]=_0x1370c9[_0xedc5('0x35')][_0xedc5('0x37')]?_0x1370c9[_0xedc5('0x35')]:_0x563169[_0xedc5('0x32')];if(!_0x2987d7[_0xedc5('0x33')][_0xedc5('0x38')]('nolimit')){_0x1370c9[_0xedc5('0x1e')]=qs[_0xedc5('0x1e')](_0x2987d7[_0xedc5('0x33')]['limit']);_0x1370c9[_0xedc5('0x1c')]=qs[_0xedc5('0x1c')](_0x2987d7[_0xedc5('0x33')][_0xedc5('0x1c')]);}_0x1370c9[_0xedc5('0x39')]=qs[_0xedc5('0x3a')](_0x2987d7[_0xedc5('0x33')]['sort']);_0x1370c9['where']=qs['filters'](_[_0xedc5('0x3b')](_0x2987d7[_0xedc5('0x33')],_0x563169['filters']),_0x53fc09);if(_0x2987d7[_0xedc5('0x33')][_0xedc5('0x3c')]){_0x1370c9[_0xedc5('0x3d')]=_['merge'](_0x1370c9['where'],{'$or':_[_0xedc5('0x2c')](_0x53fc09,function(_0x4622a3){if(_0x4622a3['type']!==_0xedc5('0x3e')){var _0x1a802c={};_0x1a802c[_0x4622a3[_0xedc5('0x2a')]]={'$like':'%'+_0x2987d7['query'][_0xedc5('0x3c')]+'%'};return _0x1a802c;}})});}_0x1370c9=_['merge']({},_0x1370c9,_0x2987d7[_0xedc5('0x3f')]);var _0x240971={'where':_0x1370c9[_0xedc5('0x3d')]};return db[_0xedc5('0x2d')]['count'](_0x240971)[_0xedc5('0x26')](function(_0x241775){_0x5300cb[_0xedc5('0x1f')]=_0x241775;if(_0x2987d7[_0xedc5('0x33')]['includeAll']){_0x1370c9['include']=[{'all':!![]}];}return db[_0xedc5('0x2d')][_0xedc5('0x40')](_0x1370c9);})[_0xedc5('0x26')](function(_0x130413){_0x5300cb[_0xedc5('0x41')]=_0x130413;return _0x5300cb;})[_0xedc5('0x26')](respondWithFilteredResult(_0x206ec6,_0x1370c9))[_0xedc5('0x42')](handleError(_0x206ec6,null));};exports['show']=function(_0x182dad,_0x9bac63){var _0x3e309e={'raw':!![],'where':{'id':_0x182dad[_0xedc5('0x43')]['id']}},_0x2b75d2={};_0x2b75d2[_0xedc5('0x32')]=_['keys'](db[_0xedc5('0x2d')][_0xedc5('0x2e')]);_0x2b75d2[_0xedc5('0x33')]=_[_0xedc5('0x44')](_0x182dad['query']);_0x2b75d2[_0xedc5('0x45')]=_['intersection'](_0x2b75d2[_0xedc5('0x32')],_0x2b75d2['query']);_0x3e309e[_0xedc5('0x35')]=_[_0xedc5('0x34')](_0x2b75d2['model'],qs['fields'](_0x182dad[_0xedc5('0x33')][_0xedc5('0x36')]));_0x3e309e[_0xedc5('0x35')]=_0x3e309e[_0xedc5('0x35')][_0xedc5('0x37')]?_0x3e309e[_0xedc5('0x35')]:_0x2b75d2[_0xedc5('0x32')];if(_0x182dad[_0xedc5('0x33')][_0xedc5('0x46')]){_0x3e309e['include']=[{'all':!![]}];}_0x3e309e=_[_0xedc5('0x47')]({},_0x3e309e,_0x182dad[_0xedc5('0x3f')]);return db[_0xedc5('0x2d')][_0xedc5('0x48')](_0x3e309e)['then'](handleEntityNotFound(_0x9bac63,null))[_0xedc5('0x26')](respondWithResult(_0x9bac63,null))[_0xedc5('0x42')](handleError(_0x9bac63,null));};exports['create']=function(_0x53cbd1,_0x48632c){return db[_0xedc5('0x2d')]['create'](_0x53cbd1['body'],{})['then'](respondWithResult(_0x48632c,0xc9))['catch'](handleError(_0x48632c,null));};exports['update']=function(_0x69e431,_0x3c787a){if(_0x69e431[_0xedc5('0x49')]['id']){delete _0x69e431[_0xedc5('0x49')]['id'];}return db['SquareRecording'][_0xedc5('0x48')]({'where':{'id':_0x69e431[_0xedc5('0x43')]['id']}})[_0xedc5('0x26')](handleEntityNotFound(_0x3c787a,null))[_0xedc5('0x26')](saveUpdates(_0x69e431[_0xedc5('0x49')],null))[_0xedc5('0x26')](respondWithResult(_0x3c787a,null))['catch'](handleError(_0x3c787a,null));};exports[_0xedc5('0x4a')]=function(_0x2c5277,_0x350966,_0x484f66){var _0x3511b5=require(_0xedc5('0x4b'));var _0x4faa48=![];var _0x14001a={};if(_0x2c5277[_0xedc5('0x33')][_0xedc5('0x30')]&&_0x2c5277[_0xedc5('0x33')][_0xedc5('0x30')]===_0xedc5('0x4c')){_0x14001a[_0xedc5('0x4c')]=_0x2c5277['params']['id'];}else{_0x14001a['id']=_0x2c5277[_0xedc5('0x43')]['id'];}return db[_0xedc5('0x2d')][_0xedc5('0x48')]({'where':_0x14001a,'attributes':['id',_0xedc5('0x4d'),_0xedc5('0x4e')],'raw':!![]})[_0xedc5('0x26')](handleEntityNotFound(_0x350966,null))[_0xedc5('0x26')](function(_0x5e1115){if(_0x5e1115){var _0x22bcb9=_0x5e1115['savePath'];var _0x4fa295=util[_0xedc5('0x4f')](_0xedc5('0x50'),_0x22bcb9);if(fs[_0xedc5('0x51')](_0x4fa295)){_0x4faa48=!![];return _0x3511b5[_0xedc5('0x52')](_0x4fa295,_0x22bcb9,config[_0xedc5('0x53')][_0xedc5('0x54')])['then'](function(){return _0x5e1115;});}return _0x5e1115;}})[_0xedc5('0x26')](function(_0x46c9bd){if(_0x46c9bd){var _0x5e8704=_0x46c9bd['savePath'];if(!fs[_0xedc5('0x51')](_0x5e8704)){throw new db['Sequelize'][(_0xedc5('0x55'))](_0xedc5('0x56'));}if(_0x46c9bd[_0xedc5('0x4e')]){return _0x350966[_0xedc5('0x4a')](_0x5e8704,_0x46c9bd[_0xedc5('0x4e')]+path['extname'](_0x5e8704),function(){if(_0x4faa48){fs[_0xedc5('0x57')](_0x5e8704);}});}else{return _0x350966['download'](_0x5e8704,function(_0xbaf91e){if(_0x4faa48){fs[_0xedc5('0x57')](_0x5e8704);}});}}})[_0xedc5('0x42')](function(_0x3d66fe){if(_0x3d66fe['message']==='SquareRecording\x20not\x20found'){_0x350966[_0xedc5('0x19')](0x194)[_0xedc5('0x2b')]('Not\x20found');}else{return handleError(_0x350966,null);}});};exports[_0xedc5('0x27')]=function(_0x8b3afd,_0x17967f){return db[_0xedc5('0x2d')][_0xedc5('0x48')]({'where':{'id':_0x8b3afd[_0xedc5('0x43')]['id']}})[_0xedc5('0x26')](function(_0x2cd731){if(_[_0xedc5('0x58')](_0x2cd731)){throw new ReferenceError(_0xedc5('0x59'));}return _0x2cd731;})[_0xedc5('0x26')](function(_0x8870c0){var _0x54bd4c=_0x8870c0['savePath'];logger['info'](_0xedc5('0x5a'),_0x54bd4c);if(!_['isNil'](_0x8870c0[_0xedc5('0x4d')])&&fs[_0xedc5('0x51')](_0x54bd4c)){logger[_0xedc5('0x5b')]('File:\x20\x22'+_0x54bd4c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x54bd4c);}_0x54bd4c=_0x54bd4c+_0xedc5('0x5c');if(!_[_0xedc5('0x58')](_0x8870c0['savePath'])&&fs[_0xedc5('0x51')](_0x54bd4c)){logger[_0xedc5('0x5b')]('File:\x20\x22'+_0x54bd4c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x54bd4c);}return _0x8870c0;})[_0xedc5('0x26')](function(_0x25dd6){if(!_0x25dd6)throw new InternalError();return _0x25dd6[_0xedc5('0x27')]();})[_0xedc5('0x26')](function(){_0x17967f[_0xedc5('0x19')](0xcc)[_0xedc5('0x1a')]();})['catch'](handleError(_0x17967f,null));}; \ No newline at end of file +var _0x5b83=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','SquareRecording','findAll','rows','catch','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x5b83,0x1cf));var _0x35b8=function(_0x2ff504,_0x2b84bf){_0x2ff504=_0x2ff504-0x0;var _0x2e3927=_0x5b83[_0x2ff504];return _0x2e3927;};'use strict';var emlformat=require(_0x35b8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x35b8('0x1'));var moment=require('moment');var BPromise=require(_0x35b8('0x2'));var Mustache=require(_0x35b8('0x3'));var util=require(_0x35b8('0x4'));var path=require(_0x35b8('0x5'));var sox=require(_0x35b8('0x6'));var csv=require(_0x35b8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x35b8('0x8'));var _=require(_0x35b8('0x9'));var squel=require(_0x35b8('0xa'));var crypto=require(_0x35b8('0xb'));var jsforce=require(_0x35b8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x35b8('0x7'));var querystring=require(_0x35b8('0xd'));var Papa=require(_0x35b8('0xe'));var Redis=require('ioredis');var authService=require(_0x35b8('0xf'));var qs=require(_0x35b8('0x10'));var as=require(_0x35b8('0x11'));var hardwareService=require(_0x35b8('0x12'));var logger=require(_0x35b8('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x35b8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56806d,_0x4cf0bb){_0x4cf0bb=_0x4cf0bb||0xcc;return function(_0x3f7905){if(_0x3f7905){return _0x56806d[_0x35b8('0x15')](_0x4cf0bb);}return _0x56806d[_0x35b8('0x16')](_0x4cf0bb)[_0x35b8('0x17')]();};}function respondWithResult(_0x20f969,_0x13c6c9){_0x13c6c9=_0x13c6c9||0xc8;return function(_0x537e89){if(_0x537e89){return _0x20f969[_0x35b8('0x16')](_0x13c6c9)[_0x35b8('0x18')](_0x537e89);}};}function respondWithFilteredResult(_0x3d0ad5,_0x5b48e0){return function(_0x22b129){if(_0x22b129){var _0x10f2a2=typeof _0x5b48e0[_0x35b8('0x19')]===_0x35b8('0x1a')&&typeof _0x5b48e0[_0x35b8('0x1b')]==='undefined';var _0x542a06=_0x22b129[_0x35b8('0x1c')];var _0x3323b3=_0x10f2a2?0x0:_0x5b48e0['offset'];var _0x49f00e=_0x10f2a2?_0x22b129[_0x35b8('0x1c')]:_0x5b48e0[_0x35b8('0x19')]+_0x5b48e0[_0x35b8('0x1b')];var _0x2b538c;if(_0x49f00e>=_0x542a06){_0x49f00e=_0x542a06;_0x2b538c=0xc8;}else{_0x2b538c=0xce;}_0x3d0ad5['status'](_0x2b538c);return _0x3d0ad5[_0x35b8('0x1d')](_0x35b8('0x1e'),_0x3323b3+'-'+_0x49f00e+'/'+_0x542a06)[_0x35b8('0x18')](_0x22b129);}return null;};}function patchUpdates(_0x2d4f8d){return function(_0x5ad6f4){try{jsonpatch[_0x35b8('0x1f')](_0x5ad6f4,_0x2d4f8d,!![]);}catch(_0x59f93e){return BPromise[_0x35b8('0x20')](_0x59f93e);}return _0x5ad6f4[_0x35b8('0x21')]();};}function saveUpdates(_0x548c01,_0x2e387a){return function(_0x3e3998){if(_0x3e3998){return _0x3e3998[_0x35b8('0x22')](_0x548c01)[_0x35b8('0x23')](function(_0x4a5f98){return _0x4a5f98;});}return null;};}function removeEntity(_0x63302b,_0x2d83a8){return function(_0x3e1ee7){if(_0x3e1ee7){return _0x3e1ee7[_0x35b8('0x24')]()['then'](function(){_0x63302b[_0x35b8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x240c5b,_0x4372e5){return function(_0x5a1a4d){if(!_0x5a1a4d){_0x240c5b['sendStatus'](0x194);}return _0x5a1a4d;};}function handleError(_0x2e2ad6,_0x2eb00e){_0x2eb00e=_0x2eb00e||0x1f4;return function(_0x52a0c6){logger[_0x35b8('0x25')](_0x52a0c6[_0x35b8('0x26')]);if(_0x52a0c6[_0x35b8('0x27')]){delete _0x52a0c6['name'];}_0x2e2ad6[_0x35b8('0x16')](_0x2eb00e)[_0x35b8('0x28')](_0x52a0c6);};}exports[_0x35b8('0x29')]=function(_0x147f58,_0x571f9c){var _0x4cdc21={},_0x2ab4c6={},_0x7e0ea1={'count':0x0,'rows':[]};var _0x2e6aa4=_[_0x35b8('0x2a')](db['SquareRecording'][_0x35b8('0x2b')],function(_0x24aad8){return{'name':_0x24aad8[_0x35b8('0x2c')],'type':_0x24aad8[_0x35b8('0x2d')][_0x35b8('0x2e')]};});_0x2ab4c6[_0x35b8('0x2f')]=_['map'](_0x2e6aa4,_0x35b8('0x27'));_0x2ab4c6[_0x35b8('0x30')]=_[_0x35b8('0x31')](_0x147f58[_0x35b8('0x30')]);_0x2ab4c6[_0x35b8('0x32')]=_[_0x35b8('0x33')](_0x2ab4c6['model'],_0x2ab4c6[_0x35b8('0x30')]);_0x4cdc21['attributes']=_[_0x35b8('0x33')](_0x2ab4c6[_0x35b8('0x2f')],qs[_0x35b8('0x34')](_0x147f58[_0x35b8('0x30')][_0x35b8('0x34')]));_0x4cdc21[_0x35b8('0x35')]=_0x4cdc21[_0x35b8('0x35')][_0x35b8('0x36')]?_0x4cdc21[_0x35b8('0x35')]:_0x2ab4c6[_0x35b8('0x2f')];if(!_0x147f58[_0x35b8('0x30')][_0x35b8('0x37')](_0x35b8('0x38'))){_0x4cdc21['limit']=qs[_0x35b8('0x1b')](_0x147f58[_0x35b8('0x30')][_0x35b8('0x1b')]);_0x4cdc21[_0x35b8('0x19')]=qs['offset'](_0x147f58[_0x35b8('0x30')][_0x35b8('0x19')]);}_0x4cdc21[_0x35b8('0x39')]=qs['sort'](_0x147f58[_0x35b8('0x30')][_0x35b8('0x3a')]);_0x4cdc21['where']=qs[_0x35b8('0x32')](_['pick'](_0x147f58['query'],_0x2ab4c6[_0x35b8('0x32')]),_0x2e6aa4);if(_0x147f58['query'][_0x35b8('0x3b')]){_0x4cdc21[_0x35b8('0x3c')]=_['merge'](_0x4cdc21[_0x35b8('0x3c')],{'$or':_[_0x35b8('0x2a')](_0x2e6aa4,function(_0x5a8621){if(_0x5a8621['type']!==_0x35b8('0x3d')){var _0x1084e8={};_0x1084e8[_0x5a8621[_0x35b8('0x27')]]={'$like':'%'+_0x147f58[_0x35b8('0x30')][_0x35b8('0x3b')]+'%'};return _0x1084e8;}})});}_0x4cdc21=_[_0x35b8('0x3e')]({},_0x4cdc21,_0x147f58[_0x35b8('0x3f')]);var _0x26fd5f={'where':_0x4cdc21['where']};return db['SquareRecording']['count'](_0x26fd5f)[_0x35b8('0x23')](function(_0x55caf2){_0x7e0ea1['count']=_0x55caf2;if(_0x147f58['query'][_0x35b8('0x40')]){_0x4cdc21[_0x35b8('0x41')]=[{'all':!![]}];}return db[_0x35b8('0x42')][_0x35b8('0x43')](_0x4cdc21);})['then'](function(_0x5898f2){_0x7e0ea1[_0x35b8('0x44')]=_0x5898f2;return _0x7e0ea1;})[_0x35b8('0x23')](respondWithFilteredResult(_0x571f9c,_0x4cdc21))[_0x35b8('0x45')](handleError(_0x571f9c,null));};exports['show']=function(_0x312519,_0x5ebd9e){var _0x301aaa={'raw':!![],'where':{'id':_0x312519['params']['id']}},_0x10b110={};_0x10b110[_0x35b8('0x2f')]=_['keys'](db[_0x35b8('0x42')][_0x35b8('0x2b')]);_0x10b110[_0x35b8('0x30')]=_[_0x35b8('0x31')](_0x312519[_0x35b8('0x30')]);_0x10b110[_0x35b8('0x32')]=_[_0x35b8('0x33')](_0x10b110[_0x35b8('0x2f')],_0x10b110[_0x35b8('0x30')]);_0x301aaa['attributes']=_[_0x35b8('0x33')](_0x10b110['model'],qs[_0x35b8('0x34')](_0x312519[_0x35b8('0x30')][_0x35b8('0x34')]));_0x301aaa[_0x35b8('0x35')]=_0x301aaa[_0x35b8('0x35')][_0x35b8('0x36')]?_0x301aaa[_0x35b8('0x35')]:_0x10b110[_0x35b8('0x2f')];if(_0x312519[_0x35b8('0x30')][_0x35b8('0x40')]){_0x301aaa[_0x35b8('0x41')]=[{'all':!![]}];}_0x301aaa=_[_0x35b8('0x3e')]({},_0x301aaa,_0x312519[_0x35b8('0x3f')]);return db[_0x35b8('0x42')][_0x35b8('0x46')](_0x301aaa)[_0x35b8('0x23')](handleEntityNotFound(_0x5ebd9e,null))[_0x35b8('0x23')](respondWithResult(_0x5ebd9e,null))[_0x35b8('0x45')](handleError(_0x5ebd9e,null));};exports['create']=function(_0x552760,_0x351b4a){return db['SquareRecording'][_0x35b8('0x47')](_0x552760[_0x35b8('0x48')],{})[_0x35b8('0x23')](respondWithResult(_0x351b4a,0xc9))['catch'](handleError(_0x351b4a,null));};exports['update']=function(_0x416872,_0x191bfb){if(_0x416872['body']['id']){delete _0x416872[_0x35b8('0x48')]['id'];}return db[_0x35b8('0x42')]['find']({'where':{'id':_0x416872[_0x35b8('0x49')]['id']}})[_0x35b8('0x23')](handleEntityNotFound(_0x191bfb,null))[_0x35b8('0x23')](saveUpdates(_0x416872['body'],null))[_0x35b8('0x23')](respondWithResult(_0x191bfb,null))['catch'](handleError(_0x191bfb,null));};exports[_0x35b8('0x4a')]=function(_0x3e4305,_0x4f628f,_0x2a2d41){var _0x12f7f4=require(_0x35b8('0x4b'));var _0x9b223c=![];var _0x2c4a30={};if(_0x3e4305[_0x35b8('0x30')][_0x35b8('0x2d')]&&_0x3e4305[_0x35b8('0x30')]['type']===_0x35b8('0x4c')){_0x2c4a30[_0x35b8('0x4c')]=_0x3e4305['params']['id'];}else{_0x2c4a30['id']=_0x3e4305['params']['id'];}return db[_0x35b8('0x42')][_0x35b8('0x46')]({'where':_0x2c4a30,'attributes':['id',_0x35b8('0x4d'),'filename'],'raw':!![]})[_0x35b8('0x23')](handleEntityNotFound(_0x4f628f,null))[_0x35b8('0x23')](function(_0x2c3ede){if(_0x2c3ede){var _0x71a07a=_0x2c3ede[_0x35b8('0x4d')];var _0x557f2=util[_0x35b8('0x4e')](_0x35b8('0x4f'),_0x71a07a);if(fs['existsSync'](_0x557f2)){_0x9b223c=!![];return _0x12f7f4[_0x35b8('0x50')](_0x557f2,_0x71a07a,config[_0x35b8('0x51')][_0x35b8('0x52')])[_0x35b8('0x23')](function(){return _0x2c3ede;});}return _0x2c3ede;}})[_0x35b8('0x23')](function(_0x2b20da){if(_0x2b20da){var _0x460032=_0x2b20da['savePath'];if(!fs[_0x35b8('0x53')](_0x460032)){throw new db['Sequelize'][(_0x35b8('0x54'))](_0x35b8('0x55'));}if(_0x2b20da['filename']){return _0x4f628f[_0x35b8('0x4a')](_0x460032,_0x2b20da[_0x35b8('0x56')]+path[_0x35b8('0x57')](_0x460032),function(){if(_0x9b223c){fs['unlink'](_0x460032);}});}else{return _0x4f628f[_0x35b8('0x4a')](_0x460032,function(_0x53e194){if(_0x9b223c){fs[_0x35b8('0x58')](_0x460032);}});}}})[_0x35b8('0x45')](function(_0x36c7a4){if(_0x36c7a4[_0x35b8('0x59')]===_0x35b8('0x55')){_0x4f628f[_0x35b8('0x16')](0x194)[_0x35b8('0x28')](_0x35b8('0x5a'));}else{return handleError(_0x4f628f,null);}});};exports['destroy']=function(_0x23c3ad,_0x1237f4){return db['SquareRecording'][_0x35b8('0x46')]({'where':{'id':_0x23c3ad['params']['id']}})[_0x35b8('0x23')](function(_0x1b8a0d){if(_[_0x35b8('0x5b')](_0x1b8a0d)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1b8a0d;})[_0x35b8('0x23')](function(_0x5298ae){var _0x164806=_0x5298ae['savePath'];logger[_0x35b8('0x5c')](_0x35b8('0x5d'),_0x164806);if(!_[_0x35b8('0x5b')](_0x5298ae[_0x35b8('0x4d')])&&fs[_0x35b8('0x53')](_0x164806)){logger['info'](_0x35b8('0x5e')+_0x164806+_0x35b8('0x5f'));fs[_0x35b8('0x60')](_0x164806);}_0x164806=_0x164806+_0x35b8('0x61');if(!_[_0x35b8('0x5b')](_0x5298ae['savePath'])&&fs['existsSync'](_0x164806)){logger[_0x35b8('0x5c')](_0x35b8('0x5e')+_0x164806+_0x35b8('0x5f'));fs[_0x35b8('0x60')](_0x164806);}return _0x5298ae;})[_0x35b8('0x23')](function(_0x156649){if(!_0x156649)throw new InternalError();return _0x156649[_0x35b8('0x24')]();})[_0x35b8('0x23')](function(){_0x1237f4[_0x35b8('0x16')](0xcc)[_0x35b8('0x17')]();})[_0x35b8('0x45')](handleError(_0x1237f4,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 8efd17f..eecb30e 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 _0xfb67=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger'];(function(_0x251a63,_0x26f4c2){var _0xb88007=function(_0x4ced7b){while(--_0x4ced7b){_0x251a63['push'](_0x251a63['shift']());}};_0xb88007(++_0x26f4c2);}(_0xfb67,0xdd));var _0x7fb6=function(_0x855236,_0x3f18b3){_0x855236=_0x855236-0x0;var _0x582ff7=_0xfb67[_0x855236];return _0x582ff7;};'use strict';var _=require(_0x7fb6('0x0'));var util=require(_0x7fb6('0x1'));var logger=require(_0x7fb6('0x2'))(_0x7fb6('0x3'));var moment=require(_0x7fb6('0x4'));var BPromise=require(_0x7fb6('0x5'));var rp=require(_0x7fb6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fb6('0x7'));var config=require(_0x7fb6('0x8'));var attributes=require(_0x7fb6('0x9'));module[_0x7fb6('0xa')]=function(_0x3e7393,_0x59b2e2){return _0x3e7393[_0x7fb6('0xb')](_0x7fb6('0xc'),attributes,{'tableName':_0x7fb6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc74c=['exports','SquareRecording','square_recordings','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x1d98f1,_0x1e7b1a){var _0x273bd=function(_0x488754){while(--_0x488754){_0x1d98f1['push'](_0x1d98f1['shift']());}};_0x273bd(++_0x1e7b1a);}(_0xc74c,0x163));var _0xcc74=function(_0x1426e0,_0x4de140){_0x1426e0=_0x1426e0-0x0;var _0x49af46=_0xc74c[_0x1426e0];return _0x49af46;};'use strict';var _=require(_0xcc74('0x0'));var util=require(_0xcc74('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc74('0x2'));var BPromise=require(_0xcc74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc74('0x4'));var rimraf=require(_0xcc74('0x5'));var config=require(_0xcc74('0x6'));var attributes=require(_0xcc74('0x7'));module[_0xcc74('0x8')]=function(_0x23c249,_0x425b73){return _0x23c249['define'](_0xcc74('0x9'),attributes,{'tableName':_0xcc74('0xa'),'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 4a2ee46..a49f2ca 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 _0x7dd1=['message','info','SquareRecording,\x20%s,\x20%s','result','CreateSquareRecording','SquareRecording','create','body','options','raw','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','request\x20sent','debug','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7dd1,0x169));var _0x17dd=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x7dd1[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x17dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x17dd('0x1'));var rs=require(_0x17dd('0x2'));var fs=require('fs');var Redis=require(_0x17dd('0x3'));var db=require(_0x17dd('0x4'))['db'];var utils=require(_0x17dd('0x5'));var logger=require(_0x17dd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x17dd('0x7'));var client=jayson['client'][_0x17dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b9038,_0x591bbf,_0x44a3ed){return new BPromise(function(_0x29b28f,_0x5b1bd4){return client[_0x17dd('0x9')](_0x1b9038,_0x44a3ed)['then'](function(_0x4122db){logger['info']('SquareRecording,\x20%s,\x20%s',_0x591bbf,_0x17dd('0xa'));logger[_0x17dd('0xb')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x591bbf,_0x17dd('0xa'),JSON[_0x17dd('0xc')](_0x4122db));if(_0x4122db[_0x17dd('0xd')]){if(_0x4122db['error']['code']===0x1f4){logger[_0x17dd('0xd')]('SquareRecording,\x20%s,\x20%s',_0x591bbf,_0x4122db[_0x17dd('0xd')][_0x17dd('0xe')]);return _0x5b1bd4(_0x4122db[_0x17dd('0xd')][_0x17dd('0xe')]);}logger[_0x17dd('0xd')]('SquareRecording,\x20%s,\x20%s',_0x591bbf,_0x4122db[_0x17dd('0xd')][_0x17dd('0xe')]);return _0x29b28f(_0x4122db[_0x17dd('0xd')][_0x17dd('0xe')]);}else{logger[_0x17dd('0xf')](_0x17dd('0x10'),_0x591bbf,'request\x20sent');_0x29b28f(_0x4122db[_0x17dd('0x11')]['message']);}})['catch'](function(_0x2ccde7){logger[_0x17dd('0xd')]('SquareRecording,\x20%s,\x20%s',_0x591bbf,_0x2ccde7);_0x5b1bd4(_0x2ccde7);});});}exports[_0x17dd('0x12')]=function(_0x3345c5){var _0x5c0342=this;return new Promise(function(_0x41b9f2,_0x15ae11){return db[_0x17dd('0x13')][_0x17dd('0x14')](_0x3345c5[_0x17dd('0x15')],{'raw':_0x3345c5[_0x17dd('0x16')]?_0x3345c5[_0x17dd('0x16')][_0x17dd('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x30d55a){logger[_0x17dd('0xf')]('CreateSquareRecording',_0x3345c5);logger[_0x17dd('0xb')](_0x17dd('0x12'),_0x3345c5,JSON[_0x17dd('0xc')](_0x30d55a));_0x41b9f2(_0x30d55a);})[_0x17dd('0x18')](function(_0x31c75d){logger[_0x17dd('0xd')]('CreateSquareRecording',_0x31c75d[_0x17dd('0xe')],_0x3345c5);_0x15ae11(_0x5c0342[_0x17dd('0xd')](0x1f4,_0x31c75d[_0x17dd('0xe')]));});});}; \ No newline at end of file +var _0xbfb9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SquareRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','CreateSquareRecording','SquareRecording','create','body','raw','catch'];(function(_0x294215,_0x57b5ef){var _0x65452e=function(_0x957996){while(--_0x957996){_0x294215['push'](_0x294215['shift']());}};_0x65452e(++_0x57b5ef);}(_0xbfb9,0x144));var _0x9bfb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbfb9[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x9bfb('0x0'));var util=require(_0x9bfb('0x1'));var moment=require(_0x9bfb('0x2'));var BPromise=require(_0x9bfb('0x3'));var rs=require(_0x9bfb('0x4'));var fs=require('fs');var Redis=require(_0x9bfb('0x5'));var db=require(_0x9bfb('0x6'))['db'];var utils=require(_0x9bfb('0x7'));var logger=require(_0x9bfb('0x8'))(_0x9bfb('0x9'));var config=require('../../config/environment');var jayson=require(_0x9bfb('0xa'));var client=jayson[_0x9bfb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52b4e8,_0x5f978c,_0x2121f4){return new BPromise(function(_0x314c1c,_0x3f3b5f){return client['request'](_0x52b4e8,_0x2121f4)[_0x9bfb('0xc')](function(_0x47b06f){logger[_0x9bfb('0xd')](_0x9bfb('0xe'),_0x5f978c,'request\x20sent');logger[_0x9bfb('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5f978c,_0x9bfb('0x10'),JSON[_0x9bfb('0x11')](_0x47b06f));if(_0x47b06f[_0x9bfb('0x12')]){if(_0x47b06f[_0x9bfb('0x12')]['code']===0x1f4){logger[_0x9bfb('0x12')](_0x9bfb('0xe'),_0x5f978c,_0x47b06f['error'][_0x9bfb('0x13')]);return _0x3f3b5f(_0x47b06f['error'][_0x9bfb('0x13')]);}logger[_0x9bfb('0x12')](_0x9bfb('0xe'),_0x5f978c,_0x47b06f[_0x9bfb('0x12')][_0x9bfb('0x13')]);return _0x314c1c(_0x47b06f[_0x9bfb('0x12')][_0x9bfb('0x13')]);}else{logger['info'](_0x9bfb('0xe'),_0x5f978c,_0x9bfb('0x10'));_0x314c1c(_0x47b06f[_0x9bfb('0x14')][_0x9bfb('0x13')]);}})['catch'](function(_0x3ee7c3){logger['error']('SquareRecording,\x20%s,\x20%s',_0x5f978c,_0x3ee7c3);_0x3f3b5f(_0x3ee7c3);});});}exports[_0x9bfb('0x15')]=function(_0x1310ab){var _0x39f3d3=this;return new Promise(function(_0x4e6373,_0x5c69c5){return db[_0x9bfb('0x16')][_0x9bfb('0x17')](_0x1310ab[_0x9bfb('0x18')],{'raw':_0x1310ab['options']?_0x1310ab['options'][_0x9bfb('0x19')]===undefined?!![]:![]:!![]})[_0x9bfb('0xc')](function(_0x5c36a8){logger[_0x9bfb('0xd')](_0x9bfb('0x15'),_0x1310ab);logger[_0x9bfb('0xf')]('CreateSquareRecording',_0x1310ab,JSON[_0x9bfb('0x11')](_0x5c36a8));_0x4e6373(_0x5c36a8);})[_0x9bfb('0x1a')](function(_0x344d5f){logger[_0x9bfb('0x12')](_0x9bfb('0x15'),_0x344d5f['message'],_0x1310ab);_0x5c69c5(_0x39f3d3[_0x9bfb('0x12')](0x1f4,_0x344d5f[_0x9bfb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index f4fea71..dcd864b 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x4e18c1,_0x4ad01c){var _0x44c9e5=function(_0x3d3fae){while(--_0x3d3fae){_0x4e18c1['push'](_0x4e18c1['shift']());}};_0x44c9e5(++_0x4ad01c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3632d54..49bdfc2 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 _0x4243=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x214322,_0x15b192){var _0x1d2ad7=function(_0x465f4e){while(--_0x465f4e){_0x214322['push'](_0x214322['shift']());}};_0x1d2ad7(++_0x15b192);}(_0x4243,0x13d));var _0x3424=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4243[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3424('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x3424('0x1')]},'request':{'type':Sequelize[_0x3424('0x1')]},'channel':{'type':Sequelize[_0x3424('0x1')]},'language':{'type':Sequelize[_0x3424('0x1')]},'type':{'type':Sequelize[_0x3424('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x3424('0x1')]},'callerid':{'type':Sequelize[_0x3424('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x3424('0x1')]},'callington':{'type':Sequelize[_0x3424('0x1')]},'callingtns':{'type':Sequelize[_0x3424('0x1')]},'dnid':{'type':Sequelize[_0x3424('0x1')]},'rdnis':{'type':Sequelize[_0x3424('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x3424('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x3424('0x1')]},'accountcode':{'type':Sequelize[_0x3424('0x1')]},'threadid':{'type':Sequelize[_0x3424('0x1')]},'project_name':{'type':Sequelize[_0x3424('0x1')]},'joinAt':{'type':Sequelize[_0x3424('0x2')]},'leaveAt':{'type':Sequelize[_0x3424('0x2')]},'bot':{'type':Sequelize[_0x3424('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x38bd=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x29a99e,_0x46a4f4){var _0x449e21=function(_0x25769e){while(--_0x25769e){_0x29a99e['push'](_0x29a99e['shift']());}};_0x449e21(++_0x46a4f4);}(_0x38bd,0x14e));var _0xd38b=function(_0x3db6ad,_0x217cc2){_0x3db6ad=_0x3db6ad-0x0;var _0x582b7d=_0x38bd[_0x3db6ad];return _0x582b7d;};'use strict';var Sequelize=require(_0xd38b('0x0'));module[_0xd38b('0x1')]={'network':{'type':Sequelize[_0xd38b('0x2')]},'network_script':{'type':Sequelize[_0xd38b('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd38b('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xd38b('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xd38b('0x2')]},'callington':{'type':Sequelize[_0xd38b('0x2')]},'callingtns':{'type':Sequelize[_0xd38b('0x2')]},'dnid':{'type':Sequelize[_0xd38b('0x2')]},'rdnis':{'type':Sequelize[_0xd38b('0x2')]},'context':{'type':Sequelize[_0xd38b('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd38b('0x2')]},'enhanced':{'type':Sequelize[_0xd38b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xd38b('0x2')]},'project_name':{'type':Sequelize[_0xd38b('0x2')]},'joinAt':{'type':Sequelize[_0xd38b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xd38b('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 b094763..0be25a2 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 _0x2207=['limit','undefined','count','json','reject','save','update','then','destroy','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x2207,0xc0));var _0x7220=function(_0x3e22ec,_0x59e837){_0x3e22ec=_0x3e22ec-0x0;var _0x21669d=_0x2207[_0x3e22ec];return _0x21669d;};'use strict';var emlformat=require(_0x7220('0x0'));var rimraf=require(_0x7220('0x1'));var zipdir=require(_0x7220('0x2'));var jsonpatch=require(_0x7220('0x3'));var rp=require('request-promise');var moment=require(_0x7220('0x4'));var BPromise=require(_0x7220('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7220('0x6'));var sox=require('sox');var csv=require(_0x7220('0x7'));var ejs=require(_0x7220('0x8'));var fs=require('fs');var fs_extra=require(_0x7220('0x9'));var _=require(_0x7220('0xa'));var squel=require(_0x7220('0xb'));var crypto=require(_0x7220('0xc'));var jsforce=require(_0x7220('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7220('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7220('0xf'));var qs=require(_0x7220('0x10'));var as=require(_0x7220('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7220('0x12'));var utils=require(_0x7220('0x13'));var config=require(_0x7220('0x14'));var licenseUtil=require(_0x7220('0x15'));var db=require(_0x7220('0x16'))['db'];function respondWithStatusCode(_0x5bd028,_0x22e3b9){_0x22e3b9=_0x22e3b9||0xcc;return function(_0x1d2732){if(_0x1d2732){return _0x5bd028[_0x7220('0x17')](_0x22e3b9);}return _0x5bd028[_0x7220('0x18')](_0x22e3b9)[_0x7220('0x19')]();};}function respondWithResult(_0x31ce5f,_0xb6b998){_0xb6b998=_0xb6b998||0xc8;return function(_0x3b063b){if(_0x3b063b){return _0x31ce5f[_0x7220('0x18')](_0xb6b998)['json'](_0x3b063b);}};}function respondWithFilteredResult(_0x4e2ff5,_0x171374){return function(_0x32dd8d){if(_0x32dd8d){var _0x374fda=typeof _0x171374[_0x7220('0x1a')]==='undefined'&&typeof _0x171374[_0x7220('0x1b')]===_0x7220('0x1c');var _0x2cc723=_0x32dd8d[_0x7220('0x1d')];var _0x5d6c76=_0x374fda?0x0:_0x171374[_0x7220('0x1a')];var _0xa87688=_0x374fda?_0x32dd8d[_0x7220('0x1d')]:_0x171374[_0x7220('0x1a')]+_0x171374[_0x7220('0x1b')];var _0x525bcf;if(_0xa87688>=_0x2cc723){_0xa87688=_0x2cc723;_0x525bcf=0xc8;}else{_0x525bcf=0xce;}_0x4e2ff5['status'](_0x525bcf);return _0x4e2ff5['set']('Content-Range',_0x5d6c76+'-'+_0xa87688+'/'+_0x2cc723)[_0x7220('0x1e')](_0x32dd8d);}return null;};}function patchUpdates(_0x42db61){return function(_0x3003ac){try{jsonpatch['apply'](_0x3003ac,_0x42db61,!![]);}catch(_0x35e062){return BPromise[_0x7220('0x1f')](_0x35e062);}return _0x3003ac[_0x7220('0x20')]();};}function saveUpdates(_0x3c7d5a,_0x1f521a){return function(_0xae446c){if(_0xae446c){return _0xae446c[_0x7220('0x21')](_0x3c7d5a)[_0x7220('0x22')](function(_0x2f3445){return _0x2f3445;});}return null;};}function removeEntity(_0x33ba2d,_0x6176ff){return function(_0x4a9530){if(_0x4a9530){return _0x4a9530[_0x7220('0x23')]()[_0x7220('0x22')](function(){_0x33ba2d['status'](0xcc)[_0x7220('0x19')]();});}};}function handleEntityNotFound(_0x47fe17,_0x175541){return function(_0x225807){if(!_0x225807){_0x47fe17['sendStatus'](0x194);}return _0x225807;};}function handleError(_0x1d1380,_0x145e4e){_0x145e4e=_0x145e4e||0x1f4;return function(_0x3277c6){logger[_0x7220('0x24')](_0x3277c6[_0x7220('0x25')]);if(_0x3277c6[_0x7220('0x26')]){delete _0x3277c6['name'];}_0x1d1380[_0x7220('0x18')](_0x145e4e)['send'](_0x3277c6);};}exports[_0x7220('0x27')]=function(_0x227f85,_0x219d6d){var _0x4490b8={},_0x1ab4fd={},_0x2eff6e={'count':0x0,'rows':[]};var _0x17d2bf=_[_0x7220('0x28')](db[_0x7220('0x29')][_0x7220('0x2a')],function(_0x23c130){return{'name':_0x23c130[_0x7220('0x2b')],'type':_0x23c130[_0x7220('0x2c')][_0x7220('0x2d')]};});_0x1ab4fd[_0x7220('0x2e')]=_[_0x7220('0x28')](_0x17d2bf,_0x7220('0x26'));_0x1ab4fd['query']=_[_0x7220('0x2f')](_0x227f85[_0x7220('0x30')]);_0x1ab4fd['filters']=_[_0x7220('0x31')](_0x1ab4fd[_0x7220('0x2e')],_0x1ab4fd[_0x7220('0x30')]);_0x4490b8[_0x7220('0x32')]=_[_0x7220('0x31')](_0x1ab4fd[_0x7220('0x2e')],qs[_0x7220('0x33')](_0x227f85[_0x7220('0x30')][_0x7220('0x33')]));_0x4490b8[_0x7220('0x32')]=_0x4490b8[_0x7220('0x32')][_0x7220('0x34')]?_0x4490b8[_0x7220('0x32')]:_0x1ab4fd[_0x7220('0x2e')];if(!_0x227f85['query']['hasOwnProperty'](_0x7220('0x35'))){_0x4490b8['limit']=qs[_0x7220('0x1b')](_0x227f85['query'][_0x7220('0x1b')]);_0x4490b8[_0x7220('0x1a')]=qs[_0x7220('0x1a')](_0x227f85['query']['offset']);}_0x4490b8[_0x7220('0x36')]=qs[_0x7220('0x37')](_0x227f85[_0x7220('0x30')][_0x7220('0x37')]);_0x4490b8[_0x7220('0x38')]=qs[_0x7220('0x39')](_[_0x7220('0x3a')](_0x227f85[_0x7220('0x30')],_0x1ab4fd[_0x7220('0x39')]),_0x17d2bf);if(_0x227f85[_0x7220('0x30')][_0x7220('0x3b')]){_0x4490b8[_0x7220('0x38')]=_['merge'](_0x4490b8[_0x7220('0x38')],{'$or':_['map'](_0x17d2bf,function(_0x254234){if(_0x254234[_0x7220('0x2c')]!=='VIRTUAL'){var _0x17348a={};_0x17348a[_0x254234['name']]={'$like':'%'+_0x227f85['query'][_0x7220('0x3b')]+'%'};return _0x17348a;}})});}_0x4490b8=_[_0x7220('0x3c')]({},_0x4490b8,_0x227f85[_0x7220('0x3d')]);var _0x5b426f={'where':_0x4490b8['where']};return db[_0x7220('0x29')]['count'](_0x5b426f)[_0x7220('0x22')](function(_0x1ee249){_0x2eff6e['count']=_0x1ee249;if(_0x227f85[_0x7220('0x30')][_0x7220('0x3e')]){_0x4490b8[_0x7220('0x3f')]=[{'all':!![]}];}return db[_0x7220('0x29')][_0x7220('0x40')](_0x4490b8);})[_0x7220('0x22')](function(_0x5333d6){_0x2eff6e[_0x7220('0x41')]=_0x5333d6;return _0x2eff6e;})['then'](respondWithFilteredResult(_0x219d6d,_0x4490b8))[_0x7220('0x42')](handleError(_0x219d6d,null));};exports[_0x7220('0x43')]=function(_0x52e5f3,_0x3d4f00){var _0x276c63={'raw':!![],'where':{'id':_0x52e5f3['params']['id']}},_0x188d6c={};_0x188d6c['model']=_[_0x7220('0x2f')](db[_0x7220('0x29')][_0x7220('0x2a')]);_0x188d6c[_0x7220('0x30')]=_[_0x7220('0x2f')](_0x52e5f3['query']);_0x188d6c[_0x7220('0x39')]=_[_0x7220('0x31')](_0x188d6c[_0x7220('0x2e')],_0x188d6c[_0x7220('0x30')]);_0x276c63[_0x7220('0x32')]=_['intersection'](_0x188d6c['model'],qs[_0x7220('0x33')](_0x52e5f3['query'][_0x7220('0x33')]));_0x276c63['attributes']=_0x276c63[_0x7220('0x32')]['length']?_0x276c63['attributes']:_0x188d6c[_0x7220('0x2e')];if(_0x52e5f3['query'][_0x7220('0x3e')]){_0x276c63['include']=[{'all':!![]}];}_0x276c63=_[_0x7220('0x3c')]({},_0x276c63,_0x52e5f3['options']);return db[_0x7220('0x29')][_0x7220('0x44')](_0x276c63)[_0x7220('0x22')](handleEntityNotFound(_0x3d4f00,null))['then'](respondWithResult(_0x3d4f00,null))[_0x7220('0x42')](handleError(_0x3d4f00,null));};exports[_0x7220('0x45')]=function(_0x493b28,_0x1b35b8){return db[_0x7220('0x29')][_0x7220('0x45')](_0x493b28[_0x7220('0x46')],{})[_0x7220('0x22')](respondWithResult(_0x1b35b8,0xc9))[_0x7220('0x42')](handleError(_0x1b35b8,null));};exports[_0x7220('0x21')]=function(_0x4af283,_0x17b1c8){if(_0x4af283[_0x7220('0x46')]['id']){delete _0x4af283[_0x7220('0x46')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x4af283[_0x7220('0x47')]['id']}})['then'](handleEntityNotFound(_0x17b1c8,null))['then'](saveUpdates(_0x4af283['body'],null))[_0x7220('0x22')](respondWithResult(_0x17b1c8,null))['catch'](handleError(_0x17b1c8,null));};exports['destroy']=function(_0x2b652a,_0x56c692){return db['SquareReport'][_0x7220('0x44')]({'where':{'id':_0x2b652a[_0x7220('0x47')]['id']}})[_0x7220('0x22')](handleEntityNotFound(_0x56c692,null))[_0x7220('0x22')](removeEntity(_0x56c692,null))[_0x7220('0x42')](handleError(_0x56c692,null));};exports[_0x7220('0x48')]=function(_0x2490f9,_0x15d803){return db['SquareReport'][_0x7220('0x48')]()[_0x7220('0x22')](respondWithResult(_0x15d803,null))[_0x7220('0x42')](handleError(_0x15d803,null));}; \ No newline at end of file +var _0xbf3e=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','SquareReport','includeAll','include','rows','show','params','attributes','create','body','catch','find','describe'];(function(_0x4e939d,_0x28aefb){var _0x450e6a=function(_0x3ba59a){while(--_0x3ba59a){_0x4e939d['push'](_0x4e939d['shift']());}};_0x450e6a(++_0x28aefb);}(_0xbf3e,0xe7));var _0xebf3=function(_0xcce413,_0x5b9c5c){_0xcce413=_0xcce413-0x0;var _0x15ae94=_0xbf3e[_0xcce413];return _0x15ae94;};'use strict';var emlformat=require(_0xebf3('0x0'));var rimraf=require(_0xebf3('0x1'));var zipdir=require(_0xebf3('0x2'));var jsonpatch=require(_0xebf3('0x3'));var rp=require(_0xebf3('0x4'));var moment=require(_0xebf3('0x5'));var BPromise=require(_0xebf3('0x6'));var Mustache=require(_0xebf3('0x7'));var util=require('util');var path=require(_0xebf3('0x8'));var sox=require(_0xebf3('0x9'));var csv=require('to-csv');var ejs=require(_0xebf3('0xa'));var fs=require('fs');var fs_extra=require(_0xebf3('0xb'));var _=require(_0xebf3('0xc'));var squel=require('squel');var crypto=require(_0xebf3('0xd'));var jsforce=require(_0xebf3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xebf3('0xf'));var querystring=require('querystring');var Papa=require(_0xebf3('0x10'));var Redis=require(_0xebf3('0x11'));var authService=require(_0xebf3('0x12'));var qs=require(_0xebf3('0x13'));var as=require(_0xebf3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xebf3('0x15'))(_0xebf3('0x16'));var utils=require(_0xebf3('0x17'));var config=require(_0xebf3('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x337898,_0x59a227){_0x59a227=_0x59a227||0xcc;return function(_0x49ec46){if(_0x49ec46){return _0x337898[_0xebf3('0x19')](_0x59a227);}return _0x337898[_0xebf3('0x1a')](_0x59a227)[_0xebf3('0x1b')]();};}function respondWithResult(_0x47cf8f,_0x56879c){_0x56879c=_0x56879c||0xc8;return function(_0x2f8d1c){if(_0x2f8d1c){return _0x47cf8f[_0xebf3('0x1a')](_0x56879c)[_0xebf3('0x1c')](_0x2f8d1c);}};}function respondWithFilteredResult(_0x3eb1e8,_0x1f0500){return function(_0x1b2a1a){if(_0x1b2a1a){var _0x571c0b=typeof _0x1f0500[_0xebf3('0x1d')]===_0xebf3('0x1e')&&typeof _0x1f0500[_0xebf3('0x1f')]==='undefined';var _0x5258a3=_0x1b2a1a[_0xebf3('0x20')];var _0x1922fb=_0x571c0b?0x0:_0x1f0500[_0xebf3('0x1d')];var _0x187dfb=_0x571c0b?_0x1b2a1a[_0xebf3('0x20')]:_0x1f0500['offset']+_0x1f0500['limit'];var _0x2a595d;if(_0x187dfb>=_0x5258a3){_0x187dfb=_0x5258a3;_0x2a595d=0xc8;}else{_0x2a595d=0xce;}_0x3eb1e8[_0xebf3('0x1a')](_0x2a595d);return _0x3eb1e8[_0xebf3('0x21')](_0xebf3('0x22'),_0x1922fb+'-'+_0x187dfb+'/'+_0x5258a3)[_0xebf3('0x1c')](_0x1b2a1a);}return null;};}function patchUpdates(_0x4bc5a4){return function(_0x301b29){try{jsonpatch[_0xebf3('0x23')](_0x301b29,_0x4bc5a4,!![]);}catch(_0x31440f){return BPromise[_0xebf3('0x24')](_0x31440f);}return _0x301b29[_0xebf3('0x25')]();};}function saveUpdates(_0x888ea2,_0x58dd17){return function(_0x560a37){if(_0x560a37){return _0x560a37[_0xebf3('0x26')](_0x888ea2)[_0xebf3('0x27')](function(_0x14c4fd){return _0x14c4fd;});}return null;};}function removeEntity(_0x2da8f1,_0xee565){return function(_0x28b773){if(_0x28b773){return _0x28b773[_0xebf3('0x28')]()['then'](function(){_0x2da8f1[_0xebf3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ab244,_0x39fe27){return function(_0x4d1112){if(!_0x4d1112){_0x3ab244[_0xebf3('0x19')](0x194);}return _0x4d1112;};}function handleError(_0x2cbbd1,_0x3080d){_0x3080d=_0x3080d||0x1f4;return function(_0x4427e9){logger['error'](_0x4427e9[_0xebf3('0x29')]);if(_0x4427e9[_0xebf3('0x2a')]){delete _0x4427e9[_0xebf3('0x2a')];}_0x2cbbd1[_0xebf3('0x1a')](_0x3080d)[_0xebf3('0x2b')](_0x4427e9);};}exports['index']=function(_0x29f340,_0x27e11c){var _0x26946b={},_0x5dd51f={},_0x2280de={'count':0x0,'rows':[]};var _0xa6f91b=_[_0xebf3('0x2c')](db['SquareReport'][_0xebf3('0x2d')],function(_0xb1398b){return{'name':_0xb1398b[_0xebf3('0x2e')],'type':_0xb1398b[_0xebf3('0x2f')][_0xebf3('0x30')]};});_0x5dd51f[_0xebf3('0x31')]=_[_0xebf3('0x2c')](_0xa6f91b,_0xebf3('0x2a'));_0x5dd51f[_0xebf3('0x32')]=_[_0xebf3('0x33')](_0x29f340['query']);_0x5dd51f[_0xebf3('0x34')]=_[_0xebf3('0x35')](_0x5dd51f['model'],_0x5dd51f['query']);_0x26946b['attributes']=_[_0xebf3('0x35')](_0x5dd51f[_0xebf3('0x31')],qs[_0xebf3('0x36')](_0x29f340['query'][_0xebf3('0x36')]));_0x26946b['attributes']=_0x26946b['attributes'][_0xebf3('0x37')]?_0x26946b['attributes']:_0x5dd51f[_0xebf3('0x31')];if(!_0x29f340[_0xebf3('0x32')][_0xebf3('0x38')](_0xebf3('0x39'))){_0x26946b[_0xebf3('0x1f')]=qs['limit'](_0x29f340['query']['limit']);_0x26946b['offset']=qs[_0xebf3('0x1d')](_0x29f340[_0xebf3('0x32')][_0xebf3('0x1d')]);}_0x26946b['order']=qs[_0xebf3('0x3a')](_0x29f340['query'][_0xebf3('0x3a')]);_0x26946b[_0xebf3('0x3b')]=qs[_0xebf3('0x34')](_[_0xebf3('0x3c')](_0x29f340[_0xebf3('0x32')],_0x5dd51f[_0xebf3('0x34')]),_0xa6f91b);if(_0x29f340[_0xebf3('0x32')]['filter']){_0x26946b[_0xebf3('0x3b')]=_['merge'](_0x26946b[_0xebf3('0x3b')],{'$or':_[_0xebf3('0x2c')](_0xa6f91b,function(_0x41fdf0){if(_0x41fdf0[_0xebf3('0x2f')]!==_0xebf3('0x3d')){var _0x56a266={};_0x56a266[_0x41fdf0[_0xebf3('0x2a')]]={'$like':'%'+_0x29f340[_0xebf3('0x32')][_0xebf3('0x3e')]+'%'};return _0x56a266;}})});}_0x26946b=_[_0xebf3('0x3f')]({},_0x26946b,_0x29f340[_0xebf3('0x40')]);var _0x2932bc={'where':_0x26946b['where']};return db[_0xebf3('0x41')][_0xebf3('0x20')](_0x2932bc)[_0xebf3('0x27')](function(_0x6b1c19){_0x2280de[_0xebf3('0x20')]=_0x6b1c19;if(_0x29f340[_0xebf3('0x32')][_0xebf3('0x42')]){_0x26946b[_0xebf3('0x43')]=[{'all':!![]}];}return db[_0xebf3('0x41')]['findAll'](_0x26946b);})[_0xebf3('0x27')](function(_0x8c5b3e){_0x2280de[_0xebf3('0x44')]=_0x8c5b3e;return _0x2280de;})[_0xebf3('0x27')](respondWithFilteredResult(_0x27e11c,_0x26946b))['catch'](handleError(_0x27e11c,null));};exports[_0xebf3('0x45')]=function(_0x3bcb52,_0x4ab4a9){var _0x5796bb={'raw':!![],'where':{'id':_0x3bcb52[_0xebf3('0x46')]['id']}},_0x2c40d5={};_0x2c40d5['model']=_[_0xebf3('0x33')](db[_0xebf3('0x41')]['rawAttributes']);_0x2c40d5[_0xebf3('0x32')]=_[_0xebf3('0x33')](_0x3bcb52['query']);_0x2c40d5[_0xebf3('0x34')]=_[_0xebf3('0x35')](_0x2c40d5[_0xebf3('0x31')],_0x2c40d5['query']);_0x5796bb['attributes']=_['intersection'](_0x2c40d5[_0xebf3('0x31')],qs[_0xebf3('0x36')](_0x3bcb52[_0xebf3('0x32')][_0xebf3('0x36')]));_0x5796bb['attributes']=_0x5796bb[_0xebf3('0x47')]['length']?_0x5796bb[_0xebf3('0x47')]:_0x2c40d5[_0xebf3('0x31')];if(_0x3bcb52[_0xebf3('0x32')][_0xebf3('0x42')]){_0x5796bb[_0xebf3('0x43')]=[{'all':!![]}];}_0x5796bb=_[_0xebf3('0x3f')]({},_0x5796bb,_0x3bcb52[_0xebf3('0x40')]);return db[_0xebf3('0x41')]['find'](_0x5796bb)[_0xebf3('0x27')](handleEntityNotFound(_0x4ab4a9,null))[_0xebf3('0x27')](respondWithResult(_0x4ab4a9,null))['catch'](handleError(_0x4ab4a9,null));};exports[_0xebf3('0x48')]=function(_0x28a833,_0x1e41a0){return db[_0xebf3('0x41')][_0xebf3('0x48')](_0x28a833[_0xebf3('0x49')],{})[_0xebf3('0x27')](respondWithResult(_0x1e41a0,0xc9))[_0xebf3('0x4a')](handleError(_0x1e41a0,null));};exports['update']=function(_0x293fd8,_0x17c235){if(_0x293fd8['body']['id']){delete _0x293fd8[_0xebf3('0x49')]['id'];}return db[_0xebf3('0x41')]['find']({'where':{'id':_0x293fd8['params']['id']}})[_0xebf3('0x27')](handleEntityNotFound(_0x17c235,null))[_0xebf3('0x27')](saveUpdates(_0x293fd8['body'],null))['then'](respondWithResult(_0x17c235,null))['catch'](handleError(_0x17c235,null));};exports[_0xebf3('0x28')]=function(_0x2771a1,_0x125de0){return db[_0xebf3('0x41')][_0xebf3('0x4b')]({'where':{'id':_0x2771a1[_0xebf3('0x46')]['id']}})['then'](handleEntityNotFound(_0x125de0,null))[_0xebf3('0x27')](removeEntity(_0x125de0,null))[_0xebf3('0x4a')](handleError(_0x125de0,null));};exports[_0xebf3('0x4c')]=function(_0x538b2b,_0x2c68ca){return db[_0xebf3('0x41')][_0xebf3('0x4c')]()[_0xebf3('0x27')](respondWithResult(_0x2c68ca,null))['catch'](handleError(_0x2c68ca,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 115fcb5..1573317 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 _0xaf04=['api','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger'];(function(_0x37ae26,_0x2ecd70){var _0x1b1902=function(_0x5a6ae0){while(--_0x5a6ae0){_0x37ae26['push'](_0x37ae26['shift']());}};_0x1b1902(++_0x2ecd70);}(_0xaf04,0x1ed));var _0x4af0=function(_0x52f6d2,_0x2384e6){_0x52f6d2=_0x52f6d2-0x0;var _0x16499a=_0xaf04[_0x52f6d2];return _0x16499a;};'use strict';var _=require(_0x4af0('0x0'));var util=require('util');var logger=require(_0x4af0('0x1'))(_0x4af0('0x2'));var moment=require('moment');var BPromise=require(_0x4af0('0x3'));var rp=require(_0x4af0('0x4'));var fs=require('fs');var path=require(_0x4af0('0x5'));var rimraf=require('rimraf');var config=require(_0x4af0('0x6'));var attributes=require(_0x4af0('0x7'));module[_0x4af0('0x8')]=function(_0x1420cc,_0x41429a){return _0x1420cc[_0x4af0('0x9')](_0x4af0('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x4af0('0xb'),'fields':[_0x4af0('0xc'),_0x4af0('0xd')]},{'name':_0x4af0('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a6b=['./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x563a7e,_0x4d543a){var _0x4f7bd4=function(_0xb5d294){while(--_0xb5d294){_0x563a7e['push'](_0x563a7e['shift']());}};_0x4f7bd4(++_0x4d543a);}(_0x1a6b,0x108));var _0xb1a6=function(_0xbfa5dc,_0x5da4f7){_0xbfa5dc=_0xbfa5dc-0x0;var _0x54c41a=_0x1a6b[_0xbfa5dc];return _0x54c41a;};'use strict';var _=require(_0xb1a6('0x0'));var util=require(_0xb1a6('0x1'));var logger=require('../../config/logger')(_0xb1a6('0x2'));var moment=require(_0xb1a6('0x3'));var BPromise=require('bluebird');var rp=require(_0xb1a6('0x4'));var fs=require('fs');var path=require(_0xb1a6('0x5'));var rimraf=require(_0xb1a6('0x6'));var config=require(_0xb1a6('0x7'));var attributes=require(_0xb1a6('0x8'));module['exports']=function(_0x36507a,_0x3709f2){return _0x36507a[_0xb1a6('0x9')](_0xb1a6('0xa'),attributes,{'tableName':_0xb1a6('0xb'),'paranoid':![],'indexes':[{'name':_0xb1a6('0xc'),'fields':[_0xb1a6('0xd'),_0xb1a6('0xe')]},{'name':_0xb1a6('0xf'),'fields':[_0xb1a6('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index c500065..352a766 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 _0xc1a0=['debug','SquareReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','SquareReport','create','options','raw','CreateSquareReport','stringify','UpdateSquareReport','update','body','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1658ad,_0x487c1f){var _0x3b1927=function(_0xc06bb2){while(--_0xc06bb2){_0x1658ad['push'](_0x1658ad['shift']());}};_0x3b1927(++_0x487c1f);}(_0xc1a0,0x166));var _0x0c1a=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xc1a0[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0x0c1a('0x0'));var util=require(_0x0c1a('0x1'));var moment=require(_0x0c1a('0x2'));var BPromise=require('bluebird');var rs=require(_0x0c1a('0x3'));var fs=require('fs');var Redis=require(_0x0c1a('0x4'));var db=require(_0x0c1a('0x5'))['db'];var utils=require(_0x0c1a('0x6'));var logger=require(_0x0c1a('0x7'))(_0x0c1a('0x8'));var config=require(_0x0c1a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0c1a('0xa')][_0x0c1a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4021d7,_0x266892,_0x5a7fe3){return new BPromise(function(_0x2d8899,_0x656de1){return client['request'](_0x4021d7,_0x5a7fe3)[_0x0c1a('0xc')](function(_0x163d64){logger[_0x0c1a('0xd')](_0x0c1a('0xe'),_0x266892,_0x0c1a('0xf'));logger[_0x0c1a('0x10')](_0x0c1a('0x11'),_0x266892,_0x0c1a('0xf'),JSON['stringify'](_0x163d64));if(_0x163d64[_0x0c1a('0x12')]){if(_0x163d64[_0x0c1a('0x12')]['code']===0x1f4){logger[_0x0c1a('0x12')](_0x0c1a('0xe'),_0x266892,_0x163d64['error'][_0x0c1a('0x13')]);return _0x656de1(_0x163d64['error'][_0x0c1a('0x13')]);}logger[_0x0c1a('0x12')](_0x0c1a('0xe'),_0x266892,_0x163d64[_0x0c1a('0x12')][_0x0c1a('0x13')]);return _0x2d8899(_0x163d64[_0x0c1a('0x12')][_0x0c1a('0x13')]);}else{logger[_0x0c1a('0xd')](_0x0c1a('0xe'),_0x266892,'request\x20sent');_0x2d8899(_0x163d64[_0x0c1a('0x14')]['message']);}})[_0x0c1a('0x15')](function(_0x417c4e){logger['error']('SquareReport,\x20%s,\x20%s',_0x266892,_0x417c4e);_0x656de1(_0x417c4e);});});}exports['CreateSquareReport']=function(_0x1c8258){var _0x552988=this;return new Promise(function(_0x2c0c13,_0x40011a){return db[_0x0c1a('0x16')][_0x0c1a('0x17')](_0x1c8258['body'],{'raw':_0x1c8258['options']?_0x1c8258[_0x0c1a('0x18')][_0x0c1a('0x19')]===undefined?!![]:![]:!![]})[_0x0c1a('0xc')](function(_0x243438){logger[_0x0c1a('0xd')](_0x0c1a('0x1a'),_0x1c8258);logger[_0x0c1a('0x10')](_0x0c1a('0x1a'),_0x1c8258,JSON[_0x0c1a('0x1b')](_0x243438));_0x2c0c13(_0x243438);})[_0x0c1a('0x15')](function(_0x2c25f5){logger[_0x0c1a('0x12')](_0x0c1a('0x1a'),_0x2c25f5[_0x0c1a('0x13')],_0x1c8258);_0x40011a(_0x552988['error'](0x1f4,_0x2c25f5[_0x0c1a('0x13')]));});});};exports[_0x0c1a('0x1c')]=function(_0xf2a30){var _0x208090=this;return new Promise(function(_0x259220,_0x367b9c){return db[_0x0c1a('0x16')][_0x0c1a('0x1d')](_0xf2a30[_0x0c1a('0x1e')],{'raw':_0xf2a30['options']?_0xf2a30['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf2a30['options']?_0xf2a30[_0x0c1a('0x18')][_0x0c1a('0x1f')]||null:null,'attributes':_0xf2a30[_0x0c1a('0x18')]?_0xf2a30[_0x0c1a('0x18')][_0x0c1a('0x20')]||null:null,'limit':_0xf2a30[_0x0c1a('0x18')]?_0xf2a30[_0x0c1a('0x18')][_0x0c1a('0x21')]||null:null})[_0x0c1a('0xc')](function(_0x3ca433){logger[_0x0c1a('0xd')](_0x0c1a('0x1c'),_0xf2a30);logger['debug'](_0x0c1a('0x1c'),_0xf2a30,JSON[_0x0c1a('0x1b')](_0x3ca433));_0x259220(_0x3ca433);})[_0x0c1a('0x15')](function(_0x1706a1){logger[_0x0c1a('0x12')]('UpdateSquareReport',_0x1706a1['message'],_0xf2a30);_0x367b9c(_0x208090[_0x0c1a('0x12')](0x1f4,_0x1706a1[_0x0c1a('0x13')]));});});}; \ No newline at end of file +var _0x2ca0=['CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','SquareReport,\x20%s,\x20%s','message','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2ca0,0x128));var _0x02ca=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x2ca0[_0x307086];return _0x699043;};'use strict';var _=require(_0x02ca('0x0'));var util=require(_0x02ca('0x1'));var moment=require(_0x02ca('0x2'));var BPromise=require(_0x02ca('0x3'));var rs=require(_0x02ca('0x4'));var fs=require('fs');var Redis=require(_0x02ca('0x5'));var db=require(_0x02ca('0x6'))['db'];var utils=require(_0x02ca('0x7'));var logger=require(_0x02ca('0x8'))(_0x02ca('0x9'));var config=require(_0x02ca('0xa'));var jayson=require(_0x02ca('0xb'));var client=jayson[_0x02ca('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x209458,_0x2ee1aa,_0x9807a8){return new BPromise(function(_0x5ab5eb,_0x30adb5){return client[_0x02ca('0xd')](_0x209458,_0x9807a8)[_0x02ca('0xe')](function(_0x4fcd3e){logger[_0x02ca('0xf')]('SquareReport,\x20%s,\x20%s',_0x2ee1aa,_0x02ca('0x10'));logger[_0x02ca('0x11')](_0x02ca('0x12'),_0x2ee1aa,_0x02ca('0x10'),JSON['stringify'](_0x4fcd3e));if(_0x4fcd3e[_0x02ca('0x13')]){if(_0x4fcd3e[_0x02ca('0x13')]['code']===0x1f4){logger[_0x02ca('0x13')](_0x02ca('0x14'),_0x2ee1aa,_0x4fcd3e[_0x02ca('0x13')][_0x02ca('0x15')]);return _0x30adb5(_0x4fcd3e['error'][_0x02ca('0x15')]);}logger[_0x02ca('0x13')]('SquareReport,\x20%s,\x20%s',_0x2ee1aa,_0x4fcd3e[_0x02ca('0x13')][_0x02ca('0x15')]);return _0x5ab5eb(_0x4fcd3e[_0x02ca('0x13')]['message']);}else{logger[_0x02ca('0xf')](_0x02ca('0x14'),_0x2ee1aa,'request\x20sent');_0x5ab5eb(_0x4fcd3e[_0x02ca('0x16')][_0x02ca('0x15')]);}})[_0x02ca('0x17')](function(_0xf02964){logger[_0x02ca('0x13')]('SquareReport,\x20%s,\x20%s',_0x2ee1aa,_0xf02964);_0x30adb5(_0xf02964);});});}exports[_0x02ca('0x18')]=function(_0x205624){var _0x5e4fe3=this;return new Promise(function(_0x43ff89,_0x399386){return db[_0x02ca('0x19')][_0x02ca('0x1a')](_0x205624[_0x02ca('0x1b')],{'raw':_0x205624[_0x02ca('0x1c')]?_0x205624[_0x02ca('0x1c')][_0x02ca('0x1d')]===undefined?!![]:![]:!![]})[_0x02ca('0xe')](function(_0x3a750b){logger[_0x02ca('0xf')]('CreateSquareReport',_0x205624);logger[_0x02ca('0x11')]('CreateSquareReport',_0x205624,JSON['stringify'](_0x3a750b));_0x43ff89(_0x3a750b);})[_0x02ca('0x17')](function(_0x383f51){logger['error'](_0x02ca('0x18'),_0x383f51[_0x02ca('0x15')],_0x205624);_0x399386(_0x5e4fe3['error'](0x1f4,_0x383f51[_0x02ca('0x15')]));});});};exports[_0x02ca('0x1e')]=function(_0x36146c){var _0x1ae551=this;return new Promise(function(_0x577b47,_0xe79684){return db['SquareReport']['update'](_0x36146c['body'],{'raw':_0x36146c[_0x02ca('0x1c')]?_0x36146c[_0x02ca('0x1c')][_0x02ca('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36146c['options']?_0x36146c[_0x02ca('0x1c')]['where']||null:null,'attributes':_0x36146c[_0x02ca('0x1c')]?_0x36146c[_0x02ca('0x1c')]['attributes']||null:null,'limit':_0x36146c[_0x02ca('0x1c')]?_0x36146c[_0x02ca('0x1c')][_0x02ca('0x1f')]||null:null})[_0x02ca('0xe')](function(_0x59d21d){logger[_0x02ca('0xf')]('UpdateSquareReport',_0x36146c);logger[_0x02ca('0x11')]('UpdateSquareReport',_0x36146c,JSON['stringify'](_0x59d21d));_0x577b47(_0x59d21d);})[_0x02ca('0x17')](function(_0x4432db){logger[_0x02ca('0x13')]('UpdateSquareReport',_0x4432db[_0x02ca('0x15')],_0x36146c);_0xe79684(_0x1ae551[_0x02ca('0x13')](0x1f4,_0x4432db[_0x02ca('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 868200a..ddc7226 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 _0x8f1a=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','isAuthenticated','/:id','create','put','update'];(function(_0x41cdd4,_0x501b1d){var _0x5fed68=function(_0x15f3ec){while(--_0x15f3ec){_0x41cdd4['push'](_0x41cdd4['shift']());}};_0x5fed68(++_0x501b1d);}(_0x8f1a,0x1c5));var _0xa8f1=function(_0x429abd,_0x5a6d67){_0x429abd=_0x429abd-0x0;var _0x2b2f4a=_0x8f1a[_0x429abd];return _0x2b2f4a;};'use strict';var multer=require('multer');var util=require(_0xa8f1('0x0'));var path=require(_0xa8f1('0x1'));var timeout=require('connect-timeout');var express=require(_0xa8f1('0x2'));var router=express[_0xa8f1('0x3')]();var fs_extra=require(_0xa8f1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa8f1('0x5'));var config=require(_0xa8f1('0x6'));var controller=require(_0xa8f1('0x7'));router[_0xa8f1('0x8')]('/',auth['isAuthenticated'](),controller[_0xa8f1('0x9')]);router[_0xa8f1('0x8')]('/describe',auth[_0xa8f1('0xa')](),controller['describe']);router['get'](_0xa8f1('0xb'),auth[_0xa8f1('0xa')](),controller['show']);router['post']('/',auth[_0xa8f1('0xa')](),controller[_0xa8f1('0xc')]);router[_0xa8f1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xa8f1('0xe')]);router[_0xa8f1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa8f1('0x10')]);module[_0xa8f1('0x11')]=router; \ No newline at end of file +var _0x4e0a=['get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','isAuthenticated','index'];(function(_0x439f33,_0x1df51c){var _0x5e70ee=function(_0x12efdf){while(--_0x12efdf){_0x439f33['push'](_0x439f33['shift']());}};_0x5e70ee(++_0x1df51c);}(_0x4e0a,0xe5));var _0xa4e0=function(_0x14915a,_0x222f6b){_0x14915a=_0x14915a-0x0;var _0x2f683c=_0x4e0a[_0x14915a];return _0x2f683c;};'use strict';var multer=require(_0xa4e0('0x0'));var util=require(_0xa4e0('0x1'));var path=require(_0xa4e0('0x2'));var timeout=require(_0xa4e0('0x3'));var express=require('express');var router=express[_0xa4e0('0x4')]();var fs_extra=require(_0xa4e0('0x5'));var auth=require(_0xa4e0('0x6'));var interaction=require(_0xa4e0('0x7'));var config=require('../../config/environment');var controller=require(_0xa4e0('0x8'));router['get']('/',auth[_0xa4e0('0x9')](),controller[_0xa4e0('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa4e0('0xb')](_0xa4e0('0xc'),auth[_0xa4e0('0x9')](),controller[_0xa4e0('0xd')]);router[_0xa4e0('0xe')]('/',auth[_0xa4e0('0x9')](),controller[_0xa4e0('0xf')]);router[_0xa4e0('0x10')]('/:id',auth[_0xa4e0('0x9')](),controller[_0xa4e0('0x11')]);router['delete'](_0xa4e0('0xc'),auth[_0xa4e0('0x9')](),controller[_0xa4e0('0x12')]);module[_0xa4e0('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 1a1c340..f2f569a 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 _0xe659=['STRING','TEXT','sequelize'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xe659,0x1e2));var _0x9e65=function(_0x4ae6e9,_0x4a8468){_0x4ae6e9=_0x4ae6e9-0x0;var _0x2906ec=_0xe659[_0x4ae6e9];return _0x2906ec;};'use strict';var Sequelize=require(_0x9e65('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9e65('0x1')]},'node':{'type':Sequelize[_0x9e65('0x1')]},'application':{'type':Sequelize[_0x9e65('0x1')]},'data':{'type':Sequelize[_0x9e65('0x2')]},'project_name':{'type':Sequelize[_0x9e65('0x1')]},'callerid':{'type':Sequelize[_0x9e65('0x1')]}}; \ No newline at end of file +var _0xd5c0=['exports','STRING','TEXT','sequelize'];(function(_0x1fb4e1,_0x3d4ce6){var _0x22d1b0=function(_0x553822){while(--_0x553822){_0x1fb4e1['push'](_0x1fb4e1['shift']());}};_0x22d1b0(++_0x3d4ce6);}(_0xd5c0,0x77));var _0x0d5c=function(_0x17d389,_0x2f85bf){_0x17d389=_0x17d389-0x0;var _0x28a0c4=_0xd5c0[_0x17d389];return _0x28a0c4;};'use strict';var Sequelize=require(_0x0d5c('0x0'));module[_0x0d5c('0x1')]={'uniqueid':{'type':Sequelize[_0x0d5c('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x0d5c('0x2')]},'data':{'type':Sequelize[_0x0d5c('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 3fcdb51..73c92b0 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 _0xc6fe=['offset','set','Content-Range','save','update','destroy','then','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','fields','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xc6fe,0x158));var _0xec6f=function(_0x1cb37d,_0x3a1ae7){_0x1cb37d=_0x1cb37d-0x0;var _0x3b8714=_0xc6fe[_0x1cb37d];return _0x3b8714;};'use strict';var emlformat=require(_0xec6f('0x0'));var rimraf=require(_0xec6f('0x1'));var zipdir=require(_0xec6f('0x2'));var jsonpatch=require(_0xec6f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xec6f('0x4'));var Mustache=require(_0xec6f('0x5'));var util=require(_0xec6f('0x6'));var path=require('path');var sox=require(_0xec6f('0x7'));var csv=require(_0xec6f('0x8'));var ejs=require(_0xec6f('0x9'));var fs=require('fs');var fs_extra=require(_0xec6f('0xa'));var _=require('lodash');var squel=require(_0xec6f('0xb'));var crypto=require(_0xec6f('0xc'));var jsforce=require(_0xec6f('0xd'));var deskjs=require(_0xec6f('0xe'));var toCsv=require(_0xec6f('0x8'));var querystring=require(_0xec6f('0xf'));var Papa=require(_0xec6f('0x10'));var Redis=require('ioredis');var authService=require(_0xec6f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xec6f('0x12'));var hardwareService=require(_0xec6f('0x13'));var logger=require(_0xec6f('0x14'))(_0xec6f('0x15'));var utils=require(_0xec6f('0x16'));var config=require(_0xec6f('0x17'));var licenseUtil=require(_0xec6f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xab0602,_0x33148b){_0x33148b=_0x33148b||0xcc;return function(_0x276c03){if(_0x276c03){return _0xab0602[_0xec6f('0x19')](_0x33148b);}return _0xab0602[_0xec6f('0x1a')](_0x33148b)[_0xec6f('0x1b')]();};}function respondWithResult(_0x194896,_0x10b982){_0x10b982=_0x10b982||0xc8;return function(_0x30190f){if(_0x30190f){return _0x194896[_0xec6f('0x1a')](_0x10b982)[_0xec6f('0x1c')](_0x30190f);}};}function respondWithFilteredResult(_0xfebcf8,_0x8cdadb){return function(_0x88414c){if(_0x88414c){var _0x21115a=typeof _0x8cdadb['offset']===_0xec6f('0x1d')&&typeof _0x8cdadb['limit']===_0xec6f('0x1d');var _0x12cb9e=_0x88414c[_0xec6f('0x1e')];var _0x53363b=_0x21115a?0x0:_0x8cdadb['offset'];var _0x4a7146=_0x21115a?_0x88414c[_0xec6f('0x1e')]:_0x8cdadb[_0xec6f('0x1f')]+_0x8cdadb['limit'];var _0x19917a;if(_0x4a7146>=_0x12cb9e){_0x4a7146=_0x12cb9e;_0x19917a=0xc8;}else{_0x19917a=0xce;}_0xfebcf8['status'](_0x19917a);return _0xfebcf8[_0xec6f('0x20')](_0xec6f('0x21'),_0x53363b+'-'+_0x4a7146+'/'+_0x12cb9e)[_0xec6f('0x1c')](_0x88414c);}return null;};}function patchUpdates(_0x363986){return function(_0x2a57a6){try{jsonpatch['apply'](_0x2a57a6,_0x363986,!![]);}catch(_0x27775b){return BPromise['reject'](_0x27775b);}return _0x2a57a6[_0xec6f('0x22')]();};}function saveUpdates(_0x398e92,_0x5a1580){return function(_0x56ca7a){if(_0x56ca7a){return _0x56ca7a[_0xec6f('0x23')](_0x398e92)['then'](function(_0x41f72b){return _0x41f72b;});}return null;};}function removeEntity(_0x398628,_0x1d473d){return function(_0x3be681){if(_0x3be681){return _0x3be681[_0xec6f('0x24')]()[_0xec6f('0x25')](function(){_0x398628[_0xec6f('0x1a')](0xcc)[_0xec6f('0x1b')]();});}};}function handleEntityNotFound(_0x341c60,_0x2394ed){return function(_0x67c5a2){if(!_0x67c5a2){_0x341c60[_0xec6f('0x19')](0x194);}return _0x67c5a2;};}function handleError(_0x432dc0,_0x1b4fef){_0x1b4fef=_0x1b4fef||0x1f4;return function(_0x14bb63){logger['error'](_0x14bb63[_0xec6f('0x26')]);if(_0x14bb63[_0xec6f('0x27')]){delete _0x14bb63[_0xec6f('0x27')];}_0x432dc0[_0xec6f('0x1a')](_0x1b4fef)[_0xec6f('0x28')](_0x14bb63);};}exports['index']=function(_0x222842,_0x416a72){var _0x1897f0={},_0x5583ff={},_0x1e77fc={'count':0x0,'rows':[]};var _0x73a1c0=_[_0xec6f('0x29')](db[_0xec6f('0x2a')][_0xec6f('0x2b')],function(_0x15bb2e){return{'name':_0x15bb2e[_0xec6f('0x2c')],'type':_0x15bb2e[_0xec6f('0x2d')]['key']};});_0x5583ff['model']=_[_0xec6f('0x29')](_0x73a1c0,_0xec6f('0x27'));_0x5583ff['query']=_[_0xec6f('0x2e')](_0x222842[_0xec6f('0x2f')]);_0x5583ff[_0xec6f('0x30')]=_[_0xec6f('0x31')](_0x5583ff[_0xec6f('0x32')],_0x5583ff[_0xec6f('0x2f')]);_0x1897f0[_0xec6f('0x33')]=_[_0xec6f('0x31')](_0x5583ff[_0xec6f('0x32')],qs['fields'](_0x222842[_0xec6f('0x2f')]['fields']));_0x1897f0[_0xec6f('0x33')]=_0x1897f0[_0xec6f('0x33')][_0xec6f('0x34')]?_0x1897f0[_0xec6f('0x33')]:_0x5583ff[_0xec6f('0x32')];if(!_0x222842[_0xec6f('0x2f')][_0xec6f('0x35')](_0xec6f('0x36'))){_0x1897f0[_0xec6f('0x37')]=qs[_0xec6f('0x37')](_0x222842['query']['limit']);_0x1897f0[_0xec6f('0x1f')]=qs[_0xec6f('0x1f')](_0x222842[_0xec6f('0x2f')]['offset']);}_0x1897f0['order']=qs['sort'](_0x222842[_0xec6f('0x2f')][_0xec6f('0x38')]);_0x1897f0[_0xec6f('0x39')]=qs[_0xec6f('0x30')](_[_0xec6f('0x3a')](_0x222842[_0xec6f('0x2f')],_0x5583ff['filters']),_0x73a1c0);if(_0x222842[_0xec6f('0x2f')][_0xec6f('0x3b')]){_0x1897f0[_0xec6f('0x39')]=_[_0xec6f('0x3c')](_0x1897f0[_0xec6f('0x39')],{'$or':_[_0xec6f('0x29')](_0x73a1c0,function(_0x28a96c){if(_0x28a96c['type']!==_0xec6f('0x3d')){var _0x1ff2c9={};_0x1ff2c9[_0x28a96c[_0xec6f('0x27')]]={'$like':'%'+_0x222842['query'][_0xec6f('0x3b')]+'%'};return _0x1ff2c9;}})});}_0x1897f0=_[_0xec6f('0x3c')]({},_0x1897f0,_0x222842[_0xec6f('0x3e')]);var _0xc5a0d5={'where':_0x1897f0[_0xec6f('0x39')]};return db['SquareDetailsReport']['count'](_0xc5a0d5)[_0xec6f('0x25')](function(_0x47bfc8){_0x1e77fc['count']=_0x47bfc8;if(_0x222842[_0xec6f('0x2f')]['includeAll']){_0x1897f0[_0xec6f('0x3f')]=[{'all':!![]}];}return db[_0xec6f('0x2a')][_0xec6f('0x40')](_0x1897f0);})[_0xec6f('0x25')](function(_0x515b8d){_0x1e77fc[_0xec6f('0x41')]=_0x515b8d;return _0x1e77fc;})[_0xec6f('0x25')](respondWithFilteredResult(_0x416a72,_0x1897f0))[_0xec6f('0x42')](handleError(_0x416a72,null));};exports[_0xec6f('0x43')]=function(_0x56d559,_0xa7bad9){var _0x3e4ce0={'raw':!![],'where':{'id':_0x56d559[_0xec6f('0x44')]['id']}},_0xaf8687={};_0xaf8687[_0xec6f('0x32')]=_[_0xec6f('0x2e')](db[_0xec6f('0x2a')][_0xec6f('0x2b')]);_0xaf8687[_0xec6f('0x2f')]=_[_0xec6f('0x2e')](_0x56d559[_0xec6f('0x2f')]);_0xaf8687[_0xec6f('0x30')]=_[_0xec6f('0x31')](_0xaf8687[_0xec6f('0x32')],_0xaf8687[_0xec6f('0x2f')]);_0x3e4ce0['attributes']=_[_0xec6f('0x31')](_0xaf8687[_0xec6f('0x32')],qs[_0xec6f('0x45')](_0x56d559[_0xec6f('0x2f')][_0xec6f('0x45')]));_0x3e4ce0['attributes']=_0x3e4ce0['attributes'][_0xec6f('0x34')]?_0x3e4ce0['attributes']:_0xaf8687['model'];if(_0x56d559['query'][_0xec6f('0x46')]){_0x3e4ce0[_0xec6f('0x3f')]=[{'all':!![]}];}_0x3e4ce0=_[_0xec6f('0x3c')]({},_0x3e4ce0,_0x56d559[_0xec6f('0x3e')]);return db[_0xec6f('0x2a')]['find'](_0x3e4ce0)[_0xec6f('0x25')](handleEntityNotFound(_0xa7bad9,null))[_0xec6f('0x25')](respondWithResult(_0xa7bad9,null))['catch'](handleError(_0xa7bad9,null));};exports[_0xec6f('0x47')]=function(_0xa93ab6,_0x2dbe99){return db['SquareDetailsReport'][_0xec6f('0x47')](_0xa93ab6['body'],{})[_0xec6f('0x25')](respondWithResult(_0x2dbe99,0xc9))[_0xec6f('0x42')](handleError(_0x2dbe99,null));};exports[_0xec6f('0x23')]=function(_0x54a591,_0x2aa124){if(_0x54a591[_0xec6f('0x48')]['id']){delete _0x54a591[_0xec6f('0x48')]['id'];}return db[_0xec6f('0x2a')][_0xec6f('0x49')]({'where':{'id':_0x54a591['params']['id']}})[_0xec6f('0x25')](handleEntityNotFound(_0x2aa124,null))['then'](saveUpdates(_0x54a591[_0xec6f('0x48')],null))[_0xec6f('0x25')](respondWithResult(_0x2aa124,null))[_0xec6f('0x42')](handleError(_0x2aa124,null));};exports[_0xec6f('0x24')]=function(_0x7fa0a2,_0x32b828){return db[_0xec6f('0x2a')][_0xec6f('0x49')]({'where':{'id':_0x7fa0a2['params']['id']}})['then'](handleEntityNotFound(_0x32b828,null))[_0xec6f('0x25')](removeEntity(_0x32b828,null))['catch'](handleError(_0x32b828,null));};exports[_0xec6f('0x4a')]=function(_0x1ff4a4,_0x726522){return db[_0xec6f('0x2a')][_0xec6f('0x4a')]()['then'](respondWithResult(_0x726522,null))[_0xec6f('0x42')](handleError(_0x726522,null));}; \ No newline at end of file +var _0xf86c=['describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','include','find','create','body'];(function(_0x29473a,_0x9d35e6){var _0x582332=function(_0x538809){while(--_0x538809){_0x29473a['push'](_0x29473a['shift']());}};_0x582332(++_0x9d35e6);}(_0xf86c,0xd9));var _0xcf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xcf86('0x0'));var rimraf=require(_0xcf86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf86('0x2'));var rp=require(_0xcf86('0x3'));var moment=require('moment');var BPromise=require(_0xcf86('0x4'));var Mustache=require(_0xcf86('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcf86('0x6'));var ejs=require(_0xcf86('0x7'));var fs=require('fs');var fs_extra=require(_0xcf86('0x8'));var _=require('lodash');var squel=require(_0xcf86('0x9'));var crypto=require('crypto');var jsforce=require(_0xcf86('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xcf86('0x6'));var querystring=require(_0xcf86('0xb'));var Papa=require('papaparse');var Redis=require(_0xcf86('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xcf86('0xd'));var as=require(_0xcf86('0xe'));var hardwareService=require(_0xcf86('0xf'));var logger=require('../../config/logger')(_0xcf86('0x10'));var utils=require(_0xcf86('0x11'));var config=require(_0xcf86('0x12'));var licenseUtil=require(_0xcf86('0x13'));var db=require(_0xcf86('0x14'))['db'];function respondWithStatusCode(_0x12ef1a,_0x190bf5){_0x190bf5=_0x190bf5||0xcc;return function(_0x2a8d33){if(_0x2a8d33){return _0x12ef1a[_0xcf86('0x15')](_0x190bf5);}return _0x12ef1a[_0xcf86('0x16')](_0x190bf5)[_0xcf86('0x17')]();};}function respondWithResult(_0x17122b,_0x4349b4){_0x4349b4=_0x4349b4||0xc8;return function(_0x2b1617){if(_0x2b1617){return _0x17122b[_0xcf86('0x16')](_0x4349b4)[_0xcf86('0x18')](_0x2b1617);}};}function respondWithFilteredResult(_0x51c16d,_0x37074f){return function(_0x4c76b8){if(_0x4c76b8){var _0x3b2f5d=typeof _0x37074f[_0xcf86('0x19')]===_0xcf86('0x1a')&&typeof _0x37074f[_0xcf86('0x1b')]===_0xcf86('0x1a');var _0x5ca3cd=_0x4c76b8[_0xcf86('0x1c')];var _0x228765=_0x3b2f5d?0x0:_0x37074f[_0xcf86('0x19')];var _0x376e12=_0x3b2f5d?_0x4c76b8[_0xcf86('0x1c')]:_0x37074f['offset']+_0x37074f[_0xcf86('0x1b')];var _0x325762;if(_0x376e12>=_0x5ca3cd){_0x376e12=_0x5ca3cd;_0x325762=0xc8;}else{_0x325762=0xce;}_0x51c16d[_0xcf86('0x16')](_0x325762);return _0x51c16d['set'](_0xcf86('0x1d'),_0x228765+'-'+_0x376e12+'/'+_0x5ca3cd)[_0xcf86('0x18')](_0x4c76b8);}return null;};}function patchUpdates(_0xfb54b0){return function(_0x12f4b7){try{jsonpatch['apply'](_0x12f4b7,_0xfb54b0,!![]);}catch(_0x3a11c3){return BPromise[_0xcf86('0x1e')](_0x3a11c3);}return _0x12f4b7[_0xcf86('0x1f')]();};}function saveUpdates(_0x36c3a7,_0x5eee3e){return function(_0x319bd9){if(_0x319bd9){return _0x319bd9[_0xcf86('0x20')](_0x36c3a7)[_0xcf86('0x21')](function(_0x3ba304){return _0x3ba304;});}return null;};}function removeEntity(_0x1a7f21,_0x6f0bd2){return function(_0x51a41d){if(_0x51a41d){return _0x51a41d['destroy']()[_0xcf86('0x21')](function(){_0x1a7f21['status'](0xcc)[_0xcf86('0x17')]();});}};}function handleEntityNotFound(_0x6b0d1b,_0x122b4e){return function(_0x3b24d6){if(!_0x3b24d6){_0x6b0d1b[_0xcf86('0x15')](0x194);}return _0x3b24d6;};}function handleError(_0x2b6bbf,_0x14d5ca){_0x14d5ca=_0x14d5ca||0x1f4;return function(_0x41b24d){logger[_0xcf86('0x22')](_0x41b24d[_0xcf86('0x23')]);if(_0x41b24d[_0xcf86('0x24')]){delete _0x41b24d['name'];}_0x2b6bbf[_0xcf86('0x16')](_0x14d5ca)[_0xcf86('0x25')](_0x41b24d);};}exports[_0xcf86('0x26')]=function(_0x265c73,_0x23956c){var _0xe1f4fa={},_0x15e97d={},_0x296d8f={'count':0x0,'rows':[]};var _0x2e4309=_[_0xcf86('0x27')](db[_0xcf86('0x28')][_0xcf86('0x29')],function(_0x271230){return{'name':_0x271230[_0xcf86('0x2a')],'type':_0x271230[_0xcf86('0x2b')][_0xcf86('0x2c')]};});_0x15e97d[_0xcf86('0x2d')]=_[_0xcf86('0x27')](_0x2e4309,_0xcf86('0x24'));_0x15e97d[_0xcf86('0x2e')]=_['keys'](_0x265c73[_0xcf86('0x2e')]);_0x15e97d[_0xcf86('0x2f')]=_[_0xcf86('0x30')](_0x15e97d[_0xcf86('0x2d')],_0x15e97d[_0xcf86('0x2e')]);_0xe1f4fa[_0xcf86('0x31')]=_['intersection'](_0x15e97d[_0xcf86('0x2d')],qs[_0xcf86('0x32')](_0x265c73[_0xcf86('0x2e')][_0xcf86('0x32')]));_0xe1f4fa[_0xcf86('0x31')]=_0xe1f4fa['attributes'][_0xcf86('0x33')]?_0xe1f4fa[_0xcf86('0x31')]:_0x15e97d[_0xcf86('0x2d')];if(!_0x265c73[_0xcf86('0x2e')][_0xcf86('0x34')](_0xcf86('0x35'))){_0xe1f4fa['limit']=qs[_0xcf86('0x1b')](_0x265c73[_0xcf86('0x2e')]['limit']);_0xe1f4fa[_0xcf86('0x19')]=qs[_0xcf86('0x19')](_0x265c73['query'][_0xcf86('0x19')]);}_0xe1f4fa[_0xcf86('0x36')]=qs[_0xcf86('0x37')](_0x265c73['query'][_0xcf86('0x37')]);_0xe1f4fa['where']=qs[_0xcf86('0x2f')](_['pick'](_0x265c73[_0xcf86('0x2e')],_0x15e97d[_0xcf86('0x2f')]),_0x2e4309);if(_0x265c73[_0xcf86('0x2e')][_0xcf86('0x38')]){_0xe1f4fa[_0xcf86('0x39')]=_[_0xcf86('0x3a')](_0xe1f4fa[_0xcf86('0x39')],{'$or':_['map'](_0x2e4309,function(_0x33622f){if(_0x33622f[_0xcf86('0x2b')]!==_0xcf86('0x3b')){var _0x4bc968={};_0x4bc968[_0x33622f['name']]={'$like':'%'+_0x265c73[_0xcf86('0x2e')][_0xcf86('0x38')]+'%'};return _0x4bc968;}})});}_0xe1f4fa=_[_0xcf86('0x3a')]({},_0xe1f4fa,_0x265c73[_0xcf86('0x3c')]);var _0x4f3f26={'where':_0xe1f4fa[_0xcf86('0x39')]};return db[_0xcf86('0x28')]['count'](_0x4f3f26)[_0xcf86('0x21')](function(_0x150113){_0x296d8f[_0xcf86('0x1c')]=_0x150113;if(_0x265c73['query']['includeAll']){_0xe1f4fa['include']=[{'all':!![]}];}return db[_0xcf86('0x28')][_0xcf86('0x3d')](_0xe1f4fa);})[_0xcf86('0x21')](function(_0xe8c2f7){_0x296d8f[_0xcf86('0x3e')]=_0xe8c2f7;return _0x296d8f;})[_0xcf86('0x21')](respondWithFilteredResult(_0x23956c,_0xe1f4fa))[_0xcf86('0x3f')](handleError(_0x23956c,null));};exports[_0xcf86('0x40')]=function(_0x438e17,_0x5d1427){var _0x308a2b={'raw':!![],'where':{'id':_0x438e17[_0xcf86('0x41')]['id']}},_0x2fe376={};_0x2fe376[_0xcf86('0x2d')]=_[_0xcf86('0x42')](db['SquareDetailsReport'][_0xcf86('0x29')]);_0x2fe376[_0xcf86('0x2e')]=_[_0xcf86('0x42')](_0x438e17['query']);_0x2fe376[_0xcf86('0x2f')]=_['intersection'](_0x2fe376[_0xcf86('0x2d')],_0x2fe376['query']);_0x308a2b['attributes']=_[_0xcf86('0x30')](_0x2fe376['model'],qs[_0xcf86('0x32')](_0x438e17[_0xcf86('0x2e')][_0xcf86('0x32')]));_0x308a2b['attributes']=_0x308a2b[_0xcf86('0x31')]['length']?_0x308a2b[_0xcf86('0x31')]:_0x2fe376[_0xcf86('0x2d')];if(_0x438e17[_0xcf86('0x2e')]['includeAll']){_0x308a2b[_0xcf86('0x43')]=[{'all':!![]}];}_0x308a2b=_[_0xcf86('0x3a')]({},_0x308a2b,_0x438e17[_0xcf86('0x3c')]);return db['SquareDetailsReport'][_0xcf86('0x44')](_0x308a2b)[_0xcf86('0x21')](handleEntityNotFound(_0x5d1427,null))[_0xcf86('0x21')](respondWithResult(_0x5d1427,null))[_0xcf86('0x3f')](handleError(_0x5d1427,null));};exports[_0xcf86('0x45')]=function(_0x54ff66,_0x3b6dd7){return db[_0xcf86('0x28')][_0xcf86('0x45')](_0x54ff66[_0xcf86('0x46')],{})[_0xcf86('0x21')](respondWithResult(_0x3b6dd7,0xc9))[_0xcf86('0x3f')](handleError(_0x3b6dd7,null));};exports[_0xcf86('0x20')]=function(_0x1c80ef,_0x52f60b){if(_0x1c80ef[_0xcf86('0x46')]['id']){delete _0x1c80ef[_0xcf86('0x46')]['id'];}return db[_0xcf86('0x28')][_0xcf86('0x44')]({'where':{'id':_0x1c80ef[_0xcf86('0x41')]['id']}})[_0xcf86('0x21')](handleEntityNotFound(_0x52f60b,null))['then'](saveUpdates(_0x1c80ef[_0xcf86('0x46')],null))[_0xcf86('0x21')](respondWithResult(_0x52f60b,null))[_0xcf86('0x3f')](handleError(_0x52f60b,null));};exports['destroy']=function(_0x582e8e,_0x428b5e){return db[_0xcf86('0x28')]['find']({'where':{'id':_0x582e8e['params']['id']}})[_0xcf86('0x21')](handleEntityNotFound(_0x428b5e,null))[_0xcf86('0x21')](removeEntity(_0x428b5e,null))[_0xcf86('0x3f')](handleError(_0x428b5e,null));};exports[_0xcf86('0x47')]=function(_0x5c6be5,_0x50eeb6){return db['SquareDetailsReport'][_0xcf86('0x47')]()[_0xcf86('0x21')](respondWithResult(_0x50eeb6,null))[_0xcf86('0x3f')](handleError(_0x50eeb6,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 41a57d7..eb7c7ed 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 _0xb0d0=['request-promise','path','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','util','../../config/logger','api','moment','bluebird'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0xb0d0,0x1df));var _0x0b0d=function(_0x34ac7c,_0x4beec4){_0x34ac7c=_0x34ac7c-0x0;var _0x329c13=_0xb0d0[_0x34ac7c];return _0x329c13;};'use strict';var _=require('lodash');var util=require(_0x0b0d('0x0'));var logger=require(_0x0b0d('0x1'))(_0x0b0d('0x2'));var moment=require(_0x0b0d('0x3'));var BPromise=require(_0x0b0d('0x4'));var rp=require(_0x0b0d('0x5'));var fs=require('fs');var path=require(_0x0b0d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0b0d('0x7'));module[_0x0b0d('0x8')]=function(_0x107a7f,_0x3eaec4){return _0x107a7f['define'](_0x0b0d('0x9'),attributes,{'tableName':_0x0b0d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b90=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x4bba9b,_0x4ca5d3){var _0x1f4439=function(_0x4c00a6){while(--_0x4c00a6){_0x4bba9b['push'](_0x4bba9b['shift']());}};_0x1f4439(++_0x4ca5d3);}(_0x1b90,0xd1));var _0x01b9=function(_0x28cb01,_0x39e649){_0x28cb01=_0x28cb01-0x0;var _0x1fe8c1=_0x1b90[_0x28cb01];return _0x1fe8c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x01b9('0x0'))('api');var moment=require('moment');var BPromise=require(_0x01b9('0x1'));var rp=require(_0x01b9('0x2'));var fs=require('fs');var path=require(_0x01b9('0x3'));var rimraf=require(_0x01b9('0x4'));var config=require(_0x01b9('0x5'));var attributes=require(_0x01b9('0x6'));module[_0x01b9('0x7')]=function(_0x416863,_0x46a9ff){return _0x416863[_0x01b9('0x8')](_0x01b9('0x9'),attributes,{'tableName':_0x01b9('0xa'),'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 74c00f2..42bd0d4 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 _0xb62e=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','then','lodash','util'];(function(_0x52f669,_0x64641c){var _0x150690=function(_0x20c0bb){while(--_0x20c0bb){_0x52f669['push'](_0x52f669['shift']());}};_0x150690(++_0x64641c);}(_0xb62e,0x1de));var _0xeb62=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb62e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f5ea,_0x5e0dc4,_0x2065a0){return new BPromise(function(_0xab7049,_0x1e10ae){return client[_0xeb62('0xc')](_0x31f5ea,_0x2065a0)['then'](function(_0x5cdef3){logger[_0xeb62('0xd')](_0xeb62('0xe'),_0x5e0dc4,_0xeb62('0xf'));logger[_0xeb62('0x10')](_0xeb62('0x11'),_0x5e0dc4,_0xeb62('0xf'),JSON[_0xeb62('0x12')](_0x5cdef3));if(_0x5cdef3[_0xeb62('0x13')]){if(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x14')]===0x1f4){logger['error'](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);return _0x1e10ae(_0x5cdef3[_0xeb62('0x13')]['message']);}logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')]['message']);return _0xab7049(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);}else{logger[_0xeb62('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x5e0dc4,_0xeb62('0xf'));_0xab7049(_0x5cdef3[_0xeb62('0x16')][_0xeb62('0x15')]);}})[_0xeb62('0x17')](function(_0x3fb280){logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x3fb280);_0x1e10ae(_0x3fb280);});});}exports[_0xeb62('0x18')]=function(_0x39b138){var _0x27fd84=this;return new Promise(function(_0x27efc8,_0x11d516){return db[_0xeb62('0x19')]['create'](_0x39b138[_0xeb62('0x1a')],{'raw':_0x39b138[_0xeb62('0x1b')]?_0x39b138[_0xeb62('0x1b')][_0xeb62('0x1c')]===undefined?!![]:![]:!![]})[_0xeb62('0x1d')](function(_0x24cbf3){logger[_0xeb62('0xd')]('CreateSquareDetailsReport',_0x39b138);logger['debug'](_0xeb62('0x18'),_0x39b138,JSON[_0xeb62('0x12')](_0x24cbf3));_0x27efc8(_0x24cbf3);})[_0xeb62('0x17')](function(_0x13243f){logger[_0xeb62('0x13')]('CreateSquareDetailsReport',_0x13243f['message'],_0x39b138);_0x11d516(_0x27fd84[_0xeb62('0x13')](0x1f4,_0x13243f[_0xeb62('0x15')]));});});}; \ No newline at end of file +var _0x4b0f=['debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x407e73,_0x281dad){_0x407e73=_0x407e73-0x0;var _0x2600e5=_0x4b0f[_0x407e73];return _0x2600e5;};'use strict';var _=require('lodash');var util=require(_0xf4b0('0x0'));var moment=require(_0xf4b0('0x1'));var BPromise=require(_0xf4b0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4b0('0x3'));var db=require(_0xf4b0('0x4'))['db'];var utils=require(_0xf4b0('0x5'));var logger=require(_0xf4b0('0x6'))(_0xf4b0('0x7'));var config=require(_0xf4b0('0x8'));var jayson=require(_0xf4b0('0x9'));var client=jayson[_0xf4b0('0xa')][_0xf4b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x373042,_0x300b64,_0x35160f){return new BPromise(function(_0x3a2236,_0xd132d8){return client[_0xf4b0('0xc')](_0x373042,_0x35160f)[_0xf4b0('0xd')](function(_0x4906e9){logger[_0xf4b0('0xe')](_0xf4b0('0xf'),_0x300b64,_0xf4b0('0x10'));logger[_0xf4b0('0x11')](_0xf4b0('0x12'),_0x300b64,_0xf4b0('0x10'),JSON[_0xf4b0('0x13')](_0x4906e9));if(_0x4906e9[_0xf4b0('0x14')]){if(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x15')]===0x1f4){logger[_0xf4b0('0x14')](_0xf4b0('0xf'),_0x300b64,_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);return _0xd132d8(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);}logger[_0xf4b0('0x14')](_0xf4b0('0xf'),_0x300b64,_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);return _0x3a2236(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);}else{logger['info'](_0xf4b0('0xf'),_0x300b64,_0xf4b0('0x10'));_0x3a2236(_0x4906e9[_0xf4b0('0x17')]['message']);}})[_0xf4b0('0x18')](function(_0x1f2d74){logger[_0xf4b0('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x300b64,_0x1f2d74);_0xd132d8(_0x1f2d74);});});}exports[_0xf4b0('0x19')]=function(_0x390dbd){var _0x3e8ade=this;return new Promise(function(_0x543c88,_0x4cffc2){return db[_0xf4b0('0x1a')][_0xf4b0('0x1b')](_0x390dbd['body'],{'raw':_0x390dbd['options']?_0x390dbd[_0xf4b0('0x1c')][_0xf4b0('0x1d')]===undefined?!![]:![]:!![]})[_0xf4b0('0xd')](function(_0x4e65cd){logger[_0xf4b0('0xe')](_0xf4b0('0x19'),_0x390dbd);logger[_0xf4b0('0x11')](_0xf4b0('0x19'),_0x390dbd,JSON[_0xf4b0('0x13')](_0x4e65cd));_0x543c88(_0x4e65cd);})[_0xf4b0('0x18')](function(_0x221b1d){logger['error'](_0xf4b0('0x19'),_0x221b1d[_0xf4b0('0x16')],_0x390dbd);_0x4cffc2(_0x3e8ade[_0xf4b0('0x14')](0x1f4,_0x221b1d[_0xf4b0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index e6db911..a12529b 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 _0xf594=['index','/process/:pid/kill','exports','express','Router','get'];(function(_0x3fcca7,_0x27dfb1){var _0x489ed4=function(_0x31dafe){while(--_0x31dafe){_0x3fcca7['push'](_0x3fcca7['shift']());}};_0x489ed4(++_0x27dfb1);}(_0xf594,0x1d1));var _0x4f59=function(_0x185ae4,_0x294e7a){_0x185ae4=_0x185ae4-0x0;var _0x3df401=_0xf594[_0x185ae4];return _0x3df401;};'use strict';var express=require(_0x4f59('0x0'));var router=express[_0x4f59('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x4f59('0x2')]('/',auth['isAuthenticated'](),controller[_0x4f59('0x3')]);router['get'](_0x4f59('0x4'),auth['isAuthenticated'](),controller['killProcess']);module[_0x4f59('0x5')]=router; \ No newline at end of file +var _0xcdea=['isAuthenticated','/process/:pid/kill','killProcess','express','Router','./system.controller','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcdea,0x15a));var _0xacde=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0xcdea[_0x287a47];return _0x3fb726;};'use strict';var express=require(_0xacde('0x0'));var router=express[_0xacde('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xacde('0x2'));router[_0xacde('0x3')]('/',auth[_0xacde('0x4')](),controller['index']);router[_0xacde('0x3')](_0xacde('0x5'),auth[_0xacde('0x4')](),controller[_0xacde('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 6c1df43..e5fef62 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 _0xe48c=['util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','then','status','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','api'];(function(_0x116ecc,_0x30f13f){var _0x355701=function(_0x535982){while(--_0x535982){_0x116ecc['push'](_0x116ecc['shift']());}};_0x355701(++_0x30f13f);}(_0xe48c,0x19d));var _0xce48=function(_0x55c0fe,_0x24ebad){_0x55c0fe=_0x55c0fe-0x0;var _0x2ac363=_0xe48c[_0x55c0fe];return _0x2ac363;};'use strict';var info=require('systeminformation');var exec=require(_0xce48('0x0'))['exec'];var logger=require(_0xce48('0x1'))(_0xce48('0x2'));var util=require(_0xce48('0x3'));var BPromise=require(_0xce48('0x4'));var _=require('lodash');function handleError(_0x4ca935,_0x539954,_0xc7329e){_0x539954=_0x539954||0x1f4;return function(_0x25f979){logger[_0xce48('0x5')](_0xce48('0x6'),_0xc7329e,_0x539954,util[_0xce48('0x7')](_0x25f979,{'showHidden':![],'depth':null}));delete _0x25f979[_0xce48('0x8')];_0x4ca935['status'](_0x539954)[_0xce48('0x9')](_0x25f979);};}exports[_0xce48('0xa')]=function(_0x33611b,_0x4d61fe){return info['getAllData']()[_0xce48('0xb')](function(_0x2e6646){return _0x4d61fe[_0xce48('0xc')](0xc8)[_0xce48('0xd')](_0x2e6646);})[_0xce48('0xe')](function(_0x1d1ebf){return _0x4d61fe['status'](0x1f4)[_0xce48('0xd')](_0x1d1ebf);});};exports[_0xce48('0xf')]=function(_0x4e6ffe,_0x49fba6){var _0x448ad0=[_0xce48('0x10')];return new BPromise(function(_0x1bc5c5,_0x2d4912){return exec(util[_0xce48('0x11')](_0xce48('0x12'),_0x4e6ffe[_0xce48('0x13')][_0xce48('0x14')]),function(_0xac2dd7,_0x202443,_0x2ad996){if(_0xac2dd7){return _0x2d4912(_0xac2dd7);}return _0x1bc5c5(_0x202443);});})[_0xce48('0xb')](function(_0x37f20d){var _0x4eb49b=![];var _0x544dec=_0x37f20d[_0xce48('0x15')](/\n/);for(var _0x3533d9=0x0,_0xc414be=_0x448ad0[_0xce48('0x16')];_0x3533d9<_0xc414be,_0x4eb49b===![];_0x3533d9+=0x1){if(_0x37f20d['indexOf'](_0x448ad0[_0x3533d9])>=0x0){_0x4eb49b=!![];}}if(!_0x4eb49b){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4e6ffe[_0xce48('0x13')]['pid']));}process[_0xce48('0x17')](_0x4e6ffe[_0xce48('0x13')][_0xce48('0x14')],_0xce48('0x18'));return _0x49fba6['status'](0xc8)[_0xce48('0xd')]({'message':util[_0xce48('0x11')](_0xce48('0x19'),_0x4e6ffe[_0xce48('0x13')][_0xce48('0x14')])});})[_0xce48('0xe')](handleError(_0x49fba6,null,_0xce48('0xf')));}; \ No newline at end of file +var _0xc5a9=['pid','split','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','then','json','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params'];(function(_0x1c815d,_0x484fe3){var _0x52d1f6=function(_0x157840){while(--_0x157840){_0x1c815d['push'](_0x1c815d['shift']());}};_0x52d1f6(++_0x484fe3);}(_0xc5a9,0x126));var _0x9c5a=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xc5a9[_0x4c12ec];return _0x3ae42c;};'use strict';var info=require(_0x9c5a('0x0'));var exec=require(_0x9c5a('0x1'))[_0x9c5a('0x2')];var logger=require('../../config/logger')('api');var util=require(_0x9c5a('0x3'));var BPromise=require(_0x9c5a('0x4'));var _=require(_0x9c5a('0x5'));function handleError(_0x16297c,_0x1432d1,_0x4a65e3){_0x1432d1=_0x1432d1||0x1f4;return function(_0xd2788b){logger[_0x9c5a('0x6')](_0x9c5a('0x7'),_0x4a65e3,_0x1432d1,util[_0x9c5a('0x8')](_0xd2788b,{'showHidden':![],'depth':null}));delete _0xd2788b[_0x9c5a('0x9')];_0x16297c[_0x9c5a('0xa')](_0x1432d1)[_0x9c5a('0xb')](_0xd2788b);};}exports['index']=function(_0x5d4a68,_0xda996f){return info[_0x9c5a('0xc')]()[_0x9c5a('0xd')](function(_0x329682){return _0xda996f['status'](0xc8)['json'](_0x329682);})['catch'](function(_0x1e761f){return _0xda996f[_0x9c5a('0xa')](0x1f4)[_0x9c5a('0xe')](_0x1e761f);});};exports[_0x9c5a('0xf')]=function(_0x2c8a0d,_0x17d470){var _0x398502=['components/import/cm'];return new BPromise(function(_0x25788a,_0x1b8f17){return exec(util['format'](_0x9c5a('0x10'),_0x2c8a0d[_0x9c5a('0x11')][_0x9c5a('0x12')]),function(_0x27975a,_0x6a7364,_0x5d59a6){if(_0x27975a){return _0x1b8f17(_0x27975a);}return _0x25788a(_0x6a7364);});})[_0x9c5a('0xd')](function(_0x2e600f){var _0x53169a=![];var _0x539a8a=_0x2e600f[_0x9c5a('0x13')](/\n/);for(var _0x2b1aa3=0x0,_0x45110a=_0x398502['length'];_0x2b1aa3<_0x45110a,_0x53169a===![];_0x2b1aa3+=0x1){if(_0x2e600f['indexOf'](_0x398502[_0x2b1aa3])>=0x0){_0x53169a=!![];}}if(!_0x53169a){throw new Error(util[_0x9c5a('0x14')](_0x9c5a('0x15'),_0x2c8a0d[_0x9c5a('0x11')][_0x9c5a('0x12')]));}process[_0x9c5a('0x16')](_0x2c8a0d['params'][_0x9c5a('0x12')],_0x9c5a('0x17'));return _0x17d470[_0x9c5a('0xa')](0xc8)[_0x9c5a('0xe')]({'message':util[_0x9c5a('0x14')](_0x9c5a('0x18'),_0x2c8a0d[_0x9c5a('0x11')][_0x9c5a('0x12')])});})[_0x9c5a('0x19')](handleError(_0x17d470,null,_0x9c5a('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 49f58e7..f0b10b6 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 _0x55a6=['put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','show','post','create'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x55a6,0x74));var _0x655a=function(_0x5c06a2,_0x3372b4){_0x5c06a2=_0x5c06a2-0x0;var _0x5d7bcb=_0x55a6[_0x5c06a2];return _0x5d7bcb;};'use strict';var multer=require(_0x655a('0x0'));var util=require(_0x655a('0x1'));var path=require(_0x655a('0x2'));var timeout=require(_0x655a('0x3'));var express=require(_0x655a('0x4'));var router=express[_0x655a('0x5')]();var fs_extra=require(_0x655a('0x6'));var auth=require(_0x655a('0x7'));var interaction=require(_0x655a('0x8'));var config=require('../../config/environment');var controller=require(_0x655a('0x9'));router[_0x655a('0xa')]('/',auth[_0x655a('0xb')](),controller[_0x655a('0xc')]);router[_0x655a('0xa')]('/:id',auth[_0x655a('0xb')](),controller[_0x655a('0xd')]);router[_0x655a('0xe')]('/',auth[_0x655a('0xb')](),controller[_0x655a('0xf')]);router[_0x655a('0x10')]('/:id',auth[_0x655a('0xb')](),controller[_0x655a('0x11')]);router[_0x655a('0x12')](_0x655a('0x13'),auth[_0x655a('0xb')](),controller[_0x655a('0x14')]);module[_0x655a('0x15')]=router; \ No newline at end of file +var _0x55af=['show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id'];(function(_0x3d8ad1,_0x575b49){var _0x2c621e=function(_0x366b05){while(--_0x366b05){_0x3d8ad1['push'](_0x3d8ad1['shift']());}};_0x2c621e(++_0x575b49);}(_0x55af,0x1ab));var _0xf55a=function(_0x352c0b,_0x16cadf){_0x352c0b=_0x352c0b-0x0;var _0x3f230e=_0x55af[_0x352c0b];return _0x3f230e;};'use strict';var multer=require(_0xf55a('0x0'));var util=require(_0xf55a('0x1'));var path=require(_0xf55a('0x2'));var timeout=require(_0xf55a('0x3'));var express=require(_0xf55a('0x4'));var router=express[_0xf55a('0x5')]();var fs_extra=require(_0xf55a('0x6'));var auth=require(_0xf55a('0x7'));var interaction=require(_0xf55a('0x8'));var config=require(_0xf55a('0x9'));var controller=require('./tag.controller');router['get']('/',auth[_0xf55a('0xa')](),controller['index']);router[_0xf55a('0xb')](_0xf55a('0xc'),auth[_0xf55a('0xa')](),controller[_0xf55a('0xd')]);router[_0xf55a('0xe')]('/',auth[_0xf55a('0xa')](),controller[_0xf55a('0xf')]);router[_0xf55a('0x10')](_0xf55a('0xc'),auth[_0xf55a('0xa')](),controller[_0xf55a('0x11')]);router[_0xf55a('0x12')]('/:id',auth[_0xf55a('0xa')](),controller['destroy']);module[_0xf55a('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 731ece0..5ed31c5 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 _0x7d98=['STRING','name','#0091EA','sequelize'];(function(_0x450d5b,_0x639c78){var _0x18f6cd=function(_0x2ddca0){while(--_0x2ddca0){_0x450d5b['push'](_0x450d5b['shift']());}};_0x18f6cd(++_0x639c78);}(_0x7d98,0xe7));var _0x87d9=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0x7d98[_0x39872b];return _0x55fa18;};'use strict';var Sequelize=require(_0x87d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x87d9('0x1')],'unique':_0x87d9('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x87d9('0x1')],'defaultValue':_0x87d9('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf894=['STRING','name','#0091EA','sequelize','exports'];(function(_0x2b8722,_0x50d540){var _0x20c180=function(_0x595b40){while(--_0x595b40){_0x2b8722['push'](_0x2b8722['shift']());}};_0x20c180(++_0x50d540);}(_0xf894,0xfd));var _0x4f89=function(_0x2dcb97,_0x498bc5){_0x2dcb97=_0x2dcb97-0x0;var _0x2884c7=_0xf894[_0x2dcb97];return _0x2884c7;};'use strict';var Sequelize=require(_0x4f89('0x0'));module[_0x4f89('0x1')]={'name':{'type':Sequelize[_0x4f89('0x2')],'unique':_0x4f89('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4f89('0x2')],'defaultValue':_0x4f89('0x4')},'description':{'type':Sequelize[_0x4f89('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 1c7f2b7..edda39b 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 _0xb717=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Tags','end','sendStatus','stack','name','send','map','Tag','rawAttributes','fieldName','type','model'];(function(_0x430821,_0x4f6a22){var _0x282fa0=function(_0x2386bc){while(--_0x2386bc){_0x430821['push'](_0x430821['shift']());}};_0x282fa0(++_0x4f6a22);}(_0xb717,0x1b4));var _0x7b71=function(_0x53e9f9,_0xfe79f9){_0x53e9f9=_0x53e9f9-0x0;var _0x46c9f2=_0xb717[_0x53e9f9];return _0x46c9f2;};'use strict';var emlformat=require(_0x7b71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b71('0x2'));var moment=require(_0x7b71('0x3'));var BPromise=require(_0x7b71('0x4'));var Mustache=require('mustache');var util=require(_0x7b71('0x5'));var path=require(_0x7b71('0x6'));var sox=require(_0x7b71('0x7'));var csv=require(_0x7b71('0x8'));var ejs=require(_0x7b71('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b71('0xa'));var squel=require(_0x7b71('0xb'));var crypto=require(_0x7b71('0xc'));var jsforce=require(_0x7b71('0xd'));var deskjs=require(_0x7b71('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7b71('0xf'));var Papa=require(_0x7b71('0x10'));var Redis=require('ioredis');var authService=require(_0x7b71('0x11'));var qs=require(_0x7b71('0x12'));var as=require(_0x7b71('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b71('0x14'))('api');var utils=require(_0x7b71('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7b71('0x16'));var db=require(_0x7b71('0x17'))['db'];function respondWithStatusCode(_0x291ba5,_0x101181){_0x101181=_0x101181||0xcc;return function(_0x45c890){if(_0x45c890){return _0x291ba5['sendStatus'](_0x101181);}return _0x291ba5[_0x7b71('0x18')](_0x101181)['end']();};}function respondWithResult(_0x121e8f,_0x22114a){_0x22114a=_0x22114a||0xc8;return function(_0x4f1f41){if(_0x4f1f41){return _0x121e8f[_0x7b71('0x18')](_0x22114a)[_0x7b71('0x19')](_0x4f1f41);}};}function respondWithFilteredResult(_0x4266e5,_0x5888f9){return function(_0x5e7c3a){if(_0x5e7c3a){var _0xadd51e=typeof _0x5888f9[_0x7b71('0x1a')]===_0x7b71('0x1b')&&typeof _0x5888f9[_0x7b71('0x1c')]==='undefined';var _0x268090=_0x5e7c3a['count'];var _0x4adce8=_0xadd51e?0x0:_0x5888f9[_0x7b71('0x1a')];var _0xbde25=_0xadd51e?_0x5e7c3a[_0x7b71('0x1d')]:_0x5888f9[_0x7b71('0x1a')]+_0x5888f9[_0x7b71('0x1c')];var _0x51d647;if(_0xbde25>=_0x268090){_0xbde25=_0x268090;_0x51d647=0xc8;}else{_0x51d647=0xce;}_0x4266e5[_0x7b71('0x18')](_0x51d647);return _0x4266e5[_0x7b71('0x1e')](_0x7b71('0x1f'),_0x4adce8+'-'+_0xbde25+'/'+_0x268090)[_0x7b71('0x19')](_0x5e7c3a);}return null;};}function patchUpdates(_0x206000){return function(_0x297918){try{jsonpatch['apply'](_0x297918,_0x206000,!![]);}catch(_0x459c8b){return BPromise[_0x7b71('0x20')](_0x459c8b);}return _0x297918[_0x7b71('0x21')]();};}function saveUpdates(_0x375f85,_0x47d933){return function(_0x55ed9c){if(_0x55ed9c){return _0x55ed9c[_0x7b71('0x22')](_0x375f85)[_0x7b71('0x23')](function(_0x467f1a){return _0x467f1a;});}return null;};}function removeEntity(_0x33ad80,_0x3aca34){return function(_0x478dd8){if(_0x478dd8){return _0x478dd8[_0x7b71('0x24')]()['then'](function(){var _0x16c1f3=_0x478dd8[_0x7b71('0x25')]({'plain':!![]});var _0x19a6f5=_0x7b71('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x19a6f5,'resourceId':_0x16c1f3['id']}})[_0x7b71('0x23')](function(){return _0x478dd8;});})[_0x7b71('0x23')](function(){_0x33ad80['status'](0xcc)[_0x7b71('0x27')]();});}};}function handleEntityNotFound(_0x214555,_0x7c978b){return function(_0x2f9ca9){if(!_0x2f9ca9){_0x214555[_0x7b71('0x28')](0x194);}return _0x2f9ca9;};}function handleError(_0x5209b6,_0x55ae81){_0x55ae81=_0x55ae81||0x1f4;return function(_0x2b323b){logger['error'](_0x2b323b[_0x7b71('0x29')]);if(_0x2b323b['name']){delete _0x2b323b[_0x7b71('0x2a')];}_0x5209b6[_0x7b71('0x18')](_0x55ae81)[_0x7b71('0x2b')](_0x2b323b);};}exports['index']=function(_0x1e4e89,_0xc29e2b){var _0x21ef65={},_0x5b5a4b={},_0x5e11e1={'count':0x0,'rows':[]};var _0xd100d4=_[_0x7b71('0x2c')](db[_0x7b71('0x2d')][_0x7b71('0x2e')],function(_0x43925c){return{'name':_0x43925c[_0x7b71('0x2f')],'type':_0x43925c[_0x7b71('0x30')]['key']};});_0x5b5a4b[_0x7b71('0x31')]=_[_0x7b71('0x2c')](_0xd100d4,_0x7b71('0x2a'));_0x5b5a4b['query']=_[_0x7b71('0x32')](_0x1e4e89[_0x7b71('0x33')]);_0x5b5a4b[_0x7b71('0x34')]=_[_0x7b71('0x35')](_0x5b5a4b[_0x7b71('0x31')],_0x5b5a4b[_0x7b71('0x33')]);_0x21ef65['attributes']=_[_0x7b71('0x35')](_0x5b5a4b[_0x7b71('0x31')],qs[_0x7b71('0x36')](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x36')]));_0x21ef65['attributes']=_0x21ef65[_0x7b71('0x37')][_0x7b71('0x38')]?_0x21ef65[_0x7b71('0x37')]:_0x5b5a4b[_0x7b71('0x31')];if(!_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x39')](_0x7b71('0x3a'))){_0x21ef65[_0x7b71('0x1c')]=qs['limit'](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x1c')]);_0x21ef65[_0x7b71('0x1a')]=qs[_0x7b71('0x1a')](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x1a')]);}_0x21ef65[_0x7b71('0x3b')]=qs['sort'](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3c')]);_0x21ef65[_0x7b71('0x3d')]=qs[_0x7b71('0x34')](_['pick'](_0x1e4e89[_0x7b71('0x33')],_0x5b5a4b[_0x7b71('0x34')]),_0xd100d4);if(_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3e')]){_0x21ef65[_0x7b71('0x3d')]=_[_0x7b71('0x3f')](_0x21ef65[_0x7b71('0x3d')],{'$or':_[_0x7b71('0x2c')](_0xd100d4,function(_0x30e9d1){if(_0x30e9d1[_0x7b71('0x30')]!==_0x7b71('0x40')){var _0x154dd5={};_0x154dd5[_0x30e9d1['name']]={'$like':'%'+_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3e')]+'%'};return _0x154dd5;}})});}_0x21ef65=_['merge']({},_0x21ef65,_0x1e4e89[_0x7b71('0x41')]);var _0x411c57={'where':_0x21ef65[_0x7b71('0x3d')]};return db[_0x7b71('0x2d')][_0x7b71('0x1d')](_0x411c57)['then'](function(_0x37cf27){_0x5e11e1[_0x7b71('0x1d')]=_0x37cf27;if(_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x42')]){_0x21ef65[_0x7b71('0x43')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x21ef65);})[_0x7b71('0x23')](function(_0x541730){_0x5e11e1[_0x7b71('0x44')]=_0x541730;return _0x5e11e1;})[_0x7b71('0x23')](respondWithFilteredResult(_0xc29e2b,_0x21ef65))[_0x7b71('0x45')](handleError(_0xc29e2b,null));};exports[_0x7b71('0x46')]=function(_0x3c3ffb,_0x324b28){var _0x23a762={'raw':!![],'where':{'id':_0x3c3ffb[_0x7b71('0x47')]['id']}},_0x5b73a6={};_0x5b73a6[_0x7b71('0x31')]=_['keys'](db[_0x7b71('0x2d')][_0x7b71('0x2e')]);_0x5b73a6[_0x7b71('0x33')]=_[_0x7b71('0x32')](_0x3c3ffb[_0x7b71('0x33')]);_0x5b73a6[_0x7b71('0x34')]=_[_0x7b71('0x35')](_0x5b73a6[_0x7b71('0x31')],_0x5b73a6[_0x7b71('0x33')]);_0x23a762[_0x7b71('0x37')]=_[_0x7b71('0x35')](_0x5b73a6[_0x7b71('0x31')],qs[_0x7b71('0x36')](_0x3c3ffb['query'][_0x7b71('0x36')]));_0x23a762[_0x7b71('0x37')]=_0x23a762['attributes']['length']?_0x23a762['attributes']:_0x5b73a6[_0x7b71('0x31')];if(_0x3c3ffb[_0x7b71('0x33')][_0x7b71('0x42')]){_0x23a762['include']=[{'all':!![]}];}_0x23a762=_[_0x7b71('0x3f')]({},_0x23a762,_0x3c3ffb[_0x7b71('0x41')]);return db['Tag'][_0x7b71('0x48')](_0x23a762)[_0x7b71('0x23')](handleEntityNotFound(_0x324b28,null))[_0x7b71('0x23')](respondWithResult(_0x324b28,null))['catch'](handleError(_0x324b28,null));};exports[_0x7b71('0x49')]=function(_0x18cb19,_0x945c68){return db[_0x7b71('0x2d')][_0x7b71('0x49')](_0x18cb19[_0x7b71('0x4a')],{})[_0x7b71('0x23')](function(_0x30e8d8){var _0xdb438=_0x18cb19[_0x7b71('0x4b')][_0x7b71('0x25')]({'plain':!![]});if(!_0xdb438)throw new Error(_0x7b71('0x4c'));if(_0xdb438['role']===_0x7b71('0x4b')){var _0x504cdf=_0x30e8d8[_0x7b71('0x25')]({'plain':!![]});var _0x154f72=_0x7b71('0x26');return db[_0x7b71('0x4d')][_0x7b71('0x48')]({'where':{'name':_0x154f72,'userProfileId':_0xdb438[_0x7b71('0x4e')]},'raw':!![]})['then'](function(_0x318605){if(_0x318605&&_0x318605['autoAssociation']===0x0){return db['UserProfileResource'][_0x7b71('0x49')]({'name':_0x504cdf['name'],'resourceId':_0x504cdf['id'],'type':_0x318605[_0x7b71('0x2a')],'sectionId':_0x318605['id']},{})[_0x7b71('0x23')](function(){return _0x30e8d8;});}else{return _0x30e8d8;}})[_0x7b71('0x45')](function(_0x38cf0e){logger[_0x7b71('0x4f')](_0x7b71('0x50'),_0x38cf0e);throw _0x38cf0e;});}return _0x30e8d8;})[_0x7b71('0x23')](respondWithResult(_0x945c68,0xc9))[_0x7b71('0x45')](handleError(_0x945c68,null));};exports[_0x7b71('0x22')]=function(_0x38395a,_0xbb46b3){if(_0x38395a['body']['id']){delete _0x38395a['body']['id'];}return db[_0x7b71('0x2d')]['find']({'where':{'id':_0x38395a[_0x7b71('0x47')]['id']}})[_0x7b71('0x23')](handleEntityNotFound(_0xbb46b3,null))[_0x7b71('0x23')](saveUpdates(_0x38395a['body'],null))['then'](respondWithResult(_0xbb46b3,null))['catch'](handleError(_0xbb46b3,null));};exports[_0x7b71('0x24')]=function(_0x48b486,_0x1d3acf){return db[_0x7b71('0x2d')]['find']({'where':{'id':_0x48b486[_0x7b71('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d3acf,null))[_0x7b71('0x23')](removeEntity(_0x1d3acf,null))['catch'](handleError(_0x1d3acf,null));}; \ No newline at end of file +var _0x5db8=['model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','VIRTUAL','merge','includeAll','findAll','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Tags','error','stack','name','send','index','map','Tag','fieldName','type','key','query','keys','intersection'];(function(_0x444927,_0x1e178f){var _0x498eea=function(_0x16b241){while(--_0x16b241){_0x444927['push'](_0x444927['shift']());}};_0x498eea(++_0x1e178f);}(_0x5db8,0xbb));var _0x85db=function(_0x458ed6,_0x504646){_0x458ed6=_0x458ed6-0x0;var _0xa5dfd9=_0x5db8[_0x458ed6];return _0xa5dfd9;};'use strict';var emlformat=require(_0x85db('0x0'));var rimraf=require(_0x85db('0x1'));var zipdir=require(_0x85db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85db('0x3'));var moment=require(_0x85db('0x4'));var BPromise=require(_0x85db('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x85db('0x6'));var sox=require(_0x85db('0x7'));var csv=require(_0x85db('0x8'));var ejs=require(_0x85db('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x85db('0xa'));var crypto=require(_0x85db('0xb'));var jsforce=require(_0x85db('0xc'));var deskjs=require(_0x85db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x85db('0xe'));var Papa=require('papaparse');var Redis=require(_0x85db('0xf'));var authService=require(_0x85db('0x10'));var qs=require(_0x85db('0x11'));var as=require(_0x85db('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x85db('0x13'));var config=require(_0x85db('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x85db('0x15'))['db'];function respondWithStatusCode(_0x541f2f,_0x437f7a){_0x437f7a=_0x437f7a||0xcc;return function(_0x35f8c6){if(_0x35f8c6){return _0x541f2f[_0x85db('0x16')](_0x437f7a);}return _0x541f2f[_0x85db('0x17')](_0x437f7a)[_0x85db('0x18')]();};}function respondWithResult(_0xb7ea66,_0x2b7507){_0x2b7507=_0x2b7507||0xc8;return function(_0x25ec64){if(_0x25ec64){return _0xb7ea66[_0x85db('0x17')](_0x2b7507)[_0x85db('0x19')](_0x25ec64);}};}function respondWithFilteredResult(_0x1e9dec,_0x270fd7){return function(_0x2be61d){if(_0x2be61d){var _0x5ccfef=typeof _0x270fd7[_0x85db('0x1a')]===_0x85db('0x1b')&&typeof _0x270fd7[_0x85db('0x1c')]===_0x85db('0x1b');var _0x2ecd71=_0x2be61d[_0x85db('0x1d')];var _0x3209b3=_0x5ccfef?0x0:_0x270fd7['offset'];var _0x37ac04=_0x5ccfef?_0x2be61d[_0x85db('0x1d')]:_0x270fd7[_0x85db('0x1a')]+_0x270fd7[_0x85db('0x1c')];var _0x4d976d;if(_0x37ac04>=_0x2ecd71){_0x37ac04=_0x2ecd71;_0x4d976d=0xc8;}else{_0x4d976d=0xce;}_0x1e9dec[_0x85db('0x17')](_0x4d976d);return _0x1e9dec[_0x85db('0x1e')](_0x85db('0x1f'),_0x3209b3+'-'+_0x37ac04+'/'+_0x2ecd71)[_0x85db('0x19')](_0x2be61d);}return null;};}function patchUpdates(_0x107c10){return function(_0x5c37d7){try{jsonpatch[_0x85db('0x20')](_0x5c37d7,_0x107c10,!![]);}catch(_0x398aa2){return BPromise[_0x85db('0x21')](_0x398aa2);}return _0x5c37d7[_0x85db('0x22')]();};}function saveUpdates(_0x44c122,_0x3842d7){return function(_0x3a7148){if(_0x3a7148){return _0x3a7148[_0x85db('0x23')](_0x44c122)['then'](function(_0xfffea2){return _0xfffea2;});}return null;};}function removeEntity(_0x2534bc,_0x57fe5b){return function(_0x3381ec){if(_0x3381ec){return _0x3381ec[_0x85db('0x24')]()[_0x85db('0x25')](function(){var _0x51c948=_0x3381ec[_0x85db('0x26')]({'plain':!![]});var _0x46f428=_0x85db('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x46f428,'resourceId':_0x51c948['id']}})['then'](function(){return _0x3381ec;});})[_0x85db('0x25')](function(){_0x2534bc[_0x85db('0x17')](0xcc)[_0x85db('0x18')]();});}};}function handleEntityNotFound(_0x51b748,_0x71c6f4){return function(_0xc2abb8){if(!_0xc2abb8){_0x51b748[_0x85db('0x16')](0x194);}return _0xc2abb8;};}function handleError(_0x574bcc,_0x5c8ddd){_0x5c8ddd=_0x5c8ddd||0x1f4;return function(_0x299013){logger[_0x85db('0x28')](_0x299013[_0x85db('0x29')]);if(_0x299013[_0x85db('0x2a')]){delete _0x299013[_0x85db('0x2a')];}_0x574bcc[_0x85db('0x17')](_0x5c8ddd)[_0x85db('0x2b')](_0x299013);};}exports[_0x85db('0x2c')]=function(_0x6ee161,_0x1edc8d){var _0x580e90={},_0x4a15b9={},_0x13ad98={'count':0x0,'rows':[]};var _0x5e0e75=_[_0x85db('0x2d')](db[_0x85db('0x2e')]['rawAttributes'],function(_0x1d15b0){return{'name':_0x1d15b0[_0x85db('0x2f')],'type':_0x1d15b0[_0x85db('0x30')][_0x85db('0x31')]};});_0x4a15b9['model']=_[_0x85db('0x2d')](_0x5e0e75,_0x85db('0x2a'));_0x4a15b9[_0x85db('0x32')]=_[_0x85db('0x33')](_0x6ee161[_0x85db('0x32')]);_0x4a15b9['filters']=_[_0x85db('0x34')](_0x4a15b9[_0x85db('0x35')],_0x4a15b9[_0x85db('0x32')]);_0x580e90[_0x85db('0x36')]=_['intersection'](_0x4a15b9[_0x85db('0x35')],qs[_0x85db('0x37')](_0x6ee161[_0x85db('0x32')]['fields']));_0x580e90['attributes']=_0x580e90[_0x85db('0x36')][_0x85db('0x38')]?_0x580e90['attributes']:_0x4a15b9[_0x85db('0x35')];if(!_0x6ee161[_0x85db('0x32')][_0x85db('0x39')](_0x85db('0x3a'))){_0x580e90[_0x85db('0x1c')]=qs[_0x85db('0x1c')](_0x6ee161[_0x85db('0x32')][_0x85db('0x1c')]);_0x580e90[_0x85db('0x1a')]=qs[_0x85db('0x1a')](_0x6ee161[_0x85db('0x32')][_0x85db('0x1a')]);}_0x580e90['order']=qs[_0x85db('0x3b')](_0x6ee161[_0x85db('0x32')][_0x85db('0x3b')]);_0x580e90[_0x85db('0x3c')]=qs['filters'](_[_0x85db('0x3d')](_0x6ee161[_0x85db('0x32')],_0x4a15b9[_0x85db('0x3e')]),_0x5e0e75);if(_0x6ee161[_0x85db('0x32')]['filter']){_0x580e90['where']=_['merge'](_0x580e90['where'],{'$or':_['map'](_0x5e0e75,function(_0x3b9d1b){if(_0x3b9d1b[_0x85db('0x30')]!==_0x85db('0x3f')){var _0x17f649={};_0x17f649[_0x3b9d1b[_0x85db('0x2a')]]={'$like':'%'+_0x6ee161['query']['filter']+'%'};return _0x17f649;}})});}_0x580e90=_[_0x85db('0x40')]({},_0x580e90,_0x6ee161['options']);var _0x9f2d7f={'where':_0x580e90[_0x85db('0x3c')]};return db['Tag']['count'](_0x9f2d7f)[_0x85db('0x25')](function(_0x928808){_0x13ad98[_0x85db('0x1d')]=_0x928808;if(_0x6ee161[_0x85db('0x32')][_0x85db('0x41')]){_0x580e90['include']=[{'all':!![]}];}return db[_0x85db('0x2e')][_0x85db('0x42')](_0x580e90);})[_0x85db('0x25')](function(_0x5be721){_0x13ad98['rows']=_0x5be721;return _0x13ad98;})['then'](respondWithFilteredResult(_0x1edc8d,_0x580e90))[_0x85db('0x43')](handleError(_0x1edc8d,null));};exports[_0x85db('0x44')]=function(_0x116cb3,_0x57677d){var _0x5ef59b={'raw':!![],'where':{'id':_0x116cb3['params']['id']}},_0x3e4dbc={};_0x3e4dbc[_0x85db('0x35')]=_[_0x85db('0x33')](db[_0x85db('0x2e')]['rawAttributes']);_0x3e4dbc[_0x85db('0x32')]=_[_0x85db('0x33')](_0x116cb3[_0x85db('0x32')]);_0x3e4dbc[_0x85db('0x3e')]=_[_0x85db('0x34')](_0x3e4dbc[_0x85db('0x35')],_0x3e4dbc[_0x85db('0x32')]);_0x5ef59b[_0x85db('0x36')]=_[_0x85db('0x34')](_0x3e4dbc['model'],qs[_0x85db('0x37')](_0x116cb3[_0x85db('0x32')][_0x85db('0x37')]));_0x5ef59b[_0x85db('0x36')]=_0x5ef59b[_0x85db('0x36')][_0x85db('0x38')]?_0x5ef59b['attributes']:_0x3e4dbc[_0x85db('0x35')];if(_0x116cb3[_0x85db('0x32')][_0x85db('0x41')]){_0x5ef59b['include']=[{'all':!![]}];}_0x5ef59b=_['merge']({},_0x5ef59b,_0x116cb3[_0x85db('0x45')]);return db['Tag'][_0x85db('0x46')](_0x5ef59b)[_0x85db('0x25')](handleEntityNotFound(_0x57677d,null))[_0x85db('0x25')](respondWithResult(_0x57677d,null))[_0x85db('0x43')](handleError(_0x57677d,null));};exports[_0x85db('0x47')]=function(_0x5e1455,_0x5d44ef){return db[_0x85db('0x2e')][_0x85db('0x47')](_0x5e1455[_0x85db('0x48')],{})[_0x85db('0x25')](function(_0x1b6157){var _0x107882=_0x5e1455[_0x85db('0x49')][_0x85db('0x26')]({'plain':!![]});if(!_0x107882)throw new Error(_0x85db('0x4a'));if(_0x107882[_0x85db('0x4b')]==='user'){var _0x69c505=_0x1b6157[_0x85db('0x26')]({'plain':!![]});var _0x54abf5='Tags';return db[_0x85db('0x4c')][_0x85db('0x46')]({'where':{'name':_0x54abf5,'userProfileId':_0x107882['userProfileId']},'raw':!![]})['then'](function(_0x74b926){if(_0x74b926&&_0x74b926[_0x85db('0x4d')]===0x0){return db['UserProfileResource'][_0x85db('0x47')]({'name':_0x69c505[_0x85db('0x2a')],'resourceId':_0x69c505['id'],'type':_0x74b926[_0x85db('0x2a')],'sectionId':_0x74b926['id']},{})[_0x85db('0x25')](function(){return _0x1b6157;});}else{return _0x1b6157;}})[_0x85db('0x43')](function(_0x2cddad){logger[_0x85db('0x28')](_0x85db('0x4e'),_0x2cddad);throw _0x2cddad;});}return _0x1b6157;})[_0x85db('0x25')](respondWithResult(_0x5d44ef,0xc9))[_0x85db('0x43')](handleError(_0x5d44ef,null));};exports['update']=function(_0x4ef4db,_0x283b13){if(_0x4ef4db[_0x85db('0x48')]['id']){delete _0x4ef4db[_0x85db('0x48')]['id'];}return db[_0x85db('0x2e')][_0x85db('0x46')]({'where':{'id':_0x4ef4db[_0x85db('0x4f')]['id']}})[_0x85db('0x25')](handleEntityNotFound(_0x283b13,null))[_0x85db('0x25')](saveUpdates(_0x4ef4db[_0x85db('0x48')],null))[_0x85db('0x25')](respondWithResult(_0x283b13,null))[_0x85db('0x43')](handleError(_0x283b13,null));};exports[_0x85db('0x24')]=function(_0x198dad,_0x425e61){return db['Tag'][_0x85db('0x46')]({'where':{'id':_0x198dad[_0x85db('0x4f')]['id']}})['then'](handleEntityNotFound(_0x425e61,null))[_0x85db('0x25')](removeEntity(_0x425e61,null))[_0x85db('0x43')](handleError(_0x425e61,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 04b021e..84a16b5 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 _0x8a47=['./tag.attributes','tools_tags','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x373624,_0x43fb17){var _0x124590=function(_0xf8a5d){while(--_0xf8a5d){_0x373624['push'](_0x373624['shift']());}};_0x124590(++_0x43fb17);}(_0x8a47,0x17e));var _0x78a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8a47[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x78a4('0x0'));var util=require(_0x78a4('0x1'));var logger=require(_0x78a4('0x2'))(_0x78a4('0x3'));var moment=require('moment');var BPromise=require(_0x78a4('0x4'));var rp=require(_0x78a4('0x5'));var fs=require('fs');var path=require(_0x78a4('0x6'));var rimraf=require(_0x78a4('0x7'));var config=require('../../config/environment');var attributes=require(_0x78a4('0x8'));module['exports']=function(_0x4184fc,_0x2d7ec3){return _0x4184fc['define']('Tag',attributes,{'tableName':_0x78a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb92e=['../../config/environment','./tag.attributes','Tag','tools_tags','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x26a795,_0x5d62b7){var _0x394d3e=function(_0x419c43){while(--_0x419c43){_0x26a795['push'](_0x26a795['shift']());}};_0x394d3e(++_0x5d62b7);}(_0xb92e,0x72));var _0xeb92=function(_0x4a6362,_0x9e782a){_0x4a6362=_0x4a6362-0x0;var _0x2653a5=_0xb92e[_0x4a6362];return _0x2653a5;};'use strict';var _=require(_0xeb92('0x0'));var util=require('util');var logger=require(_0xeb92('0x1'))(_0xeb92('0x2'));var moment=require(_0xeb92('0x3'));var BPromise=require(_0xeb92('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeb92('0x5'));var config=require(_0xeb92('0x6'));var attributes=require(_0xeb92('0x7'));module['exports']=function(_0x53dcb0,_0x16e6ae){return _0x53dcb0['define'](_0xeb92('0x8'),attributes,{'tableName':_0xeb92('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index c047641..1747eca 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 _0x9567=['info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','request','then'];(function(_0x3a19d4,_0x3f19a4){var _0x5b858b=function(_0x4ddce5){while(--_0x4ddce5){_0x3a19d4['push'](_0x3a19d4['shift']());}};_0x5b858b(++_0x3f19a4);}(_0x9567,0xdc));var _0x7956=function(_0x4709b2,_0x33044f){_0x4709b2=_0x4709b2-0x0;var _0x4e26d2=_0x9567[_0x4709b2];return _0x4e26d2;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var moment=require(_0x7956('0x2'));var BPromise=require(_0x7956('0x3'));var rs=require(_0x7956('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7956('0x5'));var logger=require(_0x7956('0x6'))('rpc');var config=require(_0x7956('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7956('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1819b6,_0x31b50d,_0x48b2b3){return new BPromise(function(_0x3c213a,_0x50038a){return client[_0x7956('0x9')](_0x1819b6,_0x48b2b3)[_0x7956('0xa')](function(_0x53310c){logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,'request\x20sent');logger[_0x7956('0xd')](_0x7956('0xe'),_0x31b50d,_0x7956('0xf'),JSON['stringify'](_0x53310c));if(_0x53310c[_0x7956('0x10')]){if(_0x53310c[_0x7956('0x10')][_0x7956('0x11')]===0x1f4){logger[_0x7956('0x10')]('Tag,\x20%s,\x20%s',_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x50038a(_0x53310c[_0x7956('0x10')]['message']);}logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x3c213a(_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);}else{logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,_0x7956('0xf'));_0x3c213a(_0x53310c[_0x7956('0x13')][_0x7956('0x12')]);}})[_0x7956('0x14')](function(_0x18ae51){logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x18ae51);_0x50038a(_0x18ae51);});});} \ No newline at end of file +var _0x6737=['stringify','error','code','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2993c5,_0x5f31a2){var _0x226ce6=function(_0x8ae5dd){while(--_0x8ae5dd){_0x2993c5['push'](_0x2993c5['shift']());}};_0x226ce6(++_0x5f31a2);}(_0x6737,0xe2));var _0x7673=function(_0x387379,_0x50f6d){_0x387379=_0x387379-0x0;var _0x3ae67d=_0x6737[_0x387379];return _0x3ae67d;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var moment=require(_0x7673('0x1'));var BPromise=require('bluebird');var rs=require(_0x7673('0x2'));var fs=require('fs');var Redis=require(_0x7673('0x3'));var db=require(_0x7673('0x4'))['db'];var utils=require(_0x7673('0x5'));var logger=require('../../config/logger')(_0x7673('0x6'));var config=require(_0x7673('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7673('0x8')][_0x7673('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af802,_0x4e4b24,_0x53d67d){return new BPromise(function(_0x5292f7,_0x285c6d){return client['request'](_0x5af802,_0x53d67d)[_0x7673('0xa')](function(_0x1fb769){logger['info'](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));logger[_0x7673('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x4e4b24,'request\x20sent',JSON[_0x7673('0xe')](_0x1fb769));if(_0x1fb769['error']){if(_0x1fb769[_0x7673('0xf')][_0x7673('0x10')]===0x1f4){logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);return _0x285c6d(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769['error'][_0x7673('0x11')]);return _0x5292f7(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}else{logger[_0x7673('0x12')](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));_0x5292f7(_0x1fb769[_0x7673('0x13')]['message']);}})['catch'](function(_0x164d05){logger[_0x7673('0xf')]('Tag,\x20%s,\x20%s',_0x4e4b24,_0x164d05);_0x285c6d(_0x164d05);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index efe85da..aa679c7 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_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'));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 9ca2c10..82d92e4 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 _0xb7e7=['STRING','sequelize'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb7e7[_0x34bc30];return _0x5706de;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x386318,_0x562e52){var _0x37895b=function(_0x1a75aa){while(--_0x1a75aa){_0x386318['push'](_0x386318['shift']());}};_0x37895b(++_0x562e52);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index ef0442b..a44a115 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 _0x99ad=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','Team','includeAll','include','findAll','rows','catch','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','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','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserVoicePrefix','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','capitalize','Queues','addQueues','add','ids','removeQueues','remove','addAgents','isArray','Sms','Fax','Openchannel','transaction','Voice','through','QueueId','defaults','penalty','User','findOrCreate','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','upsert','VoicePrefixId','spread','Chat','Mail','Whatsapp','removeAgents','emit','Queue:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x17de48,_0x2a114c){var _0x24f9ca=function(_0x66fd4e){while(--_0x66fd4e){_0x17de48['push'](_0x17de48['shift']());}};_0x24f9ca(++_0x2a114c);}(_0x99ad,0x129));var _0xd99a=function(_0x499dca,_0x22f500){_0x499dca=_0x499dca-0x0;var _0x57f37c=_0x99ad[_0x499dca];return _0x57f37c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd99a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd99a('0x1'));var rp=require(_0xd99a('0x2'));var moment=require(_0xd99a('0x3'));var BPromise=require(_0xd99a('0x4'));var Mustache=require('mustache');var util=require(_0xd99a('0x5'));var path=require(_0xd99a('0x6'));var sox=require(_0xd99a('0x7'));var csv=require(_0xd99a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd99a('0x9'));var _=require('lodash');var squel=require(_0xd99a('0xa'));var crypto=require(_0xd99a('0xb'));var jsforce=require(_0xd99a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd99a('0xd'));var Papa=require(_0xd99a('0xe'));var Redis=require(_0xd99a('0xf'));var authService=require(_0xd99a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd99a('0x11'));var hardwareService=require(_0xd99a('0x12'));var logger=require(_0xd99a('0x13'))(_0xd99a('0x14'));var utils=require(_0xd99a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd99a('0x16'));var db=require(_0xd99a('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd99a('0x18'),'port':0x18eb});var socket=require(_0xd99a('0x19'))(new Redis(config['redis']));require('./team.socket')[_0xd99a('0x1a')](socket);function respondWithStatusCode(_0x325d9e,_0x483e4f){_0x483e4f=_0x483e4f||0xcc;return function(_0x1f0f61){if(_0x1f0f61){return _0x325d9e[_0xd99a('0x1b')](_0x483e4f);}return _0x325d9e[_0xd99a('0x1c')](_0x483e4f)[_0xd99a('0x1d')]();};}function respondWithResult(_0x5e8eed,_0x22c452){_0x22c452=_0x22c452||0xc8;return function(_0x34da40){if(_0x34da40){return _0x5e8eed[_0xd99a('0x1c')](_0x22c452)[_0xd99a('0x1e')](_0x34da40);}};}function respondWithFilteredResult(_0x118e8b,_0x2093c6){return function(_0xccfba9){if(_0xccfba9){var _0x311cc6=typeof _0x2093c6[_0xd99a('0x1f')]==='undefined'&&typeof _0x2093c6[_0xd99a('0x20')]===_0xd99a('0x21');var _0x5d29c6=_0xccfba9[_0xd99a('0x22')];var _0x5a859d=_0x311cc6?0x0:_0x2093c6[_0xd99a('0x1f')];var _0x26282f=_0x311cc6?_0xccfba9[_0xd99a('0x22')]:_0x2093c6[_0xd99a('0x1f')]+_0x2093c6[_0xd99a('0x20')];var _0x18285c;if(_0x26282f>=_0x5d29c6){_0x26282f=_0x5d29c6;_0x18285c=0xc8;}else{_0x18285c=0xce;}_0x118e8b[_0xd99a('0x1c')](_0x18285c);return _0x118e8b[_0xd99a('0x23')](_0xd99a('0x24'),_0x5a859d+'-'+_0x26282f+'/'+_0x5d29c6)[_0xd99a('0x1e')](_0xccfba9);}return null;};}function patchUpdates(_0x52a8db){return function(_0x5025d3){try{jsonpatch['apply'](_0x5025d3,_0x52a8db,!![]);}catch(_0x229837){return BPromise[_0xd99a('0x25')](_0x229837);}return _0x5025d3['save']();};}function saveUpdates(_0x14b89e,_0x46658e){return function(_0x1e1ab8){if(_0x1e1ab8){return _0x1e1ab8[_0xd99a('0x26')](_0x14b89e)[_0xd99a('0x27')](function(_0x481a4a){return _0x481a4a;});}return null;};}function handleEntityNotFound(_0x21de55,_0x192cbf){return function(_0x25d8e8){if(!_0x25d8e8){_0x21de55['sendStatus'](0x194);}return _0x25d8e8;};}function handleError(_0x2ee244,_0x3b9fb8){_0x3b9fb8=_0x3b9fb8||0x1f4;return function(_0x495803){logger[_0xd99a('0x28')](_0x495803[_0xd99a('0x29')]);if(_0x495803[_0xd99a('0x2a')]){delete _0x495803[_0xd99a('0x2a')];}_0x2ee244['status'](_0x3b9fb8)[_0xd99a('0x2b')](_0x495803);};}exports[_0xd99a('0x2c')]=function(_0x49c7f4,_0x16ae88){var _0x4279cb={},_0x71d438={},_0x422f92={'count':0x0,'rows':[]};var _0x7e68f4=_['map'](db['Team'][_0xd99a('0x2d')],function(_0x543a68){return{'name':_0x543a68[_0xd99a('0x2e')],'type':_0x543a68[_0xd99a('0x2f')][_0xd99a('0x30')]};});_0x71d438[_0xd99a('0x31')]=_[_0xd99a('0x32')](_0x7e68f4,'name');_0x71d438['query']=_[_0xd99a('0x33')](_0x49c7f4['query']);_0x71d438[_0xd99a('0x34')]=_[_0xd99a('0x35')](_0x71d438[_0xd99a('0x31')],_0x71d438[_0xd99a('0x36')]);_0x4279cb[_0xd99a('0x37')]=_[_0xd99a('0x35')](_0x71d438['model'],qs[_0xd99a('0x38')](_0x49c7f4[_0xd99a('0x36')]['fields']));_0x4279cb[_0xd99a('0x37')]=_0x4279cb['attributes'][_0xd99a('0x39')]?_0x4279cb[_0xd99a('0x37')]:_0x71d438[_0xd99a('0x31')];if(!_0x49c7f4[_0xd99a('0x36')][_0xd99a('0x3a')](_0xd99a('0x3b'))){_0x4279cb[_0xd99a('0x20')]=qs[_0xd99a('0x20')](_0x49c7f4['query'][_0xd99a('0x20')]);_0x4279cb[_0xd99a('0x1f')]=qs[_0xd99a('0x1f')](_0x49c7f4[_0xd99a('0x36')][_0xd99a('0x1f')]);}_0x4279cb[_0xd99a('0x3c')]=qs['sort'](_0x49c7f4[_0xd99a('0x36')][_0xd99a('0x3d')]);_0x4279cb[_0xd99a('0x3e')]=qs[_0xd99a('0x34')](_[_0xd99a('0x3f')](_0x49c7f4[_0xd99a('0x36')],_0x71d438[_0xd99a('0x34')]),_0x7e68f4);if(_0x49c7f4[_0xd99a('0x36')]['filter']){_0x4279cb[_0xd99a('0x3e')]=_['merge'](_0x4279cb[_0xd99a('0x3e')],{'$or':_[_0xd99a('0x32')](_0x7e68f4,function(_0x6470ee){if(_0x6470ee[_0xd99a('0x2f')]!==_0xd99a('0x40')){var _0x43c224={};_0x43c224[_0x6470ee[_0xd99a('0x2a')]]={'$like':'%'+_0x49c7f4[_0xd99a('0x36')][_0xd99a('0x41')]+'%'};return _0x43c224;}})});}_0x4279cb=_[_0xd99a('0x42')]({},_0x4279cb,_0x49c7f4[_0xd99a('0x43')]);var _0x3802c3={'where':_0x4279cb[_0xd99a('0x3e')]};return db[_0xd99a('0x44')][_0xd99a('0x22')](_0x3802c3)[_0xd99a('0x27')](function(_0x2d7864){_0x422f92[_0xd99a('0x22')]=_0x2d7864;if(_0x49c7f4[_0xd99a('0x36')][_0xd99a('0x45')]){_0x4279cb[_0xd99a('0x46')]=[{'all':!![]}];}return db[_0xd99a('0x44')][_0xd99a('0x47')](_0x4279cb);})['then'](function(_0x120252){_0x422f92[_0xd99a('0x48')]=_0x120252;return _0x422f92;})[_0xd99a('0x27')](respondWithFilteredResult(_0x16ae88,_0x4279cb))[_0xd99a('0x49')](handleError(_0x16ae88,null));};exports['show']=function(_0x259e7f,_0x14aae2){var _0x495dad={'raw':![],'where':{'id':_0x259e7f['params']['id']}},_0x21cbaa={};_0x21cbaa[_0xd99a('0x31')]=_[_0xd99a('0x33')](db['Team'][_0xd99a('0x2d')]);_0x21cbaa[_0xd99a('0x36')]=_['keys'](_0x259e7f[_0xd99a('0x36')]);_0x21cbaa[_0xd99a('0x34')]=_['intersection'](_0x21cbaa[_0xd99a('0x31')],_0x21cbaa[_0xd99a('0x36')]);_0x495dad['attributes']=_[_0xd99a('0x35')](_0x21cbaa[_0xd99a('0x31')],qs[_0xd99a('0x38')](_0x259e7f[_0xd99a('0x36')][_0xd99a('0x38')]));_0x495dad[_0xd99a('0x37')]=_0x495dad['attributes']['length']?_0x495dad[_0xd99a('0x37')]:_0x21cbaa[_0xd99a('0x31')];if(_0x259e7f[_0xd99a('0x36')][_0xd99a('0x45')]){_0x495dad['include']=[{'all':!![]}];}_0x495dad=_[_0xd99a('0x42')]({},_0x495dad,_0x259e7f[_0xd99a('0x43')]);return db[_0xd99a('0x44')][_0xd99a('0x4a')](_0x495dad)[_0xd99a('0x27')](handleEntityNotFound(_0x14aae2,null))['then'](respondWithResult(_0x14aae2,null))['catch'](handleError(_0x14aae2,null));};exports['create']=function(_0x5373a4,_0x572c43){return db[_0xd99a('0x44')][_0xd99a('0x4b')](_0x5373a4['body'],{})[_0xd99a('0x27')](function(_0x1dee50){var _0x972a12=_0x5373a4[_0xd99a('0x4c')][_0xd99a('0x4d')]({'plain':!![]});if(!_0x972a12)throw new Error(_0xd99a('0x4e'));if(_0x972a12[_0xd99a('0x4f')]==='user'){var _0x361564=_0x1dee50[_0xd99a('0x4d')]({'plain':!![]});var _0x1ced86=_0xd99a('0x50');return db['UserProfileSection'][_0xd99a('0x4a')]({'where':{'name':_0x1ced86,'userProfileId':_0x972a12[_0xd99a('0x51')]},'raw':!![]})[_0xd99a('0x27')](function(_0x8e410c){if(_0x8e410c&&_0x8e410c[_0xd99a('0x52')]===0x0){return db[_0xd99a('0x53')][_0xd99a('0x4b')]({'name':_0x361564[_0xd99a('0x2a')],'resourceId':_0x361564['id'],'type':_0x8e410c[_0xd99a('0x2a')],'sectionId':_0x8e410c['id']},{})[_0xd99a('0x27')](function(){return _0x1dee50;});}else{return _0x1dee50;}})[_0xd99a('0x49')](function(_0x4b4f14){logger[_0xd99a('0x28')](_0xd99a('0x54'),_0x4b4f14);throw _0x4b4f14;});}return _0x1dee50;})[_0xd99a('0x27')](respondWithResult(_0x572c43,0xc9))[_0xd99a('0x49')](handleError(_0x572c43,null));};exports[_0xd99a('0x26')]=function(_0x501070,_0x1988cc){if(_0x501070[_0xd99a('0x55')]['id']){delete _0x501070[_0xd99a('0x55')]['id'];}return db[_0xd99a('0x44')][_0xd99a('0x4a')]({'where':{'id':_0x501070['params']['id']}})[_0xd99a('0x27')](handleEntityNotFound(_0x1988cc,null))['then'](saveUpdates(_0x501070[_0xd99a('0x55')],null))[_0xd99a('0x27')](respondWithResult(_0x1988cc,null))[_0xd99a('0x49')](handleError(_0x1988cc,null));};exports['destroy']=function(_0x4f2765,_0x5505b9){var _0x470aec=_0x4f2765[_0xd99a('0x56')]['id'];var _0x407451=[];return db[_0xd99a('0x57')]['transaction'](function(_0x1205eb){var _0x39ec5e=_0xd99a('0x58')+_0x470aec;return db[_0xd99a('0x57')]['query'](_0x39ec5e,{'type':db[_0xd99a('0x59')][_0xd99a('0x5a')]['SELECT'],'raw':!![],'transaction':_0x1205eb})[_0xd99a('0x27')](function(_0x2e237e){_0x407451=_['map'](_0x2e237e,function(_0x5e179a){return Number(_0x5e179a['UserId']);});})['then'](function(){var _0x30a48c=_0xd99a('0x5b')+_0x470aec;return db[_0xd99a('0x57')][_0xd99a('0x36')](_0x30a48c,{'type':db[_0xd99a('0x59')][_0xd99a('0x5a')][_0xd99a('0x5c')],'raw':!![],'transaction':_0x1205eb});})[_0xd99a('0x27')](function(_0x2b9f5b){var _0x19ebdf=_[_0xd99a('0x32')](_0x2b9f5b,function(_0x28ecc2){return Number(_0x28ecc2[_0xd99a('0x5d')]);});return db[_0xd99a('0x5e')][_0xd99a('0x5f')]({'where':{'UserId':{'$in':_0x407451},'VoiceQueueId':{'$in':_0x19ebdf}},'transaction':_0x1205eb});})[_0xd99a('0x27')](function(){var _0x5caacb=_0xd99a('0x60')+_0x470aec;return db['sequelize'][_0xd99a('0x36')](_0x5caacb,{'type':db['Sequelize'][_0xd99a('0x5a')]['SELECT'],'raw':!![],'transaction':_0x1205eb});})[_0xd99a('0x27')](function(_0x1bebe1){var _0x41cc64=_[_0xd99a('0x32')](_0x1bebe1,function(_0x4aefcc){return Number(_0x4aefcc[_0xd99a('0x61')]);});return db['UserMailQueue'][_0xd99a('0x5f')]({'where':{'UserId':{'$in':_0x407451},'MailQueueId':{'$in':_0x41cc64}},'transaction':_0x1205eb});})[_0xd99a('0x27')](function(){var _0x2beb4d=_0xd99a('0x62')+_0x470aec;return db[_0xd99a('0x57')][_0xd99a('0x36')](_0x2beb4d,{'type':db[_0xd99a('0x59')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1205eb});})['then'](function(_0x3a79aa){var _0x50a1af=_[_0xd99a('0x32')](_0x3a79aa,function(_0x120fea){return Number(_0x120fea[_0xd99a('0x63')]);});return db['UserSmsQueue'][_0xd99a('0x5f')]({'where':{'UserId':{'$in':_0x407451},'SmsQueueId':{'$in':_0x50a1af}},'transaction':_0x1205eb});})['then'](function(){var _0x2a73eb=_0xd99a('0x64')+_0x470aec;return db[_0xd99a('0x57')][_0xd99a('0x36')](_0x2a73eb,{'type':db[_0xd99a('0x59')][_0xd99a('0x5a')][_0xd99a('0x5c')],'raw':!![],'transaction':_0x1205eb});})[_0xd99a('0x27')](function(_0x4e4ee5){var _0x35f439=_[_0xd99a('0x32')](_0x4e4ee5,function(_0x212100){return Number(_0x212100[_0xd99a('0x65')]);});return db[_0xd99a('0x66')]['destroy']({'where':{'UserId':{'$in':_0x407451},'ChatQueueId':{'$in':_0x35f439}},'transaction':_0x1205eb});})['then'](function(){var _0x4fe759=_0xd99a('0x67')+_0x470aec;return db[_0xd99a('0x57')][_0xd99a('0x36')](_0x4fe759,{'type':db['Sequelize'][_0xd99a('0x5a')][_0xd99a('0x5c')],'raw':!![],'transaction':_0x1205eb});})[_0xd99a('0x27')](function(_0x191e23){var _0x161735=_[_0xd99a('0x32')](_0x191e23,function(_0x783d2a){return Number(_0x783d2a[_0xd99a('0x68')]);});return db[_0xd99a('0x69')][_0xd99a('0x5f')]({'where':{'UserId':{'$in':_0x407451},'FaxQueueId':{'$in':_0x161735}},'transaction':_0x1205eb});})[_0xd99a('0x27')](function(){var _0x24fd34=_0xd99a('0x6a')+_0x470aec;return db[_0xd99a('0x57')][_0xd99a('0x36')](_0x24fd34,{'type':db[_0xd99a('0x59')][_0xd99a('0x5a')][_0xd99a('0x5c')],'raw':!![],'transaction':_0x1205eb});})[_0xd99a('0x27')](function(_0x37c889){var _0x3c85c7=_[_0xd99a('0x32')](_0x37c889,function(_0x4fd1ad){return Number(_0x4fd1ad['OpenchannelQueueId']);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x407451},'OpenchannelQueueId':{'$in':_0x3c85c7}},'transaction':_0x1205eb});})[_0xd99a('0x27')](function(){var _0x1e7396=_0xd99a('0x6b')+_0x470aec;return db[_0xd99a('0x57')][_0xd99a('0x36')](_0x1e7396,{'type':db[_0xd99a('0x59')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1205eb});})[_0xd99a('0x27')](function(_0x366cab){var _0x188e50=_[_0xd99a('0x32')](_0x366cab,function(_0x8f2c9){return Number(_0x8f2c9['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0xd99a('0x5f')]({'where':{'UserId':{'$in':_0x407451},'WhatsappQueueId':{'$in':_0x188e50}},'transaction':_0x1205eb});})[_0xd99a('0x27')](function(){return db['TeamVoicePrefix'][_0xd99a('0x4a')]({'where':{'TeamId':_0x470aec}});})[_0xd99a('0x27')](function(_0xc6f22d){if(_0xc6f22d===null){return;}return db[_0xd99a('0x6c')][_0xd99a('0x5f')]({'where':{'UserId':{'$in':_0x407451},'VoicePrefixId':_0xc6f22d['VoicePrefixId']},'transaction':_0x1205eb});})[_0xd99a('0x27')](function(){return db[_0xd99a('0x44')]['destroy']({'where':{'id':_0x470aec},'cascade':!![],'transaction':_0x1205eb});})[_0xd99a('0x27')](function(_0x24aeff){if(_0x24aeff===0x0){_0x5505b9[_0xd99a('0x1b')](0x194);}else{return db['UserProfileResource']['destroy']({'where':{'type':'Teams','resourceId':_0x470aec},'cascade':!![],'transaction':_0x1205eb})[_0xd99a('0x27')](function(){_0x5505b9[_0xd99a('0x1c')](0xcc)[_0xd99a('0x1d')]();});}})[_0xd99a('0x49')](function(_0x5388ef){_0x5505b9[_0xd99a('0x1c')](0x1f4)[_0xd99a('0x2b')](_0x5388ef);});});};exports[_0xd99a('0x6d')]=function(_0x3e9cf8,_0x2fd994,_0x4a1299){return db[_0xd99a('0x44')][_0xd99a('0x6e')]({'where':{'id':_0x3e9cf8[_0xd99a('0x56')]['id']}})[_0xd99a('0x27')](handleEntityNotFound(_0x2fd994,null))['then'](function(_0x4817c8){if(!_0x3e9cf8[_0xd99a('0x36')][_0xd99a('0x6f')]||!utils[_0xd99a('0x70')](_0x3e9cf8[_0xd99a('0x36')][_0xd99a('0x6f')])){throw new db[(_0xd99a('0x59'))][(_0xd99a('0x71'))](_0xd99a('0x72'));}var _0x50bc0e={};var _0x565ac1={};_0x565ac1['model']=_[_0xd99a('0x33')](db[_['capitalize'](_0x3e9cf8[_0xd99a('0x36')][_0xd99a('0x6f')][_0xd99a('0x73')]())+_0xd99a('0x74')][_0xd99a('0x2d')]);_0x565ac1['query']=_[_0xd99a('0x33')](_0x3e9cf8[_0xd99a('0x36')]);_0x565ac1[_0xd99a('0x34')]=_['intersection'](_0x565ac1[_0xd99a('0x31')],_0x565ac1[_0xd99a('0x36')]);_0x50bc0e[_0xd99a('0x37')]=_['intersection'](_0x565ac1[_0xd99a('0x31')],qs['fields'](_0x3e9cf8[_0xd99a('0x36')][_0xd99a('0x38')]));_0x50bc0e[_0xd99a('0x37')]=_0x50bc0e[_0xd99a('0x37')][_0xd99a('0x39')]?_0x50bc0e[_0xd99a('0x37')]:_0x565ac1['model'];_0x50bc0e[_0xd99a('0x20')]=qs[_0xd99a('0x20')](_0x3e9cf8[_0xd99a('0x36')]['limit']);_0x50bc0e[_0xd99a('0x1f')]=qs[_0xd99a('0x1f')](_0x3e9cf8[_0xd99a('0x36')]['offset']);_0x50bc0e[_0xd99a('0x3c')]=qs['sort'](_0x3e9cf8['query'][_0xd99a('0x3d')]);_0x50bc0e[_0xd99a('0x3e')]=qs[_0xd99a('0x34')](_[_0xd99a('0x3f')](_0x3e9cf8[_0xd99a('0x36')],_0x565ac1[_0xd99a('0x34')]));_0x50bc0e=_['merge']({},_0x50bc0e,_0x3e9cf8[_0xd99a('0x43')]);return _0x4817c8[_0xd99a('0x4d')+_[_0xd99a('0x75')](_0x3e9cf8[_0xd99a('0x36')]['channel']['toLowerCase']())+_0xd99a('0x76')](_0x50bc0e);})[_0xd99a('0x27')](respondWithResult(_0x2fd994,null))[_0xd99a('0x49')](handleError(_0x2fd994,null));};exports[_0xd99a('0x77')]=function(_0x45bd8b,_0x4f3dd7,_0x59e700){return db[_0xd99a('0x44')][_0xd99a('0x6e')]({'where':{'id':_0x45bd8b[_0xd99a('0x56')]['id']}})['then'](function(_0x2f1481){if(_0x2f1481){if(!_0x45bd8b[_0xd99a('0x55')][_0xd99a('0x6f')]||!utils['isValidChannel'](_0x45bd8b[_0xd99a('0x55')][_0xd99a('0x6f')])){throw new db['Sequelize']['ValidationError'](_0xd99a('0x72'));}return _0x2f1481[_0xd99a('0x78')+_[_0xd99a('0x75')](_0x45bd8b[_0xd99a('0x55')][_0xd99a('0x6f')][_0xd99a('0x73')]())+_0xd99a('0x76')](_0x45bd8b[_0xd99a('0x55')][_0xd99a('0x79')]);}return null;})['then'](handleEntityNotFound(_0x4f3dd7,null))[_0xd99a('0x27')](respondWithStatusCode(_0x4f3dd7,null))[_0xd99a('0x49')](handleError(_0x4f3dd7,null));};exports[_0xd99a('0x7a')]=function(_0x1e5a36,_0x19dfea,_0x3e0e5b){return db['Team'][_0xd99a('0x6e')]({'where':{'id':_0x1e5a36[_0xd99a('0x56')]['id']}})[_0xd99a('0x27')](function(_0x5d675c){if(_0x5d675c){if(!_0x1e5a36[_0xd99a('0x36')][_0xd99a('0x6f')]||!utils[_0xd99a('0x70')](_0x1e5a36[_0xd99a('0x36')]['channel'])){throw new db[(_0xd99a('0x59'))][(_0xd99a('0x71'))]('Unknown\x20channel');}return _0x5d675c[_0xd99a('0x7b')+_[_0xd99a('0x75')](_0x1e5a36['query'][_0xd99a('0x6f')]['toLowerCase']())+_0xd99a('0x76')](_0x1e5a36[_0xd99a('0x36')][_0xd99a('0x79')]);}return null;})[_0xd99a('0x27')](handleEntityNotFound(_0x19dfea,null))['then'](respondWithStatusCode(_0x19dfea,null))[_0xd99a('0x49')](handleError(_0x19dfea,null));};exports[_0xd99a('0x7c')]=function(_0x107bcd,_0x14ffea){var _0x37d4e1=_[_0xd99a('0x7d')](_0x107bcd[_0xd99a('0x55')][_0xd99a('0x79')])?_0x107bcd[_0xd99a('0x55')][_0xd99a('0x79')]:[_0x107bcd['body']['ids']];var _0x98776f=_0x107bcd[_0xd99a('0x56')]['id'];return db[_0xd99a('0x44')][_0xd99a('0x4a')]({'where':{'id':_0x98776f}})[_0xd99a('0x27')](handleEntityNotFound(_0x14ffea,null))['then'](function(_0x423ce1){if(_0x423ce1){var _0x497343=['Voice','Chat','Mail',_0xd99a('0x7e'),_0xd99a('0x7f'),_0xd99a('0x80'),'Whatsapp'];return db[_0xd99a('0x57')][_0xd99a('0x81')](function(_0xd14d29){var _0x71cf3a=_[_0xd99a('0x32')](_0x497343,function(_0x167ad9){var _0x5cb030={'attributes':['id','name']};if(_0x167ad9===_0xd99a('0x82')){_0x5cb030[_0xd99a('0x83')]={'attributes':['penalty']};}return _0x423ce1[_0xd99a('0x4d')+_0x167ad9+_0xd99a('0x76')](_0x5cb030)[_0xd99a('0x27')](function(_0x3b4fa7){var _0xd1eef9=_[_0xd99a('0x32')](_0x3b4fa7,function(_0x283023){var _0x249b7f=_[_0xd99a('0x32')](_0x37d4e1,function(_0x3eed5d){var _0x295a7f={'where':{'UserId':_0x3eed5d,[_0x167ad9+_0xd99a('0x84')]:_0x283023['id']},'transaction':_0xd14d29};if(_0x167ad9===_0xd99a('0x82')){_0x295a7f[_0xd99a('0x85')]={'penalty':_0x283023['TeamVoiceQueue'][_0xd99a('0x86')]};}return db[_0xd99a('0x87')+_0x167ad9+_0xd99a('0x74')][_0xd99a('0x88')](_0x295a7f)['then'](function(){socket['emit'](_0xd99a('0x4c')+_0x167ad9+'Queue:save',{'UserId':_0x3eed5d,[_0x167ad9+_0xd99a('0x84')]:_0x283023['id']});if(_0x167ad9!==_0xd99a('0x82')){return;}return db[_0xd99a('0x87')][_0xd99a('0x47')]({'where':{'id':_0x37d4e1,'online':0x1},'attributes':['id',_0xd99a('0x2a'),_0xd99a('0x89'),_0xd99a('0x8a'),_0xd99a('0x8b')],'raw':!![]})['then'](function(_0xcf26c2){var _0x557bab=_['map'](_0xcf26c2,function(_0x1b11e2){return db[_0xd99a('0x8c')]['upsert']({'membername':_0x1b11e2[_0xd99a('0x2a')],'UserId':_0x1b11e2['id'],'queue_name':_0x283023[_0xd99a('0x2a')],'VoiceQueueId':_0x283023['id'],'interface':_[_0xd99a('0x8d')](_0x1b11e2[_0xd99a('0x8b')])?util[_0xd99a('0x8e')](_0xd99a('0x8f'),_0x1b11e2['name']):_0x1b11e2['interface'],'paused':_0x1b11e2[_0xd99a('0x8a')]||![],'penalty':_0x283023[_0xd99a('0x90')][_0xd99a('0x86')]},{'transaction':_0xd14d29});});return Promise[_0xd99a('0x91')](_0x557bab);});});});return Promise[_0xd99a('0x91')](_0x249b7f);});return Promise[_0xd99a('0x91')](_0xd1eef9);})[_0xd99a('0x27')](function(){return db[_0xd99a('0x92')][_0xd99a('0x6e')]({'where':{'teamId':_0x98776f}})['then'](function(_0x19b7cf){if(_0x19b7cf){var _0x2fd4b3=_[_0xd99a('0x32')](_0x37d4e1,function(_0x4fe41b){db[_0xd99a('0x6c')][_0xd99a('0x93')]({'UserId':_0x4fe41b,'VoicePrefixId':_0x19b7cf[_0xd99a('0x94')]});});return Promise['all'](_0x2fd4b3);}});});});return Promise[_0xd99a('0x91')](_0x71cf3a)[_0xd99a('0x27')](function(){return _0x423ce1['addAgents'](_0x37d4e1,{'transaction':_0xd14d29})[_0xd99a('0x95')](function(_0x1762d6){return _0x1762d6;});});});}})['then'](respondWithResult(_0x14ffea,null))[_0xd99a('0x49')](handleError(_0x14ffea,null));};exports['removeAgents']=function(_0x4b269b,_0x1f3e36){var _0x6e8702=_[_0xd99a('0x7d')](_0x4b269b[_0xd99a('0x36')][_0xd99a('0x79')])?_0x4b269b['query'][_0xd99a('0x79')]:[_0x4b269b[_0xd99a('0x36')][_0xd99a('0x79')]];var _0x2b764f=_0x4b269b[_0xd99a('0x56')]['id'];return db[_0xd99a('0x44')]['find']({'where':{'id':_0x2b764f}})[_0xd99a('0x27')](handleEntityNotFound(_0x1f3e36,null))[_0xd99a('0x27')](function(_0x5112b5){if(_0x5112b5){var _0x3d9fbd=[_0xd99a('0x82'),_0xd99a('0x96'),_0xd99a('0x97'),'Sms',_0xd99a('0x7f'),'Openchannel',_0xd99a('0x98')];return db[_0xd99a('0x57')][_0xd99a('0x81')](function(_0x212062){var _0x1a4dfb=_[_0xd99a('0x32')](_0x3d9fbd,function(_0x175b43){var _0x26be01={'attributes':['id',_0xd99a('0x2a')]};return _0x5112b5[_0xd99a('0x4d')+_0x175b43+_0xd99a('0x76')](_0x26be01)[_0xd99a('0x27')](function(_0x61dff8){var _0x4f200a=_[_0xd99a('0x32')](_0x61dff8,function(_0x168711){return _0x168711[_0xd99a('0x99')](_0x6e8702,{'transaction':_0x212062})[_0xd99a('0x27')](function(){var _0x1ff618=_[_0xd99a('0x32')](_0x6e8702,function(_0x249cee){socket[_0xd99a('0x9a')](_0xd99a('0x4c')+_0x175b43+_0xd99a('0x9b'),{'UserId':Number(_0x249cee),[_0x175b43+_0xd99a('0x84')]:_0x168711['id']});if(_0x175b43!==_0xd99a('0x82')){return;}return db['UserVoiceQueueRt'][_0xd99a('0x5f')]({'where':{'VoiceQueueId':_0x168711['id'],'UserId':_0x249cee},'transaction':_0x212062});});return Promise['all'](_0x1ff618);});});return Promise[_0xd99a('0x91')](_0x4f200a);});});return Promise[_0xd99a('0x91')](_0x1a4dfb)['then'](function(){return _0x5112b5[_0xd99a('0x99')](_0x6e8702,{'transaction':_0x212062});})[_0xd99a('0x27')](function(){return db[_0xd99a('0x92')][_0xd99a('0x6e')]({'where':{'teamId':_0x2b764f}})[_0xd99a('0x27')](function(_0x5f5bdc){if(_0x5f5bdc){var _0x3ec3e2=_[_0xd99a('0x32')](_0x6e8702,function(_0x29bc1f){db[_0xd99a('0x6c')]['destroy']({'where':{'UserId':_0x29bc1f,'VoicePrefixId':_0x5f5bdc[_0xd99a('0x94')]}});});return Promise[_0xd99a('0x91')](_0x3ec3e2);}});});});}})['then'](respondWithStatusCode(_0x1f3e36,null))[_0xd99a('0x49')](handleError(_0x1f3e36,null));};exports[_0xd99a('0x9c')]=function(_0x25a663,_0x585f53,_0xc3ab3c){var _0x255e50={};var _0x4366d5={};var _0xf4c2ac;var _0x18e329;return db['Team'][_0xd99a('0x6e')]({'where':{'id':_0x25a663[_0xd99a('0x56')]['id']}})[_0xd99a('0x27')](handleEntityNotFound(_0x585f53,null))[_0xd99a('0x27')](function(_0x1ba98e){if(_0x1ba98e){_0xf4c2ac=_0x1ba98e;_0x4366d5[_0xd99a('0x31')]=_[_0xd99a('0x33')](db[_0xd99a('0x87')]['rawAttributes']);_0x4366d5[_0xd99a('0x36')]=_[_0xd99a('0x33')](_0x25a663[_0xd99a('0x36')]);_0x4366d5['filters']=_[_0xd99a('0x35')](_0x4366d5[_0xd99a('0x31')],_0x4366d5[_0xd99a('0x36')]);_0x255e50[_0xd99a('0x37')]=_[_0xd99a('0x35')](_0x4366d5[_0xd99a('0x31')],qs[_0xd99a('0x38')](_0x25a663[_0xd99a('0x36')][_0xd99a('0x38')]));_0x255e50[_0xd99a('0x37')]=_0x255e50['attributes'][_0xd99a('0x39')]?_0x255e50['attributes']:_0x4366d5['model'];_0x255e50[_0xd99a('0x3c')]=qs[_0xd99a('0x3d')](_0x25a663['query']['sort']);_0x255e50[_0xd99a('0x3e')]=qs[_0xd99a('0x34')](_['pick'](_0x25a663['query'],_0x4366d5[_0xd99a('0x34')]));if(_0x25a663[_0xd99a('0x36')][_0xd99a('0x41')]){_0x255e50[_0xd99a('0x3e')]=_['merge'](_0x255e50[_0xd99a('0x3e')],{'$or':_[_0xd99a('0x32')](_0x255e50[_0xd99a('0x37')],function(_0x308395){var _0x11441f={};_0x11441f[_0x308395]={'$like':'%'+_0x25a663[_0xd99a('0x36')][_0xd99a('0x41')]+'%'};return _0x11441f;})});}_0x255e50=_['merge']({},_0x255e50,_0x25a663[_0xd99a('0x43')]);return _0xf4c2ac[_0xd99a('0x9c')](_0x255e50);}})['then'](function(_0x51dd91){if(_0x51dd91){_0x18e329=_0x51dd91['length'];if(!_0x25a663['query']['hasOwnProperty'](_0xd99a('0x3b'))){_0x255e50[_0xd99a('0x20')]=qs[_0xd99a('0x20')](_0x25a663['query'][_0xd99a('0x20')]);_0x255e50[_0xd99a('0x1f')]=qs[_0xd99a('0x1f')](_0x25a663['query'][_0xd99a('0x1f')]);}return _0xf4c2ac[_0xd99a('0x9c')](_0x255e50);}})[_0xd99a('0x27')](function(_0xa92ec1){if(_0xa92ec1){return _0xa92ec1?{'count':_0x18e329,'rows':_0xa92ec1}:null;}})[_0xd99a('0x27')](respondWithResult(_0x585f53,null))[_0xd99a('0x49')](handleError(_0x585f53,null));}; \ No newline at end of file +var _0xeefd=['keys','Team','rawAttributes','find','create','body','user','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','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','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','sort','Queues','addQueues','isValidChannel','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','findAll','online','voicePause','interface','upsert','isNil','format','SIP/%s','all','Whatsapp','removeAgents','Queue:remove','order','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','update','then','error','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show'];(function(_0x146915,_0x32dda1){var _0x1a463a=function(_0x173c96){while(--_0x173c96){_0x146915['push'](_0x146915['shift']());}};_0x1a463a(++_0x32dda1);}(_0xeefd,0xfa));var _0xdeef=function(_0x12d672,_0x4f1cd9){_0x12d672=_0x12d672-0x0;var _0x5c257e=_0xeefd[_0x12d672];return _0x5c257e;};'use strict';var emlformat=require(_0xdeef('0x0'));var rimraf=require(_0xdeef('0x1'));var zipdir=require(_0xdeef('0x2'));var jsonpatch=require(_0xdeef('0x3'));var rp=require(_0xdeef('0x4'));var moment=require(_0xdeef('0x5'));var BPromise=require(_0xdeef('0x6'));var Mustache=require(_0xdeef('0x7'));var util=require(_0xdeef('0x8'));var path=require(_0xdeef('0x9'));var sox=require('sox');var csv=require(_0xdeef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdeef('0xb'));var _=require(_0xdeef('0xc'));var squel=require(_0xdeef('0xd'));var crypto=require(_0xdeef('0xe'));var jsforce=require(_0xdeef('0xf'));var deskjs=require(_0xdeef('0x10'));var toCsv=require(_0xdeef('0xa'));var querystring=require(_0xdeef('0x11'));var Papa=require(_0xdeef('0x12'));var Redis=require(_0xdeef('0x13'));var authService=require(_0xdeef('0x14'));var qs=require(_0xdeef('0x15'));var as=require(_0xdeef('0x16'));var hardwareService=require(_0xdeef('0x17'));var logger=require('../../config/logger')(_0xdeef('0x18'));var utils=require(_0xdeef('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xdeef('0x1a'));var db=require(_0xdeef('0x1b'))['db'];config[_0xdeef('0x1c')]=_[_0xdeef('0x1d')](config[_0xdeef('0x1c')],{'host':_0xdeef('0x1e'),'port':0x18eb});var socket=require(_0xdeef('0x1f'))(new Redis(config[_0xdeef('0x1c')]));require(_0xdeef('0x20'))[_0xdeef('0x21')](socket);function respondWithStatusCode(_0x473612,_0x127423){_0x127423=_0x127423||0xcc;return function(_0x2eb9ac){if(_0x2eb9ac){return _0x473612[_0xdeef('0x22')](_0x127423);}return _0x473612[_0xdeef('0x23')](_0x127423)[_0xdeef('0x24')]();};}function respondWithResult(_0x109fef,_0x3edf35){_0x3edf35=_0x3edf35||0xc8;return function(_0x371c10){if(_0x371c10){return _0x109fef[_0xdeef('0x23')](_0x3edf35)['json'](_0x371c10);}};}function respondWithFilteredResult(_0x3f9042,_0xd93f84){return function(_0x207a12){if(_0x207a12){var _0x46fc10=typeof _0xd93f84['offset']===_0xdeef('0x25')&&typeof _0xd93f84[_0xdeef('0x26')]==='undefined';var _0x77fd99=_0x207a12['count'];var _0x3d6b0d=_0x46fc10?0x0:_0xd93f84[_0xdeef('0x27')];var _0x2ab67a=_0x46fc10?_0x207a12['count']:_0xd93f84[_0xdeef('0x27')]+_0xd93f84['limit'];var _0x7c7ff2;if(_0x2ab67a>=_0x77fd99){_0x2ab67a=_0x77fd99;_0x7c7ff2=0xc8;}else{_0x7c7ff2=0xce;}_0x3f9042['status'](_0x7c7ff2);return _0x3f9042[_0xdeef('0x28')](_0xdeef('0x29'),_0x3d6b0d+'-'+_0x2ab67a+'/'+_0x77fd99)[_0xdeef('0x2a')](_0x207a12);}return null;};}function patchUpdates(_0x1d7eb5){return function(_0x119bd6){try{jsonpatch[_0xdeef('0x2b')](_0x119bd6,_0x1d7eb5,!![]);}catch(_0x29bd4c){return BPromise[_0xdeef('0x2c')](_0x29bd4c);}return _0x119bd6['save']();};}function saveUpdates(_0x1caf25,_0x3cda84){return function(_0x6cc5d7){if(_0x6cc5d7){return _0x6cc5d7[_0xdeef('0x2d')](_0x1caf25)[_0xdeef('0x2e')](function(_0x2c6b42){return _0x2c6b42;});}return null;};}function handleEntityNotFound(_0x5a02c7,_0x12731e){return function(_0x407b91){if(!_0x407b91){_0x5a02c7['sendStatus'](0x194);}return _0x407b91;};}function handleError(_0x25f7b3,_0x1b8118){_0x1b8118=_0x1b8118||0x1f4;return function(_0x50f6b1){logger[_0xdeef('0x2f')](_0x50f6b1['stack']);if(_0x50f6b1[_0xdeef('0x30')]){delete _0x50f6b1[_0xdeef('0x30')];}_0x25f7b3[_0xdeef('0x23')](_0x1b8118)[_0xdeef('0x31')](_0x50f6b1);};}exports[_0xdeef('0x32')]=function(_0x7cb6bc,_0xef6018){var _0x24770a={},_0x171599={},_0x571207={'count':0x0,'rows':[]};var _0x9d06df=_[_0xdeef('0x33')](db['Team']['rawAttributes'],function(_0x433e0d){return{'name':_0x433e0d[_0xdeef('0x34')],'type':_0x433e0d[_0xdeef('0x35')][_0xdeef('0x36')]};});_0x171599[_0xdeef('0x37')]=_[_0xdeef('0x33')](_0x9d06df,_0xdeef('0x30'));_0x171599[_0xdeef('0x38')]=_['keys'](_0x7cb6bc[_0xdeef('0x38')]);_0x171599[_0xdeef('0x39')]=_[_0xdeef('0x3a')](_0x171599['model'],_0x171599[_0xdeef('0x38')]);_0x24770a[_0xdeef('0x3b')]=_[_0xdeef('0x3a')](_0x171599['model'],qs[_0xdeef('0x3c')](_0x7cb6bc[_0xdeef('0x38')][_0xdeef('0x3c')]));_0x24770a['attributes']=_0x24770a[_0xdeef('0x3b')][_0xdeef('0x3d')]?_0x24770a[_0xdeef('0x3b')]:_0x171599[_0xdeef('0x37')];if(!_0x7cb6bc[_0xdeef('0x38')]['hasOwnProperty']('nolimit')){_0x24770a[_0xdeef('0x26')]=qs['limit'](_0x7cb6bc[_0xdeef('0x38')][_0xdeef('0x26')]);_0x24770a['offset']=qs['offset'](_0x7cb6bc[_0xdeef('0x38')][_0xdeef('0x27')]);}_0x24770a['order']=qs['sort'](_0x7cb6bc['query']['sort']);_0x24770a['where']=qs[_0xdeef('0x39')](_[_0xdeef('0x3e')](_0x7cb6bc[_0xdeef('0x38')],_0x171599[_0xdeef('0x39')]),_0x9d06df);if(_0x7cb6bc[_0xdeef('0x38')][_0xdeef('0x3f')]){_0x24770a[_0xdeef('0x40')]=_[_0xdeef('0x41')](_0x24770a[_0xdeef('0x40')],{'$or':_[_0xdeef('0x33')](_0x9d06df,function(_0x233340){if(_0x233340[_0xdeef('0x35')]!==_0xdeef('0x42')){var _0x459e20={};_0x459e20[_0x233340['name']]={'$like':'%'+_0x7cb6bc[_0xdeef('0x38')]['filter']+'%'};return _0x459e20;}})});}_0x24770a=_['merge']({},_0x24770a,_0x7cb6bc[_0xdeef('0x43')]);var _0x20fb19={'where':_0x24770a[_0xdeef('0x40')]};return db['Team'][_0xdeef('0x44')](_0x20fb19)['then'](function(_0x5b40d4){_0x571207[_0xdeef('0x44')]=_0x5b40d4;if(_0x7cb6bc[_0xdeef('0x38')][_0xdeef('0x45')]){_0x24770a[_0xdeef('0x46')]=[{'all':!![]}];}return db['Team']['findAll'](_0x24770a);})[_0xdeef('0x2e')](function(_0x477b27){_0x571207[_0xdeef('0x47')]=_0x477b27;return _0x571207;})[_0xdeef('0x2e')](respondWithFilteredResult(_0xef6018,_0x24770a))[_0xdeef('0x48')](handleError(_0xef6018,null));};exports[_0xdeef('0x49')]=function(_0x451083,_0x5ac05b){var _0x1e61bb={'raw':![],'where':{'id':_0x451083['params']['id']}},_0x39fd94={};_0x39fd94[_0xdeef('0x37')]=_[_0xdeef('0x4a')](db[_0xdeef('0x4b')][_0xdeef('0x4c')]);_0x39fd94['query']=_['keys'](_0x451083[_0xdeef('0x38')]);_0x39fd94[_0xdeef('0x39')]=_['intersection'](_0x39fd94[_0xdeef('0x37')],_0x39fd94[_0xdeef('0x38')]);_0x1e61bb[_0xdeef('0x3b')]=_[_0xdeef('0x3a')](_0x39fd94[_0xdeef('0x37')],qs[_0xdeef('0x3c')](_0x451083[_0xdeef('0x38')]['fields']));_0x1e61bb[_0xdeef('0x3b')]=_0x1e61bb[_0xdeef('0x3b')]['length']?_0x1e61bb['attributes']:_0x39fd94[_0xdeef('0x37')];if(_0x451083[_0xdeef('0x38')][_0xdeef('0x45')]){_0x1e61bb[_0xdeef('0x46')]=[{'all':!![]}];}_0x1e61bb=_['merge']({},_0x1e61bb,_0x451083[_0xdeef('0x43')]);return db[_0xdeef('0x4b')][_0xdeef('0x4d')](_0x1e61bb)['then'](handleEntityNotFound(_0x5ac05b,null))[_0xdeef('0x2e')](respondWithResult(_0x5ac05b,null))[_0xdeef('0x48')](handleError(_0x5ac05b,null));};exports[_0xdeef('0x4e')]=function(_0xb8465c,_0x6c6806){return db[_0xdeef('0x4b')][_0xdeef('0x4e')](_0xb8465c[_0xdeef('0x4f')],{})[_0xdeef('0x2e')](function(_0x5107c4){var _0x442ab1=_0xb8465c[_0xdeef('0x50')]['get']({'plain':!![]});if(!_0x442ab1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x442ab1['role']===_0xdeef('0x50')){var _0x4f51ca=_0x5107c4[_0xdeef('0x51')]({'plain':!![]});var _0x2ef493=_0xdeef('0x52');return db[_0xdeef('0x53')]['find']({'where':{'name':_0x2ef493,'userProfileId':_0x442ab1[_0xdeef('0x54')]},'raw':!![]})[_0xdeef('0x2e')](function(_0x463ddf){if(_0x463ddf&&_0x463ddf[_0xdeef('0x55')]===0x0){return db[_0xdeef('0x56')][_0xdeef('0x4e')]({'name':_0x4f51ca['name'],'resourceId':_0x4f51ca['id'],'type':_0x463ddf[_0xdeef('0x30')],'sectionId':_0x463ddf['id']},{})[_0xdeef('0x2e')](function(){return _0x5107c4;});}else{return _0x5107c4;}})['catch'](function(_0x23468b){logger[_0xdeef('0x2f')](_0xdeef('0x57'),_0x23468b);throw _0x23468b;});}return _0x5107c4;})[_0xdeef('0x2e')](respondWithResult(_0x6c6806,0xc9))[_0xdeef('0x48')](handleError(_0x6c6806,null));};exports[_0xdeef('0x2d')]=function(_0xa999ec,_0x2f12b5){if(_0xa999ec['body']['id']){delete _0xa999ec[_0xdeef('0x4f')]['id'];}return db[_0xdeef('0x4b')][_0xdeef('0x4d')]({'where':{'id':_0xa999ec[_0xdeef('0x58')]['id']}})[_0xdeef('0x2e')](handleEntityNotFound(_0x2f12b5,null))['then'](saveUpdates(_0xa999ec[_0xdeef('0x4f')],null))[_0xdeef('0x2e')](respondWithResult(_0x2f12b5,null))[_0xdeef('0x48')](handleError(_0x2f12b5,null));};exports['destroy']=function(_0x55821a,_0x292d21){var _0x35d6c3=_0x55821a[_0xdeef('0x58')]['id'];var _0x58bc32=[];return db[_0xdeef('0x59')][_0xdeef('0x5a')](function(_0x4a73fa){var _0x1e821f=_0xdeef('0x5b')+_0x35d6c3;return db['sequelize'][_0xdeef('0x38')](_0x1e821f,{'type':db[_0xdeef('0x5c')]['QueryTypes'][_0xdeef('0x5d')],'raw':!![],'transaction':_0x4a73fa})[_0xdeef('0x2e')](function(_0x3c0509){_0x58bc32=_[_0xdeef('0x33')](_0x3c0509,function(_0x125073){return Number(_0x125073[_0xdeef('0x5e')]);});})[_0xdeef('0x2e')](function(){var _0x7f7842=_0xdeef('0x5f')+_0x35d6c3;return db[_0xdeef('0x59')][_0xdeef('0x38')](_0x7f7842,{'type':db[_0xdeef('0x5c')][_0xdeef('0x60')][_0xdeef('0x5d')],'raw':!![],'transaction':_0x4a73fa});})['then'](function(_0x4d8d8a){var _0xfb445=_['map'](_0x4d8d8a,function(_0x2de325){return Number(_0x2de325['VoiceQueueId']);});return db[_0xdeef('0x61')][_0xdeef('0x62')]({'where':{'UserId':{'$in':_0x58bc32},'VoiceQueueId':{'$in':_0xfb445}},'transaction':_0x4a73fa});})[_0xdeef('0x2e')](function(){var _0x2459ac=_0xdeef('0x63')+_0x35d6c3;return db[_0xdeef('0x59')][_0xdeef('0x38')](_0x2459ac,{'type':db['Sequelize'][_0xdeef('0x60')][_0xdeef('0x5d')],'raw':!![],'transaction':_0x4a73fa});})[_0xdeef('0x2e')](function(_0x231ff0){var _0x24bafe=_[_0xdeef('0x33')](_0x231ff0,function(_0x166dde){return Number(_0x166dde[_0xdeef('0x64')]);});return db[_0xdeef('0x65')]['destroy']({'where':{'UserId':{'$in':_0x58bc32},'MailQueueId':{'$in':_0x24bafe}},'transaction':_0x4a73fa});})[_0xdeef('0x2e')](function(){var _0x140655=_0xdeef('0x66')+_0x35d6c3;return db[_0xdeef('0x59')][_0xdeef('0x38')](_0x140655,{'type':db[_0xdeef('0x5c')][_0xdeef('0x60')][_0xdeef('0x5d')],'raw':!![],'transaction':_0x4a73fa});})['then'](function(_0x4c95f6){var _0x5d3301=_['map'](_0x4c95f6,function(_0x33b41d){return Number(_0x33b41d['SmsQueueId']);});return db[_0xdeef('0x67')][_0xdeef('0x62')]({'where':{'UserId':{'$in':_0x58bc32},'SmsQueueId':{'$in':_0x5d3301}},'transaction':_0x4a73fa});})[_0xdeef('0x2e')](function(){var _0x5cf72a=_0xdeef('0x68')+_0x35d6c3;return db['sequelize'][_0xdeef('0x38')](_0x5cf72a,{'type':db[_0xdeef('0x5c')][_0xdeef('0x60')][_0xdeef('0x5d')],'raw':!![],'transaction':_0x4a73fa});})[_0xdeef('0x2e')](function(_0x24753d){var _0x1165b1=_[_0xdeef('0x33')](_0x24753d,function(_0x1bf214){return Number(_0x1bf214['ChatQueueId']);});return db[_0xdeef('0x69')][_0xdeef('0x62')]({'where':{'UserId':{'$in':_0x58bc32},'ChatQueueId':{'$in':_0x1165b1}},'transaction':_0x4a73fa});})[_0xdeef('0x2e')](function(){var _0x1e74d2=_0xdeef('0x6a')+_0x35d6c3;return db[_0xdeef('0x59')][_0xdeef('0x38')](_0x1e74d2,{'type':db[_0xdeef('0x5c')][_0xdeef('0x60')][_0xdeef('0x5d')],'raw':!![],'transaction':_0x4a73fa});})[_0xdeef('0x2e')](function(_0x2d688c){var _0x519d98=_['map'](_0x2d688c,function(_0x24f57a){return Number(_0x24f57a[_0xdeef('0x6b')]);});return db['UserFaxQueue'][_0xdeef('0x62')]({'where':{'UserId':{'$in':_0x58bc32},'FaxQueueId':{'$in':_0x519d98}},'transaction':_0x4a73fa});})[_0xdeef('0x2e')](function(){var _0x48da8c='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x35d6c3;return db[_0xdeef('0x59')][_0xdeef('0x38')](_0x48da8c,{'type':db['Sequelize'][_0xdeef('0x60')][_0xdeef('0x5d')],'raw':!![],'transaction':_0x4a73fa});})[_0xdeef('0x2e')](function(_0x12ce12){var _0x4b0d34=_[_0xdeef('0x33')](_0x12ce12,function(_0x2aeb9d){return Number(_0x2aeb9d[_0xdeef('0x6c')]);});return db[_0xdeef('0x6d')][_0xdeef('0x62')]({'where':{'UserId':{'$in':_0x58bc32},'OpenchannelQueueId':{'$in':_0x4b0d34}},'transaction':_0x4a73fa});})[_0xdeef('0x2e')](function(){var _0x52aa19=_0xdeef('0x6e')+_0x35d6c3;return db[_0xdeef('0x59')][_0xdeef('0x38')](_0x52aa19,{'type':db[_0xdeef('0x5c')][_0xdeef('0x60')][_0xdeef('0x5d')],'raw':!![],'transaction':_0x4a73fa});})[_0xdeef('0x2e')](function(_0x3f16c2){var _0xf6a16c=_[_0xdeef('0x33')](_0x3f16c2,function(_0x232de2){return Number(_0x232de2[_0xdeef('0x6f')]);});return db[_0xdeef('0x70')][_0xdeef('0x62')]({'where':{'UserId':{'$in':_0x58bc32},'WhatsappQueueId':{'$in':_0xf6a16c}},'transaction':_0x4a73fa});})[_0xdeef('0x2e')](function(){return db[_0xdeef('0x71')][_0xdeef('0x4d')]({'where':{'TeamId':_0x35d6c3}});})[_0xdeef('0x2e')](function(_0x306bd2){if(_0x306bd2===null){return;}return db[_0xdeef('0x72')][_0xdeef('0x62')]({'where':{'UserId':{'$in':_0x58bc32},'VoicePrefixId':_0x306bd2[_0xdeef('0x73')]},'transaction':_0x4a73fa});})['then'](function(){return db[_0xdeef('0x4b')][_0xdeef('0x62')]({'where':{'id':_0x35d6c3},'cascade':!![],'transaction':_0x4a73fa});})[_0xdeef('0x2e')](function(_0x2f1b1c){if(_0x2f1b1c===0x0){_0x292d21[_0xdeef('0x22')](0x194);}else{return db[_0xdeef('0x56')]['destroy']({'where':{'type':_0xdeef('0x52'),'resourceId':_0x35d6c3},'cascade':!![],'transaction':_0x4a73fa})['then'](function(){_0x292d21[_0xdeef('0x23')](0xcc)[_0xdeef('0x24')]();});}})[_0xdeef('0x48')](function(_0x5f5253){_0x292d21[_0xdeef('0x23')](0x1f4)[_0xdeef('0x31')](_0x5f5253);});});};exports['getQueues']=function(_0x1f004a,_0x252ce5,_0x5e3a9f){return db[_0xdeef('0x4b')][_0xdeef('0x74')]({'where':{'id':_0x1f004a[_0xdeef('0x58')]['id']}})[_0xdeef('0x2e')](handleEntityNotFound(_0x252ce5,null))['then'](function(_0x2f5ce4){if(!_0x1f004a[_0xdeef('0x38')][_0xdeef('0x75')]||!utils['isValidChannel'](_0x1f004a[_0xdeef('0x38')][_0xdeef('0x75')])){throw new db[(_0xdeef('0x5c'))][(_0xdeef('0x76'))](_0xdeef('0x77'));}var _0x1c27f5={};var _0x258f75={};_0x258f75[_0xdeef('0x37')]=_['keys'](db[_[_0xdeef('0x78')](_0x1f004a[_0xdeef('0x38')][_0xdeef('0x75')][_0xdeef('0x79')]())+_0xdeef('0x7a')][_0xdeef('0x4c')]);_0x258f75[_0xdeef('0x38')]=_[_0xdeef('0x4a')](_0x1f004a['query']);_0x258f75['filters']=_[_0xdeef('0x3a')](_0x258f75[_0xdeef('0x37')],_0x258f75[_0xdeef('0x38')]);_0x1c27f5[_0xdeef('0x3b')]=_[_0xdeef('0x3a')](_0x258f75[_0xdeef('0x37')],qs['fields'](_0x1f004a[_0xdeef('0x38')][_0xdeef('0x3c')]));_0x1c27f5[_0xdeef('0x3b')]=_0x1c27f5[_0xdeef('0x3b')][_0xdeef('0x3d')]?_0x1c27f5[_0xdeef('0x3b')]:_0x258f75['model'];_0x1c27f5[_0xdeef('0x26')]=qs[_0xdeef('0x26')](_0x1f004a[_0xdeef('0x38')][_0xdeef('0x26')]);_0x1c27f5['offset']=qs[_0xdeef('0x27')](_0x1f004a[_0xdeef('0x38')][_0xdeef('0x27')]);_0x1c27f5['order']=qs[_0xdeef('0x7b')](_0x1f004a[_0xdeef('0x38')][_0xdeef('0x7b')]);_0x1c27f5['where']=qs[_0xdeef('0x39')](_['pick'](_0x1f004a[_0xdeef('0x38')],_0x258f75[_0xdeef('0x39')]));_0x1c27f5=_[_0xdeef('0x41')]({},_0x1c27f5,_0x1f004a[_0xdeef('0x43')]);return _0x2f5ce4['get'+_[_0xdeef('0x78')](_0x1f004a['query'][_0xdeef('0x75')]['toLowerCase']())+_0xdeef('0x7c')](_0x1c27f5);})[_0xdeef('0x2e')](respondWithResult(_0x252ce5,null))['catch'](handleError(_0x252ce5,null));};exports[_0xdeef('0x7d')]=function(_0x2b6e13,_0x30ba06,_0x504458){return db[_0xdeef('0x4b')][_0xdeef('0x74')]({'where':{'id':_0x2b6e13[_0xdeef('0x58')]['id']}})[_0xdeef('0x2e')](function(_0x578f74){if(_0x578f74){if(!_0x2b6e13['body']['channel']||!utils[_0xdeef('0x7e')](_0x2b6e13[_0xdeef('0x4f')]['channel'])){throw new db[(_0xdeef('0x5c'))][(_0xdeef('0x76'))](_0xdeef('0x77'));}return _0x578f74[_0xdeef('0x7f')+_[_0xdeef('0x78')](_0x2b6e13[_0xdeef('0x4f')][_0xdeef('0x75')]['toLowerCase']())+'Queues'](_0x2b6e13['body'][_0xdeef('0x80')]);}return null;})[_0xdeef('0x2e')](handleEntityNotFound(_0x30ba06,null))['then'](respondWithStatusCode(_0x30ba06,null))['catch'](handleError(_0x30ba06,null));};exports[_0xdeef('0x81')]=function(_0x196504,_0xe536c,_0x5a403e){return db[_0xdeef('0x4b')]['findOne']({'where':{'id':_0x196504[_0xdeef('0x58')]['id']}})[_0xdeef('0x2e')](function(_0xe7c952){if(_0xe7c952){if(!_0x196504['query']['channel']||!utils[_0xdeef('0x7e')](_0x196504['query'][_0xdeef('0x75')])){throw new db[(_0xdeef('0x5c'))][(_0xdeef('0x76'))](_0xdeef('0x77'));}return _0xe7c952[_0xdeef('0x82')+_[_0xdeef('0x78')](_0x196504[_0xdeef('0x38')][_0xdeef('0x75')][_0xdeef('0x79')]())+_0xdeef('0x7c')](_0x196504[_0xdeef('0x38')]['ids']);}return null;})[_0xdeef('0x2e')](handleEntityNotFound(_0xe536c,null))[_0xdeef('0x2e')](respondWithStatusCode(_0xe536c,null))[_0xdeef('0x48')](handleError(_0xe536c,null));};exports[_0xdeef('0x83')]=function(_0x3ea19b,_0x25000f){var _0x4bd145=_[_0xdeef('0x84')](_0x3ea19b[_0xdeef('0x4f')][_0xdeef('0x80')])?_0x3ea19b[_0xdeef('0x4f')][_0xdeef('0x80')]:[_0x3ea19b['body'][_0xdeef('0x80')]];var _0x2fc015=_0x3ea19b[_0xdeef('0x58')]['id'];return db['Team'][_0xdeef('0x4d')]({'where':{'id':_0x2fc015}})['then'](handleEntityNotFound(_0x25000f,null))[_0xdeef('0x2e')](function(_0xb7a810){if(_0xb7a810){var _0x3e4fae=[_0xdeef('0x85'),_0xdeef('0x86'),_0xdeef('0x87'),_0xdeef('0x88'),_0xdeef('0x89'),_0xdeef('0x8a'),'Whatsapp'];return db[_0xdeef('0x59')][_0xdeef('0x5a')](function(_0x2fd6f4){var _0x4201cd=_[_0xdeef('0x33')](_0x3e4fae,function(_0x5d0ef0){var _0x28ac8c={'attributes':['id',_0xdeef('0x30')]};if(_0x5d0ef0==='Voice'){_0x28ac8c[_0xdeef('0x8b')]={'attributes':[_0xdeef('0x8c')]};}return _0xb7a810[_0xdeef('0x51')+_0x5d0ef0+_0xdeef('0x7c')](_0x28ac8c)[_0xdeef('0x2e')](function(_0x569376){var _0x588a4c=_['map'](_0x569376,function(_0x20e75e){var _0x1d2c51=_[_0xdeef('0x33')](_0x4bd145,function(_0x119aa7){var _0x223173={'where':{'UserId':_0x119aa7,[_0x5d0ef0+_0xdeef('0x8d')]:_0x20e75e['id']},'transaction':_0x2fd6f4};if(_0x5d0ef0===_0xdeef('0x85')){_0x223173[_0xdeef('0x1d')]={'penalty':_0x20e75e[_0xdeef('0x8e')][_0xdeef('0x8c')]};}return db[_0xdeef('0x8f')+_0x5d0ef0+_0xdeef('0x7a')][_0xdeef('0x90')](_0x223173)[_0xdeef('0x2e')](function(){socket[_0xdeef('0x91')](_0xdeef('0x50')+_0x5d0ef0+_0xdeef('0x92'),{'UserId':_0x119aa7,[_0x5d0ef0+_0xdeef('0x8d')]:_0x20e75e['id']});if(_0x5d0ef0!==_0xdeef('0x85')){return;}return db[_0xdeef('0x8f')][_0xdeef('0x93')]({'where':{'id':_0x4bd145,'online':0x1},'attributes':['id','name',_0xdeef('0x94'),_0xdeef('0x95'),_0xdeef('0x96')],'raw':!![]})['then'](function(_0x317a54){var _0x48c42e=_[_0xdeef('0x33')](_0x317a54,function(_0x451c5d){return db['UserVoiceQueueRt'][_0xdeef('0x97')]({'membername':_0x451c5d[_0xdeef('0x30')],'UserId':_0x451c5d['id'],'queue_name':_0x20e75e[_0xdeef('0x30')],'VoiceQueueId':_0x20e75e['id'],'interface':_[_0xdeef('0x98')](_0x451c5d[_0xdeef('0x96')])?util[_0xdeef('0x99')](_0xdeef('0x9a'),_0x451c5d['name']):_0x451c5d['interface'],'paused':_0x451c5d['voicePause']||![],'penalty':_0x20e75e['TeamVoiceQueue'][_0xdeef('0x8c')]},{'transaction':_0x2fd6f4});});return Promise[_0xdeef('0x9b')](_0x48c42e);});});});return Promise[_0xdeef('0x9b')](_0x1d2c51);});return Promise[_0xdeef('0x9b')](_0x588a4c);})['then'](function(){return db[_0xdeef('0x71')][_0xdeef('0x74')]({'where':{'teamId':_0x2fc015}})[_0xdeef('0x2e')](function(_0x4d9a87){if(_0x4d9a87){var _0x1baebf=_[_0xdeef('0x33')](_0x4bd145,function(_0xc55155){db[_0xdeef('0x72')][_0xdeef('0x97')]({'UserId':_0xc55155,'VoicePrefixId':_0x4d9a87[_0xdeef('0x73')]});});return Promise['all'](_0x1baebf);}});});});return Promise[_0xdeef('0x9b')](_0x4201cd)[_0xdeef('0x2e')](function(){return _0xb7a810[_0xdeef('0x83')](_0x4bd145,{'transaction':_0x2fd6f4})['spread'](function(_0x28ac7d){return _0x28ac7d;});});});}})[_0xdeef('0x2e')](respondWithResult(_0x25000f,null))[_0xdeef('0x48')](handleError(_0x25000f,null));};exports['removeAgents']=function(_0x44cd56,_0x101124){var _0x3dff77=_[_0xdeef('0x84')](_0x44cd56[_0xdeef('0x38')][_0xdeef('0x80')])?_0x44cd56[_0xdeef('0x38')][_0xdeef('0x80')]:[_0x44cd56[_0xdeef('0x38')][_0xdeef('0x80')]];var _0x6e8f84=_0x44cd56[_0xdeef('0x58')]['id'];return db[_0xdeef('0x4b')]['find']({'where':{'id':_0x6e8f84}})['then'](handleEntityNotFound(_0x101124,null))[_0xdeef('0x2e')](function(_0x28333d){if(_0x28333d){var _0xa88956=[_0xdeef('0x85'),_0xdeef('0x86'),'Mail',_0xdeef('0x88'),_0xdeef('0x89'),_0xdeef('0x8a'),_0xdeef('0x9c')];return db[_0xdeef('0x59')]['transaction'](function(_0x2de019){var _0x5375e7=_['map'](_0xa88956,function(_0x5f1532){var _0x2f087a={'attributes':['id',_0xdeef('0x30')]};return _0x28333d[_0xdeef('0x51')+_0x5f1532+_0xdeef('0x7c')](_0x2f087a)[_0xdeef('0x2e')](function(_0x5985df){var _0x2fd499=_[_0xdeef('0x33')](_0x5985df,function(_0x42a609){return _0x42a609[_0xdeef('0x9d')](_0x3dff77,{'transaction':_0x2de019})[_0xdeef('0x2e')](function(){var _0x3cf397=_['map'](_0x3dff77,function(_0x5e38a2){socket[_0xdeef('0x91')](_0xdeef('0x50')+_0x5f1532+_0xdeef('0x9e'),{'UserId':Number(_0x5e38a2),[_0x5f1532+_0xdeef('0x8d')]:_0x42a609['id']});if(_0x5f1532!==_0xdeef('0x85')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x42a609['id'],'UserId':_0x5e38a2},'transaction':_0x2de019});});return Promise['all'](_0x3cf397);});});return Promise[_0xdeef('0x9b')](_0x2fd499);});});return Promise['all'](_0x5375e7)[_0xdeef('0x2e')](function(){return _0x28333d[_0xdeef('0x9d')](_0x3dff77,{'transaction':_0x2de019});})[_0xdeef('0x2e')](function(){return db[_0xdeef('0x71')][_0xdeef('0x74')]({'where':{'teamId':_0x6e8f84}})[_0xdeef('0x2e')](function(_0x30b4db){if(_0x30b4db){var _0x3799a3=_[_0xdeef('0x33')](_0x3dff77,function(_0x58e469){db['UserVoicePrefix'][_0xdeef('0x62')]({'where':{'UserId':_0x58e469,'VoicePrefixId':_0x30b4db[_0xdeef('0x73')]}});});return Promise[_0xdeef('0x9b')](_0x3799a3);}});});});}})[_0xdeef('0x2e')](respondWithStatusCode(_0x101124,null))[_0xdeef('0x48')](handleError(_0x101124,null));};exports['getAgents']=function(_0x54d0c7,_0x48ce34,_0x5dcbcb){var _0x2040c3={};var _0x27d172={};var _0x4bc3da;var _0x439873;return db[_0xdeef('0x4b')][_0xdeef('0x74')]({'where':{'id':_0x54d0c7[_0xdeef('0x58')]['id']}})[_0xdeef('0x2e')](handleEntityNotFound(_0x48ce34,null))[_0xdeef('0x2e')](function(_0x45387b){if(_0x45387b){_0x4bc3da=_0x45387b;_0x27d172[_0xdeef('0x37')]=_[_0xdeef('0x4a')](db['User'][_0xdeef('0x4c')]);_0x27d172[_0xdeef('0x38')]=_['keys'](_0x54d0c7[_0xdeef('0x38')]);_0x27d172[_0xdeef('0x39')]=_[_0xdeef('0x3a')](_0x27d172[_0xdeef('0x37')],_0x27d172[_0xdeef('0x38')]);_0x2040c3[_0xdeef('0x3b')]=_['intersection'](_0x27d172[_0xdeef('0x37')],qs[_0xdeef('0x3c')](_0x54d0c7[_0xdeef('0x38')][_0xdeef('0x3c')]));_0x2040c3[_0xdeef('0x3b')]=_0x2040c3[_0xdeef('0x3b')]['length']?_0x2040c3['attributes']:_0x27d172[_0xdeef('0x37')];_0x2040c3[_0xdeef('0x9f')]=qs[_0xdeef('0x7b')](_0x54d0c7[_0xdeef('0x38')][_0xdeef('0x7b')]);_0x2040c3[_0xdeef('0x40')]=qs[_0xdeef('0x39')](_[_0xdeef('0x3e')](_0x54d0c7['query'],_0x27d172[_0xdeef('0x39')]));if(_0x54d0c7[_0xdeef('0x38')][_0xdeef('0x3f')]){_0x2040c3['where']=_[_0xdeef('0x41')](_0x2040c3[_0xdeef('0x40')],{'$or':_[_0xdeef('0x33')](_0x2040c3['attributes'],function(_0x1f1274){var _0x18ee9c={};_0x18ee9c[_0x1f1274]={'$like':'%'+_0x54d0c7[_0xdeef('0x38')]['filter']+'%'};return _0x18ee9c;})});}_0x2040c3=_['merge']({},_0x2040c3,_0x54d0c7[_0xdeef('0x43')]);return _0x4bc3da['getAgents'](_0x2040c3);}})[_0xdeef('0x2e')](function(_0x160437){if(_0x160437){_0x439873=_0x160437['length'];if(!_0x54d0c7[_0xdeef('0x38')][_0xdeef('0xa0')](_0xdeef('0xa1'))){_0x2040c3['limit']=qs[_0xdeef('0x26')](_0x54d0c7['query'][_0xdeef('0x26')]);_0x2040c3[_0xdeef('0x27')]=qs[_0xdeef('0x27')](_0x54d0c7[_0xdeef('0x38')][_0xdeef('0x27')]);}return _0x4bc3da['getAgents'](_0x2040c3);}})['then'](function(_0x20b3ec){if(_0x20b3ec){return _0x20b3ec?{'count':_0x439873,'rows':_0x20b3ec}:null;}})[_0xdeef('0x2e')](respondWithResult(_0x48ce34,null))[_0xdeef('0x48')](handleError(_0x48ce34,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 2a7fc72..88692e1 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 _0xf3b1=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Team','setMaxListeners'];(function(_0xda4776,_0x2485e0){var _0x39effb=function(_0x5b0764){while(--_0x5b0764){_0xda4776['push'](_0xda4776['shift']());}};_0x39effb(++_0x2485e0);}(_0xf3b1,0x115));var _0x1f3b=function(_0x52d529,_0x258725){_0x52d529=_0x52d529-0x0;var _0x585c33=_0xf3b1[_0x52d529];return _0x585c33;};'use strict';var EventEmitter=require('events');var Team=require(_0x1f3b('0x0'))['db'][_0x1f3b('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x1f3b('0x2')](0x0);var events={'afterCreate':_0x1f3b('0x3'),'afterUpdate':_0x1f3b('0x4'),'afterDestroy':_0x1f3b('0x5')};function emitEvent(_0x3f3331){return function(_0x554035,_0x4ee1cd,_0x161333){TeamEvents[_0x1f3b('0x6')](_0x3f3331+':'+_0x554035['id'],_0x554035);TeamEvents['emit'](_0x3f3331,_0x554035);_0x161333(null);};}for(var e in events){if(events[_0x1f3b('0x7')](e)){var event=events[e];Team[_0x1f3b('0x8')](e,emitEvent(event));}}module[_0x1f3b('0x9')]=TeamEvents; \ No newline at end of file +var _0x7321=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x563979,_0x336cdd){var _0x4b196f=function(_0x17c09e){while(--_0x17c09e){_0x563979['push'](_0x563979['shift']());}};_0x4b196f(++_0x336cdd);}(_0x7321,0x152));var _0x1732=function(_0x2c4d61,_0x5c45fe){_0x2c4d61=_0x2c4d61-0x0;var _0x6cdc13=_0x7321[_0x2c4d61];return _0x6cdc13;};'use strict';var EventEmitter=require(_0x1732('0x0'));var Team=require(_0x1732('0x1'))['db'][_0x1732('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x1732('0x3')](0x0);var events={'afterCreate':_0x1732('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x59c773){return function(_0x12b018,_0x3f420b,_0x260a4a){TeamEvents[_0x1732('0x5')](_0x59c773+':'+_0x12b018['id'],_0x12b018);TeamEvents[_0x1732('0x5')](_0x59c773,_0x12b018);_0x260a4a(null);};}for(var e in events){if(events[_0x1732('0x6')](e)){var event=events[e];Team[_0x1732('0x7')](e,emitEvent(event));}}module[_0x1732('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 57ee07a..aa28183 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 _0xd24b=['Chat','Fax','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','Queues','then','map','setDataValue','channel','catch','exports','teams'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xd24b,0x1ca));var _0xbd24=function(_0x3e543d,_0x4f3548){_0x3e543d=_0x3e543d-0x0;var _0x51285c=_0xd24b[_0x3e543d];return _0x51285c;};'use strict';var _=require(_0xbd24('0x0'));var attributes=require(_0xbd24('0x1'));function getQueuesByChannel(_0x26c332,_0x4d1e0e){var _0x7cd7c6='get'+_0x4d1e0e+_0xbd24('0x2');return _0x26c332[_0x7cd7c6]()[_0xbd24('0x3')](function(_0x3ee1af){return _[_0xbd24('0x4')](_0x3ee1af,function(_0x413cf1){_0x413cf1[_0xbd24('0x5')](_0xbd24('0x6'),_0x4d1e0e);return _0x413cf1;});})[_0xbd24('0x7')](function(_0x33c4c2){throw _0x33c4c2;});}module[_0xbd24('0x8')]=function(_0x1e56fc){return _0x1e56fc['define']('Team',attributes,{'tableName':_0xbd24('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x531bce=this;var _0x274931=[_0xbd24('0xa'),_0xbd24('0xb'),'Mail',_0xbd24('0xc'),_0xbd24('0xd'),_0xbd24('0xe'),_0xbd24('0xf')];return Promise[_0xbd24('0x10')]()['then'](function(){var _0x3768fe=_[_0xbd24('0x4')](_0x274931,function(_0x59811c){return getQueuesByChannel(_0x531bce,_0x59811c);});return Promise[_0xbd24('0x11')](_0x3768fe);})[_0xbd24('0x7')](function(_0x50edd7){throw _0x50edd7;});}}});}; \ No newline at end of file +var _0xdb5c=['setDataValue','channel','catch','exports','define','teams','Chat','Fax','Mail','Openchannel','Sms','Whatsapp','resolve','all','./team.attributes','then','map'];(function(_0x2fb73f,_0x5e35a5){var _0x4a340c=function(_0x3491a1){while(--_0x3491a1){_0x2fb73f['push'](_0x2fb73f['shift']());}};_0x4a340c(++_0x5e35a5);}(_0xdb5c,0x140));var _0xcdb5=function(_0x3c317c,_0x557fe0){_0x3c317c=_0x3c317c-0x0;var _0x20f2f7=_0xdb5c[_0x3c317c];return _0x20f2f7;};'use strict';var _=require('lodash');var attributes=require(_0xcdb5('0x0'));function getQueuesByChannel(_0x1d8643,_0x5dd7ed){var _0x3bc680='get'+_0x5dd7ed+'Queues';return _0x1d8643[_0x3bc680]()[_0xcdb5('0x1')](function(_0x3540e1){return _[_0xcdb5('0x2')](_0x3540e1,function(_0x2195a7){_0x2195a7[_0xcdb5('0x3')](_0xcdb5('0x4'),_0x5dd7ed);return _0x2195a7;});})[_0xcdb5('0x5')](function(_0x1816dc){throw _0x1816dc;});}module[_0xcdb5('0x6')]=function(_0x3bc797){return _0x3bc797[_0xcdb5('0x7')]('Team',attributes,{'tableName':_0xcdb5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x13adf4=this;var _0x12a403=[_0xcdb5('0x9'),_0xcdb5('0xa'),_0xcdb5('0xb'),_0xcdb5('0xc'),_0xcdb5('0xd'),'Voice',_0xcdb5('0xe')];return Promise[_0xcdb5('0xf')]()[_0xcdb5('0x1')](function(){var _0x39df26=_[_0xcdb5('0x2')](_0x12a403,function(_0x1fd732){return getQueuesByChannel(_0x13adf4,_0x1fd732);});return Promise[_0xcdb5('0x10')](_0x39df26);})[_0xcdb5('0x5')](function(_0x13f8eb){throw _0x13f8eb;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 9f7cdb0..fb69404 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 _0xb190=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x86a411,_0x459440){var _0x6e98e4=function(_0x2c5c9b){while(--_0x2c5c9b){_0x86a411['push'](_0x86a411['shift']());}};_0x6e98e4(++_0x459440);}(_0xb190,0x1ca));var _0x0b19=function(_0x20cf81,_0x4c8ba6){_0x20cf81=_0x20cf81-0x0;var _0x246890=_0xb190[_0x20cf81];return _0x246890;};'use strict';var _=require(_0x0b19('0x0'));var util=require('util');var moment=require(_0x0b19('0x1'));var BPromise=require(_0x0b19('0x2'));var rs=require(_0x0b19('0x3'));var fs=require('fs');var Redis=require(_0x0b19('0x4'));var db=require(_0x0b19('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0b19('0x6'));var jayson=require(_0x0b19('0x7'));var client=jayson[_0x0b19('0x8')][_0x0b19('0x9')]({'port':0x232a});config[_0x0b19('0xa')]=_[_0x0b19('0xb')](config[_0x0b19('0xa')],{'host':_0x0b19('0xc'),'port':0x18eb});var socket=require(_0x0b19('0xd'))(new Redis(config['redis']));require(_0x0b19('0xe'))[_0x0b19('0xf')](socket);function respondWithRpcPromise(_0x24ba7b,_0x267736,_0x40329f){return new BPromise(function(_0x5e381d,_0x8ee0cc){return client[_0x0b19('0x10')](_0x24ba7b,_0x40329f)[_0x0b19('0x11')](function(_0x222d13){logger[_0x0b19('0x12')](_0x0b19('0x13'),_0x267736,_0x0b19('0x14'));logger[_0x0b19('0x15')](_0x0b19('0x16'),_0x267736,_0x0b19('0x14'),JSON['stringify'](_0x222d13));if(_0x222d13[_0x0b19('0x17')]){if(_0x222d13[_0x0b19('0x17')][_0x0b19('0x18')]===0x1f4){logger[_0x0b19('0x17')](_0x0b19('0x13'),_0x267736,_0x222d13[_0x0b19('0x17')][_0x0b19('0x19')]);return _0x8ee0cc(_0x222d13[_0x0b19('0x17')][_0x0b19('0x19')]);}logger[_0x0b19('0x17')]('Team,\x20%s,\x20%s',_0x267736,_0x222d13[_0x0b19('0x17')][_0x0b19('0x19')]);return _0x5e381d(_0x222d13['error'][_0x0b19('0x19')]);}else{logger['info'](_0x0b19('0x13'),_0x267736,_0x0b19('0x14'));_0x5e381d(_0x222d13[_0x0b19('0x1a')][_0x0b19('0x19')]);}})['catch'](function(_0x1a4cab){logger[_0x0b19('0x17')](_0x0b19('0x13'),_0x267736,_0x1a4cab);_0x8ee0cc(_0x1a4cab);});});} \ No newline at end of file +var _0x7c6d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x494f09,_0x141939){var _0x13517c=function(_0x536256){while(--_0x536256){_0x494f09['push'](_0x494f09['shift']());}};_0x13517c(++_0x141939);}(_0x7c6d,0xd6));var _0xd7c6=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x7c6d[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require(_0xd7c6('0x0'));var moment=require(_0xd7c6('0x1'));var BPromise=require('bluebird');var rs=require(_0xd7c6('0x2'));var fs=require('fs');var Redis=require(_0xd7c6('0x3'));var db=require(_0xd7c6('0x4'))['db'];var utils=require(_0xd7c6('0x5'));var logger=require(_0xd7c6('0x6'))(_0xd7c6('0x7'));var config=require(_0xd7c6('0x8'));var jayson=require(_0xd7c6('0x9'));var client=jayson[_0xd7c6('0xa')]['http']({'port':0x232a});config[_0xd7c6('0xb')]=_[_0xd7c6('0xc')](config[_0xd7c6('0xb')],{'host':_0xd7c6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7c6('0xb')]));require('./team.socket')[_0xd7c6('0xe')](socket);function respondWithRpcPromise(_0x39dbe6,_0x7673a7,_0x3fedb5){return new BPromise(function(_0x2de3b7,_0x502ab6){return client[_0xd7c6('0xf')](_0x39dbe6,_0x3fedb5)[_0xd7c6('0x10')](function(_0x1b7b16){logger[_0xd7c6('0x11')](_0xd7c6('0x12'),_0x7673a7,_0xd7c6('0x13'));logger['debug'](_0xd7c6('0x14'),_0x7673a7,_0xd7c6('0x13'),JSON[_0xd7c6('0x15')](_0x1b7b16));if(_0x1b7b16[_0xd7c6('0x16')]){if(_0x1b7b16['error'][_0xd7c6('0x17')]===0x1f4){logger[_0xd7c6('0x16')](_0xd7c6('0x12'),_0x7673a7,_0x1b7b16[_0xd7c6('0x16')][_0xd7c6('0x18')]);return _0x502ab6(_0x1b7b16[_0xd7c6('0x16')]['message']);}logger[_0xd7c6('0x16')](_0xd7c6('0x12'),_0x7673a7,_0x1b7b16[_0xd7c6('0x16')][_0xd7c6('0x18')]);return _0x2de3b7(_0x1b7b16[_0xd7c6('0x16')][_0xd7c6('0x18')]);}else{logger['info'](_0xd7c6('0x12'),_0x7673a7,_0xd7c6('0x13'));_0x2de3b7(_0x1b7b16[_0xd7c6('0x19')][_0xd7c6('0x18')]);}})[_0xd7c6('0x1a')](function(_0x2c4730){logger[_0xd7c6('0x16')](_0xd7c6('0x12'),_0x7673a7,_0x2c4730);_0x502ab6(_0x2c4730);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 35256fd..e92722c 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 _0xff83=['emit','team:','save','remove','update'];(function(_0x28678d,_0x54324f){var _0x1643e9=function(_0x873a6c){while(--_0x873a6c){_0x28678d['push'](_0x28678d['shift']());}};_0x1643e9(++_0x54324f);}(_0xff83,0x98));var _0x3ff8=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xff83[_0x311c35];return _0x5cc50c;};'use strict';var TeamEvents=require('./team.events');var events=[_0x3ff8('0x0'),_0x3ff8('0x1'),_0x3ff8('0x2')];function createListener(_0x3280af,_0x4d8bb8){return function(_0x4db20d){_0x4d8bb8[_0x3ff8('0x3')](_0x3280af,_0x4db20d);};}function removeListener(_0x173f67,_0x3b185d){return function(){TeamEvents['removeListener'](_0x173f67,_0x3b185d);};}exports['register']=function(_0x163c8c){for(var _0x533bba=0x0,_0x49f70f=events['length'];_0x533bba<_0x49f70f;_0x533bba++){var _0x65158c=events[_0x533bba];var _0x184b3f=createListener(_0x3ff8('0x4')+_0x65158c,_0x163c8c);TeamEvents['on'](_0x65158c,_0x184b3f);}}; \ No newline at end of file +var _0x757a=['save','remove','emit','removeListener','register','team:'];(function(_0x2ff619,_0x37778f){var _0x30f21c=function(_0x257d82){while(--_0x257d82){_0x2ff619['push'](_0x2ff619['shift']());}};_0x30f21c(++_0x37778f);}(_0x757a,0xde));var _0xa757=function(_0x2f4d34,_0x4d14f1){_0x2f4d34=_0x2f4d34-0x0;var _0x4cc86d=_0x757a[_0x2f4d34];return _0x4cc86d;};'use strict';var TeamEvents=require('./team.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){TeamEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);TeamEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index b4b037e..7ee3fd2 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 _0xf82e=['INTEGER','sequelize','exports'];(function(_0x3496c0,_0x2c108d){var _0x35e985=function(_0x51d9bb){while(--_0x51d9bb){_0x3496c0['push'](_0x3496c0['shift']());}};_0x35e985(++_0x2c108d);}(_0xf82e,0x172));var _0xef82=function(_0x2983b6,_0x2dc13c){_0x2983b6=_0x2983b6-0x0;var _0x3c24f9=_0xf82e[_0x2983b6];return _0x3c24f9;};'use strict';var Sequelize=require(_0xef82('0x0'));module[_0xef82('0x1')]={'TeamId':{'type':Sequelize[_0xef82('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xef82('0x2')]}}; \ No newline at end of file +var _0xbf6e=['INTEGER'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xbf6e,0x149));var _0xebf6=function(_0x139b63,_0x389ca8){_0x139b63=_0x139b63-0x0;var _0x2493f2=_0xbf6e[_0x139b63];return _0x2493f2;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0xebf6('0x0')]},'VoicePrefixId':{'type':Sequelize[_0xebf6('0x0')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 2c1fa99..9beaf6c 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 _0xab23=['rimraf','../../config/environment','./teamVoicePrefix.attributes','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0xab23,0x1bc));var _0x3ab2=function(_0x582c7d,_0x24ed82){_0x582c7d=_0x582c7d-0x0;var _0x3caa7d=_0xab23[_0x582c7d];return _0x3caa7d;};'use strict';var _=require(_0x3ab2('0x0'));var util=require(_0x3ab2('0x1'));var logger=require(_0x3ab2('0x2'))(_0x3ab2('0x3'));var moment=require(_0x3ab2('0x4'));var BPromise=require(_0x3ab2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ab2('0x6'));var rimraf=require(_0x3ab2('0x7'));var config=require(_0x3ab2('0x8'));var attributes=require(_0x3ab2('0x9'));module['exports']=function(_0x5222ba,_0x3445f2){return _0x5222ba['define']('TeamVoicePrefix',attributes,{'tableName':_0x3ab2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97f5=['rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x5c5743,_0x51074e){var _0x2bae12=function(_0x23a923){while(--_0x23a923){_0x5c5743['push'](_0x5c5743['shift']());}};_0x2bae12(++_0x51074e);}(_0x97f5,0x72));var _0x597f=function(_0x1ea377,_0x59d83b){_0x1ea377=_0x1ea377-0x0;var _0x1215df=_0x97f5[_0x1ea377];return _0x1215df;};'use strict';var _=require(_0x597f('0x0'));var util=require(_0x597f('0x1'));var logger=require(_0x597f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x597f('0x3'));var rp=require(_0x597f('0x4'));var fs=require('fs');var path=require(_0x597f('0x5'));var rimraf=require(_0x597f('0x6'));var config=require(_0x597f('0x7'));var attributes=require(_0x597f('0x8'));module[_0x597f('0x9')]=function(_0x1abf16,_0x89d13a){return _0x1abf16['define'](_0x597f('0xa'),attributes,{'tableName':_0x597f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index f3efb98..6991f54 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4d4062,_0x219da8){var _0x8b964b=function(_0x3eb912){while(--_0x3eb912){_0x4d4062['push'](_0x4d4062['shift']());}};_0x8b964b(++_0x219da8);}(_0x70e0,0x17b));var _0x070e=function(_0x5cc222,_0x48e591){_0x5cc222=_0x5cc222-0x0;var _0x88aa01=_0x70e0[_0x5cc222];return _0x88aa01;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2c341e,_0x414d11){var _0x43c1e8=function(_0xe783f3){while(--_0xe783f3){_0x2c341e['push'](_0x2c341e['shift']());}};_0x43c1e8(++_0x414d11);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 12972bf..1066ad7 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 _0x1388=['sequelize'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x1388,0x101));var _0x8138=function(_0x27c7b2,_0x3c8adc){_0x27c7b2=_0x27c7b2-0x0;var _0x33829e=_0x1388[_0x27c7b2];return _0x33829e;};'use strict';var Sequelize=require(_0x8138('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf3ac=['INTEGER','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3ac,0x89));var _0xcf3a=function(_0x2fef1d,_0x377cc4){_0x2fef1d=_0x2fef1d-0x0;var _0x543070=_0xf3ac[_0x2fef1d];return _0x543070;};'use strict';var Sequelize=require('sequelize');module[_0xcf3a('0x0')]={'penalty':{'type':Sequelize[_0xcf3a('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 6a86f1c..08599ce 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 _0x38c3=['api','moment','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','TeamVoiceQueue','team_has_voice_queues','lodash','util'];(function(_0x452bc8,_0x26a1d2){var _0x422d19=function(_0x5984c1){while(--_0x5984c1){_0x452bc8['push'](_0x452bc8['shift']());}};_0x422d19(++_0x26a1d2);}(_0x38c3,0x13d));var _0x338c=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0x38c3[_0xdd82b4];return _0x549bb2;};'use strict';var _=require(_0x338c('0x0'));var util=require(_0x338c('0x1'));var logger=require('../../config/logger')(_0x338c('0x2'));var moment=require(_0x338c('0x3'));var BPromise=require(_0x338c('0x4'));var rp=require(_0x338c('0x5'));var fs=require('fs');var path=require(_0x338c('0x6'));var rimraf=require(_0x338c('0x7'));var config=require('../../config/environment');var attributes=require(_0x338c('0x8'));module['exports']=function(_0x41c16d,_0x28eeb3){return _0x41c16d['define'](_0x338c('0x9'),attributes,{'tableName':_0x338c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa991=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash'];(function(_0x2ec42,_0x4b0f37){var _0x5497ca=function(_0x45898f){while(--_0x45898f){_0x2ec42['push'](_0x2ec42['shift']());}};_0x5497ca(++_0x4b0f37);}(_0xa991,0x143));var _0x1a99=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xa991[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x1a99('0x0'));var util=require('util');var logger=require(_0x1a99('0x1'))(_0x1a99('0x2'));var moment=require(_0x1a99('0x3'));var BPromise=require(_0x1a99('0x4'));var rp=require(_0x1a99('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a99('0x6'));var config=require(_0x1a99('0x7'));var attributes=require(_0x1a99('0x8'));module[_0x1a99('0x9')]=function(_0x22990b,_0xabf36a){return _0x22990b[_0x1a99('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0x1a99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index f26e813..8fb869e 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 _0x498a=['message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x498a,0x1bc));var _0xa498=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x498a[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xa498('0x0'));var util=require(_0xa498('0x1'));var moment=require('moment');var BPromise=require(_0xa498('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa498('0x3'))['db'];var utils=require(_0xa498('0x4'));var logger=require(_0xa498('0x5'))(_0xa498('0x6'));var config=require('../../config/environment');var jayson=require(_0xa498('0x7'));var client=jayson['client'][_0xa498('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x346d01,_0x5212fe,_0xe38dd){return new BPromise(function(_0x703b,_0x55cace){return client[_0xa498('0x9')](_0x346d01,_0xe38dd)[_0xa498('0xa')](function(_0x48f8d3){logger[_0xa498('0xb')](_0xa498('0xc'),_0x5212fe,_0xa498('0xd'));logger[_0xa498('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5212fe,_0xa498('0xd'),JSON[_0xa498('0xf')](_0x48f8d3));if(_0x48f8d3[_0xa498('0x10')]){if(_0x48f8d3['error'][_0xa498('0x11')]===0x1f4){logger[_0xa498('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5212fe,_0x48f8d3[_0xa498('0x10')]['message']);return _0x55cace(_0x48f8d3['error'][_0xa498('0x12')]);}logger[_0xa498('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5212fe,_0x48f8d3[_0xa498('0x10')][_0xa498('0x12')]);return _0x703b(_0x48f8d3[_0xa498('0x10')][_0xa498('0x12')]);}else{logger[_0xa498('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5212fe,_0xa498('0xd'));_0x703b(_0x48f8d3[_0xa498('0x13')][_0xa498('0x12')]);}})[_0xa498('0x14')](function(_0x1cbd56){logger['error'](_0xa498('0xc'),_0x5212fe,_0x1cbd56);_0x55cace(_0x1cbd56);});});} \ No newline at end of file +var _0xf23e=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash'];(function(_0x1b4c04,_0x8d961d){var _0x374f5d=function(_0x11dc31){while(--_0x11dc31){_0x1b4c04['push'](_0x1b4c04['shift']());}};_0x374f5d(++_0x8d961d);}(_0xf23e,0x1a3));var _0xef23=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xf23e[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0xef23('0x0'));var util=require(_0xef23('0x1'));var moment=require(_0xef23('0x2'));var BPromise=require(_0xef23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef23('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef23('0x5'));var logger=require(_0xef23('0x6'))('rpc');var config=require(_0xef23('0x7'));var jayson=require(_0xef23('0x8'));var client=jayson[_0xef23('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x516d1d,_0x1efc63,_0x18b9ca){return new BPromise(function(_0x71e8,_0x4541c2){return client[_0xef23('0xa')](_0x516d1d,_0x18b9ca)[_0xef23('0xb')](function(_0x14611c){logger['info'](_0xef23('0xc'),_0x1efc63,_0xef23('0xd'));logger['debug'](_0xef23('0xe'),_0x1efc63,_0xef23('0xd'),JSON[_0xef23('0xf')](_0x14611c));if(_0x14611c[_0xef23('0x10')]){if(_0x14611c[_0xef23('0x10')][_0xef23('0x11')]===0x1f4){logger['error'](_0xef23('0xc'),_0x1efc63,_0x14611c[_0xef23('0x10')][_0xef23('0x12')]);return _0x4541c2(_0x14611c[_0xef23('0x10')][_0xef23('0x12')]);}logger['error'](_0xef23('0xc'),_0x1efc63,_0x14611c[_0xef23('0x10')][_0xef23('0x12')]);return _0x71e8(_0x14611c[_0xef23('0x10')]['message']);}else{logger[_0xef23('0x13')](_0xef23('0xc'),_0x1efc63,_0xef23('0xd'));_0x71e8(_0x14611c['result'][_0xef23('0x12')]);}})[_0xef23('0x14')](function(_0xa89f06){logger[_0xef23('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1efc63,_0xa89f06);_0x4541c2(_0xa89f06);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3369615..ba4cc83 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 _0x5ae0=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','express','Router'];(function(_0x16b119,_0x59e983){var _0x4afddf=function(_0x5ee09b){while(--_0x5ee09b){_0x16b119['push'](_0x16b119['shift']());}};_0x4afddf(++_0x59e983);}(_0x5ae0,0xf8));var _0x05ae=function(_0x481728,_0x1c1f96){_0x481728=_0x481728-0x0;var _0x3ce6ca=_0x5ae0[_0x481728];return _0x3ce6ca;};'use strict';var multer=require('multer');var util=require(_0x05ae('0x0'));var path=require(_0x05ae('0x1'));var timeout=require('connect-timeout');var express=require(_0x05ae('0x2'));var router=express[_0x05ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x05ae('0x4'));var interaction=require(_0x05ae('0x5'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x05ae('0x6')]('/',auth[_0x05ae('0x7')](),controller[_0x05ae('0x8')]);router['get'](_0x05ae('0x9'),auth[_0x05ae('0x7')](),controller[_0x05ae('0xa')]);router[_0x05ae('0xb')]('/',auth[_0x05ae('0x7')](),controller[_0x05ae('0xc')]);router[_0x05ae('0xd')](_0x05ae('0x9'),auth[_0x05ae('0x7')](),controller[_0x05ae('0xe')]);router[_0x05ae('0xf')](_0x05ae('0x9'),auth[_0x05ae('0x7')](),controller[_0x05ae('0x10')]);module[_0x05ae('0x11')]=router; \ No newline at end of file +var _0x5324=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','multer','util'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x5324,0x154));var _0x4532=function(_0x4531d8,_0x554a78){_0x4531d8=_0x4531d8-0x0;var _0x54f6e9=_0x5324[_0x4531d8];return _0x54f6e9;};'use strict';var multer=require(_0x4532('0x0'));var util=require(_0x4532('0x1'));var path=require(_0x4532('0x2'));var timeout=require(_0x4532('0x3'));var express=require('express');var router=express[_0x4532('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4532('0x5'));var interaction=require(_0x4532('0x6'));var config=require(_0x4532('0x7'));var controller=require(_0x4532('0x8'));router[_0x4532('0x9')]('/',auth[_0x4532('0xa')](),controller[_0x4532('0xb')]);router[_0x4532('0x9')]('/:id',auth[_0x4532('0xa')](),controller[_0x4532('0xc')]);router[_0x4532('0xd')]('/',auth[_0x4532('0xa')](),controller[_0x4532('0xe')]);router[_0x4532('0xf')](_0x4532('0x10'),auth[_0x4532('0xa')](),controller[_0x4532('0x11')]);router[_0x4532('0x12')](_0x4532('0x10'),auth[_0x4532('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index ae98e01..50f68cd 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 _0x68a1=['STRING','TEXT','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68a1,0x155));var _0x168a=function(_0x4afa51,_0x4a20f1){_0x4afa51=_0x4afa51-0x0;var _0x19a1de=_0x68a1[_0x4afa51];return _0x19a1de;};'use strict';var Sequelize=require('sequelize');module[_0x168a('0x0')]={'name':{'type':Sequelize[_0x168a('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x168a('0x2')]}}; \ No newline at end of file +var _0x2d53=['sequelize','STRING'];(function(_0xb03410,_0x254641){var _0x5db421=function(_0x1480cc){while(--_0x1480cc){_0xb03410['push'](_0xb03410['shift']());}};_0x5db421(++_0x254641);}(_0x2d53,0xf4));var _0x32d5=function(_0x1f4f0b,_0xc6db05){_0x1f4f0b=_0x1f4f0b-0x0;var _0x1be5c2=_0x2d53[_0x1f4f0b];return _0x1be5c2;};'use strict';var Sequelize=require(_0x32d5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x32d5('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 7203452..2f4e2c8 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 _0xa086=['limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Templates','error','name','send','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','Template','rows','catch','show','params','includeAll','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x114d1f,_0x55548e){var _0x5b91d4=function(_0x358415){while(--_0x358415){_0x114d1f['push'](_0x114d1f['shift']());}};_0x5b91d4(++_0x55548e);}(_0xa086,0x174));var _0x6a08=function(_0x57e3fc,_0x5308d3){_0x57e3fc=_0x57e3fc-0x0;var _0x2f5723=_0xa086[_0x57e3fc];return _0x2f5723;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6a08('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a08('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6a08('0x2'));var util=require(_0x6a08('0x3'));var path=require('path');var sox=require(_0x6a08('0x4'));var csv=require(_0x6a08('0x5'));var ejs=require(_0x6a08('0x6'));var fs=require('fs');var fs_extra=require(_0x6a08('0x7'));var _=require(_0x6a08('0x8'));var squel=require(_0x6a08('0x9'));var crypto=require(_0x6a08('0xa'));var jsforce=require(_0x6a08('0xb'));var deskjs=require(_0x6a08('0xc'));var toCsv=require(_0x6a08('0x5'));var querystring=require(_0x6a08('0xd'));var Papa=require(_0x6a08('0xe'));var Redis=require(_0x6a08('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6a08('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a08('0x11'))(_0x6a08('0x12'));var utils=require(_0x6a08('0x13'));var config=require(_0x6a08('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a08('0x15'))['db'];function respondWithStatusCode(_0x1b1750,_0x5645d5){_0x5645d5=_0x5645d5||0xcc;return function(_0x468cac){if(_0x468cac){return _0x1b1750[_0x6a08('0x16')](_0x5645d5);}return _0x1b1750[_0x6a08('0x17')](_0x5645d5)[_0x6a08('0x18')]();};}function respondWithResult(_0x10d6d0,_0x49a4e4){_0x49a4e4=_0x49a4e4||0xc8;return function(_0x18b985){if(_0x18b985){return _0x10d6d0['status'](_0x49a4e4)[_0x6a08('0x19')](_0x18b985);}};}function respondWithFilteredResult(_0x5bc491,_0x566ad0){return function(_0xad88d2){if(_0xad88d2){var _0xfdb2fb=typeof _0x566ad0[_0x6a08('0x1a')]===_0x6a08('0x1b')&&typeof _0x566ad0[_0x6a08('0x1c')]===_0x6a08('0x1b');var _0x4b1c8a=_0xad88d2[_0x6a08('0x1d')];var _0xb7e623=_0xfdb2fb?0x0:_0x566ad0[_0x6a08('0x1a')];var _0x48c0f8=_0xfdb2fb?_0xad88d2[_0x6a08('0x1d')]:_0x566ad0[_0x6a08('0x1a')]+_0x566ad0[_0x6a08('0x1c')];var _0x3dabf4;if(_0x48c0f8>=_0x4b1c8a){_0x48c0f8=_0x4b1c8a;_0x3dabf4=0xc8;}else{_0x3dabf4=0xce;}_0x5bc491[_0x6a08('0x17')](_0x3dabf4);return _0x5bc491[_0x6a08('0x1e')](_0x6a08('0x1f'),_0xb7e623+'-'+_0x48c0f8+'/'+_0x4b1c8a)[_0x6a08('0x19')](_0xad88d2);}return null;};}function patchUpdates(_0x4c243e){return function(_0x366bb5){try{jsonpatch[_0x6a08('0x20')](_0x366bb5,_0x4c243e,!![]);}catch(_0x2a88d2){return BPromise[_0x6a08('0x21')](_0x2a88d2);}return _0x366bb5[_0x6a08('0x22')]();};}function saveUpdates(_0x3c4dd8,_0x5bd14e){return function(_0x7ef186){if(_0x7ef186){return _0x7ef186['update'](_0x3c4dd8)[_0x6a08('0x23')](function(_0x50cef5){return _0x50cef5;});}return null;};}function removeEntity(_0x252115,_0x3b1890){return function(_0xddd7a0){if(_0xddd7a0){return _0xddd7a0[_0x6a08('0x24')]()[_0x6a08('0x23')](function(){var _0x2a48cc=_0xddd7a0[_0x6a08('0x25')]({'plain':!![]});var _0x30b8d4=_0x6a08('0x26');return db['UserProfileResource'][_0x6a08('0x24')]({'where':{'type':_0x30b8d4,'resourceId':_0x2a48cc['id']}})[_0x6a08('0x23')](function(){return _0xddd7a0;});})[_0x6a08('0x23')](function(){_0x252115[_0x6a08('0x17')](0xcc)[_0x6a08('0x18')]();});}};}function handleEntityNotFound(_0x61b568,_0x1a5da6){return function(_0x214a5e){if(!_0x214a5e){_0x61b568[_0x6a08('0x16')](0x194);}return _0x214a5e;};}function handleError(_0xe28ea7,_0x5dd7d8){_0x5dd7d8=_0x5dd7d8||0x1f4;return function(_0x245633){logger[_0x6a08('0x27')](_0x245633['stack']);if(_0x245633[_0x6a08('0x28')]){delete _0x245633[_0x6a08('0x28')];}_0xe28ea7[_0x6a08('0x17')](_0x5dd7d8)[_0x6a08('0x29')](_0x245633);};}exports['index']=function(_0x5d3550,_0xa670ad){var _0x17a906={},_0x5cdfa0={},_0x301cef={'count':0x0,'rows':[]};var _0xc3bc65=_['map'](db['Template']['rawAttributes'],function(_0x4df2f4){return{'name':_0x4df2f4[_0x6a08('0x2a')],'type':_0x4df2f4[_0x6a08('0x2b')][_0x6a08('0x2c')]};});_0x5cdfa0[_0x6a08('0x2d')]=_['map'](_0xc3bc65,'name');_0x5cdfa0[_0x6a08('0x2e')]=_[_0x6a08('0x2f')](_0x5d3550[_0x6a08('0x2e')]);_0x5cdfa0[_0x6a08('0x30')]=_[_0x6a08('0x31')](_0x5cdfa0[_0x6a08('0x2d')],_0x5cdfa0[_0x6a08('0x2e')]);_0x17a906[_0x6a08('0x32')]=_['intersection'](_0x5cdfa0[_0x6a08('0x2d')],qs[_0x6a08('0x33')](_0x5d3550[_0x6a08('0x2e')][_0x6a08('0x33')]));_0x17a906[_0x6a08('0x32')]=_0x17a906['attributes'][_0x6a08('0x34')]?_0x17a906[_0x6a08('0x32')]:_0x5cdfa0[_0x6a08('0x2d')];if(!_0x5d3550[_0x6a08('0x2e')][_0x6a08('0x35')](_0x6a08('0x36'))){_0x17a906['limit']=qs[_0x6a08('0x1c')](_0x5d3550[_0x6a08('0x2e')][_0x6a08('0x1c')]);_0x17a906[_0x6a08('0x1a')]=qs[_0x6a08('0x1a')](_0x5d3550[_0x6a08('0x2e')][_0x6a08('0x1a')]);}_0x17a906[_0x6a08('0x37')]=qs['sort'](_0x5d3550[_0x6a08('0x2e')][_0x6a08('0x38')]);_0x17a906[_0x6a08('0x39')]=qs[_0x6a08('0x30')](_[_0x6a08('0x3a')](_0x5d3550[_0x6a08('0x2e')],_0x5cdfa0[_0x6a08('0x30')]),_0xc3bc65);if(_0x5d3550[_0x6a08('0x2e')][_0x6a08('0x3b')]){_0x17a906[_0x6a08('0x39')]=_[_0x6a08('0x3c')](_0x17a906[_0x6a08('0x39')],{'$or':_[_0x6a08('0x3d')](_0xc3bc65,function(_0x8be9de){if(_0x8be9de['type']!==_0x6a08('0x3e')){var _0x5b9765={};_0x5b9765[_0x8be9de[_0x6a08('0x28')]]={'$like':'%'+_0x5d3550[_0x6a08('0x2e')][_0x6a08('0x3b')]+'%'};return _0x5b9765;}})});}_0x17a906=_[_0x6a08('0x3c')]({},_0x17a906,_0x5d3550['options']);var _0x340ee4={'where':_0x17a906['where']};return db[_0x6a08('0x3f')][_0x6a08('0x1d')](_0x340ee4)[_0x6a08('0x23')](function(_0x3fa553){_0x301cef[_0x6a08('0x1d')]=_0x3fa553;if(_0x5d3550['query']['includeAll']){_0x17a906['include']=[{'all':!![]}];}return db['Template']['findAll'](_0x17a906);})[_0x6a08('0x23')](function(_0x3637d2){_0x301cef[_0x6a08('0x40')]=_0x3637d2;return _0x301cef;})[_0x6a08('0x23')](respondWithFilteredResult(_0xa670ad,_0x17a906))[_0x6a08('0x41')](handleError(_0xa670ad,null));};exports[_0x6a08('0x42')]=function(_0x139824,_0x3e0452){var _0x59e979={'raw':!![],'where':{'id':_0x139824[_0x6a08('0x43')]['id']}},_0x50d417={};_0x50d417[_0x6a08('0x2d')]=_[_0x6a08('0x2f')](db[_0x6a08('0x3f')]['rawAttributes']);_0x50d417[_0x6a08('0x2e')]=_[_0x6a08('0x2f')](_0x139824[_0x6a08('0x2e')]);_0x50d417[_0x6a08('0x30')]=_[_0x6a08('0x31')](_0x50d417[_0x6a08('0x2d')],_0x50d417[_0x6a08('0x2e')]);_0x59e979['attributes']=_[_0x6a08('0x31')](_0x50d417[_0x6a08('0x2d')],qs[_0x6a08('0x33')](_0x139824['query'][_0x6a08('0x33')]));_0x59e979[_0x6a08('0x32')]=_0x59e979[_0x6a08('0x32')][_0x6a08('0x34')]?_0x59e979[_0x6a08('0x32')]:_0x50d417['model'];if(_0x139824[_0x6a08('0x2e')][_0x6a08('0x44')]){_0x59e979[_0x6a08('0x45')]=[{'all':!![]}];}_0x59e979=_[_0x6a08('0x3c')]({},_0x59e979,_0x139824[_0x6a08('0x46')]);return db[_0x6a08('0x3f')][_0x6a08('0x47')](_0x59e979)[_0x6a08('0x23')](handleEntityNotFound(_0x3e0452,null))[_0x6a08('0x23')](respondWithResult(_0x3e0452,null))[_0x6a08('0x41')](handleError(_0x3e0452,null));};exports[_0x6a08('0x48')]=function(_0x521fc7,_0x3e9665){return db[_0x6a08('0x3f')][_0x6a08('0x48')](_0x521fc7[_0x6a08('0x49')],{})['then'](function(_0x24acc6){var _0x711879=_0x521fc7['user']['get']({'plain':!![]});if(!_0x711879)throw new Error(_0x6a08('0x4a'));if(_0x711879['role']===_0x6a08('0x4b')){var _0x237f2b=_0x24acc6[_0x6a08('0x25')]({'plain':!![]});var _0x3885c0=_0x6a08('0x26');return db[_0x6a08('0x4c')][_0x6a08('0x47')]({'where':{'name':_0x3885c0,'userProfileId':_0x711879[_0x6a08('0x4d')]},'raw':!![]})[_0x6a08('0x23')](function(_0x421ff9){if(_0x421ff9&&_0x421ff9['autoAssociation']===0x0){return db[_0x6a08('0x4e')][_0x6a08('0x48')]({'name':_0x237f2b[_0x6a08('0x28')],'resourceId':_0x237f2b['id'],'type':_0x421ff9['name'],'sectionId':_0x421ff9['id']},{})[_0x6a08('0x23')](function(){return _0x24acc6;});}else{return _0x24acc6;}})[_0x6a08('0x41')](function(_0x42b85e){logger[_0x6a08('0x27')](_0x6a08('0x4f'),_0x42b85e);throw _0x42b85e;});}return _0x24acc6;})['then'](respondWithResult(_0x3e9665,0xc9))[_0x6a08('0x41')](handleError(_0x3e9665,null));};exports['update']=function(_0xf7a74e,_0x51ccb1){if(_0xf7a74e[_0x6a08('0x49')]['id']){delete _0xf7a74e[_0x6a08('0x49')]['id'];}return db[_0x6a08('0x3f')][_0x6a08('0x47')]({'where':{'id':_0xf7a74e['params']['id']}})[_0x6a08('0x23')](handleEntityNotFound(_0x51ccb1,null))[_0x6a08('0x23')](saveUpdates(_0xf7a74e['body'],null))[_0x6a08('0x23')](respondWithResult(_0x51ccb1,null))['catch'](handleError(_0x51ccb1,null));};exports['destroy']=function(_0x23ae7b,_0xcacd8a){return db[_0x6a08('0x3f')][_0x6a08('0x47')]({'where':{'id':_0x23ae7b[_0x6a08('0x43')]['id']}})['then'](handleEntityNotFound(_0xcacd8a,null))[_0x6a08('0x23')](removeEntity(_0xcacd8a,null))[_0x6a08('0x41')](handleError(_0xcacd8a,null));}; \ No newline at end of file +var _0x5c8c=['intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','get','UserProfileResource','stack','name','send','Template','rawAttributes','fieldName','type','model','map','query','filters'];(function(_0x36665f,_0x4f9488){var _0x481d25=function(_0x3779cc){while(--_0x3779cc){_0x36665f['push'](_0x36665f['shift']());}};_0x481d25(++_0x4f9488);}(_0x5c8c,0x1a5));var _0xc5c8=function(_0x2b905c,_0x33feb2){_0x2b905c=_0x2b905c-0x0;var _0x3b731f=_0x5c8c[_0x2b905c];return _0x3b731f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc5c8('0x0'));var zipdir=require(_0xc5c8('0x1'));var jsonpatch=require(_0xc5c8('0x2'));var rp=require(_0xc5c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc5c8('0x4'));var csv=require(_0xc5c8('0x5'));var ejs=require(_0xc5c8('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc5c8('0x7'));var squel=require(_0xc5c8('0x8'));var crypto=require(_0xc5c8('0x9'));var jsforce=require(_0xc5c8('0xa'));var deskjs=require(_0xc5c8('0xb'));var toCsv=require(_0xc5c8('0x5'));var querystring=require(_0xc5c8('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc5c8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc5c8('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5c8('0xf'))(_0xc5c8('0x10'));var utils=require('../../config/utils');var config=require(_0xc5c8('0x11'));var licenseUtil=require(_0xc5c8('0x12'));var db=require(_0xc5c8('0x13'))['db'];function respondWithStatusCode(_0x4fa821,_0x3d28ba){_0x3d28ba=_0x3d28ba||0xcc;return function(_0x4195b1){if(_0x4195b1){return _0x4fa821[_0xc5c8('0x14')](_0x3d28ba);}return _0x4fa821['status'](_0x3d28ba)[_0xc5c8('0x15')]();};}function respondWithResult(_0x1ae3bb,_0x4f14c3){_0x4f14c3=_0x4f14c3||0xc8;return function(_0x3ea09a){if(_0x3ea09a){return _0x1ae3bb[_0xc5c8('0x16')](_0x4f14c3)[_0xc5c8('0x17')](_0x3ea09a);}};}function respondWithFilteredResult(_0x1ee998,_0x3076d4){return function(_0x3ce70d){if(_0x3ce70d){var _0x4f7070=typeof _0x3076d4[_0xc5c8('0x18')]===_0xc5c8('0x19')&&typeof _0x3076d4['limit']===_0xc5c8('0x19');var _0x20d2b5=_0x3ce70d[_0xc5c8('0x1a')];var _0x13a836=_0x4f7070?0x0:_0x3076d4['offset'];var _0x40e982=_0x4f7070?_0x3ce70d[_0xc5c8('0x1a')]:_0x3076d4[_0xc5c8('0x18')]+_0x3076d4[_0xc5c8('0x1b')];var _0x54cdf5;if(_0x40e982>=_0x20d2b5){_0x40e982=_0x20d2b5;_0x54cdf5=0xc8;}else{_0x54cdf5=0xce;}_0x1ee998[_0xc5c8('0x16')](_0x54cdf5);return _0x1ee998[_0xc5c8('0x1c')](_0xc5c8('0x1d'),_0x13a836+'-'+_0x40e982+'/'+_0x20d2b5)[_0xc5c8('0x17')](_0x3ce70d);}return null;};}function patchUpdates(_0x202e08){return function(_0x3e2821){try{jsonpatch[_0xc5c8('0x1e')](_0x3e2821,_0x202e08,!![]);}catch(_0x582440){return BPromise['reject'](_0x582440);}return _0x3e2821['save']();};}function saveUpdates(_0x2199f1,_0x2a1ac7){return function(_0x1cac45){if(_0x1cac45){return _0x1cac45[_0xc5c8('0x1f')](_0x2199f1)['then'](function(_0x4cae7d){return _0x4cae7d;});}return null;};}function removeEntity(_0x235a06,_0x206653){return function(_0x32727d){if(_0x32727d){return _0x32727d[_0xc5c8('0x20')]()[_0xc5c8('0x21')](function(){var _0x3a6f95=_0x32727d[_0xc5c8('0x22')]({'plain':!![]});var _0x54aae3='Templates';return db[_0xc5c8('0x23')][_0xc5c8('0x20')]({'where':{'type':_0x54aae3,'resourceId':_0x3a6f95['id']}})[_0xc5c8('0x21')](function(){return _0x32727d;});})['then'](function(){_0x235a06['status'](0xcc)[_0xc5c8('0x15')]();});}};}function handleEntityNotFound(_0x550c6d,_0x239da1){return function(_0x395edf){if(!_0x395edf){_0x550c6d[_0xc5c8('0x14')](0x194);}return _0x395edf;};}function handleError(_0x83e07f,_0x482eb7){_0x482eb7=_0x482eb7||0x1f4;return function(_0x523df0){logger['error'](_0x523df0[_0xc5c8('0x24')]);if(_0x523df0[_0xc5c8('0x25')]){delete _0x523df0[_0xc5c8('0x25')];}_0x83e07f[_0xc5c8('0x16')](_0x482eb7)[_0xc5c8('0x26')](_0x523df0);};}exports['index']=function(_0x34445d,_0x30eed9){var _0x1706c5={},_0x5c5d12={},_0x9fec72={'count':0x0,'rows':[]};var _0x54b0f7=_['map'](db[_0xc5c8('0x27')][_0xc5c8('0x28')],function(_0x4afd81){return{'name':_0x4afd81[_0xc5c8('0x29')],'type':_0x4afd81[_0xc5c8('0x2a')]['key']};});_0x5c5d12[_0xc5c8('0x2b')]=_[_0xc5c8('0x2c')](_0x54b0f7,_0xc5c8('0x25'));_0x5c5d12[_0xc5c8('0x2d')]=_['keys'](_0x34445d[_0xc5c8('0x2d')]);_0x5c5d12[_0xc5c8('0x2e')]=_[_0xc5c8('0x2f')](_0x5c5d12[_0xc5c8('0x2b')],_0x5c5d12[_0xc5c8('0x2d')]);_0x1706c5['attributes']=_[_0xc5c8('0x2f')](_0x5c5d12[_0xc5c8('0x2b')],qs[_0xc5c8('0x30')](_0x34445d['query']['fields']));_0x1706c5[_0xc5c8('0x31')]=_0x1706c5[_0xc5c8('0x31')][_0xc5c8('0x32')]?_0x1706c5[_0xc5c8('0x31')]:_0x5c5d12['model'];if(!_0x34445d[_0xc5c8('0x2d')][_0xc5c8('0x33')]('nolimit')){_0x1706c5[_0xc5c8('0x1b')]=qs[_0xc5c8('0x1b')](_0x34445d['query'][_0xc5c8('0x1b')]);_0x1706c5[_0xc5c8('0x18')]=qs[_0xc5c8('0x18')](_0x34445d['query'][_0xc5c8('0x18')]);}_0x1706c5['order']=qs[_0xc5c8('0x34')](_0x34445d[_0xc5c8('0x2d')][_0xc5c8('0x34')]);_0x1706c5[_0xc5c8('0x35')]=qs[_0xc5c8('0x2e')](_[_0xc5c8('0x36')](_0x34445d[_0xc5c8('0x2d')],_0x5c5d12[_0xc5c8('0x2e')]),_0x54b0f7);if(_0x34445d['query']['filter']){_0x1706c5[_0xc5c8('0x35')]=_[_0xc5c8('0x37')](_0x1706c5['where'],{'$or':_[_0xc5c8('0x2c')](_0x54b0f7,function(_0x482ba6){if(_0x482ba6['type']!==_0xc5c8('0x38')){var _0x1090b6={};_0x1090b6[_0x482ba6[_0xc5c8('0x25')]]={'$like':'%'+_0x34445d[_0xc5c8('0x2d')][_0xc5c8('0x39')]+'%'};return _0x1090b6;}})});}_0x1706c5=_[_0xc5c8('0x37')]({},_0x1706c5,_0x34445d['options']);var _0x58e4c9={'where':_0x1706c5[_0xc5c8('0x35')]};return db[_0xc5c8('0x27')]['count'](_0x58e4c9)[_0xc5c8('0x21')](function(_0x10e688){_0x9fec72[_0xc5c8('0x1a')]=_0x10e688;if(_0x34445d[_0xc5c8('0x2d')]['includeAll']){_0x1706c5[_0xc5c8('0x3a')]=[{'all':!![]}];}return db['Template'][_0xc5c8('0x3b')](_0x1706c5);})[_0xc5c8('0x21')](function(_0xf206fd){_0x9fec72[_0xc5c8('0x3c')]=_0xf206fd;return _0x9fec72;})[_0xc5c8('0x21')](respondWithFilteredResult(_0x30eed9,_0x1706c5))[_0xc5c8('0x3d')](handleError(_0x30eed9,null));};exports[_0xc5c8('0x3e')]=function(_0x91aa35,_0xa7d1ec){var _0x426201={'raw':!![],'where':{'id':_0x91aa35[_0xc5c8('0x3f')]['id']}},_0xd24ef3={};_0xd24ef3[_0xc5c8('0x2b')]=_[_0xc5c8('0x40')](db[_0xc5c8('0x27')][_0xc5c8('0x28')]);_0xd24ef3['query']=_[_0xc5c8('0x40')](_0x91aa35['query']);_0xd24ef3[_0xc5c8('0x2e')]=_['intersection'](_0xd24ef3[_0xc5c8('0x2b')],_0xd24ef3[_0xc5c8('0x2d')]);_0x426201[_0xc5c8('0x31')]=_['intersection'](_0xd24ef3[_0xc5c8('0x2b')],qs[_0xc5c8('0x30')](_0x91aa35[_0xc5c8('0x2d')]['fields']));_0x426201[_0xc5c8('0x31')]=_0x426201[_0xc5c8('0x31')][_0xc5c8('0x32')]?_0x426201[_0xc5c8('0x31')]:_0xd24ef3['model'];if(_0x91aa35[_0xc5c8('0x2d')][_0xc5c8('0x41')]){_0x426201[_0xc5c8('0x3a')]=[{'all':!![]}];}_0x426201=_['merge']({},_0x426201,_0x91aa35[_0xc5c8('0x42')]);return db[_0xc5c8('0x27')][_0xc5c8('0x43')](_0x426201)[_0xc5c8('0x21')](handleEntityNotFound(_0xa7d1ec,null))[_0xc5c8('0x21')](respondWithResult(_0xa7d1ec,null))[_0xc5c8('0x3d')](handleError(_0xa7d1ec,null));};exports[_0xc5c8('0x44')]=function(_0x25d827,_0xb4b691){return db['Template'][_0xc5c8('0x44')](_0x25d827['body'],{})[_0xc5c8('0x21')](function(_0x2bc8da){var _0x42c6f2=_0x25d827[_0xc5c8('0x45')][_0xc5c8('0x22')]({'plain':!![]});if(!_0x42c6f2)throw new Error(_0xc5c8('0x46'));if(_0x42c6f2[_0xc5c8('0x47')]===_0xc5c8('0x45')){var _0x1a0e48=_0x2bc8da[_0xc5c8('0x22')]({'plain':!![]});var _0xfff17a=_0xc5c8('0x48');return db['UserProfileSection'][_0xc5c8('0x43')]({'where':{'name':_0xfff17a,'userProfileId':_0x42c6f2[_0xc5c8('0x49')]},'raw':!![]})['then'](function(_0x791565){if(_0x791565&&_0x791565[_0xc5c8('0x4a')]===0x0){return db[_0xc5c8('0x23')][_0xc5c8('0x44')]({'name':_0x1a0e48[_0xc5c8('0x25')],'resourceId':_0x1a0e48['id'],'type':_0x791565[_0xc5c8('0x25')],'sectionId':_0x791565['id']},{})[_0xc5c8('0x21')](function(){return _0x2bc8da;});}else{return _0x2bc8da;}})[_0xc5c8('0x3d')](function(_0x53eab8){logger[_0xc5c8('0x4b')](_0xc5c8('0x4c'),_0x53eab8);throw _0x53eab8;});}return _0x2bc8da;})[_0xc5c8('0x21')](respondWithResult(_0xb4b691,0xc9))[_0xc5c8('0x3d')](handleError(_0xb4b691,null));};exports[_0xc5c8('0x1f')]=function(_0x75a665,_0x141c14){if(_0x75a665[_0xc5c8('0x4d')]['id']){delete _0x75a665[_0xc5c8('0x4d')]['id'];}return db[_0xc5c8('0x27')][_0xc5c8('0x43')]({'where':{'id':_0x75a665[_0xc5c8('0x3f')]['id']}})[_0xc5c8('0x21')](handleEntityNotFound(_0x141c14,null))[_0xc5c8('0x21')](saveUpdates(_0x75a665[_0xc5c8('0x4d')],null))['then'](respondWithResult(_0x141c14,null))[_0xc5c8('0x3d')](handleError(_0x141c14,null));};exports['destroy']=function(_0x5c5e52,_0x19f613){return db[_0xc5c8('0x27')][_0xc5c8('0x43')]({'where':{'id':_0x5c5e52['params']['id']}})['then'](handleEntityNotFound(_0x19f613,null))['then'](removeEntity(_0x19f613,null))['catch'](handleError(_0x19f613,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 267067f..668771f 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 _0x96e0=['request-promise','../../config/environment','./template.attributes','exports','Template','lodash','util','../../config/logger','api','moment'];(function(_0x511d41,_0x14b3ca){var _0x1030e3=function(_0x4e38d2){while(--_0x4e38d2){_0x511d41['push'](_0x511d41['shift']());}};_0x1030e3(++_0x14b3ca);}(_0x96e0,0x14f));var _0x096e=function(_0x44c9a0,_0x898781){_0x44c9a0=_0x44c9a0-0x0;var _0x76fb85=_0x96e0[_0x44c9a0];return _0x76fb85;};'use strict';var _=require(_0x096e('0x0'));var util=require(_0x096e('0x1'));var logger=require(_0x096e('0x2'))(_0x096e('0x3'));var moment=require(_0x096e('0x4'));var BPromise=require('bluebird');var rp=require(_0x096e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x096e('0x6'));var attributes=require(_0x096e('0x7'));module[_0x096e('0x8')]=function(_0x19b700,_0x18a39d){return _0x19b700['define'](_0x096e('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83b3=['../../config/environment','define','Template','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x137b0f,_0x48c6bb){var _0x1e413d=function(_0x30e3cf){while(--_0x30e3cf){_0x137b0f['push'](_0x137b0f['shift']());}};_0x1e413d(++_0x48c6bb);}(_0x83b3,0x7b));var _0x383b=function(_0x40f1cd,_0x3b0ee6){_0x40f1cd=_0x40f1cd-0x0;var _0x298f43=_0x83b3[_0x40f1cd];return _0x298f43;};'use strict';var _=require(_0x383b('0x0'));var util=require(_0x383b('0x1'));var logger=require('../../config/logger')(_0x383b('0x2'));var moment=require(_0x383b('0x3'));var BPromise=require(_0x383b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x383b('0x5'));var rimraf=require(_0x383b('0x6'));var config=require(_0x383b('0x7'));var attributes=require('./template.attributes');module['exports']=function(_0x14ce0e,_0x2078b8){return _0x14ce0e[_0x383b('0x8')](_0x383b('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index dd3a915..d1e3fd7 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 _0xd751=['then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetTemplate','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xd751,0x79));var _0x1d75=function(_0x34ce72,_0x19ce31){_0x34ce72=_0x34ce72-0x0;var _0x4a3fe8=_0xd751[_0x34ce72];return _0x4a3fe8;};'use strict';var _=require(_0x1d75('0x0'));var util=require('util');var moment=require(_0x1d75('0x1'));var BPromise=require(_0x1d75('0x2'));var rs=require(_0x1d75('0x3'));var fs=require('fs');var Redis=require(_0x1d75('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d75('0x5'));var logger=require('../../config/logger')(_0x1d75('0x6'));var config=require(_0x1d75('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1d75('0x8')][_0x1d75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9b25e7,_0x4af55c,_0x4ed67e){return new BPromise(function(_0x41de5e,_0x4a5df9){return client[_0x1d75('0xa')](_0x9b25e7,_0x4ed67e)[_0x1d75('0xb')](function(_0x201ff6){logger[_0x1d75('0xc')](_0x1d75('0xd'),_0x4af55c,_0x1d75('0xe'));logger[_0x1d75('0xf')](_0x1d75('0x10'),_0x4af55c,_0x1d75('0xe'),JSON[_0x1d75('0x11')](_0x201ff6));if(_0x201ff6[_0x1d75('0x12')]){if(_0x201ff6[_0x1d75('0x12')][_0x1d75('0x13')]===0x1f4){logger[_0x1d75('0x12')](_0x1d75('0xd'),_0x4af55c,_0x201ff6[_0x1d75('0x12')]['message']);return _0x4a5df9(_0x201ff6[_0x1d75('0x12')][_0x1d75('0x14')]);}logger[_0x1d75('0x12')](_0x1d75('0xd'),_0x4af55c,_0x201ff6[_0x1d75('0x12')][_0x1d75('0x14')]);return _0x41de5e(_0x201ff6[_0x1d75('0x12')]['message']);}else{logger[_0x1d75('0xc')](_0x1d75('0xd'),_0x4af55c,_0x1d75('0xe'));_0x41de5e(_0x201ff6[_0x1d75('0x15')][_0x1d75('0x14')]);}})[_0x1d75('0x16')](function(_0x4be130){logger['error']('Template,\x20%s,\x20%s',_0x4af55c,_0x4be130);_0x4a5df9(_0x4be130);});});}exports['GetTemplate']=function(_0x5e8d0e){var _0x4e9f1a=this;return new Promise(function(_0x327b7b,_0x3b9db5){return db['Template'][_0x1d75('0x17')]({'raw':_0x5e8d0e[_0x1d75('0x18')]?_0x5e8d0e[_0x1d75('0x18')][_0x1d75('0x19')]===undefined?!![]:![]:!![],'where':_0x5e8d0e[_0x1d75('0x18')]?_0x5e8d0e[_0x1d75('0x18')][_0x1d75('0x1a')]||null:null,'attributes':_0x5e8d0e[_0x1d75('0x18')]?_0x5e8d0e['options'][_0x1d75('0x1b')]||null:null,'limit':_0x5e8d0e[_0x1d75('0x18')]?_0x5e8d0e['options'][_0x1d75('0x1c')]||null:null,'include':_0x5e8d0e[_0x1d75('0x18')]?_0x5e8d0e[_0x1d75('0x18')][_0x1d75('0x1d')]?_[_0x1d75('0x1e')](_0x5e8d0e[_0x1d75('0x18')][_0x1d75('0x1d')],function(_0x35c2b8){return{'model':db[_0x35c2b8[_0x1d75('0x1f')]],'as':_0x35c2b8['as'],'attributes':_0x35c2b8[_0x1d75('0x1b')],'include':_0x35c2b8[_0x1d75('0x1d')]?_[_0x1d75('0x1e')](_0x35c2b8[_0x1d75('0x1d')],function(_0x28bde2){return{'model':db[_0x28bde2['model']],'as':_0x28bde2['as'],'attributes':_0x28bde2[_0x1d75('0x1b')],'include':_0x28bde2[_0x1d75('0x1d')]?_[_0x1d75('0x1e')](_0x28bde2['include'],function(_0x1a1ee6){return{'model':db[_0x1a1ee6[_0x1d75('0x1f')]],'as':_0x1a1ee6['as'],'attributes':_0x1a1ee6['attributes']};}):[]};}):[]};}):[]:[]})[_0x1d75('0xb')](function(_0x594d46){logger[_0x1d75('0xc')](_0x1d75('0x20'),_0x5e8d0e);logger[_0x1d75('0xf')](_0x1d75('0x20'),_0x5e8d0e,JSON['stringify'](_0x594d46));_0x327b7b(_0x594d46);})[_0x1d75('0x16')](function(_0xb49e5){logger[_0x1d75('0x12')](_0x1d75('0x20'),_0xb49e5[_0x1d75('0x14')],_0x5e8d0e);_0x3b9db5(_0x4e9f1a['error'](0x1f4,_0xb49e5['message']));});});}; \ No newline at end of file +var _0xae9e=['message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','model','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s'];(function(_0x200324,_0x4ffad3){var _0x4f27d7=function(_0x319665){while(--_0x319665){_0x200324['push'](_0x200324['shift']());}};_0x4f27d7(++_0x4ffad3);}(_0xae9e,0xbd));var _0xeae9=function(_0x475500,_0x2d9fa4){_0x475500=_0x475500-0x0;var _0x448dae=_0xae9e[_0x475500];return _0x448dae;};'use strict';var _=require('lodash');var util=require(_0xeae9('0x0'));var moment=require(_0xeae9('0x1'));var BPromise=require(_0xeae9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeae9('0x3'));var db=require(_0xeae9('0x4'))['db'];var utils=require(_0xeae9('0x5'));var logger=require(_0xeae9('0x6'))(_0xeae9('0x7'));var config=require(_0xeae9('0x8'));var jayson=require(_0xeae9('0x9'));var client=jayson[_0xeae9('0xa')][_0xeae9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bafe,_0x3b027d,_0x5afaf4){return new BPromise(function(_0x2e6ef0,_0x555d80){return client[_0xeae9('0xc')](_0x54bafe,_0x5afaf4)[_0xeae9('0xd')](function(_0x3b489d){logger[_0xeae9('0xe')]('Template,\x20%s,\x20%s',_0x3b027d,_0xeae9('0xf'));logger['debug'](_0xeae9('0x10'),_0x3b027d,_0xeae9('0xf'),JSON[_0xeae9('0x11')](_0x3b489d));if(_0x3b489d[_0xeae9('0x12')]){if(_0x3b489d['error'][_0xeae9('0x13')]===0x1f4){logger[_0xeae9('0x12')](_0xeae9('0x14'),_0x3b027d,_0x3b489d['error'][_0xeae9('0x15')]);return _0x555d80(_0x3b489d[_0xeae9('0x12')][_0xeae9('0x15')]);}logger[_0xeae9('0x12')](_0xeae9('0x14'),_0x3b027d,_0x3b489d[_0xeae9('0x12')][_0xeae9('0x15')]);return _0x2e6ef0(_0x3b489d[_0xeae9('0x12')][_0xeae9('0x15')]);}else{logger[_0xeae9('0xe')](_0xeae9('0x14'),_0x3b027d,_0xeae9('0xf'));_0x2e6ef0(_0x3b489d[_0xeae9('0x16')][_0xeae9('0x15')]);}})[_0xeae9('0x17')](function(_0x10caac){logger[_0xeae9('0x12')](_0xeae9('0x14'),_0x3b027d,_0x10caac);_0x555d80(_0x10caac);});});}exports[_0xeae9('0x18')]=function(_0x10b3db){var _0x419015=this;return new Promise(function(_0x2397ce,_0x56ac2d){return db[_0xeae9('0x19')][_0xeae9('0x1a')]({'raw':_0x10b3db[_0xeae9('0x1b')]?_0x10b3db[_0xeae9('0x1b')][_0xeae9('0x1c')]===undefined?!![]:![]:!![],'where':_0x10b3db['options']?_0x10b3db['options'][_0xeae9('0x1d')]||null:null,'attributes':_0x10b3db['options']?_0x10b3db['options'][_0xeae9('0x1e')]||null:null,'limit':_0x10b3db[_0xeae9('0x1b')]?_0x10b3db['options']['limit']||null:null,'include':_0x10b3db['options']?_0x10b3db[_0xeae9('0x1b')][_0xeae9('0x1f')]?_[_0xeae9('0x20')](_0x10b3db['options']['include'],function(_0x48205a){return{'model':db[_0x48205a[_0xeae9('0x21')]],'as':_0x48205a['as'],'attributes':_0x48205a[_0xeae9('0x1e')],'include':_0x48205a[_0xeae9('0x1f')]?_[_0xeae9('0x20')](_0x48205a[_0xeae9('0x1f')],function(_0x3a8a7d){return{'model':db[_0x3a8a7d[_0xeae9('0x21')]],'as':_0x3a8a7d['as'],'attributes':_0x3a8a7d[_0xeae9('0x1e')],'include':_0x3a8a7d[_0xeae9('0x1f')]?_[_0xeae9('0x20')](_0x3a8a7d[_0xeae9('0x1f')],function(_0x2ee6c8){return{'model':db[_0x2ee6c8[_0xeae9('0x21')]],'as':_0x2ee6c8['as'],'attributes':_0x2ee6c8[_0xeae9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xeae9('0xd')](function(_0x1c4267){logger[_0xeae9('0xe')](_0xeae9('0x18'),_0x10b3db);logger[_0xeae9('0x22')](_0xeae9('0x18'),_0x10b3db,JSON['stringify'](_0x1c4267));_0x2397ce(_0x1c4267);})[_0xeae9('0x17')](function(_0x1e32b1){logger[_0xeae9('0x12')](_0xeae9('0x18'),_0x1e32b1[_0xeae9('0x15')],_0x10b3db);_0x56ac2d(_0x419015[_0xeae9('0x12')](0x1f4,_0x1e32b1[_0xeae9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index f19299e..bbcb32d 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 _0x7fff=['index','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','isAuthenticated','getActions','post','addAllCondition','addAnyCondition','/:id/actions','addAction','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get'];(function(_0x560466,_0x38714a){var _0x1b3eb7=function(_0x2fb05f){while(--_0x2fb05f){_0x560466['push'](_0x560466['shift']());}};_0x1b3eb7(++_0x38714a);}(_0x7fff,0x1a6));var _0xf7ff=function(_0x594bbe,_0x2afb6e){_0x594bbe=_0x594bbe-0x0;var _0x6b1b1a=_0x7fff[_0x594bbe];return _0x6b1b1a;};'use strict';var multer=require(_0xf7ff('0x0'));var util=require(_0xf7ff('0x1'));var path=require('path');var timeout=require(_0xf7ff('0x2'));var express=require(_0xf7ff('0x3'));var router=express[_0xf7ff('0x4')]();var fs_extra=require(_0xf7ff('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf7ff('0x6'));var config=require(_0xf7ff('0x7'));var controller=require(_0xf7ff('0x8'));router[_0xf7ff('0x9')]('/',auth['isAuthenticated'](),controller[_0xf7ff('0xa')]);router[_0xf7ff('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf7ff('0xb')]);router[_0xf7ff('0x9')](_0xf7ff('0xc'),auth['isAuthenticated'](),controller[_0xf7ff('0xd')]);router[_0xf7ff('0x9')](_0xf7ff('0xe'),auth[_0xf7ff('0xf')](),controller['getAnyConditions']);router[_0xf7ff('0x9')]('/:id/actions',auth[_0xf7ff('0xf')](),controller[_0xf7ff('0x10')]);router[_0xf7ff('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf7ff('0x11')](_0xf7ff('0xc'),auth[_0xf7ff('0xf')](),controller[_0xf7ff('0x12')]);router['post']('/:id/any_conditions',auth[_0xf7ff('0xf')](),controller[_0xf7ff('0x13')]);router[_0xf7ff('0x11')](_0xf7ff('0x14'),auth['isAuthenticated'](),controller[_0xf7ff('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf7ff('0x16')]);router[_0xf7ff('0x17')](_0xf7ff('0x18'),auth['isAuthenticated'](),controller[_0xf7ff('0x19')]);module[_0xf7ff('0x1a')]=router; \ No newline at end of file +var _0xe85c=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','exports','multer'];(function(_0x1eaf62,_0x38436f){var _0x2ac9a8=function(_0x288743){while(--_0x288743){_0x1eaf62['push'](_0x1eaf62['shift']());}};_0x2ac9a8(++_0x38436f);}(_0xe85c,0x117));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xce85('0x0'));var util=require(_0xce85('0x1'));var path=require(_0xce85('0x2'));var timeout=require(_0xce85('0x3'));var express=require(_0xce85('0x4'));var router=express[_0xce85('0x5')]();var fs_extra=require(_0xce85('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xce85('0x7'));var config=require('../../config/environment');var controller=require(_0xce85('0x8'));router[_0xce85('0x9')]('/',auth[_0xce85('0xa')](),controller[_0xce85('0xb')]);router[_0xce85('0x9')]('/:id',auth[_0xce85('0xa')](),controller[_0xce85('0xc')]);router[_0xce85('0x9')](_0xce85('0xd'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0xce85('0x9')](_0xce85('0xe'),auth[_0xce85('0xa')](),controller['getAnyConditions']);router[_0xce85('0x9')](_0xce85('0xf'),auth[_0xce85('0xa')](),controller[_0xce85('0x10')]);router[_0xce85('0x11')]('/',auth[_0xce85('0xa')](),controller[_0xce85('0x12')]);router[_0xce85('0x11')]('/:id/all_conditions',auth[_0xce85('0xa')](),controller[_0xce85('0x13')]);router[_0xce85('0x11')]('/:id/any_conditions',auth[_0xce85('0xa')](),controller[_0xce85('0x14')]);router['post'](_0xce85('0xf'),auth[_0xce85('0xa')](),controller[_0xce85('0x15')]);router[_0xce85('0x16')](_0xce85('0x17'),auth[_0xce85('0xa')](),controller[_0xce85('0x18')]);router[_0xce85('0x19')](_0xce85('0x17'),auth['isAuthenticated'](),controller[_0xce85('0x1a')]);module[_0xce85('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index fbe8912..d160363 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 _0xaf32=['exports','STRING','BOOLEAN','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xaf32,0x14b));var _0x2af3=function(_0x42cc1f,_0xe9eb20){_0x42cc1f=_0x42cc1f-0x0;var _0x175df5=_0xaf32[_0x42cc1f];return _0x175df5;};'use strict';var Sequelize=require(_0x2af3('0x0'));module[_0x2af3('0x1')]={'name':{'type':Sequelize[_0x2af3('0x2')]},'channel':{'type':Sequelize[_0x2af3('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x2af3('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1d72=['sequelize','exports','STRING','BOOLEAN'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x1d72,0x1cc));var _0x21d7=function(_0xa18bfa,_0x2ea80c){_0xa18bfa=_0xa18bfa-0x0;var _0x46abc9=_0x1d72[_0xa18bfa];return _0x46abc9;};'use strict';var Sequelize=require(_0x21d7('0x0'));module[_0x21d7('0x1')]={'name':{'type':Sequelize[_0x21d7('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x21d7('0x2')]},'status':{'type':Sequelize[_0x21d7('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index b339415..6410f17 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 _0x120a=['order','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','get','Triggers','UserProfileResource','error','name','send','map','Trigger','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','type','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x120a,0x192));var _0xa120=function(_0x338990,_0x4755d9){_0x338990=_0x338990-0x0;var _0x14f156=_0x120a[_0x338990];return _0x14f156;};'use strict';var emlformat=require(_0xa120('0x0'));var rimraf=require(_0xa120('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa120('0x2'));var rp=require(_0xa120('0x3'));var moment=require(_0xa120('0x4'));var BPromise=require(_0xa120('0x5'));var Mustache=require(_0xa120('0x6'));var util=require(_0xa120('0x7'));var path=require(_0xa120('0x8'));var sox=require(_0xa120('0x9'));var csv=require(_0xa120('0xa'));var ejs=require(_0xa120('0xb'));var fs=require('fs');var fs_extra=require(_0xa120('0xc'));var _=require(_0xa120('0xd'));var squel=require(_0xa120('0xe'));var crypto=require(_0xa120('0xf'));var jsforce=require(_0xa120('0x10'));var deskjs=require(_0xa120('0x11'));var toCsv=require(_0xa120('0xa'));var querystring=require(_0xa120('0x12'));var Papa=require(_0xa120('0x13'));var Redis=require(_0xa120('0x14'));var authService=require(_0xa120('0x15'));var qs=require(_0xa120('0x16'));var as=require(_0xa120('0x17'));var hardwareService=require(_0xa120('0x18'));var logger=require(_0xa120('0x19'))(_0xa120('0x1a'));var utils=require(_0xa120('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0xa120('0x1c'));var db=require(_0xa120('0x1d'))['db'];function respondWithStatusCode(_0x1e6dfd,_0x4780f6){_0x4780f6=_0x4780f6||0xcc;return function(_0x11cc26){if(_0x11cc26){return _0x1e6dfd[_0xa120('0x1e')](_0x4780f6);}return _0x1e6dfd['status'](_0x4780f6)[_0xa120('0x1f')]();};}function respondWithResult(_0x477e4d,_0x4f501d){_0x4f501d=_0x4f501d||0xc8;return function(_0x5e3930){if(_0x5e3930){return _0x477e4d[_0xa120('0x20')](_0x4f501d)[_0xa120('0x21')](_0x5e3930);}};}function respondWithFilteredResult(_0x347159,_0x54a5a6){return function(_0x556776){if(_0x556776){var _0x1ee4f8=typeof _0x54a5a6['offset']===_0xa120('0x22')&&typeof _0x54a5a6[_0xa120('0x23')]===_0xa120('0x22');var _0x20a3ea=_0x556776['count'];var _0x1171cc=_0x1ee4f8?0x0:_0x54a5a6[_0xa120('0x24')];var _0x46c059=_0x1ee4f8?_0x556776[_0xa120('0x25')]:_0x54a5a6[_0xa120('0x24')]+_0x54a5a6[_0xa120('0x23')];var _0x3de35a;if(_0x46c059>=_0x20a3ea){_0x46c059=_0x20a3ea;_0x3de35a=0xc8;}else{_0x3de35a=0xce;}_0x347159[_0xa120('0x20')](_0x3de35a);return _0x347159[_0xa120('0x26')](_0xa120('0x27'),_0x1171cc+'-'+_0x46c059+'/'+_0x20a3ea)[_0xa120('0x21')](_0x556776);}return null;};}function patchUpdates(_0x22f800){return function(_0x5e803f){try{jsonpatch[_0xa120('0x28')](_0x5e803f,_0x22f800,!![]);}catch(_0x40536b){return BPromise['reject'](_0x40536b);}return _0x5e803f[_0xa120('0x29')]();};}function saveUpdates(_0x430c09,_0x4bc737){return function(_0x4ab06c){if(_0x4ab06c){return _0x4ab06c[_0xa120('0x2a')](_0x430c09)[_0xa120('0x2b')](function(_0x3ffae3){return _0x3ffae3;});}return null;};}function removeEntity(_0x35009b,_0x21664f){return function(_0x7a257c){if(_0x7a257c){return _0x7a257c[_0xa120('0x2c')]()[_0xa120('0x2b')](function(){var _0x409aec=_0x7a257c[_0xa120('0x2d')]({'plain':!![]});var _0x1f316a=_0xa120('0x2e');return db[_0xa120('0x2f')]['destroy']({'where':{'type':_0x1f316a,'resourceId':_0x409aec['id']}})[_0xa120('0x2b')](function(){return _0x7a257c;});})['then'](function(){_0x35009b[_0xa120('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x296246,_0x5e4148){return function(_0x1dde1a){if(!_0x1dde1a){_0x296246[_0xa120('0x1e')](0x194);}return _0x1dde1a;};}function handleError(_0x32b9bb,_0x569481){_0x569481=_0x569481||0x1f4;return function(_0x35d842){logger[_0xa120('0x30')](_0x35d842['stack']);if(_0x35d842[_0xa120('0x31')]){delete _0x35d842[_0xa120('0x31')];}_0x32b9bb[_0xa120('0x20')](_0x569481)[_0xa120('0x32')](_0x35d842);};}exports['index']=function(_0x5d2440,_0x13efc0){var _0x321276={},_0x3e5bc7={},_0x1a09b8={'count':0x0,'rows':[]};var _0x34da68=_[_0xa120('0x33')](db[_0xa120('0x34')][_0xa120('0x35')],function(_0x455f1b){return{'name':_0x455f1b[_0xa120('0x36')],'type':_0x455f1b['type'][_0xa120('0x37')]};});_0x3e5bc7[_0xa120('0x38')]=_[_0xa120('0x33')](_0x34da68,_0xa120('0x31'));_0x3e5bc7[_0xa120('0x39')]=_[_0xa120('0x3a')](_0x5d2440[_0xa120('0x39')]);_0x3e5bc7['filters']=_[_0xa120('0x3b')](_0x3e5bc7[_0xa120('0x38')],_0x3e5bc7[_0xa120('0x39')]);_0x321276[_0xa120('0x3c')]=_['intersection'](_0x3e5bc7[_0xa120('0x38')],qs['fields'](_0x5d2440[_0xa120('0x39')][_0xa120('0x3d')]));_0x321276[_0xa120('0x3c')]=_0x321276[_0xa120('0x3c')][_0xa120('0x3e')]?_0x321276[_0xa120('0x3c')]:_0x3e5bc7[_0xa120('0x38')];if(!_0x5d2440[_0xa120('0x39')][_0xa120('0x3f')](_0xa120('0x40'))){_0x321276[_0xa120('0x23')]=qs[_0xa120('0x23')](_0x5d2440['query'][_0xa120('0x23')]);_0x321276[_0xa120('0x24')]=qs['offset'](_0x5d2440[_0xa120('0x39')][_0xa120('0x24')]);}_0x321276['order']=qs[_0xa120('0x41')](_0x5d2440[_0xa120('0x39')][_0xa120('0x41')]);_0x321276['where']=qs[_0xa120('0x42')](_[_0xa120('0x43')](_0x5d2440[_0xa120('0x39')],_0x3e5bc7[_0xa120('0x42')]),_0x34da68);if(_0x5d2440[_0xa120('0x39')]['filter']){_0x321276[_0xa120('0x44')]=_['merge'](_0x321276[_0xa120('0x44')],{'$or':_[_0xa120('0x33')](_0x34da68,function(_0xc53e3d){if(_0xc53e3d[_0xa120('0x45')]!=='VIRTUAL'){var _0x34baf4={};_0x34baf4[_0xc53e3d[_0xa120('0x31')]]={'$like':'%'+_0x5d2440[_0xa120('0x39')][_0xa120('0x46')]+'%'};return _0x34baf4;}})});}_0x321276=_[_0xa120('0x47')]({},_0x321276,_0x5d2440[_0xa120('0x48')]);var _0x46029a={'where':_0x321276[_0xa120('0x44')]};return db[_0xa120('0x34')]['count'](_0x46029a)[_0xa120('0x2b')](function(_0x2c3bf0){_0x1a09b8[_0xa120('0x25')]=_0x2c3bf0;if(_0x5d2440['query'][_0xa120('0x49')]){_0x321276['include']=[{'all':!![]}];}return db[_0xa120('0x34')][_0xa120('0x4a')](_0x321276);})['then'](function(_0x38ecbc){_0x1a09b8[_0xa120('0x4b')]=_0x38ecbc;return _0x1a09b8;})['then'](respondWithFilteredResult(_0x13efc0,_0x321276))[_0xa120('0x4c')](handleError(_0x13efc0,null));};exports[_0xa120('0x4d')]=function(_0x363c1a,_0x2f8370){var _0x28cf92={'raw':![],'where':{'id':_0x363c1a[_0xa120('0x4e')]['id']}},_0x348462={};_0x348462['model']=_[_0xa120('0x3a')](db[_0xa120('0x34')]['rawAttributes']);_0x348462['query']=_[_0xa120('0x3a')](_0x363c1a[_0xa120('0x39')]);_0x348462[_0xa120('0x42')]=_[_0xa120('0x3b')](_0x348462[_0xa120('0x38')],_0x348462[_0xa120('0x39')]);_0x28cf92[_0xa120('0x3c')]=_[_0xa120('0x3b')](_0x348462[_0xa120('0x38')],qs[_0xa120('0x3d')](_0x363c1a[_0xa120('0x39')][_0xa120('0x3d')]));_0x28cf92['attributes']=_0x28cf92[_0xa120('0x3c')][_0xa120('0x3e')]?_0x28cf92[_0xa120('0x3c')]:_0x348462[_0xa120('0x38')];if(_0x363c1a[_0xa120('0x39')]['includeAll']){_0x28cf92[_0xa120('0x4f')]=[{'all':!![]}];}_0x28cf92=_[_0xa120('0x47')]({},_0x28cf92,_0x363c1a[_0xa120('0x48')]);return db[_0xa120('0x34')][_0xa120('0x50')](_0x28cf92)[_0xa120('0x2b')](handleEntityNotFound(_0x2f8370,null))[_0xa120('0x2b')](respondWithResult(_0x2f8370,null))[_0xa120('0x4c')](handleError(_0x2f8370,null));};exports[_0xa120('0x51')]=function(_0x562b6b,_0x2c7f86){return db['Trigger'][_0xa120('0x51')](_0x562b6b['body'],{})[_0xa120('0x2b')](function(_0x3df601){var _0xf5f6a2=_0x562b6b[_0xa120('0x52')][_0xa120('0x2d')]({'plain':!![]});if(!_0xf5f6a2)throw new Error(_0xa120('0x53'));if(_0xf5f6a2['role']===_0xa120('0x52')){var _0x184b41=_0x3df601[_0xa120('0x2d')]({'plain':!![]});var _0x39a817=_0xa120('0x2e');return db[_0xa120('0x54')][_0xa120('0x50')]({'where':{'name':_0x39a817,'userProfileId':_0xf5f6a2['userProfileId']},'raw':!![]})['then'](function(_0x28fe17){if(_0x28fe17&&_0x28fe17[_0xa120('0x55')]===0x0){return db[_0xa120('0x2f')][_0xa120('0x51')]({'name':_0x184b41[_0xa120('0x31')],'resourceId':_0x184b41['id'],'type':_0x28fe17[_0xa120('0x31')],'sectionId':_0x28fe17['id']},{})[_0xa120('0x2b')](function(){return _0x3df601;});}else{return _0x3df601;}})[_0xa120('0x4c')](function(_0x2640a4){logger[_0xa120('0x30')](_0xa120('0x56'),_0x2640a4);throw _0x2640a4;});}return _0x3df601;})[_0xa120('0x2b')](respondWithResult(_0x2c7f86,0xc9))['catch'](handleError(_0x2c7f86,null));};exports['update']=function(_0x3449d7,_0x3f7012){if(_0x3449d7[_0xa120('0x57')]['id']){delete _0x3449d7['body']['id'];}return db[_0xa120('0x34')][_0xa120('0x50')]({'where':{'id':_0x3449d7['params']['id']}})['then'](handleEntityNotFound(_0x3f7012,null))['then'](saveUpdates(_0x3449d7[_0xa120('0x57')],null))['then'](respondWithResult(_0x3f7012,null))[_0xa120('0x4c')](handleError(_0x3f7012,null));};exports['destroy']=function(_0x522a47,_0x478edd){return db['Trigger'][_0xa120('0x50')]({'where':{'id':_0x522a47[_0xa120('0x4e')]['id']}})[_0xa120('0x2b')](handleEntityNotFound(_0x478edd,null))[_0xa120('0x2b')](removeEntity(_0x478edd,null))['catch'](handleError(_0x478edd,null));};exports[_0xa120('0x58')]=function(_0x3d6858,_0x3e5cde,_0x570fdc){if(_0x3d6858[_0xa120('0x57')]['id']){delete _0x3d6858[_0xa120('0x57')]['id'];}return db[_0xa120('0x34')][_0xa120('0x50')]({'where':{'id':_0x3d6858[_0xa120('0x4e')]['id']}})[_0xa120('0x2b')](handleEntityNotFound(_0x3e5cde,null))[_0xa120('0x2b')](function(_0x212fd6){if(_0x212fd6){_0x3d6858['body']['TriggerAllId']=_0x212fd6['id'];return db[_0xa120('0x59')]['create'](_0x3d6858[_0xa120('0x57')]);}})[_0xa120('0x2b')](respondWithResult(_0x3e5cde,null))[_0xa120('0x4c')](handleError(_0x3e5cde,null));};exports[_0xa120('0x5a')]=function(_0x36bc26,_0x15246f,_0x9c37da){if(_0x36bc26[_0xa120('0x57')]['id']){delete _0x36bc26[_0xa120('0x57')]['id'];}return db[_0xa120('0x34')][_0xa120('0x50')]({'where':{'id':_0x36bc26[_0xa120('0x4e')]['id']}})[_0xa120('0x2b')](handleEntityNotFound(_0x15246f,null))[_0xa120('0x2b')](function(_0x29c8e8){if(_0x29c8e8){_0x36bc26[_0xa120('0x57')]['TriggerAnyId']=_0x29c8e8['id'];return db[_0xa120('0x59')][_0xa120('0x51')](_0x36bc26['body']);}})['then'](respondWithResult(_0x15246f,null))[_0xa120('0x4c')](handleError(_0x15246f,null));};exports[_0xa120('0x5b')]=function(_0xe32d23,_0x261fd3,_0x49b95c){var _0x5b7f0a={};var _0x3ab6d3={};var _0x2270e7;var _0x363315;return db[_0xa120('0x34')][_0xa120('0x5c')]({'where':{'id':_0xe32d23[_0xa120('0x4e')]['id']}})[_0xa120('0x2b')](handleEntityNotFound(_0x261fd3,null))[_0xa120('0x2b')](function(_0x40f923){if(_0x40f923){_0x2270e7=_0x40f923;_0x3ab6d3[_0xa120('0x38')]=_['keys'](db['Condition'][_0xa120('0x35')]);_0x3ab6d3[_0xa120('0x39')]=_[_0xa120('0x3a')](_0xe32d23[_0xa120('0x39')]);_0x3ab6d3[_0xa120('0x42')]=_['intersection'](_0x3ab6d3[_0xa120('0x38')],_0x3ab6d3[_0xa120('0x39')]);_0x5b7f0a['attributes']=_['intersection'](_0x3ab6d3['model'],qs[_0xa120('0x3d')](_0xe32d23[_0xa120('0x39')][_0xa120('0x3d')]));_0x5b7f0a['attributes']=_0x5b7f0a[_0xa120('0x3c')]['length']?_0x5b7f0a[_0xa120('0x3c')]:_0x3ab6d3[_0xa120('0x38')];_0x5b7f0a[_0xa120('0x5d')]=qs[_0xa120('0x41')](_0xe32d23[_0xa120('0x39')]['sort']);_0x5b7f0a[_0xa120('0x44')]=qs[_0xa120('0x42')](_[_0xa120('0x43')](_0xe32d23['query'],_0x3ab6d3['filters']));if(_0xe32d23[_0xa120('0x39')][_0xa120('0x46')]){_0x5b7f0a['where']=_[_0xa120('0x47')](_0x5b7f0a['where'],{'$or':_[_0xa120('0x33')](_0x5b7f0a[_0xa120('0x3c')],function(_0x3cc232){var _0x2bfba2={};_0x2bfba2[_0x3cc232]={'$like':'%'+_0xe32d23[_0xa120('0x39')][_0xa120('0x46')]+'%'};return _0x2bfba2;})});}_0x5b7f0a=_[_0xa120('0x47')]({},_0x5b7f0a,_0xe32d23[_0xa120('0x48')]);return _0x2270e7['getAllConditions'](_0x5b7f0a);}})[_0xa120('0x2b')](function(_0x4a6f1a){if(_0x4a6f1a){_0x363315=_0x4a6f1a[_0xa120('0x3e')];if(!_0xe32d23[_0xa120('0x39')][_0xa120('0x3f')](_0xa120('0x40'))){_0x5b7f0a[_0xa120('0x23')]=qs['limit'](_0xe32d23['query']['limit']);_0x5b7f0a[_0xa120('0x24')]=qs[_0xa120('0x24')](_0xe32d23['query'][_0xa120('0x24')]);}return _0x2270e7[_0xa120('0x5b')](_0x5b7f0a);}})['then'](function(_0x593997){if(_0x593997){return _0x593997?{'count':_0x363315,'rows':_0x593997}:null;}})[_0xa120('0x2b')](respondWithResult(_0x261fd3,null))[_0xa120('0x4c')](handleError(_0x261fd3,null));};exports[_0xa120('0x5e')]=function(_0x4e7459,_0x1f29cb,_0x3e7369){var _0x4129f2={};var _0x1e8dd4={};var _0x5e6d6f;var _0xd8c709;return db[_0xa120('0x34')][_0xa120('0x5c')]({'where':{'id':_0x4e7459[_0xa120('0x4e')]['id']}})[_0xa120('0x2b')](handleEntityNotFound(_0x1f29cb,null))[_0xa120('0x2b')](function(_0x22670c){if(_0x22670c){_0x5e6d6f=_0x22670c;_0x1e8dd4[_0xa120('0x38')]=_[_0xa120('0x3a')](db[_0xa120('0x59')]['rawAttributes']);_0x1e8dd4[_0xa120('0x39')]=_[_0xa120('0x3a')](_0x4e7459[_0xa120('0x39')]);_0x1e8dd4[_0xa120('0x42')]=_[_0xa120('0x3b')](_0x1e8dd4['model'],_0x1e8dd4[_0xa120('0x39')]);_0x4129f2['attributes']=_[_0xa120('0x3b')](_0x1e8dd4[_0xa120('0x38')],qs['fields'](_0x4e7459[_0xa120('0x39')]['fields']));_0x4129f2[_0xa120('0x3c')]=_0x4129f2[_0xa120('0x3c')][_0xa120('0x3e')]?_0x4129f2['attributes']:_0x1e8dd4[_0xa120('0x38')];_0x4129f2['order']=qs[_0xa120('0x41')](_0x4e7459[_0xa120('0x39')][_0xa120('0x41')]);_0x4129f2[_0xa120('0x44')]=qs[_0xa120('0x42')](_['pick'](_0x4e7459[_0xa120('0x39')],_0x1e8dd4['filters']));if(_0x4e7459['query'][_0xa120('0x46')]){_0x4129f2[_0xa120('0x44')]=_[_0xa120('0x47')](_0x4129f2['where'],{'$or':_[_0xa120('0x33')](_0x4129f2[_0xa120('0x3c')],function(_0x2eba83){var _0x2a15be={};_0x2a15be[_0x2eba83]={'$like':'%'+_0x4e7459[_0xa120('0x39')]['filter']+'%'};return _0x2a15be;})});}_0x4129f2=_[_0xa120('0x47')]({},_0x4129f2,_0x4e7459['options']);return _0x5e6d6f[_0xa120('0x5e')](_0x4129f2);}})[_0xa120('0x2b')](function(_0x1d78e5){if(_0x1d78e5){_0xd8c709=_0x1d78e5[_0xa120('0x3e')];if(!_0x4e7459[_0xa120('0x39')][_0xa120('0x3f')](_0xa120('0x40'))){_0x4129f2['limit']=qs['limit'](_0x4e7459[_0xa120('0x39')][_0xa120('0x23')]);_0x4129f2[_0xa120('0x24')]=qs[_0xa120('0x24')](_0x4e7459['query'][_0xa120('0x24')]);}return _0x5e6d6f[_0xa120('0x5e')](_0x4129f2);}})[_0xa120('0x2b')](function(_0x136361){if(_0x136361){return _0x136361?{'count':_0xd8c709,'rows':_0x136361}:null;}})[_0xa120('0x2b')](respondWithResult(_0x1f29cb,null))[_0xa120('0x4c')](handleError(_0x1f29cb,null));};exports[_0xa120('0x5f')]=function(_0x220779,_0x5116a6,_0x4aa8dd){if(_0x220779[_0xa120('0x57')]['id']){delete _0x220779[_0xa120('0x57')]['id'];}return db[_0xa120('0x34')][_0xa120('0x50')]({'where':{'id':_0x220779['params']['id']}})['then'](handleEntityNotFound(_0x5116a6,null))[_0xa120('0x2b')](function(_0x1286d1){if(_0x1286d1){_0x220779[_0xa120('0x57')][_0xa120('0x60')]=_0x1286d1['id'];return db[_0xa120('0x61')]['create'](_0x220779['body']);}})['then'](respondWithResult(_0x5116a6,null))['catch'](handleError(_0x5116a6,null));};exports[_0xa120('0x62')]=function(_0x2957d9,_0x5993be,_0x4e3a27){var _0x36f812={};var _0xed32df={};var _0x194613;var _0x2ccb05;return db[_0xa120('0x34')][_0xa120('0x5c')]({'where':{'id':_0x2957d9[_0xa120('0x4e')]['id']}})[_0xa120('0x2b')](handleEntityNotFound(_0x5993be,null))[_0xa120('0x2b')](function(_0x1e2057){if(_0x1e2057){_0x194613=_0x1e2057;_0xed32df[_0xa120('0x38')]=_['keys'](db[_0xa120('0x61')][_0xa120('0x35')]);_0xed32df[_0xa120('0x39')]=_[_0xa120('0x3a')](_0x2957d9[_0xa120('0x39')]);_0xed32df[_0xa120('0x42')]=_[_0xa120('0x3b')](_0xed32df[_0xa120('0x38')],_0xed32df[_0xa120('0x39')]);_0x36f812['attributes']=_['intersection'](_0xed32df[_0xa120('0x38')],qs[_0xa120('0x3d')](_0x2957d9['query'][_0xa120('0x3d')]));_0x36f812['attributes']=_0x36f812[_0xa120('0x3c')][_0xa120('0x3e')]?_0x36f812[_0xa120('0x3c')]:_0xed32df[_0xa120('0x38')];_0x36f812[_0xa120('0x5d')]=qs['sort'](_0x2957d9['query'][_0xa120('0x41')]);_0x36f812[_0xa120('0x44')]=qs[_0xa120('0x42')](_['pick'](_0x2957d9['query'],_0xed32df[_0xa120('0x42')]));if(_0x2957d9[_0xa120('0x39')][_0xa120('0x46')]){_0x36f812[_0xa120('0x44')]=_[_0xa120('0x47')](_0x36f812[_0xa120('0x44')],{'$or':_[_0xa120('0x33')](_0x36f812[_0xa120('0x3c')],function(_0x59fa6b){var _0x8de246={};_0x8de246[_0x59fa6b]={'$like':'%'+_0x2957d9['query'][_0xa120('0x46')]+'%'};return _0x8de246;})});}_0x36f812=_[_0xa120('0x47')]({},_0x36f812,_0x2957d9[_0xa120('0x48')]);return _0x194613[_0xa120('0x62')](_0x36f812);}})[_0xa120('0x2b')](function(_0x4579b1){if(_0x4579b1){_0x2ccb05=_0x4579b1[_0xa120('0x3e')];if(!_0x2957d9[_0xa120('0x39')][_0xa120('0x3f')](_0xa120('0x40'))){_0x36f812[_0xa120('0x23')]=qs[_0xa120('0x23')](_0x2957d9[_0xa120('0x39')][_0xa120('0x23')]);_0x36f812['offset']=qs[_0xa120('0x24')](_0x2957d9[_0xa120('0x39')]['offset']);}return _0x194613[_0xa120('0x62')](_0x36f812);}})[_0xa120('0x2b')](function(_0x9369e){if(_0x9369e){return _0x9369e?{'count':_0x2ccb05,'rows':_0x9369e}:null;}})['then'](respondWithResult(_0x5993be,null))['catch'](handleError(_0x5993be,null));}; \ No newline at end of file +var _0xcf51=['query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','pick','getAllConditions','length','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','model'];(function(_0x368e94,_0x25ad87){var _0x5bd95c=function(_0x7feab3){while(--_0x7feab3){_0x368e94['push'](_0x368e94['shift']());}};_0x5bd95c(++_0x25ad87);}(_0xcf51,0xe6));var _0x1cf5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcf51[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x1cf5('0x0'));var rimraf=require(_0x1cf5('0x1'));var zipdir=require(_0x1cf5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1cf5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cf5('0x4'));var util=require(_0x1cf5('0x5'));var path=require(_0x1cf5('0x6'));var sox=require(_0x1cf5('0x7'));var csv=require(_0x1cf5('0x8'));var ejs=require(_0x1cf5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1cf5('0xa'));var squel=require(_0x1cf5('0xb'));var crypto=require(_0x1cf5('0xc'));var jsforce=require(_0x1cf5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1cf5('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(_0x1cf5('0xf'));var logger=require('../../config/logger')(_0x1cf5('0x10'));var utils=require('../../config/utils');var config=require(_0x1cf5('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x1cf5('0x12'))['db'];function respondWithStatusCode(_0x13156b,_0x3718bb){_0x3718bb=_0x3718bb||0xcc;return function(_0x3e279){if(_0x3e279){return _0x13156b[_0x1cf5('0x13')](_0x3718bb);}return _0x13156b[_0x1cf5('0x14')](_0x3718bb)[_0x1cf5('0x15')]();};}function respondWithResult(_0x3296a9,_0x133aac){_0x133aac=_0x133aac||0xc8;return function(_0x4bafa7){if(_0x4bafa7){return _0x3296a9[_0x1cf5('0x14')](_0x133aac)['json'](_0x4bafa7);}};}function respondWithFilteredResult(_0x1dd0c1,_0x3b9cbc){return function(_0x5e01d4){if(_0x5e01d4){var _0x2c3bc1=typeof _0x3b9cbc['offset']===_0x1cf5('0x16')&&typeof _0x3b9cbc[_0x1cf5('0x17')]==='undefined';var _0x2ca62e=_0x5e01d4['count'];var _0x21e048=_0x2c3bc1?0x0:_0x3b9cbc[_0x1cf5('0x18')];var _0x7ebe5d=_0x2c3bc1?_0x5e01d4['count']:_0x3b9cbc['offset']+_0x3b9cbc[_0x1cf5('0x17')];var _0x4dcd14;if(_0x7ebe5d>=_0x2ca62e){_0x7ebe5d=_0x2ca62e;_0x4dcd14=0xc8;}else{_0x4dcd14=0xce;}_0x1dd0c1[_0x1cf5('0x14')](_0x4dcd14);return _0x1dd0c1[_0x1cf5('0x19')](_0x1cf5('0x1a'),_0x21e048+'-'+_0x7ebe5d+'/'+_0x2ca62e)[_0x1cf5('0x1b')](_0x5e01d4);}return null;};}function patchUpdates(_0x2194b5){return function(_0x572e6e){try{jsonpatch['apply'](_0x572e6e,_0x2194b5,!![]);}catch(_0x42abd6){return BPromise['reject'](_0x42abd6);}return _0x572e6e[_0x1cf5('0x1c')]();};}function saveUpdates(_0x1d63d5,_0x45231d){return function(_0x8479ae){if(_0x8479ae){return _0x8479ae[_0x1cf5('0x1d')](_0x1d63d5)[_0x1cf5('0x1e')](function(_0x517e9d){return _0x517e9d;});}return null;};}function removeEntity(_0x390d16,_0x3648fb){return function(_0x12f7be){if(_0x12f7be){return _0x12f7be[_0x1cf5('0x1f')]()[_0x1cf5('0x1e')](function(){var _0x2d9105=_0x12f7be[_0x1cf5('0x20')]({'plain':!![]});var _0x4a01db=_0x1cf5('0x21');return db[_0x1cf5('0x22')]['destroy']({'where':{'type':_0x4a01db,'resourceId':_0x2d9105['id']}})[_0x1cf5('0x1e')](function(){return _0x12f7be;});})['then'](function(){_0x390d16['status'](0xcc)[_0x1cf5('0x15')]();});}};}function handleEntityNotFound(_0x323e7d,_0x5a4d1e){return function(_0x455705){if(!_0x455705){_0x323e7d['sendStatus'](0x194);}return _0x455705;};}function handleError(_0x2d5c91,_0x128f98){_0x128f98=_0x128f98||0x1f4;return function(_0x172144){logger[_0x1cf5('0x23')](_0x172144[_0x1cf5('0x24')]);if(_0x172144[_0x1cf5('0x25')]){delete _0x172144[_0x1cf5('0x25')];}_0x2d5c91[_0x1cf5('0x14')](_0x128f98)[_0x1cf5('0x26')](_0x172144);};}exports[_0x1cf5('0x27')]=function(_0x357bf0,_0x12d6aa){var _0x58e45f={},_0x551b7c={},_0x39b2e3={'count':0x0,'rows':[]};var _0x47fb39=_[_0x1cf5('0x28')](db[_0x1cf5('0x29')][_0x1cf5('0x2a')],function(_0x5af83c){return{'name':_0x5af83c[_0x1cf5('0x2b')],'type':_0x5af83c[_0x1cf5('0x2c')]['key']};});_0x551b7c[_0x1cf5('0x2d')]=_[_0x1cf5('0x28')](_0x47fb39,_0x1cf5('0x25'));_0x551b7c[_0x1cf5('0x2e')]=_[_0x1cf5('0x2f')](_0x357bf0[_0x1cf5('0x2e')]);_0x551b7c['filters']=_[_0x1cf5('0x30')](_0x551b7c['model'],_0x551b7c[_0x1cf5('0x2e')]);_0x58e45f['attributes']=_[_0x1cf5('0x30')](_0x551b7c[_0x1cf5('0x2d')],qs[_0x1cf5('0x31')](_0x357bf0[_0x1cf5('0x2e')][_0x1cf5('0x31')]));_0x58e45f[_0x1cf5('0x32')]=_0x58e45f['attributes']['length']?_0x58e45f['attributes']:_0x551b7c[_0x1cf5('0x2d')];if(!_0x357bf0[_0x1cf5('0x2e')][_0x1cf5('0x33')](_0x1cf5('0x34'))){_0x58e45f[_0x1cf5('0x17')]=qs[_0x1cf5('0x17')](_0x357bf0['query']['limit']);_0x58e45f[_0x1cf5('0x18')]=qs[_0x1cf5('0x18')](_0x357bf0[_0x1cf5('0x2e')][_0x1cf5('0x18')]);}_0x58e45f[_0x1cf5('0x35')]=qs[_0x1cf5('0x36')](_0x357bf0[_0x1cf5('0x2e')]['sort']);_0x58e45f[_0x1cf5('0x37')]=qs[_0x1cf5('0x38')](_['pick'](_0x357bf0['query'],_0x551b7c[_0x1cf5('0x38')]),_0x47fb39);if(_0x357bf0['query'][_0x1cf5('0x39')]){_0x58e45f[_0x1cf5('0x37')]=_[_0x1cf5('0x3a')](_0x58e45f['where'],{'$or':_[_0x1cf5('0x28')](_0x47fb39,function(_0x1350d5){if(_0x1350d5[_0x1cf5('0x2c')]!==_0x1cf5('0x3b')){var _0x480cf0={};_0x480cf0[_0x1350d5[_0x1cf5('0x25')]]={'$like':'%'+_0x357bf0[_0x1cf5('0x2e')][_0x1cf5('0x39')]+'%'};return _0x480cf0;}})});}_0x58e45f=_[_0x1cf5('0x3a')]({},_0x58e45f,_0x357bf0['options']);var _0x53bc4c={'where':_0x58e45f[_0x1cf5('0x37')]};return db['Trigger'][_0x1cf5('0x3c')](_0x53bc4c)[_0x1cf5('0x1e')](function(_0x540d11){_0x39b2e3['count']=_0x540d11;if(_0x357bf0[_0x1cf5('0x2e')][_0x1cf5('0x3d')]){_0x58e45f[_0x1cf5('0x3e')]=[{'all':!![]}];}return db[_0x1cf5('0x29')][_0x1cf5('0x3f')](_0x58e45f);})['then'](function(_0x343acb){_0x39b2e3[_0x1cf5('0x40')]=_0x343acb;return _0x39b2e3;})[_0x1cf5('0x1e')](respondWithFilteredResult(_0x12d6aa,_0x58e45f))[_0x1cf5('0x41')](handleError(_0x12d6aa,null));};exports['show']=function(_0x1d6109,_0x35beaa){var _0x19cd9={'raw':![],'where':{'id':_0x1d6109[_0x1cf5('0x42')]['id']}},_0x3becf3={};_0x3becf3['model']=_['keys'](db[_0x1cf5('0x29')][_0x1cf5('0x2a')]);_0x3becf3[_0x1cf5('0x2e')]=_[_0x1cf5('0x2f')](_0x1d6109[_0x1cf5('0x2e')]);_0x3becf3['filters']=_[_0x1cf5('0x30')](_0x3becf3[_0x1cf5('0x2d')],_0x3becf3[_0x1cf5('0x2e')]);_0x19cd9[_0x1cf5('0x32')]=_['intersection'](_0x3becf3[_0x1cf5('0x2d')],qs[_0x1cf5('0x31')](_0x1d6109[_0x1cf5('0x2e')][_0x1cf5('0x31')]));_0x19cd9['attributes']=_0x19cd9[_0x1cf5('0x32')]['length']?_0x19cd9[_0x1cf5('0x32')]:_0x3becf3[_0x1cf5('0x2d')];if(_0x1d6109[_0x1cf5('0x2e')][_0x1cf5('0x3d')]){_0x19cd9[_0x1cf5('0x3e')]=[{'all':!![]}];}_0x19cd9=_[_0x1cf5('0x3a')]({},_0x19cd9,_0x1d6109[_0x1cf5('0x43')]);return db[_0x1cf5('0x29')]['find'](_0x19cd9)[_0x1cf5('0x1e')](handleEntityNotFound(_0x35beaa,null))['then'](respondWithResult(_0x35beaa,null))[_0x1cf5('0x41')](handleError(_0x35beaa,null));};exports['create']=function(_0xc80658,_0x717e7){return db['Trigger'][_0x1cf5('0x44')](_0xc80658[_0x1cf5('0x45')],{})[_0x1cf5('0x1e')](function(_0x11a44c){var _0xc34b8b=_0xc80658['user'][_0x1cf5('0x20')]({'plain':!![]});if(!_0xc34b8b)throw new Error(_0x1cf5('0x46'));if(_0xc34b8b[_0x1cf5('0x47')]===_0x1cf5('0x48')){var _0x462605=_0x11a44c[_0x1cf5('0x20')]({'plain':!![]});var _0x1ac8a7=_0x1cf5('0x21');return db[_0x1cf5('0x49')]['find']({'where':{'name':_0x1ac8a7,'userProfileId':_0xc34b8b[_0x1cf5('0x4a')]},'raw':!![]})[_0x1cf5('0x1e')](function(_0x5a70c9){if(_0x5a70c9&&_0x5a70c9[_0x1cf5('0x4b')]===0x0){return db[_0x1cf5('0x22')][_0x1cf5('0x44')]({'name':_0x462605['name'],'resourceId':_0x462605['id'],'type':_0x5a70c9[_0x1cf5('0x25')],'sectionId':_0x5a70c9['id']},{})['then'](function(){return _0x11a44c;});}else{return _0x11a44c;}})[_0x1cf5('0x41')](function(_0xf7c69c){logger[_0x1cf5('0x23')](_0x1cf5('0x4c'),_0xf7c69c);throw _0xf7c69c;});}return _0x11a44c;})[_0x1cf5('0x1e')](respondWithResult(_0x717e7,0xc9))[_0x1cf5('0x41')](handleError(_0x717e7,null));};exports[_0x1cf5('0x1d')]=function(_0x5705cd,_0xa27d47){if(_0x5705cd[_0x1cf5('0x45')]['id']){delete _0x5705cd['body']['id'];}return db[_0x1cf5('0x29')][_0x1cf5('0x4d')]({'where':{'id':_0x5705cd['params']['id']}})[_0x1cf5('0x1e')](handleEntityNotFound(_0xa27d47,null))[_0x1cf5('0x1e')](saveUpdates(_0x5705cd[_0x1cf5('0x45')],null))[_0x1cf5('0x1e')](respondWithResult(_0xa27d47,null))[_0x1cf5('0x41')](handleError(_0xa27d47,null));};exports[_0x1cf5('0x1f')]=function(_0x3b9dfe,_0x2b874a){return db[_0x1cf5('0x29')][_0x1cf5('0x4d')]({'where':{'id':_0x3b9dfe[_0x1cf5('0x42')]['id']}})[_0x1cf5('0x1e')](handleEntityNotFound(_0x2b874a,null))[_0x1cf5('0x1e')](removeEntity(_0x2b874a,null))[_0x1cf5('0x41')](handleError(_0x2b874a,null));};exports[_0x1cf5('0x4e')]=function(_0x883d3b,_0x7565f,_0x49d29d){if(_0x883d3b[_0x1cf5('0x45')]['id']){delete _0x883d3b[_0x1cf5('0x45')]['id'];}return db[_0x1cf5('0x29')][_0x1cf5('0x4d')]({'where':{'id':_0x883d3b[_0x1cf5('0x42')]['id']}})[_0x1cf5('0x1e')](handleEntityNotFound(_0x7565f,null))[_0x1cf5('0x1e')](function(_0x459781){if(_0x459781){_0x883d3b[_0x1cf5('0x45')][_0x1cf5('0x4f')]=_0x459781['id'];return db[_0x1cf5('0x50')][_0x1cf5('0x44')](_0x883d3b['body']);}})[_0x1cf5('0x1e')](respondWithResult(_0x7565f,null))[_0x1cf5('0x41')](handleError(_0x7565f,null));};exports[_0x1cf5('0x51')]=function(_0x836e11,_0x20119a,_0x55f1c5){if(_0x836e11['body']['id']){delete _0x836e11['body']['id'];}return db[_0x1cf5('0x29')]['find']({'where':{'id':_0x836e11[_0x1cf5('0x42')]['id']}})[_0x1cf5('0x1e')](handleEntityNotFound(_0x20119a,null))[_0x1cf5('0x1e')](function(_0x46c4c7){if(_0x46c4c7){_0x836e11[_0x1cf5('0x45')][_0x1cf5('0x52')]=_0x46c4c7['id'];return db[_0x1cf5('0x50')][_0x1cf5('0x44')](_0x836e11['body']);}})[_0x1cf5('0x1e')](respondWithResult(_0x20119a,null))[_0x1cf5('0x41')](handleError(_0x20119a,null));};exports['getAllConditions']=function(_0x375416,_0x1f9256,_0x4d3651){var _0x4263ef={};var _0x6e0925={};var _0x1614de;var _0x448494;return db[_0x1cf5('0x29')][_0x1cf5('0x53')]({'where':{'id':_0x375416[_0x1cf5('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f9256,null))['then'](function(_0x4c6c0e){if(_0x4c6c0e){_0x1614de=_0x4c6c0e;_0x6e0925[_0x1cf5('0x2d')]=_[_0x1cf5('0x2f')](db[_0x1cf5('0x50')]['rawAttributes']);_0x6e0925[_0x1cf5('0x2e')]=_[_0x1cf5('0x2f')](_0x375416['query']);_0x6e0925[_0x1cf5('0x38')]=_['intersection'](_0x6e0925[_0x1cf5('0x2d')],_0x6e0925[_0x1cf5('0x2e')]);_0x4263ef[_0x1cf5('0x32')]=_['intersection'](_0x6e0925[_0x1cf5('0x2d')],qs[_0x1cf5('0x31')](_0x375416[_0x1cf5('0x2e')][_0x1cf5('0x31')]));_0x4263ef['attributes']=_0x4263ef[_0x1cf5('0x32')]['length']?_0x4263ef[_0x1cf5('0x32')]:_0x6e0925[_0x1cf5('0x2d')];_0x4263ef[_0x1cf5('0x35')]=qs[_0x1cf5('0x36')](_0x375416[_0x1cf5('0x2e')][_0x1cf5('0x36')]);_0x4263ef[_0x1cf5('0x37')]=qs['filters'](_[_0x1cf5('0x54')](_0x375416[_0x1cf5('0x2e')],_0x6e0925[_0x1cf5('0x38')]));if(_0x375416[_0x1cf5('0x2e')][_0x1cf5('0x39')]){_0x4263ef[_0x1cf5('0x37')]=_[_0x1cf5('0x3a')](_0x4263ef[_0x1cf5('0x37')],{'$or':_['map'](_0x4263ef[_0x1cf5('0x32')],function(_0x1b795e){var _0x45dfcf={};_0x45dfcf[_0x1b795e]={'$like':'%'+_0x375416[_0x1cf5('0x2e')]['filter']+'%'};return _0x45dfcf;})});}_0x4263ef=_[_0x1cf5('0x3a')]({},_0x4263ef,_0x375416[_0x1cf5('0x43')]);return _0x1614de[_0x1cf5('0x55')](_0x4263ef);}})[_0x1cf5('0x1e')](function(_0x3a0506){if(_0x3a0506){_0x448494=_0x3a0506[_0x1cf5('0x56')];if(!_0x375416[_0x1cf5('0x2e')][_0x1cf5('0x33')](_0x1cf5('0x34'))){_0x4263ef['limit']=qs[_0x1cf5('0x17')](_0x375416[_0x1cf5('0x2e')][_0x1cf5('0x17')]);_0x4263ef['offset']=qs[_0x1cf5('0x18')](_0x375416[_0x1cf5('0x2e')]['offset']);}return _0x1614de['getAllConditions'](_0x4263ef);}})[_0x1cf5('0x1e')](function(_0x1b652b){if(_0x1b652b){return _0x1b652b?{'count':_0x448494,'rows':_0x1b652b}:null;}})[_0x1cf5('0x1e')](respondWithResult(_0x1f9256,null))[_0x1cf5('0x41')](handleError(_0x1f9256,null));};exports[_0x1cf5('0x57')]=function(_0x19fe6d,_0x215cba,_0x454aa8){var _0x39d089={};var _0x493629={};var _0x56594c;var _0x2e4721;return db[_0x1cf5('0x29')]['findOne']({'where':{'id':_0x19fe6d[_0x1cf5('0x42')]['id']}})['then'](handleEntityNotFound(_0x215cba,null))[_0x1cf5('0x1e')](function(_0x28daff){if(_0x28daff){_0x56594c=_0x28daff;_0x493629[_0x1cf5('0x2d')]=_[_0x1cf5('0x2f')](db[_0x1cf5('0x50')][_0x1cf5('0x2a')]);_0x493629['query']=_[_0x1cf5('0x2f')](_0x19fe6d['query']);_0x493629[_0x1cf5('0x38')]=_['intersection'](_0x493629['model'],_0x493629['query']);_0x39d089['attributes']=_[_0x1cf5('0x30')](_0x493629[_0x1cf5('0x2d')],qs[_0x1cf5('0x31')](_0x19fe6d[_0x1cf5('0x2e')][_0x1cf5('0x31')]));_0x39d089['attributes']=_0x39d089['attributes'][_0x1cf5('0x56')]?_0x39d089[_0x1cf5('0x32')]:_0x493629[_0x1cf5('0x2d')];_0x39d089[_0x1cf5('0x35')]=qs['sort'](_0x19fe6d[_0x1cf5('0x2e')][_0x1cf5('0x36')]);_0x39d089[_0x1cf5('0x37')]=qs['filters'](_[_0x1cf5('0x54')](_0x19fe6d[_0x1cf5('0x2e')],_0x493629[_0x1cf5('0x38')]));if(_0x19fe6d[_0x1cf5('0x2e')][_0x1cf5('0x39')]){_0x39d089[_0x1cf5('0x37')]=_['merge'](_0x39d089[_0x1cf5('0x37')],{'$or':_[_0x1cf5('0x28')](_0x39d089[_0x1cf5('0x32')],function(_0x46562f){var _0x627a57={};_0x627a57[_0x46562f]={'$like':'%'+_0x19fe6d[_0x1cf5('0x2e')][_0x1cf5('0x39')]+'%'};return _0x627a57;})});}_0x39d089=_['merge']({},_0x39d089,_0x19fe6d[_0x1cf5('0x43')]);return _0x56594c[_0x1cf5('0x57')](_0x39d089);}})['then'](function(_0x74cf23){if(_0x74cf23){_0x2e4721=_0x74cf23['length'];if(!_0x19fe6d[_0x1cf5('0x2e')][_0x1cf5('0x33')]('nolimit')){_0x39d089[_0x1cf5('0x17')]=qs[_0x1cf5('0x17')](_0x19fe6d['query']['limit']);_0x39d089['offset']=qs[_0x1cf5('0x18')](_0x19fe6d[_0x1cf5('0x2e')][_0x1cf5('0x18')]);}return _0x56594c[_0x1cf5('0x57')](_0x39d089);}})[_0x1cf5('0x1e')](function(_0x4057ea){if(_0x4057ea){return _0x4057ea?{'count':_0x2e4721,'rows':_0x4057ea}:null;}})[_0x1cf5('0x1e')](respondWithResult(_0x215cba,null))[_0x1cf5('0x41')](handleError(_0x215cba,null));};exports[_0x1cf5('0x58')]=function(_0x48da95,_0x11fb84,_0x302fd0){if(_0x48da95[_0x1cf5('0x45')]['id']){delete _0x48da95['body']['id'];}return db['Trigger'][_0x1cf5('0x4d')]({'where':{'id':_0x48da95[_0x1cf5('0x42')]['id']}})['then'](handleEntityNotFound(_0x11fb84,null))[_0x1cf5('0x1e')](function(_0x426a68){if(_0x426a68){_0x48da95[_0x1cf5('0x45')][_0x1cf5('0x59')]=_0x426a68['id'];return db[_0x1cf5('0x5a')][_0x1cf5('0x44')](_0x48da95['body']);}})[_0x1cf5('0x1e')](respondWithResult(_0x11fb84,null))[_0x1cf5('0x41')](handleError(_0x11fb84,null));};exports['getActions']=function(_0x2c9fbd,_0x53bf80,_0x22a0e7){var _0x511795={};var _0xdb9e8a={};var _0x4e9cdc;var _0x3277d5;return db[_0x1cf5('0x29')][_0x1cf5('0x53')]({'where':{'id':_0x2c9fbd[_0x1cf5('0x42')]['id']}})[_0x1cf5('0x1e')](handleEntityNotFound(_0x53bf80,null))['then'](function(_0x444494){if(_0x444494){_0x4e9cdc=_0x444494;_0xdb9e8a['model']=_[_0x1cf5('0x2f')](db[_0x1cf5('0x5a')]['rawAttributes']);_0xdb9e8a[_0x1cf5('0x2e')]=_[_0x1cf5('0x2f')](_0x2c9fbd['query']);_0xdb9e8a[_0x1cf5('0x38')]=_['intersection'](_0xdb9e8a[_0x1cf5('0x2d')],_0xdb9e8a['query']);_0x511795['attributes']=_[_0x1cf5('0x30')](_0xdb9e8a[_0x1cf5('0x2d')],qs[_0x1cf5('0x31')](_0x2c9fbd[_0x1cf5('0x2e')]['fields']));_0x511795[_0x1cf5('0x32')]=_0x511795[_0x1cf5('0x32')][_0x1cf5('0x56')]?_0x511795[_0x1cf5('0x32')]:_0xdb9e8a[_0x1cf5('0x2d')];_0x511795[_0x1cf5('0x35')]=qs[_0x1cf5('0x36')](_0x2c9fbd[_0x1cf5('0x2e')][_0x1cf5('0x36')]);_0x511795['where']=qs[_0x1cf5('0x38')](_[_0x1cf5('0x54')](_0x2c9fbd[_0x1cf5('0x2e')],_0xdb9e8a['filters']));if(_0x2c9fbd[_0x1cf5('0x2e')][_0x1cf5('0x39')]){_0x511795[_0x1cf5('0x37')]=_[_0x1cf5('0x3a')](_0x511795[_0x1cf5('0x37')],{'$or':_[_0x1cf5('0x28')](_0x511795['attributes'],function(_0x3458fd){var _0x807d7c={};_0x807d7c[_0x3458fd]={'$like':'%'+_0x2c9fbd['query']['filter']+'%'};return _0x807d7c;})});}_0x511795=_[_0x1cf5('0x3a')]({},_0x511795,_0x2c9fbd[_0x1cf5('0x43')]);return _0x4e9cdc[_0x1cf5('0x5b')](_0x511795);}})[_0x1cf5('0x1e')](function(_0x44ee95){if(_0x44ee95){_0x3277d5=_0x44ee95[_0x1cf5('0x56')];if(!_0x2c9fbd[_0x1cf5('0x2e')][_0x1cf5('0x33')]('nolimit')){_0x511795['limit']=qs[_0x1cf5('0x17')](_0x2c9fbd['query'][_0x1cf5('0x17')]);_0x511795[_0x1cf5('0x18')]=qs['offset'](_0x2c9fbd[_0x1cf5('0x2e')][_0x1cf5('0x18')]);}return _0x4e9cdc[_0x1cf5('0x5b')](_0x511795);}})[_0x1cf5('0x1e')](function(_0x1b4804){if(_0x1b4804){return _0x1b4804?{'count':_0x3277d5,'rows':_0x1b4804}:null;}})[_0x1cf5('0x1e')](respondWithResult(_0x53bf80,null))['catch'](handleError(_0x53bf80,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 53f1097..23596eb 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 _0xf041=['path','../../config/environment','define','Trigger','tools_triggers','../../config/logger','api','moment','bluebird'];(function(_0x39efa2,_0x5c159d){var _0x62f0a8=function(_0x117831){while(--_0x117831){_0x39efa2['push'](_0x39efa2['shift']());}};_0x62f0a8(++_0x5c159d);}(_0xf041,0x15b));var _0x1f04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf041[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f04('0x0'))(_0x1f04('0x1'));var moment=require(_0x1f04('0x2'));var BPromise=require(_0x1f04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f04('0x4'));var rimraf=require('rimraf');var config=require(_0x1f04('0x5'));var attributes=require('./trigger.attributes');module['exports']=function(_0x25d578,_0x504d71){return _0x25d578[_0x1f04('0x6')](_0x1f04('0x7'),attributes,{'tableName':_0x1f04('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bde=['request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','../../config/logger','api','bluebird'];(function(_0x41c2ba,_0x2205b0){var _0x2d085d=function(_0x5e3272){while(--_0x5e3272){_0x41c2ba['push'](_0x41c2ba['shift']());}};_0x2d085d(++_0x2205b0);}(_0x0bde,0x110));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe0bd('0x0'));var util=require('util');var logger=require(_0xe0bd('0x1'))(_0xe0bd('0x2'));var moment=require('moment');var BPromise=require(_0xe0bd('0x3'));var rp=require(_0xe0bd('0x4'));var fs=require('fs');var path=require(_0xe0bd('0x5'));var rimraf=require('rimraf');var config=require(_0xe0bd('0x6'));var attributes=require(_0xe0bd('0x7'));module[_0xe0bd('0x8')]=function(_0x3a3cd2,_0x37289f){return _0x3a3cd2[_0xe0bd('0x9')](_0xe0bd('0xa'),attributes,{'tableName':_0xe0bd('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 180e517..0d29dff 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 _0x2aad=['catch','GetTrigger','findAll','options','raw','attributes','include','model','map','stringify','ShowTrigger','find','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x117473,_0x485375){var _0x38711a=function(_0x33e119){while(--_0x33e119){_0x117473['push'](_0x117473['shift']());}};_0x38711a(++_0x485375);}(_0x2aad,0x140));var _0xd2aa=function(_0x3d47eb,_0x57b1ef){_0x3d47eb=_0x3d47eb-0x0;var _0x4532e2=_0x2aad[_0x3d47eb];return _0x4532e2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd2aa('0x0'));var BPromise=require(_0xd2aa('0x1'));var rs=require(_0xd2aa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2aa('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd2aa('0x4'));var jayson=require(_0xd2aa('0x5'));var client=jayson[_0xd2aa('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28c621,_0x5063e6,_0x554bd2){return new BPromise(function(_0x5d192e,_0x4a73d9){return client[_0xd2aa('0x7')](_0x28c621,_0x554bd2)[_0xd2aa('0x8')](function(_0x3f86b1){logger[_0xd2aa('0x9')](_0xd2aa('0xa'),_0x5063e6,_0xd2aa('0xb'));logger[_0xd2aa('0xc')](_0xd2aa('0xd'),_0x5063e6,_0xd2aa('0xb'),JSON['stringify'](_0x3f86b1));if(_0x3f86b1[_0xd2aa('0xe')]){if(_0x3f86b1[_0xd2aa('0xe')]['code']===0x1f4){logger[_0xd2aa('0xe')](_0xd2aa('0xa'),_0x5063e6,_0x3f86b1[_0xd2aa('0xe')][_0xd2aa('0xf')]);return _0x4a73d9(_0x3f86b1[_0xd2aa('0xe')][_0xd2aa('0xf')]);}logger[_0xd2aa('0xe')](_0xd2aa('0xa'),_0x5063e6,_0x3f86b1[_0xd2aa('0xe')][_0xd2aa('0xf')]);return _0x5d192e(_0x3f86b1[_0xd2aa('0xe')]['message']);}else{logger[_0xd2aa('0x9')](_0xd2aa('0xa'),_0x5063e6,_0xd2aa('0xb'));_0x5d192e(_0x3f86b1['result'][_0xd2aa('0xf')]);}})[_0xd2aa('0x10')](function(_0x542b25){logger['error'](_0xd2aa('0xa'),_0x5063e6,_0x542b25);_0x4a73d9(_0x542b25);});});}exports[_0xd2aa('0x11')]=function(_0x364943){var _0x2a5644=this;return new Promise(function(_0x43cd90,_0x38a8c1){return db['Trigger'][_0xd2aa('0x12')]({'raw':_0x364943[_0xd2aa('0x13')]?_0x364943[_0xd2aa('0x13')][_0xd2aa('0x14')]===undefined?!![]:![]:!![],'where':_0x364943['options']?_0x364943[_0xd2aa('0x13')]['where']||null:null,'attributes':_0x364943[_0xd2aa('0x13')]?_0x364943[_0xd2aa('0x13')][_0xd2aa('0x15')]||null:null,'limit':_0x364943['options']?_0x364943[_0xd2aa('0x13')]['limit']||null:null,'include':_0x364943[_0xd2aa('0x13')]?_0x364943['options'][_0xd2aa('0x16')]?_['map'](_0x364943[_0xd2aa('0x13')][_0xd2aa('0x16')],function(_0x223931){return{'model':db[_0x223931[_0xd2aa('0x17')]],'as':_0x223931['as'],'attributes':_0x223931['attributes'],'include':_0x223931[_0xd2aa('0x16')]?_[_0xd2aa('0x18')](_0x223931[_0xd2aa('0x16')],function(_0x8a050f){return{'model':db[_0x8a050f[_0xd2aa('0x17')]],'as':_0x8a050f['as'],'attributes':_0x8a050f['attributes'],'include':_0x8a050f[_0xd2aa('0x16')]?_[_0xd2aa('0x18')](_0x8a050f['include'],function(_0x189836){return{'model':db[_0x189836[_0xd2aa('0x17')]],'as':_0x189836['as'],'attributes':_0x189836[_0xd2aa('0x15')]};}):[]};}):[]};}):[]:[]})[_0xd2aa('0x8')](function(_0x18d3fa){logger[_0xd2aa('0x9')](_0xd2aa('0x11'),_0x364943);logger[_0xd2aa('0xc')]('GetTrigger',_0x364943,JSON[_0xd2aa('0x19')](_0x18d3fa));_0x43cd90(_0x18d3fa);})[_0xd2aa('0x10')](function(_0x5e2c1b){logger[_0xd2aa('0xe')]('GetTrigger',_0x5e2c1b['message'],_0x364943);_0x38a8c1(_0x2a5644[_0xd2aa('0xe')](0x1f4,_0x5e2c1b[_0xd2aa('0xf')]));});});};exports[_0xd2aa('0x1a')]=function(_0x5811b1){var _0x15036a=this;return new Promise(function(_0x4f4c17,_0x4a8717){return db['Trigger'][_0xd2aa('0x1b')]({'raw':_0x5811b1[_0xd2aa('0x13')]?_0x5811b1['options'][_0xd2aa('0x14')]===undefined?!![]:![]:!![],'where':_0x5811b1[_0xd2aa('0x13')]?_0x5811b1[_0xd2aa('0x13')]['where']||null:null,'attributes':_0x5811b1[_0xd2aa('0x13')]?_0x5811b1[_0xd2aa('0x13')][_0xd2aa('0x15')]||null:null,'include':_0x5811b1[_0xd2aa('0x13')]?_0x5811b1[_0xd2aa('0x13')][_0xd2aa('0x16')]?_['map'](_0x5811b1[_0xd2aa('0x13')][_0xd2aa('0x16')],function(_0x5a1480){return{'model':db[_0x5a1480['model']],'as':_0x5a1480['as'],'attributes':_0x5a1480[_0xd2aa('0x15')],'include':_0x5a1480[_0xd2aa('0x16')]?_['map'](_0x5a1480[_0xd2aa('0x16')],function(_0x53130e){return{'model':db[_0x53130e[_0xd2aa('0x17')]],'as':_0x53130e['as'],'attributes':_0x53130e[_0xd2aa('0x15')],'include':_0x53130e[_0xd2aa('0x16')]?_[_0xd2aa('0x18')](_0x53130e[_0xd2aa('0x16')],function(_0x4fd546){return{'model':db[_0x4fd546[_0xd2aa('0x17')]],'as':_0x4fd546['as'],'attributes':_0x4fd546[_0xd2aa('0x15')]};}):[]};}):[]};}):[]:[]})[_0xd2aa('0x8')](function(_0x45bd2c){logger[_0xd2aa('0x9')](_0xd2aa('0x1a'),_0x5811b1);logger['debug'](_0xd2aa('0x1a'),_0x5811b1,JSON[_0xd2aa('0x19')](_0x45bd2c));_0x4f4c17(_0x45bd2c);})['catch'](function(_0x396514){logger[_0xd2aa('0xe')](_0xd2aa('0x1a'),_0x396514[_0xd2aa('0xf')],_0x5811b1);_0x4a8717(_0x15036a[_0xd2aa('0xe')](0x1f4,_0x396514[_0xd2aa('0xf')]));});});}; \ No newline at end of file +var _0x850b=['info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x850b,0x197));var _0xb850=function(_0x28757e,_0x36da7f){_0x28757e=_0x28757e-0x0;var _0x37dcaa=_0x850b[_0x28757e];return _0x37dcaa;};'use strict';var _=require(_0xb850('0x0'));var util=require(_0xb850('0x1'));var moment=require(_0xb850('0x2'));var BPromise=require(_0xb850('0x3'));var rs=require(_0xb850('0x4'));var fs=require('fs');var Redis=require(_0xb850('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb850('0x6'));var logger=require(_0xb850('0x7'))(_0xb850('0x8'));var config=require(_0xb850('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb850('0xa')][_0xb850('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dff3f,_0x256557,_0x2363bd){return new BPromise(function(_0x2cf75b,_0x9de2de){return client['request'](_0x5dff3f,_0x2363bd)[_0xb850('0xc')](function(_0x1cf1da){logger[_0xb850('0xd')](_0xb850('0xe'),_0x256557,_0xb850('0xf'));logger[_0xb850('0x10')](_0xb850('0x11'),_0x256557,_0xb850('0xf'),JSON['stringify'](_0x1cf1da));if(_0x1cf1da[_0xb850('0x12')]){if(_0x1cf1da[_0xb850('0x12')][_0xb850('0x13')]===0x1f4){logger[_0xb850('0x12')](_0xb850('0xe'),_0x256557,_0x1cf1da['error'][_0xb850('0x14')]);return _0x9de2de(_0x1cf1da[_0xb850('0x12')][_0xb850('0x14')]);}logger[_0xb850('0x12')](_0xb850('0xe'),_0x256557,_0x1cf1da['error'][_0xb850('0x14')]);return _0x2cf75b(_0x1cf1da[_0xb850('0x12')]['message']);}else{logger['info'](_0xb850('0xe'),_0x256557,'request\x20sent');_0x2cf75b(_0x1cf1da[_0xb850('0x15')]['message']);}})['catch'](function(_0x3bec41){logger[_0xb850('0x12')]('Trigger,\x20%s,\x20%s',_0x256557,_0x3bec41);_0x9de2de(_0x3bec41);});});}exports[_0xb850('0x16')]=function(_0x30e448){var _0x2df9b2=this;return new Promise(function(_0x3a4917,_0x3e767f){return db[_0xb850('0x17')]['findAll']({'raw':_0x30e448[_0xb850('0x18')]?_0x30e448['options'][_0xb850('0x19')]===undefined?!![]:![]:!![],'where':_0x30e448['options']?_0x30e448[_0xb850('0x18')][_0xb850('0x1a')]||null:null,'attributes':_0x30e448['options']?_0x30e448[_0xb850('0x18')][_0xb850('0x1b')]||null:null,'limit':_0x30e448[_0xb850('0x18')]?_0x30e448[_0xb850('0x18')][_0xb850('0x1c')]||null:null,'include':_0x30e448[_0xb850('0x18')]?_0x30e448[_0xb850('0x18')][_0xb850('0x1d')]?_[_0xb850('0x1e')](_0x30e448[_0xb850('0x18')][_0xb850('0x1d')],function(_0x1b47d0){return{'model':db[_0x1b47d0[_0xb850('0x1f')]],'as':_0x1b47d0['as'],'attributes':_0x1b47d0[_0xb850('0x1b')],'include':_0x1b47d0[_0xb850('0x1d')]?_[_0xb850('0x1e')](_0x1b47d0['include'],function(_0x4d6ce1){return{'model':db[_0x4d6ce1[_0xb850('0x1f')]],'as':_0x4d6ce1['as'],'attributes':_0x4d6ce1[_0xb850('0x1b')],'include':_0x4d6ce1['include']?_[_0xb850('0x1e')](_0x4d6ce1[_0xb850('0x1d')],function(_0x5b187c){return{'model':db[_0x5b187c[_0xb850('0x1f')]],'as':_0x5b187c['as'],'attributes':_0x5b187c[_0xb850('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb850('0xc')](function(_0x23b003){logger[_0xb850('0xd')](_0xb850('0x16'),_0x30e448);logger[_0xb850('0x10')]('GetTrigger',_0x30e448,JSON[_0xb850('0x20')](_0x23b003));_0x3a4917(_0x23b003);})[_0xb850('0x21')](function(_0x4f7150){logger[_0xb850('0x12')](_0xb850('0x16'),_0x4f7150[_0xb850('0x14')],_0x30e448);_0x3e767f(_0x2df9b2['error'](0x1f4,_0x4f7150[_0xb850('0x14')]));});});};exports[_0xb850('0x22')]=function(_0x2315d1){var _0x88475c=this;return new Promise(function(_0x833dfc,_0x3be0b8){return db['Trigger']['find']({'raw':_0x2315d1['options']?_0x2315d1[_0xb850('0x18')][_0xb850('0x19')]===undefined?!![]:![]:!![],'where':_0x2315d1[_0xb850('0x18')]?_0x2315d1['options']['where']||null:null,'attributes':_0x2315d1[_0xb850('0x18')]?_0x2315d1[_0xb850('0x18')]['attributes']||null:null,'include':_0x2315d1[_0xb850('0x18')]?_0x2315d1[_0xb850('0x18')][_0xb850('0x1d')]?_[_0xb850('0x1e')](_0x2315d1[_0xb850('0x18')][_0xb850('0x1d')],function(_0x1e3570){return{'model':db[_0x1e3570[_0xb850('0x1f')]],'as':_0x1e3570['as'],'attributes':_0x1e3570['attributes'],'include':_0x1e3570[_0xb850('0x1d')]?_[_0xb850('0x1e')](_0x1e3570['include'],function(_0x3b9a78){return{'model':db[_0x3b9a78[_0xb850('0x1f')]],'as':_0x3b9a78['as'],'attributes':_0x3b9a78[_0xb850('0x1b')],'include':_0x3b9a78['include']?_[_0xb850('0x1e')](_0x3b9a78[_0xb850('0x1d')],function(_0xad2fea){return{'model':db[_0xad2fea[_0xb850('0x1f')]],'as':_0xad2fea['as'],'attributes':_0xad2fea[_0xb850('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb850('0xc')](function(_0x3c5393){logger[_0xb850('0xd')](_0xb850('0x22'),_0x2315d1);logger[_0xb850('0x10')]('ShowTrigger',_0x2315d1,JSON[_0xb850('0x20')](_0x3c5393));_0x833dfc(_0x3c5393);})[_0xb850('0x21')](function(_0x4c708d){logger[_0xb850('0x12')](_0xb850('0x22'),_0x4c708d[_0xb850('0x14')],_0x2315d1);_0x3be0b8(_0x88475c['error'](0x1f4,_0x4c708d[_0xb850('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index c64cc5b..c0c1eef 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 _0x9c5f=['express','Router','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show','post','/:id/clone','clone','create','delete','multer','path'];(function(_0x5ca6b7,_0x1a4f32){var _0x2d7743=function(_0x569d42){while(--_0x569d42){_0x5ca6b7['push'](_0x5ca6b7['shift']());}};_0x2d7743(++_0x1a4f32);}(_0x9c5f,0x11f));var _0xf9c5=function(_0x1ed213,_0x25027e){_0x1ed213=_0x1ed213-0x0;var _0x1afede=_0x9c5f[_0x1ed213];return _0x1afede;};'use strict';var multer=require(_0xf9c5('0x0'));var util=require('util');var path=require(_0xf9c5('0x1'));var timeout=require('connect-timeout');var express=require(_0xf9c5('0x2'));var router=express[_0xf9c5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf9c5('0x4'));var config=require(_0xf9c5('0x5'));var controller=require(_0xf9c5('0x6'));router[_0xf9c5('0x7')]('/',auth['isAuthenticated'](),controller[_0xf9c5('0x8')]);router['get'](_0xf9c5('0x9'),auth[_0xf9c5('0xa')](),controller[_0xf9c5('0xb')]);router[_0xf9c5('0xc')](_0xf9c5('0xd'),auth[_0xf9c5('0xa')](),controller[_0xf9c5('0xe')]);router[_0xf9c5('0xc')]('/',auth[_0xf9c5('0xa')](),controller[_0xf9c5('0xf')]);router['put'](_0xf9c5('0x9'),auth[_0xf9c5('0xa')](),controller['update']);router[_0xf9c5('0x10')]('/:id',auth[_0xf9c5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xee5a=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','path'];(function(_0xa0fd4b,_0x5e5f17){var _0x33a6d1=function(_0x5464a7){while(--_0x5464a7){_0xa0fd4b['push'](_0xa0fd4b['shift']());}};_0x33a6d1(++_0x5e5f17);}(_0xee5a,0xcf));var _0xaee5=function(_0x59ee62,_0x5df351){_0x59ee62=_0x59ee62-0x0;var _0xbe96ff=_0xee5a[_0x59ee62];return _0xbe96ff;};'use strict';var multer=require(_0xaee5('0x0'));var util=require('util');var path=require(_0xaee5('0x1'));var timeout=require('connect-timeout');var express=require(_0xaee5('0x2'));var router=express[_0xaee5('0x3')]();var fs_extra=require(_0xaee5('0x4'));var auth=require(_0xaee5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaee5('0x6'));var controller=require(_0xaee5('0x7'));router[_0xaee5('0x8')]('/',auth[_0xaee5('0x9')](),controller['index']);router[_0xaee5('0x8')](_0xaee5('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xaee5('0xb')](_0xaee5('0xc'),auth[_0xaee5('0x9')](),controller[_0xaee5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xaee5('0xe')](_0xaee5('0xa'),auth['isAuthenticated'](),controller[_0xaee5('0xf')]);router[_0xaee5('0x10')]('/:id',auth[_0xaee5('0x9')](),controller[_0xaee5('0x11')]);module[_0xaee5('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 29ea739..a996fd7 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 _0xd6eb=['rfc2833','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','\x22\x22\x20<>','INTEGER','always','accept','refuse','uac','uas','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x4ee848,_0x3e29b2){var _0x1a55c0=function(_0x2838af){while(--_0x2838af){_0x4ee848['push'](_0x4ee848['shift']());}};_0x1a55c0(++_0x3e29b2);}(_0xd6eb,0xb4));var _0xbd6e=function(_0x3fffb3,_0x140ea8){_0x3fffb3=_0x3fffb3-0x0;var _0x260f9a=_0xd6eb[_0x3fffb3];return _0x260f9a;};'use strict';var Sequelize=require(_0xbd6e('0x0'));module[_0xbd6e('0x1')]={'name':{'type':Sequelize[_0xbd6e('0x2')],'allowNull':![],'unique':_0xbd6e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x5'),_0xbd6e('0x6'),_0xbd6e('0x7')),'allowNull':![],'defaultValue':_0xbd6e('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd6e('0x8')},'callingpres':{'type':Sequelize['ENUM'](_0xbd6e('0x9'),'ALLOWED_PASSED_SCREEN',_0xbd6e('0xa'),_0xbd6e('0xb'),_0xbd6e('0xc'),_0xbd6e('0xd'),_0xbd6e('0xe'),_0xbd6e('0xf'))},'deny':{'type':Sequelize[_0xbd6e('0x2')]},'permit':{'type':Sequelize[_0xbd6e('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xbd6e('0x2')]},'remotesecret':{'type':Sequelize[_0xbd6e('0x2')]},'transport':{'type':Sequelize[_0xbd6e('0x2')],'defaultValue':'udp','set':function(_0x5d6f17){this[_0xbd6e('0x10')]('transport',_0x5d6f17?_0x5d6f17['join'](','):null);},'get':function(){return this['getDataValue'](_0xbd6e('0x11'))?this[_0xbd6e('0x12')](_0xbd6e('0x11'))['split'](','):null;},'comment':_0xbd6e('0x13')},'dtmfmode':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x14'),'info',_0xbd6e('0x15'),_0xbd6e('0x16'),_0xbd6e('0x17')),'defaultValue':_0xbd6e('0x14')},'directmedia':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no',_0xbd6e('0x19'),_0xbd6e('0x1a'),_0xbd6e('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xbd6e('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xbd6e('0x2')],'defaultValue':_0xbd6e('0x1c'),'set':function(_0x1c649d){this[_0xbd6e('0x10')](_0xbd6e('0x1d'),_0x1c649d?_0x1c649d[_0xbd6e('0x1e')](','):null);},'get':function(){return this[_0xbd6e('0x12')](_0xbd6e('0x1d'))?this[_0xbd6e('0x12')](_0xbd6e('0x1d'))[_0xbd6e('0x1f')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xbd6e('0x2')]},'namedcallgroup':{'type':Sequelize[_0xbd6e('0x2')]},'pickupgroup':{'type':Sequelize[_0xbd6e('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xbd6e('0x2')]},'language':{'type':Sequelize[_0xbd6e('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xbd6e('0x20')},'allow':{'type':Sequelize[_0xbd6e('0x2')],'allowNull':![],'defaultValue':_0xbd6e('0x21'),'set':function(_0x3186b9){this[_0xbd6e('0x10')](_0xbd6e('0x22'),_0x3186b9?_0x3186b9[_0xbd6e('0x1e')](';'):_0xbd6e('0x21'));},'get':function(){return this['getDataValue'](_0xbd6e('0x22'))?this[_0xbd6e('0x12')](_0xbd6e('0x22'))['split'](';'):null;},'comment':_0xbd6e('0x23')},'autoframing':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no')},'insecure':{'type':Sequelize[_0xbd6e('0x2')],'defaultValue':_0xbd6e('0x24'),'set':function(_0x4c5b55){this['setDataValue'](_0xbd6e('0x25'),_0x4c5b55?_0x4c5b55['join'](','):null);},'get':function(){return this[_0xbd6e('0x12')]('insecure')?this[_0xbd6e('0x12')](_0xbd6e('0x25'))[_0xbd6e('0x1f')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xbd6e('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xbd6e('0x4')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xbd6e('0x2')]},'callerid':{'type':Sequelize[_0xbd6e('0x2')],'defaultValue':_0xbd6e('0x26')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xbd6e('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xbd6e('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xbd6e('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xbd6e('0x4')]('yes','no',_0xbd6e('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xbd6e('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no')},'mailbox':{'type':Sequelize[_0xbd6e('0x2')]},'session_timers':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x29'),_0xbd6e('0x2a'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xbd6e('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x2b'),_0xbd6e('0x2c')),'defaultValue':_0xbd6e('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xbd6e('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xbd6e('0x18'),'no'),'defaultValue':_0xbd6e('0x18')},'keepalive':{'type':Sequelize[_0xbd6e('0x27')](0xb)},'defaultip':{'type':Sequelize[_0xbd6e('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xbd6e('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xbd6e('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xbd6e('0x2')]},'callbackextension':{'type':Sequelize[_0xbd6e('0x2')]},'timert1':{'type':Sequelize[_0xbd6e('0x27')](0xb)},'timerb':{'type':Sequelize[_0xbd6e('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0xbd6e('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0xbd6e('0x2')]},'contactdeny':{'type':Sequelize[_0xbd6e('0x2')]},'contactacl':{'type':Sequelize[_0xbd6e('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xbd6e('0x2')]},'use_q850_reason':{'type':Sequelize[_0xbd6e('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xbd6e('0x4')]('yes','no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0xbd6e('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xbd6e('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xbd6e('0x2')]},'dtlscafile':{'type':Sequelize[_0xbd6e('0x2')]},'dtlscapath':{'type':Sequelize[_0xbd6e('0x2')]},'dtlssetup':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x2d'),_0xbd6e('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xbd6e('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0xbd6e('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xbd6e('0x2')]},'recordofffeature':{'type':Sequelize[_0xbd6e('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no')},'vmexten':{'type':Sequelize[_0xbd6e('0x2')]},'mohinterpret':{'type':Sequelize[_0xbd6e('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xbd6e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0xbd6e('0x2f')},'canreinvite':{'type':Sequelize[_0xbd6e('0x4')](_0xbd6e('0x18'),'no',_0xbd6e('0x19'),_0xbd6e('0x1a'),_0xbd6e('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xbd6e('0x2')]},'otherFields':{'type':Sequelize[_0xbd6e('0x2')]},'active':{'type':Sequelize[_0xbd6e('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xbd6e('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x16f3=['fingerprint','active','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas'];(function(_0x4dad6b,_0x5da208){var _0x2bccda=function(_0x57d302){while(--_0x57d302){_0x4dad6b['push'](_0x4dad6b['shift']());}};_0x2bccda(++_0x5da208);}(_0x16f3,0x9c));var _0x316f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16f3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x316f('0x0'));module[_0x316f('0x1')]={'name':{'type':Sequelize[_0x316f('0x2')],'allowNull':![],'unique':_0x316f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x316f('0x4')]('friend','user','peer'),'allowNull':![],'defaultValue':_0x316f('0x5')},'context':{'type':Sequelize[_0x316f('0x2')],'allowNull':![],'defaultValue':_0x316f('0x6')},'callingpres':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x7'),_0x316f('0x8'),_0x316f('0x9'),_0x316f('0xa'),_0x316f('0xb'),_0x316f('0xc'),_0x316f('0xd'),_0x316f('0xe'))},'deny':{'type':Sequelize[_0x316f('0x2')]},'permit':{'type':Sequelize[_0x316f('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x316f('0x2')]},'remotesecret':{'type':Sequelize[_0x316f('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x316f('0xf'),'set':function(_0x2e8b4d){this[_0x316f('0x10')]('transport',_0x2e8b4d?_0x2e8b4d[_0x316f('0x11')](','):null);},'get':function(){return this[_0x316f('0x12')]('transport')?this[_0x316f('0x12')](_0x316f('0x13'))[_0x316f('0x14')](','):null;},'comment':_0x316f('0x15')},'dtmfmode':{'type':Sequelize[_0x316f('0x4')]('rfc2833','info','shortinfo','inband',_0x316f('0x16')),'defaultValue':_0x316f('0x17')},'directmedia':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no',_0x316f('0x19'),_0x316f('0x1a'),_0x316f('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x316f('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x316f('0x1c'),'set':function(_0x24cd60){this[_0x316f('0x10')]('nat',_0x24cd60?_0x24cd60['join'](','):null);},'get':function(){return this['getDataValue'](_0x316f('0x1d'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0x316f('0x1e')},'callgroup':{'type':Sequelize[_0x316f('0x2')]},'namedcallgroup':{'type':Sequelize[_0x316f('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x316f('0x2')]},'language':{'type':Sequelize[_0x316f('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x316f('0x2')],'defaultValue':_0x316f('0x1f')},'allow':{'type':Sequelize[_0x316f('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5a8881){this[_0x316f('0x10')]('allow',_0x5a8881?_0x5a8881[_0x316f('0x11')](';'):_0x316f('0x20'));},'get':function(){return this[_0x316f('0x12')](_0x316f('0x21'))?this[_0x316f('0x12')](_0x316f('0x21'))[_0x316f('0x14')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no')},'insecure':{'type':Sequelize[_0x316f('0x2')],'defaultValue':'port,invite','set':function(_0x5508d6){this[_0x316f('0x10')](_0x316f('0x22'),_0x5508d6?_0x5508d6[_0x316f('0x11')](','):null);},'get':function(){return this[_0x316f('0x12')](_0x316f('0x22'))?this[_0x316f('0x12')]('insecure')[_0x316f('0x14')](','):null;},'comment':_0x316f('0x23')},'trustrpid':{'type':Sequelize[_0x316f('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x316f('0x18'),'no',_0x316f('0x24'))},'promiscredir':{'type':Sequelize['ENUM'](_0x316f('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no')},'accountcode':{'type':Sequelize[_0x316f('0x25')](0xb)},'setvar':{'type':Sequelize[_0x316f('0x2')]},'callerid':{'type':Sequelize[_0x316f('0x2')],'defaultValue':_0x316f('0x26')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no'),'defaultValue':_0x316f('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x316f('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x316f('0x2')]},'template':{'type':Sequelize[_0x316f('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x316f('0x18'),'no',_0x316f('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x316f('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no')},'mailbox':{'type':Sequelize[_0x316f('0x2')]},'session_timers':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x28'),_0x316f('0x29'),_0x316f('0x2a'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x316f('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x316f('0x4')]('uac',_0x316f('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x316f('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x316f('0x2')]},'fromuser':{'type':Sequelize[_0x316f('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no'),'defaultValue':_0x316f('0x18')},'keepalive':{'type':Sequelize[_0x316f('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x316f('0x2')]},'defaultuser':{'type':Sequelize[_0x316f('0x2')]},'rtptimeout':{'type':Sequelize[_0x316f('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x316f('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x316f('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x316f('0x2')]},'timert1':{'type':Sequelize[_0x316f('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x316f('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x316f('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x316f('0x2')]},'use_q850_reason':{'type':Sequelize[_0x316f('0x2')]},'maxforwards':{'type':Sequelize[_0x316f('0x25')](0xb)},'encryption':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0x316f('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x316f('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x316f('0x4')]('yes','no',_0x316f('0x2c'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x316f('0x25')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x316f('0x2')]},'dtlscipher':{'type':Sequelize[_0x316f('0x2')]},'dtlscafile':{'type':Sequelize[_0x316f('0x2')]},'dtlscapath':{'type':Sequelize[_0x316f('0x2')]},'dtlssetup':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x2d'),'passive',_0x316f('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x316f('0x2')]},'usereqphone':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x316f('0x2')]},'recordofffeature':{'type':Sequelize[_0x316f('0x2')]},'call_limit':{'type':Sequelize[_0x316f('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x316f('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x316f('0x2')]},'mohsuggest':{'type':Sequelize[_0x316f('0x2')]},'parkinglot':{'type':Sequelize[_0x316f('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x316f('0x2')],'defaultValue':_0x316f('0x2f')},'canreinvite':{'type':Sequelize[_0x316f('0x4')](_0x316f('0x18'),'no','nonat',_0x316f('0x1a'),_0x316f('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x316f('0x2')]},'otherFields':{'type':Sequelize[_0x316f('0x2')]},'active':{'type':Sequelize[_0x316f('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x316f('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 6c89738..bb6e763 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 _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x4b84[_0x4d1ee9];return _0x9a5456;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file +var _0x008c=['update','destroy','get','Trunks','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','Trunk','findAll','show','params','includeAll','include','options','clone','find','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','utf8','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','Reload','chan_sip.so','server/files/templates/trunk.ejs','join','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save'];(function(_0x1c46c5,_0x41bc70){var _0x4e403c=function(_0x8cf318){while(--_0x8cf318){_0x1c46c5['push'](_0x1c46c5['shift']());}};_0x4e403c(++_0x41bc70);}(_0x008c,0x188));var _0xc008=function(_0x5b6d34,_0x2a32a0){_0x5b6d34=_0x5b6d34-0x0;var _0x65eb46=_0x008c[_0x5b6d34];return _0x65eb46;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];var jayson=require(_0xc008('0x18'));var client=jayson[_0xc008('0x19')][_0xc008('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x593f7a,_0x560e28,_0x33f44c,_0x50c1ab){return new BPromise(function(_0x25e13f,_0x4584e1){var _0x2073ef=_0x50c1ab||client;return _0x2073ef[_0xc008('0x1b')](_0x593f7a,_0x33f44c)[_0xc008('0x1c')](function(_0x5ee00b){logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));logger[_0xc008('0x1e')](_0xc008('0x1f'),_0x560e28,_0xc008('0x1d'),JSON['stringify'](_0x5ee00b));if(_0x5ee00b['error']){if(_0x5ee00b['error']['code']===0x1f4){logger[_0xc008('0x20')](_0xc008('0x21'),_0x560e28,_0x5ee00b['error'][_0xc008('0x22')]);return _0x4584e1(_0x5ee00b['error']['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x560e28,_0x5ee00b[_0xc008('0x20')]['message']);return _0x25e13f(_0x5ee00b['error']['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));_0x25e13f(_0x5ee00b[_0xc008('0x23')][_0xc008('0x22')]);}})[_0xc008('0x24')](function(_0x11cc75){logger[_0xc008('0x20')]('Trunk,\x20%s,\x20%s',_0x560e28,_0x11cc75);_0x4584e1(_0x11cc75);});});}function respondWithStatusCode(_0x459fd9,_0x5c85f2){_0x5c85f2=_0x5c85f2||0xcc;return function(_0x58a6ea){if(_0x58a6ea){return _0x459fd9[_0xc008('0x25')](_0x5c85f2);}return _0x459fd9[_0xc008('0x26')](_0x5c85f2)[_0xc008('0x27')]();};}function respondWithResult(_0x3cb28c,_0x5410f5){_0x5410f5=_0x5410f5||0xc8;return function(_0x48582b){if(_0x48582b){return _0x3cb28c['status'](_0x5410f5)[_0xc008('0x28')](_0x48582b);}};}function respondWithFilteredResult(_0x15dade,_0x92c582){return function(_0x2e31c2){if(_0x2e31c2){var _0x5bebd9=typeof _0x92c582['offset']==='undefined'&&typeof _0x92c582['limit']==='undefined';var _0x3865c0=_0x2e31c2[_0xc008('0x29')];var _0x25eae4=_0x5bebd9?0x0:_0x92c582['offset'];var _0x24c14c=_0x5bebd9?_0x2e31c2[_0xc008('0x29')]:_0x92c582[_0xc008('0x2a')]+_0x92c582[_0xc008('0x2b')];var _0x4c5dec;if(_0x24c14c>=_0x3865c0){_0x24c14c=_0x3865c0;_0x4c5dec=0xc8;}else{_0x4c5dec=0xce;}_0x15dade[_0xc008('0x26')](_0x4c5dec);return _0x15dade[_0xc008('0x2c')]('Content-Range',_0x25eae4+'-'+_0x24c14c+'/'+_0x3865c0)['json'](_0x2e31c2);}return null;};}function patchUpdates(_0x539766){return function(_0x1032b2){try{jsonpatch[_0xc008('0x2d')](_0x1032b2,_0x539766,!![]);}catch(_0xf831f2){return BPromise[_0xc008('0x2e')](_0xf831f2);}return _0x1032b2[_0xc008('0x2f')]();};}function saveUpdates(_0xceebc3,_0x294f97){return function(_0x22d8e8){if(_0x22d8e8){return _0x22d8e8[_0xc008('0x30')](_0xceebc3)[_0xc008('0x1c')](function(_0x2f4b6b){return _0x2f4b6b;});}return null;};}function removeEntity(_0x1ac7c8,_0x596ee8){return function(_0x334a09){if(_0x334a09){return _0x334a09[_0xc008('0x31')]()['then'](function(){var _0xaf4b84=_0x334a09[_0xc008('0x32')]({'plain':!![]});var _0x383be7=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x31')]({'where':{'type':_0x383be7,'resourceId':_0xaf4b84['id']}})[_0xc008('0x1c')](function(){return _0x334a09;});})[_0xc008('0x1c')](function(){_0x1ac7c8[_0xc008('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415b87,_0x389a40){return function(_0x459df4){if(!_0x459df4){_0x415b87[_0xc008('0x25')](0x194);}return _0x459df4;};}function handleError(_0x40002f,_0x315562){_0x315562=_0x315562||0x1f4;return function(_0x1667a0){logger['error'](_0x1667a0[_0xc008('0x35')]);if(_0x1667a0[_0xc008('0x36')]){delete _0x1667a0['name'];}_0x40002f[_0xc008('0x26')](_0x315562)[_0xc008('0x37')](_0x1667a0);};}exports['index']=function(_0x263473,_0x2e4ae1){var _0x280e9b={},_0x55ff48={},_0x53b353={'count':0x0,'rows':[]};var _0x478810=_[_0xc008('0x38')](db['Trunk'][_0xc008('0x39')],function(_0x3884dd){return{'name':_0x3884dd[_0xc008('0x3a')],'type':_0x3884dd[_0xc008('0x3b')][_0xc008('0x3c')]};});_0x55ff48[_0xc008('0x3d')]=_[_0xc008('0x38')](_0x478810,_0xc008('0x36'));_0x55ff48[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x263473[_0xc008('0x3e')]);_0x55ff48[_0xc008('0x40')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],_0x55ff48['query']);_0x280e9b[_0xc008('0x42')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x263473['query'][_0xc008('0x43')]));_0x280e9b[_0xc008('0x42')]=_0x280e9b[_0xc008('0x42')][_0xc008('0x44')]?_0x280e9b[_0xc008('0x42')]:_0x55ff48['model'];if(!_0x263473[_0xc008('0x3e')][_0xc008('0x45')](_0xc008('0x46'))){_0x280e9b[_0xc008('0x2b')]=qs[_0xc008('0x2b')](_0x263473['query'][_0xc008('0x2b')]);_0x280e9b[_0xc008('0x2a')]=qs[_0xc008('0x2a')](_0x263473[_0xc008('0x3e')]['offset']);}_0x280e9b[_0xc008('0x47')]=qs[_0xc008('0x48')](_0x263473[_0xc008('0x3e')]['sort']);_0x280e9b[_0xc008('0x49')]=qs['filters'](_[_0xc008('0x4a')](_0x263473['query'],_0x55ff48[_0xc008('0x40')]),_0x478810);if(_0x263473[_0xc008('0x3e')]['filter']){_0x280e9b[_0xc008('0x49')]=_[_0xc008('0x4b')](_0x280e9b[_0xc008('0x49')],{'$or':_['map'](_0x478810,function(_0x1cec64){if(_0x1cec64[_0xc008('0x3b')]!==_0xc008('0x4c')){var _0x44fc5d={};_0x44fc5d[_0x1cec64[_0xc008('0x36')]]={'$like':'%'+_0x263473[_0xc008('0x3e')]['filter']+'%'};return _0x44fc5d;}})});}_0x280e9b=_['merge']({},_0x280e9b,_0x263473['options']);var _0x4552ed={'where':_0x280e9b[_0xc008('0x49')]};return db[_0xc008('0x4d')][_0xc008('0x29')](_0x4552ed)[_0xc008('0x1c')](function(_0x24f6a4){_0x53b353[_0xc008('0x29')]=_0x24f6a4;if(_0x263473[_0xc008('0x3e')]['includeAll']){_0x280e9b['include']=[{'all':!![]}];}return db['Trunk'][_0xc008('0x4e')](_0x280e9b);})[_0xc008('0x1c')](function(_0x158eae){_0x53b353['rows']=_0x158eae;return _0x53b353;})[_0xc008('0x1c')](respondWithFilteredResult(_0x2e4ae1,_0x280e9b))[_0xc008('0x24')](handleError(_0x2e4ae1,null));};exports[_0xc008('0x4f')]=function(_0x1c2c50,_0x4981b4){var _0x56e4ac={'raw':![],'where':{'id':_0x1c2c50[_0xc008('0x50')]['id']}},_0x17ec90={};_0x17ec90[_0xc008('0x3d')]=_[_0xc008('0x3f')](db['Trunk']['rawAttributes']);_0x17ec90[_0xc008('0x3e')]=_['keys'](_0x1c2c50[_0xc008('0x3e')]);_0x17ec90[_0xc008('0x40')]=_[_0xc008('0x41')](_0x17ec90['model'],_0x17ec90[_0xc008('0x3e')]);_0x56e4ac[_0xc008('0x42')]=_[_0xc008('0x41')](_0x17ec90[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x1c2c50['query'][_0xc008('0x43')]));_0x56e4ac[_0xc008('0x42')]=_0x56e4ac['attributes'][_0xc008('0x44')]?_0x56e4ac[_0xc008('0x42')]:_0x17ec90['model'];if(_0x1c2c50['query'][_0xc008('0x51')]){_0x56e4ac[_0xc008('0x52')]=[{'all':!![]}];}_0x56e4ac=_[_0xc008('0x4b')]({},_0x56e4ac,_0x1c2c50[_0xc008('0x53')]);return db[_0xc008('0x4d')]['find'](_0x56e4ac)['then'](handleEntityNotFound(_0x4981b4,null))[_0xc008('0x1c')](respondWithResult(_0x4981b4,null))['catch'](handleError(_0x4981b4,null));};exports[_0xc008('0x54')]=function(_0x25d351,_0xf94fcb){var _0x2f1105={'where':{'id':_0x25d351[_0xc008('0x50')]['id']}},_0x44f42d={};_0x44f42d['model']=_[_0xc008('0x3f')](db[_0xc008('0x4d')][_0xc008('0x39')]);_0x2f1105[_0xc008('0x42')]=_[_0xc008('0x41')](_0x44f42d['model'],qs[_0xc008('0x43')](_0x25d351['query']['fields']));_0x2f1105['attributes']=_0x2f1105[_0xc008('0x42')][_0xc008('0x44')]?_0x2f1105[_0xc008('0x42')]:_0x44f42d['model'];if(_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]){_0x2f1105[_0xc008('0x52')]=[{'all':!![]}];}_0x2f1105=_['merge']({},_0x2f1105,_0x25d351[_0xc008('0x53')]);return db[_0xc008('0x4d')][_0xc008('0x55')](_0x2f1105)[_0xc008('0x1c')](handleEntityNotFound(_0xf94fcb,null))['then'](function(_0x4022dd){if(_0x4022dd){var _0x4eaa6d=_0x4022dd[_0xc008('0x32')]({'plain':!![]});_0x4eaa6d=qs[_0xc008('0x56')](_0x4eaa6d,['id',_0xc008('0x57'),_0xc008('0x58')]);_0x25d351[_0xc008('0x59')]=_[_0xc008('0x56')](_0x25d351['body'],['id',_0xc008('0x57'),'updatedAt']);return db['Trunk'][_0xc008('0x5a')](_[_0xc008('0x4b')](_0x4eaa6d,_0x25d351['body']),{'include':_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]?[{'all':!![]}]:undefined})[_0xc008('0x1c')](function(_0x4517c0){var _0x21ee6d=_0x25d351[_0xc008('0x5b')][_0xc008('0x32')]({'plain':!![]});if(!_0x21ee6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21ee6d[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x3bfb15=_0x4517c0[_0xc008('0x32')]({'plain':!![]});var _0xb3ca0f=_0xc008('0x33');return db[_0xc008('0x5d')][_0xc008('0x55')]({'where':{'name':_0xb3ca0f,'userProfileId':_0x21ee6d[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x1bef66){if(_0x1bef66&&_0x1bef66[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x3bfb15['name'],'resourceId':_0x3bfb15['id'],'type':_0x1bef66[_0xc008('0x36')],'sectionId':_0x1bef66['id']},{})[_0xc008('0x1c')](function(){return _0x4517c0;});}else{return _0x4517c0;}})[_0xc008('0x24')](function(_0x566dea){logger[_0xc008('0x20')](_0xc008('0x60'),_0x566dea);throw _0x566dea;});}return _0x4517c0;});}})['then'](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x5a')]=function(_0x2a4c2b,_0x7bad14,_0x39083c){var _0x1a2ce7;return db[_0xc008('0x4d')][_0xc008('0x5a')](_0x2a4c2b[_0xc008('0x59')],{'raw':!![]})[_0xc008('0x1c')](function(_0x1b059b){_0x1a2ce7=_0x1b059b;return db[_0xc008('0x4d')]['findAll']({'raw':!![]});})[_0xc008('0x1c')](function(_0x25a52b){var _0xfdb5e3=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],'server/files/templates/trunk.ejs'),_0xc008('0x63'));var _0x46fa7b=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x64')),_0xc008('0x63'));var _0x553f5c=ejs[_0xc008('0x65')](_0xfdb5e3,{'trunks':_0x25a52b||[]});fs['writeFileSync'](_0xc008('0x66'),_0x553f5c);if(_0x1a2ce7[_0xc008('0x67')]){var _0x23012c=ejs[_0xc008('0x65')](_0x46fa7b,{'trunks':_0x25a52b||[]});fs[_0xc008('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x23012c);}})[_0xc008('0x1c')](function(){return respondWithRpcPromise(_0xc008('0x69'),'create',{'module':_0xc008('0x6a')});})['then'](function(){var _0x278cbe=_0x2a4c2b['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x278cbe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x278cbe[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x33d8e4=_0x1a2ce7[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x55')]({'where':{'name':_0xc008('0x33'),'userProfileId':_0x278cbe[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x321500){if(_0x321500&&_0x321500[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x33d8e4['name'],'resourceId':_0x33d8e4['id'],'type':_0x321500[_0xc008('0x36')],'sectionId':_0x321500['id']},{})['then'](function(){return _0x1a2ce7;});}else{return _0x1a2ce7;}})['catch'](function(_0x4c84da){logger[_0xc008('0x20')](_0xc008('0x60'),_0x4c84da);throw _0x4c84da;});}return _0x1a2ce7;})[_0xc008('0x1c')](respondWithResult(_0x7bad14,0xc9))[_0xc008('0x24')](handleError(_0x7bad14,null));};exports[_0xc008('0x30')]=function(_0x2e9646,_0x23ef42,_0x519328){var _0x127bdf;return db['Trunk'][_0xc008('0x55')]({'where':{'id':_0x2e9646[_0xc008('0x50')]['id']}})[_0xc008('0x1c')](handleEntityNotFound(_0x23ef42,null))[_0xc008('0x1c')](saveUpdates(_0x2e9646[_0xc008('0x59')],null))[_0xc008('0x1c')](function(_0x23d4ff){if(_0x23d4ff){_0x127bdf=_0x23d4ff;return db[_0xc008('0x4d')][_0xc008('0x4e')]({'raw':!![]});}})[_0xc008('0x1c')](function(_0x334ed8){if(_0x334ed8){var _0x1dd9fe=fs['readFileSync'](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x572d93=fs[_0xc008('0x61')](path[_0xc008('0x6c')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x3fc44f=ejs[_0xc008('0x65')](_0x1dd9fe,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x66'),_0x3fc44f);var _0x1101b8=ejs[_0xc008('0x65')](_0x572d93,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x6d'),_0x1101b8);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x30'),{'module':'chan_sip.so'});}return null;})['then'](function(_0xc644fe){if(_0xc644fe){return _0x127bdf;}})[_0xc008('0x1c')](respondWithResult(_0x23ef42,null))[_0xc008('0x24')](handleError(_0x23ef42,null));};exports[_0xc008('0x31')]=function(_0x2b94b2,_0x37fc2c,_0x4b434f){var _0x5794fe;return db[_0xc008('0x4d')][_0xc008('0x55')]({'where':{'id':_0x2b94b2[_0xc008('0x50')]['id']}})['then'](handleEntityNotFound(_0x37fc2c,null))['then'](removeEntity(_0x37fc2c,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x276de2){var _0x52bf60=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x5bc8b0=fs['readFileSync'](path[_0xc008('0x6c')](config['root'],_0xc008('0x64')),_0xc008('0x63'));var _0x544519=ejs[_0xc008('0x65')](_0x52bf60,{'trunks':_0x276de2});var _0x4db90b=ejs['render'](_0x5bc8b0,{'trunks':_0x276de2});fs[_0xc008('0x68')](_0xc008('0x66'),_0x544519);fs['writeFileSync'](_0xc008('0x6d'),_0x4db90b);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x31'),{'module':'chan_sip.so'});})[_0xc008('0x24')](handleError(_0x37fc2c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index c6c83b5..62678b9 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 _0xead2=['tools_trunks','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define'];(function(_0x31df77,_0x4378c5){var _0xdea181=function(_0x25baad){while(--_0x25baad){_0x31df77['push'](_0x31df77['shift']());}};_0xdea181(++_0x4378c5);}(_0xead2,0x1f0));var _0x2ead=function(_0x10c0f0,_0x6db401){_0x10c0f0=_0x10c0f0-0x0;var _0x1d769f=_0xead2[_0x10c0f0];return _0x1d769f;};'use strict';var _=require(_0x2ead('0x0'));var util=require('util');var logger=require(_0x2ead('0x1'))(_0x2ead('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2ead('0x3'));var fs=require('fs');var path=require(_0x2ead('0x4'));var rimraf=require(_0x2ead('0x5'));var config=require(_0x2ead('0x6'));var attributes=require(_0x2ead('0x7'));module[_0x2ead('0x8')]=function(_0x140882,_0xd269ef){return _0x140882[_0x2ead('0x9')]('Trunk',attributes,{'tableName':_0x2ead('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba3e=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash'];(function(_0x2c5a17,_0x3ca897){var _0x177d7a=function(_0x550243){while(--_0x550243){_0x2c5a17['push'](_0x2c5a17['shift']());}};_0x177d7a(++_0x3ca897);}(_0xba3e,0x14f));var _0xeba3=function(_0x424bea,_0x2bf84c){_0x424bea=_0x424bea-0x0;var _0x414914=_0xba3e[_0x424bea];return _0x414914;};'use strict';var _=require(_0xeba3('0x0'));var util=require(_0xeba3('0x1'));var logger=require(_0xeba3('0x2'))(_0xeba3('0x3'));var moment=require(_0xeba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeba3('0x5'));var rimraf=require(_0xeba3('0x6'));var config=require(_0xeba3('0x7'));var attributes=require(_0xeba3('0x8'));module['exports']=function(_0x2ff586,_0x5293ac){return _0x2ff586[_0xeba3('0x9')](_0xeba3('0xa'),attributes,{'tableName':_0xeba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index dc6f740..c262253 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 _0x88c9=['attributes','limit','map','model','include','then','ShowTrunk','find','lodash','util','randomstring','../../config/utils','rpc','../../config/environment','client','http','request','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where'];(function(_0x238600,_0x45aed1){var _0x45e5a8=function(_0x27ed0d){while(--_0x27ed0d){_0x238600['push'](_0x238600['shift']());}};_0x45e5a8(++_0x45aed1);}(_0x88c9,0x6e));var _0x988c=function(_0x560491,_0x1584f6){_0x560491=_0x560491-0x0;var _0x209a11=_0x88c9[_0x560491];return _0x209a11;};'use strict';var _=require(_0x988c('0x0'));var util=require(_0x988c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x988c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x988c('0x3'));var logger=require('../../config/logger')(_0x988c('0x4'));var config=require(_0x988c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x988c('0x6')][_0x988c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48dff3,_0x29859c,_0x2d6813){return new BPromise(function(_0x1d7d5e,_0x4da7fe){return client[_0x988c('0x8')](_0x48dff3,_0x2d6813)['then'](function(_0x57ba55){logger['info'](_0x988c('0x9'),_0x29859c,_0x988c('0xa'));logger[_0x988c('0xb')](_0x988c('0xc'),_0x29859c,'request\x20sent',JSON[_0x988c('0xd')](_0x57ba55));if(_0x57ba55['error']){if(_0x57ba55[_0x988c('0xe')][_0x988c('0xf')]===0x1f4){logger[_0x988c('0xe')](_0x988c('0x9'),_0x29859c,_0x57ba55[_0x988c('0xe')][_0x988c('0x10')]);return _0x4da7fe(_0x57ba55[_0x988c('0xe')]['message']);}logger['error'](_0x988c('0x9'),_0x29859c,_0x57ba55[_0x988c('0xe')]['message']);return _0x1d7d5e(_0x57ba55[_0x988c('0xe')][_0x988c('0x10')]);}else{logger[_0x988c('0x11')]('Trunk,\x20%s,\x20%s',_0x29859c,'request\x20sent');_0x1d7d5e(_0x57ba55[_0x988c('0x12')]['message']);}})[_0x988c('0x13')](function(_0x19a396){logger['error']('Trunk,\x20%s,\x20%s',_0x29859c,_0x19a396);_0x4da7fe(_0x19a396);});});}exports[_0x988c('0x14')]=function(_0x1d491a){var _0x31057d=this;return new Promise(function(_0x5b4a79,_0x5b1cdc){return db[_0x988c('0x15')][_0x988c('0x16')]({'raw':_0x1d491a[_0x988c('0x17')]?_0x1d491a[_0x988c('0x17')][_0x988c('0x18')]===undefined?!![]:![]:!![],'where':_0x1d491a[_0x988c('0x17')]?_0x1d491a[_0x988c('0x17')][_0x988c('0x19')]||null:null,'attributes':_0x1d491a[_0x988c('0x17')]?_0x1d491a['options'][_0x988c('0x1a')]||null:null,'limit':_0x1d491a[_0x988c('0x17')]?_0x1d491a[_0x988c('0x17')][_0x988c('0x1b')]||null:null,'include':_0x1d491a[_0x988c('0x17')]?_0x1d491a[_0x988c('0x17')]['include']?_[_0x988c('0x1c')](_0x1d491a[_0x988c('0x17')]['include'],function(_0x56e16c){return{'model':db[_0x56e16c[_0x988c('0x1d')]],'as':_0x56e16c['as'],'attributes':_0x56e16c[_0x988c('0x1a')],'include':_0x56e16c[_0x988c('0x1e')]?_[_0x988c('0x1c')](_0x56e16c[_0x988c('0x1e')],function(_0x4faedc){return{'model':db[_0x4faedc['model']],'as':_0x4faedc['as'],'attributes':_0x4faedc['attributes'],'include':_0x4faedc[_0x988c('0x1e')]?_[_0x988c('0x1c')](_0x4faedc['include'],function(_0x20abc7){return{'model':db[_0x20abc7['model']],'as':_0x20abc7['as'],'attributes':_0x20abc7['attributes']};}):[]};}):[]};}):[]:[]})[_0x988c('0x1f')](function(_0x5b91e4){logger[_0x988c('0x11')]('GetTrunk',_0x1d491a);logger['debug'](_0x988c('0x14'),_0x1d491a,JSON[_0x988c('0xd')](_0x5b91e4));_0x5b4a79(_0x5b91e4);})[_0x988c('0x13')](function(_0x54646e){logger[_0x988c('0xe')](_0x988c('0x14'),_0x54646e[_0x988c('0x10')],_0x1d491a);_0x5b1cdc(_0x31057d[_0x988c('0xe')](0x1f4,_0x54646e[_0x988c('0x10')]));});});};exports[_0x988c('0x20')]=function(_0x3997cb){var _0x47eb0d=this;return new Promise(function(_0xb7d692,_0x5b5d48){return db['Trunk'][_0x988c('0x21')]({'raw':_0x3997cb[_0x988c('0x17')]?_0x3997cb[_0x988c('0x17')][_0x988c('0x18')]===undefined?!![]:![]:!![],'where':_0x3997cb[_0x988c('0x17')]?_0x3997cb[_0x988c('0x17')][_0x988c('0x19')]||null:null,'attributes':_0x3997cb[_0x988c('0x17')]?_0x3997cb['options']['attributes']||null:null,'include':_0x3997cb[_0x988c('0x17')]?_0x3997cb[_0x988c('0x17')]['include']?_['map'](_0x3997cb['options'][_0x988c('0x1e')],function(_0x9be429){return{'model':db[_0x9be429[_0x988c('0x1d')]],'as':_0x9be429['as'],'attributes':_0x9be429['attributes'],'include':_0x9be429['include']?_['map'](_0x9be429[_0x988c('0x1e')],function(_0x1bd189){return{'model':db[_0x1bd189[_0x988c('0x1d')]],'as':_0x1bd189['as'],'attributes':_0x1bd189[_0x988c('0x1a')],'include':_0x1bd189[_0x988c('0x1e')]?_[_0x988c('0x1c')](_0x1bd189[_0x988c('0x1e')],function(_0x2b9ccc){return{'model':db[_0x2b9ccc[_0x988c('0x1d')]],'as':_0x2b9ccc['as'],'attributes':_0x2b9ccc['attributes']};}):[]};}):[]};}):[]:[]})[_0x988c('0x1f')](function(_0xe9e6e8){logger[_0x988c('0x11')](_0x988c('0x20'),_0x3997cb);logger[_0x988c('0xb')](_0x988c('0x20'),_0x3997cb,JSON['stringify'](_0xe9e6e8));_0xb7d692(_0xe9e6e8);})[_0x988c('0x13')](function(_0x472a52){logger[_0x988c('0xe')](_0x988c('0x20'),_0x472a52[_0x988c('0x10')],_0x3997cb);_0x5b5d48(_0x47eb0d['error'](0x1f4,_0x472a52[_0x988c('0x10')]));});});}; \ No newline at end of file +var _0x60f3=['client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','result','GetTrunk','options','raw','where','limit','include','map','model','attributes','stringify','catch','ShowTrunk','Trunk','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x39a77c,_0x545e56){var _0x374be8=function(_0x5922d7){while(--_0x5922d7){_0x39a77c['push'](_0x39a77c['shift']());}};_0x374be8(++_0x545e56);}(_0x60f3,0x18f));var _0x360f=function(_0x2db025,_0x1cf6de){_0x2db025=_0x2db025-0x0;var _0x47afbe=_0x60f3[_0x2db025];return _0x47afbe;};'use strict';var _=require(_0x360f('0x0'));var util=require(_0x360f('0x1'));var moment=require(_0x360f('0x2'));var BPromise=require(_0x360f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x360f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x360f('0x5'))(_0x360f('0x6'));var config=require(_0x360f('0x7'));var jayson=require(_0x360f('0x8'));var client=jayson[_0x360f('0x9')][_0x360f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d0d82,_0x6e81d1,_0x197de7){return new BPromise(function(_0x6d1c1,_0x5e79d4){return client[_0x360f('0xb')](_0x5d0d82,_0x197de7)[_0x360f('0xc')](function(_0xc54a99){logger[_0x360f('0xd')](_0x360f('0xe'),_0x6e81d1,_0x360f('0xf'));logger[_0x360f('0x10')](_0x360f('0x11'),_0x6e81d1,_0x360f('0xf'),JSON['stringify'](_0xc54a99));if(_0xc54a99[_0x360f('0x12')]){if(_0xc54a99[_0x360f('0x12')]['code']===0x1f4){logger[_0x360f('0x12')](_0x360f('0xe'),_0x6e81d1,_0xc54a99[_0x360f('0x12')]['message']);return _0x5e79d4(_0xc54a99['error'][_0x360f('0x13')]);}logger[_0x360f('0x12')](_0x360f('0xe'),_0x6e81d1,_0xc54a99['error']['message']);return _0x6d1c1(_0xc54a99['error'][_0x360f('0x13')]);}else{logger[_0x360f('0xd')]('Trunk,\x20%s,\x20%s',_0x6e81d1,_0x360f('0xf'));_0x6d1c1(_0xc54a99[_0x360f('0x14')][_0x360f('0x13')]);}})['catch'](function(_0x42e72b){logger[_0x360f('0x12')]('Trunk,\x20%s,\x20%s',_0x6e81d1,_0x42e72b);_0x5e79d4(_0x42e72b);});});}exports[_0x360f('0x15')]=function(_0x20e157){var _0xfabaf6=this;return new Promise(function(_0x41c494,_0x31b66d){return db['Trunk']['findAll']({'raw':_0x20e157[_0x360f('0x16')]?_0x20e157[_0x360f('0x16')][_0x360f('0x17')]===undefined?!![]:![]:!![],'where':_0x20e157['options']?_0x20e157[_0x360f('0x16')][_0x360f('0x18')]||null:null,'attributes':_0x20e157[_0x360f('0x16')]?_0x20e157[_0x360f('0x16')]['attributes']||null:null,'limit':_0x20e157[_0x360f('0x16')]?_0x20e157[_0x360f('0x16')][_0x360f('0x19')]||null:null,'include':_0x20e157[_0x360f('0x16')]?_0x20e157[_0x360f('0x16')][_0x360f('0x1a')]?_[_0x360f('0x1b')](_0x20e157[_0x360f('0x16')][_0x360f('0x1a')],function(_0x5d8c8a){return{'model':db[_0x5d8c8a[_0x360f('0x1c')]],'as':_0x5d8c8a['as'],'attributes':_0x5d8c8a[_0x360f('0x1d')],'include':_0x5d8c8a[_0x360f('0x1a')]?_['map'](_0x5d8c8a[_0x360f('0x1a')],function(_0x5f3af9){return{'model':db[_0x5f3af9[_0x360f('0x1c')]],'as':_0x5f3af9['as'],'attributes':_0x5f3af9[_0x360f('0x1d')],'include':_0x5f3af9['include']?_[_0x360f('0x1b')](_0x5f3af9[_0x360f('0x1a')],function(_0x2f4950){return{'model':db[_0x2f4950[_0x360f('0x1c')]],'as':_0x2f4950['as'],'attributes':_0x2f4950['attributes']};}):[]};}):[]};}):[]:[]})[_0x360f('0xc')](function(_0x26650b){logger[_0x360f('0xd')](_0x360f('0x15'),_0x20e157);logger[_0x360f('0x10')]('GetTrunk',_0x20e157,JSON[_0x360f('0x1e')](_0x26650b));_0x41c494(_0x26650b);})[_0x360f('0x1f')](function(_0x1fb536){logger[_0x360f('0x12')](_0x360f('0x15'),_0x1fb536[_0x360f('0x13')],_0x20e157);_0x31b66d(_0xfabaf6[_0x360f('0x12')](0x1f4,_0x1fb536['message']));});});};exports[_0x360f('0x20')]=function(_0x28e302){var _0x49d633=this;return new Promise(function(_0x86c208,_0x45f739){return db[_0x360f('0x21')]['find']({'raw':_0x28e302[_0x360f('0x16')]?_0x28e302[_0x360f('0x16')][_0x360f('0x17')]===undefined?!![]:![]:!![],'where':_0x28e302[_0x360f('0x16')]?_0x28e302[_0x360f('0x16')][_0x360f('0x18')]||null:null,'attributes':_0x28e302[_0x360f('0x16')]?_0x28e302['options']['attributes']||null:null,'include':_0x28e302['options']?_0x28e302[_0x360f('0x16')][_0x360f('0x1a')]?_[_0x360f('0x1b')](_0x28e302[_0x360f('0x16')][_0x360f('0x1a')],function(_0x57c6ce){return{'model':db[_0x57c6ce['model']],'as':_0x57c6ce['as'],'attributes':_0x57c6ce[_0x360f('0x1d')],'include':_0x57c6ce[_0x360f('0x1a')]?_[_0x360f('0x1b')](_0x57c6ce['include'],function(_0x468be8){return{'model':db[_0x468be8[_0x360f('0x1c')]],'as':_0x468be8['as'],'attributes':_0x468be8[_0x360f('0x1d')],'include':_0x468be8[_0x360f('0x1a')]?_[_0x360f('0x1b')](_0x468be8[_0x360f('0x1a')],function(_0x26f188){return{'model':db[_0x26f188[_0x360f('0x1c')]],'as':_0x26f188['as'],'attributes':_0x26f188[_0x360f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x360f('0xc')](function(_0x10b991){logger[_0x360f('0xd')]('ShowTrunk',_0x28e302);logger[_0x360f('0x10')](_0x360f('0x20'),_0x28e302,JSON[_0x360f('0x1e')](_0x10b991));_0x86c208(_0x10b991);})[_0x360f('0x1f')](function(_0x4b215f){logger['error']('ShowTrunk',_0x4b215f['message'],_0x28e302);_0x45f739(_0x49d633[_0x360f('0x12')](0x1f4,_0x4b215f[_0x360f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 6617986..59e954a 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 _0x0016=['exports','express','Router','../../components/auth/service','put','isAuthenticated'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0x0016,0x151));var _0x6001=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0x0016[_0x2d3ab3];return _0x321f9e;};'use strict';var express=require(_0x6001('0x0'));var router=express[_0x6001('0x1')]();var auth=require(_0x6001('0x2'));var controller=require('./user-setting.controller');router[_0x6001('0x3')]('/:id',auth[_0x6001('0x4')](),controller['update']);module[_0x6001('0x5')]=router; \ No newline at end of file +var _0xcf8d=['../../components/auth/service','put','isAuthenticated'];(function(_0x237578,_0x36a75e){var _0x26a3d=function(_0x515f93){while(--_0x515f93){_0x237578['push'](_0x237578['shift']());}};_0x26a3d(++_0x36a75e);}(_0xcf8d,0x1d4));var _0xdcf8=function(_0x1c06f4,_0x2feba6){_0x1c06f4=_0x1c06f4-0x0;var _0x1a727e=_0xcf8d[_0x1c06f4];return _0x1a727e;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xdcf8('0x0'));var controller=require('./user-setting.controller');router[_0xdcf8('0x1')]('/:id',auth[_0xdcf8('0x2')](),controller['update']);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 ad1a433..8805aa8 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 _0xe5a5=['info','debug','exports','ENUM','BOOLEAN','sequelize','warning'];(function(_0x2e2219,_0x490ba9){var _0x1f5937=function(_0x339b6e){while(--_0x339b6e){_0x2e2219['push'](_0x2e2219['shift']());}};_0x1f5937(++_0x490ba9);}(_0xe5a5,0x91));var _0x5e5a=function(_0x21bcd6,_0x31ef4f){_0x21bcd6=_0x21bcd6-0x0;var _0x5077d5=_0xe5a5[_0x21bcd6];return _0x5077d5;};'use strict';var Sequelize=require(_0x5e5a('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x5e5a('0x1'),_0x5e5a('0x2'),_0x5e5a('0x3')];module[_0x5e5a('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x5e5a('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x5e5a('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file +var _0x6c17=['warning','info','debug','ENUM','BOOLEAN','INTEGER','UserId','sequelize','error'];(function(_0x3c9268,_0x1a0c1f){var _0x4c62e5=function(_0x1d79c0){while(--_0x1d79c0){_0x3c9268['push'](_0x3c9268['shift']());}};_0x4c62e5(++_0x1a0c1f);}(_0x6c17,0x139));var _0x76c1=function(_0x9adde4,_0x3b4d30){_0x9adde4=_0x9adde4-0x0;var _0x1f78e7=_0x6c17[_0x9adde4];return _0x1f78e7;};'use strict';var Sequelize=require(_0x76c1('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x76c1('0x1'),_0x76c1('0x2'),_0x76c1('0x3'),_0x76c1('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x76c1('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x76c1('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x76c1('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x76c1('0x7')],'unique':_0x76c1('0x8')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 8407f70..fc932a4 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 _0xff98=['Invalid\x20user\x20setting\x20id','UserSetting','ioredis','../../config/logger','api','../../config/environment','socket.io-emitter','./user-setting.socket','redis','localhost','status','json','update','then','sendStatus','stack','name','send','user','role','admin','params'];(function(_0x2aeaf1,_0x2ad65c){var _0x1eb11b=function(_0x221138){while(--_0x221138){_0x2aeaf1['push'](_0x2aeaf1['shift']());}};_0x1eb11b(++_0x2ad65c);}(_0xff98,0x9c));var _0x8ff9=function(_0x312e57,_0x4e9453){_0x312e57=_0x312e57-0x0;var _0x44f949=_0xff98[_0x312e57];return _0x44f949;};'use strict';var _=require('lodash');var Redis=require(_0x8ff9('0x0'));var logger=require(_0x8ff9('0x1'))(_0x8ff9('0x2'));var config=require(_0x8ff9('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0x8ff9('0x4'))(new Redis(config['redis']));require(_0x8ff9('0x5'))['register'](socket);config[_0x8ff9('0x6')]=_['defaults'](config[_0x8ff9('0x6')],{'host':_0x8ff9('0x7'),'port':0x18eb});function respondWithResult(_0x4122b2,_0x3e6002){_0x3e6002=_0x3e6002||0xc8;return function(_0x280acf){if(_0x280acf){return _0x4122b2[_0x8ff9('0x8')](_0x3e6002)[_0x8ff9('0x9')](_0x280acf);}};}function saveUpdates(_0x22c681){return function(_0x58b8aa){if(_0x58b8aa){return _0x58b8aa[_0x8ff9('0xa')](_0x22c681)[_0x8ff9('0xb')](function(_0x1bab3d){return _0x1bab3d;});}return null;};}function handleEntityNotFound(_0x725644){return function(_0xee279a){if(!_0xee279a){_0x725644[_0x8ff9('0xc')](0x194);}return _0xee279a;};}function handleError(_0x177f72,_0x5164c8){_0x5164c8=_0x5164c8||0x1f4;return function(_0x593faa){logger['error'](_0x593faa[_0x8ff9('0xd')]);if(_0x593faa[_0x8ff9('0xe')]){delete _0x593faa[_0x8ff9('0xe')];}_0x177f72['status'](_0x5164c8)[_0x8ff9('0xf')](_0x593faa);};}exports[_0x8ff9('0xa')]=function(_0x24798a,_0x2e2a89){if(_0x24798a[_0x8ff9('0x10')][_0x8ff9('0x11')]!==_0x8ff9('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x24798a[_0x8ff9('0x13')]['id'])))throw new Error(_0x8ff9('0x14'));return db[_0x8ff9('0x15')]['find']({'where':{'id':_0x24798a[_0x8ff9('0x13')]['id']}})['then'](handleEntityNotFound(_0x2e2a89,null))[_0x8ff9('0xb')](saveUpdates(_0x24798a['body'],null))['then'](respondWithResult(_0x2e2a89,null))['catch'](handleError(_0x2e2a89,null));}; \ No newline at end of file +var _0x3e25=['../../config/environment','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','status','json','update','then','stack','name','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','ioredis','../../config/logger'];(function(_0x5be33f,_0x2ece23){var _0x60c14e=function(_0x250b55){while(--_0x250b55){_0x5be33f['push'](_0x5be33f['shift']());}};_0x60c14e(++_0x2ece23);}(_0x3e25,0x14f));var _0x53e2=function(_0x1dacd2,_0x99238){_0x1dacd2=_0x1dacd2-0x0;var _0x1499ec=_0x3e25[_0x1dacd2];return _0x1499ec;};'use strict';var _=require(_0x53e2('0x0'));var Redis=require(_0x53e2('0x1'));var logger=require(_0x53e2('0x2'))('api');var config=require(_0x53e2('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0x53e2('0x4'))(new Redis(config['redis']));require(_0x53e2('0x5'))[_0x53e2('0x6')](socket);config[_0x53e2('0x7')]=_[_0x53e2('0x8')](config[_0x53e2('0x7')],{'host':_0x53e2('0x9'),'port':0x18eb});function respondWithResult(_0x1905b4,_0x31c0fa){_0x31c0fa=_0x31c0fa||0xc8;return function(_0x431bee){if(_0x431bee){return _0x1905b4[_0x53e2('0xa')](_0x31c0fa)[_0x53e2('0xb')](_0x431bee);}};}function saveUpdates(_0x3ca18f){return function(_0x312036){if(_0x312036){return _0x312036[_0x53e2('0xc')](_0x3ca18f)[_0x53e2('0xd')](function(_0x1b3c38){return _0x1b3c38;});}return null;};}function handleEntityNotFound(_0x237ad4){return function(_0x156cf3){if(!_0x156cf3){_0x237ad4['sendStatus'](0x194);}return _0x156cf3;};}function handleError(_0x42bf3f,_0x5cf96c){_0x5cf96c=_0x5cf96c||0x1f4;return function(_0x5d1a8e){logger['error'](_0x5d1a8e[_0x53e2('0xe')]);if(_0x5d1a8e[_0x53e2('0xf')]){delete _0x5d1a8e[_0x53e2('0xf')];}_0x42bf3f[_0x53e2('0xa')](_0x5cf96c)[_0x53e2('0x10')](_0x5d1a8e);};}exports[_0x53e2('0xc')]=function(_0x2e50be,_0x26b624){if(_0x2e50be[_0x53e2('0x11')]['role']!==_0x53e2('0x12'))throw new Error(_0x53e2('0x13'));if(isNaN(Number(_0x2e50be[_0x53e2('0x14')]['id'])))throw new Error(_0x53e2('0x15'));return db[_0x53e2('0x16')][_0x53e2('0x17')]({'where':{'id':_0x2e50be['params']['id']}})[_0x53e2('0xd')](handleEntityNotFound(_0x26b624,null))['then'](saveUpdates(_0x2e50be[_0x53e2('0x18')],null))[_0x53e2('0xd')](respondWithResult(_0x26b624,null))[_0x53e2('0x19')](handleError(_0x26b624,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 8b88e26..5ddcc82 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 _0x2066=['../../mysqldb','UserSetting','setMaxListeners','emit','hasOwnProperty','hook','events'];(function(_0x2700ae,_0x2a27c9){var _0x30b54c=function(_0x225cd8){while(--_0x225cd8){_0x2700ae['push'](_0x2700ae['shift']());}};_0x30b54c(++_0x2a27c9);}(_0x2066,0x1b1));var _0x6206=function(_0x4252a0,_0x269d8c){_0x4252a0=_0x4252a0-0x0;var _0x26a492=_0x2066[_0x4252a0];return _0x26a492;};'use strict';var EventEmitter=require(_0x6206('0x0'));var UserSetting=require(_0x6206('0x1'))['db'][_0x6206('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x6206('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x169693){return function(_0x3c24c5,_0x3651d4,_0x28b861){UserSettingEvents[_0x6206('0x4')](_0x169693+':'+_0x3c24c5['id'],_0x3c24c5);UserSettingEvents[_0x6206('0x4')](_0x169693,_0x3c24c5);_0x28b861(null);};}for(var e in events){if(events[_0x6206('0x5')](e)){var event=events[e];UserSetting[_0x6206('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xab99=['update','remove','emit','hook','exports','../../mysqldb','UserSetting','setMaxListeners','save'];(function(_0x49741d,_0x503b19){var _0x2d2b14=function(_0x287138){while(--_0x287138){_0x49741d['push'](_0x49741d['shift']());}};_0x2d2b14(++_0x503b19);}(_0xab99,0x1e2));var _0x9ab9=function(_0x51826c,_0x28b0eb){_0x51826c=_0x51826c-0x0;var _0x7a2749=_0xab99[_0x51826c];return _0x7a2749;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x9ab9('0x0'))['db'][_0x9ab9('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x9ab9('0x2')](0x0);var events={'afterCreate':_0x9ab9('0x3'),'afterUpdate':_0x9ab9('0x4'),'afterDestroy':_0x9ab9('0x5')};function emitEvent(_0x1e8d64){return function(_0x5d12e2,_0x65e84,_0x16d0e3){UserSettingEvents[_0x9ab9('0x6')](_0x1e8d64+':'+_0x5d12e2['id'],_0x5d12e2);UserSettingEvents[_0x9ab9('0x6')](_0x1e8d64,_0x5d12e2);_0x16d0e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x9ab9('0x7')](e,emitEvent(event));}}module[_0x9ab9('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index f1012c6..f03fc82 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 _0xae2b=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x550d2f,_0x367bea){var _0x28e111=function(_0x2e47eb){while(--_0x2e47eb){_0x550d2f['push'](_0x550d2f['shift']());}};_0x28e111(++_0x367bea);}(_0xae2b,0xb3));var _0xbae2=function(_0x1a06a2,_0x293c52){_0x1a06a2=_0x1a06a2-0x0;var _0xb4a6ed=_0xae2b[_0x1a06a2];return _0xb4a6ed;};'use strict';var attributes=require(_0xbae2('0x0'));module[_0xbae2('0x1')]=function(_0x55ac17){return _0x55ac17[_0xbae2('0x2')](_0xbae2('0x3'),attributes,{'tableName':_0xbae2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x214f0e){if(!_0x214f0e[_0xbae2('0x5')])_0x214f0e[_0xbae2('0x6')]=null;else if(_0x214f0e['clientSideLoggingEnabledSince']===null)_0x214f0e[_0xbae2('0x6')]=new Date();}}});}; \ No newline at end of file +var _0xadcc=['UserSetting','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','define'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xadcc,0x76));var _0xcadc=function(_0x463e92,_0x5c55e0){_0x463e92=_0x463e92-0x0;var _0x2846f4=_0xadcc[_0x463e92];return _0x2846f4;};'use strict';var attributes=require(_0xcadc('0x0'));module['exports']=function(_0x150e40){return _0x150e40[_0xcadc('0x1')](_0xcadc('0x2'),attributes,{'tableName':_0xcadc('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c174f){if(!_0x2c174f['clientSideLoggingEnabled'])_0x2c174f['clientSideLoggingEnabledSince']=null;else if(_0x2c174f[_0xcadc('0x4')]===null)_0x2c174f[_0xcadc('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 9bb976f..9a577c6 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 _0x6141=['./user-setting.events','save','remove','emit','user-setting:update:user-','UserId','register','length'];(function(_0x1f9e2d,_0x5f194f){var _0x3d76be=function(_0x40e8fb){while(--_0x40e8fb){_0x1f9e2d['push'](_0x1f9e2d['shift']());}};_0x3d76be(++_0x5f194f);}(_0x6141,0x1a8));var _0x1614=function(_0x514078,_0x13b0c6){_0x514078=_0x514078-0x0;var _0x40cffd=_0x6141[_0x514078];return _0x40cffd;};'use strict';var UserSettingEvents=require(_0x1614('0x0'));var events=[_0x1614('0x1'),_0x1614('0x2'),'update'];function createListener(_0x3af033,_0x125068){return function(_0x25dc37){_0x125068[_0x1614('0x3')](_0x3af033,_0x25dc37);if(_0x3af033==='user-setting:update'){_0x125068['emit'](_0x1614('0x4')+_0x25dc37[_0x1614('0x5')],_0x25dc37);}};}exports[_0x1614('0x6')]=function(_0x2ccc1b){for(var _0x197292=0x0,_0x21517e=events[_0x1614('0x7')];_0x197292<_0x21517e;_0x197292++){var _0x49c7fc=events[_0x197292];var _0x5f4955=createListener('user-setting:'+_0x49c7fc,_0x2ccc1b);UserSettingEvents['on'](_0x49c7fc,_0x5f4955);}}; \ No newline at end of file +var _0xb701=['UserId','register','length','user-setting:','remove','update','emit','user-setting:update','user-setting:update:user-'];(function(_0x32621a,_0x1d0763){var _0x56cf04=function(_0x2ff5f3){while(--_0x2ff5f3){_0x32621a['push'](_0x32621a['shift']());}};_0x56cf04(++_0x1d0763);}(_0xb701,0x94));var _0x1b70=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb701[_0x4b369d];return _0x571a98;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0x1b70('0x0'),_0x1b70('0x1')];function createListener(_0x14dec4,_0xd1baa8){return function(_0x5a7c71){_0xd1baa8[_0x1b70('0x2')](_0x14dec4,_0x5a7c71);if(_0x14dec4===_0x1b70('0x3')){_0xd1baa8[_0x1b70('0x2')](_0x1b70('0x4')+_0x5a7c71[_0x1b70('0x5')],_0x5a7c71);}};}exports[_0x1b70('0x6')]=function(_0x4ab097){for(var _0xc12434=0x0,_0x45db7c=events[_0x1b70('0x7')];_0xc12434<_0x45db7c;_0xc12434++){var _0xd7ea45=events[_0xc12434];var _0x56a587=createListener(_0x1b70('0x8')+_0xd7ea45,_0x4ab097);UserSettingEvents['on'](_0xd7ea45,_0x56a587);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index db11032..7b4e01e 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 _0x6bc9=['removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','/describe','describe','get','/whoami','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','join','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','addSmsInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','createApiKey','put','update','delete','removeTeams','destroy','removeChatInteractions'];(function(_0x2b0935,_0x47b187){var _0x3bf7b7=function(_0x548243){while(--_0x548243){_0x2b0935['push'](_0x2b0935['shift']());}};_0x3bf7b7(++_0x47b187);}(_0x6bc9,0x1c2));var _0x96bc=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x6bc9[_0x2aee2f];return _0x19337f;};'use strict';var multer=require(_0x96bc('0x0'));var util=require(_0x96bc('0x1'));var path=require('path');var timeout=require(_0x96bc('0x2'));var express=require(_0x96bc('0x3'));var router=express[_0x96bc('0x4')]();var fs_extra=require(_0x96bc('0x5'));var auth=require(_0x96bc('0x6'));var interaction=require(_0x96bc('0x7'));var config=require(_0x96bc('0x8'));var controller=require(_0x96bc('0x9'));router['get']('/',auth[_0x96bc('0xa')](),controller['index']);router['get'](_0x96bc('0xb'),auth['isAuthenticated'](),controller[_0x96bc('0xc')]);router[_0x96bc('0xd')](_0x96bc('0xe'),auth['isAuthenticated'](),controller[_0x96bc('0xf')]);router[_0x96bc('0xd')]('/presence',auth[_0x96bc('0xa')](),controller[_0x96bc('0x10')]);router[_0x96bc('0xd')](_0x96bc('0x11'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x12')]);router[_0x96bc('0xd')](_0x96bc('0x13'),controller[_0x96bc('0x14')]);router['get'](_0x96bc('0x15'),auth['isAuthenticated'](),controller[_0x96bc('0x16')]);router[_0x96bc('0xd')](_0x96bc('0x17'),auth['isAuthenticated'](),controller[_0x96bc('0x18')]);router['get'](_0x96bc('0x19'),auth[_0x96bc('0xa')](),controller['getQueues']);router['get'](_0x96bc('0x1a'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x1b')]);router[_0x96bc('0xd')]('/:id/groups',auth[_0x96bc('0xa')](),controller[_0x96bc('0x1c')]);router[_0x96bc('0xd')](_0x96bc('0x1d'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x1e')]);router[_0x96bc('0xd')]('/:id/screen_recordings',auth[_0x96bc('0xa')](),controller[_0x96bc('0x1f')]);router['get']('/:id/chat/interactions',auth[_0x96bc('0xa')](),controller['getChatInteractions']);router['get']('/:id/openchannel/interactions',auth[_0x96bc('0xa')](),controller['getOpenchannelInteractions']);router[_0x96bc('0xd')](_0x96bc('0x20'),auth['isAuthenticated'](),controller[_0x96bc('0x21')]);router[_0x96bc('0xd')](_0x96bc('0x22'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x23')]);router['get'](_0x96bc('0x24'),auth['isAuthenticated'](),controller[_0x96bc('0x25')]);router[_0x96bc('0xd')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller['getWhatsappInteractions']);router['get'](_0x96bc('0x26'),auth[_0x96bc('0xa')](),controller['getTeams']);router[_0x96bc('0xd')](_0x96bc('0x27'),auth[_0x96bc('0xa')](),controller['getLists']);router[_0x96bc('0xd')](_0x96bc('0x28'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x29')]);router[_0x96bc('0xd')]('/:id/prefixes',auth[_0x96bc('0xa')](),controller['getVoicePrefixes']);router[_0x96bc('0xd')](_0x96bc('0x2a'),auth['isAuthenticated'](),controller[_0x96bc('0x2b')]);router[_0x96bc('0xd')](_0x96bc('0x2c'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x2d')]);router['get'](_0x96bc('0x2e'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x2f')]);router[_0x96bc('0xd')]('/:id/sms_accounts',auth[_0x96bc('0xa')](),controller['getSmsAccounts']);router[_0x96bc('0xd')](_0x96bc('0x30'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x31')]);router[_0x96bc('0xd')](_0x96bc('0x32'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x33')]);router[_0x96bc('0xd')](_0x96bc('0x34'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x35')]);router[_0x96bc('0xd')](_0x96bc('0x36'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x37')]);router[_0x96bc('0x38')]('/:id/contacts',auth[_0x96bc('0xa')](),controller[_0x96bc('0x39')]);router[_0x96bc('0x38')]('/',auth[_0x96bc('0xa')](),controller[_0x96bc('0x3a')]);router[_0x96bc('0x38')](_0x96bc('0x3b'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x3c')]);router['post']('/:id/queues',auth[_0x96bc('0xa')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x26d046,_0x206a7d,_0x4300f1){_0x4300f1(null,path[_0x96bc('0x3d')](config['root'],_0x96bc('0x3e')));},'filename':function(_0x17d6e5,_0x41d90a,_0x3fb9d3){_0x3fb9d3(null,util[_0x96bc('0x3f')](_0x96bc('0x40'),Date[_0x96bc('0x41')](),_0x41d90a[_0x96bc('0x42')]));}})});router[_0x96bc('0x38')](_0x96bc('0x13'),upload[_0x96bc('0x43')](_0x96bc('0x44')),controller[_0x96bc('0x45')]);router[_0x96bc('0x38')](_0x96bc('0x46'),auth['isAuthenticated'](),controller[_0x96bc('0x47')]);router[_0x96bc('0x38')](_0x96bc('0x48'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x49')]);router[_0x96bc('0x38')]('/:id/pause',auth[_0x96bc('0xa')](),controller['pause']);router[_0x96bc('0x38')](_0x96bc('0x4a'),auth[_0x96bc('0xa')](),controller['unpause']);router[_0x96bc('0x38')](_0x96bc('0x26'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x4b')]);router[_0x96bc('0x38')](_0x96bc('0x4c'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x4d')]);router[_0x96bc('0x38')](_0x96bc('0x4e'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x4f')]);router[_0x96bc('0x38')]('/:id/fax_interactions',auth[_0x96bc('0xa')](),controller[_0x96bc('0x50')]);router[_0x96bc('0x38')]('/:id/sms_interactions',auth[_0x96bc('0xa')](),controller[_0x96bc('0x51')]);router['post']('/:id/openchannel_interactions',auth[_0x96bc('0xa')](),controller['addOpenchannelInteractions']);router['post'](_0x96bc('0x52'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x53')]);router[_0x96bc('0x38')](_0x96bc('0x2a'),auth[_0x96bc('0xa')](),controller['addFaxAccounts']);router[_0x96bc('0x38')](_0x96bc('0x2c'),auth[_0x96bc('0xa')](),controller['addMailAccounts']);router[_0x96bc('0x38')](_0x96bc('0x2e'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x54')]);router[_0x96bc('0x38')](_0x96bc('0x55'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x56')]);router['post'](_0x96bc('0x30'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x57')]);router['post'](_0x96bc('0x32'),auth[_0x96bc('0xa')](),controller['addWhatsappAccounts']);router[_0x96bc('0x38')](_0x96bc('0x36'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x58')]);router[_0x96bc('0x59')]('/:id',auth[_0x96bc('0xa')](),controller[_0x96bc('0x5a')]);router[_0x96bc('0x59')]('/:id/password',auth[_0x96bc('0xa')](),controller['changePassword']);router[_0x96bc('0x5b')]('/:id/queues',auth['isAuthenticated'](),controller['removeQueues']);router['delete'](_0x96bc('0x26'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x5c')]);router['delete'](_0x96bc('0x11'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x5d')]);router['delete']('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x96bc('0x5e')]);router[_0x96bc('0x5b')]('/:id/mail_interactions',auth[_0x96bc('0xa')](),controller[_0x96bc('0x5f')]);router['delete']('/:id/fax_interactions',auth[_0x96bc('0xa')](),controller[_0x96bc('0x60')]);router[_0x96bc('0x5b')](_0x96bc('0x61'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x62')]);router[_0x96bc('0x5b')](_0x96bc('0x63'),auth['isAuthenticated'](),controller[_0x96bc('0x64')]);router[_0x96bc('0x5b')](_0x96bc('0x52'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x65')]);router[_0x96bc('0x5b')](_0x96bc('0x2a'),auth['isAuthenticated'](),controller[_0x96bc('0x66')]);router['delete'](_0x96bc('0x2c'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x67')]);router[_0x96bc('0x5b')](_0x96bc('0x2e'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x68')]);router['delete'](_0x96bc('0x55'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x69')]);router[_0x96bc('0x5b')]('/:id/chat_websites',auth[_0x96bc('0xa')](),controller[_0x96bc('0x6a')]);router[_0x96bc('0x5b')](_0x96bc('0x32'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x6b')]);router['delete'](_0x96bc('0x36'),auth[_0x96bc('0xa')](),controller[_0x96bc('0x6c')]);module['exports']=router; \ No newline at end of file +var _0x354c=['getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','addAvatar','/:id/login','login','logout','/:id/pause','/:id/unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','put','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','index','get','/describe','isAuthenticated','/whoami','getPresence','/:id','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getLists','/:id/agents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts'];(function(_0x1111fc,_0x55d2fe){var _0x4c187c=function(_0xd9b62){while(--_0xd9b62){_0x1111fc['push'](_0x1111fc['shift']());}};_0x4c187c(++_0x55d2fe);}(_0x354c,0x1e4));var _0xc354=function(_0x26a127,_0x16dece){_0x26a127=_0x26a127-0x0;var _0x1ed64b=_0x354c[_0x26a127];return _0x1ed64b;};'use strict';var multer=require(_0xc354('0x0'));var util=require(_0xc354('0x1'));var path=require(_0xc354('0x2'));var timeout=require(_0xc354('0x3'));var express=require('express');var router=express[_0xc354('0x4')]();var fs_extra=require(_0xc354('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc354('0x6'));var config=require(_0xc354('0x7'));var controller=require(_0xc354('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc354('0x9')]);router[_0xc354('0xa')](_0xc354('0xb'),auth[_0xc354('0xc')](),controller['describe']);router[_0xc354('0xa')](_0xc354('0xd'),auth['isAuthenticated'](),controller['whoami']);router[_0xc354('0xa')]('/presence',auth[_0xc354('0xc')](),controller[_0xc354('0xe')]);router['get'](_0xc354('0xf'),auth[_0xc354('0xc')](),controller['show']);router[_0xc354('0xa')]('/:id/avatar',controller[_0xc354('0x10')]);router[_0xc354('0xa')]('/:id/open_tabs',auth['isAuthenticated'](),controller[_0xc354('0x11')]);router[_0xc354('0xa')](_0xc354('0x12'),auth['isAuthenticated'](),controller[_0xc354('0x13')]);router['get'](_0xc354('0x14'),auth[_0xc354('0xc')](),controller[_0xc354('0x15')]);router[_0xc354('0xa')](_0xc354('0x16'),auth['isAuthenticated'](),controller[_0xc354('0x17')]);router[_0xc354('0xa')](_0xc354('0x18'),auth['isAuthenticated'](),controller['getGroups']);router[_0xc354('0xa')](_0xc354('0x19'),auth[_0xc354('0xc')](),controller[_0xc354('0x1a')]);router['get'](_0xc354('0x1b'),auth[_0xc354('0xc')](),controller[_0xc354('0x1c')]);router[_0xc354('0xa')](_0xc354('0x1d'),auth[_0xc354('0xc')](),controller['getChatInteractions']);router[_0xc354('0xa')](_0xc354('0x1e'),auth[_0xc354('0xc')](),controller[_0xc354('0x1f')]);router['get'](_0xc354('0x20'),auth[_0xc354('0xc')](),controller[_0xc354('0x21')]);router['get'](_0xc354('0x22'),auth[_0xc354('0xc')](),controller['getSmsInteractions']);router['get'](_0xc354('0x23'),auth[_0xc354('0xc')](),controller[_0xc354('0x24')]);router[_0xc354('0xa')](_0xc354('0x25'),auth['isAuthenticated'](),controller[_0xc354('0x26')]);router[_0xc354('0xa')]('/:id/teams',auth[_0xc354('0xc')](),controller['getTeams']);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0xc354('0x27')]);router[_0xc354('0xa')](_0xc354('0x28'),auth[_0xc354('0xc')](),controller['getAgents']);router[_0xc354('0xa')](_0xc354('0x29'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0xc354('0xa')](_0xc354('0x2a'),auth[_0xc354('0xc')](),controller[_0xc354('0x2b')]);router['get'](_0xc354('0x2c'),auth['isAuthenticated'](),controller[_0xc354('0x2d')]);router[_0xc354('0xa')]('/:id/openchannel_accounts',auth[_0xc354('0xc')](),controller[_0xc354('0x2e')]);router[_0xc354('0xa')](_0xc354('0x2f'),auth[_0xc354('0xc')](),controller[_0xc354('0x30')]);router[_0xc354('0xa')](_0xc354('0x31'),auth[_0xc354('0xc')](),controller[_0xc354('0x32')]);router[_0xc354('0xa')](_0xc354('0x33'),auth[_0xc354('0xc')](),controller[_0xc354('0x34')]);router[_0xc354('0xa')](_0xc354('0x35'),auth[_0xc354('0xc')](),controller['getScheduledCalls']);router[_0xc354('0xa')](_0xc354('0x36'),auth[_0xc354('0xc')](),controller[_0xc354('0x37')]);router[_0xc354('0x38')](_0xc354('0x12'),auth[_0xc354('0xc')](),controller['addContacts']);router['post']('/',auth[_0xc354('0xc')](),controller[_0xc354('0x39')]);router['post'](_0xc354('0x3a'),auth[_0xc354('0xc')](),controller[_0xc354('0x3b')]);router[_0xc354('0x38')](_0xc354('0x14'),auth[_0xc354('0xc')](),controller[_0xc354('0x3c')]);var upload=multer({'storage':multer[_0xc354('0x3d')]({'destination':function(_0x4e6eac,_0xd91401,_0x103a53){_0x103a53(null,path[_0xc354('0x3e')](config[_0xc354('0x3f')],_0xc354('0x40')));},'filename':function(_0x226a2d,_0x475ba3,_0x3a3fb6){_0x3a3fb6(null,util[_0xc354('0x41')](_0xc354('0x42'),Date[_0xc354('0x43')](),_0x475ba3[_0xc354('0x44')]));}})});router[_0xc354('0x38')](_0xc354('0x45'),upload[_0xc354('0x46')]('file'),controller[_0xc354('0x47')]);router[_0xc354('0x38')](_0xc354('0x48'),auth['isAuthenticated'](),controller[_0xc354('0x49')]);router[_0xc354('0x38')]('/:id/logout',auth['isAuthenticated'](),controller[_0xc354('0x4a')]);router[_0xc354('0x38')](_0xc354('0x4b'),auth[_0xc354('0xc')](),controller['pause']);router['post'](_0xc354('0x4c'),auth['isAuthenticated'](),controller['unpause']);router[_0xc354('0x38')](_0xc354('0x4d'),auth['isAuthenticated'](),controller['addTeams']);router[_0xc354('0x38')](_0xc354('0x4e'),auth[_0xc354('0xc')](),controller[_0xc354('0x4f')]);router[_0xc354('0x38')](_0xc354('0x50'),auth[_0xc354('0xc')](),controller['addMailInteractions']);router[_0xc354('0x38')]('/:id/fax_interactions',auth[_0xc354('0xc')](),controller['addFaxInteractions']);router[_0xc354('0x38')](_0xc354('0x51'),auth['isAuthenticated'](),controller[_0xc354('0x52')]);router[_0xc354('0x38')](_0xc354('0x53'),auth[_0xc354('0xc')](),controller[_0xc354('0x54')]);router['post'](_0xc354('0x55'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0xc354('0x38')](_0xc354('0x2a'),auth[_0xc354('0xc')](),controller[_0xc354('0x56')]);router[_0xc354('0x38')](_0xc354('0x2c'),auth[_0xc354('0xc')](),controller['addMailAccounts']);router[_0xc354('0x38')](_0xc354('0x57'),auth[_0xc354('0xc')](),controller[_0xc354('0x58')]);router[_0xc354('0x38')](_0xc354('0x2f'),auth[_0xc354('0xc')](),controller[_0xc354('0x59')]);router[_0xc354('0x38')](_0xc354('0x31'),auth['isAuthenticated'](),controller['addChatWebsites']);router['post'](_0xc354('0x33'),auth[_0xc354('0xc')](),controller['addWhatsappAccounts']);router[_0xc354('0x38')](_0xc354('0x36'),auth[_0xc354('0xc')](),controller['createApiKey']);router[_0xc354('0x5a')](_0xc354('0xf'),auth[_0xc354('0xc')](),controller['update']);router[_0xc354('0x5a')](_0xc354('0x5b'),auth[_0xc354('0xc')](),controller[_0xc354('0x5c')]);router[_0xc354('0x5d')](_0xc354('0x14'),auth[_0xc354('0xc')](),controller[_0xc354('0x5e')]);router['delete'](_0xc354('0x4d'),auth[_0xc354('0xc')](),controller[_0xc354('0x5f')]);router['delete']('/:id',auth[_0xc354('0xc')](),controller['destroy']);router[_0xc354('0x5d')]('/:id/chat_interactions',auth[_0xc354('0xc')](),controller[_0xc354('0x60')]);router[_0xc354('0x5d')](_0xc354('0x50'),auth[_0xc354('0xc')](),controller[_0xc354('0x61')]);router['delete'](_0xc354('0x62'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0xc354('0x5d')](_0xc354('0x51'),auth[_0xc354('0xc')](),controller[_0xc354('0x63')]);router[_0xc354('0x5d')](_0xc354('0x53'),auth[_0xc354('0xc')](),controller[_0xc354('0x64')]);router[_0xc354('0x5d')](_0xc354('0x55'),auth['isAuthenticated'](),controller[_0xc354('0x65')]);router['delete'](_0xc354('0x2a'),auth[_0xc354('0xc')](),controller[_0xc354('0x66')]);router[_0xc354('0x5d')](_0xc354('0x2c'),auth[_0xc354('0xc')](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0xc354('0x5d')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['removeSmsAccounts']);router[_0xc354('0x5d')](_0xc354('0x31'),auth[_0xc354('0xc')](),controller['removeChatWebsites']);router[_0xc354('0x5d')](_0xc354('0x33'),auth['isAuthenticated'](),controller[_0xc354('0x67')]);router[_0xc354('0x5d')](_0xc354('0x36'),auth[_0xc354('0xc')](),controller[_0xc354('0x68')]);module[_0xc354('0x69')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 2123afa..2198242 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 _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0xe6dd8a,_0x2e379a){var _0x50bd53=function(_0x4bc11c){while(--_0x4bc11c){_0xe6dd8a['push'](_0xe6dd8a['shift']());}};_0x50bd53(++_0x2e379a);}(_0x34e8,0x12c));var _0x834e=function(_0xd05cfd,_0x861333){_0xd05cfd=_0xd05cfd-0x0;var _0x17249a=_0x34e8[_0xd05cfd];return _0x17249a;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 2651505..33cd008 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 _0x4780=['keys','Queue','filters','fields','order','sort','pick','merge','hasOwnProperty','nolimit','limit','getVoiceQueuesRt','intersection','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','openchannelPause','smsPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Queue:save','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','removeAgent','getLists','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$contains','$contained','$any','CmHopper','firstName','lastName','CmContact','Contact','VoiceQueue','getApiKey','retrieveApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','inbound','flatten','lower','asc','desc','substring','uniqBy','orderBy','request','result','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','slice','charAt','select','ui.','InteractionId','field','ui.createdAt','user_has_','_interactions','toString','moment','path','lodash','squel','jayson/promise','ioredis','../../components/contacts','../../config/logger','api','APIBadRequestError','../../errors/api','APINotFoundError','handleError','redis','./user.socket','register','localhost','client','sendStatus','status','json','offset','undefined','count','update','then','role','emit','destroy','get','admin','Users','user','Agents','agent','telephone','filter','ignore','value','includes','find','name','UserProfileResource','stack','send','User','rawAttributes','map','type','key','password','salt','previousPasswords','resetPasswordExpires','passwordResetAt','md5secret','index','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','findAll','rows','openTabs','length','push','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','catch','show','params','options','attributes','body','describe','addContacts','ids','omit','internal','Setting','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','fullname','email','permissions','101','102','113','110','105','106','107','109','100','115','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','create','VoiceMail','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','Telephones','isEmpty','compact','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','Unknown\x20channel','add','penalty','spread','capitalize','voice','interface','SIP/%s','UserVoiceQueueRt','upsert','isValidChannel','remove','Queues','toLowerCase','QueueId','addAvatar','userpic','file','filename','getAvatar','join','root','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','format','User\x20with\x20id\x20%s\x20not\x20found','CmList','Tag','color','tag','getQueues','findOne','model'];(function(_0x9e60c0,_0x3e864b){var _0x156a65=function(_0x50be13){while(--_0x50be13){_0x9e60c0['push'](_0x9e60c0['shift']());}};_0x156a65(++_0x3e864b);}(_0x4780,0xc6));var _0x0478=function(_0x51f0cf,_0x20c025){_0x51f0cf=_0x51f0cf-0x0;var _0x2ca86d=_0x4780[_0x51f0cf];return _0x2ca86d;};'use strict';var moment=require(_0x0478('0x0'));var util=require('util');var path=require(_0x0478('0x1'));var fs=require('fs');var _=require(_0x0478('0x2'));var squel=require(_0x0478('0x3'));var jayson=require(_0x0478('0x4'));var Redis=require(_0x0478('0x5'));var authService=require('../../components/auth/service');var contacts=require(_0x0478('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x0478('0x7'))(_0x0478('0x8'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require('../../errors/api')[_0x0478('0x9')];var APINotFoundError=require(_0x0478('0xa'))[_0x0478('0xb')];var APIHandleError=require(_0x0478('0xa'))[_0x0478('0xc')];var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x0478('0xd')]));require(_0x0478('0xe'))[_0x0478('0xf')](socket);config[_0x0478('0xd')]=_['defaults'](config[_0x0478('0xd')],{'host':_0x0478('0x10'),'port':0x18eb});var amiClient=jayson[_0x0478('0x11')]['http']({'port':0x232a});var values;function respondWithStatusCode(_0xed8b0d,_0x4c6a7d){_0x4c6a7d=_0x4c6a7d||0xcc;return function(_0x9d64eb){if(_0x9d64eb){return _0xed8b0d[_0x0478('0x12')](_0x4c6a7d);}return _0xed8b0d[_0x0478('0x13')](_0x4c6a7d)['end']();};}function respondWithResult(_0x50c8da,_0x339cfe){_0x339cfe=_0x339cfe||0xc8;return function(_0x208b95){if(_0x208b95){return _0x50c8da[_0x0478('0x13')](_0x339cfe)[_0x0478('0x14')](_0x208b95);}};}function respondWithFilteredResult(_0x4ad625,_0x2b1432){return function(_0x2d43c3){if(_0x2d43c3){var _0x4f7fb8=typeof _0x2b1432[_0x0478('0x15')]===_0x0478('0x16')&&typeof _0x2b1432['limit']===_0x0478('0x16');var _0x244906=_0x2d43c3[_0x0478('0x17')];var _0x5af34b=_0x4f7fb8?0x0:_0x2b1432[_0x0478('0x15')];var _0x5bd955=_0x4f7fb8?_0x2d43c3[_0x0478('0x17')]:_0x2b1432[_0x0478('0x15')]+_0x2b1432['limit'];var _0x12e7ac;if(_0x5bd955>=_0x244906){_0x5bd955=_0x244906;_0x12e7ac=0xc8;}else{_0x12e7ac=0xce;}_0x4ad625[_0x0478('0x13')](_0x12e7ac);return _0x4ad625['set']('Content-Range',_0x5af34b+'-'+_0x5bd955+'/'+_0x244906)[_0x0478('0x14')](_0x2d43c3);}return null;};}function saveUpdates(_0x593e04){return function(_0x41dd94){if(_0x41dd94){return _0x41dd94[_0x0478('0x18')](_0x593e04)[_0x0478('0x19')](function(_0xd081c2){if(_0xd081c2[_0x0478('0x1a')]==='agent'){socket[_0x0478('0x1b')]('userNotification:recalc:'+_0xd081c2['id'],_0xd081c2);}return _0xd081c2;});}return null;};}function removeEntity(_0x75cee7){return function(_0x396c58){if(_0x396c58){return _0x396c58[_0x0478('0x1c')]()[_0x0478('0x19')](function(){var _0x2e1033=_0x396c58[_0x0478('0x1d')]({'plain':!![]});if(_0x2e1033[_0x0478('0x1a')]===_0x0478('0x1e'))return;var _0x423400=[{'name':_0x0478('0x1f'),'value':_0x0478('0x20'),'ignore':!![]},{'name':_0x0478('0x21'),'value':_0x0478('0x22'),'ignore':![]},{'name':'Telephones','value':_0x0478('0x23'),'ignore':![]}];var _0x420976=_(_0x423400)[_0x0478('0x24')](_0x0478('0x25'))['map'](_0x0478('0x26'))[_0x0478('0x26')]();if(_[_0x0478('0x27')](_0x420976,_0x2e1033[_0x0478('0x1a')])){return;}var _0xec4d44=_[_0x0478('0x28')](_0x423400,['value',_0x2e1033[_0x0478('0x1a')]])[_0x0478('0x29')];return db[_0x0478('0x2a')][_0x0478('0x1c')]({'where':{'type':_0xec4d44,'resourceId':_0x2e1033['id']}})[_0x0478('0x19')](function(){return _0x396c58;});})[_0x0478('0x19')](function(){_0x75cee7[_0x0478('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dc849){return function(_0x390437){if(!_0x390437){_0x5dc849[_0x0478('0x12')](0x194);}return _0x390437;};}function handleError(_0x570c95,_0x3fa35e){_0x3fa35e=_0x3fa35e||0x1f4;return function(_0x5cd8b5){logger['error'](_0x5cd8b5[_0x0478('0x2b')]);if(_0x5cd8b5[_0x0478('0x29')]){delete _0x5cd8b5[_0x0478('0x29')];}_0x570c95[_0x0478('0x13')](_0x3fa35e)[_0x0478('0x2c')](_0x5cd8b5);};}function getUserAttributes(){return _(db[_0x0478('0x2d')][_0x0478('0x2e')])[_0x0478('0x2f')](function(_0xd557ed){return{'name':_0xd557ed['fieldName'],'type':_0xd557ed[_0x0478('0x30')][_0x0478('0x31')]};})['filter'](function(_0x135cad){return![_0x0478('0x32'),_0x0478('0x33'),_0x0478('0x34'),'resetPasswordToken',_0x0478('0x35'),_0x0478('0x36'),_0x0478('0x37')]['includes'](_0x135cad['name']);})[_0x0478('0x26')]();}exports[_0x0478('0x38')]=function(_0x1717db,_0x332de5){var _0x8b1dad={},_0x4cc1c4={'count':0x0,'rows':[]};var _0x4a2947=getUserAttributes();_0x8b1dad=qs[_0x0478('0x39')](_0x4a2947,_0x1717db);var _0x1c6834={'where':_0x8b1dad[_0x0478('0x3a')]};return db[_0x0478('0x2d')][_0x0478('0x17')](_0x1c6834)[_0x0478('0x19')](function(_0x469599){_0x4cc1c4[_0x0478('0x17')]=_0x469599;if(_0x1717db[_0x0478('0x3b')][_0x0478('0x3c')]){_0x8b1dad[_0x0478('0x3d')]=[{'all':!![]}];}if(_0x1717db[_0x0478('0x3b')][_0x0478('0x3e')]===_0x0478('0x3f')){_0x8b1dad[_0x0478('0x3d')]=[{'model':db[_0x0478('0x40')],'as':_0x0478('0x3e')}];}if(!_[_0x0478('0x27')](_0x8b1dad['attributes'],'id')){_0x8b1dad['attributes']['push']('id');}return db['User'][_0x0478('0x41')](_0x8b1dad);})[_0x0478('0x19')](function(_0x4d8554){_0x4cc1c4[_0x0478('0x42')]=_0x4d8554;if(_0x1717db['query'][_0x0478('0x43')]===_0x0478('0x3f')){var _0xb80de3=[];for(var _0x15f1fd=0x0;_0x15f1fd<_0x4cc1c4[_0x0478('0x42')][_0x0478('0x44')];_0x15f1fd++){_0xb80de3[_0x0478('0x45')](get_open_tabs(_0x0478('0x46'),_0x4cc1c4[_0x0478('0x42')][_0x15f1fd][_0x0478('0x47')]));_0xb80de3[_0x0478('0x45')](get_open_tabs(_0x0478('0x48'),_0x4cc1c4[_0x0478('0x42')][_0x15f1fd][_0x0478('0x47')]));_0xb80de3[_0x0478('0x45')](get_open_tabs(_0x0478('0x49'),_0x4cc1c4[_0x0478('0x42')][_0x15f1fd][_0x0478('0x47')]));_0xb80de3[_0x0478('0x45')](get_open_tabs(_0x0478('0x4a'),_0x4cc1c4[_0x0478('0x42')][_0x15f1fd][_0x0478('0x47')]));_0xb80de3[_0x0478('0x45')](get_open_tabs(_0x0478('0x4b'),_0x4cc1c4[_0x0478('0x42')][_0x15f1fd][_0x0478('0x47')]));_0xb80de3[_0x0478('0x45')](get_open_tabs(_0x0478('0x4c'),_0x4cc1c4[_0x0478('0x42')][_0x15f1fd]['dataValues']));}return Promise[_0x0478('0x4d')](_0xb80de3)[_0x0478('0x19')](function(){return _0x4cc1c4;});}else{return _0x4cc1c4;}})[_0x0478('0x19')](respondWithFilteredResult(_0x332de5,_0x8b1dad))[_0x0478('0x4e')](handleError(_0x332de5,null));};exports[_0x0478('0x4f')]=function(_0x99a8d4,_0x219a98){var _0xb78906=getUserAttributes();_0x99a8d4[_0x0478('0x3b')]['id']=_0x99a8d4[_0x0478('0x50')]['id'];var _0x1277eb=qs[_0x0478('0x39')](_0xb78906,_0x99a8d4);if(_0x99a8d4[_0x0478('0x3b')]['includeAll']){_0x1277eb[_0x0478('0x3d')]=[{'all':!![]}];}if(_0x99a8d4[_0x0478('0x3b')][_0x0478('0x3e')]===_0x0478('0x3f')){_0x1277eb[_0x0478('0x3d')]=[{'model':db[_0x0478('0x40')],'as':_0x0478('0x3e')}];}_0x1277eb=_['merge']({},_0x1277eb,_0x99a8d4[_0x0478('0x51')]);if(!_['includes'](_0x1277eb[_0x0478('0x52')],'id')){_0x1277eb['attributes'][_0x0478('0x45')]('id');}return db[_0x0478('0x2d')]['find'](_0x1277eb)[_0x0478('0x19')](handleEntityNotFound(_0x219a98,null))[_0x0478('0x19')](function(_0x1473a8){var _0x47127d=[];values=_0x1473a8;if(_0x99a8d4[_0x0478('0x3b')][_0x0478('0x43')]==='true'){_0x47127d['push'](get_open_tabs(_0x0478('0x46'),_0x1473a8['dataValues']));_0x47127d[_0x0478('0x45')](get_open_tabs(_0x0478('0x48'),_0x1473a8[_0x0478('0x47')]));_0x47127d[_0x0478('0x45')](get_open_tabs(_0x0478('0x4b'),_0x1473a8[_0x0478('0x47')]));_0x47127d['push'](get_open_tabs(_0x0478('0x4c'),_0x1473a8['dataValues']));_0x47127d[_0x0478('0x45')](get_open_tabs(_0x0478('0x49'),_0x1473a8[_0x0478('0x47')]));_0x47127d[_0x0478('0x45')](get_open_tabs('mail',_0x1473a8['dataValues']));return Promise[_0x0478('0x4d')](_0x47127d);}else{return values;}})[_0x0478('0x19')](function(){return values;})['then'](respondWithResult(_0x219a98,null))['catch'](handleError(_0x219a98,null));};exports['update']=function(_0x566007,_0x4f6e83){if(_0x566007[_0x0478('0x53')]['id']){delete _0x566007[_0x0478('0x53')]['id'];}delete _0x566007[_0x0478('0x53')]['role'];return db[_0x0478('0x2d')][_0x0478('0x28')]({'where':{'id':_0x566007[_0x0478('0x50')]['id']}})['then'](handleEntityNotFound(_0x4f6e83,null))[_0x0478('0x19')](saveUpdates(_0x566007['body'],null))[_0x0478('0x19')](respondWithResult(_0x4f6e83,null))[_0x0478('0x4e')](handleError(_0x4f6e83,null));};exports[_0x0478('0x54')]=function(_0x2fa07e,_0x2c0597){return db[_0x0478('0x2d')][_0x0478('0x54')]()[_0x0478('0x19')](respondWithResult(_0x2c0597,null))[_0x0478('0x4e')](handleError(_0x2c0597,null));};exports[_0x0478('0x55')]=function(_0x1afc93,_0x301c13){return db[_0x0478('0x2d')][_0x0478('0x28')]({'where':{'id':_0x1afc93[_0x0478('0x50')]['id']}})[_0x0478('0x19')](handleEntityNotFound(_0x301c13,null))[_0x0478('0x19')](function(_0x2d7f2f){if(_0x2d7f2f){return _0x2d7f2f['addContacts'](_0x1afc93[_0x0478('0x53')][_0x0478('0x56')],_[_0x0478('0x57')](_0x1afc93['body'],[_0x0478('0x56'),'id'])||{});}})[_0x0478('0x19')](respondWithResult(_0x301c13,null))[_0x0478('0x4e')](handleError(_0x301c13,null));};function validateUser(_0x24db28){return new Promise(function(_0x36ab16,_0x5d414a){if(_0x24db28[_0x0478('0x58')])return _0x36ab16(_0x24db28);return db[_0x0478('0x59')]['findById'](0x1)[_0x0478('0x19')](function(_0xa12e16){if(_0xa12e16['securePassword'])authService['validatePasswordPattern'](_0x24db28[_0x0478('0x32')]);db[_0x0478('0x2d')][_0x0478('0x5a')](_0x0478('0x58'))[_0x0478('0x19')](function(_0x45ed46){if(_[_0x0478('0x5b')](_0x45ed46)){_0x24db28[_0x0478('0x58')]=_0xa12e16[_0x0478('0x5c')]||0x1;return;}if(_[_0x0478('0x5b')](_0xa12e16[_0x0478('0x5c')])||_0xa12e16['min_internal']===_0x45ed46){_0x24db28['internal']=_0x45ed46+0x1;return;}if(_0xa12e16[_0x0478('0x5c')]>_0x45ed46){_0x24db28['internal']=_0xa12e16['min_internal'];return;}return db[_0x0478('0x5d')][_0x0478('0x3b')](_0x0478('0x5e'),{'type':db['sequelize'][_0x0478('0x5f')][_0x0478('0x60')]})[_0x0478('0x19')](function(_0x32b58f){if(_0x32b58f&&_0x32b58f['length']){for(var _0x4e8020=0x0,_0x42cb6a=_0x32b58f[_0x0478('0x44')];_0x4e8020<_0x42cb6a&&_['isNil'](_0x24db28[_0x0478('0x58')]);_0x4e8020++){if(_0xa12e16[_0x0478('0x5c')]<=_0x32b58f[_0x4e8020][_0x0478('0x61')]){_0x24db28[_0x0478('0x58')]=_0x32b58f[_0x4e8020][_0x0478('0x61')];}else if(_0xa12e16[_0x0478('0x5c')]>_0x32b58f[_0x4e8020]['from']&&_0xa12e16[_0x0478('0x5c')]<=_0x32b58f[_0x4e8020]['to']){_0x24db28['internal']=_0xa12e16[_0x0478('0x5c')];}}}if(_[_0x0478('0x5b')](_0x24db28['internal'])){_0x24db28[_0x0478('0x58')]=_0x45ed46+0x1;}return _0x36ab16(_0x24db28);});});})['catch'](function(_0x16fe13){_0x5d414a(_0x16fe13);});});}function updateUser(_0x3028df){return new Promise(function(_0x5cf8df,_0x4f7d4f){try{if(_0x3028df[_0x0478('0x62')]){_0x3028df[_0x0478('0x63')]=_0x3028df['internal'];_0x3028df['VoiceMail']={'mailbox':_0x3028df[_0x0478('0x58')],'password':_0x3028df['password'],'fullname':_0x3028df[_0x0478('0x64')],'email':_0x3028df[_0x0478('0x65')]};}if(_0x3028df[_0x0478('0x1a')]===_0x0478('0x22')){if(!_0x3028df[_0x0478('0x66')])_0x3028df['permissions']=[_0x0478('0x67'),_0x0478('0x68'),'103',_0x0478('0x69'),_0x0478('0x6a'),'104',_0x0478('0x6b'),_0x0478('0x6c'),_0x0478('0x6d'),'108',_0x0478('0x6e'),_0x0478('0x6f'),'111','114',_0x0478('0x70')];}_0x5cf8df(_0x3028df);}catch(_0x43b773){_0x4f7d4f(_0x43b773);}});}exports['create']=function(_0x32cf5d,_0x25ce78){if(_0x32cf5d['user']['role']==='agent')throw new Error('Unauthorized');if(_0x32cf5d[_0x0478('0x53')][_0x0478('0x1a')]===_0x0478('0x20')&&_0x32cf5d[_0x0478('0x20')]['role']!==_0x0478('0x1e')){throw new Error(_0x0478('0x71'));}if(_0x32cf5d[_0x0478('0x53')]['role']===_0x0478('0x1e')&&_0x32cf5d['user'][_0x0478('0x1a')]!==_0x0478('0x1e')){throw new Error(_0x0478('0x72'));}return licenseUtil['checkUserLimits']([_0x32cf5d[_0x0478('0x53')]])[_0x0478('0x19')](function(){return validateUser(_0x32cf5d[_0x0478('0x53')]);})[_0x0478('0x19')](function(_0x23ea64){return updateUser(_0x23ea64)[_0x0478('0x19')](function(_0x9e6ba7){if(_0x9e6ba7['role']==='admin'){_0x9e6ba7[_0x0478('0x73')]=_0x32cf5d['user'][_0x0478('0x73')];delete _0x9e6ba7[_0x0478('0x74')];}return _0x9e6ba7;});})[_0x0478('0x19')](function(_0xa0947){return db['User'][_0x0478('0x75')](_0xa0947,{'include':[{'model':db[_0x0478('0x76')],'as':_0x0478('0x76')}]});})[_0x0478('0x19')](function(_0x3a5227){if(_0x32cf5d[_0x0478('0x53')][_0x0478('0x1a')]===_0x0478('0x20'))return _0x3a5227;if(_0x32cf5d[_0x0478('0x20')]['role']!==_0x0478('0x20'))return _0x3a5227;return db[_0x0478('0x77')]['find']({'where':{'name':_0x3a5227[_0x0478('0x1a')]==='agent'?_0x0478('0x21'):'Telephones','userProfileId':_0x32cf5d[_0x0478('0x20')][_0x0478('0x74')]},'raw':!![]})[_0x0478('0x19')](function(_0x43686a){if(!_0x43686a||_0x43686a[_0x0478('0x78')]!=0x0)return _0x3a5227;return db['UserProfileResource'][_0x0478('0x75')]({'name':_0x3a5227[_0x0478('0x29')],'resourceId':_0x3a5227['id'],'type':_0x43686a[_0x0478('0x29')],'sectionId':_0x43686a['id']},{})[_0x0478('0x19')](function(){return _0x3a5227;});})[_0x0478('0x4e')](function(_0x1ea1d0){logger[_0x0478('0x79')](_0x0478('0x7a'),_0x1ea1d0);throw _0x1ea1d0;});})['then'](respondWithResult(_0x25ce78,0xc9))[_0x0478('0x4e')](handleError(_0x25ce78,null));};exports[_0x0478('0x7b')]=function(_0x5d9b79,_0x1345dc){var _0x23f8c8=_0x5d9b79['body'];var _0x43ceff=[];if(_0x5d9b79[_0x0478('0x20')][_0x0478('0x1a')]===_0x0478('0x22'))throw new Error(_0x0478('0x7c'));if(_[_0x0478('0x7d')](_0x23f8c8,[_0x0478('0x1a'),'user'])&&_0x5d9b79[_0x0478('0x20')]['role']!=='admin'){throw new Error(_0x0478('0x71'));}if(_['some'](_0x23f8c8,[_0x0478('0x1a'),_0x0478('0x1e')])&&_0x5d9b79[_0x0478('0x20')]['role']!==_0x0478('0x1e')){throw new Error(_0x0478('0x7e'));}return licenseUtil[_0x0478('0x7f')](_0x23f8c8)[_0x0478('0x19')](function(){return validateUser(_0x23f8c8[0x0]);})[_0x0478('0x19')](function(){for(var _0x3bfc8e=0x1;_0x3bfc8e<_0x23f8c8['length'];_0x3bfc8e++){var _0x2ebd62=_0x23f8c8[_0x3bfc8e-0x1][_0x0478('0x58')];if(!_0x23f8c8[_0x3bfc8e][_0x0478('0x58')])_0x23f8c8[_0x3bfc8e][_0x0478('0x58')]=_0x2ebd62+0x1;_0x43ceff[_0x0478('0x45')](validateUser(_0x23f8c8[_0x3bfc8e]));}return Promise[_0x0478('0x4d')](_0x43ceff);})[_0x0478('0x19')](function(){_0x43ceff=[];for(var _0x54b489=0x0;_0x54b489<_0x23f8c8[_0x0478('0x44')];_0x54b489++){_0x43ceff[_0x0478('0x45')](updateUser(_0x23f8c8[_0x54b489]));}return Promise[_0x0478('0x4d')](_0x43ceff);})[_0x0478('0x19')](function(){_0x43ceff=_0x23f8c8[_0x0478('0x2f')](function(_0x151c9c){return db[_0x0478('0x2d')]['create'](_0x151c9c,{'include':[{'model':db[_0x0478('0x76')],'as':_0x0478('0x76')}]})['then'](function(_0x1e48e1){_0x151c9c['id']=_0x1e48e1['id'];return _0x151c9c;});});return Promise[_0x0478('0x4d')](_0x43ceff);})[_0x0478('0x19')](function(_0x2fc632){if(_0x5d9b79['body'][_0x0478('0x1a')]===_0x0478('0x20'))return _0x2fc632;if(_0x5d9b79[_0x0478('0x20')][_0x0478('0x1a')]!=='user')return _0x2fc632;var _0x13379b=_[_0x0478('0x7d')](_0x2fc632,function(_0x498c10){return _0x498c10[_0x0478('0x1a')]===_0x0478('0x22')||_0x498c10[_0x0478('0x1a')]==='telephone';});if(!_0x13379b)return _0x2fc632;return db[_0x0478('0x77')]['findAll']({'where':{'name':{'$or':[_0x0478('0x21'),_0x0478('0x80')]},'userProfileId':_0x5d9b79[_0x0478('0x20')][_0x0478('0x74')]},'raw':!![]})[_0x0478('0x19')](function(_0x53fea8){if(_[_0x0478('0x81')](_0x53fea8)||!_[_0x0478('0x7d')](_0x53fea8,[_0x0478('0x78'),0x0]))return _0x2fc632;_0x43ceff=[];var _0x4a8fa8=_(_0x53fea8)['map'](function(_0x34da60){if(_0x34da60[_0x0478('0x78')]===0x1)return;return _0x34da60[_0x0478('0x29')]===_0x0478('0x21')?_0x0478('0x22'):_0x0478('0x23');})[_0x0478('0x82')]()[_0x0478('0x26')]();for(var _0x7f52f0=0x0;_0x7f52f0<_0x2fc632[_0x0478('0x44')];_0x7f52f0++){if(!_['includes'](_0x4a8fa8,_0x2fc632[_0x7f52f0][_0x0478('0x1a')]))return;var _0x395f0c=_0x2fc632[_0x7f52f0][_0x0478('0x1a')]===_0x0478('0x22')?_0x0478('0x21'):'Telephones';_0x43ceff['push'](db[_0x0478('0x2a')]['create']({'name':_0x2fc632[_0x7f52f0]['name'],'resourceId':_0x2fc632[_0x7f52f0]['id'],'type':_0x395f0c,'sectionId':_[_0x0478('0x28')](_0x53fea8,[_0x0478('0x29'),_0x395f0c])['id']},{}));}return Promise[_0x0478('0x4d')](_0x43ceff);});})['then'](respondWithResult(_0x1345dc,0xc9))[_0x0478('0x4e')](handleError(_0x1345dc,null));};exports['changePassword']=function(_0x98a3a3,_0x260c6b){if(_0x98a3a3['body']['id']){delete _0x98a3a3[_0x0478('0x53')]['id'];}return db['User'][_0x0478('0x28')]({'where':{'id':_0x98a3a3['params']['id']}})[_0x0478('0x19')](function(_0x590559){if(!_0x590559)return null;if(_0x590559['id']===_0x98a3a3['user']['id']){if(!_0x98a3a3[_0x0478('0x53')][_0x0478('0x83')]||!_0x98a3a3['body'][_0x0478('0x84')]){throw new db['Sequelize']['ValidationError'](_0x0478('0x85'));}if(!_0x590559[_0x0478('0x86')](_0x98a3a3[_0x0478('0x53')][_0x0478('0x83')])){throw new db[(_0x0478('0x87'))][(_0x0478('0x88'))](_0x0478('0x89'));}if(_0x98a3a3[_0x0478('0x53')][_0x0478('0x83')]===_0x98a3a3[_0x0478('0x53')][_0x0478('0x84')]){throw new db[(_0x0478('0x87'))][(_0x0478('0x88'))](_0x0478('0x8a'));}}else if(_0x98a3a3['user'][_0x0478('0x1a')]==='admin'){if(!_0x98a3a3['body'][_0x0478('0x84')]){throw new db[(_0x0478('0x87'))][(_0x0478('0x88'))](_0x0478('0x8b'));}}else if(_0x98a3a3['user'][_0x0478('0x1a')]===_0x0478('0x20')){if(!_0x98a3a3['body'][_0x0478('0x84')]){throw new db[(_0x0478('0x87'))][(_0x0478('0x88'))](_0x0478('0x8b'));}if(_0x590559[_0x0478('0x1a')]!==_0x0478('0x22')){throw new db[(_0x0478('0x87'))][(_0x0478('0x88'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0x0478('0x88'))]('Unauthorized');}return _0x590559;})[_0x0478('0x19')](handleEntityNotFound(_0x260c6b,null))[_0x0478('0x19')](function(_0x5f14db){return db[_0x0478('0x59')]['findOne']({'attributes':['id',_0x0478('0x8c'),_0x0478('0x8d'),_0x0478('0x8e')]})[_0x0478('0x19')](function(_0x5af374){if(_0x5af374[_0x0478('0x8c')])authService[_0x0478('0x8f')](_0x98a3a3[_0x0478('0x53')]['newPassword']);if(!_0x5af374[_0x0478('0x8d')]||!_0x5f14db[_0x0478('0x34')])return _0x5f14db;authService[_0x0478('0x90')](_0x98a3a3[_0x0478('0x53')]['newPassword'],_0x5f14db[_0x0478('0x34')],_0x5af374[_0x0478('0x8e')]);return _0x5f14db;})[_0x0478('0x19')](saveUpdates({'password':_0x98a3a3[_0x0478('0x53')]['newPassword'],'passwordResetAt':_0x98a3a3[_0x0478('0x20')]['id']==_0x98a3a3['params']['id']?moment():null,'previousPasswords':authService[_0x0478('0x91')](_0x98a3a3['body'][_0x0478('0x84')],_0x5f14db[_0x0478('0x34')])},null));})[_0x0478('0x19')](respondWithResult(_0x260c6b,null))[_0x0478('0x4e')](handleError(_0x260c6b,null));};exports[_0x0478('0x92')]=function(_0x5614e8,_0x5d7ed1){var _0x28d7b7=_0x5614e8[_0x0478('0x53')][_0x0478('0x93')];return db['User'][_0x0478('0x28')]({'where':{'id':_0x5614e8[_0x0478('0x50')]['id']},'attributes':['id','name','role',_0x0478('0x94'),_0x0478('0x95'),_0x0478('0x96'),'interface']})[_0x0478('0x19')](handleEntityNotFound(_0x5d7ed1,null))['then'](function(_0xdfae57){if(_0xdfae57){if(!utils['isValidChannel'](_0x28d7b7)){throw new db[(_0x0478('0x87'))]['ValidationError'](_0x0478('0x97'));}return _0xdfae57[_0x0478('0x98')+_['capitalize'](_0x28d7b7['toLowerCase']())+'Queues'](_0x5614e8[_0x0478('0x53')][_0x0478('0x56')],{'penalty':_0x5614e8[_0x0478('0x53')][_0x0478('0x99')]||0x0})[_0x0478('0x9a')](function(_0x306c45){for(var _0x1e4fc0=0x0;_0x1e4fc0<_0x5614e8[_0x0478('0x53')][_0x0478('0x56')][_0x0478('0x44')];_0x1e4fc0+=0x1){var _0x303b66={'UserId':Number(_0x5614e8[_0x0478('0x50')]['id'])};_0x303b66[_[_0x0478('0x9b')](_0x28d7b7['toLowerCase']())+'QueueId']=Number(_0x5614e8[_0x0478('0x53')]['ids'][_0x1e4fc0]);socket['emit'](_0x0478('0x20')+_['capitalize'](_0x28d7b7['toLowerCase']())+'Queue:save',_0x303b66);}return _0x306c45;})[_0x0478('0x19')](function(){if(_0x28d7b7===_0x0478('0x9c')){return db['VoiceQueue'][_0x0478('0x41')]({'where':{'id':_0x5614e8['body'][_0x0478('0x56')]||[]},'raw':!![],'attributes':['id',_0x0478('0x29')]});}})[_0x0478('0x19')](function(_0x1ee6e5){var _0xec7fe=_0xdfae57[_0x0478('0x1d')]({'plain':!![]});var _0x516a02=[];if(_0x28d7b7===_0x0478('0x9c')&&_0xec7fe['role']===_0x0478('0x22')&&_0xec7fe[_0x0478('0x94')]){for(let _0x3b29ef=0x0;_0x3b29ef<_0x1ee6e5[_0x0478('0x44')];_0x3b29ef+=0x1){_0x516a02['push']({'membername':_0xec7fe[_0x0478('0x29')],'UserId':_0xec7fe['id'],'queue_name':_0x1ee6e5[_0x3b29ef][_0x0478('0x29')],'VoiceQueueId':_0x1ee6e5[_0x3b29ef]['id'],'interface':_[_0x0478('0x5b')](_0xec7fe[_0x0478('0x9d')])?util['format'](_0x0478('0x9e'),_0xec7fe[_0x0478('0x29')]):_0xec7fe[_0x0478('0x9d')],'paused':_0xec7fe[_0x0478('0x96')]||![],'penalty':_0x5614e8[_0x0478('0x53')][_0x0478('0x99')]||0x0});}return Promise[_0x0478('0x4d')](_0x516a02[_0x0478('0x2f')](function(_0x1df37a){return db[_0x0478('0x9f')][_0x0478('0xa0')](_0x1df37a);}));}return _0xdfae57;});}})[_0x0478('0x19')](respondWithStatusCode(_0x5d7ed1,null))[_0x0478('0x4e')](handleError(_0x5d7ed1,null));};exports['removeQueues']=function(_0x4c9d4d,_0x55c375){var _0x24e756,_0x4ab760;return db['User'][_0x0478('0x28')]({'where':{'id':_0x4c9d4d[_0x0478('0x50')]['id']},'attributes':['id',_0x0478('0x29'),_0x0478('0x1a')]})[_0x0478('0x19')](handleEntityNotFound(_0x55c375,null))['then'](function(_0x4061a2){if(_0x4061a2){_0x24e756=_0x4061a2;if(!_0x4c9d4d[_0x0478('0x3b')][_0x0478('0x93')]||!utils[_0x0478('0xa1')](_0x4c9d4d[_0x0478('0x3b')][_0x0478('0x93')])){throw new db[(_0x0478('0x87'))]['ValidationError'](_0x0478('0x97'));}return _0x4061a2[_0x0478('0xa2')+_[_0x0478('0x9b')](_0x4c9d4d['query']['channel']['toLowerCase']())+_0x0478('0xa3')](_0x4c9d4d[_0x0478('0x3b')][_0x0478('0x56')]);}})['then'](function(_0x1a4b5f){if(_['isArray'](_0x4c9d4d[_0x0478('0x3b')][_0x0478('0x56')])){for(var _0x45e1e5=0x0;_0x45e1e5<_0x4c9d4d[_0x0478('0x3b')]['ids']['length'];_0x45e1e5+=0x1){_0x4ab760={'UserId':Number(_0x4c9d4d[_0x0478('0x50')]['id'])};_0x4ab760[_['capitalize'](_0x4c9d4d[_0x0478('0x3b')][_0x0478('0x93')][_0x0478('0xa4')]())+_0x0478('0xa5')]=Number(_0x4c9d4d[_0x0478('0x3b')][_0x0478('0x56')][_0x45e1e5]);socket['emit']('user'+_['capitalize'](_0x4c9d4d[_0x0478('0x3b')][_0x0478('0x93')][_0x0478('0xa4')]())+'Queue:remove',_0x4ab760);}}else{_0x4ab760={'UserId':Number(_0x4c9d4d[_0x0478('0x50')]['id'])};_0x4ab760[_[_0x0478('0x9b')](_0x4c9d4d[_0x0478('0x3b')][_0x0478('0x93')][_0x0478('0xa4')]())+_0x0478('0xa5')]=Number(_0x4c9d4d[_0x0478('0x3b')][_0x0478('0x56')]);socket[_0x0478('0x1b')](_0x0478('0x20')+_['capitalize'](_0x4c9d4d[_0x0478('0x3b')]['channel'][_0x0478('0xa4')]())+'Queue:remove',_0x4ab760);}return _0x1a4b5f;})['then'](function(){if(_0x4c9d4d[_0x0478('0x3b')][_0x0478('0x93')]===_0x0478('0x9c')){return db[_0x0478('0x9f')][_0x0478('0x1c')]({'where':{'UserId':_0x4c9d4d[_0x0478('0x50')]['id'],'VoiceQueueId':_0x4c9d4d[_0x0478('0x3b')][_0x0478('0x56')]},'individualHooks':!![]})[_0x0478('0x19')](function(){return _0x24e756;});}return _0x24e756;})[_0x0478('0x19')](respondWithStatusCode(_0x55c375,null))[_0x0478('0x4e')](handleError(_0x55c375,null));};exports[_0x0478('0xa6')]=function(_0x3137f7,_0x379d61){_0x3137f7[_0x0478('0x53')][_0x0478('0xa7')]=_0x3137f7[_0x0478('0xa8')][_0x0478('0xa9')];return db['User']['find']({'where':{'id':_0x3137f7[_0x0478('0x50')]['id']}})[_0x0478('0x19')](handleEntityNotFound(_0x379d61,null))[_0x0478('0x19')](saveUpdates(_0x3137f7[_0x0478('0x53')],null))['then'](respondWithResult(_0x379d61,null))[_0x0478('0x4e')](handleError(_0x379d61,null));};exports[_0x0478('0xaa')]=function(_0x23dc10,_0x4dfa1b){var _0x298c6e=path[_0x0478('0xab')](config[_0x0478('0xac')],'server/files/images/logos/default_profile.png');return db[_0x0478('0x2d')][_0x0478('0x28')]({'where':{'id':_0x23dc10[_0x0478('0x50')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x0478('0x19')](handleEntityNotFound(_0x4dfa1b,null))[_0x0478('0x19')](function(_0x23bce7){if(_0x23bce7){if(_['isNil'](_0x23bce7[_0x0478('0xa7')])){return _0x4dfa1b[_0x0478('0xad')](_0x298c6e);}else{if(!fs[_0x0478('0xae')](path['join'](config[_0x0478('0xac')],_0x0478('0xaf'),_0x23bce7[_0x0478('0xa7')]))){return _0x4dfa1b[_0x0478('0xad')](_0x298c6e);}return _0x4dfa1b[_0x0478('0xad')](path[_0x0478('0xab')](config[_0x0478('0xac')],'server/files/images/',_0x23bce7[_0x0478('0xa7')]));}}})[_0x0478('0x4e')](handleError(_0x4dfa1b,null));};exports[_0x0478('0xb0')]=function(_0xbfd407,_0x3d371a){return db['User'][_0x0478('0x28')]({'where':{'id':_0xbfd407[_0x0478('0x50')]['id']},'attributes':['id']})[_0x0478('0x19')](handleEntityNotFound(_0x3d371a,null))[_0x0478('0x19')](function(_0x4d7fdf){var _0x515cd8=[];values=_0x4d7fdf[_0x0478('0x47')];_0x515cd8[_0x0478('0x45')](get_open_tabs(_0x0478('0x46'),_0x4d7fdf['dataValues']));_0x515cd8['push'](get_open_tabs(_0x0478('0x48'),_0x4d7fdf[_0x0478('0x47')]));_0x515cd8[_0x0478('0x45')](get_open_tabs(_0x0478('0x4b'),_0x4d7fdf['dataValues']));_0x515cd8[_0x0478('0x45')](get_open_tabs('whatsapp',_0x4d7fdf[_0x0478('0x47')]));_0x515cd8[_0x0478('0x45')](get_open_tabs(_0x0478('0x49'),_0x4d7fdf[_0x0478('0x47')]));_0x515cd8[_0x0478('0x45')](get_open_tabs(_0x0478('0x4a'),_0x4d7fdf[_0x0478('0x47')]));return Promise['all'](_0x515cd8);})['then'](function(_0x5ae191){if(_0x5ae191){var _0x159729=_[_0x0478('0x2f')](values[_0x0478('0xb1')],function(_0x13b6e2){return{'channel':_0x0478('0xb2'),'id':_0x13b6e2['id'],'createdAt':_0x13b6e2[_0x0478('0xb3')]};});var _0x28f086=_[_0x0478('0x2f')](values[_0x0478('0xb4')],function(_0x47bddd){return{'channel':'FAX','id':_0x47bddd['id'],'createdAt':_0x47bddd[_0x0478('0xb3')]};});var _0x25b50c=_[_0x0478('0x2f')](values[_0x0478('0xb5')],function(_0x3656cf){return{'channel':'OPENCHANNEL','id':_0x3656cf['id'],'createdAt':_0x3656cf[_0x0478('0xb3')]};});var _0x1846dc=_[_0x0478('0x2f')](values[_0x0478('0xb6')],function(_0x2b3efb){return{'channel':_0x0478('0xb7'),'id':_0x2b3efb['id'],'createdAt':_0x2b3efb[_0x0478('0xb3')]};});var _0xcd46e0=_[_0x0478('0x2f')](values[_0x0478('0xb8')],function(_0x1a18a3){return{'channel':'SMS','id':_0x1a18a3['id'],'createdAt':_0x1a18a3[_0x0478('0xb3')]};});var _0x8443fa=_['map'](values[_0x0478('0xb9')],function(_0x6c308d){return{'channel':_0x0478('0xba'),'id':_0x6c308d['id'],'createdAt':_0x6c308d['createdAt']};});var _0x7a2f4d=_['concat'](_0x159729,_0x28f086,_0x25b50c,_0x1846dc,_0xcd46e0,_0x8443fa);var _0x3386a7={'count':_0x7a2f4d[_0x0478('0x44')],'rows':_0x7a2f4d};return _0x3386a7;}else return null;})['then'](respondWithResult(_0x3d371a,null))[_0x0478('0x4e')](handleError(_0x3d371a,null));};exports['getContacts']=function(_0x4e4b23,_0x182e43){var _0x9bc56d={};return db[_0x0478('0x2d')]['findOne']({'where':{'id':_0x4e4b23[_0x0478('0x50')]['id']}})[_0x0478('0x19')](function(_0x260549){if(!_0x260549){throw new APINotFoundError(util[_0x0478('0xbb')](_0x0478('0xbc'),_0x4e4b23[_0x0478('0x50')]['id']));}return contacts[_0x0478('0x54')]();})[_0x0478('0x19')](function(_0x12d219){_0x4e4b23[_0x0478('0x3b')][_0x0478('0x2d')]=_0x4e4b23[_0x0478('0x50')]['id'];_0x9bc56d=qs[_0x0478('0x39')](_0x12d219,_0x4e4b23);if(_0x4e4b23[_0x0478('0x3b')]['hasOwnProperty'](_0x0478('0x3c'))){_0x9bc56d[_0x0478('0x3d')]=[{'model':db[_0x0478('0xbd')],'as':'List','required':![]},{'model':db[_0x0478('0xbe')],'as':'Tags','attributes':['id',_0x0478('0x29'),_0x0478('0xbf')],'where':_0x4e4b23['query'][_0x0478('0xc0')]?{'id':_0x4e4b23[_0x0478('0x3b')]['tag']}:undefined,'required':_0x4e4b23['query'][_0x0478('0xc0')]?!![]:![]}];}return contacts[_0x0478('0x41')](_0x4e4b23[_0x0478('0x3b')],_0x4e4b23[_0x0478('0x20')],_0x9bc56d,_0x12d219);})['then'](respondWithFilteredResult(_0x182e43,_0x9bc56d))['catch'](APIHandleError(_0x182e43));};exports[_0x0478('0xc1')]=function(_0x307ba9,_0x3a9630){var _0x5d7240;var _0x54b70c={};var _0x37e7b0;return db['User'][_0x0478('0xc2')]({'where':{'id':_0x307ba9[_0x0478('0x50')]['id']},'attributes':['id',_0x0478('0x29'),_0x0478('0x1a')]})[_0x0478('0x19')](handleEntityNotFound(_0x3a9630,null))[_0x0478('0x19')](function(_0x151ebf){if(!utils[_0x0478('0xa1')](_0x307ba9[_0x0478('0x3b')]['channel'])){throw new db[(_0x0478('0x87'))]['ValidationError'](_0x0478('0x97'));}_0x5d7240=_0x151ebf;var _0x24444f={};_0x24444f[_0x0478('0xc3')]=_[_0x0478('0xc4')](db[_[_0x0478('0x9b')](_0x307ba9[_0x0478('0x3b')][_0x0478('0x93')])+_0x0478('0xc5')]['rawAttributes']);_0x24444f['query']=_['keys'](_0x307ba9['query']);_0x24444f[_0x0478('0xc6')]=_['intersection'](_0x24444f[_0x0478('0xc3')],_0x24444f[_0x0478('0x3b')]);_0x54b70c[_0x0478('0x52')]=_['intersection'](_0x24444f[_0x0478('0xc3')],qs[_0x0478('0xc7')](_0x307ba9[_0x0478('0x3b')][_0x0478('0xc7')]));_0x54b70c['attributes']=_0x54b70c[_0x0478('0x52')]['length']?_0x54b70c[_0x0478('0x52')]:_0x24444f[_0x0478('0xc3')];_0x54b70c[_0x0478('0xc8')]=qs[_0x0478('0xc9')](_0x307ba9['query']['sort']);_0x54b70c[_0x0478('0x3a')]=qs[_0x0478('0xc6')](_[_0x0478('0xca')](_0x307ba9['query'],_0x24444f[_0x0478('0xc6')]));if(_0x307ba9[_0x0478('0x3b')][_0x0478('0x24')]){_0x54b70c[_0x0478('0x3a')]=_[_0x0478('0xcb')](_0x54b70c[_0x0478('0x3a')],{'$or':_[_0x0478('0x2f')](_0x54b70c[_0x0478('0x52')],function(_0x3f127e){var _0x3bee6f={};_0x3bee6f[_0x3f127e]={'$like':'%'+_0x307ba9[_0x0478('0x3b')][_0x0478('0x24')]+'%'};return _0x3bee6f;})});}_0x54b70c=_[_0x0478('0xcb')]({},_0x54b70c,_0x307ba9[_0x0478('0x51')]);switch(_0x5d7240[_0x0478('0x1a')]){case _0x0478('0x1e'):return db[_['capitalize'](_0x307ba9['query']['channel'])+'Queue'][_0x0478('0x41')](_0x54b70c);case _0x0478('0x20'):case _0x0478('0x22'):return _0x5d7240['get'+_[_0x0478('0x9b')](_0x307ba9[_0x0478('0x3b')]['channel'])+_0x0478('0xa3')](_0x54b70c);default:throw new db[(_0x0478('0x87'))][(_0x0478('0x88'))]('Unknown\x20role');}})['then'](function(_0x1e6d96){_0x37e7b0=_0x1e6d96[_0x0478('0x44')];if(!_0x307ba9['query'][_0x0478('0xcc')](_0x0478('0xcd'))){_0x54b70c[_0x0478('0xce')]=qs[_0x0478('0xce')](_0x307ba9[_0x0478('0x3b')][_0x0478('0xce')]);_0x54b70c[_0x0478('0x15')]=qs[_0x0478('0x15')](_0x307ba9[_0x0478('0x3b')]['offset']);}switch(_0x5d7240['role']){case'admin':return db[_[_0x0478('0x9b')](_0x307ba9[_0x0478('0x3b')][_0x0478('0x93')])+_0x0478('0xc5')]['findAll'](_0x54b70c);case _0x0478('0x20'):case _0x0478('0x22'):return _0x5d7240[_0x0478('0x1d')+_['capitalize'](_0x307ba9[_0x0478('0x3b')][_0x0478('0x93')])+_0x0478('0xa3')](_0x54b70c);}})[_0x0478('0x19')](function(_0x1287ce){return{'count':_0x37e7b0,'rows':_0x1287ce};})[_0x0478('0x19')](respondWithResult(_0x3a9630,null))['catch'](handleError(_0x3a9630,null));};exports[_0x0478('0xcf')]=function(_0xa8a6d6,_0x76aaba){var _0x384f36={};var _0x2f7eb5={};var _0x5d98f7;var _0x44c51c;return db[_0x0478('0x2d')][_0x0478('0xc2')]({'where':{'id':_0xa8a6d6[_0x0478('0x50')]['id']}})[_0x0478('0x19')](handleEntityNotFound(_0x76aaba,null))[_0x0478('0x19')](function(_0xf972b3){if(_0xf972b3){_0x5d98f7=_0xf972b3;_0x2f7eb5['model']=_[_0x0478('0xc4')](db[_0x0478('0x9f')][_0x0478('0x2e')]);_0x2f7eb5[_0x0478('0x3b')]=_[_0x0478('0xc4')](_0xa8a6d6[_0x0478('0x3b')]);_0x2f7eb5[_0x0478('0xc6')]=_[_0x0478('0xd0')](_0x2f7eb5[_0x0478('0xc3')],_0x2f7eb5['query']);_0x384f36[_0x0478('0x52')]=_[_0x0478('0xd0')](_0x2f7eb5['model'],qs[_0x0478('0xc7')](_0xa8a6d6[_0x0478('0x3b')][_0x0478('0xc7')]));_0x384f36[_0x0478('0x52')]=_0x384f36[_0x0478('0x52')][_0x0478('0x44')]?_0x384f36['attributes']:_0x2f7eb5[_0x0478('0xc3')];_0x384f36[_0x0478('0xc8')]=qs[_0x0478('0xc9')](_0xa8a6d6[_0x0478('0x3b')][_0x0478('0xc9')]);_0x384f36[_0x0478('0x3a')]=qs['filters'](_[_0x0478('0xca')](_0xa8a6d6[_0x0478('0x3b')],_0x2f7eb5[_0x0478('0xc6')]));if(_0xa8a6d6[_0x0478('0x3b')]['filter']){_0x384f36[_0x0478('0x3a')]=_['merge'](_0x384f36[_0x0478('0x3a')],{'$or':_[_0x0478('0x2f')](_0x384f36[_0x0478('0x52')],function(_0x2c8559){var _0x1b8bb7={};_0x1b8bb7[_0x2c8559]={'$like':'%'+_0xa8a6d6[_0x0478('0x3b')]['filter']+'%'};return _0x1b8bb7;})});}_0x384f36=_['merge']({},_0x384f36,_0xa8a6d6[_0x0478('0x51')]);return _0x5d98f7[_0x0478('0xcf')](_0x384f36);}})[_0x0478('0x19')](function(_0x3c5fbc){if(_0x3c5fbc){_0x44c51c=_0x3c5fbc['length'];if(!_0xa8a6d6[_0x0478('0x3b')][_0x0478('0xcc')](_0x0478('0xcd'))){_0x384f36[_0x0478('0xce')]=qs[_0x0478('0xce')](_0xa8a6d6['query'][_0x0478('0xce')]);_0x384f36[_0x0478('0x15')]=qs[_0x0478('0x15')](_0xa8a6d6['query'][_0x0478('0x15')]);}return _0x5d98f7[_0x0478('0xcf')](_0x384f36);}})['then'](function(_0x529f4c){if(_0x529f4c){return _0x529f4c?{'count':_0x44c51c,'rows':_0x529f4c}:null;}})[_0x0478('0x19')](respondWithResult(_0x76aaba,null))['catch'](handleError(_0x76aaba,null));};exports[_0x0478('0xd1')]=function(_0x378d71,_0x892f69){var _0xce5928={};var _0x4ea7f3={};var _0x47468b;var _0x34fee2;return db[_0x0478('0x2d')][_0x0478('0xc2')]({'where':{'id':_0x378d71[_0x0478('0x50')]['id']}})[_0x0478('0x19')](handleEntityNotFound(_0x892f69,null))['then'](function(_0x2e3195){if(_0x2e3195){_0x47468b=_0x2e3195;_0x4ea7f3[_0x0478('0xc3')]=_[_0x0478('0xc4')](db[_0x0478('0xd2')][_0x0478('0x2e')]);_0x4ea7f3[_0x0478('0x3b')]=_[_0x0478('0xc4')](_0x378d71[_0x0478('0x3b')]);_0x4ea7f3[_0x0478('0xc6')]=_['intersection'](_0x4ea7f3['model'],_0x4ea7f3[_0x0478('0x3b')]);_0xce5928['attributes']=_[_0x0478('0xd0')](_0x4ea7f3['model'],qs[_0x0478('0xc7')](_0x378d71['query'][_0x0478('0xc7')]));_0xce5928[_0x0478('0x52')]=_0xce5928[_0x0478('0x52')][_0x0478('0x44')]?_0xce5928['attributes']:_0x4ea7f3[_0x0478('0xc3')];_0xce5928[_0x0478('0xc8')]=qs[_0x0478('0xc9')](_0x378d71[_0x0478('0x3b')]['sort']);_0xce5928[_0x0478('0x3a')]=qs[_0x0478('0xc6')](_[_0x0478('0xca')](_0x378d71[_0x0478('0x3b')],_0x4ea7f3['filters']));if(_0x378d71[_0x0478('0x3b')][_0x0478('0x24')]){_0xce5928[_0x0478('0x3a')]=_[_0x0478('0xcb')](_0xce5928[_0x0478('0x3a')],{'$or':_[_0x0478('0x2f')](_0xce5928[_0x0478('0x52')],function(_0x178496){var _0x11e502={};_0x11e502[_0x178496]={'$like':'%'+_0x378d71[_0x0478('0x3b')][_0x0478('0x24')]+'%'};return _0x11e502;})});}_0xce5928=_[_0x0478('0xcb')]({},_0xce5928,_0x378d71[_0x0478('0x51')]);return _0x47468b['getGroups'](_0xce5928);}})[_0x0478('0x19')](function(_0x2c122d){if(_0x2c122d){_0x34fee2=_0x2c122d[_0x0478('0x44')];if(!_0x378d71['query']['hasOwnProperty'](_0x0478('0xcd'))){_0xce5928['limit']=qs[_0x0478('0xce')](_0x378d71[_0x0478('0x3b')][_0x0478('0xce')]);_0xce5928['offset']=qs[_0x0478('0x15')](_0x378d71['query'][_0x0478('0x15')]);}return _0x47468b['getGroups'](_0xce5928);}})[_0x0478('0x19')](function(_0x296eee){if(_0x296eee){return _0x296eee?{'count':_0x34fee2,'rows':_0x296eee}:null;}})[_0x0478('0x19')](respondWithResult(_0x892f69,null))[_0x0478('0x4e')](handleError(_0x892f69,null));};exports[_0x0478('0xd3')]=function(_0x47956f,_0x2d4a74){var _0x1a5acb={'raw':!![],'where':{}};var _0x3aff4a={};var _0x149699={'count':0x0,'rows':[]};return db['User'][_0x0478('0xc2')]({'where':{'id':_0x47956f[_0x0478('0x50')]['id']}})[_0x0478('0x19')](handleEntityNotFound(_0x2d4a74,null))[_0x0478('0x19')](function(_0x1f3ef7){if(_0x1f3ef7){_0x3aff4a['model']=_['keys'](db[_0x0478('0xd4')][_0x0478('0x2e')]);_0x3aff4a[_0x0478('0x3b')]=_['keys'](_0x47956f['query']);_0x3aff4a[_0x0478('0xc6')]=_[_0x0478('0xd0')](_0x3aff4a[_0x0478('0xc3')],_0x3aff4a['query']);_0x1a5acb['attributes']=_['intersection'](_0x3aff4a[_0x0478('0xc3')],qs[_0x0478('0xc7')](_0x47956f[_0x0478('0x3b')]['fields']));_0x1a5acb['attributes']=_0x1a5acb[_0x0478('0x52')]['length']?_0x1a5acb[_0x0478('0x52')]:_0x3aff4a[_0x0478('0xc3')];if(!_0x47956f[_0x0478('0x3b')][_0x0478('0xcc')](_0x0478('0xcd'))){_0x1a5acb[_0x0478('0xce')]=qs[_0x0478('0xce')](_0x47956f[_0x0478('0x3b')][_0x0478('0xce')]);_0x1a5acb[_0x0478('0x15')]=qs['offset'](_0x47956f[_0x0478('0x3b')][_0x0478('0x15')]);}_0x1a5acb[_0x0478('0xc8')]=qs[_0x0478('0xc9')](_0x47956f[_0x0478('0x3b')]['sort']);_0x1a5acb[_0x0478('0x3a')]=qs[_0x0478('0xc6')](_[_0x0478('0xca')](_0x47956f[_0x0478('0x3b')],_0x3aff4a['filters']));_0x1a5acb['where'][_0x0478('0xd5')]=_0x1f3ef7['id'];if(_0x47956f[_0x0478('0x3b')][_0x0478('0x24')]){_0x1a5acb['where']=_[_0x0478('0xcb')](_0x1a5acb[_0x0478('0x3a')],{'$or':_[_0x0478('0x2f')](_0x1a5acb[_0x0478('0x52')],function(_0x4fd8d7){var _0x5b2a4f={};_0x5b2a4f[_0x4fd8d7]={'$like':'%'+_0x47956f['query'][_0x0478('0x24')]+'%'};return _0x5b2a4f;})});}_0x1a5acb=_[_0x0478('0xcb')]({},_0x1a5acb,_0x47956f[_0x0478('0x51')]);return db[_0x0478('0xd4')][_0x0478('0x17')]({'where':_0x1a5acb[_0x0478('0x3a')]})[_0x0478('0x19')](function(_0x134787){_0x149699['count']=_0x134787;if(_0x47956f[_0x0478('0x3b')]['includeAll']){_0x1a5acb[_0x0478('0x3d')]=[{'all':!![]}];}return db[_0x0478('0xd4')][_0x0478('0x41')](_0x1a5acb);})[_0x0478('0x19')](function(_0x3cc81b){_0x149699['rows']=_0x3cc81b;return _0x149699;});}})[_0x0478('0x19')](respondWithFilteredResult(_0x2d4a74,_0x1a5acb))['catch'](handleError(_0x2d4a74,null));};exports[_0x0478('0xd6')]=function(_0x820f5a,_0x5c0d81){var _0x347a38={'raw':!![],'where':{}};var _0x12bc18={};var _0x143b8d={'count':0x0,'rows':[]};return db[_0x0478('0x2d')][_0x0478('0xc2')]({'where':{'id':_0x820f5a[_0x0478('0x50')]['id']}})[_0x0478('0x19')](handleEntityNotFound(_0x5c0d81,null))[_0x0478('0x19')](function(_0x4711ec){if(_0x4711ec){_0x12bc18[_0x0478('0xc3')]=_[_0x0478('0xc4')](db[_0x0478('0xd7')][_0x0478('0x2e')]);_0x12bc18[_0x0478('0x3b')]=_['keys'](_0x820f5a[_0x0478('0x3b')]);_0x12bc18[_0x0478('0xc6')]=_[_0x0478('0xd0')](_0x12bc18[_0x0478('0xc3')],_0x12bc18[_0x0478('0x3b')]);_0x347a38[_0x0478('0x52')]=_['intersection'](_0x12bc18['model'],qs[_0x0478('0xc7')](_0x820f5a[_0x0478('0x3b')]['fields']));_0x347a38[_0x0478('0x52')]=_0x347a38[_0x0478('0x52')]['length']?_0x347a38[_0x0478('0x52')]:_0x12bc18['model'];if(!_0x820f5a['query'][_0x0478('0xcc')](_0x0478('0xcd'))){_0x347a38[_0x0478('0xce')]=qs[_0x0478('0xce')](_0x820f5a[_0x0478('0x3b')][_0x0478('0xce')]);_0x347a38[_0x0478('0x15')]=qs[_0x0478('0x15')](_0x820f5a['query']['offset']);}_0x347a38[_0x0478('0xc8')]=qs['sort'](_0x820f5a['query']['sort']);_0x347a38['where']=qs[_0x0478('0xc6')](_[_0x0478('0xca')](_0x820f5a[_0x0478('0x3b')],_0x12bc18[_0x0478('0xc6')]));_0x347a38[_0x0478('0x3a')][_0x0478('0xd5')]=_0x4711ec['id'];if(_0x820f5a[_0x0478('0x3b')]['filter']){_0x347a38[_0x0478('0x3a')]=_[_0x0478('0xcb')](_0x347a38[_0x0478('0x3a')],{'$or':_[_0x0478('0x2f')](_0x347a38['attributes'],function(_0x3bd616){var _0x57c56d={};_0x57c56d[_0x3bd616]={'$like':'%'+_0x820f5a[_0x0478('0x3b')][_0x0478('0x24')]+'%'};return _0x57c56d;})});}_0x347a38=_[_0x0478('0xcb')]({},_0x347a38,_0x820f5a['options']);return db['ScreenRecording']['count']({'where':_0x347a38[_0x0478('0x3a')]})[_0x0478('0x19')](function(_0x33c454){_0x143b8d['count']=_0x33c454;if(_0x820f5a['query'][_0x0478('0x3c')]){_0x347a38[_0x0478('0x3d')]=[{'all':!![]}];}return db[_0x0478('0xd7')][_0x0478('0x41')](_0x347a38);})[_0x0478('0x19')](function(_0x1ddf56){_0x143b8d[_0x0478('0x42')]=_0x1ddf56;return _0x143b8d;});}})[_0x0478('0x19')](respondWithFilteredResult(_0x5c0d81,_0x347a38))['catch'](handleError(_0x5c0d81,null));};exports[_0x0478('0xd8')]=function(_0x50660e,_0x3d2e70){var _0x236f5a={};var _0x18dbdd={};var _0x89992c;var _0x204639;return db[_0x0478('0x2d')]['findOne']({'where':{'id':_0x50660e[_0x0478('0x50')]['id']}})['then'](handleEntityNotFound(_0x3d2e70,null))[_0x0478('0x19')](function(_0x12263c){if(_0x12263c){_0x89992c=_0x12263c;_0x18dbdd['model']=_[_0x0478('0xc4')](db[_0x0478('0xd9')][_0x0478('0x2e')]);_0x18dbdd[_0x0478('0x3b')]=_[_0x0478('0xc4')](_0x50660e[_0x0478('0x3b')]);_0x18dbdd[_0x0478('0xc6')]=_[_0x0478('0xd0')](_0x18dbdd[_0x0478('0xc3')],_0x18dbdd['query']);_0x236f5a[_0x0478('0x52')]=_['intersection'](_0x18dbdd[_0x0478('0xc3')],qs[_0x0478('0xc7')](_0x50660e[_0x0478('0x3b')]['fields']));_0x236f5a[_0x0478('0x52')]=_0x236f5a[_0x0478('0x52')]['length']?_0x236f5a[_0x0478('0x52')]:_0x18dbdd[_0x0478('0xc3')];_0x236f5a[_0x0478('0xc8')]=qs[_0x0478('0xc9')](_0x50660e['query'][_0x0478('0xc9')]);_0x236f5a[_0x0478('0x3a')]=qs[_0x0478('0xc6')](_[_0x0478('0xca')](_0x50660e[_0x0478('0x3b')],_0x18dbdd['filters']));if(_0x50660e[_0x0478('0x3b')][_0x0478('0x24')]){_0x236f5a[_0x0478('0x3a')]=_['merge'](_0x236f5a['where'],{'$or':_[_0x0478('0x2f')](_0x236f5a['attributes'],function(_0x2ca743){var _0x1cb203={};_0x1cb203[_0x2ca743]={'$like':'%'+_0x50660e['query'][_0x0478('0x24')]+'%'};return _0x1cb203;})});}_0x236f5a=_[_0x0478('0xcb')]({},_0x236f5a,_0x50660e[_0x0478('0x51')]);return _0x89992c[_0x0478('0xd8')](_0x236f5a);}})[_0x0478('0x19')](function(_0x4d8a50){if(_0x4d8a50){_0x204639=_0x4d8a50[_0x0478('0x44')];if(!_0x50660e[_0x0478('0x3b')][_0x0478('0xcc')](_0x0478('0xcd'))){_0x236f5a[_0x0478('0xce')]=qs[_0x0478('0xce')](_0x50660e['query'][_0x0478('0xce')]);_0x236f5a[_0x0478('0x15')]=qs[_0x0478('0x15')](_0x50660e[_0x0478('0x3b')][_0x0478('0x15')]);}return _0x89992c['getChatInteractions'](_0x236f5a);}})[_0x0478('0x19')](function(_0x226cb0){if(_0x226cb0){return _0x226cb0?{'count':_0x204639,'rows':_0x226cb0}:null;}})[_0x0478('0x19')](respondWithResult(_0x3d2e70,null))[_0x0478('0x4e')](handleError(_0x3d2e70,null));};exports[_0x0478('0xda')]=function(_0x7c2657,_0x1e125d){var _0xf29121={};var _0x53c752={};var _0x3454e2;var _0x4609be;return db[_0x0478('0x2d')][_0x0478('0xc2')]({'where':{'id':_0x7c2657[_0x0478('0x50')]['id']}})[_0x0478('0x19')](handleEntityNotFound(_0x1e125d,null))[_0x0478('0x19')](function(_0x4dff67){if(_0x4dff67){_0x3454e2=_0x4dff67;_0x53c752['model']=_[_0x0478('0xc4')](db[_0x0478('0xdb')][_0x0478('0x2e')]);_0x53c752[_0x0478('0x3b')]=_[_0x0478('0xc4')](_0x7c2657[_0x0478('0x3b')]);_0x53c752[_0x0478('0xc6')]=_[_0x0478('0xd0')](_0x53c752[_0x0478('0xc3')],_0x53c752['query']);_0xf29121[_0x0478('0x52')]=_['intersection'](_0x53c752[_0x0478('0xc3')],qs['fields'](_0x7c2657[_0x0478('0x3b')][_0x0478('0xc7')]));_0xf29121[_0x0478('0x52')]=_0xf29121['attributes'][_0x0478('0x44')]?_0xf29121[_0x0478('0x52')]:_0x53c752['model'];_0xf29121[_0x0478('0xc8')]=qs[_0x0478('0xc9')](_0x7c2657[_0x0478('0x3b')][_0x0478('0xc9')]);_0xf29121['where']=qs[_0x0478('0xc6')](_[_0x0478('0xca')](_0x7c2657['query'],_0x53c752[_0x0478('0xc6')]));if(_0x7c2657['query']['filter']){_0xf29121['where']=_[_0x0478('0xcb')](_0xf29121[_0x0478('0x3a')],{'$or':_['map'](_0xf29121[_0x0478('0x52')],function(_0x2ba71c){var _0x6470d0={};_0x6470d0[_0x2ba71c]={'$like':'%'+_0x7c2657[_0x0478('0x3b')][_0x0478('0x24')]+'%'};return _0x6470d0;})});}_0xf29121=_[_0x0478('0xcb')]({},_0xf29121,_0x7c2657[_0x0478('0x51')]);return _0x3454e2[_0x0478('0xda')](_0xf29121);}})['then'](function(_0x205fc8){if(_0x205fc8){_0x4609be=_0x205fc8[_0x0478('0x44')];if(!_0x7c2657[_0x0478('0x3b')][_0x0478('0xcc')]('nolimit')){_0xf29121[_0x0478('0xce')]=qs[_0x0478('0xce')](_0x7c2657['query'][_0x0478('0xce')]);_0xf29121[_0x0478('0x15')]=qs[_0x0478('0x15')](_0x7c2657[_0x0478('0x3b')]['offset']);}return _0x3454e2['getOpenchannelInteractions'](_0xf29121);}})[_0x0478('0x19')](function(_0x58d5e2){if(_0x58d5e2){return _0x58d5e2?{'count':_0x4609be,'rows':_0x58d5e2}:null;}})[_0x0478('0x19')](respondWithResult(_0x1e125d,null))[_0x0478('0x4e')](handleError(_0x1e125d,null));};exports['getMailInteractions']=function(_0x1612e8,_0x39f5f9){var _0x48ef02={'raw':!![],'where':{}};var _0x3558fe={};var _0x2a00b2={'count':0x0,'rows':[]};return db[_0x0478('0x2d')][_0x0478('0xc2')]({'where':{'id':_0x1612e8['params']['id']}})[_0x0478('0x19')](handleEntityNotFound(_0x39f5f9,null))[_0x0478('0x19')](function(_0x4caa90){if(_0x4caa90){_0x3558fe['model']=_[_0x0478('0xc4')](db['MailInteraction'][_0x0478('0x2e')]);_0x3558fe[_0x0478('0x3b')]=_[_0x0478('0xc4')](_0x1612e8[_0x0478('0x3b')]);_0x3558fe['filters']=_[_0x0478('0xd0')](_0x3558fe[_0x0478('0xc3')],_0x3558fe[_0x0478('0x3b')]);_0x48ef02[_0x0478('0x52')]=_['intersection'](_0x3558fe[_0x0478('0xc3')],qs[_0x0478('0xc7')](_0x1612e8[_0x0478('0x3b')][_0x0478('0xc7')]));_0x48ef02[_0x0478('0x52')]=_0x48ef02[_0x0478('0x52')][_0x0478('0x44')]?_0x48ef02[_0x0478('0x52')]:_0x3558fe[_0x0478('0xc3')];if(!_0x1612e8[_0x0478('0x3b')][_0x0478('0xcc')](_0x0478('0xcd'))){_0x48ef02[_0x0478('0xce')]=qs[_0x0478('0xce')](_0x1612e8['query'][_0x0478('0xce')]);_0x48ef02[_0x0478('0x15')]=qs[_0x0478('0x15')](_0x1612e8[_0x0478('0x3b')][_0x0478('0x15')]);}_0x48ef02[_0x0478('0xc8')]=qs[_0x0478('0xc9')](_0x1612e8['query'][_0x0478('0xc9')]);_0x48ef02[_0x0478('0x3a')]=qs[_0x0478('0xc6')](_[_0x0478('0xca')](_0x1612e8[_0x0478('0x3b')],_0x3558fe[_0x0478('0xc6')]));_0x48ef02[_0x0478('0x3a')][_0x0478('0xd5')]=_0x4caa90['id'];if(_0x1612e8[_0x0478('0x3b')]['filter']){_0x48ef02[_0x0478('0x3a')]=_[_0x0478('0xcb')](_0x48ef02[_0x0478('0x3a')],{'$or':_[_0x0478('0x2f')](_0x48ef02['attributes'],function(_0x100f98){var _0x6e8f24={};_0x6e8f24[_0x100f98]={'$like':'%'+_0x1612e8[_0x0478('0x3b')][_0x0478('0x24')]+'%'};return _0x6e8f24;})});}_0x48ef02=_[_0x0478('0xcb')]({},_0x48ef02,_0x1612e8['options']);return db[_0x0478('0xdc')][_0x0478('0x17')]({'where':_0x48ef02[_0x0478('0x3a')]})[_0x0478('0x19')](function(_0x3cab1f){_0x2a00b2[_0x0478('0x17')]=_0x3cab1f;if(_0x1612e8[_0x0478('0x3b')][_0x0478('0x3c')]){_0x48ef02['include']=[{'all':!![]}];}return db['MailInteraction'][_0x0478('0x41')](_0x48ef02);})[_0x0478('0x19')](function(_0xf258c3){_0x2a00b2[_0x0478('0x42')]=_0xf258c3;return _0x2a00b2;});}})[_0x0478('0x19')](respondWithFilteredResult(_0x39f5f9,_0x48ef02))[_0x0478('0x4e')](handleError(_0x39f5f9,null));};exports[_0x0478('0xdd')]=function(_0x401331,_0x155796){var _0x9e79b5={};var _0x1bdc33={};var _0x271dfa;var _0x131913;return db[_0x0478('0x2d')][_0x0478('0xc2')]({'where':{'id':_0x401331[_0x0478('0x50')]['id']}})[_0x0478('0x19')](handleEntityNotFound(_0x155796,null))[_0x0478('0x19')](function(_0x2ccafe){if(_0x2ccafe){_0x271dfa=_0x2ccafe;_0x1bdc33[_0x0478('0xc3')]=_[_0x0478('0xc4')](db['SmsInteraction'][_0x0478('0x2e')]);_0x1bdc33['query']=_[_0x0478('0xc4')](_0x401331['query']);_0x1bdc33[_0x0478('0xc6')]=_[_0x0478('0xd0')](_0x1bdc33[_0x0478('0xc3')],_0x1bdc33[_0x0478('0x3b')]);_0x9e79b5['attributes']=_[_0x0478('0xd0')](_0x1bdc33[_0x0478('0xc3')],qs[_0x0478('0xc7')](_0x401331['query'][_0x0478('0xc7')]));_0x9e79b5[_0x0478('0x52')]=_0x9e79b5['attributes'][_0x0478('0x44')]?_0x9e79b5[_0x0478('0x52')]:_0x1bdc33[_0x0478('0xc3')];_0x9e79b5['order']=qs[_0x0478('0xc9')](_0x401331[_0x0478('0x3b')][_0x0478('0xc9')]);_0x9e79b5['where']=qs['filters'](_[_0x0478('0xca')](_0x401331[_0x0478('0x3b')],_0x1bdc33[_0x0478('0xc6')]));if(_0x401331[_0x0478('0x3b')][_0x0478('0x24')]){_0x9e79b5[_0x0478('0x3a')]=_[_0x0478('0xcb')](_0x9e79b5[_0x0478('0x3a')],{'$or':_[_0x0478('0x2f')](_0x9e79b5[_0x0478('0x52')],function(_0x3a8d83){var _0x197254={};_0x197254[_0x3a8d83]={'$like':'%'+_0x401331[_0x0478('0x3b')][_0x0478('0x24')]+'%'};return _0x197254;})});}_0x9e79b5=_[_0x0478('0xcb')]({},_0x9e79b5,_0x401331[_0x0478('0x51')]);return _0x271dfa[_0x0478('0xdd')](_0x9e79b5);}})[_0x0478('0x19')](function(_0x1d6560){if(_0x1d6560){_0x131913=_0x1d6560['length'];if(!_0x401331[_0x0478('0x3b')][_0x0478('0xcc')]('nolimit')){_0x9e79b5[_0x0478('0xce')]=qs['limit'](_0x401331[_0x0478('0x3b')][_0x0478('0xce')]);_0x9e79b5[_0x0478('0x15')]=qs['offset'](_0x401331[_0x0478('0x3b')][_0x0478('0x15')]);}return _0x271dfa[_0x0478('0xdd')](_0x9e79b5);}})[_0x0478('0x19')](function(_0x437430){if(_0x437430){return _0x437430?{'count':_0x131913,'rows':_0x437430}:null;}})[_0x0478('0x19')](respondWithResult(_0x155796,null))[_0x0478('0x4e')](handleError(_0x155796,null));};exports[_0x0478('0xde')]=function(_0x48dfe0,_0x9f05f7){var _0x57f597={};var _0x2b1fd1={};var _0x41a14f;var _0x319cef;return db['User']['findOne']({'where':{'id':_0x48dfe0[_0x0478('0x50')]['id']}})[_0x0478('0x19')](handleEntityNotFound(_0x9f05f7,null))['then'](function(_0x3939a7){if(_0x3939a7){_0x41a14f=_0x3939a7;_0x2b1fd1[_0x0478('0xc3')]=_[_0x0478('0xc4')](db[_0x0478('0xdf')][_0x0478('0x2e')]);_0x2b1fd1[_0x0478('0x3b')]=_[_0x0478('0xc4')](_0x48dfe0[_0x0478('0x3b')]);_0x2b1fd1[_0x0478('0xc6')]=_[_0x0478('0xd0')](_0x2b1fd1[_0x0478('0xc3')],_0x2b1fd1['query']);_0x57f597[_0x0478('0x52')]=_[_0x0478('0xd0')](_0x2b1fd1['model'],qs[_0x0478('0xc7')](_0x48dfe0[_0x0478('0x3b')]['fields']));_0x57f597[_0x0478('0x52')]=_0x57f597[_0x0478('0x52')]['length']?_0x57f597['attributes']:_0x2b1fd1[_0x0478('0xc3')];_0x57f597[_0x0478('0xc8')]=qs['sort'](_0x48dfe0[_0x0478('0x3b')]['sort']);_0x57f597['where']=qs[_0x0478('0xc6')](_[_0x0478('0xca')](_0x48dfe0[_0x0478('0x3b')],_0x2b1fd1['filters']));if(_0x48dfe0['query'][_0x0478('0x24')]){_0x57f597[_0x0478('0x3a')]=_[_0x0478('0xcb')](_0x57f597[_0x0478('0x3a')],{'$or':_[_0x0478('0x2f')](_0x57f597[_0x0478('0x52')],function(_0x132598){var _0x62caea={};_0x62caea[_0x132598]={'$like':'%'+_0x48dfe0[_0x0478('0x3b')][_0x0478('0x24')]+'%'};return _0x62caea;})});}_0x57f597=_[_0x0478('0xcb')]({},_0x57f597,_0x48dfe0[_0x0478('0x51')]);return _0x41a14f[_0x0478('0xde')](_0x57f597);}})[_0x0478('0x19')](function(_0x6d1f7f){if(_0x6d1f7f){_0x319cef=_0x6d1f7f[_0x0478('0x44')];if(!_0x48dfe0[_0x0478('0x3b')][_0x0478('0xcc')](_0x0478('0xcd'))){_0x57f597[_0x0478('0xce')]=qs[_0x0478('0xce')](_0x48dfe0['query'][_0x0478('0xce')]);_0x57f597[_0x0478('0x15')]=qs['offset'](_0x48dfe0['query']['offset']);}return _0x41a14f[_0x0478('0xde')](_0x57f597);}})[_0x0478('0x19')](function(_0x5ae8b1){if(_0x5ae8b1){return _0x5ae8b1?{'count':_0x319cef,'rows':_0x5ae8b1}:null;}})[_0x0478('0x19')](respondWithResult(_0x9f05f7,null))[_0x0478('0x4e')](handleError(_0x9f05f7,null));};exports[_0x0478('0xe0')]=function(_0x2020eb,_0xca9cc6){var _0x584578={};var _0x2fe738={};var _0x3dc6f7;var _0x336771;return db[_0x0478('0x2d')][_0x0478('0xc2')]({'where':{'id':_0x2020eb[_0x0478('0x50')]['id']}})['then'](handleEntityNotFound(_0xca9cc6,null))[_0x0478('0x19')](function(_0x13b825){if(_0x13b825){_0x3dc6f7=_0x13b825;_0x2fe738[_0x0478('0xc3')]=_[_0x0478('0xc4')](db['WhatsappInteraction'][_0x0478('0x2e')]);_0x2fe738[_0x0478('0x3b')]=_['keys'](_0x2020eb[_0x0478('0x3b')]);_0x2fe738[_0x0478('0xc6')]=_[_0x0478('0xd0')](_0x2fe738[_0x0478('0xc3')],_0x2fe738[_0x0478('0x3b')]);_0x584578[_0x0478('0x52')]=_['intersection'](_0x2fe738[_0x0478('0xc3')],qs[_0x0478('0xc7')](_0x2020eb[_0x0478('0x3b')][_0x0478('0xc7')]));_0x584578[_0x0478('0x52')]=_0x584578[_0x0478('0x52')]['length']?_0x584578[_0x0478('0x52')]:_0x2fe738['model'];_0x584578[_0x0478('0xc8')]=qs[_0x0478('0xc9')](_0x2020eb[_0x0478('0x3b')][_0x0478('0xc9')]);_0x584578[_0x0478('0x3a')]=qs[_0x0478('0xc6')](_[_0x0478('0xca')](_0x2020eb[_0x0478('0x3b')],_0x2fe738['filters']));if(_0x2020eb[_0x0478('0x3b')][_0x0478('0x24')]){_0x584578[_0x0478('0x3a')]=_[_0x0478('0xcb')](_0x584578['where'],{'$or':_[_0x0478('0x2f')](_0x584578[_0x0478('0x52')],function(_0x173393){var _0x43b0c5={};_0x43b0c5[_0x173393]={'$like':'%'+_0x2020eb[_0x0478('0x3b')][_0x0478('0x24')]+'%'};return _0x43b0c5;})});}_0x584578=_[_0x0478('0xcb')]({},_0x584578,_0x2020eb['options']);return _0x3dc6f7[_0x0478('0xe0')](_0x584578);}})[_0x0478('0x19')](function(_0x240203){if(_0x240203){_0x336771=_0x240203[_0x0478('0x44')];if(!_0x2020eb[_0x0478('0x3b')][_0x0478('0xcc')](_0x0478('0xcd'))){_0x584578[_0x0478('0xce')]=qs[_0x0478('0xce')](_0x2020eb[_0x0478('0x3b')][_0x0478('0xce')]);_0x584578['offset']=qs['offset'](_0x2020eb['query'][_0x0478('0x15')]);}return _0x3dc6f7[_0x0478('0xe0')](_0x584578);}})[_0x0478('0x19')](function(_0xd39b31){if(_0xd39b31){return _0xd39b31?{'count':_0x336771,'rows':_0xd39b31}:null;}})['then'](respondWithResult(_0xca9cc6,null))[_0x0478('0x4e')](handleError(_0xca9cc6,null));};exports[_0x0478('0xe1')]=function(_0x3cbbb9,_0x23d39b,_0x1c8d5c){var _0x274f58;var _0x455a4f;var _0x5d76d8;var _0x2cd2d3=!_[_0x0478('0x5b')](_0x3cbbb9[_0x0478('0x50')]['id'])?_0x3cbbb9['params']['id']:!_['isNil'](_0x3cbbb9[_0x0478('0x20')]['id'])?_0x3cbbb9[_0x0478('0x20')]['id']:null;return db[_0x0478('0x2d')]['find']({'where':{'id':_0x2cd2d3,'role':{'$or':[_0x0478('0x1e'),_0x0478('0x20'),_0x0478('0x22')]}},'attributes':['id',_0x0478('0x29'),_0x0478('0xe2'),_0x0478('0xe3'),_0x0478('0x1a'),_0x0478('0x58'),_0x0478('0x95')]})[_0x0478('0x19')](function(_0x2d22a9){if(_0x2d22a9){if(_0x2d22a9[_0x0478('0x1a')]===_0x0478('0x22')){_0x274f58=_0x2d22a9;if(_0x3cbbb9[_0x0478('0x53')][_0x0478('0x9d')]){_0x5d76d8=util[_0x0478('0xbb')](_0x0478('0xe4'),_0x274f58[_0x3cbbb9[_0x0478('0x53')][_0x0478('0x9d')]]);}else if(_0x3cbbb9[_0x0478('0x53')][_0x0478('0xe5')]){_0x5d76d8=util['format'](_0x0478('0x9e'),_0x3cbbb9[_0x0478('0x53')][_0x0478('0xe5')]);}else{_0x5d76d8=util[_0x0478('0xbb')](_0x0478('0x9e'),_0x274f58['name']);}socket['to'](util['format'](_0x0478('0xe6'),_0x274f58[_0x0478('0x29')]))['emit']('user:forcelogout',{'user':{'id':_0x274f58['id'],'name':_0x274f58[_0x0478('0x29')]},'ip':_0x3cbbb9[_0x0478('0xe7')][_0x0478('0xe8')]||_0x3cbbb9[_0x0478('0xe9')][_0x0478('0xea')]||_0x3cbbb9[_0x0478('0xeb')][_0x0478('0xea')]||_0x3cbbb9[_0x0478('0xe9')][_0x0478('0xeb')]['remoteAddress']});return db[_0x0478('0x9f')]['destroy']({'where':{'membername':_0x274f58[_0x0478('0x29')]},'individualHooks':!![]});}}else{throw new db[(_0x0478('0x87'))][(_0x0478('0x88'))](_0x0478('0xec'));}})[_0x0478('0x19')](function(){if(_0x274f58){return _0x274f58[_0x0478('0xed')]({'raw':!![]});}})[_0x0478('0x19')](function(_0x4ae7ea){if(_0x274f58){if(_0x4ae7ea){_0x455a4f=_0x4ae7ea;if(_0x455a4f['length']){var _0x376a7f=_0x455a4f[_0x0478('0x2f')](function(_0xa561d){var _0x3361ba={'membername':_0x274f58[_0x0478('0x29')],'UserId':_0x274f58['id'],'queue_name':_0xa561d[_0x0478('0x29')],'VoiceQueueId':_0xa561d['id'],'interface':_0x5d76d8,'paused':_0x274f58['loginInPause']||![],'penalty':_0xa561d[_0x0478('0xee')]||0x0};return db[_0x0478('0x9f')][_0x0478('0xa0')](_0x3361ba);});return Promise[_0x0478('0x4d')](_0x376a7f);}}}})[_0x0478('0x19')](function(){if(_0x274f58){return db[_0x0478('0xef')][_0x0478('0x41')]({'where':{'membername':_0x274f58[_0x0478('0x29')],'exitAt':null}});}})[_0x0478('0x19')](function(_0x37ea00){if(_0x274f58){var _0xaded19=[];_0x37ea00[_0x0478('0xf0')](function(_0x2031f5){_0xaded19[_0x0478('0x45')](_0x2031f5['update']({'exitAt':moment()[_0x0478('0xbb')](_0x0478('0xf1'))}));});return Promise[_0x0478('0x4d')](_0xaded19);}})[_0x0478('0x19')](function(){if(_0x274f58){var _0x22493d=[];var _0x5e31bf=[];var _0x3e5d37=utils[_0x0478('0xf2')]();var _0x3f61d3={'membername':_0x274f58[_0x0478('0x29')],'interface':_0x5d76d8,'enterAt':moment()[_0x0478('0xbb')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x274f58[_0x0478('0x1a')],'internal':_0x274f58[_0x0478('0x58')]};_0x3e5d37[_0x0478('0xf0')](function(_0x1880c3){_0x22493d[_0x0478('0x45')](_['merge']({'channel':_0x1880c3,'type':_0x0478('0xf3'),'data1':_0x3cbbb9[_0x0478('0x53')][_0x0478('0xf4')],'data2':_0x5d76d8},_0x3f61d3));if(_0x274f58[_0x0478('0x95')]){_0x5e31bf[_0x0478('0x45')](_[_0x0478('0xcb')]({'channel':_0x1880c3,'type':_0x0478('0xf5'),'data1':_0x0478('0xf6')},_0x3f61d3));}});return db['MemberReport']['bulkCreate'](_0x22493d[_0x0478('0xf7')](_0x5e31bf),{'individualHooks':!![]});}})[_0x0478('0x19')](function(){if(_0x274f58){return _0x274f58[_0x0478('0x18')]({'online':!![],'lastLoginAt':moment()[_0x0478('0xbb')](_0x0478('0xf1')),'voicePause':_0x274f58[_0x0478('0x95')]||![],'mailPause':_0x274f58[_0x0478('0x95')]||![],'chatPause':_0x274f58[_0x0478('0x95')]||![],'faxPause':_0x274f58[_0x0478('0x95')]||![],'smsPause':_0x274f58[_0x0478('0x95')]||![],'openchannelPause':_0x274f58['loginInPause']||![],'whatsappPause':_0x274f58['loginInPause']||![],'pauseType':_0x274f58[_0x0478('0x95')]?_0x0478('0xf6'):null,'interface':_0x5d76d8,'lastPauseAt':moment()[_0x0478('0xbb')](_0x0478('0xf1'))});}})[_0x0478('0x19')](function(_0x410d38){if(_0x3cbbb9['isMiddleware']){return _0x1c8d5c();}else{return Promise[_0x0478('0xf8')](_0x410d38)['then'](respondWithResult(_0x23d39b,null));}})[_0x0478('0x4e')](handleError(_0x23d39b,null));};exports[_0x0478('0xf9')]=function(_0x84c4e9,_0x2667b1){var _0x3d33a6;return db[_0x0478('0x2d')][_0x0478('0x28')]({'where':{'id':_0x84c4e9[_0x0478('0x50')]['id'],'role':_0x0478('0x22')},'attributes':['id',_0x0478('0x29'),_0x0478('0x1a')]})[_0x0478('0x19')](handleEntityNotFound(_0x2667b1,null))['then'](function(_0x2bd790){if(_0x2bd790){_0x3d33a6=_0x2bd790;return db[_0x0478('0x9f')][_0x0478('0x1c')]({'where':{'membername':_0x3d33a6[_0x0478('0x29')]},'individualHooks':!![]});}})[_0x0478('0x19')](function(){return db['MemberReport'][_0x0478('0x41')]({'where':{'membername':_0x3d33a6[_0x0478('0x29')],'exitAt':null}});})[_0x0478('0x19')](function(_0xcd19fa){var _0x135aa9=[];_0xcd19fa[_0x0478('0xf0')](function(_0x53aa7c){_0x135aa9['push'](_0x53aa7c[_0x0478('0x18')]({'exitAt':moment()[_0x0478('0xbb')](_0x0478('0xf1'))}));});return Promise[_0x0478('0x4d')](_0x135aa9);})[_0x0478('0x19')](function(){return _0x3d33a6['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0478('0x19')](respondWithResult(_0x2667b1,null))[_0x0478('0x4e')](handleError(_0x2667b1,null));};exports[_0x0478('0xfa')]=function(_0x569315,_0x2988c8){var _0x4c6a1a;return db[_0x0478('0x9f')][_0x0478('0x18')]({'paused':0x1},{'where':{'UserId':_0x569315[_0x0478('0x50')]['id']},'individualHooks':!![]})[_0x0478('0x19')](function(){return db[_0x0478('0x2d')][_0x0478('0x28')]({'where':{'id':_0x569315[_0x0478('0x50')]['id'],'role':_0x0478('0x22')},'attributes':['id','name','role',_0x0478('0x58'),_0x0478('0x9d'),_0x0478('0x94')]});})[_0x0478('0x19')](handleEntityNotFound(_0x2988c8,null))[_0x0478('0x19')](function(_0xcee03){if(_0xcee03){_0x4c6a1a=_0xcee03;return db['MemberReport']['findAll']({'where':{'membername':_0x4c6a1a[_0x0478('0x29')],'type':_0x0478('0xf5'),'exitAt':null}});}})['then'](function(_0x1e428e){if(_0x1e428e[_0x0478('0x44')]){var _0x5d9b2d=moment()[_0x0478('0xbb')](_0x0478('0xf1'));for(var _0x43c4a8=0x0,_0xd5106b=_0x1e428e[_0x0478('0x44')];_0x43c4a8<_0xd5106b;_0x43c4a8++){_0x1e428e[_0x43c4a8][_0x0478('0xfb')]({'exitAt':_0x5d9b2d});}}})[_0x0478('0x19')](function(){var _0x28374f=[];var _0x22b2f5=utils['getChannels']();_0x22b2f5[_0x0478('0xf0')](function(_0x387950){_0x28374f['push']({'channel':_0x387950,'membername':_0x4c6a1a['name'],'interface':_[_0x0478('0x5b')](_0x4c6a1a[_0x0478('0x9d')])?util[_0x0478('0xbb')]('SIP/%s',_0x4c6a1a[_0x0478('0x29')]):_0x4c6a1a[_0x0478('0x9d')],'type':_0x0478('0xf5'),'enterAt':moment()[_0x0478('0xbb')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x569315[_0x0478('0x53')]['type']||'DEFAULT\x20PAUSE','role':_0x4c6a1a[_0x0478('0x1a')],'internal':_0x4c6a1a[_0x0478('0x58')]});});return db['MemberReport'][_0x0478('0x7b')](_0x28374f,{'individualHooks':!![]});})['then'](function(){return _0x4c6a1a[_0x0478('0x18')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x569315['body'][_0x0478('0x30')]||_0x0478('0xfc'),'lastPauseAt':moment()['format'](_0x0478('0xf1'))});})['then'](respondWithResult(_0x2988c8,null))[_0x0478('0x4e')](handleError(_0x2988c8,null));};exports[_0x0478('0xfd')]=function(_0x53ec6a,_0x20099f){if(_0x53ec6a[_0x0478('0x53')][_0x0478('0x93')]&&!utils[_0x0478('0xa1')](_0x53ec6a[_0x0478('0x53')][_0x0478('0x93')])){throw new APIBadRequestError(util[_0x0478('0xbb')](_0x0478('0xfe'),_0x53ec6a[_0x0478('0x53')][_0x0478('0x93')]));}return db[_0x0478('0x2d')][_0x0478('0x28')]({'where':{'id':_0x53ec6a[_0x0478('0x50')]['id']},'attributes':['id',_0x0478('0x29'),_0x0478('0x1a'),_0x0478('0x58'),_0x0478('0x9d'),_0x0478('0x94'),'voicePause',_0x0478('0xff'),_0x0478('0x100'),'faxPause',_0x0478('0x101'),_0x0478('0x102'),'whatsappPause',_0x0478('0x103'),_0x0478('0x104')]})[_0x0478('0x19')](function(_0x4f1ddc){if(!_0x4f1ddc){throw new APINotFoundError(util[_0x0478('0xbb')](_0x0478('0xbc'),_0x53ec6a[_0x0478('0x50')]['id']));}return _0x4f1ddc[_0x0478('0xfd')](_0x53ec6a['body']['channel']);})[_0x0478('0x19')](respondWithResult(_0x20099f,null))['catch'](APIHandleError(_0x20099f));};exports[_0x0478('0x105')]=function(_0x541b6d,_0x17de3d){var _0x4a72e7={};var _0x1c07f4={};var _0x11b9ce;var _0x38f930;return db[_0x0478('0x2d')][_0x0478('0xc2')]({'where':{'id':_0x541b6d[_0x0478('0x50')]['id']}})[_0x0478('0x19')](handleEntityNotFound(_0x17de3d,null))[_0x0478('0x19')](function(_0x4f5965){if(_0x4f5965){_0x11b9ce=_0x4f5965;_0x1c07f4[_0x0478('0xc3')]=_[_0x0478('0xc4')](db[_0x0478('0x106')][_0x0478('0x2e')]);_0x1c07f4['query']=_['keys'](_0x541b6d[_0x0478('0x3b')]);_0x1c07f4[_0x0478('0xc6')]=_[_0x0478('0xd0')](_0x1c07f4['model'],_0x1c07f4[_0x0478('0x3b')]);_0x4a72e7[_0x0478('0x52')]=_[_0x0478('0xd0')](_0x1c07f4[_0x0478('0xc3')],qs['fields'](_0x541b6d[_0x0478('0x3b')]['fields']));_0x4a72e7[_0x0478('0x52')]=_0x4a72e7[_0x0478('0x52')][_0x0478('0x44')]?_0x4a72e7[_0x0478('0x52')]:_0x1c07f4[_0x0478('0xc3')];_0x4a72e7[_0x0478('0xc8')]=qs['sort'](_0x541b6d[_0x0478('0x3b')][_0x0478('0xc9')]);_0x4a72e7['where']=qs[_0x0478('0xc6')](_['pick'](_0x541b6d['query'],_0x1c07f4[_0x0478('0xc6')]));if(_0x541b6d['query'][_0x0478('0x24')]){_0x4a72e7[_0x0478('0x3a')]=_[_0x0478('0xcb')](_0x4a72e7[_0x0478('0x3a')],{'$or':_['map'](_0x4a72e7[_0x0478('0x52')],function(_0x5a7181){var _0x5d25f4={};_0x5d25f4[_0x5a7181]={'$like':'%'+_0x541b6d[_0x0478('0x3b')][_0x0478('0x24')]+'%'};return _0x5d25f4;})});}_0x4a72e7=_[_0x0478('0xcb')]({},_0x4a72e7,_0x541b6d[_0x0478('0x51')]);return _0x11b9ce[_0x0478('0x105')](_0x4a72e7);}})[_0x0478('0x19')](function(_0x5a2d75){if(_0x5a2d75){_0x38f930=_0x5a2d75[_0x0478('0x44')];if(!_0x541b6d['query'][_0x0478('0xcc')](_0x0478('0xcd'))){_0x4a72e7[_0x0478('0xce')]=qs['limit'](_0x541b6d[_0x0478('0x3b')][_0x0478('0xce')]);_0x4a72e7[_0x0478('0x15')]=qs[_0x0478('0x15')](_0x541b6d[_0x0478('0x3b')][_0x0478('0x15')]);}return _0x11b9ce[_0x0478('0x105')](_0x4a72e7);}})[_0x0478('0x19')](function(_0x4aaa0a){if(_0x4aaa0a){return _0x4aaa0a?{'count':_0x38f930,'rows':_0x4aaa0a}:null;}})[_0x0478('0x19')](respondWithResult(_0x17de3d,null))[_0x0478('0x4e')](handleError(_0x17de3d,null));};exports[_0x0478('0x107')]=function(_0x5a1d56,_0x1b6a21){var _0x47cbdd=_0x5a1d56[_0x0478('0x50')]['id'];var _0x512f95=_0x5a1d56[_0x0478('0x53')]?_0x5a1d56[_0x0478('0x53')]['ids']:null;var _0x4d4490=[];return Promise[_0x0478('0xf8')]()[_0x0478('0x19')](function(){if(!_0x512f95)throw new APIBadRequestError(_0x0478('0x108'));})[_0x0478('0x19')](function(){return db[_0x0478('0x2d')]['findOne']({'where':{'id':_0x47cbdd}});})['then'](function(_0x22eba2){if(!_0x22eba2)throw new APINotFoundError(util['format'](_0x0478('0xbc'),_0x5a1d56['params']['id']));return db[_0x0478('0x5d')][_0x0478('0x109')](function(_0x31e1e6){return _0x22eba2[_0x0478('0x107')](_0x512f95,{'transaction':_0x31e1e6})[_0x0478('0x19')](function(){return db[_0x0478('0x106')][_0x0478('0x41')]({'where':{'id':{'$in':_0x512f95}}});})['then'](function(_0x1d4b39){var _0x2acada=_[_0x0478('0x2f')](_0x1d4b39,function(_0x39987e){return _0x39987e['getAssociatedQueues']();});return Promise['all'](_0x2acada);})[_0x0478('0x19')](function(_0x3f0107){_0x4d4490=_[_0x0478('0x10a')](_0x3f0107);var _0x108ff0=_[_0x0478('0x2f')](_0x4d4490,function(_0x73704e){return _0x73704e[_0x0478('0x10b')](_0x22eba2['id'],{'transaction':_0x31e1e6});});return Promise['all'](_0x108ff0);})['then'](function(){if(!_0x22eba2['online'])return;var _0x25eb9c=_['filter'](_0x4d4490,function(_0xc60561){return _0xc60561[_0x0478('0x10c')](_0x0478('0x93'))===_0x0478('0x10d');});var _0x327a74=_[_0x0478('0x2f')](_0x25eb9c,function(_0x6e5378){return db['UserVoiceQueueRt'][_0x0478('0xa0')]({'membername':_0x22eba2[_0x0478('0x29')],'UserId':_0x22eba2['id'],'queue_name':_0x6e5378[_0x0478('0x29')],'VoiceQueueId':_0x6e5378['id'],'interface':_[_0x0478('0x5b')](_0x22eba2['interface'])?util[_0x0478('0xbb')](_0x0478('0x9e'),_0x22eba2[_0x0478('0x29')]):_0x22eba2[_0x0478('0x9d')],'paused':_0x22eba2[_0x0478('0x96')]||![],'penalty':_0x22eba2['penalty']},{'transaction':_0x31e1e6});});return Promise[_0x0478('0x4d')](_0x327a74);})['then'](function(){return db[_0x0478('0x10e')][_0x0478('0x41')]({'where':{'teamId':{'$in':_0x512f95}}});})['then'](function(_0xa7d511){var _0x4ae4e1=_[_0x0478('0x2f')](_0xa7d511,function(_0x57a9f2){return db[_0x0478('0x10f')]['create']({'UserId':_0x22eba2['id'],'VoicePrefixId':_0x57a9f2[_0x0478('0x110')]},{'transaction':_0x31e1e6});});return Promise[_0x0478('0x4d')](_0x4ae4e1);});});})[_0x0478('0x19')](function(){for(var _0xc79251=0x0;_0xc79251<_0x4d4490[_0x0478('0x44')];_0xc79251++){var _0x77df76=_0x4d4490[_0xc79251][_0x0478('0x10c')](_0x0478('0x93'));var _0x337b18=_0x77df76+'QueueId';socket[_0x0478('0x1b')]('user'+_0x77df76+_0x0478('0x111'),{'UserId':_0x47cbdd,['queueField']:_0x4d4490[_0xc79251]['id']});}})['then'](respondWithStatusCode(_0x1b6a21,null))[_0x0478('0x4e')](APIHandleError(_0x1b6a21));};exports[_0x0478('0x112')]=function(_0x1a42f2,_0x4b8181){var _0x346866=_0x1a42f2[_0x0478('0x50')]['id'];var _0x20b6b4=null;if(_0x1a42f2[_0x0478('0x3b')][_0x0478('0x56')]){_0x20b6b4=_[_0x0478('0x113')](_0x1a42f2[_0x0478('0x3b')][_0x0478('0x56')])?_0x1a42f2[_0x0478('0x3b')][_0x0478('0x56')]:[_0x1a42f2['query'][_0x0478('0x56')]];}var _0x513b82=[];return Promise[_0x0478('0xf8')]()[_0x0478('0x19')](function(){if(!_0x20b6b4)throw new APIBadRequestError(_0x0478('0x114'));})['then'](function(){return db[_0x0478('0x2d')][_0x0478('0xc2')]({'where':{'id':_0x346866}});})[_0x0478('0x19')](function(_0x3234e9){if(!_0x3234e9)throw new APINotFoundError(util[_0x0478('0xbb')](_0x0478('0xbc'),_0x1a42f2[_0x0478('0x50')]['id']));return db[_0x0478('0x5d')]['transaction'](function(_0x47ed80){return _0x3234e9[_0x0478('0x112')](_0x20b6b4,{'transaction':_0x47ed80})[_0x0478('0x19')](function(){return db[_0x0478('0x106')][_0x0478('0x41')]({'where':{'id':{'$in':_0x20b6b4}}});})['then'](function(_0x475dc4){var _0x403d6f=_['map'](_0x475dc4,function(_0x1e6ae0){return _0x1e6ae0[_0x0478('0x115')]();});return Promise['all'](_0x403d6f);})[_0x0478('0x19')](function(_0x210cc9){_0x513b82=_[_0x0478('0x10a')](_0x210cc9);var _0x5e29cf=_[_0x0478('0x2f')](_0x513b82,function(_0x200377){return _0x200377[_0x0478('0x116')](_0x3234e9['id'],{'transaction':_0x47ed80});});return Promise[_0x0478('0x4d')](_0x5e29cf);})[_0x0478('0x19')](function(){if(!_0x3234e9['online'])return;var _0x3fb39e=_[_0x0478('0x24')](_0x513b82,function(_0x2830ad){return _0x2830ad[_0x0478('0x10c')](_0x0478('0x93'))===_0x0478('0x10d');});var _0x39dbfe=_[_0x0478('0x2f')](_0x3fb39e,function(_0x12e7d8){return db[_0x0478('0x9f')]['destroy']({'where':{'VoiceQueueId':_0x12e7d8['id'],'UserId':_0x3234e9['id']},'transaction':_0x47ed80});});return Promise['all'](_0x39dbfe);})[_0x0478('0x19')](function(){return db[_0x0478('0x10e')][_0x0478('0x41')]({'where':{'teamId':{'$in':_0x20b6b4}}});})[_0x0478('0x19')](function(_0x4955b8){var _0x152b8a=_[_0x0478('0x2f')](_0x4955b8,function(_0x3ed00c){return db[_0x0478('0x10f')][_0x0478('0x1c')]({'where':{'UserId':_0x3234e9['id'],'VoicePrefixId':_0x3ed00c[_0x0478('0x110')]}},{'transaction':_0x47ed80});});return Promise[_0x0478('0x4d')](_0x152b8a);});});})[_0x0478('0x19')](function(){for(var _0xd653bb=0x0;_0xd653bb<_0x513b82[_0x0478('0x44')];_0xd653bb++){var _0x5ece87=_0x513b82[_0xd653bb][_0x0478('0x10c')](_0x0478('0x93'));var _0x3d5da1=_0x5ece87+_0x0478('0xa5');socket['emit'](_0x0478('0x20')+_0x5ece87+'Queue:remove',{'UserId':_0x346866,['queueField']:_0x513b82[_0xd653bb]['id']});}})[_0x0478('0x19')](respondWithStatusCode(_0x4b8181,null))[_0x0478('0x4e')](APIHandleError(_0x4b8181));};exports[_0x0478('0x117')]=function(_0x152a6b,_0x47257b){var _0x671ef4={};var _0x534b5a={};var _0x3c4d88;var _0x51b020;return db['User']['findOne']({'where':{'id':_0x152a6b[_0x0478('0x50')]['id']}})['then'](handleEntityNotFound(_0x47257b,null))[_0x0478('0x19')](function(_0xb5966b){if(_0xb5966b){_0x3c4d88=_0xb5966b;_0x534b5a[_0x0478('0xc3')]=_['keys'](db['CmList'][_0x0478('0x2e')]);_0x534b5a[_0x0478('0x3b')]=_[_0x0478('0xc4')](_0x152a6b[_0x0478('0x3b')]);_0x534b5a[_0x0478('0xc6')]=_['intersection'](_0x534b5a[_0x0478('0xc3')],_0x534b5a['query']);_0x671ef4['attributes']=_[_0x0478('0xd0')](_0x534b5a['model'],qs['fields'](_0x152a6b['query'][_0x0478('0xc7')]));_0x671ef4[_0x0478('0x52')]=_0x671ef4[_0x0478('0x52')]['length']?_0x671ef4[_0x0478('0x52')]:_0x534b5a[_0x0478('0xc3')];_0x671ef4[_0x0478('0xc8')]=qs['sort'](_0x152a6b[_0x0478('0x3b')][_0x0478('0xc9')]);_0x671ef4[_0x0478('0x3a')]=qs['filters'](_[_0x0478('0xca')](_0x152a6b[_0x0478('0x3b')],_0x534b5a[_0x0478('0xc6')]));if(_0x152a6b[_0x0478('0x3b')]['filter']){_0x671ef4['where']=_['merge'](_0x671ef4[_0x0478('0x3a')],{'$or':_[_0x0478('0x2f')](_0x671ef4[_0x0478('0x52')],function(_0xee527b){var _0x50a602={};_0x50a602[_0xee527b]={'$like':'%'+_0x152a6b['query'][_0x0478('0x24')]+'%'};return _0x50a602;})});}_0x671ef4=_[_0x0478('0xcb')]({},_0x671ef4,_0x152a6b['options']);return _0x3c4d88[_0x0478('0x117')](_0x671ef4);}})['then'](function(_0x58b4d8){if(_0x58b4d8){_0x51b020=_0x58b4d8['length'];if(!_0x152a6b['query'][_0x0478('0xcc')](_0x0478('0xcd'))){_0x671ef4[_0x0478('0xce')]=qs['limit'](_0x152a6b[_0x0478('0x3b')][_0x0478('0xce')]);_0x671ef4[_0x0478('0x15')]=qs[_0x0478('0x15')](_0x152a6b[_0x0478('0x3b')]['offset']);}return _0x3c4d88[_0x0478('0x117')](_0x671ef4);}})['then'](function(_0x4e95d7){if(_0x4e95d7){return _0x4e95d7?{'count':_0x51b020,'rows':_0x4e95d7}:null;}})[_0x0478('0x19')](respondWithResult(_0x47257b,null))[_0x0478('0x4e')](handleError(_0x47257b,null));};exports['getAgents']=function(_0x252e2f,_0x2dd600){var _0x504961={};var _0x1e76a5={};var _0x5cf507;return db[_0x0478('0x2d')]['findOne']({'where':{'id':_0x252e2f[_0x0478('0x50')]['id']}})[_0x0478('0x19')](handleEntityNotFound(_0x2dd600,null))[_0x0478('0x19')](function(_0xde525d){if(_0xde525d){_0x5cf507=_0xde525d;_0x1e76a5[_0x0478('0xc3')]=_[_0x0478('0xc4')](db[_0x0478('0x2d')]['rawAttributes']);_0x1e76a5[_0x0478('0x3b')]=_[_0x0478('0xc4')](_0x252e2f[_0x0478('0x3b')]);_0x1e76a5[_0x0478('0xc6')]=_['intersection'](_0x1e76a5[_0x0478('0xc3')],_0x1e76a5['query']);_0x504961[_0x0478('0x52')]=_['intersection'](_0x1e76a5[_0x0478('0xc3')],qs[_0x0478('0xc7')](_0x252e2f['query'][_0x0478('0xc7')]));_0x504961['attributes']=_0x504961['attributes'][_0x0478('0x44')]?_0x504961[_0x0478('0x52')]:_0x1e76a5[_0x0478('0xc3')];_0x504961[_0x0478('0xc8')]=qs[_0x0478('0xc9')](_0x252e2f[_0x0478('0x3b')]['sort']);_0x504961[_0x0478('0x3a')]=qs[_0x0478('0xc6')](_[_0x0478('0xca')](_0x252e2f[_0x0478('0x3b')],_0x1e76a5['filters']));if(_0x252e2f['query']['filter']){_0x504961[_0x0478('0x3a')]=_[_0x0478('0xcb')](_0x504961[_0x0478('0x3a')],{'$or':_['map'](_0x504961[_0x0478('0x52')],function(_0x5d219b){var _0x4c723a={};_0x4c723a[_0x5d219b]={'$like':'%'+_0x252e2f['query'][_0x0478('0x24')]+'%'};return _0x4c723a;})});}_0x504961[_0x0478('0xc3')]=db[_0x0478('0x2d')];_0x504961['as']='Agents';_0x504961=_['merge']({},_0x504961,_0x252e2f['options']);return _0x5cf507['getVoiceQueues']({'include':[_0x504961]});}})['then'](function(_0x467fa0){if(_0x467fa0){var _0xd725d={},_0x19074e=[];for(var _0x5c1a77=0x0;_0x5c1a77<_0x467fa0[_0x0478('0x44')];_0x5c1a77+=0x1){for(var _0xd2e74d=0x0,_0x1084cf;_0xd2e74d<_0x467fa0[_0x5c1a77][_0x0478('0x21')][_0x0478('0x44')];_0xd2e74d+=0x1){_0x1084cf=_0x467fa0[_0x5c1a77][_0x0478('0x21')][_0xd2e74d][_0x0478('0x1d')]({'plain':!![]});_0xd725d[_0x1084cf['id']]=_0x1084cf;}}_0xd725d=_['values'](_0xd725d);for(var _0x353835=qs[_0x0478('0x15')](_0x252e2f[_0x0478('0x3b')]['offset']);_0x353835<_0xd725d[_0x0478('0x44')]&&_0x19074e[_0x0478('0x44')]=_0x3cad86){_0x25822c=_0x3cad86;_0x47fb08=0xc8;}else{_0x47fb08=0xce;}_0x381177['status'](_0x47fb08);return _0x381177[_0x2954('0x1b')]('Content-Range',_0x236fda+'-'+_0x25822c+'/'+_0x3cad86)[_0x2954('0x1c')](_0x26356a);}return null;};}function saveUpdates(_0x76a26f){return function(_0x32b864){if(_0x32b864){return _0x32b864[_0x2954('0x1d')](_0x76a26f)[_0x2954('0x1e')](function(_0x11645e){if(_0x11645e[_0x2954('0x1f')]===_0x2954('0x20')){socket[_0x2954('0x21')](_0x2954('0x22')+_0x11645e['id'],_0x11645e);}return _0x11645e;});}return null;};}function removeEntity(_0x4ff4aa){return function(_0x4736aa){if(_0x4736aa){return _0x4736aa[_0x2954('0x23')]()[_0x2954('0x1e')](function(){var _0x7e5782=_0x4736aa['get']({'plain':!![]});if(_0x7e5782[_0x2954('0x1f')]===_0x2954('0x24'))return;var _0x494e3a=[{'name':'Users','value':_0x2954('0x25'),'ignore':!![]},{'name':_0x2954('0x26'),'value':_0x2954('0x20'),'ignore':![]},{'name':'Telephones','value':_0x2954('0x27'),'ignore':![]}];var _0x51a680=_(_0x494e3a)['filter'](_0x2954('0x28'))[_0x2954('0x29')](_0x2954('0x2a'))[_0x2954('0x2a')]();if(_[_0x2954('0x2b')](_0x51a680,_0x7e5782[_0x2954('0x1f')])){return;}var _0x511372=_['find'](_0x494e3a,[_0x2954('0x2a'),_0x7e5782[_0x2954('0x1f')]])[_0x2954('0x2c')];return db[_0x2954('0x2d')][_0x2954('0x23')]({'where':{'type':_0x511372,'resourceId':_0x7e5782['id']}})['then'](function(){return _0x4736aa;});})[_0x2954('0x1e')](function(){_0x4ff4aa[_0x2954('0x16')](0xcc)[_0x2954('0x15')]();});}};}function handleEntityNotFound(_0x1fa4a9){return function(_0x4e9400){if(!_0x4e9400){_0x1fa4a9['sendStatus'](0x194);}return _0x4e9400;};}function handleError(_0x9a375c,_0x348f46){_0x348f46=_0x348f46||0x1f4;return function(_0x545530){logger[_0x2954('0x2e')](_0x545530['stack']);if(_0x545530['name']){delete _0x545530[_0x2954('0x2c')];}_0x9a375c[_0x2954('0x16')](_0x348f46)[_0x2954('0x2f')](_0x545530);};}function getUserAttributes(){return _(db['User'][_0x2954('0x30')])[_0x2954('0x29')](function(_0x1a648c){return{'name':_0x1a648c[_0x2954('0x31')],'type':_0x1a648c[_0x2954('0x32')][_0x2954('0x33')]};})[_0x2954('0x34')](function(_0xbfb8c1){return![_0x2954('0x35'),_0x2954('0x36'),_0x2954('0x37'),_0x2954('0x38'),_0x2954('0x39'),'passwordResetAt',_0x2954('0x3a')]['includes'](_0xbfb8c1[_0x2954('0x2c')]);})[_0x2954('0x2a')]();}exports[_0x2954('0x3b')]=function(_0x5cc842,_0x2102a2){var _0xd06020={},_0x5ade5b={'count':0x0,'rows':[]};var _0x31d58b=getUserAttributes();_0xd06020=qs['getOptions'](_0x31d58b,_0x5cc842);var _0x418af2={'where':_0xd06020[_0x2954('0x3c')]};return db['User'][_0x2954('0x19')](_0x418af2)[_0x2954('0x1e')](function(_0x5eeaf0){_0x5ade5b[_0x2954('0x19')]=_0x5eeaf0;if(_0x5cc842[_0x2954('0x3d')]['includeAll']){_0xd06020[_0x2954('0x3e')]=[{'all':!![]}];}if(_0x5cc842[_0x2954('0x3d')][_0x2954('0x3f')]===_0x2954('0x40')){_0xd06020[_0x2954('0x3e')]=[{'model':db[_0x2954('0x41')],'as':_0x2954('0x3f')}];}if(!_[_0x2954('0x2b')](_0xd06020['attributes'],'id')){_0xd06020['attributes'][_0x2954('0x42')]('id');}return db[_0x2954('0x43')][_0x2954('0x44')](_0xd06020);})[_0x2954('0x1e')](function(_0x438354){_0x5ade5b[_0x2954('0x45')]=_0x438354;if(_0x5cc842[_0x2954('0x3d')][_0x2954('0x46')]===_0x2954('0x40')){var _0x59d446=[];for(var _0x1c5daf=0x0;_0x1c5daf<_0x5ade5b[_0x2954('0x45')]['length'];_0x1c5daf++){_0x59d446[_0x2954('0x42')](get_open_tabs(_0x2954('0x47'),_0x5ade5b['rows'][_0x1c5daf][_0x2954('0x48')]));_0x59d446[_0x2954('0x42')](get_open_tabs(_0x2954('0x49'),_0x5ade5b['rows'][_0x1c5daf][_0x2954('0x48')]));_0x59d446['push'](get_open_tabs('fax',_0x5ade5b[_0x2954('0x45')][_0x1c5daf][_0x2954('0x48')]));_0x59d446[_0x2954('0x42')](get_open_tabs(_0x2954('0x4a'),_0x5ade5b[_0x2954('0x45')][_0x1c5daf][_0x2954('0x48')]));_0x59d446[_0x2954('0x42')](get_open_tabs(_0x2954('0x4b'),_0x5ade5b[_0x2954('0x45')][_0x1c5daf][_0x2954('0x48')]));_0x59d446['push'](get_open_tabs(_0x2954('0x4c'),_0x5ade5b[_0x2954('0x45')][_0x1c5daf][_0x2954('0x48')]));}return Promise[_0x2954('0x4d')](_0x59d446)[_0x2954('0x1e')](function(){return _0x5ade5b;});}else{return _0x5ade5b;}})['then'](respondWithFilteredResult(_0x2102a2,_0xd06020))[_0x2954('0x4e')](handleError(_0x2102a2,null));};exports[_0x2954('0x4f')]=function(_0x3a5143,_0x222f9c){var _0x24e460=getUserAttributes();_0x3a5143[_0x2954('0x3d')]['id']=_0x3a5143['params']['id'];var _0x2ea856=qs[_0x2954('0x50')](_0x24e460,_0x3a5143);if(_0x3a5143[_0x2954('0x3d')][_0x2954('0x51')]){_0x2ea856['include']=[{'all':!![]}];}if(_0x3a5143[_0x2954('0x3d')][_0x2954('0x3f')]===_0x2954('0x40')){_0x2ea856[_0x2954('0x3e')]=[{'model':db[_0x2954('0x41')],'as':_0x2954('0x3f')}];}_0x2ea856=_[_0x2954('0x52')]({},_0x2ea856,_0x3a5143[_0x2954('0x53')]);if(!_['includes'](_0x2ea856[_0x2954('0x54')],'id')){_0x2ea856[_0x2954('0x54')][_0x2954('0x42')]('id');}return db[_0x2954('0x43')][_0x2954('0x55')](_0x2ea856)['then'](handleEntityNotFound(_0x222f9c,null))[_0x2954('0x1e')](function(_0x1b64a2){var _0x45572d=[];values=_0x1b64a2;if(_0x3a5143['query'][_0x2954('0x46')]===_0x2954('0x40')){_0x45572d[_0x2954('0x42')](get_open_tabs(_0x2954('0x47'),_0x1b64a2['dataValues']));_0x45572d[_0x2954('0x42')](get_open_tabs(_0x2954('0x49'),_0x1b64a2['dataValues']));_0x45572d[_0x2954('0x42')](get_open_tabs(_0x2954('0x4b'),_0x1b64a2['dataValues']));_0x45572d[_0x2954('0x42')](get_open_tabs(_0x2954('0x4c'),_0x1b64a2['dataValues']));_0x45572d[_0x2954('0x42')](get_open_tabs('fax',_0x1b64a2[_0x2954('0x48')]));_0x45572d[_0x2954('0x42')](get_open_tabs('mail',_0x1b64a2[_0x2954('0x48')]));return Promise[_0x2954('0x4d')](_0x45572d);}else{return values;}})[_0x2954('0x1e')](function(){return values;})[_0x2954('0x1e')](respondWithResult(_0x222f9c,null))[_0x2954('0x4e')](handleError(_0x222f9c,null));};exports[_0x2954('0x1d')]=function(_0x3e049c,_0x34d815){if(_0x3e049c[_0x2954('0x56')]['id']){delete _0x3e049c[_0x2954('0x56')]['id'];}delete _0x3e049c[_0x2954('0x56')][_0x2954('0x1f')];return db[_0x2954('0x43')][_0x2954('0x55')]({'where':{'id':_0x3e049c[_0x2954('0x57')]['id']}})[_0x2954('0x1e')](handleEntityNotFound(_0x34d815,null))[_0x2954('0x1e')](saveUpdates(_0x3e049c[_0x2954('0x56')],null))[_0x2954('0x1e')](respondWithResult(_0x34d815,null))[_0x2954('0x4e')](handleError(_0x34d815,null));};exports[_0x2954('0x58')]=function(_0xc0e4c0,_0x325d32){return db[_0x2954('0x43')][_0x2954('0x58')]()[_0x2954('0x1e')](respondWithResult(_0x325d32,null))['catch'](handleError(_0x325d32,null));};exports[_0x2954('0x59')]=function(_0x119d53,_0x6cc8aa){return db[_0x2954('0x43')]['find']({'where':{'id':_0x119d53[_0x2954('0x57')]['id']}})[_0x2954('0x1e')](handleEntityNotFound(_0x6cc8aa,null))[_0x2954('0x1e')](function(_0x534d30){if(_0x534d30){return _0x534d30['addContacts'](_0x119d53[_0x2954('0x56')]['ids'],_[_0x2954('0x5a')](_0x119d53['body'],[_0x2954('0x5b'),'id'])||{});}})[_0x2954('0x1e')](respondWithResult(_0x6cc8aa,null))[_0x2954('0x4e')](handleError(_0x6cc8aa,null));};function validateUser(_0x1547c2){return new Promise(function(_0x169d5b,_0x5a7046){if(_0x1547c2[_0x2954('0x5c')])return _0x169d5b(_0x1547c2);return db['Setting'][_0x2954('0x5d')](0x1)[_0x2954('0x1e')](function(_0x116464){if(_0x116464[_0x2954('0x5e')])authService[_0x2954('0x5f')](_0x1547c2[_0x2954('0x35')]);db[_0x2954('0x43')]['max']('internal')[_0x2954('0x1e')](function(_0x334daa){if(_[_0x2954('0x60')](_0x334daa)){_0x1547c2[_0x2954('0x5c')]=_0x116464[_0x2954('0x61')]||0x1;return;}if(_[_0x2954('0x60')](_0x116464[_0x2954('0x61')])||_0x116464[_0x2954('0x61')]===_0x334daa){_0x1547c2[_0x2954('0x5c')]=_0x334daa+0x1;return;}if(_0x116464['min_internal']>_0x334daa){_0x1547c2[_0x2954('0x5c')]=_0x116464[_0x2954('0x61')];return;}return db[_0x2954('0x62')][_0x2954('0x3d')](_0x2954('0x63'),{'type':db[_0x2954('0x62')][_0x2954('0x64')][_0x2954('0x65')]})[_0x2954('0x1e')](function(_0x31cfce){if(_0x31cfce&&_0x31cfce[_0x2954('0x66')]){for(var _0x37589f=0x0,_0x5d8c56=_0x31cfce[_0x2954('0x66')];_0x37589f<_0x5d8c56&&_[_0x2954('0x60')](_0x1547c2[_0x2954('0x5c')]);_0x37589f++){if(_0x116464['min_internal']<=_0x31cfce[_0x37589f][_0x2954('0x67')]){_0x1547c2['internal']=_0x31cfce[_0x37589f][_0x2954('0x67')];}else if(_0x116464[_0x2954('0x61')]>_0x31cfce[_0x37589f]['from']&&_0x116464[_0x2954('0x61')]<=_0x31cfce[_0x37589f]['to']){_0x1547c2[_0x2954('0x5c')]=_0x116464[_0x2954('0x61')];}}}if(_[_0x2954('0x60')](_0x1547c2[_0x2954('0x5c')])){_0x1547c2[_0x2954('0x5c')]=_0x334daa+0x1;}return _0x169d5b(_0x1547c2);});});})[_0x2954('0x4e')](function(_0x5421d5){_0x5a7046(_0x5421d5);});});}function updateUser(_0x5c11a1){return new Promise(function(_0x287476,_0x3b434d){try{if(_0x5c11a1['voicemail']){_0x5c11a1['mailbox']=_0x5c11a1['internal'];_0x5c11a1[_0x2954('0x68')]={'mailbox':_0x5c11a1['internal'],'password':_0x5c11a1[_0x2954('0x35')],'fullname':_0x5c11a1['fullname'],'email':_0x5c11a1['email']};}if(_0x5c11a1[_0x2954('0x1f')]===_0x2954('0x20')){if(!_0x5c11a1[_0x2954('0x69')])_0x5c11a1[_0x2954('0x69')]=[_0x2954('0x6a'),_0x2954('0x6b'),'103',_0x2954('0x6c'),'110','104','105',_0x2954('0x6d'),_0x2954('0x6e'),_0x2954('0x6f'),_0x2954('0x70'),'100',_0x2954('0x71'),_0x2954('0x72'),_0x2954('0x73')];}_0x287476(_0x5c11a1);}catch(_0x5a942e){_0x3b434d(_0x5a942e);}});}exports['create']=function(_0x5ea3f2,_0x4496df){if(_0x5ea3f2[_0x2954('0x25')]['role']===_0x2954('0x20'))throw new Error(_0x2954('0x74'));if(_0x5ea3f2[_0x2954('0x56')]['role']==='user'&&_0x5ea3f2[_0x2954('0x25')][_0x2954('0x1f')]!==_0x2954('0x24')){throw new Error(_0x2954('0x75'));}if(_0x5ea3f2['body'][_0x2954('0x1f')]==='admin'&&_0x5ea3f2[_0x2954('0x25')][_0x2954('0x1f')]!==_0x2954('0x24')){throw new Error(_0x2954('0x76'));}return licenseUtil[_0x2954('0x77')]([_0x5ea3f2[_0x2954('0x56')]])[_0x2954('0x1e')](function(){return validateUser(_0x5ea3f2['body']);})['then'](function(_0x4bd81f){return updateUser(_0x4bd81f)['then'](function(_0x563d44){if(_0x563d44[_0x2954('0x1f')]===_0x2954('0x24')){_0x563d44[_0x2954('0x78')]=_0x5ea3f2[_0x2954('0x25')]['settingsEnabled'];delete _0x563d44[_0x2954('0x79')];}return _0x563d44;});})['then'](function(_0xa40ce7){return db[_0x2954('0x43')][_0x2954('0x7a')](_0xa40ce7,{'include':[{'model':db[_0x2954('0x68')],'as':_0x2954('0x68')}]});})['then'](function(_0x3dea33){if(_0x5ea3f2['body']['role']===_0x2954('0x25'))return _0x3dea33;if(_0x5ea3f2[_0x2954('0x25')][_0x2954('0x1f')]!==_0x2954('0x25'))return _0x3dea33;return db['UserProfileSection'][_0x2954('0x55')]({'where':{'name':_0x3dea33[_0x2954('0x1f')]===_0x2954('0x20')?'Agents':_0x2954('0x7b'),'userProfileId':_0x5ea3f2[_0x2954('0x25')][_0x2954('0x79')]},'raw':!![]})[_0x2954('0x1e')](function(_0x5d1d22){if(!_0x5d1d22||_0x5d1d22[_0x2954('0x7c')]!=0x0)return _0x3dea33;return db[_0x2954('0x2d')]['create']({'name':_0x3dea33[_0x2954('0x2c')],'resourceId':_0x3dea33['id'],'type':_0x5d1d22[_0x2954('0x2c')],'sectionId':_0x5d1d22['id']},{})[_0x2954('0x1e')](function(){return _0x3dea33;});})[_0x2954('0x4e')](function(_0x50cdfd){logger[_0x2954('0x2e')](_0x2954('0x7d'),_0x50cdfd);throw _0x50cdfd;});})[_0x2954('0x1e')](respondWithResult(_0x4496df,0xc9))['catch'](handleError(_0x4496df,null));};exports[_0x2954('0x7e')]=function(_0x3f566c,_0x4293f3){var _0x46c210=_0x3f566c['body'];var _0x389f3f=[];if(_0x3f566c[_0x2954('0x25')]['role']===_0x2954('0x20'))throw new Error('Unauthorized');if(_[_0x2954('0x7f')](_0x46c210,[_0x2954('0x1f'),_0x2954('0x25')])&&_0x3f566c[_0x2954('0x25')]['role']!==_0x2954('0x24')){throw new Error(_0x2954('0x75'));}if(_['some'](_0x46c210,[_0x2954('0x1f'),_0x2954('0x24')])&&_0x3f566c['user'][_0x2954('0x1f')]!==_0x2954('0x24')){throw new Error(_0x2954('0x80'));}return licenseUtil[_0x2954('0x77')](_0x46c210)[_0x2954('0x1e')](function(){return validateUser(_0x46c210[0x0]);})['then'](function(){for(var _0x5a8899=0x1;_0x5a8899<_0x46c210['length'];_0x5a8899++){var _0x3b5990=_0x46c210[_0x5a8899-0x1]['internal'];if(!_0x46c210[_0x5a8899][_0x2954('0x5c')])_0x46c210[_0x5a8899][_0x2954('0x5c')]=_0x3b5990+0x1;_0x389f3f['push'](validateUser(_0x46c210[_0x5a8899]));}return Promise[_0x2954('0x4d')](_0x389f3f);})[_0x2954('0x1e')](function(){_0x389f3f=[];for(var _0x2a0757=0x0;_0x2a0757<_0x46c210[_0x2954('0x66')];_0x2a0757++){_0x389f3f[_0x2954('0x42')](updateUser(_0x46c210[_0x2a0757]));}return Promise['all'](_0x389f3f);})[_0x2954('0x1e')](function(){_0x389f3f=_0x46c210[_0x2954('0x29')](function(_0xfb50fc){return db['User'][_0x2954('0x7a')](_0xfb50fc,{'include':[{'model':db[_0x2954('0x68')],'as':_0x2954('0x68')}]})[_0x2954('0x1e')](function(_0x53249e){_0xfb50fc['id']=_0x53249e['id'];return _0xfb50fc;});});return Promise[_0x2954('0x4d')](_0x389f3f);})['then'](function(_0x338419){if(_0x3f566c[_0x2954('0x56')][_0x2954('0x1f')]==='user')return _0x338419;if(_0x3f566c['user'][_0x2954('0x1f')]!==_0x2954('0x25'))return _0x338419;var _0x386e37=_['some'](_0x338419,function(_0x3f69f6){return _0x3f69f6[_0x2954('0x1f')]===_0x2954('0x20')||_0x3f69f6[_0x2954('0x1f')]==='telephone';});if(!_0x386e37)return _0x338419;return db['UserProfileSection'][_0x2954('0x44')]({'where':{'name':{'$or':[_0x2954('0x26'),'Telephones']},'userProfileId':_0x3f566c['user'][_0x2954('0x79')]},'raw':!![]})[_0x2954('0x1e')](function(_0x1c4f2b){if(_[_0x2954('0x81')](_0x1c4f2b)||!_[_0x2954('0x7f')](_0x1c4f2b,[_0x2954('0x7c'),0x0]))return _0x338419;_0x389f3f=[];var _0x425247=_(_0x1c4f2b)[_0x2954('0x29')](function(_0x303a0a){if(_0x303a0a[_0x2954('0x7c')]===0x1)return;return _0x303a0a['name']===_0x2954('0x26')?'agent':_0x2954('0x27');})['compact']()['value']();for(var _0x21b901=0x0;_0x21b901<_0x338419[_0x2954('0x66')];_0x21b901++){if(!_['includes'](_0x425247,_0x338419[_0x21b901]['role']))return;var _0x58043d=_0x338419[_0x21b901][_0x2954('0x1f')]===_0x2954('0x20')?'Agents':_0x2954('0x7b');_0x389f3f[_0x2954('0x42')](db[_0x2954('0x2d')][_0x2954('0x7a')]({'name':_0x338419[_0x21b901][_0x2954('0x2c')],'resourceId':_0x338419[_0x21b901]['id'],'type':_0x58043d,'sectionId':_['find'](_0x1c4f2b,[_0x2954('0x2c'),_0x58043d])['id']},{}));}return Promise[_0x2954('0x4d')](_0x389f3f);});})[_0x2954('0x1e')](respondWithResult(_0x4293f3,0xc9))[_0x2954('0x4e')](handleError(_0x4293f3,null));};exports['changePassword']=function(_0x7ddab3,_0x151cdc){if(_0x7ddab3['body']['id']){delete _0x7ddab3[_0x2954('0x56')]['id'];}return db[_0x2954('0x43')]['find']({'where':{'id':_0x7ddab3[_0x2954('0x57')]['id']}})['then'](function(_0x22df03){if(!_0x22df03)return null;if(_0x22df03['id']===_0x7ddab3[_0x2954('0x25')]['id']){if(!_0x7ddab3['body'][_0x2954('0x82')]||!_0x7ddab3['body'][_0x2954('0x83')]){throw new db[(_0x2954('0x84'))][(_0x2954('0x85'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x22df03[_0x2954('0x86')](_0x7ddab3[_0x2954('0x56')][_0x2954('0x82')])){throw new db[(_0x2954('0x84'))][(_0x2954('0x85'))](_0x2954('0x87'));}if(_0x7ddab3[_0x2954('0x56')][_0x2954('0x82')]===_0x7ddab3['body'][_0x2954('0x83')]){throw new db['Sequelize'][(_0x2954('0x85'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x7ddab3[_0x2954('0x25')][_0x2954('0x1f')]===_0x2954('0x24')){if(!_0x7ddab3[_0x2954('0x56')][_0x2954('0x83')]){throw new db[(_0x2954('0x84'))]['ValidationError'](_0x2954('0x88'));}}else if(_0x7ddab3['user'][_0x2954('0x1f')]==='user'){if(!_0x7ddab3[_0x2954('0x56')][_0x2954('0x83')]){throw new db['Sequelize'][(_0x2954('0x85'))](_0x2954('0x88'));}if(_0x22df03['role']!==_0x2954('0x20')){throw new db[(_0x2954('0x84'))][(_0x2954('0x85'))](_0x2954('0x74'));}}else{throw new db[(_0x2954('0x84'))][(_0x2954('0x85'))]('Unauthorized');}return _0x22df03;})[_0x2954('0x1e')](handleEntityNotFound(_0x151cdc,null))[_0x2954('0x1e')](function(_0x34d72){return db['Setting'][_0x2954('0x89')]({'attributes':['id',_0x2954('0x5e'),_0x2954('0x8a'),_0x2954('0x8b')]})[_0x2954('0x1e')](function(_0x211308){if(_0x211308['securePassword'])authService[_0x2954('0x5f')](_0x7ddab3[_0x2954('0x56')][_0x2954('0x83')]);if(!_0x211308['enforcePasswordHistory']||!_0x34d72['previousPasswords'])return _0x34d72;authService['validatePasswordHistory'](_0x7ddab3[_0x2954('0x56')][_0x2954('0x83')],_0x34d72['previousPasswords'],_0x211308['passwordHistoryLimit']);return _0x34d72;})[_0x2954('0x1e')](saveUpdates({'password':_0x7ddab3[_0x2954('0x56')][_0x2954('0x83')],'passwordResetAt':_0x7ddab3[_0x2954('0x25')]['id']==_0x7ddab3[_0x2954('0x57')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x7ddab3[_0x2954('0x56')]['newPassword'],_0x34d72[_0x2954('0x37')])},null));})[_0x2954('0x1e')](respondWithResult(_0x151cdc,null))[_0x2954('0x4e')](handleError(_0x151cdc,null));};exports[_0x2954('0x8c')]=function(_0x5de091,_0x4738c3){var _0x4a2b21=_0x5de091[_0x2954('0x56')][_0x2954('0x8d')];return db['User']['find']({'where':{'id':_0x5de091[_0x2954('0x57')]['id']},'attributes':['id','name',_0x2954('0x1f'),'online',_0x2954('0x8e'),'voicePause',_0x2954('0x8f')]})[_0x2954('0x1e')](handleEntityNotFound(_0x4738c3,null))[_0x2954('0x1e')](function(_0x239f74){if(_0x239f74){if(!utils[_0x2954('0x90')](_0x4a2b21)){throw new db['Sequelize'][(_0x2954('0x85'))](_0x2954('0x91'));}return _0x239f74[_0x2954('0x92')+_[_0x2954('0x93')](_0x4a2b21['toLowerCase']())+'Queues'](_0x5de091[_0x2954('0x56')]['ids'],{'penalty':_0x5de091['body'][_0x2954('0x94')]||0x0})[_0x2954('0x95')](function(_0x4c9a20){for(var _0x20e13a=0x0;_0x20e13a<_0x5de091[_0x2954('0x56')][_0x2954('0x5b')][_0x2954('0x66')];_0x20e13a+=0x1){var _0x28197c={'UserId':Number(_0x5de091[_0x2954('0x57')]['id'])};_0x28197c[_[_0x2954('0x93')](_0x4a2b21[_0x2954('0x96')]())+_0x2954('0x97')]=Number(_0x5de091[_0x2954('0x56')][_0x2954('0x5b')][_0x20e13a]);socket[_0x2954('0x21')](_0x2954('0x25')+_[_0x2954('0x93')](_0x4a2b21[_0x2954('0x96')]())+_0x2954('0x98'),_0x28197c);}return _0x4c9a20;})[_0x2954('0x1e')](function(){if(_0x4a2b21===_0x2954('0x99')){return db[_0x2954('0x9a')]['findAll']({'where':{'id':_0x5de091[_0x2954('0x56')][_0x2954('0x5b')]||[]},'raw':!![],'attributes':['id',_0x2954('0x2c')]});}})[_0x2954('0x1e')](function(_0x5ab20b){var _0x5dea0a=_0x239f74[_0x2954('0x9b')]({'plain':!![]});var _0xfe4917=[];if(_0x4a2b21===_0x2954('0x99')&&_0x5dea0a[_0x2954('0x1f')]===_0x2954('0x20')&&_0x5dea0a[_0x2954('0x9c')]){for(let _0x552108=0x0;_0x552108<_0x5ab20b[_0x2954('0x66')];_0x552108+=0x1){_0xfe4917['push']({'membername':_0x5dea0a['name'],'UserId':_0x5dea0a['id'],'queue_name':_0x5ab20b[_0x552108][_0x2954('0x2c')],'VoiceQueueId':_0x5ab20b[_0x552108]['id'],'interface':_['isNil'](_0x5dea0a[_0x2954('0x8f')])?util['format']('SIP/%s',_0x5dea0a[_0x2954('0x2c')]):_0x5dea0a[_0x2954('0x8f')],'paused':_0x5dea0a['voicePause']||![],'penalty':_0x5de091['body']['penalty']||0x0});}return Promise[_0x2954('0x4d')](_0xfe4917[_0x2954('0x29')](function(_0x8de0a7){return db[_0x2954('0x9d')][_0x2954('0x9e')](_0x8de0a7);}));}return _0x239f74;});}})[_0x2954('0x1e')](respondWithStatusCode(_0x4738c3,null))['catch'](handleError(_0x4738c3,null));};exports['removeQueues']=function(_0x4785f5,_0x536634){var _0x2b5e96,_0x19404d;return db[_0x2954('0x43')][_0x2954('0x55')]({'where':{'id':_0x4785f5['params']['id']},'attributes':['id',_0x2954('0x2c'),_0x2954('0x1f')]})[_0x2954('0x1e')](handleEntityNotFound(_0x536634,null))[_0x2954('0x1e')](function(_0x49c0b7){if(_0x49c0b7){_0x2b5e96=_0x49c0b7;if(!_0x4785f5['query'][_0x2954('0x8d')]||!utils[_0x2954('0x90')](_0x4785f5['query']['channel'])){throw new db[(_0x2954('0x84'))][(_0x2954('0x85'))](_0x2954('0x91'));}return _0x49c0b7[_0x2954('0x9f')+_[_0x2954('0x93')](_0x4785f5[_0x2954('0x3d')][_0x2954('0x8d')][_0x2954('0x96')]())+_0x2954('0xa0')](_0x4785f5[_0x2954('0x3d')][_0x2954('0x5b')]);}})[_0x2954('0x1e')](function(_0x23ae96){if(_[_0x2954('0xa1')](_0x4785f5[_0x2954('0x3d')]['ids'])){for(var _0x17c7e7=0x0;_0x17c7e7<_0x4785f5['query']['ids'][_0x2954('0x66')];_0x17c7e7+=0x1){_0x19404d={'UserId':Number(_0x4785f5['params']['id'])};_0x19404d[_[_0x2954('0x93')](_0x4785f5[_0x2954('0x3d')][_0x2954('0x8d')][_0x2954('0x96')]())+'QueueId']=Number(_0x4785f5[_0x2954('0x3d')][_0x2954('0x5b')][_0x17c7e7]);socket[_0x2954('0x21')](_0x2954('0x25')+_[_0x2954('0x93')](_0x4785f5['query'][_0x2954('0x8d')]['toLowerCase']())+_0x2954('0xa2'),_0x19404d);}}else{_0x19404d={'UserId':Number(_0x4785f5[_0x2954('0x57')]['id'])};_0x19404d[_[_0x2954('0x93')](_0x4785f5[_0x2954('0x3d')][_0x2954('0x8d')][_0x2954('0x96')]())+'QueueId']=Number(_0x4785f5[_0x2954('0x3d')][_0x2954('0x5b')]);socket[_0x2954('0x21')](_0x2954('0x25')+_['capitalize'](_0x4785f5['query'][_0x2954('0x8d')][_0x2954('0x96')]())+_0x2954('0xa2'),_0x19404d);}return _0x23ae96;})[_0x2954('0x1e')](function(){if(_0x4785f5[_0x2954('0x3d')][_0x2954('0x8d')]===_0x2954('0x99')){return db[_0x2954('0x9d')][_0x2954('0x23')]({'where':{'UserId':_0x4785f5[_0x2954('0x57')]['id'],'VoiceQueueId':_0x4785f5[_0x2954('0x3d')][_0x2954('0x5b')]},'individualHooks':!![]})['then'](function(){return _0x2b5e96;});}return _0x2b5e96;})[_0x2954('0x1e')](respondWithStatusCode(_0x536634,null))[_0x2954('0x4e')](handleError(_0x536634,null));};exports[_0x2954('0xa3')]=function(_0x26989c,_0x62249e){_0x26989c[_0x2954('0x56')][_0x2954('0xa4')]=_0x26989c['file'][_0x2954('0xa5')];return db['User']['find']({'where':{'id':_0x26989c[_0x2954('0x57')]['id']}})['then'](handleEntityNotFound(_0x62249e,null))[_0x2954('0x1e')](saveUpdates(_0x26989c[_0x2954('0x56')],null))[_0x2954('0x1e')](respondWithResult(_0x62249e,null))['catch'](handleError(_0x62249e,null));};exports[_0x2954('0xa6')]=function(_0x41590a,_0x41def8){var _0x199455=path[_0x2954('0xa7')](config[_0x2954('0xa8')],'server/files/images/logos/default_profile.png');return db[_0x2954('0x43')][_0x2954('0x55')]({'where':{'id':_0x41590a['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x2954('0x1e')](handleEntityNotFound(_0x41def8,null))[_0x2954('0x1e')](function(_0x4795a5){if(_0x4795a5){if(_[_0x2954('0x60')](_0x4795a5[_0x2954('0xa4')])){return _0x41def8[_0x2954('0xa9')](_0x199455);}else{if(!fs['existsSync'](path[_0x2954('0xa7')](config[_0x2954('0xa8')],_0x2954('0xaa'),_0x4795a5[_0x2954('0xa4')]))){return _0x41def8[_0x2954('0xa9')](_0x199455);}return _0x41def8[_0x2954('0xa9')](path[_0x2954('0xa7')](config[_0x2954('0xa8')],_0x2954('0xaa'),_0x4795a5[_0x2954('0xa4')]));}}})[_0x2954('0x4e')](handleError(_0x41def8,null));};exports['getOpenTabs']=function(_0x5b504f,_0xce3b6f){return db[_0x2954('0x43')][_0x2954('0x55')]({'where':{'id':_0x5b504f['params']['id']},'attributes':['id']})[_0x2954('0x1e')](handleEntityNotFound(_0xce3b6f,null))[_0x2954('0x1e')](function(_0x205de4){var _0xd0332d=[];values=_0x205de4['dataValues'];_0xd0332d['push'](get_open_tabs('chat',_0x205de4['dataValues']));_0xd0332d[_0x2954('0x42')](get_open_tabs(_0x2954('0x49'),_0x205de4['dataValues']));_0xd0332d[_0x2954('0x42')](get_open_tabs('openchannel',_0x205de4['dataValues']));_0xd0332d[_0x2954('0x42')](get_open_tabs(_0x2954('0x4c'),_0x205de4['dataValues']));_0xd0332d[_0x2954('0x42')](get_open_tabs(_0x2954('0xab'),_0x205de4[_0x2954('0x48')]));_0xd0332d[_0x2954('0x42')](get_open_tabs(_0x2954('0x4a'),_0x205de4[_0x2954('0x48')]));return Promise[_0x2954('0x4d')](_0xd0332d);})[_0x2954('0x1e')](function(_0x5616b5){if(_0x5616b5){var _0x3d20c0=_[_0x2954('0x29')](values[_0x2954('0xac')],function(_0x19c277){return{'channel':_0x2954('0xad'),'id':_0x19c277['id'],'createdAt':_0x19c277[_0x2954('0xae')]};});var _0x4085e8=_[_0x2954('0x29')](values['FaxOpenTabs'],function(_0x545e15){return{'channel':'FAX','id':_0x545e15['id'],'createdAt':_0x545e15['createdAt']};});var _0x2916db=_[_0x2954('0x29')](values[_0x2954('0xaf')],function(_0x362574){return{'channel':_0x2954('0xb0'),'id':_0x362574['id'],'createdAt':_0x362574[_0x2954('0xae')]};});var _0x132eed=_['map'](values[_0x2954('0xb1')],function(_0x3c2aae){return{'channel':_0x2954('0xb2'),'id':_0x3c2aae['id'],'createdAt':_0x3c2aae['createdAt']};});var _0x3b8350=_[_0x2954('0x29')](values[_0x2954('0xb3')],function(_0x2c107f){return{'channel':_0x2954('0xb4'),'id':_0x2c107f['id'],'createdAt':_0x2c107f['createdAt']};});var _0x4c382a=_[_0x2954('0x29')](values[_0x2954('0xb5')],function(_0x717e){return{'channel':'WHATSAPP','id':_0x717e['id'],'createdAt':_0x717e['createdAt']};});var _0x48b4c4=_[_0x2954('0xb6')](_0x3d20c0,_0x4085e8,_0x2916db,_0x132eed,_0x3b8350,_0x4c382a);var _0x5f5004={'count':_0x48b4c4[_0x2954('0x66')],'rows':_0x48b4c4};return _0x5f5004;}else return null;})['then'](respondWithResult(_0xce3b6f,null))[_0x2954('0x4e')](handleError(_0xce3b6f,null));};exports[_0x2954('0xb7')]=function(_0x3ea589,_0x3c6188){var _0x37cb35={};return db[_0x2954('0x43')][_0x2954('0x89')]({'where':{'id':_0x3ea589[_0x2954('0x57')]['id']}})[_0x2954('0x1e')](function(_0x1f42fb){if(!_0x1f42fb){throw new APINotFoundError(util[_0x2954('0xb8')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3ea589['params']['id']));}return contacts['describe']();})[_0x2954('0x1e')](function(_0x38fadc){_0x3ea589['query'][_0x2954('0x43')]=_0x3ea589[_0x2954('0x57')]['id'];_0x37cb35=qs[_0x2954('0x50')](_0x38fadc,_0x3ea589);if(_0x3ea589[_0x2954('0x3d')][_0x2954('0xb9')](_0x2954('0x51'))){_0x37cb35['include']=[{'model':db[_0x2954('0xba')],'as':'List','required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x2954('0x2c'),_0x2954('0xbb')],'where':_0x3ea589[_0x2954('0x3d')][_0x2954('0xbc')]?{'id':_0x3ea589[_0x2954('0x3d')]['tag']}:undefined,'required':_0x3ea589[_0x2954('0x3d')][_0x2954('0xbc')]?!![]:![]}];}return contacts[_0x2954('0x44')](_0x3ea589[_0x2954('0x3d')],_0x3ea589[_0x2954('0x25')],_0x37cb35,_0x38fadc);})[_0x2954('0x1e')](respondWithFilteredResult(_0x3c6188,_0x37cb35))[_0x2954('0x4e')](APIHandleError(_0x3c6188));};exports['getQueues']=function(_0x3158f0,_0xc779cb){var _0x5d1ca5;var _0x36ceba={};var _0x164991;return db[_0x2954('0x43')][_0x2954('0x89')]({'where':{'id':_0x3158f0[_0x2954('0x57')]['id']},'attributes':['id',_0x2954('0x2c'),_0x2954('0x1f')]})[_0x2954('0x1e')](handleEntityNotFound(_0xc779cb,null))[_0x2954('0x1e')](function(_0x3cb44f){if(!utils['isValidChannel'](_0x3158f0[_0x2954('0x3d')][_0x2954('0x8d')])){throw new db[(_0x2954('0x84'))]['ValidationError'](_0x2954('0x91'));}_0x5d1ca5=_0x3cb44f;var _0x3c7c35={};_0x3c7c35[_0x2954('0xbd')]=_['keys'](db[_[_0x2954('0x93')](_0x3158f0[_0x2954('0x3d')][_0x2954('0x8d')])+'Queue']['rawAttributes']);_0x3c7c35['query']=_[_0x2954('0xbe')](_0x3158f0['query']);_0x3c7c35[_0x2954('0xbf')]=_[_0x2954('0xc0')](_0x3c7c35['model'],_0x3c7c35[_0x2954('0x3d')]);_0x36ceba[_0x2954('0x54')]=_['intersection'](_0x3c7c35['model'],qs[_0x2954('0xc1')](_0x3158f0[_0x2954('0x3d')][_0x2954('0xc1')]));_0x36ceba[_0x2954('0x54')]=_0x36ceba[_0x2954('0x54')][_0x2954('0x66')]?_0x36ceba[_0x2954('0x54')]:_0x3c7c35[_0x2954('0xbd')];_0x36ceba[_0x2954('0xc2')]=qs[_0x2954('0xc3')](_0x3158f0[_0x2954('0x3d')][_0x2954('0xc3')]);_0x36ceba[_0x2954('0x3c')]=qs['filters'](_['pick'](_0x3158f0[_0x2954('0x3d')],_0x3c7c35[_0x2954('0xbf')]));if(_0x3158f0[_0x2954('0x3d')][_0x2954('0x34')]){_0x36ceba[_0x2954('0x3c')]=_[_0x2954('0x52')](_0x36ceba[_0x2954('0x3c')],{'$or':_[_0x2954('0x29')](_0x36ceba[_0x2954('0x54')],function(_0xe90e65){var _0x130392={};_0x130392[_0xe90e65]={'$like':'%'+_0x3158f0['query'][_0x2954('0x34')]+'%'};return _0x130392;})});}_0x36ceba=_[_0x2954('0x52')]({},_0x36ceba,_0x3158f0[_0x2954('0x53')]);switch(_0x5d1ca5[_0x2954('0x1f')]){case _0x2954('0x24'):return db[_['capitalize'](_0x3158f0[_0x2954('0x3d')][_0x2954('0x8d')])+_0x2954('0xc4')]['findAll'](_0x36ceba);case _0x2954('0x25'):case'agent':return _0x5d1ca5['get'+_[_0x2954('0x93')](_0x3158f0[_0x2954('0x3d')][_0x2954('0x8d')])+_0x2954('0xa0')](_0x36ceba);default:throw new db[(_0x2954('0x84'))][(_0x2954('0x85'))]('Unknown\x20role');}})[_0x2954('0x1e')](function(_0x38f408){_0x164991=_0x38f408[_0x2954('0x66')];if(!_0x3158f0[_0x2954('0x3d')][_0x2954('0xb9')]('nolimit')){_0x36ceba['limit']=qs[_0x2954('0x18')](_0x3158f0[_0x2954('0x3d')][_0x2954('0x18')]);_0x36ceba[_0x2954('0x1a')]=qs[_0x2954('0x1a')](_0x3158f0[_0x2954('0x3d')][_0x2954('0x1a')]);}switch(_0x5d1ca5[_0x2954('0x1f')]){case'admin':return db[_[_0x2954('0x93')](_0x3158f0[_0x2954('0x3d')]['channel'])+'Queue']['findAll'](_0x36ceba);case _0x2954('0x25'):case _0x2954('0x20'):return _0x5d1ca5[_0x2954('0x9b')+_[_0x2954('0x93')](_0x3158f0[_0x2954('0x3d')][_0x2954('0x8d')])+_0x2954('0xa0')](_0x36ceba);}})[_0x2954('0x1e')](function(_0x36e981){return{'count':_0x164991,'rows':_0x36e981};})[_0x2954('0x1e')](respondWithResult(_0xc779cb,null))[_0x2954('0x4e')](handleError(_0xc779cb,null));};exports[_0x2954('0xc5')]=function(_0x22b458,_0x580bb4){var _0xecac41={};var _0x35e1d0={};var _0x53e021;var _0x543309;return db['User']['findOne']({'where':{'id':_0x22b458['params']['id']}})[_0x2954('0x1e')](handleEntityNotFound(_0x580bb4,null))['then'](function(_0x42731f){if(_0x42731f){_0x53e021=_0x42731f;_0x35e1d0['model']=_['keys'](db[_0x2954('0x9d')][_0x2954('0x30')]);_0x35e1d0[_0x2954('0x3d')]=_['keys'](_0x22b458['query']);_0x35e1d0[_0x2954('0xbf')]=_['intersection'](_0x35e1d0[_0x2954('0xbd')],_0x35e1d0[_0x2954('0x3d')]);_0xecac41[_0x2954('0x54')]=_['intersection'](_0x35e1d0[_0x2954('0xbd')],qs[_0x2954('0xc1')](_0x22b458[_0x2954('0x3d')][_0x2954('0xc1')]));_0xecac41[_0x2954('0x54')]=_0xecac41['attributes'][_0x2954('0x66')]?_0xecac41[_0x2954('0x54')]:_0x35e1d0[_0x2954('0xbd')];_0xecac41[_0x2954('0xc2')]=qs[_0x2954('0xc3')](_0x22b458['query']['sort']);_0xecac41['where']=qs[_0x2954('0xbf')](_['pick'](_0x22b458['query'],_0x35e1d0[_0x2954('0xbf')]));if(_0x22b458[_0x2954('0x3d')]['filter']){_0xecac41['where']=_['merge'](_0xecac41[_0x2954('0x3c')],{'$or':_[_0x2954('0x29')](_0xecac41[_0x2954('0x54')],function(_0x25238b){var _0x2f66e7={};_0x2f66e7[_0x25238b]={'$like':'%'+_0x22b458[_0x2954('0x3d')][_0x2954('0x34')]+'%'};return _0x2f66e7;})});}_0xecac41=_[_0x2954('0x52')]({},_0xecac41,_0x22b458[_0x2954('0x53')]);return _0x53e021[_0x2954('0xc5')](_0xecac41);}})[_0x2954('0x1e')](function(_0x2f0ff3){if(_0x2f0ff3){_0x543309=_0x2f0ff3[_0x2954('0x66')];if(!_0x22b458[_0x2954('0x3d')][_0x2954('0xb9')](_0x2954('0xc6'))){_0xecac41[_0x2954('0x18')]=qs[_0x2954('0x18')](_0x22b458[_0x2954('0x3d')][_0x2954('0x18')]);_0xecac41['offset']=qs['offset'](_0x22b458['query'][_0x2954('0x1a')]);}return _0x53e021[_0x2954('0xc5')](_0xecac41);}})[_0x2954('0x1e')](function(_0x41c641){if(_0x41c641){return _0x41c641?{'count':_0x543309,'rows':_0x41c641}:null;}})[_0x2954('0x1e')](respondWithResult(_0x580bb4,null))[_0x2954('0x4e')](handleError(_0x580bb4,null));};exports[_0x2954('0xc7')]=function(_0x3b1d5f,_0xacc705){var _0x5857fb={};var _0x5e2b38={};var _0x2b1127;var _0x3d526b;return db['User'][_0x2954('0x89')]({'where':{'id':_0x3b1d5f[_0x2954('0x57')]['id']}})[_0x2954('0x1e')](handleEntityNotFound(_0xacc705,null))['then'](function(_0x4bc1a6){if(_0x4bc1a6){_0x2b1127=_0x4bc1a6;_0x5e2b38[_0x2954('0xbd')]=_[_0x2954('0xbe')](db[_0x2954('0xc8')]['rawAttributes']);_0x5e2b38[_0x2954('0x3d')]=_[_0x2954('0xbe')](_0x3b1d5f[_0x2954('0x3d')]);_0x5e2b38['filters']=_[_0x2954('0xc0')](_0x5e2b38[_0x2954('0xbd')],_0x5e2b38['query']);_0x5857fb[_0x2954('0x54')]=_[_0x2954('0xc0')](_0x5e2b38['model'],qs[_0x2954('0xc1')](_0x3b1d5f['query'][_0x2954('0xc1')]));_0x5857fb['attributes']=_0x5857fb[_0x2954('0x54')][_0x2954('0x66')]?_0x5857fb[_0x2954('0x54')]:_0x5e2b38[_0x2954('0xbd')];_0x5857fb['order']=qs['sort'](_0x3b1d5f[_0x2954('0x3d')][_0x2954('0xc3')]);_0x5857fb[_0x2954('0x3c')]=qs['filters'](_['pick'](_0x3b1d5f[_0x2954('0x3d')],_0x5e2b38[_0x2954('0xbf')]));if(_0x3b1d5f[_0x2954('0x3d')][_0x2954('0x34')]){_0x5857fb[_0x2954('0x3c')]=_[_0x2954('0x52')](_0x5857fb[_0x2954('0x3c')],{'$or':_[_0x2954('0x29')](_0x5857fb[_0x2954('0x54')],function(_0x488e18){var _0x129a75={};_0x129a75[_0x488e18]={'$like':'%'+_0x3b1d5f[_0x2954('0x3d')][_0x2954('0x34')]+'%'};return _0x129a75;})});}_0x5857fb=_['merge']({},_0x5857fb,_0x3b1d5f[_0x2954('0x53')]);return _0x2b1127[_0x2954('0xc7')](_0x5857fb);}})['then'](function(_0x3596bb){if(_0x3596bb){_0x3d526b=_0x3596bb[_0x2954('0x66')];if(!_0x3b1d5f['query']['hasOwnProperty']('nolimit')){_0x5857fb[_0x2954('0x18')]=qs[_0x2954('0x18')](_0x3b1d5f[_0x2954('0x3d')]['limit']);_0x5857fb['offset']=qs[_0x2954('0x1a')](_0x3b1d5f[_0x2954('0x3d')][_0x2954('0x1a')]);}return _0x2b1127[_0x2954('0xc7')](_0x5857fb);}})[_0x2954('0x1e')](function(_0x1d378f){if(_0x1d378f){return _0x1d378f?{'count':_0x3d526b,'rows':_0x1d378f}:null;}})[_0x2954('0x1e')](respondWithResult(_0xacc705,null))[_0x2954('0x4e')](handleError(_0xacc705,null));};exports['getRecordings']=function(_0x928e31,_0x568ce4){var _0x541f1b={'raw':!![],'where':{}};var _0x270420={};var _0x5d3287={'count':0x0,'rows':[]};return db['User'][_0x2954('0x89')]({'where':{'id':_0x928e31[_0x2954('0x57')]['id']}})[_0x2954('0x1e')](handleEntityNotFound(_0x568ce4,null))[_0x2954('0x1e')](function(_0x58513f){if(_0x58513f){_0x270420[_0x2954('0xbd')]=_[_0x2954('0xbe')](db['VoiceRecording'][_0x2954('0x30')]);_0x270420['query']=_['keys'](_0x928e31[_0x2954('0x3d')]);_0x270420[_0x2954('0xbf')]=_[_0x2954('0xc0')](_0x270420[_0x2954('0xbd')],_0x270420[_0x2954('0x3d')]);_0x541f1b[_0x2954('0x54')]=_['intersection'](_0x270420['model'],qs['fields'](_0x928e31[_0x2954('0x3d')][_0x2954('0xc1')]));_0x541f1b['attributes']=_0x541f1b[_0x2954('0x54')][_0x2954('0x66')]?_0x541f1b[_0x2954('0x54')]:_0x270420[_0x2954('0xbd')];if(!_0x928e31[_0x2954('0x3d')]['hasOwnProperty']('nolimit')){_0x541f1b[_0x2954('0x18')]=qs[_0x2954('0x18')](_0x928e31['query'][_0x2954('0x18')]);_0x541f1b['offset']=qs['offset'](_0x928e31[_0x2954('0x3d')][_0x2954('0x1a')]);}_0x541f1b[_0x2954('0xc2')]=qs[_0x2954('0xc3')](_0x928e31[_0x2954('0x3d')][_0x2954('0xc3')]);_0x541f1b[_0x2954('0x3c')]=qs['filters'](_[_0x2954('0xc9')](_0x928e31[_0x2954('0x3d')],_0x270420[_0x2954('0xbf')]));_0x541f1b['where']['UserId']=_0x58513f['id'];if(_0x928e31[_0x2954('0x3d')]['filter']){_0x541f1b[_0x2954('0x3c')]=_[_0x2954('0x52')](_0x541f1b[_0x2954('0x3c')],{'$or':_[_0x2954('0x29')](_0x541f1b['attributes'],function(_0x586799){var _0x1fed01={};_0x1fed01[_0x586799]={'$like':'%'+_0x928e31[_0x2954('0x3d')]['filter']+'%'};return _0x1fed01;})});}_0x541f1b=_[_0x2954('0x52')]({},_0x541f1b,_0x928e31[_0x2954('0x53')]);return db[_0x2954('0xca')][_0x2954('0x19')]({'where':_0x541f1b[_0x2954('0x3c')]})[_0x2954('0x1e')](function(_0x22e398){_0x5d3287['count']=_0x22e398;if(_0x928e31[_0x2954('0x3d')][_0x2954('0x51')]){_0x541f1b[_0x2954('0x3e')]=[{'all':!![]}];}return db[_0x2954('0xca')]['findAll'](_0x541f1b);})[_0x2954('0x1e')](function(_0xc6bdde){_0x5d3287[_0x2954('0x45')]=_0xc6bdde;return _0x5d3287;});}})[_0x2954('0x1e')](respondWithFilteredResult(_0x568ce4,_0x541f1b))[_0x2954('0x4e')](handleError(_0x568ce4,null));};exports['getScreenRecordings']=function(_0x2a2f1b,_0x1a5d97){var _0x228157={'raw':!![],'where':{}};var _0x1f5f9a={};var _0x2d24e8={'count':0x0,'rows':[]};return db[_0x2954('0x43')]['findOne']({'where':{'id':_0x2a2f1b[_0x2954('0x57')]['id']}})[_0x2954('0x1e')](handleEntityNotFound(_0x1a5d97,null))[_0x2954('0x1e')](function(_0x2cf608){if(_0x2cf608){_0x1f5f9a[_0x2954('0xbd')]=_[_0x2954('0xbe')](db[_0x2954('0xcb')][_0x2954('0x30')]);_0x1f5f9a[_0x2954('0x3d')]=_[_0x2954('0xbe')](_0x2a2f1b[_0x2954('0x3d')]);_0x1f5f9a[_0x2954('0xbf')]=_[_0x2954('0xc0')](_0x1f5f9a[_0x2954('0xbd')],_0x1f5f9a[_0x2954('0x3d')]);_0x228157[_0x2954('0x54')]=_[_0x2954('0xc0')](_0x1f5f9a[_0x2954('0xbd')],qs['fields'](_0x2a2f1b[_0x2954('0x3d')][_0x2954('0xc1')]));_0x228157[_0x2954('0x54')]=_0x228157[_0x2954('0x54')][_0x2954('0x66')]?_0x228157[_0x2954('0x54')]:_0x1f5f9a[_0x2954('0xbd')];if(!_0x2a2f1b['query'][_0x2954('0xb9')](_0x2954('0xc6'))){_0x228157[_0x2954('0x18')]=qs['limit'](_0x2a2f1b[_0x2954('0x3d')][_0x2954('0x18')]);_0x228157[_0x2954('0x1a')]=qs[_0x2954('0x1a')](_0x2a2f1b['query'][_0x2954('0x1a')]);}_0x228157[_0x2954('0xc2')]=qs['sort'](_0x2a2f1b[_0x2954('0x3d')]['sort']);_0x228157[_0x2954('0x3c')]=qs[_0x2954('0xbf')](_[_0x2954('0xc9')](_0x2a2f1b[_0x2954('0x3d')],_0x1f5f9a[_0x2954('0xbf')]));_0x228157[_0x2954('0x3c')]['UserId']=_0x2cf608['id'];if(_0x2a2f1b[_0x2954('0x3d')][_0x2954('0x34')]){_0x228157['where']=_[_0x2954('0x52')](_0x228157[_0x2954('0x3c')],{'$or':_['map'](_0x228157[_0x2954('0x54')],function(_0x3c4721){var _0x1e2af2={};_0x1e2af2[_0x3c4721]={'$like':'%'+_0x2a2f1b['query'][_0x2954('0x34')]+'%'};return _0x1e2af2;})});}_0x228157=_[_0x2954('0x52')]({},_0x228157,_0x2a2f1b[_0x2954('0x53')]);return db['ScreenRecording']['count']({'where':_0x228157[_0x2954('0x3c')]})[_0x2954('0x1e')](function(_0x2964fb){_0x2d24e8[_0x2954('0x19')]=_0x2964fb;if(_0x2a2f1b[_0x2954('0x3d')][_0x2954('0x51')]){_0x228157[_0x2954('0x3e')]=[{'all':!![]}];}return db[_0x2954('0xcb')][_0x2954('0x44')](_0x228157);})[_0x2954('0x1e')](function(_0x23ebbc){_0x2d24e8[_0x2954('0x45')]=_0x23ebbc;return _0x2d24e8;});}})['then'](respondWithFilteredResult(_0x1a5d97,_0x228157))['catch'](handleError(_0x1a5d97,null));};exports[_0x2954('0xcc')]=function(_0x52b58e,_0x154e0a){var _0xfaf340={};var _0x50bdb6={};var _0x53fbe4;var _0x374bd6;return db[_0x2954('0x43')][_0x2954('0x89')]({'where':{'id':_0x52b58e['params']['id']}})[_0x2954('0x1e')](handleEntityNotFound(_0x154e0a,null))[_0x2954('0x1e')](function(_0x45dc1e){if(_0x45dc1e){_0x53fbe4=_0x45dc1e;_0x50bdb6['model']=_[_0x2954('0xbe')](db[_0x2954('0xcd')][_0x2954('0x30')]);_0x50bdb6['query']=_[_0x2954('0xbe')](_0x52b58e[_0x2954('0x3d')]);_0x50bdb6[_0x2954('0xbf')]=_[_0x2954('0xc0')](_0x50bdb6[_0x2954('0xbd')],_0x50bdb6[_0x2954('0x3d')]);_0xfaf340[_0x2954('0x54')]=_[_0x2954('0xc0')](_0x50bdb6['model'],qs['fields'](_0x52b58e[_0x2954('0x3d')][_0x2954('0xc1')]));_0xfaf340['attributes']=_0xfaf340[_0x2954('0x54')][_0x2954('0x66')]?_0xfaf340[_0x2954('0x54')]:_0x50bdb6[_0x2954('0xbd')];_0xfaf340[_0x2954('0xc2')]=qs[_0x2954('0xc3')](_0x52b58e[_0x2954('0x3d')][_0x2954('0xc3')]);_0xfaf340[_0x2954('0x3c')]=qs[_0x2954('0xbf')](_[_0x2954('0xc9')](_0x52b58e[_0x2954('0x3d')],_0x50bdb6['filters']));if(_0x52b58e[_0x2954('0x3d')][_0x2954('0x34')]){_0xfaf340[_0x2954('0x3c')]=_[_0x2954('0x52')](_0xfaf340[_0x2954('0x3c')],{'$or':_[_0x2954('0x29')](_0xfaf340[_0x2954('0x54')],function(_0x36446f){var _0x401c77={};_0x401c77[_0x36446f]={'$like':'%'+_0x52b58e['query'][_0x2954('0x34')]+'%'};return _0x401c77;})});}_0xfaf340=_[_0x2954('0x52')]({},_0xfaf340,_0x52b58e[_0x2954('0x53')]);return _0x53fbe4[_0x2954('0xcc')](_0xfaf340);}})[_0x2954('0x1e')](function(_0x403776){if(_0x403776){_0x374bd6=_0x403776['length'];if(!_0x52b58e['query']['hasOwnProperty']('nolimit')){_0xfaf340['limit']=qs[_0x2954('0x18')](_0x52b58e[_0x2954('0x3d')][_0x2954('0x18')]);_0xfaf340['offset']=qs[_0x2954('0x1a')](_0x52b58e[_0x2954('0x3d')]['offset']);}return _0x53fbe4['getChatInteractions'](_0xfaf340);}})[_0x2954('0x1e')](function(_0xd3d6e3){if(_0xd3d6e3){return _0xd3d6e3?{'count':_0x374bd6,'rows':_0xd3d6e3}:null;}})[_0x2954('0x1e')](respondWithResult(_0x154e0a,null))['catch'](handleError(_0x154e0a,null));};exports[_0x2954('0xce')]=function(_0x1cce7c,_0x5276c2){var _0x26d4f2={};var _0x368979={};var _0xb4a7db;var _0x4e2d43;return db[_0x2954('0x43')][_0x2954('0x89')]({'where':{'id':_0x1cce7c[_0x2954('0x57')]['id']}})[_0x2954('0x1e')](handleEntityNotFound(_0x5276c2,null))[_0x2954('0x1e')](function(_0x2feef8){if(_0x2feef8){_0xb4a7db=_0x2feef8;_0x368979[_0x2954('0xbd')]=_['keys'](db['OpenchannelInteraction'][_0x2954('0x30')]);_0x368979[_0x2954('0x3d')]=_[_0x2954('0xbe')](_0x1cce7c[_0x2954('0x3d')]);_0x368979[_0x2954('0xbf')]=_[_0x2954('0xc0')](_0x368979[_0x2954('0xbd')],_0x368979[_0x2954('0x3d')]);_0x26d4f2[_0x2954('0x54')]=_['intersection'](_0x368979['model'],qs[_0x2954('0xc1')](_0x1cce7c[_0x2954('0x3d')]['fields']));_0x26d4f2[_0x2954('0x54')]=_0x26d4f2['attributes']['length']?_0x26d4f2['attributes']:_0x368979[_0x2954('0xbd')];_0x26d4f2[_0x2954('0xc2')]=qs[_0x2954('0xc3')](_0x1cce7c[_0x2954('0x3d')][_0x2954('0xc3')]);_0x26d4f2['where']=qs[_0x2954('0xbf')](_['pick'](_0x1cce7c[_0x2954('0x3d')],_0x368979['filters']));if(_0x1cce7c[_0x2954('0x3d')][_0x2954('0x34')]){_0x26d4f2[_0x2954('0x3c')]=_[_0x2954('0x52')](_0x26d4f2['where'],{'$or':_[_0x2954('0x29')](_0x26d4f2[_0x2954('0x54')],function(_0x208623){var _0x2ac61a={};_0x2ac61a[_0x208623]={'$like':'%'+_0x1cce7c[_0x2954('0x3d')]['filter']+'%'};return _0x2ac61a;})});}_0x26d4f2=_[_0x2954('0x52')]({},_0x26d4f2,_0x1cce7c[_0x2954('0x53')]);return _0xb4a7db[_0x2954('0xce')](_0x26d4f2);}})[_0x2954('0x1e')](function(_0x5e654f){if(_0x5e654f){_0x4e2d43=_0x5e654f[_0x2954('0x66')];if(!_0x1cce7c[_0x2954('0x3d')][_0x2954('0xb9')]('nolimit')){_0x26d4f2[_0x2954('0x18')]=qs['limit'](_0x1cce7c[_0x2954('0x3d')][_0x2954('0x18')]);_0x26d4f2[_0x2954('0x1a')]=qs[_0x2954('0x1a')](_0x1cce7c[_0x2954('0x3d')][_0x2954('0x1a')]);}return _0xb4a7db[_0x2954('0xce')](_0x26d4f2);}})['then'](function(_0x3906de){if(_0x3906de){return _0x3906de?{'count':_0x4e2d43,'rows':_0x3906de}:null;}})['then'](respondWithResult(_0x5276c2,null))[_0x2954('0x4e')](handleError(_0x5276c2,null));};exports[_0x2954('0xcf')]=function(_0x259fc1,_0x329638){var _0x5c4673={'raw':!![],'where':{}};var _0x4a9d15={};var _0x5ec8be={'count':0x0,'rows':[]};return db[_0x2954('0x43')][_0x2954('0x89')]({'where':{'id':_0x259fc1[_0x2954('0x57')]['id']}})[_0x2954('0x1e')](handleEntityNotFound(_0x329638,null))[_0x2954('0x1e')](function(_0x2bd794){if(_0x2bd794){_0x4a9d15['model']=_[_0x2954('0xbe')](db['MailInteraction'][_0x2954('0x30')]);_0x4a9d15[_0x2954('0x3d')]=_[_0x2954('0xbe')](_0x259fc1[_0x2954('0x3d')]);_0x4a9d15['filters']=_[_0x2954('0xc0')](_0x4a9d15[_0x2954('0xbd')],_0x4a9d15[_0x2954('0x3d')]);_0x5c4673[_0x2954('0x54')]=_['intersection'](_0x4a9d15[_0x2954('0xbd')],qs[_0x2954('0xc1')](_0x259fc1[_0x2954('0x3d')][_0x2954('0xc1')]));_0x5c4673['attributes']=_0x5c4673[_0x2954('0x54')][_0x2954('0x66')]?_0x5c4673[_0x2954('0x54')]:_0x4a9d15[_0x2954('0xbd')];if(!_0x259fc1[_0x2954('0x3d')][_0x2954('0xb9')](_0x2954('0xc6'))){_0x5c4673[_0x2954('0x18')]=qs[_0x2954('0x18')](_0x259fc1['query'][_0x2954('0x18')]);_0x5c4673[_0x2954('0x1a')]=qs[_0x2954('0x1a')](_0x259fc1[_0x2954('0x3d')][_0x2954('0x1a')]);}_0x5c4673['order']=qs[_0x2954('0xc3')](_0x259fc1[_0x2954('0x3d')][_0x2954('0xc3')]);_0x5c4673[_0x2954('0x3c')]=qs[_0x2954('0xbf')](_[_0x2954('0xc9')](_0x259fc1[_0x2954('0x3d')],_0x4a9d15[_0x2954('0xbf')]));_0x5c4673[_0x2954('0x3c')]['UserId']=_0x2bd794['id'];if(_0x259fc1[_0x2954('0x3d')]['filter']){_0x5c4673[_0x2954('0x3c')]=_[_0x2954('0x52')](_0x5c4673[_0x2954('0x3c')],{'$or':_[_0x2954('0x29')](_0x5c4673[_0x2954('0x54')],function(_0x499f51){var _0x37d0b0={};_0x37d0b0[_0x499f51]={'$like':'%'+_0x259fc1[_0x2954('0x3d')]['filter']+'%'};return _0x37d0b0;})});}_0x5c4673=_['merge']({},_0x5c4673,_0x259fc1[_0x2954('0x53')]);return db[_0x2954('0xd0')]['count']({'where':_0x5c4673[_0x2954('0x3c')]})['then'](function(_0x3f5cb1){_0x5ec8be[_0x2954('0x19')]=_0x3f5cb1;if(_0x259fc1[_0x2954('0x3d')][_0x2954('0x51')]){_0x5c4673[_0x2954('0x3e')]=[{'all':!![]}];}return db[_0x2954('0xd0')][_0x2954('0x44')](_0x5c4673);})[_0x2954('0x1e')](function(_0x26f683){_0x5ec8be[_0x2954('0x45')]=_0x26f683;return _0x5ec8be;});}})['then'](respondWithFilteredResult(_0x329638,_0x5c4673))['catch'](handleError(_0x329638,null));};exports[_0x2954('0xd1')]=function(_0x77bccf,_0x49592b){var _0x1c7e9b={};var _0x1767c8={};var _0xaa3922;var _0x375925;return db[_0x2954('0x43')][_0x2954('0x89')]({'where':{'id':_0x77bccf[_0x2954('0x57')]['id']}})['then'](handleEntityNotFound(_0x49592b,null))['then'](function(_0x563a45){if(_0x563a45){_0xaa3922=_0x563a45;_0x1767c8[_0x2954('0xbd')]=_[_0x2954('0xbe')](db['SmsInteraction'][_0x2954('0x30')]);_0x1767c8['query']=_[_0x2954('0xbe')](_0x77bccf[_0x2954('0x3d')]);_0x1767c8[_0x2954('0xbf')]=_[_0x2954('0xc0')](_0x1767c8['model'],_0x1767c8[_0x2954('0x3d')]);_0x1c7e9b['attributes']=_[_0x2954('0xc0')](_0x1767c8[_0x2954('0xbd')],qs[_0x2954('0xc1')](_0x77bccf[_0x2954('0x3d')]['fields']));_0x1c7e9b[_0x2954('0x54')]=_0x1c7e9b[_0x2954('0x54')][_0x2954('0x66')]?_0x1c7e9b[_0x2954('0x54')]:_0x1767c8['model'];_0x1c7e9b[_0x2954('0xc2')]=qs[_0x2954('0xc3')](_0x77bccf['query'][_0x2954('0xc3')]);_0x1c7e9b['where']=qs[_0x2954('0xbf')](_['pick'](_0x77bccf[_0x2954('0x3d')],_0x1767c8[_0x2954('0xbf')]));if(_0x77bccf[_0x2954('0x3d')][_0x2954('0x34')]){_0x1c7e9b[_0x2954('0x3c')]=_[_0x2954('0x52')](_0x1c7e9b['where'],{'$or':_[_0x2954('0x29')](_0x1c7e9b[_0x2954('0x54')],function(_0x2af4d1){var _0x345b26={};_0x345b26[_0x2af4d1]={'$like':'%'+_0x77bccf['query'][_0x2954('0x34')]+'%'};return _0x345b26;})});}_0x1c7e9b=_[_0x2954('0x52')]({},_0x1c7e9b,_0x77bccf['options']);return _0xaa3922[_0x2954('0xd1')](_0x1c7e9b);}})[_0x2954('0x1e')](function(_0x4ed145){if(_0x4ed145){_0x375925=_0x4ed145['length'];if(!_0x77bccf[_0x2954('0x3d')][_0x2954('0xb9')](_0x2954('0xc6'))){_0x1c7e9b[_0x2954('0x18')]=qs[_0x2954('0x18')](_0x77bccf[_0x2954('0x3d')]['limit']);_0x1c7e9b[_0x2954('0x1a')]=qs[_0x2954('0x1a')](_0x77bccf[_0x2954('0x3d')]['offset']);}return _0xaa3922['getSmsInteractions'](_0x1c7e9b);}})[_0x2954('0x1e')](function(_0x478884){if(_0x478884){return _0x478884?{'count':_0x375925,'rows':_0x478884}:null;}})[_0x2954('0x1e')](respondWithResult(_0x49592b,null))[_0x2954('0x4e')](handleError(_0x49592b,null));};exports[_0x2954('0xd2')]=function(_0x200268,_0x3973ed){var _0x1fef6f={};var _0x13b151={};var _0x323aa9;var _0x4bcd09;return db[_0x2954('0x43')][_0x2954('0x89')]({'where':{'id':_0x200268['params']['id']}})[_0x2954('0x1e')](handleEntityNotFound(_0x3973ed,null))[_0x2954('0x1e')](function(_0x2e1f19){if(_0x2e1f19){_0x323aa9=_0x2e1f19;_0x13b151['model']=_[_0x2954('0xbe')](db[_0x2954('0xd3')][_0x2954('0x30')]);_0x13b151['query']=_[_0x2954('0xbe')](_0x200268[_0x2954('0x3d')]);_0x13b151[_0x2954('0xbf')]=_['intersection'](_0x13b151[_0x2954('0xbd')],_0x13b151[_0x2954('0x3d')]);_0x1fef6f['attributes']=_[_0x2954('0xc0')](_0x13b151[_0x2954('0xbd')],qs[_0x2954('0xc1')](_0x200268['query']['fields']));_0x1fef6f[_0x2954('0x54')]=_0x1fef6f[_0x2954('0x54')][_0x2954('0x66')]?_0x1fef6f['attributes']:_0x13b151[_0x2954('0xbd')];_0x1fef6f[_0x2954('0xc2')]=qs[_0x2954('0xc3')](_0x200268[_0x2954('0x3d')][_0x2954('0xc3')]);_0x1fef6f['where']=qs[_0x2954('0xbf')](_[_0x2954('0xc9')](_0x200268['query'],_0x13b151[_0x2954('0xbf')]));if(_0x200268['query'][_0x2954('0x34')]){_0x1fef6f[_0x2954('0x3c')]=_[_0x2954('0x52')](_0x1fef6f['where'],{'$or':_[_0x2954('0x29')](_0x1fef6f[_0x2954('0x54')],function(_0x7795f4){var _0x51865d={};_0x51865d[_0x7795f4]={'$like':'%'+_0x200268[_0x2954('0x3d')][_0x2954('0x34')]+'%'};return _0x51865d;})});}_0x1fef6f=_[_0x2954('0x52')]({},_0x1fef6f,_0x200268['options']);return _0x323aa9[_0x2954('0xd2')](_0x1fef6f);}})[_0x2954('0x1e')](function(_0x30b857){if(_0x30b857){_0x4bcd09=_0x30b857[_0x2954('0x66')];if(!_0x200268['query']['hasOwnProperty'](_0x2954('0xc6'))){_0x1fef6f['limit']=qs[_0x2954('0x18')](_0x200268[_0x2954('0x3d')][_0x2954('0x18')]);_0x1fef6f['offset']=qs['offset'](_0x200268[_0x2954('0x3d')]['offset']);}return _0x323aa9[_0x2954('0xd2')](_0x1fef6f);}})[_0x2954('0x1e')](function(_0x403eeb){if(_0x403eeb){return _0x403eeb?{'count':_0x4bcd09,'rows':_0x403eeb}:null;}})['then'](respondWithResult(_0x3973ed,null))[_0x2954('0x4e')](handleError(_0x3973ed,null));};exports[_0x2954('0xd4')]=function(_0x3b2d5c,_0x359b51){var _0x411083={};var _0x966d84={};var _0x714bab;var _0x308560;return db[_0x2954('0x43')][_0x2954('0x89')]({'where':{'id':_0x3b2d5c[_0x2954('0x57')]['id']}})[_0x2954('0x1e')](handleEntityNotFound(_0x359b51,null))['then'](function(_0x3f45b0){if(_0x3f45b0){_0x714bab=_0x3f45b0;_0x966d84[_0x2954('0xbd')]=_[_0x2954('0xbe')](db[_0x2954('0xd5')][_0x2954('0x30')]);_0x966d84[_0x2954('0x3d')]=_[_0x2954('0xbe')](_0x3b2d5c[_0x2954('0x3d')]);_0x966d84['filters']=_[_0x2954('0xc0')](_0x966d84[_0x2954('0xbd')],_0x966d84[_0x2954('0x3d')]);_0x411083['attributes']=_['intersection'](_0x966d84[_0x2954('0xbd')],qs[_0x2954('0xc1')](_0x3b2d5c[_0x2954('0x3d')][_0x2954('0xc1')]));_0x411083[_0x2954('0x54')]=_0x411083[_0x2954('0x54')]['length']?_0x411083[_0x2954('0x54')]:_0x966d84[_0x2954('0xbd')];_0x411083[_0x2954('0xc2')]=qs[_0x2954('0xc3')](_0x3b2d5c['query'][_0x2954('0xc3')]);_0x411083[_0x2954('0x3c')]=qs['filters'](_['pick'](_0x3b2d5c['query'],_0x966d84['filters']));if(_0x3b2d5c[_0x2954('0x3d')]['filter']){_0x411083['where']=_['merge'](_0x411083[_0x2954('0x3c')],{'$or':_[_0x2954('0x29')](_0x411083[_0x2954('0x54')],function(_0x3d78f8){var _0x200b2e={};_0x200b2e[_0x3d78f8]={'$like':'%'+_0x3b2d5c[_0x2954('0x3d')][_0x2954('0x34')]+'%'};return _0x200b2e;})});}_0x411083=_['merge']({},_0x411083,_0x3b2d5c[_0x2954('0x53')]);return _0x714bab['getWhatsappInteractions'](_0x411083);}})['then'](function(_0x551dab){if(_0x551dab){_0x308560=_0x551dab[_0x2954('0x66')];if(!_0x3b2d5c['query']['hasOwnProperty'](_0x2954('0xc6'))){_0x411083[_0x2954('0x18')]=qs[_0x2954('0x18')](_0x3b2d5c[_0x2954('0x3d')]['limit']);_0x411083[_0x2954('0x1a')]=qs['offset'](_0x3b2d5c['query']['offset']);}return _0x714bab[_0x2954('0xd4')](_0x411083);}})['then'](function(_0x1e45e3){if(_0x1e45e3){return _0x1e45e3?{'count':_0x308560,'rows':_0x1e45e3}:null;}})[_0x2954('0x1e')](respondWithResult(_0x359b51,null))[_0x2954('0x4e')](handleError(_0x359b51,null));};exports[_0x2954('0xd6')]=function(_0x1b13e5,_0x30453b,_0x30389c){var _0x4185f2;var _0x380175;var _0x22d9e2;var _0x2f7615=!_['isNil'](_0x1b13e5[_0x2954('0x57')]['id'])?_0x1b13e5[_0x2954('0x57')]['id']:!_[_0x2954('0x60')](_0x1b13e5['user']['id'])?_0x1b13e5['user']['id']:null;return db[_0x2954('0x43')][_0x2954('0x55')]({'where':{'id':_0x2f7615,'role':{'$or':[_0x2954('0x24'),_0x2954('0x25'),_0x2954('0x20')]}},'attributes':['id','name',_0x2954('0xd7'),_0x2954('0xd8'),_0x2954('0x1f'),_0x2954('0x5c'),_0x2954('0x8e')]})[_0x2954('0x1e')](function(_0x57fb24){if(_0x57fb24){if(_0x57fb24['role']===_0x2954('0x20')){_0x4185f2=_0x57fb24;if(_0x1b13e5['body'][_0x2954('0x8f')]){_0x22d9e2=util['format'](_0x2954('0xd9'),_0x4185f2[_0x1b13e5[_0x2954('0x56')]['interface']]);}else if(_0x1b13e5[_0x2954('0x56')]['intrf']){_0x22d9e2=util[_0x2954('0xb8')]('SIP/%s',_0x1b13e5['body'][_0x2954('0xda')]);}else{_0x22d9e2=util[_0x2954('0xb8')](_0x2954('0xdb'),_0x4185f2['name']);}socket['to'](util[_0x2954('0xb8')](_0x2954('0xdc'),_0x4185f2[_0x2954('0x2c')]))[_0x2954('0x21')](_0x2954('0xdd'),{'user':{'id':_0x4185f2['id'],'name':_0x4185f2['name']},'ip':_0x1b13e5['headers']['x-forwarded-for']||_0x1b13e5[_0x2954('0xde')]['remoteAddress']||_0x1b13e5[_0x2954('0xdf')][_0x2954('0xe0')]||_0x1b13e5['connection'][_0x2954('0xdf')][_0x2954('0xe0')]});return db[_0x2954('0x9d')]['destroy']({'where':{'membername':_0x4185f2['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x2954('0x85'))](_0x2954('0xe1'));}})[_0x2954('0x1e')](function(){if(_0x4185f2){return _0x4185f2[_0x2954('0xe2')]({'raw':!![]});}})['then'](function(_0x433b42){if(_0x4185f2){if(_0x433b42){_0x380175=_0x433b42;if(_0x380175[_0x2954('0x66')]){var _0x53faba=_0x380175[_0x2954('0x29')](function(_0x54186d){var _0x331817={'membername':_0x4185f2[_0x2954('0x2c')],'UserId':_0x4185f2['id'],'queue_name':_0x54186d[_0x2954('0x2c')],'VoiceQueueId':_0x54186d['id'],'interface':_0x22d9e2,'paused':_0x4185f2[_0x2954('0x8e')]||![],'penalty':_0x54186d[_0x2954('0xe3')]||0x0};return db[_0x2954('0x9d')][_0x2954('0x9e')](_0x331817);});return Promise[_0x2954('0x4d')](_0x53faba);}}}})[_0x2954('0x1e')](function(){if(_0x4185f2){return db[_0x2954('0xe4')]['findAll']({'where':{'membername':_0x4185f2[_0x2954('0x2c')],'exitAt':null}});}})[_0x2954('0x1e')](function(_0x52b54c){if(_0x4185f2){var _0x4b30bb=[];_0x52b54c['forEach'](function(_0x28a3c7){_0x4b30bb['push'](_0x28a3c7[_0x2954('0x1d')]({'exitAt':moment()[_0x2954('0xb8')](_0x2954('0xe5'))}));});return Promise[_0x2954('0x4d')](_0x4b30bb);}})[_0x2954('0x1e')](function(){if(_0x4185f2){var _0x16d0d3=[];var _0x37d88e=[];var _0x49545c=utils['getChannels']();var _0xf11f1c={'membername':_0x4185f2[_0x2954('0x2c')],'interface':_0x22d9e2,'enterAt':moment()['format'](_0x2954('0xe5')),'role':_0x4185f2[_0x2954('0x1f')],'internal':_0x4185f2['internal']};_0x49545c[_0x2954('0xe6')](function(_0x53827a){_0x16d0d3[_0x2954('0x42')](_[_0x2954('0x52')]({'channel':_0x53827a,'type':_0x2954('0xe7'),'data1':_0x1b13e5['body'][_0x2954('0xe8')],'data2':_0x22d9e2},_0xf11f1c));if(_0x4185f2[_0x2954('0x8e')]){_0x37d88e['push'](_[_0x2954('0x52')]({'channel':_0x53827a,'type':_0x2954('0xe9'),'data1':_0x2954('0xea')},_0xf11f1c));}});return db[_0x2954('0xe4')][_0x2954('0x7e')](_0x16d0d3['concat'](_0x37d88e),{'individualHooks':!![]});}})[_0x2954('0x1e')](function(){if(_0x4185f2){return _0x4185f2['update']({'online':!![],'lastLoginAt':moment()[_0x2954('0xb8')](_0x2954('0xe5')),'voicePause':_0x4185f2[_0x2954('0x8e')]||![],'mailPause':_0x4185f2[_0x2954('0x8e')]||![],'chatPause':_0x4185f2['loginInPause']||![],'faxPause':_0x4185f2['loginInPause']||![],'smsPause':_0x4185f2[_0x2954('0x8e')]||![],'openchannelPause':_0x4185f2[_0x2954('0x8e')]||![],'whatsappPause':_0x4185f2[_0x2954('0x8e')]||![],'pauseType':_0x4185f2[_0x2954('0x8e')]?_0x2954('0xea'):null,'interface':_0x22d9e2,'lastPauseAt':moment()[_0x2954('0xb8')](_0x2954('0xe5'))});}})[_0x2954('0x1e')](function(_0x1fa109){if(_0x1b13e5['isMiddleware']){return _0x30389c();}else{return Promise[_0x2954('0xeb')](_0x1fa109)[_0x2954('0x1e')](respondWithResult(_0x30453b,null));}})[_0x2954('0x4e')](handleError(_0x30453b,null));};exports['logout']=function(_0x5984dc,_0x25c5f0){var _0x52ad0f;return db['User'][_0x2954('0x55')]({'where':{'id':_0x5984dc['params']['id'],'role':_0x2954('0x20')},'attributes':['id',_0x2954('0x2c'),_0x2954('0x1f')]})[_0x2954('0x1e')](handleEntityNotFound(_0x25c5f0,null))['then'](function(_0x59a4cd){if(_0x59a4cd){_0x52ad0f=_0x59a4cd;return db[_0x2954('0x9d')][_0x2954('0x23')]({'where':{'membername':_0x52ad0f[_0x2954('0x2c')]},'individualHooks':!![]});}})[_0x2954('0x1e')](function(){return db[_0x2954('0xe4')][_0x2954('0x44')]({'where':{'membername':_0x52ad0f[_0x2954('0x2c')],'exitAt':null}});})[_0x2954('0x1e')](function(_0x1cbeac){var _0x48efdb=[];_0x1cbeac[_0x2954('0xe6')](function(_0x31e9ba){_0x48efdb[_0x2954('0x42')](_0x31e9ba[_0x2954('0x1d')]({'exitAt':moment()[_0x2954('0xb8')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x2954('0x4d')](_0x48efdb);})['then'](function(){return _0x52ad0f[_0x2954('0x1d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2954('0x1e')](respondWithResult(_0x25c5f0,null))[_0x2954('0x4e')](handleError(_0x25c5f0,null));};exports[_0x2954('0xec')]=function(_0x2bff7c,_0x215cdc){var _0x564ec3;return db[_0x2954('0x9d')][_0x2954('0x1d')]({'paused':0x1},{'where':{'UserId':_0x2bff7c[_0x2954('0x57')]['id']},'individualHooks':!![]})[_0x2954('0x1e')](function(){return db[_0x2954('0x43')]['find']({'where':{'id':_0x2bff7c[_0x2954('0x57')]['id'],'role':_0x2954('0x20')},'attributes':['id',_0x2954('0x2c'),_0x2954('0x1f'),'internal',_0x2954('0x8f'),_0x2954('0x9c')]});})[_0x2954('0x1e')](handleEntityNotFound(_0x215cdc,null))[_0x2954('0x1e')](function(_0x367251){if(_0x367251){_0x564ec3=_0x367251;return db['MemberReport'][_0x2954('0x44')]({'where':{'membername':_0x564ec3[_0x2954('0x2c')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x30b77b){if(_0x30b77b[_0x2954('0x66')]){var _0x1ed6f8=moment()[_0x2954('0xb8')](_0x2954('0xe5'));for(var _0x9ad1b2=0x0,_0x57ae13=_0x30b77b[_0x2954('0x66')];_0x9ad1b2<_0x57ae13;_0x9ad1b2++){_0x30b77b[_0x9ad1b2][_0x2954('0xed')]({'exitAt':_0x1ed6f8});}}})[_0x2954('0x1e')](function(){var _0x245869=[];var _0x28f2bb=utils[_0x2954('0xee')]();_0x28f2bb[_0x2954('0xe6')](function(_0x48f0ad){_0x245869[_0x2954('0x42')]({'channel':_0x48f0ad,'membername':_0x564ec3[_0x2954('0x2c')],'interface':_[_0x2954('0x60')](_0x564ec3[_0x2954('0x8f')])?util[_0x2954('0xb8')]('SIP/%s',_0x564ec3['name']):_0x564ec3['interface'],'type':_0x2954('0xe9'),'enterAt':moment()[_0x2954('0xb8')](_0x2954('0xe5')),'data1':_0x2bff7c[_0x2954('0x56')]['type']||'DEFAULT\x20PAUSE','role':_0x564ec3['role'],'internal':_0x564ec3[_0x2954('0x5c')]});});return db[_0x2954('0xe4')][_0x2954('0x7e')](_0x245869,{'individualHooks':!![]});})['then'](function(){return _0x564ec3['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2bff7c[_0x2954('0x56')]['type']||_0x2954('0xef'),'lastPauseAt':moment()[_0x2954('0xb8')](_0x2954('0xe5'))});})[_0x2954('0x1e')](respondWithResult(_0x215cdc,null))['catch'](handleError(_0x215cdc,null));};exports[_0x2954('0xf0')]=function(_0x1c3d55,_0x6d5f50){if(_0x1c3d55['body']['channel']&&!utils[_0x2954('0x90')](_0x1c3d55[_0x2954('0x56')][_0x2954('0x8d')])){throw new APIBadRequestError(util[_0x2954('0xb8')](_0x2954('0xf1'),_0x1c3d55[_0x2954('0x56')]['channel']));}return db[_0x2954('0x43')][_0x2954('0x55')]({'where':{'id':_0x1c3d55[_0x2954('0x57')]['id']},'attributes':['id',_0x2954('0x2c'),'role',_0x2954('0x5c'),_0x2954('0x8f'),_0x2954('0x9c'),'voicePause',_0x2954('0xf2'),_0x2954('0xf3'),_0x2954('0xf4'),_0x2954('0xf5'),_0x2954('0xf6'),_0x2954('0xf7'),_0x2954('0xf8'),_0x2954('0xf9')]})[_0x2954('0x1e')](function(_0x382e4d){if(!_0x382e4d){throw new APINotFoundError(util[_0x2954('0xb8')](_0x2954('0xfa'),_0x1c3d55[_0x2954('0x57')]['id']));}return _0x382e4d[_0x2954('0xf0')](_0x1c3d55[_0x2954('0x56')][_0x2954('0x8d')]);})[_0x2954('0x1e')](respondWithResult(_0x6d5f50,null))[_0x2954('0x4e')](APIHandleError(_0x6d5f50));};exports['getTeams']=function(_0x815e2d,_0x19325f){var _0x2fc71d={};var _0x2f57f5={};var _0x451865;var _0x27676c;return db[_0x2954('0x43')][_0x2954('0x89')]({'where':{'id':_0x815e2d['params']['id']}})[_0x2954('0x1e')](handleEntityNotFound(_0x19325f,null))[_0x2954('0x1e')](function(_0x25f4ec){if(_0x25f4ec){_0x451865=_0x25f4ec;_0x2f57f5[_0x2954('0xbd')]=_[_0x2954('0xbe')](db[_0x2954('0xfb')][_0x2954('0x30')]);_0x2f57f5['query']=_[_0x2954('0xbe')](_0x815e2d[_0x2954('0x3d')]);_0x2f57f5['filters']=_[_0x2954('0xc0')](_0x2f57f5['model'],_0x2f57f5[_0x2954('0x3d')]);_0x2fc71d['attributes']=_[_0x2954('0xc0')](_0x2f57f5[_0x2954('0xbd')],qs[_0x2954('0xc1')](_0x815e2d[_0x2954('0x3d')][_0x2954('0xc1')]));_0x2fc71d[_0x2954('0x54')]=_0x2fc71d[_0x2954('0x54')][_0x2954('0x66')]?_0x2fc71d[_0x2954('0x54')]:_0x2f57f5[_0x2954('0xbd')];_0x2fc71d[_0x2954('0xc2')]=qs[_0x2954('0xc3')](_0x815e2d[_0x2954('0x3d')][_0x2954('0xc3')]);_0x2fc71d[_0x2954('0x3c')]=qs[_0x2954('0xbf')](_[_0x2954('0xc9')](_0x815e2d[_0x2954('0x3d')],_0x2f57f5[_0x2954('0xbf')]));if(_0x815e2d['query'][_0x2954('0x34')]){_0x2fc71d[_0x2954('0x3c')]=_[_0x2954('0x52')](_0x2fc71d['where'],{'$or':_[_0x2954('0x29')](_0x2fc71d['attributes'],function(_0x203cd9){var _0x33c562={};_0x33c562[_0x203cd9]={'$like':'%'+_0x815e2d[_0x2954('0x3d')][_0x2954('0x34')]+'%'};return _0x33c562;})});}_0x2fc71d=_[_0x2954('0x52')]({},_0x2fc71d,_0x815e2d[_0x2954('0x53')]);return _0x451865[_0x2954('0xfc')](_0x2fc71d);}})[_0x2954('0x1e')](function(_0x15f4db){if(_0x15f4db){_0x27676c=_0x15f4db['length'];if(!_0x815e2d[_0x2954('0x3d')][_0x2954('0xb9')](_0x2954('0xc6'))){_0x2fc71d[_0x2954('0x18')]=qs[_0x2954('0x18')](_0x815e2d[_0x2954('0x3d')][_0x2954('0x18')]);_0x2fc71d[_0x2954('0x1a')]=qs[_0x2954('0x1a')](_0x815e2d[_0x2954('0x3d')][_0x2954('0x1a')]);}return _0x451865[_0x2954('0xfc')](_0x2fc71d);}})[_0x2954('0x1e')](function(_0x4412c6){if(_0x4412c6){return _0x4412c6?{'count':_0x27676c,'rows':_0x4412c6}:null;}})['then'](respondWithResult(_0x19325f,null))[_0x2954('0x4e')](handleError(_0x19325f,null));};exports[_0x2954('0xfd')]=function(_0x3c1f10,_0x5bb839){var _0x394da1=_0x3c1f10[_0x2954('0x57')]['id'];var _0x542416=_0x3c1f10[_0x2954('0x56')]?_0x3c1f10[_0x2954('0x56')][_0x2954('0x5b')]:null;var _0x6414c1=[];return Promise['resolve']()[_0x2954('0x1e')](function(){if(!_0x542416)throw new APIBadRequestError(_0x2954('0xfe'));})[_0x2954('0x1e')](function(){return db[_0x2954('0x43')]['findOne']({'where':{'id':_0x394da1}});})['then'](function(_0x3242f8){if(!_0x3242f8)throw new APINotFoundError(util[_0x2954('0xb8')](_0x2954('0xfa'),_0x3c1f10['params']['id']));return db[_0x2954('0x62')][_0x2954('0xff')](function(_0x30fa18){return _0x3242f8['addTeams'](_0x542416,{'transaction':_0x30fa18})[_0x2954('0x1e')](function(){return db[_0x2954('0xfb')][_0x2954('0x44')]({'where':{'id':{'$in':_0x542416}}});})[_0x2954('0x1e')](function(_0x4aa1dd){var _0x142541=_[_0x2954('0x29')](_0x4aa1dd,function(_0x4ff2e3){return _0x4ff2e3[_0x2954('0x100')]();});return Promise[_0x2954('0x4d')](_0x142541);})[_0x2954('0x1e')](function(_0xbcace8){_0x6414c1=_[_0x2954('0x101')](_0xbcace8);var _0x150b2f=_[_0x2954('0x29')](_0x6414c1,function(_0x9d9647){return _0x9d9647[_0x2954('0x102')](_0x3242f8['id'],{'transaction':_0x30fa18});});return Promise[_0x2954('0x4d')](_0x150b2f);})['then'](function(){if(!_0x3242f8[_0x2954('0x9c')])return;var _0x5c155f=_[_0x2954('0x34')](_0x6414c1,function(_0x19dc65){return _0x19dc65[_0x2954('0x103')](_0x2954('0x8d'))===_0x2954('0x104');});var _0x2d3bcc=_[_0x2954('0x29')](_0x5c155f,function(_0x4a3d46){return db[_0x2954('0x9d')][_0x2954('0x9e')]({'membername':_0x3242f8[_0x2954('0x2c')],'UserId':_0x3242f8['id'],'queue_name':_0x4a3d46[_0x2954('0x2c')],'VoiceQueueId':_0x4a3d46['id'],'interface':_[_0x2954('0x60')](_0x3242f8[_0x2954('0x8f')])?util[_0x2954('0xb8')](_0x2954('0xdb'),_0x3242f8[_0x2954('0x2c')]):_0x3242f8['interface'],'paused':_0x3242f8[_0x2954('0x105')]||![],'penalty':_0x3242f8[_0x2954('0x94')]},{'transaction':_0x30fa18});});return Promise[_0x2954('0x4d')](_0x2d3bcc);})[_0x2954('0x1e')](function(){return db[_0x2954('0x106')][_0x2954('0x44')]({'where':{'teamId':{'$in':_0x542416}}});})[_0x2954('0x1e')](function(_0xf2ff58){var _0x5987e0=_[_0x2954('0x29')](_0xf2ff58,function(_0x53bccd){return db[_0x2954('0x107')][_0x2954('0x7a')]({'UserId':_0x3242f8['id'],'VoicePrefixId':_0x53bccd[_0x2954('0x108')]},{'transaction':_0x30fa18});});return Promise[_0x2954('0x4d')](_0x5987e0);});});})['then'](function(){for(var _0x248d3f=0x0;_0x248d3f<_0x6414c1[_0x2954('0x66')];_0x248d3f++){var _0x4d5dc4=_0x6414c1[_0x248d3f][_0x2954('0x103')](_0x2954('0x8d'));var _0x2074bb=_0x4d5dc4+_0x2954('0x97');socket[_0x2954('0x21')]('user'+_0x4d5dc4+_0x2954('0x98'),{'UserId':_0x394da1,['queueField']:_0x6414c1[_0x248d3f]['id']});}})['then'](respondWithStatusCode(_0x5bb839,null))['catch'](APIHandleError(_0x5bb839));};exports['removeTeams']=function(_0x32ab38,_0x16c54d){var _0x53ace3=_0x32ab38[_0x2954('0x57')]['id'];var _0x4db01b=null;if(_0x32ab38['query'][_0x2954('0x5b')]){_0x4db01b=_[_0x2954('0xa1')](_0x32ab38[_0x2954('0x3d')][_0x2954('0x5b')])?_0x32ab38[_0x2954('0x3d')][_0x2954('0x5b')]:[_0x32ab38[_0x2954('0x3d')][_0x2954('0x5b')]];}var _0x6dcf2=[];return Promise[_0x2954('0xeb')]()[_0x2954('0x1e')](function(){if(!_0x4db01b)throw new APIBadRequestError(_0x2954('0x109'));})['then'](function(){return db[_0x2954('0x43')][_0x2954('0x89')]({'where':{'id':_0x53ace3}});})[_0x2954('0x1e')](function(_0x2ff7e9){if(!_0x2ff7e9)throw new APINotFoundError(util[_0x2954('0xb8')](_0x2954('0xfa'),_0x32ab38['params']['id']));return db[_0x2954('0x62')][_0x2954('0xff')](function(_0x3019e7){return _0x2ff7e9[_0x2954('0x10a')](_0x4db01b,{'transaction':_0x3019e7})[_0x2954('0x1e')](function(){return db[_0x2954('0xfb')][_0x2954('0x44')]({'where':{'id':{'$in':_0x4db01b}}});})[_0x2954('0x1e')](function(_0x2608ee){var _0x1f5932=_['map'](_0x2608ee,function(_0x369cc2){return _0x369cc2[_0x2954('0x100')]();});return Promise[_0x2954('0x4d')](_0x1f5932);})[_0x2954('0x1e')](function(_0x230fc9){_0x6dcf2=_[_0x2954('0x101')](_0x230fc9);var _0x2136d1=_['map'](_0x6dcf2,function(_0x5c745e){return _0x5c745e['removeAgent'](_0x2ff7e9['id'],{'transaction':_0x3019e7});});return Promise[_0x2954('0x4d')](_0x2136d1);})['then'](function(){if(!_0x2ff7e9[_0x2954('0x9c')])return;var _0x1d6707=_[_0x2954('0x34')](_0x6dcf2,function(_0x789baa){return _0x789baa[_0x2954('0x103')](_0x2954('0x8d'))==='Voice';});var _0x32f353=_[_0x2954('0x29')](_0x1d6707,function(_0x21d8cf){return db[_0x2954('0x9d')]['destroy']({'where':{'VoiceQueueId':_0x21d8cf['id'],'UserId':_0x2ff7e9['id']},'transaction':_0x3019e7});});return Promise[_0x2954('0x4d')](_0x32f353);})[_0x2954('0x1e')](function(){return db[_0x2954('0x106')][_0x2954('0x44')]({'where':{'teamId':{'$in':_0x4db01b}}});})[_0x2954('0x1e')](function(_0x2583d9){var _0x1dafa0=_[_0x2954('0x29')](_0x2583d9,function(_0x541a3d){return db[_0x2954('0x107')][_0x2954('0x23')]({'where':{'UserId':_0x2ff7e9['id'],'VoicePrefixId':_0x541a3d[_0x2954('0x108')]}},{'transaction':_0x3019e7});});return Promise[_0x2954('0x4d')](_0x1dafa0);});});})[_0x2954('0x1e')](function(){for(var _0xedcd6f=0x0;_0xedcd6f<_0x6dcf2['length'];_0xedcd6f++){var _0x42ffac=_0x6dcf2[_0xedcd6f]['getDataValue'](_0x2954('0x8d'));var _0x3cf57e=_0x42ffac+_0x2954('0x97');socket[_0x2954('0x21')](_0x2954('0x25')+_0x42ffac+_0x2954('0xa2'),{'UserId':_0x53ace3,['queueField']:_0x6dcf2[_0xedcd6f]['id']});}})[_0x2954('0x1e')](respondWithStatusCode(_0x16c54d,null))['catch'](APIHandleError(_0x16c54d));};exports['getLists']=function(_0x52595b,_0x4a516b){var _0x489dca={};var _0x4ba206={};var _0x3ccfb3;var _0x5755f9;return db[_0x2954('0x43')][_0x2954('0x89')]({'where':{'id':_0x52595b[_0x2954('0x57')]['id']}})['then'](handleEntityNotFound(_0x4a516b,null))['then'](function(_0x2dd221){if(_0x2dd221){_0x3ccfb3=_0x2dd221;_0x4ba206[_0x2954('0xbd')]=_['keys'](db[_0x2954('0xba')][_0x2954('0x30')]);_0x4ba206[_0x2954('0x3d')]=_[_0x2954('0xbe')](_0x52595b[_0x2954('0x3d')]);_0x4ba206[_0x2954('0xbf')]=_[_0x2954('0xc0')](_0x4ba206['model'],_0x4ba206[_0x2954('0x3d')]);_0x489dca['attributes']=_[_0x2954('0xc0')](_0x4ba206['model'],qs['fields'](_0x52595b[_0x2954('0x3d')][_0x2954('0xc1')]));_0x489dca[_0x2954('0x54')]=_0x489dca[_0x2954('0x54')][_0x2954('0x66')]?_0x489dca[_0x2954('0x54')]:_0x4ba206['model'];_0x489dca[_0x2954('0xc2')]=qs[_0x2954('0xc3')](_0x52595b[_0x2954('0x3d')][_0x2954('0xc3')]);_0x489dca[_0x2954('0x3c')]=qs[_0x2954('0xbf')](_[_0x2954('0xc9')](_0x52595b['query'],_0x4ba206[_0x2954('0xbf')]));if(_0x52595b['query']['filter']){_0x489dca[_0x2954('0x3c')]=_[_0x2954('0x52')](_0x489dca[_0x2954('0x3c')],{'$or':_[_0x2954('0x29')](_0x489dca[_0x2954('0x54')],function(_0x3d9d8d){var _0xa74de2={};_0xa74de2[_0x3d9d8d]={'$like':'%'+_0x52595b[_0x2954('0x3d')][_0x2954('0x34')]+'%'};return _0xa74de2;})});}_0x489dca=_[_0x2954('0x52')]({},_0x489dca,_0x52595b['options']);return _0x3ccfb3[_0x2954('0x10b')](_0x489dca);}})[_0x2954('0x1e')](function(_0x410fa7){if(_0x410fa7){_0x5755f9=_0x410fa7['length'];if(!_0x52595b['query']['hasOwnProperty']('nolimit')){_0x489dca[_0x2954('0x18')]=qs['limit'](_0x52595b[_0x2954('0x3d')]['limit']);_0x489dca[_0x2954('0x1a')]=qs[_0x2954('0x1a')](_0x52595b[_0x2954('0x3d')][_0x2954('0x1a')]);}return _0x3ccfb3[_0x2954('0x10b')](_0x489dca);}})[_0x2954('0x1e')](function(_0x2073c4){if(_0x2073c4){return _0x2073c4?{'count':_0x5755f9,'rows':_0x2073c4}:null;}})[_0x2954('0x1e')](respondWithResult(_0x4a516b,null))[_0x2954('0x4e')](handleError(_0x4a516b,null));};exports[_0x2954('0x10c')]=function(_0x3513c2,_0x9af337){var _0x587141={};var _0x8e8e13={};var _0x130546;return db['User'][_0x2954('0x89')]({'where':{'id':_0x3513c2[_0x2954('0x57')]['id']}})[_0x2954('0x1e')](handleEntityNotFound(_0x9af337,null))['then'](function(_0x3fd9a9){if(_0x3fd9a9){_0x130546=_0x3fd9a9;_0x8e8e13['model']=_[_0x2954('0xbe')](db[_0x2954('0x43')][_0x2954('0x30')]);_0x8e8e13['query']=_['keys'](_0x3513c2['query']);_0x8e8e13[_0x2954('0xbf')]=_['intersection'](_0x8e8e13[_0x2954('0xbd')],_0x8e8e13[_0x2954('0x3d')]);_0x587141[_0x2954('0x54')]=_[_0x2954('0xc0')](_0x8e8e13[_0x2954('0xbd')],qs[_0x2954('0xc1')](_0x3513c2['query']['fields']));_0x587141[_0x2954('0x54')]=_0x587141[_0x2954('0x54')][_0x2954('0x66')]?_0x587141[_0x2954('0x54')]:_0x8e8e13[_0x2954('0xbd')];_0x587141[_0x2954('0xc2')]=qs['sort'](_0x3513c2[_0x2954('0x3d')][_0x2954('0xc3')]);_0x587141[_0x2954('0x3c')]=qs[_0x2954('0xbf')](_['pick'](_0x3513c2['query'],_0x8e8e13[_0x2954('0xbf')]));if(_0x3513c2[_0x2954('0x3d')][_0x2954('0x34')]){_0x587141[_0x2954('0x3c')]=_[_0x2954('0x52')](_0x587141[_0x2954('0x3c')],{'$or':_[_0x2954('0x29')](_0x587141['attributes'],function(_0x2ac3e4){var _0x3dd92d={};_0x3dd92d[_0x2ac3e4]={'$like':'%'+_0x3513c2[_0x2954('0x3d')][_0x2954('0x34')]+'%'};return _0x3dd92d;})});}_0x587141[_0x2954('0xbd')]=db['User'];_0x587141['as']=_0x2954('0x26');_0x587141=_[_0x2954('0x52')]({},_0x587141,_0x3513c2[_0x2954('0x53')]);return _0x130546[_0x2954('0xe2')]({'include':[_0x587141]});}})[_0x2954('0x1e')](function(_0x5c3370){if(_0x5c3370){var _0x52ddbe={},_0x2e4a6b=[];for(var _0x4bcab1=0x0;_0x4bcab1<_0x5c3370[_0x2954('0x66')];_0x4bcab1+=0x1){for(var _0x1e4a7e=0x0,_0x5b7283;_0x1e4a7e<_0x5c3370[_0x4bcab1]['Agents']['length'];_0x1e4a7e+=0x1){_0x5b7283=_0x5c3370[_0x4bcab1][_0x2954('0x26')][_0x1e4a7e][_0x2954('0x9b')]({'plain':!![]});_0x52ddbe[_0x5b7283['id']]=_0x5b7283;}}_0x52ddbe=_['values'](_0x52ddbe);for(var _0x4de70a=qs[_0x2954('0x1a')](_0x3513c2['query'][_0x2954('0x1a')]);_0x4de70a<_0x52ddbe[_0x2954('0x66')]&&_0x2e4a6b['length']=_0xd51d76[_0xb29c('0x4c')]){throw new Error(_0xb29c('0x4d'));}})[_0xb29c('0x1e')](function(){if(_0x20764c){return db['UserVoiceQueueRt'][_0xb29c('0x4e')]({'where':{'membername':_0x20764c[_0xb29c('0x21')]},'individualHooks':!![]});}})['then'](function(){if(_0x20764c){return _0x20764c[_0xb29c('0x4f')]({'raw':!![]});}})[_0xb29c('0x1e')](function(_0x3daf5d){if(_0x20764c){if(_0x3daf5d){var _0x5066e5=[];_0x29a7df=_0x3daf5d;if(_0x29a7df[_0xb29c('0x2a')]){for(var _0x52566e=0x0;_0x52566e<_0x29a7df[_0xb29c('0x2a')];_0x52566e++){_0x5066e5[_0xb29c('0x2f')](db['UserVoiceQueueRt'][_0xb29c('0x50')]({'membername':_0x20764c['name'],'UserId':_0x20764c['id'],'queue_name':_0x29a7df[_0x52566e][_0xb29c('0x21')],'VoiceQueueId':_0x29a7df[_0x52566e]['id'],'interface':_0x4fcbec,'paused':_0x20764c[_0xb29c('0x48')]||![],'penalty':_0x29a7df[_0x52566e][_0xb29c('0x51')]||0x0}));}return BPromise[_0xb29c('0x45')](_0x5066e5);}}}})[_0xb29c('0x1e')](function(){if(_0x20764c){return db['MemberReport']['findAll']({'where':{'membername':_0x20764c[_0xb29c('0x21')],'exitAt':null}});}})[_0xb29c('0x1e')](function(_0x1f8875){if(_0x20764c){if(_0x1f8875&&_0x1f8875[_0xb29c('0x2a')]){var _0x438db3=[];_0x1f8875['forEach'](function(_0x517a91){_0x438db3[_0xb29c('0x2f')](_0x517a91['update']({'exitAt':moment()[_0xb29c('0x25')](_0xb29c('0x2b'))}));});return BPromise[_0xb29c('0x45')](_0x438db3);}}})['then'](function(){if(_0x20764c){var _0x59769f=[];var _0x3e4c4a=[];var _0x435663=utils[_0xb29c('0x2d')]();var _0x1e7ba5={'membername':_0x20764c[_0xb29c('0x21')],'interface':_0x4fcbec,'enterAt':moment()[_0xb29c('0x25')](_0xb29c('0x2b')),'role':_0x20764c[_0xb29c('0x22')],'internal':_0x20764c['internal']};_0x435663[_0xb29c('0x2e')](function(_0x519b3a){_0x59769f[_0xb29c('0x2f')](_[_0xb29c('0x52')]({'channel':_0x519b3a,'type':_0xb29c('0x53'),'data1':'callysquare','data2':_0x4fcbec},_0x1e7ba5));if(_0x20764c[_0xb29c('0x48')]){_0x3e4c4a[_0xb29c('0x2f')](_[_0xb29c('0x52')]({'channel':_0x519b3a,'type':_0xb29c('0x32'),'data1':_0xb29c('0x54')},_0x1e7ba5));}});return db[_0xb29c('0x29')]['bulkCreate'](_0x59769f[_0xb29c('0x55')](_0x3e4c4a),{'individualHooks':!![]});}})[_0xb29c('0x1e')](function(){if(_0x20764c){return _0x20764c['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x20764c[_0xb29c('0x48')]||![],'mailPause':_0x20764c[_0xb29c('0x48')]||![],'chatPause':_0x20764c['loginInPause']||![],'faxPause':_0x20764c[_0xb29c('0x48')]||![],'smsPause':_0x20764c['loginInPause']||![],'openchannelPause':_0x20764c[_0xb29c('0x48')]||![],'pauseType':_0x20764c[_0xb29c('0x48')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xb29c('0x25')](_0xb29c('0x2b')),'interface':_0x4fcbec});}})[_0xb29c('0x1e')](function(_0x956ca6){_0x56bdda(_0x956ca6);})['catch'](function(_0x5dd777){_0x2be619(_0x2c64b2['error'](0x1f4,_0x5dd777[_0xb29c('0x1b')]));});});}; \ No newline at end of file +var _0x63ba=['../../config/logger','../../config/environment','redis','defaults','localhost','register','GetUser','User','findAll','options','where','limit','include','model','attributes','map','then','info','stringify','catch','message','error','ShowUser','find','raw','debug','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','bulkCreate','type','DEFAULT\x20PAUSE','UnpauseUser','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','voicePause','mailPause','chatPause','faxPause','smsPause','lastPauseAt','unpause','system','findOne','destroy','MemberReport','all','LoginUser','mobile','phone','loginInPause','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63ba,0xfb));var _0xa63b=function(_0x1dd616,_0x14996f){_0x1dd616=_0x1dd616-0x0;var _0x59660c=_0x63ba[_0x1dd616];return _0x59660c;};'use strict';var _=require('lodash');var util=require(_0xa63b('0x0'));var moment=require('moment');var BPromise=require(_0xa63b('0x1'));var Redis=require('ioredis');var db=require(_0xa63b('0x2'))['db'];var utils=require(_0xa63b('0x3'));var logger=require(_0xa63b('0x4'))('rpc');var config=require(_0xa63b('0x5'));config[_0xa63b('0x6')]=_[_0xa63b('0x7')](config[_0xa63b('0x6')],{'host':_0xa63b('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa63b('0x6')]));require('./user.socket')[_0xa63b('0x9')](socket);exports[_0xa63b('0xa')]=function(_0x321069){var _0x29aa9a=this;return new Promise(function(_0x2a8aab,_0x29e695){return db[_0xa63b('0xb')][_0xa63b('0xc')]({'raw':_0x321069['options']?_0x321069['options']['raw']===undefined?!![]:![]:!![],'where':_0x321069[_0xa63b('0xd')]?_0x321069['options'][_0xa63b('0xe')]||null:null,'attributes':_0x321069[_0xa63b('0xd')]?_0x321069[_0xa63b('0xd')]['attributes']||null:null,'limit':_0x321069[_0xa63b('0xd')]?_0x321069['options'][_0xa63b('0xf')]||null:null,'include':_0x321069[_0xa63b('0xd')]?_0x321069[_0xa63b('0xd')][_0xa63b('0x10')]?_['map'](_0x321069[_0xa63b('0xd')][_0xa63b('0x10')],function(_0x59a57b){return{'model':db[_0x59a57b[_0xa63b('0x11')]],'as':_0x59a57b['as'],'attributes':_0x59a57b[_0xa63b('0x12')],'include':_0x59a57b[_0xa63b('0x10')]?_['map'](_0x59a57b[_0xa63b('0x10')],function(_0xbe8596){return{'model':db[_0xbe8596[_0xa63b('0x11')]],'as':_0xbe8596['as'],'attributes':_0xbe8596['attributes'],'include':_0xbe8596[_0xa63b('0x10')]?_[_0xa63b('0x13')](_0xbe8596[_0xa63b('0x10')],function(_0x3efdef){return{'model':db[_0x3efdef[_0xa63b('0x11')]],'as':_0x3efdef['as'],'attributes':_0x3efdef[_0xa63b('0x12')]};}):[]};}):[]};}):[]:[]})[_0xa63b('0x14')](function(_0x184e54){logger[_0xa63b('0x15')](_0xa63b('0xa'),_0x321069);logger['debug'](_0xa63b('0xa'),_0x321069,JSON[_0xa63b('0x16')](_0x184e54));_0x2a8aab(_0x184e54);})[_0xa63b('0x17')](function(_0x20202e){logger['error'](_0xa63b('0xa'),_0x20202e[_0xa63b('0x18')],_0x321069);_0x29e695(_0x29aa9a[_0xa63b('0x19')](0x1f4,_0x20202e[_0xa63b('0x18')]));});});};exports[_0xa63b('0x1a')]=function(_0x360a9b){var _0x53e6cc=this;return new Promise(function(_0xc5da1e,_0x2cc861){return db[_0xa63b('0xb')][_0xa63b('0x1b')]({'raw':_0x360a9b[_0xa63b('0xd')]?_0x360a9b[_0xa63b('0xd')][_0xa63b('0x1c')]===undefined?!![]:![]:!![],'where':_0x360a9b[_0xa63b('0xd')]?_0x360a9b[_0xa63b('0xd')][_0xa63b('0xe')]||null:null,'attributes':_0x360a9b[_0xa63b('0xd')]?_0x360a9b['options'][_0xa63b('0x12')]||null:null,'include':_0x360a9b[_0xa63b('0xd')]?_0x360a9b[_0xa63b('0xd')][_0xa63b('0x10')]?_[_0xa63b('0x13')](_0x360a9b[_0xa63b('0xd')][_0xa63b('0x10')],function(_0xb7dc36){return{'model':db[_0xb7dc36[_0xa63b('0x11')]],'as':_0xb7dc36['as'],'attributes':_0xb7dc36[_0xa63b('0x12')],'include':_0xb7dc36[_0xa63b('0x10')]?_[_0xa63b('0x13')](_0xb7dc36[_0xa63b('0x10')],function(_0x58713d){return{'model':db[_0x58713d[_0xa63b('0x11')]],'as':_0x58713d['as'],'attributes':_0x58713d[_0xa63b('0x12')],'include':_0x58713d[_0xa63b('0x10')]?_[_0xa63b('0x13')](_0x58713d['include'],function(_0x3e8217){return{'model':db[_0x3e8217[_0xa63b('0x11')]],'as':_0x3e8217['as'],'attributes':_0x3e8217['attributes']};}):[]};}):[]};}):[]:[]})[_0xa63b('0x14')](function(_0x5d14f5){logger[_0xa63b('0x15')]('ShowUser',_0x360a9b);logger[_0xa63b('0x1d')](_0xa63b('0x1a'),_0x360a9b,JSON[_0xa63b('0x16')](_0x5d14f5));_0xc5da1e(_0x5d14f5);})[_0xa63b('0x17')](function(_0xdd05d1){logger['error'](_0xa63b('0x1a'),_0xdd05d1['message'],_0x360a9b);_0x2cc861(_0x53e6cc[_0xa63b('0x19')](0x1f4,_0xdd05d1[_0xa63b('0x18')]));});});};exports[_0xa63b('0x1e')]=function(_0x5cf6ac){var _0x536e7b;return db[_0xa63b('0xb')]['find']({'where':_0x5cf6ac[_0xa63b('0xd')][_0xa63b('0xe')]||{},'attributes':['id',_0xa63b('0x1f'),_0xa63b('0x20'),_0xa63b('0x21'),_0xa63b('0x22')]})[_0xa63b('0x14')](function(_0x5a224d){if(!_0x5a224d){throw new Error(util[_0xa63b('0x23')](_0xa63b('0x24'),_0x5cf6ac[_0xa63b('0x25')]['id']));}_0x536e7b=_0x5a224d;return db[_0xa63b('0x26')][_0xa63b('0x27')]({'paused':0x1},{'where':{'UserId':_0x536e7b['id']},'individualHooks':!![]});})[_0xa63b('0x14')](function(){return db['MemberReport'][_0xa63b('0xc')]({'where':{'membername':_0x536e7b[_0xa63b('0x1f')],'type':_0xa63b('0x28'),'exitAt':null}});})['then'](function(_0x14f17b){if(_0x14f17b&&_0x14f17b[_0xa63b('0x29')]){var _0x5b5aca=moment()[_0xa63b('0x23')](_0xa63b('0x2a'));for(var _0x309afa=0x0,_0x2683e5=_0x14f17b['length'];_0x309afa<_0x2683e5;_0x309afa++){_0x14f17b[_0x309afa][_0xa63b('0x2b')]({'exitAt':_0x5b5aca});}}})[_0xa63b('0x14')](function(){var _0x56fdd3=[];var _0x3461a1=utils[_0xa63b('0x2c')]();_0x3461a1[_0xa63b('0x2d')](function(_0x11ec00){_0x56fdd3[_0xa63b('0x2e')]({'channel':_0x11ec00,'membername':_0x536e7b['name'],'interface':_[_0xa63b('0x2f')](_0x536e7b[_0xa63b('0x22')])?util[_0xa63b('0x23')](_0xa63b('0x30'),_0x536e7b[_0xa63b('0x1f')]):_0x536e7b['interface'],'type':'PAUSE','enterAt':moment()[_0xa63b('0x23')](_0xa63b('0x2a')),'data1':_0x5cf6ac[_0xa63b('0x31')]['type']||'DEFAULT\x20PAUSE','role':_0x536e7b['role'],'internal':_0x536e7b['internal'],'uniqueid':_0x5cf6ac[_0xa63b('0x31')]['uniqueid']||null});});return db['MemberReport'][_0xa63b('0x32')](_0x56fdd3,{'individualHooks':!![]});})['then'](function(){return _0x536e7b[_0xa63b('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5cf6ac[_0xa63b('0x31')][_0xa63b('0x33')]||_0xa63b('0x34'),'lastPauseAt':moment()[_0xa63b('0x23')](_0xa63b('0x2a'))});})['catch'](function(_0x2bb7ec){throw _0x2bb7ec;});};exports[_0xa63b('0x35')]=function(_0x38864a){return Promise[_0xa63b('0x36')]()['then'](function(){if(_0x38864a[_0xa63b('0x31')][_0xa63b('0x37')]&&!utils['isValidChannel'](_0x38864a[_0xa63b('0x31')][_0xa63b('0x37')])){throw new Error(util[_0xa63b('0x23')](_0xa63b('0x38'),_0x38864a[_0xa63b('0x31')]['channel']));}return db[_0xa63b('0xb')]['findOne']({'where':_0x38864a[_0xa63b('0xd')][_0xa63b('0xe')]||{},'attributes':['id',_0xa63b('0x1f'),_0xa63b('0x20'),_0xa63b('0x21'),_0xa63b('0x22'),'online',_0xa63b('0x39'),_0xa63b('0x3a'),_0xa63b('0x3b'),_0xa63b('0x3c'),'openchannelPause',_0xa63b('0x3d'),'whatsappPause','pauseType',_0xa63b('0x3e')]});})[_0xa63b('0x14')](function(_0x54989e){if(!_0x54989e){throw new Error(util[_0xa63b('0x23')]('User\x20with\x20id\x20%s\x20not\x20found',_0x38864a[_0xa63b('0x25')]['id']));}return _0x54989e[_0xa63b('0x3f')](_0x38864a[_0xa63b('0x31')][_0xa63b('0x37')],_0xa63b('0x40'));})[_0xa63b('0x17')](function(_0x1a6b91){throw _0x1a6b91;});};exports['LogoutUser']=function(_0x9f8f96){var _0x46f691=this;return new Promise(function(_0x3092bb,_0x1b67a9){var _0x1952ca;return db[_0xa63b('0xb')][_0xa63b('0x41')]({'where':_0x9f8f96[_0xa63b('0xd')]['where']||{},'attributes':['id','name']})['then'](function(_0x2e4677){if(_0x2e4677){_0x1952ca=_0x2e4677;return db[_0xa63b('0x26')][_0xa63b('0x42')]({'where':{'membername':_0x1952ca[_0xa63b('0x1f')]},'individualHooks':!![]});}})[_0xa63b('0x14')](function(){if(_0x1952ca){return db[_0xa63b('0x43')][_0xa63b('0xc')]({'where':{'membername':_0x1952ca[_0xa63b('0x1f')],'exitAt':null}});}})['then'](function(_0x1c8947){if(_0x1952ca){if(_0x1c8947&&_0x1c8947['length']){var _0x43586a=[];_0x1c8947[_0xa63b('0x2d')](function(_0x1eef52){_0x43586a['push'](_0x1eef52[_0xa63b('0x27')]({'exitAt':moment()[_0xa63b('0x23')](_0xa63b('0x2a'))}));});return BPromise[_0xa63b('0x44')](_0x43586a);}}})[_0xa63b('0x14')](function(){if(_0x1952ca){return _0x1952ca[_0xa63b('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xa63b('0x14')](function(_0x4cd90c){_0x3092bb(_0x4cd90c);})['catch'](function(_0x4e6114){_0x1b67a9(_0x46f691[_0xa63b('0x19')](0x1f4,_0x4e6114[_0xa63b('0x18')]));});});};exports[_0xa63b('0x45')]=function(_0x34ae09){var _0x5456f1=this;return new Promise(function(_0x196bf7,_0x2a3eaa){var _0x2aabc6;var _0x77e4e;var _0x5dad5e;var _0x245919;return db['User'][_0xa63b('0x41')]({'where':_0x34ae09[_0xa63b('0xd')][_0xa63b('0xe')]||{},'attributes':['id',_0xa63b('0x1f'),_0xa63b('0x20'),_0xa63b('0x46'),_0xa63b('0x47'),'internal',_0xa63b('0x48'),_0xa63b('0x22')]})['then'](function(_0x34b1ca){if(_0x34b1ca){_0x2aabc6=_0x34b1ca;_0x245919=_0x34ae09[_0xa63b('0x31')][_0xa63b('0x22')]?_0x34ae09[_0xa63b('0x31')]['interface']:util[_0xa63b('0x23')](_0xa63b('0x30'),_0x2aabc6[_0xa63b('0x1f')]);return db['User']['count']({'where':{'role':_0xa63b('0x49'),'online':!![],'id':{'$ne':_0x2aabc6['id']}}});}})[_0xa63b('0x14')](function(_0x9f1628){if(_0x9f1628){_0x5dad5e=_0x9f1628;return require(_0xa63b('0x4a'))['getLicense']();}})[_0xa63b('0x14')](function(_0x334d2a){if(_0x334d2a&&_0x334d2a[_0xa63b('0x4b')]&&_0x5dad5e>=_0x334d2a[_0xa63b('0x4b')]){throw new Error(_0xa63b('0x4c'));}})[_0xa63b('0x14')](function(){if(_0x2aabc6){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x2aabc6['name']},'individualHooks':!![]});}})[_0xa63b('0x14')](function(){if(_0x2aabc6){return _0x2aabc6[_0xa63b('0x4d')]({'raw':!![]});}})[_0xa63b('0x14')](function(_0x4ff2c6){if(_0x2aabc6){if(_0x4ff2c6){var _0x35cc51=[];_0x77e4e=_0x4ff2c6;if(_0x77e4e['length']){for(var _0x25c1b1=0x0;_0x25c1b1<_0x77e4e[_0xa63b('0x29')];_0x25c1b1++){_0x35cc51[_0xa63b('0x2e')](db[_0xa63b('0x26')][_0xa63b('0x4e')]({'membername':_0x2aabc6[_0xa63b('0x1f')],'UserId':_0x2aabc6['id'],'queue_name':_0x77e4e[_0x25c1b1][_0xa63b('0x1f')],'VoiceQueueId':_0x77e4e[_0x25c1b1]['id'],'interface':_0x245919,'paused':_0x2aabc6[_0xa63b('0x48')]||![],'penalty':_0x77e4e[_0x25c1b1][_0xa63b('0x4f')]||0x0}));}return BPromise[_0xa63b('0x44')](_0x35cc51);}}}})[_0xa63b('0x14')](function(){if(_0x2aabc6){return db[_0xa63b('0x43')]['findAll']({'where':{'membername':_0x2aabc6['name'],'exitAt':null}});}})[_0xa63b('0x14')](function(_0x1dbae2){if(_0x2aabc6){if(_0x1dbae2&&_0x1dbae2[_0xa63b('0x29')]){var _0x35637e=[];_0x1dbae2['forEach'](function(_0x11f6b3){_0x35637e[_0xa63b('0x2e')](_0x11f6b3[_0xa63b('0x27')]({'exitAt':moment()['format'](_0xa63b('0x2a'))}));});return BPromise[_0xa63b('0x44')](_0x35637e);}}})[_0xa63b('0x14')](function(){if(_0x2aabc6){var _0x3ca9b5=[];var _0x549c83=[];var _0x399dd0=utils[_0xa63b('0x2c')]();var _0x47ffd3={'membername':_0x2aabc6[_0xa63b('0x1f')],'interface':_0x245919,'enterAt':moment()[_0xa63b('0x23')](_0xa63b('0x2a')),'role':_0x2aabc6['role'],'internal':_0x2aabc6[_0xa63b('0x21')]};_0x399dd0[_0xa63b('0x2d')](function(_0x13ca1c){_0x3ca9b5[_0xa63b('0x2e')](_[_0xa63b('0x50')]({'channel':_0x13ca1c,'type':_0xa63b('0x51'),'data1':_0xa63b('0x52'),'data2':_0x245919},_0x47ffd3));if(_0x2aabc6[_0xa63b('0x48')]){_0x549c83[_0xa63b('0x2e')](_[_0xa63b('0x50')]({'channel':_0x13ca1c,'type':'PAUSE','data1':_0xa63b('0x53')},_0x47ffd3));}});return db[_0xa63b('0x43')][_0xa63b('0x32')](_0x3ca9b5[_0xa63b('0x54')](_0x549c83),{'individualHooks':!![]});}})[_0xa63b('0x14')](function(){if(_0x2aabc6){return _0x2aabc6['update']({'online':!![],'lastLoginAt':moment()[_0xa63b('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2aabc6['loginInPause']||![],'mailPause':_0x2aabc6[_0xa63b('0x48')]||![],'chatPause':_0x2aabc6[_0xa63b('0x48')]||![],'faxPause':_0x2aabc6['loginInPause']||![],'smsPause':_0x2aabc6['loginInPause']||![],'openchannelPause':_0x2aabc6[_0xa63b('0x48')]||![],'pauseType':_0x2aabc6[_0xa63b('0x48')]?_0xa63b('0x53'):null,'lastPauseAt':moment()[_0xa63b('0x23')](_0xa63b('0x2a')),'interface':_0x245919});}})[_0xa63b('0x14')](function(_0x122a37){_0x196bf7(_0x122a37);})[_0xa63b('0x17')](function(_0x25e0a9){_0x2a3eaa(_0x5456f1['error'](0x1f4,_0x25e0a9[_0xa63b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 69443aa..f6e887c 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 _0x4eb2=['user:','./user.events','save','remove','emit','removeListener','register','length'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x4eb2,0xb9));var _0x24eb=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x4eb2[_0x125ff8];return _0x2d9ef;};'use strict';var UserEvents=require(_0x24eb('0x0'));var events=[_0x24eb('0x1'),_0x24eb('0x2'),'update'];function createListener(_0x55802a,_0x396b8b){return function(_0xb40f47){_0x396b8b[_0x24eb('0x3')](_0x55802a,_0xb40f47);};}function removeListener(_0x4dc368,_0x325023){return function(){UserEvents[_0x24eb('0x4')](_0x4dc368,_0x325023);};}exports[_0x24eb('0x5')]=function(_0x5569ca){for(var _0x350a1a=0x0,_0x5e01c8=events[_0x24eb('0x6')];_0x350a1a<_0x5e01c8;_0x350a1a++){var _0xff459b=events[_0x350a1a];var _0x2e057a=createListener(_0x24eb('0x7')+_0xff459b,_0x5569ca);UserEvents['on'](_0xff459b,_0x2e057a);}}; \ No newline at end of file +var _0x7754=['emit','removeListener','length','./user.events','save','remove','update'];(function(_0x1b5080,_0x3e7cc9){var _0x195c87=function(_0x1ef917){while(--_0x1ef917){_0x1b5080['push'](_0x1b5080['shift']());}};_0x195c87(++_0x3e7cc9);}(_0x7754,0x192));var _0x4775=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0x7754[_0x133277];return _0x5b4a22;};'use strict';var UserEvents=require(_0x4775('0x0'));var events=[_0x4775('0x1'),_0x4775('0x2'),_0x4775('0x3')];function createListener(_0x149657,_0x293a83){return function(_0x292b1e){_0x293a83[_0x4775('0x4')](_0x149657,_0x292b1e);};}function removeListener(_0x226e7b,_0x47a192){return function(){UserEvents[_0x4775('0x5')](_0x226e7b,_0x47a192);};}exports['register']=function(_0x5aa4eb){for(var _0x6ede06=0x0,_0x14a2f6=events[_0x4775('0x6')];_0x6ede06<_0x14a2f6;_0x6ede06++){var _0x3f6cf0=events[_0x6ede06];var _0x86afbf=createListener('user:'+_0x3f6cf0,_0x5aa4eb);UserEvents['on'](_0x3f6cf0,_0x86afbf);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index fccc95b..df22caf 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x209c3b,_0x5e71f9){var _0x299e78=function(_0x37c9a8){while(--_0x37c9a8){_0x209c3b['push'](_0x209c3b['shift']());}};_0x299e78(++_0x5e71f9);}(_0xe706,0xa3));var _0x6e70=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xe706[_0x409353];return _0x4f4b59;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1d9a5a,_0x53eb60){var _0x58b7bd=function(_0x141fd0){while(--_0x141fd0){_0x1d9a5a['push'](_0x1d9a5a['shift']());}};_0x58b7bd(++_0x53eb60);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 55300fd..69c93e3 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 _0x9ed7=['sequelize','INTEGER'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x9ed7,0x168));var _0x79ed=function(_0xd63e3a,_0x1bd6eb){_0xd63e3a=_0xd63e3a-0x0;var _0x19c178=_0x9ed7[_0xd63e3a];return _0x19c178;};'use strict';var Sequelize=require(_0x79ed('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x79ed('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9be3=['sequelize','exports'];(function(_0xc69f39,_0x2ce0cf){var _0x93be41=function(_0xd66056){while(--_0xd66056){_0xc69f39['push'](_0xc69f39['shift']());}};_0x93be41(++_0x2ce0cf);}(_0x9be3,0xd2));var _0x39be=function(_0x2834d5,_0x8ba713){_0x2834d5=_0x2834d5-0x0;var _0x4cb566=_0x9be3[_0x2834d5];return _0x4cb566;};'use strict';var Sequelize=require(_0x39be('0x0'));module[_0x39be('0x1')]={'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 c4d17fc..a228158 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 _0x3c6e=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','util'];(function(_0x357766,_0x1ade36){var _0xe28a73=function(_0x1d8449){while(--_0x1d8449){_0x357766['push'](_0x357766['shift']());}};_0xe28a73(++_0x1ade36);}(_0x3c6e,0xd7));var _0xe3c6=function(_0x1ab357,_0x2319c1){_0x1ab357=_0x1ab357-0x0;var _0x3975eb=_0x3c6e[_0x1ab357];return _0x3975eb;};'use strict';var _=require('lodash');var util=require(_0xe3c6('0x0'));var logger=require(_0xe3c6('0x1'))(_0xe3c6('0x2'));var moment=require(_0xe3c6('0x3'));var BPromise=require('bluebird');var rp=require(_0xe3c6('0x4'));var fs=require('fs');var path=require(_0xe3c6('0x5'));var rimraf=require(_0xe3c6('0x6'));var config=require(_0xe3c6('0x7'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x419d41,_0x2d1010){return _0x419d41[_0xe3c6('0x8')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3b5=['rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x786087,_0x34dffc){var _0x2c37c8=function(_0x3fa168){while(--_0x3fa168){_0x786087['push'](_0x786087['shift']());}};_0x2c37c8(++_0x34dffc);}(_0xe3b5,0xbd));var _0x5e3b=function(_0x50ae58,_0xd1cb99){_0x50ae58=_0x50ae58-0x0;var _0x3cfaa0=_0xe3b5[_0x50ae58];return _0x3cfaa0;};'use strict';var _=require(_0x5e3b('0x0'));var util=require(_0x5e3b('0x1'));var logger=require(_0x5e3b('0x2'))('api');var moment=require(_0x5e3b('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e3b('0x4'));var fs=require('fs');var path=require(_0x5e3b('0x5'));var rimraf=require(_0x5e3b('0x6'));var config=require(_0x5e3b('0x7'));var attributes=require(_0x5e3b('0x8'));module[_0x5e3b('0x9')]=function(_0x835ade,_0x47e6c3){return _0x835ade[_0x5e3b('0xa')](_0x5e3b('0xb'),attributes,{'tableName':_0x5e3b('0xc'),'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 3918836..e0f73cb 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 _0x31c3=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','UserChatQueue,\x20%s,\x20%s'];(function(_0xc2b23,_0x111eec){var _0x8090b8=function(_0x5c180f){while(--_0x5c180f){_0xc2b23['push'](_0xc2b23['shift']());}};_0x8090b8(++_0x111eec);}(_0x31c3,0x77));var _0x331c=function(_0x4ae60f,_0x3fa2a3){_0x4ae60f=_0x4ae60f-0x0;var _0x15759a=_0x31c3[_0x4ae60f];return _0x15759a;};'use strict';var _=require(_0x331c('0x0'));var util=require('util');var moment=require(_0x331c('0x1'));var BPromise=require(_0x331c('0x2'));var rs=require(_0x331c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x331c('0x4'))['db'];var utils=require(_0x331c('0x5'));var logger=require(_0x331c('0x6'))(_0x331c('0x7'));var config=require(_0x331c('0x8'));var jayson=require(_0x331c('0x9'));var client=jayson['client'][_0x331c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x335103,_0x228a2c,_0x32ead8){return new BPromise(function(_0x539c17,_0x585bcb){return client['request'](_0x335103,_0x32ead8)[_0x331c('0xb')](function(_0x82526a){logger['info'](_0x331c('0xc'),_0x228a2c,'request\x20sent');logger[_0x331c('0xd')](_0x331c('0xe'),_0x228a2c,_0x331c('0xf'),JSON[_0x331c('0x10')](_0x82526a));if(_0x82526a[_0x331c('0x11')]){if(_0x82526a[_0x331c('0x11')][_0x331c('0x12')]===0x1f4){logger[_0x331c('0x11')](_0x331c('0xc'),_0x228a2c,_0x82526a[_0x331c('0x11')][_0x331c('0x13')]);return _0x585bcb(_0x82526a[_0x331c('0x11')][_0x331c('0x13')]);}logger[_0x331c('0x11')](_0x331c('0xc'),_0x228a2c,_0x82526a[_0x331c('0x11')]['message']);return _0x539c17(_0x82526a[_0x331c('0x11')][_0x331c('0x13')]);}else{logger[_0x331c('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x228a2c,'request\x20sent');_0x539c17(_0x82526a['result'][_0x331c('0x13')]);}})[_0x331c('0x15')](function(_0x50a323){logger[_0x331c('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x228a2c,_0x50a323);_0x585bcb(_0x50a323);});});} \ No newline at end of file +var _0x49cd=['rpc','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4f71f4,_0x2fae27){var _0x56a190=function(_0x4f07ef){while(--_0x4f07ef){_0x4f71f4['push'](_0x4f71f4['shift']());}};_0x56a190(++_0x2fae27);}(_0x49cd,0x17f));var _0xd49c=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x49cd[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0xd49c('0x0'));var util=require('util');var moment=require(_0xd49c('0x1'));var BPromise=require(_0xd49c('0x2'));var rs=require(_0xd49c('0x3'));var fs=require('fs');var Redis=require(_0xd49c('0x4'));var db=require(_0xd49c('0x5'))['db'];var utils=require(_0xd49c('0x6'));var logger=require(_0xd49c('0x7'))(_0xd49c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd49c('0x9')][_0xd49c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x861480,_0x40ab15,_0x288d16){return new BPromise(function(_0x4571a4,_0xf7865){return client[_0xd49c('0xb')](_0x861480,_0x288d16)[_0xd49c('0xc')](function(_0x30bd8a){logger[_0xd49c('0xd')](_0xd49c('0xe'),_0x40ab15,_0xd49c('0xf'));logger[_0xd49c('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x40ab15,_0xd49c('0xf'),JSON[_0xd49c('0x11')](_0x30bd8a));if(_0x30bd8a[_0xd49c('0x12')]){if(_0x30bd8a['error'][_0xd49c('0x13')]===0x1f4){logger[_0xd49c('0x12')](_0xd49c('0xe'),_0x40ab15,_0x30bd8a[_0xd49c('0x12')][_0xd49c('0x14')]);return _0xf7865(_0x30bd8a['error'][_0xd49c('0x14')]);}logger[_0xd49c('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x40ab15,_0x30bd8a[_0xd49c('0x12')][_0xd49c('0x14')]);return _0x4571a4(_0x30bd8a[_0xd49c('0x12')][_0xd49c('0x14')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x40ab15,_0xd49c('0xf'));_0x4571a4(_0x30bd8a[_0xd49c('0x15')][_0xd49c('0x14')]);}})[_0xd49c('0x16')](function(_0x3d5288){logger['error'](_0xd49c('0xe'),_0x40ab15,_0x3d5288);_0xf7865(_0x3d5288);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 07114fa..6b8b0cd 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1d66e2,_0x195dc7){var _0x3765d0=function(_0x40c7f1){while(--_0x40c7f1){_0x1d66e2['push'](_0x1d66e2['shift']());}};_0x3765d0(++_0x195dc7);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4b6126,_0x1fd8d0){var _0x1e6db1=function(_0x5343fb){while(--_0x5343fb){_0x4b6126['push'](_0x4b6126['shift']());}};_0x1e6db1(++_0x1fd8d0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index c76e590..7e68105 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 _0xcbde=['sequelize','INTEGER','STRING'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xcbde,0x1e9));var _0xecbd=function(_0x5886eb,_0x317b49){_0x5886eb=_0x5886eb-0x0;var _0x3ae673=_0xcbde[_0x5886eb];return _0x3ae673;};'use strict';var Sequelize=require(_0xecbd('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xecbd('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xecbd('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xecbd('0x2')]}}; \ No newline at end of file +var _0x8527=['INTEGER','STRING','sequelize','exports'];(function(_0x30ec20,_0x523a75){var _0x1892e2=function(_0x138a9c){while(--_0x138a9c){_0x30ec20['push'](_0x30ec20['shift']());}};_0x1892e2(++_0x523a75);}(_0x8527,0xee));var _0x7852=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0x8527[_0x218994];return _0x3f350b;};'use strict';var Sequelize=require(_0x7852('0x0'));module[_0x7852('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7852('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7852('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 8197a64..27f38fc 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 _0xff25=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues'];(function(_0x4b9b78,_0x1dc74a){var _0x330388=function(_0x49bcdc){while(--_0x49bcdc){_0x4b9b78['push'](_0x4b9b78['shift']());}};_0x330388(++_0x1dc74a);}(_0xff25,0xb6));var _0x5ff2=function(_0x2bc5e5,_0x203f7c){_0x2bc5e5=_0x2bc5e5-0x0;var _0x341ac4=_0xff25[_0x2bc5e5];return _0x341ac4;};'use strict';var _=require(_0x5ff2('0x0'));var util=require('util');var logger=require(_0x5ff2('0x1'))(_0x5ff2('0x2'));var moment=require(_0x5ff2('0x3'));var BPromise=require(_0x5ff2('0x4'));var rp=require(_0x5ff2('0x5'));var fs=require('fs');var path=require(_0x5ff2('0x6'));var rimraf=require(_0x5ff2('0x7'));var config=require(_0x5ff2('0x8'));var attributes=require(_0x5ff2('0x9'));module['exports']=function(_0x46d54f,_0x3678ea){return _0x46d54f[_0x5ff2('0xa')](_0x5ff2('0xb'),attributes,{'tableName':_0x5ff2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d7c=['define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x3de258,_0x537ad8){var _0xe0e6e4=function(_0x4f12be){while(--_0x4f12be){_0x3de258['push'](_0x3de258['shift']());}};_0xe0e6e4(++_0x537ad8);}(_0x3d7c,0x78));var _0xc3d7=function(_0x737194,_0x453cc6){_0x737194=_0x737194-0x0;var _0x492317=_0x3d7c[_0x737194];return _0x492317;};'use strict';var _=require('lodash');var util=require(_0xc3d7('0x0'));var logger=require(_0xc3d7('0x1'))(_0xc3d7('0x2'));var moment=require(_0xc3d7('0x3'));var BPromise=require('bluebird');var rp=require(_0xc3d7('0x4'));var fs=require('fs');var path=require(_0xc3d7('0x5'));var rimraf=require(_0xc3d7('0x6'));var config=require(_0xc3d7('0x7'));var attributes=require(_0xc3d7('0x8'));module[_0xc3d7('0x9')]=function(_0x426dea,_0x3acfbd){return _0x426dea[_0xc3d7('0xa')](_0xc3d7('0xb'),attributes,{'tableName':_0xc3d7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 4023f1a..5267965 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 _0x9acd=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x4b7e37,_0x2e3fd5){var _0x4404af=function(_0x3cb16f){while(--_0x3cb16f){_0x4b7e37['push'](_0x4b7e37['shift']());}};_0x4404af(++_0x2e3fd5);}(_0x9acd,0x71));var _0xd9ac=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9acd[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xd9ac('0x0'));var util=require(_0xd9ac('0x1'));var moment=require('moment');var BPromise=require(_0xd9ac('0x2'));var rs=require(_0xd9ac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9ac('0x4'))['db'];var utils=require(_0xd9ac('0x5'));var logger=require(_0xd9ac('0x6'))(_0xd9ac('0x7'));var config=require('../../config/environment');var jayson=require(_0xd9ac('0x8'));var client=jayson[_0xd9ac('0x9')][_0xd9ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x514b1c,_0x5b9ee1,_0x372936){return new BPromise(function(_0x4128d9,_0x330a80){return client[_0xd9ac('0xb')](_0x514b1c,_0x372936)[_0xd9ac('0xc')](function(_0x3d9ae1){logger[_0xd9ac('0xd')](_0xd9ac('0xe'),_0x5b9ee1,_0xd9ac('0xf'));logger[_0xd9ac('0x10')](_0xd9ac('0x11'),_0x5b9ee1,'request\x20sent',JSON['stringify'](_0x3d9ae1));if(_0x3d9ae1['error']){if(_0x3d9ae1[_0xd9ac('0x12')][_0xd9ac('0x13')]===0x1f4){logger['error'](_0xd9ac('0xe'),_0x5b9ee1,_0x3d9ae1['error'][_0xd9ac('0x14')]);return _0x330a80(_0x3d9ae1['error'][_0xd9ac('0x14')]);}logger[_0xd9ac('0x12')](_0xd9ac('0xe'),_0x5b9ee1,_0x3d9ae1[_0xd9ac('0x12')][_0xd9ac('0x14')]);return _0x4128d9(_0x3d9ae1['error'][_0xd9ac('0x14')]);}else{logger[_0xd9ac('0xd')](_0xd9ac('0xe'),_0x5b9ee1,_0xd9ac('0xf'));_0x4128d9(_0x3d9ae1[_0xd9ac('0x15')][_0xd9ac('0x14')]);}})[_0xd9ac('0x16')](function(_0x3de483){logger[_0xd9ac('0x12')](_0xd9ac('0xe'),_0x5b9ee1,_0x3de483);_0x330a80(_0x3de483);});});} \ No newline at end of file +var _0x96ec=['error','message','UserFaxQueue,\x20%s,\x20%s','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','stringify'];(function(_0xd8f3e2,_0xe0915a){var _0xa1e682=function(_0x2a1f19){while(--_0x2a1f19){_0xd8f3e2['push'](_0xd8f3e2['shift']());}};_0xa1e682(++_0xe0915a);}(_0x96ec,0x82));var _0xc96e=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0x96ec[_0x16771d];return _0x386f11;};'use strict';var _=require(_0xc96e('0x0'));var util=require('util');var moment=require(_0xc96e('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc96e('0x3'))['db'];var utils=require(_0xc96e('0x4'));var logger=require('../../config/logger')(_0xc96e('0x5'));var config=require(_0xc96e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc96e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5727ec,_0x56ec06,_0x2c0274){return new BPromise(function(_0x57f45e,_0x357ba7){return client[_0xc96e('0x8')](_0x5727ec,_0x2c0274)[_0xc96e('0x9')](function(_0x11915f){logger[_0xc96e('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x56ec06,_0xc96e('0xb'));logger[_0xc96e('0xc')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x56ec06,'request\x20sent',JSON[_0xc96e('0xd')](_0x11915f));if(_0x11915f[_0xc96e('0xe')]){if(_0x11915f['error']['code']===0x1f4){logger[_0xc96e('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x56ec06,_0x11915f[_0xc96e('0xe')][_0xc96e('0xf')]);return _0x357ba7(_0x11915f[_0xc96e('0xe')][_0xc96e('0xf')]);}logger[_0xc96e('0xe')](_0xc96e('0x10'),_0x56ec06,_0x11915f[_0xc96e('0xe')]['message']);return _0x57f45e(_0x11915f[_0xc96e('0xe')][_0xc96e('0xf')]);}else{logger[_0xc96e('0xa')](_0xc96e('0x10'),_0x56ec06,_0xc96e('0xb'));_0x57f45e(_0x11915f['result'][_0xc96e('0xf')]);}})[_0xc96e('0x11')](function(_0x4b65cc){logger[_0xc96e('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x56ec06,_0x4b65cc);_0x357ba7(_0x4b65cc);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index b7dc912..ca9cccf 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1c571e,_0x548a78){var _0x4c546e=function(_0x4402b0){while(--_0x4402b0){_0x1c571e['push'](_0x1c571e['shift']());}};_0x4c546e(++_0x548a78);}(_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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1f6704,_0x106f36){var _0x4acab6=function(_0x398633){while(--_0x398633){_0x1f6704['push'](_0x1f6704['shift']());}};_0x4acab6(++_0x106f36);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 9d2a17e..7d57212 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 _0xa6a1=['INTEGER','sequelize'];(function(_0xd35de5,_0x5ee3cc){var _0x5bb99d=function(_0x54182b){while(--_0x54182b){_0xd35de5['push'](_0xd35de5['shift']());}};_0x5bb99d(++_0x5ee3cc);}(_0xa6a1,0xbb));var _0x1a6a=function(_0x65f8ff,_0xf40934){_0x65f8ff=_0x65f8ff-0x0;var _0x5ae092=_0xa6a1[_0x65f8ff];return _0x5ae092;};'use strict';var Sequelize=require(_0x1a6a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1a6a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7bf9=['INTEGER','sequelize','exports'];(function(_0xc3d817,_0x3191f5){var _0x2b7658=function(_0xf08b6e){while(--_0xf08b6e){_0xc3d817['push'](_0xc3d817['shift']());}};_0x2b7658(++_0x3191f5);}(_0x7bf9,0x15a));var _0x97bf=function(_0x1dca9b,_0xa892ec){_0x1dca9b=_0x1dca9b-0x0;var _0x385331=_0x7bf9[_0x1dca9b];return _0x385331;};'use strict';var Sequelize=require(_0x97bf('0x0'));module[_0x97bf('0x1')]={'penalty':{'type':Sequelize[_0x97bf('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 317deec..8729bbb 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 _0x455e=['request-promise','path','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x14911e,_0x578e33){var _0x46ed87=function(_0x315ad6){while(--_0x315ad6){_0x14911e['push'](_0x14911e['shift']());}};_0x46ed87(++_0x578e33);}(_0x455e,0xd7));var _0xe455=function(_0x30f5e3,_0x41d3ba){_0x30f5e3=_0x30f5e3-0x0;var _0x22ed90=_0x455e[_0x30f5e3];return _0x22ed90;};'use strict';var _=require(_0xe455('0x0'));var util=require(_0xe455('0x1'));var logger=require(_0xe455('0x2'))(_0xe455('0x3'));var moment=require(_0xe455('0x4'));var BPromise=require(_0xe455('0x5'));var rp=require(_0xe455('0x6'));var fs=require('fs');var path=require(_0xe455('0x7'));var rimraf=require('rimraf');var config=require(_0xe455('0x8'));var attributes=require(_0xe455('0x9'));module[_0xe455('0xa')]=function(_0x5d1ec4,_0x573433){return _0x5d1ec4[_0xe455('0xb')](_0xe455('0xc'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf010=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xf010,0x77));var _0x0f01=function(_0x1fe1e4,_0xcf633b){_0x1fe1e4=_0x1fe1e4-0x0;var _0x21b4f4=_0xf010[_0x1fe1e4];return _0x21b4f4;};'use strict';var _=require(_0x0f01('0x0'));var util=require('util');var logger=require(_0x0f01('0x1'))('api');var moment=require(_0x0f01('0x2'));var BPromise=require(_0x0f01('0x3'));var rp=require(_0x0f01('0x4'));var fs=require('fs');var path=require(_0x0f01('0x5'));var rimraf=require(_0x0f01('0x6'));var config=require(_0x0f01('0x7'));var attributes=require(_0x0f01('0x8'));module['exports']=function(_0x1d8ac6,_0xa039e1){return _0x1d8ac6[_0x0f01('0x9')]('UserMailQueue',attributes,{'tableName':_0x0f01('0xa'),'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 05de9dd..81d7a21 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x3f93a6,_0x9df034){var _0x33af95=function(_0x26a8c8){while(--_0x26a8c8){_0x3f93a6['push'](_0x3f93a6['shift']());}};_0x33af95(++_0x9df034);}(_0x3e74,0x175));var _0x43e7=function(_0x1ec994,_0x25700e){_0x1ec994=_0x1ec994-0x0;var _0x116d24=_0x3e74[_0x1ec994];return _0x116d24;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x292fa5,_0xd3ea4f){var _0x39ecf4=function(_0x4c90cd){while(--_0x4c90cd){_0x292fa5['push'](_0x292fa5['shift']());}};_0x39ecf4(++_0xd3ea4f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x41930a,_0x264623){_0x41930a=_0x41930a-0x0;var _0x147ffd=_0x8ef6[_0x41930a];return _0x147ffd;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index d0bed60..ee5bb1d 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 _0x38e1=['sendUserNotification','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x38e1,0x1a6));var _0x138e=function(_0x1c1567,_0x488e61){_0x1c1567=_0x1c1567-0x0;var _0xbb709b=_0x38e1[_0x1c1567];return _0xbb709b;};'use strict';var multer=require(_0x138e('0x0'));var util=require(_0x138e('0x1'));var path=require(_0x138e('0x2'));var timeout=require(_0x138e('0x3'));var express=require(_0x138e('0x4'));var router=express['Router']();var fs_extra=require(_0x138e('0x5'));var auth=require(_0x138e('0x6'));var interaction=require(_0x138e('0x7'));var config=require(_0x138e('0x8'));var controller=require('./userNotification.controller');router['post']('/',auth[_0x138e('0x9')](),controller[_0x138e('0xa')]);module[_0x138e('0xb')]=router; \ No newline at end of file +var _0xf33c=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0xf33c,0x127));var _0xcf33=function(_0x5a7322,_0x5a3b73){_0x5a7322=_0x5a7322-0x0;var _0x445373=_0xf33c[_0x5a7322];return _0x445373;};'use strict';var multer=require(_0xcf33('0x0'));var util=require(_0xcf33('0x1'));var path=require(_0xcf33('0x2'));var timeout=require(_0xcf33('0x3'));var express=require(_0xcf33('0x4'));var router=express[_0xcf33('0x5')]();var fs_extra=require(_0xcf33('0x6'));var auth=require(_0xcf33('0x7'));var interaction=require(_0xcf33('0x8'));var config=require(_0xcf33('0x9'));var controller=require(_0xcf33('0xa'));router['post']('/',auth[_0xcf33('0xb')](),controller[_0xcf33('0xc')]);module[_0xcf33('0xd')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 7523314..bae2153 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 _0xa0c2=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa0c2,0x122));var _0x2a0c=function(_0x232e16,_0x1328d3){_0x232e16=_0x232e16-0x0;var _0x29719c=_0xa0c2[_0x232e16];return _0x29719c;};'use strict';var Sequelize=require(_0x2a0c('0x0'));module[_0x2a0c('0x1')]={'body':{'type':Sequelize[_0x2a0c('0x2')]},'senderName':{'type':Sequelize[_0x2a0c('0x3')]},'recipientsId':{'type':Sequelize[_0x2a0c('0x2')]},'recipientsDescription':{'type':Sequelize[_0x2a0c('0x3')]},'beep':{'type':Sequelize[_0x2a0c('0x4')]}}; \ No newline at end of file +var _0xd408=['STRING','BOOLEAN','sequelize','exports'];(function(_0x9ff1c0,_0x207afc){var _0x3e6c23=function(_0x11ad15){while(--_0x11ad15){_0x9ff1c0['push'](_0x9ff1c0['shift']());}};_0x3e6c23(++_0x207afc);}(_0xd408,0x126));var _0x8d40=function(_0x344bcd,_0x25b335){_0x344bcd=_0x344bcd-0x0;var _0x2b73fa=_0xd408[_0x344bcd];return _0x2b73fa;};'use strict';var Sequelize=require(_0x8d40('0x0'));module[_0x8d40('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x8d40('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x8d40('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index db8fafe..f4f8f93 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 _0x2530=['./userNotification.socket','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','end','sendStatus','error','name','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','catch','Template','TemplateId','render','html','view','startCase','union','ids','queue','replace','Queue','push','all','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x5d0818,_0x188411){var _0x37fcdb=function(_0x10c95a){while(--_0x10c95a){_0x5d0818['push'](_0x5d0818['shift']());}};_0x37fcdb(++_0x188411);}(_0x2530,0xa4));var _0x0253=function(_0x7c1bbe,_0x596795){_0x7c1bbe=_0x7c1bbe-0x0;var _0x1cfaba=_0x2530[_0x7c1bbe];return _0x1cfaba;};'use strict';var emlformat=require(_0x0253('0x0'));var rimraf=require(_0x0253('0x1'));var zipdir=require(_0x0253('0x2'));var jsonpatch=require(_0x0253('0x3'));var rp=require(_0x0253('0x4'));var moment=require('moment');var BPromise=require(_0x0253('0x5'));var Mustache=require('mustache');var util=require(_0x0253('0x6'));var path=require('path');var sox=require(_0x0253('0x7'));var csv=require(_0x0253('0x8'));var ejs=require(_0x0253('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0253('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0253('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0253('0x8'));var querystring=require(_0x0253('0xc'));var Papa=require('papaparse');var Redis=require(_0x0253('0xd'));var authService=require(_0x0253('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0253('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0253('0x10'))(_0x0253('0x11'));var utils=require(_0x0253('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0253('0x13'));var db=require(_0x0253('0x14'))['db'];config[_0x0253('0x15')]=_[_0x0253('0x16')](config[_0x0253('0x15')],{'host':_0x0253('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0253('0x15')]));require(_0x0253('0x18'))['register'](socket);function respondWithStatusCode(_0x5d7ab7,_0x2dbcf0){_0x2dbcf0=_0x2dbcf0||0xcc;return function(_0x446366){if(_0x446366){return _0x5d7ab7['sendStatus'](_0x2dbcf0);}return _0x5d7ab7[_0x0253('0x19')](_0x2dbcf0)['end']();};}function respondWithResult(_0x56bb3c,_0x2d99e1){_0x2d99e1=_0x2d99e1||0xc8;return function(_0x259f79){if(_0x259f79){return _0x56bb3c[_0x0253('0x19')](_0x2d99e1)['json'](_0x259f79);}};}function respondWithFilteredResult(_0x4799f6,_0x2b3878){return function(_0xccbea){if(_0xccbea){var _0x347bc4=typeof _0x2b3878[_0x0253('0x1a')]==='undefined'&&typeof _0x2b3878[_0x0253('0x1b')]===_0x0253('0x1c');var _0x27cd0f=_0xccbea[_0x0253('0x1d')];var _0x31d66b=_0x347bc4?0x0:_0x2b3878['offset'];var _0x4763a0=_0x347bc4?_0xccbea[_0x0253('0x1d')]:_0x2b3878[_0x0253('0x1a')]+_0x2b3878[_0x0253('0x1b')];var _0x3a6d05;if(_0x4763a0>=_0x27cd0f){_0x4763a0=_0x27cd0f;_0x3a6d05=0xc8;}else{_0x3a6d05=0xce;}_0x4799f6[_0x0253('0x19')](_0x3a6d05);return _0x4799f6[_0x0253('0x1e')](_0x0253('0x1f'),_0x31d66b+'-'+_0x4763a0+'/'+_0x27cd0f)[_0x0253('0x20')](_0xccbea);}return null;};}function patchUpdates(_0x9005f4){return function(_0x51c0e8){try{jsonpatch['apply'](_0x51c0e8,_0x9005f4,!![]);}catch(_0x2beec3){return BPromise[_0x0253('0x21')](_0x2beec3);}return _0x51c0e8[_0x0253('0x22')]();};}function saveUpdates(_0x4fa65e,_0x15d6b1){return function(_0x11ac4a){if(_0x11ac4a){return _0x11ac4a['update'](_0x4fa65e)[_0x0253('0x23')](function(_0x3681b6){return _0x3681b6;});}return null;};}function removeEntity(_0x1985ca,_0x402e76){return function(_0x4c5a42){if(_0x4c5a42){return _0x4c5a42['destroy']()[_0x0253('0x23')](function(){_0x1985ca[_0x0253('0x19')](0xcc)[_0x0253('0x24')]();});}};}function handleEntityNotFound(_0x4b8ea4,_0x353a6f){return function(_0x88fac6){if(!_0x88fac6){_0x4b8ea4[_0x0253('0x25')](0x194);}return _0x88fac6;};}function handleError(_0x596b22,_0x4ddec5){_0x4ddec5=_0x4ddec5||0x1f4;return function(_0x5b5a98){logger[_0x0253('0x26')](_0x5b5a98['stack']);if(_0x5b5a98[_0x0253('0x27')]){delete _0x5b5a98[_0x0253('0x27')];}_0x596b22[_0x0253('0x19')](_0x4ddec5)['send'](_0x5b5a98);};}exports['sendUserNotification']=function(_0x1ba562,_0x3534ee,_0x1c3955){if(!_0x1ba562[_0x0253('0x28')][_0x0253('0x29')](_0x0253('0x2a'))&&!_0x1ba562[_0x0253('0x28')][_0x0253('0x29')]('TemplateId')){throw new db[(_0x0253('0x2b'))][(_0x0253('0x2c'))](_0x0253('0x2d'));}else{if(_0x1ba562[_0x0253('0x28')][_0x0253('0x29')]('TemplateId')&&!_0x1ba562[_0x0253('0x28')][_0x0253('0x29')]('view')){throw new db[(_0x0253('0x2b'))][(_0x0253('0x2c'))](_0x0253('0x2e'));}if(!_0x1ba562['body']['hasOwnProperty'](_0x0253('0x2f'))){throw new db[(_0x0253('0x2b'))][(_0x0253('0x2c'))](_0x0253('0x30'));}else{try{var _0x16de19=JSON[_0x0253('0x31')](_0x1ba562['body'][_0x0253('0x2f')]);}catch(_0x434b68){logger['error'](_0x434b68);throw new db[(_0x0253('0x2b'))][(_0x0253('0x2c'))]('Invalid\x20\x27recipients\x27\x20object');}var _0xb14948=[_0x0253('0x32'),_0x0253('0x33'),_0x0253('0x34'),_0x0253('0x35'),_0x0253('0x36'),'voicequeue',_0x0253('0x37'),_0x0253('0x38'),_0x0253('0x39')];if(_[_0x0253('0x3a')](_0x16de19,function(_0x2594c7){return!_[_0x0253('0x3b')](_0xb14948,_0x2594c7[_0x0253('0x3c')][_0x0253('0x3d')]());})){throw new db[(_0x0253('0x2b'))][(_0x0253('0x2c'))](_0x0253('0x3e'));}}}var _0x115d8f={};_0x115d8f[_0x0253('0x3f')]=_0x1ba562[_0x0253('0x28')][_0x0253('0x29')](_0x0253('0x3f'))?_0x1ba562[_0x0253('0x28')][_0x0253('0x3f')]:_0x1ba562[_0x0253('0x39')]['fullname'];_0x115d8f[_0x0253('0x40')]=_[_0x0253('0x41')](_0x1ba562[_0x0253('0x28')][_0x0253('0x40')])?null:_0x1ba562[_0x0253('0x28')][_0x0253('0x40')];_0x115d8f[_0x0253('0x42')]=_0x1ba562[_0x0253('0x28')]['beep']||![];_0x115d8f[_0x0253('0x43')]=_0x1ba562[_0x0253('0x39')]['id'];return getContent(_0x1ba562[_0x0253('0x28')])[_0x0253('0x23')](function(_0x190eac){_0x115d8f[_0x0253('0x28')]=_0x190eac;return getRecipients(_0x16de19);})[_0x0253('0x23')](function(_0x5ead62){_0x115d8f[_0x0253('0x44')]=_[_0x0253('0x45')](_0x5ead62)[_0x0253('0x46')](',');return db[_0x0253('0x47')][_0x0253('0x48')](function(_0x54b260){return db[_0x0253('0x49')][_0x0253('0x4a')](_0x115d8f,{'raw':!![],'transaction':_0x54b260})[_0x0253('0x23')](function(_0x499bbc){var _0x20adb6={'sender':_0x115d8f[_0x0253('0x3f')],'description':_0x115d8f[_0x0253('0x40')],'content':_0x115d8f[_0x0253('0x28')],'beep':_0x115d8f[_0x0253('0x42')]};_0x5ead62[_0x0253('0x4b')](function(_0x34f863){_0x20adb6[_0x0253('0x4c')]=_0x34f863;socket[_0x0253('0x4d')]('userNotification:send',_0x20adb6);});return _0x499bbc;});});})[_0x0253('0x23')](respondWithResult(_0x3534ee,0xc9))[_0x0253('0x4e')](handleError(_0x3534ee,null));};function getContent(_0x434fa4){return new BPromise(function(_0x14ecef,_0x56f61d){if(_0x434fa4[_0x0253('0x2a')]){_0x14ecef(_0x434fa4[_0x0253('0x2a')]);return;}return db[_0x0253('0x4f')]['findOne']({'attributes':['html'],'where':{'id':_0x434fa4[_0x0253('0x50')]},'raw':!![]})[_0x0253('0x23')](function(_0x1b402a){if(!_0x1b402a)throw new db[(_0x0253('0x2b'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x21eeb9=Mustache[_0x0253('0x51')](_0x1b402a[_0x0253('0x52')],_0x434fa4[_0x0253('0x53')]);_0x14ecef(_0x21eeb9);})[_0x0253('0x4e')](function(_0x283d7b){_0x56f61d(_0x283d7b);});});}function getRecipients(_0x3228cb){return new BPromise(function(_0x324e1a,_0x5cc019){var _0x2fe9c6=[];var _0x599322=[];_0x3228cb['forEach'](function(_0x514704){var _0x4dc65f=_[_0x0253('0x54')](_0x514704[_0x0253('0x3c')][_0x0253('0x3d')]());if(_0x4dc65f==='User'){_0x2fe9c6=_[_0x0253('0x55')](_0x2fe9c6,_0x514704[_0x0253('0x56')]);}else{if(_[_0x0253('0x3b')](_0x4dc65f,_0x0253('0x57')))_0x4dc65f=_0x4dc65f[_0x0253('0x58')](_0x0253('0x57'),_0x0253('0x59'));_0x514704['ids']['forEach'](function(_0x49a3b3){_0x599322[_0x0253('0x5a')](getAgents(_0x4dc65f,_0x49a3b3));});}});return BPromise[_0x0253('0x5b')](_0x599322)['then'](function(_0x759f7c){_0x2fe9c6=_[_0x0253('0x55')](_0x2fe9c6,_['flatten'](_0x759f7c));_0x324e1a(_0x2fe9c6);})['catch'](function(_0x65c80f){_0x5cc019(_0x65c80f);});});}function getAgents(_0x26bd21,_0x1c2afb){return new BPromise(function(_0x24a914,_0x30f950){return db[_0x26bd21]['findOne']({'where':{'id':_0x1c2afb}})[_0x0253('0x23')](function(_0x5e9ab8){return _0x5e9ab8[_0x0253('0x5c')]({'attributes':['id'],'raw':!![]})[_0x0253('0x23')](function(_0x578614){var _0x6e8bda=_[_0x0253('0x5d')](_0x578614,'id');_0x24a914(_0x6e8bda);});})[_0x0253('0x4e')](function(_0x20e1e3){_0x30f950(_0x20e1e3);});});} \ No newline at end of file +var _0xb997=['json','reject','save','then','error','stack','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','recipients','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','union','replace','queue','ids','all','flatten','findOne','getAgents','map','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','offset','undefined','limit','count','Content-Range'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xb997,0x100));var _0x7b99=function(_0x4af8f9,_0x24701a){_0x4af8f9=_0x4af8f9-0x0;var _0x10ab41=_0xb997[_0x4af8f9];return _0x10ab41;};'use strict';var emlformat=require(_0x7b99('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b99('0x1'));var jsonpatch=require(_0x7b99('0x2'));var rp=require('request-promise');var moment=require(_0x7b99('0x3'));var BPromise=require(_0x7b99('0x4'));var Mustache=require(_0x7b99('0x5'));var util=require(_0x7b99('0x6'));var path=require(_0x7b99('0x7'));var sox=require(_0x7b99('0x8'));var csv=require(_0x7b99('0x9'));var ejs=require(_0x7b99('0xa'));var fs=require('fs');var fs_extra=require(_0x7b99('0xb'));var _=require('lodash');var squel=require(_0x7b99('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7b99('0x9'));var querystring=require(_0x7b99('0xd'));var Papa=require(_0x7b99('0xe'));var Redis=require(_0x7b99('0xf'));var authService=require(_0x7b99('0x10'));var qs=require(_0x7b99('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b99('0x12'));var logger=require(_0x7b99('0x13'))(_0x7b99('0x14'));var utils=require(_0x7b99('0x15'));var config=require(_0x7b99('0x16'));var licenseUtil=require(_0x7b99('0x17'));var db=require('../../mysqldb')['db'];config[_0x7b99('0x18')]=_[_0x7b99('0x19')](config['redis'],{'host':_0x7b99('0x1a'),'port':0x18eb});var socket=require(_0x7b99('0x1b'))(new Redis(config[_0x7b99('0x18')]));require(_0x7b99('0x1c'))[_0x7b99('0x1d')](socket);function respondWithStatusCode(_0x2b07d8,_0x90d4a4){_0x90d4a4=_0x90d4a4||0xcc;return function(_0x564df2){if(_0x564df2){return _0x2b07d8[_0x7b99('0x1e')](_0x90d4a4);}return _0x2b07d8['status'](_0x90d4a4)[_0x7b99('0x1f')]();};}function respondWithResult(_0x5d287a,_0x54035a){_0x54035a=_0x54035a||0xc8;return function(_0x288fda){if(_0x288fda){return _0x5d287a[_0x7b99('0x20')](_0x54035a)['json'](_0x288fda);}};}function respondWithFilteredResult(_0x1315ff,_0x1dbd69){return function(_0x55f481){if(_0x55f481){var _0x30620f=typeof _0x1dbd69[_0x7b99('0x21')]===_0x7b99('0x22')&&typeof _0x1dbd69[_0x7b99('0x23')]===_0x7b99('0x22');var _0x1d23ab=_0x55f481[_0x7b99('0x24')];var _0x44268f=_0x30620f?0x0:_0x1dbd69['offset'];var _0x140423=_0x30620f?_0x55f481['count']:_0x1dbd69[_0x7b99('0x21')]+_0x1dbd69['limit'];var _0x455792;if(_0x140423>=_0x1d23ab){_0x140423=_0x1d23ab;_0x455792=0xc8;}else{_0x455792=0xce;}_0x1315ff['status'](_0x455792);return _0x1315ff['set'](_0x7b99('0x25'),_0x44268f+'-'+_0x140423+'/'+_0x1d23ab)[_0x7b99('0x26')](_0x55f481);}return null;};}function patchUpdates(_0x571d47){return function(_0x59218f){try{jsonpatch['apply'](_0x59218f,_0x571d47,!![]);}catch(_0xb89477){return BPromise[_0x7b99('0x27')](_0xb89477);}return _0x59218f[_0x7b99('0x28')]();};}function saveUpdates(_0x880abd,_0xf1a8f8){return function(_0x4de756){if(_0x4de756){return _0x4de756['update'](_0x880abd)[_0x7b99('0x29')](function(_0x5b1b61){return _0x5b1b61;});}return null;};}function removeEntity(_0x17fc39,_0xe30a20){return function(_0x113155){if(_0x113155){return _0x113155['destroy']()[_0x7b99('0x29')](function(){_0x17fc39['status'](0xcc)[_0x7b99('0x1f')]();});}};}function handleEntityNotFound(_0x50168a,_0x36d379){return function(_0xbe1486){if(!_0xbe1486){_0x50168a[_0x7b99('0x1e')](0x194);}return _0xbe1486;};}function handleError(_0x322290,_0x5c0194){_0x5c0194=_0x5c0194||0x1f4;return function(_0x360c43){logger[_0x7b99('0x2a')](_0x360c43[_0x7b99('0x2b')]);if(_0x360c43['name']){delete _0x360c43['name'];}_0x322290['status'](_0x5c0194)['send'](_0x360c43);};}exports['sendUserNotification']=function(_0x4a6059,_0x3db12f,_0x2669ff){if(!_0x4a6059[_0x7b99('0x2c')][_0x7b99('0x2d')](_0x7b99('0x2e'))&&!_0x4a6059[_0x7b99('0x2c')][_0x7b99('0x2d')](_0x7b99('0x2f'))){throw new db[(_0x7b99('0x30'))]['ValidationError'](_0x7b99('0x31'));}else{if(_0x4a6059[_0x7b99('0x2c')]['hasOwnProperty']('TemplateId')&&!_0x4a6059[_0x7b99('0x2c')][_0x7b99('0x2d')](_0x7b99('0x32'))){throw new db[(_0x7b99('0x30'))][(_0x7b99('0x33'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x4a6059[_0x7b99('0x2c')]['hasOwnProperty'](_0x7b99('0x34'))){throw new db[(_0x7b99('0x30'))][(_0x7b99('0x33'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x3f82e7=JSON[_0x7b99('0x35')](_0x4a6059[_0x7b99('0x2c')][_0x7b99('0x34')]);}catch(_0x37eb89){logger[_0x7b99('0x2a')](_0x37eb89);throw new db[(_0x7b99('0x30'))][(_0x7b99('0x33'))](_0x7b99('0x36'));}var _0x55a7f1=['chatqueue',_0x7b99('0x37'),_0x7b99('0x38'),_0x7b99('0x39'),_0x7b99('0x3a'),_0x7b99('0x3b'),_0x7b99('0x3c'),'team','user'];if(_['some'](_0x3f82e7,function(_0x17ad31){return!_[_0x7b99('0x3d')](_0x55a7f1,_0x17ad31[_0x7b99('0x3e')]['toLowerCase']());})){throw new db[(_0x7b99('0x30'))][(_0x7b99('0x33'))](_0x7b99('0x3f'));}}}var _0x51e9ec={};_0x51e9ec[_0x7b99('0x40')]=_0x4a6059[_0x7b99('0x2c')][_0x7b99('0x2d')](_0x7b99('0x40'))?_0x4a6059[_0x7b99('0x2c')][_0x7b99('0x40')]:_0x4a6059[_0x7b99('0x41')][_0x7b99('0x42')];_0x51e9ec['recipientsDescription']=_[_0x7b99('0x43')](_0x4a6059[_0x7b99('0x2c')][_0x7b99('0x44')])?null:_0x4a6059[_0x7b99('0x2c')][_0x7b99('0x44')];_0x51e9ec[_0x7b99('0x45')]=_0x4a6059['body']['beep']||![];_0x51e9ec[_0x7b99('0x46')]=_0x4a6059[_0x7b99('0x41')]['id'];return getContent(_0x4a6059[_0x7b99('0x2c')])[_0x7b99('0x29')](function(_0x6a334e){_0x51e9ec[_0x7b99('0x2c')]=_0x6a334e;return getRecipients(_0x3f82e7);})[_0x7b99('0x29')](function(_0x1135b1){_0x51e9ec[_0x7b99('0x47')]=_[_0x7b99('0x48')](_0x1135b1)[_0x7b99('0x49')](',');return db[_0x7b99('0x4a')]['transaction'](function(_0x15102e){return db[_0x7b99('0x4b')][_0x7b99('0x4c')](_0x51e9ec,{'raw':!![],'transaction':_0x15102e})['then'](function(_0x5d59c2){var _0x168171={'sender':_0x51e9ec[_0x7b99('0x40')],'description':_0x51e9ec[_0x7b99('0x44')],'content':_0x51e9ec['body'],'beep':_0x51e9ec[_0x7b99('0x45')]};_0x1135b1[_0x7b99('0x4d')](function(_0x5113cb){_0x168171[_0x7b99('0x4e')]=_0x5113cb;socket[_0x7b99('0x4f')](_0x7b99('0x50'),_0x168171);});return _0x5d59c2;});});})['then'](respondWithResult(_0x3db12f,0xc9))[_0x7b99('0x51')](handleError(_0x3db12f,null));};function getContent(_0x2098c2){return new BPromise(function(_0xb4adad,_0x130121){if(_0x2098c2[_0x7b99('0x2e')]){_0xb4adad(_0x2098c2['text']);return;}return db[_0x7b99('0x52')]['findOne']({'attributes':[_0x7b99('0x53')],'where':{'id':_0x2098c2[_0x7b99('0x2f')]},'raw':!![]})[_0x7b99('0x29')](function(_0xb88413){if(!_0xb88413)throw new db[(_0x7b99('0x30'))][(_0x7b99('0x33'))](_0x7b99('0x54'));var _0x4d2bdc=Mustache[_0x7b99('0x55')](_0xb88413[_0x7b99('0x53')],_0x2098c2['view']);_0xb4adad(_0x4d2bdc);})['catch'](function(_0x36aebb){_0x130121(_0x36aebb);});});}function getRecipients(_0x24b1f0){return new BPromise(function(_0x330412,_0x41602d){var _0x15e983=[];var _0x2e926b=[];_0x24b1f0[_0x7b99('0x4d')](function(_0x2579b4){var _0x37d04e=_[_0x7b99('0x56')](_0x2579b4[_0x7b99('0x3e')][_0x7b99('0x57')]());if(_0x37d04e===_0x7b99('0x58')){_0x15e983=_[_0x7b99('0x59')](_0x15e983,_0x2579b4['ids']);}else{if(_[_0x7b99('0x3d')](_0x37d04e,'queue'))_0x37d04e=_0x37d04e[_0x7b99('0x5a')](_0x7b99('0x5b'),'Queue');_0x2579b4[_0x7b99('0x5c')][_0x7b99('0x4d')](function(_0x151604){_0x2e926b['push'](getAgents(_0x37d04e,_0x151604));});}});return BPromise[_0x7b99('0x5d')](_0x2e926b)[_0x7b99('0x29')](function(_0x2ca9a0){_0x15e983=_[_0x7b99('0x59')](_0x15e983,_[_0x7b99('0x5e')](_0x2ca9a0));_0x330412(_0x15e983);})[_0x7b99('0x51')](function(_0x11e750){_0x41602d(_0x11e750);});});}function getAgents(_0x5550bd,_0x1cf1aa){return new BPromise(function(_0x526ff6,_0x29a867){return db[_0x5550bd][_0x7b99('0x5f')]({'where':{'id':_0x1cf1aa}})[_0x7b99('0x29')](function(_0x1a1981){return _0x1a1981[_0x7b99('0x60')]({'attributes':['id'],'raw':!![]})[_0x7b99('0x29')](function(_0x626a56){var _0x313260=_[_0x7b99('0x61')](_0x626a56,'id');_0x526ff6(_0x313260);});})[_0x7b99('0x51')](function(_0x506d41){_0x29a867(_0x506d41);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index bde593a..3106bd4 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 _0x0e0f=['../../mysqldb','UserNotification','save','update','hasOwnProperty','hook','exports','events'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0x0e0f,0xd7));var _0xf0e0=function(_0x361630,_0x535450){_0x361630=_0x361630-0x0;var _0x61efd7=_0x0e0f[_0x361630];return _0x61efd7;};'use strict';var EventEmitter=require(_0xf0e0('0x0'));var UserNotification=require(_0xf0e0('0x1'))['db'][_0xf0e0('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf0e0('0x3'),'afterUpdate':_0xf0e0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1eab8f){return function(_0x30ed1c,_0x4e47a4,_0x558155){UserNotificationEvents['emit'](_0x1eab8f+':'+_0x30ed1c['id'],_0x30ed1c);UserNotificationEvents['emit'](_0x1eab8f,_0x30ed1c);_0x558155(null);};}for(var e in events){if(events[_0xf0e0('0x5')](e)){var event=events[e];UserNotification[_0xf0e0('0x6')](e,emitEvent(event));}}module[_0xf0e0('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x2337=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification'];(function(_0x44b09b,_0x115c7d){var _0x409f63=function(_0x5dc307){while(--_0x5dc307){_0x44b09b['push'](_0x44b09b['shift']());}};_0x409f63(++_0x115c7d);}(_0x2337,0x1bd));var _0x7233=function(_0x258143,_0x2c746a){_0x258143=_0x258143-0x0;var _0x24333f=_0x2337[_0x258143];return _0x24333f;};'use strict';var EventEmitter=require(_0x7233('0x0'));var UserNotification=require(_0x7233('0x1'))['db'][_0x7233('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x27e5e7){return function(_0x499c7c,_0x4c71c8,_0x12681f){UserNotificationEvents[_0x7233('0x3')](_0x27e5e7+':'+_0x499c7c['id'],_0x499c7c);UserNotificationEvents[_0x7233('0x3')](_0x27e5e7,_0x499c7c);_0x12681f(null);};}for(var e in events){if(events[_0x7233('0x4')](e)){var event=events[e];UserNotification[_0x7233('0x5')](e,emitEvent(event));}}module[_0x7233('0x6')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index e8c7619..f5f7fa6 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 _0xbe49=['api','moment','request-promise','path','rimraf','./userNotification.attributes','exports','define','UserNotification','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0xbe49,0x1b7));var _0x9be4=function(_0x5976a3,_0x50616e){_0x5976a3=_0x5976a3-0x0;var _0x3d8dfa=_0xbe49[_0x5976a3];return _0x3d8dfa;};'use strict';var _=require(_0x9be4('0x0'));var util=require(_0x9be4('0x1'));var logger=require(_0x9be4('0x2'))(_0x9be4('0x3'));var moment=require(_0x9be4('0x4'));var BPromise=require('bluebird');var rp=require(_0x9be4('0x5'));var fs=require('fs');var path=require(_0x9be4('0x6'));var rimraf=require(_0x9be4('0x7'));var config=require('../../config/environment');var attributes=require(_0x9be4('0x8'));module[_0x9be4('0x9')]=function(_0x1e536a,_0x8d453c){return _0x1e536a[_0x9be4('0xa')](_0x9be4('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9be4('0xc')});}; \ No newline at end of file +var _0xd89b=['../../config/environment','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x395981,_0x39be68){var _0x3b12c2=function(_0x27e513){while(--_0x27e513){_0x395981['push'](_0x395981['shift']());}};_0x3b12c2(++_0x39be68);}(_0xd89b,0xca));var _0xbd89=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xd89b[_0x49d41c];return _0xb64c5f;};'use strict';var _=require('lodash');var util=require(_0xbd89('0x0'));var logger=require(_0xbd89('0x1'))(_0xbd89('0x2'));var moment=require(_0xbd89('0x3'));var BPromise=require(_0xbd89('0x4'));var rp=require(_0xbd89('0x5'));var fs=require('fs');var path=require(_0xbd89('0x6'));var rimraf=require(_0xbd89('0x7'));var config=require(_0xbd89('0x8'));var attributes=require('./userNotification.attributes');module[_0xbd89('0x9')]=function(_0x51dde7,_0x585c10){return _0x51dde7['define'](_0xbd89('0xa'),attributes,{'tableName':_0xbd89('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd89('0xc'),'collate':_0xbd89('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d72ddf3..af72431 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 _0x5020=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x1ff68e,_0x51026b){var _0x6da642=function(_0x5a677f){while(--_0x5a677f){_0x1ff68e['push'](_0x1ff68e['shift']());}};_0x6da642(++_0x51026b);}(_0x5020,0x9f));var _0x0502=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5020[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x0502('0x0'));var moment=require(_0x0502('0x1'));var BPromise=require(_0x0502('0x2'));var rs=require(_0x0502('0x3'));var fs=require('fs');var Redis=require(_0x0502('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0502('0x5'))(_0x0502('0x6'));var config=require(_0x0502('0x7'));var jayson=require(_0x0502('0x8'));var client=jayson[_0x0502('0x9')][_0x0502('0xa')]({'port':0x232a});config[_0x0502('0xb')]=_['defaults'](config[_0x0502('0xb')],{'host':_0x0502('0xc'),'port':0x18eb});var socket=require(_0x0502('0xd'))(new Redis(config[_0x0502('0xb')]));require(_0x0502('0xe'))[_0x0502('0xf')](socket);function respondWithRpcPromise(_0x1a83c8,_0x1395cf,_0x2f0651){return new BPromise(function(_0xa8e4b2,_0x19f2f5){return client[_0x0502('0x10')](_0x1a83c8,_0x2f0651)['then'](function(_0x37b833){logger[_0x0502('0x11')](_0x0502('0x12'),_0x1395cf,'request\x20sent');logger[_0x0502('0x13')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x1395cf,_0x0502('0x14'),JSON['stringify'](_0x37b833));if(_0x37b833[_0x0502('0x15')]){if(_0x37b833[_0x0502('0x15')][_0x0502('0x16')]===0x1f4){logger[_0x0502('0x15')]('UserNotification,\x20%s,\x20%s',_0x1395cf,_0x37b833[_0x0502('0x15')][_0x0502('0x17')]);return _0x19f2f5(_0x37b833[_0x0502('0x15')][_0x0502('0x17')]);}logger[_0x0502('0x15')](_0x0502('0x12'),_0x1395cf,_0x37b833[_0x0502('0x15')]['message']);return _0xa8e4b2(_0x37b833[_0x0502('0x15')][_0x0502('0x17')]);}else{logger[_0x0502('0x11')](_0x0502('0x12'),_0x1395cf,'request\x20sent');_0xa8e4b2(_0x37b833[_0x0502('0x18')][_0x0502('0x17')]);}})[_0x0502('0x19')](function(_0x55d8ff){logger['error']('UserNotification,\x20%s,\x20%s',_0x1395cf,_0x55d8ff);_0x19f2f5(_0x55d8ff);});});} \ No newline at end of file +var _0x61b9=['redis','defaults','localhost','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4ff8ca,_0x1189cc){var _0x429640=function(_0x232feb){while(--_0x232feb){_0x4ff8ca['push'](_0x4ff8ca['shift']());}};_0x429640(++_0x1189cc);}(_0x61b9,0x97));var _0x961b=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0x61b9[_0x368bba];return _0x409f8f;};'use strict';var _=require(_0x961b('0x0'));var util=require(_0x961b('0x1'));var moment=require(_0x961b('0x2'));var BPromise=require(_0x961b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x961b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x961b('0x5'));var logger=require(_0x961b('0x6'))(_0x961b('0x7'));var config=require(_0x961b('0x8'));var jayson=require(_0x961b('0x9'));var client=jayson['client'][_0x961b('0xa')]({'port':0x232a});config[_0x961b('0xb')]=_[_0x961b('0xc')](config[_0x961b('0xb')],{'host':_0x961b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x961b('0xb')]));require(_0x961b('0xe'))[_0x961b('0xf')](socket);function respondWithRpcPromise(_0xa0e105,_0x2d5668,_0x1bb07c){return new BPromise(function(_0x2156b7,_0xd8b9cd){return client[_0x961b('0x10')](_0xa0e105,_0x1bb07c)['then'](function(_0x3319e2){logger[_0x961b('0x11')](_0x961b('0x12'),_0x2d5668,_0x961b('0x13'));logger[_0x961b('0x14')](_0x961b('0x15'),_0x2d5668,_0x961b('0x13'),JSON[_0x961b('0x16')](_0x3319e2));if(_0x3319e2[_0x961b('0x17')]){if(_0x3319e2[_0x961b('0x17')][_0x961b('0x18')]===0x1f4){logger[_0x961b('0x17')]('UserNotification,\x20%s,\x20%s',_0x2d5668,_0x3319e2['error'][_0x961b('0x19')]);return _0xd8b9cd(_0x3319e2[_0x961b('0x17')]['message']);}logger[_0x961b('0x17')](_0x961b('0x12'),_0x2d5668,_0x3319e2['error'][_0x961b('0x19')]);return _0x2156b7(_0x3319e2[_0x961b('0x17')][_0x961b('0x19')]);}else{logger[_0x961b('0x11')]('UserNotification,\x20%s,\x20%s',_0x2d5668,_0x961b('0x13'));_0x2156b7(_0x3319e2[_0x961b('0x1a')][_0x961b('0x19')]);}})['catch'](function(_0xf687ff){logger[_0x961b('0x17')](_0x961b('0x12'),_0x2d5668,_0xf687ff);_0xd8b9cd(_0xf687ff);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 3083a62..20c88b7 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 _0xf43e=['register','length','./userNotification.events','save','remove','removeListener'];(function(_0x3941d4,_0x445e2f){var _0x42e507=function(_0x50a584){while(--_0x50a584){_0x3941d4['push'](_0x3941d4['shift']());}};_0x42e507(++_0x445e2f);}(_0xf43e,0xf8));var _0xef43=function(_0x360bc4,_0x38f1){_0x360bc4=_0x360bc4-0x0;var _0x327a89=_0xf43e[_0x360bc4];return _0x327a89;};'use strict';var UserNotificationEvents=require(_0xef43('0x0'));var events=[_0xef43('0x1'),_0xef43('0x2'),'update'];function createListener(_0x2139b5,_0x3011be){return function(_0x38316a){_0x3011be['emit'](_0x2139b5,_0x38316a);};}function removeListener(_0x2abd48,_0x40f3e4){return function(){UserNotificationEvents[_0xef43('0x3')](_0x2abd48,_0x40f3e4);};}exports[_0xef43('0x4')]=function(_0x13481c){for(var _0x1686db=0x0,_0x3113f2=events[_0xef43('0x5')];_0x1686db<_0x3113f2;_0x1686db++){var _0x35c00c=events[_0x1686db];var _0x2951ce=createListener('userNotification:'+_0x35c00c,_0x13481c);UserNotificationEvents['on'](_0x35c00c,_0x2951ce);}}; \ No newline at end of file +var _0xceaf=['update','emit','removeListener','register','length','userNotification:','save','remove'];(function(_0x86913b,_0x508334){var _0xf5de10=function(_0x176eef){while(--_0x176eef){_0x86913b['push'](_0x86913b['shift']());}};_0xf5de10(++_0x508334);}(_0xceaf,0x10e));var _0xfcea=function(_0x4d2fc9,_0xf5aaaf){_0x4d2fc9=_0x4d2fc9-0x0;var _0x49922b=_0xceaf[_0x4d2fc9];return _0x49922b;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xfcea('0x0'),_0xfcea('0x1'),_0xfcea('0x2')];function createListener(_0x5293ab,_0x4ccd50){return function(_0x358260){_0x4ccd50[_0xfcea('0x3')](_0x5293ab,_0x358260);};}function removeListener(_0x16f568,_0x25c39a){return function(){UserNotificationEvents[_0xfcea('0x4')](_0x16f568,_0x25c39a);};}exports[_0xfcea('0x5')]=function(_0x2c8596){for(var _0x146eaa=0x0,_0x567171=events[_0xfcea('0x6')];_0x146eaa<_0x567171;_0x146eaa++){var _0x479bf0=events[_0x146eaa];var _0x5cd035=createListener(_0xfcea('0x7')+_0x479bf0,_0x2c8596);UserNotificationEvents['on'](_0x479bf0,_0x5cd035);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d4d761a..003a173 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x343857,_0x951b15){var _0x392e37=function(_0x2d555e){while(--_0x2d555e){_0x343857['push'](_0x343857['shift']());}};_0x392e37(++_0x951b15);}(_0xedd9,0xfc));var _0x9edd=function(_0x2c33f4,_0x25ece0){_0x2c33f4=_0x2c33f4-0x0;var _0x51023=_0xedd9[_0x2c33f4];return _0x51023;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x80868c,_0x3b4ce5){var _0x417aa2=function(_0x673dfa){while(--_0x673dfa){_0x80868c['push'](_0x80868c['shift']());}};_0x417aa2(++_0x3b4ce5);}(_0x70e0,0x17b));var _0x070e=function(_0x2f3028,_0x318a4d){_0x2f3028=_0x2f3028-0x0;var _0x4d2af4=_0x70e0[_0x2f3028];return _0x4d2af4;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 2c1314f..308647b 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 _0x5bb8=['exports','INTEGER','sequelize'];(function(_0x34b167,_0x87c65e){var _0x2f9831=function(_0x46252f){while(--_0x46252f){_0x34b167['push'](_0x34b167['shift']());}};_0x2f9831(++_0x87c65e);}(_0x5bb8,0x158));var _0x85bb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5bb8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x85bb('0x0'));module[_0x85bb('0x1')]={'penalty':{'type':Sequelize[_0x85bb('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x83cc=['INTEGER','sequelize','exports'];(function(_0x4b693e,_0x3a0439){var _0x36ffba=function(_0x160a95){while(--_0x160a95){_0x4b693e['push'](_0x4b693e['shift']());}};_0x36ffba(++_0x3a0439);}(_0x83cc,0x115));var _0xc83c=function(_0x21125f,_0x8079f8){_0x21125f=_0x21125f-0x0;var _0x2f421d=_0x83cc[_0x21125f];return _0x2f421d;};'use strict';var Sequelize=require(_0xc83c('0x0'));module[_0xc83c('0x1')]={'penalty':{'type':Sequelize[_0xc83c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index eb16243..3e20311 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 _0x7026=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues'];(function(_0x72ad36,_0x4c4898){var _0x41926f=function(_0xbb9691){while(--_0xbb9691){_0x72ad36['push'](_0x72ad36['shift']());}};_0x41926f(++_0x4c4898);}(_0x7026,0x18c));var _0x6702=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7026[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6702('0x0'))(_0x6702('0x1'));var moment=require(_0x6702('0x2'));var BPromise=require(_0x6702('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6702('0x4'));var rimraf=require(_0x6702('0x5'));var config=require(_0x6702('0x6'));var attributes=require(_0x6702('0x7'));module[_0x6702('0x8')]=function(_0x29eca6,_0x3884a5){return _0x29eca6[_0x6702('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0x6702('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1e1=['api','moment','bluebird','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger'];(function(_0x44f659,_0xdf6c9d){var _0xf2ff59=function(_0x2d96a4){while(--_0x2d96a4){_0x44f659['push'](_0x44f659['shift']());}};_0xf2ff59(++_0xdf6c9d);}(_0xc1e1,0x166));var _0x1c1e=function(_0x24a0c2,_0xf21f49){_0x24a0c2=_0x24a0c2-0x0;var _0x377992=_0xc1e1[_0x24a0c2];return _0x377992;};'use strict';var _=require('lodash');var util=require(_0x1c1e('0x0'));var logger=require(_0x1c1e('0x1'))(_0x1c1e('0x2'));var moment=require(_0x1c1e('0x3'));var BPromise=require(_0x1c1e('0x4'));var rp=require(_0x1c1e('0x5'));var fs=require('fs');var path=require(_0x1c1e('0x6'));var rimraf=require('rimraf');var config=require(_0x1c1e('0x7'));var attributes=require(_0x1c1e('0x8'));module['exports']=function(_0x3216d5,_0x3e8f76){return _0x3216d5[_0x1c1e('0x9')](_0x1c1e('0xa'),attributes,{'tableName':_0x1c1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 5d4edf0..5925249 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 _0xbf1a=['stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x508f50,_0x1c557c){var _0x3aab22=function(_0x316e63){while(--_0x316e63){_0x508f50['push'](_0x508f50['shift']());}};_0x3aab22(++_0x1c557c);}(_0xbf1a,0x1a4));var _0xabf1=function(_0x493bd0,_0x1960e7){_0x493bd0=_0x493bd0-0x0;var _0x47c5d3=_0xbf1a[_0x493bd0];return _0x47c5d3;};'use strict';var _=require(_0xabf1('0x0'));var util=require('util');var moment=require(_0xabf1('0x1'));var BPromise=require(_0xabf1('0x2'));var rs=require(_0xabf1('0x3'));var fs=require('fs');var Redis=require(_0xabf1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xabf1('0x5'));var logger=require(_0xabf1('0x6'))(_0xabf1('0x7'));var config=require(_0xabf1('0x8'));var jayson=require(_0xabf1('0x9'));var client=jayson['client'][_0xabf1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c842e,_0x277283,_0x2e513d){return new BPromise(function(_0x2c05f4,_0x466fa3){return client[_0xabf1('0xb')](_0x2c842e,_0x2e513d)[_0xabf1('0xc')](function(_0x409ca0){logger['info'](_0xabf1('0xd'),_0x277283,_0xabf1('0xe'));logger[_0xabf1('0xf')](_0xabf1('0x10'),_0x277283,_0xabf1('0xe'),JSON[_0xabf1('0x11')](_0x409ca0));if(_0x409ca0[_0xabf1('0x12')]){if(_0x409ca0[_0xabf1('0x12')]['code']===0x1f4){logger[_0xabf1('0x12')](_0xabf1('0xd'),_0x277283,_0x409ca0['error'][_0xabf1('0x13')]);return _0x466fa3(_0x409ca0['error'][_0xabf1('0x13')]);}logger[_0xabf1('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x277283,_0x409ca0[_0xabf1('0x12')][_0xabf1('0x13')]);return _0x2c05f4(_0x409ca0[_0xabf1('0x12')][_0xabf1('0x13')]);}else{logger[_0xabf1('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x277283,_0xabf1('0xe'));_0x2c05f4(_0x409ca0[_0xabf1('0x15')][_0xabf1('0x13')]);}})[_0xabf1('0x16')](function(_0x2447cb){logger['error'](_0xabf1('0xd'),_0x277283,_0x2447cb);_0x466fa3(_0x2447cb);});});} \ No newline at end of file +var _0x9e9c=['http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x9e9c,0x188));var _0xc9e9=function(_0x2f54b6,_0x3cc6cb){_0x2f54b6=_0x2f54b6-0x0;var _0x169f21=_0x9e9c[_0x2f54b6];return _0x169f21;};'use strict';var _=require(_0xc9e9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc9e9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc9e9('0x2'));var logger=require(_0xc9e9('0x3'))(_0xc9e9('0x4'));var config=require(_0xc9e9('0x5'));var jayson=require(_0xc9e9('0x6'));var client=jayson['client'][_0xc9e9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d1c5e,_0x3cb264,_0x58642c){return new BPromise(function(_0x2f4494,_0x5cce2f){return client[_0xc9e9('0x8')](_0x4d1c5e,_0x58642c)[_0xc9e9('0x9')](function(_0x1377bd){logger[_0xc9e9('0xa')](_0xc9e9('0xb'),_0x3cb264,'request\x20sent');logger[_0xc9e9('0xc')](_0xc9e9('0xd'),_0x3cb264,_0xc9e9('0xe'),JSON[_0xc9e9('0xf')](_0x1377bd));if(_0x1377bd[_0xc9e9('0x10')]){if(_0x1377bd[_0xc9e9('0x10')]['code']===0x1f4){logger[_0xc9e9('0x10')](_0xc9e9('0xb'),_0x3cb264,_0x1377bd[_0xc9e9('0x10')][_0xc9e9('0x11')]);return _0x5cce2f(_0x1377bd[_0xc9e9('0x10')][_0xc9e9('0x11')]);}logger[_0xc9e9('0x10')](_0xc9e9('0xb'),_0x3cb264,_0x1377bd[_0xc9e9('0x10')][_0xc9e9('0x11')]);return _0x2f4494(_0x1377bd['error'][_0xc9e9('0x11')]);}else{logger[_0xc9e9('0xa')](_0xc9e9('0xb'),_0x3cb264,_0xc9e9('0xe'));_0x2f4494(_0x1377bd['result'][_0xc9e9('0x11')]);}})[_0xc9e9('0x12')](function(_0x19b1b7){logger['error'](_0xc9e9('0xb'),_0x3cb264,_0x19b1b7);_0x5cce2f(_0x19b1b7);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 6b7240c..7f13a6f 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 _0xfd61=['/:id/resources','create','post','/:id/clone','clone','addResources','put','update','delete','destroy','/:id/sections','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','getSections'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfd61,0x176));var _0x1fd6=function(_0x339f54,_0x3ff67e){_0x339f54=_0x339f54-0x0;var _0x23bb0a=_0xfd61[_0x339f54];return _0x23bb0a;};'use strict';var multer=require(_0x1fd6('0x0'));var util=require(_0x1fd6('0x1'));var path=require(_0x1fd6('0x2'));var timeout=require(_0x1fd6('0x3'));var express=require(_0x1fd6('0x4'));var router=express[_0x1fd6('0x5')]();var fs_extra=require(_0x1fd6('0x6'));var auth=require(_0x1fd6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1fd6('0x8'));var controller=require(_0x1fd6('0x9'));router[_0x1fd6('0xa')]('/',auth[_0x1fd6('0xb')](),controller['index']);router[_0x1fd6('0xa')](_0x1fd6('0xc'),auth[_0x1fd6('0xb')](),controller[_0x1fd6('0xd')]);router[_0x1fd6('0xa')](_0x1fd6('0xe'),auth[_0x1fd6('0xb')](),controller['show']);router['get']('/:id/sections',auth['isAuthenticated'](),controller[_0x1fd6('0xf')]);router[_0x1fd6('0xa')](_0x1fd6('0x10'),auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0x1fd6('0xb')](),controller[_0x1fd6('0x11')]);router[_0x1fd6('0x12')](_0x1fd6('0x13'),auth[_0x1fd6('0xb')](),controller[_0x1fd6('0x14')]);router[_0x1fd6('0x12')]('/:id/sections',auth[_0x1fd6('0xb')](),controller['addSections']);router[_0x1fd6('0x12')](_0x1fd6('0x10'),auth[_0x1fd6('0xb')](),controller[_0x1fd6('0x15')]);router[_0x1fd6('0x16')](_0x1fd6('0xe'),auth[_0x1fd6('0xb')](),controller[_0x1fd6('0x17')]);router[_0x1fd6('0x18')](_0x1fd6('0xe'),auth[_0x1fd6('0xb')](),controller[_0x1fd6('0x19')]);router[_0x1fd6('0x18')](_0x1fd6('0x1a'),auth[_0x1fd6('0xb')](),controller[_0x1fd6('0x1b')]);router['delete']('/:id/resources',auth[_0x1fd6('0xb')](),controller[_0x1fd6('0x1c')]);module[_0x1fd6('0x1d')]=router; \ No newline at end of file +var _0x6ff1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','create','/:id/clone','clone','post','addSections','addResources','put','update','delete','removeSections','removeResources','exports','multer','util','path','express'];(function(_0x63ef61,_0x337aae){var _0x4d9caf=function(_0xdc17e3){while(--_0xdc17e3){_0x63ef61['push'](_0x63ef61['shift']());}};_0x4d9caf(++_0x337aae);}(_0x6ff1,0x18f));var _0x16ff=function(_0x3288dd,_0x47e8d9){_0x3288dd=_0x3288dd-0x0;var _0x57ab27=_0x6ff1[_0x3288dd];return _0x57ab27;};'use strict';var multer=require(_0x16ff('0x0'));var util=require(_0x16ff('0x1'));var path=require(_0x16ff('0x2'));var timeout=require('connect-timeout');var express=require(_0x16ff('0x3'));var router=express[_0x16ff('0x4')]();var fs_extra=require(_0x16ff('0x5'));var auth=require(_0x16ff('0x6'));var interaction=require(_0x16ff('0x7'));var config=require(_0x16ff('0x8'));var controller=require('./userProfile.controller');router[_0x16ff('0x9')]('/',auth[_0x16ff('0xa')](),controller[_0x16ff('0xb')]);router[_0x16ff('0x9')](_0x16ff('0xc'),auth[_0x16ff('0xa')](),controller['describe']);router[_0x16ff('0x9')](_0x16ff('0xd'),auth['isAuthenticated'](),controller[_0x16ff('0xe')]);router[_0x16ff('0x9')](_0x16ff('0xf'),auth[_0x16ff('0xa')](),controller[_0x16ff('0x10')]);router['get'](_0x16ff('0x11'),auth[_0x16ff('0xa')](),controller[_0x16ff('0x12')]);router['post']('/',auth[_0x16ff('0xa')](),controller[_0x16ff('0x13')]);router['post'](_0x16ff('0x14'),auth[_0x16ff('0xa')](),controller[_0x16ff('0x15')]);router[_0x16ff('0x16')](_0x16ff('0xf'),auth['isAuthenticated'](),controller[_0x16ff('0x17')]);router[_0x16ff('0x16')](_0x16ff('0x11'),auth[_0x16ff('0xa')](),controller[_0x16ff('0x18')]);router[_0x16ff('0x19')](_0x16ff('0xd'),auth['isAuthenticated'](),controller[_0x16ff('0x1a')]);router[_0x16ff('0x1b')]('/:id',auth[_0x16ff('0xa')](),controller['destroy']);router['delete'](_0x16ff('0xf'),auth[_0x16ff('0xa')](),controller[_0x16ff('0x1c')]);router[_0x16ff('0x1b')]('/:id/resources',auth[_0x16ff('0xa')](),controller[_0x16ff('0x1d')]);module[_0x16ff('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 2482e1f..30150f5 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 _0x2796=['getDataValue','split','BOOLEAN','sequelize','STRING','crudPermissions','join'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2796,0x106));var _0x6279=function(_0x71ea77,_0x3ee3e){_0x71ea77=_0x71ea77-0x0;var _0x43a078=_0x2796[_0x71ea77];return _0x43a078;};'use strict';var Sequelize=require(_0x6279('0x0'));module['exports']={'name':{'type':Sequelize[_0x6279('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x6279('0x1')],'set':function(_0x5ebc67){this['setDataValue'](_0x6279('0x2'),_0x5ebc67?_0x5ebc67[_0x6279('0x3')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x6279('0x4')]('crudPermissions')[_0x6279('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x6279('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x6279('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x6279('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x6279('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x6279('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6279('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x6279('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x0622=['getDataValue','BOOLEAN','sequelize','exports','STRING','setDataValue','crudPermissions'];(function(_0x278a76,_0x4a3538){var _0xa98163=function(_0x192420){while(--_0x192420){_0x278a76['push'](_0x278a76['shift']());}};_0xa98163(++_0x4a3538);}(_0x0622,0xb8));var _0x2062=function(_0x4f72d8,_0x470fd7){_0x4f72d8=_0x4f72d8-0x0;var _0x44ef7a=_0x0622[_0x4f72d8];return _0x44ef7a;};'use strict';var Sequelize=require(_0x2062('0x0'));module[_0x2062('0x1')]={'name':{'type':Sequelize[_0x2062('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x2062('0x2')],'set':function(_0x17a6b2){this[_0x2062('0x3')](_0x2062('0x4'),_0x17a6b2?_0x17a6b2['join'](''):[]);},'get':function(){return this[_0x2062('0x5')](_0x2062('0x4'))?this['getDataValue'](_0x2062('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2062('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2062('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2062('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2062('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2062('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2062('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2062('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index b2a143f..374b5ab 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 _0xd532=['Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','nolimit','limit','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','update','then','destroy','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','clone','length','get','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','sectionId','Resources','UserProfileResource','describe','addSections','userProfileId','removeSections','ids','includes','isEmpty','enabled','subsections','concat','findOne','Dashboard','forEach','push','resourceId'];(function(_0x288124,_0x43d146){var _0x40e990=function(_0x27525){while(--_0x27525){_0x288124['push'](_0x288124['shift']());}};_0x40e990(++_0x43d146);}(_0xd532,0x80));var _0x2d53=function(_0x1c8d08,_0x2c11b4){_0x1c8d08=_0x1c8d08-0x0;var _0x74a0c9=_0xd532[_0x1c8d08];return _0x74a0c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d53('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d53('0x1'));var rp=require('request-promise');var moment=require(_0x2d53('0x2'));var BPromise=require(_0x2d53('0x3'));var Mustache=require(_0x2d53('0x4'));var util=require(_0x2d53('0x5'));var path=require(_0x2d53('0x6'));var sox=require(_0x2d53('0x7'));var csv=require('to-csv');var ejs=require(_0x2d53('0x8'));var fs=require('fs');var fs_extra=require(_0x2d53('0x9'));var _=require(_0x2d53('0xa'));var squel=require(_0x2d53('0xb'));var crypto=require(_0x2d53('0xc'));var jsforce=require(_0x2d53('0xd'));var deskjs=require(_0x2d53('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2d53('0xf'));var Papa=require(_0x2d53('0x10'));var Redis=require(_0x2d53('0x11'));var authService=require(_0x2d53('0x12'));var qs=require(_0x2d53('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d53('0x14'));var logger=require(_0x2d53('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2d53('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d53('0x17'))['db'];config[_0x2d53('0x18')]=_[_0x2d53('0x19')](config[_0x2d53('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d53('0x1a'))(new Redis(config['redis']));require(_0x2d53('0x1b'))[_0x2d53('0x1c')](socket);function respondWithStatusCode(_0x59ec82,_0x1c69fd){_0x1c69fd=_0x1c69fd||0xcc;return function(_0x5cf3c7){if(_0x5cf3c7){return _0x59ec82[_0x2d53('0x1d')](_0x1c69fd);}return _0x59ec82[_0x2d53('0x1e')](_0x1c69fd)[_0x2d53('0x1f')]();};}function respondWithResult(_0x56e4b0,_0x3e9405){_0x3e9405=_0x3e9405||0xc8;return function(_0x267a8b){if(_0x267a8b){return _0x56e4b0[_0x2d53('0x1e')](_0x3e9405)[_0x2d53('0x20')](_0x267a8b);}};}function respondWithFilteredResult(_0x463dc9,_0x4d3ce9){return function(_0x303298){if(_0x303298){var _0x5429d6=typeof _0x4d3ce9[_0x2d53('0x21')]===_0x2d53('0x22')&&typeof _0x4d3ce9['limit']===_0x2d53('0x22');var _0x5f110d=_0x303298[_0x2d53('0x23')];var _0x3ed50e=_0x5429d6?0x0:_0x4d3ce9[_0x2d53('0x21')];var _0x3fb66e=_0x5429d6?_0x303298[_0x2d53('0x23')]:_0x4d3ce9[_0x2d53('0x21')]+_0x4d3ce9['limit'];var _0x17c463;if(_0x3fb66e>=_0x5f110d){_0x3fb66e=_0x5f110d;_0x17c463=0xc8;}else{_0x17c463=0xce;}_0x463dc9[_0x2d53('0x1e')](_0x17c463);return _0x463dc9[_0x2d53('0x24')]('Content-Range',_0x3ed50e+'-'+_0x3fb66e+'/'+_0x5f110d)[_0x2d53('0x20')](_0x303298);}return null;};}function patchUpdates(_0x47d3eb){return function(_0x37431d){try{jsonpatch[_0x2d53('0x25')](_0x37431d,_0x47d3eb,!![]);}catch(_0x3e620f){return BPromise[_0x2d53('0x26')](_0x3e620f);}return _0x37431d['save']();};}function saveUpdates(_0x35d207,_0x57a633){return function(_0x1094b5){if(_0x1094b5){return _0x1094b5[_0x2d53('0x27')](_0x35d207)[_0x2d53('0x28')](function(_0x4dd6f9){return _0x4dd6f9;});}return null;};}function removeEntity(_0x2c65b5,_0x13a5f4){return function(_0x39a60e){if(_0x39a60e){return _0x39a60e[_0x2d53('0x29')]()[_0x2d53('0x28')](function(){_0x2c65b5['status'](0xcc)[_0x2d53('0x1f')]();});}};}function handleEntityNotFound(_0x433976,_0x497005){return function(_0xfc536){if(!_0xfc536){_0x433976[_0x2d53('0x1d')](0x194);}return _0xfc536;};}function handleError(_0x4b6831,_0x214b80){_0x214b80=_0x214b80||0x1f4;return function(_0x27a9aa){logger['error'](_0x27a9aa[_0x2d53('0x2a')]);if(_0x27a9aa[_0x2d53('0x2b')]){delete _0x27a9aa[_0x2d53('0x2b')];}_0x4b6831[_0x2d53('0x1e')](_0x214b80)[_0x2d53('0x2c')](_0x27a9aa);};}exports[_0x2d53('0x2d')]=function(_0x130a90,_0x231a6a){var _0x51a258={},_0x580de1={},_0x184655={'count':0x0,'rows':[]};var _0x37c4aa=_['map'](db[_0x2d53('0x2e')][_0x2d53('0x2f')],function(_0x266faf){return{'name':_0x266faf[_0x2d53('0x30')],'type':_0x266faf[_0x2d53('0x31')][_0x2d53('0x32')]};});_0x580de1[_0x2d53('0x33')]=_[_0x2d53('0x34')](_0x37c4aa,_0x2d53('0x2b'));_0x580de1[_0x2d53('0x35')]=_[_0x2d53('0x36')](_0x130a90[_0x2d53('0x35')]);_0x580de1['filters']=_[_0x2d53('0x37')](_0x580de1[_0x2d53('0x33')],_0x580de1[_0x2d53('0x35')]);_0x51a258[_0x2d53('0x38')]=_[_0x2d53('0x37')](_0x580de1[_0x2d53('0x33')],qs[_0x2d53('0x39')](_0x130a90[_0x2d53('0x35')][_0x2d53('0x39')]));_0x51a258[_0x2d53('0x38')]=_0x51a258[_0x2d53('0x38')]['length']?_0x51a258[_0x2d53('0x38')]:_0x580de1[_0x2d53('0x33')];if(!_0x130a90[_0x2d53('0x35')]['hasOwnProperty']('nolimit')){_0x51a258['limit']=qs['limit'](_0x130a90[_0x2d53('0x35')]['limit']);_0x51a258[_0x2d53('0x21')]=qs[_0x2d53('0x21')](_0x130a90[_0x2d53('0x35')][_0x2d53('0x21')]);}_0x51a258[_0x2d53('0x3a')]=qs['sort'](_0x130a90[_0x2d53('0x35')]['sort']);_0x51a258[_0x2d53('0x3b')]=qs['filters'](_[_0x2d53('0x3c')](_0x130a90[_0x2d53('0x35')],_0x580de1['filters']),_0x37c4aa);if(_0x130a90[_0x2d53('0x35')]['filter']){_0x51a258[_0x2d53('0x3b')]=_[_0x2d53('0x3d')](_0x51a258[_0x2d53('0x3b')],{'$or':_['map'](_0x37c4aa,function(_0x29ba10){if(_0x29ba10[_0x2d53('0x31')]!==_0x2d53('0x3e')){var _0x19ca7a={};_0x19ca7a[_0x29ba10['name']]={'$like':'%'+_0x130a90[_0x2d53('0x35')][_0x2d53('0x3f')]+'%'};return _0x19ca7a;}})});}_0x51a258=_[_0x2d53('0x3d')]({},_0x51a258,_0x130a90[_0x2d53('0x40')]);var _0xdd5624={'where':_0x51a258[_0x2d53('0x3b')]};return db['UserProfile'][_0x2d53('0x23')](_0xdd5624)['then'](function(_0xaced9d){_0x184655[_0x2d53('0x23')]=_0xaced9d;if(_0x130a90[_0x2d53('0x35')][_0x2d53('0x41')]){_0x51a258[_0x2d53('0x42')]=[{'all':!![]}];}return db[_0x2d53('0x2e')][_0x2d53('0x43')](_0x51a258);})[_0x2d53('0x28')](function(_0x159586){_0x184655[_0x2d53('0x44')]=_0x159586;return _0x184655;})[_0x2d53('0x28')](respondWithFilteredResult(_0x231a6a,_0x51a258))[_0x2d53('0x45')](handleError(_0x231a6a,null));};exports[_0x2d53('0x46')]=function(_0x37e3d9,_0x456bdc){var _0x33bf55={'raw':![],'where':{'id':_0x37e3d9[_0x2d53('0x47')]['id']}},_0x303a6b={};_0x303a6b[_0x2d53('0x33')]=_['keys'](db[_0x2d53('0x2e')][_0x2d53('0x2f')]);_0x303a6b[_0x2d53('0x35')]=_[_0x2d53('0x36')](_0x37e3d9[_0x2d53('0x35')]);_0x303a6b[_0x2d53('0x48')]=_[_0x2d53('0x37')](_0x303a6b[_0x2d53('0x33')],_0x303a6b[_0x2d53('0x35')]);_0x33bf55['attributes']=_[_0x2d53('0x37')](_0x303a6b[_0x2d53('0x33')],qs[_0x2d53('0x39')](_0x37e3d9[_0x2d53('0x35')][_0x2d53('0x39')]));_0x33bf55[_0x2d53('0x38')]=_0x33bf55[_0x2d53('0x38')]['length']?_0x33bf55[_0x2d53('0x38')]:_0x303a6b[_0x2d53('0x33')];if(_0x37e3d9[_0x2d53('0x35')][_0x2d53('0x41')]){_0x33bf55[_0x2d53('0x42')]=[{'all':!![]}];}_0x33bf55=_['merge']({},_0x33bf55,_0x37e3d9['options']);return db[_0x2d53('0x2e')][_0x2d53('0x49')](_0x33bf55)[_0x2d53('0x28')](handleEntityNotFound(_0x456bdc,null))[_0x2d53('0x28')](respondWithResult(_0x456bdc,null))[_0x2d53('0x45')](handleError(_0x456bdc,null));};exports[_0x2d53('0x4a')]=function(_0x5528c8,_0x27d571){return db[_0x2d53('0x2e')][_0x2d53('0x4a')](_0x5528c8[_0x2d53('0x4b')],{})[_0x2d53('0x28')](respondWithResult(_0x27d571,0xc9))[_0x2d53('0x45')](handleError(_0x27d571,null));};exports[_0x2d53('0x4c')]=function(_0x2117a7,_0x59d93){var _0x18da8f={'where':{'id':_0x2117a7[_0x2d53('0x47')]['id']}},_0x407ee3={};_0x407ee3[_0x2d53('0x33')]=_['keys'](db['UserProfile'][_0x2d53('0x2f')]);_0x18da8f['attributes']=_[_0x2d53('0x37')](_0x407ee3['model'],qs[_0x2d53('0x39')](_0x2117a7[_0x2d53('0x35')]['fields']));_0x18da8f['attributes']=_0x18da8f[_0x2d53('0x38')][_0x2d53('0x4d')]?_0x18da8f[_0x2d53('0x38')]:_0x407ee3[_0x2d53('0x33')];if(_0x2117a7[_0x2d53('0x35')][_0x2d53('0x41')]){_0x18da8f[_0x2d53('0x42')]=[{'all':!![]}];}_0x18da8f=_['merge']({},_0x18da8f,_0x2117a7[_0x2d53('0x40')]);return db[_0x2d53('0x2e')][_0x2d53('0x49')](_0x18da8f)[_0x2d53('0x28')](handleEntityNotFound(_0x59d93,null))[_0x2d53('0x28')](function(_0x1317c1){if(_0x1317c1){var _0xfa46ac=_0x1317c1[_0x2d53('0x4e')]({'plain':!![]});_0xfa46ac=qs[_0x2d53('0x4f')](_0xfa46ac,['id',_0x2d53('0x50'),'updatedAt',_0x2d53('0x51')]);_0x2117a7[_0x2d53('0x4b')]=_['omit'](_0x2117a7['body'],['id',_0x2d53('0x50'),_0x2d53('0x52')]);return db[_0x2d53('0x53')][_0x2d53('0x54')](function(_0x361563){return db[_0x2d53('0x2e')][_0x2d53('0x4a')](_['merge'](_0xfa46ac,_0x2117a7['body']),{'include':_0x2117a7[_0x2d53('0x35')][_0x2d53('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x361563})[_0x2d53('0x28')](function(_0x4e6bb3){var _0x2c7ced=_0x4e6bb3[_0x2d53('0x4e')]({'plain':!![]});return db[_0x2d53('0x55')][_0x2d53('0x43')]({'where':{'userProfileId':_0x2117a7[_0x2d53('0x47')]['id']},'raw':!![]})[_0x2d53('0x28')](function(_0x59bb2d){if(_0x59bb2d){return BPromise[_0x2d53('0x56')](_0x59bb2d,function(_0x11f03f){return new BPromise(function(_0x408754,_0x4d7f95){if(_0x11f03f[_0x2d53('0x57')]===null||_0x11f03f['autoAssociation']===0x1)_0x408754(null);return db['UserProfileResource'][_0x2d53('0x43')]({'where':{'sectionId':_0x11f03f['id']},'raw':!![]})[_0x2d53('0x28')](function(_0x3b8350){var _0x99a617=_[_0x2d53('0x34')](_0x3b8350,function(_0x470e14){return qs[_0x2d53('0x4f')](_0x470e14,['id',_0x2d53('0x50'),_0x2d53('0x52'),_0x2d53('0x58')]);});_0x408754(_0x99a617);})[_0x2d53('0x45')](function(_0x58867d){_0x4d7f95(_0x58867d);});})[_0x2d53('0x28')](function(_0x5d7bab){var _0x2ac0dd=qs[_0x2d53('0x4f')](_0x11f03f,['id',_0x2d53('0x50'),_0x2d53('0x52')]);_0x2ac0dd['userProfileId']=_0x2c7ced['id'];if(_0x5d7bab)_0x2ac0dd[_0x2d53('0x59')]=_0x5d7bab;return _0x2ac0dd;})[_0x2d53('0x28')](function(_0x1b3ea4){return db[_0x2d53('0x55')][_0x2d53('0x4a')](_0x1b3ea4,{'include':[{'model':db[_0x2d53('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x361563});});})[_0x2d53('0x28')](function(){return _0x2c7ced;});}});});});}})[_0x2d53('0x28')](respondWithResult(_0x59d93,0xc9))[_0x2d53('0x45')](handleError(_0x59d93,null));};exports[_0x2d53('0x27')]=function(_0x2f46c9,_0x488358){if(_0x2f46c9[_0x2d53('0x4b')]['id']){delete _0x2f46c9[_0x2d53('0x4b')]['id'];}return db['UserProfile'][_0x2d53('0x49')]({'where':{'id':_0x2f46c9[_0x2d53('0x47')]['id']}})[_0x2d53('0x28')](handleEntityNotFound(_0x488358,null))[_0x2d53('0x28')](saveUpdates(_0x2f46c9[_0x2d53('0x4b')],null))[_0x2d53('0x28')](respondWithResult(_0x488358,null))[_0x2d53('0x45')](handleError(_0x488358,null));};exports[_0x2d53('0x29')]=function(_0x4d2329,_0x1ff3fc){return db[_0x2d53('0x2e')][_0x2d53('0x49')]({'where':{'id':_0x4d2329[_0x2d53('0x47')]['id']}})[_0x2d53('0x28')](handleEntityNotFound(_0x1ff3fc,null))[_0x2d53('0x28')](removeEntity(_0x1ff3fc,null))[_0x2d53('0x45')](handleError(_0x1ff3fc,null));};exports[_0x2d53('0x5b')]=function(_0x48de1e,_0x11a84a){return db[_0x2d53('0x2e')][_0x2d53('0x5b')]()[_0x2d53('0x28')](respondWithResult(_0x11a84a,null))[_0x2d53('0x45')](handleError(_0x11a84a,null));};exports[_0x2d53('0x5c')]=function(_0x222214,_0x13041f){var _0xb5159a=_0x222214[_0x2d53('0x4b')];return db[_0x2d53('0x2e')][_0x2d53('0x49')]({'where':{'id':_0x222214[_0x2d53('0x47')]['id']}})[_0x2d53('0x28')](handleEntityNotFound(_0x13041f,null))[_0x2d53('0x28')](function(_0x3d7cf9){if(_0x3d7cf9){return db[_0x2d53('0x53')][_0x2d53('0x54')](function(_0x2d3896){return db[_0x2d53('0x55')][_0x2d53('0x29')]({'where':{'userProfileId':_0x222214[_0x2d53('0x47')]['id'],'sectionId':_[_0x2d53('0x34')](_0xb5159a,function(_0x2f8c04){return _0x2f8c04[_0x2d53('0x58')];})},'transaction':_0x2d3896})[_0x2d53('0x28')](function(){var _0x297fc5=_[_0x2d53('0x34')](_0xb5159a,function(_0x1b9d7d){_0x1b9d7d[_0x2d53('0x5d')]=_0x222214[_0x2d53('0x47')]['id'];return _0x1b9d7d;});var _0x704ab0=[];return BPromise['each'](_0x297fc5,function(_0x5cd5a0){return db[_0x2d53('0x55')][_0x2d53('0x4a')](_0x5cd5a0,{'include':[{'model':db[_0x2d53('0x5a')],'as':_0x2d53('0x59')}],'raw':!![],'transaction':_0x2d3896})[_0x2d53('0x28')](function(_0xb63f8f){_0x704ab0['push'](_0xb63f8f[_0x2d53('0x4e')]({'plain':!![]}));});})[_0x2d53('0x28')](function(){return _0x704ab0;});});});}})['then'](function(_0x1c764d){return _0x1c764d;})[_0x2d53('0x28')](respondWithResult(_0x13041f,null))[_0x2d53('0x45')](handleError(_0x13041f,null));};exports[_0x2d53('0x5e')]=function(_0x47207c,_0x475307){var _0x5b4dca;return db[_0x2d53('0x2e')][_0x2d53('0x49')]({'where':{'id':_0x47207c[_0x2d53('0x47')]['id']},'attributes':['id','name']})[_0x2d53('0x28')](handleEntityNotFound(_0x475307,null))['then'](function(_0x4e1ed0){if(_0x4e1ed0){_0x5b4dca=_0x4e1ed0;return db['UserProfileSection'][_0x2d53('0x29')]({'where':{'userProfileId':_0x47207c['params']['id'],'sectionId':_0x47207c['query'][_0x2d53('0x5f')]}});}})[_0x2d53('0x28')](function(){return _0x5b4dca;})[_0x2d53('0x28')](respondWithStatusCode(_0x475307,null))[_0x2d53('0x45')](handleError(_0x475307,null));};exports['getSections']=function(_0x5a90b4,_0x376c4b){var _0x4d82f5=[];var _0x3a847b=[];return db['UserProfileSection'][_0x2d53('0x43')]({'where':{'userProfileId':_0x5a90b4['params']['id']},'raw':!![]})[_0x2d53('0x28')](function(_0x13d65a){_0x4d82f5=_[_0x2d53('0x3f')](_0x13d65a,function(_0x6fe9a0){return _0x6fe9a0['enabled']===0x1||_[_0x2d53('0x60')]([0x3eb,0x709],_0x6fe9a0[_0x2d53('0x58')]);});if(!_[_0x2d53('0x61')](_0x4d82f5)){return _[_0x2d53('0x34')](_0x4d82f5,function(_0x2c271e){return _0x2c271e[_0x2d53('0x58')];});}else{return;}})[_0x2d53('0x28')](function(_0x1cc839){if(_0x1cc839)_0x3a847b=_0x1cc839;if(_[_0x2d53('0x60')](_0x3a847b,0x64)){var _0x5833c6=_['find'](_0x4d82f5,{'sectionId':0x64});return hasDefaultDashboard(_0x5833c6)[_0x2d53('0x28')](function(_0xab8a62){return _[_0x2d53('0x34')](_0x4d82f5,function(_0x263c78){if(_0x263c78[_0x2d53('0x58')]===0x64){_0x263c78['subsections']=_0xab8a62;}return _0x263c78;});});}else{return;}})[_0x2d53('0x28')](function(_0x1aeb4b){if(_0x1aeb4b)_0x4d82f5=_0x1aeb4b;if(_[_0x2d53('0x60')](_0x3a847b,0x3eb)){var _0x210739=_['find'](_0x4d82f5,{'sectionId':0x3eb});return getCustomDashboards(_0x210739)[_0x2d53('0x28')](function(_0x2d1518){return _[_0x2d53('0x34')](_0x4d82f5,function(_0x3e24dc){if(_0x210739[_0x2d53('0x62')]){if(_0x3e24dc[_0x2d53('0x58')]===0x3eb){_0x3e24dc[_0x2d53('0x63')]=_0x2d1518;}}else{if(_0x3e24dc[_0x2d53('0x58')]===0x64){if(!_0x3e24dc[_0x2d53('0x63')]){_0x3e24dc[_0x2d53('0x63')]=[];}_0x3e24dc[_0x2d53('0x63')]=_0x3e24dc[_0x2d53('0x63')][_0x2d53('0x64')](_0x2d1518);}}return _0x3e24dc;});});}else{return;}})[_0x2d53('0x28')](function(_0x7c0f55){if(_0x7c0f55)_0x4d82f5=_0x7c0f55;if(_['includes'](_0x3a847b,0x709)){var _0xbef6e2=_[_0x2d53('0x49')](_0x4d82f5,{'sectionId':0x709});return getPlugins(_0xbef6e2)[_0x2d53('0x28')](function(_0x3683d0){if(_0xbef6e2[_0x2d53('0x62')]){return _[_0x2d53('0x34')](_0x4d82f5,function(_0x435c09){if(_0x435c09['sectionId']===0x709){_0x435c09[_0x2d53('0x63')]=_0x3683d0;}return _0x435c09;});}else{var _0x2d7cfb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3683d0};var _0x271169=_['map'](_0x4d82f5);_0x271169['push'](_0x2d7cfb);return _0x271169;}});}else{return;}})[_0x2d53('0x28')](function(_0x23686b){if(_0x23686b)_0x4d82f5=_0x23686b;return _['filter'](_0x4d82f5,[_0x2d53('0x62'),0x1]);})[_0x2d53('0x28')](respondWithResult(_0x376c4b,null))[_0x2d53('0x45')](handleError(_0x376c4b,null));};function hasDefaultDashboard(_0x4885ad){var _0x3430eb=[0x65];return new BPromise(function(_0x1458d6,_0x3c421d){try{if(_0x4885ad[_0x2d53('0x57')]){_0x1458d6(_0x3430eb);}else{return db[_0x2d53('0x5a')][_0x2d53('0x65')]({'where':{'sectionId':_0x4885ad['id']},'raw':!![]})[_0x2d53('0x28')](function(_0x1b55f8){_0x1b55f8?_0x1458d6(_0x3430eb):_0x1458d6();});}}catch(_0x582237){_0x3c421d(_0x582237);}});}function getCustomDashboards(_0x347739){var _0x4c05aa=[];return new BPromise(function(_0x2e5220,_0x3cbd08){try{if(_0x347739['autoAssociation']){return db[_0x2d53('0x66')][_0x2d53('0x43')]({'raw':!![]})['then'](function(_0x104727){_0x104727[_0x2d53('0x67')](function(_0x23fa21){_0x4c05aa['push'](_0x23fa21['id']+0x1869f);});_0x2e5220(_0x4c05aa);});}else{return db[_0x2d53('0x5a')][_0x2d53('0x43')]({'where':{'sectionId':_0x347739['id']},'raw':!![]})[_0x2d53('0x28')](function(_0x368df2){_0x368df2[_0x2d53('0x67')](function(_0x3bf6b1){_0x4c05aa[_0x2d53('0x68')](_0x3bf6b1[_0x2d53('0x69')]+0x1869f);});_0x2e5220(_0x4c05aa);});}}catch(_0x2b61dc){_0x3cbd08(_0x2b61dc);}});}function getPlugins(_0x546537){var _0x4de169=[];return new BPromise(function(_0x9a3b96,_0x1423de){try{if(_0x546537[_0x2d53('0x57')]){return db[_0x2d53('0x6a')][_0x2d53('0x43')]({'raw':!![]})[_0x2d53('0x28')](function(_0x371080){_0x371080[_0x2d53('0x67')](function(_0x35677f){_0x4de169[_0x2d53('0x68')](_0x35677f['id']+0x15b38);});_0x9a3b96(_0x4de169);});}else{return db['UserProfileResource'][_0x2d53('0x43')]({'where':{'sectionId':_0x546537['id']},'raw':!![]})[_0x2d53('0x28')](function(_0x4a1e4d){_0x4a1e4d[_0x2d53('0x67')](function(_0x3d34dd){_0x4de169[_0x2d53('0x68')](_0x3d34dd['resourceId']+0x15b38);});_0x9a3b96(_0x4de169);});}}catch(_0x51031e){_0x1423de(_0x51031e);}});}exports[_0x2d53('0x6b')]=function(_0x7ecbbc,_0x1d7be4){return db['UserProfile'][_0x2d53('0x49')]({'where':{'id':_0x7ecbbc[_0x2d53('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d7be4,null))[_0x2d53('0x28')](function(_0x593e5f){if(_0x593e5f){return db[_0x2d53('0x53')]['transaction'](function(_0x5ef26b){return db[_0x2d53('0x55')][_0x2d53('0x43')]({'where':{'userProfileId':_0x7ecbbc['params']['id']},'attributes':['id'],'raw':!![]})[_0x2d53('0x28')](function(_0x30e0d6){if(_0x30e0d6){return db['UserProfileSection'][_0x2d53('0x29')]({'where':{'userProfileId':_0x7ecbbc[_0x2d53('0x47')]['id'],'id':_[_0x2d53('0x34')](_0x30e0d6,function(_0x1c708c){return _0x1c708c['id'];})},'transaction':_0x5ef26b});}})['then'](function(_0x3ef046){var _0x5c85df=_[_0x2d53('0x34')](_0x7ecbbc[_0x2d53('0x4b')],function(_0x157c16){_0x157c16[_0x2d53('0x5d')]=_0x7ecbbc[_0x2d53('0x47')]['id'];return _0x157c16;});return db[_0x2d53('0x55')][_0x2d53('0x6c')](_0x5c85df,{'raw':!![],'transaction':_0x5ef26b});})[_0x2d53('0x28')](function(_0x12fcbb){var _0x5db103=_[_0x2d53('0x3f')](_['map'](_0x12fcbb,function(_0x2acee8){return _0x2acee8['get']({'plain':!![]});}),{'includeAll':![]});if(_0x5db103){return db[_0x2d53('0x55')][_0x2d53('0x43')]({'where':{'userProfileId':_0x7ecbbc[_0x2d53('0x47')]['id'],'sectionId':_[_0x2d53('0x34')](_0x5db103,function(_0x563556){return _0x563556[_0x2d53('0x58')];})},'attributes':['id',_0x2d53('0x58')],'raw':!![]})[_0x2d53('0x28')](function(_0x3d422a){var _0x355ddc=_[_0x2d53('0x34')](_0x7ecbbc[_0x2d53('0x4b')],function(_0x1608dc){_0x1608dc[_0x2d53('0x5d')]=_0x7ecbbc['params']['id'];return _0x1608dc;});return db['UserProfileResource'][_0x2d53('0x6c')](_0x355ddc,{'raw':!![],'transaction':_0x5ef26b});});}})['catch'](handleError(_0x1d7be4,null));});}})[_0x2d53('0x28')](function(_0x5ab7ff){var _0x772c3f=_[_0x2d53('0x34')](_0x5ab7ff,function(_0x3b4c78){return _0x3b4c78['get']({'plain':!![]});});})['then'](respondWithResult(_0x1d7be4,null))[_0x2d53('0x45')](handleError(_0x1d7be4,null));};exports[_0x2d53('0x6d')]=function(_0x2af06d,_0x276eff,_0x458937){return db[_0x2d53('0x2e')][_0x2d53('0x49')]({'where':{'id':_0x2af06d[_0x2d53('0x47')]['id']}})[_0x2d53('0x28')](handleEntityNotFound(_0x276eff,null))['then'](function(_0x214473){if(_0x214473){return _0x214473[_0x2d53('0x6d')](_0x2af06d['query'][_0x2d53('0x5f')]);}})[_0x2d53('0x28')](respondWithStatusCode(_0x276eff,null))['catch'](handleError(_0x276eff,null));};exports[_0x2d53('0x6e')]=function(_0x8187f9,_0x530f09){var _0x6ad17e={};if(!_0x8187f9['query'][_0x2d53('0x6f')])throw new Error(_0x2d53('0x70'));if(!_0x8187f9[_0x2d53('0x35')][_0x2d53('0x71')](_0x2d53('0x72'))){_0x6ad17e['limit']=qs[_0x2d53('0x73')](_0x8187f9[_0x2d53('0x35')][_0x2d53('0x73')]);_0x6ad17e[_0x2d53('0x21')]=qs[_0x2d53('0x21')](_0x8187f9[_0x2d53('0x35')]['offset']);}return db[_0x2d53('0x2e')][_0x2d53('0x49')]({'where':{'id':_0x8187f9[_0x2d53('0x47')]['id']}})[_0x2d53('0x28')](function(_0x11dd6a){if(!_0x11dd6a)throw new Error(_0x2d53('0x74')+_0x8187f9[_0x2d53('0x47')]['id']);return db['UserProfile']['getResources'](_0x8187f9);})[_0x2d53('0x28')](respondWithFilteredResult(_0x530f09,_0x6ad17e))[_0x2d53('0x45')](handleError(_0x530f09,null));}; \ No newline at end of file +var _0xc492=['getResources','section','Missing\x20section\x20parameter','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','UserProfile','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','params','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xc492,0xe5));var _0x2c49=function(_0x456fa5,_0x270105){_0x456fa5=_0x456fa5-0x0;var _0x44077d=_0xc492[_0x456fa5];return _0x44077d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c49('0x0'));var zipdir=require(_0x2c49('0x1'));var jsonpatch=require(_0x2c49('0x2'));var rp=require(_0x2c49('0x3'));var moment=require(_0x2c49('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2c49('0x5'));var util=require(_0x2c49('0x6'));var path=require('path');var sox=require(_0x2c49('0x7'));var csv=require(_0x2c49('0x8'));var ejs=require(_0x2c49('0x9'));var fs=require('fs');var fs_extra=require(_0x2c49('0xa'));var _=require(_0x2c49('0xb'));var squel=require(_0x2c49('0xc'));var crypto=require(_0x2c49('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2c49('0xe'));var toCsv=require(_0x2c49('0x8'));var querystring=require(_0x2c49('0xf'));var Papa=require(_0x2c49('0x10'));var Redis=require(_0x2c49('0x11'));var authService=require(_0x2c49('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2c49('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c49('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x2c49('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c49('0x16'))['db'];config['redis']=_[_0x2c49('0x17')](config[_0x2c49('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c49('0x19'))(new Redis(config['redis']));require(_0x2c49('0x1a'))[_0x2c49('0x1b')](socket);function respondWithStatusCode(_0x4bcdc1,_0x125550){_0x125550=_0x125550||0xcc;return function(_0x35e4f8){if(_0x35e4f8){return _0x4bcdc1[_0x2c49('0x1c')](_0x125550);}return _0x4bcdc1[_0x2c49('0x1d')](_0x125550)[_0x2c49('0x1e')]();};}function respondWithResult(_0x5d3284,_0x2c0ff7){_0x2c0ff7=_0x2c0ff7||0xc8;return function(_0x4941ee){if(_0x4941ee){return _0x5d3284[_0x2c49('0x1d')](_0x2c0ff7)[_0x2c49('0x1f')](_0x4941ee);}};}function respondWithFilteredResult(_0x2f551f,_0x4c0d6e){return function(_0x433a03){if(_0x433a03){var _0x24ce9d=typeof _0x4c0d6e[_0x2c49('0x20')]==='undefined'&&typeof _0x4c0d6e['limit']===_0x2c49('0x21');var _0x3fef0f=_0x433a03[_0x2c49('0x22')];var _0x55ba14=_0x24ce9d?0x0:_0x4c0d6e['offset'];var _0x1a55d8=_0x24ce9d?_0x433a03[_0x2c49('0x22')]:_0x4c0d6e[_0x2c49('0x20')]+_0x4c0d6e['limit'];var _0x2b3e96;if(_0x1a55d8>=_0x3fef0f){_0x1a55d8=_0x3fef0f;_0x2b3e96=0xc8;}else{_0x2b3e96=0xce;}_0x2f551f[_0x2c49('0x1d')](_0x2b3e96);return _0x2f551f[_0x2c49('0x23')](_0x2c49('0x24'),_0x55ba14+'-'+_0x1a55d8+'/'+_0x3fef0f)[_0x2c49('0x1f')](_0x433a03);}return null;};}function patchUpdates(_0x4ac45d){return function(_0x58533b){try{jsonpatch[_0x2c49('0x25')](_0x58533b,_0x4ac45d,!![]);}catch(_0x40da99){return BPromise[_0x2c49('0x26')](_0x40da99);}return _0x58533b[_0x2c49('0x27')]();};}function saveUpdates(_0x3a5af2,_0x371613){return function(_0x201331){if(_0x201331){return _0x201331[_0x2c49('0x28')](_0x3a5af2)[_0x2c49('0x29')](function(_0x1b4fb3){return _0x1b4fb3;});}return null;};}function removeEntity(_0x33e7ae,_0x47cc09){return function(_0xbae21c){if(_0xbae21c){return _0xbae21c[_0x2c49('0x2a')]()[_0x2c49('0x29')](function(){_0x33e7ae[_0x2c49('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a97b7,_0x263ccc){return function(_0x1fb82d){if(!_0x1fb82d){_0x4a97b7['sendStatus'](0x194);}return _0x1fb82d;};}function handleError(_0x1c35d4,_0x203cdf){_0x203cdf=_0x203cdf||0x1f4;return function(_0x59bd77){logger[_0x2c49('0x2b')](_0x59bd77[_0x2c49('0x2c')]);if(_0x59bd77[_0x2c49('0x2d')]){delete _0x59bd77['name'];}_0x1c35d4[_0x2c49('0x1d')](_0x203cdf)['send'](_0x59bd77);};}exports[_0x2c49('0x2e')]=function(_0x5f4b5f,_0x42b720){var _0x46ee78={},_0x728a9c={},_0x1e3d1b={'count':0x0,'rows':[]};var _0xaa8c94=_[_0x2c49('0x2f')](db[_0x2c49('0x30')]['rawAttributes'],function(_0x4662f6){return{'name':_0x4662f6[_0x2c49('0x31')],'type':_0x4662f6[_0x2c49('0x32')][_0x2c49('0x33')]};});_0x728a9c['model']=_[_0x2c49('0x2f')](_0xaa8c94,_0x2c49('0x2d'));_0x728a9c[_0x2c49('0x34')]=_[_0x2c49('0x35')](_0x5f4b5f[_0x2c49('0x34')]);_0x728a9c[_0x2c49('0x36')]=_[_0x2c49('0x37')](_0x728a9c[_0x2c49('0x38')],_0x728a9c['query']);_0x46ee78[_0x2c49('0x39')]=_[_0x2c49('0x37')](_0x728a9c['model'],qs[_0x2c49('0x3a')](_0x5f4b5f[_0x2c49('0x34')][_0x2c49('0x3a')]));_0x46ee78[_0x2c49('0x39')]=_0x46ee78['attributes'][_0x2c49('0x3b')]?_0x46ee78[_0x2c49('0x39')]:_0x728a9c[_0x2c49('0x38')];if(!_0x5f4b5f[_0x2c49('0x34')]['hasOwnProperty'](_0x2c49('0x3c'))){_0x46ee78[_0x2c49('0x3d')]=qs[_0x2c49('0x3d')](_0x5f4b5f['query']['limit']);_0x46ee78[_0x2c49('0x20')]=qs[_0x2c49('0x20')](_0x5f4b5f[_0x2c49('0x34')][_0x2c49('0x20')]);}_0x46ee78['order']=qs[_0x2c49('0x3e')](_0x5f4b5f[_0x2c49('0x34')][_0x2c49('0x3e')]);_0x46ee78['where']=qs[_0x2c49('0x36')](_[_0x2c49('0x3f')](_0x5f4b5f['query'],_0x728a9c['filters']),_0xaa8c94);if(_0x5f4b5f[_0x2c49('0x34')][_0x2c49('0x40')]){_0x46ee78[_0x2c49('0x41')]=_[_0x2c49('0x42')](_0x46ee78['where'],{'$or':_['map'](_0xaa8c94,function(_0x574660){if(_0x574660[_0x2c49('0x32')]!==_0x2c49('0x43')){var _0x3addd8={};_0x3addd8[_0x574660[_0x2c49('0x2d')]]={'$like':'%'+_0x5f4b5f['query'][_0x2c49('0x40')]+'%'};return _0x3addd8;}})});}_0x46ee78=_[_0x2c49('0x42')]({},_0x46ee78,_0x5f4b5f[_0x2c49('0x44')]);var _0x3be694={'where':_0x46ee78['where']};return db[_0x2c49('0x30')][_0x2c49('0x22')](_0x3be694)['then'](function(_0x433974){_0x1e3d1b[_0x2c49('0x22')]=_0x433974;if(_0x5f4b5f['query'][_0x2c49('0x45')]){_0x46ee78[_0x2c49('0x46')]=[{'all':!![]}];}return db[_0x2c49('0x30')][_0x2c49('0x47')](_0x46ee78);})[_0x2c49('0x29')](function(_0xc4cc11){_0x1e3d1b['rows']=_0xc4cc11;return _0x1e3d1b;})['then'](respondWithFilteredResult(_0x42b720,_0x46ee78))[_0x2c49('0x48')](handleError(_0x42b720,null));};exports[_0x2c49('0x49')]=function(_0x2ff322,_0x18f120){var _0x3a27f9={'raw':![],'where':{'id':_0x2ff322['params']['id']}},_0x30ceb4={};_0x30ceb4['model']=_[_0x2c49('0x35')](db[_0x2c49('0x30')][_0x2c49('0x4a')]);_0x30ceb4[_0x2c49('0x34')]=_[_0x2c49('0x35')](_0x2ff322[_0x2c49('0x34')]);_0x30ceb4['filters']=_[_0x2c49('0x37')](_0x30ceb4[_0x2c49('0x38')],_0x30ceb4[_0x2c49('0x34')]);_0x3a27f9[_0x2c49('0x39')]=_[_0x2c49('0x37')](_0x30ceb4[_0x2c49('0x38')],qs['fields'](_0x2ff322['query'][_0x2c49('0x3a')]));_0x3a27f9[_0x2c49('0x39')]=_0x3a27f9[_0x2c49('0x39')][_0x2c49('0x3b')]?_0x3a27f9[_0x2c49('0x39')]:_0x30ceb4['model'];if(_0x2ff322[_0x2c49('0x34')]['includeAll']){_0x3a27f9[_0x2c49('0x46')]=[{'all':!![]}];}_0x3a27f9=_[_0x2c49('0x42')]({},_0x3a27f9,_0x2ff322[_0x2c49('0x44')]);return db[_0x2c49('0x30')][_0x2c49('0x4b')](_0x3a27f9)[_0x2c49('0x29')](handleEntityNotFound(_0x18f120,null))['then'](respondWithResult(_0x18f120,null))[_0x2c49('0x48')](handleError(_0x18f120,null));};exports[_0x2c49('0x4c')]=function(_0x3fa38f,_0x33c292){return db[_0x2c49('0x30')]['create'](_0x3fa38f['body'],{})[_0x2c49('0x29')](respondWithResult(_0x33c292,0xc9))[_0x2c49('0x48')](handleError(_0x33c292,null));};exports['clone']=function(_0x4b7965,_0x1324c3){var _0xf40ab3={'where':{'id':_0x4b7965[_0x2c49('0x4d')]['id']}},_0x4bd647={};_0x4bd647[_0x2c49('0x38')]=_['keys'](db[_0x2c49('0x30')][_0x2c49('0x4a')]);_0xf40ab3[_0x2c49('0x39')]=_[_0x2c49('0x37')](_0x4bd647['model'],qs[_0x2c49('0x3a')](_0x4b7965[_0x2c49('0x34')]['fields']));_0xf40ab3['attributes']=_0xf40ab3[_0x2c49('0x39')]['length']?_0xf40ab3[_0x2c49('0x39')]:_0x4bd647[_0x2c49('0x38')];if(_0x4b7965[_0x2c49('0x34')][_0x2c49('0x45')]){_0xf40ab3[_0x2c49('0x46')]=[{'all':!![]}];}_0xf40ab3=_[_0x2c49('0x42')]({},_0xf40ab3,_0x4b7965['options']);return db[_0x2c49('0x30')]['find'](_0xf40ab3)[_0x2c49('0x29')](handleEntityNotFound(_0x1324c3,null))[_0x2c49('0x29')](function(_0x7defb0){if(_0x7defb0){var _0xa06f78=_0x7defb0[_0x2c49('0x4e')]({'plain':!![]});_0xa06f78=qs[_0x2c49('0x4f')](_0xa06f78,['id',_0x2c49('0x50'),_0x2c49('0x51'),_0x2c49('0x52')]);_0x4b7965[_0x2c49('0x53')]=_[_0x2c49('0x4f')](_0x4b7965[_0x2c49('0x53')],['id',_0x2c49('0x50'),_0x2c49('0x51')]);return db[_0x2c49('0x54')][_0x2c49('0x55')](function(_0x44db87){return db[_0x2c49('0x30')][_0x2c49('0x4c')](_[_0x2c49('0x42')](_0xa06f78,_0x4b7965['body']),{'include':_0x4b7965[_0x2c49('0x34')][_0x2c49('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x44db87})[_0x2c49('0x29')](function(_0x38e76f){var _0x1e6cce=_0x38e76f[_0x2c49('0x4e')]({'plain':!![]});return db[_0x2c49('0x56')][_0x2c49('0x47')]({'where':{'userProfileId':_0x4b7965[_0x2c49('0x4d')]['id']},'raw':!![]})[_0x2c49('0x29')](function(_0x5569f0){if(_0x5569f0){return BPromise[_0x2c49('0x57')](_0x5569f0,function(_0x241f62){return new BPromise(function(_0x2d79f2,_0x50de56){if(_0x241f62[_0x2c49('0x58')]===null||_0x241f62[_0x2c49('0x58')]===0x1)_0x2d79f2(null);return db[_0x2c49('0x59')][_0x2c49('0x47')]({'where':{'sectionId':_0x241f62['id']},'raw':!![]})[_0x2c49('0x29')](function(_0x1ff2e0){var _0x1cb286=_[_0x2c49('0x2f')](_0x1ff2e0,function(_0x13e250){return qs['omit'](_0x13e250,['id',_0x2c49('0x50'),_0x2c49('0x51'),_0x2c49('0x5a')]);});_0x2d79f2(_0x1cb286);})[_0x2c49('0x48')](function(_0x226115){_0x50de56(_0x226115);});})[_0x2c49('0x29')](function(_0x2913f2){var _0x11653f=qs['omit'](_0x241f62,['id',_0x2c49('0x50'),_0x2c49('0x51')]);_0x11653f['userProfileId']=_0x1e6cce['id'];if(_0x2913f2)_0x11653f[_0x2c49('0x5b')]=_0x2913f2;return _0x11653f;})[_0x2c49('0x29')](function(_0x29e950){return db[_0x2c49('0x56')][_0x2c49('0x4c')](_0x29e950,{'include':[{'model':db[_0x2c49('0x59')],'as':_0x2c49('0x5b')}],'raw':!![],'transaction':_0x44db87});});})['then'](function(){return _0x1e6cce;});}});});});}})['then'](respondWithResult(_0x1324c3,0xc9))['catch'](handleError(_0x1324c3,null));};exports[_0x2c49('0x28')]=function(_0xd20d98,_0x22fdc3){if(_0xd20d98['body']['id']){delete _0xd20d98['body']['id'];}return db[_0x2c49('0x30')][_0x2c49('0x4b')]({'where':{'id':_0xd20d98[_0x2c49('0x4d')]['id']}})[_0x2c49('0x29')](handleEntityNotFound(_0x22fdc3,null))[_0x2c49('0x29')](saveUpdates(_0xd20d98[_0x2c49('0x53')],null))[_0x2c49('0x29')](respondWithResult(_0x22fdc3,null))[_0x2c49('0x48')](handleError(_0x22fdc3,null));};exports[_0x2c49('0x2a')]=function(_0x152311,_0x1a04d6){return db['UserProfile'][_0x2c49('0x4b')]({'where':{'id':_0x152311['params']['id']}})[_0x2c49('0x29')](handleEntityNotFound(_0x1a04d6,null))[_0x2c49('0x29')](removeEntity(_0x1a04d6,null))[_0x2c49('0x48')](handleError(_0x1a04d6,null));};exports['describe']=function(_0x5c522f,_0x1253ce){return db[_0x2c49('0x30')][_0x2c49('0x5c')]()[_0x2c49('0x29')](respondWithResult(_0x1253ce,null))['catch'](handleError(_0x1253ce,null));};exports[_0x2c49('0x5d')]=function(_0x5edb92,_0xd5305){var _0x260919=_0x5edb92['body'];return db[_0x2c49('0x30')][_0x2c49('0x4b')]({'where':{'id':_0x5edb92[_0x2c49('0x4d')]['id']}})[_0x2c49('0x29')](handleEntityNotFound(_0xd5305,null))[_0x2c49('0x29')](function(_0x9e7dfa){if(_0x9e7dfa){return db[_0x2c49('0x54')][_0x2c49('0x55')](function(_0x1d8a53){return db[_0x2c49('0x56')][_0x2c49('0x2a')]({'where':{'userProfileId':_0x5edb92[_0x2c49('0x4d')]['id'],'sectionId':_[_0x2c49('0x2f')](_0x260919,function(_0x2df9a6){return _0x2df9a6[_0x2c49('0x5a')];})},'transaction':_0x1d8a53})[_0x2c49('0x29')](function(){var _0x57e6ed=_['map'](_0x260919,function(_0x29431f){_0x29431f[_0x2c49('0x5e')]=_0x5edb92[_0x2c49('0x4d')]['id'];return _0x29431f;});var _0x3ee33e=[];return BPromise[_0x2c49('0x57')](_0x57e6ed,function(_0x4d96f8){return db[_0x2c49('0x56')]['create'](_0x4d96f8,{'include':[{'model':db[_0x2c49('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x1d8a53})[_0x2c49('0x29')](function(_0x3ffa14){_0x3ee33e[_0x2c49('0x5f')](_0x3ffa14[_0x2c49('0x4e')]({'plain':!![]}));});})[_0x2c49('0x29')](function(){return _0x3ee33e;});});});}})['then'](function(_0x4f5bdd){return _0x4f5bdd;})[_0x2c49('0x29')](respondWithResult(_0xd5305,null))[_0x2c49('0x48')](handleError(_0xd5305,null));};exports[_0x2c49('0x60')]=function(_0x5059cd,_0xe42e82){var _0x3a185a;return db[_0x2c49('0x30')][_0x2c49('0x4b')]({'where':{'id':_0x5059cd['params']['id']},'attributes':['id',_0x2c49('0x2d')]})[_0x2c49('0x29')](handleEntityNotFound(_0xe42e82,null))[_0x2c49('0x29')](function(_0xa92a6b){if(_0xa92a6b){_0x3a185a=_0xa92a6b;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x5059cd[_0x2c49('0x4d')]['id'],'sectionId':_0x5059cd[_0x2c49('0x34')][_0x2c49('0x61')]}});}})[_0x2c49('0x29')](function(){return _0x3a185a;})[_0x2c49('0x29')](respondWithStatusCode(_0xe42e82,null))[_0x2c49('0x48')](handleError(_0xe42e82,null));};exports[_0x2c49('0x62')]=function(_0x28a3e4,_0xf0936){var _0xe65f28=[];var _0xabea44=[];return db[_0x2c49('0x56')]['findAll']({'where':{'userProfileId':_0x28a3e4['params']['id']},'raw':!![]})[_0x2c49('0x29')](function(_0x54868d){_0xe65f28=_[_0x2c49('0x40')](_0x54868d,function(_0x12d876){return _0x12d876[_0x2c49('0x63')]===0x1||_[_0x2c49('0x64')]([0x3eb,0x709],_0x12d876[_0x2c49('0x5a')]);});if(!_[_0x2c49('0x65')](_0xe65f28)){return _['map'](_0xe65f28,function(_0x236f9e){return _0x236f9e['sectionId'];});}else{return;}})[_0x2c49('0x29')](function(_0x45bf2f){if(_0x45bf2f)_0xabea44=_0x45bf2f;if(_[_0x2c49('0x64')](_0xabea44,0x64)){var _0x4effda=_[_0x2c49('0x4b')](_0xe65f28,{'sectionId':0x64});return hasDefaultDashboard(_0x4effda)[_0x2c49('0x29')](function(_0x144559){return _[_0x2c49('0x2f')](_0xe65f28,function(_0x385d98){if(_0x385d98[_0x2c49('0x5a')]===0x64){_0x385d98[_0x2c49('0x66')]=_0x144559;}return _0x385d98;});});}else{return;}})[_0x2c49('0x29')](function(_0x3d4cbb){if(_0x3d4cbb)_0xe65f28=_0x3d4cbb;if(_[_0x2c49('0x64')](_0xabea44,0x3eb)){var _0x1c7728=_[_0x2c49('0x4b')](_0xe65f28,{'sectionId':0x3eb});return getCustomDashboards(_0x1c7728)[_0x2c49('0x29')](function(_0x414a05){return _[_0x2c49('0x2f')](_0xe65f28,function(_0x5616ee){if(_0x1c7728[_0x2c49('0x63')]){if(_0x5616ee[_0x2c49('0x5a')]===0x3eb){_0x5616ee[_0x2c49('0x66')]=_0x414a05;}}else{if(_0x5616ee['sectionId']===0x64){if(!_0x5616ee[_0x2c49('0x66')]){_0x5616ee[_0x2c49('0x66')]=[];}_0x5616ee[_0x2c49('0x66')]=_0x5616ee['subsections'][_0x2c49('0x67')](_0x414a05);}}return _0x5616ee;});});}else{return;}})[_0x2c49('0x29')](function(_0x569c38){if(_0x569c38)_0xe65f28=_0x569c38;if(_[_0x2c49('0x64')](_0xabea44,0x709)){var _0x53b9f8=_['find'](_0xe65f28,{'sectionId':0x709});return getPlugins(_0x53b9f8)['then'](function(_0x1418bb){if(_0x53b9f8[_0x2c49('0x63')]){return _[_0x2c49('0x2f')](_0xe65f28,function(_0x37fb03){if(_0x37fb03['sectionId']===0x709){_0x37fb03[_0x2c49('0x66')]=_0x1418bb;}return _0x37fb03;});}else{var _0x6e353a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1418bb};var _0x4d1c66=_['map'](_0xe65f28);_0x4d1c66[_0x2c49('0x5f')](_0x6e353a);return _0x4d1c66;}});}else{return;}})[_0x2c49('0x29')](function(_0xa6c82c){if(_0xa6c82c)_0xe65f28=_0xa6c82c;return _[_0x2c49('0x40')](_0xe65f28,[_0x2c49('0x63'),0x1]);})[_0x2c49('0x29')](respondWithResult(_0xf0936,null))['catch'](handleError(_0xf0936,null));};function hasDefaultDashboard(_0x12c9de){var _0x16167b=[0x65];return new BPromise(function(_0x1f4fc7,_0x8e0ac6){try{if(_0x12c9de[_0x2c49('0x58')]){_0x1f4fc7(_0x16167b);}else{return db[_0x2c49('0x59')][_0x2c49('0x68')]({'where':{'sectionId':_0x12c9de['id']},'raw':!![]})[_0x2c49('0x29')](function(_0x2698a6){_0x2698a6?_0x1f4fc7(_0x16167b):_0x1f4fc7();});}}catch(_0x11a12f){_0x8e0ac6(_0x11a12f);}});}function getCustomDashboards(_0x2c2cee){var _0x57e6b6=[];return new BPromise(function(_0x5b60a0,_0x1fa6d8){try{if(_0x2c2cee[_0x2c49('0x58')]){return db['Dashboard'][_0x2c49('0x47')]({'raw':!![]})['then'](function(_0xc94127){_0xc94127[_0x2c49('0x69')](function(_0x34b56c){_0x57e6b6['push'](_0x34b56c['id']+0x1869f);});_0x5b60a0(_0x57e6b6);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x2c2cee['id']},'raw':!![]})[_0x2c49('0x29')](function(_0x1038ef){_0x1038ef[_0x2c49('0x69')](function(_0x809703){_0x57e6b6[_0x2c49('0x5f')](_0x809703[_0x2c49('0x6a')]+0x1869f);});_0x5b60a0(_0x57e6b6);});}}catch(_0x1a9f54){_0x1fa6d8(_0x1a9f54);}});}function getPlugins(_0x440ac8){var _0x30095b=[];return new BPromise(function(_0x33f897,_0x2bb7f7){try{if(_0x440ac8[_0x2c49('0x58')]){return db[_0x2c49('0x6b')][_0x2c49('0x47')]({'raw':!![]})[_0x2c49('0x29')](function(_0x177c0b){_0x177c0b['forEach'](function(_0x238f5c){_0x30095b[_0x2c49('0x5f')](_0x238f5c['id']+0x15b38);});_0x33f897(_0x30095b);});}else{return db['UserProfileResource'][_0x2c49('0x47')]({'where':{'sectionId':_0x440ac8['id']},'raw':!![]})[_0x2c49('0x29')](function(_0x14c205){_0x14c205[_0x2c49('0x69')](function(_0x2396d5){_0x30095b['push'](_0x2396d5['resourceId']+0x15b38);});_0x33f897(_0x30095b);});}}catch(_0x225d9a){_0x2bb7f7(_0x225d9a);}});}exports['addResources']=function(_0x3cb559,_0x41ba0d){return db['UserProfile'][_0x2c49('0x4b')]({'where':{'id':_0x3cb559[_0x2c49('0x4d')]['id']}})[_0x2c49('0x29')](handleEntityNotFound(_0x41ba0d,null))['then'](function(_0x19e29f){if(_0x19e29f){return db[_0x2c49('0x54')]['transaction'](function(_0x5d92a2){return db[_0x2c49('0x56')][_0x2c49('0x47')]({'where':{'userProfileId':_0x3cb559[_0x2c49('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0x2c49('0x29')](function(_0x18ce52){if(_0x18ce52){return db[_0x2c49('0x56')][_0x2c49('0x2a')]({'where':{'userProfileId':_0x3cb559[_0x2c49('0x4d')]['id'],'id':_['map'](_0x18ce52,function(_0x255d3a){return _0x255d3a['id'];})},'transaction':_0x5d92a2});}})['then'](function(_0x2064b1){var _0x3f52f8=_['map'](_0x3cb559['body'],function(_0x250bf8){_0x250bf8[_0x2c49('0x5e')]=_0x3cb559['params']['id'];return _0x250bf8;});return db[_0x2c49('0x56')][_0x2c49('0x6c')](_0x3f52f8,{'raw':!![],'transaction':_0x5d92a2});})[_0x2c49('0x29')](function(_0x18647f){var _0x849e31=_[_0x2c49('0x40')](_[_0x2c49('0x2f')](_0x18647f,function(_0x2e578e){return _0x2e578e[_0x2c49('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x849e31){return db[_0x2c49('0x56')][_0x2c49('0x47')]({'where':{'userProfileId':_0x3cb559[_0x2c49('0x4d')]['id'],'sectionId':_[_0x2c49('0x2f')](_0x849e31,function(_0x3a73dc){return _0x3a73dc[_0x2c49('0x5a')];})},'attributes':['id',_0x2c49('0x5a')],'raw':!![]})[_0x2c49('0x29')](function(_0x3a24d9){var _0x2ecbd4=_[_0x2c49('0x2f')](_0x3cb559[_0x2c49('0x53')],function(_0x583fd2){_0x583fd2[_0x2c49('0x5e')]=_0x3cb559['params']['id'];return _0x583fd2;});return db[_0x2c49('0x59')][_0x2c49('0x6c')](_0x2ecbd4,{'raw':!![],'transaction':_0x5d92a2});});}})[_0x2c49('0x48')](handleError(_0x41ba0d,null));});}})[_0x2c49('0x29')](function(_0xd8cf0a){var _0x33dc5f=_[_0x2c49('0x2f')](_0xd8cf0a,function(_0x14f84f){return _0x14f84f[_0x2c49('0x4e')]({'plain':!![]});});})['then'](respondWithResult(_0x41ba0d,null))[_0x2c49('0x48')](handleError(_0x41ba0d,null));};exports[_0x2c49('0x6d')]=function(_0x3833a3,_0x361ae6,_0x4aaafa){return db[_0x2c49('0x30')]['find']({'where':{'id':_0x3833a3[_0x2c49('0x4d')]['id']}})[_0x2c49('0x29')](handleEntityNotFound(_0x361ae6,null))[_0x2c49('0x29')](function(_0x3949d3){if(_0x3949d3){return _0x3949d3['removeResources'](_0x3833a3[_0x2c49('0x34')][_0x2c49('0x61')]);}})[_0x2c49('0x29')](respondWithStatusCode(_0x361ae6,null))[_0x2c49('0x48')](handleError(_0x361ae6,null));};exports[_0x2c49('0x6e')]=function(_0x21aea,_0x5383c0){var _0x14e46d={};if(!_0x21aea[_0x2c49('0x34')][_0x2c49('0x6f')])throw new Error(_0x2c49('0x70'));if(!_0x21aea[_0x2c49('0x34')]['hasOwnProperty']('nolimit')){_0x14e46d['limit']=qs['limit'](_0x21aea[_0x2c49('0x34')][_0x2c49('0x3d')]);_0x14e46d[_0x2c49('0x20')]=qs[_0x2c49('0x20')](_0x21aea['query'][_0x2c49('0x20')]);}return db['UserProfile'][_0x2c49('0x4b')]({'where':{'id':_0x21aea[_0x2c49('0x4d')]['id']}})[_0x2c49('0x29')](function(_0xc85e30){if(!_0xc85e30)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x21aea[_0x2c49('0x4d')]['id']);return db['UserProfile'][_0x2c49('0x6e')](_0x21aea);})['then'](respondWithFilteredResult(_0x5383c0,_0x14e46d))[_0x2c49('0x48')](handleError(_0x5383c0,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 04ae827..1c82efd 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 _0xe2fe=['exports','events','setMaxListeners','update','remove','emit','hook'];(function(_0x42f7a3,_0x2ef719){var _0x3cace2=function(_0x21d251){while(--_0x21d251){_0x42f7a3['push'](_0x42f7a3['shift']());}};_0x3cace2(++_0x2ef719);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xee2f('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xee2f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xee2f('0x2'),'afterDestroy':_0xee2f('0x3')};function emitEvent(_0xe5ad8a){return function(_0x2d2b03,_0xcb45e6,_0x4ba89f){UserProfileEvents[_0xee2f('0x4')](_0xe5ad8a+':'+_0x2d2b03['id'],_0x2d2b03);UserProfileEvents[_0xee2f('0x4')](_0xe5ad8a,_0x2d2b03);_0x4ba89f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xee2f('0x5')](e,emitEvent(event));}}module[_0xee2f('0x6')]=UserProfileEvents; \ No newline at end of file +var _0x3d04=['UserProfile','setMaxListeners','save','update','remove','emit','events','../../mysqldb'];(function(_0x497a85,_0x2bd7cf){var _0x33207e=function(_0x56e9ec){while(--_0x56e9ec){_0x497a85['push'](_0x497a85['shift']());}};_0x33207e(++_0x2bd7cf);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x43d0('0x0'));var UserProfile=require(_0x43d0('0x1'))['db'][_0x43d0('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x43d0('0x3')](0x0);var events={'afterCreate':_0x43d0('0x4'),'afterUpdate':_0x43d0('0x5'),'afterDestroy':_0x43d0('0x6')};function emitEvent(_0x1f80fd){return function(_0x5a9e1d,_0x2a4d4c,_0x1a75d4){UserProfileEvents[_0x43d0('0x7')](_0x1f80fd+':'+_0x5a9e1d['id'],_0x5a9e1d);UserProfileEvents[_0x43d0('0x7')](_0x1f80fd,_0x5a9e1d);_0x1a75d4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index d353097..fc0256a 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 _0xf33a=['whatsappaccounts','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','User','Users','role','zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Template','triggers','trunks','Trunk','variables','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','user_has_','_interactions','where','sequelize','query','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','params','all','ignore','union','push','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','merge','VIRTUAL','foreignKey','options','includeAll','include','forEach','reportType','default','DefaultReports','custom','count','rows','ids','customSorting','extraQueryConditions','Tag','Tags','color','tag','openTabs','fax','mail','openchannel','dataValues','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','value','findAll','then','model','associatedResources','name','catch','resolve','UserProfileResource','field','map','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','projectName','projects','contacts','CmContact','parentSections','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','agent','Telephones','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues'];(function(_0x2a1fa3,_0x154c71){var _0x3e286f=function(_0x12145c){while(--_0x12145c){_0x2a1fa3['push'](_0x2a1fa3['shift']());}};_0x3e286f(++_0x154c71);}(_0xf33a,0x12a));var _0xaf33=function(_0x49a0f8,_0x21c323){_0x49a0f8=_0x49a0f8-0x0;var _0x4054fe=_0xf33a[_0x49a0f8];return _0x4054fe;};'use strict';var _=require(_0xaf33('0x0'));var attributes=require(_0xaf33('0x1'));var qs=require(_0xaf33('0x2'));var squel=require(_0xaf33('0x3'));module[_0xaf33('0x4')]=function(_0x597cfb){var _0x57b3dd=_0x597cfb[_0xaf33('0x5')];function _0x4ad1a8(_0x3c87d8,_0x4ddeb9){return new Promise(function(_0x15b9f1,_0x37f0e4){if(!_0x4ddeb9)return _0x15b9f1(null);var _0x26d4c9=_0x4ddeb9['filter']?{[_0x4ddeb9[_0xaf33('0x6')]['field']]:_0x4ddeb9[_0xaf33('0x6')][_0xaf33('0x7')]}:undefined;return _0x57b3dd[_0x3c87d8][_0xaf33('0x8')]({'where':_0x26d4c9,'raw':!![]})[_0xaf33('0x9')](function(_0x348fbb){_0x4ddeb9['associatedResources']=_['map'](_0x348fbb,'id');_0x15b9f1(_0x4ddeb9);})['catch'](function(_0x4bbd1c){_0x37f0e4(_0x4bbd1c);});});}function _0x19c8c6(_0x4f384c,_0x2fb9f8){return new Promise(function(_0x4b91da,_0xed15a4){var _0x1f5ab8=_0x4f384c['filter']?{[_0x4f384c[_0xaf33('0x6')]['field']]:_0x4f384c[_0xaf33('0x6')][_0xaf33('0x7')]}:undefined;return _0x57b3dd[_0x4f384c[_0xaf33('0xa')]][_0xaf33('0x8')]({'where':_0x1f5ab8,'raw':!![]})[_0xaf33('0x9')](function(_0x372732){_0x2fb9f8[_0xaf33('0xb')]=_['map'](_0x372732,function(_0x3b40e0){return _0x3b40e0[_0xaf33('0xc')];});_0x4b91da(_0x2fb9f8);})[_0xaf33('0xd')](function(_0x48fb62){_0xed15a4(_0x48fb62);});});}function _0x2ebb42(_0xb1b320,_0x1c7130,_0x13d824){if(!_0x1c7130)return Promise[_0xaf33('0xe')](null);return new Promise(function(_0x1a9543,_0xc0a724){return _0x57b3dd[_0xaf33('0xf')][_0xaf33('0x8')]({'where':{'sectionId':_0x1c7130['id']},'raw':!![]})['then'](function(_0x3e7201){if(_0xb1b320[_0xaf33('0x10')]&&_0xb1b320['field']!=='id'){_0x1c7130[_0xaf33('0xb')]=_[_0xaf33('0x11')](_0x3e7201,function(_0x858361){return _0x858361[_0xb1b320[_0xaf33('0x10')]];});}else{if(_0x13d824===_0xaf33('0x12')){_0x1c7130[_0xaf33('0xb')]=_[_0xaf33('0x11')](_0x3e7201,function(_0x43ead4){return{'id':_0x43ead4[_0xaf33('0x13')],'type':_0x43ead4[_0xaf33('0x14')]};});}else{_0x1c7130[_0xaf33('0xb')]=_['map'](_0x3e7201,function(_0x4a8d33){return _0x4a8d33[_0xaf33('0x13')];});}}_0x1a9543(_0x1c7130);})[_0xaf33('0xd')](function(_0x4aa69e){_0xc0a724(_0x4aa69e);});});}function _0x5b1e3d(_0x11a37e,_0x56c379){var _0x350172={'parentSections':[]};switch(_0x11a37e[_0xaf33('0x15')]()){case _0xaf33('0x16'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x18');break;case'odbc':_0x350172['childModel']=_0xaf33('0x19');break;case _0xaf33('0x1a'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x1b');_0x350172['parentSections']=[{'name':'SquareProjects','field':'name','foreignKey':_0xaf33('0x1c')}];break;case _0xaf33('0x1d'):_0x350172['childModel']='JscriptyProject';break;case _0xaf33('0x1e'):_0x350172['childModel']=_0xaf33('0x1f');_0x350172[_0xaf33('0x20')]=[{'name':_0xaf33('0x21'),'field':'id','foreignKey':_0xaf33('0x22')}];break;case _0xaf33('0x23'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x24');break;case _0xaf33('0x25'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x26');break;case _0xaf33('0x27'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x28');break;case _0xaf33('0x29'):_0x350172[_0xaf33('0x17')]='ChatQueue';break;case _0xaf33('0x2a'):_0x350172['childModel']='ChatWebsite';break;case'faxqueues':_0x350172[_0xaf33('0x17')]=_0xaf33('0x2b');break;case _0xaf33('0x2c'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x2d');break;case'inboundroutes':case _0xaf33('0x2e'):case _0xaf33('0x2f'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x30');break;case'contexts':_0x350172[_0xaf33('0x17')]=_0xaf33('0x31');break;case _0xaf33('0x32'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x33');break;case _0xaf33('0x34'):_0x350172[_0xaf33('0x17')]='VoiceRecording';_0x350172[_0xaf33('0x20')]=[{'name':_0xaf33('0x35'),'field':_0xaf33('0xc'),'foreignKey':_0xaf33('0x36'),'model':'User','filter':{'field':'role','value':[_0xaf33('0x37')]}},{'name':_0xaf33('0x38'),'field':'name','foreignKey':_0xaf33('0x36'),'model':'User','filter':{'field':'role','value':[_0xaf33('0x39')]}},{'name':'VoiceQueues','field':_0xaf33('0xc'),'foreignKey':_0xaf33('0x3a'),'model':_0xaf33('0x3b'),'filter':{'field':_0xaf33('0x14'),'value':[_0xaf33('0x3c')]}},{'name':_0xaf33('0x3d'),'field':_0xaf33('0xc'),'foreignKey':_0xaf33('0x3a'),'model':'VoiceQueue','filter':{'field':_0xaf33('0x14'),'value':[_0xaf33('0x3e')]}}];break;case'musiconholds':_0x350172[_0xaf33('0x17')]=_0xaf33('0x3f');break;case'chanspies':_0x350172[_0xaf33('0x17')]=_0xaf33('0x40');break;case _0xaf33('0x41'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x42');break;case _0xaf33('0x43'):_0x350172['childModel']='Campaign';break;case _0xaf33('0x44'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x45');break;case _0xaf33('0x46'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x47');break;case _0xaf33('0x48'):_0x350172['childModel']='MailSubstatus';break;case _0xaf33('0x49'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x4a');break;case'openchannelaccounts':_0x350172[_0xaf33('0x17')]='OpenchannelAccount';break;case _0xaf33('0x4b'):_0x350172['childModel']=_0xaf33('0x4c');break;case _0xaf33('0x4d'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x4e');break;case _0xaf33('0x4f'):_0x350172[_0xaf33('0x17')]='WhatsappQueue';break;case _0xaf33('0x50'):_0x350172[_0xaf33('0x17')]='WhatsappAccount';break;case'teams':_0x350172[_0xaf33('0x17')]=_0xaf33('0x51');break;case _0xaf33('0x52'):case _0xaf33('0x53'):_0x350172['childModel']=_0xaf33('0x3b');if(_0x56c379){_0x350172[_0xaf33('0x20')]=[{'name':_0xaf33('0x54')},{'name':_0xaf33('0x3d')}];}break;case _0xaf33('0x55'):case _0xaf33('0x56'):case'telephones':_0x350172[_0xaf33('0x17')]=_0xaf33('0x57');if(_0x56c379){_0x350172[_0xaf33('0x20')]=[{'name':_0xaf33('0x58'),'filter':{'field':_0xaf33('0x59'),'value':['admin','user']},'ignore':!![]},{'name':_0xaf33('0x35')},{'name':_0xaf33('0x38')}];}break;case _0xaf33('0x5a'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x5b');break;case'salesforceaccounts':_0x350172[_0xaf33('0x17')]=_0xaf33('0x5c');break;case'freshdeskaccounts':_0x350172[_0xaf33('0x17')]=_0xaf33('0x5d');break;case _0xaf33('0x5e'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x5f');break;case _0xaf33('0x60'):_0x350172['childModel']=_0xaf33('0x61');break;case'zohoaccounts':_0x350172['childModel']=_0xaf33('0x62');break;case'vtigeraccounts':_0x350172[_0xaf33('0x17')]=_0xaf33('0x57');break;case _0xaf33('0x63'):_0x350172['childModel']=_0xaf33('0x64');break;case _0xaf33('0x65'):_0x350172['childModel']='Disposition';break;case _0xaf33('0x66'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x67');break;case'intervals':_0x350172[_0xaf33('0x17')]='Interval';break;case _0xaf33('0x68'):_0x350172['childModel']=_0xaf33('0x69');break;case _0xaf33('0x6a'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x6b');break;case _0xaf33('0x6c'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x6d');break;case _0xaf33('0x6e'):_0x350172[_0xaf33('0x17')]='Tag';break;case'templates':_0x350172['childModel']=_0xaf33('0x6f');break;case _0xaf33('0x70'):_0x350172[_0xaf33('0x17')]='Trigger';break;case _0xaf33('0x71'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x72');break;case _0xaf33('0x73'):_0x350172[_0xaf33('0x17')]='Variable';break;case'plugins':_0x350172[_0xaf33('0x17')]=_0xaf33('0x74');break;case _0xaf33('0x75'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x12');_0x350172[_0xaf33('0x20')]=[{'name':_0xaf33('0x76'),'field':'id','foreignKey':_0xaf33('0x77')}];break;case _0xaf33('0x78'):_0x350172[_0xaf33('0x17')]=_0xaf33('0x79');break;}return _0x350172;}function _0x26d7bc(_0x560f77,_0x193e61){var _0x323e8e=_0x560f77['charAt'](0x0)[_0xaf33('0x7a')]()+_0x560f77[_0xaf33('0x7b')](0x1);var _0x255f7c={'type':_0x57b3dd[_0xaf33('0x7c')][_0xaf33('0x7d')][_0xaf33('0x7e')],'raw':!![]};return new Promise(function(_0x4825a6,_0x224a75){var _0x1e7569=squel[_0xaf33('0x7f')]()['field'](_0xaf33('0x80')+_0x323e8e+'InteractionId','id')['field'](_0xaf33('0x81'))['from'](_0xaf33('0x82')+_0x560f77+_0xaf33('0x83'),'ui')[_0xaf33('0x84')]('ui.UserId\x20=\x20?',_0x193e61['id']);return _0x57b3dd[_0xaf33('0x85')][_0xaf33('0x86')](_0x1e7569['toString'](),_0x255f7c)[_0xaf33('0x9')](function(_0xc9bfe6){_0x193e61[_0x323e8e+_0xaf33('0x87')]=_0xc9bfe6;_0x4825a6(_0xc9bfe6);})['catch'](function(_0x5067da){_0x224a75(_0x5067da);});});}return _0x597cfb[_0xaf33('0x88')](_0xaf33('0x89'),attributes,{'tableName':_0xaf33('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5e3108){var _0x41ec2b={'raw':_0x5e3108['query']['raw'],'where':{}};var _0x3ea063={};var _0xe0fbce={'count':0x0,'rows':[]};var _0x3ac51f=_0x5e3108[_0xaf33('0x86')][_0xaf33('0x8b')];var _0x1cfb56=_0x5e3108[_0xaf33('0x86')][_0xaf33('0x8c')]||![];var _0x37551d=_0x5b1e3d(_0x3ac51f,_0x1cfb56);if(!_0x37551d[_0xaf33('0x17')])throw new Error(_0xaf33('0x8d')+_0x3ac51f+'\x27');var _0x1ea6b5=[{'name':_0x3ac51f}];if(!_[_0xaf33('0x8e')](_0x37551d[_0xaf33('0x20')]))_0x1ea6b5=_0x37551d['parentSections'];var _0x19c6ba=[];for(var _0x5dcb98=0x0;_0x5dcb98<_0x1ea6b5[_0xaf33('0x8f')];_0x5dcb98++){_0x19c6ba['push'](_0x57b3dd[_0xaf33('0x90')][_0xaf33('0x91')]({'where':{'userProfileId':_0x5e3108[_0xaf33('0x92')]['id'],'name':_0x1ea6b5[_0x5dcb98][_0xaf33('0xc')]},'raw':!![]}));}return Promise[_0xaf33('0x93')](_0x19c6ba)[_0xaf33('0x9')](function(_0x5312ba){var _0x31a8af=_['filter'](_0x5312ba,function(_0x2c4ae8){return _0x2c4ae8?_0x2c4ae8:undefined;});var _0xb96d07=_[_0xaf33('0x6')](_0x1ea6b5,[_0xaf33('0x94'),!![]]);var _0x571419=_[_0xaf33('0x8e')](_0x31a8af)&&_[_0xaf33('0x8e')](_0xb96d07)?null:_[_0xaf33('0x95')](_0xb96d07,_0x31a8af);if(!_0x571419)return null;var _0xd8b3bc=[];for(var _0x3429d3=0x0;_0x3429d3<_0x571419[_0xaf33('0x8f')];_0x3429d3++){var _0x5f535b=_['find'](_0x1ea6b5,function(_0x537850){return _0x571419[_0x3429d3]?_0x537850[_0xaf33('0xc')]===_0x571419[_0x3429d3][_0xaf33('0xc')]:null;});if(_0x5f535b){if(_0x571419[_0x3429d3]['ignore']){_0xd8b3bc[_0xaf33('0x96')](_0x4ad1a8(_0x37551d[_0xaf33('0x17')],_0x571419[_0x3429d3]));}else{if(!_0x571419[_0x3429d3][_0xaf33('0x97')]){_0xd8b3bc['push'](_0x2ebb42(_0x5f535b,_0x571419[_0x3429d3],_0x37551d['childModel']));}else{if(_0x5f535b[_0xaf33('0xa')]){_0xd8b3bc['push'](_0x19c8c6(_0x5f535b,_0x571419[_0x3429d3]));}}}}}return Promise[_0xaf33('0x93')](_0xd8b3bc);})[_0xaf33('0x9')](function(_0x11e80a){var _0x2a3d6d=_0x11e80a;var _0x429466=null;if(_0x2a3d6d){_0x429466=_0x2a3d6d[_0xaf33('0x8f')]===0x1?_0x2a3d6d[0x0]:null;}if(!_0x429466&&!_0x2a3d6d)return _0xe0fbce;var _0x7d5536=_0x57b3dd[_0x37551d[_0xaf33('0x17')]][_0xaf33('0x98')];_0x3ea063['model']=_[_0xaf33('0x99')](_0x7d5536);_0x3ea063['query']=_[_0xaf33('0x99')](_0x5e3108[_0xaf33('0x86')]);_0x3ea063[_0xaf33('0x9a')]=_[_0xaf33('0x9b')](_0x3ea063[_0xaf33('0xa')],_0x3ea063[_0xaf33('0x86')]);_0x41ec2b[_0xaf33('0x9c')]=_[_0xaf33('0x9b')](_0x3ea063['model'],qs[_0xaf33('0x9d')](_0x5e3108['query']['fields']));_0x41ec2b[_0xaf33('0x9c')]=_0x41ec2b[_0xaf33('0x9c')][_0xaf33('0x8f')]?_0x41ec2b['attributes']:_0x3ea063[_0xaf33('0xa')];if(!_0x5e3108[_0xaf33('0x86')]['hasOwnProperty'](_0xaf33('0x9e'))){_0x41ec2b[_0xaf33('0x9f')]=qs[_0xaf33('0x9f')](_0x5e3108[_0xaf33('0x86')][_0xaf33('0x9f')]);_0x41ec2b[_0xaf33('0xa0')]=qs[_0xaf33('0xa0')](_0x5e3108['query']['offset']);}_0x41ec2b[_0xaf33('0xa1')]=qs[_0xaf33('0xa2')](_0x5e3108['query'][_0xaf33('0xa2')]);_0x41ec2b[_0xaf33('0x84')]=qs[_0xaf33('0x9a')](_['pick'](_0x5e3108[_0xaf33('0x86')],_0x3ea063['filters']));if(_0x5e3108[_0xaf33('0x86')]['filter']){_0x41ec2b[_0xaf33('0x84')]=_[_0xaf33('0xa3')](_0x41ec2b[_0xaf33('0x84')],{'$or':_[_0xaf33('0x11')](_0x7d5536,function(_0x565485){if(_0x565485['type']['key']!==_0xaf33('0xa4')){var _0x3de490={};_0x3de490[_0x565485['field']]={'$like':'%'+_0x5e3108['query'][_0xaf33('0x6')]+'%'};return _0x3de490;}})});}var _0x309f0a=[];var _0x1245a3=null;var _0x502b56={};if(_0x429466){_0x1245a3=_['find'](_0x1ea6b5,['name',_0x429466[_0xaf33('0xc')]]);if(_0x1245a3[_0xaf33('0x10')]){_0x502b56={};if(_0x37551d[_0xaf33('0x17')]===_0xaf33('0x12')){_0x502b56[_0x1245a3['foreignKey']]=_[_0xaf33('0x11')](_0x429466[_0xaf33('0xb')],'id');}else{_0x502b56[_0x1245a3[_0xaf33('0xa5')]]=_0x429466[_0xaf33('0xb')];}_0x309f0a[_0xaf33('0x96')](_0x502b56);}else{_0x41ec2b[_0xaf33('0x84')]['id']=_0x429466[_0xaf33('0xb')];}}else{for(var _0x433b14=0x0;_0x433b14<_0x2a3d6d[_0xaf33('0x8f')];_0x433b14++){_0x1245a3=_[_0xaf33('0x91')](_0x1ea6b5,[_0xaf33('0xc'),_0x2a3d6d[_0x433b14][_0xaf33('0xc')]]);if(_0x1245a3['field']){_0x502b56={};_0x502b56[_0x1245a3['foreignKey']]=_0x2a3d6d[_0x433b14]['associatedResources'];_0x309f0a[_0xaf33('0x96')](_0x502b56);}else{if(!_0x41ec2b[_0xaf33('0x84')]['id'])_0x41ec2b[_0xaf33('0x84')]['id']=[];_0x2a3d6d[_0x433b14][_0xaf33('0xb')]['forEach'](function(_0x4c6402){_0x41ec2b['where']['id'][_0xaf33('0x96')](_0x4c6402);});}}}if(!_['isEmpty'](_0x309f0a)){_0x41ec2b['where']=_[_0xaf33('0xa3')](_0x41ec2b[_0xaf33('0x84')],{'$and':{'$or':_0x309f0a}});}_0x41ec2b=_[_0xaf33('0xa3')]({},_0x41ec2b,_0x5e3108[_0xaf33('0xa6')]);if(_0x429466&&!_0x429466[_0xaf33('0x97')]&&_0x37551d[_0xaf33('0x17')]===_0xaf33('0x12')){if(_0x5e3108[_0xaf33('0x86')][_0xaf33('0xa7')]){_0x41ec2b[_0xaf33('0xa8')]=[{'all':!![]}];}return _0x57b3dd[_0x37551d[_0xaf33('0x17')]][_0xaf33('0x8')](_0x41ec2b)[_0xaf33('0x9')](function(_0x4dd06e){var _0x10d9c9=[];_0x4dd06e[_0xaf33('0xa9')](function(_0x3e3f06){var _0x527ac5;switch(_0x3e3f06[_0xaf33('0xaa')]){case _0xaf33('0xab'):_0x527ac5=_['find'](_0x429466[_0xaf33('0xb')],function(_0x30dbe7){return _0x30dbe7['id']===_0x3e3f06['reportId']&&_0x30dbe7[_0xaf33('0x14')]===_0xaf33('0xac');});break;case _0xaf33('0xad'):_0x527ac5=_[_0xaf33('0x91')](_0x429466[_0xaf33('0xb')],function(_0x253291){return _0x253291['id']===_0x3e3f06[_0xaf33('0x77')]&&_0x253291[_0xaf33('0x14')]==='CustomReports';});break;}if(_0x527ac5)_0x10d9c9[_0xaf33('0x96')](_0x3e3f06);});_0xe0fbce[_0xaf33('0xae')]=_0x10d9c9[_0xaf33('0x8f')];_0xe0fbce[_0xaf33('0xaf')]=_0x10d9c9;return _0xe0fbce;});}else{if(!_[_0xaf33('0x8e')](_0x5e3108[_0xaf33('0x86')][_0xaf33('0xb0')])){_0x41ec2b[_0xaf33('0x84')]['id']=_0x41ec2b[_0xaf33('0x84')]['id']?_['intersection'](_0x41ec2b[_0xaf33('0x84')]['id'],_0x5e3108[_0xaf33('0x86')]['ids']):_0x5e3108[_0xaf33('0x86')]['ids'];if(_0x5e3108[_0xaf33('0x86')][_0xaf33('0xb1')]){_0x41ec2b[_0xaf33('0xa1')]=_0x5e3108[_0xaf33('0x86')]['customSorting'];}}if(_0x5e3108[_0xaf33('0x86')][_0xaf33('0xb2')]){_0x41ec2b[_0xaf33('0x84')]=_[_0xaf33('0xa3')](_0x41ec2b[_0xaf33('0x84')],{'$and':_0x5e3108[_0xaf33('0x86')][_0xaf33('0xb2')]});}return _0x57b3dd[_0x37551d['childModel']][_0xaf33('0xae')]({'where':_0x41ec2b['where']})['then'](function(_0x3e8ddd){_0xe0fbce[_0xaf33('0xae')]=_0x3e8ddd;if(_0x5e3108[_0xaf33('0x86')][_0xaf33('0xa7')]){if(_0x37551d['childModel']===_0xaf33('0x1f')){_0x41ec2b['include']=[{'model':_0x57b3dd[_0xaf33('0xb3')],'as':_0xaf33('0xb4'),'attributes':['id',_0xaf33('0xc'),_0xaf33('0xb5')],'required':_0x5e3108[_0xaf33('0x86')]['tag']?!![]:![]},{'model':_0x57b3dd[_0xaf33('0xb3')],'as':'ThroughTags','attributes':['id',_0xaf33('0xc'),_0xaf33('0xb5')],'through':_0x5e3108['query']['tag']?{'attributes':[],'where':{'TagId':_0x5e3108['query'][_0xaf33('0xb6')]||undefined}}:{},'required':_0x5e3108[_0xaf33('0x86')]['tag']?!![]:![]}];}else{_0x41ec2b[_0xaf33('0xa8')]=[{'all':!![]}];}}return _0x57b3dd[_0x37551d[_0xaf33('0x17')]]['findAll'](_0x41ec2b);})[_0xaf33('0x9')](function(_0x58a242){_0xe0fbce[_0xaf33('0xaf')]=_0x58a242;if(_0x3ac51f==='Agents'&&_0x5e3108[_0xaf33('0x86')][_0xaf33('0xb7')]==='true'){var _0x1d7dbf=[];for(var _0x1170f7=0x0;_0x1170f7<_0xe0fbce[_0xaf33('0xaf')][_0xaf33('0x8f')];_0x1170f7++){_0x1d7dbf['push'](_0x26d7bc('chat',_0xe0fbce[_0xaf33('0xaf')][_0x1170f7]['dataValues']));_0x1d7dbf[_0xaf33('0x96')](_0x26d7bc('sms',_0xe0fbce[_0xaf33('0xaf')][_0x1170f7]['dataValues']));_0x1d7dbf[_0xaf33('0x96')](_0x26d7bc(_0xaf33('0xb8'),_0xe0fbce[_0xaf33('0xaf')][_0x1170f7]['dataValues']));_0x1d7dbf[_0xaf33('0x96')](_0x26d7bc(_0xaf33('0xb9'),_0xe0fbce[_0xaf33('0xaf')][_0x1170f7]['dataValues']));_0x1d7dbf['push'](_0x26d7bc(_0xaf33('0xba'),_0xe0fbce[_0xaf33('0xaf')][_0x1170f7][_0xaf33('0xbb')]));_0x1d7dbf['push'](_0x26d7bc(_0xaf33('0xbc'),_0xe0fbce[_0xaf33('0xaf')][_0x1170f7][_0xaf33('0xbb')]));}return Promise[_0xaf33('0x93')](_0x1d7dbf)[_0xaf33('0x9')](function(){return _0xe0fbce;});}return _0xe0fbce;});}});}}});}; \ No newline at end of file +var _0xbb86=['musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','user','Agents','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','tags','Tag','templates','triggers','Trigger','trunks','Trunk','Variable','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','isEmpty','UserProfileSection','params','union','length','ignore','autoAssociation','push','rawAttributes','model','keys','filters','intersection','attributes','fields','limit','offset','order','sort','pick','merge','key','find','foreignKey','options','includeAll','forEach','default','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','include','Tags','tag','ThroughTags','color','openTabs','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','value','then','findAll','associatedResources','map','name','catch','resolve','AnalyticExtractedReport','type','resourceId','squareprojects','childModel','odbc','SquareOdbc','SquareRecording','projectName','projects','contacts','CmContact','ListId','lists','CmList','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','voicerecordings','VoiceRecording','parentSections','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xbb86,0x8d));var _0x6bb8=function(_0x13c4eb,_0x5d218c){_0x13c4eb=_0x13c4eb-0x0;var _0x421546=_0xbb86[_0x13c4eb];return _0x421546;};'use strict';var _=require(_0x6bb8('0x0'));var attributes=require(_0x6bb8('0x1'));var qs=require(_0x6bb8('0x2'));var squel=require('squel');module[_0x6bb8('0x3')]=function(_0x1ce3ec){var _0x43ab6a=_0x1ce3ec[_0x6bb8('0x4')];function _0x56365(_0x20ed09,_0x4162eb){return new Promise(function(_0xd2d14f,_0x1835ff){if(!_0x4162eb)return _0xd2d14f(null);var _0x30fc28=_0x4162eb['filter']?{[_0x4162eb[_0x6bb8('0x5')][_0x6bb8('0x6')]]:_0x4162eb[_0x6bb8('0x5')][_0x6bb8('0x7')]}:undefined;return _0x43ab6a[_0x20ed09]['findAll']({'where':_0x30fc28,'raw':!![]})[_0x6bb8('0x8')](function(_0x17db12){_0x4162eb['associatedResources']=_['map'](_0x17db12,'id');_0xd2d14f(_0x4162eb);})['catch'](function(_0x3cbcb3){_0x1835ff(_0x3cbcb3);});});}function _0x1a50a5(_0x5abf95,_0x101206){return new Promise(function(_0x5a9f6b,_0x50f583){var _0x42abb2=_0x5abf95[_0x6bb8('0x5')]?{[_0x5abf95[_0x6bb8('0x5')][_0x6bb8('0x6')]]:_0x5abf95['filter'][_0x6bb8('0x7')]}:undefined;return _0x43ab6a[_0x5abf95['model']][_0x6bb8('0x9')]({'where':_0x42abb2,'raw':!![]})[_0x6bb8('0x8')](function(_0xfd800){_0x101206[_0x6bb8('0xa')]=_[_0x6bb8('0xb')](_0xfd800,function(_0x59ceb6){return _0x59ceb6[_0x6bb8('0xc')];});_0x5a9f6b(_0x101206);})[_0x6bb8('0xd')](function(_0xf63a36){_0x50f583(_0xf63a36);});});}function _0x495884(_0x486253,_0x465284,_0x43a441){if(!_0x465284)return Promise[_0x6bb8('0xe')](null);return new Promise(function(_0x45d185,_0x1ab2bb){return _0x43ab6a['UserProfileResource'][_0x6bb8('0x9')]({'where':{'sectionId':_0x465284['id']},'raw':!![]})[_0x6bb8('0x8')](function(_0x54cb48){if(_0x486253[_0x6bb8('0x6')]&&_0x486253[_0x6bb8('0x6')]!=='id'){_0x465284[_0x6bb8('0xa')]=_[_0x6bb8('0xb')](_0x54cb48,function(_0x47e6b){return _0x47e6b[_0x486253[_0x6bb8('0x6')]];});}else{if(_0x43a441===_0x6bb8('0xf')){_0x465284['associatedResources']=_['map'](_0x54cb48,function(_0x33bbef){return{'id':_0x33bbef['resourceId'],'type':_0x33bbef[_0x6bb8('0x10')]};});}else{_0x465284[_0x6bb8('0xa')]=_[_0x6bb8('0xb')](_0x54cb48,function(_0x17a0ef){return _0x17a0ef[_0x6bb8('0x11')];});}}_0x45d185(_0x465284);})['catch'](function(_0x38e928){_0x1ab2bb(_0x38e928);});});}function _0xa632e(_0x4801c9,_0x2f1719){var _0x47c028={'parentSections':[]};switch(_0x4801c9['toLowerCase']()){case _0x6bb8('0x12'):_0x47c028[_0x6bb8('0x13')]='SquareProject';break;case _0x6bb8('0x14'):_0x47c028['childModel']=_0x6bb8('0x15');break;case'squarerecordings':_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x16');_0x47c028['parentSections']=[{'name':'SquareProjects','field':_0x6bb8('0xc'),'foreignKey':_0x6bb8('0x17')}];break;case _0x6bb8('0x18'):_0x47c028['childModel']='JscriptyProject';break;case _0x6bb8('0x19'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x1a');_0x47c028['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x6bb8('0x1b')}];break;case _0x6bb8('0x1c'):_0x47c028['childModel']=_0x6bb8('0x1d');break;case _0x6bb8('0x1e'):_0x47c028['childModel']=_0x6bb8('0x1f');break;case'globalcustomfields':_0x47c028[_0x6bb8('0x13')]='CmCustomField';break;case _0x6bb8('0x20'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x21');break;case _0x6bb8('0x22'):_0x47c028[_0x6bb8('0x13')]='ChatWebsite';break;case _0x6bb8('0x23'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x24');break;case _0x6bb8('0x25'):_0x47c028['childModel']=_0x6bb8('0x26');break;case _0x6bb8('0x27'):case _0x6bb8('0x28'):case _0x6bb8('0x29'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x2a');break;case _0x6bb8('0x2b'):_0x47c028[_0x6bb8('0x13')]='VoiceContext';break;case _0x6bb8('0x2c'):_0x47c028['childModel']='VoiceMail';break;case _0x6bb8('0x2d'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x2e');_0x47c028[_0x6bb8('0x2f')]=[{'name':'Agents','field':_0x6bb8('0xc'),'foreignKey':_0x6bb8('0x30'),'model':_0x6bb8('0x31'),'filter':{'field':_0x6bb8('0x32'),'value':[_0x6bb8('0x33')]}},{'name':_0x6bb8('0x34'),'field':'name','foreignKey':'membername','model':'User','filter':{'field':_0x6bb8('0x32'),'value':[_0x6bb8('0x35')]}},{'name':_0x6bb8('0x36'),'field':_0x6bb8('0xc'),'foreignKey':_0x6bb8('0x37'),'model':_0x6bb8('0x38'),'filter':{'field':_0x6bb8('0x10'),'value':['inbound']}},{'name':_0x6bb8('0x39'),'field':_0x6bb8('0xc'),'foreignKey':_0x6bb8('0x37'),'model':_0x6bb8('0x38'),'filter':{'field':_0x6bb8('0x10'),'value':[_0x6bb8('0x3a')]}}];break;case _0x6bb8('0x3b'):_0x47c028['childModel']=_0x6bb8('0x3c');break;case _0x6bb8('0x3d'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x3e');break;case'voiceprefixes':_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x3f');break;case'ivrcampaigns':_0x47c028['childModel']=_0x6bb8('0x40');break;case _0x6bb8('0x41'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x42');break;case _0x6bb8('0x43'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x44');break;case _0x6bb8('0x45'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x46');break;case _0x6bb8('0x47'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x48');break;case _0x6bb8('0x49'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x4a');break;case _0x6bb8('0x4b'):_0x47c028['childModel']=_0x6bb8('0x4c');break;case _0x6bb8('0x4d'):_0x47c028['childModel']='SmsAccount';break;case _0x6bb8('0x4e'):_0x47c028['childModel']=_0x6bb8('0x4f');break;case _0x6bb8('0x50'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x51');break;case _0x6bb8('0x52'):_0x47c028['childModel']=_0x6bb8('0x53');break;case _0x6bb8('0x54'):case _0x6bb8('0x55'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x38');if(_0x2f1719){_0x47c028[_0x6bb8('0x2f')]=[{'name':'VoiceQueues'},{'name':_0x6bb8('0x39')}];}break;case _0x6bb8('0x56'):case _0x6bb8('0x57'):case _0x6bb8('0x58'):_0x47c028[_0x6bb8('0x13')]='User';if(_0x2f1719){_0x47c028[_0x6bb8('0x2f')]=[{'name':_0x6bb8('0x59'),'filter':{'field':_0x6bb8('0x32'),'value':['admin',_0x6bb8('0x5a')]},'ignore':!![]},{'name':_0x6bb8('0x5b')},{'name':_0x6bb8('0x34')}];}break;case'zendeskaccounts':_0x47c028['childModel']=_0x6bb8('0x5c');break;case _0x6bb8('0x5d'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x5e');break;case'freshdeskaccounts':_0x47c028[_0x6bb8('0x13')]='FreshdeskAccount';break;case _0x6bb8('0x5f'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x60');break;case _0x6bb8('0x61'):_0x47c028[_0x6bb8('0x13')]='DeskAccount';break;case _0x6bb8('0x62'):_0x47c028[_0x6bb8('0x13')]='ZohoAccount';break;case _0x6bb8('0x63'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x31');break;case _0x6bb8('0x64'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x65');break;case _0x6bb8('0x66'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x67');break;case _0x6bb8('0x68'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x69');break;case _0x6bb8('0x6a'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x6b');break;case _0x6bb8('0x6c'):_0x47c028['childModel']=_0x6bb8('0x6d');break;case'scheduler':_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x6e');break;case _0x6bb8('0x6f'):_0x47c028[_0x6bb8('0x13')]='Sound';break;case _0x6bb8('0x70'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x71');break;case _0x6bb8('0x72'):_0x47c028['childModel']='Template';break;case _0x6bb8('0x73'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x74');break;case _0x6bb8('0x75'):_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x76');break;case'variables':_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x77');break;case'plugins':_0x47c028[_0x6bb8('0x13')]=_0x6bb8('0x78');break;case _0x6bb8('0x79'):_0x47c028['childModel']=_0x6bb8('0xf');_0x47c028[_0x6bb8('0x2f')]=[{'name':_0x6bb8('0x7a'),'field':'id','foreignKey':_0x6bb8('0x7b')}];break;case _0x6bb8('0x7c'):_0x47c028['childModel']=_0x6bb8('0x7d');break;}return _0x47c028;}function _0x5315ef(_0x59d595,_0x2e80d7){var _0x391b01=_0x59d595[_0x6bb8('0x7e')](0x0)[_0x6bb8('0x7f')]()+_0x59d595[_0x6bb8('0x80')](0x1);var _0x33ba88={'type':_0x43ab6a[_0x6bb8('0x81')][_0x6bb8('0x82')][_0x6bb8('0x83')],'raw':!![]};return new Promise(function(_0x5673da,_0x3b0635){var _0x3eb99b=squel[_0x6bb8('0x84')]()[_0x6bb8('0x6')](_0x6bb8('0x85')+_0x391b01+_0x6bb8('0x86'),'id')[_0x6bb8('0x6')](_0x6bb8('0x87'))[_0x6bb8('0x88')]('user_has_'+_0x59d595+_0x6bb8('0x89'),'ui')[_0x6bb8('0x8a')](_0x6bb8('0x8b'),_0x2e80d7['id']);return _0x43ab6a[_0x6bb8('0x8c')][_0x6bb8('0x8d')](_0x3eb99b[_0x6bb8('0x8e')](),_0x33ba88)[_0x6bb8('0x8')](function(_0x26f086){_0x2e80d7[_0x391b01+_0x6bb8('0x8f')]=_0x26f086;_0x5673da(_0x26f086);})['catch'](function(_0x680745){_0x3b0635(_0x680745);});});}return _0x1ce3ec[_0x6bb8('0x90')](_0x6bb8('0x91'),attributes,{'tableName':_0x6bb8('0x92'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xac4431){var _0x33291a={'raw':_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0x93')],'where':{}};var _0x32ca06={};var _0x5d2834={'count':0x0,'rows':[]};var _0x1a04e2=_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0x94')];var _0x26e5de=_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0x95')]||![];var _0x251d13=_0xa632e(_0x1a04e2,_0x26e5de);if(!_0x251d13[_0x6bb8('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x1a04e2+'\x27');var _0x28c862=[{'name':_0x1a04e2}];if(!_[_0x6bb8('0x96')](_0x251d13[_0x6bb8('0x2f')]))_0x28c862=_0x251d13[_0x6bb8('0x2f')];var _0x5bf2a1=[];for(var _0x3d3a68=0x0;_0x3d3a68<_0x28c862['length'];_0x3d3a68++){_0x5bf2a1['push'](_0x43ab6a[_0x6bb8('0x97')]['find']({'where':{'userProfileId':_0xac4431[_0x6bb8('0x98')]['id'],'name':_0x28c862[_0x3d3a68]['name']},'raw':!![]}));}return Promise['all'](_0x5bf2a1)[_0x6bb8('0x8')](function(_0x49fcd3){var _0x430c47=_[_0x6bb8('0x5')](_0x49fcd3,function(_0x1f25cc){return _0x1f25cc?_0x1f25cc:undefined;});var _0x11e436=_[_0x6bb8('0x5')](_0x28c862,['ignore',!![]]);var _0x279afb=_[_0x6bb8('0x96')](_0x430c47)&&_[_0x6bb8('0x96')](_0x11e436)?null:_[_0x6bb8('0x99')](_0x11e436,_0x430c47);if(!_0x279afb)return null;var _0x101374=[];for(var _0x2b4311=0x0;_0x2b4311<_0x279afb[_0x6bb8('0x9a')];_0x2b4311++){var _0x4ef622=_['find'](_0x28c862,function(_0x217fda){return _0x279afb[_0x2b4311]?_0x217fda[_0x6bb8('0xc')]===_0x279afb[_0x2b4311][_0x6bb8('0xc')]:null;});if(_0x4ef622){if(_0x279afb[_0x2b4311][_0x6bb8('0x9b')]){_0x101374['push'](_0x56365(_0x251d13[_0x6bb8('0x13')],_0x279afb[_0x2b4311]));}else{if(!_0x279afb[_0x2b4311][_0x6bb8('0x9c')]){_0x101374[_0x6bb8('0x9d')](_0x495884(_0x4ef622,_0x279afb[_0x2b4311],_0x251d13['childModel']));}else{if(_0x4ef622['model']){_0x101374[_0x6bb8('0x9d')](_0x1a50a5(_0x4ef622,_0x279afb[_0x2b4311]));}}}}}return Promise['all'](_0x101374);})[_0x6bb8('0x8')](function(_0x2e6420){var _0x5f1b97=_0x2e6420;var _0xd35263=null;if(_0x5f1b97){_0xd35263=_0x5f1b97['length']===0x1?_0x5f1b97[0x0]:null;}if(!_0xd35263&&!_0x5f1b97)return _0x5d2834;var _0xab799a=_0x43ab6a[_0x251d13['childModel']][_0x6bb8('0x9e')];_0x32ca06[_0x6bb8('0x9f')]=_[_0x6bb8('0xa0')](_0xab799a);_0x32ca06[_0x6bb8('0x8d')]=_[_0x6bb8('0xa0')](_0xac4431[_0x6bb8('0x8d')]);_0x32ca06[_0x6bb8('0xa1')]=_[_0x6bb8('0xa2')](_0x32ca06['model'],_0x32ca06['query']);_0x33291a[_0x6bb8('0xa3')]=_[_0x6bb8('0xa2')](_0x32ca06[_0x6bb8('0x9f')],qs['fields'](_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0xa4')]));_0x33291a['attributes']=_0x33291a[_0x6bb8('0xa3')][_0x6bb8('0x9a')]?_0x33291a[_0x6bb8('0xa3')]:_0x32ca06[_0x6bb8('0x9f')];if(!_0xac4431['query']['hasOwnProperty']('nolimit')){_0x33291a['limit']=qs[_0x6bb8('0xa5')](_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0xa5')]);_0x33291a[_0x6bb8('0xa6')]=qs[_0x6bb8('0xa6')](_0xac4431[_0x6bb8('0x8d')]['offset']);}_0x33291a[_0x6bb8('0xa7')]=qs['sort'](_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0xa8')]);_0x33291a[_0x6bb8('0x8a')]=qs[_0x6bb8('0xa1')](_[_0x6bb8('0xa9')](_0xac4431[_0x6bb8('0x8d')],_0x32ca06[_0x6bb8('0xa1')]));if(_0xac4431[_0x6bb8('0x8d')]['filter']){_0x33291a[_0x6bb8('0x8a')]=_[_0x6bb8('0xaa')](_0x33291a[_0x6bb8('0x8a')],{'$or':_['map'](_0xab799a,function(_0x2bf07b){if(_0x2bf07b['type'][_0x6bb8('0xab')]!=='VIRTUAL'){var _0x2e777a={};_0x2e777a[_0x2bf07b[_0x6bb8('0x6')]]={'$like':'%'+_0xac4431['query'][_0x6bb8('0x5')]+'%'};return _0x2e777a;}})});}var _0x433475=[];var _0x5d8a81=null;var _0x33269d={};if(_0xd35263){_0x5d8a81=_[_0x6bb8('0xac')](_0x28c862,[_0x6bb8('0xc'),_0xd35263[_0x6bb8('0xc')]]);if(_0x5d8a81[_0x6bb8('0x6')]){_0x33269d={};if(_0x251d13[_0x6bb8('0x13')]===_0x6bb8('0xf')){_0x33269d[_0x5d8a81[_0x6bb8('0xad')]]=_[_0x6bb8('0xb')](_0xd35263[_0x6bb8('0xa')],'id');}else{_0x33269d[_0x5d8a81[_0x6bb8('0xad')]]=_0xd35263[_0x6bb8('0xa')];}_0x433475[_0x6bb8('0x9d')](_0x33269d);}else{_0x33291a[_0x6bb8('0x8a')]['id']=_0xd35263['associatedResources'];}}else{for(var _0x3a3a63=0x0;_0x3a3a63<_0x5f1b97[_0x6bb8('0x9a')];_0x3a3a63++){_0x5d8a81=_[_0x6bb8('0xac')](_0x28c862,[_0x6bb8('0xc'),_0x5f1b97[_0x3a3a63]['name']]);if(_0x5d8a81[_0x6bb8('0x6')]){_0x33269d={};_0x33269d[_0x5d8a81[_0x6bb8('0xad')]]=_0x5f1b97[_0x3a3a63][_0x6bb8('0xa')];_0x433475[_0x6bb8('0x9d')](_0x33269d);}else{if(!_0x33291a[_0x6bb8('0x8a')]['id'])_0x33291a[_0x6bb8('0x8a')]['id']=[];_0x5f1b97[_0x3a3a63][_0x6bb8('0xa')]['forEach'](function(_0x4ebda8){_0x33291a[_0x6bb8('0x8a')]['id'][_0x6bb8('0x9d')](_0x4ebda8);});}}}if(!_['isEmpty'](_0x433475)){_0x33291a[_0x6bb8('0x8a')]=_[_0x6bb8('0xaa')](_0x33291a[_0x6bb8('0x8a')],{'$and':{'$or':_0x433475}});}_0x33291a=_['merge']({},_0x33291a,_0xac4431[_0x6bb8('0xae')]);if(_0xd35263&&!_0xd35263[_0x6bb8('0x9c')]&&_0x251d13['childModel']===_0x6bb8('0xf')){if(_0xac4431['query'][_0x6bb8('0xaf')]){_0x33291a['include']=[{'all':!![]}];}return _0x43ab6a[_0x251d13[_0x6bb8('0x13')]][_0x6bb8('0x9')](_0x33291a)[_0x6bb8('0x8')](function(_0xf21c6a){var _0x4cb1e6=[];_0xf21c6a[_0x6bb8('0xb0')](function(_0x14d4db){var _0x27c411;switch(_0x14d4db['reportType']){case _0x6bb8('0xb1'):_0x27c411=_[_0x6bb8('0xac')](_0xd35263['associatedResources'],function(_0x53e3be){return _0x53e3be['id']===_0x14d4db[_0x6bb8('0x7b')]&&_0x53e3be['type']===_0x6bb8('0xb2');});break;case _0x6bb8('0xb3'):_0x27c411=_[_0x6bb8('0xac')](_0xd35263[_0x6bb8('0xa')],function(_0x5154e3){return _0x5154e3['id']===_0x14d4db[_0x6bb8('0x7b')]&&_0x5154e3[_0x6bb8('0x10')]===_0x6bb8('0xb4');});break;}if(_0x27c411)_0x4cb1e6['push'](_0x14d4db);});_0x5d2834['count']=_0x4cb1e6[_0x6bb8('0x9a')];_0x5d2834[_0x6bb8('0xb5')]=_0x4cb1e6;return _0x5d2834;});}else{if(!_[_0x6bb8('0x96')](_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0xb6')])){_0x33291a['where']['id']=_0x33291a[_0x6bb8('0x8a')]['id']?_[_0x6bb8('0xa2')](_0x33291a[_0x6bb8('0x8a')]['id'],_0xac4431['query'][_0x6bb8('0xb6')]):_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0xb6')];if(_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0xb7')]){_0x33291a[_0x6bb8('0xa7')]=_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0xb7')];}}if(_0xac4431[_0x6bb8('0x8d')]['extraQueryConditions']){_0x33291a[_0x6bb8('0x8a')]=_[_0x6bb8('0xaa')](_0x33291a['where'],{'$and':_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0xb8')]});}return _0x43ab6a[_0x251d13[_0x6bb8('0x13')]][_0x6bb8('0xb9')]({'where':_0x33291a[_0x6bb8('0x8a')]})[_0x6bb8('0x8')](function(_0x1dcd04){_0x5d2834[_0x6bb8('0xb9')]=_0x1dcd04;if(_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0xaf')]){if(_0x251d13['childModel']===_0x6bb8('0x1a')){_0x33291a[_0x6bb8('0xba')]=[{'model':_0x43ab6a['Tag'],'as':_0x6bb8('0xbb'),'attributes':['id',_0x6bb8('0xc'),'color'],'required':_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0xbc')]?!![]:![]},{'model':_0x43ab6a[_0x6bb8('0x71')],'as':_0x6bb8('0xbd'),'attributes':['id','name',_0x6bb8('0xbe')],'through':_0xac4431[_0x6bb8('0x8d')]['tag']?{'attributes':[],'where':{'TagId':_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0xbc')]||undefined}}:{},'required':_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0xbc')]?!![]:![]}];}else{_0x33291a[_0x6bb8('0xba')]=[{'all':!![]}];}}return _0x43ab6a[_0x251d13['childModel']][_0x6bb8('0x9')](_0x33291a);})[_0x6bb8('0x8')](function(_0x362af0){_0x5d2834[_0x6bb8('0xb5')]=_0x362af0;if(_0x1a04e2===_0x6bb8('0x5b')&&_0xac4431[_0x6bb8('0x8d')][_0x6bb8('0xbf')]==='true'){var _0x38aa12=[];for(var _0x541b39=0x0;_0x541b39<_0x5d2834[_0x6bb8('0xb5')]['length'];_0x541b39++){_0x38aa12[_0x6bb8('0x9d')](_0x5315ef(_0x6bb8('0xc0'),_0x5d2834[_0x6bb8('0xb5')][_0x541b39][_0x6bb8('0xc1')]));_0x38aa12[_0x6bb8('0x9d')](_0x5315ef(_0x6bb8('0xc2'),_0x5d2834[_0x6bb8('0xb5')][_0x541b39][_0x6bb8('0xc1')]));_0x38aa12['push'](_0x5315ef(_0x6bb8('0xc3'),_0x5d2834[_0x6bb8('0xb5')][_0x541b39][_0x6bb8('0xc1')]));_0x38aa12[_0x6bb8('0x9d')](_0x5315ef(_0x6bb8('0xc4'),_0x5d2834['rows'][_0x541b39][_0x6bb8('0xc1')]));_0x38aa12['push'](_0x5315ef(_0x6bb8('0xc5'),_0x5d2834[_0x6bb8('0xb5')][_0x541b39][_0x6bb8('0xc1')]));_0x38aa12[_0x6bb8('0x9d')](_0x5315ef(_0x6bb8('0xc6'),_0x5d2834[_0x6bb8('0xb5')][_0x541b39]['dataValues']));}return Promise[_0x6bb8('0xc7')](_0x38aa12)[_0x6bb8('0x8')](function(){return _0x5d2834;});}return _0x5d2834;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index dae0d89..5858199 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 _0x07fa=['message','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','defaults','./userProfile.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','UserProfile,\x20%s,\x20%s'];(function(_0x16818d,_0x1b85a6){var _0x2edfeb=function(_0x58811d){while(--_0x58811d){_0x16818d['push'](_0x16818d['shift']());}};_0x2edfeb(++_0x1b85a6);}(_0x07fa,0x177));var _0xa07f=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x07fa[_0xa148b7];return _0x51efd3;};'use strict';var _=require('lodash');var util=require(_0xa07f('0x0'));var moment=require(_0xa07f('0x1'));var BPromise=require(_0xa07f('0x2'));var rs=require(_0xa07f('0x3'));var fs=require('fs');var Redis=require(_0xa07f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa07f('0x5'));var logger=require(_0xa07f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa07f('0x7')][_0xa07f('0x8')]({'port':0x232a});config['redis']=_[_0xa07f('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa07f('0xa'))[_0xa07f('0xb')](socket);function respondWithRpcPromise(_0x5812ff,_0xd3bdbf,_0x4401fa){return new BPromise(function(_0x151dda,_0x3679de){return client[_0xa07f('0xc')](_0x5812ff,_0x4401fa)[_0xa07f('0xd')](function(_0x7873c2){logger[_0xa07f('0xe')]('UserProfile,\x20%s,\x20%s',_0xd3bdbf,_0xa07f('0xf'));logger[_0xa07f('0x10')]('UserProfile,\x20%s,\x20%s,\x20%s',_0xd3bdbf,_0xa07f('0xf'),JSON[_0xa07f('0x11')](_0x7873c2));if(_0x7873c2[_0xa07f('0x12')]){if(_0x7873c2['error'][_0xa07f('0x13')]===0x1f4){logger['error'](_0xa07f('0x14'),_0xd3bdbf,_0x7873c2[_0xa07f('0x12')][_0xa07f('0x15')]);return _0x3679de(_0x7873c2[_0xa07f('0x12')]['message']);}logger[_0xa07f('0x12')](_0xa07f('0x14'),_0xd3bdbf,_0x7873c2[_0xa07f('0x12')][_0xa07f('0x15')]);return _0x151dda(_0x7873c2[_0xa07f('0x12')]['message']);}else{logger[_0xa07f('0xe')]('UserProfile,\x20%s,\x20%s',_0xd3bdbf,'request\x20sent');_0x151dda(_0x7873c2['result']['message']);}})['catch'](function(_0x54b2dd){logger[_0xa07f('0x12')](_0xa07f('0x14'),_0xd3bdbf,_0x54b2dd);_0x3679de(_0x54b2dd);});});} \ No newline at end of file +var _0x00f0=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','UserProfile,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x00f0,0xec));var _0x000f=function(_0xb97fa5,_0x86250d){_0xb97fa5=_0xb97fa5-0x0;var _0x16a609=_0x00f0[_0xb97fa5];return _0x16a609;};'use strict';var _=require(_0x000f('0x0'));var util=require(_0x000f('0x1'));var moment=require(_0x000f('0x2'));var BPromise=require(_0x000f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x000f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x000f('0x5'))('rpc');var config=require(_0x000f('0x6'));var jayson=require(_0x000f('0x7'));var client=jayson['client'][_0x000f('0x8')]({'port':0x232a});config[_0x000f('0x9')]=_[_0x000f('0xa')](config[_0x000f('0x9')],{'host':_0x000f('0xb'),'port':0x18eb});var socket=require(_0x000f('0xc'))(new Redis(config[_0x000f('0x9')]));require(_0x000f('0xd'))[_0x000f('0xe')](socket);function respondWithRpcPromise(_0x278cd8,_0x190417,_0x504f65){return new BPromise(function(_0x59749b,_0x1a8ebf){return client[_0x000f('0xf')](_0x278cd8,_0x504f65)['then'](function(_0x2bac47){logger[_0x000f('0x10')]('UserProfile,\x20%s,\x20%s',_0x190417,'request\x20sent');logger[_0x000f('0x11')](_0x000f('0x12'),_0x190417,'request\x20sent',JSON['stringify'](_0x2bac47));if(_0x2bac47[_0x000f('0x13')]){if(_0x2bac47[_0x000f('0x13')][_0x000f('0x14')]===0x1f4){logger[_0x000f('0x13')]('UserProfile,\x20%s,\x20%s',_0x190417,_0x2bac47[_0x000f('0x13')]['message']);return _0x1a8ebf(_0x2bac47['error'][_0x000f('0x15')]);}logger['error'](_0x000f('0x16'),_0x190417,_0x2bac47[_0x000f('0x13')][_0x000f('0x15')]);return _0x59749b(_0x2bac47[_0x000f('0x13')][_0x000f('0x15')]);}else{logger[_0x000f('0x10')](_0x000f('0x16'),_0x190417,_0x000f('0x17'));_0x59749b(_0x2bac47[_0x000f('0x18')][_0x000f('0x15')]);}})[_0x000f('0x19')](function(_0x156342){logger[_0x000f('0x13')]('UserProfile,\x20%s,\x20%s',_0x190417,_0x156342);_0x1a8ebf(_0x156342);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 6f784b7..2cb9658 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 _0xc072=['length','userProfile:','./userProfile.events','save','update','emit','removeListener','register'];(function(_0x54c65f,_0x5a4eea){var _0x535b20=function(_0x4a99be){while(--_0x4a99be){_0x54c65f['push'](_0x54c65f['shift']());}};_0x535b20(++_0x5a4eea);}(_0xc072,0x122));var _0x2c07=function(_0x5ec098,_0x399e8e){_0x5ec098=_0x5ec098-0x0;var _0x3c251f=_0xc072[_0x5ec098];return _0x3c251f;};'use strict';var UserProfileEvents=require(_0x2c07('0x0'));var events=[_0x2c07('0x1'),'remove',_0x2c07('0x2')];function createListener(_0x14b5c4,_0x36acb4){return function(_0x363563){_0x36acb4[_0x2c07('0x3')](_0x14b5c4,_0x363563);};}function removeListener(_0x10c6d9,_0x46767a){return function(){UserProfileEvents[_0x2c07('0x4')](_0x10c6d9,_0x46767a);};}exports[_0x2c07('0x5')]=function(_0x852eab){for(var _0x1a3501=0x0,_0x4ab882=events[_0x2c07('0x6')];_0x1a3501<_0x4ab882;_0x1a3501++){var _0x26cd9b=events[_0x1a3501];var _0x39ea25=createListener(_0x2c07('0x7')+_0x26cd9b,_0x852eab);UserProfileEvents['on'](_0x26cd9b,_0x39ea25);}}; \ No newline at end of file +var _0xb69d=['removeListener','length','userProfile:','./userProfile.events','save','remove','emit'];(function(_0x348d2e,_0x2b7b9b){var _0x143ca5=function(_0x287ae4){while(--_0x287ae4){_0x348d2e['push'](_0x348d2e['shift']());}};_0x143ca5(++_0x2b7b9b);}(_0xb69d,0x14c));var _0xdb69=function(_0x342d54,_0x262fb2){_0x342d54=_0x342d54-0x0;var _0x52186e=_0xb69d[_0x342d54];return _0x52186e;};'use strict';var UserProfileEvents=require(_0xdb69('0x0'));var events=[_0xdb69('0x1'),_0xdb69('0x2'),'update'];function createListener(_0x5e65cc,_0x5248b8){return function(_0x50181f){_0x5248b8[_0xdb69('0x3')](_0x5e65cc,_0x50181f);};}function removeListener(_0x19b3e6,_0x23b0d5){return function(){UserProfileEvents[_0xdb69('0x4')](_0x19b3e6,_0x23b0d5);};}exports['register']=function(_0x4fba6c){for(var _0x240087=0x0,_0xba22f3=events[_0xdb69('0x5')];_0x240087<_0xba22f3;_0x240087++){var _0x4c8d21=events[_0x240087];var _0x133c25=createListener(_0xdb69('0x6')+_0x4c8d21,_0x4fba6c);UserProfileEvents['on'](_0x4c8d21,_0x133c25);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index a9e1d83..66e0341 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 _0x1bde=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','show','create','put','/:id','update','delete','destroy','multer','path','fs-extra','../../components/auth/service'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x1bde,0x11d));var _0xe1bd=function(_0x540cdb,_0xf5fe44){_0x540cdb=_0x540cdb-0x0;var _0x52f1ff=_0x1bde[_0x540cdb];return _0x52f1ff;};'use strict';var multer=require(_0xe1bd('0x0'));var util=require('util');var path=require(_0xe1bd('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe1bd('0x2'));var auth=require(_0xe1bd('0x3'));var interaction=require(_0xe1bd('0x4'));var config=require(_0xe1bd('0x5'));var controller=require(_0xe1bd('0x6'));router[_0xe1bd('0x7')]('/',auth[_0xe1bd('0x8')](),controller['index']);router[_0xe1bd('0x7')](_0xe1bd('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xe1bd('0x7')]('/:id',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0xa')]);router['post']('/',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0xb')]);router[_0xe1bd('0xc')](_0xe1bd('0xd'),auth['isAuthenticated'](),controller[_0xe1bd('0xe')]);router[_0xe1bd('0xf')]('/:id',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7175=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','show','post','update','delete','destroy','exports','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7175,0x1c1));var _0x5717=function(_0x4dc35f,_0x377c51){_0x4dc35f=_0x4dc35f-0x0;var _0x1f8820=_0x7175[_0x4dc35f];return _0x1f8820;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5717('0x0'));var timeout=require('connect-timeout');var express=require(_0x5717('0x1'));var router=express[_0x5717('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5717('0x3'));var interaction=require(_0x5717('0x4'));var config=require(_0x5717('0x5'));var controller=require(_0x5717('0x6'));router[_0x5717('0x7')]('/',auth['isAuthenticated'](),controller[_0x5717('0x8')]);router[_0x5717('0x7')](_0x5717('0x9'),auth[_0x5717('0xa')](),controller[_0x5717('0xb')]);router[_0x5717('0x7')]('/:id',auth[_0x5717('0xa')](),controller[_0x5717('0xc')]);router[_0x5717('0xd')]('/',auth[_0x5717('0xa')](),controller['create']);router['put']('/:id',auth[_0x5717('0xa')](),controller[_0x5717('0xe')]);router[_0x5717('0xf')]('/:id',auth[_0x5717('0xa')](),controller[_0x5717('0x10')]);module[_0x5717('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index d72664f..6f22921 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 _0x6a36=['INTEGER','sequelize','STRING'];(function(_0x4e6d36,_0x491afa){var _0xcc4e12=function(_0x188552){while(--_0x188552){_0x4e6d36['push'](_0x4e6d36['shift']());}};_0xcc4e12(++_0x491afa);}(_0x6a36,0xb8));var _0x66a3=function(_0x29c76b,_0x2f7371){_0x29c76b=_0x29c76b-0x0;var _0x2b5b35=_0x6a36[_0x29c76b];return _0x2b5b35;};'use strict';var Sequelize=require(_0x66a3('0x0'));module['exports']={'name':{'type':Sequelize[_0x66a3('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x66a3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x66a3('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xbc0e=['sequelize','exports','STRING','INTEGER'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbc0e,0x80));var _0xebc0=function(_0x4a24ae,_0x5b85ca){_0x4a24ae=_0x4a24ae-0x0;var _0x3cebe6=_0xbc0e[_0x4a24ae];return _0x3cebe6;};'use strict';var Sequelize=require(_0xebc0('0x0'));module[_0xebc0('0x1')]={'name':{'type':Sequelize[_0xebc0('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xebc0('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xebc0('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 2a2b4f9..7ab9326 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4137=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','UserProfileResource','rawAttributes','type'];(function(_0x557ba5,_0x55735b){var _0x4c7d96=function(_0x4ed4d8){while(--_0x4ed4d8){_0x557ba5['push'](_0x557ba5['shift']());}};_0x4c7d96(++_0x55735b);}(_0x4137,0xf8));var _0x7413=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4137[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['UserProfileResource'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['UserProfileResource']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));};exports[_0x7413('0x49')]=function(_0x1ba4e9,_0x4bc337){return db['UserProfileResource'][_0x7413('0x49')]()['then'](respondWithResult(_0x4bc337,null))[_0x7413('0x47')](handleError(_0x4bc337,null));}; \ No newline at end of file +var _0x687b=['options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x2a6754,_0x277259){var _0x17feda=function(_0x5745be){while(--_0x5745be){_0x2a6754['push'](_0x2a6754['shift']());}};_0x17feda(++_0x277259);}(_0x687b,0x14a));var _0xb687=function(_0x45cb89,_0x99520e){_0x45cb89=_0x45cb89-0x0;var _0x5948c1=_0x687b[_0x45cb89];return _0x5948c1;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['UserProfileResource'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));};exports[_0xb687('0x4e')]=function(_0x2342f6,_0x4f5784){return db['UserProfileResource']['describe']()['then'](respondWithResult(_0x4f5784,null))[_0xb687('0x4a')](handleError(_0x4f5784,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index d3a29bc..f7d7a05 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 _0xf68b=['exports','define','UserProfileResource','user_profile_has_resources','sectionId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x42c5c8,_0x5c6a63){var _0x3fc894=function(_0x25b288){while(--_0x25b288){_0x42c5c8['push'](_0x42c5c8['shift']());}};_0x3fc894(++_0x5c6a63);}(_0xf68b,0x1e5));var _0xbf68=function(_0x11cc66,_0x59da98){_0x11cc66=_0x11cc66-0x0;var _0x19d7e6=_0xf68b[_0x11cc66];return _0x19d7e6;};'use strict';var _=require(_0xbf68('0x0'));var util=require(_0xbf68('0x1'));var logger=require(_0xbf68('0x2'))('api');var moment=require(_0xbf68('0x3'));var BPromise=require(_0xbf68('0x4'));var rp=require(_0xbf68('0x5'));var fs=require('fs');var path=require(_0xbf68('0x6'));var rimraf=require(_0xbf68('0x7'));var config=require(_0xbf68('0x8'));var attributes=require(_0xbf68('0x9'));module[_0xbf68('0xa')]=function(_0x304c19,_0x4c6467){return _0x304c19[_0xbf68('0xb')](_0xbf68('0xc'),attributes,{'tableName':_0xbf68('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0xbf68('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2308=['user_profile_has_resources','compositeIndex','lodash','api','bluebird','path','../../config/environment','exports','UserProfileResource'];(function(_0x599f33,_0x32538f){var _0x4fd43e=function(_0x11da23){while(--_0x11da23){_0x599f33['push'](_0x599f33['shift']());}};_0x4fd43e(++_0x32538f);}(_0x2308,0xec));var _0x8230=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x2308[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x8230('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8230('0x1'));var moment=require('moment');var BPromise=require(_0x8230('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8230('0x3'));var rimraf=require('rimraf');var config=require(_0x8230('0x4'));var attributes=require('./userProfileResource.attributes');module[_0x8230('0x5')]=function(_0x3564a5,_0x120e9a){return _0x3564a5['define'](_0x8230('0x6'),attributes,{'tableName':_0x8230('0x7'),'paranoid':![],'indexes':[{'name':_0x8230('0x8'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 7814978..0a59f92 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 _0x9a2b=['jayson/promise','then','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','UserProfileResource,\x20%s,\x20%s','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x569257,_0x1da54f){var _0xb56f90=function(_0x7475ac){while(--_0x7475ac){_0x569257['push'](_0x569257['shift']());}};_0xb56f90(++_0x1da54f);}(_0x9a2b,0xd5));var _0xb9a2=function(_0x265721,_0x1503f2){_0x265721=_0x265721-0x0;var _0x11ec95=_0x9a2b[_0x265721];return _0x11ec95;};'use strict';var _=require(_0xb9a2('0x0'));var util=require(_0xb9a2('0x1'));var moment=require(_0xb9a2('0x2'));var BPromise=require(_0xb9a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9a2('0x4'));var db=require(_0xb9a2('0x5'))['db'];var utils=require(_0xb9a2('0x6'));var logger=require(_0xb9a2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb9a2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d8a88,_0x255ac5,_0x20fc43){return new BPromise(function(_0x45a827,_0x182142){return client['request'](_0x1d8a88,_0x20fc43)[_0xb9a2('0x9')](function(_0x1f69fe){logger[_0xb9a2('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x255ac5,_0xb9a2('0xb'));logger['debug'](_0xb9a2('0xc'),_0x255ac5,'request\x20sent',JSON[_0xb9a2('0xd')](_0x1f69fe));if(_0x1f69fe[_0xb9a2('0xe')]){if(_0x1f69fe[_0xb9a2('0xe')]['code']===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x255ac5,_0x1f69fe[_0xb9a2('0xe')]['message']);return _0x182142(_0x1f69fe[_0xb9a2('0xe')][_0xb9a2('0xf')]);}logger[_0xb9a2('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x255ac5,_0x1f69fe[_0xb9a2('0xe')][_0xb9a2('0xf')]);return _0x45a827(_0x1f69fe[_0xb9a2('0xe')][_0xb9a2('0xf')]);}else{logger[_0xb9a2('0xa')](_0xb9a2('0x10'),_0x255ac5,_0xb9a2('0xb'));_0x45a827(_0x1f69fe['result']['message']);}})['catch'](function(_0x2f197f){logger[_0xb9a2('0xe')](_0xb9a2('0x10'),_0x255ac5,_0x2f197f);_0x182142(_0x2f197f);});});} \ No newline at end of file +var _0xdeba=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','error','UserProfileResource,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2ed1cd,_0x3d32de){var _0x52612e=function(_0x502318){while(--_0x502318){_0x2ed1cd['push'](_0x2ed1cd['shift']());}};_0x52612e(++_0x3d32de);}(_0xdeba,0x77));var _0xadeb=function(_0x4998ff,_0x13a98f){_0x4998ff=_0x4998ff-0x0;var _0x14b30d=_0xdeba[_0x4998ff];return _0x14b30d;};'use strict';var _=require(_0xadeb('0x0'));var util=require(_0xadeb('0x1'));var moment=require(_0xadeb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadeb('0x3'));var db=require(_0xadeb('0x4'))['db'];var utils=require(_0xadeb('0x5'));var logger=require(_0xadeb('0x6'))(_0xadeb('0x7'));var config=require(_0xadeb('0x8'));var jayson=require(_0xadeb('0x9'));var client=jayson[_0xadeb('0xa')][_0xadeb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xff2d30,_0x11b066,_0x47a00a){return new BPromise(function(_0x582cea,_0x3e6eb1){return client[_0xadeb('0xc')](_0xff2d30,_0x47a00a)[_0xadeb('0xd')](function(_0xcc2600){logger[_0xadeb('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x11b066,'request\x20sent');logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x11b066,'request\x20sent',JSON['stringify'](_0xcc2600));if(_0xcc2600[_0xadeb('0xf')]){if(_0xcc2600['error']['code']===0x1f4){logger[_0xadeb('0xf')](_0xadeb('0x10'),_0x11b066,_0xcc2600[_0xadeb('0xf')][_0xadeb('0x11')]);return _0x3e6eb1(_0xcc2600[_0xadeb('0xf')][_0xadeb('0x11')]);}logger[_0xadeb('0xf')](_0xadeb('0x10'),_0x11b066,_0xcc2600[_0xadeb('0xf')][_0xadeb('0x11')]);return _0x582cea(_0xcc2600[_0xadeb('0xf')][_0xadeb('0x11')]);}else{logger[_0xadeb('0xe')](_0xadeb('0x10'),_0x11b066,_0xadeb('0x12'));_0x582cea(_0xcc2600[_0xadeb('0x13')][_0xadeb('0x11')]);}})[_0xadeb('0x14')](function(_0x2f8b3b){logger['error'](_0xadeb('0x10'),_0x11b066,_0x2f8b3b);_0x3e6eb1(_0x2f8b3b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index c746131..e60e09c 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 _0x7a3a=['isAuthenticated','describe','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','index'];(function(_0x2fed48,_0x13df44){var _0xea0f77=function(_0x25edec){while(--_0x25edec){_0x2fed48['push'](_0x2fed48['shift']());}};_0xea0f77(++_0x13df44);}(_0x7a3a,0xe5));var _0xa7a3=function(_0x2ee8f7,_0x3f106b){_0x2ee8f7=_0x2ee8f7-0x0;var _0x1184e2=_0x7a3a[_0x2ee8f7];return _0x1184e2;};'use strict';var multer=require('multer');var util=require(_0xa7a3('0x0'));var path=require(_0xa7a3('0x1'));var timeout=require(_0xa7a3('0x2'));var express=require(_0xa7a3('0x3'));var router=express[_0xa7a3('0x4')]();var fs_extra=require(_0xa7a3('0x5'));var auth=require(_0xa7a3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa7a3('0x7'));var controller=require(_0xa7a3('0x8'));router[_0xa7a3('0x9')]('/',auth['isAuthenticated'](),controller[_0xa7a3('0xa')]);router['get']('/describe',auth[_0xa7a3('0xb')](),controller[_0xa7a3('0xc')]);router['get']('/:id',auth[_0xa7a3('0xb')](),controller['show']);router[_0xa7a3('0xd')]('/',auth['isAuthenticated'](),controller[_0xa7a3('0xe')]);router[_0xa7a3('0xf')](_0xa7a3('0x10'),auth[_0xa7a3('0xb')](),controller[_0xa7a3('0x11')]);router[_0xa7a3('0x12')](_0xa7a3('0x10'),auth[_0xa7a3('0xb')](),controller['destroy']);module[_0xa7a3('0x13')]=router; \ No newline at end of file +var _0xa86d=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x591e0c,_0x37e294){var _0x317424=function(_0x1c8c58){while(--_0x1c8c58){_0x591e0c['push'](_0x591e0c['shift']());}};_0x317424(++_0x37e294);}(_0xa86d,0x12d));var _0xda86=function(_0x326858,_0x2aa7dc){_0x326858=_0x326858-0x0;var _0x4daf84=_0xa86d[_0x326858];return _0x4daf84;};'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('fs-extra');var auth=require(_0xda86('0x5'));var interaction=require(_0xda86('0x6'));var config=require(_0xda86('0x7'));var controller=require(_0xda86('0x8'));router[_0xda86('0x9')]('/',auth[_0xda86('0xa')](),controller[_0xda86('0xb')]);router[_0xda86('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xda86('0xc'),auth[_0xda86('0xa')](),controller['show']);router[_0xda86('0xd')]('/',auth[_0xda86('0xa')](),controller[_0xda86('0xe')]);router[_0xda86('0xf')](_0xda86('0xc'),auth[_0xda86('0xa')](),controller[_0xda86('0x10')]);router['delete'](_0xda86('0xc'),auth[_0xda86('0xa')](),controller[_0xda86('0x11')]);module[_0xda86('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 2d1bfcc..858cfd2 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 _0x4b17=['STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x4767bb,_0x86d5c6){var _0x2de2a7=function(_0x4930be){while(--_0x4930be){_0x4767bb['push'](_0x4767bb['shift']());}};_0x2de2a7(++_0x86d5c6);}(_0x4b17,0x10f));var _0x74b1=function(_0xc5a279,_0x155360){_0xc5a279=_0xc5a279-0x0;var _0xc755d3=_0x4b17[_0xc5a279];return _0xc755d3;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x74b1('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x74b1('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x74b1('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x74b1('0x1')],'set':function(_0x4f206f){this['setDataValue'](_0x74b1('0x4'),_0x4f206f?_0x4f206f[_0x74b1('0x5')](''):[]);},'get':function(){return this[_0x74b1('0x6')](_0x74b1('0x4'))?this[_0x74b1('0x6')](_0x74b1('0x4'))[_0x74b1('0x7')](''):[];}}}; \ No newline at end of file +var _0x9354=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','exports','STRING','INTEGER'];(function(_0x31df6f,_0x380e73){var _0x31e353=function(_0x3a434b){while(--_0x3a434b){_0x31df6f['push'](_0x31df6f['shift']());}};_0x31e353(++_0x380e73);}(_0x9354,0x96));var _0x4935=function(_0x39ec06,_0xa5e032){_0x39ec06=_0x39ec06-0x0;var _0x43c12f=_0x9354[_0x39ec06];return _0x43c12f;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'name':{'type':Sequelize[_0x4935('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4935('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4935('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4935('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4935('0x1')],'set':function(_0x5327fc){this[_0x4935('0x4')](_0x4935('0x5'),_0x5327fc?_0x5327fc[_0x4935('0x6')](''):[]);},'get':function(){return this[_0x4935('0x7')](_0x4935('0x5'))?this[_0x4935('0x7')](_0x4935('0x5'))[_0x4935('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 424724d..e254631 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 _0x94ce=['fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','UserProfileSection','rawAttributes'];(function(_0x1f006b,_0x228e9e){var _0x3073bc=function(_0x3629fa){while(--_0x3629fa){_0x1f006b['push'](_0x1f006b['shift']());}};_0x3073bc(++_0x228e9e);}(_0x94ce,0x141));var _0xe94c=function(_0x84706,_0x1544a3){_0x84706=_0x84706-0x0;var _0x119ed1=_0x94ce[_0x84706];return _0x119ed1;};'use strict';var emlformat=require(_0xe94c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe94c('0x1'));var rp=require(_0xe94c('0x2'));var moment=require(_0xe94c('0x3'));var BPromise=require(_0xe94c('0x4'));var Mustache=require('mustache');var util=require(_0xe94c('0x5'));var path=require(_0xe94c('0x6'));var sox=require(_0xe94c('0x7'));var csv=require(_0xe94c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe94c('0x9'));var _=require(_0xe94c('0xa'));var squel=require('squel');var crypto=require(_0xe94c('0xb'));var jsforce=require(_0xe94c('0xc'));var deskjs=require(_0xe94c('0xd'));var toCsv=require(_0xe94c('0x8'));var querystring=require(_0xe94c('0xe'));var Papa=require(_0xe94c('0xf'));var Redis=require(_0xe94c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe94c('0x11'));var as=require(_0xe94c('0x12'));var hardwareService=require(_0xe94c('0x13'));var logger=require(_0xe94c('0x14'))('api');var utils=require(_0xe94c('0x15'));var config=require(_0xe94c('0x16'));var licenseUtil=require(_0xe94c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3966fd,_0x4740b4){_0x4740b4=_0x4740b4||0xcc;return function(_0x1f43e0){if(_0x1f43e0){return _0x3966fd['sendStatus'](_0x4740b4);}return _0x3966fd[_0xe94c('0x18')](_0x4740b4)[_0xe94c('0x19')]();};}function respondWithResult(_0x3c4fd9,_0x4d062d){_0x4d062d=_0x4d062d||0xc8;return function(_0x3bc55c){if(_0x3bc55c){return _0x3c4fd9[_0xe94c('0x18')](_0x4d062d)[_0xe94c('0x1a')](_0x3bc55c);}};}function respondWithFilteredResult(_0x27446d,_0x589ca4){return function(_0x56e547){if(_0x56e547){var _0x4f654a=typeof _0x589ca4[_0xe94c('0x1b')]===_0xe94c('0x1c')&&typeof _0x589ca4[_0xe94c('0x1d')]===_0xe94c('0x1c');var _0x2d53dc=_0x56e547['count'];var _0x1af427=_0x4f654a?0x0:_0x589ca4[_0xe94c('0x1b')];var _0x27e2c3=_0x4f654a?_0x56e547[_0xe94c('0x1e')]:_0x589ca4[_0xe94c('0x1b')]+_0x589ca4[_0xe94c('0x1d')];var _0x284a34;if(_0x27e2c3>=_0x2d53dc){_0x27e2c3=_0x2d53dc;_0x284a34=0xc8;}else{_0x284a34=0xce;}_0x27446d[_0xe94c('0x18')](_0x284a34);return _0x27446d['set'](_0xe94c('0x1f'),_0x1af427+'-'+_0x27e2c3+'/'+_0x2d53dc)[_0xe94c('0x1a')](_0x56e547);}return null;};}function patchUpdates(_0x2f7811){return function(_0x1b87b0){try{jsonpatch[_0xe94c('0x20')](_0x1b87b0,_0x2f7811,!![]);}catch(_0x3911f8){return BPromise[_0xe94c('0x21')](_0x3911f8);}return _0x1b87b0['save']();};}function saveUpdates(_0x1906c2,_0x1b8cfd){return function(_0x20d33a){if(_0x20d33a){return _0x20d33a[_0xe94c('0x22')](_0x1906c2)[_0xe94c('0x23')](function(_0x445072){return _0x445072;});}return null;};}function removeEntity(_0x28d31c,_0x2b8469){return function(_0x7c7c6a){if(_0x7c7c6a){return _0x7c7c6a['destroy']()[_0xe94c('0x23')](function(){_0x28d31c[_0xe94c('0x18')](0xcc)[_0xe94c('0x19')]();});}};}function handleEntityNotFound(_0x2df61f,_0x3ca99f){return function(_0xff4edc){if(!_0xff4edc){_0x2df61f['sendStatus'](0x194);}return _0xff4edc;};}function handleError(_0x4dda7e,_0x1fd593){_0x1fd593=_0x1fd593||0x1f4;return function(_0x246972){logger[_0xe94c('0x24')](_0x246972[_0xe94c('0x25')]);if(_0x246972[_0xe94c('0x26')]){delete _0x246972['name'];}_0x4dda7e[_0xe94c('0x18')](_0x1fd593)[_0xe94c('0x27')](_0x246972);};}exports[_0xe94c('0x28')]=function(_0x3ccac0,_0x29ae2e){var _0x1d5dc4={},_0x53aca2={},_0x39c353={'count':0x0,'rows':[]};var _0x35f9a8=_[_0xe94c('0x29')](db[_0xe94c('0x2a')][_0xe94c('0x2b')],function(_0x2d2999){return{'name':_0x2d2999[_0xe94c('0x2c')],'type':_0x2d2999[_0xe94c('0x2d')]['key']};});_0x53aca2[_0xe94c('0x2e')]=_['map'](_0x35f9a8,_0xe94c('0x26'));_0x53aca2[_0xe94c('0x2f')]=_[_0xe94c('0x30')](_0x3ccac0['query']);_0x53aca2[_0xe94c('0x31')]=_[_0xe94c('0x32')](_0x53aca2[_0xe94c('0x2e')],_0x53aca2[_0xe94c('0x2f')]);_0x1d5dc4['attributes']=_[_0xe94c('0x32')](_0x53aca2[_0xe94c('0x2e')],qs[_0xe94c('0x33')](_0x3ccac0[_0xe94c('0x2f')][_0xe94c('0x33')]));_0x1d5dc4['attributes']=_0x1d5dc4[_0xe94c('0x34')][_0xe94c('0x35')]?_0x1d5dc4['attributes']:_0x53aca2['model'];if(!_0x3ccac0[_0xe94c('0x2f')][_0xe94c('0x36')](_0xe94c('0x37'))){_0x1d5dc4[_0xe94c('0x1d')]=qs[_0xe94c('0x1d')](_0x3ccac0[_0xe94c('0x2f')][_0xe94c('0x1d')]);_0x1d5dc4[_0xe94c('0x1b')]=qs[_0xe94c('0x1b')](_0x3ccac0[_0xe94c('0x2f')][_0xe94c('0x1b')]);}_0x1d5dc4['order']=qs[_0xe94c('0x38')](_0x3ccac0[_0xe94c('0x2f')]['sort']);_0x1d5dc4[_0xe94c('0x39')]=qs['filters'](_['pick'](_0x3ccac0[_0xe94c('0x2f')],_0x53aca2[_0xe94c('0x31')]),_0x35f9a8);if(_0x3ccac0[_0xe94c('0x2f')]['filter']){_0x1d5dc4[_0xe94c('0x39')]=_[_0xe94c('0x3a')](_0x1d5dc4[_0xe94c('0x39')],{'$or':_[_0xe94c('0x29')](_0x35f9a8,function(_0x3b3cce){if(_0x3b3cce[_0xe94c('0x2d')]!==_0xe94c('0x3b')){var _0x1db059={};_0x1db059[_0x3b3cce['name']]={'$like':'%'+_0x3ccac0['query'][_0xe94c('0x3c')]+'%'};return _0x1db059;}})});}_0x1d5dc4=_['merge']({},_0x1d5dc4,_0x3ccac0[_0xe94c('0x3d')]);var _0x4bdfde={'where':_0x1d5dc4[_0xe94c('0x39')]};return db[_0xe94c('0x2a')][_0xe94c('0x1e')](_0x4bdfde)['then'](function(_0x4aeb65){_0x39c353[_0xe94c('0x1e')]=_0x4aeb65;if(_0x3ccac0['query'][_0xe94c('0x3e')]){_0x1d5dc4[_0xe94c('0x3f')]=[{'all':!![]}];}return db[_0xe94c('0x2a')]['findAll'](_0x1d5dc4);})[_0xe94c('0x23')](function(_0x490850){_0x39c353[_0xe94c('0x40')]=_0x490850;return _0x39c353;})[_0xe94c('0x23')](respondWithFilteredResult(_0x29ae2e,_0x1d5dc4))[_0xe94c('0x41')](handleError(_0x29ae2e,null));};exports[_0xe94c('0x42')]=function(_0x1a03a1,_0x85dcae){var _0x31fb46={'raw':![],'where':{'id':_0x1a03a1[_0xe94c('0x43')]['id']}},_0x8f5294={};_0x8f5294['model']=_[_0xe94c('0x30')](db[_0xe94c('0x2a')][_0xe94c('0x2b')]);_0x8f5294[_0xe94c('0x2f')]=_[_0xe94c('0x30')](_0x1a03a1[_0xe94c('0x2f')]);_0x8f5294[_0xe94c('0x31')]=_[_0xe94c('0x32')](_0x8f5294[_0xe94c('0x2e')],_0x8f5294[_0xe94c('0x2f')]);_0x31fb46['attributes']=_['intersection'](_0x8f5294[_0xe94c('0x2e')],qs[_0xe94c('0x33')](_0x1a03a1[_0xe94c('0x2f')]['fields']));_0x31fb46['attributes']=_0x31fb46[_0xe94c('0x34')][_0xe94c('0x35')]?_0x31fb46[_0xe94c('0x34')]:_0x8f5294['model'];if(_0x1a03a1[_0xe94c('0x2f')][_0xe94c('0x3e')]){_0x31fb46[_0xe94c('0x3f')]=[{'all':!![]}];}_0x31fb46=_[_0xe94c('0x3a')]({},_0x31fb46,_0x1a03a1[_0xe94c('0x3d')]);return db[_0xe94c('0x2a')][_0xe94c('0x44')](_0x31fb46)[_0xe94c('0x23')](handleEntityNotFound(_0x85dcae,null))['then'](respondWithResult(_0x85dcae,null))['catch'](handleError(_0x85dcae,null));};exports[_0xe94c('0x45')]=function(_0x5194d8,_0x240e60){return db['UserProfileSection'][_0xe94c('0x45')](_0x5194d8[_0xe94c('0x46')],{})[_0xe94c('0x23')](respondWithResult(_0x240e60,0xc9))[_0xe94c('0x41')](handleError(_0x240e60,null));};exports['update']=function(_0x314ff2,_0x5e25bb){if(_0x314ff2[_0xe94c('0x46')]['id']){delete _0x314ff2['body']['id'];}return db[_0xe94c('0x2a')][_0xe94c('0x44')]({'where':{'id':_0x314ff2[_0xe94c('0x43')]['id']}})[_0xe94c('0x23')](handleEntityNotFound(_0x5e25bb,null))[_0xe94c('0x23')](saveUpdates(_0x314ff2[_0xe94c('0x46')],null))[_0xe94c('0x23')](respondWithResult(_0x5e25bb,null))['catch'](handleError(_0x5e25bb,null));};exports[_0xe94c('0x47')]=function(_0x186c3e,_0x31784b){return db[_0xe94c('0x2a')][_0xe94c('0x44')]({'where':{'id':_0x186c3e[_0xe94c('0x43')]['id']}})[_0xe94c('0x23')](handleEntityNotFound(_0x31784b,null))[_0xe94c('0x23')](removeEntity(_0x31784b,null))[_0xe94c('0x41')](handleError(_0x31784b,null));};exports[_0xe94c('0x48')]=function(_0x51a5a5,_0x150c5a){return db[_0xe94c('0x2a')]['describe']()[_0xe94c('0x23')](respondWithResult(_0x150c5a,null))[_0xe94c('0x41')](handleError(_0x150c5a,null));}; \ No newline at end of file +var _0xc484=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','then','includeAll','include','rows','params','keys','find','catch','create','body','describe','eml-format','moment','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','query','filters'];(function(_0x378ee7,_0x19bfee){var _0x306bae=function(_0x390ac4){while(--_0x390ac4){_0x378ee7['push'](_0x378ee7['shift']());}};_0x306bae(++_0x19bfee);}(_0xc484,0xa9));var _0x4c48=function(_0x1fc716,_0x263857){_0x1fc716=_0x1fc716-0x0;var _0x637fd3=_0xc484[_0x1fc716];return _0x637fd3;};'use strict';var emlformat=require(_0x4c48('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4c48('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x4c48('0x2'));var util=require(_0x4c48('0x3'));var path=require('path');var sox=require(_0x4c48('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c48('0x5'));var _=require('lodash');var squel=require(_0x4c48('0x6'));var crypto=require(_0x4c48('0x7'));var jsforce=require(_0x4c48('0x8'));var deskjs=require(_0x4c48('0x9'));var toCsv=require(_0x4c48('0xa'));var querystring=require(_0x4c48('0xb'));var Papa=require(_0x4c48('0xc'));var Redis=require('ioredis');var authService=require(_0x4c48('0xd'));var qs=require(_0x4c48('0xe'));var as=require(_0x4c48('0xf'));var hardwareService=require(_0x4c48('0x10'));var logger=require(_0x4c48('0x11'))(_0x4c48('0x12'));var utils=require(_0x4c48('0x13'));var config=require(_0x4c48('0x14'));var licenseUtil=require(_0x4c48('0x15'));var db=require(_0x4c48('0x16'))['db'];function respondWithStatusCode(_0x16e5f6,_0x5050c6){_0x5050c6=_0x5050c6||0xcc;return function(_0x3083a6){if(_0x3083a6){return _0x16e5f6[_0x4c48('0x17')](_0x5050c6);}return _0x16e5f6[_0x4c48('0x18')](_0x5050c6)[_0x4c48('0x19')]();};}function respondWithResult(_0x47469f,_0x58233b){_0x58233b=_0x58233b||0xc8;return function(_0x334a2a){if(_0x334a2a){return _0x47469f[_0x4c48('0x18')](_0x58233b)[_0x4c48('0x1a')](_0x334a2a);}};}function respondWithFilteredResult(_0x4b1f6e,_0xcc09e6){return function(_0x2500dd){if(_0x2500dd){var _0xc2d63a=typeof _0xcc09e6[_0x4c48('0x1b')]==='undefined'&&typeof _0xcc09e6[_0x4c48('0x1c')]==='undefined';var _0xc4ecaf=_0x2500dd['count'];var _0x22481d=_0xc2d63a?0x0:_0xcc09e6['offset'];var _0x20d450=_0xc2d63a?_0x2500dd[_0x4c48('0x1d')]:_0xcc09e6[_0x4c48('0x1b')]+_0xcc09e6[_0x4c48('0x1c')];var _0x3f7f96;if(_0x20d450>=_0xc4ecaf){_0x20d450=_0xc4ecaf;_0x3f7f96=0xc8;}else{_0x3f7f96=0xce;}_0x4b1f6e['status'](_0x3f7f96);return _0x4b1f6e[_0x4c48('0x1e')]('Content-Range',_0x22481d+'-'+_0x20d450+'/'+_0xc4ecaf)['json'](_0x2500dd);}return null;};}function patchUpdates(_0x547f41){return function(_0x5890c4){try{jsonpatch[_0x4c48('0x1f')](_0x5890c4,_0x547f41,!![]);}catch(_0x446fb0){return BPromise[_0x4c48('0x20')](_0x446fb0);}return _0x5890c4[_0x4c48('0x21')]();};}function saveUpdates(_0x597050,_0x205201){return function(_0xbc2d72){if(_0xbc2d72){return _0xbc2d72[_0x4c48('0x22')](_0x597050)['then'](function(_0x664446){return _0x664446;});}return null;};}function removeEntity(_0x222a38,_0x5e0dc4){return function(_0x2468e2){if(_0x2468e2){return _0x2468e2[_0x4c48('0x23')]()['then'](function(){_0x222a38[_0x4c48('0x18')](0xcc)[_0x4c48('0x19')]();});}};}function handleEntityNotFound(_0xa9369c,_0x54cf1e){return function(_0x5f23f9){if(!_0x5f23f9){_0xa9369c['sendStatus'](0x194);}return _0x5f23f9;};}function handleError(_0x2232de,_0x205920){_0x205920=_0x205920||0x1f4;return function(_0x54dd5c){logger['error'](_0x54dd5c['stack']);if(_0x54dd5c['name']){delete _0x54dd5c[_0x4c48('0x24')];}_0x2232de[_0x4c48('0x18')](_0x205920)[_0x4c48('0x25')](_0x54dd5c);};}exports[_0x4c48('0x26')]=function(_0x5268a5,_0x40bc49){var _0x4c0ea9={},_0x3d2e40={},_0x92116f={'count':0x0,'rows':[]};var _0x557d5a=_[_0x4c48('0x27')](db[_0x4c48('0x28')][_0x4c48('0x29')],function(_0x4dbb6d){return{'name':_0x4dbb6d[_0x4c48('0x2a')],'type':_0x4dbb6d['type'][_0x4c48('0x2b')]};});_0x3d2e40[_0x4c48('0x2c')]=_[_0x4c48('0x27')](_0x557d5a,_0x4c48('0x24'));_0x3d2e40[_0x4c48('0x2d')]=_['keys'](_0x5268a5['query']);_0x3d2e40[_0x4c48('0x2e')]=_[_0x4c48('0x2f')](_0x3d2e40['model'],_0x3d2e40['query']);_0x4c0ea9[_0x4c48('0x30')]=_['intersection'](_0x3d2e40[_0x4c48('0x2c')],qs[_0x4c48('0x31')](_0x5268a5[_0x4c48('0x2d')][_0x4c48('0x31')]));_0x4c0ea9['attributes']=_0x4c0ea9[_0x4c48('0x30')][_0x4c48('0x32')]?_0x4c0ea9['attributes']:_0x3d2e40[_0x4c48('0x2c')];if(!_0x5268a5[_0x4c48('0x2d')][_0x4c48('0x33')]('nolimit')){_0x4c0ea9[_0x4c48('0x1c')]=qs[_0x4c48('0x1c')](_0x5268a5[_0x4c48('0x2d')][_0x4c48('0x1c')]);_0x4c0ea9[_0x4c48('0x1b')]=qs[_0x4c48('0x1b')](_0x5268a5[_0x4c48('0x2d')][_0x4c48('0x1b')]);}_0x4c0ea9[_0x4c48('0x34')]=qs[_0x4c48('0x35')](_0x5268a5[_0x4c48('0x2d')][_0x4c48('0x35')]);_0x4c0ea9[_0x4c48('0x36')]=qs['filters'](_[_0x4c48('0x37')](_0x5268a5[_0x4c48('0x2d')],_0x3d2e40[_0x4c48('0x2e')]),_0x557d5a);if(_0x5268a5[_0x4c48('0x2d')][_0x4c48('0x38')]){_0x4c0ea9['where']=_['merge'](_0x4c0ea9[_0x4c48('0x36')],{'$or':_['map'](_0x557d5a,function(_0x8c9c49){if(_0x8c9c49[_0x4c48('0x39')]!==_0x4c48('0x3a')){var _0x20681b={};_0x20681b[_0x8c9c49['name']]={'$like':'%'+_0x5268a5[_0x4c48('0x2d')]['filter']+'%'};return _0x20681b;}})});}_0x4c0ea9=_[_0x4c48('0x3b')]({},_0x4c0ea9,_0x5268a5[_0x4c48('0x3c')]);var _0x43d620={'where':_0x4c0ea9[_0x4c48('0x36')]};return db[_0x4c48('0x28')][_0x4c48('0x1d')](_0x43d620)[_0x4c48('0x3d')](function(_0x1f3626){_0x92116f[_0x4c48('0x1d')]=_0x1f3626;if(_0x5268a5[_0x4c48('0x2d')][_0x4c48('0x3e')]){_0x4c0ea9[_0x4c48('0x3f')]=[{'all':!![]}];}return db[_0x4c48('0x28')]['findAll'](_0x4c0ea9);})[_0x4c48('0x3d')](function(_0x48fb2c){_0x92116f[_0x4c48('0x40')]=_0x48fb2c;return _0x92116f;})[_0x4c48('0x3d')](respondWithFilteredResult(_0x40bc49,_0x4c0ea9))['catch'](handleError(_0x40bc49,null));};exports['show']=function(_0xab7080,_0x3c906f){var _0x37618={'raw':![],'where':{'id':_0xab7080[_0x4c48('0x41')]['id']}},_0x1b40f9={};_0x1b40f9[_0x4c48('0x2c')]=_[_0x4c48('0x42')](db[_0x4c48('0x28')][_0x4c48('0x29')]);_0x1b40f9[_0x4c48('0x2d')]=_[_0x4c48('0x42')](_0xab7080[_0x4c48('0x2d')]);_0x1b40f9[_0x4c48('0x2e')]=_['intersection'](_0x1b40f9[_0x4c48('0x2c')],_0x1b40f9['query']);_0x37618[_0x4c48('0x30')]=_[_0x4c48('0x2f')](_0x1b40f9[_0x4c48('0x2c')],qs[_0x4c48('0x31')](_0xab7080['query'][_0x4c48('0x31')]));_0x37618[_0x4c48('0x30')]=_0x37618[_0x4c48('0x30')][_0x4c48('0x32')]?_0x37618[_0x4c48('0x30')]:_0x1b40f9[_0x4c48('0x2c')];if(_0xab7080[_0x4c48('0x2d')][_0x4c48('0x3e')]){_0x37618[_0x4c48('0x3f')]=[{'all':!![]}];}_0x37618=_[_0x4c48('0x3b')]({},_0x37618,_0xab7080['options']);return db[_0x4c48('0x28')][_0x4c48('0x43')](_0x37618)[_0x4c48('0x3d')](handleEntityNotFound(_0x3c906f,null))['then'](respondWithResult(_0x3c906f,null))[_0x4c48('0x44')](handleError(_0x3c906f,null));};exports[_0x4c48('0x45')]=function(_0x443a2d,_0x54d432){return db['UserProfileSection']['create'](_0x443a2d['body'],{})[_0x4c48('0x3d')](respondWithResult(_0x54d432,0xc9))[_0x4c48('0x44')](handleError(_0x54d432,null));};exports[_0x4c48('0x22')]=function(_0x27982f,_0x19be1b){if(_0x27982f[_0x4c48('0x46')]['id']){delete _0x27982f[_0x4c48('0x46')]['id'];}return db[_0x4c48('0x28')]['find']({'where':{'id':_0x27982f[_0x4c48('0x41')]['id']}})[_0x4c48('0x3d')](handleEntityNotFound(_0x19be1b,null))[_0x4c48('0x3d')](saveUpdates(_0x27982f[_0x4c48('0x46')],null))[_0x4c48('0x3d')](respondWithResult(_0x19be1b,null))[_0x4c48('0x44')](handleError(_0x19be1b,null));};exports['destroy']=function(_0x216587,_0x1fb4e8){return db[_0x4c48('0x28')][_0x4c48('0x43')]({'where':{'id':_0x216587[_0x4c48('0x41')]['id']}})[_0x4c48('0x3d')](handleEntityNotFound(_0x1fb4e8,null))[_0x4c48('0x3d')](removeEntity(_0x1fb4e8,null))[_0x4c48('0x44')](handleError(_0x1fb4e8,null));};exports[_0x4c48('0x47')]=function(_0x3ef53b,_0x1c4c9a){return db['UserProfileSection'][_0x4c48('0x47')]()[_0x4c48('0x3d')](respondWithResult(_0x1c4c9a,null))[_0x4c48('0x44')](handleError(_0x1c4c9a,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 1b740c0..8c0bd0b 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 _0xda3b=['userProfileId','lodash','util','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex'];(function(_0x15f8ad,_0x5275c3){var _0xc0238a=function(_0x5550c8){while(--_0x5550c8){_0x15f8ad['push'](_0x15f8ad['shift']());}};_0xc0238a(++_0x5275c3);}(_0xda3b,0x18d));var _0xbda3=function(_0x9a25f5,_0x27e259){_0x9a25f5=_0x9a25f5-0x0;var _0x2b72c3=_0xda3b[_0x9a25f5];return _0x2b72c3;};'use strict';var _=require(_0xbda3('0x0'));var util=require(_0xbda3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbda3('0x2'));var fs=require('fs');var path=require(_0xbda3('0x3'));var rimraf=require(_0xbda3('0x4'));var config=require('../../config/environment');var attributes=require(_0xbda3('0x5'));module[_0xbda3('0x6')]=function(_0x16261a,_0x4e71aa){return _0x16261a[_0xbda3('0x7')]('UserProfileSection',attributes,{'tableName':_0xbda3('0x8'),'paranoid':![],'indexes':[{'name':_0xbda3('0x9'),'fields':['sectionId',_0xbda3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x864e=['sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x2bda24,_0x3683ee){var _0x436332=function(_0x4ff0c3){while(--_0x4ff0c3){_0x2bda24['push'](_0x2bda24['shift']());}};_0x436332(++_0x3683ee);}(_0x864e,0xc4));var _0xe864=function(_0x4fc80f,_0x24ed41){_0x4fc80f=_0x4fc80f-0x0;var _0x10d408=_0x864e[_0x4fc80f];return _0x10d408;};'use strict';var _=require(_0xe864('0x0'));var util=require(_0xe864('0x1'));var logger=require(_0xe864('0x2'))(_0xe864('0x3'));var moment=require(_0xe864('0x4'));var BPromise=require('bluebird');var rp=require(_0xe864('0x5'));var fs=require('fs');var path=require(_0xe864('0x6'));var rimraf=require(_0xe864('0x7'));var config=require(_0xe864('0x8'));var attributes=require(_0xe864('0x9'));module[_0xe864('0xa')]=function(_0x21dd7b,_0x114a21){return _0x21dd7b['define'](_0xe864('0xb'),attributes,{'tableName':_0xe864('0xc'),'paranoid':![],'indexes':[{'name':_0xe864('0xd'),'fields':[_0xe864('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 09b339c..0a52210 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 _0xfa78=['UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x4a85a2,_0x44c241){var _0x498251=function(_0x3a89cf){while(--_0x3a89cf){_0x4a85a2['push'](_0x4a85a2['shift']());}};_0x498251(++_0x44c241);}(_0xfa78,0x1e2));var _0x8fa7=function(_0x21d2cc,_0x4916fb){_0x21d2cc=_0x21d2cc-0x0;var _0x38fb66=_0xfa78[_0x21d2cc];return _0x38fb66;};'use strict';var _=require('lodash');var util=require(_0x8fa7('0x0'));var moment=require(_0x8fa7('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fa7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fa7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fa7('0x4'))(_0x8fa7('0x5'));var config=require(_0x8fa7('0x6'));var jayson=require(_0x8fa7('0x7'));var client=jayson[_0x8fa7('0x8')][_0x8fa7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b9da1,_0x43c250,_0x4e579b){return new BPromise(function(_0x42602a,_0x1fbf84){return client['request'](_0x2b9da1,_0x4e579b)[_0x8fa7('0xa')](function(_0x5e498a){logger[_0x8fa7('0xb')](_0x8fa7('0xc'),_0x43c250,'request\x20sent');logger['debug'](_0x8fa7('0xd'),_0x43c250,_0x8fa7('0xe'),JSON[_0x8fa7('0xf')](_0x5e498a));if(_0x5e498a[_0x8fa7('0x10')]){if(_0x5e498a['error']['code']===0x1f4){logger[_0x8fa7('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x43c250,_0x5e498a[_0x8fa7('0x10')][_0x8fa7('0x11')]);return _0x1fbf84(_0x5e498a[_0x8fa7('0x10')][_0x8fa7('0x11')]);}logger['error'](_0x8fa7('0xc'),_0x43c250,_0x5e498a[_0x8fa7('0x10')][_0x8fa7('0x11')]);return _0x42602a(_0x5e498a['error']['message']);}else{logger[_0x8fa7('0xb')](_0x8fa7('0xc'),_0x43c250,'request\x20sent');_0x42602a(_0x5e498a['result'][_0x8fa7('0x11')]);}})[_0x8fa7('0x12')](function(_0x2bb6c4){logger['error'](_0x8fa7('0xc'),_0x43c250,_0x2bb6c4);_0x1fbf84(_0x2bb6c4);});});} \ No newline at end of file +var _0xea09=['info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then'];(function(_0x196e84,_0x3340c4){var _0x4be51f=function(_0x2c9294){while(--_0x2c9294){_0x196e84['push'](_0x196e84['shift']());}};_0x4be51f(++_0x3340c4);}(_0xea09,0xd0));var _0x9ea0=function(_0x1dc8d8,_0x17b3fb){_0x1dc8d8=_0x1dc8d8-0x0;var _0x28e248=_0xea09[_0x1dc8d8];return _0x28e248;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ea0('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ea0('0x1'))['db'];var utils=require(_0x9ea0('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x9ea0('0x3'));var jayson=require(_0x9ea0('0x4'));var client=jayson['client'][_0x9ea0('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1e2eb1,_0x40e85c,_0x10133b){return new BPromise(function(_0xc4f0f3,_0x6cdf96){return client[_0x9ea0('0x6')](_0x1e2eb1,_0x10133b)[_0x9ea0('0x7')](function(_0x535928){logger[_0x9ea0('0x8')](_0x9ea0('0x9'),_0x40e85c,_0x9ea0('0xa'));logger[_0x9ea0('0xb')](_0x9ea0('0xc'),_0x40e85c,'request\x20sent',JSON[_0x9ea0('0xd')](_0x535928));if(_0x535928[_0x9ea0('0xe')]){if(_0x535928[_0x9ea0('0xe')]['code']===0x1f4){logger[_0x9ea0('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x40e85c,_0x535928['error'][_0x9ea0('0xf')]);return _0x6cdf96(_0x535928['error'][_0x9ea0('0xf')]);}logger[_0x9ea0('0xe')](_0x9ea0('0x9'),_0x40e85c,_0x535928[_0x9ea0('0xe')][_0x9ea0('0xf')]);return _0xc4f0f3(_0x535928[_0x9ea0('0xe')][_0x9ea0('0xf')]);}else{logger['info'](_0x9ea0('0x9'),_0x40e85c,_0x9ea0('0xa'));_0xc4f0f3(_0x535928[_0x9ea0('0x10')][_0x9ea0('0xf')]);}})[_0x9ea0('0x11')](function(_0x2ce7ae){logger[_0x9ea0('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x40e85c,_0x2ce7ae);_0x6cdf96(_0x2ce7ae);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 02317d5..731cfd1 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4b756f,_0x253774){var _0x3ed29a=function(_0xc14f63){while(--_0xc14f63){_0x4b756f['push'](_0x4b756f['shift']());}};_0x3ed29a(++_0x253774);}(_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(_0x20f47a,_0xaaa4ca){var _0x394bd4=function(_0x371991){while(--_0x371991){_0x20f47a['push'](_0x20f47a['shift']());}};_0x394bd4(++_0xaaa4ca);}(_0xe706,0xa3));var _0x6e70=function(_0x109669,_0x1b4895){_0x109669=_0x109669-0x0;var _0x4dd5a7=_0xe706[_0x109669];return _0x4dd5a7;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 0953ed6..b9a2aa1 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 _0x94df=['exports','INTEGER','sequelize'];(function(_0x395c24,_0x48d2cb){var _0x1d708b=function(_0x517a7b){while(--_0x517a7b){_0x395c24['push'](_0x395c24['shift']());}};_0x1d708b(++_0x48d2cb);}(_0x94df,0xe3));var _0xf94d=function(_0x178e62,_0x3cb98a){_0x178e62=_0x178e62-0x0;var _0xd666e=_0x94df[_0x178e62];return _0xd666e;};'use strict';var Sequelize=require(_0xf94d('0x0'));module[_0xf94d('0x1')]={'penalty':{'type':Sequelize[_0xf94d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2cf6=['sequelize','exports','INTEGER'];(function(_0x2f88bf,_0x761a0e){var _0x1b451e=function(_0x1116fa){while(--_0x1116fa){_0x2f88bf['push'](_0x2f88bf['shift']());}};_0x1b451e(++_0x761a0e);}(_0x2cf6,0x177));var _0x62cf=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x2cf6[_0x359bbe];return _0x1b3353;};'use strict';var Sequelize=require(_0x62cf('0x0'));module[_0x62cf('0x1')]={'penalty':{'type':Sequelize[_0x62cf('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index e6b481e..faebe75 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','define','user_has_sms_queues','lodash'];(function(_0x4ae055,_0x4f718c){var _0x230a65=function(_0x391d81){while(--_0x391d81){_0x4ae055['push'](_0x4ae055['shift']());}};_0x230a65(++_0x4f718c);}(_0x5496,0x175));var _0x6549=function(_0x379599,_0x29f27e){_0x379599=_0x379599-0x0;var _0x2f79b2=_0x5496[_0x379599];return _0x2f79b2;};'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')]('UserSmsQueue',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd2e=['./userSmsQueue.attributes','user_has_sms_queues','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2ced14,_0x5758a8){var _0x5d3bb1=function(_0x174690){while(--_0x174690){_0x2ced14['push'](_0x2ced14['shift']());}};_0x5d3bb1(++_0x5758a8);}(_0xfd2e,0x6e));var _0xefd2=function(_0x291662,_0x1c33de){_0x291662=_0x291662-0x0;var _0x5ce8db=_0xfd2e[_0x291662];return _0x5ce8db;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var logger=require(_0xefd2('0x1'))('api');var moment=require(_0xefd2('0x2'));var BPromise=require('bluebird');var rp=require(_0xefd2('0x3'));var fs=require('fs');var path=require(_0xefd2('0x4'));var rimraf=require(_0xefd2('0x5'));var config=require(_0xefd2('0x6'));var attributes=require(_0xefd2('0x7'));module['exports']=function(_0x5124c6,_0x40e76c){return _0x5124c6['define']('UserSmsQueue',attributes,{'tableName':_0xefd2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index fd72379..2cde058 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 _0xe114=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment'];(function(_0x525cdb,_0x5402a2){var _0x5e99cf=function(_0x4ce13d){while(--_0x4ce13d){_0x525cdb['push'](_0x525cdb['shift']());}};_0x5e99cf(++_0x5402a2);}(_0xe114,0x141));var _0x4e11=function(_0x68e606,_0x22570e){_0x68e606=_0x68e606-0x0;var _0x12b58d=_0xe114[_0x68e606];return _0x12b58d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4e11('0x0'));var BPromise=require(_0x4e11('0x1'));var rs=require(_0x4e11('0x2'));var fs=require('fs');var Redis=require(_0x4e11('0x3'));var db=require(_0x4e11('0x4'))['db'];var utils=require(_0x4e11('0x5'));var logger=require(_0x4e11('0x6'))(_0x4e11('0x7'));var config=require(_0x4e11('0x8'));var jayson=require(_0x4e11('0x9'));var client=jayson['client'][_0x4e11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22f369,_0xc2ac9c,_0x241501){return new BPromise(function(_0x3f14da,_0x1cdbb1){return client[_0x4e11('0xb')](_0x22f369,_0x241501)[_0x4e11('0xc')](function(_0x25c4bc){logger[_0x4e11('0xd')](_0x4e11('0xe'),_0xc2ac9c,_0x4e11('0xf'));logger[_0x4e11('0x10')](_0x4e11('0x11'),_0xc2ac9c,_0x4e11('0xf'),JSON[_0x4e11('0x12')](_0x25c4bc));if(_0x25c4bc[_0x4e11('0x13')]){if(_0x25c4bc[_0x4e11('0x13')][_0x4e11('0x14')]===0x1f4){logger[_0x4e11('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0xc2ac9c,_0x25c4bc[_0x4e11('0x13')][_0x4e11('0x15')]);return _0x1cdbb1(_0x25c4bc['error'][_0x4e11('0x15')]);}logger['error'](_0x4e11('0xe'),_0xc2ac9c,_0x25c4bc[_0x4e11('0x13')][_0x4e11('0x15')]);return _0x3f14da(_0x25c4bc[_0x4e11('0x13')][_0x4e11('0x15')]);}else{logger[_0x4e11('0xd')](_0x4e11('0xe'),_0xc2ac9c,_0x4e11('0xf'));_0x3f14da(_0x25c4bc[_0x4e11('0x16')][_0x4e11('0x15')]);}})['catch'](function(_0x8e3b5c){logger[_0x4e11('0x13')](_0x4e11('0xe'),_0xc2ac9c,_0x8e3b5c);_0x1cdbb1(_0x8e3b5c);});});} \ No newline at end of file +var _0x3013=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3013,0x92));var _0x3301=function(_0xcc071a,_0x13520e){_0xcc071a=_0xcc071a-0x0;var _0x4ce83e=_0x3013[_0xcc071a];return _0x4ce83e;};'use strict';var _=require('lodash');var util=require(_0x3301('0x0'));var moment=require(_0x3301('0x1'));var BPromise=require(_0x3301('0x2'));var rs=require(_0x3301('0x3'));var fs=require('fs');var Redis=require(_0x3301('0x4'));var db=require(_0x3301('0x5'))['db'];var utils=require(_0x3301('0x6'));var logger=require(_0x3301('0x7'))(_0x3301('0x8'));var config=require(_0x3301('0x9'));var jayson=require(_0x3301('0xa'));var client=jayson[_0x3301('0xb')][_0x3301('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58d62c,_0x57c497,_0x23ffb4){return new BPromise(function(_0x37598f,_0x2fa3e1){return client['request'](_0x58d62c,_0x23ffb4)['then'](function(_0x2c7f32){logger[_0x3301('0xd')](_0x3301('0xe'),_0x57c497,_0x3301('0xf'));logger[_0x3301('0x10')](_0x3301('0x11'),_0x57c497,'request\x20sent',JSON[_0x3301('0x12')](_0x2c7f32));if(_0x2c7f32[_0x3301('0x13')]){if(_0x2c7f32[_0x3301('0x13')][_0x3301('0x14')]===0x1f4){logger['error'](_0x3301('0xe'),_0x57c497,_0x2c7f32[_0x3301('0x13')][_0x3301('0x15')]);return _0x2fa3e1(_0x2c7f32[_0x3301('0x13')][_0x3301('0x15')]);}logger[_0x3301('0x13')](_0x3301('0xe'),_0x57c497,_0x2c7f32['error']['message']);return _0x37598f(_0x2c7f32[_0x3301('0x13')][_0x3301('0x15')]);}else{logger[_0x3301('0xd')](_0x3301('0xe'),_0x57c497,_0x3301('0xf'));_0x37598f(_0x2c7f32[_0x3301('0x16')]['message']);}})[_0x3301('0x17')](function(_0x59aadf){logger[_0x3301('0x13')](_0x3301('0xe'),_0x57c497,_0x59aadf);_0x2fa3e1(_0x59aadf);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 6004dbf..b1d21e9 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 _0x9ed1=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ed1,0x18d));var _0x19ed=function(_0x3d91ca,_0xe4f45b){_0x3d91ca=_0x3d91ca-0x0;var _0xc4b68c=_0x9ed1[_0x3d91ca];return _0xc4b68c;};'use strict';var Sequelize=require(_0x19ed('0x0'));module[_0x19ed('0x1')]={'UserId':{'type':Sequelize[_0x19ed('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x19ed('0x2')]}}; \ No newline at end of file +var _0xc867=['sequelize','INTEGER'];(function(_0x1ecbf8,_0x46567b){var _0x4d323a=function(_0x26111d){while(--_0x26111d){_0x1ecbf8['push'](_0x1ecbf8['shift']());}};_0x4d323a(++_0x46567b);}(_0xc867,0x178));var _0x7c86=function(_0x354974,_0xa0dcee){_0x354974=_0x354974-0x0;var _0x397ace=_0xc867[_0x354974];return _0x397ace;};'use strict';var Sequelize=require(_0x7c86('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x7c86('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index ae69f3b..28fa122 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(_0x146f2c,_0x752c62){var _0x4b81e9=function(_0x2a948c){while(--_0x2a948c){_0x146f2c['push'](_0x146f2c['shift']());}};_0x4b81e9(++_0x752c62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3a27eb,_0x6b6d8a){var _0x1f2208=function(_0x15b1d0){while(--_0x15b1d0){_0x3a27eb['push'](_0x3a27eb['shift']());}};_0x1f2208(++_0x6b6d8a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 a1bf6d2..bc11811 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(_0x57a8e8,_0x559564){var _0x2a365b=function(_0x3f29d6){while(--_0x3f29d6){_0x57a8e8['push'](_0x57a8e8['shift']());}};_0x2a365b(++_0x559564);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3be174,_0x393350){var _0x5ec09c=function(_0x28a9aa){while(--_0x28a9aa){_0x3be174['push'](_0x3be174['shift']());}};_0x5ec09c(++_0x393350);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index bfb86c8..ed641d6 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 _0x28a2=['INTEGER','exports'];(function(_0x12c859,_0x1220ee){var _0x54e16a=function(_0x338a22){while(--_0x338a22){_0x12c859['push'](_0x12c859['shift']());}};_0x54e16a(++_0x1220ee);}(_0x28a2,0x6d));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x228a('0x0')]={'penalty':{'type':Sequelize[_0x228a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd13e=['INTEGER','sequelize','exports'];(function(_0x1930c2,_0x288266){var _0xd8dcce=function(_0x1b0582){while(--_0x1b0582){_0x1930c2['push'](_0x1930c2['shift']());}};_0xd8dcce(++_0x288266);}(_0xd13e,0x193));var _0xed13=function(_0x4ed87c,_0x3b594e){_0x4ed87c=_0x4ed87c-0x0;var _0x5b99b5=_0xd13e[_0x4ed87c];return _0x5b99b5;};'use strict';var Sequelize=require(_0xed13('0x0'));module[_0xed13('0x1')]={'penalty':{'type':Sequelize[_0xed13('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 8874712..fa10899 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 _0xc330=['api','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger'];(function(_0x278062,_0x5a8ca4){var _0x5bc303=function(_0x12d07f){while(--_0x12d07f){_0x278062['push'](_0x278062['shift']());}};_0x5bc303(++_0x5a8ca4);}(_0xc330,0xe2));var _0x0c33=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xc330[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var util=require(_0x0c33('0x0'));var logger=require(_0x0c33('0x1'))(_0x0c33('0x2'));var moment=require('moment');var BPromise=require(_0x0c33('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c33('0x4'));var rimraf=require(_0x0c33('0x5'));var config=require(_0x0c33('0x6'));var attributes=require(_0x0c33('0x7'));module[_0x0c33('0x8')]=function(_0x10419a,_0x54345a){return _0x10419a[_0x0c33('0x9')](_0x0c33('0xa'),attributes,{'tableName':_0x0c33('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc92=['rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','bluebird','request-promise','path'];(function(_0x59f606,_0x4256ea){var _0x2daa76=function(_0x14f05c){while(--_0x14f05c){_0x59f606['push'](_0x59f606['shift']());}};_0x2daa76(++_0x4256ea);}(_0xdc92,0x1b5));var _0x2dc9=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xdc92[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2dc9('0x0'));var rp=require(_0x2dc9('0x1'));var fs=require('fs');var path=require(_0x2dc9('0x2'));var rimraf=require(_0x2dc9('0x3'));var config=require(_0x2dc9('0x4'));var attributes=require(_0x2dc9('0x5'));module['exports']=function(_0x16d095,_0x2667f5){return _0x16d095[_0x2dc9('0x6')](_0x2dc9('0x7'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 2038cc3..4ae350b 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 _0xcf7a=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x25ac44,_0x4bca2b){var _0x36ba24=function(_0x2a18c8){while(--_0x2a18c8){_0x25ac44['push'](_0x25ac44['shift']());}};_0x36ba24(++_0x4bca2b);}(_0xcf7a,0x9f));var _0xacf7=function(_0x1ee6ff,_0x2bd521){_0x1ee6ff=_0x1ee6ff-0x0;var _0x4f83a7=_0xcf7a[_0x1ee6ff];return _0x4f83a7;};'use strict';var _=require(_0xacf7('0x0'));var util=require(_0xacf7('0x1'));var moment=require(_0xacf7('0x2'));var BPromise=require(_0xacf7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacf7('0x4'));var db=require(_0xacf7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xacf7('0x6'))(_0xacf7('0x7'));var config=require(_0xacf7('0x8'));var jayson=require(_0xacf7('0x9'));var client=jayson['client'][_0xacf7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdd48fa,_0x191789,_0x523915){return new BPromise(function(_0x7567da,_0x3641da){return client[_0xacf7('0xb')](_0xdd48fa,_0x523915)[_0xacf7('0xc')](function(_0x40aff3){logger[_0xacf7('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x191789,'request\x20sent');logger['debug'](_0xacf7('0xe'),_0x191789,_0xacf7('0xf'),JSON[_0xacf7('0x10')](_0x40aff3));if(_0x40aff3['error']){if(_0x40aff3[_0xacf7('0x11')][_0xacf7('0x12')]===0x1f4){logger[_0xacf7('0x11')](_0xacf7('0x13'),_0x191789,_0x40aff3[_0xacf7('0x11')]['message']);return _0x3641da(_0x40aff3['error'][_0xacf7('0x14')]);}logger[_0xacf7('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x191789,_0x40aff3[_0xacf7('0x11')][_0xacf7('0x14')]);return _0x7567da(_0x40aff3[_0xacf7('0x11')]['message']);}else{logger[_0xacf7('0xd')](_0xacf7('0x13'),_0x191789,_0xacf7('0xf'));_0x7567da(_0x40aff3[_0xacf7('0x15')][_0xacf7('0x14')]);}})[_0xacf7('0x16')](function(_0x32ab16){logger[_0xacf7('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x191789,_0x32ab16);_0x3641da(_0x32ab16);});});} \ No newline at end of file +var _0x393a=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x28dff2,_0xd5cae9){var _0x551bd1=function(_0x427563){while(--_0x427563){_0x28dff2['push'](_0x28dff2['shift']());}};_0x551bd1(++_0xd5cae9);}(_0x393a,0x115));var _0xa393=function(_0x58c50e,_0x573495){_0x58c50e=_0x58c50e-0x0;var _0x4a8199=_0x393a[_0x58c50e];return _0x4a8199;};'use strict';var _=require(_0xa393('0x0'));var util=require('util');var moment=require(_0xa393('0x1'));var BPromise=require('bluebird');var rs=require(_0xa393('0x2'));var fs=require('fs');var Redis=require(_0xa393('0x3'));var db=require(_0xa393('0x4'))['db'];var utils=require(_0xa393('0x5'));var logger=require('../../config/logger')(_0xa393('0x6'));var config=require(_0xa393('0x7'));var jayson=require(_0xa393('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x290cc7,_0x574ac2,_0x163eac){return new BPromise(function(_0x303897,_0x5e9b21){return client[_0xa393('0x9')](_0x290cc7,_0x163eac)[_0xa393('0xa')](function(_0x49ec34){logger[_0xa393('0xb')](_0xa393('0xc'),_0x574ac2,_0xa393('0xd'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x574ac2,'request\x20sent',JSON['stringify'](_0x49ec34));if(_0x49ec34[_0xa393('0xe')]){if(_0x49ec34[_0xa393('0xe')][_0xa393('0xf')]===0x1f4){logger[_0xa393('0xe')](_0xa393('0xc'),_0x574ac2,_0x49ec34[_0xa393('0xe')]['message']);return _0x5e9b21(_0x49ec34['error'][_0xa393('0x10')]);}logger[_0xa393('0xe')](_0xa393('0xc'),_0x574ac2,_0x49ec34[_0xa393('0xe')][_0xa393('0x10')]);return _0x303897(_0x49ec34['error'][_0xa393('0x10')]);}else{logger[_0xa393('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x574ac2,_0xa393('0xd'));_0x303897(_0x49ec34['result'][_0xa393('0x10')]);}})[_0xa393('0x11')](function(_0x2907e6){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x574ac2,_0x2907e6);_0x5e9b21(_0x2907e6);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 59a41c6..0133053 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2c0931,_0x503573){var _0x3d781f=function(_0x3f84ac){while(--_0x3f84ac){_0x2c0931['push'](_0x2c0931['shift']());}};_0x3d781f(++_0x503573);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x35cee6,_0x248a73){var _0x4aec9c=function(_0x67493a){while(--_0x67493a){_0x35cee6['push'](_0x35cee6['shift']());}};_0x4aec9c(++_0x248a73);}(_0xedd9,0xfc));var _0x9edd=function(_0x109a23,_0xba2f47){_0x109a23=_0x109a23-0x0;var _0x2c082e=_0xedd9[_0x109a23];return _0x2c082e;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 7528996..c29cfc9 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 _0x83b3=['INTEGER','STRING','Required\x20by\x20Asterisk','sequelize','exports'];(function(_0x3b93e6,_0x4aadef){var _0x4a9afb=function(_0x3358bc){while(--_0x3358bc){_0x3b93e6['push'](_0x3b93e6['shift']());}};_0x4a9afb(++_0x4aadef);}(_0x83b3,0x13e));var _0x383b=function(_0x1b310b,_0x338af6){_0x1b310b=_0x1b310b-0x0;var _0x1703bd=_0x83b3[_0x1b310b];return _0x1703bd;};'use strict';var Sequelize=require(_0x383b('0x0'));module[_0x383b('0x1')]={'uniqueid':{'type':Sequelize[_0x383b('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x383b('0x3')],'allowNull':![],'comment':_0x383b('0x4')},'UserId':{'type':Sequelize[_0x383b('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x383b('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x383b('0x4')},'VoiceQueueId':{'type':Sequelize[_0x383b('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x383b('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x383b('0x4')},'penalty':{'type':Sequelize[_0x383b('0x2')](0xb),'defaultValue':0x0,'comment':_0x383b('0x4')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x383b('0x4')}}; \ No newline at end of file +var _0xded6=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x89ee68,_0x18ca4d){var _0x1dfd3b=function(_0x2f8d31){while(--_0x2f8d31){_0x89ee68['push'](_0x89ee68['shift']());}};_0x1dfd3b(++_0x18ca4d);}(_0xded6,0x1aa));var _0x6ded=function(_0x547e0b,_0x344780){_0x547e0b=_0x547e0b-0x0;var _0x4a4bfb=_0xded6[_0x547e0b];return _0x4a4bfb;};'use strict';var Sequelize=require(_0x6ded('0x0'));module[_0x6ded('0x1')]={'uniqueid':{'type':Sequelize[_0x6ded('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6ded('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x6ded('0x3')},'UserId':{'type':Sequelize[_0x6ded('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6ded('0x4'),'comment':_0x6ded('0x3')},'VoiceQueueId':{'type':Sequelize[_0x6ded('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6ded('0x4'),'comment':_0x6ded('0x3')},'penalty':{'type':Sequelize[_0x6ded('0x2')](0xb),'defaultValue':0x0,'comment':_0x6ded('0x3')},'paused':{'type':Sequelize[_0x6ded('0x2')](0xb),'defaultValue':0x0,'comment':_0x6ded('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index e79c711..89d7fb4 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 _0xe125=['exports','events','../../mysqldb','emit','hasOwnProperty','hook'];(function(_0x454893,_0x7560b7){var _0x5eaa56=function(_0x5bbbca){while(--_0x5bbbca){_0x454893['push'](_0x454893['shift']());}};_0x5eaa56(++_0x7560b7);}(_0xe125,0x15d));var _0x5e12=function(_0x43f148,_0x4c7123){_0x43f148=_0x43f148-0x0;var _0x11a9f3=_0xe125[_0x43f148];return _0x11a9f3;};'use strict';var EventEmitter=require(_0x5e12('0x0'));var UserVoiceQueueRt=require(_0x5e12('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x56bb13){return function(_0x2fb3aa,_0x4091d1,_0x20c19a){UserVoiceQueueRtEvents[_0x5e12('0x2')](_0x56bb13+':'+_0x2fb3aa['id'],_0x2fb3aa);UserVoiceQueueRtEvents[_0x5e12('0x2')](_0x56bb13,_0x2fb3aa);_0x20c19a(null);};}for(var e in events){if(events[_0x5e12('0x3')](e)){var event=events[e];UserVoiceQueueRt[_0x5e12('0x4')](e,emitEvent(event));}}module[_0x5e12('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x5449=['update','remove','emit','hook','events','../../mysqldb','save'];(function(_0x1cd93,_0x4b046e){var _0x325e23=function(_0x1d8ee8){while(--_0x1d8ee8){_0x1cd93['push'](_0x1cd93['shift']());}};_0x325e23(++_0x4b046e);}(_0x5449,0x1ee));var _0x9544=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x5449[_0x59befa];return _0x1dd63d;};'use strict';var EventEmitter=require(_0x9544('0x0'));var UserVoiceQueueRt=require(_0x9544('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9544('0x2'),'afterUpdate':_0x9544('0x3'),'afterDestroy':_0x9544('0x4')};function emitEvent(_0x64518c){return function(_0x11d505,_0xe597e1,_0x42426e){UserVoiceQueueRtEvents[_0x9544('0x5')](_0x64518c+':'+_0x11d505['id'],_0x11d505);UserVoiceQueueRtEvents['emit'](_0x64518c,_0x11d505);_0x42426e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x9544('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 6165489..c13ceab 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 _0xb3d4=['exports','UserVoiceQueueRt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x576272,_0x57a184){var _0x4ed9fc=function(_0x13d210){while(--_0x13d210){_0x576272['push'](_0x576272['shift']());}};_0x4ed9fc(++_0x57a184);}(_0xb3d4,0x1a6));var _0x4b3d=function(_0x20399b,_0x43c8ee){_0x20399b=_0x20399b-0x0;var _0x35eb6d=_0xb3d4[_0x20399b];return _0x35eb6d;};'use strict';var _=require(_0x4b3d('0x0'));var util=require(_0x4b3d('0x1'));var logger=require(_0x4b3d('0x2'))(_0x4b3d('0x3'));var moment=require('moment');var BPromise=require(_0x4b3d('0x4'));var rp=require(_0x4b3d('0x5'));var fs=require('fs');var path=require(_0x4b3d('0x6'));var rimraf=require(_0x4b3d('0x7'));var config=require(_0x4b3d('0x8'));var attributes=require(_0x4b3d('0x9'));module[_0x4b3d('0xa')]=function(_0x3f88a2,_0xbf7d1d){return _0x3f88a2['define'](_0x4b3d('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcfa=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0xf01721,_0x456136){var _0x3a587c=function(_0x12a4a3){while(--_0x12a4a3){_0xf01721['push'](_0xf01721['shift']());}};_0x3a587c(++_0x456136);}(_0xbcfa,0xf7));var _0xabcf=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xbcfa[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xabcf('0x0'));var util=require(_0xabcf('0x1'));var logger=require('../../config/logger')(_0xabcf('0x2'));var moment=require('moment');var BPromise=require(_0xabcf('0x3'));var rp=require(_0xabcf('0x4'));var fs=require('fs');var path=require(_0xabcf('0x5'));var rimraf=require(_0xabcf('0x6'));var config=require(_0xabcf('0x7'));var attributes=require(_0xabcf('0x8'));module[_0xabcf('0x9')]=function(_0x51ed4e,_0x1c49fc){return _0x51ed4e[_0xabcf('0xa')](_0xabcf('0xb'),attributes,{'tableName':_0xabcf('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 72191f5..56ff545 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 _0x648f=['catch','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','GetVoiceQueueRtPauses','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','stringify','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','result'];(function(_0x122d95,_0x15e1a9){var _0x55ddd8=function(_0x2ed874){while(--_0x2ed874){_0x122d95['push'](_0x122d95['shift']());}};_0x55ddd8(++_0x15e1a9);}(_0x648f,0x101));var _0xf648=function(_0x2b18e5,_0x1a141c){_0x2b18e5=_0x2b18e5-0x0;var _0x12e52c=_0x648f[_0x2b18e5];return _0x12e52c;};'use strict';var _=require(_0xf648('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf648('0x1'));var fs=require('fs');var Redis=require(_0xf648('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf648('0x3'));var logger=require(_0xf648('0x4'))(_0xf648('0x5'));var config=require(_0xf648('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf648('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf648('0x8')],{'host':_0xf648('0x9'),'port':0x18eb});var socket=require(_0xf648('0xa'))(new Redis(config[_0xf648('0x8')]));require(_0xf648('0xb'))[_0xf648('0xc')](socket);function respondWithRpcPromise(_0x284f05,_0x3d416c,_0x566457){return new BPromise(function(_0x2177bd,_0x985871){return client[_0xf648('0xd')](_0x284f05,_0x566457)[_0xf648('0xe')](function(_0x35d976){logger[_0xf648('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3d416c,_0xf648('0x10'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x3d416c,_0xf648('0x10'),JSON[_0xf648('0x11')](_0x35d976));if(_0x35d976[_0xf648('0x12')]){if(_0x35d976[_0xf648('0x12')][_0xf648('0x13')]===0x1f4){logger[_0xf648('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3d416c,_0x35d976['error'][_0xf648('0x14')]);return _0x985871(_0x35d976['error'][_0xf648('0x14')]);}logger['error'](_0xf648('0x15'),_0x3d416c,_0x35d976[_0xf648('0x12')][_0xf648('0x14')]);return _0x2177bd(_0x35d976[_0xf648('0x12')][_0xf648('0x14')]);}else{logger[_0xf648('0xf')](_0xf648('0x15'),_0x3d416c,_0xf648('0x10'));_0x2177bd(_0x35d976[_0xf648('0x16')][_0xf648('0x14')]);}})[_0xf648('0x17')](function(_0x2b6d0f){logger[_0xf648('0x12')](_0xf648('0x15'),_0x3d416c,_0x2b6d0f);_0x985871(_0x2b6d0f);});});}exports['GetVoiceQueueRtPauses']=function(_0x44392f){var _0x25827a=this;return new Promise(function(_0x5be935,_0x332bad){return db[_0xf648('0x18')]['findAll']({'raw':_0x44392f[_0xf648('0x19')]?_0x44392f[_0xf648('0x19')][_0xf648('0x1a')]===undefined?!![]:![]:!![],'where':_0x44392f[_0xf648('0x19')]?_0x44392f['options'][_0xf648('0x1b')]||null:null,'attributes':[[db[_0xf648('0x1c')]['fn'](_0xf648('0x1d'),db[_0xf648('0x1c')]['fn']('IF',db[_0xf648('0x1c')][_0xf648('0x1e')](_0xf648('0x1f')))),_0xf648('0x20')]]})['then'](function(_0x27c478){logger[_0xf648('0xf')]('GetVoiceQueueRtPauses',_0x44392f);logger[_0xf648('0x21')](_0xf648('0x22'),_0x44392f,JSON[_0xf648('0x11')](_0x27c478));_0x5be935(_0x27c478);})[_0xf648('0x17')](function(_0x41743d){logger[_0xf648('0x12')](_0xf648('0x22'),_0x41743d['message'],_0x44392f);_0x332bad(_0x25827a['error'](0x1f4,_0x41743d[_0xf648('0x14')]));});});}; \ No newline at end of file +var _0xf4b6=['rpc','http','redis','defaults','localhost','socket.io-emitter','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x12d785,_0xdf6d48){var _0x2ef75c=function(_0xbff67f){while(--_0xbff67f){_0x12d785['push'](_0x12d785['shift']());}};_0x2ef75c(++_0xdf6d48);}(_0xf4b6,0x81));var _0x6f4b=function(_0x5a3a08,_0x20686e){_0x5a3a08=_0x5a3a08-0x0;var _0x5c6748=_0xf4b6[_0x5a3a08];return _0x5c6748;};'use strict';var _=require(_0x6f4b('0x0'));var util=require(_0x6f4b('0x1'));var moment=require(_0x6f4b('0x2'));var BPromise=require(_0x6f4b('0x3'));var rs=require(_0x6f4b('0x4'));var fs=require('fs');var Redis=require(_0x6f4b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6f4b('0x6'))(_0x6f4b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6f4b('0x8')]({'port':0x232a});config[_0x6f4b('0x9')]=_[_0x6f4b('0xa')](config[_0x6f4b('0x9')],{'host':_0x6f4b('0xb'),'port':0x18eb});var socket=require(_0x6f4b('0xc'))(new Redis(config[_0x6f4b('0x9')]));require('./userVoiceQueueRt.socket')[_0x6f4b('0xd')](socket);function respondWithRpcPromise(_0x428317,_0x46ce6b,_0x357872){return new BPromise(function(_0x5c830e,_0x199220){return client[_0x6f4b('0xe')](_0x428317,_0x357872)[_0x6f4b('0xf')](function(_0x225c42){logger['info'](_0x6f4b('0x10'),_0x46ce6b,_0x6f4b('0x11'));logger['debug'](_0x6f4b('0x12'),_0x46ce6b,_0x6f4b('0x11'),JSON[_0x6f4b('0x13')](_0x225c42));if(_0x225c42[_0x6f4b('0x14')]){if(_0x225c42[_0x6f4b('0x14')][_0x6f4b('0x15')]===0x1f4){logger[_0x6f4b('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x46ce6b,_0x225c42['error'][_0x6f4b('0x16')]);return _0x199220(_0x225c42[_0x6f4b('0x14')][_0x6f4b('0x16')]);}logger[_0x6f4b('0x14')](_0x6f4b('0x10'),_0x46ce6b,_0x225c42[_0x6f4b('0x14')][_0x6f4b('0x16')]);return _0x5c830e(_0x225c42[_0x6f4b('0x14')][_0x6f4b('0x16')]);}else{logger[_0x6f4b('0x17')](_0x6f4b('0x10'),_0x46ce6b,'request\x20sent');_0x5c830e(_0x225c42[_0x6f4b('0x18')][_0x6f4b('0x16')]);}})['catch'](function(_0xacbf13){logger[_0x6f4b('0x14')](_0x6f4b('0x10'),_0x46ce6b,_0xacbf13);_0x199220(_0xacbf13);});});}exports[_0x6f4b('0x19')]=function(_0x45e4d1){var _0x348d0e=this;return new Promise(function(_0x2511f7,_0x33ad22){return db[_0x6f4b('0x1a')]['findAll']({'raw':_0x45e4d1[_0x6f4b('0x1b')]?_0x45e4d1['options'][_0x6f4b('0x1c')]===undefined?!![]:![]:!![],'where':_0x45e4d1[_0x6f4b('0x1b')]?_0x45e4d1[_0x6f4b('0x1b')][_0x6f4b('0x1d')]||null:null,'attributes':[[db[_0x6f4b('0x1e')]['fn'](_0x6f4b('0x1f'),db[_0x6f4b('0x1e')]['fn']('IF',db[_0x6f4b('0x1e')][_0x6f4b('0x20')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x6f4b('0xf')](function(_0x559676){logger['info']('GetVoiceQueueRtPauses',_0x45e4d1);logger['debug']('GetVoiceQueueRtPauses',_0x45e4d1,JSON['stringify'](_0x559676));_0x2511f7(_0x559676);})[_0x6f4b('0x21')](function(_0x77dcf7){logger[_0x6f4b('0x14')](_0x6f4b('0x19'),_0x77dcf7[_0x6f4b('0x16')],_0x45e4d1);_0x33ad22(_0x348d0e[_0x6f4b('0x14')](0x1f4,_0x77dcf7[_0x6f4b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 0f4f88c..3bc4f03 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 _0x9a22=['update','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x3c7974,_0x1cf7ba){var _0x411bf3=function(_0x2c0bd5){while(--_0x2c0bd5){_0x3c7974['push'](_0x3c7974['shift']());}};_0x411bf3(++_0x1cf7ba);}(_0x9a22,0x75));var _0x29a2=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x9a22[_0x2576d7];return _0x16a08c;};'use strict';var UserVoiceQueueRtEvents=require(_0x29a2('0x0'));var events=[_0x29a2('0x1'),_0x29a2('0x2'),_0x29a2('0x3')];function createListener(_0x2f7a2d,_0xc7dd1f){return function(_0x195e9e){_0xc7dd1f['emit'](_0x2f7a2d,_0x195e9e);};}function removeListener(_0x4e617e,_0x427d51){return function(){UserVoiceQueueRtEvents[_0x29a2('0x4')](_0x4e617e,_0x427d51);};}exports[_0x29a2('0x5')]=function(_0x2ea411){for(var _0x261835=0x0,_0xfb91e8=events[_0x29a2('0x6')];_0x261835<_0xfb91e8;_0x261835++){var _0x2887e1=events[_0x261835];var _0x4b55de=createListener(_0x29a2('0x7')+_0x2887e1,_0x2ea411);UserVoiceQueueRtEvents['on'](_0x2887e1,_0x4b55de);}}; \ No newline at end of file +var _0x17c4=['save','remove','update','emit','removeListener','length','./userVoiceQueueRt.events'];(function(_0x2baa83,_0x1a945e){var _0x58fc09=function(_0x2335f7){while(--_0x2335f7){_0x2baa83['push'](_0x2baa83['shift']());}};_0x58fc09(++_0x1a945e);}(_0x17c4,0x102));var _0x417c=function(_0x1bc95c,_0x109aec){_0x1bc95c=_0x1bc95c-0x0;var _0x1a9fdc=_0x17c4[_0x1bc95c];return _0x1a9fdc;};'use strict';var UserVoiceQueueRtEvents=require(_0x417c('0x0'));var events=[_0x417c('0x1'),_0x417c('0x2'),_0x417c('0x3')];function createListener(_0x2f1975,_0x2e9ccf){return function(_0x6579e5){_0x2e9ccf[_0x417c('0x4')](_0x2f1975,_0x6579e5);};}function removeListener(_0x212ac0,_0x413ee5){return function(){UserVoiceQueueRtEvents[_0x417c('0x5')](_0x212ac0,_0x413ee5);};}exports['register']=function(_0x24e681){for(var _0x117c5d=0x0,_0x340095=events[_0x417c('0x6')];_0x117c5d<_0x340095;_0x117c5d++){var _0x1106df=events[_0x117c5d];var _0x4c6534=createListener('userVoiceQueueRt:'+_0x1106df,_0x24e681);UserVoiceQueueRtEvents['on'](_0x1106df,_0x4c6534);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index f22cb37..f98dd84 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4c76cd,_0x14f044){var _0x68b4e0=function(_0x259520){while(--_0x259520){_0x4c76cd['push'](_0x4c76cd['shift']());}};_0x68b4e0(++_0x14f044);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index deb3ed0..81d7124 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 _0xb9c5=['INTEGER'];(function(_0x3091f9,_0x532951){var _0x523516=function(_0xe1e58b){while(--_0xe1e58b){_0x3091f9['push'](_0x3091f9['shift']());}};_0x523516(++_0x532951);}(_0xb9c5,0x14c));var _0x5b9c=function(_0x288264,_0x3bbb6b){_0x288264=_0x288264-0x0;var _0x1a7cdd=_0xb9c5[_0x288264];return _0x1a7cdd;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5b9c('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xab36=['exports','INTEGER','sequelize'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0xab36,0x1df));var _0x6ab3=function(_0x47c8f8,_0x158eb3){_0x47c8f8=_0x47c8f8-0x0;var _0x1630d4=_0xab36[_0x47c8f8];return _0x1630d4;};'use strict';var Sequelize=require(_0x6ab3('0x0'));module[_0x6ab3('0x1')]={'penalty':{'type':Sequelize[_0x6ab3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index f9e4fb1..09d08b3 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 _0xc31b=['bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','moment'];(function(_0x754fd2,_0x27ac7d){var _0x1d7dbc=function(_0x122da9){while(--_0x122da9){_0x754fd2['push'](_0x754fd2['shift']());}};_0x1d7dbc(++_0x27ac7d);}(_0xc31b,0xd9));var _0xbc31=function(_0x334832,_0x5086b3){_0x334832=_0x334832-0x0;var _0x23b871=_0xc31b[_0x334832];return _0x23b871;};'use strict';var _=require(_0xbc31('0x0'));var util=require(_0xbc31('0x1'));var logger=require(_0xbc31('0x2'))('api');var moment=require(_0xbc31('0x3'));var BPromise=require(_0xbc31('0x4'));var rp=require(_0xbc31('0x5'));var fs=require('fs');var path=require(_0xbc31('0x6'));var rimraf=require('rimraf');var config=require(_0xbc31('0x7'));var attributes=require(_0xbc31('0x8'));module[_0xbc31('0x9')]=function(_0x5ecdeb,_0x5cf691){return _0x5ecdeb[_0xbc31('0xa')](_0xbc31('0xb'),attributes,{'tableName':_0xbc31('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4aae=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','user_has_whatsapp_queues','lodash'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x4aae,0x1d3));var _0xe4aa=function(_0x4665db,_0x5467a2){_0x4665db=_0x4665db-0x0;var _0x15e2ee=_0x4aae[_0x4665db];return _0x15e2ee;};'use strict';var _=require(_0xe4aa('0x0'));var util=require('util');var logger=require(_0xe4aa('0x1'))(_0xe4aa('0x2'));var moment=require(_0xe4aa('0x3'));var BPromise=require(_0xe4aa('0x4'));var rp=require(_0xe4aa('0x5'));var fs=require('fs');var path=require(_0xe4aa('0x6'));var rimraf=require(_0xe4aa('0x7'));var config=require(_0xe4aa('0x8'));var attributes=require(_0xe4aa('0x9'));module['exports']=function(_0x3a5ff6,_0x4eec69){return _0x3a5ff6[_0xe4aa('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0xe4aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 8be64cf..ad22cc9 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 _0x5931=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserWhatsappQueue,\x20%s,\x20%s','catch','lodash','bluebird'];(function(_0x1bc148,_0x23471c){var _0x38f977=function(_0x284967){while(--_0x284967){_0x1bc148['push'](_0x1bc148['shift']());}};_0x38f977(++_0x23471c);}(_0x5931,0x6c));var _0x1593=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0x5931[_0x21cb7f];return _0x5a079a;};'use strict';var _=require(_0x1593('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1593('0x1'));var rs=require(_0x1593('0x2'));var fs=require('fs');var Redis=require(_0x1593('0x3'));var db=require(_0x1593('0x4'))['db'];var utils=require(_0x1593('0x5'));var logger=require(_0x1593('0x6'))(_0x1593('0x7'));var config=require(_0x1593('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1593('0x9')][_0x1593('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x510afc,_0x33f344,_0x1d50d7){return new BPromise(function(_0x52ee33,_0x34b1cc){return client[_0x1593('0xb')](_0x510afc,_0x1d50d7)[_0x1593('0xc')](function(_0x20423b){logger[_0x1593('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x33f344,_0x1593('0xe'));logger['debug'](_0x1593('0xf'),_0x33f344,_0x1593('0xe'),JSON[_0x1593('0x10')](_0x20423b));if(_0x20423b[_0x1593('0x11')]){if(_0x20423b[_0x1593('0x11')][_0x1593('0x12')]===0x1f4){logger[_0x1593('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x33f344,_0x20423b[_0x1593('0x11')]['message']);return _0x34b1cc(_0x20423b[_0x1593('0x11')][_0x1593('0x13')]);}logger[_0x1593('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x33f344,_0x20423b[_0x1593('0x11')][_0x1593('0x13')]);return _0x52ee33(_0x20423b[_0x1593('0x11')]['message']);}else{logger['info'](_0x1593('0x14'),_0x33f344,_0x1593('0xe'));_0x52ee33(_0x20423b['result'][_0x1593('0x13')]);}})[_0x1593('0x15')](function(_0x29d754){logger[_0x1593('0x11')](_0x1593('0x14'),_0x33f344,_0x29d754);_0x34b1cc(_0x29d754);});});} \ No newline at end of file +var _0x0980=['UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','debug'];(function(_0x3864e3,_0x3fd8df){var _0x358ee9=function(_0x32e6e8){while(--_0x32e6e8){_0x3864e3['push'](_0x3864e3['shift']());}};_0x358ee9(++_0x3fd8df);}(_0x0980,0x1e9));var _0x0098=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x0980[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x0098('0x0'));var util=require(_0x0098('0x1'));var moment=require('moment');var BPromise=require(_0x0098('0x2'));var rs=require(_0x0098('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0098('0x4'));var logger=require(_0x0098('0x5'))(_0x0098('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0098('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4a8e06,_0x54503d,_0x23980b){return new BPromise(function(_0x170fec,_0x365959){return client['request'](_0x4a8e06,_0x23980b)[_0x0098('0x8')](function(_0x51c332){logger[_0x0098('0x9')]('UserWhatsappQueue,\x20%s,\x20%s',_0x54503d,'request\x20sent');logger[_0x0098('0xa')](_0x0098('0xb'),_0x54503d,_0x0098('0xc'),JSON[_0x0098('0xd')](_0x51c332));if(_0x51c332[_0x0098('0xe')]){if(_0x51c332['error'][_0x0098('0xf')]===0x1f4){logger[_0x0098('0xe')](_0x0098('0x10'),_0x54503d,_0x51c332[_0x0098('0xe')][_0x0098('0x11')]);return _0x365959(_0x51c332['error'][_0x0098('0x11')]);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x54503d,_0x51c332[_0x0098('0xe')]['message']);return _0x170fec(_0x51c332['error'][_0x0098('0x11')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x54503d,_0x0098('0xc'));_0x170fec(_0x51c332[_0x0098('0x12')]['message']);}})[_0x0098('0x13')](function(_0xa5d7bf){logger[_0x0098('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x54503d,_0xa5d7bf);_0x365959(_0xa5d7bf);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index fab3493..c3482ae 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 _0x3fc6=['update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0x3fc6,0x159));var _0x63fc=function(_0x1c46c3,_0x27f511){_0x1c46c3=_0x1c46c3-0x0;var _0x4f0457=_0x3fc6[_0x1c46c3];return _0x4f0457;};'use strict';var multer=require(_0x63fc('0x0'));var util=require(_0x63fc('0x1'));var path=require(_0x63fc('0x2'));var timeout=require('connect-timeout');var express=require(_0x63fc('0x3'));var router=express[_0x63fc('0x4')]();var fs_extra=require(_0x63fc('0x5'));var auth=require(_0x63fc('0x6'));var interaction=require(_0x63fc('0x7'));var config=require(_0x63fc('0x8'));var controller=require('./variable.controller');router['get']('/',auth[_0x63fc('0x9')](),controller[_0x63fc('0xa')]);router[_0x63fc('0xb')]('/:id',auth[_0x63fc('0x9')](),controller[_0x63fc('0xc')]);router['post']('/',auth[_0x63fc('0x9')](),controller[_0x63fc('0xd')]);router[_0x63fc('0xe')](_0x63fc('0xf'),auth[_0x63fc('0x9')](),controller[_0x63fc('0x10')]);router[_0x63fc('0x11')](_0x63fc('0xf'),auth[_0x63fc('0x9')](),controller[_0x63fc('0x12')]);module['exports']=router; \ No newline at end of file +var _0x67a2=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','post','create','put','/:id','update'];(function(_0x43bf20,_0x10da52){var _0x16dbf4=function(_0x2a8ad0){while(--_0x2a8ad0){_0x43bf20['push'](_0x43bf20['shift']());}};_0x16dbf4(++_0x10da52);}(_0x67a2,0xd3));var _0x267a=function(_0x223222,_0xabf6be){_0x223222=_0x223222-0x0;var _0x197302=_0x67a2[_0x223222];return _0x197302;};'use strict';var multer=require(_0x267a('0x0'));var util=require(_0x267a('0x1'));var path=require('path');var timeout=require(_0x267a('0x2'));var express=require(_0x267a('0x3'));var router=express[_0x267a('0x4')]();var fs_extra=require(_0x267a('0x5'));var auth=require(_0x267a('0x6'));var interaction=require(_0x267a('0x7'));var config=require(_0x267a('0x8'));var controller=require('./variable.controller');router['get']('/',auth[_0x267a('0x9')](),controller[_0x267a('0xa')]);router[_0x267a('0xb')]('/:id',auth[_0x267a('0x9')](),controller['show']);router[_0x267a('0xc')]('/',auth[_0x267a('0x9')](),controller[_0x267a('0xd')]);router[_0x267a('0xe')](_0x267a('0xf'),auth[_0x267a('0x9')](),controller[_0x267a('0x10')]);router['delete'](_0x267a('0xf'),auth[_0x267a('0x9')](),controller[_0x267a('0x11')]);module[_0x267a('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 27fd850..0d2bc2f 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 _0x5d53=['exports','STRING','name'];(function(_0x9b3efc,_0x577a0d){var _0x200f05=function(_0x15ad7c){while(--_0x15ad7c){_0x9b3efc['push'](_0x9b3efc['shift']());}};_0x200f05(++_0x577a0d);}(_0x5d53,0x81));var _0x35d5=function(_0xfd9239,_0x2fea4f){_0xfd9239=_0xfd9239-0x0;var _0x48f447=_0x5d53[_0xfd9239];return _0x48f447;};'use strict';var Sequelize=require('sequelize');module[_0x35d5('0x0')]={'name':{'type':Sequelize[_0x35d5('0x1')],'unique':_0x35d5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x35d5('0x1')]}}; \ No newline at end of file +var _0x8524=['name','sequelize','exports','STRING'];(function(_0x32a617,_0x3e0a79){var _0x1d9689=function(_0x196abe){while(--_0x196abe){_0x32a617['push'](_0x32a617['shift']());}};_0x1d9689(++_0x3e0a79);}(_0x8524,0xb9));var _0x4852=function(_0x2dbfa1,_0x3a2777){_0x2dbfa1=_0x2dbfa1-0x0;var _0x5c3494=_0x8524[_0x2dbfa1];return _0x5c3494;};'use strict';var Sequelize=require(_0x4852('0x0'));module[_0x4852('0x1')]={'name':{'type':Sequelize[_0x4852('0x2')],'unique':_0x4852('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4852('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index a697a69..56f59a4 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 _0x07f6=['length','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','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','Variables','UserProfileResource','destroy','name','send','index','map','Variable','fieldName','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys'];(function(_0x53bfcf,_0x24937a){var _0x2825e4=function(_0x2ffd0a){while(--_0x2ffd0a){_0x53bfcf['push'](_0x53bfcf['shift']());}};_0x2825e4(++_0x24937a);}(_0x07f6,0x149));var _0x607f=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x07f6[_0x4e5552];return _0x60a338;};'use strict';var emlformat=require(_0x607f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x607f('0x1'));var jsonpatch=require(_0x607f('0x2'));var rp=require('request-promise');var moment=require(_0x607f('0x3'));var BPromise=require(_0x607f('0x4'));var Mustache=require(_0x607f('0x5'));var util=require(_0x607f('0x6'));var path=require(_0x607f('0x7'));var sox=require(_0x607f('0x8'));var csv=require(_0x607f('0x9'));var ejs=require(_0x607f('0xa'));var fs=require('fs');var fs_extra=require(_0x607f('0xb'));var _=require(_0x607f('0xc'));var squel=require(_0x607f('0xd'));var crypto=require(_0x607f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x607f('0xf'));var toCsv=require(_0x607f('0x9'));var querystring=require(_0x607f('0x10'));var Papa=require(_0x607f('0x11'));var Redis=require('ioredis');var authService=require(_0x607f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x607f('0x13'));var logger=require(_0x607f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x607f('0x15'));var licenseUtil=require(_0x607f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4659b0,_0xf07fd2){_0xf07fd2=_0xf07fd2||0xcc;return function(_0x4d32ae){if(_0x4d32ae){return _0x4659b0[_0x607f('0x17')](_0xf07fd2);}return _0x4659b0[_0x607f('0x18')](_0xf07fd2)[_0x607f('0x19')]();};}function respondWithResult(_0x2b7381,_0x5c581b){_0x5c581b=_0x5c581b||0xc8;return function(_0x44d205){if(_0x44d205){return _0x2b7381[_0x607f('0x18')](_0x5c581b)[_0x607f('0x1a')](_0x44d205);}};}function respondWithFilteredResult(_0x17f7ee,_0x51252c){return function(_0x58ad69){if(_0x58ad69){var _0x14bec8=typeof _0x51252c[_0x607f('0x1b')]===_0x607f('0x1c')&&typeof _0x51252c[_0x607f('0x1d')]===_0x607f('0x1c');var _0x1bfb98=_0x58ad69[_0x607f('0x1e')];var _0x228117=_0x14bec8?0x0:_0x51252c['offset'];var _0x4fe78c=_0x14bec8?_0x58ad69[_0x607f('0x1e')]:_0x51252c[_0x607f('0x1b')]+_0x51252c[_0x607f('0x1d')];var _0x52d460;if(_0x4fe78c>=_0x1bfb98){_0x4fe78c=_0x1bfb98;_0x52d460=0xc8;}else{_0x52d460=0xce;}_0x17f7ee[_0x607f('0x18')](_0x52d460);return _0x17f7ee[_0x607f('0x1f')](_0x607f('0x20'),_0x228117+'-'+_0x4fe78c+'/'+_0x1bfb98)[_0x607f('0x1a')](_0x58ad69);}return null;};}function patchUpdates(_0x56d490){return function(_0x38fe8a){try{jsonpatch['apply'](_0x38fe8a,_0x56d490,!![]);}catch(_0x3f93d0){return BPromise[_0x607f('0x21')](_0x3f93d0);}return _0x38fe8a['save']();};}function saveUpdates(_0x5c4be7,_0x1f6750){return function(_0x3f4cf5){if(_0x3f4cf5){return _0x3f4cf5['update'](_0x5c4be7)[_0x607f('0x22')](function(_0x20ec28){return _0x20ec28;});}return null;};}function removeEntity(_0x27bf22,_0x476075){return function(_0x33b240){if(_0x33b240){return _0x33b240['destroy']()['then'](function(){var _0x334a52=_0x33b240['get']({'plain':!![]});var _0x354f9f=_0x607f('0x23');return db[_0x607f('0x24')][_0x607f('0x25')]({'where':{'type':_0x354f9f,'resourceId':_0x334a52['id']}})[_0x607f('0x22')](function(){return _0x33b240;});})[_0x607f('0x22')](function(){_0x27bf22[_0x607f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d425,_0x3f00f5){return function(_0x3240a1){if(!_0x3240a1){_0x19d425[_0x607f('0x17')](0x194);}return _0x3240a1;};}function handleError(_0x38c7a4,_0x26c002){_0x26c002=_0x26c002||0x1f4;return function(_0x59393f){logger['error'](_0x59393f['stack']);if(_0x59393f['name']){delete _0x59393f[_0x607f('0x26')];}_0x38c7a4['status'](_0x26c002)[_0x607f('0x27')](_0x59393f);};}exports[_0x607f('0x28')]=function(_0x40ecf4,_0x4d8ee0){var _0x38999e={},_0x94f7a={},_0x157a0e={'count':0x0,'rows':[]};var _0x160a61=_[_0x607f('0x29')](db[_0x607f('0x2a')]['rawAttributes'],function(_0x503ed0){return{'name':_0x503ed0[_0x607f('0x2b')],'type':_0x503ed0[_0x607f('0x2c')][_0x607f('0x2d')]};});_0x94f7a[_0x607f('0x2e')]=_[_0x607f('0x29')](_0x160a61,_0x607f('0x26'));_0x94f7a['query']=_['keys'](_0x40ecf4['query']);_0x94f7a[_0x607f('0x2f')]=_[_0x607f('0x30')](_0x94f7a[_0x607f('0x2e')],_0x94f7a[_0x607f('0x31')]);_0x38999e[_0x607f('0x32')]=_['intersection'](_0x94f7a[_0x607f('0x2e')],qs['fields'](_0x40ecf4[_0x607f('0x31')][_0x607f('0x33')]));_0x38999e[_0x607f('0x32')]=_0x38999e[_0x607f('0x32')]['length']?_0x38999e['attributes']:_0x94f7a[_0x607f('0x2e')];if(!_0x40ecf4[_0x607f('0x31')][_0x607f('0x34')](_0x607f('0x35'))){_0x38999e[_0x607f('0x1d')]=qs['limit'](_0x40ecf4['query'][_0x607f('0x1d')]);_0x38999e['offset']=qs[_0x607f('0x1b')](_0x40ecf4[_0x607f('0x31')][_0x607f('0x1b')]);}_0x38999e['order']=qs['sort'](_0x40ecf4[_0x607f('0x31')][_0x607f('0x36')]);_0x38999e[_0x607f('0x37')]=qs[_0x607f('0x2f')](_['pick'](_0x40ecf4[_0x607f('0x31')],_0x94f7a[_0x607f('0x2f')]),_0x160a61);if(_0x40ecf4[_0x607f('0x31')]['filter']){_0x38999e['where']=_[_0x607f('0x38')](_0x38999e['where'],{'$or':_[_0x607f('0x29')](_0x160a61,function(_0x11aae4){if(_0x11aae4[_0x607f('0x2c')]!==_0x607f('0x39')){var _0x55a1a6={};_0x55a1a6[_0x11aae4['name']]={'$like':'%'+_0x40ecf4['query']['filter']+'%'};return _0x55a1a6;}})});}_0x38999e=_[_0x607f('0x38')]({},_0x38999e,_0x40ecf4[_0x607f('0x3a')]);var _0x387fac={'where':_0x38999e[_0x607f('0x37')]};return db[_0x607f('0x2a')][_0x607f('0x1e')](_0x387fac)[_0x607f('0x22')](function(_0x4694a3){_0x157a0e[_0x607f('0x1e')]=_0x4694a3;if(_0x40ecf4['query'][_0x607f('0x3b')]){_0x38999e[_0x607f('0x3c')]=[{'all':!![]}];}return db[_0x607f('0x2a')][_0x607f('0x3d')](_0x38999e);})[_0x607f('0x22')](function(_0x27d631){_0x157a0e[_0x607f('0x3e')]=_0x27d631;return _0x157a0e;})[_0x607f('0x22')](respondWithFilteredResult(_0x4d8ee0,_0x38999e))[_0x607f('0x3f')](handleError(_0x4d8ee0,null));};exports[_0x607f('0x40')]=function(_0x53d49a,_0x289161){var _0x25787f={'raw':!![],'where':{'id':_0x53d49a['params']['id']}},_0x39f077={};_0x39f077[_0x607f('0x2e')]=_[_0x607f('0x41')](db['Variable']['rawAttributes']);_0x39f077[_0x607f('0x31')]=_[_0x607f('0x41')](_0x53d49a['query']);_0x39f077[_0x607f('0x2f')]=_[_0x607f('0x30')](_0x39f077[_0x607f('0x2e')],_0x39f077['query']);_0x25787f[_0x607f('0x32')]=_[_0x607f('0x30')](_0x39f077['model'],qs['fields'](_0x53d49a[_0x607f('0x31')][_0x607f('0x33')]));_0x25787f[_0x607f('0x32')]=_0x25787f['attributes'][_0x607f('0x42')]?_0x25787f[_0x607f('0x32')]:_0x39f077[_0x607f('0x2e')];if(_0x53d49a[_0x607f('0x31')][_0x607f('0x3b')]){_0x25787f[_0x607f('0x3c')]=[{'all':!![]}];}_0x25787f=_[_0x607f('0x38')]({},_0x25787f,_0x53d49a[_0x607f('0x3a')]);return db[_0x607f('0x2a')][_0x607f('0x43')](_0x25787f)[_0x607f('0x22')](handleEntityNotFound(_0x289161,null))[_0x607f('0x22')](respondWithResult(_0x289161,null))['catch'](handleError(_0x289161,null));};exports[_0x607f('0x44')]=function(_0x3d4060,_0x472962){return db[_0x607f('0x2a')][_0x607f('0x44')](_0x3d4060[_0x607f('0x45')],{})[_0x607f('0x22')](function(_0x4b6004){var _0x2c767f=_0x3d4060[_0x607f('0x46')][_0x607f('0x47')]({'plain':!![]});if(!_0x2c767f)throw new Error(_0x607f('0x48'));if(_0x2c767f[_0x607f('0x49')]==='user'){var _0x33cfd1=_0x4b6004['get']({'plain':!![]});var _0x3f95a6=_0x607f('0x23');return db[_0x607f('0x4a')]['find']({'where':{'name':_0x3f95a6,'userProfileId':_0x2c767f[_0x607f('0x4b')]},'raw':!![]})[_0x607f('0x22')](function(_0x4857c4){if(_0x4857c4&&_0x4857c4[_0x607f('0x4c')]===0x0){return db[_0x607f('0x24')][_0x607f('0x44')]({'name':_0x33cfd1[_0x607f('0x26')],'resourceId':_0x33cfd1['id'],'type':_0x4857c4[_0x607f('0x26')],'sectionId':_0x4857c4['id']},{})[_0x607f('0x22')](function(){return _0x4b6004;});}else{return _0x4b6004;}})['catch'](function(_0x446653){logger['error'](_0x607f('0x4d'),_0x446653);throw _0x446653;});}return _0x4b6004;})[_0x607f('0x22')](respondWithResult(_0x472962,0xc9))[_0x607f('0x3f')](handleError(_0x472962,null));};exports['update']=function(_0x2d773d,_0x5065b2){if(_0x2d773d[_0x607f('0x45')]['id']){delete _0x2d773d[_0x607f('0x45')]['id'];}return db['Variable'][_0x607f('0x43')]({'where':{'id':_0x2d773d[_0x607f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5065b2,null))[_0x607f('0x22')](saveUpdates(_0x2d773d[_0x607f('0x45')],null))[_0x607f('0x22')](respondWithResult(_0x5065b2,null))[_0x607f('0x3f')](handleError(_0x5065b2,null));};exports[_0x607f('0x25')]=function(_0x18de13,_0x497c69){return db[_0x607f('0x2a')][_0x607f('0x43')]({'where':{'id':_0x18de13['params']['id']}})[_0x607f('0x22')](handleEntityNotFound(_0x497c69,null))['then'](removeEntity(_0x497c69,null))[_0x607f('0x3f')](handleError(_0x497c69,null));}; \ No newline at end of file +var _0x6e86=['error','stack','name','send','map','Variable','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','show','params','length','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','get'];(function(_0x10167c,_0x12713e){var _0x1c4fdd=function(_0x55aad6){while(--_0x55aad6){_0x10167c['push'](_0x10167c['shift']());}};_0x1c4fdd(++_0x12713e);}(_0x6e86,0x77));var _0x66e8=function(_0x274394,_0x6fd912){_0x274394=_0x274394-0x0;var _0x2a2773=_0x6e86[_0x274394];return _0x2a2773;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x66e8('0x0'));var jsonpatch=require(_0x66e8('0x1'));var rp=require(_0x66e8('0x2'));var moment=require(_0x66e8('0x3'));var BPromise=require(_0x66e8('0x4'));var Mustache=require('mustache');var util=require(_0x66e8('0x5'));var path=require(_0x66e8('0x6'));var sox=require(_0x66e8('0x7'));var csv=require(_0x66e8('0x8'));var ejs=require(_0x66e8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66e8('0xa'));var squel=require('squel');var crypto=require(_0x66e8('0xb'));var jsforce=require(_0x66e8('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x66e8('0xd'));var Redis=require(_0x66e8('0xe'));var authService=require(_0x66e8('0xf'));var qs=require(_0x66e8('0x10'));var as=require(_0x66e8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x66e8('0x12'))(_0x66e8('0x13'));var utils=require(_0x66e8('0x14'));var config=require(_0x66e8('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8cdb65,_0x36ab55){_0x36ab55=_0x36ab55||0xcc;return function(_0x451c5c){if(_0x451c5c){return _0x8cdb65[_0x66e8('0x16')](_0x36ab55);}return _0x8cdb65[_0x66e8('0x17')](_0x36ab55)[_0x66e8('0x18')]();};}function respondWithResult(_0x39b924,_0xff97ad){_0xff97ad=_0xff97ad||0xc8;return function(_0x488381){if(_0x488381){return _0x39b924['status'](_0xff97ad)[_0x66e8('0x19')](_0x488381);}};}function respondWithFilteredResult(_0x4d9b9b,_0x1cf056){return function(_0x316a04){if(_0x316a04){var _0x10dc8c=typeof _0x1cf056['offset']===_0x66e8('0x1a')&&typeof _0x1cf056[_0x66e8('0x1b')]===_0x66e8('0x1a');var _0x1008f1=_0x316a04['count'];var _0x23d6a0=_0x10dc8c?0x0:_0x1cf056['offset'];var _0x5db259=_0x10dc8c?_0x316a04[_0x66e8('0x1c')]:_0x1cf056[_0x66e8('0x1d')]+_0x1cf056[_0x66e8('0x1b')];var _0x196c62;if(_0x5db259>=_0x1008f1){_0x5db259=_0x1008f1;_0x196c62=0xc8;}else{_0x196c62=0xce;}_0x4d9b9b[_0x66e8('0x17')](_0x196c62);return _0x4d9b9b[_0x66e8('0x1e')](_0x66e8('0x1f'),_0x23d6a0+'-'+_0x5db259+'/'+_0x1008f1)[_0x66e8('0x19')](_0x316a04);}return null;};}function patchUpdates(_0x2dd608){return function(_0x35a39a){try{jsonpatch[_0x66e8('0x20')](_0x35a39a,_0x2dd608,!![]);}catch(_0x228780){return BPromise[_0x66e8('0x21')](_0x228780);}return _0x35a39a['save']();};}function saveUpdates(_0x697aa9,_0x59c22b){return function(_0x1629dd){if(_0x1629dd){return _0x1629dd[_0x66e8('0x22')](_0x697aa9)[_0x66e8('0x23')](function(_0x4bb188){return _0x4bb188;});}return null;};}function removeEntity(_0x1e3168,_0x1b3645){return function(_0x6b2860){if(_0x6b2860){return _0x6b2860['destroy']()[_0x66e8('0x23')](function(){var _0x328ed7=_0x6b2860[_0x66e8('0x24')]({'plain':!![]});var _0x2f1bcc='Variables';return db['UserProfileResource']['destroy']({'where':{'type':_0x2f1bcc,'resourceId':_0x328ed7['id']}})[_0x66e8('0x23')](function(){return _0x6b2860;});})[_0x66e8('0x23')](function(){_0x1e3168['status'](0xcc)[_0x66e8('0x18')]();});}};}function handleEntityNotFound(_0x3ae65c,_0x5438c2){return function(_0x3b4cf4){if(!_0x3b4cf4){_0x3ae65c['sendStatus'](0x194);}return _0x3b4cf4;};}function handleError(_0x30b0ed,_0x50c546){_0x50c546=_0x50c546||0x1f4;return function(_0x257bd7){logger[_0x66e8('0x25')](_0x257bd7[_0x66e8('0x26')]);if(_0x257bd7[_0x66e8('0x27')]){delete _0x257bd7[_0x66e8('0x27')];}_0x30b0ed[_0x66e8('0x17')](_0x50c546)[_0x66e8('0x28')](_0x257bd7);};}exports['index']=function(_0x3fab1b,_0x3cc146){var _0x32fc7d={},_0x35bbfe={},_0xad4ce0={'count':0x0,'rows':[]};var _0x104882=_[_0x66e8('0x29')](db[_0x66e8('0x2a')][_0x66e8('0x2b')],function(_0x4a878f){return{'name':_0x4a878f['fieldName'],'type':_0x4a878f[_0x66e8('0x2c')][_0x66e8('0x2d')]};});_0x35bbfe['model']=_[_0x66e8('0x29')](_0x104882,_0x66e8('0x27'));_0x35bbfe[_0x66e8('0x2e')]=_[_0x66e8('0x2f')](_0x3fab1b[_0x66e8('0x2e')]);_0x35bbfe[_0x66e8('0x30')]=_[_0x66e8('0x31')](_0x35bbfe[_0x66e8('0x32')],_0x35bbfe['query']);_0x32fc7d[_0x66e8('0x33')]=_['intersection'](_0x35bbfe[_0x66e8('0x32')],qs[_0x66e8('0x34')](_0x3fab1b['query'][_0x66e8('0x34')]));_0x32fc7d[_0x66e8('0x33')]=_0x32fc7d['attributes']['length']?_0x32fc7d['attributes']:_0x35bbfe[_0x66e8('0x32')];if(!_0x3fab1b[_0x66e8('0x2e')]['hasOwnProperty']('nolimit')){_0x32fc7d[_0x66e8('0x1b')]=qs[_0x66e8('0x1b')](_0x3fab1b[_0x66e8('0x2e')]['limit']);_0x32fc7d['offset']=qs[_0x66e8('0x1d')](_0x3fab1b[_0x66e8('0x2e')]['offset']);}_0x32fc7d['order']=qs['sort'](_0x3fab1b[_0x66e8('0x2e')][_0x66e8('0x35')]);_0x32fc7d[_0x66e8('0x36')]=qs[_0x66e8('0x30')](_[_0x66e8('0x37')](_0x3fab1b[_0x66e8('0x2e')],_0x35bbfe[_0x66e8('0x30')]),_0x104882);if(_0x3fab1b[_0x66e8('0x2e')][_0x66e8('0x38')]){_0x32fc7d[_0x66e8('0x36')]=_['merge'](_0x32fc7d[_0x66e8('0x36')],{'$or':_[_0x66e8('0x29')](_0x104882,function(_0x1146a0){if(_0x1146a0[_0x66e8('0x2c')]!==_0x66e8('0x39')){var _0x14b3d0={};_0x14b3d0[_0x1146a0[_0x66e8('0x27')]]={'$like':'%'+_0x3fab1b[_0x66e8('0x2e')][_0x66e8('0x38')]+'%'};return _0x14b3d0;}})});}_0x32fc7d=_[_0x66e8('0x3a')]({},_0x32fc7d,_0x3fab1b[_0x66e8('0x3b')]);var _0x2c5e89={'where':_0x32fc7d[_0x66e8('0x36')]};return db[_0x66e8('0x2a')]['count'](_0x2c5e89)[_0x66e8('0x23')](function(_0x3992b4){_0xad4ce0[_0x66e8('0x1c')]=_0x3992b4;if(_0x3fab1b['query']['includeAll']){_0x32fc7d['include']=[{'all':!![]}];}return db['Variable'][_0x66e8('0x3c')](_0x32fc7d);})[_0x66e8('0x23')](function(_0x23fa37){_0xad4ce0[_0x66e8('0x3d')]=_0x23fa37;return _0xad4ce0;})[_0x66e8('0x23')](respondWithFilteredResult(_0x3cc146,_0x32fc7d))['catch'](handleError(_0x3cc146,null));};exports[_0x66e8('0x3e')]=function(_0x240036,_0x20937a){var _0x4c3fcf={'raw':!![],'where':{'id':_0x240036[_0x66e8('0x3f')]['id']}},_0x345f36={};_0x345f36['model']=_[_0x66e8('0x2f')](db[_0x66e8('0x2a')][_0x66e8('0x2b')]);_0x345f36[_0x66e8('0x2e')]=_['keys'](_0x240036[_0x66e8('0x2e')]);_0x345f36[_0x66e8('0x30')]=_[_0x66e8('0x31')](_0x345f36[_0x66e8('0x32')],_0x345f36[_0x66e8('0x2e')]);_0x4c3fcf[_0x66e8('0x33')]=_[_0x66e8('0x31')](_0x345f36[_0x66e8('0x32')],qs['fields'](_0x240036[_0x66e8('0x2e')][_0x66e8('0x34')]));_0x4c3fcf['attributes']=_0x4c3fcf[_0x66e8('0x33')][_0x66e8('0x40')]?_0x4c3fcf[_0x66e8('0x33')]:_0x345f36[_0x66e8('0x32')];if(_0x240036['query']['includeAll']){_0x4c3fcf[_0x66e8('0x41')]=[{'all':!![]}];}_0x4c3fcf=_[_0x66e8('0x3a')]({},_0x4c3fcf,_0x240036['options']);return db[_0x66e8('0x2a')][_0x66e8('0x42')](_0x4c3fcf)[_0x66e8('0x23')](handleEntityNotFound(_0x20937a,null))[_0x66e8('0x23')](respondWithResult(_0x20937a,null))[_0x66e8('0x43')](handleError(_0x20937a,null));};exports[_0x66e8('0x44')]=function(_0x556cdc,_0x215e41){return db['Variable'][_0x66e8('0x44')](_0x556cdc[_0x66e8('0x45')],{})[_0x66e8('0x23')](function(_0x4e221a){var _0x12fce2=_0x556cdc['user'][_0x66e8('0x24')]({'plain':!![]});if(!_0x12fce2)throw new Error(_0x66e8('0x46'));if(_0x12fce2[_0x66e8('0x47')]===_0x66e8('0x48')){var _0x528f42=_0x4e221a[_0x66e8('0x24')]({'plain':!![]});var _0x37a637='Variables';return db[_0x66e8('0x49')][_0x66e8('0x42')]({'where':{'name':_0x37a637,'userProfileId':_0x12fce2[_0x66e8('0x4a')]},'raw':!![]})['then'](function(_0x5ad325){if(_0x5ad325&&_0x5ad325[_0x66e8('0x4b')]===0x0){return db[_0x66e8('0x4c')][_0x66e8('0x44')]({'name':_0x528f42[_0x66e8('0x27')],'resourceId':_0x528f42['id'],'type':_0x5ad325[_0x66e8('0x27')],'sectionId':_0x5ad325['id']},{})[_0x66e8('0x23')](function(){return _0x4e221a;});}else{return _0x4e221a;}})[_0x66e8('0x43')](function(_0x2e5b49){logger['error'](_0x66e8('0x4d'),_0x2e5b49);throw _0x2e5b49;});}return _0x4e221a;})[_0x66e8('0x23')](respondWithResult(_0x215e41,0xc9))[_0x66e8('0x43')](handleError(_0x215e41,null));};exports[_0x66e8('0x22')]=function(_0x90022,_0x59a9ab){if(_0x90022[_0x66e8('0x45')]['id']){delete _0x90022[_0x66e8('0x45')]['id'];}return db[_0x66e8('0x2a')][_0x66e8('0x42')]({'where':{'id':_0x90022[_0x66e8('0x3f')]['id']}})[_0x66e8('0x23')](handleEntityNotFound(_0x59a9ab,null))[_0x66e8('0x23')](saveUpdates(_0x90022[_0x66e8('0x45')],null))[_0x66e8('0x23')](respondWithResult(_0x59a9ab,null))['catch'](handleError(_0x59a9ab,null));};exports['destroy']=function(_0x2c79e4,_0x10d9e5){return db[_0x66e8('0x2a')]['find']({'where':{'id':_0x2c79e4[_0x66e8('0x3f')]['id']}})[_0x66e8('0x23')](handleEntityNotFound(_0x10d9e5,null))[_0x66e8('0x23')](removeEntity(_0x10d9e5,null))[_0x66e8('0x43')](handleError(_0x10d9e5,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 53c2d55..b13fafc 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 _0x43b1=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','Variable','tools_variables','lodash'];(function(_0x3221cd,_0x4a4a4a){var _0x21a689=function(_0x375599){while(--_0x375599){_0x3221cd['push'](_0x3221cd['shift']());}};_0x21a689(++_0x4a4a4a);}(_0x43b1,0xdb));var _0x143b=function(_0x417a2c,_0x23916e){_0x417a2c=_0x417a2c-0x0;var _0x47e18a=_0x43b1[_0x417a2c];return _0x47e18a;};'use strict';var _=require(_0x143b('0x0'));var util=require('util');var logger=require(_0x143b('0x1'))(_0x143b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x143b('0x3'));var fs=require('fs');var path=require(_0x143b('0x4'));var rimraf=require(_0x143b('0x5'));var config=require(_0x143b('0x6'));var attributes=require('./variable.attributes');module[_0x143b('0x7')]=function(_0x553da9,_0xe867c8){return _0x553da9['define'](_0x143b('0x8'),attributes,{'tableName':_0x143b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97cc=['request-promise','path','rimraf','../../config/environment','exports','define','tools_variables','lodash','../../config/logger','api','moment','bluebird'];(function(_0x89a530,_0x5c2450){var _0x49b589=function(_0x394b1c){while(--_0x394b1c){_0x89a530['push'](_0x89a530['shift']());}};_0x49b589(++_0x5c2450);}(_0x97cc,0x73));var _0xc97c=function(_0x2c8560,_0x3f13f2){_0x2c8560=_0x2c8560-0x0;var _0xaee7f4=_0x97cc[_0x2c8560];return _0xaee7f4;};'use strict';var _=require(_0xc97c('0x0'));var util=require('util');var logger=require(_0xc97c('0x1'))(_0xc97c('0x2'));var moment=require(_0xc97c('0x3'));var BPromise=require(_0xc97c('0x4'));var rp=require(_0xc97c('0x5'));var fs=require('fs');var path=require(_0xc97c('0x6'));var rimraf=require(_0xc97c('0x7'));var config=require(_0xc97c('0x8'));var attributes=require('./variable.attributes');module[_0xc97c('0x9')]=function(_0x3985b9,_0x10580b){return _0x3985b9[_0xc97c('0xa')]('Variable',attributes,{'tableName':_0xc97c('0xb'),'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 eafc8c5..ac41b13 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x40d394,_0x27f0de){var _0x4f285d=function(_0x2c6c7e){while(--_0x2c6c7e){_0x40d394['push'](_0x40d394['shift']());}};_0x4f285d(++_0x27f0de);}(_0x55ca,0x126));var _0xa55c=function(_0x286f2b,_0x171c07){_0x286f2b=_0x286f2b-0x0;var _0x33d6f4=_0x55ca[_0x286f2b];return _0x33d6f4;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +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(_0x4a3940,_0x5e76f4){var _0x294950=function(_0x437ca9){while(--_0x437ca9){_0x4a3940['push'](_0x4a3940['shift']());}};_0x294950(++_0x5e76f4);}(_0x6aa7,0x178));var _0x76aa=function(_0x4fa213,_0x568c6a){_0x4fa213=_0x4fa213-0x0;var _0x1d5e57=_0x6aa7[_0x4fa213];return _0x1d5e57;};'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 diff --git a/server/api/version/index.js b/server/api/version/index.js index 978b4d0..e434407 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 _0x7032=['Router','../../components/auth/service','./version.controller','/fetch','fetch','get','/reset','isAuthenticated','/pull','pull','/restart','restart','exports','express'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0x7032,0x125));var _0x2703=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0x7032[_0x38fb8b];return _0x1ec681;};'use strict';var express=require(_0x2703('0x0'));var router=express[_0x2703('0x1')]();var auth=require(_0x2703('0x2'));var controller=require(_0x2703('0x3'));router['get']('/',controller['index']);router['get'](_0x2703('0x4'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x2703('0x5')]);router[_0x2703('0x6')](_0x2703('0x7'),auth[_0x2703('0x8')](),auth['canUpdate'](),controller['reset']);router[_0x2703('0x6')](_0x2703('0x9'),auth[_0x2703('0x8')](),auth['canUpdate'](),controller[_0x2703('0xa')]);router[_0x2703('0x6')](_0x2703('0xb'),auth['isAuthenticated'](),controller[_0x2703('0xc')]);router[_0x2703('0x6')]('/migrations',controller['migrations']);module[_0x2703('0xd')]=router; \ No newline at end of file +var _0x4125=['fetch','/reset','reset','/pull','pull','/restart','/migrations','migrations','exports','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate'];(function(_0x165a34,_0xa1da41){var _0x25a5ff=function(_0x2f34d0){while(--_0x2f34d0){_0x165a34['push'](_0x165a34['shift']());}};_0x25a5ff(++_0xa1da41);}(_0x4125,0x117));var _0x5412=function(_0x101424,_0x146dbf){_0x101424=_0x101424-0x0;var _0x4f4f04=_0x4125[_0x101424];return _0x4f4f04;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x5412('0x0'));var controller=require(_0x5412('0x1'));router[_0x5412('0x2')]('/',controller['index']);router[_0x5412('0x2')](_0x5412('0x3'),auth[_0x5412('0x4')](),auth[_0x5412('0x5')](),controller[_0x5412('0x6')]);router[_0x5412('0x2')](_0x5412('0x7'),auth[_0x5412('0x4')](),auth[_0x5412('0x5')](),controller[_0x5412('0x8')]);router['get'](_0x5412('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x5412('0xa')]);router['get'](_0x5412('0xb'),auth['isAuthenticated'](),controller['restart']);router[_0x5412('0x2')](_0x5412('0xc'),controller[_0x5412('0xd')]);module[_0x5412('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 799d19d..46d56a2 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 _0xfb4c=['query','latest','fetch','tags','2.0.0','status','json','master','error','info','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','join','Database\x20already\x20up-to-date','umzug','pkginfo','version','compare-versions','exec','../../config/pm2','../../config/logger','update','simple-git','root','exports'];(function(_0x5ca464,_0x1ed391){var _0x2654b5=function(_0x5245b3){while(--_0x5245b3){_0x5ca464['push'](_0x5ca464['shift']());}};_0x2654b5(++_0x1ed391);}(_0xfb4c,0x1df));var _0xcfb4=function(_0xf2b812,_0x5788ec){_0xf2b812=_0xf2b812-0x0;var _0x24df75=_0xfb4c[_0xf2b812];return _0x24df75;};'use strict';var Umzug=require(_0xcfb4('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xcfb4('0x1'))(module,_0xcfb4('0x2'));var compareVersions=require(_0xcfb4('0x3'));var exec=require('child_process')[_0xcfb4('0x4')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xcfb4('0x5'));var logger=require(_0xcfb4('0x6'))(_0xcfb4('0x7'));var git=require(_0xcfb4('0x8'))(config[_0xcfb4('0x9')]);exports['index']=function(_0x37f39c,_0x5269c5){var _0x1b825a={'current':module[_0xcfb4('0xa')][_0xcfb4('0x2')],'phonebar':0x2};if(_0x37f39c[_0xcfb4('0xb')]&&_0x37f39c[_0xcfb4('0xb')][_0xcfb4('0xc')]){return git[_0xcfb4('0xd')]()[_0xcfb4('0xe')](function(_0x4367ab,_0xce32f1){_0x1b825a[_0xcfb4('0xc')]=(_0x4367ab?module['exports'][_0xcfb4('0x2')]:_0xce32f1['latest'])||_0xcfb4('0xf');return _0x5269c5[_0xcfb4('0x10')](0xc8)['json'](_0x1b825a);});}else{return _0x5269c5[_0xcfb4('0x10')](0xc8)[_0xcfb4('0x11')](_0x1b825a);}};exports[_0xcfb4('0xd')]=function(_0x5c6c80,_0x27bcad){return git[_0xcfb4('0xd')](['origin',_0xcfb4('0x12')],function(_0x370125){if(_0x370125){logger[_0xcfb4('0x13')](_0x370125);return _0x27bcad[_0xcfb4('0x10')](0x1f4)['json'](_0x370125);}logger[_0xcfb4('0x14')]('git\x20fetch');return _0x27bcad[_0xcfb4('0x10')](0xc8)[_0xcfb4('0x11')]({'output':_0xcfb4('0x15')});});};exports['reset']=function(_0x42ca06,_0xfea028){return git[_0xcfb4('0x16')](['--hard',_0xcfb4('0x17')],function(_0x4a6df0){if(_0x4a6df0){logger['error'](_0x4a6df0);return _0xfea028[_0xcfb4('0x10')](0x1f4)['json'](_0x4a6df0);}logger[_0xcfb4('0x14')](_0xcfb4('0x18'));return _0xfea028[_0xcfb4('0x10')](0xc8)[_0xcfb4('0x11')]({'output':_0xcfb4('0x19')});});};exports[_0xcfb4('0x1a')]=function(_0x2a2722,_0x4de36d){exec('npm\x20install\x20--production',function(_0x1b8b49,_0x100494,_0x4a0a53){logger[_0xcfb4('0x14')](_0x100494);logger[_0xcfb4('0x14')](_0x4a0a53);if(_0x1b8b49){logger[_0xcfb4('0x13')](_0x1b8b49);return _0x4de36d[_0xcfb4('0x10')](0x1f4)[_0xcfb4('0x11')](_0x1b8b49);}return _0x4de36d['status'](0xc8)[_0xcfb4('0x11')]({'output':_0x100494});});};exports[_0xcfb4('0x1b')]=function(_0x115f11,_0x536480){return pm2['restart']('motion2')[_0xcfb4('0x1c')](function(_0x1c54a0){logger['info']('pm2\x20restart\x20motion\x20%s',_0x1c54a0);return _0x536480[_0xcfb4('0x10')](0xc8)[_0xcfb4('0x11')]({'output':_0xcfb4('0x1d')});})[_0xcfb4('0x1e')](function(_0x3fe102){logger[_0xcfb4('0x13')](_0x3fe102);return _0x536480['status'](0x1f4)[_0xcfb4('0x11')](_0x3fe102);});};exports[_0xcfb4('0x1f')]=function(_0x5732a6,_0x3810c2){var _0x5c75e8=fs[_0xcfb4('0x20')](path['join'](config[_0xcfb4('0x9')],_0xcfb4('0x21'),_0xcfb4('0x1f')));var _0xe371e7=[];for(var _0x1e67ad=0x0;_0x1e67ad<_0x5c75e8[_0xcfb4('0x22')];_0x1e67ad++){var _0x1e34f3=_0x5c75e8[_0x1e67ad][_0xcfb4('0x23')]('.js','');if(compareVersions(module[_0xcfb4('0xa')][_0xcfb4('0x2')],_0x1e34f3)===-0x1){_0xe371e7['push'](_0x1e34f3);}}if(_0xe371e7['length']){var _0x571c93=_0xe371e7[_0xcfb4('0x24')](compareVersions);var _0x45a754=new Umzug({'storage':_0xcfb4('0x25'),'storageOptions':{'model':db[_0xcfb4('0x26')],'modelName':_0xcfb4('0x26'),'columnName':_0xcfb4('0x2')},'migrations':{'params':[db[_0xcfb4('0x25')][_0xcfb4('0x27')](),db[_0xcfb4('0x25')][_0xcfb4('0x28')],function(){throw new Error(_0xcfb4('0x29'));}],'path':path['join'](config['root'],'server',_0xcfb4('0x1f')),'pattern':/\.js$/}});_0x45a754['up']({'migrations':_[_0xcfb4('0x2a')](_0x571c93,function(_0x1eb379){return _0x1eb379+_0xcfb4('0x2b');})})['then'](function(){return _0x3810c2[_0xcfb4('0x10')](0xc8)[_0xcfb4('0x11')]({'output':_0xcfb4('0x2c')+module[_0xcfb4('0xa')][_0xcfb4('0x2')]+_0xcfb4('0x2d')+_[_0xcfb4('0x2e')](_0x571c93),'migrations':_[_0xcfb4('0x2f')](_0x571c93)});})['catch'](function(_0x4c83f8){if(_0x4c83f8 instanceof db[_0xcfb4('0x25')]['UniqueConstraintError']){return _0x3810c2[_0xcfb4('0x10')](0xc8)[_0xcfb4('0x11')]({'output':_0xcfb4('0x30')});}else{return _0x3810c2['status'](0x1f4)[_0xcfb4('0x11')](_0x4c83f8);}});}else{return _0x3810c2[_0xcfb4('0x10')](0xc8)[_0xcfb4('0x11')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xeb45=['Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','latest','tags','2.0.0','status','json','fetch','origin','info','git\x20fetch','reset','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','join','server','replace','.js','push','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xeb45,0xd1));var _0x5eb4=function(_0x31ae97,_0x2868d7){_0x31ae97=_0x31ae97-0x0;var _0x3386d8=_0xeb45[_0x31ae97];return _0x3386d8;};'use strict';var Umzug=require(_0x5eb4('0x0'));var path=require(_0x5eb4('0x1'));var fs=require('fs');var _=require(_0x5eb4('0x2'));var pkginfo=require(_0x5eb4('0x3'))(module,_0x5eb4('0x4'));var compareVersions=require(_0x5eb4('0x5'));var exec=require(_0x5eb4('0x6'))[_0x5eb4('0x7')];var db=require(_0x5eb4('0x8'))['db'];var config=require(_0x5eb4('0x9'));var pm2=require(_0x5eb4('0xa'));var logger=require('../../config/logger')(_0x5eb4('0xb'));var git=require(_0x5eb4('0xc'))(config[_0x5eb4('0xd')]);exports[_0x5eb4('0xe')]=function(_0x5143c4,_0x1d98d){var _0x4d2669={'current':module[_0x5eb4('0xf')][_0x5eb4('0x4')],'phonebar':0x2};if(_0x5143c4[_0x5eb4('0x10')]&&_0x5143c4[_0x5eb4('0x10')][_0x5eb4('0x11')]){return git['fetch']()[_0x5eb4('0x12')](function(_0x3927e9,_0x19e058){_0x4d2669['latest']=(_0x3927e9?module[_0x5eb4('0xf')]['version']:_0x19e058[_0x5eb4('0x11')])||_0x5eb4('0x13');return _0x1d98d[_0x5eb4('0x14')](0xc8)[_0x5eb4('0x15')](_0x4d2669);});}else{return _0x1d98d[_0x5eb4('0x14')](0xc8)[_0x5eb4('0x15')](_0x4d2669);}};exports['fetch']=function(_0x4d09f2,_0xe8962a){return git[_0x5eb4('0x16')]([_0x5eb4('0x17'),'master'],function(_0x8ada3a){if(_0x8ada3a){logger['error'](_0x8ada3a);return _0xe8962a['status'](0x1f4)[_0x5eb4('0x15')](_0x8ada3a);}logger[_0x5eb4('0x18')](_0x5eb4('0x19'));return _0xe8962a[_0x5eb4('0x14')](0xc8)[_0x5eb4('0x15')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x5eb4('0x1a')]=function(_0x461289,_0x3fbf3f){return git['reset'](['--hard',_0x5eb4('0x1b')],function(_0x3a0cc7){if(_0x3a0cc7){logger[_0x5eb4('0x1c')](_0x3a0cc7);return _0x3fbf3f['status'](0x1f4)[_0x5eb4('0x15')](_0x3a0cc7);}logger[_0x5eb4('0x18')](_0x5eb4('0x1d'));return _0x3fbf3f['status'](0xc8)[_0x5eb4('0x15')]({'output':_0x5eb4('0x1e')});});};exports[_0x5eb4('0x1f')]=function(_0x2f5b94,_0x451f1b){exec('npm\x20install\x20--production',function(_0x4ef2e8,_0x20109c,_0x3fc6b7){logger['info'](_0x20109c);logger[_0x5eb4('0x18')](_0x3fc6b7);if(_0x4ef2e8){logger[_0x5eb4('0x1c')](_0x4ef2e8);return _0x451f1b[_0x5eb4('0x14')](0x1f4)[_0x5eb4('0x15')](_0x4ef2e8);}return _0x451f1b['status'](0xc8)[_0x5eb4('0x15')]({'output':_0x20109c});});};exports['restart']=function(_0x1e508a,_0x3bac12){return pm2[_0x5eb4('0x20')](_0x5eb4('0x21'))[_0x5eb4('0x22')](function(_0x307174){logger[_0x5eb4('0x18')](_0x5eb4('0x23'),_0x307174);return _0x3bac12[_0x5eb4('0x14')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x4c01cc){logger[_0x5eb4('0x1c')](_0x4c01cc);return _0x3bac12['status'](0x1f4)[_0x5eb4('0x15')](_0x4c01cc);});};exports['migrations']=function(_0x307252,_0x2fcf9f){var _0x177d1d=fs['readdirSync'](path[_0x5eb4('0x24')](config['root'],_0x5eb4('0x25'),'migrations'));var _0x252c00=[];for(var _0x3ad6b2=0x0;_0x3ad6b2<_0x177d1d['length'];_0x3ad6b2++){var _0x483708=_0x177d1d[_0x3ad6b2][_0x5eb4('0x26')](_0x5eb4('0x27'),'');if(compareVersions(module[_0x5eb4('0xf')][_0x5eb4('0x4')],_0x483708)===-0x1){_0x252c00[_0x5eb4('0x28')](_0x483708);}}if(_0x252c00['length']){var _0x3ea5cc=_0x252c00['sort'](compareVersions);var _0x483b48=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x5eb4('0x29'),'columnName':_0x5eb4('0x4')},'migrations':{'params':[db[_0x5eb4('0x2a')][_0x5eb4('0x2b')](),db['sequelize'][_0x5eb4('0x2c')],function(){throw new Error(_0x5eb4('0x2d'));}],'path':path[_0x5eb4('0x24')](config[_0x5eb4('0xd')],_0x5eb4('0x25'),_0x5eb4('0x2e')),'pattern':/\.js$/}});_0x483b48['up']({'migrations':_[_0x5eb4('0x2f')](_0x3ea5cc,function(_0x10bc40){return _0x10bc40+'.js';})})[_0x5eb4('0x22')](function(){return _0x2fcf9f[_0x5eb4('0x14')](0xc8)['json']({'output':_0x5eb4('0x30')+module[_0x5eb4('0xf')][_0x5eb4('0x4')]+'\x20to\x20'+_[_0x5eb4('0x31')](_0x3ea5cc),'migrations':_[_0x5eb4('0x24')](_0x3ea5cc)});})[_0x5eb4('0x32')](function(_0x373ddb){if(_0x373ddb instanceof db[_0x5eb4('0x2a')]['UniqueConstraintError']){return _0x2fcf9f[_0x5eb4('0x14')](0xc8)[_0x5eb4('0x15')]({'output':_0x5eb4('0x33')});}else{return _0x2fcf9f[_0x5eb4('0x14')](0x1f4)[_0x5eb4('0x15')](_0x373ddb);}});}else{return _0x2fcf9f[_0x5eb4('0x14')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 4088ffb..31139f5 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 _0x7c4c=['isAuthenticated','index','get','/describe','describe','/:id','show','create','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x588d38,_0x3a3925){var _0x46fd44=function(_0x40ae9b){while(--_0x40ae9b){_0x588d38['push'](_0x588d38['shift']());}};_0x46fd44(++_0x3a3925);}(_0x7c4c,0x1b0));var _0xc7c4=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x7c4c[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require('multer');var util=require(_0xc7c4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc7c4('0x1'));var router=express[_0xc7c4('0x2')]();var fs_extra=require(_0xc7c4('0x3'));var auth=require(_0xc7c4('0x4'));var interaction=require(_0xc7c4('0x5'));var config=require(_0xc7c4('0x6'));var controller=require(_0xc7c4('0x7'));router['get']('/',auth[_0xc7c4('0x8')](),controller[_0xc7c4('0x9')]);router[_0xc7c4('0xa')](_0xc7c4('0xb'),auth['isAuthenticated'](),controller[_0xc7c4('0xc')]);router[_0xc7c4('0xa')](_0xc7c4('0xd'),auth[_0xc7c4('0x8')](),controller[_0xc7c4('0xe')]);router['post']('/',auth[_0xc7c4('0x8')](),controller[_0xc7c4('0xf')]);router['put'](_0xc7c4('0xd'),auth[_0xc7c4('0x8')](),controller[_0xc7c4('0x10')]);router[_0xc7c4('0x11')](_0xc7c4('0xd'),auth[_0xc7c4('0x8')](),controller[_0xc7c4('0x12')]);module[_0xc7c4('0x13')]=router; \ No newline at end of file +var _0x6260=['describe','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','isAuthenticated','index','get','/describe'];(function(_0x3a255b,_0x5bcbd9){var _0x4600f9=function(_0x513f1c){while(--_0x513f1c){_0x3a255b['push'](_0x3a255b['shift']());}};_0x4600f9(++_0x5bcbd9);}(_0x6260,0xe5));var _0x0626=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0x6260[_0x83af7f];return _0x32d85c;};'use strict';var multer=require(_0x0626('0x0'));var util=require('util');var path=require(_0x0626('0x1'));var timeout=require(_0x0626('0x2'));var express=require(_0x0626('0x3'));var router=express[_0x0626('0x4')]();var fs_extra=require(_0x0626('0x5'));var auth=require(_0x0626('0x6'));var interaction=require(_0x0626('0x7'));var config=require('../../config/environment');var controller=require(_0x0626('0x8'));router['get']('/',auth[_0x0626('0x9')](),controller[_0x0626('0xa')]);router[_0x0626('0xb')](_0x0626('0xc'),auth['isAuthenticated'](),controller[_0x0626('0xd')]);router[_0x0626('0xb')](_0x0626('0xe'),auth[_0x0626('0x9')](),controller[_0x0626('0xf')]);router[_0x0626('0x10')]('/',auth[_0x0626('0x9')](),controller['create']);router[_0x0626('0x11')](_0x0626('0xe'),auth[_0x0626('0x9')](),controller[_0x0626('0x12')]);router[_0x0626('0x13')](_0x0626('0xe'),auth[_0x0626('0x9')](),controller[_0x0626('0x14')]);module[_0x0626('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 525d13d..bed0a7d 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 _0x48ac=['STRING','DATE','BOOLEAN','INTEGER','exports'];(function(_0x56fe8d,_0x40acbd){var _0x3bc23d=function(_0x2882a8){while(--_0x2882a8){_0x56fe8d['push'](_0x56fe8d['shift']());}};_0x3bc23d(++_0x40acbd);}(_0x48ac,0xe0));var _0xc48a=function(_0x315a30,_0x3f0006){_0x315a30=_0x315a30-0x0;var _0x27aa8a=_0x48ac[_0x315a30];return _0x27aa8a;};'use strict';var Sequelize=require('sequelize');module[_0xc48a('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc48a('0x1')]},'calleridnum':{'type':Sequelize[_0xc48a('0x1')]},'calleridname':{'type':Sequelize[_0xc48a('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xc48a('0x1')]},'membername':{'type':Sequelize[_0xc48a('0x1')]},'agentcalledAt':{'type':Sequelize[_0xc48a('0x2')]},'agentconnectAt':{'type':Sequelize[_0xc48a('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xc48a('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc48a('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc48a('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc48a('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc48a('0x4')]},'reason':{'type':Sequelize[_0xc48a('0x1')]},'lastevent':{'type':Sequelize[_0xc48a('0x1')]},'channel':{'type':Sequelize[_0xc48a('0x1')]},'channelstate':{'type':Sequelize[_0xc48a('0x4')]},'channelstatedesc':{'type':Sequelize[_0xc48a('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc48a('0x1')]},'connectedlinename':{'type':Sequelize[_0xc48a('0x1')]},'language':{'type':Sequelize[_0xc48a('0x1')]},'accountcode':{'type':Sequelize[_0xc48a('0x1')]},'context':{'type':Sequelize[_0xc48a('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc48a('0x1')]},'destchannel':{'type':Sequelize[_0xc48a('0x1')]},'destchannelstate':{'type':Sequelize[_0xc48a('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xc48a('0x1')]},'destcalleridname':{'type':Sequelize[_0xc48a('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xc48a('0x1')]},'destlanguage':{'type':Sequelize[_0xc48a('0x1')]},'destaccountcode':{'type':Sequelize[_0xc48a('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xc48a('0x1')]},'destpriority':{'type':Sequelize[_0xc48a('0x1')]},'destuniqueid':{'type':Sequelize[_0xc48a('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xc48a('0x1')]},'transfer':{'type':Sequelize[_0xc48a('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xc48a('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xc48a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x69d3=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x1fbebd,_0x511f14){var _0x29569b=function(_0x5a68d5){while(--_0x5a68d5){_0x1fbebd['push'](_0x1fbebd['shift']());}};_0x29569b(++_0x511f14);}(_0x69d3,0xda));var _0x369d=function(_0x43799e,_0x2fa63a){_0x43799e=_0x43799e-0x0;var _0x5cb4bc=_0x69d3[_0x43799e];return _0x5cb4bc;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'type':{'type':Sequelize[_0x369d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x369d('0x2')]},'calleridname':{'type':Sequelize[_0x369d('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x369d('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x369d('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x369d('0x3')]},'agentdumpAt':{'type':Sequelize[_0x369d('0x3')]},'holdtime':{'type':Sequelize[_0x369d('0x4')]},'agentcomplete':{'type':Sequelize[_0x369d('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x369d('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x369d('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x369d('0x4')]},'agentacw':{'type':Sequelize[_0x369d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x369d('0x2')]},'channel':{'type':Sequelize[_0x369d('0x2')]},'channelstate':{'type':Sequelize[_0x369d('0x4')]},'channelstatedesc':{'type':Sequelize[_0x369d('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x369d('0x2')]},'accountcode':{'type':Sequelize[_0x369d('0x2')]},'context':{'type':Sequelize[_0x369d('0x2')]},'exten':{'type':Sequelize[_0x369d('0x2')]},'priority':{'type':Sequelize[_0x369d('0x2')]},'destchannel':{'type':Sequelize[_0x369d('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x369d('0x2')]},'destcalleridnum':{'type':Sequelize[_0x369d('0x2')]},'destcalleridname':{'type':Sequelize[_0x369d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x369d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x369d('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x369d('0x2')]},'destpriority':{'type':Sequelize[_0x369d('0x2')]},'destuniqueid':{'type':Sequelize[_0x369d('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x369d('0x2')]},'transfer':{'type':Sequelize[_0x369d('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x369d('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x369d('0x2')]},'transferuniqueid':{'type':Sequelize[_0x369d('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 7aa1088..9830528 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(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 8e53f1d..ceaa0b9 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 _0xe132=['report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','VoiceAgentReport'];(function(_0x1e919c,_0x4987ef){var _0xaf5297=function(_0x491479){while(--_0x491479){_0x1e919c['push'](_0x1e919c['shift']());}};_0xaf5297(++_0x4987ef);}(_0xe132,0x162));var _0x2e13=function(_0x6cb262,_0x124cce){_0x6cb262=_0x6cb262-0x0;var _0x12bb02=_0xe132[_0x6cb262];return _0x12bb02;};'use strict';var _=require(_0x2e13('0x0'));var util=require('util');var logger=require(_0x2e13('0x1'))(_0x2e13('0x2'));var moment=require(_0x2e13('0x3'));var BPromise=require(_0x2e13('0x4'));var rp=require(_0x2e13('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x260dc1,_0x2f9d00){return _0x260dc1[_0x2e13('0x8')](_0x2e13('0x9'),attributes,{'tableName':_0x2e13('0xa'),'paranoid':![],'indexes':[{'fields':[_0x2e13('0xb'),_0x2e13('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x815b=['./voiceAgentReport.attributes','exports','define','report_agent','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x5a9731,_0x56957c){var _0x1b8c3f=function(_0x1c7e90){while(--_0x1c7e90){_0x5a9731['push'](_0x5a9731['shift']());}};_0x1b8c3f(++_0x56957c);}(_0x815b,0xb4));var _0xb815=function(_0x75fedc,_0x401563){_0x75fedc=_0x75fedc-0x0;var _0x3ddc8e=_0x815b[_0x75fedc];return _0x3ddc8e;};'use strict';var _=require(_0xb815('0x0'));var util=require(_0xb815('0x1'));var logger=require(_0xb815('0x2'))(_0xb815('0x3'));var moment=require(_0xb815('0x4'));var BPromise=require('bluebird');var rp=require(_0xb815('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb815('0x6'));var attributes=require(_0xb815('0x7'));module[_0xb815('0x8')]=function(_0x5a5c18,_0x466899){return _0x5a5c18[_0xb815('0x9')]('VoiceAgentReport',attributes,{'tableName':_0xb815('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index d7df440..87f015a 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 _0xf779=['UpdateVoiceAgentReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xf779,0x1b5));var _0x9f77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf779[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9f77('0x0'));var util=require(_0x9f77('0x1'));var moment=require(_0x9f77('0x2'));var BPromise=require(_0x9f77('0x3'));var rs=require(_0x9f77('0x4'));var fs=require('fs');var Redis=require(_0x9f77('0x5'));var db=require(_0x9f77('0x6'))['db'];var utils=require(_0x9f77('0x7'));var logger=require('../../config/logger')(_0x9f77('0x8'));var config=require('../../config/environment');var jayson=require(_0x9f77('0x9'));var client=jayson['client'][_0x9f77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x606075,_0x1fab3a,_0x42294c){return new BPromise(function(_0x4b674c,_0x4aa6e6){return client[_0x9f77('0xb')](_0x606075,_0x42294c)[_0x9f77('0xc')](function(_0x111bc6){logger[_0x9f77('0xd')](_0x9f77('0xe'),_0x1fab3a,'request\x20sent');logger[_0x9f77('0xf')](_0x9f77('0x10'),_0x1fab3a,_0x9f77('0x11'),JSON[_0x9f77('0x12')](_0x111bc6));if(_0x111bc6[_0x9f77('0x13')]){if(_0x111bc6[_0x9f77('0x13')]['code']===0x1f4){logger[_0x9f77('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x1fab3a,_0x111bc6[_0x9f77('0x13')][_0x9f77('0x14')]);return _0x4aa6e6(_0x111bc6['error'][_0x9f77('0x14')]);}logger[_0x9f77('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x1fab3a,_0x111bc6[_0x9f77('0x13')][_0x9f77('0x14')]);return _0x4b674c(_0x111bc6['error'][_0x9f77('0x14')]);}else{logger[_0x9f77('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x1fab3a,_0x9f77('0x11'));_0x4b674c(_0x111bc6[_0x9f77('0x15')]['message']);}})[_0x9f77('0x16')](function(_0x23bdb6){logger[_0x9f77('0x13')](_0x9f77('0xe'),_0x1fab3a,_0x23bdb6);_0x4aa6e6(_0x23bdb6);});});}exports[_0x9f77('0x17')]=function(_0x705a7b){var _0xf2e976=this;return new Promise(function(_0x24e071,_0x4b64ea){return db[_0x9f77('0x18')]['create'](_0x705a7b[_0x9f77('0x19')],{'raw':_0x705a7b['options']?_0x705a7b[_0x9f77('0x1a')][_0x9f77('0x1b')]===undefined?!![]:![]:!![]})[_0x9f77('0xc')](function(_0x33d23d){logger[_0x9f77('0xd')](_0x9f77('0x17'),_0x705a7b);logger[_0x9f77('0xf')](_0x9f77('0x17'),_0x705a7b,JSON[_0x9f77('0x12')](_0x33d23d));_0x24e071(_0x33d23d);})[_0x9f77('0x16')](function(_0x51aaf6){logger[_0x9f77('0x13')](_0x9f77('0x17'),_0x51aaf6[_0x9f77('0x14')],_0x705a7b);_0x4b64ea(_0xf2e976[_0x9f77('0x13')](0x1f4,_0x51aaf6[_0x9f77('0x14')]));});});};exports[_0x9f77('0x1c')]=function(_0xe479fc){var _0x20be12=this;return new Promise(function(_0x1bc6b2,_0x1de6d2){return db[_0x9f77('0x18')][_0x9f77('0x1d')](_0xe479fc[_0x9f77('0x19')],{'raw':_0xe479fc[_0x9f77('0x1a')]?_0xe479fc[_0x9f77('0x1a')][_0x9f77('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe479fc[_0x9f77('0x1a')]?_0xe479fc['options']['where']||null:null,'attributes':_0xe479fc['options']?_0xe479fc[_0x9f77('0x1a')]['attributes']||null:null,'limit':_0xe479fc[_0x9f77('0x1a')]?_0xe479fc[_0x9f77('0x1a')][_0x9f77('0x1e')]||null:null})['then'](function(_0x1d6fcb){logger[_0x9f77('0xd')](_0x9f77('0x1c'),_0xe479fc);logger[_0x9f77('0xf')](_0x9f77('0x1c'),_0xe479fc,JSON[_0x9f77('0x12')](_0x1d6fcb));_0x1bc6b2(_0x1d6fcb);})[_0x9f77('0x16')](function(_0x3a03c7){logger['error'](_0x9f77('0x1c'),_0x3a03c7['message'],_0xe479fc);_0x1de6d2(_0x20be12[_0x9f77('0x13')](0x1f4,_0x3a03c7[_0x9f77('0x14')]));});});}; \ No newline at end of file +var _0x6eb3=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','VoiceAgentReport','update','attributes','limit','lodash','util','moment'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x6eb3,0x11d));var _0x36eb=function(_0x11457d,_0x334646){_0x11457d=_0x11457d-0x0;var _0x420575=_0x6eb3[_0x11457d];return _0x420575;};'use strict';var _=require(_0x36eb('0x0'));var util=require(_0x36eb('0x1'));var moment=require(_0x36eb('0x2'));var BPromise=require(_0x36eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36eb('0x4'));var db=require(_0x36eb('0x5'))['db'];var utils=require(_0x36eb('0x6'));var logger=require('../../config/logger')(_0x36eb('0x7'));var config=require('../../config/environment');var jayson=require(_0x36eb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36f184,_0x892ac2,_0x41f9d2){return new BPromise(function(_0x9198c7,_0x49278f){return client[_0x36eb('0x9')](_0x36f184,_0x41f9d2)[_0x36eb('0xa')](function(_0x550893){logger[_0x36eb('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x892ac2,_0x36eb('0xc'));logger[_0x36eb('0xd')](_0x36eb('0xe'),_0x892ac2,_0x36eb('0xc'),JSON[_0x36eb('0xf')](_0x550893));if(_0x550893[_0x36eb('0x10')]){if(_0x550893[_0x36eb('0x10')][_0x36eb('0x11')]===0x1f4){logger[_0x36eb('0x10')](_0x36eb('0x12'),_0x892ac2,_0x550893[_0x36eb('0x10')][_0x36eb('0x13')]);return _0x49278f(_0x550893[_0x36eb('0x10')][_0x36eb('0x13')]);}logger['error'](_0x36eb('0x12'),_0x892ac2,_0x550893[_0x36eb('0x10')][_0x36eb('0x13')]);return _0x9198c7(_0x550893[_0x36eb('0x10')][_0x36eb('0x13')]);}else{logger[_0x36eb('0xb')](_0x36eb('0x12'),_0x892ac2,_0x36eb('0xc'));_0x9198c7(_0x550893[_0x36eb('0x14')][_0x36eb('0x13')]);}})[_0x36eb('0x15')](function(_0x567a60){logger[_0x36eb('0x10')](_0x36eb('0x12'),_0x892ac2,_0x567a60);_0x49278f(_0x567a60);});});}exports[_0x36eb('0x16')]=function(_0x4cb816){var _0x50720a=this;return new Promise(function(_0x51df72,_0x41e521){return db['VoiceAgentReport'][_0x36eb('0x17')](_0x4cb816[_0x36eb('0x18')],{'raw':_0x4cb816[_0x36eb('0x19')]?_0x4cb816['options'][_0x36eb('0x1a')]===undefined?!![]:![]:!![]})[_0x36eb('0xa')](function(_0x171a6a){logger[_0x36eb('0xb')](_0x36eb('0x16'),_0x4cb816);logger[_0x36eb('0xd')]('CreateVoiceAgentReport',_0x4cb816,JSON[_0x36eb('0xf')](_0x171a6a));_0x51df72(_0x171a6a);})['catch'](function(_0x2ba29a){logger['error'](_0x36eb('0x16'),_0x2ba29a['message'],_0x4cb816);_0x41e521(_0x50720a['error'](0x1f4,_0x2ba29a[_0x36eb('0x13')]));});});};exports[_0x36eb('0x1b')]=function(_0x12e4a6){var _0x26f1d3=this;return new Promise(function(_0x262dc7,_0x297825){return db[_0x36eb('0x1c')][_0x36eb('0x1d')](_0x12e4a6[_0x36eb('0x18')],{'raw':_0x12e4a6[_0x36eb('0x19')]?_0x12e4a6[_0x36eb('0x19')][_0x36eb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12e4a6[_0x36eb('0x19')]?_0x12e4a6['options']['where']||null:null,'attributes':_0x12e4a6['options']?_0x12e4a6['options'][_0x36eb('0x1e')]||null:null,'limit':_0x12e4a6[_0x36eb('0x19')]?_0x12e4a6[_0x36eb('0x19')][_0x36eb('0x1f')]||null:null})['then'](function(_0x28a3b9){logger[_0x36eb('0xb')]('UpdateVoiceAgentReport',_0x12e4a6);logger[_0x36eb('0xd')](_0x36eb('0x1b'),_0x12e4a6,JSON['stringify'](_0x28a3b9));_0x262dc7(_0x28a3b9);})[_0x36eb('0x15')](function(_0x43a08c){logger[_0x36eb('0x10')](_0x36eb('0x1b'),_0x43a08c[_0x36eb('0x13')],_0x12e4a6);_0x297825(_0x26f1d3['error'](0x1f4,_0x43a08c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 6d303c3..df6412c 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 _0x29d4=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','exports','multer','path','connect-timeout'];(function(_0x174490,_0x457074){var _0x4a6446=function(_0x1e6f73){while(--_0x1e6f73){_0x174490['push'](_0x174490['shift']());}};_0x4a6446(++_0x457074);}(_0x29d4,0x1a1));var _0x429d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x29d4[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x429d('0x0'));var util=require('util');var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express[_0x429d('0x4')]();var fs_extra=require(_0x429d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var controller=require(_0x429d('0x8'));router[_0x429d('0x9')]('/',auth[_0x429d('0xa')](),controller[_0x429d('0xb')]);router[_0x429d('0x9')](_0x429d('0xc'),auth['isAuthenticated'](),controller[_0x429d('0xd')]);router['get'](_0x429d('0xe'),auth[_0x429d('0xa')](),controller[_0x429d('0xf')]);router['post']('/',auth[_0x429d('0xa')](),controller[_0x429d('0x10')]);router['put'](_0x429d('0xe'),auth[_0x429d('0xa')](),controller[_0x429d('0x11')]);router['delete'](_0x429d('0xe'),auth[_0x429d('0xa')](),controller[_0x429d('0x12')]);module[_0x429d('0x13')]=router; \ No newline at end of file +var _0x9957=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x142d9b,_0x3d6a78){var _0x526e93=function(_0x40bc99){while(--_0x40bc99){_0x142d9b['push'](_0x142d9b['shift']());}};_0x526e93(++_0x3d6a78);}(_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('0xf')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')](_0x7995('0x12'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);module[_0x7995('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 8d8377a..362214e 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 _0xa1e0=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','outbound','inbound-fax','outbound-fax','TEXT'];(function(_0x50aa80,_0x2927a5){var _0x3ac6af=function(_0x47bd85){while(--_0x47bd85){_0x50aa80['push'](_0x50aa80['shift']());}};_0x3ac6af(++_0x2927a5);}(_0xa1e0,0xb2));var _0x0a1e=function(_0x32b493,_0x264127){_0x32b493=_0x32b493-0x0;var _0x42b6f4=_0xa1e0[_0x32b493];return _0x42b6f4;};'use strict';var Sequelize=require(_0x0a1e('0x0'));module[_0x0a1e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a1e('0x2')]},'type':{'type':Sequelize[_0x0a1e('0x3')](_0x0a1e('0x4'),'internal',_0x0a1e('0x5'),_0x0a1e('0x6'),_0x0a1e('0x7'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0a1e('0x2')]},'source':{'type':Sequelize[_0x0a1e('0x2')]},'destination':{'type':Sequelize[_0x0a1e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a1e('0x2')]},'callerid':{'type':Sequelize[_0x0a1e('0x2')]},'channel':{'type':Sequelize[_0x0a1e('0x2')]},'destinationchannel':{'type':Sequelize[_0x0a1e('0x2')]},'lastapplication':{'type':Sequelize[_0x0a1e('0x2')]},'lastdata':{'type':Sequelize[_0x0a1e('0x8')]},'starttime':{'type':Sequelize[_0x0a1e('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x0a1e('0x9')]},'endtime':{'type':Sequelize[_0x0a1e('0x9')]},'duration':{'type':Sequelize[_0x0a1e('0xa')]},'billableseconds':{'type':Sequelize[_0x0a1e('0xa')]},'mohtime':{'type':Sequelize[_0x0a1e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x0a1e('0x2')]},'userfield':{'type':Sequelize[_0x0a1e('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a1e('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x0a1e('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x72f6=['internal','outbound','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','inbound'];(function(_0x4bde1e,_0x2b957e){var _0x787b7=function(_0x3117b8){while(--_0x3117b8){_0x4bde1e['push'](_0x4bde1e['shift']());}};_0x787b7(++_0x2b957e);}(_0x72f6,0x1a9));var _0x672f=function(_0xf88c17,_0x26849a){_0xf88c17=_0xf88c17-0x0;var _0x321e7e=_0x72f6[_0xf88c17];return _0x321e7e;};'use strict';var Sequelize=require(_0x672f('0x0'));module[_0x672f('0x1')]={'uniqueid':{'type':Sequelize[_0x672f('0x2')]},'type':{'type':Sequelize['ENUM'](_0x672f('0x3'),_0x672f('0x4'),_0x672f('0x5'),_0x672f('0x6'),'outbound-fax',_0x672f('0x7'))},'tag':{'type':Sequelize[_0x672f('0x2')]},'accountcode':{'type':Sequelize[_0x672f('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x672f('0x2')]},'destinationcontext':{'type':Sequelize[_0x672f('0x2')]},'callerid':{'type':Sequelize[_0x672f('0x2')]},'channel':{'type':Sequelize[_0x672f('0x2')]},'destinationchannel':{'type':Sequelize[_0x672f('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x672f('0x8')]},'starttime':{'type':Sequelize[_0x672f('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x672f('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x672f('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x672f('0x2')]},'userfield':{'type':Sequelize[_0x672f('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x672f('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x672f('0x2')]},'note':{'type':Sequelize[_0x672f('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x672f('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 6bcb33d..9ce8298 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0xadb5,0xad));var _0x5adb=function(_0x28be48,_0x401958){_0x28be48=_0x28be48-0x0;var _0x1dc8a9=_0xadb5[_0x28be48];return _0x1dc8a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x1e93ef,_0x2af9d8){var _0xf1cc53=function(_0x14beb8){while(--_0x14beb8){_0x1e93ef['push'](_0x1e93ef['shift']());}};_0xf1cc53(++_0x2af9d8);}(_0xb10b,0x12a));var _0xbb10=function(_0x37d718,_0x4b5779){_0x37d718=_0x37d718-0x0;var _0x1b650a=_0xb10b[_0x37d718];return _0x1b650a;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 6349f75..1d9ccd2 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 _0x8d92=['request-promise','../../config/environment','./voiceCallReport.attributes','exports','report_call','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x8d92,0x124));var _0x28d9=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0x8d92[_0x418549];return _0x288826;};'use strict';var _=require(_0x28d9('0x0'));var util=require(_0x28d9('0x1'));var logger=require(_0x28d9('0x2'))('api');var moment=require(_0x28d9('0x3'));var BPromise=require(_0x28d9('0x4'));var rp=require(_0x28d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x28d9('0x6'));var attributes=require(_0x28d9('0x7'));module[_0x28d9('0x8')]=function(_0x2dda65,_0x41a40a){return _0x2dda65['define']('VoiceCallReport',attributes,{'tableName':_0x28d9('0x9'),'paranoid':![],'indexes':[{'fields':[_0x28d9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a3d=['request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','define','report_call','uniqueid','lodash','util','moment','bluebird'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x7a3d,0xa1));var _0xd7a3=function(_0xee4986,_0xdd46e2){_0xee4986=_0xee4986-0x0;var _0x5090aa=_0x7a3d[_0xee4986];return _0x5090aa;};'use strict';var _=require(_0xd7a3('0x0'));var util=require(_0xd7a3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd7a3('0x2'));var BPromise=require(_0xd7a3('0x3'));var rp=require(_0xd7a3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd7a3('0x5'));var config=require(_0xd7a3('0x6'));var attributes=require(_0xd7a3('0x7'));module['exports']=function(_0x418a6a,_0x29e16d){return _0x418a6a[_0xd7a3('0x8')]('VoiceCallReport',attributes,{'tableName':_0xd7a3('0x9'),'paranoid':![],'indexes':[{'fields':[_0xd7a3('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 88b3b05..8ca893e 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 _0x95a1=['raw','attributes','limit','include','map','model','create','body','CreateVoiceCallReport','where','UpdateVoiceCallReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x95a1,0x14f));var _0x195a=function(_0x2ee80b,_0x56504a){_0x2ee80b=_0x2ee80b-0x0;var _0x2c17cf=_0x95a1[_0x2ee80b];return _0x2c17cf;};'use strict';var _=require(_0x195a('0x0'));var util=require(_0x195a('0x1'));var moment=require('moment');var BPromise=require(_0x195a('0x2'));var rs=require(_0x195a('0x3'));var fs=require('fs');var Redis=require(_0x195a('0x4'));var db=require(_0x195a('0x5'))['db'];var utils=require(_0x195a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x195a('0x7'));var client=jayson[_0x195a('0x8')][_0x195a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4014be,_0xfb2d43,_0x2bbd27){return new BPromise(function(_0x3dae99,_0x4a239f){return client['request'](_0x4014be,_0x2bbd27)[_0x195a('0xa')](function(_0x250f84){logger[_0x195a('0xb')](_0x195a('0xc'),_0xfb2d43,_0x195a('0xd'));logger[_0x195a('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0xfb2d43,_0x195a('0xd'),JSON[_0x195a('0xf')](_0x250f84));if(_0x250f84[_0x195a('0x10')]){if(_0x250f84['error'][_0x195a('0x11')]===0x1f4){logger[_0x195a('0x10')](_0x195a('0xc'),_0xfb2d43,_0x250f84[_0x195a('0x10')][_0x195a('0x12')]);return _0x4a239f(_0x250f84[_0x195a('0x10')][_0x195a('0x12')]);}logger[_0x195a('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0xfb2d43,_0x250f84[_0x195a('0x10')][_0x195a('0x12')]);return _0x3dae99(_0x250f84[_0x195a('0x10')][_0x195a('0x12')]);}else{logger[_0x195a('0xb')](_0x195a('0xc'),_0xfb2d43,_0x195a('0xd'));_0x3dae99(_0x250f84[_0x195a('0x13')][_0x195a('0x12')]);}})[_0x195a('0x14')](function(_0x45bf3d){logger[_0x195a('0x10')](_0x195a('0xc'),_0xfb2d43,_0x45bf3d);_0x4a239f(_0x45bf3d);});});}exports[_0x195a('0x15')]=function(_0x2c0a82){var _0x456b65=this;return new Promise(function(_0x447f5b,_0x539188){return db[_0x195a('0x16')][_0x195a('0x17')]({'raw':_0x2c0a82[_0x195a('0x18')]?_0x2c0a82[_0x195a('0x18')][_0x195a('0x19')]===undefined?!![]:![]:!![],'where':_0x2c0a82['options']?_0x2c0a82[_0x195a('0x18')]['where']||null:null,'attributes':_0x2c0a82[_0x195a('0x18')]?_0x2c0a82[_0x195a('0x18')][_0x195a('0x1a')]||null:null,'limit':_0x2c0a82[_0x195a('0x18')]?_0x2c0a82[_0x195a('0x18')][_0x195a('0x1b')]||null:null,'include':_0x2c0a82['options']?_0x2c0a82[_0x195a('0x18')][_0x195a('0x1c')]?_['map'](_0x2c0a82[_0x195a('0x18')][_0x195a('0x1c')],function(_0x3abfca){return{'model':db[_0x3abfca['model']],'as':_0x3abfca['as'],'attributes':_0x3abfca[_0x195a('0x1a')],'include':_0x3abfca['include']?_[_0x195a('0x1d')](_0x3abfca[_0x195a('0x1c')],function(_0xf44139){return{'model':db[_0xf44139['model']],'as':_0xf44139['as'],'attributes':_0xf44139['attributes'],'include':_0xf44139['include']?_[_0x195a('0x1d')](_0xf44139[_0x195a('0x1c')],function(_0x387b1b){return{'model':db[_0x387b1b[_0x195a('0x1e')]],'as':_0x387b1b['as'],'attributes':_0x387b1b[_0x195a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x195a('0xa')](function(_0x2857c7){logger[_0x195a('0xb')](_0x195a('0x15'),_0x2c0a82);logger[_0x195a('0xe')](_0x195a('0x15'),_0x2c0a82,JSON[_0x195a('0xf')](_0x2857c7));_0x447f5b(_0x2857c7);})[_0x195a('0x14')](function(_0x3605ed){logger['error'](_0x195a('0x15'),_0x3605ed['message'],_0x2c0a82);_0x539188(_0x456b65[_0x195a('0x10')](0x1f4,_0x3605ed[_0x195a('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x110512){var _0x3509b2=this;return new Promise(function(_0x355ad4,_0x33fcec){return db['VoiceCallReport'][_0x195a('0x1f')](_0x110512[_0x195a('0x20')],{'raw':_0x110512[_0x195a('0x18')]?_0x110512[_0x195a('0x18')][_0x195a('0x19')]===undefined?!![]:![]:!![]})[_0x195a('0xa')](function(_0x16e0e2){logger[_0x195a('0xb')]('CreateVoiceCallReport',_0x110512);logger[_0x195a('0xe')](_0x195a('0x21'),_0x110512,JSON['stringify'](_0x16e0e2));_0x355ad4(_0x16e0e2);})[_0x195a('0x14')](function(_0x120d81){logger['error']('CreateVoiceCallReport',_0x120d81[_0x195a('0x12')],_0x110512);_0x33fcec(_0x3509b2['error'](0x1f4,_0x120d81[_0x195a('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x4099fc){var _0x4dfc15=this;return new Promise(function(_0x11a8b,_0x3f00c2){return db[_0x195a('0x16')]['update'](_0x4099fc[_0x195a('0x20')],{'raw':_0x4099fc['options']?_0x4099fc[_0x195a('0x18')][_0x195a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4099fc[_0x195a('0x18')]?_0x4099fc[_0x195a('0x18')][_0x195a('0x22')]||null:null,'attributes':_0x4099fc[_0x195a('0x18')]?_0x4099fc[_0x195a('0x18')][_0x195a('0x1a')]||null:null,'limit':_0x4099fc[_0x195a('0x18')]?_0x4099fc['options'][_0x195a('0x1b')]||null:null})['then'](function(_0xd682c9){logger[_0x195a('0xb')]('UpdateVoiceCallReport',_0x4099fc);logger[_0x195a('0xe')](_0x195a('0x23'),_0x4099fc,JSON['stringify'](_0xd682c9));_0x11a8b(_0xd682c9);})[_0x195a('0x14')](function(_0x1fcd3b){logger[_0x195a('0x10')](_0x195a('0x23'),_0x1fcd3b[_0x195a('0x12')],_0x4099fc);_0x3f00c2(_0x4dfc15[_0x195a('0x10')](0x1f4,_0x1fcd3b[_0x195a('0x12')]));});});}; \ No newline at end of file +var _0x3ceb=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceCallReport','findAll','options','raw','limit','map','include','model','attributes','debug','VoiceCallReport','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4fe135,_0x588d33){var _0x4466ad=function(_0x3d504c){while(--_0x3d504c){_0x4fe135['push'](_0x4fe135['shift']());}};_0x4466ad(++_0x588d33);}(_0x3ceb,0x131));var _0xb3ce=function(_0x426434,_0x2b1073){_0x426434=_0x426434-0x0;var _0x2450fa=_0x3ceb[_0x426434];return _0x2450fa;};'use strict';var _=require(_0xb3ce('0x0'));var util=require(_0xb3ce('0x1'));var moment=require(_0xb3ce('0x2'));var BPromise=require(_0xb3ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3ce('0x4'));var db=require(_0xb3ce('0x5'))['db'];var utils=require(_0xb3ce('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb3ce('0x7'));var jayson=require(_0xb3ce('0x8'));var client=jayson[_0xb3ce('0x9')][_0xb3ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25d8c6,_0x2c35e0,_0x3b652b){return new BPromise(function(_0xd0f605,_0x39e2ed){return client[_0xb3ce('0xb')](_0x25d8c6,_0x3b652b)[_0xb3ce('0xc')](function(_0x304f13){logger[_0xb3ce('0xd')](_0xb3ce('0xe'),_0x2c35e0,'request\x20sent');logger['debug'](_0xb3ce('0xf'),_0x2c35e0,_0xb3ce('0x10'),JSON[_0xb3ce('0x11')](_0x304f13));if(_0x304f13[_0xb3ce('0x12')]){if(_0x304f13['error']['code']===0x1f4){logger[_0xb3ce('0x12')](_0xb3ce('0xe'),_0x2c35e0,_0x304f13[_0xb3ce('0x12')][_0xb3ce('0x13')]);return _0x39e2ed(_0x304f13['error']['message']);}logger[_0xb3ce('0x12')](_0xb3ce('0xe'),_0x2c35e0,_0x304f13[_0xb3ce('0x12')][_0xb3ce('0x13')]);return _0xd0f605(_0x304f13[_0xb3ce('0x12')][_0xb3ce('0x13')]);}else{logger[_0xb3ce('0xd')](_0xb3ce('0xe'),_0x2c35e0,_0xb3ce('0x10'));_0xd0f605(_0x304f13[_0xb3ce('0x14')]['message']);}})[_0xb3ce('0x15')](function(_0x4b8e55){logger['error'](_0xb3ce('0xe'),_0x2c35e0,_0x4b8e55);_0x39e2ed(_0x4b8e55);});});}exports[_0xb3ce('0x16')]=function(_0x278ff5){var _0x57ceb2=this;return new Promise(function(_0x462801,_0x54bc6e){return db['VoiceCallReport'][_0xb3ce('0x17')]({'raw':_0x278ff5[_0xb3ce('0x18')]?_0x278ff5[_0xb3ce('0x18')][_0xb3ce('0x19')]===undefined?!![]:![]:!![],'where':_0x278ff5[_0xb3ce('0x18')]?_0x278ff5[_0xb3ce('0x18')]['where']||null:null,'attributes':_0x278ff5[_0xb3ce('0x18')]?_0x278ff5[_0xb3ce('0x18')]['attributes']||null:null,'limit':_0x278ff5[_0xb3ce('0x18')]?_0x278ff5[_0xb3ce('0x18')][_0xb3ce('0x1a')]||null:null,'include':_0x278ff5[_0xb3ce('0x18')]?_0x278ff5[_0xb3ce('0x18')]['include']?_[_0xb3ce('0x1b')](_0x278ff5[_0xb3ce('0x18')][_0xb3ce('0x1c')],function(_0x1a9434){return{'model':db[_0x1a9434[_0xb3ce('0x1d')]],'as':_0x1a9434['as'],'attributes':_0x1a9434[_0xb3ce('0x1e')],'include':_0x1a9434[_0xb3ce('0x1c')]?_['map'](_0x1a9434[_0xb3ce('0x1c')],function(_0x5196f5){return{'model':db[_0x5196f5[_0xb3ce('0x1d')]],'as':_0x5196f5['as'],'attributes':_0x5196f5[_0xb3ce('0x1e')],'include':_0x5196f5[_0xb3ce('0x1c')]?_[_0xb3ce('0x1b')](_0x5196f5[_0xb3ce('0x1c')],function(_0x11b91){return{'model':db[_0x11b91['model']],'as':_0x11b91['as'],'attributes':_0x11b91[_0xb3ce('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb3ce('0xc')](function(_0x219481){logger[_0xb3ce('0xd')]('GetVoiceCallReport',_0x278ff5);logger[_0xb3ce('0x1f')](_0xb3ce('0x16'),_0x278ff5,JSON[_0xb3ce('0x11')](_0x219481));_0x462801(_0x219481);})[_0xb3ce('0x15')](function(_0xa2c9fe){logger[_0xb3ce('0x12')](_0xb3ce('0x16'),_0xa2c9fe['message'],_0x278ff5);_0x54bc6e(_0x57ceb2[_0xb3ce('0x12')](0x1f4,_0xa2c9fe['message']));});});};exports['CreateVoiceCallReport']=function(_0x4154ce){var _0x8a3143=this;return new Promise(function(_0x2feb7b,_0x40e897){return db[_0xb3ce('0x20')][_0xb3ce('0x21')](_0x4154ce[_0xb3ce('0x22')],{'raw':_0x4154ce[_0xb3ce('0x18')]?_0x4154ce[_0xb3ce('0x18')][_0xb3ce('0x19')]===undefined?!![]:![]:!![]})[_0xb3ce('0xc')](function(_0x1c5579){logger['info'](_0xb3ce('0x23'),_0x4154ce);logger['debug'](_0xb3ce('0x23'),_0x4154ce,JSON['stringify'](_0x1c5579));_0x2feb7b(_0x1c5579);})['catch'](function(_0x59b61d){logger[_0xb3ce('0x12')]('CreateVoiceCallReport',_0x59b61d[_0xb3ce('0x13')],_0x4154ce);_0x40e897(_0x8a3143[_0xb3ce('0x12')](0x1f4,_0x59b61d['message']));});});};exports[_0xb3ce('0x24')]=function(_0xcf821d){var _0x43fcb2=this;return new Promise(function(_0x280fa1,_0xaa3747){return db[_0xb3ce('0x20')][_0xb3ce('0x25')](_0xcf821d[_0xb3ce('0x22')],{'raw':_0xcf821d['options']?_0xcf821d[_0xb3ce('0x18')][_0xb3ce('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcf821d[_0xb3ce('0x18')]?_0xcf821d['options'][_0xb3ce('0x26')]||null:null,'attributes':_0xcf821d[_0xb3ce('0x18')]?_0xcf821d[_0xb3ce('0x18')]['attributes']||null:null,'limit':_0xcf821d[_0xb3ce('0x18')]?_0xcf821d[_0xb3ce('0x18')][_0xb3ce('0x1a')]||null:null})['then'](function(_0x39b49b){logger[_0xb3ce('0xd')](_0xb3ce('0x24'),_0xcf821d);logger[_0xb3ce('0x1f')](_0xb3ce('0x24'),_0xcf821d,JSON[_0xb3ce('0x11')](_0x39b49b));_0x280fa1(_0x39b49b);})[_0xb3ce('0x15')](function(_0x5f3cb8){logger[_0xb3ce('0x12')](_0xb3ce('0x24'),_0x5f3cb8[_0xb3ce('0x13')],_0xcf821d);_0xaa3747(_0x43fcb2[_0xb3ce('0x12')](0x1f4,_0x5f3cb8['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 87598dd..59b14b2 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 _0xbddc=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','multer','path'];(function(_0x4f9423,_0x31aeb9){var _0x41799c=function(_0x5aa068){while(--_0x5aa068){_0x4f9423['push'](_0x4f9423['shift']());}};_0x41799c(++_0x31aeb9);}(_0xbddc,0x142));var _0xcbdd=function(_0x51278f,_0x1e3f43){_0x51278f=_0x51278f-0x0;var _0x59def5=_0xbddc[_0x51278f];return _0x59def5;};'use strict';var multer=require(_0xcbdd('0x0'));var util=require('util');var path=require(_0xcbdd('0x1'));var timeout=require(_0xcbdd('0x2'));var express=require(_0xcbdd('0x3'));var router=express[_0xcbdd('0x4')]();var fs_extra=require(_0xcbdd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcbdd('0x6'));var config=require(_0xcbdd('0x7'));var controller=require('./voiceChanSpy.controller');router[_0xcbdd('0x8')]('/',auth[_0xcbdd('0x9')](),controller[_0xcbdd('0xa')]);router[_0xcbdd('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xcbdd('0xb')]);router[_0xcbdd('0xc')]('/',auth['isAuthenticated'](),controller[_0xcbdd('0xd')]);router[_0xcbdd('0xe')](_0xcbdd('0xf'),auth[_0xcbdd('0x9')](),controller[_0xcbdd('0x10')]);router[_0xcbdd('0x11')](_0xcbdd('0xf'),auth[_0xcbdd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb53d=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','/:id','isAuthenticated','show','post','create','delete','destroy','exports'];(function(_0x2b0821,_0x57ef1e){var _0x2d6958=function(_0x49dde5){while(--_0x49dde5){_0x2b0821['push'](_0x2b0821['shift']());}};_0x2d6958(++_0x57ef1e);}(_0xb53d,0x165));var _0xdb53=function(_0x5916bc,_0x5bc30a){_0x5916bc=_0x5916bc-0x0;var _0x5b8d61=_0xb53d[_0x5916bc];return _0x5b8d61;};'use strict';var multer=require('multer');var util=require(_0xdb53('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdb53('0x1'));var router=express[_0xdb53('0x2')]();var fs_extra=require(_0xdb53('0x3'));var auth=require(_0xdb53('0x4'));var interaction=require(_0xdb53('0x5'));var config=require(_0xdb53('0x6'));var controller=require(_0xdb53('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdb53('0x8')](_0xdb53('0x9'),auth[_0xdb53('0xa')](),controller[_0xdb53('0xb')]);router[_0xdb53('0xc')]('/',auth[_0xdb53('0xa')](),controller[_0xdb53('0xd')]);router['put']('/:id',auth[_0xdb53('0xa')](),controller['update']);router[_0xdb53('0xe')](_0xdb53('0x9'),auth[_0xdb53('0xa')](),controller[_0xdb53('0xf')]);module[_0xdb53('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index f841a0b..5ce3b2c 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 _0x4860=['options','split','STRING','sequelize','exports','name','setDataValue','join','getDataValue'];(function(_0x56b8eb,_0x1b90ab){var _0x31494f=function(_0x865155){while(--_0x865155){_0x56b8eb['push'](_0x56b8eb['shift']());}};_0x31494f(++_0x1b90ab);}(_0x4860,0x12c));var _0x0486=function(_0x29ffe4,_0x42729e){_0x29ffe4=_0x29ffe4-0x0;var _0x6eb95c=_0x4860[_0x29ffe4];return _0x6eb95c;};'use strict';var Sequelize=require(_0x0486('0x0'));module[_0x0486('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x0486('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x24ed1f){this[_0x0486('0x3')]('options',_0x24ed1f?_0x24ed1f[_0x0486('0x4')](''):[]);},'get':function(){return this[_0x0486('0x5')](_0x0486('0x6'))?this[_0x0486('0x5')]('options')[_0x0486('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x0486('0x8')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0486('0x8')]}}; \ No newline at end of file +var _0xbb57=['STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbb57,0xaa));var _0x7bb5=function(_0x3694fd,_0x32ca14){_0x3694fd=_0x3694fd-0x0;var _0x2ecb90=_0xbb57[_0x3694fd];return _0x2ecb90;};'use strict';var Sequelize=require('sequelize');module[_0x7bb5('0x0')]={'name':{'type':Sequelize[_0x7bb5('0x1')]},'prefix':{'type':Sequelize[_0x7bb5('0x1')],'unique':_0x7bb5('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x7bb5('0x1')],'set':function(_0x596366){this[_0x7bb5('0x3')](_0x7bb5('0x4'),_0x596366?_0x596366[_0x7bb5('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x7bb5('0x4'))?this[_0x7bb5('0x6')](_0x7bb5('0x4'))[_0x7bb5('0x7')](''):[];}},'auth':{'type':Sequelize[_0x7bb5('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x7bb5('0x1')]},'record':{'type':Sequelize[_0x7bb5('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 81d3d69..85963a3 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 _0x720c=['body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','offset','count','limit','set','apply','reject','save','update','destroy','then','get','ChanSpies','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','include','findAll','rows','catch','show','includeAll','find'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0x720c,0x154));var _0xc720=function(_0x27ebe4,_0x2bcb38){_0x27ebe4=_0x27ebe4-0x0;var _0x402a55=_0x720c[_0x27ebe4];return _0x402a55;};'use strict';var emlformat=require(_0xc720('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc720('0x1'));var jsonpatch=require(_0xc720('0x2'));var rp=require(_0xc720('0x3'));var moment=require(_0xc720('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc720('0x5'));var util=require(_0xc720('0x6'));var path=require(_0xc720('0x7'));var sox=require(_0xc720('0x8'));var csv=require(_0xc720('0x9'));var ejs=require(_0xc720('0xa'));var fs=require('fs');var fs_extra=require(_0xc720('0xb'));var _=require('lodash');var squel=require(_0xc720('0xc'));var crypto=require(_0xc720('0xd'));var jsforce=require(_0xc720('0xe'));var deskjs=require(_0xc720('0xf'));var toCsv=require(_0xc720('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc720('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc720('0x11'));var as=require(_0xc720('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc720('0x13'))(_0xc720('0x14'));var utils=require(_0xc720('0x15'));var config=require(_0xc720('0x16'));var licenseUtil=require(_0xc720('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18b088,_0x40f2f6){_0x40f2f6=_0x40f2f6||0xcc;return function(_0x24b8c1){if(_0x24b8c1){return _0x18b088[_0xc720('0x18')](_0x40f2f6);}return _0x18b088['status'](_0x40f2f6)[_0xc720('0x19')]();};}function respondWithResult(_0x267bf5,_0x3df0eb){_0x3df0eb=_0x3df0eb||0xc8;return function(_0x487d64){if(_0x487d64){return _0x267bf5[_0xc720('0x1a')](_0x3df0eb)[_0xc720('0x1b')](_0x487d64);}};}function respondWithFilteredResult(_0x37f24d,_0x2f7eaf){return function(_0xebcb34){if(_0xebcb34){var _0x4f351a=typeof _0x2f7eaf['offset']===_0xc720('0x1c')&&typeof _0x2f7eaf['limit']===_0xc720('0x1c');var _0x26014e=_0xebcb34['count'];var _0x34de4c=_0x4f351a?0x0:_0x2f7eaf[_0xc720('0x1d')];var _0x195cf3=_0x4f351a?_0xebcb34[_0xc720('0x1e')]:_0x2f7eaf[_0xc720('0x1d')]+_0x2f7eaf[_0xc720('0x1f')];var _0xf92a2f;if(_0x195cf3>=_0x26014e){_0x195cf3=_0x26014e;_0xf92a2f=0xc8;}else{_0xf92a2f=0xce;}_0x37f24d[_0xc720('0x1a')](_0xf92a2f);return _0x37f24d[_0xc720('0x20')]('Content-Range',_0x34de4c+'-'+_0x195cf3+'/'+_0x26014e)['json'](_0xebcb34);}return null;};}function patchUpdates(_0x52cdf7){return function(_0x387bac){try{jsonpatch[_0xc720('0x21')](_0x387bac,_0x52cdf7,!![]);}catch(_0x1e8a00){return BPromise[_0xc720('0x22')](_0x1e8a00);}return _0x387bac[_0xc720('0x23')]();};}function saveUpdates(_0x4f0312,_0x358cfe){return function(_0x56d824){if(_0x56d824){return _0x56d824[_0xc720('0x24')](_0x4f0312)['then'](function(_0x38ac8a){return _0x38ac8a;});}return null;};}function removeEntity(_0x211aa0,_0x5ee6e7){return function(_0xfc7d7b){if(_0xfc7d7b){return _0xfc7d7b[_0xc720('0x25')]()[_0xc720('0x26')](function(){var _0x232cb1=_0xfc7d7b[_0xc720('0x27')]({'plain':!![]});var _0x141cb5=_0xc720('0x28');return db['UserProfileResource'][_0xc720('0x25')]({'where':{'type':_0x141cb5,'resourceId':_0x232cb1['id']}})[_0xc720('0x26')](function(){return _0xfc7d7b;});})['then'](function(){_0x211aa0[_0xc720('0x1a')](0xcc)[_0xc720('0x19')]();});}};}function handleEntityNotFound(_0x4ff333,_0x31603f){return function(_0x4e0d3a){if(!_0x4e0d3a){_0x4ff333[_0xc720('0x18')](0x194);}return _0x4e0d3a;};}function handleError(_0x46c41b,_0x1d7797){_0x1d7797=_0x1d7797||0x1f4;return function(_0x84d71e){logger[_0xc720('0x29')](_0x84d71e[_0xc720('0x2a')]);if(_0x84d71e[_0xc720('0x2b')]){delete _0x84d71e['name'];}_0x46c41b['status'](_0x1d7797)[_0xc720('0x2c')](_0x84d71e);};}exports[_0xc720('0x2d')]=function(_0x531cee,_0x1c1bdd){var _0x51973a={},_0x237ee9={},_0x18b9da={'count':0x0,'rows':[]};var _0x4c7618=_[_0xc720('0x2e')](db[_0xc720('0x2f')][_0xc720('0x30')],function(_0x19954b){return{'name':_0x19954b[_0xc720('0x31')],'type':_0x19954b[_0xc720('0x32')][_0xc720('0x33')]};});_0x237ee9[_0xc720('0x34')]=_[_0xc720('0x2e')](_0x4c7618,_0xc720('0x2b'));_0x237ee9['query']=_[_0xc720('0x35')](_0x531cee['query']);_0x237ee9[_0xc720('0x36')]=_['intersection'](_0x237ee9['model'],_0x237ee9[_0xc720('0x37')]);_0x51973a[_0xc720('0x38')]=_[_0xc720('0x39')](_0x237ee9[_0xc720('0x34')],qs['fields'](_0x531cee[_0xc720('0x37')][_0xc720('0x3a')]));_0x51973a['attributes']=_0x51973a[_0xc720('0x38')][_0xc720('0x3b')]?_0x51973a[_0xc720('0x38')]:_0x237ee9[_0xc720('0x34')];if(!_0x531cee['query'][_0xc720('0x3c')](_0xc720('0x3d'))){_0x51973a['limit']=qs['limit'](_0x531cee[_0xc720('0x37')][_0xc720('0x1f')]);_0x51973a['offset']=qs[_0xc720('0x1d')](_0x531cee['query'][_0xc720('0x1d')]);}_0x51973a[_0xc720('0x3e')]=qs[_0xc720('0x3f')](_0x531cee[_0xc720('0x37')][_0xc720('0x3f')]);_0x51973a['where']=qs[_0xc720('0x36')](_['pick'](_0x531cee[_0xc720('0x37')],_0x237ee9['filters']),_0x4c7618);if(_0x531cee['query'][_0xc720('0x40')]){_0x51973a[_0xc720('0x41')]=_[_0xc720('0x42')](_0x51973a[_0xc720('0x41')],{'$or':_[_0xc720('0x2e')](_0x4c7618,function(_0x517536){if(_0x517536[_0xc720('0x32')]!=='VIRTUAL'){var _0x427145={};_0x427145[_0x517536[_0xc720('0x2b')]]={'$like':'%'+_0x531cee['query'][_0xc720('0x40')]+'%'};return _0x427145;}})});}_0x51973a=_[_0xc720('0x42')]({},_0x51973a,_0x531cee[_0xc720('0x43')]);var _0x27c5c4={'where':_0x51973a[_0xc720('0x41')]};return db[_0xc720('0x2f')][_0xc720('0x1e')](_0x27c5c4)['then'](function(_0x45cf18){_0x18b9da[_0xc720('0x1e')]=_0x45cf18;if(_0x531cee[_0xc720('0x37')]['includeAll']){_0x51973a[_0xc720('0x44')]=[{'all':!![]}];}return db[_0xc720('0x2f')][_0xc720('0x45')](_0x51973a);})[_0xc720('0x26')](function(_0x5c5a3b){_0x18b9da[_0xc720('0x46')]=_0x5c5a3b;return _0x18b9da;})[_0xc720('0x26')](respondWithFilteredResult(_0x1c1bdd,_0x51973a))[_0xc720('0x47')](handleError(_0x1c1bdd,null));};exports[_0xc720('0x48')]=function(_0x53b70e,_0x25a228){var _0x3c2e99={'raw':![],'where':{'id':_0x53b70e['params']['id']}},_0x1b292e={};_0x1b292e[_0xc720('0x34')]=_[_0xc720('0x35')](db[_0xc720('0x2f')]['rawAttributes']);_0x1b292e[_0xc720('0x37')]=_[_0xc720('0x35')](_0x53b70e[_0xc720('0x37')]);_0x1b292e[_0xc720('0x36')]=_[_0xc720('0x39')](_0x1b292e[_0xc720('0x34')],_0x1b292e[_0xc720('0x37')]);_0x3c2e99[_0xc720('0x38')]=_['intersection'](_0x1b292e[_0xc720('0x34')],qs[_0xc720('0x3a')](_0x53b70e[_0xc720('0x37')][_0xc720('0x3a')]));_0x3c2e99[_0xc720('0x38')]=_0x3c2e99[_0xc720('0x38')]['length']?_0x3c2e99[_0xc720('0x38')]:_0x1b292e['model'];if(_0x53b70e[_0xc720('0x37')][_0xc720('0x49')]){_0x3c2e99[_0xc720('0x44')]=[{'all':!![]}];}_0x3c2e99=_[_0xc720('0x42')]({},_0x3c2e99,_0x53b70e['options']);return db[_0xc720('0x2f')][_0xc720('0x4a')](_0x3c2e99)[_0xc720('0x26')](handleEntityNotFound(_0x25a228,null))['then'](respondWithResult(_0x25a228,null))['catch'](handleError(_0x25a228,null));};exports['create']=function(_0x4baab4,_0x4f152c){return db[_0xc720('0x2f')]['create'](_0x4baab4[_0xc720('0x4b')],{})['then'](function(_0x3a895c){var _0x566ad8=_0x4baab4[_0xc720('0x4c')][_0xc720('0x27')]({'plain':!![]});if(!_0x566ad8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x566ad8[_0xc720('0x4d')]===_0xc720('0x4c')){var _0x5009e3=_0x3a895c[_0xc720('0x27')]({'plain':!![]});var _0x1d1d8c='ChanSpies';return db[_0xc720('0x4e')][_0xc720('0x4a')]({'where':{'name':_0x1d1d8c,'userProfileId':_0x566ad8[_0xc720('0x4f')]},'raw':!![]})[_0xc720('0x26')](function(_0x428923){if(_0x428923&&_0x428923[_0xc720('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x5009e3[_0xc720('0x2b')],'resourceId':_0x5009e3['id'],'type':_0x428923[_0xc720('0x2b')],'sectionId':_0x428923['id']},{})[_0xc720('0x26')](function(){return _0x3a895c;});}else{return _0x3a895c;}})[_0xc720('0x47')](function(_0x2778e2){logger['error'](_0xc720('0x51'),_0x2778e2);throw _0x2778e2;});}return _0x3a895c;})['then'](respondWithResult(_0x4f152c,0xc9))[_0xc720('0x47')](handleError(_0x4f152c,null));};exports[_0xc720('0x24')]=function(_0x3d97ce,_0x3e9609){if(_0x3d97ce[_0xc720('0x4b')]['id']){delete _0x3d97ce[_0xc720('0x4b')]['id'];}return db[_0xc720('0x2f')][_0xc720('0x4a')]({'where':{'id':_0x3d97ce[_0xc720('0x52')]['id']}})[_0xc720('0x26')](handleEntityNotFound(_0x3e9609,null))[_0xc720('0x26')](saveUpdates(_0x3d97ce[_0xc720('0x4b')],null))[_0xc720('0x26')](respondWithResult(_0x3e9609,null))[_0xc720('0x47')](handleError(_0x3e9609,null));};exports[_0xc720('0x25')]=function(_0x3930a4,_0x1a4bd8){return db[_0xc720('0x2f')][_0xc720('0x4a')]({'where':{'id':_0x3930a4[_0xc720('0x52')]['id']}})[_0xc720('0x26')](handleEntityNotFound(_0x1a4bd8,null))['then'](removeEntity(_0x1a4bd8,null))[_0xc720('0x47')](handleError(_0x1a4bd8,null));}; \ No newline at end of file +var _0xc817=['key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ChanSpies','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','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','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','UserProfileResource','then','error','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type'];(function(_0x1f4637,_0x2ebece){var _0x4c6686=function(_0x311ded){while(--_0x311ded){_0x1f4637['push'](_0x1f4637['shift']());}};_0x4c6686(++_0x2ebece);}(_0xc817,0x75));var _0x7c81=function(_0x41ba9b,_0x4e9617){_0x41ba9b=_0x41ba9b-0x0;var _0x2379ab=_0xc817[_0x41ba9b];return _0x2379ab;};'use strict';var emlformat=require(_0x7c81('0x0'));var rimraf=require(_0x7c81('0x1'));var zipdir=require(_0x7c81('0x2'));var jsonpatch=require(_0x7c81('0x3'));var rp=require('request-promise');var moment=require(_0x7c81('0x4'));var BPromise=require(_0x7c81('0x5'));var Mustache=require(_0x7c81('0x6'));var util=require(_0x7c81('0x7'));var path=require(_0x7c81('0x8'));var sox=require(_0x7c81('0x9'));var csv=require('to-csv');var ejs=require(_0x7c81('0xa'));var fs=require('fs');var fs_extra=require(_0x7c81('0xb'));var _=require('lodash');var squel=require(_0x7c81('0xc'));var crypto=require(_0x7c81('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7c81('0xe'));var toCsv=require(_0x7c81('0xf'));var querystring=require(_0x7c81('0x10'));var Papa=require(_0x7c81('0x11'));var Redis=require(_0x7c81('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7c81('0x13'));var as=require(_0x7c81('0x14'));var hardwareService=require(_0x7c81('0x15'));var logger=require(_0x7c81('0x16'))(_0x7c81('0x17'));var utils=require(_0x7c81('0x18'));var config=require(_0x7c81('0x19'));var licenseUtil=require(_0x7c81('0x1a'));var db=require(_0x7c81('0x1b'))['db'];function respondWithStatusCode(_0x1f7771,_0xe463e){_0xe463e=_0xe463e||0xcc;return function(_0x1f7b5c){if(_0x1f7b5c){return _0x1f7771[_0x7c81('0x1c')](_0xe463e);}return _0x1f7771[_0x7c81('0x1d')](_0xe463e)[_0x7c81('0x1e')]();};}function respondWithResult(_0xebb73,_0x9362c4){_0x9362c4=_0x9362c4||0xc8;return function(_0x1abf26){if(_0x1abf26){return _0xebb73[_0x7c81('0x1d')](_0x9362c4)['json'](_0x1abf26);}};}function respondWithFilteredResult(_0x439b1c,_0x18aefa){return function(_0x2f3de2){if(_0x2f3de2){var _0x1021f8=typeof _0x18aefa[_0x7c81('0x1f')]===_0x7c81('0x20')&&typeof _0x18aefa[_0x7c81('0x21')]===_0x7c81('0x20');var _0x266bb0=_0x2f3de2['count'];var _0x14cce5=_0x1021f8?0x0:_0x18aefa[_0x7c81('0x1f')];var _0xfd62e=_0x1021f8?_0x2f3de2[_0x7c81('0x22')]:_0x18aefa['offset']+_0x18aefa[_0x7c81('0x21')];var _0x2e2b44;if(_0xfd62e>=_0x266bb0){_0xfd62e=_0x266bb0;_0x2e2b44=0xc8;}else{_0x2e2b44=0xce;}_0x439b1c[_0x7c81('0x1d')](_0x2e2b44);return _0x439b1c[_0x7c81('0x23')](_0x7c81('0x24'),_0x14cce5+'-'+_0xfd62e+'/'+_0x266bb0)['json'](_0x2f3de2);}return null;};}function patchUpdates(_0x679b81){return function(_0x1a9cee){try{jsonpatch[_0x7c81('0x25')](_0x1a9cee,_0x679b81,!![]);}catch(_0x35761d){return BPromise[_0x7c81('0x26')](_0x35761d);}return _0x1a9cee['save']();};}function saveUpdates(_0x887753,_0x198390){return function(_0x4704e9){if(_0x4704e9){return _0x4704e9[_0x7c81('0x27')](_0x887753)['then'](function(_0x3bdca5){return _0x3bdca5;});}return null;};}function removeEntity(_0x53bdb2,_0x4ecf3b){return function(_0x53f49c){if(_0x53f49c){return _0x53f49c[_0x7c81('0x28')]()['then'](function(){var _0x4a01fb=_0x53f49c['get']({'plain':!![]});var _0x349b5c='ChanSpies';return db[_0x7c81('0x29')][_0x7c81('0x28')]({'where':{'type':_0x349b5c,'resourceId':_0x4a01fb['id']}})[_0x7c81('0x2a')](function(){return _0x53f49c;});})['then'](function(){_0x53bdb2[_0x7c81('0x1d')](0xcc)[_0x7c81('0x1e')]();});}};}function handleEntityNotFound(_0x39d36d,_0x26e2bc){return function(_0x1645bf){if(!_0x1645bf){_0x39d36d[_0x7c81('0x1c')](0x194);}return _0x1645bf;};}function handleError(_0x4d2286,_0x2e6024){_0x2e6024=_0x2e6024||0x1f4;return function(_0x5c8206){logger[_0x7c81('0x2b')](_0x5c8206['stack']);if(_0x5c8206[_0x7c81('0x2c')]){delete _0x5c8206[_0x7c81('0x2c')];}_0x4d2286[_0x7c81('0x1d')](_0x2e6024)['send'](_0x5c8206);};}exports[_0x7c81('0x2d')]=function(_0x53a4d0,_0x527be1){var _0x1dba1d={},_0x50f6fb={},_0x47e048={'count':0x0,'rows':[]};var _0x11efe4=_[_0x7c81('0x2e')](db[_0x7c81('0x2f')][_0x7c81('0x30')],function(_0x368b17){return{'name':_0x368b17[_0x7c81('0x31')],'type':_0x368b17[_0x7c81('0x32')][_0x7c81('0x33')]};});_0x50f6fb['model']=_[_0x7c81('0x2e')](_0x11efe4,_0x7c81('0x2c'));_0x50f6fb['query']=_[_0x7c81('0x34')](_0x53a4d0[_0x7c81('0x35')]);_0x50f6fb[_0x7c81('0x36')]=_['intersection'](_0x50f6fb[_0x7c81('0x37')],_0x50f6fb[_0x7c81('0x35')]);_0x1dba1d[_0x7c81('0x38')]=_[_0x7c81('0x39')](_0x50f6fb[_0x7c81('0x37')],qs[_0x7c81('0x3a')](_0x53a4d0[_0x7c81('0x35')][_0x7c81('0x3a')]));_0x1dba1d[_0x7c81('0x38')]=_0x1dba1d[_0x7c81('0x38')][_0x7c81('0x3b')]?_0x1dba1d[_0x7c81('0x38')]:_0x50f6fb[_0x7c81('0x37')];if(!_0x53a4d0['query'][_0x7c81('0x3c')](_0x7c81('0x3d'))){_0x1dba1d[_0x7c81('0x21')]=qs[_0x7c81('0x21')](_0x53a4d0[_0x7c81('0x35')]['limit']);_0x1dba1d['offset']=qs[_0x7c81('0x1f')](_0x53a4d0[_0x7c81('0x35')][_0x7c81('0x1f')]);}_0x1dba1d[_0x7c81('0x3e')]=qs[_0x7c81('0x3f')](_0x53a4d0['query'][_0x7c81('0x3f')]);_0x1dba1d[_0x7c81('0x40')]=qs[_0x7c81('0x36')](_['pick'](_0x53a4d0[_0x7c81('0x35')],_0x50f6fb[_0x7c81('0x36')]),_0x11efe4);if(_0x53a4d0[_0x7c81('0x35')]['filter']){_0x1dba1d[_0x7c81('0x40')]=_[_0x7c81('0x41')](_0x1dba1d['where'],{'$or':_[_0x7c81('0x2e')](_0x11efe4,function(_0x1b27da){if(_0x1b27da[_0x7c81('0x32')]!==_0x7c81('0x42')){var _0x5d4f3b={};_0x5d4f3b[_0x1b27da[_0x7c81('0x2c')]]={'$like':'%'+_0x53a4d0[_0x7c81('0x35')]['filter']+'%'};return _0x5d4f3b;}})});}_0x1dba1d=_[_0x7c81('0x41')]({},_0x1dba1d,_0x53a4d0[_0x7c81('0x43')]);var _0x415c30={'where':_0x1dba1d['where']};return db['VoiceChanSpy'][_0x7c81('0x22')](_0x415c30)['then'](function(_0x44e611){_0x47e048[_0x7c81('0x22')]=_0x44e611;if(_0x53a4d0[_0x7c81('0x35')][_0x7c81('0x44')]){_0x1dba1d['include']=[{'all':!![]}];}return db[_0x7c81('0x2f')][_0x7c81('0x45')](_0x1dba1d);})[_0x7c81('0x2a')](function(_0x341a8c){_0x47e048[_0x7c81('0x46')]=_0x341a8c;return _0x47e048;})['then'](respondWithFilteredResult(_0x527be1,_0x1dba1d))[_0x7c81('0x47')](handleError(_0x527be1,null));};exports[_0x7c81('0x48')]=function(_0xa19b28,_0xcf3c52){var _0x332f4b={'raw':![],'where':{'id':_0xa19b28[_0x7c81('0x49')]['id']}},_0x4b96d0={};_0x4b96d0[_0x7c81('0x37')]=_[_0x7c81('0x34')](db['VoiceChanSpy'][_0x7c81('0x30')]);_0x4b96d0[_0x7c81('0x35')]=_['keys'](_0xa19b28['query']);_0x4b96d0[_0x7c81('0x36')]=_[_0x7c81('0x39')](_0x4b96d0[_0x7c81('0x37')],_0x4b96d0[_0x7c81('0x35')]);_0x332f4b[_0x7c81('0x38')]=_[_0x7c81('0x39')](_0x4b96d0[_0x7c81('0x37')],qs['fields'](_0xa19b28[_0x7c81('0x35')]['fields']));_0x332f4b[_0x7c81('0x38')]=_0x332f4b[_0x7c81('0x38')][_0x7c81('0x3b')]?_0x332f4b[_0x7c81('0x38')]:_0x4b96d0[_0x7c81('0x37')];if(_0xa19b28[_0x7c81('0x35')][_0x7c81('0x44')]){_0x332f4b[_0x7c81('0x4a')]=[{'all':!![]}];}_0x332f4b=_[_0x7c81('0x41')]({},_0x332f4b,_0xa19b28[_0x7c81('0x43')]);return db[_0x7c81('0x2f')][_0x7c81('0x4b')](_0x332f4b)[_0x7c81('0x2a')](handleEntityNotFound(_0xcf3c52,null))[_0x7c81('0x2a')](respondWithResult(_0xcf3c52,null))[_0x7c81('0x47')](handleError(_0xcf3c52,null));};exports[_0x7c81('0x4c')]=function(_0x4b47a2,_0xeb1033){return db['VoiceChanSpy'][_0x7c81('0x4c')](_0x4b47a2[_0x7c81('0x4d')],{})[_0x7c81('0x2a')](function(_0x4c0c2b){var _0x588fe4=_0x4b47a2[_0x7c81('0x4e')]['get']({'plain':!![]});if(!_0x588fe4)throw new Error(_0x7c81('0x4f'));if(_0x588fe4[_0x7c81('0x50')]===_0x7c81('0x4e')){var _0x260d65=_0x4c0c2b[_0x7c81('0x51')]({'plain':!![]});var _0x14cd68=_0x7c81('0x52');return db['UserProfileSection'][_0x7c81('0x4b')]({'where':{'name':_0x14cd68,'userProfileId':_0x588fe4[_0x7c81('0x53')]},'raw':!![]})['then'](function(_0x2c0358){if(_0x2c0358&&_0x2c0358['autoAssociation']===0x0){return db['UserProfileResource'][_0x7c81('0x4c')]({'name':_0x260d65[_0x7c81('0x2c')],'resourceId':_0x260d65['id'],'type':_0x2c0358[_0x7c81('0x2c')],'sectionId':_0x2c0358['id']},{})[_0x7c81('0x2a')](function(){return _0x4c0c2b;});}else{return _0x4c0c2b;}})[_0x7c81('0x47')](function(_0x496d9e){logger[_0x7c81('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x496d9e);throw _0x496d9e;});}return _0x4c0c2b;})[_0x7c81('0x2a')](respondWithResult(_0xeb1033,0xc9))[_0x7c81('0x47')](handleError(_0xeb1033,null));};exports[_0x7c81('0x27')]=function(_0x3f5bb0,_0x337e01){if(_0x3f5bb0['body']['id']){delete _0x3f5bb0['body']['id'];}return db[_0x7c81('0x2f')][_0x7c81('0x4b')]({'where':{'id':_0x3f5bb0[_0x7c81('0x49')]['id']}})['then'](handleEntityNotFound(_0x337e01,null))[_0x7c81('0x2a')](saveUpdates(_0x3f5bb0['body'],null))[_0x7c81('0x2a')](respondWithResult(_0x337e01,null))['catch'](handleError(_0x337e01,null));};exports[_0x7c81('0x28')]=function(_0x278a46,_0x494d1b){return db[_0x7c81('0x2f')]['find']({'where':{'id':_0x278a46[_0x7c81('0x49')]['id']}})[_0x7c81('0x2a')](handleEntityNotFound(_0x494d1b,null))[_0x7c81('0x2a')](removeEntity(_0x494d1b,null))[_0x7c81('0x47')](handleError(_0x494d1b,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 9e02c23..e5cb4bb 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 _0xf14a=['push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join','length','internal','concat','User','findAll','then','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','record'];(function(_0x108069,_0xbd95b){var _0x39e919=function(_0x14c18f){while(--_0x14c18f){_0x108069['push'](_0x108069['shift']());}};_0x39e919(++_0xbd95b);}(_0xf14a,0xfd));var _0xaf14=function(_0x2a0704,_0x133fbd){_0x2a0704=_0x2a0704-0x0;var _0x24243a=_0xf14a[_0x2a0704];return _0x24243a;};'use strict';var _=require(_0xaf14('0x0'));var util=require(_0xaf14('0x1'));var BPromise=require(_0xaf14('0x2'));var attributes=require(_0xaf14('0x3'));var getUserApplications=function(_0x2eef3e,_0x137b8b,_0x4cea90){var _0x494882=0x1;var _0x3ffc66=[];var _0x16bee5={'context':_0x137b8b[_0xaf14('0x4')]||'from-sip','exten':util[_0xaf14('0x5')](_0xaf14('0x6'),_0x2eef3e[_0xaf14('0x7')],_0x4cea90),'type':_0xaf14('0x8'),'isApp':![],'ChanSpyId':_0x2eef3e['id'],'UserId':_0x137b8b['id']};_0x3ffc66['push'](_[_0xaf14('0x9')]({'app':_0xaf14('0xa'),'appdata':util['format'](_0xaf14('0xb'),'chanspy'),'priority':_0x494882++},_0x16bee5));if(_0x2eef3e[_0xaf14('0xc')]){_0x3ffc66[_0xaf14('0xd')](_['merge']({'app':_0xaf14('0xe'),'appdata':util[_0xaf14('0x5')](_0xaf14('0xf'),_0x2eef3e[_0xaf14('0x10')]),'priority':_0x494882++},_0x16bee5));}if(_0x2eef3e[_0xaf14('0x11')]){_0x3ffc66['push'](_[_0xaf14('0x9')]({'app':_0xaf14('0x12'),'appdata':_0x2eef3e[_0xaf14('0x13')],'priority':_0x494882++},_0x16bee5));}_0x3ffc66[_0xaf14('0xd')](_['merge']({'app':'ChanSpy','appdata':util[_0xaf14('0x5')](_0xaf14('0x14'),_0x137b8b[_0xaf14('0x15')],_0x2eef3e[_0xaf14('0x16')]?_0x2eef3e[_0xaf14('0x16')][_0xaf14('0x17')](''):''),'priority':_0x494882++},_0x16bee5));if(_0x2eef3e[_0xaf14('0xc')]){_0x3ffc66[_0xaf14('0xd')](_['merge']({'app':'StopMixMonitor','priority':_0x494882++},_0x16bee5));}return _0x3ffc66;};var getChanSpyApplications=function(_0x334f3a,_0x3e9f8d){var _0xf1ae6b=[];for(var _0x49a1bc=0x0,_0x59a013=0x1;_0x49a1bc<_0x3e9f8d[_0xaf14('0x18')];_0x49a1bc++,_0x59a013=0x1){_0xf1ae6b=_0xf1ae6b['concat'](getUserApplications(_0x334f3a,_0x3e9f8d[_0x49a1bc],_0x3e9f8d[_0x49a1bc][_0xaf14('0x19')]));if(_0x3e9f8d[_0x49a1bc]['internal']!=_0x3e9f8d[_0x49a1bc][_0xaf14('0x15')]){_0xf1ae6b=_0xf1ae6b[_0xaf14('0x1a')](getUserApplications(_0x334f3a,_0x3e9f8d[_0x49a1bc],_0x3e9f8d[_0x49a1bc][_0xaf14('0x15')]));}}return _0xf1ae6b;};var getChanSpyPromise=function(_0x248b89,_0x548657){return new BPromise(function(_0x2244f4,_0x198d15){return _0x248b89[_0xaf14('0x1b')][_0xaf14('0x1c')]({'attributes':['id','name',_0xaf14('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xaf14('0x1d')](function(_0x5b8950){if(_0x5b8950){return _0x2244f4(getChanSpyApplications(_0x548657,_0x5b8950));}return _0x2244f4([]);})['catch'](function(_0x550ebf){_0x198d15(_0x550ebf);});});};module['exports']=function(_0x2b6a77,_0x53dbea){var _0x44787c=_0x2b6a77[_0xaf14('0x1e')];return _0x2b6a77[_0xaf14('0x1f')](_0xaf14('0x20'),attributes,{'tableName':_0xaf14('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b92ad,_0x447cdc,_0x173560){return getChanSpyPromise(_0x44787c,_0x2b92ad)[_0xaf14('0x1d')](function(_0x32296a){if(_0x32296a&&_0x32296a[_0xaf14('0x18')]){return _0x44787c[_0xaf14('0x22')]['bulkCreate'](_0x32296a);}})[_0xaf14('0x1d')](function(){_0x173560();})['catch'](function(_0x4e201e){_0x173560(_0x4e201e);});},'afterUpdate':function(_0x4576d9,_0x5806aa,_0x161bd4){return _0x44787c[_0xaf14('0x22')]['destroy']({'where':{'ChanSpyId':_0x4576d9['id']}})[_0xaf14('0x1d')](function(){return getChanSpyPromise(_0x44787c,_0x4576d9);})[_0xaf14('0x1d')](function(_0x30471a){if(_0x30471a&&_0x30471a[_0xaf14('0x18')]){return _0x44787c[_0xaf14('0x22')][_0xaf14('0x23')](_0x30471a);}})[_0xaf14('0x1d')](function(){_0x161bd4();})[_0xaf14('0x24')](function(_0x12aed6){_0x161bd4(_0x12aed6);});},'afterDestroy':function(_0x40f3f2,_0x497258,_0x2830a6){return _0x44787c['VoiceExtension'][_0xaf14('0x25')]({'where':{'ChanSpyId':_0x40f3f2['id']}})[_0xaf14('0x1d')](function(){_0x2830a6();})[_0xaf14('0x24')](function(_0x40c186){_0x2830a6(_0x40c186);});}}});}; \ No newline at end of file +var _0x5bc3=['prefix','system','push','merge','CDR(type)=%s','record','${UNIQUEID}.%s,a','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s'];(function(_0xca7ecb,_0x584c9e){var _0x44ea92=function(_0x29d2e2){while(--_0x29d2e2){_0xca7ecb['push'](_0xca7ecb['shift']());}};_0x44ea92(++_0x584c9e);}(_0x5bc3,0x68));var _0x35bc=function(_0xdb417d,_0x4227e4){_0xdb417d=_0xdb417d-0x0;var _0x16b4a9=_0x5bc3[_0xdb417d];return _0x16b4a9;};'use strict';var _=require(_0x35bc('0x0'));var util=require(_0x35bc('0x1'));var BPromise=require('bluebird');var attributes=require(_0x35bc('0x2'));var getUserApplications=function(_0x2bd9e1,_0x49de37,_0x53d1d1){var _0x59c372=0x1;var _0x517e08=[];var _0x57670c={'context':_0x49de37[_0x35bc('0x3')]||_0x35bc('0x4'),'exten':util[_0x35bc('0x5')](_0x35bc('0x6'),_0x2bd9e1[_0x35bc('0x7')],_0x53d1d1),'type':_0x35bc('0x8'),'isApp':![],'ChanSpyId':_0x2bd9e1['id'],'UserId':_0x49de37['id']};_0x517e08[_0x35bc('0x9')](_[_0x35bc('0xa')]({'app':'Set','appdata':util[_0x35bc('0x5')](_0x35bc('0xb'),'chanspy'),'priority':_0x59c372++},_0x57670c));if(_0x2bd9e1[_0x35bc('0xc')]){_0x517e08['push'](_[_0x35bc('0xa')]({'app':'MixMonitor','appdata':util[_0x35bc('0x5')](_0x35bc('0xd'),_0x2bd9e1['recordingFormat']),'priority':_0x59c372++},_0x57670c));}if(_0x2bd9e1['auth']){_0x517e08[_0x35bc('0x9')](_[_0x35bc('0xa')]({'app':_0x35bc('0xe'),'appdata':_0x2bd9e1[_0x35bc('0xf')],'priority':_0x59c372++},_0x57670c));}_0x517e08[_0x35bc('0x9')](_[_0x35bc('0xa')]({'app':_0x35bc('0x10'),'appdata':util[_0x35bc('0x5')](_0x35bc('0x11'),_0x49de37[_0x35bc('0x12')],_0x2bd9e1[_0x35bc('0x13')]?_0x2bd9e1[_0x35bc('0x13')][_0x35bc('0x14')](''):''),'priority':_0x59c372++},_0x57670c));if(_0x2bd9e1['record']){_0x517e08['push'](_['merge']({'app':_0x35bc('0x15'),'priority':_0x59c372++},_0x57670c));}return _0x517e08;};var getChanSpyApplications=function(_0x274e71,_0x1ca03f){var _0x1835ef=[];for(var _0x32e54a=0x0,_0x3154d0=0x1;_0x32e54a<_0x1ca03f[_0x35bc('0x16')];_0x32e54a++,_0x3154d0=0x1){_0x1835ef=_0x1835ef[_0x35bc('0x17')](getUserApplications(_0x274e71,_0x1ca03f[_0x32e54a],_0x1ca03f[_0x32e54a][_0x35bc('0x18')]));if(_0x1ca03f[_0x32e54a][_0x35bc('0x18')]!=_0x1ca03f[_0x32e54a][_0x35bc('0x12')]){_0x1835ef=_0x1835ef[_0x35bc('0x17')](getUserApplications(_0x274e71,_0x1ca03f[_0x32e54a],_0x1ca03f[_0x32e54a]['name']));}}return _0x1835ef;};var getChanSpyPromise=function(_0x379da6,_0x23a80e){return new BPromise(function(_0x254fd7,_0x4b2f0f){return _0x379da6[_0x35bc('0x19')][_0x35bc('0x1a')]({'attributes':['id',_0x35bc('0x12'),_0x35bc('0x18')],'where':{'role':_0x35bc('0x1b'),'chanspy':!![]},'raw':!![]})[_0x35bc('0x1c')](function(_0x1bb44c){if(_0x1bb44c){return _0x254fd7(getChanSpyApplications(_0x23a80e,_0x1bb44c));}return _0x254fd7([]);})[_0x35bc('0x1d')](function(_0x210e9e){_0x4b2f0f(_0x210e9e);});});};module[_0x35bc('0x1e')]=function(_0x444279,_0x527570){var _0x22d494=_0x444279[_0x35bc('0x1f')];return _0x444279[_0x35bc('0x20')]('VoiceChanSpy',attributes,{'tableName':_0x35bc('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x323751,_0x530589,_0x4461c2){return getChanSpyPromise(_0x22d494,_0x323751)[_0x35bc('0x1c')](function(_0x4ebdf5){if(_0x4ebdf5&&_0x4ebdf5[_0x35bc('0x16')]){return _0x22d494[_0x35bc('0x22')][_0x35bc('0x23')](_0x4ebdf5);}})[_0x35bc('0x1c')](function(){_0x4461c2();})[_0x35bc('0x1d')](function(_0x4fafbe){_0x4461c2(_0x4fafbe);});},'afterUpdate':function(_0x57a3ff,_0x45fc78,_0x55ba12){return _0x22d494[_0x35bc('0x22')][_0x35bc('0x24')]({'where':{'ChanSpyId':_0x57a3ff['id']}})[_0x35bc('0x1c')](function(){return getChanSpyPromise(_0x22d494,_0x57a3ff);})['then'](function(_0x34c702){if(_0x34c702&&_0x34c702[_0x35bc('0x16')]){return _0x22d494[_0x35bc('0x22')]['bulkCreate'](_0x34c702);}})['then'](function(){_0x55ba12();})[_0x35bc('0x1d')](function(_0x31633b){_0x55ba12(_0x31633b);});},'afterDestroy':function(_0x235e22,_0x5e42f5,_0x58fd4a){return _0x22d494['VoiceExtension'][_0x35bc('0x24')]({'where':{'ChanSpyId':_0x235e22['id']}})['then'](function(){_0x58fd4a();})[_0x35bc('0x1d')](function(_0x381d7){_0x58fd4a(_0x381d7);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index de9c3ed..55ac810 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 _0xa0bc=['catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x106a1d,_0x1dafdf){var _0x3ef52f=function(_0x3ff2a2){while(--_0x3ff2a2){_0x106a1d['push'](_0x106a1d['shift']());}};_0x3ef52f(++_0x1dafdf);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var moment=require(_0xca0b('0x1'));var BPromise=require('bluebird');var rs=require(_0xca0b('0x2'));var fs=require('fs');var Redis=require(_0xca0b('0x3'));var db=require(_0xca0b('0x4'))['db'];var utils=require(_0xca0b('0x5'));var logger=require(_0xca0b('0x6'))(_0xca0b('0x7'));var config=require(_0xca0b('0x8'));var jayson=require(_0xca0b('0x9'));var client=jayson[_0xca0b('0xa')][_0xca0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbe64c7,_0x30202d,_0xa506a4){return new BPromise(function(_0x19acc2,_0x55a1de){return client[_0xca0b('0xc')](_0xbe64c7,_0xa506a4)[_0xca0b('0xd')](function(_0x3e3909){logger[_0xca0b('0xe')](_0xca0b('0xf'),_0x30202d,_0xca0b('0x10'));logger['debug'](_0xca0b('0x11'),_0x30202d,_0xca0b('0x10'),JSON[_0xca0b('0x12')](_0x3e3909));if(_0x3e3909[_0xca0b('0x13')]){if(_0x3e3909[_0xca0b('0x13')][_0xca0b('0x14')]===0x1f4){logger[_0xca0b('0x13')](_0xca0b('0xf'),_0x30202d,_0x3e3909[_0xca0b('0x13')][_0xca0b('0x15')]);return _0x55a1de(_0x3e3909['error'][_0xca0b('0x15')]);}logger[_0xca0b('0x13')](_0xca0b('0xf'),_0x30202d,_0x3e3909['error'][_0xca0b('0x15')]);return _0x19acc2(_0x3e3909[_0xca0b('0x13')][_0xca0b('0x15')]);}else{logger[_0xca0b('0xe')](_0xca0b('0xf'),_0x30202d,_0xca0b('0x10'));_0x19acc2(_0x3e3909['result'][_0xca0b('0x15')]);}})[_0xca0b('0x16')](function(_0x4d9b16){logger[_0xca0b('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x30202d,_0x4d9b16);_0x55a1de(_0x4d9b16);});});} \ No newline at end of file +var _0xa5fa=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment'];(function(_0x2b95e1,_0x493700){var _0x12a9b8=function(_0x25c400){while(--_0x25c400){_0x2b95e1['push'](_0x2b95e1['shift']());}};_0x12a9b8(++_0x493700);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x366628,_0xdd8460){_0x366628=_0x366628-0x0;var _0x512d64=_0xa5fa[_0x366628];return _0x512d64;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 2eb44ad..81db8a5 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 _0xfbd3=['update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','put'];(function(_0x525f73,_0x5cf7e6){var _0xbc7f27=function(_0x28c9c3){while(--_0x28c9c3){_0x525f73['push'](_0x525f73['shift']());}};_0xbc7f27(++_0x5cf7e6);}(_0xfbd3,0x1df));var _0x3fbd=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xfbd3[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x3fbd('0x0'));var util=require(_0x3fbd('0x1'));var path=require(_0x3fbd('0x2'));var timeout=require(_0x3fbd('0x3'));var express=require(_0x3fbd('0x4'));var router=express['Router']();var fs_extra=require(_0x3fbd('0x5'));var auth=require(_0x3fbd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3fbd('0x7'));var controller=require(_0x3fbd('0x8'));router['get']('/',auth[_0x3fbd('0x9')](),controller[_0x3fbd('0xa')]);router[_0x3fbd('0xb')](_0x3fbd('0xc'),auth[_0x3fbd('0x9')](),controller['show']);router['post']('/',auth[_0x3fbd('0x9')](),controller['create']);router[_0x3fbd('0xd')](_0x3fbd('0xc'),auth['isAuthenticated'](),controller[_0x3fbd('0xe')]);router['delete'](_0x3fbd('0xc'),auth[_0x3fbd('0x9')](),controller[_0x3fbd('0xf')]);module[_0x3fbd('0x10')]=router; \ No newline at end of file +var _0x5d51=['index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get'];(function(_0x11a32e,_0x143462){var _0x38c8a6=function(_0x2cdfdb){while(--_0x2cdfdb){_0x11a32e['push'](_0x11a32e['shift']());}};_0x38c8a6(++_0x143462);}(_0x5d51,0x106));var _0x15d5=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5d51[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x15d5('0x0'));var util=require(_0x15d5('0x1'));var path=require(_0x15d5('0x2'));var timeout=require(_0x15d5('0x3'));var express=require(_0x15d5('0x4'));var router=express[_0x15d5('0x5')]();var fs_extra=require(_0x15d5('0x6'));var auth=require(_0x15d5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x15d5('0x8'));var controller=require(_0x15d5('0x9'));router[_0x15d5('0xa')]('/',auth['isAuthenticated'](),controller[_0x15d5('0xb')]);router['get'](_0x15d5('0xc'),auth[_0x15d5('0xd')](),controller[_0x15d5('0xe')]);router[_0x15d5('0xf')]('/',auth[_0x15d5('0xd')](),controller[_0x15d5('0x10')]);router[_0x15d5('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x15d5('0x12')]);router[_0x15d5('0x13')]('/:id',auth[_0x15d5('0xd')](),controller[_0x15d5('0x14')]);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 438e20b..70b6a29 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 _0x6971=['STRING','BOOLEAN','exports'];(function(_0x1296f0,_0x4331c3){var _0x4b2a0f=function(_0x316f53){while(--_0x316f53){_0x1296f0['push'](_0x1296f0['shift']());}};_0x4b2a0f(++_0x4331c3);}(_0x6971,0x1e8));var _0x1697=function(_0x4916ca,_0x3d19c2){_0x4916ca=_0x4916ca-0x0;var _0x598fe8=_0x6971[_0x4916ca];return _0x598fe8;};'use strict';var Sequelize=require('sequelize');module[_0x1697('0x0')]={'name':{'type':Sequelize[_0x1697('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x1697('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x1697('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x76fe=['BOOLEAN','name'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x76fe,0x171));var _0xe76f=function(_0x404f55,_0x2814e3){_0x404f55=_0x404f55-0x0;var _0x395a9e=_0x76fe[_0x404f55];return _0x395a9e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe76f('0x0')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe76f('0x1')],'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 c6591b4..72da10d 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 _0x44f0=['count','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','params','create','body','readFileSync','root','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','writeFileSync','utf8','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','then','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','offset','undefined','limit'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0x44f0,0x105));var _0x044f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x44f0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x044f('0x0'));var zipdir=require(_0x044f('0x1'));var jsonpatch=require(_0x044f('0x2'));var rp=require(_0x044f('0x3'));var moment=require(_0x044f('0x4'));var BPromise=require(_0x044f('0x5'));var Mustache=require(_0x044f('0x6'));var util=require(_0x044f('0x7'));var path=require(_0x044f('0x8'));var sox=require(_0x044f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x044f('0xa'));var squel=require(_0x044f('0xb'));var crypto=require(_0x044f('0xc'));var jsforce=require(_0x044f('0xd'));var deskjs=require(_0x044f('0xe'));var toCsv=require(_0x044f('0xf'));var querystring=require(_0x044f('0x10'));var Papa=require('papaparse');var Redis=require(_0x044f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x044f('0x12'));var logger=require(_0x044f('0x13'))(_0x044f('0x14'));var utils=require(_0x044f('0x15'));var config=require(_0x044f('0x16'));var licenseUtil=require(_0x044f('0x17'));var db=require(_0x044f('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4354f5,_0x1667d7,_0x2c10a8,_0xbe824c){return new BPromise(function(_0x103e87,_0x2cd856){var _0x5118fb=_0xbe824c||client;return _0x5118fb['request'](_0x4354f5,_0x2c10a8)[_0x044f('0x19')](function(_0x335821){logger['info']('VoiceContext,\x20%s,\x20%s',_0x1667d7,_0x044f('0x1a'));logger[_0x044f('0x1b')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1667d7,_0x044f('0x1a'),JSON[_0x044f('0x1c')](_0x335821));if(_0x335821[_0x044f('0x1d')]){if(_0x335821['error'][_0x044f('0x1e')]===0x1f4){logger[_0x044f('0x1d')](_0x044f('0x1f'),_0x1667d7,_0x335821[_0x044f('0x1d')][_0x044f('0x20')]);return _0x2cd856(_0x335821['error'][_0x044f('0x20')]);}logger['error'](_0x044f('0x1f'),_0x1667d7,_0x335821[_0x044f('0x1d')][_0x044f('0x20')]);return _0x103e87(_0x335821[_0x044f('0x1d')]['message']);}else{logger[_0x044f('0x21')](_0x044f('0x1f'),_0x1667d7,_0x044f('0x1a'));_0x103e87(_0x335821[_0x044f('0x22')]['message']);}})[_0x044f('0x23')](function(_0x40f96f){logger[_0x044f('0x1d')](_0x044f('0x1f'),_0x1667d7,_0x40f96f);_0x2cd856(_0x40f96f);});});}function respondWithStatusCode(_0x283eb9,_0x33d762){_0x33d762=_0x33d762||0xcc;return function(_0xf755ee){if(_0xf755ee){return _0x283eb9[_0x044f('0x24')](_0x33d762);}return _0x283eb9[_0x044f('0x25')](_0x33d762)[_0x044f('0x26')]();};}function respondWithResult(_0x288d56,_0xe71665){_0xe71665=_0xe71665||0xc8;return function(_0x3a19a1){if(_0x3a19a1){return _0x288d56[_0x044f('0x25')](_0xe71665)['json'](_0x3a19a1);}};}function respondWithFilteredResult(_0x6463f3,_0x13f8c1){return function(_0x1a128f){if(_0x1a128f){var _0x57ecf2=typeof _0x13f8c1[_0x044f('0x27')]===_0x044f('0x28')&&typeof _0x13f8c1[_0x044f('0x29')]===_0x044f('0x28');var _0x304b34=_0x1a128f[_0x044f('0x2a')];var _0x628228=_0x57ecf2?0x0:_0x13f8c1[_0x044f('0x27')];var _0x536509=_0x57ecf2?_0x1a128f[_0x044f('0x2a')]:_0x13f8c1['offset']+_0x13f8c1[_0x044f('0x29')];var _0xb3c47b;if(_0x536509>=_0x304b34){_0x536509=_0x304b34;_0xb3c47b=0xc8;}else{_0xb3c47b=0xce;}_0x6463f3[_0x044f('0x25')](_0xb3c47b);return _0x6463f3[_0x044f('0x2b')](_0x044f('0x2c'),_0x628228+'-'+_0x536509+'/'+_0x304b34)['json'](_0x1a128f);}return null;};}function patchUpdates(_0x67cc5f){return function(_0x2dfe03){try{jsonpatch[_0x044f('0x2d')](_0x2dfe03,_0x67cc5f,!![]);}catch(_0x3ed3b4){return BPromise[_0x044f('0x2e')](_0x3ed3b4);}return _0x2dfe03[_0x044f('0x2f')]();};}function saveUpdates(_0x1ea38c,_0x591678){return function(_0x2117ee){if(_0x2117ee){return _0x2117ee[_0x044f('0x30')](_0x1ea38c)[_0x044f('0x19')](function(_0x548753){return _0x548753;});}return null;};}function removeEntity(_0x5c6082,_0x4ede5d){return function(_0x32c327){if(_0x32c327){return _0x32c327[_0x044f('0x31')]()[_0x044f('0x19')](function(){var _0x250867=_0x32c327[_0x044f('0x32')]({'plain':!![]});var _0x2ce50b=_0x044f('0x33');return db[_0x044f('0x34')][_0x044f('0x31')]({'where':{'type':_0x2ce50b,'resourceId':_0x250867['id']}})[_0x044f('0x19')](function(){return _0x32c327;});})[_0x044f('0x19')](function(){_0x5c6082[_0x044f('0x25')](0xcc)[_0x044f('0x26')]();});}};}function handleEntityNotFound(_0x13d7ff,_0x3b4791){return function(_0x4eb328){if(!_0x4eb328){_0x13d7ff[_0x044f('0x24')](0x194);}return _0x4eb328;};}function handleError(_0x11a264,_0x3e9408){_0x3e9408=_0x3e9408||0x1f4;return function(_0x31ef39){logger[_0x044f('0x1d')](_0x31ef39[_0x044f('0x35')]);if(_0x31ef39[_0x044f('0x36')]){delete _0x31ef39[_0x044f('0x36')];}_0x11a264[_0x044f('0x25')](_0x3e9408)['send'](_0x31ef39);};}exports[_0x044f('0x37')]=function(_0x40e8ad,_0x1ca958){var _0x7c5894={},_0x271d93={},_0x2e98f4={'count':0x0,'rows':[]};var _0x4f0665=_[_0x044f('0x38')](db[_0x044f('0x39')][_0x044f('0x3a')],function(_0xf85a67){return{'name':_0xf85a67[_0x044f('0x3b')],'type':_0xf85a67[_0x044f('0x3c')][_0x044f('0x3d')]};});_0x271d93['model']=_[_0x044f('0x38')](_0x4f0665,_0x044f('0x36'));_0x271d93[_0x044f('0x3e')]=_['keys'](_0x40e8ad[_0x044f('0x3e')]);_0x271d93[_0x044f('0x3f')]=_[_0x044f('0x40')](_0x271d93[_0x044f('0x41')],_0x271d93[_0x044f('0x3e')]);_0x7c5894[_0x044f('0x42')]=_['intersection'](_0x271d93[_0x044f('0x41')],qs[_0x044f('0x43')](_0x40e8ad[_0x044f('0x3e')][_0x044f('0x43')]));_0x7c5894[_0x044f('0x42')]=_0x7c5894[_0x044f('0x42')][_0x044f('0x44')]?_0x7c5894['attributes']:_0x271d93[_0x044f('0x41')];if(!_0x40e8ad['query'][_0x044f('0x45')](_0x044f('0x46'))){_0x7c5894['limit']=qs[_0x044f('0x29')](_0x40e8ad[_0x044f('0x3e')]['limit']);_0x7c5894['offset']=qs[_0x044f('0x27')](_0x40e8ad[_0x044f('0x3e')][_0x044f('0x27')]);}_0x7c5894[_0x044f('0x47')]=qs[_0x044f('0x48')](_0x40e8ad[_0x044f('0x3e')][_0x044f('0x48')]);_0x7c5894['where']=qs[_0x044f('0x3f')](_['pick'](_0x40e8ad[_0x044f('0x3e')],_0x271d93['filters']),_0x4f0665);if(_0x40e8ad['query'][_0x044f('0x49')]){_0x7c5894[_0x044f('0x4a')]=_[_0x044f('0x4b')](_0x7c5894[_0x044f('0x4a')],{'$or':_[_0x044f('0x38')](_0x4f0665,function(_0x26195b){if(_0x26195b['type']!==_0x044f('0x4c')){var _0x1bfffe={};_0x1bfffe[_0x26195b[_0x044f('0x36')]]={'$like':'%'+_0x40e8ad[_0x044f('0x3e')][_0x044f('0x49')]+'%'};return _0x1bfffe;}})});}_0x7c5894=_[_0x044f('0x4b')]({},_0x7c5894,_0x40e8ad[_0x044f('0x4d')]);var _0x4acbf9={'where':_0x7c5894['where']};return db[_0x044f('0x39')]['count'](_0x4acbf9)[_0x044f('0x19')](function(_0x5510d3){_0x2e98f4['count']=_0x5510d3;if(_0x40e8ad[_0x044f('0x3e')][_0x044f('0x4e')]){_0x7c5894[_0x044f('0x4f')]=[{'all':!![]}];}return db['VoiceContext'][_0x044f('0x50')](_0x7c5894);})[_0x044f('0x19')](function(_0x11ef25){_0x2e98f4['rows']=_0x11ef25;return _0x2e98f4;})['then'](respondWithFilteredResult(_0x1ca958,_0x7c5894))[_0x044f('0x23')](handleError(_0x1ca958,null));};exports['show']=function(_0x35abbb,_0x599a0e){var _0x4f8fdf={'raw':![],'where':{'id':_0x35abbb[_0x044f('0x51')]['id']}},_0x2abfd5={};_0x2abfd5[_0x044f('0x41')]=_['keys'](db[_0x044f('0x39')][_0x044f('0x3a')]);_0x2abfd5[_0x044f('0x3e')]=_['keys'](_0x35abbb['query']);_0x2abfd5[_0x044f('0x3f')]=_[_0x044f('0x40')](_0x2abfd5['model'],_0x2abfd5[_0x044f('0x3e')]);_0x4f8fdf['attributes']=_[_0x044f('0x40')](_0x2abfd5[_0x044f('0x41')],qs[_0x044f('0x43')](_0x35abbb[_0x044f('0x3e')][_0x044f('0x43')]));_0x4f8fdf[_0x044f('0x42')]=_0x4f8fdf[_0x044f('0x42')][_0x044f('0x44')]?_0x4f8fdf['attributes']:_0x2abfd5[_0x044f('0x41')];if(_0x35abbb[_0x044f('0x3e')][_0x044f('0x4e')]){_0x4f8fdf['include']=[{'all':!![]}];}_0x4f8fdf=_[_0x044f('0x4b')]({},_0x4f8fdf,_0x35abbb[_0x044f('0x4d')]);return db[_0x044f('0x39')]['find'](_0x4f8fdf)['then'](handleEntityNotFound(_0x599a0e,null))[_0x044f('0x19')](respondWithResult(_0x599a0e,null))[_0x044f('0x23')](handleError(_0x599a0e,null));};exports[_0x044f('0x52')]=function(_0x438ed0,_0x46bb45,_0x2abcf5){var _0x57d7d4;return db[_0x044f('0x39')][_0x044f('0x52')](_0x438ed0[_0x044f('0x53')],{'raw':!![]})[_0x044f('0x19')](function(_0x70985f){_0x57d7d4=_0x70985f;return db[_0x044f('0x39')][_0x044f('0x50')]({'raw':!![]});})[_0x044f('0x19')](function(_0x597321){var _0x5da6b8=fs[_0x044f('0x54')](path['join'](config[_0x044f('0x55')],_0x044f('0x56')),'utf8');var _0x1a9adb=ejs[_0x044f('0x57')](_0x5da6b8,{'contexts':_0x597321||[]});fs['writeFileSync'](_0x044f('0x58'),_0x1a9adb);})[_0x044f('0x19')](function(){return respondWithRpcPromise(_0x044f('0x59'),'create',{'module':_0x044f('0x5a')});})[_0x044f('0x19')](function(){var _0x32e6fb=_0x438ed0[_0x044f('0x5b')][_0x044f('0x32')]({'plain':!![]});if(!_0x32e6fb)throw new Error(_0x044f('0x5c'));if(_0x32e6fb[_0x044f('0x5d')]===_0x044f('0x5b')){var _0x4f56e6=_0x57d7d4[_0x044f('0x32')]({'plain':!![]});return db[_0x044f('0x5e')][_0x044f('0x5f')]({'where':{'name':_0x044f('0x33'),'userProfileId':_0x32e6fb[_0x044f('0x60')]},'raw':!![]})['then'](function(_0x10547f){if(_0x10547f&&_0x10547f['autoAssociation']===0x0){return db[_0x044f('0x34')][_0x044f('0x52')]({'name':_0x4f56e6[_0x044f('0x36')],'resourceId':_0x4f56e6['id'],'type':_0x10547f[_0x044f('0x36')],'sectionId':_0x10547f['id']},{})[_0x044f('0x19')](function(){return _0x57d7d4;});}else{return _0x57d7d4;}})['catch'](function(_0x5f4ebb){logger[_0x044f('0x1d')](_0x044f('0x61'),_0x5f4ebb);throw _0x5f4ebb;});}return _0x57d7d4;})[_0x044f('0x19')](respondWithResult(_0x46bb45,0xc9))[_0x044f('0x23')](handleError(_0x46bb45,null));};exports['update']=function(_0x35a8d3,_0x3b86d0,_0x47bd2e){var _0x10eaa6;return db[_0x044f('0x39')][_0x044f('0x5f')]({'where':{'id':_0x35a8d3[_0x044f('0x51')]['id']}})[_0x044f('0x19')](handleEntityNotFound(_0x3b86d0,null))[_0x044f('0x19')](saveUpdates(_0x35a8d3[_0x044f('0x53')],null))[_0x044f('0x19')](function(_0x453843){if(_0x453843){_0x10eaa6=_0x453843;return db[_0x044f('0x39')]['findAll']({'raw':!![]});}})[_0x044f('0x19')](function(_0x5b0a82){var _0x339020=fs[_0x044f('0x54')](path[_0x044f('0x62')](config[_0x044f('0x55')],_0x044f('0x56')),'utf8');var _0x4c273b=ejs[_0x044f('0x57')](_0x339020,{'contexts':_0x5b0a82||[]});fs[_0x044f('0x63')](_0x044f('0x58'),_0x4c273b);})[_0x044f('0x19')](function(){return respondWithRpcPromise(_0x044f('0x59'),_0x044f('0x30'),{'module':_0x044f('0x5a')});})[_0x044f('0x19')](function(){return _0x10eaa6;})['then'](respondWithResult(_0x3b86d0,null))[_0x044f('0x23')](handleError(_0x3b86d0,null));};exports[_0x044f('0x31')]=function(_0xb63dca,_0x5e538c,_0x32e7f1){var _0x51f8e6;return db[_0x044f('0x39')][_0x044f('0x5f')]({'where':{'id':_0xb63dca[_0x044f('0x51')]['id']}})[_0x044f('0x19')](handleEntityNotFound(_0x5e538c,null))[_0x044f('0x19')](removeEntity(_0x5e538c,null))[_0x044f('0x19')](function(){return db[_0x044f('0x39')][_0x044f('0x50')]({'raw':!![]});})[_0x044f('0x19')](function(_0x443fb9){var _0x5eb327=fs[_0x044f('0x54')](path['join'](config[_0x044f('0x55')],_0x044f('0x56')),_0x044f('0x64'));var _0xc431e1=ejs['render'](_0x5eb327,{'contexts':_0x443fb9});fs[_0x044f('0x63')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xc431e1);return respondWithRpcPromise('Reload',_0x044f('0x31'),{'module':'chan_sip.so'});})['catch'](handleError(_0x5e538c,null));}; \ No newline at end of file +var _0xe8b7=['bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','get','UserProfileResource','name','send','index','map','VoiceContext','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','create','body','findAll','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','readFileSync','join','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1b95e7,_0x496cc8){var _0x38fd3f=function(_0x2f891c){while(--_0x2f891c){_0x1b95e7['push'](_0x1b95e7['shift']());}};_0x38fd3f(++_0x496cc8);}(_0xe8b7,0x193));var _0x7e8b=function(_0x472b1b,_0x5dd7d0){_0x472b1b=_0x472b1b-0x0;var _0x11653e=_0xe8b7[_0x472b1b];return _0x11653e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e8b('0x0'));var zipdir=require(_0x7e8b('0x1'));var jsonpatch=require(_0x7e8b('0x2'));var rp=require(_0x7e8b('0x3'));var moment=require(_0x7e8b('0x4'));var BPromise=require(_0x7e8b('0x5'));var Mustache=require(_0x7e8b('0x6'));var util=require('util');var path=require(_0x7e8b('0x7'));var sox=require(_0x7e8b('0x8'));var csv=require(_0x7e8b('0x9'));var ejs=require(_0x7e8b('0xa'));var fs=require('fs');var fs_extra=require(_0x7e8b('0xb'));var _=require('lodash');var squel=require(_0x7e8b('0xc'));var crypto=require(_0x7e8b('0xd'));var jsforce=require(_0x7e8b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7e8b('0x9'));var querystring=require(_0x7e8b('0xf'));var Papa=require('papaparse');var Redis=require(_0x7e8b('0x10'));var authService=require(_0x7e8b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e8b('0x12'));var logger=require(_0x7e8b('0x13'))(_0x7e8b('0x14'));var utils=require(_0x7e8b('0x15'));var config=require(_0x7e8b('0x16'));var licenseUtil=require(_0x7e8b('0x17'));var db=require(_0x7e8b('0x18'))['db'];var jayson=require(_0x7e8b('0x19'));var client=jayson[_0x7e8b('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36295b,_0x41b478,_0x590d17,_0x4b2a7e){return new BPromise(function(_0x5782c4,_0x236b7d){var _0x23222a=_0x4b2a7e||client;return _0x23222a['request'](_0x36295b,_0x590d17)[_0x7e8b('0x1b')](function(_0xf6919d){logger[_0x7e8b('0x1c')](_0x7e8b('0x1d'),_0x41b478,_0x7e8b('0x1e'));logger[_0x7e8b('0x1f')](_0x7e8b('0x20'),_0x41b478,_0x7e8b('0x1e'),JSON[_0x7e8b('0x21')](_0xf6919d));if(_0xf6919d['error']){if(_0xf6919d[_0x7e8b('0x22')][_0x7e8b('0x23')]===0x1f4){logger[_0x7e8b('0x22')]('VoiceContext,\x20%s,\x20%s',_0x41b478,_0xf6919d[_0x7e8b('0x22')]['message']);return _0x236b7d(_0xf6919d[_0x7e8b('0x22')][_0x7e8b('0x24')]);}logger['error'](_0x7e8b('0x1d'),_0x41b478,_0xf6919d['error']['message']);return _0x5782c4(_0xf6919d['error']['message']);}else{logger['info'](_0x7e8b('0x1d'),_0x41b478,_0x7e8b('0x1e'));_0x5782c4(_0xf6919d[_0x7e8b('0x25')][_0x7e8b('0x24')]);}})[_0x7e8b('0x26')](function(_0x3e45b9){logger[_0x7e8b('0x22')](_0x7e8b('0x1d'),_0x41b478,_0x3e45b9);_0x236b7d(_0x3e45b9);});});}function respondWithStatusCode(_0x4f2ac9,_0x263b35){_0x263b35=_0x263b35||0xcc;return function(_0x543ee5){if(_0x543ee5){return _0x4f2ac9[_0x7e8b('0x27')](_0x263b35);}return _0x4f2ac9[_0x7e8b('0x28')](_0x263b35)[_0x7e8b('0x29')]();};}function respondWithResult(_0x551e30,_0x1880e9){_0x1880e9=_0x1880e9||0xc8;return function(_0x2912e9){if(_0x2912e9){return _0x551e30[_0x7e8b('0x28')](_0x1880e9)[_0x7e8b('0x2a')](_0x2912e9);}};}function respondWithFilteredResult(_0xed623c,_0x21800c){return function(_0x4bdd42){if(_0x4bdd42){var _0x520484=typeof _0x21800c[_0x7e8b('0x2b')]===_0x7e8b('0x2c')&&typeof _0x21800c[_0x7e8b('0x2d')]===_0x7e8b('0x2c');var _0x46e940=_0x4bdd42[_0x7e8b('0x2e')];var _0x1ebde5=_0x520484?0x0:_0x21800c['offset'];var _0xb0d49d=_0x520484?_0x4bdd42[_0x7e8b('0x2e')]:_0x21800c[_0x7e8b('0x2b')]+_0x21800c[_0x7e8b('0x2d')];var _0x5d5210;if(_0xb0d49d>=_0x46e940){_0xb0d49d=_0x46e940;_0x5d5210=0xc8;}else{_0x5d5210=0xce;}_0xed623c[_0x7e8b('0x28')](_0x5d5210);return _0xed623c['set'](_0x7e8b('0x2f'),_0x1ebde5+'-'+_0xb0d49d+'/'+_0x46e940)[_0x7e8b('0x2a')](_0x4bdd42);}return null;};}function patchUpdates(_0x152811){return function(_0x3d5ecb){try{jsonpatch['apply'](_0x3d5ecb,_0x152811,!![]);}catch(_0x56cac8){return BPromise[_0x7e8b('0x30')](_0x56cac8);}return _0x3d5ecb[_0x7e8b('0x31')]();};}function saveUpdates(_0x111943,_0x4fd728){return function(_0x2767fe){if(_0x2767fe){return _0x2767fe['update'](_0x111943)[_0x7e8b('0x1b')](function(_0xd4e8ca){return _0xd4e8ca;});}return null;};}function removeEntity(_0x50cfc7,_0x4d2cbc){return function(_0x79fbc9){if(_0x79fbc9){return _0x79fbc9[_0x7e8b('0x32')]()[_0x7e8b('0x1b')](function(){var _0x5dc23d=_0x79fbc9[_0x7e8b('0x33')]({'plain':!![]});var _0x1587bc='Contexts';return db[_0x7e8b('0x34')][_0x7e8b('0x32')]({'where':{'type':_0x1587bc,'resourceId':_0x5dc23d['id']}})[_0x7e8b('0x1b')](function(){return _0x79fbc9;});})[_0x7e8b('0x1b')](function(){_0x50cfc7[_0x7e8b('0x28')](0xcc)[_0x7e8b('0x29')]();});}};}function handleEntityNotFound(_0x4d135f,_0x56e6bd){return function(_0x4bc419){if(!_0x4bc419){_0x4d135f[_0x7e8b('0x27')](0x194);}return _0x4bc419;};}function handleError(_0x599b18,_0x5beee0){_0x5beee0=_0x5beee0||0x1f4;return function(_0x1b3386){logger[_0x7e8b('0x22')](_0x1b3386['stack']);if(_0x1b3386[_0x7e8b('0x35')]){delete _0x1b3386[_0x7e8b('0x35')];}_0x599b18[_0x7e8b('0x28')](_0x5beee0)[_0x7e8b('0x36')](_0x1b3386);};}exports[_0x7e8b('0x37')]=function(_0x4ed670,_0x1f1f54){var _0x5d4c85={},_0x405ac1={},_0x5478bc={'count':0x0,'rows':[]};var _0xf821b9=_[_0x7e8b('0x38')](db[_0x7e8b('0x39')]['rawAttributes'],function(_0x164961){return{'name':_0x164961['fieldName'],'type':_0x164961[_0x7e8b('0x3a')][_0x7e8b('0x3b')]};});_0x405ac1[_0x7e8b('0x3c')]=_['map'](_0xf821b9,_0x7e8b('0x35'));_0x405ac1[_0x7e8b('0x3d')]=_[_0x7e8b('0x3e')](_0x4ed670['query']);_0x405ac1[_0x7e8b('0x3f')]=_[_0x7e8b('0x40')](_0x405ac1[_0x7e8b('0x3c')],_0x405ac1[_0x7e8b('0x3d')]);_0x5d4c85[_0x7e8b('0x41')]=_[_0x7e8b('0x40')](_0x405ac1[_0x7e8b('0x3c')],qs[_0x7e8b('0x42')](_0x4ed670[_0x7e8b('0x3d')][_0x7e8b('0x42')]));_0x5d4c85[_0x7e8b('0x41')]=_0x5d4c85[_0x7e8b('0x41')][_0x7e8b('0x43')]?_0x5d4c85[_0x7e8b('0x41')]:_0x405ac1[_0x7e8b('0x3c')];if(!_0x4ed670[_0x7e8b('0x3d')][_0x7e8b('0x44')](_0x7e8b('0x45'))){_0x5d4c85[_0x7e8b('0x2d')]=qs['limit'](_0x4ed670['query'][_0x7e8b('0x2d')]);_0x5d4c85[_0x7e8b('0x2b')]=qs[_0x7e8b('0x2b')](_0x4ed670['query'][_0x7e8b('0x2b')]);}_0x5d4c85[_0x7e8b('0x46')]=qs[_0x7e8b('0x47')](_0x4ed670[_0x7e8b('0x3d')][_0x7e8b('0x47')]);_0x5d4c85['where']=qs[_0x7e8b('0x3f')](_['pick'](_0x4ed670[_0x7e8b('0x3d')],_0x405ac1['filters']),_0xf821b9);if(_0x4ed670[_0x7e8b('0x3d')]['filter']){_0x5d4c85[_0x7e8b('0x48')]=_[_0x7e8b('0x49')](_0x5d4c85[_0x7e8b('0x48')],{'$or':_[_0x7e8b('0x38')](_0xf821b9,function(_0xe987cf){if(_0xe987cf[_0x7e8b('0x3a')]!==_0x7e8b('0x4a')){var _0x25009e={};_0x25009e[_0xe987cf['name']]={'$like':'%'+_0x4ed670['query']['filter']+'%'};return _0x25009e;}})});}_0x5d4c85=_[_0x7e8b('0x49')]({},_0x5d4c85,_0x4ed670[_0x7e8b('0x4b')]);var _0x2bdb7b={'where':_0x5d4c85[_0x7e8b('0x48')]};return db[_0x7e8b('0x39')][_0x7e8b('0x2e')](_0x2bdb7b)[_0x7e8b('0x1b')](function(_0x5f82c3){_0x5478bc[_0x7e8b('0x2e')]=_0x5f82c3;if(_0x4ed670[_0x7e8b('0x3d')][_0x7e8b('0x4c')]){_0x5d4c85[_0x7e8b('0x4d')]=[{'all':!![]}];}return db[_0x7e8b('0x39')]['findAll'](_0x5d4c85);})[_0x7e8b('0x1b')](function(_0x3df4c8){_0x5478bc[_0x7e8b('0x4e')]=_0x3df4c8;return _0x5478bc;})[_0x7e8b('0x1b')](respondWithFilteredResult(_0x1f1f54,_0x5d4c85))[_0x7e8b('0x26')](handleError(_0x1f1f54,null));};exports[_0x7e8b('0x4f')]=function(_0x2a3aa3,_0x4b9831){var _0x2130c9={'raw':![],'where':{'id':_0x2a3aa3[_0x7e8b('0x50')]['id']}},_0x16b35c={};_0x16b35c[_0x7e8b('0x3c')]=_[_0x7e8b('0x3e')](db[_0x7e8b('0x39')][_0x7e8b('0x51')]);_0x16b35c['query']=_[_0x7e8b('0x3e')](_0x2a3aa3[_0x7e8b('0x3d')]);_0x16b35c[_0x7e8b('0x3f')]=_[_0x7e8b('0x40')](_0x16b35c['model'],_0x16b35c[_0x7e8b('0x3d')]);_0x2130c9[_0x7e8b('0x41')]=_[_0x7e8b('0x40')](_0x16b35c[_0x7e8b('0x3c')],qs['fields'](_0x2a3aa3[_0x7e8b('0x3d')]['fields']));_0x2130c9[_0x7e8b('0x41')]=_0x2130c9['attributes']['length']?_0x2130c9[_0x7e8b('0x41')]:_0x16b35c['model'];if(_0x2a3aa3[_0x7e8b('0x3d')]['includeAll']){_0x2130c9[_0x7e8b('0x4d')]=[{'all':!![]}];}_0x2130c9=_[_0x7e8b('0x49')]({},_0x2130c9,_0x2a3aa3[_0x7e8b('0x4b')]);return db[_0x7e8b('0x39')]['find'](_0x2130c9)[_0x7e8b('0x1b')](handleEntityNotFound(_0x4b9831,null))[_0x7e8b('0x1b')](respondWithResult(_0x4b9831,null))[_0x7e8b('0x26')](handleError(_0x4b9831,null));};exports[_0x7e8b('0x52')]=function(_0x4691e3,_0x35b84a,_0x5acff1){var _0x4ab70c;return db[_0x7e8b('0x39')][_0x7e8b('0x52')](_0x4691e3[_0x7e8b('0x53')],{'raw':!![]})[_0x7e8b('0x1b')](function(_0x242bdd){_0x4ab70c=_0x242bdd;return db[_0x7e8b('0x39')][_0x7e8b('0x54')]({'raw':!![]});})[_0x7e8b('0x1b')](function(_0x16ec6a){var _0x14f075=fs['readFileSync'](path['join'](config[_0x7e8b('0x55')],_0x7e8b('0x56')),_0x7e8b('0x57'));var _0x31d0d6=ejs[_0x7e8b('0x58')](_0x14f075,{'contexts':_0x16ec6a||[]});fs[_0x7e8b('0x59')](_0x7e8b('0x5a'),_0x31d0d6);})[_0x7e8b('0x1b')](function(){return respondWithRpcPromise(_0x7e8b('0x5b'),'create',{'module':_0x7e8b('0x5c')});})[_0x7e8b('0x1b')](function(){var _0x48fb73=_0x4691e3[_0x7e8b('0x5d')][_0x7e8b('0x33')]({'plain':!![]});if(!_0x48fb73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48fb73[_0x7e8b('0x5e')]===_0x7e8b('0x5d')){var _0x32e18c=_0x4ab70c['get']({'plain':!![]});return db['UserProfileSection'][_0x7e8b('0x5f')]({'where':{'name':'Contexts','userProfileId':_0x48fb73[_0x7e8b('0x60')]},'raw':!![]})[_0x7e8b('0x1b')](function(_0x3b88c0){if(_0x3b88c0&&_0x3b88c0[_0x7e8b('0x61')]===0x0){return db[_0x7e8b('0x34')][_0x7e8b('0x52')]({'name':_0x32e18c[_0x7e8b('0x35')],'resourceId':_0x32e18c['id'],'type':_0x3b88c0['name'],'sectionId':_0x3b88c0['id']},{})[_0x7e8b('0x1b')](function(){return _0x4ab70c;});}else{return _0x4ab70c;}})['catch'](function(_0x120e00){logger[_0x7e8b('0x22')](_0x7e8b('0x62'),_0x120e00);throw _0x120e00;});}return _0x4ab70c;})[_0x7e8b('0x1b')](respondWithResult(_0x35b84a,0xc9))[_0x7e8b('0x26')](handleError(_0x35b84a,null));};exports[_0x7e8b('0x63')]=function(_0xc07804,_0x4eee39,_0xd9186){var _0x3d58ca;return db['VoiceContext'][_0x7e8b('0x5f')]({'where':{'id':_0xc07804[_0x7e8b('0x50')]['id']}})[_0x7e8b('0x1b')](handleEntityNotFound(_0x4eee39,null))[_0x7e8b('0x1b')](saveUpdates(_0xc07804[_0x7e8b('0x53')],null))['then'](function(_0x6716ef){if(_0x6716ef){_0x3d58ca=_0x6716ef;return db['VoiceContext'][_0x7e8b('0x54')]({'raw':!![]});}})['then'](function(_0x2464a9){var _0x22e57c=fs[_0x7e8b('0x64')](path[_0x7e8b('0x65')](config[_0x7e8b('0x55')],_0x7e8b('0x56')),'utf8');var _0x130c66=ejs[_0x7e8b('0x58')](_0x22e57c,{'contexts':_0x2464a9||[]});fs[_0x7e8b('0x59')](_0x7e8b('0x5a'),_0x130c66);})[_0x7e8b('0x1b')](function(){return respondWithRpcPromise(_0x7e8b('0x5b'),'update',{'module':_0x7e8b('0x5c')});})[_0x7e8b('0x1b')](function(){return _0x3d58ca;})[_0x7e8b('0x1b')](respondWithResult(_0x4eee39,null))[_0x7e8b('0x26')](handleError(_0x4eee39,null));};exports[_0x7e8b('0x32')]=function(_0x5d4237,_0x310650,_0x1cd8cc){var _0xddf190;return db['VoiceContext'][_0x7e8b('0x5f')]({'where':{'id':_0x5d4237[_0x7e8b('0x50')]['id']}})[_0x7e8b('0x1b')](handleEntityNotFound(_0x310650,null))[_0x7e8b('0x1b')](removeEntity(_0x310650,null))[_0x7e8b('0x1b')](function(){return db[_0x7e8b('0x39')][_0x7e8b('0x54')]({'raw':!![]});})[_0x7e8b('0x1b')](function(_0x113d92){var _0x31334c=fs[_0x7e8b('0x64')](path[_0x7e8b('0x65')](config['root'],_0x7e8b('0x56')),_0x7e8b('0x57'));var _0x3d402d=ejs['render'](_0x31334c,{'contexts':_0x113d92});fs[_0x7e8b('0x59')](_0x7e8b('0x5a'),_0x3d402d);return respondWithRpcPromise(_0x7e8b('0x5b'),_0x7e8b('0x32'),{'module':_0x7e8b('0x5c')});})[_0x7e8b('0x26')](handleError(_0x310650,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 2c6f5fa..21f50d9 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 _0x5b1f=['path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3800e2,_0x527490){var _0x25ca8a=function(_0x1b67d9){while(--_0x1b67d9){_0x3800e2['push'](_0x3800e2['shift']());}};_0x25ca8a(++_0x527490);}(_0x5b1f,0x170));var _0xf5b1=function(_0x303fcf,_0x5162ae){_0x303fcf=_0x303fcf-0x0;var _0xf3d516=_0x5b1f[_0x303fcf];return _0xf3d516;};'use strict';var _=require(_0xf5b1('0x0'));var util=require(_0xf5b1('0x1'));var logger=require(_0xf5b1('0x2'))(_0xf5b1('0x3'));var moment=require(_0xf5b1('0x4'));var BPromise=require(_0xf5b1('0x5'));var rp=require(_0xf5b1('0x6'));var fs=require('fs');var path=require(_0xf5b1('0x7'));var rimraf=require(_0xf5b1('0x8'));var config=require(_0xf5b1('0x9'));var attributes=require(_0xf5b1('0xa'));module[_0xf5b1('0xb')]=function(_0x4a5eaa,_0x31c1e1){return _0x4a5eaa[_0xf5b1('0xc')](_0xf5b1('0xd'),attributes,{'tableName':_0xf5b1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc35f=['exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x1f4820,_0x582ec8){var _0x5bf8aa=function(_0x234cae){while(--_0x234cae){_0x1f4820['push'](_0x1f4820['shift']());}};_0x5bf8aa(++_0x582ec8);}(_0xc35f,0x82));var _0xfc35=function(_0x346b96,_0x1ded20){_0x346b96=_0x346b96-0x0;var _0x437872=_0xc35f[_0x346b96];return _0x437872;};'use strict';var _=require(_0xfc35('0x0'));var util=require(_0xfc35('0x1'));var logger=require(_0xfc35('0x2'))(_0xfc35('0x3'));var moment=require(_0xfc35('0x4'));var BPromise=require(_0xfc35('0x5'));var rp=require(_0xfc35('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc35('0x7'));var config=require(_0xfc35('0x8'));var attributes=require(_0xfc35('0x9'));module[_0xfc35('0xa')]=function(_0x4b4655,_0x1ef67d){return _0x4b4655[_0xfc35('0xb')](_0xfc35('0xc'),attributes,{'tableName':_0xfc35('0xd'),'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 1b0c24e..1039219 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 _0xe0dd=['../../config/utils','../../config/logger','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xe0dd,0x163));var _0xde0d=function(_0x1bc762,_0x523eb3){_0x1bc762=_0x1bc762-0x0;var _0x40f70c=_0xe0dd[_0x1bc762];return _0x40f70c;};'use strict';var _=require(_0xde0d('0x0'));var util=require(_0xde0d('0x1'));var moment=require('moment');var BPromise=require(_0xde0d('0x2'));var rs=require(_0xde0d('0x3'));var fs=require('fs');var Redis=require(_0xde0d('0x4'));var db=require(_0xde0d('0x5'))['db'];var utils=require(_0xde0d('0x6'));var logger=require(_0xde0d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xde0d('0x8'));var client=jayson[_0xde0d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x323200,_0x3ce23c,_0x33a644){return new BPromise(function(_0x570b78,_0x25f0fe){return client['request'](_0x323200,_0x33a644)[_0xde0d('0xa')](function(_0x5e6588){logger[_0xde0d('0xb')](_0xde0d('0xc'),_0x3ce23c,_0xde0d('0xd'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3ce23c,'request\x20sent',JSON[_0xde0d('0xe')](_0x5e6588));if(_0x5e6588[_0xde0d('0xf')]){if(_0x5e6588[_0xde0d('0xf')]['code']===0x1f4){logger[_0xde0d('0xf')](_0xde0d('0xc'),_0x3ce23c,_0x5e6588['error'][_0xde0d('0x10')]);return _0x25f0fe(_0x5e6588[_0xde0d('0xf')][_0xde0d('0x10')]);}logger[_0xde0d('0xf')](_0xde0d('0xc'),_0x3ce23c,_0x5e6588['error'][_0xde0d('0x10')]);return _0x570b78(_0x5e6588['error'][_0xde0d('0x10')]);}else{logger['info'](_0xde0d('0xc'),_0x3ce23c,'request\x20sent');_0x570b78(_0x5e6588[_0xde0d('0x11')][_0xde0d('0x10')]);}})[_0xde0d('0x12')](function(_0x228666){logger[_0xde0d('0xf')](_0xde0d('0xc'),_0x3ce23c,_0x228666);_0x25f0fe(_0x228666);});});} \ No newline at end of file +var _0xca7b=['then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request'];(function(_0x4e5569,_0x3a2400){var _0x318d34=function(_0x3f5907){while(--_0x3f5907){_0x4e5569['push'](_0x4e5569['shift']());}};_0x318d34(++_0x3a2400);}(_0xca7b,0x14e));var _0xbca7=function(_0x3384d3,_0x391d87){_0x3384d3=_0x3384d3-0x0;var _0x54f7b8=_0xca7b[_0x3384d3];return _0x54f7b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbca7('0x0'));var BPromise=require(_0xbca7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbca7('0x2'));var db=require(_0xbca7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbca7('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbca7('0x5'));var client=jayson['client'][_0xbca7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x53e0e6,_0x1dc1a8,_0x140a73){return new BPromise(function(_0x438f99,_0x2ae5d4){return client[_0xbca7('0x7')](_0x53e0e6,_0x140a73)[_0xbca7('0x8')](function(_0x491b64){logger[_0xbca7('0x9')](_0xbca7('0xa'),_0x1dc1a8,_0xbca7('0xb'));logger[_0xbca7('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1dc1a8,_0xbca7('0xb'),JSON[_0xbca7('0xd')](_0x491b64));if(_0x491b64['error']){if(_0x491b64[_0xbca7('0xe')][_0xbca7('0xf')]===0x1f4){logger[_0xbca7('0xe')](_0xbca7('0xa'),_0x1dc1a8,_0x491b64[_0xbca7('0xe')][_0xbca7('0x10')]);return _0x2ae5d4(_0x491b64[_0xbca7('0xe')]['message']);}logger[_0xbca7('0xe')](_0xbca7('0xa'),_0x1dc1a8,_0x491b64['error'][_0xbca7('0x10')]);return _0x438f99(_0x491b64[_0xbca7('0xe')]['message']);}else{logger[_0xbca7('0x9')]('VoiceContext,\x20%s,\x20%s',_0x1dc1a8,_0xbca7('0xb'));_0x438f99(_0x491b64[_0xbca7('0x11')]['message']);}})[_0xbca7('0x12')](function(_0x40d273){logger[_0xbca7('0xe')](_0xbca7('0xa'),_0x1dc1a8,_0x40d273);_0x2ae5d4(_0x40d273);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index eef3cac..d3cf3f4 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 _0x46de=['destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x46de,0x1c3));var _0xe46d=function(_0x2ecc65,_0xd75c48){_0x2ecc65=_0x2ecc65-0x0;var _0x103cc3=_0x46de[_0x2ecc65];return _0x103cc3;};'use strict';var multer=require(_0xe46d('0x0'));var util=require(_0xe46d('0x1'));var path=require(_0xe46d('0x2'));var timeout=require(_0xe46d('0x3'));var express=require('express');var router=express[_0xe46d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe46d('0x5'));var config=require(_0xe46d('0x6'));var controller=require(_0xe46d('0x7'));router[_0xe46d('0x8')]('/',auth[_0xe46d('0x9')](),controller['index']);router['get']('/describe',auth[_0xe46d('0x9')](),controller['describe']);router[_0xe46d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe46d('0xa')]);router[_0xe46d('0xb')]('/',auth['isAuthenticated'](),controller[_0xe46d('0xc')]);router[_0xe46d('0xd')](_0xe46d('0xe'),auth['isAuthenticated'](),controller[_0xe46d('0xf')]);router[_0xe46d('0x10')]('/:id',auth[_0xe46d('0x9')](),controller[_0xe46d('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6cd2=['put','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','/:id','show','post','create'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x6cd2,0x147));var _0x26cd=function(_0x28d963,_0x174841){_0x28d963=_0x28d963-0x0;var _0x463242=_0x6cd2[_0x28d963];return _0x463242;};'use strict';var multer=require(_0x26cd('0x0'));var util=require(_0x26cd('0x1'));var path=require(_0x26cd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x26cd('0x3')]();var fs_extra=require(_0x26cd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x26cd('0x5'));var config=require(_0x26cd('0x6'));var controller=require(_0x26cd('0x7'));router[_0x26cd('0x8')]('/',auth[_0x26cd('0x9')](),controller['index']);router[_0x26cd('0x8')](_0x26cd('0xa'),auth[_0x26cd('0x9')](),controller['describe']);router[_0x26cd('0x8')](_0x26cd('0xb'),auth[_0x26cd('0x9')](),controller[_0x26cd('0xc')]);router[_0x26cd('0xd')]('/',auth[_0x26cd('0x9')](),controller[_0x26cd('0xe')]);router[_0x26cd('0xf')](_0x26cd('0xb'),auth[_0x26cd('0x9')](),controller[_0x26cd('0x10')]);router['delete'](_0x26cd('0xb'),auth[_0x26cd('0x9')](),controller[_0x26cd('0x11')]);module[_0x26cd('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 03b9702..863c24f 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 _0x8d0e=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x277eb4,_0x3076f9){var _0x41dfb7=function(_0x426f2f){while(--_0x426f2f){_0x277eb4['push'](_0x277eb4['shift']());}};_0x41dfb7(++_0x3076f9);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x33d9b9,_0x5f1969){_0x33d9b9=_0x33d9b9-0x0;var _0x466ae1=_0x8d0e[_0x33d9b9];return _0x466ae1;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'privilege':{'type':Sequelize[_0xe8d0('0x2')]},'channel':{'type':Sequelize[_0xe8d0('0x2')]},'channelstate':{'type':Sequelize[_0xe8d0('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'calleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x3')]},'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'linkedid':{'type':Sequelize[_0xe8d0('0x2')]},'destchannel':{'type':Sequelize[_0xe8d0('0x2')]},'destchannelstate':{'type':Sequelize[_0xe8d0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe8d0('0x2')]},'destlanguage':{'type':Sequelize[_0xe8d0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe8d0('0x2')]},'destpriority':{'type':Sequelize[_0xe8d0('0x3')]},'destuniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'destlinkedid':{'type':Sequelize[_0xe8d0('0x2')]},'dialstring':{'type':Sequelize[_0xe8d0('0x2')]},'dialstatus':{'type':Sequelize[_0xe8d0('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe8d0('0x4')]},'endtime':{'type':Sequelize[_0xe8d0('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xe8d0('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xe8d0('0x3')]},'billableseconds':{'type':Sequelize[_0xe8d0('0x3')]}}; \ No newline at end of file +var _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0x2994c9,_0x930e79){var _0x4f318c=function(_0xfb5e7a){while(--_0xfb5e7a){_0x2994c9['push'](_0x2994c9['shift']());}};_0x4f318c(++_0x930e79);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x4b84[_0x3cb6dc];return _0x47ec89;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x44b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinename':{'type':Sequelize[_0x44b8('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x44b8('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x44b8('0x3')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x44b8('0x3')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x44b8('0x3')]},'destcalleridname':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x44b8('0x3')]},'destaccountcode':{'type':Sequelize[_0x44b8('0x3')]},'destcontext':{'type':Sequelize[_0x44b8('0x3')]},'destexten':{'type':Sequelize[_0x44b8('0x3')]},'destpriority':{'type':Sequelize[_0x44b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x44b8('0x3')]},'destlinkedid':{'type':Sequelize[_0x44b8('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x44b8('0x3')]},'starttime':{'type':Sequelize[_0x44b8('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x44b8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x44b8('0x5')},'routeId':{'type':Sequelize[_0x44b8('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x44b8('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index adae184..38636e3 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 _0xf85b=['mustache','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','keys','filters','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','VoiceDialReport','findAll','rows','catch','show','params','intersection','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x342136,_0x55dab7){var _0x194c7f=function(_0x5e0924){while(--_0x5e0924){_0x342136['push'](_0x342136['shift']());}};_0x194c7f(++_0x55dab7);}(_0xf85b,0xd1));var _0xbf85=function(_0x19e838,_0x1f961d){_0x19e838=_0x19e838-0x0;var _0x343f29=_0xf85b[_0x19e838];return _0x343f29;};'use strict';var emlformat=require(_0xbf85('0x0'));var rimraf=require(_0xbf85('0x1'));var zipdir=require(_0xbf85('0x2'));var jsonpatch=require(_0xbf85('0x3'));var rp=require(_0xbf85('0x4'));var moment=require(_0xbf85('0x5'));var BPromise=require(_0xbf85('0x6'));var Mustache=require(_0xbf85('0x7'));var util=require('util');var path=require(_0xbf85('0x8'));var sox=require('sox');var csv=require(_0xbf85('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf85('0xa'));var squel=require('squel');var crypto=require(_0xbf85('0xb'));var jsforce=require(_0xbf85('0xc'));var deskjs=require(_0xbf85('0xd'));var toCsv=require(_0xbf85('0x9'));var querystring=require(_0xbf85('0xe'));var Papa=require(_0xbf85('0xf'));var Redis=require('ioredis');var authService=require(_0xbf85('0x10'));var qs=require(_0xbf85('0x11'));var as=require(_0xbf85('0x12'));var hardwareService=require(_0xbf85('0x13'));var logger=require(_0xbf85('0x14'))('api');var utils=require(_0xbf85('0x15'));var config=require(_0xbf85('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3dd9,_0xe4ad01){_0xe4ad01=_0xe4ad01||0xcc;return function(_0x448a9b){if(_0x448a9b){return _0x2b3dd9[_0xbf85('0x17')](_0xe4ad01);}return _0x2b3dd9[_0xbf85('0x18')](_0xe4ad01)[_0xbf85('0x19')]();};}function respondWithResult(_0x3faa7b,_0x108eab){_0x108eab=_0x108eab||0xc8;return function(_0x353ca4){if(_0x353ca4){return _0x3faa7b[_0xbf85('0x18')](_0x108eab)[_0xbf85('0x1a')](_0x353ca4);}};}function respondWithFilteredResult(_0x2c142e,_0x2b263b){return function(_0x3d0fd6){if(_0x3d0fd6){var _0x247179=typeof _0x2b263b[_0xbf85('0x1b')]===_0xbf85('0x1c')&&typeof _0x2b263b[_0xbf85('0x1d')]===_0xbf85('0x1c');var _0x29608a=_0x3d0fd6[_0xbf85('0x1e')];var _0x5cd00d=_0x247179?0x0:_0x2b263b[_0xbf85('0x1b')];var _0x1fe572=_0x247179?_0x3d0fd6[_0xbf85('0x1e')]:_0x2b263b[_0xbf85('0x1b')]+_0x2b263b[_0xbf85('0x1d')];var _0x5e7eef;if(_0x1fe572>=_0x29608a){_0x1fe572=_0x29608a;_0x5e7eef=0xc8;}else{_0x5e7eef=0xce;}_0x2c142e[_0xbf85('0x18')](_0x5e7eef);return _0x2c142e['set'](_0xbf85('0x1f'),_0x5cd00d+'-'+_0x1fe572+'/'+_0x29608a)[_0xbf85('0x1a')](_0x3d0fd6);}return null;};}function patchUpdates(_0x440319){return function(_0x2204cb){try{jsonpatch['apply'](_0x2204cb,_0x440319,!![]);}catch(_0x4f8c90){return BPromise[_0xbf85('0x20')](_0x4f8c90);}return _0x2204cb[_0xbf85('0x21')]();};}function saveUpdates(_0x261c05,_0x3ccbec){return function(_0x1782ad){if(_0x1782ad){return _0x1782ad[_0xbf85('0x22')](_0x261c05)['then'](function(_0xee8851){return _0xee8851;});}return null;};}function removeEntity(_0x4db421,_0x527995){return function(_0x8ced51){if(_0x8ced51){return _0x8ced51[_0xbf85('0x23')]()[_0xbf85('0x24')](function(){_0x4db421['status'](0xcc)[_0xbf85('0x19')]();});}};}function handleEntityNotFound(_0x269afe,_0x56265d){return function(_0x2be921){if(!_0x2be921){_0x269afe['sendStatus'](0x194);}return _0x2be921;};}function handleError(_0x645c07,_0x53779c){_0x53779c=_0x53779c||0x1f4;return function(_0xe760d0){logger[_0xbf85('0x25')](_0xe760d0[_0xbf85('0x26')]);if(_0xe760d0[_0xbf85('0x27')]){delete _0xe760d0[_0xbf85('0x27')];}_0x645c07[_0xbf85('0x18')](_0x53779c)['send'](_0xe760d0);};}exports[_0xbf85('0x28')]=function(_0x9367b,_0x41ece4){var _0x1737ed={},_0xfff0d2={},_0x55bef9={'count':0x0,'rows':[]};var _0x3a1d89=_[_0xbf85('0x29')](db['VoiceDialReport'][_0xbf85('0x2a')],function(_0x7dc7d2){return{'name':_0x7dc7d2[_0xbf85('0x2b')],'type':_0x7dc7d2[_0xbf85('0x2c')]['key']};});_0xfff0d2[_0xbf85('0x2d')]=_[_0xbf85('0x29')](_0x3a1d89,_0xbf85('0x27'));_0xfff0d2['query']=_[_0xbf85('0x2e')](_0x9367b['query']);_0xfff0d2[_0xbf85('0x2f')]=_['intersection'](_0xfff0d2[_0xbf85('0x2d')],_0xfff0d2[_0xbf85('0x30')]);_0x1737ed[_0xbf85('0x31')]=_['intersection'](_0xfff0d2[_0xbf85('0x2d')],qs[_0xbf85('0x32')](_0x9367b['query'][_0xbf85('0x32')]));_0x1737ed[_0xbf85('0x31')]=_0x1737ed[_0xbf85('0x31')][_0xbf85('0x33')]?_0x1737ed['attributes']:_0xfff0d2[_0xbf85('0x2d')];if(!_0x9367b['query'][_0xbf85('0x34')](_0xbf85('0x35'))){_0x1737ed[_0xbf85('0x1d')]=qs[_0xbf85('0x1d')](_0x9367b[_0xbf85('0x30')][_0xbf85('0x1d')]);_0x1737ed[_0xbf85('0x1b')]=qs[_0xbf85('0x1b')](_0x9367b[_0xbf85('0x30')]['offset']);}_0x1737ed['order']=qs[_0xbf85('0x36')](_0x9367b['query'][_0xbf85('0x36')]);_0x1737ed[_0xbf85('0x37')]=qs['filters'](_[_0xbf85('0x38')](_0x9367b[_0xbf85('0x30')],_0xfff0d2[_0xbf85('0x2f')]),_0x3a1d89);if(_0x9367b[_0xbf85('0x30')][_0xbf85('0x39')]){_0x1737ed['where']=_[_0xbf85('0x3a')](_0x1737ed['where'],{'$or':_[_0xbf85('0x29')](_0x3a1d89,function(_0x3846db){if(_0x3846db[_0xbf85('0x2c')]!==_0xbf85('0x3b')){var _0x5a402e={};_0x5a402e[_0x3846db[_0xbf85('0x27')]]={'$like':'%'+_0x9367b[_0xbf85('0x30')][_0xbf85('0x39')]+'%'};return _0x5a402e;}})});}_0x1737ed=_[_0xbf85('0x3a')]({},_0x1737ed,_0x9367b[_0xbf85('0x3c')]);var _0x1b33a0={'where':_0x1737ed[_0xbf85('0x37')]};return db['VoiceDialReport'][_0xbf85('0x1e')](_0x1b33a0)[_0xbf85('0x24')](function(_0x38ab5d){_0x55bef9[_0xbf85('0x1e')]=_0x38ab5d;if(_0x9367b[_0xbf85('0x30')][_0xbf85('0x3d')]){_0x1737ed['include']=[{'all':!![]}];}return db[_0xbf85('0x3e')][_0xbf85('0x3f')](_0x1737ed);})[_0xbf85('0x24')](function(_0x28b45f){_0x55bef9[_0xbf85('0x40')]=_0x28b45f;return _0x55bef9;})[_0xbf85('0x24')](respondWithFilteredResult(_0x41ece4,_0x1737ed))[_0xbf85('0x41')](handleError(_0x41ece4,null));};exports[_0xbf85('0x42')]=function(_0x31890e,_0x5a461d){var _0x229c63={'raw':!![],'where':{'id':_0x31890e[_0xbf85('0x43')]['id']}},_0x11b4e5={};_0x11b4e5[_0xbf85('0x2d')]=_[_0xbf85('0x2e')](db[_0xbf85('0x3e')]['rawAttributes']);_0x11b4e5[_0xbf85('0x30')]=_[_0xbf85('0x2e')](_0x31890e[_0xbf85('0x30')]);_0x11b4e5[_0xbf85('0x2f')]=_[_0xbf85('0x44')](_0x11b4e5[_0xbf85('0x2d')],_0x11b4e5[_0xbf85('0x30')]);_0x229c63[_0xbf85('0x31')]=_[_0xbf85('0x44')](_0x11b4e5[_0xbf85('0x2d')],qs[_0xbf85('0x32')](_0x31890e['query'][_0xbf85('0x32')]));_0x229c63[_0xbf85('0x31')]=_0x229c63['attributes'][_0xbf85('0x33')]?_0x229c63[_0xbf85('0x31')]:_0x11b4e5[_0xbf85('0x2d')];if(_0x31890e['query'][_0xbf85('0x3d')]){_0x229c63['include']=[{'all':!![]}];}_0x229c63=_[_0xbf85('0x3a')]({},_0x229c63,_0x31890e['options']);return db[_0xbf85('0x3e')][_0xbf85('0x45')](_0x229c63)['then'](handleEntityNotFound(_0x5a461d,null))[_0xbf85('0x24')](respondWithResult(_0x5a461d,null))[_0xbf85('0x41')](handleError(_0x5a461d,null));};exports['create']=function(_0x28f7b1,_0x516ed9){return db[_0xbf85('0x3e')]['create'](_0x28f7b1[_0xbf85('0x46')],{})[_0xbf85('0x24')](respondWithResult(_0x516ed9,0xc9))[_0xbf85('0x41')](handleError(_0x516ed9,null));};exports[_0xbf85('0x22')]=function(_0x58390a,_0x50abb5){if(_0x58390a[_0xbf85('0x46')]['id']){delete _0x58390a[_0xbf85('0x46')]['id'];}return db[_0xbf85('0x3e')][_0xbf85('0x45')]({'where':{'id':_0x58390a[_0xbf85('0x43')]['id']}})[_0xbf85('0x24')](handleEntityNotFound(_0x50abb5,null))['then'](saveUpdates(_0x58390a[_0xbf85('0x46')],null))[_0xbf85('0x24')](respondWithResult(_0x50abb5,null))[_0xbf85('0x41')](handleError(_0x50abb5,null));};exports[_0xbf85('0x23')]=function(_0x4461e1,_0x38218a){return db[_0xbf85('0x3e')][_0xbf85('0x45')]({'where':{'id':_0x4461e1[_0xbf85('0x43')]['id']}})[_0xbf85('0x24')](handleEntityNotFound(_0x38218a,null))['then'](removeEntity(_0x38218a,null))[_0xbf85('0x41')](handleError(_0x38218a,null));};exports['describe']=function(_0x3a9f40,_0x42e0d1){return db[_0xbf85('0x3e')][_0xbf85('0x47')]()[_0xbf85('0x24')](respondWithResult(_0x42e0d1,null))[_0xbf85('0x41')](handleError(_0x42e0d1,null));}; \ No newline at end of file +var _0x3eee=['fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','VoiceDialReport','rawAttributes'];(function(_0x28048c,_0x282e8d){var _0x12eca6=function(_0x4484dc){while(--_0x4484dc){_0x28048c['push'](_0x28048c['shift']());}};_0x12eca6(++_0x282e8d);}(_0x3eee,0x6a));var _0xe3ee=function(_0x39abe3,_0x2db148){_0x39abe3=_0x39abe3-0x0;var _0xeba672=_0x3eee[_0x39abe3];return _0xeba672;};'use strict';var emlformat=require(_0xe3ee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe3ee('0x1'));var rp=require(_0xe3ee('0x2'));var moment=require(_0xe3ee('0x3'));var BPromise=require(_0xe3ee('0x4'));var Mustache=require('mustache');var util=require(_0xe3ee('0x5'));var path=require(_0xe3ee('0x6'));var sox=require(_0xe3ee('0x7'));var csv=require(_0xe3ee('0x8'));var ejs=require(_0xe3ee('0x9'));var fs=require('fs');var fs_extra=require(_0xe3ee('0xa'));var _=require(_0xe3ee('0xb'));var squel=require('squel');var crypto=require(_0xe3ee('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe3ee('0xd'));var toCsv=require(_0xe3ee('0x8'));var querystring=require(_0xe3ee('0xe'));var Papa=require(_0xe3ee('0xf'));var Redis=require(_0xe3ee('0x10'));var authService=require(_0xe3ee('0x11'));var qs=require(_0xe3ee('0x12'));var as=require(_0xe3ee('0x13'));var hardwareService=require(_0xe3ee('0x14'));var logger=require(_0xe3ee('0x15'))(_0xe3ee('0x16'));var utils=require(_0xe3ee('0x17'));var config=require(_0xe3ee('0x18'));var licenseUtil=require(_0xe3ee('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bde8d,_0x33c02b){_0x33c02b=_0x33c02b||0xcc;return function(_0x151018){if(_0x151018){return _0x5bde8d['sendStatus'](_0x33c02b);}return _0x5bde8d[_0xe3ee('0x1a')](_0x33c02b)[_0xe3ee('0x1b')]();};}function respondWithResult(_0x1ab707,_0xa29a62){_0xa29a62=_0xa29a62||0xc8;return function(_0x59de87){if(_0x59de87){return _0x1ab707[_0xe3ee('0x1a')](_0xa29a62)[_0xe3ee('0x1c')](_0x59de87);}};}function respondWithFilteredResult(_0x4241b7,_0x5a485a){return function(_0xc308f){if(_0xc308f){var _0x291003=typeof _0x5a485a[_0xe3ee('0x1d')]==='undefined'&&typeof _0x5a485a[_0xe3ee('0x1e')]==='undefined';var _0x26305b=_0xc308f[_0xe3ee('0x1f')];var _0x195706=_0x291003?0x0:_0x5a485a[_0xe3ee('0x1d')];var _0x301735=_0x291003?_0xc308f['count']:_0x5a485a[_0xe3ee('0x1d')]+_0x5a485a[_0xe3ee('0x1e')];var _0x53c500;if(_0x301735>=_0x26305b){_0x301735=_0x26305b;_0x53c500=0xc8;}else{_0x53c500=0xce;}_0x4241b7['status'](_0x53c500);return _0x4241b7[_0xe3ee('0x20')](_0xe3ee('0x21'),_0x195706+'-'+_0x301735+'/'+_0x26305b)[_0xe3ee('0x1c')](_0xc308f);}return null;};}function patchUpdates(_0x146ff1){return function(_0xa13516){try{jsonpatch[_0xe3ee('0x22')](_0xa13516,_0x146ff1,!![]);}catch(_0x458b73){return BPromise[_0xe3ee('0x23')](_0x458b73);}return _0xa13516[_0xe3ee('0x24')]();};}function saveUpdates(_0x43ef60,_0x577fe2){return function(_0x57d0f9){if(_0x57d0f9){return _0x57d0f9[_0xe3ee('0x25')](_0x43ef60)['then'](function(_0x11a1a8){return _0x11a1a8;});}return null;};}function removeEntity(_0x395d84,_0x563a53){return function(_0x5d2bfd){if(_0x5d2bfd){return _0x5d2bfd['destroy']()[_0xe3ee('0x26')](function(){_0x395d84[_0xe3ee('0x1a')](0xcc)[_0xe3ee('0x1b')]();});}};}function handleEntityNotFound(_0xf7511e,_0x219d83){return function(_0x2b3278){if(!_0x2b3278){_0xf7511e['sendStatus'](0x194);}return _0x2b3278;};}function handleError(_0xf7457f,_0x4fc2e9){_0x4fc2e9=_0x4fc2e9||0x1f4;return function(_0x1eb10b){logger[_0xe3ee('0x27')](_0x1eb10b[_0xe3ee('0x28')]);if(_0x1eb10b[_0xe3ee('0x29')]){delete _0x1eb10b['name'];}_0xf7457f['status'](_0x4fc2e9)[_0xe3ee('0x2a')](_0x1eb10b);};}exports['index']=function(_0x3c3749,_0x585390){var _0x174d04={},_0x187121={},_0x3e8cb2={'count':0x0,'rows':[]};var _0x4a1fea=_[_0xe3ee('0x2b')](db[_0xe3ee('0x2c')][_0xe3ee('0x2d')],function(_0x58747e){return{'name':_0x58747e[_0xe3ee('0x2e')],'type':_0x58747e[_0xe3ee('0x2f')][_0xe3ee('0x30')]};});_0x187121['model']=_['map'](_0x4a1fea,_0xe3ee('0x29'));_0x187121[_0xe3ee('0x31')]=_['keys'](_0x3c3749[_0xe3ee('0x31')]);_0x187121[_0xe3ee('0x32')]=_[_0xe3ee('0x33')](_0x187121[_0xe3ee('0x34')],_0x187121[_0xe3ee('0x31')]);_0x174d04[_0xe3ee('0x35')]=_[_0xe3ee('0x33')](_0x187121[_0xe3ee('0x34')],qs[_0xe3ee('0x36')](_0x3c3749[_0xe3ee('0x31')][_0xe3ee('0x36')]));_0x174d04[_0xe3ee('0x35')]=_0x174d04[_0xe3ee('0x35')][_0xe3ee('0x37')]?_0x174d04[_0xe3ee('0x35')]:_0x187121[_0xe3ee('0x34')];if(!_0x3c3749['query']['hasOwnProperty'](_0xe3ee('0x38'))){_0x174d04[_0xe3ee('0x1e')]=qs[_0xe3ee('0x1e')](_0x3c3749[_0xe3ee('0x31')]['limit']);_0x174d04[_0xe3ee('0x1d')]=qs[_0xe3ee('0x1d')](_0x3c3749[_0xe3ee('0x31')][_0xe3ee('0x1d')]);}_0x174d04['order']=qs[_0xe3ee('0x39')](_0x3c3749[_0xe3ee('0x31')][_0xe3ee('0x39')]);_0x174d04[_0xe3ee('0x3a')]=qs[_0xe3ee('0x32')](_[_0xe3ee('0x3b')](_0x3c3749['query'],_0x187121[_0xe3ee('0x32')]),_0x4a1fea);if(_0x3c3749[_0xe3ee('0x31')][_0xe3ee('0x3c')]){_0x174d04[_0xe3ee('0x3a')]=_[_0xe3ee('0x3d')](_0x174d04[_0xe3ee('0x3a')],{'$or':_['map'](_0x4a1fea,function(_0x42e69a){if(_0x42e69a['type']!==_0xe3ee('0x3e')){var _0x568458={};_0x568458[_0x42e69a[_0xe3ee('0x29')]]={'$like':'%'+_0x3c3749[_0xe3ee('0x31')][_0xe3ee('0x3c')]+'%'};return _0x568458;}})});}_0x174d04=_[_0xe3ee('0x3d')]({},_0x174d04,_0x3c3749[_0xe3ee('0x3f')]);var _0x5d3872={'where':_0x174d04[_0xe3ee('0x3a')]};return db[_0xe3ee('0x2c')][_0xe3ee('0x1f')](_0x5d3872)['then'](function(_0xd01633){_0x3e8cb2['count']=_0xd01633;if(_0x3c3749[_0xe3ee('0x31')][_0xe3ee('0x40')]){_0x174d04[_0xe3ee('0x41')]=[{'all':!![]}];}return db[_0xe3ee('0x2c')][_0xe3ee('0x42')](_0x174d04);})['then'](function(_0x5c24c5){_0x3e8cb2['rows']=_0x5c24c5;return _0x3e8cb2;})['then'](respondWithFilteredResult(_0x585390,_0x174d04))[_0xe3ee('0x43')](handleError(_0x585390,null));};exports[_0xe3ee('0x44')]=function(_0x164cc5,_0x11b768){var _0x5f5460={'raw':!![],'where':{'id':_0x164cc5[_0xe3ee('0x45')]['id']}},_0x5a7ad7={};_0x5a7ad7[_0xe3ee('0x34')]=_[_0xe3ee('0x46')](db['VoiceDialReport'][_0xe3ee('0x2d')]);_0x5a7ad7['query']=_[_0xe3ee('0x46')](_0x164cc5[_0xe3ee('0x31')]);_0x5a7ad7[_0xe3ee('0x32')]=_['intersection'](_0x5a7ad7['model'],_0x5a7ad7[_0xe3ee('0x31')]);_0x5f5460[_0xe3ee('0x35')]=_['intersection'](_0x5a7ad7[_0xe3ee('0x34')],qs[_0xe3ee('0x36')](_0x164cc5[_0xe3ee('0x31')][_0xe3ee('0x36')]));_0x5f5460['attributes']=_0x5f5460['attributes'][_0xe3ee('0x37')]?_0x5f5460[_0xe3ee('0x35')]:_0x5a7ad7[_0xe3ee('0x34')];if(_0x164cc5[_0xe3ee('0x31')][_0xe3ee('0x40')]){_0x5f5460[_0xe3ee('0x41')]=[{'all':!![]}];}_0x5f5460=_[_0xe3ee('0x3d')]({},_0x5f5460,_0x164cc5[_0xe3ee('0x3f')]);return db[_0xe3ee('0x2c')]['find'](_0x5f5460)[_0xe3ee('0x26')](handleEntityNotFound(_0x11b768,null))[_0xe3ee('0x26')](respondWithResult(_0x11b768,null))[_0xe3ee('0x43')](handleError(_0x11b768,null));};exports['create']=function(_0x1c49f6,_0x525fb9){return db[_0xe3ee('0x2c')][_0xe3ee('0x47')](_0x1c49f6[_0xe3ee('0x48')],{})[_0xe3ee('0x26')](respondWithResult(_0x525fb9,0xc9))[_0xe3ee('0x43')](handleError(_0x525fb9,null));};exports[_0xe3ee('0x25')]=function(_0x5e4262,_0x48f47f){if(_0x5e4262[_0xe3ee('0x48')]['id']){delete _0x5e4262[_0xe3ee('0x48')]['id'];}return db['VoiceDialReport'][_0xe3ee('0x49')]({'where':{'id':_0x5e4262['params']['id']}})[_0xe3ee('0x26')](handleEntityNotFound(_0x48f47f,null))[_0xe3ee('0x26')](saveUpdates(_0x5e4262[_0xe3ee('0x48')],null))[_0xe3ee('0x26')](respondWithResult(_0x48f47f,null))[_0xe3ee('0x43')](handleError(_0x48f47f,null));};exports[_0xe3ee('0x4a')]=function(_0x3bb33b,_0x979f41){return db['VoiceDialReport']['find']({'where':{'id':_0x3bb33b[_0xe3ee('0x45')]['id']}})[_0xe3ee('0x26')](handleEntityNotFound(_0x979f41,null))[_0xe3ee('0x26')](removeEntity(_0x979f41,null))[_0xe3ee('0x43')](handleError(_0x979f41,null));};exports['describe']=function(_0x29580c,_0x2ffe64){return db[_0xe3ee('0x2c')][_0xe3ee('0x4b')]()['then'](respondWithResult(_0x2ffe64,null))[_0xe3ee('0x43')](handleError(_0x2ffe64,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index b7564da..1fb27d3 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 _0x94cf=['VoiceDialReport','report_dial','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x2b80c3,_0x37315f){var _0xd975c8=function(_0xba5ec6){while(--_0xba5ec6){_0x2b80c3['push'](_0x2b80c3['shift']());}};_0xd975c8(++_0x37315f);}(_0x94cf,0xc2));var _0xf94c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94cf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf94c('0x0'));var logger=require(_0xf94c('0x1'))(_0xf94c('0x2'));var moment=require('moment');var BPromise=require(_0xf94c('0x3'));var rp=require(_0xf94c('0x4'));var fs=require('fs');var path=require(_0xf94c('0x5'));var rimraf=require(_0xf94c('0x6'));var config=require(_0xf94c('0x7'));var attributes=require(_0xf94c('0x8'));module[_0xf94c('0x9')]=function(_0x1c0879,_0x139ac3){return _0x1c0879['define'](_0xf94c('0xa'),attributes,{'tableName':_0xf94c('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x21e9=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util','moment','bluebird','request-promise'];(function(_0xf93076,_0x1acb30){var _0x33d1da=function(_0x29e6bf){while(--_0x29e6bf){_0xf93076['push'](_0xf93076['shift']());}};_0x33d1da(++_0x1acb30);}(_0x21e9,0x164));var _0x921e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x21e9[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x921e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x921e('0x1'));var BPromise=require(_0x921e('0x2'));var rp=require(_0x921e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x921e('0x4'));var config=require(_0x921e('0x5'));var attributes=require(_0x921e('0x6'));module[_0x921e('0x7')]=function(_0x2b56a6,_0x364155){return _0x2b56a6[_0x921e('0x8')](_0x921e('0x9'),attributes,{'tableName':_0x921e('0xa'),'paranoid':![],'indexes':[{'fields':[_0x921e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index d3d2fa3..5b007b9 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 _0xca82=['CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','UpdateVoiceDialReport','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch'];(function(_0x3ea3e4,_0xb8d7b5){var _0x508411=function(_0x8a1f68){while(--_0x8a1f68){_0x3ea3e4['push'](_0x3ea3e4['shift']());}};_0x508411(++_0xb8d7b5);}(_0xca82,0x10b));var _0x2ca8=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0xca82[_0x1e500e];return _0x10dc5e;};'use strict';var _=require(_0x2ca8('0x0'));var util=require(_0x2ca8('0x1'));var moment=require(_0x2ca8('0x2'));var BPromise=require('bluebird');var rs=require(_0x2ca8('0x3'));var fs=require('fs');var Redis=require(_0x2ca8('0x4'));var db=require(_0x2ca8('0x5'))['db'];var utils=require(_0x2ca8('0x6'));var logger=require(_0x2ca8('0x7'))(_0x2ca8('0x8'));var config=require('../../config/environment');var jayson=require(_0x2ca8('0x9'));var client=jayson['client'][_0x2ca8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x275511,_0x5f4ea4,_0x23cb0f){return new BPromise(function(_0x5e0282,_0x19a1fa){return client[_0x2ca8('0xb')](_0x275511,_0x23cb0f)['then'](function(_0x411b2f){logger['info'](_0x2ca8('0xc'),_0x5f4ea4,_0x2ca8('0xd'));logger[_0x2ca8('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x5f4ea4,_0x2ca8('0xd'),JSON[_0x2ca8('0xf')](_0x411b2f));if(_0x411b2f[_0x2ca8('0x10')]){if(_0x411b2f[_0x2ca8('0x10')]['code']===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x5f4ea4,_0x411b2f[_0x2ca8('0x10')][_0x2ca8('0x11')]);return _0x19a1fa(_0x411b2f[_0x2ca8('0x10')][_0x2ca8('0x11')]);}logger['error'](_0x2ca8('0xc'),_0x5f4ea4,_0x411b2f[_0x2ca8('0x10')][_0x2ca8('0x11')]);return _0x5e0282(_0x411b2f[_0x2ca8('0x10')][_0x2ca8('0x11')]);}else{logger[_0x2ca8('0x12')](_0x2ca8('0xc'),_0x5f4ea4,_0x2ca8('0xd'));_0x5e0282(_0x411b2f[_0x2ca8('0x13')][_0x2ca8('0x11')]);}})[_0x2ca8('0x14')](function(_0x2a8028){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x5f4ea4,_0x2a8028);_0x19a1fa(_0x2a8028);});});}exports[_0x2ca8('0x15')]=function(_0x52f2ea){var _0x56de27=this;return new Promise(function(_0x1e7929,_0xd9de1f){return db[_0x2ca8('0x16')][_0x2ca8('0x17')](_0x52f2ea[_0x2ca8('0x18')],{'raw':_0x52f2ea[_0x2ca8('0x19')]?_0x52f2ea['options'][_0x2ca8('0x1a')]===undefined?!![]:![]:!![]})[_0x2ca8('0x1b')](function(_0x5f16a1){logger[_0x2ca8('0x12')]('CreateVoiceDialReport',_0x52f2ea);logger[_0x2ca8('0xe')](_0x2ca8('0x15'),_0x52f2ea,JSON['stringify'](_0x5f16a1));_0x1e7929(_0x5f16a1);})['catch'](function(_0x273aa4){logger[_0x2ca8('0x10')](_0x2ca8('0x15'),_0x273aa4[_0x2ca8('0x11')],_0x52f2ea);_0xd9de1f(_0x56de27[_0x2ca8('0x10')](0x1f4,_0x273aa4[_0x2ca8('0x11')]));});});};exports[_0x2ca8('0x1c')]=function(_0x131860){var _0x31519d=this;return new Promise(function(_0x4e9208,_0x30b42e){return db['VoiceDialReport']['update'](_0x131860[_0x2ca8('0x18')],{'raw':_0x131860[_0x2ca8('0x19')]?_0x131860[_0x2ca8('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x131860['options']?_0x131860['options'][_0x2ca8('0x1d')]||null:null,'attributes':_0x131860['options']?_0x131860[_0x2ca8('0x19')][_0x2ca8('0x1e')]||null:null,'limit':_0x131860['options']?_0x131860['options'][_0x2ca8('0x1f')]||null:null})[_0x2ca8('0x1b')](function(_0x1c263b){logger['info'](_0x2ca8('0x1c'),_0x131860);logger[_0x2ca8('0xe')](_0x2ca8('0x1c'),_0x131860,JSON['stringify'](_0x1c263b));_0x4e9208(_0x1c263b);})[_0x2ca8('0x14')](function(_0x1a2dc7){logger[_0x2ca8('0x10')]('UpdateVoiceDialReport',_0x1a2dc7[_0x2ca8('0x11')],_0x131860);_0x30b42e(_0x31519d[_0x2ca8('0x10')](0x1f4,_0x1a2dc7[_0x2ca8('0x11')]));});});}; \ No newline at end of file +var _0xa384=['limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','info','stringify','UpdateVoiceDialReport','update','attributes'];(function(_0x56fc9b,_0x502081){var _0x26f028=function(_0x5707c5){while(--_0x5707c5){_0x56fc9b['push'](_0x56fc9b['shift']());}};_0x26f028(++_0x502081);}(_0xa384,0xa1));var _0x4a38=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xa384[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0x4a38('0x0'));var util=require(_0x4a38('0x1'));var moment=require('moment');var BPromise=require(_0x4a38('0x2'));var rs=require(_0x4a38('0x3'));var fs=require('fs');var Redis=require(_0x4a38('0x4'));var db=require(_0x4a38('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a38('0x6'))(_0x4a38('0x7'));var config=require(_0x4a38('0x8'));var jayson=require(_0x4a38('0x9'));var client=jayson[_0x4a38('0xa')][_0x4a38('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x334847,_0x455207,_0x17b016){return new BPromise(function(_0x5be3f3,_0x659ffe){return client[_0x4a38('0xc')](_0x334847,_0x17b016)[_0x4a38('0xd')](function(_0x24b2dc){logger['info'](_0x4a38('0xe'),_0x455207,_0x4a38('0xf'));logger[_0x4a38('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x455207,_0x4a38('0xf'),JSON['stringify'](_0x24b2dc));if(_0x24b2dc[_0x4a38('0x11')]){if(_0x24b2dc[_0x4a38('0x11')][_0x4a38('0x12')]===0x1f4){logger[_0x4a38('0x11')](_0x4a38('0xe'),_0x455207,_0x24b2dc[_0x4a38('0x11')]['message']);return _0x659ffe(_0x24b2dc[_0x4a38('0x11')][_0x4a38('0x13')]);}logger[_0x4a38('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x455207,_0x24b2dc[_0x4a38('0x11')][_0x4a38('0x13')]);return _0x5be3f3(_0x24b2dc['error'][_0x4a38('0x13')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x455207,'request\x20sent');_0x5be3f3(_0x24b2dc['result'][_0x4a38('0x13')]);}})[_0x4a38('0x14')](function(_0x1bb4a1){logger[_0x4a38('0x11')](_0x4a38('0xe'),_0x455207,_0x1bb4a1);_0x659ffe(_0x1bb4a1);});});}exports[_0x4a38('0x15')]=function(_0x4ccc6b){var _0x1e0812=this;return new Promise(function(_0x5f147d,_0xd51aef){return db[_0x4a38('0x16')]['create'](_0x4ccc6b[_0x4a38('0x17')],{'raw':_0x4ccc6b[_0x4a38('0x18')]?_0x4ccc6b[_0x4a38('0x18')][_0x4a38('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5d49a4){logger[_0x4a38('0x1a')](_0x4a38('0x15'),_0x4ccc6b);logger[_0x4a38('0x10')](_0x4a38('0x15'),_0x4ccc6b,JSON[_0x4a38('0x1b')](_0x5d49a4));_0x5f147d(_0x5d49a4);})[_0x4a38('0x14')](function(_0x7f3e5){logger[_0x4a38('0x11')](_0x4a38('0x15'),_0x7f3e5['message'],_0x4ccc6b);_0xd51aef(_0x1e0812[_0x4a38('0x11')](0x1f4,_0x7f3e5[_0x4a38('0x13')]));});});};exports[_0x4a38('0x1c')]=function(_0x41bb10){var _0x3931fc=this;return new Promise(function(_0x2352f1,_0x4b7bab){return db[_0x4a38('0x16')][_0x4a38('0x1d')](_0x41bb10[_0x4a38('0x17')],{'raw':_0x41bb10['options']?_0x41bb10[_0x4a38('0x18')][_0x4a38('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41bb10[_0x4a38('0x18')]?_0x41bb10[_0x4a38('0x18')]['where']||null:null,'attributes':_0x41bb10[_0x4a38('0x18')]?_0x41bb10[_0x4a38('0x18')][_0x4a38('0x1e')]||null:null,'limit':_0x41bb10[_0x4a38('0x18')]?_0x41bb10[_0x4a38('0x18')][_0x4a38('0x1f')]||null:null})[_0x4a38('0xd')](function(_0x337436){logger[_0x4a38('0x1a')](_0x4a38('0x1c'),_0x41bb10);logger[_0x4a38('0x10')](_0x4a38('0x1c'),_0x41bb10,JSON['stringify'](_0x337436));_0x2352f1(_0x337436);})['catch'](function(_0x2dd96c){logger[_0x4a38('0x11')](_0x4a38('0x1c'),_0x2dd96c[_0x4a38('0x13')],_0x41bb10);_0x4b7bab(_0x3931fc[_0x4a38('0x11')](0x1f4,_0x2dd96c[_0x4a38('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 52f07a8..11ab8c7 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 _0xbee6=['post','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show'];(function(_0x25cd63,_0x3e4f82){var _0x312099=function(_0x3ce6ef){while(--_0x3ce6ef){_0x25cd63['push'](_0x25cd63['shift']());}};_0x312099(++_0x3e4f82);}(_0xbee6,0xce));var _0x6bee=function(_0x2c7ec5,_0x43e06c){_0x2c7ec5=_0x2c7ec5-0x0;var _0x3c6c0a=_0xbee6[_0x2c7ec5];return _0x3c6c0a;};'use strict';var multer=require(_0x6bee('0x0'));var util=require('util');var path=require(_0x6bee('0x1'));var timeout=require(_0x6bee('0x2'));var express=require(_0x6bee('0x3'));var router=express[_0x6bee('0x4')]();var fs_extra=require(_0x6bee('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6bee('0x6'));var config=require(_0x6bee('0x7'));var controller=require(_0x6bee('0x8'));router[_0x6bee('0x9')]('/',auth[_0x6bee('0xa')](),controller[_0x6bee('0xb')]);router[_0x6bee('0x9')](_0x6bee('0xc'),auth[_0x6bee('0xa')](),controller[_0x6bee('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6bee('0xe')](_0x6bee('0xf'),auth['isAuthenticated'](),controller[_0x6bee('0x10')]);router[_0x6bee('0x11')](_0x6bee('0xc'),auth[_0x6bee('0xa')](),controller[_0x6bee('0x12')]);router[_0x6bee('0x13')](_0x6bee('0xc'),auth[_0x6bee('0xa')](),controller[_0x6bee('0x14')]);module[_0x6bee('0x15')]=router; \ No newline at end of file +var _0x9030=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','update','delete','destroy','exports','multer','util','path'];(function(_0xc2869e,_0x105457){var _0x243be2=function(_0x4876b6){while(--_0x4876b6){_0xc2869e['push'](_0xc2869e['shift']());}};_0x243be2(++_0x105457);}(_0x9030,0x10e));var _0x0903=function(_0x1b27ee,_0x5136ca){_0x1b27ee=_0x1b27ee-0x0;var _0x2e06ea=_0x9030[_0x1b27ee];return _0x2e06ea;};'use strict';var multer=require(_0x0903('0x0'));var util=require(_0x0903('0x1'));var path=require(_0x0903('0x2'));var timeout=require(_0x0903('0x3'));var express=require(_0x0903('0x4'));var router=express[_0x0903('0x5')]();var fs_extra=require(_0x0903('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0903('0x7'));var config=require('../../config/environment');var controller=require(_0x0903('0x8'));router[_0x0903('0x9')]('/',auth[_0x0903('0xa')](),controller[_0x0903('0xb')]);router[_0x0903('0x9')](_0x0903('0xc'),auth[_0x0903('0xa')](),controller[_0x0903('0xd')]);router[_0x0903('0xe')]('/',auth[_0x0903('0xa')](),controller[_0x0903('0xf')]);router[_0x0903('0xe')](_0x0903('0x10'),auth[_0x0903('0xa')](),controller['addApplications']);router['put'](_0x0903('0xc'),auth[_0x0903('0xa')](),controller[_0x0903('0x11')]);router[_0x0903('0x12')](_0x0903('0xc'),auth[_0x0903('0xa')](),controller[_0x0903('0x13')]);module[_0x0903('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 3ebc2c9..6887199 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 _0x652d=['VIRTUAL','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','INTEGER','BOOLEAN','wav'];(function(_0x4fa5e3,_0x2f75dc){var _0x1a2f1e=function(_0x5bcfc0){while(--_0x5bcfc0){_0x4fa5e3['push'](_0x4fa5e3['shift']());}};_0x1a2f1e(++_0x2f75dc);}(_0x652d,0x141));var _0xd652=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x652d[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xd652('0x0'));module[_0xd652('0x1')]={'context':{'type':Sequelize[_0xd652('0x2')],'allowNull':![],'unique':_0xd652('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd652('0x2')],'allowNull':![],'unique':_0xd652('0x3')},'priority':{'type':Sequelize[_0xd652('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xd652('0x3')},'tag':{'type':Sequelize[_0xd652('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd652('0x4')},'appdata':{'type':Sequelize[_0xd652('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd652('0x5')](_0xd652('0x6'),_0xd652('0x7'),_0xd652('0x8'),_0xd652('0x9'),_0xd652('0xa'),_0xd652('0xb'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd652('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xd652('0xc')]},'isApp':{'type':Sequelize[_0xd652('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd652('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd652('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xd652('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xd652('0x2')],'defaultValue':_0xd652('0xe')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xd652('0xf')],'get':function(_0x44875a){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0xd652('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xf4b4=['NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4b4,0x19a));var _0x4f4b=function(_0x5b1370,_0x5beac4){_0x5b1370=_0x5b1370-0x0;var _0xf5075d=_0xf4b4[_0x5b1370];return _0xf5075d;};'use strict';var Sequelize=require(_0x4f4b('0x0'));module[_0x4f4b('0x1')]={'context':{'type':Sequelize[_0x4f4b('0x2')],'allowNull':![],'unique':_0x4f4b('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4f4b('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x4f4b('0x3')},'tag':{'type':Sequelize[_0x4f4b('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4f4b('0x2')],'allowNull':![],'defaultValue':_0x4f4b('0x4')},'appdata':{'type':Sequelize[_0x4f4b('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4f4b('0x5')](_0x4f4b('0x6'),_0x4f4b('0x7'),_0x4f4b('0x8'),_0x4f4b('0x9'),_0x4f4b('0xa'),'system',_0x4f4b('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x4f4b('0x2')]},'interval':{'type':Sequelize[_0x4f4b('0x2')],'allowNull':![],'defaultValue':_0x4f4b('0xc')},'IntervalId':{'type':Sequelize[_0x4f4b('0xd')]},'isApp':{'type':Sequelize[_0x4f4b('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4f4b('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x4f4b('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x4f4b('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4f4b('0xd')]},'recordingFormat':{'type':Sequelize[_0x4f4b('0x2')],'defaultValue':_0x4f4b('0xf')},'answer':{'type':Sequelize[_0x4f4b('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4f4b('0x10')],'get':function(_0x13e8b2){return this['getDataValue'](_0x4f4b('0x11'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 03c3337..edc5243 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 _0x8bfc=['addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','send','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./voiceExtension.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','then','get','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','name','UserProfileResource','error','stack','VoiceExtension','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','alias'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x8bfc,0x71));var _0xc8bf=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x8bfc[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0xc8bf('0x0'));var Redis=require('ioredis');var qs=require(_0xc8bf('0x1'));var logger=require(_0xc8bf('0x2'))(_0xc8bf('0x3'));var config=require(_0xc8bf('0x4'));var db=require(_0xc8bf('0x5'))['db'];config[_0xc8bf('0x6')]=_[_0xc8bf('0x7')](config[_0xc8bf('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc8bf('0x8'))['register'](socket);function respondWithStatusCode(_0x4dfd60,_0x40623f){_0x40623f=_0x40623f||0xcc;return function(_0x3f3fe3){if(_0x3f3fe3){return _0x4dfd60[_0xc8bf('0x9')](_0x40623f);}return _0x4dfd60[_0xc8bf('0xa')](_0x40623f)[_0xc8bf('0xb')]();};}function respondWithResult(_0x4cc4b6,_0x325865){_0x325865=_0x325865||0xc8;return function(_0x281ed7){if(_0x281ed7){return _0x4cc4b6['status'](_0x325865)[_0xc8bf('0xc')](_0x281ed7);}};}function respondWithFilteredResult(_0x2701f4,_0x22ae65){return function(_0x2d1b6f){if(_0x2d1b6f){var _0x237098=typeof _0x22ae65[_0xc8bf('0xd')]==='undefined'&&typeof _0x22ae65[_0xc8bf('0xe')]===_0xc8bf('0xf');var _0x46d77e=_0x2d1b6f[_0xc8bf('0x10')];var _0x4f6d35=_0x237098?0x0:_0x22ae65[_0xc8bf('0xd')];var _0xefc11e=_0x237098?_0x2d1b6f[_0xc8bf('0x10')]:_0x22ae65[_0xc8bf('0xd')]+_0x22ae65[_0xc8bf('0xe')];var _0x25f3bb;if(_0xefc11e>=_0x46d77e){_0xefc11e=_0x46d77e;_0x25f3bb=0xc8;}else{_0x25f3bb=0xce;}_0x2701f4[_0xc8bf('0xa')](_0x25f3bb);return _0x2701f4[_0xc8bf('0x11')](_0xc8bf('0x12'),_0x4f6d35+'-'+_0xefc11e+'/'+_0x46d77e)[_0xc8bf('0xc')](_0x2d1b6f);}return null;};}function removeEntity(_0x38b8e1){return function(_0x38ca36){if(_0x38ca36){return _0x38ca36[_0xc8bf('0x13')]()[_0xc8bf('0x14')](function(){var _0x4b56f2=_0x38ca36[_0xc8bf('0x15')]({'plain':!![]});var _0x59551c=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0xc8bf('0x16'),'value':_0xc8bf('0x17'),'ignore':![]},{'name':_0xc8bf('0x18'),'value':_0xc8bf('0x19'),'ignore':![]}];var _0x237c0c=_(_0x59551c)[_0xc8bf('0x1a')](_0xc8bf('0x1b'))[_0xc8bf('0x1c')](_0xc8bf('0x1d'))[_0xc8bf('0x1d')]();if(_[_0xc8bf('0x1e')](_0x237c0c,_0x4b56f2[_0xc8bf('0x1f')])){return;}var _0x15c129=_['find'](_0x59551c,['value',_0x4b56f2['type']])[_0xc8bf('0x20')];return db[_0xc8bf('0x21')][_0xc8bf('0x13')]({'where':{'type':_0x15c129,'resourceId':_0x4b56f2['id']}})[_0xc8bf('0x14')](function(){return _0x38ca36;});})[_0xc8bf('0x14')](function(){_0x38b8e1[_0xc8bf('0xa')](0xcc)[_0xc8bf('0xb')]();});}};}function handleEntityNotFound(_0x143507){return function(_0x1a7835){if(!_0x1a7835){_0x143507['sendStatus'](0x194);}return _0x1a7835;};}function handleError(_0x13a6fd,_0x52c1d8){_0x52c1d8=_0x52c1d8||0x1f4;return function(_0x51c39e){logger[_0xc8bf('0x22')](_0x51c39e[_0xc8bf('0x23')]);if(_0x51c39e[_0xc8bf('0x20')]){delete _0x51c39e[_0xc8bf('0x20')];}_0x13a6fd[_0xc8bf('0xa')](_0x52c1d8)['send'](_0x51c39e);};}exports['index']=function(_0x17c2b3,_0x4fddc4){var _0x53824d={},_0x50339c={},_0x404276={'count':0x0,'rows':[]};var _0x38279a=_[_0xc8bf('0x1c')](db[_0xc8bf('0x24')][_0xc8bf('0x25')],function(_0x41b0c6){return{'name':_0x41b0c6['fieldName'],'type':_0x41b0c6[_0xc8bf('0x1f')][_0xc8bf('0x26')]};});_0x50339c[_0xc8bf('0x27')]=_[_0xc8bf('0x1c')](_0x38279a,_0xc8bf('0x20'));_0x50339c[_0xc8bf('0x28')]=_[_0xc8bf('0x29')](_0x17c2b3[_0xc8bf('0x28')]);_0x50339c['filters']=_[_0xc8bf('0x2a')](_0x50339c[_0xc8bf('0x27')],_0x50339c[_0xc8bf('0x28')]);_0x53824d['attributes']=_['intersection'](_0x50339c[_0xc8bf('0x27')],qs['fields'](_0x17c2b3[_0xc8bf('0x28')][_0xc8bf('0x2b')]));_0x53824d[_0xc8bf('0x2c')]=_0x53824d[_0xc8bf('0x2c')][_0xc8bf('0x2d')]?_0x53824d['attributes']:_0x50339c['model'];if(!_0x17c2b3[_0xc8bf('0x28')][_0xc8bf('0x2e')](_0xc8bf('0x2f'))){_0x53824d['limit']=qs[_0xc8bf('0xe')](_0x17c2b3['query'][_0xc8bf('0xe')]);_0x53824d[_0xc8bf('0xd')]=qs[_0xc8bf('0xd')](_0x17c2b3[_0xc8bf('0x28')]['offset']);}_0x53824d[_0xc8bf('0x30')]=qs[_0xc8bf('0x31')](_0x17c2b3['query'][_0xc8bf('0x31')]);_0x53824d[_0xc8bf('0x32')]=qs[_0xc8bf('0x33')](_[_0xc8bf('0x34')](_0x17c2b3['query'],_0x50339c[_0xc8bf('0x33')]),_0x38279a);if(_0x17c2b3[_0xc8bf('0x28')][_0xc8bf('0x1a')]){_0x53824d[_0xc8bf('0x32')]=_['merge'](_0x53824d['where'],{'$or':_[_0xc8bf('0x1c')](_0x38279a,function(_0x2c0e1b){if(_0x2c0e1b['type']!==_0xc8bf('0x35')){var _0x3c2e75={};_0x3c2e75[_0x2c0e1b[_0xc8bf('0x20')]]={'$like':'%'+_0x17c2b3[_0xc8bf('0x28')][_0xc8bf('0x1a')]+'%'};return _0x3c2e75;}})});}_0x53824d=_[_0xc8bf('0x36')]({},_0x53824d,_0x17c2b3[_0xc8bf('0x37')]);var _0xa87475={'where':_0x53824d[_0xc8bf('0x32')]};return db['VoiceExtension'][_0xc8bf('0x10')](_0xa87475)[_0xc8bf('0x14')](function(_0x14d38b){_0x404276[_0xc8bf('0x10')]=_0x14d38b;if(_0x17c2b3[_0xc8bf('0x28')][_0xc8bf('0x38')]){_0x53824d['include']=[{'all':!![]}];}return db['VoiceExtension'][_0xc8bf('0x39')](_0x53824d);})[_0xc8bf('0x14')](function(_0x2b23b2){_0x404276[_0xc8bf('0x3a')]=_0x2b23b2;return _0x404276;})['then'](respondWithFilteredResult(_0x4fddc4,_0x53824d))[_0xc8bf('0x3b')](handleError(_0x4fddc4,null));};exports[_0xc8bf('0x3c')]=function(_0x220d65,_0x23b991){var _0x2591ac={'raw':![],'where':{'id':_0x220d65[_0xc8bf('0x3d')]['id']}},_0x4a474b={};_0x4a474b[_0xc8bf('0x27')]=_['keys'](db[_0xc8bf('0x24')][_0xc8bf('0x25')]);_0x4a474b[_0xc8bf('0x28')]=_['keys'](_0x220d65[_0xc8bf('0x28')]);_0x4a474b['filters']=_['intersection'](_0x4a474b['model'],_0x4a474b[_0xc8bf('0x28')]);_0x2591ac[_0xc8bf('0x2c')]=_[_0xc8bf('0x2a')](_0x4a474b[_0xc8bf('0x27')],qs[_0xc8bf('0x2b')](_0x220d65[_0xc8bf('0x28')][_0xc8bf('0x2b')]));_0x2591ac[_0xc8bf('0x2c')]=_0x2591ac[_0xc8bf('0x2c')][_0xc8bf('0x2d')]?_0x2591ac[_0xc8bf('0x2c')]:_0x4a474b[_0xc8bf('0x27')];if(_0x220d65[_0xc8bf('0x28')][_0xc8bf('0x38')]){_0x2591ac[_0xc8bf('0x3e')]=[{'all':!![]}];}_0x2591ac=_[_0xc8bf('0x36')]({},_0x2591ac,_0x220d65[_0xc8bf('0x37')]);return db[_0xc8bf('0x24')][_0xc8bf('0x3f')](_0x2591ac)[_0xc8bf('0x14')](handleEntityNotFound(_0x23b991,null))[_0xc8bf('0x14')](respondWithResult(_0x23b991,null))[_0xc8bf('0x3b')](handleError(_0x23b991,null));};exports[_0xc8bf('0x13')]=function(_0x12f7b6,_0x520820){return db[_0xc8bf('0x24')][_0xc8bf('0x3f')]({'where':{'id':_0x12f7b6[_0xc8bf('0x3d')]['id']}})[_0xc8bf('0x14')](handleEntityNotFound(_0x520820,null))[_0xc8bf('0x14')](removeEntity(_0x520820,null))[_0xc8bf('0x3b')](handleError(_0x520820,null));};exports[_0xc8bf('0x40')]=function(_0x1a9f6c,_0x1448ff){if(_0x1a9f6c[_0xc8bf('0x41')][_0xc8bf('0x1f')]==='outbound'&&!_[_0xc8bf('0x42')](_0x1a9f6c['body']['exten'],'_')){_0x1a9f6c['body'][_0xc8bf('0x43')]='_'[_0xc8bf('0x44')](_0x1a9f6c['body'][_0xc8bf('0x43')]);}return db[_0xc8bf('0x24')][_0xc8bf('0x40')](_0x1a9f6c[_0xc8bf('0x41')],{'raw':![]})[_0xc8bf('0x14')](function(_0x232ecd){var _0x5c8edc=_0x1a9f6c[_0xc8bf('0x45')]['get']({'plain':!![]});if(!_0x5c8edc)throw new Error(_0xc8bf('0x46'));if(_0x5c8edc[_0xc8bf('0x47')]===_0xc8bf('0x45')){var _0x4b0679=_0x232ecd[_0xc8bf('0x15')]({'plain':!![]});var _0x214234=[{'name':_0xc8bf('0x48'),'value':'inbound'},{'name':_0xc8bf('0x16'),'value':_0xc8bf('0x17')},{'name':_0xc8bf('0x18'),'value':'internal'}];var _0x4bf216=_[_0xc8bf('0x3f')](_0x214234,[_0xc8bf('0x1d'),_0x4b0679[_0xc8bf('0x1f')]])[_0xc8bf('0x20')];return db[_0xc8bf('0x49')]['find']({'where':{'name':_0x4bf216,'userProfileId':_0x5c8edc[_0xc8bf('0x4a')]},'raw':!![]})['then'](function(_0x271bfd){if(_0x271bfd&&_0x271bfd[_0xc8bf('0x4b')]===0x0){return db[_0xc8bf('0x21')][_0xc8bf('0x40')]({'name':_0x4b0679[_0xc8bf('0x20')],'resourceId':_0x4b0679['id'],'type':_0x271bfd[_0xc8bf('0x20')],'sectionId':_0x271bfd['id']},{})['then'](function(){return _0x232ecd;});}else{return _0x232ecd;}})[_0xc8bf('0x3b')](function(_0x24a13e){logger['error'](_0xc8bf('0x4c'),_0x24a13e);throw _0x24a13e;});}return _0x232ecd;})[_0xc8bf('0x14')](respondWithResult(_0x1448ff,0xc9))[_0xc8bf('0x3b')](handleError(_0x1448ff,null));};exports[_0xc8bf('0x4d')]=function(_0x5ecd27,_0x2c9a63){if(_0x5ecd27[_0xc8bf('0x41')]['id']){delete _0x5ecd27[_0xc8bf('0x41')]['id'];}return db[_0xc8bf('0x24')][_0xc8bf('0x3f')]({'where':{'id':_0x5ecd27['params']['id']}})[_0xc8bf('0x14')](handleEntityNotFound(_0x2c9a63,null))[_0xc8bf('0x14')](function(_0x5722b7){if(_0x5722b7){return db[_0xc8bf('0x24')][_0xc8bf('0x4d')](_[_0xc8bf('0x34')](_0x5ecd27[_0xc8bf('0x41')],[_0xc8bf('0x43'),_0xc8bf('0x4e'),_0xc8bf('0x4f'),_0xc8bf('0x50'),_0xc8bf('0x51'),'mandatoryDisposition',_0xc8bf('0x52')]),{'where':{'context':_0x5722b7[_0xc8bf('0x4e')],'exten':_0x5722b7[_0xc8bf('0x43')]},'individualHooks':!![]})[_0xc8bf('0x14')](function(_0x3ea9ff){return _0x3ea9ff;});}return null;})[_0xc8bf('0x14')](respondWithStatusCode(_0x2c9a63,null))[_0xc8bf('0x3b')](handleError(_0x2c9a63,null));};exports[_0xc8bf('0x53')]=function(_0x2328d5,_0x5d3e3e){var _0x13de98=_0x2328d5[_0xc8bf('0x3d')]['id'];var _0x757799=_0x2328d5[_0xc8bf('0x41')];var _0xa9d58a=0xc8;var _0x4e32bc=null;return db[_0xc8bf('0x54')][_0xc8bf('0x55')]({'isolationLevel':db[_0xc8bf('0x54')][_0xc8bf('0x56')][_0xc8bf('0x57')][_0xc8bf('0x58')]},function(_0x2825e9){return db['VoiceExtension'][_0xc8bf('0x59')]({'where':{'id':_0x13de98},'transaction':_0x2825e9})[_0xc8bf('0x14')](function(_0x5b4c78){if(_0x5b4c78){return db[_0xc8bf('0x24')][_0xc8bf('0x13')]({'where':{'VoiceExtensionId':_0x13de98},'transaction':_0x2825e9})['then'](function(){var _0xe55826=_[_0xc8bf('0x1c')](_0x757799,function(_0x45177d){_0x45177d[_0xc8bf('0x5a')]=_0x13de98;_0x45177d[_0xc8bf('0x5b')]=!![];return _0x45177d;});return _0x5b4c78[_0xc8bf('0x5c')](_0xe55826);})[_0xc8bf('0x14')](function(_0x5ef752){return db[_0xc8bf('0x24')][_0xc8bf('0x5d')](_0x5ef752,{'transaction':_0x2825e9});});}else{_0xa9d58a=0x194;_0x4e32bc=[];}});})['then'](function(){if(_0xa9d58a!==0x194){return db[_0xc8bf('0x24')][_0xc8bf('0x5e')]({'where':{'isApp':!![],'VoiceExtensionId':_0x13de98},'order':_0xc8bf('0x5f')})['then'](function(_0x4dfc60){_0x4e32bc=_0x4dfc60;});}})[_0xc8bf('0x3b')](function(_0x855199){_0xa9d58a=0x1f4;logger[_0xc8bf('0x22')](_0x855199[_0xc8bf('0x23')]);if(_0x855199[_0xc8bf('0x20')]){delete _0x855199[_0xc8bf('0x20')];}_0x4e32bc=_0x855199;})[_0xc8bf('0x60')](function(){if(_0x4e32bc===null){_0x5d3e3e['sendStatus'](_0xa9d58a);}else{if(_0xa9d58a===0x1f4){_0x5d3e3e[_0xc8bf('0xa')](_0xa9d58a)[_0xc8bf('0x61')](_0x4e32bc);}else{_0x5d3e3e['status'](_0xa9d58a)['json'](_0x4e32bc);}}});}; \ No newline at end of file +var _0x58a7=['includes','type','find','name','UserProfileResource','then','error','stack','send','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','include','VoiceExtension','findAll','catch','show','params','keys','merge','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','InboundRoutes','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','cutdigits','mandatoryDisposition','alias','sequelize','transaction','Transaction','ISOLATION_LEVELS','VoiceExtensionId','isApp','createRouting','finally','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','destroy','get','outbound','InternalRoutes','internal','filter','ignore','map','value'];(function(_0x46d8b2,_0x3829c4){var _0x1a351f=function(_0x279ce5){while(--_0x279ce5){_0x46d8b2['push'](_0x46d8b2['shift']());}};_0x1a351f(++_0x3829c4);}(_0x58a7,0x149));var _0x758a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x58a7[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var Redis=require(_0x758a('0x0'));var qs=require(_0x758a('0x1'));var logger=require(_0x758a('0x2'))(_0x758a('0x3'));var config=require('../../config/environment');var db=require(_0x758a('0x4'))['db'];config['redis']=_[_0x758a('0x5')](config[_0x758a('0x6')],{'host':_0x758a('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceExtension.socket')[_0x758a('0x8')](socket);function respondWithStatusCode(_0x46fd52,_0x572226){_0x572226=_0x572226||0xcc;return function(_0x584946){if(_0x584946){return _0x46fd52[_0x758a('0x9')](_0x572226);}return _0x46fd52[_0x758a('0xa')](_0x572226)[_0x758a('0xb')]();};}function respondWithResult(_0x33d392,_0x523f4d){_0x523f4d=_0x523f4d||0xc8;return function(_0x2be04a){if(_0x2be04a){return _0x33d392['status'](_0x523f4d)['json'](_0x2be04a);}};}function respondWithFilteredResult(_0x1e6a24,_0x3cbb80){return function(_0x3669bc){if(_0x3669bc){var _0x2d39bf=typeof _0x3cbb80[_0x758a('0xc')]===_0x758a('0xd')&&typeof _0x3cbb80[_0x758a('0xe')]==='undefined';var _0x51e91d=_0x3669bc[_0x758a('0xf')];var _0x168f72=_0x2d39bf?0x0:_0x3cbb80[_0x758a('0xc')];var _0x4df6a8=_0x2d39bf?_0x3669bc[_0x758a('0xf')]:_0x3cbb80[_0x758a('0xc')]+_0x3cbb80[_0x758a('0xe')];var _0x53ac0f;if(_0x4df6a8>=_0x51e91d){_0x4df6a8=_0x51e91d;_0x53ac0f=0xc8;}else{_0x53ac0f=0xce;}_0x1e6a24[_0x758a('0xa')](_0x53ac0f);return _0x1e6a24['set'](_0x758a('0x10'),_0x168f72+'-'+_0x4df6a8+'/'+_0x51e91d)[_0x758a('0x11')](_0x3669bc);}return null;};}function removeEntity(_0x24ccbd){return function(_0x163c3f){if(_0x163c3f){return _0x163c3f[_0x758a('0x12')]()['then'](function(){var _0x5ecf54=_0x163c3f[_0x758a('0x13')]({'plain':!![]});var _0x3cd906=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x758a('0x14'),'ignore':![]},{'name':_0x758a('0x15'),'value':_0x758a('0x16'),'ignore':![]}];var _0x378683=_(_0x3cd906)[_0x758a('0x17')](_0x758a('0x18'))[_0x758a('0x19')](_0x758a('0x1a'))[_0x758a('0x1a')]();if(_[_0x758a('0x1b')](_0x378683,_0x5ecf54[_0x758a('0x1c')])){return;}var _0x4cca28=_[_0x758a('0x1d')](_0x3cd906,['value',_0x5ecf54[_0x758a('0x1c')]])[_0x758a('0x1e')];return db[_0x758a('0x1f')][_0x758a('0x12')]({'where':{'type':_0x4cca28,'resourceId':_0x5ecf54['id']}})[_0x758a('0x20')](function(){return _0x163c3f;});})[_0x758a('0x20')](function(){_0x24ccbd[_0x758a('0xa')](0xcc)[_0x758a('0xb')]();});}};}function handleEntityNotFound(_0x3bb4d6){return function(_0x348aa9){if(!_0x348aa9){_0x3bb4d6[_0x758a('0x9')](0x194);}return _0x348aa9;};}function handleError(_0x1bbf27,_0x49ef3b){_0x49ef3b=_0x49ef3b||0x1f4;return function(_0x599133){logger[_0x758a('0x21')](_0x599133[_0x758a('0x22')]);if(_0x599133[_0x758a('0x1e')]){delete _0x599133[_0x758a('0x1e')];}_0x1bbf27[_0x758a('0xa')](_0x49ef3b)[_0x758a('0x23')](_0x599133);};}exports['index']=function(_0x2855d6,_0x31a5a0){var _0x5b7f3b={},_0x45ad94={},_0x1177a0={'count':0x0,'rows':[]};var _0x34af44=_[_0x758a('0x19')](db['VoiceExtension'][_0x758a('0x24')],function(_0x592f7d){return{'name':_0x592f7d[_0x758a('0x25')],'type':_0x592f7d[_0x758a('0x1c')][_0x758a('0x26')]};});_0x45ad94[_0x758a('0x27')]=_[_0x758a('0x19')](_0x34af44,_0x758a('0x1e'));_0x45ad94[_0x758a('0x28')]=_['keys'](_0x2855d6[_0x758a('0x28')]);_0x45ad94[_0x758a('0x29')]=_[_0x758a('0x2a')](_0x45ad94['model'],_0x45ad94[_0x758a('0x28')]);_0x5b7f3b[_0x758a('0x2b')]=_['intersection'](_0x45ad94[_0x758a('0x27')],qs['fields'](_0x2855d6['query'][_0x758a('0x2c')]));_0x5b7f3b['attributes']=_0x5b7f3b[_0x758a('0x2b')][_0x758a('0x2d')]?_0x5b7f3b[_0x758a('0x2b')]:_0x45ad94[_0x758a('0x27')];if(!_0x2855d6[_0x758a('0x28')][_0x758a('0x2e')](_0x758a('0x2f'))){_0x5b7f3b[_0x758a('0xe')]=qs['limit'](_0x2855d6[_0x758a('0x28')]['limit']);_0x5b7f3b[_0x758a('0xc')]=qs[_0x758a('0xc')](_0x2855d6[_0x758a('0x28')]['offset']);}_0x5b7f3b[_0x758a('0x30')]=qs[_0x758a('0x31')](_0x2855d6[_0x758a('0x28')][_0x758a('0x31')]);_0x5b7f3b[_0x758a('0x32')]=qs[_0x758a('0x29')](_[_0x758a('0x33')](_0x2855d6[_0x758a('0x28')],_0x45ad94[_0x758a('0x29')]),_0x34af44);if(_0x2855d6[_0x758a('0x28')][_0x758a('0x17')]){_0x5b7f3b[_0x758a('0x32')]=_['merge'](_0x5b7f3b['where'],{'$or':_[_0x758a('0x19')](_0x34af44,function(_0x5e1120){if(_0x5e1120[_0x758a('0x1c')]!==_0x758a('0x34')){var _0x4c3ca1={};_0x4c3ca1[_0x5e1120[_0x758a('0x1e')]]={'$like':'%'+_0x2855d6[_0x758a('0x28')][_0x758a('0x17')]+'%'};return _0x4c3ca1;}})});}_0x5b7f3b=_['merge']({},_0x5b7f3b,_0x2855d6[_0x758a('0x35')]);var _0x1ffcbb={'where':_0x5b7f3b[_0x758a('0x32')]};return db['VoiceExtension'][_0x758a('0xf')](_0x1ffcbb)['then'](function(_0x35fe2a){_0x1177a0[_0x758a('0xf')]=_0x35fe2a;if(_0x2855d6['query'][_0x758a('0x36')]){_0x5b7f3b[_0x758a('0x37')]=[{'all':!![]}];}return db[_0x758a('0x38')][_0x758a('0x39')](_0x5b7f3b);})[_0x758a('0x20')](function(_0x12b08e){_0x1177a0['rows']=_0x12b08e;return _0x1177a0;})[_0x758a('0x20')](respondWithFilteredResult(_0x31a5a0,_0x5b7f3b))[_0x758a('0x3a')](handleError(_0x31a5a0,null));};exports[_0x758a('0x3b')]=function(_0x54cf3c,_0x302336){var _0x29f5df={'raw':![],'where':{'id':_0x54cf3c[_0x758a('0x3c')]['id']}},_0x366a50={};_0x366a50[_0x758a('0x27')]=_[_0x758a('0x3d')](db[_0x758a('0x38')][_0x758a('0x24')]);_0x366a50[_0x758a('0x28')]=_['keys'](_0x54cf3c[_0x758a('0x28')]);_0x366a50['filters']=_['intersection'](_0x366a50['model'],_0x366a50[_0x758a('0x28')]);_0x29f5df[_0x758a('0x2b')]=_[_0x758a('0x2a')](_0x366a50[_0x758a('0x27')],qs[_0x758a('0x2c')](_0x54cf3c[_0x758a('0x28')][_0x758a('0x2c')]));_0x29f5df[_0x758a('0x2b')]=_0x29f5df[_0x758a('0x2b')]['length']?_0x29f5df[_0x758a('0x2b')]:_0x366a50['model'];if(_0x54cf3c['query']['includeAll']){_0x29f5df[_0x758a('0x37')]=[{'all':!![]}];}_0x29f5df=_[_0x758a('0x3e')]({},_0x29f5df,_0x54cf3c[_0x758a('0x35')]);return db[_0x758a('0x38')][_0x758a('0x1d')](_0x29f5df)[_0x758a('0x20')](handleEntityNotFound(_0x302336,null))[_0x758a('0x20')](respondWithResult(_0x302336,null))[_0x758a('0x3a')](handleError(_0x302336,null));};exports['destroy']=function(_0x98a194,_0xb3b16e){return db[_0x758a('0x38')][_0x758a('0x1d')]({'where':{'id':_0x98a194['params']['id']}})[_0x758a('0x20')](handleEntityNotFound(_0xb3b16e,null))[_0x758a('0x20')](removeEntity(_0xb3b16e,null))[_0x758a('0x3a')](handleError(_0xb3b16e,null));};exports[_0x758a('0x3f')]=function(_0x1d1f09,_0x43cd98){if(_0x1d1f09[_0x758a('0x40')][_0x758a('0x1c')]===_0x758a('0x14')&&!_[_0x758a('0x41')](_0x1d1f09['body'][_0x758a('0x42')],'_')){_0x1d1f09['body'][_0x758a('0x42')]='_'['concat'](_0x1d1f09['body'][_0x758a('0x42')]);}return db[_0x758a('0x38')][_0x758a('0x3f')](_0x1d1f09[_0x758a('0x40')],{'raw':![]})[_0x758a('0x20')](function(_0x4bc9a3){var _0x28514f=_0x1d1f09['user'][_0x758a('0x13')]({'plain':!![]});if(!_0x28514f)throw new Error(_0x758a('0x43'));if(_0x28514f[_0x758a('0x44')]===_0x758a('0x45')){var _0x84b88a=_0x4bc9a3[_0x758a('0x13')]({'plain':!![]});var _0x984c28=[{'name':_0x758a('0x46'),'value':_0x758a('0x47')},{'name':'OutboundRoutes','value':_0x758a('0x14')},{'name':_0x758a('0x15'),'value':_0x758a('0x16')}];var _0x10d820=_[_0x758a('0x1d')](_0x984c28,[_0x758a('0x1a'),_0x84b88a[_0x758a('0x1c')]])[_0x758a('0x1e')];return db[_0x758a('0x48')][_0x758a('0x1d')]({'where':{'name':_0x10d820,'userProfileId':_0x28514f[_0x758a('0x49')]},'raw':!![]})['then'](function(_0x5597e0){if(_0x5597e0&&_0x5597e0[_0x758a('0x4a')]===0x0){return db['UserProfileResource'][_0x758a('0x3f')]({'name':_0x84b88a[_0x758a('0x1e')],'resourceId':_0x84b88a['id'],'type':_0x5597e0[_0x758a('0x1e')],'sectionId':_0x5597e0['id']},{})[_0x758a('0x20')](function(){return _0x4bc9a3;});}else{return _0x4bc9a3;}})[_0x758a('0x3a')](function(_0x25c1ea){logger[_0x758a('0x21')](_0x758a('0x4b'),_0x25c1ea);throw _0x25c1ea;});}return _0x4bc9a3;})[_0x758a('0x20')](respondWithResult(_0x43cd98,0xc9))[_0x758a('0x3a')](handleError(_0x43cd98,null));};exports[_0x758a('0x4c')]=function(_0x5e08a1,_0x455383){if(_0x5e08a1[_0x758a('0x40')]['id']){delete _0x5e08a1[_0x758a('0x40')]['id'];}return db[_0x758a('0x38')][_0x758a('0x1d')]({'where':{'id':_0x5e08a1[_0x758a('0x3c')]['id']}})[_0x758a('0x20')](handleEntityNotFound(_0x455383,null))['then'](function(_0x46235a){if(_0x46235a){return db[_0x758a('0x38')][_0x758a('0x4c')](_[_0x758a('0x33')](_0x5e08a1['body'],[_0x758a('0x42'),_0x758a('0x4d'),'description','recordingFormat',_0x758a('0x4e'),_0x758a('0x4f'),_0x758a('0x50')]),{'where':{'context':_0x46235a[_0x758a('0x4d')],'exten':_0x46235a[_0x758a('0x42')]},'individualHooks':!![]})[_0x758a('0x20')](function(_0x2ca6b6){return _0x2ca6b6;});}return null;})[_0x758a('0x20')](respondWithStatusCode(_0x455383,null))[_0x758a('0x3a')](handleError(_0x455383,null));};exports['addApplications']=function(_0x364509,_0x19fa45){var _0x4cf2e1=_0x364509['params']['id'];var _0x452396=_0x364509['body'];var _0x1b43d1=0xc8;var _0x12a516=null;return db[_0x758a('0x51')][_0x758a('0x52')]({'isolationLevel':db[_0x758a('0x51')][_0x758a('0x53')][_0x758a('0x54')]['READ_COMMITTED']},function(_0x4d3545){return db[_0x758a('0x38')]['findOne']({'where':{'id':_0x4cf2e1},'transaction':_0x4d3545})['then'](function(_0x2c2798){if(_0x2c2798){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x4cf2e1},'transaction':_0x4d3545})[_0x758a('0x20')](function(){var _0x5b6b4b=_[_0x758a('0x19')](_0x452396,function(_0x12318e){_0x12318e[_0x758a('0x55')]=_0x4cf2e1;_0x12318e[_0x758a('0x56')]=!![];return _0x12318e;});return _0x2c2798[_0x758a('0x57')](_0x5b6b4b);})['then'](function(_0x30ecc8){return db['VoiceExtension']['bulkCreate'](_0x30ecc8,{'transaction':_0x4d3545});});}else{_0x1b43d1=0x194;_0x12a516=[];}});})[_0x758a('0x20')](function(){if(_0x1b43d1!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x4cf2e1},'order':'cast(priority\x20as\x20unsigned)'})[_0x758a('0x20')](function(_0x1df4e8){_0x12a516=_0x1df4e8;});}})[_0x758a('0x3a')](function(_0x46560b){_0x1b43d1=0x1f4;logger['error'](_0x46560b['stack']);if(_0x46560b[_0x758a('0x1e')]){delete _0x46560b[_0x758a('0x1e')];}_0x12a516=_0x46560b;})[_0x758a('0x58')](function(){if(_0x12a516===null){_0x19fa45[_0x758a('0x9')](_0x1b43d1);}else{if(_0x1b43d1===0x1f4){_0x19fa45[_0x758a('0xa')](_0x1b43d1)[_0x758a('0x23')](_0x12a516);}else{_0x19fa45[_0x758a('0xa')](_0x1b43d1)[_0x758a('0x11')](_0x12a516);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index cc60763..2a4515c 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 _0x1edb=['hook','events','setMaxListeners','save','remove','hasOwnProperty'];(function(_0xb98169,_0x104b77){var _0x1c7aa4=function(_0x177eac){while(--_0x177eac){_0xb98169['push'](_0xb98169['shift']());}};_0x1c7aa4(++_0x104b77);}(_0x1edb,0x85));var _0xb1ed=function(_0x3e0b53,_0x354369){_0x3e0b53=_0x3e0b53-0x0;var _0x1f54b0=_0x1edb[_0x3e0b53];return _0x1f54b0;};'use strict';var EventEmitter=require(_0xb1ed('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb1ed('0x1')](0x0);var events={'afterCreate':_0xb1ed('0x2'),'afterUpdate':'update','afterDestroy':_0xb1ed('0x3')};function emitEvent(_0x5923b3){return function(_0x5c8f9,_0x4335d3,_0x96466d){VoiceExtensionEvents['emit'](_0x5923b3+':'+_0x5c8f9['id'],_0x5c8f9);VoiceExtensionEvents['emit'](_0x5923b3,_0x5c8f9);_0x96466d(null);};}for(var e in events){if(events[_0xb1ed('0x4')](e)){var event=events[e];VoiceExtension[_0xb1ed('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xdeef=['hasOwnProperty','exports','../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit'];(function(_0x2647d4,_0xbde0c2){var _0x365670=function(_0x2dc8f5){while(--_0x2dc8f5){_0x2647d4['push'](_0x2647d4['shift']());}};_0x365670(++_0xbde0c2);}(_0xdeef,0x182));var _0xfdee=function(_0x4f11cb,_0x14e174){_0x4f11cb=_0x4f11cb-0x0;var _0x491488=_0xdeef[_0x4f11cb];return _0x491488;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xfdee('0x0'))['db'][_0xfdee('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xfdee('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdee('0x3'),'afterDestroy':_0xfdee('0x4')};function emitEvent(_0x2f1a68){return function(_0x24e189,_0x18daa1,_0x2fa3c6){VoiceExtensionEvents['emit'](_0x2f1a68+':'+_0x24e189['id'],_0x24e189);VoiceExtensionEvents[_0xfdee('0x5')](_0x2f1a68,_0x24e189);_0x2fa3c6(null);};}for(var e in events){if(events[_0xfdee('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xfdee('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 5977808..12051ad 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 _0x09f4=['NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','split','length','name','param','prefix','phone','${EXTEN}','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','IntervalId','then','interval','*,*,*,*','map','filter','toLowerCase','tag','CDR(tag)=','intervals','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','get','Hangup','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias'];(function(_0x3dacd8,_0xacf7bc){var _0x227ed4=function(_0x58c04b){while(--_0x58c04b){_0x3dacd8['push'](_0x3dacd8['shift']());}};_0x227ed4(++_0xacf7bc);}(_0x09f4,0x1a5));var _0x409f=function(_0x54b5b8,_0x33fa64){_0x54b5b8=_0x54b5b8-0x0;var _0x4ef494=_0x09f4[_0x54b5b8];return _0x4ef494;};'use strict';var _=require('lodash');var attributes=require(_0x409f('0x0'));module[_0x409f('0x1')]=function(_0x4c2965){var _0x188057=_0x4c2965[_0x409f('0x2')];function _0x55498f(_0x2926cc){var _0x1e52b5=0x2;var _0x49d0df=[{'type':_0x2926cc[_0x409f('0x3')],'app':_0x409f('0x4'),'appdata':_0x409f('0x5')+_0x2926cc[_0x409f('0x3')],'context':_0x2926cc[_0x409f('0x6')],'exten':_0x2926cc[_0x409f('0x7')],'priority':_0x1e52b5++,'VoiceExtensionId':_0x2926cc['id']},{'type':_0x2926cc[_0x409f('0x3')],'app':_0x2926cc[_0x409f('0x8')]?_0x409f('0x4'):_0x409f('0x9'),'appdata':_0x2926cc[_0x409f('0x8')]?_0x409f('0xa')+_0x2926cc[_0x409f('0x8')]:_0x409f('0xb'),'context':_0x2926cc[_0x409f('0x6')],'exten':_0x2926cc[_0x409f('0x7')],'priority':_0x1e52b5++,'VoiceExtensionId':_0x2926cc['id']}];if(_0x2926cc[_0x409f('0x3')]===_0x409f('0xc')){_0x49d0df[_0x409f('0xd')]({'type':_0x409f('0xc'),'app':_0x409f('0x4'),'appdata':'CDR(routeid)='+_0x2926cc['id'],'context':_0x2926cc['context'],'exten':_0x2926cc[_0x409f('0x7')],'priority':_0x1e52b5++,'VoiceExtensionId':_0x2926cc['id']});}_0x49d0df[_0x409f('0xd')]({'type':_0x2926cc[_0x409f('0x3')],'app':_0x409f('0x4'),'appdata':_0x409f('0xe'),'context':_0x2926cc['context'],'exten':_0x2926cc['exten'],'priority':_0x1e52b5++,'VoiceExtensionId':_0x2926cc['id']},{'type':_0x2926cc[_0x409f('0x3')],'app':_0x409f('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2926cc[_0x409f('0x6')],'exten':_0x2926cc[_0x409f('0x7')],'priority':_0x1e52b5++,'VoiceExtensionId':_0x2926cc['id']},{'type':_0x2926cc[_0x409f('0x3')],'app':_0x409f('0x4'),'appdata':_0x409f('0xf'),'context':_0x2926cc['context'],'exten':_0x2926cc[_0x409f('0x7')],'priority':_0x1e52b5++,'VoiceExtensionId':_0x2926cc['id']});return _0x49d0df;}function _0x35a201(_0x86fbdc){var _0x593453=0x2;var _0x44b064=[{'type':_0x409f('0x10'),'app':'Set','appdata':_0x409f('0x11'),'context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':'outbound','app':_0x86fbdc['alias']?_0x409f('0x4'):_0x409f('0x9'),'appdata':_0x86fbdc[_0x409f('0x8')]?_0x409f('0xa')+_0x86fbdc[_0x409f('0x8')]:_0x409f('0xb'),'context':_0x86fbdc['context'],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':_0x409f('0x12')+(_0x86fbdc['cutdigits']?_0x409f('0x13')+_0x86fbdc[_0x409f('0x14')]+'}':'${EXTEN}'),'context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':_0x409f('0x15')+_0x86fbdc['id'],'context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x16'),'appdata':_0x409f('0x17')+(_0x593453+0x2)+'):Goto('+(_0x593453+0x1)+')','context':_0x86fbdc['context'],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':_0x86fbdc[_0x409f('0x14')]?_0x409f('0x18')+_0x86fbdc['cutdigits']+'}':_0x409f('0x19'),'context':_0x86fbdc['context'],'exten':_0x86fbdc['exten'],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':_0x409f('0xe'),'context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc['exten'],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':'outbound','app':'Set','appdata':_0x409f('0x1a'),'context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc['exten'],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':'outbound','app':_0x409f('0x4'),'appdata':_0x409f('0x1b')+_0x86fbdc['id'],'context':_0x86fbdc['context'],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']}];if(_0x86fbdc['hasOwnProperty'](_0x409f('0x1c'))&&_0x86fbdc[_0x409f('0x1c')]!==_0x409f('0x1d')){_0x44b064[_0x409f('0xd')]({'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':_0x409f('0x1e'),'context':_0x86fbdc['context'],'exten':_0x86fbdc['exten'],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']},{'type':_0x409f('0x10'),'app':_0x409f('0x4'),'appdata':_0x409f('0x1f')+_0x86fbdc[_0x409f('0x1c')]||_0x409f('0x20'),'context':_0x86fbdc[_0x409f('0x6')],'exten':_0x86fbdc[_0x409f('0x7')],'priority':_0x593453++,'VoiceExtensionId':_0x86fbdc['id']});}return _0x44b064;}function _0x31800b(_0x52fb31,_0x2c84c8){var _0x5592c8=[{'name':_0x409f('0x21'),'param':0x0},{'name':_0x409f('0x22'),'param':0x1},{'name':'options','param':0x2},{'name':_0x409f('0x23'),'param':0x3}];var _0x2a5e9f={};var _0x5c0a73=_0x2c84c8[_0x409f('0x24')](',');var _0x2a1f93=[];for(var _0x300343=0x0;_0x300343<_0x5592c8[_0x409f('0x25')];_0x300343++){switch(_0x5592c8[_0x300343][_0x409f('0x26')]){case _0x409f('0x21'):_0x2a5e9f[_0x409f('0x21')]=_0x5c0a73[_0x5592c8[_0x300343][_0x409f('0x27')]]['split']('/')[0x1];_0x2a5e9f['phone']=_0x5c0a73[_0x5592c8[_0x300343][_0x409f('0x27')]][_0x409f('0x24')]('/')[0x2];_0x2a5e9f[_0x409f('0x28')]=_0x2a5e9f['phone']?_0x2a5e9f['phone'][_0x409f('0x24')]('$')[0x0]:undefined;_0x2a5e9f[_0x409f('0x29')]=_0x52fb31['cutdigits']?(_0x2a5e9f[_0x409f('0x28')]||'')+_0x409f('0x13')+_0x52fb31[_0x409f('0x14')]+'}':(_0x2a5e9f['prefix']||'')+_0x409f('0x2a');_0x2a1f93[_0x5592c8[_0x300343][_0x409f('0x27')]]=[_0x409f('0x2b'),_0x2a5e9f['trunk'],_0x2a5e9f[_0x409f('0x29')]][_0x409f('0x2c')]('/');break;case _0x409f('0x2d'):_0x2a5e9f['options']=_0x5c0a73[_0x5592c8[_0x300343]['param']];if(_0x52fb31[_0x409f('0x1c')]!==_0x409f('0x1d')){if(_0x2a5e9f[_0x409f('0x2d')][_0x409f('0x2e')](_0x409f('0x2f'))<0x0){_0x2a5e9f[_0x409f('0x2d')]+=_0x409f('0x2f');}}else{_0x2a5e9f['options']=_0x2a5e9f[_0x409f('0x2d')][_0x409f('0x30')](_0x409f('0x2f'),'');}_0x2a1f93[_0x5592c8[_0x300343][_0x409f('0x27')]]=_0x2a5e9f[_0x409f('0x2d')];break;default:_0x2a1f93[_0x5592c8[_0x300343][_0x409f('0x27')]]=_0x5c0a73[_0x5592c8[_0x300343]['param']];}}return _0x2a1f93[_0x409f('0x2c')](',');}function _0x5464e8(_0x597147,_0x4efbc1,_0x4327c8){return new Promise(function(_0x49cdc7,_0x273851){var _0x2dda13=[];if(_[_0x409f('0x31')](_0x4efbc1))return _0x49cdc7(_0x2dda13);_0x188057[_0x409f('0x32')]['findAll']({'attributes':['id','interval',_0x409f('0x33')],'raw':!![]})[_0x409f('0x34')](function(_0x3bd899){for(var _0x24ce23=0x0,_0x532056=0x0;_0x24ce23<_0x4efbc1['length'];_0x24ce23++,_0x532056=0x0){var _0xc54f16=_0x4efbc1[_0x24ce23];var _0x126845=[];var _0x237e47=[];delete _0xc54f16['id'];if(_0xc54f16[_0x409f('0x35')]!==_0x409f('0x36')){_0xc54f16['intervals']=[_0xc54f16['interval']];}else{_0xc54f16['intervals']=_0xc54f16[_0x409f('0x33')]?_[_0x409f('0x37')](_[_0x409f('0x38')](_0x3bd899,{'IntervalId':_0xc54f16['IntervalId']}),'interval'):[];}_0xc54f16[_0x409f('0x6')]=_0x597147[_0x409f('0x6')];_0xc54f16[_0x409f('0x7')]=_0x597147['exten'];if(_0xc54f16[_0x409f('0x3')])_0xc54f16[_0x409f('0x3')]=_0xc54f16[_0x409f('0x3')][_0x409f('0x39')]();if(_0x597147[_0x409f('0x3')]===_0x409f('0x10')){if(_0xc54f16['hasOwnProperty']('tag')&&_0xc54f16['tag']&&_0xc54f16[_0x409f('0x3a')]!=='--'){_0x126845['push']({'type':_0xc54f16[_0x409f('0x3')]['toLowerCase'](),'app':_0x409f('0x4'),'appdata':_0x409f('0x3b')+_0xc54f16[_0x409f('0x3a')],'context':_0x597147['context'],'exten':_0x597147[_0x409f('0x7')],'priority':_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')]+_0x4327c8+_0x532056++,'VoiceExtensionId':_0x597147['id']});}_0x126845[_0x409f('0xd')]({'type':_0xc54f16['type'][_0x409f('0x39')](),'app':_0x409f('0x16'),'appdata':_0x409f('0x3d')+(_0xc54f16['callerID']?_0x409f('0x3e')+_0xc54f16[_0x409f('0x3f')]+')':_0x409f('0x40')),'context':_0x597147['context'],'exten':_0x597147[_0x409f('0x7')],'priority':_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')]+_0x4327c8+_0x532056++,'VoiceExtensionId':_0x597147['id']});}else{if(_0xc54f16['hasOwnProperty'](_0x409f('0x41'))){if(['queue',_0x409f('0x42')]['includes'](_0xc54f16[_0x409f('0x43')][_0x409f('0x39')]())&&_0xc54f16[_0x409f('0x44')]!==_0x409f('0x45')){if(_0xc54f16[_0x409f('0x41')]){_0x126845[_0x409f('0xd')]({'type':_0xc54f16[_0x409f('0x3')]['toLowerCase'](),'app':_0x409f('0x16'),'appdata':_0x409f('0x46'),'context':_0x597147[_0x409f('0x6')],'exten':_0x597147[_0x409f('0x7')],'priority':_0xc54f16[_0x409f('0x3c')]['length']+_0x4327c8+_0x532056++,'VoiceExtensionId':_0x597147['id']});_0x126845[_0x409f('0xd')]({'type':_0xc54f16[_0x409f('0x3')]['toLowerCase'](),'app':'Set','appdata':_0x409f('0x47'),'context':_0x597147['context'],'exten':_0x597147[_0x409f('0x7')],'priority':_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')]+_0x4327c8+_0x532056++,'VoiceExtensionId':_0x597147['id']});}else{_0x126845['push']({'type':_0xc54f16[_0x409f('0x3')][_0x409f('0x39')](),'app':'ExecIf','appdata':_0x409f('0x48'),'context':_0x597147['context'],'exten':_0x597147[_0x409f('0x7')],'priority':_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')]+_0x4327c8+_0x532056++,'VoiceExtensionId':_0x597147['id']});_0x126845[_0x409f('0xd')]({'type':_0xc54f16[_0x409f('0x3')][_0x409f('0x39')](),'app':'Set','appdata':_0x409f('0x49'),'context':_0x597147[_0x409f('0x6')],'exten':_0x597147['exten'],'priority':_0xc54f16[_0x409f('0x3c')]['length']+_0x4327c8+_0x532056++,'VoiceExtensionId':_0x597147['id']});}}}}for(var _0x4bc2f5=0x0;_0x4bc2f5<_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')];_0x4bc2f5++){var _0x3763cc=_0x4327c8+_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')];var _0xf85613=_0x4bc2f5===_0xc54f16[_0x409f('0x3c')][_0x409f('0x25')]-0x1?_0x4327c8+_0x126845[_0x409f('0x25')]+_0x237e47[_0x409f('0x25')]+0x2:_0x4327c8+_0x4bc2f5+0x1;_0x126845[_0x409f('0x4a')](_0x4bc2f5,0x0,{'type':_0x597147['type'],'app':_0x409f('0x4b'),'appdata':_0xc54f16[_0x409f('0x3c')][_0x4bc2f5]+'?'+_0x597147['context']+',${EXTEN},'+_0x3763cc+':'+_0x597147[_0x409f('0x6')]+_0x409f('0x4c')+_0xf85613,'exten':_0x597147[_0x409f('0x7')],'context':_0x597147[_0x409f('0x6')],'priority':_0x4327c8+_0x4bc2f5,'VoiceExtensionId':_0x597147['id']});}if(_0xc54f16[_0x409f('0x44')]===_0x409f('0x4d'))_0xc54f16[_0x409f('0x4e')]=_0x31800b(_0x597147,_0xc54f16['appdata']);_0xc54f16[_0x409f('0x4f')]=_0x126845['length']?_[_0x409f('0x50')](_0x126845)['priority']+0x1:_0x4327c8;_0x2dda13=_['concat'](_0x2dda13,_0x126845,[_0xc54f16],_0x237e47);_0x4327c8=_[_0x409f('0x50')](_0x2dda13)['priority']+0x1;}return _0x49cdc7(_0x2dda13);})[_0x409f('0x51')](function(_0x598e4e){_0x273851(_0x598e4e);});});}return _0x4c2965[_0x409f('0x52')](_0x409f('0x53'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x32cc50){var _0xe86405=this[_0x409f('0x54')]({'plain':!![]});var _0x245be1=_0xe86405[_0x409f('0x3')]===_0x409f('0x10')?_0x35a201(_0xe86405):_0x55498f(_0xe86405);return _0x5464e8(_0xe86405,_0x32cc50,_[_0x409f('0x50')](_0x245be1)['priority']+0x1)[_0x409f('0x34')](function(_0x4c8653){var _0x3df14f=_['concat'](_0x245be1,_0x4c8653);_0x3df14f[_0x409f('0xd')]({'type':_0xe86405[_0x409f('0x3')],'app':_0x409f('0x55'),'exten':_0xe86405[_0x409f('0x7')],'context':_0xe86405[_0x409f('0x6')],'priority':_[_0x409f('0x50')](_0x3df14f)[_0x409f('0x4f')]+0x1,'VoiceExtensionId':_0xe86405['id']});return _0x3df14f;});}}});}; \ No newline at end of file +var _0x92e0=['define','VoiceExtension','voice_extensions','get','lodash','exports','models','type','Set','context','exten','CDR(routeAlias)=','alias','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','url','length','name','trunk','param','split','phone','prefix','SIP','join','options','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','priority','last','concat','catch'];(function(_0x5179a5,_0x419746){var _0x15c8ce=function(_0x1b13c4){while(--_0x1b13c4){_0x5179a5['push'](_0x5179a5['shift']());}};_0x15c8ce(++_0x419746);}(_0x92e0,0x154));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x092e('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x092e('0x1')]=function(_0xfd835f){var _0x2e3997=_0xfd835f[_0x092e('0x2')];function _0x10ccfe(_0xadc488){var _0x3756db=0x2;var _0x416760=[{'type':_0xadc488[_0x092e('0x3')],'app':_0x092e('0x4'),'appdata':'CDR(type)='+_0xadc488['type'],'context':_0xadc488[_0x092e('0x5')],'exten':_0xadc488[_0x092e('0x6')],'priority':_0x3756db++,'VoiceExtensionId':_0xadc488['id']},{'type':_0xadc488[_0x092e('0x3')],'app':_0xadc488['alias']?_0x092e('0x4'):'NoOp','appdata':_0xadc488['alias']?_0x092e('0x7')+_0xadc488[_0x092e('0x8')]:'No\x20alias\x20set','context':_0xadc488[_0x092e('0x5')],'exten':_0xadc488['exten'],'priority':_0x3756db++,'VoiceExtensionId':_0xadc488['id']}];if(_0xadc488['type']===_0x092e('0x9')){_0x416760['push']({'type':_0x092e('0x9'),'app':'Set','appdata':'CDR(routeid)='+_0xadc488['id'],'context':_0xadc488[_0x092e('0x5')],'exten':_0xadc488['exten'],'priority':_0x3756db++,'VoiceExtensionId':_0xadc488['id']});}_0x416760[_0x092e('0xa')]({'type':_0xadc488[_0x092e('0x3')],'app':_0x092e('0x4'),'appdata':_0x092e('0xb'),'context':_0xadc488[_0x092e('0x5')],'exten':_0xadc488['exten'],'priority':_0x3756db++,'VoiceExtensionId':_0xadc488['id']},{'type':_0xadc488['type'],'app':_0x092e('0x4'),'appdata':_0x092e('0xc'),'context':_0xadc488['context'],'exten':_0xadc488[_0x092e('0x6')],'priority':_0x3756db++,'VoiceExtensionId':_0xadc488['id']},{'type':_0xadc488[_0x092e('0x3')],'app':_0x092e('0x4'),'appdata':_0x092e('0xd'),'context':_0xadc488['context'],'exten':_0xadc488[_0x092e('0x6')],'priority':_0x3756db++,'VoiceExtensionId':_0xadc488['id']});return _0x416760;}function _0x13bdf1(_0x5c39d7){var _0x49f5c1=0x2;var _0x3a4aff=[{'type':_0x092e('0xe'),'app':_0x092e('0x4'),'appdata':_0x092e('0xf'),'context':_0x5c39d7[_0x092e('0x5')],'exten':_0x5c39d7['exten'],'priority':_0x49f5c1++,'VoiceExtensionId':_0x5c39d7['id']},{'type':_0x092e('0xe'),'app':_0x5c39d7[_0x092e('0x8')]?'Set':_0x092e('0x10'),'appdata':_0x5c39d7['alias']?_0x092e('0x7')+_0x5c39d7['alias']:'No\x20alias\x20set','context':_0x5c39d7['context'],'exten':_0x5c39d7[_0x092e('0x6')],'priority':_0x49f5c1++,'VoiceExtensionId':_0x5c39d7['id']},{'type':_0x092e('0xe'),'app':'Set','appdata':'CDR(destination)='+(_0x5c39d7[_0x092e('0x11')]?_0x092e('0x12')+_0x5c39d7[_0x092e('0x11')]+'}':_0x092e('0x13')),'context':_0x5c39d7[_0x092e('0x5')],'exten':_0x5c39d7['exten'],'priority':_0x49f5c1++,'VoiceExtensionId':_0x5c39d7['id']},{'type':'outbound','app':'Set','appdata':_0x092e('0x14')+_0x5c39d7['id'],'context':_0x5c39d7[_0x092e('0x5')],'exten':_0x5c39d7['exten'],'priority':_0x49f5c1++,'VoiceExtensionId':_0x5c39d7['id']},{'type':_0x092e('0xe'),'app':_0x092e('0x15'),'appdata':_0x092e('0x16')+(_0x49f5c1+0x2)+'):Goto('+(_0x49f5c1+0x1)+')','context':_0x5c39d7[_0x092e('0x5')],'exten':_0x5c39d7[_0x092e('0x6')],'priority':_0x49f5c1++,'VoiceExtensionId':_0x5c39d7['id']},{'type':_0x092e('0xe'),'app':'Set','appdata':_0x5c39d7[_0x092e('0x11')]?_0x092e('0x17')+_0x5c39d7[_0x092e('0x11')]+'}':_0x092e('0x18'),'context':_0x5c39d7['context'],'exten':_0x5c39d7[_0x092e('0x6')],'priority':_0x49f5c1++,'VoiceExtensionId':_0x5c39d7['id']},{'type':_0x092e('0xe'),'app':'Set','appdata':_0x092e('0xb'),'context':_0x5c39d7[_0x092e('0x5')],'exten':_0x5c39d7[_0x092e('0x6')],'priority':_0x49f5c1++,'VoiceExtensionId':_0x5c39d7['id']},{'type':_0x092e('0xe'),'app':_0x092e('0x4'),'appdata':_0x092e('0xc'),'context':_0x5c39d7[_0x092e('0x5')],'exten':_0x5c39d7[_0x092e('0x6')],'priority':_0x49f5c1++,'VoiceExtensionId':_0x5c39d7['id']},{'type':'outbound','app':_0x092e('0x4'),'appdata':_0x092e('0xd'),'context':_0x5c39d7[_0x092e('0x5')],'exten':_0x5c39d7[_0x092e('0x6')],'priority':_0x49f5c1++,'VoiceExtensionId':_0x5c39d7['id']},{'type':_0x092e('0xe'),'app':_0x092e('0x4'),'appdata':_0x092e('0x19')+_0x5c39d7['id'],'context':_0x5c39d7[_0x092e('0x5')],'exten':_0x5c39d7[_0x092e('0x6')],'priority':_0x49f5c1++,'VoiceExtensionId':_0x5c39d7['id']}];if(_0x5c39d7[_0x092e('0x1a')]('recordingFormat')&&_0x5c39d7[_0x092e('0x1b')]!=='none'){_0x3a4aff[_0x092e('0xa')]({'type':_0x092e('0xe'),'app':_0x092e('0x4'),'appdata':_0x092e('0x1c'),'context':_0x5c39d7[_0x092e('0x5')],'exten':_0x5c39d7[_0x092e('0x6')],'priority':_0x49f5c1++,'VoiceExtensionId':_0x5c39d7['id']},{'type':_0x092e('0xe'),'app':_0x092e('0x4'),'appdata':_0x092e('0x1d')+_0x5c39d7['recordingFormat']||_0x092e('0x1e'),'context':_0x5c39d7[_0x092e('0x5')],'exten':_0x5c39d7[_0x092e('0x6')],'priority':_0x49f5c1++,'VoiceExtensionId':_0x5c39d7['id']});}return _0x3a4aff;}function _0x541628(_0x1a6144,_0x222531){var _0x1335b5=[{'name':'trunk','param':0x0},{'name':_0x092e('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':_0x092e('0x20'),'param':0x3}];var _0x4eec2d={};var _0x1488a4=_0x222531['split'](',');var _0xdd1c14=[];for(var _0x4d0609=0x0;_0x4d0609<_0x1335b5[_0x092e('0x21')];_0x4d0609++){switch(_0x1335b5[_0x4d0609][_0x092e('0x22')]){case _0x092e('0x23'):_0x4eec2d[_0x092e('0x23')]=_0x1488a4[_0x1335b5[_0x4d0609][_0x092e('0x24')]][_0x092e('0x25')]('/')[0x1];_0x4eec2d[_0x092e('0x26')]=_0x1488a4[_0x1335b5[_0x4d0609][_0x092e('0x24')]][_0x092e('0x25')]('/')[0x2];_0x4eec2d[_0x092e('0x27')]=_0x4eec2d[_0x092e('0x26')]?_0x4eec2d['phone'][_0x092e('0x25')]('$')[0x0]:undefined;_0x4eec2d[_0x092e('0x26')]=_0x1a6144[_0x092e('0x11')]?(_0x4eec2d[_0x092e('0x27')]||'')+_0x092e('0x12')+_0x1a6144['cutdigits']+'}':(_0x4eec2d[_0x092e('0x27')]||'')+_0x092e('0x13');_0xdd1c14[_0x1335b5[_0x4d0609]['param']]=[_0x092e('0x28'),_0x4eec2d['trunk'],_0x4eec2d[_0x092e('0x26')]][_0x092e('0x29')]('/');break;case _0x092e('0x2a'):_0x4eec2d['options']=_0x1488a4[_0x1335b5[_0x4d0609][_0x092e('0x24')]];if(_0x1a6144[_0x092e('0x1b')]!==_0x092e('0x2b')){if(_0x4eec2d['options'][_0x092e('0x2c')](_0x092e('0x2d'))<0x0){_0x4eec2d[_0x092e('0x2a')]+=_0x092e('0x2d');}}else{_0x4eec2d[_0x092e('0x2a')]=_0x4eec2d['options'][_0x092e('0x2e')](_0x092e('0x2d'),'');}_0xdd1c14[_0x1335b5[_0x4d0609]['param']]=_0x4eec2d[_0x092e('0x2a')];break;default:_0xdd1c14[_0x1335b5[_0x4d0609][_0x092e('0x24')]]=_0x1488a4[_0x1335b5[_0x4d0609]['param']];}}return _0xdd1c14[_0x092e('0x29')](',');}function _0x343a43(_0x2b5bdd,_0x123e3b,_0x18425c){return new Promise(function(_0x370ba5,_0x479e91){var _0x2709fc=[];if(_[_0x092e('0x2f')](_0x123e3b))return _0x370ba5(_0x2709fc);_0x2e3997[_0x092e('0x30')][_0x092e('0x31')]({'attributes':['id',_0x092e('0x32'),_0x092e('0x33')],'raw':!![]})[_0x092e('0x34')](function(_0x12f5fb){for(var _0x489900=0x0,_0x54eaa4=0x0;_0x489900<_0x123e3b['length'];_0x489900++,_0x54eaa4=0x0){var _0x319d4b=_0x123e3b[_0x489900];var _0x4bbe70=[];var _0x9e1bf5=[];delete _0x319d4b['id'];if(_0x319d4b['interval']!==_0x092e('0x35')){_0x319d4b[_0x092e('0x36')]=[_0x319d4b[_0x092e('0x32')]];}else{_0x319d4b[_0x092e('0x36')]=_0x319d4b[_0x092e('0x33')]?_['map'](_[_0x092e('0x37')](_0x12f5fb,{'IntervalId':_0x319d4b[_0x092e('0x33')]}),_0x092e('0x32')):[];}_0x319d4b[_0x092e('0x5')]=_0x2b5bdd[_0x092e('0x5')];_0x319d4b[_0x092e('0x6')]=_0x2b5bdd[_0x092e('0x6')];if(_0x319d4b[_0x092e('0x3')])_0x319d4b[_0x092e('0x3')]=_0x319d4b[_0x092e('0x3')][_0x092e('0x38')]();if(_0x2b5bdd['type']===_0x092e('0xe')){if(_0x319d4b['hasOwnProperty'](_0x092e('0x39'))&&_0x319d4b['tag']&&_0x319d4b[_0x092e('0x39')]!=='--'){_0x4bbe70[_0x092e('0xa')]({'type':_0x319d4b[_0x092e('0x3')][_0x092e('0x38')](),'app':_0x092e('0x4'),'appdata':_0x092e('0x3a')+_0x319d4b[_0x092e('0x39')],'context':_0x2b5bdd[_0x092e('0x5')],'exten':_0x2b5bdd[_0x092e('0x6')],'priority':_0x319d4b[_0x092e('0x36')][_0x092e('0x21')]+_0x18425c+_0x54eaa4++,'VoiceExtensionId':_0x2b5bdd['id']});}_0x4bbe70['push']({'type':_0x319d4b[_0x092e('0x3')][_0x092e('0x38')](),'app':_0x092e('0x15'),'appdata':_0x092e('0x3b')+(_0x319d4b['callerID']?_0x092e('0x3c')+_0x319d4b[_0x092e('0x3d')]+')':_0x092e('0x3e')),'context':_0x2b5bdd[_0x092e('0x5')],'exten':_0x2b5bdd['exten'],'priority':_0x319d4b[_0x092e('0x36')][_0x092e('0x21')]+_0x18425c+_0x54eaa4++,'VoiceExtensionId':_0x2b5bdd['id']});}else{if(_0x319d4b[_0x092e('0x1a')](_0x092e('0x3f'))){if([_0x092e('0x40'),_0x092e('0x41')][_0x092e('0x42')](_0x319d4b[_0x092e('0x43')][_0x092e('0x38')]())&&_0x319d4b[_0x092e('0x44')]!==_0x092e('0x45')){if(_0x319d4b[_0x092e('0x3f')]){_0x4bbe70['push']({'type':_0x319d4b[_0x092e('0x3')][_0x092e('0x38')](),'app':_0x092e('0x15'),'appdata':_0x092e('0x46'),'context':_0x2b5bdd[_0x092e('0x5')],'exten':_0x2b5bdd[_0x092e('0x6')],'priority':_0x319d4b[_0x092e('0x36')][_0x092e('0x21')]+_0x18425c+_0x54eaa4++,'VoiceExtensionId':_0x2b5bdd['id']});_0x4bbe70[_0x092e('0xa')]({'type':_0x319d4b[_0x092e('0x3')]['toLowerCase'](),'app':_0x092e('0x4'),'appdata':_0x092e('0x47'),'context':_0x2b5bdd[_0x092e('0x5')],'exten':_0x2b5bdd[_0x092e('0x6')],'priority':_0x319d4b[_0x092e('0x36')]['length']+_0x18425c+_0x54eaa4++,'VoiceExtensionId':_0x2b5bdd['id']});}else{_0x4bbe70[_0x092e('0xa')]({'type':_0x319d4b[_0x092e('0x3')][_0x092e('0x38')](),'app':_0x092e('0x15'),'appdata':_0x092e('0x48'),'context':_0x2b5bdd[_0x092e('0x5')],'exten':_0x2b5bdd[_0x092e('0x6')],'priority':_0x319d4b[_0x092e('0x36')][_0x092e('0x21')]+_0x18425c+_0x54eaa4++,'VoiceExtensionId':_0x2b5bdd['id']});_0x4bbe70[_0x092e('0xa')]({'type':_0x319d4b[_0x092e('0x3')][_0x092e('0x38')](),'app':_0x092e('0x4'),'appdata':_0x092e('0x49'),'context':_0x2b5bdd[_0x092e('0x5')],'exten':_0x2b5bdd[_0x092e('0x6')],'priority':_0x319d4b[_0x092e('0x36')]['length']+_0x18425c+_0x54eaa4++,'VoiceExtensionId':_0x2b5bdd['id']});}}}}for(var _0x12f5a8=0x0;_0x12f5a8<_0x319d4b[_0x092e('0x36')][_0x092e('0x21')];_0x12f5a8++){var _0x1eb763=_0x18425c+_0x319d4b[_0x092e('0x36')][_0x092e('0x21')];var _0x3b87ae=_0x12f5a8===_0x319d4b[_0x092e('0x36')][_0x092e('0x21')]-0x1?_0x18425c+_0x4bbe70[_0x092e('0x21')]+_0x9e1bf5[_0x092e('0x21')]+0x2:_0x18425c+_0x12f5a8+0x1;_0x4bbe70['splice'](_0x12f5a8,0x0,{'type':_0x2b5bdd[_0x092e('0x3')],'app':_0x092e('0x4a'),'appdata':_0x319d4b['intervals'][_0x12f5a8]+'?'+_0x2b5bdd[_0x092e('0x5')]+_0x092e('0x4b')+_0x1eb763+':'+_0x2b5bdd[_0x092e('0x5')]+_0x092e('0x4b')+_0x3b87ae,'exten':_0x2b5bdd[_0x092e('0x6')],'context':_0x2b5bdd['context'],'priority':_0x18425c+_0x12f5a8,'VoiceExtensionId':_0x2b5bdd['id']});}if(_0x319d4b[_0x092e('0x44')]==='outboundDial')_0x319d4b['appdata']=_0x541628(_0x2b5bdd,_0x319d4b['appdata']);_0x319d4b[_0x092e('0x4c')]=_0x4bbe70[_0x092e('0x21')]?_[_0x092e('0x4d')](_0x4bbe70)[_0x092e('0x4c')]+0x1:_0x18425c;_0x2709fc=_[_0x092e('0x4e')](_0x2709fc,_0x4bbe70,[_0x319d4b],_0x9e1bf5);_0x18425c=_[_0x092e('0x4d')](_0x2709fc)['priority']+0x1;}return _0x370ba5(_0x2709fc);})[_0x092e('0x4f')](function(_0x53399f){_0x479e91(_0x53399f);});});}return _0xfd835f[_0x092e('0x50')](_0x092e('0x51'),attributes,{'tableName':_0x092e('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2732a6){var _0xa15f7b=this[_0x092e('0x53')]({'plain':!![]});var _0x1c292b=_0xa15f7b[_0x092e('0x3')]==='outbound'?_0x13bdf1(_0xa15f7b):_0x10ccfe(_0xa15f7b);return _0x343a43(_0xa15f7b,_0x2732a6,_[_0x092e('0x4d')](_0x1c292b)[_0x092e('0x4c')]+0x1)[_0x092e('0x34')](function(_0x3fd4c8){var _0x1af177=_[_0x092e('0x4e')](_0x1c292b,_0x3fd4c8);_0x1af177[_0x092e('0xa')]({'type':_0xa15f7b[_0x092e('0x3')],'app':'Hangup','exten':_0xa15f7b[_0x092e('0x6')],'context':_0xa15f7b[_0x092e('0x5')],'priority':_['last'](_0x1af177)[_0x092e('0x4c')]+0x1,'VoiceExtensionId':_0xa15f7b['id']});return _0x1af177;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index c85511f..eb721f0 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 _0xbecd=['localhost','socket.io-emitter','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','map','model','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x45e89b,_0x3d3cfb){var _0x22857e=function(_0x633fe2){while(--_0x633fe2){_0x45e89b['push'](_0x45e89b['shift']());}};_0x22857e(++_0x3d3cfb);}(_0xbecd,0x6a));var _0xdbec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbecd[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdbec('0x0'));var util=require('util');var moment=require(_0xdbec('0x1'));var BPromise=require(_0xdbec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbec('0x3'));var db=require(_0xdbec('0x4'))['db'];var utils=require(_0xdbec('0x5'));var logger=require(_0xdbec('0x6'))(_0xdbec('0x7'));var config=require(_0xdbec('0x8'));var jayson=require(_0xdbec('0x9'));var client=jayson[_0xdbec('0xa')][_0xdbec('0xb')]({'port':0x232a});config[_0xdbec('0xc')]=_[_0xdbec('0xd')](config[_0xdbec('0xc')],{'host':_0xdbec('0xe'),'port':0x18eb});var socket=require(_0xdbec('0xf'))(new Redis(config[_0xdbec('0xc')]));require('./voiceExtension.socket')[_0xdbec('0x10')](socket);function respondWithRpcPromise(_0x5419ab,_0x5f363f,_0x57013c){return new BPromise(function(_0x5afc70,_0x19c62a){return client[_0xdbec('0x11')](_0x5419ab,_0x57013c)['then'](function(_0x3aea6a){logger[_0xdbec('0x12')](_0xdbec('0x13'),_0x5f363f,_0xdbec('0x14'));logger[_0xdbec('0x15')](_0xdbec('0x16'),_0x5f363f,'request\x20sent',JSON[_0xdbec('0x17')](_0x3aea6a));if(_0x3aea6a[_0xdbec('0x18')]){if(_0x3aea6a['error'][_0xdbec('0x19')]===0x1f4){logger[_0xdbec('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x5f363f,_0x3aea6a[_0xdbec('0x18')]['message']);return _0x19c62a(_0x3aea6a[_0xdbec('0x18')]['message']);}logger[_0xdbec('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x5f363f,_0x3aea6a['error'][_0xdbec('0x1a')]);return _0x5afc70(_0x3aea6a[_0xdbec('0x18')][_0xdbec('0x1a')]);}else{logger[_0xdbec('0x12')](_0xdbec('0x13'),_0x5f363f,_0xdbec('0x14'));_0x5afc70(_0x3aea6a[_0xdbec('0x1b')]['message']);}})[_0xdbec('0x1c')](function(_0x439bd9){logger[_0xdbec('0x18')](_0xdbec('0x13'),_0x5f363f,_0x439bd9);_0x19c62a(_0x439bd9);});});}exports[_0xdbec('0x1d')]=function(_0xa729e5){var _0xfb5eaa=this;return new Promise(function(_0x552180,_0x405a2a){return db[_0xdbec('0x1e')][_0xdbec('0x1f')]({'raw':_0xa729e5['options']?_0xa729e5[_0xdbec('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0xa729e5[_0xdbec('0x20')]?_0xa729e5[_0xdbec('0x20')][_0xdbec('0x21')]||null:null,'attributes':_0xa729e5[_0xdbec('0x20')]?_0xa729e5[_0xdbec('0x20')][_0xdbec('0x22')]||null:null,'limit':_0xa729e5[_0xdbec('0x20')]?_0xa729e5[_0xdbec('0x20')][_0xdbec('0x23')]||null:null,'include':_0xa729e5[_0xdbec('0x20')]?_0xa729e5[_0xdbec('0x20')][_0xdbec('0x24')]?_[_0xdbec('0x25')](_0xa729e5[_0xdbec('0x20')][_0xdbec('0x24')],function(_0x267b7e){return{'model':db[_0x267b7e[_0xdbec('0x26')]],'as':_0x267b7e['as'],'attributes':_0x267b7e[_0xdbec('0x22')],'include':_0x267b7e[_0xdbec('0x24')]?_[_0xdbec('0x25')](_0x267b7e[_0xdbec('0x24')],function(_0x4e6c61){return{'model':db[_0x4e6c61[_0xdbec('0x26')]],'as':_0x4e6c61['as'],'attributes':_0x4e6c61[_0xdbec('0x22')],'include':_0x4e6c61[_0xdbec('0x24')]?_[_0xdbec('0x25')](_0x4e6c61[_0xdbec('0x24')],function(_0x3e368c){return{'model':db[_0x3e368c['model']],'as':_0x3e368c['as'],'attributes':_0x3e368c[_0xdbec('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdbec('0x27')](function(_0x2696ef){logger['info'](_0xdbec('0x1d'),_0xa729e5);logger['debug'](_0xdbec('0x1d'),_0xa729e5,JSON['stringify'](_0x2696ef));_0x552180(_0x2696ef);})[_0xdbec('0x1c')](function(_0x4f73be){logger[_0xdbec('0x18')](_0xdbec('0x1d'),_0x4f73be[_0xdbec('0x1a')],_0xa729e5);_0x405a2a(_0xfb5eaa['error'](0x1f4,_0x4f73be['message']));});});}; \ No newline at end of file +var _0x8ac9=['defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceExtension,\x20%s,\x20%s','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x38d7fd,_0x4a91af){var _0x451896=function(_0x21e4aa){while(--_0x21e4aa){_0x38d7fd['push'](_0x38d7fd['shift']());}};_0x451896(++_0x4a91af);}(_0x8ac9,0x199));var _0x98ac=function(_0x851fa9,_0x5b6f67){_0x851fa9=_0x851fa9-0x0;var _0x2765f9=_0x8ac9[_0x851fa9];return _0x2765f9;};'use strict';var _=require(_0x98ac('0x0'));var util=require(_0x98ac('0x1'));var moment=require(_0x98ac('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98ac('0x3'));var db=require(_0x98ac('0x4'))['db'];var utils=require(_0x98ac('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x98ac('0x6'));var jayson=require(_0x98ac('0x7'));var client=jayson[_0x98ac('0x8')]['http']({'port':0x232a});config['redis']=_[_0x98ac('0x9')](config[_0x98ac('0xa')],{'host':_0x98ac('0xb'),'port':0x18eb});var socket=require(_0x98ac('0xc'))(new Redis(config[_0x98ac('0xa')]));require(_0x98ac('0xd'))['register'](socket);function respondWithRpcPromise(_0x3335ce,_0x55e46f,_0xb21a9d){return new BPromise(function(_0x432461,_0x8f058c){return client[_0x98ac('0xe')](_0x3335ce,_0xb21a9d)[_0x98ac('0xf')](function(_0x4724b6){logger[_0x98ac('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x55e46f,'request\x20sent');logger[_0x98ac('0x11')](_0x98ac('0x12'),_0x55e46f,_0x98ac('0x13'),JSON[_0x98ac('0x14')](_0x4724b6));if(_0x4724b6['error']){if(_0x4724b6[_0x98ac('0x15')][_0x98ac('0x16')]===0x1f4){logger[_0x98ac('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x55e46f,_0x4724b6['error'][_0x98ac('0x17')]);return _0x8f058c(_0x4724b6[_0x98ac('0x15')]['message']);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x55e46f,_0x4724b6[_0x98ac('0x15')][_0x98ac('0x17')]);return _0x432461(_0x4724b6['error'][_0x98ac('0x17')]);}else{logger[_0x98ac('0x10')](_0x98ac('0x18'),_0x55e46f,'request\x20sent');_0x432461(_0x4724b6[_0x98ac('0x19')][_0x98ac('0x17')]);}})[_0x98ac('0x1a')](function(_0x48f000){logger[_0x98ac('0x15')](_0x98ac('0x18'),_0x55e46f,_0x48f000);_0x8f058c(_0x48f000);});});}exports[_0x98ac('0x1b')]=function(_0x2d368b){var _0x5820ee=this;return new Promise(function(_0x5adc38,_0xbaf1a3){return db[_0x98ac('0x1c')][_0x98ac('0x1d')]({'raw':_0x2d368b[_0x98ac('0x1e')]?_0x2d368b[_0x98ac('0x1e')][_0x98ac('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d368b[_0x98ac('0x1e')]?_0x2d368b[_0x98ac('0x1e')][_0x98ac('0x20')]||null:null,'attributes':_0x2d368b['options']?_0x2d368b[_0x98ac('0x1e')][_0x98ac('0x21')]||null:null,'limit':_0x2d368b['options']?_0x2d368b[_0x98ac('0x1e')][_0x98ac('0x22')]||null:null,'include':_0x2d368b['options']?_0x2d368b[_0x98ac('0x1e')][_0x98ac('0x23')]?_[_0x98ac('0x24')](_0x2d368b['options'][_0x98ac('0x23')],function(_0xf55309){return{'model':db[_0xf55309[_0x98ac('0x25')]],'as':_0xf55309['as'],'attributes':_0xf55309[_0x98ac('0x21')],'include':_0xf55309[_0x98ac('0x23')]?_[_0x98ac('0x24')](_0xf55309[_0x98ac('0x23')],function(_0x3d1110){return{'model':db[_0x3d1110[_0x98ac('0x25')]],'as':_0x3d1110['as'],'attributes':_0x3d1110[_0x98ac('0x21')],'include':_0x3d1110['include']?_[_0x98ac('0x24')](_0x3d1110[_0x98ac('0x23')],function(_0x211b7a){return{'model':db[_0x211b7a[_0x98ac('0x25')]],'as':_0x211b7a['as'],'attributes':_0x211b7a[_0x98ac('0x21')]};}):[]};}):[]};}):[]:[]})[_0x98ac('0xf')](function(_0x2ab97e){logger['info']('GetVoiceExtension',_0x2d368b);logger[_0x98ac('0x11')](_0x98ac('0x1b'),_0x2d368b,JSON[_0x98ac('0x14')](_0x2ab97e));_0x5adc38(_0x2ab97e);})[_0x98ac('0x1a')](function(_0x2c57b1){logger[_0x98ac('0x15')](_0x98ac('0x1b'),_0x2c57b1[_0x98ac('0x17')],_0x2d368b);_0xbaf1a3(_0x5820ee[_0x98ac('0x15')](0x1f4,_0x2c57b1[_0x98ac('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 48b748f..d124360 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 _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x17ef89,_0x19e025){var _0x1c8f76=function(_0x170785){while(--_0x170785){_0x17ef89['push'](_0x17ef89['shift']());}};_0x1c8f76(++_0x19e025);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0x814b,0x1a2));var _0xb814=function(_0x5a488c,_0x4cc470){_0x5a488c=_0x5a488c-0x0;var _0x53a7d6=_0x814b[_0x5a488c];return _0x53a7d6;};'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 diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 9305d0c..48a4684 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 _0xd046=['get','show','getMessages','isAuthenticated','update','delete','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./voiceMail.controller','index'];(function(_0x37deac,_0x5bd3bc){var _0xf5d4e1=function(_0x49012c){while(--_0x49012c){_0x37deac['push'](_0x37deac['shift']());}};_0xf5d4e1(++_0x5bd3bc);}(_0xd046,0x129));var _0x6d04=function(_0x57669f,_0x2196b8){_0x57669f=_0x57669f-0x0;var _0x183977=_0xd046[_0x57669f];return _0x183977;};'use strict';var multer=require('multer');var util=require(_0x6d04('0x0'));var path=require(_0x6d04('0x1'));var timeout=require(_0x6d04('0x2'));var express=require('express');var router=express[_0x6d04('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d04('0x4'));var config=require('../../config/environment');var controller=require(_0x6d04('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x6d04('0x6')]);router[_0x6d04('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x6d04('0x8')]);router[_0x6d04('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6d04('0x9')]);router['post']('/',auth[_0x6d04('0xa')](),controller['create']);router['put']('/:id',auth[_0x6d04('0xa')](),controller[_0x6d04('0xb')]);router[_0x6d04('0xc')](_0x6d04('0xd'),auth['isAuthenticated'](),controller[_0x6d04('0xe')]);module[_0x6d04('0xf')]=router; \ No newline at end of file +var _0x2675=['post','create','update','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show'];(function(_0x16bafa,_0x4d2c86){var _0x4d7f09=function(_0x2808f1){while(--_0x2808f1){_0x16bafa['push'](_0x16bafa['shift']());}};_0x4d7f09(++_0x4d2c86);}(_0x2675,0x75));var _0x5267=function(_0x25aa23,_0x1e21a1){_0x25aa23=_0x25aa23-0x0;var _0x30ee57=_0x2675[_0x25aa23];return _0x30ee57;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5267('0x3'));var interaction=require(_0x5267('0x4'));var config=require('../../config/environment');var controller=require(_0x5267('0x5'));router[_0x5267('0x6')]('/',auth[_0x5267('0x7')](),controller[_0x5267('0x8')]);router[_0x5267('0x6')](_0x5267('0x9'),auth['isAuthenticated'](),controller[_0x5267('0xa')]);router[_0x5267('0x6')]('/:id/messages',auth[_0x5267('0x7')](),controller['getMessages']);router[_0x5267('0xb')]('/',auth[_0x5267('0x7')](),controller[_0x5267('0xc')]);router['put'](_0x5267('0x9'),auth['isAuthenticated'](),controller[_0x5267('0xd')]);router['delete'](_0x5267('0x9'),auth[_0x5267('0x7')](),controller[_0x5267('0xe')]);module[_0x5267('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 4b979b0..7150a19 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 _0x5447=['fullname','\x20-\x20','mailbox','sequelize','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER'];(function(_0xea40fe,_0x4f55d7){var _0x5a8a4f=function(_0x29796a){while(--_0x29796a){_0xea40fe['push'](_0xea40fe['shift']());}};_0x5a8a4f(++_0x4f55d7);}(_0x5447,0x17a));var _0x7544=function(_0x3bea1a,_0x420ac9){_0x3bea1a=_0x3bea1a-0x0;var _0x230889=_0x5447[_0x3bea1a];return _0x230889;};'use strict';var Sequelize=require(_0x7544('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x7544('0x1')]},'context':{'type':Sequelize[_0x7544('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x7544('0x1')],'defaultValue':'','allowNull':![],'unique':_0x7544('0x2')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x7544('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0xdca091){this[_0x7544('0x3')](_0x7544('0x4'),typeof _0xdca091===_0x7544('0x5')&&_0xdca091['trim']()?_0xdca091[_0x7544('0x6')]():null);}},'pager':{'type':Sequelize[_0x7544('0x1')]},'tz':{'type':Sequelize[_0x7544('0x1')],'defaultValue':_0x7544('0x7')},'attach':{'type':Sequelize[_0x7544('0x8')]('yes','no'),'defaultValue':_0x7544('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x7544('0x8')](_0x7544('0x9'),'no'),'defaultValue':_0x7544('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x7544('0x1')]},'review':{'type':Sequelize[_0x7544('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7544('0x8')](_0x7544('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7544('0x8')](_0x7544('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x7544('0x8')](_0x7544('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7544('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x7544('0x8')](_0x7544('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7544('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7544('0x8')](_0x7544('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x7544('0x8')](_0x7544('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7544('0x8')](_0x7544('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7544('0x8')](_0x7544('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x7544('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x7544('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7544('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x7544('0xc'))+_0x7544('0xd')+this['getDataValue'](_0x7544('0xe'));}}}; \ No newline at end of file +var _0xef0f=['sequelize','exports','from-voicemail','contest_mailbox','STRING','setDataValue','email','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','\x20-\x20','getDataValue','mailbox'];(function(_0xa5c905,_0x347339){var _0x513650=function(_0x150e58){while(--_0x150e58){_0xa5c905['push'](_0xa5c905['shift']());}};_0x513650(++_0x347339);}(_0xef0f,0x1dc));var _0xfef0=function(_0x50cde4,_0x50b225){_0x50cde4=_0x50cde4-0x0;var _0x3eca5f=_0xef0f[_0x50cde4];return _0x3eca5f;};'use strict';var Sequelize=require(_0xfef0('0x0'));module[_0xfef0('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0xfef0('0x2'),'unique':_0xfef0('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xfef0('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xfef0('0x4')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2fb58b){this[_0xfef0('0x5')](_0xfef0('0x6'),typeof _0x2fb58b==='string'&&_0x2fb58b[_0xfef0('0x7')]()?_0x2fb58b[_0xfef0('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xfef0('0x4')],'defaultValue':_0xfef0('0x8')},'attach':{'type':Sequelize[_0xfef0('0x9')](_0xfef0('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xfef0('0x9')](_0xfef0('0xa'),'no'),'defaultValue':_0xfef0('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfef0('0x4')]},'callback':{'type':Sequelize[_0xfef0('0x4')]},'review':{'type':Sequelize[_0xfef0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfef0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfef0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfef0('0x9')](_0xfef0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfef0('0x9')](_0xfef0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xfef0('0x9')](_0xfef0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfef0('0x9')](_0xfef0('0xa'),'no'),'defaultValue':_0xfef0('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xfef0('0x9')](_0xfef0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfef0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfef0('0x9')](_0xfef0('0xa'),'no'),'defaultValue':_0xfef0('0xa'),'allowNull':![]},'stamp':{'type':_0xfef0('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xfef0('0x4')]},'maxsecs':{'type':Sequelize[_0xfef0('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xfef0('0xd')],'get':function(){return this['getDataValue']('fullname')+_0xfef0('0xe')+this[_0xfef0('0xf')](_0xfef0('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 5dad777..c602bd2 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 _0x750a=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','json','destroy','then','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceMail','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','body','getMessages','findOne','VoiceMailMessage','length','findAndCountAll','rimraf','request-promise','moment','bluebird'];(function(_0x401b3e,_0xed8de5){var _0x4f290f=function(_0xa45f77){while(--_0xa45f77){_0x401b3e['push'](_0x401b3e['shift']());}};_0x4f290f(++_0xed8de5);}(_0x750a,0x140));var _0xa750=function(_0x3b6732,_0x4e47a9){_0x3b6732=_0x3b6732-0x0;var _0x218263=_0x750a[_0x3b6732];return _0x218263;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa750('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa750('0x1'));var moment=require(_0xa750('0x2'));var BPromise=require(_0xa750('0x3'));var Mustache=require(_0xa750('0x4'));var util=require(_0xa750('0x5'));var path=require(_0xa750('0x6'));var sox=require(_0xa750('0x7'));var csv=require(_0xa750('0x8'));var ejs=require(_0xa750('0x9'));var fs=require('fs');var fs_extra=require(_0xa750('0xa'));var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x8'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var licenseUtil=require(_0xa750('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ec62,_0x1c5657){_0x1c5657=_0x1c5657||0xcc;return function(_0x344c67){if(_0x344c67){return _0x24ec62['sendStatus'](_0x1c5657);}return _0x24ec62[_0xa750('0x15')](_0x1c5657)[_0xa750('0x16')]();};}function respondWithResult(_0x2d3421,_0x24e48a){_0x24e48a=_0x24e48a||0xc8;return function(_0xa66181){if(_0xa66181){return _0x2d3421[_0xa750('0x15')](_0x24e48a)['json'](_0xa66181);}};}function respondWithFilteredResult(_0x3ae2a1,_0x8488ea){return function(_0x290d46){if(_0x290d46){var _0x49fe3b=typeof _0x8488ea[_0xa750('0x17')]===_0xa750('0x18')&&typeof _0x8488ea['limit']==='undefined';var _0x321eb2=_0x290d46['count'];var _0x433dbd=_0x49fe3b?0x0:_0x8488ea[_0xa750('0x17')];var _0x4f1faa=_0x49fe3b?_0x290d46[_0xa750('0x19')]:_0x8488ea['offset']+_0x8488ea['limit'];var _0x25e335;if(_0x4f1faa>=_0x321eb2){_0x4f1faa=_0x321eb2;_0x25e335=0xc8;}else{_0x25e335=0xce;}_0x3ae2a1['status'](_0x25e335);return _0x3ae2a1[_0xa750('0x1a')]('Content-Range',_0x433dbd+'-'+_0x4f1faa+'/'+_0x321eb2)[_0xa750('0x1b')](_0x290d46);}return null;};}function patchUpdates(_0x4a007d){return function(_0x3dc7f1){try{jsonpatch['apply'](_0x3dc7f1,_0x4a007d,!![]);}catch(_0x1efb68){return BPromise['reject'](_0x1efb68);}return _0x3dc7f1['save']();};}function saveUpdates(_0xaa9d3e,_0x52da84){return function(_0x216fbf){if(_0x216fbf){return _0x216fbf['update'](_0xaa9d3e)['then'](function(_0x5b433d){return _0x5b433d;});}return null;};}function removeEntity(_0x5d758e,_0x15d72f){return function(_0x2ec6c4){if(_0x2ec6c4){return _0x2ec6c4[_0xa750('0x1c')]()[_0xa750('0x1d')](function(){var _0x1b80a5=_0x2ec6c4[_0xa750('0x1e')]({'plain':!![]});var _0x3001bc=_0xa750('0x1f');return db[_0xa750('0x20')][_0xa750('0x1c')]({'where':{'type':_0x3001bc,'resourceId':_0x1b80a5['id']}})[_0xa750('0x1d')](function(){return _0x2ec6c4;});})[_0xa750('0x1d')](function(){_0x5d758e[_0xa750('0x15')](0xcc)[_0xa750('0x16')]();});}};}function handleEntityNotFound(_0x310e2d,_0x4ffff4){return function(_0x3d3923){if(!_0x3d3923){_0x310e2d[_0xa750('0x21')](0x194);}return _0x3d3923;};}function handleError(_0x21cd2c,_0x4cceee){_0x4cceee=_0x4cceee||0x1f4;return function(_0x35ab53){logger[_0xa750('0x22')](_0x35ab53[_0xa750('0x23')]);if(_0x35ab53[_0xa750('0x24')]){delete _0x35ab53['name'];}_0x21cd2c[_0xa750('0x15')](_0x4cceee)[_0xa750('0x25')](_0x35ab53);};}exports[_0xa750('0x26')]=function(_0x2aef3a,_0x2c5253){var _0x59ab33={},_0x46cc11={},_0x4c2c9e={'count':0x0,'rows':[]};var _0x2d0e93=_[_0xa750('0x27')](db['VoiceMail'][_0xa750('0x28')],function(_0x6bc25d){return{'name':_0x6bc25d[_0xa750('0x29')],'type':_0x6bc25d[_0xa750('0x2a')][_0xa750('0x2b')]};});_0x46cc11[_0xa750('0x2c')]=_[_0xa750('0x27')](_0x2d0e93,_0xa750('0x24'));_0x46cc11['query']=_[_0xa750('0x2d')](_0x2aef3a['query']);_0x46cc11[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],_0x46cc11[_0xa750('0x30')]);_0x59ab33['attributes']=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],qs['fields'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x31')]));_0x59ab33[_0xa750('0x32')]=_0x59ab33[_0xa750('0x32')]['length']?_0x59ab33[_0xa750('0x32')]:_0x46cc11['model'];if(!_0x2aef3a['query'][_0xa750('0x33')](_0xa750('0x34'))){_0x59ab33[_0xa750('0x35')]=qs['limit'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x35')]);_0x59ab33[_0xa750('0x17')]=qs['offset'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x17')]);}_0x59ab33[_0xa750('0x36')]=qs['sort'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x37')]);_0x59ab33[_0xa750('0x38')]=qs['filters'](_[_0xa750('0x39')](_0x2aef3a[_0xa750('0x30')],_0x46cc11[_0xa750('0x2e')]),_0x2d0e93);if(_0x2aef3a[_0xa750('0x30')]['filter']){_0x59ab33['where']=_[_0xa750('0x3a')](_0x59ab33[_0xa750('0x38')],{'$or':_['map'](_0x2d0e93,function(_0x43dc3a){if(_0x43dc3a[_0xa750('0x2a')]!==_0xa750('0x3b')){var _0x1166ff={};_0x1166ff[_0x43dc3a[_0xa750('0x24')]]={'$like':'%'+_0x2aef3a['query'][_0xa750('0x3c')]+'%'};return _0x1166ff;}})});}_0x59ab33=_[_0xa750('0x3a')]({},_0x59ab33,_0x2aef3a[_0xa750('0x3d')]);var _0x134874={'where':_0x59ab33[_0xa750('0x38')]};return db[_0xa750('0x3e')][_0xa750('0x19')](_0x134874)['then'](function(_0x3daa38){_0x4c2c9e['count']=_0x3daa38;if(_0x2aef3a[_0xa750('0x30')]['includeAll']){_0x59ab33[_0xa750('0x3f')]=[{'all':!![]}];}return db[_0xa750('0x3e')][_0xa750('0x40')](_0x59ab33);})[_0xa750('0x1d')](function(_0x430d60){_0x4c2c9e[_0xa750('0x41')]=_0x430d60;return _0x4c2c9e;})[_0xa750('0x1d')](respondWithFilteredResult(_0x2c5253,_0x59ab33))[_0xa750('0x42')](handleError(_0x2c5253,null));};exports[_0xa750('0x43')]=function(_0x108a1a,_0x36a8d6){var _0x1458f1={'raw':!![],'where':{'id':_0x108a1a[_0xa750('0x44')]['id']}},_0x3ec860={};_0x3ec860[_0xa750('0x2c')]=_[_0xa750('0x2d')](db[_0xa750('0x3e')][_0xa750('0x28')]);_0x3ec860[_0xa750('0x30')]=_[_0xa750('0x2d')](_0x108a1a['query']);_0x3ec860[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],_0x3ec860[_0xa750('0x30')]);_0x1458f1[_0xa750('0x32')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],qs[_0xa750('0x31')](_0x108a1a[_0xa750('0x30')]['fields']));_0x1458f1[_0xa750('0x32')]=_0x1458f1[_0xa750('0x32')]['length']?_0x1458f1[_0xa750('0x32')]:_0x3ec860[_0xa750('0x2c')];if(_0x108a1a[_0xa750('0x30')][_0xa750('0x45')]){_0x1458f1[_0xa750('0x3f')]=[{'all':!![]}];}_0x1458f1=_[_0xa750('0x3a')]({},_0x1458f1,_0x108a1a[_0xa750('0x3d')]);return db[_0xa750('0x3e')][_0xa750('0x46')](_0x1458f1)[_0xa750('0x1d')](handleEntityNotFound(_0x36a8d6,null))['then'](respondWithResult(_0x36a8d6,null))[_0xa750('0x42')](handleError(_0x36a8d6,null));};exports[_0xa750('0x47')]=function(_0x58afd2,_0x93e49f){return db[_0xa750('0x3e')][_0xa750('0x47')](_0x58afd2['body'],{})[_0xa750('0x1d')](function(_0x3fc623){var _0x1e5a9a=_0x58afd2[_0xa750('0x48')]['get']({'plain':!![]});if(!_0x1e5a9a)throw new Error(_0xa750('0x49'));if(_0x1e5a9a[_0xa750('0x4a')]===_0xa750('0x48')){var _0xed4f88=_0x3fc623['get']({'plain':!![]});var _0x203f2a=_0xa750('0x1f');return db['UserProfileSection'][_0xa750('0x46')]({'where':{'name':_0x203f2a,'userProfileId':_0x1e5a9a['userProfileId']},'raw':!![]})[_0xa750('0x1d')](function(_0x69995b){if(_0x69995b&&_0x69995b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xed4f88[_0xa750('0x24')],'resourceId':_0xed4f88['id'],'type':_0x69995b[_0xa750('0x24')],'sectionId':_0x69995b['id']},{})['then'](function(){return _0x3fc623;});}else{return _0x3fc623;}})[_0xa750('0x42')](function(_0x1a79a9){logger[_0xa750('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a79a9);throw _0x1a79a9;});}return _0x3fc623;})['then'](respondWithResult(_0x93e49f,0xc9))['catch'](handleError(_0x93e49f,null));};exports['update']=function(_0x3c34d4,_0x4a1b5d){if(_0x3c34d4[_0xa750('0x4b')]['id']){delete _0x3c34d4[_0xa750('0x4b')]['id'];}return db['VoiceMail'][_0xa750('0x46')]({'where':{'id':_0x3c34d4['params']['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x4a1b5d,null))['then'](saveUpdates(_0x3c34d4['body'],null))['then'](respondWithResult(_0x4a1b5d,null))['catch'](handleError(_0x4a1b5d,null));};exports[_0xa750('0x1c')]=function(_0x40dac2,_0x5f1313){return db['VoiceMail']['find']({'where':{'id':_0x40dac2[_0xa750('0x44')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x5f1313,null))[_0xa750('0x1d')](removeEntity(_0x5f1313,null))[_0xa750('0x42')](handleError(_0x5f1313,null));};exports[_0xa750('0x4c')]=function(_0x13528a,_0x599e7e,_0x590b1c){return db[_0xa750('0x3e')][_0xa750('0x4d')]({'where':{'id':_0x13528a[_0xa750('0x44')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x599e7e,null))[_0xa750('0x1d')](function(_0x5a3cd5){var _0x4030b3;var _0xaa63be={},_0x2c7dd0={};_0x2c7dd0[_0xa750('0x2c')]=_[_0xa750('0x2d')](db[_0xa750('0x4e')][_0xa750('0x28')]);_0x2c7dd0[_0xa750('0x30')]=_['keys'](_0x13528a[_0xa750('0x30')]);_0x2c7dd0[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x2c7dd0[_0xa750('0x2c')],_0x2c7dd0[_0xa750('0x30')]);_0xaa63be['attributes']=_[_0xa750('0x2f')](_0x2c7dd0[_0xa750('0x2c')],qs[_0xa750('0x31')](_0x13528a[_0xa750('0x30')][_0xa750('0x31')]));_0xaa63be[_0xa750('0x32')]=_0xaa63be[_0xa750('0x32')][_0xa750('0x4f')]?_0xaa63be[_0xa750('0x32')]:_0x2c7dd0[_0xa750('0x2c')];if(!_0x13528a[_0xa750('0x30')][_0xa750('0x33')](_0xa750('0x34'))){_0xaa63be[_0xa750('0x35')]=qs[_0xa750('0x35')](_0x13528a[_0xa750('0x30')]['limit']);_0xaa63be[_0xa750('0x17')]=qs['offset'](_0x13528a[_0xa750('0x30')][_0xa750('0x17')]);}_0xaa63be[_0xa750('0x36')]=qs['sort'](_0x13528a[_0xa750('0x30')][_0xa750('0x37')]);_0xaa63be[_0xa750('0x38')]=qs[_0xa750('0x2e')](_[_0xa750('0x39')](_0x13528a[_0xa750('0x30')],_0x2c7dd0['filters']));if(_0x13528a[_0xa750('0x30')][_0xa750('0x3c')]){_0xaa63be['where']=_[_0xa750('0x3a')](_0xaa63be[_0xa750('0x38')],{'$or':_[_0xa750('0x27')](_0xaa63be[_0xa750('0x32')],function(_0x3255c7){var _0x1b7597={};_0x1b7597[_0x3255c7]={'$like':'%'+_0x13528a[_0xa750('0x30')][_0xa750('0x3c')]+'%'};return _0x1b7597;})});}_0xaa63be[_0xa750('0x38')]=_[_0xa750('0x3a')](_0xaa63be[_0xa750('0x38')],{'mailboxuser':_0x5a3cd5['mailbox']});_0xaa63be=_['merge']({},_0xaa63be,_0x13528a[_0xa750('0x3d')]);return db[_0xa750('0x4e')][_0xa750('0x50')](_0xaa63be)[_0xa750('0x1d')](respondWithFilteredResult(_0x599e7e,_0xaa63be));})['catch'](handleError(_0x599e7e,null));}; \ No newline at end of file +var _0x34b7=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','VoiceMailMessage','nolimit','mailbox','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','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','limit','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','end','error','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys'];(function(_0x499a98,_0x46d30d){var _0x32f7df=function(_0x503c48){while(--_0x503c48){_0x499a98['push'](_0x499a98['shift']());}};_0x32f7df(++_0x46d30d);}(_0x34b7,0x196));var _0x734b=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0x34b7[_0x586fa2];return _0x515be9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){var _0x104fff=_0x46d432[_0x734b('0x26')]({'plain':!![]});var _0x3abbe6=_0x734b('0x27');return db[_0x734b('0x28')][_0x734b('0x25')]({'where':{'type':_0x3abbe6,'resourceId':_0x104fff['id']}})['then'](function(){return _0x46d432;});})['then'](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x29')]();});}};}function handleEntityNotFound(_0x47a0a9,_0x32ea00){return function(_0x2dd51a){if(!_0x2dd51a){_0x47a0a9[_0x734b('0x18')](0x194);}return _0x2dd51a;};}function handleError(_0x41b501,_0x43edea){_0x43edea=_0x43edea||0x1f4;return function(_0x1b8295){logger[_0x734b('0x2a')](_0x1b8295['stack']);if(_0x1b8295[_0x734b('0x2b')]){delete _0x1b8295[_0x734b('0x2b')];}_0x41b501[_0x734b('0x19')](_0x43edea)[_0x734b('0x2c')](_0x1b8295);};}exports[_0x734b('0x2d')]=function(_0x427c36,_0x1fed72){var _0x21ed3c={},_0x371ead={},_0x3065b0={'count':0x0,'rows':[]};var _0x5dcabf=_[_0x734b('0x2e')](db[_0x734b('0x2f')]['rawAttributes'],function(_0xbbe037){return{'name':_0xbbe037[_0x734b('0x30')],'type':_0xbbe037[_0x734b('0x31')][_0x734b('0x32')]};});_0x371ead[_0x734b('0x33')]=_[_0x734b('0x2e')](_0x5dcabf,_0x734b('0x2b'));_0x371ead[_0x734b('0x34')]=_[_0x734b('0x35')](_0x427c36[_0x734b('0x34')]);_0x371ead[_0x734b('0x36')]=_[_0x734b('0x37')](_0x371ead[_0x734b('0x33')],_0x371ead[_0x734b('0x34')]);_0x21ed3c[_0x734b('0x38')]=_['intersection'](_0x371ead[_0x734b('0x33')],qs['fields'](_0x427c36[_0x734b('0x34')][_0x734b('0x39')]));_0x21ed3c[_0x734b('0x38')]=_0x21ed3c[_0x734b('0x38')][_0x734b('0x3a')]?_0x21ed3c[_0x734b('0x38')]:_0x371ead['model'];if(!_0x427c36['query'][_0x734b('0x3b')]('nolimit')){_0x21ed3c[_0x734b('0x1e')]=qs['limit'](_0x427c36[_0x734b('0x34')]['limit']);_0x21ed3c[_0x734b('0x1b')]=qs['offset'](_0x427c36[_0x734b('0x34')][_0x734b('0x1b')]);}_0x21ed3c[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x427c36[_0x734b('0x34')][_0x734b('0x3d')]);_0x21ed3c[_0x734b('0x3e')]=qs['filters'](_[_0x734b('0x3f')](_0x427c36[_0x734b('0x34')],_0x371ead['filters']),_0x5dcabf);if(_0x427c36[_0x734b('0x34')][_0x734b('0x40')]){_0x21ed3c[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x21ed3c['where'],{'$or':_[_0x734b('0x2e')](_0x5dcabf,function(_0x352d28){if(_0x352d28['type']!==_0x734b('0x42')){var _0x1e1689={};_0x1e1689[_0x352d28['name']]={'$like':'%'+_0x427c36[_0x734b('0x34')][_0x734b('0x40')]+'%'};return _0x1e1689;}})});}_0x21ed3c=_[_0x734b('0x41')]({},_0x21ed3c,_0x427c36[_0x734b('0x43')]);var _0x56eb35={'where':_0x21ed3c['where']};return db[_0x734b('0x2f')]['count'](_0x56eb35)['then'](function(_0x121a00){_0x3065b0['count']=_0x121a00;if(_0x427c36[_0x734b('0x34')]['includeAll']){_0x21ed3c[_0x734b('0x44')]=[{'all':!![]}];}return db[_0x734b('0x2f')][_0x734b('0x45')](_0x21ed3c);})['then'](function(_0x5cf3a0){_0x3065b0[_0x734b('0x46')]=_0x5cf3a0;return _0x3065b0;})['then'](respondWithFilteredResult(_0x1fed72,_0x21ed3c))['catch'](handleError(_0x1fed72,null));};exports[_0x734b('0x47')]=function(_0x159db9,_0x58f78a){var _0x2e789e={'raw':!![],'where':{'id':_0x159db9[_0x734b('0x48')]['id']}},_0x513f07={};_0x513f07[_0x734b('0x33')]=_[_0x734b('0x35')](db['VoiceMail'][_0x734b('0x49')]);_0x513f07[_0x734b('0x34')]=_[_0x734b('0x35')](_0x159db9[_0x734b('0x34')]);_0x513f07['filters']=_['intersection'](_0x513f07['model'],_0x513f07[_0x734b('0x34')]);_0x2e789e['attributes']=_['intersection'](_0x513f07[_0x734b('0x33')],qs['fields'](_0x159db9[_0x734b('0x34')][_0x734b('0x39')]));_0x2e789e[_0x734b('0x38')]=_0x2e789e[_0x734b('0x38')]['length']?_0x2e789e[_0x734b('0x38')]:_0x513f07['model'];if(_0x159db9[_0x734b('0x34')][_0x734b('0x4a')]){_0x2e789e[_0x734b('0x44')]=[{'all':!![]}];}_0x2e789e=_['merge']({},_0x2e789e,_0x159db9[_0x734b('0x43')]);return db['VoiceMail'][_0x734b('0x4b')](_0x2e789e)[_0x734b('0x24')](handleEntityNotFound(_0x58f78a,null))['then'](respondWithResult(_0x58f78a,null))[_0x734b('0x4c')](handleError(_0x58f78a,null));};exports[_0x734b('0x4d')]=function(_0x145ced,_0x38125a){return db[_0x734b('0x2f')]['create'](_0x145ced[_0x734b('0x4e')],{})['then'](function(_0x171575){var _0x5de7b7=_0x145ced[_0x734b('0x4f')][_0x734b('0x26')]({'plain':!![]});if(!_0x5de7b7)throw new Error(_0x734b('0x50'));if(_0x5de7b7[_0x734b('0x51')]===_0x734b('0x4f')){var _0x4b70f2=_0x171575['get']({'plain':!![]});var _0x484156=_0x734b('0x27');return db[_0x734b('0x52')]['find']({'where':{'name':_0x484156,'userProfileId':_0x5de7b7[_0x734b('0x53')]},'raw':!![]})[_0x734b('0x24')](function(_0x588ceb){if(_0x588ceb&&_0x588ceb[_0x734b('0x54')]===0x0){return db[_0x734b('0x28')][_0x734b('0x4d')]({'name':_0x4b70f2['name'],'resourceId':_0x4b70f2['id'],'type':_0x588ceb[_0x734b('0x2b')],'sectionId':_0x588ceb['id']},{})[_0x734b('0x24')](function(){return _0x171575;});}else{return _0x171575;}})[_0x734b('0x4c')](function(_0xe605be){logger['error'](_0x734b('0x55'),_0xe605be);throw _0xe605be;});}return _0x171575;})[_0x734b('0x24')](respondWithResult(_0x38125a,0xc9))[_0x734b('0x4c')](handleError(_0x38125a,null));};exports[_0x734b('0x56')]=function(_0x4b65bf,_0x27f0ff){if(_0x4b65bf['body']['id']){delete _0x4b65bf[_0x734b('0x4e')]['id'];}return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x4b65bf[_0x734b('0x48')]['id']}})['then'](handleEntityNotFound(_0x27f0ff,null))[_0x734b('0x24')](saveUpdates(_0x4b65bf[_0x734b('0x4e')],null))['then'](respondWithResult(_0x27f0ff,null))['catch'](handleError(_0x27f0ff,null));};exports[_0x734b('0x25')]=function(_0x577735,_0x16b461){return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x577735['params']['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x16b461,null))['then'](removeEntity(_0x16b461,null))[_0x734b('0x4c')](handleError(_0x16b461,null));};exports[_0x734b('0x57')]=function(_0x3c3359,_0x10660d,_0x49a43b){return db[_0x734b('0x2f')]['findOne']({'where':{'id':_0x3c3359[_0x734b('0x48')]['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x10660d,null))[_0x734b('0x24')](function(_0x59b7d8){var _0x18e187;var _0x55c699={},_0x2c81a1={};_0x2c81a1[_0x734b('0x33')]=_[_0x734b('0x35')](db[_0x734b('0x58')]['rawAttributes']);_0x2c81a1[_0x734b('0x34')]=_['keys'](_0x3c3359[_0x734b('0x34')]);_0x2c81a1[_0x734b('0x36')]=_[_0x734b('0x37')](_0x2c81a1['model'],_0x2c81a1[_0x734b('0x34')]);_0x55c699[_0x734b('0x38')]=_[_0x734b('0x37')](_0x2c81a1[_0x734b('0x33')],qs[_0x734b('0x39')](_0x3c3359[_0x734b('0x34')][_0x734b('0x39')]));_0x55c699['attributes']=_0x55c699[_0x734b('0x38')][_0x734b('0x3a')]?_0x55c699[_0x734b('0x38')]:_0x2c81a1['model'];if(!_0x3c3359['query'][_0x734b('0x3b')](_0x734b('0x59'))){_0x55c699[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3c3359['query']['limit']);_0x55c699['offset']=qs[_0x734b('0x1b')](_0x3c3359[_0x734b('0x34')][_0x734b('0x1b')]);}_0x55c699[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x3c3359[_0x734b('0x34')][_0x734b('0x3d')]);_0x55c699[_0x734b('0x3e')]=qs[_0x734b('0x36')](_[_0x734b('0x3f')](_0x3c3359[_0x734b('0x34')],_0x2c81a1[_0x734b('0x36')]));if(_0x3c3359[_0x734b('0x34')][_0x734b('0x40')]){_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'$or':_[_0x734b('0x2e')](_0x55c699[_0x734b('0x38')],function(_0x39d4e7){var _0x379a33={};_0x379a33[_0x39d4e7]={'$like':'%'+_0x3c3359['query'][_0x734b('0x40')]+'%'};return _0x379a33;})});}_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'mailboxuser':_0x59b7d8[_0x734b('0x5a')]});_0x55c699=_['merge']({},_0x55c699,_0x3c3359[_0x734b('0x43')]);return db[_0x734b('0x58')][_0x734b('0x5b')](_0x55c699)[_0x734b('0x24')](respondWithFilteredResult(_0x10660d,_0x55c699));})[_0x734b('0x4c')](handleError(_0x10660d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index d6e987e..462b686 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 _0x1e6c=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context'];(function(_0x22853,_0xbfcf3e){var _0x3bcd80=function(_0x558f8c){while(--_0x558f8c){_0x22853['push'](_0x22853['shift']());}};_0x3bcd80(++_0xbfcf3e);}(_0x1e6c,0x69));var _0xc1e6=function(_0x5253c3,_0x3e4a0a){_0x5253c3=_0x5253c3-0x0;var _0x3c3917=_0x1e6c[_0x5253c3];return _0x3c3917;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc1e6('0x0'))(_0xc1e6('0x1'));var moment=require('moment');var BPromise=require(_0xc1e6('0x2'));var rp=require(_0xc1e6('0x3'));var fs=require('fs');var path=require(_0xc1e6('0x4'));var rimraf=require(_0xc1e6('0x5'));var config=require(_0xc1e6('0x6'));var attributes=require(_0xc1e6('0x7'));module[_0xc1e6('0x8')]=function(_0x4c72af,_0x446cc7){return _0x4c72af[_0xc1e6('0x9')](_0xc1e6('0xa'),attributes,{'tableName':_0xc1e6('0xb'),'paranoid':![],'indexes':[{'name':_0xc1e6('0xc'),'fields':[_0xc1e6('0xd'),_0xc1e6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb811=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','mailbox_context','mailbox','lodash','util'];(function(_0x5b311b,_0x3e0280){var _0x4fa0de=function(_0x5363ed){while(--_0x5363ed){_0x5b311b['push'](_0x5b311b['shift']());}};_0x4fa0de(++_0x3e0280);}(_0xb811,0x108));var _0x1b81=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xb811[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x1b81('0x0'));var util=require(_0x1b81('0x1'));var logger=require(_0x1b81('0x2'))('api');var moment=require(_0x1b81('0x3'));var BPromise=require(_0x1b81('0x4'));var rp=require(_0x1b81('0x5'));var fs=require('fs');var path=require(_0x1b81('0x6'));var rimraf=require(_0x1b81('0x7'));var config=require(_0x1b81('0x8'));var attributes=require(_0x1b81('0x9'));module[_0x1b81('0xa')]=function(_0x2b3fbd,_0x1eacc2){return _0x2b3fbd['define'](_0x1b81('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x1b81('0xc'),'fields':[_0x1b81('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index ef7b70a..204c13e 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 _0x42b4=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x459c2b,_0x44b2d9){var _0x26bc62=function(_0xf8c480){while(--_0xf8c480){_0x459c2b['push'](_0x459c2b['shift']());}};_0x26bc62(++_0x44b2d9);}(_0x42b4,0x73));var _0x442b=function(_0x5cef5c,_0x375597){_0x5cef5c=_0x5cef5c-0x0;var _0x2684bd=_0x42b4[_0x5cef5c];return _0x2684bd;};'use strict';var _=require(_0x442b('0x0'));var util=require(_0x442b('0x1'));var moment=require(_0x442b('0x2'));var BPromise=require(_0x442b('0x3'));var rs=require(_0x442b('0x4'));var fs=require('fs');var Redis=require(_0x442b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x442b('0x6'));var logger=require('../../config/logger')(_0x442b('0x7'));var config=require(_0x442b('0x8'));var jayson=require(_0x442b('0x9'));var client=jayson[_0x442b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5df7f8,_0x11fe99,_0xd79d4b){return new BPromise(function(_0x44b5c9,_0xa2e94b){return client[_0x442b('0xb')](_0x5df7f8,_0xd79d4b)[_0x442b('0xc')](function(_0x38ca28){logger[_0x442b('0xd')](_0x442b('0xe'),_0x11fe99,'request\x20sent');logger[_0x442b('0xf')](_0x442b('0x10'),_0x11fe99,_0x442b('0x11'),JSON['stringify'](_0x38ca28));if(_0x38ca28['error']){if(_0x38ca28[_0x442b('0x12')][_0x442b('0x13')]===0x1f4){logger[_0x442b('0x12')](_0x442b('0xe'),_0x11fe99,_0x38ca28[_0x442b('0x12')]['message']);return _0xa2e94b(_0x38ca28[_0x442b('0x12')][_0x442b('0x14')]);}logger[_0x442b('0x12')]('VoiceMail,\x20%s,\x20%s',_0x11fe99,_0x38ca28[_0x442b('0x12')][_0x442b('0x14')]);return _0x44b5c9(_0x38ca28[_0x442b('0x12')]['message']);}else{logger[_0x442b('0xd')](_0x442b('0xe'),_0x11fe99,_0x442b('0x11'));_0x44b5c9(_0x38ca28[_0x442b('0x15')][_0x442b('0x14')]);}})[_0x442b('0x16')](function(_0x37c80a){logger[_0x442b('0x12')](_0x442b('0xe'),_0x11fe99,_0x37c80a);_0xa2e94b(_0x37c80a);});});} \ No newline at end of file +var _0x73ec=['http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x26c5c2,_0x409598){var _0x381ac8=function(_0x341f98){while(--_0x341f98){_0x26c5c2['push'](_0x26c5c2['shift']());}};_0x381ac8(++_0x409598);}(_0x73ec,0x8f));var _0xc73e=function(_0xc461d2,_0x56e687){_0xc461d2=_0xc461d2-0x0;var _0x5bfbcb=_0x73ec[_0xc461d2];return _0x5bfbcb;};'use strict';var _=require(_0xc73e('0x0'));var util=require(_0xc73e('0x1'));var moment=require(_0xc73e('0x2'));var BPromise=require('bluebird');var rs=require(_0xc73e('0x3'));var fs=require('fs');var Redis=require(_0xc73e('0x4'));var db=require(_0xc73e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc73e('0x6'))(_0xc73e('0x7'));var config=require(_0xc73e('0x8'));var jayson=require(_0xc73e('0x9'));var client=jayson[_0xc73e('0xa')][_0xc73e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x567ed3,_0x2607c5,_0x2b967f){return new BPromise(function(_0x3db2b4,_0x2ebedb){return client['request'](_0x567ed3,_0x2b967f)[_0xc73e('0xc')](function(_0x11c784){logger[_0xc73e('0xd')](_0xc73e('0xe'),_0x2607c5,_0xc73e('0xf'));logger[_0xc73e('0x10')](_0xc73e('0x11'),_0x2607c5,_0xc73e('0xf'),JSON[_0xc73e('0x12')](_0x11c784));if(_0x11c784[_0xc73e('0x13')]){if(_0x11c784['error']['code']===0x1f4){logger[_0xc73e('0x13')](_0xc73e('0xe'),_0x2607c5,_0x11c784[_0xc73e('0x13')]['message']);return _0x2ebedb(_0x11c784[_0xc73e('0x13')][_0xc73e('0x14')]);}logger[_0xc73e('0x13')]('VoiceMail,\x20%s,\x20%s',_0x2607c5,_0x11c784[_0xc73e('0x13')][_0xc73e('0x14')]);return _0x3db2b4(_0x11c784[_0xc73e('0x13')][_0xc73e('0x14')]);}else{logger[_0xc73e('0xd')](_0xc73e('0xe'),_0x2607c5,_0xc73e('0xf'));_0x3db2b4(_0x11c784[_0xc73e('0x15')]['message']);}})['catch'](function(_0x58e1cd){logger[_0xc73e('0x13')](_0xc73e('0xe'),_0x2607c5,_0x58e1cd);_0x2ebedb(_0x58e1cd);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 7189518..3044228 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 _0x4838=['isAuthenticated','/:id/download','download','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./voiceMailMessage.controller','get'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x4838,0xbf));var _0x8483=function(_0xed9299,_0x25f580){_0xed9299=_0xed9299-0x0;var _0x57bd5c=_0x4838[_0xed9299];return _0x57bd5c;};'use strict';var multer=require(_0x8483('0x0'));var util=require(_0x8483('0x1'));var path=require(_0x8483('0x2'));var timeout=require('connect-timeout');var express=require(_0x8483('0x3'));var router=express[_0x8483('0x4')]();var fs_extra=require(_0x8483('0x5'));var auth=require(_0x8483('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8483('0x7'));router[_0x8483('0x8')]('/',auth[_0x8483('0x9')](),controller['index']);router[_0x8483('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8483('0xa'),auth[_0x8483('0x9')](),controller[_0x8483('0xb')]);router[_0x8483('0xc')]('/',auth[_0x8483('0x9')](),controller[_0x8483('0xd')]);router[_0x8483('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8483('0xf')]);router[_0x8483('0x10')](_0x8483('0x11'),auth[_0x8483('0x9')](),controller[_0x8483('0x12')]);module[_0x8483('0x13')]=router; \ No newline at end of file +var _0x07b4=['get','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','index'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0x07b4,0xd2));var _0x407b=function(_0x5eb4ac,_0x4ef2c4){_0x5eb4ac=_0x5eb4ac-0x0;var _0x469c94=_0x07b4[_0x5eb4ac];return _0x469c94;};'use strict';var multer=require(_0x407b('0x0'));var util=require('util');var path=require(_0x407b('0x1'));var timeout=require(_0x407b('0x2'));var express=require('express');var router=express[_0x407b('0x3')]();var fs_extra=require(_0x407b('0x4'));var auth=require(_0x407b('0x5'));var interaction=require(_0x407b('0x6'));var config=require('../../config/environment');var controller=require(_0x407b('0x7'));router['get']('/',auth[_0x407b('0x8')](),controller[_0x407b('0x9')]);router[_0x407b('0xa')](_0x407b('0xb'),auth[_0x407b('0x8')](),controller[_0x407b('0xc')]);router[_0x407b('0xa')](_0x407b('0xd'),auth[_0x407b('0x8')](),controller[_0x407b('0xe')]);router[_0x407b('0xf')]('/',auth['isAuthenticated'](),controller[_0x407b('0x10')]);router[_0x407b('0x11')]('/:id',auth[_0x407b('0x8')](),controller[_0x407b('0x12')]);router[_0x407b('0x13')](_0x407b('0xb'),auth[_0x407b('0x8')](),controller[_0x407b('0x14')]);module[_0x407b('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 4e8d51c..1d5d7a7 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 _0xf74a=['exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x5b8f91,_0x2c2354){var _0x2c7db5=function(_0x1f53f5){while(--_0x1f53f5){_0x5b8f91['push'](_0x5b8f91['shift']());}};_0x2c7db5(++_0x2c2354);}(_0xf74a,0x8c));var _0xaf74=function(_0x207c88,_0x433988){_0x207c88=_0x207c88-0x0;var _0xe742d3=_0xf74a[_0x207c88];return _0xe742d3;};'use strict';var Sequelize=require('sequelize');module[_0xaf74('0x0')]={'name':{'type':Sequelize[_0xaf74('0x1')],'get':function(_0x54a1f4){return this[_0xaf74('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xaf74('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xaf74('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xaf74('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xaf74('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xaf74('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xaf74('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xaf74('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xaf74('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xaf74('0x5')](_0xaf74('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xaf74('0x4')],'defaultValue':''},'stamp':{'type':_0xaf74('0x7'),'defaultValue':Sequelize[_0xaf74('0x8')](_0xaf74('0x9'))}}; \ No newline at end of file +var _0xc781=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x2226f6,_0x395823){var _0x687135=function(_0x4a1761){while(--_0x4a1761){_0x2226f6['push'](_0x2226f6['shift']());}};_0x687135(++_0x395823);}(_0xc781,0x143));var _0x1c78=function(_0x1c8e6f,_0x30444d){_0x1c8e6f=_0x1c8e6f-0x0;var _0x941f8c=_0xc781[_0x1c8e6f];return _0x941f8c;};'use strict';var Sequelize=require(_0x1c78('0x0'));module[_0x1c78('0x1')]={'name':{'type':Sequelize[_0x1c78('0x2')],'get':function(_0x3c3b52){return this[_0x1c78('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x1c78('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x1c78('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1c78('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1c78('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x1c78('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x1c78('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1c78('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x1c78('0x6')](_0x1c78('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x1c78('0x5')],'defaultValue':''},'stamp':{'type':_0x1c78('0x8'),'defaultValue':Sequelize[_0x1c78('0x9')](_0x1c78('0xa'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 3abc108..9ffcb43 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 _0x3318=['then','rows','catch','show','keys','create','body','find','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22','send','eml-format','fast-json-patch','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','reject','update','destroy','error','stack','name','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','count','include','findAll'];(function(_0x46b993,_0x4a215b){var _0x477845=function(_0x444c25){while(--_0x444c25){_0x46b993['push'](_0x46b993['shift']());}};_0x477845(++_0x4a215b);}(_0x3318,0x10c));var _0x8331=function(_0x9d0c16,_0x228248){_0x9d0c16=_0x9d0c16-0x0;var _0x2b48cf=_0x3318[_0x9d0c16];return _0x2b48cf;};'use strict';var emlformat=require(_0x8331('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8331('0x1'));var rp=require('request-promise');var moment=require(_0x8331('0x2'));var BPromise=require(_0x8331('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8331('0x4'));var ejs=require(_0x8331('0x5'));var fs=require('fs');var fs_extra=require(_0x8331('0x6'));var _=require(_0x8331('0x7'));var squel=require(_0x8331('0x8'));var crypto=require(_0x8331('0x9'));var jsforce=require(_0x8331('0xa'));var deskjs=require(_0x8331('0xb'));var toCsv=require(_0x8331('0x4'));var querystring=require(_0x8331('0xc'));var Papa=require(_0x8331('0xd'));var Redis=require(_0x8331('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8331('0xf'));var as=require(_0x8331('0x10'));var hardwareService=require(_0x8331('0x11'));var logger=require('../../config/logger')(_0x8331('0x12'));var utils=require(_0x8331('0x13'));var config=require(_0x8331('0x14'));var licenseUtil=require(_0x8331('0x15'));var db=require(_0x8331('0x16'))['db'];function respondWithStatusCode(_0x5439fc,_0x468183){_0x468183=_0x468183||0xcc;return function(_0x37d7df){if(_0x37d7df){return _0x5439fc[_0x8331('0x17')](_0x468183);}return _0x5439fc[_0x8331('0x18')](_0x468183)[_0x8331('0x19')]();};}function respondWithResult(_0x20067d,_0x2bc904){_0x2bc904=_0x2bc904||0xc8;return function(_0x3505b7){if(_0x3505b7){return _0x20067d[_0x8331('0x18')](_0x2bc904)['json'](_0x3505b7);}};}function respondWithFilteredResult(_0x5d6d81,_0x3e64c6){return function(_0x5b8757){if(_0x5b8757){var _0x3c894d=typeof _0x3e64c6[_0x8331('0x1a')]===_0x8331('0x1b')&&typeof _0x3e64c6['limit']===_0x8331('0x1b');var _0xf1751e=_0x5b8757['count'];var _0x425daa=_0x3c894d?0x0:_0x3e64c6[_0x8331('0x1a')];var _0x5cfee9=_0x3c894d?_0x5b8757['count']:_0x3e64c6[_0x8331('0x1a')]+_0x3e64c6[_0x8331('0x1c')];var _0x97433a;if(_0x5cfee9>=_0xf1751e){_0x5cfee9=_0xf1751e;_0x97433a=0xc8;}else{_0x97433a=0xce;}_0x5d6d81[_0x8331('0x18')](_0x97433a);return _0x5d6d81[_0x8331('0x1d')](_0x8331('0x1e'),_0x425daa+'-'+_0x5cfee9+'/'+_0xf1751e)[_0x8331('0x1f')](_0x5b8757);}return null;};}function patchUpdates(_0x337a3c){return function(_0x497232){try{jsonpatch['apply'](_0x497232,_0x337a3c,!![]);}catch(_0x158c74){return BPromise[_0x8331('0x20')](_0x158c74);}return _0x497232['save']();};}function saveUpdates(_0x3ba4a6,_0x5d714d){return function(_0xeb1289){if(_0xeb1289){return _0xeb1289[_0x8331('0x21')](_0x3ba4a6)['then'](function(_0x3cffa8){return _0x3cffa8;});}return null;};}function removeEntity(_0x244689,_0x23ee0f){return function(_0x55a951){if(_0x55a951){return _0x55a951[_0x8331('0x22')]()['then'](function(){_0x244689[_0x8331('0x18')](0xcc)[_0x8331('0x19')]();});}};}function handleEntityNotFound(_0x33d4a7,_0xd3f739){return function(_0x26fc1c){if(!_0x26fc1c){_0x33d4a7[_0x8331('0x17')](0x194);}return _0x26fc1c;};}function handleError(_0x538ea4,_0x575dab){_0x575dab=_0x575dab||0x1f4;return function(_0x1a3f71){logger[_0x8331('0x23')](_0x1a3f71[_0x8331('0x24')]);if(_0x1a3f71['name']){delete _0x1a3f71[_0x8331('0x25')];}_0x538ea4[_0x8331('0x18')](_0x575dab)['send'](_0x1a3f71);};}exports[_0x8331('0x26')]=function(_0x41baf2,_0x493c28){var _0x33296a={},_0x2a97a5={},_0x44ed4f={'count':0x0,'rows':[]};var _0x45836a=_[_0x8331('0x27')](db[_0x8331('0x28')][_0x8331('0x29')],function(_0x444220){return{'name':_0x444220[_0x8331('0x2a')],'type':_0x444220['type'][_0x8331('0x2b')]};});_0x2a97a5[_0x8331('0x2c')]=_[_0x8331('0x2d')](_['map'](_0x45836a,_0x8331('0x25')),[_0x8331('0x25')]);_0x2a97a5[_0x8331('0x2e')]=_['keys'](_0x41baf2['query']);_0x2a97a5[_0x8331('0x2f')]=_[_0x8331('0x30')](_0x2a97a5['model'],_0x2a97a5[_0x8331('0x2e')]);_0x33296a[_0x8331('0x31')]=_[_0x8331('0x30')](_0x2a97a5[_0x8331('0x2c')],qs[_0x8331('0x32')](_0x41baf2[_0x8331('0x2e')][_0x8331('0x32')]));_0x33296a[_0x8331('0x31')]=_0x33296a[_0x8331('0x31')][_0x8331('0x33')]?_0x33296a['attributes']:_0x2a97a5[_0x8331('0x2c')];if(!_0x41baf2[_0x8331('0x2e')][_0x8331('0x34')](_0x8331('0x35'))){_0x33296a['limit']=qs['limit'](_0x41baf2[_0x8331('0x2e')][_0x8331('0x1c')]);_0x33296a[_0x8331('0x1a')]=qs[_0x8331('0x1a')](_0x41baf2['query']['offset']);}_0x33296a[_0x8331('0x36')]=qs[_0x8331('0x37')](_0x41baf2[_0x8331('0x2e')][_0x8331('0x37')]);_0x33296a[_0x8331('0x38')]=qs[_0x8331('0x2f')](_['pick'](_0x41baf2[_0x8331('0x2e')],_0x2a97a5[_0x8331('0x2f')]),_0x45836a);if(_0x41baf2[_0x8331('0x2e')][_0x8331('0x39')]){_0x33296a[_0x8331('0x38')]=_[_0x8331('0x3a')](_0x33296a[_0x8331('0x38')],{'$or':_['map'](_0x45836a,function(_0x527f55){if(_0x527f55[_0x8331('0x3b')]!=='VIRTUAL'){var _0xea3738={};_0xea3738[_0x527f55[_0x8331('0x25')]]={'$like':'%'+_0x41baf2[_0x8331('0x2e')]['filter']+'%'};return _0xea3738;}})});}_0x33296a=_[_0x8331('0x3a')]({},_0x33296a,_0x41baf2[_0x8331('0x3c')]);var _0xc935db={'where':_0x33296a[_0x8331('0x38')]};return db[_0x8331('0x28')]['count'](_0xc935db)['then'](function(_0x55bb4c){_0x44ed4f[_0x8331('0x3d')]=_0x55bb4c;if(_0x41baf2['query']['includeAll']){_0x33296a[_0x8331('0x3e')]=[{'all':!![]}];}return db[_0x8331('0x28')][_0x8331('0x3f')](_0x33296a);})[_0x8331('0x40')](function(_0x1d8c4d){_0x44ed4f[_0x8331('0x41')]=_0x1d8c4d;return _0x44ed4f;})['then'](respondWithFilteredResult(_0x493c28,_0x33296a))[_0x8331('0x42')](handleError(_0x493c28,null));};exports[_0x8331('0x43')]=function(_0x44e26c,_0x2c37ff){var _0x23e848={'raw':!![],'where':{'id':_0x44e26c['params']['id']}},_0x56ca7d={};_0x56ca7d[_0x8331('0x2c')]=_['keys'](db[_0x8331('0x28')][_0x8331('0x29')]);_0x56ca7d['query']=_[_0x8331('0x44')](_0x44e26c[_0x8331('0x2e')]);_0x56ca7d['filters']=_[_0x8331('0x30')](_0x56ca7d['model'],_0x56ca7d[_0x8331('0x2e')]);_0x23e848[_0x8331('0x31')]=_['intersection'](_0x56ca7d[_0x8331('0x2c')],qs['fields'](_0x44e26c[_0x8331('0x2e')][_0x8331('0x32')]));_0x23e848[_0x8331('0x31')]=_0x23e848[_0x8331('0x31')][_0x8331('0x33')]?_0x23e848[_0x8331('0x31')]:_0x56ca7d[_0x8331('0x2c')];if(_0x44e26c['query']['includeAll']){_0x23e848[_0x8331('0x3e')]=[{'all':!![]}];}_0x23e848=_[_0x8331('0x3a')]({},_0x23e848,_0x44e26c['options']);return db[_0x8331('0x28')]['find'](_0x23e848)[_0x8331('0x40')](handleEntityNotFound(_0x2c37ff,null))[_0x8331('0x40')](respondWithResult(_0x2c37ff,null))['catch'](handleError(_0x2c37ff,null));};exports[_0x8331('0x45')]=function(_0x4c9fed,_0x2d9c81){return db[_0x8331('0x28')][_0x8331('0x45')](_0x4c9fed[_0x8331('0x46')],{})[_0x8331('0x40')](respondWithResult(_0x2d9c81,0xc9))[_0x8331('0x42')](handleError(_0x2d9c81,null));};exports[_0x8331('0x21')]=function(_0x245168,_0x22a48c){if(_0x245168[_0x8331('0x46')]['id']){delete _0x245168[_0x8331('0x46')]['id'];}return db[_0x8331('0x28')][_0x8331('0x47')]({'where':{'id':_0x245168['params']['id']}})['then'](handleEntityNotFound(_0x22a48c,null))[_0x8331('0x40')](saveUpdates(_0x245168[_0x8331('0x46')],null))['then'](respondWithResult(_0x22a48c,null))[_0x8331('0x42')](handleError(_0x22a48c,null));};exports[_0x8331('0x22')]=function(_0x3d168c,_0x4f75f4){return db[_0x8331('0x28')][_0x8331('0x47')]({'where':{'id':_0x3d168c[_0x8331('0x48')]['id']}})[_0x8331('0x40')](handleEntityNotFound(_0x4f75f4,null))[_0x8331('0x40')](removeEntity(_0x4f75f4,null))['catch'](handleError(_0x4f75f4,null));};exports[_0x8331('0x49')]=function(_0x548357,_0x2f1ee8,_0xcb1e1d){return db['VoiceMailMessage'][_0x8331('0x47')]({'where':{'id':_0x548357[_0x8331('0x48')]['id']},'attributes':['id',_0x8331('0x4a'),_0x8331('0x4b')]})[_0x8331('0x40')](handleEntityNotFound(_0x2f1ee8,null))[_0x8331('0x40')](function(_0x1fc57c){if(_0x1fc57c){if(!_0x1fc57c[_0x8331('0x4a')]){throw new db[(_0x8331('0x4c'))][(_0x8331('0x4d'))](_0x8331('0x4e'));}var _0xc149e5={'Content-Type':'audio/wav','Content-Disposition':_0x8331('0x4f')};if(_0x1fc57c[_0x8331('0x4b')]){_0xc149e5[_0x8331('0x50')]='attachment;\x20filename=\x22'+_0x1fc57c['msg_id']+_0x8331('0x51');}_0x2f1ee8[_0x8331('0x1d')](_0xc149e5);return _0x2f1ee8[_0x8331('0x52')](new Buffer(_0x1fc57c[_0x8331('0x4a')]));}})[_0x8331('0x42')](handleError(_0x2f1ee8,null));}; \ No newline at end of file +var _0xe2f0=['intersection','fields','attributes','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','download','recording','ValidationError','VoiceMailMessage\x20not\x20found','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','fast-json-patch','request-promise','moment','bluebird','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','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','send','map','VoiceMailMessage','rawAttributes','type','model','differenceBy','query','filters'];(function(_0x40b63d,_0x40ba8f){var _0x38fa70=function(_0x29e376){while(--_0x29e376){_0x40b63d['push'](_0x40b63d['shift']());}};_0x38fa70(++_0x40ba8f);}(_0xe2f0,0x16c));var _0x0e2f=function(_0x18e5c7,_0x392a80){_0x18e5c7=_0x18e5c7-0x0;var _0x55f2f0=_0xe2f0[_0x18e5c7];return _0x55f2f0;};'use strict';var emlformat=require(_0x0e2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0e2f('0x1'));var rp=require(_0x0e2f('0x2'));var moment=require(_0x0e2f('0x3'));var BPromise=require(_0x0e2f('0x4'));var Mustache=require('mustache');var util=require(_0x0e2f('0x5'));var path=require('path');var sox=require(_0x0e2f('0x6'));var csv=require(_0x0e2f('0x7'));var ejs=require(_0x0e2f('0x8'));var fs=require('fs');var fs_extra=require(_0x0e2f('0x9'));var _=require(_0x0e2f('0xa'));var squel=require(_0x0e2f('0xb'));var crypto=require(_0x0e2f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0e2f('0xd'));var toCsv=require(_0x0e2f('0x7'));var querystring=require(_0x0e2f('0xe'));var Papa=require(_0x0e2f('0xf'));var Redis=require(_0x0e2f('0x10'));var authService=require(_0x0e2f('0x11'));var qs=require(_0x0e2f('0x12'));var as=require(_0x0e2f('0x13'));var hardwareService=require(_0x0e2f('0x14'));var logger=require(_0x0e2f('0x15'))(_0x0e2f('0x16'));var utils=require(_0x0e2f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0e2f('0x18'));var db=require(_0x0e2f('0x19'))['db'];function respondWithStatusCode(_0x269d69,_0x589b24){_0x589b24=_0x589b24||0xcc;return function(_0x23e124){if(_0x23e124){return _0x269d69[_0x0e2f('0x1a')](_0x589b24);}return _0x269d69['status'](_0x589b24)[_0x0e2f('0x1b')]();};}function respondWithResult(_0xabf4ad,_0x1d12f4){_0x1d12f4=_0x1d12f4||0xc8;return function(_0x5aa261){if(_0x5aa261){return _0xabf4ad[_0x0e2f('0x1c')](_0x1d12f4)[_0x0e2f('0x1d')](_0x5aa261);}};}function respondWithFilteredResult(_0x3cbd40,_0x3cf42b){return function(_0x3b5735){if(_0x3b5735){var _0x55c3b1=typeof _0x3cf42b[_0x0e2f('0x1e')]===_0x0e2f('0x1f')&&typeof _0x3cf42b[_0x0e2f('0x20')]===_0x0e2f('0x1f');var _0x4d1efc=_0x3b5735['count'];var _0x3c6f02=_0x55c3b1?0x0:_0x3cf42b[_0x0e2f('0x1e')];var _0xf69311=_0x55c3b1?_0x3b5735[_0x0e2f('0x21')]:_0x3cf42b['offset']+_0x3cf42b[_0x0e2f('0x20')];var _0x256454;if(_0xf69311>=_0x4d1efc){_0xf69311=_0x4d1efc;_0x256454=0xc8;}else{_0x256454=0xce;}_0x3cbd40[_0x0e2f('0x1c')](_0x256454);return _0x3cbd40[_0x0e2f('0x22')]('Content-Range',_0x3c6f02+'-'+_0xf69311+'/'+_0x4d1efc)[_0x0e2f('0x1d')](_0x3b5735);}return null;};}function patchUpdates(_0x1fc709){return function(_0x1785e4){try{jsonpatch['apply'](_0x1785e4,_0x1fc709,!![]);}catch(_0x54250d){return BPromise[_0x0e2f('0x23')](_0x54250d);}return _0x1785e4[_0x0e2f('0x24')]();};}function saveUpdates(_0x4d5ddb,_0x3b3f9c){return function(_0x4db9c3){if(_0x4db9c3){return _0x4db9c3[_0x0e2f('0x25')](_0x4d5ddb)[_0x0e2f('0x26')](function(_0xa59389){return _0xa59389;});}return null;};}function removeEntity(_0x2f0491,_0x88d841){return function(_0x18e708){if(_0x18e708){return _0x18e708['destroy']()[_0x0e2f('0x26')](function(){_0x2f0491[_0x0e2f('0x1c')](0xcc)[_0x0e2f('0x1b')]();});}};}function handleEntityNotFound(_0x4cf325,_0x39374e){return function(_0x3a246b){if(!_0x3a246b){_0x4cf325[_0x0e2f('0x1a')](0x194);}return _0x3a246b;};}function handleError(_0x5e3d31,_0x396bf3){_0x396bf3=_0x396bf3||0x1f4;return function(_0xa8d758){logger[_0x0e2f('0x27')](_0xa8d758[_0x0e2f('0x28')]);if(_0xa8d758[_0x0e2f('0x29')]){delete _0xa8d758[_0x0e2f('0x29')];}_0x5e3d31[_0x0e2f('0x1c')](_0x396bf3)[_0x0e2f('0x2a')](_0xa8d758);};}exports['index']=function(_0x5227c0,_0x309e97){var _0x1e604a={},_0x2f15c1={},_0x130367={'count':0x0,'rows':[]};var _0x469f27=_[_0x0e2f('0x2b')](db[_0x0e2f('0x2c')][_0x0e2f('0x2d')],function(_0x389c6a){return{'name':_0x389c6a['fieldName'],'type':_0x389c6a[_0x0e2f('0x2e')]['key']};});_0x2f15c1[_0x0e2f('0x2f')]=_[_0x0e2f('0x30')](_[_0x0e2f('0x2b')](_0x469f27,_0x0e2f('0x29')),['name']);_0x2f15c1['query']=_['keys'](_0x5227c0[_0x0e2f('0x31')]);_0x2f15c1[_0x0e2f('0x32')]=_['intersection'](_0x2f15c1[_0x0e2f('0x2f')],_0x2f15c1[_0x0e2f('0x31')]);_0x1e604a['attributes']=_[_0x0e2f('0x33')](_0x2f15c1[_0x0e2f('0x2f')],qs['fields'](_0x5227c0[_0x0e2f('0x31')][_0x0e2f('0x34')]));_0x1e604a[_0x0e2f('0x35')]=_0x1e604a[_0x0e2f('0x35')][_0x0e2f('0x36')]?_0x1e604a['attributes']:_0x2f15c1[_0x0e2f('0x2f')];if(!_0x5227c0[_0x0e2f('0x31')]['hasOwnProperty'](_0x0e2f('0x37'))){_0x1e604a[_0x0e2f('0x20')]=qs['limit'](_0x5227c0[_0x0e2f('0x31')][_0x0e2f('0x20')]);_0x1e604a[_0x0e2f('0x1e')]=qs[_0x0e2f('0x1e')](_0x5227c0[_0x0e2f('0x31')][_0x0e2f('0x1e')]);}_0x1e604a['order']=qs[_0x0e2f('0x38')](_0x5227c0[_0x0e2f('0x31')][_0x0e2f('0x38')]);_0x1e604a['where']=qs['filters'](_[_0x0e2f('0x39')](_0x5227c0[_0x0e2f('0x31')],_0x2f15c1[_0x0e2f('0x32')]),_0x469f27);if(_0x5227c0['query'][_0x0e2f('0x3a')]){_0x1e604a[_0x0e2f('0x3b')]=_['merge'](_0x1e604a[_0x0e2f('0x3b')],{'$or':_['map'](_0x469f27,function(_0x48ea39){if(_0x48ea39[_0x0e2f('0x2e')]!==_0x0e2f('0x3c')){var _0x2c3a4c={};_0x2c3a4c[_0x48ea39['name']]={'$like':'%'+_0x5227c0[_0x0e2f('0x31')][_0x0e2f('0x3a')]+'%'};return _0x2c3a4c;}})});}_0x1e604a=_[_0x0e2f('0x3d')]({},_0x1e604a,_0x5227c0[_0x0e2f('0x3e')]);var _0x4c9dec={'where':_0x1e604a['where']};return db[_0x0e2f('0x2c')][_0x0e2f('0x21')](_0x4c9dec)[_0x0e2f('0x26')](function(_0x4d3a7c){_0x130367[_0x0e2f('0x21')]=_0x4d3a7c;if(_0x5227c0[_0x0e2f('0x31')][_0x0e2f('0x3f')]){_0x1e604a['include']=[{'all':!![]}];}return db[_0x0e2f('0x2c')][_0x0e2f('0x40')](_0x1e604a);})[_0x0e2f('0x26')](function(_0x43a5d4){_0x130367[_0x0e2f('0x41')]=_0x43a5d4;return _0x130367;})[_0x0e2f('0x26')](respondWithFilteredResult(_0x309e97,_0x1e604a))[_0x0e2f('0x42')](handleError(_0x309e97,null));};exports[_0x0e2f('0x43')]=function(_0x52b122,_0x3da76a){var _0x38a0cd={'raw':!![],'where':{'id':_0x52b122[_0x0e2f('0x44')]['id']}},_0x168eb9={};_0x168eb9['model']=_['keys'](db[_0x0e2f('0x2c')]['rawAttributes']);_0x168eb9[_0x0e2f('0x31')]=_['keys'](_0x52b122[_0x0e2f('0x31')]);_0x168eb9[_0x0e2f('0x32')]=_[_0x0e2f('0x33')](_0x168eb9[_0x0e2f('0x2f')],_0x168eb9[_0x0e2f('0x31')]);_0x38a0cd[_0x0e2f('0x35')]=_[_0x0e2f('0x33')](_0x168eb9[_0x0e2f('0x2f')],qs[_0x0e2f('0x34')](_0x52b122[_0x0e2f('0x31')][_0x0e2f('0x34')]));_0x38a0cd[_0x0e2f('0x35')]=_0x38a0cd['attributes']['length']?_0x38a0cd[_0x0e2f('0x35')]:_0x168eb9[_0x0e2f('0x2f')];if(_0x52b122[_0x0e2f('0x31')][_0x0e2f('0x3f')]){_0x38a0cd[_0x0e2f('0x45')]=[{'all':!![]}];}_0x38a0cd=_[_0x0e2f('0x3d')]({},_0x38a0cd,_0x52b122[_0x0e2f('0x3e')]);return db['VoiceMailMessage'][_0x0e2f('0x46')](_0x38a0cd)['then'](handleEntityNotFound(_0x3da76a,null))[_0x0e2f('0x26')](respondWithResult(_0x3da76a,null))['catch'](handleError(_0x3da76a,null));};exports[_0x0e2f('0x47')]=function(_0x56322d,_0x127853){return db[_0x0e2f('0x2c')]['create'](_0x56322d[_0x0e2f('0x48')],{})['then'](respondWithResult(_0x127853,0xc9))[_0x0e2f('0x42')](handleError(_0x127853,null));};exports[_0x0e2f('0x25')]=function(_0x127282,_0x515dbd){if(_0x127282[_0x0e2f('0x48')]['id']){delete _0x127282[_0x0e2f('0x48')]['id'];}return db['VoiceMailMessage'][_0x0e2f('0x46')]({'where':{'id':_0x127282[_0x0e2f('0x44')]['id']}})[_0x0e2f('0x26')](handleEntityNotFound(_0x515dbd,null))[_0x0e2f('0x26')](saveUpdates(_0x127282['body'],null))[_0x0e2f('0x26')](respondWithResult(_0x515dbd,null))[_0x0e2f('0x42')](handleError(_0x515dbd,null));};exports[_0x0e2f('0x49')]=function(_0x119f28,_0x37e8ef){return db[_0x0e2f('0x2c')][_0x0e2f('0x46')]({'where':{'id':_0x119f28[_0x0e2f('0x44')]['id']}})[_0x0e2f('0x26')](handleEntityNotFound(_0x37e8ef,null))[_0x0e2f('0x26')](removeEntity(_0x37e8ef,null))[_0x0e2f('0x42')](handleError(_0x37e8ef,null));};exports[_0x0e2f('0x4a')]=function(_0x38a6f9,_0xc43fea,_0x1e2dab){return db['VoiceMailMessage']['find']({'where':{'id':_0x38a6f9[_0x0e2f('0x44')]['id']},'attributes':['id',_0x0e2f('0x4b'),'msg_id']})['then'](handleEntityNotFound(_0xc43fea,null))[_0x0e2f('0x26')](function(_0x31a037){if(_0x31a037){if(!_0x31a037[_0x0e2f('0x4b')]){throw new db['Sequelize'][(_0x0e2f('0x4c'))](_0x0e2f('0x4d'));}var _0x1578fc={'Content-Type':'audio/wav','Content-Disposition':_0x0e2f('0x4e')};if(_0x31a037[_0x0e2f('0x4f')]){_0x1578fc[_0x0e2f('0x50')]=_0x0e2f('0x51')+_0x31a037['msg_id']+_0x0e2f('0x52');}_0xc43fea[_0x0e2f('0x22')](_0x1578fc);return _0xc43fea[_0x0e2f('0x2a')](new Buffer(_0x31a037[_0x0e2f('0x4b')]));}})[_0x0e2f('0x42')](handleError(_0xc43fea,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f042547..f85ec88 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 _0xb617=['request-promise','path','rimraf','../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1964e9,_0x3df886){var _0x2121ed=function(_0x34b82b){while(--_0x34b82b){_0x1964e9['push'](_0x1964e9['shift']());}};_0x2121ed(++_0x3df886);}(_0xb617,0x90));var _0x7b61=function(_0x23dae1,_0x1c09fc){_0x23dae1=_0x23dae1-0x0;var _0xebb4c0=_0xb617[_0x23dae1];return _0xebb4c0;};'use strict';var _=require(_0x7b61('0x0'));var util=require(_0x7b61('0x1'));var logger=require(_0x7b61('0x2'))(_0x7b61('0x3'));var moment=require(_0x7b61('0x4'));var BPromise=require(_0x7b61('0x5'));var rp=require(_0x7b61('0x6'));var fs=require('fs');var path=require(_0x7b61('0x7'));var rimraf=require(_0x7b61('0x8'));var config=require(_0x7b61('0x9'));var attributes=require('./voiceMailMessage.attributes');module[_0x7b61('0xa')]=function(_0x1f15f6,_0x49dda6){return _0x1f15f6[_0x7b61('0xb')](_0x7b61('0xc'),attributes,{'tableName':_0x7b61('0xd'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x7b61('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6b32=['voice_voicemail_messages','dir','util','../../config/logger','api','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage'];(function(_0x29ebf,_0x5d73f0){var _0x3261f2=function(_0x26b9d5){while(--_0x26b9d5){_0x29ebf['push'](_0x29ebf['shift']());}};_0x3261f2(++_0x5d73f0);}(_0x6b32,0xc2));var _0x26b3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6b32[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x26b3('0x0'));var logger=require(_0x26b3('0x1'))(_0x26b3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x26b3('0x3'));var rimraf=require(_0x26b3('0x4'));var config=require(_0x26b3('0x5'));var attributes=require(_0x26b3('0x6'));module[_0x26b3('0x7')]=function(_0x56c503,_0x501551){return _0x56c503[_0x26b3('0x8')](_0x26b3('0x9'),attributes,{'tableName':_0x26b3('0xa'),'paranoid':![],'indexes':[{'name':_0x26b3('0xb'),'fields':[_0x26b3('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 571e9cf..f92e365 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 _0x6aa6=['client','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6aa6,0x75));var _0x66aa=function(_0xf90f2d,_0x33e494){_0xf90f2d=_0xf90f2d-0x0;var _0x3d9694=_0x6aa6[_0xf90f2d];return _0x3d9694;};'use strict';var _=require(_0x66aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x66aa('0x1'));var rs=require(_0x66aa('0x2'));var fs=require('fs');var Redis=require(_0x66aa('0x3'));var db=require(_0x66aa('0x4'))['db'];var utils=require(_0x66aa('0x5'));var logger=require(_0x66aa('0x6'))(_0x66aa('0x7'));var config=require(_0x66aa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x66aa('0x9')][_0x66aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10f63b,_0x1eafb8,_0x214cd9){return new BPromise(function(_0x1d8bec,_0xde0d86){return client['request'](_0x10f63b,_0x214cd9)[_0x66aa('0xb')](function(_0x424236){logger['info'](_0x66aa('0xc'),_0x1eafb8,_0x66aa('0xd'));logger[_0x66aa('0xe')](_0x66aa('0xf'),_0x1eafb8,'request\x20sent',JSON[_0x66aa('0x10')](_0x424236));if(_0x424236[_0x66aa('0x11')]){if(_0x424236[_0x66aa('0x11')]['code']===0x1f4){logger[_0x66aa('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x1eafb8,_0x424236[_0x66aa('0x11')][_0x66aa('0x12')]);return _0xde0d86(_0x424236['error']['message']);}logger[_0x66aa('0x11')](_0x66aa('0xc'),_0x1eafb8,_0x424236[_0x66aa('0x11')]['message']);return _0x1d8bec(_0x424236[_0x66aa('0x11')][_0x66aa('0x12')]);}else{logger[_0x66aa('0x13')](_0x66aa('0xc'),_0x1eafb8,_0x66aa('0xd'));_0x1d8bec(_0x424236['result'][_0x66aa('0x12')]);}})[_0x66aa('0x14')](function(_0x235967){logger[_0x66aa('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x1eafb8,_0x235967);_0xde0d86(_0x235967);});});} \ No newline at end of file +var _0xe3d0=['code','VoiceMailMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3d0,0xe0));var _0x0e3d=function(_0x47e4ac,_0x529ef1){_0x47e4ac=_0x47e4ac-0x0;var _0x93ccda=_0xe3d0[_0x47e4ac];return _0x93ccda;};'use strict';var _=require(_0x0e3d('0x0'));var util=require(_0x0e3d('0x1'));var moment=require(_0x0e3d('0x2'));var BPromise=require('bluebird');var rs=require(_0x0e3d('0x3'));var fs=require('fs');var Redis=require(_0x0e3d('0x4'));var db=require(_0x0e3d('0x5'))['db'];var utils=require(_0x0e3d('0x6'));var logger=require(_0x0e3d('0x7'))(_0x0e3d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0e3d('0x9')][_0x0e3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x520101,_0xfecab4,_0x5a7449){return new BPromise(function(_0x4d00ed,_0x43f77e){return client[_0x0e3d('0xb')](_0x520101,_0x5a7449)[_0x0e3d('0xc')](function(_0xb223ae){logger[_0x0e3d('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0xfecab4,_0x0e3d('0xe'));logger[_0x0e3d('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0xfecab4,'request\x20sent',JSON[_0x0e3d('0x10')](_0xb223ae));if(_0xb223ae[_0x0e3d('0x11')]){if(_0xb223ae[_0x0e3d('0x11')][_0x0e3d('0x12')]===0x1f4){logger['error'](_0x0e3d('0x13'),_0xfecab4,_0xb223ae[_0x0e3d('0x11')][_0x0e3d('0x14')]);return _0x43f77e(_0xb223ae['error'][_0x0e3d('0x14')]);}logger[_0x0e3d('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0xfecab4,_0xb223ae[_0x0e3d('0x11')][_0x0e3d('0x14')]);return _0x4d00ed(_0xb223ae[_0x0e3d('0x11')]['message']);}else{logger['info'](_0x0e3d('0x13'),_0xfecab4,'request\x20sent');_0x4d00ed(_0xb223ae['result'][_0x0e3d('0x14')]);}})[_0x0e3d('0x15')](function(_0x17432a){logger['error'](_0x0e3d('0x13'),_0xfecab4,_0x17432a);_0x43f77e(_0x17432a);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 4460f7e..6eaf4b7 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 _0x97d8=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','addSound','update','delete','/:id','destroy','/:id/sounds/:id2','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x253b37,_0xdb7ae0){var _0x24b147=function(_0x38c58d){while(--_0x38c58d){_0x253b37['push'](_0x253b37['shift']());}};_0x24b147(++_0xdb7ae0);}(_0x97d8,0x1dc));var _0x897d=function(_0x108f82,_0x38c340){_0x108f82=_0x108f82-0x0;var _0x2c9f88=_0x97d8[_0x108f82];return _0x2c9f88;};'use strict';var multer=require(_0x897d('0x0'));var util=require(_0x897d('0x1'));var path=require('path');var timeout=require(_0x897d('0x2'));var express=require(_0x897d('0x3'));var router=express['Router']();var fs_extra=require(_0x897d('0x4'));var auth=require(_0x897d('0x5'));var interaction=require(_0x897d('0x6'));var config=require(_0x897d('0x7'));var controller=require(_0x897d('0x8'));router[_0x897d('0x9')]('/',auth[_0x897d('0xa')](),controller[_0x897d('0xb')]);router[_0x897d('0x9')]('/:id',auth[_0x897d('0xa')](),controller[_0x897d('0xc')]);router[_0x897d('0x9')](_0x897d('0xd'),auth[_0x897d('0xa')](),controller[_0x897d('0xe')]);router[_0x897d('0xf')]('/',auth[_0x897d('0xa')](),controller['create']);router[_0x897d('0xf')](_0x897d('0xd'),auth[_0x897d('0xa')](),controller[_0x897d('0x10')]);router['put']('/:id',auth[_0x897d('0xa')](),controller[_0x897d('0x11')]);router[_0x897d('0x12')](_0x897d('0x13'),auth[_0x897d('0xa')](),controller[_0x897d('0x14')]);router[_0x897d('0x12')](_0x897d('0x15'),auth[_0x897d('0xa')](),controller['removeSound']);module[_0x897d('0x16')]=router; \ No newline at end of file +var _0x519a=['create','addSound','put','/:id','delete','/:id/sounds/:id2','removeSound','exports','util','path','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','/:id/sounds','post'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x519a,0x15e));var _0xa519=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x519a[_0x386525];return _0x14d015;};'use strict';var multer=require('multer');var util=require(_0xa519('0x0'));var path=require(_0xa519('0x1'));var timeout=require('connect-timeout');var express=require(_0xa519('0x2'));var router=express[_0xa519('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa519('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa519('0x5'));var controller=require('./voiceMusicOnHold.controller');router[_0xa519('0x6')]('/',auth['isAuthenticated'](),controller[_0xa519('0x7')]);router[_0xa519('0x6')]('/:id',auth[_0xa519('0x8')](),controller['show']);router[_0xa519('0x6')](_0xa519('0x9'),auth[_0xa519('0x8')](),controller['getSounds']);router[_0xa519('0xa')]('/',auth['isAuthenticated'](),controller[_0xa519('0xb')]);router['post'](_0xa519('0x9'),auth['isAuthenticated'](),controller[_0xa519('0xc')]);router[_0xa519('0xd')](_0xa519('0xe'),auth[_0xa519('0x8')](),controller['update']);router[_0xa519('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xa519('0xf')](_0xa519('0x10'),auth[_0xa519('0x8')](),controller[_0xa519('0x11')]);module[_0xa519('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 57ce87c..88ba4e8 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 _0x47c1=['exports','name','custom','files','mp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x478b89,_0x184edc){var _0x4a9193=function(_0x2f3c21){while(--_0x2f3c21){_0x478b89['push'](_0x478b89['shift']());}};_0x4a9193(++_0x184edc);}(_0x47c1,0x14f));var _0x147c=function(_0x4d4f61,_0x56d7a7){_0x4d4f61=_0x4d4f61-0x0;var _0x297414=_0x47c1[_0x4d4f61];return _0x297414;};'use strict';var Sequelize=require(_0x147c('0x0'));module[_0x147c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x147c('0x2')},'mode':{'type':Sequelize['ENUM'](_0x147c('0x3'),_0x147c('0x4'),_0x147c('0x5'),'quietmp3nb',_0x147c('0x6'),_0x147c('0x7')),'allowNull':!![],'defaultValue':_0x147c('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x147c('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x147c('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x147c('0x8')],'allowNull':!![],'defaultValue':_0x147c('0x9')},'format':{'type':Sequelize[_0x147c('0x8')],'allowNull':!![]},'stamp':{'type':_0x147c('0xa')},'defaultEntry':{'type':Sequelize[_0x147c('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9793=['files','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','custom'];(function(_0x96112a,_0x2fa19b){var _0x479ffb=function(_0x21cfb6){while(--_0x21cfb6){_0x96112a['push'](_0x96112a['shift']());}};_0x479ffb(++_0x2fa19b);}(_0x9793,0x1e8));var _0x3979=function(_0x3efe67,_0x35230){_0x3efe67=_0x3efe67-0x0;var _0xb2045e=_0x9793[_0x3efe67];return _0xb2045e;};'use strict';var Sequelize=require(_0x3979('0x0'));module[_0x3979('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3979('0x2')},'mode':{'type':Sequelize['ENUM'](_0x3979('0x3'),_0x3979('0x4'),'mp3nb',_0x3979('0x5'),_0x3979('0x6'),_0x3979('0x7')),'allowNull':!![],'defaultValue':_0x3979('0x4')},'directory':{'type':Sequelize[_0x3979('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x3979('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x3979('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x3979('0x8')],'allowNull':!![],'defaultValue':_0x3979('0x9')},'format':{'type':Sequelize[_0x3979('0x8')],'allowNull':!![]},'stamp':{'type':_0x3979('0xa')},'defaultEntry':{'type':Sequelize[_0x3979('0xb')],'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 4036e52..4dde1da 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 _0x356a=['UserProfileResource','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','merge','find','body','sequelize','transaction','directory','join','create','mode','files','mkdirSync','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','save_name','converted_format','createdAt','format','basename','extname','root','server/files/moh','removeSound','findOne','id2','getSounds','order','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','save','update','then','destroy','get','MusicOnHolds'];(function(_0x34233f,_0x533ddb){var _0x4a4b1f=function(_0x49f6ad){while(--_0x49f6ad){_0x34233f['push'](_0x34233f['shift']());}};_0x4a4b1f(++_0x533ddb);}(_0x356a,0x11e));var _0xa356=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x356a[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa356('0x0'));var zipdir=require(_0xa356('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa356('0x2'));var moment=require(_0xa356('0x3'));var BPromise=require(_0xa356('0x4'));var Mustache=require(_0xa356('0x5'));var util=require(_0xa356('0x6'));var path=require(_0xa356('0x7'));var sox=require(_0xa356('0x8'));var csv=require(_0xa356('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa356('0xa'));var _=require(_0xa356('0xb'));var squel=require('squel');var crypto=require(_0xa356('0xc'));var jsforce=require(_0xa356('0xd'));var deskjs=require(_0xa356('0xe'));var toCsv=require(_0xa356('0x9'));var querystring=require(_0xa356('0xf'));var Papa=require(_0xa356('0x10'));var Redis=require(_0xa356('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa356('0x12'));var as=require(_0xa356('0x13'));var hardwareService=require(_0xa356('0x14'));var logger=require(_0xa356('0x15'))(_0xa356('0x16'));var utils=require('../../config/utils');var config=require(_0xa356('0x17'));var licenseUtil=require(_0xa356('0x18'));var db=require(_0xa356('0x19'))['db'];function respondWithStatusCode(_0x17c500,_0x48a0a2){_0x48a0a2=_0x48a0a2||0xcc;return function(_0x584707){if(_0x584707){return _0x17c500[_0xa356('0x1a')](_0x48a0a2);}return _0x17c500[_0xa356('0x1b')](_0x48a0a2)[_0xa356('0x1c')]();};}function respondWithResult(_0x479003,_0x1416cf){_0x1416cf=_0x1416cf||0xc8;return function(_0x1daa6d){if(_0x1daa6d){return _0x479003[_0xa356('0x1b')](_0x1416cf)['json'](_0x1daa6d);}};}function respondWithFilteredResult(_0x3a6107,_0x256d8f){return function(_0x184ccd){if(_0x184ccd){var _0x1131c1=typeof _0x256d8f[_0xa356('0x1d')]==='undefined'&&typeof _0x256d8f[_0xa356('0x1e')]===_0xa356('0x1f');var _0x5c42c3=_0x184ccd['count'];var _0x4c43f8=_0x1131c1?0x0:_0x256d8f[_0xa356('0x1d')];var _0x17c4b3=_0x1131c1?_0x184ccd[_0xa356('0x20')]:_0x256d8f[_0xa356('0x1d')]+_0x256d8f[_0xa356('0x1e')];var _0x161269;if(_0x17c4b3>=_0x5c42c3){_0x17c4b3=_0x5c42c3;_0x161269=0xc8;}else{_0x161269=0xce;}_0x3a6107[_0xa356('0x1b')](_0x161269);return _0x3a6107[_0xa356('0x21')]('Content-Range',_0x4c43f8+'-'+_0x17c4b3+'/'+_0x5c42c3)[_0xa356('0x22')](_0x184ccd);}return null;};}function patchUpdates(_0x3b2983){return function(_0x14190f){try{jsonpatch['apply'](_0x14190f,_0x3b2983,!![]);}catch(_0x1c90ef){return BPromise['reject'](_0x1c90ef);}return _0x14190f[_0xa356('0x23')]();};}function saveUpdates(_0x379ba7,_0x46a1a1){return function(_0x5066f0){if(_0x5066f0){return _0x5066f0[_0xa356('0x24')](_0x379ba7)[_0xa356('0x25')](function(_0x226955){return _0x226955;});}return null;};}function removeEntity(_0x5e263e,_0x1d7925){return function(_0x55c32b){if(_0x55c32b){return _0x55c32b[_0xa356('0x26')]()['then'](function(){var _0x381355=_0x55c32b[_0xa356('0x27')]({'plain':!![]});var _0xedee26=_0xa356('0x28');return db[_0xa356('0x29')][_0xa356('0x26')]({'where':{'type':_0xedee26,'resourceId':_0x381355['id']}})[_0xa356('0x25')](function(){return _0x55c32b;});})[_0xa356('0x25')](function(){_0x5e263e['status'](0xcc)[_0xa356('0x1c')]();});}};}function handleEntityNotFound(_0x271496,_0x598a5c){return function(_0x3cdbdf){if(!_0x3cdbdf){_0x271496[_0xa356('0x1a')](0x194);}return _0x3cdbdf;};}function handleError(_0x455b8e,_0x8bdcaf){_0x8bdcaf=_0x8bdcaf||0x1f4;return function(_0x207af8){logger[_0xa356('0x2a')](_0x207af8[_0xa356('0x2b')]);if(_0x207af8[_0xa356('0x2c')]){delete _0x207af8[_0xa356('0x2c')];}_0x455b8e['status'](_0x8bdcaf)['send'](_0x207af8);};}exports[_0xa356('0x2d')]=function(_0x47e374,_0x25ca27){var _0x1e08f3={},_0x5890eb={},_0xe1f7fe={'count':0x0,'rows':[]};var _0xaad642=_[_0xa356('0x2e')](db[_0xa356('0x2f')][_0xa356('0x30')],function(_0x431635){return{'name':_0x431635[_0xa356('0x31')],'type':_0x431635['type'][_0xa356('0x32')]};});_0x5890eb['model']=_[_0xa356('0x2e')](_0xaad642,_0xa356('0x2c'));_0x5890eb[_0xa356('0x33')]=_[_0xa356('0x34')](_0x47e374[_0xa356('0x33')]);_0x5890eb[_0xa356('0x35')]=_[_0xa356('0x36')](_0x5890eb['model'],_0x5890eb[_0xa356('0x33')]);_0x1e08f3[_0xa356('0x37')]=_[_0xa356('0x36')](_0x5890eb[_0xa356('0x38')],qs[_0xa356('0x39')](_0x47e374[_0xa356('0x33')][_0xa356('0x39')]));_0x1e08f3[_0xa356('0x37')]=_0x1e08f3[_0xa356('0x37')][_0xa356('0x3a')]?_0x1e08f3[_0xa356('0x37')]:_0x5890eb[_0xa356('0x38')];if(!_0x47e374[_0xa356('0x33')][_0xa356('0x3b')](_0xa356('0x3c'))){_0x1e08f3[_0xa356('0x1e')]=qs[_0xa356('0x1e')](_0x47e374[_0xa356('0x33')][_0xa356('0x1e')]);_0x1e08f3[_0xa356('0x1d')]=qs[_0xa356('0x1d')](_0x47e374[_0xa356('0x33')][_0xa356('0x1d')]);}_0x1e08f3['order']=qs['sort'](_0x47e374['query'][_0xa356('0x3d')]);delete _0x47e374[_0xa356('0x33')][_0xa356('0x3d')];_0x1e08f3[_0xa356('0x3e')]=qs['filters'](_[_0xa356('0x3f')](_0x47e374[_0xa356('0x33')],_0x5890eb[_0xa356('0x35')]),_0xaad642);if(_0x47e374['query'][_0xa356('0x40')]){_0x1e08f3['where']=_['merge'](_0x1e08f3[_0xa356('0x3e')],{'$or':_[_0xa356('0x2e')](_0xaad642,function(_0x8ff40d){if(_0x8ff40d['type']!==_0xa356('0x41')){var _0x57b1c2={};_0x57b1c2[_0x8ff40d[_0xa356('0x2c')]]={'$like':'%'+_0x47e374[_0xa356('0x33')][_0xa356('0x40')]+'%'};return _0x57b1c2;}})});}_0x1e08f3=_['merge']({},_0x1e08f3,_0x47e374[_0xa356('0x42')]);var _0x1a998d={'where':_0x1e08f3[_0xa356('0x3e')]};return db['VoiceMusicOnHold']['count'](_0x1a998d)[_0xa356('0x25')](function(_0xfdcf0b){_0xe1f7fe['count']=_0xfdcf0b;if(_0x47e374[_0xa356('0x33')][_0xa356('0x43')]){_0x1e08f3[_0xa356('0x44')]=[{'all':!![]}];}return db[_0xa356('0x2f')][_0xa356('0x45')](_0x1e08f3);})[_0xa356('0x25')](function(_0x33912c){_0xe1f7fe[_0xa356('0x46')]=_0x33912c;return _0xe1f7fe;})[_0xa356('0x25')](respondWithFilteredResult(_0x25ca27,_0x1e08f3))[_0xa356('0x47')](handleError(_0x25ca27,null));};exports['show']=function(_0x5c3138,_0x3da70e){var _0x59fc71={'raw':![],'where':{'id':_0x5c3138[_0xa356('0x48')]['id']}},_0x594563={};_0x594563[_0xa356('0x38')]=_[_0xa356('0x34')](db[_0xa356('0x2f')][_0xa356('0x30')]);_0x594563[_0xa356('0x33')]=_[_0xa356('0x34')](_0x5c3138[_0xa356('0x33')]);_0x594563[_0xa356('0x35')]=_['intersection'](_0x594563[_0xa356('0x38')],_0x594563[_0xa356('0x33')]);_0x59fc71[_0xa356('0x37')]=_[_0xa356('0x36')](_0x594563[_0xa356('0x38')],qs[_0xa356('0x39')](_0x5c3138['query'][_0xa356('0x39')]));_0x59fc71[_0xa356('0x37')]=_0x59fc71[_0xa356('0x37')][_0xa356('0x3a')]?_0x59fc71[_0xa356('0x37')]:_0x594563[_0xa356('0x38')];if(_0x5c3138[_0xa356('0x33')][_0xa356('0x43')]){_0x59fc71[_0xa356('0x44')]=[{'all':!![]}];}_0x59fc71=_[_0xa356('0x49')]({},_0x59fc71,_0x5c3138[_0xa356('0x42')]);return db[_0xa356('0x2f')][_0xa356('0x4a')](_0x59fc71)[_0xa356('0x25')](handleEntityNotFound(_0x3da70e,null))[_0xa356('0x25')](respondWithResult(_0x3da70e,null))[_0xa356('0x47')](handleError(_0x3da70e,null));};exports['update']=function(_0x563f29,_0x3ef736){if(_0x563f29[_0xa356('0x4b')]['id']){delete _0x563f29[_0xa356('0x4b')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x563f29[_0xa356('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ef736,null))[_0xa356('0x25')](saveUpdates(_0x563f29[_0xa356('0x4b')],null))[_0xa356('0x25')](respondWithResult(_0x3ef736,null))['catch'](handleError(_0x3ef736,null));};exports['create']=function(_0x50193e,_0xb644ad,_0x2d8497){return db[_0xa356('0x4c')][_0xa356('0x4d')](function(_0x440ca4){if(_0x50193e[_0xa356('0x4b')]['mode']==='files'){_0x50193e[_0xa356('0x4b')][_0xa356('0x4e')]=path[_0xa356('0x4f')](config['root'],'server/files/moh',_0x50193e['body']['name']);}return db[_0xa356('0x2f')][_0xa356('0x50')](_0x50193e[_0xa356('0x4b')],{'transaction':_0x440ca4})[_0xa356('0x25')](function(_0x59ba68){if(_0x50193e[_0xa356('0x4b')][_0xa356('0x51')]===_0xa356('0x52')){fs[_0xa356('0x53')](_0x59ba68['directory'],parseInt('0777',0x8));}var _0xd3aadb=_0x50193e[_0xa356('0x54')][_0xa356('0x27')]({'plain':!![]});if(!_0xd3aadb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd3aadb['role']===_0xa356('0x54')){var _0x4fad35=_0x59ba68['get']({'plain':!![]});return db[_0xa356('0x55')][_0xa356('0x4a')]({'where':{'name':_0xa356('0x28'),'userProfileId':_0xd3aadb[_0xa356('0x56')]},'raw':!![]})[_0xa356('0x25')](function(_0xb3460e){if(_0xb3460e&&_0xb3460e['autoAssociation']===0x0){return db[_0xa356('0x29')][_0xa356('0x50')]({'name':_0x4fad35[_0xa356('0x2c')],'resourceId':_0x4fad35['id'],'type':_0xb3460e[_0xa356('0x2c')],'sectionId':_0xb3460e['id']},{})[_0xa356('0x25')](function(){return _0x59ba68;});}else{return _0x59ba68;}})['catch'](function(_0x48502b){logger[_0xa356('0x2a')](_0xa356('0x57'),_0x48502b);});}return _0x59ba68;});})['then'](respondWithResult(_0xb644ad,0xc9))[_0xa356('0x47')](handleError(_0xb644ad,null));};exports[_0xa356('0x26')]=function(_0xa1182b,_0x3b4185,_0x4d5c1d){var _0x59249e;return db[_0xa356('0x2f')][_0xa356('0x4a')]({'where':{'id':_0xa1182b[_0xa356('0x48')]['id']}})[_0xa356('0x25')](function(_0x5e8c3c){if(_0x5e8c3c){return db[_0xa356('0x4c')][_0xa356('0x4d')](function(_0x1afc53){return _0x5e8c3c[_0xa356('0x26')]({'transaction':_0x1afc53,'raw':!![]})[_0xa356('0x25')](function(_0x45107a){if(_0x45107a['directory']){fs['readdirSync'](_0x45107a['directory'])[_0xa356('0x58')](function(_0x317330){fs[_0xa356('0x59')](path[_0xa356('0x4f')](_0x45107a['directory'],_0x317330));});fs[_0xa356('0x5a')](_0x45107a[_0xa356('0x4e')]);}return _0x45107a;});})['catch'](function(_0x412d9a){throw new db[(_0xa356('0x5b'))][(_0xa356('0x5c'))](_0x412d9a[_0xa356('0x5d')]);});}})[_0xa356('0x25')](handleEntityNotFound(_0x3b4185,null))[_0xa356('0x25')](removeEntity(_0x3b4185,null))[_0xa356('0x47')](handleError(_0x3b4185,null));};exports['addSound']=function(_0x3ec03e,_0x2b6524,_0x104c36){return db[_0xa356('0x4c')]['transaction'](function(_0x42634a){var _0x57c2f2;return db[_0xa356('0x2f')][_0xa356('0x4a')]({'where':{'id':_0x3ec03e[_0xa356('0x48')]['id']}})[_0xa356('0x25')](function(_0x4c62bf){if(_0x4c62bf){_0x57c2f2=_0x4c62bf;return _0x4c62bf[_0xa356('0x5e')](_0x3ec03e[_0xa356('0x4b')]['id'],{'transaction':_0x42634a});}})[_0xa356('0x25')](function(_0x58f814){if(_0x58f814){return db[_0xa356('0x5f')]['findOne']({'where':{'id':_0x3ec03e['body']['id']},'attributes':['id','name',_0xa356('0x60'),_0xa356('0x61'),_0xa356('0x62')],'raw':!![]});}})[_0xa356('0x25')](function(_0x2387cf){if(_0x2387cf){var _0xb1a4f5=path['join'](config['root'],'server/files/sounds/converted',util[_0xa356('0x63')]('%s.%s',path[_0xa356('0x64')](_0x2387cf[_0xa356('0x60')],path[_0xa356('0x65')](_0x2387cf[_0xa356('0x60')])),_0x2387cf[_0xa356('0x61')]));var _0x5750cd=path[_0xa356('0x4f')](config[_0xa356('0x66')],_0xa356('0x67'),_0x57c2f2['name'],util[_0xa356('0x63')]('%s.%s',_0x2387cf[_0xa356('0x2c')],_0x2387cf[_0xa356('0x61')]));fs['symlinkSync'](_0xb1a4f5,_0x5750cd);return _0x2387cf;}})[_0xa356('0x47')](function(_0x17c930){throw new db[(_0xa356('0x5b'))][(_0xa356('0x5c'))](_0x17c930[_0xa356('0x5d')]);});})['then'](handleEntityNotFound(_0x2b6524,null))[_0xa356('0x25')](respondWithResult(_0x2b6524,0xc9))['catch'](handleError(_0x2b6524,null));};exports[_0xa356('0x68')]=function(_0x3c5cee,_0x2aa6b0,_0x5a48c3){return db[_0xa356('0x4c')][_0xa356('0x4d')](function(_0x292584){var _0x1a5914;return db[_0xa356('0x2f')][_0xa356('0x69')]({'where':{'id':_0x3c5cee[_0xa356('0x48')]['id']}})[_0xa356('0x25')](handleEntityNotFound(_0x2aa6b0,null))['then'](function(_0x31d068){if(_0x31d068){_0x1a5914=_0x31d068;return _0x31d068[_0xa356('0x68')](_0x3c5cee['params'][_0xa356('0x6a')]);}})[_0xa356('0x25')](function(_0x5d9b85){if(_0x5d9b85){return db[_0xa356('0x5f')][_0xa356('0x69')]({'where':{'id':_0x3c5cee[_0xa356('0x48')][_0xa356('0x6a')]},'attributes':['id',_0xa356('0x2c'),_0xa356('0x60'),_0xa356('0x61'),_0xa356('0x62')],'raw':!![]});}})['then'](function(_0x3ba8d9){if(_0x3ba8d9){fs['unlinkSync'](path[_0xa356('0x4f')](_0x1a5914[_0xa356('0x4e')],util['format']('%s.%s',_0x3ba8d9[_0xa356('0x2c')],_0x3ba8d9[_0xa356('0x61')])));return _0x3ba8d9;}})[_0xa356('0x47')](function(_0x52f895){throw new db[(_0xa356('0x5b'))]['ValidationError'](_0x52f895[_0xa356('0x5d')]);});})[_0xa356('0x25')](handleEntityNotFound(_0x2aa6b0,null))[_0xa356('0x25')](respondWithStatusCode(_0x2aa6b0,0xcc))['catch'](handleError(_0x2aa6b0,null));};exports[_0xa356('0x6b')]=function(_0xd1fc12,_0x318665,_0x3bf06e){var _0x5cb360={};var _0x2b8400={};var _0x5b8a4c;var _0xa7b263;return db[_0xa356('0x2f')][_0xa356('0x69')]({'where':{'id':_0xd1fc12[_0xa356('0x48')]['id']}})['then'](handleEntityNotFound(_0x318665,null))[_0xa356('0x25')](function(_0x41e81f){if(_0x41e81f){_0x5b8a4c=_0x41e81f;_0x2b8400[_0xa356('0x38')]=_[_0xa356('0x34')](db[_0xa356('0x5f')]['rawAttributes']);_0x2b8400[_0xa356('0x33')]=_[_0xa356('0x34')](_0xd1fc12[_0xa356('0x33')]);_0x2b8400[_0xa356('0x35')]=_[_0xa356('0x36')](_0x2b8400[_0xa356('0x38')],_0x2b8400[_0xa356('0x33')]);_0x5cb360[_0xa356('0x37')]=_[_0xa356('0x36')](_0x2b8400[_0xa356('0x38')],qs[_0xa356('0x39')](_0xd1fc12[_0xa356('0x33')][_0xa356('0x39')]));_0x5cb360[_0xa356('0x37')]=_0x5cb360[_0xa356('0x37')][_0xa356('0x3a')]?_0x5cb360[_0xa356('0x37')]:_0x2b8400['model'];_0x5cb360[_0xa356('0x6c')]=qs['sort'](_0xd1fc12[_0xa356('0x33')][_0xa356('0x3d')]);_0x5cb360[_0xa356('0x3e')]=qs[_0xa356('0x35')](_['pick'](_0xd1fc12[_0xa356('0x33')],_0x2b8400[_0xa356('0x35')]));if(_0xd1fc12['query'][_0xa356('0x40')]){_0x5cb360[_0xa356('0x3e')]=_['merge'](_0x5cb360[_0xa356('0x3e')],{'$or':_[_0xa356('0x2e')](_0x5cb360[_0xa356('0x37')],function(_0x48b529){var _0xa4d221={};_0xa4d221[_0x48b529]={'$like':'%'+_0xd1fc12[_0xa356('0x33')][_0xa356('0x40')]+'%'};return _0xa4d221;})});}_0x5cb360=_[_0xa356('0x49')]({},_0x5cb360,_0xd1fc12[_0xa356('0x42')]);return _0x5b8a4c[_0xa356('0x6b')](_0x5cb360);}})[_0xa356('0x25')](function(_0x59a808){if(_0x59a808){_0xa7b263=_0x59a808[_0xa356('0x3a')];if(!_0xd1fc12[_0xa356('0x33')]['hasOwnProperty'](_0xa356('0x3c'))){_0x5cb360['limit']=qs['limit'](_0xd1fc12['query'][_0xa356('0x1e')]);_0x5cb360[_0xa356('0x1d')]=qs['offset'](_0xd1fc12['query'][_0xa356('0x1d')]);}return _0x5b8a4c[_0xa356('0x6b')](_0x5cb360);}})['then'](function(_0x2945f2){if(_0x2945f2){return _0x2945f2?{'count':_0xa7b263,'rows':_0x2945f2}:null;}})[_0xa356('0x25')](respondWithResult(_0x318665,null))[_0xa356('0x47')](handleError(_0x318665,null));}; \ No newline at end of file +var _0x3da7=['name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','VoiceMusicOnHold','includeAll','findAll','catch','show','params','find','body','create','sequelize','transaction','mode','files','directory','join','root','mkdirSync','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','readdirSync','forEach','unlinkSync','ValidationError','message','addSound','Sound','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','save_name','extname','symlinkSync','removeSound','findOne','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','then','MusicOnHolds','UserProfileResource','end','error','stack'];(function(_0x398379,_0x20ac70){var _0x206be9=function(_0x43ff9b){while(--_0x43ff9b){_0x398379['push'](_0x398379['shift']());}};_0x206be9(++_0x20ac70);}(_0x3da7,0x1e9));var _0x73da=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0x3da7[_0x1ebe90];return _0x447c82;};'use strict';var emlformat=require(_0x73da('0x0'));var rimraf=require(_0x73da('0x1'));var zipdir=require(_0x73da('0x2'));var jsonpatch=require(_0x73da('0x3'));var rp=require(_0x73da('0x4'));var moment=require('moment');var BPromise=require(_0x73da('0x5'));var Mustache=require(_0x73da('0x6'));var util=require('util');var path=require(_0x73da('0x7'));var sox=require(_0x73da('0x8'));var csv=require(_0x73da('0x9'));var ejs=require(_0x73da('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x73da('0xb'));var crypto=require(_0x73da('0xc'));var jsforce=require(_0x73da('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x73da('0x9'));var querystring=require('querystring');var Papa=require(_0x73da('0xe'));var Redis=require(_0x73da('0xf'));var authService=require(_0x73da('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x73da('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x73da('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x73da('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x110a90,_0x13e93a){_0x13e93a=_0x13e93a||0xcc;return function(_0x183036){if(_0x183036){return _0x110a90[_0x73da('0x14')](_0x13e93a);}return _0x110a90[_0x73da('0x15')](_0x13e93a)['end']();};}function respondWithResult(_0x462cee,_0x29162d){_0x29162d=_0x29162d||0xc8;return function(_0x1b3582){if(_0x1b3582){return _0x462cee[_0x73da('0x15')](_0x29162d)['json'](_0x1b3582);}};}function respondWithFilteredResult(_0x64f7b,_0x409ba7){return function(_0xa36669){if(_0xa36669){var _0x53a048=typeof _0x409ba7[_0x73da('0x16')]===_0x73da('0x17')&&typeof _0x409ba7[_0x73da('0x18')]===_0x73da('0x17');var _0x405e02=_0xa36669[_0x73da('0x19')];var _0x318251=_0x53a048?0x0:_0x409ba7[_0x73da('0x16')];var _0x3d288b=_0x53a048?_0xa36669[_0x73da('0x19')]:_0x409ba7[_0x73da('0x16')]+_0x409ba7[_0x73da('0x18')];var _0x9a281b;if(_0x3d288b>=_0x405e02){_0x3d288b=_0x405e02;_0x9a281b=0xc8;}else{_0x9a281b=0xce;}_0x64f7b['status'](_0x9a281b);return _0x64f7b['set'](_0x73da('0x1a'),_0x318251+'-'+_0x3d288b+'/'+_0x405e02)['json'](_0xa36669);}return null;};}function patchUpdates(_0x3069bc){return function(_0x493cb2){try{jsonpatch[_0x73da('0x1b')](_0x493cb2,_0x3069bc,!![]);}catch(_0x198652){return BPromise[_0x73da('0x1c')](_0x198652);}return _0x493cb2[_0x73da('0x1d')]();};}function saveUpdates(_0x2dbc2b,_0x184d99){return function(_0x5abe7c){if(_0x5abe7c){return _0x5abe7c['update'](_0x2dbc2b)[_0x73da('0x1e')](function(_0x2989a0){return _0x2989a0;});}return null;};}function removeEntity(_0x60cbd0,_0x19ddd7){return function(_0x5bbe44){if(_0x5bbe44){return _0x5bbe44['destroy']()[_0x73da('0x1e')](function(){var _0xeb78b=_0x5bbe44['get']({'plain':!![]});var _0x15a29c=_0x73da('0x1f');return db[_0x73da('0x20')]['destroy']({'where':{'type':_0x15a29c,'resourceId':_0xeb78b['id']}})[_0x73da('0x1e')](function(){return _0x5bbe44;});})[_0x73da('0x1e')](function(){_0x60cbd0['status'](0xcc)[_0x73da('0x21')]();});}};}function handleEntityNotFound(_0x237494,_0x28e5ce){return function(_0x29c9f5){if(!_0x29c9f5){_0x237494[_0x73da('0x14')](0x194);}return _0x29c9f5;};}function handleError(_0x37233f,_0x21e0b7){_0x21e0b7=_0x21e0b7||0x1f4;return function(_0xcbb718){logger[_0x73da('0x22')](_0xcbb718[_0x73da('0x23')]);if(_0xcbb718[_0x73da('0x24')]){delete _0xcbb718['name'];}_0x37233f[_0x73da('0x15')](_0x21e0b7)[_0x73da('0x25')](_0xcbb718);};}exports['index']=function(_0x186227,_0x57c6b9){var _0x44debd={},_0x222449={},_0x5273e2={'count':0x0,'rows':[]};var _0x5065f5=_[_0x73da('0x26')](db['VoiceMusicOnHold'][_0x73da('0x27')],function(_0x5cb8b8){return{'name':_0x5cb8b8[_0x73da('0x28')],'type':_0x5cb8b8['type'][_0x73da('0x29')]};});_0x222449[_0x73da('0x2a')]=_['map'](_0x5065f5,_0x73da('0x24'));_0x222449[_0x73da('0x2b')]=_[_0x73da('0x2c')](_0x186227['query']);_0x222449[_0x73da('0x2d')]=_[_0x73da('0x2e')](_0x222449[_0x73da('0x2a')],_0x222449[_0x73da('0x2b')]);_0x44debd[_0x73da('0x2f')]=_['intersection'](_0x222449[_0x73da('0x2a')],qs[_0x73da('0x30')](_0x186227['query'][_0x73da('0x30')]));_0x44debd[_0x73da('0x2f')]=_0x44debd[_0x73da('0x2f')][_0x73da('0x31')]?_0x44debd[_0x73da('0x2f')]:_0x222449[_0x73da('0x2a')];if(!_0x186227[_0x73da('0x2b')][_0x73da('0x32')](_0x73da('0x33'))){_0x44debd[_0x73da('0x18')]=qs['limit'](_0x186227[_0x73da('0x2b')][_0x73da('0x18')]);_0x44debd['offset']=qs['offset'](_0x186227['query'][_0x73da('0x16')]);}_0x44debd[_0x73da('0x34')]=qs[_0x73da('0x35')](_0x186227[_0x73da('0x2b')][_0x73da('0x35')]);delete _0x186227[_0x73da('0x2b')]['sort'];_0x44debd[_0x73da('0x36')]=qs[_0x73da('0x2d')](_[_0x73da('0x37')](_0x186227[_0x73da('0x2b')],_0x222449[_0x73da('0x2d')]),_0x5065f5);if(_0x186227['query'][_0x73da('0x38')]){_0x44debd[_0x73da('0x36')]=_['merge'](_0x44debd['where'],{'$or':_['map'](_0x5065f5,function(_0x18e538){if(_0x18e538[_0x73da('0x39')]!==_0x73da('0x3a')){var _0x1c197f={};_0x1c197f[_0x18e538[_0x73da('0x24')]]={'$like':'%'+_0x186227[_0x73da('0x2b')][_0x73da('0x38')]+'%'};return _0x1c197f;}})});}_0x44debd=_[_0x73da('0x3b')]({},_0x44debd,_0x186227[_0x73da('0x3c')]);var _0x423821={'where':_0x44debd['where']};return db[_0x73da('0x3d')]['count'](_0x423821)[_0x73da('0x1e')](function(_0x124848){_0x5273e2['count']=_0x124848;if(_0x186227[_0x73da('0x2b')][_0x73da('0x3e')]){_0x44debd['include']=[{'all':!![]}];}return db[_0x73da('0x3d')][_0x73da('0x3f')](_0x44debd);})[_0x73da('0x1e')](function(_0x380170){_0x5273e2['rows']=_0x380170;return _0x5273e2;})[_0x73da('0x1e')](respondWithFilteredResult(_0x57c6b9,_0x44debd))[_0x73da('0x40')](handleError(_0x57c6b9,null));};exports[_0x73da('0x41')]=function(_0x25fa6d,_0x565b42){var _0x2adb5a={'raw':![],'where':{'id':_0x25fa6d[_0x73da('0x42')]['id']}},_0x40c375={};_0x40c375[_0x73da('0x2a')]=_[_0x73da('0x2c')](db[_0x73da('0x3d')]['rawAttributes']);_0x40c375['query']=_[_0x73da('0x2c')](_0x25fa6d[_0x73da('0x2b')]);_0x40c375['filters']=_[_0x73da('0x2e')](_0x40c375[_0x73da('0x2a')],_0x40c375['query']);_0x2adb5a[_0x73da('0x2f')]=_[_0x73da('0x2e')](_0x40c375[_0x73da('0x2a')],qs[_0x73da('0x30')](_0x25fa6d[_0x73da('0x2b')][_0x73da('0x30')]));_0x2adb5a[_0x73da('0x2f')]=_0x2adb5a[_0x73da('0x2f')]['length']?_0x2adb5a[_0x73da('0x2f')]:_0x40c375[_0x73da('0x2a')];if(_0x25fa6d[_0x73da('0x2b')]['includeAll']){_0x2adb5a['include']=[{'all':!![]}];}_0x2adb5a=_[_0x73da('0x3b')]({},_0x2adb5a,_0x25fa6d[_0x73da('0x3c')]);return db[_0x73da('0x3d')][_0x73da('0x43')](_0x2adb5a)['then'](handleEntityNotFound(_0x565b42,null))['then'](respondWithResult(_0x565b42,null))[_0x73da('0x40')](handleError(_0x565b42,null));};exports['update']=function(_0x3d3aaf,_0x2edfc3){if(_0x3d3aaf[_0x73da('0x44')]['id']){delete _0x3d3aaf[_0x73da('0x44')]['id'];}return db[_0x73da('0x3d')]['find']({'where':{'id':_0x3d3aaf[_0x73da('0x42')]['id']}})[_0x73da('0x1e')](handleEntityNotFound(_0x2edfc3,null))[_0x73da('0x1e')](saveUpdates(_0x3d3aaf[_0x73da('0x44')],null))[_0x73da('0x1e')](respondWithResult(_0x2edfc3,null))['catch'](handleError(_0x2edfc3,null));};exports[_0x73da('0x45')]=function(_0xdb3be2,_0x2305d1,_0x21a512){return db[_0x73da('0x46')][_0x73da('0x47')](function(_0x3d6265){if(_0xdb3be2[_0x73da('0x44')][_0x73da('0x48')]===_0x73da('0x49')){_0xdb3be2[_0x73da('0x44')][_0x73da('0x4a')]=path[_0x73da('0x4b')](config[_0x73da('0x4c')],'server/files/moh',_0xdb3be2[_0x73da('0x44')][_0x73da('0x24')]);}return db['VoiceMusicOnHold'][_0x73da('0x45')](_0xdb3be2['body'],{'transaction':_0x3d6265})['then'](function(_0x4989f4){if(_0xdb3be2[_0x73da('0x44')][_0x73da('0x48')]===_0x73da('0x49')){fs[_0x73da('0x4d')](_0x4989f4[_0x73da('0x4a')],parseInt('0777',0x8));}var _0x52fc3c=_0xdb3be2[_0x73da('0x4e')][_0x73da('0x4f')]({'plain':!![]});if(!_0x52fc3c)throw new Error(_0x73da('0x50'));if(_0x52fc3c[_0x73da('0x51')]==='user'){var _0x3410b0=_0x4989f4[_0x73da('0x4f')]({'plain':!![]});return db['UserProfileSection'][_0x73da('0x43')]({'where':{'name':_0x73da('0x1f'),'userProfileId':_0x52fc3c[_0x73da('0x52')]},'raw':!![]})[_0x73da('0x1e')](function(_0x5d55a2){if(_0x5d55a2&&_0x5d55a2[_0x73da('0x53')]===0x0){return db[_0x73da('0x20')][_0x73da('0x45')]({'name':_0x3410b0[_0x73da('0x24')],'resourceId':_0x3410b0['id'],'type':_0x5d55a2[_0x73da('0x24')],'sectionId':_0x5d55a2['id']},{})[_0x73da('0x1e')](function(){return _0x4989f4;});}else{return _0x4989f4;}})[_0x73da('0x40')](function(_0x2ebc41){logger[_0x73da('0x22')](_0x73da('0x54'),_0x2ebc41);});}return _0x4989f4;});})[_0x73da('0x1e')](respondWithResult(_0x2305d1,0xc9))['catch'](handleError(_0x2305d1,null));};exports[_0x73da('0x55')]=function(_0x17528f,_0x1aea62,_0x5740ff){var _0x2436c8;return db[_0x73da('0x3d')][_0x73da('0x43')]({'where':{'id':_0x17528f[_0x73da('0x42')]['id']}})[_0x73da('0x1e')](function(_0x56695f){if(_0x56695f){return db[_0x73da('0x46')][_0x73da('0x47')](function(_0x3b0b4a){return _0x56695f[_0x73da('0x55')]({'transaction':_0x3b0b4a,'raw':!![]})['then'](function(_0x45a57a){if(_0x45a57a[_0x73da('0x4a')]){fs[_0x73da('0x56')](_0x45a57a['directory'])[_0x73da('0x57')](function(_0x101dda){fs[_0x73da('0x58')](path[_0x73da('0x4b')](_0x45a57a[_0x73da('0x4a')],_0x101dda));});fs['rmdirSync'](_0x45a57a[_0x73da('0x4a')]);}return _0x45a57a;});})[_0x73da('0x40')](function(_0x2ef78f){throw new db['Sequelize'][(_0x73da('0x59'))](_0x2ef78f[_0x73da('0x5a')]);});}})['then'](handleEntityNotFound(_0x1aea62,null))['then'](removeEntity(_0x1aea62,null))['catch'](handleError(_0x1aea62,null));};exports[_0x73da('0x5b')]=function(_0x17d734,_0x36833f,_0xb50879){return db[_0x73da('0x46')][_0x73da('0x47')](function(_0x3e3292){var _0x4d5636;return db[_0x73da('0x3d')]['find']({'where':{'id':_0x17d734['params']['id']}})[_0x73da('0x1e')](function(_0x20fdd2){if(_0x20fdd2){_0x4d5636=_0x20fdd2;return _0x20fdd2['addSound'](_0x17d734[_0x73da('0x44')]['id'],{'transaction':_0x3e3292});}})[_0x73da('0x1e')](function(_0x2d5acb){if(_0x2d5acb){return db[_0x73da('0x5c')]['findOne']({'where':{'id':_0x17d734[_0x73da('0x44')]['id']},'attributes':['id','name','save_name',_0x73da('0x5d'),_0x73da('0x5e')],'raw':!![]});}})['then'](function(_0x19a3e4){if(_0x19a3e4){var _0x2d1263=path[_0x73da('0x4b')](config['root'],_0x73da('0x5f'),util[_0x73da('0x60')](_0x73da('0x61'),path['basename'](_0x19a3e4[_0x73da('0x62')],path[_0x73da('0x63')](_0x19a3e4[_0x73da('0x62')])),_0x19a3e4[_0x73da('0x5d')]));var _0x29c637=path[_0x73da('0x4b')](config['root'],'server/files/moh',_0x4d5636['name'],util[_0x73da('0x60')](_0x73da('0x61'),_0x19a3e4['name'],_0x19a3e4[_0x73da('0x5d')]));fs[_0x73da('0x64')](_0x2d1263,_0x29c637);return _0x19a3e4;}})[_0x73da('0x40')](function(_0x551fac){throw new db['Sequelize'][(_0x73da('0x59'))](_0x551fac[_0x73da('0x5a')]);});})[_0x73da('0x1e')](handleEntityNotFound(_0x36833f,null))[_0x73da('0x1e')](respondWithResult(_0x36833f,0xc9))[_0x73da('0x40')](handleError(_0x36833f,null));};exports[_0x73da('0x65')]=function(_0x2f4c40,_0x25a340,_0x1b26be){return db['sequelize'][_0x73da('0x47')](function(_0x4b9976){var _0x4cb50e;return db[_0x73da('0x3d')][_0x73da('0x66')]({'where':{'id':_0x2f4c40['params']['id']}})[_0x73da('0x1e')](handleEntityNotFound(_0x25a340,null))[_0x73da('0x1e')](function(_0x16bc65){if(_0x16bc65){_0x4cb50e=_0x16bc65;return _0x16bc65[_0x73da('0x65')](_0x2f4c40[_0x73da('0x42')][_0x73da('0x67')]);}})[_0x73da('0x1e')](function(_0x463e5f){if(_0x463e5f){return db[_0x73da('0x5c')][_0x73da('0x66')]({'where':{'id':_0x2f4c40[_0x73da('0x42')][_0x73da('0x67')]},'attributes':['id',_0x73da('0x24'),'save_name',_0x73da('0x5d'),_0x73da('0x5e')],'raw':!![]});}})[_0x73da('0x1e')](function(_0x591c1f){if(_0x591c1f){fs['unlinkSync'](path[_0x73da('0x4b')](_0x4cb50e[_0x73da('0x4a')],util[_0x73da('0x60')](_0x73da('0x61'),_0x591c1f[_0x73da('0x24')],_0x591c1f[_0x73da('0x5d')])));return _0x591c1f;}})[_0x73da('0x40')](function(_0x1cfe14){throw new db['Sequelize'][(_0x73da('0x59'))](_0x1cfe14['message']);});})[_0x73da('0x1e')](handleEntityNotFound(_0x25a340,null))[_0x73da('0x1e')](respondWithStatusCode(_0x25a340,0xcc))[_0x73da('0x40')](handleError(_0x25a340,null));};exports[_0x73da('0x68')]=function(_0x5ebdcc,_0x18b363,_0x4764f3){var _0x51c0e5={};var _0x503124={};var _0x1660be;var _0x46a317;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5ebdcc[_0x73da('0x42')]['id']}})[_0x73da('0x1e')](handleEntityNotFound(_0x18b363,null))[_0x73da('0x1e')](function(_0xef17a4){if(_0xef17a4){_0x1660be=_0xef17a4;_0x503124[_0x73da('0x2a')]=_[_0x73da('0x2c')](db[_0x73da('0x5c')][_0x73da('0x27')]);_0x503124[_0x73da('0x2b')]=_['keys'](_0x5ebdcc['query']);_0x503124[_0x73da('0x2d')]=_['intersection'](_0x503124[_0x73da('0x2a')],_0x503124[_0x73da('0x2b')]);_0x51c0e5[_0x73da('0x2f')]=_[_0x73da('0x2e')](_0x503124[_0x73da('0x2a')],qs['fields'](_0x5ebdcc[_0x73da('0x2b')]['fields']));_0x51c0e5['attributes']=_0x51c0e5[_0x73da('0x2f')]['length']?_0x51c0e5[_0x73da('0x2f')]:_0x503124[_0x73da('0x2a')];_0x51c0e5[_0x73da('0x34')]=qs[_0x73da('0x35')](_0x5ebdcc[_0x73da('0x2b')][_0x73da('0x35')]);_0x51c0e5['where']=qs['filters'](_[_0x73da('0x37')](_0x5ebdcc[_0x73da('0x2b')],_0x503124[_0x73da('0x2d')]));if(_0x5ebdcc[_0x73da('0x2b')][_0x73da('0x38')]){_0x51c0e5[_0x73da('0x36')]=_[_0x73da('0x3b')](_0x51c0e5[_0x73da('0x36')],{'$or':_[_0x73da('0x26')](_0x51c0e5[_0x73da('0x2f')],function(_0x583b7e){var _0x508add={};_0x508add[_0x583b7e]={'$like':'%'+_0x5ebdcc[_0x73da('0x2b')][_0x73da('0x38')]+'%'};return _0x508add;})});}_0x51c0e5=_['merge']({},_0x51c0e5,_0x5ebdcc[_0x73da('0x3c')]);return _0x1660be['getSounds'](_0x51c0e5);}})[_0x73da('0x1e')](function(_0xdfff54){if(_0xdfff54){_0x46a317=_0xdfff54[_0x73da('0x31')];if(!_0x5ebdcc['query']['hasOwnProperty'](_0x73da('0x33'))){_0x51c0e5[_0x73da('0x18')]=qs[_0x73da('0x18')](_0x5ebdcc[_0x73da('0x2b')]['limit']);_0x51c0e5[_0x73da('0x16')]=qs[_0x73da('0x16')](_0x5ebdcc[_0x73da('0x2b')]['offset']);}return _0x1660be[_0x73da('0x68')](_0x51c0e5);}})[_0x73da('0x1e')](function(_0x49f965){if(_0x49f965){return _0x49f965?{'count':_0x46a317,'rows':_0x49f965}:null;}})['then'](respondWithResult(_0x18b363,null))[_0x73da('0x40')](handleError(_0x18b363,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index e6d4537..8ae497f 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 _0x99b0=['bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','util','api','moment'];(function(_0x14c55f,_0x38d253){var _0x56ab8b=function(_0xa4c62e){while(--_0xa4c62e){_0x14c55f['push'](_0x14c55f['shift']());}};_0x56ab8b(++_0x38d253);}(_0x99b0,0x1d0));var _0x099b=function(_0x260e4b,_0x54668d){_0x260e4b=_0x260e4b-0x0;var _0x18dfba=_0x99b0[_0x260e4b];return _0x18dfba;};'use strict';var _=require(_0x099b('0x0'));var util=require(_0x099b('0x1'));var logger=require('../../config/logger')(_0x099b('0x2'));var moment=require(_0x099b('0x3'));var BPromise=require(_0x099b('0x4'));var rp=require(_0x099b('0x5'));var fs=require('fs');var path=require(_0x099b('0x6'));var rimraf=require('rimraf');var config=require(_0x099b('0x7'));var attributes=require(_0x099b('0x8'));module[_0x099b('0x9')]=function(_0x48f3cd,_0x211c0d){return _0x48f3cd[_0x099b('0xa')](_0x099b('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44c5=['util','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x304e0e,_0x33b054){var _0x568db1=function(_0x3db7dc){while(--_0x3db7dc){_0x304e0e['push'](_0x304e0e['shift']());}};_0x568db1(++_0x33b054);}(_0x44c5,0xef));var _0x544c=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0x44c5[_0x2ade6c];return _0x2cb372;};'use strict';var _=require(_0x544c('0x0'));var util=require(_0x544c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x544c('0x2'));var BPromise=require(_0x544c('0x3'));var rp=require(_0x544c('0x4'));var fs=require('fs');var path=require(_0x544c('0x5'));var rimraf=require(_0x544c('0x6'));var config=require('../../config/environment');var attributes=require(_0x544c('0x7'));module[_0x544c('0x8')]=function(_0x196930,_0xe8af13){return _0x196930[_0x544c('0x9')](_0x544c('0xa'),attributes,{'tableName':_0x544c('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 5133c1c..73a384a 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4239b1,_0x509382){var _0x46bf7c=function(_0x12e400){while(--_0x12e400){_0x4239b1['push'](_0x4239b1['shift']());}};_0x46bf7c(++_0x509382);}(_0xe706,0xa3));var _0x6e70=function(_0x380fa9,_0x5123eb){_0x380fa9=_0x380fa9-0x0;var _0x4f2532=_0xe706[_0x380fa9];return _0x4f2532;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4ec34f,_0x3ebe0e){var _0x36305b=function(_0xf9e5a6){while(--_0xf9e5a6){_0x4ec34f['push'](_0x4ec34f['shift']());}};_0x36305b(++_0x3ebe0e);}(_0x34e8,0x12c));var _0x834e=function(_0x322d37,_0x11d37e){_0x322d37=_0x322d37-0x0;var _0x206cc2=_0x34e8[_0x322d37];return _0x206cc2;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 4dc4c08..b720f3d 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 _0xa348=['update','delete','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put'];(function(_0x2a0189,_0x5277d6){var _0x57b03c=function(_0x4e4474){while(--_0x4e4474){_0x2a0189['push'](_0x2a0189['shift']());}};_0x57b03c(++_0x5277d6);}(_0xa348,0xb2));var _0x8a34=function(_0x534774,_0x1efcd8){_0x534774=_0x534774-0x0;var _0xe582ad=_0xa348[_0x534774];return _0xe582ad;};'use strict';var multer=require(_0x8a34('0x0'));var util=require('util');var path=require(_0x8a34('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8a34('0x2'));var auth=require(_0x8a34('0x3'));var interaction=require(_0x8a34('0x4'));var config=require(_0x8a34('0x5'));var controller=require(_0x8a34('0x6'));router[_0x8a34('0x7')]('/',auth[_0x8a34('0x8')](),controller[_0x8a34('0x9')]);router[_0x8a34('0x7')](_0x8a34('0xa'),auth['isAuthenticated'](),controller[_0x8a34('0xb')]);router[_0x8a34('0x7')](_0x8a34('0xc'),auth[_0x8a34('0x8')](),controller['show']);router[_0x8a34('0x7')](_0x8a34('0xd'),auth['isAuthenticated'](),controller[_0x8a34('0xe')]);router[_0x8a34('0x7')](_0x8a34('0xf'),auth[_0x8a34('0x8')](),controller[_0x8a34('0x10')]);router[_0x8a34('0x11')]('/',auth[_0x8a34('0x8')](),controller[_0x8a34('0x12')]);router['post']('/:id/users',auth[_0x8a34('0x8')](),controller[_0x8a34('0x13')]);router['post'](_0x8a34('0xf'),auth[_0x8a34('0x8')](),controller[_0x8a34('0x14')]);router[_0x8a34('0x15')](_0x8a34('0xc'),auth[_0x8a34('0x8')](),controller[_0x8a34('0x16')]);router[_0x8a34('0x17')](_0x8a34('0xc'),auth[_0x8a34('0x8')](),controller['destroy']);router[_0x8a34('0x17')](_0x8a34('0xd'),auth['isAuthenticated'](),controller['removeAgents']);router[_0x8a34('0x17')](_0x8a34('0xf'),auth[_0x8a34('0x8')](),controller['removeTeams']);module[_0x8a34('0x18')]=router; \ No newline at end of file +var _0xf185=['destroy','delete','removeAgents','removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','/:id/users','getAgents','getTeams','post','addAgents','/:id/teams','addTeams','put'];(function(_0x1431c9,_0x118452){var _0x243d70=function(_0x52dd6f){while(--_0x52dd6f){_0x1431c9['push'](_0x1431c9['shift']());}};_0x243d70(++_0x118452);}(_0xf185,0x1be));var _0x5f18=function(_0x41b6fd,_0x5ac139){_0x41b6fd=_0x41b6fd-0x0;var _0x4a1f91=_0xf185[_0x41b6fd];return _0x4a1f91;};'use strict';var multer=require(_0x5f18('0x0'));var util=require('util');var path=require(_0x5f18('0x1'));var timeout=require(_0x5f18('0x2'));var express=require(_0x5f18('0x3'));var router=express[_0x5f18('0x4')]();var fs_extra=require(_0x5f18('0x5'));var auth=require(_0x5f18('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f18('0x7'));var controller=require(_0x5f18('0x8'));router[_0x5f18('0x9')]('/',auth[_0x5f18('0xa')](),controller['index']);router[_0x5f18('0x9')](_0x5f18('0xb'),auth['isAuthenticated'](),controller[_0x5f18('0xc')]);router['get'](_0x5f18('0xd'),auth[_0x5f18('0xa')](),controller['show']);router[_0x5f18('0x9')](_0x5f18('0xe'),auth['isAuthenticated'](),controller[_0x5f18('0xf')]);router[_0x5f18('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5f18('0x10')]);router[_0x5f18('0x11')]('/',auth[_0x5f18('0xa')](),controller['create']);router[_0x5f18('0x11')](_0x5f18('0xe'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x12')]);router[_0x5f18('0x11')](_0x5f18('0x13'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x14')]);router[_0x5f18('0x15')]('/:id',auth[_0x5f18('0xa')](),controller['update']);router['delete'](_0x5f18('0xd'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x16')]);router[_0x5f18('0x17')](_0x5f18('0xe'),auth['isAuthenticated'](),controller[_0x5f18('0x18')]);router[_0x5f18('0x17')](_0x5f18('0x13'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x19')]);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 c573ec4..1ea6cd4 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 _0x098f=['STRING','INTEGER','sequelize','exports','name','system-'];(function(_0x5cf5d8,_0x202d0a){var _0x4305a2=function(_0x2495b3){while(--_0x2495b3){_0x5cf5d8['push'](_0x5cf5d8['shift']());}};_0x4305a2(++_0x202d0a);}(_0x098f,0xc2));var _0xf098=function(_0x1277c7,_0x3b3d62){_0x1277c7=_0x1277c7-0x0;var _0x4e5258=_0x098f[_0x1277c7];return _0x4e5258;};'use strict';var Sequelize=require(_0xf098('0x0'));module[_0xf098('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf098('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x13a2c0){return _0xf098('0x3')+this['getDataValue'](_0xf098('0x2'))+'-';}},'description':{'type':Sequelize[_0xf098('0x4')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xf098('0x5')]}}; \ No newline at end of file +var _0x241b=['name','system-','getDataValue','INTEGER','exports','STRING'];(function(_0x356c87,_0x420cf2){var _0x927957=function(_0x5ded5e){while(--_0x5ded5e){_0x356c87['push'](_0x356c87['shift']());}};_0x927957(++_0x420cf2);}(_0x241b,0x1d2));var _0xb241=function(_0x19d727,_0x228e7e){_0x19d727=_0x19d727-0x0;var _0x596726=_0x241b[_0x19d727];return _0x596726;};'use strict';var Sequelize=require('sequelize');module[_0xb241('0x0')]={'name':{'type':Sequelize[_0xb241('0x1')],'allowNull':![],'unique':_0xb241('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x3fcc40){return _0xb241('0x3')+this[_0xb241('0x4')](_0xb241('0x2'))+'-';}},'description':{'type':Sequelize[_0xb241('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xb241('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index ff5f3fc..4585a26 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 _0xb9be=['addAgents','emit','userVoicePrefix:save','ids','isArray','userVoicePrefix:remove','getAgents','findOne','order','Team','pick','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','User','select','field','tq.TeamId','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','name','index','map','VoicePrefix','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','sequelize','transaction','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','prefix','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-'];(function(_0x465b0c,_0x569d90){var _0x502ff0=function(_0x221757){while(--_0x221757){_0x465b0c['push'](_0x465b0c['shift']());}};_0x502ff0(++_0x569d90);}(_0xb9be,0xc5));var _0xeb9b=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0xb9be[_0x496738];return _0xee1381;};'use strict';var emlformat=require(_0xeb9b('0x0'));var rimraf=require(_0xeb9b('0x1'));var zipdir=require(_0xeb9b('0x2'));var jsonpatch=require(_0xeb9b('0x3'));var rp=require(_0xeb9b('0x4'));var moment=require(_0xeb9b('0x5'));var BPromise=require(_0xeb9b('0x6'));var Mustache=require(_0xeb9b('0x7'));var util=require(_0xeb9b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xeb9b('0x9'));var ejs=require(_0xeb9b('0xa'));var fs=require('fs');var fs_extra=require(_0xeb9b('0xb'));var _=require('lodash');var squel=require(_0xeb9b('0xc'));var crypto=require(_0xeb9b('0xd'));var jsforce=require(_0xeb9b('0xe'));var deskjs=require(_0xeb9b('0xf'));var toCsv=require(_0xeb9b('0x9'));var querystring=require(_0xeb9b('0x10'));var Papa=require(_0xeb9b('0x11'));var Redis=require(_0xeb9b('0x12'));var authService=require(_0xeb9b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9b('0x15'));var utils=require(_0xeb9b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xeb9b('0x17'));var db=require(_0xeb9b('0x18'))['db'];config[_0xeb9b('0x19')]=_[_0xeb9b('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb9b('0x19')]));require(_0xeb9b('0x1b'))[_0xeb9b('0x1c')](socket);function respondWithStatusCode(_0x4ec46d,_0x5926e1){_0x5926e1=_0x5926e1||0xcc;return function(_0x4f8182){if(_0x4f8182){return _0x4ec46d[_0xeb9b('0x1d')](_0x5926e1);}return _0x4ec46d[_0xeb9b('0x1e')](_0x5926e1)[_0xeb9b('0x1f')]();};}function respondWithResult(_0x3fa308,_0x2c9aa6){_0x2c9aa6=_0x2c9aa6||0xc8;return function(_0x10da6e){if(_0x10da6e){return _0x3fa308[_0xeb9b('0x1e')](_0x2c9aa6)['json'](_0x10da6e);}};}function respondWithFilteredResult(_0x2e8645,_0x36e871){return function(_0x21aca6){if(_0x21aca6){var _0x3a11e3=typeof _0x36e871[_0xeb9b('0x20')]===_0xeb9b('0x21')&&typeof _0x36e871[_0xeb9b('0x22')]===_0xeb9b('0x21');var _0x2c199f=_0x21aca6[_0xeb9b('0x23')];var _0x4f436e=_0x3a11e3?0x0:_0x36e871[_0xeb9b('0x20')];var _0x5a7ffd=_0x3a11e3?_0x21aca6['count']:_0x36e871[_0xeb9b('0x20')]+_0x36e871[_0xeb9b('0x22')];var _0x4ab4b8;if(_0x5a7ffd>=_0x2c199f){_0x5a7ffd=_0x2c199f;_0x4ab4b8=0xc8;}else{_0x4ab4b8=0xce;}_0x2e8645[_0xeb9b('0x1e')](_0x4ab4b8);return _0x2e8645[_0xeb9b('0x24')](_0xeb9b('0x25'),_0x4f436e+'-'+_0x5a7ffd+'/'+_0x2c199f)[_0xeb9b('0x26')](_0x21aca6);}return null;};}function patchUpdates(_0x3c8be7){return function(_0x43dab8){try{jsonpatch[_0xeb9b('0x27')](_0x43dab8,_0x3c8be7,!![]);}catch(_0x15e5b8){return BPromise[_0xeb9b('0x28')](_0x15e5b8);}return _0x43dab8[_0xeb9b('0x29')]();};}function saveUpdates(_0x61c86d,_0x296f95){return function(_0x1a4faf){if(_0x1a4faf){return _0x1a4faf[_0xeb9b('0x2a')](_0x61c86d)[_0xeb9b('0x2b')](function(_0x434461){return _0x434461;});}return null;};}function removeEntity(_0x4c997e,_0xd57390){return function(_0x4ed960){if(_0x4ed960){return _0x4ed960[_0xeb9b('0x2c')]()['then'](function(){var _0x347ec1=_0x4ed960[_0xeb9b('0x2d')]({'plain':!![]});var _0x7e0134=_0xeb9b('0x2e');return db['UserProfileResource'][_0xeb9b('0x2c')]({'where':{'type':_0x7e0134,'resourceId':_0x347ec1['id']}})[_0xeb9b('0x2b')](function(){return _0x4ed960;});})['then'](function(){_0x4c997e[_0xeb9b('0x1e')](0xcc)[_0xeb9b('0x1f')]();});}};}function handleEntityNotFound(_0x5ce745,_0x2a4b51){return function(_0x2ea20f){if(!_0x2ea20f){_0x5ce745[_0xeb9b('0x1d')](0x194);}return _0x2ea20f;};}function handleError(_0x48c5f4,_0x309bad){_0x309bad=_0x309bad||0x1f4;return function(_0x5336f2){logger[_0xeb9b('0x2f')](_0x5336f2['stack']);if(_0x5336f2[_0xeb9b('0x30')]){delete _0x5336f2['name'];}_0x48c5f4[_0xeb9b('0x1e')](_0x309bad)['send'](_0x5336f2);};}exports[_0xeb9b('0x31')]=function(_0x4c8e4c,_0x25b8da){var _0x370dbe={},_0x20e577={},_0x2e6034={'count':0x0,'rows':[]};var _0x112129=_[_0xeb9b('0x32')](db[_0xeb9b('0x33')][_0xeb9b('0x34')],function(_0x41e6c4){return{'name':_0x41e6c4[_0xeb9b('0x35')],'type':_0x41e6c4['type'][_0xeb9b('0x36')]};});_0x20e577[_0xeb9b('0x37')]=_[_0xeb9b('0x32')](_0x112129,_0xeb9b('0x30'));_0x20e577[_0xeb9b('0x38')]=_[_0xeb9b('0x39')](_0x4c8e4c[_0xeb9b('0x38')]);_0x20e577['filters']=_[_0xeb9b('0x3a')](_0x20e577[_0xeb9b('0x37')],_0x20e577[_0xeb9b('0x38')]);_0x370dbe['attributes']=_[_0xeb9b('0x3a')](_0x20e577[_0xeb9b('0x37')],qs[_0xeb9b('0x3b')](_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x3b')]));_0x370dbe[_0xeb9b('0x3c')]=_0x370dbe['attributes'][_0xeb9b('0x3d')]?_0x370dbe[_0xeb9b('0x3c')]:_0x20e577['model'];if(!_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x3e')](_0xeb9b('0x3f'))){_0x370dbe[_0xeb9b('0x22')]=qs[_0xeb9b('0x22')](_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x22')]);_0x370dbe['offset']=qs[_0xeb9b('0x20')](_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x20')]);}_0x370dbe['order']=qs['sort'](_0x4c8e4c['query'][_0xeb9b('0x40')]);_0x370dbe[_0xeb9b('0x41')]=qs[_0xeb9b('0x42')](_['pick'](_0x4c8e4c[_0xeb9b('0x38')],_0x20e577[_0xeb9b('0x42')]),_0x112129);if(_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x43')]){_0x370dbe[_0xeb9b('0x41')]=_[_0xeb9b('0x44')](_0x370dbe[_0xeb9b('0x41')],{'$or':_['map'](_0x112129,function(_0x5e597a){if(_0x5e597a[_0xeb9b('0x45')]!==_0xeb9b('0x46')){var _0x4ee3cd={};_0x4ee3cd[_0x5e597a['name']]={'$like':'%'+_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x43')]+'%'};return _0x4ee3cd;}})});}_0x370dbe=_['merge']({},_0x370dbe,_0x4c8e4c[_0xeb9b('0x47')]);var _0x535e73={'where':_0x370dbe[_0xeb9b('0x41')]};return db[_0xeb9b('0x33')][_0xeb9b('0x23')](_0x535e73)[_0xeb9b('0x2b')](function(_0xbee63e){_0x2e6034[_0xeb9b('0x23')]=_0xbee63e;if(_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x48')]){_0x370dbe[_0xeb9b('0x49')]=[{'all':!![]}];}return db[_0xeb9b('0x33')][_0xeb9b('0x4a')](_0x370dbe);})[_0xeb9b('0x2b')](function(_0x5e270a){_0x2e6034['rows']=_0x5e270a;return _0x2e6034;})[_0xeb9b('0x2b')](respondWithFilteredResult(_0x25b8da,_0x370dbe))['catch'](handleError(_0x25b8da,null));};exports[_0xeb9b('0x4b')]=function(_0x232731,_0x2c00ed){var _0x5eee9b={'raw':![],'where':{'id':_0x232731[_0xeb9b('0x4c')]['id']}},_0x1e2d25={};_0x1e2d25['model']=_[_0xeb9b('0x39')](db[_0xeb9b('0x33')][_0xeb9b('0x34')]);_0x1e2d25[_0xeb9b('0x38')]=_[_0xeb9b('0x39')](_0x232731[_0xeb9b('0x38')]);_0x1e2d25[_0xeb9b('0x42')]=_[_0xeb9b('0x3a')](_0x1e2d25['model'],_0x1e2d25['query']);_0x5eee9b[_0xeb9b('0x3c')]=_['intersection'](_0x1e2d25['model'],qs[_0xeb9b('0x3b')](_0x232731[_0xeb9b('0x38')][_0xeb9b('0x3b')]));_0x5eee9b[_0xeb9b('0x3c')]=_0x5eee9b[_0xeb9b('0x3c')][_0xeb9b('0x3d')]?_0x5eee9b['attributes']:_0x1e2d25['model'];if(_0x232731['query'][_0xeb9b('0x48')]){_0x5eee9b['include']=[{'all':!![]}];}_0x5eee9b=_[_0xeb9b('0x44')]({},_0x5eee9b,_0x232731[_0xeb9b('0x47')]);return db[_0xeb9b('0x33')][_0xeb9b('0x4d')](_0x5eee9b)[_0xeb9b('0x2b')](handleEntityNotFound(_0x2c00ed,null))[_0xeb9b('0x2b')](respondWithResult(_0x2c00ed,null))[_0xeb9b('0x4e')](handleError(_0x2c00ed,null));};exports[_0xeb9b('0x2c')]=function(_0x34755f,_0x28968b){return db['VoicePrefix']['find']({'where':{'id':_0x34755f[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x28968b,null))['then'](removeEntity(_0x28968b,null))[_0xeb9b('0x4e')](handleError(_0x28968b,null));};exports['describe']=function(_0x2ceb23,_0x1f7b31){return db['VoicePrefix']['describe']()['then'](respondWithResult(_0x1f7b31,null))[_0xeb9b('0x4e')](handleError(_0x1f7b31,null));};exports[_0xeb9b('0x4f')]=function(_0x263453,_0x4fe9d0){var _0x4ded40;return db[_0xeb9b('0x50')][_0xeb9b('0x51')](function(_0x3e6e73){return db[_0xeb9b('0x33')][_0xeb9b('0x4f')](_0x263453[_0xeb9b('0x52')],{'transaction':_0x3e6e73})['then'](function(_0x20dbea){_0x4ded40=_0x20dbea[_0xeb9b('0x2d')]({'plain':!![]});return db['VoiceExtension'][_0xeb9b('0x4d')]({'where':{'id':_0x4ded40['VoiceExtensionId']},'raw':!![]})[_0xeb9b('0x2b')](function(_0x12f8d6){return createVoicePrefixExtensions(_0x4ded40,_0x12f8d6,_0x3e6e73);});});})['then'](function(){var _0x396aa9=_0x263453['user'][_0xeb9b('0x2d')]({'plain':!![]});if(!_0x396aa9)throw new Error(_0xeb9b('0x53'));if(_0x396aa9[_0xeb9b('0x54')]===_0xeb9b('0x55')){var _0x5c769e=_0x4ded40;return db['UserProfileSection'][_0xeb9b('0x4d')]({'where':{'name':_0xeb9b('0x2e'),'userProfileId':_0x396aa9[_0xeb9b('0x56')]},'raw':!![]})['then'](function(_0x3126d9){if(_0x3126d9&&_0x3126d9[_0xeb9b('0x57')]===0x0){return db[_0xeb9b('0x58')][_0xeb9b('0x4f')]({'name':_0x5c769e[_0xeb9b('0x30')],'resourceId':_0x5c769e['id'],'type':_0x3126d9[_0xeb9b('0x30')],'sectionId':_0x3126d9['id']},{})[_0xeb9b('0x2b')](function(){return _0x4ded40;});}else{return _0x4ded40;}})[_0xeb9b('0x4e')](function(_0x2f8b0f){logger[_0xeb9b('0x2f')](_0xeb9b('0x59'),_0x2f8b0f);throw _0x2f8b0f;});}return _0x4ded40;})['then'](respondWithResult(_0x4fe9d0,null))['catch'](handleError(_0x4fe9d0,null));};function Extension(_0x4b2506,_0x83d48a,_0x4cf8bf,_0x34ff5f){this[_0xeb9b('0x5a')]=_0xeb9b('0x5b');this['exten']=_0x4b2506;this[_0xeb9b('0x5c')]=_0x4cf8bf;this[_0xeb9b('0x45')]=_0xeb9b('0x5d');this[_0xeb9b('0x5e')]=_0xeb9b('0x5f');this[_0xeb9b('0x60')]=_0x83d48a;this[_0xeb9b('0x61')]=_0x34ff5f;}function createVoicePrefixExtensions(_0x295d81,_0x58a3e2,_0x5b55a6){return new BPromise(function(_0x27a445,_0x37f20c){var _0xa0146b=new Extension(formatPrefixName(_0x295d81['prefix']),0x1,_0xeb9b('0x62'),'Voice\x20Prefix');_0xa0146b[_0xeb9b('0x63')]=_0x295d81['id'];return db['VoiceExtension'][_0xeb9b('0x4f')](_0xa0146b,{'transaction':_0x5b55a6})[_0xeb9b('0x2b')](function(_0x3d223f){var _0x1b2a7a=_0x3d223f[_0xeb9b('0x2d')]({'plain':!![]});var _0x4be938=_[_0xeb9b('0x32')](addVoicePrefixExtensions(_0x295d81,_0x58a3e2),function(_0x1c7569){_0x1c7569['VoiceExtensionId']=_0x1b2a7a['id'];_0x1c7569['VoicePrefixId']=_0x295d81['id'];return _0x1c7569;});return db[_0xeb9b('0x64')][_0xeb9b('0x65')](_0x4be938,{'transaction':_0x5b55a6})['then'](function(_0xeb81b9){if(!_0xeb81b9){return _0x37f20c('Extensions\x20creation\x20failed');}else{return _0x27a445(_0xeb81b9);}})[_0xeb9b('0x4e')](function(_0x515a97){return _0x37f20c(_0x515a97);});});;});};function addVoicePrefixExtensions(_0x36376f,_0x382d3a){var _0x417221=[];var _0x1fea34=formatPrefixName(_0x36376f[_0xeb9b('0x66')]);_0x417221[_0xeb9b('0x67')](new Extension(_0x1fea34,0x2,'Set',_0xeb9b('0x68')+_0x36376f[_0xeb9b('0x30')]));if(_0x36376f['callerIdAll']){_0x417221[_0xeb9b('0x67')](new Extension(_0x1fea34,0x3,_0xeb9b('0x69'),_0xeb9b('0x6a')+_0x36376f[_0xeb9b('0x6b')]));}else{_0x417221['push'](new Extension(_0x1fea34,0x3,_0xeb9b('0x62'),_0xeb9b('0x6c')));}_0x417221['push'](new Extension(_0x1fea34,0x4,_0xeb9b('0x6d'),_0x382d3a[_0xeb9b('0x5a')]+','+_0xeb9b('0x6e')+(0x8+_0x36376f[_0xeb9b('0x30')][_0xeb9b('0x3d')])+'}'+','+0x1));return _0x417221;}function formatPrefixName(_0x48b0ec){var _0x3f9ce0='_';for(var _0x4a48f6=0x0;_0x4a48f6<_0x48b0ec[_0xeb9b('0x3d')];_0x4a48f6++){if(_0x48b0ec[_0xeb9b('0x6f')](_0x4a48f6)=='-'){_0x3f9ce0+=_0x48b0ec['charAt'](_0x4a48f6);}else{_0x3f9ce0+='['+_0x48b0ec[_0xeb9b('0x6f')](_0x4a48f6)+']';}}_0x3f9ce0+='.';return _0x3f9ce0;}exports[_0xeb9b('0x2a')]=function(_0x2fb07e,_0x25398e,_0x51de75){var _0xb0080f=_0x2fb07e[_0xeb9b('0x52')];_0xb0080f[_0xeb9b('0x66')]=_0xeb9b('0x70')+_0xb0080f[_0xeb9b('0x30')]+'-';return db[_0xeb9b('0x50')][_0xeb9b('0x51')](function(_0x3836bd){return db[_0xeb9b('0x33')][_0xeb9b('0x2a')](_0xb0080f,{'where':{'id':_0xb0080f['id']},'transaction':_0x3836bd})[_0xeb9b('0x2b')](function(){return db[_0xeb9b('0x64')][_0xeb9b('0x2c')]({'where':{'VoicePrefixId':_0xb0080f['id']},'transaction':_0x3836bd})[_0xeb9b('0x2b')](function(){return db[_0xeb9b('0x64')][_0xeb9b('0x4d')]({'where':{'id':_0xb0080f['VoiceExtensionId']},'raw':!![]})[_0xeb9b('0x2b')](function(_0x3e4ef2){return createVoicePrefixExtensions(_0xb0080f,_0x3e4ef2,_0x3836bd);});});});})[_0xeb9b('0x2b')](function(){return db['VoicePrefix']['findById'](_0xb0080f['id']);})[_0xeb9b('0x2b')](respondWithResult(_0x25398e,null))['catch'](handleError(_0x25398e,null));};exports[_0xeb9b('0x71')]=function(_0x463767,_0x279f71,_0x12a271){return db[_0xeb9b('0x33')][_0xeb9b('0x4d')]({'where':{'id':_0x463767[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x279f71,null))[_0xeb9b('0x2b')](function(_0x46ce60){if(_0x46ce60){return _0x46ce60[_0xeb9b('0x71')](_0x463767[_0xeb9b('0x52')]['ids'],_['omit'](_0x463767[_0xeb9b('0x52')],['ids','id'])||{})['spread'](function(_0x95e1d0){for(var _0x4bdaf5=0x0;_0x4bdaf5<_0x463767['body']['ids'][_0xeb9b('0x3d')];_0x4bdaf5+=0x1){socket[_0xeb9b('0x72')](_0xeb9b('0x73'),{'UserId':Number(_0x463767[_0xeb9b('0x52')]['ids'][_0x4bdaf5]),'VoicePrefixId':Number(_0x463767[_0xeb9b('0x4c')]['id'])});}return _0x95e1d0;});}})[_0xeb9b('0x2b')](respondWithResult(_0x279f71,null))[_0xeb9b('0x4e')](handleError(_0x279f71,null));};exports['removeAgents']=function(_0x5c010d,_0x3ea644,_0x4ffa9e){return db[_0xeb9b('0x33')]['find']({'where':{'id':_0x5c010d['params']['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x3ea644,null))['then'](function(_0x3aca78){if(_0x3aca78){return _0x3aca78['removeAgents'](_0x5c010d['query'][_0xeb9b('0x74')])[_0xeb9b('0x2b')](function(){if(_[_0xeb9b('0x75')](_0x5c010d[_0xeb9b('0x38')]['ids'])){for(var _0x193ffc=0x0;_0x193ffc<_0x5c010d[_0xeb9b('0x38')][_0xeb9b('0x74')][_0xeb9b('0x3d')];_0x193ffc+=0x1){socket[_0xeb9b('0x72')](_0xeb9b('0x76'),{'UserId':Number(_0x5c010d['query'][_0xeb9b('0x74')][_0x193ffc]),'VoicePrefixId':Number(_0x5c010d['params']['id'])});}}else{socket[_0xeb9b('0x72')](_0xeb9b('0x76'),{'UserId':Number(_0x5c010d['query'][_0xeb9b('0x74')]),'VoicePrefixId':Number(_0x5c010d['params']['id'])});}});}})[_0xeb9b('0x2b')](respondWithStatusCode(_0x3ea644,null))['catch'](handleError(_0x3ea644,null));};exports[_0xeb9b('0x77')]=function(_0x36af5a,_0x41af31,_0x14db1d){var _0x31b0c5={};var _0x24bac5={};var _0x462fa2;var _0x5bf4a4;return db[_0xeb9b('0x33')][_0xeb9b('0x78')]({'where':{'id':_0x36af5a['params']['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x41af31,null))[_0xeb9b('0x2b')](function(_0x16f500){if(_0x16f500){_0x462fa2=_0x16f500;_0x24bac5['model']=_['keys'](db['User'][_0xeb9b('0x34')]);_0x24bac5[_0xeb9b('0x38')]=_['keys'](_0x36af5a[_0xeb9b('0x38')]);_0x24bac5[_0xeb9b('0x42')]=_[_0xeb9b('0x3a')](_0x24bac5[_0xeb9b('0x37')],_0x24bac5[_0xeb9b('0x38')]);_0x31b0c5[_0xeb9b('0x3c')]=_['intersection'](_0x24bac5[_0xeb9b('0x37')],qs[_0xeb9b('0x3b')](_0x36af5a[_0xeb9b('0x38')][_0xeb9b('0x3b')]));_0x31b0c5[_0xeb9b('0x3c')]=_0x31b0c5[_0xeb9b('0x3c')][_0xeb9b('0x3d')]?_0x31b0c5[_0xeb9b('0x3c')]:_0x24bac5[_0xeb9b('0x37')];_0x31b0c5[_0xeb9b('0x79')]=qs[_0xeb9b('0x40')](_0x36af5a['query'][_0xeb9b('0x40')]);_0x31b0c5[_0xeb9b('0x41')]=qs['filters'](_['pick'](_0x36af5a[_0xeb9b('0x38')],_0x24bac5[_0xeb9b('0x42')]));if(_0x36af5a['query'][_0xeb9b('0x43')]){_0x31b0c5[_0xeb9b('0x41')]=_[_0xeb9b('0x44')](_0x31b0c5[_0xeb9b('0x41')],{'$or':_[_0xeb9b('0x32')](_0x31b0c5[_0xeb9b('0x3c')],function(_0x3cb938){var _0x44562a={};_0x44562a[_0x3cb938]={'$like':'%'+_0x36af5a[_0xeb9b('0x38')]['filter']+'%'};return _0x44562a;})});}_0x31b0c5=_[_0xeb9b('0x44')]({},_0x31b0c5,_0x36af5a[_0xeb9b('0x47')]);return _0x462fa2[_0xeb9b('0x77')](_0x31b0c5);}})[_0xeb9b('0x2b')](function(_0x4d894e){if(_0x4d894e){_0x5bf4a4=_0x4d894e[_0xeb9b('0x3d')];if(!_0x36af5a['query']['hasOwnProperty'](_0xeb9b('0x3f'))){_0x31b0c5[_0xeb9b('0x22')]=qs[_0xeb9b('0x22')](_0x36af5a[_0xeb9b('0x38')][_0xeb9b('0x22')]);_0x31b0c5['offset']=qs[_0xeb9b('0x20')](_0x36af5a['query'][_0xeb9b('0x20')]);}return _0x462fa2[_0xeb9b('0x77')](_0x31b0c5);}})[_0xeb9b('0x2b')](function(_0x51628d){if(_0x51628d){return _0x51628d?{'count':_0x5bf4a4,'rows':_0x51628d}:null;}})[_0xeb9b('0x2b')](respondWithResult(_0x41af31,null))['catch'](handleError(_0x41af31,null));};exports['getTeams']=function(_0x3f9806,_0x3332ba,_0x25e684){var _0x841fc6={};var _0x175afe={};var _0x57a99e;var _0x2ee62d;return db[_0xeb9b('0x33')]['findOne']({'where':{'id':_0x3f9806[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x3332ba,null))[_0xeb9b('0x2b')](function(_0x4c303d){if(_0x4c303d){_0x57a99e=_0x4c303d;_0x175afe[_0xeb9b('0x37')]=_[_0xeb9b('0x39')](db[_0xeb9b('0x7a')][_0xeb9b('0x34')]);_0x175afe[_0xeb9b('0x38')]=_[_0xeb9b('0x39')](_0x3f9806['query']);_0x175afe[_0xeb9b('0x42')]=_[_0xeb9b('0x3a')](_0x175afe[_0xeb9b('0x37')],_0x175afe[_0xeb9b('0x38')]);_0x841fc6[_0xeb9b('0x3c')]=_[_0xeb9b('0x3a')](_0x175afe[_0xeb9b('0x37')],qs[_0xeb9b('0x3b')](_0x3f9806[_0xeb9b('0x38')][_0xeb9b('0x3b')]));_0x841fc6[_0xeb9b('0x3c')]=_0x841fc6['attributes'][_0xeb9b('0x3d')]?_0x841fc6[_0xeb9b('0x3c')]:_0x175afe[_0xeb9b('0x37')];_0x841fc6[_0xeb9b('0x79')]=qs['sort'](_0x3f9806['query'][_0xeb9b('0x40')]);_0x841fc6[_0xeb9b('0x41')]=qs[_0xeb9b('0x42')](_[_0xeb9b('0x7b')](_0x3f9806[_0xeb9b('0x38')],_0x175afe[_0xeb9b('0x42')]));if(_0x3f9806[_0xeb9b('0x38')][_0xeb9b('0x43')]){_0x841fc6[_0xeb9b('0x41')]=_[_0xeb9b('0x44')](_0x841fc6[_0xeb9b('0x41')],{'$or':_[_0xeb9b('0x32')](_0x841fc6[_0xeb9b('0x3c')],function(_0x5b456a){var _0x13db61={};_0x13db61[_0x5b456a]={'$like':'%'+_0x3f9806[_0xeb9b('0x38')]['filter']+'%'};return _0x13db61;})});}_0x841fc6=_[_0xeb9b('0x44')]({},_0x841fc6,_0x3f9806[_0xeb9b('0x47')]);return _0x57a99e[_0xeb9b('0x7c')](_0x841fc6);}})['then'](function(_0x5c0da1){if(_0x5c0da1){_0x2ee62d=_0x5c0da1[_0xeb9b('0x3d')];if(!_0x3f9806['query'][_0xeb9b('0x3e')](_0xeb9b('0x3f'))){_0x841fc6[_0xeb9b('0x22')]=qs[_0xeb9b('0x22')](_0x3f9806[_0xeb9b('0x38')][_0xeb9b('0x22')]);_0x841fc6[_0xeb9b('0x20')]=qs[_0xeb9b('0x20')](_0x3f9806['query'][_0xeb9b('0x20')]);}return _0x57a99e[_0xeb9b('0x7c')](_0x841fc6);}})[_0xeb9b('0x2b')](function(_0x5e7146){if(_0x5e7146){return _0x5e7146?{'count':_0x2ee62d,'rows':_0x5e7146}:null;}})[_0xeb9b('0x2b')](respondWithResult(_0x3332ba,null))['catch'](handleError(_0x3332ba,null));};exports[_0xeb9b('0x7d')]=function(_0x26d380,_0x3d3b2c,_0x50dae3){var _0x461392=_0x26d380[_0xeb9b('0x52')]['ids'];var _0x33adad;return db[_0xeb9b('0x7a')]['findAll']({'where':{'id':_0x461392},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb9b('0x7e'),'attributes':['id',_0xeb9b('0x30'),_0xeb9b('0x7f'),_0xeb9b('0x80'),_0xeb9b('0x81')],'raw':!![]}]})[_0xeb9b('0x2b')](function(_0x1a49a7){if(_0x1a49a7){_0x33adad=_0x1a49a7;var _0x40c30f=_[_0xeb9b('0x82')](_0x1a49a7,function(_0xcda621){var _0xb409e0=_0xcda621[_0xeb9b('0x2d')]({'plain':!![]});return _0xb409e0[_0xeb9b('0x7e')];});return db['VoicePrefix'][_0xeb9b('0x4d')]({'where':{'id':_0x26d380[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](function(_0x52bd7a){return db[_0xeb9b('0x50')][_0xeb9b('0x51')](function(_0x33e5c3){return _0x52bd7a[_0xeb9b('0x7d')](_0x461392,{'transaction':_0x33e5c3})[_0xeb9b('0x2b')](function(){return BPromise[_0xeb9b('0x83')](_0x33adad,function(_0x45b94f){return db[_0xeb9b('0x84')]['upsert']({'TeamId':_0x45b94f['id'],'VoicePrefixId':_0x26d380[_0xeb9b('0x4c')]['id']},{'transaction':_0x33e5c3});});})[_0xeb9b('0x2b')](function(){return BPromise[_0xeb9b('0x83')](_0x40c30f,function(_0x193304){return db[_0xeb9b('0x85')][_0xeb9b('0x86')]({'where':{'UserId':_0x193304['id'],'VoicePrefixId':_0x26d380['params']['id']},'transaction':_0x33e5c3});});})[_0xeb9b('0x2b')](function(){_0x40c30f[_0xeb9b('0x87')](function(_0xe7dcc5){socket['emit']('userVoicePrefix:save',{'UserId':_0xe7dcc5['id'],'VoicePrefixId':_0x52bd7a['id']});});});});});}})[_0xeb9b('0x2b')](respondWithStatusCode(_0x3d3b2c,null))[_0xeb9b('0x4e')](handleError(_0x3d3b2c,null));};exports[_0xeb9b('0x88')]=function(_0x122550,_0x3e804b,_0x41659f){return db[_0xeb9b('0x7a')][_0xeb9b('0x4a')]({'where':{'id':_0x122550[_0xeb9b('0x38')][_0xeb9b('0x74')]},'attributes':['id'],'include':[{'model':db[_0xeb9b('0x89')],'as':_0xeb9b('0x7e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3e804b,null))[_0xeb9b('0x2b')](function(_0x4b273d){var _0x16c4a5=_['map'](_0x4b273d,'id');var _0x4d39a7=[];var _0x384fba=[];var _0x23893b=squel[_0xeb9b('0x8a')]();_0x23893b[_0xeb9b('0x8b')](_0xeb9b('0x8c'))['from'](_0xeb9b('0x8d'),'tq')['join'](_0xeb9b('0x8e'),'ut',_0xeb9b('0x8f'))[_0xeb9b('0x41')](_0xeb9b('0x90'),_0x122550['params']['id']);for(var _0x1a9933=0x0;_0x1a9933<_0x4b273d[_0xeb9b('0x3d')];_0x1a9933+=0x1){let _0x2bc3b5=_0x4b273d[_0x1a9933];for(var _0x3b28ef=0x0;_0x3b28ef<_0x2bc3b5[_0xeb9b('0x7e')][_0xeb9b('0x3d')];_0x3b28ef+=0x1){let _0x427672=_0x2bc3b5['Agents'][_0x3b28ef];var _0x276e1f=_0x23893b[_0xeb9b('0x91')]();_0x276e1f[_0xeb9b('0x41')](_0xeb9b('0x92'),_0x427672['id']);_0x384fba['push'](db[_0xeb9b('0x50')][_0xeb9b('0x38')](_0x276e1f[_0xeb9b('0x93')](),{'type':db[_0xeb9b('0x50')]['QueryTypes'][_0xeb9b('0x94')]})[_0xeb9b('0x2b')](function(_0x519eff){if(_0x519eff['length']===0x1){return _0x427672['id'];}else{var _0x564125=_[_0xeb9b('0x95')](_['map'](_0x519eff,_0xeb9b('0x96')),function(_0x44ba4b){return _['includes'](_0x16c4a5,_0x44ba4b);});if(_0x564125){return _0x427672['id'];}}}));}}return BPromise['all'](_0x384fba)[_0xeb9b('0x2b')](function(_0x245892){_0x4d39a7=_(_0x4d39a7)[_0xeb9b('0x97')](_0x245892)[_0xeb9b('0x98')]()[_0xeb9b('0x99')]();return db[_0xeb9b('0x33')][_0xeb9b('0x4d')]({'where':{'id':_0x122550[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](function(_0x4d5919){return db[_0xeb9b('0x50')][_0xeb9b('0x51')](function(_0x5d3fdf){return _0x4d5919[_0xeb9b('0x88')](_0x122550['query'][_0xeb9b('0x74')],{'transaction':_0x5d3fdf})[_0xeb9b('0x2b')](function(){if(!_[_0xeb9b('0x9a')](_0x4d39a7)){return _0x4d5919['removeAgents'](_0x4d39a7,{'transaction':_0x5d3fdf});}})['then'](function(){_0x4d39a7['forEach'](function(_0x8680da){socket[_0xeb9b('0x72')]('userVoicePrefix:remove',{'UserId':_0x8680da,'VoicePrefixId':_0x4d5919['id']});});});});});});})[_0xeb9b('0x2b')](respondWithStatusCode(_0x3e804b,null))[_0xeb9b('0x4e')](handleError(_0x3e804b,null));}; \ No newline at end of file +var _0x8f4c=['save','update','destroy','then','VoicePrefixes','error','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','get','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','appdata','NoOp','Voice\x20Prefix','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','prefix','system-','VoiceExtensionId','addAgents','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','findAll','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject'];(function(_0x1a57b8,_0x3e384b){var _0x137ec3=function(_0x48d4dc){while(--_0x48d4dc){_0x1a57b8['push'](_0x1a57b8['shift']());}};_0x137ec3(++_0x3e384b);}(_0x8f4c,0x113));var _0xc8f4=function(_0x396181,_0x2e3f1f){_0x396181=_0x396181-0x0;var _0x1048c1=_0x8f4c[_0x396181];return _0x1048c1;};'use strict';var emlformat=require(_0xc8f4('0x0'));var rimraf=require(_0xc8f4('0x1'));var zipdir=require(_0xc8f4('0x2'));var jsonpatch=require(_0xc8f4('0x3'));var rp=require(_0xc8f4('0x4'));var moment=require(_0xc8f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc8f4('0x6'));var util=require(_0xc8f4('0x7'));var path=require(_0xc8f4('0x8'));var sox=require('sox');var csv=require(_0xc8f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xc8f4('0xb'));var deskjs=require(_0xc8f4('0xc'));var toCsv=require(_0xc8f4('0x9'));var querystring=require(_0xc8f4('0xd'));var Papa=require(_0xc8f4('0xe'));var Redis=require('ioredis');var authService=require(_0xc8f4('0xf'));var qs=require(_0xc8f4('0x10'));var as=require(_0xc8f4('0x11'));var hardwareService=require(_0xc8f4('0x12'));var logger=require('../../config/logger')(_0xc8f4('0x13'));var utils=require('../../config/utils');var config=require(_0xc8f4('0x14'));var licenseUtil=require(_0xc8f4('0x15'));var db=require(_0xc8f4('0x16'))['db'];config[_0xc8f4('0x17')]=_[_0xc8f4('0x18')](config['redis'],{'host':_0xc8f4('0x19'),'port':0x18eb});var socket=require(_0xc8f4('0x1a'))(new Redis(config[_0xc8f4('0x17')]));require(_0xc8f4('0x1b'))[_0xc8f4('0x1c')](socket);function respondWithStatusCode(_0x411c5c,_0x4e3c36){_0x4e3c36=_0x4e3c36||0xcc;return function(_0x2bce00){if(_0x2bce00){return _0x411c5c[_0xc8f4('0x1d')](_0x4e3c36);}return _0x411c5c[_0xc8f4('0x1e')](_0x4e3c36)[_0xc8f4('0x1f')]();};}function respondWithResult(_0x22c08a,_0x56a25d){_0x56a25d=_0x56a25d||0xc8;return function(_0xac45d5){if(_0xac45d5){return _0x22c08a['status'](_0x56a25d)['json'](_0xac45d5);}};}function respondWithFilteredResult(_0x14bc02,_0x225b76){return function(_0x108076){if(_0x108076){var _0x7bb973=typeof _0x225b76[_0xc8f4('0x20')]===_0xc8f4('0x21')&&typeof _0x225b76[_0xc8f4('0x22')]===_0xc8f4('0x21');var _0x1982bb=_0x108076[_0xc8f4('0x23')];var _0x3cd90c=_0x7bb973?0x0:_0x225b76[_0xc8f4('0x20')];var _0x22236c=_0x7bb973?_0x108076['count']:_0x225b76[_0xc8f4('0x20')]+_0x225b76[_0xc8f4('0x22')];var _0x29e52d;if(_0x22236c>=_0x1982bb){_0x22236c=_0x1982bb;_0x29e52d=0xc8;}else{_0x29e52d=0xce;}_0x14bc02[_0xc8f4('0x1e')](_0x29e52d);return _0x14bc02[_0xc8f4('0x24')](_0xc8f4('0x25'),_0x3cd90c+'-'+_0x22236c+'/'+_0x1982bb)[_0xc8f4('0x26')](_0x108076);}return null;};}function patchUpdates(_0x43eb57){return function(_0x5e62aa){try{jsonpatch[_0xc8f4('0x27')](_0x5e62aa,_0x43eb57,!![]);}catch(_0x205c41){return BPromise[_0xc8f4('0x28')](_0x205c41);}return _0x5e62aa[_0xc8f4('0x29')]();};}function saveUpdates(_0x5d54a9,_0x39174f){return function(_0x4a44e0){if(_0x4a44e0){return _0x4a44e0[_0xc8f4('0x2a')](_0x5d54a9)['then'](function(_0x177a44){return _0x177a44;});}return null;};}function removeEntity(_0x3dd717,_0x5c94c6){return function(_0x41f4de){if(_0x41f4de){return _0x41f4de[_0xc8f4('0x2b')]()[_0xc8f4('0x2c')](function(){var _0x2fa052=_0x41f4de['get']({'plain':!![]});var _0x3db490=_0xc8f4('0x2d');return db['UserProfileResource'][_0xc8f4('0x2b')]({'where':{'type':_0x3db490,'resourceId':_0x2fa052['id']}})[_0xc8f4('0x2c')](function(){return _0x41f4de;});})[_0xc8f4('0x2c')](function(){_0x3dd717[_0xc8f4('0x1e')](0xcc)[_0xc8f4('0x1f')]();});}};}function handleEntityNotFound(_0x385e41,_0x4a25da){return function(_0x45f972){if(!_0x45f972){_0x385e41[_0xc8f4('0x1d')](0x194);}return _0x45f972;};}function handleError(_0x1ea3d9,_0x4dcd8f){_0x4dcd8f=_0x4dcd8f||0x1f4;return function(_0xf4a556){logger[_0xc8f4('0x2e')](_0xf4a556['stack']);if(_0xf4a556['name']){delete _0xf4a556['name'];}_0x1ea3d9[_0xc8f4('0x1e')](_0x4dcd8f)[_0xc8f4('0x2f')](_0xf4a556);};}exports[_0xc8f4('0x30')]=function(_0x28baa0,_0x273e73){var _0x2f9a80={},_0x3181af={},_0xffc7aa={'count':0x0,'rows':[]};var _0x4b4203=_[_0xc8f4('0x31')](db[_0xc8f4('0x32')][_0xc8f4('0x33')],function(_0x5cb6ce){return{'name':_0x5cb6ce[_0xc8f4('0x34')],'type':_0x5cb6ce[_0xc8f4('0x35')]['key']};});_0x3181af[_0xc8f4('0x36')]=_[_0xc8f4('0x31')](_0x4b4203,_0xc8f4('0x37'));_0x3181af['query']=_[_0xc8f4('0x38')](_0x28baa0[_0xc8f4('0x39')]);_0x3181af[_0xc8f4('0x3a')]=_['intersection'](_0x3181af[_0xc8f4('0x36')],_0x3181af[_0xc8f4('0x39')]);_0x2f9a80[_0xc8f4('0x3b')]=_[_0xc8f4('0x3c')](_0x3181af[_0xc8f4('0x36')],qs[_0xc8f4('0x3d')](_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x3d')]));_0x2f9a80[_0xc8f4('0x3b')]=_0x2f9a80[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x2f9a80[_0xc8f4('0x3b')]:_0x3181af[_0xc8f4('0x36')];if(!_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x3f')](_0xc8f4('0x40'))){_0x2f9a80['limit']=qs[_0xc8f4('0x22')](_0x28baa0['query'][_0xc8f4('0x22')]);_0x2f9a80['offset']=qs[_0xc8f4('0x20')](_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x20')]);}_0x2f9a80[_0xc8f4('0x41')]=qs[_0xc8f4('0x42')](_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x42')]);_0x2f9a80['where']=qs[_0xc8f4('0x3a')](_[_0xc8f4('0x43')](_0x28baa0[_0xc8f4('0x39')],_0x3181af[_0xc8f4('0x3a')]),_0x4b4203);if(_0x28baa0['query'][_0xc8f4('0x44')]){_0x2f9a80[_0xc8f4('0x45')]=_[_0xc8f4('0x46')](_0x2f9a80[_0xc8f4('0x45')],{'$or':_[_0xc8f4('0x31')](_0x4b4203,function(_0x1d7831){if(_0x1d7831[_0xc8f4('0x35')]!==_0xc8f4('0x47')){var _0x1eebbd={};_0x1eebbd[_0x1d7831[_0xc8f4('0x37')]]={'$like':'%'+_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x44')]+'%'};return _0x1eebbd;}})});}_0x2f9a80=_['merge']({},_0x2f9a80,_0x28baa0[_0xc8f4('0x48')]);var _0x32e067={'where':_0x2f9a80[_0xc8f4('0x45')]};return db[_0xc8f4('0x32')]['count'](_0x32e067)['then'](function(_0x413a55){_0xffc7aa[_0xc8f4('0x23')]=_0x413a55;if(_0x28baa0['query'][_0xc8f4('0x49')]){_0x2f9a80[_0xc8f4('0x4a')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x2f9a80);})[_0xc8f4('0x2c')](function(_0x342c28){_0xffc7aa[_0xc8f4('0x4b')]=_0x342c28;return _0xffc7aa;})[_0xc8f4('0x2c')](respondWithFilteredResult(_0x273e73,_0x2f9a80))[_0xc8f4('0x4c')](handleError(_0x273e73,null));};exports[_0xc8f4('0x4d')]=function(_0x4de3d1,_0x522f52){var _0x705792={'raw':![],'where':{'id':_0x4de3d1[_0xc8f4('0x4e')]['id']}},_0x8c82a5={};_0x8c82a5['model']=_['keys'](db['VoicePrefix']['rawAttributes']);_0x8c82a5['query']=_[_0xc8f4('0x38')](_0x4de3d1[_0xc8f4('0x39')]);_0x8c82a5[_0xc8f4('0x3a')]=_[_0xc8f4('0x3c')](_0x8c82a5[_0xc8f4('0x36')],_0x8c82a5[_0xc8f4('0x39')]);_0x705792['attributes']=_[_0xc8f4('0x3c')](_0x8c82a5[_0xc8f4('0x36')],qs['fields'](_0x4de3d1['query'][_0xc8f4('0x3d')]));_0x705792[_0xc8f4('0x3b')]=_0x705792[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x705792['attributes']:_0x8c82a5['model'];if(_0x4de3d1[_0xc8f4('0x39')][_0xc8f4('0x49')]){_0x705792[_0xc8f4('0x4a')]=[{'all':!![]}];}_0x705792=_[_0xc8f4('0x46')]({},_0x705792,_0x4de3d1[_0xc8f4('0x48')]);return db[_0xc8f4('0x32')]['find'](_0x705792)['then'](handleEntityNotFound(_0x522f52,null))[_0xc8f4('0x2c')](respondWithResult(_0x522f52,null))[_0xc8f4('0x4c')](handleError(_0x522f52,null));};exports[_0xc8f4('0x2b')]=function(_0x1b3744,_0x39b4a4){return db[_0xc8f4('0x32')][_0xc8f4('0x4f')]({'where':{'id':_0x1b3744[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0x39b4a4,null))['then'](removeEntity(_0x39b4a4,null))['catch'](handleError(_0x39b4a4,null));};exports[_0xc8f4('0x50')]=function(_0xc11ff5,_0x1e5932){return db[_0xc8f4('0x32')][_0xc8f4('0x50')]()[_0xc8f4('0x2c')](respondWithResult(_0x1e5932,null))[_0xc8f4('0x4c')](handleError(_0x1e5932,null));};exports[_0xc8f4('0x51')]=function(_0x197f3c,_0x189fae){var _0x15064a;return db[_0xc8f4('0x52')][_0xc8f4('0x53')](function(_0x4ec67d){return db[_0xc8f4('0x32')][_0xc8f4('0x51')](_0x197f3c[_0xc8f4('0x54')],{'transaction':_0x4ec67d})[_0xc8f4('0x2c')](function(_0x481dd2){_0x15064a=_0x481dd2[_0xc8f4('0x55')]({'plain':!![]});return db[_0xc8f4('0x56')]['find']({'where':{'id':_0x15064a['VoiceExtensionId']},'raw':!![]})[_0xc8f4('0x2c')](function(_0x5cc52d){return createVoicePrefixExtensions(_0x15064a,_0x5cc52d,_0x4ec67d);});});})[_0xc8f4('0x2c')](function(){var _0x29f8f4=_0x197f3c[_0xc8f4('0x57')][_0xc8f4('0x55')]({'plain':!![]});if(!_0x29f8f4)throw new Error(_0xc8f4('0x58'));if(_0x29f8f4[_0xc8f4('0x59')]===_0xc8f4('0x57')){var _0x1f7602=_0x15064a;return db[_0xc8f4('0x5a')][_0xc8f4('0x4f')]({'where':{'name':_0xc8f4('0x2d'),'userProfileId':_0x29f8f4['userProfileId']},'raw':!![]})[_0xc8f4('0x2c')](function(_0x1f983e){if(_0x1f983e&&_0x1f983e[_0xc8f4('0x5b')]===0x0){return db[_0xc8f4('0x5c')]['create']({'name':_0x1f7602[_0xc8f4('0x37')],'resourceId':_0x1f7602['id'],'type':_0x1f983e['name'],'sectionId':_0x1f983e['id']},{})['then'](function(){return _0x15064a;});}else{return _0x15064a;}})[_0xc8f4('0x4c')](function(_0x451a3e){logger[_0xc8f4('0x2e')](_0xc8f4('0x5d'),_0x451a3e);throw _0x451a3e;});}return _0x15064a;})[_0xc8f4('0x2c')](respondWithResult(_0x189fae,null))[_0xc8f4('0x4c')](handleError(_0x189fae,null));};function Extension(_0x5aba71,_0x562e89,_0x45fb1a,_0x2b558e){this[_0xc8f4('0x5e')]=_0xc8f4('0x5f');this[_0xc8f4('0x60')]=_0x5aba71;this[_0xc8f4('0x61')]=_0x45fb1a;this[_0xc8f4('0x35')]='system';this[_0xc8f4('0x62')]=_0xc8f4('0x63');this['priority']=_0x562e89;this[_0xc8f4('0x64')]=_0x2b558e;}function createVoicePrefixExtensions(_0x2da305,_0x9dbf80,_0x5b8bf4){return new BPromise(function(_0x368798,_0x3aa12d){var _0x33801b=new Extension(formatPrefixName(_0x2da305['prefix']),0x1,_0xc8f4('0x65'),_0xc8f4('0x66'));_0x33801b['VoicePrefixId']=_0x2da305['id'];return db['VoiceExtension'][_0xc8f4('0x51')](_0x33801b,{'transaction':_0x5b8bf4})['then'](function(_0x281b3a){var _0x44f603=_0x281b3a['get']({'plain':!![]});var _0x5f2781=_['map'](addVoicePrefixExtensions(_0x2da305,_0x9dbf80),function(_0x490b8b){_0x490b8b['VoiceExtensionId']=_0x44f603['id'];_0x490b8b['VoicePrefixId']=_0x2da305['id'];return _0x490b8b;});return db[_0xc8f4('0x56')]['bulkCreate'](_0x5f2781,{'transaction':_0x5b8bf4})[_0xc8f4('0x2c')](function(_0x357e45){if(!_0x357e45){return _0x3aa12d(_0xc8f4('0x67'));}else{return _0x368798(_0x357e45);}})[_0xc8f4('0x4c')](function(_0x5ea840){return _0x3aa12d(_0x5ea840);});});;});};function addVoicePrefixExtensions(_0x3f2596,_0x329c26){var _0x3ca2ca=[];var _0xb50e61=formatPrefixName(_0x3f2596['prefix']);_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x2,_0xc8f4('0x69'),_0xc8f4('0x6a')+_0x3f2596[_0xc8f4('0x37')]));if(_0x3f2596['callerIdAll']){_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x3,_0xc8f4('0x69'),'PREFIX-CALLERIDALL='+_0x3f2596[_0xc8f4('0x6b')]));}else{_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x3,_0xc8f4('0x65'),_0xc8f4('0x6c')));}_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x4,_0xc8f4('0x6d'),_0x329c26['context']+','+_0xc8f4('0x6e')+(0x8+_0x3f2596[_0xc8f4('0x37')][_0xc8f4('0x3e')])+'}'+','+0x1));return _0x3ca2ca;}function formatPrefixName(_0x5e5117){var _0x28db1f='_';for(var _0x2b6510=0x0;_0x2b6510<_0x5e5117[_0xc8f4('0x3e')];_0x2b6510++){if(_0x5e5117['charAt'](_0x2b6510)=='-'){_0x28db1f+=_0x5e5117[_0xc8f4('0x6f')](_0x2b6510);}else{_0x28db1f+='['+_0x5e5117[_0xc8f4('0x6f')](_0x2b6510)+']';}}_0x28db1f+='.';return _0x28db1f;}exports[_0xc8f4('0x2a')]=function(_0x1278f1,_0x5bf089,_0x8c8e43){var _0x9996da=_0x1278f1['body'];_0x9996da[_0xc8f4('0x70')]=_0xc8f4('0x71')+_0x9996da['name']+'-';return db[_0xc8f4('0x52')][_0xc8f4('0x53')](function(_0x437718){return db[_0xc8f4('0x32')][_0xc8f4('0x2a')](_0x9996da,{'where':{'id':_0x9996da['id']},'transaction':_0x437718})[_0xc8f4('0x2c')](function(){return db[_0xc8f4('0x56')][_0xc8f4('0x2b')]({'where':{'VoicePrefixId':_0x9996da['id']},'transaction':_0x437718})['then'](function(){return db[_0xc8f4('0x56')][_0xc8f4('0x4f')]({'where':{'id':_0x9996da[_0xc8f4('0x72')]},'raw':!![]})[_0xc8f4('0x2c')](function(_0xdc64f3){return createVoicePrefixExtensions(_0x9996da,_0xdc64f3,_0x437718);});});});})['then'](function(){return db[_0xc8f4('0x32')]['findById'](_0x9996da['id']);})[_0xc8f4('0x2c')](respondWithResult(_0x5bf089,null))[_0xc8f4('0x4c')](handleError(_0x5bf089,null));};exports[_0xc8f4('0x73')]=function(_0x30e155,_0xc6df8e,_0x9a7714){return db[_0xc8f4('0x32')][_0xc8f4('0x4f')]({'where':{'id':_0x30e155[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0xc6df8e,null))[_0xc8f4('0x2c')](function(_0x4d7d74){if(_0x4d7d74){return _0x4d7d74[_0xc8f4('0x73')](_0x30e155[_0xc8f4('0x54')][_0xc8f4('0x74')],_[_0xc8f4('0x75')](_0x30e155['body'],['ids','id'])||{})[_0xc8f4('0x76')](function(_0x4cde06){for(var _0x205ed9=0x0;_0x205ed9<_0x30e155['body'][_0xc8f4('0x74')]['length'];_0x205ed9+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x30e155['body']['ids'][_0x205ed9]),'VoicePrefixId':Number(_0x30e155['params']['id'])});}return _0x4cde06;});}})[_0xc8f4('0x2c')](respondWithResult(_0xc6df8e,null))['catch'](handleError(_0xc6df8e,null));};exports[_0xc8f4('0x77')]=function(_0x3ad7dd,_0x3e22c2,_0x367d5e){return db[_0xc8f4('0x32')]['find']({'where':{'id':_0x3ad7dd[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0x3e22c2,null))[_0xc8f4('0x2c')](function(_0x5b354d){if(_0x5b354d){return _0x5b354d[_0xc8f4('0x77')](_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')])[_0xc8f4('0x2c')](function(){if(_[_0xc8f4('0x78')](_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')])){for(var _0x1401f1=0x0;_0x1401f1<_0x3ad7dd['query'][_0xc8f4('0x74')][_0xc8f4('0x3e')];_0x1401f1+=0x1){socket[_0xc8f4('0x79')](_0xc8f4('0x7a'),{'UserId':Number(_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')][_0x1401f1]),'VoicePrefixId':Number(_0x3ad7dd[_0xc8f4('0x4e')]['id'])});}}else{socket[_0xc8f4('0x79')](_0xc8f4('0x7a'),{'UserId':Number(_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')]),'VoicePrefixId':Number(_0x3ad7dd['params']['id'])});}});}})[_0xc8f4('0x2c')](respondWithStatusCode(_0x3e22c2,null))[_0xc8f4('0x4c')](handleError(_0x3e22c2,null));};exports['getAgents']=function(_0x412695,_0x1921bc,_0x50f012){var _0x16ea62={};var _0x2bbf57={};var _0x57b97a;var _0x5bb6cc;return db[_0xc8f4('0x32')][_0xc8f4('0x7b')]({'where':{'id':_0x412695[_0xc8f4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1921bc,null))[_0xc8f4('0x2c')](function(_0xf1c31d){if(_0xf1c31d){_0x57b97a=_0xf1c31d;_0x2bbf57['model']=_['keys'](db[_0xc8f4('0x7c')][_0xc8f4('0x33')]);_0x2bbf57[_0xc8f4('0x39')]=_['keys'](_0x412695[_0xc8f4('0x39')]);_0x2bbf57[_0xc8f4('0x3a')]=_[_0xc8f4('0x3c')](_0x2bbf57['model'],_0x2bbf57[_0xc8f4('0x39')]);_0x16ea62[_0xc8f4('0x3b')]=_[_0xc8f4('0x3c')](_0x2bbf57[_0xc8f4('0x36')],qs[_0xc8f4('0x3d')](_0x412695[_0xc8f4('0x39')][_0xc8f4('0x3d')]));_0x16ea62[_0xc8f4('0x3b')]=_0x16ea62[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x16ea62[_0xc8f4('0x3b')]:_0x2bbf57['model'];_0x16ea62[_0xc8f4('0x41')]=qs['sort'](_0x412695[_0xc8f4('0x39')][_0xc8f4('0x42')]);_0x16ea62[_0xc8f4('0x45')]=qs[_0xc8f4('0x3a')](_[_0xc8f4('0x43')](_0x412695[_0xc8f4('0x39')],_0x2bbf57[_0xc8f4('0x3a')]));if(_0x412695[_0xc8f4('0x39')]['filter']){_0x16ea62[_0xc8f4('0x45')]=_['merge'](_0x16ea62['where'],{'$or':_[_0xc8f4('0x31')](_0x16ea62[_0xc8f4('0x3b')],function(_0x35a3db){var _0x4fedd9={};_0x4fedd9[_0x35a3db]={'$like':'%'+_0x412695['query'][_0xc8f4('0x44')]+'%'};return _0x4fedd9;})});}_0x16ea62=_[_0xc8f4('0x46')]({},_0x16ea62,_0x412695[_0xc8f4('0x48')]);return _0x57b97a['getAgents'](_0x16ea62);}})[_0xc8f4('0x2c')](function(_0x5ce8eb){if(_0x5ce8eb){_0x5bb6cc=_0x5ce8eb[_0xc8f4('0x3e')];if(!_0x412695[_0xc8f4('0x39')][_0xc8f4('0x3f')](_0xc8f4('0x40'))){_0x16ea62[_0xc8f4('0x22')]=qs['limit'](_0x412695[_0xc8f4('0x39')]['limit']);_0x16ea62[_0xc8f4('0x20')]=qs[_0xc8f4('0x20')](_0x412695[_0xc8f4('0x39')][_0xc8f4('0x20')]);}return _0x57b97a[_0xc8f4('0x7d')](_0x16ea62);}})[_0xc8f4('0x2c')](function(_0x3f1852){if(_0x3f1852){return _0x3f1852?{'count':_0x5bb6cc,'rows':_0x3f1852}:null;}})[_0xc8f4('0x2c')](respondWithResult(_0x1921bc,null))[_0xc8f4('0x4c')](handleError(_0x1921bc,null));};exports[_0xc8f4('0x7e')]=function(_0x28bcf0,_0x53bd16,_0x526010){var _0x23890b={};var _0x20c759={};var _0x13a274;var _0xb813ba;return db[_0xc8f4('0x32')][_0xc8f4('0x7b')]({'where':{'id':_0x28bcf0[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0x53bd16,null))[_0xc8f4('0x2c')](function(_0x7758c2){if(_0x7758c2){_0x13a274=_0x7758c2;_0x20c759[_0xc8f4('0x36')]=_[_0xc8f4('0x38')](db['Team']['rawAttributes']);_0x20c759[_0xc8f4('0x39')]=_['keys'](_0x28bcf0['query']);_0x20c759[_0xc8f4('0x3a')]=_['intersection'](_0x20c759['model'],_0x20c759['query']);_0x23890b['attributes']=_['intersection'](_0x20c759[_0xc8f4('0x36')],qs[_0xc8f4('0x3d')](_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x3d')]));_0x23890b[_0xc8f4('0x3b')]=_0x23890b[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x23890b[_0xc8f4('0x3b')]:_0x20c759[_0xc8f4('0x36')];_0x23890b[_0xc8f4('0x41')]=qs[_0xc8f4('0x42')](_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x42')]);_0x23890b[_0xc8f4('0x45')]=qs[_0xc8f4('0x3a')](_[_0xc8f4('0x43')](_0x28bcf0[_0xc8f4('0x39')],_0x20c759[_0xc8f4('0x3a')]));if(_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x44')]){_0x23890b[_0xc8f4('0x45')]=_[_0xc8f4('0x46')](_0x23890b[_0xc8f4('0x45')],{'$or':_['map'](_0x23890b['attributes'],function(_0xe8ff50){var _0x416ade={};_0x416ade[_0xe8ff50]={'$like':'%'+_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x44')]+'%'};return _0x416ade;})});}_0x23890b=_[_0xc8f4('0x46')]({},_0x23890b,_0x28bcf0[_0xc8f4('0x48')]);return _0x13a274[_0xc8f4('0x7e')](_0x23890b);}})[_0xc8f4('0x2c')](function(_0xe9d619){if(_0xe9d619){_0xb813ba=_0xe9d619[_0xc8f4('0x3e')];if(!_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x3f')](_0xc8f4('0x40'))){_0x23890b[_0xc8f4('0x22')]=qs['limit'](_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x22')]);_0x23890b[_0xc8f4('0x20')]=qs[_0xc8f4('0x20')](_0x28bcf0[_0xc8f4('0x39')]['offset']);}return _0x13a274[_0xc8f4('0x7e')](_0x23890b);}})[_0xc8f4('0x2c')](function(_0x5a5f87){if(_0x5a5f87){return _0x5a5f87?{'count':_0xb813ba,'rows':_0x5a5f87}:null;}})['then'](respondWithResult(_0x53bd16,null))[_0xc8f4('0x4c')](handleError(_0x53bd16,null));};exports[_0xc8f4('0x7f')]=function(_0xe771f7,_0x32c7c3,_0x3ecd2e){var _0x4b2876=_0xe771f7['body'][_0xc8f4('0x74')];var _0xe437e;return db['Team'][_0xc8f4('0x80')]({'where':{'id':_0x4b2876},'attributes':['id'],'include':[{'model':db[_0xc8f4('0x7c')],'as':_0xc8f4('0x81'),'attributes':['id',_0xc8f4('0x37'),_0xc8f4('0x82'),_0xc8f4('0x83'),_0xc8f4('0x84')],'raw':!![]}]})[_0xc8f4('0x2c')](function(_0x4a4ea5){if(_0x4a4ea5){_0xe437e=_0x4a4ea5;var _0x23177d=_[_0xc8f4('0x85')](_0x4a4ea5,function(_0x129d2a){var _0x4d63e1=_0x129d2a[_0xc8f4('0x55')]({'plain':!![]});return _0x4d63e1['Agents'];});return db[_0xc8f4('0x32')][_0xc8f4('0x4f')]({'where':{'id':_0xe771f7[_0xc8f4('0x4e')]['id']}})['then'](function(_0x3a2f12){return db['sequelize'][_0xc8f4('0x53')](function(_0xfbf268){return _0x3a2f12[_0xc8f4('0x7f')](_0x4b2876,{'transaction':_0xfbf268})['then'](function(){return BPromise[_0xc8f4('0x86')](_0xe437e,function(_0x3a1a5a){return db[_0xc8f4('0x87')][_0xc8f4('0x88')]({'TeamId':_0x3a1a5a['id'],'VoicePrefixId':_0xe771f7['params']['id']},{'transaction':_0xfbf268});});})[_0xc8f4('0x2c')](function(){return BPromise['each'](_0x23177d,function(_0x2180a4){return db['UserVoicePrefix'][_0xc8f4('0x89')]({'where':{'UserId':_0x2180a4['id'],'VoicePrefixId':_0xe771f7[_0xc8f4('0x4e')]['id']},'transaction':_0xfbf268});});})['then'](function(){_0x23177d[_0xc8f4('0x8a')](function(_0x1b0146){socket[_0xc8f4('0x79')](_0xc8f4('0x8b'),{'UserId':_0x1b0146['id'],'VoicePrefixId':_0x3a2f12['id']});});});});});}})[_0xc8f4('0x2c')](respondWithStatusCode(_0x32c7c3,null))['catch'](handleError(_0x32c7c3,null));};exports[_0xc8f4('0x8c')]=function(_0x2a69de,_0xfe16,_0xac0f76){return db['Team'][_0xc8f4('0x80')]({'where':{'id':_0x2a69de[_0xc8f4('0x39')][_0xc8f4('0x74')]},'attributes':['id'],'include':[{'model':db[_0xc8f4('0x7c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc8f4('0x2c')](handleEntityNotFound(_0xfe16,null))[_0xc8f4('0x2c')](function(_0x32258c){var _0x3e67d5=_[_0xc8f4('0x31')](_0x32258c,'id');var _0xbc97d=[];var _0x5b723a=[];var _0x9c5a78=squel[_0xc8f4('0x8d')]();_0x9c5a78['field'](_0xc8f4('0x8e'))[_0xc8f4('0x8f')](_0xc8f4('0x90'),'tq')[_0xc8f4('0x91')]('user_has_teams','ut',_0xc8f4('0x92'))['where'](_0xc8f4('0x93'),_0x2a69de[_0xc8f4('0x4e')]['id']);for(var _0x11c10f=0x0;_0x11c10f<_0x32258c['length'];_0x11c10f+=0x1){let _0x2e3221=_0x32258c[_0x11c10f];for(var _0x103c24=0x0;_0x103c24<_0x2e3221[_0xc8f4('0x81')][_0xc8f4('0x3e')];_0x103c24+=0x1){let _0x2e1a3b=_0x2e3221[_0xc8f4('0x81')][_0x103c24];var _0x3c0e05=_0x9c5a78['clone']();_0x3c0e05[_0xc8f4('0x45')](_0xc8f4('0x94'),_0x2e1a3b['id']);_0x5b723a[_0xc8f4('0x68')](db[_0xc8f4('0x52')][_0xc8f4('0x39')](_0x3c0e05[_0xc8f4('0x95')](),{'type':db[_0xc8f4('0x52')][_0xc8f4('0x96')][_0xc8f4('0x97')]})[_0xc8f4('0x2c')](function(_0x29d70c){if(_0x29d70c[_0xc8f4('0x3e')]===0x1){return _0x2e1a3b['id'];}else{var _0x10cc75=_[_0xc8f4('0x98')](_[_0xc8f4('0x31')](_0x29d70c,_0xc8f4('0x99')),function(_0x84dc88){return _[_0xc8f4('0x9a')](_0x3e67d5,_0x84dc88);});if(_0x10cc75){return _0x2e1a3b['id'];}}}));}}return BPromise[_0xc8f4('0x9b')](_0x5b723a)[_0xc8f4('0x2c')](function(_0x506950){_0xbc97d=_(_0xbc97d)['union'](_0x506950)[_0xc8f4('0x9c')]()['value']();return db['VoicePrefix'][_0xc8f4('0x4f')]({'where':{'id':_0x2a69de[_0xc8f4('0x4e')]['id']}})['then'](function(_0x4bba01){return db['sequelize']['transaction'](function(_0x27334b){return _0x4bba01['removeTeams'](_0x2a69de['query'][_0xc8f4('0x74')],{'transaction':_0x27334b})[_0xc8f4('0x2c')](function(){if(!_[_0xc8f4('0x9d')](_0xbc97d)){return _0x4bba01[_0xc8f4('0x77')](_0xbc97d,{'transaction':_0x27334b});}})[_0xc8f4('0x2c')](function(){_0xbc97d[_0xc8f4('0x8a')](function(_0x34a545){socket[_0xc8f4('0x79')](_0xc8f4('0x7a'),{'UserId':_0x34a545,'VoicePrefixId':_0x4bba01['id']});});});});});});})[_0xc8f4('0x2c')](respondWithStatusCode(_0xfe16,null))['catch'](handleError(_0xfe16,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index ab78dbc..2e0cd38 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 _0x722e=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x1dce4a,_0x45dc6d){var _0x1231eb=function(_0x649d36){while(--_0x649d36){_0x1dce4a['push'](_0x1dce4a['shift']());}};_0x1231eb(++_0x45dc6d);}(_0x722e,0x140));var _0xe722=function(_0x1423ed,_0x45b68b){_0x1423ed=_0x1423ed-0x0;var _0x2456d0=_0x722e[_0x1423ed];return _0x2456d0;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xe722('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe722('0x1')](0x0);var events={'afterCreate':_0xe722('0x2'),'afterUpdate':_0xe722('0x3'),'afterDestroy':_0xe722('0x4')};function emitEvent(_0x32a8f6){return function(_0x5283f7,_0x35b88f,_0x477e48){VoicePrefixEvents[_0xe722('0x5')](_0x32a8f6+':'+_0x5283f7['id'],_0x5283f7);VoicePrefixEvents['emit'](_0x32a8f6,_0x5283f7);_0x477e48(null);};}for(var e in events){if(events[_0xe722('0x6')](e)){var event=events[e];VoicePrefix[_0xe722('0x7')](e,emitEvent(event));}}module[_0xe722('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xc3af=['hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove','emit'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0xc3af,0xa4));var _0xfc3a=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0xc3af[_0x24f326];return _0x488e2d;};'use strict';var EventEmitter=require(_0xfc3a('0x0'));var VoicePrefix=require(_0xfc3a('0x1'))['db'][_0xfc3a('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xfc3a('0x3')](0x0);var events={'afterCreate':_0xfc3a('0x4'),'afterUpdate':'update','afterDestroy':_0xfc3a('0x5')};function emitEvent(_0x11190c){return function(_0x3bac39,_0x40c645,_0x24c66b){VoicePrefixEvents[_0xfc3a('0x6')](_0x11190c+':'+_0x3bac39['id'],_0x3bac39);VoicePrefixEvents[_0xfc3a('0x6')](_0x11190c,_0x3bac39);_0x24c66b(null);};}for(var e in events){if(events[_0xfc3a('0x7')](e)){var event=events[e];VoicePrefix[_0xfc3a('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index f10bb10..fbdcc15 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 _0x1a32=['util','moment','request-promise','path','rimraf','exports','define','lodash'];(function(_0x207a02,_0x278c56){var _0xd995c3=function(_0x24e415){while(--_0x24e415){_0x207a02['push'](_0x207a02['shift']());}};_0xd995c3(++_0x278c56);}(_0x1a32,0xcf));var _0x21a3=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0x1a32[_0x4c05da];return _0x1614db;};'use strict';var _=require(_0x21a3('0x0'));var util=require(_0x21a3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x21a3('0x2'));var BPromise=require('bluebird');var rp=require(_0x21a3('0x3'));var fs=require('fs');var path=require(_0x21a3('0x4'));var rimraf=require(_0x21a3('0x5'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0x21a3('0x6')]=function(_0x3d1cff,_0x560a5c){return _0x3d1cff[_0x21a3('0x7')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e7c=['define','VoicePrefix','lodash','util','../../config/logger','bluebird','request-promise','path','./voicePrefix.attributes','exports'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x5e7c,0x16a));var _0xc5e7=function(_0xa5ac70,_0x499051){_0xa5ac70=_0xa5ac70-0x0;var _0x2c59ec=_0x5e7c[_0xa5ac70];return _0x2c59ec;};'use strict';var _=require(_0xc5e7('0x0'));var util=require(_0xc5e7('0x1'));var logger=require(_0xc5e7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc5e7('0x3'));var rp=require(_0xc5e7('0x4'));var fs=require('fs');var path=require(_0xc5e7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc5e7('0x6'));module[_0xc5e7('0x7')]=function(_0x329a63,_0x2f3e88){return _0x329a63[_0xc5e7('0x8')](_0xc5e7('0x9'),attributes,{'tableName':'voice_prefixes','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 53cab4b..a72d384 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 _0x1fa9=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1fa9,0x136));var _0x91fa=function(_0x485c6c,_0x5d9e66){_0x485c6c=_0x485c6c-0x0;var _0x2a9e70=_0x1fa9[_0x485c6c];return _0x2a9e70;};'use strict';var _=require(_0x91fa('0x0'));var util=require('util');var moment=require(_0x91fa('0x1'));var BPromise=require('bluebird');var rs=require(_0x91fa('0x2'));var fs=require('fs');var Redis=require(_0x91fa('0x3'));var db=require(_0x91fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x91fa('0x5'))(_0x91fa('0x6'));var config=require(_0x91fa('0x7'));var jayson=require(_0x91fa('0x8'));var client=jayson[_0x91fa('0x9')]['http']({'port':0x232a});config[_0x91fa('0xa')]=_[_0x91fa('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x91fa('0xc'))(new Redis(config[_0x91fa('0xa')]));require(_0x91fa('0xd'))[_0x91fa('0xe')](socket);function respondWithRpcPromise(_0x1f246b,_0x886fc1,_0x132eb2){return new BPromise(function(_0x595295,_0x544f1c){return client[_0x91fa('0xf')](_0x1f246b,_0x132eb2)[_0x91fa('0x10')](function(_0x17fc65){logger[_0x91fa('0x11')](_0x91fa('0x12'),_0x886fc1,_0x91fa('0x13'));logger[_0x91fa('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x886fc1,'request\x20sent',JSON['stringify'](_0x17fc65));if(_0x17fc65[_0x91fa('0x15')]){if(_0x17fc65['error'][_0x91fa('0x16')]===0x1f4){logger[_0x91fa('0x15')](_0x91fa('0x12'),_0x886fc1,_0x17fc65[_0x91fa('0x15')]['message']);return _0x544f1c(_0x17fc65[_0x91fa('0x15')][_0x91fa('0x17')]);}logger[_0x91fa('0x15')](_0x91fa('0x12'),_0x886fc1,_0x17fc65[_0x91fa('0x15')][_0x91fa('0x17')]);return _0x595295(_0x17fc65['error'][_0x91fa('0x17')]);}else{logger[_0x91fa('0x11')](_0x91fa('0x12'),_0x886fc1,_0x91fa('0x13'));_0x595295(_0x17fc65[_0x91fa('0x18')]['message']);}})[_0x91fa('0x19')](function(_0x433cf5){logger[_0x91fa('0x15')](_0x91fa('0x12'),_0x886fc1,_0x433cf5);_0x544f1c(_0x433cf5);});});} \ No newline at end of file +var _0x7b84=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2e482c,_0x1f588d){var _0x167c3c=function(_0x189298){while(--_0x189298){_0x2e482c['push'](_0x2e482c['shift']());}};_0x167c3c(++_0x1f588d);}(_0x7b84,0x17c));var _0x47b8=function(_0x41b82e,_0x4e50fd){_0x41b82e=_0x41b82e-0x0;var _0xc558dd=_0x7b84[_0x41b82e];return _0xc558dd;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});config['redis']=_[_0x47b8('0xd')](config[_0x47b8('0xe')],{'host':_0x47b8('0xf'),'port':0x18eb});var socket=require(_0x47b8('0x10'))(new Redis(config[_0x47b8('0xe')]));require(_0x47b8('0x11'))[_0x47b8('0x12')](socket);function respondWithRpcPromise(_0x4570d4,_0x9414c2,_0x429262){return new BPromise(function(_0x289f98,_0x1a0a6a){return client[_0x47b8('0x13')](_0x4570d4,_0x429262)[_0x47b8('0x14')](function(_0x3e255e){logger[_0x47b8('0x15')](_0x47b8('0x16'),_0x9414c2,_0x47b8('0x17'));logger[_0x47b8('0x18')](_0x47b8('0x19'),_0x9414c2,_0x47b8('0x17'),JSON[_0x47b8('0x1a')](_0x3e255e));if(_0x3e255e[_0x47b8('0x1b')]){if(_0x3e255e[_0x47b8('0x1b')][_0x47b8('0x1c')]===0x1f4){logger[_0x47b8('0x1b')](_0x47b8('0x16'),_0x9414c2,_0x3e255e['error'][_0x47b8('0x1d')]);return _0x1a0a6a(_0x3e255e[_0x47b8('0x1b')][_0x47b8('0x1d')]);}logger[_0x47b8('0x1b')](_0x47b8('0x16'),_0x9414c2,_0x3e255e[_0x47b8('0x1b')][_0x47b8('0x1d')]);return _0x289f98(_0x3e255e['error'][_0x47b8('0x1d')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x9414c2,'request\x20sent');_0x289f98(_0x3e255e[_0x47b8('0x1e')][_0x47b8('0x1d')]);}})[_0x47b8('0x1f')](function(_0x5b3e8e){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x9414c2,_0x5b3e8e);_0x1a0a6a(_0x5b3e8e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index afdbcd1..a9fe315 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 _0x3f8c=['remove','update','register','length','voicePrefix:'];(function(_0xbc376e,_0x12af1c){var _0x22d022=function(_0x3155e1){while(--_0x3155e1){_0xbc376e['push'](_0xbc376e['shift']());}};_0x22d022(++_0x12af1c);}(_0x3f8c,0x104));var _0xc3f8=function(_0x2aca9f,_0x3c6e0a){_0x2aca9f=_0x2aca9f-0x0;var _0x121784=_0x3f8c[_0x2aca9f];return _0x121784;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0xc3f8('0x0'),_0xc3f8('0x1')];function createListener(_0x2e70c4,_0xab5f83){return function(_0x4de1c7){_0xab5f83['emit'](_0x2e70c4,_0x4de1c7);};}function removeListener(_0x54035a,_0x4e5dbd){return function(){VoicePrefixEvents['removeListener'](_0x54035a,_0x4e5dbd);};}exports[_0xc3f8('0x2')]=function(_0x1a6976){for(var _0x3a4e2f=0x0,_0x44c25d=events[_0xc3f8('0x3')];_0x3a4e2f<_0x44c25d;_0x3a4e2f++){var _0x15512a=events[_0x3a4e2f];var _0x51093a=createListener(_0xc3f8('0x4')+_0x15512a,_0x1a6976);VoicePrefixEvents['on'](_0x15512a,_0x51093a);}}; \ No newline at end of file +var _0x4746=['length','voicePrefix:','./voicePrefix.events','save','update','emit','register'];(function(_0x8ee4d,_0x47f1ca){var _0x1ff628=function(_0x2a8b87){while(--_0x2a8b87){_0x8ee4d['push'](_0x8ee4d['shift']());}};_0x1ff628(++_0x47f1ca);}(_0x4746,0xc6));var _0x6474=function(_0x291af9,_0x2c11bb){_0x291af9=_0x291af9-0x0;var _0x5a0883=_0x4746[_0x291af9];return _0x5a0883;};'use strict';var VoicePrefixEvents=require(_0x6474('0x0'));var events=[_0x6474('0x1'),'remove',_0x6474('0x2')];function createListener(_0x59b95a,_0xd115f7){return function(_0x244bc5){_0xd115f7[_0x6474('0x3')](_0x59b95a,_0x244bc5);};}function removeListener(_0x156374,_0x1314f4){return function(){VoicePrefixEvents['removeListener'](_0x156374,_0x1314f4);};}exports[_0x6474('0x4')]=function(_0x2bcf7c){for(var _0x4cadd7=0x0,_0x433af9=events[_0x6474('0x5')];_0x4cadd7<_0x433af9;_0x4cadd7++){var _0xcd065e=events[_0x4cadd7];var _0xec3cda=createListener(_0x6474('0x6')+_0xcd065e,_0x2bcf7c);VoicePrefixEvents['on'](_0xcd065e,_0xec3cda);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index b82dfe6..de63a91 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(_0x1177a0,_0x431f77){var _0x39714b=function(_0x4acda7){while(--_0x4acda7){_0x1177a0['push'](_0x1177a0['shift']());}};_0x39714b(++_0x431f77);}(_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 _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x435b2f,_0x4c44da){var _0x181648=function(_0x3d753e){while(--_0x3d753e){_0x435b2f['push'](_0x435b2f['shift']());}};_0x181648(++_0x4c44da);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b0bc8,_0x3f86b0){_0x5b0bc8=_0x5b0bc8-0x0;var _0x1626a5=_0xb10b[_0x5b0bc8];return _0x1626a5;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 80fcc1d..fb692f8 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 _0x191e=['BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','ENUM','inbound','outbound','default','STRING','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','setDataValue','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','strategy','INTEGER','yes','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty'];(function(_0x5b453e,_0x31e024){var _0x16f816=function(_0x4a9c92){while(--_0x4a9c92){_0x5b453e['push'](_0x5b453e['shift']());}};_0x16f816(++_0x31e024);}(_0x191e,0x1d8));var _0xe191=function(_0x3a805c,_0x282353){_0x3a805c=_0x3a805c-0x0;var _0x3c8364=_0x191e[_0x3a805c];return _0x3c8364;};'use strict';var Sequelize=require('sequelize');module[_0xe191('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe191('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe191('0x2')](_0xe191('0x3'),_0xe191('0x4')),'allowNull':![],'defaultValue':_0xe191('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xe191('0x5')},'announce':{'type':Sequelize[_0xe191('0x6')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xe191('0x7'),_0xe191('0x8'),_0xe191('0x9'),_0xe191('0xa'),_0xe191('0xb'),_0xe191('0xc'),_0xe191('0xd'),'rrordered'),'allowNull':![],'defaultValue':_0xe191('0x7'),'set':function(_0x313579){this[_0xe191('0xe')]('strategy',_0x313579?_0x313579:_0xe191('0xb'));},'get':function(){var _0x16a68f=this[_0xe191('0xf')](_0xe191('0x10'));var _0x369f1e=this[_0xe191('0xf')](_0xe191('0x11'));var _0x724819=this[_0xe191('0xf')]('strategy');if(_0x16a68f===_0xe191('0x4')){if(_0x369f1e===_0xe191('0x12')){return null;}if(_0x369f1e===_0xe191('0x13')&&!['rrmemory',_0xe191('0x14')][_0xe191('0x15')](_0x724819)){this[_0xe191('0xe')](_0xe191('0x16'),'rrmemory');}}return _0x724819;}},'servicelevel':{'type':Sequelize[_0xe191('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xe191('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xe191('0x17')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xe191('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xe191('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xe191('0x2')](_0xe191('0x18'),'no'),'defaultValue':_0xe191('0x18')},'autopause':{'type':Sequelize[_0xe191('0x2')](_0xe191('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xe191('0x2')](_0xe191('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xe191('0x2')](_0xe191('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xe191('0x2')](_0xe191('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xe191('0x2')](_0xe191('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xe191('0x2')](_0xe191('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xe191('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xe191('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xe191('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xe191('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xe191('0x2')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe191('0x2')]('yes','no'),'defaultValue':_0xe191('0x18')},'announce_holdtime':{'type':Sequelize[_0xe191('0x2')](_0xe191('0x18'),'no',_0xe191('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xe191('0x2')](_0xe191('0x18'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xe191('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe191('0x6')]},'queue_youarenext':{'type':Sequelize[_0xe191('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xe191('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xe191('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xe191('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe191('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xe191('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xe191('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xe191('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xe191('0x6')]},'queue_quantity2':{'type':Sequelize[_0xe191('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0xe191('0x6')]},'queue_less_than':{'type':Sequelize[_0xe191('0x6')]},'periodic_announce':{'type':Sequelize[_0xe191('0x1a')],'set':function(_0x1f661e){this[_0xe191('0xe')](_0xe191('0x1b'),_0x1f661e?_0x1f661e[_0xe191('0x1c')](','):[]);},'get':function(){return this['getDataValue'](_0xe191('0x1b'))?this[_0xe191('0xf')](_0xe191('0x1b'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xe191('0x6')],'defaultValue':'yes','set':function(_0x49c1f0){this[_0xe191('0xe')]('joinempty',_0x49c1f0?_0x49c1f0[_0xe191('0x1c')](','):undefined);},'get':function(){return this[_0xe191('0xf')](_0xe191('0x1d'))?this['getDataValue'](_0xe191('0x1d'))[_0xe191('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xe191('0x6')],'defaultValue':'no','set':function(_0x1255dd){this['setDataValue'](_0xe191('0x1f'),_0x1255dd?_0x1255dd[_0xe191('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0xe191('0x1f'))?this[_0xe191('0xf')]('leavewhenempty')[_0xe191('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe191('0x2')](_0xe191('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xe191('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xe191('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xe191('0x2')](_0xe191('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xe191('0x6')]},'description':{'type':Sequelize[_0xe191('0x6')]},'acw':{'type':Sequelize[_0xe191('0x20')],'defaultValue':0x0,'set':function(_0x2eabf3){this[_0xe191('0xe')](_0xe191('0x21'),_0x2eabf3);if(_0x2eabf3){if(this[_0xe191('0xf')](_0xe191('0x22'))<0x2){this[_0xe191('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xe191('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xe191('0x20')],'defaultValue':0x0,'comment':_0xe191('0x23')},'dialMethod':{'type':Sequelize[_0xe191('0x2')](_0xe191('0x12'),'progressive','power',_0xe191('0x24'),'booked'),'defaultValue':_0xe191('0x25'),'comment':_0xe191('0x26')},'dialLimitChannel':{'type':Sequelize[_0xe191('0x17')](0x4)[_0xe191('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe191('0x28')},'dialLimitQueue':{'type':Sequelize[_0xe191('0x17')](0x4)[_0xe191('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe191('0x29')},'dialPowerLevel':{'type':Sequelize[_0xe191('0x2a')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xe191('0x2b')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xe191('0x2c'),_0xe191('0x2d')),'defaultValue':_0xe191('0x2d'),'comment':_0xe191('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xe191('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xe191('0x2f')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xe191('0x30')},'dialOriginateCallerIdName':{'type':Sequelize[_0xe191('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe191('0x31')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xe191('0x32'),'comment':_0xe191('0x33')},'dialQueueTimeout':{'type':Sequelize[_0xe191('0x17')](0x3)[_0xe191('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe191('0x34')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe191('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe191('0x17')](0x5)[_0xe191('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe191('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0xe191('0x17')](0x3)[_0xe191('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe191('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe191('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe191('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe191('0x17')](0x3)[_0xe191('0x27')],'defaultValue':0x3,'comment':_0xe191('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe191('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xe191('0x17')](0x3)[_0xe191('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe191('0x39')},'dialTimezone':{'type':Sequelize[_0xe191('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe191('0x6')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xe191('0x2')]('always',_0xe191('0x3a'),_0xe191('0x3b')),'defaultValue':_0xe191('0x3c')},'dialAMDActive':{'type':Sequelize[_0xe191('0x20')],'defaultValue':0x0,'comment':_0xe191('0x3d')},'dialAMDInitialSilence':{'type':Sequelize[_0xe191('0x17')](0x9)[_0xe191('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xe191('0x17')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe191('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe191('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe191('0x17')](0x9)[_0xe191('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe191('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0xe191('0x17')](0x9)[_0xe191('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe191('0x17')](0x9)[_0xe191('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe191('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe191('0x17')](0x9)[_0xe191('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe191('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe191('0x17')](0x9)[_0xe191('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe191('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0xe191('0x17')](0x5)[_0xe191('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xe191('0x20')],'defaultValue':0x0,'comment':_0xe191('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe191('0x2')]('DESC',_0xe191('0x44')),'defaultValue':_0xe191('0x45')},'dialQueueProject2':{'type':Sequelize[_0xe191('0x6')],'comment':_0xe191('0x46')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xe191('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe191('0x17')](0x3)[_0xe191('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe191('0x47')},'dialCutDigit':{'type':Sequelize[_0xe191('0x17')](0x3)[_0xe191('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe191('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe191('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe191('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe191('0x17')](0x5)[_0xe191('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe191('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xe191('0x17')](0x5)[_0xe191('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe191('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe191('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe191('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe191('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0xe191('0x17')](0x3)[_0xe191('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe191('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe191('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe191('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe191('0x17')](0x3)[_0xe191('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe191('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe191('0x17')](0x5)[_0xe191('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe191('0x50')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe191('0x17')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe191('0x20')],'defaultValue':![],'comment':_0xe191('0x51'),'set':function(_0x15b20d){if(!_0x15b20d)this[_0xe191('0xe')](_0xe191('0x52'),null);this['setDataValue'](_0xe191('0x53'),_0x15b20d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xe191('0x17')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xe191('0x17')](0x3)[_0xe191('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xe191('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xe191('0x17')](0x3)[_0xe191('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xe191('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0x05b7=['mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','default','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','type','dialMethod','strategy','outbound','preview','booked','roundrobin','includes','INTEGER','yes','all','once','split','joinempty','join','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x05b7,0xfa));var _0x705b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x05b7[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x705b('0x0'));module['exports']={'name':{'type':Sequelize[_0x705b('0x1')],'allowNull':![],'unique':_0x705b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x705b('0x3')](_0x705b('0x4'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x705b('0x1')],'defaultValue':_0x705b('0x5')},'announce':{'type':Sequelize[_0x705b('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x705b('0x6'),_0x705b('0x7'),'random',_0x705b('0x8'),_0x705b('0x9'),_0x705b('0xa'),_0x705b('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x1adcfe){this[_0x705b('0xc')]('strategy',_0x1adcfe?_0x1adcfe:_0x705b('0x8'));},'get':function(){var _0x5b428d=this[_0x705b('0xd')](_0x705b('0xe'));var _0x272878=this[_0x705b('0xd')](_0x705b('0xf'));var _0x143578=this[_0x705b('0xd')](_0x705b('0x10'));if(_0x5b428d===_0x705b('0x11')){if(_0x272878===_0x705b('0x12')){return null;}if(_0x272878===_0x705b('0x13')&&![_0x705b('0x8'),_0x705b('0x14')][_0x705b('0x15')](_0x143578)){this[_0x705b('0xc')]('strategy',_0x705b('0x8'));}}return _0x143578;}},'servicelevel':{'type':Sequelize[_0x705b('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x705b('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x705b('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x705b('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x705b('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x705b('0x3')](_0x705b('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x705b('0x3')](_0x705b('0x17'),'no',_0x705b('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x705b('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x705b('0x3')](_0x705b('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x705b('0x3')](_0x705b('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x705b('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x705b('0x3')](_0x705b('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x705b('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x705b('0x3')](_0x705b('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x705b('0x3')](_0x705b('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x705b('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x705b('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x705b('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x705b('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x705b('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x705b('0x3')](_0x705b('0x17'),'no'),'defaultValue':_0x705b('0x17')},'announce_holdtime':{'type':Sequelize[_0x705b('0x3')](_0x705b('0x17'),'no',_0x705b('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x705b('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x705b('0x3')](_0x705b('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x705b('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x705b('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x705b('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x705b('0x1')]},'queue_youarenext':{'type':Sequelize[_0x705b('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x705b('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x705b('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x705b('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x705b('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x705b('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x705b('0x1')]},'queue_quantity2':{'type':Sequelize[_0x705b('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x705b('0x1')]},'queue_less_than':{'type':Sequelize[_0x705b('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x4c19e8){this[_0x705b('0xc')]('periodic_announce',_0x4c19e8?_0x4c19e8['join'](','):[]);},'get':function(){return this[_0x705b('0xd')]('periodic_announce')?this[_0x705b('0xd')]('periodic_announce')[_0x705b('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x705b('0x1')],'defaultValue':_0x705b('0x17'),'set':function(_0x782add){this['setDataValue'](_0x705b('0x1b'),_0x782add?_0x782add[_0x705b('0x1c')](','):undefined);},'get':function(){return this[_0x705b('0xd')]('joinempty')?this[_0x705b('0xd')](_0x705b('0x1b'))[_0x705b('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x586140){this[_0x705b('0xc')]('leavewhenempty',_0x586140?_0x586140[_0x705b('0x1c')](','):undefined);},'get':function(){return this[_0x705b('0xd')]('leavewhenempty')?this[_0x705b('0xd')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x705b('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x705b('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x705b('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x705b('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x705b('0x1d')],'defaultValue':0x0,'set':function(_0x37e235){this[_0x705b('0xc')](_0x705b('0x1e'),_0x37e235);if(_0x37e235){if(this[_0x705b('0xd')](_0x705b('0x1f'))<0x2){this[_0x705b('0xc')](_0x705b('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x705b('0x1d')],'defaultValue':0x0,'comment':_0x705b('0x20')},'dialMethod':{'type':Sequelize[_0x705b('0x3')](_0x705b('0x12'),'progressive',_0x705b('0x21'),_0x705b('0x22'),'booked'),'defaultValue':_0x705b('0x23'),'comment':_0x705b('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x705b('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x705b('0x26')},'dialLimitQueue':{'type':Sequelize[_0x705b('0x16')](0x4)[_0x705b('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x705b('0x27')](0x2)[_0x705b('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x705b('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x705b('0x3')]('agentBusyFactor',_0x705b('0x29')),'defaultValue':_0x705b('0x29'),'comment':_0x705b('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x705b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x705b('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x705b('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x705b('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x705b('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x705b('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x705b('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x705b('0x1')],'defaultValue':_0x705b('0x2d'),'comment':_0x705b('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x705b('0x16')](0x3)[_0x705b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x705b('0x2f')},'dialQueueProject':{'type':Sequelize[_0x705b('0x1')],'comment':_0x705b('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x705b('0x16')](0x3)[_0x705b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x705b('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x705b('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x705b('0x16')](0x3)[_0x705b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x705b('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x705b('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x705b('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x705b('0x25')],'defaultValue':0x3,'comment':_0x705b('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x705b('0x16')](0x5)[_0x705b('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x705b('0x35')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x705b('0x36')},'dialTimezone':{'type':Sequelize[_0x705b('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x705b('0x1')],'defaultValue':_0x705b('0x37')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x705b('0x3')](_0x705b('0x38'),_0x705b('0x39'),_0x705b('0x3a')),'defaultValue':_0x705b('0x38')},'dialAMDActive':{'type':Sequelize[_0x705b('0x1d')],'defaultValue':0x0,'comment':_0x705b('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0x705b('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x705b('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x705b('0x16')](0x9)[_0x705b('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x705b('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x705b('0x16')](0x9)[_0x705b('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x705b('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x705b('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x705b('0x3f')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x705b('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x705b('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x705b('0x16')](0x9)[_0x705b('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x705b('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x705b('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x705b('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x705b('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x705b('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x705b('0x16')](0x9)[_0x705b('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x705b('0x44')},'dialRecallMeTimeout':{'type':Sequelize[_0x705b('0x16')](0x5)[_0x705b('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x705b('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0x705b('0x3')]('DESC',_0x705b('0x46')),'defaultValue':_0x705b('0x47')},'dialQueueProject2':{'type':Sequelize[_0x705b('0x1')],'comment':_0x705b('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x705b('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x705b('0x16')](0x3)[_0x705b('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x705b('0x16')](0x3)[_0x705b('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x705b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x705b('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x705b('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x705b('0x16')](0x5)[_0x705b('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x705b('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x705b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x705b('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x705b('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x705b('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x705b('0x16')](0x3)[_0x705b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x705b('0x16')](0x5)[_0x705b('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x705b('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x705b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x705b('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x705b('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x705b('0x4f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x705b('0x50'),'set':function(_0x7df1b1){if(!_0x7df1b1)this['setDataValue'](_0x705b('0x51'),null);this[_0x705b('0xc')](_0x705b('0x52'),_0x7df1b1);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x705b('0x16')](0x3)[_0x705b('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x705b('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x705b('0x16')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x705b('0x1d')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 58e7c6e..685032e 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 _0x9bdb=['options','include','findAll','rows','catch','show','params','fields','includeAll','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','findOne','hasOwnProperty','CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','User','online','voicePause','flatMap','Agents','forEach','penalty','sequelize','transaction','addTeams','TeamVoiceQueue','upsert','UserVoiceQueue','each','UserVoiceQueueRt','isNil','interface','format','SIP/%s','emit','removeTeams','select','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','union','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','userVoiceQueue:save','all','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','cm_hopper','fromQuery','phone','scheduledAt','field','ContactId','toString','ListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','cm_contacts','insert','CmHopperId','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','merge','filter'];(function(_0x3dfa94,_0x484cda){var _0x101a77=function(_0x319d3a){while(--_0x319d3a){_0x3dfa94['push'](_0x3dfa94['shift']());}};_0x101a77(++_0x484cda);}(_0x9bdb,0x13c));var _0xb9bd=function(_0x27cf2c,_0x1aaeb5){_0x27cf2c=_0x27cf2c-0x0;var _0x2672c1=_0x9bdb[_0x27cf2c];return _0x2672c1;};'use strict';var emlformat=require(_0xb9bd('0x0'));var rimraf=require(_0xb9bd('0x1'));var zipdir=require(_0xb9bd('0x2'));var jsonpatch=require(_0xb9bd('0x3'));var rp=require('request-promise');var moment=require(_0xb9bd('0x4'));var BPromise=require(_0xb9bd('0x5'));var Mustache=require(_0xb9bd('0x6'));var util=require(_0xb9bd('0x7'));var path=require(_0xb9bd('0x8'));var sox=require(_0xb9bd('0x9'));var csv=require(_0xb9bd('0xa'));var ejs=require(_0xb9bd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9bd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb9bd('0xd'));var deskjs=require(_0xb9bd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb9bd('0xf'));var Papa=require(_0xb9bd('0x10'));var Redis=require(_0xb9bd('0x11'));var authService=require(_0xb9bd('0x12'));var qs=require(_0xb9bd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9bd('0x14'))(_0xb9bd('0x15'));var utils=require(_0xb9bd('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb9bd('0x17'))['db'];config[_0xb9bd('0x18')]=_['defaults'](config[_0xb9bd('0x18')],{'host':_0xb9bd('0x19'),'port':0x18eb});var socket=require(_0xb9bd('0x1a'))(new Redis(config['redis']));require(_0xb9bd('0x1b'))[_0xb9bd('0x1c')](socket);function respondWithStatusCode(_0x2b951c,_0x559855){_0x559855=_0x559855||0xcc;return function(_0x56450d){if(_0x56450d){return _0x2b951c[_0xb9bd('0x1d')](_0x559855);}return _0x2b951c['status'](_0x559855)[_0xb9bd('0x1e')]();};}function respondWithResult(_0x507236,_0x1e0c3a){_0x1e0c3a=_0x1e0c3a||0xc8;return function(_0x1ad774){if(_0x1ad774){return _0x507236[_0xb9bd('0x1f')](_0x1e0c3a)[_0xb9bd('0x20')](_0x1ad774);}};}function respondWithFilteredResult(_0x427640,_0x15dc9f){return function(_0x2f6edc){if(_0x2f6edc){var _0xd65adc=typeof _0x15dc9f[_0xb9bd('0x21')]===_0xb9bd('0x22')&&typeof _0x15dc9f[_0xb9bd('0x23')]==='undefined';var _0x48e7a5=_0x2f6edc[_0xb9bd('0x24')];var _0x2be079=_0xd65adc?0x0:_0x15dc9f[_0xb9bd('0x21')];var _0x1d3ffd=_0xd65adc?_0x2f6edc[_0xb9bd('0x24')]:_0x15dc9f['offset']+_0x15dc9f[_0xb9bd('0x23')];var _0x3657b5;if(_0x1d3ffd>=_0x48e7a5){_0x1d3ffd=_0x48e7a5;_0x3657b5=0xc8;}else{_0x3657b5=0xce;}_0x427640[_0xb9bd('0x1f')](_0x3657b5);return _0x427640[_0xb9bd('0x25')](_0xb9bd('0x26'),_0x2be079+'-'+_0x1d3ffd+'/'+_0x48e7a5)[_0xb9bd('0x20')](_0x2f6edc);}return null;};}function patchUpdates(_0x4657cb){return function(_0x3162b7){try{jsonpatch[_0xb9bd('0x27')](_0x3162b7,_0x4657cb,!![]);}catch(_0x4d2307){return BPromise[_0xb9bd('0x28')](_0x4d2307);}return _0x3162b7[_0xb9bd('0x29')]();};}function saveUpdates(_0x52e526,_0x50dced){return function(_0x4b3940){if(_0x4b3940){return _0x4b3940[_0xb9bd('0x2a')](_0x52e526)[_0xb9bd('0x2b')](function(_0x5eba05){return _0x5eba05;});}return null;};}function removeEntity(_0x9f087d,_0x18f4c1){return function(_0x3b9846){if(_0x3b9846){return _0x3b9846[_0xb9bd('0x2c')]()[_0xb9bd('0x2b')](function(){var _0x3a6cdb=_0x3b9846[_0xb9bd('0x2d')]({'plain':!![]});var _0x31e0cb=[{'name':_0xb9bd('0x2e'),'value':_0xb9bd('0x2f'),'ignore':![]},{'name':_0xb9bd('0x30'),'value':_0xb9bd('0x31'),'ignore':![]}];var _0x5d09c9=_(_0x31e0cb)['filter'](_0xb9bd('0x32'))[_0xb9bd('0x33')](_0xb9bd('0x34'))[_0xb9bd('0x34')]();if(_[_0xb9bd('0x35')](_0x5d09c9,_0x3a6cdb[_0xb9bd('0x36')])){return;}var _0x29cde6=_[_0xb9bd('0x37')](_0x31e0cb,[_0xb9bd('0x34'),_0x3a6cdb['type']])[_0xb9bd('0x38')];return db[_0xb9bd('0x39')][_0xb9bd('0x2c')]({'where':{'type':_0x29cde6,'resourceId':_0x3a6cdb['id']}})[_0xb9bd('0x2b')](function(){return _0x3b9846;});})['then'](function(){_0x9f087d[_0xb9bd('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23d9d5,_0x111bc9){return function(_0x235a99){if(!_0x235a99){_0x23d9d5[_0xb9bd('0x1d')](0x194);}return _0x235a99;};}function handleError(_0x162046,_0x8efeea){_0x8efeea=_0x8efeea||0x1f4;return function(_0x4207d5){logger[_0xb9bd('0x3a')](_0x4207d5[_0xb9bd('0x3b')]);if(_0x4207d5[_0xb9bd('0x38')]){delete _0x4207d5[_0xb9bd('0x38')];}_0x162046[_0xb9bd('0x1f')](_0x8efeea)[_0xb9bd('0x3c')](_0x4207d5);};}exports[_0xb9bd('0x3d')]=function(_0x481309,_0x502e02){var _0x16254a={},_0x5a6f20={},_0x4e85e8={'count':0x0,'rows':[]};var _0x438b23=_[_0xb9bd('0x33')](db[_0xb9bd('0x3e')][_0xb9bd('0x3f')],function(_0x352339){return{'name':_0x352339[_0xb9bd('0x40')],'type':_0x352339[_0xb9bd('0x36')][_0xb9bd('0x41')]};});_0x5a6f20[_0xb9bd('0x42')]=_[_0xb9bd('0x33')](_0x438b23,_0xb9bd('0x38'));_0x5a6f20['query']=_[_0xb9bd('0x43')](_0x481309[_0xb9bd('0x44')]);_0x5a6f20[_0xb9bd('0x45')]=_[_0xb9bd('0x46')](_0x5a6f20['model'],_0x5a6f20['query']);_0x16254a[_0xb9bd('0x47')]=_[_0xb9bd('0x46')](_0x5a6f20[_0xb9bd('0x42')],qs['fields'](_0x481309[_0xb9bd('0x44')]['fields']));_0x16254a[_0xb9bd('0x47')]=_0x16254a[_0xb9bd('0x47')][_0xb9bd('0x48')]?_0x16254a[_0xb9bd('0x47')]:_0x5a6f20[_0xb9bd('0x42')];if(!_0x481309[_0xb9bd('0x44')]['hasOwnProperty'](_0xb9bd('0x49'))){_0x16254a[_0xb9bd('0x23')]=qs[_0xb9bd('0x23')](_0x481309[_0xb9bd('0x44')][_0xb9bd('0x23')]);_0x16254a[_0xb9bd('0x21')]=qs[_0xb9bd('0x21')](_0x481309[_0xb9bd('0x44')]['offset']);}_0x16254a[_0xb9bd('0x4a')]=qs[_0xb9bd('0x4b')](_0x481309[_0xb9bd('0x44')]['sort']);_0x16254a[_0xb9bd('0x4c')]=qs['filters'](_[_0xb9bd('0x4d')](_0x481309[_0xb9bd('0x44')],_0x5a6f20[_0xb9bd('0x45')]),_0x438b23);if(_0x481309[_0xb9bd('0x44')]['filter']){_0x16254a[_0xb9bd('0x4c')]=_[_0xb9bd('0x4e')](_0x16254a[_0xb9bd('0x4c')],{'$or':_[_0xb9bd('0x33')](_0x438b23,function(_0x53a0a7){if(_0x53a0a7[_0xb9bd('0x36')]!=='VIRTUAL'){var _0x301656={};_0x301656[_0x53a0a7[_0xb9bd('0x38')]]={'$like':'%'+_0x481309[_0xb9bd('0x44')][_0xb9bd('0x4f')]+'%'};return _0x301656;}})});}_0x16254a=_['merge']({},_0x16254a,_0x481309[_0xb9bd('0x50')]);var _0x4d8278={'where':_0x16254a['where']};return db[_0xb9bd('0x3e')]['count'](_0x4d8278)[_0xb9bd('0x2b')](function(_0x4e1246){_0x4e85e8[_0xb9bd('0x24')]=_0x4e1246;if(_0x481309[_0xb9bd('0x44')]['includeAll']){_0x16254a[_0xb9bd('0x51')]=[{'all':!![]}];}return db[_0xb9bd('0x3e')][_0xb9bd('0x52')](_0x16254a);})[_0xb9bd('0x2b')](function(_0x5bd420){_0x4e85e8[_0xb9bd('0x53')]=_0x5bd420;return _0x4e85e8;})[_0xb9bd('0x2b')](respondWithFilteredResult(_0x502e02,_0x16254a))[_0xb9bd('0x54')](handleError(_0x502e02,null));};exports[_0xb9bd('0x55')]=function(_0x38734c,_0x171dc5){var _0x5e547a={'raw':![],'where':{'id':_0x38734c[_0xb9bd('0x56')]['id']}},_0x65d0e4={};_0x65d0e4[_0xb9bd('0x42')]=_[_0xb9bd('0x43')](db['VoiceQueue'][_0xb9bd('0x3f')]);_0x65d0e4[_0xb9bd('0x44')]=_[_0xb9bd('0x43')](_0x38734c[_0xb9bd('0x44')]);_0x65d0e4[_0xb9bd('0x45')]=_[_0xb9bd('0x46')](_0x65d0e4[_0xb9bd('0x42')],_0x65d0e4[_0xb9bd('0x44')]);_0x5e547a[_0xb9bd('0x47')]=_[_0xb9bd('0x46')](_0x65d0e4[_0xb9bd('0x42')],qs[_0xb9bd('0x57')](_0x38734c[_0xb9bd('0x44')]['fields']));_0x5e547a[_0xb9bd('0x47')]=_0x5e547a['attributes'][_0xb9bd('0x48')]?_0x5e547a['attributes']:_0x65d0e4[_0xb9bd('0x42')];if(_0x38734c[_0xb9bd('0x44')][_0xb9bd('0x58')]){_0x5e547a['include']=[{'all':!![]}];}_0x5e547a=_[_0xb9bd('0x4e')]({},_0x5e547a,_0x38734c['options']);return db[_0xb9bd('0x3e')][_0xb9bd('0x37')](_0x5e547a)['then'](handleEntityNotFound(_0x171dc5,null))['then'](respondWithResult(_0x171dc5,null))['catch'](handleError(_0x171dc5,null));};exports[_0xb9bd('0x59')]=function(_0x916d63,_0x15bc7e){return db[_0xb9bd('0x3e')]['create'](_0x916d63[_0xb9bd('0x5a')],{})[_0xb9bd('0x2b')](function(_0x42cdc6){var _0x562e8e=_0x916d63[_0xb9bd('0x5b')][_0xb9bd('0x2d')]({'plain':!![]});if(!_0x562e8e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x562e8e[_0xb9bd('0x5c')]===_0xb9bd('0x5b')){var _0x583a34=_0x42cdc6['get']({'plain':!![]});var _0x5314ba=[{'name':_0xb9bd('0x2e'),'value':_0xb9bd('0x2f')},{'name':'QueueCampaigns','value':_0xb9bd('0x31')}];var _0x34cc3a=_[_0xb9bd('0x37')](_0x5314ba,[_0xb9bd('0x34'),_0x583a34[_0xb9bd('0x36')]])['name'];return db['UserProfileSection'][_0xb9bd('0x37')]({'where':{'name':_0x34cc3a,'userProfileId':_0x562e8e[_0xb9bd('0x5d')]},'raw':!![]})[_0xb9bd('0x2b')](function(_0x2c5c32){if(_0x2c5c32&&_0x2c5c32['autoAssociation']===0x0){return db['UserProfileResource'][_0xb9bd('0x59')]({'name':_0x583a34['name'],'resourceId':_0x583a34['id'],'type':_0x2c5c32[_0xb9bd('0x38')],'sectionId':_0x2c5c32['id']},{})[_0xb9bd('0x2b')](function(){return _0x42cdc6;});}else{return _0x42cdc6;}})['catch'](function(_0x5763c8){logger['error'](_0xb9bd('0x5e'),_0x5763c8);throw _0x5763c8;});}return _0x42cdc6;})[_0xb9bd('0x2b')](respondWithResult(_0x15bc7e,0xc9))['catch'](handleError(_0x15bc7e,null));};exports['clone']=function(_0x46b091,_0x36a175){var _0x122084={'where':{'id':_0x46b091[_0xb9bd('0x56')]['id']}},_0x1dd45b={};_0x1dd45b['model']=_['keys'](db[_0xb9bd('0x3e')]['rawAttributes']);_0x122084[_0xb9bd('0x47')]=_[_0xb9bd('0x46')](_0x1dd45b[_0xb9bd('0x42')],qs[_0xb9bd('0x57')](_0x46b091['query'][_0xb9bd('0x57')]));_0x122084[_0xb9bd('0x47')]=_0x122084['attributes'][_0xb9bd('0x48')]?_0x122084[_0xb9bd('0x47')]:_0x1dd45b[_0xb9bd('0x42')];if(_0x46b091[_0xb9bd('0x44')][_0xb9bd('0x58')]){_0x122084['include']=[{'all':!![]}];}_0x122084=_['merge']({},_0x122084,_0x46b091[_0xb9bd('0x50')]);return db[_0xb9bd('0x3e')][_0xb9bd('0x37')](_0x122084)[_0xb9bd('0x2b')](handleEntityNotFound(_0x36a175,null))[_0xb9bd('0x2b')](function(_0x4a0898){if(_0x4a0898){var _0x250586=_0x4a0898['get']({'plain':!![]});_0x250586=qs[_0xb9bd('0x5f')](_0x250586,['id','createdAt',_0xb9bd('0x60')]);_0x46b091[_0xb9bd('0x5a')]=_[_0xb9bd('0x5f')](_0x46b091[_0xb9bd('0x5a')],['id',_0xb9bd('0x61'),_0xb9bd('0x60')]);return db['VoiceQueue'][_0xb9bd('0x59')](_[_0xb9bd('0x4e')](_0x250586,_0x46b091[_0xb9bd('0x5a')]),{'include':_0x46b091[_0xb9bd('0x44')][_0xb9bd('0x58')]?[{'all':!![]}]:undefined})['then'](function(_0x264350){var _0x3247dc=_0x46b091[_0xb9bd('0x5b')][_0xb9bd('0x2d')]({'plain':!![]});if(!_0x3247dc)throw new Error(_0xb9bd('0x62'));if(_0x3247dc[_0xb9bd('0x5c')]==='user'){var _0x4041ec=_0x264350[_0xb9bd('0x2d')]({'plain':!![]});var _0x353730=[{'name':_0xb9bd('0x2e'),'value':'inbound'},{'name':_0xb9bd('0x30'),'value':_0xb9bd('0x31')}];var _0x30f0ba=_[_0xb9bd('0x37')](_0x353730,['value',_0x4041ec[_0xb9bd('0x36')]])[_0xb9bd('0x38')];return db[_0xb9bd('0x63')][_0xb9bd('0x37')]({'where':{'name':_0x30f0ba,'userProfileId':_0x3247dc['userProfileId']},'raw':!![]})['then'](function(_0x65ea07){if(_0x65ea07&&_0x65ea07[_0xb9bd('0x64')]===0x0){return db[_0xb9bd('0x39')][_0xb9bd('0x59')]({'name':_0x4041ec[_0xb9bd('0x38')],'resourceId':_0x4041ec['id'],'type':_0x65ea07['name'],'sectionId':_0x65ea07['id']},{})[_0xb9bd('0x2b')](function(){return _0x264350;});}else{return _0x264350;}})['catch'](function(_0x4025d6){logger[_0xb9bd('0x3a')](_0xb9bd('0x5e'),_0x4025d6);throw _0x4025d6;});}return _0x264350;});}})[_0xb9bd('0x2b')](respondWithResult(_0x36a175,0xc9))[_0xb9bd('0x54')](handleError(_0x36a175,null));};exports['update']=function(_0x4c6d06,_0xec8974){if(_0x4c6d06[_0xb9bd('0x5a')]['id']){delete _0x4c6d06[_0xb9bd('0x5a')]['id'];}return db[_0xb9bd('0x3e')][_0xb9bd('0x37')]({'where':{'id':_0x4c6d06[_0xb9bd('0x56')]['id']}})[_0xb9bd('0x2b')](handleEntityNotFound(_0xec8974,null))[_0xb9bd('0x2b')](saveUpdates(_0x4c6d06[_0xb9bd('0x5a')],null))['then'](respondWithResult(_0xec8974,null))[_0xb9bd('0x54')](handleError(_0xec8974,null));};exports[_0xb9bd('0x2c')]=function(_0x1a2398,_0x498b45){return db[_0xb9bd('0x3e')][_0xb9bd('0x37')]({'where':{'id':_0x1a2398[_0xb9bd('0x56')]['id']}})[_0xb9bd('0x2b')](handleEntityNotFound(_0x498b45,null))[_0xb9bd('0x2b')](removeEntity(_0x498b45,null))[_0xb9bd('0x54')](handleError(_0x498b45,null));};exports['getHoppers']=function(_0x1f9196,_0xf3289a,_0x5a4dad){var _0x4fc4ee={'raw':![],'where':{}};var _0x2d0669={};var _0x4ecb1a={'count':0x0,'rows':[]};return db[_0xb9bd('0x3e')][_0xb9bd('0x65')]({'where':{'id':_0x1f9196[_0xb9bd('0x56')]['id']}})[_0xb9bd('0x2b')](handleEntityNotFound(_0xf3289a,null))['then'](function(_0x32bdb8){if(_0x32bdb8){_0x2d0669[_0xb9bd('0x42')]=_['keys'](db['CmHopper'][_0xb9bd('0x3f')]);_0x2d0669[_0xb9bd('0x44')]=_[_0xb9bd('0x43')](_0x1f9196[_0xb9bd('0x44')]);_0x2d0669[_0xb9bd('0x45')]=_[_0xb9bd('0x46')](_0x2d0669[_0xb9bd('0x42')],_0x2d0669[_0xb9bd('0x44')]);_0x4fc4ee[_0xb9bd('0x47')]=_[_0xb9bd('0x46')](_0x2d0669['model'],qs[_0xb9bd('0x57')](_0x1f9196[_0xb9bd('0x44')][_0xb9bd('0x57')]));_0x4fc4ee[_0xb9bd('0x47')]=_0x4fc4ee['attributes'][_0xb9bd('0x48')]?_0x4fc4ee[_0xb9bd('0x47')]:_0x2d0669[_0xb9bd('0x42')];if(!_0x1f9196[_0xb9bd('0x44')][_0xb9bd('0x66')]('nolimit')){_0x4fc4ee[_0xb9bd('0x23')]=qs[_0xb9bd('0x23')](_0x1f9196['query'][_0xb9bd('0x23')]);_0x4fc4ee[_0xb9bd('0x21')]=qs[_0xb9bd('0x21')](_0x1f9196[_0xb9bd('0x44')]['offset']);}_0x4fc4ee['order']=qs[_0xb9bd('0x4b')](_0x1f9196[_0xb9bd('0x44')][_0xb9bd('0x4b')]);_0x4fc4ee['where']=qs[_0xb9bd('0x45')](_[_0xb9bd('0x4d')](_0x1f9196[_0xb9bd('0x44')],_0x2d0669[_0xb9bd('0x45')]));_0x4fc4ee[_0xb9bd('0x4c')]['VoiceQueueId']=_0x32bdb8['id'];if(_0x1f9196[_0xb9bd('0x44')]['filter']){_0x4fc4ee[_0xb9bd('0x4c')]=_[_0xb9bd('0x4e')](_0x4fc4ee[_0xb9bd('0x4c')],{'$or':_[_0xb9bd('0x33')](_0x4fc4ee[_0xb9bd('0x47')],function(_0x38d985){var _0x596770={};_0x596770[_0x38d985]={'$like':'%'+_0x1f9196[_0xb9bd('0x44')]['filter']+'%'};return _0x596770;})});}_0x4fc4ee=_['merge']({},_0x4fc4ee,_0x1f9196[_0xb9bd('0x50')]);return db['CmHopper'][_0xb9bd('0x24')]({'where':_0x4fc4ee[_0xb9bd('0x4c')]})['then'](function(_0x4b95f3){_0x4ecb1a[_0xb9bd('0x24')]=_0x4b95f3;if(_0x1f9196['query'][_0xb9bd('0x58')]){_0x4fc4ee[_0xb9bd('0x51')]=[{'all':!![]}];}return db[_0xb9bd('0x67')]['findAll'](_0x4fc4ee);})[_0xb9bd('0x2b')](function(_0x2914c7){_0x4ecb1a['rows']=_0x2914c7;return _0x4ecb1a;});}})[_0xb9bd('0x2b')](respondWithFilteredResult(_0xf3289a,_0x4fc4ee))[_0xb9bd('0x54')](handleError(_0xf3289a,null));};exports[_0xb9bd('0x68')]=function(_0x4f0bd4,_0x58834e,_0xc85290){var _0x35a49c={'raw':!![],'where':{}};var _0x47a43c={};var _0x4e6595={'count':0x0,'rows':[]};return db[_0xb9bd('0x3e')][_0xb9bd('0x65')]({'where':{'id':_0x4f0bd4[_0xb9bd('0x56')]['id']}})[_0xb9bd('0x2b')](handleEntityNotFound(_0x58834e,null))[_0xb9bd('0x2b')](function(_0x1f8f0e){if(_0x1f8f0e){_0x47a43c[_0xb9bd('0x42')]=_[_0xb9bd('0x43')](db[_0xb9bd('0x69')]['rawAttributes']);_0x47a43c[_0xb9bd('0x44')]=_[_0xb9bd('0x43')](_0x4f0bd4['query']);_0x47a43c[_0xb9bd('0x45')]=_[_0xb9bd('0x46')](_0x47a43c[_0xb9bd('0x42')],_0x47a43c['query']);_0x35a49c[_0xb9bd('0x47')]=_[_0xb9bd('0x46')](_0x47a43c['model'],qs['fields'](_0x4f0bd4['query'][_0xb9bd('0x57')]));_0x35a49c[_0xb9bd('0x47')]=_0x35a49c[_0xb9bd('0x47')][_0xb9bd('0x48')]?_0x35a49c[_0xb9bd('0x47')]:_0x47a43c[_0xb9bd('0x42')];if(!_0x4f0bd4[_0xb9bd('0x44')][_0xb9bd('0x66')](_0xb9bd('0x49'))){_0x35a49c[_0xb9bd('0x23')]=qs[_0xb9bd('0x23')](_0x4f0bd4[_0xb9bd('0x44')][_0xb9bd('0x23')]);_0x35a49c[_0xb9bd('0x21')]=qs[_0xb9bd('0x21')](_0x4f0bd4[_0xb9bd('0x44')][_0xb9bd('0x21')]);}_0x35a49c[_0xb9bd('0x4a')]=qs[_0xb9bd('0x4b')](_0x4f0bd4[_0xb9bd('0x44')]['sort']);_0x35a49c[_0xb9bd('0x4c')]=qs['filters'](_[_0xb9bd('0x4d')](_0x4f0bd4[_0xb9bd('0x44')],_0x47a43c[_0xb9bd('0x45')]));_0x35a49c[_0xb9bd('0x4c')][_0xb9bd('0x6a')]=_0x1f8f0e['id'];if(_0x4f0bd4[_0xb9bd('0x44')]['filter']){_0x35a49c['where']=_[_0xb9bd('0x4e')](_0x35a49c[_0xb9bd('0x4c')],{'$or':_[_0xb9bd('0x33')](_0x35a49c[_0xb9bd('0x47')],function(_0x3b4a0c){var _0x374f38={};_0x374f38[_0x3b4a0c]={'$like':'%'+_0x4f0bd4[_0xb9bd('0x44')][_0xb9bd('0x4f')]+'%'};return _0x374f38;})});}_0x35a49c=_['merge']({},_0x35a49c,_0x4f0bd4[_0xb9bd('0x50')]);return db['CmHopperHistory'][_0xb9bd('0x24')]({'where':_0x35a49c[_0xb9bd('0x4c')]})[_0xb9bd('0x2b')](function(_0x347180){_0x4e6595[_0xb9bd('0x24')]=_0x347180;if(_0x4f0bd4[_0xb9bd('0x44')][_0xb9bd('0x58')]){_0x35a49c[_0xb9bd('0x51')]=[{'all':!![]}];}return db[_0xb9bd('0x69')][_0xb9bd('0x52')](_0x35a49c);})[_0xb9bd('0x2b')](function(_0x1fe8c7){_0x4e6595[_0xb9bd('0x53')]=_0x1fe8c7;return _0x4e6595;});}})['then'](respondWithFilteredResult(_0x58834e,_0x35a49c))[_0xb9bd('0x54')](handleError(_0x58834e,null));};exports[_0xb9bd('0x6b')]=function(_0x147cd7,_0x31cc6e,_0x3ed6ab){var _0x429575={'raw':!![],'where':{}};var _0x20149d={};var _0x50a5a3={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb9bd('0x65')]({'where':{'id':_0x147cd7[_0xb9bd('0x56')]['id']}})[_0xb9bd('0x2b')](handleEntityNotFound(_0x31cc6e,null))[_0xb9bd('0x2b')](function(_0x350214){if(_0x350214){_0x20149d[_0xb9bd('0x42')]=_['keys'](db[_0xb9bd('0x6c')]['rawAttributes']);_0x20149d[_0xb9bd('0x44')]=_[_0xb9bd('0x43')](_0x147cd7[_0xb9bd('0x44')]);_0x20149d[_0xb9bd('0x45')]=_['intersection'](_0x20149d[_0xb9bd('0x42')],_0x20149d[_0xb9bd('0x44')]);_0x429575[_0xb9bd('0x47')]=_[_0xb9bd('0x46')](_0x20149d[_0xb9bd('0x42')],qs[_0xb9bd('0x57')](_0x147cd7['query'][_0xb9bd('0x57')]));_0x429575['attributes']=_0x429575['attributes'][_0xb9bd('0x48')]?_0x429575[_0xb9bd('0x47')]:_0x20149d[_0xb9bd('0x42')];if(!_0x147cd7['query'][_0xb9bd('0x66')](_0xb9bd('0x49'))){_0x429575[_0xb9bd('0x23')]=qs[_0xb9bd('0x23')](_0x147cd7['query'][_0xb9bd('0x23')]);_0x429575[_0xb9bd('0x21')]=qs[_0xb9bd('0x21')](_0x147cd7[_0xb9bd('0x44')][_0xb9bd('0x21')]);}_0x429575[_0xb9bd('0x4a')]=qs[_0xb9bd('0x4b')](_0x147cd7[_0xb9bd('0x44')][_0xb9bd('0x4b')]);_0x429575[_0xb9bd('0x4c')]=qs[_0xb9bd('0x45')](_[_0xb9bd('0x4d')](_0x147cd7[_0xb9bd('0x44')],_0x20149d[_0xb9bd('0x45')]));_0x429575['where']['VoiceQueueId']=_0x350214['id'];if(_0x147cd7[_0xb9bd('0x44')][_0xb9bd('0x4f')]){_0x429575[_0xb9bd('0x4c')]=_[_0xb9bd('0x4e')](_0x429575[_0xb9bd('0x4c')],{'$or':_[_0xb9bd('0x33')](_0x429575[_0xb9bd('0x47')],function(_0x50677c){var _0x2bf5c5={};_0x2bf5c5[_0x50677c]={'$like':'%'+_0x147cd7[_0xb9bd('0x44')][_0xb9bd('0x4f')]+'%'};return _0x2bf5c5;})});}_0x429575=_[_0xb9bd('0x4e')]({},_0x429575,_0x147cd7[_0xb9bd('0x50')]);return db['CmHopperFinal'][_0xb9bd('0x24')]({'where':_0x429575[_0xb9bd('0x4c')]})[_0xb9bd('0x2b')](function(_0x37e26e){_0x50a5a3[_0xb9bd('0x24')]=_0x37e26e;if(_0x147cd7[_0xb9bd('0x44')]['includeAll']){_0x429575[_0xb9bd('0x51')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb9bd('0x52')](_0x429575);})[_0xb9bd('0x2b')](function(_0x5cd364){_0x50a5a3['rows']=_0x5cd364;return _0x50a5a3;});}})['then'](respondWithFilteredResult(_0x31cc6e,_0x429575))[_0xb9bd('0x54')](handleError(_0x31cc6e,null));};exports['getHopperBlacks']=function(_0x7bdb59,_0x2ce8c8,_0x599cb1){var _0x3bea7f={'raw':!![],'where':{}};var _0x5938d8={};var _0x52d8cf={'count':0x0,'rows':[]};return db[_0xb9bd('0x3e')][_0xb9bd('0x65')]({'where':{'id':_0x7bdb59[_0xb9bd('0x56')]['id']}})[_0xb9bd('0x2b')](handleEntityNotFound(_0x2ce8c8,null))[_0xb9bd('0x2b')](function(_0x3fea13){if(_0x3fea13){_0x5938d8['model']=_[_0xb9bd('0x43')](db[_0xb9bd('0x6d')][_0xb9bd('0x3f')]);_0x5938d8['query']=_[_0xb9bd('0x43')](_0x7bdb59[_0xb9bd('0x44')]);_0x5938d8[_0xb9bd('0x45')]=_['intersection'](_0x5938d8[_0xb9bd('0x42')],_0x5938d8[_0xb9bd('0x44')]);_0x3bea7f[_0xb9bd('0x47')]=_[_0xb9bd('0x46')](_0x5938d8[_0xb9bd('0x42')],qs['fields'](_0x7bdb59['query']['fields']));_0x3bea7f[_0xb9bd('0x47')]=_0x3bea7f['attributes'][_0xb9bd('0x48')]?_0x3bea7f[_0xb9bd('0x47')]:_0x5938d8[_0xb9bd('0x42')];if(!_0x7bdb59['query']['hasOwnProperty']('nolimit')){_0x3bea7f['limit']=qs[_0xb9bd('0x23')](_0x7bdb59[_0xb9bd('0x44')][_0xb9bd('0x23')]);_0x3bea7f[_0xb9bd('0x21')]=qs['offset'](_0x7bdb59[_0xb9bd('0x44')][_0xb9bd('0x21')]);}_0x3bea7f[_0xb9bd('0x4a')]=qs[_0xb9bd('0x4b')](_0x7bdb59['query']['sort']);_0x3bea7f[_0xb9bd('0x4c')]=qs['filters'](_[_0xb9bd('0x4d')](_0x7bdb59['query'],_0x5938d8[_0xb9bd('0x45')]));_0x3bea7f[_0xb9bd('0x4c')]['VoiceQueueId']=_0x3fea13['id'];if(_0x7bdb59[_0xb9bd('0x44')][_0xb9bd('0x4f')]){_0x3bea7f[_0xb9bd('0x4c')]=_['merge'](_0x3bea7f[_0xb9bd('0x4c')],{'$or':_['map'](_0x3bea7f[_0xb9bd('0x47')],function(_0x104f2f){var _0x2fbb9c={};_0x2fbb9c[_0x104f2f]={'$like':'%'+_0x7bdb59[_0xb9bd('0x44')][_0xb9bd('0x4f')]+'%'};return _0x2fbb9c;})});}_0x3bea7f=_[_0xb9bd('0x4e')]({},_0x3bea7f,_0x7bdb59[_0xb9bd('0x50')]);return db[_0xb9bd('0x6d')][_0xb9bd('0x24')]({'where':_0x3bea7f[_0xb9bd('0x4c')]})[_0xb9bd('0x2b')](function(_0x26b30a){_0x52d8cf['count']=_0x26b30a;if(_0x7bdb59['query'][_0xb9bd('0x58')]){_0x3bea7f['include']=[{'all':!![]}];}return db[_0xb9bd('0x6d')][_0xb9bd('0x52')](_0x3bea7f);})['then'](function(_0x1968b0){_0x52d8cf[_0xb9bd('0x53')]=_0x1968b0;return _0x52d8cf;});}})['then'](respondWithFilteredResult(_0x2ce8c8,_0x3bea7f))['catch'](handleError(_0x2ce8c8,null));};exports[_0xb9bd('0x6e')]=function(_0x2fc7ff,_0x412282,_0x118ae6){var _0x2ce86a={};var _0x3a48ff={};var _0x460a27;var _0x5af5c5;return db[_0xb9bd('0x3e')][_0xb9bd('0x65')]({'where':{'id':_0x2fc7ff[_0xb9bd('0x56')]['id']}})[_0xb9bd('0x2b')](handleEntityNotFound(_0x412282,null))[_0xb9bd('0x2b')](function(_0x307436){if(_0x307436){_0x460a27=_0x307436;_0x3a48ff[_0xb9bd('0x42')]=_['keys'](db[_0xb9bd('0x6f')][_0xb9bd('0x3f')]);_0x3a48ff[_0xb9bd('0x44')]=_[_0xb9bd('0x43')](_0x2fc7ff[_0xb9bd('0x44')]);_0x3a48ff['filters']=_['intersection'](_0x3a48ff[_0xb9bd('0x42')],_0x3a48ff[_0xb9bd('0x44')]);_0x2ce86a[_0xb9bd('0x47')]=_[_0xb9bd('0x46')](_0x3a48ff['model'],qs[_0xb9bd('0x57')](_0x2fc7ff['query'][_0xb9bd('0x57')]));_0x2ce86a[_0xb9bd('0x47')]=_0x2ce86a[_0xb9bd('0x47')]['length']?_0x2ce86a[_0xb9bd('0x47')]:_0x3a48ff['model'];_0x2ce86a['order']=qs[_0xb9bd('0x4b')](_0x2fc7ff[_0xb9bd('0x44')][_0xb9bd('0x4b')]);_0x2ce86a['where']=qs[_0xb9bd('0x45')](_[_0xb9bd('0x4d')](_0x2fc7ff[_0xb9bd('0x44')],_0x3a48ff[_0xb9bd('0x45')]));if(_0x2fc7ff[_0xb9bd('0x44')][_0xb9bd('0x4f')]){_0x2ce86a[_0xb9bd('0x4c')]=_[_0xb9bd('0x4e')](_0x2ce86a['where'],{'$or':_[_0xb9bd('0x33')](_0x2ce86a[_0xb9bd('0x47')],function(_0x574ec7){var _0x10681d={};_0x10681d[_0x574ec7]={'$like':'%'+_0x2fc7ff['query'][_0xb9bd('0x4f')]+'%'};return _0x10681d;})});}_0x2ce86a=_[_0xb9bd('0x4e')]({},_0x2ce86a,_0x2fc7ff[_0xb9bd('0x50')]);return _0x460a27[_0xb9bd('0x6e')](_0x2ce86a);}})[_0xb9bd('0x2b')](function(_0x2dbbd0){if(_0x2dbbd0){_0x5af5c5=_0x2dbbd0['length'];if(!_0x2fc7ff['query'][_0xb9bd('0x66')](_0xb9bd('0x49'))){_0x2ce86a[_0xb9bd('0x23')]=qs['limit'](_0x2fc7ff[_0xb9bd('0x44')][_0xb9bd('0x23')]);_0x2ce86a[_0xb9bd('0x21')]=qs[_0xb9bd('0x21')](_0x2fc7ff['query']['offset']);}return _0x460a27[_0xb9bd('0x6e')](_0x2ce86a);}})[_0xb9bd('0x2b')](function(_0xef06d0){if(_0xef06d0){return _0xef06d0?{'count':_0x5af5c5,'rows':_0xef06d0}:null;}})[_0xb9bd('0x2b')](respondWithResult(_0x412282,null))[_0xb9bd('0x54')](handleError(_0x412282,null));};exports['addTeams']=function(_0x194141,_0x289b76,_0x174e4e){var _0x49be7f=_0x194141[_0xb9bd('0x5a')]['teams'];var _0x1f3125=_[_0xb9bd('0x33')](_0x49be7f,'id');return db[_0xb9bd('0x6f')][_0xb9bd('0x52')]({'where':{'id':_0x1f3125},'attributes':['id'],'include':[{'model':db[_0xb9bd('0x70')],'as':'Agents','attributes':['id',_0xb9bd('0x38'),_0xb9bd('0x71'),_0xb9bd('0x72'),'interface'],'raw':!![]}]})[_0xb9bd('0x2b')](function(_0x10ee50){if(_0x10ee50){var _0x4d70e1=_[_0xb9bd('0x73')](_0x10ee50,function(_0x2e5633){var _0x23aaa3=_0x2e5633['get']({'plain':!![]});_0x23aaa3[_0xb9bd('0x74')][_0xb9bd('0x75')](function(_0x41089d){_0x41089d[_0xb9bd('0x76')]=_[_0xb9bd('0x37')](_0x49be7f,{'id':_0x23aaa3['id']})[_0xb9bd('0x76')];});return _0x23aaa3['Agents'];});return db[_0xb9bd('0x3e')][_0xb9bd('0x37')]({'where':{'id':_0x194141[_0xb9bd('0x56')]['id']}})[_0xb9bd('0x2b')](function(_0x57cd1b){return db[_0xb9bd('0x77')][_0xb9bd('0x78')](function(_0x5f1ecc){return _0x57cd1b[_0xb9bd('0x79')](_0x1f3125,{'transaction':_0x5f1ecc})[_0xb9bd('0x2b')](function(){return BPromise['each'](_0x49be7f,function(_0x4fde8a){return db[_0xb9bd('0x7a')][_0xb9bd('0x7b')]({'TeamId':_0x4fde8a['id'],'VoiceQueueId':_0x194141[_0xb9bd('0x56')]['id'],'penalty':_0x4fde8a[_0xb9bd('0x76')]},{'transaction':_0x5f1ecc});});})[_0xb9bd('0x2b')](function(){return BPromise['each'](_0x4d70e1,function(_0x770a16){return db[_0xb9bd('0x7c')]['findOrCreate']({'where':{'UserId':_0x770a16['id'],'VoiceQueueId':_0x194141[_0xb9bd('0x56')]['id']},'defaults':{'penalty':_0x770a16[_0xb9bd('0x76')]},'transaction':_0x5f1ecc});});})['then'](function(){return BPromise[_0xb9bd('0x7d')](_[_0xb9bd('0x4f')](_0x4d70e1,{'online':!![]}),function(_0x4d43fb){return db[_0xb9bd('0x7e')][_0xb9bd('0x7b')]({'membername':_0x4d43fb[_0xb9bd('0x38')],'UserId':_0x4d43fb['id'],'queue_name':_0x57cd1b[_0xb9bd('0x38')],'VoiceQueueId':_0x57cd1b['id'],'interface':_[_0xb9bd('0x7f')](_0x4d43fb[_0xb9bd('0x80')])?util[_0xb9bd('0x81')](_0xb9bd('0x82'),_0x4d43fb[_0xb9bd('0x38')]):_0x4d43fb['interface'],'paused':_0x4d43fb[_0xb9bd('0x72')]||![],'penalty':_0x4d43fb['penalty']},{'transaction':_0x5f1ecc});});})['then'](function(){_0x4d70e1[_0xb9bd('0x75')](function(_0x10d6c2){socket[_0xb9bd('0x83')]('userVoiceQueue:save',{'UserId':_0x10d6c2['id'],'VoiceQueueId':_0x57cd1b['id']});});});});});}})['then'](respondWithStatusCode(_0x289b76,null))[_0xb9bd('0x54')](handleError(_0x289b76,null));};exports[_0xb9bd('0x84')]=function(_0x46032b,_0x3f7166,_0x2c409a){return db[_0xb9bd('0x6f')][_0xb9bd('0x52')]({'where':{'id':_0x46032b['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb9bd('0x74'),'attributes':['id'],'raw':!![]}]})[_0xb9bd('0x2b')](handleEntityNotFound(_0x3f7166,null))[_0xb9bd('0x2b')](function(_0x4cfd71){var _0x1069f6=_[_0xb9bd('0x33')](_0x4cfd71,'id');var _0x4989ef=[];var _0x1e4d01=[];var _0x30ac3f=squel[_0xb9bd('0x85')]();_0x30ac3f['field']('tq.TeamId')[_0xb9bd('0x86')](_0xb9bd('0x87'),'tq')[_0xb9bd('0x88')]('user_has_teams','ut',_0xb9bd('0x89'))[_0xb9bd('0x4c')]('VoiceQueueId\x20=\x20?',_0x46032b[_0xb9bd('0x56')]['id']);for(var _0x88c6f5=0x0;_0x88c6f5<_0x4cfd71['length'];_0x88c6f5+=0x1){let _0x25b29b=_0x4cfd71[_0x88c6f5];for(var _0x230471=0x0;_0x230471<_0x25b29b[_0xb9bd('0x74')][_0xb9bd('0x48')];_0x230471+=0x1){let _0x1f5c74=_0x25b29b[_0xb9bd('0x74')][_0x230471];var _0xfc0ce7=_0x30ac3f[_0xb9bd('0x8a')]();_0xfc0ce7[_0xb9bd('0x4c')](_0xb9bd('0x8b'),_0x1f5c74['id']);_0x1e4d01[_0xb9bd('0x8c')](db[_0xb9bd('0x77')]['query'](_0xfc0ce7['toString'](),{'type':db[_0xb9bd('0x77')][_0xb9bd('0x8d')][_0xb9bd('0x8e')]})[_0xb9bd('0x2b')](function(_0x4cc472){if(_0x4cc472[_0xb9bd('0x48')]===0x1){return _0x1f5c74['id'];}else{var _0x2f0138=_[_0xb9bd('0x8f')](_[_0xb9bd('0x33')](_0x4cc472,_0xb9bd('0x90')),function(_0x66226b){return _[_0xb9bd('0x35')](_0x1069f6,_0x66226b);});if(_0x2f0138){return _0x1f5c74['id'];}}}));}}return BPromise['all'](_0x1e4d01)['then'](function(_0x25a91d){_0x4989ef=_(_0x4989ef)[_0xb9bd('0x91')](_0x25a91d)[_0xb9bd('0x92')]()[_0xb9bd('0x34')]();return db['VoiceQueue'][_0xb9bd('0x37')]({'where':{'id':_0x46032b['params']['id']}})[_0xb9bd('0x2b')](function(_0x32954a){return db[_0xb9bd('0x77')][_0xb9bd('0x78')](function(_0x3da944){return _0x32954a['removeTeams'](_0x46032b[_0xb9bd('0x44')][_0xb9bd('0x93')],{'transaction':_0x3da944})[_0xb9bd('0x2b')](function(){if(!_[_0xb9bd('0x94')](_0x4989ef)){return _0x32954a[_0xb9bd('0x95')](_0x4989ef,{'transaction':_0x3da944})[_0xb9bd('0x2b')](function(){return db[_0xb9bd('0x7e')][_0xb9bd('0x2c')]({'where':{'VoiceQueueId':_0x46032b[_0xb9bd('0x56')]['id'],'UserId':_0x4989ef},'transaction':_0x3da944});});}})['then'](function(){_0x4989ef[_0xb9bd('0x75')](function(_0x279766){socket['emit'](_0xb9bd('0x96'),{'UserId':_0x279766,'VoiceQueueId':_0x32954a['id']});});});});});});})[_0xb9bd('0x2b')](respondWithStatusCode(_0x3f7166,null))[_0xb9bd('0x54')](handleError(_0x3f7166,null));};exports['addAgents']=function(_0x53b7da,_0x153e5b,_0x3429a2){var _0x449649,_0x39a73f;return db[_0xb9bd('0x3e')][_0xb9bd('0x37')]({'where':{'id':_0x53b7da[_0xb9bd('0x56')]['id']}})['then'](handleEntityNotFound(_0x153e5b,null))['then'](function(_0x124c27){if(_0x124c27){_0x39a73f=_0x124c27;return _0x124c27[_0xb9bd('0x97')](_0x53b7da['body'][_0xb9bd('0x93')],_[_0xb9bd('0x5f')](_0x53b7da[_0xb9bd('0x5a')],[_0xb9bd('0x93'),'id'])||{})['spread'](function(_0x295a56){for(var _0x11b90f=0x0;_0x11b90f<_0x53b7da[_0xb9bd('0x5a')]['ids'][_0xb9bd('0x48')];_0x11b90f+=0x1){socket['emit'](_0xb9bd('0x98'),{'UserId':Number(_0x53b7da[_0xb9bd('0x5a')][_0xb9bd('0x93')][_0x11b90f]),'VoiceQueueId':Number(_0x53b7da['params']['id'])});}return _0x295a56;});}})['then'](function(_0x344c46){_0x449649=_0x344c46||[];if(_0x39a73f){return db[_0xb9bd('0x70')][_0xb9bd('0x52')]({'where':{'id':_0x53b7da[_0xb9bd('0x5a')][_0xb9bd('0x93')]},'attributes':['id',_0xb9bd('0x38'),_0xb9bd('0x71'),_0xb9bd('0x72'),_0xb9bd('0x80')],'raw':!![]});}})['then'](function(_0x557c3e){if(!_[_0xb9bd('0x94')](_0x557c3e)){var _0x111907=[];for(var _0x58373b=0x0;_0x58373b<_0x557c3e[_0xb9bd('0x48')];_0x58373b++){if(_0x557c3e[_0x58373b]['online']){_0x111907[_0xb9bd('0x8c')](db['UserVoiceQueueRt']['upsert']({'membername':_0x557c3e[_0x58373b][_0xb9bd('0x38')],'UserId':_0x557c3e[_0x58373b]['id'],'queue_name':_0x39a73f[_0xb9bd('0x38')],'VoiceQueueId':_0x39a73f['id'],'interface':_['isNil'](_0x557c3e[_0x58373b][_0xb9bd('0x80')])?util['format'](_0xb9bd('0x82'),_0x557c3e[_0x58373b][_0xb9bd('0x38')]):_0x557c3e[_0x58373b][_0xb9bd('0x80')],'paused':_0x557c3e[_0x58373b][_0xb9bd('0x72')]||![],'penalty':_0x53b7da[_0xb9bd('0x5a')][_0xb9bd('0x76')]||0x0}));}}return BPromise[_0xb9bd('0x99')](_0x111907);}})[_0xb9bd('0x2b')](function(){return _0x449649;})[_0xb9bd('0x2b')](respondWithResult(_0x153e5b,null))['catch'](handleError(_0x153e5b,null));};exports[_0xb9bd('0x95')]=function(_0x4e1c6c,_0x49315a,_0x37be79){return db[_0xb9bd('0x3e')][_0xb9bd('0x37')]({'where':{'id':_0x4e1c6c['params']['id']}})[_0xb9bd('0x2b')](handleEntityNotFound(_0x49315a,null))[_0xb9bd('0x2b')](function(_0x41e1c1){if(_0x41e1c1){return _0x41e1c1['removeAgents'](_0x4e1c6c[_0xb9bd('0x44')][_0xb9bd('0x93')])[_0xb9bd('0x2b')](function(){if(_[_0xb9bd('0x9a')](_0x4e1c6c[_0xb9bd('0x44')]['ids'])){for(var _0x42eed0=0x0;_0x42eed0<_0x4e1c6c[_0xb9bd('0x44')][_0xb9bd('0x93')][_0xb9bd('0x48')];_0x42eed0+=0x1){socket[_0xb9bd('0x83')]('userVoiceQueue:remove',{'UserId':Number(_0x4e1c6c[_0xb9bd('0x44')]['ids'][_0x42eed0]),'VoiceQueueId':Number(_0x4e1c6c[_0xb9bd('0x56')]['id'])});}}else{socket[_0xb9bd('0x83')](_0xb9bd('0x96'),{'UserId':Number(_0x4e1c6c['query'][_0xb9bd('0x93')]),'VoiceQueueId':Number(_0x4e1c6c[_0xb9bd('0x56')]['id'])});}});}})['then'](function(_0x5e23ec){return db[_0xb9bd('0x7e')][_0xb9bd('0x2c')]({'where':{'VoiceQueueId':_0x4e1c6c[_0xb9bd('0x56')]['id'],'UserId':_0x4e1c6c['query'][_0xb9bd('0x93')]}})[_0xb9bd('0x2b')](function(){return _0x5e23ec;});})[_0xb9bd('0x2b')](respondWithStatusCode(_0x49315a,null))['catch'](handleError(_0x49315a,null));};exports[_0xb9bd('0x9b')]=function(_0x35b930,_0x185197,_0x2c7917){var _0xce7044={};var _0x1add01={};var _0x40c058;var _0x5bd847;return db['VoiceQueue'][_0xb9bd('0x65')]({'where':{'id':_0x35b930['params']['id']}})['then'](handleEntityNotFound(_0x185197,null))[_0xb9bd('0x2b')](function(_0x59de46){if(_0x59de46){_0x40c058=_0x59de46;_0x1add01[_0xb9bd('0x42')]=_[_0xb9bd('0x43')](db[_0xb9bd('0x70')][_0xb9bd('0x3f')]);_0x1add01[_0xb9bd('0x44')]=_[_0xb9bd('0x43')](_0x35b930[_0xb9bd('0x44')]);_0x1add01[_0xb9bd('0x45')]=_[_0xb9bd('0x46')](_0x1add01[_0xb9bd('0x42')],_0x1add01['query']);_0xce7044[_0xb9bd('0x47')]=_['intersection'](_0x1add01['model'],qs[_0xb9bd('0x57')](_0x35b930[_0xb9bd('0x44')][_0xb9bd('0x57')]));_0xce7044[_0xb9bd('0x47')]=_0xce7044[_0xb9bd('0x47')][_0xb9bd('0x48')]?_0xce7044[_0xb9bd('0x47')]:_0x1add01['model'];_0xce7044['order']=qs[_0xb9bd('0x4b')](_0x35b930[_0xb9bd('0x44')][_0xb9bd('0x4b')]);_0xce7044[_0xb9bd('0x4c')]=qs[_0xb9bd('0x45')](_[_0xb9bd('0x4d')](_0x35b930[_0xb9bd('0x44')],_0x1add01[_0xb9bd('0x45')]));if(_0x35b930[_0xb9bd('0x44')]['filter']){_0xce7044['where']=_[_0xb9bd('0x4e')](_0xce7044[_0xb9bd('0x4c')],{'$or':_[_0xb9bd('0x33')](_0xce7044[_0xb9bd('0x47')],function(_0x5bc02b){var _0x18ede2={};_0x18ede2[_0x5bc02b]={'$like':'%'+_0x35b930[_0xb9bd('0x44')]['filter']+'%'};return _0x18ede2;})});}_0xce7044=_[_0xb9bd('0x4e')]({},_0xce7044,_0x35b930[_0xb9bd('0x50')]);return _0x40c058[_0xb9bd('0x9b')](_0xce7044);}})[_0xb9bd('0x2b')](function(_0x34d0ed){if(_0x34d0ed){_0x5bd847=_0x34d0ed[_0xb9bd('0x48')];if(!_0x35b930[_0xb9bd('0x44')][_0xb9bd('0x66')](_0xb9bd('0x49'))){_0xce7044[_0xb9bd('0x23')]=qs['limit'](_0x35b930['query'][_0xb9bd('0x23')]);_0xce7044['offset']=qs[_0xb9bd('0x21')](_0x35b930['query']['offset']);}return _0x40c058['getAgents'](_0xce7044);}})[_0xb9bd('0x2b')](function(_0x40b2f7){if(_0x40b2f7){return _0x40b2f7?{'count':_0x5bd847,'rows':_0x40b2f7}:null;}})[_0xb9bd('0x2b')](respondWithResult(_0x185197,null))['catch'](handleError(_0x185197,null));};exports[_0xb9bd('0x9c')]=function(_0x4365e1,_0x4bd9ac,_0x23cb5a){var _0x10e08f={};var _0x3eb29a={};var _0x21b3b3;var _0x515179;return db[_0xb9bd('0x3e')][_0xb9bd('0x65')]({'where':{'id':_0x4365e1[_0xb9bd('0x56')]['id']}})['then'](handleEntityNotFound(_0x4bd9ac,null))[_0xb9bd('0x2b')](function(_0x436b2b){if(_0x436b2b){_0x21b3b3=_0x436b2b;_0x3eb29a['model']=_[_0xb9bd('0x43')](db[_0xb9bd('0x7e')]['rawAttributes']);_0x3eb29a[_0xb9bd('0x44')]=_[_0xb9bd('0x43')](_0x4365e1[_0xb9bd('0x44')]);_0x3eb29a['filters']=_['intersection'](_0x3eb29a['model'],_0x3eb29a[_0xb9bd('0x44')]);_0x10e08f[_0xb9bd('0x47')]=_[_0xb9bd('0x46')](_0x3eb29a[_0xb9bd('0x42')],qs[_0xb9bd('0x57')](_0x4365e1[_0xb9bd('0x44')][_0xb9bd('0x57')]));_0x10e08f['attributes']=_0x10e08f['attributes'][_0xb9bd('0x48')]?_0x10e08f[_0xb9bd('0x47')]:_0x3eb29a[_0xb9bd('0x42')];_0x10e08f[_0xb9bd('0x4a')]=qs['sort'](_0x4365e1[_0xb9bd('0x44')]['sort']);_0x10e08f[_0xb9bd('0x4c')]=qs[_0xb9bd('0x45')](_['pick'](_0x4365e1[_0xb9bd('0x44')],_0x3eb29a[_0xb9bd('0x45')]));if(_0x4365e1['query'][_0xb9bd('0x4f')]){_0x10e08f[_0xb9bd('0x4c')]=_[_0xb9bd('0x4e')](_0x10e08f[_0xb9bd('0x4c')],{'$or':_['map'](_0x10e08f[_0xb9bd('0x47')],function(_0x32b540){var _0x4b7f8a={};_0x4b7f8a[_0x32b540]={'$like':'%'+_0x4365e1[_0xb9bd('0x44')]['filter']+'%'};return _0x4b7f8a;})});}_0x10e08f=_[_0xb9bd('0x4e')]({},_0x10e08f,_0x4365e1[_0xb9bd('0x50')]);return _0x21b3b3['getMembers'](_0x10e08f);}})['then'](function(_0x5e61f2){if(_0x5e61f2){_0x515179=_0x5e61f2[_0xb9bd('0x48')];if(!_0x4365e1[_0xb9bd('0x44')][_0xb9bd('0x66')](_0xb9bd('0x49'))){_0x10e08f['limit']=qs[_0xb9bd('0x23')](_0x4365e1['query'][_0xb9bd('0x23')]);_0x10e08f[_0xb9bd('0x21')]=qs[_0xb9bd('0x21')](_0x4365e1[_0xb9bd('0x44')][_0xb9bd('0x21')]);}return _0x21b3b3['getMembers'](_0x10e08f);}})[_0xb9bd('0x2b')](function(_0x280acc){return _0x280acc?{'count':_0x515179,'rows':_0x280acc}:null;})[_0xb9bd('0x2b')](respondWithResult(_0x4bd9ac,null))[_0xb9bd('0x54')](handleError(_0x4bd9ac,null));};exports[_0xb9bd('0x9d')]=function(_0x335983,_0xa2cb31,_0x1ab0a5){var _0x1cfa8b={};var _0x3228a8={};var _0x8e52f1;var _0x38bc8f;return db[_0xb9bd('0x3e')][_0xb9bd('0x65')]({'where':{'id':_0x335983[_0xb9bd('0x56')]['id']}})[_0xb9bd('0x2b')](handleEntityNotFound(_0xa2cb31,null))['then'](function(_0x33d958){if(_0x33d958){_0x8e52f1=_0x33d958;_0x3228a8[_0xb9bd('0x42')]=_[_0xb9bd('0x43')](db[_0xb9bd('0x9e')][_0xb9bd('0x3f')]);_0x3228a8['query']=_['keys'](_0x335983[_0xb9bd('0x44')]);_0x3228a8[_0xb9bd('0x45')]=_[_0xb9bd('0x46')](_0x3228a8[_0xb9bd('0x42')],_0x3228a8[_0xb9bd('0x44')]);_0x1cfa8b[_0xb9bd('0x47')]=_[_0xb9bd('0x46')](_0x3228a8[_0xb9bd('0x42')],qs[_0xb9bd('0x57')](_0x335983[_0xb9bd('0x44')][_0xb9bd('0x57')]));_0x1cfa8b[_0xb9bd('0x47')]=_0x1cfa8b[_0xb9bd('0x47')][_0xb9bd('0x48')]?_0x1cfa8b[_0xb9bd('0x47')]:_0x3228a8[_0xb9bd('0x42')];_0x1cfa8b[_0xb9bd('0x4a')]=qs[_0xb9bd('0x4b')](_0x335983[_0xb9bd('0x44')][_0xb9bd('0x4b')]);_0x1cfa8b['where']=qs['filters'](_[_0xb9bd('0x4d')](_0x335983['query'],_0x3228a8[_0xb9bd('0x45')]));if(_0x335983['query'][_0xb9bd('0x4f')]){_0x1cfa8b[_0xb9bd('0x4c')]=_[_0xb9bd('0x4e')](_0x1cfa8b[_0xb9bd('0x4c')],{'$or':_[_0xb9bd('0x33')](_0x1cfa8b[_0xb9bd('0x47')],function(_0x2a96d4){var _0x14ac33={};_0x14ac33[_0x2a96d4]={'$like':'%'+_0x335983[_0xb9bd('0x44')][_0xb9bd('0x4f')]+'%'};return _0x14ac33;})});}_0x1cfa8b=_[_0xb9bd('0x4e')]({},_0x1cfa8b,_0x335983['options']);return _0x8e52f1['getLists'](_0x1cfa8b);}})[_0xb9bd('0x2b')](function(_0x2af9a8){if(_0x2af9a8){_0x38bc8f=_0x2af9a8[_0xb9bd('0x48')];if(!_0x335983[_0xb9bd('0x44')]['hasOwnProperty'](_0xb9bd('0x49'))){_0x1cfa8b['limit']=qs['limit'](_0x335983['query'][_0xb9bd('0x23')]);_0x1cfa8b['offset']=qs[_0xb9bd('0x21')](_0x335983[_0xb9bd('0x44')]['offset']);}return _0x8e52f1['getLists'](_0x1cfa8b);}})['then'](function(_0xcb4791){if(_0xcb4791){return _0xcb4791?{'count':_0x38bc8f,'rows':_0xcb4791}:null;}})['then'](respondWithResult(_0xa2cb31,null))[_0xb9bd('0x54')](handleError(_0xa2cb31,null));};exports[_0xb9bd('0x9f')]=function(_0x4a5049,_0x5de762,_0x13a8be){var _0x353971=moment()[_0xb9bd('0x81')](_0xb9bd('0xa0'));var _0x46bddc,_0x554265;return db[_0xb9bd('0x3e')][_0xb9bd('0x37')]({'where':{'id':_0x4a5049['params']['id']}})[_0xb9bd('0x2b')](handleEntityNotFound(_0x5de762,null))[_0xb9bd('0x2b')](function(_0x7b770){if(_0x7b770){_0x554265=_0x7b770;return _0x7b770['addLists'](_0x4a5049['body'][_0xb9bd('0x93')],_[_0xb9bd('0x5f')](_0x4a5049[_0xb9bd('0x5a')],[_0xb9bd('0x93'),'id'])||{});}return null;})[_0xb9bd('0xa1')](function(_0x5d84c2){var _0x11e71c;_0x46bddc=_0x5d84c2||[];var _0x433016=[];if(_0x5d84c2){for(var _0x295810=0x0;_0x295810<_0x5d84c2[_0xb9bd('0x48')];_0x295810+=0x1){var _0x29f652=_0x5d84c2[_0x295810][_0xb9bd('0x2d')]({'plain':!![]});_0x554265['dialCheckDuplicateType']=_0x4a5049[_0xb9bd('0x5a')][_0xb9bd('0xa2')]?_0x4a5049[_0xb9bd('0x5a')][_0xb9bd('0xa2')]:_0x554265[_0xb9bd('0xa2')];switch(_0x554265[_0xb9bd('0xa2')]){case'always':_0x11e71c=squel['insert']()['into'](_0xb9bd('0xa3'))[_0xb9bd('0xa4')]([_0xb9bd('0xa5'),_0xb9bd('0xa6'),'ContactId','ListId',_0xb9bd('0x6a'),_0xb9bd('0x61'),_0xb9bd('0x60')],squel[_0xb9bd('0x85')]()[_0xb9bd('0xa7')](_0xb9bd('0xa5'),_0xb9bd('0xa5'))[_0xb9bd('0xa7')]('\x27'+_0x353971+'\x27',_0xb9bd('0xa6'))[_0xb9bd('0xa7')]('id',_0xb9bd('0xa8'))[_0xb9bd('0xa7')](_0x29f652['CmListId'][_0xb9bd('0xa9')](),_0xb9bd('0xaa'))[_0xb9bd('0xa7')](_0x4a5049[_0xb9bd('0x56')]['id'][_0xb9bd('0xa9')](),'VoiceQueueId')[_0xb9bd('0xa7')]('\x27'+_0x353971+'\x27',_0xb9bd('0x61'))[_0xb9bd('0xa7')]('\x27'+_0x353971+'\x27','updatedAt')[_0xb9bd('0x86')]('cm_contacts')[_0xb9bd('0x4c')](_0xb9bd('0xab'))['where'](_0xb9bd('0xac'),_0x29f652[_0xb9bd('0xad')]['toString']())[_0xb9bd('0x4c')](_0xb9bd('0xae'))['where'](_0xb9bd('0xaf'),squel[_0xb9bd('0x85')]()[_0xb9bd('0xa7')](_0xb9bd('0xb0'))[_0xb9bd('0x86')](_0xb9bd('0xb1'))[_0xb9bd('0x4c')](_0xb9bd('0xb2'),_0x4a5049['params']['id'][_0xb9bd('0xa9')]()))[_0xb9bd('0x4c')](_0xb9bd('0xaf'),squel[_0xb9bd('0x85')]()[_0xb9bd('0xa7')](_0xb9bd('0xb3'))[_0xb9bd('0x86')]('cm_hopper')[_0xb9bd('0x4c')]('VoiceQueueId\x20=\x20?',_0x4a5049['params']['id'][_0xb9bd('0xa9')]())))[_0xb9bd('0xa9')]();break;case _0xb9bd('0xb4'):_0x11e71c=squel['insert']()[_0xb9bd('0xb5')]('cm_hopper')[_0xb9bd('0xa4')]([_0xb9bd('0xa5'),'scheduledAt','ContactId',_0xb9bd('0xaa'),_0xb9bd('0x6a'),_0xb9bd('0x61'),_0xb9bd('0x60')],squel['select']()[_0xb9bd('0xa7')]('phone',_0xb9bd('0xa5'))['field']('\x27'+_0x353971+'\x27','scheduledAt')[_0xb9bd('0xa7')]('id','ContactId')[_0xb9bd('0xa7')](_0x29f652[_0xb9bd('0xad')][_0xb9bd('0xa9')](),_0xb9bd('0xaa'))[_0xb9bd('0xa7')](_0x4a5049[_0xb9bd('0x56')]['id'][_0xb9bd('0xa9')](),_0xb9bd('0x6a'))[_0xb9bd('0xa7')]('\x27'+_0x353971+'\x27',_0xb9bd('0x61'))[_0xb9bd('0xa7')]('\x27'+_0x353971+'\x27',_0xb9bd('0x60'))[_0xb9bd('0x86')](_0xb9bd('0xb6'))[_0xb9bd('0x4c')](_0xb9bd('0xab'))['where']('ListId\x20=\x20?',_0x29f652['CmListId'][_0xb9bd('0xa9')]())[_0xb9bd('0x4c')]('phone\x20IS\x20NOT\x20NULL')[_0xb9bd('0x4c')](_0xb9bd('0xaf'),squel[_0xb9bd('0x85')]()[_0xb9bd('0xa7')]('COALESCE(phone,\x27\x27)')[_0xb9bd('0x86')](_0xb9bd('0xa3'))[_0xb9bd('0x4c')](_0xb9bd('0xb2'),_0x4a5049['params']['id'][_0xb9bd('0xa9')]())))[_0xb9bd('0xa9')]();break;default:_0x11e71c=squel[_0xb9bd('0xb7')]()[_0xb9bd('0xb5')]('cm_hopper')[_0xb9bd('0xa4')]([_0xb9bd('0xa5'),'scheduledAt',_0xb9bd('0xa8'),'ListId',_0xb9bd('0x6a'),_0xb9bd('0x61'),'updatedAt'],squel[_0xb9bd('0x85')]()[_0xb9bd('0xa7')]('phone',_0xb9bd('0xa5'))[_0xb9bd('0xa7')]('\x27'+_0x353971+'\x27',_0xb9bd('0xa6'))[_0xb9bd('0xa7')]('id',_0xb9bd('0xa8'))[_0xb9bd('0xa7')](_0x29f652[_0xb9bd('0xad')]['toString'](),_0xb9bd('0xaa'))[_0xb9bd('0xa7')](_0x4a5049[_0xb9bd('0x56')]['id'][_0xb9bd('0xa9')](),_0xb9bd('0x6a'))['field']('\x27'+_0x353971+'\x27',_0xb9bd('0x61'))[_0xb9bd('0xa7')]('\x27'+_0x353971+'\x27',_0xb9bd('0x60'))[_0xb9bd('0x86')](_0xb9bd('0xb6'))[_0xb9bd('0x4c')](_0xb9bd('0xab'))[_0xb9bd('0x4c')]('ListId\x20=\x20?',_0x29f652['CmListId'][_0xb9bd('0xa9')]())[_0xb9bd('0x4c')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x433016[_0xb9bd('0x8c')](db['sequelize'][_0xb9bd('0x44')](_0x11e71c));}return BPromise[_0xb9bd('0x99')](_0x433016);}})[_0xb9bd('0x2b')](function(){var _0x56b903=[];var _0x21e9e2=squel[_0xb9bd('0xb7')]()['into']('cm_hopper_additional_phones')[_0xb9bd('0xa4')]([_0xb9bd('0xb8'),'phone','OrderBy',_0xb9bd('0x61'),'updatedAt'],squel[_0xb9bd('0x85')]()[_0xb9bd('0xa7')](_0xb9bd('0xb9'))[_0xb9bd('0xa7')](_0xb9bd('0xba'))[_0xb9bd('0xa7')]('ci.OrderBy+1')['field']('\x27'+_0x353971+'\x27','createdAt')[_0xb9bd('0xa7')]('\x27'+_0x353971+'\x27',_0xb9bd('0x60'))[_0xb9bd('0x86')](_0xb9bd('0xbb'),'ci')['join'](_0xb9bd('0xa3'),'h',_0xb9bd('0xbc'))[_0xb9bd('0x4c')](_0xb9bd('0xbd'),_0x353971)[_0xb9bd('0x4c')](_0xb9bd('0xbe'),_0xb9bd('0xbf')))[_0xb9bd('0xa9')]();_0x56b903[_0xb9bd('0x8c')](db[_0xb9bd('0x77')][_0xb9bd('0x44')](_0x21e9e2));return BPromise[_0xb9bd('0x99')](_0x56b903);})['then'](function(){return _0x46bddc;})[_0xb9bd('0x2b')](respondWithResult(_0x5de762,null))[_0xb9bd('0x54')](handleError(_0x5de762,null));};exports['removeLists']=function(_0x4f9cfe,_0x2f6d4a,_0x1b2098){return db[_0xb9bd('0x3e')][_0xb9bd('0x37')]({'where':{'id':_0x4f9cfe[_0xb9bd('0x56')]['id']}})['then'](handleEntityNotFound(_0x2f6d4a,null))['then'](function(_0xa79ad2){if(_0xa79ad2){return _0xa79ad2[_0xb9bd('0xc0')](_0x4f9cfe[_0xb9bd('0x44')]['ids']);}})['then'](function(_0x5f1acb){if(_0x5f1acb){return db[_0xb9bd('0x67')][_0xb9bd('0x2c')]({'where':{'ListId':_0x4f9cfe[_0xb9bd('0x44')][_0xb9bd('0x93')],'VoiceQueueId':_0x4f9cfe[_0xb9bd('0x56')]['id']}})[_0xb9bd('0x2b')](function(){return _0x5f1acb;});}})[_0xb9bd('0x2b')](respondWithStatusCode(_0x2f6d4a,null))[_0xb9bd('0x54')](handleError(_0x2f6d4a,null));};exports[_0xb9bd('0xc1')]=function(_0x27fb08,_0x4b6ca5,_0x2f975a){var _0x3ec240={};var _0x9cc200={};var _0x5d3471;var _0x23b2a6;return db[_0xb9bd('0x3e')]['findOne']({'where':{'id':_0x27fb08[_0xb9bd('0x56')]['id']}})[_0xb9bd('0x2b')](handleEntityNotFound(_0x4b6ca5,null))['then'](function(_0x398830){if(_0x398830){_0x5d3471=_0x398830;_0x9cc200[_0xb9bd('0x42')]=_[_0xb9bd('0x43')](db[_0xb9bd('0x9e')][_0xb9bd('0x3f')]);_0x9cc200[_0xb9bd('0x44')]=_[_0xb9bd('0x43')](_0x27fb08[_0xb9bd('0x44')]);_0x9cc200[_0xb9bd('0x45')]=_[_0xb9bd('0x46')](_0x9cc200[_0xb9bd('0x42')],_0x9cc200[_0xb9bd('0x44')]);_0x3ec240[_0xb9bd('0x47')]=_[_0xb9bd('0x46')](_0x9cc200[_0xb9bd('0x42')],qs[_0xb9bd('0x57')](_0x27fb08[_0xb9bd('0x44')][_0xb9bd('0x57')]));_0x3ec240['attributes']=_0x3ec240['attributes'][_0xb9bd('0x48')]?_0x3ec240['attributes']:_0x9cc200[_0xb9bd('0x42')];_0x3ec240[_0xb9bd('0x4a')]=qs[_0xb9bd('0x4b')](_0x27fb08['query']['sort']);_0x3ec240[_0xb9bd('0x4c')]=qs['filters'](_['pick'](_0x27fb08[_0xb9bd('0x44')],_0x9cc200['filters']));if(_0x27fb08['query'][_0xb9bd('0x4f')]){_0x3ec240[_0xb9bd('0x4c')]=_[_0xb9bd('0x4e')](_0x3ec240['where'],{'$or':_[_0xb9bd('0x33')](_0x3ec240[_0xb9bd('0x47')],function(_0x2455d8){var _0x22c6f9={};_0x22c6f9[_0x2455d8]={'$like':'%'+_0x27fb08[_0xb9bd('0x44')][_0xb9bd('0x4f')]+'%'};return _0x22c6f9;})});}_0x3ec240=_[_0xb9bd('0x4e')]({},_0x3ec240,_0x27fb08[_0xb9bd('0x50')]);return _0x5d3471['getBlackLists'](_0x3ec240);}})[_0xb9bd('0x2b')](function(_0x273898){if(_0x273898){_0x23b2a6=_0x273898[_0xb9bd('0x48')];if(!_0x27fb08[_0xb9bd('0x44')][_0xb9bd('0x66')](_0xb9bd('0x49'))){_0x3ec240[_0xb9bd('0x23')]=qs[_0xb9bd('0x23')](_0x27fb08[_0xb9bd('0x44')][_0xb9bd('0x23')]);_0x3ec240[_0xb9bd('0x21')]=qs[_0xb9bd('0x21')](_0x27fb08[_0xb9bd('0x44')][_0xb9bd('0x21')]);}return _0x5d3471['getBlackLists'](_0x3ec240);}})[_0xb9bd('0x2b')](function(_0x2c894b){if(_0x2c894b){return _0x2c894b?{'count':_0x23b2a6,'rows':_0x2c894b}:null;}})[_0xb9bd('0x2b')](respondWithResult(_0x4b6ca5,null))[_0xb9bd('0x54')](handleError(_0x4b6ca5,null));};exports[_0xb9bd('0xc2')]=function(_0x4be017,_0x5e59f8,_0x5c1185){var _0x5c46d6,_0x132129;return db['VoiceQueue'][_0xb9bd('0x37')]({'where':{'id':_0x4be017['params']['id']}})['then'](handleEntityNotFound(_0x5e59f8,null))[_0xb9bd('0x2b')](function(_0x5898dd){if(_0x5898dd){_0x132129=_0x5898dd;return _0x5898dd['addBlackLists'](_0x4be017[_0xb9bd('0x5a')][_0xb9bd('0x93')],_[_0xb9bd('0x5f')](_0x4be017[_0xb9bd('0x5a')],['ids','id'])||{});}return null;})[_0xb9bd('0xa1')](function(_0x85a455){var _0x4cc349;_0x5c46d6=_0x85a455||[];var _0x4d9e26=[];if(_0x85a455){for(var _0x1221a8=0x0;_0x1221a8<_0x85a455[_0xb9bd('0x48')];_0x1221a8+=0x1){var _0x22418e=_0x85a455[_0x1221a8]['get']({'plain':!![]});_0x4cc349=squel[_0xb9bd('0xb7')]()[_0xb9bd('0xb5')](_0xb9bd('0xc3'))[_0xb9bd('0xa4')]([_0xb9bd('0xa5'),'ContactId',_0xb9bd('0xaa'),_0xb9bd('0x6a'),_0xb9bd('0x61'),'updatedAt'],squel['select']()[_0xb9bd('0xa7')]('phone','phone')[_0xb9bd('0xa7')]('id',_0xb9bd('0xa8'))['field'](_0x22418e['CmListId'][_0xb9bd('0xa9')](),_0xb9bd('0xaa'))[_0xb9bd('0xa7')](_0x4be017[_0xb9bd('0x56')]['id'][_0xb9bd('0xa9')](),_0xb9bd('0x6a'))[_0xb9bd('0xa7')]('NOW()',_0xb9bd('0x61'))[_0xb9bd('0xa7')](_0xb9bd('0xc4'),_0xb9bd('0x60'))[_0xb9bd('0x86')]('cm_contacts')[_0xb9bd('0x4c')]('deletedAt\x20IS\x20NULL')[_0xb9bd('0x4c')](_0xb9bd('0xac'),_0x22418e['CmListId'][_0xb9bd('0xa9')]())[_0xb9bd('0x4c')]('phone\x20IS\x20NOT\x20NULL'))[_0xb9bd('0xa9')]();_0x4d9e26[_0xb9bd('0x8c')](db[_0xb9bd('0x77')]['query'](_0x4cc349));}return BPromise[_0xb9bd('0x99')](_0x4d9e26);}})[_0xb9bd('0x2b')](function(){return _0x5c46d6;})[_0xb9bd('0x2b')](respondWithResult(_0x5e59f8,null))[_0xb9bd('0x54')](handleError(_0x5e59f8,null));};exports['removeBlackLists']=function(_0x15a495,_0x50363c,_0x4ad295){return db[_0xb9bd('0x3e')]['find']({'where':{'id':_0x15a495[_0xb9bd('0x56')]['id']}})[_0xb9bd('0x2b')](handleEntityNotFound(_0x50363c,null))['then'](function(_0x6e7255){if(_0x6e7255){return _0x6e7255[_0xb9bd('0xc5')](_0x15a495[_0xb9bd('0x44')][_0xb9bd('0x93')]);}})[_0xb9bd('0x2b')](function(_0xc12f0d){if(_0xc12f0d){return db[_0xb9bd('0x6d')][_0xb9bd('0x2c')]({'where':{'ListId':_0x15a495[_0xb9bd('0x44')][_0xb9bd('0x93')],'VoiceQueueId':_0x15a495[_0xb9bd('0x56')]['id']}})['then'](function(){return _0xc12f0d;});}})['then'](respondWithStatusCode(_0x50363c,null))[_0xb9bd('0x54')](handleError(_0x50363c,null));}; \ No newline at end of file +var _0x2b47=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','find','name','UserProfileResource','end','sendStatus','error','stack','VoiceQueue','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','getHoppers','findOne','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','User','Agents','online','flatMap','forEach','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','interface','format','userVoiceQueue:save','removeTeams','Team','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','union','compact','ids','isEmpty','removeAgents','UserVoiceQueueRt','emit','addAgents','spread','isNil','SIP/%s','voicePause','all','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','ContactId','ListId','phone','scheduledAt','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','into','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x5e709a,_0x1d7975){var _0x57401a=function(_0x27eab5){while(--_0x27eab5){_0x5e709a['push'](_0x5e709a['shift']());}};_0x57401a(++_0x1d7975);}(_0x2b47,0x177));var _0x72b4=function(_0x38c367,_0x502961){_0x38c367=_0x38c367-0x0;var _0x363800=_0x2b47[_0x38c367];return _0x363800;};'use strict';var emlformat=require(_0x72b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72b4('0x1'));var jsonpatch=require(_0x72b4('0x2'));var rp=require(_0x72b4('0x3'));var moment=require('moment');var BPromise=require(_0x72b4('0x4'));var Mustache=require(_0x72b4('0x5'));var util=require(_0x72b4('0x6'));var path=require(_0x72b4('0x7'));var sox=require(_0x72b4('0x8'));var csv=require(_0x72b4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72b4('0xa'));var _=require('lodash');var squel=require(_0x72b4('0xb'));var crypto=require(_0x72b4('0xc'));var jsforce=require(_0x72b4('0xd'));var deskjs=require(_0x72b4('0xe'));var toCsv=require(_0x72b4('0x9'));var querystring=require(_0x72b4('0xf'));var Papa=require(_0x72b4('0x10'));var Redis=require(_0x72b4('0x11'));var authService=require(_0x72b4('0x12'));var qs=require(_0x72b4('0x13'));var as=require(_0x72b4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72b4('0x15'))(_0x72b4('0x16'));var utils=require(_0x72b4('0x17'));var config=require(_0x72b4('0x18'));var licenseUtil=require(_0x72b4('0x19'));var db=require(_0x72b4('0x1a'))['db'];config[_0x72b4('0x1b')]=_[_0x72b4('0x1c')](config[_0x72b4('0x1b')],{'host':_0x72b4('0x1d'),'port':0x18eb});var socket=require(_0x72b4('0x1e'))(new Redis(config['redis']));require(_0x72b4('0x1f'))[_0x72b4('0x20')](socket);function respondWithStatusCode(_0x28ae3c,_0x46eb8f){_0x46eb8f=_0x46eb8f||0xcc;return function(_0x5cd685){if(_0x5cd685){return _0x28ae3c['sendStatus'](_0x46eb8f);}return _0x28ae3c[_0x72b4('0x21')](_0x46eb8f)['end']();};}function respondWithResult(_0x21ff7d,_0x2d4fd0){_0x2d4fd0=_0x2d4fd0||0xc8;return function(_0x5ac4fc){if(_0x5ac4fc){return _0x21ff7d[_0x72b4('0x21')](_0x2d4fd0)[_0x72b4('0x22')](_0x5ac4fc);}};}function respondWithFilteredResult(_0x3318fc,_0x144fe2){return function(_0x139d30){if(_0x139d30){var _0x334910=typeof _0x144fe2[_0x72b4('0x23')]===_0x72b4('0x24')&&typeof _0x144fe2[_0x72b4('0x25')]==='undefined';var _0x9b4e7a=_0x139d30['count'];var _0x22dab0=_0x334910?0x0:_0x144fe2[_0x72b4('0x23')];var _0x518fda=_0x334910?_0x139d30[_0x72b4('0x26')]:_0x144fe2[_0x72b4('0x23')]+_0x144fe2['limit'];var _0x2d0e1f;if(_0x518fda>=_0x9b4e7a){_0x518fda=_0x9b4e7a;_0x2d0e1f=0xc8;}else{_0x2d0e1f=0xce;}_0x3318fc['status'](_0x2d0e1f);return _0x3318fc[_0x72b4('0x27')]('Content-Range',_0x22dab0+'-'+_0x518fda+'/'+_0x9b4e7a)['json'](_0x139d30);}return null;};}function patchUpdates(_0x1f0986){return function(_0x5966f5){try{jsonpatch[_0x72b4('0x28')](_0x5966f5,_0x1f0986,!![]);}catch(_0x8e0277){return BPromise[_0x72b4('0x29')](_0x8e0277);}return _0x5966f5['save']();};}function saveUpdates(_0x3a21d6,_0x24921b){return function(_0x355d21){if(_0x355d21){return _0x355d21['update'](_0x3a21d6)[_0x72b4('0x2a')](function(_0x10df07){return _0x10df07;});}return null;};}function removeEntity(_0x15f819,_0x273aa3){return function(_0x393eef){if(_0x393eef){return _0x393eef[_0x72b4('0x2b')]()[_0x72b4('0x2a')](function(){var _0x4919ae=_0x393eef[_0x72b4('0x2c')]({'plain':!![]});var _0x5d0d20=[{'name':_0x72b4('0x2d'),'value':_0x72b4('0x2e'),'ignore':![]},{'name':_0x72b4('0x2f'),'value':_0x72b4('0x30'),'ignore':![]}];var _0x4785b9=_(_0x5d0d20)[_0x72b4('0x31')]('ignore')[_0x72b4('0x32')](_0x72b4('0x33'))[_0x72b4('0x33')]();if(_[_0x72b4('0x34')](_0x4785b9,_0x4919ae[_0x72b4('0x35')])){return;}var _0x155198=_[_0x72b4('0x36')](_0x5d0d20,[_0x72b4('0x33'),_0x4919ae['type']])[_0x72b4('0x37')];return db[_0x72b4('0x38')]['destroy']({'where':{'type':_0x155198,'resourceId':_0x4919ae['id']}})[_0x72b4('0x2a')](function(){return _0x393eef;});})[_0x72b4('0x2a')](function(){_0x15f819[_0x72b4('0x21')](0xcc)[_0x72b4('0x39')]();});}};}function handleEntityNotFound(_0xdaf4fd,_0x230e44){return function(_0xc591c6){if(!_0xc591c6){_0xdaf4fd[_0x72b4('0x3a')](0x194);}return _0xc591c6;};}function handleError(_0x29ecd7,_0xe06129){_0xe06129=_0xe06129||0x1f4;return function(_0x36311b){logger[_0x72b4('0x3b')](_0x36311b[_0x72b4('0x3c')]);if(_0x36311b[_0x72b4('0x37')]){delete _0x36311b[_0x72b4('0x37')];}_0x29ecd7[_0x72b4('0x21')](_0xe06129)['send'](_0x36311b);};}exports['index']=function(_0x14b77c,_0x503442){var _0xaae20e={},_0x59dcf8={},_0x36e5b7={'count':0x0,'rows':[]};var _0x41eab3=_[_0x72b4('0x32')](db[_0x72b4('0x3d')]['rawAttributes'],function(_0x14a6d6){return{'name':_0x14a6d6[_0x72b4('0x3e')],'type':_0x14a6d6[_0x72b4('0x35')][_0x72b4('0x3f')]};});_0x59dcf8[_0x72b4('0x40')]=_[_0x72b4('0x32')](_0x41eab3,_0x72b4('0x37'));_0x59dcf8[_0x72b4('0x41')]=_[_0x72b4('0x42')](_0x14b77c['query']);_0x59dcf8['filters']=_[_0x72b4('0x43')](_0x59dcf8['model'],_0x59dcf8['query']);_0xaae20e[_0x72b4('0x44')]=_['intersection'](_0x59dcf8[_0x72b4('0x40')],qs[_0x72b4('0x45')](_0x14b77c[_0x72b4('0x41')][_0x72b4('0x45')]));_0xaae20e[_0x72b4('0x44')]=_0xaae20e[_0x72b4('0x44')][_0x72b4('0x46')]?_0xaae20e[_0x72b4('0x44')]:_0x59dcf8[_0x72b4('0x40')];if(!_0x14b77c[_0x72b4('0x41')][_0x72b4('0x47')](_0x72b4('0x48'))){_0xaae20e[_0x72b4('0x25')]=qs[_0x72b4('0x25')](_0x14b77c['query'][_0x72b4('0x25')]);_0xaae20e[_0x72b4('0x23')]=qs['offset'](_0x14b77c[_0x72b4('0x41')][_0x72b4('0x23')]);}_0xaae20e[_0x72b4('0x49')]=qs[_0x72b4('0x4a')](_0x14b77c['query'][_0x72b4('0x4a')]);_0xaae20e[_0x72b4('0x4b')]=qs[_0x72b4('0x4c')](_[_0x72b4('0x4d')](_0x14b77c[_0x72b4('0x41')],_0x59dcf8['filters']),_0x41eab3);if(_0x14b77c['query'][_0x72b4('0x31')]){_0xaae20e[_0x72b4('0x4b')]=_['merge'](_0xaae20e[_0x72b4('0x4b')],{'$or':_['map'](_0x41eab3,function(_0x380487){if(_0x380487['type']!=='VIRTUAL'){var _0x1807ee={};_0x1807ee[_0x380487[_0x72b4('0x37')]]={'$like':'%'+_0x14b77c['query'][_0x72b4('0x31')]+'%'};return _0x1807ee;}})});}_0xaae20e=_[_0x72b4('0x4e')]({},_0xaae20e,_0x14b77c['options']);var _0x24ea07={'where':_0xaae20e[_0x72b4('0x4b')]};return db[_0x72b4('0x3d')][_0x72b4('0x26')](_0x24ea07)[_0x72b4('0x2a')](function(_0x536db0){_0x36e5b7['count']=_0x536db0;if(_0x14b77c[_0x72b4('0x41')][_0x72b4('0x4f')]){_0xaae20e[_0x72b4('0x50')]=[{'all':!![]}];}return db[_0x72b4('0x3d')][_0x72b4('0x51')](_0xaae20e);})['then'](function(_0x585ac0){_0x36e5b7[_0x72b4('0x52')]=_0x585ac0;return _0x36e5b7;})[_0x72b4('0x2a')](respondWithFilteredResult(_0x503442,_0xaae20e))[_0x72b4('0x53')](handleError(_0x503442,null));};exports[_0x72b4('0x54')]=function(_0x4caeba,_0x35af71){var _0x2ff377={'raw':![],'where':{'id':_0x4caeba[_0x72b4('0x55')]['id']}},_0x3907fe={};_0x3907fe['model']=_[_0x72b4('0x42')](db[_0x72b4('0x3d')][_0x72b4('0x56')]);_0x3907fe['query']=_[_0x72b4('0x42')](_0x4caeba[_0x72b4('0x41')]);_0x3907fe[_0x72b4('0x4c')]=_['intersection'](_0x3907fe['model'],_0x3907fe[_0x72b4('0x41')]);_0x2ff377[_0x72b4('0x44')]=_['intersection'](_0x3907fe[_0x72b4('0x40')],qs[_0x72b4('0x45')](_0x4caeba[_0x72b4('0x41')][_0x72b4('0x45')]));_0x2ff377[_0x72b4('0x44')]=_0x2ff377['attributes'][_0x72b4('0x46')]?_0x2ff377['attributes']:_0x3907fe[_0x72b4('0x40')];if(_0x4caeba['query']['includeAll']){_0x2ff377[_0x72b4('0x50')]=[{'all':!![]}];}_0x2ff377=_['merge']({},_0x2ff377,_0x4caeba[_0x72b4('0x57')]);return db['VoiceQueue'][_0x72b4('0x36')](_0x2ff377)[_0x72b4('0x2a')](handleEntityNotFound(_0x35af71,null))[_0x72b4('0x2a')](respondWithResult(_0x35af71,null))[_0x72b4('0x53')](handleError(_0x35af71,null));};exports[_0x72b4('0x58')]=function(_0x3797ef,_0xac980e){return db['VoiceQueue'][_0x72b4('0x58')](_0x3797ef[_0x72b4('0x59')],{})['then'](function(_0x136c7d){var _0x4c76a6=_0x3797ef[_0x72b4('0x5a')][_0x72b4('0x2c')]({'plain':!![]});if(!_0x4c76a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c76a6['role']===_0x72b4('0x5a')){var _0x5ae0fd=_0x136c7d[_0x72b4('0x2c')]({'plain':!![]});var _0x47bfac=[{'name':'VoiceQueues','value':_0x72b4('0x2e')},{'name':_0x72b4('0x2f'),'value':'outbound'}];var _0x3e1e21=_[_0x72b4('0x36')](_0x47bfac,[_0x72b4('0x33'),_0x5ae0fd[_0x72b4('0x35')]])[_0x72b4('0x37')];return db[_0x72b4('0x5b')][_0x72b4('0x36')]({'where':{'name':_0x3e1e21,'userProfileId':_0x4c76a6[_0x72b4('0x5c')]},'raw':!![]})[_0x72b4('0x2a')](function(_0x4705fd){if(_0x4705fd&&_0x4705fd['autoAssociation']===0x0){return db['UserProfileResource'][_0x72b4('0x58')]({'name':_0x5ae0fd[_0x72b4('0x37')],'resourceId':_0x5ae0fd['id'],'type':_0x4705fd['name'],'sectionId':_0x4705fd['id']},{})[_0x72b4('0x2a')](function(){return _0x136c7d;});}else{return _0x136c7d;}})['catch'](function(_0x34e1b4){logger[_0x72b4('0x3b')](_0x72b4('0x5d'),_0x34e1b4);throw _0x34e1b4;});}return _0x136c7d;})[_0x72b4('0x2a')](respondWithResult(_0xac980e,0xc9))[_0x72b4('0x53')](handleError(_0xac980e,null));};exports[_0x72b4('0x5e')]=function(_0x49fed0,_0x2c0df3){var _0x3cebc1={'where':{'id':_0x49fed0[_0x72b4('0x55')]['id']}},_0x355399={};_0x355399[_0x72b4('0x40')]=_[_0x72b4('0x42')](db[_0x72b4('0x3d')][_0x72b4('0x56')]);_0x3cebc1[_0x72b4('0x44')]=_[_0x72b4('0x43')](_0x355399[_0x72b4('0x40')],qs[_0x72b4('0x45')](_0x49fed0[_0x72b4('0x41')]['fields']));_0x3cebc1[_0x72b4('0x44')]=_0x3cebc1['attributes'][_0x72b4('0x46')]?_0x3cebc1['attributes']:_0x355399['model'];if(_0x49fed0[_0x72b4('0x41')][_0x72b4('0x4f')]){_0x3cebc1['include']=[{'all':!![]}];}_0x3cebc1=_[_0x72b4('0x4e')]({},_0x3cebc1,_0x49fed0[_0x72b4('0x57')]);return db[_0x72b4('0x3d')][_0x72b4('0x36')](_0x3cebc1)[_0x72b4('0x2a')](handleEntityNotFound(_0x2c0df3,null))[_0x72b4('0x2a')](function(_0x8a7144){if(_0x8a7144){var _0xc6457b=_0x8a7144[_0x72b4('0x2c')]({'plain':!![]});_0xc6457b=qs[_0x72b4('0x5f')](_0xc6457b,['id','createdAt','updatedAt']);_0x49fed0[_0x72b4('0x59')]=_[_0x72b4('0x5f')](_0x49fed0[_0x72b4('0x59')],['id',_0x72b4('0x60'),_0x72b4('0x61')]);return db[_0x72b4('0x3d')]['create'](_['merge'](_0xc6457b,_0x49fed0['body']),{'include':_0x49fed0[_0x72b4('0x41')]['includeAll']?[{'all':!![]}]:undefined})[_0x72b4('0x2a')](function(_0x394519){var _0x125f93=_0x49fed0['user']['get']({'plain':!![]});if(!_0x125f93)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x125f93['role']===_0x72b4('0x5a')){var _0x257c74=_0x394519[_0x72b4('0x2c')]({'plain':!![]});var _0x4288a9=[{'name':_0x72b4('0x2d'),'value':_0x72b4('0x2e')},{'name':_0x72b4('0x2f'),'value':'outbound'}];var _0x2899cf=_[_0x72b4('0x36')](_0x4288a9,[_0x72b4('0x33'),_0x257c74[_0x72b4('0x35')]])[_0x72b4('0x37')];return db[_0x72b4('0x5b')]['find']({'where':{'name':_0x2899cf,'userProfileId':_0x125f93[_0x72b4('0x5c')]},'raw':!![]})[_0x72b4('0x2a')](function(_0x5e120d){if(_0x5e120d&&_0x5e120d['autoAssociation']===0x0){return db[_0x72b4('0x38')][_0x72b4('0x58')]({'name':_0x257c74[_0x72b4('0x37')],'resourceId':_0x257c74['id'],'type':_0x5e120d['name'],'sectionId':_0x5e120d['id']},{})[_0x72b4('0x2a')](function(){return _0x394519;});}else{return _0x394519;}})[_0x72b4('0x53')](function(_0x18aa05){logger[_0x72b4('0x3b')](_0x72b4('0x5d'),_0x18aa05);throw _0x18aa05;});}return _0x394519;});}})['then'](respondWithResult(_0x2c0df3,0xc9))[_0x72b4('0x53')](handleError(_0x2c0df3,null));};exports[_0x72b4('0x62')]=function(_0x4ff5e9,_0x36a203){if(_0x4ff5e9[_0x72b4('0x59')]['id']){delete _0x4ff5e9[_0x72b4('0x59')]['id'];}return db[_0x72b4('0x3d')][_0x72b4('0x36')]({'where':{'id':_0x4ff5e9[_0x72b4('0x55')]['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x36a203,null))[_0x72b4('0x2a')](saveUpdates(_0x4ff5e9['body'],null))[_0x72b4('0x2a')](respondWithResult(_0x36a203,null))[_0x72b4('0x53')](handleError(_0x36a203,null));};exports['destroy']=function(_0x401535,_0x1f3f5e){return db['VoiceQueue'][_0x72b4('0x36')]({'where':{'id':_0x401535[_0x72b4('0x55')]['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x1f3f5e,null))[_0x72b4('0x2a')](removeEntity(_0x1f3f5e,null))['catch'](handleError(_0x1f3f5e,null));};exports[_0x72b4('0x63')]=function(_0x4c767d,_0xa9d653,_0x47927c){var _0x4d7462={'raw':![],'where':{}};var _0x43e064={};var _0x1dee66={'count':0x0,'rows':[]};return db[_0x72b4('0x3d')][_0x72b4('0x64')]({'where':{'id':_0x4c767d[_0x72b4('0x55')]['id']}})['then'](handleEntityNotFound(_0xa9d653,null))[_0x72b4('0x2a')](function(_0x10f3b0){if(_0x10f3b0){_0x43e064[_0x72b4('0x40')]=_[_0x72b4('0x42')](db['CmHopper'][_0x72b4('0x56')]);_0x43e064[_0x72b4('0x41')]=_[_0x72b4('0x42')](_0x4c767d[_0x72b4('0x41')]);_0x43e064['filters']=_[_0x72b4('0x43')](_0x43e064[_0x72b4('0x40')],_0x43e064['query']);_0x4d7462[_0x72b4('0x44')]=_[_0x72b4('0x43')](_0x43e064['model'],qs[_0x72b4('0x45')](_0x4c767d[_0x72b4('0x41')][_0x72b4('0x45')]));_0x4d7462[_0x72b4('0x44')]=_0x4d7462[_0x72b4('0x44')][_0x72b4('0x46')]?_0x4d7462['attributes']:_0x43e064['model'];if(!_0x4c767d[_0x72b4('0x41')]['hasOwnProperty'](_0x72b4('0x48'))){_0x4d7462[_0x72b4('0x25')]=qs[_0x72b4('0x25')](_0x4c767d[_0x72b4('0x41')][_0x72b4('0x25')]);_0x4d7462['offset']=qs[_0x72b4('0x23')](_0x4c767d[_0x72b4('0x41')][_0x72b4('0x23')]);}_0x4d7462[_0x72b4('0x49')]=qs[_0x72b4('0x4a')](_0x4c767d['query'][_0x72b4('0x4a')]);_0x4d7462[_0x72b4('0x4b')]=qs[_0x72b4('0x4c')](_[_0x72b4('0x4d')](_0x4c767d[_0x72b4('0x41')],_0x43e064['filters']));_0x4d7462[_0x72b4('0x4b')][_0x72b4('0x65')]=_0x10f3b0['id'];if(_0x4c767d[_0x72b4('0x41')]['filter']){_0x4d7462[_0x72b4('0x4b')]=_[_0x72b4('0x4e')](_0x4d7462[_0x72b4('0x4b')],{'$or':_[_0x72b4('0x32')](_0x4d7462[_0x72b4('0x44')],function(_0x4045d3){var _0xc99cc6={};_0xc99cc6[_0x4045d3]={'$like':'%'+_0x4c767d[_0x72b4('0x41')][_0x72b4('0x31')]+'%'};return _0xc99cc6;})});}_0x4d7462=_[_0x72b4('0x4e')]({},_0x4d7462,_0x4c767d['options']);return db[_0x72b4('0x66')][_0x72b4('0x26')]({'where':_0x4d7462[_0x72b4('0x4b')]})['then'](function(_0x4a5f9d){_0x1dee66[_0x72b4('0x26')]=_0x4a5f9d;if(_0x4c767d[_0x72b4('0x41')]['includeAll']){_0x4d7462[_0x72b4('0x50')]=[{'all':!![]}];}return db[_0x72b4('0x66')]['findAll'](_0x4d7462);})['then'](function(_0x11cc95){_0x1dee66[_0x72b4('0x52')]=_0x11cc95;return _0x1dee66;});}})[_0x72b4('0x2a')](respondWithFilteredResult(_0xa9d653,_0x4d7462))['catch'](handleError(_0xa9d653,null));};exports[_0x72b4('0x67')]=function(_0x460996,_0x348d13,_0x2162c7){var _0x2b103a={'raw':!![],'where':{}};var _0x38f4ee={};var _0x3a6a93={'count':0x0,'rows':[]};return db[_0x72b4('0x3d')]['findOne']({'where':{'id':_0x460996['params']['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x348d13,null))[_0x72b4('0x2a')](function(_0x26b600){if(_0x26b600){_0x38f4ee[_0x72b4('0x40')]=_['keys'](db[_0x72b4('0x68')][_0x72b4('0x56')]);_0x38f4ee[_0x72b4('0x41')]=_[_0x72b4('0x42')](_0x460996[_0x72b4('0x41')]);_0x38f4ee[_0x72b4('0x4c')]=_[_0x72b4('0x43')](_0x38f4ee[_0x72b4('0x40')],_0x38f4ee[_0x72b4('0x41')]);_0x2b103a[_0x72b4('0x44')]=_[_0x72b4('0x43')](_0x38f4ee[_0x72b4('0x40')],qs['fields'](_0x460996[_0x72b4('0x41')][_0x72b4('0x45')]));_0x2b103a[_0x72b4('0x44')]=_0x2b103a[_0x72b4('0x44')][_0x72b4('0x46')]?_0x2b103a[_0x72b4('0x44')]:_0x38f4ee['model'];if(!_0x460996[_0x72b4('0x41')][_0x72b4('0x47')](_0x72b4('0x48'))){_0x2b103a['limit']=qs[_0x72b4('0x25')](_0x460996[_0x72b4('0x41')]['limit']);_0x2b103a[_0x72b4('0x23')]=qs['offset'](_0x460996[_0x72b4('0x41')][_0x72b4('0x23')]);}_0x2b103a[_0x72b4('0x49')]=qs[_0x72b4('0x4a')](_0x460996[_0x72b4('0x41')]['sort']);_0x2b103a[_0x72b4('0x4b')]=qs['filters'](_[_0x72b4('0x4d')](_0x460996[_0x72b4('0x41')],_0x38f4ee['filters']));_0x2b103a[_0x72b4('0x4b')][_0x72b4('0x65')]=_0x26b600['id'];if(_0x460996[_0x72b4('0x41')][_0x72b4('0x31')]){_0x2b103a[_0x72b4('0x4b')]=_[_0x72b4('0x4e')](_0x2b103a[_0x72b4('0x4b')],{'$or':_[_0x72b4('0x32')](_0x2b103a[_0x72b4('0x44')],function(_0x3cc5df){var _0x3ebbe9={};_0x3ebbe9[_0x3cc5df]={'$like':'%'+_0x460996['query'][_0x72b4('0x31')]+'%'};return _0x3ebbe9;})});}_0x2b103a=_[_0x72b4('0x4e')]({},_0x2b103a,_0x460996[_0x72b4('0x57')]);return db[_0x72b4('0x68')]['count']({'where':_0x2b103a[_0x72b4('0x4b')]})['then'](function(_0x18b0ac){_0x3a6a93[_0x72b4('0x26')]=_0x18b0ac;if(_0x460996[_0x72b4('0x41')][_0x72b4('0x4f')]){_0x2b103a['include']=[{'all':!![]}];}return db[_0x72b4('0x68')][_0x72b4('0x51')](_0x2b103a);})[_0x72b4('0x2a')](function(_0xe554ce){_0x3a6a93['rows']=_0xe554ce;return _0x3a6a93;});}})[_0x72b4('0x2a')](respondWithFilteredResult(_0x348d13,_0x2b103a))[_0x72b4('0x53')](handleError(_0x348d13,null));};exports[_0x72b4('0x69')]=function(_0x147346,_0x2aa12d,_0x19727f){var _0x10a9da={'raw':!![],'where':{}};var _0x3af41a={};var _0x264266={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x72b4('0x64')]({'where':{'id':_0x147346['params']['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x2aa12d,null))['then'](function(_0x46a71e){if(_0x46a71e){_0x3af41a[_0x72b4('0x40')]=_[_0x72b4('0x42')](db[_0x72b4('0x6a')][_0x72b4('0x56')]);_0x3af41a[_0x72b4('0x41')]=_[_0x72b4('0x42')](_0x147346[_0x72b4('0x41')]);_0x3af41a[_0x72b4('0x4c')]=_[_0x72b4('0x43')](_0x3af41a[_0x72b4('0x40')],_0x3af41a[_0x72b4('0x41')]);_0x10a9da['attributes']=_[_0x72b4('0x43')](_0x3af41a[_0x72b4('0x40')],qs[_0x72b4('0x45')](_0x147346['query'][_0x72b4('0x45')]));_0x10a9da[_0x72b4('0x44')]=_0x10a9da[_0x72b4('0x44')]['length']?_0x10a9da[_0x72b4('0x44')]:_0x3af41a['model'];if(!_0x147346[_0x72b4('0x41')][_0x72b4('0x47')](_0x72b4('0x48'))){_0x10a9da['limit']=qs['limit'](_0x147346['query'][_0x72b4('0x25')]);_0x10a9da[_0x72b4('0x23')]=qs['offset'](_0x147346[_0x72b4('0x41')][_0x72b4('0x23')]);}_0x10a9da[_0x72b4('0x49')]=qs[_0x72b4('0x4a')](_0x147346[_0x72b4('0x41')][_0x72b4('0x4a')]);_0x10a9da['where']=qs[_0x72b4('0x4c')](_[_0x72b4('0x4d')](_0x147346['query'],_0x3af41a[_0x72b4('0x4c')]));_0x10a9da['where'][_0x72b4('0x65')]=_0x46a71e['id'];if(_0x147346[_0x72b4('0x41')]['filter']){_0x10a9da[_0x72b4('0x4b')]=_[_0x72b4('0x4e')](_0x10a9da['where'],{'$or':_[_0x72b4('0x32')](_0x10a9da['attributes'],function(_0x5f0f9b){var _0x35bb14={};_0x35bb14[_0x5f0f9b]={'$like':'%'+_0x147346[_0x72b4('0x41')][_0x72b4('0x31')]+'%'};return _0x35bb14;})});}_0x10a9da=_[_0x72b4('0x4e')]({},_0x10a9da,_0x147346[_0x72b4('0x57')]);return db[_0x72b4('0x6a')][_0x72b4('0x26')]({'where':_0x10a9da[_0x72b4('0x4b')]})[_0x72b4('0x2a')](function(_0x5d5cb5){_0x264266[_0x72b4('0x26')]=_0x5d5cb5;if(_0x147346[_0x72b4('0x41')]['includeAll']){_0x10a9da[_0x72b4('0x50')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x72b4('0x51')](_0x10a9da);})[_0x72b4('0x2a')](function(_0x29ef50){_0x264266[_0x72b4('0x52')]=_0x29ef50;return _0x264266;});}})[_0x72b4('0x2a')](respondWithFilteredResult(_0x2aa12d,_0x10a9da))[_0x72b4('0x53')](handleError(_0x2aa12d,null));};exports[_0x72b4('0x6b')]=function(_0x559706,_0x287b16,_0x3d7bfd){var _0x537a80={'raw':!![],'where':{}};var _0x29465f={};var _0x133a4f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x72b4('0x64')]({'where':{'id':_0x559706[_0x72b4('0x55')]['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x287b16,null))[_0x72b4('0x2a')](function(_0x3a32d5){if(_0x3a32d5){_0x29465f[_0x72b4('0x40')]=_[_0x72b4('0x42')](db[_0x72b4('0x6c')][_0x72b4('0x56')]);_0x29465f[_0x72b4('0x41')]=_[_0x72b4('0x42')](_0x559706[_0x72b4('0x41')]);_0x29465f[_0x72b4('0x4c')]=_[_0x72b4('0x43')](_0x29465f['model'],_0x29465f['query']);_0x537a80[_0x72b4('0x44')]=_[_0x72b4('0x43')](_0x29465f[_0x72b4('0x40')],qs[_0x72b4('0x45')](_0x559706[_0x72b4('0x41')]['fields']));_0x537a80[_0x72b4('0x44')]=_0x537a80[_0x72b4('0x44')][_0x72b4('0x46')]?_0x537a80[_0x72b4('0x44')]:_0x29465f[_0x72b4('0x40')];if(!_0x559706[_0x72b4('0x41')][_0x72b4('0x47')]('nolimit')){_0x537a80[_0x72b4('0x25')]=qs[_0x72b4('0x25')](_0x559706[_0x72b4('0x41')][_0x72b4('0x25')]);_0x537a80[_0x72b4('0x23')]=qs[_0x72b4('0x23')](_0x559706['query'][_0x72b4('0x23')]);}_0x537a80[_0x72b4('0x49')]=qs['sort'](_0x559706[_0x72b4('0x41')]['sort']);_0x537a80[_0x72b4('0x4b')]=qs[_0x72b4('0x4c')](_[_0x72b4('0x4d')](_0x559706[_0x72b4('0x41')],_0x29465f[_0x72b4('0x4c')]));_0x537a80['where'][_0x72b4('0x65')]=_0x3a32d5['id'];if(_0x559706[_0x72b4('0x41')][_0x72b4('0x31')]){_0x537a80['where']=_['merge'](_0x537a80[_0x72b4('0x4b')],{'$or':_[_0x72b4('0x32')](_0x537a80[_0x72b4('0x44')],function(_0x2c58e1){var _0x33fc8d={};_0x33fc8d[_0x2c58e1]={'$like':'%'+_0x559706[_0x72b4('0x41')]['filter']+'%'};return _0x33fc8d;})});}_0x537a80=_['merge']({},_0x537a80,_0x559706[_0x72b4('0x57')]);return db[_0x72b4('0x6c')][_0x72b4('0x26')]({'where':_0x537a80[_0x72b4('0x4b')]})[_0x72b4('0x2a')](function(_0xd548c9){_0x133a4f[_0x72b4('0x26')]=_0xd548c9;if(_0x559706['query'][_0x72b4('0x4f')]){_0x537a80[_0x72b4('0x50')]=[{'all':!![]}];}return db[_0x72b4('0x6c')][_0x72b4('0x51')](_0x537a80);})['then'](function(_0x28f168){_0x133a4f[_0x72b4('0x52')]=_0x28f168;return _0x133a4f;});}})[_0x72b4('0x2a')](respondWithFilteredResult(_0x287b16,_0x537a80))[_0x72b4('0x53')](handleError(_0x287b16,null));};exports['getTeams']=function(_0x4d4a51,_0x20cc4d,_0x3f249d){var _0x6c2309={};var _0xd7641d={};var _0x89fad8;var _0x36b21e;return db['VoiceQueue'][_0x72b4('0x64')]({'where':{'id':_0x4d4a51[_0x72b4('0x55')]['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x20cc4d,null))['then'](function(_0x298ab1){if(_0x298ab1){_0x89fad8=_0x298ab1;_0xd7641d['model']=_['keys'](db['Team'][_0x72b4('0x56')]);_0xd7641d[_0x72b4('0x41')]=_['keys'](_0x4d4a51[_0x72b4('0x41')]);_0xd7641d[_0x72b4('0x4c')]=_[_0x72b4('0x43')](_0xd7641d[_0x72b4('0x40')],_0xd7641d[_0x72b4('0x41')]);_0x6c2309['attributes']=_['intersection'](_0xd7641d['model'],qs['fields'](_0x4d4a51[_0x72b4('0x41')][_0x72b4('0x45')]));_0x6c2309[_0x72b4('0x44')]=_0x6c2309[_0x72b4('0x44')][_0x72b4('0x46')]?_0x6c2309[_0x72b4('0x44')]:_0xd7641d['model'];_0x6c2309[_0x72b4('0x49')]=qs[_0x72b4('0x4a')](_0x4d4a51['query'][_0x72b4('0x4a')]);_0x6c2309[_0x72b4('0x4b')]=qs['filters'](_[_0x72b4('0x4d')](_0x4d4a51[_0x72b4('0x41')],_0xd7641d[_0x72b4('0x4c')]));if(_0x4d4a51[_0x72b4('0x41')][_0x72b4('0x31')]){_0x6c2309[_0x72b4('0x4b')]=_[_0x72b4('0x4e')](_0x6c2309[_0x72b4('0x4b')],{'$or':_[_0x72b4('0x32')](_0x6c2309['attributes'],function(_0x2c9b79){var _0x4a97d4={};_0x4a97d4[_0x2c9b79]={'$like':'%'+_0x4d4a51['query']['filter']+'%'};return _0x4a97d4;})});}_0x6c2309=_[_0x72b4('0x4e')]({},_0x6c2309,_0x4d4a51['options']);return _0x89fad8['getTeams'](_0x6c2309);}})[_0x72b4('0x2a')](function(_0x3ba2db){if(_0x3ba2db){_0x36b21e=_0x3ba2db[_0x72b4('0x46')];if(!_0x4d4a51[_0x72b4('0x41')][_0x72b4('0x47')](_0x72b4('0x48'))){_0x6c2309[_0x72b4('0x25')]=qs[_0x72b4('0x25')](_0x4d4a51[_0x72b4('0x41')][_0x72b4('0x25')]);_0x6c2309[_0x72b4('0x23')]=qs[_0x72b4('0x23')](_0x4d4a51['query']['offset']);}return _0x89fad8[_0x72b4('0x6d')](_0x6c2309);}})[_0x72b4('0x2a')](function(_0x5fca45){if(_0x5fca45){return _0x5fca45?{'count':_0x36b21e,'rows':_0x5fca45}:null;}})['then'](respondWithResult(_0x20cc4d,null))['catch'](handleError(_0x20cc4d,null));};exports[_0x72b4('0x6e')]=function(_0x44d457,_0x4d9e17,_0x252543){var _0x48f25f=_0x44d457[_0x72b4('0x59')][_0x72b4('0x6f')];var _0xa5aa51=_[_0x72b4('0x32')](_0x48f25f,'id');return db['Team'][_0x72b4('0x51')]({'where':{'id':_0xa5aa51},'attributes':['id'],'include':[{'model':db[_0x72b4('0x70')],'as':_0x72b4('0x71'),'attributes':['id','name',_0x72b4('0x72'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x47946f){if(_0x47946f){var _0x30687a=_[_0x72b4('0x73')](_0x47946f,function(_0x570ac5){var _0x1e644c=_0x570ac5['get']({'plain':!![]});_0x1e644c[_0x72b4('0x71')][_0x72b4('0x74')](function(_0x4cb41f){_0x4cb41f[_0x72b4('0x75')]=_[_0x72b4('0x36')](_0x48f25f,{'id':_0x1e644c['id']})[_0x72b4('0x75')];});return _0x1e644c['Agents'];});return db['VoiceQueue'][_0x72b4('0x36')]({'where':{'id':_0x44d457[_0x72b4('0x55')]['id']}})[_0x72b4('0x2a')](function(_0xec8318){return db['sequelize'][_0x72b4('0x76')](function(_0x52e8de){return _0xec8318[_0x72b4('0x6e')](_0xa5aa51,{'transaction':_0x52e8de})[_0x72b4('0x2a')](function(){return BPromise[_0x72b4('0x77')](_0x48f25f,function(_0x80e923){return db[_0x72b4('0x78')][_0x72b4('0x79')]({'TeamId':_0x80e923['id'],'VoiceQueueId':_0x44d457['params']['id'],'penalty':_0x80e923[_0x72b4('0x75')]},{'transaction':_0x52e8de});});})[_0x72b4('0x2a')](function(){return BPromise[_0x72b4('0x77')](_0x30687a,function(_0x2daef4){return db[_0x72b4('0x7a')][_0x72b4('0x7b')]({'where':{'UserId':_0x2daef4['id'],'VoiceQueueId':_0x44d457[_0x72b4('0x55')]['id']},'defaults':{'penalty':_0x2daef4[_0x72b4('0x75')]},'transaction':_0x52e8de});});})[_0x72b4('0x2a')](function(){return BPromise[_0x72b4('0x77')](_[_0x72b4('0x31')](_0x30687a,{'online':!![]}),function(_0x4d5c15){return db['UserVoiceQueueRt']['upsert']({'membername':_0x4d5c15[_0x72b4('0x37')],'UserId':_0x4d5c15['id'],'queue_name':_0xec8318['name'],'VoiceQueueId':_0xec8318['id'],'interface':_['isNil'](_0x4d5c15[_0x72b4('0x7c')])?util[_0x72b4('0x7d')]('SIP/%s',_0x4d5c15[_0x72b4('0x37')]):_0x4d5c15['interface'],'paused':_0x4d5c15['voicePause']||![],'penalty':_0x4d5c15[_0x72b4('0x75')]},{'transaction':_0x52e8de});});})[_0x72b4('0x2a')](function(){_0x30687a['forEach'](function(_0xf85ac3){socket['emit'](_0x72b4('0x7e'),{'UserId':_0xf85ac3['id'],'VoiceQueueId':_0xec8318['id']});});});});});}})[_0x72b4('0x2a')](respondWithStatusCode(_0x4d9e17,null))[_0x72b4('0x53')](handleError(_0x4d9e17,null));};exports[_0x72b4('0x7f')]=function(_0x32f038,_0x1271e0,_0x2d7e8b){return db[_0x72b4('0x80')][_0x72b4('0x51')]({'where':{'id':_0x32f038[_0x72b4('0x41')]['ids']},'attributes':['id'],'include':[{'model':db[_0x72b4('0x70')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x72b4('0x2a')](handleEntityNotFound(_0x1271e0,null))['then'](function(_0xadeb38){var _0x2cb837=_[_0x72b4('0x32')](_0xadeb38,'id');var _0x2c74c4=[];var _0x5b9729=[];var _0x33f326=squel[_0x72b4('0x81')]();_0x33f326[_0x72b4('0x82')](_0x72b4('0x83'))['from'](_0x72b4('0x84'),'tq')[_0x72b4('0x85')](_0x72b4('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x72b4('0x4b')](_0x72b4('0x87'),_0x32f038[_0x72b4('0x55')]['id']);for(var _0x431ec1=0x0;_0x431ec1<_0xadeb38[_0x72b4('0x46')];_0x431ec1+=0x1){let _0x937545=_0xadeb38[_0x431ec1];for(var _0x2ed804=0x0;_0x2ed804<_0x937545['Agents']['length'];_0x2ed804+=0x1){let _0x182861=_0x937545[_0x72b4('0x71')][_0x2ed804];var _0x280d28=_0x33f326['clone']();_0x280d28['where'](_0x72b4('0x88'),_0x182861['id']);_0x5b9729[_0x72b4('0x89')](db[_0x72b4('0x8a')]['query'](_0x280d28[_0x72b4('0x8b')](),{'type':db[_0x72b4('0x8a')][_0x72b4('0x8c')][_0x72b4('0x8d')]})[_0x72b4('0x2a')](function(_0x54f178){if(_0x54f178[_0x72b4('0x46')]===0x1){return _0x182861['id'];}else{var _0xe06201=_['every'](_[_0x72b4('0x32')](_0x54f178,_0x72b4('0x8e')),function(_0x3845c2){return _['includes'](_0x2cb837,_0x3845c2);});if(_0xe06201){return _0x182861['id'];}}}));}}return BPromise['all'](_0x5b9729)[_0x72b4('0x2a')](function(_0x3be165){_0x2c74c4=_(_0x2c74c4)[_0x72b4('0x8f')](_0x3be165)[_0x72b4('0x90')]()[_0x72b4('0x33')]();return db['VoiceQueue'][_0x72b4('0x36')]({'where':{'id':_0x32f038[_0x72b4('0x55')]['id']}})[_0x72b4('0x2a')](function(_0xb7ea){return db[_0x72b4('0x8a')][_0x72b4('0x76')](function(_0xdd23d8){return _0xb7ea[_0x72b4('0x7f')](_0x32f038['query'][_0x72b4('0x91')],{'transaction':_0xdd23d8})['then'](function(){if(!_[_0x72b4('0x92')](_0x2c74c4)){return _0xb7ea[_0x72b4('0x93')](_0x2c74c4,{'transaction':_0xdd23d8})[_0x72b4('0x2a')](function(){return db[_0x72b4('0x94')]['destroy']({'where':{'VoiceQueueId':_0x32f038[_0x72b4('0x55')]['id'],'UserId':_0x2c74c4},'transaction':_0xdd23d8});});}})[_0x72b4('0x2a')](function(){_0x2c74c4[_0x72b4('0x74')](function(_0x415377){socket[_0x72b4('0x95')]('userVoiceQueue:remove',{'UserId':_0x415377,'VoiceQueueId':_0xb7ea['id']});});});});});});})['then'](respondWithStatusCode(_0x1271e0,null))[_0x72b4('0x53')](handleError(_0x1271e0,null));};exports[_0x72b4('0x96')]=function(_0x2155a9,_0x36dbc2,_0x2034f6){var _0x4e88a1,_0x1d0e33;return db[_0x72b4('0x3d')]['find']({'where':{'id':_0x2155a9[_0x72b4('0x55')]['id']}})['then'](handleEntityNotFound(_0x36dbc2,null))[_0x72b4('0x2a')](function(_0x2e23ff){if(_0x2e23ff){_0x1d0e33=_0x2e23ff;return _0x2e23ff['addAgents'](_0x2155a9[_0x72b4('0x59')][_0x72b4('0x91')],_[_0x72b4('0x5f')](_0x2155a9[_0x72b4('0x59')],['ids','id'])||{})[_0x72b4('0x97')](function(_0x1d077e){for(var _0x514862=0x0;_0x514862<_0x2155a9['body']['ids'][_0x72b4('0x46')];_0x514862+=0x1){socket[_0x72b4('0x95')](_0x72b4('0x7e'),{'UserId':Number(_0x2155a9['body'][_0x72b4('0x91')][_0x514862]),'VoiceQueueId':Number(_0x2155a9[_0x72b4('0x55')]['id'])});}return _0x1d077e;});}})['then'](function(_0x1e6f74){_0x4e88a1=_0x1e6f74||[];if(_0x1d0e33){return db[_0x72b4('0x70')][_0x72b4('0x51')]({'where':{'id':_0x2155a9[_0x72b4('0x59')][_0x72b4('0x91')]},'attributes':['id',_0x72b4('0x37'),_0x72b4('0x72'),'voicePause',_0x72b4('0x7c')],'raw':!![]});}})[_0x72b4('0x2a')](function(_0x4b087b){if(!_[_0x72b4('0x92')](_0x4b087b)){var _0x535caa=[];for(var _0x5f3fc9=0x0;_0x5f3fc9<_0x4b087b[_0x72b4('0x46')];_0x5f3fc9++){if(_0x4b087b[_0x5f3fc9][_0x72b4('0x72')]){_0x535caa[_0x72b4('0x89')](db[_0x72b4('0x94')][_0x72b4('0x79')]({'membername':_0x4b087b[_0x5f3fc9][_0x72b4('0x37')],'UserId':_0x4b087b[_0x5f3fc9]['id'],'queue_name':_0x1d0e33[_0x72b4('0x37')],'VoiceQueueId':_0x1d0e33['id'],'interface':_[_0x72b4('0x98')](_0x4b087b[_0x5f3fc9][_0x72b4('0x7c')])?util[_0x72b4('0x7d')](_0x72b4('0x99'),_0x4b087b[_0x5f3fc9][_0x72b4('0x37')]):_0x4b087b[_0x5f3fc9][_0x72b4('0x7c')],'paused':_0x4b087b[_0x5f3fc9][_0x72b4('0x9a')]||![],'penalty':_0x2155a9['body']['penalty']||0x0}));}}return BPromise[_0x72b4('0x9b')](_0x535caa);}})[_0x72b4('0x2a')](function(){return _0x4e88a1;})[_0x72b4('0x2a')](respondWithResult(_0x36dbc2,null))['catch'](handleError(_0x36dbc2,null));};exports[_0x72b4('0x93')]=function(_0x3e1895,_0x185c4c,_0x5b487b){return db[_0x72b4('0x3d')]['find']({'where':{'id':_0x3e1895[_0x72b4('0x55')]['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x185c4c,null))['then'](function(_0x498a05){if(_0x498a05){return _0x498a05[_0x72b4('0x93')](_0x3e1895[_0x72b4('0x41')]['ids'])[_0x72b4('0x2a')](function(){if(_['isArray'](_0x3e1895[_0x72b4('0x41')][_0x72b4('0x91')])){for(var _0x1f59be=0x0;_0x1f59be<_0x3e1895[_0x72b4('0x41')][_0x72b4('0x91')]['length'];_0x1f59be+=0x1){socket[_0x72b4('0x95')]('userVoiceQueue:remove',{'UserId':Number(_0x3e1895[_0x72b4('0x41')]['ids'][_0x1f59be]),'VoiceQueueId':Number(_0x3e1895[_0x72b4('0x55')]['id'])});}}else{socket[_0x72b4('0x95')](_0x72b4('0x9c'),{'UserId':Number(_0x3e1895['query'][_0x72b4('0x91')]),'VoiceQueueId':Number(_0x3e1895[_0x72b4('0x55')]['id'])});}});}})[_0x72b4('0x2a')](function(_0x57d6c4){return db[_0x72b4('0x94')][_0x72b4('0x2b')]({'where':{'VoiceQueueId':_0x3e1895['params']['id'],'UserId':_0x3e1895[_0x72b4('0x41')]['ids']}})['then'](function(){return _0x57d6c4;});})[_0x72b4('0x2a')](respondWithStatusCode(_0x185c4c,null))[_0x72b4('0x53')](handleError(_0x185c4c,null));};exports[_0x72b4('0x9d')]=function(_0x5a15f1,_0x570032,_0x2cf877){var _0x1ade67={};var _0x23822a={};var _0xf4efb6;var _0xe371f0;return db[_0x72b4('0x3d')][_0x72b4('0x64')]({'where':{'id':_0x5a15f1[_0x72b4('0x55')]['id']}})['then'](handleEntityNotFound(_0x570032,null))[_0x72b4('0x2a')](function(_0x414ced){if(_0x414ced){_0xf4efb6=_0x414ced;_0x23822a['model']=_[_0x72b4('0x42')](db[_0x72b4('0x70')][_0x72b4('0x56')]);_0x23822a[_0x72b4('0x41')]=_['keys'](_0x5a15f1['query']);_0x23822a['filters']=_[_0x72b4('0x43')](_0x23822a[_0x72b4('0x40')],_0x23822a[_0x72b4('0x41')]);_0x1ade67['attributes']=_[_0x72b4('0x43')](_0x23822a[_0x72b4('0x40')],qs['fields'](_0x5a15f1[_0x72b4('0x41')]['fields']));_0x1ade67[_0x72b4('0x44')]=_0x1ade67[_0x72b4('0x44')]['length']?_0x1ade67[_0x72b4('0x44')]:_0x23822a[_0x72b4('0x40')];_0x1ade67[_0x72b4('0x49')]=qs[_0x72b4('0x4a')](_0x5a15f1[_0x72b4('0x41')]['sort']);_0x1ade67['where']=qs[_0x72b4('0x4c')](_['pick'](_0x5a15f1[_0x72b4('0x41')],_0x23822a[_0x72b4('0x4c')]));if(_0x5a15f1[_0x72b4('0x41')][_0x72b4('0x31')]){_0x1ade67[_0x72b4('0x4b')]=_[_0x72b4('0x4e')](_0x1ade67[_0x72b4('0x4b')],{'$or':_['map'](_0x1ade67[_0x72b4('0x44')],function(_0x25558a){var _0x4f96d1={};_0x4f96d1[_0x25558a]={'$like':'%'+_0x5a15f1[_0x72b4('0x41')][_0x72b4('0x31')]+'%'};return _0x4f96d1;})});}_0x1ade67=_[_0x72b4('0x4e')]({},_0x1ade67,_0x5a15f1['options']);return _0xf4efb6[_0x72b4('0x9d')](_0x1ade67);}})[_0x72b4('0x2a')](function(_0x26ea6b){if(_0x26ea6b){_0xe371f0=_0x26ea6b[_0x72b4('0x46')];if(!_0x5a15f1[_0x72b4('0x41')]['hasOwnProperty']('nolimit')){_0x1ade67[_0x72b4('0x25')]=qs[_0x72b4('0x25')](_0x5a15f1[_0x72b4('0x41')]['limit']);_0x1ade67['offset']=qs[_0x72b4('0x23')](_0x5a15f1['query'][_0x72b4('0x23')]);}return _0xf4efb6[_0x72b4('0x9d')](_0x1ade67);}})[_0x72b4('0x2a')](function(_0x3f43f6){if(_0x3f43f6){return _0x3f43f6?{'count':_0xe371f0,'rows':_0x3f43f6}:null;}})[_0x72b4('0x2a')](respondWithResult(_0x570032,null))[_0x72b4('0x53')](handleError(_0x570032,null));};exports['getMembers']=function(_0x47995f,_0x57987e,_0x139024){var _0x446669={};var _0x3f4148={};var _0x46947f;var _0x2efb23;return db['VoiceQueue'][_0x72b4('0x64')]({'where':{'id':_0x47995f[_0x72b4('0x55')]['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x57987e,null))[_0x72b4('0x2a')](function(_0x5eb8d1){if(_0x5eb8d1){_0x46947f=_0x5eb8d1;_0x3f4148[_0x72b4('0x40')]=_[_0x72b4('0x42')](db[_0x72b4('0x94')]['rawAttributes']);_0x3f4148[_0x72b4('0x41')]=_['keys'](_0x47995f['query']);_0x3f4148[_0x72b4('0x4c')]=_[_0x72b4('0x43')](_0x3f4148[_0x72b4('0x40')],_0x3f4148[_0x72b4('0x41')]);_0x446669[_0x72b4('0x44')]=_[_0x72b4('0x43')](_0x3f4148['model'],qs['fields'](_0x47995f[_0x72b4('0x41')][_0x72b4('0x45')]));_0x446669[_0x72b4('0x44')]=_0x446669[_0x72b4('0x44')]['length']?_0x446669[_0x72b4('0x44')]:_0x3f4148[_0x72b4('0x40')];_0x446669[_0x72b4('0x49')]=qs[_0x72b4('0x4a')](_0x47995f['query'][_0x72b4('0x4a')]);_0x446669[_0x72b4('0x4b')]=qs[_0x72b4('0x4c')](_[_0x72b4('0x4d')](_0x47995f['query'],_0x3f4148[_0x72b4('0x4c')]));if(_0x47995f[_0x72b4('0x41')][_0x72b4('0x31')]){_0x446669[_0x72b4('0x4b')]=_[_0x72b4('0x4e')](_0x446669[_0x72b4('0x4b')],{'$or':_[_0x72b4('0x32')](_0x446669[_0x72b4('0x44')],function(_0x31d346){var _0x2c86dd={};_0x2c86dd[_0x31d346]={'$like':'%'+_0x47995f['query'][_0x72b4('0x31')]+'%'};return _0x2c86dd;})});}_0x446669=_[_0x72b4('0x4e')]({},_0x446669,_0x47995f[_0x72b4('0x57')]);return _0x46947f[_0x72b4('0x9e')](_0x446669);}})[_0x72b4('0x2a')](function(_0x199edd){if(_0x199edd){_0x2efb23=_0x199edd[_0x72b4('0x46')];if(!_0x47995f[_0x72b4('0x41')]['hasOwnProperty'](_0x72b4('0x48'))){_0x446669[_0x72b4('0x25')]=qs[_0x72b4('0x25')](_0x47995f[_0x72b4('0x41')]['limit']);_0x446669[_0x72b4('0x23')]=qs['offset'](_0x47995f[_0x72b4('0x41')][_0x72b4('0x23')]);}return _0x46947f['getMembers'](_0x446669);}})[_0x72b4('0x2a')](function(_0x29af12){return _0x29af12?{'count':_0x2efb23,'rows':_0x29af12}:null;})['then'](respondWithResult(_0x57987e,null))['catch'](handleError(_0x57987e,null));};exports['getLists']=function(_0xb1c491,_0x2edfe8,_0x395db4){var _0x5d9142={};var _0x19cdc0={};var _0x425495;var _0xf7f3a7;return db[_0x72b4('0x3d')][_0x72b4('0x64')]({'where':{'id':_0xb1c491[_0x72b4('0x55')]['id']}})['then'](handleEntityNotFound(_0x2edfe8,null))[_0x72b4('0x2a')](function(_0x4ac8de){if(_0x4ac8de){_0x425495=_0x4ac8de;_0x19cdc0[_0x72b4('0x40')]=_[_0x72b4('0x42')](db[_0x72b4('0x9f')]['rawAttributes']);_0x19cdc0['query']=_[_0x72b4('0x42')](_0xb1c491['query']);_0x19cdc0['filters']=_[_0x72b4('0x43')](_0x19cdc0[_0x72b4('0x40')],_0x19cdc0['query']);_0x5d9142['attributes']=_[_0x72b4('0x43')](_0x19cdc0['model'],qs[_0x72b4('0x45')](_0xb1c491[_0x72b4('0x41')][_0x72b4('0x45')]));_0x5d9142[_0x72b4('0x44')]=_0x5d9142[_0x72b4('0x44')][_0x72b4('0x46')]?_0x5d9142[_0x72b4('0x44')]:_0x19cdc0[_0x72b4('0x40')];_0x5d9142[_0x72b4('0x49')]=qs[_0x72b4('0x4a')](_0xb1c491[_0x72b4('0x41')]['sort']);_0x5d9142['where']=qs[_0x72b4('0x4c')](_['pick'](_0xb1c491[_0x72b4('0x41')],_0x19cdc0[_0x72b4('0x4c')]));if(_0xb1c491[_0x72b4('0x41')]['filter']){_0x5d9142[_0x72b4('0x4b')]=_[_0x72b4('0x4e')](_0x5d9142[_0x72b4('0x4b')],{'$or':_[_0x72b4('0x32')](_0x5d9142[_0x72b4('0x44')],function(_0x4768d4){var _0x5d22f2={};_0x5d22f2[_0x4768d4]={'$like':'%'+_0xb1c491[_0x72b4('0x41')][_0x72b4('0x31')]+'%'};return _0x5d22f2;})});}_0x5d9142=_[_0x72b4('0x4e')]({},_0x5d9142,_0xb1c491[_0x72b4('0x57')]);return _0x425495[_0x72b4('0xa0')](_0x5d9142);}})[_0x72b4('0x2a')](function(_0x57f1eb){if(_0x57f1eb){_0xf7f3a7=_0x57f1eb['length'];if(!_0xb1c491['query'][_0x72b4('0x47')](_0x72b4('0x48'))){_0x5d9142[_0x72b4('0x25')]=qs['limit'](_0xb1c491[_0x72b4('0x41')][_0x72b4('0x25')]);_0x5d9142[_0x72b4('0x23')]=qs[_0x72b4('0x23')](_0xb1c491[_0x72b4('0x41')][_0x72b4('0x23')]);}return _0x425495[_0x72b4('0xa0')](_0x5d9142);}})[_0x72b4('0x2a')](function(_0x241a5a){if(_0x241a5a){return _0x241a5a?{'count':_0xf7f3a7,'rows':_0x241a5a}:null;}})['then'](respondWithResult(_0x2edfe8,null))['catch'](handleError(_0x2edfe8,null));};exports[_0x72b4('0xa1')]=function(_0x3b4acd,_0x2f4747,_0x23a7ba){var _0x26d8dc=moment()[_0x72b4('0x7d')](_0x72b4('0xa2'));var _0x4e4372,_0xe19a23;return db['VoiceQueue'][_0x72b4('0x36')]({'where':{'id':_0x3b4acd['params']['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x2f4747,null))[_0x72b4('0x2a')](function(_0x1e9d6e){if(_0x1e9d6e){_0xe19a23=_0x1e9d6e;return _0x1e9d6e[_0x72b4('0xa1')](_0x3b4acd[_0x72b4('0x59')][_0x72b4('0x91')],_[_0x72b4('0x5f')](_0x3b4acd[_0x72b4('0x59')],[_0x72b4('0x91'),'id'])||{});}return null;})[_0x72b4('0x97')](function(_0x5aa593){var _0x230e47;_0x4e4372=_0x5aa593||[];var _0x15556b=[];if(_0x5aa593){for(var _0x32f25b=0x0;_0x32f25b<_0x5aa593['length'];_0x32f25b+=0x1){var _0x4167ba=_0x5aa593[_0x32f25b][_0x72b4('0x2c')]({'plain':!![]});_0xe19a23[_0x72b4('0xa3')]=_0x3b4acd[_0x72b4('0x59')][_0x72b4('0xa3')]?_0x3b4acd[_0x72b4('0x59')][_0x72b4('0xa3')]:_0xe19a23[_0x72b4('0xa3')];switch(_0xe19a23[_0x72b4('0xa3')]){case _0x72b4('0xa4'):_0x230e47=squel[_0x72b4('0xa5')]()['into'](_0x72b4('0xa6'))[_0x72b4('0xa7')](['phone','scheduledAt',_0x72b4('0xa8'),_0x72b4('0xa9'),'VoiceQueueId',_0x72b4('0x60'),_0x72b4('0x61')],squel[_0x72b4('0x81')]()[_0x72b4('0x82')]('phone',_0x72b4('0xaa'))[_0x72b4('0x82')]('\x27'+_0x26d8dc+'\x27',_0x72b4('0xab'))['field']('id',_0x72b4('0xa8'))['field'](_0x4167ba[_0x72b4('0xac')][_0x72b4('0x8b')](),_0x72b4('0xa9'))['field'](_0x3b4acd[_0x72b4('0x55')]['id'][_0x72b4('0x8b')](),_0x72b4('0x65'))[_0x72b4('0x82')]('\x27'+_0x26d8dc+'\x27','createdAt')['field']('\x27'+_0x26d8dc+'\x27',_0x72b4('0x61'))['from'](_0x72b4('0xad'))[_0x72b4('0x4b')]('deletedAt\x20IS\x20NULL')[_0x72b4('0x4b')](_0x72b4('0xae'),_0x4167ba[_0x72b4('0xac')]['toString']())[_0x72b4('0x4b')](_0x72b4('0xaf'))[_0x72b4('0x4b')](_0x72b4('0xb0'),squel[_0x72b4('0x81')]()[_0x72b4('0x82')](_0x72b4('0xb1'))[_0x72b4('0xb2')](_0x72b4('0xb3'))[_0x72b4('0x4b')](_0x72b4('0x87'),_0x3b4acd[_0x72b4('0x55')]['id'][_0x72b4('0x8b')]()))[_0x72b4('0x4b')](_0x72b4('0xb0'),squel[_0x72b4('0x81')]()[_0x72b4('0x82')](_0x72b4('0xb4'))[_0x72b4('0xb2')]('cm_hopper')[_0x72b4('0x4b')]('VoiceQueueId\x20=\x20?',_0x3b4acd['params']['id'][_0x72b4('0x8b')]())))[_0x72b4('0x8b')]();break;case'onlyIfOpen':_0x230e47=squel['insert']()[_0x72b4('0xb5')](_0x72b4('0xa6'))[_0x72b4('0xa7')]([_0x72b4('0xaa'),_0x72b4('0xab'),'ContactId',_0x72b4('0xa9'),'VoiceQueueId',_0x72b4('0x60'),_0x72b4('0x61')],squel[_0x72b4('0x81')]()[_0x72b4('0x82')]('phone',_0x72b4('0xaa'))['field']('\x27'+_0x26d8dc+'\x27',_0x72b4('0xab'))[_0x72b4('0x82')]('id',_0x72b4('0xa8'))[_0x72b4('0x82')](_0x4167ba['CmListId'][_0x72b4('0x8b')](),'ListId')[_0x72b4('0x82')](_0x3b4acd['params']['id'][_0x72b4('0x8b')](),_0x72b4('0x65'))['field']('\x27'+_0x26d8dc+'\x27',_0x72b4('0x60'))[_0x72b4('0x82')]('\x27'+_0x26d8dc+'\x27','updatedAt')[_0x72b4('0xb2')](_0x72b4('0xad'))['where'](_0x72b4('0xb6'))['where'](_0x72b4('0xae'),_0x4167ba[_0x72b4('0xac')][_0x72b4('0x8b')]())[_0x72b4('0x4b')](_0x72b4('0xaf'))[_0x72b4('0x4b')](_0x72b4('0xb0'),squel[_0x72b4('0x81')]()[_0x72b4('0x82')](_0x72b4('0xb4'))['from']('cm_hopper')[_0x72b4('0x4b')](_0x72b4('0x87'),_0x3b4acd[_0x72b4('0x55')]['id'][_0x72b4('0x8b')]())))[_0x72b4('0x8b')]();break;default:_0x230e47=squel['insert']()['into'](_0x72b4('0xa6'))[_0x72b4('0xa7')]([_0x72b4('0xaa'),_0x72b4('0xab'),'ContactId','ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0x72b4('0x81')]()[_0x72b4('0x82')](_0x72b4('0xaa'),_0x72b4('0xaa'))['field']('\x27'+_0x26d8dc+'\x27',_0x72b4('0xab'))['field']('id',_0x72b4('0xa8'))[_0x72b4('0x82')](_0x4167ba['CmListId']['toString'](),_0x72b4('0xa9'))[_0x72b4('0x82')](_0x3b4acd[_0x72b4('0x55')]['id'][_0x72b4('0x8b')](),_0x72b4('0x65'))[_0x72b4('0x82')]('\x27'+_0x26d8dc+'\x27',_0x72b4('0x60'))[_0x72b4('0x82')]('\x27'+_0x26d8dc+'\x27',_0x72b4('0x61'))[_0x72b4('0xb2')](_0x72b4('0xad'))['where'](_0x72b4('0xb6'))[_0x72b4('0x4b')](_0x72b4('0xae'),_0x4167ba[_0x72b4('0xac')][_0x72b4('0x8b')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x72b4('0x8b')]();}_0x15556b['push'](db['sequelize'][_0x72b4('0x41')](_0x230e47));}return BPromise[_0x72b4('0x9b')](_0x15556b);}})['then'](function(){var _0x5a87b1=[];var _0x17dc3a=squel[_0x72b4('0xa5')]()[_0x72b4('0xb5')](_0x72b4('0xb7'))[_0x72b4('0xa7')]([_0x72b4('0xb8'),'phone','OrderBy',_0x72b4('0x60'),_0x72b4('0x61')],squel[_0x72b4('0x81')]()[_0x72b4('0x82')](_0x72b4('0xb9'))[_0x72b4('0x82')](_0x72b4('0xba'))[_0x72b4('0x82')](_0x72b4('0xbb'))['field']('\x27'+_0x26d8dc+'\x27',_0x72b4('0x60'))[_0x72b4('0x82')]('\x27'+_0x26d8dc+'\x27',_0x72b4('0x61'))[_0x72b4('0xb2')](_0x72b4('0xbc'),'ci')['join'](_0x72b4('0xa6'),'h',_0x72b4('0xbd'))[_0x72b4('0x4b')](_0x72b4('0xbe'),_0x26d8dc)[_0x72b4('0x4b')](_0x72b4('0xbf'),_0x72b4('0xc0')))[_0x72b4('0x8b')]();_0x5a87b1['push'](db[_0x72b4('0x8a')][_0x72b4('0x41')](_0x17dc3a));return BPromise[_0x72b4('0x9b')](_0x5a87b1);})[_0x72b4('0x2a')](function(){return _0x4e4372;})['then'](respondWithResult(_0x2f4747,null))[_0x72b4('0x53')](handleError(_0x2f4747,null));};exports['removeLists']=function(_0x5b6030,_0x4415ab,_0x411f90){return db['VoiceQueue']['find']({'where':{'id':_0x5b6030[_0x72b4('0x55')]['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x4415ab,null))[_0x72b4('0x2a')](function(_0x69bc18){if(_0x69bc18){return _0x69bc18[_0x72b4('0xc1')](_0x5b6030[_0x72b4('0x41')]['ids']);}})['then'](function(_0x4cb515){if(_0x4cb515){return db['CmHopper'][_0x72b4('0x2b')]({'where':{'ListId':_0x5b6030[_0x72b4('0x41')][_0x72b4('0x91')],'VoiceQueueId':_0x5b6030[_0x72b4('0x55')]['id']}})[_0x72b4('0x2a')](function(){return _0x4cb515;});}})[_0x72b4('0x2a')](respondWithStatusCode(_0x4415ab,null))[_0x72b4('0x53')](handleError(_0x4415ab,null));};exports[_0x72b4('0xc2')]=function(_0x44b332,_0x3e38d9,_0x40f0a5){var _0x4c2a7f={};var _0xb21a11={};var _0xc693fc;var _0x5ebcbd;return db['VoiceQueue'][_0x72b4('0x64')]({'where':{'id':_0x44b332['params']['id']}})['then'](handleEntityNotFound(_0x3e38d9,null))[_0x72b4('0x2a')](function(_0x244be8){if(_0x244be8){_0xc693fc=_0x244be8;_0xb21a11['model']=_[_0x72b4('0x42')](db['CmList'][_0x72b4('0x56')]);_0xb21a11['query']=_[_0x72b4('0x42')](_0x44b332[_0x72b4('0x41')]);_0xb21a11[_0x72b4('0x4c')]=_[_0x72b4('0x43')](_0xb21a11[_0x72b4('0x40')],_0xb21a11[_0x72b4('0x41')]);_0x4c2a7f['attributes']=_['intersection'](_0xb21a11[_0x72b4('0x40')],qs[_0x72b4('0x45')](_0x44b332[_0x72b4('0x41')][_0x72b4('0x45')]));_0x4c2a7f[_0x72b4('0x44')]=_0x4c2a7f[_0x72b4('0x44')]['length']?_0x4c2a7f[_0x72b4('0x44')]:_0xb21a11[_0x72b4('0x40')];_0x4c2a7f[_0x72b4('0x49')]=qs[_0x72b4('0x4a')](_0x44b332['query']['sort']);_0x4c2a7f[_0x72b4('0x4b')]=qs[_0x72b4('0x4c')](_[_0x72b4('0x4d')](_0x44b332['query'],_0xb21a11[_0x72b4('0x4c')]));if(_0x44b332['query'][_0x72b4('0x31')]){_0x4c2a7f[_0x72b4('0x4b')]=_['merge'](_0x4c2a7f['where'],{'$or':_[_0x72b4('0x32')](_0x4c2a7f[_0x72b4('0x44')],function(_0xfb1d0c){var _0xd6feb7={};_0xd6feb7[_0xfb1d0c]={'$like':'%'+_0x44b332[_0x72b4('0x41')][_0x72b4('0x31')]+'%'};return _0xd6feb7;})});}_0x4c2a7f=_[_0x72b4('0x4e')]({},_0x4c2a7f,_0x44b332['options']);return _0xc693fc[_0x72b4('0xc2')](_0x4c2a7f);}})[_0x72b4('0x2a')](function(_0x247db0){if(_0x247db0){_0x5ebcbd=_0x247db0['length'];if(!_0x44b332[_0x72b4('0x41')][_0x72b4('0x47')](_0x72b4('0x48'))){_0x4c2a7f[_0x72b4('0x25')]=qs[_0x72b4('0x25')](_0x44b332[_0x72b4('0x41')]['limit']);_0x4c2a7f[_0x72b4('0x23')]=qs[_0x72b4('0x23')](_0x44b332[_0x72b4('0x41')][_0x72b4('0x23')]);}return _0xc693fc[_0x72b4('0xc2')](_0x4c2a7f);}})[_0x72b4('0x2a')](function(_0x1460ca){if(_0x1460ca){return _0x1460ca?{'count':_0x5ebcbd,'rows':_0x1460ca}:null;}})[_0x72b4('0x2a')](respondWithResult(_0x3e38d9,null))['catch'](handleError(_0x3e38d9,null));};exports['addBlackLists']=function(_0x260774,_0x3e7cc4,_0x6a37d5){var _0x98f386,_0x13d4d0;return db[_0x72b4('0x3d')][_0x72b4('0x36')]({'where':{'id':_0x260774['params']['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x3e7cc4,null))['then'](function(_0x115c37){if(_0x115c37){_0x13d4d0=_0x115c37;return _0x115c37[_0x72b4('0xc3')](_0x260774['body'][_0x72b4('0x91')],_[_0x72b4('0x5f')](_0x260774['body'],['ids','id'])||{});}return null;})[_0x72b4('0x97')](function(_0x35be2a){var _0x25de1f;_0x98f386=_0x35be2a||[];var _0x3eff9e=[];if(_0x35be2a){for(var _0x2e28cc=0x0;_0x2e28cc<_0x35be2a[_0x72b4('0x46')];_0x2e28cc+=0x1){var _0x1ebf41=_0x35be2a[_0x2e28cc][_0x72b4('0x2c')]({'plain':!![]});_0x25de1f=squel[_0x72b4('0xa5')]()[_0x72b4('0xb5')](_0x72b4('0xc4'))['fromQuery']([_0x72b4('0xaa'),_0x72b4('0xa8'),'ListId',_0x72b4('0x65'),_0x72b4('0x60'),_0x72b4('0x61')],squel[_0x72b4('0x81')]()['field'](_0x72b4('0xaa'),_0x72b4('0xaa'))[_0x72b4('0x82')]('id',_0x72b4('0xa8'))[_0x72b4('0x82')](_0x1ebf41['CmListId'][_0x72b4('0x8b')](),'ListId')[_0x72b4('0x82')](_0x260774[_0x72b4('0x55')]['id'][_0x72b4('0x8b')](),_0x72b4('0x65'))[_0x72b4('0x82')](_0x72b4('0xc5'),_0x72b4('0x60'))[_0x72b4('0x82')](_0x72b4('0xc5'),_0x72b4('0x61'))[_0x72b4('0xb2')](_0x72b4('0xad'))[_0x72b4('0x4b')](_0x72b4('0xb6'))['where'](_0x72b4('0xae'),_0x1ebf41['CmListId']['toString']())[_0x72b4('0x4b')](_0x72b4('0xaf')))[_0x72b4('0x8b')]();_0x3eff9e[_0x72b4('0x89')](db[_0x72b4('0x8a')][_0x72b4('0x41')](_0x25de1f));}return BPromise[_0x72b4('0x9b')](_0x3eff9e);}})[_0x72b4('0x2a')](function(){return _0x98f386;})[_0x72b4('0x2a')](respondWithResult(_0x3e7cc4,null))[_0x72b4('0x53')](handleError(_0x3e7cc4,null));};exports['removeBlackLists']=function(_0x41da8d,_0x6db577,_0x175306){return db['VoiceQueue'][_0x72b4('0x36')]({'where':{'id':_0x41da8d[_0x72b4('0x55')]['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x6db577,null))[_0x72b4('0x2a')](function(_0x10a240){if(_0x10a240){return _0x10a240[_0x72b4('0xc6')](_0x41da8d[_0x72b4('0x41')][_0x72b4('0x91')]);}})['then'](function(_0x5cbd30){if(_0x5cbd30){return db[_0x72b4('0x6c')][_0x72b4('0x2b')]({'where':{'ListId':_0x41da8d['query'][_0x72b4('0x91')],'VoiceQueueId':_0x41da8d[_0x72b4('0x55')]['id']}})[_0x72b4('0x2a')](function(){return _0x5cbd30;});}})[_0x72b4('0x2a')](respondWithStatusCode(_0x6db577,null))[_0x72b4('0x53')](handleError(_0x6db577,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 172a58a..7f4a1ca 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 _0x598d=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1088d5,_0x1d6044){var _0x3f05e2=function(_0x4467c5){while(--_0x4467c5){_0x1088d5['push'](_0x1088d5['shift']());}};_0x3f05e2(++_0x1d6044);}(_0x598d,0x160));var _0xd598=function(_0x17af76,_0x4604bb){_0x17af76=_0x17af76-0x0;var _0x22c8e0=_0x598d[_0x17af76];return _0x22c8e0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xd598('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xd598('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd598('0x2'),'afterDestroy':_0xd598('0x3')};function emitEvent(_0x2b2b64){return function(_0x12f806,_0x5f265b,_0x3a38e0){VoiceQueueEvents[_0xd598('0x4')](_0x2b2b64+':'+_0x12f806['id'],_0x12f806);VoiceQueueEvents['emit'](_0x2b2b64,_0x12f806);_0x3a38e0(null);};}for(var e in events){if(events[_0xd598('0x5')](e)){var event=events[e];VoiceQueue[_0xd598('0x6')](e,emitEvent(event));}}module[_0xd598('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x1fbb=['setMaxListeners','update','hasOwnProperty','hook','exports','events'];(function(_0xa78869,_0x3fcd8d){var _0x183699=function(_0x1b6924){while(--_0x1b6924){_0xa78869['push'](_0xa78869['shift']());}};_0x183699(++_0x3fcd8d);}(_0x1fbb,0x107));var _0xb1fb=function(_0x51b51d,_0x2d0c64){_0x51b51d=_0x51b51d-0x0;var _0x4e1ec0=_0x1fbb[_0x51b51d];return _0x4e1ec0;};'use strict';var EventEmitter=require(_0xb1fb('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xb1fb('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb1fb('0x2'),'afterDestroy':'remove'};function emitEvent(_0x153841){return function(_0x5b44a7,_0x3f1767,_0x52481b){VoiceQueueEvents['emit'](_0x153841+':'+_0x5b44a7['id'],_0x5b44a7);VoiceQueueEvents['emit'](_0x153841,_0x5b44a7);_0x52481b(null);};}for(var e in events){if(events[_0xb1fb('0x3')](e)){var event=events[e];VoiceQueue[_0xb1fb('0x4')](e,emitEvent(event));}}module[_0xb1fb('0x5')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 78b93cf..c81e2ca 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1ca928,_0x26f4dd){var _0x138818=function(_0x344077){while(--_0x344077){_0x1ca928['push'](_0x1ca928['shift']());}};_0x138818(++_0x26f4dd);}(_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 logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x3328d5,_0x437844){var _0x5b5659=function(_0x5157b9){while(--_0x5157b9){_0x3328d5['push'](_0x3328d5['shift']());}};_0x5b5659(++_0x437844);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index f4b928a..655b2b3 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 _0x470c=['options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','VoiceQueue','find','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','VoiceQueue,\x20%s,\x20%s','message','GetVoiceQueue','findAll'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x470c,0xf6));var _0xc470=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x470c[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xc470('0x0'));var moment=require(_0xc470('0x1'));var BPromise=require('bluebird');var rs=require(_0xc470('0x2'));var fs=require('fs');var Redis=require(_0xc470('0x3'));var db=require(_0xc470('0x4'))['db'];var utils=require(_0xc470('0x5'));var logger=require(_0xc470('0x6'))(_0xc470('0x7'));var config=require('../../config/environment');var jayson=require(_0xc470('0x8'));var client=jayson[_0xc470('0x9')][_0xc470('0xa')]({'port':0x232a});config['redis']=_[_0xc470('0xb')](config[_0xc470('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc470('0xd'))(new Redis(config['redis']));require(_0xc470('0xe'))[_0xc470('0xf')](socket);function respondWithRpcPromise(_0x4814dc,_0x542dd5,_0x32039d){return new BPromise(function(_0x53010e,_0x15bc79){return client[_0xc470('0x10')](_0x4814dc,_0x32039d)[_0xc470('0x11')](function(_0x13eed1){logger[_0xc470('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x542dd5,_0xc470('0x13'));logger[_0xc470('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x542dd5,_0xc470('0x13'),JSON[_0xc470('0x15')](_0x13eed1));if(_0x13eed1[_0xc470('0x16')]){if(_0x13eed1[_0xc470('0x16')]['code']===0x1f4){logger['error'](_0xc470('0x17'),_0x542dd5,_0x13eed1[_0xc470('0x16')]['message']);return _0x15bc79(_0x13eed1[_0xc470('0x16')][_0xc470('0x18')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x542dd5,_0x13eed1[_0xc470('0x16')]['message']);return _0x53010e(_0x13eed1['error'][_0xc470('0x18')]);}else{logger[_0xc470('0x12')](_0xc470('0x17'),_0x542dd5,'request\x20sent');_0x53010e(_0x13eed1['result']['message']);}})['catch'](function(_0x3f7b9f){logger['error'](_0xc470('0x17'),_0x542dd5,_0x3f7b9f);_0x15bc79(_0x3f7b9f);});});}exports[_0xc470('0x19')]=function(_0x2e92f8){var _0x28f7b7=this;return new Promise(function(_0x4f3159,_0x11aa85){return db['VoiceQueue'][_0xc470('0x1a')]({'raw':_0x2e92f8[_0xc470('0x1b')]?_0x2e92f8['options'][_0xc470('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e92f8[_0xc470('0x1b')]?_0x2e92f8[_0xc470('0x1b')][_0xc470('0x1d')]||null:null,'attributes':_0x2e92f8['options']?_0x2e92f8[_0xc470('0x1b')][_0xc470('0x1e')]||null:null,'limit':_0x2e92f8[_0xc470('0x1b')]?_0x2e92f8['options'][_0xc470('0x1f')]||null:null,'include':_0x2e92f8[_0xc470('0x1b')]?_0x2e92f8[_0xc470('0x1b')][_0xc470('0x20')]?_[_0xc470('0x21')](_0x2e92f8['options'][_0xc470('0x20')],function(_0x47dd15){return{'model':db[_0x47dd15[_0xc470('0x22')]],'as':_0x47dd15['as'],'attributes':_0x47dd15[_0xc470('0x1e')],'include':_0x47dd15[_0xc470('0x20')]?_[_0xc470('0x21')](_0x47dd15[_0xc470('0x20')],function(_0x24e095){return{'model':db[_0x24e095[_0xc470('0x22')]],'as':_0x24e095['as'],'attributes':_0x24e095['attributes'],'include':_0x24e095['include']?_[_0xc470('0x21')](_0x24e095[_0xc470('0x20')],function(_0x1e86cc){return{'model':db[_0x1e86cc[_0xc470('0x22')]],'as':_0x1e86cc['as'],'attributes':_0x1e86cc[_0xc470('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x548116){logger[_0xc470('0x12')](_0xc470('0x19'),_0x2e92f8);logger[_0xc470('0x14')]('GetVoiceQueue',_0x2e92f8,JSON['stringify'](_0x548116));_0x4f3159(_0x548116);})['catch'](function(_0x4ac738){logger[_0xc470('0x16')]('GetVoiceQueue',_0x4ac738[_0xc470('0x18')],_0x2e92f8);_0x11aa85(_0x28f7b7[_0xc470('0x16')](0x1f4,_0x4ac738[_0xc470('0x18')]));});});};exports[_0xc470('0x23')]=function(_0x43b437){var _0xe780b2=this;return new Promise(function(_0x49ead8,_0x5403c8){return db[_0xc470('0x24')][_0xc470('0x25')]({'raw':_0x43b437['options']?_0x43b437[_0xc470('0x1b')][_0xc470('0x1c')]===undefined?!![]:![]:!![],'where':_0x43b437[_0xc470('0x1b')]?_0x43b437[_0xc470('0x1b')][_0xc470('0x1d')]||null:null,'attributes':_0x43b437['options']?_0x43b437[_0xc470('0x1b')]['attributes']||null:null,'include':_0x43b437['options']?_0x43b437[_0xc470('0x1b')][_0xc470('0x20')]?_[_0xc470('0x21')](_0x43b437[_0xc470('0x1b')][_0xc470('0x20')],function(_0x20e9a0){return{'model':db[_0x20e9a0[_0xc470('0x22')]],'as':_0x20e9a0['as'],'attributes':_0x20e9a0[_0xc470('0x1e')],'include':_0x20e9a0[_0xc470('0x20')]?_[_0xc470('0x21')](_0x20e9a0[_0xc470('0x20')],function(_0x1d6353){return{'model':db[_0x1d6353[_0xc470('0x22')]],'as':_0x1d6353['as'],'attributes':_0x1d6353['attributes'],'include':_0x1d6353[_0xc470('0x20')]?_[_0xc470('0x21')](_0x1d6353['include'],function(_0x3a052a){return{'model':db[_0x3a052a[_0xc470('0x22')]],'as':_0x3a052a['as'],'attributes':_0x3a052a[_0xc470('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc470('0x11')](function(_0x519607){logger[_0xc470('0x12')](_0xc470('0x23'),_0x43b437);logger[_0xc470('0x14')](_0xc470('0x23'),_0x43b437,JSON[_0xc470('0x15')](_0x519607));_0x49ead8(_0x519607);})[_0xc470('0x26')](function(_0x402443){logger[_0xc470('0x16')](_0xc470('0x23'),_0x402443['message'],_0x43b437);_0x5403c8(_0xe780b2[_0xc470('0x16')](0x1f4,_0x402443['message']));});});}; \ No newline at end of file +var _0x599d=['error','code','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','model','include','map','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x38c7d8,_0x253557){var _0x266426=function(_0x2f727b){while(--_0x2f727b){_0x38c7d8['push'](_0x38c7d8['shift']());}};_0x266426(++_0x253557);}(_0x599d,0x189));var _0xd599=function(_0xc5e567,_0x5a29ca){_0xc5e567=_0xc5e567-0x0;var _0x366b4a=_0x599d[_0xc5e567];return _0x366b4a;};'use strict';var _=require(_0xd599('0x0'));var util=require(_0xd599('0x1'));var moment=require(_0xd599('0x2'));var BPromise=require(_0xd599('0x3'));var rs=require(_0xd599('0x4'));var fs=require('fs');var Redis=require(_0xd599('0x5'));var db=require(_0xd599('0x6'))['db'];var utils=require(_0xd599('0x7'));var logger=require(_0xd599('0x8'))(_0xd599('0x9'));var config=require(_0xd599('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd599('0xb')][_0xd599('0xc')]({'port':0x232a});config[_0xd599('0xd')]=_[_0xd599('0xe')](config[_0xd599('0xd')],{'host':_0xd599('0xf'),'port':0x18eb});var socket=require(_0xd599('0x10'))(new Redis(config['redis']));require(_0xd599('0x11'))[_0xd599('0x12')](socket);function respondWithRpcPromise(_0x306db1,_0x281dd9,_0x3c345f){return new BPromise(function(_0x57f9cd,_0x26eecd){return client[_0xd599('0x13')](_0x306db1,_0x3c345f)[_0xd599('0x14')](function(_0x51a40b){logger[_0xd599('0x15')](_0xd599('0x16'),_0x281dd9,'request\x20sent');logger[_0xd599('0x17')](_0xd599('0x18'),_0x281dd9,_0xd599('0x19'),JSON[_0xd599('0x1a')](_0x51a40b));if(_0x51a40b[_0xd599('0x1b')]){if(_0x51a40b[_0xd599('0x1b')][_0xd599('0x1c')]===0x1f4){logger[_0xd599('0x1b')](_0xd599('0x16'),_0x281dd9,_0x51a40b['error'][_0xd599('0x1d')]);return _0x26eecd(_0x51a40b['error']['message']);}logger[_0xd599('0x1b')](_0xd599('0x16'),_0x281dd9,_0x51a40b[_0xd599('0x1b')][_0xd599('0x1d')]);return _0x57f9cd(_0x51a40b[_0xd599('0x1b')][_0xd599('0x1d')]);}else{logger[_0xd599('0x15')](_0xd599('0x16'),_0x281dd9,_0xd599('0x19'));_0x57f9cd(_0x51a40b[_0xd599('0x1e')][_0xd599('0x1d')]);}})[_0xd599('0x1f')](function(_0x3ab515){logger['error'](_0xd599('0x16'),_0x281dd9,_0x3ab515);_0x26eecd(_0x3ab515);});});}exports[_0xd599('0x20')]=function(_0x2a17ca){var _0xb408a3=this;return new Promise(function(_0x1b8016,_0x4e2bb1){return db[_0xd599('0x21')]['findAll']({'raw':_0x2a17ca[_0xd599('0x22')]?_0x2a17ca[_0xd599('0x22')][_0xd599('0x23')]===undefined?!![]:![]:!![],'where':_0x2a17ca[_0xd599('0x22')]?_0x2a17ca[_0xd599('0x22')][_0xd599('0x24')]||null:null,'attributes':_0x2a17ca[_0xd599('0x22')]?_0x2a17ca['options'][_0xd599('0x25')]||null:null,'limit':_0x2a17ca[_0xd599('0x22')]?_0x2a17ca[_0xd599('0x22')]['limit']||null:null,'include':_0x2a17ca['options']?_0x2a17ca[_0xd599('0x22')]['include']?_['map'](_0x2a17ca[_0xd599('0x22')]['include'],function(_0x41c346){return{'model':db[_0x41c346[_0xd599('0x26')]],'as':_0x41c346['as'],'attributes':_0x41c346[_0xd599('0x25')],'include':_0x41c346[_0xd599('0x27')]?_['map'](_0x41c346[_0xd599('0x27')],function(_0x19919e){return{'model':db[_0x19919e[_0xd599('0x26')]],'as':_0x19919e['as'],'attributes':_0x19919e[_0xd599('0x25')],'include':_0x19919e[_0xd599('0x27')]?_[_0xd599('0x28')](_0x19919e[_0xd599('0x27')],function(_0x489a7b){return{'model':db[_0x489a7b[_0xd599('0x26')]],'as':_0x489a7b['as'],'attributes':_0x489a7b[_0xd599('0x25')]};}):[]};}):[]};}):[]:[]})[_0xd599('0x14')](function(_0x1dce7e){logger[_0xd599('0x15')](_0xd599('0x20'),_0x2a17ca);logger[_0xd599('0x17')]('GetVoiceQueue',_0x2a17ca,JSON['stringify'](_0x1dce7e));_0x1b8016(_0x1dce7e);})[_0xd599('0x1f')](function(_0x146be8){logger[_0xd599('0x1b')](_0xd599('0x20'),_0x146be8['message'],_0x2a17ca);_0x4e2bb1(_0xb408a3[_0xd599('0x1b')](0x1f4,_0x146be8[_0xd599('0x1d')]));});});};exports[_0xd599('0x29')]=function(_0x24af95){var _0x18b3c4=this;return new Promise(function(_0x3bc479,_0x297fcf){return db[_0xd599('0x21')]['find']({'raw':_0x24af95[_0xd599('0x22')]?_0x24af95['options'][_0xd599('0x23')]===undefined?!![]:![]:!![],'where':_0x24af95['options']?_0x24af95[_0xd599('0x22')]['where']||null:null,'attributes':_0x24af95['options']?_0x24af95[_0xd599('0x22')][_0xd599('0x25')]||null:null,'include':_0x24af95[_0xd599('0x22')]?_0x24af95[_0xd599('0x22')][_0xd599('0x27')]?_['map'](_0x24af95[_0xd599('0x22')][_0xd599('0x27')],function(_0xaba10e){return{'model':db[_0xaba10e[_0xd599('0x26')]],'as':_0xaba10e['as'],'attributes':_0xaba10e[_0xd599('0x25')],'include':_0xaba10e[_0xd599('0x27')]?_['map'](_0xaba10e[_0xd599('0x27')],function(_0x101e73){return{'model':db[_0x101e73['model']],'as':_0x101e73['as'],'attributes':_0x101e73[_0xd599('0x25')],'include':_0x101e73[_0xd599('0x27')]?_['map'](_0x101e73[_0xd599('0x27')],function(_0x12c714){return{'model':db[_0x12c714[_0xd599('0x26')]],'as':_0x12c714['as'],'attributes':_0x12c714[_0xd599('0x25')]};}):[]};}):[]};}):[]:[]})[_0xd599('0x14')](function(_0x3af3dd){logger[_0xd599('0x15')](_0xd599('0x29'),_0x24af95);logger[_0xd599('0x17')]('ShowVoiceQueue',_0x24af95,JSON[_0xd599('0x1a')](_0x3af3dd));_0x3bc479(_0x3af3dd);})[_0xd599('0x1f')](function(_0x3d719b){logger[_0xd599('0x1b')](_0xd599('0x29'),_0x3d719b[_0xd599('0x1d')],_0x24af95);_0x297fcf(_0x18b3c4[_0xd599('0x1b')](0x1f4,_0x3d719b[_0xd599('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 499387f..3ff1f4a 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 _0x3901=['voiceQueue:','./voiceQueue.events','update','emit','removeListener','register','length'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x3901,0x16d));var _0x1390=function(_0x4666c5,_0x3ff2f2){_0x4666c5=_0x4666c5-0x0;var _0x5a0a31=_0x3901[_0x4666c5];return _0x5a0a31;};'use strict';var VoiceQueueEvents=require(_0x1390('0x0'));var events=['save','remove',_0x1390('0x1')];function createListener(_0x22cf12,_0x17dc28){return function(_0xd77fb){_0x17dc28[_0x1390('0x2')](_0x22cf12,_0xd77fb);};}function removeListener(_0x80e4c7,_0x418705){return function(){VoiceQueueEvents[_0x1390('0x3')](_0x80e4c7,_0x418705);};}exports[_0x1390('0x4')]=function(_0x1923d1){for(var _0x15ac9e=0x0,_0x2044d9=events[_0x1390('0x5')];_0x15ac9e<_0x2044d9;_0x15ac9e++){var _0x1d0988=events[_0x15ac9e];var _0x2e4d90=createListener(_0x1390('0x6')+_0x1d0988,_0x1923d1);VoiceQueueEvents['on'](_0x1d0988,_0x2e4d90);}}; \ No newline at end of file +var _0xcf41=['remove','update','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x23c3a6,_0x2cd03e){var _0x719ff=function(_0x172c39){while(--_0x172c39){_0x23c3a6['push'](_0x23c3a6['shift']());}};_0x719ff(++_0x2cd03e);}(_0xcf41,0x1ef));var _0x1cf4=function(_0x483987,_0x368124){_0x483987=_0x483987-0x0;var _0x1c44e3=_0xcf41[_0x483987];return _0x1c44e3;};'use strict';var VoiceQueueEvents=require(_0x1cf4('0x0'));var events=[_0x1cf4('0x1'),_0x1cf4('0x2'),_0x1cf4('0x3')];function createListener(_0xb8b640,_0x3ec6ad){return function(_0x43e57d){_0x3ec6ad['emit'](_0xb8b640,_0x43e57d);};}function removeListener(_0x430fb4,_0x4b1eef){return function(){VoiceQueueEvents['removeListener'](_0x430fb4,_0x4b1eef);};}exports[_0x1cf4('0x4')]=function(_0x4dac17){for(var _0x176f71=0x0,_0x1d74ac=events[_0x1cf4('0x5')];_0x176f71<_0x1d74ac;_0x176f71++){var _0x15818b=events[_0x176f71];var _0x3d29af=createListener(_0x1cf4('0x6')+_0x15818b,_0x4dac17);VoiceQueueEvents['on'](_0x15818b,_0x3d29af);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 469545d..b0732f2 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 _0x93e0=['delete','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put'];(function(_0x555e79,_0x9ee00e){var _0x36cb67=function(_0x207ec7){while(--_0x207ec7){_0x555e79['push'](_0x555e79['shift']());}};_0x36cb67(++_0x9ee00e);}(_0x93e0,0x1e1));var _0x093e=function(_0x23de48,_0x3d0849){_0x23de48=_0x23de48-0x0;var _0x5560fc=_0x93e0[_0x23de48];return _0x5560fc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x093e('0x0'));var timeout=require(_0x093e('0x1'));var express=require(_0x093e('0x2'));var router=express[_0x093e('0x3')]();var fs_extra=require(_0x093e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x093e('0x5'));var config=require(_0x093e('0x6'));var controller=require('./voiceQueueReport.controller');router[_0x093e('0x7')]('/',auth[_0x093e('0x8')](),controller[_0x093e('0x9')]);router[_0x093e('0x7')](_0x093e('0xa'),auth[_0x093e('0x8')](),controller[_0x093e('0xb')]);router[_0x093e('0x7')](_0x093e('0xc'),auth[_0x093e('0x8')](),controller[_0x093e('0xd')]);router[_0x093e('0x7')](_0x093e('0xe'),auth[_0x093e('0x8')](),controller[_0x093e('0xf')]);router[_0x093e('0x10')]('/',auth[_0x093e('0x8')](),controller[_0x093e('0x11')]);router[_0x093e('0x12')](_0x093e('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x093e('0x13')]('/:id',auth[_0x093e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb05c=['isAuthenticated','index','/describe','getVoiceQueuesReport','post','create','/:id','update','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get'];(function(_0x13cf06,_0x184d67){var _0x4fe4de=function(_0x4352e6){while(--_0x4352e6){_0x13cf06['push'](_0x13cf06['shift']());}};_0x4fe4de(++_0x184d67);}(_0xb05c,0x105));var _0xcb05=function(_0x131bb1,_0x5c91cc){_0x131bb1=_0x131bb1-0x0;var _0x4b006b=_0xb05c[_0x131bb1];return _0x4b006b;};'use strict';var multer=require(_0xcb05('0x0'));var util=require(_0xcb05('0x1'));var path=require(_0xcb05('0x2'));var timeout=require(_0xcb05('0x3'));var express=require('express');var router=express[_0xcb05('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcb05('0x5'));var config=require(_0xcb05('0x6'));var controller=require(_0xcb05('0x7'));router[_0xcb05('0x8')]('/',auth[_0xcb05('0x9')](),controller[_0xcb05('0xa')]);router[_0xcb05('0x8')](_0xcb05('0xb'),auth[_0xcb05('0x9')](),controller['describe']);router[_0xcb05('0x8')]('/index',auth[_0xcb05('0x9')](),controller[_0xcb05('0xc')]);router[_0xcb05('0x8')]('/:id',auth[_0xcb05('0x9')](),controller['show']);router[_0xcb05('0xd')]('/',auth['isAuthenticated'](),controller[_0xcb05('0xe')]);router['put'](_0xcb05('0xf'),auth[_0xcb05('0x9')](),controller[_0xcb05('0x10')]);router['delete'](_0xcb05('0xf'),auth[_0xcb05('0x9')](),controller[_0xcb05('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 9df2b54..564f073 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 _0x35e3=['queuecallerjoinAt','diff','seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','moment','exports','STRING','DATE'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x35e3,0x1b4));var _0x335e=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0x35e3[_0x5581ba];return _0x1e927f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x335e('0x0'));module[_0x335e('0x1')]={'type':{'type':Sequelize[_0x335e('0x2')]},'uniqueid':{'type':Sequelize[_0x335e('0x2')]},'calleridnum':{'type':Sequelize[_0x335e('0x2')]},'calleridname':{'type':Sequelize[_0x335e('0x2')]},'queue':{'type':Sequelize[_0x335e('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x335e('0x3')],'set':function(_0x35513c){var _0x31c6e5=moment(_0x35513c);var _0x32a574=moment(this['getDataValue'](_0x335e('0x4')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x3288c7=_0x31c6e5[_0x335e('0x5')](_0x32a574,_0x335e('0x6'));this[_0x335e('0x7')]('queuecallerleaveAt',_0x35513c);this[_0x335e('0x7')]('holdtime',_0x3288c7||null);}},'position':{'type':Sequelize[_0x335e('0x8')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x335e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x335e('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x335e('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x335e('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x335e('0xa')},'originalposition':{'type':Sequelize[_0x335e('0x8')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x335e('0x2')]},'connectedlinename':{'type':Sequelize[_0x335e('0x2')]},'accountcode':{'type':Sequelize[_0x335e('0x2')]},'context':{'type':Sequelize[_0x335e('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x335e('0x8')]},'mohtime':{'type':Sequelize[_0x335e('0x8')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x335e('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x335e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x335e('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x335e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x335e('0x2')]},'disposition':{'type':Sequelize[_0x335e('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x335e('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x335e('0x2')]}}; \ No newline at end of file +var _0xb2db=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x3ca910,_0xfb4836){var _0x22a247=function(_0x249fbe){while(--_0x249fbe){_0x3ca910['push'](_0x3ca910['shift']());}};_0x22a247(++_0xfb4836);}(_0xb2db,0x15a));var _0xbb2d=function(_0x49a0b6,_0x46d99e){_0x49a0b6=_0x49a0b6-0x0;var _0x1b93c5=_0xb2db[_0x49a0b6];return _0x1b93c5;};'use strict';var Sequelize=require(_0xbb2d('0x0'));var moment=require(_0xbb2d('0x1'));module[_0xbb2d('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xbb2d('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbb2d('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xbb2d('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xbb2d('0x4')],'set':function(_0x17a1e6){var _0x5896c3=moment(_0x17a1e6);var _0x2fbcff=moment(this[_0xbb2d('0x5')](_0xbb2d('0x6')))[_0xbb2d('0x7')](_0xbb2d('0x8'));var _0x40b661=_0x5896c3['diff'](_0x2fbcff,'seconds');this[_0xbb2d('0x9')](_0xbb2d('0xa'),_0x17a1e6);this['setDataValue']('holdtime',_0x40b661||null);}},'position':{'type':Sequelize[_0xbb2d('0xb')]},'count':{'type':Sequelize[_0xbb2d('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xbb2d('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xbb2d('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xbb2d('0x4')]},'queuecallerexit':{'type':Sequelize[_0xbb2d('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xbb2d('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xbb2d('0x3')],'comment':_0xbb2d('0xd')},'originalposition':{'type':Sequelize[_0xbb2d('0xb')]},'channel':{'type':Sequelize[_0xbb2d('0x3')]},'connectedlinenum':{'type':Sequelize[_0xbb2d('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xbb2d('0x3')]},'exten':{'type':Sequelize[_0xbb2d('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xbb2d('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xbb2d('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xbb2d('0x3')]},'transfer':{'type':Sequelize[_0xbb2d('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbb2d('0x3')],'comment':_0xbb2d('0xe')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xbb2d('0x3')]},'disposition':{'type':Sequelize[_0xbb2d('0x3')]},'secondDisposition':{'type':Sequelize[_0xbb2d('0x3')]},'thirdDisposition':{'type':Sequelize[_0xbb2d('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xbb2d('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 02dc6da..fd00185 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 _0x40dd=['./voiceQueueReport.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis'];(function(_0x3e36a2,_0x5a38fa){var _0x1dcc46=function(_0xfaebd7){while(--_0xfaebd7){_0x3e36a2['push'](_0x3e36a2['shift']());}};_0x1dcc46(++_0x5a38fa);}(_0x40dd,0x12a));var _0xd40d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x40dd[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xd40d('0x0'));var rimraf=require(_0xd40d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd40d('0x2'));var rp=require(_0xd40d('0x3'));var moment=require(_0xd40d('0x4'));var BPromise=require(_0xd40d('0x5'));var Mustache=require('mustache');var util=require(_0xd40d('0x6'));var path=require(_0xd40d('0x7'));var sox=require(_0xd40d('0x8'));var csv=require(_0xd40d('0x9'));var ejs=require(_0xd40d('0xa'));var fs=require('fs');var fs_extra=require(_0xd40d('0xb'));var _=require(_0xd40d('0xc'));var squel=require(_0xd40d('0xd'));var crypto=require(_0xd40d('0xe'));var jsforce=require(_0xd40d('0xf'));var deskjs=require(_0xd40d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd40d('0x11'));var Redis=require(_0xd40d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd40d('0x13'));var as=require(_0xd40d('0x14'));var hardwareService=require(_0xd40d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd40d('0x16'));var config=require(_0xd40d('0x17'));var licenseUtil=require(_0xd40d('0x18'));var db=require('../../mysqldb')['db'];config[_0xd40d('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd40d('0x19')]));require(_0xd40d('0x1a'))[_0xd40d('0x1b')](socket);function respondWithStatusCode(_0x550635,_0x591bff){_0x591bff=_0x591bff||0xcc;return function(_0x2b6dc1){if(_0x2b6dc1){return _0x550635[_0xd40d('0x1c')](_0x591bff);}return _0x550635['status'](_0x591bff)['end']();};}function respondWithResult(_0x4b1a63,_0x5094ce){_0x5094ce=_0x5094ce||0xc8;return function(_0x522c1b){if(_0x522c1b){return _0x4b1a63[_0xd40d('0x1d')](_0x5094ce)[_0xd40d('0x1e')](_0x522c1b);}};}function respondWithFilteredResult(_0x1644a3,_0x3fdd21){return function(_0x108952){if(_0x108952){var _0x22d76d=typeof _0x3fdd21['offset']===_0xd40d('0x1f')&&typeof _0x3fdd21[_0xd40d('0x20')]===_0xd40d('0x1f');var _0xb4fe34=_0x108952[_0xd40d('0x21')];var _0x3b760e=_0x22d76d?0x0:_0x3fdd21['offset'];var _0x6417f5=_0x22d76d?_0x108952[_0xd40d('0x21')]:_0x3fdd21[_0xd40d('0x22')]+_0x3fdd21[_0xd40d('0x20')];var _0x2ce683;if(_0x6417f5>=_0xb4fe34){_0x6417f5=_0xb4fe34;_0x2ce683=0xc8;}else{_0x2ce683=0xce;}_0x1644a3[_0xd40d('0x1d')](_0x2ce683);return _0x1644a3[_0xd40d('0x23')](_0xd40d('0x24'),_0x3b760e+'-'+_0x6417f5+'/'+_0xb4fe34)[_0xd40d('0x1e')](_0x108952);}return null;};}function patchUpdates(_0x3824ba){return function(_0x379719){try{jsonpatch[_0xd40d('0x25')](_0x379719,_0x3824ba,!![]);}catch(_0x33e2fe){return BPromise[_0xd40d('0x26')](_0x33e2fe);}return _0x379719[_0xd40d('0x27')]();};}function saveUpdates(_0x5d248f,_0x2187b1){return function(_0x444886){if(_0x444886){return _0x444886[_0xd40d('0x28')](_0x5d248f)[_0xd40d('0x29')](function(_0x427249){return _0x427249;});}return null;};}function removeEntity(_0x3080e9,_0x405ad9){return function(_0x529b0c){if(_0x529b0c){return _0x529b0c[_0xd40d('0x2a')]()[_0xd40d('0x29')](function(){_0x3080e9[_0xd40d('0x1d')](0xcc)[_0xd40d('0x2b')]();});}};}function handleEntityNotFound(_0x24e0dd,_0x3bc585){return function(_0x381db7){if(!_0x381db7){_0x24e0dd[_0xd40d('0x1c')](0x194);}return _0x381db7;};}function handleError(_0x1369d8,_0x55e5cc){_0x55e5cc=_0x55e5cc||0x1f4;return function(_0x3ed3b6){logger['error'](_0x3ed3b6['stack']);if(_0x3ed3b6[_0xd40d('0x2c')]){delete _0x3ed3b6['name'];}_0x1369d8[_0xd40d('0x1d')](_0x55e5cc)['send'](_0x3ed3b6);};}exports[_0xd40d('0x2d')]=function(_0x5203d2,_0x42f2d6){var _0x51b358={},_0x124efa={},_0x1fc044={'count':0x0,'rows':[]};var _0x2b552c=_[_0xd40d('0x2e')](db[_0xd40d('0x2f')][_0xd40d('0x30')],function(_0x49b427){return{'name':_0x49b427[_0xd40d('0x31')],'type':_0x49b427[_0xd40d('0x32')][_0xd40d('0x33')]};});_0x124efa[_0xd40d('0x34')]=_[_0xd40d('0x2e')](_0x2b552c,'name');_0x124efa[_0xd40d('0x35')]=_[_0xd40d('0x36')](_0x5203d2['query']);_0x124efa['filters']=_[_0xd40d('0x37')](_0x124efa[_0xd40d('0x34')],_0x124efa[_0xd40d('0x35')]);_0x51b358[_0xd40d('0x38')]=_['intersection'](_0x124efa[_0xd40d('0x34')],qs[_0xd40d('0x39')](_0x5203d2[_0xd40d('0x35')]['fields']));_0x51b358[_0xd40d('0x38')]=_0x51b358['attributes'][_0xd40d('0x3a')]?_0x51b358[_0xd40d('0x38')]:_0x124efa['model'];if(!_0x5203d2[_0xd40d('0x35')][_0xd40d('0x3b')](_0xd40d('0x3c'))){_0x51b358[_0xd40d('0x20')]=qs[_0xd40d('0x20')](_0x5203d2[_0xd40d('0x35')]['limit']);_0x51b358['offset']=qs[_0xd40d('0x22')](_0x5203d2[_0xd40d('0x35')][_0xd40d('0x22')]);}_0x51b358[_0xd40d('0x3d')]=qs[_0xd40d('0x3e')](_0x5203d2[_0xd40d('0x35')]['sort']);_0x51b358[_0xd40d('0x3f')]=qs[_0xd40d('0x40')](_[_0xd40d('0x41')](_0x5203d2[_0xd40d('0x35')],_0x124efa[_0xd40d('0x40')]),_0x2b552c);if(_0x5203d2['query'][_0xd40d('0x42')]){_0x51b358['where']=_[_0xd40d('0x43')](_0x51b358[_0xd40d('0x3f')],{'$or':_[_0xd40d('0x2e')](_0x2b552c,function(_0xd96188){if(_0xd96188[_0xd40d('0x32')]!==_0xd40d('0x44')){var _0xf4a86e={};_0xf4a86e[_0xd96188['name']]={'$like':'%'+_0x5203d2[_0xd40d('0x35')]['filter']+'%'};return _0xf4a86e;}})});}_0x51b358=_[_0xd40d('0x43')]({},_0x51b358,_0x5203d2[_0xd40d('0x45')]);var _0x82e0cf={'where':_0x51b358[_0xd40d('0x3f')]};return db[_0xd40d('0x2f')][_0xd40d('0x21')](_0x82e0cf)[_0xd40d('0x29')](function(_0x2886ed){_0x1fc044['count']=_0x2886ed;if(_0x5203d2['query'][_0xd40d('0x46')]){_0x51b358[_0xd40d('0x47')]=[{'all':!![]}];}return db[_0xd40d('0x2f')][_0xd40d('0x48')](_0x51b358);})[_0xd40d('0x29')](function(_0x2c7983){_0x1fc044[_0xd40d('0x49')]=_0x2c7983;return _0x1fc044;})[_0xd40d('0x29')](respondWithFilteredResult(_0x42f2d6,_0x51b358))[_0xd40d('0x4a')](handleError(_0x42f2d6,null));};exports[_0xd40d('0x4b')]=function(_0x550ede,_0xec757a){var _0x50c363={'raw':![],'where':{'id':_0x550ede[_0xd40d('0x4c')]['id']}},_0x52559c={};_0x52559c[_0xd40d('0x34')]=_[_0xd40d('0x36')](db[_0xd40d('0x2f')][_0xd40d('0x30')]);_0x52559c[_0xd40d('0x35')]=_[_0xd40d('0x36')](_0x550ede['query']);_0x52559c[_0xd40d('0x40')]=_[_0xd40d('0x37')](_0x52559c[_0xd40d('0x34')],_0x52559c[_0xd40d('0x35')]);_0x50c363[_0xd40d('0x38')]=_[_0xd40d('0x37')](_0x52559c[_0xd40d('0x34')],qs[_0xd40d('0x39')](_0x550ede[_0xd40d('0x35')][_0xd40d('0x39')]));_0x50c363['attributes']=_0x50c363[_0xd40d('0x38')]['length']?_0x50c363['attributes']:_0x52559c[_0xd40d('0x34')];if(_0x550ede['query']['includeAll']){_0x50c363[_0xd40d('0x47')]=[{'all':!![]}];}_0x50c363=_[_0xd40d('0x43')]({},_0x50c363,_0x550ede[_0xd40d('0x45')]);return db[_0xd40d('0x2f')][_0xd40d('0x4d')](_0x50c363)['then'](handleEntityNotFound(_0xec757a,null))['then'](respondWithResult(_0xec757a,null))[_0xd40d('0x4a')](handleError(_0xec757a,null));};exports['create']=function(_0x1ddb19,_0x23461e){return db[_0xd40d('0x2f')]['create'](_0x1ddb19[_0xd40d('0x4e')],{})['then'](respondWithResult(_0x23461e,0xc9))[_0xd40d('0x4a')](handleError(_0x23461e,null));};exports[_0xd40d('0x28')]=function(_0x39aadf,_0x5c8446){if(_0x39aadf[_0xd40d('0x4e')]['id']){delete _0x39aadf['body']['id'];}return db[_0xd40d('0x2f')][_0xd40d('0x4d')]({'where':{'id':_0x39aadf[_0xd40d('0x4c')]['id']}})[_0xd40d('0x29')](handleEntityNotFound(_0x5c8446,null))['then'](saveUpdates(_0x39aadf[_0xd40d('0x4e')],null))[_0xd40d('0x29')](respondWithResult(_0x5c8446,null))[_0xd40d('0x4a')](handleError(_0x5c8446,null));};exports[_0xd40d('0x2a')]=function(_0xc2238b,_0x3be545){return db[_0xd40d('0x2f')][_0xd40d('0x4d')]({'where':{'id':_0xc2238b[_0xd40d('0x4c')]['id']}})[_0xd40d('0x29')](handleEntityNotFound(_0x3be545,null))[_0xd40d('0x29')](removeEntity(_0x3be545,null))['catch'](handleError(_0x3be545,null));};exports[_0xd40d('0x4f')]=function(_0x3304b4,_0x4b828c){return db[_0xd40d('0x2f')][_0xd40d('0x4f')]()[_0xd40d('0x29')](respondWithResult(_0x4b828c,null))['catch'](handleError(_0x4b828c,null));};exports['getVoiceQueuesReport']=function(_0x19c6fc,_0x1566c0){var _0x39cda7={},_0x5395b0={},_0x58d47d={'count':0x0,'rows':[]};_0x5395b0[_0xd40d('0x34')]=_[_0xd40d('0x36')](db[_0xd40d('0x2f')][_0xd40d('0x30')]);_0x5395b0[_0xd40d('0x35')]=_[_0xd40d('0x36')](_0x19c6fc[_0xd40d('0x35')]);_0x5395b0['filters']=_[_0xd40d('0x37')](_0x5395b0[_0xd40d('0x34')],_0x5395b0[_0xd40d('0x35')]);_0x39cda7['attributes']=_['intersection'](_0x5395b0['model'],qs['fields'](_0x19c6fc[_0xd40d('0x35')]['fields']));_0x39cda7[_0xd40d('0x38')]=_0x39cda7[_0xd40d('0x38')]['length']?_0x39cda7[_0xd40d('0x38')]:_0x5395b0[_0xd40d('0x34')];if(!_0x19c6fc[_0xd40d('0x35')][_0xd40d('0x3b')]('nolimit')){_0x39cda7[_0xd40d('0x20')]=qs[_0xd40d('0x20')](_0x19c6fc[_0xd40d('0x35')]['limit']);_0x39cda7[_0xd40d('0x22')]=qs['offset'](_0x19c6fc[_0xd40d('0x35')][_0xd40d('0x22')]);}_0x39cda7[_0xd40d('0x3d')]=qs['sort'](_0x19c6fc[_0xd40d('0x35')][_0xd40d('0x3e')]);_0x39cda7[_0xd40d('0x3f')]=qs[_0xd40d('0x40')](_['pick'](_0x19c6fc['query'],_0x5395b0['filters']));if(_0x19c6fc['query'][_0xd40d('0x42')]){_0x39cda7[_0xd40d('0x3f')]=_[_0xd40d('0x43')](_0x39cda7['where'],{'$or':_[_0xd40d('0x2e')](_0x39cda7['attributes'],function(_0x4a48a9){var _0xd0ab88={};_0xd0ab88[_0x4a48a9]={'$like':'%'+_0x19c6fc['query']['filter']+'%'};return _0xd0ab88;})});}_0x39cda7=_['merge']({},_0x39cda7,_0x19c6fc[_0xd40d('0x45')]);var _0x80f7a0={'where':_0x39cda7[_0xd40d('0x3f')]};return db[_0xd40d('0x2f')][_0xd40d('0x21')](_0x80f7a0)[_0xd40d('0x29')](function(_0x2fbd4c){_0x58d47d[_0xd40d('0x21')]=_0x2fbd4c;if(_0x19c6fc[_0xd40d('0x35')][_0xd40d('0x46')]){_0x39cda7[_0xd40d('0x47')]=[{'all':!![]}];}return db[_0xd40d('0x2f')][_0xd40d('0x48')](_0x39cda7);})[_0xd40d('0x29')](function(_0x27f70c){_0x58d47d[_0xd40d('0x49')]=_0x27f70c;return _0x58d47d;})['then'](respondWithFilteredResult(_0x1566c0,_0x39cda7,_0xd40d('0x50')))[_0xd40d('0x4a')](handleError(_0x1566c0,null,_0xd40d('0x50')));}; \ No newline at end of file +var _0x9823=['map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','filters','VoiceQueueReport','find','body','params','describe','getVoiceQueuesReport','nolimit','order','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','error','name','index'];(function(_0xe6bc6a,_0x414bca){var _0x365831=function(_0x3025de){while(--_0x3025de){_0xe6bc6a['push'](_0xe6bc6a['shift']());}};_0x365831(++_0x414bca);}(_0x9823,0x74));var _0x3982=function(_0x4a064c,_0x2976f6){_0x4a064c=_0x4a064c-0x0;var _0x407da0=_0x9823[_0x4a064c];return _0x407da0;};'use strict';var emlformat=require(_0x3982('0x0'));var rimraf=require(_0x3982('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3982('0x2'));var rp=require(_0x3982('0x3'));var moment=require(_0x3982('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3982('0x5'));var util=require(_0x3982('0x6'));var path=require(_0x3982('0x7'));var sox=require(_0x3982('0x8'));var csv=require('to-csv');var ejs=require(_0x3982('0x9'));var fs=require('fs');var fs_extra=require(_0x3982('0xa'));var _=require(_0x3982('0xb'));var squel=require(_0x3982('0xc'));var crypto=require(_0x3982('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3982('0xe'));var querystring=require(_0x3982('0xf'));var Papa=require(_0x3982('0x10'));var Redis=require(_0x3982('0x11'));var authService=require(_0x3982('0x12'));var qs=require(_0x3982('0x13'));var as=require(_0x3982('0x14'));var hardwareService=require(_0x3982('0x15'));var logger=require(_0x3982('0x16'))(_0x3982('0x17'));var utils=require(_0x3982('0x18'));var config=require(_0x3982('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3982('0x1a'))['db'];config[_0x3982('0x1b')]=_[_0x3982('0x1c')](config['redis'],{'host':_0x3982('0x1d'),'port':0x18eb});var socket=require(_0x3982('0x1e'))(new Redis(config[_0x3982('0x1b')]));require('./voiceQueueReport.socket')[_0x3982('0x1f')](socket);function respondWithStatusCode(_0x2c90b1,_0x4513fb){_0x4513fb=_0x4513fb||0xcc;return function(_0x222ff4){if(_0x222ff4){return _0x2c90b1[_0x3982('0x20')](_0x4513fb);}return _0x2c90b1[_0x3982('0x21')](_0x4513fb)['end']();};}function respondWithResult(_0x104228,_0x45a3a8){_0x45a3a8=_0x45a3a8||0xc8;return function(_0x419d18){if(_0x419d18){return _0x104228[_0x3982('0x21')](_0x45a3a8)['json'](_0x419d18);}};}function respondWithFilteredResult(_0x4a0931,_0xdf0508){return function(_0x4fde5f){if(_0x4fde5f){var _0x28019a=typeof _0xdf0508['offset']==='undefined'&&typeof _0xdf0508['limit']===_0x3982('0x22');var _0x28df20=_0x4fde5f[_0x3982('0x23')];var _0x335601=_0x28019a?0x0:_0xdf0508[_0x3982('0x24')];var _0x260a24=_0x28019a?_0x4fde5f[_0x3982('0x23')]:_0xdf0508[_0x3982('0x24')]+_0xdf0508[_0x3982('0x25')];var _0x53b8fb;if(_0x260a24>=_0x28df20){_0x260a24=_0x28df20;_0x53b8fb=0xc8;}else{_0x53b8fb=0xce;}_0x4a0931['status'](_0x53b8fb);return _0x4a0931[_0x3982('0x26')](_0x3982('0x27'),_0x335601+'-'+_0x260a24+'/'+_0x28df20)[_0x3982('0x28')](_0x4fde5f);}return null;};}function patchUpdates(_0x2d5a71){return function(_0x4bb912){try{jsonpatch['apply'](_0x4bb912,_0x2d5a71,!![]);}catch(_0x7f94ce){return BPromise[_0x3982('0x29')](_0x7f94ce);}return _0x4bb912['save']();};}function saveUpdates(_0x5783fa,_0x4cadf1){return function(_0x3fe7aa){if(_0x3fe7aa){return _0x3fe7aa[_0x3982('0x2a')](_0x5783fa)[_0x3982('0x2b')](function(_0x4abe97){return _0x4abe97;});}return null;};}function removeEntity(_0x215db6,_0x13dbd9){return function(_0x312660){if(_0x312660){return _0x312660[_0x3982('0x2c')]()['then'](function(){_0x215db6[_0x3982('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x86c469,_0x258f04){return function(_0x2de8d4){if(!_0x2de8d4){_0x86c469[_0x3982('0x20')](0x194);}return _0x2de8d4;};}function handleError(_0x48f2fc,_0x8f3e92){_0x8f3e92=_0x8f3e92||0x1f4;return function(_0xfec569){logger[_0x3982('0x2d')](_0xfec569['stack']);if(_0xfec569[_0x3982('0x2e')]){delete _0xfec569['name'];}_0x48f2fc[_0x3982('0x21')](_0x8f3e92)['send'](_0xfec569);};}exports[_0x3982('0x2f')]=function(_0xeee2a3,_0x389896){var _0xafcdaf={},_0x3998ea={},_0x40df43={'count':0x0,'rows':[]};var _0x2de886=_[_0x3982('0x30')](db['VoiceQueueReport'][_0x3982('0x31')],function(_0x3751d1){return{'name':_0x3751d1[_0x3982('0x32')],'type':_0x3751d1[_0x3982('0x33')][_0x3982('0x34')]};});_0x3998ea[_0x3982('0x35')]=_[_0x3982('0x30')](_0x2de886,_0x3982('0x2e'));_0x3998ea['query']=_[_0x3982('0x36')](_0xeee2a3['query']);_0x3998ea['filters']=_[_0x3982('0x37')](_0x3998ea[_0x3982('0x35')],_0x3998ea[_0x3982('0x38')]);_0xafcdaf[_0x3982('0x39')]=_[_0x3982('0x37')](_0x3998ea[_0x3982('0x35')],qs[_0x3982('0x3a')](_0xeee2a3[_0x3982('0x38')][_0x3982('0x3a')]));_0xafcdaf[_0x3982('0x39')]=_0xafcdaf['attributes'][_0x3982('0x3b')]?_0xafcdaf['attributes']:_0x3998ea['model'];if(!_0xeee2a3[_0x3982('0x38')][_0x3982('0x3c')]('nolimit')){_0xafcdaf[_0x3982('0x25')]=qs[_0x3982('0x25')](_0xeee2a3['query'][_0x3982('0x25')]);_0xafcdaf[_0x3982('0x24')]=qs['offset'](_0xeee2a3[_0x3982('0x38')]['offset']);}_0xafcdaf['order']=qs[_0x3982('0x3d')](_0xeee2a3['query'][_0x3982('0x3d')]);_0xafcdaf[_0x3982('0x3e')]=qs['filters'](_[_0x3982('0x3f')](_0xeee2a3[_0x3982('0x38')],_0x3998ea['filters']),_0x2de886);if(_0xeee2a3[_0x3982('0x38')][_0x3982('0x40')]){_0xafcdaf[_0x3982('0x3e')]=_[_0x3982('0x41')](_0xafcdaf[_0x3982('0x3e')],{'$or':_[_0x3982('0x30')](_0x2de886,function(_0xbcd988){if(_0xbcd988[_0x3982('0x33')]!==_0x3982('0x42')){var _0xb85957={};_0xb85957[_0xbcd988[_0x3982('0x2e')]]={'$like':'%'+_0xeee2a3[_0x3982('0x38')][_0x3982('0x40')]+'%'};return _0xb85957;}})});}_0xafcdaf=_[_0x3982('0x41')]({},_0xafcdaf,_0xeee2a3[_0x3982('0x43')]);var _0x2e553c={'where':_0xafcdaf['where']};return db['VoiceQueueReport']['count'](_0x2e553c)[_0x3982('0x2b')](function(_0x2b8200){_0x40df43[_0x3982('0x23')]=_0x2b8200;if(_0xeee2a3['query'][_0x3982('0x44')]){_0xafcdaf[_0x3982('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x3982('0x46')](_0xafcdaf);})['then'](function(_0x5e88f3){_0x40df43[_0x3982('0x47')]=_0x5e88f3;return _0x40df43;})[_0x3982('0x2b')](respondWithFilteredResult(_0x389896,_0xafcdaf))[_0x3982('0x48')](handleError(_0x389896,null));};exports['show']=function(_0x5815ae,_0x30d9a7){var _0x3fefd9={'raw':![],'where':{'id':_0x5815ae['params']['id']}},_0x1341f6={};_0x1341f6[_0x3982('0x35')]=_[_0x3982('0x36')](db['VoiceQueueReport'][_0x3982('0x31')]);_0x1341f6[_0x3982('0x38')]=_[_0x3982('0x36')](_0x5815ae[_0x3982('0x38')]);_0x1341f6[_0x3982('0x49')]=_[_0x3982('0x37')](_0x1341f6[_0x3982('0x35')],_0x1341f6['query']);_0x3fefd9[_0x3982('0x39')]=_[_0x3982('0x37')](_0x1341f6[_0x3982('0x35')],qs[_0x3982('0x3a')](_0x5815ae[_0x3982('0x38')][_0x3982('0x3a')]));_0x3fefd9[_0x3982('0x39')]=_0x3fefd9['attributes'][_0x3982('0x3b')]?_0x3fefd9[_0x3982('0x39')]:_0x1341f6[_0x3982('0x35')];if(_0x5815ae['query'][_0x3982('0x44')]){_0x3fefd9['include']=[{'all':!![]}];}_0x3fefd9=_[_0x3982('0x41')]({},_0x3fefd9,_0x5815ae[_0x3982('0x43')]);return db[_0x3982('0x4a')][_0x3982('0x4b')](_0x3fefd9)[_0x3982('0x2b')](handleEntityNotFound(_0x30d9a7,null))[_0x3982('0x2b')](respondWithResult(_0x30d9a7,null))[_0x3982('0x48')](handleError(_0x30d9a7,null));};exports['create']=function(_0x5785eb,_0x19dac0){return db[_0x3982('0x4a')]['create'](_0x5785eb[_0x3982('0x4c')],{})['then'](respondWithResult(_0x19dac0,0xc9))[_0x3982('0x48')](handleError(_0x19dac0,null));};exports[_0x3982('0x2a')]=function(_0x5b033b,_0x598d79){if(_0x5b033b[_0x3982('0x4c')]['id']){delete _0x5b033b['body']['id'];}return db[_0x3982('0x4a')][_0x3982('0x4b')]({'where':{'id':_0x5b033b['params']['id']}})[_0x3982('0x2b')](handleEntityNotFound(_0x598d79,null))[_0x3982('0x2b')](saveUpdates(_0x5b033b[_0x3982('0x4c')],null))[_0x3982('0x2b')](respondWithResult(_0x598d79,null))[_0x3982('0x48')](handleError(_0x598d79,null));};exports[_0x3982('0x2c')]=function(_0x560bce,_0x57e409){return db[_0x3982('0x4a')]['find']({'where':{'id':_0x560bce[_0x3982('0x4d')]['id']}})[_0x3982('0x2b')](handleEntityNotFound(_0x57e409,null))[_0x3982('0x2b')](removeEntity(_0x57e409,null))['catch'](handleError(_0x57e409,null));};exports[_0x3982('0x4e')]=function(_0x381f04,_0x84988f){return db[_0x3982('0x4a')]['describe']()['then'](respondWithResult(_0x84988f,null))['catch'](handleError(_0x84988f,null));};exports[_0x3982('0x4f')]=function(_0x2c285b,_0x57191d){var _0x5f0abe={},_0x4cd2c7={},_0x49bd87={'count':0x0,'rows':[]};_0x4cd2c7[_0x3982('0x35')]=_[_0x3982('0x36')](db[_0x3982('0x4a')][_0x3982('0x31')]);_0x4cd2c7['query']=_[_0x3982('0x36')](_0x2c285b[_0x3982('0x38')]);_0x4cd2c7[_0x3982('0x49')]=_['intersection'](_0x4cd2c7['model'],_0x4cd2c7[_0x3982('0x38')]);_0x5f0abe[_0x3982('0x39')]=_['intersection'](_0x4cd2c7[_0x3982('0x35')],qs[_0x3982('0x3a')](_0x2c285b[_0x3982('0x38')][_0x3982('0x3a')]));_0x5f0abe[_0x3982('0x39')]=_0x5f0abe[_0x3982('0x39')][_0x3982('0x3b')]?_0x5f0abe['attributes']:_0x4cd2c7[_0x3982('0x35')];if(!_0x2c285b[_0x3982('0x38')][_0x3982('0x3c')](_0x3982('0x50'))){_0x5f0abe[_0x3982('0x25')]=qs[_0x3982('0x25')](_0x2c285b[_0x3982('0x38')][_0x3982('0x25')]);_0x5f0abe[_0x3982('0x24')]=qs[_0x3982('0x24')](_0x2c285b[_0x3982('0x38')]['offset']);}_0x5f0abe[_0x3982('0x51')]=qs['sort'](_0x2c285b['query']['sort']);_0x5f0abe[_0x3982('0x3e')]=qs['filters'](_[_0x3982('0x3f')](_0x2c285b[_0x3982('0x38')],_0x4cd2c7[_0x3982('0x49')]));if(_0x2c285b[_0x3982('0x38')]['filter']){_0x5f0abe[_0x3982('0x3e')]=_[_0x3982('0x41')](_0x5f0abe[_0x3982('0x3e')],{'$or':_['map'](_0x5f0abe[_0x3982('0x39')],function(_0x3bd079){var _0x4e3cb4={};_0x4e3cb4[_0x3bd079]={'$like':'%'+_0x2c285b[_0x3982('0x38')][_0x3982('0x40')]+'%'};return _0x4e3cb4;})});}_0x5f0abe=_[_0x3982('0x41')]({},_0x5f0abe,_0x2c285b[_0x3982('0x43')]);var _0x1c6a2d={'where':_0x5f0abe[_0x3982('0x3e')]};return db[_0x3982('0x4a')]['count'](_0x1c6a2d)[_0x3982('0x2b')](function(_0x450d1a){_0x49bd87[_0x3982('0x23')]=_0x450d1a;if(_0x2c285b['query']['includeAll']){_0x5f0abe[_0x3982('0x45')]=[{'all':!![]}];}return db[_0x3982('0x4a')]['findAll'](_0x5f0abe);})[_0x3982('0x2b')](function(_0x2471b0){_0x49bd87[_0x3982('0x47')]=_0x2471b0;return _0x49bd87;})['then'](respondWithFilteredResult(_0x57191d,_0x5f0abe,_0x3982('0x4f')))[_0x3982('0x48')](handleError(_0x57191d,null,_0x3982('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ffbdabd..d355059 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 _0x983c=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1fa841,_0x37a70c){var _0x384b67=function(_0x248c40){while(--_0x248c40){_0x1fa841['push'](_0x1fa841['shift']());}};_0x384b67(++_0x37a70c);}(_0x983c,0x154));var _0xc983=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x983c[_0x5e238b];return _0x389bea;};'use strict';var EventEmitter=require(_0xc983('0x0'));var VoiceQueueReport=require(_0xc983('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc983('0x2')](0x0);var events={'afterCreate':_0xc983('0x3'),'afterUpdate':_0xc983('0x4'),'afterDestroy':_0xc983('0x5')};function emitEvent(_0x384d0a){return function(_0x1bddfe,_0x1ea523,_0x2119a7){VoiceQueueReportEvents[_0xc983('0x6')](_0x384d0a+':'+_0x1bddfe['id'],_0x1bddfe);VoiceQueueReportEvents['emit'](_0x384d0a,_0x1bddfe);_0x2119a7(null);};}for(var e in events){if(events[_0xc983('0x7')](e)){var event=events[e];VoiceQueueReport[_0xc983('0x8')](e,emitEvent(event));}}module[_0xc983('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x00a9=['remove','emit','hook','exports','events','VoiceQueueReport','save','update'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x00a9,0x154));var _0x900a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x00a9[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x900a('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x900a('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x900a('0x2'),'afterUpdate':_0x900a('0x3'),'afterDestroy':_0x900a('0x4')};function emitEvent(_0x4042cd){return function(_0x1e798c,_0x1a947e,_0x409ada){VoiceQueueReportEvents[_0x900a('0x5')](_0x4042cd+':'+_0x1e798c['id'],_0x1e798c);VoiceQueueReportEvents[_0x900a('0x5')](_0x4042cd,_0x1e798c);_0x409ada(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x900a('0x6')](e,emitEvent(event));}}module[_0x900a('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c0f82d1..2b7dc27 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 _0xc0a8=['request-promise','path','rimraf','exports','define','VoiceQueueReport','report_queue','uniqueid','lodash','../../config/logger','moment','bluebird'];(function(_0x384e15,_0x13a1f2){var _0x1a7809=function(_0xdd0de3){while(--_0xdd0de3){_0x384e15['push'](_0x384e15['shift']());}};_0x1a7809(++_0x13a1f2);}(_0xc0a8,0xbc));var _0x8c0a=function(_0x426a1e,_0x427f6f){_0x426a1e=_0x426a1e-0x0;var _0x26d40e=_0xc0a8[_0x426a1e];return _0x26d40e;};'use strict';var _=require(_0x8c0a('0x0'));var util=require('util');var logger=require(_0x8c0a('0x1'))('api');var moment=require(_0x8c0a('0x2'));var BPromise=require(_0x8c0a('0x3'));var rp=require(_0x8c0a('0x4'));var fs=require('fs');var path=require(_0x8c0a('0x5'));var rimraf=require(_0x8c0a('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0x8c0a('0x7')]=function(_0x474e24,_0x3f3057){return _0x474e24[_0x8c0a('0x8')](_0x8c0a('0x9'),attributes,{'tableName':_0x8c0a('0xa'),'paranoid':![],'indexes':[{'fields':[_0x8c0a('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe256=['report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport'];(function(_0x30fad2,_0x2e8a02){var _0x5ee612=function(_0x13c97b){while(--_0x13c97b){_0x30fad2['push'](_0x30fad2['shift']());}};_0x5ee612(++_0x2e8a02);}(_0xe256,0x163));var _0x6e25=function(_0x23b1c4,_0x4f8d5f){_0x23b1c4=_0x23b1c4-0x0;var _0x3be01f=_0xe256[_0x23b1c4];return _0x3be01f;};'use strict';var _=require(_0x6e25('0x0'));var util=require(_0x6e25('0x1'));var logger=require(_0x6e25('0x2'))(_0x6e25('0x3'));var moment=require(_0x6e25('0x4'));var BPromise=require(_0x6e25('0x5'));var rp=require(_0x6e25('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e25('0x7'));var config=require(_0x6e25('0x8'));var attributes=require(_0x6e25('0x9'));module[_0x6e25('0xa')]=function(_0x104c1c,_0x20d66f){return _0x104c1c[_0x6e25('0xb')](_0x6e25('0xc'),attributes,{'tableName':_0x6e25('0xd'),'paranoid':![],'indexes':[{'fields':[_0x6e25('0xe')]},{'fields':[_0x6e25('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 0092885..9b34167 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 _0x0860=['raw','where','limit','UpdateVoiceQueueReport','lodash','bluebird','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','GetVoiceQueueReport','VoiceQueueReport','findAll','options','include','map','model','attributes','CreateVoiceQueueReport','create','body','stringify','catch','update'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0x0860,0x151));var _0x0086=function(_0x4da0c5,_0x579420){_0x4da0c5=_0x4da0c5-0x0;var _0x1a311f=_0x0860[_0x4da0c5];return _0x1a311f;};'use strict';var _=require(_0x0086('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0086('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0086('0x2'))['db'];var utils=require(_0x0086('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x0086('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x0086('0x5')][_0x0086('0x6')]({'port':0x232a});config[_0x0086('0x7')]=_[_0x0086('0x8')](config['redis'],{'host':_0x0086('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x83a5de,_0x4ba800,_0x4e0850){return new BPromise(function(_0x255ab3,_0x310193){return client['request'](_0x83a5de,_0x4e0850)[_0x0086('0xa')](function(_0x16bbab){logger[_0x0086('0xb')](_0x0086('0xc'),_0x4ba800,_0x0086('0xd'));logger[_0x0086('0xe')](_0x0086('0xf'),_0x4ba800,'request\x20sent',JSON['stringify'](_0x16bbab));if(_0x16bbab[_0x0086('0x10')]){if(_0x16bbab[_0x0086('0x10')][_0x0086('0x11')]===0x1f4){logger[_0x0086('0x10')](_0x0086('0xc'),_0x4ba800,_0x16bbab[_0x0086('0x10')][_0x0086('0x12')]);return _0x310193(_0x16bbab[_0x0086('0x10')]['message']);}logger[_0x0086('0x10')](_0x0086('0xc'),_0x4ba800,_0x16bbab['error'][_0x0086('0x12')]);return _0x255ab3(_0x16bbab['error'][_0x0086('0x12')]);}else{logger[_0x0086('0xb')](_0x0086('0xc'),_0x4ba800,_0x0086('0xd'));_0x255ab3(_0x16bbab['result']['message']);}})['catch'](function(_0x3d4e7b){logger['error'](_0x0086('0xc'),_0x4ba800,_0x3d4e7b);_0x310193(_0x3d4e7b);});});}exports[_0x0086('0x13')]=function(_0x379acf){var _0x5b2120=this;return new Promise(function(_0x497fdb,_0x57bee5){return db[_0x0086('0x14')][_0x0086('0x15')]({'raw':_0x379acf[_0x0086('0x16')]?_0x379acf[_0x0086('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x379acf['options']?_0x379acf[_0x0086('0x16')]['where']||null:null,'attributes':_0x379acf['options']?_0x379acf['options']['attributes']||null:null,'limit':_0x379acf[_0x0086('0x16')]?_0x379acf[_0x0086('0x16')]['limit']||null:null,'include':_0x379acf[_0x0086('0x16')]?_0x379acf['options'][_0x0086('0x17')]?_[_0x0086('0x18')](_0x379acf[_0x0086('0x16')]['include'],function(_0x1ece36){return{'model':db[_0x1ece36[_0x0086('0x19')]],'as':_0x1ece36['as'],'attributes':_0x1ece36[_0x0086('0x1a')],'include':_0x1ece36[_0x0086('0x17')]?_[_0x0086('0x18')](_0x1ece36[_0x0086('0x17')],function(_0x50c5c8){return{'model':db[_0x50c5c8[_0x0086('0x19')]],'as':_0x50c5c8['as'],'attributes':_0x50c5c8['attributes'],'include':_0x50c5c8[_0x0086('0x17')]?_[_0x0086('0x18')](_0x50c5c8[_0x0086('0x17')],function(_0x21cb1f){return{'model':db[_0x21cb1f['model']],'as':_0x21cb1f['as'],'attributes':_0x21cb1f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x17654d){logger['info'](_0x0086('0x13'),_0x379acf);logger[_0x0086('0xe')](_0x0086('0x13'),_0x379acf,JSON['stringify'](_0x17654d));_0x497fdb(_0x17654d);})['catch'](function(_0x49f77b){logger[_0x0086('0x10')](_0x0086('0x13'),_0x49f77b[_0x0086('0x12')],_0x379acf);_0x57bee5(_0x5b2120['error'](0x1f4,_0x49f77b['message']));});});};exports[_0x0086('0x1b')]=function(_0x2ad59){var _0x24bd0d=this;return new Promise(function(_0x393ee9,_0x3f8a0e){return db['VoiceQueueReport'][_0x0086('0x1c')](_0x2ad59[_0x0086('0x1d')],{'raw':_0x2ad59['options']?_0x2ad59[_0x0086('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x0086('0xa')](function(_0x4a5ce8){logger[_0x0086('0xb')](_0x0086('0x1b'),_0x2ad59);logger[_0x0086('0xe')](_0x0086('0x1b'),_0x2ad59,JSON[_0x0086('0x1e')](_0x4a5ce8));_0x393ee9(_0x4a5ce8);})[_0x0086('0x1f')](function(_0x4924a2){logger['error'](_0x0086('0x1b'),_0x4924a2[_0x0086('0x12')],_0x2ad59);_0x3f8a0e(_0x24bd0d[_0x0086('0x10')](0x1f4,_0x4924a2[_0x0086('0x12')]));});});};exports['UpdateVoiceQueueReport']=function(_0x38da2c){var _0x9c82b5=this;return new Promise(function(_0x65c9a2,_0xf3d074){return db['VoiceQueueReport'][_0x0086('0x20')](_0x38da2c[_0x0086('0x1d')],{'raw':_0x38da2c['options']?_0x38da2c[_0x0086('0x16')][_0x0086('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38da2c[_0x0086('0x16')]?_0x38da2c[_0x0086('0x16')][_0x0086('0x22')]||null:null,'attributes':_0x38da2c[_0x0086('0x16')]?_0x38da2c['options'][_0x0086('0x1a')]||null:null,'limit':_0x38da2c[_0x0086('0x16')]?_0x38da2c['options'][_0x0086('0x23')]||null:null})['then'](function(_0x9cd981){logger['info'](_0x0086('0x24'),_0x38da2c);logger['debug'](_0x0086('0x24'),_0x38da2c,JSON[_0x0086('0x1e')](_0x9cd981));_0x65c9a2(_0x9cd981);})[_0x0086('0x1f')](function(_0x4b8f82){logger[_0x0086('0x10')](_0x0086('0x24'),_0x4b8f82[_0x0086('0x12')],_0x38da2c);_0xf3d074(_0x9c82b5[_0x0086('0x10')](0x1f4,_0x4b8f82[_0x0086('0x12')]));});});}; \ No newline at end of file +var _0x21d5=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','model','map','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x21d5,0x12b));var _0x521d=function(_0x2e35de,_0x439d2f){_0x2e35de=_0x2e35de-0x0;var _0xe2b87b=_0x21d5[_0x2e35de];return _0xe2b87b;};'use strict';var _=require(_0x521d('0x0'));var util=require(_0x521d('0x1'));var moment=require(_0x521d('0x2'));var BPromise=require(_0x521d('0x3'));var rs=require(_0x521d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x521d('0x5'))['db'];var utils=require(_0x521d('0x6'));var logger=require(_0x521d('0x7'))(_0x521d('0x8'));var config=require(_0x521d('0x9'));var jayson=require(_0x521d('0xa'));var client=jayson[_0x521d('0xb')][_0x521d('0xc')]({'port':0x232a});config[_0x521d('0xd')]=_[_0x521d('0xe')](config[_0x521d('0xd')],{'host':_0x521d('0xf'),'port':0x18eb});var socket=require(_0x521d('0x10'))(new Redis(config[_0x521d('0xd')]));require('./voiceQueueReport.socket')[_0x521d('0x11')](socket);function respondWithRpcPromise(_0xd8f98e,_0x4ef931,_0x2b1577){return new BPromise(function(_0xd699ea,_0x466407){return client['request'](_0xd8f98e,_0x2b1577)[_0x521d('0x12')](function(_0x106b33){logger['info'](_0x521d('0x13'),_0x4ef931,_0x521d('0x14'));logger[_0x521d('0x15')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x4ef931,_0x521d('0x14'),JSON[_0x521d('0x16')](_0x106b33));if(_0x106b33['error']){if(_0x106b33[_0x521d('0x17')]['code']===0x1f4){logger[_0x521d('0x17')](_0x521d('0x13'),_0x4ef931,_0x106b33[_0x521d('0x17')]['message']);return _0x466407(_0x106b33['error'][_0x521d('0x18')]);}logger['error'](_0x521d('0x13'),_0x4ef931,_0x106b33[_0x521d('0x17')][_0x521d('0x18')]);return _0xd699ea(_0x106b33['error'][_0x521d('0x18')]);}else{logger[_0x521d('0x19')](_0x521d('0x13'),_0x4ef931,_0x521d('0x14'));_0xd699ea(_0x106b33[_0x521d('0x1a')][_0x521d('0x18')]);}})[_0x521d('0x1b')](function(_0x20e731){logger[_0x521d('0x17')](_0x521d('0x13'),_0x4ef931,_0x20e731);_0x466407(_0x20e731);});});}exports[_0x521d('0x1c')]=function(_0x202d4c){var _0x28a0ae=this;return new Promise(function(_0x511337,_0x15a44e){return db[_0x521d('0x1d')][_0x521d('0x1e')]({'raw':_0x202d4c[_0x521d('0x1f')]?_0x202d4c[_0x521d('0x1f')][_0x521d('0x20')]===undefined?!![]:![]:!![],'where':_0x202d4c['options']?_0x202d4c['options']['where']||null:null,'attributes':_0x202d4c['options']?_0x202d4c[_0x521d('0x1f')][_0x521d('0x21')]||null:null,'limit':_0x202d4c[_0x521d('0x1f')]?_0x202d4c[_0x521d('0x1f')][_0x521d('0x22')]||null:null,'include':_0x202d4c[_0x521d('0x1f')]?_0x202d4c[_0x521d('0x1f')][_0x521d('0x23')]?_['map'](_0x202d4c[_0x521d('0x1f')][_0x521d('0x23')],function(_0x2e8b9f){return{'model':db[_0x2e8b9f[_0x521d('0x24')]],'as':_0x2e8b9f['as'],'attributes':_0x2e8b9f[_0x521d('0x21')],'include':_0x2e8b9f['include']?_[_0x521d('0x25')](_0x2e8b9f[_0x521d('0x23')],function(_0x3325a1){return{'model':db[_0x3325a1[_0x521d('0x24')]],'as':_0x3325a1['as'],'attributes':_0x3325a1[_0x521d('0x21')],'include':_0x3325a1[_0x521d('0x23')]?_['map'](_0x3325a1[_0x521d('0x23')],function(_0x5b45cb){return{'model':db[_0x5b45cb[_0x521d('0x24')]],'as':_0x5b45cb['as'],'attributes':_0x5b45cb[_0x521d('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x126649){logger[_0x521d('0x19')]('GetVoiceQueueReport',_0x202d4c);logger[_0x521d('0x15')](_0x521d('0x1c'),_0x202d4c,JSON['stringify'](_0x126649));_0x511337(_0x126649);})[_0x521d('0x1b')](function(_0x5625fb){logger[_0x521d('0x17')](_0x521d('0x1c'),_0x5625fb[_0x521d('0x18')],_0x202d4c);_0x15a44e(_0x28a0ae[_0x521d('0x17')](0x1f4,_0x5625fb[_0x521d('0x18')]));});});};exports[_0x521d('0x26')]=function(_0x363ce7){var _0x197cd4=this;return new Promise(function(_0x285d18,_0x352ee3){return db['VoiceQueueReport'][_0x521d('0x27')](_0x363ce7[_0x521d('0x28')],{'raw':_0x363ce7[_0x521d('0x1f')]?_0x363ce7[_0x521d('0x1f')][_0x521d('0x20')]===undefined?!![]:![]:!![]})[_0x521d('0x12')](function(_0x3c7707){logger[_0x521d('0x19')]('CreateVoiceQueueReport',_0x363ce7);logger[_0x521d('0x15')](_0x521d('0x26'),_0x363ce7,JSON[_0x521d('0x16')](_0x3c7707));_0x285d18(_0x3c7707);})[_0x521d('0x1b')](function(_0x1c2c24){logger['error'](_0x521d('0x26'),_0x1c2c24[_0x521d('0x18')],_0x363ce7);_0x352ee3(_0x197cd4[_0x521d('0x17')](0x1f4,_0x1c2c24[_0x521d('0x18')]));});});};exports[_0x521d('0x29')]=function(_0x20d719){var _0x4441a7=this;return new Promise(function(_0x47cca8,_0x25f01f){return db[_0x521d('0x1d')][_0x521d('0x2a')](_0x20d719['body'],{'raw':_0x20d719[_0x521d('0x1f')]?_0x20d719[_0x521d('0x1f')][_0x521d('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20d719[_0x521d('0x1f')]?_0x20d719[_0x521d('0x1f')]['where']||null:null,'attributes':_0x20d719[_0x521d('0x1f')]?_0x20d719[_0x521d('0x1f')]['attributes']||null:null,'limit':_0x20d719[_0x521d('0x1f')]?_0x20d719[_0x521d('0x1f')][_0x521d('0x22')]||null:null})[_0x521d('0x12')](function(_0x377753){logger[_0x521d('0x19')](_0x521d('0x29'),_0x20d719);logger[_0x521d('0x15')](_0x521d('0x29'),_0x20d719,JSON[_0x521d('0x16')](_0x377753));_0x47cca8(_0x377753);})['catch'](function(_0x4fc65e){logger[_0x521d('0x17')](_0x521d('0x29'),_0x4fc65e[_0x521d('0x18')],_0x20d719);_0x25f01f(_0x4441a7[_0x521d('0x17')](0x1f4,_0x4fc65e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 67c14d7..f0ad0f4 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 _0x3937=['register','length','./voiceQueueReport.events','remove','update','emit','removeListener'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3937,0xbf));var _0x7393=function(_0x290f55,_0x4a946c){_0x290f55=_0x290f55-0x0;var _0x2ae65a=_0x3937[_0x290f55];return _0x2ae65a;};'use strict';var VoiceQueueReportEvents=require(_0x7393('0x0'));var events=['save',_0x7393('0x1'),_0x7393('0x2')];function createListener(_0x49aa96,_0x45cd02){return function(_0x503841){_0x45cd02[_0x7393('0x3')](_0x49aa96,_0x503841);};}function removeListener(_0x4c9c71,_0x992b15){return function(){VoiceQueueReportEvents[_0x7393('0x4')](_0x4c9c71,_0x992b15);};}exports[_0x7393('0x5')]=function(_0x1f538f){for(var _0x15eabd=0x0,_0x42bdd1=events[_0x7393('0x6')];_0x15eabd<_0x42bdd1;_0x15eabd++){var _0x26668a=events[_0x15eabd];var _0x944b0b=createListener('voiceQueueReport:'+_0x26668a,_0x1f538f);VoiceQueueReportEvents['on'](_0x26668a,_0x944b0b);}}; \ No newline at end of file +var _0x7266=['emit','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x1fa068,_0x34d8d2){var _0x2d4650=function(_0x486ec4){while(--_0x486ec4){_0x1fa068['push'](_0x1fa068['shift']());}};_0x2d4650(++_0x34d8d2);}(_0x7266,0xec));var _0x6726=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x7266[_0x5d4607];return _0x5e4a86;};'use strict';var VoiceQueueReportEvents=require(_0x6726('0x0'));var events=[_0x6726('0x1'),_0x6726('0x2'),_0x6726('0x3')];function createListener(_0x438753,_0x51d674){return function(_0x5dd7a7){_0x51d674[_0x6726('0x4')](_0x438753,_0x5dd7a7);};}function removeListener(_0x4e215d,_0x5939ff){return function(){VoiceQueueReportEvents['removeListener'](_0x4e215d,_0x5939ff);};}exports[_0x6726('0x5')]=function(_0x41c7c8){for(var _0x1c2cfd=0x0,_0x180502=events[_0x6726('0x6')];_0x1c2cfd<_0x180502;_0x1c2cfd++){var _0x3c8020=events[_0x1c2cfd];var _0x126ba7=createListener(_0x6726('0x7')+_0x3c8020,_0x41c7c8);VoiceQueueReportEvents['on'](_0x3c8020,_0x126ba7);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e5cb3ba..219918c 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 _0x30d6=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','put','update','delete'];(function(_0x278eea,_0x2f4603){var _0xb8eb73=function(_0x31c08c){while(--_0x31c08c){_0x278eea['push'](_0x278eea['shift']());}};_0xb8eb73(++_0x2f4603);}(_0x30d6,0x80));var _0x630d=function(_0x11efe8,_0xe6ad7e){_0x11efe8=_0x11efe8-0x0;var _0x5954b8=_0x30d6[_0x11efe8];return _0x5954b8;};'use strict';var multer=require('multer');var util=require(_0x630d('0x0'));var path=require(_0x630d('0x1'));var timeout=require(_0x630d('0x2'));var express=require(_0x630d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x630d('0x4'));var interaction=require(_0x630d('0x5'));var config=require(_0x630d('0x6'));var controller=require(_0x630d('0x7'));router['get']('/',auth[_0x630d('0x8')](),controller[_0x630d('0x9')]);router[_0x630d('0xa')](_0x630d('0xb'),auth[_0x630d('0x8')](),controller[_0x630d('0xc')]);router['post']('/',auth[_0x630d('0x8')](),controller['create']);router[_0x630d('0xd')](_0x630d('0xb'),auth[_0x630d('0x8')](),controller[_0x630d('0xe')]);router[_0x630d('0xf')](_0x630d('0xb'),auth[_0x630d('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x57cd=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','update','delete'];(function(_0x1de4b8,_0x529b41){var _0x557699=function(_0xb10c18){while(--_0xb10c18){_0x1de4b8['push'](_0x1de4b8['shift']());}};_0x557699(++_0x529b41);}(_0x57cd,0x121));var _0xd57c=function(_0x132fb6,_0x7a257b){_0x132fb6=_0x132fb6-0x0;var _0x2ca9d5=_0x57cd[_0x132fb6];return _0x2ca9d5;};'use strict';var multer=require(_0xd57c('0x0'));var util=require(_0xd57c('0x1'));var path=require('path');var timeout=require(_0xd57c('0x2'));var express=require(_0xd57c('0x3'));var router=express[_0xd57c('0x4')]();var fs_extra=require(_0xd57c('0x5'));var auth=require(_0xd57c('0x6'));var interaction=require(_0xd57c('0x7'));var config=require(_0xd57c('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0xd57c('0x9')]('/',auth[_0xd57c('0xa')](),controller[_0xd57c('0xb')]);router[_0xd57c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd57c('0xc')]);router['post']('/',auth[_0xd57c('0xa')](),controller[_0xd57c('0xd')]);router[_0xd57c('0xe')]('/:id',auth[_0xd57c('0xa')](),controller[_0xd57c('0xf')]);router[_0xd57c('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd57c('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 3984426..5a3f74d 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 _0xe627=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xe627,0x1a7));var _0x7e62=function(_0xc35b9a,_0xcbbd71){_0xc35b9a=_0xc35b9a-0x0;var _0x2d2d30=_0xe627[_0xc35b9a];return _0x2d2d30;};'use strict';var Sequelize=require(_0x7e62('0x0'));var moment=require(_0x7e62('0x1'));module[_0x7e62('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x7e62('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7e62('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7e62('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7e62('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7e62('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7e62('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7e62('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7e62('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x7e62('0x5')](_0x7e62('0x6'))}}; \ No newline at end of file +var _0x0032=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','STRING','DATE','literal'];(function(_0x4e1e19,_0x565eca){var _0x42723e=function(_0x35ef78){while(--_0x35ef78){_0x4e1e19['push'](_0x4e1e19['shift']());}};_0x42723e(++_0x565eca);}(_0x0032,0x91));var _0x2003=function(_0xf1ad51,_0x2bf1ab){_0xf1ad51=_0xf1ad51-0x0;var _0x394820=_0x0032[_0xf1ad51];return _0x394820;};'use strict';var Sequelize=require(_0x2003('0x0'));var moment=require(_0x2003('0x1'));module['exports']={'time':{'type':Sequelize[_0x2003('0x2')]},'callid':{'type':Sequelize[_0x2003('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x2003('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x2003('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x2003('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x2003('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x2003('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x2003('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x2003('0x4')](_0x2003('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index d156d04..c6520a1 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 _0x7313=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','reject','save','update','then','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','create','body','find','destroy','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util'];(function(_0x4a8bb0,_0x528f8d){var _0x4d4bdb=function(_0x3e025b){while(--_0x3e025b){_0x4a8bb0['push'](_0x4a8bb0['shift']());}};_0x4d4bdb(++_0x528f8d);}(_0x7313,0x93));var _0x3731=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x7313[_0x10004e];return _0x5af990;};'use strict';var emlformat=require(_0x3731('0x0'));var rimraf=require(_0x3731('0x1'));var zipdir=require(_0x3731('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3731('0x3'));var moment=require('moment');var BPromise=require(_0x3731('0x4'));var Mustache=require(_0x3731('0x5'));var util=require(_0x3731('0x6'));var path=require(_0x3731('0x7'));var sox=require(_0x3731('0x8'));var csv=require(_0x3731('0x9'));var ejs=require(_0x3731('0xa'));var fs=require('fs');var fs_extra=require(_0x3731('0xb'));var _=require(_0x3731('0xc'));var squel=require(_0x3731('0xd'));var crypto=require(_0x3731('0xe'));var jsforce=require(_0x3731('0xf'));var deskjs=require(_0x3731('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3731('0x11'));var authService=require(_0x3731('0x12'));var qs=require(_0x3731('0x13'));var as=require(_0x3731('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3731('0x15'))(_0x3731('0x16'));var utils=require(_0x3731('0x17'));var config=require(_0x3731('0x18'));var licenseUtil=require(_0x3731('0x19'));var db=require(_0x3731('0x1a'))['db'];function respondWithStatusCode(_0x227c32,_0x2b6641){_0x2b6641=_0x2b6641||0xcc;return function(_0x420fa2){if(_0x420fa2){return _0x227c32[_0x3731('0x1b')](_0x2b6641);}return _0x227c32[_0x3731('0x1c')](_0x2b6641)[_0x3731('0x1d')]();};}function respondWithResult(_0x5220f0,_0x476bdb){_0x476bdb=_0x476bdb||0xc8;return function(_0x203693){if(_0x203693){return _0x5220f0[_0x3731('0x1c')](_0x476bdb)['json'](_0x203693);}};}function respondWithFilteredResult(_0xb51e55,_0x537723){return function(_0x2e929f){if(_0x2e929f){var _0x12de1a=typeof _0x537723[_0x3731('0x1e')]===_0x3731('0x1f')&&typeof _0x537723['limit']===_0x3731('0x1f');var _0x5a075b=_0x2e929f['count'];var _0x1d370a=_0x12de1a?0x0:_0x537723[_0x3731('0x1e')];var _0xe8f50f=_0x12de1a?_0x2e929f[_0x3731('0x20')]:_0x537723[_0x3731('0x1e')]+_0x537723['limit'];var _0x361865;if(_0xe8f50f>=_0x5a075b){_0xe8f50f=_0x5a075b;_0x361865=0xc8;}else{_0x361865=0xce;}_0xb51e55[_0x3731('0x1c')](_0x361865);return _0xb51e55[_0x3731('0x21')](_0x3731('0x22'),_0x1d370a+'-'+_0xe8f50f+'/'+_0x5a075b)['json'](_0x2e929f);}return null;};}function patchUpdates(_0x4872b8){return function(_0x1535b6){try{jsonpatch['apply'](_0x1535b6,_0x4872b8,!![]);}catch(_0x1decbe){return BPromise[_0x3731('0x23')](_0x1decbe);}return _0x1535b6[_0x3731('0x24')]();};}function saveUpdates(_0x35967f,_0x5c5491){return function(_0x168d73){if(_0x168d73){return _0x168d73[_0x3731('0x25')](_0x35967f)[_0x3731('0x26')](function(_0xdfebcf){return _0xdfebcf;});}return null;};}function removeEntity(_0x57e3ac,_0x21d8c4){return function(_0xe40294){if(_0xe40294){return _0xe40294['destroy']()['then'](function(){_0x57e3ac[_0x3731('0x1c')](0xcc)[_0x3731('0x1d')]();});}};}function handleEntityNotFound(_0xff97a0,_0x36beeb){return function(_0x38043c){if(!_0x38043c){_0xff97a0[_0x3731('0x1b')](0x194);}return _0x38043c;};}function handleError(_0x35e8ff,_0x31a8f7){_0x31a8f7=_0x31a8f7||0x1f4;return function(_0x3eb429){logger['error'](_0x3eb429[_0x3731('0x27')]);if(_0x3eb429[_0x3731('0x28')]){delete _0x3eb429[_0x3731('0x28')];}_0x35e8ff[_0x3731('0x1c')](_0x31a8f7)[_0x3731('0x29')](_0x3eb429);};}exports['index']=function(_0x29db36,_0x2416e6){var _0x5527c9={},_0x2bbddb={},_0x8c3a91={'count':0x0,'rows':[]};var _0x326296=_[_0x3731('0x2a')](db[_0x3731('0x2b')][_0x3731('0x2c')],function(_0x39a2c3){return{'name':_0x39a2c3[_0x3731('0x2d')],'type':_0x39a2c3[_0x3731('0x2e')][_0x3731('0x2f')]};});_0x2bbddb['model']=_[_0x3731('0x2a')](_0x326296,_0x3731('0x28'));_0x2bbddb[_0x3731('0x30')]=_[_0x3731('0x31')](_0x29db36[_0x3731('0x30')]);_0x2bbddb[_0x3731('0x32')]=_[_0x3731('0x33')](_0x2bbddb['model'],_0x2bbddb[_0x3731('0x30')]);_0x5527c9[_0x3731('0x34')]=_[_0x3731('0x33')](_0x2bbddb['model'],qs['fields'](_0x29db36[_0x3731('0x30')][_0x3731('0x35')]));_0x5527c9[_0x3731('0x34')]=_0x5527c9['attributes'][_0x3731('0x36')]?_0x5527c9[_0x3731('0x34')]:_0x2bbddb[_0x3731('0x37')];if(!_0x29db36[_0x3731('0x30')][_0x3731('0x38')](_0x3731('0x39'))){_0x5527c9['limit']=qs['limit'](_0x29db36[_0x3731('0x30')][_0x3731('0x3a')]);_0x5527c9[_0x3731('0x1e')]=qs[_0x3731('0x1e')](_0x29db36[_0x3731('0x30')][_0x3731('0x1e')]);}_0x5527c9[_0x3731('0x3b')]=qs['sort'](_0x29db36[_0x3731('0x30')][_0x3731('0x3c')]);_0x5527c9[_0x3731('0x3d')]=qs['filters'](_[_0x3731('0x3e')](_0x29db36[_0x3731('0x30')],_0x2bbddb[_0x3731('0x32')]),_0x326296);if(_0x29db36['query'][_0x3731('0x3f')]){_0x5527c9[_0x3731('0x3d')]=_[_0x3731('0x40')](_0x5527c9[_0x3731('0x3d')],{'$or':_['map'](_0x326296,function(_0x590876){if(_0x590876['type']!==_0x3731('0x41')){var _0x35e53e={};_0x35e53e[_0x590876[_0x3731('0x28')]]={'$like':'%'+_0x29db36[_0x3731('0x30')][_0x3731('0x3f')]+'%'};return _0x35e53e;}})});}_0x5527c9=_[_0x3731('0x40')]({},_0x5527c9,_0x29db36[_0x3731('0x42')]);var _0x1cb632={'where':_0x5527c9['where']};return db[_0x3731('0x2b')][_0x3731('0x20')](_0x1cb632)['then'](function(_0xe11e06){_0x8c3a91[_0x3731('0x20')]=_0xe11e06;if(_0x29db36[_0x3731('0x30')][_0x3731('0x43')]){_0x5527c9['include']=[{'all':!![]}];}return db[_0x3731('0x2b')][_0x3731('0x44')](_0x5527c9);})[_0x3731('0x26')](function(_0x4f4ad4){_0x8c3a91[_0x3731('0x45')]=_0x4f4ad4;return _0x8c3a91;})['then'](respondWithFilteredResult(_0x2416e6,_0x5527c9))[_0x3731('0x46')](handleError(_0x2416e6,null));};exports[_0x3731('0x47')]=function(_0x5c062a,_0x4cd336){var _0x1be205={'raw':!![],'where':{'id':_0x5c062a[_0x3731('0x48')]['id']}},_0x240f0c={};_0x240f0c[_0x3731('0x37')]=_[_0x3731('0x31')](db['VoiceQueuesLog'][_0x3731('0x2c')]);_0x240f0c[_0x3731('0x30')]=_[_0x3731('0x31')](_0x5c062a['query']);_0x240f0c['filters']=_[_0x3731('0x33')](_0x240f0c[_0x3731('0x37')],_0x240f0c[_0x3731('0x30')]);_0x1be205[_0x3731('0x34')]=_[_0x3731('0x33')](_0x240f0c[_0x3731('0x37')],qs['fields'](_0x5c062a[_0x3731('0x30')][_0x3731('0x35')]));_0x1be205[_0x3731('0x34')]=_0x1be205[_0x3731('0x34')][_0x3731('0x36')]?_0x1be205[_0x3731('0x34')]:_0x240f0c['model'];if(_0x5c062a['query']['includeAll']){_0x1be205['include']=[{'all':!![]}];}_0x1be205=_[_0x3731('0x40')]({},_0x1be205,_0x5c062a[_0x3731('0x42')]);return db[_0x3731('0x2b')]['find'](_0x1be205)[_0x3731('0x26')](handleEntityNotFound(_0x4cd336,null))[_0x3731('0x26')](respondWithResult(_0x4cd336,null))[_0x3731('0x46')](handleError(_0x4cd336,null));};exports[_0x3731('0x49')]=function(_0x2e4878,_0x2af9c6){return db[_0x3731('0x2b')][_0x3731('0x49')](_0x2e4878['body'],{})['then'](respondWithResult(_0x2af9c6,0xc9))[_0x3731('0x46')](handleError(_0x2af9c6,null));};exports[_0x3731('0x25')]=function(_0x454f8b,_0xe1dcf9){if(_0x454f8b[_0x3731('0x4a')]['id']){delete _0x454f8b['body']['id'];}return db[_0x3731('0x2b')][_0x3731('0x4b')]({'where':{'id':_0x454f8b[_0x3731('0x48')]['id']}})[_0x3731('0x26')](handleEntityNotFound(_0xe1dcf9,null))[_0x3731('0x26')](saveUpdates(_0x454f8b['body'],null))[_0x3731('0x26')](respondWithResult(_0xe1dcf9,null))[_0x3731('0x46')](handleError(_0xe1dcf9,null));};exports[_0x3731('0x4c')]=function(_0x1d94c1,_0x5d8110){return db[_0x3731('0x2b')][_0x3731('0x4b')]({'where':{'id':_0x1d94c1['params']['id']}})['then'](handleEntityNotFound(_0x5d8110,null))[_0x3731('0x26')](removeEntity(_0x5d8110,null))[_0x3731('0x46')](handleError(_0x5d8110,null));}; \ No newline at end of file +var _0x6508=['undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','body','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x3eff6a,_0x695147){var _0x5508a7=function(_0x542282){while(--_0x542282){_0x3eff6a['push'](_0x3eff6a['shift']());}};_0x5508a7(++_0x695147);}(_0x6508,0xbc));var _0x8650=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0x6508[_0x529296];return _0x1796bf;};'use strict';var emlformat=require(_0x8650('0x0'));var rimraf=require(_0x8650('0x1'));var zipdir=require(_0x8650('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8650('0x3'));var BPromise=require(_0x8650('0x4'));var Mustache=require('mustache');var util=require(_0x8650('0x5'));var path=require(_0x8650('0x6'));var sox=require(_0x8650('0x7'));var csv=require('to-csv');var ejs=require(_0x8650('0x8'));var fs=require('fs');var fs_extra=require(_0x8650('0x9'));var _=require('lodash');var squel=require(_0x8650('0xa'));var crypto=require(_0x8650('0xb'));var jsforce=require(_0x8650('0xc'));var deskjs=require(_0x8650('0xd'));var toCsv=require(_0x8650('0xe'));var querystring=require(_0x8650('0xf'));var Papa=require('papaparse');var Redis=require(_0x8650('0x10'));var authService=require(_0x8650('0x11'));var qs=require(_0x8650('0x12'));var as=require(_0x8650('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8650('0x14'))('api');var utils=require(_0x8650('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8650('0x16'));var db=require(_0x8650('0x17'))['db'];function respondWithStatusCode(_0xebc100,_0x2786ff){_0x2786ff=_0x2786ff||0xcc;return function(_0x90cc01){if(_0x90cc01){return _0xebc100[_0x8650('0x18')](_0x2786ff);}return _0xebc100[_0x8650('0x19')](_0x2786ff)[_0x8650('0x1a')]();};}function respondWithResult(_0x4dc873,_0x36df0a){_0x36df0a=_0x36df0a||0xc8;return function(_0x2860e5){if(_0x2860e5){return _0x4dc873[_0x8650('0x19')](_0x36df0a)['json'](_0x2860e5);}};}function respondWithFilteredResult(_0x302dd6,_0x26270f){return function(_0x3f4fd3){if(_0x3f4fd3){var _0x2d244a=typeof _0x26270f[_0x8650('0x1b')]===_0x8650('0x1c')&&typeof _0x26270f[_0x8650('0x1d')]==='undefined';var _0x1cb848=_0x3f4fd3[_0x8650('0x1e')];var _0x231213=_0x2d244a?0x0:_0x26270f[_0x8650('0x1b')];var _0x1ad169=_0x2d244a?_0x3f4fd3[_0x8650('0x1e')]:_0x26270f['offset']+_0x26270f[_0x8650('0x1d')];var _0x722edd;if(_0x1ad169>=_0x1cb848){_0x1ad169=_0x1cb848;_0x722edd=0xc8;}else{_0x722edd=0xce;}_0x302dd6[_0x8650('0x19')](_0x722edd);return _0x302dd6['set'](_0x8650('0x1f'),_0x231213+'-'+_0x1ad169+'/'+_0x1cb848)[_0x8650('0x20')](_0x3f4fd3);}return null;};}function patchUpdates(_0x402572){return function(_0x2103e1){try{jsonpatch[_0x8650('0x21')](_0x2103e1,_0x402572,!![]);}catch(_0x3113b3){return BPromise[_0x8650('0x22')](_0x3113b3);}return _0x2103e1['save']();};}function saveUpdates(_0x5d1e0d,_0x4dd575){return function(_0x498942){if(_0x498942){return _0x498942[_0x8650('0x23')](_0x5d1e0d)[_0x8650('0x24')](function(_0x2a82aa){return _0x2a82aa;});}return null;};}function removeEntity(_0x13ca0f,_0x38a8df){return function(_0x3249b6){if(_0x3249b6){return _0x3249b6[_0x8650('0x25')]()[_0x8650('0x24')](function(){_0x13ca0f[_0x8650('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12cac2,_0x2e5163){return function(_0x3694aa){if(!_0x3694aa){_0x12cac2[_0x8650('0x18')](0x194);}return _0x3694aa;};}function handleError(_0xf4b153,_0x57f84c){_0x57f84c=_0x57f84c||0x1f4;return function(_0x4ef94f){logger[_0x8650('0x26')](_0x4ef94f[_0x8650('0x27')]);if(_0x4ef94f[_0x8650('0x28')]){delete _0x4ef94f['name'];}_0xf4b153[_0x8650('0x19')](_0x57f84c)[_0x8650('0x29')](_0x4ef94f);};}exports['index']=function(_0x2f079d,_0x44cd4b){var _0x532514={},_0x4b8f89={},_0x12f62e={'count':0x0,'rows':[]};var _0x2845cb=_[_0x8650('0x2a')](db[_0x8650('0x2b')][_0x8650('0x2c')],function(_0x1ac62e){return{'name':_0x1ac62e[_0x8650('0x2d')],'type':_0x1ac62e[_0x8650('0x2e')][_0x8650('0x2f')]};});_0x4b8f89[_0x8650('0x30')]=_[_0x8650('0x2a')](_0x2845cb,_0x8650('0x28'));_0x4b8f89['query']=_[_0x8650('0x31')](_0x2f079d['query']);_0x4b8f89[_0x8650('0x32')]=_[_0x8650('0x33')](_0x4b8f89[_0x8650('0x30')],_0x4b8f89[_0x8650('0x34')]);_0x532514[_0x8650('0x35')]=_[_0x8650('0x33')](_0x4b8f89['model'],qs[_0x8650('0x36')](_0x2f079d['query'][_0x8650('0x36')]));_0x532514['attributes']=_0x532514[_0x8650('0x35')][_0x8650('0x37')]?_0x532514[_0x8650('0x35')]:_0x4b8f89[_0x8650('0x30')];if(!_0x2f079d[_0x8650('0x34')][_0x8650('0x38')]('nolimit')){_0x532514[_0x8650('0x1d')]=qs[_0x8650('0x1d')](_0x2f079d[_0x8650('0x34')][_0x8650('0x1d')]);_0x532514[_0x8650('0x1b')]=qs[_0x8650('0x1b')](_0x2f079d[_0x8650('0x34')][_0x8650('0x1b')]);}_0x532514[_0x8650('0x39')]=qs[_0x8650('0x3a')](_0x2f079d[_0x8650('0x34')][_0x8650('0x3a')]);_0x532514[_0x8650('0x3b')]=qs[_0x8650('0x32')](_[_0x8650('0x3c')](_0x2f079d[_0x8650('0x34')],_0x4b8f89[_0x8650('0x32')]),_0x2845cb);if(_0x2f079d['query'][_0x8650('0x3d')]){_0x532514[_0x8650('0x3b')]=_[_0x8650('0x3e')](_0x532514[_0x8650('0x3b')],{'$or':_[_0x8650('0x2a')](_0x2845cb,function(_0x4d16f6){if(_0x4d16f6['type']!=='VIRTUAL'){var _0x323b8e={};_0x323b8e[_0x4d16f6[_0x8650('0x28')]]={'$like':'%'+_0x2f079d['query']['filter']+'%'};return _0x323b8e;}})});}_0x532514=_['merge']({},_0x532514,_0x2f079d[_0x8650('0x3f')]);var _0x409da2={'where':_0x532514[_0x8650('0x3b')]};return db['VoiceQueuesLog'][_0x8650('0x1e')](_0x409da2)[_0x8650('0x24')](function(_0x5276ba){_0x12f62e[_0x8650('0x1e')]=_0x5276ba;if(_0x2f079d[_0x8650('0x34')][_0x8650('0x40')]){_0x532514[_0x8650('0x41')]=[{'all':!![]}];}return db[_0x8650('0x2b')][_0x8650('0x42')](_0x532514);})[_0x8650('0x24')](function(_0x5198ca){_0x12f62e[_0x8650('0x43')]=_0x5198ca;return _0x12f62e;})[_0x8650('0x24')](respondWithFilteredResult(_0x44cd4b,_0x532514))[_0x8650('0x44')](handleError(_0x44cd4b,null));};exports[_0x8650('0x45')]=function(_0x4433b8,_0x4610fe){var _0xdfbc0b={'raw':!![],'where':{'id':_0x4433b8[_0x8650('0x46')]['id']}},_0x5c0d3a={};_0x5c0d3a[_0x8650('0x30')]=_[_0x8650('0x31')](db['VoiceQueuesLog'][_0x8650('0x2c')]);_0x5c0d3a[_0x8650('0x34')]=_[_0x8650('0x31')](_0x4433b8['query']);_0x5c0d3a[_0x8650('0x32')]=_[_0x8650('0x33')](_0x5c0d3a[_0x8650('0x30')],_0x5c0d3a[_0x8650('0x34')]);_0xdfbc0b['attributes']=_[_0x8650('0x33')](_0x5c0d3a[_0x8650('0x30')],qs[_0x8650('0x36')](_0x4433b8['query'][_0x8650('0x36')]));_0xdfbc0b[_0x8650('0x35')]=_0xdfbc0b['attributes'][_0x8650('0x37')]?_0xdfbc0b['attributes']:_0x5c0d3a[_0x8650('0x30')];if(_0x4433b8[_0x8650('0x34')]['includeAll']){_0xdfbc0b['include']=[{'all':!![]}];}_0xdfbc0b=_['merge']({},_0xdfbc0b,_0x4433b8[_0x8650('0x3f')]);return db[_0x8650('0x2b')]['find'](_0xdfbc0b)[_0x8650('0x24')](handleEntityNotFound(_0x4610fe,null))[_0x8650('0x24')](respondWithResult(_0x4610fe,null))[_0x8650('0x44')](handleError(_0x4610fe,null));};exports['create']=function(_0x22ba29,_0x484dcd){return db['VoiceQueuesLog']['create'](_0x22ba29[_0x8650('0x47')],{})[_0x8650('0x24')](respondWithResult(_0x484dcd,0xc9))[_0x8650('0x44')](handleError(_0x484dcd,null));};exports[_0x8650('0x23')]=function(_0x4e0bd7,_0x2f0d72){if(_0x4e0bd7[_0x8650('0x47')]['id']){delete _0x4e0bd7[_0x8650('0x47')]['id'];}return db[_0x8650('0x2b')]['find']({'where':{'id':_0x4e0bd7['params']['id']}})[_0x8650('0x24')](handleEntityNotFound(_0x2f0d72,null))[_0x8650('0x24')](saveUpdates(_0x4e0bd7[_0x8650('0x47')],null))['then'](respondWithResult(_0x2f0d72,null))[_0x8650('0x44')](handleError(_0x2f0d72,null));};exports[_0x8650('0x25')]=function(_0x218d6d,_0xb6d313){return db['VoiceQueuesLog']['find']({'where':{'id':_0x218d6d[_0x8650('0x46')]['id']}})[_0x8650('0x24')](handleEntityNotFound(_0xb6d313,null))['then'](removeEntity(_0xb6d313,null))[_0x8650('0x44')](handleError(_0xb6d313,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 56fa52c..a0580f5 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 _0x2394=['request-promise','../../config/environment','./voiceQueuesLog.attributes','define','voice_queues_log','event_dtm','event','dtm','lodash','api','moment','bluebird'];(function(_0x4d696c,_0x56a1ec){var _0x1c4d91=function(_0x3e780c){while(--_0x3e780c){_0x4d696c['push'](_0x4d696c['shift']());}};_0x1c4d91(++_0x56a1ec);}(_0x2394,0x1f4));var _0x4239=function(_0x2eba5e,_0x304173){_0x2eba5e=_0x2eba5e-0x0;var _0x5baf3d=_0x2394[_0x2eba5e];return _0x5baf3d;};'use strict';var _=require(_0x4239('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4239('0x1'));var moment=require(_0x4239('0x2'));var BPromise=require(_0x4239('0x3'));var rp=require(_0x4239('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4239('0x5'));var attributes=require(_0x4239('0x6'));module['exports']=function(_0x3d6d9e,_0x27415e){return _0x3d6d9e[_0x4239('0x7')]('VoiceQueuesLog',attributes,{'tableName':_0x4239('0x8'),'paranoid':![],'indexes':[{'name':_0x4239('0x9'),'fields':[_0x4239('0xa'),_0x4239('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x201d=['lodash','../../config/logger','api','path','rimraf','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','dtm'];(function(_0x1c54f2,_0x2b1216){var _0x478e59=function(_0x5ce214){while(--_0x5ce214){_0x1c54f2['push'](_0x1c54f2['shift']());}};_0x478e59(++_0x2b1216);}(_0x201d,0xd2));var _0xd201=function(_0x5b6d86,_0x276a3d){_0x5b6d86=_0x5b6d86-0x0;var _0x3e0612=_0x201d[_0x5b6d86];return _0x3e0612;};'use strict';var _=require(_0xd201('0x0'));var util=require('util');var logger=require(_0xd201('0x1'))(_0xd201('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd201('0x3'));var rimraf=require(_0xd201('0x4'));var config=require('../../config/environment');var attributes=require(_0xd201('0x5'));module['exports']=function(_0xb1427d,_0x586714){return _0xb1427d[_0xd201('0x6')](_0xd201('0x7'),attributes,{'tableName':_0xd201('0x8'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xd201('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index def79c4..5b0a058 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 _0x4522=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2e180c,_0x5d9dd1){var _0x2496a3=function(_0x27c9ee){while(--_0x27c9ee){_0x2e180c['push'](_0x2e180c['shift']());}};_0x2496a3(++_0x5d9dd1);}(_0x4522,0x1a0));var _0x2452=function(_0x33dcfc,_0x34f7d6){_0x33dcfc=_0x33dcfc-0x0;var _0x2a2dec=_0x4522[_0x33dcfc];return _0x2a2dec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2452('0x0'));var BPromise=require(_0x2452('0x1'));var rs=require(_0x2452('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2452('0x3'))['db'];var utils=require(_0x2452('0x4'));var logger=require(_0x2452('0x5'))(_0x2452('0x6'));var config=require(_0x2452('0x7'));var jayson=require(_0x2452('0x8'));var client=jayson[_0x2452('0x9')][_0x2452('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0139,_0x149807,_0x3bc193){return new BPromise(function(_0x33b935,_0x24073f){return client[_0x2452('0xb')](_0x2f0139,_0x3bc193)[_0x2452('0xc')](function(_0x2995b5){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x149807,_0x2452('0xd'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x149807,_0x2452('0xd'),JSON[_0x2452('0xe')](_0x2995b5));if(_0x2995b5[_0x2452('0xf')]){if(_0x2995b5[_0x2452('0xf')][_0x2452('0x10')]===0x1f4){logger[_0x2452('0xf')](_0x2452('0x11'),_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x24073f(_0x2995b5['error']['message']);}logger[_0x2452('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x33b935(_0x2995b5[_0x2452('0xf')][_0x2452('0x12')]);}else{logger['info'](_0x2452('0x11'),_0x149807,'request\x20sent');_0x33b935(_0x2995b5[_0x2452('0x13')][_0x2452('0x12')]);}})[_0x2452('0x14')](function(_0xdede20){logger['error'](_0x2452('0x11'),_0x149807,_0xdede20);_0x24073f(_0xdede20);});});} \ No newline at end of file +var _0x67c7=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x67c7,0x172));var _0x767c=function(_0x5700c5,_0x3f8f18){_0x5700c5=_0x5700c5-0x0;var _0x771cca=_0x67c7[_0x5700c5];return _0x771cca;};'use strict';var _=require(_0x767c('0x0'));var util=require(_0x767c('0x1'));var moment=require(_0x767c('0x2'));var BPromise=require(_0x767c('0x3'));var rs=require(_0x767c('0x4'));var fs=require('fs');var Redis=require(_0x767c('0x5'));var db=require(_0x767c('0x6'))['db'];var utils=require(_0x767c('0x7'));var logger=require('../../config/logger')(_0x767c('0x8'));var config=require(_0x767c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x767c('0xa')][_0x767c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x334608,_0x3a3b2d,_0x2a1958){return new BPromise(function(_0x438e71,_0x396b7c){return client[_0x767c('0xc')](_0x334608,_0x2a1958)[_0x767c('0xd')](function(_0x204022){logger[_0x767c('0xe')](_0x767c('0xf'),_0x3a3b2d,_0x767c('0x10'));logger[_0x767c('0x11')](_0x767c('0x12'),_0x3a3b2d,'request\x20sent',JSON[_0x767c('0x13')](_0x204022));if(_0x204022[_0x767c('0x14')]){if(_0x204022[_0x767c('0x14')][_0x767c('0x15')]===0x1f4){logger[_0x767c('0x14')](_0x767c('0xf'),_0x3a3b2d,_0x204022[_0x767c('0x14')][_0x767c('0x16')]);return _0x396b7c(_0x204022[_0x767c('0x14')]['message']);}logger[_0x767c('0x14')](_0x767c('0xf'),_0x3a3b2d,_0x204022[_0x767c('0x14')][_0x767c('0x16')]);return _0x438e71(_0x204022[_0x767c('0x14')][_0x767c('0x16')]);}else{logger[_0x767c('0xe')](_0x767c('0xf'),_0x3a3b2d,_0x767c('0x10'));_0x438e71(_0x204022['result'][_0x767c('0x16')]);}})[_0x767c('0x17')](function(_0x3e4927){logger[_0x767c('0x14')](_0x767c('0xf'),_0x3a3b2d,_0x3e4927);_0x396b7c(_0x3e4927);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index d89adee..4092282 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 _0xb232=['runTranscribe','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post'];(function(_0x56f0,_0x4e1f39){var _0x4fe5ab=function(_0x245834){while(--_0x245834){_0x56f0['push'](_0x56f0['shift']());}};_0x4fe5ab(++_0x4e1f39);}(_0xb232,0x1b5));var _0x2b23=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0xb232[_0x3747ae];return _0x339035;};'use strict';var multer=require(_0x2b23('0x0'));var util=require(_0x2b23('0x1'));var path=require(_0x2b23('0x2'));var timeout=require(_0x2b23('0x3'));var express=require('express');var router=express[_0x2b23('0x4')]();var fs_extra=require(_0x2b23('0x5'));var auth=require(_0x2b23('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2b23('0x7'));var controller=require(_0x2b23('0x8'));router[_0x2b23('0x9')]('/',auth[_0x2b23('0xa')](),controller[_0x2b23('0xb')]);router[_0x2b23('0x9')]('/describe',auth[_0x2b23('0xa')](),controller[_0x2b23('0xc')]);router[_0x2b23('0x9')](_0x2b23('0xd'),auth[_0x2b23('0xa')](),controller['show']);router[_0x2b23('0x9')](_0x2b23('0xe'),auth[_0x2b23('0xa')](),controller[_0x2b23('0xf')]);router[_0x2b23('0x9')](_0x2b23('0x10'),controller[_0x2b23('0x11')]);router[_0x2b23('0x9')](_0x2b23('0x12'),auth['isAuthenticated'](),controller[_0x2b23('0x13')]);router['post']('/',auth[_0x2b23('0xa')](),controller[_0x2b23('0x14')]);router[_0x2b23('0x15')](_0x2b23('0x12'),auth[_0x2b23('0xa')](),controller[_0x2b23('0x16')]);router['put']('/:id',auth[_0x2b23('0xa')](),controller[_0x2b23('0x17')]);router[_0x2b23('0x18')](_0x2b23('0xd'),auth['isAuthenticated'](),controller[_0x2b23('0x19')]);module[_0x2b23('0x1a')]=router; \ No newline at end of file +var _0x32d2=['../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5c1199,_0x43e929){var _0x1067a4=function(_0xca2eac){while(--_0xca2eac){_0x5c1199['push'](_0x5c1199['shift']());}};_0x1067a4(++_0x43e929);}(_0x32d2,0x7b));var _0x232d=function(_0x4e8eef,_0x2cb73b){_0x4e8eef=_0x4e8eef-0x0;var _0x2998f7=_0x32d2[_0x4e8eef];return _0x2998f7;};'use strict';var multer=require(_0x232d('0x0'));var util=require('util');var path=require(_0x232d('0x1'));var timeout=require(_0x232d('0x2'));var express=require(_0x232d('0x3'));var router=express[_0x232d('0x4')]();var fs_extra=require(_0x232d('0x5'));var auth=require(_0x232d('0x6'));var interaction=require(_0x232d('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x232d('0x8')](),controller[_0x232d('0x9')]);router[_0x232d('0xa')](_0x232d('0xb'),auth[_0x232d('0x8')](),controller['describe']);router[_0x232d('0xa')](_0x232d('0xc'),auth[_0x232d('0x8')](),controller[_0x232d('0xd')]);router[_0x232d('0xa')](_0x232d('0xe'),auth[_0x232d('0x8')](),controller[_0x232d('0xf')]);router['get'](_0x232d('0x10'),controller['downloads']);router[_0x232d('0xa')](_0x232d('0x11'),auth[_0x232d('0x8')](),controller[_0x232d('0x12')]);router[_0x232d('0x13')]('/',auth['isAuthenticated'](),controller[_0x232d('0x14')]);router[_0x232d('0x13')](_0x232d('0x11'),auth[_0x232d('0x8')](),controller[_0x232d('0x15')]);router[_0x232d('0x16')](_0x232d('0xc'),auth[_0x232d('0x8')](),controller[_0x232d('0x17')]);router['delete'](_0x232d('0xc'),auth[_0x232d('0x8')](),controller[_0x232d('0x18')]);module[_0x232d('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 08b1da0..02ae1b6 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(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 8e08bb3..110b186 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 _0xac48=['message','downloads','sequelize','MD5','col','token','$and','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','../../components/encryptor','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','findOne','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','.txt','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac48,0xd3));var _0x8ac4=function(_0x31a2ad,_0x32520f){_0x31a2ad=_0x31a2ad-0x0;var _0x12f749=_0xac48[_0x31a2ad];return _0x12f749;};'use strict';var emlformat=require(_0x8ac4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ac4('0x1'));var jsonpatch=require(_0x8ac4('0x2'));var rp=require(_0x8ac4('0x3'));var moment=require(_0x8ac4('0x4'));var BPromise=require(_0x8ac4('0x5'));var Mustache=require(_0x8ac4('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8ac4('0x7'));var csv=require(_0x8ac4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ac4('0x9'));var squel=require(_0x8ac4('0xa'));var crypto=require(_0x8ac4('0xb'));var jsforce=require(_0x8ac4('0xc'));var deskjs=require(_0x8ac4('0xd'));var toCsv=require(_0x8ac4('0x8'));var querystring=require(_0x8ac4('0xe'));var Papa=require(_0x8ac4('0xf'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0x8ac4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8ac4('0x11'));var as=require(_0x8ac4('0x12'));var hardwareService=require(_0x8ac4('0x13'));var logger=require(_0x8ac4('0x14'))('api');var utils=require(_0x8ac4('0x15'));var config=require(_0x8ac4('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18fee6,_0x2b979c){_0x2b979c=_0x2b979c||0xcc;return function(_0x4585d5){if(_0x4585d5){return _0x18fee6[_0x8ac4('0x17')](_0x2b979c);}return _0x18fee6[_0x8ac4('0x18')](_0x2b979c)[_0x8ac4('0x19')]();};}function respondWithResult(_0x5214d0,_0x30e8dd){_0x30e8dd=_0x30e8dd||0xc8;return function(_0x42b32e){if(_0x42b32e){return _0x5214d0['status'](_0x30e8dd)[_0x8ac4('0x1a')](_0x42b32e);}};}function respondWithFilteredResult(_0x468783,_0x5afd7f){return function(_0x42d04c){if(_0x42d04c){var _0x508af4=typeof _0x5afd7f[_0x8ac4('0x1b')]===_0x8ac4('0x1c')&&typeof _0x5afd7f['limit']==='undefined';var _0x5ad555=_0x42d04c[_0x8ac4('0x1d')];var _0x45068f=_0x508af4?0x0:_0x5afd7f[_0x8ac4('0x1b')];var _0x1f4431=_0x508af4?_0x42d04c['count']:_0x5afd7f[_0x8ac4('0x1b')]+_0x5afd7f[_0x8ac4('0x1e')];var _0x298a78;if(_0x1f4431>=_0x5ad555){_0x1f4431=_0x5ad555;_0x298a78=0xc8;}else{_0x298a78=0xce;}_0x468783[_0x8ac4('0x18')](_0x298a78);return _0x468783[_0x8ac4('0x1f')](_0x8ac4('0x20'),_0x45068f+'-'+_0x1f4431+'/'+_0x5ad555)[_0x8ac4('0x1a')](_0x42d04c);}return null;};}function patchUpdates(_0x254212){return function(_0x135591){try{jsonpatch[_0x8ac4('0x21')](_0x135591,_0x254212,!![]);}catch(_0xacc4e4){return BPromise[_0x8ac4('0x22')](_0xacc4e4);}return _0x135591[_0x8ac4('0x23')]();};}function saveUpdates(_0x46b302,_0x13931d){return function(_0x3cc541){if(_0x3cc541){return _0x3cc541[_0x8ac4('0x24')](_0x46b302)[_0x8ac4('0x25')](function(_0x351d07){return _0x351d07;});}return null;};}function removeEntity(_0x408ebc,_0x38073a){return function(_0x1aa20a){if(_0x1aa20a){return _0x1aa20a[_0x8ac4('0x26')]()[_0x8ac4('0x25')](function(){_0x408ebc[_0x8ac4('0x18')](0xcc)[_0x8ac4('0x19')]();});}};}function handleEntityNotFound(_0x3bcc42,_0x348cac){return function(_0x51972c){if(!_0x51972c){_0x3bcc42[_0x8ac4('0x17')](0x194);}return _0x51972c;};}function handleError(_0x438ba1,_0x12807e){_0x12807e=_0x12807e||0x1f4;return function(_0x562c61){logger[_0x8ac4('0x27')](_0x562c61[_0x8ac4('0x28')]);if(_0x562c61[_0x8ac4('0x29')]){delete _0x562c61['name'];}_0x438ba1['status'](_0x12807e)[_0x8ac4('0x2a')](_0x562c61);};}exports[_0x8ac4('0x2b')]=function(_0x4232cc,_0x190c4a){var _0x544382={},_0x10cb6c={},_0x973567={'count':0x0,'rows':[]};var _0xf598f3=_[_0x8ac4('0x2c')](db[_0x8ac4('0x2d')]['rawAttributes'],function(_0x5143ee){return{'name':_0x5143ee[_0x8ac4('0x2e')],'type':_0x5143ee[_0x8ac4('0x2f')][_0x8ac4('0x30')]};});_0x10cb6c[_0x8ac4('0x31')]=_[_0x8ac4('0x32')](_['map'](_0xf598f3,_0x8ac4('0x29')),[_0x8ac4('0x33')]);_0x10cb6c['query']=_[_0x8ac4('0x34')](_0x4232cc[_0x8ac4('0x35')]);_0x10cb6c['filters']=_['intersection'](_0x10cb6c[_0x8ac4('0x31')],_0x10cb6c['query']);_0x544382[_0x8ac4('0x36')]=_[_0x8ac4('0x37')](_0x10cb6c['model'],qs[_0x8ac4('0x38')](_0x4232cc[_0x8ac4('0x35')][_0x8ac4('0x38')]));_0x544382[_0x8ac4('0x36')]=_0x544382[_0x8ac4('0x36')][_0x8ac4('0x39')]?_0x544382[_0x8ac4('0x36')]:_0x10cb6c[_0x8ac4('0x31')];if(!_0x4232cc[_0x8ac4('0x35')][_0x8ac4('0x3a')](_0x8ac4('0x3b'))){_0x544382[_0x8ac4('0x1e')]=qs[_0x8ac4('0x1e')](_0x4232cc['query'][_0x8ac4('0x1e')]);_0x544382['offset']=qs[_0x8ac4('0x1b')](_0x4232cc[_0x8ac4('0x35')][_0x8ac4('0x1b')]);}_0x544382[_0x8ac4('0x3c')]=qs[_0x8ac4('0x3d')](_0x4232cc['query'][_0x8ac4('0x3d')]);_0x544382[_0x8ac4('0x3e')]=qs['filters'](_[_0x8ac4('0x3f')](_0x4232cc[_0x8ac4('0x35')],_0x10cb6c['filters']),_0xf598f3);if(_0x4232cc[_0x8ac4('0x35')][_0x8ac4('0x40')]){_0x544382['where']=_[_0x8ac4('0x41')](_0x544382[_0x8ac4('0x3e')],{'$or':_[_0x8ac4('0x2c')](_0xf598f3,function(_0x469c50){if(_0x469c50['type']!==_0x8ac4('0x42')){var _0x3773af={};_0x3773af[_0x469c50['name']]={'$like':'%'+_0x4232cc[_0x8ac4('0x35')]['filter']+'%'};return _0x3773af;}})});}_0x544382=_[_0x8ac4('0x41')]({},_0x544382,_0x4232cc[_0x8ac4('0x43')]);var _0x5c688e={'where':_0x544382[_0x8ac4('0x3e')]};return db[_0x8ac4('0x2d')][_0x8ac4('0x1d')](_0x5c688e)[_0x8ac4('0x25')](function(_0x4959c7){_0x973567['count']=_0x4959c7;if(_0x4232cc['query'][_0x8ac4('0x44')]){_0x544382[_0x8ac4('0x45')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x544382);})[_0x8ac4('0x25')](function(_0x4ce009){_0x973567[_0x8ac4('0x46')]=_0x4ce009;return _0x973567;})[_0x8ac4('0x25')](respondWithFilteredResult(_0x190c4a,_0x544382))[_0x8ac4('0x47')](handleError(_0x190c4a,null));};exports['show']=function(_0xb48ad7,_0x1a6907){var _0x3dcdf6={'raw':![],'where':{'id':_0xb48ad7[_0x8ac4('0x48')]['id']}},_0x27b20b={};_0x27b20b[_0x8ac4('0x31')]=_[_0x8ac4('0x34')](db['VoiceRecording']['rawAttributes']);_0x27b20b[_0x8ac4('0x35')]=_['keys'](_0xb48ad7[_0x8ac4('0x35')]);_0x27b20b['filters']=_['intersection'](_0x27b20b[_0x8ac4('0x31')],_0x27b20b['query']);_0x3dcdf6[_0x8ac4('0x36')]=_[_0x8ac4('0x37')](_0x27b20b[_0x8ac4('0x31')],qs['fields'](_0xb48ad7[_0x8ac4('0x35')]['fields']));_0x3dcdf6[_0x8ac4('0x36')]=_0x3dcdf6['attributes'][_0x8ac4('0x39')]?_0x3dcdf6[_0x8ac4('0x36')]:_0x27b20b[_0x8ac4('0x31')];if(_0xb48ad7['query'][_0x8ac4('0x44')]){_0x3dcdf6['include']=[{'all':!![]}];}_0x3dcdf6=_[_0x8ac4('0x41')]({},_0x3dcdf6,_0xb48ad7[_0x8ac4('0x43')]);return db[_0x8ac4('0x2d')][_0x8ac4('0x49')](_0x3dcdf6)[_0x8ac4('0x25')](handleEntityNotFound(_0x1a6907,null))[_0x8ac4('0x25')](respondWithResult(_0x1a6907,null))['catch'](handleError(_0x1a6907,null));};exports[_0x8ac4('0x4a')]=function(_0x34b047,_0x1edb7e){return db[_0x8ac4('0x2d')][_0x8ac4('0x4a')](_0x34b047[_0x8ac4('0x4b')],{})['then'](respondWithResult(_0x1edb7e,0xc9))[_0x8ac4('0x47')](handleError(_0x1edb7e,null));};exports[_0x8ac4('0x24')]=function(_0x88df6f,_0x22015b){if(_0x88df6f[_0x8ac4('0x4b')]['id']){delete _0x88df6f[_0x8ac4('0x4b')]['id'];}return db[_0x8ac4('0x2d')][_0x8ac4('0x49')]({'where':{'id':_0x88df6f[_0x8ac4('0x48')]['id']}})[_0x8ac4('0x25')](handleEntityNotFound(_0x22015b,null))[_0x8ac4('0x25')](saveUpdates(_0x88df6f['body'],null))['then'](respondWithResult(_0x22015b,null))[_0x8ac4('0x47')](handleError(_0x22015b,null));};exports[_0x8ac4('0x4c')]=function(_0x3fe82b,_0x248949){return db['VoiceRecording'][_0x8ac4('0x4c')]()[_0x8ac4('0x25')](respondWithResult(_0x248949,null))[_0x8ac4('0x47')](handleError(_0x248949,null));};exports[_0x8ac4('0x4d')]=function(_0x1ecbd3,_0x1ad774,_0x51ea7e){var _0x329288=require('../../components/encryptor');var _0x5274eb=![];var _0x524d28={};if(_0x1ecbd3[_0x8ac4('0x35')]['type']&&_0x1ecbd3[_0x8ac4('0x35')][_0x8ac4('0x2f')]===_0x8ac4('0x4e')){_0x524d28[_0x8ac4('0x4e')]=_0x1ecbd3[_0x8ac4('0x48')]['id'];}else{_0x524d28['id']=_0x1ecbd3['params']['id'];}return db['VoiceRecording'][_0x8ac4('0x49')]({'where':_0x524d28,'attributes':['id',_0x8ac4('0x4f')],'raw':!![]})[_0x8ac4('0x25')](handleEntityNotFound(_0x1ad774,null))['then'](function(_0x3a9623){if(_0x3a9623){var _0x78146e=_0x3a9623[_0x8ac4('0x4f')];var _0x1e5317=util[_0x8ac4('0x33')](_0x8ac4('0x50'),_0x78146e);if(fs[_0x8ac4('0x51')](_0x1e5317)){_0x5274eb=!![];return _0x329288[_0x8ac4('0x52')](_0x1e5317,_0x78146e,config[_0x8ac4('0x53')][_0x8ac4('0x54')])['then'](function(){return _0x3a9623;});}return _0x3a9623;}})[_0x8ac4('0x25')](function(_0x111a07){if(_0x111a07){var _0x5088d3=_0x111a07[_0x8ac4('0x4f')];if(!fs[_0x8ac4('0x51')](_0x5088d3)){throw new db[(_0x8ac4('0x55'))][(_0x8ac4('0x56'))](_0x8ac4('0x57'));}if(_0x111a07[_0x8ac4('0x58')]){return _0x1ad774[_0x8ac4('0x4d')](_0x5088d3,_0x111a07[_0x8ac4('0x58')]+path[_0x8ac4('0x59')](_0x5088d3),function(){if(_0x5274eb){fs[_0x8ac4('0x5a')](_0x5088d3);}});}else{return _0x1ad774[_0x8ac4('0x4d')](_0x5088d3,function(_0x36d397){if(_0x5274eb){fs[_0x8ac4('0x5a')](_0x5088d3);}});}}})['catch'](function(_0x56bcd8){if(_0x56bcd8[_0x8ac4('0x5b')]===_0x8ac4('0x57')){_0x1ad774[_0x8ac4('0x18')](0x194)[_0x8ac4('0x2a')]('Not\x20found');}else{return handleError(_0x1ad774,null);}});};exports[_0x8ac4('0x5c')]=function(_0x1f1964,_0x31c006,_0x220287){var _0xd35e4b=require('../../components/encryptor');var _0x1d62d6=![];var _0x16b8cd={'$and':[db['sequelize'][_0x8ac4('0x3e')](db[_0x8ac4('0x5d')]['fn'](_0x8ac4('0x5e'),db['sequelize'][_0x8ac4('0x5f')](_0x8ac4('0x4e'))),_0x1f1964[_0x8ac4('0x35')][_0x8ac4('0x60')])]};if(_0x1f1964[_0x8ac4('0x35')][_0x8ac4('0x2f')]&&_0x1f1964[_0x8ac4('0x35')][_0x8ac4('0x2f')]===_0x8ac4('0x4e')){_0x16b8cd[_0x8ac4('0x61')][_0x8ac4('0x62')]({'uniqueid':_0x1f1964[_0x8ac4('0x48')]['id']});}else{_0x16b8cd[_0x8ac4('0x61')][_0x8ac4('0x62')]({'id':_0x1f1964[_0x8ac4('0x48')]['id']});}return db[_0x8ac4('0x2d')][_0x8ac4('0x49')]({'where':_0x16b8cd,'attributes':['id','value'],'raw':!![]})[_0x8ac4('0x25')](handleEntityNotFound(_0x31c006,null))[_0x8ac4('0x25')](function(_0x4d6874){if(_0x4d6874){var _0x52c899=util['format']('%s.cypher',_0x4d6874[_0x8ac4('0x4f')]);if(fs['existsSync'](_0x52c899)){_0x1d62d6=!![];return _0xd35e4b[_0x8ac4('0x52')](_0x52c899,_0x4d6874['value'],config['secrets'][_0x8ac4('0x54')])[_0x8ac4('0x25')](function(){return _0x4d6874;});}return _0x4d6874;}})[_0x8ac4('0x25')](function(_0x81b1fc){if(_0x81b1fc){if(!fs[_0x8ac4('0x51')](_0x81b1fc['value'])){throw new db[(_0x8ac4('0x55'))][(_0x8ac4('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x81b1fc['filename']){return _0x31c006[_0x8ac4('0x4d')](_0x81b1fc[_0x8ac4('0x4f')],_0x81b1fc['filename']+path[_0x8ac4('0x59')](_0x81b1fc[_0x8ac4('0x4f')]),function(){if(_0x1d62d6){fs[_0x8ac4('0x5a')](_0x81b1fc[_0x8ac4('0x4f')]);}});}else{return _0x31c006[_0x8ac4('0x4d')](_0x81b1fc['value'],function(_0x2276c7){if(_0x1d62d6){fs[_0x8ac4('0x5a')](_0x81b1fc[_0x8ac4('0x4f')]);}});}}})[_0x8ac4('0x47')](handleError(_0x31c006,null));};exports[_0x8ac4('0x26')]=function(_0x38dea4,_0xb0231a){return db['VoiceRecording'][_0x8ac4('0x49')]({'where':{'id':_0x38dea4[_0x8ac4('0x48')]['id']}})[_0x8ac4('0x25')](function(_0x466c69){if(_[_0x8ac4('0x63')](_0x466c69)){throw new ReferenceError(_0x8ac4('0x64'));}return _0x466c69;})[_0x8ac4('0x25')](function(_0x69c07b){var _0x2a9822=_0x69c07b[_0x8ac4('0x4f')];logger[_0x8ac4('0x65')](_0x8ac4('0x66'),_0x2a9822);if(!_['isNil'](_0x69c07b[_0x8ac4('0x4f')])&&fs[_0x8ac4('0x51')](_0x2a9822)){logger[_0x8ac4('0x65')](_0x8ac4('0x67')+_0x2a9822+_0x8ac4('0x68'));fs['unlinkSync'](_0x2a9822);}_0x2a9822=_0x2a9822+'.cypher';if(!_[_0x8ac4('0x63')](_0x69c07b[_0x8ac4('0x4f')])&&fs['existsSync'](_0x2a9822)){logger[_0x8ac4('0x65')]('File:\x20\x22'+_0x2a9822+_0x8ac4('0x68'));fs['unlinkSync'](_0x2a9822);}return _0x69c07b;})[_0x8ac4('0x25')](function(_0x3476f8){if(!_0x3476f8)throw new InternalError();return _0x3476f8[_0x8ac4('0x26')]();})[_0x8ac4('0x25')](function(){_0xb0231a['status'](0xcc)['end']();})[_0x8ac4('0x47')](handleError(_0xb0231a,null));};function getBucketslist(_0x405328,_0x2b471a,_0x206c4a){return new Promise(function(_0x4e50b0,_0x430906){var _0x1c92ff=new AWS['S3']({'accessKeyId':_0x2b471a,'secretAccessKey':_0x405328,'region':_0x206c4a});_0x1c92ff[_0x8ac4('0x69')]({},function(_0xbf0de0,_0x426c04){if(_0xbf0de0){return _0x430906(_0xbf0de0);}else{return _0x4e50b0(_0x426c04);}});});}function createBucket(_0x3e1c19,_0x3a7061,_0x1241da,_0x10b0fe){return new Promise(function(_0x17e328,_0x339578){var _0x4e929b=new AWS['S3']({'accessKeyId':_0x3a7061,'secretAccessKey':_0x3e1c19,'region':_0x1241da});_0x4e929b[_0x8ac4('0x6a')]({'Bucket':_0x10b0fe},function(_0x3e967a,_0x525250){if(_0x3e967a){return _0x339578(_0x3e967a);}else{return _0x17e328(_0x525250);}});});}function uploadFile(_0x21f550,_0x510277,_0x43a31f,_0x3bed20,_0x1f679f,_0x466eac){return new Promise(function(_0x50b125,_0x5deec6){var _0x4acef1=new AWS['S3']({'accessKeyId':_0x510277,'secretAccessKey':_0x21f550,'region':_0x43a31f});_0x4acef1[_0x8ac4('0x6b')]({'Bucket':_0x3bed20,'Key':_0x1f679f,'Body':_0x466eac},function(_0x160b00,_0x2bbb3e){if(_0x160b00){return _0x5deec6(_0x160b00);}else{return _0x50b125(_0x2bbb3e);}});});}function startTranscribe(_0x1e73b2,_0x3aa801,_0x4fc54e,_0x224633,_0x5afd68,_0x160f81){return new Promise(function(_0x44209b,_0x241c05){var _0x1cd5e6=new AWS[(_0x8ac4('0x6c'))]({'accessKeyId':_0x3aa801,'secretAccessKey':_0x1e73b2,'region':_0x4fc54e});_0x1cd5e6[_0x8ac4('0x6d')]({'TranscriptionJobName':_0x224633,'LanguageCode':_0x5afd68,'Media':{'MediaFileUri':_0x160f81}},function(_0x47a517,_0x159363){if(_0x47a517){return _0x241c05(_0x47a517);}else{return _0x44209b(_0x159363);}});});}function transcribe(_0x23be0d,_0x505c6a,_0x5045e9,_0xf44959,_0x4e3e8c,_0x2bd85d,_0x4a75da){return new Promise(function(_0x18fda1,_0x2dbec2){var _0x4b2aeb={};logger['info'](util[_0x8ac4('0x33')](_0x8ac4('0x6e'),_0x23be0d,_0x4e3e8c));return uploadFile(_0x505c6a,_0x5045e9,_0xf44959,_0x4e3e8c,path[_0x8ac4('0x6f')](_0x2bd85d),fs[_0x8ac4('0x70')](_0x2bd85d))[_0x8ac4('0x25')](function(_0x5aeff1){logger[_0x8ac4('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x23be0d,_0x4e3e8c,_0x5aeff1[_0x8ac4('0x71')]));_0x4b2aeb[_0x8ac4('0x72')]=_0x5aeff1[_0x8ac4('0x73')];_0x4b2aeb['location']=_0x5aeff1['Location'];logger['info'](util[_0x8ac4('0x33')](_0x8ac4('0x74'),_0x23be0d));return startTranscribe(_0x505c6a,_0x5045e9,_0xf44959,uuidv4(),_0x4a75da,_0x5aeff1[_0x8ac4('0x71')]);})[_0x8ac4('0x25')](function(_0xcab2f5){logger[_0x8ac4('0x65')](util[_0x8ac4('0x33')](_0x8ac4('0x75'),_0x23be0d,_0xcab2f5[_0x8ac4('0x76')][_0x8ac4('0x77')]));_0x4b2aeb['transcribeName']=_0xcab2f5['TranscriptionJob']['TranscriptionJobName'];_0x4b2aeb['transcribeStatus']=_0xcab2f5[_0x8ac4('0x76')][_0x8ac4('0x78')];return _0x18fda1(_0x4b2aeb);})[_0x8ac4('0x47')](function(_0x35f85d){return _0x2dbec2(_0x35f85d);});});}exports[_0x8ac4('0x79')]=function(_0x5e0a4f,_0x308452,_0x55347e){var _0x5ac717;var _0x12ce0d;var _0x5c318d;var _0x1872de=require(_0x8ac4('0x7a'));return db[_0x8ac4('0x2d')]['findOne']({'where':{'id':_0x5e0a4f['params']['id']}})[_0x8ac4('0x25')](function(_0x38a55d){if(_0x38a55d){var _0x4bf8c7=util['format'](_0x8ac4('0x50'),_0x38a55d[_0x8ac4('0x4f')]);if(fs[_0x8ac4('0x51')](_0x4bf8c7)){cypher=!![];return _0x1872de['decryptFile'](_0x4bf8c7,_0x38a55d[_0x8ac4('0x4f')],config['secrets'][_0x8ac4('0x54')])[_0x8ac4('0x25')](function(){return _0x38a55d;});}return _0x38a55d;}})[_0x8ac4('0x25')](function(_0x6bbcfd){if(!_0x6bbcfd){throw new db[(_0x8ac4('0x55'))][(_0x8ac4('0x56'))](_0x8ac4('0x7b'));}_0x12ce0d=_0x6bbcfd;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x308452,null))[_0x8ac4('0x25')](function(_0x20b028){if(_0x20b028){_0x5ac717=_0x20b028;if(!_0x5ac717[_0x8ac4('0x7c')]||!_0x5ac717[_0x8ac4('0x7d')]||!_0x5ac717['transcribeRegion']||!_0x5ac717[_0x8ac4('0x7e')]||!_0x5ac717['bucket']){throw new db[(_0x8ac4('0x55'))][(_0x8ac4('0x56'))](_0x8ac4('0x7f'));}if(_0x5e0a4f['body'][_0x8ac4('0x80')]&&(!_0x5ac717[_0x8ac4('0x81')]||!_0x5ac717[_0x8ac4('0x82')]||!_0x5ac717['sentimentRegion']||!_0x5ac717[_0x8ac4('0x7e')]||!_0x5ac717[_0x8ac4('0x72')])){throw new db['Sequelize']['ValidationError'](_0x8ac4('0x83'));}return db['CloudProvider'][_0x8ac4('0x84')]({'where':{'id':_0x5ac717[_0x8ac4('0x7d')]}});}})[_0x8ac4('0x25')](function(_0x488828){if(!_0x488828){throw new db[(_0x8ac4('0x55'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x488828[_0x8ac4('0x85')]||!_0x488828[_0x8ac4('0x86')]){throw new db['Sequelize'][(_0x8ac4('0x56'))](_0x8ac4('0x87'));}_0x5c318d=_0x488828;return getBucketslist(_0x5c318d[_0x8ac4('0x85')],_0x5c318d[_0x8ac4('0x86')],_0x5ac717[_0x8ac4('0x88')]);})['then'](function(_0x1e33ce){if(_0x1e33ce&&_0x1e33ce[_0x8ac4('0x89')]){var _0x29760c=_[_0x8ac4('0x49')](_0x1e33ce[_0x8ac4('0x89')],function(_0x26887f){return _0x26887f[_0x8ac4('0x8a')]===_0x5ac717['bucket'];});if(!_0x29760c){logger[_0x8ac4('0x65')](util[_0x8ac4('0x33')](_0x8ac4('0x8b'),_0x5e0a4f[_0x8ac4('0x48')]['id'],_0x5ac717['bucket']));return createBucket(_0x5c318d['data1'],_0x5c318d[_0x8ac4('0x86')],_0x5ac717[_0x8ac4('0x88')],_0x5ac717[_0x8ac4('0x72')]);}logger['info'](util[_0x8ac4('0x33')](_0x8ac4('0x8c'),_0x5e0a4f[_0x8ac4('0x48')]['id'],_0x5ac717[_0x8ac4('0x72')]));return;}})[_0x8ac4('0x25')](function(_0x53b975){if(_0x12ce0d[_0x8ac4('0x8d')]===_0x8ac4('0x8e')){return transcribe(_0x5e0a4f[_0x8ac4('0x48')]['id'],_0x5c318d['data1'],_0x5c318d[_0x8ac4('0x86')],_0x5ac717[_0x8ac4('0x88')],_0x5ac717['bucket'],_0x12ce0d[_0x8ac4('0x4f')],_0x5ac717[_0x8ac4('0x7e')]);}else{logger['info'](util[_0x8ac4('0x33')](_0x8ac4('0x8f'),_0x5e0a4f['params']['id']));return{'transcribeStatus':_0x8ac4('0x90')};}})[_0x8ac4('0x25')](function(_0x4fd60a){if(_0x4fd60a){_0x4fd60a[_0x8ac4('0x91')]=_0x5e0a4f[_0x8ac4('0x4b')][_0x8ac4('0x80')];return _0x12ce0d['updateAttributes'](_0x4fd60a);}})[_0x8ac4('0x25')](respondWithResult(_0x308452,null))[_0x8ac4('0x47')](handleError(_0x308452,null));};function writeFile(_0x5aacf7,_0x3fcc69){return new Promise(function(_0x5d0d3f,_0x411124){fs[_0x8ac4('0x92')](_0x3fcc69,_0x5aacf7,function(_0x57eca2,_0x43023b){if(_0x57eca2){return _0x411124(_0x57eca2);}else{return _0x5d0d3f(_0x43023b);}});});}exports[_0x8ac4('0x93')]=function(_0x59a7f3,_0x19afd9,_0x13281e){return db[_0x8ac4('0x2d')][_0x8ac4('0x84')]({'where':{'id':_0x59a7f3['params']['id']}})[_0x8ac4('0x25')](handleEntityNotFound(_0x19afd9))['then'](function(_0x594da0){if(_0x594da0&&_0x594da0[_0x8ac4('0x94')]){var _0x4b8d74=_0x594da0[_0x8ac4('0x94')];var _0x4f2c5e=config[_0x8ac4('0x95')]+'/server/files/transcribes/transcribe_'+_0x594da0['id']+_0x8ac4('0x96');if(fs['existsSync'](_0x4f2c5e)){return _0x4f2c5e;}return writeFile(_0x4b8d74,_0x4f2c5e)[_0x8ac4('0x25')](function(){return _0x4f2c5e;});}else{throw new db['Sequelize'][(_0x8ac4('0x56'))]('Transcript\x20not\x20available');}})[_0x8ac4('0x25')](function(_0x212c18){return _0x19afd9[_0x8ac4('0x4d')](_0x212c18);})[_0x8ac4('0x47')](handleError(_0x19afd9));}; \ No newline at end of file +var _0x2cec=['uuid/v4','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','VoiceRecording','includeAll','findAll','catch','params','find','create','body','describe','download','uniqueid','value','format','%s.cypher','decryptFile','recording','existsSync','filename','extname','unlink','message','VoiceRecording\x20not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','secrets','Sequelize','ValidationError','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','writeFile','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2cec,0x1a4));var _0xc2ce=function(_0x3e2b9a,_0x3e2fb8){_0x3e2b9a=_0x3e2b9a-0x0;var _0x6d9bc5=_0x2cec[_0x3e2b9a];return _0x6d9bc5;};'use strict';var emlformat=require(_0xc2ce('0x0'));var rimraf=require(_0xc2ce('0x1'));var zipdir=require(_0xc2ce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc2ce('0x3'));var BPromise=require(_0xc2ce('0x4'));var Mustache=require(_0xc2ce('0x5'));var util=require(_0xc2ce('0x6'));var path=require(_0xc2ce('0x7'));var sox=require(_0xc2ce('0x8'));var csv=require(_0xc2ce('0x9'));var ejs=require(_0xc2ce('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc2ce('0xb'));var crypto=require(_0xc2ce('0xc'));var jsforce=require(_0xc2ce('0xd'));var deskjs=require(_0xc2ce('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc2ce('0xf'));var Papa=require(_0xc2ce('0x10'));var AWS=require(_0xc2ce('0x11'));var uuidv4=require(_0xc2ce('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc2ce('0x13'));var as=require(_0xc2ce('0x14'));var hardwareService=require(_0xc2ce('0x15'));var logger=require(_0xc2ce('0x16'))(_0xc2ce('0x17'));var utils=require('../../config/utils');var config=require(_0xc2ce('0x18'));var licenseUtil=require(_0xc2ce('0x19'));var db=require(_0xc2ce('0x1a'))['db'];function respondWithStatusCode(_0xf7adcd,_0x4d165a){_0x4d165a=_0x4d165a||0xcc;return function(_0x36172b){if(_0x36172b){return _0xf7adcd[_0xc2ce('0x1b')](_0x4d165a);}return _0xf7adcd['status'](_0x4d165a)[_0xc2ce('0x1c')]();};}function respondWithResult(_0x481434,_0x5ed6b3){_0x5ed6b3=_0x5ed6b3||0xc8;return function(_0x23e800){if(_0x23e800){return _0x481434['status'](_0x5ed6b3)[_0xc2ce('0x1d')](_0x23e800);}};}function respondWithFilteredResult(_0x46fe35,_0xa7ca08){return function(_0x196906){if(_0x196906){var _0x208184=typeof _0xa7ca08['offset']==='undefined'&&typeof _0xa7ca08[_0xc2ce('0x1e')]===_0xc2ce('0x1f');var _0x3f418f=_0x196906[_0xc2ce('0x20')];var _0x4267bf=_0x208184?0x0:_0xa7ca08[_0xc2ce('0x21')];var _0x799878=_0x208184?_0x196906[_0xc2ce('0x20')]:_0xa7ca08[_0xc2ce('0x21')]+_0xa7ca08['limit'];var _0x473224;if(_0x799878>=_0x3f418f){_0x799878=_0x3f418f;_0x473224=0xc8;}else{_0x473224=0xce;}_0x46fe35[_0xc2ce('0x22')](_0x473224);return _0x46fe35[_0xc2ce('0x23')](_0xc2ce('0x24'),_0x4267bf+'-'+_0x799878+'/'+_0x3f418f)[_0xc2ce('0x1d')](_0x196906);}return null;};}function patchUpdates(_0x4e1b39){return function(_0x5ac1a4){try{jsonpatch[_0xc2ce('0x25')](_0x5ac1a4,_0x4e1b39,!![]);}catch(_0x41beb5){return BPromise[_0xc2ce('0x26')](_0x41beb5);}return _0x5ac1a4[_0xc2ce('0x27')]();};}function saveUpdates(_0x238865,_0x4b549b){return function(_0x50beff){if(_0x50beff){return _0x50beff[_0xc2ce('0x28')](_0x238865)[_0xc2ce('0x29')](function(_0x19db38){return _0x19db38;});}return null;};}function removeEntity(_0x3cb172,_0x23ea95){return function(_0x4bf853){if(_0x4bf853){return _0x4bf853[_0xc2ce('0x2a')]()[_0xc2ce('0x29')](function(){_0x3cb172[_0xc2ce('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe354da,_0x367d41){return function(_0x280bc1){if(!_0x280bc1){_0xe354da[_0xc2ce('0x1b')](0x194);}return _0x280bc1;};}function handleError(_0x40f058,_0x16c7cb){_0x16c7cb=_0x16c7cb||0x1f4;return function(_0xfe9ee4){logger[_0xc2ce('0x2b')](_0xfe9ee4[_0xc2ce('0x2c')]);if(_0xfe9ee4[_0xc2ce('0x2d')]){delete _0xfe9ee4[_0xc2ce('0x2d')];}_0x40f058[_0xc2ce('0x22')](_0x16c7cb)[_0xc2ce('0x2e')](_0xfe9ee4);};}exports['index']=function(_0x394c94,_0x1562a1){var _0x39d834={},_0x3f6899={},_0x572502={'count':0x0,'rows':[]};var _0x2b341e=_[_0xc2ce('0x2f')](db['VoiceRecording'][_0xc2ce('0x30')],function(_0x344115){return{'name':_0x344115['fieldName'],'type':_0x344115[_0xc2ce('0x31')][_0xc2ce('0x32')]};});_0x3f6899[_0xc2ce('0x33')]=_['differenceBy'](_[_0xc2ce('0x2f')](_0x2b341e,_0xc2ce('0x2d')),['format']);_0x3f6899['query']=_[_0xc2ce('0x34')](_0x394c94[_0xc2ce('0x35')]);_0x3f6899[_0xc2ce('0x36')]=_[_0xc2ce('0x37')](_0x3f6899[_0xc2ce('0x33')],_0x3f6899['query']);_0x39d834[_0xc2ce('0x38')]=_[_0xc2ce('0x37')](_0x3f6899[_0xc2ce('0x33')],qs[_0xc2ce('0x39')](_0x394c94[_0xc2ce('0x35')][_0xc2ce('0x39')]));_0x39d834[_0xc2ce('0x38')]=_0x39d834['attributes'][_0xc2ce('0x3a')]?_0x39d834['attributes']:_0x3f6899[_0xc2ce('0x33')];if(!_0x394c94[_0xc2ce('0x35')]['hasOwnProperty'](_0xc2ce('0x3b'))){_0x39d834[_0xc2ce('0x1e')]=qs[_0xc2ce('0x1e')](_0x394c94['query'][_0xc2ce('0x1e')]);_0x39d834[_0xc2ce('0x21')]=qs[_0xc2ce('0x21')](_0x394c94[_0xc2ce('0x35')][_0xc2ce('0x21')]);}_0x39d834['order']=qs[_0xc2ce('0x3c')](_0x394c94[_0xc2ce('0x35')][_0xc2ce('0x3c')]);_0x39d834[_0xc2ce('0x3d')]=qs[_0xc2ce('0x36')](_[_0xc2ce('0x3e')](_0x394c94[_0xc2ce('0x35')],_0x3f6899[_0xc2ce('0x36')]),_0x2b341e);if(_0x394c94[_0xc2ce('0x35')][_0xc2ce('0x3f')]){_0x39d834[_0xc2ce('0x3d')]=_['merge'](_0x39d834[_0xc2ce('0x3d')],{'$or':_[_0xc2ce('0x2f')](_0x2b341e,function(_0x3a5a78){if(_0x3a5a78['type']!=='VIRTUAL'){var _0x8ea4c9={};_0x8ea4c9[_0x3a5a78[_0xc2ce('0x2d')]]={'$like':'%'+_0x394c94[_0xc2ce('0x35')][_0xc2ce('0x3f')]+'%'};return _0x8ea4c9;}})});}_0x39d834=_[_0xc2ce('0x40')]({},_0x39d834,_0x394c94[_0xc2ce('0x41')]);var _0x3ffb28={'where':_0x39d834[_0xc2ce('0x3d')]};return db[_0xc2ce('0x42')][_0xc2ce('0x20')](_0x3ffb28)[_0xc2ce('0x29')](function(_0x1df63f){_0x572502[_0xc2ce('0x20')]=_0x1df63f;if(_0x394c94[_0xc2ce('0x35')][_0xc2ce('0x43')]){_0x39d834['include']=[{'all':!![]}];}return db[_0xc2ce('0x42')][_0xc2ce('0x44')](_0x39d834);})['then'](function(_0x727f20){_0x572502['rows']=_0x727f20;return _0x572502;})[_0xc2ce('0x29')](respondWithFilteredResult(_0x1562a1,_0x39d834))[_0xc2ce('0x45')](handleError(_0x1562a1,null));};exports['show']=function(_0x346d30,_0x4345bf){var _0x37b10a={'raw':![],'where':{'id':_0x346d30[_0xc2ce('0x46')]['id']}},_0x38dc9b={};_0x38dc9b[_0xc2ce('0x33')]=_[_0xc2ce('0x34')](db[_0xc2ce('0x42')][_0xc2ce('0x30')]);_0x38dc9b[_0xc2ce('0x35')]=_[_0xc2ce('0x34')](_0x346d30['query']);_0x38dc9b[_0xc2ce('0x36')]=_[_0xc2ce('0x37')](_0x38dc9b[_0xc2ce('0x33')],_0x38dc9b[_0xc2ce('0x35')]);_0x37b10a[_0xc2ce('0x38')]=_['intersection'](_0x38dc9b['model'],qs[_0xc2ce('0x39')](_0x346d30[_0xc2ce('0x35')][_0xc2ce('0x39')]));_0x37b10a[_0xc2ce('0x38')]=_0x37b10a['attributes'][_0xc2ce('0x3a')]?_0x37b10a[_0xc2ce('0x38')]:_0x38dc9b['model'];if(_0x346d30[_0xc2ce('0x35')][_0xc2ce('0x43')]){_0x37b10a['include']=[{'all':!![]}];}_0x37b10a=_['merge']({},_0x37b10a,_0x346d30[_0xc2ce('0x41')]);return db[_0xc2ce('0x42')][_0xc2ce('0x47')](_0x37b10a)[_0xc2ce('0x29')](handleEntityNotFound(_0x4345bf,null))[_0xc2ce('0x29')](respondWithResult(_0x4345bf,null))[_0xc2ce('0x45')](handleError(_0x4345bf,null));};exports[_0xc2ce('0x48')]=function(_0x5098ba,_0x4855ae){return db[_0xc2ce('0x42')][_0xc2ce('0x48')](_0x5098ba[_0xc2ce('0x49')],{})[_0xc2ce('0x29')](respondWithResult(_0x4855ae,0xc9))[_0xc2ce('0x45')](handleError(_0x4855ae,null));};exports[_0xc2ce('0x28')]=function(_0x21eca7,_0x380633){if(_0x21eca7[_0xc2ce('0x49')]['id']){delete _0x21eca7[_0xc2ce('0x49')]['id'];}return db[_0xc2ce('0x42')][_0xc2ce('0x47')]({'where':{'id':_0x21eca7[_0xc2ce('0x46')]['id']}})['then'](handleEntityNotFound(_0x380633,null))['then'](saveUpdates(_0x21eca7[_0xc2ce('0x49')],null))[_0xc2ce('0x29')](respondWithResult(_0x380633,null))[_0xc2ce('0x45')](handleError(_0x380633,null));};exports['describe']=function(_0x254630,_0x5a4825){return db['VoiceRecording'][_0xc2ce('0x4a')]()['then'](respondWithResult(_0x5a4825,null))[_0xc2ce('0x45')](handleError(_0x5a4825,null));};exports[_0xc2ce('0x4b')]=function(_0x43a36d,_0x4cf1cb,_0x1f5b6b){var _0x207295=require('../../components/encryptor');var _0x18af70=![];var _0x5ada97={};if(_0x43a36d[_0xc2ce('0x35')][_0xc2ce('0x31')]&&_0x43a36d[_0xc2ce('0x35')][_0xc2ce('0x31')]===_0xc2ce('0x4c')){_0x5ada97[_0xc2ce('0x4c')]=_0x43a36d[_0xc2ce('0x46')]['id'];}else{_0x5ada97['id']=_0x43a36d[_0xc2ce('0x46')]['id'];}return db[_0xc2ce('0x42')][_0xc2ce('0x47')]({'where':_0x5ada97,'attributes':['id',_0xc2ce('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x4cf1cb,null))['then'](function(_0x883404){if(_0x883404){var _0x234f06=_0x883404[_0xc2ce('0x4d')];var _0x1a2966=util[_0xc2ce('0x4e')](_0xc2ce('0x4f'),_0x234f06);if(fs['existsSync'](_0x1a2966)){_0x18af70=!![];return _0x207295[_0xc2ce('0x50')](_0x1a2966,_0x234f06,config['secrets'][_0xc2ce('0x51')])[_0xc2ce('0x29')](function(){return _0x883404;});}return _0x883404;}})[_0xc2ce('0x29')](function(_0x4039e2){if(_0x4039e2){var _0x4acad8=_0x4039e2[_0xc2ce('0x4d')];if(!fs[_0xc2ce('0x52')](_0x4acad8)){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x4039e2[_0xc2ce('0x53')]){return _0x4cf1cb['download'](_0x4acad8,_0x4039e2[_0xc2ce('0x53')]+path[_0xc2ce('0x54')](_0x4acad8),function(){if(_0x18af70){fs[_0xc2ce('0x55')](_0x4acad8);}});}else{return _0x4cf1cb['download'](_0x4acad8,function(_0x1acaf3){if(_0x18af70){fs[_0xc2ce('0x55')](_0x4acad8);}});}}})[_0xc2ce('0x45')](function(_0x444207){if(_0x444207[_0xc2ce('0x56')]===_0xc2ce('0x57')){_0x4cf1cb['status'](0x194)[_0xc2ce('0x2e')]('Not\x20found');}else{return handleError(_0x4cf1cb,null);}});};exports[_0xc2ce('0x58')]=function(_0x1b5729,_0x1cbf9f,_0x400598){var _0x1da104=require(_0xc2ce('0x59'));var _0x131533=![];var _0x1faf47={'$and':[db[_0xc2ce('0x5a')][_0xc2ce('0x3d')](db['sequelize']['fn'](_0xc2ce('0x5b'),db['sequelize'][_0xc2ce('0x5c')](_0xc2ce('0x4c'))),_0x1b5729[_0xc2ce('0x35')][_0xc2ce('0x5d')])]};if(_0x1b5729[_0xc2ce('0x35')]['type']&&_0x1b5729[_0xc2ce('0x35')][_0xc2ce('0x31')]===_0xc2ce('0x4c')){_0x1faf47[_0xc2ce('0x5e')][_0xc2ce('0x5f')]({'uniqueid':_0x1b5729[_0xc2ce('0x46')]['id']});}else{_0x1faf47[_0xc2ce('0x5e')]['push']({'id':_0x1b5729[_0xc2ce('0x46')]['id']});}return db[_0xc2ce('0x42')][_0xc2ce('0x47')]({'where':_0x1faf47,'attributes':['id',_0xc2ce('0x4d')],'raw':!![]})[_0xc2ce('0x29')](handleEntityNotFound(_0x1cbf9f,null))[_0xc2ce('0x29')](function(_0x2b1d63){if(_0x2b1d63){var _0x46002e=util[_0xc2ce('0x4e')](_0xc2ce('0x4f'),_0x2b1d63[_0xc2ce('0x4d')]);if(fs[_0xc2ce('0x52')](_0x46002e)){_0x131533=!![];return _0x1da104[_0xc2ce('0x50')](_0x46002e,_0x2b1d63[_0xc2ce('0x4d')],config[_0xc2ce('0x60')][_0xc2ce('0x51')])['then'](function(){return _0x2b1d63;});}return _0x2b1d63;}})['then'](function(_0x3430de){if(_0x3430de){if(!fs['existsSync'](_0x3430de[_0xc2ce('0x4d')])){throw new db[(_0xc2ce('0x61'))][(_0xc2ce('0x62'))]('VoiceRecording\x20not\x20found');}if(_0x3430de[_0xc2ce('0x53')]){return _0x1cbf9f['download'](_0x3430de[_0xc2ce('0x4d')],_0x3430de[_0xc2ce('0x53')]+path['extname'](_0x3430de[_0xc2ce('0x4d')]),function(){if(_0x131533){fs['unlink'](_0x3430de[_0xc2ce('0x4d')]);}});}else{return _0x1cbf9f[_0xc2ce('0x4b')](_0x3430de['value'],function(_0x52db84){if(_0x131533){fs[_0xc2ce('0x55')](_0x3430de[_0xc2ce('0x4d')]);}});}}})[_0xc2ce('0x45')](handleError(_0x1cbf9f,null));};exports['destroy']=function(_0x10f29c,_0x3b76c6){return db[_0xc2ce('0x42')][_0xc2ce('0x47')]({'where':{'id':_0x10f29c[_0xc2ce('0x46')]['id']}})[_0xc2ce('0x29')](function(_0x3483db){if(_[_0xc2ce('0x63')](_0x3483db)){throw new ReferenceError(_0xc2ce('0x64'));}return _0x3483db;})[_0xc2ce('0x29')](function(_0x4af566){var _0x486148=_0x4af566[_0xc2ce('0x4d')];logger[_0xc2ce('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x486148);if(!_['isNil'](_0x4af566[_0xc2ce('0x4d')])&&fs['existsSync'](_0x486148)){logger[_0xc2ce('0x65')](_0xc2ce('0x66')+_0x486148+_0xc2ce('0x67'));fs[_0xc2ce('0x68')](_0x486148);}_0x486148=_0x486148+_0xc2ce('0x69');if(!_[_0xc2ce('0x63')](_0x4af566[_0xc2ce('0x4d')])&&fs['existsSync'](_0x486148)){logger[_0xc2ce('0x65')](_0xc2ce('0x66')+_0x486148+_0xc2ce('0x67'));fs[_0xc2ce('0x68')](_0x486148);}return _0x4af566;})[_0xc2ce('0x29')](function(_0x4b166){if(!_0x4b166)throw new InternalError();return _0x4b166[_0xc2ce('0x2a')]();})[_0xc2ce('0x29')](function(){_0x3b76c6['status'](0xcc)['end']();})[_0xc2ce('0x45')](handleError(_0x3b76c6,null));};function getBucketslist(_0x40eb81,_0x43f3ca,_0x2029ff){return new Promise(function(_0x1dabe2,_0x14356a){var _0x346ba3=new AWS['S3']({'accessKeyId':_0x43f3ca,'secretAccessKey':_0x40eb81,'region':_0x2029ff});_0x346ba3[_0xc2ce('0x6a')]({},function(_0x24fbf4,_0x271e7a){if(_0x24fbf4){return _0x14356a(_0x24fbf4);}else{return _0x1dabe2(_0x271e7a);}});});}function createBucket(_0x48c9cf,_0x59c100,_0x24b600,_0x1866ea){return new Promise(function(_0xd46648,_0x1cea1d){var _0x272568=new AWS['S3']({'accessKeyId':_0x59c100,'secretAccessKey':_0x48c9cf,'region':_0x24b600});_0x272568[_0xc2ce('0x6b')]({'Bucket':_0x1866ea},function(_0x3a25f5,_0x1f5d7a){if(_0x3a25f5){return _0x1cea1d(_0x3a25f5);}else{return _0xd46648(_0x1f5d7a);}});});}function uploadFile(_0x640bfe,_0x322868,_0x59c015,_0x228e92,_0x2fd4e7,_0x5d8c2e){return new Promise(function(_0x165c66,_0x2a3cd0){var _0x10f95e=new AWS['S3']({'accessKeyId':_0x322868,'secretAccessKey':_0x640bfe,'region':_0x59c015});_0x10f95e[_0xc2ce('0x6c')]({'Bucket':_0x228e92,'Key':_0x2fd4e7,'Body':_0x5d8c2e},function(_0x493363,_0x35f70a){if(_0x493363){return _0x2a3cd0(_0x493363);}else{return _0x165c66(_0x35f70a);}});});}function startTranscribe(_0x40f208,_0x2dc433,_0x5cc4a5,_0xdab552,_0x567efe,_0x3e8da8){return new Promise(function(_0x2150f3,_0x12eb69){var _0x4e8c42=new AWS[(_0xc2ce('0x6d'))]({'accessKeyId':_0x2dc433,'secretAccessKey':_0x40f208,'region':_0x5cc4a5});_0x4e8c42['startTranscriptionJob']({'TranscriptionJobName':_0xdab552,'LanguageCode':_0x567efe,'Media':{'MediaFileUri':_0x3e8da8}},function(_0x28ac98,_0x240020){if(_0x28ac98){return _0x12eb69(_0x28ac98);}else{return _0x2150f3(_0x240020);}});});}function transcribe(_0x1eb651,_0x410d4b,_0x7cbeb,_0xe51f17,_0x20248d,_0xdeaef5,_0x16114b){return new Promise(function(_0x40dfa4,_0x46fd1f){var _0x186793={};logger[_0xc2ce('0x65')](util[_0xc2ce('0x4e')](_0xc2ce('0x6e'),_0x1eb651,_0x20248d));return uploadFile(_0x410d4b,_0x7cbeb,_0xe51f17,_0x20248d,path[_0xc2ce('0x6f')](_0xdeaef5),fs[_0xc2ce('0x70')](_0xdeaef5))['then'](function(_0x337800){logger[_0xc2ce('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x1eb651,_0x20248d,_0x337800[_0xc2ce('0x71')]));_0x186793['bucket']=_0x337800['Bucket'];_0x186793[_0xc2ce('0x72')]=_0x337800[_0xc2ce('0x71')];logger[_0xc2ce('0x65')](util[_0xc2ce('0x4e')](_0xc2ce('0x73'),_0x1eb651));return startTranscribe(_0x410d4b,_0x7cbeb,_0xe51f17,uuidv4(),_0x16114b,_0x337800[_0xc2ce('0x71')]);})[_0xc2ce('0x29')](function(_0x3cefa4){logger[_0xc2ce('0x65')](util[_0xc2ce('0x4e')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1eb651,_0x3cefa4[_0xc2ce('0x74')][_0xc2ce('0x75')]));_0x186793['transcribeName']=_0x3cefa4[_0xc2ce('0x74')][_0xc2ce('0x75')];_0x186793[_0xc2ce('0x76')]=_0x3cefa4['TranscriptionJob'][_0xc2ce('0x77')];return _0x40dfa4(_0x186793);})['catch'](function(_0x2955a5){return _0x46fd1f(_0x2955a5);});});}exports[_0xc2ce('0x78')]=function(_0x1977b2,_0x4a22f9,_0x4e1254){var _0x59d8a4;var _0x508d22;var _0x3423b5;var _0xddc42a=require(_0xc2ce('0x59'));return db['VoiceRecording'][_0xc2ce('0x79')]({'where':{'id':_0x1977b2[_0xc2ce('0x46')]['id']}})[_0xc2ce('0x29')](function(_0x5a9266){if(_0x5a9266){var _0x4e5e16=util[_0xc2ce('0x4e')](_0xc2ce('0x4f'),_0x5a9266[_0xc2ce('0x4d')]);if(fs[_0xc2ce('0x52')](_0x4e5e16)){cypher=!![];return _0xddc42a[_0xc2ce('0x50')](_0x4e5e16,_0x5a9266[_0xc2ce('0x4d')],config[_0xc2ce('0x60')][_0xc2ce('0x51')])[_0xc2ce('0x29')](function(){return _0x5a9266;});}return _0x5a9266;}})[_0xc2ce('0x29')](function(_0x2808bc){if(!_0x2808bc){throw new db[(_0xc2ce('0x61'))][(_0xc2ce('0x62'))](_0xc2ce('0x7a'));}_0x508d22=_0x2808bc;return db['Setting'][_0xc2ce('0x79')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4a22f9,null))[_0xc2ce('0x29')](function(_0x35e7fb){if(_0x35e7fb){_0x59d8a4=_0x35e7fb;if(!_0x59d8a4[_0xc2ce('0x7b')]||!_0x59d8a4[_0xc2ce('0x7c')]||!_0x59d8a4[_0xc2ce('0x7d')]||!_0x59d8a4[_0xc2ce('0x7e')]||!_0x59d8a4[_0xc2ce('0x7f')]){throw new db[(_0xc2ce('0x61'))][(_0xc2ce('0x62'))](_0xc2ce('0x80'));}if(_0x1977b2[_0xc2ce('0x49')][_0xc2ce('0x81')]&&(!_0x59d8a4[_0xc2ce('0x82')]||!_0x59d8a4[_0xc2ce('0x83')]||!_0x59d8a4['sentimentRegion']||!_0x59d8a4['language']||!_0x59d8a4[_0xc2ce('0x7f')])){throw new db['Sequelize'][(_0xc2ce('0x62'))](_0xc2ce('0x84'));}return db[_0xc2ce('0x85')][_0xc2ce('0x79')]({'where':{'id':_0x59d8a4[_0xc2ce('0x7c')]}});}})[_0xc2ce('0x29')](function(_0x56175c){if(!_0x56175c){throw new db[(_0xc2ce('0x61'))][(_0xc2ce('0x62'))](_0xc2ce('0x86'));}if(!_0x56175c[_0xc2ce('0x87')]||!_0x56175c[_0xc2ce('0x88')]){throw new db[(_0xc2ce('0x61'))][(_0xc2ce('0x62'))]('Cloud\x20Provider\x20not\x20configured');}_0x3423b5=_0x56175c;return getBucketslist(_0x3423b5[_0xc2ce('0x87')],_0x3423b5[_0xc2ce('0x88')],_0x59d8a4[_0xc2ce('0x7d')]);})[_0xc2ce('0x29')](function(_0x3e3d28){if(_0x3e3d28&&_0x3e3d28['Buckets']){var _0x472f29=_[_0xc2ce('0x47')](_0x3e3d28['Buckets'],function(_0x597d50){return _0x597d50['Name']===_0x59d8a4[_0xc2ce('0x7f')];});if(!_0x472f29){logger[_0xc2ce('0x65')](util['format'](_0xc2ce('0x89'),_0x1977b2[_0xc2ce('0x46')]['id'],_0x59d8a4[_0xc2ce('0x7f')]));return createBucket(_0x3423b5[_0xc2ce('0x87')],_0x3423b5['data2'],_0x59d8a4[_0xc2ce('0x7d')],_0x59d8a4[_0xc2ce('0x7f')]);}logger[_0xc2ce('0x65')](util[_0xc2ce('0x4e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x1977b2['params']['id'],_0x59d8a4['bucket']));return;}})[_0xc2ce('0x29')](function(_0x17ae1f){if(_0x508d22[_0xc2ce('0x76')]===_0xc2ce('0x8a')){return transcribe(_0x1977b2[_0xc2ce('0x46')]['id'],_0x3423b5[_0xc2ce('0x87')],_0x3423b5['data2'],_0x59d8a4['transcribeRegion'],_0x59d8a4['bucket'],_0x508d22[_0xc2ce('0x4d')],_0x59d8a4[_0xc2ce('0x7e')]);}else{logger[_0xc2ce('0x65')](util['format'](_0xc2ce('0x8b'),_0x1977b2[_0xc2ce('0x46')]['id']));return{'transcribeStatus':_0xc2ce('0x8c')};}})[_0xc2ce('0x29')](function(_0x1e8caa){if(_0x1e8caa){_0x1e8caa['tempSentiment']=_0x1977b2[_0xc2ce('0x49')][_0xc2ce('0x81')];return _0x508d22['updateAttributes'](_0x1e8caa);}})['then'](respondWithResult(_0x4a22f9,null))[_0xc2ce('0x45')](handleError(_0x4a22f9,null));};function writeFile(_0x188c00,_0x1ca0e4){return new Promise(function(_0x1a7f40,_0x201518){fs[_0xc2ce('0x8d')](_0x1ca0e4,_0x188c00,function(_0x32f432,_0x12512e){if(_0x32f432){return _0x201518(_0x32f432);}else{return _0x1a7f40(_0x12512e);}});});}exports['downloadTranscribe']=function(_0x22c98c,_0x308494,_0x458216){return db[_0xc2ce('0x42')]['findOne']({'where':{'id':_0x22c98c[_0xc2ce('0x46')]['id']}})['then'](handleEntityNotFound(_0x308494))[_0xc2ce('0x29')](function(_0x331096){if(_0x331096&&_0x331096[_0xc2ce('0x8e')]){var _0x432395=_0x331096['fileText'];var _0x49ffb2=config[_0xc2ce('0x8f')]+_0xc2ce('0x90')+_0x331096['id']+'.txt';if(fs[_0xc2ce('0x52')](_0x49ffb2)){return _0x49ffb2;}return writeFile(_0x432395,_0x49ffb2)[_0xc2ce('0x29')](function(){return _0x49ffb2;});}else{throw new db[(_0xc2ce('0x61'))][(_0xc2ce('0x62'))](_0xc2ce('0x91'));}})[_0xc2ce('0x29')](function(_0x21b34c){return _0x308494[_0xc2ce('0x4b')](_0x21b34c);})['catch'](handleError(_0x308494));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index b5f812e..aeedd22 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 _0x3379=['transcribeStatus','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x3379,0x115));var _0x9337=function(_0x414da6,_0x19c7ca){_0x414da6=_0x414da6-0x0;var _0x47f446=_0x3379[_0x414da6];return _0x47f446;};'use strict';var attributes=require(_0x9337('0x0'));module[_0x9337('0x1')]=function(_0x43fb11,_0x3338dd){return _0x43fb11['define'](_0x9337('0x2'),attributes,{'tableName':_0x9337('0x3'),'paranoid':![],'indexes':[{'name':_0x9337('0x4'),'fields':[_0x9337('0x4')]},{'name':'transcribeStatus','fields':[_0x9337('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b75=['define','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x1c7021,_0x13efdf){var _0x1a0edf=function(_0x591d37){while(--_0x591d37){_0x1c7021['push'](_0x1c7021['shift']());}};_0x1a0edf(++_0x13efdf);}(_0x3b75,0xdc));var _0x53b7=function(_0x303064,_0x12f0c2){_0x303064=_0x303064-0x0;var _0x5a1d3d=_0x3b75[_0x303064];return _0x5a1d3d;};'use strict';var attributes=require(_0x53b7('0x0'));module[_0x53b7('0x1')]=function(_0x3ac0a0,_0x3bd8fc){return _0x3ac0a0[_0x53b7('0x2')]('VoiceRecording',attributes,{'tableName':_0x53b7('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x53b7('0x4')]},{'name':'transcribeStatus','fields':[_0x53b7('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 c6c7610..7a7bae6 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 _0x5b12=['Setting','callRecordingEncryption','create','body','value','format','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','UpdateVoiceRecording','VoiceRecording','options','raw','attributes','CreateVoiceRecording','../../components/encryptor'];(function(_0x188f29,_0x3875e6){var _0x4a5489=function(_0x66e5c4){while(--_0x66e5c4){_0x188f29['push'](_0x188f29['shift']());}};_0x4a5489(++_0x3875e6);}(_0x5b12,0xa3));var _0x25b1=function(_0x1efdec,_0x172902){_0x1efdec=_0x1efdec-0x0;var _0x3dd959=_0x5b12[_0x1efdec];return _0x3dd959;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb95b,_0x1f715d,_0x28c980){return new BPromise(function(_0x451c66,_0x2a46e0){return client[_0x25b1('0x8')](_0x5bb95b,_0x28c980)[_0x25b1('0x9')](function(_0x3346ed){logger[_0x25b1('0xa')]('VoiceRecording,\x20%s,\x20%s',_0x1f715d,_0x25b1('0xb'));logger[_0x25b1('0xc')](_0x25b1('0xd'),_0x1f715d,_0x25b1('0xb'),JSON[_0x25b1('0xe')](_0x3346ed));if(_0x3346ed[_0x25b1('0xf')]){if(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x10')]===0x1f4){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);return _0x2a46e0(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);}logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed['error'][_0x25b1('0x12')]);return _0x451c66(_0x3346ed[_0x25b1('0xf')]['message']);}else{logger[_0x25b1('0xa')](_0x25b1('0x11'),_0x1f715d,_0x25b1('0xb'));_0x451c66(_0x3346ed['result']['message']);}})[_0x25b1('0x13')](function(_0x573ec2){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x573ec2);_0x2a46e0(_0x573ec2);});});}exports[_0x25b1('0x14')]=function(_0x27ccc9){var _0x1f78c2=this;return new Promise(function(_0x2a7d14,_0x17024a){return db[_0x25b1('0x15')]['update'](_0x27ccc9['body'],{'raw':_0x27ccc9[_0x25b1('0x16')]?_0x27ccc9['options'][_0x25b1('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27ccc9['options']?_0x27ccc9[_0x25b1('0x16')]['where']||null:null,'attributes':_0x27ccc9[_0x25b1('0x16')]?_0x27ccc9['options'][_0x25b1('0x18')]||null:null,'limit':_0x27ccc9['options']?_0x27ccc9['options']['limit']||null:null})[_0x25b1('0x9')](function(_0x150436){logger['info'](_0x25b1('0x14'),_0x27ccc9);logger[_0x25b1('0xc')](_0x25b1('0x14'),_0x27ccc9,JSON[_0x25b1('0xe')](_0x150436));_0x2a7d14(_0x150436);})[_0x25b1('0x13')](function(_0x5e6b6b){logger[_0x25b1('0xf')](_0x25b1('0x14'),_0x5e6b6b[_0x25b1('0x12')],_0x27ccc9);_0x17024a(_0x1f78c2[_0x25b1('0xf')](0x1f4,_0x5e6b6b[_0x25b1('0x12')]));});});};exports[_0x25b1('0x19')]=function(_0x5d9ed7){var _0x3c05c6=this;return new Promise(function(_0x27dd68,_0x3d279f){var _0x5bc8fc=require(_0x25b1('0x1a'));var _0x9e175f;return db[_0x25b1('0x1b')]['findOne']({'attributes':['id',_0x25b1('0x1c')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x19ecd1){_0x9e175f=_0x19ecd1;return db[_0x25b1('0x15')][_0x25b1('0x1d')](_0x5d9ed7[_0x25b1('0x1e')]);})[_0x25b1('0x9')](function(_0x300a14){if(_0x9e175f[_0x25b1('0x1c')]&&fs['existsSync'](_0x300a14[_0x25b1('0x1f')])){var _0xca56f0=util[_0x25b1('0x20')](_0x25b1('0x21'),_0x300a14[_0x25b1('0x1f')]);return _0x5bc8fc['encryptFile'](_0x300a14[_0x25b1('0x1f')],_0xca56f0,config[_0x25b1('0x22')][_0x25b1('0x23')])[_0x25b1('0x9')](function(){fs[_0x25b1('0x24')](_0x300a14['value']);logger['info'](_0x25b1('0x25'));return _0x300a14;});}return _0x300a14;})['then'](function(_0x446984){logger[_0x25b1('0xa')](_0x25b1('0x19'),_0x5d9ed7);logger['debug']('CreateVoiceRecording',_0x5d9ed7,JSON[_0x25b1('0xe')](_0x446984));_0x27dd68(_0x446984);})[_0x25b1('0x13')](function(_0x26d3bc){logger['error'](_0x25b1('0x19'),_0x26d3bc[_0x25b1('0x12')],_0x5d9ed7);_0x3d279f(_0x3c05c6[_0x25b1('0xf')](0x1f4,_0x26d3bc[_0x25b1('0x12')]));});});}; \ No newline at end of file +var _0x0b0e=['secrets','recording','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','update','options','where','attributes','UpdateVoiceRecording','../../components/encryptor','Setting','callRecordingEncryption','VoiceRecording','create','body','existsSync','format','encryptFile','value'];(function(_0xecfc67,_0x324174){var _0xa9d1a7=function(_0x237b42){while(--_0x237b42){_0xecfc67['push'](_0xecfc67['shift']());}};_0xa9d1a7(++_0x324174);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3c30a4,_0x152fd6){_0x3c30a4=_0x3c30a4-0x0;var _0x4f3e14=_0x0b0e[_0x3c30a4];return _0x4f3e14;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});}exports['UpdateVoiceRecording']=function(_0x54a3eb){var _0x46bb44=this;return new Promise(function(_0x50a441,_0x4df8da){return db['VoiceRecording'][_0xe0b0('0x18')](_0x54a3eb['body'],{'raw':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54a3eb[_0xe0b0('0x19')]?_0x54a3eb['options'][_0xe0b0('0x1a')]||null:null,'attributes':_0x54a3eb[_0xe0b0('0x19')]?_0x54a3eb[_0xe0b0('0x19')][_0xe0b0('0x1b')]||null:null,'limit':_0x54a3eb[_0xe0b0('0x19')]?_0x54a3eb['options']['limit']||null:null})[_0xe0b0('0xd')](function(_0x5512bb){logger[_0xe0b0('0xe')](_0xe0b0('0x1c'),_0x54a3eb);logger['debug'](_0xe0b0('0x1c'),_0x54a3eb,JSON['stringify'](_0x5512bb));_0x50a441(_0x5512bb);})[_0xe0b0('0x17')](function(_0x49a727){logger[_0xe0b0('0x13')]('UpdateVoiceRecording',_0x49a727[_0xe0b0('0x14')],_0x54a3eb);_0x4df8da(_0x46bb44['error'](0x1f4,_0x49a727[_0xe0b0('0x14')]));});});};exports['CreateVoiceRecording']=function(_0x3c221d){var _0x5c5317=this;return new Promise(function(_0x362aba,_0x3c3bc2){var _0x1f1ebd=require(_0xe0b0('0x1d'));var _0x3ec2;return db[_0xe0b0('0x1e')]['findOne']({'attributes':['id',_0xe0b0('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xe0b0('0xd')](function(_0x5b7a64){_0x3ec2=_0x5b7a64;return db[_0xe0b0('0x20')][_0xe0b0('0x21')](_0x3c221d[_0xe0b0('0x22')]);})[_0xe0b0('0xd')](function(_0x3cdbd5){if(_0x3ec2[_0xe0b0('0x1f')]&&fs[_0xe0b0('0x23')](_0x3cdbd5['value'])){var _0x1854b8=util[_0xe0b0('0x24')]('%s.cypher',_0x3cdbd5['value']);return _0x1f1ebd[_0xe0b0('0x25')](_0x3cdbd5[_0xe0b0('0x26')],_0x1854b8,config[_0xe0b0('0x27')][_0xe0b0('0x28')])[_0xe0b0('0xd')](function(){fs['unlink'](_0x3cdbd5[_0xe0b0('0x26')]);logger[_0xe0b0('0xe')](_0xe0b0('0x29'));return _0x3cdbd5;});}return _0x3cdbd5;})[_0xe0b0('0xd')](function(_0x27158f){logger['info'](_0xe0b0('0x2a'),_0x3c221d);logger[_0xe0b0('0x10')](_0xe0b0('0x2a'),_0x3c221d,JSON[_0xe0b0('0x12')](_0x27158f));_0x362aba(_0x27158f);})[_0xe0b0('0x17')](function(_0x12eeb8){logger[_0xe0b0('0x13')](_0xe0b0('0x2a'),_0x12eeb8[_0xe0b0('0x14')],_0x3c221d);_0x3c3bc2(_0x5c5317[_0xe0b0('0x13')](0x1f4,_0x12eeb8[_0xe0b0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 6f0c357..3420f62 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 _0x1231=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','index','get','/describe','isAuthenticated','describe','post','create','put','update','delete','/:id','exports','multer','util','path','express','Router'];(function(_0x575d37,_0x48033b){var _0x8046bd=function(_0x6039a8){while(--_0x6039a8){_0x575d37['push'](_0x575d37['shift']());}};_0x8046bd(++_0x48033b);}(_0x1231,0xc1));var _0x1123=function(_0x5d20d7,_0x3e0eba){_0x5d20d7=_0x5d20d7-0x0;var _0x4c280a=_0x1231[_0x5d20d7];return _0x4c280a;};'use strict';var multer=require(_0x1123('0x0'));var util=require(_0x1123('0x1'));var path=require(_0x1123('0x2'));var timeout=require('connect-timeout');var express=require(_0x1123('0x3'));var router=express[_0x1123('0x4')]();var fs_extra=require(_0x1123('0x5'));var auth=require(_0x1123('0x6'));var interaction=require(_0x1123('0x7'));var config=require(_0x1123('0x8'));var controller=require(_0x1123('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1123('0xa')]);router[_0x1123('0xb')](_0x1123('0xc'),auth[_0x1123('0xd')](),controller[_0x1123('0xe')]);router[_0x1123('0xb')]('/:id',auth[_0x1123('0xd')](),controller['show']);router[_0x1123('0xf')]('/',auth[_0x1123('0xd')](),controller[_0x1123('0x10')]);router[_0x1123('0x11')]('/:id',auth[_0x1123('0xd')](),controller[_0x1123('0x12')]);router[_0x1123('0x13')](_0x1123('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x1123('0x15')]=router; \ No newline at end of file +var _0x90fd=['/describe','describe','/:id','isAuthenticated','show','post','create','put','update','exports','multer','util','path','express','fs-extra','../../components/interaction/service','./voiceTransferReport.controller','get'];(function(_0x1710a9,_0x37a544){var _0x2336f7=function(_0x2b37ee){while(--_0x2b37ee){_0x1710a9['push'](_0x1710a9['shift']());}};_0x2336f7(++_0x37a544);}(_0x90fd,0x196));var _0xd90f=function(_0x1e7af1,_0x4457c4){_0x1e7af1=_0x1e7af1-0x0;var _0x1643c4=_0x90fd[_0x1e7af1];return _0x1643c4;};'use strict';var multer=require(_0xd90f('0x0'));var util=require(_0xd90f('0x1'));var path=require(_0xd90f('0x2'));var timeout=require('connect-timeout');var express=require(_0xd90f('0x3'));var router=express['Router']();var fs_extra=require(_0xd90f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd90f('0x5'));var config=require('../../config/environment');var controller=require(_0xd90f('0x6'));router[_0xd90f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd90f('0x7')](_0xd90f('0x8'),auth['isAuthenticated'](),controller[_0xd90f('0x9')]);router[_0xd90f('0x7')](_0xd90f('0xa'),auth[_0xd90f('0xb')](),controller[_0xd90f('0xc')]);router[_0xd90f('0xd')]('/',auth[_0xd90f('0xb')](),controller[_0xd90f('0xe')]);router[_0xd90f('0xf')](_0xd90f('0xa'),auth[_0xd90f('0xb')](),controller[_0xd90f('0x10')]);router['delete']('/:id',auth[_0xd90f('0xb')](),controller['destroy']);module[_0xd90f('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 420e799..78894de 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 _0xd5f9=['attended','STRING','Yes','moment','ENUM','blind'];(function(_0x3bda0a,_0x5b404e){var _0x5b7f12=function(_0x4aa0a6){while(--_0x4aa0a6){_0x3bda0a['push'](_0x3bda0a['shift']());}};_0x5b7f12(++_0x5b404e);}(_0xd5f9,0x13b));var _0x9d5f=function(_0x3328b4,_0x403a24){_0x3328b4=_0x3328b4-0x0;var _0x530143=_0xd5f9[_0x3328b4];return _0x530143;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9d5f('0x0'));module['exports']={'type':{'type':Sequelize[_0x9d5f('0x1')](_0x9d5f('0x2'),_0x9d5f('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x9d5f('0x4')]},'transferercalleridname':{'type':Sequelize[_0x9d5f('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x9d5f('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x9d5f('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x9d5f('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x9d5f('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x9d5f('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x9d5f('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x9d5f('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x9d5f('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x9d5f('0x4')]},'transfereecontext':{'type':Sequelize[_0x9d5f('0x4')]},'transfereeexten':{'type':Sequelize[_0x9d5f('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x9d5f('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x9d5f('0x5'),'No')},'context':{'type':Sequelize[_0x9d5f('0x4')]},'extension':{'type':Sequelize[_0x9d5f('0x4')]}}; \ No newline at end of file +var _0xa79a=['STRING','Yes','sequelize','exports','ENUM','blind','attended'];(function(_0x265c81,_0x4d539a){var _0x3e63d1=function(_0x5bc90e){while(--_0x5bc90e){_0x265c81['push'](_0x265c81['shift']());}};_0x3e63d1(++_0x4d539a);}(_0xa79a,0x12f));var _0xaa79=function(_0x6f6376,_0x4afe50){_0x6f6376=_0x6f6376-0x0;var _0x2e4685=_0xa79a[_0x6f6376];return _0x2e4685;};'use strict';var Sequelize=require(_0xaa79('0x0'));var moment=require('moment');module[_0xaa79('0x1')]={'type':{'type':Sequelize[_0xaa79('0x2')](_0xaa79('0x3'),_0xaa79('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xaa79('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xaa79('0x5')]},'transferercalleridname':{'type':Sequelize[_0xaa79('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xaa79('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xaa79('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xaa79('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xaa79('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xaa79('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xaa79('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xaa79('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xaa79('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xaa79('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xaa79('0x2')](_0xaa79('0x6'),'No')},'context':{'type':Sequelize[_0xaa79('0x5')]},'extension':{'type':Sequelize[_0xaa79('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 03f2a5f..69db7bd 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 _0xd25c=['merge','filter','options','includeAll','include','VoiceTransferReport','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','then','end','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick'];(function(_0x369e31,_0x5f1558){var _0x33b750=function(_0x264483){while(--_0x264483){_0x369e31['push'](_0x369e31['shift']());}};_0x33b750(++_0x5f1558);}(_0xd25c,0x1db));var _0xcd25=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xd25c[_0x3635ce];return _0x97ecd0;};'use strict';var emlformat=require(_0xcd25('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd25('0x1'));var jsonpatch=require(_0xcd25('0x2'));var rp=require(_0xcd25('0x3'));var moment=require(_0xcd25('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd25('0x5'));var util=require(_0xcd25('0x6'));var path=require(_0xcd25('0x7'));var sox=require(_0xcd25('0x8'));var csv=require(_0xcd25('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd25('0xa'));var _=require(_0xcd25('0xb'));var squel=require(_0xcd25('0xc'));var crypto=require(_0xcd25('0xd'));var jsforce=require(_0xcd25('0xe'));var deskjs=require(_0xcd25('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcd25('0x10'));var Papa=require(_0xcd25('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd25('0x12'));var as=require(_0xcd25('0x13'));var hardwareService=require(_0xcd25('0x14'));var logger=require(_0xcd25('0x15'))(_0xcd25('0x16'));var utils=require(_0xcd25('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcd25('0x18'));var db=require(_0xcd25('0x19'))['db'];function respondWithStatusCode(_0x593d74,_0x27f536){_0x27f536=_0x27f536||0xcc;return function(_0x4cea2c){if(_0x4cea2c){return _0x593d74[_0xcd25('0x1a')](_0x27f536);}return _0x593d74[_0xcd25('0x1b')](_0x27f536)['end']();};}function respondWithResult(_0x16236d,_0x427aae){_0x427aae=_0x427aae||0xc8;return function(_0xcd8900){if(_0xcd8900){return _0x16236d[_0xcd25('0x1b')](_0x427aae)['json'](_0xcd8900);}};}function respondWithFilteredResult(_0x5f22e0,_0x192f83){return function(_0x562e91){if(_0x562e91){var _0x1fec83=typeof _0x192f83[_0xcd25('0x1c')]===_0xcd25('0x1d')&&typeof _0x192f83[_0xcd25('0x1e')]===_0xcd25('0x1d');var _0x3646a4=_0x562e91['count'];var _0x4f635e=_0x1fec83?0x0:_0x192f83['offset'];var _0x2e6cf2=_0x1fec83?_0x562e91[_0xcd25('0x1f')]:_0x192f83[_0xcd25('0x1c')]+_0x192f83['limit'];var _0x35eb03;if(_0x2e6cf2>=_0x3646a4){_0x2e6cf2=_0x3646a4;_0x35eb03=0xc8;}else{_0x35eb03=0xce;}_0x5f22e0[_0xcd25('0x1b')](_0x35eb03);return _0x5f22e0['set'](_0xcd25('0x20'),_0x4f635e+'-'+_0x2e6cf2+'/'+_0x3646a4)[_0xcd25('0x21')](_0x562e91);}return null;};}function patchUpdates(_0x1a19b1){return function(_0x3b56b4){try{jsonpatch[_0xcd25('0x22')](_0x3b56b4,_0x1a19b1,!![]);}catch(_0x34bbff){return BPromise['reject'](_0x34bbff);}return _0x3b56b4[_0xcd25('0x23')]();};}function saveUpdates(_0x572e6b,_0x5049cb){return function(_0x4ba13f){if(_0x4ba13f){return _0x4ba13f['update'](_0x572e6b)['then'](function(_0x24cbb1){return _0x24cbb1;});}return null;};}function removeEntity(_0x5725a5,_0x25e734){return function(_0x404587){if(_0x404587){return _0x404587['destroy']()[_0xcd25('0x24')](function(){_0x5725a5[_0xcd25('0x1b')](0xcc)[_0xcd25('0x25')]();});}};}function handleEntityNotFound(_0x46a683,_0x577797){return function(_0x29f5c2){if(!_0x29f5c2){_0x46a683[_0xcd25('0x1a')](0x194);}return _0x29f5c2;};}function handleError(_0x53f79a,_0x532ddb){_0x532ddb=_0x532ddb||0x1f4;return function(_0x191b56){logger[_0xcd25('0x26')](_0x191b56[_0xcd25('0x27')]);if(_0x191b56[_0xcd25('0x28')]){delete _0x191b56[_0xcd25('0x28')];}_0x53f79a[_0xcd25('0x1b')](_0x532ddb)[_0xcd25('0x29')](_0x191b56);};}exports[_0xcd25('0x2a')]=function(_0x3101c1,_0x9a66bd){var _0x5bb2ba={},_0xc9a8b5={},_0x511b58={'count':0x0,'rows':[]};var _0x2b626c=_[_0xcd25('0x2b')](db['VoiceTransferReport']['rawAttributes'],function(_0xf59ea1){return{'name':_0xf59ea1[_0xcd25('0x2c')],'type':_0xf59ea1[_0xcd25('0x2d')]['key']};});_0xc9a8b5[_0xcd25('0x2e')]=_[_0xcd25('0x2b')](_0x2b626c,_0xcd25('0x28'));_0xc9a8b5[_0xcd25('0x2f')]=_[_0xcd25('0x30')](_0x3101c1[_0xcd25('0x2f')]);_0xc9a8b5[_0xcd25('0x31')]=_[_0xcd25('0x32')](_0xc9a8b5['model'],_0xc9a8b5['query']);_0x5bb2ba[_0xcd25('0x33')]=_['intersection'](_0xc9a8b5[_0xcd25('0x2e')],qs[_0xcd25('0x34')](_0x3101c1[_0xcd25('0x2f')][_0xcd25('0x34')]));_0x5bb2ba[_0xcd25('0x33')]=_0x5bb2ba[_0xcd25('0x33')]['length']?_0x5bb2ba[_0xcd25('0x33')]:_0xc9a8b5[_0xcd25('0x2e')];if(!_0x3101c1['query']['hasOwnProperty']('nolimit')){_0x5bb2ba['limit']=qs[_0xcd25('0x1e')](_0x3101c1[_0xcd25('0x2f')][_0xcd25('0x1e')]);_0x5bb2ba['offset']=qs[_0xcd25('0x1c')](_0x3101c1[_0xcd25('0x2f')][_0xcd25('0x1c')]);}_0x5bb2ba[_0xcd25('0x35')]=qs[_0xcd25('0x36')](_0x3101c1[_0xcd25('0x2f')][_0xcd25('0x36')]);_0x5bb2ba[_0xcd25('0x37')]=qs[_0xcd25('0x31')](_[_0xcd25('0x38')](_0x3101c1[_0xcd25('0x2f')],_0xc9a8b5[_0xcd25('0x31')]),_0x2b626c);if(_0x3101c1[_0xcd25('0x2f')]['filter']){_0x5bb2ba[_0xcd25('0x37')]=_[_0xcd25('0x39')](_0x5bb2ba[_0xcd25('0x37')],{'$or':_['map'](_0x2b626c,function(_0xef9c15){if(_0xef9c15[_0xcd25('0x2d')]!=='VIRTUAL'){var _0x2233e7={};_0x2233e7[_0xef9c15[_0xcd25('0x28')]]={'$like':'%'+_0x3101c1['query'][_0xcd25('0x3a')]+'%'};return _0x2233e7;}})});}_0x5bb2ba=_['merge']({},_0x5bb2ba,_0x3101c1[_0xcd25('0x3b')]);var _0x470e14={'where':_0x5bb2ba[_0xcd25('0x37')]};return db['VoiceTransferReport']['count'](_0x470e14)[_0xcd25('0x24')](function(_0x3644a7){_0x511b58[_0xcd25('0x1f')]=_0x3644a7;if(_0x3101c1[_0xcd25('0x2f')][_0xcd25('0x3c')]){_0x5bb2ba[_0xcd25('0x3d')]=[{'all':!![]}];}return db[_0xcd25('0x3e')][_0xcd25('0x3f')](_0x5bb2ba);})[_0xcd25('0x24')](function(_0x39efe9){_0x511b58[_0xcd25('0x40')]=_0x39efe9;return _0x511b58;})[_0xcd25('0x24')](respondWithFilteredResult(_0x9a66bd,_0x5bb2ba))[_0xcd25('0x41')](handleError(_0x9a66bd,null));};exports[_0xcd25('0x42')]=function(_0x2dd3e9,_0x2d18bb){var _0x1ace0e={'raw':!![],'where':{'id':_0x2dd3e9[_0xcd25('0x43')]['id']}},_0x478806={};_0x478806['model']=_[_0xcd25('0x30')](db[_0xcd25('0x3e')][_0xcd25('0x44')]);_0x478806['query']=_[_0xcd25('0x30')](_0x2dd3e9['query']);_0x478806['filters']=_[_0xcd25('0x32')](_0x478806[_0xcd25('0x2e')],_0x478806[_0xcd25('0x2f')]);_0x1ace0e['attributes']=_[_0xcd25('0x32')](_0x478806[_0xcd25('0x2e')],qs['fields'](_0x2dd3e9[_0xcd25('0x2f')][_0xcd25('0x34')]));_0x1ace0e[_0xcd25('0x33')]=_0x1ace0e[_0xcd25('0x33')][_0xcd25('0x45')]?_0x1ace0e[_0xcd25('0x33')]:_0x478806[_0xcd25('0x2e')];if(_0x2dd3e9[_0xcd25('0x2f')][_0xcd25('0x3c')]){_0x1ace0e[_0xcd25('0x3d')]=[{'all':!![]}];}_0x1ace0e=_['merge']({},_0x1ace0e,_0x2dd3e9['options']);return db['VoiceTransferReport'][_0xcd25('0x46')](_0x1ace0e)[_0xcd25('0x24')](handleEntityNotFound(_0x2d18bb,null))[_0xcd25('0x24')](respondWithResult(_0x2d18bb,null))[_0xcd25('0x41')](handleError(_0x2d18bb,null));};exports[_0xcd25('0x47')]=function(_0x90a0,_0x105835){return db[_0xcd25('0x3e')]['create'](_0x90a0[_0xcd25('0x48')],{})[_0xcd25('0x24')](respondWithResult(_0x105835,0xc9))[_0xcd25('0x41')](handleError(_0x105835,null));};exports[_0xcd25('0x49')]=function(_0x520ca3,_0x143658){if(_0x520ca3[_0xcd25('0x48')]['id']){delete _0x520ca3[_0xcd25('0x48')]['id'];}return db[_0xcd25('0x3e')][_0xcd25('0x46')]({'where':{'id':_0x520ca3[_0xcd25('0x43')]['id']}})[_0xcd25('0x24')](handleEntityNotFound(_0x143658,null))[_0xcd25('0x24')](saveUpdates(_0x520ca3[_0xcd25('0x48')],null))[_0xcd25('0x24')](respondWithResult(_0x143658,null))[_0xcd25('0x41')](handleError(_0x143658,null));};exports[_0xcd25('0x4a')]=function(_0x2c165a,_0x3608af){return db[_0xcd25('0x3e')]['find']({'where':{'id':_0x2c165a[_0xcd25('0x43')]['id']}})['then'](handleEntityNotFound(_0x3608af,null))['then'](removeEntity(_0x3608af,null))[_0xcd25('0x41')](handleError(_0x3608af,null));};exports[_0xcd25('0x4b')]=function(_0x1636cf,_0x5927f1){return db[_0xcd25('0x3e')][_0xcd25('0x4b')]()[_0xcd25('0x24')](respondWithResult(_0x5927f1,null))[_0xcd25('0x41')](handleError(_0x5927f1,null));}; \ No newline at end of file +var _0x98dc=['save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','length','create','body','find','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply'];(function(_0x2edcf3,_0x23412e){var _0x1b78ff=function(_0x295ede){while(--_0x295ede){_0x2edcf3['push'](_0x2edcf3['shift']());}};_0x1b78ff(++_0x23412e);}(_0x98dc,0x106));var _0xc98d=function(_0x372d1d,_0x3975c5){_0x372d1d=_0x372d1d-0x0;var _0x404421=_0x98dc[_0x372d1d];return _0x404421;};'use strict';var emlformat=require(_0xc98d('0x0'));var rimraf=require(_0xc98d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc98d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc98d('0x3'));var Mustache=require(_0xc98d('0x4'));var util=require(_0xc98d('0x5'));var path=require(_0xc98d('0x6'));var sox=require('sox');var csv=require(_0xc98d('0x7'));var ejs=require(_0xc98d('0x8'));var fs=require('fs');var fs_extra=require(_0xc98d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc98d('0xa'));var jsforce=require(_0xc98d('0xb'));var deskjs=require(_0xc98d('0xc'));var toCsv=require(_0xc98d('0x7'));var querystring=require(_0xc98d('0xd'));var Papa=require(_0xc98d('0xe'));var Redis=require(_0xc98d('0xf'));var authService=require(_0xc98d('0x10'));var qs=require(_0xc98d('0x11'));var as=require(_0xc98d('0x12'));var hardwareService=require(_0xc98d('0x13'));var logger=require('../../config/logger')(_0xc98d('0x14'));var utils=require(_0xc98d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc98d('0x16'));var db=require(_0xc98d('0x17'))['db'];function respondWithStatusCode(_0x51845c,_0x130fc5){_0x130fc5=_0x130fc5||0xcc;return function(_0x1d486c){if(_0x1d486c){return _0x51845c[_0xc98d('0x18')](_0x130fc5);}return _0x51845c[_0xc98d('0x19')](_0x130fc5)[_0xc98d('0x1a')]();};}function respondWithResult(_0x4e3391,_0x223492){_0x223492=_0x223492||0xc8;return function(_0x319c9a){if(_0x319c9a){return _0x4e3391['status'](_0x223492)['json'](_0x319c9a);}};}function respondWithFilteredResult(_0x5702c4,_0xc1c2cf){return function(_0x137be9){if(_0x137be9){var _0xdbc766=typeof _0xc1c2cf[_0xc98d('0x1b')]==='undefined'&&typeof _0xc1c2cf['limit']===_0xc98d('0x1c');var _0x296845=_0x137be9['count'];var _0x11b8fe=_0xdbc766?0x0:_0xc1c2cf[_0xc98d('0x1b')];var _0x57894e=_0xdbc766?_0x137be9[_0xc98d('0x1d')]:_0xc1c2cf[_0xc98d('0x1b')]+_0xc1c2cf[_0xc98d('0x1e')];var _0x246790;if(_0x57894e>=_0x296845){_0x57894e=_0x296845;_0x246790=0xc8;}else{_0x246790=0xce;}_0x5702c4[_0xc98d('0x19')](_0x246790);return _0x5702c4['set'](_0xc98d('0x1f'),_0x11b8fe+'-'+_0x57894e+'/'+_0x296845)[_0xc98d('0x20')](_0x137be9);}return null;};}function patchUpdates(_0x2bcd99){return function(_0x54ce7a){try{jsonpatch[_0xc98d('0x21')](_0x54ce7a,_0x2bcd99,!![]);}catch(_0x51f67c){return BPromise['reject'](_0x51f67c);}return _0x54ce7a[_0xc98d('0x22')]();};}function saveUpdates(_0x58303d,_0x1a6830){return function(_0x34f3dd){if(_0x34f3dd){return _0x34f3dd[_0xc98d('0x23')](_0x58303d)[_0xc98d('0x24')](function(_0x1a8ea9){return _0x1a8ea9;});}return null;};}function removeEntity(_0x1b1ec0,_0x2e27c4){return function(_0x4abea3){if(_0x4abea3){return _0x4abea3[_0xc98d('0x25')]()['then'](function(){_0x1b1ec0[_0xc98d('0x19')](0xcc)[_0xc98d('0x1a')]();});}};}function handleEntityNotFound(_0x485175,_0x273a98){return function(_0x2475b1){if(!_0x2475b1){_0x485175[_0xc98d('0x18')](0x194);}return _0x2475b1;};}function handleError(_0x177903,_0x452171){_0x452171=_0x452171||0x1f4;return function(_0x563166){logger[_0xc98d('0x26')](_0x563166[_0xc98d('0x27')]);if(_0x563166[_0xc98d('0x28')]){delete _0x563166[_0xc98d('0x28')];}_0x177903[_0xc98d('0x19')](_0x452171)[_0xc98d('0x29')](_0x563166);};}exports[_0xc98d('0x2a')]=function(_0x4c51a8,_0x4bc2f7){var _0x556b88={},_0x2ef81e={},_0x1fc0b2={'count':0x0,'rows':[]};var _0x446e5c=_[_0xc98d('0x2b')](db[_0xc98d('0x2c')][_0xc98d('0x2d')],function(_0x2d7b76){return{'name':_0x2d7b76['fieldName'],'type':_0x2d7b76[_0xc98d('0x2e')][_0xc98d('0x2f')]};});_0x2ef81e['model']=_['map'](_0x446e5c,_0xc98d('0x28'));_0x2ef81e[_0xc98d('0x30')]=_[_0xc98d('0x31')](_0x4c51a8[_0xc98d('0x30')]);_0x2ef81e[_0xc98d('0x32')]=_['intersection'](_0x2ef81e['model'],_0x2ef81e[_0xc98d('0x30')]);_0x556b88[_0xc98d('0x33')]=_[_0xc98d('0x34')](_0x2ef81e[_0xc98d('0x35')],qs[_0xc98d('0x36')](_0x4c51a8[_0xc98d('0x30')][_0xc98d('0x36')]));_0x556b88['attributes']=_0x556b88[_0xc98d('0x33')]['length']?_0x556b88['attributes']:_0x2ef81e[_0xc98d('0x35')];if(!_0x4c51a8[_0xc98d('0x30')][_0xc98d('0x37')](_0xc98d('0x38'))){_0x556b88[_0xc98d('0x1e')]=qs[_0xc98d('0x1e')](_0x4c51a8[_0xc98d('0x30')][_0xc98d('0x1e')]);_0x556b88['offset']=qs[_0xc98d('0x1b')](_0x4c51a8[_0xc98d('0x30')][_0xc98d('0x1b')]);}_0x556b88['order']=qs[_0xc98d('0x39')](_0x4c51a8[_0xc98d('0x30')][_0xc98d('0x39')]);_0x556b88[_0xc98d('0x3a')]=qs[_0xc98d('0x32')](_[_0xc98d('0x3b')](_0x4c51a8['query'],_0x2ef81e[_0xc98d('0x32')]),_0x446e5c);if(_0x4c51a8[_0xc98d('0x30')][_0xc98d('0x3c')]){_0x556b88[_0xc98d('0x3a')]=_[_0xc98d('0x3d')](_0x556b88[_0xc98d('0x3a')],{'$or':_[_0xc98d('0x2b')](_0x446e5c,function(_0x41fbe1){if(_0x41fbe1[_0xc98d('0x2e')]!==_0xc98d('0x3e')){var _0x88b6d0={};_0x88b6d0[_0x41fbe1[_0xc98d('0x28')]]={'$like':'%'+_0x4c51a8[_0xc98d('0x30')][_0xc98d('0x3c')]+'%'};return _0x88b6d0;}})});}_0x556b88=_[_0xc98d('0x3d')]({},_0x556b88,_0x4c51a8[_0xc98d('0x3f')]);var _0xcf5eaa={'where':_0x556b88[_0xc98d('0x3a')]};return db['VoiceTransferReport'][_0xc98d('0x1d')](_0xcf5eaa)[_0xc98d('0x24')](function(_0x5f0fc4){_0x1fc0b2[_0xc98d('0x1d')]=_0x5f0fc4;if(_0x4c51a8['query'][_0xc98d('0x40')]){_0x556b88[_0xc98d('0x41')]=[{'all':!![]}];}return db[_0xc98d('0x2c')]['findAll'](_0x556b88);})['then'](function(_0x389d3d){_0x1fc0b2['rows']=_0x389d3d;return _0x1fc0b2;})[_0xc98d('0x24')](respondWithFilteredResult(_0x4bc2f7,_0x556b88))[_0xc98d('0x42')](handleError(_0x4bc2f7,null));};exports[_0xc98d('0x43')]=function(_0x352a69,_0x3173b1){var _0x53a711={'raw':!![],'where':{'id':_0x352a69[_0xc98d('0x44')]['id']}},_0x4f824f={};_0x4f824f[_0xc98d('0x35')]=_[_0xc98d('0x31')](db[_0xc98d('0x2c')][_0xc98d('0x2d')]);_0x4f824f[_0xc98d('0x30')]=_[_0xc98d('0x31')](_0x352a69[_0xc98d('0x30')]);_0x4f824f[_0xc98d('0x32')]=_[_0xc98d('0x34')](_0x4f824f['model'],_0x4f824f['query']);_0x53a711[_0xc98d('0x33')]=_[_0xc98d('0x34')](_0x4f824f[_0xc98d('0x35')],qs['fields'](_0x352a69[_0xc98d('0x30')][_0xc98d('0x36')]));_0x53a711['attributes']=_0x53a711[_0xc98d('0x33')][_0xc98d('0x45')]?_0x53a711['attributes']:_0x4f824f[_0xc98d('0x35')];if(_0x352a69[_0xc98d('0x30')][_0xc98d('0x40')]){_0x53a711[_0xc98d('0x41')]=[{'all':!![]}];}_0x53a711=_[_0xc98d('0x3d')]({},_0x53a711,_0x352a69[_0xc98d('0x3f')]);return db[_0xc98d('0x2c')]['find'](_0x53a711)[_0xc98d('0x24')](handleEntityNotFound(_0x3173b1,null))[_0xc98d('0x24')](respondWithResult(_0x3173b1,null))['catch'](handleError(_0x3173b1,null));};exports[_0xc98d('0x46')]=function(_0x139526,_0x31a587){return db[_0xc98d('0x2c')][_0xc98d('0x46')](_0x139526[_0xc98d('0x47')],{})[_0xc98d('0x24')](respondWithResult(_0x31a587,0xc9))[_0xc98d('0x42')](handleError(_0x31a587,null));};exports['update']=function(_0x5baa43,_0x552ca7){if(_0x5baa43[_0xc98d('0x47')]['id']){delete _0x5baa43['body']['id'];}return db[_0xc98d('0x2c')][_0xc98d('0x48')]({'where':{'id':_0x5baa43[_0xc98d('0x44')]['id']}})[_0xc98d('0x24')](handleEntityNotFound(_0x552ca7,null))[_0xc98d('0x24')](saveUpdates(_0x5baa43[_0xc98d('0x47')],null))[_0xc98d('0x24')](respondWithResult(_0x552ca7,null))['catch'](handleError(_0x552ca7,null));};exports[_0xc98d('0x25')]=function(_0x31ac7b,_0x2e4545){return db[_0xc98d('0x2c')][_0xc98d('0x48')]({'where':{'id':_0x31ac7b[_0xc98d('0x44')]['id']}})[_0xc98d('0x24')](handleEntityNotFound(_0x2e4545,null))[_0xc98d('0x24')](removeEntity(_0x2e4545,null))[_0xc98d('0x42')](handleError(_0x2e4545,null));};exports['describe']=function(_0x263806,_0x2112f2){return db['VoiceTransferReport'][_0xc98d('0x49')]()[_0xc98d('0x24')](respondWithResult(_0x2112f2,null))[_0xc98d('0x42')](handleError(_0x2112f2,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 26cfd41..609744f 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 _0x6643=['report_call_transfer','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0x3de3de,_0x26e5ea){var _0x4a30b4=function(_0x390976){while(--_0x390976){_0x3de3de['push'](_0x3de3de['shift']());}};_0x4a30b4(++_0x26e5ea);}(_0x6643,0x1c8));var _0x3664=function(_0xc5e99d,_0x3880d8){_0xc5e99d=_0xc5e99d-0x0;var _0x26fbbe=_0x6643[_0xc5e99d];return _0x26fbbe;};'use strict';var _=require(_0x3664('0x0'));var util=require(_0x3664('0x1'));var logger=require(_0x3664('0x2'))(_0x3664('0x3'));var moment=require('moment');var BPromise=require(_0x3664('0x4'));var rp=require(_0x3664('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3664('0x6'));var config=require(_0x3664('0x7'));var attributes=require(_0x3664('0x8'));module[_0x3664('0x9')]=function(_0x23e9f0,_0x20f7af){return _0x23e9f0[_0x3664('0xa')](_0x3664('0xb'),attributes,{'tableName':_0x3664('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fb9=['define','VoiceTransferReport','lodash','util','api','moment','bluebird','request-promise','path','./voiceTransferReport.attributes'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x4fb9,0x11a));var _0x94fb=function(_0x2e3dd2,_0x22f251){_0x2e3dd2=_0x2e3dd2-0x0;var _0x4ad280=_0x4fb9[_0x2e3dd2];return _0x4ad280;};'use strict';var _=require(_0x94fb('0x0'));var util=require(_0x94fb('0x1'));var logger=require('../../config/logger')(_0x94fb('0x2'));var moment=require(_0x94fb('0x3'));var BPromise=require(_0x94fb('0x4'));var rp=require(_0x94fb('0x5'));var fs=require('fs');var path=require(_0x94fb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x94fb('0x7'));module['exports']=function(_0x563ccf,_0xa4de24){return _0x563ccf[_0x94fb('0x8')](_0x94fb('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 121218c..1a202db 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 _0xfc9c=['client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','CreateVoiceTransferReport','create','body','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x629e00,_0x55df2f){var _0x27e096=function(_0x1d75ff){while(--_0x1d75ff){_0x629e00['push'](_0x629e00['shift']());}};_0x27e096(++_0x55df2f);}(_0xfc9c,0x18d));var _0xcfc9=function(_0x41703c,_0x380af7){_0x41703c=_0x41703c-0x0;var _0x5988f9=_0xfc9c[_0x41703c];return _0x5988f9;};'use strict';var _=require('lodash');var util=require(_0xcfc9('0x0'));var moment=require(_0xcfc9('0x1'));var BPromise=require(_0xcfc9('0x2'));var rs=require(_0xcfc9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfc9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfc9('0x5'))(_0xcfc9('0x6'));var config=require(_0xcfc9('0x7'));var jayson=require(_0xcfc9('0x8'));var client=jayson[_0xcfc9('0x9')][_0xcfc9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b1501,_0x21d94b,_0x335981){return new BPromise(function(_0x434aed,_0xac9b35){return client[_0xcfc9('0xb')](_0x3b1501,_0x335981)[_0xcfc9('0xc')](function(_0x2d797c){logger['info'](_0xcfc9('0xd'),_0x21d94b,_0xcfc9('0xe'));logger[_0xcfc9('0xf')](_0xcfc9('0x10'),_0x21d94b,_0xcfc9('0xe'),JSON[_0xcfc9('0x11')](_0x2d797c));if(_0x2d797c['error']){if(_0x2d797c['error'][_0xcfc9('0x12')]===0x1f4){logger[_0xcfc9('0x13')](_0xcfc9('0xd'),_0x21d94b,_0x2d797c[_0xcfc9('0x13')]['message']);return _0xac9b35(_0x2d797c[_0xcfc9('0x13')][_0xcfc9('0x14')]);}logger[_0xcfc9('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x21d94b,_0x2d797c[_0xcfc9('0x13')][_0xcfc9('0x14')]);return _0x434aed(_0x2d797c[_0xcfc9('0x13')]['message']);}else{logger[_0xcfc9('0x15')](_0xcfc9('0xd'),_0x21d94b,_0xcfc9('0xe'));_0x434aed(_0x2d797c[_0xcfc9('0x16')][_0xcfc9('0x14')]);}})[_0xcfc9('0x17')](function(_0x555627){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x21d94b,_0x555627);_0xac9b35(_0x555627);});});}exports[_0xcfc9('0x18')]=function(_0x143776){var _0x52e8ed=this;return new Promise(function(_0x44acea,_0x56c2e4){return db['VoiceTransferReport'][_0xcfc9('0x19')](_0x143776[_0xcfc9('0x1a')],{'raw':_0x143776['options']?_0x143776[_0xcfc9('0x1b')][_0xcfc9('0x1c')]===undefined?!![]:![]:!![]})[_0xcfc9('0xc')](function(_0x1794fe){logger[_0xcfc9('0x15')](_0xcfc9('0x18'),_0x143776);logger[_0xcfc9('0xf')](_0xcfc9('0x18'),_0x143776,JSON[_0xcfc9('0x11')](_0x1794fe));_0x44acea(_0x1794fe);})['catch'](function(_0x56055f){logger[_0xcfc9('0x13')]('CreateVoiceTransferReport',_0x56055f[_0xcfc9('0x14')],_0x143776);_0x56c2e4(_0x52e8ed['error'](0x1f4,_0x56055f[_0xcfc9('0x14')]));});});}; \ No newline at end of file +var _0xa69c=['request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','options','CreateVoiceTransferReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x2a818d,_0x376d95){var _0x2ff3f5=function(_0x330ca0){while(--_0x330ca0){_0x2a818d['push'](_0x2a818d['shift']());}};_0x2ff3f5(++_0x376d95);}(_0xa69c,0x17c));var _0xca69=function(_0x30c7c5,_0x168208){_0x30c7c5=_0x30c7c5-0x0;var _0x29e24e=_0xa69c[_0x30c7c5];return _0x29e24e;};'use strict';var _=require(_0xca69('0x0'));var util=require('util');var moment=require(_0xca69('0x1'));var BPromise=require(_0xca69('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca69('0x3'));var db=require(_0xca69('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xca69('0x5'))('rpc');var config=require(_0xca69('0x6'));var jayson=require(_0xca69('0x7'));var client=jayson[_0xca69('0x8')][_0xca69('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29d1eb,_0x30d629,_0x64939b){return new BPromise(function(_0x372d6c,_0x83d1d1){return client[_0xca69('0xa')](_0x29d1eb,_0x64939b)[_0xca69('0xb')](function(_0x249fe7){logger[_0xca69('0xc')](_0xca69('0xd'),_0x30d629,_0xca69('0xe'));logger[_0xca69('0xf')](_0xca69('0x10'),_0x30d629,'request\x20sent',JSON[_0xca69('0x11')](_0x249fe7));if(_0x249fe7[_0xca69('0x12')]){if(_0x249fe7[_0xca69('0x12')][_0xca69('0x13')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x30d629,_0x249fe7['error'][_0xca69('0x14')]);return _0x83d1d1(_0x249fe7[_0xca69('0x12')][_0xca69('0x14')]);}logger[_0xca69('0x12')](_0xca69('0xd'),_0x30d629,_0x249fe7['error'][_0xca69('0x14')]);return _0x372d6c(_0x249fe7[_0xca69('0x12')]['message']);}else{logger[_0xca69('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x30d629,_0xca69('0xe'));_0x372d6c(_0x249fe7[_0xca69('0x15')][_0xca69('0x14')]);}})[_0xca69('0x16')](function(_0x4be12a){logger[_0xca69('0x12')](_0xca69('0xd'),_0x30d629,_0x4be12a);_0x83d1d1(_0x4be12a);});});}exports['CreateVoiceTransferReport']=function(_0x37a2a1){var _0x23857c=this;return new Promise(function(_0x29a3d7,_0x4830d4){return db['VoiceTransferReport'][_0xca69('0x17')](_0x37a2a1['body'],{'raw':_0x37a2a1['options']?_0x37a2a1[_0xca69('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xca69('0xb')](function(_0x3ebab8){logger[_0xca69('0xc')](_0xca69('0x19'),_0x37a2a1);logger[_0xca69('0xf')](_0xca69('0x19'),_0x37a2a1,JSON[_0xca69('0x11')](_0x3ebab8));_0x29a3d7(_0x3ebab8);})['catch'](function(_0x5473c3){logger[_0xca69('0x12')]('CreateVoiceTransferReport',_0x5473c3[_0xca69('0x14')],_0x37a2a1);_0x4830d4(_0x23857c['error'](0x1f4,_0x5473c3[_0xca69('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 864a81f..f115018 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 _0xb4e6=['unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/hold','hold','/unhold'];(function(_0x13d5e1,_0x2413ef){var _0x29a530=function(_0x3e8679){while(--_0x3e8679){_0x13d5e1['push'](_0x13d5e1['shift']());}};_0x29a530(++_0x2413ef);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0xb4e6[_0x2440fe];return _0x5cf734;};'use strict';var express=require(_0x6b4e('0x0'));var router=express['Router']();var auth=require(_0x6b4e('0x1'));var controller=require(_0x6b4e('0x2'));router[_0x6b4e('0x3')](_0x6b4e('0x4'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0x7')]);router['post'](_0x6b4e('0x8'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['hangup']);router[_0x6b4e('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6b4e('0x6')](),controller['answer']);router['post'](_0x6b4e('0x9'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xa')]);router[_0x6b4e('0x3')](_0x6b4e('0xb'),auth[_0x6b4e('0x5')](),auth['isWebrtcLicence'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x3')]('/calls',auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xd')]);router[_0x6b4e('0x3')](_0x6b4e('0xe'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['transfer']);module[_0x6b4e('0xf')]=router; \ No newline at end of file +var _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0x46d208,_0x3654d0){var _0x3bc42f=function(_0x4722bf){while(--_0x4722bf){_0x46d208['push'](_0x46d208['shift']());}};_0x3bc42f(++_0x3654d0);}(_0xe14d,0x1ee));var _0xde14=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xe14d[_0x1d9aa0];return _0x226868;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index f1b45a8..694299a 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 _0xda55=['sessionId\x20','\x20not\x20found!','originate','info','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','catch','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','UserId','conference','webbar:conference','transfer','transfer\x20fired:','path','lodash','util','bluebird','jayson/promise','client','http','webbarapi','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','stack','name','status','send','NotFound','then','error','code','message','result','User','VoiceChannels','all','filter','rows','length'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0xda55,0x6d));var _0x5da5=function(_0x1cd2ac,_0x718d01){_0x1cd2ac=_0x1cd2ac-0x0;var _0x50164a=_0xda55[_0x1cd2ac];return _0x50164a;};'use strict';var path=require(_0x5da5('0x0'));var fs=require('fs');var _=require(_0x5da5('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x5da5('0x2'));var BPromise=require(_0x5da5('0x3'));var jayson=require(_0x5da5('0x4'));var amiClient=jayson[_0x5da5('0x5')][_0x5da5('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x5da5('0x7'));var Redis=require('ioredis');config[_0x5da5('0x8')]=_['defaults'](config[_0x5da5('0x8')],{'host':_0x5da5('0x9'),'port':0x18eb});var io=require(_0x5da5('0xa'))(new Redis(config[_0x5da5('0x8')]));var Schema=require(_0x5da5('0xb'));var originateValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'callNumber':{'type':_0x5da5('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x5da5('0xe')},'callbackUrl':{'type':_0x5da5('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'sessionId':{'type':_0x5da5('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'sessionId':{'type':'string','required':[!![],_0x5da5('0xf')]},'transferNumber':{'type':_0x5da5('0xe'),'required':[!![],_0x5da5('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'sessionId':{'type':_0x5da5('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]}});function emit(_0x11bd3,_0x134afa,_0x3aff51){logger['info'](_0x11bd3,_0x134afa,JSON[_0x5da5('0x11')](_0x3aff51));io['to'](_0x11bd3)[_0x5da5('0x12')](_0x134afa,_0x3aff51);}function handleError(_0x1a4849){return function(_0x16b11f){console[_0x5da5('0x13')](_0x5da5('0x14'),_0x16b11f,_0x16b11f instanceof RangeError);logger['error'](_0x16b11f[_0x5da5('0x15')]);if(_0x16b11f instanceof RangeError){if(_0x16b11f[_0x5da5('0x16')]){delete _0x16b11f[_0x5da5('0x16')];}_0x1a4849[_0x5da5('0x17')](0x194)[_0x5da5('0x18')](_0x16b11f);}else{if(_0x16b11f['name']){delete _0x16b11f[_0x5da5('0x16')];}_0x1a4849[_0x5da5('0x17')](0x1f4)[_0x5da5('0x18')](_0x16b11f);}};}function checkError(){return function(_0x560ea7){if(!_0x560ea7){throw new RangeError(_0x5da5('0x19'));}return _0x560ea7;};}function respondWithRpcPromise(_0x15aa62,_0x20c8a6){return new BPromise(function(_0x2e68d5,_0xec69f2){var _0x436960=amiClient;return _0x436960['request'](_0x15aa62,_0x20c8a6)[_0x5da5('0x1a')](function(_0x568ddf){if(_0x568ddf[_0x5da5('0x1b')]){if(_0x568ddf[_0x5da5('0x1b')][_0x5da5('0x1c')]===0x1f4){return _0xec69f2(_0x568ddf['error'][_0x5da5('0x1d')]);}return _0x2e68d5(_0x568ddf[_0x5da5('0x1b')][_0x5da5('0x1d')]);}else{_0x2e68d5(_0x568ddf[_0x5da5('0x1e')]);}})['catch'](function(_0x5b0b43){_0xec69f2(_0x5b0b43);});});}function getAgent(_0x50aadc){return db[_0x5da5('0x1f')]['findOne']({'where':{'id':_0x50aadc,'role':'agent'}})[_0x5da5('0x1a')](checkError());}function getAgentCheckSession(_0x3974d8,_0x5740a7){return new BPromise(function(_0x1798ae,_0x1ab83e){var _0x558b12=respondWithRpcPromise(_0x5da5('0x20'));var _0x27de55=getAgent(_0x3974d8);Promise[_0x5da5('0x21')]([_0x558b12,_0x27de55])[_0x5da5('0x1a')](function(_0x766ed9){var _0x5734ce=_0x766ed9[0x0];var _0x3ae664=_0x766ed9[0x1];var _0x2e3c5d=_[_0x5da5('0x22')](_0x5734ce[_0x5da5('0x23')],function(_0x55e2bf){return _0x55e2bf['UserId']==_0x3ae664['id']&&_0x55e2bf['sessionId']==_0x5740a7;});if(_0x2e3c5d[_0x5da5('0x24')]==0x1){_0x1798ae(_0x3ae664);}else{_0x1ab83e(new RangeError(_0x5da5('0x25')+_0x5740a7+_0x5da5('0x26')));}});});}exports[_0x5da5('0x27')]=function(_0x51b712,_0x585298){logger[_0x5da5('0x28')]('originate\x20fired:',_0x51b712['body']);var _0x2dd4b6=originateValidation['validate'](_0x51b712[_0x5da5('0x29')]);if(_0x2dd4b6[_0x5da5('0x24')]>0x0){return _0x585298[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x2dd4b6);}var _0x6c556d=_0x51b712[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x3dc66a=_0x51b712['body'][_0x5da5('0x2c')];var _0x48de0b=_0x51b712[_0x5da5('0x29')][_0x5da5('0x2d')];var _0x28c5eb=_0x51b712[_0x5da5('0x29')][_0x5da5('0x2e')];return getAgent(_0x6c556d)[_0x5da5('0x1a')](function(_0x325ccd){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x325ccd[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0x325ccd[_0x5da5('0x16')]),'webbar:originate',{'callNumber':_0x3dc66a,'callerId':_0x48de0b,'callbackUrl':_0x28c5eb});return _0x585298[_0x5da5('0x17')](0xc8)['json']({'error':![],'message':_0x5da5('0x32')});})[_0x5da5('0x33')](handleError(_0x585298));};exports[_0x5da5('0x34')]=function(_0x24842c,_0x59c92e){logger[_0x5da5('0x28')](_0x5da5('0x35'),_0x24842c[_0x5da5('0x29')]);var _0x56fd57=hangupValidation[_0x5da5('0xb')](_0x24842c[_0x5da5('0x29')]);if(_0x56fd57['length']>0x0){return _0x59c92e[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x56fd57);}var _0xe9888e=_0x24842c[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x664a8d=_0x24842c['body'][_0x5da5('0x36')];return getAgent(_0xe9888e)[_0x5da5('0x1a')](function(_0x14c3f5){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x14c3f5['name']);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0x14c3f5['name']),_0x5da5('0x37'),{'sessionId':_0x664a8d});return _0x59c92e['status'](0xc8)['json']({'error':![],'message':_0x5da5('0x38')});})[_0x5da5('0x33')](handleError(_0x59c92e));};exports[_0x5da5('0x39')]=function(_0x29d9a7,_0x52b618){logger[_0x5da5('0x28')](_0x5da5('0x3a'),_0x29d9a7[_0x5da5('0x29')]);var _0x40cf69=answerValidation[_0x5da5('0xb')](_0x29d9a7[_0x5da5('0x29')]);if(_0x40cf69[_0x5da5('0x24')]>0x0){return _0x52b618[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x40cf69);}var _0x284d40=_0x29d9a7[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x4464a7=_0x29d9a7[_0x5da5('0x29')][_0x5da5('0x36')];return getAgent(_0x284d40)['then'](function(_0x485326){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x485326['name']);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0x485326[_0x5da5('0x16')]),_0x5da5('0x3b'),{'sessionId':_0x4464a7});return _0x52b618[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'error':![],'message':_0x5da5('0x3c')});})[_0x5da5('0x33')](handleError(_0x52b618));};exports[_0x5da5('0x3d')]=function(_0x44de08,_0x4fc584){logger[_0x5da5('0x28')]('hold\x20fired:',_0x44de08['body']);var _0x2a0fb6=holdValidation[_0x5da5('0xb')](_0x44de08[_0x5da5('0x29')]);if(_0x2a0fb6[_0x5da5('0x24')]>0x0){return _0x4fc584[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x2a0fb6);}var _0x5aa561=_0x44de08[_0x5da5('0x29')]['userId'];var _0x5325ad=_0x44de08[_0x5da5('0x29')][_0x5da5('0x36')];return getAgent(_0x5aa561)['then'](function(_0x419d74){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x419d74[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')]('user:%s',_0x419d74[_0x5da5('0x16')]),'webbar:hold',{'sessionId':_0x5325ad});return _0x4fc584['status'](0xc8)[_0x5da5('0x2a')]({'error':![],'message':'hold\x20executed!'});})[_0x5da5('0x33')](handleError(_0x4fc584));};exports[_0x5da5('0x3e')]=function(_0x17581a,_0x1ec725){logger[_0x5da5('0x28')](_0x5da5('0x3f'),_0x17581a['body']);var _0x5cb8d8=unholdValidation[_0x5da5('0xb')](_0x17581a[_0x5da5('0x29')]);if(_0x5cb8d8['length']>0x0){return _0x1ec725['status'](0x190)[_0x5da5('0x2a')](_0x5cb8d8);}var _0x4c1321=_0x17581a[_0x5da5('0x29')]['userId'];var _0x505ea4=_0x17581a[_0x5da5('0x29')][_0x5da5('0x36')];return getAgent(_0x4c1321)[_0x5da5('0x1a')](function(_0x39d428){logger['info'](_0x5da5('0x2f'),_0x39d428[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')]('user:%s',_0x39d428[_0x5da5('0x16')]),_0x5da5('0x40'),{'sessionId':_0x505ea4});return _0x1ec725[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'error':![],'message':_0x5da5('0x41')});})[_0x5da5('0x33')](handleError(_0x1ec725));};exports[_0x5da5('0x42')]=function(_0x53c7dd,_0x3d1a54){logger[_0x5da5('0x28')](_0x5da5('0x43'),_0x3d1a54[_0x5da5('0x29')]);var _0x211b80=callsValidation[_0x5da5('0xb')](_0x53c7dd[_0x5da5('0x29')]);if(_0x211b80[_0x5da5('0x24')]>0x0){return _0x3d1a54[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x211b80);}var _0x191691=_0x53c7dd[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x4cc539=respondWithRpcPromise(_0x5da5('0x20'));var _0x35939b=getAgent(_0x191691);return Promise['all']([_0x4cc539,_0x35939b])['then'](function(_0x509c9e){var _0x1959af=_0x509c9e[0x0];var _0x469907=_0x509c9e[0x1];var _0x20c269=_['filter'](_0x1959af['rows'],function(_0x462317){return _0x462317[_0x5da5('0x44')]==_0x469907['id'];});return _0x3d1a54[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'count':_0x20c269['length'],'rows':_0x20c269});})[_0x5da5('0x33')](handleError(_0x3d1a54));};exports[_0x5da5('0x45')]=function(_0x34b4b0,_0x4e4ffa){logger[_0x5da5('0x28')]('conference\x20fired:',_0x34b4b0[_0x5da5('0x29')]);var _0x4496d2=conferenceValidation[_0x5da5('0xb')](_0x34b4b0[_0x5da5('0x29')]);if(_0x4496d2[_0x5da5('0x24')]>0x0){return _0x4e4ffa[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x4496d2);}var _0x2c13f1=_0x34b4b0[_0x5da5('0x29')][_0x5da5('0x2b')];return getAgent(_0x2c13f1)[_0x5da5('0x1a')](function(_0xe3fc79){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0xe3fc79[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0xe3fc79[_0x5da5('0x16')]),_0x5da5('0x46'));return _0x4e4ffa[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x4e4ffa));};exports[_0x5da5('0x47')]=function(_0x35cca1,_0x4041e8){logger['info'](_0x5da5('0x48'),_0x35cca1[_0x5da5('0x29')]);var _0x43b55e=transferValidation[_0x5da5('0xb')](_0x35cca1['body']);if(_0x43b55e[_0x5da5('0x24')]>0x0){return _0x4041e8['status'](0x190)[_0x5da5('0x2a')](_0x43b55e);}var _0x5f862f=_0x35cca1[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x57966d=_0x35cca1[_0x5da5('0x29')][_0x5da5('0x36')];var _0x512f01=_0x35cca1['body']['transferNumber'];return getAgent(_0x5f862f)[_0x5da5('0x1a')](function(_0x446241){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x446241[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0x446241[_0x5da5('0x16')]),'webbar:transfer',{'sessionId':_0x57966d,'transferNumber':_0x512f01});return _0x4041e8[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x4041e8));}; \ No newline at end of file +var _0x00b3=['webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','jayson/promise','http','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','name','status','send','NotFound','then','code','message','catch','User','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','body','json','userId','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','validate','length','format','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:'];(function(_0x430b22,_0x36200b){var _0x50d4e1=function(_0x59e236){while(--_0x59e236){_0x430b22['push'](_0x430b22['shift']());}};_0x50d4e1(++_0x36200b);}(_0x00b3,0x17a));var _0x300b=function(_0x2b6c94,_0x145720){_0x2b6c94=_0x2b6c94-0x0;var _0x3d754b=_0x00b3[_0x2b6c94];return _0x3d754b;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x300b('0x0'));var db=require(_0x300b('0x1'))['db'];var config=require(_0x300b('0x2'));var util=require(_0x300b('0x3'));var BPromise=require('bluebird');var jayson=require(_0x300b('0x4'));var amiClient=jayson['client'][_0x300b('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x300b('0x6'));var Redis=require(_0x300b('0x7'));config[_0x300b('0x8')]=_[_0x300b('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x300b('0xa'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]},'callNumber':{'type':_0x300b('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x300b('0xd')},'callbackUrl':{'type':_0x300b('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]},'sessionId':{'type':_0x300b('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x300b('0xc')]},'sessionId':{'type':_0x300b('0xd'),'required':[!![],_0x300b('0xe')]},'transferNumber':{'type':_0x300b('0xd'),'required':[!![],_0x300b('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]},'sessionId':{'type':_0x300b('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x300b('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]}});function emit(_0xd252fa,_0x51186d,_0x509089){logger[_0x300b('0x10')](_0xd252fa,_0x51186d,JSON[_0x300b('0x11')](_0x509089));io['to'](_0xd252fa)[_0x300b('0x12')](_0x51186d,_0x509089);}function handleError(_0xae48d2){return function(_0x4d2024){console[_0x300b('0x13')](_0x300b('0x14'),_0x4d2024,_0x4d2024 instanceof RangeError);logger[_0x300b('0x15')](_0x4d2024['stack']);if(_0x4d2024 instanceof RangeError){if(_0x4d2024[_0x300b('0x16')]){delete _0x4d2024[_0x300b('0x16')];}_0xae48d2[_0x300b('0x17')](0x194)[_0x300b('0x18')](_0x4d2024);}else{if(_0x4d2024['name']){delete _0x4d2024[_0x300b('0x16')];}_0xae48d2[_0x300b('0x17')](0x1f4)[_0x300b('0x18')](_0x4d2024);}};}function checkError(){return function(_0x4a5f75){if(!_0x4a5f75){throw new RangeError(_0x300b('0x19'));}return _0x4a5f75;};}function respondWithRpcPromise(_0x38dedb,_0x30a057){return new BPromise(function(_0x502c5f,_0x26913f){var _0x5b14ed=amiClient;return _0x5b14ed['request'](_0x38dedb,_0x30a057)[_0x300b('0x1a')](function(_0xad0fb){if(_0xad0fb[_0x300b('0x15')]){if(_0xad0fb[_0x300b('0x15')][_0x300b('0x1b')]===0x1f4){return _0x26913f(_0xad0fb[_0x300b('0x15')][_0x300b('0x1c')]);}return _0x502c5f(_0xad0fb[_0x300b('0x15')][_0x300b('0x1c')]);}else{_0x502c5f(_0xad0fb['result']);}})[_0x300b('0x1d')](function(_0x152048){_0x26913f(_0x152048);});});}function getAgent(_0x260bdc){return db[_0x300b('0x1e')]['findOne']({'where':{'id':_0x260bdc,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x39794a,_0x4a1300){return new BPromise(function(_0x1241c7,_0x2496e0){var _0x60bb0c=respondWithRpcPromise(_0x300b('0x1f'));var _0x2d2ea7=getAgent(_0x39794a);Promise[_0x300b('0x20')]([_0x60bb0c,_0x2d2ea7])[_0x300b('0x1a')](function(_0x159b63){var _0x1cdc8b=_0x159b63[0x0];var _0x3210cd=_0x159b63[0x1];var _0x485952=_['filter'](_0x1cdc8b[_0x300b('0x21')],function(_0x2a7604){return _0x2a7604[_0x300b('0x22')]==_0x3210cd['id']&&_0x2a7604[_0x300b('0x23')]==_0x4a1300;});if(_0x485952['length']==0x1){_0x1241c7(_0x3210cd);}else{_0x2496e0(new RangeError(_0x300b('0x24')+_0x4a1300+'\x20not\x20found!'));}});});}exports['originate']=function(_0x53ed0c,_0x27d2de){logger[_0x300b('0x10')]('originate\x20fired:',_0x53ed0c[_0x300b('0x25')]);var _0x39007c=originateValidation['validate'](_0x53ed0c[_0x300b('0x25')]);if(_0x39007c['length']>0x0){return _0x27d2de[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x39007c);}var _0xdad35f=_0x53ed0c[_0x300b('0x25')][_0x300b('0x27')];var _0x46a0e3=_0x53ed0c[_0x300b('0x25')]['callNumber'];var _0x4b00e6=_0x53ed0c['body'][_0x300b('0x28')];var _0x32e326=_0x53ed0c['body'][_0x300b('0x29')];return getAgent(_0xdad35f)[_0x300b('0x1a')](function(_0x5a5aba){logger[_0x300b('0x10')](_0x300b('0x2a'),_0x5a5aba[_0x300b('0x16')]);emit(util['format'](_0x300b('0x2b'),_0x5a5aba[_0x300b('0x16')]),_0x300b('0x2c'),{'callNumber':_0x46a0e3,'callerId':_0x4b00e6,'callbackUrl':_0x32e326});return _0x27d2de[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x2d')});})[_0x300b('0x1d')](handleError(_0x27d2de));};exports['hangup']=function(_0x2da2e3,_0x30b72){logger['info'](_0x300b('0x2e'),_0x2da2e3['body']);var _0x5987da=hangupValidation[_0x300b('0x2f')](_0x2da2e3[_0x300b('0x25')]);if(_0x5987da[_0x300b('0x30')]>0x0){return _0x30b72[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x5987da);}var _0x510ad8=_0x2da2e3[_0x300b('0x25')][_0x300b('0x27')];var _0x55b4da=_0x2da2e3[_0x300b('0x25')]['sessionId'];return getAgent(_0x510ad8)[_0x300b('0x1a')](function(_0x262ddb){logger[_0x300b('0x10')](_0x300b('0x2a'),_0x262ddb[_0x300b('0x16')]);emit(util[_0x300b('0x31')](_0x300b('0x2b'),_0x262ddb[_0x300b('0x16')]),_0x300b('0x32'),{'sessionId':_0x55b4da});return _0x30b72[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x30b72));};exports[_0x300b('0x33')]=function(_0x566af2,_0x5a08f7){logger[_0x300b('0x10')](_0x300b('0x34'),_0x566af2[_0x300b('0x25')]);var _0x5ef864=answerValidation[_0x300b('0x2f')](_0x566af2['body']);if(_0x5ef864['length']>0x0){return _0x5a08f7[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x5ef864);}var _0x5f0fd1=_0x566af2[_0x300b('0x25')][_0x300b('0x27')];var _0x54bdc9=_0x566af2[_0x300b('0x25')][_0x300b('0x23')];return getAgent(_0x5f0fd1)['then'](function(_0x3b1432){logger[_0x300b('0x10')](_0x300b('0x2a'),_0x3b1432[_0x300b('0x16')]);emit(util[_0x300b('0x31')](_0x300b('0x2b'),_0x3b1432[_0x300b('0x16')]),_0x300b('0x35'),{'sessionId':_0x54bdc9});return _0x5a08f7['status'](0xc8)['json']({'error':![],'message':_0x300b('0x36')});})['catch'](handleError(_0x5a08f7));};exports['hold']=function(_0x3379cb,_0x3028c0){logger[_0x300b('0x10')](_0x300b('0x37'),_0x3379cb[_0x300b('0x25')]);var _0x33f978=holdValidation['validate'](_0x3379cb[_0x300b('0x25')]);if(_0x33f978['length']>0x0){return _0x3028c0['status'](0x190)[_0x300b('0x26')](_0x33f978);}var _0x44d1b4=_0x3379cb['body'][_0x300b('0x27')];var _0x290942=_0x3379cb[_0x300b('0x25')][_0x300b('0x23')];return getAgent(_0x44d1b4)['then'](function(_0x389256){logger[_0x300b('0x10')]('entityFound:',_0x389256[_0x300b('0x16')]);emit(util[_0x300b('0x31')](_0x300b('0x2b'),_0x389256['name']),_0x300b('0x38'),{'sessionId':_0x290942});return _0x3028c0[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x39')});})[_0x300b('0x1d')](handleError(_0x3028c0));};exports[_0x300b('0x3a')]=function(_0x418ac3,_0x3dd25c){logger[_0x300b('0x10')](_0x300b('0x3b'),_0x418ac3[_0x300b('0x25')]);var _0x377ca8=unholdValidation[_0x300b('0x2f')](_0x418ac3['body']);if(_0x377ca8['length']>0x0){return _0x3dd25c[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x377ca8);}var _0x124229=_0x418ac3['body'][_0x300b('0x27')];var _0x543035=_0x418ac3[_0x300b('0x25')][_0x300b('0x23')];return getAgent(_0x124229)['then'](function(_0x31aba8){logger[_0x300b('0x10')](_0x300b('0x2a'),_0x31aba8[_0x300b('0x16')]);emit(util['format'](_0x300b('0x2b'),_0x31aba8['name']),_0x300b('0x3c'),{'sessionId':_0x543035});return _0x3dd25c[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x3d')});})[_0x300b('0x1d')](handleError(_0x3dd25c));};exports[_0x300b('0x3e')]=function(_0x69d6dd,_0x178f82){logger[_0x300b('0x10')](_0x300b('0x3f'),_0x178f82[_0x300b('0x25')]);var _0x1d6672=callsValidation[_0x300b('0x2f')](_0x69d6dd[_0x300b('0x25')]);if(_0x1d6672['length']>0x0){return _0x178f82[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x1d6672);}var _0x488715=_0x69d6dd['body'][_0x300b('0x27')];var _0x23e11e=respondWithRpcPromise(_0x300b('0x1f'));var _0xb9eb0a=getAgent(_0x488715);return Promise[_0x300b('0x20')]([_0x23e11e,_0xb9eb0a])[_0x300b('0x1a')](function(_0x18d5d2){var _0x487c2e=_0x18d5d2[0x0];var _0xff003a=_0x18d5d2[0x1];var _0x37ed9f=_['filter'](_0x487c2e[_0x300b('0x21')],function(_0x555f86){return _0x555f86[_0x300b('0x22')]==_0xff003a['id'];});return _0x178f82[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'count':_0x37ed9f['length'],'rows':_0x37ed9f});})[_0x300b('0x1d')](handleError(_0x178f82));};exports[_0x300b('0x40')]=function(_0x371396,_0x34c962){logger['info'](_0x300b('0x41'),_0x371396['body']);var _0x18b763=conferenceValidation[_0x300b('0x2f')](_0x371396['body']);if(_0x18b763[_0x300b('0x30')]>0x0){return _0x34c962[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x18b763);}var _0x4f8881=_0x371396[_0x300b('0x25')][_0x300b('0x27')];return getAgent(_0x4f8881)['then'](function(_0x158b08){logger['info'](_0x300b('0x2a'),_0x158b08[_0x300b('0x16')]);emit(util[_0x300b('0x31')](_0x300b('0x2b'),_0x158b08[_0x300b('0x16')]),_0x300b('0x42'));return _0x34c962[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x43')});})[_0x300b('0x1d')](handleError(_0x34c962));};exports[_0x300b('0x44')]=function(_0x3768f6,_0x464aa6){logger[_0x300b('0x10')](_0x300b('0x45'),_0x3768f6[_0x300b('0x25')]);var _0x3069c0=transferValidation[_0x300b('0x2f')](_0x3768f6[_0x300b('0x25')]);if(_0x3069c0[_0x300b('0x30')]>0x0){return _0x464aa6[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x3069c0);}var _0x3a7470=_0x3768f6['body'][_0x300b('0x27')];var _0x5022d5=_0x3768f6[_0x300b('0x25')][_0x300b('0x23')];var _0x2680e0=_0x3768f6[_0x300b('0x25')][_0x300b('0x46')];return getAgent(_0x3a7470)[_0x300b('0x1a')](function(_0x2f0113){logger[_0x300b('0x10')]('entityFound:',_0x2f0113[_0x300b('0x16')]);emit(util['format']('user:%s',_0x2f0113[_0x300b('0x16')]),_0x300b('0x47'),{'sessionId':_0x5022d5,'transferNumber':_0x2680e0});return _0x464aa6[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x48')});})['catch'](handleError(_0x464aa6));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index a80e97c..bd44ab3 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 _0x4975=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addAnswer','/:id/users','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeDispositions','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated'];(function(_0x47792a,_0x4bd474){var _0x480c14=function(_0x4b0e5e){while(--_0x4b0e5e){_0x47792a['push'](_0x47792a['shift']());}};_0x480c14(++_0x4bd474);}(_0x4975,0x86));var _0x5497=function(_0x48b3ba,_0x4db526){_0x48b3ba=_0x48b3ba-0x0;var _0x4b2b3d=_0x4975[_0x48b3ba];return _0x4b2b3d;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0xa')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0xa')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller['getAnswers']);router['get']('/:id/users',auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router[_0x5497('0xa')](_0x5497('0x15'),auth[_0x5497('0xd')](),controller[_0x5497('0x16')]);router[_0x5497('0x17')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x18')]);router[_0x5497('0x17')]('/:id/dispositions',auth[_0x5497('0xd')](),controller['addDisposition']);router[_0x5497('0x17')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller[_0x5497('0x19')]);router[_0x5497('0x17')](_0x5497('0x1a'),auth[_0x5497('0xd')](),controller['addAgents']);router['post'](_0x5497('0x15'),auth[_0x5497('0xd')](),controller[_0x5497('0x1b')]);router['post'](_0x5497('0x1c'),controller[_0x5497('0x1d')]);router[_0x5497('0x17')](_0x5497('0x1e'),auth[_0x5497('0xd')](),controller[_0x5497('0x1f')]);router[_0x5497('0x20')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x21')]);router[_0x5497('0x22')]('/:id',auth[_0x5497('0xd')](),controller['destroy']);router[_0x5497('0x22')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x23')]);router[_0x5497('0x22')](_0x5497('0x13'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x5497('0x22')](_0x5497('0x1a'),auth[_0x5497('0xd')](),controller[_0x5497('0x24')]);module['exports']=router; \ No newline at end of file +var _0x7096=['removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/notify','/:id/send','send','/:id','update','delete','destroy','removeDispositions','removeAnswers'];(function(_0x4d9183,_0x3f2ae6){var _0x3692f3=function(_0x169a54){while(--_0x169a54){_0x4d9183['push'](_0x4d9183['shift']());}};_0x3692f3(++_0x3f2ae6);}(_0x7096,0x10c));var _0x6709=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7096[_0xbb091];return _0x467a04;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var fs_extra=require(_0x6709('0x3'));var auth=require(_0x6709('0x4'));var interaction=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var controller=require(_0x6709('0x7'));router[_0x6709('0x8')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xa')]);router[_0x6709('0x8')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0xc')]);router['get']('/:id',auth[_0x6709('0x9')](),controller[_0x6709('0xd')]);router[_0x6709('0x8')](_0x6709('0xe'),auth[_0x6709('0x9')](),controller[_0x6709('0xf')]);router['get']('/:id/canned_answers',auth[_0x6709('0x9')](),controller[_0x6709('0x10')]);router[_0x6709('0x8')](_0x6709('0x11'),auth[_0x6709('0x9')](),controller[_0x6709('0x12')]);router[_0x6709('0x8')](_0x6709('0x13'),auth['isAuthenticated'](),controller[_0x6709('0x14')]);router[_0x6709('0x15')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0x16')]);router['post'](_0x6709('0xe'),auth['isAuthenticated'](),controller[_0x6709('0x17')]);router['post'](_0x6709('0x18'),auth[_0x6709('0x9')](),controller[_0x6709('0x19')]);router[_0x6709('0x15')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x6709('0x15')](_0x6709('0x13'),auth['isAuthenticated'](),controller[_0x6709('0x1a')]);router[_0x6709('0x15')](_0x6709('0x1b'),controller['notify']);router[_0x6709('0x15')](_0x6709('0x1c'),auth[_0x6709('0x9')](),controller[_0x6709('0x1d')]);router['put'](_0x6709('0x1e'),auth[_0x6709('0x9')](),controller[_0x6709('0x1f')]);router[_0x6709('0x20')](_0x6709('0x1e'),auth[_0x6709('0x9')](),controller[_0x6709('0x21')]);router[_0x6709('0x20')](_0x6709('0xe'),auth[_0x6709('0x9')](),controller[_0x6709('0x22')]);router[_0x6709('0x20')]('/:id/canned_answers',auth[_0x6709('0x9')](),controller[_0x6709('0x23')]);router[_0x6709('0x20')]('/:id/users',auth[_0x6709('0x9')](),controller[_0x6709('0x24')]);module[_0x6709('0x25')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index b79719c..5152354 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 _0x681e=['STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','mandatoryDispositionPauseId','setDataValue','sequelize','exports'];(function(_0x21bbfc,_0x511146){var _0x1fce1c=function(_0xb84971){while(--_0xb84971){_0x21bbfc['push'](_0x21bbfc['shift']());}};_0x1fce1c(++_0x511146);}(_0x681e,0x8d));var _0xe681=function(_0x5e6b42,_0x357ad2){_0x5e6b42=_0x5e6b42-0x0;var _0x52343f=_0x681e[_0x5e6b42];return _0x52343f;};'use strict';var Sequelize=require(_0xe681('0x0'));var rs=require('randomstring');module[_0xe681('0x1')]={'name':{'type':Sequelize[_0xe681('0x2')],'unique':_0xe681('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xe681('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xe681('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xe681('0x2')],'defaultValue':function(){return rs[_0xe681('0x4')]();}},'phone':{'type':Sequelize[_0xe681('0x2')]},'type':{'type':Sequelize[_0xe681('0x5')](_0xe681('0x6'),'sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xe681('0x2')]},'authToken':{'type':Sequelize[_0xe681('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe681('0x7')],'defaultValue':function(){return _0xe681('0x8');}},'notificationSound':{'type':Sequelize[_0xe681('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe681('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe681('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe681('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe681('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe681('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe681('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe681('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x589b38){if(!_0x589b38){this['setDataValue'](_0xe681('0xb'),null);}this[_0xe681('0xc')]('mandatoryDisposition',_0x589b38);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3f5e=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x257ffc,_0xb417f){var _0x375407=function(_0x4ca22a){while(--_0x4ca22a){_0x257ffc['push'](_0x257ffc['shift']());}};_0x375407(++_0xb417f);}(_0x3f5e,0x64));var _0xe3f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f5e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe3f5('0x0'));var rs=require('randomstring');module[_0xe3f5('0x1')]={'name':{'type':Sequelize[_0xe3f5('0x2')],'unique':_0xe3f5('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xe3f5('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xe3f5('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xe3f5('0x2')],'defaultValue':function(){return rs[_0xe3f5('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe3f5('0x5')](_0xe3f5('0x6'),_0xe3f5('0x7'))},'accountSid':{'type':Sequelize[_0xe3f5('0x2')]},'baseUrl':{'type':Sequelize[_0xe3f5('0x2')]},'authToken':{'type':Sequelize[_0xe3f5('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe3f5('0x8')],'defaultValue':function(){return _0xe3f5('0x9');}},'notificationSound':{'type':Sequelize[_0xe3f5('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe3f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe3f5('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe3f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe3f5('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe3f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xe3f5('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xe3f5('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x571a18){if(!_0x571a18){this[_0xe3f5('0xd')](_0xe3f5('0xe'),null);}this[_0xe3f5('0xd')](_0xe3f5('0xf'),_0x571a18);}},'description':{'type':Sequelize[_0xe3f5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 6d83eda..39f4729 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 _0x5caa=['List','out','Messages','dataValues','push','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','./whatsappAccount.socket','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','name','send','index','mandatoryDispositionPause','rawAttributes','key','map','keys','query','filters','model','attributes','fields','length','sort','where','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','intersection','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Pause','describe','addDisposition','WhatsappAccountId','Disposition','findOne','hasOwnProperty','nolimit','order','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','stack','finally','getApplications','notify','Applications','account','sinch','statuses','state','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','type','twilio','From','replace','Body','messageId','MessageSid','notifications','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','omit','Contacts','defaults','contact','WhatsappInteraction','interaction','created','autoclose','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','entity\x20found','text/xml','\x0a','to\x20is\x20mandatory'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5caa,0x187));var _0xa5ca=function(_0x3c8f26,_0x453699){_0x3c8f26=_0x3c8f26-0x0;var _0x5a4dd7=_0x5caa[_0x3c8f26];return _0x5a4dd7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5ca('0x0'));var zipdir=require(_0xa5ca('0x1'));var jsonpatch=require(_0xa5ca('0x2'));var rp=require(_0xa5ca('0x3'));var moment=require('moment');var BPromise=require(_0xa5ca('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa5ca('0x5'));var sox=require('sox');var csv=require(_0xa5ca('0x6'));var ejs=require(_0xa5ca('0x7'));var fs=require('fs');var fs_extra=require(_0xa5ca('0x8'));var _=require(_0xa5ca('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa5ca('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa5ca('0xb'));var Papa=require('papaparse');var Redis=require(_0xa5ca('0xc'));var authService=require(_0xa5ca('0xd'));var qs=require(_0xa5ca('0xe'));var as=require(_0xa5ca('0xf'));var hardwareService=require(_0xa5ca('0x10'));var logger=require(_0xa5ca('0x11'))(_0xa5ca('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa5ca('0x13'))['db'];config[_0xa5ca('0x14')]=_['defaults'](config[_0xa5ca('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5ca('0x14')]));require(_0xa5ca('0x15'))['register'](socket);var jayson=require(_0xa5ca('0x16'));var client=jayson[_0xa5ca('0x17')][_0xa5ca('0x18')]({'port':0x232c});function respondWithRpcPromise(_0x5f4950,_0x2ab413,_0x5c3496,_0x5efcaa){return new BPromise(function(_0x254df5,_0x3e5e1f){var _0x242306=_0x5efcaa||client;return _0x242306['request'](_0x5f4950,_0x5c3496)[_0xa5ca('0x19')](function(_0x4dce8e){logger[_0xa5ca('0x1a')](_0xa5ca('0x1b'),_0x2ab413,_0xa5ca('0x1c'));logger[_0xa5ca('0x1d')](_0xa5ca('0x1e'),_0x2ab413,_0xa5ca('0x1c'),JSON[_0xa5ca('0x1f')](_0x4dce8e));if(_0x4dce8e[_0xa5ca('0x20')]){if(_0x4dce8e[_0xa5ca('0x20')][_0xa5ca('0x21')]===0x1f4){logger[_0xa5ca('0x20')](_0xa5ca('0x1b'),_0x2ab413,_0x4dce8e[_0xa5ca('0x20')][_0xa5ca('0x22')]);return _0x3e5e1f(_0x4dce8e[_0xa5ca('0x20')][_0xa5ca('0x22')]);}logger[_0xa5ca('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x2ab413,_0x4dce8e[_0xa5ca('0x20')][_0xa5ca('0x22')]);return _0x254df5(_0x4dce8e[_0xa5ca('0x20')][_0xa5ca('0x22')]);}else{logger[_0xa5ca('0x1a')](_0xa5ca('0x1b'),_0x2ab413,_0xa5ca('0x1c'));_0x254df5(_0x4dce8e['result'][_0xa5ca('0x22')]);}})[_0xa5ca('0x23')](function(_0x33a97d){logger[_0xa5ca('0x20')](_0xa5ca('0x1b'),_0x2ab413,_0x33a97d);_0x3e5e1f(_0x33a97d);});});}function respondWithStatusCode(_0x26c2b0,_0x3f8ea1){_0x3f8ea1=_0x3f8ea1||0xcc;return function(_0x2a8d34){if(_0x2a8d34){return _0x26c2b0['sendStatus'](_0x3f8ea1);}return _0x26c2b0[_0xa5ca('0x24')](_0x3f8ea1)[_0xa5ca('0x25')]();};}function respondWithResult(_0x553e5b,_0xa89c94){_0xa89c94=_0xa89c94||0xc8;return function(_0x80eaa0){if(_0x80eaa0){return _0x553e5b[_0xa5ca('0x24')](_0xa89c94)['json'](_0x80eaa0);}};}function respondWithFilteredResult(_0x5f32f4,_0x584b9f){return function(_0x553d8e){if(_0x553d8e){var _0x345663=typeof _0x584b9f[_0xa5ca('0x26')]==='undefined'&&typeof _0x584b9f[_0xa5ca('0x27')]===_0xa5ca('0x28');var _0x18ee9f=_0x553d8e[_0xa5ca('0x29')];var _0x3bb61e=_0x345663?0x0:_0x584b9f[_0xa5ca('0x26')];var _0x5da624=_0x345663?_0x553d8e['count']:_0x584b9f[_0xa5ca('0x26')]+_0x584b9f[_0xa5ca('0x27')];var _0x14097a;if(_0x5da624>=_0x18ee9f){_0x5da624=_0x18ee9f;_0x14097a=0xc8;}else{_0x14097a=0xce;}_0x5f32f4[_0xa5ca('0x24')](_0x14097a);return _0x5f32f4['set'](_0xa5ca('0x2a'),_0x3bb61e+'-'+_0x5da624+'/'+_0x18ee9f)[_0xa5ca('0x2b')](_0x553d8e);}return null;};}function patchUpdates(_0x52944e){return function(_0x5d1dd8){try{jsonpatch[_0xa5ca('0x2c')](_0x5d1dd8,_0x52944e,!![]);}catch(_0x54ad67){return BPromise[_0xa5ca('0x2d')](_0x54ad67);}return _0x5d1dd8[_0xa5ca('0x2e')]();};}function saveUpdates(_0x5940a0,_0x398afc){return function(_0x2e2c6e){if(_0x2e2c6e){return _0x2e2c6e[_0xa5ca('0x2f')](_0x5940a0)['then'](function(_0x9a0026){return _0x9a0026;});}return null;};}function removeEntity(_0x10241b,_0x569f95){return function(_0x240a09){if(_0x240a09){return _0x240a09[_0xa5ca('0x30')]()[_0xa5ca('0x19')](function(){var _0x2eeec6=_0x240a09[_0xa5ca('0x31')]({'plain':!![]});var _0x12b430=_0xa5ca('0x32');return db[_0xa5ca('0x33')][_0xa5ca('0x30')]({'where':{'type':_0x12b430,'resourceId':_0x2eeec6['id']}})['then'](function(){return _0x240a09;});})['then'](function(){_0x10241b[_0xa5ca('0x24')](0xcc)[_0xa5ca('0x25')]();});}};}function handleEntityNotFound(_0x44a854,_0x377fbd){return function(_0x29c376){if(!_0x29c376){_0x44a854[_0xa5ca('0x34')](0x194);}return _0x29c376;};}function handleError(_0x5deff2,_0x3273b6){_0x3273b6=_0x3273b6||0x1f4;return function(_0x52f490){logger[_0xa5ca('0x20')](_0x52f490['stack']);if(_0x52f490['name']){delete _0x52f490[_0xa5ca('0x35')];}_0x5deff2['status'](_0x3273b6)[_0xa5ca('0x36')](_0x52f490);};}exports[_0xa5ca('0x37')]=function(_0x4f5aaf,_0x53685b){var _0x8c06a2={'include':[{'model':db['Pause'],'as':_0xa5ca('0x38')}]},_0x1fb87c={},_0x364e05={'count':0x0,'rows':[]};var _0xe60dfe=_['map'](db['WhatsappAccount'][_0xa5ca('0x39')],function(_0x5de0f0){return{'name':_0x5de0f0['fieldName'],'type':_0x5de0f0['type'][_0xa5ca('0x3a')]};});_0x1fb87c['model']=_[_0xa5ca('0x3b')](_0xe60dfe,_0xa5ca('0x35'));_0x1fb87c['query']=_[_0xa5ca('0x3c')](_0x4f5aaf[_0xa5ca('0x3d')]);_0x1fb87c[_0xa5ca('0x3e')]=_['intersection'](_0x1fb87c[_0xa5ca('0x3f')],_0x1fb87c[_0xa5ca('0x3d')]);_0x8c06a2[_0xa5ca('0x40')]=_['intersection'](_0x1fb87c['model'],qs[_0xa5ca('0x41')](_0x4f5aaf[_0xa5ca('0x3d')]['fields']));_0x8c06a2[_0xa5ca('0x40')]=_0x8c06a2[_0xa5ca('0x40')][_0xa5ca('0x42')]?_0x8c06a2[_0xa5ca('0x40')]:_0x1fb87c['model'];if(!_0x4f5aaf[_0xa5ca('0x3d')]['hasOwnProperty']('nolimit')){_0x8c06a2[_0xa5ca('0x27')]=qs['limit'](_0x4f5aaf[_0xa5ca('0x3d')][_0xa5ca('0x27')]);_0x8c06a2[_0xa5ca('0x26')]=qs[_0xa5ca('0x26')](_0x4f5aaf[_0xa5ca('0x3d')][_0xa5ca('0x26')]);}_0x8c06a2['order']=qs[_0xa5ca('0x43')](_0x4f5aaf['query'][_0xa5ca('0x43')]);_0x8c06a2[_0xa5ca('0x44')]=qs[_0xa5ca('0x3e')](_['pick'](_0x4f5aaf['query'],_0x1fb87c[_0xa5ca('0x3e')]),_0xe60dfe);if(_0x4f5aaf[_0xa5ca('0x3d')][_0xa5ca('0x45')]){_0x8c06a2[_0xa5ca('0x44')]=_[_0xa5ca('0x46')](_0x8c06a2[_0xa5ca('0x44')],{'$or':_[_0xa5ca('0x3b')](_0xe60dfe,function(_0x4198e0){if(_0x4198e0['type']!==_0xa5ca('0x47')){var _0x58527b={};_0x58527b[_0x4198e0[_0xa5ca('0x35')]]={'$like':'%'+_0x4f5aaf[_0xa5ca('0x3d')][_0xa5ca('0x45')]+'%'};return _0x58527b;}})});}_0x8c06a2=_[_0xa5ca('0x46')]({},_0x8c06a2,_0x4f5aaf[_0xa5ca('0x48')]);var _0x5b84e5={'where':_0x8c06a2[_0xa5ca('0x44')]};return db[_0xa5ca('0x49')][_0xa5ca('0x29')](_0x5b84e5)[_0xa5ca('0x19')](function(_0x534b0f){_0x364e05[_0xa5ca('0x29')]=_0x534b0f;if(_0x4f5aaf[_0xa5ca('0x3d')][_0xa5ca('0x4a')]){_0x8c06a2[_0xa5ca('0x4b')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xa5ca('0x4c')](_0x8c06a2);})[_0xa5ca('0x19')](function(_0x4eddc2){_0x364e05[_0xa5ca('0x4d')]=_0x4eddc2;return _0x364e05;})[_0xa5ca('0x19')](respondWithFilteredResult(_0x53685b,_0x8c06a2))['catch'](handleError(_0x53685b,null));};exports[_0xa5ca('0x4e')]=function(_0x3c5cc3,_0x53e091){var _0x57c9e6={'raw':![],'where':{'id':_0x3c5cc3['params']['id']},'include':[{'model':db['Pause'],'as':_0xa5ca('0x38')}]},_0x587722={};_0x587722[_0xa5ca('0x3f')]=_[_0xa5ca('0x3c')](db[_0xa5ca('0x49')][_0xa5ca('0x39')]);_0x587722[_0xa5ca('0x3d')]=_[_0xa5ca('0x3c')](_0x3c5cc3['query']);_0x587722[_0xa5ca('0x3e')]=_[_0xa5ca('0x4f')](_0x587722['model'],_0x587722[_0xa5ca('0x3d')]);_0x57c9e6[_0xa5ca('0x40')]=_['intersection'](_0x587722[_0xa5ca('0x3f')],qs['fields'](_0x3c5cc3[_0xa5ca('0x3d')][_0xa5ca('0x41')]));_0x57c9e6[_0xa5ca('0x40')]=_0x57c9e6['attributes']['length']?_0x57c9e6[_0xa5ca('0x40')]:_0x587722['model'];if(_0x3c5cc3[_0xa5ca('0x3d')][_0xa5ca('0x4a')]){_0x57c9e6[_0xa5ca('0x4b')]=[{'all':!![]}];}_0x57c9e6=_[_0xa5ca('0x46')]({},_0x57c9e6,_0x3c5cc3[_0xa5ca('0x48')]);return db[_0xa5ca('0x49')][_0xa5ca('0x50')](_0x57c9e6)[_0xa5ca('0x19')](handleEntityNotFound(_0x53e091,null))[_0xa5ca('0x19')](respondWithResult(_0x53e091,null))[_0xa5ca('0x23')](handleError(_0x53e091,null));};exports[_0xa5ca('0x51')]=function(_0x3cde20,_0x5c74a0){return db[_0xa5ca('0x49')]['create'](_0x3cde20[_0xa5ca('0x52')],{})['then'](function(_0xde325a){var _0x4fd052=_0x3cde20[_0xa5ca('0x53')][_0xa5ca('0x31')]({'plain':!![]});if(!_0x4fd052)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fd052[_0xa5ca('0x54')]===_0xa5ca('0x53')){var _0x18d726=_0xde325a[_0xa5ca('0x31')]({'plain':!![]});var _0x2077ac='WhatsappAccounts';return db[_0xa5ca('0x55')][_0xa5ca('0x50')]({'where':{'name':_0x2077ac,'userProfileId':_0x4fd052[_0xa5ca('0x56')]},'raw':!![]})[_0xa5ca('0x19')](function(_0x39d7ff){if(_0x39d7ff&&_0x39d7ff[_0xa5ca('0x57')]===0x0){return db[_0xa5ca('0x33')][_0xa5ca('0x51')]({'name':_0x18d726['name'],'resourceId':_0x18d726['id'],'type':_0x39d7ff[_0xa5ca('0x35')],'sectionId':_0x39d7ff['id']},{})[_0xa5ca('0x19')](function(){return _0xde325a;});}else{return _0xde325a;}})['catch'](function(_0x425d45){logger['error'](_0xa5ca('0x58'),_0x425d45);throw _0x425d45;});}return _0xde325a;})[_0xa5ca('0x19')](respondWithResult(_0x5c74a0,0xc9))[_0xa5ca('0x23')](handleError(_0x5c74a0,null));};exports[_0xa5ca('0x2f')]=function(_0x41fc4c,_0x33f73e){if(_0x41fc4c[_0xa5ca('0x52')]['id']){delete _0x41fc4c[_0xa5ca('0x52')]['id'];}return db['WhatsappAccount'][_0xa5ca('0x50')]({'where':{'id':_0x41fc4c[_0xa5ca('0x59')]['id']},'include':[{'model':db[_0xa5ca('0x5a')],'as':_0xa5ca('0x38')}]})[_0xa5ca('0x19')](handleEntityNotFound(_0x33f73e,null))[_0xa5ca('0x19')](saveUpdates(_0x41fc4c[_0xa5ca('0x52')],null))[_0xa5ca('0x19')](respondWithResult(_0x33f73e,null))['catch'](handleError(_0x33f73e,null));};exports[_0xa5ca('0x30')]=function(_0x5e4c7b,_0x35f7fb){return db['WhatsappAccount']['find']({'where':{'id':_0x5e4c7b['params']['id']}})[_0xa5ca('0x19')](handleEntityNotFound(_0x35f7fb,null))[_0xa5ca('0x19')](removeEntity(_0x35f7fb,null))['catch'](handleError(_0x35f7fb,null));};exports[_0xa5ca('0x5b')]=function(_0x35569a,_0x2a30fb){return db[_0xa5ca('0x49')][_0xa5ca('0x5b')]()[_0xa5ca('0x19')](respondWithResult(_0x2a30fb,null))[_0xa5ca('0x23')](handleError(_0x2a30fb,null));};exports[_0xa5ca('0x5c')]=function(_0x5a5a77,_0x30867e,_0x2bd89b){if(_0x5a5a77[_0xa5ca('0x52')]['id']){delete _0x5a5a77['body']['id'];}return db[_0xa5ca('0x49')][_0xa5ca('0x50')]({'where':{'id':_0x5a5a77[_0xa5ca('0x59')]['id']}})[_0xa5ca('0x19')](handleEntityNotFound(_0x30867e,null))[_0xa5ca('0x19')](function(_0x1cc710){if(_0x1cc710){_0x5a5a77[_0xa5ca('0x52')][_0xa5ca('0x5d')]=_0x1cc710['id'];return db[_0xa5ca('0x5e')][_0xa5ca('0x51')](_0x5a5a77[_0xa5ca('0x52')]);}})[_0xa5ca('0x19')](respondWithResult(_0x30867e,null))[_0xa5ca('0x23')](handleError(_0x30867e,null));};exports['getDispositions']=function(_0x1b86e9,_0x1e1a1a,_0x134a49){var _0x487e57={'raw':![],'where':{}};var _0x5779b1={};var _0x5c28c8={'count':0x0,'rows':[]};return db[_0xa5ca('0x49')][_0xa5ca('0x5f')]({'where':{'id':_0x1b86e9[_0xa5ca('0x59')]['id']}})[_0xa5ca('0x19')](handleEntityNotFound(_0x1e1a1a,null))[_0xa5ca('0x19')](function(_0x4a7546){if(_0x4a7546){_0x5779b1[_0xa5ca('0x3f')]=_[_0xa5ca('0x3c')](db[_0xa5ca('0x5e')][_0xa5ca('0x39')]);_0x5779b1[_0xa5ca('0x3d')]=_['keys'](_0x1b86e9[_0xa5ca('0x3d')]);_0x5779b1['filters']=_[_0xa5ca('0x4f')](_0x5779b1[_0xa5ca('0x3f')],_0x5779b1[_0xa5ca('0x3d')]);_0x487e57[_0xa5ca('0x40')]=_[_0xa5ca('0x4f')](_0x5779b1[_0xa5ca('0x3f')],qs[_0xa5ca('0x41')](_0x1b86e9[_0xa5ca('0x3d')]['fields']));_0x487e57['attributes']=_0x487e57[_0xa5ca('0x40')]['length']?_0x487e57[_0xa5ca('0x40')]:_0x5779b1['model'];if(!_0x1b86e9['query'][_0xa5ca('0x60')](_0xa5ca('0x61'))){_0x487e57[_0xa5ca('0x27')]=qs[_0xa5ca('0x27')](_0x1b86e9[_0xa5ca('0x3d')][_0xa5ca('0x27')]);_0x487e57[_0xa5ca('0x26')]=qs[_0xa5ca('0x26')](_0x1b86e9[_0xa5ca('0x3d')][_0xa5ca('0x26')]);}_0x487e57[_0xa5ca('0x62')]=qs['sort'](_0x1b86e9[_0xa5ca('0x3d')][_0xa5ca('0x43')]);_0x487e57[_0xa5ca('0x44')]=qs[_0xa5ca('0x3e')](_[_0xa5ca('0x63')](_0x1b86e9[_0xa5ca('0x3d')],_0x5779b1['filters']));_0x487e57['where'][_0xa5ca('0x5d')]=_0x4a7546['id'];if(_0x1b86e9['query'][_0xa5ca('0x45')]){_0x487e57[_0xa5ca('0x44')]=_['merge'](_0x487e57[_0xa5ca('0x44')],{'$or':_[_0xa5ca('0x3b')](_0x487e57['attributes'],function(_0xcc755b){var _0x8438a6={};_0x8438a6[_0xcc755b]={'$like':'%'+_0x1b86e9['query'][_0xa5ca('0x45')]+'%'};return _0x8438a6;})});}_0x487e57=_[_0xa5ca('0x46')]({},_0x487e57,_0x1b86e9[_0xa5ca('0x48')]);return db['Disposition'][_0xa5ca('0x29')]({'where':_0x487e57[_0xa5ca('0x44')]})[_0xa5ca('0x19')](function(_0x34a980){_0x5c28c8['count']=_0x34a980;if(_0x1b86e9['query'][_0xa5ca('0x4a')]){_0x487e57[_0xa5ca('0x4b')]=[{'all':!![]}];}return db[_0xa5ca('0x5e')]['findAll'](_0x487e57);})[_0xa5ca('0x19')](function(_0x15dc5e){_0x5c28c8[_0xa5ca('0x4d')]=_0x15dc5e;return _0x5c28c8;});}})['then'](respondWithFilteredResult(_0x1e1a1a,_0x487e57))[_0xa5ca('0x23')](handleError(_0x1e1a1a,null));};exports['removeDispositions']=function(_0xb7af50,_0x92fc8c,_0x30bcc4){return db[_0xa5ca('0x49')][_0xa5ca('0x50')]({'where':{'id':_0xb7af50[_0xa5ca('0x59')]['id']}})[_0xa5ca('0x19')](handleEntityNotFound(_0x92fc8c,null))[_0xa5ca('0x19')](function(_0x236ad7){if(_0x236ad7){return _0x236ad7[_0xa5ca('0x64')](_0xb7af50[_0xa5ca('0x3d')]['ids']);}})[_0xa5ca('0x19')](respondWithStatusCode(_0x92fc8c,null))['catch'](handleError(_0x92fc8c,null));};exports[_0xa5ca('0x65')]=function(_0x31f7ab,_0xb19c4d,_0xccc1ac){if(_0x31f7ab[_0xa5ca('0x52')]['id']){delete _0x31f7ab[_0xa5ca('0x52')]['id'];}return db[_0xa5ca('0x49')][_0xa5ca('0x50')]({'where':{'id':_0x31f7ab[_0xa5ca('0x59')]['id']}})[_0xa5ca('0x19')](handleEntityNotFound(_0xb19c4d,null))[_0xa5ca('0x19')](function(_0x57df91){if(_0x57df91){_0x31f7ab['body'][_0xa5ca('0x5d')]=_0x57df91['id'];return db[_0xa5ca('0x66')][_0xa5ca('0x51')](_0x31f7ab[_0xa5ca('0x52')]);}})[_0xa5ca('0x19')](respondWithResult(_0xb19c4d,null))[_0xa5ca('0x23')](handleError(_0xb19c4d,null));};exports[_0xa5ca('0x67')]=function(_0x71c18d,_0x4adb01,_0x35de18){var _0x5165b5={'raw':![],'where':{}};var _0x2d6a72={};var _0xc43f4e={'count':0x0,'rows':[]};return db[_0xa5ca('0x49')][_0xa5ca('0x5f')]({'where':{'id':_0x71c18d['params']['id']}})[_0xa5ca('0x19')](handleEntityNotFound(_0x4adb01,null))[_0xa5ca('0x19')](function(_0x5bb90e){if(_0x5bb90e){_0x2d6a72['model']=_[_0xa5ca('0x3c')](db[_0xa5ca('0x66')][_0xa5ca('0x39')]);_0x2d6a72[_0xa5ca('0x3d')]=_['keys'](_0x71c18d[_0xa5ca('0x3d')]);_0x2d6a72[_0xa5ca('0x3e')]=_['intersection'](_0x2d6a72['model'],_0x2d6a72[_0xa5ca('0x3d')]);_0x5165b5['attributes']=_[_0xa5ca('0x4f')](_0x2d6a72[_0xa5ca('0x3f')],qs[_0xa5ca('0x41')](_0x71c18d[_0xa5ca('0x3d')][_0xa5ca('0x41')]));_0x5165b5[_0xa5ca('0x40')]=_0x5165b5['attributes']['length']?_0x5165b5['attributes']:_0x2d6a72[_0xa5ca('0x3f')];if(!_0x71c18d[_0xa5ca('0x3d')]['hasOwnProperty']('nolimit')){_0x5165b5[_0xa5ca('0x27')]=qs['limit'](_0x71c18d['query']['limit']);_0x5165b5[_0xa5ca('0x26')]=qs[_0xa5ca('0x26')](_0x71c18d[_0xa5ca('0x3d')][_0xa5ca('0x26')]);}_0x5165b5[_0xa5ca('0x62')]=qs[_0xa5ca('0x43')](_0x71c18d[_0xa5ca('0x3d')][_0xa5ca('0x43')]);_0x5165b5[_0xa5ca('0x44')]=qs[_0xa5ca('0x3e')](_['pick'](_0x71c18d[_0xa5ca('0x3d')],_0x2d6a72[_0xa5ca('0x3e')]));_0x5165b5[_0xa5ca('0x44')][_0xa5ca('0x5d')]=_0x5bb90e['id'];if(_0x71c18d[_0xa5ca('0x3d')][_0xa5ca('0x45')]){_0x5165b5['where']=_[_0xa5ca('0x46')](_0x5165b5[_0xa5ca('0x44')],{'$or':_[_0xa5ca('0x3b')](_0x5165b5['attributes'],function(_0xb9fd6a){var _0x36dff3={};_0x36dff3[_0xb9fd6a]={'$like':'%'+_0x71c18d[_0xa5ca('0x3d')]['filter']+'%'};return _0x36dff3;})});}_0x5165b5=_[_0xa5ca('0x46')]({},_0x5165b5,_0x71c18d[_0xa5ca('0x48')]);return db['CannedAnswer']['count']({'where':_0x5165b5[_0xa5ca('0x44')]})[_0xa5ca('0x19')](function(_0x5cb51d){_0xc43f4e[_0xa5ca('0x29')]=_0x5cb51d;if(_0x71c18d[_0xa5ca('0x3d')]['includeAll']){_0x5165b5[_0xa5ca('0x4b')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5165b5);})[_0xa5ca('0x19')](function(_0x375acc){_0xc43f4e[_0xa5ca('0x4d')]=_0x375acc;return _0xc43f4e;});}})[_0xa5ca('0x19')](respondWithFilteredResult(_0x4adb01,_0x5165b5))[_0xa5ca('0x23')](handleError(_0x4adb01,null));};exports[_0xa5ca('0x68')]=function(_0x5e4a4a,_0x3796d6,_0x291962){return db[_0xa5ca('0x49')][_0xa5ca('0x50')]({'where':{'id':_0x5e4a4a[_0xa5ca('0x59')]['id']}})[_0xa5ca('0x19')](handleEntityNotFound(_0x3796d6,null))[_0xa5ca('0x19')](function(_0x1638ac){if(_0x1638ac){return _0x1638ac[_0xa5ca('0x68')](_0x5e4a4a[_0xa5ca('0x3d')][_0xa5ca('0x69')]);}})[_0xa5ca('0x19')](respondWithStatusCode(_0x3796d6,null))['catch'](handleError(_0x3796d6,null));};exports[_0xa5ca('0x6a')]=function(_0x28e010,_0x590e11,_0x1d98db){return db[_0xa5ca('0x49')][_0xa5ca('0x50')]({'where':{'id':_0x28e010[_0xa5ca('0x59')]['id']}})[_0xa5ca('0x19')](handleEntityNotFound(_0x590e11,null))[_0xa5ca('0x19')](function(_0x43b0f6){if(_0x43b0f6){return _0x43b0f6[_0xa5ca('0x6a')](_0x28e010[_0xa5ca('0x52')][_0xa5ca('0x69')],_['omit'](_0x28e010['body'],[_0xa5ca('0x69'),'id'])||{})[_0xa5ca('0x6b')](function(_0x1bf4ac){for(var _0x273238=0x0;_0x273238<_0x28e010[_0xa5ca('0x52')]['ids'][_0xa5ca('0x42')];_0x273238+=0x1){socket[_0xa5ca('0x6c')](_0xa5ca('0x6d'),{'UserId':Number(_0x28e010[_0xa5ca('0x52')][_0xa5ca('0x69')][_0x273238]),'WhatsappAccountId':Number(_0x28e010[_0xa5ca('0x59')]['id'])});}return _0x1bf4ac;});}})[_0xa5ca('0x19')](respondWithResult(_0x590e11,null))[_0xa5ca('0x23')](handleError(_0x590e11,null));};exports['removeAgents']=function(_0x5eb9a6,_0x769bef,_0x159804){return db[_0xa5ca('0x49')][_0xa5ca('0x50')]({'where':{'id':_0x5eb9a6[_0xa5ca('0x59')]['id']}})['then'](handleEntityNotFound(_0x769bef,null))[_0xa5ca('0x19')](function(_0x166be4){if(_0x166be4){return _0x166be4[_0xa5ca('0x6e')](_0x5eb9a6[_0xa5ca('0x3d')]['ids'])[_0xa5ca('0x19')](function(){if(_[_0xa5ca('0x6f')](_0x5eb9a6[_0xa5ca('0x3d')][_0xa5ca('0x69')])){for(var _0x24b5c3=0x0;_0x24b5c3<_0x5eb9a6[_0xa5ca('0x3d')][_0xa5ca('0x69')][_0xa5ca('0x42')];_0x24b5c3+=0x1){socket[_0xa5ca('0x6c')](_0xa5ca('0x70'),{'UserId':Number(_0x5eb9a6[_0xa5ca('0x3d')][_0xa5ca('0x69')][_0x24b5c3]),'WhatsappAccountId':Number(_0x5eb9a6[_0xa5ca('0x59')]['id'])});}}else{socket[_0xa5ca('0x6c')](_0xa5ca('0x70'),{'UserId':Number(_0x5eb9a6['query'][_0xa5ca('0x69')]),'WhatsappAccountId':Number(_0x5eb9a6[_0xa5ca('0x59')]['id'])});}});}})[_0xa5ca('0x19')](respondWithStatusCode(_0x769bef,null))[_0xa5ca('0x23')](handleError(_0x769bef,null));};exports['getAgents']=function(_0x1b9153,_0x2e2ab7,_0x285e3b){var _0x1913dd={};var _0x39ae31={};var _0xcd690a;var _0x474ee0;return db[_0xa5ca('0x49')][_0xa5ca('0x5f')]({'where':{'id':_0x1b9153[_0xa5ca('0x59')]['id']}})['then'](handleEntityNotFound(_0x2e2ab7,null))[_0xa5ca('0x19')](function(_0x1ec40f){if(_0x1ec40f){_0xcd690a=_0x1ec40f;_0x39ae31[_0xa5ca('0x3f')]=_[_0xa5ca('0x3c')](db[_0xa5ca('0x71')][_0xa5ca('0x39')]);_0x39ae31[_0xa5ca('0x3d')]=_[_0xa5ca('0x3c')](_0x1b9153['query']);_0x39ae31['filters']=_[_0xa5ca('0x4f')](_0x39ae31[_0xa5ca('0x3f')],_0x39ae31[_0xa5ca('0x3d')]);_0x1913dd[_0xa5ca('0x40')]=_['intersection'](_0x39ae31[_0xa5ca('0x3f')],qs[_0xa5ca('0x41')](_0x1b9153[_0xa5ca('0x3d')][_0xa5ca('0x41')]));_0x1913dd['attributes']=_0x1913dd[_0xa5ca('0x40')][_0xa5ca('0x42')]?_0x1913dd[_0xa5ca('0x40')]:_0x39ae31[_0xa5ca('0x3f')];_0x1913dd['order']=qs[_0xa5ca('0x43')](_0x1b9153[_0xa5ca('0x3d')][_0xa5ca('0x43')]);_0x1913dd[_0xa5ca('0x44')]=qs['filters'](_[_0xa5ca('0x63')](_0x1b9153[_0xa5ca('0x3d')],_0x39ae31[_0xa5ca('0x3e')]));if(_0x1b9153[_0xa5ca('0x3d')][_0xa5ca('0x45')]){_0x1913dd[_0xa5ca('0x44')]=_[_0xa5ca('0x46')](_0x1913dd[_0xa5ca('0x44')],{'$or':_[_0xa5ca('0x3b')](_0x1913dd[_0xa5ca('0x40')],function(_0x1ad42a){var _0x4f39d3={};_0x4f39d3[_0x1ad42a]={'$like':'%'+_0x1b9153[_0xa5ca('0x3d')][_0xa5ca('0x45')]+'%'};return _0x4f39d3;})});}_0x1913dd=_[_0xa5ca('0x46')]({},_0x1913dd,_0x1b9153['options']);return _0xcd690a['getAgents'](_0x1913dd);}})[_0xa5ca('0x19')](function(_0x4216ef){if(_0x4216ef){_0x474ee0=_0x4216ef[_0xa5ca('0x42')];if(!_0x1b9153[_0xa5ca('0x3d')][_0xa5ca('0x60')](_0xa5ca('0x61'))){_0x1913dd['limit']=qs[_0xa5ca('0x27')](_0x1b9153['query'][_0xa5ca('0x27')]);_0x1913dd['offset']=qs[_0xa5ca('0x26')](_0x1b9153[_0xa5ca('0x3d')][_0xa5ca('0x26')]);}return _0xcd690a[_0xa5ca('0x72')](_0x1913dd);}})['then'](function(_0x5beb40){if(_0x5beb40){return _0x5beb40?{'count':_0x474ee0,'rows':_0x5beb40}:null;}})[_0xa5ca('0x19')](respondWithResult(_0x2e2ab7,null))[_0xa5ca('0x23')](handleError(_0x2e2ab7,null));};exports[_0xa5ca('0x73')]=function(_0x35c7ce,_0x1580e9){var _0x31f8a5=_0x35c7ce['params']['id'];var _0x3d1398=_0x35c7ce[_0xa5ca('0x52')];var _0x57174f=0xc8;var _0xaebb0e=null;return db['sequelize'][_0xa5ca('0x74')]({'isolationLevel':db['sequelize'][_0xa5ca('0x75')][_0xa5ca('0x76')][_0xa5ca('0x77')]},function(_0x5cf3df){return db[_0xa5ca('0x49')][_0xa5ca('0x5f')]({'where':{'id':_0x31f8a5},'transaction':_0x5cf3df})['then'](function(_0x71c59f){if(_0x71c59f){return db[_0xa5ca('0x78')][_0xa5ca('0x30')]({'where':{'WhatsappAccountId':_0x31f8a5},'transaction':_0x5cf3df})[_0xa5ca('0x19')](function(){var _0x2ae5b6=_[_0xa5ca('0x3b')](_0x3d1398,function(_0x7a6e65){_0x7a6e65['WhatsappAccountId']=_0x31f8a5;return _0x7a6e65;});return db[_0xa5ca('0x78')]['bulkCreate'](_0x2ae5b6,{'transaction':_0x5cf3df});});}else{_0x57174f=0x194;_0xaebb0e=[];}});})[_0xa5ca('0x19')](function(){if(_0x57174f!==0x194){return db['WhatsappApplication'][_0xa5ca('0x79')]({'where':{'WhatsappAccountId':_0x31f8a5},'order':_0xa5ca('0x7a')})['then'](function(_0x360fca){_0xaebb0e=_0x360fca;});}})[_0xa5ca('0x23')](function(_0x49ff22){_0x57174f=0x1f4;logger[_0xa5ca('0x20')](_0x49ff22[_0xa5ca('0x7b')]);if(_0x49ff22[_0xa5ca('0x35')]){delete _0x49ff22[_0xa5ca('0x35')];}_0xaebb0e=_0x49ff22;})[_0xa5ca('0x7c')](function(){if(_0xaebb0e===null){_0x1580e9[_0xa5ca('0x34')](_0x57174f);}else{if(_0x57174f===0x1f4){_0x1580e9['status'](_0x57174f)[_0xa5ca('0x36')](_0xaebb0e);}else{_0x1580e9[_0xa5ca('0x24')](_0x57174f)[_0xa5ca('0x2b')](_0xaebb0e);}}});};exports[_0xa5ca('0x7d')]=function(_0x56b453,_0x518d70,_0x23adbb){var _0x92bef6={};var _0x34e987={};var _0x1c3ef0;var _0x3995e4;return db[_0xa5ca('0x49')][_0xa5ca('0x5f')]({'where':{'id':_0x56b453[_0xa5ca('0x59')]['id']}})[_0xa5ca('0x19')](handleEntityNotFound(_0x518d70,null))['then'](function(_0x5c4d56){if(_0x5c4d56){_0x1c3ef0=_0x5c4d56;_0x34e987[_0xa5ca('0x3f')]=_[_0xa5ca('0x3c')](db[_0xa5ca('0x78')]['rawAttributes']);_0x34e987[_0xa5ca('0x3d')]=_[_0xa5ca('0x3c')](_0x56b453[_0xa5ca('0x3d')]);_0x34e987['filters']=_[_0xa5ca('0x4f')](_0x34e987[_0xa5ca('0x3f')],_0x34e987['query']);_0x92bef6[_0xa5ca('0x40')]=_['intersection'](_0x34e987['model'],qs[_0xa5ca('0x41')](_0x56b453[_0xa5ca('0x3d')]['fields']));_0x92bef6['attributes']=_0x92bef6[_0xa5ca('0x40')][_0xa5ca('0x42')]?_0x92bef6[_0xa5ca('0x40')]:_0x34e987[_0xa5ca('0x3f')];_0x92bef6[_0xa5ca('0x62')]=qs['sort'](_0x56b453[_0xa5ca('0x3d')][_0xa5ca('0x43')]);_0x92bef6[_0xa5ca('0x44')]=qs[_0xa5ca('0x3e')](_[_0xa5ca('0x63')](_0x56b453[_0xa5ca('0x3d')],_0x34e987[_0xa5ca('0x3e')]));if(_0x56b453[_0xa5ca('0x3d')][_0xa5ca('0x45')]){_0x92bef6['where']=_['merge'](_0x92bef6[_0xa5ca('0x44')],{'$or':_[_0xa5ca('0x3b')](_0x92bef6[_0xa5ca('0x40')],function(_0x423ade){var _0x4210d0={};_0x4210d0[_0x423ade]={'$like':'%'+_0x56b453[_0xa5ca('0x3d')]['filter']+'%'};return _0x4210d0;})});}_0x92bef6=_[_0xa5ca('0x46')]({},_0x92bef6,_0x56b453[_0xa5ca('0x48')]);return _0x1c3ef0[_0xa5ca('0x7d')](_0x92bef6);}})[_0xa5ca('0x19')](function(_0x338bed){if(_0x338bed){_0x3995e4=_0x338bed[_0xa5ca('0x42')];if(!_0x56b453[_0xa5ca('0x3d')][_0xa5ca('0x60')](_0xa5ca('0x61'))){_0x92bef6[_0xa5ca('0x27')]=qs[_0xa5ca('0x27')](_0x56b453[_0xa5ca('0x3d')]['limit']);_0x92bef6['offset']=qs[_0xa5ca('0x26')](_0x56b453['query'][_0xa5ca('0x26')]);}return _0x1c3ef0[_0xa5ca('0x7d')](_0x92bef6);}})['then'](function(_0x5aa671){if(_0x5aa671){return _0x5aa671?{'count':_0x3995e4,'rows':_0x5aa671}:null;}})[_0xa5ca('0x19')](respondWithResult(_0x518d70,null))[_0xa5ca('0x23')](handleError(_0x518d70,null));};exports[_0xa5ca('0x7e')]=function(_0x7e03ff,_0x271586,_0x22e59e){var _0x212346={'channel':'whatsapp'};var _0x225b54=[];var _0x3e977d=[];var _0x420587={};return db[_0xa5ca('0x49')]['find']({'where':{'id':_0x7e03ff[_0xa5ca('0x59')]['id']},'include':[{'model':db[_0xa5ca('0x78')],'as':_0xa5ca('0x7f')}]})[_0xa5ca('0x19')](handleEntityNotFound(_0x271586,null))[_0xa5ca('0x19')](function(_0x3bd84b){_0x212346['account']=_0x3bd84b;if(_0x212346['account']&&_0x212346[_0xa5ca('0x80')]['type']===_0xa5ca('0x81')&&_0x7e03ff['body'][_0xa5ca('0x82')]){if(_0x7e03ff[_0xa5ca('0x52')][_0xa5ca('0x82')]['length']===0x0)return;if(_0x7e03ff[_0xa5ca('0x52')][_0xa5ca('0x82')][0x0][_0xa5ca('0x83')]!=='read')return;return db[_0xa5ca('0x84')][_0xa5ca('0x2f')]({'read':!![],'readAt':_0x7e03ff[_0xa5ca('0x52')][_0xa5ca('0x82')][0x0][_0xa5ca('0x85')]},{'where':{'messageId':_0x7e03ff[_0xa5ca('0x52')][_0xa5ca('0x82')][0x0][_0xa5ca('0x86')]},'individualHooks':!![]})[_0xa5ca('0x19')](function(_0x3cabe0){return _0x271586[_0xa5ca('0x24')](0xc8)[_0xa5ca('0x2b')](_0x3cabe0);});}_0x212346[_0xa5ca('0x87')]=_[_0xa5ca('0x88')](_0x3bd84b[_0xa5ca('0x7f')],[_0xa5ca('0x7a')],[_0xa5ca('0x89')]);if(_0x212346[_0xa5ca('0x80')][_0xa5ca('0x7f')]){delete _0x212346[_0xa5ca('0x80')][_0xa5ca('0x7f')];}return db['CmContact'][_0xa5ca('0x5b')]()[_0xa5ca('0x19')](function(_0x17df28){if(!_0x17df28){throw new db[(_0xa5ca('0x8a'))][(_0xa5ca('0x8b'))](_0xa5ca('0x8c'));}_0x225b54=_['difference'](_['keys'](_0x17df28),[_0xa5ca('0x8d'),_0xa5ca('0x8e')]);_0x3e977d=_['difference'](_['keys'](_0x17df28),['createdAt',_0xa5ca('0x8e'),_0xa5ca('0x8f'),_0xa5ca('0x90')]);_0x212346[_0xa5ca('0x52')]={'mapKey':_0xa5ca('0x91')};if(_0x212346[_0xa5ca('0x80')]&&_0x212346[_0xa5ca('0x80')][_0xa5ca('0x92')]===_0xa5ca('0x93')){_0x212346[_0xa5ca('0x52')]['from']=_0x7e03ff['body'][_0xa5ca('0x94')][_0xa5ca('0x95')]('whatsapp:','');_0x212346['body'][_0xa5ca('0x52')]=_0x7e03ff[_0xa5ca('0x52')][_0xa5ca('0x96')];_0x212346[_0xa5ca('0x52')][_0xa5ca('0x97')]=_0x7e03ff['body'][_0xa5ca('0x98')];}if(_0x212346[_0xa5ca('0x80')]&&_0x212346[_0xa5ca('0x80')][_0xa5ca('0x92')]===_0xa5ca('0x81')){_0x212346['body']['from']=_0x7e03ff[_0xa5ca('0x52')][_0xa5ca('0x99')][0x0]['from'];_0x212346[_0xa5ca('0x52')][_0xa5ca('0x52')]=_0x7e03ff['body'][_0xa5ca('0x99')][0x0][_0xa5ca('0x22')][_0xa5ca('0x52')];_0x212346[_0xa5ca('0x52')]['messageId']=_0x7e03ff[_0xa5ca('0x52')][_0xa5ca('0x99')][0x0][_0xa5ca('0x86')];}if(_0x212346['body']['id']){delete _0x212346['body']['id'];}if(_[_0xa5ca('0x9a')](_0x212346[_0xa5ca('0x52')][_0xa5ca('0x9b')])){throw new db[(_0xa5ca('0x8a'))][(_0xa5ca('0x8b'))](_0xa5ca('0x9c'));}if(_[_0xa5ca('0x9a')](_0x212346[_0xa5ca('0x52')]['body'])||_0x212346[_0xa5ca('0x52')][_0xa5ca('0x52')]===''){throw new db[(_0xa5ca('0x8a'))][(_0xa5ca('0x8b'))](_0xa5ca('0x9d'));}if(_['isNil'](_0x212346[_0xa5ca('0x52')][_0xa5ca('0x9e')])){throw new db[(_0xa5ca('0x8a'))][(_0xa5ca('0x8b'))](_0xa5ca('0x9f')+_0x3e977d);}if(!_[_0xa5ca('0xa0')](_0x3e977d,_0x212346[_0xa5ca('0x52')]['mapKey'])){throw new db['Sequelize'][(_0xa5ca('0x8b'))](_0xa5ca('0xa1')+_0x3e977d);}_0x420587[_0x212346[_0xa5ca('0x52')]['mapKey']]=_0x212346['body'][_0xa5ca('0x9b')];return db[_0xa5ca('0xa2')][_0xa5ca('0x50')]({'where':{'id':_0x212346[_0xa5ca('0x80')][_0xa5ca('0x90')]},'include':[{'model':db[_0xa5ca('0xa3')],'as':'Contacts','where':_0x420587,'limit':0x1,'order':[[_0xa5ca('0x8e'),_0xa5ca('0xa4')]]}]});})[_0xa5ca('0x19')](handleEntityNotFound(_0x271586,null))[_0xa5ca('0x19')](function(_0x5c91d4){if(_0x5c91d4){_0x212346[_0xa5ca('0xa5')]=_[_0xa5ca('0xa6')](_0x5c91d4,[_0xa5ca('0xa7')]);if(_0x5c91d4[_0xa5ca('0xa7')][_0xa5ca('0x42')]){return _0x5c91d4['Contacts'][0x0];}var _0x46d3fc=_[_0xa5ca('0xa8')](_0x212346['body'],{'firstName':_0x212346[_0xa5ca('0x52')][_0xa5ca('0x9b')],'ListId':_0x5c91d4['id']});_0x46d3fc[_0x212346['body']['mapKey']]=_0x212346[_0xa5ca('0x52')][_0xa5ca('0x9b')];return db[_0xa5ca('0xa3')][_0xa5ca('0x51')](_0x46d3fc,{'fields':_0x225b54,'raw':!![]});}})['then'](handleEntityNotFound(_0x271586,null))[_0xa5ca('0x19')](function(_0x4a4260){if(_0x4a4260){_0x212346[_0xa5ca('0xa9')]=_0x4a4260;var _0x25c544={'ContactId':_0x4a4260['id'],'phone':_0x212346[_0xa5ca('0x52')][_0xa5ca('0x9b')],'WhatsappAccountId':_0x7e03ff[_0xa5ca('0x59')]['id']};var _0x3149fe={'ContactId':_0x4a4260['id'],'WhatsappAccountId':_0x7e03ff[_0xa5ca('0x59')]['id'],'closed':![]};return db[_0xa5ca('0xaa')][_0xa5ca('0x50')]({'where':_0x3149fe})[_0xa5ca('0x19')](function(_0x70e917){if(_0x70e917){return[_0x70e917,![]];}return db[_0xa5ca('0xaa')][_0xa5ca('0x51')](_0x25c544)[_0xa5ca('0x19')](function(_0x1da1b5){return[_0x1da1b5,!![]];});});}})[_0xa5ca('0x6b')](function(_0x2d3373,_0x711ab6){_0x212346[_0xa5ca('0xab')]=_0x2d3373['get']({'plain':!![]});_0x212346[_0xa5ca('0xab')][_0xa5ca('0xac')]=![];if(_0x711ab6){if(_0x212346[_0xa5ca('0x80')][_0xa5ca('0xad')]){_0x212346[_0xa5ca('0x87')]['push']({'id':0x0,'priority':_0x212346[_0xa5ca('0x87')][_0xa5ca('0x42')]+0x1,'app':'close','appdata':_0xa5ca('0xae'),'interval':'*,*,*,*'});}_0x212346[_0xa5ca('0xab')]['created']=!![];}return db[_0xa5ca('0x84')][_0xa5ca('0x51')]({'phone':_0x212346[_0xa5ca('0x52')][_0xa5ca('0x9b')],'messageId':_0x212346[_0xa5ca('0x52')][_0xa5ca('0x97')],'body':_0x212346['body']['body'],'WhatsappAccountId':_0x7e03ff['params']['id'],'WhatsappInteractionId':_0x2d3373['id'],'direction':'in','ContactId':_0x2d3373[_0xa5ca('0xaf')],'AttachmentId':_0x212346['body'][_0xa5ca('0xb0')]});})[_0xa5ca('0x19')](function(_0x2d8542){_0x212346[_0xa5ca('0x22')]=_0x2d8542;if(_0x212346[_0xa5ca('0xab')][_0xa5ca('0xb1')]){return db[_0xa5ca('0x71')][_0xa5ca('0x50')]({'attributes':['id',_0xa5ca('0x35')],'where':{'id':_0x212346[_0xa5ca('0xab')]['UserId']}})[_0xa5ca('0x19')](function(_0x3c689e){if(_0x3c689e){_0x212346[_0xa5ca('0x87')][_0xa5ca('0xb2')]({'id':0x0,'priority':0x0,'app':_0xa5ca('0xb3'),'appdata':_0x3c689e[_0xa5ca('0x35')]+','+(_0x212346[_0xa5ca('0x80')][_0xa5ca('0xb4')]||0xa),'interval':_0xa5ca('0xb5')});}return respondWithRpcPromise('Start',_0xa5ca('0xb6'),_0x212346);});}return respondWithRpcPromise(_0xa5ca('0xb7'),_0xa5ca('0xb6'),_0x212346);})[_0xa5ca('0x19')](function(_0x3ff6de){if(_0x3ff6de){var _0x3ec06b=0xc8;var _0x182bcf='receiveMessage';logger['info'](_0xa5ca('0x1e'),_0x182bcf,_0x3ec06b,_0xa5ca('0xb8'));logger[_0xa5ca('0x1d')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x182bcf,_0x3ec06b,_0xa5ca('0xb8'),JSON[_0xa5ca('0x1f')](_0x3ff6de));if(_0x212346[_0xa5ca('0x80')]['type']===_0xa5ca('0x93')){return _0x271586[_0xa5ca('0x24')](_0x3ec06b)['set']('Content-Type',_0xa5ca('0xb9'))['send'](_0xa5ca('0xba'));}else{return _0x271586['status'](_0x3ec06b)[_0xa5ca('0x2b')](_0x3ff6de);}}});})[_0xa5ca('0x23')](handleError(_0x271586,null));};exports['send']=function(_0x4324b8,_0xb1cf59,_0x5d0161){var _0x3b8c50,_0x20a49e,_0x3bac13;if(_[_0xa5ca('0x9a')](_0x4324b8[_0xa5ca('0x52')][_0xa5ca('0x52')])||_0x4324b8[_0xa5ca('0x52')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa5ca('0x9a')](_0x4324b8['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xa5ca('0xbb'));}_0x3b8c50=_0x4324b8[_0xa5ca('0x52')]['to'];return db[_0xa5ca('0x49')][_0xa5ca('0x50')]({'where':{'id':_0x4324b8[_0xa5ca('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0xa5ca('0xbc'),'include':[{'model':db[_0xa5ca('0xa3')],'as':_0xa5ca('0xa7'),'where':{'mobile':_0x3b8c50},'limit':0x1,'order':[[_0xa5ca('0x8e'),_0xa5ca('0xa4')]]}]}]})[_0xa5ca('0x19')](handleEntityNotFound(_0xb1cf59,null))[_0xa5ca('0x19')](function(_0x53d3ba){if(_0x53d3ba&&_0x53d3ba[_0xa5ca('0xbc')]){_0x20a49e=_0x53d3ba[_0xa5ca('0x31')]({'plain':!![]});if(_0x20a49e[_0xa5ca('0xbc')]&&_0x20a49e[_0xa5ca('0xbc')]['Contacts'][_0xa5ca('0x42')]){return _0x20a49e[_0xa5ca('0xbc')][_0xa5ca('0xa7')][0x0];}return db['CmContact']['create'](_[_0xa5ca('0xa8')](_0x4324b8['body'],{'firstName':_0x3b8c50,'mobile':_0x3b8c50,'phone':_0x3b8c50,'ListId':_0x20a49e[_0xa5ca('0x90')]}));}})['then'](handleEntityNotFound(_0xb1cf59,null))[_0xa5ca('0x19')](function(_0x3f2146){if(_0x3f2146){_0x3bac13=_0x3f2146;return db[_0xa5ca('0xaa')][_0xa5ca('0x50')]({'where':{'ContactId':_0x3bac13['id'],'closed':![],'WhatsappAccountId':_0x20a49e['id']}})[_0xa5ca('0x19')](function(_0x3a9c8f){if(_0x3a9c8f){return[_0x3a9c8f,![]];}return db['WhatsappInteraction'][_0xa5ca('0x51')]({'UserId':_0x4324b8['user']['id'],'ContactId':_0x3bac13['id'],'WhatsappAccountId':_0x20a49e['id'],'phone':_0x3b8c50,'firstMsgDirection':_0xa5ca('0xbd'),'Messages':[_[_0xa5ca('0x46')](_0x4324b8[_0xa5ca('0x52')],{'read':![],'body':_0x4324b8[_0xa5ca('0x52')][_0xa5ca('0x52')],'phone':_0x3b8c50,'WhatsappAccountId':_0x20a49e['id'],'UserId':_0x4324b8[_0xa5ca('0x53')]['id'],'ContactId':_0x3bac13['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xa5ca('0xbe')}]})[_0xa5ca('0x19')](function(_0x47afe8){return[_0x47afe8,!![]];});});}})[_0xa5ca('0x6b')](function(_0x1661c3,_0x6adcb8){if(_0x6adcb8){return _0x1661c3;}return db[_0xa5ca('0x84')][_0xa5ca('0x51')](_[_0xa5ca('0x46')](_0x4324b8[_0xa5ca('0x52')],{'read':![],'body':_0x4324b8[_0xa5ca('0x52')][_0xa5ca('0x52')],'phone':_0x3b8c50,'WhatsappAccountId':_0x20a49e['id'],'WhatsappInteractionId':_0x1661c3['id'],'UserId':_0x4324b8['user']['id'],'ContactId':_0x3bac13['id']}))[_0xa5ca('0x19')](function(_0x1a1c97){_0x1661c3[_0xa5ca('0xbf')]['Messages']=[];_0x1661c3[_0xa5ca('0xbf')][_0xa5ca('0xbe')][_0xa5ca('0xc0')](_0x1a1c97[_0xa5ca('0xbf')]);return _0x1661c3;});})['then'](respondWithResult(_0xb1cf59,null))[_0xa5ca('0x23')](handleError(_0xb1cf59,null));}; \ No newline at end of file +var _0x8c3b=['createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','messageId','MessageSid','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','WhatsappInteraction','created','autoclose','close','unmanaged','*,*,*,*','ContactId','AttachmentId','interaction','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','push','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','update','then','destroy','WhatsappAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','WhatsappAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','Pause','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','describe','addDisposition','Disposition','getDispositions','findOne','WhatsappAccountId','map','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','message_id','applications','orderBy','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference'];(function(_0x864ba8,_0x53028d){var _0x701828=function(_0x343227){while(--_0x343227){_0x864ba8['push'](_0x864ba8['shift']());}};_0x701828(++_0x53028d);}(_0x8c3b,0xf7));var _0xb8c3=function(_0x4ec15e,_0x3040d8){_0x4ec15e=_0x4ec15e-0x0;var _0x408b47=_0x8c3b[_0x4ec15e];return _0x408b47;};'use strict';var emlformat=require(_0xb8c3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb8c3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8c3('0x2'));var moment=require(_0xb8c3('0x3'));var BPromise=require(_0xb8c3('0x4'));var Mustache=require(_0xb8c3('0x5'));var util=require(_0xb8c3('0x6'));var path=require('path');var sox=require(_0xb8c3('0x7'));var csv=require(_0xb8c3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb8c3('0x9'));var _=require(_0xb8c3('0xa'));var squel=require(_0xb8c3('0xb'));var crypto=require(_0xb8c3('0xc'));var jsforce=require(_0xb8c3('0xd'));var deskjs=require(_0xb8c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb8c3('0xf'));var Papa=require(_0xb8c3('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb8c3('0x11'));var as=require(_0xb8c3('0x12'));var hardwareService=require(_0xb8c3('0x13'));var logger=require(_0xb8c3('0x14'))(_0xb8c3('0x15'));var utils=require(_0xb8c3('0x16'));var config=require(_0xb8c3('0x17'));var licenseUtil=require(_0xb8c3('0x18'));var db=require(_0xb8c3('0x19'))['db'];config[_0xb8c3('0x1a')]=_[_0xb8c3('0x1b')](config[_0xb8c3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xb8c3('0x1c'))(new Redis(config[_0xb8c3('0x1a')]));require(_0xb8c3('0x1d'))[_0xb8c3('0x1e')](socket);var jayson=require(_0xb8c3('0x1f'));var client=jayson[_0xb8c3('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5e53ba,_0x3f69b9,_0x133002,_0x48bb15){return new BPromise(function(_0x1d17b9,_0x6decac){var _0x4d6fd7=_0x48bb15||client;return _0x4d6fd7['request'](_0x5e53ba,_0x133002)['then'](function(_0x568c15){logger['info'](_0xb8c3('0x21'),_0x3f69b9,'request\x20sent');logger[_0xb8c3('0x22')](_0xb8c3('0x23'),_0x3f69b9,'request\x20sent',JSON[_0xb8c3('0x24')](_0x568c15));if(_0x568c15[_0xb8c3('0x25')]){if(_0x568c15[_0xb8c3('0x25')][_0xb8c3('0x26')]===0x1f4){logger['error'](_0xb8c3('0x21'),_0x3f69b9,_0x568c15[_0xb8c3('0x25')]['message']);return _0x6decac(_0x568c15['error'][_0xb8c3('0x27')]);}logger[_0xb8c3('0x25')](_0xb8c3('0x21'),_0x3f69b9,_0x568c15[_0xb8c3('0x25')][_0xb8c3('0x27')]);return _0x1d17b9(_0x568c15[_0xb8c3('0x25')]['message']);}else{logger[_0xb8c3('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x3f69b9,_0xb8c3('0x29'));_0x1d17b9(_0x568c15[_0xb8c3('0x2a')][_0xb8c3('0x27')]);}})['catch'](function(_0x472ba1){logger[_0xb8c3('0x25')](_0xb8c3('0x21'),_0x3f69b9,_0x472ba1);_0x6decac(_0x472ba1);});});}function respondWithStatusCode(_0x14aa1a,_0xf0feb3){_0xf0feb3=_0xf0feb3||0xcc;return function(_0x51df10){if(_0x51df10){return _0x14aa1a[_0xb8c3('0x2b')](_0xf0feb3);}return _0x14aa1a[_0xb8c3('0x2c')](_0xf0feb3)[_0xb8c3('0x2d')]();};}function respondWithResult(_0x3f939f,_0x3d6a40){_0x3d6a40=_0x3d6a40||0xc8;return function(_0x57abd5){if(_0x57abd5){return _0x3f939f[_0xb8c3('0x2c')](_0x3d6a40)[_0xb8c3('0x2e')](_0x57abd5);}};}function respondWithFilteredResult(_0x281d91,_0x5d9150){return function(_0xd21f0e){if(_0xd21f0e){var _0x287f64=typeof _0x5d9150['offset']==='undefined'&&typeof _0x5d9150[_0xb8c3('0x2f')]==='undefined';var _0xe312bc=_0xd21f0e[_0xb8c3('0x30')];var _0x214977=_0x287f64?0x0:_0x5d9150[_0xb8c3('0x31')];var _0x34d2f1=_0x287f64?_0xd21f0e[_0xb8c3('0x30')]:_0x5d9150[_0xb8c3('0x31')]+_0x5d9150[_0xb8c3('0x2f')];var _0x5a20c1;if(_0x34d2f1>=_0xe312bc){_0x34d2f1=_0xe312bc;_0x5a20c1=0xc8;}else{_0x5a20c1=0xce;}_0x281d91['status'](_0x5a20c1);return _0x281d91[_0xb8c3('0x32')](_0xb8c3('0x33'),_0x214977+'-'+_0x34d2f1+'/'+_0xe312bc)[_0xb8c3('0x2e')](_0xd21f0e);}return null;};}function patchUpdates(_0x62752){return function(_0x377965){try{jsonpatch[_0xb8c3('0x34')](_0x377965,_0x62752,!![]);}catch(_0x1c702c){return BPromise['reject'](_0x1c702c);}return _0x377965['save']();};}function saveUpdates(_0x4b0526,_0x2892f3){return function(_0x5937e1){if(_0x5937e1){return _0x5937e1[_0xb8c3('0x35')](_0x4b0526)[_0xb8c3('0x36')](function(_0x51a357){return _0x51a357;});}return null;};}function removeEntity(_0x34c17b,_0x31ccff){return function(_0x38e314){if(_0x38e314){return _0x38e314[_0xb8c3('0x37')]()[_0xb8c3('0x36')](function(){var _0x4fdcc4=_0x38e314['get']({'plain':!![]});var _0x433bd4=_0xb8c3('0x38');return db[_0xb8c3('0x39')]['destroy']({'where':{'type':_0x433bd4,'resourceId':_0x4fdcc4['id']}})['then'](function(){return _0x38e314;});})['then'](function(){_0x34c17b[_0xb8c3('0x2c')](0xcc)[_0xb8c3('0x2d')]();});}};}function handleEntityNotFound(_0x53b8e3,_0x377fad){return function(_0x28a592){if(!_0x28a592){_0x53b8e3['sendStatus'](0x194);}return _0x28a592;};}function handleError(_0x5a329d,_0x3ea012){_0x3ea012=_0x3ea012||0x1f4;return function(_0x4d0b7f){logger[_0xb8c3('0x25')](_0x4d0b7f[_0xb8c3('0x3a')]);if(_0x4d0b7f[_0xb8c3('0x3b')]){delete _0x4d0b7f[_0xb8c3('0x3b')];}_0x5a329d['status'](_0x3ea012)['send'](_0x4d0b7f);};}exports[_0xb8c3('0x3c')]=function(_0x2f1f28,_0x4e9f78){var _0x59a60d={'include':[{'model':db['Pause'],'as':_0xb8c3('0x3d')}]},_0x1a44ec={},_0x1b0f01={'count':0x0,'rows':[]};var _0x2612fa=_['map'](db[_0xb8c3('0x3e')][_0xb8c3('0x3f')],function(_0xd7b92b){return{'name':_0xd7b92b['fieldName'],'type':_0xd7b92b[_0xb8c3('0x40')][_0xb8c3('0x41')]};});_0x1a44ec[_0xb8c3('0x42')]=_['map'](_0x2612fa,_0xb8c3('0x3b'));_0x1a44ec[_0xb8c3('0x43')]=_[_0xb8c3('0x44')](_0x2f1f28[_0xb8c3('0x43')]);_0x1a44ec[_0xb8c3('0x45')]=_[_0xb8c3('0x46')](_0x1a44ec[_0xb8c3('0x42')],_0x1a44ec[_0xb8c3('0x43')]);_0x59a60d[_0xb8c3('0x47')]=_[_0xb8c3('0x46')](_0x1a44ec[_0xb8c3('0x42')],qs['fields'](_0x2f1f28[_0xb8c3('0x43')]['fields']));_0x59a60d[_0xb8c3('0x47')]=_0x59a60d['attributes'][_0xb8c3('0x48')]?_0x59a60d[_0xb8c3('0x47')]:_0x1a44ec[_0xb8c3('0x42')];if(!_0x2f1f28[_0xb8c3('0x43')][_0xb8c3('0x49')](_0xb8c3('0x4a'))){_0x59a60d[_0xb8c3('0x2f')]=qs['limit'](_0x2f1f28[_0xb8c3('0x43')][_0xb8c3('0x2f')]);_0x59a60d['offset']=qs[_0xb8c3('0x31')](_0x2f1f28[_0xb8c3('0x43')][_0xb8c3('0x31')]);}_0x59a60d[_0xb8c3('0x4b')]=qs[_0xb8c3('0x4c')](_0x2f1f28[_0xb8c3('0x43')]['sort']);_0x59a60d['where']=qs[_0xb8c3('0x45')](_[_0xb8c3('0x4d')](_0x2f1f28[_0xb8c3('0x43')],_0x1a44ec['filters']),_0x2612fa);if(_0x2f1f28[_0xb8c3('0x43')][_0xb8c3('0x4e')]){_0x59a60d[_0xb8c3('0x4f')]=_[_0xb8c3('0x50')](_0x59a60d[_0xb8c3('0x4f')],{'$or':_['map'](_0x2612fa,function(_0x2fce88){if(_0x2fce88[_0xb8c3('0x40')]!==_0xb8c3('0x51')){var _0x122130={};_0x122130[_0x2fce88[_0xb8c3('0x3b')]]={'$like':'%'+_0x2f1f28[_0xb8c3('0x43')][_0xb8c3('0x4e')]+'%'};return _0x122130;}})});}_0x59a60d=_[_0xb8c3('0x50')]({},_0x59a60d,_0x2f1f28[_0xb8c3('0x52')]);var _0x232c0a={'where':_0x59a60d[_0xb8c3('0x4f')]};return db['WhatsappAccount'][_0xb8c3('0x30')](_0x232c0a)['then'](function(_0x397bfb){_0x1b0f01[_0xb8c3('0x30')]=_0x397bfb;if(_0x2f1f28['query'][_0xb8c3('0x53')]){_0x59a60d[_0xb8c3('0x54')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xb8c3('0x55')](_0x59a60d);})[_0xb8c3('0x36')](function(_0x47b350){_0x1b0f01[_0xb8c3('0x56')]=_0x47b350;return _0x1b0f01;})[_0xb8c3('0x36')](respondWithFilteredResult(_0x4e9f78,_0x59a60d))[_0xb8c3('0x57')](handleError(_0x4e9f78,null));};exports[_0xb8c3('0x58')]=function(_0x1d1382,_0x57e623){var _0x2ac82d={'raw':![],'where':{'id':_0x1d1382[_0xb8c3('0x59')]['id']},'include':[{'model':db[_0xb8c3('0x5a')],'as':_0xb8c3('0x3d')}]},_0x59cd3a={};_0x59cd3a[_0xb8c3('0x42')]=_[_0xb8c3('0x44')](db['WhatsappAccount']['rawAttributes']);_0x59cd3a['query']=_[_0xb8c3('0x44')](_0x1d1382[_0xb8c3('0x43')]);_0x59cd3a[_0xb8c3('0x45')]=_['intersection'](_0x59cd3a['model'],_0x59cd3a[_0xb8c3('0x43')]);_0x2ac82d[_0xb8c3('0x47')]=_[_0xb8c3('0x46')](_0x59cd3a[_0xb8c3('0x42')],qs[_0xb8c3('0x5b')](_0x1d1382[_0xb8c3('0x43')]['fields']));_0x2ac82d[_0xb8c3('0x47')]=_0x2ac82d[_0xb8c3('0x47')][_0xb8c3('0x48')]?_0x2ac82d['attributes']:_0x59cd3a[_0xb8c3('0x42')];if(_0x1d1382[_0xb8c3('0x43')][_0xb8c3('0x53')]){_0x2ac82d['include']=[{'all':!![]}];}_0x2ac82d=_[_0xb8c3('0x50')]({},_0x2ac82d,_0x1d1382['options']);return db[_0xb8c3('0x3e')][_0xb8c3('0x5c')](_0x2ac82d)[_0xb8c3('0x36')](handleEntityNotFound(_0x57e623,null))['then'](respondWithResult(_0x57e623,null))['catch'](handleError(_0x57e623,null));};exports[_0xb8c3('0x5d')]=function(_0x4691a1,_0x15888a){return db[_0xb8c3('0x3e')][_0xb8c3('0x5d')](_0x4691a1[_0xb8c3('0x5e')],{})[_0xb8c3('0x36')](function(_0x292522){var _0x529622=_0x4691a1[_0xb8c3('0x5f')]['get']({'plain':!![]});if(!_0x529622)throw new Error(_0xb8c3('0x60'));if(_0x529622[_0xb8c3('0x61')]===_0xb8c3('0x5f')){var _0x284f89=_0x292522[_0xb8c3('0x62')]({'plain':!![]});var _0x176512='WhatsappAccounts';return db[_0xb8c3('0x63')][_0xb8c3('0x5c')]({'where':{'name':_0x176512,'userProfileId':_0x529622['userProfileId']},'raw':!![]})[_0xb8c3('0x36')](function(_0x4ec3ee){if(_0x4ec3ee&&_0x4ec3ee[_0xb8c3('0x64')]===0x0){return db['UserProfileResource'][_0xb8c3('0x5d')]({'name':_0x284f89[_0xb8c3('0x3b')],'resourceId':_0x284f89['id'],'type':_0x4ec3ee[_0xb8c3('0x3b')],'sectionId':_0x4ec3ee['id']},{})[_0xb8c3('0x36')](function(){return _0x292522;});}else{return _0x292522;}})[_0xb8c3('0x57')](function(_0x39e27f){logger[_0xb8c3('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39e27f);throw _0x39e27f;});}return _0x292522;})[_0xb8c3('0x36')](respondWithResult(_0x15888a,0xc9))[_0xb8c3('0x57')](handleError(_0x15888a,null));};exports['update']=function(_0x2d1d7a,_0x1a5e19){if(_0x2d1d7a['body']['id']){delete _0x2d1d7a['body']['id'];}return db[_0xb8c3('0x3e')]['find']({'where':{'id':_0x2d1d7a[_0xb8c3('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xb8c3('0x3d')}]})[_0xb8c3('0x36')](handleEntityNotFound(_0x1a5e19,null))[_0xb8c3('0x36')](saveUpdates(_0x2d1d7a['body'],null))['then'](respondWithResult(_0x1a5e19,null))[_0xb8c3('0x57')](handleError(_0x1a5e19,null));};exports['destroy']=function(_0x4c0aa7,_0x335612){return db[_0xb8c3('0x3e')][_0xb8c3('0x5c')]({'where':{'id':_0x4c0aa7[_0xb8c3('0x59')]['id']}})[_0xb8c3('0x36')](handleEntityNotFound(_0x335612,null))[_0xb8c3('0x36')](removeEntity(_0x335612,null))[_0xb8c3('0x57')](handleError(_0x335612,null));};exports[_0xb8c3('0x65')]=function(_0x1b968b,_0x334805){return db[_0xb8c3('0x3e')][_0xb8c3('0x65')]()['then'](respondWithResult(_0x334805,null))[_0xb8c3('0x57')](handleError(_0x334805,null));};exports[_0xb8c3('0x66')]=function(_0x34c6fc,_0x43acb2,_0x553841){if(_0x34c6fc[_0xb8c3('0x5e')]['id']){delete _0x34c6fc[_0xb8c3('0x5e')]['id'];}return db[_0xb8c3('0x3e')][_0xb8c3('0x5c')]({'where':{'id':_0x34c6fc['params']['id']}})[_0xb8c3('0x36')](handleEntityNotFound(_0x43acb2,null))[_0xb8c3('0x36')](function(_0x5cedc7){if(_0x5cedc7){_0x34c6fc[_0xb8c3('0x5e')]['WhatsappAccountId']=_0x5cedc7['id'];return db[_0xb8c3('0x67')][_0xb8c3('0x5d')](_0x34c6fc['body']);}})[_0xb8c3('0x36')](respondWithResult(_0x43acb2,null))[_0xb8c3('0x57')](handleError(_0x43acb2,null));};exports[_0xb8c3('0x68')]=function(_0x1d3cae,_0x17fe26,_0x2b42ae){var _0xaf3ae4={'raw':![],'where':{}};var _0xc263c={};var _0x5babc6={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xb8c3('0x69')]({'where':{'id':_0x1d3cae['params']['id']}})[_0xb8c3('0x36')](handleEntityNotFound(_0x17fe26,null))['then'](function(_0x2534f6){if(_0x2534f6){_0xc263c[_0xb8c3('0x42')]=_[_0xb8c3('0x44')](db['Disposition']['rawAttributes']);_0xc263c[_0xb8c3('0x43')]=_[_0xb8c3('0x44')](_0x1d3cae[_0xb8c3('0x43')]);_0xc263c['filters']=_[_0xb8c3('0x46')](_0xc263c[_0xb8c3('0x42')],_0xc263c[_0xb8c3('0x43')]);_0xaf3ae4[_0xb8c3('0x47')]=_[_0xb8c3('0x46')](_0xc263c[_0xb8c3('0x42')],qs[_0xb8c3('0x5b')](_0x1d3cae[_0xb8c3('0x43')][_0xb8c3('0x5b')]));_0xaf3ae4[_0xb8c3('0x47')]=_0xaf3ae4['attributes'][_0xb8c3('0x48')]?_0xaf3ae4[_0xb8c3('0x47')]:_0xc263c[_0xb8c3('0x42')];if(!_0x1d3cae[_0xb8c3('0x43')]['hasOwnProperty'](_0xb8c3('0x4a'))){_0xaf3ae4[_0xb8c3('0x2f')]=qs[_0xb8c3('0x2f')](_0x1d3cae[_0xb8c3('0x43')][_0xb8c3('0x2f')]);_0xaf3ae4[_0xb8c3('0x31')]=qs[_0xb8c3('0x31')](_0x1d3cae[_0xb8c3('0x43')][_0xb8c3('0x31')]);}_0xaf3ae4[_0xb8c3('0x4b')]=qs['sort'](_0x1d3cae[_0xb8c3('0x43')]['sort']);_0xaf3ae4[_0xb8c3('0x4f')]=qs[_0xb8c3('0x45')](_['pick'](_0x1d3cae[_0xb8c3('0x43')],_0xc263c[_0xb8c3('0x45')]));_0xaf3ae4[_0xb8c3('0x4f')][_0xb8c3('0x6a')]=_0x2534f6['id'];if(_0x1d3cae[_0xb8c3('0x43')][_0xb8c3('0x4e')]){_0xaf3ae4[_0xb8c3('0x4f')]=_['merge'](_0xaf3ae4['where'],{'$or':_[_0xb8c3('0x6b')](_0xaf3ae4[_0xb8c3('0x47')],function(_0xf50bc){var _0x53be3d={};_0x53be3d[_0xf50bc]={'$like':'%'+_0x1d3cae['query']['filter']+'%'};return _0x53be3d;})});}_0xaf3ae4=_[_0xb8c3('0x50')]({},_0xaf3ae4,_0x1d3cae['options']);return db[_0xb8c3('0x67')][_0xb8c3('0x30')]({'where':_0xaf3ae4[_0xb8c3('0x4f')]})[_0xb8c3('0x36')](function(_0x5b0d60){_0x5babc6[_0xb8c3('0x30')]=_0x5b0d60;if(_0x1d3cae[_0xb8c3('0x43')][_0xb8c3('0x53')]){_0xaf3ae4['include']=[{'all':!![]}];}return db[_0xb8c3('0x67')][_0xb8c3('0x55')](_0xaf3ae4);})[_0xb8c3('0x36')](function(_0x235a9e){_0x5babc6[_0xb8c3('0x56')]=_0x235a9e;return _0x5babc6;});}})['then'](respondWithFilteredResult(_0x17fe26,_0xaf3ae4))[_0xb8c3('0x57')](handleError(_0x17fe26,null));};exports[_0xb8c3('0x6c')]=function(_0x4b57e4,_0x269dc8,_0x2232dc){return db['WhatsappAccount']['find']({'where':{'id':_0x4b57e4[_0xb8c3('0x59')]['id']}})[_0xb8c3('0x36')](handleEntityNotFound(_0x269dc8,null))[_0xb8c3('0x36')](function(_0xbc07e1){if(_0xbc07e1){return _0xbc07e1[_0xb8c3('0x6c')](_0x4b57e4[_0xb8c3('0x43')][_0xb8c3('0x6d')]);}})[_0xb8c3('0x36')](respondWithStatusCode(_0x269dc8,null))[_0xb8c3('0x57')](handleError(_0x269dc8,null));};exports[_0xb8c3('0x6e')]=function(_0x8ee0da,_0x3ce21c,_0xc3499b){if(_0x8ee0da['body']['id']){delete _0x8ee0da[_0xb8c3('0x5e')]['id'];}return db[_0xb8c3('0x3e')][_0xb8c3('0x5c')]({'where':{'id':_0x8ee0da[_0xb8c3('0x59')]['id']}})['then'](handleEntityNotFound(_0x3ce21c,null))[_0xb8c3('0x36')](function(_0x2f9fa0){if(_0x2f9fa0){_0x8ee0da['body'][_0xb8c3('0x6a')]=_0x2f9fa0['id'];return db[_0xb8c3('0x6f')][_0xb8c3('0x5d')](_0x8ee0da[_0xb8c3('0x5e')]);}})[_0xb8c3('0x36')](respondWithResult(_0x3ce21c,null))[_0xb8c3('0x57')](handleError(_0x3ce21c,null));};exports['getAnswers']=function(_0x3f8c06,_0xd13bc1,_0x427040){var _0x452a82={'raw':![],'where':{}};var _0x5b6af7={};var _0x119ed1={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x3f8c06[_0xb8c3('0x59')]['id']}})['then'](handleEntityNotFound(_0xd13bc1,null))[_0xb8c3('0x36')](function(_0xdd7913){if(_0xdd7913){_0x5b6af7[_0xb8c3('0x42')]=_['keys'](db[_0xb8c3('0x6f')]['rawAttributes']);_0x5b6af7[_0xb8c3('0x43')]=_['keys'](_0x3f8c06[_0xb8c3('0x43')]);_0x5b6af7[_0xb8c3('0x45')]=_['intersection'](_0x5b6af7[_0xb8c3('0x42')],_0x5b6af7[_0xb8c3('0x43')]);_0x452a82['attributes']=_[_0xb8c3('0x46')](_0x5b6af7[_0xb8c3('0x42')],qs[_0xb8c3('0x5b')](_0x3f8c06[_0xb8c3('0x43')][_0xb8c3('0x5b')]));_0x452a82[_0xb8c3('0x47')]=_0x452a82[_0xb8c3('0x47')][_0xb8c3('0x48')]?_0x452a82['attributes']:_0x5b6af7['model'];if(!_0x3f8c06['query'][_0xb8c3('0x49')](_0xb8c3('0x4a'))){_0x452a82[_0xb8c3('0x2f')]=qs[_0xb8c3('0x2f')](_0x3f8c06[_0xb8c3('0x43')]['limit']);_0x452a82[_0xb8c3('0x31')]=qs[_0xb8c3('0x31')](_0x3f8c06['query'][_0xb8c3('0x31')]);}_0x452a82[_0xb8c3('0x4b')]=qs['sort'](_0x3f8c06[_0xb8c3('0x43')][_0xb8c3('0x4c')]);_0x452a82[_0xb8c3('0x4f')]=qs['filters'](_[_0xb8c3('0x4d')](_0x3f8c06[_0xb8c3('0x43')],_0x5b6af7['filters']));_0x452a82['where'][_0xb8c3('0x6a')]=_0xdd7913['id'];if(_0x3f8c06[_0xb8c3('0x43')]['filter']){_0x452a82[_0xb8c3('0x4f')]=_['merge'](_0x452a82[_0xb8c3('0x4f')],{'$or':_[_0xb8c3('0x6b')](_0x452a82[_0xb8c3('0x47')],function(_0x1785d7){var _0x433342={};_0x433342[_0x1785d7]={'$like':'%'+_0x3f8c06[_0xb8c3('0x43')]['filter']+'%'};return _0x433342;})});}_0x452a82=_[_0xb8c3('0x50')]({},_0x452a82,_0x3f8c06[_0xb8c3('0x52')]);return db['CannedAnswer'][_0xb8c3('0x30')]({'where':_0x452a82[_0xb8c3('0x4f')]})[_0xb8c3('0x36')](function(_0x2b9463){_0x119ed1[_0xb8c3('0x30')]=_0x2b9463;if(_0x3f8c06[_0xb8c3('0x43')][_0xb8c3('0x53')]){_0x452a82[_0xb8c3('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb8c3('0x55')](_0x452a82);})['then'](function(_0x1c9358){_0x119ed1[_0xb8c3('0x56')]=_0x1c9358;return _0x119ed1;});}})['then'](respondWithFilteredResult(_0xd13bc1,_0x452a82))[_0xb8c3('0x57')](handleError(_0xd13bc1,null));};exports[_0xb8c3('0x70')]=function(_0x306f37,_0x40e91c,_0x11c915){return db[_0xb8c3('0x3e')][_0xb8c3('0x5c')]({'where':{'id':_0x306f37['params']['id']}})[_0xb8c3('0x36')](handleEntityNotFound(_0x40e91c,null))[_0xb8c3('0x36')](function(_0x380839){if(_0x380839){return _0x380839['removeAnswers'](_0x306f37[_0xb8c3('0x43')][_0xb8c3('0x6d')]);}})['then'](respondWithStatusCode(_0x40e91c,null))[_0xb8c3('0x57')](handleError(_0x40e91c,null));};exports[_0xb8c3('0x71')]=function(_0x41aeef,_0x569aae,_0x394a51){return db[_0xb8c3('0x3e')][_0xb8c3('0x5c')]({'where':{'id':_0x41aeef[_0xb8c3('0x59')]['id']}})[_0xb8c3('0x36')](handleEntityNotFound(_0x569aae,null))[_0xb8c3('0x36')](function(_0x44780b){if(_0x44780b){return _0x44780b[_0xb8c3('0x71')](_0x41aeef[_0xb8c3('0x5e')][_0xb8c3('0x6d')],_[_0xb8c3('0x72')](_0x41aeef[_0xb8c3('0x5e')],[_0xb8c3('0x6d'),'id'])||{})[_0xb8c3('0x73')](function(_0xe87fbc){for(var _0x52edd3=0x0;_0x52edd3<_0x41aeef[_0xb8c3('0x5e')][_0xb8c3('0x6d')][_0xb8c3('0x48')];_0x52edd3+=0x1){socket[_0xb8c3('0x74')](_0xb8c3('0x75'),{'UserId':Number(_0x41aeef[_0xb8c3('0x5e')][_0xb8c3('0x6d')][_0x52edd3]),'WhatsappAccountId':Number(_0x41aeef[_0xb8c3('0x59')]['id'])});}return _0xe87fbc;});}})[_0xb8c3('0x36')](respondWithResult(_0x569aae,null))['catch'](handleError(_0x569aae,null));};exports['removeAgents']=function(_0x325b35,_0x59263f,_0x226218){return db[_0xb8c3('0x3e')][_0xb8c3('0x5c')]({'where':{'id':_0x325b35[_0xb8c3('0x59')]['id']}})[_0xb8c3('0x36')](handleEntityNotFound(_0x59263f,null))[_0xb8c3('0x36')](function(_0xcd8d25){if(_0xcd8d25){return _0xcd8d25[_0xb8c3('0x76')](_0x325b35[_0xb8c3('0x43')]['ids'])[_0xb8c3('0x36')](function(){if(_['isArray'](_0x325b35['query'][_0xb8c3('0x6d')])){for(var _0x1bcd88=0x0;_0x1bcd88<_0x325b35['query'][_0xb8c3('0x6d')]['length'];_0x1bcd88+=0x1){socket[_0xb8c3('0x74')](_0xb8c3('0x77'),{'UserId':Number(_0x325b35['query'][_0xb8c3('0x6d')][_0x1bcd88]),'WhatsappAccountId':Number(_0x325b35[_0xb8c3('0x59')]['id'])});}}else{socket[_0xb8c3('0x74')](_0xb8c3('0x77'),{'UserId':Number(_0x325b35[_0xb8c3('0x43')][_0xb8c3('0x6d')]),'WhatsappAccountId':Number(_0x325b35[_0xb8c3('0x59')]['id'])});}});}})[_0xb8c3('0x36')](respondWithStatusCode(_0x59263f,null))[_0xb8c3('0x57')](handleError(_0x59263f,null));};exports[_0xb8c3('0x78')]=function(_0x990c1e,_0xa95acf,_0x543708){var _0x451c47={};var _0xba4549={};var _0x48345d;var _0x267125;return db[_0xb8c3('0x3e')][_0xb8c3('0x69')]({'where':{'id':_0x990c1e[_0xb8c3('0x59')]['id']}})[_0xb8c3('0x36')](handleEntityNotFound(_0xa95acf,null))['then'](function(_0x2c7913){if(_0x2c7913){_0x48345d=_0x2c7913;_0xba4549[_0xb8c3('0x42')]=_['keys'](db[_0xb8c3('0x79')]['rawAttributes']);_0xba4549[_0xb8c3('0x43')]=_[_0xb8c3('0x44')](_0x990c1e[_0xb8c3('0x43')]);_0xba4549[_0xb8c3('0x45')]=_[_0xb8c3('0x46')](_0xba4549[_0xb8c3('0x42')],_0xba4549[_0xb8c3('0x43')]);_0x451c47['attributes']=_['intersection'](_0xba4549['model'],qs[_0xb8c3('0x5b')](_0x990c1e[_0xb8c3('0x43')][_0xb8c3('0x5b')]));_0x451c47[_0xb8c3('0x47')]=_0x451c47['attributes'][_0xb8c3('0x48')]?_0x451c47['attributes']:_0xba4549[_0xb8c3('0x42')];_0x451c47[_0xb8c3('0x4b')]=qs[_0xb8c3('0x4c')](_0x990c1e[_0xb8c3('0x43')][_0xb8c3('0x4c')]);_0x451c47[_0xb8c3('0x4f')]=qs[_0xb8c3('0x45')](_[_0xb8c3('0x4d')](_0x990c1e['query'],_0xba4549[_0xb8c3('0x45')]));if(_0x990c1e[_0xb8c3('0x43')][_0xb8c3('0x4e')]){_0x451c47[_0xb8c3('0x4f')]=_[_0xb8c3('0x50')](_0x451c47[_0xb8c3('0x4f')],{'$or':_[_0xb8c3('0x6b')](_0x451c47[_0xb8c3('0x47')],function(_0x50e9e7){var _0x594c48={};_0x594c48[_0x50e9e7]={'$like':'%'+_0x990c1e[_0xb8c3('0x43')][_0xb8c3('0x4e')]+'%'};return _0x594c48;})});}_0x451c47=_[_0xb8c3('0x50')]({},_0x451c47,_0x990c1e['options']);return _0x48345d['getAgents'](_0x451c47);}})[_0xb8c3('0x36')](function(_0x3b6b69){if(_0x3b6b69){_0x267125=_0x3b6b69[_0xb8c3('0x48')];if(!_0x990c1e['query'][_0xb8c3('0x49')](_0xb8c3('0x4a'))){_0x451c47[_0xb8c3('0x2f')]=qs[_0xb8c3('0x2f')](_0x990c1e[_0xb8c3('0x43')][_0xb8c3('0x2f')]);_0x451c47[_0xb8c3('0x31')]=qs[_0xb8c3('0x31')](_0x990c1e[_0xb8c3('0x43')]['offset']);}return _0x48345d[_0xb8c3('0x78')](_0x451c47);}})['then'](function(_0x4e156a){if(_0x4e156a){return _0x4e156a?{'count':_0x267125,'rows':_0x4e156a}:null;}})[_0xb8c3('0x36')](respondWithResult(_0xa95acf,null))[_0xb8c3('0x57')](handleError(_0xa95acf,null));};exports[_0xb8c3('0x7a')]=function(_0x5f0a6a,_0x3ff9bf){var _0x4039e2=_0x5f0a6a['params']['id'];var _0x2d7dfa=_0x5f0a6a['body'];var _0x2e96fd=0xc8;var _0x47d555=null;return db['sequelize'][_0xb8c3('0x7b')]({'isolationLevel':db[_0xb8c3('0x7c')][_0xb8c3('0x7d')][_0xb8c3('0x7e')][_0xb8c3('0x7f')]},function(_0x7f7265){return db[_0xb8c3('0x3e')][_0xb8c3('0x69')]({'where':{'id':_0x4039e2},'transaction':_0x7f7265})['then'](function(_0x5be89c){if(_0x5be89c){return db[_0xb8c3('0x80')][_0xb8c3('0x37')]({'where':{'WhatsappAccountId':_0x4039e2},'transaction':_0x7f7265})[_0xb8c3('0x36')](function(){var _0x662bad=_[_0xb8c3('0x6b')](_0x2d7dfa,function(_0x2be5d0){_0x2be5d0[_0xb8c3('0x6a')]=_0x4039e2;return _0x2be5d0;});return db['WhatsappApplication'][_0xb8c3('0x81')](_0x662bad,{'transaction':_0x7f7265});});}else{_0x2e96fd=0x194;_0x47d555=[];}});})[_0xb8c3('0x36')](function(){if(_0x2e96fd!==0x194){return db[_0xb8c3('0x80')][_0xb8c3('0x82')]({'where':{'WhatsappAccountId':_0x4039e2},'order':_0xb8c3('0x83')})[_0xb8c3('0x36')](function(_0x46582b){_0x47d555=_0x46582b;});}})[_0xb8c3('0x57')](function(_0x4a5c79){_0x2e96fd=0x1f4;logger[_0xb8c3('0x25')](_0x4a5c79[_0xb8c3('0x3a')]);if(_0x4a5c79['name']){delete _0x4a5c79[_0xb8c3('0x3b')];}_0x47d555=_0x4a5c79;})[_0xb8c3('0x84')](function(){if(_0x47d555===null){_0x3ff9bf[_0xb8c3('0x2b')](_0x2e96fd);}else{if(_0x2e96fd===0x1f4){_0x3ff9bf[_0xb8c3('0x2c')](_0x2e96fd)[_0xb8c3('0x85')](_0x47d555);}else{_0x3ff9bf[_0xb8c3('0x2c')](_0x2e96fd)[_0xb8c3('0x2e')](_0x47d555);}}});};exports[_0xb8c3('0x86')]=function(_0x5b1a88,_0x491c4f,_0x3629a6){var _0x5dccc3={};var _0x2feeec={};var _0x3afb95;var _0x414987;return db[_0xb8c3('0x3e')][_0xb8c3('0x69')]({'where':{'id':_0x5b1a88['params']['id']}})[_0xb8c3('0x36')](handleEntityNotFound(_0x491c4f,null))[_0xb8c3('0x36')](function(_0x13329c){if(_0x13329c){_0x3afb95=_0x13329c;_0x2feeec[_0xb8c3('0x42')]=_[_0xb8c3('0x44')](db[_0xb8c3('0x80')][_0xb8c3('0x3f')]);_0x2feeec['query']=_['keys'](_0x5b1a88[_0xb8c3('0x43')]);_0x2feeec[_0xb8c3('0x45')]=_[_0xb8c3('0x46')](_0x2feeec[_0xb8c3('0x42')],_0x2feeec[_0xb8c3('0x43')]);_0x5dccc3[_0xb8c3('0x47')]=_[_0xb8c3('0x46')](_0x2feeec[_0xb8c3('0x42')],qs[_0xb8c3('0x5b')](_0x5b1a88[_0xb8c3('0x43')][_0xb8c3('0x5b')]));_0x5dccc3['attributes']=_0x5dccc3[_0xb8c3('0x47')][_0xb8c3('0x48')]?_0x5dccc3[_0xb8c3('0x47')]:_0x2feeec[_0xb8c3('0x42')];_0x5dccc3[_0xb8c3('0x4b')]=qs[_0xb8c3('0x4c')](_0x5b1a88[_0xb8c3('0x43')]['sort']);_0x5dccc3['where']=qs[_0xb8c3('0x45')](_[_0xb8c3('0x4d')](_0x5b1a88['query'],_0x2feeec[_0xb8c3('0x45')]));if(_0x5b1a88[_0xb8c3('0x43')]['filter']){_0x5dccc3['where']=_[_0xb8c3('0x50')](_0x5dccc3[_0xb8c3('0x4f')],{'$or':_[_0xb8c3('0x6b')](_0x5dccc3[_0xb8c3('0x47')],function(_0x14a802){var _0x283e96={};_0x283e96[_0x14a802]={'$like':'%'+_0x5b1a88[_0xb8c3('0x43')]['filter']+'%'};return _0x283e96;})});}_0x5dccc3=_['merge']({},_0x5dccc3,_0x5b1a88[_0xb8c3('0x52')]);return _0x3afb95['getApplications'](_0x5dccc3);}})[_0xb8c3('0x36')](function(_0x48042d){if(_0x48042d){_0x414987=_0x48042d[_0xb8c3('0x48')];if(!_0x5b1a88['query'][_0xb8c3('0x49')]('nolimit')){_0x5dccc3[_0xb8c3('0x2f')]=qs[_0xb8c3('0x2f')](_0x5b1a88[_0xb8c3('0x43')][_0xb8c3('0x2f')]);_0x5dccc3[_0xb8c3('0x31')]=qs[_0xb8c3('0x31')](_0x5b1a88[_0xb8c3('0x43')][_0xb8c3('0x31')]);}return _0x3afb95[_0xb8c3('0x86')](_0x5dccc3);}})[_0xb8c3('0x36')](function(_0x2e1379){if(_0x2e1379){return _0x2e1379?{'count':_0x414987,'rows':_0x2e1379}:null;}})[_0xb8c3('0x36')](respondWithResult(_0x491c4f,null))[_0xb8c3('0x57')](handleError(_0x491c4f,null));};exports[_0xb8c3('0x87')]=function(_0x9e4e4a,_0x228cf8,_0x5570ca){var _0x452812={'channel':'whatsapp'};var _0x3ab6ed=[];var _0x4a0811=[];var _0x38811f={};return db['WhatsappAccount']['find']({'where':{'id':_0x9e4e4a[_0xb8c3('0x59')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xb8c3('0x88')}]})[_0xb8c3('0x36')](handleEntityNotFound(_0x228cf8,null))[_0xb8c3('0x36')](function(_0x1dd4d6){_0x452812['account']=_0x1dd4d6;if(_0x452812[_0xb8c3('0x89')]&&_0x452812[_0xb8c3('0x89')][_0xb8c3('0x40')]===_0xb8c3('0x8a')&&_0x9e4e4a[_0xb8c3('0x5e')][_0xb8c3('0x8b')]){if(_0x9e4e4a[_0xb8c3('0x5e')][_0xb8c3('0x8b')][_0xb8c3('0x48')]===0x0)return;if(_0x9e4e4a[_0xb8c3('0x5e')][_0xb8c3('0x8b')][0x0][_0xb8c3('0x8c')]!==_0xb8c3('0x8d'))return;return db[_0xb8c3('0x8e')]['update']({'read':!![],'readAt':_0x9e4e4a[_0xb8c3('0x5e')][_0xb8c3('0x8b')][0x0]['timestamp']},{'where':{'messageId':_0x9e4e4a[_0xb8c3('0x5e')]['statuses'][0x0][_0xb8c3('0x8f')]},'individualHooks':!![]})[_0xb8c3('0x36')](function(_0x181bd6){return _0x228cf8[_0xb8c3('0x2c')](0xc8)[_0xb8c3('0x2e')](_0x181bd6);});}_0x452812[_0xb8c3('0x90')]=_[_0xb8c3('0x91')](_0x1dd4d6[_0xb8c3('0x88')],['priority'],['asc']);if(_0x452812['account'][_0xb8c3('0x88')]){delete _0x452812['account'][_0xb8c3('0x88')];}return db[_0xb8c3('0x92')][_0xb8c3('0x65')]()[_0xb8c3('0x36')](function(_0x4d04da){if(!_0x4d04da){throw new db[(_0xb8c3('0x93'))][(_0xb8c3('0x94'))](_0xb8c3('0x95'));}_0x3ab6ed=_[_0xb8c3('0x96')](_[_0xb8c3('0x44')](_0x4d04da),[_0xb8c3('0x97'),_0xb8c3('0x98')]);_0x4a0811=_[_0xb8c3('0x96')](_[_0xb8c3('0x44')](_0x4d04da),[_0xb8c3('0x97'),_0xb8c3('0x98'),_0xb8c3('0x99'),_0xb8c3('0x9a')]);_0x452812[_0xb8c3('0x5e')]={'mapKey':_0xb8c3('0x9b')};if(_0x452812['account']&&_0x452812[_0xb8c3('0x89')]['type']===_0xb8c3('0x9c')){_0x452812[_0xb8c3('0x5e')][_0xb8c3('0x9d')]=_0x9e4e4a[_0xb8c3('0x5e')][_0xb8c3('0x9e')][_0xb8c3('0x9f')](_0xb8c3('0xa0'),'');_0x452812['body']['body']=_0x9e4e4a[_0xb8c3('0x5e')]['Body'];_0x452812[_0xb8c3('0x5e')][_0xb8c3('0xa1')]=_0x9e4e4a['body'][_0xb8c3('0xa2')];}if(_0x452812['account']&&_0x452812[_0xb8c3('0x89')][_0xb8c3('0x40')]===_0xb8c3('0x8a')){_0x452812[_0xb8c3('0x5e')][_0xb8c3('0x9d')]=_0x9e4e4a['body'][_0xb8c3('0xa3')][0x0]['from'];_0x452812[_0xb8c3('0x5e')][_0xb8c3('0x5e')]=_0x9e4e4a[_0xb8c3('0x5e')]['notifications'][0x0][_0xb8c3('0x27')][_0xb8c3('0x5e')];_0x452812[_0xb8c3('0x5e')][_0xb8c3('0xa1')]=_0x9e4e4a[_0xb8c3('0x5e')][_0xb8c3('0xa3')][0x0]['message_id'];}if(_0x452812['body']['id']){delete _0x452812['body']['id'];}if(_['isNil'](_0x452812[_0xb8c3('0x5e')][_0xb8c3('0x9d')])){throw new db[(_0xb8c3('0x93'))][(_0xb8c3('0x94'))]('from\x20is\x20mandatory');}if(_[_0xb8c3('0xa4')](_0x452812['body'][_0xb8c3('0x5e')])||_0x452812['body'][_0xb8c3('0x5e')]===''){throw new db['Sequelize'][(_0xb8c3('0x94'))](_0xb8c3('0xa5'));}if(_[_0xb8c3('0xa4')](_0x452812[_0xb8c3('0x5e')][_0xb8c3('0xa6')])){throw new db[(_0xb8c3('0x93'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4a0811);}if(!_['includes'](_0x4a0811,_0x452812[_0xb8c3('0x5e')][_0xb8c3('0xa6')])){throw new db['Sequelize']['ValidationError'](_0xb8c3('0xa7')+_0x4a0811);}_0x38811f[_0x452812[_0xb8c3('0x5e')][_0xb8c3('0xa6')]]=_0x452812['body']['from'];return db['CmList'][_0xb8c3('0x5c')]({'where':{'id':_0x452812[_0xb8c3('0x89')]['ListId']},'include':[{'model':db[_0xb8c3('0x92')],'as':_0xb8c3('0xa8'),'where':_0x38811f,'limit':0x1,'order':[[_0xb8c3('0x98'),_0xb8c3('0xa9')]]}]});})[_0xb8c3('0x36')](handleEntityNotFound(_0x228cf8,null))['then'](function(_0x398418){if(_0x398418){_0x452812[_0xb8c3('0xaa')]=_['omit'](_0x398418,[_0xb8c3('0xa8')]);if(_0x398418[_0xb8c3('0xa8')]['length']){return _0x398418['Contacts'][0x0];}var _0x4abd43=_['defaults'](_0x452812['body'],{'firstName':_0x452812[_0xb8c3('0x5e')][_0xb8c3('0x9d')],'ListId':_0x398418['id']});_0x4abd43[_0x452812[_0xb8c3('0x5e')][_0xb8c3('0xa6')]]=_0x452812[_0xb8c3('0x5e')]['from'];return db['CmContact'][_0xb8c3('0x5d')](_0x4abd43,{'fields':_0x3ab6ed,'raw':!![]});}})[_0xb8c3('0x36')](handleEntityNotFound(_0x228cf8,null))[_0xb8c3('0x36')](function(_0xf6cb85){if(_0xf6cb85){_0x452812[_0xb8c3('0xab')]=_0xf6cb85;var _0x56b94e={'ContactId':_0xf6cb85['id'],'phone':_0x452812[_0xb8c3('0x5e')][_0xb8c3('0x9d')],'WhatsappAccountId':_0x9e4e4a[_0xb8c3('0x59')]['id']};var _0x24d29c={'ContactId':_0xf6cb85['id'],'WhatsappAccountId':_0x9e4e4a[_0xb8c3('0x59')]['id'],'closed':![]};return db[_0xb8c3('0xac')][_0xb8c3('0x5c')]({'where':_0x24d29c})[_0xb8c3('0x36')](function(_0x35f4c4){if(_0x35f4c4){return[_0x35f4c4,![]];}return db[_0xb8c3('0xac')][_0xb8c3('0x5d')](_0x56b94e)[_0xb8c3('0x36')](function(_0x119dcf){return[_0x119dcf,!![]];});});}})['spread'](function(_0x3839d1,_0x588b7c){_0x452812['interaction']=_0x3839d1['get']({'plain':!![]});_0x452812['interaction'][_0xb8c3('0xad')]=![];if(_0x588b7c){if(_0x452812['account'][_0xb8c3('0xae')]){_0x452812[_0xb8c3('0x90')]['push']({'id':0x0,'priority':_0x452812[_0xb8c3('0x90')]['length']+0x1,'app':_0xb8c3('0xaf'),'appdata':_0xb8c3('0xb0'),'interval':_0xb8c3('0xb1')});}_0x452812['interaction'][_0xb8c3('0xad')]=!![];}return db[_0xb8c3('0x8e')][_0xb8c3('0x5d')]({'phone':_0x452812[_0xb8c3('0x5e')][_0xb8c3('0x9d')],'messageId':_0x452812[_0xb8c3('0x5e')][_0xb8c3('0xa1')],'body':_0x452812['body'][_0xb8c3('0x5e')],'WhatsappAccountId':_0x9e4e4a['params']['id'],'WhatsappInteractionId':_0x3839d1['id'],'direction':'in','ContactId':_0x3839d1[_0xb8c3('0xb2')],'AttachmentId':_0x452812[_0xb8c3('0x5e')][_0xb8c3('0xb3')]});})[_0xb8c3('0x36')](function(_0x589311){_0x452812[_0xb8c3('0x27')]=_0x589311;if(_0x452812[_0xb8c3('0xb4')]['UserId']){return db[_0xb8c3('0x79')][_0xb8c3('0x5c')]({'attributes':['id',_0xb8c3('0x3b')],'where':{'id':_0x452812['interaction'][_0xb8c3('0xb5')]}})[_0xb8c3('0x36')](function(_0x5b11fe){if(_0x5b11fe){_0x452812[_0xb8c3('0x90')][_0xb8c3('0xb6')]({'id':0x0,'priority':0x0,'app':_0xb8c3('0xb7'),'appdata':_0x5b11fe[_0xb8c3('0x3b')]+','+(_0x452812[_0xb8c3('0x89')][_0xb8c3('0xb8')]||0xa),'interval':_0xb8c3('0xb1')});}return respondWithRpcPromise(_0xb8c3('0xb9'),_0xb8c3('0xba'),_0x452812);});}return respondWithRpcPromise(_0xb8c3('0xb9'),_0xb8c3('0xba'),_0x452812);})[_0xb8c3('0x36')](function(_0x22372d){if(_0x22372d){var _0x23c7d4=0xc8;var _0x43df3c=_0xb8c3('0xbb');logger[_0xb8c3('0x28')](_0xb8c3('0x23'),_0x43df3c,_0x23c7d4,_0xb8c3('0xbc'));logger['debug'](_0xb8c3('0xbd'),_0x43df3c,_0x23c7d4,'entity\x20found',JSON[_0xb8c3('0x24')](_0x22372d));if(_0x452812[_0xb8c3('0x89')][_0xb8c3('0x40')]===_0xb8c3('0x9c')){return _0x228cf8['status'](_0x23c7d4)[_0xb8c3('0x32')]('Content-Type',_0xb8c3('0xbe'))[_0xb8c3('0x85')](_0xb8c3('0xbf'));}else{return _0x228cf8[_0xb8c3('0x2c')](_0x23c7d4)['json'](_0x22372d);}}});})[_0xb8c3('0x57')](handleError(_0x228cf8,null));};exports['send']=function(_0x2b4fdf,_0x697e3e,_0x4184fc){var _0x50bf32,_0x1e6073,_0x588a40;if(_[_0xb8c3('0xa4')](_0x2b4fdf[_0xb8c3('0x5e')][_0xb8c3('0x5e')])||_0x2b4fdf[_0xb8c3('0x5e')][_0xb8c3('0x5e')]===''){throw new db['Sequelize']['ValidationError'](_0xb8c3('0xa5'));}if(_[_0xb8c3('0xa4')](_0x2b4fdf[_0xb8c3('0x5e')]['to'])){throw new db[(_0xb8c3('0x93'))][(_0xb8c3('0x94'))](_0xb8c3('0xc0'));}_0x50bf32=_0x2b4fdf[_0xb8c3('0x5e')]['to'];return db['WhatsappAccount'][_0xb8c3('0x5c')]({'where':{'id':_0x2b4fdf[_0xb8c3('0x59')]['id']},'include':[{'model':db[_0xb8c3('0xc1')],'as':_0xb8c3('0xc2'),'include':[{'model':db[_0xb8c3('0x92')],'as':_0xb8c3('0xa8'),'where':{'mobile':_0x50bf32},'limit':0x1,'order':[['updatedAt',_0xb8c3('0xa9')]]}]}]})[_0xb8c3('0x36')](handleEntityNotFound(_0x697e3e,null))[_0xb8c3('0x36')](function(_0x143fc2){if(_0x143fc2&&_0x143fc2[_0xb8c3('0xc2')]){_0x1e6073=_0x143fc2['get']({'plain':!![]});if(_0x1e6073[_0xb8c3('0xc2')]&&_0x1e6073[_0xb8c3('0xc2')][_0xb8c3('0xa8')][_0xb8c3('0x48')]){return _0x1e6073['List'][_0xb8c3('0xa8')][0x0];}return db[_0xb8c3('0x92')][_0xb8c3('0x5d')](_[_0xb8c3('0x1b')](_0x2b4fdf['body'],{'firstName':_0x50bf32,'mobile':_0x50bf32,'phone':_0x50bf32,'ListId':_0x1e6073[_0xb8c3('0x9a')]}));}})['then'](handleEntityNotFound(_0x697e3e,null))[_0xb8c3('0x36')](function(_0x1ea42c){if(_0x1ea42c){_0x588a40=_0x1ea42c;return db['WhatsappInteraction'][_0xb8c3('0x5c')]({'where':{'ContactId':_0x588a40['id'],'closed':![],'WhatsappAccountId':_0x1e6073['id']}})[_0xb8c3('0x36')](function(_0xc8f2e8){if(_0xc8f2e8){return[_0xc8f2e8,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x2b4fdf[_0xb8c3('0x5f')]['id'],'ContactId':_0x588a40['id'],'WhatsappAccountId':_0x1e6073['id'],'phone':_0x50bf32,'firstMsgDirection':_0xb8c3('0xc3'),'Messages':[_['merge'](_0x2b4fdf[_0xb8c3('0x5e')],{'read':![],'body':_0x2b4fdf[_0xb8c3('0x5e')][_0xb8c3('0x5e')],'phone':_0x50bf32,'WhatsappAccountId':_0x1e6073['id'],'UserId':_0x2b4fdf[_0xb8c3('0x5f')]['id'],'ContactId':_0x588a40['id']})]},{'include':[{'model':db[_0xb8c3('0x8e')],'as':_0xb8c3('0xc4')}]})[_0xb8c3('0x36')](function(_0x399c27){return[_0x399c27,!![]];});});}})[_0xb8c3('0x73')](function(_0x2a7e1b,_0x198619){if(_0x198619){return _0x2a7e1b;}return db['WhatsappMessage'][_0xb8c3('0x5d')](_[_0xb8c3('0x50')](_0x2b4fdf[_0xb8c3('0x5e')],{'read':![],'body':_0x2b4fdf[_0xb8c3('0x5e')]['body'],'phone':_0x50bf32,'WhatsappAccountId':_0x1e6073['id'],'WhatsappInteractionId':_0x2a7e1b['id'],'UserId':_0x2b4fdf[_0xb8c3('0x5f')]['id'],'ContactId':_0x588a40['id']}))[_0xb8c3('0x36')](function(_0x37c435){_0x2a7e1b[_0xb8c3('0xc5')]['Messages']=[];_0x2a7e1b[_0xb8c3('0xc5')][_0xb8c3('0xc4')][_0xb8c3('0xc6')](_0x37c435[_0xb8c3('0xc5')]);return _0x2a7e1b;});})[_0xb8c3('0x36')](respondWithResult(_0x697e3e,null))['catch'](handleError(_0x697e3e,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index df37923..4451ee6 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 _0x9b44=['remove','emit','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0x3da2a5,_0x5c5c70){var _0x57bb9e=function(_0x593581){while(--_0x593581){_0x3da2a5['push'](_0x3da2a5['shift']());}};_0x57bb9e(++_0x5c5c70);}(_0x9b44,0x90));var _0x49b4=function(_0x334fea,_0x1f1e18){_0x334fea=_0x334fea-0x0;var _0x3c5829=_0x9b44[_0x334fea];return _0x3c5829;};'use strict';var EventEmitter=require(_0x49b4('0x0'));var WhatsappAccount=require(_0x49b4('0x1'))['db'][_0x49b4('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x49b4('0x3')](0x0);var events={'afterCreate':_0x49b4('0x4'),'afterUpdate':_0x49b4('0x5'),'afterDestroy':_0x49b4('0x6')};function emitEvent(_0x5d4ad6){return function(_0x183b0b,_0x1defa0,_0x306a8b){WhatsappAccountEvents['emit'](_0x5d4ad6+':'+_0x183b0b['id'],_0x183b0b);WhatsappAccountEvents[_0x49b4('0x7')](_0x5d4ad6,_0x183b0b);_0x306a8b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x49b4('0x8')](e,emitEvent(event));}}module[_0x49b4('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x66c3=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0x66c3,0x197));var _0x366c=function(_0x4a4b22,_0x125c49){_0x4a4b22=_0x4a4b22-0x0;var _0xaec260=_0x66c3[_0x4a4b22];return _0xaec260;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x366c('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x366c('0x1')](0x0);var events={'afterCreate':_0x366c('0x2'),'afterUpdate':'update','afterDestroy':_0x366c('0x3')};function emitEvent(_0x35924c){return function(_0x236623,_0x13d21a,_0x55824c){WhatsappAccountEvents[_0x366c('0x4')](_0x35924c+':'+_0x236623['id'],_0x236623);WhatsappAccountEvents[_0x366c('0x4')](_0x35924c,_0x236623);_0x55824c(null);};}for(var e in events){if(events[_0x366c('0x5')](e)){var event=events[e];WhatsappAccount[_0x366c('0x6')](e,emitEvent(event));}}module[_0x366c('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 5c8bbac..249ad87 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 _0x3e1f=['request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util','../../config/logger','moment'];(function(_0x4ab489,_0x4d389d){var _0x16e07b=function(_0x3bb9b2){while(--_0x3bb9b2){_0x4ab489['push'](_0x4ab489['shift']());}};_0x16e07b(++_0x4d389d);}(_0x3e1f,0x96));var _0xf3e1=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x3e1f[_0x53abe5];return _0xc1c37e;};'use strict';var _=require(_0xf3e1('0x0'));var util=require(_0xf3e1('0x1'));var logger=require(_0xf3e1('0x2'))('api');var moment=require(_0xf3e1('0x3'));var BPromise=require('bluebird');var rp=require(_0xf3e1('0x4'));var fs=require('fs');var path=require(_0xf3e1('0x5'));var rimraf=require('rimraf');var config=require(_0xf3e1('0x6'));var attributes=require(_0xf3e1('0x7'));module[_0xf3e1('0x8')]=function(_0x152ec3,_0x3c2950){return _0x152ec3[_0xf3e1('0x9')]('WhatsappAccount',attributes,{'tableName':_0xf3e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61b1=['whatsapp_accounts','util','api','bluebird','request-promise','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x4bacb6,_0x2b299d){var _0x58c029=function(_0x2faaf5){while(--_0x2faaf5){_0x4bacb6['push'](_0x4bacb6['shift']());}};_0x58c029(++_0x2b299d);}(_0x61b1,0xd9));var _0x161b=function(_0x51b72e,_0x408f4f){_0x51b72e=_0x51b72e-0x0;var _0xa108e1=_0x61b1[_0x51b72e];return _0xa108e1;};'use strict';var _=require('lodash');var util=require(_0x161b('0x0'));var logger=require('../../config/logger')(_0x161b('0x1'));var moment=require('moment');var BPromise=require(_0x161b('0x2'));var rp=require(_0x161b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x161b('0x4'));var attributes=require(_0x161b('0x5'));module[_0x161b('0x6')]=function(_0x23354d,_0xb6f964){return _0x23354d['define']('WhatsappAccount',attributes,{'tableName':_0x161b('0x7'),'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 6bf7152..21cc759 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 _0x7f65=['../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','WhatsappAccount','find','options','where','attributes','include','map','model','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x294e77,_0x1cd2cb){var _0x8d33fe=function(_0x19eb8e){while(--_0x19eb8e){_0x294e77['push'](_0x294e77['shift']());}};_0x8d33fe(++_0x1cd2cb);}(_0x7f65,0x91));var _0x57f6=function(_0xe91770,_0x4f47c4){_0xe91770=_0xe91770-0x0;var _0x33ca30=_0x7f65[_0xe91770];return _0x33ca30;};'use strict';var _=require(_0x57f6('0x0'));var util=require(_0x57f6('0x1'));var moment=require(_0x57f6('0x2'));var BPromise=require(_0x57f6('0x3'));var rs=require(_0x57f6('0x4'));var fs=require('fs');var Redis=require(_0x57f6('0x5'));var db=require(_0x57f6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x57f6('0x7'))('rpc');var config=require(_0x57f6('0x8'));var jayson=require(_0x57f6('0x9'));var client=jayson['client'][_0x57f6('0xa')]({'port':0x232a});config[_0x57f6('0xb')]=_[_0x57f6('0xc')](config[_0x57f6('0xb')],{'host':_0x57f6('0xd'),'port':0x18eb});var socket=require(_0x57f6('0xe'))(new Redis(config[_0x57f6('0xb')]));require(_0x57f6('0xf'))[_0x57f6('0x10')](socket);function respondWithRpcPromise(_0x5e3518,_0x3099b5,_0x375e13){return new BPromise(function(_0x3d9ad1,_0x410ec3){return client[_0x57f6('0x11')](_0x5e3518,_0x375e13)[_0x57f6('0x12')](function(_0x288f65){logger['info'](_0x57f6('0x13'),_0x3099b5,_0x57f6('0x14'));logger[_0x57f6('0x15')](_0x57f6('0x16'),_0x3099b5,_0x57f6('0x14'),JSON[_0x57f6('0x17')](_0x288f65));if(_0x288f65[_0x57f6('0x18')]){if(_0x288f65['error'][_0x57f6('0x19')]===0x1f4){logger['error'](_0x57f6('0x13'),_0x3099b5,_0x288f65['error'][_0x57f6('0x1a')]);return _0x410ec3(_0x288f65[_0x57f6('0x18')][_0x57f6('0x1a')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3099b5,_0x288f65[_0x57f6('0x18')][_0x57f6('0x1a')]);return _0x3d9ad1(_0x288f65[_0x57f6('0x18')][_0x57f6('0x1a')]);}else{logger[_0x57f6('0x1b')](_0x57f6('0x13'),_0x3099b5,_0x57f6('0x14'));_0x3d9ad1(_0x288f65[_0x57f6('0x1c')][_0x57f6('0x1a')]);}})['catch'](function(_0x4da55a){logger[_0x57f6('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x3099b5,_0x4da55a);_0x410ec3(_0x4da55a);});});}exports['ShowWhatsappAccount']=function(_0x3c9c57){var _0xb4ca36=this;return new Promise(function(_0x59b597,_0x27a55c){return db[_0x57f6('0x1d')][_0x57f6('0x1e')]({'raw':_0x3c9c57[_0x57f6('0x1f')]?_0x3c9c57['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c9c57[_0x57f6('0x1f')]?_0x3c9c57['options'][_0x57f6('0x20')]||null:null,'attributes':_0x3c9c57[_0x57f6('0x1f')]?_0x3c9c57[_0x57f6('0x1f')][_0x57f6('0x21')]||null:null,'include':_0x3c9c57[_0x57f6('0x1f')]?_0x3c9c57[_0x57f6('0x1f')][_0x57f6('0x22')]?_[_0x57f6('0x23')](_0x3c9c57['options'][_0x57f6('0x22')],function(_0x11520a){return{'model':db[_0x11520a[_0x57f6('0x24')]],'as':_0x11520a['as'],'attributes':_0x11520a[_0x57f6('0x21')],'include':_0x11520a[_0x57f6('0x22')]?_['map'](_0x11520a[_0x57f6('0x22')],function(_0x474935){return{'model':db[_0x474935[_0x57f6('0x24')]],'as':_0x474935['as'],'attributes':_0x474935[_0x57f6('0x21')],'include':_0x474935[_0x57f6('0x22')]?_['map'](_0x474935[_0x57f6('0x22')],function(_0x399a43){return{'model':db[_0x399a43['model']],'as':_0x399a43['as'],'attributes':_0x399a43['attributes']};}):[]};}):[]};}):[]:[]})[_0x57f6('0x12')](function(_0x46aced){logger[_0x57f6('0x1b')](_0x57f6('0x25'),_0x3c9c57);logger[_0x57f6('0x15')](_0x57f6('0x25'),_0x3c9c57,JSON[_0x57f6('0x17')](_0x46aced));_0x59b597(_0x46aced);})['catch'](function(_0x2cf066){logger[_0x57f6('0x18')](_0x57f6('0x25'),_0x2cf066[_0x57f6('0x1a')],_0x3c9c57);_0x27a55c(_0xb4ca36[_0x57f6('0x18')](0x1f4,_0x2cf066[_0x57f6('0x1a')]));});});}; \ No newline at end of file +var _0x9d02=['map','model','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include'];(function(_0x4a7d10,_0x1d519e){var _0x1b1142=function(_0x18af34){while(--_0x18af34){_0x4a7d10['push'](_0x4a7d10['shift']());}};_0x1b1142(++_0x1d519e);}(_0x9d02,0xe6));var _0x29d0=function(_0xbc9863,_0x5c8cef){_0xbc9863=_0xbc9863-0x0;var _0x13bfa5=_0x9d02[_0xbc9863];return _0x13bfa5;};'use strict';var _=require(_0x29d0('0x0'));var util=require('util');var moment=require(_0x29d0('0x1'));var BPromise=require(_0x29d0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x29d0('0x3'));var db=require(_0x29d0('0x4'))['db'];var utils=require(_0x29d0('0x5'));var logger=require('../../config/logger')(_0x29d0('0x6'));var config=require(_0x29d0('0x7'));var jayson=require(_0x29d0('0x8'));var client=jayson[_0x29d0('0x9')][_0x29d0('0xa')]({'port':0x232a});config[_0x29d0('0xb')]=_[_0x29d0('0xc')](config[_0x29d0('0xb')],{'host':_0x29d0('0xd'),'port':0x18eb});var socket=require(_0x29d0('0xe'))(new Redis(config[_0x29d0('0xb')]));require(_0x29d0('0xf'))[_0x29d0('0x10')](socket);function respondWithRpcPromise(_0x442a09,_0x164ff3,_0x1cea1d){return new BPromise(function(_0x58be18,_0x50d460){return client[_0x29d0('0x11')](_0x442a09,_0x1cea1d)[_0x29d0('0x12')](function(_0x10a0d3){logger[_0x29d0('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x164ff3,_0x29d0('0x14'));logger[_0x29d0('0x15')](_0x29d0('0x16'),_0x164ff3,_0x29d0('0x14'),JSON['stringify'](_0x10a0d3));if(_0x10a0d3[_0x29d0('0x17')]){if(_0x10a0d3[_0x29d0('0x17')][_0x29d0('0x18')]===0x1f4){logger[_0x29d0('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x164ff3,_0x10a0d3['error']['message']);return _0x50d460(_0x10a0d3[_0x29d0('0x17')][_0x29d0('0x19')]);}logger[_0x29d0('0x17')](_0x29d0('0x1a'),_0x164ff3,_0x10a0d3['error']['message']);return _0x58be18(_0x10a0d3['error']['message']);}else{logger[_0x29d0('0x13')](_0x29d0('0x1a'),_0x164ff3,_0x29d0('0x14'));_0x58be18(_0x10a0d3[_0x29d0('0x1b')][_0x29d0('0x19')]);}})[_0x29d0('0x1c')](function(_0x1b8e36){logger['error'](_0x29d0('0x1a'),_0x164ff3,_0x1b8e36);_0x50d460(_0x1b8e36);});});}exports[_0x29d0('0x1d')]=function(_0x5d9bc7){var _0x374af0=this;return new Promise(function(_0x5b90d0,_0x3ec848){return db[_0x29d0('0x1e')][_0x29d0('0x1f')]({'raw':_0x5d9bc7[_0x29d0('0x20')]?_0x5d9bc7[_0x29d0('0x20')][_0x29d0('0x21')]===undefined?!![]:![]:!![],'where':_0x5d9bc7[_0x29d0('0x20')]?_0x5d9bc7[_0x29d0('0x20')]['where']||null:null,'attributes':_0x5d9bc7['options']?_0x5d9bc7[_0x29d0('0x20')][_0x29d0('0x22')]||null:null,'include':_0x5d9bc7[_0x29d0('0x20')]?_0x5d9bc7[_0x29d0('0x20')][_0x29d0('0x23')]?_[_0x29d0('0x24')](_0x5d9bc7[_0x29d0('0x20')]['include'],function(_0x4bd459){return{'model':db[_0x4bd459[_0x29d0('0x25')]],'as':_0x4bd459['as'],'attributes':_0x4bd459[_0x29d0('0x22')],'include':_0x4bd459[_0x29d0('0x23')]?_['map'](_0x4bd459[_0x29d0('0x23')],function(_0x38f3ef){return{'model':db[_0x38f3ef[_0x29d0('0x25')]],'as':_0x38f3ef['as'],'attributes':_0x38f3ef['attributes'],'include':_0x38f3ef['include']?_['map'](_0x38f3ef[_0x29d0('0x23')],function(_0x9d8374){return{'model':db[_0x9d8374['model']],'as':_0x9d8374['as'],'attributes':_0x9d8374[_0x29d0('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b956c){logger[_0x29d0('0x13')](_0x29d0('0x1d'),_0x5d9bc7);logger[_0x29d0('0x15')](_0x29d0('0x1d'),_0x5d9bc7,JSON['stringify'](_0x4b956c));_0x5b90d0(_0x4b956c);})[_0x29d0('0x1c')](function(_0x5aa9a2){logger['error'](_0x29d0('0x1d'),_0x5aa9a2[_0x29d0('0x19')],_0x5d9bc7);_0x3ec848(_0x374af0[_0x29d0('0x17')](0x1f4,_0x5aa9a2[_0x29d0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 26548b6..ad51d7f 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 _0x38fe=['update','emit','removeListener','length','whatsappAccount:','save','remove'];(function(_0x5e9d35,_0x382c91){var _0x3beb2e=function(_0x4242cf){while(--_0x4242cf){_0x5e9d35['push'](_0x5e9d35['shift']());}};_0x3beb2e(++_0x382c91);}(_0x38fe,0xbb));var _0xe38f=function(_0x4a3fdf,_0x3c2c54){_0x4a3fdf=_0x4a3fdf-0x0;var _0x8c4ecc=_0x38fe[_0x4a3fdf];return _0x8c4ecc;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xe38f('0x0'),_0xe38f('0x1'),_0xe38f('0x2')];function createListener(_0x270540,_0x2e8d8a){return function(_0x25153f){_0x2e8d8a[_0xe38f('0x3')](_0x270540,_0x25153f);};}function removeListener(_0x529930,_0x520ebe){return function(){WhatsappAccountEvents[_0xe38f('0x4')](_0x529930,_0x520ebe);};}exports['register']=function(_0x4b7f23){for(var _0x1313ca=0x0,_0xd6424b=events[_0xe38f('0x5')];_0x1313ca<_0xd6424b;_0x1313ca++){var _0x520e78=events[_0x1313ca];var _0x5c5bcd=createListener(_0xe38f('0x6')+_0x520e78,_0x4b7f23);WhatsappAccountEvents['on'](_0x520e78,_0x5c5bcd);}}; \ No newline at end of file +var _0xcd1e=['length','save','update','emit','removeListener','register'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0xcd1e,0xa3));var _0xecd1=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xcd1e[_0x413feb];return _0x40ee88;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xecd1('0x0'),'remove',_0xecd1('0x1')];function createListener(_0x2e1a51,_0x43b0f0){return function(_0x11573a){_0x43b0f0[_0xecd1('0x2')](_0x2e1a51,_0x11573a);};}function removeListener(_0x31120a,_0x2cc462){return function(){WhatsappAccountEvents[_0xecd1('0x3')](_0x31120a,_0x2cc462);};}exports[_0xecd1('0x4')]=function(_0x5dbfa8){for(var _0x3c295c=0x0,_0x4495f4=events[_0xecd1('0x5')];_0x3c295c<_0x4495f4;_0x3c295c++){var _0x1fec9e=events[_0x3c295c];var _0x210bbc=createListener('whatsappAccount:'+_0x1fec9e,_0x5dbfa8);WhatsappAccountEvents['on'](_0x1fec9e,_0x210bbc);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 6eb6fcf..e900473 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 _0x2a70=['isAuthenticated','post','put','/:id','update','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a70,0x1e8));var _0x02a7=function(_0x6c9b2c,_0x2e1e98){_0x6c9b2c=_0x6c9b2c-0x0;var _0x2dbb9c=_0x2a70[_0x6c9b2c];return _0x2dbb9c;};'use strict';var multer=require('multer');var util=require(_0x02a7('0x0'));var path=require('path');var timeout=require(_0x02a7('0x1'));var express=require(_0x02a7('0x2'));var router=express[_0x02a7('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x02a7('0x4'));var config=require(_0x02a7('0x5'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x02a7('0x6')](),controller['index']);router['get']('/:id',auth[_0x02a7('0x6')](),controller['show']);router[_0x02a7('0x7')]('/',auth[_0x02a7('0x6')](),controller['create']);router[_0x02a7('0x8')](_0x02a7('0x9'),auth[_0x02a7('0x6')](),controller[_0x02a7('0xa')]);router[_0x02a7('0xb')](_0x02a7('0x9'),auth[_0x02a7('0x6')](),controller['destroy']);module[_0x02a7('0xc')]=router; \ No newline at end of file +var _0xcb57=['Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x2a6bb3,_0x288bba){var _0x19d246=function(_0x5677e3){while(--_0x5677e3){_0x2a6bb3['push'](_0x2a6bb3['shift']());}};_0x19d246(++_0x288bba);}(_0xcb57,0x140));var _0x7cb5=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xcb57[_0x819464];return _0x49dcc0;};'use strict';var multer=require('multer');var util=require(_0x7cb5('0x0'));var path=require(_0x7cb5('0x1'));var timeout=require(_0x7cb5('0x2'));var express=require(_0x7cb5('0x3'));var router=express[_0x7cb5('0x4')]();var fs_extra=require(_0x7cb5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7cb5('0x6'));var config=require(_0x7cb5('0x7'));var controller=require(_0x7cb5('0x8'));router[_0x7cb5('0x9')]('/',auth[_0x7cb5('0xa')](),controller[_0x7cb5('0xb')]);router['get'](_0x7cb5('0xc'),auth[_0x7cb5('0xa')](),controller['show']);router[_0x7cb5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7cb5('0xe')](_0x7cb5('0xc'),auth[_0x7cb5('0xa')](),controller[_0x7cb5('0xf')]);router['delete'](_0x7cb5('0xc'),auth[_0x7cb5('0xa')](),controller[_0x7cb5('0x10')]);module[_0x7cb5('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 5fae714..cfa6c92 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 _0xa96d=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xa96d,0x66));var _0xda96=function(_0x1b69aa,_0x5aa147){_0x1b69aa=_0x1b69aa-0x0;var _0x42647d=_0xa96d[_0x1b69aa];return _0x42647d;};'use strict';var Sequelize=require(_0xda96('0x0'));module[_0xda96('0x1')]={'priority':{'type':Sequelize[_0xda96('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xda96('0x3')],'allowNull':![],'defaultValue':_0xda96('0x4')},'appdata':{'type':Sequelize[_0xda96('0x5')]()},'description':{'type':Sequelize[_0xda96('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2819=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x381526,_0x358cac){var _0x14c940=function(_0xa7606c){while(--_0xa7606c){_0x381526['push'](_0x381526['shift']());}};_0x14c940(++_0x358cac);}(_0x2819,0x1e1));var _0x9281=function(_0x3f3b4c,_0x4b490e){_0x3f3b4c=_0x3f3b4c-0x0;var _0x49dee8=_0x2819[_0x3f3b4c];return _0x49dee8;};'use strict';var Sequelize=require(_0x9281('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9281('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9281('0x2')],'allowNull':![],'defaultValue':_0x9281('0x3')},'appdata':{'type':Sequelize[_0x9281('0x4')]()},'description':{'type':Sequelize[_0x9281('0x2')]},'interval':{'type':Sequelize[_0x9281('0x2')],'defaultValue':_0x9281('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 13255ad..65c916c 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 _0xd663=['apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','create','body','find','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../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'];(function(_0x36ff98,_0x1b8fc7){var _0x39d4c=function(_0x38ae23){while(--_0x38ae23){_0x36ff98['push'](_0x36ff98['shift']());}};_0x39d4c(++_0x1b8fc7);}(_0xd663,0x1ed));var _0x3d66=function(_0x3505f1,_0x1df74a){_0x3505f1=_0x3505f1-0x0;var _0x36cd16=_0xd663[_0x3505f1];return _0x36cd16;};'use strict';var emlformat=require(_0x3d66('0x0'));var rimraf=require(_0x3d66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d66('0x2'));var rp=require(_0x3d66('0x3'));var moment=require(_0x3d66('0x4'));var BPromise=require(_0x3d66('0x5'));var Mustache=require(_0x3d66('0x6'));var util=require('util');var path=require(_0x3d66('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(_0x3d66('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3d66('0x9'));var deskjs=require(_0x3d66('0xa'));var toCsv=require(_0x3d66('0xb'));var querystring=require(_0x3d66('0xc'));var Papa=require(_0x3d66('0xd'));var Redis=require(_0x3d66('0xe'));var authService=require(_0x3d66('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3d66('0x10'));var hardwareService=require(_0x3d66('0x11'));var logger=require(_0x3d66('0x12'))('api');var utils=require(_0x3d66('0x13'));var config=require(_0x3d66('0x14'));var licenseUtil=require(_0x3d66('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x207712,_0x223de6){_0x223de6=_0x223de6||0xcc;return function(_0x288693){if(_0x288693){return _0x207712[_0x3d66('0x16')](_0x223de6);}return _0x207712['status'](_0x223de6)[_0x3d66('0x17')]();};}function respondWithResult(_0x5a940c,_0x15bba0){_0x15bba0=_0x15bba0||0xc8;return function(_0x290f29){if(_0x290f29){return _0x5a940c[_0x3d66('0x18')](_0x15bba0)[_0x3d66('0x19')](_0x290f29);}};}function respondWithFilteredResult(_0x30260d,_0x153b88){return function(_0x5628ae){if(_0x5628ae){var _0x5eba7e=typeof _0x153b88[_0x3d66('0x1a')]===_0x3d66('0x1b')&&typeof _0x153b88['limit']===_0x3d66('0x1b');var _0x24d137=_0x5628ae[_0x3d66('0x1c')];var _0x1dfd81=_0x5eba7e?0x0:_0x153b88[_0x3d66('0x1a')];var _0x239ffb=_0x5eba7e?_0x5628ae[_0x3d66('0x1c')]:_0x153b88[_0x3d66('0x1a')]+_0x153b88[_0x3d66('0x1d')];var _0x3902f1;if(_0x239ffb>=_0x24d137){_0x239ffb=_0x24d137;_0x3902f1=0xc8;}else{_0x3902f1=0xce;}_0x30260d[_0x3d66('0x18')](_0x3902f1);return _0x30260d[_0x3d66('0x1e')](_0x3d66('0x1f'),_0x1dfd81+'-'+_0x239ffb+'/'+_0x24d137)[_0x3d66('0x19')](_0x5628ae);}return null;};}function patchUpdates(_0x21cfd7){return function(_0x4c61ee){try{jsonpatch[_0x3d66('0x20')](_0x4c61ee,_0x21cfd7,!![]);}catch(_0x5e1516){return BPromise[_0x3d66('0x21')](_0x5e1516);}return _0x4c61ee[_0x3d66('0x22')]();};}function saveUpdates(_0x4486f5,_0x37ed73){return function(_0x11be7f){if(_0x11be7f){return _0x11be7f[_0x3d66('0x23')](_0x4486f5)[_0x3d66('0x24')](function(_0x1bfa81){return _0x1bfa81;});}return null;};}function removeEntity(_0x1eb922,_0x4e2c42){return function(_0x151364){if(_0x151364){return _0x151364[_0x3d66('0x25')]()[_0x3d66('0x24')](function(){_0x1eb922[_0x3d66('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59fe0a,_0x45628b){return function(_0x4302ad){if(!_0x4302ad){_0x59fe0a[_0x3d66('0x16')](0x194);}return _0x4302ad;};}function handleError(_0x4f0d9e,_0x402c4c){_0x402c4c=_0x402c4c||0x1f4;return function(_0x3e6712){logger[_0x3d66('0x26')](_0x3e6712[_0x3d66('0x27')]);if(_0x3e6712[_0x3d66('0x28')]){delete _0x3e6712[_0x3d66('0x28')];}_0x4f0d9e[_0x3d66('0x18')](_0x402c4c)[_0x3d66('0x29')](_0x3e6712);};}exports[_0x3d66('0x2a')]=function(_0x1271bf,_0x54ba13){var _0x28466b={},_0x1dff3b={},_0x197c5e={'count':0x0,'rows':[]};var _0xc128a7=_[_0x3d66('0x2b')](db[_0x3d66('0x2c')][_0x3d66('0x2d')],function(_0xabe382){return{'name':_0xabe382[_0x3d66('0x2e')],'type':_0xabe382[_0x3d66('0x2f')][_0x3d66('0x30')]};});_0x1dff3b['model']=_['map'](_0xc128a7,_0x3d66('0x28'));_0x1dff3b[_0x3d66('0x31')]=_[_0x3d66('0x32')](_0x1271bf[_0x3d66('0x31')]);_0x1dff3b[_0x3d66('0x33')]=_[_0x3d66('0x34')](_0x1dff3b[_0x3d66('0x35')],_0x1dff3b[_0x3d66('0x31')]);_0x28466b[_0x3d66('0x36')]=_[_0x3d66('0x34')](_0x1dff3b[_0x3d66('0x35')],qs[_0x3d66('0x37')](_0x1271bf[_0x3d66('0x31')][_0x3d66('0x37')]));_0x28466b[_0x3d66('0x36')]=_0x28466b[_0x3d66('0x36')][_0x3d66('0x38')]?_0x28466b[_0x3d66('0x36')]:_0x1dff3b[_0x3d66('0x35')];if(!_0x1271bf[_0x3d66('0x31')][_0x3d66('0x39')](_0x3d66('0x3a'))){_0x28466b[_0x3d66('0x1d')]=qs['limit'](_0x1271bf[_0x3d66('0x31')][_0x3d66('0x1d')]);_0x28466b[_0x3d66('0x1a')]=qs['offset'](_0x1271bf[_0x3d66('0x31')]['offset']);}_0x28466b[_0x3d66('0x3b')]=qs[_0x3d66('0x3c')](_0x1271bf['query'][_0x3d66('0x3c')]);_0x28466b[_0x3d66('0x3d')]=qs['filters'](_[_0x3d66('0x3e')](_0x1271bf[_0x3d66('0x31')],_0x1dff3b['filters']),_0xc128a7);if(_0x1271bf[_0x3d66('0x31')][_0x3d66('0x3f')]){_0x28466b[_0x3d66('0x3d')]=_[_0x3d66('0x40')](_0x28466b['where'],{'$or':_[_0x3d66('0x2b')](_0xc128a7,function(_0x58851d){if(_0x58851d[_0x3d66('0x2f')]!=='VIRTUAL'){var _0xc77eb5={};_0xc77eb5[_0x58851d[_0x3d66('0x28')]]={'$like':'%'+_0x1271bf[_0x3d66('0x31')]['filter']+'%'};return _0xc77eb5;}})});}_0x28466b=_[_0x3d66('0x40')]({},_0x28466b,_0x1271bf[_0x3d66('0x41')]);var _0x105726={'where':_0x28466b[_0x3d66('0x3d')]};return db[_0x3d66('0x2c')][_0x3d66('0x1c')](_0x105726)[_0x3d66('0x24')](function(_0x38633f){_0x197c5e[_0x3d66('0x1c')]=_0x38633f;if(_0x1271bf[_0x3d66('0x31')][_0x3d66('0x42')]){_0x28466b[_0x3d66('0x43')]=[{'all':!![]}];}return db[_0x3d66('0x2c')]['findAll'](_0x28466b);})[_0x3d66('0x24')](function(_0x4482a3){_0x197c5e[_0x3d66('0x44')]=_0x4482a3;return _0x197c5e;})['then'](respondWithFilteredResult(_0x54ba13,_0x28466b))['catch'](handleError(_0x54ba13,null));};exports[_0x3d66('0x45')]=function(_0x263e9f,_0x3deb7d){var _0x26350b={'raw':!![],'where':{'id':_0x263e9f[_0x3d66('0x46')]['id']}},_0x283395={};_0x283395[_0x3d66('0x35')]=_[_0x3d66('0x32')](db['WhatsappApplication'][_0x3d66('0x2d')]);_0x283395[_0x3d66('0x31')]=_[_0x3d66('0x32')](_0x263e9f['query']);_0x283395['filters']=_[_0x3d66('0x34')](_0x283395[_0x3d66('0x35')],_0x283395[_0x3d66('0x31')]);_0x26350b[_0x3d66('0x36')]=_[_0x3d66('0x34')](_0x283395[_0x3d66('0x35')],qs[_0x3d66('0x37')](_0x263e9f[_0x3d66('0x31')]['fields']));_0x26350b[_0x3d66('0x36')]=_0x26350b['attributes'][_0x3d66('0x38')]?_0x26350b[_0x3d66('0x36')]:_0x283395[_0x3d66('0x35')];if(_0x263e9f['query'][_0x3d66('0x42')]){_0x26350b[_0x3d66('0x43')]=[{'all':!![]}];}_0x26350b=_[_0x3d66('0x40')]({},_0x26350b,_0x263e9f[_0x3d66('0x41')]);return db['WhatsappApplication']['find'](_0x26350b)[_0x3d66('0x24')](handleEntityNotFound(_0x3deb7d,null))['then'](respondWithResult(_0x3deb7d,null))['catch'](handleError(_0x3deb7d,null));};exports[_0x3d66('0x47')]=function(_0x3c5b6d,_0x32edc2){return db[_0x3d66('0x2c')][_0x3d66('0x47')](_0x3c5b6d[_0x3d66('0x48')],{})[_0x3d66('0x24')](respondWithResult(_0x32edc2,0xc9))['catch'](handleError(_0x32edc2,null));};exports[_0x3d66('0x23')]=function(_0x2e05ce,_0x22c447){if(_0x2e05ce[_0x3d66('0x48')]['id']){delete _0x2e05ce[_0x3d66('0x48')]['id'];}return db['WhatsappApplication'][_0x3d66('0x49')]({'where':{'id':_0x2e05ce[_0x3d66('0x46')]['id']}})[_0x3d66('0x24')](handleEntityNotFound(_0x22c447,null))[_0x3d66('0x24')](saveUpdates(_0x2e05ce[_0x3d66('0x48')],null))[_0x3d66('0x24')](respondWithResult(_0x22c447,null))[_0x3d66('0x4a')](handleError(_0x22c447,null));};exports['destroy']=function(_0x4a6c1c,_0x505abb){return db[_0x3d66('0x2c')][_0x3d66('0x49')]({'where':{'id':_0x4a6c1c['params']['id']}})[_0x3d66('0x24')](handleEntityNotFound(_0x505abb,null))[_0x3d66('0x24')](removeEntity(_0x505abb,null))[_0x3d66('0x4a')](handleError(_0x505abb,null));}; \ No newline at end of file +var _0x8561=['limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','catch','show','keys','include','find','create','body','update','params','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','lodash','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x5b51db,_0xa10295){var _0x50a2ca=function(_0x804861){while(--_0x804861){_0x5b51db['push'](_0x5b51db['shift']());}};_0x50a2ca(++_0xa10295);}(_0x8561,0x1b2));var _0x1856=function(_0x952282,_0x51a614){_0x952282=_0x952282-0x0;var _0x613507=_0x8561[_0x952282];return _0x613507;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1856('0x0'));var zipdir=require(_0x1856('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1856('0x2'));var moment=require('moment');var BPromise=require(_0x1856('0x3'));var Mustache=require('mustache');var util=require(_0x1856('0x4'));var path=require('path');var sox=require(_0x1856('0x5'));var csv=require(_0x1856('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1856('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1856('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1856('0x9'));var authService=require(_0x1856('0xa'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1856('0xb'));var logger=require('../../config/logger')(_0x1856('0xc'));var utils=require(_0x1856('0xd'));var config=require(_0x1856('0xe'));var licenseUtil=require('../../config/license/util');var db=require(_0x1856('0xf'))['db'];function respondWithStatusCode(_0x317635,_0x57deab){_0x57deab=_0x57deab||0xcc;return function(_0x354164){if(_0x354164){return _0x317635[_0x1856('0x10')](_0x57deab);}return _0x317635[_0x1856('0x11')](_0x57deab)['end']();};}function respondWithResult(_0x2db814,_0xc02b25){_0xc02b25=_0xc02b25||0xc8;return function(_0x208118){if(_0x208118){return _0x2db814['status'](_0xc02b25)[_0x1856('0x12')](_0x208118);}};}function respondWithFilteredResult(_0xb5ff4d,_0x12a82f){return function(_0x3ff3af){if(_0x3ff3af){var _0x41d5bc=typeof _0x12a82f[_0x1856('0x13')]===_0x1856('0x14')&&typeof _0x12a82f['limit']==='undefined';var _0x340bcd=_0x3ff3af['count'];var _0x4ccc42=_0x41d5bc?0x0:_0x12a82f[_0x1856('0x13')];var _0x2346f6=_0x41d5bc?_0x3ff3af['count']:_0x12a82f['offset']+_0x12a82f[_0x1856('0x15')];var _0x40d229;if(_0x2346f6>=_0x340bcd){_0x2346f6=_0x340bcd;_0x40d229=0xc8;}else{_0x40d229=0xce;}_0xb5ff4d[_0x1856('0x11')](_0x40d229);return _0xb5ff4d[_0x1856('0x16')](_0x1856('0x17'),_0x4ccc42+'-'+_0x2346f6+'/'+_0x340bcd)[_0x1856('0x12')](_0x3ff3af);}return null;};}function patchUpdates(_0x47e94c){return function(_0x3d98e4){try{jsonpatch[_0x1856('0x18')](_0x3d98e4,_0x47e94c,!![]);}catch(_0x1dd95d){return BPromise[_0x1856('0x19')](_0x1dd95d);}return _0x3d98e4[_0x1856('0x1a')]();};}function saveUpdates(_0x988cd2,_0xce310a){return function(_0x4dd5b2){if(_0x4dd5b2){return _0x4dd5b2['update'](_0x988cd2)[_0x1856('0x1b')](function(_0x31df72){return _0x31df72;});}return null;};}function removeEntity(_0x31dc64,_0x4b867e){return function(_0x389ed6){if(_0x389ed6){return _0x389ed6[_0x1856('0x1c')]()[_0x1856('0x1b')](function(){_0x31dc64[_0x1856('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfd069f,_0x25b98d){return function(_0x195546){if(!_0x195546){_0xfd069f[_0x1856('0x10')](0x194);}return _0x195546;};}function handleError(_0x4d4f0c,_0x254d35){_0x254d35=_0x254d35||0x1f4;return function(_0x4022e8){logger['error'](_0x4022e8[_0x1856('0x1d')]);if(_0x4022e8['name']){delete _0x4022e8[_0x1856('0x1e')];}_0x4d4f0c['status'](_0x254d35)[_0x1856('0x1f')](_0x4022e8);};}exports[_0x1856('0x20')]=function(_0x1416b3,_0x3c907b){var _0x4ad54a={},_0x2f3d8f={},_0x155607={'count':0x0,'rows':[]};var _0x1134a5=_[_0x1856('0x21')](db[_0x1856('0x22')][_0x1856('0x23')],function(_0x4b0deb){return{'name':_0x4b0deb[_0x1856('0x24')],'type':_0x4b0deb[_0x1856('0x25')][_0x1856('0x26')]};});_0x2f3d8f['model']=_[_0x1856('0x21')](_0x1134a5,_0x1856('0x1e'));_0x2f3d8f[_0x1856('0x27')]=_['keys'](_0x1416b3[_0x1856('0x27')]);_0x2f3d8f['filters']=_[_0x1856('0x28')](_0x2f3d8f[_0x1856('0x29')],_0x2f3d8f[_0x1856('0x27')]);_0x4ad54a[_0x1856('0x2a')]=_[_0x1856('0x28')](_0x2f3d8f[_0x1856('0x29')],qs[_0x1856('0x2b')](_0x1416b3['query'][_0x1856('0x2b')]));_0x4ad54a[_0x1856('0x2a')]=_0x4ad54a[_0x1856('0x2a')][_0x1856('0x2c')]?_0x4ad54a[_0x1856('0x2a')]:_0x2f3d8f['model'];if(!_0x1416b3[_0x1856('0x27')][_0x1856('0x2d')](_0x1856('0x2e'))){_0x4ad54a['limit']=qs[_0x1856('0x15')](_0x1416b3[_0x1856('0x27')][_0x1856('0x15')]);_0x4ad54a[_0x1856('0x13')]=qs[_0x1856('0x13')](_0x1416b3['query']['offset']);}_0x4ad54a['order']=qs[_0x1856('0x2f')](_0x1416b3['query'][_0x1856('0x2f')]);_0x4ad54a[_0x1856('0x30')]=qs['filters'](_['pick'](_0x1416b3[_0x1856('0x27')],_0x2f3d8f[_0x1856('0x31')]),_0x1134a5);if(_0x1416b3[_0x1856('0x27')][_0x1856('0x32')]){_0x4ad54a['where']=_[_0x1856('0x33')](_0x4ad54a[_0x1856('0x30')],{'$or':_[_0x1856('0x21')](_0x1134a5,function(_0x366c8d){if(_0x366c8d[_0x1856('0x25')]!==_0x1856('0x34')){var _0x2e60c0={};_0x2e60c0[_0x366c8d['name']]={'$like':'%'+_0x1416b3[_0x1856('0x27')][_0x1856('0x32')]+'%'};return _0x2e60c0;}})});}_0x4ad54a=_['merge']({},_0x4ad54a,_0x1416b3[_0x1856('0x35')]);var _0xc1164={'where':_0x4ad54a['where']};return db['WhatsappApplication'][_0x1856('0x36')](_0xc1164)[_0x1856('0x1b')](function(_0x35948b){_0x155607[_0x1856('0x36')]=_0x35948b;if(_0x1416b3[_0x1856('0x27')][_0x1856('0x37')]){_0x4ad54a['include']=[{'all':!![]}];}return db[_0x1856('0x22')]['findAll'](_0x4ad54a);})[_0x1856('0x1b')](function(_0x15608f){_0x155607['rows']=_0x15608f;return _0x155607;})[_0x1856('0x1b')](respondWithFilteredResult(_0x3c907b,_0x4ad54a))[_0x1856('0x38')](handleError(_0x3c907b,null));};exports[_0x1856('0x39')]=function(_0x9020dc,_0x33c137){var _0x3056ad={'raw':!![],'where':{'id':_0x9020dc['params']['id']}},_0xf534ab={};_0xf534ab['model']=_[_0x1856('0x3a')](db['WhatsappApplication']['rawAttributes']);_0xf534ab[_0x1856('0x27')]=_[_0x1856('0x3a')](_0x9020dc['query']);_0xf534ab[_0x1856('0x31')]=_[_0x1856('0x28')](_0xf534ab[_0x1856('0x29')],_0xf534ab[_0x1856('0x27')]);_0x3056ad[_0x1856('0x2a')]=_[_0x1856('0x28')](_0xf534ab[_0x1856('0x29')],qs[_0x1856('0x2b')](_0x9020dc[_0x1856('0x27')][_0x1856('0x2b')]));_0x3056ad['attributes']=_0x3056ad[_0x1856('0x2a')][_0x1856('0x2c')]?_0x3056ad[_0x1856('0x2a')]:_0xf534ab[_0x1856('0x29')];if(_0x9020dc[_0x1856('0x27')]['includeAll']){_0x3056ad[_0x1856('0x3b')]=[{'all':!![]}];}_0x3056ad=_[_0x1856('0x33')]({},_0x3056ad,_0x9020dc[_0x1856('0x35')]);return db[_0x1856('0x22')][_0x1856('0x3c')](_0x3056ad)['then'](handleEntityNotFound(_0x33c137,null))[_0x1856('0x1b')](respondWithResult(_0x33c137,null))[_0x1856('0x38')](handleError(_0x33c137,null));};exports[_0x1856('0x3d')]=function(_0x5799fd,_0x494c34){return db['WhatsappApplication'][_0x1856('0x3d')](_0x5799fd[_0x1856('0x3e')],{})[_0x1856('0x1b')](respondWithResult(_0x494c34,0xc9))[_0x1856('0x38')](handleError(_0x494c34,null));};exports[_0x1856('0x3f')]=function(_0x4b2aa7,_0x24bf19){if(_0x4b2aa7[_0x1856('0x3e')]['id']){delete _0x4b2aa7[_0x1856('0x3e')]['id'];}return db[_0x1856('0x22')]['find']({'where':{'id':_0x4b2aa7[_0x1856('0x40')]['id']}})[_0x1856('0x1b')](handleEntityNotFound(_0x24bf19,null))['then'](saveUpdates(_0x4b2aa7[_0x1856('0x3e')],null))[_0x1856('0x1b')](respondWithResult(_0x24bf19,null))[_0x1856('0x38')](handleError(_0x24bf19,null));};exports[_0x1856('0x1c')]=function(_0x287b7d,_0x26da87){return db[_0x1856('0x22')][_0x1856('0x3c')]({'where':{'id':_0x287b7d['params']['id']}})[_0x1856('0x1b')](handleEntityNotFound(_0x26da87,null))['then'](removeEntity(_0x26da87,null))['catch'](handleError(_0x26da87,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 2530a2c..f9a715c 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 _0x00b3=['../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','path','rimraf'];(function(_0x49be77,_0x1e62ab){var _0x1d531c=function(_0x561365){while(--_0x561365){_0x49be77['push'](_0x49be77['shift']());}};_0x1d531c(++_0x1e62ab);}(_0x00b3,0x97));var _0x300b=function(_0x2995bf,_0x4e094d){_0x2995bf=_0x2995bf-0x0;var _0x290529=_0x00b3[_0x2995bf];return _0x290529;};'use strict';var _=require(_0x300b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x300b('0x1'));var moment=require(_0x300b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x300b('0x3'));var rimraf=require(_0x300b('0x4'));var config=require(_0x300b('0x5'));var attributes=require('./whatsappApplication.attributes');module[_0x300b('0x6')]=function(_0xbceeb8,_0x34a5cd){return _0xbceeb8[_0x300b('0x7')](_0x300b('0x8'),attributes,{'tableName':_0x300b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x300b('0xa'),'collate':_0x300b('0xb')});}; \ No newline at end of file +var _0x544a=['whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','./whatsappApplication.attributes','exports','define'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x544a,0xbd));var _0xa544=function(_0x535ac5,_0x5a167d){_0x535ac5=_0x535ac5-0x0;var _0xe7e3ec=_0x544a[_0x535ac5];return _0xe7e3ec;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var logger=require(_0xa544('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa544('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa544('0x4'));var rimraf=require(_0xa544('0x5'));var config=require('../../config/environment');var attributes=require(_0xa544('0x6'));module[_0xa544('0x7')]=function(_0x2f5992,_0x15a604){return _0x2f5992[_0xa544('0x8')]('WhatsappApplication',attributes,{'tableName':_0xa544('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa544('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 6de5c4b..ac00e6b 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 _0xb903=['http','request','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappApplication,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x526d8e,_0x1199bb){var _0x57aeb0=function(_0x40d8c1){while(--_0x40d8c1){_0x526d8e['push'](_0x526d8e['shift']());}};_0x57aeb0(++_0x1199bb);}(_0xb903,0x185));var _0x3b90=function(_0x19f37e,_0x5534ee){_0x19f37e=_0x19f37e-0x0;var _0x2965b0=_0xb903[_0x19f37e];return _0x2965b0;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});} \ No newline at end of file +var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s'];(function(_0x2125e2,_0x500e5a){var _0x3b00f0=function(_0x379ab1){while(--_0x379ab1){_0x2125e2['push'](_0x2125e2['shift']());}};_0x3b00f0(++_0x500e5a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x00bb[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index fbb50c4..d9fc2c5 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 _0xb934=['addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','download','post','create'];(function(_0x253611,_0x4af864){var _0x2c7119=function(_0x344ed4){while(--_0x344ed4){_0x253611['push'](_0x253611['shift']());}};_0x2c7119(++_0x4af864);}(_0xb934,0x92));var _0x4b93=function(_0x332a0c,_0x4688a8){_0x332a0c=_0x332a0c-0x0;var _0x99141e=_0xb934[_0x332a0c];return _0x99141e;};'use strict';var multer=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var path=require(_0x4b93('0x2'));var timeout=require('connect-timeout');var express=require(_0x4b93('0x3'));var router=express[_0x4b93('0x4')]();var fs_extra=require(_0x4b93('0x5'));var auth=require(_0x4b93('0x6'));var interaction=require(_0x4b93('0x7'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x4b93('0x8')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0xa')]);router[_0x4b93('0x8')]('/describe',auth[_0x4b93('0x9')](),controller[_0x4b93('0xb')]);router[_0x4b93('0x8')](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0xd')]);router[_0x4b93('0x8')](_0x4b93('0xe'),auth[_0x4b93('0x9')](),controller['getMessages']);router[_0x4b93('0x8')](_0x4b93('0xf'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x10')]);router[_0x4b93('0x11')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0x12')]);router[_0x4b93('0x11')](_0x4b93('0xe'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x13')]);router[_0x4b93('0x11')](_0x4b93('0x14'),auth[_0x4b93('0x9')](),interaction[_0x4b93('0x15')]('whatsapp',_0x4b93('0x16')),controller[_0x4b93('0x17')]);router[_0x4b93('0x18')]('/:id',auth[_0x4b93('0x9')](),interaction[_0x4b93('0x15')](_0x4b93('0x19'),_0x4b93('0x1a')),controller[_0x4b93('0x1b')]);router['delete'](_0x4b93('0xc'),auth[_0x4b93('0x9')](),interaction['tracked']('whatsapp',_0x4b93('0x1c')),controller[_0x4b93('0x1d')]);router[_0x4b93('0x1e')](_0x4b93('0x14'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x1f')]);module[_0x4b93('0x20')]=router; \ No newline at end of file +var _0xcf98=['tracked','whatsapp','whatsappinteraction:addtags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x4e6a3d,_0x2cd9ae){var _0x5c2ede=function(_0x1c1c1){while(--_0x1c1c1){_0x4e6a3d['push'](_0x4e6a3d['shift']());}};_0x5c2ede(++_0x2cd9ae);}(_0xcf98,0x8d));var _0x8cf9=function(_0x732fb8,_0x50205a){_0x732fb8=_0x732fb8-0x0;var _0x133dbd=_0xcf98[_0x732fb8];return _0x133dbd;};'use strict';var multer=require('multer');var util=require(_0x8cf9('0x0'));var path=require(_0x8cf9('0x1'));var timeout=require(_0x8cf9('0x2'));var express=require(_0x8cf9('0x3'));var router=express[_0x8cf9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8cf9('0x5'));var config=require(_0x8cf9('0x6'));var controller=require(_0x8cf9('0x7'));router[_0x8cf9('0x8')]('/',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xa')]);router[_0x8cf9('0x8')](_0x8cf9('0xb'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xc')]);router[_0x8cf9('0x8')]('/:id',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xd')]);router['get'](_0x8cf9('0xe'),auth['isAuthenticated'](),controller[_0x8cf9('0xf')]);router[_0x8cf9('0x8')](_0x8cf9('0x10'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x11')]);router[_0x8cf9('0x12')]('/',auth[_0x8cf9('0x9')](),controller['create']);router[_0x8cf9('0x12')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x8cf9('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8cf9('0x13')](_0x8cf9('0x14'),_0x8cf9('0x15')),controller['addTags']);router[_0x8cf9('0x16')](_0x8cf9('0x17'),auth['isAuthenticated'](),interaction[_0x8cf9('0x13')](_0x8cf9('0x14'),_0x8cf9('0x18')),controller[_0x8cf9('0x19')]);router[_0x8cf9('0x1a')](_0x8cf9('0x17'),auth[_0x8cf9('0x9')](),interaction[_0x8cf9('0x13')](_0x8cf9('0x14'),_0x8cf9('0x1b')),controller[_0x8cf9('0x1c')]);router[_0x8cf9('0x1a')](_0x8cf9('0x1d'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x1e')]);module[_0x8cf9('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 3e94f82..b18f302 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 _0x3fa4=['sequelize','DATE','STRING','out','ENUM','BOOLEAN'];(function(_0x1f9019,_0x346b3){var _0x53474c=function(_0x4d1771){while(--_0x4d1771){_0x1f9019['push'](_0x1f9019['shift']());}};_0x53474c(++_0x346b3);}(_0x3fa4,0xf0));var _0x43fa=function(_0x234015,_0x57c990){_0x234015=_0x234015-0x0;var _0x12ea3e=_0x3fa4[_0x234015];return _0x12ea3e;};'use strict';var Sequelize=require(_0x43fa('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x43fa('0x1')]},'disposition':{'type':Sequelize[_0x43fa('0x2')]},'secondDisposition':{'type':Sequelize[_0x43fa('0x2')]},'thirdDisposition':{'type':Sequelize[_0x43fa('0x2')]},'note':{'type':Sequelize[_0x43fa('0x2')]},'phone':{'type':Sequelize[_0x43fa('0x2')]},'read1stAt':{'type':Sequelize[_0x43fa('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x43fa('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x43fa('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x43fa('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x43fa('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x9330=['sequelize','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x10482c,_0x2af28f){var _0x3a0b90=function(_0x3e0657){while(--_0x3e0657){_0x10482c['push'](_0x10482c['shift']());}};_0x3a0b90(++_0x2af28f);}(_0x9330,0x14a));var _0x0933=function(_0x10f4bf,_0x420658){_0x10f4bf=_0x10f4bf-0x0;var _0x52f856=_0x9330[_0x10f4bf];return _0x52f856;};'use strict';var Sequelize=require(_0x0933('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x0933('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0933('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0933('0x2')]},'note':{'type':Sequelize[_0x0933('0x2')]},'phone':{'type':Sequelize[_0x0933('0x2')]},'read1stAt':{'type':Sequelize[_0x0933('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0933('0x4')]('in',_0x0933('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0933('0x4')]('in',_0x0933('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0933('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index a0c3e76..12f8915 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 _0x88ab=['basename','existsSync','createReadStream','pipe','YYYY-MM-DD\x20HH:mm:ss','out','System','value','renderFile','transcript-','createPdfFromHTML','unlinkSync','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','json','offset','undefined','limit','count','set','then','sendStatus','error','stack','name','send','map','WhatsappInteraction','rawAttributes','type','findAll','whatsapp','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','update','body','destroy','describe','WhatsappMessage','ids','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','rows','omit','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','closed','closedAt','disposition'];(function(_0xf48244,_0x115cad){var _0x37d890=function(_0x19a886){while(--_0x19a886){_0xf48244['push'](_0xf48244['shift']());}};_0x37d890(++_0x115cad);}(_0x88ab,0x82));var _0xb88a=function(_0x5d221c,_0x38f901){_0x5d221c=_0x5d221c-0x0;var _0x30c51f=_0x88ab[_0x5d221c];return _0x30c51f;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xb88a('0x0'));var moment=require(_0xb88a('0x1'));var BPromise=require('bluebird');var util=require(_0xb88a('0x2'));var path=require(_0xb88a('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb88a('0x4'));var Redis=require(_0xb88a('0x5'));var interaction=require(_0xb88a('0x6'));var qs=require(_0xb88a('0x7'));var pdf=require(_0xb88a('0x8'));var logger=require(_0xb88a('0x9'))('api');var config=require(_0xb88a('0xa'));var db=require(_0xb88a('0xb'))['db'];config[_0xb88a('0xc')]=_[_0xb88a('0xd')](config[_0xb88a('0xc')],{'host':_0xb88a('0xe'),'port':0x18eb});var socket=require(_0xb88a('0xf'))(new Redis(config[_0xb88a('0xc')]));require(_0xb88a('0x10'))[_0xb88a('0x11')](socket);function respondWithStatusCode(_0x3cd182,_0x42cf0b){_0x42cf0b=_0x42cf0b||0xcc;return function(_0x181340){if(_0x181340){return _0x3cd182['sendStatus'](_0x42cf0b);}return _0x3cd182[_0xb88a('0x12')](_0x42cf0b)['end']();};}function respondWithResult(_0x2c03e6,_0x1ad25c){_0x1ad25c=_0x1ad25c||0xc8;return function(_0x4ff25d){if(_0x4ff25d){return _0x2c03e6['status'](_0x1ad25c)[_0xb88a('0x13')](_0x4ff25d);}};}function respondWithFilteredResult(_0x580b44,_0x3fdc0e){return function(_0x27a7e1){if(_0x27a7e1){var _0x1eb345=typeof _0x3fdc0e[_0xb88a('0x14')]===_0xb88a('0x15')&&typeof _0x3fdc0e[_0xb88a('0x16')]===_0xb88a('0x15');var _0x573ddd=_0x27a7e1[_0xb88a('0x17')];var _0x338b65=_0x1eb345?0x0:_0x3fdc0e[_0xb88a('0x14')];var _0x56d513=_0x1eb345?_0x27a7e1['count']:_0x3fdc0e[_0xb88a('0x14')]+_0x3fdc0e[_0xb88a('0x16')];var _0x456948;if(_0x56d513>=_0x573ddd){_0x56d513=_0x573ddd;_0x456948=0xc8;}else{_0x456948=0xce;}_0x580b44['status'](_0x456948);return _0x580b44[_0xb88a('0x18')]('Content-Range',_0x338b65+'-'+_0x56d513+'/'+_0x573ddd)[_0xb88a('0x13')](_0x27a7e1);}return null;};}function saveUpdates(_0x17729e){return function(_0x12583f){if(_0x12583f){return _0x12583f['update'](_0x17729e)['then'](function(_0x130b5d){return _0x130b5d;});}return null;};}function removeEntity(_0x1333d5){return function(_0x5bd73c){if(_0x5bd73c){return _0x5bd73c['destroy']()[_0xb88a('0x19')](function(){_0x1333d5[_0xb88a('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37be44){return function(_0x106c13){if(!_0x106c13){_0x37be44[_0xb88a('0x1a')](0x194);}return _0x106c13;};}function handleError(_0xca44d0,_0x3222d0){_0x3222d0=_0x3222d0||0x1f4;return function(_0x656cab){logger[_0xb88a('0x1b')](_0x656cab[_0xb88a('0x1c')]);if(_0x656cab[_0xb88a('0x1d')]){delete _0x656cab[_0xb88a('0x1d')];}_0xca44d0[_0xb88a('0x12')](_0x3222d0)[_0xb88a('0x1e')](_0x656cab);};}exports['index']=function(_0x31b3f3,_0x4e7deb){var _0x35766d={};var _0x51305d=_[_0xb88a('0x1f')](db[_0xb88a('0x20')][_0xb88a('0x21')],function(_0x519211){return{'name':_0x519211['fieldName'],'type':_0x519211[_0xb88a('0x22')]['key']};});_0x35766d=qs['getOptions'](_0x51305d,_0x31b3f3);return interaction[_0xb88a('0x23')](_0xb88a('0x24'),_0x31b3f3[_0xb88a('0x25')],_0x31b3f3[_0xb88a('0x26')],_0x35766d,_0x51305d)[_0xb88a('0x19')](respondWithFilteredResult(_0x4e7deb,_0x35766d))[_0xb88a('0x27')](handleError(_0x4e7deb,null));};exports[_0xb88a('0x28')]=function(_0x512bba,_0x1747b2){var _0x2099ad={'raw':![],'where':{'id':_0x512bba[_0xb88a('0x29')]['id']}},_0x9c3d72={};_0x9c3d72[_0xb88a('0x2a')]=_[_0xb88a('0x2b')](db[_0xb88a('0x20')]['rawAttributes']);_0x9c3d72['query']=_[_0xb88a('0x2b')](_0x512bba[_0xb88a('0x25')]);_0x9c3d72[_0xb88a('0x2c')]=_[_0xb88a('0x2d')](_0x9c3d72[_0xb88a('0x2a')],_0x9c3d72[_0xb88a('0x25')]);_0x2099ad[_0xb88a('0x2e')]=_[_0xb88a('0x2d')](_0x9c3d72['model'],qs[_0xb88a('0x2f')](_0x512bba[_0xb88a('0x25')]['fields']));_0x2099ad['attributes']=_0x2099ad[_0xb88a('0x2e')][_0xb88a('0x30')]?_0x2099ad[_0xb88a('0x2e')]:_0x9c3d72[_0xb88a('0x2a')];if(_0x512bba[_0xb88a('0x25')][_0xb88a('0x31')]){_0x2099ad[_0xb88a('0x32')]=[{'all':!![]}];}_0x2099ad=_[_0xb88a('0x33')]({},_0x2099ad,_0x512bba[_0xb88a('0x34')]);return db[_0xb88a('0x20')][_0xb88a('0x35')](_0x2099ad)[_0xb88a('0x19')](handleEntityNotFound(_0x1747b2,null))[_0xb88a('0x19')](respondWithResult(_0x1747b2,null))[_0xb88a('0x27')](handleError(_0x1747b2,null));};exports[_0xb88a('0x36')]=function(_0x2c987f,_0x5a7603){return db[_0xb88a('0x20')][_0xb88a('0x36')](_0x2c987f['body'],{})['then'](respondWithResult(_0x5a7603,0xc9))[_0xb88a('0x27')](handleError(_0x5a7603,null));};exports[_0xb88a('0x37')]=function(_0x1c22ce,_0x4215ca){if(_0x1c22ce[_0xb88a('0x38')]['id']){delete _0x1c22ce[_0xb88a('0x38')]['id'];}return db[_0xb88a('0x20')]['find']({'where':{'id':_0x1c22ce[_0xb88a('0x29')]['id']}})[_0xb88a('0x19')](handleEntityNotFound(_0x4215ca,null))['then'](saveUpdates(_0x1c22ce[_0xb88a('0x38')],null))['then'](respondWithResult(_0x4215ca,null))['catch'](handleError(_0x4215ca,null));};exports[_0xb88a('0x39')]=function(_0x157cbe,_0x52f673){return db['WhatsappInteraction'][_0xb88a('0x35')]({'where':{'id':_0x157cbe[_0xb88a('0x29')]['id']}})['then'](handleEntityNotFound(_0x52f673,null))[_0xb88a('0x19')](removeEntity(_0x52f673,null))[_0xb88a('0x27')](handleError(_0x52f673,null));};exports[_0xb88a('0x3a')]=function(_0x4729d8,_0x4fef49){return db[_0xb88a('0x20')][_0xb88a('0x3a')]()['then'](respondWithResult(_0x4fef49,null))[_0xb88a('0x27')](handleError(_0x4fef49,null));};exports['addMessage']=function(_0x3af880,_0x51f182){return db[_0xb88a('0x3b')][_0xb88a('0x35')]({'where':{'id':_0x3af880['params']['id']}})[_0xb88a('0x19')](handleEntityNotFound(_0x51f182,null))[_0xb88a('0x19')](function(_0x4f8a6e){if(_0x4f8a6e){return _0x4f8a6e['addMessage'](_0x3af880[_0xb88a('0x38')]['ids'],_['omit'](_0x3af880[_0xb88a('0x38')],[_0xb88a('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x51f182,null))[_0xb88a('0x27')](handleError(_0x51f182,null));};exports['getMessages']=function(_0x49c59f,_0x3e0490){var _0x513a04={'raw':![],'where':{}};var _0x54a49f={};var _0x1a0c3d={'count':0x0,'rows':[]};return db[_0xb88a('0x20')][_0xb88a('0x3d')]({'where':{'id':_0x49c59f[_0xb88a('0x29')]['id']}})[_0xb88a('0x19')](handleEntityNotFound(_0x3e0490,null))['then'](function(_0x11164a){if(_0x11164a){_0x54a49f[_0xb88a('0x2a')]=_[_0xb88a('0x2b')](db[_0xb88a('0x3b')]['rawAttributes']);_0x54a49f[_0xb88a('0x25')]=_[_0xb88a('0x2b')](_0x49c59f[_0xb88a('0x25')]);_0x54a49f['filters']=_[_0xb88a('0x2d')](_0x54a49f[_0xb88a('0x2a')],_0x54a49f[_0xb88a('0x25')]);_0x513a04['attributes']=_[_0xb88a('0x2d')](_0x54a49f[_0xb88a('0x2a')],qs[_0xb88a('0x2f')](_0x49c59f['query'][_0xb88a('0x2f')]));_0x513a04[_0xb88a('0x2e')]=_0x513a04['attributes']['length']?_0x513a04[_0xb88a('0x2e')]:_0x54a49f[_0xb88a('0x2a')];if(!_0x49c59f['query'][_0xb88a('0x3e')](_0xb88a('0x3f'))){_0x513a04[_0xb88a('0x16')]=qs[_0xb88a('0x16')](_0x49c59f[_0xb88a('0x25')][_0xb88a('0x16')]);_0x513a04['offset']=qs[_0xb88a('0x14')](_0x49c59f[_0xb88a('0x25')][_0xb88a('0x14')]);}_0x513a04[_0xb88a('0x40')]=qs['sort'](_0x49c59f['query'][_0xb88a('0x41')]);_0x513a04[_0xb88a('0x42')]=qs[_0xb88a('0x2c')](_[_0xb88a('0x43')](_0x49c59f[_0xb88a('0x25')],_0x54a49f[_0xb88a('0x2c')]));_0x513a04['where']['WhatsappInteractionId']=_0x11164a['id'];if(_0x49c59f[_0xb88a('0x25')]['filter']){_0x513a04[_0xb88a('0x42')]=_['merge'](_0x513a04['where'],{'$or':_[_0xb88a('0x1f')](_0x513a04[_0xb88a('0x2e')],function(_0x3784a2){var _0x224a7a={};_0x224a7a[_0x3784a2]={'$like':'%'+_0x49c59f[_0xb88a('0x25')][_0xb88a('0x44')]+'%'};return _0x224a7a;})});}if(_0x49c59f['query'][_0xb88a('0x45')]){var _0x41f11c=_0x49c59f['query'][_0xb88a('0x45')]['split'](',');var _0x548d4f={};_0x548d4f[_0x41f11c[0x0]]={'$gte':moment(_0x41f11c[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x513a04[_0xb88a('0x42')]=_['merge'](_0x513a04[_0xb88a('0x42')],_0x548d4f);}_0x513a04=_[_0xb88a('0x33')]({},_0x513a04,_0x49c59f[_0xb88a('0x34')]);return db[_0xb88a('0x3b')][_0xb88a('0x17')]({'where':_0x513a04[_0xb88a('0x42')]})[_0xb88a('0x19')](function(_0x38e8d7){_0x1a0c3d[_0xb88a('0x17')]=_0x38e8d7;if(_0x49c59f[_0xb88a('0x25')][_0xb88a('0x31')]){_0x513a04['include']=[{'all':!![]}];}return db[_0xb88a('0x3b')]['findAll'](_0x513a04);})[_0xb88a('0x19')](function(_0x147095){_0x1a0c3d[_0xb88a('0x46')]=_0x147095;return _0x1a0c3d;});}})[_0xb88a('0x19')](respondWithFilteredResult(_0x3e0490,_0x513a04))['catch'](handleError(_0x3e0490,null));};exports['addTags']=function(_0x3eddb0,_0x323588){return db[_0xb88a('0x20')][_0xb88a('0x35')]({'where':{'id':_0x3eddb0[_0xb88a('0x29')]['id']}})[_0xb88a('0x19')](handleEntityNotFound(_0x323588,null))[_0xb88a('0x19')](function(_0xeec87){if(_0xeec87){return _0xeec87['setTags'](_0x3eddb0[_0xb88a('0x38')]['ids'],_[_0xb88a('0x47')](_0x3eddb0[_0xb88a('0x38')],[_0xb88a('0x3c'),'id'])||{})['spread'](function(){return db[_0xb88a('0x48')][_0xb88a('0x23')]({'attributes':['id',_0xb88a('0x1d'),_0xb88a('0x49')],'where':{'id':_0x3eddb0[_0xb88a('0x38')]['ids']}});})[_0xb88a('0x19')](function(_0x2a915a){socket[_0xb88a('0x4a')]('whatsappInteractionTags:save',{'id':Number(_0x3eddb0[_0xb88a('0x29')]['id']),'tags':_0x2a915a||[]});return{'id':Number(_0x3eddb0['params']['id']),'tags':_0x2a915a||[]};});}})['then'](respondWithResult(_0x323588,null))[_0xb88a('0x27')](handleError(_0x323588,null));};exports[_0xb88a('0x4b')]=function(_0x2924bb,_0x2fc45e){return db[_0xb88a('0x20')][_0xb88a('0x35')]({'where':{'id':_0x2924bb['params']['id']}})[_0xb88a('0x19')](handleEntityNotFound(_0x2fc45e,null))[_0xb88a('0x19')](function(_0x23fcc7){if(_0x23fcc7){return _0x23fcc7[_0xb88a('0x4b')](_0x2924bb[_0xb88a('0x25')][_0xb88a('0x3c')]);}})['then'](respondWithStatusCode(_0x2fc45e,null))[_0xb88a('0x27')](handleError(_0x2fc45e,null));};exports[_0xb88a('0x4c')]=function(_0xbe3668,_0x388377){var _0xa41ccd=moment()[_0xb88a('0x4d')]()[_0xb88a('0x4e')]();var _0x1fb61d=path[_0xb88a('0x4f')](config[_0xb88a('0x50')],_0xb88a('0x51'),_0xb88a('0x52'),_0xb88a('0x53'));var _0x581543=path[_0xb88a('0x4f')](config[_0xb88a('0x50')],_0xb88a('0x51'),_0xb88a('0x52'),_0xb88a('0x54'));var _0x1c7735=path[_0xb88a('0x4f')](_0x1fb61d,_0xa41ccd);var _0x5b7151=util[_0xb88a('0x55')]('transcript-%d-%s.zip',_0xbe3668[_0xb88a('0x29')]['id'],_0xa41ccd);var _0x50b20e=path[_0xb88a('0x4f')](_0x1fb61d,_0x5b7151);var _0x3f448c=[];_0x3f448c[_0xb88a('0x56')]({'model':db[_0xb88a('0x57')],'as':'User','attributes':['id',_0xb88a('0x58')],'raw':!![]});_0x3f448c[_0xb88a('0x56')]({'model':db['CmContact'],'as':_0xb88a('0x59'),'attributes':['id',_0xb88a('0x5a'),_0xb88a('0x5b')],'raw':!![]});if(_0xbe3668[_0xb88a('0x25')][_0xb88a('0x54')]){_0x3f448c[_0xb88a('0x56')]({'model':db[_0xb88a('0x5c')],'as':_0xb88a('0x5c'),'raw':!![]});}var _0x4b1530=[{'model':db[_0xb88a('0x3b')],'as':_0xb88a('0x5d'),'attributes':['id',_0xb88a('0x38'),_0xb88a('0x5e'),_0xb88a('0x5f'),_0xb88a('0x60'),_0xb88a('0x61')],'include':_0x3f448c}];_0x4b1530['push']({'model':db[_0xb88a('0x62')],'as':_0xb88a('0x63'),'attributes':['id',_0xb88a('0x1d')]});_0x4b1530[_0xb88a('0x56')]({'model':db[_0xb88a('0x57')],'as':_0xb88a('0x64'),'attributes':['id',_0xb88a('0x58')]});return db['WhatsappInteraction'][_0xb88a('0x35')]({'where':{'id':_0xbe3668['params']['id']},'include':_0x4b1530})[_0xb88a('0x19')](handleEntityNotFound(_0x388377,null))[_0xb88a('0x19')](function(_0x42555c){if(_0x42555c){var _0x4c9b6a=_0x42555c[_0xb88a('0x65')]({'plain':!![]});fs[_0xb88a('0x66')](_0x1c7735);var _0x4c3617={'channel':'Whatsapp','account':_0x4c9b6a[_0xb88a('0x63')]['name'],'agent':_0x4c9b6a[_0xb88a('0x64')]?_0x4c9b6a[_0xb88a('0x64')][_0xb88a('0x58')]:'N.A.','createdAt':moment(_0x4c9b6a[_0xb88a('0x5e')])[_0xb88a('0x55')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb88a('0x4e')](),'closedAt':_0x4c9b6a[_0xb88a('0x67')]?moment(_0x4c9b6a[_0xb88a('0x68')])[_0xb88a('0x55')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb88a('0x4e')]():'','disposition':_0x4c9b6a[_0xb88a('0x69')],'messages':_(_0x4c9b6a[_0xb88a('0x5d')])[_0xb88a('0x44')]({'secret':![]})[_0xb88a('0x1f')](function(_0x184e95){if(_0x184e95[_0xb88a('0x5c')]){var _0x29cf21=path['join'](_0x581543,_0x184e95[_0xb88a('0x5c')][_0xb88a('0x6a')]);if(fs[_0xb88a('0x6b')](_0x29cf21)){fs[_0xb88a('0x6c')](_0x29cf21)[_0xb88a('0x6d')](fs['createWriteStream'](path[_0xb88a('0x4f')](_0x1c7735,_0x184e95[_0xb88a('0x5c')][_0xb88a('0x6a')])));}}return{'date':moment(_0x184e95['createdAt'])[_0xb88a('0x55')](_0xb88a('0x6e'))[_0xb88a('0x4e')](),'sender':_0x184e95[_0xb88a('0x5f')]===_0xb88a('0x6f')?_0x184e95[_0xb88a('0x57')]?_0x184e95['User'][_0xb88a('0x58')]:_0xb88a('0x70'):_0x184e95['Contact'][_0xb88a('0x5a')]+(_0x184e95[_0xb88a('0x59')][_0xb88a('0x5b')]?'\x20'+_0x184e95[_0xb88a('0x59')]['lastName']:''),'body':_0x184e95['Attachment']?_0x184e95[_0xb88a('0x5c')][_0xb88a('0x6a')]:_0x184e95['body'],'direction':_0x184e95[_0xb88a('0x5f')]===_0xb88a('0x6f')?'A':'C','secret':_0x184e95['secret'],'read':_0x184e95['read'],'attachment':_0x184e95[_0xb88a('0x5c')]};})[_0xb88a('0x71')]()};return ejs[_0xb88a('0x72')](path[_0xb88a('0x4f')](config[_0xb88a('0x50')],'server','views','downloadInteraction.ejs'),{'interaction':_0x4c3617})[_0xb88a('0x19')](function(_0x105702){var _0x2aa1d7=path[_0xb88a('0x4f')](_0x1c7735,_0xb88a('0x73')+_0x4c9b6a['id']+'-'+_0xa41ccd+'.pdf');var _0x1b49dc={'path':_0x2aa1d7,'channel':'Whatsapp','interactionId':_0x4c9b6a['id']};return pdf[_0xb88a('0x74')](_0x105702,_0x1b49dc);})[_0xb88a('0x19')](function(){return new BPromise(function(_0x59c3a4,_0x3b3dd2){zipdir(_0x1c7735,{'saveTo':_0x50b20e},function(_0xc7ddfa,_0x1ff716){if(_0xc7ddfa)return _0x3b3dd2(_0xc7ddfa);return _0x59c3a4(_0x1ff716);});})[_0xb88a('0x19')](function(){return new BPromise(function(_0x5707a8,_0x97b610){rimraf(_0x1c7735,function(_0x34a4ce){if(_0x34a4ce)_0x97b610(_0x34a4ce);return _0x5707a8();});});})[_0xb88a('0x19')](function(){return _0x388377[_0xb88a('0x4c')](_0x50b20e,_0x5b7151,function(_0x214501){if(_0x214501){console['log']('err',_0x214501);}else{fs[_0xb88a('0x75')](_0x50b20e);}});});});}else{return _0x388377[_0xb88a('0x1a')](0xc8);}})['catch'](handleError(_0x388377,null));}; \ No newline at end of file +var _0x88df=['files','tmp','root','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','secret','read','Account','Owner','get','mkdirSync','toString','closed','closedAt','Messages','existsSync','createReadStream','createWriteStream','basename','createdAt','direction','out','value','renderFile','views','transcript-','.pdf','Whatsapp','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','undefined','limit','count','offset','set','Content-Range','json','then','sendStatus','error','stack','name','send','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','whatsapp','query','user','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','destroy','describe','addMessage','WhatsappMessage','ids','omit','hasOwnProperty','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','findAll','rows','addTags','spread','emit','whatsappInteractionTags:save','removeTags','unix','join','server'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x88df,0xa5));var _0xf88d=function(_0xc0b9c9,_0x477253){_0xc0b9c9=_0xc0b9c9-0x0;var _0x41fa75=_0x88df[_0xc0b9c9];return _0x41fa75;};'use strict';var rimraf=require(_0xf88d('0x0'));var zipdir=require(_0xf88d('0x1'));var moment=require(_0xf88d('0x2'));var BPromise=require('bluebird');var util=require(_0xf88d('0x3'));var path=require(_0xf88d('0x4'));var ejs=require(_0xf88d('0x5'));var fs=require('fs');var _=require(_0xf88d('0x6'));var Redis=require(_0xf88d('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xf88d('0x8'));var pdf=require(_0xf88d('0x9'));var logger=require('../../config/logger')(_0xf88d('0xa'));var config=require('../../config/environment');var db=require(_0xf88d('0xb'))['db'];config[_0xf88d('0xc')]=_[_0xf88d('0xd')](config[_0xf88d('0xc')],{'host':_0xf88d('0xe'),'port':0x18eb});var socket=require(_0xf88d('0xf'))(new Redis(config[_0xf88d('0xc')]));require(_0xf88d('0x10'))[_0xf88d('0x11')](socket);function respondWithStatusCode(_0x5d10bb,_0x281504){_0x281504=_0x281504||0xcc;return function(_0x3f97d5){if(_0x3f97d5){return _0x5d10bb['sendStatus'](_0x281504);}return _0x5d10bb[_0xf88d('0x12')](_0x281504)[_0xf88d('0x13')]();};}function respondWithResult(_0x424538,_0x384c23){_0x384c23=_0x384c23||0xc8;return function(_0x3afe9a){if(_0x3afe9a){return _0x424538[_0xf88d('0x12')](_0x384c23)['json'](_0x3afe9a);}};}function respondWithFilteredResult(_0x3a436d,_0x28473a){return function(_0x35b3e9){if(_0x35b3e9){var _0xe78548=typeof _0x28473a['offset']===_0xf88d('0x14')&&typeof _0x28473a[_0xf88d('0x15')]===_0xf88d('0x14');var _0x40269a=_0x35b3e9['count'];var _0x19f84e=_0xe78548?0x0:_0x28473a['offset'];var _0x6875ce=_0xe78548?_0x35b3e9[_0xf88d('0x16')]:_0x28473a[_0xf88d('0x17')]+_0x28473a[_0xf88d('0x15')];var _0x13c575;if(_0x6875ce>=_0x40269a){_0x6875ce=_0x40269a;_0x13c575=0xc8;}else{_0x13c575=0xce;}_0x3a436d[_0xf88d('0x12')](_0x13c575);return _0x3a436d[_0xf88d('0x18')](_0xf88d('0x19'),_0x19f84e+'-'+_0x6875ce+'/'+_0x40269a)[_0xf88d('0x1a')](_0x35b3e9);}return null;};}function saveUpdates(_0x1e3dd9){return function(_0xc14087){if(_0xc14087){return _0xc14087['update'](_0x1e3dd9)['then'](function(_0x226057){return _0x226057;});}return null;};}function removeEntity(_0x48c300){return function(_0x428d0f){if(_0x428d0f){return _0x428d0f['destroy']()[_0xf88d('0x1b')](function(){_0x48c300[_0xf88d('0x12')](0xcc)[_0xf88d('0x13')]();});}};}function handleEntityNotFound(_0xaad751){return function(_0x1fb937){if(!_0x1fb937){_0xaad751[_0xf88d('0x1c')](0x194);}return _0x1fb937;};}function handleError(_0x2cef90,_0x1a9b74){_0x1a9b74=_0x1a9b74||0x1f4;return function(_0x5b6abf){logger[_0xf88d('0x1d')](_0x5b6abf[_0xf88d('0x1e')]);if(_0x5b6abf[_0xf88d('0x1f')]){delete _0x5b6abf['name'];}_0x2cef90[_0xf88d('0x12')](_0x1a9b74)[_0xf88d('0x20')](_0x5b6abf);};}exports['index']=function(_0x191847,_0x3f71ec){var _0x541ca8={};var _0x5b6c3c=_[_0xf88d('0x21')](db[_0xf88d('0x22')][_0xf88d('0x23')],function(_0x4dc88b){return{'name':_0x4dc88b[_0xf88d('0x24')],'type':_0x4dc88b['type'][_0xf88d('0x25')]};});_0x541ca8=qs[_0xf88d('0x26')](_0x5b6c3c,_0x191847);return interaction['findAll'](_0xf88d('0x27'),_0x191847[_0xf88d('0x28')],_0x191847[_0xf88d('0x29')],_0x541ca8,_0x5b6c3c)['then'](respondWithFilteredResult(_0x3f71ec,_0x541ca8))[_0xf88d('0x2a')](handleError(_0x3f71ec,null));};exports['show']=function(_0x4ff1a8,_0x234389){var _0x4fc791={'raw':![],'where':{'id':_0x4ff1a8[_0xf88d('0x2b')]['id']}},_0x12b7ba={};_0x12b7ba[_0xf88d('0x2c')]=_[_0xf88d('0x2d')](db[_0xf88d('0x22')][_0xf88d('0x23')]);_0x12b7ba[_0xf88d('0x28')]=_[_0xf88d('0x2d')](_0x4ff1a8[_0xf88d('0x28')]);_0x12b7ba[_0xf88d('0x2e')]=_[_0xf88d('0x2f')](_0x12b7ba['model'],_0x12b7ba[_0xf88d('0x28')]);_0x4fc791[_0xf88d('0x30')]=_[_0xf88d('0x2f')](_0x12b7ba[_0xf88d('0x2c')],qs['fields'](_0x4ff1a8[_0xf88d('0x28')][_0xf88d('0x31')]));_0x4fc791[_0xf88d('0x30')]=_0x4fc791['attributes'][_0xf88d('0x32')]?_0x4fc791['attributes']:_0x12b7ba['model'];if(_0x4ff1a8['query'][_0xf88d('0x33')]){_0x4fc791[_0xf88d('0x34')]=[{'all':!![]}];}_0x4fc791=_['merge']({},_0x4fc791,_0x4ff1a8[_0xf88d('0x35')]);return db[_0xf88d('0x22')][_0xf88d('0x36')](_0x4fc791)[_0xf88d('0x1b')](handleEntityNotFound(_0x234389,null))[_0xf88d('0x1b')](respondWithResult(_0x234389,null))[_0xf88d('0x2a')](handleError(_0x234389,null));};exports[_0xf88d('0x37')]=function(_0x4ebad3,_0x3d6865){return db['WhatsappInteraction'][_0xf88d('0x37')](_0x4ebad3[_0xf88d('0x38')],{})[_0xf88d('0x1b')](respondWithResult(_0x3d6865,0xc9))[_0xf88d('0x2a')](handleError(_0x3d6865,null));};exports['update']=function(_0x58ea18,_0x4f9462){if(_0x58ea18[_0xf88d('0x38')]['id']){delete _0x58ea18['body']['id'];}return db['WhatsappInteraction'][_0xf88d('0x36')]({'where':{'id':_0x58ea18[_0xf88d('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4f9462,null))[_0xf88d('0x1b')](saveUpdates(_0x58ea18[_0xf88d('0x38')],null))[_0xf88d('0x1b')](respondWithResult(_0x4f9462,null))[_0xf88d('0x2a')](handleError(_0x4f9462,null));};exports[_0xf88d('0x39')]=function(_0x56e9d8,_0x22cfd4){return db[_0xf88d('0x22')][_0xf88d('0x36')]({'where':{'id':_0x56e9d8[_0xf88d('0x2b')]['id']}})['then'](handleEntityNotFound(_0x22cfd4,null))['then'](removeEntity(_0x22cfd4,null))[_0xf88d('0x2a')](handleError(_0x22cfd4,null));};exports[_0xf88d('0x3a')]=function(_0x57c495,_0x13a22d){return db[_0xf88d('0x22')][_0xf88d('0x3a')]()[_0xf88d('0x1b')](respondWithResult(_0x13a22d,null))[_0xf88d('0x2a')](handleError(_0x13a22d,null));};exports[_0xf88d('0x3b')]=function(_0x5b6826,_0x49586c){return db[_0xf88d('0x3c')][_0xf88d('0x36')]({'where':{'id':_0x5b6826[_0xf88d('0x2b')]['id']}})[_0xf88d('0x1b')](handleEntityNotFound(_0x49586c,null))[_0xf88d('0x1b')](function(_0x5b2490){if(_0x5b2490){return _0x5b2490[_0xf88d('0x3b')](_0x5b6826['body'][_0xf88d('0x3d')],_[_0xf88d('0x3e')](_0x5b6826[_0xf88d('0x38')],['ids','id'])||{});}})[_0xf88d('0x1b')](respondWithResult(_0x49586c,null))[_0xf88d('0x2a')](handleError(_0x49586c,null));};exports['getMessages']=function(_0x3b283c,_0x40de56){var _0x121073={'raw':![],'where':{}};var _0x5ada21={};var _0x3a02b8={'count':0x0,'rows':[]};return db[_0xf88d('0x22')]['findOne']({'where':{'id':_0x3b283c[_0xf88d('0x2b')]['id']}})[_0xf88d('0x1b')](handleEntityNotFound(_0x40de56,null))['then'](function(_0x466b05){if(_0x466b05){_0x5ada21[_0xf88d('0x2c')]=_[_0xf88d('0x2d')](db['WhatsappMessage'][_0xf88d('0x23')]);_0x5ada21[_0xf88d('0x28')]=_['keys'](_0x3b283c[_0xf88d('0x28')]);_0x5ada21[_0xf88d('0x2e')]=_[_0xf88d('0x2f')](_0x5ada21[_0xf88d('0x2c')],_0x5ada21['query']);_0x121073['attributes']=_[_0xf88d('0x2f')](_0x5ada21[_0xf88d('0x2c')],qs[_0xf88d('0x31')](_0x3b283c['query']['fields']));_0x121073[_0xf88d('0x30')]=_0x121073['attributes'][_0xf88d('0x32')]?_0x121073[_0xf88d('0x30')]:_0x5ada21[_0xf88d('0x2c')];if(!_0x3b283c[_0xf88d('0x28')][_0xf88d('0x3f')]('nolimit')){_0x121073[_0xf88d('0x15')]=qs[_0xf88d('0x15')](_0x3b283c[_0xf88d('0x28')][_0xf88d('0x15')]);_0x121073['offset']=qs[_0xf88d('0x17')](_0x3b283c[_0xf88d('0x28')][_0xf88d('0x17')]);}_0x121073[_0xf88d('0x40')]=qs[_0xf88d('0x41')](_0x3b283c[_0xf88d('0x28')][_0xf88d('0x41')]);_0x121073[_0xf88d('0x42')]=qs['filters'](_[_0xf88d('0x43')](_0x3b283c['query'],_0x5ada21['filters']));_0x121073[_0xf88d('0x42')][_0xf88d('0x44')]=_0x466b05['id'];if(_0x3b283c['query']['filter']){_0x121073[_0xf88d('0x42')]=_['merge'](_0x121073[_0xf88d('0x42')],{'$or':_[_0xf88d('0x21')](_0x121073[_0xf88d('0x30')],function(_0x1e151d){var _0x23a7ee={};_0x23a7ee[_0x1e151d]={'$like':'%'+_0x3b283c[_0xf88d('0x28')][_0xf88d('0x45')]+'%'};return _0x23a7ee;})});}if(_0x3b283c['query']['$gte']){var _0x28b96b=_0x3b283c[_0xf88d('0x28')][_0xf88d('0x46')][_0xf88d('0x47')](',');var _0x54e706={};_0x54e706[_0x28b96b[0x0]]={'$gte':moment(_0x28b96b[0x1])[_0xf88d('0x48')](_0xf88d('0x49'))};_0x121073[_0xf88d('0x42')]=_[_0xf88d('0x4a')](_0x121073[_0xf88d('0x42')],_0x54e706);}_0x121073=_[_0xf88d('0x4a')]({},_0x121073,_0x3b283c['options']);return db[_0xf88d('0x3c')][_0xf88d('0x16')]({'where':_0x121073[_0xf88d('0x42')]})[_0xf88d('0x1b')](function(_0x27a274){_0x3a02b8[_0xf88d('0x16')]=_0x27a274;if(_0x3b283c[_0xf88d('0x28')][_0xf88d('0x33')]){_0x121073[_0xf88d('0x34')]=[{'all':!![]}];}return db[_0xf88d('0x3c')][_0xf88d('0x4b')](_0x121073);})[_0xf88d('0x1b')](function(_0x1c8615){_0x3a02b8[_0xf88d('0x4c')]=_0x1c8615;return _0x3a02b8;});}})[_0xf88d('0x1b')](respondWithFilteredResult(_0x40de56,_0x121073))['catch'](handleError(_0x40de56,null));};exports[_0xf88d('0x4d')]=function(_0x764989,_0x96fe80){return db[_0xf88d('0x22')][_0xf88d('0x36')]({'where':{'id':_0x764989[_0xf88d('0x2b')]['id']}})[_0xf88d('0x1b')](handleEntityNotFound(_0x96fe80,null))[_0xf88d('0x1b')](function(_0x392cc4){if(_0x392cc4){return _0x392cc4['setTags'](_0x764989['body'][_0xf88d('0x3d')],_[_0xf88d('0x3e')](_0x764989[_0xf88d('0x38')],[_0xf88d('0x3d'),'id'])||{})[_0xf88d('0x4e')](function(){return db['Tag'][_0xf88d('0x4b')]({'attributes':['id',_0xf88d('0x1f'),'color'],'where':{'id':_0x764989[_0xf88d('0x38')][_0xf88d('0x3d')]}});})[_0xf88d('0x1b')](function(_0x329816){socket[_0xf88d('0x4f')](_0xf88d('0x50'),{'id':Number(_0x764989[_0xf88d('0x2b')]['id']),'tags':_0x329816||[]});return{'id':Number(_0x764989[_0xf88d('0x2b')]['id']),'tags':_0x329816||[]};});}})['then'](respondWithResult(_0x96fe80,null))[_0xf88d('0x2a')](handleError(_0x96fe80,null));};exports[_0xf88d('0x51')]=function(_0x301a13,_0x29f54b){return db[_0xf88d('0x22')]['find']({'where':{'id':_0x301a13[_0xf88d('0x2b')]['id']}})[_0xf88d('0x1b')](handleEntityNotFound(_0x29f54b,null))[_0xf88d('0x1b')](function(_0x16302e){if(_0x16302e){return _0x16302e[_0xf88d('0x51')](_0x301a13[_0xf88d('0x28')][_0xf88d('0x3d')]);}})[_0xf88d('0x1b')](respondWithStatusCode(_0x29f54b,null))[_0xf88d('0x2a')](handleError(_0x29f54b,null));};exports['download']=function(_0x1c6140,_0x385340){var _0x4ce136=moment()[_0xf88d('0x52')]()['toString']();var _0xf2c18c=path[_0xf88d('0x53')](config['root'],_0xf88d('0x54'),_0xf88d('0x55'),_0xf88d('0x56'));var _0x156110=path[_0xf88d('0x53')](config[_0xf88d('0x57')],_0xf88d('0x54'),'files',_0xf88d('0x58'));var _0x3b17c0=path[_0xf88d('0x53')](_0xf2c18c,_0x4ce136);var _0x1b3e4f=util[_0xf88d('0x48')](_0xf88d('0x59'),_0x1c6140['params']['id'],_0x4ce136);var _0x439645=path['join'](_0xf2c18c,_0x1b3e4f);var _0x191df0=[];_0x191df0[_0xf88d('0x5a')]({'model':db[_0xf88d('0x5b')],'as':'User','attributes':['id',_0xf88d('0x5c')],'raw':!![]});_0x191df0[_0xf88d('0x5a')]({'model':db['CmContact'],'as':_0xf88d('0x5d'),'attributes':['id',_0xf88d('0x5e'),_0xf88d('0x5f')],'raw':!![]});if(_0x1c6140[_0xf88d('0x28')][_0xf88d('0x58')]){_0x191df0[_0xf88d('0x5a')]({'model':db[_0xf88d('0x60')],'as':'Attachment','raw':!![]});}var _0x2c2b11=[{'model':db[_0xf88d('0x3c')],'as':'Messages','attributes':['id','body','createdAt','direction',_0xf88d('0x61'),_0xf88d('0x62')],'include':_0x191df0}];_0x2c2b11[_0xf88d('0x5a')]({'model':db['WhatsappAccount'],'as':_0xf88d('0x63'),'attributes':['id',_0xf88d('0x1f')]});_0x2c2b11[_0xf88d('0x5a')]({'model':db[_0xf88d('0x5b')],'as':_0xf88d('0x64'),'attributes':['id','fullname']});return db[_0xf88d('0x22')][_0xf88d('0x36')]({'where':{'id':_0x1c6140['params']['id']},'include':_0x2c2b11})[_0xf88d('0x1b')](handleEntityNotFound(_0x385340,null))[_0xf88d('0x1b')](function(_0x18a215){if(_0x18a215){var _0x5cf43c=_0x18a215[_0xf88d('0x65')]({'plain':!![]});fs[_0xf88d('0x66')](_0x3b17c0);var _0x1adc48={'channel':'Whatsapp','account':_0x5cf43c[_0xf88d('0x63')][_0xf88d('0x1f')],'agent':_0x5cf43c[_0xf88d('0x64')]?_0x5cf43c[_0xf88d('0x64')][_0xf88d('0x5c')]:'N.A.','createdAt':moment(_0x5cf43c['createdAt'])['format'](_0xf88d('0x49'))[_0xf88d('0x67')](),'closedAt':_0x5cf43c[_0xf88d('0x68')]?moment(_0x5cf43c[_0xf88d('0x69')])[_0xf88d('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf88d('0x67')]():'','disposition':_0x5cf43c['disposition'],'messages':_(_0x5cf43c[_0xf88d('0x6a')])[_0xf88d('0x45')]({'secret':![]})[_0xf88d('0x21')](function(_0x1c1124){if(_0x1c1124['Attachment']){var _0x2fded4=path[_0xf88d('0x53')](_0x156110,_0x1c1124[_0xf88d('0x60')]['basename']);if(fs[_0xf88d('0x6b')](_0x2fded4)){fs[_0xf88d('0x6c')](_0x2fded4)['pipe'](fs[_0xf88d('0x6d')](path['join'](_0x3b17c0,_0x1c1124[_0xf88d('0x60')][_0xf88d('0x6e')])));}}return{'date':moment(_0x1c1124[_0xf88d('0x6f')])[_0xf88d('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf88d('0x67')](),'sender':_0x1c1124[_0xf88d('0x70')]==='out'?_0x1c1124[_0xf88d('0x5b')]?_0x1c1124[_0xf88d('0x5b')][_0xf88d('0x5c')]:'System':_0x1c1124[_0xf88d('0x5d')][_0xf88d('0x5e')]+(_0x1c1124['Contact'][_0xf88d('0x5f')]?'\x20'+_0x1c1124[_0xf88d('0x5d')][_0xf88d('0x5f')]:''),'body':_0x1c1124[_0xf88d('0x60')]?_0x1c1124[_0xf88d('0x60')][_0xf88d('0x6e')]:_0x1c1124[_0xf88d('0x38')],'direction':_0x1c1124['direction']===_0xf88d('0x71')?'A':'C','secret':_0x1c1124[_0xf88d('0x61')],'read':_0x1c1124[_0xf88d('0x62')],'attachment':_0x1c1124['Attachment']};})[_0xf88d('0x72')]()};return ejs[_0xf88d('0x73')](path[_0xf88d('0x53')](config[_0xf88d('0x57')],_0xf88d('0x54'),_0xf88d('0x74'),'downloadInteraction.ejs'),{'interaction':_0x1adc48})[_0xf88d('0x1b')](function(_0x3b4be9){var _0x516000=path[_0xf88d('0x53')](_0x3b17c0,_0xf88d('0x75')+_0x5cf43c['id']+'-'+_0x4ce136+_0xf88d('0x76'));var _0x4f6748={'path':_0x516000,'channel':_0xf88d('0x77'),'interactionId':_0x5cf43c['id']};return pdf[_0xf88d('0x78')](_0x3b4be9,_0x4f6748);})['then'](function(){return new BPromise(function(_0x4ab212,_0x9dd251){zipdir(_0x3b17c0,{'saveTo':_0x439645},function(_0x9c4d7e,_0x28c299){if(_0x9c4d7e)return _0x9dd251(_0x9c4d7e);return _0x4ab212(_0x28c299);});})['then'](function(){return new BPromise(function(_0xd03d2f,_0x30a601){rimraf(_0x3b17c0,function(_0x4ba318){if(_0x4ba318)_0x30a601(_0x4ba318);return _0xd03d2f();});});})[_0xf88d('0x1b')](function(){return _0x385340[_0xf88d('0x79')](_0x439645,_0x1b3e4f,function(_0x1438e8){if(_0x1438e8){console[_0xf88d('0x7a')](_0xf88d('0x7b'),_0x1438e8);}else{fs[_0xf88d('0x7c')](_0x439645);}});});});}else{return _0x385340[_0xf88d('0x1c')](0xc8);}})['catch'](handleError(_0x385340,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index f280aad..13b87de 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 _0xd624=['update','remove','setDataValue','Users','map','then','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1c81fa,_0xad0bd9){var _0x4b8bf9=function(_0x2fc9b5){while(--_0x2fc9b5){_0x1c81fa['push'](_0x1c81fa['shift']());}};_0x4b8bf9(++_0xad0bd9);}(_0xd624,0x124));var _0x4d62=function(_0x245b87,_0x1e56b6){_0x245b87=_0x245b87-0x0;var _0x28ed52=_0xd624[_0x245b87];return _0x28ed52;};'use strict';var EventEmitter=require(_0x4d62('0x0'));var WhatsappInteraction=require(_0x4d62('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x4d62('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d62('0x2'),'afterDestroy':_0x4d62('0x3')};function emitEvent(_0x231932){return function(_0x1a7587,_0x311462,_0x2582df){_0x1a7587['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x133d24){_0x1a7587[_0x4d62('0x4')](_0x4d62('0x5'),_0x133d24[_0x4d62('0x6')](function(_0xa80583){return{'id':_0xa80583['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x1a7587['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4d62('0x7')](function(_0x62e82e){_0x1a7587[_0x4d62('0x4')](_0x4d62('0x8'),_0x62e82e['length']);WhatsappInteractionEvents[_0x4d62('0x9')](_0x231932+':'+_0x1a7587['id'],_0x1a7587);WhatsappInteractionEvents[_0x4d62('0x9')](_0x231932,_0x1a7587);_0x2582df(null);})[_0x4d62('0xa')](_0x2582df(null));};}for(var e in events){if(events[_0x4d62('0xb')](e)){var event=events[e];WhatsappInteraction[_0x4d62('0xc')](e,emitEvent(event));}}module[_0x4d62('0xd')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x2c1b=['setMaxListeners','save','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage'];(function(_0x41397b,_0x481d0e){var _0x5f4677=function(_0x4a0b5b){while(--_0x4a0b5b){_0x41397b['push'](_0x41397b['shift']());}};_0x5f4677(++_0x481d0e);}(_0x2c1b,0xb0));var _0xb2c1=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x2c1b[_0x49d41c];return _0xb64c5f;};'use strict';var EventEmitter=require(_0xb2c1('0x0'));var WhatsappInteraction=require(_0xb2c1('0x1'))['db'][_0xb2c1('0x2')];var WhatsappMessage=require(_0xb2c1('0x1'))['db'][_0xb2c1('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb2c1('0x4')](0x0);var events={'afterCreate':_0xb2c1('0x5'),'afterUpdate':'update','afterDestroy':_0xb2c1('0x6')};function emitEvent(_0x3ed884){return function(_0x40302d,_0x362abe,_0x42b565){_0x40302d[_0xb2c1('0x7')]({'attributes':['id'],'raw':!![]})[_0xb2c1('0x8')](function(_0x42308a){_0x40302d[_0xb2c1('0x9')](_0xb2c1('0xa'),_0x42308a['map'](function(_0x564bcb){return{'id':_0x564bcb['id']};}));return WhatsappMessage[_0xb2c1('0xb')]({'where':{'WhatsappInteractionId':_0x40302d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb2c1('0x8')](function(_0x33b6ae){_0x40302d[_0xb2c1('0x9')](_0xb2c1('0xc'),_0x33b6ae[_0xb2c1('0xd')]);WhatsappInteractionEvents[_0xb2c1('0xe')](_0x3ed884+':'+_0x40302d['id'],_0x40302d);WhatsappInteractionEvents[_0xb2c1('0xe')](_0x3ed884,_0x40302d);_0x42b565(null);})['catch'](_0x42b565(null));};}for(var e in events){if(events[_0xb2c1('0xf')](e)){var event=events[e];WhatsappInteraction[_0xb2c1('0x10')](e,emitEvent(event));}}module[_0xb2c1('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 103be24..3a13efa 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 _0x81d4=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt'];(function(_0x2699fc,_0x45f889){var _0x264208=function(_0x425fc6){while(--_0x425fc6){_0x2699fc['push'](_0x2699fc['shift']());}};_0x264208(++_0x45f889);}(_0x81d4,0xa7));var _0x481d=function(_0x93cad8,_0x1f4bf6){_0x93cad8=_0x93cad8-0x0;var _0xb088df=_0x81d4[_0x93cad8];return _0xb088df;};'use strict';var _=require(_0x481d('0x0'));var util=require(_0x481d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x481d('0x2'));var BPromise=require(_0x481d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x481d('0x4'));var config=require(_0x481d('0x5'));var attributes=require(_0x481d('0x6'));module[_0x481d('0x7')]=function(_0x376a12,_0x4b3a98){return _0x376a12['define'](_0x481d('0x8'),attributes,{'tableName':_0x481d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15a9d2,_0x21980b,_0xb356e7){if(_0x15a9d2[_0x481d('0xa')](_0x481d('0xb'))){_0x15a9d2[_0x481d('0xc')]=moment()[_0x481d('0xd')](_0x481d('0xe'));}_0xb356e7(null,_0x15a9d2);}}});}; \ No newline at end of file +var _0x5480=['changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','./whatsappInteraction.attributes','exports','define'];(function(_0x546e95,_0x1c2322){var _0x540536=function(_0x35504a){while(--_0x35504a){_0x546e95['push'](_0x546e95['shift']());}};_0x540536(++_0x1c2322);}(_0x5480,0x18a));var _0x0548=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x5480[_0x5d80de];return _0x1c7556;};'use strict';var _=require(_0x0548('0x0'));var util=require(_0x0548('0x1'));var logger=require(_0x0548('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0548('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0548('0x4'));var rimraf=require(_0x0548('0x5'));var config=require('../../config/environment');var attributes=require(_0x0548('0x6'));module[_0x0548('0x7')]=function(_0x287079,_0x420166){return _0x287079[_0x0548('0x8')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf69224,_0x5678e3,_0x377b55){if(_0xf69224[_0x0548('0x9')](_0x0548('0xa'))){_0xf69224['closedAt']=moment()[_0x0548('0xb')](_0x0548('0xc'));}_0x377b55(null,_0xf69224);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 4f22c84..4169b98 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 _0xa1f8=['message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','stringify','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xa1f8,0x131));var _0x8a1f=function(_0x222f3c,_0x1b327c){_0x222f3c=_0x222f3c-0x0;var _0x28e555=_0xa1f8[_0x222f3c];return _0x28e555;};'use strict';var _=require(_0x8a1f('0x0'));var util=require(_0x8a1f('0x1'));var moment=require(_0x8a1f('0x2'));var BPromise=require(_0x8a1f('0x3'));var rs=require(_0x8a1f('0x4'));var fs=require('fs');var Redis=require(_0x8a1f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a1f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8a1f('0x7'));var jayson=require(_0x8a1f('0x8'));var client=jayson[_0x8a1f('0x9')]['http']({'port':0x232a});config[_0x8a1f('0xa')]=_[_0x8a1f('0xb')](config[_0x8a1f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8a1f('0xc'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x8a1f('0xd')](socket);function respondWithRpcPromise(_0x111018,_0x3a2abe,_0x4b7407){return new BPromise(function(_0x166a4e,_0x5cad7a){return client[_0x8a1f('0xe')](_0x111018,_0x4b7407)[_0x8a1f('0xf')](function(_0x50cd5e){logger[_0x8a1f('0x10')](_0x8a1f('0x11'),_0x3a2abe,'request\x20sent');logger[_0x8a1f('0x12')](_0x8a1f('0x13'),_0x3a2abe,_0x8a1f('0x14'),JSON['stringify'](_0x50cd5e));if(_0x50cd5e[_0x8a1f('0x15')]){if(_0x50cd5e['error'][_0x8a1f('0x16')]===0x1f4){logger[_0x8a1f('0x15')](_0x8a1f('0x11'),_0x3a2abe,_0x50cd5e['error']['message']);return _0x5cad7a(_0x50cd5e[_0x8a1f('0x15')][_0x8a1f('0x17')]);}logger[_0x8a1f('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x3a2abe,_0x50cd5e[_0x8a1f('0x15')]['message']);return _0x166a4e(_0x50cd5e['error'][_0x8a1f('0x17')]);}else{logger[_0x8a1f('0x10')](_0x8a1f('0x11'),_0x3a2abe,_0x8a1f('0x14'));_0x166a4e(_0x50cd5e[_0x8a1f('0x18')][_0x8a1f('0x17')]);}})[_0x8a1f('0x19')](function(_0x23f1b4){logger[_0x8a1f('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x3a2abe,_0x23f1b4);_0x5cad7a(_0x23f1b4);});});}exports[_0x8a1f('0x1a')]=function(_0x3815c5){var _0x3e91bb=this;return new Promise(function(_0x31c347,_0x4e0821){return db[_0x8a1f('0x1b')][_0x8a1f('0x1c')](_0x3815c5[_0x8a1f('0x1d')],{'raw':_0x3815c5['options']?_0x3815c5[_0x8a1f('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3815c5[_0x8a1f('0x1e')]?_0x3815c5[_0x8a1f('0x1e')][_0x8a1f('0x1f')]||null:null,'attributes':_0x3815c5[_0x8a1f('0x1e')]?_0x3815c5[_0x8a1f('0x1e')][_0x8a1f('0x20')]||null:null,'limit':_0x3815c5[_0x8a1f('0x1e')]?_0x3815c5[_0x8a1f('0x1e')]['limit']||null:null})[_0x8a1f('0xf')](function(_0x290dbc){logger['info'](_0x8a1f('0x1a'),_0x3815c5);logger[_0x8a1f('0x12')]('UpdateWhatsappInteraction',_0x3815c5,JSON[_0x8a1f('0x21')](_0x290dbc));_0x31c347(_0x290dbc);})[_0x8a1f('0x19')](function(_0xe6de19){logger['error'](_0x8a1f('0x1a'),_0xe6de19[_0x8a1f('0x17')],_0x3815c5);_0x4e0821(_0x3e91bb['error'](0x1f4,_0xe6de19[_0x8a1f('0x17')]));});});};exports[_0x8a1f('0x22')]=function(_0x52e695){return new Promise(function(_0x1e4124,_0x494dab){return db['WhatsappInteraction'][_0x8a1f('0x23')]({'where':_0x52e695[_0x8a1f('0x1e')]?_0x52e695['options'][_0x8a1f('0x1f')]||null:null})[_0x8a1f('0xf')](function(_0x4f13f0){if(_0x4f13f0){return _0x4f13f0[_0x8a1f('0x24')](_0x52e695['body'][_0x8a1f('0x25')],_[_0x8a1f('0x26')](_0x52e695[_0x8a1f('0x1d')],[_0x8a1f('0x25'),'id'])||{});}})[_0x8a1f('0x27')](function(_0x20db89){logger[_0x8a1f('0x10')](_0x8a1f('0x28'),_0x52e695);logger[_0x8a1f('0x12')]('AddTags',_0x52e695,JSON[_0x8a1f('0x21')](_0x20db89));_0x1e4124(_0x20db89);})['catch'](function(_0x1a5134){logger['error'](_0x8a1f('0x28'),_0x1a5134[_0x8a1f('0x17')],_0x52e695);_0x494dab(_this['error'](0x1f4,_0x1a5134[_0x8a1f('0x17')]));});});}; \ No newline at end of file +var _0x44f9=['socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateWhatsappInteraction','body','options','raw','attributes','limit','catch','AddTagsToWhatsappInteraction','WhatsappInteraction','where','addTags','ids','omit','spread','debug','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis'];(function(_0x82f824,_0xcf2c8b){var _0x9488e=function(_0x3f9a91){while(--_0x3f9a91){_0x82f824['push'](_0x82f824['shift']());}};_0x9488e(++_0xcf2c8b);}(_0x44f9,0x16c));var _0x944f=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x44f9[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x944f('0x0'));var util=require(_0x944f('0x1'));var moment=require(_0x944f('0x2'));var BPromise=require(_0x944f('0x3'));var rs=require(_0x944f('0x4'));var fs=require('fs');var Redis=require(_0x944f('0x5'));var db=require(_0x944f('0x6'))['db'];var utils=require(_0x944f('0x7'));var logger=require(_0x944f('0x8'))('rpc');var config=require(_0x944f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x944f('0xa')][_0x944f('0xb')]({'port':0x232a});config['redis']=_[_0x944f('0xc')](config[_0x944f('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x944f('0xe'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x944f('0xf')](socket);function respondWithRpcPromise(_0x4b1f5c,_0x54f66a,_0x4db049){return new BPromise(function(_0x175046,_0x24f787){return client[_0x944f('0x10')](_0x4b1f5c,_0x4db049)[_0x944f('0x11')](function(_0x2e3a58){logger[_0x944f('0x12')](_0x944f('0x13'),_0x54f66a,_0x944f('0x14'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x54f66a,'request\x20sent',JSON[_0x944f('0x15')](_0x2e3a58));if(_0x2e3a58['error']){if(_0x2e3a58[_0x944f('0x16')][_0x944f('0x17')]===0x1f4){logger[_0x944f('0x16')](_0x944f('0x13'),_0x54f66a,_0x2e3a58[_0x944f('0x16')][_0x944f('0x18')]);return _0x24f787(_0x2e3a58[_0x944f('0x16')]['message']);}logger['error'](_0x944f('0x13'),_0x54f66a,_0x2e3a58[_0x944f('0x16')][_0x944f('0x18')]);return _0x175046(_0x2e3a58[_0x944f('0x16')][_0x944f('0x18')]);}else{logger['info'](_0x944f('0x13'),_0x54f66a,_0x944f('0x14'));_0x175046(_0x2e3a58[_0x944f('0x19')][_0x944f('0x18')]);}})['catch'](function(_0x310ddf){logger[_0x944f('0x16')](_0x944f('0x13'),_0x54f66a,_0x310ddf);_0x24f787(_0x310ddf);});});}exports[_0x944f('0x1a')]=function(_0x5490d1){var _0x385fd4=this;return new Promise(function(_0x584763,_0x4250f6){return db['WhatsappInteraction']['update'](_0x5490d1[_0x944f('0x1b')],{'raw':_0x5490d1[_0x944f('0x1c')]?_0x5490d1['options'][_0x944f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5490d1[_0x944f('0x1c')]?_0x5490d1['options']['where']||null:null,'attributes':_0x5490d1['options']?_0x5490d1[_0x944f('0x1c')][_0x944f('0x1e')]||null:null,'limit':_0x5490d1[_0x944f('0x1c')]?_0x5490d1[_0x944f('0x1c')][_0x944f('0x1f')]||null:null})[_0x944f('0x11')](function(_0x221071){logger[_0x944f('0x12')](_0x944f('0x1a'),_0x5490d1);logger['debug']('UpdateWhatsappInteraction',_0x5490d1,JSON[_0x944f('0x15')](_0x221071));_0x584763(_0x221071);})[_0x944f('0x20')](function(_0x147c3e){logger['error'](_0x944f('0x1a'),_0x147c3e[_0x944f('0x18')],_0x5490d1);_0x4250f6(_0x385fd4[_0x944f('0x16')](0x1f4,_0x147c3e[_0x944f('0x18')]));});});};exports[_0x944f('0x21')]=function(_0x48b54b){return new Promise(function(_0x45df93,_0x4edd62){return db[_0x944f('0x22')]['find']({'where':_0x48b54b[_0x944f('0x1c')]?_0x48b54b[_0x944f('0x1c')][_0x944f('0x23')]||null:null})[_0x944f('0x11')](function(_0x342ce2){if(_0x342ce2){return _0x342ce2[_0x944f('0x24')](_0x48b54b[_0x944f('0x1b')][_0x944f('0x25')],_[_0x944f('0x26')](_0x48b54b['body'],[_0x944f('0x25'),'id'])||{});}})[_0x944f('0x27')](function(_0x376396){logger[_0x944f('0x12')]('AddTags',_0x48b54b);logger[_0x944f('0x28')]('AddTags',_0x48b54b,JSON[_0x944f('0x15')](_0x376396));_0x45df93(_0x376396);})['catch'](function(_0x1023fc){logger[_0x944f('0x16')](_0x944f('0x29'),_0x1023fc[_0x944f('0x18')],_0x48b54b);_0x4edd62(_this[_0x944f('0x16')](0x1f4,_0x1023fc[_0x944f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 8a9b17e..7622967 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 _0xc8e3=['update','emit','removeListener','register','length','whatsappInteraction:','remove'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc8e3,0x15d));var _0x3c8e=function(_0x1ce317,_0x90c618){_0x1ce317=_0x1ce317-0x0;var _0x185f56=_0xc8e3[_0x1ce317];return _0x185f56;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x3c8e('0x0'),_0x3c8e('0x1')];function createListener(_0x168509,_0x3aab82){return function(_0x3ab29b){_0x3aab82[_0x3c8e('0x2')](_0x168509,_0x3ab29b);};}function removeListener(_0x65335a,_0xc6354e){return function(){WhatsappInteractionEvents[_0x3c8e('0x3')](_0x65335a,_0xc6354e);};}exports[_0x3c8e('0x4')]=function(_0x6b8c2e){for(var _0x23555a=0x0,_0x2c2ab7=events[_0x3c8e('0x5')];_0x23555a<_0x2c2ab7;_0x23555a++){var _0x1aa114=events[_0x23555a];var _0x54f2ce=createListener(_0x3c8e('0x6')+_0x1aa114,_0x6b8c2e);WhatsappInteractionEvents['on'](_0x1aa114,_0x54f2ce);}}; \ No newline at end of file +var _0xba7e=['./whatsappInteraction.events','remove','update','emit','removeListener','length','whatsappInteraction:'];(function(_0x4bc66c,_0x4559b8){var _0xe5a9c=function(_0x449b38){while(--_0x449b38){_0x4bc66c['push'](_0x4bc66c['shift']());}};_0xe5a9c(++_0x4559b8);}(_0xba7e,0xb6));var _0xeba7=function(_0x95b44e,_0x4af5e1){_0x95b44e=_0x95b44e-0x0;var _0x4d33ea=_0xba7e[_0x95b44e];return _0x4d33ea;};'use strict';var WhatsappInteractionEvents=require(_0xeba7('0x0'));var events=['save',_0xeba7('0x1'),_0xeba7('0x2')];function createListener(_0x43bb40,_0x7c26be){return function(_0x531d0d){_0x7c26be[_0xeba7('0x3')](_0x43bb40,_0x531d0d);};}function removeListener(_0x276e32,_0x212f8a){return function(){WhatsappInteractionEvents[_0xeba7('0x4')](_0x276e32,_0x212f8a);};}exports['register']=function(_0x162f78){for(var _0x66eee6=0x0,_0x174940=events[_0xeba7('0x5')];_0x66eee6<_0x174940;_0x66eee6++){var _0x49dc73=events[_0x66eee6];var _0x1548f5=createListener(_0xeba7('0x6')+_0x49dc73,_0x162f78);WhatsappInteractionEvents['on'](_0x49dc73,_0x1548f5);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 3f3d65d..32c9dfa 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 _0x58eb=['/:id/status','/:id/accept','accept','put','/:id/reject','destroy','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create'];(function(_0x390c9e,_0x25087b){var _0x184d9d=function(_0x7e4aa5){while(--_0x7e4aa5){_0x390c9e['push'](_0x390c9e['shift']());}};_0x184d9d(++_0x25087b);}(_0x58eb,0x119));var _0xb58e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x58eb[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0xb58e('0x0'));var util=require(_0xb58e('0x1'));var path=require(_0xb58e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb58e('0x3')]();var fs_extra=require(_0xb58e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb58e('0x5'));var config=require(_0xb58e('0x6'));var controller=require(_0xb58e('0x7'));router[_0xb58e('0x8')]('/',auth[_0xb58e('0x9')](),controller[_0xb58e('0xa')]);router['get'](_0xb58e('0xb'),auth[_0xb58e('0x9')](),controller['describe']);router[_0xb58e('0x8')](_0xb58e('0xc'),auth[_0xb58e('0x9')](),controller[_0xb58e('0xd')]);router[_0xb58e('0xe')]('/',auth[_0xb58e('0x9')](),interaction[_0xb58e('0xf')](_0xb58e('0x10'),_0xb58e('0x11')),controller[_0xb58e('0x12')]);router[_0xb58e('0xe')](_0xb58e('0x13'),controller['status']);router['put'](_0xb58e('0xc'),auth[_0xb58e('0x9')](),controller['update']);router['put'](_0xb58e('0x14'),auth[_0xb58e('0x9')](),controller[_0xb58e('0x15')]);router[_0xb58e('0x16')](_0xb58e('0x17'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xb58e('0xc'),auth[_0xb58e('0x9')](),controller[_0xb58e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x7bf4=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','whatsapp','create','/:id/status','status','update','put','/:id/accept','/:id/reject','destroy'];(function(_0x24ca1f,_0x3d2164){var _0x5f4222=function(_0x37b651){while(--_0x37b651){_0x24ca1f['push'](_0x24ca1f['shift']());}};_0x5f4222(++_0x3d2164);}(_0x7bf4,0x119));var _0x47bf=function(_0x159199,_0xd61c5d){_0x159199=_0x159199-0x0;var _0x49dfdd=_0x7bf4[_0x159199];return _0x49dfdd;};'use strict';var multer=require(_0x47bf('0x0'));var util=require(_0x47bf('0x1'));var path=require(_0x47bf('0x2'));var timeout=require(_0x47bf('0x3'));var express=require(_0x47bf('0x4'));var router=express[_0x47bf('0x5')]();var fs_extra=require(_0x47bf('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47bf('0x7'));var config=require(_0x47bf('0x8'));var controller=require(_0x47bf('0x9'));router[_0x47bf('0xa')]('/',auth['isAuthenticated'](),controller[_0x47bf('0xb')]);router[_0x47bf('0xa')](_0x47bf('0xc'),auth[_0x47bf('0xd')](),controller['describe']);router[_0x47bf('0xa')](_0x47bf('0xe'),auth[_0x47bf('0xd')](),controller[_0x47bf('0xf')]);router[_0x47bf('0x10')]('/',auth[_0x47bf('0xd')](),interaction[_0x47bf('0x11')](_0x47bf('0x12'),'whatsappmessage:create'),controller[_0x47bf('0x13')]);router[_0x47bf('0x10')](_0x47bf('0x14'),controller[_0x47bf('0x15')]);router['put'](_0x47bf('0xe'),auth['isAuthenticated'](),controller[_0x47bf('0x16')]);router[_0x47bf('0x17')](_0x47bf('0x18'),auth[_0x47bf('0xd')](),controller['accept']);router[_0x47bf('0x17')](_0x47bf('0x19'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x47bf('0xe'),auth[_0x47bf('0xd')](),controller[_0x47bf('0x1a')]);module[_0x47bf('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index f9f0935..0f87543 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 _0xcc0d=['DATE','sequelize','exports','TEXT','ENUM','out','STRING'];(function(_0xd9c3ff,_0x81f198){var _0x18e42f=function(_0x41117d){while(--_0x41117d){_0xd9c3ff['push'](_0xd9c3ff['shift']());}};_0x18e42f(++_0x81f198);}(_0xcc0d,0x174));var _0xdcc0=function(_0x211e8f,_0x54b63a){_0x211e8f=_0x211e8f-0x0;var _0x45e6c8=_0xcc0d[_0x211e8f];return _0x45e6c8;};'use strict';var Sequelize=require(_0xdcc0('0x0'));module[_0xdcc0('0x1')]={'body':{'type':Sequelize[_0xdcc0('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xdcc0('0x3')]('in',_0xdcc0('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xdcc0('0x5')](0xbe)},'phone':{'type':Sequelize[_0xdcc0('0x5')]},'readAt':{'type':Sequelize[_0xdcc0('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdcc0('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8c79=['out','STRING','TEXT','sequelize','BOOLEAN'];(function(_0x119a2a,_0x52a94f){var _0x22d268=function(_0x40714c){while(--_0x40714c){_0x119a2a['push'](_0x119a2a['shift']());}};_0x22d268(++_0x52a94f);}(_0x8c79,0xa8));var _0x98c7=function(_0x510ee9,_0xfd8b59){_0x510ee9=_0x510ee9-0x0;var _0xc4e23=_0x8c79[_0x510ee9];return _0xc4e23;};'use strict';var Sequelize=require(_0x98c7('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x98c7('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x98c7('0x2')),'defaultValue':_0x98c7('0x2'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x98c7('0x3')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x98c7('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index a113514..44c6a08 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 _0xfbd8=['include','findAll','rows','show','length','find','create','body','params','describe','whatsapp-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','acceptMessage','sequelize','QueryTypes','SELECT','User','fullname','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','contact','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x4bf559,_0x3fb379){var _0x208dc9=function(_0x2f9b7a){while(--_0x2f9b7a){_0x4bf559['push'](_0x4bf559['shift']());}};_0x208dc9(++_0x3fb379);}(_0xfbd8,0xcb));var _0x8fbd=function(_0x54fd80,_0x430280){_0x54fd80=_0x54fd80-0x0;var _0x415018=_0xfbd8[_0x54fd80];return _0x415018;};'use strict';var emlformat=require(_0x8fbd('0x0'));var rimraf=require(_0x8fbd('0x1'));var zipdir=require(_0x8fbd('0x2'));var jsonpatch=require(_0x8fbd('0x3'));var rp=require(_0x8fbd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8fbd('0x5'));var util=require(_0x8fbd('0x6'));var path=require(_0x8fbd('0x7'));var sox=require(_0x8fbd('0x8'));var csv=require(_0x8fbd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8fbd('0xa'));var _=require(_0x8fbd('0xb'));var squel=require('squel');var crypto=require(_0x8fbd('0xc'));var jsforce=require(_0x8fbd('0xd'));var deskjs=require(_0x8fbd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8fbd('0xf'));var Papa=require(_0x8fbd('0x10'));var Redis=require(_0x8fbd('0x11'));var authService=require(_0x8fbd('0x12'));var qs=require(_0x8fbd('0x13'));var as=require(_0x8fbd('0x14'));var hardwareService=require(_0x8fbd('0x15'));var logger=require(_0x8fbd('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x8fbd('0x17'));var licenseUtil=require(_0x8fbd('0x18'));var db=require(_0x8fbd('0x19'))['db'];config['redis']=_[_0x8fbd('0x1a')](config[_0x8fbd('0x1b')],{'host':_0x8fbd('0x1c'),'port':0x18eb});var socket=require(_0x8fbd('0x1d'))(new Redis(config[_0x8fbd('0x1b')]));require(_0x8fbd('0x1e'))[_0x8fbd('0x1f')](socket);var jayson=require(_0x8fbd('0x20'));var client=jayson['client'][_0x8fbd('0x21')]({'port':0x232c});var client9002=jayson[_0x8fbd('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dcfc5,_0x24649e,_0x4d9523,_0x5816cf){return new BPromise(function(_0x2a1232,_0x48752f){var _0x1eda91=_0x5816cf||client;return _0x1eda91[_0x8fbd('0x23')](_0x3dcfc5,_0x4d9523)[_0x8fbd('0x24')](function(_0x4c9edc){logger[_0x8fbd('0x25')](_0x8fbd('0x26'),_0x24649e,'request\x20sent');logger[_0x8fbd('0x27')](_0x8fbd('0x28'),_0x24649e,'request\x20sent',JSON[_0x8fbd('0x29')](_0x4c9edc));if(_0x4c9edc[_0x8fbd('0x2a')]){if(_0x4c9edc['error']['code']===0x1f4){logger[_0x8fbd('0x2a')](_0x8fbd('0x26'),_0x24649e,_0x4c9edc[_0x8fbd('0x2a')]['message']);return _0x48752f(_0x4c9edc[_0x8fbd('0x2a')][_0x8fbd('0x2b')]);}logger[_0x8fbd('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x24649e,_0x4c9edc['error'][_0x8fbd('0x2b')]);return _0x2a1232(_0x4c9edc[_0x8fbd('0x2a')]['message']);}else{logger[_0x8fbd('0x25')](_0x8fbd('0x26'),_0x24649e,'request\x20sent');_0x2a1232(_0x4c9edc['result'][_0x8fbd('0x2b')]);}})[_0x8fbd('0x2c')](function(_0x2ac376){logger[_0x8fbd('0x2a')](_0x8fbd('0x26'),_0x24649e,_0x2ac376);_0x48752f(_0x2ac376);});});}function respondWithStatusCode(_0x47deba,_0x1b6877){_0x1b6877=_0x1b6877||0xcc;return function(_0x2d4004){if(_0x2d4004){return _0x47deba['sendStatus'](_0x1b6877);}return _0x47deba['status'](_0x1b6877)[_0x8fbd('0x2d')]();};}function respondWithResult(_0x329853,_0x3a94a3){_0x3a94a3=_0x3a94a3||0xc8;return function(_0x5e518e){if(_0x5e518e){return _0x329853[_0x8fbd('0x2e')](_0x3a94a3)[_0x8fbd('0x2f')](_0x5e518e);}};}function respondWithFilteredResult(_0x10e6f0,_0x2cc853){return function(_0xc89347){if(_0xc89347){var _0xb30a44=typeof _0x2cc853[_0x8fbd('0x30')]===_0x8fbd('0x31')&&typeof _0x2cc853[_0x8fbd('0x32')]===_0x8fbd('0x31');var _0x420940=_0xc89347[_0x8fbd('0x33')];var _0x4238a4=_0xb30a44?0x0:_0x2cc853[_0x8fbd('0x30')];var _0x2d4cc5=_0xb30a44?_0xc89347[_0x8fbd('0x33')]:_0x2cc853['offset']+_0x2cc853[_0x8fbd('0x32')];var _0xc84925;if(_0x2d4cc5>=_0x420940){_0x2d4cc5=_0x420940;_0xc84925=0xc8;}else{_0xc84925=0xce;}_0x10e6f0[_0x8fbd('0x2e')](_0xc84925);return _0x10e6f0['set'](_0x8fbd('0x34'),_0x4238a4+'-'+_0x2d4cc5+'/'+_0x420940)[_0x8fbd('0x2f')](_0xc89347);}return null;};}function patchUpdates(_0x7f5137){return function(_0x18b0b7){try{jsonpatch[_0x8fbd('0x35')](_0x18b0b7,_0x7f5137,!![]);}catch(_0x991856){return BPromise[_0x8fbd('0x36')](_0x991856);}return _0x18b0b7[_0x8fbd('0x37')]();};}function saveUpdates(_0xd3bb4f,_0x1b1529){return function(_0x367a10){if(_0x367a10){return _0x367a10[_0x8fbd('0x38')](_0xd3bb4f)[_0x8fbd('0x24')](function(_0x9b7dd4){return _0x9b7dd4;});}return null;};}function removeEntity(_0x29dcee,_0x1a292e){return function(_0x229190){if(_0x229190){return _0x229190[_0x8fbd('0x39')]()['then'](function(){_0x29dcee[_0x8fbd('0x2e')](0xcc)[_0x8fbd('0x2d')]();});}};}function handleEntityNotFound(_0x204a1b,_0x456cba){return function(_0x3bd2b1){if(!_0x3bd2b1){_0x204a1b[_0x8fbd('0x3a')](0x194);}return _0x3bd2b1;};}function handleError(_0x3bf78b,_0x4cf3d5){_0x4cf3d5=_0x4cf3d5||0x1f4;return function(_0x44cf37){logger[_0x8fbd('0x2a')](_0x44cf37[_0x8fbd('0x3b')]);if(_0x44cf37[_0x8fbd('0x3c')]){delete _0x44cf37['name'];}_0x3bf78b[_0x8fbd('0x2e')](_0x4cf3d5)[_0x8fbd('0x3d')](_0x44cf37);};}exports[_0x8fbd('0x3e')]=function(_0xb437d,_0x425a3d){var _0x2b611b={},_0x5e95f2={},_0x46ae38={'count':0x0,'rows':[]};var _0x2e11e1=_[_0x8fbd('0x3f')](db[_0x8fbd('0x40')][_0x8fbd('0x41')],function(_0x522aa7){return{'name':_0x522aa7['fieldName'],'type':_0x522aa7[_0x8fbd('0x42')][_0x8fbd('0x43')]};});_0x5e95f2[_0x8fbd('0x44')]=_['map'](_0x2e11e1,_0x8fbd('0x3c'));_0x5e95f2[_0x8fbd('0x45')]=_[_0x8fbd('0x46')](_0xb437d[_0x8fbd('0x45')]);_0x5e95f2[_0x8fbd('0x47')]=_[_0x8fbd('0x48')](_0x5e95f2[_0x8fbd('0x44')],_0x5e95f2[_0x8fbd('0x45')]);_0x2b611b[_0x8fbd('0x49')]=_[_0x8fbd('0x48')](_0x5e95f2[_0x8fbd('0x44')],qs[_0x8fbd('0x4a')](_0xb437d[_0x8fbd('0x45')][_0x8fbd('0x4a')]));_0x2b611b['attributes']=_0x2b611b[_0x8fbd('0x49')]['length']?_0x2b611b[_0x8fbd('0x49')]:_0x5e95f2['model'];if(!_0xb437d['query'][_0x8fbd('0x4b')]('nolimit')){_0x2b611b[_0x8fbd('0x32')]=qs[_0x8fbd('0x32')](_0xb437d[_0x8fbd('0x45')][_0x8fbd('0x32')]);_0x2b611b['offset']=qs[_0x8fbd('0x30')](_0xb437d[_0x8fbd('0x45')]['offset']);}_0x2b611b[_0x8fbd('0x4c')]=qs[_0x8fbd('0x4d')](_0xb437d[_0x8fbd('0x45')]['sort']);_0x2b611b[_0x8fbd('0x4e')]=qs[_0x8fbd('0x47')](_[_0x8fbd('0x4f')](_0xb437d[_0x8fbd('0x45')],_0x5e95f2[_0x8fbd('0x47')]),_0x2e11e1);if(_0xb437d[_0x8fbd('0x45')][_0x8fbd('0x50')]){_0x2b611b[_0x8fbd('0x4e')]=_[_0x8fbd('0x51')](_0x2b611b['where'],{'$or':_[_0x8fbd('0x3f')](_0x2e11e1,function(_0x3cc18a){if(_0x3cc18a[_0x8fbd('0x42')]!==_0x8fbd('0x52')){var _0xcd89eb={};_0xcd89eb[_0x3cc18a[_0x8fbd('0x3c')]]={'$like':'%'+_0xb437d[_0x8fbd('0x45')][_0x8fbd('0x50')]+'%'};return _0xcd89eb;}})});}_0x2b611b=_['merge']({},_0x2b611b,_0xb437d[_0x8fbd('0x53')]);var _0x3ce67c={'where':_0x2b611b[_0x8fbd('0x4e')]};return db[_0x8fbd('0x40')][_0x8fbd('0x33')](_0x3ce67c)['then'](function(_0xf752d9){_0x46ae38[_0x8fbd('0x33')]=_0xf752d9;if(_0xb437d[_0x8fbd('0x45')][_0x8fbd('0x54')]){_0x2b611b[_0x8fbd('0x55')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x8fbd('0x56')](_0x2b611b);})[_0x8fbd('0x24')](function(_0x490e7b){_0x46ae38[_0x8fbd('0x57')]=_0x490e7b;return _0x46ae38;})[_0x8fbd('0x24')](respondWithFilteredResult(_0x425a3d,_0x2b611b))[_0x8fbd('0x2c')](handleError(_0x425a3d,null));};exports[_0x8fbd('0x58')]=function(_0x5c5eb6,_0x46b62b){var _0x6bed53={'raw':!![],'where':{'id':_0x5c5eb6['params']['id']}},_0x2162ca={};_0x2162ca[_0x8fbd('0x44')]=_[_0x8fbd('0x46')](db['WhatsappMessage'][_0x8fbd('0x41')]);_0x2162ca[_0x8fbd('0x45')]=_[_0x8fbd('0x46')](_0x5c5eb6[_0x8fbd('0x45')]);_0x2162ca[_0x8fbd('0x47')]=_[_0x8fbd('0x48')](_0x2162ca['model'],_0x2162ca[_0x8fbd('0x45')]);_0x6bed53[_0x8fbd('0x49')]=_['intersection'](_0x2162ca['model'],qs[_0x8fbd('0x4a')](_0x5c5eb6[_0x8fbd('0x45')][_0x8fbd('0x4a')]));_0x6bed53[_0x8fbd('0x49')]=_0x6bed53[_0x8fbd('0x49')][_0x8fbd('0x59')]?_0x6bed53[_0x8fbd('0x49')]:_0x2162ca[_0x8fbd('0x44')];if(_0x5c5eb6[_0x8fbd('0x45')][_0x8fbd('0x54')]){_0x6bed53[_0x8fbd('0x55')]=[{'all':!![]}];}_0x6bed53=_[_0x8fbd('0x51')]({},_0x6bed53,_0x5c5eb6[_0x8fbd('0x53')]);return db[_0x8fbd('0x40')][_0x8fbd('0x5a')](_0x6bed53)[_0x8fbd('0x24')](handleEntityNotFound(_0x46b62b,null))[_0x8fbd('0x24')](respondWithResult(_0x46b62b,null))[_0x8fbd('0x2c')](handleError(_0x46b62b,null));};exports[_0x8fbd('0x5b')]=function(_0x4137bf,_0x435092){return db['WhatsappMessage'][_0x8fbd('0x5b')](_0x4137bf[_0x8fbd('0x5c')],{})[_0x8fbd('0x24')](respondWithResult(_0x435092,0xc9))[_0x8fbd('0x2c')](handleError(_0x435092,null));};exports['update']=function(_0x124dd2,_0x11ed6e){if(_0x124dd2[_0x8fbd('0x5c')]['id']){delete _0x124dd2[_0x8fbd('0x5c')]['id'];}return db[_0x8fbd('0x40')][_0x8fbd('0x5a')]({'where':{'id':_0x124dd2[_0x8fbd('0x5d')]['id']}})[_0x8fbd('0x24')](handleEntityNotFound(_0x11ed6e,null))[_0x8fbd('0x24')](saveUpdates(_0x124dd2[_0x8fbd('0x5c')],null))[_0x8fbd('0x24')](respondWithResult(_0x11ed6e,null))['catch'](handleError(_0x11ed6e,null));};exports[_0x8fbd('0x39')]=function(_0x29578b,_0x2c61ba){return db[_0x8fbd('0x40')][_0x8fbd('0x5a')]({'where':{'id':_0x29578b[_0x8fbd('0x5d')]['id']}})[_0x8fbd('0x24')](handleEntityNotFound(_0x2c61ba,null))[_0x8fbd('0x24')](removeEntity(_0x2c61ba,null))[_0x8fbd('0x2c')](handleError(_0x2c61ba,null));};exports[_0x8fbd('0x5e')]=function(_0x1cff04,_0x1340cd){return db['WhatsappMessage'][_0x8fbd('0x5e')]()[_0x8fbd('0x24')](respondWithResult(_0x1340cd,null))[_0x8fbd('0x2c')](handleError(_0x1340cd,null));};var interaction_log=require(_0x8fbd('0x16'))(_0x8fbd('0x5f'));exports['accept']=function(_0x2681ac,_0x485d18,_0x1406e3){var _0x2d51f4={'agent':{},'channel':'whatsapp'};if(_0x2681ac[_0x8fbd('0x5c')]['id']){delete _0x2681ac[_0x8fbd('0x5c')]['id'];}_0x2681ac['body'][_0x8fbd('0x60')]=!![];_0x2681ac[_0x8fbd('0x5c')][_0x8fbd('0x61')]=moment()[_0x8fbd('0x62')](_0x8fbd('0x63'));_0x2681ac['body'][_0x8fbd('0x64')]=_0x2681ac['body'][_0x8fbd('0x64')]||_0x2681ac[_0x8fbd('0x65')]['id'];_0x2d51f4['agent']['id']=_0x2681ac[_0x8fbd('0x5c')][_0x8fbd('0x64')];return db['WhatsappMessage'][_0x8fbd('0x5a')]({'where':{'id':_0x2681ac[_0x8fbd('0x5d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x485d18,null))['then'](saveUpdates(_0x2681ac[_0x8fbd('0x5c')],null))['then'](function(_0x44ea3f){if(_0x44ea3f){_0x2d51f4[_0x8fbd('0x2b')]=_0x44ea3f[_0x8fbd('0x66')]({'plain':!![]});return db['WhatsappInteraction'][_0x8fbd('0x5a')]({'where':{'id':_0x44ea3f[_0x8fbd('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x485d18,null))[_0x8fbd('0x24')](function(_0x5a593a){if(_0x5a593a){return _0x5a593a[_0x8fbd('0x38')]({'UserId':_0x2681ac[_0x8fbd('0x5c')]['UserId'],'read1stAt':_[_0x8fbd('0x68')](_0x5a593a[_0x8fbd('0x69')])?moment()['format'](_0x8fbd('0x63')):undefined});}return null;})[_0x8fbd('0x24')](function(_0x14b31e){if(_0x14b31e){_0x2d51f4['interaction']=_0x14b31e[_0x8fbd('0x66')]({'plain':!![]});interaction_log['info'](_0x8fbd('0x6a'),_0x2681ac[_0x8fbd('0x65')]['id'],_0x2681ac[_0x8fbd('0x65')][_0x8fbd('0x3c')],_0x2681ac[_0x8fbd('0x65')][_0x8fbd('0x6b')],_0x2d51f4[_0x8fbd('0x6c')]['id'],_0x2681ac[_0x8fbd('0x5c')]?JSON[_0x8fbd('0x29')](_0x2681ac[_0x8fbd('0x5c')]):'null');return respondWithRpcPromise('AcceptMessage',_0x8fbd('0x6d'),_0x2d51f4);}return null;})[_0x8fbd('0x24')](function(_0x218c7a){var _0xc9118d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x218c7a[_0x8fbd('0x2b')]['ContactId'];return db[_0x8fbd('0x6e')][_0x8fbd('0x45')](_0xc9118d,{'type':db['Sequelize'][_0x8fbd('0x6f')][_0x8fbd('0x70')],'raw':!![]})[_0x8fbd('0x24')](function(_0x105ed9){return _0x105ed9;});})[_0x8fbd('0x24')](function(_0x348111){if(_0x348111){_0x2d51f4[_0x8fbd('0x2b')]['contact']=_0x348111[0x0];if(!_0x2681ac[_0x8fbd('0x5c')][_0x8fbd('0x64')])return;return db[_0x8fbd('0x71')][_0x8fbd('0x5a')]({'where':{'id':_0x2681ac[_0x8fbd('0x5c')][_0x8fbd('0x64')],'role':'agent'},'attributes':['id',_0x8fbd('0x3c'),_0x8fbd('0x72'),_0x8fbd('0x73'),_0x8fbd('0x74')],'raw':!![]});}return null;})[_0x8fbd('0x24')](function(_0x158535){if(!_0x158535)return null;_0x2d51f4[_0x8fbd('0x2b')][_0x8fbd('0x75')]=_0x158535;return _0x2d51f4;})['then'](function(_0x2daee1){if(_0x2daee1){if(_0x2681ac['body'][_0x8fbd('0x76')]){_0x2d51f4['message'][_0x8fbd('0x77')]=util[_0x8fbd('0x62')](_0x8fbd('0x78'),_0x2681ac[_0x8fbd('0x65')]['name']);_0x2d51f4[_0x8fbd('0x2b')]['channel']=_0x2d51f4[_0x8fbd('0x79')];_0x2d51f4[_0x8fbd('0x2b')][_0x8fbd('0x7a')]=_0x2d51f4[_0x8fbd('0x79')];_0x2d51f4[_0x8fbd('0x2b')][_0x8fbd('0x7b')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x8fbd('0x7c'),'message':_0x2d51f4[_0x8fbd('0x2b')]},client9002)[_0x8fbd('0x24')](function(){return _0x2d51f4;});}return _0x2d51f4;}return null;})[_0x8fbd('0x24')](respondWithResult(_0x485d18,null))[_0x8fbd('0x2c')](handleError(_0x485d18,null));};var interaction_log=require(_0x8fbd('0x16'))(_0x8fbd('0x5f'));exports[_0x8fbd('0x36')]=function(_0x343de5,_0x3b3eda,_0x305996){var _0x3aa1de={'agent':{},'channel':'whatsapp'};if(_0x343de5['body']['id']){delete _0x343de5[_0x8fbd('0x5c')]['id'];}_0x343de5[_0x8fbd('0x5c')][_0x8fbd('0x64')]=_0x343de5[_0x8fbd('0x5c')]['UserId']||_0x343de5['user']['id'];_0x3aa1de[_0x8fbd('0x75')]['id']=_0x343de5[_0x8fbd('0x5c')]['UserId'];return db['WhatsappMessage'][_0x8fbd('0x5a')]({'where':{'id':_0x343de5[_0x8fbd('0x5d')]['id'],'UserId':null}})[_0x8fbd('0x24')](handleEntityNotFound(_0x3b3eda,null))[_0x8fbd('0x24')](function(_0x30c820){if(_0x30c820){_0x3aa1de[_0x8fbd('0x2b')]=_0x30c820[_0x8fbd('0x66')]({'plain':!![]});return db[_0x8fbd('0x7d')][_0x8fbd('0x5a')]({'where':{'id':_0x30c820[_0x8fbd('0x67')]}});}return null;})[_0x8fbd('0x24')](handleEntityNotFound(_0x3b3eda,null))[_0x8fbd('0x24')](function(_0x40709a){if(_0x40709a){_0x3aa1de[_0x8fbd('0x6c')]=_0x40709a[_0x8fbd('0x66')]({'plain':!![]});interaction_log[_0x8fbd('0x25')](_0x8fbd('0x7e'),_0x343de5[_0x8fbd('0x65')]['id'],_0x343de5[_0x8fbd('0x65')][_0x8fbd('0x3c')],_0x343de5[_0x8fbd('0x65')][_0x8fbd('0x6b')],_0x3aa1de['interaction']['id'],_0x343de5[_0x8fbd('0x5c')]?JSON['stringify'](_0x343de5[_0x8fbd('0x5c')]):_0x8fbd('0x7f'));return respondWithRpcPromise('RejectMessage',_0x8fbd('0x80'),_0x3aa1de);}return null;})['then'](function(_0x4fc52e){var _0x4cdabb=_0x8fbd('0x81')+_0x4fc52e['message'][_0x8fbd('0x82')];return db['sequelize'][_0x8fbd('0x45')](_0x4cdabb,{'type':db[_0x8fbd('0x83')][_0x8fbd('0x6f')][_0x8fbd('0x70')],'raw':!![]})[_0x8fbd('0x24')](function(_0x36db87){return _0x36db87;});})[_0x8fbd('0x24')](function(_0x381a01){if(_0x381a01){_0x3aa1de['message'][_0x8fbd('0x84')]=_0x381a01[0x0];if(!_0x343de5[_0x8fbd('0x5c')][_0x8fbd('0x64')])return;return db[_0x8fbd('0x71')][_0x8fbd('0x5a')]({'where':{'id':_0x343de5['body'][_0x8fbd('0x64')],'role':'agent'},'attributes':['id',_0x8fbd('0x3c'),'fullname',_0x8fbd('0x73'),'internal'],'raw':!![]});}return null;})[_0x8fbd('0x24')](function(_0xdd1830){if(!_0xdd1830)return null;_0x3aa1de[_0x8fbd('0x2b')]['agent']=_0xdd1830;return _0x3aa1de;})['then'](function(_0x16b3e3){if(_0x16b3e3){_0x16b3e3['message']['interface']=util[_0x8fbd('0x62')](_0x8fbd('0x78'),_0x343de5[_0x8fbd('0x65')]['name']);_0x16b3e3[_0x8fbd('0x2b')][_0x8fbd('0x79')]=_0x3aa1de['channel'];_0x16b3e3[_0x8fbd('0x2b')][_0x8fbd('0x7a')]=_0x3aa1de[_0x8fbd('0x79')];_0x16b3e3[_0x8fbd('0x2b')][_0x8fbd('0x7b')]=_0x8fbd('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0x8fbd('0x85'),'message':_0x16b3e3[_0x8fbd('0x2b')]},client9002);return _0x3aa1de;}return null;})[_0x8fbd('0x24')](respondWithResult(_0x3b3eda,null))[_0x8fbd('0x2c')](handleError(_0x3b3eda,null));};exports[_0x8fbd('0x2e')]=function(_0x167528,_0x5dddb6,_0x5c0367){if(_0x167528[_0x8fbd('0x5c')]['id']){delete _0x167528['body']['id'];}var _0x3e57d5;return db[_0x8fbd('0x40')][_0x8fbd('0x5a')]({'where':{'id':_0x167528[_0x8fbd('0x5d')]['id']}})[_0x8fbd('0x24')](handleEntityNotFound(_0x5dddb6,null))[_0x8fbd('0x24')](function(_0x19ebf7){if(_0x19ebf7){_0x3e57d5=_0x19ebf7;return db[_0x8fbd('0x86')][_0x8fbd('0x5a')]({'where':{'id':_0x19ebf7[_0x8fbd('0x87')]}});}})[_0x8fbd('0x24')](handleEntityNotFound(_0x5dddb6,null))[_0x8fbd('0x24')](function(_0x15502d){if(_0x15502d){logger['debug'](_0x8fbd('0x88'),'status',_0x8fbd('0x89'),_0x15502d[_0x8fbd('0x42')],util[_0x8fbd('0x8a')](_0x167528[_0x8fbd('0x5c')],{'showHidden':![],'depth':null}));switch(_0x15502d['type']){case _0x8fbd('0x8b'):if(_0x167528['body'][_0x8fbd('0x8c')]&&_0x167528['body'][_0x8fbd('0x8c')]===_0x3e57d5[_0x8fbd('0x8d')]&&_0x167528[_0x8fbd('0x5c')][_0x8fbd('0x8e')]&&_0x167528['body']['MessageStatus']===_0x8fbd('0x60')){return _0x3e57d5[_0x8fbd('0x38')]({'read':!![]});}else{logger[_0x8fbd('0x2a')](_0x8fbd('0x8f'),'status',_0x8fbd('0x8b'),util[_0x8fbd('0x8a')](_0x167528['body'],{'showHidden':![],'depth':null}));}break;}return _0x3e57d5;}})['then'](respondWithResult(_0x5dddb6,null))[_0x8fbd('0x2c')](handleError(_0x5dddb6,null));}; \ No newline at end of file +var _0x3eeb=['type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','then','includeAll','include','rows','show','params','keys','merge','options','create','body','find','destroy','describe','whatsapp-interactions','readAt','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','update','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','whatsapp','get','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','fullname','format','EventManager','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageStatus','read','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','stack','name','index','map','WhatsappMessage'];(function(_0x2a147f,_0x303e35){var _0x405c1b=function(_0x179884){while(--_0x179884){_0x2a147f['push'](_0x2a147f['shift']());}};_0x405c1b(++_0x303e35);}(_0x3eeb,0x1e7));var _0xb3ee=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3eeb[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xb3ee('0x0'));var rimraf=require(_0xb3ee('0x1'));var zipdir=require(_0xb3ee('0x2'));var jsonpatch=require(_0xb3ee('0x3'));var rp=require(_0xb3ee('0x4'));var moment=require(_0xb3ee('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb3ee('0x6'));var util=require(_0xb3ee('0x7'));var path=require(_0xb3ee('0x8'));var sox=require('sox');var csv=require(_0xb3ee('0x9'));var ejs=require(_0xb3ee('0xa'));var fs=require('fs');var fs_extra=require(_0xb3ee('0xb'));var _=require(_0xb3ee('0xc'));var squel=require(_0xb3ee('0xd'));var crypto=require(_0xb3ee('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb3ee('0xf'));var toCsv=require(_0xb3ee('0x9'));var querystring=require(_0xb3ee('0x10'));var Papa=require(_0xb3ee('0x11'));var Redis=require(_0xb3ee('0x12'));var authService=require(_0xb3ee('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3ee('0x14'));var logger=require(_0xb3ee('0x15'))('api');var utils=require(_0xb3ee('0x16'));var config=require(_0xb3ee('0x17'));var licenseUtil=require(_0xb3ee('0x18'));var db=require(_0xb3ee('0x19'))['db'];config[_0xb3ee('0x1a')]=_['defaults'](config['redis'],{'host':_0xb3ee('0x1b'),'port':0x18eb});var socket=require(_0xb3ee('0x1c'))(new Redis(config[_0xb3ee('0x1a')]));require(_0xb3ee('0x1d'))[_0xb3ee('0x1e')](socket);var jayson=require(_0xb3ee('0x1f'));var client=jayson[_0xb3ee('0x20')][_0xb3ee('0x21')]({'port':0x232c});var client9002=jayson[_0xb3ee('0x20')][_0xb3ee('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x40cd81,_0x1710ea,_0x123b39,_0x1367e8){return new BPromise(function(_0x672de6,_0x2286fc){var _0xe71586=_0x1367e8||client;return _0xe71586[_0xb3ee('0x22')](_0x40cd81,_0x123b39)['then'](function(_0x3fa9f1){logger[_0xb3ee('0x23')](_0xb3ee('0x24'),_0x1710ea,_0xb3ee('0x25'));logger['debug'](_0xb3ee('0x26'),_0x1710ea,'request\x20sent',JSON[_0xb3ee('0x27')](_0x3fa9f1));if(_0x3fa9f1[_0xb3ee('0x28')]){if(_0x3fa9f1[_0xb3ee('0x28')][_0xb3ee('0x29')]===0x1f4){logger[_0xb3ee('0x28')](_0xb3ee('0x24'),_0x1710ea,_0x3fa9f1[_0xb3ee('0x28')][_0xb3ee('0x2a')]);return _0x2286fc(_0x3fa9f1['error'][_0xb3ee('0x2a')]);}logger[_0xb3ee('0x28')](_0xb3ee('0x24'),_0x1710ea,_0x3fa9f1[_0xb3ee('0x28')]['message']);return _0x672de6(_0x3fa9f1[_0xb3ee('0x28')][_0xb3ee('0x2a')]);}else{logger[_0xb3ee('0x23')](_0xb3ee('0x24'),_0x1710ea,_0xb3ee('0x25'));_0x672de6(_0x3fa9f1[_0xb3ee('0x2b')][_0xb3ee('0x2a')]);}})[_0xb3ee('0x2c')](function(_0x28f985){logger[_0xb3ee('0x28')](_0xb3ee('0x24'),_0x1710ea,_0x28f985);_0x2286fc(_0x28f985);});});}function respondWithStatusCode(_0x52eb81,_0x2fbcbc){_0x2fbcbc=_0x2fbcbc||0xcc;return function(_0x39ace1){if(_0x39ace1){return _0x52eb81[_0xb3ee('0x2d')](_0x2fbcbc);}return _0x52eb81[_0xb3ee('0x2e')](_0x2fbcbc)[_0xb3ee('0x2f')]();};}function respondWithResult(_0x3bd9ba,_0x1aca1d){_0x1aca1d=_0x1aca1d||0xc8;return function(_0x443847){if(_0x443847){return _0x3bd9ba['status'](_0x1aca1d)[_0xb3ee('0x30')](_0x443847);}};}function respondWithFilteredResult(_0x2662f8,_0x5292f4){return function(_0x34e0b1){if(_0x34e0b1){var _0xafcec2=typeof _0x5292f4[_0xb3ee('0x31')]==='undefined'&&typeof _0x5292f4['limit']===_0xb3ee('0x32');var _0x3d8bd7=_0x34e0b1[_0xb3ee('0x33')];var _0x5a2e11=_0xafcec2?0x0:_0x5292f4[_0xb3ee('0x31')];var _0x500007=_0xafcec2?_0x34e0b1[_0xb3ee('0x33')]:_0x5292f4['offset']+_0x5292f4['limit'];var _0x1665d2;if(_0x500007>=_0x3d8bd7){_0x500007=_0x3d8bd7;_0x1665d2=0xc8;}else{_0x1665d2=0xce;}_0x2662f8['status'](_0x1665d2);return _0x2662f8[_0xb3ee('0x34')]('Content-Range',_0x5a2e11+'-'+_0x500007+'/'+_0x3d8bd7)[_0xb3ee('0x30')](_0x34e0b1);}return null;};}function patchUpdates(_0x48af75){return function(_0x51894e){try{jsonpatch[_0xb3ee('0x35')](_0x51894e,_0x48af75,!![]);}catch(_0x2d1da6){return BPromise[_0xb3ee('0x36')](_0x2d1da6);}return _0x51894e[_0xb3ee('0x37')]();};}function saveUpdates(_0x3f8638,_0x58e2ee){return function(_0x1f6732){if(_0x1f6732){return _0x1f6732['update'](_0x3f8638)['then'](function(_0x12263f){return _0x12263f;});}return null;};}function removeEntity(_0xf53d5c,_0x41a76f){return function(_0x5dca05){if(_0x5dca05){return _0x5dca05['destroy']()['then'](function(){_0xf53d5c['status'](0xcc)[_0xb3ee('0x2f')]();});}};}function handleEntityNotFound(_0x43c104,_0x2937b6){return function(_0x168599){if(!_0x168599){_0x43c104[_0xb3ee('0x2d')](0x194);}return _0x168599;};}function handleError(_0x5dbf14,_0x2569df){_0x2569df=_0x2569df||0x1f4;return function(_0x27bbd9){logger[_0xb3ee('0x28')](_0x27bbd9[_0xb3ee('0x38')]);if(_0x27bbd9['name']){delete _0x27bbd9[_0xb3ee('0x39')];}_0x5dbf14['status'](_0x2569df)['send'](_0x27bbd9);};}exports[_0xb3ee('0x3a')]=function(_0x5aa8d7,_0x35d335){var _0x39746f={},_0x28bbb1={},_0x2b4e88={'count':0x0,'rows':[]};var _0x450e40=_[_0xb3ee('0x3b')](db[_0xb3ee('0x3c')]['rawAttributes'],function(_0x18fdf6){return{'name':_0x18fdf6['fieldName'],'type':_0x18fdf6[_0xb3ee('0x3d')][_0xb3ee('0x3e')]};});_0x28bbb1[_0xb3ee('0x3f')]=_[_0xb3ee('0x3b')](_0x450e40,_0xb3ee('0x39'));_0x28bbb1[_0xb3ee('0x40')]=_['keys'](_0x5aa8d7['query']);_0x28bbb1[_0xb3ee('0x41')]=_['intersection'](_0x28bbb1[_0xb3ee('0x3f')],_0x28bbb1[_0xb3ee('0x40')]);_0x39746f[_0xb3ee('0x42')]=_[_0xb3ee('0x43')](_0x28bbb1[_0xb3ee('0x3f')],qs[_0xb3ee('0x44')](_0x5aa8d7[_0xb3ee('0x40')][_0xb3ee('0x44')]));_0x39746f['attributes']=_0x39746f[_0xb3ee('0x42')][_0xb3ee('0x45')]?_0x39746f['attributes']:_0x28bbb1[_0xb3ee('0x3f')];if(!_0x5aa8d7[_0xb3ee('0x40')][_0xb3ee('0x46')](_0xb3ee('0x47'))){_0x39746f[_0xb3ee('0x48')]=qs[_0xb3ee('0x48')](_0x5aa8d7['query'][_0xb3ee('0x48')]);_0x39746f[_0xb3ee('0x31')]=qs[_0xb3ee('0x31')](_0x5aa8d7[_0xb3ee('0x40')][_0xb3ee('0x31')]);}_0x39746f[_0xb3ee('0x49')]=qs[_0xb3ee('0x4a')](_0x5aa8d7[_0xb3ee('0x40')][_0xb3ee('0x4a')]);_0x39746f['where']=qs[_0xb3ee('0x41')](_['pick'](_0x5aa8d7[_0xb3ee('0x40')],_0x28bbb1[_0xb3ee('0x41')]),_0x450e40);if(_0x5aa8d7['query']['filter']){_0x39746f[_0xb3ee('0x4b')]=_['merge'](_0x39746f[_0xb3ee('0x4b')],{'$or':_[_0xb3ee('0x3b')](_0x450e40,function(_0x4ccd8b){if(_0x4ccd8b[_0xb3ee('0x3d')]!=='VIRTUAL'){var _0x5bfcdb={};_0x5bfcdb[_0x4ccd8b['name']]={'$like':'%'+_0x5aa8d7[_0xb3ee('0x40')][_0xb3ee('0x4c')]+'%'};return _0x5bfcdb;}})});}_0x39746f=_['merge']({},_0x39746f,_0x5aa8d7['options']);var _0x528046={'where':_0x39746f[_0xb3ee('0x4b')]};return db[_0xb3ee('0x3c')]['count'](_0x528046)[_0xb3ee('0x4d')](function(_0x258288){_0x2b4e88['count']=_0x258288;if(_0x5aa8d7[_0xb3ee('0x40')][_0xb3ee('0x4e')]){_0x39746f[_0xb3ee('0x4f')]=[{'all':!![]}];}return db[_0xb3ee('0x3c')]['findAll'](_0x39746f);})['then'](function(_0x2341e0){_0x2b4e88[_0xb3ee('0x50')]=_0x2341e0;return _0x2b4e88;})[_0xb3ee('0x4d')](respondWithFilteredResult(_0x35d335,_0x39746f))[_0xb3ee('0x2c')](handleError(_0x35d335,null));};exports[_0xb3ee('0x51')]=function(_0x49bc75,_0x2f1e7a){var _0x3e30ce={'raw':!![],'where':{'id':_0x49bc75[_0xb3ee('0x52')]['id']}},_0x5b78a6={};_0x5b78a6[_0xb3ee('0x3f')]=_['keys'](db[_0xb3ee('0x3c')]['rawAttributes']);_0x5b78a6['query']=_[_0xb3ee('0x53')](_0x49bc75[_0xb3ee('0x40')]);_0x5b78a6[_0xb3ee('0x41')]=_['intersection'](_0x5b78a6[_0xb3ee('0x3f')],_0x5b78a6[_0xb3ee('0x40')]);_0x3e30ce[_0xb3ee('0x42')]=_['intersection'](_0x5b78a6['model'],qs['fields'](_0x49bc75[_0xb3ee('0x40')][_0xb3ee('0x44')]));_0x3e30ce[_0xb3ee('0x42')]=_0x3e30ce[_0xb3ee('0x42')]['length']?_0x3e30ce[_0xb3ee('0x42')]:_0x5b78a6[_0xb3ee('0x3f')];if(_0x49bc75[_0xb3ee('0x40')]['includeAll']){_0x3e30ce[_0xb3ee('0x4f')]=[{'all':!![]}];}_0x3e30ce=_[_0xb3ee('0x54')]({},_0x3e30ce,_0x49bc75[_0xb3ee('0x55')]);return db[_0xb3ee('0x3c')]['find'](_0x3e30ce)[_0xb3ee('0x4d')](handleEntityNotFound(_0x2f1e7a,null))[_0xb3ee('0x4d')](respondWithResult(_0x2f1e7a,null))[_0xb3ee('0x2c')](handleError(_0x2f1e7a,null));};exports[_0xb3ee('0x56')]=function(_0x5146d4,_0xd52e0b){return db[_0xb3ee('0x3c')]['create'](_0x5146d4[_0xb3ee('0x57')],{})['then'](respondWithResult(_0xd52e0b,0xc9))[_0xb3ee('0x2c')](handleError(_0xd52e0b,null));};exports['update']=function(_0x428b79,_0x5272d4){if(_0x428b79[_0xb3ee('0x57')]['id']){delete _0x428b79['body']['id'];}return db[_0xb3ee('0x3c')][_0xb3ee('0x58')]({'where':{'id':_0x428b79[_0xb3ee('0x52')]['id']}})[_0xb3ee('0x4d')](handleEntityNotFound(_0x5272d4,null))[_0xb3ee('0x4d')](saveUpdates(_0x428b79[_0xb3ee('0x57')],null))[_0xb3ee('0x4d')](respondWithResult(_0x5272d4,null))[_0xb3ee('0x2c')](handleError(_0x5272d4,null));};exports[_0xb3ee('0x59')]=function(_0x4cbcb0,_0x3b0cac){return db['WhatsappMessage']['find']({'where':{'id':_0x4cbcb0[_0xb3ee('0x52')]['id']}})[_0xb3ee('0x4d')](handleEntityNotFound(_0x3b0cac,null))[_0xb3ee('0x4d')](removeEntity(_0x3b0cac,null))[_0xb3ee('0x2c')](handleError(_0x3b0cac,null));};exports[_0xb3ee('0x5a')]=function(_0x118e35,_0x5b469a){return db[_0xb3ee('0x3c')]['describe']()[_0xb3ee('0x4d')](respondWithResult(_0x5b469a,null))[_0xb3ee('0x2c')](handleError(_0x5b469a,null));};var interaction_log=require(_0xb3ee('0x15'))(_0xb3ee('0x5b'));exports['accept']=function(_0x4ba5a7,_0x35011c,_0x22e090){var _0x3996bb={'agent':{},'channel':'whatsapp'};if(_0x4ba5a7[_0xb3ee('0x57')]['id']){delete _0x4ba5a7[_0xb3ee('0x57')]['id'];}_0x4ba5a7[_0xb3ee('0x57')]['read']=!![];_0x4ba5a7[_0xb3ee('0x57')][_0xb3ee('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4ba5a7[_0xb3ee('0x57')][_0xb3ee('0x5d')]=_0x4ba5a7['body'][_0xb3ee('0x5d')]||_0x4ba5a7[_0xb3ee('0x5e')]['id'];_0x3996bb[_0xb3ee('0x5f')]['id']=_0x4ba5a7[_0xb3ee('0x57')][_0xb3ee('0x5d')];return db[_0xb3ee('0x3c')][_0xb3ee('0x58')]({'where':{'id':_0x4ba5a7[_0xb3ee('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x35011c,null))['then'](saveUpdates(_0x4ba5a7[_0xb3ee('0x57')],null))[_0xb3ee('0x4d')](function(_0x59a07a){if(_0x59a07a){_0x3996bb[_0xb3ee('0x2a')]=_0x59a07a['get']({'plain':!![]});return db[_0xb3ee('0x60')]['find']({'where':{'id':_0x59a07a[_0xb3ee('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x35011c,null))['then'](function(_0xf6c55b){if(_0xf6c55b){return _0xf6c55b[_0xb3ee('0x62')]({'UserId':_0x4ba5a7[_0xb3ee('0x57')][_0xb3ee('0x5d')],'read1stAt':_[_0xb3ee('0x63')](_0xf6c55b['read1stAt'])?moment()['format'](_0xb3ee('0x64')):undefined});}return null;})['then'](function(_0x27a9e7){if(_0x27a9e7){_0x3996bb[_0xb3ee('0x65')]=_0x27a9e7['get']({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ba5a7[_0xb3ee('0x5e')]['id'],_0x4ba5a7['user'][_0xb3ee('0x39')],_0x4ba5a7[_0xb3ee('0x5e')][_0xb3ee('0x66')],_0x3996bb[_0xb3ee('0x65')]['id'],_0x4ba5a7['body']?JSON[_0xb3ee('0x27')](_0x4ba5a7[_0xb3ee('0x57')]):_0xb3ee('0x67'));return respondWithRpcPromise(_0xb3ee('0x68'),'acceptMessage',_0x3996bb);}return null;})[_0xb3ee('0x4d')](function(_0x5d2f76){var _0x41020a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5d2f76[_0xb3ee('0x2a')][_0xb3ee('0x69')];return db[_0xb3ee('0x6a')][_0xb3ee('0x40')](_0x41020a,{'type':db[_0xb3ee('0x6b')][_0xb3ee('0x6c')][_0xb3ee('0x6d')],'raw':!![]})[_0xb3ee('0x4d')](function(_0xa14e83){return _0xa14e83;});})[_0xb3ee('0x4d')](function(_0x1c34d9){if(_0x1c34d9){_0x3996bb[_0xb3ee('0x2a')]['contact']=_0x1c34d9[0x0];if(!_0x4ba5a7['body'][_0xb3ee('0x5d')])return;return db[_0xb3ee('0x6e')][_0xb3ee('0x58')]({'where':{'id':_0x4ba5a7[_0xb3ee('0x57')][_0xb3ee('0x5d')],'role':_0xb3ee('0x5f')},'attributes':['id','name','fullname',_0xb3ee('0x6f'),'internal'],'raw':!![]});}return null;})[_0xb3ee('0x4d')](function(_0x17d39c){if(!_0x17d39c)return null;_0x3996bb[_0xb3ee('0x2a')][_0xb3ee('0x5f')]=_0x17d39c;return _0x3996bb;})[_0xb3ee('0x4d')](function(_0x245bc0){if(_0x245bc0){if(_0x4ba5a7[_0xb3ee('0x57')][_0xb3ee('0x70')]){_0x3996bb['message'][_0xb3ee('0x71')]=util['format'](_0xb3ee('0x72'),_0x4ba5a7[_0xb3ee('0x5e')][_0xb3ee('0x39')]);_0x3996bb[_0xb3ee('0x2a')][_0xb3ee('0x73')]=_0x3996bb[_0xb3ee('0x73')];_0x3996bb[_0xb3ee('0x2a')][_0xb3ee('0x74')]=_0x3996bb['channel'];_0x3996bb[_0xb3ee('0x2a')][_0xb3ee('0x75')]=_0xb3ee('0x76');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x3996bb[_0xb3ee('0x2a')]},client9002)[_0xb3ee('0x4d')](function(){return _0x3996bb;});}return _0x3996bb;}return null;})[_0xb3ee('0x4d')](respondWithResult(_0x35011c,null))[_0xb3ee('0x2c')](handleError(_0x35011c,null));};var interaction_log=require(_0xb3ee('0x15'))(_0xb3ee('0x5b'));exports[_0xb3ee('0x36')]=function(_0x3b493c,_0x158234,_0x41255a){var _0x535ec3={'agent':{},'channel':_0xb3ee('0x77')};if(_0x3b493c[_0xb3ee('0x57')]['id']){delete _0x3b493c['body']['id'];}_0x3b493c[_0xb3ee('0x57')]['UserId']=_0x3b493c[_0xb3ee('0x57')]['UserId']||_0x3b493c[_0xb3ee('0x5e')]['id'];_0x535ec3[_0xb3ee('0x5f')]['id']=_0x3b493c['body'][_0xb3ee('0x5d')];return db[_0xb3ee('0x3c')][_0xb3ee('0x58')]({'where':{'id':_0x3b493c[_0xb3ee('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x158234,null))[_0xb3ee('0x4d')](function(_0x3e5ae3){if(_0x3e5ae3){_0x535ec3[_0xb3ee('0x2a')]=_0x3e5ae3['get']({'plain':!![]});return db[_0xb3ee('0x60')][_0xb3ee('0x58')]({'where':{'id':_0x3e5ae3[_0xb3ee('0x61')]}});}return null;})[_0xb3ee('0x4d')](handleEntityNotFound(_0x158234,null))['then'](function(_0x3cb46c){if(_0x3cb46c){_0x535ec3[_0xb3ee('0x65')]=_0x3cb46c[_0xb3ee('0x78')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3b493c[_0xb3ee('0x5e')]['id'],_0x3b493c[_0xb3ee('0x5e')][_0xb3ee('0x39')],_0x3b493c[_0xb3ee('0x5e')][_0xb3ee('0x66')],_0x535ec3['interaction']['id'],_0x3b493c[_0xb3ee('0x57')]?JSON['stringify'](_0x3b493c[_0xb3ee('0x57')]):'null');return respondWithRpcPromise(_0xb3ee('0x79'),_0xb3ee('0x7a'),_0x535ec3);}return null;})['then'](function(_0x5711d1){var _0x19e35e=_0xb3ee('0x7b')+_0x5711d1[_0xb3ee('0x2a')][_0xb3ee('0x69')];return db[_0xb3ee('0x6a')]['query'](_0x19e35e,{'type':db['Sequelize'][_0xb3ee('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x33265b){return _0x33265b;});})[_0xb3ee('0x4d')](function(_0x1a01b8){if(_0x1a01b8){_0x535ec3[_0xb3ee('0x2a')][_0xb3ee('0x7c')]=_0x1a01b8[0x0];if(!_0x3b493c['body'][_0xb3ee('0x5d')])return;return db[_0xb3ee('0x6e')][_0xb3ee('0x58')]({'where':{'id':_0x3b493c[_0xb3ee('0x57')][_0xb3ee('0x5d')],'role':_0xb3ee('0x5f')},'attributes':['id','name',_0xb3ee('0x7d'),_0xb3ee('0x6f'),'internal'],'raw':!![]});}return null;})[_0xb3ee('0x4d')](function(_0x770a0b){if(!_0x770a0b)return null;_0x535ec3['message'][_0xb3ee('0x5f')]=_0x770a0b;return _0x535ec3;})['then'](function(_0x2cf57f){if(_0x2cf57f){_0x2cf57f[_0xb3ee('0x2a')]['interface']=util[_0xb3ee('0x7e')](_0xb3ee('0x72'),_0x3b493c[_0xb3ee('0x5e')]['name']);_0x2cf57f['message'][_0xb3ee('0x73')]=_0x535ec3[_0xb3ee('0x73')];_0x2cf57f[_0xb3ee('0x2a')][_0xb3ee('0x74')]=_0x535ec3[_0xb3ee('0x73')];_0x2cf57f['message'][_0xb3ee('0x75')]=_0xb3ee('0x36');respondWithRpcPromise(_0xb3ee('0x7f'),'EventManager',{'event':'rejectmessage','message':_0x2cf57f[_0xb3ee('0x2a')]},client9002);return _0x535ec3;}return null;})[_0xb3ee('0x4d')](respondWithResult(_0x158234,null))[_0xb3ee('0x2c')](handleError(_0x158234,null));};exports['status']=function(_0x4b7e6f,_0x740c00,_0x31d28b){if(_0x4b7e6f[_0xb3ee('0x57')]['id']){delete _0x4b7e6f[_0xb3ee('0x57')]['id'];}var _0x311493;return db['WhatsappMessage'][_0xb3ee('0x58')]({'where':{'id':_0x4b7e6f[_0xb3ee('0x52')]['id']}})['then'](handleEntityNotFound(_0x740c00,null))[_0xb3ee('0x4d')](function(_0x5d9321){if(_0x5d9321){_0x311493=_0x5d9321;return db[_0xb3ee('0x80')][_0xb3ee('0x58')]({'where':{'id':_0x5d9321[_0xb3ee('0x81')]}});}})[_0xb3ee('0x4d')](handleEntityNotFound(_0x740c00,null))[_0xb3ee('0x4d')](function(_0x17437c){if(_0x17437c){logger[_0xb3ee('0x82')](_0xb3ee('0x83'),_0xb3ee('0x2e'),_0xb3ee('0x84'),_0x17437c[_0xb3ee('0x3d')],util[_0xb3ee('0x85')](_0x4b7e6f[_0xb3ee('0x57')],{'showHidden':![],'depth':null}));switch(_0x17437c[_0xb3ee('0x3d')]){case _0xb3ee('0x86'):if(_0x4b7e6f[_0xb3ee('0x57')]['MessageSid']&&_0x4b7e6f['body']['MessageSid']===_0x311493['messageId']&&_0x4b7e6f[_0xb3ee('0x57')][_0xb3ee('0x87')]&&_0x4b7e6f[_0xb3ee('0x57')]['MessageStatus']===_0xb3ee('0x88')){return _0x311493[_0xb3ee('0x62')]({'read':!![]});}else{logger[_0xb3ee('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0xb3ee('0x86'),util[_0xb3ee('0x85')](_0x4b7e6f['body'],{'showHidden':![],'depth':null}));}break;}return _0x311493;}})[_0xb3ee('0x4d')](respondWithResult(_0x740c00,null))[_0xb3ee('0x2c')](handleError(_0x740c00,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 868b2fa..ab011ec 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 _0x9d9b=['save','remove','emit','hasOwnProperty','exports','../../mysqldb','WhatsappMessage'];(function(_0x187943,_0x1f9f5c){var _0x475fd0=function(_0x291272){while(--_0x291272){_0x187943['push'](_0x187943['shift']());}};_0x475fd0(++_0x1f9f5c);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x164d35,_0x4c309e){_0x164d35=_0x164d35-0x0;var _0x3536a6=_0x9d9b[_0x164d35];return _0x3536a6;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xb9d9('0x0'))['db'][_0xb9d9('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb9d9('0x2'),'afterUpdate':'update','afterDestroy':_0xb9d9('0x3')};function emitEvent(_0x19d86d){return function(_0x2fd7d5,_0x55b2c3,_0x3bac8c){WhatsappMessageEvents['emit'](_0x19d86d+':'+_0x2fd7d5['id'],_0x2fd7d5);WhatsappMessageEvents[_0xb9d9('0x4')](_0x19d86d,_0x2fd7d5);_0x3bac8c(null);};}for(var e in events){if(events[_0xb9d9('0x5')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xb9d9('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0xd547=['hook','WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x44feb5,_0x3f7964){var _0x45e3b8=function(_0x2848be){while(--_0x2848be){_0x44feb5['push'](_0x44feb5['shift']());}};_0x45e3b8(++_0x3f7964);}(_0xd547,0x1c1));var _0x7d54=function(_0x5ee2db,_0x47ea25){_0x5ee2db=_0x5ee2db-0x0;var _0x2cab07=_0xd547[_0x5ee2db];return _0x2cab07;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x7d54('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7d54('0x1')](0x0);var events={'afterCreate':_0x7d54('0x2'),'afterUpdate':_0x7d54('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4ab00b){return function(_0x21c23f,_0x5d21c1,_0x22ea09){WhatsappMessageEvents['emit'](_0x4ab00b+':'+_0x21c23f['id'],_0x21c23f);WhatsappMessageEvents[_0x7d54('0x4')](_0x4ab00b,_0x21c23f);_0x22ea09(null);};}for(var e in events){if(events[_0x7d54('0x5')](e)){var event=events[e];WhatsappMessage[_0x7d54('0x6')](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 c62813c..170d4de 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 _0x7140=['WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','WhatsappInteractionId','update','createdAt','WhatsappAccount','find','then','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','token','sid','catch','error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','message_id','statuses','err'];(function(_0xf83277,_0x55487e){var _0x361e0e=function(_0xa2b602){while(--_0xa2b602){_0xf83277['push'](_0xf83277['shift']());}};_0x361e0e(++_0x55487e);}(_0x7140,0xbb));var _0x0714=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0x7140[_0x545bed];return _0x16c79c;};'use strict';var _=require(_0x0714('0x0'));var util=require(_0x0714('0x1'));var logger=require(_0x0714('0x2'))(_0x0714('0x3'));var moment=require(_0x0714('0x4'));var BPromise=require(_0x0714('0x5'));var rp=require('request-promise');var fetch=require(_0x0714('0x6'));var fs=require('fs');var path=require(_0x0714('0x7'));var rimraf=require(_0x0714('0x8'));var config=require(_0x0714('0x9'));var attributes=require(_0x0714('0xa'));module[_0x0714('0xb')]=function(_0x4faa0c,_0x38c9f2){return _0x4faa0c['define'](_0x0714('0xc'),attributes,{'tableName':_0x0714('0xd'),'paranoid':![],'indexes':[{'name':_0x0714('0xe'),'fields':[_0x0714('0xe')]},{'name':_0x0714('0xf'),'fields':[_0x0714('0x10')],'type':_0x0714('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x144504,_0x5dca07,_0x47f1ac){var _0x3eb198=_0x4faa0c[_0x0714('0x12')];var _0x41fe90=_0x144504[_0x0714('0x13')]({'plain':!![]});if(_0x41fe90[_0x0714('0x14')][_0x0714('0x15')]()==='in'||_0x41fe90['direction']['toLowerCase']()===_0x0714('0x16')&&!_0x41fe90[_0x0714('0x17')]&&!_[_0x0714('0x18')](_0x41fe90['UserId'])){_0x3eb198['WhatsappInteraction'][_0x0714('0x19')]({'where':{'id':_0x41fe90[_0x0714('0x1a')]}})['then'](function(_0x47c124){if(_0x47c124){_0x47c124[_0x0714('0x1b')]({'lastMsgAt':_0x41fe90[_0x0714('0x1c')],'lastMsgDirection':_0x41fe90[_0x0714('0x14')][_0x0714('0x15')]()});}})['catch'](function(_0xac3e3a){console['error'](_0xac3e3a);});}if(_0x41fe90['direction']===_0x0714('0x16')&&!_0x41fe90[_0x0714('0x17')]){var _0x2569d4;_0x3eb198[_0x0714('0x1d')][_0x0714('0x1e')]({'where':{'id':_0x41fe90['WhatsappAccountId']},'raw':!![]})[_0x0714('0x1f')](function(_0x596ac7){_0x2569d4=_0x596ac7;if(_0x2569d4&&_0x2569d4[_0x0714('0x20')]){switch(_0x2569d4['type']){case'twilio':var _0x2140fa=require(_0x0714('0x21'));if(_0x2569d4[_0x0714('0x22')]&&_0x2569d4['authToken']&&_0x2569d4[_0x0714('0x23')]){var _0x41f22f=new _0x2140fa(_0x2569d4[_0x0714('0x22')],_0x2569d4[_0x0714('0x24')]);_0x41f22f[_0x0714('0x25')][_0x0714('0x26')]({'body':_0x41fe90[_0x0714('0x10')],'to':_0x0714('0x27')+_0x41fe90[_0x0714('0x23')],'from':_0x0714('0x27')+_0x2569d4['phone'],'statusCallback':_0x2569d4['remote']+'/api/whatsapp/messages/'+_0x41fe90['id']+'/status?token='+_0x2569d4[_0x0714('0x28')]})[_0x0714('0x1f')](function(_0x3230a5){if(_0x3230a5[_0x0714('0x29')]){return _0x144504[_0x0714('0x1b')]({'messageId':_0x3230a5[_0x0714('0x29')]});}})[_0x0714('0x2a')](function(_0x34d4be){logger[_0x0714('0x2b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x0714('0x2c'),'twilio',util[_0x0714('0x2d')](_0x34d4be,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0714('0x2e'),_0x0714('0x2c'),'twilio',_0x0714('0x2f'));}break;case'sinch':var _0x325cf2=_0x2569d4[_0x0714('0x22')];var _0x34b8d0=_0x2569d4[_0x0714('0x24')];var _0x4e926a=_0x2569d4[_0x0714('0x30')]+_0x0714('0x31')+_0x325cf2+_0x0714('0x32');var _0x3111be={'to':[_0x41fe90['phone']],'message':{'type':_0x0714('0x33'),'text':_0x41fe90[_0x0714('0x10')]}};var _0x6b6f97={'method':'POST','uri':_0x4e926a,'headers':{'Authorization':_0x0714('0x34')+_0x34b8d0,'Content-Type':_0x0714('0x35')},'body':_0x3111be,'json':!![]};rp(_0x6b6f97)['then'](function(_0xcd5273){if(_0xcd5273['statuses'][0x0][_0x0714('0x36')]){return _0x144504['update']({'messageId':_0xcd5273[_0x0714('0x37')][0x0]['message_id']});}})[_0x0714('0x2a')](function(_0x3d63e0){logger[_0x0714('0x38')](_0x0714('0x39'),_0x3d63e0);});break;}}})[_0x0714('0x3a')](function(){_0x47f1ac();});}else{_0x47f1ac();}}},'charset':_0x0714('0x3b'),'collate':_0x0714('0x3c')});}; \ No newline at end of file +var _0xddce=['../../config/environment','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','create','whatsapp:','phone','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','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','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xddce,0x171));var _0xeddc=function(_0x31783f,_0x4f888){_0x31783f=_0x31783f-0x0;var _0x38f24a=_0xddce[_0x31783f];return _0x38f24a;};'use strict';var _=require('lodash');var util=require(_0xeddc('0x0'));var logger=require(_0xeddc('0x1'))(_0xeddc('0x2'));var moment=require(_0xeddc('0x3'));var BPromise=require(_0xeddc('0x4'));var rp=require(_0xeddc('0x5'));var fetch=require(_0xeddc('0x6'));var fs=require('fs');var path=require(_0xeddc('0x7'));var rimraf=require(_0xeddc('0x8'));var config=require(_0xeddc('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0xeddc('0xa')]=function(_0x5ed49e,_0x52579f){return _0x5ed49e['define'](_0xeddc('0xb'),attributes,{'tableName':_0xeddc('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xeddc('0xd')]},{'name':_0xeddc('0xe'),'fields':[_0xeddc('0xf')],'type':_0xeddc('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f6e84,_0xe3a587,_0x34f99d){var _0x5f7453=_0x5ed49e[_0xeddc('0x11')];var _0x1260aa=_0x2f6e84['get']({'plain':!![]});if(_0x1260aa[_0xeddc('0x12')]['toLowerCase']()==='in'||_0x1260aa[_0xeddc('0x12')][_0xeddc('0x13')]()===_0xeddc('0x14')&&!_0x1260aa[_0xeddc('0x15')]&&!_[_0xeddc('0x16')](_0x1260aa[_0xeddc('0x17')])){_0x5f7453[_0xeddc('0x18')][_0xeddc('0x19')]({'where':{'id':_0x1260aa[_0xeddc('0x1a')]}})[_0xeddc('0x1b')](function(_0x292b98){if(_0x292b98){_0x292b98[_0xeddc('0x1c')]({'lastMsgAt':_0x1260aa[_0xeddc('0x1d')],'lastMsgDirection':_0x1260aa[_0xeddc('0x12')]['toLowerCase']()});}})[_0xeddc('0x1e')](function(_0x219ca2){console['error'](_0x219ca2);});}if(_0x1260aa[_0xeddc('0x12')]===_0xeddc('0x14')&&!_0x1260aa[_0xeddc('0x15')]){var _0x51d70d;_0x5f7453[_0xeddc('0x1f')]['find']({'where':{'id':_0x1260aa[_0xeddc('0x20')]},'raw':!![]})['then'](function(_0x5d6342){_0x51d70d=_0x5d6342;if(_0x51d70d&&_0x51d70d[_0xeddc('0x21')]){switch(_0x51d70d[_0xeddc('0x21')]){case _0xeddc('0x22'):var _0x1ba975=require(_0xeddc('0x22'));if(_0x51d70d[_0xeddc('0x23')]&&_0x51d70d[_0xeddc('0x24')]&&_0x51d70d['phone']){var _0x4d5b2b=new _0x1ba975(_0x51d70d[_0xeddc('0x23')],_0x51d70d[_0xeddc('0x24')]);_0x4d5b2b['messages'][_0xeddc('0x25')]({'body':_0x1260aa[_0xeddc('0xf')],'to':_0xeddc('0x26')+_0x1260aa['phone'],'from':_0xeddc('0x26')+_0x51d70d[_0xeddc('0x27')],'statusCallback':_0x51d70d['remote']+_0xeddc('0x28')+_0x1260aa['id']+_0xeddc('0x29')+_0x51d70d[_0xeddc('0x2a')]})['then'](function(_0x59979b){if(_0x59979b[_0xeddc('0x2b')]){return _0x2f6e84[_0xeddc('0x1c')]({'messageId':_0x59979b[_0xeddc('0x2b')]});}})[_0xeddc('0x1e')](function(_0x2e6730){logger['error'](_0xeddc('0x2c'),_0xeddc('0x2d'),_0xeddc('0x22'),util[_0xeddc('0x2e')](_0x2e6730,{'showHidden':![],'depth':null}));});}else{logger[_0xeddc('0x2f')](_0xeddc('0x2c'),_0xeddc('0x2d'),_0xeddc('0x22'),_0xeddc('0x30'));}break;case _0xeddc('0x31'):var _0x545e4e=_0x51d70d[_0xeddc('0x23')];var _0x4cda5d=_0x51d70d['authToken'];var _0x54162e=_0x51d70d[_0xeddc('0x32')]+_0xeddc('0x33')+_0x545e4e+_0xeddc('0x34');var _0xfc997a={'to':[_0x1260aa[_0xeddc('0x27')]],'message':{'type':'text','text':_0x1260aa['body']}};var _0x1ea2a6={'method':_0xeddc('0x35'),'uri':_0x54162e,'headers':{'Authorization':_0xeddc('0x36')+_0x4cda5d,'Content-Type':_0xeddc('0x37')},'body':_0xfc997a,'json':!![]};rp(_0x1ea2a6)[_0xeddc('0x1b')](function(_0x40ce91){if(_0x40ce91[_0xeddc('0x38')][0x0][_0xeddc('0x39')]){return _0x2f6e84[_0xeddc('0x1c')]({'messageId':_0x40ce91[_0xeddc('0x38')][0x0][_0xeddc('0x39')]});}})[_0xeddc('0x1e')](function(_0x5bb55b){logger[_0xeddc('0x3a')](_0xeddc('0x3b'),_0x5bb55b);});break;}}})[_0xeddc('0x3c')](function(){_0x34f99d();});}else{_0x34f99d();}}},'charset':_0xeddc('0x3d'),'collate':_0xeddc('0x3e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 66cb7c5..d5e9c4d 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 _0xe016=['then','info','debug','request\x20sent','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xe016,0x17b));var _0x6e01=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xe016[_0x45d55e];return _0x29812a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e01('0x0'));var BPromise=require(_0x6e01('0x1'));var rs=require(_0x6e01('0x2'));var fs=require('fs');var Redis=require(_0x6e01('0x3'));var db=require(_0x6e01('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e01('0x5'))(_0x6e01('0x6'));var config=require(_0x6e01('0x7'));var jayson=require(_0x6e01('0x8'));var client=jayson['client'][_0x6e01('0x9')]({'port':0x232a});config[_0x6e01('0xa')]=_[_0x6e01('0xb')](config[_0x6e01('0xa')],{'host':_0x6e01('0xc'),'port':0x18eb});var socket=require(_0x6e01('0xd'))(new Redis(config[_0x6e01('0xa')]));require(_0x6e01('0xe'))[_0x6e01('0xf')](socket);function respondWithRpcPromise(_0x16d2dc,_0x501d8f,_0x3ef08b){return new BPromise(function(_0x1c472a,_0x164110){return client[_0x6e01('0x10')](_0x16d2dc,_0x3ef08b)[_0x6e01('0x11')](function(_0x30fa67){logger[_0x6e01('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x501d8f,'request\x20sent');logger[_0x6e01('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x501d8f,_0x6e01('0x14'),JSON['stringify'](_0x30fa67));if(_0x30fa67['error']){if(_0x30fa67[_0x6e01('0x15')][_0x6e01('0x16')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x501d8f,_0x30fa67[_0x6e01('0x15')]['message']);return _0x164110(_0x30fa67[_0x6e01('0x15')][_0x6e01('0x17')]);}logger[_0x6e01('0x15')](_0x6e01('0x18'),_0x501d8f,_0x30fa67['error'][_0x6e01('0x17')]);return _0x1c472a(_0x30fa67[_0x6e01('0x15')][_0x6e01('0x17')]);}else{logger[_0x6e01('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x501d8f,_0x6e01('0x14'));_0x1c472a(_0x30fa67[_0x6e01('0x19')]['message']);}})[_0x6e01('0x1a')](function(_0x4d1b00){logger[_0x6e01('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x501d8f,_0x4d1b00);_0x164110(_0x4d1b00);});});}exports[_0x6e01('0x1b')]=function(_0x32aa32){var _0x125c08=this;return new Promise(function(_0xebdb91,_0x29a6e1){return db[_0x6e01('0x1c')]['create'](_0x32aa32[_0x6e01('0x1d')],{'raw':_0x32aa32[_0x6e01('0x1e')]?_0x32aa32[_0x6e01('0x1e')][_0x6e01('0x1f')]===undefined?!![]:![]:!![]})[_0x6e01('0x11')](function(_0x181862){logger[_0x6e01('0x12')](_0x6e01('0x1b'),_0x32aa32);logger[_0x6e01('0x13')](_0x6e01('0x1b'),_0x32aa32,JSON[_0x6e01('0x20')](_0x181862));_0xebdb91(_0x181862);})[_0x6e01('0x1a')](function(_0xf79fc7){logger[_0x6e01('0x15')]('CreateWhatsappMessage',_0xf79fc7[_0x6e01('0x17')],_0x32aa32);_0x29a6e1(_0x125c08[_0x6e01('0x15')](0x1f4,_0xf79fc7[_0x6e01('0x17')]));});});}; \ No newline at end of file +var _0xb0dd=['error','code','message','catch','WhatsappMessage','options','then','CreateWhatsappMessage','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dda0f,_0x5b9902){var _0x1b0488=function(_0x267031){while(--_0x267031){_0x3dda0f['push'](_0x3dda0f['shift']());}};_0x1b0488(++_0x5b9902);}(_0xb0dd,0x1a8));var _0xdb0d=function(_0x30afd1,_0x5c5071){_0x30afd1=_0x30afd1-0x0;var _0x8c73fe=_0xb0dd[_0x30afd1];return _0x8c73fe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdb0d('0x0'));var BPromise=require(_0xdb0d('0x1'));var rs=require(_0xdb0d('0x2'));var fs=require('fs');var Redis=require(_0xdb0d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb0d('0x4'));var logger=require('../../config/logger')(_0xdb0d('0x5'));var config=require('../../config/environment');var jayson=require(_0xdb0d('0x6'));var client=jayson[_0xdb0d('0x7')][_0xdb0d('0x8')]({'port':0x232a});config['redis']=_[_0xdb0d('0x9')](config[_0xdb0d('0xa')],{'host':_0xdb0d('0xb'),'port':0x18eb});var socket=require(_0xdb0d('0xc'))(new Redis(config[_0xdb0d('0xa')]));require('./whatsappMessage.socket')[_0xdb0d('0xd')](socket);function respondWithRpcPromise(_0x57e5bb,_0x14b6b2,_0x3ec75c){return new BPromise(function(_0x458b38,_0x15e196){return client['request'](_0x57e5bb,_0x3ec75c)['then'](function(_0x26e4a7){logger[_0xdb0d('0xe')](_0xdb0d('0xf'),_0x14b6b2,_0xdb0d('0x10'));logger[_0xdb0d('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x14b6b2,_0xdb0d('0x10'),JSON['stringify'](_0x26e4a7));if(_0x26e4a7[_0xdb0d('0x12')]){if(_0x26e4a7[_0xdb0d('0x12')][_0xdb0d('0x13')]===0x1f4){logger[_0xdb0d('0x12')](_0xdb0d('0xf'),_0x14b6b2,_0x26e4a7[_0xdb0d('0x12')][_0xdb0d('0x14')]);return _0x15e196(_0x26e4a7['error']['message']);}logger[_0xdb0d('0x12')](_0xdb0d('0xf'),_0x14b6b2,_0x26e4a7[_0xdb0d('0x12')][_0xdb0d('0x14')]);return _0x458b38(_0x26e4a7[_0xdb0d('0x12')][_0xdb0d('0x14')]);}else{logger[_0xdb0d('0xe')](_0xdb0d('0xf'),_0x14b6b2,_0xdb0d('0x10'));_0x458b38(_0x26e4a7['result'][_0xdb0d('0x14')]);}})[_0xdb0d('0x15')](function(_0x358077){logger[_0xdb0d('0x12')](_0xdb0d('0xf'),_0x14b6b2,_0x358077);_0x15e196(_0x358077);});});}exports['CreateWhatsappMessage']=function(_0x4927cd){var _0xc4e0d9=this;return new Promise(function(_0x40ca16,_0x482077){return db[_0xdb0d('0x16')]['create'](_0x4927cd['body'],{'raw':_0x4927cd[_0xdb0d('0x17')]?_0x4927cd[_0xdb0d('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xdb0d('0x18')](function(_0x20873d){logger['info'](_0xdb0d('0x19'),_0x4927cd);logger[_0xdb0d('0x11')]('CreateWhatsappMessage',_0x4927cd,JSON['stringify'](_0x20873d));_0x40ca16(_0x20873d);})['catch'](function(_0xdc1a9b){logger[_0xdb0d('0x12')](_0xdb0d('0x19'),_0xdc1a9b[_0xdb0d('0x14')],_0x4927cd);_0x482077(_0xc4e0d9['error'](0x1f4,_0xdc1a9b[_0xdb0d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f48f4a7..c1db3e4 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 _0x22ef=['update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','remove'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x22ef,0x146));var _0xf22e=function(_0x9f5c4c,_0x56a089){_0x9f5c4c=_0x9f5c4c-0x0;var _0x37aa93=_0x22ef[_0x9f5c4c];return _0x37aa93;};'use strict';var WhatsappMessageEvents=require(_0xf22e('0x0'));var events=['save',_0xf22e('0x1'),_0xf22e('0x2')];function createListener(_0x23ab5e,_0x8a1891){return function(_0x563acf){_0x8a1891[_0xf22e('0x3')](_0x23ab5e,_0x563acf);};}function removeListener(_0x1a72a1,_0x18c66f){return function(){WhatsappMessageEvents[_0xf22e('0x4')](_0x1a72a1,_0x18c66f);};}exports[_0xf22e('0x5')]=function(_0x2b7a35){for(var _0x5220c5=0x0,_0x5eb83e=events[_0xf22e('0x6')];_0x5220c5<_0x5eb83e;_0x5220c5++){var _0xd80431=events[_0x5220c5];var _0x157a33=createListener(_0xf22e('0x7')+_0xd80431,_0x2b7a35);WhatsappMessageEvents['on'](_0xd80431,_0x157a33);}}; \ No newline at end of file +var _0xb8c1=['update','emit','removeListener','whatsappMessage:','./whatsappMessage.events','remove'];(function(_0xd2f436,_0x3a563f){var _0x72545f=function(_0x279813){while(--_0x279813){_0xd2f436['push'](_0xd2f436['shift']());}};_0x72545f(++_0x3a563f);}(_0xb8c1,0x64));var _0x1b8c=function(_0x461e9b,_0x279550){_0x461e9b=_0x461e9b-0x0;var _0x1af16c=_0xb8c1[_0x461e9b];return _0x1af16c;};'use strict';var WhatsappMessageEvents=require(_0x1b8c('0x0'));var events=['save',_0x1b8c('0x1'),_0x1b8c('0x2')];function createListener(_0x44d9ba,_0x314ef1){return function(_0x4550f0){_0x314ef1[_0x1b8c('0x3')](_0x44d9ba,_0x4550f0);};}function removeListener(_0x33800e,_0x215073){return function(){WhatsappMessageEvents[_0x1b8c('0x4')](_0x33800e,_0x215073);};}exports['register']=function(_0x5169a4){for(var _0x505e94=0x0,_0x253d9c=events['length'];_0x505e94<_0x253d9c;_0x505e94++){var _0x2ba04a=events[_0x505e94];var _0x3ca7aa=createListener(_0x1b8c('0x5')+_0x2ba04a,_0x5169a4);WhatsappMessageEvents['on'](_0x2ba04a,_0x3ca7aa);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 221b369..06aea2f 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 _0x16bb=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util'];(function(_0x168180,_0x55594a){var _0x5067a7=function(_0x705445){while(--_0x705445){_0x168180['push'](_0x168180['shift']());}};_0x5067a7(++_0x55594a);}(_0x16bb,0x1eb));var _0xb16b=function(_0xb67da5,_0x16bf3f){_0xb67da5=_0xb67da5-0x0;var _0x38df4d=_0x16bb[_0xb67da5];return _0x38df4d;};'use strict';var multer=require(_0xb16b('0x0'));var util=require(_0xb16b('0x1'));var path=require(_0xb16b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb16b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb16b('0x4'));var interaction=require(_0xb16b('0x5'));var config=require(_0xb16b('0x6'));var controller=require(_0xb16b('0x7'));router['get']('/',auth[_0xb16b('0x8')](),controller[_0xb16b('0x9')]);router[_0xb16b('0xa')]('/describe',auth[_0xb16b('0x8')](),controller[_0xb16b('0xb')]);router[_0xb16b('0xa')]('/:id',auth[_0xb16b('0x8')](),controller[_0xb16b('0xc')]);router['get'](_0xb16b('0xd'),auth[_0xb16b('0x8')](),controller[_0xb16b('0xe')]);router['get'](_0xb16b('0xf'),auth[_0xb16b('0x8')](),controller[_0xb16b('0x10')]);router[_0xb16b('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xb16b('0x11')]);router[_0xb16b('0x12')]('/',auth[_0xb16b('0x8')](),controller['create']);router[_0xb16b('0x12')](_0xb16b('0xf'),auth[_0xb16b('0x8')](),controller[_0xb16b('0x13')]);router[_0xb16b('0x12')](_0xb16b('0x14'),auth[_0xb16b('0x8')](),controller[_0xb16b('0x15')]);router[_0xb16b('0x16')](_0xb16b('0x17'),auth[_0xb16b('0x8')](),controller[_0xb16b('0x18')]);router[_0xb16b('0x19')]('/:id',auth[_0xb16b('0x8')](),controller[_0xb16b('0x1a')]);router['delete'](_0xb16b('0xf'),auth[_0xb16b('0x8')](),controller[_0xb16b('0x1b')]);router['delete'](_0xb16b('0x14'),auth['isAuthenticated'](),controller[_0xb16b('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xc0d2=['index','describe','/:id','show','/:id/members','/:id/teams','getAgents','create','post','addTeams','/:id/users','addAgents','put','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated'];(function(_0xac19ee,_0x37689b){var _0x2871d1=function(_0x53c5b2){while(--_0x53c5b2){_0xac19ee['push'](_0xac19ee['shift']());}};_0x2871d1(++_0x37689b);}(_0xc0d2,0x1b5));var _0x2c0d=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xc0d2[_0x36eaaa];return _0x461349;};'use strict';var multer=require(_0x2c0d('0x0'));var util=require(_0x2c0d('0x1'));var path=require(_0x2c0d('0x2'));var timeout=require('connect-timeout');var express=require(_0x2c0d('0x3'));var router=express[_0x2c0d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2c0d('0x5'));var interaction=require(_0x2c0d('0x6'));var config=require(_0x2c0d('0x7'));var controller=require(_0x2c0d('0x8'));router[_0x2c0d('0x9')]('/',auth[_0x2c0d('0xa')](),controller[_0x2c0d('0xb')]);router[_0x2c0d('0x9')]('/describe',auth[_0x2c0d('0xa')](),controller[_0x2c0d('0xc')]);router[_0x2c0d('0x9')](_0x2c0d('0xd'),auth[_0x2c0d('0xa')](),controller[_0x2c0d('0xe')]);router[_0x2c0d('0x9')](_0x2c0d('0xf'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x2c0d('0x10'),auth[_0x2c0d('0xa')](),controller['getTeams']);router[_0x2c0d('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x2c0d('0x11')]);router['post']('/',auth[_0x2c0d('0xa')](),controller[_0x2c0d('0x12')]);router[_0x2c0d('0x13')](_0x2c0d('0x10'),auth[_0x2c0d('0xa')](),controller[_0x2c0d('0x14')]);router[_0x2c0d('0x13')](_0x2c0d('0x15'),auth['isAuthenticated'](),controller[_0x2c0d('0x16')]);router[_0x2c0d('0x17')]('/:id',auth[_0x2c0d('0xa')](),controller['update']);router[_0x2c0d('0x18')](_0x2c0d('0xd'),auth[_0x2c0d('0xa')](),controller['destroy']);router[_0x2c0d('0x18')](_0x2c0d('0x10'),auth[_0x2c0d('0xa')](),controller[_0x2c0d('0x19')]);router['delete']('/:id/users',auth[_0x2c0d('0xa')](),controller[_0x2c0d('0x1a')]);module[_0x2c0d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 07ff435..7819e03 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 _0x76a3=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x5bb3b2,_0x512954){var _0xbd9087=function(_0x4da464){while(--_0x4da464){_0x5bb3b2['push'](_0x5bb3b2['shift']());}};_0xbd9087(++_0x512954);}(_0x76a3,0xf8));var _0x376a=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0x76a3[_0x15942a];return _0x36a9fb;};'use strict';var Sequelize=require(_0x376a('0x0'));module[_0x376a('0x1')]={'name':{'type':Sequelize[_0x376a('0x2')],'unique':_0x376a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x376a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x376a('0x5')](_0x376a('0x6'),_0x376a('0x7'),_0x376a('0x8'))},'description':{'type':Sequelize[_0x376a('0x2')]}}; \ No newline at end of file +var _0x99e9=['name','INTEGER','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x99e9,0xb4));var _0x999e=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0x99e9[_0x12d951];return _0x44de17;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')],'unique':_0x999e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x999e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x999e('0x4'),_0x999e('0x5'),_0x999e('0x6'))},'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 c742979..27ddf9d 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 _0xfcc3=['options','show','attributes','includeAll','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAll','User','findAndCountAll','agent','whatsappPause','createdAt','rows','format','%s/%s','updatedAt','params','Team','getTeams','hasOwnProperty','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','every','all','union','compact','value','removeTeams','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','userWhatsappQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','length','model','nolimit','order','sort','pick','filter','where','merge'];(function(_0x504fb5,_0x33620f){var _0x31fda5=function(_0x4bc889){while(--_0x4bc889){_0x504fb5['push'](_0x504fb5['shift']());}};_0x31fda5(++_0x33620f);}(_0xfcc3,0x159));var _0x3fcc=function(_0x528531,_0x200c73){_0x528531=_0x528531-0x0;var _0x2719fc=_0xfcc3[_0x528531];return _0x2719fc;};'use strict';var emlformat=require(_0x3fcc('0x0'));var rimraf=require(_0x3fcc('0x1'));var zipdir=require(_0x3fcc('0x2'));var jsonpatch=require(_0x3fcc('0x3'));var rp=require(_0x3fcc('0x4'));var moment=require(_0x3fcc('0x5'));var BPromise=require(_0x3fcc('0x6'));var Mustache=require(_0x3fcc('0x7'));var util=require(_0x3fcc('0x8'));var path=require(_0x3fcc('0x9'));var sox=require('sox');var csv=require(_0x3fcc('0xa'));var ejs=require(_0x3fcc('0xb'));var fs=require('fs');var fs_extra=require(_0x3fcc('0xc'));var _=require(_0x3fcc('0xd'));var squel=require(_0x3fcc('0xe'));var crypto=require('crypto');var jsforce=require(_0x3fcc('0xf'));var deskjs=require(_0x3fcc('0x10'));var toCsv=require(_0x3fcc('0xa'));var querystring=require(_0x3fcc('0x11'));var Papa=require('papaparse');var Redis=require(_0x3fcc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3fcc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3fcc('0x14'));var logger=require(_0x3fcc('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3fcc('0x16'));var db=require('../../mysqldb')['db'];config[_0x3fcc('0x17')]=_[_0x3fcc('0x18')](config['redis'],{'host':_0x3fcc('0x19'),'port':0x18eb});var socket=require(_0x3fcc('0x1a'))(new Redis(config[_0x3fcc('0x17')]));require(_0x3fcc('0x1b'))[_0x3fcc('0x1c')](socket);function respondWithStatusCode(_0x5e1107,_0x1b52fa){_0x1b52fa=_0x1b52fa||0xcc;return function(_0x3f8296){if(_0x3f8296){return _0x5e1107['sendStatus'](_0x1b52fa);}return _0x5e1107['status'](_0x1b52fa)['end']();};}function respondWithResult(_0x3ac6aa,_0x1457b9){_0x1457b9=_0x1457b9||0xc8;return function(_0x621fa3){if(_0x621fa3){return _0x3ac6aa[_0x3fcc('0x1d')](_0x1457b9)['json'](_0x621fa3);}};}function respondWithFilteredResult(_0x3d8898,_0x28887){return function(_0x214822){if(_0x214822){var _0x5764ba=typeof _0x28887[_0x3fcc('0x1e')]==='undefined'&&typeof _0x28887[_0x3fcc('0x1f')]===_0x3fcc('0x20');var _0x5bfa73=_0x214822[_0x3fcc('0x21')];var _0x4fa712=_0x5764ba?0x0:_0x28887[_0x3fcc('0x1e')];var _0x3644f2=_0x5764ba?_0x214822[_0x3fcc('0x21')]:_0x28887[_0x3fcc('0x1e')]+_0x28887[_0x3fcc('0x1f')];var _0x28a50b;if(_0x3644f2>=_0x5bfa73){_0x3644f2=_0x5bfa73;_0x28a50b=0xc8;}else{_0x28a50b=0xce;}_0x3d8898[_0x3fcc('0x1d')](_0x28a50b);return _0x3d8898[_0x3fcc('0x22')](_0x3fcc('0x23'),_0x4fa712+'-'+_0x3644f2+'/'+_0x5bfa73)[_0x3fcc('0x24')](_0x214822);}return null;};}function patchUpdates(_0x5a6357){return function(_0x244cf1){try{jsonpatch[_0x3fcc('0x25')](_0x244cf1,_0x5a6357,!![]);}catch(_0x1e8de7){return BPromise[_0x3fcc('0x26')](_0x1e8de7);}return _0x244cf1[_0x3fcc('0x27')]();};}function saveUpdates(_0x78495c,_0x14ede1){return function(_0x266535){if(_0x266535){return _0x266535[_0x3fcc('0x28')](_0x78495c)[_0x3fcc('0x29')](function(_0x43815b){return _0x43815b;});}return null;};}function removeEntity(_0x26bb3c,_0x32decb){return function(_0x95e24){if(_0x95e24){return _0x95e24[_0x3fcc('0x2a')]()['then'](function(){var _0x3a981b=_0x95e24[_0x3fcc('0x2b')]({'plain':!![]});var _0x480349=_0x3fcc('0x2c');return db[_0x3fcc('0x2d')][_0x3fcc('0x2a')]({'where':{'type':_0x480349,'resourceId':_0x3a981b['id']}})[_0x3fcc('0x29')](function(){return _0x95e24;});})[_0x3fcc('0x29')](function(){_0x26bb3c[_0x3fcc('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ec343,_0x5e460b){return function(_0x176961){if(!_0x176961){_0x1ec343['sendStatus'](0x194);}return _0x176961;};}function handleError(_0x1a102c,_0x15e1a1){_0x15e1a1=_0x15e1a1||0x1f4;return function(_0x4304d6){logger['error'](_0x4304d6[_0x3fcc('0x2e')]);if(_0x4304d6[_0x3fcc('0x2f')]){delete _0x4304d6['name'];}_0x1a102c[_0x3fcc('0x1d')](_0x15e1a1)[_0x3fcc('0x30')](_0x4304d6);};}exports['index']=function(_0x573ff8,_0x244a70){var _0x3a07a2={},_0xe810b1={},_0x2b74e4={'count':0x0,'rows':[]};var _0x873499=_[_0x3fcc('0x31')](db[_0x3fcc('0x32')][_0x3fcc('0x33')],function(_0x45eb13){return{'name':_0x45eb13[_0x3fcc('0x34')],'type':_0x45eb13[_0x3fcc('0x35')][_0x3fcc('0x36')]};});_0xe810b1['model']=_['map'](_0x873499,'name');_0xe810b1[_0x3fcc('0x37')]=_[_0x3fcc('0x38')](_0x573ff8[_0x3fcc('0x37')]);_0xe810b1[_0x3fcc('0x39')]=_[_0x3fcc('0x3a')](_0xe810b1['model'],_0xe810b1[_0x3fcc('0x37')]);_0x3a07a2['attributes']=_[_0x3fcc('0x3a')](_0xe810b1['model'],qs['fields'](_0x573ff8[_0x3fcc('0x37')][_0x3fcc('0x3b')]));_0x3a07a2['attributes']=_0x3a07a2['attributes'][_0x3fcc('0x3c')]?_0x3a07a2['attributes']:_0xe810b1[_0x3fcc('0x3d')];if(!_0x573ff8[_0x3fcc('0x37')]['hasOwnProperty'](_0x3fcc('0x3e'))){_0x3a07a2[_0x3fcc('0x1f')]=qs[_0x3fcc('0x1f')](_0x573ff8[_0x3fcc('0x37')]['limit']);_0x3a07a2[_0x3fcc('0x1e')]=qs[_0x3fcc('0x1e')](_0x573ff8[_0x3fcc('0x37')]['offset']);}_0x3a07a2[_0x3fcc('0x3f')]=qs[_0x3fcc('0x40')](_0x573ff8['query'][_0x3fcc('0x40')]);_0x3a07a2['where']=qs[_0x3fcc('0x39')](_[_0x3fcc('0x41')](_0x573ff8[_0x3fcc('0x37')],_0xe810b1['filters']),_0x873499);if(_0x573ff8[_0x3fcc('0x37')][_0x3fcc('0x42')]){_0x3a07a2[_0x3fcc('0x43')]=_[_0x3fcc('0x44')](_0x3a07a2[_0x3fcc('0x43')],{'$or':_['map'](_0x873499,function(_0x9b0803){if(_0x9b0803[_0x3fcc('0x35')]!=='VIRTUAL'){var _0x370115={};_0x370115[_0x9b0803[_0x3fcc('0x2f')]]={'$like':'%'+_0x573ff8[_0x3fcc('0x37')][_0x3fcc('0x42')]+'%'};return _0x370115;}})});}_0x3a07a2=_['merge']({},_0x3a07a2,_0x573ff8[_0x3fcc('0x45')]);var _0x586e0b={'where':_0x3a07a2[_0x3fcc('0x43')]};return db[_0x3fcc('0x32')][_0x3fcc('0x21')](_0x586e0b)[_0x3fcc('0x29')](function(_0x43893f){_0x2b74e4[_0x3fcc('0x21')]=_0x43893f;if(_0x573ff8['query']['includeAll']){_0x3a07a2['include']=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x3a07a2);})[_0x3fcc('0x29')](function(_0x391a7f){_0x2b74e4['rows']=_0x391a7f;return _0x2b74e4;})['then'](respondWithFilteredResult(_0x244a70,_0x3a07a2))['catch'](handleError(_0x244a70,null));};exports[_0x3fcc('0x46')]=function(_0x52db2e,_0x2ea5a4){var _0xf3855b={'raw':!![],'where':{'id':_0x52db2e['params']['id']}},_0xccb036={};_0xccb036[_0x3fcc('0x3d')]=_[_0x3fcc('0x38')](db['WhatsappQueue'][_0x3fcc('0x33')]);_0xccb036[_0x3fcc('0x37')]=_[_0x3fcc('0x38')](_0x52db2e[_0x3fcc('0x37')]);_0xccb036[_0x3fcc('0x39')]=_[_0x3fcc('0x3a')](_0xccb036[_0x3fcc('0x3d')],_0xccb036[_0x3fcc('0x37')]);_0xf3855b[_0x3fcc('0x47')]=_[_0x3fcc('0x3a')](_0xccb036[_0x3fcc('0x3d')],qs['fields'](_0x52db2e[_0x3fcc('0x37')][_0x3fcc('0x3b')]));_0xf3855b['attributes']=_0xf3855b[_0x3fcc('0x47')][_0x3fcc('0x3c')]?_0xf3855b[_0x3fcc('0x47')]:_0xccb036[_0x3fcc('0x3d')];if(_0x52db2e['query'][_0x3fcc('0x48')]){_0xf3855b[_0x3fcc('0x49')]=[{'all':!![]}];}_0xf3855b=_['merge']({},_0xf3855b,_0x52db2e[_0x3fcc('0x45')]);return db[_0x3fcc('0x32')]['find'](_0xf3855b)['then'](handleEntityNotFound(_0x2ea5a4,null))[_0x3fcc('0x29')](respondWithResult(_0x2ea5a4,null))[_0x3fcc('0x4a')](handleError(_0x2ea5a4,null));};exports['create']=function(_0x29ec46,_0x519a59){return db[_0x3fcc('0x32')][_0x3fcc('0x4b')](_0x29ec46[_0x3fcc('0x4c')],{})[_0x3fcc('0x29')](function(_0x5004c5){var _0xbbc1f0=_0x29ec46[_0x3fcc('0x4d')][_0x3fcc('0x2b')]({'plain':!![]});if(!_0xbbc1f0)throw new Error(_0x3fcc('0x4e'));if(_0xbbc1f0['role']===_0x3fcc('0x4d')){var _0x1afaa2=_0x5004c5['get']({'plain':!![]});var _0x39c0af=_0x3fcc('0x2c');return db[_0x3fcc('0x4f')][_0x3fcc('0x50')]({'where':{'name':_0x39c0af,'userProfileId':_0xbbc1f0[_0x3fcc('0x51')]},'raw':!![]})[_0x3fcc('0x29')](function(_0xf118b2){if(_0xf118b2&&_0xf118b2['autoAssociation']===0x0){return db[_0x3fcc('0x2d')][_0x3fcc('0x4b')]({'name':_0x1afaa2[_0x3fcc('0x2f')],'resourceId':_0x1afaa2['id'],'type':_0xf118b2[_0x3fcc('0x2f')],'sectionId':_0xf118b2['id']},{})[_0x3fcc('0x29')](function(){return _0x5004c5;});}else{return _0x5004c5;}})['catch'](function(_0x565655){logger[_0x3fcc('0x52')](_0x3fcc('0x53'),_0x565655);throw _0x565655;});}return _0x5004c5;})[_0x3fcc('0x29')](respondWithResult(_0x519a59,0xc9))['catch'](handleError(_0x519a59,null));};exports['update']=function(_0x2447a9,_0x254f59){if(_0x2447a9[_0x3fcc('0x4c')]['id']){delete _0x2447a9[_0x3fcc('0x4c')]['id'];}return db[_0x3fcc('0x32')][_0x3fcc('0x50')]({'where':{'id':_0x2447a9['params']['id']}})[_0x3fcc('0x29')](handleEntityNotFound(_0x254f59,null))[_0x3fcc('0x29')](saveUpdates(_0x2447a9[_0x3fcc('0x4c')],null))[_0x3fcc('0x29')](respondWithResult(_0x254f59,null))[_0x3fcc('0x4a')](handleError(_0x254f59,null));};exports[_0x3fcc('0x2a')]=function(_0x1527e9,_0x20f05d){return db[_0x3fcc('0x32')][_0x3fcc('0x50')]({'where':{'id':_0x1527e9['params']['id']}})['then'](handleEntityNotFound(_0x20f05d,null))['then'](removeEntity(_0x20f05d,null))[_0x3fcc('0x4a')](handleError(_0x20f05d,null));};exports[_0x3fcc('0x54')]=function(_0x79185d,_0x422ead){return db[_0x3fcc('0x32')][_0x3fcc('0x54')]()[_0x3fcc('0x29')](respondWithResult(_0x422ead,null))['catch'](handleError(_0x422ead,null));};exports[_0x3fcc('0x55')]=function(_0x3b41ad,_0x35d52f,_0x39fe1b){var _0x52a6a7={'raw':!![],'where':{}},_0x37aa3c={},_0x119886;return db[_0x3fcc('0x32')][_0x3fcc('0x56')]({'where':{'id':_0x3b41ad['params']['id']}})[_0x3fcc('0x29')](handleEntityNotFound(_0x35d52f,null))[_0x3fcc('0x29')](function(_0x5c9598){if(_0x5c9598){_0x119886=_0x5c9598[_0x3fcc('0x2b')]({'plain':!![]});_0x37aa3c[_0x3fcc('0x3d')]=_[_0x3fcc('0x38')](db[_0x3fcc('0x57')]['rawAttributes']);_0x37aa3c['query']=_[_0x3fcc('0x38')](_0x3b41ad['query']);_0x37aa3c[_0x3fcc('0x39')]=_[_0x3fcc('0x3a')](_0x37aa3c['model'],_0x37aa3c[_0x3fcc('0x37')]);_0x52a6a7['attributes']=_[_0x3fcc('0x3a')](_0x37aa3c['model'],qs[_0x3fcc('0x3b')](_0x3b41ad[_0x3fcc('0x37')][_0x3fcc('0x3b')]));_0x52a6a7['attributes']=_0x52a6a7[_0x3fcc('0x47')][_0x3fcc('0x3c')]?_0x52a6a7['attributes']:_0x37aa3c[_0x3fcc('0x3d')];if(!_0x3b41ad[_0x3fcc('0x37')]['hasOwnProperty'](_0x3fcc('0x3e'))){_0x52a6a7['limit']=qs[_0x3fcc('0x1f')](_0x3b41ad[_0x3fcc('0x37')][_0x3fcc('0x1f')]);_0x52a6a7[_0x3fcc('0x1e')]=qs[_0x3fcc('0x1e')](_0x3b41ad[_0x3fcc('0x37')][_0x3fcc('0x1e')]);}_0x52a6a7[_0x3fcc('0x3f')]=qs[_0x3fcc('0x40')](_0x3b41ad[_0x3fcc('0x37')][_0x3fcc('0x40')]);_0x52a6a7[_0x3fcc('0x43')]=qs[_0x3fcc('0x39')](_[_0x3fcc('0x41')](_0x3b41ad[_0x3fcc('0x37')],_0x37aa3c[_0x3fcc('0x39')]));_0x52a6a7['where'][_0x3fcc('0x58')]=_0x5c9598['id'];if(_0x3b41ad[_0x3fcc('0x37')][_0x3fcc('0x42')]){_0x52a6a7[_0x3fcc('0x43')]=_['merge'](_0x52a6a7[_0x3fcc('0x43')],{'$or':_[_0x3fcc('0x31')](_0x52a6a7[_0x3fcc('0x47')],function(_0x2e3d78){var _0x37ec13={};_0x37ec13[_0x2e3d78]={'$like':'%'+_0x3b41ad[_0x3fcc('0x37')]['filter']+'%'};return _0x37ec13;})});}_0x52a6a7=_[_0x3fcc('0x44')]({},_0x52a6a7,_0x3b41ad[_0x3fcc('0x45')]);return db[_0x3fcc('0x57')][_0x3fcc('0x59')](_0x52a6a7);}})[_0x3fcc('0x29')](function(_0x18b39b){if(_0x18b39b){return db[_0x3fcc('0x5a')][_0x3fcc('0x5b')]({'where':{'id':_['map'](_0x18b39b,'UserId'),'role':_0x3fcc('0x5c')},'attributes':['id','name',_0x3fcc('0x5d'),'updatedAt',_0x3fcc('0x5e')]});}})[_0x3fcc('0x29')](function(_0x5a7192){if(_0x5a7192){return{'count':_0x5a7192[_0x3fcc('0x21')],'rows':_[_0x3fcc('0x31')](_0x5a7192[_0x3fcc('0x5f')],function(_0x322354){return{'membername':_0x322354[_0x3fcc('0x2f')],'UserId':_0x322354['id'],'queue_name':_0x119886[_0x3fcc('0x2f')],'WhatsappQueueId':_0x119886['id'],'interface':util[_0x3fcc('0x60')](_0x3fcc('0x61'),'SIP',_0x322354[_0x3fcc('0x2f')]),'penalty':0x0,'paused':_0x322354[_0x3fcc('0x5d')],'createdAt':_0x322354[_0x3fcc('0x5e')],'updatedAt':_0x322354[_0x3fcc('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3fcc('0x29')](respondWithFilteredResult(_0x35d52f,_0x52a6a7))[_0x3fcc('0x4a')](handleError(_0x35d52f,null));};exports['getTeams']=function(_0x18232c,_0xcc4b42,_0x5080c2){var _0x29fde9={};var _0x12f79d={};var _0x58bd8c;var _0x5c073b;return db[_0x3fcc('0x32')][_0x3fcc('0x56')]({'where':{'id':_0x18232c[_0x3fcc('0x63')]['id']}})['then'](handleEntityNotFound(_0xcc4b42,null))[_0x3fcc('0x29')](function(_0x2097a6){if(_0x2097a6){_0x58bd8c=_0x2097a6;_0x12f79d[_0x3fcc('0x3d')]=_[_0x3fcc('0x38')](db[_0x3fcc('0x64')][_0x3fcc('0x33')]);_0x12f79d[_0x3fcc('0x37')]=_[_0x3fcc('0x38')](_0x18232c[_0x3fcc('0x37')]);_0x12f79d['filters']=_[_0x3fcc('0x3a')](_0x12f79d['model'],_0x12f79d[_0x3fcc('0x37')]);_0x29fde9['attributes']=_['intersection'](_0x12f79d[_0x3fcc('0x3d')],qs[_0x3fcc('0x3b')](_0x18232c[_0x3fcc('0x37')][_0x3fcc('0x3b')]));_0x29fde9[_0x3fcc('0x47')]=_0x29fde9[_0x3fcc('0x47')]['length']?_0x29fde9[_0x3fcc('0x47')]:_0x12f79d[_0x3fcc('0x3d')];_0x29fde9[_0x3fcc('0x3f')]=qs[_0x3fcc('0x40')](_0x18232c['query'][_0x3fcc('0x40')]);_0x29fde9['where']=qs[_0x3fcc('0x39')](_[_0x3fcc('0x41')](_0x18232c[_0x3fcc('0x37')],_0x12f79d[_0x3fcc('0x39')]));if(_0x18232c['query'][_0x3fcc('0x42')]){_0x29fde9['where']=_[_0x3fcc('0x44')](_0x29fde9[_0x3fcc('0x43')],{'$or':_[_0x3fcc('0x31')](_0x29fde9[_0x3fcc('0x47')],function(_0x52f74e){var _0x5b52fb={};_0x5b52fb[_0x52f74e]={'$like':'%'+_0x18232c['query'][_0x3fcc('0x42')]+'%'};return _0x5b52fb;})});}_0x29fde9=_['merge']({},_0x29fde9,_0x18232c[_0x3fcc('0x45')]);return _0x58bd8c[_0x3fcc('0x65')](_0x29fde9);}})[_0x3fcc('0x29')](function(_0xac4729){if(_0xac4729){_0x5c073b=_0xac4729['length'];if(!_0x18232c['query'][_0x3fcc('0x66')](_0x3fcc('0x3e'))){_0x29fde9[_0x3fcc('0x1f')]=qs['limit'](_0x18232c[_0x3fcc('0x37')]['limit']);_0x29fde9['offset']=qs[_0x3fcc('0x1e')](_0x18232c[_0x3fcc('0x37')][_0x3fcc('0x1e')]);}return _0x58bd8c['getTeams'](_0x29fde9);}})[_0x3fcc('0x29')](function(_0x770b4f){if(_0x770b4f){return _0x770b4f?{'count':_0x5c073b,'rows':_0x770b4f}:null;}})[_0x3fcc('0x29')](respondWithResult(_0xcc4b42,null))[_0x3fcc('0x4a')](handleError(_0xcc4b42,null));};exports['addTeams']=function(_0x2f08ab,_0x2f57c6,_0x3efc06){var _0x1af03a=_0x2f08ab[_0x3fcc('0x4c')][_0x3fcc('0x67')];return db[_0x3fcc('0x64')][_0x3fcc('0x59')]({'where':{'id':_0x1af03a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3fcc('0x68'),'attributes':['id','name','online',_0x3fcc('0x69'),_0x3fcc('0x6a')],'raw':!![]}]})[_0x3fcc('0x29')](function(_0x44effd){if(_0x44effd){var _0x39a6f8=_[_0x3fcc('0x6b')](_0x44effd,function(_0xa12399){var _0x23f240=_0xa12399[_0x3fcc('0x2b')]({'plain':!![]});return _0x23f240[_0x3fcc('0x68')];});return db['WhatsappQueue']['find']({'where':{'id':_0x2f08ab[_0x3fcc('0x63')]['id']}})[_0x3fcc('0x29')](function(_0xdfce26){return db[_0x3fcc('0x6c')][_0x3fcc('0x6d')](function(_0x38478b){return _0xdfce26['addTeams'](_0x1af03a,{'transaction':_0x38478b})[_0x3fcc('0x29')](function(){return BPromise[_0x3fcc('0x6e')](_0x39a6f8,function(_0x265aa2){return db[_0x3fcc('0x57')][_0x3fcc('0x6f')]({'where':{'UserId':_0x265aa2['id'],'WhatsappQueueId':_0x2f08ab[_0x3fcc('0x63')]['id']},'transaction':_0x38478b});});})[_0x3fcc('0x29')](function(){_0x39a6f8[_0x3fcc('0x70')](function(_0x33aee8){socket[_0x3fcc('0x71')]('userWhatsappQueue:save',{'UserId':_0x33aee8['id'],'WhatsappQueueId':_0xdfce26['id']});});});});});}})[_0x3fcc('0x29')](respondWithStatusCode(_0x2f57c6,null))[_0x3fcc('0x4a')](handleError(_0x2f57c6,null));};exports['removeTeams']=function(_0x34a1d6,_0x370f07,_0x1f764b){return db[_0x3fcc('0x64')][_0x3fcc('0x59')]({'where':{'id':_0x34a1d6[_0x3fcc('0x37')][_0x3fcc('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3fcc('0x29')](handleEntityNotFound(_0x370f07,null))[_0x3fcc('0x29')](function(_0x291486){var _0x3a1068=_['map'](_0x291486,'id');var _0x153bed=[];var _0xaa71ac=[];var _0x3b3b7d=squel[_0x3fcc('0x72')]();_0x3b3b7d[_0x3fcc('0x73')](_0x3fcc('0x74'))[_0x3fcc('0x75')](_0x3fcc('0x76'),'tq')['join'](_0x3fcc('0x77'),'ut',_0x3fcc('0x78'))[_0x3fcc('0x43')](_0x3fcc('0x79'),_0x34a1d6[_0x3fcc('0x63')]['id']);for(var _0x527ee9=0x0;_0x527ee9<_0x291486['length'];_0x527ee9+=0x1){let _0x3418e2=_0x291486[_0x527ee9];for(var _0x5476fe=0x0;_0x5476fe<_0x3418e2[_0x3fcc('0x68')]['length'];_0x5476fe+=0x1){let _0x304990=_0x3418e2[_0x3fcc('0x68')][_0x5476fe];var _0x432298=_0x3b3b7d['clone']();_0x432298[_0x3fcc('0x43')](_0x3fcc('0x7a'),_0x304990['id']);_0xaa71ac[_0x3fcc('0x7b')](db['sequelize'][_0x3fcc('0x37')](_0x432298['toString'](),{'type':db['sequelize'][_0x3fcc('0x7c')]['SELECT']})[_0x3fcc('0x29')](function(_0x3cc49b){if(_0x3cc49b[_0x3fcc('0x3c')]===0x1){return _0x304990['id'];}else{var _0x21eb5c=_[_0x3fcc('0x7d')](_[_0x3fcc('0x31')](_0x3cc49b,'TeamId'),function(_0xcdd456){return _['includes'](_0x3a1068,_0xcdd456);});if(_0x21eb5c){return _0x304990['id'];}}}));}}return BPromise[_0x3fcc('0x7e')](_0xaa71ac)[_0x3fcc('0x29')](function(_0x5b580f){_0x153bed=_(_0x153bed)[_0x3fcc('0x7f')](_0x5b580f)[_0x3fcc('0x80')]()[_0x3fcc('0x81')]();return db[_0x3fcc('0x32')][_0x3fcc('0x50')]({'where':{'id':_0x34a1d6[_0x3fcc('0x63')]['id']}})[_0x3fcc('0x29')](function(_0x3260ce){return db['sequelize'][_0x3fcc('0x6d')](function(_0x2f2154){return _0x3260ce[_0x3fcc('0x82')](_0x34a1d6[_0x3fcc('0x37')][_0x3fcc('0x67')],{'transaction':_0x2f2154})[_0x3fcc('0x29')](function(){if(!_[_0x3fcc('0x83')](_0x153bed)){return _0x3260ce[_0x3fcc('0x84')](_0x153bed,{'transaction':_0x2f2154});}})['then'](function(){_0x153bed[_0x3fcc('0x70')](function(_0x597c50){socket['emit'](_0x3fcc('0x85'),{'UserId':_0x597c50,'WhatsappQueueId':_0x3260ce['id']});});});});});});})[_0x3fcc('0x29')](respondWithStatusCode(_0x370f07,null))[_0x3fcc('0x4a')](handleError(_0x370f07,null));};exports[_0x3fcc('0x86')]=function(_0x5b6ec1,_0x434c6c,_0x46500a){return db['WhatsappQueue'][_0x3fcc('0x50')]({'where':{'id':_0x5b6ec1[_0x3fcc('0x63')]['id']}})['then'](handleEntityNotFound(_0x434c6c,null))[_0x3fcc('0x29')](function(_0x10b585){if(_0x10b585){return _0x10b585['addAgents'](_0x5b6ec1[_0x3fcc('0x4c')]['ids'],_['omit'](_0x5b6ec1[_0x3fcc('0x4c')],['ids','id'])||{})[_0x3fcc('0x87')](function(_0x41c5cb){for(var _0x43c2ec=0x0;_0x43c2ec<_0x5b6ec1[_0x3fcc('0x4c')][_0x3fcc('0x67')][_0x3fcc('0x3c')];_0x43c2ec+=0x1){socket[_0x3fcc('0x71')](_0x3fcc('0x88'),{'UserId':Number(_0x5b6ec1[_0x3fcc('0x4c')][_0x3fcc('0x67')][_0x43c2ec]),'WhatsappQueueId':Number(_0x5b6ec1[_0x3fcc('0x63')]['id'])});}return _0x41c5cb;});}})[_0x3fcc('0x29')](respondWithResult(_0x434c6c,null))[_0x3fcc('0x4a')](handleError(_0x434c6c,null));};exports[_0x3fcc('0x84')]=function(_0x12cfe0,_0x3ea438,_0x433dc9){return db[_0x3fcc('0x32')][_0x3fcc('0x50')]({'where':{'id':_0x12cfe0[_0x3fcc('0x63')]['id']}})[_0x3fcc('0x29')](handleEntityNotFound(_0x3ea438,null))[_0x3fcc('0x29')](function(_0x4485b4){if(_0x4485b4){return _0x4485b4[_0x3fcc('0x84')](_0x12cfe0[_0x3fcc('0x37')][_0x3fcc('0x67')])[_0x3fcc('0x29')](function(){if(_['isArray'](_0x12cfe0[_0x3fcc('0x37')][_0x3fcc('0x67')])){for(var _0x1a1487=0x0;_0x1a1487<_0x12cfe0['query'][_0x3fcc('0x67')][_0x3fcc('0x3c')];_0x1a1487+=0x1){socket[_0x3fcc('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x12cfe0[_0x3fcc('0x37')]['ids'][_0x1a1487]),'WhatsappQueueId':Number(_0x12cfe0[_0x3fcc('0x63')]['id'])});}}else{socket[_0x3fcc('0x71')](_0x3fcc('0x85'),{'UserId':Number(_0x12cfe0[_0x3fcc('0x37')][_0x3fcc('0x67')]),'WhatsappQueueId':Number(_0x12cfe0[_0x3fcc('0x63')]['id'])});}});}})[_0x3fcc('0x29')](respondWithStatusCode(_0x3ea438,null))[_0x3fcc('0x4a')](handleError(_0x3ea438,null));};exports[_0x3fcc('0x89')]=function(_0x13864d,_0x2dbe5e,_0x51ca39){var _0x108166={};var _0x2daab6={};var _0x29114e;var _0x448e14;return db[_0x3fcc('0x32')][_0x3fcc('0x56')]({'where':{'id':_0x13864d['params']['id']}})['then'](handleEntityNotFound(_0x2dbe5e,null))[_0x3fcc('0x29')](function(_0x2dc59b){if(_0x2dc59b){_0x29114e=_0x2dc59b;_0x2daab6[_0x3fcc('0x3d')]=_[_0x3fcc('0x38')](db['User'][_0x3fcc('0x33')]);_0x2daab6[_0x3fcc('0x37')]=_[_0x3fcc('0x38')](_0x13864d[_0x3fcc('0x37')]);_0x2daab6[_0x3fcc('0x39')]=_['intersection'](_0x2daab6[_0x3fcc('0x3d')],_0x2daab6[_0x3fcc('0x37')]);_0x108166[_0x3fcc('0x47')]=_[_0x3fcc('0x3a')](_0x2daab6['model'],qs[_0x3fcc('0x3b')](_0x13864d[_0x3fcc('0x37')][_0x3fcc('0x3b')]));_0x108166[_0x3fcc('0x47')]=_0x108166['attributes'][_0x3fcc('0x3c')]?_0x108166[_0x3fcc('0x47')]:_0x2daab6[_0x3fcc('0x3d')];_0x108166['order']=qs[_0x3fcc('0x40')](_0x13864d[_0x3fcc('0x37')][_0x3fcc('0x40')]);_0x108166['where']=qs[_0x3fcc('0x39')](_['pick'](_0x13864d[_0x3fcc('0x37')],_0x2daab6['filters']));if(_0x13864d[_0x3fcc('0x37')][_0x3fcc('0x42')]){_0x108166['where']=_[_0x3fcc('0x44')](_0x108166[_0x3fcc('0x43')],{'$or':_['map'](_0x108166[_0x3fcc('0x47')],function(_0x40d514){var _0x3c5525={};_0x3c5525[_0x40d514]={'$like':'%'+_0x13864d[_0x3fcc('0x37')]['filter']+'%'};return _0x3c5525;})});}_0x108166=_['merge']({},_0x108166,_0x13864d[_0x3fcc('0x45')]);return _0x29114e['getAgents'](_0x108166);}})[_0x3fcc('0x29')](function(_0x4e0e53){if(_0x4e0e53){_0x448e14=_0x4e0e53[_0x3fcc('0x3c')];if(!_0x13864d[_0x3fcc('0x37')][_0x3fcc('0x66')](_0x3fcc('0x3e'))){_0x108166[_0x3fcc('0x1f')]=qs[_0x3fcc('0x1f')](_0x13864d[_0x3fcc('0x37')]['limit']);_0x108166[_0x3fcc('0x1e')]=qs[_0x3fcc('0x1e')](_0x13864d[_0x3fcc('0x37')]['offset']);}return _0x29114e[_0x3fcc('0x89')](_0x108166);}})[_0x3fcc('0x29')](function(_0x2f8617){if(_0x2f8617){return _0x2f8617?{'count':_0x448e14,'rows':_0x2f8617}:null;}})[_0x3fcc('0x29')](respondWithResult(_0x2dbe5e,null))[_0x3fcc('0x4a')](handleError(_0x2dbe5e,null));}; \ No newline at end of file +var _0xaae0=['forEach','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','apply','reject','then','get','WhatsappQueues','destroy','error','index','map','rawAttributes','type','model','name','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','WhatsappQueue','findAll','rows','catch','params','find','create','body','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','sort','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','%s/%s','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xaae0,0x116));var _0x0aae=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xaae0[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0aae('0x0'));var zipdir=require(_0x0aae('0x1'));var jsonpatch=require(_0x0aae('0x2'));var rp=require(_0x0aae('0x3'));var moment=require(_0x0aae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0aae('0x5'));var util=require(_0x0aae('0x6'));var path=require(_0x0aae('0x7'));var sox=require(_0x0aae('0x8'));var csv=require(_0x0aae('0x9'));var ejs=require(_0x0aae('0xa'));var fs=require('fs');var fs_extra=require(_0x0aae('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0aae('0xc'));var jsforce=require(_0x0aae('0xd'));var deskjs=require(_0x0aae('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0aae('0xf'));var Papa=require(_0x0aae('0x10'));var Redis=require(_0x0aae('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0aae('0x12'));var as=require(_0x0aae('0x13'));var hardwareService=require(_0x0aae('0x14'));var logger=require('../../config/logger')(_0x0aae('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0aae('0x16'));var db=require(_0x0aae('0x17'))['db'];config[_0x0aae('0x18')]=_['defaults'](config[_0x0aae('0x18')],{'host':_0x0aae('0x19'),'port':0x18eb});var socket=require(_0x0aae('0x1a'))(new Redis(config[_0x0aae('0x18')]));require(_0x0aae('0x1b'))[_0x0aae('0x1c')](socket);function respondWithStatusCode(_0x3406a5,_0x4cd142){_0x4cd142=_0x4cd142||0xcc;return function(_0x247b8a){if(_0x247b8a){return _0x3406a5[_0x0aae('0x1d')](_0x4cd142);}return _0x3406a5[_0x0aae('0x1e')](_0x4cd142)['end']();};}function respondWithResult(_0x1de314,_0x2a6ac6){_0x2a6ac6=_0x2a6ac6||0xc8;return function(_0x1c9a01){if(_0x1c9a01){return _0x1de314['status'](_0x2a6ac6)[_0x0aae('0x1f')](_0x1c9a01);}};}function respondWithFilteredResult(_0x1ba261,_0x31d9d9){return function(_0x5a9db3){if(_0x5a9db3){var _0x589f6b=typeof _0x31d9d9[_0x0aae('0x20')]==='undefined'&&typeof _0x31d9d9['limit']===_0x0aae('0x21');var _0x277247=_0x5a9db3[_0x0aae('0x22')];var _0x45eef3=_0x589f6b?0x0:_0x31d9d9[_0x0aae('0x20')];var _0x125e0d=_0x589f6b?_0x5a9db3[_0x0aae('0x22')]:_0x31d9d9[_0x0aae('0x20')]+_0x31d9d9[_0x0aae('0x23')];var _0x5e577c;if(_0x125e0d>=_0x277247){_0x125e0d=_0x277247;_0x5e577c=0xc8;}else{_0x5e577c=0xce;}_0x1ba261[_0x0aae('0x1e')](_0x5e577c);return _0x1ba261['set']('Content-Range',_0x45eef3+'-'+_0x125e0d+'/'+_0x277247)[_0x0aae('0x1f')](_0x5a9db3);}return null;};}function patchUpdates(_0x239deb){return function(_0x56ca03){try{jsonpatch[_0x0aae('0x24')](_0x56ca03,_0x239deb,!![]);}catch(_0x354f4e){return BPromise[_0x0aae('0x25')](_0x354f4e);}return _0x56ca03['save']();};}function saveUpdates(_0x3e20e1,_0x1c517b){return function(_0x1eeda0){if(_0x1eeda0){return _0x1eeda0['update'](_0x3e20e1)[_0x0aae('0x26')](function(_0x19ed70){return _0x19ed70;});}return null;};}function removeEntity(_0x228641,_0x22b446){return function(_0x4af476){if(_0x4af476){return _0x4af476['destroy']()[_0x0aae('0x26')](function(){var _0x2ebd43=_0x4af476[_0x0aae('0x27')]({'plain':!![]});var _0x1b6100=_0x0aae('0x28');return db['UserProfileResource'][_0x0aae('0x29')]({'where':{'type':_0x1b6100,'resourceId':_0x2ebd43['id']}})[_0x0aae('0x26')](function(){return _0x4af476;});})[_0x0aae('0x26')](function(){_0x228641[_0x0aae('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d912f,_0x5ec73d){return function(_0x21f43d){if(!_0x21f43d){_0x5d912f[_0x0aae('0x1d')](0x194);}return _0x21f43d;};}function handleError(_0x52cee4,_0x43e941){_0x43e941=_0x43e941||0x1f4;return function(_0x455fa9){logger[_0x0aae('0x2a')](_0x455fa9['stack']);if(_0x455fa9['name']){delete _0x455fa9['name'];}_0x52cee4[_0x0aae('0x1e')](_0x43e941)['send'](_0x455fa9);};}exports[_0x0aae('0x2b')]=function(_0x324750,_0x2a0404){var _0x150a00={},_0x3e3c36={},_0x5c1b8d={'count':0x0,'rows':[]};var _0x5b4544=_[_0x0aae('0x2c')](db['WhatsappQueue'][_0x0aae('0x2d')],function(_0x5e49e5){return{'name':_0x5e49e5['fieldName'],'type':_0x5e49e5[_0x0aae('0x2e')]['key']};});_0x3e3c36[_0x0aae('0x2f')]=_[_0x0aae('0x2c')](_0x5b4544,_0x0aae('0x30'));_0x3e3c36['query']=_[_0x0aae('0x31')](_0x324750[_0x0aae('0x32')]);_0x3e3c36['filters']=_[_0x0aae('0x33')](_0x3e3c36['model'],_0x3e3c36[_0x0aae('0x32')]);_0x150a00['attributes']=_[_0x0aae('0x33')](_0x3e3c36[_0x0aae('0x2f')],qs[_0x0aae('0x34')](_0x324750[_0x0aae('0x32')][_0x0aae('0x34')]));_0x150a00[_0x0aae('0x35')]=_0x150a00[_0x0aae('0x35')][_0x0aae('0x36')]?_0x150a00['attributes']:_0x3e3c36[_0x0aae('0x2f')];if(!_0x324750[_0x0aae('0x32')][_0x0aae('0x37')](_0x0aae('0x38'))){_0x150a00[_0x0aae('0x23')]=qs[_0x0aae('0x23')](_0x324750['query'][_0x0aae('0x23')]);_0x150a00[_0x0aae('0x20')]=qs[_0x0aae('0x20')](_0x324750[_0x0aae('0x32')][_0x0aae('0x20')]);}_0x150a00[_0x0aae('0x39')]=qs['sort'](_0x324750[_0x0aae('0x32')]['sort']);_0x150a00[_0x0aae('0x3a')]=qs[_0x0aae('0x3b')](_[_0x0aae('0x3c')](_0x324750[_0x0aae('0x32')],_0x3e3c36[_0x0aae('0x3b')]),_0x5b4544);if(_0x324750[_0x0aae('0x32')]['filter']){_0x150a00['where']=_['merge'](_0x150a00['where'],{'$or':_['map'](_0x5b4544,function(_0x34793f){if(_0x34793f[_0x0aae('0x2e')]!==_0x0aae('0x3d')){var _0x40df80={};_0x40df80[_0x34793f[_0x0aae('0x30')]]={'$like':'%'+_0x324750[_0x0aae('0x32')][_0x0aae('0x3e')]+'%'};return _0x40df80;}})});}_0x150a00=_[_0x0aae('0x3f')]({},_0x150a00,_0x324750[_0x0aae('0x40')]);var _0x3791ad={'where':_0x150a00[_0x0aae('0x3a')]};return db['WhatsappQueue'][_0x0aae('0x22')](_0x3791ad)['then'](function(_0x13660b){_0x5c1b8d[_0x0aae('0x22')]=_0x13660b;if(_0x324750['query'][_0x0aae('0x41')]){_0x150a00[_0x0aae('0x42')]=[{'all':!![]}];}return db[_0x0aae('0x43')][_0x0aae('0x44')](_0x150a00);})[_0x0aae('0x26')](function(_0x42ccd5){_0x5c1b8d[_0x0aae('0x45')]=_0x42ccd5;return _0x5c1b8d;})[_0x0aae('0x26')](respondWithFilteredResult(_0x2a0404,_0x150a00))[_0x0aae('0x46')](handleError(_0x2a0404,null));};exports['show']=function(_0x532bb0,_0x460fe5){var _0x178b33={'raw':!![],'where':{'id':_0x532bb0[_0x0aae('0x47')]['id']}},_0x5a7a18={};_0x5a7a18[_0x0aae('0x2f')]=_['keys'](db[_0x0aae('0x43')]['rawAttributes']);_0x5a7a18['query']=_['keys'](_0x532bb0['query']);_0x5a7a18[_0x0aae('0x3b')]=_[_0x0aae('0x33')](_0x5a7a18[_0x0aae('0x2f')],_0x5a7a18[_0x0aae('0x32')]);_0x178b33[_0x0aae('0x35')]=_[_0x0aae('0x33')](_0x5a7a18[_0x0aae('0x2f')],qs[_0x0aae('0x34')](_0x532bb0[_0x0aae('0x32')][_0x0aae('0x34')]));_0x178b33[_0x0aae('0x35')]=_0x178b33[_0x0aae('0x35')][_0x0aae('0x36')]?_0x178b33[_0x0aae('0x35')]:_0x5a7a18[_0x0aae('0x2f')];if(_0x532bb0[_0x0aae('0x32')][_0x0aae('0x41')]){_0x178b33['include']=[{'all':!![]}];}_0x178b33=_[_0x0aae('0x3f')]({},_0x178b33,_0x532bb0['options']);return db['WhatsappQueue'][_0x0aae('0x48')](_0x178b33)[_0x0aae('0x26')](handleEntityNotFound(_0x460fe5,null))[_0x0aae('0x26')](respondWithResult(_0x460fe5,null))[_0x0aae('0x46')](handleError(_0x460fe5,null));};exports[_0x0aae('0x49')]=function(_0x24bf6d,_0x59d39e){return db[_0x0aae('0x43')][_0x0aae('0x49')](_0x24bf6d[_0x0aae('0x4a')],{})[_0x0aae('0x26')](function(_0xd9c12c){var _0x557299=_0x24bf6d['user'][_0x0aae('0x27')]({'plain':!![]});if(!_0x557299)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x557299['role']===_0x0aae('0x4b')){var _0x4198ba=_0xd9c12c['get']({'plain':!![]});var _0x19bac7=_0x0aae('0x28');return db['UserProfileSection'][_0x0aae('0x48')]({'where':{'name':_0x19bac7,'userProfileId':_0x557299[_0x0aae('0x4c')]},'raw':!![]})[_0x0aae('0x26')](function(_0x74a7a2){if(_0x74a7a2&&_0x74a7a2['autoAssociation']===0x0){return db[_0x0aae('0x4d')][_0x0aae('0x49')]({'name':_0x4198ba[_0x0aae('0x30')],'resourceId':_0x4198ba['id'],'type':_0x74a7a2[_0x0aae('0x30')],'sectionId':_0x74a7a2['id']},{})[_0x0aae('0x26')](function(){return _0xd9c12c;});}else{return _0xd9c12c;}})['catch'](function(_0x3608d9){logger[_0x0aae('0x2a')](_0x0aae('0x4e'),_0x3608d9);throw _0x3608d9;});}return _0xd9c12c;})[_0x0aae('0x26')](respondWithResult(_0x59d39e,0xc9))[_0x0aae('0x46')](handleError(_0x59d39e,null));};exports['update']=function(_0x3a1bce,_0x3b56cd){if(_0x3a1bce[_0x0aae('0x4a')]['id']){delete _0x3a1bce[_0x0aae('0x4a')]['id'];}return db['WhatsappQueue'][_0x0aae('0x48')]({'where':{'id':_0x3a1bce[_0x0aae('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b56cd,null))['then'](saveUpdates(_0x3a1bce[_0x0aae('0x4a')],null))[_0x0aae('0x26')](respondWithResult(_0x3b56cd,null))[_0x0aae('0x46')](handleError(_0x3b56cd,null));};exports['destroy']=function(_0x74310e,_0xf114d7){return db[_0x0aae('0x43')]['find']({'where':{'id':_0x74310e[_0x0aae('0x47')]['id']}})['then'](handleEntityNotFound(_0xf114d7,null))['then'](removeEntity(_0xf114d7,null))[_0x0aae('0x46')](handleError(_0xf114d7,null));};exports['describe']=function(_0x5a01cb,_0x448b2f){return db[_0x0aae('0x43')][_0x0aae('0x4f')]()[_0x0aae('0x26')](respondWithResult(_0x448b2f,null))[_0x0aae('0x46')](handleError(_0x448b2f,null));};exports[_0x0aae('0x50')]=function(_0x4026bc,_0xbd3f61,_0x4f92ca){var _0x2bf9f9={'raw':!![],'where':{}},_0x5a02c9={},_0x1e761a;return db[_0x0aae('0x43')][_0x0aae('0x51')]({'where':{'id':_0x4026bc[_0x0aae('0x47')]['id']}})[_0x0aae('0x26')](handleEntityNotFound(_0xbd3f61,null))['then'](function(_0x40f6fd){if(_0x40f6fd){_0x1e761a=_0x40f6fd[_0x0aae('0x27')]({'plain':!![]});_0x5a02c9[_0x0aae('0x2f')]=_[_0x0aae('0x31')](db['UserWhatsappQueue']['rawAttributes']);_0x5a02c9['query']=_[_0x0aae('0x31')](_0x4026bc[_0x0aae('0x32')]);_0x5a02c9['filters']=_[_0x0aae('0x33')](_0x5a02c9[_0x0aae('0x2f')],_0x5a02c9[_0x0aae('0x32')]);_0x2bf9f9[_0x0aae('0x35')]=_[_0x0aae('0x33')](_0x5a02c9['model'],qs[_0x0aae('0x34')](_0x4026bc[_0x0aae('0x32')][_0x0aae('0x34')]));_0x2bf9f9['attributes']=_0x2bf9f9[_0x0aae('0x35')]['length']?_0x2bf9f9[_0x0aae('0x35')]:_0x5a02c9[_0x0aae('0x2f')];if(!_0x4026bc[_0x0aae('0x32')][_0x0aae('0x37')](_0x0aae('0x38'))){_0x2bf9f9[_0x0aae('0x23')]=qs[_0x0aae('0x23')](_0x4026bc[_0x0aae('0x32')]['limit']);_0x2bf9f9[_0x0aae('0x20')]=qs['offset'](_0x4026bc['query'][_0x0aae('0x20')]);}_0x2bf9f9[_0x0aae('0x39')]=qs[_0x0aae('0x52')](_0x4026bc[_0x0aae('0x32')][_0x0aae('0x52')]);_0x2bf9f9[_0x0aae('0x3a')]=qs['filters'](_[_0x0aae('0x3c')](_0x4026bc[_0x0aae('0x32')],_0x5a02c9[_0x0aae('0x3b')]));_0x2bf9f9['where']['WhatsappQueueId']=_0x40f6fd['id'];if(_0x4026bc[_0x0aae('0x32')]['filter']){_0x2bf9f9[_0x0aae('0x3a')]=_[_0x0aae('0x3f')](_0x2bf9f9[_0x0aae('0x3a')],{'$or':_[_0x0aae('0x2c')](_0x2bf9f9['attributes'],function(_0x28811d){var _0x5e732f={};_0x5e732f[_0x28811d]={'$like':'%'+_0x4026bc[_0x0aae('0x32')][_0x0aae('0x3e')]+'%'};return _0x5e732f;})});}_0x2bf9f9=_[_0x0aae('0x3f')]({},_0x2bf9f9,_0x4026bc[_0x0aae('0x40')]);return db[_0x0aae('0x53')][_0x0aae('0x44')](_0x2bf9f9);}})['then'](function(_0x547e46){if(_0x547e46){return db[_0x0aae('0x54')][_0x0aae('0x55')]({'where':{'id':_[_0x0aae('0x2c')](_0x547e46,_0x0aae('0x56')),'role':_0x0aae('0x57')},'attributes':['id',_0x0aae('0x30'),_0x0aae('0x58'),'updatedAt','createdAt']});}})[_0x0aae('0x26')](function(_0x124320){if(_0x124320){return{'count':_0x124320['count'],'rows':_['map'](_0x124320[_0x0aae('0x45')],function(_0x41ed31){return{'membername':_0x41ed31['name'],'UserId':_0x41ed31['id'],'queue_name':_0x1e761a[_0x0aae('0x30')],'WhatsappQueueId':_0x1e761a['id'],'interface':util['format'](_0x0aae('0x59'),'SIP',_0x41ed31['name']),'penalty':0x0,'paused':_0x41ed31[_0x0aae('0x58')],'createdAt':_0x41ed31[_0x0aae('0x5a')],'updatedAt':_0x41ed31[_0x0aae('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xbd3f61,_0x2bf9f9))[_0x0aae('0x46')](handleError(_0xbd3f61,null));};exports[_0x0aae('0x5c')]=function(_0x5bfe27,_0x5b04e2,_0x422ce9){var _0x4559e0={};var _0xc5a37b={};var _0x466935;var _0x10d71a;return db[_0x0aae('0x43')]['findOne']({'where':{'id':_0x5bfe27[_0x0aae('0x47')]['id']}})[_0x0aae('0x26')](handleEntityNotFound(_0x5b04e2,null))[_0x0aae('0x26')](function(_0x354c68){if(_0x354c68){_0x466935=_0x354c68;_0xc5a37b['model']=_['keys'](db[_0x0aae('0x5d')][_0x0aae('0x2d')]);_0xc5a37b[_0x0aae('0x32')]=_[_0x0aae('0x31')](_0x5bfe27[_0x0aae('0x32')]);_0xc5a37b[_0x0aae('0x3b')]=_[_0x0aae('0x33')](_0xc5a37b['model'],_0xc5a37b[_0x0aae('0x32')]);_0x4559e0[_0x0aae('0x35')]=_[_0x0aae('0x33')](_0xc5a37b[_0x0aae('0x2f')],qs[_0x0aae('0x34')](_0x5bfe27[_0x0aae('0x32')][_0x0aae('0x34')]));_0x4559e0['attributes']=_0x4559e0[_0x0aae('0x35')][_0x0aae('0x36')]?_0x4559e0[_0x0aae('0x35')]:_0xc5a37b[_0x0aae('0x2f')];_0x4559e0[_0x0aae('0x39')]=qs['sort'](_0x5bfe27[_0x0aae('0x32')][_0x0aae('0x52')]);_0x4559e0[_0x0aae('0x3a')]=qs[_0x0aae('0x3b')](_[_0x0aae('0x3c')](_0x5bfe27['query'],_0xc5a37b[_0x0aae('0x3b')]));if(_0x5bfe27[_0x0aae('0x32')][_0x0aae('0x3e')]){_0x4559e0['where']=_[_0x0aae('0x3f')](_0x4559e0[_0x0aae('0x3a')],{'$or':_[_0x0aae('0x2c')](_0x4559e0[_0x0aae('0x35')],function(_0x50647d){var _0x2fa956={};_0x2fa956[_0x50647d]={'$like':'%'+_0x5bfe27['query']['filter']+'%'};return _0x2fa956;})});}_0x4559e0=_[_0x0aae('0x3f')]({},_0x4559e0,_0x5bfe27['options']);return _0x466935[_0x0aae('0x5c')](_0x4559e0);}})['then'](function(_0xd094e2){if(_0xd094e2){_0x10d71a=_0xd094e2['length'];if(!_0x5bfe27[_0x0aae('0x32')][_0x0aae('0x37')](_0x0aae('0x38'))){_0x4559e0[_0x0aae('0x23')]=qs[_0x0aae('0x23')](_0x5bfe27[_0x0aae('0x32')]['limit']);_0x4559e0[_0x0aae('0x20')]=qs['offset'](_0x5bfe27[_0x0aae('0x32')]['offset']);}return _0x466935['getTeams'](_0x4559e0);}})[_0x0aae('0x26')](function(_0x308164){if(_0x308164){return _0x308164?{'count':_0x10d71a,'rows':_0x308164}:null;}})[_0x0aae('0x26')](respondWithResult(_0x5b04e2,null))[_0x0aae('0x46')](handleError(_0x5b04e2,null));};exports[_0x0aae('0x5e')]=function(_0x54015d,_0x57d2db,_0x3b93ad){var _0x31ab58=_0x54015d[_0x0aae('0x4a')][_0x0aae('0x5f')];return db['Team'][_0x0aae('0x44')]({'where':{'id':_0x31ab58},'attributes':['id'],'include':[{'model':db[_0x0aae('0x54')],'as':_0x0aae('0x60'),'attributes':['id',_0x0aae('0x30'),_0x0aae('0x61'),_0x0aae('0x62'),_0x0aae('0x63')],'raw':!![]}]})['then'](function(_0x3968c4){if(_0x3968c4){var _0x49666d=_[_0x0aae('0x64')](_0x3968c4,function(_0x484970){var _0x37441a=_0x484970['get']({'plain':!![]});return _0x37441a[_0x0aae('0x60')];});return db[_0x0aae('0x43')][_0x0aae('0x48')]({'where':{'id':_0x54015d[_0x0aae('0x47')]['id']}})['then'](function(_0x54ed8f){return db['sequelize'][_0x0aae('0x65')](function(_0x264fa2){return _0x54ed8f[_0x0aae('0x5e')](_0x31ab58,{'transaction':_0x264fa2})[_0x0aae('0x26')](function(){return BPromise[_0x0aae('0x66')](_0x49666d,function(_0x5b5815){return db[_0x0aae('0x53')][_0x0aae('0x67')]({'where':{'UserId':_0x5b5815['id'],'WhatsappQueueId':_0x54015d[_0x0aae('0x47')]['id']},'transaction':_0x264fa2});});})['then'](function(){_0x49666d['forEach'](function(_0x547bbd){socket[_0x0aae('0x68')](_0x0aae('0x69'),{'UserId':_0x547bbd['id'],'WhatsappQueueId':_0x54ed8f['id']});});});});});}})['then'](respondWithStatusCode(_0x57d2db,null))[_0x0aae('0x46')](handleError(_0x57d2db,null));};exports[_0x0aae('0x6a')]=function(_0x227eae,_0x1c8f19,_0xba4e2a){return db['Team'][_0x0aae('0x44')]({'where':{'id':_0x227eae[_0x0aae('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0aae('0x54')],'as':_0x0aae('0x60'),'attributes':['id'],'raw':!![]}]})[_0x0aae('0x26')](handleEntityNotFound(_0x1c8f19,null))[_0x0aae('0x26')](function(_0x217190){var _0x4d9aa7=_[_0x0aae('0x2c')](_0x217190,'id');var _0x659c60=[];var _0x16a491=[];var _0x3ec60b=squel[_0x0aae('0x6b')]();_0x3ec60b[_0x0aae('0x6c')]('tq.TeamId')[_0x0aae('0x6d')](_0x0aae('0x6e'),'tq')[_0x0aae('0x6f')]('user_has_teams','ut',_0x0aae('0x70'))[_0x0aae('0x3a')](_0x0aae('0x71'),_0x227eae[_0x0aae('0x47')]['id']);for(var _0x590faa=0x0;_0x590faa<_0x217190[_0x0aae('0x36')];_0x590faa+=0x1){let _0x588381=_0x217190[_0x590faa];for(var _0x1ba49a=0x0;_0x1ba49a<_0x588381[_0x0aae('0x60')][_0x0aae('0x36')];_0x1ba49a+=0x1){let _0x20e354=_0x588381[_0x0aae('0x60')][_0x1ba49a];var _0x337579=_0x3ec60b[_0x0aae('0x72')]();_0x337579[_0x0aae('0x3a')]('ut.UserId\x20=\x20?',_0x20e354['id']);_0x16a491[_0x0aae('0x73')](db[_0x0aae('0x74')][_0x0aae('0x32')](_0x337579[_0x0aae('0x75')](),{'type':db[_0x0aae('0x74')][_0x0aae('0x76')][_0x0aae('0x77')]})[_0x0aae('0x26')](function(_0x4101db){if(_0x4101db['length']===0x1){return _0x20e354['id'];}else{var _0x402d7d=_[_0x0aae('0x78')](_[_0x0aae('0x2c')](_0x4101db,'TeamId'),function(_0x4ef1db){return _[_0x0aae('0x79')](_0x4d9aa7,_0x4ef1db);});if(_0x402d7d){return _0x20e354['id'];}}}));}}return BPromise[_0x0aae('0x7a')](_0x16a491)[_0x0aae('0x26')](function(_0xbc8311){_0x659c60=_(_0x659c60)[_0x0aae('0x7b')](_0xbc8311)[_0x0aae('0x7c')]()[_0x0aae('0x7d')]();return db[_0x0aae('0x43')][_0x0aae('0x48')]({'where':{'id':_0x227eae[_0x0aae('0x47')]['id']}})[_0x0aae('0x26')](function(_0x3908f0){return db[_0x0aae('0x74')][_0x0aae('0x65')](function(_0x25a2b6){return _0x3908f0[_0x0aae('0x6a')](_0x227eae[_0x0aae('0x32')][_0x0aae('0x5f')],{'transaction':_0x25a2b6})['then'](function(){if(!_[_0x0aae('0x7e')](_0x659c60)){return _0x3908f0['removeAgents'](_0x659c60,{'transaction':_0x25a2b6});}})[_0x0aae('0x26')](function(){_0x659c60[_0x0aae('0x7f')](function(_0x2c816e){socket['emit'](_0x0aae('0x80'),{'UserId':_0x2c816e,'WhatsappQueueId':_0x3908f0['id']});});});});});});})['then'](respondWithStatusCode(_0x1c8f19,null))[_0x0aae('0x46')](handleError(_0x1c8f19,null));};exports['addAgents']=function(_0x4c3aaf,_0x19cbd5,_0x551c4e){return db[_0x0aae('0x43')][_0x0aae('0x48')]({'where':{'id':_0x4c3aaf[_0x0aae('0x47')]['id']}})[_0x0aae('0x26')](handleEntityNotFound(_0x19cbd5,null))[_0x0aae('0x26')](function(_0x26de56){if(_0x26de56){return _0x26de56[_0x0aae('0x81')](_0x4c3aaf[_0x0aae('0x4a')][_0x0aae('0x5f')],_[_0x0aae('0x82')](_0x4c3aaf[_0x0aae('0x4a')],[_0x0aae('0x5f'),'id'])||{})[_0x0aae('0x83')](function(_0x428773){for(var _0x29fce3=0x0;_0x29fce3<_0x4c3aaf[_0x0aae('0x4a')]['ids']['length'];_0x29fce3+=0x1){socket['emit'](_0x0aae('0x69'),{'UserId':Number(_0x4c3aaf['body'][_0x0aae('0x5f')][_0x29fce3]),'WhatsappQueueId':Number(_0x4c3aaf[_0x0aae('0x47')]['id'])});}return _0x428773;});}})[_0x0aae('0x26')](respondWithResult(_0x19cbd5,null))[_0x0aae('0x46')](handleError(_0x19cbd5,null));};exports[_0x0aae('0x84')]=function(_0x362551,_0xbe6d9c,_0x7c40c6){return db[_0x0aae('0x43')][_0x0aae('0x48')]({'where':{'id':_0x362551[_0x0aae('0x47')]['id']}})[_0x0aae('0x26')](handleEntityNotFound(_0xbe6d9c,null))[_0x0aae('0x26')](function(_0x10abc1){if(_0x10abc1){return _0x10abc1[_0x0aae('0x84')](_0x362551[_0x0aae('0x32')][_0x0aae('0x5f')])[_0x0aae('0x26')](function(){if(_[_0x0aae('0x85')](_0x362551[_0x0aae('0x32')][_0x0aae('0x5f')])){for(var _0x557475=0x0;_0x557475<_0x362551[_0x0aae('0x32')][_0x0aae('0x5f')]['length'];_0x557475+=0x1){socket[_0x0aae('0x68')]('userWhatsappQueue:remove',{'UserId':Number(_0x362551[_0x0aae('0x32')][_0x0aae('0x5f')][_0x557475]),'WhatsappQueueId':Number(_0x362551['params']['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x362551[_0x0aae('0x32')][_0x0aae('0x5f')]),'WhatsappQueueId':Number(_0x362551[_0x0aae('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0xbe6d9c,null))[_0x0aae('0x46')](handleError(_0xbe6d9c,null));};exports['getAgents']=function(_0x4d5688,_0xbeceb3,_0x3a781b){var _0x37bdbe={};var _0x3f5efd={};var _0x10d80f;var _0x9638ff;return db[_0x0aae('0x43')]['findOne']({'where':{'id':_0x4d5688[_0x0aae('0x47')]['id']}})[_0x0aae('0x26')](handleEntityNotFound(_0xbeceb3,null))[_0x0aae('0x26')](function(_0x4e8159){if(_0x4e8159){_0x10d80f=_0x4e8159;_0x3f5efd['model']=_[_0x0aae('0x31')](db[_0x0aae('0x54')][_0x0aae('0x2d')]);_0x3f5efd[_0x0aae('0x32')]=_[_0x0aae('0x31')](_0x4d5688[_0x0aae('0x32')]);_0x3f5efd['filters']=_[_0x0aae('0x33')](_0x3f5efd[_0x0aae('0x2f')],_0x3f5efd[_0x0aae('0x32')]);_0x37bdbe[_0x0aae('0x35')]=_[_0x0aae('0x33')](_0x3f5efd[_0x0aae('0x2f')],qs[_0x0aae('0x34')](_0x4d5688[_0x0aae('0x32')][_0x0aae('0x34')]));_0x37bdbe['attributes']=_0x37bdbe[_0x0aae('0x35')][_0x0aae('0x36')]?_0x37bdbe[_0x0aae('0x35')]:_0x3f5efd['model'];_0x37bdbe['order']=qs['sort'](_0x4d5688['query']['sort']);_0x37bdbe[_0x0aae('0x3a')]=qs['filters'](_[_0x0aae('0x3c')](_0x4d5688[_0x0aae('0x32')],_0x3f5efd[_0x0aae('0x3b')]));if(_0x4d5688[_0x0aae('0x32')]['filter']){_0x37bdbe[_0x0aae('0x3a')]=_['merge'](_0x37bdbe[_0x0aae('0x3a')],{'$or':_[_0x0aae('0x2c')](_0x37bdbe[_0x0aae('0x35')],function(_0x11b3c4){var _0x1bb82d={};_0x1bb82d[_0x11b3c4]={'$like':'%'+_0x4d5688['query'][_0x0aae('0x3e')]+'%'};return _0x1bb82d;})});}_0x37bdbe=_['merge']({},_0x37bdbe,_0x4d5688[_0x0aae('0x40')]);return _0x10d80f['getAgents'](_0x37bdbe);}})['then'](function(_0x496e65){if(_0x496e65){_0x9638ff=_0x496e65['length'];if(!_0x4d5688['query']['hasOwnProperty']('nolimit')){_0x37bdbe[_0x0aae('0x23')]=qs[_0x0aae('0x23')](_0x4d5688[_0x0aae('0x32')][_0x0aae('0x23')]);_0x37bdbe[_0x0aae('0x20')]=qs[_0x0aae('0x20')](_0x4d5688[_0x0aae('0x32')][_0x0aae('0x20')]);}return _0x10d80f[_0x0aae('0x86')](_0x37bdbe);}})[_0x0aae('0x26')](function(_0x554244){if(_0x554244){return _0x554244?{'count':_0x9638ff,'rows':_0x554244}:null;}})[_0x0aae('0x26')](respondWithResult(_0xbeceb3,null))[_0x0aae('0x46')](handleError(_0xbeceb3,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 57aa8a5..5625a21 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 _0x309a=['WhatsappQueue','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x566fb2,_0x4316b9){var _0x28ccb6=function(_0x140ac0){while(--_0x140ac0){_0x566fb2['push'](_0x566fb2['shift']());}};_0x28ccb6(++_0x4316b9);}(_0x309a,0x154));var _0xa309=function(_0x263a3d,_0x3616b2){_0x263a3d=_0x263a3d-0x0;var _0x22e7c0=_0x309a[_0x263a3d];return _0x22e7c0;};'use strict';var EventEmitter=require(_0xa309('0x0'));var WhatsappQueue=require(_0xa309('0x1'))['db'][_0xa309('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa309('0x3'),'afterDestroy':_0xa309('0x4')};function emitEvent(_0x5cdfd8){return function(_0x1ff71c,_0x209ccf,_0x4aa1c6){WhatsappQueueEvents['emit'](_0x5cdfd8+':'+_0x1ff71c['id'],_0x1ff71c);WhatsappQueueEvents[_0xa309('0x5')](_0x5cdfd8,_0x1ff71c);_0x4aa1c6(null);};}for(var e in events){if(events[_0xa309('0x6')](e)){var event=events[e];WhatsappQueue[_0xa309('0x7')](e,emitEvent(event));}}module[_0xa309('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xb7e2=['hook','exports','../../mysqldb','update','emit'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xb7e2,0xc5));var _0x2b7e=function(_0x3ce977,_0xd179ab){_0x3ce977=_0x3ce977-0x0;var _0x2a3043=_0xb7e2[_0x3ce977];return _0x2a3043;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x2b7e('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2b7e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x2913c1){return function(_0x520146,_0x418fe0,_0x516bbc){WhatsappQueueEvents[_0x2b7e('0x2')](_0x2913c1+':'+_0x520146['id'],_0x520146);WhatsappQueueEvents[_0x2b7e('0x2')](_0x2913c1,_0x520146);_0x516bbc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x2b7e('0x3')](e,emitEvent(event));}}module[_0x2b7e('0x4')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 584e393..e4cfd98 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 _0x7f40=['WhatsappQueue','util','api','moment','bluebird','request-promise','./whatsappQueue.attributes','exports','define'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0x7f40,0x121));var _0x07f4=function(_0x1187ba,_0x5ab107){_0x1187ba=_0x1187ba-0x0;var _0x589b74=_0x7f40[_0x1187ba];return _0x589b74;};'use strict';var _=require('lodash');var util=require(_0x07f4('0x0'));var logger=require('../../config/logger')(_0x07f4('0x1'));var moment=require(_0x07f4('0x2'));var BPromise=require(_0x07f4('0x3'));var rp=require(_0x07f4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x07f4('0x5'));module[_0x07f4('0x6')]=function(_0x5231df,_0x514d86){return _0x5231df[_0x07f4('0x7')](_0x07f4('0x8'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41d7=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','util'];(function(_0x45deae,_0x85d57f){var _0x1c7381=function(_0x563d78){while(--_0x563d78){_0x45deae['push'](_0x45deae['shift']());}};_0x1c7381(++_0x85d57f);}(_0x41d7,0xdc));var _0x741d=function(_0x3c64e8,_0xf7f6f6){_0x3c64e8=_0x3c64e8-0x0;var _0x2911=_0x41d7[_0x3c64e8];return _0x2911;};'use strict';var _=require('lodash');var util=require(_0x741d('0x0'));var logger=require(_0x741d('0x1'))(_0x741d('0x2'));var moment=require(_0x741d('0x3'));var BPromise=require('bluebird');var rp=require(_0x741d('0x4'));var fs=require('fs');var path=require(_0x741d('0x5'));var rimraf=require(_0x741d('0x6'));var config=require(_0x741d('0x7'));var attributes=require(_0x741d('0x8'));module[_0x741d('0x9')]=function(_0x2661a3,_0x319572){return _0x2661a3[_0x741d('0xa')](_0x741d('0xb'),attributes,{'tableName':_0x741d('0xc'),'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 81cf1ed..585b806 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 _0xd9ba=['catch','find','debug','ShowWhatsappQueue','util','moment','bluebird','ioredis','rpc','../../config/environment','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetWhatsappQueue'];(function(_0x4ad977,_0x3adc7b){var _0x4474a8=function(_0x194494){while(--_0x194494){_0x4ad977['push'](_0x4ad977['shift']());}};_0x4474a8(++_0x3adc7b);}(_0xd9ba,0x8c));var _0xad9b=function(_0x4ee1af,_0xae2643){_0x4ee1af=_0x4ee1af-0x0;var _0x41d274=_0xd9ba[_0x4ee1af];return _0x41d274;};'use strict';var _=require('lodash');var util=require(_0xad9b('0x0'));var moment=require(_0xad9b('0x1'));var BPromise=require(_0xad9b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad9b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xad9b('0x4'));var config=require(_0xad9b('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xad9b('0x6')]=_['defaults'](config[_0xad9b('0x6')],{'host':_0xad9b('0x7'),'port':0x18eb});var socket=require(_0xad9b('0x8'))(new Redis(config['redis']));require(_0xad9b('0x9'))[_0xad9b('0xa')](socket);function respondWithRpcPromise(_0x33ae97,_0x2af7be,_0x434cbb){return new BPromise(function(_0x162a68,_0x54a847){return client[_0xad9b('0xb')](_0x33ae97,_0x434cbb)['then'](function(_0x57f0d1){logger[_0xad9b('0xc')](_0xad9b('0xd'),_0x2af7be,_0xad9b('0xe'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2af7be,'request\x20sent',JSON[_0xad9b('0xf')](_0x57f0d1));if(_0x57f0d1[_0xad9b('0x10')]){if(_0x57f0d1['error']['code']===0x1f4){logger['error'](_0xad9b('0xd'),_0x2af7be,_0x57f0d1[_0xad9b('0x10')][_0xad9b('0x11')]);return _0x54a847(_0x57f0d1['error'][_0xad9b('0x11')]);}logger[_0xad9b('0x10')](_0xad9b('0xd'),_0x2af7be,_0x57f0d1['error'][_0xad9b('0x11')]);return _0x162a68(_0x57f0d1['error'][_0xad9b('0x11')]);}else{logger[_0xad9b('0xc')](_0xad9b('0xd'),_0x2af7be,_0xad9b('0xe'));_0x162a68(_0x57f0d1['result'][_0xad9b('0x11')]);}})['catch'](function(_0xc663bd){logger[_0xad9b('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x2af7be,_0xc663bd);_0x54a847(_0xc663bd);});});}exports['GetWhatsappQueue']=function(_0x2c9fe6){var _0x45a5cc=this;return new Promise(function(_0x530c50,_0x43ddc0){return db[_0xad9b('0x12')][_0xad9b('0x13')]({'raw':_0x2c9fe6[_0xad9b('0x14')]?_0x2c9fe6['options'][_0xad9b('0x15')]===undefined?!![]:![]:!![],'where':_0x2c9fe6[_0xad9b('0x14')]?_0x2c9fe6[_0xad9b('0x14')][_0xad9b('0x16')]||null:null,'attributes':_0x2c9fe6['options']?_0x2c9fe6[_0xad9b('0x14')][_0xad9b('0x17')]||null:null,'limit':_0x2c9fe6[_0xad9b('0x14')]?_0x2c9fe6[_0xad9b('0x14')][_0xad9b('0x18')]||null:null,'include':_0x2c9fe6[_0xad9b('0x14')]?_0x2c9fe6[_0xad9b('0x14')][_0xad9b('0x19')]?_[_0xad9b('0x1a')](_0x2c9fe6[_0xad9b('0x14')]['include'],function(_0x2dc427){return{'model':db[_0x2dc427[_0xad9b('0x1b')]],'as':_0x2dc427['as'],'attributes':_0x2dc427[_0xad9b('0x17')],'include':_0x2dc427[_0xad9b('0x19')]?_[_0xad9b('0x1a')](_0x2dc427['include'],function(_0x57a0d5){return{'model':db[_0x57a0d5[_0xad9b('0x1b')]],'as':_0x57a0d5['as'],'attributes':_0x57a0d5[_0xad9b('0x17')],'include':_0x57a0d5[_0xad9b('0x19')]?_[_0xad9b('0x1a')](_0x57a0d5['include'],function(_0x1441a6){return{'model':db[_0x1441a6[_0xad9b('0x1b')]],'as':_0x1441a6['as'],'attributes':_0x1441a6[_0xad9b('0x17')]};}):[]};}):[]};}):[]:[]})[_0xad9b('0x1c')](function(_0x2b0549){logger[_0xad9b('0xc')](_0xad9b('0x1d'),_0x2c9fe6);logger['debug']('GetWhatsappQueue',_0x2c9fe6,JSON[_0xad9b('0xf')](_0x2b0549));_0x530c50(_0x2b0549);})[_0xad9b('0x1e')](function(_0xaea23c){logger['error'](_0xad9b('0x1d'),_0xaea23c[_0xad9b('0x11')],_0x2c9fe6);_0x43ddc0(_0x45a5cc[_0xad9b('0x10')](0x1f4,_0xaea23c['message']));});});};exports['ShowWhatsappQueue']=function(_0x479c02){var _0x2d94d2=this;return new Promise(function(_0x513ef0,_0x1a393d){return db[_0xad9b('0x12')][_0xad9b('0x1f')]({'raw':_0x479c02[_0xad9b('0x14')]?_0x479c02[_0xad9b('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x479c02[_0xad9b('0x14')]?_0x479c02[_0xad9b('0x14')][_0xad9b('0x16')]||null:null,'attributes':_0x479c02[_0xad9b('0x14')]?_0x479c02[_0xad9b('0x14')][_0xad9b('0x17')]||null:null,'include':_0x479c02[_0xad9b('0x14')]?_0x479c02[_0xad9b('0x14')][_0xad9b('0x19')]?_[_0xad9b('0x1a')](_0x479c02[_0xad9b('0x14')][_0xad9b('0x19')],function(_0x5c4446){return{'model':db[_0x5c4446['model']],'as':_0x5c4446['as'],'attributes':_0x5c4446[_0xad9b('0x17')],'include':_0x5c4446[_0xad9b('0x19')]?_[_0xad9b('0x1a')](_0x5c4446[_0xad9b('0x19')],function(_0x541833){return{'model':db[_0x541833[_0xad9b('0x1b')]],'as':_0x541833['as'],'attributes':_0x541833[_0xad9b('0x17')],'include':_0x541833[_0xad9b('0x19')]?_[_0xad9b('0x1a')](_0x541833[_0xad9b('0x19')],function(_0x231818){return{'model':db[_0x231818[_0xad9b('0x1b')]],'as':_0x231818['as'],'attributes':_0x231818[_0xad9b('0x17')]};}):[]};}):[]};}):[]:[]})[_0xad9b('0x1c')](function(_0x4e3d52){logger[_0xad9b('0xc')]('ShowWhatsappQueue',_0x479c02);logger[_0xad9b('0x20')](_0xad9b('0x21'),_0x479c02,JSON[_0xad9b('0xf')](_0x4e3d52));_0x513ef0(_0x4e3d52);})[_0xad9b('0x1e')](function(_0x507987){logger[_0xad9b('0x10')](_0xad9b('0x21'),_0x507987[_0xad9b('0x11')],_0x479c02);_0x1a393d(_0x2d94d2[_0xad9b('0x10')](0x1f4,_0x507987[_0xad9b('0x11')]));});});}; \ No newline at end of file +var _0xafe1=['info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','GetWhatsappQueue','ShowWhatsappQueue','find','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0xafe1,0x1a8));var _0x1afe=function(_0x1fa3d3,_0x42a2e0){_0x1fa3d3=_0x1fa3d3-0x0;var _0x51a3b5=_0xafe1[_0x1fa3d3];return _0x51a3b5;};'use strict';var _=require(_0x1afe('0x0'));var util=require('util');var moment=require(_0x1afe('0x1'));var BPromise=require(_0x1afe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1afe('0x3'));var db=require(_0x1afe('0x4'))['db'];var utils=require(_0x1afe('0x5'));var logger=require('../../config/logger')(_0x1afe('0x6'));var config=require('../../config/environment');var jayson=require(_0x1afe('0x7'));var client=jayson[_0x1afe('0x8')][_0x1afe('0x9')]({'port':0x232a});config['redis']=_[_0x1afe('0xa')](config[_0x1afe('0xb')],{'host':_0x1afe('0xc'),'port':0x18eb});var socket=require(_0x1afe('0xd'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x1afe('0xe')](socket);function respondWithRpcPromise(_0x55e336,_0x35821e,_0x5081a7){return new BPromise(function(_0x4564b2,_0x23232f){return client['request'](_0x55e336,_0x5081a7)[_0x1afe('0xf')](function(_0x58b06b){logger[_0x1afe('0x10')](_0x1afe('0x11'),_0x35821e,'request\x20sent');logger[_0x1afe('0x12')](_0x1afe('0x13'),_0x35821e,_0x1afe('0x14'),JSON[_0x1afe('0x15')](_0x58b06b));if(_0x58b06b[_0x1afe('0x16')]){if(_0x58b06b[_0x1afe('0x16')][_0x1afe('0x17')]===0x1f4){logger[_0x1afe('0x16')](_0x1afe('0x11'),_0x35821e,_0x58b06b[_0x1afe('0x16')][_0x1afe('0x18')]);return _0x23232f(_0x58b06b[_0x1afe('0x16')]['message']);}logger['error'](_0x1afe('0x11'),_0x35821e,_0x58b06b['error'][_0x1afe('0x18')]);return _0x4564b2(_0x58b06b[_0x1afe('0x16')][_0x1afe('0x18')]);}else{logger[_0x1afe('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x35821e,_0x1afe('0x14'));_0x4564b2(_0x58b06b[_0x1afe('0x19')][_0x1afe('0x18')]);}})[_0x1afe('0x1a')](function(_0x380029){logger[_0x1afe('0x16')](_0x1afe('0x11'),_0x35821e,_0x380029);_0x23232f(_0x380029);});});}exports['GetWhatsappQueue']=function(_0x52b5bf){var _0x1eefaa=this;return new Promise(function(_0xe1f4de,_0x961c87){return db[_0x1afe('0x1b')][_0x1afe('0x1c')]({'raw':_0x52b5bf[_0x1afe('0x1d')]?_0x52b5bf[_0x1afe('0x1d')][_0x1afe('0x1e')]===undefined?!![]:![]:!![],'where':_0x52b5bf[_0x1afe('0x1d')]?_0x52b5bf[_0x1afe('0x1d')]['where']||null:null,'attributes':_0x52b5bf[_0x1afe('0x1d')]?_0x52b5bf[_0x1afe('0x1d')][_0x1afe('0x1f')]||null:null,'limit':_0x52b5bf[_0x1afe('0x1d')]?_0x52b5bf[_0x1afe('0x1d')][_0x1afe('0x20')]||null:null,'include':_0x52b5bf[_0x1afe('0x1d')]?_0x52b5bf['options'][_0x1afe('0x21')]?_[_0x1afe('0x22')](_0x52b5bf[_0x1afe('0x1d')][_0x1afe('0x21')],function(_0x2d6888){return{'model':db[_0x2d6888[_0x1afe('0x23')]],'as':_0x2d6888['as'],'attributes':_0x2d6888[_0x1afe('0x1f')],'include':_0x2d6888['include']?_[_0x1afe('0x22')](_0x2d6888[_0x1afe('0x21')],function(_0x381bd2){return{'model':db[_0x381bd2['model']],'as':_0x381bd2['as'],'attributes':_0x381bd2[_0x1afe('0x1f')],'include':_0x381bd2[_0x1afe('0x21')]?_['map'](_0x381bd2['include'],function(_0x2a6400){return{'model':db[_0x2a6400['model']],'as':_0x2a6400['as'],'attributes':_0x2a6400['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x41026d){logger[_0x1afe('0x10')](_0x1afe('0x24'),_0x52b5bf);logger[_0x1afe('0x12')](_0x1afe('0x24'),_0x52b5bf,JSON[_0x1afe('0x15')](_0x41026d));_0xe1f4de(_0x41026d);})['catch'](function(_0x4ab70a){logger[_0x1afe('0x16')](_0x1afe('0x24'),_0x4ab70a['message'],_0x52b5bf);_0x961c87(_0x1eefaa[_0x1afe('0x16')](0x1f4,_0x4ab70a[_0x1afe('0x18')]));});});};exports[_0x1afe('0x25')]=function(_0x236ef6){var _0x515e0a=this;return new Promise(function(_0x1a5a04,_0x2abd36){return db[_0x1afe('0x1b')][_0x1afe('0x26')]({'raw':_0x236ef6[_0x1afe('0x1d')]?_0x236ef6['options']['raw']===undefined?!![]:![]:!![],'where':_0x236ef6[_0x1afe('0x1d')]?_0x236ef6['options'][_0x1afe('0x27')]||null:null,'attributes':_0x236ef6[_0x1afe('0x1d')]?_0x236ef6[_0x1afe('0x1d')]['attributes']||null:null,'include':_0x236ef6[_0x1afe('0x1d')]?_0x236ef6[_0x1afe('0x1d')]['include']?_[_0x1afe('0x22')](_0x236ef6[_0x1afe('0x1d')][_0x1afe('0x21')],function(_0x4b1df3){return{'model':db[_0x4b1df3[_0x1afe('0x23')]],'as':_0x4b1df3['as'],'attributes':_0x4b1df3[_0x1afe('0x1f')],'include':_0x4b1df3[_0x1afe('0x21')]?_[_0x1afe('0x22')](_0x4b1df3[_0x1afe('0x21')],function(_0x315001){return{'model':db[_0x315001['model']],'as':_0x315001['as'],'attributes':_0x315001[_0x1afe('0x1f')],'include':_0x315001[_0x1afe('0x21')]?_['map'](_0x315001[_0x1afe('0x21')],function(_0x2dc554){return{'model':db[_0x2dc554['model']],'as':_0x2dc554['as'],'attributes':_0x2dc554['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bf0ef){logger[_0x1afe('0x10')](_0x1afe('0x25'),_0x236ef6);logger['debug'](_0x1afe('0x25'),_0x236ef6,JSON[_0x1afe('0x15')](_0x1bf0ef));_0x1a5a04(_0x1bf0ef);})[_0x1afe('0x1a')](function(_0x21efbd){logger[_0x1afe('0x16')]('ShowWhatsappQueue',_0x21efbd['message'],_0x236ef6);_0x2abd36(_0x515e0a[_0x1afe('0x16')](0x1f4,_0x21efbd[_0x1afe('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 22390c8..b156e23 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 _0xb76d=['whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener','length'];(function(_0x386343,_0xf11726){var _0x34c5b8=function(_0x1a92ab){while(--_0x1a92ab){_0x386343['push'](_0x386343['shift']());}};_0x34c5b8(++_0xf11726);}(_0xb76d,0x127));var _0xdb76=function(_0x392a7d,_0xb7d60b){_0x392a7d=_0x392a7d-0x0;var _0x398b29=_0xb76d[_0x392a7d];return _0x398b29;};'use strict';var WhatsappQueueEvents=require(_0xdb76('0x0'));var events=[_0xdb76('0x1'),_0xdb76('0x2'),_0xdb76('0x3')];function createListener(_0x8d08b5,_0x5325e7){return function(_0x1e8791){_0x5325e7['emit'](_0x8d08b5,_0x1e8791);};}function removeListener(_0x417c2c,_0xcaa43a){return function(){WhatsappQueueEvents[_0xdb76('0x4')](_0x417c2c,_0xcaa43a);};}exports['register']=function(_0x5ecc75){for(var _0x7e1e8e=0x0,_0x56f49a=events[_0xdb76('0x5')];_0x7e1e8e<_0x56f49a;_0x7e1e8e++){var _0x368015=events[_0x7e1e8e];var _0x411fe0=createListener(_0xdb76('0x6')+_0x368015,_0x5ecc75);WhatsappQueueEvents['on'](_0x368015,_0x411fe0);}}; \ No newline at end of file +var _0x71f6=['./whatsappQueue.events','save','update','emit','removeListener','register','whatsappQueue:'];(function(_0x168951,_0x13030b){var _0x4fdb01=function(_0x2d1586){while(--_0x2d1586){_0x168951['push'](_0x168951['shift']());}};_0x4fdb01(++_0x13030b);}(_0x71f6,0x12d));var _0x671f=function(_0x4f64ae,_0x4d20a6){_0x4f64ae=_0x4f64ae-0x0;var _0x97f72d=_0x71f6[_0x4f64ae];return _0x97f72d;};'use strict';var WhatsappQueueEvents=require(_0x671f('0x0'));var events=[_0x671f('0x1'),'remove',_0x671f('0x2')];function createListener(_0x345202,_0x4f7032){return function(_0x527f12){_0x4f7032[_0x671f('0x3')](_0x345202,_0x527f12);};}function removeListener(_0x238fbb,_0x5119d0){return function(){WhatsappQueueEvents[_0x671f('0x4')](_0x238fbb,_0x5119d0);};}exports[_0x671f('0x5')]=function(_0x3cb0db){for(var _0x470c4d=0x0,_0x479a78=events['length'];_0x470c4d<_0x479a78;_0x470c4d++){var _0x4f7b30=events[_0x470c4d];var _0x1f1756=createListener(_0x671f('0x6')+_0x4f7b30,_0x3cb0db);WhatsappQueueEvents['on'](_0x4f7b30,_0x1f1756);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index bd58c86..e30a204 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 _0x7d3a=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','put','update','delete','/:id','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1c12b8,_0x4933bb){var _0x26d1d8=function(_0x2602b4){while(--_0x2602b4){_0x1c12b8['push'](_0x1c12b8['shift']());}};_0x26d1d8(++_0x4933bb);}(_0x7d3a,0x85));var _0xa7d3=function(_0x3707f4,_0x3b32e0){_0x3707f4=_0x3707f4-0x0;var _0x4173d0=_0x7d3a[_0x3707f4];return _0x4173d0;};'use strict';var multer=require(_0xa7d3('0x0'));var util=require(_0xa7d3('0x1'));var path=require(_0xa7d3('0x2'));var timeout=require(_0xa7d3('0x3'));var express=require(_0xa7d3('0x4'));var router=express[_0xa7d3('0x5')]();var fs_extra=require(_0xa7d3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa7d3('0x7'));var config=require(_0xa7d3('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0xa7d3('0x9')]('/',auth[_0xa7d3('0xa')](),controller[_0xa7d3('0xb')]);router[_0xa7d3('0x9')](_0xa7d3('0xc'),auth['isAuthenticated'](),controller[_0xa7d3('0xd')]);router['get']('/:id',auth[_0xa7d3('0xa')](),controller[_0xa7d3('0xe')]);router[_0xa7d3('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa7d3('0x10')]('/:id',auth[_0xa7d3('0xa')](),controller[_0xa7d3('0x11')]);router[_0xa7d3('0x12')](_0xa7d3('0x13'),auth[_0xa7d3('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe3df=['isAuthenticated','index','describe','/:id','show','put','update','exports','multer','util','path','express','Router','../../components/interaction/service','get'];(function(_0x4f652e,_0x149853){var _0x19451d=function(_0x2ef1cf){while(--_0x2ef1cf){_0x4f652e['push'](_0x4f652e['shift']());}};_0x19451d(++_0x149853);}(_0xe3df,0x1ac));var _0xfe3d=function(_0x40ec34,_0x1f9f4b){_0x40ec34=_0x40ec34-0x0;var _0x51c150=_0xe3df[_0x40ec34];return _0x51c150;};'use strict';var multer=require(_0xfe3d('0x0'));var util=require(_0xfe3d('0x1'));var path=require(_0xfe3d('0x2'));var timeout=require('connect-timeout');var express=require(_0xfe3d('0x3'));var router=express[_0xfe3d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe3d('0x5'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router[_0xfe3d('0x6')]('/',auth[_0xfe3d('0x7')](),controller[_0xfe3d('0x8')]);router[_0xfe3d('0x6')]('/describe',auth[_0xfe3d('0x7')](),controller[_0xfe3d('0x9')]);router[_0xfe3d('0x6')](_0xfe3d('0xa'),auth[_0xfe3d('0x7')](),controller[_0xfe3d('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfe3d('0xc')](_0xfe3d('0xa'),auth[_0xfe3d('0x7')](),controller[_0xfe3d('0xd')]);router['delete'](_0xfe3d('0xa'),auth[_0xfe3d('0x7')](),controller['destroy']);module[_0xfe3d('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 4ff3cbb..3d984ba 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x571e06,_0x501285){var _0x338652=function(_0x5a49d6){while(--_0x5a49d6){_0x571e06['push'](_0x571e06['shift']());}};_0x338652(++_0x501285);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x265814,_0x54a6ac){var _0x524ca9=function(_0x2d1234){while(--_0x2d1234){_0x265814['push'](_0x265814['shift']());}};_0x524ca9(++_0x54a6ac);}(_0x7a54,0x106));var _0x47a5=function(_0x5fda21,_0x3fed65){_0x5fda21=_0x5fda21-0x0;var _0xe31b07=_0x7a54[_0x5fda21];return _0xe31b07;};'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 0ef796c..5c62afa 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 _0xd87e=['squel','crypto','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','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappQueueReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs'];(function(_0x3afab1,_0x334e35){var _0x1dfdca=function(_0x18126f){while(--_0x18126f){_0x3afab1['push'](_0x3afab1['shift']());}};_0x1dfdca(++_0x334e35);}(_0xd87e,0x1bf));var _0xed87=function(_0x47ae44,_0x1ecf33){_0x47ae44=_0x47ae44-0x0;var _0x37c675=_0xd87e[_0x47ae44];return _0x37c675;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];function respondWithStatusCode(_0x5e912e,_0x4ffc2d){_0x4ffc2d=_0x4ffc2d||0xcc;return function(_0x466f35){if(_0x466f35){return _0x5e912e[_0xed87('0x18')](_0x4ffc2d);}return _0x5e912e[_0xed87('0x19')](_0x4ffc2d)[_0xed87('0x1a')]();};}function respondWithResult(_0x16bfd6,_0x3865c5){_0x3865c5=_0x3865c5||0xc8;return function(_0x52dfe8){if(_0x52dfe8){return _0x16bfd6[_0xed87('0x19')](_0x3865c5)[_0xed87('0x1b')](_0x52dfe8);}};}function respondWithFilteredResult(_0x1722a6,_0x1e9a3d){return function(_0x2f2fd3){if(_0x2f2fd3){var _0xd34e0e=typeof _0x1e9a3d[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x1e9a3d[_0xed87('0x1e')]==='undefined';var _0x3db5ea=_0x2f2fd3[_0xed87('0x1f')];var _0x2c386a=_0xd34e0e?0x0:_0x1e9a3d[_0xed87('0x1c')];var _0x5f4076=_0xd34e0e?_0x2f2fd3[_0xed87('0x1f')]:_0x1e9a3d[_0xed87('0x1c')]+_0x1e9a3d[_0xed87('0x1e')];var _0x3f9e08;if(_0x5f4076>=_0x3db5ea){_0x5f4076=_0x3db5ea;_0x3f9e08=0xc8;}else{_0x3f9e08=0xce;}_0x1722a6[_0xed87('0x19')](_0x3f9e08);return _0x1722a6[_0xed87('0x20')](_0xed87('0x21'),_0x2c386a+'-'+_0x5f4076+'/'+_0x3db5ea)[_0xed87('0x1b')](_0x2f2fd3);}return null;};}function patchUpdates(_0x3b7981){return function(_0x52e81c){try{jsonpatch['apply'](_0x52e81c,_0x3b7981,!![]);}catch(_0x5db546){return BPromise['reject'](_0x5db546);}return _0x52e81c[_0xed87('0x22')]();};}function saveUpdates(_0x5d3ec8,_0x4191a7){return function(_0x2b0b98){if(_0x2b0b98){return _0x2b0b98['update'](_0x5d3ec8)[_0xed87('0x23')](function(_0x505733){return _0x505733;});}return null;};}function removeEntity(_0x3d1641,_0x24962e){return function(_0x27799a){if(_0x27799a){return _0x27799a[_0xed87('0x24')]()[_0xed87('0x23')](function(){_0x3d1641['status'](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x3c22b7,_0x41e0d4){return function(_0x320bcc){if(!_0x320bcc){_0x3c22b7[_0xed87('0x18')](0x194);}return _0x320bcc;};}function handleError(_0x289e38,_0x25a6f7){_0x25a6f7=_0x25a6f7||0x1f4;return function(_0x4735b3){logger[_0xed87('0x25')](_0x4735b3[_0xed87('0x26')]);if(_0x4735b3[_0xed87('0x27')]){delete _0x4735b3[_0xed87('0x27')];}_0x289e38[_0xed87('0x19')](_0x25a6f7)[_0xed87('0x28')](_0x4735b3);};}exports['index']=function(_0xb32b1c,_0x1c4a65){var _0x4eaa44={},_0x3dff74={},_0x33c367={'count':0x0,'rows':[]};var _0x21c93b=_['map'](db['WhatsappQueueReport'][_0xed87('0x29')],function(_0x428b75){return{'name':_0x428b75[_0xed87('0x2a')],'type':_0x428b75['type'][_0xed87('0x2b')]};});_0x3dff74[_0xed87('0x2c')]=_[_0xed87('0x2d')](_0x21c93b,_0xed87('0x27'));_0x3dff74[_0xed87('0x2e')]=_[_0xed87('0x2f')](_0xb32b1c[_0xed87('0x2e')]);_0x3dff74[_0xed87('0x30')]=_[_0xed87('0x31')](_0x3dff74['model'],_0x3dff74[_0xed87('0x2e')]);_0x4eaa44[_0xed87('0x32')]=_['intersection'](_0x3dff74[_0xed87('0x2c')],qs['fields'](_0xb32b1c[_0xed87('0x2e')][_0xed87('0x33')]));_0x4eaa44[_0xed87('0x32')]=_0x4eaa44[_0xed87('0x32')][_0xed87('0x34')]?_0x4eaa44[_0xed87('0x32')]:_0x3dff74[_0xed87('0x2c')];if(!_0xb32b1c[_0xed87('0x2e')][_0xed87('0x35')](_0xed87('0x36'))){_0x4eaa44[_0xed87('0x1e')]=qs['limit'](_0xb32b1c[_0xed87('0x2e')][_0xed87('0x1e')]);_0x4eaa44['offset']=qs[_0xed87('0x1c')](_0xb32b1c['query'][_0xed87('0x1c')]);}_0x4eaa44[_0xed87('0x37')]=qs['sort'](_0xb32b1c[_0xed87('0x2e')][_0xed87('0x38')]);_0x4eaa44[_0xed87('0x39')]=qs[_0xed87('0x30')](_[_0xed87('0x3a')](_0xb32b1c['query'],_0x3dff74[_0xed87('0x30')]),_0x21c93b);if(_0xb32b1c['query'][_0xed87('0x3b')]){_0x4eaa44['where']=_[_0xed87('0x3c')](_0x4eaa44[_0xed87('0x39')],{'$or':_[_0xed87('0x2d')](_0x21c93b,function(_0x217435){if(_0x217435[_0xed87('0x3d')]!==_0xed87('0x3e')){var _0x9e3356={};_0x9e3356[_0x217435[_0xed87('0x27')]]={'$like':'%'+_0xb32b1c[_0xed87('0x2e')]['filter']+'%'};return _0x9e3356;}})});}_0x4eaa44=_['merge']({},_0x4eaa44,_0xb32b1c[_0xed87('0x3f')]);var _0x206544={'where':_0x4eaa44[_0xed87('0x39')]};return db[_0xed87('0x40')][_0xed87('0x1f')](_0x206544)[_0xed87('0x23')](function(_0x5d1bd0){_0x33c367[_0xed87('0x1f')]=_0x5d1bd0;if(_0xb32b1c[_0xed87('0x2e')][_0xed87('0x41')]){_0x4eaa44['include']=[{'all':!![]}];}return db[_0xed87('0x40')][_0xed87('0x42')](_0x4eaa44);})[_0xed87('0x23')](function(_0x1b0092){_0x33c367[_0xed87('0x43')]=_0x1b0092;return _0x33c367;})[_0xed87('0x23')](respondWithFilteredResult(_0x1c4a65,_0x4eaa44))[_0xed87('0x44')](handleError(_0x1c4a65,null));};exports[_0xed87('0x45')]=function(_0x35bd1c,_0x406b73){var _0x5c6925={'raw':!![],'where':{'id':_0x35bd1c[_0xed87('0x46')]['id']}},_0x7e6cbb={};_0x7e6cbb[_0xed87('0x2c')]=_['keys'](db['WhatsappQueueReport'][_0xed87('0x29')]);_0x7e6cbb[_0xed87('0x2e')]=_[_0xed87('0x2f')](_0x35bd1c[_0xed87('0x2e')]);_0x7e6cbb['filters']=_[_0xed87('0x31')](_0x7e6cbb[_0xed87('0x2c')],_0x7e6cbb['query']);_0x5c6925[_0xed87('0x32')]=_[_0xed87('0x31')](_0x7e6cbb[_0xed87('0x2c')],qs[_0xed87('0x33')](_0x35bd1c[_0xed87('0x2e')][_0xed87('0x33')]));_0x5c6925[_0xed87('0x32')]=_0x5c6925[_0xed87('0x32')][_0xed87('0x34')]?_0x5c6925[_0xed87('0x32')]:_0x7e6cbb[_0xed87('0x2c')];if(_0x35bd1c['query'][_0xed87('0x41')]){_0x5c6925[_0xed87('0x47')]=[{'all':!![]}];}_0x5c6925=_[_0xed87('0x3c')]({},_0x5c6925,_0x35bd1c[_0xed87('0x3f')]);return db[_0xed87('0x40')][_0xed87('0x48')](_0x5c6925)[_0xed87('0x23')](handleEntityNotFound(_0x406b73,null))[_0xed87('0x23')](respondWithResult(_0x406b73,null))[_0xed87('0x44')](handleError(_0x406b73,null));};exports[_0xed87('0x49')]=function(_0x8aa499,_0x26c8f4){return db[_0xed87('0x40')][_0xed87('0x49')](_0x8aa499[_0xed87('0x4a')],{})[_0xed87('0x23')](respondWithResult(_0x26c8f4,0xc9))[_0xed87('0x44')](handleError(_0x26c8f4,null));};exports['update']=function(_0x2c7bef,_0x1a68a7){if(_0x2c7bef[_0xed87('0x4a')]['id']){delete _0x2c7bef['body']['id'];}return db[_0xed87('0x40')][_0xed87('0x48')]({'where':{'id':_0x2c7bef['params']['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x1a68a7,null))[_0xed87('0x23')](saveUpdates(_0x2c7bef[_0xed87('0x4a')],null))[_0xed87('0x23')](respondWithResult(_0x1a68a7,null))['catch'](handleError(_0x1a68a7,null));};exports[_0xed87('0x24')]=function(_0x436e15,_0x3ca34c){return db[_0xed87('0x40')][_0xed87('0x48')]({'where':{'id':_0x436e15[_0xed87('0x46')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x3ca34c,null))[_0xed87('0x23')](removeEntity(_0x3ca34c,null))[_0xed87('0x44')](handleError(_0x3ca34c,null));};exports[_0xed87('0x4b')]=function(_0x25a514,_0x18846f){return db[_0xed87('0x40')]['describe']()[_0xed87('0x23')](respondWithResult(_0x18846f,null))['catch'](handleError(_0x18846f,null));}; \ No newline at end of file +var _0xe820=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','reject','save','update','then','destroy','error','name','index','WhatsappQueueReport','rawAttributes','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x4e204f,_0x417205){var _0x32e8e1=function(_0x566b89){while(--_0x566b89){_0x4e204f['push'](_0x4e204f['shift']());}};_0x32e8e1(++_0x417205);}(_0xe820,0xd2));var _0x0e82=function(_0xfee56,_0x5f42ad){_0xfee56=_0xfee56-0x0;var _0x488101=_0xe820[_0xfee56];return _0x488101;};'use strict';var emlformat=require(_0x0e82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e82('0x2'));var BPromise=require(_0x0e82('0x3'));var Mustache=require(_0x0e82('0x4'));var util=require('util');var path=require(_0x0e82('0x5'));var sox=require('sox');var csv=require(_0x0e82('0x6'));var ejs=require(_0x0e82('0x7'));var fs=require('fs');var fs_extra=require(_0x0e82('0x8'));var _=require(_0x0e82('0x9'));var squel=require(_0x0e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0e82('0xb'));var deskjs=require(_0x0e82('0xc'));var toCsv=require(_0x0e82('0x6'));var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require('ioredis');var authService=require(_0x0e82('0xf'));var qs=require(_0x0e82('0x10'));var as=require(_0x0e82('0x11'));var hardwareService=require(_0x0e82('0x12'));var logger=require(_0x0e82('0x13'))(_0x0e82('0x14'));var utils=require(_0x0e82('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0e82('0x16'));var db=require(_0x0e82('0x17'))['db'];function respondWithStatusCode(_0x21c40b,_0x1da28a){_0x1da28a=_0x1da28a||0xcc;return function(_0x166dc2){if(_0x166dc2){return _0x21c40b[_0x0e82('0x18')](_0x1da28a);}return _0x21c40b['status'](_0x1da28a)[_0x0e82('0x19')]();};}function respondWithResult(_0x5c161c,_0x48d99b){_0x48d99b=_0x48d99b||0xc8;return function(_0x1e4ddb){if(_0x1e4ddb){return _0x5c161c['status'](_0x48d99b)['json'](_0x1e4ddb);}};}function respondWithFilteredResult(_0x5a2d28,_0x3298c7){return function(_0x4d1aa0){if(_0x4d1aa0){var _0x585b9b=typeof _0x3298c7[_0x0e82('0x1a')]==='undefined'&&typeof _0x3298c7[_0x0e82('0x1b')]===_0x0e82('0x1c');var _0x233c6d=_0x4d1aa0[_0x0e82('0x1d')];var _0x53622b=_0x585b9b?0x0:_0x3298c7[_0x0e82('0x1a')];var _0x310aac=_0x585b9b?_0x4d1aa0[_0x0e82('0x1d')]:_0x3298c7[_0x0e82('0x1a')]+_0x3298c7[_0x0e82('0x1b')];var _0x1230e6;if(_0x310aac>=_0x233c6d){_0x310aac=_0x233c6d;_0x1230e6=0xc8;}else{_0x1230e6=0xce;}_0x5a2d28[_0x0e82('0x1e')](_0x1230e6);return _0x5a2d28[_0x0e82('0x1f')](_0x0e82('0x20'),_0x53622b+'-'+_0x310aac+'/'+_0x233c6d)[_0x0e82('0x21')](_0x4d1aa0);}return null;};}function patchUpdates(_0x5903c){return function(_0x493280){try{jsonpatch['apply'](_0x493280,_0x5903c,!![]);}catch(_0x294696){return BPromise[_0x0e82('0x22')](_0x294696);}return _0x493280[_0x0e82('0x23')]();};}function saveUpdates(_0xb0a31,_0xd48046){return function(_0x1bdad4){if(_0x1bdad4){return _0x1bdad4[_0x0e82('0x24')](_0xb0a31)[_0x0e82('0x25')](function(_0x56b3ad){return _0x56b3ad;});}return null;};}function removeEntity(_0x1b71b4,_0x13f023){return function(_0x3d6c28){if(_0x3d6c28){return _0x3d6c28[_0x0e82('0x26')]()['then'](function(){_0x1b71b4[_0x0e82('0x1e')](0xcc)[_0x0e82('0x19')]();});}};}function handleEntityNotFound(_0x7a9399,_0x16e11c){return function(_0x4900d3){if(!_0x4900d3){_0x7a9399[_0x0e82('0x18')](0x194);}return _0x4900d3;};}function handleError(_0x51dbcd,_0x595319){_0x595319=_0x595319||0x1f4;return function(_0x384f88){logger[_0x0e82('0x27')](_0x384f88['stack']);if(_0x384f88[_0x0e82('0x28')]){delete _0x384f88[_0x0e82('0x28')];}_0x51dbcd[_0x0e82('0x1e')](_0x595319)['send'](_0x384f88);};}exports[_0x0e82('0x29')]=function(_0x25fa4e,_0x4ee65a){var _0xabc536={},_0x59a5b6={},_0x4300f9={'count':0x0,'rows':[]};var _0x3ec302=_['map'](db[_0x0e82('0x2a')][_0x0e82('0x2b')],function(_0x661718){return{'name':_0x661718['fieldName'],'type':_0x661718['type'][_0x0e82('0x2c')]};});_0x59a5b6['model']=_[_0x0e82('0x2d')](_0x3ec302,'name');_0x59a5b6[_0x0e82('0x2e')]=_[_0x0e82('0x2f')](_0x25fa4e[_0x0e82('0x2e')]);_0x59a5b6['filters']=_[_0x0e82('0x30')](_0x59a5b6['model'],_0x59a5b6[_0x0e82('0x2e')]);_0xabc536[_0x0e82('0x31')]=_[_0x0e82('0x30')](_0x59a5b6[_0x0e82('0x32')],qs[_0x0e82('0x33')](_0x25fa4e[_0x0e82('0x2e')]['fields']));_0xabc536[_0x0e82('0x31')]=_0xabc536[_0x0e82('0x31')][_0x0e82('0x34')]?_0xabc536[_0x0e82('0x31')]:_0x59a5b6[_0x0e82('0x32')];if(!_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x35')](_0x0e82('0x36'))){_0xabc536[_0x0e82('0x1b')]=qs[_0x0e82('0x1b')](_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x1b')]);_0xabc536[_0x0e82('0x1a')]=qs[_0x0e82('0x1a')](_0x25fa4e[_0x0e82('0x2e')]['offset']);}_0xabc536[_0x0e82('0x37')]=qs[_0x0e82('0x38')](_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x38')]);_0xabc536['where']=qs[_0x0e82('0x39')](_[_0x0e82('0x3a')](_0x25fa4e['query'],_0x59a5b6[_0x0e82('0x39')]),_0x3ec302);if(_0x25fa4e['query']['filter']){_0xabc536[_0x0e82('0x3b')]=_[_0x0e82('0x3c')](_0xabc536[_0x0e82('0x3b')],{'$or':_[_0x0e82('0x2d')](_0x3ec302,function(_0x61a5ce){if(_0x61a5ce[_0x0e82('0x3d')]!==_0x0e82('0x3e')){var _0x50fed8={};_0x50fed8[_0x61a5ce['name']]={'$like':'%'+_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x3f')]+'%'};return _0x50fed8;}})});}_0xabc536=_[_0x0e82('0x3c')]({},_0xabc536,_0x25fa4e[_0x0e82('0x40')]);var _0x265872={'where':_0xabc536[_0x0e82('0x3b')]};return db[_0x0e82('0x2a')][_0x0e82('0x1d')](_0x265872)['then'](function(_0x3ba181){_0x4300f9[_0x0e82('0x1d')]=_0x3ba181;if(_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x41')]){_0xabc536[_0x0e82('0x42')]=[{'all':!![]}];}return db[_0x0e82('0x2a')][_0x0e82('0x43')](_0xabc536);})['then'](function(_0x311cb8){_0x4300f9[_0x0e82('0x44')]=_0x311cb8;return _0x4300f9;})[_0x0e82('0x25')](respondWithFilteredResult(_0x4ee65a,_0xabc536))[_0x0e82('0x45')](handleError(_0x4ee65a,null));};exports[_0x0e82('0x46')]=function(_0x423b14,_0x453cd3){var _0x50322b={'raw':!![],'where':{'id':_0x423b14['params']['id']}},_0x581764={};_0x581764['model']=_['keys'](db['WhatsappQueueReport'][_0x0e82('0x2b')]);_0x581764[_0x0e82('0x2e')]=_[_0x0e82('0x2f')](_0x423b14[_0x0e82('0x2e')]);_0x581764[_0x0e82('0x39')]=_[_0x0e82('0x30')](_0x581764[_0x0e82('0x32')],_0x581764[_0x0e82('0x2e')]);_0x50322b['attributes']=_['intersection'](_0x581764[_0x0e82('0x32')],qs[_0x0e82('0x33')](_0x423b14[_0x0e82('0x2e')][_0x0e82('0x33')]));_0x50322b[_0x0e82('0x31')]=_0x50322b[_0x0e82('0x31')][_0x0e82('0x34')]?_0x50322b[_0x0e82('0x31')]:_0x581764['model'];if(_0x423b14[_0x0e82('0x2e')]['includeAll']){_0x50322b[_0x0e82('0x42')]=[{'all':!![]}];}_0x50322b=_['merge']({},_0x50322b,_0x423b14[_0x0e82('0x40')]);return db['WhatsappQueueReport'][_0x0e82('0x47')](_0x50322b)[_0x0e82('0x25')](handleEntityNotFound(_0x453cd3,null))[_0x0e82('0x25')](respondWithResult(_0x453cd3,null))['catch'](handleError(_0x453cd3,null));};exports['create']=function(_0x331668,_0x132c45){return db[_0x0e82('0x2a')]['create'](_0x331668[_0x0e82('0x48')],{})['then'](respondWithResult(_0x132c45,0xc9))[_0x0e82('0x45')](handleError(_0x132c45,null));};exports[_0x0e82('0x24')]=function(_0x162890,_0x64406e){if(_0x162890[_0x0e82('0x48')]['id']){delete _0x162890[_0x0e82('0x48')]['id'];}return db[_0x0e82('0x2a')][_0x0e82('0x47')]({'where':{'id':_0x162890[_0x0e82('0x49')]['id']}})[_0x0e82('0x25')](handleEntityNotFound(_0x64406e,null))[_0x0e82('0x25')](saveUpdates(_0x162890[_0x0e82('0x48')],null))['then'](respondWithResult(_0x64406e,null))[_0x0e82('0x45')](handleError(_0x64406e,null));};exports[_0x0e82('0x26')]=function(_0x576726,_0x360858){return db['WhatsappQueueReport']['find']({'where':{'id':_0x576726[_0x0e82('0x49')]['id']}})['then'](handleEntityNotFound(_0x360858,null))[_0x0e82('0x25')](removeEntity(_0x360858,null))[_0x0e82('0x45')](handleError(_0x360858,null));};exports[_0x0e82('0x4a')]=function(_0x149100,_0xdbb813){return db['WhatsappQueueReport'][_0x0e82('0x4a')]()['then'](respondWithResult(_0xdbb813,null))[_0x0e82('0x45')](handleError(_0xdbb813,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index b341af9..fa11d3a 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 _0x0ad0=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x327922,_0x2dadab){var _0x31e3ab=function(_0x2345eb){while(--_0x2345eb){_0x327922['push'](_0x327922['shift']());}};_0x31e3ab(++_0x2dadab);}(_0x0ad0,0x1b5));var _0x00ad=function(_0xff17bc,_0x19adf5){_0xff17bc=_0xff17bc-0x0;var _0x32c249=_0x0ad0[_0xff17bc];return _0x32c249;};'use strict';var _=require('lodash');var util=require(_0x00ad('0x0'));var logger=require(_0x00ad('0x1'))(_0x00ad('0x2'));var moment=require(_0x00ad('0x3'));var BPromise=require(_0x00ad('0x4'));var rp=require(_0x00ad('0x5'));var fs=require('fs');var path=require(_0x00ad('0x6'));var rimraf=require(_0x00ad('0x7'));var config=require(_0x00ad('0x8'));var attributes=require('./whatsappQueueReport.attributes');module[_0x00ad('0x9')]=function(_0x428a59,_0xdbc329){return _0x428a59[_0x00ad('0xa')](_0x00ad('0xb'),attributes,{'tableName':_0x00ad('0xc'),'paranoid':![],'indexes':[{'name':_0x00ad('0xd'),'fields':[_0x00ad('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x936b=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x936b,0x182));var _0xb936=function(_0x4909a1,_0x156a52){_0x4909a1=_0x4909a1-0x0;var _0x265dbc=_0x936b[_0x4909a1];return _0x265dbc;};'use strict';var _=require(_0xb936('0x0'));var util=require(_0xb936('0x1'));var logger=require(_0xb936('0x2'))(_0xb936('0x3'));var moment=require(_0xb936('0x4'));var BPromise=require(_0xb936('0x5'));var rp=require(_0xb936('0x6'));var fs=require('fs');var path=require(_0xb936('0x7'));var rimraf=require(_0xb936('0x8'));var config=require(_0xb936('0x9'));var attributes=require(_0xb936('0xa'));module['exports']=function(_0xd59453,_0x19649c){return _0xd59453[_0xb936('0xb')](_0xb936('0xc'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xb936('0xd'),'fields':[_0xb936('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 241b78d..8b0601d 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 _0x4103=['rpc','../../config/environment','jayson/promise','client','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','update','body','where','info','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x537501,_0x1509e4){var _0x54bfc2=function(_0x29bd68){while(--_0x29bd68){_0x537501['push'](_0x537501['shift']());}};_0x54bfc2(++_0x1509e4);}(_0x4103,0x144));var _0x3410=function(_0x123885,_0x36e9ab){_0x123885=_0x123885-0x0;var _0x4d3e75=_0x4103[_0x123885];return _0x4d3e75;};'use strict';var _=require(_0x3410('0x0'));var util=require('util');var moment=require(_0x3410('0x1'));var BPromise=require('bluebird');var rs=require(_0x3410('0x2'));var fs=require('fs');var Redis=require(_0x3410('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3410('0x4'));var logger=require(_0x3410('0x5'))(_0x3410('0x6'));var config=require(_0x3410('0x7'));var jayson=require(_0x3410('0x8'));var client=jayson[_0x3410('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1031d9,_0x8c605a,_0xacded7){return new BPromise(function(_0x15a41c,_0x4f2f99){return client[_0x3410('0xa')](_0x1031d9,_0xacded7)[_0x3410('0xb')](function(_0x4d3a77){logger['info'](_0x3410('0xc'),_0x8c605a,_0x3410('0xd'));logger[_0x3410('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x8c605a,_0x3410('0xd'),JSON[_0x3410('0xf')](_0x4d3a77));if(_0x4d3a77[_0x3410('0x10')]){if(_0x4d3a77[_0x3410('0x10')][_0x3410('0x11')]===0x1f4){logger[_0x3410('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x8c605a,_0x4d3a77['error'][_0x3410('0x12')]);return _0x4f2f99(_0x4d3a77[_0x3410('0x10')][_0x3410('0x12')]);}logger[_0x3410('0x10')](_0x3410('0xc'),_0x8c605a,_0x4d3a77[_0x3410('0x10')][_0x3410('0x12')]);return _0x15a41c(_0x4d3a77[_0x3410('0x10')][_0x3410('0x12')]);}else{logger['info'](_0x3410('0xc'),_0x8c605a,'request\x20sent');_0x15a41c(_0x4d3a77[_0x3410('0x13')][_0x3410('0x12')]);}})['catch'](function(_0x55a858){logger[_0x3410('0x10')](_0x3410('0xc'),_0x8c605a,_0x55a858);_0x4f2f99(_0x55a858);});});}exports[_0x3410('0x14')]=function(_0x311107){var _0x316a4a=this;return new Promise(function(_0x4c7ea2,_0x167583){return db[_0x3410('0x15')][_0x3410('0x16')](_0x311107['body'],{'raw':_0x311107['options']?_0x311107[_0x3410('0x17')][_0x3410('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x39ae4e){logger['info'](_0x3410('0x14'),_0x311107);logger[_0x3410('0xe')](_0x3410('0x14'),_0x311107,JSON[_0x3410('0xf')](_0x39ae4e));_0x4c7ea2(_0x39ae4e);})['catch'](function(_0x2ad278){logger[_0x3410('0x10')](_0x3410('0x14'),_0x2ad278[_0x3410('0x12')],_0x311107);_0x167583(_0x316a4a[_0x3410('0x10')](0x1f4,_0x2ad278[_0x3410('0x12')]));});});};exports[_0x3410('0x19')]=function(_0x13d91e){var _0x426120=this;return new Promise(function(_0x5e472e,_0x2c5825){return db[_0x3410('0x15')][_0x3410('0x1a')](_0x13d91e[_0x3410('0x1b')],{'raw':_0x13d91e[_0x3410('0x17')]?_0x13d91e[_0x3410('0x17')][_0x3410('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13d91e[_0x3410('0x17')]?_0x13d91e['options'][_0x3410('0x1c')]||null:null,'attributes':_0x13d91e['options']?_0x13d91e['options']['attributes']||null:null,'limit':_0x13d91e[_0x3410('0x17')]?_0x13d91e['options']['limit']||null:null})[_0x3410('0xb')](function(_0x4733dc){logger[_0x3410('0x1d')](_0x3410('0x19'),_0x13d91e);logger['debug'](_0x3410('0x19'),_0x13d91e,JSON[_0x3410('0xf')](_0x4733dc));_0x5e472e(_0x4733dc);})['catch'](function(_0x44d15a){logger['error'](_0x3410('0x19'),_0x44d15a[_0x3410('0x12')],_0x13d91e);_0x2c5825(_0x426120[_0x3410('0x10')](0x1f4,_0x44d15a['message']));});});}; \ No newline at end of file +var _0xd0ea=['debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','catch','UpdateWhatsappQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x75ba48,_0x4ec4d6){var _0x49b049=function(_0x4f660){while(--_0x4f660){_0x75ba48['push'](_0x75ba48['shift']());}};_0x49b049(++_0x4ec4d6);}(_0xd0ea,0x1a2));var _0xad0e=function(_0x456af7,_0x3d36d3){_0x456af7=_0x456af7-0x0;var _0x3818f7=_0xd0ea[_0x456af7];return _0x3818f7;};'use strict';var _=require(_0xad0e('0x0'));var util=require(_0xad0e('0x1'));var moment=require(_0xad0e('0x2'));var BPromise=require(_0xad0e('0x3'));var rs=require(_0xad0e('0x4'));var fs=require('fs');var Redis=require(_0xad0e('0x5'));var db=require(_0xad0e('0x6'))['db'];var utils=require(_0xad0e('0x7'));var logger=require(_0xad0e('0x8'))(_0xad0e('0x9'));var config=require(_0xad0e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xad0e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0568,_0x474cbe,_0x2daca5){return new BPromise(function(_0x93843e,_0x5f26dc){return client['request'](_0x4e0568,_0x2daca5)[_0xad0e('0xc')](function(_0x2436ff){logger[_0xad0e('0xd')](_0xad0e('0xe'),_0x474cbe,_0xad0e('0xf'));logger[_0xad0e('0x10')](_0xad0e('0x11'),_0x474cbe,_0xad0e('0xf'),JSON[_0xad0e('0x12')](_0x2436ff));if(_0x2436ff[_0xad0e('0x13')]){if(_0x2436ff['error']['code']===0x1f4){logger['error'](_0xad0e('0xe'),_0x474cbe,_0x2436ff[_0xad0e('0x13')][_0xad0e('0x14')]);return _0x5f26dc(_0x2436ff[_0xad0e('0x13')][_0xad0e('0x14')]);}logger['error'](_0xad0e('0xe'),_0x474cbe,_0x2436ff[_0xad0e('0x13')]['message']);return _0x93843e(_0x2436ff[_0xad0e('0x13')][_0xad0e('0x14')]);}else{logger[_0xad0e('0xd')](_0xad0e('0xe'),_0x474cbe,_0xad0e('0xf'));_0x93843e(_0x2436ff[_0xad0e('0x15')][_0xad0e('0x14')]);}})['catch'](function(_0x138d91){logger[_0xad0e('0x13')](_0xad0e('0xe'),_0x474cbe,_0x138d91);_0x5f26dc(_0x138d91);});});}exports[_0xad0e('0x16')]=function(_0x55092b){var _0x3a70cd=this;return new Promise(function(_0xba152c,_0x579ef5){return db[_0xad0e('0x17')][_0xad0e('0x18')](_0x55092b[_0xad0e('0x19')],{'raw':_0x55092b[_0xad0e('0x1a')]?_0x55092b[_0xad0e('0x1a')][_0xad0e('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5cd1a6){logger[_0xad0e('0xd')](_0xad0e('0x16'),_0x55092b);logger[_0xad0e('0x10')]('CreateWhatsappQueueReport',_0x55092b,JSON[_0xad0e('0x12')](_0x5cd1a6));_0xba152c(_0x5cd1a6);})[_0xad0e('0x1c')](function(_0x23abd5){logger[_0xad0e('0x13')](_0xad0e('0x16'),_0x23abd5['message'],_0x55092b);_0x579ef5(_0x3a70cd[_0xad0e('0x13')](0x1f4,_0x23abd5[_0xad0e('0x14')]));});});};exports[_0xad0e('0x1d')]=function(_0xec440b){var _0x402acc=this;return new Promise(function(_0x547c75,_0xb8480d){return db[_0xad0e('0x17')][_0xad0e('0x1e')](_0xec440b[_0xad0e('0x19')],{'raw':_0xec440b[_0xad0e('0x1a')]?_0xec440b[_0xad0e('0x1a')][_0xad0e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xec440b[_0xad0e('0x1a')]?_0xec440b[_0xad0e('0x1a')]['where']||null:null,'attributes':_0xec440b['options']?_0xec440b[_0xad0e('0x1a')]['attributes']||null:null,'limit':_0xec440b[_0xad0e('0x1a')]?_0xec440b[_0xad0e('0x1a')]['limit']||null:null})[_0xad0e('0xc')](function(_0x1cadae){logger[_0xad0e('0xd')]('UpdateWhatsappQueueReport',_0xec440b);logger['debug'](_0xad0e('0x1d'),_0xec440b,JSON[_0xad0e('0x12')](_0x1cadae));_0x547c75(_0x1cadae);})[_0xad0e('0x1c')](function(_0x3311bd){logger[_0xad0e('0x13')]('UpdateWhatsappQueueReport',_0x3311bd[_0xad0e('0x14')],_0xec440b);_0xb8480d(_0x402acc[_0xad0e('0x13')](0x1f4,_0x3311bd[_0xad0e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index e591526..d94c515 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 _0x6f71=['describe','/:id','show','post','create','put','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','isAuthenticated'];(function(_0x47a444,_0x480724){var _0x3139a4=function(_0x5a0b71){while(--_0x5a0b71){_0x47a444['push'](_0x47a444['shift']());}};_0x3139a4(++_0x480724);}(_0x6f71,0xf8));var _0x16f7=function(_0x3949fd,_0x52c61d){_0x3949fd=_0x3949fd-0x0;var _0x10e4d2=_0x6f71[_0x3949fd];return _0x10e4d2;};'use strict';var multer=require(_0x16f7('0x0'));var util=require('util');var path=require(_0x16f7('0x1'));var timeout=require('connect-timeout');var express=require(_0x16f7('0x2'));var router=express[_0x16f7('0x3')]();var fs_extra=require(_0x16f7('0x4'));var auth=require(_0x16f7('0x5'));var interaction=require(_0x16f7('0x6'));var config=require(_0x16f7('0x7'));var controller=require(_0x16f7('0x8'));router[_0x16f7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x16f7('0x9')](_0x16f7('0xa'),auth[_0x16f7('0xb')](),controller[_0x16f7('0xc')]);router[_0x16f7('0x9')](_0x16f7('0xd'),auth[_0x16f7('0xb')](),controller[_0x16f7('0xe')]);router[_0x16f7('0xf')]('/',auth['isAuthenticated'](),controller[_0x16f7('0x10')]);router[_0x16f7('0x11')](_0x16f7('0xd'),auth[_0x16f7('0xb')](),controller['update']);router[_0x16f7('0x12')](_0x16f7('0xd'),auth['isAuthenticated'](),controller[_0x16f7('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8823=['../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','show','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2e0353,_0x3a2da6){var _0x3c344a=function(_0x5498d3){while(--_0x5498d3){_0x2e0353['push'](_0x2e0353['shift']());}};_0x3c344a(++_0x3a2da6);}(_0x8823,0x72));var _0x3882=function(_0x2881f1,_0x1ecd77){_0x2881f1=_0x2881f1-0x0;var _0x5925c1=_0x8823[_0x2881f1];return _0x5925c1;};'use strict';var multer=require(_0x3882('0x0'));var util=require(_0x3882('0x1'));var path=require(_0x3882('0x2'));var timeout=require(_0x3882('0x3'));var express=require(_0x3882('0x4'));var router=express['Router']();var fs_extra=require(_0x3882('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3882('0x6'));var config=require(_0x3882('0x7'));var controller=require(_0x3882('0x8'));router[_0x3882('0x9')]('/',auth[_0x3882('0xa')](),controller[_0x3882('0xb')]);router[_0x3882('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3882('0xc')]);router[_0x3882('0x9')]('/:id',auth[_0x3882('0xa')](),controller[_0x3882('0xd')]);router[_0x3882('0xe')]('/',auth[_0x3882('0xa')](),controller['create']);router['put'](_0x3882('0xf'),auth[_0x3882('0xa')](),controller[_0x3882('0x10')]);router[_0x3882('0x11')](_0x3882('0xf'),auth[_0x3882('0xa')](),controller[_0x3882('0x12')]);module[_0x3882('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 255a488..a0f0af7 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 _0x723c=['STRING','account','queue','DATE','exports'];(function(_0x449967,_0x49266a){var _0x283c82=function(_0x48ed62){while(--_0x48ed62){_0x449967['push'](_0x449967['shift']());}};_0x283c82(++_0x49266a);}(_0x723c,0x1ad));var _0xc723=function(_0x5cb24f,_0x4dc4c2){_0x5cb24f=_0x5cb24f-0x0;var _0x3d72e0=_0x723c[_0x5cb24f];return _0x3d72e0;};'use strict';var Sequelize=require('sequelize');module[_0xc723('0x0')]={'uniqueid':{'type':Sequelize[_0xc723('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc723('0x2'),'agent',_0xc723('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc723('0x4')]}}; \ No newline at end of file +var _0x72fa=['sequelize','exports','ENUM','account','agent'];(function(_0x185d8f,_0x16b7f1){var _0x39072b=function(_0x188220){while(--_0x188220){_0x185d8f['push'](_0x185d8f['shift']());}};_0x39072b(++_0x16b7f1);}(_0x72fa,0x78));var _0xa72f=function(_0x19077e,_0x1ae7cd){_0x19077e=_0x19077e-0x0;var _0x440fc3=_0x72fa[_0x19077e];return _0x440fc3;};'use strict';var Sequelize=require(_0xa72f('0x0'));module[_0xa72f('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa72f('0x2')](_0xa72f('0x3'),_0xa72f('0x4'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 0d75bf1..be3bb1d 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 _0x6aec=['to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x98a02d,_0x45cd5f){var _0x5d8ca2=function(_0x436893){while(--_0x436893){_0x98a02d['push'](_0x98a02d['shift']());}};_0x5d8ca2(++_0x45cd5f);}(_0x6aec,0x10e));var _0xc6ae=function(_0x27ace4,_0x414d60){_0x27ace4=_0x27ace4-0x0;var _0x52ba0f=_0x6aec[_0x27ace4];return _0x52ba0f;};'use strict';var emlformat=require(_0xc6ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6ae('0x1'));var jsonpatch=require(_0xc6ae('0x2'));var rp=require(_0xc6ae('0x3'));var moment=require(_0xc6ae('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc6ae('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xc6ae('0x6'));var ejs=require(_0xc6ae('0x7'));var fs=require('fs');var fs_extra=require(_0xc6ae('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc6ae('0x9'));var jsforce=require(_0xc6ae('0xa'));var deskjs=require(_0xc6ae('0xb'));var toCsv=require(_0xc6ae('0x6'));var querystring=require(_0xc6ae('0xc'));var Papa=require(_0xc6ae('0xd'));var Redis=require(_0xc6ae('0xe'));var authService=require(_0xc6ae('0xf'));var qs=require(_0xc6ae('0x10'));var as=require(_0xc6ae('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc6ae('0x12'));var utils=require(_0xc6ae('0x13'));var config=require(_0xc6ae('0x14'));var licenseUtil=require(_0xc6ae('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb8006d,_0x2fa5aa){_0x2fa5aa=_0x2fa5aa||0xcc;return function(_0x26c0c3){if(_0x26c0c3){return _0xb8006d[_0xc6ae('0x16')](_0x2fa5aa);}return _0xb8006d[_0xc6ae('0x17')](_0x2fa5aa)['end']();};}function respondWithResult(_0x3a280a,_0x35954d){_0x35954d=_0x35954d||0xc8;return function(_0x1000e3){if(_0x1000e3){return _0x3a280a[_0xc6ae('0x17')](_0x35954d)[_0xc6ae('0x18')](_0x1000e3);}};}function respondWithFilteredResult(_0x522485,_0x26153e){return function(_0x9ee663){if(_0x9ee663){var _0x4d23b8=typeof _0x26153e[_0xc6ae('0x19')]===_0xc6ae('0x1a')&&typeof _0x26153e[_0xc6ae('0x1b')]===_0xc6ae('0x1a');var _0x26e4f3=_0x9ee663[_0xc6ae('0x1c')];var _0x93a4f7=_0x4d23b8?0x0:_0x26153e[_0xc6ae('0x19')];var _0x3892af=_0x4d23b8?_0x9ee663[_0xc6ae('0x1c')]:_0x26153e[_0xc6ae('0x19')]+_0x26153e[_0xc6ae('0x1b')];var _0x5b6ed0;if(_0x3892af>=_0x26e4f3){_0x3892af=_0x26e4f3;_0x5b6ed0=0xc8;}else{_0x5b6ed0=0xce;}_0x522485[_0xc6ae('0x17')](_0x5b6ed0);return _0x522485[_0xc6ae('0x1d')](_0xc6ae('0x1e'),_0x93a4f7+'-'+_0x3892af+'/'+_0x26e4f3)['json'](_0x9ee663);}return null;};}function patchUpdates(_0x5d7417){return function(_0x3e39bf){try{jsonpatch[_0xc6ae('0x1f')](_0x3e39bf,_0x5d7417,!![]);}catch(_0x7fead1){return BPromise[_0xc6ae('0x20')](_0x7fead1);}return _0x3e39bf[_0xc6ae('0x21')]();};}function saveUpdates(_0x5c1368,_0x204b3d){return function(_0xd9b5fa){if(_0xd9b5fa){return _0xd9b5fa[_0xc6ae('0x22')](_0x5c1368)[_0xc6ae('0x23')](function(_0x473f0e){return _0x473f0e;});}return null;};}function removeEntity(_0x253c66,_0x2c6f70){return function(_0x40e4ef){if(_0x40e4ef){return _0x40e4ef[_0xc6ae('0x24')]()[_0xc6ae('0x23')](function(){_0x253c66['status'](0xcc)[_0xc6ae('0x25')]();});}};}function handleEntityNotFound(_0x107957,_0x5bb4ef){return function(_0xaff6ae){if(!_0xaff6ae){_0x107957[_0xc6ae('0x16')](0x194);}return _0xaff6ae;};}function handleError(_0x305a3c,_0x325092){_0x325092=_0x325092||0x1f4;return function(_0x435add){logger[_0xc6ae('0x26')](_0x435add['stack']);if(_0x435add['name']){delete _0x435add[_0xc6ae('0x27')];}_0x305a3c[_0xc6ae('0x17')](_0x325092)[_0xc6ae('0x28')](_0x435add);};}exports[_0xc6ae('0x29')]=function(_0x490ffd,_0x3a0cbc){var _0x323581={},_0x21c66e={},_0x524e8a={'count':0x0,'rows':[]};var _0x41a47=_[_0xc6ae('0x2a')](db[_0xc6ae('0x2b')][_0xc6ae('0x2c')],function(_0xa07ff0){return{'name':_0xa07ff0[_0xc6ae('0x2d')],'type':_0xa07ff0[_0xc6ae('0x2e')]['key']};});_0x21c66e[_0xc6ae('0x2f')]=_[_0xc6ae('0x2a')](_0x41a47,_0xc6ae('0x27'));_0x21c66e[_0xc6ae('0x30')]=_[_0xc6ae('0x31')](_0x490ffd[_0xc6ae('0x30')]);_0x21c66e[_0xc6ae('0x32')]=_['intersection'](_0x21c66e[_0xc6ae('0x2f')],_0x21c66e[_0xc6ae('0x30')]);_0x323581['attributes']=_[_0xc6ae('0x33')](_0x21c66e[_0xc6ae('0x2f')],qs[_0xc6ae('0x34')](_0x490ffd['query'][_0xc6ae('0x34')]));_0x323581['attributes']=_0x323581[_0xc6ae('0x35')]['length']?_0x323581['attributes']:_0x21c66e['model'];if(!_0x490ffd[_0xc6ae('0x30')]['hasOwnProperty']('nolimit')){_0x323581[_0xc6ae('0x1b')]=qs[_0xc6ae('0x1b')](_0x490ffd[_0xc6ae('0x30')][_0xc6ae('0x1b')]);_0x323581[_0xc6ae('0x19')]=qs[_0xc6ae('0x19')](_0x490ffd['query'][_0xc6ae('0x19')]);}_0x323581['order']=qs['sort'](_0x490ffd[_0xc6ae('0x30')]['sort']);_0x323581[_0xc6ae('0x36')]=qs['filters'](_['pick'](_0x490ffd[_0xc6ae('0x30')],_0x21c66e[_0xc6ae('0x32')]),_0x41a47);if(_0x490ffd[_0xc6ae('0x30')]['filter']){_0x323581[_0xc6ae('0x36')]=_[_0xc6ae('0x37')](_0x323581[_0xc6ae('0x36')],{'$or':_['map'](_0x41a47,function(_0x446a19){if(_0x446a19[_0xc6ae('0x2e')]!==_0xc6ae('0x38')){var _0x23edef={};_0x23edef[_0x446a19[_0xc6ae('0x27')]]={'$like':'%'+_0x490ffd[_0xc6ae('0x30')][_0xc6ae('0x39')]+'%'};return _0x23edef;}})});}_0x323581=_[_0xc6ae('0x37')]({},_0x323581,_0x490ffd['options']);var _0xfc7e92={'where':_0x323581[_0xc6ae('0x36')]};return db[_0xc6ae('0x2b')][_0xc6ae('0x1c')](_0xfc7e92)[_0xc6ae('0x23')](function(_0x1d92b6){_0x524e8a[_0xc6ae('0x1c')]=_0x1d92b6;if(_0x490ffd[_0xc6ae('0x30')][_0xc6ae('0x3a')]){_0x323581['include']=[{'all':!![]}];}return db[_0xc6ae('0x2b')][_0xc6ae('0x3b')](_0x323581);})['then'](function(_0x6dc23b){_0x524e8a[_0xc6ae('0x3c')]=_0x6dc23b;return _0x524e8a;})['then'](respondWithFilteredResult(_0x3a0cbc,_0x323581))[_0xc6ae('0x3d')](handleError(_0x3a0cbc,null));};exports[_0xc6ae('0x3e')]=function(_0x335dc1,_0x23a48a){var _0x330544={'raw':!![],'where':{'id':_0x335dc1[_0xc6ae('0x3f')]['id']}},_0x153b6a={};_0x153b6a[_0xc6ae('0x2f')]=_[_0xc6ae('0x31')](db[_0xc6ae('0x2b')][_0xc6ae('0x2c')]);_0x153b6a['query']=_[_0xc6ae('0x31')](_0x335dc1[_0xc6ae('0x30')]);_0x153b6a[_0xc6ae('0x32')]=_['intersection'](_0x153b6a[_0xc6ae('0x2f')],_0x153b6a['query']);_0x330544[_0xc6ae('0x35')]=_[_0xc6ae('0x33')](_0x153b6a[_0xc6ae('0x2f')],qs[_0xc6ae('0x34')](_0x335dc1['query']['fields']));_0x330544['attributes']=_0x330544['attributes'][_0xc6ae('0x40')]?_0x330544[_0xc6ae('0x35')]:_0x153b6a[_0xc6ae('0x2f')];if(_0x335dc1[_0xc6ae('0x30')][_0xc6ae('0x3a')]){_0x330544['include']=[{'all':!![]}];}_0x330544=_[_0xc6ae('0x37')]({},_0x330544,_0x335dc1['options']);return db['WhatsappTransferReport'][_0xc6ae('0x41')](_0x330544)['then'](handleEntityNotFound(_0x23a48a,null))[_0xc6ae('0x23')](respondWithResult(_0x23a48a,null))[_0xc6ae('0x3d')](handleError(_0x23a48a,null));};exports[_0xc6ae('0x42')]=function(_0x3be749,_0x4ed33e){return db[_0xc6ae('0x2b')]['create'](_0x3be749[_0xc6ae('0x43')],{})['then'](respondWithResult(_0x4ed33e,0xc9))[_0xc6ae('0x3d')](handleError(_0x4ed33e,null));};exports[_0xc6ae('0x22')]=function(_0x2ebe68,_0x19cd88){if(_0x2ebe68[_0xc6ae('0x43')]['id']){delete _0x2ebe68[_0xc6ae('0x43')]['id'];}return db[_0xc6ae('0x2b')][_0xc6ae('0x41')]({'where':{'id':_0x2ebe68['params']['id']}})[_0xc6ae('0x23')](handleEntityNotFound(_0x19cd88,null))[_0xc6ae('0x23')](saveUpdates(_0x2ebe68[_0xc6ae('0x43')],null))[_0xc6ae('0x23')](respondWithResult(_0x19cd88,null))[_0xc6ae('0x3d')](handleError(_0x19cd88,null));};exports['destroy']=function(_0x5c8ebf,_0xf066f2){return db[_0xc6ae('0x2b')][_0xc6ae('0x41')]({'where':{'id':_0x5c8ebf[_0xc6ae('0x3f')]['id']}})[_0xc6ae('0x23')](handleEntityNotFound(_0xf066f2,null))[_0xc6ae('0x23')](removeEntity(_0xf066f2,null))[_0xc6ae('0x3d')](handleError(_0xf066f2,null));};exports[_0xc6ae('0x44')]=function(_0x2df397,_0x296193){return db[_0xc6ae('0x2b')][_0xc6ae('0x44')]()[_0xc6ae('0x23')](respondWithResult(_0x296193,null))['catch'](handleError(_0x296193,null));}; \ No newline at end of file +var _0x3cb4=['map','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','WhatsappTransferReport','rows','catch','show','params','includeAll','include','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','end','json','offset','count','limit','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x3495b7,_0x3054fd){var _0x55eff5=function(_0x401d35){while(--_0x401d35){_0x3495b7['push'](_0x3495b7['shift']());}};_0x55eff5(++_0x3054fd);}(_0x3cb4,0x1f1));var _0x43cb=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x3cb4[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x43cb('0x0'));var zipdir=require(_0x43cb('0x1'));var jsonpatch=require(_0x43cb('0x2'));var rp=require(_0x43cb('0x3'));var moment=require(_0x43cb('0x4'));var BPromise=require(_0x43cb('0x5'));var Mustache=require(_0x43cb('0x6'));var util=require(_0x43cb('0x7'));var path=require('path');var sox=require(_0x43cb('0x8'));var csv=require(_0x43cb('0x9'));var ejs=require(_0x43cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43cb('0xb'));var squel=require(_0x43cb('0xc'));var crypto=require(_0x43cb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x43cb('0xe'));var toCsv=require(_0x43cb('0x9'));var querystring=require(_0x43cb('0xf'));var Papa=require(_0x43cb('0x10'));var Redis=require(_0x43cb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x43cb('0x12'));var as=require(_0x43cb('0x13'));var hardwareService=require(_0x43cb('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x43cb('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54f320,_0x593baa){_0x593baa=_0x593baa||0xcc;return function(_0x362982){if(_0x362982){return _0x54f320[_0x43cb('0x16')](_0x593baa);}return _0x54f320[_0x43cb('0x17')](_0x593baa)[_0x43cb('0x18')]();};}function respondWithResult(_0x422559,_0x3ea3d2){_0x3ea3d2=_0x3ea3d2||0xc8;return function(_0x33ffc4){if(_0x33ffc4){return _0x422559[_0x43cb('0x17')](_0x3ea3d2)[_0x43cb('0x19')](_0x33ffc4);}};}function respondWithFilteredResult(_0x3af51f,_0x2ecb6f){return function(_0x9a8ae0){if(_0x9a8ae0){var _0x252ebb=typeof _0x2ecb6f[_0x43cb('0x1a')]==='undefined'&&typeof _0x2ecb6f['limit']==='undefined';var _0x366af3=_0x9a8ae0[_0x43cb('0x1b')];var _0x4f52ce=_0x252ebb?0x0:_0x2ecb6f[_0x43cb('0x1a')];var _0x131797=_0x252ebb?_0x9a8ae0[_0x43cb('0x1b')]:_0x2ecb6f['offset']+_0x2ecb6f[_0x43cb('0x1c')];var _0x36ef48;if(_0x131797>=_0x366af3){_0x131797=_0x366af3;_0x36ef48=0xc8;}else{_0x36ef48=0xce;}_0x3af51f[_0x43cb('0x17')](_0x36ef48);return _0x3af51f['set']('Content-Range',_0x4f52ce+'-'+_0x131797+'/'+_0x366af3)[_0x43cb('0x19')](_0x9a8ae0);}return null;};}function patchUpdates(_0x122197){return function(_0x2e3f1c){try{jsonpatch[_0x43cb('0x1d')](_0x2e3f1c,_0x122197,!![]);}catch(_0x3cda74){return BPromise[_0x43cb('0x1e')](_0x3cda74);}return _0x2e3f1c[_0x43cb('0x1f')]();};}function saveUpdates(_0x2dc8f6,_0x3257a0){return function(_0x51f1b4){if(_0x51f1b4){return _0x51f1b4[_0x43cb('0x20')](_0x2dc8f6)[_0x43cb('0x21')](function(_0x365549){return _0x365549;});}return null;};}function removeEntity(_0x3c02a0,_0x3b09b5){return function(_0x497cef){if(_0x497cef){return _0x497cef[_0x43cb('0x22')]()[_0x43cb('0x21')](function(){_0x3c02a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd4bbc2,_0x1d4016){return function(_0x53095f){if(!_0x53095f){_0xd4bbc2[_0x43cb('0x16')](0x194);}return _0x53095f;};}function handleError(_0x496550,_0x16da69){_0x16da69=_0x16da69||0x1f4;return function(_0x2dbd36){logger[_0x43cb('0x23')](_0x2dbd36[_0x43cb('0x24')]);if(_0x2dbd36[_0x43cb('0x25')]){delete _0x2dbd36['name'];}_0x496550[_0x43cb('0x17')](_0x16da69)[_0x43cb('0x26')](_0x2dbd36);};}exports['index']=function(_0x166167,_0x4c54be){var _0x97c766={},_0x290aa1={},_0x42be5b={'count':0x0,'rows':[]};var _0x1eec68=_[_0x43cb('0x27')](db['WhatsappTransferReport'][_0x43cb('0x28')],function(_0x562f14){return{'name':_0x562f14['fieldName'],'type':_0x562f14['type']['key']};});_0x290aa1['model']=_[_0x43cb('0x27')](_0x1eec68,'name');_0x290aa1['query']=_[_0x43cb('0x29')](_0x166167[_0x43cb('0x2a')]);_0x290aa1[_0x43cb('0x2b')]=_[_0x43cb('0x2c')](_0x290aa1[_0x43cb('0x2d')],_0x290aa1[_0x43cb('0x2a')]);_0x97c766[_0x43cb('0x2e')]=_[_0x43cb('0x2c')](_0x290aa1[_0x43cb('0x2d')],qs['fields'](_0x166167[_0x43cb('0x2a')][_0x43cb('0x2f')]));_0x97c766[_0x43cb('0x2e')]=_0x97c766[_0x43cb('0x2e')][_0x43cb('0x30')]?_0x97c766[_0x43cb('0x2e')]:_0x290aa1[_0x43cb('0x2d')];if(!_0x166167[_0x43cb('0x2a')][_0x43cb('0x31')]('nolimit')){_0x97c766[_0x43cb('0x1c')]=qs[_0x43cb('0x1c')](_0x166167[_0x43cb('0x2a')][_0x43cb('0x1c')]);_0x97c766['offset']=qs[_0x43cb('0x1a')](_0x166167[_0x43cb('0x2a')]['offset']);}_0x97c766[_0x43cb('0x32')]=qs[_0x43cb('0x33')](_0x166167[_0x43cb('0x2a')][_0x43cb('0x33')]);_0x97c766[_0x43cb('0x34')]=qs[_0x43cb('0x2b')](_[_0x43cb('0x35')](_0x166167[_0x43cb('0x2a')],_0x290aa1['filters']),_0x1eec68);if(_0x166167['query']['filter']){_0x97c766[_0x43cb('0x34')]=_['merge'](_0x97c766[_0x43cb('0x34')],{'$or':_['map'](_0x1eec68,function(_0x31e421){if(_0x31e421['type']!=='VIRTUAL'){var _0x1ab3fa={};_0x1ab3fa[_0x31e421[_0x43cb('0x25')]]={'$like':'%'+_0x166167[_0x43cb('0x2a')][_0x43cb('0x36')]+'%'};return _0x1ab3fa;}})});}_0x97c766=_[_0x43cb('0x37')]({},_0x97c766,_0x166167[_0x43cb('0x38')]);var _0x32a7fe={'where':_0x97c766[_0x43cb('0x34')]};return db[_0x43cb('0x39')][_0x43cb('0x1b')](_0x32a7fe)['then'](function(_0x138958){_0x42be5b[_0x43cb('0x1b')]=_0x138958;if(_0x166167[_0x43cb('0x2a')]['includeAll']){_0x97c766['include']=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x97c766);})[_0x43cb('0x21')](function(_0xa14bf4){_0x42be5b[_0x43cb('0x3a')]=_0xa14bf4;return _0x42be5b;})[_0x43cb('0x21')](respondWithFilteredResult(_0x4c54be,_0x97c766))[_0x43cb('0x3b')](handleError(_0x4c54be,null));};exports[_0x43cb('0x3c')]=function(_0x360392,_0x261ece){var _0x4243b7={'raw':!![],'where':{'id':_0x360392[_0x43cb('0x3d')]['id']}},_0x317e73={};_0x317e73[_0x43cb('0x2d')]=_[_0x43cb('0x29')](db[_0x43cb('0x39')][_0x43cb('0x28')]);_0x317e73[_0x43cb('0x2a')]=_[_0x43cb('0x29')](_0x360392[_0x43cb('0x2a')]);_0x317e73[_0x43cb('0x2b')]=_[_0x43cb('0x2c')](_0x317e73[_0x43cb('0x2d')],_0x317e73[_0x43cb('0x2a')]);_0x4243b7['attributes']=_[_0x43cb('0x2c')](_0x317e73[_0x43cb('0x2d')],qs[_0x43cb('0x2f')](_0x360392[_0x43cb('0x2a')][_0x43cb('0x2f')]));_0x4243b7[_0x43cb('0x2e')]=_0x4243b7[_0x43cb('0x2e')][_0x43cb('0x30')]?_0x4243b7[_0x43cb('0x2e')]:_0x317e73[_0x43cb('0x2d')];if(_0x360392[_0x43cb('0x2a')][_0x43cb('0x3e')]){_0x4243b7[_0x43cb('0x3f')]=[{'all':!![]}];}_0x4243b7=_[_0x43cb('0x37')]({},_0x4243b7,_0x360392[_0x43cb('0x38')]);return db[_0x43cb('0x39')][_0x43cb('0x40')](_0x4243b7)[_0x43cb('0x21')](handleEntityNotFound(_0x261ece,null))['then'](respondWithResult(_0x261ece,null))[_0x43cb('0x3b')](handleError(_0x261ece,null));};exports['create']=function(_0x4040ad,_0xf72fab){return db[_0x43cb('0x39')]['create'](_0x4040ad[_0x43cb('0x41')],{})[_0x43cb('0x21')](respondWithResult(_0xf72fab,0xc9))[_0x43cb('0x3b')](handleError(_0xf72fab,null));};exports[_0x43cb('0x20')]=function(_0x3ccaeb,_0x6aaf47){if(_0x3ccaeb[_0x43cb('0x41')]['id']){delete _0x3ccaeb['body']['id'];}return db[_0x43cb('0x39')][_0x43cb('0x40')]({'where':{'id':_0x3ccaeb[_0x43cb('0x3d')]['id']}})[_0x43cb('0x21')](handleEntityNotFound(_0x6aaf47,null))[_0x43cb('0x21')](saveUpdates(_0x3ccaeb['body'],null))['then'](respondWithResult(_0x6aaf47,null))[_0x43cb('0x3b')](handleError(_0x6aaf47,null));};exports[_0x43cb('0x22')]=function(_0x1967cf,_0x2a48f9){return db[_0x43cb('0x39')]['find']({'where':{'id':_0x1967cf['params']['id']}})[_0x43cb('0x21')](handleEntityNotFound(_0x2a48f9,null))[_0x43cb('0x21')](removeEntity(_0x2a48f9,null))[_0x43cb('0x3b')](handleError(_0x2a48f9,null));};exports[_0x43cb('0x42')]=function(_0x211440,_0x33fd43){return db[_0x43cb('0x39')]['describe']()[_0x43cb('0x21')](respondWithResult(_0x33fd43,null))[_0x43cb('0x3b')](handleError(_0x33fd43,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index f50f513..55dbad4 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 _0xc473=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','uniqueid','lodash','util'];(function(_0x4e0090,_0x803be0){var _0x180148=function(_0xcc8682){while(--_0xcc8682){_0x4e0090['push'](_0x4e0090['shift']());}};_0x180148(++_0x803be0);}(_0xc473,0x1b8));var _0x3c47=function(_0x2b61c3,_0x4d941a){_0x2b61c3=_0x2b61c3-0x0;var _0x2690d2=_0xc473[_0x2b61c3];return _0x2690d2;};'use strict';var _=require(_0x3c47('0x0'));var util=require(_0x3c47('0x1'));var logger=require(_0x3c47('0x2'))('api');var moment=require(_0x3c47('0x3'));var BPromise=require(_0x3c47('0x4'));var rp=require(_0x3c47('0x5'));var fs=require('fs');var path=require(_0x3c47('0x6'));var rimraf=require(_0x3c47('0x7'));var config=require(_0x3c47('0x8'));var attributes=require(_0x3c47('0x9'));module[_0x3c47('0xa')]=function(_0x1b4b76,_0x44009f){return _0x1b4b76['define'](_0x3c47('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x3c47('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3057=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x21b762,_0xc8ef11){var _0x2ea6d4=function(_0x22bd14){while(--_0x22bd14){_0x21b762['push'](_0x21b762['shift']());}};_0x2ea6d4(++_0xc8ef11);}(_0x3057,0x1cd));var _0x7305=function(_0x55a9c2,_0x321663){_0x55a9c2=_0x55a9c2-0x0;var _0x5b4a2e=_0x3057[_0x55a9c2];return _0x5b4a2e;};'use strict';var _=require(_0x7305('0x0'));var util=require(_0x7305('0x1'));var logger=require(_0x7305('0x2'))('api');var moment=require(_0x7305('0x3'));var BPromise=require(_0x7305('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7305('0x5'));var rimraf=require(_0x7305('0x6'));var config=require(_0x7305('0x7'));var attributes=require(_0x7305('0x8'));module[_0x7305('0x9')]=function(_0x98e8de,_0x18cdce){return _0x98e8de[_0x7305('0xa')](_0x7305('0xb'),attributes,{'tableName':_0x7305('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7305('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 48dd699..a8b52e8 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 _0x361e=['WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3eae5b,_0x277ba9){var _0xfd82f6=function(_0xba8754){while(--_0xba8754){_0x3eae5b['push'](_0x3eae5b['shift']());}};_0xfd82f6(++_0x277ba9);}(_0x361e,0x1e9));var _0xe361=function(_0x2709ee,_0x4db185){_0x2709ee=_0x2709ee-0x0;var _0x35ba9a=_0x361e[_0x2709ee];return _0x35ba9a;};'use strict';var _=require(_0xe361('0x0'));var util=require(_0xe361('0x1'));var moment=require(_0xe361('0x2'));var BPromise=require(_0xe361('0x3'));var rs=require(_0xe361('0x4'));var fs=require('fs');var Redis=require(_0xe361('0x5'));var db=require(_0xe361('0x6'))['db'];var utils=require(_0xe361('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe361('0x8'));var jayson=require(_0xe361('0x9'));var client=jayson[_0xe361('0xa')][_0xe361('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x462ec9,_0xb13883,_0x904d2f){return new BPromise(function(_0x24265c,_0x1885be){return client[_0xe361('0xc')](_0x462ec9,_0x904d2f)[_0xe361('0xd')](function(_0x267a35){logger['info'](_0xe361('0xe'),_0xb13883,_0xe361('0xf'));logger[_0xe361('0x10')](_0xe361('0x11'),_0xb13883,_0xe361('0xf'),JSON[_0xe361('0x12')](_0x267a35));if(_0x267a35[_0xe361('0x13')]){if(_0x267a35[_0xe361('0x13')]['code']===0x1f4){logger['error'](_0xe361('0xe'),_0xb13883,_0x267a35[_0xe361('0x13')]['message']);return _0x1885be(_0x267a35[_0xe361('0x13')][_0xe361('0x14')]);}logger[_0xe361('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0xb13883,_0x267a35[_0xe361('0x13')][_0xe361('0x14')]);return _0x24265c(_0x267a35[_0xe361('0x13')][_0xe361('0x14')]);}else{logger[_0xe361('0x15')](_0xe361('0xe'),_0xb13883,'request\x20sent');_0x24265c(_0x267a35[_0xe361('0x16')][_0xe361('0x14')]);}})['catch'](function(_0x33de35){logger[_0xe361('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0xb13883,_0x33de35);_0x1885be(_0x33de35);});});} \ No newline at end of file +var _0x6030=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','util','moment'];(function(_0x926364,_0x1051e3){var _0x3e785a=function(_0x5becfd){while(--_0x5becfd){_0x926364['push'](_0x926364['shift']());}};_0x3e785a(++_0x1051e3);}(_0x6030,0x1d9));var _0x0603=function(_0x166a5a,_0x22bd21){_0x166a5a=_0x166a5a-0x0;var _0x47c2a7=_0x6030[_0x166a5a];return _0x47c2a7;};'use strict';var _=require('lodash');var util=require(_0x0603('0x0'));var moment=require(_0x0603('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0603('0x2'));var db=require(_0x0603('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0603('0x4'))(_0x0603('0x5'));var config=require(_0x0603('0x6'));var jayson=require(_0x0603('0x7'));var client=jayson[_0x0603('0x8')][_0x0603('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13801b,_0x925a3c,_0x8b602a){return new BPromise(function(_0x4dae8d,_0x519259){return client['request'](_0x13801b,_0x8b602a)['then'](function(_0x43b7ab){logger[_0x0603('0xa')]('WhatsappTransferReport,\x20%s,\x20%s',_0x925a3c,'request\x20sent');logger['debug'](_0x0603('0xb'),_0x925a3c,_0x0603('0xc'),JSON[_0x0603('0xd')](_0x43b7ab));if(_0x43b7ab['error']){if(_0x43b7ab[_0x0603('0xe')][_0x0603('0xf')]===0x1f4){logger[_0x0603('0xe')](_0x0603('0x10'),_0x925a3c,_0x43b7ab[_0x0603('0xe')][_0x0603('0x11')]);return _0x519259(_0x43b7ab[_0x0603('0xe')][_0x0603('0x11')]);}logger[_0x0603('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x925a3c,_0x43b7ab['error']['message']);return _0x4dae8d(_0x43b7ab[_0x0603('0xe')]['message']);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x925a3c,'request\x20sent');_0x4dae8d(_0x43b7ab[_0x0603('0x12')][_0x0603('0x11')]);}})['catch'](function(_0x233fb8){logger[_0x0603('0xe')](_0x0603('0x10'),_0x925a3c,_0x233fb8);_0x519259(_0x233fb8);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 6e7741f..8af84d1 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x308a=['filter','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./config/seedDB','./config/license','./rpc','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','then','seedDB','start','info','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name'];(function(_0x373059,_0x17b09c){var _0x368f67=function(_0xccc46c){while(--_0xccc46c){_0x373059['push'](_0x373059['shift']());}};_0x368f67(++_0x17b09c);}(_0x308a,0x71));var _0xa308=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x308a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa308('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xa308('0x1'));var checkLicense=require(_0xa308('0x2'));var rpc=require(_0xa308('0x3'));var config=require(_0xa308('0x4'));var logger=require('./config/logger')('app');var pm2=require(_0xa308('0x5'));var pm2Config=require(_0xa308('0x6'));var schedule=require(_0xa308('0x7'));var chat=require(_0xa308('0x8'));var whatsapp=require(_0xa308('0x9'));var transcribe=require(_0xa308('0xa'));var provider=require(_0xa308('0xb'));function main(){return db['sequelize']['sync']()[_0xa308('0xc')](function(){if(config[_0xa308('0xd')]){return seedDb['default']();}})[_0xa308('0xc')](function(){return checkLicense['default']();})[_0xa308('0xc')](function(){return rpc['listen']();})[_0xa308('0xc')](function(_0x19726b){logger['info'](_0x19726b);return chat[_0xa308('0xe')]();})['then'](function(){return whatsapp['start']();})[_0xa308('0xc')](function(){return schedule[_0xa308('0xe')]();})[_0xa308('0xc')](function(){return transcribe[_0xa308('0xe')]();})[_0xa308('0xc')](function(){return provider[_0xa308('0xe')]();})['then'](function(_0x361539){logger[_0xa308('0xf')](_0x361539);return pm2[_0xa308('0xe')](pm2Config);})[_0xa308('0xc')](function(_0x39b04c){var _0x5b0909=_0x39b04c['filter'](function(_0x558c31){return typeof _0x558c31[_0xa308('0x10')]===_0xa308('0x11')&&_0x558c31[_0xa308('0x10')]>=0x0;});if(_0x5b0909[_0xa308('0x12')]>0x0){throw new Error(_0x5b0909['length']+_0xa308('0x13')+_[_0xa308('0x14')](_0x5b0909,function(_0x1a94ba){return'\x22'+_0x1a94ba[_0xa308('0x15')][_0xa308('0x16')]+'\x22';}));}logger[_0xa308('0xf')]('Online\x20apps:',_[_0xa308('0x14')](_[_0xa308('0x17')](_0x39b04c,{'status':_0xa308('0x18')}),'name')[_0xa308('0x19')]());logger[_0xa308('0xf')](_0xa308('0x1a'),_[_0xa308('0x14')](_[_0xa308('0x17')](_0x39b04c,function(_0x2e1d96){return _0x2e1d96[_0xa308('0x1b')]!=='online';}),_0xa308('0x16'))[_0xa308('0x19')]()||_0xa308('0x1c'));console[_0xa308('0x1d')](_0xa308('0x1e'));})['catch'](function(_0x46f319){console[_0xa308('0x1d')](_0xa308('0x1f'),_0x46f319);logger[_0xa308('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x46f319);process[_0xa308('0x21')](0x1);});}main(); \ No newline at end of file +var _0x5b5a=['catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','listen','start','info','filter','exitCode','number','pm2_env','name','Online\x20apps:','map','online','join','Offline\x20apps:','status','None','log','App\x20Ready!'];(function(_0x42b3aa,_0x223f53){var _0x319157=function(_0x4e5c40){while(--_0x4e5c40){_0x42b3aa['push'](_0x42b3aa['shift']());}};_0x319157(++_0x223f53);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x467cb0,_0x303070){_0x467cb0=_0x467cb0-0x0;var _0x2153f7=_0x5b5a[_0x467cb0];return _0x2153f7;};'use strict';var _=require('lodash');var db=require(_0xa5b5('0x0'))['db'];var seedDb=require(_0xa5b5('0x1'));var checkLicense=require('./config/license');var rpc=require(_0xa5b5('0x2'));var config=require(_0xa5b5('0x3'));var logger=require(_0xa5b5('0x4'))(_0xa5b5('0x5'));var pm2=require(_0xa5b5('0x6'));var pm2Config=require(_0xa5b5('0x7'));var schedule=require(_0xa5b5('0x8'));var chat=require(_0xa5b5('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xa5b5('0xa'));var provider=require(_0xa5b5('0xb'));function main(){return db['sequelize'][_0xa5b5('0xc')]()[_0xa5b5('0xd')](function(){if(config[_0xa5b5('0xe')]){return seedDb[_0xa5b5('0xf')]();}})[_0xa5b5('0xd')](function(){return checkLicense[_0xa5b5('0xf')]();})[_0xa5b5('0xd')](function(){return rpc[_0xa5b5('0x10')]();})[_0xa5b5('0xd')](function(_0x1a35a0){logger['info'](_0x1a35a0);return chat['start']();})['then'](function(){return whatsapp['start']();})[_0xa5b5('0xd')](function(){return schedule['start']();})[_0xa5b5('0xd')](function(){return transcribe['start']();})[_0xa5b5('0xd')](function(){return provider[_0xa5b5('0x11')]();})[_0xa5b5('0xd')](function(_0x9b2f49){logger[_0xa5b5('0x12')](_0x9b2f49);return pm2[_0xa5b5('0x11')](pm2Config);})[_0xa5b5('0xd')](function(_0x5191c5){var _0x521626=_0x5191c5[_0xa5b5('0x13')](function(_0x578c26){return typeof _0x578c26[_0xa5b5('0x14')]===_0xa5b5('0x15')&&_0x578c26[_0xa5b5('0x14')]>=0x0;});if(_0x521626['length']>0x0){throw new Error(_0x521626['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x521626,function(_0x44689a){return'\x22'+_0x44689a[_0xa5b5('0x16')][_0xa5b5('0x17')]+'\x22';}));}logger[_0xa5b5('0x12')](_0xa5b5('0x18'),_[_0xa5b5('0x19')](_['filter'](_0x5191c5,{'status':_0xa5b5('0x1a')}),_0xa5b5('0x17'))[_0xa5b5('0x1b')]());logger['info'](_0xa5b5('0x1c'),_[_0xa5b5('0x19')](_[_0xa5b5('0x13')](_0x5191c5,function(_0x22a94f){return _0x22a94f[_0xa5b5('0x1d')]!==_0xa5b5('0x1a');}),_0xa5b5('0x17'))[_0xa5b5('0x1b')]()||_0xa5b5('0x1e'));console[_0xa5b5('0x1f')](_0xa5b5('0x20'));})[_0xa5b5('0x21')](function(_0x3313df){console[_0xa5b5('0x1f')](_0xa5b5('0x22'),_0x3313df);logger[_0xa5b5('0x23')](_0xa5b5('0x24'),_0x3313df);process[_0xa5b5('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index c80a88b..5d1ecee 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 _0xf3cd=['role','name','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','authorization','startsWith','Basic','User','authenticate','catch','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockDuration','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','test','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','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session'];(function(_0x2bd428,_0x93b4a6){var _0x58c122=function(_0x51ead8){while(--_0x51ead8){_0x2bd428['push'](_0x2bd428['shift']());}};_0x58c122(++_0x93b4a6);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x32bbb1,_0xa0e27e){_0x32bbb1=_0x32bbb1-0x0;var _0x42b415=_0xf3cd[_0x32bbb1];return _0x42b415;};'use strict';var db=require(_0xdf3c('0x0'))['db'];var config=require(_0xdf3c('0x1'));var hardwareConf=require(_0xdf3c('0x2'));var licenseUtil=require(_0xdf3c('0x3'));var encryptor=require(_0xdf3c('0x4'));var _=require(_0xdf3c('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xdf3c('0x6'));var compose=require(_0xdf3c('0x7'));var basicAuth=require(_0xdf3c('0x8'));var crypto=require('crypto');var BPromise=require(_0xdf3c('0x9'));var util=require(_0xdf3c('0xa'));var moment=require(_0xdf3c('0xb'));var validateJwt=expressJwt({'secret':config[_0xdf3c('0xc')][_0xdf3c('0xd')]});var userAttributes=['id',_0xdf3c('0xe'),'fullname',_0xdf3c('0xf'),'internal','email',_0xdf3c('0x10'),_0xdf3c('0x11'),'md5secret',_0xdf3c('0x12'),_0xdf3c('0x13'),_0xdf3c('0x14'),_0xdf3c('0x15'),_0xdf3c('0x16'),_0xdf3c('0x17'),_0xdf3c('0x18'),_0xdf3c('0x19'),'lastLoginAt',_0xdf3c('0x1a'),_0xdf3c('0x1b'),_0xdf3c('0x1c'),_0xdf3c('0x1d'),'alias',_0xdf3c('0x1e'),_0xdf3c('0x1f'),_0xdf3c('0x20'),'phoneBarEnableRecording',_0xdf3c('0x21'),_0xdf3c('0x22'),_0xdf3c('0x23'),_0xdf3c('0x24'),_0xdf3c('0x25'),_0xdf3c('0x26'),_0xdf3c('0x27'),_0xdf3c('0x28'),_0xdf3c('0x29'),_0xdf3c('0x2a'),'settingsEnabled',_0xdf3c('0x2b'),_0xdf3c('0x2c'),_0xdf3c('0x2d'),_0xdf3c('0x2e'),_0xdf3c('0x2f'),_0xdf3c('0x30'),_0xdf3c('0x31'),_0xdf3c('0x32'),_0xdf3c('0x33'),_0xdf3c('0x34'),_0xdf3c('0x35'),_0xdf3c('0x36'),_0xdf3c('0x37'),'openchannelAutoanswerDelay','faxAutoanswer',_0xdf3c('0x38'),'whatsappAutoanswer',_0xdf3c('0x39')];exports[_0xdf3c('0x3a')]=function(){return this[_0xdf3c('0x3b')](!![])[_0xdf3c('0x3c')](function(_0x33652f,_0x36ba1c,_0x50d8ca){if(_0x33652f[_0xdf3c('0x3d')]){_0x50d8ca();}else{return db[_0xdf3c('0x3e')][_0xdf3c('0x3f')]({'where':{'id':_0x33652f[_0xdf3c('0x40')]['id']},'attributes':['id',_0xdf3c('0x41'),_0xdf3c('0x42')],'raw':!![]})[_0xdf3c('0x43')](function(_0x155f54){if(_0x155f54&&_0x155f54[_0xdf3c('0x41')]){return _0x36ba1c[_0xdf3c('0x44')](_0x155f54['disposition']===_0xdf3c('0x45')?0x195:0x193)[_0xdf3c('0x46')]({'message':_0x155f54['disposition']===_0xdf3c('0x45')?'Unmanaged.':'Forbidden.'});}else{_0x50d8ca();}})['catch'](function(_0x14aac9){_0x50d8ca(_0x14aac9);});}});};exports[_0xdf3c('0x3b')]=function isAuthenticated(_0x52b8f6){return compose()['use'](function(_0x37ecfd,_0x1f2ce4,_0xd3cfcb){var _0x1ccdd4;if(_0x37ecfd['headers'][_0xdf3c('0x47')]){if(_[_0xdf3c('0x48')](_0x37ecfd['headers']['authorization'],_0xdf3c('0x49'))){var _0x46f0e3=basicAuth(_0x37ecfd);db[_0xdf3c('0x4a')]['find']({'where':{'name':_0x46f0e3[_0xdf3c('0xf')]}})[_0xdf3c('0x43')](function(_0x21e7b8){if(!_0x21e7b8||!_0x21e7b8[_0xdf3c('0x4b')](_0x46f0e3['pass'])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':'Wrong\x20credentials.'});}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x21e7b8['id']};_0xd3cfcb();})[_0xdf3c('0x4c')](function(_0x217a65){_0xd3cfcb(_0x217a65);});}else if(_[_0xdf3c('0x48')](_0x37ecfd['headers'][_0xdf3c('0x47')],_0xdf3c('0x4d'))){validateJwt(_0x37ecfd,_0x1f2ce4,_0xd3cfcb);}else{if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4[_0xdf3c('0x44')](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x37ecfd[_0xdf3c('0x4e')][_0xdf3c('0x4f')]){try{var _0x5ddd21={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};verifyJwt(_0x37ecfd['query'][_0xdf3c('0x4f')],_0x5ddd21)['then'](function(_0x57faba){return db['User'][_0xdf3c('0x51')]({'where':{'id':_0x57faba[_0xdf3c('0x52')]}})[_0xdf3c('0x43')](function(_0x29b5b7){_0x1ccdd4=_0x29b5b7;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xdf3c('0x53'),'blockDuration'],'raw':!![]});})[_0xdf3c('0x43')](function(_0x17b502){if(!_0x1ccdd4||!_[_0xdf3c('0x54')](_0x1ccdd4[_0xdf3c('0x55')],_0x57faba[_0xdf3c('0x56')])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x57')});}if(_0x1ccdd4[_0xdf3c('0x58')]){return _0x1f2ce4['status'](0x191)[_0xdf3c('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1ccdd4['blocked']){if(_0x17b502[_0xdf3c('0x59')]>0x0){if(moment(_0x1ccdd4['blockedAt'])[_0xdf3c('0x5a')](_0x17b502['blockDuration'],_0xdf3c('0x5b'))>moment()){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}else{return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x1ccdd4['id']};_0xd3cfcb();});})[_0xdf3c('0x4c')](function(){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});});}catch(_0x57e0ab){_0xd3cfcb(_0x57e0ab);}}else if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4['status'](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}})[_0xdf3c('0x3c')](function(_0x14d8e1,_0x46194d,_0x328b18){if(_0x14d8e1['user']){db['User'][_0xdf3c('0x51')]({'where':{'id':_0x14d8e1[_0xdf3c('0x3d')]['id']},'attributes':userAttributes})[_0xdf3c('0x43')](function(_0x4c59ef){if(!_0x4c59ef){return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5d')});}_0x14d8e1[_0xdf3c('0x3d')]=_0x4c59ef;_0x328b18();})['catch'](function(_0x127685){_0x328b18(_0x127685);});}else if(_0x52b8f6){_0x328b18();}else{return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5e')});}});};exports[_0xdf3c('0x5f')]=function canUpdate(){return compose()['use'](function(_0x410aaf,_0x286b72,_0x437443){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x344f1e){if(_0x344f1e['update']){_0x437443();}else{return _0x286b72['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})['catch'](function(_0x5c9885){_0x437443(_0x5c9885);});});};exports[_0xdf3c('0x62')]=function isWebrtcLicence(){return compose()[_0xdf3c('0x3c')](function(_0x46b2bd,_0x2aeb29,_0xaae4bc){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x84c5c2){if(_0x84c5c2[_0xdf3c('0x63')]){_0xaae4bc();}else{return _0x2aeb29['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})[_0xdf3c('0x4c')](function(_0xe760dd){_0xaae4bc(_0xe760dd);});});};exports[_0xdf3c('0x64')]=function(_0x385824,_0x28a468,_0x553f70){_0x385824[_0xdf3c('0x64')]=!![];return _0x553f70();};exports['signToken']=function signToken(_0xa4e137){return signJwt(_0xa4e137);};exports['setTokenCookie']=function(_0x41b78c,_0x28144f){if(!_0x41b78c[_0xdf3c('0x3d')]){return _0x28144f[_0xdf3c('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a068a={'payload':{'id':_0x41b78c[_0xdf3c('0x3d')]['id'],'role':_0x41b78c['user'][_0xdf3c('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a068a)[_0xdf3c('0x43')](function(_0x446713){_0x28144f[_0xdf3c('0x65')](_0xdf3c('0x66'),_0x446713);_0x28144f['redirect']('/dashboards/general');})[_0xdf3c('0x4c')](function(_0x27a541){return _0x28144f['status'](0x1f4)[_0xdf3c('0x67')](_0x27a541);});};exports[_0xdf3c('0x68')]=function(_0x168eaf){if(_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x55')])||_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x6a')])){return null;}else{return createJwt(_0x168eaf);}};exports['generateApiKey']=function(_0x4c98dc){_0x4c98dc[_0xdf3c('0x55')]=generateNonce();_0x4c98dc[_0xdf3c('0x6a')]=generateIssuedAt();return createJwt(_0x4c98dc);};exports[_0xdf3c('0x6b')]=function(_0x1ad771,_0x22de6c){var _0x39f38f=_0x1ad771[_0xdf3c('0x4e')][_0xdf3c('0x4f')];if(_0x39f38f){var _0x143d01={'nonce':_0x22de6c[_0xdf3c('0x55')],'iat':_0x22de6c[_0xdf3c('0x6a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};return verifyJwt(_0x39f38f,_0x143d01)['then'](function(){return generateApiKey(_0x22de6c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x58fcbf){var _0x541c57=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x541c57[_0xdf3c('0x6c')](_0x58fcbf))throw new db[(_0xdf3c('0x6d'))]['ValidationError'](_0xdf3c('0x6e'));return;};exports[_0xdf3c('0x6f')]=function(_0x51f8dd,_0xa8dddb,_0x28f935){var _0x10e9d5=encryptor[_0xdf3c('0x70')](_0xa8dddb)[_0xdf3c('0x71')](',');for(var _0x28f387=0x0;_0x28f387<_0x28f935;_0x28f387++){if(!_0x10e9d5[_0x28f387])break;if(_0x51f8dd[_0xdf3c('0x72')]()===_0x10e9d5[_0x28f387][_0xdf3c('0x72')]()){var _0x42efa2=util[_0xdf3c('0x73')](_0xdf3c('0x74'),_0x28f935);if(_0x28f935===0x1){_0x42efa2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xdf3c('0x6d'))][(_0xdf3c('0x75'))](_0x42efa2);}}return;};exports[_0xdf3c('0x76')]=function(_0x5a3d63,_0x245c68){var _0x3e327e=_0x245c68?encryptor[_0xdf3c('0x70')](_0x245c68)['split'](','):[];if(_0x3e327e[_0xdf3c('0x77')]===0x5){_0x3e327e[_0xdf3c('0x78')](-0x1,0x1);}_0x3e327e['unshift'](_0x5a3d63);return encryptor[_0xdf3c('0x79')](_0x3e327e['join'](','));};function signJwt(_0x28c296){var _0x1b03e7=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7b')],{'context':jwt});var _0xed2a78=_0x28c296[_0xdf3c('0x7c')]||config[_0xdf3c('0xc')][_0xdf3c('0xd')];return new BPromise(function(_0x2922d8,_0x330730){_0x1b03e7(_0x28c296[_0xdf3c('0x7d')],_0xed2a78,_0x28c296[_0xdf3c('0x7e')])[_0xdf3c('0x43')](function(_0x206a18){_0x2922d8(_0x206a18);})[_0xdf3c('0x4c')](function(_0xe42432){_0x330730(_0xe42432);});});}function verifyJwt(_0xd7fb2d,_0x510538,_0x4dade5){var _0x2e8511=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7f')],{'context':jwt});var _0x596282=_0x4dade5||config[_0xdf3c('0xc')]['session'];return new BPromise(function(_0x574852,_0x184952){_0x2e8511(_0xd7fb2d,_0x596282,_0x510538)[_0xdf3c('0x43')](function(_0x1121b9){_0x574852(_0x1121b9);})[_0xdf3c('0x4c')](function(_0x68f487){_0x184952(_0x68f487);});});}function generateNonce(){return crypto[_0xdf3c('0x80')](0x10)[_0xdf3c('0x81')](_0xdf3c('0x82'));}function generateIssuedAt(){return Math[_0xdf3c('0x83')](Date[_0xdf3c('0x84')]()/0x3e8)[_0xdf3c('0x81')]();}function createJwt(_0x5a2dad){var _0x34000c={'payload':{'iat':_0x5a2dad['apiKeyIat'],'nonce':_0x5a2dad[_0xdf3c('0x55')]},'options':{'algorithm':_0xdf3c('0x85'),'subject':_0x5a2dad['id'][_0xdf3c('0x81')](),'issuer':hardwareConf[_0xdf3c('0x50')](),'audience':hardwareConf[_0xdf3c('0x50')]()}};return signJwt(_0x34000c)['then'](function(_0x18bf4f){return{'iat':_0x5a2dad[_0xdf3c('0x6a')],'nonce':_0x5a2dad[_0xdf3c('0x55')],'token':_0x18bf4f};});} \ No newline at end of file +var _0x9c44=['showWebBar','lastLoginAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','user','ChatInteraction','findOne','params','then','status','disposition','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','authorization','startsWith','Basic','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','User','find','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','use','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','sign','options','promisify','toString','hex','floor','now','HS512','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','crypto','util','moment','secrets','session','role','name','internal','email','userpic','voicePause','chatPause','faxPause','smsPause'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0x49c4('0x0'));var licenseUtil=require(_0x49c4('0x1'));var encryptor=require(_0x49c4('0x2'));var _=require(_0x49c4('0x3'));var jwt=require(_0x49c4('0x4'));var expressJwt=require(_0x49c4('0x5'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x49c4('0x6'));var BPromise=require('bluebird');var util=require(_0x49c4('0x7'));var moment=require(_0x49c4('0x8'));var validateJwt=expressJwt({'secret':config[_0x49c4('0x9')][_0x49c4('0xa')]});var userAttributes=['id',_0x49c4('0xb'),'fullname',_0x49c4('0xc'),_0x49c4('0xd'),_0x49c4('0xe'),_0x49c4('0xf'),'permissions','md5secret',_0x49c4('0x10'),_0x49c4('0x11'),'mailPause',_0x49c4('0x12'),_0x49c4('0x13'),'openchannelPause','pauseType',_0x49c4('0x14'),_0x49c4('0x15'),'lastPauseAt',_0x49c4('0x16'),_0x49c4('0x17'),'passwordResetAt',_0x49c4('0x18'),_0x49c4('0x19'),_0x49c4('0x1a'),_0x49c4('0x1b'),_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),'phoneBarPrefixRequired',_0x49c4('0x20'),_0x49c4('0x21'),_0x49c4('0x22'),_0x49c4('0x23'),_0x49c4('0x24'),'privacyEnabled',_0x49c4('0x25'),_0x49c4('0x26'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x49c4('0x27'),_0x49c4('0x28'),_0x49c4('0x29'),'chatAutoanswer',_0x49c4('0x2a'),'emailAutoanswer',_0x49c4('0x2b'),_0x49c4('0x2c'),_0x49c4('0x2d'),_0x49c4('0x2e'),_0x49c4('0x2f'),_0x49c4('0x30'),_0x49c4('0x31'),_0x49c4('0x32'),_0x49c4('0x33')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])['use'](function(_0x1c99b1,_0x4f0b62,_0x592bb8){if(_0x1c99b1[_0x49c4('0x34')]){_0x592bb8();}else{return db[_0x49c4('0x35')][_0x49c4('0x36')]({'where':{'id':_0x1c99b1[_0x49c4('0x37')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x49c4('0x38')](function(_0x9cb797){if(_0x9cb797&&_0x9cb797['closed']){return _0x4f0b62[_0x49c4('0x39')](_0x9cb797[_0x49c4('0x3a')]===_0x49c4('0x3b')?0x195:0x193)[_0x49c4('0x3c')]({'message':_0x9cb797['disposition']==='unmanaged'?_0x49c4('0x3d'):'Forbidden.'});}else{_0x592bb8();}})[_0x49c4('0x3e')](function(_0x3852b2){_0x592bb8(_0x3852b2);});}});};exports[_0x49c4('0x3f')]=function isAuthenticated(_0x372a47){return compose()['use'](function(_0x889909,_0x2b2793,_0x46e04d){var _0x4f28a2;if(_0x889909[_0x49c4('0x40')][_0x49c4('0x41')]){if(_[_0x49c4('0x42')](_0x889909[_0x49c4('0x40')][_0x49c4('0x41')],_0x49c4('0x43'))){var _0x46f7ea=basicAuth(_0x889909);db['User']['find']({'where':{'name':_0x46f7ea['name']}})[_0x49c4('0x38')](function(_0x7ee704){if(!_0x7ee704||!_0x7ee704[_0x49c4('0x44')](_0x46f7ea[_0x49c4('0x45')])){return _0x2b2793[_0x49c4('0x39')](0x191)['json']({'message':_0x49c4('0x46')});}_0x889909[_0x49c4('0x34')]={'id':_0x7ee704['id']};_0x46e04d();})[_0x49c4('0x3e')](function(_0x24bba9){_0x46e04d(_0x24bba9);});}else if(_['startsWith'](_0x889909['headers'][_0x49c4('0x41')],_0x49c4('0x47'))){validateJwt(_0x889909,_0x2b2793,_0x46e04d);}else{if(_0x372a47){_0x46e04d();}else{return _0x2b2793[_0x49c4('0x39')](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x48')});}}}else if(_0x889909['query'][_0x49c4('0x49')]){try{var _0x84c621={'audience':hardwareConf[_0x49c4('0x4a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x889909['query'][_0x49c4('0x49')],_0x84c621)[_0x49c4('0x38')](function(_0x3bec0a){return db[_0x49c4('0x4b')][_0x49c4('0x4c')]({'where':{'id':_0x3bec0a[_0x49c4('0x4d')]}})[_0x49c4('0x38')](function(_0x27ef5f){_0x4f28a2=_0x27ef5f;return db[_0x49c4('0x4e')]['findOne']({'where':{'id':0x1},'attributes':[_0x49c4('0x4f'),'blockDuration'],'raw':!![]});})[_0x49c4('0x38')](function(_0x349791){if(!_0x4f28a2||!_[_0x49c4('0x50')](_0x4f28a2[_0x49c4('0x51')],_0x3bec0a['nonce'])){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x52')});}if(_0x4f28a2['disabled']){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});}if(_0x4f28a2[_0x49c4('0x54')]){if(_0x349791[_0x49c4('0x55')]>0x0){if(moment(_0x4f28a2[_0x49c4('0x56')])[_0x49c4('0x57')](_0x349791[_0x49c4('0x55')],_0x49c4('0x58'))>moment()){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});}}_0x889909[_0x49c4('0x34')]={'id':_0x4f28a2['id']};_0x46e04d();});})[_0x49c4('0x3e')](function(){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});});}catch(_0x248c0a){_0x46e04d(_0x248c0a);}}else if(_0x372a47){_0x46e04d();}else{return _0x2b2793[_0x49c4('0x39')](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x48')});}})[_0x49c4('0x59')](function(_0x4e38bc,_0x212366,_0x49829e){if(_0x4e38bc[_0x49c4('0x34')]){db[_0x49c4('0x4b')][_0x49c4('0x4c')]({'where':{'id':_0x4e38bc[_0x49c4('0x34')]['id']},'attributes':userAttributes})[_0x49c4('0x38')](function(_0x281b83){if(!_0x281b83){return _0x212366['status'](0x194)['json']({'message':_0x49c4('0x5a')});}_0x4e38bc[_0x49c4('0x34')]=_0x281b83;_0x49829e();})[_0x49c4('0x3e')](function(_0x117151){_0x49829e(_0x117151);});}else if(_0x372a47){_0x49829e();}else{return _0x212366['status'](0x194)[_0x49c4('0x3c')]({'message':_0x49c4('0x5b')});}});};exports[_0x49c4('0x5c')]=function canUpdate(){return compose()[_0x49c4('0x59')](function(_0x81a674,_0x3bde49,_0x1a9593){return licenseUtil[_0x49c4('0x5d')]()[_0x49c4('0x38')](function(_0x5640d3){if(_0x5640d3[_0x49c4('0x5e')]){_0x1a9593();}else{return _0x3bde49['status'](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x5f')});}})[_0x49c4('0x3e')](function(_0x258abe){_0x1a9593(_0x258abe);});});};exports[_0x49c4('0x60')]=function isWebrtcLicence(){return compose()['use'](function(_0x592e8e,_0x15b674,_0x384862){return licenseUtil[_0x49c4('0x5d')]()[_0x49c4('0x38')](function(_0x5d4790){if(_0x5d4790[_0x49c4('0x61')]){_0x384862();}else{return _0x15b674['status'](0x193)[_0x49c4('0x3c')]({'message':'Forbidden'});}})[_0x49c4('0x3e')](function(_0x906d3){_0x384862(_0x906d3);});});};exports[_0x49c4('0x62')]=function(_0x27adfe,_0x2d8087,_0x30bea5){_0x27adfe[_0x49c4('0x62')]=!![];return _0x30bea5();};exports['signToken']=function signToken(_0x3b731f){return signJwt(_0x3b731f);};exports[_0x49c4('0x63')]=function(_0x4a5c34,_0x1e1ac4){if(!_0x4a5c34[_0x49c4('0x34')]){return _0x1e1ac4[_0x49c4('0x39')](0x194)[_0x49c4('0x3c')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5d8bf0={'payload':{'id':_0x4a5c34[_0x49c4('0x34')]['id'],'role':_0x4a5c34['user'][_0x49c4('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5d8bf0)[_0x49c4('0x38')](function(_0x3811b2){_0x1e1ac4[_0x49c4('0x64')](_0x49c4('0x65'),_0x3811b2);_0x1e1ac4[_0x49c4('0x66')](_0x49c4('0x67'));})['catch'](function(_0x1f26c2){return _0x1e1ac4[_0x49c4('0x39')](0x1f4)[_0x49c4('0x68')](_0x1f26c2);});};exports[_0x49c4('0x69')]=function(_0x17ef75){if(_[_0x49c4('0x6a')](_0x17ef75[_0x49c4('0x51')])||_[_0x49c4('0x6a')](_0x17ef75[_0x49c4('0x6b')])){return null;}else{return createJwt(_0x17ef75);}};exports[_0x49c4('0x6c')]=function(_0x5b822f){_0x5b822f['apiKeyNonce']=generateNonce();_0x5b822f[_0x49c4('0x6b')]=generateIssuedAt();return createJwt(_0x5b822f);};exports[_0x49c4('0x6d')]=function(_0x527e74,_0x59a8bc){var _0x77163d=_0x527e74['query']['apikey'];if(_0x77163d){var _0x3208c2={'nonce':_0x59a8bc[_0x49c4('0x51')],'iat':_0x59a8bc[_0x49c4('0x6b')],'audience':hardwareConf[_0x49c4('0x4a')](),'issuer':hardwareConf[_0x49c4('0x4a')]()};return verifyJwt(_0x77163d,_0x3208c2)[_0x49c4('0x38')](function(){return generateApiKey(_0x59a8bc);});}else{throw{'message':_0x49c4('0x6e')};}};exports['validatePasswordPattern']=function(_0x859dde){var _0xcc6a2b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xcc6a2b[_0x49c4('0x6f')](_0x859dde))throw new db[(_0x49c4('0x70'))][(_0x49c4('0x71'))](_0x49c4('0x72'));return;};exports['validatePasswordHistory']=function(_0x5c7ddd,_0x1ef0c1,_0x155c43){var _0x2a6308=encryptor[_0x49c4('0x73')](_0x1ef0c1)[_0x49c4('0x74')](',');for(var _0x6b2592=0x0;_0x6b2592<_0x155c43;_0x6b2592++){if(!_0x2a6308[_0x6b2592])break;if(_0x5c7ddd[_0x49c4('0x75')]()===_0x2a6308[_0x6b2592]['toLowerCase']()){var _0x45d715=util[_0x49c4('0x76')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x155c43);if(_0x155c43===0x1){_0x45d715=_0x49c4('0x77');}throw new db['Sequelize'][(_0x49c4('0x71'))](_0x45d715);}}return;};exports[_0x49c4('0x78')]=function(_0x9eaa84,_0x2fe89a){var _0x845f7e=_0x2fe89a?encryptor[_0x49c4('0x73')](_0x2fe89a)[_0x49c4('0x74')](','):[];if(_0x845f7e[_0x49c4('0x79')]===0x5){_0x845f7e['splice'](-0x1,0x1);}_0x845f7e[_0x49c4('0x7a')](_0x9eaa84);return encryptor[_0x49c4('0x7b')](_0x845f7e['join'](','));};function signJwt(_0x10dec7){var _0x299e74=BPromise['promisify'](jwt[_0x49c4('0x7c')],{'context':jwt});var _0x42e0e6=_0x10dec7['secret']||config['secrets']['session'];return new BPromise(function(_0x513879,_0xc43386){_0x299e74(_0x10dec7['payload'],_0x42e0e6,_0x10dec7[_0x49c4('0x7d')])[_0x49c4('0x38')](function(_0x515240){_0x513879(_0x515240);})[_0x49c4('0x3e')](function(_0xdb2b33){_0xc43386(_0xdb2b33);});});}function verifyJwt(_0x5ac9f0,_0x34272f,_0x3dcf4c){var _0x167e84=BPromise[_0x49c4('0x7e')](jwt['verify'],{'context':jwt});var _0x431921=_0x3dcf4c||config[_0x49c4('0x9')][_0x49c4('0xa')];return new BPromise(function(_0x20e97d,_0x5d3375){_0x167e84(_0x5ac9f0,_0x431921,_0x34272f)[_0x49c4('0x38')](function(_0x4a93bc){_0x20e97d(_0x4a93bc);})['catch'](function(_0x58259d){_0x5d3375(_0x58259d);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x49c4('0x7f')](_0x49c4('0x80'));}function generateIssuedAt(){return Math[_0x49c4('0x81')](Date[_0x49c4('0x82')]()/0x3e8)['toString']();}function createJwt(_0x4daa6d){var _0x340523={'payload':{'iat':_0x4daa6d[_0x49c4('0x6b')],'nonce':_0x4daa6d[_0x49c4('0x51')]},'options':{'algorithm':_0x49c4('0x83'),'subject':_0x4daa6d['id'][_0x49c4('0x7f')](),'issuer':hardwareConf[_0x49c4('0x4a')](),'audience':hardwareConf[_0x49c4('0x4a')]()}};return signJwt(_0x340523)[_0x49c4('0x38')](function(_0x4d49e0){return{'iat':_0x4daa6d[_0x49c4('0x6b')],'nonce':_0x4daa6d['apiKeyNonce'],'token':_0x4d49e0};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index d25f496..2a4dbd1 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 _0xfefc=['buildContactsQuery','getFilteredContacts','rows','catch','keys','startsWith','cf_','map','CmCustomField','findOne','type','lodash','./sql-utils','../../mysqldb','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','user','clause','skip','ids','tag','countFilteredContacts','count','User'];(function(_0x1687ea,_0x1d1b87){var _0x43943c=function(_0x37f797){while(--_0x37f797){_0x1687ea['push'](_0x1687ea['shift']());}};_0x43943c(++_0x1d1b87);}(_0xfefc,0xab));var _0xcfef=function(_0xb09707,_0x4ed0fe){_0xb09707=_0xb09707-0x0;var _0x561787=_0xfefc[_0xb09707];return _0x561787;};'use strict';var _=require(_0xcfef('0x0'));var sqlUtils=require(_0xcfef('0x1'));var db=require(_0xcfef('0x2'))['db'];exports['findAll']=function(_0x3c45c6,_0x7d47ae,_0x841df3,_0x4a16fe){var _0x5d1266={'count':0x0,'rows':[]};var _0x3b2b67=sqlUtils['skipContactsQuery'](_0x7d47ae,_0x3c45c6);if(_0x3b2b67){return Promise[_0xcfef('0x3')](_0x5d1266);}var _0x4eb439=sqlUtils[_0xcfef('0x4')]();var _0x323319={};var _0xa854a9=![];var _0x47869c=![];return Promise[_0xcfef('0x3')]()[_0xcfef('0x5')](function(){if(_0x3c45c6[_0xcfef('0x6')]){return sqlUtils[_0xcfef('0x7')](_0x3c45c6['search'],_0x4a16fe);}else{return sqlUtils[_0xcfef('0x8')](_0x3c45c6,_0x4a16fe);}})[_0xcfef('0x5')](function(_0xc4c45){_0x4eb439[_0xcfef('0x9')](_0xc4c45[_0xcfef('0xa')]);_0x4eb439[_0xcfef('0x9')](_0xc4c45[_0xcfef('0xb')]);_0x4eb439[_0xcfef('0x9')](_0xc4c45[_0xcfef('0xc')]);_0x4eb439[_0xcfef('0x9')](_0xc4c45[_0xcfef('0xd')][_0xcfef('0xe')]);_0x323319=_0xc4c45['tags'];_0x47869c=_0xc4c45[_0xcfef('0xd')][_0xcfef('0xf')];return sqlUtils['checkListsRestrictions'](_0x7d47ae,_0x3c45c6,_0x47869c);})[_0xcfef('0x5')](function(_0x209295){_0x4eb439[_0xcfef('0x9')](_0x209295);var _0x486b9c=_0x3c45c6[_0xcfef('0x6')]?_0x323319[_0xcfef('0x10')]:_0x3c45c6[_0xcfef('0x11')];_0xa854a9=_0x486b9c?!![]:![];return sqlUtils[_0xcfef('0x12')](_0x4eb439,_0x486b9c);})['then'](function(_0x180e67){_0x5d1266[_0xcfef('0x13')]=_0x180e67;if(_0x5d1266[_0xcfef('0x13')]===0x0){return;}if(_0x3c45c6[_0xcfef('0x14')]){_0x47869c=!![];}return sqlUtils[_0xcfef('0x15')](_0x4eb439,_0x3c45c6[_0xcfef('0xb')],_0x841df3,_0xa854a9,_0x323319['clause'],_0x47869c);})[_0xcfef('0x5')](function(_0x42ae4d){if(!_0x42ae4d){return[];}return sqlUtils[_0xcfef('0x16')](_0x42ae4d,_0x3c45c6,_0x841df3);})['then'](function(_0x4abec4){_0x5d1266[_0xcfef('0x17')]=_0x4abec4;return _0x5d1266;})[_0xcfef('0x18')](function(_0x339398){throw _0x339398;});};exports['describe']=function(){var _0x422d32={};var _0x189579=[];return db['CmContact']['describe']()[_0xcfef('0x5')](function(_0x5d726a){_0x422d32=_0x5d726a;var _0x209687=Object[_0xcfef('0x19')](_0x422d32)[_0xcfef('0xc')](function(_0x1592d4){return _[_0xcfef('0x1a')](_0x1592d4,_0xcfef('0x1b'))?_0x1592d4:undefined;});var _0xbe11ae=_0x209687[_0xcfef('0x1c')](function(_0x5e3d6b){return db[_0xcfef('0x1d')][_0xcfef('0x1e')]({'where':{'id':_0x5e3d6b['slice'](0x3)},'raw':!![]});});return Promise['all'](_0xbe11ae);})['then'](function(_0x5c2923){for(var _0x238d74=0x0;_0x238d74<_0x5c2923['length'];_0x238d74++){if(_0x5c2923[_0x238d74]){var _0x288c0a=_0xcfef('0x1b')+_0x5c2923[_0x238d74]['id'];_0x422d32[_0x288c0a]['fieldType']=_0x5c2923[_0x238d74]['type'];}}_0x189579=_[_0xcfef('0x1c')](Object[_0xcfef('0x19')](_0x422d32),function(_0x10dd01){return{'name':_0x10dd01,'type':_0x422d32[_0x10dd01][_0xcfef('0x1f')]};});return _0x189579;})[_0xcfef('0x18')](function(_0x4ad35a){throw _0x4ad35a;});}; \ No newline at end of file +var _0x207b=['skip','ids','tag','countFilteredContacts','count','buildContactsQuery','fields','getFilteredContacts','catch','describe','CmContact','keys','startsWith','map','CmCustomField','findOne','slice','all','length','cf_','type','lodash','./sql-utils','findAll','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','filter','clause'];(function(_0x4e92b5,_0x1419bd){var _0x4171e8=function(_0x34183c){while(--_0x34183c){_0x4e92b5['push'](_0x4e92b5['shift']());}};_0x4171e8(++_0x1419bd);}(_0x207b,0xbf));var _0xb207=function(_0x50f9ab,_0x5009b4){_0x50f9ab=_0x50f9ab-0x0;var _0x58dda4=_0x207b[_0x50f9ab];return _0x58dda4;};'use strict';var _=require(_0xb207('0x0'));var sqlUtils=require(_0xb207('0x1'));var db=require('../../mysqldb')['db'];exports[_0xb207('0x2')]=function(_0x203a29,_0x2bb745,_0x6ef1c6,_0x1a9b1c){var _0x15428a={'count':0x0,'rows':[]};var _0x4e89e8=sqlUtils[_0xb207('0x3')](_0x2bb745,_0x203a29);if(_0x4e89e8){return Promise[_0xb207('0x4')](_0x15428a);}var _0x5d4883=sqlUtils['getContactsSubquery']();var _0xebaa56={};var _0x3b2d6f=![];var _0x3f9f21=![];return Promise[_0xb207('0x4')]()[_0xb207('0x5')](function(){if(_0x203a29[_0xb207('0x6')]){return sqlUtils[_0xb207('0x7')](_0x203a29['search'],_0x1a9b1c);}else{return sqlUtils[_0xb207('0x8')](_0x203a29,_0x1a9b1c);}})[_0xb207('0x5')](function(_0x35b9ea){_0x5d4883['where'](_0x35b9ea[_0xb207('0x9')]);_0x5d4883[_0xb207('0xa')](_0x35b9ea['fields']);_0x5d4883[_0xb207('0xa')](_0x35b9ea[_0xb207('0xb')]);_0x5d4883['where'](_0x35b9ea['user'][_0xb207('0xc')]);_0xebaa56=_0x35b9ea['tags'];_0x3f9f21=_0x35b9ea['user'][_0xb207('0xd')];return sqlUtils['checkListsRestrictions'](_0x2bb745,_0x203a29,_0x3f9f21);})[_0xb207('0x5')](function(_0x874112){_0x5d4883[_0xb207('0xa')](_0x874112);var _0x3d1ac1=_0x203a29['search']?_0xebaa56[_0xb207('0xe')]:_0x203a29[_0xb207('0xf')];_0x3b2d6f=_0x3d1ac1?!![]:![];return sqlUtils[_0xb207('0x10')](_0x5d4883,_0x3d1ac1);})[_0xb207('0x5')](function(_0x4f11ef){_0x15428a['count']=_0x4f11ef;if(_0x15428a[_0xb207('0x11')]===0x0){return;}if(_0x203a29['User']){_0x3f9f21=!![];}return sqlUtils[_0xb207('0x12')](_0x5d4883,_0x203a29[_0xb207('0x13')],_0x6ef1c6,_0x3b2d6f,_0xebaa56[_0xb207('0xc')],_0x3f9f21);})[_0xb207('0x5')](function(_0x36aca8){if(!_0x36aca8){return[];}return sqlUtils[_0xb207('0x14')](_0x36aca8,_0x203a29,_0x6ef1c6);})[_0xb207('0x5')](function(_0x397f00){_0x15428a['rows']=_0x397f00;return _0x15428a;})[_0xb207('0x15')](function(_0x47a009){throw _0x47a009;});};exports[_0xb207('0x16')]=function(){var _0x320cc8={};var _0x26c9dd=[];return db[_0xb207('0x17')][_0xb207('0x16')]()['then'](function(_0x14f09f){_0x320cc8=_0x14f09f;var _0x58cebd=Object[_0xb207('0x18')](_0x320cc8)[_0xb207('0xb')](function(_0x481062){return _[_0xb207('0x19')](_0x481062,'cf_')?_0x481062:undefined;});var _0x46d053=_0x58cebd[_0xb207('0x1a')](function(_0x247e31){return db[_0xb207('0x1b')][_0xb207('0x1c')]({'where':{'id':_0x247e31[_0xb207('0x1d')](0x3)},'raw':!![]});});return Promise[_0xb207('0x1e')](_0x46d053);})['then'](function(_0x44e81b){for(var _0x1a9d95=0x0;_0x1a9d95<_0x44e81b[_0xb207('0x1f')];_0x1a9d95++){if(_0x44e81b[_0x1a9d95]){var _0x24d630=_0xb207('0x20')+_0x44e81b[_0x1a9d95]['id'];_0x320cc8[_0x24d630]['fieldType']=_0x44e81b[_0x1a9d95][_0xb207('0x21')];}}_0x26c9dd=_['map'](Object[_0xb207('0x18')](_0x320cc8),function(_0x60c3e9){return{'name':_0x60c3e9,'type':_0x320cc8[_0x60c3e9][_0xb207('0x21')]};});return _0x26c9dd;})['catch'](function(_0x1ff478){throw _0x1ff478;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index c3093a4..bab0100 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 _0x8b33=['length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','start','value','end','Tag','map','and','tags','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','forEach','c.ListId\x20IN\x20?','concat','\x20=\x20?','resolve','then','fields','tag','clause','filter','role','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','Tags','clone','isEmpty','t.id\x20IN\x20?','query','COUNT(*)','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','lastName','phone','mobile','fax','email','CompanyId','updatedAt','TagIds','push','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split'];(function(_0x25b990,_0x3868d4){var _0x4baf62=function(_0x497de9){while(--_0x497de9){_0x25b990['push'](_0x25b990['shift']());}};_0x4baf62(++_0x3868d4);}(_0x8b33,0x12a));var _0x38b3=function(_0x12aa54,_0x4598a4){_0x12aa54=_0x12aa54-0x0;var _0x5ea365=_0x8b33[_0x12aa54];return _0x5ea365;};'use strict';var _=require(_0x38b3('0x0'));var squel=require('squel');var as=require(_0x38b3('0x1'));var qs=require(_0x38b3('0x2'));var utils=require(_0x38b3('0x3'));var db=require(_0x38b3('0x4'))['db'];function skipContactsQuery(_0x2f6489,_0x47392b){var _0x43c653=![];if(_0x2f6489['role']==='agent'&&!_0x47392b[_0x38b3('0x5')]&&!_0x47392b[_0x38b3('0x6')]&&_0x47392b[_0x38b3('0x7')]!==_0x38b3('0x8')){_0x43c653=!![];}return _0x43c653;}function getContactsSubquery(){return squel[_0x38b3('0x9')]()[_0x38b3('0xa')](_0x38b3('0xb'),'c')[_0x38b3('0xc')](_0x38b3('0xd'));}function applyJoinClauses(_0x383498,_0x408d80){var _0x24deba=_0x408d80?'c':_0x38b3('0xe');_0x383498[_0x38b3('0xf')](_0x38b3('0x10'),'uc',_0x38b3('0x11')+_0x24deba+_0x38b3('0x12'))[_0x38b3('0xf')]('cm_contact_has_tags','ct',_0x38b3('0x13')+_0x24deba+'.id')[_0x38b3('0xf')](_0x38b3('0x14'),'t',_0x38b3('0x15'));return _0x383498;}function addFieldsToQuery(_0x157706,_0x56e429,_0x3ccca6,_0x54135a,_0x201298){var _0x4777a0=_0x201298?'c':_0x38b3('0xe');if(!_0x56e429){_0x56e429=['id','firstName',_0x38b3('0x16'),_0x38b3('0x17'),_0x38b3('0x18'),_0x38b3('0x19'),_0x38b3('0x1a'),_0x38b3('0x6'),_0x38b3('0x1b'),'createdAt',_0x38b3('0x1c'),'deletedAt',_0x38b3('0x1d')];}else if(!_0x56e429['includes']('id')){_0x56e429[_0x38b3('0x1e')]('id');}var _0x115075=_0x3ccca6&&_0x201298||!_0x3ccca6&&!_0x201298;if(_0x54135a){_0x115075=_0x54135a&&_0x201298||!_0x54135a&&!_0x201298;}_0x56e429['forEach'](function(_0x3363db){if(_0x3363db===_0x38b3('0x1d')){if(_0x115075){_0x157706['field'](_0x38b3('0x1f'),_0x3363db);}else if(_0x3ccca6||_0x54135a){_0x157706[_0x38b3('0x20')](_0x4777a0+'.'+_0x3363db);}}else{_0x157706['field'](_0x4777a0+'.'+_0x3363db);}});return _0x157706;}function getSqlClauses(){var _0x2255b6={'default':squel[_0x38b3('0x21')](),'fields':squel[_0x38b3('0x21')](),'filter':squel[_0x38b3('0x21')](),'tags':{'clause':squel[_0x38b3('0x21')](),'ids':null},'user':{'clause':squel[_0x38b3('0x21')](),'skip':![]}};return _0x2255b6;}function parseTagParameter(_0x17cfb8){var _0x4af93e=squel[_0x38b3('0x21')]();if(_0x17cfb8){var _0x455a9d=utils[_0x38b3('0x22')](_0x17cfb8);_0x455a9d['forEach'](function(_0x3e1b11){_0x4af93e['or'](_0x38b3('0x23'),'%,'+_0x3e1b11+',%');});}return _0x4af93e;}function parseSearchFilter(_0x195de6){var _0x4e2475=squel[_0x38b3('0x21')]();if(_0x195de6){var _0x3c464f=_0x195de6['replace']('\x5c','\x5c\x5c')[_0x38b3('0x24')](/'/g,'\x27\x27');if(_0x3c464f[_0x38b3('0x25')]('\x20')[_0x38b3('0x26')]>0x1){_0x4e2475['or'](_0x38b3('0x27'),qs[_0x38b3('0x28')](_0x3c464f,!![]),null);}else{if(qs[_0x38b3('0x29')](_0x3c464f)){_0x4e2475['or'](_0x38b3('0x2a'),_0x3c464f+'%');_0x4e2475['or'](_0x38b3('0x2b'),_0x3c464f+'%');_0x4e2475['or']('c.mobile\x20LIKE\x20?',_0x3c464f+'%');_0x4e2475['or'](_0x38b3('0x2c'),_0x3c464f+'%');}else if(qs[_0x38b3('0x2d')](_0x3c464f)){_0x4e2475['or'](_0x38b3('0x2e'),_0x3c464f+'%');}else{_0x4e2475['or'](_0x38b3('0x2f'),'%'+_0x3c464f+'%');_0x4e2475['or'](_0x38b3('0x30'),'%'+_0x3c464f+'%');_0x4e2475['or'](_0x38b3('0x2e'),'%'+_0x3c464f+'%');}}}return _0x4e2475;}function parseAdvancedSearchFilter(_0x4db6d5,_0xe51a11){var _0x321a70=getSqlClauses();var _0x10afce=as['parseSearch'](_0x4db6d5);var _0x424a67=_0x10afce[_0x38b3('0x31')];for(var _0x552c4f=0x0;_0x552c4f<_0x10afce[_0x38b3('0x32')][_0x38b3('0x26')];_0x552c4f++){var _0x242abf=_0x10afce[_0x38b3('0x32')][_0x552c4f];var _0x4c54f7='c';var _0x55f0ca=_['find'](_0xe51a11,[_0x38b3('0x33'),_0x242abf[_0x38b3('0x20')]]);if(_0x55f0ca){if(_0x242abf[_0x38b3('0x20')]===_0x38b3('0x34')||_0x55f0ca[_0x38b3('0x35')]===_0x38b3('0x36')){_0x242abf[_0x38b3('0x37')]=_0x38b3('0x38');}var _0x25afc7=as[_0x38b3('0x39')](_0x4c54f7,_0x55f0ca[_0x38b3('0x3a')],_0x242abf);_0x321a70[_0x38b3('0x3b')][_0x424a67](_0x25afc7['text'],_0x25afc7['value'][_0x38b3('0x3c')],_0x25afc7[_0x38b3('0x3d')][_0x38b3('0x3e')]);}else{if(_0x242abf[_0x38b3('0x20')]===_0x38b3('0x3f')){var _0x53d8ea=_0x242abf[_0x38b3('0x3d')][_0x38b3('0x25')](',')[_0x38b3('0x40')](function(_0x560af9){return Number(_0x560af9);});var _0x1c75b3=parseTagParameter(_0x53d8ea);_0x321a70['tags']['clause'][_0x38b3('0x41')](_0x1c75b3);_0x321a70[_0x38b3('0x42')][_0x38b3('0x43')]=_0x53d8ea;}else if(_0x242abf['field']===_0x38b3('0x44')){_0x321a70[_0x38b3('0x45')]['clause'][_0x38b3('0x41')](_0x38b3('0x46'),_0x242abf[_0x38b3('0x3d')]);_0x321a70[_0x38b3('0x45')][_0x38b3('0x47')]=!![];}}}return _0x321a70;}function parseModelFields(_0x38405e,_0x2dc513){var _0x26879f=squel[_0x38b3('0x21')]();var _0x536fee=_(_0x38405e)[_0x38b3('0x48')]()[_0x38b3('0x40')](function(_0x20ef60){return _[_0x38b3('0x49')](_0x2dc513,[_0x38b3('0x33'),_0x20ef60])?_0x20ef60:undefined;})[_0x38b3('0x4a')]()[_0x38b3('0x3d')]();if(_0x38405e[_0x38b3('0x4b')]){_0x536fee[_0x38b3('0x1e')](_0x38b3('0x4b'));}if(_0x38405e[_0x38b3('0x44')]){_0x536fee[_0x38b3('0x1e')](_0x38b3('0x44'));}if(_0x536fee[_0x38b3('0x26')]>0x0){_0x536fee[_0x38b3('0x4c')](function(_0x3230cc){if(_0x3230cc==='ListId'){_0x26879f['and'](_0x38b3('0x4d'),[][_0x38b3('0x4e')](_0x38405e[_0x3230cc]));}else if(_0x3230cc===_0x38b3('0x4b')){var _0x48910b='%'+_0x38405e[_0x3230cc]+'%';_0x26879f[_0x38b3('0x41')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x48910b);}else if(_0x3230cc===_0x38b3('0x44')){_0x26879f[_0x38b3('0x41')](_0x38b3('0x46'),_0x38405e[_0x3230cc]);}else{_0x26879f['and']('c.'+_0x3230cc+_0x38b3('0x4f'),_0x38405e[_0x3230cc]);}});}return _0x26879f;}function parseQueryParameters(_0xca7a04,_0x59354c){var _0x42e003=getSqlClauses();return Promise[_0x38b3('0x50')]()[_0x38b3('0x51')](function(){return parseModelFields(_0xca7a04,_0x59354c);})['then'](function(_0x4b4ec6){_0x42e003[_0x38b3('0x52')]['and'](_0x4b4ec6);return parseTagParameter(_0xca7a04[_0x38b3('0x53')]);})[_0x38b3('0x51')](function(_0x563071){_0x42e003['tags'][_0x38b3('0x54')][_0x38b3('0x41')](_0x563071);return parseSearchFilter(_0xca7a04['filter']);})['then'](function(_0x215f26){_0x42e003[_0x38b3('0x55')]=_0x215f26;return _0x42e003;});}function checkListsRestrictions(_0x554bfa,_0x52a883,_0x17a8b9){var _0x115506=squel[_0x38b3('0x21')]();return Promise[_0x38b3('0x50')]()[_0x38b3('0x51')](function(){if(_0x52a883[_0x38b3('0x5')]&&_0x554bfa[_0x38b3('0x56')]==='agent'&&!_0x17a8b9){return _0x554bfa[_0x38b3('0x57')]({'attributes':['id'],'raw':!![]});}})[_0x38b3('0x51')](function(_0x5dc9d4){if(_0x5dc9d4){if(_0x5dc9d4[_0x38b3('0x26')]===0x0){_0x115506[_0x38b3('0x41')](_0x38b3('0x58'));}else{_0x115506[_0x38b3('0x41')](_0x38b3('0x4d'),_[_0x38b3('0x40')](_0x5dc9d4,'id'));}}})[_0x38b3('0x51')](function(){return _0x115506;});}function buildContactsQuery(_0x3f5c8c,_0x4900a0,_0x31b0c1,_0x410dbb,_0x1c58a4,_0xcf70dc){if(_0x4900a0){_0x4900a0=_0x31b0c1[_0x38b3('0x59')];}_0x3f5c8c=addFieldsToQuery(_0x3f5c8c,_0x4900a0,_0x410dbb,_0xcf70dc,!![]);var _0x26270a=squel[_0x38b3('0x9')]();_0x26270a=addFieldsToQuery(_0x26270a,_0x4900a0,_0x410dbb,_0xcf70dc,![]);if(_0x410dbb||_0xcf70dc){_0x3f5c8c=applyJoinClauses(_0x3f5c8c,!![]);_0x3f5c8c[_0x38b3('0x5a')](_0x38b3('0x5b'));if(_0x31b0c1[_0x38b3('0x5c')]){_0x26270a['limit'](_0x31b0c1[_0x38b3('0x5c')]);}if(_0x31b0c1[_0x38b3('0x5d')]){_0x26270a[_0x38b3('0x5d')](_0x31b0c1['offset']);}}else{_0x26270a=applyJoinClauses(_0x26270a,![]);_0x26270a[_0x38b3('0x5a')](_0x38b3('0x5e'));if(_0x31b0c1[_0x38b3('0x5c')]){_0x3f5c8c[_0x38b3('0x5c')](_0x31b0c1['limit']);}if(_0x31b0c1['offset']){_0x3f5c8c[_0x38b3('0x5d')](_0x31b0c1[_0x38b3('0x5d')]);}}_0x26270a[_0x38b3('0x5f')](_0x1c58a4);if(_0x31b0c1['order']){_0x31b0c1[_0x38b3('0x60')][_0x38b3('0x4c')](function(_0x11d8db){_0x3f5c8c[_0x38b3('0x60')]('c.'+_0x11d8db[0x0],_0x11d8db[0x1]===_0x38b3('0x61')?![]:!![]);_0x26270a[_0x38b3('0x60')](_0x38b3('0x62')+_0x11d8db[0x0],_0x11d8db[0x1]===_0x38b3('0x61')?![]:!![]);});}_0x26270a[_0x38b3('0xa')](_0x3f5c8c,_0x38b3('0xe'));return _0x26270a;}function getFilteredContacts(_0x58f48b){var _0x3e29fa=[];return db['Tag'][_0x38b3('0x63')]({'attributes':['id','name',_0x38b3('0x64')],'raw':!![]})[_0x38b3('0x51')](function(_0x1c902c){_0x3e29fa=_[_0x38b3('0x65')](_0x1c902c,'id');var _0x4d4452={'type':db[_0x38b3('0x66')][_0x38b3('0x67')]['SELECT'],'model':db[_0x38b3('0x68')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x38b3('0x69')]['query'](_0x58f48b['toString'](),_0x4d4452);})[_0x38b3('0x51')](function(_0x231c49){_0x231c49['forEach'](function(_0x2b5403){if(_0x2b5403[_0x38b3('0x1d')]){_0x2b5403[_0x38b3('0x6a')]=[];_0x2b5403[_0x38b3('0x1d')][_0x38b3('0x25')](',')[_0x38b3('0x4c')](function(_0x480e45){_0x2b5403[_0x38b3('0x6a')][_0x38b3('0x1e')](_0x3e29fa[_0x480e45]);});}delete _0x2b5403['TagIds'];});return _0x231c49;});}function countFilteredContacts(_0x9ebcd6,_0x3e54e4){var _0x304e4d=_0x9ebcd6[_0x38b3('0x6b')]();_0x304e4d[_0x38b3('0x20')]('COUNT(*)');_0x304e4d=applyJoinClauses(_0x304e4d,!![]);_0x9ebcd6['group']('c.id');var _0x1d23c7=utils['getSelectedTags'](_0x3e54e4);if(!_[_0x38b3('0x6c')](_0x1d23c7)){_0x304e4d[_0x38b3('0xc')](_0x38b3('0x6d'),_0x1d23c7);}var _0x3a961a={'type':db[_0x38b3('0x66')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0x38b3('0x69')][_0x38b3('0x6e')](_0x304e4d['toString'](),_0x3a961a)[_0x38b3('0x51')](function(_0xf3993a){return _0xf3993a[0x0][_0x38b3('0x6f')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xe489=['field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','castTo','buildExpression','type','default','value','start','end','Tag','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','user','keys','some','compact','Contact','push','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','filter','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','split','clone','COUNT(*)','isEmpty','SELECT','exports','../parsers/qs','../interaction/utils','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','forEach'];(function(_0x4d515d,_0x108c96){var _0x58fe07=function(_0x2e18bf){while(--_0x2e18bf){_0x4d515d['push'](_0x4d515d['shift']());}};_0x58fe07(++_0x108c96);}(_0xe489,0x194));var _0x9e48=function(_0x17a00a,_0x25a828){_0x17a00a=_0x17a00a-0x0;var _0x307caa=_0xe489[_0x17a00a];return _0x307caa;};'use strict';var _=require('lodash');var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0x9e48('0x0'));var utils=require(_0x9e48('0x1'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x3107ac,_0xa6e85){var _0x4252ad=![];if(_0x3107ac[_0x9e48('0x2')]===_0x9e48('0x3')&&!_0xa6e85[_0x9e48('0x4')]&&!_0xa6e85[_0x9e48('0x5')]&&_0xa6e85[_0x9e48('0x6')]!==_0x9e48('0x7')){_0x4252ad=!![];}return _0x4252ad;}function getContactsSubquery(){return squel[_0x9e48('0x8')]()[_0x9e48('0x9')](_0x9e48('0xa'),'c')[_0x9e48('0xb')](_0x9e48('0xc'));}function applyJoinClauses(_0x47ae09,_0x595803){var _0x508f77=_0x595803?'c':_0x9e48('0xd');_0x47ae09['left_join'](_0x9e48('0xe'),'uc',_0x9e48('0xf')+_0x508f77+_0x9e48('0x10'))[_0x9e48('0x11')](_0x9e48('0x12'),'ct','ct.CmContactId\x20=\x20'+_0x508f77+'.id')['left_join'](_0x9e48('0x13'),'t',_0x9e48('0x14'));return _0x47ae09;}function addFieldsToQuery(_0x366ec4,_0x54efae,_0x99214a,_0x1b1930,_0x37b0f1){var _0x467b1c=_0x37b0f1?'c':_0x9e48('0xd');if(!_0x54efae){_0x54efae=['id',_0x9e48('0x15'),_0x9e48('0x16'),'phone',_0x9e48('0x17'),_0x9e48('0x18'),_0x9e48('0x19'),_0x9e48('0x5'),_0x9e48('0x1a'),_0x9e48('0x1b'),_0x9e48('0x1c'),_0x9e48('0x1d'),_0x9e48('0x1e')];}else if(!_0x54efae['includes']('id')){_0x54efae['push']('id');}var _0x506edf=_0x99214a&&_0x37b0f1||!_0x99214a&&!_0x37b0f1;if(_0x1b1930){_0x506edf=_0x1b1930&&_0x37b0f1||!_0x1b1930&&!_0x37b0f1;}_0x54efae[_0x9e48('0x1f')](function(_0x37373c){if(_0x37373c==='TagIds'){if(_0x506edf){_0x366ec4[_0x9e48('0x20')](_0x9e48('0x21'),_0x37373c);}else if(_0x99214a||_0x1b1930){_0x366ec4[_0x9e48('0x20')](_0x467b1c+'.'+_0x37373c);}}else{_0x366ec4[_0x9e48('0x20')](_0x467b1c+'.'+_0x37373c);}});return _0x366ec4;}function getSqlClauses(){var _0x3e5a77={'default':squel[_0x9e48('0x22')](),'fields':squel[_0x9e48('0x22')](),'filter':squel['expr'](),'tags':{'clause':squel[_0x9e48('0x22')](),'ids':null},'user':{'clause':squel[_0x9e48('0x22')](),'skip':![]}};return _0x3e5a77;}function parseTagParameter(_0x2f58c5){var _0x2bbd00=squel[_0x9e48('0x22')]();if(_0x2f58c5){var _0x471139=utils[_0x9e48('0x23')](_0x2f58c5);_0x471139[_0x9e48('0x1f')](function(_0x3a2bc3){_0x2bbd00['or'](_0x9e48('0x24'),'%,'+_0x3a2bc3+',%');});}return _0x2bbd00;}function parseSearchFilter(_0x2e9eef){var _0x193439=squel[_0x9e48('0x22')]();if(_0x2e9eef){var _0x526fce=_0x2e9eef[_0x9e48('0x25')]('\x5c','\x5c\x5c')[_0x9e48('0x25')](/'/g,'\x27\x27');if(_0x526fce['split']('\x20')[_0x9e48('0x26')]>0x1){_0x193439['or'](_0x9e48('0x27'),qs['getFullTextValue'](_0x526fce,!![]),null);}else{if(qs[_0x9e48('0x28')](_0x526fce)){_0x193439['or'](_0x9e48('0x29'),_0x526fce+'%');_0x193439['or'](_0x9e48('0x2a'),_0x526fce+'%');_0x193439['or'](_0x9e48('0x2b'),_0x526fce+'%');_0x193439['or'](_0x9e48('0x2c'),_0x526fce+'%');}else if(qs['isEmail'](_0x526fce)){_0x193439['or'](_0x9e48('0x2d'),_0x526fce+'%');}else{_0x193439['or'](_0x9e48('0x2e'),'%'+_0x526fce+'%');_0x193439['or'](_0x9e48('0x2f'),'%'+_0x526fce+'%');_0x193439['or']('c.email\x20LIKE\x20?','%'+_0x526fce+'%');}}}return _0x193439;}function parseAdvancedSearchFilter(_0x5c03b4,_0x256b2a){var _0x2f5fc8=getSqlClauses();var _0x554664=as[_0x9e48('0x30')](_0x5c03b4);var _0x54cd3e=_0x554664[_0x9e48('0x31')];for(var _0xf24744=0x0;_0xf24744<_0x554664[_0x9e48('0x32')][_0x9e48('0x26')];_0xf24744++){var _0x44a707=_0x554664[_0x9e48('0x32')][_0xf24744];var _0x20dd88='c';var _0x30c55b=_['find'](_0x256b2a,[_0x9e48('0x33'),_0x44a707[_0x9e48('0x20')]]);if(_0x30c55b){if(_0x44a707['field']===_0x9e48('0x34')||_0x30c55b[_0x9e48('0x35')]===_0x9e48('0x36')){_0x44a707[_0x9e48('0x37')]='DATE';}var _0x20ed65=as[_0x9e48('0x38')](_0x20dd88,_0x30c55b[_0x9e48('0x39')],_0x44a707);_0x2f5fc8[_0x9e48('0x3a')][_0x54cd3e](_0x20ed65['text'],_0x20ed65[_0x9e48('0x3b')][_0x9e48('0x3c')],_0x20ed65[_0x9e48('0x3b')][_0x9e48('0x3d')]);}else{if(_0x44a707[_0x9e48('0x20')]===_0x9e48('0x3e')){var _0x40b4a8=_0x44a707[_0x9e48('0x3b')]['split'](',')[_0x9e48('0x3f')](function(_0x297d9f){return Number(_0x297d9f);});var _0x4e7803=parseTagParameter(_0x40b4a8);_0x2f5fc8[_0x9e48('0x40')][_0x9e48('0x41')][_0x9e48('0x42')](_0x4e7803);_0x2f5fc8[_0x9e48('0x40')][_0x9e48('0x43')]=_0x40b4a8;}else if(_0x44a707[_0x9e48('0x20')]===_0x9e48('0x44')){_0x2f5fc8['user'][_0x9e48('0x41')][_0x9e48('0x42')](_0x9e48('0x45'),_0x44a707[_0x9e48('0x3b')]);_0x2f5fc8[_0x9e48('0x46')]['skip']=!![];}}}return _0x2f5fc8;}function parseModelFields(_0x49a48f,_0x5964b3){var _0x5f1615=squel[_0x9e48('0x22')]();var _0xc35aae=_(_0x49a48f)[_0x9e48('0x47')]()[_0x9e48('0x3f')](function(_0x426a9e){return _[_0x9e48('0x48')](_0x5964b3,[_0x9e48('0x33'),_0x426a9e])?_0x426a9e:undefined;})[_0x9e48('0x49')]()[_0x9e48('0x3b')]();if(_0x49a48f[_0x9e48('0x4a')]){_0xc35aae['push'](_0x9e48('0x4a'));}if(_0x49a48f['User']){_0xc35aae[_0x9e48('0x4b')](_0x9e48('0x44'));}if(_0xc35aae[_0x9e48('0x26')]>0x0){_0xc35aae[_0x9e48('0x1f')](function(_0x2cf34e){if(_0x2cf34e===_0x9e48('0x5')){_0x5f1615[_0x9e48('0x42')](_0x9e48('0x4c'),[][_0x9e48('0x4d')](_0x49a48f[_0x2cf34e]));}else if(_0x2cf34e===_0x9e48('0x4a')){var _0x11633e='%'+_0x49a48f[_0x2cf34e]+'%';_0x5f1615[_0x9e48('0x42')](_0x9e48('0x4e'),_0x11633e);}else if(_0x2cf34e==='User'){_0x5f1615[_0x9e48('0x42')](_0x9e48('0x45'),_0x49a48f[_0x2cf34e]);}else{_0x5f1615['and']('c.'+_0x2cf34e+_0x9e48('0x4f'),_0x49a48f[_0x2cf34e]);}});}return _0x5f1615;}function parseQueryParameters(_0x20d018,_0x2e9ad7){var _0x592a34=getSqlClauses();return Promise[_0x9e48('0x50')]()[_0x9e48('0x51')](function(){return parseModelFields(_0x20d018,_0x2e9ad7);})[_0x9e48('0x51')](function(_0x5996a5){_0x592a34['fields'][_0x9e48('0x42')](_0x5996a5);return parseTagParameter(_0x20d018['tag']);})[_0x9e48('0x51')](function(_0x2789e){_0x592a34[_0x9e48('0x40')][_0x9e48('0x41')][_0x9e48('0x42')](_0x2789e);return parseSearchFilter(_0x20d018[_0x9e48('0x52')]);})['then'](function(_0x4494be){_0x592a34[_0x9e48('0x52')]=_0x4494be;return _0x592a34;});}function checkListsRestrictions(_0x493279,_0x1cdd94,_0x1542e2){var _0x1b16b8=squel[_0x9e48('0x22')]();return Promise[_0x9e48('0x50')]()[_0x9e48('0x51')](function(){if(_0x1cdd94[_0x9e48('0x4')]&&_0x493279[_0x9e48('0x2')]===_0x9e48('0x3')&&!_0x1542e2){return _0x493279['getLists']({'attributes':['id'],'raw':!![]});}})[_0x9e48('0x51')](function(_0x1abde9){if(_0x1abde9){if(_0x1abde9[_0x9e48('0x26')]===0x0){_0x1b16b8[_0x9e48('0x42')]('c.ListId\x20IS\x20NULL');}else{_0x1b16b8['and']('c.ListId\x20IN\x20?',_['map'](_0x1abde9,'id'));}}})[_0x9e48('0x51')](function(){return _0x1b16b8;});}function buildContactsQuery(_0x9ae6ef,_0x6be7df,_0x468fac,_0x2cb438,_0x2e0f95,_0x3541ca){if(_0x6be7df){_0x6be7df=_0x468fac[_0x9e48('0x53')];}_0x9ae6ef=addFieldsToQuery(_0x9ae6ef,_0x6be7df,_0x2cb438,_0x3541ca,!![]);var _0x9ce210=squel[_0x9e48('0x8')]();_0x9ce210=addFieldsToQuery(_0x9ce210,_0x6be7df,_0x2cb438,_0x3541ca,![]);if(_0x2cb438||_0x3541ca){_0x9ae6ef=applyJoinClauses(_0x9ae6ef,!![]);_0x9ae6ef[_0x9e48('0x54')](_0x9e48('0x55'));if(_0x468fac[_0x9e48('0x56')]){_0x9ce210['limit'](_0x468fac[_0x9e48('0x56')]);}if(_0x468fac[_0x9e48('0x57')]){_0x9ce210[_0x9e48('0x57')](_0x468fac['offset']);}}else{_0x9ce210=applyJoinClauses(_0x9ce210,![]);_0x9ce210[_0x9e48('0x54')](_0x9e48('0x58'));if(_0x468fac[_0x9e48('0x56')]){_0x9ae6ef[_0x9e48('0x56')](_0x468fac[_0x9e48('0x56')]);}if(_0x468fac[_0x9e48('0x57')]){_0x9ae6ef['offset'](_0x468fac[_0x9e48('0x57')]);}}_0x9ce210[_0x9e48('0x59')](_0x2e0f95);if(_0x468fac[_0x9e48('0x5a')]){_0x468fac['order'][_0x9e48('0x1f')](function(_0x3f9ada){_0x9ae6ef['order']('c.'+_0x3f9ada[0x0],_0x3f9ada[0x1]===_0x9e48('0x5b')?![]:!![]);_0x9ce210[_0x9e48('0x5a')](_0x9e48('0x5c')+_0x3f9ada[0x0],_0x3f9ada[0x1]===_0x9e48('0x5b')?![]:!![]);});}_0x9ce210[_0x9e48('0x9')](_0x9ae6ef,_0x9e48('0xd'));return _0x9ce210;}function getFilteredContacts(_0x255ea9){var _0x997046=[];return db[_0x9e48('0x3e')][_0x9e48('0x5d')]({'attributes':['id',_0x9e48('0x33'),_0x9e48('0x5e')],'raw':!![]})[_0x9e48('0x51')](function(_0x138f59){_0x997046=_[_0x9e48('0x5f')](_0x138f59,'id');var _0x22e43d={'type':db[_0x9e48('0x60')][_0x9e48('0x61')]['SELECT'],'model':db[_0x9e48('0x62')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x9e48('0x63')][_0x9e48('0x64')](_0x255ea9[_0x9e48('0x65')](),_0x22e43d);})['then'](function(_0x596e2c){_0x596e2c[_0x9e48('0x1f')](function(_0x10fe0e){if(_0x10fe0e[_0x9e48('0x1e')]){_0x10fe0e[_0x9e48('0x66')]=[];_0x10fe0e[_0x9e48('0x1e')][_0x9e48('0x67')](',')[_0x9e48('0x1f')](function(_0x40051f){_0x10fe0e[_0x9e48('0x66')][_0x9e48('0x4b')](_0x997046[_0x40051f]);});}delete _0x10fe0e[_0x9e48('0x1e')];});return _0x596e2c;});}function countFilteredContacts(_0xe317a2,_0x16683c){var _0x42504d=_0xe317a2[_0x9e48('0x68')]();_0x42504d['field'](_0x9e48('0x69'));_0x42504d=applyJoinClauses(_0x42504d,!![]);_0xe317a2[_0x9e48('0x54')](_0x9e48('0x55'));var _0x230fd2=utils[_0x9e48('0x23')](_0x16683c);if(!_[_0x9e48('0x6a')](_0x230fd2)){_0x42504d['where']('t.id\x20IN\x20?',_0x230fd2);}var _0x4d2947={'type':db[_0x9e48('0x60')][_0x9e48('0x61')][_0x9e48('0x6b')],'raw':!![]};return db[_0x9e48('0x63')][_0x9e48('0x64')](_0x42504d[_0x9e48('0x65')](),_0x4d2947)[_0x9e48('0x51')](function(_0x47a9ea){return _0x47a9ea[0x0]['COUNT(*)'];});}module[_0x9e48('0x6c')]={'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 e0f077a..f3eac6f 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 _0x28f8=['is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','binary','write','end','close','unlink','createDecipher','data','final','secret','utf8','base64','decryptString','update','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','encrypt','algorithm','error'];(function(_0x77ea11,_0x26dcbf){var _0x310750=function(_0x470a29){while(--_0x470a29){_0x77ea11['push'](_0x77ea11['shift']());}};_0x310750(++_0x26dcbf);}(_0x28f8,0x175));var _0x828f=function(_0x586c70,_0x4a8cb3){_0x586c70=_0x586c70-0x0;var _0x26db79=_0x28f8[_0x586c70];return _0x26db79;};'use strict';var crypto=require(_0x828f('0x0'));var fs=require('fs');var BPromise=require(_0x828f('0x1'));var _=require(_0x828f('0x2'));var config=require(_0x828f('0x3'));var logger=require(_0x828f('0x4'))(_0x828f('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x828f('0x6')][_0x828f('0x7')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0x828f('0x8')]&&config[_0x828f('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x828f('0x9')]=config[_0x828f('0x8')][_0x828f('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x828f('0xa')](config[_0x828f('0x8')][_0x828f('0x9')],_0x828f('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x21f914){return AES_SUPPORTED_RX[_0x828f('0xc')](_0x21f914);}function getSupportedCiphers(){return crypto[_0x828f('0xd')]()[_0x828f('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x3fb7d8){return getSupportedCiphers()[_0x828f('0xf')](_0x3fb7d8)>-0x1;}function combineOptions(_0x307e54){var _0x89d7e1={};for(var _0x15315a in fileOptions){if(fileOptions['hasOwnProperty'](_0x15315a)){_0x89d7e1[_0x15315a]=fileOptions[_0x15315a];}}if(_0x307e54){for(var _0x12ee03 in _0x307e54){if(_0x307e54[_0x828f('0x10')](_0x12ee03)){_0x89d7e1[_0x12ee03]=_0x307e54[_0x12ee03];}}}return _0x89d7e1;}exports['encryptFile']=function(_0x125c95,_0x8c96c1,_0x4bcdca,_0x17bdd7){return new BPromise(function(_0x3c0465,_0x5f41b0){_0x17bdd7=combineOptions(_0x17bdd7);var _0x1e288b=new Buffer(_0x4bcdca);var _0x269eeb=fs[_0x828f('0x11')](_0x125c95);var _0x397ec0=fs[_0x828f('0x12')](_0x8c96c1);var _0x1272bc=crypto['createCipher'](_0x17bdd7[_0x828f('0x9')],_0x1e288b);_0x269eeb['on']('data',function(_0x451059){var _0x4bb279=new Buffer(_0x1272bc['update'](_0x451059),_0x828f('0x13'));_0x397ec0[_0x828f('0x14')](_0x4bb279);});_0x269eeb['on'](_0x828f('0x15'),function(){try{var _0x257df1=new Buffer(_0x1272bc['final']('binary'),_0x828f('0x13'));_0x397ec0['write'](_0x257df1);_0x397ec0[_0x828f('0x15')]();_0x397ec0['on'](_0x828f('0x16'),function(){return _0x3c0465(_0x8c96c1);});}catch(_0x1a358c){fs[_0x828f('0x17')](_0x8c96c1);return _0x5f41b0(_0x1a358c);}});});};exports['decryptFile']=function(_0x4a2d2a,_0x1978a5,_0x37b7d7,_0x1655fc){return new BPromise(function(_0x1254b3,_0x965ac4){_0x1655fc=combineOptions(_0x1655fc);var _0x37d846=new Buffer(_0x37b7d7);var _0x2d91ed=fs[_0x828f('0x11')](_0x4a2d2a);var _0x5be93b=fs[_0x828f('0x12')](_0x1978a5);var _0x261a75=crypto[_0x828f('0x18')](_0x1655fc[_0x828f('0x9')],_0x37d846);_0x2d91ed['on'](_0x828f('0x19'),function(_0xf5304c){var _0x192603=new Buffer(_0x261a75['update'](_0xf5304c),_0x828f('0x13'));_0x5be93b[_0x828f('0x14')](_0x192603);});_0x2d91ed['on'](_0x828f('0x15'),function(){try{var _0x3f7e2a=new Buffer(_0x261a75[_0x828f('0x1a')](_0x828f('0x13')),_0x828f('0x13'));_0x5be93b[_0x828f('0x14')](_0x3f7e2a);_0x5be93b[_0x828f('0x15')]();_0x5be93b['on']('close',function(){return _0x1254b3(_0x1978a5);});}catch(_0x9c32dd){fs[_0x828f('0x17')](_0x1978a5);return _0x965ac4(_0x9c32dd);}});});};exports['encryptString']=function(_0x225db1,_0x109464,_0x134ce6){var _0x24a3ff=_0x134ce6||stringOptions['algorithm'];var _0x52a356=_0x109464||stringOptions[_0x828f('0x1b')];var _0x5b0e70=crypto['createCipher'](_0x24a3ff,_0x52a356);var _0x36fab0=_0x5b0e70['update'](_0x225db1,_0x828f('0x1c'),_0x828f('0x1d'));_0x36fab0+=_0x5b0e70[_0x828f('0x1a')](_0x828f('0x1d'));return _0x36fab0;};exports[_0x828f('0x1e')]=function(_0x24784e,_0x3fb9d0,_0x19cb01){var _0x22002b=_0x19cb01||stringOptions['algorithm'];var _0x4dcfa2=_0x3fb9d0||stringOptions['secret'];var _0x2a817a=crypto[_0x828f('0x18')](_0x22002b,_0x4dcfa2);var _0x3100f1=_0x2a817a[_0x828f('0x1f')](_0x24784e,'base64',_0x828f('0x1c'));_0x3100f1+=_0x2a817a[_0x828f('0x1a')](_0x828f('0x1c'));return _0x3100f1;}; \ No newline at end of file +var _0x75d2=['binary','write','end','final','close','unlink','createDecipher','data','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','../../config/logger','app','session','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update'];(function(_0x367c9c,_0xb8a7fa){var _0x310f14=function(_0x54aba8){while(--_0x54aba8){_0x367c9c['push'](_0x367c9c['shift']());}};_0x310f14(++_0xb8a7fa);}(_0x75d2,0x142));var _0x275d=function(_0x37ded3,_0x371ebb){_0x37ded3=_0x37ded3-0x0;var _0x51e49e=_0x75d2[_0x37ded3];return _0x51e49e;};'use strict';var crypto=require(_0x275d('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x275d('0x1'));var config=require(_0x275d('0x2'));var logger=require(_0x275d('0x3'))(_0x275d('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x275d('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x275d('0x6')};if(config[_0x275d('0x7')]&&config[_0x275d('0x7')][_0x275d('0x8')]){var isSupported=isAlgorithmSupported(config[_0x275d('0x7')][_0x275d('0x8')]);if(isSupported){fileOptions[_0x275d('0x8')]=config[_0x275d('0x7')][_0x275d('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config['encrypt']['algorithm'],_0x275d('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x3c7457){return AES_SUPPORTED_RX[_0x275d('0xa')](_0x3c7457);}function getSupportedCiphers(){return crypto[_0x275d('0xb')]()[_0x275d('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x3bda7e){return getSupportedCiphers()['indexOf'](_0x3bda7e)>-0x1;}function combineOptions(_0x2dc418){var _0x2eee8f={};for(var _0x311704 in fileOptions){if(fileOptions[_0x275d('0xd')](_0x311704)){_0x2eee8f[_0x311704]=fileOptions[_0x311704];}}if(_0x2dc418){for(var _0x3c9425 in _0x2dc418){if(_0x2dc418['hasOwnProperty'](_0x3c9425)){_0x2eee8f[_0x3c9425]=_0x2dc418[_0x3c9425];}}}return _0x2eee8f;}exports[_0x275d('0xe')]=function(_0x40dc09,_0x9dc977,_0x251379,_0x597e9b){return new BPromise(function(_0x500792,_0x451fdd){_0x597e9b=combineOptions(_0x597e9b);var _0x591375=new Buffer(_0x251379);var _0x3a88cc=fs[_0x275d('0xf')](_0x40dc09);var _0xe1c560=fs[_0x275d('0x10')](_0x9dc977);var _0x5c69de=crypto[_0x275d('0x11')](_0x597e9b[_0x275d('0x8')],_0x591375);_0x3a88cc['on']('data',function(_0x3849da){var _0x45c102=new Buffer(_0x5c69de[_0x275d('0x12')](_0x3849da),_0x275d('0x13'));_0xe1c560[_0x275d('0x14')](_0x45c102);});_0x3a88cc['on'](_0x275d('0x15'),function(){try{var _0x58c25b=new Buffer(_0x5c69de[_0x275d('0x16')](_0x275d('0x13')),_0x275d('0x13'));_0xe1c560[_0x275d('0x14')](_0x58c25b);_0xe1c560['end']();_0xe1c560['on'](_0x275d('0x17'),function(){return _0x500792(_0x9dc977);});}catch(_0x1751ae){fs[_0x275d('0x18')](_0x9dc977);return _0x451fdd(_0x1751ae);}});});};exports['decryptFile']=function(_0x50e55c,_0x3aac6e,_0xd6a8e3,_0x5025ba){return new BPromise(function(_0x502977,_0x5d3806){_0x5025ba=combineOptions(_0x5025ba);var _0x46bfbe=new Buffer(_0xd6a8e3);var _0x573b72=fs[_0x275d('0xf')](_0x50e55c);var _0xbc3dc6=fs[_0x275d('0x10')](_0x3aac6e);var _0x45dc00=crypto[_0x275d('0x19')](_0x5025ba[_0x275d('0x8')],_0x46bfbe);_0x573b72['on'](_0x275d('0x1a'),function(_0xe7e85){var _0x2ebbb2=new Buffer(_0x45dc00[_0x275d('0x12')](_0xe7e85),_0x275d('0x13'));_0xbc3dc6[_0x275d('0x14')](_0x2ebbb2);});_0x573b72['on']('end',function(){try{var _0x223a44=new Buffer(_0x45dc00[_0x275d('0x16')](_0x275d('0x13')),'binary');_0xbc3dc6[_0x275d('0x14')](_0x223a44);_0xbc3dc6[_0x275d('0x15')]();_0xbc3dc6['on'](_0x275d('0x17'),function(){return _0x502977(_0x3aac6e);});}catch(_0x654145){fs['unlink'](_0x3aac6e);return _0x5d3806(_0x654145);}});});};exports['encryptString']=function(_0x4493e9,_0x1fb802,_0x1adcfc){var _0x1617da=_0x1adcfc||stringOptions['algorithm'];var _0x32dd76=_0x1fb802||stringOptions[_0x275d('0x1b')];var _0x4bf64a=crypto[_0x275d('0x11')](_0x1617da,_0x32dd76);var _0x21f390=_0x4bf64a[_0x275d('0x12')](_0x4493e9,_0x275d('0x1c'),_0x275d('0x1d'));_0x21f390+=_0x4bf64a['final'](_0x275d('0x1d'));return _0x21f390;};exports[_0x275d('0x1e')]=function(_0x557497,_0x45b239,_0x8ed81d){var _0x2a38dd=_0x8ed81d||stringOptions['algorithm'];var _0x4cab63=_0x45b239||stringOptions[_0x275d('0x1b')];var _0x407cfa=crypto[_0x275d('0x19')](_0x2a38dd,_0x4cab63);var _0x3240ec=_0x407cfa['update'](_0x557497,_0x275d('0x1d'),_0x275d('0x1c'));_0x3240ec+=_0x407cfa[_0x275d('0x16')]('utf8');return _0x3240ec;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 4af4109..949b229 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 _0xb907=['existsSync','join','each','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','lodash','to-csv','bluebird','zip-dir','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','then','splitSizeCsv','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.csv','split','length'];(function(_0x3877dd,_0x1980d2){var _0x60dc10=function(_0x162f57){while(--_0x162f57){_0x3877dd['push'](_0x3877dd['shift']());}};_0x60dc10(++_0x1980d2);}(_0xb907,0x9f));var _0x7b90=function(_0x3a3dfe,_0x3ed1f5){_0x3a3dfe=_0x3a3dfe-0x0;var _0x5e9b63=_0xb907[_0x3a3dfe];return _0x5e9b63;};'use strict';var util=require(_0x7b90('0x0'));var path=require('path');var _=require(_0x7b90('0x1'));var csv=require(_0x7b90('0x2'));var fs=require('fs');var BPromise=require(_0x7b90('0x3'));var zipdir=require(_0x7b90('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x7b90('0x5')];var logger=require(_0x7b90('0x6'))(_0x7b90('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x7b90('0x8')][0x2]);var QUERY=process[_0x7b90('0x8')][0x3];var PATH=process[_0x7b90('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x58880f,_0x209b2c){var _0x6b470f={'status':_0x58880f};var _0x20f3aa={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x209b2c){_0x6b470f[_0x7b90('0x9')]=_0x209b2c;}return db[_0x7b90('0xa')][_0x7b90('0xb')](_0x6b470f,_0x20f3aa);}function main(){var _0x18933e=0x1388;var _0x2b0238;logger[_0x7b90('0xc')](util[_0x7b90('0xd')](_0x7b90('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x7b90('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x7b90('0x10')](function(_0x4cb1ab){if(_0x4cb1ab){_0x2b0238=_0x4cb1ab;_0x18933e=_0x2b0238[_0x7b90('0x11')]||0x1388;}})[_0x7b90('0x10')](function(){return dbH[_0x7b90('0x12')]['query'](util[_0x7b90('0xd')](_0x7b90('0x13'),QUERY),{'type':dbH['sequelize'][_0x7b90('0x14')]['SELECT']});})[_0x7b90('0x10')](function(_0x2c9142){if(!_0x2c9142[0x0][_0x7b90('0x15')]){return analyticExtractedReport('Empty');}var _0x5e3247=[];var _0x1fa21d=0x0;if(_0x2b0238['split']){if(_0x2c9142&&_0x2c9142['length']){var _0xed4569=_[_0x7b90('0x16')](_0x2c9142[0x0][_0x7b90('0x15')]/_0x18933e);var _0x335443=Number[_0x7b90('0x17')](_0x2c9142[0x0][_0x7b90('0x15')]/_0x18933e)?_0x2c9142[0x0]['num']%_0x18933e:0x0;_0xed4569[_0x7b90('0x18')](function(_0x596ac3){if(_0x596ac3>0x0){_0x1fa21d+=_0x18933e;}_0x5e3247[_0x7b90('0x19')](dbH[_0x7b90('0x12')][_0x7b90('0x1a')](util[_0x7b90('0xd')](_0x7b90('0x1b'),QUERY,_0x18933e,_0x1fa21d),{'type':dbH[_0x7b90('0x12')]['QueryTypes']['SELECT']}));});if(_0x335443>0x0){_0x1fa21d+=_0x18933e;_0x5e3247['push'](dbH[_0x7b90('0x12')][_0x7b90('0x1a')](util['format'](_0x7b90('0x1b'),QUERY,_0x335443,_0x1fa21d),{'type':dbH[_0x7b90('0x12')]['QueryTypes']['SELECT']}));}}}else{_0x5e3247[_0x7b90('0x19')](dbH[_0x7b90('0x12')][_0x7b90('0x1a')](QUERY,{'type':dbH['sequelize'][_0x7b90('0x14')][_0x7b90('0x1c')]}));}var _0x4168f4=path['dirname'](PATH);var _0x417414=path[_0x7b90('0x1d')](PATH,_0x7b90('0x1e'));var _0x3eec60=_0x2b0238[_0x7b90('0x1f')]&&_0x5e3247[_0x7b90('0x20')]>0x1;var _0x259294=[];if(!fs[_0x7b90('0x21')](path['join'](_0x4168f4,_0x417414))&&_0x3eec60){fs['mkdirSync'](path[_0x7b90('0x22')](_0x4168f4,_0x417414));}return BPromise[_0x7b90('0x23')](_0x5e3247,function(_0x58f80b){_0x259294[_0x7b90('0x19')](_0x58f80b);})['then'](function(){for(var _0x336a31=0x0;_0x336a31<_0x259294[_0x7b90('0x20')];_0x336a31+=0x1){var _0x299ae1;var _0x26af2e=_0x259294[_0x336a31];if(_0x3eec60){_0x299ae1=path[_0x7b90('0x22')](_0x4168f4,_0x417414,util[_0x7b90('0xd')]('%s%d.%s',_0x417414,_0x336a31,_0x7b90('0x24')));}else{_0x299ae1=path[_0x7b90('0x22')](_0x4168f4,util[_0x7b90('0xd')](_0x7b90('0x25'),_0x417414,_0x7b90('0x24')));}fs[_0x7b90('0x26')](_0x299ae1,csv(_0x26af2e));}})['then'](function(){if(_0x3eec60){return new Promise(function(_0x84a327){zipdir(path[_0x7b90('0x22')](_0x4168f4,_0x417414),{'saveTo':path['join'](_0x4168f4,util[_0x7b90('0xd')](_0x7b90('0x25'),_0x417414,'zip'))},function(_0x4ebcab,_0x8aa4a2){rimraf(path[_0x7b90('0x22')](_0x4168f4,_0x417414),function(){});_0x84a327(_0x7b90('0x27'));});});}})[_0x7b90('0x10')](function(){logger[_0x7b90('0xc')](util[_0x7b90('0xd')](_0x7b90('0x28'),EXTRACTED_REPORT_ID,_0x7b90('0x29')));return analyticExtractedReport(_0x7b90('0x2a'),_0x3eec60?util[_0x7b90('0xd')](_0x7b90('0x25'),_0x417414,_0x3eec60?'zip':'csv'):null);});})[_0x7b90('0x2b')](function(_0x3bae4e){logger[_0x7b90('0xc')](util[_0x7b90('0xd')](_0x7b90('0x2c'),EXTRACTED_REPORT_ID,_0x7b90('0x29')),util[_0x7b90('0x2d')](_0x3bae4e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7b90('0x2e'));})[_0x7b90('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe7a0=['writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','inspect','finally','exit','util','lodash','to-csv','zip-dir','../../mysqldb','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','then','splitSizeCsv','sequelize','QueryTypes','num','Empty','split','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','length','join','mkdirSync','each','%s%d.%s','csv','%s.%s'];(function(_0x51f601,_0x340ad3){var _0x281f35=function(_0x2effe5){while(--_0x2effe5){_0x51f601['push'](_0x51f601['shift']());}};_0x281f35(++_0x340ad3);}(_0xe7a0,0x19c));var _0x0e7a=function(_0x4d28a9,_0x533a6c){_0x4d28a9=_0x4d28a9-0x0;var _0x4501d6=_0xe7a0[_0x4d28a9];return _0x4501d6;};'use strict';var util=require(_0x0e7a('0x0'));var path=require('path');var _=require(_0x0e7a('0x1'));var csv=require(_0x0e7a('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x0e7a('0x3'));var rimraf=require('rimraf');var db=require(_0x0e7a('0x4'))['db'];var dbH=require(_0x0e7a('0x4'))['dbH'];var logger=require(_0x0e7a('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x0e7a('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1ebcef,_0x44b49b){var _0x1efa79={'status':_0x1ebcef};var _0x2f3d7e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x44b49b){_0x1efa79['savename']=_0x44b49b;}return db[_0x0e7a('0x7')][_0x0e7a('0x8')](_0x1efa79,_0x2f3d7e);}function main(){var _0x2f5e3c=0x1388;var _0x5a1cad;logger[_0x0e7a('0x9')](util[_0x0e7a('0xa')](_0x0e7a('0xb'),EXTRACTED_REPORT_ID,_0x0e7a('0xc')));return db[_0x0e7a('0xd')][_0x0e7a('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x0e7a('0xf')](function(_0x1d8e09){if(_0x1d8e09){_0x5a1cad=_0x1d8e09;_0x2f5e3c=_0x5a1cad[_0x0e7a('0x10')]||0x1388;}})[_0x0e7a('0xf')](function(){return dbH['sequelize']['query'](util[_0x0e7a('0xa')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0e7a('0x11')][_0x0e7a('0x12')]['SELECT']});})[_0x0e7a('0xf')](function(_0xa68c0){if(!_0xa68c0[0x0][_0x0e7a('0x13')]){return analyticExtractedReport(_0x0e7a('0x14'));}var _0x4b519c=[];var _0x30b217=0x0;if(_0x5a1cad[_0x0e7a('0x15')]){if(_0xa68c0&&_0xa68c0['length']){var _0x1ee9a6=_[_0x0e7a('0x16')](_0xa68c0[0x0][_0x0e7a('0x13')]/_0x2f5e3c);var _0x3fcbe1=Number[_0x0e7a('0x17')](_0xa68c0[0x0][_0x0e7a('0x13')]/_0x2f5e3c)?_0xa68c0[0x0][_0x0e7a('0x13')]%_0x2f5e3c:0x0;_0x1ee9a6[_0x0e7a('0x18')](function(_0x150386){if(_0x150386>0x0){_0x30b217+=_0x2f5e3c;}_0x4b519c[_0x0e7a('0x19')](dbH[_0x0e7a('0x11')][_0x0e7a('0x1a')](util['format'](_0x0e7a('0x1b'),QUERY,_0x2f5e3c,_0x30b217),{'type':dbH['sequelize'][_0x0e7a('0x12')][_0x0e7a('0x1c')]}));});if(_0x3fcbe1>0x0){_0x30b217+=_0x2f5e3c;_0x4b519c[_0x0e7a('0x19')](dbH[_0x0e7a('0x11')]['query'](util[_0x0e7a('0xa')](_0x0e7a('0x1b'),QUERY,_0x3fcbe1,_0x30b217),{'type':dbH[_0x0e7a('0x11')][_0x0e7a('0x12')]['SELECT']}));}}}else{_0x4b519c[_0x0e7a('0x19')](dbH['sequelize'][_0x0e7a('0x1a')](QUERY,{'type':dbH[_0x0e7a('0x11')][_0x0e7a('0x12')][_0x0e7a('0x1c')]}));}var _0x55a5aa=path[_0x0e7a('0x1d')](PATH);var _0x49e2bf=path[_0x0e7a('0x1e')](PATH,'.csv');var _0x259af3=_0x5a1cad[_0x0e7a('0x15')]&&_0x4b519c[_0x0e7a('0x1f')]>0x1;var _0x3957c1=[];if(!fs['existsSync'](path[_0x0e7a('0x20')](_0x55a5aa,_0x49e2bf))&&_0x259af3){fs[_0x0e7a('0x21')](path['join'](_0x55a5aa,_0x49e2bf));}return BPromise[_0x0e7a('0x22')](_0x4b519c,function(_0x2aebf9){_0x3957c1[_0x0e7a('0x19')](_0x2aebf9);})[_0x0e7a('0xf')](function(){for(var _0x21ff2f=0x0;_0x21ff2f<_0x3957c1[_0x0e7a('0x1f')];_0x21ff2f+=0x1){var _0x112aab;var _0x59088c=_0x3957c1[_0x21ff2f];if(_0x259af3){_0x112aab=path[_0x0e7a('0x20')](_0x55a5aa,_0x49e2bf,util[_0x0e7a('0xa')](_0x0e7a('0x23'),_0x49e2bf,_0x21ff2f,_0x0e7a('0x24')));}else{_0x112aab=path['join'](_0x55a5aa,util[_0x0e7a('0xa')](_0x0e7a('0x25'),_0x49e2bf,_0x0e7a('0x24')));}fs[_0x0e7a('0x26')](_0x112aab,csv(_0x59088c));}})[_0x0e7a('0xf')](function(){if(_0x259af3){return new Promise(function(_0x424829){zipdir(path[_0x0e7a('0x20')](_0x55a5aa,_0x49e2bf),{'saveTo':path[_0x0e7a('0x20')](_0x55a5aa,util['format'](_0x0e7a('0x25'),_0x49e2bf,'zip'))},function(_0x2f1444,_0x59cff5){rimraf(path[_0x0e7a('0x20')](_0x55a5aa,_0x49e2bf),function(){});_0x424829(_0x0e7a('0x27'));});});}})[_0x0e7a('0xf')](function(){logger[_0x0e7a('0x9')](util[_0x0e7a('0xa')](_0x0e7a('0x28'),EXTRACTED_REPORT_ID,_0x0e7a('0xc')));return analyticExtractedReport('Completed',_0x259af3?util[_0x0e7a('0xa')](_0x0e7a('0x25'),_0x49e2bf,_0x259af3?'zip':_0x0e7a('0x24')):null);});})[_0x0e7a('0x29')](function(_0x15cffd){logger['info'](util[_0x0e7a('0xa')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0e7a('0xc')),util[_0x0e7a('0x2a')](_0x15cffd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0e7a('0x2b')](function(){process[_0x0e7a('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 000cba9..cb6d55f 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 _0xbc02=['update','map','pick','fill','body','push','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','before','margin','landscape','toString','footer','Arial','black','right','Empty','find','split','splitSizePdf','then','isInteger','num','sequelize','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','basename','.pdf','existsSync','join','length','createPdfKitDocument','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x2f5b07,_0x5e749f){var _0x8bb306=function(_0x3c591c){while(--_0x3c591c){_0x2f5b07['push'](_0x2f5b07['shift']());}};_0x8bb306(++_0x5e749f);}(_0xbc02,0x9b));var _0x2bc0=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0xbc02[_0x4b26b5];return _0x4dec71;};'use strict';var _=require(_0x2bc0('0x0'));var fs=require('fs');var util=require(_0x2bc0('0x1'));var path=require(_0x2bc0('0x2'));var moment=require(_0x2bc0('0x3'));var htmlToPdfmake=require(_0x2bc0('0x4'));var PdfPrinter=require(_0x2bc0('0x5'));var zipdir=require(_0x2bc0('0x6'));var rimraf=require(_0x2bc0('0x7'));var JSDOM=require(_0x2bc0('0x8'))['JSDOM'];var window=new JSDOM('')[_0x2bc0('0x9')];var BPromise=require(_0x2bc0('0xa'));var db=require(_0x2bc0('0xb'))['db'];var dbH=require(_0x2bc0('0xb'))[_0x2bc0('0xc')];var logger=require(_0x2bc0('0xd'))(_0x2bc0('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0x2bc0('0xf')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x2bc0('0xf')][0x4];var NAME=process[_0x2bc0('0xf')][0x5];var FORMAT=_0x2bc0('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x571c3d,_0x32e160){var _0x2cbc29={'status':_0x571c3d};var _0xda6202={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x32e160){_0x2cbc29[_0x2bc0('0x11')]=_0x32e160;}return db[_0x2bc0('0x12')][_0x2bc0('0x13')](_0x2cbc29,_0xda6202);}function getHeaders(_0x6baf5b){return _[_0x2bc0('0x14')](_0x6baf5b,function(_0x149b0c){return{'text':_0x149b0c,'style':'tableHeader'};});}function getRows(_0x343807,_0x4f83af){return _[_0x2bc0('0x14')](_0x4f83af,function(_0x2d7867){return _(_0x2d7867)[_0x2bc0('0x15')](_0x343807)['map'](function(_0x250b7e){return _0x250b7e?_['toString'](_0x250b7e):'';})['value']();});}function createTable(_0x2bd88f,_0x5d5013){var _0x39be8a={'widths':_[_0x2bc0('0x16')](Array(_0x2bd88f['length']),0x91),'heights':function(_0x4e753a){return _0x4e753a===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x55b38e=getHeaders(_0x2bd88f);_0x39be8a[_0x2bc0('0x17')][_0x2bc0('0x18')](_0x55b38e);var _0x31a64e=getRows(_0x2bd88f,_0x5d5013);_0x39be8a[_0x2bc0('0x17')]=_0x39be8a[_0x2bc0('0x17')]['concat'](_0x31a64e);return _0x39be8a;}function createTables(_0x277135){var _0x38c0c2=[];var _0x4554b4=_[_0x2bc0('0x19')](Object[_0x2bc0('0x1a')](_0x277135[0x0]),0x5);_0x4554b4[_0x2bc0('0x1b')](function(_0x2aee94){_0x38c0c2[_0x2bc0('0x18')](createTable(_0x2aee94,_0x277135));});return _0x38c0c2;}function getPDFDocDefinition(_0x4de8e9){var _0x82ae2=util['format'](_0x2bc0('0x1c'),NAME,EXTRACTED_REPORT[_0x2bc0('0x1d')],moment(EXTRACTED_REPORT[_0x2bc0('0x1e')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x2bc0('0x1f')])['format'](FORMAT));var _0x16de59=[];for(var _0x45d0db=0x0;_0x45d0db<_0x4de8e9['length'];_0x45d0db++){var _0x482bc1=[];if(_0x45d0db===0x0){_0x482bc1['push']({'text':_0x82ae2,'style':_0x2bc0('0x20')});}var _0x1b2a6c={'table':_0x4de8e9[_0x45d0db]};if(_0x45d0db>0x0){_0x1b2a6c['pageBreak']=_0x2bc0('0x21');_0x1b2a6c[_0x2bc0('0x22')]=[0x0,0x46,0x0,0x0];}_0x482bc1[_0x2bc0('0x18')](_0x1b2a6c);_0x16de59[_0x2bc0('0x18')](_0x482bc1);}return{'pageSize':'A4','pageOrientation':_0x2bc0('0x23'),'content':_0x16de59,'footer':function(_0x3e35c9,_0x5f070a){return{'text':_0x3e35c9[_0x2bc0('0x24')]()+'\x20/\x20'+_0x5f070a,'style':_0x2bc0('0x25')};},'defaultStyle':{'font':_0x2bc0('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x2bc0('0x27')},'footer':{'alignment':_0x2bc0('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3cb50a){var _0xbfab1a=0x1388;var _0x17ac6c;if(!_0x3cb50a[0x0]['num']){return analyticExtractedReport(_0x2bc0('0x29'));}return db['Setting'][_0x2bc0('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2bc0('0x2b'),_0x2bc0('0x2c')]})[_0x2bc0('0x2d')](function(_0x2807e8){if(_0x2807e8){_0x17ac6c=_0x2807e8;_0xbfab1a=_0x17ac6c[_0x2bc0('0x2c')]||0x3e8;}})[_0x2bc0('0x2d')](function(){var _0x98c6c8=[];var _0x38e99a=0x0;if(_0x17ac6c[_0x2bc0('0x2b')]){if(_0x3cb50a&&_0x3cb50a['length']){var _0x679851=_['range'](_0x3cb50a[0x0]['num']/_0xbfab1a);var _0x1975db=Number[_0x2bc0('0x2e')](_0x3cb50a[0x0][_0x2bc0('0x2f')]/_0xbfab1a)?_0x3cb50a[0x0][_0x2bc0('0x2f')]%_0xbfab1a:0x0;_0x679851['forEach'](function(_0x435d16){if(_0x435d16>0x0){_0x38e99a+=_0xbfab1a;}_0x98c6c8[_0x2bc0('0x18')](dbH[_0x2bc0('0x30')]['query'](util[_0x2bc0('0x31')](_0x2bc0('0x32'),QUERY,_0xbfab1a,_0x38e99a),{'type':dbH['sequelize'][_0x2bc0('0x33')][_0x2bc0('0x34')]}));});if(_0x1975db>0x0){_0x38e99a+=_0xbfab1a;_0x98c6c8['push'](dbH[_0x2bc0('0x30')][_0x2bc0('0x35')](util['format'](_0x2bc0('0x32'),QUERY,_0x1975db,_0x38e99a),{'type':dbH[_0x2bc0('0x30')]['QueryTypes'][_0x2bc0('0x34')]}));}}}else{_0x98c6c8[_0x2bc0('0x18')](dbH[_0x2bc0('0x30')][_0x2bc0('0x35')](QUERY,{'type':dbH['sequelize'][_0x2bc0('0x33')][_0x2bc0('0x34')]}));}var _0x4e3cb1=path['dirname'](PATH);var _0x90ac14=path[_0x2bc0('0x36')](PATH,_0x2bc0('0x37'));var _0x4f9374=_0x17ac6c[_0x2bc0('0x2b')]&&_0x98c6c8['length']>0x1;var _0x5618c8=[];if(!fs[_0x2bc0('0x38')](path[_0x2bc0('0x39')](_0x4e3cb1,_0x90ac14))&&_0x4f9374){fs['mkdirSync'](path[_0x2bc0('0x39')](_0x4e3cb1,_0x90ac14));}return BPromise['each'](_0x98c6c8,function(_0x1ba9f9){_0x5618c8[_0x2bc0('0x18')](_0x1ba9f9);})['then'](function(){var _0x42ca9a=[];for(var _0x2ea829=0x0;_0x2ea829<_0x5618c8[_0x2bc0('0x3a')];_0x2ea829+=0x1){var _0x379a66=_0x5618c8[_0x2ea829];var _0x28c6ee=createTables(_['flatten'](_0x379a66));var _0x3a7885;var _0x2667cb=getPDFDocDefinition(_0x28c6ee);var _0x1a5a41=getPDFPrinter();var _0x5dc76f=_0x1a5a41[_0x2bc0('0x3b')](_0x2667cb);if(_0x4f9374){_0x3a7885=path[_0x2bc0('0x39')](_0x4e3cb1,_0x90ac14,util[_0x2bc0('0x31')]('%s%d.%s',_0x90ac14,_0x2ea829,_0x2bc0('0x3c')));}else{_0x3a7885=path[_0x2bc0('0x39')](_0x4e3cb1,util[_0x2bc0('0x31')](_0x2bc0('0x3d'),_0x90ac14,_0x2bc0('0x3c')));}_0x42ca9a['push'](writePDFDocument(_0x5dc76f,_0x3a7885));}return Promise['all'](_0x42ca9a);})[_0x2bc0('0x2d')](function(){if(_0x4f9374){return new Promise(function(_0x1d9bad){zipdir(path['join'](_0x4e3cb1,_0x90ac14),{'saveTo':path['join'](_0x4e3cb1,util[_0x2bc0('0x31')](_0x2bc0('0x3d'),_0x90ac14,_0x2bc0('0x3e')))},function(){rimraf(path['join'](_0x4e3cb1,_0x90ac14),function(){});_0x1d9bad(_0x2bc0('0x3f'));});});}})['then'](function(){if(!_0x4f9374)return;rimraf(path[_0x2bc0('0x39')](_0x4e3cb1,_0x90ac14),function(){});})['then'](function(){logger[_0x2bc0('0x40')](util[_0x2bc0('0x31')](_0x2bc0('0x41'),EXTRACTED_REPORT_ID,_0x2bc0('0x42')));return analyticExtractedReport(_0x2bc0('0x43'),_0x4f9374?util['format'](_0x2bc0('0x3d'),_0x90ac14,_0x4f9374?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x2bc0('0x40')](util[_0x2bc0('0x31')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2bc0('0x42')));return db[_0x2bc0('0x12')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x40eeb5){EXTRACTED_REPORT=_0x40eeb5;return dbH['sequelize']['query'](util[_0x2bc0('0x31')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2bc0('0x30')][_0x2bc0('0x33')][_0x2bc0('0x34')]});})[_0x2bc0('0x2d')](extractReport)[_0x2bc0('0x44')](function(_0x8f8689){logger['info'](util[_0x2bc0('0x31')](_0x2bc0('0x45'),EXTRACTED_REPORT_ID,_0x2bc0('0x42')),util[_0x2bc0('0x46')](_0x8f8689,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2bc0('0x47'));})[_0x2bc0('0x48')](function(){process[_0x2bc0('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2d5db4=new PdfPrinter({'Arial':{'normal':__dirname+_0x2bc0('0x4a'),'bold':__dirname+_0x2bc0('0x4b'),'italics':__dirname+_0x2bc0('0x4c'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x2d5db4;}function getPDFDocDefinitionFromHTML(_0x1e3d49,_0x33c418){var _0x906581=util['format'](_0x2bc0('0x4d'),_0x33c418[_0x2bc0('0x4e')],_0x33c418[_0x2bc0('0x4f')]);var _0x2b713f=moment()[_0x2bc0('0x31')](_0x2bc0('0x50'))[_0x2bc0('0x24')]();var _0x15c677=htmlToPdfmake(_0x1e3d49,{'window':window,'tableAutoSize':!![]});return{'content':[_0x15c677],'defaultStyle':{'font':_0x2bc0('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x2bc0('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x2bc0('0x20')}];},'footer':function(_0x2a6f80,_0x374c33){return[{'text':util[_0x2bc0('0x31')](_0x2bc0('0x52'),_0x906581,_0x2a6f80,_0x374c33,_0x2b713f),'style':_0x2bc0('0x25')}];}};}function writePDFDocument(_0x263969,_0x315511){return new Promise(function(_0x142067,_0x46463c){var _0xc39ded=_0x263969[_0x2bc0('0x53')](fs[_0x2bc0('0x54')](_0x315511));_0xc39ded['on'](_0x2bc0('0x55'),function(){_0x142067('finish');});_0xc39ded['on']('error',function(_0x927b87){_0x46463c(_0x927b87);});_0x263969[_0x2bc0('0x56')]();});}exports['createPdfFromHTML']=function(_0x552fbf,_0x17ab31){var _0x5a33e8=getPDFPrinter();var _0x1a6ecd=getPDFDocDefinitionFromHTML(_0x552fbf,_0x17ab31);var _0x166e91=_0x5a33e8[_0x2bc0('0x3b')](_0x1a6ecd);return writePDFDocument(_0x166e91,_0x17ab31['path'])[_0x2bc0('0x44')](function(_0x1e6262){throw _0x1e6262;});}; \ No newline at end of file +var _0xa47a=['sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','center','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','lodash','util','path','moment','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','name','startDate','endDate','pageBreak','Arial','black','right','num','Empty','Setting','find','split','then','splitSizePdf','range','isInteger'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa47a,0xd9));var _0xaa47=function(_0x43615c,_0xcbb0a3){_0x43615c=_0x43615c-0x0;var _0x26d3fe=_0xa47a[_0x43615c];return _0x26d3fe;};'use strict';var _=require(_0xaa47('0x0'));var fs=require('fs');var util=require(_0xaa47('0x1'));var path=require(_0xaa47('0x2'));var moment=require(_0xaa47('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xaa47('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xaa47('0x5'));var JSDOM=require(_0xaa47('0x6'))[_0xaa47('0x7')];var window=new JSDOM('')[_0xaa47('0x8')];var BPromise=require(_0xaa47('0x9'));var db=require(_0xaa47('0xa'))['db'];var dbH=require(_0xaa47('0xa'))['dbH'];var logger=require(_0xaa47('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xaa47('0xc')][0x2]);var QUERY=process[_0xaa47('0xc')][0x3];var PATH=process[_0xaa47('0xc')][0x4];var NAME=process[_0xaa47('0xc')][0x5];var FORMAT=_0xaa47('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1fceae,_0xe090ee){var _0x45cf4c={'status':_0x1fceae};var _0x2cb851={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xe090ee){_0x45cf4c[_0xaa47('0xe')]=_0xe090ee;}return db[_0xaa47('0xf')]['update'](_0x45cf4c,_0x2cb851);}function getHeaders(_0x5b4b16){return _[_0xaa47('0x10')](_0x5b4b16,function(_0x53ee63){return{'text':_0x53ee63,'style':_0xaa47('0x11')};});}function getRows(_0x5dfa4d,_0x29ef8b){return _[_0xaa47('0x10')](_0x29ef8b,function(_0x18eae9){return _(_0x18eae9)[_0xaa47('0x12')](_0x5dfa4d)['map'](function(_0x1b43d2){return _0x1b43d2?_[_0xaa47('0x13')](_0x1b43d2):'';})[_0xaa47('0x14')]();});}function createTable(_0x4f9bbb,_0x5d8d0f){var _0x35053d={'widths':_[_0xaa47('0x15')](Array(_0x4f9bbb[_0xaa47('0x16')]),0x91),'heights':function(_0x567a57){return _0x567a57===0x0?_0xaa47('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x216101=getHeaders(_0x4f9bbb);_0x35053d[_0xaa47('0x18')][_0xaa47('0x19')](_0x216101);var _0x1a6852=getRows(_0x4f9bbb,_0x5d8d0f);_0x35053d[_0xaa47('0x18')]=_0x35053d[_0xaa47('0x18')][_0xaa47('0x1a')](_0x1a6852);return _0x35053d;}function createTables(_0x13dd59){var _0x4a925a=[];var _0x282e40=_[_0xaa47('0x1b')](Object[_0xaa47('0x1c')](_0x13dd59[0x0]),0x5);_0x282e40[_0xaa47('0x1d')](function(_0x22fb11){_0x4a925a[_0xaa47('0x19')](createTable(_0x22fb11,_0x13dd59));});return _0x4a925a;}function getPDFDocDefinition(_0xfc2f65){var _0x47ca1b=util[_0xaa47('0x1e')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xaa47('0x1f')],moment(EXTRACTED_REPORT[_0xaa47('0x20')])[_0xaa47('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xaa47('0x21')])[_0xaa47('0x1e')](FORMAT));var _0x7004f5=[];for(var _0x5faee1=0x0;_0x5faee1<_0xfc2f65[_0xaa47('0x16')];_0x5faee1++){var _0x4b74ab=[];if(_0x5faee1===0x0){_0x4b74ab[_0xaa47('0x19')]({'text':_0x47ca1b,'style':'header'});}var _0x1fb810={'table':_0xfc2f65[_0x5faee1]};if(_0x5faee1>0x0){_0x1fb810[_0xaa47('0x22')]='before';_0x1fb810['margin']=[0x0,0x46,0x0,0x0];}_0x4b74ab[_0xaa47('0x19')](_0x1fb810);_0x7004f5[_0xaa47('0x19')](_0x4b74ab);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x7004f5,'footer':function(_0x21f89e,_0x4add00){return{'text':_0x21f89e[_0xaa47('0x13')]()+'\x20/\x20'+_0x4add00,'style':'footer'};},'defaultStyle':{'font':_0xaa47('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xaa47('0x24')},'footer':{'alignment':_0xaa47('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x456d3b){var _0x58b13d=0x1388;var _0x521c34;if(!_0x456d3b[0x0][_0xaa47('0x26')]){return analyticExtractedReport(_0xaa47('0x27'));}return db[_0xaa47('0x28')][_0xaa47('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xaa47('0x2a'),'splitSizePdf']})[_0xaa47('0x2b')](function(_0x52bae2){if(_0x52bae2){_0x521c34=_0x52bae2;_0x58b13d=_0x521c34[_0xaa47('0x2c')]||0x3e8;}})[_0xaa47('0x2b')](function(){var _0x4b7b0f=[];var _0x2b2ae5=0x0;if(_0x521c34[_0xaa47('0x2a')]){if(_0x456d3b&&_0x456d3b[_0xaa47('0x16')]){var _0x5b8552=_[_0xaa47('0x2d')](_0x456d3b[0x0][_0xaa47('0x26')]/_0x58b13d);var _0x463716=Number[_0xaa47('0x2e')](_0x456d3b[0x0][_0xaa47('0x26')]/_0x58b13d)?_0x456d3b[0x0][_0xaa47('0x26')]%_0x58b13d:0x0;_0x5b8552[_0xaa47('0x1d')](function(_0xf23094){if(_0xf23094>0x0){_0x2b2ae5+=_0x58b13d;}_0x4b7b0f[_0xaa47('0x19')](dbH[_0xaa47('0x2f')][_0xaa47('0x30')](util[_0xaa47('0x1e')](_0xaa47('0x31'),QUERY,_0x58b13d,_0x2b2ae5),{'type':dbH['sequelize'][_0xaa47('0x32')][_0xaa47('0x33')]}));});if(_0x463716>0x0){_0x2b2ae5+=_0x58b13d;_0x4b7b0f[_0xaa47('0x19')](dbH['sequelize']['query'](util[_0xaa47('0x1e')](_0xaa47('0x31'),QUERY,_0x463716,_0x2b2ae5),{'type':dbH[_0xaa47('0x2f')]['QueryTypes']['SELECT']}));}}}else{_0x4b7b0f[_0xaa47('0x19')](dbH[_0xaa47('0x2f')][_0xaa47('0x30')](QUERY,{'type':dbH[_0xaa47('0x2f')][_0xaa47('0x32')]['SELECT']}));}var _0x1629eb=path['dirname'](PATH);var _0x117a33=path[_0xaa47('0x34')](PATH,_0xaa47('0x35'));var _0x29bd99=_0x521c34[_0xaa47('0x2a')]&&_0x4b7b0f[_0xaa47('0x16')]>0x1;var _0x4de00a=[];if(!fs[_0xaa47('0x36')](path[_0xaa47('0x37')](_0x1629eb,_0x117a33))&&_0x29bd99){fs[_0xaa47('0x38')](path[_0xaa47('0x37')](_0x1629eb,_0x117a33));}return BPromise[_0xaa47('0x39')](_0x4b7b0f,function(_0x57170e){_0x4de00a[_0xaa47('0x19')](_0x57170e);})[_0xaa47('0x2b')](function(){var _0x5918ca=[];for(var _0x5061e9=0x0;_0x5061e9<_0x4de00a[_0xaa47('0x16')];_0x5061e9+=0x1){var _0x1477ea=_0x4de00a[_0x5061e9];var _0x51afbd=createTables(_[_0xaa47('0x3a')](_0x1477ea));var _0xbfa0fa;var _0x66abf2=getPDFDocDefinition(_0x51afbd);var _0xc1296a=getPDFPrinter();var _0x54bb25=_0xc1296a[_0xaa47('0x3b')](_0x66abf2);if(_0x29bd99){_0xbfa0fa=path[_0xaa47('0x37')](_0x1629eb,_0x117a33,util[_0xaa47('0x1e')](_0xaa47('0x3c'),_0x117a33,_0x5061e9,_0xaa47('0x3d')));}else{_0xbfa0fa=path['join'](_0x1629eb,util[_0xaa47('0x1e')]('%s.%s',_0x117a33,_0xaa47('0x3d')));}_0x5918ca[_0xaa47('0x19')](writePDFDocument(_0x54bb25,_0xbfa0fa));}return Promise[_0xaa47('0x3e')](_0x5918ca);})[_0xaa47('0x2b')](function(){if(_0x29bd99){return new Promise(function(_0x5d7c23){zipdir(path[_0xaa47('0x37')](_0x1629eb,_0x117a33),{'saveTo':path[_0xaa47('0x37')](_0x1629eb,util[_0xaa47('0x1e')](_0xaa47('0x3f'),_0x117a33,_0xaa47('0x40')))},function(){rimraf(path['join'](_0x1629eb,_0x117a33),function(){});_0x5d7c23(_0xaa47('0x41'));});});}})[_0xaa47('0x2b')](function(){if(!_0x29bd99)return;rimraf(path[_0xaa47('0x37')](_0x1629eb,_0x117a33),function(){});})[_0xaa47('0x2b')](function(){logger[_0xaa47('0x42')](util[_0xaa47('0x1e')](_0xaa47('0x43'),EXTRACTED_REPORT_ID,_0xaa47('0x44')));return analyticExtractedReport(_0xaa47('0x45'),_0x29bd99?util['format'](_0xaa47('0x3f'),_0x117a33,_0x29bd99?_0xaa47('0x40'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xaa47('0x1e')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xaa47('0x44')));return db[_0xaa47('0xf')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xaa47('0x2b')](function(_0x1addde){EXTRACTED_REPORT=_0x1addde;return dbH[_0xaa47('0x2f')][_0xaa47('0x30')](util[_0xaa47('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xaa47('0x2f')][_0xaa47('0x32')][_0xaa47('0x33')]});})[_0xaa47('0x2b')](extractReport)[_0xaa47('0x46')](function(_0x296798){logger[_0xaa47('0x42')](util[_0xaa47('0x1e')](_0xaa47('0x47'),EXTRACTED_REPORT_ID,_0xaa47('0x44')),util[_0xaa47('0x48')](_0x296798,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xaa47('0x49')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x23d73f=new PdfPrinter({'Arial':{'normal':__dirname+_0xaa47('0x4a'),'bold':__dirname+_0xaa47('0x4b'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xaa47('0x4c')}});return _0x23d73f;}function getPDFDocDefinitionFromHTML(_0x538bb2,_0x3bcb2b){var _0x4b2c9e=util[_0xaa47('0x1e')](_0xaa47('0x4d'),_0x3bcb2b[_0xaa47('0x4e')],_0x3bcb2b['interactionId']);var _0x2277bf=moment()[_0xaa47('0x1e')]('YYYY-MM-DD')['toString']();var _0x33b418=htmlToPdfmake(_0x538bb2,{'window':window,'tableAutoSize':!![]});return{'content':[_0x33b418],'defaultStyle':{'font':_0xaa47('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xaa47('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xaa47('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xaa47('0x4f')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xaa47('0x50')}];},'footer':function(_0x32afa5,_0x1c5f13){return[{'text':util[_0xaa47('0x1e')](_0xaa47('0x51'),_0x4b2c9e,_0x32afa5,_0x1c5f13,_0x2277bf),'style':_0xaa47('0x52')}];}};}function writePDFDocument(_0x4cb2a6,_0x430339){return new Promise(function(_0x2fa1be,_0xa10f93){var _0x3b94d5=_0x4cb2a6[_0xaa47('0x53')](fs[_0xaa47('0x54')](_0x430339));_0x3b94d5['on'](_0xaa47('0x55'),function(){_0x2fa1be(_0xaa47('0x55'));});_0x3b94d5['on'](_0xaa47('0x56'),function(_0x653842){_0xa10f93(_0x653842);});_0x4cb2a6[_0xaa47('0x57')]();});}exports['createPdfFromHTML']=function(_0x301aba,_0x596078){var _0x5c7b48=getPDFPrinter();var _0x258c0d=getPDFDocDefinitionFromHTML(_0x301aba,_0x596078);var _0x5d0aa1=_0x5c7b48[_0xaa47('0x3b')](_0x258c0d);return writePDFDocument(_0x5d0aa1,_0x596078['path'])[_0xaa47('0x46')](function(_0x50b845){throw _0x50b845;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index bea9485..0301e25 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 _0x590a=['zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','exit','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','QueryTypes','Empty','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.xlsx','join','mkdirSync','each','xlsx','%s.%s','writeFileSync'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x590a,0x159));var _0xa590=function(_0x4d388e,_0x257dd4){_0x4d388e=_0x4d388e-0x0;var _0x5c7c93=_0x590a[_0x4d388e];return _0x5c7c93;};'use strict';var util=require('util');var path=require(_0xa590('0x0'));var _=require(_0xa590('0x1'));var fs=require('fs');var json2xls=require(_0xa590('0x2'));var BPromise=require(_0xa590('0x3'));var zipdir=require(_0xa590('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xa590('0x5'))[_0xa590('0x6')];var logger=require(_0xa590('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa590('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xa590('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x163d19,_0x2ad01a){var _0x27a5fa={'status':_0x163d19};var _0x5d9565={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ad01a){_0x27a5fa['savename']=_0x2ad01a;}return db[_0xa590('0x9')]['update'](_0x27a5fa,_0x5d9565);}function main(){var _0x397b6c=0x1388;var _0x3e59f3;logger[_0xa590('0xa')](util['format'](_0xa590('0xb'),EXTRACTED_REPORT_ID,_0xa590('0xc')));return db[_0xa590('0xd')][_0xa590('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa590('0xf'),_0xa590('0x10')]})[_0xa590('0x11')](function(_0x570b51){if(_0x570b51){_0x3e59f3=_0x570b51;_0x397b6c=_0x3e59f3['splitSizeXlsx']||0x1388;}})[_0xa590('0x11')](function(){return dbH[_0xa590('0x12')][_0xa590('0x13')](util[_0xa590('0x14')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xa590('0x12')][_0xa590('0x15')]['SELECT']});})['then'](function(_0x2954af){if(!_0x2954af[0x0]['num']){return analyticExtractedReport(_0xa590('0x16'));}var _0x6ca5c8=[];var _0x1d218c=0x0;if(_0x3e59f3[_0xa590('0xf')]){if(_0x2954af&&_0x2954af[_0xa590('0x17')]){var _0x114654=_[_0xa590('0x18')](_0x2954af[0x0][_0xa590('0x19')]/_0x397b6c);var _0x4f4075=Number[_0xa590('0x1a')](_0x2954af[0x0][_0xa590('0x19')]/_0x397b6c)?_0x2954af[0x0][_0xa590('0x19')]%_0x397b6c:0x0;_0x114654[_0xa590('0x1b')](function(_0x5b4317){if(_0x5b4317>0x0){_0x1d218c+=_0x397b6c;}_0x6ca5c8[_0xa590('0x1c')](dbH[_0xa590('0x12')][_0xa590('0x13')](util[_0xa590('0x14')](_0xa590('0x1d'),QUERY,_0x397b6c,_0x1d218c),{'type':dbH[_0xa590('0x12')][_0xa590('0x15')][_0xa590('0x1e')]}));});if(_0x4f4075>0x0){_0x1d218c+=_0x397b6c;_0x6ca5c8['push'](dbH[_0xa590('0x12')][_0xa590('0x13')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4f4075,_0x1d218c),{'type':dbH[_0xa590('0x12')][_0xa590('0x15')][_0xa590('0x1e')]}));}}}else{_0x6ca5c8[_0xa590('0x1c')](dbH[_0xa590('0x12')]['query'](QUERY,{'type':dbH[_0xa590('0x12')][_0xa590('0x15')][_0xa590('0x1e')]}));}var _0x257297=path[_0xa590('0x1f')](PATH);var _0x457a32=path['basename'](PATH,_0xa590('0x20'));var _0x4fdc6e=_0x3e59f3[_0xa590('0xf')]&&_0x6ca5c8[_0xa590('0x17')]>0x1;var _0x46f7dd=[];if(!fs['existsSync'](path[_0xa590('0x21')](_0x257297,_0x457a32))&&_0x4fdc6e){fs[_0xa590('0x22')](path[_0xa590('0x21')](_0x257297,_0x457a32));}return BPromise[_0xa590('0x23')](_0x6ca5c8,function(_0x51612e){_0x46f7dd['push'](_0x51612e);})[_0xa590('0x11')](function(){for(var _0x391f8c=0x0;_0x391f8c<_0x46f7dd[_0xa590('0x17')];_0x391f8c+=0x1){var _0x115e45;var _0x3b47f1=_0x46f7dd[_0x391f8c];if(_0x4fdc6e){_0x115e45=path[_0xa590('0x21')](_0x257297,_0x457a32,util[_0xa590('0x14')]('%s%d.%s',_0x457a32,_0x391f8c,_0xa590('0x24')));}else{_0x115e45=path[_0xa590('0x21')](_0x257297,util[_0xa590('0x14')](_0xa590('0x25'),_0x457a32,_0xa590('0x24')));}fs[_0xa590('0x26')](_0x115e45,json2xls(_0x3b47f1),'binary');}})['then'](function(){if(_0x4fdc6e){return new Promise(function(_0x5e86e2){zipdir(path[_0xa590('0x21')](_0x257297,_0x457a32),{'saveTo':path['join'](_0x257297,util['format'](_0xa590('0x25'),_0x457a32,_0xa590('0x27')))},function(_0x41782a,_0x2cbe1a){rimraf(path['join'](_0x257297,_0x457a32),function(){});_0x5e86e2(_0xa590('0x28'));});});}})[_0xa590('0x11')](function(){logger['info'](util[_0xa590('0x14')](_0xa590('0x29'),EXTRACTED_REPORT_ID,_0xa590('0xc')));return analyticExtractedReport(_0xa590('0x2a'),_0x4fdc6e?util[_0xa590('0x14')]('%s.%s',_0x457a32,_0x4fdc6e?_0xa590('0x27'):'xlsx'):null);});})[_0xa590('0x2b')](function(_0x15f2c5){logger[_0xa590('0xa')](util[_0xa590('0x14')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa590('0xc')),util[_0xa590('0x2c')](_0x15f2c5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa590('0x2d'));})[_0xa590('0x2e')](function(){process[_0xa590('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2964=['update','info','format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','%s%d.%s','xlsx','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport'];(function(_0x3433f9,_0x4ad882){var _0x588a44=function(_0x520f77){while(--_0x520f77){_0x3433f9['push'](_0x3433f9['shift']());}};_0x588a44(++_0x4ad882);}(_0x2964,0x8f));var _0x4296=function(_0xaaa578,_0x4177d3){_0xaaa578=_0xaaa578-0x0;var _0x2fddff=_0x2964[_0xaaa578];return _0x2fddff;};'use strict';var util=require(_0x4296('0x0'));var path=require(_0x4296('0x1'));var _=require(_0x4296('0x2'));var fs=require('fs');var json2xls=require(_0x4296('0x3'));var BPromise=require(_0x4296('0x4'));var zipdir=require(_0x4296('0x5'));var rimraf=require(_0x4296('0x6'));var db=require(_0x4296('0x7'))['db'];var dbH=require('../../mysqldb')[_0x4296('0x8')];var logger=require(_0x4296('0x9'))(_0x4296('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x4296('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4296('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3baa3b,_0x332dc4){var _0x367c94={'status':_0x3baa3b};var _0x23eb1b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x332dc4){_0x367c94['savename']=_0x332dc4;}return db[_0x4296('0xc')][_0x4296('0xd')](_0x367c94,_0x23eb1b);}function main(){var _0x3392af=0x1388;var _0x3676c7;logger[_0x4296('0xe')](util[_0x4296('0xf')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4296('0x10')));return db[_0x4296('0x11')][_0x4296('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4296('0x13'),_0x4296('0x14')]})['then'](function(_0x434556){if(_0x434556){_0x3676c7=_0x434556;_0x3392af=_0x3676c7['splitSizeXlsx']||0x1388;}})[_0x4296('0x15')](function(){return dbH[_0x4296('0x16')][_0x4296('0x17')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4296('0x16')][_0x4296('0x18')][_0x4296('0x19')]});})['then'](function(_0x4a7378){if(!_0x4a7378[0x0][_0x4296('0x1a')]){return analyticExtractedReport(_0x4296('0x1b'));}var _0x575cd9=[];var _0x5c4ddf=0x0;if(_0x3676c7[_0x4296('0x13')]){if(_0x4a7378&&_0x4a7378[_0x4296('0x1c')]){var _0x3433a5=_[_0x4296('0x1d')](_0x4a7378[0x0][_0x4296('0x1a')]/_0x3392af);var _0x1b56d4=Number[_0x4296('0x1e')](_0x4a7378[0x0][_0x4296('0x1a')]/_0x3392af)?_0x4a7378[0x0][_0x4296('0x1a')]%_0x3392af:0x0;_0x3433a5[_0x4296('0x1f')](function(_0x34d32a){if(_0x34d32a>0x0){_0x5c4ddf+=_0x3392af;}_0x575cd9[_0x4296('0x20')](dbH['sequelize'][_0x4296('0x17')](util[_0x4296('0xf')](_0x4296('0x21'),QUERY,_0x3392af,_0x5c4ddf),{'type':dbH[_0x4296('0x16')][_0x4296('0x18')][_0x4296('0x19')]}));});if(_0x1b56d4>0x0){_0x5c4ddf+=_0x3392af;_0x575cd9['push'](dbH[_0x4296('0x16')][_0x4296('0x17')](util['format'](_0x4296('0x21'),QUERY,_0x1b56d4,_0x5c4ddf),{'type':dbH[_0x4296('0x16')][_0x4296('0x18')][_0x4296('0x19')]}));}}}else{_0x575cd9[_0x4296('0x20')](dbH[_0x4296('0x16')]['query'](QUERY,{'type':dbH[_0x4296('0x16')][_0x4296('0x18')][_0x4296('0x19')]}));}var _0x206859=path[_0x4296('0x22')](PATH);var _0x5e713a=path[_0x4296('0x23')](PATH,_0x4296('0x24'));var _0x41242b=_0x3676c7[_0x4296('0x13')]&&_0x575cd9[_0x4296('0x1c')]>0x1;var _0x516366=[];if(!fs[_0x4296('0x25')](path[_0x4296('0x26')](_0x206859,_0x5e713a))&&_0x41242b){fs['mkdirSync'](path[_0x4296('0x26')](_0x206859,_0x5e713a));}return BPromise['each'](_0x575cd9,function(_0xa3ef29){_0x516366['push'](_0xa3ef29);})[_0x4296('0x15')](function(){for(var _0x4f1a29=0x0;_0x4f1a29<_0x516366[_0x4296('0x1c')];_0x4f1a29+=0x1){var _0x537ce5;var _0x4a511e=_0x516366[_0x4f1a29];if(_0x41242b){_0x537ce5=path[_0x4296('0x26')](_0x206859,_0x5e713a,util[_0x4296('0xf')](_0x4296('0x27'),_0x5e713a,_0x4f1a29,_0x4296('0x28')));}else{_0x537ce5=path[_0x4296('0x26')](_0x206859,util['format']('%s.%s',_0x5e713a,'xlsx'));}fs[_0x4296('0x29')](_0x537ce5,json2xls(_0x4a511e),'binary');}})[_0x4296('0x15')](function(){if(_0x41242b){return new Promise(function(_0x894a29){zipdir(path[_0x4296('0x26')](_0x206859,_0x5e713a),{'saveTo':path[_0x4296('0x26')](_0x206859,util[_0x4296('0xf')](_0x4296('0x2a'),_0x5e713a,_0x4296('0x2b')))},function(_0x1668cb,_0x27995a){rimraf(path['join'](_0x206859,_0x5e713a),function(){});_0x894a29(_0x4296('0x2c'));});});}})[_0x4296('0x15')](function(){logger[_0x4296('0xe')](util[_0x4296('0xf')](_0x4296('0x2d'),EXTRACTED_REPORT_ID,_0x4296('0x10')));return analyticExtractedReport(_0x4296('0x2e'),_0x41242b?util[_0x4296('0xf')]('%s.%s',_0x5e713a,_0x41242b?_0x4296('0x2b'):_0x4296('0x28')):null);});})[_0x4296('0x2f')](function(_0x50c5c0){logger[_0x4296('0xe')](util['format'](_0x4296('0x30'),EXTRACTED_REPORT_ID,_0x4296('0x10')),util[_0x4296('0x31')](_0x50c5c0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4296('0x32'));})[_0x4296('0x33')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 8ba99ca..17907a5 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 _0xc6e1=['cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','length','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','ExecIf','$[${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)','app','toLowerCase','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','map','filter','groupBy','exten','queue','hasOwnProperty','priority','extensions','extension','push','Set','format','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xc6e1,0xf1));var _0x1c6e=function(_0x4feca4,_0x55a156){_0x4feca4=_0x4feca4-0x0;var _0x448c07=_0xc6e1[_0x4feca4];return _0x448c07;};'use strict';var _=require(_0x1c6e('0x0'));var util=require(_0x1c6e('0x1'));function rewrite(_0xec2539,_0x6a508e){var _0x331e3e=this;return _0xec2539[_0x1c6e('0x2')][_0x1c6e('0x3')][_0x1c6e('0x4')]({'raw':!![]})[_0x1c6e('0x5')](function(_0x3fa313){_0x331e3e[_0x1c6e('0x6')]=_0x3fa313;return _0xec2539[_0x1c6e('0x2')][_0x1c6e('0x7')][_0x1c6e('0x4')]({'where':{'IntervalId':_0x6a508e[_0x1c6e('0x8')]},'raw':!![]});})[_0x1c6e('0x5')](function(_0x3af26f){return _0xec2539[_0x1c6e('0x2')][_0x1c6e('0x7')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x1c6e('0x9')](_0x3af26f,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x1c6e('0x5')](function(_0x760a7f){var _0x1cbd62=_['filter'](_0x760a7f,{'priority':'1'});var _0x120017=_[_0x1c6e('0xa')](_0x760a7f,{'isApp':0x1});var _0x522e78=_[_0x1c6e('0xb')](_0x120017,_0x1c6e('0xc'));var _0x4136b3=[_0x1c6e('0xd'),'playback'];var _0x248073=[];var _0x2fa4e0=[];for(var _0x49f972 in _0x522e78){if(_0x522e78[_0x1c6e('0xe')](_0x49f972)){_0x331e3e[_0x1c6e('0xf')]=0x2;_0x331e3e[_0x1c6e('0x10')]=[];_0x331e3e[_0x1c6e('0x11')]=_['find'](_0x1cbd62,{'exten':_0x522e78[_0x49f972][0x0]['exten']});_0x331e3e['extensions'][_0x1c6e('0x12')]({'type':_0x522e78[_0x49f972][0x0]['type'],'app':_0x1c6e('0x13'),'appdata':util[_0x1c6e('0x14')]('CDR(type)=%s',_0x522e78[_0x49f972][0x0][_0x1c6e('0x15')]),'context':_0x522e78[_0x49f972][0x0][_0x1c6e('0x16')],'exten':_0x522e78[_0x49f972][0x0]['exten'],'priority':_0x331e3e['priority']++,'VoiceExtensionId':_0x522e78[_0x49f972][0x0][_0x1c6e('0x17')]});if(_0x522e78[_0x49f972][0x0][_0x1c6e('0x15')]===_0x1c6e('0x18')){_0x331e3e[_0x1c6e('0x10')]['push']({'type':_0x522e78[_0x49f972][0x0][_0x1c6e('0x15')],'app':'Set','appdata':_0x1c6e('0x19')+_0x522e78[_0x49f972][0x0][_0x1c6e('0x17')],'context':_0x522e78[_0x49f972][0x0][_0x1c6e('0x16')],'exten':_0x522e78[_0x49f972][0x0][_0x1c6e('0xc')],'priority':_0x331e3e['priority']++,'VoiceExtensionId':_0x522e78[_0x49f972][0x0][_0x1c6e('0x17')]});}else if(_0x522e78[_0x49f972][0x0][_0x1c6e('0x15')]===_0x1c6e('0x1a')){if(_0x331e3e[_0x1c6e('0x11')]){_0x331e3e['extensions'][_0x1c6e('0x12')]({'type':_0x522e78[_0x49f972][0x0][_0x1c6e('0x15')],'app':'Set','appdata':'CDR(destination)='+(_0x331e3e[_0x1c6e('0x11')][_0x1c6e('0x1b')]?'${EXTEN:'+_0x331e3e[_0x1c6e('0x11')]['cutdigits']+'}':_0x1c6e('0x1c')),'context':_0x522e78[_0x49f972][0x0][_0x1c6e('0x16')],'exten':_0x522e78[_0x49f972][0x0][_0x1c6e('0xc')],'priority':_0x331e3e['priority']++,'VoiceExtensionId':_0x522e78[_0x49f972][0x0][_0x1c6e('0x17')]});}_0x331e3e['extensions'][_0x1c6e('0x12')]({'type':_0x522e78[_0x49f972][0x0][_0x1c6e('0x15')],'app':_0x1c6e('0x13'),'appdata':_0x1c6e('0x19')+_0x522e78[_0x49f972][0x0][_0x1c6e('0x17')],'context':_0x522e78[_0x49f972][0x0][_0x1c6e('0x16')],'exten':_0x522e78[_0x49f972][0x0][_0x1c6e('0xc')],'priority':_0x331e3e[_0x1c6e('0xf')]++,'VoiceExtensionId':_0x522e78[_0x49f972][0x0][_0x1c6e('0x17')]});var _0xe58a1a=_0x331e3e[_0x1c6e('0xf')]++;_0x331e3e[_0x1c6e('0x10')][_0x1c6e('0x12')]({'type':_0x522e78[_0x49f972][0x0][_0x1c6e('0x15')],'app':'ExecIf','appdata':_0x1c6e('0x1d')+(_0xe58a1a+0x2)+_0x1c6e('0x1e')+(_0xe58a1a+0x1)+')','context':_0x522e78[_0x49f972][0x0][_0x1c6e('0x16')],'exten':_0x522e78[_0x49f972][0x0][_0x1c6e('0xc')],'priority':_0xe58a1a,'VoiceExtensionId':_0x522e78[_0x49f972][0x0][_0x1c6e('0x17')]});if(_0x331e3e['extension']){_0x331e3e['extensions'][_0x1c6e('0x12')]({'type':_0x522e78[_0x49f972][0x0][_0x1c6e('0x15')],'app':_0x1c6e('0x13'),'appdata':_0x331e3e['extension'][_0x1c6e('0x1b')]?_0x1c6e('0x1f')+_0x331e3e['extension'][_0x1c6e('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x522e78[_0x49f972][0x0][_0x1c6e('0x16')],'exten':_0x522e78[_0x49f972][0x0][_0x1c6e('0xc')],'priority':_0x331e3e[_0x1c6e('0xf')]++,'VoiceExtensionId':_0x522e78[_0x49f972][0x0][_0x1c6e('0x17')]});}_0x331e3e[_0x1c6e('0x10')][_0x1c6e('0x12')]({'type':_0x522e78[_0x49f972][0x0][_0x1c6e('0x15')],'app':_0x1c6e('0x13'),'appdata':_0x1c6e('0x20')+_0x522e78[_0x49f972][0x0]['VoiceExtensionId'],'context':_0x522e78[_0x49f972][0x0][_0x1c6e('0x16')],'exten':_0x522e78[_0x49f972][0x0][_0x1c6e('0xc')],'priority':_0x331e3e[_0x1c6e('0xf')]++,'VoiceExtensionId':_0x522e78[_0x49f972][0x0]['VoiceExtensionId']});if(_0x331e3e['extension']&&_0x331e3e['extension'][_0x1c6e('0xe')](_0x1c6e('0x21'))&&_0x331e3e[_0x1c6e('0x11')]['recordingFormat']!==_0x1c6e('0x22')){_0x331e3e[_0x1c6e('0x10')][_0x1c6e('0x12')]({'type':_0x522e78[_0x49f972][0x0][_0x1c6e('0x15')],'app':_0x1c6e('0x13'),'appdata':_0x1c6e('0x23'),'context':_0x522e78[_0x49f972][0x0][_0x1c6e('0x16')],'exten':_0x522e78[_0x49f972][0x0]['exten'],'priority':_0x331e3e['priority']++,'VoiceExtensionId':_0x522e78[_0x49f972][0x0][_0x1c6e('0x17')]});_0x331e3e[_0x1c6e('0x10')]['push']({'type':_0x522e78[_0x49f972][0x0][_0x1c6e('0x15')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x331e3e[_0x1c6e('0x11')]['recordingFormat']||_0x1c6e('0x24'),'context':_0x522e78[_0x49f972][0x0][_0x1c6e('0x16')],'exten':_0x522e78[_0x49f972][0x0][_0x1c6e('0xc')],'priority':_0x331e3e[_0x1c6e('0xf')]++,'VoiceExtensionId':_0x522e78[_0x49f972][0x0]['VoiceExtensionId']});}}_0x331e3e[_0x1c6e('0x10')][_0x1c6e('0x12')]({'type':_0x522e78[_0x49f972][0x0][_0x1c6e('0x15')],'app':_0x1c6e('0x13'),'appdata':_0x1c6e('0x25'),'context':_0x522e78[_0x49f972][0x0]['context'],'exten':_0x522e78[_0x49f972][0x0][_0x1c6e('0xc')],'priority':_0x331e3e[_0x1c6e('0xf')]++,'VoiceExtensionId':_0x522e78[_0x49f972][0x0]['VoiceExtensionId']});_0x331e3e['extensions']['push']({'type':_0x522e78[_0x49f972][0x0][_0x1c6e('0x15')],'app':_0x1c6e('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x522e78[_0x49f972][0x0][_0x1c6e('0x16')],'exten':_0x522e78[_0x49f972][0x0]['exten'],'priority':_0x331e3e[_0x1c6e('0xf')]++,'VoiceExtensionId':_0x522e78[_0x49f972][0x0][_0x1c6e('0x17')]});_0x331e3e[_0x1c6e('0x10')][_0x1c6e('0x12')]({'type':_0x522e78[_0x49f972][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x522e78[_0x49f972][0x0][_0x1c6e('0x16')],'exten':_0x522e78[_0x49f972][0x0][_0x1c6e('0xc')],'priority':_0x331e3e[_0x1c6e('0xf')]++,'VoiceExtensionId':_0x522e78[_0x49f972][0x0]['VoiceExtensionId']});for(var _0x522cb0=0x0,_0x105308=0x0;_0x522cb0<_0x522e78[_0x49f972][_0x1c6e('0x26')];_0x522cb0+=0x1,_0x105308=0x0){var _0x438522=_0x522e78[_0x49f972][_0x522cb0];if(_0x438522['type']){_0x438522['type']=_0x438522[_0x1c6e('0x15')]['toLowerCase']();}var _0x5bac41=[];var _0x20f485=[];delete _0x438522['id'];delete _0x438522[_0x1c6e('0x27')];delete _0x438522[_0x1c6e('0x28')];var _0x3d60a5=_0x438522[_0x1c6e('0x29')]!==_0x1c6e('0x2a')?[_0x438522[_0x1c6e('0x29')]]:_0x438522['IntervalId']?_['map'](_[_0x1c6e('0xa')](_0x331e3e[_0x1c6e('0x6')],{'IntervalId':_0x438522[_0x1c6e('0x8')]}),_0x1c6e('0x29')):[];if(_0x438522[_0x1c6e('0xe')](_0x1c6e('0x2b'))){if(_0x438522[_0x1c6e('0x2b')]&&_0x438522[_0x1c6e('0x2b')]!=='--'){_0x5bac41[_0x1c6e('0x12')]({'type':_0x438522[_0x1c6e('0x15')],'app':_0x1c6e('0x13'),'appdata':_0x1c6e('0x2c')+_0x438522[_0x1c6e('0x2b')],'context':_0x438522[_0x1c6e('0x16')],'exten':_0x438522['exten'],'priority':_0x3d60a5[_0x1c6e('0x26')]+_0x331e3e['priority']+_0x105308++,'VoiceExtensionId':_0x438522[_0x1c6e('0x17')]});}}if(_0x438522[_0x1c6e('0x15')]===_0x1c6e('0x1a')&&_0x438522[_0x1c6e('0xe')](_0x1c6e('0x2d'))){if(_0x438522[_0x1c6e('0x2d')]){_0x5bac41[_0x1c6e('0x12')]({'type':_0x438522['type'],'app':_0x1c6e('0x2e'),'appdata':_0x1c6e('0x2f')+_0x438522['callerID']+')','context':_0x438522[_0x1c6e('0x16')],'exten':_0x438522[_0x1c6e('0xc')],'priority':_0x3d60a5[_0x1c6e('0x26')]+_0x331e3e['priority']+_0x105308++,'VoiceExtensionId':_0x438522[_0x1c6e('0x17')]});}else{_0x5bac41[_0x1c6e('0x12')]({'type':_0x438522['type'],'app':_0x1c6e('0x2e'),'appdata':_0x1c6e('0x30'),'context':_0x438522['context'],'exten':_0x438522[_0x1c6e('0xc')],'priority':_0x3d60a5[_0x1c6e('0x26')]+_0x331e3e[_0x1c6e('0xf')]+_0x105308++,'VoiceExtensionId':_0x438522[_0x1c6e('0x17')]});}}if(_0x438522[_0x1c6e('0xe')]('answer')){if(_0x4136b3['indexOf'](_0x438522[_0x1c6e('0x31')][_0x1c6e('0x32')]())>=0x0&&_0x438522[_0x1c6e('0x33')]!=='custom'){if(_0x438522[_0x1c6e('0x34')]){_0x5bac41[_0x1c6e('0x12')]({'type':_0x438522[_0x1c6e('0x15')],'app':_0x1c6e('0x2e'),'appdata':_0x1c6e('0x35'),'context':_0x438522[_0x1c6e('0x16')],'exten':_0x438522[_0x1c6e('0xc')],'priority':_0x3d60a5['length']+_0x331e3e[_0x1c6e('0xf')]+_0x105308++,'VoiceExtensionId':_0x438522[_0x1c6e('0x17')]});_0x5bac41[_0x1c6e('0x12')]({'type':_0x438522['type'],'app':_0x1c6e('0x13'),'appdata':_0x1c6e('0x36'),'context':_0x438522['context'],'exten':_0x438522['exten'],'priority':_0x3d60a5[_0x1c6e('0x26')]+_0x331e3e[_0x1c6e('0xf')]+_0x105308++,'VoiceExtensionId':_0x438522[_0x1c6e('0x17')]});}else{_0x5bac41['push']({'type':_0x438522[_0x1c6e('0x15')],'app':_0x1c6e('0x2e'),'appdata':_0x1c6e('0x37'),'context':_0x438522['context'],'exten':_0x438522[_0x1c6e('0xc')],'priority':_0x3d60a5[_0x1c6e('0x26')]+_0x331e3e[_0x1c6e('0xf')]+_0x105308++,'VoiceExtensionId':_0x438522[_0x1c6e('0x17')]});_0x5bac41[_0x1c6e('0x12')]({'type':_0x438522[_0x1c6e('0x15')],'app':_0x1c6e('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x438522[_0x1c6e('0x16')],'exten':_0x438522['exten'],'priority':_0x3d60a5[_0x1c6e('0x26')]+_0x331e3e[_0x1c6e('0xf')]+_0x105308++,'VoiceExtensionId':_0x438522['VoiceExtensionId']});}}}for(var _0x7aa62b=0x0;_0x7aa62b<_0x3d60a5[_0x1c6e('0x26')];_0x7aa62b+=0x1){var _0x2aa8ab=_0x331e3e[_0x1c6e('0xf')]+_0x3d60a5[_0x1c6e('0x26')];var _0x48564d=_0x7aa62b===_0x3d60a5[_0x1c6e('0x26')]-0x1?_0x331e3e[_0x1c6e('0xf')]+_0x5bac41[_0x1c6e('0x26')]+_0x20f485[_0x1c6e('0x26')]+0x2:_0x331e3e[_0x1c6e('0xf')]+_0x7aa62b+0x1;_0x5bac41[_0x1c6e('0x38')](_0x7aa62b,0x0,{'type':_0x438522[_0x1c6e('0x15')],'app':_0x1c6e('0x39'),'appdata':_0x3d60a5[_0x7aa62b]+'?'+_0x438522[_0x1c6e('0x16')]+_0x1c6e('0x3a')+_0x2aa8ab+':'+_0x438522['context']+_0x1c6e('0x3a')+_0x48564d,'exten':_0x438522[_0x1c6e('0xc')],'context':_0x438522[_0x1c6e('0x16')],'priority':_0x331e3e[_0x1c6e('0xf')]+_0x7aa62b,'VoiceExtensionId':_0x522e78[_0x49f972][0x0][_0x1c6e('0x17')]});}_0x438522[_0x1c6e('0xf')]=_0x5bac41['length']?_['last'](_0x5bac41)[_0x1c6e('0xf')]+0x1:_0x331e3e['priority'];_0x331e3e['priority']=(_0x20f485[_0x1c6e('0x26')]?_[_0x1c6e('0x3b')](_0x20f485)[_0x1c6e('0xf')]:_0x438522[_0x1c6e('0xf')])+0x1;_0x331e3e[_0x1c6e('0x10')]=_[_0x1c6e('0x3c')](_0x331e3e[_0x1c6e('0x10')],_0x5bac41,[_0x438522],_0x20f485);}_0x331e3e[_0x1c6e('0x10')][_0x1c6e('0x12')]({'type':_0x522e78[_0x49f972][0x0]['type'],'app':_0x1c6e('0x3d'),'exten':_0x522e78[_0x49f972][0x0]['exten'],'context':_0x522e78[_0x49f972][0x0][_0x1c6e('0x16')],'priority':_0x331e3e['priority'],'VoiceExtensionId':_0x522e78[_0x49f972][0x0][_0x1c6e('0x17')]});_0x248073['push'](_0x522e78[_0x49f972][0x0]['VoiceExtensionId']);_0x2fa4e0=_[_0x1c6e('0x3c')](_0x2fa4e0,_0x331e3e[_0x1c6e('0x10')]);}}return _0xec2539['transaction'](function(_0x245581){return _0xec2539[_0x1c6e('0x2')][_0x1c6e('0x7')][_0x1c6e('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x248073}},'transaction':_0x245581})[_0x1c6e('0x5')](function(_0x50f3ee){return _0xec2539[_0x1c6e('0x2')][_0x1c6e('0x7')][_0x1c6e('0x3f')](_[_0x1c6e('0x40')](_0x2fa4e0,_0x1c6e('0xf')),{'transaction':_0x245581});});});})['catch'](function(_0x1528fe){console[_0x1c6e('0x41')](_0x1528fe);});}exports[_0x1c6e('0x42')]=rewrite; \ No newline at end of file +var _0xda29=['push','type','Set','format','CDR(type)=%s','VoiceExtensionId','inbound','extensions','CDR(routeid)=','context','outbound','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','map','filter','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','hasOwnProperty','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','queue','playback','priority','extension'];(function(_0x24d4f2,_0x53516f){var _0x2a7234=function(_0x5cb7b8){while(--_0x5cb7b8){_0x24d4f2['push'](_0x24d4f2['shift']());}};_0x2a7234(++_0x53516f);}(_0xda29,0x1d2));var _0x9da2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xda29[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x9da2('0x0'));var util=require(_0x9da2('0x1'));function rewrite(_0x5884bb,_0x5ee466){var _0x13e21e=this;return _0x5884bb[_0x9da2('0x2')][_0x9da2('0x3')][_0x9da2('0x4')]({'raw':!![]})[_0x9da2('0x5')](function(_0xc66280){_0x13e21e[_0x9da2('0x6')]=_0xc66280;return _0x5884bb[_0x9da2('0x2')]['VoiceExtension'][_0x9da2('0x4')]({'where':{'IntervalId':_0x5ee466[_0x9da2('0x7')]},'raw':!![]});})['then'](function(_0x316722){return _0x5884bb[_0x9da2('0x2')][_0x9da2('0x8')]['findAll']({'where':{'exten':{'$in':_[_0x9da2('0x9')](_['map'](_0x316722,_0x9da2('0xa')))}},'order':[{'raw':_0x9da2('0xb')}],'raw':!![]});})[_0x9da2('0x5')](function(_0x199fc1){var _0x27bdfe=_['filter'](_0x199fc1,{'priority':'1'});var _0x2e1154=_['filter'](_0x199fc1,{'isApp':0x1});var _0x1156a7=_[_0x9da2('0xc')](_0x2e1154,_0x9da2('0xa'));var _0x8ca29c=[_0x9da2('0xd'),_0x9da2('0xe')];var _0x1e597f=[];var _0x9f5c1c=[];for(var _0x58994f in _0x1156a7){if(_0x1156a7['hasOwnProperty'](_0x58994f)){_0x13e21e[_0x9da2('0xf')]=0x2;_0x13e21e['extensions']=[];_0x13e21e[_0x9da2('0x10')]=_['find'](_0x27bdfe,{'exten':_0x1156a7[_0x58994f][0x0][_0x9da2('0xa')]});_0x13e21e['extensions'][_0x9da2('0x11')]({'type':_0x1156a7[_0x58994f][0x0][_0x9da2('0x12')],'app':_0x9da2('0x13'),'appdata':util[_0x9da2('0x14')](_0x9da2('0x15'),_0x1156a7[_0x58994f][0x0]['type']),'context':_0x1156a7[_0x58994f][0x0]['context'],'exten':_0x1156a7[_0x58994f][0x0]['exten'],'priority':_0x13e21e[_0x9da2('0xf')]++,'VoiceExtensionId':_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')]});if(_0x1156a7[_0x58994f][0x0][_0x9da2('0x12')]===_0x9da2('0x17')){_0x13e21e[_0x9da2('0x18')][_0x9da2('0x11')]({'type':_0x1156a7[_0x58994f][0x0][_0x9da2('0x12')],'app':'Set','appdata':_0x9da2('0x19')+_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')],'context':_0x1156a7[_0x58994f][0x0][_0x9da2('0x1a')],'exten':_0x1156a7[_0x58994f][0x0][_0x9da2('0xa')],'priority':_0x13e21e[_0x9da2('0xf')]++,'VoiceExtensionId':_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')]});}else if(_0x1156a7[_0x58994f][0x0][_0x9da2('0x12')]===_0x9da2('0x1b')){if(_0x13e21e[_0x9da2('0x10')]){_0x13e21e[_0x9da2('0x18')][_0x9da2('0x11')]({'type':_0x1156a7[_0x58994f][0x0][_0x9da2('0x12')],'app':_0x9da2('0x13'),'appdata':'CDR(destination)='+(_0x13e21e[_0x9da2('0x10')][_0x9da2('0x1c')]?'${EXTEN:'+_0x13e21e['extension'][_0x9da2('0x1c')]+'}':'${EXTEN}'),'context':_0x1156a7[_0x58994f][0x0][_0x9da2('0x1a')],'exten':_0x1156a7[_0x58994f][0x0]['exten'],'priority':_0x13e21e['priority']++,'VoiceExtensionId':_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')]});}_0x13e21e[_0x9da2('0x18')][_0x9da2('0x11')]({'type':_0x1156a7[_0x58994f][0x0][_0x9da2('0x12')],'app':'Set','appdata':_0x9da2('0x19')+_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')],'context':_0x1156a7[_0x58994f][0x0]['context'],'exten':_0x1156a7[_0x58994f][0x0]['exten'],'priority':_0x13e21e[_0x9da2('0xf')]++,'VoiceExtensionId':_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')]});var _0x431a72=_0x13e21e[_0x9da2('0xf')]++;_0x13e21e[_0x9da2('0x18')][_0x9da2('0x11')]({'type':_0x1156a7[_0x58994f][0x0][_0x9da2('0x12')],'app':_0x9da2('0x1d'),'appdata':_0x9da2('0x1e')+(_0x431a72+0x2)+'):Goto('+(_0x431a72+0x1)+')','context':_0x1156a7[_0x58994f][0x0][_0x9da2('0x1a')],'exten':_0x1156a7[_0x58994f][0x0][_0x9da2('0xa')],'priority':_0x431a72,'VoiceExtensionId':_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')]});if(_0x13e21e['extension']){_0x13e21e[_0x9da2('0x18')][_0x9da2('0x11')]({'type':_0x1156a7[_0x58994f][0x0][_0x9da2('0x12')],'app':_0x9da2('0x13'),'appdata':_0x13e21e[_0x9da2('0x10')]['cutdigits']?_0x9da2('0x1f')+_0x13e21e[_0x9da2('0x10')][_0x9da2('0x1c')]+'}':_0x9da2('0x20'),'context':_0x1156a7[_0x58994f][0x0]['context'],'exten':_0x1156a7[_0x58994f][0x0][_0x9da2('0xa')],'priority':_0x13e21e[_0x9da2('0xf')]++,'VoiceExtensionId':_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')]});}_0x13e21e[_0x9da2('0x18')][_0x9da2('0x11')]({'type':_0x1156a7[_0x58994f][0x0][_0x9da2('0x12')],'app':_0x9da2('0x13'),'appdata':'outboundrouteid='+_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')],'context':_0x1156a7[_0x58994f][0x0]['context'],'exten':_0x1156a7[_0x58994f][0x0]['exten'],'priority':_0x13e21e[_0x9da2('0xf')]++,'VoiceExtensionId':_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')]});if(_0x13e21e[_0x9da2('0x10')]&&_0x13e21e[_0x9da2('0x10')]['hasOwnProperty'](_0x9da2('0x21'))&&_0x13e21e[_0x9da2('0x10')]['recordingFormat']!==_0x9da2('0x22')){_0x13e21e[_0x9da2('0x18')][_0x9da2('0x11')]({'type':_0x1156a7[_0x58994f][0x0]['type'],'app':_0x9da2('0x13'),'appdata':_0x9da2('0x23'),'context':_0x1156a7[_0x58994f][0x0][_0x9da2('0x1a')],'exten':_0x1156a7[_0x58994f][0x0][_0x9da2('0xa')],'priority':_0x13e21e['priority']++,'VoiceExtensionId':_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')]});_0x13e21e['extensions'][_0x9da2('0x11')]({'type':_0x1156a7[_0x58994f][0x0][_0x9da2('0x12')],'app':_0x9da2('0x13'),'appdata':_0x9da2('0x24')+_0x13e21e[_0x9da2('0x10')]['recordingFormat']||_0x9da2('0x25'),'context':_0x1156a7[_0x58994f][0x0][_0x9da2('0x1a')],'exten':_0x1156a7[_0x58994f][0x0]['exten'],'priority':_0x13e21e[_0x9da2('0xf')]++,'VoiceExtensionId':_0x1156a7[_0x58994f][0x0]['VoiceExtensionId']});}}_0x13e21e['extensions'][_0x9da2('0x11')]({'type':_0x1156a7[_0x58994f][0x0][_0x9da2('0x12')],'app':_0x9da2('0x13'),'appdata':_0x9da2('0x26'),'context':_0x1156a7[_0x58994f][0x0]['context'],'exten':_0x1156a7[_0x58994f][0x0][_0x9da2('0xa')],'priority':_0x13e21e[_0x9da2('0xf')]++,'VoiceExtensionId':_0x1156a7[_0x58994f][0x0]['VoiceExtensionId']});_0x13e21e['extensions'][_0x9da2('0x11')]({'type':_0x1156a7[_0x58994f][0x0][_0x9da2('0x12')],'app':'Set','appdata':_0x9da2('0x27'),'context':_0x1156a7[_0x58994f][0x0]['context'],'exten':_0x1156a7[_0x58994f][0x0][_0x9da2('0xa')],'priority':_0x13e21e[_0x9da2('0xf')]++,'VoiceExtensionId':_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')]});_0x13e21e[_0x9da2('0x18')][_0x9da2('0x11')]({'type':_0x1156a7[_0x58994f][0x0]['type'],'app':_0x9da2('0x13'),'appdata':_0x9da2('0x28'),'context':_0x1156a7[_0x58994f][0x0][_0x9da2('0x1a')],'exten':_0x1156a7[_0x58994f][0x0]['exten'],'priority':_0x13e21e[_0x9da2('0xf')]++,'VoiceExtensionId':_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')]});for(var _0x40f86f=0x0,_0x43eb95=0x0;_0x40f86f<_0x1156a7[_0x58994f][_0x9da2('0x29')];_0x40f86f+=0x1,_0x43eb95=0x0){var _0x2cb2c1=_0x1156a7[_0x58994f][_0x40f86f];if(_0x2cb2c1[_0x9da2('0x12')]){_0x2cb2c1[_0x9da2('0x12')]=_0x2cb2c1['type'][_0x9da2('0x2a')]();}var _0x206b0e=[];var _0x3586d1=[];delete _0x2cb2c1['id'];delete _0x2cb2c1[_0x9da2('0x2b')];delete _0x2cb2c1['updatedAt'];var _0x5337ca=_0x2cb2c1[_0x9da2('0x2c')]!=='*,*,*,*'?[_0x2cb2c1[_0x9da2('0x2c')]]:_0x2cb2c1[_0x9da2('0x7')]?_[_0x9da2('0x2d')](_[_0x9da2('0x2e')](_0x13e21e[_0x9da2('0x6')],{'IntervalId':_0x2cb2c1[_0x9da2('0x7')]}),_0x9da2('0x2c')):[];if(_0x2cb2c1['hasOwnProperty'](_0x9da2('0x2f'))){if(_0x2cb2c1[_0x9da2('0x2f')]&&_0x2cb2c1['tag']!=='--'){_0x206b0e[_0x9da2('0x11')]({'type':_0x2cb2c1['type'],'app':_0x9da2('0x13'),'appdata':_0x9da2('0x30')+_0x2cb2c1[_0x9da2('0x2f')],'context':_0x2cb2c1[_0x9da2('0x1a')],'exten':_0x2cb2c1['exten'],'priority':_0x5337ca[_0x9da2('0x29')]+_0x13e21e['priority']+_0x43eb95++,'VoiceExtensionId':_0x2cb2c1[_0x9da2('0x16')]});}}if(_0x2cb2c1[_0x9da2('0x12')]===_0x9da2('0x1b')&&_0x2cb2c1['hasOwnProperty'](_0x9da2('0x31'))){if(_0x2cb2c1['callerID']){_0x206b0e['push']({'type':_0x2cb2c1[_0x9da2('0x12')],'app':_0x9da2('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2cb2c1[_0x9da2('0x31')]+')','context':_0x2cb2c1['context'],'exten':_0x2cb2c1[_0x9da2('0xa')],'priority':_0x5337ca[_0x9da2('0x29')]+_0x13e21e[_0x9da2('0xf')]+_0x43eb95++,'VoiceExtensionId':_0x2cb2c1['VoiceExtensionId']});}else{_0x206b0e['push']({'type':_0x2cb2c1[_0x9da2('0x12')],'app':_0x9da2('0x1d'),'appdata':_0x9da2('0x32'),'context':_0x2cb2c1[_0x9da2('0x1a')],'exten':_0x2cb2c1['exten'],'priority':_0x5337ca[_0x9da2('0x29')]+_0x13e21e[_0x9da2('0xf')]+_0x43eb95++,'VoiceExtensionId':_0x2cb2c1[_0x9da2('0x16')]});}}if(_0x2cb2c1[_0x9da2('0x33')](_0x9da2('0x34'))){if(_0x8ca29c[_0x9da2('0x35')](_0x2cb2c1[_0x9da2('0x36')][_0x9da2('0x2a')]())>=0x0&&_0x2cb2c1[_0x9da2('0x37')]!==_0x9da2('0x38')){if(_0x2cb2c1[_0x9da2('0x34')]){_0x206b0e[_0x9da2('0x11')]({'type':_0x2cb2c1[_0x9da2('0x12')],'app':_0x9da2('0x1d'),'appdata':_0x9da2('0x39'),'context':_0x2cb2c1[_0x9da2('0x1a')],'exten':_0x2cb2c1[_0x9da2('0xa')],'priority':_0x5337ca[_0x9da2('0x29')]+_0x13e21e[_0x9da2('0xf')]+_0x43eb95++,'VoiceExtensionId':_0x2cb2c1[_0x9da2('0x16')]});_0x206b0e['push']({'type':_0x2cb2c1[_0x9da2('0x12')],'app':_0x9da2('0x13'),'appdata':_0x9da2('0x3a'),'context':_0x2cb2c1[_0x9da2('0x1a')],'exten':_0x2cb2c1[_0x9da2('0xa')],'priority':_0x5337ca[_0x9da2('0x29')]+_0x13e21e[_0x9da2('0xf')]+_0x43eb95++,'VoiceExtensionId':_0x2cb2c1[_0x9da2('0x16')]});}else{_0x206b0e[_0x9da2('0x11')]({'type':_0x2cb2c1[_0x9da2('0x12')],'app':_0x9da2('0x1d'),'appdata':_0x9da2('0x3b'),'context':_0x2cb2c1[_0x9da2('0x1a')],'exten':_0x2cb2c1[_0x9da2('0xa')],'priority':_0x5337ca['length']+_0x13e21e[_0x9da2('0xf')]+_0x43eb95++,'VoiceExtensionId':_0x2cb2c1['VoiceExtensionId']});_0x206b0e[_0x9da2('0x11')]({'type':_0x2cb2c1[_0x9da2('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x2cb2c1[_0x9da2('0x1a')],'exten':_0x2cb2c1[_0x9da2('0xa')],'priority':_0x5337ca[_0x9da2('0x29')]+_0x13e21e[_0x9da2('0xf')]+_0x43eb95++,'VoiceExtensionId':_0x2cb2c1[_0x9da2('0x16')]});}}}for(var _0x4460a5=0x0;_0x4460a5<_0x5337ca['length'];_0x4460a5+=0x1){var _0x589037=_0x13e21e[_0x9da2('0xf')]+_0x5337ca[_0x9da2('0x29')];var _0x4b6fba=_0x4460a5===_0x5337ca['length']-0x1?_0x13e21e['priority']+_0x206b0e['length']+_0x3586d1[_0x9da2('0x29')]+0x2:_0x13e21e[_0x9da2('0xf')]+_0x4460a5+0x1;_0x206b0e[_0x9da2('0x3c')](_0x4460a5,0x0,{'type':_0x2cb2c1[_0x9da2('0x12')],'app':_0x9da2('0x3d'),'appdata':_0x5337ca[_0x4460a5]+'?'+_0x2cb2c1[_0x9da2('0x1a')]+_0x9da2('0x3e')+_0x589037+':'+_0x2cb2c1['context']+_0x9da2('0x3e')+_0x4b6fba,'exten':_0x2cb2c1['exten'],'context':_0x2cb2c1[_0x9da2('0x1a')],'priority':_0x13e21e[_0x9da2('0xf')]+_0x4460a5,'VoiceExtensionId':_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')]});}_0x2cb2c1[_0x9da2('0xf')]=_0x206b0e[_0x9da2('0x29')]?_['last'](_0x206b0e)[_0x9da2('0xf')]+0x1:_0x13e21e['priority'];_0x13e21e[_0x9da2('0xf')]=(_0x3586d1[_0x9da2('0x29')]?_[_0x9da2('0x3f')](_0x3586d1)[_0x9da2('0xf')]:_0x2cb2c1[_0x9da2('0xf')])+0x1;_0x13e21e['extensions']=_[_0x9da2('0x40')](_0x13e21e[_0x9da2('0x18')],_0x206b0e,[_0x2cb2c1],_0x3586d1);}_0x13e21e[_0x9da2('0x18')]['push']({'type':_0x1156a7[_0x58994f][0x0][_0x9da2('0x12')],'app':'Hangup','exten':_0x1156a7[_0x58994f][0x0][_0x9da2('0xa')],'context':_0x1156a7[_0x58994f][0x0]['context'],'priority':_0x13e21e['priority'],'VoiceExtensionId':_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')]});_0x1e597f[_0x9da2('0x11')](_0x1156a7[_0x58994f][0x0][_0x9da2('0x16')]);_0x9f5c1c=_[_0x9da2('0x40')](_0x9f5c1c,_0x13e21e['extensions']);}}return _0x5884bb['transaction'](function(_0x1dce13){return _0x5884bb[_0x9da2('0x2')][_0x9da2('0x8')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x1e597f}},'transaction':_0x1dce13})[_0x9da2('0x5')](function(_0x1fc5cc){return _0x5884bb[_0x9da2('0x2')][_0x9da2('0x8')][_0x9da2('0x41')](_[_0x9da2('0x42')](_0x9f5c1c,'priority'),{'transaction':_0x1dce13});});});})[_0x9da2('0x43')](function(_0xb41b82){console['error'](_0xb41b82);});}exports[_0x9da2('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 9fdc931..91171c1 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 _0x21f2=['always','sequelize','query','VoiceQueueId','onlyIfOpen','all','findAll','BlackLists','Campaign','CmList','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','stringify','finally','contact:csv_','resume','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','bluebird','squel','papaparse','ioredis','../../../mysqldb','api','redis','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','join','hasOwnProperty','data','phone','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','checkHopper','inspect','insert','into','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','cm_contacts','toString','where','cm_hopper','\x20=\x20?','deletedAt\x20IS\x20NULL','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','from','ListId\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','Lists','get'];(function(_0x3d922b,_0x1d5979){var _0x44638b=function(_0x537248){while(--_0x537248){_0x3d922b['push'](_0x3d922b['shift']());}};_0x44638b(++_0x1d5979);}(_0x21f2,0x84));var _0x221f=function(_0x34889d,_0x2eada8){_0x34889d=_0x34889d-0x0;var _0x187e7c=_0x21f2[_0x34889d];return _0x187e7c;};'use strict';var BPromise=require(_0x221f('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x221f('0x1'));var Papa=require(_0x221f('0x2'));var Redis=require(_0x221f('0x3'));var db=require(_0x221f('0x4'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x221f('0x5'));config['redis']=_['defaults'](config[_0x221f('0x6')],{'host':_0x221f('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x221f('0x8'))['register'](socket);try{if(!process[_0x221f('0x9')][0x2]||process[_0x221f('0x9')][0x2]===_0x221f('0xa')||process[_0x221f('0x9')][0x2]===_0x221f('0xb')){throw new Error(_0x221f('0xc'));}var FILEPATH=process[_0x221f('0x9')][0x2];if(!process[_0x221f('0x9')][0x3]||process[_0x221f('0x9')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process[_0x221f('0x9')][0x4]||process['argv'][0x4]===_0x221f('0xa')||process[_0x221f('0x9')][0x4]===_0x221f('0xb')){throw new Error(_0x221f('0xd'));}var FIELDS=_[_0x221f('0xe')](process['argv'][0x3]['split'](','),process[_0x221f('0x9')][0x4][_0x221f('0xf')](','));if(!process[_0x221f('0x9')][0x5]||process['argv'][0x5]==='undefined'||process['argv'][0x5]===_0x221f('0xb')){throw new Error(_0x221f('0x10'));}var LISTID=process[_0x221f('0x9')][0x5];var COMPANYID=process[_0x221f('0x9')][0x6]&&process[_0x221f('0x9')][0x6]!==_0x221f('0xa')&&process[_0x221f('0x9')][0x6]!==_0x221f('0xb')?process[_0x221f('0x9')][0x6]:null;var DUPLICATES=process[_0x221f('0x9')][0x7]&&process['argv'][0x7]!==_0x221f('0xa')&&process[_0x221f('0x9')][0x7]!==_0x221f('0xb')?process[_0x221f('0x9')][0x7]:null;if(!process[_0x221f('0x9')][0x8]||process['argv'][0x8]===_0x221f('0xa')||process[_0x221f('0x9')][0x8]===_0x221f('0xb')){throw new Error(_0x221f('0x11'));}var SOCKET_TIMESTAMP=process[_0x221f('0x9')][0x8];}catch(_0xdac1c3){logger[_0x221f('0x12')](_0xdac1c3);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(_0x41e8d2,_0x53faba,_0x20ed0c,_0x3a50df){var _0x1c5c1c={'message':_0x53faba};_0x1c5c1c[_0x41e8d2]=!![];if(_0x20ed0c){_0x1c5c1c[_0x221f('0x13')]=_0x20ed0c;}if(_0x3a50df){_0x1c5c1c[_0x221f('0x14')]=_0x3a50df;}return _0x1c5c1c;}function isEmail(_0x40d014){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'](_0x40d014);}function checkRow(_0x2d4192,_0x3611a5,_0x2e57cb){return new BPromise(function(_0x2e1170,_0x4363c7){if(_[_0x221f('0x15')](_0x2d4192)){return _0x4363c7(handleCheckRowError(_0x221f('0x12'),_0x221f('0x16'),null,_0x2e57cb));}if(_0x2d4192['errors']&&_0x2d4192['errors'][_0x221f('0x17')]){var _0x5a54f0=_['map'](_0x2d4192['errors'],'message')[_0x221f('0x18')](';');return _0x4363c7(handleCheckRowError(_0x221f('0x12'),_0x5a54f0,null,_0x2e57cb));}var _0x37d296={};for(var _0x1190d7 in FIELDS){if(FIELDS[_0x221f('0x19')](_0x1190d7)&&FIELDS[_0x1190d7]){_0x37d296[_0x1190d7]=_0x2d4192[_0x221f('0x1a')][0x0][FIELDS[_0x1190d7]]||_0x2d4192[_0x221f('0x1a')][0x0]['\ufeff'+FIELDS[_0x1190d7]];}}if(!_0x37d296['firstName']){return _0x4363c7(handleCheckRowError(_0x221f('0x12'),'firstName\x20not\x20specified!',null,_0x2e57cb));}if(!_0x37d296[_0x221f('0x1b')]){return _0x4363c7(handleCheckRowError(_0x221f('0x12'),'phone\x20not\x20specified!',null,_0x2e57cb));}if(_0x37d296[_0x221f('0x1c')]){var _0x21ee87=moment(_0x37d296['birthDate'],_0x221f('0x1d'));if(!_0x21ee87[_0x221f('0x1e')]()){return _0x4363c7(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x2e57cb));}}if(_0x37d296[_0x221f('0x1f')]){if(!isEmail(_0x37d296[_0x221f('0x1f')])){return _0x4363c7(handleCheckRowError('error',_0x221f('0x20'),null,_0x2e57cb));}}_0x37d296[_0x221f('0x21')]=LISTID;_0x37d296[_0x221f('0x22')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x221f('0x17')]&&_0x3611a5){var _0x176668={};for(var _0x1a7b39=0x0,_0xd9d739=DUPLICATES[_0x221f('0x17')];_0x1a7b39<_0xd9d739;_0x1a7b39+=0x1){_0x176668[DUPLICATES[_0x1a7b39]]=_0x37d296[DUPLICATES[_0x1a7b39]];}var _0x17306f=_[_0x221f('0x23')](_0x3611a5,_0x176668);if(_0x17306f){return _0x4363c7(handleCheckRowError('duplicate',_0x221f('0x24'),_0x17306f,_0x2e57cb));}}return db[_0x221f('0x25')][_0x221f('0x26')](_0x37d296,{'raw':!![],'hooks':![],'fields':_['keys'](_0x37d296)})[_0x221f('0x27')](function(_0xb8e376){if(DUPLICATES&&DUPLICATES['length']&&_0x3611a5){_0x3611a5[_0x221f('0x28')](_[_0x221f('0x29')](_0x37d296,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xb8e376['id'];return _0x2e1170();})[_0x221f('0x2a')](function(_0x5ef03c){return _0x4363c7(handleCheckRowError(_0x221f('0x12'),_0x221f('0x2b')+(_0x5ef03c[_0x221f('0x2c')]||JSON['stringify'](_0x5ef03c)),null,_0x2e57cb));});});}function checkHopper(){function _0x3a3ce9(){return function(_0x376b65){logger[_0x221f('0x12')]('cmContact',_0x221f('0x2d'),util[_0x221f('0x2e')](_0x376b65,{'showHidden':![],'depth':null}));};}var _0x41a863=function(_0x1c8ebf,_0x31fe01){var _0xd0455b=squel[_0x221f('0x2f')]()[_0x221f('0x30')]('cm_hopper')[_0x221f('0x31')]([_0x221f('0x1b'),_0x221f('0x32'),_0x221f('0x33'),_0x221f('0x21'),_0x31fe01,_0x221f('0x34'),_0x221f('0x35')],squel[_0x221f('0x36')]()[_0x221f('0x37')](_0x221f('0x1b'),_0x221f('0x1b'))['field']('NOW()',_0x221f('0x32'))['field']('id',_0x221f('0x33'))[_0x221f('0x37')](LISTID['toString'](),'ListId')[_0x221f('0x37')](_0x1c8ebf['id']['toString'](),_0x31fe01)[_0x221f('0x37')](_0x221f('0x38'),'createdAt')['field'](_0x221f('0x38'),_0x221f('0x35'))['from'](_0x221f('0x39'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x221f('0x3a')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x221f('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x221f('0x36')]()['field'](_0x221f('0x1b'))['from'](_0x221f('0x3c'))[_0x221f('0x3b')](_0x31fe01+_0x221f('0x3d'),_0x1c8ebf['id'][_0x221f('0x3a')]())))['toString']();return _0xd0455b;};var _0x29847c=function(_0x17bfad,_0x5e7087){var _0x47efe9=squel[_0x221f('0x2f')]()['into'](_0x221f('0x3c'))[_0x221f('0x31')]([_0x221f('0x1b'),_0x221f('0x32'),_0x221f('0x33'),'ListId',_0x5e7087,'createdAt',_0x221f('0x35')],squel[_0x221f('0x36')]()[_0x221f('0x37')](_0x221f('0x1b'),_0x221f('0x1b'))['field']('NOW()',_0x221f('0x32'))[_0x221f('0x37')]('id','ContactId')[_0x221f('0x37')](LISTID[_0x221f('0x3a')](),_0x221f('0x21'))['field'](_0x17bfad['id'][_0x221f('0x3a')](),_0x5e7087)['field'](_0x221f('0x38'),_0x221f('0x34'))[_0x221f('0x37')](_0x221f('0x38'),'updatedAt')['from'](_0x221f('0x39'))[_0x221f('0x3b')](_0x221f('0x3e'))[_0x221f('0x3b')]('ListId\x20=\x20?',LISTID[_0x221f('0x3a')]())[_0x221f('0x3b')]('id\x20IN\x20?',squel[_0x221f('0x3f')](hopperContacts))[_0x221f('0x3b')](_0x221f('0x40'))[_0x221f('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x221f('0x36')]()[_0x221f('0x37')](_0x221f('0x41'))['from'](_0x221f('0x42'))[_0x221f('0x3b')](_0x5e7087+_0x221f('0x3d'),_0x17bfad['id']['toString']()))[_0x221f('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x221f('0x36')]()[_0x221f('0x37')](_0x221f('0x1b'))[_0x221f('0x43')]('cm_hopper')[_0x221f('0x3b')](_0x5e7087+_0x221f('0x3d'),_0x17bfad['id']['toString']())))[_0x221f('0x3a')]();return _0x47efe9;};function _0x1adda4(_0x1072fc,_0x83889e){var _0x34c7af=squel[_0x221f('0x2f')]()['into']('cm_hopper')[_0x221f('0x31')](['phone','scheduledAt','ContactId',_0x221f('0x21'),_0x83889e,_0x221f('0x34'),'updatedAt'],squel[_0x221f('0x36')]()['field'](_0x221f('0x1b'),'phone')[_0x221f('0x37')](_0x221f('0x38'),'scheduledAt')[_0x221f('0x37')]('id',_0x221f('0x33'))[_0x221f('0x37')](LISTID[_0x221f('0x3a')](),_0x221f('0x21'))[_0x221f('0x37')](_0x1072fc['id'][_0x221f('0x3a')](),_0x83889e)[_0x221f('0x37')](_0x221f('0x38'),_0x221f('0x34'))[_0x221f('0x37')](_0x221f('0x38'),_0x221f('0x35'))[_0x221f('0x43')](_0x221f('0x39'))[_0x221f('0x3b')](_0x221f('0x3e'))[_0x221f('0x3b')](_0x221f('0x44'),LISTID[_0x221f('0x3a')]())['where'](_0x221f('0x45'),squel[_0x221f('0x3f')](hopperContacts))[_0x221f('0x3b')](_0x221f('0x40')))['toString']();return _0x34c7af;}function _0xe7663b(_0x3d4713,_0x3b805d){var _0x2c9002=squel[_0x221f('0x2f')]()['into'](_0x221f('0x46'))[_0x221f('0x31')]([_0x221f('0x1b'),_0x221f('0x33'),_0x221f('0x21'),_0x3b805d,_0x221f('0x34'),_0x221f('0x35')],squel[_0x221f('0x36')]()[_0x221f('0x37')](_0x221f('0x1b'),_0x221f('0x1b'))['field']('id',_0x221f('0x33'))['field'](LISTID['toString'](),_0x221f('0x21'))['field'](_0x3d4713['id']['toString'](),_0x3b805d)[_0x221f('0x37')]('NOW()',_0x221f('0x34'))[_0x221f('0x37')](_0x221f('0x38'),_0x221f('0x35'))['from'](_0x221f('0x39'))[_0x221f('0x3b')](_0x221f('0x3e'))['where'](_0x221f('0x44'),LISTID[_0x221f('0x3a')]())[_0x221f('0x3b')](_0x221f('0x45'),squel[_0x221f('0x3f')](hopperContacts))[_0x221f('0x3b')](_0x221f('0x40')))['toString']();return _0x2c9002;}return db[_0x221f('0x47')]['findAll']({'where':{'type':_0x221f('0x48')},'attributes':['id',_0x221f('0x49')],'include':[{'model':db['CmList'],'as':_0x221f('0x4a'),'where':{'id':LISTID}}]})[_0x221f('0x27')](function(_0x140300){var _0x4c853f=[];if(_0x140300){var _0x183767;for(var _0x113ce2=0x0,_0x66c33;_0x113ce2<_0x140300[_0x221f('0x17')];_0x113ce2+=0x1){_0x66c33=_0x140300[_0x113ce2][_0x221f('0x4b')]({'plain':!![]});switch(_0x66c33[_0x221f('0x49')]){case _0x221f('0x4c'):_0x4c853f[_0x221f('0x28')](db[_0x221f('0x4d')][_0x221f('0x4e')](_0x29847c(_0x66c33,_0x221f('0x4f')))['then'](function(){})['catch'](_0x3a3ce9()));break;case _0x221f('0x50'):_0x4c853f[_0x221f('0x28')](db[_0x221f('0x4d')][_0x221f('0x4e')](_0x41a863(_0x66c33,_0x221f('0x4f')))[_0x221f('0x27')](function(){})[_0x221f('0x2a')](_0x3a3ce9()));break;default:_0x4c853f[_0x221f('0x28')](db['sequelize']['query'](_0x1adda4(_0x66c33,'VoiceQueueId'))['then'](function(){})[_0x221f('0x2a')](_0x3a3ce9()));}}}return _0x4c853f;})[_0x221f('0x51')]()[_0x221f('0x27')](function(){return db[_0x221f('0x47')][_0x221f('0x52')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x221f('0x53'),'where':{'id':LISTID}}]})['then'](function(_0x30d6d6){var _0x51544a=[];if(_0x30d6d6){var _0x10f7b0;for(var _0x57740b=0x0,_0xbc8e8;_0x57740b<_0x30d6d6[_0x221f('0x17')];_0x57740b+=0x1){_0xbc8e8=_0x30d6d6[_0x57740b][_0x221f('0x4b')]({'plain':!![]});_0x51544a['push'](db[_0x221f('0x4d')][_0x221f('0x4e')](_0xe7663b(_0xbc8e8,_0x221f('0x4f')))['then'](function(){})[_0x221f('0x2a')](_0x3a3ce9()));}}return _0x51544a;})[_0x221f('0x51')]();})[_0x221f('0x27')](function(){return db[_0x221f('0x54')][_0x221f('0x52')]({'attributes':['id',_0x221f('0x49')],'include':[{'model':db[_0x221f('0x55')],'as':_0x221f('0x4a'),'where':{'id':LISTID}}]})[_0x221f('0x27')](function(_0x24a907){var _0x210ad9=[];if(_0x24a907){for(var _0x31a42a=0x0,_0x15465e;_0x31a42a<_0x24a907[_0x221f('0x17')];_0x31a42a+=0x1){_0x15465e=_0x24a907[_0x31a42a][_0x221f('0x4b')]({'plain':!![]});switch(_0x15465e[_0x221f('0x49')]){case _0x221f('0x4c'):_0x210ad9[_0x221f('0x28')](db[_0x221f('0x4d')][_0x221f('0x4e')](_0x29847c(_0x15465e,'CampaignId'))[_0x221f('0x27')](function(){})[_0x221f('0x2a')](_0x3a3ce9()));break;case _0x221f('0x50'):_0x210ad9[_0x221f('0x28')](db[_0x221f('0x4d')][_0x221f('0x4e')](_0x41a863(_0x15465e,'CampaignId'))[_0x221f('0x27')](function(){})[_0x221f('0x2a')](_0x3a3ce9()));break;default:_0x210ad9[_0x221f('0x28')](db[_0x221f('0x4d')][_0x221f('0x4e')](_0x1adda4(_0x15465e,_0x221f('0x56')))[_0x221f('0x27')](function(){})[_0x221f('0x2a')](_0x3a3ce9()));}}}return _0x210ad9;})[_0x221f('0x51')]();})[_0x221f('0x27')](function(){return db[_0x221f('0x54')][_0x221f('0x52')]({'attributes':['id'],'include':[{'model':db[_0x221f('0x55')],'as':_0x221f('0x53'),'where':{'id':LISTID}}]})[_0x221f('0x27')](function(_0x2bba66){var _0x21208e=[];if(_0x2bba66){for(var _0x5166b3=0x0,_0x16b9d2;_0x5166b3<_0x2bba66[_0x221f('0x17')];_0x5166b3+=0x1){_0x16b9d2=_0x2bba66[_0x5166b3][_0x221f('0x4b')]({'plain':!![]});_0x21208e[_0x221f('0x28')](db[_0x221f('0x4d')][_0x221f('0x4e')](_0xe7663b(_0x16b9d2,_0x221f('0x56')))[_0x221f('0x27')](function(){})[_0x221f('0x2a')](_0x3a3ce9()));}}return _0x21208e;})['all']();})[_0x221f('0x2a')](function(_0x232ba0){logger[_0x221f('0x12')](_0x221f('0x57'),_0x221f('0x58'),_0x232ba0['message']);});}var processPromises=function(_0x3e3860){return BPromise['all'](promises)['then'](function(_0x238904){})[_0x221f('0x2a')](function(_0x5eda63){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0x221f('0x59')](_0x5eda63));})[_0x221f('0x5a')](function(){socket['emit'](_0x221f('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3e3860){return _0x3e3860[_0x221f('0x5c')]();}});};var endCsv=function(){return BPromise[_0x221f('0x5d')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x221f('0x27')](function(){socket[_0x221f('0x5e')](_0x221f('0x5b')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x256a52){logger['error'](_0x221f('0x5f'),JSON[_0x221f('0x59')](_0x256a52));}finally{process[_0x221f('0x60')](0x0);}});};process['on'](_0x221f('0x61'),function(){logger[_0x221f('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x221f('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x221f('0xf')](',');return db[_0x221f('0x25')][_0x221f('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x221f('0x27')](function(_0x5a48e){var _0x18fc3d=fs[_0x221f('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x221f('0x64')](_0x18fc3d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2a3523,_0x52ce96){total+=0x1;var _0x1f49f1=total;promises['push'](checkRow(_0x2a3523,_0x5a48e,_0x1f49f1)['then'](function(){success+=0x1;})[_0x221f('0x2a')](function(_0x46f081){if(_0x46f081[_0x221f('0x12')]){errors+=0x1;delete _0x46f081['error'];}else if(_0x46f081[_0x221f('0x65')]){duplicates+=0x1;delete _0x46f081['duplicate'];}rows['push'](_0x46f081);}));if(total%0xc8===0x0){_0x52ce96[_0x221f('0x66')]();return processPromises(_0x52ce96);}},'complete':function(){return processPromises()['then'](function(){logger[_0x221f('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x3c5cf7,_0x4e2433){logger[_0x221f('0x62')](_0x221f('0x67'),JSON[_0x221f('0x59')](_0x3c5cf7));endCsv();}});})[_0x221f('0x2a')](function(_0x2bf953){logger[_0x221f('0x12')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x221f('0x59')](_0x2bf953));});}main(); \ No newline at end of file +var _0x63bc=['Error\x20processing\x20rows\x20block:','contact:csv_','resume','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../mysqldb','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','undefined','argv','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','field','NOW()','scheduledAt','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','into','phone\x20IS\x20NOT\x20NULL','calleridnum','str','cm_hopper_black','id\x20IN\x20?','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','query','VoiceQueueId','then','sequelize','catch','outbound','BlackLists','all','Campaign','get','always','CampaignId','onlyIfOpen'];(function(_0x1ded25,_0x26be3d){var _0x8ec99f=function(_0x3017ac){while(--_0x3017ac){_0x1ded25['push'](_0x1ded25['shift']());}};_0x8ec99f(++_0x26be3d);}(_0x63bc,0x75));var _0xc63b=function(_0x546219,_0xa9c53e){_0x546219=_0x546219-0x0;var _0xd4361d=_0x63bc[_0x546219];return _0xd4361d;};'use strict';var BPromise=require(_0xc63b('0x0'));var util=require(_0xc63b('0x1'));var _=require(_0xc63b('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xc63b('0x3'));var db=require(_0xc63b('0x4'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xc63b('0x5'));config[_0xc63b('0x6')]=_[_0xc63b('0x7')](config['redis'],{'host':_0xc63b('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc63b('0x6')]));require(_0xc63b('0x9'))[_0xc63b('0xa')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xc63b('0xb')||process[_0xc63b('0xc')][0x2]===_0xc63b('0xd')){throw new Error(_0xc63b('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0xc63b('0xc')][0x3]||process['argv'][0x3]===_0xc63b('0xb')||process[_0xc63b('0xc')][0x3]===_0xc63b('0xd')||!process[_0xc63b('0xc')][0x4]||process['argv'][0x4]===_0xc63b('0xb')||process[_0xc63b('0xc')][0x4]===_0xc63b('0xd')){throw new Error(_0xc63b('0xf'));}var FIELDS=_['zipObject'](process['argv'][0x3]['split'](','),process['argv'][0x4][_0xc63b('0x10')](','));if(!process[_0xc63b('0xc')][0x5]||process[_0xc63b('0xc')][0x5]===_0xc63b('0xb')||process['argv'][0x5]===_0xc63b('0xd')){throw new Error(_0xc63b('0x11'));}var LISTID=process[_0xc63b('0xc')][0x5];var COMPANYID=process[_0xc63b('0xc')][0x6]&&process['argv'][0x6]!==_0xc63b('0xb')&&process[_0xc63b('0xc')][0x6]!=='null'?process[_0xc63b('0xc')][0x6]:null;var DUPLICATES=process[_0xc63b('0xc')][0x7]&&process['argv'][0x7]!==_0xc63b('0xb')&&process['argv'][0x7]!==_0xc63b('0xd')?process['argv'][0x7]:null;if(!process[_0xc63b('0xc')][0x8]||process[_0xc63b('0xc')][0x8]===_0xc63b('0xb')||process[_0xc63b('0xc')][0x8]===_0xc63b('0xd')){throw new Error(_0xc63b('0x12'));}var SOCKET_TIMESTAMP=process[_0xc63b('0xc')][0x8];}catch(_0x3b471c){logger[_0xc63b('0x13')](_0x3b471c);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(_0x462a13,_0x55ecb3,_0x5b7740,_0x558ef1){var _0x248fd4={'message':_0x55ecb3};_0x248fd4[_0x462a13]=!![];if(_0x5b7740){_0x248fd4['contact']=_0x5b7740;}if(_0x558ef1){_0x248fd4[_0xc63b('0x14')]=_0x558ef1;}return _0x248fd4;}function isEmail(_0x4fa9ec){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'](_0x4fa9ec);}function checkRow(_0x411d40,_0x36f7af,_0x58240d){return new BPromise(function(_0x57205c,_0x1a394a){if(_[_0xc63b('0x15')](_0x411d40)){return _0x1a394a(handleCheckRowError('error',_0xc63b('0x16'),null,_0x58240d));}if(_0x411d40[_0xc63b('0x17')]&&_0x411d40[_0xc63b('0x17')][_0xc63b('0x18')]){var _0x2f6930=_[_0xc63b('0x19')](_0x411d40['errors'],_0xc63b('0x1a'))[_0xc63b('0x1b')](';');return _0x1a394a(handleCheckRowError(_0xc63b('0x13'),_0x2f6930,null,_0x58240d));}var _0x1fb94a={};for(var _0x13eb24 in FIELDS){if(FIELDS[_0xc63b('0x1c')](_0x13eb24)&&FIELDS[_0x13eb24]){_0x1fb94a[_0x13eb24]=_0x411d40[_0xc63b('0x1d')][0x0][FIELDS[_0x13eb24]]||_0x411d40['data'][0x0]['\ufeff'+FIELDS[_0x13eb24]];}}if(!_0x1fb94a[_0xc63b('0x1e')]){return _0x1a394a(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x58240d));}if(!_0x1fb94a[_0xc63b('0x1f')]){return _0x1a394a(handleCheckRowError(_0xc63b('0x13'),_0xc63b('0x20'),null,_0x58240d));}if(_0x1fb94a[_0xc63b('0x21')]){var _0xb7c7e2=moment(_0x1fb94a[_0xc63b('0x21')],_0xc63b('0x22'));if(!_0xb7c7e2[_0xc63b('0x23')]()){return _0x1a394a(handleCheckRowError(_0xc63b('0x13'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x58240d));}}if(_0x1fb94a[_0xc63b('0x24')]){if(!isEmail(_0x1fb94a[_0xc63b('0x24')])){return _0x1a394a(handleCheckRowError('error',_0xc63b('0x25'),null,_0x58240d));}}_0x1fb94a[_0xc63b('0x26')]=LISTID;_0x1fb94a[_0xc63b('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xc63b('0x18')]&&_0x36f7af){var _0xf14631={};for(var _0x100acb=0x0,_0xacff77=DUPLICATES[_0xc63b('0x18')];_0x100acb<_0xacff77;_0x100acb+=0x1){_0xf14631[DUPLICATES[_0x100acb]]=_0x1fb94a[DUPLICATES[_0x100acb]];}var _0x26dfff=_[_0xc63b('0x28')](_0x36f7af,_0xf14631);if(_0x26dfff){return _0x1a394a(handleCheckRowError(_0xc63b('0x29'),'Duplicate\x20Contact',_0x26dfff,_0x58240d));}}return db[_0xc63b('0x2a')]['create'](_0x1fb94a,{'raw':!![],'hooks':![],'fields':_['keys'](_0x1fb94a)})['then'](function(_0x47fbc9){if(DUPLICATES&&DUPLICATES[_0xc63b('0x18')]&&_0x36f7af){_0x36f7af[_0xc63b('0x2b')](_[_0xc63b('0x2c')](_0x1fb94a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x47fbc9['id'];return _0x57205c();})['catch'](function(_0x3e13b8){return _0x1a394a(handleCheckRowError('error',_0xc63b('0x2d')+(_0x3e13b8[_0xc63b('0x1a')]||JSON[_0xc63b('0x2e')](_0x3e13b8)),null,_0x58240d));});});}function checkHopper(){function _0x33d735(){return function(_0x47cdd2){logger[_0xc63b('0x13')]('cmContact',_0xc63b('0x2f'),util[_0xc63b('0x30')](_0x47cdd2,{'showHidden':![],'depth':null}));};}var _0x1816a2=function(_0x40d59e,_0x120207){var _0x195898=squel[_0xc63b('0x31')]()['into'](_0xc63b('0x32'))[_0xc63b('0x33')](['phone','scheduledAt',_0xc63b('0x34'),_0xc63b('0x26'),_0x120207,_0xc63b('0x35'),_0xc63b('0x36')],squel['select']()[_0xc63b('0x37')](_0xc63b('0x1f'),_0xc63b('0x1f'))[_0xc63b('0x37')](_0xc63b('0x38'),_0xc63b('0x39'))[_0xc63b('0x37')]('id',_0xc63b('0x34'))['field'](LISTID[_0xc63b('0x3a')](),_0xc63b('0x26'))[_0xc63b('0x37')](_0x40d59e['id']['toString'](),_0x120207)[_0xc63b('0x37')]('NOW()',_0xc63b('0x35'))[_0xc63b('0x37')](_0xc63b('0x38'),'updatedAt')[_0xc63b('0x3b')](_0xc63b('0x3c'))[_0xc63b('0x3d')](_0xc63b('0x3e'))[_0xc63b('0x3d')](_0xc63b('0x3f'),LISTID['toString']())[_0xc63b('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0xc63b('0x3d')](_0xc63b('0x40'),squel[_0xc63b('0x41')]()[_0xc63b('0x37')]('phone')[_0xc63b('0x3b')](_0xc63b('0x32'))[_0xc63b('0x3d')](_0x120207+_0xc63b('0x42'),_0x40d59e['id']['toString']())))[_0xc63b('0x3a')]();return _0x195898;};var _0x42af18=function(_0x282d18,_0x77d5a3){var _0xc27adb=squel[_0xc63b('0x31')]()[_0xc63b('0x43')](_0xc63b('0x32'))[_0xc63b('0x33')]([_0xc63b('0x1f'),_0xc63b('0x39'),_0xc63b('0x34'),_0xc63b('0x26'),_0x77d5a3,_0xc63b('0x35'),_0xc63b('0x36')],squel[_0xc63b('0x41')]()[_0xc63b('0x37')]('phone',_0xc63b('0x1f'))['field']('NOW()',_0xc63b('0x39'))[_0xc63b('0x37')]('id','ContactId')[_0xc63b('0x37')](LISTID[_0xc63b('0x3a')](),'ListId')[_0xc63b('0x37')](_0x282d18['id'][_0xc63b('0x3a')](),_0x77d5a3)[_0xc63b('0x37')]('NOW()','createdAt')[_0xc63b('0x37')](_0xc63b('0x38'),'updatedAt')['from'](_0xc63b('0x3c'))[_0xc63b('0x3d')](_0xc63b('0x3e'))[_0xc63b('0x3d')](_0xc63b('0x3f'),LISTID[_0xc63b('0x3a')]())[_0xc63b('0x3d')]('id\x20IN\x20?',squel['str'](hopperContacts))['where'](_0xc63b('0x44'))[_0xc63b('0x3d')](_0xc63b('0x40'),squel[_0xc63b('0x41')]()['field'](_0xc63b('0x45'))[_0xc63b('0x3b')]('cm_hopper_final')[_0xc63b('0x3d')](_0x77d5a3+_0xc63b('0x42'),_0x282d18['id'][_0xc63b('0x3a')]()))[_0xc63b('0x3d')](_0xc63b('0x40'),squel[_0xc63b('0x41')]()[_0xc63b('0x37')](_0xc63b('0x1f'))[_0xc63b('0x3b')]('cm_hopper')[_0xc63b('0x3d')](_0x77d5a3+_0xc63b('0x42'),_0x282d18['id']['toString']())))['toString']();return _0xc27adb;};function _0x5beb49(_0x531ee6,_0x556c2d){var _0x1fc8c9=squel[_0xc63b('0x31')]()[_0xc63b('0x43')](_0xc63b('0x32'))[_0xc63b('0x33')]([_0xc63b('0x1f'),_0xc63b('0x39'),_0xc63b('0x34'),_0xc63b('0x26'),_0x556c2d,'createdAt',_0xc63b('0x36')],squel[_0xc63b('0x41')]()[_0xc63b('0x37')](_0xc63b('0x1f'),_0xc63b('0x1f'))[_0xc63b('0x37')](_0xc63b('0x38'),'scheduledAt')['field']('id','ContactId')[_0xc63b('0x37')](LISTID[_0xc63b('0x3a')](),_0xc63b('0x26'))[_0xc63b('0x37')](_0x531ee6['id'][_0xc63b('0x3a')](),_0x556c2d)[_0xc63b('0x37')](_0xc63b('0x38'),'createdAt')[_0xc63b('0x37')]('NOW()','updatedAt')['from'](_0xc63b('0x3c'))[_0xc63b('0x3d')](_0xc63b('0x3e'))['where'](_0xc63b('0x3f'),LISTID[_0xc63b('0x3a')]())[_0xc63b('0x3d')]('id\x20IN\x20?',squel[_0xc63b('0x46')](hopperContacts))[_0xc63b('0x3d')](_0xc63b('0x44')))[_0xc63b('0x3a')]();return _0x1fc8c9;}function _0x483426(_0x5a13ea,_0x3d8f19){var _0x49d7d4=squel[_0xc63b('0x31')]()[_0xc63b('0x43')](_0xc63b('0x47'))[_0xc63b('0x33')](['phone',_0xc63b('0x34'),_0xc63b('0x26'),_0x3d8f19,_0xc63b('0x35'),'updatedAt'],squel[_0xc63b('0x41')]()[_0xc63b('0x37')](_0xc63b('0x1f'),_0xc63b('0x1f'))[_0xc63b('0x37')]('id','ContactId')[_0xc63b('0x37')](LISTID[_0xc63b('0x3a')](),_0xc63b('0x26'))['field'](_0x5a13ea['id'][_0xc63b('0x3a')](),_0x3d8f19)[_0xc63b('0x37')](_0xc63b('0x38'),_0xc63b('0x35'))['field'](_0xc63b('0x38'),_0xc63b('0x36'))[_0xc63b('0x3b')](_0xc63b('0x3c'))[_0xc63b('0x3d')](_0xc63b('0x3e'))[_0xc63b('0x3d')](_0xc63b('0x3f'),LISTID[_0xc63b('0x3a')]())[_0xc63b('0x3d')](_0xc63b('0x48'),squel[_0xc63b('0x46')](hopperContacts))[_0xc63b('0x3d')](_0xc63b('0x44')))[_0xc63b('0x3a')]();return _0x49d7d4;}return db[_0xc63b('0x49')][_0xc63b('0x4a')]({'where':{'type':'outbound'},'attributes':['id',_0xc63b('0x4b')],'include':[{'model':db[_0xc63b('0x4c')],'as':_0xc63b('0x4d'),'where':{'id':LISTID}}]})['then'](function(_0xceb217){var _0x5958a7=[];if(_0xceb217){var _0x298923;for(var _0x927b0c=0x0,_0x2cdc05;_0x927b0c<_0xceb217[_0xc63b('0x18')];_0x927b0c+=0x1){_0x2cdc05=_0xceb217[_0x927b0c]['get']({'plain':!![]});switch(_0x2cdc05['dialCheckDuplicateType']){case'always':_0x5958a7[_0xc63b('0x2b')](db['sequelize'][_0xc63b('0x4e')](_0x42af18(_0x2cdc05,_0xc63b('0x4f')))[_0xc63b('0x50')](function(){})['catch'](_0x33d735()));break;case'onlyIfOpen':_0x5958a7[_0xc63b('0x2b')](db[_0xc63b('0x51')][_0xc63b('0x4e')](_0x1816a2(_0x2cdc05,'VoiceQueueId'))[_0xc63b('0x50')](function(){})[_0xc63b('0x52')](_0x33d735()));break;default:_0x5958a7[_0xc63b('0x2b')](db[_0xc63b('0x51')][_0xc63b('0x4e')](_0x5beb49(_0x2cdc05,_0xc63b('0x4f')))[_0xc63b('0x50')](function(){})[_0xc63b('0x52')](_0x33d735()));}}}return _0x5958a7;})['all']()[_0xc63b('0x50')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0xc63b('0x53')},'attributes':['id'],'include':[{'model':db[_0xc63b('0x4c')],'as':_0xc63b('0x54'),'where':{'id':LISTID}}]})[_0xc63b('0x50')](function(_0x332c7c){var _0x59a876=[];if(_0x332c7c){var _0x2de5e3;for(var _0x3ee473=0x0,_0x12c20d;_0x3ee473<_0x332c7c[_0xc63b('0x18')];_0x3ee473+=0x1){_0x12c20d=_0x332c7c[_0x3ee473]['get']({'plain':!![]});_0x59a876[_0xc63b('0x2b')](db[_0xc63b('0x51')][_0xc63b('0x4e')](_0x483426(_0x12c20d,'VoiceQueueId'))['then'](function(){})['catch'](_0x33d735()));}}return _0x59a876;})[_0xc63b('0x55')]();})[_0xc63b('0x50')](function(){return db[_0xc63b('0x56')][_0xc63b('0x4a')]({'attributes':['id',_0xc63b('0x4b')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xc63b('0x50')](function(_0x28a529){var _0x420329=[];if(_0x28a529){for(var _0x25ef58=0x0,_0x57b0a0;_0x25ef58<_0x28a529[_0xc63b('0x18')];_0x25ef58+=0x1){_0x57b0a0=_0x28a529[_0x25ef58][_0xc63b('0x57')]({'plain':!![]});switch(_0x57b0a0['dialCheckDuplicateType']){case _0xc63b('0x58'):_0x420329['push'](db[_0xc63b('0x51')][_0xc63b('0x4e')](_0x42af18(_0x57b0a0,_0xc63b('0x59')))[_0xc63b('0x50')](function(){})[_0xc63b('0x52')](_0x33d735()));break;case _0xc63b('0x5a'):_0x420329['push'](db[_0xc63b('0x51')]['query'](_0x1816a2(_0x57b0a0,_0xc63b('0x59')))['then'](function(){})[_0xc63b('0x52')](_0x33d735()));break;default:_0x420329[_0xc63b('0x2b')](db[_0xc63b('0x51')][_0xc63b('0x4e')](_0x5beb49(_0x57b0a0,_0xc63b('0x59')))['then'](function(){})[_0xc63b('0x52')](_0x33d735()));}}}return _0x420329;})[_0xc63b('0x55')]();})[_0xc63b('0x50')](function(){return db[_0xc63b('0x56')][_0xc63b('0x4a')]({'attributes':['id'],'include':[{'model':db[_0xc63b('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xc63b('0x50')](function(_0x2f5571){var _0x39cd95=[];if(_0x2f5571){for(var _0x2c7dda=0x0,_0x1c2d06;_0x2c7dda<_0x2f5571[_0xc63b('0x18')];_0x2c7dda+=0x1){_0x1c2d06=_0x2f5571[_0x2c7dda]['get']({'plain':!![]});_0x39cd95['push'](db[_0xc63b('0x51')]['query'](_0x483426(_0x1c2d06,'CampaignId'))[_0xc63b('0x50')](function(){})[_0xc63b('0x52')](_0x33d735()));}}return _0x39cd95;})[_0xc63b('0x55')]();})[_0xc63b('0x52')](function(_0x5a5ac4){logger[_0xc63b('0x13')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x5a5ac4[_0xc63b('0x1a')]);});}var processPromises=function(_0x137cce){return BPromise[_0xc63b('0x55')](promises)[_0xc63b('0x50')](function(_0x3690f4){})[_0xc63b('0x52')](function(_0x268146){logger[_0xc63b('0x13')](_0xc63b('0x5b'),JSON[_0xc63b('0x2e')](_0x268146));})['finally'](function(){socket['emit'](_0xc63b('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x137cce){return _0x137cce[_0xc63b('0x5d')]();}});};var endCsv=function(){return BPromise['resolve']()[_0xc63b('0x50')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0xc63b('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0xa446a5){logger['error'](_0xc63b('0x5e'),JSON[_0xc63b('0x2e')](_0xa446a5));}finally{process['exit'](0x0);}});};process['on'](_0xc63b('0x5f'),function(){logger[_0xc63b('0x60')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xc63b('0x61')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc63b('0x10')](',');return db[_0xc63b('0x2a')][_0xc63b('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc63b('0x50')](function(_0x1ba6c6){var _0x5bb696=fs[_0xc63b('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc63b('0x63')](_0x5bb696,{'header':!![],'skipEmptyLines':!![],'step':function(_0x59c191,_0x1dcb50){total+=0x1;var _0x9483ea=total;promises['push'](checkRow(_0x59c191,_0x1ba6c6,_0x9483ea)['then'](function(){success+=0x1;})[_0xc63b('0x52')](function(_0x5393e9){if(_0x5393e9[_0xc63b('0x13')]){errors+=0x1;delete _0x5393e9[_0xc63b('0x13')];}else if(_0x5393e9[_0xc63b('0x29')]){duplicates+=0x1;delete _0x5393e9[_0xc63b('0x29')];}rows[_0xc63b('0x2b')](_0x5393e9);}));if(total%0xc8===0x0){_0x1dcb50[_0xc63b('0x64')]();return processPromises(_0x1dcb50);}},'complete':function(){return processPromises()[_0xc63b('0x50')](function(){logger[_0xc63b('0x60')](_0xc63b('0x65'));endCsv();});},'error':function(_0x561270,_0x19d3ca){logger[_0xc63b('0x60')](_0xc63b('0x66'),JSON[_0xc63b('0x2e')](_0x561270));endCsv();}});})['catch'](function(_0x25e47c){logger['error'](_0xc63b('0x67'),JSON['stringify'](_0x25e47c));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index cc3cbc3..0739203 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 _0x5600=['cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','all','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','offset','catch','main','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','header','name','_description','writeFileSync','parse','createReadStream','data','rows','find','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','hasOwnProperty','itemTypeId','description','appendFileSync','emit','Abort\x20parser','abort','SystemError','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','replace','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','contactId','contactTypeId','orderBy','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','test','select','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','length','push','then','isNil','split','filter','findOne','CmContactHasItem','update','create','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.id','insert','cm_hopper_black','ListId','fields','.CmListId','field','cm_contacts.updatedAt','fromQuery','.CmListId\x20=\x20?','ListId\x20=\x20?','cm_hopper.id'];(function(_0x3ff2f9,_0x544ba1){var _0x3b0913=function(_0x554288){while(--_0x554288){_0x3ff2f9['push'](_0x3ff2f9['shift']());}};_0x3b0913(++_0x544ba1);}(_0x5600,0x1e4));var _0x0560=function(_0x11f0e3,_0x5170bc){_0x11f0e3=_0x11f0e3-0x0;var _0x2892e8=_0x5600[_0x11f0e3];return _0x2892e8;};'use strict';var fs=require('fs');var path=require(_0x0560('0x0'));var _=require(_0x0560('0x1'));var Papa=require('papaparse');var util=require(_0x0560('0x2'));var BPromise=require(_0x0560('0x3'));var moment=require(_0x0560('0x4'));var squel=require(_0x0560('0x5'));var Redis=require(_0x0560('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x0560('0x7'));var shared=require(_0x0560('0x8'));var logger=require(_0x0560('0x9'))(_0x0560('0xa'));config[_0x0560('0xb')]=_[_0x0560('0xc')](config[_0x0560('0xb')],{'host':_0x0560('0xd'),'port':0x18eb});var socket=require(_0x0560('0xe'))(new Redis(config[_0x0560('0xb')]));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()[_0x0560('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x476a5f){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))*$/[_0x0560('0x10')](_0x476a5f);}function selectNotIn(_0x196fe4,_0x1b34bd,_0x35099c,_0x3f8d1f,_0x27b406){return squel[_0x0560('0x11')]()['field'](_0x0560('0x12'))[_0x0560('0x13')](_0x3f8d1f)[_0x0560('0x14')](_0x1b34bd,null,_0x1b34bd+'.id\x20=\x20'+_0x3f8d1f+'.'+_0x35099c)[_0x0560('0x15')](_0x3f8d1f+'.'+_0x35099c+_0x0560('0x16')+_0x196fe4+'.'+_0x35099c)[_0x0560('0x15')](_0x1b34bd+_0x0560('0x17')+_0x27b406[_0x0560('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x43ac56,_0x334664){promisesAdditionalPhones=[];return db[_0x0560('0x18')][_0x0560('0x19')]({'raw':!![],'attributes':['id',_0x0560('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x4f9d7b){if(_0x4f9d7b!==null){var _0x16e6ac=[];for(var _0x23eb5c=0x0;_0x23eb5c<_0x4f9d7b[_0x0560('0x1b')];_0x23eb5c++){var _0x1b9ef0=_0x4f9d7b[_0x23eb5c];_0x16e6ac[_0x0560('0x1c')](insertAdditionalPhones(_0x1b9ef0));}}Promise['all'](_0x16e6ac)[_0x0560('0x1d')](function(){_0x43ac56({'val':0x1});});});});}function insertAdditionalPhones(_0x1ce753){return new Promise(function(_0x2271b4,_0x2abd2f){var _0x376000=_0x1ce753['AdditionalPhones'];var _0x3fee35=_0x376000['split'](';');var _0x37f2e3=[];orderBy=0x0;for(var _0x523a79=0x0;_0x523a79<_0x3fee35[_0x0560('0x1b')];_0x523a79++){_0x37f2e3[_0x0560('0x1c')](splitAdditionalPhone(_0x1ce753['id'],_0x3fee35[_0x523a79]));}Promise['all'](_0x37f2e3)[_0x0560('0x1d')](function(){_0x2271b4({'val':_0x3fee35[_0x0560('0x1b')]});});});}function splitAdditionalPhone(_0x5b7911,_0x430be3){return new Promise(function(_0x24e6d0,_0x4721b3){var _0x2eadff=_0x430be3['split'](':');var _0x4a61e3=_0x2eadff[0x0];var _0x13d6d4=_0x2eadff[0x1];if(!_[_0x0560('0x1e')](_0x13d6d4)){var _0x17ca15=_0x13d6d4[_0x0560('0x1f')]('|');var _0x2209f9=[];for(var _0x1b85af=0x0;_0x1b85af<_0x17ca15['length'];_0x1b85af++){if(_0x17ca15[_0x1b85af]!==''){var _0x355801=_[_0x0560('0x20')](promisesAdditionalPhones,{'contactId':_0x5b7911,'phone':_0x17ca15[_0x1b85af]});if(_0x355801[_0x0560('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x0560('0x1c')]({'contactId':_0x5b7911,'contactTypeId':_0x4a61e3,'phone':_0x17ca15[_0x1b85af],'orderBy':orderBy});}}}_0x24e6d0({'ok':0x1});}else _0x24e6d0({'res':0x0});});}function createAdditionalPhone(_0x1df9f8,_0x551a13,_0x529e2b,_0x2bc4a3){var _0x1ea248='';var _0x318322='';var _0x47260a=_0x529e2b[_0x0560('0x1f')]('§');_0x1ea248=_0x47260a[0x0];if(_0x47260a[_0x0560('0x1b')]==0x2)_0x318322=_0x47260a[0x1];return new Promise(function(_0x17acde,_0x4fc279){return db['CmContactHasItem'][_0x0560('0x21')]({'where':{'CmContactId':_0x1df9f8,'item':_0x1ea248}})[_0x0560('0x1d')](function(_0x380780){if(_0x380780){return db[_0x0560('0x22')][_0x0560('0x23')]({'ItemTypeId':_0x551a13,'description':_0x318322,'OrderBy':_0x2bc4a3},{'where':{'CmContactId':_0x1df9f8,'item':_0x1ea248}})[_0x0560('0x1d')](function(_0x11c41a){_0x17acde({'res':'updated'});});}else{return db[_0x0560('0x22')][_0x0560('0x24')]({'CmContactId':_0x1df9f8,'item':_0x1ea248,'description':_0x318322,'ItemTypeId':_0x551a13,'OrderBy':_0x2bc4a3,'ItemClass':'PHONE'})['then'](function(_0x1a8b55){_0x17acde({'res':'inserted'});});}});});}function insertCmHopper(_0xef3059,_0x360ae3,_0x2d8e5a,_0x24da3f,_0x5437c3){var _0x5a9674=[_0x0560('0x25'),_0x0560('0x26'),'cm_contacts.id',_0x0560('0x27'),_0x360ae3+'.'+_0x24da3f,_0x0560('0x28'),'cm_contacts.updatedAt',_0x0560('0x29'),_0x0560('0x2a'),'\x22'+_0x5437c3+'\x22'];return squel['insert']()[_0x0560('0x2b')](_0x0560('0x2c'))['fromQuery']([_0x0560('0x12'),_0x0560('0x2d'),_0x0560('0x2e'),'ListId',_0x24da3f,_0x0560('0x2f'),_0x0560('0x30'),_0x0560('0x31'),_0x0560('0x32'),_0x0560('0x33')],squel['select']()['fields'](_0x5a9674)[_0x0560('0x13')](_0x360ae3)[_0x0560('0x14')](_0x0560('0x34'),null,_0x0560('0x35')+_0x360ae3+'.CmListId')[_0x0560('0x14')](_0x2d8e5a,null,_0x2d8e5a+_0x0560('0x36')+_0x360ae3+'.'+_0x24da3f)[_0x0560('0x15')](_0x360ae3+'.CmListId\x20=\x20?',_0xef3059)[_0x0560('0x15')](_0x0560('0x37'),NOW)['where'](_0x0560('0x38'),selectNotIn(_0x360ae3,_0x2d8e5a,_0x24da3f,_0x0560('0x2c'),[_0x0560('0x39'),'\x22onlyIfOpen\x22']))[_0x0560('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x360ae3,_0x2d8e5a,_0x24da3f,_0x0560('0x2c'),[_0x0560('0x39')])))[_0x0560('0x3a')]();}function insertCmHopperBlack(_0x587227,_0x1b2d36,_0x4f5641,_0x548a2b){var _0x5d3d14=['cm_contacts.phone',_0x0560('0x3b'),'cm_contacts.ListId',_0x1b2d36+'.'+_0x548a2b,_0x0560('0x28'),'cm_contacts.updatedAt'];return squel[_0x0560('0x3c')]()[_0x0560('0x2b')](_0x0560('0x3d'))['fromQuery']([_0x0560('0x12'),'ContactId',_0x0560('0x3e'),_0x548a2b,_0x0560('0x2f'),'updatedAt'],squel[_0x0560('0x11')]()[_0x0560('0x3f')](_0x5d3d14)[_0x0560('0x13')](_0x1b2d36)[_0x0560('0x14')](_0x0560('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x1b2d36+_0x0560('0x40'))[_0x0560('0x14')](_0x4f5641,null,_0x4f5641+_0x0560('0x36')+_0x1b2d36+'.'+_0x548a2b)[_0x0560('0x15')](_0x1b2d36+'.CmListId\x20=\x20?',_0x587227)[_0x0560('0x15')](_0x0560('0x37'),NOW)[_0x0560('0x15')](_0x0560('0x38'),squel[_0x0560('0x11')]()[_0x0560('0x41')](_0x0560('0x12'))[_0x0560('0x13')](_0x0560('0x3d'))[_0x0560('0x15')]('ListId\x20=\x20?',_0x587227)[_0x0560('0x15')](_0x548a2b+'\x20=\x20'+_0x1b2d36+'.'+_0x548a2b)))[_0x0560('0x3a')]();}function insertTzCmHopper(_0x14dc38,_0x4b57c3,_0x1ae360,_0x5466a6,_0x58278e,_0x555791){var _0x2d46ee=[_0x0560('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x555791+'.offset-cm_contacts.utcOffset\x20minute)',_0x0560('0x3b'),_0x0560('0x27'),_0x4b57c3+'.'+_0x5466a6,'cm_contacts.createdAt',_0x0560('0x42'),'cm_contacts.priority',_0x0560('0x2a'),'\x22'+_0x58278e+'\x22'];var _0x322e7b=squel[_0x0560('0x3c')]()['into'](_0x0560('0x2c'))[_0x0560('0x43')]([_0x0560('0x12'),_0x0560('0x2d'),_0x0560('0x2e'),'ListId',_0x5466a6,_0x0560('0x2f'),_0x0560('0x30'),_0x0560('0x31'),_0x0560('0x32'),'recallme'],squel[_0x0560('0x11')]()[_0x0560('0x3f')](_0x2d46ee)['from'](_0x4b57c3)[_0x0560('0x14')](_0x0560('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x4b57c3+_0x0560('0x40'))[_0x0560('0x14')](_0x1ae360,null,_0x1ae360+_0x0560('0x36')+_0x4b57c3+'.'+_0x5466a6)[_0x0560('0x14')](_0x555791,null,_0x555791+_0x0560('0x36')+_0x4b57c3+'.'+_0x5466a6)[_0x0560('0x15')](_0x4b57c3+_0x0560('0x44'),_0x14dc38)[_0x0560('0x15')](_0x0560('0x37'),NOW)['where'](_0x0560('0x38'),selectNotIn(_0x4b57c3,_0x1ae360,_0x5466a6,_0x0560('0x2c'),[_0x0560('0x39'),'\x22onlyIfOpen\x22']))[_0x0560('0x15')](_0x0560('0x38'),selectNotIn(_0x4b57c3,_0x1ae360,_0x5466a6,'cm_hopper',[_0x0560('0x39')])))[_0x0560('0x3a')]();return _0x322e7b;}function insertTzCmHopperBlack(_0x2bd47c,_0x549eec,_0x49a35d,_0x19aee7){var _0x44a338=[_0x0560('0x25'),'cm_contacts.id',_0x0560('0x27'),_0x549eec+'.'+_0x19aee7,_0x0560('0x28'),_0x0560('0x42')];return squel[_0x0560('0x3c')]()['into'](_0x0560('0x3d'))[_0x0560('0x43')](['phone',_0x0560('0x2e'),_0x0560('0x3e'),_0x19aee7,'createdAt',_0x0560('0x30')],squel[_0x0560('0x11')]()[_0x0560('0x3f')](_0x44a338)['from'](_0x549eec)[_0x0560('0x14')]('cm_contacts',null,_0x0560('0x35')+_0x549eec+_0x0560('0x40'))['join'](_0x49a35d,null,_0x49a35d+_0x0560('0x36')+_0x549eec+'.'+_0x19aee7)[_0x0560('0x15')](_0x549eec+_0x0560('0x44'),_0x2bd47c)[_0x0560('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0560('0x15')](_0x0560('0x38'),squel[_0x0560('0x11')]()[_0x0560('0x41')](_0x0560('0x12'))['from'](_0x0560('0x3d'))[_0x0560('0x15')](_0x0560('0x45'),_0x2bd47c)['where'](_0x19aee7+'\x20=\x20'+_0x549eec+'.'+_0x19aee7)))['toString']();}function insertCmHopperAdditionalPhones(_0x1d980f){var _0x2a059a=[_0x0560('0x46'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0x0560('0x47'),_0x0560('0x48')];return squel[_0x0560('0x3c')]()['into'](_0x0560('0x49'))[_0x0560('0x43')]([_0x0560('0x4a'),_0x0560('0x12'),_0x0560('0x4b'),_0x0560('0x2f'),_0x0560('0x30')],squel[_0x0560('0x11')]()[_0x0560('0x3f')](_0x2a059a)[_0x0560('0x13')](_0x0560('0x2c'))[_0x0560('0x14')](_0x0560('0x34'),null,_0x0560('0x4c'))['join'](_0x0560('0x4d'),null,_0x0560('0x4e'))[_0x0560('0x15')](_0x0560('0x4f'),_0x1d980f)[_0x0560('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x0560('0x3a')]();}function insertCmContact(_0x53005c,_0x53c747,_0x3214ae,_0x5e5634){var _0x4a2545=_[_0x0560('0x50')](_[_0x0560('0x51')](_0x5e5634),[_0x0560('0x3e'),'CompanyId',_0x0560('0x2f'),_0x0560('0x30'),_0x0560('0x52')]);return squel['insert']()[_0x0560('0x2b')](_0x0560('0x34'))[_0x0560('0x43')](_0x4a2545,squel[_0x0560('0x11')]()[_0x0560('0x3f')](_0x4a2545)['from'](_0x53c747)['where']('('+_0x3214ae[_0x0560('0x14')](',')+_0x0560('0x53'),squel[_0x0560('0x11')]()[_0x0560('0x3f')](_0x3214ae)['from'](_0x0560('0x34'))[_0x0560('0x15')](_0x0560('0x45'),_0x53005c)[_0x0560('0x15')](_0x0560('0x54')))['where'](_0x0560('0x55'),squel[_0x0560('0x11')]()[_0x0560('0x41')]('MIN(id)',_0x0560('0x56'))[_0x0560('0x13')](_0x53c747)[_0x0560('0x57')](_0x3214ae[_0x0560('0x14')](','))))['toString']();}function handleStop(){logger[_0x0560('0x58')](_0x0560('0x59'));stopped=!![];}function handleUncaughtException(_0x18ab66){logger[_0x0560('0x5a')](_0x18ab66[_0x0560('0x5b')]);process[_0x0560('0x5c')](0x1);}function handleError(_0x2f88b7,_0xc3d640){stats[_0x0560('0x5d')][_0x0560('0x1c')]({'name':_0xc3d640[_0x0560('0x5e')],'message':_0xc3d640[_0x0560('0x5b')],'row':_0x2f88b7});}function handleQuery(_0x7611b1){logger[_0x0560('0x58')](_0x7611b1);return db[_0x0560('0x5f')][_0x0560('0x60')](_0x7611b1)[_0x0560('0x61')](function(_0x38c88e){results[_0x0560('0x1c')](_0x38c88e);})['catch'](function(_0x7d340a){logger[_0x0560('0x5a')](_0x7d340a['message']);});}function updateTzCampaigns(_0xe02a2a){return new Promise(function(_0x40b3b5,_0xd6eb70){var _0x4af90c=squel['select']()[_0x0560('0x3f')]([_0x0560('0x62'),_0x0560('0x63')])[_0x0560('0x13')](_0x0560('0x64'))[_0x0560('0x14')](_0x0560('0x65'),null,_0x0560('0x66'))[_0x0560('0x15')](_0x0560('0x67')+_0xe02a2a);db[_0x0560('0x5f')][_0x0560('0x60')](_0x4af90c[_0x0560('0x3a')]())[_0x0560('0x61')](function(_0x515bf9){var _0x509269=[];for(var _0x5ccfc5=0x0;_0x5ccfc5<_0x515bf9[_0x0560('0x1b')];_0x5ccfc5++){_0x509269[_0x0560('0x1c')](getTimezoneData(_0x515bf9[_0x5ccfc5],tmp_campaigns));}BPromise[_0x0560('0x68')](_0x509269)['then'](function(){_0x40b3b5({'val':0x1});});})['catch'](function(_0x207df7){logger[_0x0560('0x5a')](_0x207df7['message']);_0x40b3b5({'val':0x0});});});}function updateTzVoiceQueues(_0x4fd866){return new Promise(function(_0x4d6a5d,_0x154347){var _0xbfc0c5=squel[_0x0560('0x11')]()[_0x0560('0x3f')]([_0x0560('0x69'),_0x0560('0x6a')])[_0x0560('0x13')](_0x0560('0x6b'))[_0x0560('0x14')](_0x0560('0x6c'),null,_0x0560('0x6d'))[_0x0560('0x15')](_0x0560('0x6e')+_0x4fd866);db[_0x0560('0x5f')][_0x0560('0x60')](_0xbfc0c5[_0x0560('0x3a')]())[_0x0560('0x61')](function(_0x4a5446){var _0x1d8ea2=[];for(var _0x454bcb=0x0;_0x454bcb<_0x4a5446[_0x0560('0x1b')];_0x454bcb++){_0x1d8ea2[_0x0560('0x1c')](getTimezoneData(_0x4a5446[_0x454bcb],tmp_voice_queues));}BPromise[_0x0560('0x68')](_0x1d8ea2)['then'](function(){_0x4d6a5d({'val':0x1});});})['catch'](function(_0x3fd044){logger[_0x0560('0x5a')](_0x3fd044[_0x0560('0x5b')]);_0x4d6a5d({'val':0x0});});});}function getTimezoneData(_0x16ce18,_0x3e99b9){return new Promise(function(_0x443889,_0xe8911a){var _0x5b8621=shared[_0x0560('0x6f')];var _0x5035e3=_0x5b8621[_0x16ce18[_0x0560('0x70')]];if(_['isNil'](_0x5035e3)){_0x443889({'ret':0x1});}else{var _0x58c585=_0x5035e3['utcOffset'];var _0x50aa0c=squel[_0x0560('0x3c')]()['into'](_0x3e99b9)[_0x0560('0x71')]('id',_0x16ce18['id'])[_0x0560('0x71')](_0x0560('0x72'),_0x58c585)[_0x0560('0x71')](_0x0560('0x70'),_0x16ce18['dialTimezone'])['toString']();return db[_0x0560('0x5f')]['query'](_0x50aa0c)[_0x0560('0x61')](function(_0x1145c7){_0x443889({'ret':0x1});})[_0x0560('0x73')](function(_0x35ce2e){logger['error'](_0x35ce2e[_0x0560('0x5b')]);_0xe8911a({'ret':0x1});});}});}function handleTZQuery(_0x90e888){logger[_0x0560('0x58')](_0x90e888);return db[_0x0560('0x5f')][_0x0560('0x60')](_0x90e888)[_0x0560('0x61')](function(_0x23e44d){})['catch'](function(_0x4b28c0){logger[_0x0560('0x5a')](_0x4b28c0[_0x0560('0x5b')]);});}function main(_0x2e90d8,_0x17f302,_0x4f78e3,_0x31f2a7){logger[_0x0560('0x58')](_0x0560('0x74'),_0x2e90d8,JSON[_0x0560('0x75')](_0x17f302));process[_0x0560('0x76')](_0x0560('0x77'));var _0x326c92=_0x17f302['binding'];var _0x3d8bd6=_[_0x0560('0x78')](_0x326c92);var _0x3b44d7=_0x17f302[_0x0560('0x79')];var _0x52638d=path['join'](config[_0x0560('0x7a')],_0x0560('0x7b'),_0x3b44d7+'.csv');hasTZ=_['keys'](_0x326c92)['includes'](_0x0560('0x70'));var _0x281e7d=_['keys'](_0x326c92)[_0x0560('0x14')]();logger['info'](_0x0560('0x7c'),_0x281e7d);db['ContactItemType'][_0x0560('0x19')]({'raw':!![],'attributes':['id','name']})[_0x0560('0x1d')](function(_0x53ce54){for(var _0x28a4a7=0x0;_0x28a4a7<_0x53ce54[_0x0560('0x1b')];_0x28a4a7++){if(_0x53ce54[_0x28a4a7][_0x0560('0x7d')]in _0x326c92){contactItemTypes['push'](_0x53ce54[_0x28a4a7]);delete _0x3d8bd6[_0x53ce54[_0x28a4a7][_0x0560('0x7d')]];hasAdditionalPhones=!![];}for(var _0x3ffc22 in _0x326c92){if(_0x53ce54[_0x28a4a7][_0x0560('0x7d')]+_0x0560('0x7e')===_0x3ffc22){phoneDescriptions[_0x0560('0x1c')]({'itemTypeId':_0x53ce54[_0x28a4a7]['id'],'description':_0x3ffc22});delete _0x3d8bd6[_0x3ffc22];}}}if(hasAdditionalPhones)_0x3d8bd6[_0x0560('0x1a')]='';var _0x2c91d7=_['keys'](_0x3d8bd6)[_0x0560('0x14')]();logger[_0x0560('0x58')](_0x0560('0x7c'),_0x2c91d7);fs[_0x0560('0x7f')](_0x52638d,_0x2c91d7+'\x0a');Papa[_0x0560('0x80')](fs[_0x0560('0x81')](_0x2e90d8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1bed7f,_0x320fb0){try{for(var _0x82b6fc=0x0,_0x300ea4=[];_0x82b6fc<_0x1bed7f[_0x0560('0x82')]['length'];_0x82b6fc++){stats[_0x0560('0x83')]+=0x1;if(_0x1bed7f['errors'][_0x82b6fc]){handleError(_0x1bed7f[_0x0560('0x82')][_0x82b6fc],_0x1bed7f['errors'][_0x82b6fc]);}else{var _0x1f49b7=[];var _0x2269f9=[];var _0x208242={};for(var _0x51f52e in _0x326c92){let _0xbe850c=contactItemTypes[_0x0560('0x84')](_0x23864a=>_0x23864a[_0x0560('0x7d')]===_0x51f52e);let _0x300aeb=contactItemTypes[_0x0560('0x84')](_0x8ea5ff=>_0x8ea5ff[_0x0560('0x7d')]+_0x0560('0x7e')===_0x51f52e);if(_[_0x0560('0x1e')](_0xbe850c)&&_[_0x0560('0x1e')](_0x300aeb)){if(_0x326c92['hasOwnProperty'](_0x51f52e)){if(_0x1bed7f[_0x0560('0x82')][_0x82b6fc][_0x326c92[_0x51f52e]]){var _0x2fca7b=_['trim'](_0x1bed7f['data'][_0x82b6fc][_0x326c92[_0x51f52e]]['replace'](/"/g,'\x27'));switch(_0x51f52e){case _0x0560('0x2d'):var _0x509348=moment(_0x2fca7b,_0x0560('0x85'),!![]);if(_0x509348[_0x0560('0x86')]()){_0x300ea4['push']('\x22'+_0x2fca7b+'\x22');}else{_0x1f49b7[_0x0560('0x1c')](_0x0560('0x87'));}break;case _0x0560('0x31'):var _0x19ac35=parseInt(_0x2fca7b);_0x2fca7b=_[_0x0560('0x88')](_0x19ac35)||_0x19ac35<0x0||_0x19ac35>0x4?_0x31f2a7?0x3:0x2:_0x19ac35;_0x300ea4['push']('\x22'+_0x2fca7b+'\x22');break;case'UserId':var _0x437a4c=parseInt(_0x2fca7b);if(_[_0x0560('0x89')](_0x437a4c)&&_['includes'](_0x4f78e3,_0x437a4c)){_0x300ea4[_0x0560('0x1c')]('\x22'+_0x437a4c+'\x22');}else{_0x1f49b7[_0x0560('0x1c')](_0x0560('0x8a'));}break;case'email':if(isEmail(_0x2fca7b)){_0x300ea4[_0x0560('0x1c')]('\x22'+_0x2fca7b+'\x22');}else{_0x1f49b7['push']('email\x20wrong\x20format');}break;case _0x0560('0x8b'):var _0x2394a5=moment(_0x2fca7b,_0x0560('0x8c'),!![]);if(_0x2394a5[_0x0560('0x86')]()){_0x300ea4['push']('\x22'+_0x2fca7b+'\x22');}else{_0x1f49b7[_0x0560('0x1c')](_0x0560('0x8d'));}break;case _0x0560('0x70'):var _0x2ba750=shared[_0x0560('0x6f')];var _0x25333e=_0x2ba750[_0x2fca7b];if(!_['isNil'](_0x25333e)){var _0x2cc3e1=_0x25333e[_0x0560('0x8e')];_0x300ea4['push']('\x22'+_0x2fca7b+'\x22');_0x300ea4['push']('\x22'+_0x2cc3e1+'\x22');}break;default:_0x300ea4['push']('\x22'+_0x2fca7b+'\x22');}}else{switch(_0x51f52e){case _0x0560('0x8f'):case _0x0560('0x12'):_0x1f49b7[_0x0560('0x1c')](_0x51f52e+'\x20not\x20specified');break;default:_0x300ea4['push']('\x22\x22');}}}}else{var _0x1e8900='';if(!_[_0x0560('0x1e')](_0xbe850c)){if(!_0x208242[_0x0560('0x90')](_0xbe850c['id'])){if(!_[_0x0560('0x1e')](_0x1bed7f['data'][_0x82b6fc][_0x326c92[_0x51f52e]])){var _0x2fca7b=_['trim'](_0x1bed7f[_0x0560('0x82')][_0x82b6fc][_0x326c92[_0x51f52e]]['replace'](/"/g,'\x27'));var _0x4becc2=phoneDescriptions[_0x0560('0x84')](_0x42c784=>_0x42c784[_0x0560('0x91')]===_0xbe850c['id']);if(!_[_0x0560('0x1e')](_0x4becc2)){var _0x2f9cbd=_['trim'](_0x1bed7f[_0x0560('0x82')][_0x82b6fc][_0x326c92[_0x4becc2[_0x0560('0x92')]]]['replace'](/"/g,'\x27'));if(!_[_0x0560('0x1e')](_0x2f9cbd))_0x2fca7b=_0x2fca7b+'§'+_0x2f9cbd;}if(_0x1e8900=='')_0x1e8900=_0x2fca7b;else _0x1e8900+='|'+_0x2fca7b;}_0x2269f9['push'](_0xbe850c['id']+':'+_0x1e8900);_0x208242[_0xbe850c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x300ea4[_0x0560('0x1c')]('\x22'+_0x2269f9[_0x0560('0x14')](';')+'\x22');}if(_0x1f49b7['length']){handleError(_0x1bed7f[_0x0560('0x82')][_0x82b6fc],{'code':'SystemRow','message':_0x1f49b7[_0x0560('0x14')]()});}else{fs[_0x0560('0x93')](_0x52638d,_0x300ea4[_0x0560('0x14')]()+'\x0a');}_0x300ea4=[];}if(!(stats[_0x0560('0x83')]%0xc8)){socket[_0x0560('0x94')]('contact:import:'+_0x3b44d7,stats);stats['errors']=[];}}if(stopped){logger[_0x0560('0x58')](_0x0560('0x95'));_0x320fb0[_0x0560('0x96')]();}}catch(_0x108d5c){handleError(_0x1bed7f[_0x0560('0x82')][_0x82b6fc],{'code':_0x0560('0x97'),'message':_0x108d5c[_0x0560('0x5b')]});logger[_0x0560('0x5a')]('step',_0x108d5c[_0x0560('0x5b')]);}},'complete':function(){try{var _0x263561=[];var _0x40b0ab=[];var _0x511c90='cm_contacts';if(_0x17f302[_0x0560('0x98')]&&_0x17f302[_0x0560('0x98')][_0x0560('0x1b')]){_0x511c90='cm_contacts_'+_0x3b44d7;_0x263561[_0x0560('0x1c')](_0x0560('0x99')+_0x511c90+_0x0560('0x9a'));}tmp_campaigns='campaigns_'+_0x3b44d7;tmp_voice_queues='voice_queues_'+_0x3b44d7;_0x40b0ab['push'](_0x0560('0x99')+tmp_campaigns+_0x0560('0x9b'));_0x40b0ab[_0x0560('0x1c')](_0x0560('0x99')+tmp_voice_queues+_0x0560('0x9b'));BPromise[_0x0560('0x9c')](_0x40b0ab,handleTZQuery)[_0x0560('0x1d')](function(_0x469896){updateTzCampaigns(_0x17f302[_0x0560('0x3e')])[_0x0560('0x1d')](function(_0x3897d6){updateTzVoiceQueues(_0x17f302[_0x0560('0x3e')])[_0x0560('0x1d')](function(_0x4d66e8){if(hasTZ)_0x2c91d7=_0x2c91d7[_0x0560('0x9d')](_0x0560('0x70'),_0x0560('0x9e'));var _0x3c719d=util[_0x0560('0xf')](_0x0560('0x9f'),_0x52638d,_0x511c90,_0x2c91d7,_0x17f302[_0x0560('0x3e')],_0x17f302[_0x0560('0xa0')]||null,NOW,NOW);if(_[_0x0560('0x1e')](_0x326c92[_0x0560('0x2d')])){_0x3c719d+=_0x0560('0xa1');}_0x263561['push'](_0x3c719d);if(_0x17f302[_0x0560('0x98')]&&_0x17f302[_0x0560('0x98')]['length']){_0x263561[_0x0560('0x1c')](insertCmContact(_0x17f302[_0x0560('0x3e')],_0x511c90,_0x17f302['duplicates'],_0x326c92));_0x263561[_0x0560('0x1c')](_0x0560('0xa2')+_0x511c90+';');}BPromise[_0x0560('0x9c')](_0x263561,handleQuery)[_0x0560('0x1d')](function(_0x1dc33c){BPromise['all']([handleAdditionalPhones()])[_0x0560('0x1d')](function(){_0x263561=[];for(var _0x4bf3cd=0x0;_0x4bf3cd\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','priority','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.id','cm_contacts.updatedAt','cm_hopper_black','createdAt','updatedAt','cm_contacts','.CmListId','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','scheduledat','UserId','ListId\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt','MIN(id)','min_id','info','Received\x20SIGINT','error','message','exit','errors','code','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','sequelize','spread','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','stringify','binding','clone','root','server/files/tmp','includes','header','ContactItemType','findAll','name','_description','writeFileSync','parse','createReadStream','data','find','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','hasOwnProperty','itemTypeId','description','SystemRow','appendFileSync','rows','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_'];(function(_0x47b6f4,_0x1a0620){var _0x3e863e=function(_0x17324e){while(--_0x17324e){_0x47b6f4['push'](_0x47b6f4['shift']());}};_0x3e863e(++_0x1a0620);}(_0x3624,0x180));var _0x4362=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x3624[_0x5af97c];return _0x3472ae;};'use strict';var fs=require('fs');var path=require(_0x4362('0x0'));var _=require(_0x4362('0x1'));var Papa=require(_0x4362('0x2'));var util=require(_0x4362('0x3'));var BPromise=require(_0x4362('0x4'));var moment=require('moment');var squel=require(_0x4362('0x5'));var Redis=require(_0x4362('0x6'));var db=require(_0x4362('0x7'))['db'];var config=require(_0x4362('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0x4362('0x9'))('import');config[_0x4362('0xa')]=_[_0x4362('0xb')](config[_0x4362('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4362('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x4362('0xc')](_0x4362('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x4362('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x240d1f){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))*$/[_0x4362('0xe')](_0x240d1f);}function selectNotIn(_0x51d279,_0x44eb0b,_0x29ab55,_0x3bb96f,_0x581bcc){return squel[_0x4362('0xf')]()[_0x4362('0x10')](_0x4362('0x11'))[_0x4362('0x12')](_0x3bb96f)['join'](_0x44eb0b,null,_0x44eb0b+_0x4362('0x13')+_0x3bb96f+'.'+_0x29ab55)[_0x4362('0x14')](_0x3bb96f+'.'+_0x29ab55+_0x4362('0x15')+_0x51d279+'.'+_0x29ab55)[_0x4362('0x14')](_0x44eb0b+_0x4362('0x16')+_0x581bcc[_0x4362('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3d1819,_0x4f9ea8){promisesAdditionalPhones=[];return db[_0x4362('0x18')]['findAll']({'raw':!![],'attributes':['id',_0x4362('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x4362('0x1a')](function(_0x349dc4){if(_0x349dc4!==null){var _0x51d30a=[];for(var _0x4335a0=0x0;_0x4335a0<_0x349dc4[_0x4362('0x1b')];_0x4335a0++){var _0x13d626=_0x349dc4[_0x4335a0];_0x51d30a[_0x4362('0x1c')](insertAdditionalPhones(_0x13d626));}}Promise[_0x4362('0x1d')](_0x51d30a)[_0x4362('0x1a')](function(){_0x3d1819({'val':0x1});});});});}function insertAdditionalPhones(_0x4a197c){return new Promise(function(_0x5f30cb,_0x45e511){var _0x344ec9=_0x4a197c[_0x4362('0x19')];var _0x4c9d2a=_0x344ec9[_0x4362('0x1e')](';');var _0x2256ec=[];orderBy=0x0;for(var _0x31d505=0x0;_0x31d505<_0x4c9d2a[_0x4362('0x1b')];_0x31d505++){_0x2256ec[_0x4362('0x1c')](splitAdditionalPhone(_0x4a197c['id'],_0x4c9d2a[_0x31d505]));}Promise[_0x4362('0x1d')](_0x2256ec)[_0x4362('0x1a')](function(){_0x5f30cb({'val':_0x4c9d2a[_0x4362('0x1b')]});});});}function splitAdditionalPhone(_0x5c2954,_0x5c5473){return new Promise(function(_0x45cd5d,_0xf5918c){var _0x3255fc=_0x5c5473['split'](':');var _0x391ef8=_0x3255fc[0x0];var _0x4eefa7=_0x3255fc[0x1];if(!_[_0x4362('0x1f')](_0x4eefa7)){var _0x46359c=_0x4eefa7[_0x4362('0x1e')]('|');var _0x53ceb=[];for(var _0x2fc63f=0x0;_0x2fc63f<_0x46359c['length'];_0x2fc63f++){if(_0x46359c[_0x2fc63f]!==''){var _0x329491=_[_0x4362('0x20')](promisesAdditionalPhones,{'contactId':_0x5c2954,'phone':_0x46359c[_0x2fc63f]});if(_0x329491[_0x4362('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x5c2954,'contactTypeId':_0x391ef8,'phone':_0x46359c[_0x2fc63f],'orderBy':orderBy});}}}_0x45cd5d({'ok':0x1});}else _0x45cd5d({'res':0x0});});}function createAdditionalPhone(_0x3f6d51,_0x2813f5,_0x1fd7d8,_0x526309){var _0x578190='';var _0x41b73a='';var _0x1a4c1e=_0x1fd7d8[_0x4362('0x1e')]('§');_0x578190=_0x1a4c1e[0x0];if(_0x1a4c1e[_0x4362('0x1b')]==0x2)_0x41b73a=_0x1a4c1e[0x1];return new Promise(function(_0x5dbfcf,_0x11fd99){return db[_0x4362('0x21')][_0x4362('0x22')]({'where':{'CmContactId':_0x3f6d51,'item':_0x578190}})[_0x4362('0x1a')](function(_0xffc7a3){if(_0xffc7a3){return db[_0x4362('0x21')][_0x4362('0x23')]({'ItemTypeId':_0x2813f5,'description':_0x41b73a,'OrderBy':_0x526309},{'where':{'CmContactId':_0x3f6d51,'item':_0x578190}})['then'](function(_0x546790){_0x5dbfcf({'res':_0x4362('0x24')});});}else{return db[_0x4362('0x21')][_0x4362('0x25')]({'CmContactId':_0x3f6d51,'item':_0x578190,'description':_0x41b73a,'ItemTypeId':_0x2813f5,'OrderBy':_0x526309,'ItemClass':_0x4362('0x26')})[_0x4362('0x1a')](function(_0x2350ef){_0x5dbfcf({'res':_0x4362('0x27')});});}});});}function insertCmHopper(_0x43d8b1,_0x4f835b,_0x65c2,_0x145f01,_0x5424ca){var _0x510cf0=[_0x4362('0x28'),_0x4362('0x29'),'cm_contacts.id',_0x4362('0x2a'),_0x4f835b+'.'+_0x145f01,_0x4362('0x2b'),'cm_contacts.updatedAt','cm_contacts.priority',_0x4362('0x2c'),'\x22'+_0x5424ca+'\x22'];return squel[_0x4362('0x2d')]()[_0x4362('0x2e')](_0x4362('0x2f'))[_0x4362('0x30')]([_0x4362('0x11'),'scheduledat',_0x4362('0x31'),_0x4362('0x32'),_0x145f01,'createdAt','updatedAt',_0x4362('0x33'),'UserId','recallme'],squel[_0x4362('0xf')]()[_0x4362('0x34')](_0x510cf0)[_0x4362('0x12')](_0x4f835b)[_0x4362('0x17')]('cm_contacts',null,_0x4362('0x35')+_0x4f835b+'.CmListId')[_0x4362('0x17')](_0x65c2,null,_0x65c2+_0x4362('0x13')+_0x4f835b+'.'+_0x145f01)['where'](_0x4f835b+_0x4362('0x36'),_0x43d8b1)[_0x4362('0x14')](_0x4362('0x37'),NOW)['where'](_0x4362('0x38'),selectNotIn(_0x4f835b,_0x65c2,_0x145f01,_0x4362('0x2f'),[_0x4362('0x39'),_0x4362('0x3a')]))['where'](_0x4362('0x38'),selectNotIn(_0x4f835b,_0x65c2,_0x145f01,'cm_hopper',[_0x4362('0x39')])))['toString']();}function insertCmHopperBlack(_0x3ac27f,_0x2fe3dd,_0x57a2bb,_0x5b950e){var _0xeba696=['cm_contacts.phone',_0x4362('0x3b'),_0x4362('0x2a'),_0x2fe3dd+'.'+_0x5b950e,_0x4362('0x2b'),_0x4362('0x3c')];return squel[_0x4362('0x2d')]()['into'](_0x4362('0x3d'))[_0x4362('0x30')]([_0x4362('0x11'),_0x4362('0x31'),_0x4362('0x32'),_0x5b950e,_0x4362('0x3e'),_0x4362('0x3f')],squel[_0x4362('0xf')]()[_0x4362('0x34')](_0xeba696)['from'](_0x2fe3dd)[_0x4362('0x17')](_0x4362('0x40'),null,_0x4362('0x35')+_0x2fe3dd+_0x4362('0x41'))[_0x4362('0x17')](_0x57a2bb,null,_0x57a2bb+'.id\x20=\x20'+_0x2fe3dd+'.'+_0x5b950e)['where'](_0x2fe3dd+_0x4362('0x36'),_0x3ac27f)['where'](_0x4362('0x37'),NOW)[_0x4362('0x14')](_0x4362('0x38'),squel['select']()[_0x4362('0x10')]('phone')[_0x4362('0x12')]('cm_hopper_black')['where']('ListId\x20=\x20?',_0x3ac27f)[_0x4362('0x14')](_0x5b950e+_0x4362('0x15')+_0x2fe3dd+'.'+_0x5b950e)))['toString']();}function insertTzCmHopper(_0x10e278,_0x5389b5,_0x1205fa,_0x1c2443,_0x4f9da6,_0x5d5318){var _0x1e5c3c=[_0x4362('0x28'),_0x4362('0x42')+_0x5d5318+_0x4362('0x43'),_0x4362('0x3b'),_0x4362('0x2a'),_0x5389b5+'.'+_0x1c2443,_0x4362('0x2b'),_0x4362('0x3c'),_0x4362('0x44'),_0x4362('0x2c'),'\x22'+_0x4f9da6+'\x22'];var _0x40ebdc=squel[_0x4362('0x2d')]()[_0x4362('0x2e')]('cm_hopper')[_0x4362('0x30')]([_0x4362('0x11'),_0x4362('0x45'),_0x4362('0x31'),'ListId',_0x1c2443,'createdAt',_0x4362('0x3f'),_0x4362('0x33'),_0x4362('0x46'),'recallme'],squel[_0x4362('0xf')]()[_0x4362('0x34')](_0x1e5c3c)[_0x4362('0x12')](_0x5389b5)[_0x4362('0x17')](_0x4362('0x40'),null,_0x4362('0x35')+_0x5389b5+_0x4362('0x41'))['join'](_0x1205fa,null,_0x1205fa+'.id\x20=\x20'+_0x5389b5+'.'+_0x1c2443)['join'](_0x5d5318,null,_0x5d5318+'.id\x20=\x20'+_0x5389b5+'.'+_0x1c2443)[_0x4362('0x14')](_0x5389b5+_0x4362('0x36'),_0x10e278)[_0x4362('0x14')](_0x4362('0x37'),NOW)[_0x4362('0x14')](_0x4362('0x38'),selectNotIn(_0x5389b5,_0x1205fa,_0x1c2443,_0x4362('0x2f'),['\x22always\x22',_0x4362('0x3a')]))['where'](_0x4362('0x38'),selectNotIn(_0x5389b5,_0x1205fa,_0x1c2443,'cm_hopper',[_0x4362('0x39')])))['toString']();return _0x40ebdc;}function insertTzCmHopperBlack(_0x4efcdf,_0x26df22,_0xc4d763,_0xba6fff){var _0x2b682f=[_0x4362('0x28'),'cm_contacts.id','cm_contacts.ListId',_0x26df22+'.'+_0xba6fff,_0x4362('0x2b'),_0x4362('0x3c')];return squel[_0x4362('0x2d')]()['into'](_0x4362('0x3d'))[_0x4362('0x30')]([_0x4362('0x11'),_0x4362('0x31'),_0x4362('0x32'),_0xba6fff,_0x4362('0x3e'),_0x4362('0x3f')],squel[_0x4362('0xf')]()[_0x4362('0x34')](_0x2b682f)[_0x4362('0x12')](_0x26df22)[_0x4362('0x17')](_0x4362('0x40'),null,_0x4362('0x35')+_0x26df22+_0x4362('0x41'))['join'](_0xc4d763,null,_0xc4d763+_0x4362('0x13')+_0x26df22+'.'+_0xba6fff)[_0x4362('0x14')](_0x26df22+'.CmListId\x20=\x20?',_0x4efcdf)[_0x4362('0x14')](_0x4362('0x37'),NOW)['where'](_0x4362('0x38'),squel[_0x4362('0xf')]()['field']('phone')[_0x4362('0x12')](_0x4362('0x3d'))['where'](_0x4362('0x47'),_0x4efcdf)[_0x4362('0x14')](_0xba6fff+_0x4362('0x15')+_0x26df22+'.'+_0xba6fff)))[_0x4362('0x48')]();}function insertCmHopperAdditionalPhones(_0x25eb6a){var _0x45e7d9=[_0x4362('0x49'),'cm_contact_has_items.item',_0x4362('0x4a'),'cm_contact_has_items.createdAt',_0x4362('0x4b')];return squel['insert']()[_0x4362('0x2e')]('cm_hopper_additional_phones')['fromQuery'](['CmHopperId',_0x4362('0x11'),'OrderBy',_0x4362('0x3e'),_0x4362('0x3f')],squel[_0x4362('0xf')]()[_0x4362('0x34')](_0x45e7d9)[_0x4362('0x12')](_0x4362('0x2f'))[_0x4362('0x17')]('cm_contacts',null,_0x4362('0x4c'))[_0x4362('0x17')](_0x4362('0x4d'),null,_0x4362('0x4e'))['where'](_0x4362('0x4f'),_0x25eb6a)[_0x4362('0x14')](_0x4362('0x37'),NOW))[_0x4362('0x48')]();}function insertCmContact(_0x2dcdf3,_0x5b86ba,_0xc517a7,_0x2e443c){var _0xbed950=_[_0x4362('0x50')](_[_0x4362('0x51')](_0x2e443c),[_0x4362('0x32'),'CompanyId',_0x4362('0x3e'),_0x4362('0x3f'),_0x4362('0x52')]);return squel[_0x4362('0x2d')]()[_0x4362('0x2e')](_0x4362('0x40'))[_0x4362('0x30')](_0xbed950,squel['select']()['fields'](_0xbed950)[_0x4362('0x12')](_0x5b86ba)[_0x4362('0x14')]('('+_0xc517a7['join'](',')+')\x20NOT\x20IN\x20?',squel['select']()['fields'](_0xc517a7)[_0x4362('0x12')](_0x4362('0x40'))[_0x4362('0x14')](_0x4362('0x47'),_0x2dcdf3)['where']('deletedAt\x20IS\x20NULL'))[_0x4362('0x14')]('id\x20IN\x20?',squel['select']()[_0x4362('0x10')](_0x4362('0x53'),_0x4362('0x54'))['from'](_0x5b86ba)['group'](_0xc517a7[_0x4362('0x17')](','))))[_0x4362('0x48')]();}function handleStop(){logger[_0x4362('0x55')](_0x4362('0x56'));stopped=!![];}function handleUncaughtException(_0x31dcbe){logger[_0x4362('0x57')](_0x31dcbe[_0x4362('0x58')]);process[_0x4362('0x59')](0x1);}function handleError(_0x2895e7,_0x1c71ff){stats[_0x4362('0x5a')][_0x4362('0x1c')]({'name':_0x1c71ff[_0x4362('0x5b')],'message':_0x1c71ff[_0x4362('0x58')],'row':_0x2895e7});}function handleQuery(_0xeb921c){logger['info'](_0xeb921c);return db['sequelize'][_0x4362('0x5c')](_0xeb921c)['spread'](function(_0x192422){results['push'](_0x192422);})[_0x4362('0x5d')](function(_0x37ac82){logger[_0x4362('0x57')](_0x37ac82[_0x4362('0x58')]);});}function updateTzCampaigns(_0xf7913b){return new Promise(function(_0xc12fb3,_0x4e699d){var _0x413c7c=squel[_0x4362('0xf')]()['fields']([_0x4362('0x5e'),_0x4362('0x5f')])[_0x4362('0x12')](_0x4362('0x60'))['join'](_0x4362('0x61'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where']('campaigns_has_cm_lists.CmListId='+_0xf7913b);db[_0x4362('0x62')][_0x4362('0x5c')](_0x413c7c['toString']())[_0x4362('0x63')](function(_0x49f731){var _0x5f43a8=[];for(var _0x2aaf30=0x0;_0x2aaf30<_0x49f731[_0x4362('0x1b')];_0x2aaf30++){_0x5f43a8[_0x4362('0x1c')](getTimezoneData(_0x49f731[_0x2aaf30],tmp_campaigns));}BPromise[_0x4362('0x1d')](_0x5f43a8)[_0x4362('0x1a')](function(){_0xc12fb3({'val':0x1});});})[_0x4362('0x5d')](function(_0x1f092d){logger[_0x4362('0x57')](_0x1f092d[_0x4362('0x58')]);_0xc12fb3({'val':0x0});});});}function updateTzVoiceQueues(_0x4c5258){return new Promise(function(_0x491946,_0x3e4a39){var _0x4a7712=squel[_0x4362('0xf')]()['fields']([_0x4362('0x64'),'voice_queues.dialTimezone'])[_0x4362('0x12')](_0x4362('0x65'))['join'](_0x4362('0x66'),null,_0x4362('0x67'))[_0x4362('0x14')](_0x4362('0x68')+_0x4c5258);db['sequelize'][_0x4362('0x5c')](_0x4a7712[_0x4362('0x48')]())[_0x4362('0x63')](function(_0x56c48c){var _0x31f6b0=[];for(var _0x55fe90=0x0;_0x55fe90<_0x56c48c[_0x4362('0x1b')];_0x55fe90++){_0x31f6b0[_0x4362('0x1c')](getTimezoneData(_0x56c48c[_0x55fe90],tmp_voice_queues));}BPromise[_0x4362('0x1d')](_0x31f6b0)[_0x4362('0x1a')](function(){_0x491946({'val':0x1});});})[_0x4362('0x5d')](function(_0x21f9dc){logger[_0x4362('0x57')](_0x21f9dc[_0x4362('0x58')]);_0x491946({'val':0x0});});});}function getTimezoneData(_0x488df6,_0x41f90f){return new Promise(function(_0x21655b,_0x1d77fc){var _0x16e668=shared[_0x4362('0x69')];var _0x1326ec=_0x16e668[_0x488df6[_0x4362('0x6a')]];if(_[_0x4362('0x1f')](_0x1326ec)){_0x21655b({'ret':0x1});}else{var _0x52936a=_0x1326ec[_0x4362('0x6b')];var _0x1edbd6=squel[_0x4362('0x2d')]()[_0x4362('0x2e')](_0x41f90f)[_0x4362('0x6c')]('id',_0x488df6['id'])['set']('offset',_0x52936a)[_0x4362('0x6c')](_0x4362('0x6a'),_0x488df6[_0x4362('0x6a')])[_0x4362('0x48')]();return db['sequelize']['query'](_0x1edbd6)[_0x4362('0x63')](function(_0x49ca44){_0x21655b({'ret':0x1});})[_0x4362('0x5d')](function(_0x4e12ba){logger[_0x4362('0x57')](_0x4e12ba[_0x4362('0x58')]);_0x1d77fc({'ret':0x1});});}});}function handleTZQuery(_0x570bd8){logger[_0x4362('0x55')](_0x570bd8);return db[_0x4362('0x62')][_0x4362('0x5c')](_0x570bd8)[_0x4362('0x63')](function(_0x4bf182){})[_0x4362('0x5d')](function(_0x5eea6d){logger[_0x4362('0x57')](_0x5eea6d['message']);});}function main(_0x5510dd,_0x355202,_0x372db7,_0x69676){logger[_0x4362('0x55')]('main',_0x5510dd,JSON[_0x4362('0x6d')](_0x355202));process['send']('start');var _0x1e7891=_0x355202[_0x4362('0x6e')];var _0x2f3edf=_[_0x4362('0x6f')](_0x1e7891);var _0x2be948=_0x355202['socket_timestamp'];var _0x40c4bf=path[_0x4362('0x17')](config[_0x4362('0x70')],_0x4362('0x71'),_0x2be948+'.csv');hasTZ=_[_0x4362('0x51')](_0x1e7891)[_0x4362('0x72')](_0x4362('0x6a'));var _0x1a5e0c=_['keys'](_0x1e7891)['join']();logger[_0x4362('0x55')](_0x4362('0x73'),_0x1a5e0c);db[_0x4362('0x74')][_0x4362('0x75')]({'raw':!![],'attributes':['id',_0x4362('0x76')]})[_0x4362('0x1a')](function(_0x4d6230){for(var _0x317c18=0x0;_0x317c18<_0x4d6230[_0x4362('0x1b')];_0x317c18++){if(_0x4d6230[_0x317c18][_0x4362('0x76')]in _0x1e7891){contactItemTypes[_0x4362('0x1c')](_0x4d6230[_0x317c18]);delete _0x2f3edf[_0x4d6230[_0x317c18][_0x4362('0x76')]];hasAdditionalPhones=!![];}for(var _0x5434d7 in _0x1e7891){if(_0x4d6230[_0x317c18]['name']+_0x4362('0x77')===_0x5434d7){phoneDescriptions['push']({'itemTypeId':_0x4d6230[_0x317c18]['id'],'description':_0x5434d7});delete _0x2f3edf[_0x5434d7];}}}if(hasAdditionalPhones)_0x2f3edf[_0x4362('0x19')]='';var _0x45581a=_[_0x4362('0x51')](_0x2f3edf)[_0x4362('0x17')]();logger[_0x4362('0x55')](_0x4362('0x73'),_0x45581a);fs[_0x4362('0x78')](_0x40c4bf,_0x45581a+'\x0a');Papa[_0x4362('0x79')](fs[_0x4362('0x7a')](_0x5510dd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x26566d,_0x21b400){try{for(var _0x476096=0x0,_0x185996=[];_0x476096<_0x26566d[_0x4362('0x7b')]['length'];_0x476096++){stats['rows']+=0x1;if(_0x26566d[_0x4362('0x5a')][_0x476096]){handleError(_0x26566d['data'][_0x476096],_0x26566d[_0x4362('0x5a')][_0x476096]);}else{var _0x2b1c8e=[];var _0x516caf=[];var _0x61a5e3={};for(var _0x44c3da in _0x1e7891){let _0x246faf=contactItemTypes['find'](_0x2a8b6a=>_0x2a8b6a[_0x4362('0x76')]===_0x44c3da);let _0x3f87ea=contactItemTypes[_0x4362('0x7c')](_0x4368a6=>_0x4368a6[_0x4362('0x76')]+_0x4362('0x77')===_0x44c3da);if(_['isNil'](_0x246faf)&&_[_0x4362('0x1f')](_0x3f87ea)){if(_0x1e7891['hasOwnProperty'](_0x44c3da)){if(_0x26566d[_0x4362('0x7b')][_0x476096][_0x1e7891[_0x44c3da]]){var _0x16a80e=_[_0x4362('0x7d')](_0x26566d['data'][_0x476096][_0x1e7891[_0x44c3da]][_0x4362('0x7e')](/"/g,'\x27'));switch(_0x44c3da){case _0x4362('0x45'):var _0x31c02c=moment(_0x16a80e,_0x4362('0xd'),!![]);if(_0x31c02c[_0x4362('0x7f')]()){_0x185996[_0x4362('0x1c')]('\x22'+_0x16a80e+'\x22');}else{_0x2b1c8e[_0x4362('0x1c')](_0x4362('0x80'));}break;case _0x4362('0x33'):var _0x63fd00=parseInt(_0x16a80e);_0x16a80e=_[_0x4362('0x81')](_0x63fd00)||_0x63fd00<0x0||_0x63fd00>0x4?_0x69676?0x3:0x2:_0x63fd00;_0x185996[_0x4362('0x1c')]('\x22'+_0x16a80e+'\x22');break;case'UserId':var _0x4c1f68=parseInt(_0x16a80e);if(_[_0x4362('0x82')](_0x4c1f68)&&_['includes'](_0x372db7,_0x4c1f68)){_0x185996[_0x4362('0x1c')]('\x22'+_0x4c1f68+'\x22');}else{_0x2b1c8e[_0x4362('0x1c')]('agent\x20not\x20exists');}break;case _0x4362('0x83'):if(isEmail(_0x16a80e)){_0x185996['push']('\x22'+_0x16a80e+'\x22');}else{_0x2b1c8e[_0x4362('0x1c')](_0x4362('0x84'));}break;case _0x4362('0x85'):var _0x33d632=moment(_0x16a80e,_0x4362('0x86'),!![]);if(_0x33d632[_0x4362('0x7f')]()){_0x185996[_0x4362('0x1c')]('\x22'+_0x16a80e+'\x22');}else{_0x2b1c8e[_0x4362('0x1c')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x4362('0x6a'):var _0x3562cf=shared[_0x4362('0x69')];var _0x474250=_0x3562cf[_0x16a80e];if(!_[_0x4362('0x1f')](_0x474250)){var _0x3e3187=_0x474250[_0x4362('0x6b')];_0x185996[_0x4362('0x1c')]('\x22'+_0x16a80e+'\x22');_0x185996[_0x4362('0x1c')]('\x22'+_0x3e3187+'\x22');}break;default:_0x185996[_0x4362('0x1c')]('\x22'+_0x16a80e+'\x22');}}else{switch(_0x44c3da){case'firstName':case'phone':_0x2b1c8e['push'](_0x44c3da+'\x20not\x20specified');break;default:_0x185996['push']('\x22\x22');}}}}else{var _0x4d8427='';if(!_[_0x4362('0x1f')](_0x246faf)){if(!_0x61a5e3[_0x4362('0x87')](_0x246faf['id'])){if(!_[_0x4362('0x1f')](_0x26566d[_0x4362('0x7b')][_0x476096][_0x1e7891[_0x44c3da]])){var _0x16a80e=_[_0x4362('0x7d')](_0x26566d[_0x4362('0x7b')][_0x476096][_0x1e7891[_0x44c3da]]['replace'](/"/g,'\x27'));var _0x4acbde=phoneDescriptions[_0x4362('0x7c')](_0x2ce4a8=>_0x2ce4a8[_0x4362('0x88')]===_0x246faf['id']);if(!_['isNil'](_0x4acbde)){var _0x56d1be=_[_0x4362('0x7d')](_0x26566d[_0x4362('0x7b')][_0x476096][_0x1e7891[_0x4acbde[_0x4362('0x89')]]][_0x4362('0x7e')](/"/g,'\x27'));if(!_[_0x4362('0x1f')](_0x56d1be))_0x16a80e=_0x16a80e+'§'+_0x56d1be;}if(_0x4d8427=='')_0x4d8427=_0x16a80e;else _0x4d8427+='|'+_0x16a80e;}_0x516caf['push'](_0x246faf['id']+':'+_0x4d8427);_0x61a5e3[_0x246faf['id']]=0x1;}}}}if(hasAdditionalPhones){_0x185996[_0x4362('0x1c')]('\x22'+_0x516caf[_0x4362('0x17')](';')+'\x22');}if(_0x2b1c8e[_0x4362('0x1b')]){handleError(_0x26566d[_0x4362('0x7b')][_0x476096],{'code':_0x4362('0x8a'),'message':_0x2b1c8e['join']()});}else{fs[_0x4362('0x8b')](_0x40c4bf,_0x185996[_0x4362('0x17')]()+'\x0a');}_0x185996=[];}if(!(stats[_0x4362('0x8c')]%0xc8)){socket['emit'](_0x4362('0x8d')+_0x2be948,stats);stats[_0x4362('0x5a')]=[];}}if(stopped){logger['info'](_0x4362('0x8e'));_0x21b400['abort']();}}catch(_0x5722b2){handleError(_0x26566d[_0x4362('0x7b')][_0x476096],{'code':_0x4362('0x8f'),'message':_0x5722b2[_0x4362('0x58')]});logger[_0x4362('0x57')](_0x4362('0x90'),_0x5722b2[_0x4362('0x58')]);}},'complete':function(){try{var _0x3d2834=[];var _0x4c2c7e=[];var _0x28b63b=_0x4362('0x40');if(_0x355202[_0x4362('0x91')]&&_0x355202[_0x4362('0x91')][_0x4362('0x1b')]){_0x28b63b=_0x4362('0x92')+_0x2be948;_0x3d2834['push']('CREATE\x20TABLE\x20'+_0x28b63b+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x4362('0x93')+_0x2be948;tmp_voice_queues=_0x4362('0x94')+_0x2be948;_0x4c2c7e[_0x4362('0x1c')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x4362('0x95'));_0x4c2c7e[_0x4362('0x1c')](_0x4362('0x96')+tmp_voice_queues+_0x4362('0x95'));BPromise[_0x4362('0x97')](_0x4c2c7e,handleTZQuery)[_0x4362('0x1a')](function(_0x4b7eae){updateTzCampaigns(_0x355202[_0x4362('0x32')])[_0x4362('0x1a')](function(_0x3ddfa3){updateTzVoiceQueues(_0x355202[_0x4362('0x32')])[_0x4362('0x1a')](function(_0x10819d){if(hasTZ)_0x45581a=_0x45581a[_0x4362('0x7e')](_0x4362('0x6a'),_0x4362('0x98'));var _0x1f17ce=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x40c4bf,_0x28b63b,_0x45581a,_0x355202['ListId'],_0x355202[_0x4362('0x99')]||null,NOW,NOW);if(_[_0x4362('0x1f')](_0x1e7891[_0x4362('0x45')])){_0x1f17ce+=_0x4362('0x9a');}_0x3d2834['push'](_0x1f17ce);if(_0x355202[_0x4362('0x91')]&&_0x355202[_0x4362('0x91')][_0x4362('0x1b')]){_0x3d2834['push'](insertCmContact(_0x355202[_0x4362('0x32')],_0x28b63b,_0x355202[_0x4362('0x91')],_0x1e7891));_0x3d2834[_0x4362('0x1c')](_0x4362('0x9b')+_0x28b63b+';');}BPromise['each'](_0x3d2834,handleQuery)[_0x4362('0x1a')](function(_0x274c8f){BPromise[_0x4362('0x1d')]([handleAdditionalPhones()])[_0x4362('0x1a')](function(){_0x3d2834=[];for(var _0x3fd715=0x0;_0x3fd715\x20\x20','root','server/files/tmp','existsSync','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','parse','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','catch','error','message','then','split','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat'];(function(_0x173abc,_0x298ee4){var _0x4f1afe=function(_0x498434){while(--_0x498434){_0x173abc['push'](_0x173abc['shift']());}};_0x4f1afe(++_0x298ee4);}(_0xb7aa,0x11a));var _0xab7a=function(_0x4c804b,_0x2194f6){_0x4c804b=_0x4c804b-0x0;var _0x13e04c=_0xb7aa[_0x4c804b];return _0x13e04c;};'use strict';var fs=require('fs');var path=require(_0xab7a('0x0'));var _=require(_0xab7a('0x1'));var Papa=require(_0xab7a('0x2'));var util=require(_0xab7a('0x3'));var BPromise=require(_0xab7a('0x4'));var moment=require(_0xab7a('0x5'));var squel=require(_0xab7a('0x6'));var Redis=require(_0xab7a('0x7'));var db=require(_0xab7a('0x8'))['db'];var config=require(_0xab7a('0x9'));var logger=require('../../../config/logger')(_0xab7a('0xa'));config[_0xab7a('0xb')]=_[_0xab7a('0xc')](config[_0xab7a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xab7a('0xd'))(new Redis(config[_0xab7a('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()['format'](_0xab7a('0xe'));var tempTableName=_0xab7a('0xf')+moment()[_0xab7a('0x10')](_0xab7a('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x40cc81){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))*$/[_0xab7a('0x12')](_0x40cc81);}function selectNotIn(_0x2e2e53,_0x2ac769,_0x402384,_0x1d741e,_0x563b84){return squel[_0xab7a('0x13')]()[_0xab7a('0x14')](_0xab7a('0x15'))[_0xab7a('0x16')](_0x1d741e)['join'](_0x2ac769,null,_0x2ac769+_0xab7a('0x17')+_0x1d741e+'.'+_0x402384)[_0xab7a('0x18')](_0x1d741e+'.'+_0x402384+_0xab7a('0x19')+_0x2e2e53+'.'+_0x402384)[_0xab7a('0x18')](_0x2ac769+'.dialCheckDuplicateType\x20IN\x20('+_0x563b84[_0xab7a('0x1a')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1cc43f,_0x4a78b8){promisesAdditionalPhones=[];promisesContact=[];return db[_0xab7a('0x1b')][_0xab7a('0x1c')](_0xab7a('0x1d')+tempTableName)[_0xab7a('0x1e')](function(_0x30146c){if(_0x30146c!==null){var _0x522f10=[];for(var _0x198e78=0x0;_0x198e78<_0x30146c[_0xab7a('0x1f')];_0x198e78++){var _0x5038c9=_0x30146c[_0x198e78];if(!_[_0xab7a('0x20')](_0x5038c9[_0xab7a('0x15')])){if(!_[_0xab7a('0x20')](_0x5038c9[_0xab7a('0x21')]))_0x522f10[_0xab7a('0x22')](insertAdditionalPhones(_0x5038c9));promisesContact[_0xab7a('0x22')]({'contact':_0x5038c9});}}}Promise[_0xab7a('0x23')](_0x522f10)['then'](function(){_0x1cc43f({'val':0x1});});})[_0xab7a('0x24')](function(_0x2ea6c8){logger[_0xab7a('0x25')](_0x2ea6c8[_0xab7a('0x26')]);});});}function insertAdditionalPhones(_0x2fa287){return new Promise(function(_0x37e3bc,_0x2179b5){var _0x2c7e6e=_0x2fa287[_0xab7a('0x21')];if(_[_0xab7a('0x20')](_0x2c7e6e))_0x2179b5({'val':0x0});else{var _0x255c2e=_0x2c7e6e['split'](';');var _0x4b65f0=[];orderBy=0x0;for(var _0x5c4c3e=0x0;_0x5c4c3e<_0x255c2e[_0xab7a('0x1f')];_0x5c4c3e++){_0x4b65f0[_0xab7a('0x22')](splitAdditionalPhone(_0x2fa287['id'],_0x255c2e[_0x5c4c3e]));}Promise[_0xab7a('0x23')](_0x4b65f0)[_0xab7a('0x27')](function(){_0x37e3bc({'val':_0x255c2e[_0xab7a('0x1f')]});});}});}function splitAdditionalPhone(_0x8c1e1f,_0x3324f2){return new Promise(function(_0x533680,_0x4d2ad4){var _0x2c62dc=_0x3324f2['split'](':');var _0x4d8e6b=_0x2c62dc[0x0];var _0x249904=_0x2c62dc[0x1];if(_0x249904!==''){var _0x570a8b=_0x249904[_0xab7a('0x28')]('|');var _0x1f5399=[];for(var _0x81dc99=0x0;_0x81dc99<_0x570a8b[_0xab7a('0x1f')];_0x81dc99++){if(_0x570a8b[_0x81dc99]!==''){var _0x2b0885=_['filter'](promisesAdditionalPhones,{'contactId':_0x8c1e1f,'phone':_0x570a8b[_0x81dc99]});if(_0x2b0885[_0xab7a('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0xab7a('0x22')]({'contactId':_0x8c1e1f,'contactTypeId':_0x4d8e6b,'phone':_0x570a8b[_0x81dc99],'orderBy':orderBy});}}}_0x533680({'ok':0x1});}else _0x533680({'res':0x0});});}function createAdditionalPhone(_0x26c106,_0x4e4514,_0x42f40b,_0x311dfa){var _0x32945c='';var _0x599375='';var _0x5d16f4=_0x42f40b[_0xab7a('0x28')]('§');_0x32945c=_0x5d16f4[0x0];if(_0x5d16f4['length']==0x2)_0x599375=_0x5d16f4[0x1];return new Promise(function(_0x3f5219,_0x3dfbaf){return db['CmContactHasItem'][_0xab7a('0x29')]({'where':{'CmContactId':_0x26c106,'item':_0x32945c}})[_0xab7a('0x27')](function(_0x467dce){if(_0x467dce){return db[_0xab7a('0x2a')][_0xab7a('0x2b')]({'ItemTypeId':_0x4e4514,'description':_0x599375,'OrderBy':_0x311dfa},{'where':{'CmContactId':_0x26c106,'item':_0x32945c}})[_0xab7a('0x27')](function(_0x58a509){_0x3f5219({'res':_0xab7a('0x2c')});});}else{return db['CmContactHasItem'][_0xab7a('0x2d')]({'CmContactId':_0x26c106,'item':_0x32945c,'ItemTypeId':_0x4e4514,'description':_0x599375,'OrderBy':_0x311dfa,'ItemClass':_0xab7a('0x2e')})[_0xab7a('0x27')](function(_0x4ead7a){_0x3f5219({'res':_0xab7a('0x2f')});});}});});}function updateContact(_0x54877c){return new Promise(function(_0x59fb42,_0x3db987){var _0x11a3d9=_0x54877c['id'];delete _0x54877c['id'];return db[_0xab7a('0x30')][_0xab7a('0x2b')](_0x54877c,{'where':{'id':_0x11a3d9}})[_0xab7a('0x27')](function(_0x2ab316){updatedRows+=0x1;return db[_0xab7a('0x31')]['update']({'phone':_0x54877c[_0xab7a('0x15')]},{'where':{'ContactId':_0x11a3d9}})[_0xab7a('0x27')](function(_0x2ac036){_0x59fb42({'ret':'OK'});});});});}function insertCmHopper(_0x151928,_0x4ad5ff,_0x2df446,_0x36cb51,_0x2377d9){var _0x517407=[_0xab7a('0x32'),_0xab7a('0x33'),_0xab7a('0x34'),_0xab7a('0x35'),_0x4ad5ff+'.'+_0x36cb51,'cm_contacts.createdAt',_0xab7a('0x36'),_0xab7a('0x37'),_0xab7a('0x38'),'\x22'+_0x2377d9+'\x22'];return squel['insert']()['into'](_0xab7a('0x39'))['fromQuery']([_0xab7a('0x15'),_0xab7a('0x3a'),'ContactId','ListId',_0x36cb51,_0xab7a('0x3b'),_0xab7a('0x3c'),_0xab7a('0x3d'),_0xab7a('0x3e'),'recallme'],squel['select']()[_0xab7a('0x3f')](_0x517407)[_0xab7a('0x16')](_0x4ad5ff)[_0xab7a('0x1a')](_0xab7a('0x40'),null,'cm_contacts.ListId\x20=\x20'+_0x4ad5ff+_0xab7a('0x41'))[_0xab7a('0x1a')](_0x2df446,null,_0x2df446+_0xab7a('0x17')+_0x4ad5ff+'.'+_0x36cb51)['where'](_0x4ad5ff+_0xab7a('0x42'),_0x151928)[_0xab7a('0x18')](_0xab7a('0x43'),NOW)[_0xab7a('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4ad5ff,_0x2df446,_0x36cb51,_0xab7a('0x39'),['\x22always\x22',_0xab7a('0x44')]))[_0xab7a('0x18')](_0xab7a('0x45'),selectNotIn(_0x4ad5ff,_0x2df446,_0x36cb51,'cm_hopper',[_0xab7a('0x46')])))[_0xab7a('0x47')]();}function insertCmHopperBlack(_0x294d16,_0x299a40,_0x5b0af5,_0x2ddf18){var _0x1a68a4=[_0xab7a('0x32'),_0xab7a('0x34'),'cm_contacts.ListId',_0x299a40+'.'+_0x2ddf18,_0xab7a('0x48'),'cm_contacts.updatedAt'];return squel[_0xab7a('0x49')]()['into'](_0xab7a('0x4a'))[_0xab7a('0x4b')](['phone',_0xab7a('0x4c'),_0xab7a('0x4d'),_0x2ddf18,_0xab7a('0x3b'),_0xab7a('0x3c')],squel[_0xab7a('0x13')]()[_0xab7a('0x3f')](_0x1a68a4)['from'](_0x299a40)['join'](_0xab7a('0x40'),null,_0xab7a('0x4e')+_0x299a40+_0xab7a('0x41'))[_0xab7a('0x1a')](_0x5b0af5,null,_0x5b0af5+_0xab7a('0x17')+_0x299a40+'.'+_0x2ddf18)[_0xab7a('0x18')](_0x299a40+_0xab7a('0x42'),_0x294d16)[_0xab7a('0x18')](_0xab7a('0x43'),NOW)[_0xab7a('0x18')](_0xab7a('0x45'),squel[_0xab7a('0x13')]()['field']('phone')[_0xab7a('0x16')](_0xab7a('0x4a'))[_0xab7a('0x18')]('ListId\x20=\x20?',_0x294d16)[_0xab7a('0x18')](_0x2ddf18+'\x20=\x20?',_0x299a40+'.'+_0x2ddf18)))[_0xab7a('0x47')]();}function insertCmHopperAdditionalPhones(_0x22beab){var _0x5c4478=['cm_hopper.id','cm_contact_has_items.item',_0xab7a('0x4f'),_0xab7a('0x50'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0xab7a('0x51')](_0xab7a('0x52'))[_0xab7a('0x4b')]([_0xab7a('0x53'),_0xab7a('0x15'),'OrderBy','createdAt',_0xab7a('0x3c')],squel['select']()[_0xab7a('0x3f')](_0x5c4478)['from'](_0xab7a('0x39'))[_0xab7a('0x1a')](_0xab7a('0x40'),null,_0xab7a('0x54'))[_0xab7a('0x1a')](_0xab7a('0x55'),null,_0xab7a('0x56'))[_0xab7a('0x18')](_0xab7a('0x57'),_0x22beab)[_0xab7a('0x18')](_0xab7a('0x43'),NOW))['toString']();}function insertCmContact(_0x3bfdae,_0xafeb36,_0x14d6bd,_0x443c2a){var _0x58e0ec=_['concat'](_['keys'](_0x443c2a),[_0xab7a('0x4d'),_0xab7a('0x58'),'createdAt',_0xab7a('0x3c')]);return squel[_0xab7a('0x49')]()[_0xab7a('0x51')](_0xab7a('0x40'))[_0xab7a('0x4b')](_0x58e0ec,squel[_0xab7a('0x13')]()[_0xab7a('0x3f')](_0x58e0ec)[_0xab7a('0x16')](_0xafeb36)[_0xab7a('0x18')]('('+_0x14d6bd[_0xab7a('0x1a')](',')+_0xab7a('0x59'),squel[_0xab7a('0x13')]()['fields'](_0x14d6bd)['from'](_0xab7a('0x40'))[_0xab7a('0x18')](_0xab7a('0x5a'),_0x3bfdae))['where'](_0xab7a('0x5b'),squel['select']()[_0xab7a('0x14')]('MIN(id)',_0xab7a('0x5c'))['from'](_0xafeb36)[_0xab7a('0x5d')](_0x14d6bd[_0xab7a('0x1a')](','))))[_0xab7a('0x47')]();}function handleStop(){logger[_0xab7a('0x5e')](_0xab7a('0x5f'));stopped=!![];}function handleUncaughtException(_0x13762f){logger[_0xab7a('0x25')](_0x13762f[_0xab7a('0x26')]);process[_0xab7a('0x60')](0x1);}function handleError(_0x47ba3a,_0x52a943){stats['errors'][_0xab7a('0x22')]({'name':_0x52a943[_0xab7a('0x61')],'message':_0x52a943['message'],'row':_0x47ba3a});}function handleQuery(_0x8213bb){logger[_0xab7a('0x5e')](_0x8213bb);return db[_0xab7a('0x1b')][_0xab7a('0x1c')](_0x8213bb)[_0xab7a('0x1e')](function(_0x107677){results[_0xab7a('0x22')](_0x107677);})['catch'](function(_0x4c84ff){logger[_0xab7a('0x25')](_0x4c84ff[_0xab7a('0x26')]);});}function main(_0x2f6789,_0x33fe13,_0xcd280a,_0x5e9ab8){logger[_0xab7a('0x5e')](_0xab7a('0x62'),_0x2f6789,JSON[_0xab7a('0x63')](_0x33fe13));process[_0xab7a('0x64')](_0xab7a('0x65'));var _0x5a4976=_0x33fe13[_0xab7a('0x66')];var _0x582a0a=_[_0xab7a('0x67')](_0x5a4976);var _0x45010e=_0x33fe13[_0xab7a('0x68')];var _0x54307b=path['join'](config['root'],'server/files/tmp',_0x45010e+_0xab7a('0x69'));logger[_0xab7a('0x5e')]('body',_0x33fe13);db[_0xab7a('0x6a')][_0xab7a('0x6b')]({'raw':!![],'attributes':['id',_0xab7a('0x6c')]})[_0xab7a('0x27')](function(_0x24f63f){for(var _0x3c7421=0x0;_0x3c7421<_0x24f63f[_0xab7a('0x1f')];_0x3c7421++){if(_0x24f63f[_0x3c7421][_0xab7a('0x6c')]in _0x5a4976){contactItemTypes[_0xab7a('0x22')](_0x24f63f[_0x3c7421]);delete _0x582a0a[_0x24f63f[_0x3c7421][_0xab7a('0x6c')]];hasAdditionalPhones=!![];}for(var _0x4cf3fc in _0x5a4976){if(_0x24f63f[_0x3c7421][_0xab7a('0x6c')]+_0xab7a('0x6d')===_0x4cf3fc){phoneDescriptions[_0xab7a('0x22')]({'itemTypeId':_0x24f63f[_0x3c7421]['id'],'description':_0x4cf3fc});delete _0x582a0a[_0x4cf3fc];}}}if(hasAdditionalPhones)_0x582a0a[_0xab7a('0x21')]='';var _0x3c3fe5=_['keys'](_0x582a0a)[_0xab7a('0x1a')]();logger[_0xab7a('0x5e')](_0xab7a('0x6e'),_0x3c3fe5);fs['writeFileSync'](_0x54307b,_0x3c3fe5+'\x0a');Papa['parse'](fs[_0xab7a('0x6f')](_0x2f6789),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4cc81a,_0x26282e){try{for(var _0x5d2fb1=0x0,_0x143d9c=[];_0x5d2fb1<_0x4cc81a[_0xab7a('0x70')][_0xab7a('0x1f')];_0x5d2fb1++){stats[_0xab7a('0x71')]+=0x1;if(_0x4cc81a[_0xab7a('0x72')][_0x5d2fb1]){handleError(_0x4cc81a[_0xab7a('0x70')][_0x5d2fb1],_0x4cc81a[_0xab7a('0x72')][_0x5d2fb1]);}else{var _0x4e3431=[];var _0x5267b7=[];var _0x4022e7={};for(var _0x258a04 in _0x5a4976){let _0x1e266d=contactItemTypes['find'](_0x2c54c3=>_0x2c54c3['name']===_0x258a04);let _0x443bff=contactItemTypes[_0xab7a('0x73')](_0x3dd4fc=>_0x3dd4fc[_0xab7a('0x6c')]+_0xab7a('0x6d')===_0x258a04);if(_[_0xab7a('0x20')](_0x1e266d)&&_[_0xab7a('0x20')](_0x443bff)){if(_0x5a4976[_0xab7a('0x74')](_0x258a04)){if(_0x4cc81a[_0xab7a('0x70')][_0x5d2fb1][_0x5a4976[_0x258a04]]){var _0x4e186b=_[_0xab7a('0x75')](_0x4cc81a[_0xab7a('0x70')][_0x5d2fb1][_0x5a4976[_0x258a04]][_0xab7a('0x76')](/"/g,'\x27'));switch(_0x258a04){case'scheduledat':var _0xfbebd7=moment(_0x4e186b,_0xab7a('0xe'),!![]);if(_0xfbebd7[_0xab7a('0x77')]()){_0x143d9c[_0xab7a('0x22')]('\x22'+_0x4e186b+'\x22');}else{_0x4e3431[_0xab7a('0x22')](_0xab7a('0x78'));}break;case _0xab7a('0x3d'):var _0x2925dc=parseInt(_0x4e186b);_0x4e186b=_[_0xab7a('0x79')](_0x2925dc)||_0x2925dc<0x0||_0x2925dc>0x4?_0x5e9ab8?0x3:0x2:_0x2925dc;_0x143d9c[_0xab7a('0x22')]('\x22'+_0x4e186b+'\x22');break;case _0xab7a('0x3e'):var _0x3667d2=parseInt(_0x4e186b);if(_[_0xab7a('0x7a')](_0x3667d2)&&_[_0xab7a('0x7b')](_0xcd280a,_0x3667d2)){_0x143d9c['push']('\x22'+_0x3667d2+'\x22');}else{_0x4e3431['push'](_0xab7a('0x7c'));}break;case _0xab7a('0x7d'):if(isEmail(_0x4e186b)){_0x143d9c['push']('\x22'+_0x4e186b+'\x22');}else{_0x4e3431[_0xab7a('0x22')]('email\x20wrong\x20format');}break;case _0xab7a('0x7e'):var _0x4bd04c=moment(_0x4e186b,_0xab7a('0x7f'),!![]);if(_0x4bd04c[_0xab7a('0x77')]()){_0x143d9c[_0xab7a('0x22')]('\x22'+_0x4e186b+'\x22');}else{_0x4e3431[_0xab7a('0x22')](_0xab7a('0x80'));}break;default:_0x143d9c[_0xab7a('0x22')]('\x22'+_0x4e186b+'\x22');}}else{switch(_0x258a04){case _0xab7a('0x81'):case _0xab7a('0x15'):_0x4e3431['push'](_0x258a04+_0xab7a('0x82'));break;default:_0x143d9c[_0xab7a('0x22')]('\x22\x22');}}}}else{var _0x4cf026='';if(!_[_0xab7a('0x20')](_0x1e266d)){if(!_0x4022e7[_0xab7a('0x74')](_0x1e266d['id'])){for(var _0x58c64d=0x0;_0x58c64d<_0x5a4976[_0x258a04][_0xab7a('0x1f')];_0x58c64d++){var _0x4e186b=_[_0xab7a('0x75')](_0x4cc81a[_0xab7a('0x70')][_0x5d2fb1][_0x5a4976[_0x258a04][_0x58c64d]]['replace'](/"/g,'\x27'));var _0x51364b=phoneDescriptions['find'](_0x3e3b6e=>_0x3e3b6e[_0xab7a('0x83')]===_0x1e266d['id']);if(!_[_0xab7a('0x20')](_0x51364b)){var _0x536376=_['trim'](_0x4cc81a[_0xab7a('0x70')][_0x5d2fb1][_0x5a4976[_0x51364b[_0xab7a('0x84')]][0x0]][_0xab7a('0x76')](/"/g,'\x27'));if(!_['isNil'](_0x536376))_0x4e186b=_0x4e186b+'§'+_0x536376;}if(_0x4cf026=='')_0x4cf026=_0x4e186b;else _0x4cf026+='|'+_0x4e186b;}_0x5267b7[_0xab7a('0x22')](_0x1e266d['id']+':'+_0x4cf026);_0x4022e7[_0x1e266d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x143d9c[_0xab7a('0x22')]('\x22'+_0x5267b7['join'](';')+'\x22');}if(_0x4e3431['length']){handleError(_0x4cc81a[_0xab7a('0x70')][_0x5d2fb1],{'code':_0xab7a('0x85'),'message':_0x4e3431[_0xab7a('0x1a')]()});}else{fs[_0xab7a('0x86')](_0x54307b,_0x143d9c[_0xab7a('0x1a')]()+'\x0a');}_0x143d9c=[];}if(!(stats[_0xab7a('0x71')]%0xc8)){socket[_0xab7a('0x87')](_0xab7a('0x88')+_0x45010e,stats);stats[_0xab7a('0x72')]=[];}}if(stopped){logger[_0xab7a('0x5e')](_0xab7a('0x89'));_0x26282e[_0xab7a('0x8a')]();}}catch(_0x20f378){handleError(_0x4cc81a[_0xab7a('0x70')][_0x5d2fb1],{'code':_0xab7a('0x8b'),'message':_0x20f378[_0xab7a('0x26')]});logger[_0xab7a('0x25')](_0xab7a('0x8c'),_0x20f378[_0xab7a('0x26')]);}},'complete':function(){try{var _0xd485af=[];var _0x23976c=tempTableName;_0xd485af[_0xab7a('0x22')](_0xab7a('0x8d')+_0x23976c+_0xab7a('0x8e'));logger[_0xab7a('0x5e')](_0xab7a('0x8f'),contactItemTypes[_0xab7a('0x1f')]);var _0x2d496c=util[_0xab7a('0x10')](_0xab7a('0x90'),_0x54307b,_0x23976c,_0x3c3fe5,_0x33fe13['ListId'],_0x33fe13[_0xab7a('0x58')]||null,NOW,NOW);if(_['isNil'](_0x5a4976[_0xab7a('0x3a')])){_0x2d496c+=_0xab7a('0x91');}_0xd485af[_0xab7a('0x22')](_0x2d496c);BPromise[_0xab7a('0x92')](_0xd485af,handleQuery)[_0xab7a('0x27')](function(_0x41e4a7){BPromise[_0xab7a('0x23')]([handleAdditionalPhones()])['then'](function(){_0xd485af=[];for(var _0x50f918=0x0;_0x50f918\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','length','phone','isNil','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','update','updated','PHONE','inserted','CmContact','CmHopper','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','UserId','fields','join','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','ContactId','updatedAt','cm_contacts','.CmListId\x20=\x20?','field','cm_hopper_black','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','Received\x20SIGINT','message','exit','errors','code','sequelize','spread','info','stringify','send','start','binding','clone','server/files/tmp','.csv','body','ContactItemType','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','includes','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','CompanyId',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','each','finish','unlink'];(function(_0x5b0448,_0x273a44){var _0xf900a8=function(_0x37bae3){while(--_0x37bae3){_0x5b0448['push'](_0x5b0448['shift']());}};_0xf900a8(++_0x273a44);}(_0xcf55,0x14b));var _0x5cf5=function(_0x5ef37c,_0x2df5ff){_0x5ef37c=_0x5ef37c-0x0;var _0x308937=_0xcf55[_0x5ef37c];return _0x308937;};'use strict';var fs=require('fs');var path=require(_0x5cf5('0x0'));var _=require(_0x5cf5('0x1'));var Papa=require(_0x5cf5('0x2'));var util=require(_0x5cf5('0x3'));var BPromise=require(_0x5cf5('0x4'));var moment=require(_0x5cf5('0x5'));var squel=require(_0x5cf5('0x6'));var Redis=require('ioredis');var db=require(_0x5cf5('0x7'))['db'];var config=require(_0x5cf5('0x8'));var logger=require(_0x5cf5('0x9'))('import');config[_0x5cf5('0xa')]=_[_0x5cf5('0xb')](config[_0x5cf5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5cf5('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x5cf5('0xd')+moment()[_0x5cf5('0xe')](_0x5cf5('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3e516f){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))*$/[_0x5cf5('0x10')](_0x3e516f);}function selectNotIn(_0x46d180,_0x3be7b7,_0x1be9e9,_0xdffc26,_0x4c5a96){return squel[_0x5cf5('0x11')]()['field']('phone')[_0x5cf5('0x12')](_0xdffc26)['join'](_0x3be7b7,null,_0x3be7b7+_0x5cf5('0x13')+_0xdffc26+'.'+_0x1be9e9)[_0x5cf5('0x14')](_0xdffc26+'.'+_0x1be9e9+_0x5cf5('0x15')+_0x46d180+'.'+_0x1be9e9)[_0x5cf5('0x14')](_0x3be7b7+_0x5cf5('0x16')+_0x4c5a96['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x29bf9a,_0x570642){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x5cf5('0x17')](_0x5cf5('0x18')+tempTableName)['spread'](function(_0x450344){if(_0x450344!==null){var _0xbc9b6f=[];for(var _0x5e4f9d=0x0;_0x5e4f9d<_0x450344[_0x5cf5('0x19')];_0x5e4f9d++){var _0x2031a9=_0x450344[_0x5e4f9d];if(!_['isNil'](_0x2031a9[_0x5cf5('0x1a')])){if(!_[_0x5cf5('0x1b')](_0x2031a9[_0x5cf5('0x1c')]))_0xbc9b6f[_0x5cf5('0x1d')](insertAdditionalPhones(_0x2031a9));promisesContact[_0x5cf5('0x1d')]({'contact':_0x2031a9});}}}Promise[_0x5cf5('0x1e')](_0xbc9b6f)[_0x5cf5('0x1f')](function(){_0x29bf9a({'val':0x1});});})[_0x5cf5('0x20')](function(_0x42f81d){logger[_0x5cf5('0x21')](_0x42f81d['message']);});});}function insertAdditionalPhones(_0x52c9d7){return new Promise(function(_0x21a995,_0x34bdc7){var _0x59e6d8=_0x52c9d7[_0x5cf5('0x1c')];if(_[_0x5cf5('0x1b')](_0x59e6d8))_0x34bdc7({'val':0x0});else{var _0x56b245=_0x59e6d8['split'](';');var _0x22672d=[];orderBy=0x0;for(var _0x408413=0x0;_0x408413<_0x56b245[_0x5cf5('0x19')];_0x408413++){_0x22672d[_0x5cf5('0x1d')](splitAdditionalPhone(_0x52c9d7['id'],_0x56b245[_0x408413]));}Promise[_0x5cf5('0x1e')](_0x22672d)[_0x5cf5('0x1f')](function(){_0x21a995({'val':_0x56b245[_0x5cf5('0x19')]});});}});}function splitAdditionalPhone(_0x267301,_0x145988){return new Promise(function(_0xdd3bdf,_0x2267e0){var _0x240cc2=_0x145988[_0x5cf5('0x22')](':');var _0x45a0be=_0x240cc2[0x0];var _0x4ea372=_0x240cc2[0x1];if(_0x4ea372!==''){var _0x4cf4e6=_0x4ea372['split']('|');var _0xf7bc05=[];for(var _0x3220f4=0x0;_0x3220f4<_0x4cf4e6['length'];_0x3220f4++){if(_0x4cf4e6[_0x3220f4]!==''){var _0x31acff=_[_0x5cf5('0x23')](promisesAdditionalPhones,{'contactId':_0x267301,'phone':_0x4cf4e6[_0x3220f4]});if(_0x31acff[_0x5cf5('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x5cf5('0x1d')]({'contactId':_0x267301,'contactTypeId':_0x45a0be,'phone':_0x4cf4e6[_0x3220f4],'orderBy':orderBy});}}}_0xdd3bdf({'ok':0x1});}else _0xdd3bdf({'res':0x0});});}function createAdditionalPhone(_0xc37815,_0x5cd51e,_0x326dae,_0x55b97e){var _0x4f3401='';var _0x5915ca='';var _0x46ffe6=_0x326dae[_0x5cf5('0x22')]('§');_0x4f3401=_0x46ffe6[0x0];if(_0x46ffe6[_0x5cf5('0x19')]==0x2)_0x5915ca=_0x46ffe6[0x1];return new Promise(function(_0x206e0b,_0x15693a){return db[_0x5cf5('0x24')]['findOne']({'where':{'CmContactId':_0xc37815,'item':_0x4f3401}})[_0x5cf5('0x1f')](function(_0xd6e27b){if(_0xd6e27b){return db[_0x5cf5('0x24')][_0x5cf5('0x25')]({'ItemTypeId':_0x5cd51e,'description':_0x5915ca,'OrderBy':_0x55b97e},{'where':{'CmContactId':_0xc37815,'item':_0x4f3401}})[_0x5cf5('0x1f')](function(_0x52084e){_0x206e0b({'res':_0x5cf5('0x26')});});}else{return db[_0x5cf5('0x24')]['create']({'CmContactId':_0xc37815,'item':_0x4f3401,'ItemTypeId':_0x5cd51e,'description':_0x5915ca,'OrderBy':_0x55b97e,'ItemClass':_0x5cf5('0x27')})[_0x5cf5('0x1f')](function(_0x4f54e5){_0x206e0b({'res':_0x5cf5('0x28')});});}});});}function updateContact(_0x21e060){return new Promise(function(_0x2c6a13,_0x147510){var _0x47d0a0=_0x21e060['id'];delete _0x21e060['id'];return db[_0x5cf5('0x29')][_0x5cf5('0x25')](_0x21e060,{'where':{'id':_0x47d0a0}})[_0x5cf5('0x1f')](function(_0x55edba){updatedRows+=0x1;return db[_0x5cf5('0x2a')][_0x5cf5('0x25')]({'phone':_0x21e060['phone']},{'where':{'ContactId':_0x47d0a0}})['then'](function(_0x1e23a8){_0x2c6a13({'ret':'OK'});});});});}function insertCmHopper(_0x5b820d,_0x264c21,_0x197358,_0x119f29,_0x2d126b){var _0x21cc28=['cm_contacts.phone',_0x5cf5('0x2b'),'cm_contacts.id','cm_contacts.ListId',_0x264c21+'.'+_0x119f29,_0x5cf5('0x2c'),_0x5cf5('0x2d'),_0x5cf5('0x2e'),'cm_contacts.UserId','\x22'+_0x2d126b+'\x22'];return squel[_0x5cf5('0x2f')]()[_0x5cf5('0x30')](_0x5cf5('0x31'))[_0x5cf5('0x32')]([_0x5cf5('0x1a'),_0x5cf5('0x33'),'ContactId',_0x5cf5('0x34'),_0x119f29,_0x5cf5('0x35'),'updatedAt','priority',_0x5cf5('0x36'),'recallme'],squel[_0x5cf5('0x11')]()[_0x5cf5('0x37')](_0x21cc28)['from'](_0x264c21)[_0x5cf5('0x38')]('cm_contacts',null,_0x5cf5('0x39')+_0x264c21+_0x5cf5('0x3a'))[_0x5cf5('0x38')](_0x197358,null,_0x197358+'.id\x20=\x20'+_0x264c21+'.'+_0x119f29)[_0x5cf5('0x14')](_0x264c21+'.CmListId\x20=\x20?',_0x5b820d)['where'](_0x5cf5('0x3b'),NOW)['where'](_0x5cf5('0x3c'),selectNotIn(_0x264c21,_0x197358,_0x119f29,_0x5cf5('0x31'),[_0x5cf5('0x3d'),_0x5cf5('0x3e')]))[_0x5cf5('0x14')](_0x5cf5('0x3c'),selectNotIn(_0x264c21,_0x197358,_0x119f29,'cm_hopper',['\x22always\x22'])))[_0x5cf5('0x3f')]();}function insertCmHopperBlack(_0xdd3f6,_0x31aeea,_0x284d8d,_0x5c4542){var _0x23b89b=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x31aeea+'.'+_0x5c4542,_0x5cf5('0x2c'),_0x5cf5('0x2d')];return squel[_0x5cf5('0x2f')]()['into']('cm_hopper_black')[_0x5cf5('0x32')](['phone',_0x5cf5('0x40'),_0x5cf5('0x34'),_0x5c4542,_0x5cf5('0x35'),_0x5cf5('0x41')],squel[_0x5cf5('0x11')]()[_0x5cf5('0x37')](_0x23b89b)['from'](_0x31aeea)[_0x5cf5('0x38')](_0x5cf5('0x42'),null,_0x5cf5('0x39')+_0x31aeea+_0x5cf5('0x3a'))[_0x5cf5('0x38')](_0x284d8d,null,_0x284d8d+_0x5cf5('0x13')+_0x31aeea+'.'+_0x5c4542)[_0x5cf5('0x14')](_0x31aeea+_0x5cf5('0x43'),_0xdd3f6)[_0x5cf5('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5cf5('0x14')](_0x5cf5('0x3c'),squel[_0x5cf5('0x11')]()[_0x5cf5('0x44')]('phone')[_0x5cf5('0x12')](_0x5cf5('0x45'))[_0x5cf5('0x14')]('ListId\x20=\x20?',_0xdd3f6)[_0x5cf5('0x14')](_0x5c4542+_0x5cf5('0x46'),_0x31aeea+'.'+_0x5c4542)))[_0x5cf5('0x3f')]();}function insertCmHopperAdditionalPhones(_0x41a86c){var _0x10acec=[_0x5cf5('0x47'),'cm_contact_has_items.item',_0x5cf5('0x48'),_0x5cf5('0x49'),_0x5cf5('0x4a')];return squel[_0x5cf5('0x2f')]()[_0x5cf5('0x30')](_0x5cf5('0x4b'))[_0x5cf5('0x32')]([_0x5cf5('0x4c'),_0x5cf5('0x1a'),_0x5cf5('0x4d'),_0x5cf5('0x35'),_0x5cf5('0x41')],squel['select']()[_0x5cf5('0x37')](_0x10acec)[_0x5cf5('0x12')](_0x5cf5('0x31'))['join'](_0x5cf5('0x42'),null,_0x5cf5('0x4e'))[_0x5cf5('0x38')](_0x5cf5('0x4f'),null,_0x5cf5('0x50'))[_0x5cf5('0x14')](_0x5cf5('0x51'),_0x41a86c)[_0x5cf5('0x14')](_0x5cf5('0x3b'),NOW))[_0x5cf5('0x3f')]();}function insertCmContact(_0x2bf664,_0x24010e,_0x4ef312,_0x8468b0){var _0x35a239=_[_0x5cf5('0x52')](_[_0x5cf5('0x53')](_0x8468b0),[_0x5cf5('0x34'),'CompanyId',_0x5cf5('0x35'),_0x5cf5('0x41')]);return squel[_0x5cf5('0x2f')]()['into']('cm_contacts')['fromQuery'](_0x35a239,squel['select']()[_0x5cf5('0x37')](_0x35a239)[_0x5cf5('0x12')](_0x24010e)[_0x5cf5('0x14')]('('+_0x4ef312[_0x5cf5('0x38')](',')+_0x5cf5('0x54'),squel[_0x5cf5('0x11')]()['fields'](_0x4ef312)['from']('cm_contacts')[_0x5cf5('0x14')](_0x5cf5('0x55'),_0x2bf664))[_0x5cf5('0x14')](_0x5cf5('0x56'),squel['select']()['field'](_0x5cf5('0x57'),_0x5cf5('0x58'))[_0x5cf5('0x12')](_0x24010e)['group'](_0x4ef312[_0x5cf5('0x38')](','))))['toString']();}function handleStop(){logger['info'](_0x5cf5('0x59'));stopped=!![];}function handleUncaughtException(_0x50d5af){logger[_0x5cf5('0x21')](_0x50d5af[_0x5cf5('0x5a')]);process[_0x5cf5('0x5b')](0x1);}function handleError(_0x45eda8,_0x26e305){stats[_0x5cf5('0x5c')][_0x5cf5('0x1d')]({'name':_0x26e305[_0x5cf5('0x5d')],'message':_0x26e305[_0x5cf5('0x5a')],'row':_0x45eda8});}function handleQuery(_0x3c64f0){logger['info'](_0x3c64f0);return db[_0x5cf5('0x5e')][_0x5cf5('0x17')](_0x3c64f0)[_0x5cf5('0x5f')](function(_0x112bfa){results[_0x5cf5('0x1d')](_0x112bfa);})[_0x5cf5('0x20')](function(_0x5586c1){logger[_0x5cf5('0x21')](_0x5586c1['message']);});}function main(_0x5b8fd2,_0x519041,_0x3c0fb4,_0x4ee923){logger[_0x5cf5('0x60')]('main',_0x5b8fd2,JSON[_0x5cf5('0x61')](_0x519041));process[_0x5cf5('0x62')](_0x5cf5('0x63'));var _0x4b231e=_0x519041[_0x5cf5('0x64')];var _0x48bacb=_[_0x5cf5('0x65')](_0x4b231e);var _0x4689cf=_0x519041['socket_timestamp'];var _0x25a59e=path[_0x5cf5('0x38')](config['root'],_0x5cf5('0x66'),_0x4689cf+_0x5cf5('0x67'));logger[_0x5cf5('0x60')](_0x5cf5('0x68'),_0x519041);db[_0x5cf5('0x69')]['findAll']({'raw':!![],'attributes':['id',_0x5cf5('0x6a')]})[_0x5cf5('0x1f')](function(_0x5485f9){for(var _0x12060f=0x0;_0x12060f<_0x5485f9[_0x5cf5('0x19')];_0x12060f++){if(_0x5485f9[_0x12060f][_0x5cf5('0x6a')]in _0x4b231e){contactItemTypes[_0x5cf5('0x1d')](_0x5485f9[_0x12060f]);delete _0x48bacb[_0x5485f9[_0x12060f][_0x5cf5('0x6a')]];hasAdditionalPhones=!![];}for(var _0x32eefa in _0x4b231e){if(_0x5485f9[_0x12060f][_0x5cf5('0x6a')]+_0x5cf5('0x6b')===_0x32eefa){phoneDescriptions[_0x5cf5('0x1d')]({'itemTypeId':_0x5485f9[_0x12060f]['id'],'description':_0x32eefa});delete _0x48bacb[_0x32eefa];}}}if(hasAdditionalPhones)_0x48bacb['AdditionalPhones']='';var _0x54827d=_[_0x5cf5('0x53')](_0x48bacb)[_0x5cf5('0x38')]();logger['info'](_0x5cf5('0x6c'),_0x54827d);fs[_0x5cf5('0x6d')](_0x25a59e,_0x54827d+'\x0a');Papa[_0x5cf5('0x6e')](fs[_0x5cf5('0x6f')](_0x5b8fd2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5506d4,_0x4aaf42){try{for(var _0x3cb1a8=0x0,_0x583f34=[];_0x3cb1a8<_0x5506d4[_0x5cf5('0x70')][_0x5cf5('0x19')];_0x3cb1a8++){stats[_0x5cf5('0x71')]+=0x1;if(_0x5506d4[_0x5cf5('0x5c')][_0x3cb1a8]){handleError(_0x5506d4[_0x5cf5('0x70')][_0x3cb1a8],_0x5506d4[_0x5cf5('0x5c')][_0x3cb1a8]);}else{var _0x1635b9=[];var _0x2acad3=[];var _0x1a483b={};for(var _0x593758 in _0x4b231e){let _0x23fca4=contactItemTypes['find'](_0x489050=>_0x489050['name']===_0x593758);let _0x459063=contactItemTypes[_0x5cf5('0x72')](_0x3d5915=>_0x3d5915[_0x5cf5('0x6a')]+_0x5cf5('0x6b')===_0x593758);if(_[_0x5cf5('0x1b')](_0x23fca4)&&_[_0x5cf5('0x1b')](_0x459063)){if(_0x4b231e[_0x5cf5('0x73')](_0x593758)){if(_0x5506d4['data'][_0x3cb1a8][_0x4b231e[_0x593758]]){var _0x52a534=_[_0x5cf5('0x74')](_0x5506d4['data'][_0x3cb1a8][_0x4b231e[_0x593758]][_0x5cf5('0x75')](/"/g,'\x27'));switch(_0x593758){case'scheduledat':var _0x844408=moment(_0x52a534,_0x5cf5('0x76'),!![]);if(_0x844408['isValid']()){_0x583f34[_0x5cf5('0x1d')]('\x22'+_0x52a534+'\x22');}else{_0x1635b9[_0x5cf5('0x1d')](_0x5cf5('0x77'));}break;case _0x5cf5('0x78'):var _0x454b0d=parseInt(_0x52a534);_0x52a534=_[_0x5cf5('0x79')](_0x454b0d)||_0x454b0d<0x0||_0x454b0d>0x4?_0x4ee923?0x3:0x2:_0x454b0d;_0x583f34[_0x5cf5('0x1d')]('\x22'+_0x52a534+'\x22');break;case _0x5cf5('0x36'):var _0x4ac01f=parseInt(_0x52a534);if(_['isNumber'](_0x4ac01f)&&_[_0x5cf5('0x7a')](_0x3c0fb4,_0x4ac01f)){_0x583f34[_0x5cf5('0x1d')]('\x22'+_0x4ac01f+'\x22');}else{_0x1635b9[_0x5cf5('0x1d')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x52a534)){_0x583f34[_0x5cf5('0x1d')]('\x22'+_0x52a534+'\x22');}else{_0x1635b9['push'](_0x5cf5('0x7b'));}break;case _0x5cf5('0x7c'):var _0x5a340f=moment(_0x52a534,_0x5cf5('0x7d'),!![]);if(_0x5a340f[_0x5cf5('0x7e')]()){_0x583f34[_0x5cf5('0x1d')]('\x22'+_0x52a534+'\x22');}else{_0x1635b9[_0x5cf5('0x1d')](_0x5cf5('0x7f'));}break;default:_0x583f34['push']('\x22'+_0x52a534+'\x22');}}else{switch(_0x593758){case _0x5cf5('0x80'):case _0x5cf5('0x1a'):_0x1635b9[_0x5cf5('0x1d')](_0x593758+_0x5cf5('0x81'));break;default:_0x583f34[_0x5cf5('0x1d')]('\x22\x22');}}}}else{var _0x5b9f22='';if(!_[_0x5cf5('0x1b')](_0x23fca4)){if(!_0x1a483b[_0x5cf5('0x73')](_0x23fca4['id'])){for(var _0x404043=0x0;_0x404043<_0x4b231e[_0x593758]['length'];_0x404043++){var _0x52a534=_[_0x5cf5('0x74')](_0x5506d4[_0x5cf5('0x70')][_0x3cb1a8][_0x4b231e[_0x593758][_0x404043]]['replace'](/"/g,'\x27'));var _0x21ca9b=phoneDescriptions[_0x5cf5('0x72')](_0x17bcbb=>_0x17bcbb[_0x5cf5('0x82')]===_0x23fca4['id']);if(!_[_0x5cf5('0x1b')](_0x21ca9b)){var _0x49b396=_[_0x5cf5('0x74')](_0x5506d4[_0x5cf5('0x70')][_0x3cb1a8][_0x4b231e[_0x21ca9b[_0x5cf5('0x83')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x5cf5('0x1b')](_0x49b396))_0x52a534=_0x52a534+'§'+_0x49b396;}if(_0x5b9f22=='')_0x5b9f22=_0x52a534;else _0x5b9f22+='|'+_0x52a534;}_0x2acad3[_0x5cf5('0x1d')](_0x23fca4['id']+':'+_0x5b9f22);_0x1a483b[_0x23fca4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x583f34['push']('\x22'+_0x2acad3['join'](';')+'\x22');}if(_0x1635b9[_0x5cf5('0x19')]){handleError(_0x5506d4[_0x5cf5('0x70')][_0x3cb1a8],{'code':_0x5cf5('0x84'),'message':_0x1635b9['join']()});}else{fs[_0x5cf5('0x85')](_0x25a59e,_0x583f34[_0x5cf5('0x38')]()+'\x0a');}_0x583f34=[];}if(!(stats[_0x5cf5('0x71')]%0xc8)){socket[_0x5cf5('0x86')](_0x5cf5('0x87')+_0x4689cf,stats);stats[_0x5cf5('0x5c')]=[];}}if(stopped){logger[_0x5cf5('0x60')](_0x5cf5('0x88'));_0x4aaf42['abort']();}}catch(_0x3ff2f){handleError(_0x5506d4[_0x5cf5('0x70')][_0x3cb1a8],{'code':'SystemError','message':_0x3ff2f[_0x5cf5('0x5a')]});logger[_0x5cf5('0x21')]('step',_0x3ff2f['message']);}},'complete':function(){try{var _0x5ad150=[];var _0x27f9c2=tempTableName;_0x5ad150[_0x5cf5('0x1d')](_0x5cf5('0x89')+_0x27f9c2+_0x5cf5('0x8a'));logger[_0x5cf5('0x60')]('CIS\x20len',contactItemTypes[_0x5cf5('0x19')]);var _0x26da3c=util[_0x5cf5('0xe')](_0x5cf5('0x8b'),_0x25a59e,_0x27f9c2,_0x54827d,_0x519041[_0x5cf5('0x34')],_0x519041[_0x5cf5('0x8c')]||null,NOW,NOW);if(_[_0x5cf5('0x1b')](_0x4b231e[_0x5cf5('0x33')])){_0x26da3c+=_0x5cf5('0x8d');}_0x5ad150[_0x5cf5('0x1d')](_0x26da3c);BPromise['each'](_0x5ad150,handleQuery)[_0x5cf5('0x1f')](function(_0x53dc58){BPromise[_0x5cf5('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x5ad150=[];for(var _0x487f16=0x0;_0x487f16\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.to','i.UserId','openchannel','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','c.lastName','Contact.lastName','Contact.email','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)'];(function(_0x587ff4,_0x551480){var _0xf123da=function(_0x52ef10){while(--_0x52ef10){_0x587ff4['push'](_0x587ff4['shift']());}};_0xf123da(++_0x551480);}(_0x2f72,0x14c));var _0x22f7=function(_0x16022c,_0x5508cb){_0x16022c=_0x16022c-0x0;var _0x2bbe54=_0x2f72[_0x16022c];return _0x2bbe54;};'use strict';var _=require(_0x22f7('0x0'));var squel=require(_0x22f7('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x22f7('0x2'));var updateInteraction=require('./update-interaction')[_0x22f7('0x3')];var utils=require(_0x22f7('0x4'));var db=require(_0x22f7('0x5'))['db'];function skipInteractionsQuery(_0xc4c9b7,_0x27ed4b,_0x4a4791){var _0x3435ed=![];var _0x644c8f=utils[_0x22f7('0x6')](_0xc4c9b7);if(_0x27ed4b[_0x22f7('0x7')]===_0x22f7('0x8')&&!_0x4a4791['search']&&!_0x4a4791[_0x644c8f]){_0x3435ed=!![];}return _0x3435ed;}function getTagsQuery(){return squel[_0x22f7('0x9')]()['field']('id')[_0x22f7('0xa')](_0x22f7('0xb'))[_0x22f7('0xa')](_0x22f7('0xc'))[_0x22f7('0xd')](_0x22f7('0xe'));}function getUsersQuery(_0x29c749,_0x14b1ab){var _0x4984d9=utils[_0x22f7('0xf')](_0x29c749);var _0x911325='user_has_'+_0x29c749+'_interactions';var _0x3f4646=squel['select']()['field'](_0x22f7('0x10'))['field'](_0x22f7('0x11'))[_0x22f7('0xa')](_0x22f7('0x12')+_0x4984d9)['from'](_0x911325,'ui')[_0x22f7('0x13')]('users','u',_0x22f7('0x14'));if(_0x14b1ab['length']>0x0){_0x3f4646[_0x22f7('0x15')](_0x22f7('0x12')+_0x4984d9+'\x20IN\x20?',_[_0x22f7('0x16')](_0x14b1ab,'id'));}return _0x3f4646;}function getInteractionsQuery(_0x4c4738){var _0x4e5e47=utils[_0x22f7('0x17')](_0x4c4738);var _0x4a3203=utils[_0x22f7('0x6')](_0x4c4738);var _0xc7700=utils['getInteractionFK'](_0x4c4738);return squel[_0x22f7('0x9')]()[_0x22f7('0xd')](_0x4e5e47[_0x22f7('0x18')],'i')[_0x22f7('0x13')](_0x22f7('0x19'),'c',_0x22f7('0x1a'))[_0x22f7('0x13')]('users','o','o.id\x20=\x20i.UserId')[_0x22f7('0x13')](_0x4e5e47[_0x22f7('0x1b')],'a',_0x22f7('0x1c')+_0x4a3203)[_0x22f7('0x13')](_0x4e5e47['messages'],'me',_0x22f7('0x1d')+_0xc7700+_0x22f7('0x1e'))[_0x22f7('0x13')](_0x4e5e47[_0x22f7('0x1f')],'it',_0x22f7('0x20')+_0xc7700+'\x20=\x20i.id')[_0x22f7('0x13')](_0x22f7('0xe'),'t',_0x22f7('0x21'));}function getSqlClauses(){var _0x411620={'body':squel[_0x22f7('0x22')](),'contact':squel[_0x22f7('0x22')](),'default':squel[_0x22f7('0x22')](),'fields':squel[_0x22f7('0x22')](),'filter':squel[_0x22f7('0x22')](),'read':squel[_0x22f7('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x22f7('0x22')]()};return _0x411620;}function parseTagParameter(_0x4c2488){var _0x84825b=squel['expr']();if(_0x4c2488){var _0x14aa11=utils[_0x22f7('0x23')](_0x4c2488);_0x14aa11[_0x22f7('0x24')](function(_0x1b6e70){_0x84825b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1b6e70+',%');});}return _0x84825b;}function parseReadParameter(_0x3fe4f3){var _0x2b6b83='';if(_0x3fe4f3){_0x2b6b83=_0x22f7('0x25');if(_0x3fe4f3==='1'){_0x2b6b83=_0x2b6b83[_0x22f7('0x26')](_0x22f7('0x27'),'=');}else{_0x2b6b83=_0x2b6b83[_0x22f7('0x26')](_0x22f7('0x27'),'>');}}return _0x2b6b83;}function parseSearchFilter(_0x2ff150,_0x485c68){var _0x12ded7=squel['expr']();if(_0x485c68){var _0x3fcb4c=_0x485c68['replace']('\x5c','\x5c\x5c')[_0x22f7('0x26')](/'/g,'\x27\x27');if(qs[_0x22f7('0x28')](_0x3fcb4c)){_0x12ded7['or']('i.id\x20LIKE\x20?',_0x3fcb4c+'%');if([_0x22f7('0x29'),'whatsapp'][_0x22f7('0x2a')](_0x2ff150)){_0x12ded7['or'](_0x22f7('0x2b'),_0x3fcb4c+'%');}else if(_0x2ff150===_0x22f7('0x2c')){_0x12ded7['or'](_0x22f7('0x2d'),_0x3fcb4c+'%');}else if(_0x2ff150==='openchannel'){_0x12ded7['or'](_0x22f7('0x2e'),_0x3fcb4c+'%');}}else if(_0x2ff150===_0x22f7('0x2f')&&qs[_0x22f7('0x30')](_0x3fcb4c)){_0x12ded7['or']('c.email\x20LIKE\x20?',_0x3fcb4c+'%');}else{if(_0x2ff150===_0x22f7('0x2f')){_0x12ded7['or'](_0x22f7('0x31'),qs['getFullTextValue'](_0x3fcb4c,!![]))['or'](_0x22f7('0x32'),qs[_0x22f7('0x33')](_0x3fcb4c));}else if(_0x2ff150!==_0x22f7('0x2c')){_0x12ded7['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x22f7('0x33')](_0x3fcb4c));}_0x12ded7['or'](_0x22f7('0x34'),qs[_0x22f7('0x33')](_0x3fcb4c,!![]),null);}}return _0x12ded7;}function parseAdvancedSearchFilter(_0x38808b,_0x372642){var _0x345d13=getSqlClauses();var _0x296eec=as[_0x22f7('0x35')](_0x38808b);var _0xee6ebb=_0x296eec[_0x22f7('0x36')];for(var _0x269008=0x0;_0x269008<_0x296eec[_0x22f7('0x37')][_0x22f7('0x38')];_0x269008++){var _0x12c29e=_0x296eec['conditions'][_0x269008];var _0x3ce39b='i';var _0x1bfe3f=_['find'](_0x372642,[_0x22f7('0xb'),_0x12c29e[_0x22f7('0xa')]]);if(_0x1bfe3f){var _0x18c66c=as['buildExpression'](_0x3ce39b,_0x1bfe3f[_0x22f7('0x39')],_0x12c29e);_0x345d13[_0x22f7('0x3a')][_0xee6ebb](_0x18c66c['text'],_0x18c66c[_0x22f7('0x3b')][_0x22f7('0x3c')],_0x18c66c[_0x22f7('0x3b')][_0x22f7('0x3d')]);}else{switch(_0x12c29e[_0x22f7('0xa')]){case _0x22f7('0x3e'):var _0x430a6a=parseReadParameter(_0x12c29e[_0x22f7('0x3b')]);_0x345d13[_0x22f7('0x3f')]['and'](_0x430a6a);break;case'Contact':if(_0x12c29e[_0x22f7('0x40')]===_0x22f7('0x41')){if(_0x12c29e[_0x22f7('0x3b')][_0x22f7('0x42')]('\x20')['length']>0x1){_0x345d13[_0x22f7('0x43')][_0xee6ebb](_0x22f7('0x34'),qs[_0x22f7('0x33')](_0x12c29e['value'],!![]),null);}else{var _0x48ded7='%'+_0x12c29e[_0x22f7('0x3b')]+'%';_0x345d13[_0x22f7('0x43')][_0xee6ebb](_0x22f7('0x44'),_0x48ded7,_0x48ded7,_0x48ded7);}}else{_0x1bfe3f=_['find'](_0x372642,[_0x22f7('0xb'),_0x22f7('0x45')]);_0x12c29e[_0x22f7('0xa')]=_0x22f7('0x45');_0x18c66c=as[_0x22f7('0x46')](_0x3ce39b,_0x1bfe3f['type'],_0x12c29e);_0x345d13[_0x22f7('0x43')][_0xee6ebb](_0x18c66c[_0x22f7('0x47')],_0x18c66c[_0x22f7('0x3b')][_0x22f7('0x3c')],_0x18c66c['value'][_0x22f7('0x3d')]);}break;case _0x22f7('0x48'):var _0x237abe=_0x12c29e[_0x22f7('0x3b')][_0x22f7('0x42')](',')[_0x22f7('0x16')](function(_0x4e5251){return Number(_0x4e5251);});var _0x2a642d=parseTagParameter(_0x237abe);_0x345d13[_0x22f7('0x49')][_0x22f7('0x4a')]['and'](_0x2a642d);_0x345d13[_0x22f7('0x49')][_0x22f7('0x4b')]=_0x237abe;break;case _0x22f7('0x4c'):if(_0x12c29e['operator']==='$substring'){_0x345d13['user'][_0xee6ebb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x12c29e[_0x22f7('0x3b')]+'%',null);}else{_0x1bfe3f=_['find'](_0x372642,[_0x22f7('0xb'),_0x22f7('0x4d')]);_0x12c29e[_0x22f7('0xa')]=_0x22f7('0x4d');_0x18c66c=as['buildExpression'](_0x3ce39b,_0x1bfe3f['type'],_0x12c29e);_0x345d13[_0x22f7('0x4e')][_0xee6ebb](_0x18c66c[_0x22f7('0x47')],_0x18c66c[_0x22f7('0x3b')][_0x22f7('0x3c')],_0x18c66c[_0x22f7('0x3b')][_0x22f7('0x3d')]);}break;case _0x22f7('0x4f'):case _0x22f7('0x50'):_0x18c66c=as['buildExpression']('me',null,_0x12c29e);_0x345d13['body'][_0xee6ebb](_0x18c66c[_0x22f7('0x47')],_0x18c66c['value']['start'],_0x18c66c['value']['end']);break;}}}return _0x345d13;}function parseModelFields(_0x20a615,_0x2a345f,_0x3a267e){var _0x28db0c=utils[_0x22f7('0x6')](_0x20a615);var _0x773262=squel[_0x22f7('0x22')]();var _0x47ff09=_(_0x2a345f)[_0x22f7('0x51')]()[_0x22f7('0x16')](function(_0x3c88dd){return _[_0x22f7('0x52')](_0x3a267e,[_0x22f7('0xb'),_0x3c88dd])?_0x3c88dd:undefined;})[_0x22f7('0x53')]()[_0x22f7('0x3b')]();if(_0x47ff09[_0x22f7('0x38')]>0x0){_0x47ff09['forEach'](function(_0x337505){if(_0x337505===_0x28db0c){_0x773262[_0x22f7('0x54')]('i.'+_0x28db0c+_0x22f7('0x55'),[][_0x22f7('0x56')](_0x2a345f[_0x337505]));}else if(_0x337505===_0x22f7('0x57')){var _0x48c491=JSON[_0x22f7('0x58')](_0x2a345f[_0x337505])[_0x22f7('0x59')];var _0x165dbf=JSON[_0x22f7('0x58')](_0x2a345f[_0x337505])[_0x22f7('0x5a')];_0x773262['and'](_0x22f7('0x5b'),_0x48c491,_0x165dbf);}else{if(_0x2a345f[_0x337505]==='null'){_0x773262[_0x22f7('0x54')]('i.'+_0x337505+_0x22f7('0x5c'));}else{_0x773262['and']('i.'+_0x337505+_0x22f7('0x5d'),_0x2a345f[_0x337505]);}}});}return _0x773262;}function parseQueryParameters(_0x496297,_0x3f916e,_0x3ab5e4){var _0x229e03=getSqlClauses();return Promise[_0x22f7('0x5e')]()[_0x22f7('0x5f')](function(){return parseModelFields(_0x496297,_0x3f916e,_0x3ab5e4);})[_0x22f7('0x5f')](function(_0x273a12){_0x229e03[_0x22f7('0x60')][_0x22f7('0x54')](_0x273a12);return parseReadParameter(_0x3f916e[_0x22f7('0x3f')]);})[_0x22f7('0x5f')](function(_0x3f5828){_0x229e03[_0x22f7('0x3f')][_0x22f7('0x54')](_0x3f5828);return parseTagParameter(_0x3f916e['tag']);})[_0x22f7('0x5f')](function(_0x2eee1e){_0x229e03[_0x22f7('0x49')]['clause'][_0x22f7('0x54')](_0x2eee1e);return parseSearchFilter(_0x496297,_0x3f916e[_0x22f7('0x61')]);})[_0x22f7('0x5f')](function(_0x484677){_0x229e03['filter']=_0x484677;return _0x229e03;});}function checkAccountsRestrictions(_0x69203b,_0x46d5f0,_0xce6ca9){var _0x19cb05=utils[_0x22f7('0x6')](_0x69203b);var _0x32b04a=_0x22f7('0x62')+_['capitalize'](_0x69203b)+(_0x69203b==='chat'?'Websites':_0x22f7('0x63'));var _0x394024=squel[_0x22f7('0x22')]();return Promise[_0x22f7('0x5e')]()[_0x22f7('0x5f')](function(){if(_0xce6ca9[_0x22f7('0x64')]&&_0x46d5f0['role']===_0x22f7('0x8')){return _0x46d5f0[_0x32b04a]({'attributes':['id'],'raw':!![]});}})[_0x22f7('0x5f')](function(_0x293268){if(_0x293268){if(_0x293268[_0x22f7('0x38')]===0x0){_0x394024[_0x22f7('0x54')]('i.'+_0x19cb05+'\x20IS\x20NULL');}else{_0x394024['and']('i.'+_0x19cb05+_0x22f7('0x55'),_[_0x22f7('0x16')](_0x293268,'id'));}}else if(!_0xce6ca9[_0x19cb05]){_0x394024[_0x22f7('0x54')]('i.'+_0x19cb05+'\x20IS\x20NOT\x20NULL');}})[_0x22f7('0x5f')](function(){return _0x394024;});}function getClosedOrderClause(_0x14e58b,_0x1c1948){var _0x522d63='';var _0x219f42=[_0x22f7('0x65'),_0x22f7('0x66'),_0x22f7('0x67')];if(_0x14e58b==='mail'){_0x219f42[_0x22f7('0x68')](_0x22f7('0x69'));}if(_0x1c1948[_0x22f7('0x6a')]==='0'&&_0x14e58b===_0x22f7('0x2f')){_0x522d63='i.substatus';}else{if(_0x1c1948[_0x22f7('0x6a')]==='1'){_0x219f42[_0x22f7('0x6b')]();}_0x522d63='CONCAT_WS(\x27\x27,\x20'+_0x219f42[_0x22f7('0x6c')](',\x20')+')';}return _0x522d63;}function getFilteredInteractions(_0x194ce7,_0x3fe1c3,_0x48b013,_0x5647a6){var _0x443026=utils[_0x22f7('0xf')](_0x194ce7);var _0x4a801e=_[_0x22f7('0x6d')](_0x194ce7)+_0x22f7('0x6e');var _0x3964c1=[];var _0x4fbb42=getTagsQuery();var _0x2ea79f={'type':db[_0x22f7('0x6f')]['QueryTypes'][_0x22f7('0x70')],'raw':!![]};var _0xbb99bd=[];var _0x2b3817=[];return db[_0x22f7('0x71')][_0x22f7('0x72')](_0x4fbb42[_0x22f7('0x73')](),_0x2ea79f)[_0x22f7('0x5f')](function(_0x22111f){_0x3964c1=_[_0x22f7('0x74')](_0x22111f,'id');_0x2ea79f=_[_0x22f7('0x75')](_0x2ea79f,{'model':db[_0x4a801e],'mapToModel':!![],'nest':!![]});if(_0x48b013[_0x22f7('0x60')]){_0x5647a6[_0x22f7('0x76')][_0x22f7('0x24')](function(_0x32937f){_0x3fe1c3[_0x22f7('0xa')]('i.'+_0x32937f);});}else{_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x77'),_0x22f7('0x3e'));_0x3fe1c3['field'](_0x22f7('0x78'),'Account.key');_0x3fe1c3[_0x22f7('0xa')]('a.mandatoryDisposition',_0x22f7('0x79'));if(_0x194ce7==='mail'){_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x7a'),_0x22f7('0x7b'));_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x7c'),_0x22f7('0x7d'));_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x7e'));_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x7f'));_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x80'));_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x81'));_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x82'));_0x3fe1c3['field'](_0x22f7('0x83'));_0x3fe1c3['field']('i.lastMsgAt');_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x84'));_0x3fe1c3['field'](_0x22f7('0x85'));_0x3fe1c3[_0x22f7('0xa')]('i.disposition');_0x3fe1c3[_0x22f7('0xa')]('i.secondDisposition');_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x65'));_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x69'));_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x86'));_0x3fe1c3[_0x22f7('0xa')]('i.ContactId');_0x3fe1c3['field']('i.MailAccountId');_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x87'));}else if(_0x194ce7===_0x22f7('0x88')){_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x89'),'contactName');}else{_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x8a'),_0x22f7('0x7d'));}if(_0x194ce7!==_0x22f7('0x2f')){_0x3fe1c3['field'](_0x22f7('0x8b'));}_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x8c'),_0x22f7('0x8d'));_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x8e'),_0x22f7('0x8f'));_0x3fe1c3[_0x22f7('0xa')]('c.email',_0x22f7('0x90'));_0x3fe1c3['field']('c.phone','Contact.phone');_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x91'),'Contact.mobile');_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x92'),_0x22f7('0x93'));_0x3fe1c3['field'](_0x22f7('0x94'),_0x22f7('0x95'));_0x3fe1c3[_0x22f7('0xa')]('o.internal','Owner.internal');_0x3fe1c3[_0x22f7('0xa')](_0x22f7('0x96'),'TagIds');}if(_0x5647a6[_0x22f7('0x97')]){_0x3fe1c3[_0x22f7('0x97')](_0x5647a6['limit']);}if(_0x5647a6[_0x22f7('0x98')]){_0x3fe1c3[_0x22f7('0x98')](_0x5647a6['offset']);}return db['sequelize'][_0x22f7('0x72')](_0x3fe1c3['toString'](),_0x2ea79f);})[_0x22f7('0x5f')](function(_0x44c183){_0xbb99bd=_0x44c183;var _0x139e09=getUsersQuery(_0x194ce7,_0xbb99bd);return db[_0x22f7('0x71')][_0x22f7('0x72')](_0x139e09['toString'](),_0x2ea79f);})[_0x22f7('0x5f')](function(_0x3582b4){_0x2b3817=_['groupBy'](_0x3582b4,_0x443026);if(_0x194ce7===_0x22f7('0x2f')){return db[_0x22f7('0x99')]['findOne']({'attributes':[_0x22f7('0x9a')],'raw':!![]});}})[_0x22f7('0x5f')](function(_0x176589){var _0x555a97=_0x176589?_0x176589[_0x22f7('0x9a')]:undefined;var _0x2216b1=_0xbb99bd[_0x22f7('0x16')](function(_0x268558){return updateInteraction(_0x268558,_0x3964c1,_0x2b3817,_0x555a97);});return Promise[_0x22f7('0x9b')](_0x2216b1);});}function countFilteredInteractions(_0x264e4f,_0x42df7f){var _0xe7ccf1=_0x264e4f[_0x22f7('0x9c')]();_0xe7ccf1[_0x22f7('0xa')](_0x22f7('0x9d'));_0xe7ccf1[_0x22f7('0xa')](_0x22f7('0x77'),'unreadMessages');var _0x5e232e=utils[_0x22f7('0x23')](_0x42df7f);if(!_['isEmpty'](_0x5e232e)){_0xe7ccf1[_0x22f7('0x15')](_0x22f7('0x9e'),_0x5e232e);}var _0x5ec319={'type':db[_0x22f7('0x6f')][_0x22f7('0x9f')][_0x22f7('0x70')],'raw':!![]};return db[_0x22f7('0x71')]['query'](_0xe7ccf1[_0x22f7('0x73')](),_0x5ec319);}module[_0x22f7('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xc0e2=['$lte','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','filter','capitalize','chat','Websites','Accounts','search','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','SELECT','sequelize','query','toString','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closedAt','i.lastMsgAt','i.subject','i.UserId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','QueryTypes','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','getAccountFK','role','agent','field','color','tools_tags','getInteractionFK','_interactions','select','u.id','u.fullname','ui.','from','users','where','\x20IN\x20?','interactions','cm_contacts','left_join','o.id\x20=\x20i.UserId','accounts','messages','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','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','length','find','name','buildExpression','default','start','unreadMessages','value','read','and','Contact','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','map','tags','clause','ids','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','text','body','plainBody','end','keys','some','compact','concat','createdAt','parse','$gte'];(function(_0x5cb139,_0x1a5f77){var _0x816e2b=function(_0x1ad50f){while(--_0x1ad50f){_0x5cb139['push'](_0x5cb139['shift']());}};_0x816e2b(++_0x1a5f77);}(_0xc0e2,0x182));var _0x2c0e=function(_0x9243a2,_0x43d22a){_0x9243a2=_0x9243a2-0x0;var _0x4dc606=_0xc0e2[_0x9243a2];return _0x4dc606;};'use strict';var _=require('lodash');var squel=require(_0x2c0e('0x0'));var as=require(_0x2c0e('0x1'));var qs=require(_0x2c0e('0x2'));var updateInteraction=require(_0x2c0e('0x3'))[_0x2c0e('0x4')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x4e5362,_0x506925,_0x25f9d0){var _0x5b1198=![];var _0x147b1e=utils[_0x2c0e('0x5')](_0x4e5362);if(_0x506925[_0x2c0e('0x6')]===_0x2c0e('0x7')&&!_0x25f9d0['search']&&!_0x25f9d0[_0x147b1e]){_0x5b1198=!![];}return _0x5b1198;}function getTagsQuery(){return squel['select']()[_0x2c0e('0x8')]('id')[_0x2c0e('0x8')]('name')[_0x2c0e('0x8')](_0x2c0e('0x9'))['from'](_0x2c0e('0xa'));}function getUsersQuery(_0x211fed,_0x59b9c4){var _0x12f0f0=utils[_0x2c0e('0xb')](_0x211fed);var _0x39a9ff='user_has_'+_0x211fed+_0x2c0e('0xc');var _0x5c1af5=squel[_0x2c0e('0xd')]()[_0x2c0e('0x8')](_0x2c0e('0xe'))[_0x2c0e('0x8')](_0x2c0e('0xf'))['field'](_0x2c0e('0x10')+_0x12f0f0)[_0x2c0e('0x11')](_0x39a9ff,'ui')['left_join'](_0x2c0e('0x12'),'u','u.id\x20=\x20ui.UserId');if(_0x59b9c4['length']>0x0){_0x5c1af5[_0x2c0e('0x13')](_0x2c0e('0x10')+_0x12f0f0+_0x2c0e('0x14'),_['map'](_0x59b9c4,'id'));}return _0x5c1af5;}function getInteractionsQuery(_0x2c2ea2){var _0x536f97=utils['getInteractionsTables'](_0x2c2ea2);var _0x134c73=utils['getAccountFK'](_0x2c2ea2);var _0x39d626=utils['getInteractionFK'](_0x2c2ea2);return squel['select']()[_0x2c0e('0x11')](_0x536f97[_0x2c0e('0x15')],'i')['left_join'](_0x2c0e('0x16'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x2c0e('0x17')](_0x2c0e('0x12'),'o',_0x2c0e('0x18'))['left_join'](_0x536f97[_0x2c0e('0x19')],'a','a.id\x20=\x20i.'+_0x134c73)[_0x2c0e('0x17')](_0x536f97[_0x2c0e('0x1a')],'me','me.'+_0x39d626+_0x2c0e('0x1b'))[_0x2c0e('0x17')](_0x536f97[_0x2c0e('0x1c')],'it',_0x2c0e('0x1d')+_0x39d626+_0x2c0e('0x1b'))['left_join']('tools_tags','t',_0x2c0e('0x1e'));}function getSqlClauses(){var _0x49f1fb={'body':squel[_0x2c0e('0x1f')](),'contact':squel[_0x2c0e('0x1f')](),'default':squel['expr'](),'fields':squel[_0x2c0e('0x1f')](),'filter':squel[_0x2c0e('0x1f')](),'read':squel[_0x2c0e('0x1f')](),'tags':{'clause':squel[_0x2c0e('0x1f')](),'ids':null},'user':squel['expr']()};return _0x49f1fb;}function parseTagParameter(_0x107e92){var _0x48aa0a=squel[_0x2c0e('0x1f')]();if(_0x107e92){var _0x26640f=utils[_0x2c0e('0x20')](_0x107e92);_0x26640f[_0x2c0e('0x21')](function(_0x652298){_0x48aa0a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x652298+',%');});}return _0x48aa0a;}function parseReadParameter(_0x1ab9e7){var _0x522dd7='';if(_0x1ab9e7){_0x522dd7='unreadMessages\x20{OPERATOR}\x200';if(_0x1ab9e7==='1'){_0x522dd7=_0x522dd7[_0x2c0e('0x22')](_0x2c0e('0x23'),'=');}else{_0x522dd7=_0x522dd7['replace']('{OPERATOR}','>');}}return _0x522dd7;}function parseSearchFilter(_0x3c9c34,_0x484c6a){var _0x33bea2=squel[_0x2c0e('0x1f')]();if(_0x484c6a){var _0xf120d4=_0x484c6a[_0x2c0e('0x22')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x2c0e('0x24')](_0xf120d4)){_0x33bea2['or'](_0x2c0e('0x25'),_0xf120d4+'%');if([_0x2c0e('0x26'),'whatsapp'][_0x2c0e('0x27')](_0x3c9c34)){_0x33bea2['or'](_0x2c0e('0x28'),_0xf120d4+'%');}else if(_0x3c9c34===_0x2c0e('0x29')){_0x33bea2['or'](_0x2c0e('0x2a'),_0xf120d4+'%');}else if(_0x3c9c34===_0x2c0e('0x2b')){_0x33bea2['or'](_0x2c0e('0x2c'),_0xf120d4+'%');}}else if(_0x3c9c34===_0x2c0e('0x2d')&&qs['isEmail'](_0xf120d4)){_0x33bea2['or'](_0x2c0e('0x2e'),_0xf120d4+'%');}else{if(_0x3c9c34===_0x2c0e('0x2d')){_0x33bea2['or'](_0x2c0e('0x2f'),qs[_0x2c0e('0x30')](_0xf120d4,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xf120d4));}else if(_0x3c9c34!==_0x2c0e('0x29')){_0x33bea2['or'](_0x2c0e('0x31'),qs[_0x2c0e('0x30')](_0xf120d4));}_0x33bea2['or'](_0x2c0e('0x32'),qs[_0x2c0e('0x30')](_0xf120d4,!![]),null);}}return _0x33bea2;}function parseAdvancedSearchFilter(_0x14b6fb,_0x541eda){var _0x214f52=getSqlClauses();var _0x3bb8f3=as[_0x2c0e('0x33')](_0x14b6fb);var _0x53aece=_0x3bb8f3[_0x2c0e('0x34')];for(var _0x4d3260=0x0;_0x4d3260<_0x3bb8f3[_0x2c0e('0x35')][_0x2c0e('0x36')];_0x4d3260++){var _0x370d26=_0x3bb8f3['conditions'][_0x4d3260];var _0x319c6e='i';var _0x227973=_[_0x2c0e('0x37')](_0x541eda,[_0x2c0e('0x38'),_0x370d26[_0x2c0e('0x8')]]);if(_0x227973){var _0x143805=as[_0x2c0e('0x39')](_0x319c6e,_0x227973['type'],_0x370d26);_0x214f52[_0x2c0e('0x3a')][_0x53aece](_0x143805['text'],_0x143805['value'][_0x2c0e('0x3b')],_0x143805['value']['end']);}else{switch(_0x370d26[_0x2c0e('0x8')]){case _0x2c0e('0x3c'):var _0x410ca0=parseReadParameter(_0x370d26[_0x2c0e('0x3d')]);_0x214f52[_0x2c0e('0x3e')][_0x2c0e('0x3f')](_0x410ca0);break;case _0x2c0e('0x40'):if(_0x370d26['operator']===_0x2c0e('0x41')){if(_0x370d26[_0x2c0e('0x3d')][_0x2c0e('0x42')]('\x20')[_0x2c0e('0x36')]>0x1){_0x214f52[_0x2c0e('0x43')][_0x53aece](_0x2c0e('0x32'),qs[_0x2c0e('0x30')](_0x370d26['value'],!![]),null);}else{var _0x18d23b='%'+_0x370d26[_0x2c0e('0x3d')]+'%';_0x214f52['contact'][_0x53aece](_0x2c0e('0x44'),_0x18d23b,_0x18d23b,_0x18d23b);}}else{_0x227973=_[_0x2c0e('0x37')](_0x541eda,['name','ContactId']);_0x370d26[_0x2c0e('0x8')]=_0x2c0e('0x45');_0x143805=as[_0x2c0e('0x39')](_0x319c6e,_0x227973['type'],_0x370d26);_0x214f52[_0x2c0e('0x43')][_0x53aece](_0x143805['text'],_0x143805[_0x2c0e('0x3d')]['start'],_0x143805[_0x2c0e('0x3d')]['end']);}break;case _0x2c0e('0x46'):var _0x1843be=_0x370d26[_0x2c0e('0x3d')][_0x2c0e('0x42')](',')[_0x2c0e('0x47')](function(_0x3054e7){return Number(_0x3054e7);});var _0x3ed076=parseTagParameter(_0x1843be);_0x214f52[_0x2c0e('0x48')][_0x2c0e('0x49')][_0x2c0e('0x3f')](_0x3ed076);_0x214f52[_0x2c0e('0x48')][_0x2c0e('0x4a')]=_0x1843be;break;case'User':if(_0x370d26[_0x2c0e('0x4b')]==='$substring'){_0x214f52[_0x2c0e('0x4c')][_0x53aece](_0x2c0e('0x4d'),'%'+_0x370d26['value']+'%',null);}else{_0x227973=_[_0x2c0e('0x37')](_0x541eda,[_0x2c0e('0x38'),_0x2c0e('0x4e')]);_0x370d26[_0x2c0e('0x8')]=_0x2c0e('0x4e');_0x143805=as[_0x2c0e('0x39')](_0x319c6e,_0x227973[_0x2c0e('0x4f')],_0x370d26);_0x214f52[_0x2c0e('0x4c')][_0x53aece](_0x143805[_0x2c0e('0x50')],_0x143805[_0x2c0e('0x3d')][_0x2c0e('0x3b')],_0x143805['value']['end']);}break;case _0x2c0e('0x51'):case _0x2c0e('0x52'):_0x143805=as[_0x2c0e('0x39')]('me',null,_0x370d26);_0x214f52[_0x2c0e('0x51')][_0x53aece](_0x143805[_0x2c0e('0x50')],_0x143805[_0x2c0e('0x3d')][_0x2c0e('0x3b')],_0x143805[_0x2c0e('0x3d')][_0x2c0e('0x53')]);break;}}}return _0x214f52;}function parseModelFields(_0x352f77,_0x3bff29,_0xe0a7fa){var _0x47d31e=utils[_0x2c0e('0x5')](_0x352f77);var _0x147427=squel[_0x2c0e('0x1f')]();var _0x509dd6=_(_0x3bff29)[_0x2c0e('0x54')]()['map'](function(_0x3949a1){return _[_0x2c0e('0x55')](_0xe0a7fa,['name',_0x3949a1])?_0x3949a1:undefined;})[_0x2c0e('0x56')]()[_0x2c0e('0x3d')]();if(_0x509dd6[_0x2c0e('0x36')]>0x0){_0x509dd6['forEach'](function(_0x491c3d){if(_0x491c3d===_0x47d31e){_0x147427['and']('i.'+_0x47d31e+'\x20IN\x20?',[][_0x2c0e('0x57')](_0x3bff29[_0x491c3d]));}else if(_0x491c3d===_0x2c0e('0x58')){var _0x339dbb=JSON[_0x2c0e('0x59')](_0x3bff29[_0x491c3d])[_0x2c0e('0x5a')];var _0x29bfc9=JSON[_0x2c0e('0x59')](_0x3bff29[_0x491c3d])[_0x2c0e('0x5b')];_0x147427[_0x2c0e('0x3f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x339dbb,_0x29bfc9);}else{if(_0x3bff29[_0x491c3d]===_0x2c0e('0x5c')){_0x147427[_0x2c0e('0x3f')]('i.'+_0x491c3d+_0x2c0e('0x5d'));}else{_0x147427[_0x2c0e('0x3f')]('i.'+_0x491c3d+_0x2c0e('0x5e'),_0x3bff29[_0x491c3d]);}}});}return _0x147427;}function parseQueryParameters(_0x5f182c,_0x5c141f,_0x4e2fbb){var _0x4f38a7=getSqlClauses();return Promise[_0x2c0e('0x5f')]()['then'](function(){return parseModelFields(_0x5f182c,_0x5c141f,_0x4e2fbb);})[_0x2c0e('0x60')](function(_0x511433){_0x4f38a7['fields'][_0x2c0e('0x3f')](_0x511433);return parseReadParameter(_0x5c141f['read']);})[_0x2c0e('0x60')](function(_0x1b3dd8){_0x4f38a7[_0x2c0e('0x3e')][_0x2c0e('0x3f')](_0x1b3dd8);return parseTagParameter(_0x5c141f['tag']);})[_0x2c0e('0x60')](function(_0xcfeacb){_0x4f38a7['tags'][_0x2c0e('0x49')][_0x2c0e('0x3f')](_0xcfeacb);return parseSearchFilter(_0x5f182c,_0x5c141f[_0x2c0e('0x61')]);})[_0x2c0e('0x60')](function(_0x479b97){_0x4f38a7[_0x2c0e('0x61')]=_0x479b97;return _0x4f38a7;});}function checkAccountsRestrictions(_0x509b17,_0x2d7593,_0x33e833){var _0x5a5911=utils[_0x2c0e('0x5')](_0x509b17);var _0x2b12aa='get'+_[_0x2c0e('0x62')](_0x509b17)+(_0x509b17===_0x2c0e('0x63')?_0x2c0e('0x64'):_0x2c0e('0x65'));var _0x204ffd=squel['expr']();return Promise['resolve']()[_0x2c0e('0x60')](function(){if(_0x33e833[_0x2c0e('0x66')]&&_0x2d7593[_0x2c0e('0x6')]===_0x2c0e('0x7')){return _0x2d7593[_0x2b12aa]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x35e5f4){if(_0x35e5f4){if(_0x35e5f4[_0x2c0e('0x36')]===0x0){_0x204ffd['and']('i.'+_0x5a5911+_0x2c0e('0x5d'));}else{_0x204ffd[_0x2c0e('0x3f')]('i.'+_0x5a5911+_0x2c0e('0x14'),_[_0x2c0e('0x47')](_0x35e5f4,'id'));}}else if(!_0x33e833[_0x5a5911]){_0x204ffd[_0x2c0e('0x3f')]('i.'+_0x5a5911+_0x2c0e('0x67'));}})[_0x2c0e('0x60')](function(){return _0x204ffd;});}function getClosedOrderClause(_0x31e7b4,_0x5db6a3){var _0x156fc9='';var _0x1f48c3=['i.thirdDisposition',_0x2c0e('0x68'),_0x2c0e('0x69')];if(_0x31e7b4===_0x2c0e('0x2d')){_0x1f48c3[_0x2c0e('0x6a')](_0x2c0e('0x6b'));}if(_0x5db6a3[_0x2c0e('0x6c')]==='0'&&_0x31e7b4==='mail'){_0x156fc9=_0x2c0e('0x6b');}else{if(_0x5db6a3['closed']==='1'){_0x1f48c3['shift']();}_0x156fc9=_0x2c0e('0x6d')+_0x1f48c3['join'](',\x20')+')';}return _0x156fc9;}function getFilteredInteractions(_0x4e6404,_0x94f0fa,_0x3aa981,_0x7ec2dd){var _0x365ca9=utils[_0x2c0e('0xb')](_0x4e6404);var _0x30e6a7=_[_0x2c0e('0x62')](_0x4e6404)+'Interaction';var _0x4dc632=[];var _0x2d01a9=getTagsQuery();var _0x2a7af4={'type':db['Sequelize']['QueryTypes'][_0x2c0e('0x6e')],'raw':!![]};var _0x5ef8fd=[];var _0x1a54ed=[];return db[_0x2c0e('0x6f')][_0x2c0e('0x70')](_0x2d01a9[_0x2c0e('0x71')](),_0x2a7af4)[_0x2c0e('0x60')](function(_0x5f0335){_0x4dc632=_['keyBy'](_0x5f0335,'id');_0x2a7af4=_[_0x2c0e('0x72')](_0x2a7af4,{'model':db[_0x30e6a7],'mapToModel':!![],'nest':!![]});if(_0x3aa981[_0x2c0e('0x73')]){_0x7ec2dd['attributes']['forEach'](function(_0x508650){_0x94f0fa[_0x2c0e('0x8')]('i.'+_0x508650);});}else{_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x74'),_0x2c0e('0x3c'));_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x75'),_0x2c0e('0x76'));_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x77'),'Account.mandatoryDisposition');if(_0x4e6404===_0x2c0e('0x2d')){_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x78'),_0x2c0e('0x79'));_0x94f0fa['field'](_0x2c0e('0x7a'),_0x2c0e('0x7b'));_0x94f0fa['field'](_0x2c0e('0x7c'));_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x7d'));_0x94f0fa[_0x2c0e('0x8')]('i.updatedAt');_0x94f0fa[_0x2c0e('0x8')]('i.closed');_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x7e'));_0x94f0fa[_0x2c0e('0x8')]('i.attach');_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x7f'));_0x94f0fa[_0x2c0e('0x8')]('i.lastMsgDirection');_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x80'));_0x94f0fa[_0x2c0e('0x8')]('i.disposition');_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x68'));_0x94f0fa[_0x2c0e('0x8')]('i.thirdDisposition');_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x6b'));_0x94f0fa[_0x2c0e('0x8')]('i.to');_0x94f0fa[_0x2c0e('0x8')]('i.ContactId');_0x94f0fa['field']('i.MailAccountId');_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x81'));}else if(_0x4e6404===_0x2c0e('0x2b')){_0x94f0fa[_0x2c0e('0x8')]('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','contactName');}else{_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x82'),_0x2c0e('0x7b'));}if(_0x4e6404!==_0x2c0e('0x2d')){_0x94f0fa['field'](_0x2c0e('0x83'));}_0x94f0fa[_0x2c0e('0x8')]('c.firstName',_0x2c0e('0x84'));_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x85'),_0x2c0e('0x86'));_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x87'),'Contact.email');_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x88'),_0x2c0e('0x89'));_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x8a'),_0x2c0e('0x8b'));_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x8c'),_0x2c0e('0x8d'));_0x94f0fa['field'](_0x2c0e('0x8e'),'Owner.fullname');_0x94f0fa[_0x2c0e('0x8')](_0x2c0e('0x8f'),_0x2c0e('0x90'));_0x94f0fa['field'](_0x2c0e('0x91'),_0x2c0e('0x92'));}if(_0x7ec2dd[_0x2c0e('0x93')]){_0x94f0fa['limit'](_0x7ec2dd[_0x2c0e('0x93')]);}if(_0x7ec2dd[_0x2c0e('0x94')]){_0x94f0fa['offset'](_0x7ec2dd[_0x2c0e('0x94')]);}return db['sequelize'][_0x2c0e('0x70')](_0x94f0fa[_0x2c0e('0x71')](),_0x2a7af4);})[_0x2c0e('0x60')](function(_0x2f4fe5){_0x5ef8fd=_0x2f4fe5;var _0x201b59=getUsersQuery(_0x4e6404,_0x5ef8fd);return db[_0x2c0e('0x6f')]['query'](_0x201b59[_0x2c0e('0x71')](),_0x2a7af4);})[_0x2c0e('0x60')](function(_0xe48aab){_0x1a54ed=_['groupBy'](_0xe48aab,_0x365ca9);if(_0x4e6404===_0x2c0e('0x2d')){return db[_0x2c0e('0x95')][_0x2c0e('0x96')]({'attributes':[_0x2c0e('0x97')],'raw':!![]});}})[_0x2c0e('0x60')](function(_0x1c2155){var _0x48ef7a=_0x1c2155?_0x1c2155[_0x2c0e('0x97')]:undefined;var _0x4424d5=_0x5ef8fd[_0x2c0e('0x47')](function(_0x1757ca){return updateInteraction(_0x1757ca,_0x4dc632,_0x1a54ed,_0x48ef7a);});return Promise[_0x2c0e('0x98')](_0x4424d5);});}function countFilteredInteractions(_0x3f40da,_0x6e98a7){var _0x28f689=_0x3f40da[_0x2c0e('0x99')]();_0x28f689[_0x2c0e('0x8')](_0x2c0e('0x9a'));_0x28f689[_0x2c0e('0x8')](_0x2c0e('0x74'),_0x2c0e('0x3c'));var _0x22bdf9=utils[_0x2c0e('0x20')](_0x6e98a7);if(!_[_0x2c0e('0x9b')](_0x22bdf9)){_0x28f689['where'](_0x2c0e('0x9c'),_0x22bdf9);}var _0x19737c={'type':db[_0x2c0e('0x9d')][_0x2c0e('0x9e')][_0x2c0e('0x6e')],'raw':!![]};return db[_0x2c0e('0x6f')][_0x2c0e('0x70')](_0x28f689[_0x2c0e('0x71')](),_0x19737c);}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 e0a7178..1c9e77d 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 _0x9c2f=['talking','unmanaged','abandoned','total','closed','UserId','answered','MailMessage','findOne','out','plainBody','-id','trimStart','then','Tags','TagIds','catch','lodash','../../mysqldb','fullname','split','forEach','push','waiting'];(function(_0x375ae5,_0x77fee2){var _0x19b70a=function(_0x23426d){while(--_0x23426d){_0x375ae5['push'](_0x375ae5['shift']());}};_0x19b70a(++_0x77fee2);}(_0x9c2f,0x1a9));var _0xf9c2=function(_0x5831fc,_0xab9a0a){_0x5831fc=_0x5831fc-0x0;var _0x47c212=_0x9c2f[_0x5831fc];return _0x47c212;};'use strict';var _=require(_0xf9c2('0x0'));var db=require(_0xf9c2('0x1'))['db'];function getInteractionUsers(_0x192206,_0x48982c){return new Promise(function(_0x187b2c,_0x3ebfb6){try{var _0x4405e1=[];if(_0x48982c[_0x192206]){_0x4405e1=_0x48982c[_0x192206]['map'](function(_0x46772a){return{'id':_0x46772a['id'],'fullname':_0x46772a[_0xf9c2('0x2')]};});}return _0x187b2c(_0x4405e1);}catch(_0x5786c1){_0x3ebfb6(_0x5786c1);}});}function getInteractionTags(_0x212ddf,_0x430404){var _0x4a446a=[];if(_0x212ddf){_0x212ddf[_0xf9c2('0x3')](',')[_0xf9c2('0x4')](function(_0x28875e){_0x4a446a[_0xf9c2('0x5')](_0x430404[_0x28875e]);});}return _0x4a446a;}function updateWaitingCounter(_0x2d6013){if(_0x2d6013['waiting']){_0x2d6013[_0xf9c2('0x6')]-=0x1;}}function updateInteractionCounters(_0x2932e5){_0x2932e5['waiting']=0x0;_0x2932e5[_0xf9c2('0x7')]=0x0;_0x2932e5['answered']=0x0;_0x2932e5[_0xf9c2('0x8')]=0x0;_0x2932e5[_0xf9c2('0x9')]=0x0;_0x2932e5[_0xf9c2('0xa')]=0x0;if(_0x2932e5[_0xf9c2('0xb')]){if(_0x2932e5['disposition']===_0xf9c2('0x9')){_0x2932e5['abandoned']+=0x1;updateWaitingCounter(_0x2932e5);}if(_0x2932e5[_0xf9c2('0xc')]){_0x2932e5[_0xf9c2('0xd')]+=0x1;if(_0x2932e5[_0xf9c2('0x7')]){_0x2932e5[_0xf9c2('0x7')]-=0x1;}}else{if(_0x2932e5['disposition']){_0x2932e5[_0xf9c2('0x8')]+=0x1;updateWaitingCounter(_0x2932e5);}}}else{if(!_0x2932e5[_0xf9c2('0xc')]){_0x2932e5[_0xf9c2('0x6')]+=0x1;}if(_0x2932e5[_0xf9c2('0xc')]){_0x2932e5[_0xf9c2('0x7')]+=0x1;updateWaitingCounter(_0x2932e5);}}_0x2932e5[_0xf9c2('0xa')]+=0x1;return _0x2932e5;}function getLastMessageText(_0x5e7bac){return db[_0xf9c2('0xe')][_0xf9c2('0xf')]({'where':{'$and':[{'MailInteractionId':_0x5e7bac['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xf9c2('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xf9c2('0x11')],'order':_0xf9c2('0x12'),'raw':!![]})['then'](function(_0x567816){if(_0x567816&&_0x567816['plainBody']){_0x5e7bac['lastMsgText']=_[_0xf9c2('0x13')](_0x567816[_0xf9c2('0x11')]);}return _0x5e7bac;})['catch'](function(_0x5be5cb){throw _0x5be5cb;});}exports['updateInteraction']=function(_0x483fef,_0x1a7049,_0xd21668,_0x4e3d71){return new Promise(function(_0x37b12c,_0x306493){return getInteractionUsers(_0x483fef['id'],_0xd21668)[_0xf9c2('0x14')](function(_0x449ed5){_0x483fef['Users']=_0x449ed5;return getInteractionTags(_0x483fef['TagIds'],_0x1a7049);})[_0xf9c2('0x14')](function(_0xfef35a){_0x483fef[_0xf9c2('0x15')]=_0xfef35a;delete _0x483fef[_0xf9c2('0x16')];return updateInteractionCounters(_0x483fef);})[_0xf9c2('0x14')](function(_0x12f926){if(_0x4e3d71){return getLastMessageText(_0x12f926);}else{return _0x12f926;}})[_0xf9c2('0x14')](function(_0x290890){_0x37b12c(_0x290890);})[_0xf9c2('0x17')](function(_0x534c9c){_0x306493(_0x534c9c);});});}; \ No newline at end of file +var _0x5201=['map','fullname','split','forEach','push','waiting','answered','unmanaged','abandoned','total','closed','disposition','UserId','talking','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch','Tags','TagIds','lodash','../../mysqldb'];(function(_0x4cacac,_0x12ef6d){var _0x249c11=function(_0x35f5ea){while(--_0x35f5ea){_0x4cacac['push'](_0x4cacac['shift']());}};_0x249c11(++_0x12ef6d);}(_0x5201,0x127));var _0x1520=function(_0x58b27e,_0x67e3b1){_0x58b27e=_0x58b27e-0x0;var _0x1114ae=_0x5201[_0x58b27e];return _0x1114ae;};'use strict';var _=require(_0x1520('0x0'));var db=require(_0x1520('0x1'))['db'];function getInteractionUsers(_0x5f4ae7,_0x1d2757){return new Promise(function(_0x482df5,_0xe20f6c){try{var _0x58e47a=[];if(_0x1d2757[_0x5f4ae7]){_0x58e47a=_0x1d2757[_0x5f4ae7][_0x1520('0x2')](function(_0xe5d64e){return{'id':_0xe5d64e['id'],'fullname':_0xe5d64e[_0x1520('0x3')]};});}return _0x482df5(_0x58e47a);}catch(_0x2d2527){_0xe20f6c(_0x2d2527);}});}function getInteractionTags(_0x94adda,_0x57aa81){var _0xf7e286=[];if(_0x94adda){_0x94adda[_0x1520('0x4')](',')[_0x1520('0x5')](function(_0x2442b2){_0xf7e286[_0x1520('0x6')](_0x57aa81[_0x2442b2]);});}return _0xf7e286;}function updateWaitingCounter(_0x13644b){if(_0x13644b[_0x1520('0x7')]){_0x13644b[_0x1520('0x7')]-=0x1;}}function updateInteractionCounters(_0x13f514){_0x13f514['waiting']=0x0;_0x13f514['talking']=0x0;_0x13f514[_0x1520('0x8')]=0x0;_0x13f514[_0x1520('0x9')]=0x0;_0x13f514[_0x1520('0xa')]=0x0;_0x13f514[_0x1520('0xb')]=0x0;if(_0x13f514[_0x1520('0xc')]){if(_0x13f514[_0x1520('0xd')]===_0x1520('0xa')){_0x13f514['abandoned']+=0x1;updateWaitingCounter(_0x13f514);}if(_0x13f514[_0x1520('0xe')]){_0x13f514[_0x1520('0x8')]+=0x1;if(_0x13f514[_0x1520('0xf')]){_0x13f514[_0x1520('0xf')]-=0x1;}}else{if(_0x13f514['disposition']){_0x13f514[_0x1520('0x9')]+=0x1;updateWaitingCounter(_0x13f514);}}}else{if(!_0x13f514[_0x1520('0xe')]){_0x13f514[_0x1520('0x7')]+=0x1;}if(_0x13f514[_0x1520('0xe')]){_0x13f514[_0x1520('0xf')]+=0x1;updateWaitingCounter(_0x13f514);}}_0x13f514[_0x1520('0xb')]+=0x1;return _0x13f514;}function getLastMessageText(_0x37cf02){return db[_0x1520('0x10')][_0x1520('0x11')]({'where':{'$and':[{'MailInteractionId':_0x37cf02['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1520('0x12')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1520('0x13')],'order':_0x1520('0x14'),'raw':!![]})[_0x1520('0x15')](function(_0x5a7e1a){if(_0x5a7e1a&&_0x5a7e1a[_0x1520('0x13')]){_0x37cf02[_0x1520('0x16')]=_[_0x1520('0x17')](_0x5a7e1a[_0x1520('0x13')]);}return _0x37cf02;})[_0x1520('0x18')](function(_0x43ec71){throw _0x43ec71;});}exports['updateInteraction']=function(_0x197451,_0x1e0138,_0x28fd99,_0x54cd78){return new Promise(function(_0x465b08,_0x4129db){return getInteractionUsers(_0x197451['id'],_0x28fd99)[_0x1520('0x15')](function(_0x2429fa){_0x197451['Users']=_0x2429fa;return getInteractionTags(_0x197451['TagIds'],_0x1e0138);})[_0x1520('0x15')](function(_0x2194b5){_0x197451[_0x1520('0x19')]=_0x2194b5;delete _0x197451[_0x1520('0x1a')];return updateInteractionCounters(_0x197451);})[_0x1520('0x15')](function(_0x4e6a7d){if(_0x54cd78){return getLastMessageText(_0x4e6a7d);}else{return _0x4e6a7d;}})[_0x1520('0x15')](function(_0x7fe9eb){_0x465b08(_0x7fe9eb);})[_0x1520('0x18')](function(_0x15692c){_0x4129db(_0x15692c);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 84bb4ab..d380e5f 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 _0x95d2=['fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','InteractionId','upperFirst','unknown','chat','websites','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','Interaction','findOne','update','then','catch','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0x95d2,0x18e));var _0x295d=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x95d2[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x295d('0x0'));var db=require(_0x295d('0x1'))['db'];var loggers={'openchannel':require(_0x295d('0x2'))(_0x295d('0x3')),'mail':require(_0x295d('0x2'))(_0x295d('0x4')),'fax':require(_0x295d('0x2'))(_0x295d('0x5')),'sms':require(_0x295d('0x2'))(_0x295d('0x6')),'chat':require(_0x295d('0x2'))(_0x295d('0x7')),'whatsapp':require(_0x295d('0x2'))(_0x295d('0x8'))};function getAccountFK(_0x35ff97){return _[_0x295d('0x9')](_0x35ff97)+(_0x35ff97==='chat'?_0x295d('0xa'):'Account')+'Id';}function getInteractionFK(_0x44ba0d){return _[_0x295d('0x9')](_0x44ba0d)+_0x295d('0xb');}function getInteractionId(_0x58339f,_0x2d1985,_0x6480c5){if(_0x58339f&&_0x58339f[_['upperFirst'](_0x6480c5)+_0x295d('0xb')]){return _0x58339f[_[_0x295d('0xc')](_0x6480c5)+_0x295d('0xb')];}else if(_0x58339f&&_0x58339f['id']){return _0x58339f['id'];}else if(_0x2d1985&&_0x2d1985['id']){return _0x2d1985['id'];}else{return _0x295d('0xd');}}function getInteractionsTables(_0x3a5817){return{'accounts':_0x3a5817+'_'+(_0x3a5817===_0x295d('0xe')?_0x295d('0xf'):'accounts'),'interactions':_0x3a5817+_0x295d('0x10'),'interactionsTags':_0x3a5817+_0x295d('0x11'),'messages':_0x3a5817+_0x295d('0x12'),'userInteractions':_0x295d('0x13')+_0x3a5817+_0x295d('0x10')};}function getSelectedTags(_0x281b48){var _0x494bae=[];if(_0x281b48){_0x494bae=Array[_0x295d('0x14')](_0x281b48)?_0x281b48:[_0x281b48];}return _0x494bae;}function log(_0x21dd51,_0x27756f,_0x51740c,_0x2ef997,_0x1b86d7,_0x3f48b1){loggers[_0x1b86d7[_0x295d('0x15')]()][_0x21dd51](_0x295d('0x16'),_0x3f48b1['toUpperCase'](),_0x27756f?_0x27756f['id']:null,_0x27756f?_0x27756f[_0x295d('0x17')]:null,_0x27756f?_0x27756f[_0x295d('0x18')]:null,getInteractionId(_0x51740c,_0x2ef997,_0x1b86d7),_0x51740c?JSON['stringify'](_0x51740c):'null');}function updateUser(_0x17ee00,_0x223912,_0x4305dc,_0x17c527,_0x3cfbe9){db[_[_0x295d('0xc')](_0x17c527)+_0x295d('0x19')][_0x295d('0x1a')]({'where':{'id':getInteractionId(_0x223912,_0x4305dc,_0x17c527)}})['then'](function(_0x2db8b7){if(_0x2db8b7){return _0x2db8b7[_0x295d('0x1b')]({'UserId':_0x17ee00?_0x17ee00['id']:null});}})[_0x295d('0x1c')](function(_0x2e66ba){if(_0x2e66ba){log('info',_0x17ee00,_0x223912,_0x4305dc,_0x17c527,_0x3cfbe9);}})[_0x295d('0x1d')](function(){log('error',_0x17ee00,_0x223912,_0x4305dc,_0x17c527,_0x3cfbe9);});}module[_0x295d('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x3692=['_interaction_has_tags','user_has_','isArray','toLowerCase','toUpperCase','role','stringify','null','Interaction','findOne','update','then','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','accounts','_interactions'];(function(_0x52d66b,_0x2ec808){var _0x588708=function(_0x2f27f0){while(--_0x2f27f0){_0x52d66b['push'](_0x52d66b['shift']());}};_0x588708(++_0x2ec808);}(_0x3692,0x17b));var _0x2369=function(_0x51fe86,_0x422b66){_0x51fe86=_0x51fe86-0x0;var _0x3557d4=_0x3692[_0x51fe86];return _0x3557d4;};'use strict';var _=require(_0x2369('0x0'));var db=require(_0x2369('0x1'))['db'];var loggers={'openchannel':require(_0x2369('0x2'))(_0x2369('0x3')),'mail':require(_0x2369('0x2'))(_0x2369('0x4')),'fax':require(_0x2369('0x2'))(_0x2369('0x5')),'sms':require('../../config/logger')(_0x2369('0x6')),'chat':require(_0x2369('0x2'))(_0x2369('0x7')),'whatsapp':require(_0x2369('0x2'))(_0x2369('0x8'))};function getAccountFK(_0x5984e5){return _[_0x2369('0x9')](_0x5984e5)+(_0x5984e5===_0x2369('0xa')?_0x2369('0xb'):_0x2369('0xc'))+'Id';}function getInteractionFK(_0x3f5ed9){return _['capitalize'](_0x3f5ed9)+_0x2369('0xd');}function getInteractionId(_0x3fa9f2,_0x412815,_0x2eb3c1){if(_0x3fa9f2&&_0x3fa9f2[_[_0x2369('0xe')](_0x2eb3c1)+'InteractionId']){return _0x3fa9f2[_['upperFirst'](_0x2eb3c1)+'InteractionId'];}else if(_0x3fa9f2&&_0x3fa9f2['id']){return _0x3fa9f2['id'];}else if(_0x412815&&_0x412815['id']){return _0x412815['id'];}else{return'unknown';}}function getInteractionsTables(_0x23db15){return{'accounts':_0x23db15+'_'+(_0x23db15===_0x2369('0xa')?'websites':_0x2369('0xf')),'interactions':_0x23db15+_0x2369('0x10'),'interactionsTags':_0x23db15+_0x2369('0x11'),'messages':_0x23db15+'_messages','userInteractions':_0x2369('0x12')+_0x23db15+_0x2369('0x10')};}function getSelectedTags(_0x1a2152){var _0x4b60c0=[];if(_0x1a2152){_0x4b60c0=Array[_0x2369('0x13')](_0x1a2152)?_0x1a2152:[_0x1a2152];}return _0x4b60c0;}function log(_0xdea146,_0x5af2f7,_0x55c87a,_0x1758f7,_0x1d59cd,_0x51e9c9){loggers[_0x1d59cd[_0x2369('0x14')]()][_0xdea146]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x51e9c9[_0x2369('0x15')](),_0x5af2f7?_0x5af2f7['id']:null,_0x5af2f7?_0x5af2f7['name']:null,_0x5af2f7?_0x5af2f7[_0x2369('0x16')]:null,getInteractionId(_0x55c87a,_0x1758f7,_0x1d59cd),_0x55c87a?JSON[_0x2369('0x17')](_0x55c87a):_0x2369('0x18'));}function updateUser(_0x98f6e4,_0x328c50,_0x4cb467,_0x1a8228,_0xe0e667){db[_[_0x2369('0xe')](_0x1a8228)+_0x2369('0x19')][_0x2369('0x1a')]({'where':{'id':getInteractionId(_0x328c50,_0x4cb467,_0x1a8228)}})['then'](function(_0x309801){if(_0x309801){return _0x309801[_0x2369('0x1b')]({'UserId':_0x98f6e4?_0x98f6e4['id']:null});}})[_0x2369('0x1c')](function(_0x448d90){if(_0x448d90){log(_0x2369('0x1d'),_0x98f6e4,_0x328c50,_0x4cb467,_0x1a8228,_0xe0e667);}})[_0x2369('0x1e')](function(){log(_0x2369('0x1f'),_0x98f6e4,_0x328c50,_0x4cb467,_0x1a8228,_0xe0e667);});}module[_0x2369('0x20')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index a66b9fd..a1ef26f 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 _0x27a9=['catch','User','admin','user','isUserLimit','crypto','util','../../mysqldb','data1','license','split','createDecipher','format','%s:%s:%s','update','base64','final','utf8','parse','License','then','status'];(function(_0x3557bd,_0x7c92dd){var _0x591edc=function(_0x13bae6){while(--_0x13bae6){_0x3557bd['push'](_0x3557bd['shift']());}};_0x591edc(++_0x7c92dd);}(_0x27a9,0x73));var _0x927a=function(_0x3b234d,_0x249d15){_0x3b234d=_0x3b234d-0x0;var _0x47788c=_0x27a9[_0x3b234d];return _0x47788c;};'use strict';var crypto=require(_0x927a('0x0'));var util=require(_0x927a('0x1'));var compose=require('composable-middleware');var db=require(_0x927a('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x4fcc5b,_0x51fffc){if(_0x4fcc5b&&_0x51fffc){if(_0x51fffc['data1']&&_0x51fffc['license']){var _0x910256=_0x51fffc[_0x927a('0x3')];var _0x2ec084=_0x51fffc[_0x927a('0x4')];var _0x371fa4=_0x910256['split']('-')[0x4];var _0x40e017=_0x910256[_0x927a('0x5')]('-')[0x0];var _0x10c203=crypto[_0x927a('0x6')]('aes-256-ctr',util[_0x927a('0x7')](_0x927a('0x8'),_0x371fa4,_0x910256,_0x40e017));var _0x40789b=_0x10c203[_0x927a('0x9')](_0x2ec084,_0x927a('0xa'),'utf8');_0x40789b+=_0x10c203[_0x927a('0xb')](_0x927a('0xc'));var _0x4c021c=JSON[_0x927a('0xd')](_0x40789b);return _0x4c021c['hasOwnProperty'](_0x4fcc5b)?_0x4c021c[_0x4fcc5b]:null;}}return null;}function isLimit(_0x32e2ce,_0x4821d4,_0x521b5f,_0x211541){var _0x5e97b3=_0x4821d4;return compose()['use'](function(_0x35d7c6,_0x4748f7,_0x21abce){return db[_0x927a('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x927a('0xf')](function(_0x424276){var _0x2ce20a=getValueFromLicense(_0x32e2ce,_0x424276);return _0x2ce20a?_0x2ce20a:_0x5e97b3;})[_0x927a('0xf')](function(_0x19b449){_0x5e97b3=_0x19b449;return _0x521b5f['count'](_0x211541);})[_0x927a('0xf')](function(_0x2c4f7b){if(_0x2c4f7b>=_0x5e97b3){return _0x4748f7[_0x927a('0x10')](0x193)['json']({'message':util[_0x927a('0x7')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x32e2ce)});}_0x21abce();})[_0x927a('0x11')](function(_0x5bf860){_0x21abce(_0x5bf860);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x927a('0x12')],{'where':{'$or':[{'role':_0x927a('0x13')},{'role':_0x927a('0x14')}]}});}exports[_0x927a('0x15')]=isUserLimit; \ No newline at end of file +var _0x84cd=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','use','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license'];(function(_0x433577,_0x100162){var _0x36c112=function(_0x568c11){while(--_0x568c11){_0x433577['push'](_0x433577['shift']());}};_0x36c112(++_0x100162);}(_0x84cd,0x1e0));var _0xd84c=function(_0x301ed1,_0x4b7fed){_0x301ed1=_0x301ed1-0x0;var _0x24f38f=_0x84cd[_0x301ed1];return _0x24f38f;};'use strict';var crypto=require('crypto');var util=require(_0xd84c('0x0'));var compose=require(_0xd84c('0x1'));var db=require(_0xd84c('0x2'))['db'];var config=require(_0xd84c('0x3'));function getValueFromLicense(_0x171331,_0x2d0111){if(_0x171331&&_0x2d0111){if(_0x2d0111[_0xd84c('0x4')]&&_0x2d0111[_0xd84c('0x5')]){var _0x317a07=_0x2d0111[_0xd84c('0x4')];var _0x49f1d9=_0x2d0111[_0xd84c('0x5')];var _0x1f6718=_0x317a07[_0xd84c('0x6')]('-')[0x4];var _0x357e6f=_0x317a07['split']('-')[0x0];var _0x4b72b3=crypto[_0xd84c('0x7')](_0xd84c('0x8'),util[_0xd84c('0x9')](_0xd84c('0xa'),_0x1f6718,_0x317a07,_0x357e6f));var _0x22bd29=_0x4b72b3['update'](_0x49f1d9,_0xd84c('0xb'),_0xd84c('0xc'));_0x22bd29+=_0x4b72b3[_0xd84c('0xd')](_0xd84c('0xc'));var _0x163069=JSON[_0xd84c('0xe')](_0x22bd29);return _0x163069['hasOwnProperty'](_0x171331)?_0x163069[_0x171331]:null;}}return null;}function isLimit(_0x15fa46,_0x9768ad,_0x878e06,_0x8a56a6){var _0x162e2b=_0x9768ad;return compose()[_0xd84c('0xf')](function(_0x53bcd6,_0x49cef9,_0x5906e6){return db[_0xd84c('0x10')][_0xd84c('0x11')]({'where':{'id':0x1},'raw':!![]})[_0xd84c('0x12')](function(_0x444c88){var _0x52bc97=getValueFromLicense(_0x15fa46,_0x444c88);return _0x52bc97?_0x52bc97:_0x162e2b;})[_0xd84c('0x12')](function(_0x32e8b8){_0x162e2b=_0x32e8b8;return _0x878e06[_0xd84c('0x13')](_0x8a56a6);})[_0xd84c('0x12')](function(_0x41f49c){if(_0x41f49c>=_0x162e2b){return _0x49cef9[_0xd84c('0x14')](0x193)['json']({'message':util[_0xd84c('0x9')](_0xd84c('0x15'),_0x15fa46)});}_0x5906e6();})[_0xd84c('0x16')](function(_0x832973){_0x5906e6(_0x832973);});});}function isUserLimit(){return isLimit(_0xd84c('0x17'),0x1,db[_0xd84c('0x18')],{'where':{'$or':[{'role':_0xd84c('0x19')},{'role':'user'}]}});}exports[_0xd84c('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 719503f..ff4a4e9 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 _0x9c1b=['hours','minutes','seconds','lodash','moment','startsWith','[$or]','and','replace','[$and]','slice','forEach','split','match','filter','map','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','add','days','YYYY-MM-DD','text','field','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','$ne','$startsWith','$lt','<\x20?','>\x20?','$lte','<=\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','$endsWith','shift','utcOffset','format'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9c1b,0x1d7));var _0xb9c1=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x9c1b[_0x209ec9];return _0x129b1b;};'use strict';var _=require(_0xb9c1('0x0'));var moment=require(_0xb9c1('0x1'));exports['parseSearch']=function(_0x38fe71){var _0x149cb9={'conditions':[]};_0x149cb9['sqlOperator']=_[_0xb9c1('0x2')](_0x38fe71,_0xb9c1('0x3'))?'or':_0xb9c1('0x4');var _0x59ba8e=_0x38fe71[_0xb9c1('0x5')](_0xb9c1('0x6'),'')[_0xb9c1('0x5')](_0xb9c1('0x3'),'')['split']('||');for(var _0x6799a0=0x0;_0x6799a0<_0x59ba8e['length'];_0x6799a0++){var _0x51340b=_0x59ba8e[_0x6799a0]['split'](':=');var _0x28daf1=_0x51340b[0x0];var _0x2d19be=_0x51340b[_0xb9c1('0x7')](0x1);_0x2d19be[_0xb9c1('0x8')](function(_0x15bbbd){var _0x44fd9f=_0x15bbbd[_0xb9c1('0x9')]('[')['shift']();var _0xb03a34=_0x15bbbd[_0xb9c1('0xa')](/\[(.*?)\]/g);_0xb03a34[_0xb9c1('0x8')](function(_0x2e55c0){var _0x2330d7=_0x2e55c0[_0xb9c1('0x9')]('[')[_0xb9c1('0xb')](function(_0x3dc73d){return _0x3dc73d['indexOf'](']')>-0x1;})[_0xb9c1('0xc')](function(_0x13072c){return _0x13072c[_0xb9c1('0x9')](']')[0x0];})[0x0];_0x149cb9[_0xb9c1('0xd')][_0xb9c1('0xe')]({'field':_0x28daf1,'operator':_0x44fd9f,'value':_0x2330d7});});});}return _0x149cb9;};exports[_0xb9c1('0xf')]=function(_0x2f13df,_0x39a5b1,_0x488865){var _0x342fae={};if(_0x39a5b1===_0xb9c1('0x10')){if(_0x488865[_0xb9c1('0x11')]===_0xb9c1('0x12')){_0x488865[_0xb9c1('0x11')]='$between';_0x488865[_0xb9c1('0x13')]+=','+_0x488865[_0xb9c1('0x13')];}else if(_[_0xb9c1('0x14')]([_0xb9c1('0x15'),'$lte'],_0x488865['operator'])){_0x488865[_0xb9c1('0x13')]=moment(_0x488865[_0xb9c1('0x13')])[_0xb9c1('0x16')](0x1,_0xb9c1('0x17'))['format'](_0xb9c1('0x18'));}}if(_0x488865['castTo']){_0x39a5b1=_0x488865['castTo'];_0x342fae[_0xb9c1('0x19')]='CAST('+_0x2f13df+'.'+_0x488865['field']+'\x20AS\x20'+_0x488865['castTo']+')\x20'+parseOperator(_0x488865[_0xb9c1('0x11')]);}else{_0x342fae['text']=_0x2f13df+'.'+_0x488865[_0xb9c1('0x1a')]+'\x20'+parseOperator(_0x488865['operator']);}if(_['includes'](['$ne',_0xb9c1('0x1b')],_0x488865['operator']))_0x342fae[_0xb9c1('0x19')]='('+_0x342fae['text']+_0xb9c1('0x1c')+_0x2f13df+'.'+_0x488865[_0xb9c1('0x1a')]+_0xb9c1('0x1d');_0x342fae[_0xb9c1('0x13')]=parseValue(_0x39a5b1,_0x488865[_0xb9c1('0x11')],_0x488865[_0xb9c1('0x13')]);return _0x342fae;};function parseOperator(_0x19559a){var _0x100825;switch(_0x19559a){case _0xb9c1('0x1e'):_0x100825=_0xb9c1('0x1f');break;case _0xb9c1('0x1b'):_0x100825='NOT\x20IN\x20?';break;case'$eq':_0x100825=_0xb9c1('0x20');break;case _0xb9c1('0x21'):_0x100825='<>\x20?';break;case'$substring':case _0xb9c1('0x22'):case'$endsWith':_0x100825='LIKE\x20?';break;case _0xb9c1('0x23'):_0x100825=_0xb9c1('0x24');break;case _0xb9c1('0x15'):_0x100825=_0xb9c1('0x25');break;case _0xb9c1('0x26'):_0x100825=_0xb9c1('0x27');break;case _0xb9c1('0x28'):_0x100825='>=\x20?';break;case _0xb9c1('0x29'):_0x100825=_0xb9c1('0x2a');break;}return _0x100825;}function parseValue(_0x28814f,_0x5ab9b2,_0x27a913){var _0x1feb8d={'start':undefined,'end':undefined};switch(_0x5ab9b2){case'$in':case'$notIn':_0x1feb8d[_0xb9c1('0x2b')]=_0x27a913[_0xb9c1('0x9')](',');break;case _0xb9c1('0x2c'):_0x1feb8d['start']='%'+_0x27a913+'%';break;case _0xb9c1('0x22'):_0x1feb8d[_0xb9c1('0x2b')]=_0x27a913+'%';break;case _0xb9c1('0x2d'):_0x1feb8d['start']='%'+_0x27a913;break;case'$between':var _0x2f7525=_0x27a913[_0xb9c1('0x9')](',');var _0x27a913=_0x2f7525[_0xb9c1('0x2e')]();var _0x1d746e=_0x2f7525['pop']();if(_0x28814f===_0xb9c1('0x10')){_0x27a913=moment(_0x27a913)[_0xb9c1('0x2f')](0x0,!![])[_0xb9c1('0x30')]();_0x1d746e=moment(_0x1d746e)[_0xb9c1('0x2f')](0x0,!![])[_0xb9c1('0x16')](0x17,_0xb9c1('0x31'))['add'](0x3b,_0xb9c1('0x32'))[_0xb9c1('0x16')](0x3b,_0xb9c1('0x33'))['format']();}_0x1feb8d={'start':_0x27a913,'end':_0x1d746e};break;default:_0x1feb8d['start']=_0x27a913;break;}return _0x1feb8d;} \ No newline at end of file +var _0xd1a7=['map','conditions','buildExpression','DATE','operator','$between','value','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','includes','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','pop','hours','minutes','lodash','parseSearch','startsWith','replace','[$and]','[$or]','split','length','slice','forEach','shift','filter','indexOf'];(function(_0x45c12c,_0x496b00){var _0x500578=function(_0x4273fb){while(--_0x4273fb){_0x45c12c['push'](_0x45c12c['shift']());}};_0x500578(++_0x496b00);}(_0xd1a7,0x166));var _0x7d1a=function(_0x2e875d,_0x4be9ff){_0x2e875d=_0x2e875d-0x0;var _0x8ac843=_0xd1a7[_0x2e875d];return _0x8ac843;};'use strict';var _=require(_0x7d1a('0x0'));var moment=require('moment');exports[_0x7d1a('0x1')]=function(_0x54bcac){var _0x4125cf={'conditions':[]};_0x4125cf['sqlOperator']=_[_0x7d1a('0x2')](_0x54bcac,'[$or]')?'or':'and';var _0x3cf840=_0x54bcac[_0x7d1a('0x3')](_0x7d1a('0x4'),'')[_0x7d1a('0x3')](_0x7d1a('0x5'),'')[_0x7d1a('0x6')]('||');for(var _0x231470=0x0;_0x231470<_0x3cf840[_0x7d1a('0x7')];_0x231470++){var _0x1e0eb5=_0x3cf840[_0x231470][_0x7d1a('0x6')](':=');var _0x3dcf73=_0x1e0eb5[0x0];var _0x1a740d=_0x1e0eb5[_0x7d1a('0x8')](0x1);_0x1a740d[_0x7d1a('0x9')](function(_0xb46690){var _0x14e3f6=_0xb46690[_0x7d1a('0x6')]('[')[_0x7d1a('0xa')]();var _0x1ea981=_0xb46690['match'](/\[(.*?)\]/g);_0x1ea981[_0x7d1a('0x9')](function(_0x11e34a){var _0x22ff65=_0x11e34a['split']('[')[_0x7d1a('0xb')](function(_0x211837){return _0x211837[_0x7d1a('0xc')](']')>-0x1;})[_0x7d1a('0xd')](function(_0x3ab30a){return _0x3ab30a['split'](']')[0x0];})[0x0];_0x4125cf[_0x7d1a('0xe')]['push']({'field':_0x3dcf73,'operator':_0x14e3f6,'value':_0x22ff65});});});}return _0x4125cf;};exports[_0x7d1a('0xf')]=function(_0x1a811,_0x1d5731,_0x52e425){var _0x124ab0={};if(_0x1d5731===_0x7d1a('0x10')){if(_0x52e425['operator']==='$eq'){_0x52e425[_0x7d1a('0x11')]=_0x7d1a('0x12');_0x52e425[_0x7d1a('0x13')]+=','+_0x52e425[_0x7d1a('0x13')];}else if(_['includes']([_0x7d1a('0x14'),_0x7d1a('0x15')],_0x52e425[_0x7d1a('0x11')])){_0x52e425[_0x7d1a('0x13')]=moment(_0x52e425['value'])[_0x7d1a('0x16')](0x1,'days')[_0x7d1a('0x17')](_0x7d1a('0x18'));}}if(_0x52e425[_0x7d1a('0x19')]){_0x1d5731=_0x52e425[_0x7d1a('0x19')];_0x124ab0[_0x7d1a('0x1a')]=_0x7d1a('0x1b')+_0x1a811+'.'+_0x52e425['field']+_0x7d1a('0x1c')+_0x52e425['castTo']+')\x20'+parseOperator(_0x52e425[_0x7d1a('0x11')]);}else{_0x124ab0[_0x7d1a('0x1a')]=_0x1a811+'.'+_0x52e425['field']+'\x20'+parseOperator(_0x52e425[_0x7d1a('0x11')]);}if(_[_0x7d1a('0x1d')](['$ne',_0x7d1a('0x1e')],_0x52e425[_0x7d1a('0x11')]))_0x124ab0['text']='('+_0x124ab0[_0x7d1a('0x1a')]+_0x7d1a('0x1f')+_0x1a811+'.'+_0x52e425['field']+_0x7d1a('0x20');_0x124ab0['value']=parseValue(_0x1d5731,_0x52e425['operator'],_0x52e425['value']);return _0x124ab0;};function parseOperator(_0x53708d){var _0x4d0f94;switch(_0x53708d){case _0x7d1a('0x21'):_0x4d0f94=_0x7d1a('0x22');break;case _0x7d1a('0x1e'):_0x4d0f94=_0x7d1a('0x23');break;case _0x7d1a('0x24'):_0x4d0f94=_0x7d1a('0x25');break;case _0x7d1a('0x26'):_0x4d0f94=_0x7d1a('0x27');break;case _0x7d1a('0x28'):case _0x7d1a('0x29'):case _0x7d1a('0x2a'):_0x4d0f94=_0x7d1a('0x2b');break;case _0x7d1a('0x2c'):_0x4d0f94='<\x20?';break;case _0x7d1a('0x14'):_0x4d0f94=_0x7d1a('0x2d');break;case'$lte':_0x4d0f94=_0x7d1a('0x2e');break;case _0x7d1a('0x2f'):_0x4d0f94='>=\x20?';break;case _0x7d1a('0x12'):_0x4d0f94=_0x7d1a('0x30');break;}return _0x4d0f94;}function parseValue(_0x414509,_0x25aa8d,_0x268da3){var _0xb7192a={'start':undefined,'end':undefined};switch(_0x25aa8d){case _0x7d1a('0x21'):case _0x7d1a('0x1e'):_0xb7192a[_0x7d1a('0x31')]=_0x268da3[_0x7d1a('0x6')](',');break;case _0x7d1a('0x28'):_0xb7192a[_0x7d1a('0x31')]='%'+_0x268da3+'%';break;case'$startsWith':_0xb7192a['start']=_0x268da3+'%';break;case'$endsWith':_0xb7192a[_0x7d1a('0x31')]='%'+_0x268da3;break;case _0x7d1a('0x12'):var _0x2fbdd9=_0x268da3[_0x7d1a('0x6')](',');var _0x268da3=_0x2fbdd9[_0x7d1a('0xa')]();var _0x27931f=_0x2fbdd9[_0x7d1a('0x32')]();if(_0x414509==='DATE'){_0x268da3=moment(_0x268da3)['utcOffset'](0x0,!![])[_0x7d1a('0x17')]();_0x27931f=moment(_0x27931f)['utcOffset'](0x0,!![])['add'](0x17,_0x7d1a('0x33'))['add'](0x3b,_0x7d1a('0x34'))[_0x7d1a('0x16')](0x3b,'seconds')[_0x7d1a('0x17')]();}_0xb7192a={'start':_0x268da3,'end':_0x27931f};break;default:_0xb7192a[_0x7d1a('0x31')]=_0x268da3;break;}return _0xb7192a;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d2431d0..8e2b44d 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 _0x6b39=['format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','sort','map','indexOf','priority','cast','col','DESC','unsigned','length','isObject','isString','hasOwnProperty','omit','isNumeric','match','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','push','join','getOptions','$id','query','model','intersection','attributes','offset','order','where','filter','object','includes','columns','value','merge','type','VIRTUAL','lower','options','parse','keys','fields','split','filters','isEmpty','find','isPlainObject','$gte'];(function(_0xbfcb59,_0x34fb3b){var _0x4d999a=function(_0x4386b5){while(--_0x4386b5){_0xbfcb59['push'](_0xbfcb59['shift']());}};_0x4d999a(++_0x34fb3b);}(_0x6b39,0x1cf));var _0x96b3=function(_0xc89450,_0x2acbe6){_0xc89450=_0xc89450-0x0;var _0x5cd7f5=_0x6b39[_0xc89450];return _0x5cd7f5;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2e1259){var _0x547b24=['ne'];try{var _0x45d47b=JSON[_0x96b3('0x0')](_0x2e1259);var _0x1855bd=Object[_0x96b3('0x1')](_0x45d47b)[0x0];return _0x547b24['includes'](_0x1855bd);}catch(_0x5da8a6){return![];}}function getOperatorValue(_0x5eb0ee){var _0x2a1843=JSON[_0x96b3('0x0')](_0x5eb0ee);var _0x4fcf04=Object['keys'](_0x2a1843)[0x0];var _0x48b7c8=_0x2a1843[_0x4fcf04];return{['$'+_0x4fcf04]:_0x48b7c8};}exports[_0x96b3('0x2')]=function(_0x566591){var _0x22e851=null;if(_0x566591){_0x22e851=_0x566591[_0x96b3('0x3')](',');}return _0x22e851;};exports[_0x96b3('0x4')]=function(_0x274e82,_0x27a4d8){var _0x4db808={};if(!_[_0x96b3('0x5')](_0x274e82)){_['forOwn'](_0x274e82,function(_0x299ced,_0x1a2edd){try{if(_0x27a4d8){var _0x30cfae=_[_0x96b3('0x6')](_0x27a4d8,{'name':_0x1a2edd})||{};if(hasSequelizeOperator(_0x299ced)){_0x4db808[_0x1a2edd]=getOperatorValue(_0x299ced);}else if(_0x30cfae['type']==='DATE'&&_[_0x96b3('0x7')](_0x299ced)){var _0x42e868=JSON[_0x96b3('0x0')](_0x299ced);var _0x9142b1={'$gte':moment(moment(_0x42e868[_0x96b3('0x8')])[_0x96b3('0x9')](_0x96b3('0xa')))[_0x96b3('0xb')]()[_0x96b3('0x9')](),'$lte':moment(moment(_0x42e868[_0x96b3('0xc')])['format'](_0x96b3('0xa')))[_0x96b3('0xb')]()[_0x96b3('0xd')](0x1,'s')[_0x96b3('0x9')]()};_0x4db808[_0x1a2edd]=_0x9142b1;}else if(_0x30cfae[_0x96b3('0xe')]===_0x96b3('0xf')){_0x4db808[_0x1a2edd]=_0x299ced;}else{_0x4db808[_0x1a2edd]=_[_0x96b3('0x10')](_0x299ced)?_0x299ced:JSON['parse'](_0x299ced);}}else{_0x4db808[_0x1a2edd]=_[_0x96b3('0x10')](_0x299ced)?_0x299ced:JSON[_0x96b3('0x0')](_0x299ced);}}catch(_0x4bb23c){_0x4db808[_0x1a2edd]=_0x299ced[_0x96b3('0x3')](',');}});}return _0x4db808;};exports[_0x96b3('0x11')]=function(_0x48f412){_0x48f412=parseInt(_0x48f412,0xa);if(!_0x48f412||_0x48f412<0x0){_0x48f412=LIMIT_VALUE;}return _0x48f412;};exports['offset']=function(_0xa12578){_0xa12578=parseInt(_0xa12578,0xa);if(!_0xa12578||_0xa12578<0x0){_0xa12578=0x0;}return _0xa12578;};exports[_0x96b3('0x12')]=function(_0x4c3da7){var _0x3234c6,_0x256b46=null;if(_0x4c3da7){_0x3234c6=_0x4c3da7[_0x96b3('0x3')](',');_0x256b46=_[_0x96b3('0x13')](_0x3234c6,function(_0x3a7427){if(_0x3a7427[_0x96b3('0x14')]('-')===0x0){return[_0x3a7427===_0x96b3('0x15')?sequelize[_0x96b3('0x16')](sequelize[_0x96b3('0x17')](_0x96b3('0x15')),'unsigned'):_0x3a7427['substr'](0x1),_0x96b3('0x18')];}else{return[_0x3a7427===_0x96b3('0x15')?sequelize['cast'](sequelize[_0x96b3('0x17')](_0x96b3('0x15')),_0x96b3('0x19')):_0x3a7427,'ASC'];}});}return _0x256b46;};exports['omit']=function(_0x54d8fb,_0x19aa18){if(_[_0x96b3('0x5')](_0x54d8fb)){return _0x54d8fb;}if(_[_0x96b3('0x10')](_0x54d8fb)){for(var _0x609c35=0x0;_0x609c35<_0x54d8fb[_0x96b3('0x1a')];_0x609c35+=0x1){_0x54d8fb[_0x609c35]=this['omit'](_0x54d8fb[_0x609c35],_0x19aa18);}return _0x54d8fb;}if(!_[_0x96b3('0x1b')](_0x54d8fb)){return _0x54d8fb;}if(_[_0x96b3('0x1c')](_0x19aa18)){_0x19aa18=[_0x19aa18];}if(!_[_0x96b3('0x10')](_0x19aa18)){return _0x54d8fb;}for(var _0x1e324b=0x0;_0x1e324b<_0x19aa18['length'];_0x1e324b+=0x1){_['unset'](_0x54d8fb,_0x19aa18[_0x1e324b]);}for(var _0x52ca28 in _0x54d8fb){if(_0x54d8fb[_0x96b3('0x1d')](_0x52ca28)){_0x54d8fb[_0x52ca28]=this[_0x96b3('0x1e')](_0x54d8fb[_0x52ca28],_0x19aa18);}}return _0x54d8fb;};exports[_0x96b3('0x1f')]=function(_0x52af64){return _0x52af64[_0x96b3('0x20')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x96b3('0x21')]=function(_0xd36f75){return _0xd36f75[_0x96b3('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0x96b3('0x22')]=function(_0x752bfb,_0x2d5cb8){var _0x1d5101=[];var _0x3b43c6=/[ `!@#$%^&*()_\-?~]/;var _0x239a84=_0x2d5cb8?_0x96b3('0x23'):_0x96b3('0x24');_0x752bfb[_0x96b3('0x3')](/[ ,]+/)['forEach'](function(_0x1aa972){_0x1aa972=_0x1aa972[_0x96b3('0x25')](/([^:]")"+/g,'$1');_0x1aa972='+'+_0x1aa972+'*';var _0x4da34=_0x1aa972['match'](_0x3b43c6);if(_0x4da34){_0x1aa972='\x22'+_0x1aa972+'\x22';}_0x1d5101[_0x96b3('0x26')](_0x1aa972);});_0x239a84=_0x239a84[_0x96b3('0x25')](_0x96b3('0x24'),_0x1d5101[_0x96b3('0x27')]('\x20'));return _0x239a84;};exports[_0x96b3('0x28')]=function(_0x31b58d,_0x5873ee,_0x1a384c){var _0x31b29c={},_0x1f8f2c={};if(_0x5873ee['query'][_0x96b3('0x29')]){_0x5873ee['query']['id']=_0x5873ee[_0x96b3('0x2a')][_0x96b3('0x29')];delete _0x5873ee[_0x96b3('0x2a')][_0x96b3('0x29')];}_0x31b29c[_0x96b3('0x2b')]=_[_0x96b3('0x13')](_0x31b58d,_0x96b3('0xe'));_0x31b29c[_0x96b3('0x2a')]=_[_0x96b3('0x1')](_0x5873ee[_0x96b3('0x2a')]);_0x31b29c[_0x96b3('0x4')]=_[_0x96b3('0x2c')](_0x31b29c[_0x96b3('0x2b')],_0x31b29c[_0x96b3('0x2a')]);_0x1f8f2c[_0x96b3('0x2d')]=_['intersection'](_0x31b29c[_0x96b3('0x2b')],this['fields'](_0x5873ee['query']['fields']));_0x1f8f2c[_0x96b3('0x2d')]=_0x1f8f2c[_0x96b3('0x2d')][_0x96b3('0x1a')]?_0x1f8f2c['attributes']:_0x31b29c[_0x96b3('0x2b')];if(!_0x5873ee[_0x96b3('0x2a')]['hasOwnProperty']('nolimit')){_0x1f8f2c[_0x96b3('0x11')]=this['limit'](_0x5873ee[_0x96b3('0x2a')][_0x96b3('0x11')]);_0x1f8f2c[_0x96b3('0x2e')]=this[_0x96b3('0x2e')](_0x5873ee[_0x96b3('0x2a')][_0x96b3('0x2e')]);}_0x1f8f2c[_0x96b3('0x2f')]=this['sort'](_0x5873ee[_0x96b3('0x2a')][_0x96b3('0x12')]);_0x1f8f2c[_0x96b3('0x30')]=this[_0x96b3('0x4')](_['pick'](_0x5873ee['query'],_0x31b29c['filters']),_0x31b58d);if(_0x5873ee['query']['filter']){var _0x4825d2=_0x31b58d;var _0x225162=_0x5873ee[_0x96b3('0x2a')][_0x96b3('0x31')];if(typeof _0x225162===_0x96b3('0x32')){_0x4825d2=_[_0x96b3('0x31')](_0x31b58d,function(_0x244020){return _[_0x96b3('0x33')](_0x225162[_0x96b3('0x34')],_0x244020[_0x96b3('0xe')]);});_0x225162=_0x225162[_0x96b3('0x35')];}_0x1f8f2c[_0x96b3('0x30')]=_[_0x96b3('0x36')](_0x1f8f2c[_0x96b3('0x30')],{'$or':_['map'](_0x4825d2,function(_0x32b3c9){if(_0x32b3c9[_0x96b3('0x37')]!==_0x96b3('0x38')){if(_0x1a384c){return sequelize['where'](sequelize['fn'](_0x96b3('0x39'),sequelize[_0x96b3('0x17')](_0x32b3c9[_0x96b3('0xe')])),{'$like':sequelize['fn'](_0x96b3('0x39'),'%'+_0x5873ee[_0x96b3('0x2a')][_0x96b3('0x31')]+'%')});}else{var _0x3cd871={};_0x3cd871[_0x32b3c9[_0x96b3('0xe')]]={'$like':'%'+_0x5873ee[_0x96b3('0x2a')][_0x96b3('0x31')]+'%'};return _0x3cd871;}}})});}_0x1f8f2c=_['merge']({},_0x1f8f2c,_0x5873ee[_0x96b3('0x3a')]);return _0x1f8f2c;}; \ No newline at end of file +var _0x2f0b=['match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','{EXPR}','join','getOptions','query','$id','model','map','intersection','attributes','nolimit','limit','offset','order','where','pick','filter','object','columns','value','VIRTUAL','lower','options','lodash','sequelize','moment','keys','includes','parse','fields','split','filters','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','sort','indexOf','col','priority','unsigned','substr','DESC','cast','ASC','omit','isEmpty','isObject','isString','length','unset','hasOwnProperty','isNumeric'];(function(_0x5de0e2,_0x5be79b){var _0x53adb9=function(_0x4d6dec){while(--_0x4d6dec){_0x5de0e2['push'](_0x5de0e2['shift']());}};_0x53adb9(++_0x5be79b);}(_0x2f0b,0x129));var _0xb2f0=function(_0x4d3faf,_0xc0f5ba){_0x4d3faf=_0x4d3faf-0x0;var _0x5848f6=_0x2f0b[_0x4d3faf];return _0x5848f6;};'use strict';var _=require(_0xb2f0('0x0'));var sequelize=require(_0xb2f0('0x1'));var moment=require(_0xb2f0('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4332b4){var _0x1193a2=['ne'];try{var _0x4b7218=JSON['parse'](_0x4332b4);var _0x435fec=Object[_0xb2f0('0x3')](_0x4b7218)[0x0];return _0x1193a2[_0xb2f0('0x4')](_0x435fec);}catch(_0x5bb973){return![];}}function getOperatorValue(_0x34bfcd){var _0x5d62b8=JSON[_0xb2f0('0x5')](_0x34bfcd);var _0x508edf=Object[_0xb2f0('0x3')](_0x5d62b8)[0x0];var _0x5aecd9=_0x5d62b8[_0x508edf];return{['$'+_0x508edf]:_0x5aecd9};}exports[_0xb2f0('0x6')]=function(_0xf2cb79){var _0x28f6dd=null;if(_0xf2cb79){_0x28f6dd=_0xf2cb79[_0xb2f0('0x7')](',');}return _0x28f6dd;};exports[_0xb2f0('0x8')]=function(_0x9cf4cc,_0x4d48c6){var _0x1f9c5d={};if(!_['isEmpty'](_0x9cf4cc)){_['forOwn'](_0x9cf4cc,function(_0x8b8d4c,_0x23d09e){try{if(_0x4d48c6){var _0x4498da=_[_0xb2f0('0x9')](_0x4d48c6,{'name':_0x23d09e})||{};if(hasSequelizeOperator(_0x8b8d4c)){_0x1f9c5d[_0x23d09e]=getOperatorValue(_0x8b8d4c);}else if(_0x4498da[_0xb2f0('0xa')]===_0xb2f0('0xb')&&_[_0xb2f0('0xc')](_0x8b8d4c)){var _0x2741e4=JSON['parse'](_0x8b8d4c);var _0x2d877e={'$gte':moment(moment(_0x2741e4[_0xb2f0('0xd')])[_0xb2f0('0xe')](_0xb2f0('0xf')))[_0xb2f0('0x10')]()[_0xb2f0('0xe')](),'$lte':moment(moment(_0x2741e4[_0xb2f0('0x11')])[_0xb2f0('0xe')](_0xb2f0('0xf')))[_0xb2f0('0x10')]()[_0xb2f0('0x12')](0x1,'s')[_0xb2f0('0xe')]()};_0x1f9c5d[_0x23d09e]=_0x2d877e;}else if(_0x4498da[_0xb2f0('0x13')]==='uniqueid'){_0x1f9c5d[_0x23d09e]=_0x8b8d4c;}else{_0x1f9c5d[_0x23d09e]=_[_0xb2f0('0x14')](_0x8b8d4c)?_0x8b8d4c:JSON[_0xb2f0('0x5')](_0x8b8d4c);}}else{_0x1f9c5d[_0x23d09e]=_[_0xb2f0('0x14')](_0x8b8d4c)?_0x8b8d4c:JSON[_0xb2f0('0x5')](_0x8b8d4c);}}catch(_0x514377){_0x1f9c5d[_0x23d09e]=_0x8b8d4c[_0xb2f0('0x7')](',');}});}return _0x1f9c5d;};exports['limit']=function(_0x419717){_0x419717=parseInt(_0x419717,0xa);if(!_0x419717||_0x419717<0x0){_0x419717=LIMIT_VALUE;}return _0x419717;};exports['offset']=function(_0x10c2cc){_0x10c2cc=parseInt(_0x10c2cc,0xa);if(!_0x10c2cc||_0x10c2cc<0x0){_0x10c2cc=0x0;}return _0x10c2cc;};exports[_0xb2f0('0x15')]=function(_0x401543){var _0x407fa2,_0x293ecf=null;if(_0x401543){_0x407fa2=_0x401543['split'](',');_0x293ecf=_['map'](_0x407fa2,function(_0x5cf551){if(_0x5cf551[_0xb2f0('0x16')]('-')===0x0){return[_0x5cf551==='priority'?sequelize['cast'](sequelize[_0xb2f0('0x17')](_0xb2f0('0x18')),_0xb2f0('0x19')):_0x5cf551[_0xb2f0('0x1a')](0x1),_0xb2f0('0x1b')];}else{return[_0x5cf551===_0xb2f0('0x18')?sequelize[_0xb2f0('0x1c')](sequelize[_0xb2f0('0x17')](_0xb2f0('0x18')),_0xb2f0('0x19')):_0x5cf551,_0xb2f0('0x1d')];}});}return _0x293ecf;};exports[_0xb2f0('0x1e')]=function(_0x38a8fd,_0x29a047){if(_[_0xb2f0('0x1f')](_0x38a8fd)){return _0x38a8fd;}if(_[_0xb2f0('0x14')](_0x38a8fd)){for(var _0x101a76=0x0;_0x101a76<_0x38a8fd['length'];_0x101a76+=0x1){_0x38a8fd[_0x101a76]=this['omit'](_0x38a8fd[_0x101a76],_0x29a047);}return _0x38a8fd;}if(!_[_0xb2f0('0x20')](_0x38a8fd)){return _0x38a8fd;}if(_[_0xb2f0('0x21')](_0x29a047)){_0x29a047=[_0x29a047];}if(!_[_0xb2f0('0x14')](_0x29a047)){return _0x38a8fd;}for(var _0x5b39e2=0x0;_0x5b39e2<_0x29a047[_0xb2f0('0x22')];_0x5b39e2+=0x1){_[_0xb2f0('0x23')](_0x38a8fd,_0x29a047[_0x5b39e2]);}for(var _0x4ed148 in _0x38a8fd){if(_0x38a8fd[_0xb2f0('0x24')](_0x4ed148)){_0x38a8fd[_0x4ed148]=this['omit'](_0x38a8fd[_0x4ed148],_0x29a047);}}return _0x38a8fd;};exports[_0xb2f0('0x25')]=function(_0x1cfc48){return _0x1cfc48[_0xb2f0('0x26')](RegExp(_0xb2f0('0x27')))?!![]:![];};exports[_0xb2f0('0x28')]=function(_0x36a1e4){return _0x36a1e4['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xb2f0('0x29')]=function(_0xe11f9b,_0xcee1f1){var _0x11c100=[];var _0x11732a=/[ `!@#$%^&*()_\-?~]/;var _0x7cd3f5=_0xcee1f1?'\x22{EXPR}\x22':'{EXPR}';_0xe11f9b[_0xb2f0('0x7')](/[ ,]+/)[_0xb2f0('0x2a')](function(_0x538a22){_0x538a22=_0x538a22[_0xb2f0('0x2b')](/([^:]")"+/g,'$1');_0x538a22='+'+_0x538a22+'*';var _0x429892=_0x538a22[_0xb2f0('0x26')](_0x11732a);if(_0x429892){_0x538a22='\x22'+_0x538a22+'\x22';}_0x11c100[_0xb2f0('0x2c')](_0x538a22);});_0x7cd3f5=_0x7cd3f5[_0xb2f0('0x2b')](_0xb2f0('0x2d'),_0x11c100[_0xb2f0('0x2e')]('\x20'));return _0x7cd3f5;};exports[_0xb2f0('0x2f')]=function(_0x55c161,_0x3dde1b,_0x889096){var _0x4925b={},_0x3c66ec={};if(_0x3dde1b[_0xb2f0('0x30')][_0xb2f0('0x31')]){_0x3dde1b[_0xb2f0('0x30')]['id']=_0x3dde1b[_0xb2f0('0x30')]['$id'];delete _0x3dde1b[_0xb2f0('0x30')][_0xb2f0('0x31')];}_0x4925b[_0xb2f0('0x32')]=_[_0xb2f0('0x33')](_0x55c161,_0xb2f0('0x13'));_0x4925b[_0xb2f0('0x30')]=_['keys'](_0x3dde1b[_0xb2f0('0x30')]);_0x4925b['filters']=_[_0xb2f0('0x34')](_0x4925b[_0xb2f0('0x32')],_0x4925b[_0xb2f0('0x30')]);_0x3c66ec[_0xb2f0('0x35')]=_[_0xb2f0('0x34')](_0x4925b[_0xb2f0('0x32')],this[_0xb2f0('0x6')](_0x3dde1b[_0xb2f0('0x30')][_0xb2f0('0x6')]));_0x3c66ec[_0xb2f0('0x35')]=_0x3c66ec[_0xb2f0('0x35')][_0xb2f0('0x22')]?_0x3c66ec[_0xb2f0('0x35')]:_0x4925b['model'];if(!_0x3dde1b['query'][_0xb2f0('0x24')](_0xb2f0('0x36'))){_0x3c66ec[_0xb2f0('0x37')]=this[_0xb2f0('0x37')](_0x3dde1b['query'][_0xb2f0('0x37')]);_0x3c66ec[_0xb2f0('0x38')]=this[_0xb2f0('0x38')](_0x3dde1b['query'][_0xb2f0('0x38')]);}_0x3c66ec[_0xb2f0('0x39')]=this['sort'](_0x3dde1b['query'][_0xb2f0('0x15')]);_0x3c66ec[_0xb2f0('0x3a')]=this[_0xb2f0('0x8')](_[_0xb2f0('0x3b')](_0x3dde1b[_0xb2f0('0x30')],_0x4925b[_0xb2f0('0x8')]),_0x55c161);if(_0x3dde1b['query'][_0xb2f0('0x3c')]){var _0xfc6c60=_0x55c161;var _0xf388b1=_0x3dde1b[_0xb2f0('0x30')][_0xb2f0('0x3c')];if(typeof _0xf388b1===_0xb2f0('0x3d')){_0xfc6c60=_[_0xb2f0('0x3c')](_0x55c161,function(_0x75cd05){return _['includes'](_0xf388b1[_0xb2f0('0x3e')],_0x75cd05[_0xb2f0('0x13')]);});_0xf388b1=_0xf388b1[_0xb2f0('0x3f')];}_0x3c66ec[_0xb2f0('0x3a')]=_['merge'](_0x3c66ec[_0xb2f0('0x3a')],{'$or':_[_0xb2f0('0x33')](_0xfc6c60,function(_0x2b76a1){if(_0x2b76a1['type']!==_0xb2f0('0x40')){if(_0x889096){return sequelize[_0xb2f0('0x3a')](sequelize['fn'](_0xb2f0('0x41'),sequelize[_0xb2f0('0x17')](_0x2b76a1[_0xb2f0('0x13')])),{'$like':sequelize['fn'](_0xb2f0('0x41'),'%'+_0x3dde1b[_0xb2f0('0x30')][_0xb2f0('0x3c')]+'%')});}else{var _0x5bdc3d={};_0x5bdc3d[_0x2b76a1[_0xb2f0('0x13')]]={'$like':'%'+_0x3dde1b[_0xb2f0('0x30')]['filter']+'%'};return _0x5bdc3d;}}})});}_0x3c66ec=_['merge']({},_0x3c66ec,_0x3dde1b[_0xb2f0('0x42')]);return _0x3c66ec;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index b4d549b..5115f54 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 _0xc82d=['toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','online','omit','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','voicePause','pause','faxStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','internal','substring','indexOf','sort','pauseType'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc82d,0x1ac));var _0xdc82=function(_0x402dfe,_0x143d24){_0x402dfe=_0x402dfe-0x0;var _0x521b9a=_0xc82d[_0x402dfe];return _0x521b9a;};'use strict';var _=require(_0xdc82('0x0'));var jayson=require(_0xdc82('0x1'));var db=require(_0xdc82('0x2'))['db'];var amiClient=jayson[_0xdc82('0x3')][_0xdc82('0x4')]({'port':0x232a});var routingClient=jayson[_0xdc82('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x2ad855,_0x4d6d11){var _0x3cc8f7=[_0x2ad855[_0xdc82('0x5')],_0x2ad855[_0xdc82('0x6')],_0x2ad855[_0xdc82('0x7')],_0x2ad855[_0xdc82('0x8')],_0x2ad855[_0xdc82('0x9')],_0x2ad855['voicePause'],_0x2ad855[_0xdc82('0xa')]];if(!_0x4d6d11)return _[_0xdc82('0xb')](_0x3cc8f7);var _0x55f9ae=_[_0xdc82('0xc')](_0x3cc8f7);return _0x55f9ae['length']>0x0&&_0x55f9ae[_0xdc82('0xd')]<_0x3cc8f7[_0xdc82('0xd')]?!![]:![];}function isIdle(_0x4e70e1){return _0x4e70e1===_0xdc82('0xe')||_0x4e70e1===_0xdc82('0xf')||_0x4e70e1===_0xdc82('0x10')||_0x4e70e1===_0xdc82('0x11')||_[_0xdc82('0x12')](_0x4e70e1);}function isAgentIdle(_0x3b88a6){if(_0x3b88a6[_0xdc82('0x13')]!=='idle'&&_0x3b88a6[_0xdc82('0x14')]){_0x3b88a6['voiceStatus']=_0xdc82('0x15');return![];}return _[_0xdc82('0xb')]([_0x3b88a6['chatStatus'],_0x3b88a6[_0xdc82('0x16')],_0x3b88a6['mailStatus'],_0x3b88a6[_0xdc82('0x17')],_0x3b88a6[_0xdc82('0x18')],_0x3b88a6[_0xdc82('0x13')],_0x3b88a6[_0xdc82('0x19')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xdc82('0x1a')](_0xdc82('0x1b'),{})[_0xdc82('0x1c')](function(_0x1efefc){if(_0x1efefc[_0xdc82('0x1d')]){throw new Error(_0xdc82('0x1e'));}var _0x5b28c7=_0x1efefc['result'];return routingClient[_0xdc82('0x1a')](_0xdc82('0x1b'),{})[_0xdc82('0x1c')](function(_0x10904b){if(_0x10904b[_0xdc82('0x1d')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x3a816e=_0x10904b[_0xdc82('0x1f')];return _[_0xdc82('0x20')]({},_0x5b28c7,_0x3a816e);});})[_0xdc82('0x21')](function(_0x20caee){throw _0x20caee;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x47321e){var _0x2f92b1=_0xdc82('0xf');if(isAgentPaused(_0x47321e))_0x2f92b1=_0xdc82('0x15');else if(isAgentPaused(_0x47321e,!![]))_0x2f92b1=_0xdc82('0x22');else if(isAgentIdle(_0x47321e))_0x2f92b1=_0xdc82('0xe');else _0x2f92b1=_0xdc82('0x23');return _0x2f92b1;}exports[_0xdc82('0x24')]=getAgentStatus;function getAgentIdsByQueues(_0x30c730,_0x28a86b){var _0x1e3794=_[_0xdc82('0x25')](_0x30c730)?_0x30c730:[_0x30c730];var _0x36ed1b=_[_0xdc82('0x26')](_0x28a86b)+_0xdc82('0x27');var _0x44f84b=_[_0xdc82('0x28')](_0x1e3794,function(_0x10ad5f){return db[_0x36ed1b][_0xdc82('0x29')]({'where':{'id':_0x10ad5f}})[_0xdc82('0x1c')](function(_0x18bc5d){if(!_0x18bc5d)return[];return _0x18bc5d['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xdc82('0x2a')](_0x44f84b)[_0xdc82('0x1c')](function(_0x144e5e){var _0x50d0cf=_(_0x144e5e)[_0xdc82('0x2b')]()['map']('id')[_0xdc82('0x2c')]()[_0xdc82('0x2d')]();return _0x50d0cf;});}exports[_0xdc82('0x2e')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x485033,_0x2bbdea,_0x44c0f5){try{if(_0x2bbdea[_0xdc82('0xd')]>0x0){_0x485033=_0x485033[_0xdc82('0xc')](function(_0x593b39){return _0x2bbdea[_0xdc82('0x2f')](_0x593b39['id']);});}var _0x16529f=_0x485033[_0xdc82('0xc')](function(_0x2ad589){var _0x407deb=_0xdc82('0x23');if(isAgentIdle(_0x2ad589)){_0x407deb=_0xdc82('0xe');}return _0x407deb===_0x44c0f5;});return _['map'](_0x16529f,'id');}catch(_0x4ed843){throw _0x4ed843;}}exports[_0xdc82('0x30')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5e18c4,_0x34bae5,_0xa760a9){return Promise[_0xdc82('0x31')]()[_0xdc82('0x1c')](function(){if(_0x34bae5[_0xdc82('0xd')]>0x0){_0x5e18c4=_0x5e18c4[_0xdc82('0xc')](function(_0x5a84dc){return _0x34bae5[_0xdc82('0x2f')](_0x5a84dc['id']);});}return _0x5e18c4;})[_0xdc82('0x1c')](function(){return db[_0xdc82('0x32')][_0xdc82('0x33')]({'attributes':['id',_0xdc82('0x34'),_0xdc82('0x35'),'chatPause',_0xdc82('0x6'),_0xdc82('0x7'),_0xdc82('0x8'),_0xdc82('0x9'),_0xdc82('0x14'),_0xdc82('0xa'),'pauseType'],'where':{'id':{'$in':_[_0xdc82('0x28')](_0x5e18c4,'id')}},'raw':!![]});})[_0xdc82('0x1c')](function(_0x520ff7){return _0x520ff7[_0xdc82('0x28')](function(_0x56042a){var _0x46a592=_[_0xdc82('0x36')](_0x5e18c4,['id',_0x56042a['id']]);var _0xe0bdb=filterAgentAttributes(_0x46a592);_['merge'](_0x56042a,_0xe0bdb);_0x56042a[_0xdc82('0x37')]=getAgentStatus(_0x56042a);return _0x56042a;});})[_0xdc82('0x1c')](function(_0x1699fc){var _0x300aa5=sortAgentsByStatus(_0x1699fc,_0xa760a9);return _[_0xdc82('0x28')](_0x300aa5,'id');})[_0xdc82('0x21')](function(_0x4fefa9){throw _0x4fefa9;});}exports[_0xdc82('0x38')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x359d1c){var _0x57abe9={'fields':[],'order':null};var _0x1aa309=_0x359d1c[_0xdc82('0x39')](',');_0x57abe9[_0xdc82('0x3a')]=_[_0xdc82('0xc')](_0x1aa309,function(_0x5dd4fa){if(!_0x5dd4fa[_0xdc82('0x2f')]('globalStatus')){return!![];}_0x57abe9[_0xdc82('0x3b')]=_[_0xdc82('0x3c')](_0x5dd4fa,'-')?_0xdc82('0x3d'):'ASC';return![];});return _0x57abe9;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x31e93e){if(_0x31e93e[_0xdc82('0x2f')]('fullname')&&!_0x31e93e['includes'](_0xdc82('0x3e'))){var _0x4b4e49=_0x31e93e[_0xdc82('0x3f')](0x0,_0x31e93e[_0xdc82('0x40')](_0xdc82('0x35')));_0x31e93e+=','+_0x4b4e49+_0xdc82('0x3e');}return _0x31e93e;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x180d37,_0x4b1ced){var _0x2569dd=_0x180d37[_0xdc82('0x41')](function(_0x5e5cf7,_0x2981e6){if(_0x5e5cf7[_0xdc82('0x37')]===_0x2981e6[_0xdc82('0x37')]){if(_0x5e5cf7[_0xdc82('0x37')]===_0xdc82('0x15')){if(_0x4b1ced===_0xdc82('0x3d')){return(_0x5e5cf7[_0xdc82('0x42')]||'')<(_0x2981e6[_0xdc82('0x42')]||'')||_0x5e5cf7['fullname'][_0xdc82('0x43')]()>_0x2981e6[_0xdc82('0x35')]['toLowerCase']()?0x1:-0x1;}else{return(_0x5e5cf7[_0xdc82('0x42')]||'')<(_0x2981e6[_0xdc82('0x42')]||'')||_0x5e5cf7[_0xdc82('0x35')][_0xdc82('0x43')]()>_0x2981e6[_0xdc82('0x35')][_0xdc82('0x43')]()?-0x1:0x1;}}else{if(_0x4b1ced==='DESC'){return _0x5e5cf7[_0xdc82('0x35')][_0xdc82('0x43')]()<_0x2981e6[_0xdc82('0x35')][_0xdc82('0x43')]()?0x1:-0x1;}else{return _0x5e5cf7[_0xdc82('0x35')]['toLowerCase']()<_0x2981e6[_0xdc82('0x35')][_0xdc82('0x43')]()?-0x1:0x1;}}}else{if(_0x4b1ced===_0xdc82('0x3d')){return _0x5e5cf7['globalStatus']<_0x2981e6[_0xdc82('0x37')]?0x1:-0x1;}else{return _0x5e5cf7[_0xdc82('0x37')]<_0x2981e6[_0xdc82('0x37')]?-0x1:0x1;}}});return _0x2569dd;}exports[_0xdc82('0x44')]=sortAgentsByStatus;function filterAgentAttributes(_0x59f5ae){var _0x2274b4=[_0xdc82('0x45'),'online',_0xdc82('0x46'),_0xdc82('0x47'),_0xdc82('0x42'),_0xdc82('0x47'),'internal',_0xdc82('0x48'),_0xdc82('0x5'),_0xdc82('0x8'),'mailPause','smsPause',_0xdc82('0xa'),_0xdc82('0x6'),'voicePause','chatCapacity',_0xdc82('0x49'),_0xdc82('0x4a'),_0xdc82('0x4b'),_0xdc82('0x4c'),_0xdc82('0x4d'),_0xdc82('0x4e'),_0xdc82('0x4f'),_0xdc82('0x50'),_0xdc82('0x51'),_0xdc82('0x52'),_0xdc82('0x53'),'chatStatus',_0xdc82('0x17'),_0xdc82('0x54'),_0xdc82('0x18'),_0xdc82('0x19'),_0xdc82('0x16'),'voiceStatus',_0xdc82('0x55'),_0xdc82('0x56'),_0xdc82('0x57'),'smsStatusTime','whatsappStatusTime',_0xdc82('0x58'),_0xdc82('0x59'),_0xdc82('0x5a'),_0xdc82('0x5b'),'screenrecording',_0xdc82('0x5c'),_0xdc82('0x5d'),_0xdc82('0x5e')];var _0x45fe4b=[_0xdc82('0x5'),_0xdc82('0x8'),_0xdc82('0x7'),_0xdc82('0x9'),'whatsappPause',_0xdc82('0x6'),_0xdc82('0x14'),_0xdc82('0x5f')];var _0xe84731=_(_0x59f5ae)[_0xdc82('0x60')](_0x45fe4b)[_0xdc82('0x61')](_0x2274b4)['value']();return _0xe84731;}exports[_0xdc82('0x62')]=filterAgentAttributes; \ No newline at end of file +var _0x52d0=['faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','idle','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','getRealtimeAgents','pause','*pause','busy','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','value','getAgentIdsByStatus','includes','User','findAll','name','pauseType','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','DESC','ASC','fullname','substring','internal','validateSortParameter','sort','toLowerCase','userpic','online','lastPauseAt','address','smsPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity'];(function(_0x13e3a2,_0x37c6a1){var _0xc7c1a1=function(_0x38f48f){while(--_0x38f48f){_0x13e3a2['push'](_0x13e3a2['shift']());}};_0xc7c1a1(++_0x37c6a1);}(_0x52d0,0x18f));var _0x052d=function(_0x498a91,_0x446e23){_0x498a91=_0x498a91-0x0;var _0x55bf99=_0x52d0[_0x498a91];return _0x55bf99;};'use strict';var _=require(_0x052d('0x0'));var jayson=require(_0x052d('0x1'));var db=require(_0x052d('0x2'))['db'];var amiClient=jayson[_0x052d('0x3')][_0x052d('0x4')]({'port':0x232a});var routingClient=jayson[_0x052d('0x3')][_0x052d('0x4')]({'port':0x232c});function isAgentPaused(_0x752540,_0xe65c96){var _0x1ee195=[_0x752540[_0x052d('0x5')],_0x752540[_0x052d('0x6')],_0x752540[_0x052d('0x7')],_0x752540[_0x052d('0x8')],_0x752540['smsPause'],_0x752540[_0x052d('0x9')],_0x752540[_0x052d('0xa')]];if(!_0xe65c96)return _[_0x052d('0xb')](_0x1ee195);var _0x49fb76=_[_0x052d('0xc')](_0x1ee195);return _0x49fb76[_0x052d('0xd')]>0x0&&_0x49fb76[_0x052d('0xd')]<_0x1ee195[_0x052d('0xd')]?!![]:![];}function isIdle(_0x42db64){return _0x42db64==='idle'||_0x42db64===_0x052d('0xe')||_0x42db64===_0x052d('0xf')||_0x42db64===_0x052d('0x10')||_[_0x052d('0x11')](_0x42db64);}function isAgentIdle(_0x58fb62){if(_0x58fb62[_0x052d('0x12')]!==_0x052d('0x13')&&_0x58fb62['voicePause']){_0x58fb62['voiceStatus']='pause';return![];}return _[_0x052d('0xb')]([_0x58fb62[_0x052d('0x14')],_0x58fb62[_0x052d('0x15')],_0x58fb62[_0x052d('0x16')],_0x58fb62[_0x052d('0x17')],_0x58fb62[_0x052d('0x18')],_0x58fb62['voiceStatus'],_0x58fb62[_0x052d('0x19')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x052d('0x1a')](_0x052d('0x1b'),{})[_0x052d('0x1c')](function(_0x108184){if(_0x108184[_0x052d('0x1d')]){throw new Error(_0x052d('0x1e'));}var _0x1bf28e=_0x108184[_0x052d('0x1f')];return routingClient[_0x052d('0x1a')](_0x052d('0x1b'),{})['then'](function(_0x596c11){if(_0x596c11[_0x052d('0x1d')]){throw new Error(_0x052d('0x20'));}var _0x133615=_0x596c11['result'];return _['merge']({},_0x1bf28e,_0x133615);});})[_0x052d('0x21')](function(_0x2c01f4){throw _0x2c01f4;});}exports[_0x052d('0x22')]=getRealtimeAgents;function getAgentStatus(_0x570a38){var _0x1b2e68=_0x052d('0xe');if(isAgentPaused(_0x570a38))_0x1b2e68=_0x052d('0x23');else if(isAgentPaused(_0x570a38,!![]))_0x1b2e68=_0x052d('0x24');else if(isAgentIdle(_0x570a38))_0x1b2e68=_0x052d('0x13');else _0x1b2e68=_0x052d('0x25');return _0x1b2e68;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x14e94b,_0x578d8b){var _0x44d7c6=_[_0x052d('0x26')](_0x14e94b)?_0x14e94b:[_0x14e94b];var _0x234675=_[_0x052d('0x27')](_0x578d8b)+_0x052d('0x28');var _0x591436=_[_0x052d('0x29')](_0x44d7c6,function(_0x2e16f){return db[_0x234675][_0x052d('0x2a')]({'where':{'id':_0x2e16f}})['then'](function(_0x2bc041){if(!_0x2bc041)return[];return _0x2bc041[_0x052d('0x2b')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x052d('0x2c')](_0x591436)['then'](function(_0x51658e){var _0x122649=_(_0x51658e)[_0x052d('0x2d')]()[_0x052d('0x29')]('id')['uniq']()[_0x052d('0x2e')]();return _0x122649;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x496a70,_0x5c0219,_0x43e868){try{if(_0x5c0219[_0x052d('0xd')]>0x0){_0x496a70=_0x496a70[_0x052d('0xc')](function(_0x34eca0){return _0x5c0219['includes'](_0x34eca0['id']);});}var _0x498438=_0x496a70['filter'](function(_0x988002){var _0x4660b4=_0x052d('0x25');if(isAgentIdle(_0x988002)){_0x4660b4=_0x052d('0x13');}return _0x4660b4===_0x43e868;});return _['map'](_0x498438,'id');}catch(_0x275e3f){throw _0x275e3f;}}exports[_0x052d('0x2f')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1a077c,_0x453ca7,_0x567dc1){return Promise['resolve']()[_0x052d('0x1c')](function(){if(_0x453ca7[_0x052d('0xd')]>0x0){_0x1a077c=_0x1a077c[_0x052d('0xc')](function(_0x1e3c62){return _0x453ca7[_0x052d('0x30')](_0x1e3c62['id']);});}return _0x1a077c;})[_0x052d('0x1c')](function(){return db[_0x052d('0x31')][_0x052d('0x32')]({'attributes':['id',_0x052d('0x33'),'fullname','chatPause',_0x052d('0x6'),_0x052d('0x7'),'openchannelPause','smsPause',_0x052d('0x9'),_0x052d('0xa'),_0x052d('0x34')],'where':{'id':{'$in':_['map'](_0x1a077c,'id')}},'raw':!![]});})[_0x052d('0x1c')](function(_0x39f40d){return _0x39f40d['map'](function(_0x351f4a){var _0x552ca3=_['find'](_0x1a077c,['id',_0x351f4a['id']]);var _0x5b1a0f=filterAgentAttributes(_0x552ca3);_['merge'](_0x351f4a,_0x5b1a0f);_0x351f4a['globalStatus']=getAgentStatus(_0x351f4a);return _0x351f4a;});})[_0x052d('0x1c')](function(_0x18d4b9){var _0x6d6bfc=sortAgentsByStatus(_0x18d4b9,_0x567dc1);return _['map'](_0x6d6bfc,'id');})[_0x052d('0x21')](function(_0x2cf26a){throw _0x2cf26a;});}exports[_0x052d('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xe519a7){var _0x3d42ac={'fields':[],'order':null};var _0x545947=_0xe519a7[_0x052d('0x36')](',');_0x3d42ac[_0x052d('0x37')]=_[_0x052d('0xc')](_0x545947,function(_0x1935c5){if(!_0x1935c5[_0x052d('0x30')](_0x052d('0x38'))){return!![];}_0x3d42ac[_0x052d('0x39')]=_[_0x052d('0x3a')](_0x1935c5,'-')?_0x052d('0x3b'):_0x052d('0x3c');return![];});return _0x3d42ac;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x364d79){if(_0x364d79[_0x052d('0x30')](_0x052d('0x3d'))&&!_0x364d79[_0x052d('0x30')]('internal')){var _0xc9e59e=_0x364d79[_0x052d('0x3e')](0x0,_0x364d79['indexOf'](_0x052d('0x3d')));_0x364d79+=','+_0xc9e59e+_0x052d('0x3f');}return _0x364d79;}exports[_0x052d('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x57c2bb,_0x3504c4){var _0x297a7f=_0x57c2bb[_0x052d('0x41')](function(_0xb6ddfb,_0xeb2534){if(_0xb6ddfb['globalStatus']===_0xeb2534[_0x052d('0x38')]){if(_0xb6ddfb[_0x052d('0x38')]===_0x052d('0x23')){if(_0x3504c4==='DESC'){return(_0xb6ddfb['pauseType']||'')<(_0xeb2534[_0x052d('0x34')]||'')||_0xb6ddfb[_0x052d('0x3d')]['toLowerCase']()>_0xeb2534[_0x052d('0x3d')][_0x052d('0x42')]()?0x1:-0x1;}else{return(_0xb6ddfb['pauseType']||'')<(_0xeb2534[_0x052d('0x34')]||'')||_0xb6ddfb['fullname'][_0x052d('0x42')]()>_0xeb2534[_0x052d('0x3d')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x3504c4===_0x052d('0x3b')){return _0xb6ddfb[_0x052d('0x3d')]['toLowerCase']()<_0xeb2534['fullname'][_0x052d('0x42')]()?0x1:-0x1;}else{return _0xb6ddfb['fullname'][_0x052d('0x42')]()<_0xeb2534['fullname'][_0x052d('0x42')]()?-0x1:0x1;}}}else{if(_0x3504c4===_0x052d('0x3b')){return _0xb6ddfb[_0x052d('0x38')]<_0xeb2534['globalStatus']?0x1:-0x1;}else{return _0xb6ddfb[_0x052d('0x38')]<_0xeb2534['globalStatus']?-0x1:0x1;}}});return _0x297a7f;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0xb27704){var _0x1fb5ec=[_0x052d('0x43'),_0x052d('0x44'),'lastLoginAt',_0x052d('0x45'),_0x052d('0x34'),_0x052d('0x45'),_0x052d('0x3f'),_0x052d('0x46'),'chatPause',_0x052d('0x8'),'mailPause',_0x052d('0x47'),_0x052d('0xa'),_0x052d('0x6'),_0x052d('0x9'),'chatCapacity',_0x052d('0x48'),_0x052d('0x49'),_0x052d('0x4a'),_0x052d('0x4b'),_0x052d('0x4c'),_0x052d('0x4d'),_0x052d('0x4e'),_0x052d('0x4f'),_0x052d('0x50'),_0x052d('0x51'),_0x052d('0x52'),_0x052d('0x14'),_0x052d('0x17'),_0x052d('0x16'),_0x052d('0x18'),'whatsappStatus',_0x052d('0x15'),_0x052d('0x12'),_0x052d('0x53'),_0x052d('0x54'),'mailStatusTime',_0x052d('0x55'),_0x052d('0x56'),_0x052d('0x57'),'voiceStatusTime','queue',_0x052d('0x58'),_0x052d('0x59'),_0x052d('0x5a'),_0x052d('0x5b'),_0x052d('0x5c')];var _0x333ef1=[_0x052d('0x5'),_0x052d('0x8'),_0x052d('0x7'),_0x052d('0x47'),_0x052d('0xa'),'faxPause',_0x052d('0x9'),_0x052d('0x44')];var _0x4d0129=_(_0xb27704)['omit'](_0x333ef1)[_0x052d('0x5d')](_0x1fb5ec)['value']();return _0x4d0129;}exports[_0x052d('0x5e')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index e719ad8..6ba34b0 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 _0x538d=['Trunk','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','inbound','concat','outbound','map','get','loggedIn','talking','find','merge','pick','jayson/promise','client','http','available','paused','waiting','busy','inUse','loggedInDb','onHold','ringing','pTalking','originated','message','statusMessage','dialMethod'];(function(_0x2d06bd,_0x1d90dc){var _0x4d466c=function(_0x4f9ea4){while(--_0x4f9ea4){_0x2d06bd['push'](_0x2d06bd['shift']());}};_0x4d466c(++_0x1d90dc);}(_0x538d,0x104));var _0xd538=function(_0x35227a,_0x2667f5){_0x35227a=_0x35227a-0x0;var _0x2a2812=_0x538d[_0x35227a];return _0x2a2812;};'use strict';var _=require('lodash');var jayson=require(_0xd538('0x0'));var util=require('util');var amiClient=jayson[_0xd538('0x1')][_0xd538('0x2')]({'port':0x232a});var routingClient=jayson[_0xd538('0x1')][_0xd538('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xd538('0x3'),'loggedIn',_0xd538('0x4'),_0xd538('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0xd538('0x6'),_0xd538('0x7'),'invalid',_0xd538('0x8'),'notInUse',_0xd538('0x9'),_0xd538('0xa'),'ringInUse','talking','unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xd538('0xb'),_0xd538('0xc'),_0xd538('0xd'),_0xd538('0xe'),'dialActive',_0xd538('0xf'),_0xd538('0x10'),'startPredictive','startProgressive',_0xd538('0x11'),'erlangCallToSecond',_0xd538('0x12'),_0xd538('0x13'),'dialPredictiveInterval',_0xd538('0x14'),_0xd538('0x15'),'predictiveIntervalAvailable',_0xd538('0x16'),_0xd538('0x17'),'predictiveIntervalDroppedCallsTimeout',_0xd538('0x18'),_0xd538('0x19'),_0xd538('0x1a')];function getRealtimeQueues(_0x33511e,_0x4d5c5f){var _0x47f59c=_0x4d5c5f===_0xd538('0x1b')?amiClient:routingClient;return _0x47f59c[_0xd538('0x1c')](_[_0xd538('0x1d')](_0x4d5c5f)+_0xd538('0x1e'),_0x33511e)[_0xd538('0x1f')](function(_0x291fa1){if(_0x291fa1[_0xd538('0x20')])throw new Error(util[_0xd538('0x21')](_0xd538('0x22'),_0x4d5c5f));return _0x291fa1[_0xd538('0x23')];})['catch'](function(_0x1639e7){throw _0x1639e7;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x440c9a,_0x1230f0,_0x1dbe8c,_0x3f84c7){var _0x578d99=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1dbe8c==='voice'){if(_0x3f84c7===_0xd538('0x24')){_0x578d99=_0x578d99[_0xd538('0x25')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3f84c7===_0xd538('0x26')){_0x578d99=_0x578d99['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x440c9a[_0xd538('0x27')](function(_0x67039b){var _0x2e82ee=_0x67039b[_0xd538('0x28')]({'plain':!![]});_0x2e82ee[_0xd538('0x4')]=0x0;_0x2e82ee[_0xd538('0x8')]=0x0;_0x2e82ee[_0xd538('0x29')]=0x0;_0x2e82ee[_0xd538('0x3')]=0x0;_0x2e82ee[_0xd538('0x5')]=0x0;if(_0x1dbe8c===_0xd538('0x1b')){_0x2e82ee[_0xd538('0x2a')]=0x0;_0x2e82ee[_0xd538('0x6')]=0x0;if(_0x3f84c7===_0xd538('0x26')){_0x2e82ee[_0xd538('0xb')]=0x0;_0x2e82ee[_0xd538('0xc')]=0x0;}}var _0xb1230a=_[_0xd538('0x2b')](_0x1230f0,['id',_0x2e82ee['id']]);if(_0xb1230a){_[_0xd538('0x2c')](_0x2e82ee,_[_0xd538('0x2d')](_0xb1230a,_0x578d99));}return _0x2e82ee;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x4627=['erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','Queues','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','talking','originated','merge','pick','initializeQueues','lodash','util','client','http','available','loggedIn','paused','waiting','busy','inUse','loggedInDb','notInUse','onHold','unavailable','unknown','message','statusMessage','dialActive','dialMethod','Trunk','erlangCalls'];(function(_0x20d92c,_0x5c7a9b){var _0x30c339=function(_0x2e8043){while(--_0x2e8043){_0x20d92c['push'](_0x20d92c['shift']());}};_0x30c339(++_0x5c7a9b);}(_0x4627,0x7b));var _0x7462=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x4627[_0x3e2fcf];return _0x497db7;};'use strict';var _=require(_0x7462('0x0'));var jayson=require('jayson/promise');var util=require(_0x7462('0x1'));var amiClient=jayson[_0x7462('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x7462('0x2')][_0x7462('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x7462('0x4'),_0x7462('0x5'),_0x7462('0x6'),_0x7462('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x7462('0x8'),_0x7462('0x9'),'invalid',_0x7462('0xa'),_0x7462('0xb'),_0x7462('0xc'),'ringing','ringInUse','talking',_0x7462('0xd'),_0x7462('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated',_0x7462('0xf'),_0x7462('0x10'),_0x7462('0x11'),_0x7462('0x12'),_0x7462('0x13'),'startPredictive','startProgressive',_0x7462('0x14'),_0x7462('0x15'),_0x7462('0x16'),'erlangBusyFactor',_0x7462('0x17'),_0x7462('0x18'),'dialPredictiveIntervalMinThreshold',_0x7462('0x19'),_0x7462('0x1a'),'predictiveIntervalAnsweredCalls',_0x7462('0x1b'),_0x7462('0x1c'),_0x7462('0x1d'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x2c581f,_0x18c184){var _0xb943e=_0x18c184===_0x7462('0x1e')?amiClient:routingClient;return _0xb943e[_0x7462('0x1f')](_['startCase'](_0x18c184)+_0x7462('0x20'),_0x2c581f)['then'](function(_0x39e5f1){if(_0x39e5f1[_0x7462('0x21')])throw new Error(util['format'](_0x7462('0x22'),_0x18c184));return _0x39e5f1[_0x7462('0x23')];})[_0x7462('0x24')](function(_0x4eb948){throw _0x4eb948;});}exports[_0x7462('0x25')]=getRealtimeQueues;function initializeQueues(_0x127093,_0x17cee3,_0x3aa818,_0x46779a){var _0x168148=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3aa818==='voice'){if(_0x46779a===_0x7462('0x26')){_0x168148=_0x168148[_0x7462('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x46779a===_0x7462('0x28')){_0x168148=_0x168148[_0x7462('0x27')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x127093[_0x7462('0x29')](function(_0x3a1ac3){var _0x26d40a=_0x3a1ac3[_0x7462('0x2a')]({'plain':!![]});_0x26d40a[_0x7462('0x6')]=0x0;_0x26d40a['loggedInDb']=0x0;_0x26d40a[_0x7462('0x5')]=0x0;_0x26d40a[_0x7462('0x4')]=0x0;_0x26d40a[_0x7462('0x7')]=0x0;if(_0x3aa818===_0x7462('0x1e')){_0x26d40a[_0x7462('0x2b')]=0x0;_0x26d40a[_0x7462('0x8')]=0x0;if(_0x46779a===_0x7462('0x28')){_0x26d40a['pTalking']=0x0;_0x26d40a[_0x7462('0x2c')]=0x0;}}var _0x4c0064=_['find'](_0x17cee3,['id',_0x26d40a['id']]);if(_0x4c0064){_[_0x7462('0x2d')](_0x26d40a,_[_0x7462('0x2e')](_0x4c0064,_0x168148));}return _0x26d40a;});}exports[_0x7462('0x2f')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 4691454..4c14e87 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x14405c,_0x12b9b9){var _0x5d54ba=function(_0x5eaba7){while(--_0x5eaba7){_0x14405c['push'](_0x14405c['shift']());}};_0x5d54ba(++_0x12b9b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index f3f7b23..1f7794d 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 _0xf886=['join','createHash','md5','update','hex','getUuid','licenseToken','test','win32','replace','hostname','macAddress','ipAddress','digest','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','IPv4','internal','concat','head','mac','address','127.0.0.1','map'];(function(_0x511b83,_0x2e3f20){var _0x35ed02=function(_0x1a2597){while(--_0x1a2597){_0x511b83['push'](_0x511b83['shift']());}};_0x35ed02(++_0x2e3f20);}(_0xf886,0xcf));var _0x6f88=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0xf886[_0x2a0738];return _0x159679;};'use strict';var _=require(_0x6f88('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x6f88('0x1'));var exec=require(_0x6f88('0x2'))[_0x6f88('0x3')];var config=require(_0x6f88('0x4'));function getInterfaces(){var _0x54f988=[];var _0x421ca8=os[_0x6f88('0x5')]();var _0x29e73e=_[_0x6f88('0x6')](_[_0x6f88('0x7')](_0x421ca8));for(var _0x42c56c=0x0;_0x42c56c<_0x29e73e[_0x6f88('0x8')];_0x42c56c++){var _0x2a1791=_0x421ca8[_0x29e73e[_0x42c56c]]['filter'](function(_0x260281){return _0x260281['family']===_0x6f88('0x9')&&_0x260281[_0x6f88('0xa')]===![];});_0x54f988=_0x54f988[_0x6f88('0xb')](_0x2a1791);}return _0x54f988;}function getFirstInterface(){var _0x6668b3=_[_0x6f88('0xc')](getInterfaces());return{'macAddress':_0x6668b3&&_0x6668b3[_0x6f88('0xd')]?_0x6668b3[_0x6f88('0xd')]:'00:00:00:00:00:00','ipAddress':_0x6668b3&&_0x6668b3[_0x6f88('0xe')]?_0x6668b3['address']:_0x6f88('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x1e6276=_[_0x6f88('0x6')](os['cpus']()[_0x6f88('0x10')](function(_0x36f05c){return _0x36f05c['model'];}))[_0x6f88('0x11')](':');return crypto[_0x6f88('0x12')](_0x6f88('0x13'))[_0x6f88('0x14')](_0x1e6276)['digest'](_0x6f88('0x15'));}exports[_0x6f88('0x16')]=function(){var _0x4b6edc=os['platform']();var _0x45dbdc=/[0-9a-f-]{36}/;if(config[_0x6f88('0x17')]&&_0x45dbdc[_0x6f88('0x18')](config[_0x6f88('0x17')])){return config[_0x6f88('0x17')];}else if(_0x4b6edc===_0x6f88('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0x6f88('0x1a')]('\x0d\x0a','');}else{var _0x274f1f=getFirstInterface();var _0x44279b=getCPUhash();var _0x5d624b=_0x44279b+'|'+os[_0x6f88('0x1b')]()+'|'+_0x274f1f[_0x6f88('0x1c')]+'|'+_0x274f1f[_0x6f88('0x1d')];var _0x1a7cb1=crypto[_0x6f88('0x12')](_0x6f88('0x13'))[_0x6f88('0x14')](_0x5d624b)[_0x6f88('0x1e')](_0x6f88('0x15'));return _0x1a7cb1[_0x6f88('0x1f')](0x0,0x8)+'-'+_0x1a7cb1[_0x6f88('0x1f')](0x8,0xc)+'-'+_0x1a7cb1[_0x6f88('0x1f')](0xc,0x10)+'-'+_0x1a7cb1[_0x6f88('0x1f')](0x10,0x14)+'-'+_0x1a7cb1[_0x6f88('0x1f')](0x14);}}; \ No newline at end of file +var _0x9a8e=['keys','length','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','join','createHash','md5','update','digest','hex','getUuid','test','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','networkInterfaces','orderBy'];(function(_0x278de8,_0x214744){var _0x34bb25=function(_0x4f8779){while(--_0x4f8779){_0x278de8['push'](_0x278de8['shift']());}};_0x34bb25(++_0x214744);}(_0x9a8e,0x132));var _0xe9a8=function(_0x353299,_0xba0d60){_0x353299=_0x353299-0x0;var _0x4bc0aa=_0x9a8e[_0x353299];return _0x4bc0aa;};'use strict';var _=require(_0xe9a8('0x0'));var os=require('os');var crypto=require(_0xe9a8('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')['execSync'];var config=require('../environment');function getInterfaces(){var _0x34182b=[];var _0x4fe983=os[_0xe9a8('0x2')]();var _0x51ef53=_[_0xe9a8('0x3')](_[_0xe9a8('0x4')](_0x4fe983));for(var _0x374ee6=0x0;_0x374ee6<_0x51ef53[_0xe9a8('0x5')];_0x374ee6++){var _0x3ec464=_0x4fe983[_0x51ef53[_0x374ee6]]['filter'](function(_0x413586){return _0x413586[_0xe9a8('0x6')]===_0xe9a8('0x7')&&_0x413586[_0xe9a8('0x8')]===![];});_0x34182b=_0x34182b[_0xe9a8('0x9')](_0x3ec464);}return _0x34182b;}function getFirstInterface(){var _0x27d3d5=_[_0xe9a8('0xa')](getInterfaces());return{'macAddress':_0x27d3d5&&_0x27d3d5[_0xe9a8('0xb')]?_0x27d3d5['mac']:_0xe9a8('0xc'),'ipAddress':_0x27d3d5&&_0x27d3d5[_0xe9a8('0xd')]?_0x27d3d5[_0xe9a8('0xd')]:_0xe9a8('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x58926d=_[_0xe9a8('0x3')](os['cpus']()['map'](function(_0x51daa4){return _0x51daa4['model'];}))[_0xe9a8('0xf')](':');return crypto[_0xe9a8('0x10')](_0xe9a8('0x11'))[_0xe9a8('0x12')](_0x58926d)[_0xe9a8('0x13')](_0xe9a8('0x14'));}exports[_0xe9a8('0x15')]=function(){var _0x34cc87=os['platform']();var _0x3df2a8=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x3df2a8[_0xe9a8('0x16')](config[_0xe9a8('0x17')])){return config[_0xe9a8('0x17')];}else if(_0x34cc87==='win32'){return exec(_0xe9a8('0x18'),{'encoding':_0xe9a8('0x19')})[_0xe9a8('0x1a')]('\x0d\x0a','');}else{var _0x14b697=getFirstInterface();var _0x1ab8f0=getCPUhash();var _0x530201=_0x1ab8f0+'|'+os[_0xe9a8('0x1b')]()+'|'+_0x14b697[_0xe9a8('0x1c')]+'|'+_0x14b697[_0xe9a8('0x1d')];var _0x201fa3=crypto[_0xe9a8('0x10')]('md5')[_0xe9a8('0x12')](_0x530201)[_0xe9a8('0x13')]('hex');return _0x201fa3[_0xe9a8('0x1e')](0x0,0x8)+'-'+_0x201fa3[_0xe9a8('0x1e')](0x8,0xc)+'-'+_0x201fa3['substring'](0xc,0x10)+'-'+_0x201fa3[_0xe9a8('0x1e')](0x10,0x14)+'-'+_0x201fa3[_0xe9a8('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 0dd3ea8..2408bb6 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 _0x5168=['./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','diff','DEMO\x20START\x20AT\x20%s','catch','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','util','moment','request-promise','bluebird','../../mysqldb'];(function(_0x42c2f7,_0x16bbdd){var _0x55c3ae=function(_0x24502f){while(--_0x24502f){_0x42c2f7['push'](_0x42c2f7['shift']());}};_0x55c3ae(++_0x16bbdd);}(_0x5168,0xbe));var _0x8516=function(_0x183dee,_0x38ad79){_0x183dee=_0x183dee-0x0;var _0x4f60d0=_0x5168[_0x183dee];return _0x4f60d0;};'use strict';var util=require(_0x8516('0x0'));var moment=require(_0x8516('0x1'));var rp=require(_0x8516('0x2'));var BPromise=require(_0x8516('0x3'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0x8516('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x8516('0x5'));var logger=require(_0x8516('0x6'))(_0x8516('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3ea564){return new BPromise(function(_0x25441a,_0x16a275){var _0x4a0a2c=util[_0x8516('0x8')](_0x8516('0x9'),HOST,_0x3ea564,module[_0x8516('0xa')][_0x8516('0xb')]);if(oldToken){_0x4a0a2c=util[_0x8516('0x8')](_0x8516('0xc'),HOST,_0x3ea564,module[_0x8516('0xa')]['version'],oldToken);}var _0x58bd9b={'uri':_0x4a0a2c,'method':_0x8516('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x58bd9b)[_0x8516('0xe')](function(_0x3c00f2){_0x25441a(_0x3c00f2);})['catch'](function(_0x1b82c0){_0x16a275(_0x1b82c0);});});}function manageLicense(_0xef8fbd,_0x495677){var _0x364425=_0x495677[_0x8516('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x364425['data1']!==_0xef8fbd&&!_0x364425['data2']){oldToken=_0x364425['data1'];}httpRequest(_0xef8fbd)[_0x8516('0xe')](function(_0x4300d8){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4300d8[_0x8516('0x10')]){isOldTokenSent=![];if(!_0x364425['license']&&_0x364425[_0x8516('0x7')]!=_0x4300d8[_0x8516('0x7')]||_0x364425[_0x8516('0x7')]&&_0x364425[_0x8516('0x11')]){logger[_0x8516('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x364425['license']&&!_0x364425[_0x8516('0x11')]&&_0x364425[_0x8516('0x7')]!=_0x4300d8['license']){logger[_0x8516('0x12')](_0x8516('0x13'));}if(_0x364425[_0x8516('0x7')]&&!_0x364425[_0x8516('0x11')]&&_0x364425[_0x8516('0x7')]==_0x4300d8['license']){return _0x495677;}return _0x495677[_0x8516('0x14')]({'data1':_0xef8fbd,'data2':null,'license':_0x4300d8[_0x8516('0x7')]});}else{if(_0x4300d8['license']||_0x364425[_0x8516('0x7')]){if(!_0x364425[_0x8516('0x11')]){if(_0x364425[_0x8516('0x15')]==_0xef8fbd){GRAY_PERIOD_REASON=_0x8516('0x16');logger[_0x8516('0x12')](_0x8516('0x17'));}else{GRAY_PERIOD_REASON=_0x8516('0x18');logger[_0x8516('0x12')](_0x8516('0x19'),_0x364425[_0x8516('0x15')],_0xef8fbd);}logger[_0x8516('0x12')](_0x8516('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x8516('0x8')](_0x8516('0x1b')));return _0x495677[_0x8516('0x14')]({'data2':encryptor['encryptString'](moment()[_0x8516('0x8')](_0x8516('0x1b')))});}else{if(moment()[_0x8516('0x1c')](encryptor['decryptString'](_0x364425[_0x8516('0x11')]),'days')>DAYS){logger[_0x8516('0x12')](_0x8516('0x1d'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x495677[_0x8516('0x14')]({'data1':_0xef8fbd,'data2':null,'license':null});}}}else{if(_0x364425['data1']!=_0xef8fbd){logger[_0x8516('0x12')](_0x8516('0x19'),_0x364425[_0x8516('0x15')],_0xef8fbd);return _0x495677['update']({'data1':_0xef8fbd,'data2':null,'license':null});}}}return _0x495677;})[_0x8516('0xe')](function(_0x21b145){_0x495677=_0x21b145;})[_0x8516('0x1e')](function(_0x436136){logger[_0x8516('0x1f')](_0x436136['message']);})[_0x8516('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x8516('0x21')](),_0x495677);},TIME);});}function defaultLicense(){var _0x61c1a0=hardware[_0x8516('0x21')]();if(_0x61c1a0){return db[_0x8516('0x22')][_0x8516('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x61c1a0}})[_0x8516('0x24')](function(_0x476991,_0x4851f0){logger[_0x8516('0x12')](_0x8516('0x25'),_0x61c1a0);manageLicense(_0x61c1a0,_0x476991);})['catch'](function(_0x4ba57d){logger[_0x8516('0x1f')](_0x4ba57d[_0x8516('0x26')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x8f6c=['findOrCreate','message','default','util','moment','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','data1','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid'];(function(_0x5f5399,_0x4928ca){var _0x5e5647=function(_0x55f02e){while(--_0x55f02e){_0x5f5399['push'](_0x5f5399['shift']());}};_0x5e5647(++_0x4928ca);}(_0x8f6c,0xc1));var _0xc8f6=function(_0x57ea74,_0x7ae681){_0x57ea74=_0x57ea74-0x0;var _0x12fc92=_0x8f6c[_0x57ea74];return _0x12fc92;};'use strict';var util=require(_0xc8f6('0x0'));var moment=require(_0xc8f6('0x1'));var rp=require(_0xc8f6('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xc8f6('0x3'))(module,_0xc8f6('0x4'));var db=require(_0xc8f6('0x5'))['db'];var encryptor=require(_0xc8f6('0x6'));var hardware=require(_0xc8f6('0x7'));var logger=require(_0xc8f6('0x8'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x47a03e){return new BPromise(function(_0xbf5130,_0x89a9dc){var _0x314518=util[_0xc8f6('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x47a03e,module[_0xc8f6('0xa')]['version']);if(oldToken){_0x314518=util[_0xc8f6('0x9')](_0xc8f6('0xb'),HOST,_0x47a03e,module['exports'][_0xc8f6('0x4')],oldToken);}var _0x3d9c3a={'uri':_0x314518,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x3d9c3a)[_0xc8f6('0xc')](function(_0x2c5ccb){_0xbf5130(_0x2c5ccb);})[_0xc8f6('0xd')](function(_0x6449d7){_0x89a9dc(_0x6449d7);});});}function manageLicense(_0x13a9b6,_0xc24375){var _0x3977b7=_0xc24375['get']({'plain':!![]});if(!isOldTokenSent&&_0x3977b7[_0xc8f6('0xe')]!==_0x13a9b6&&!_0x3977b7['data2']){oldToken=_0x3977b7[_0xc8f6('0xe')];}httpRequest(_0x13a9b6)[_0xc8f6('0xc')](function(_0x45fcf3){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x45fcf3[_0xc8f6('0xf')]){isOldTokenSent=![];if(!_0x3977b7[_0xc8f6('0x10')]&&_0x3977b7[_0xc8f6('0x10')]!=_0x45fcf3[_0xc8f6('0x10')]||_0x3977b7['license']&&_0x3977b7[_0xc8f6('0x11')]){logger[_0xc8f6('0x12')](_0xc8f6('0x13'));}if(_0x3977b7[_0xc8f6('0x10')]&&!_0x3977b7[_0xc8f6('0x11')]&&_0x3977b7[_0xc8f6('0x10')]!=_0x45fcf3[_0xc8f6('0x10')]){logger[_0xc8f6('0x12')](_0xc8f6('0x14'));}if(_0x3977b7[_0xc8f6('0x10')]&&!_0x3977b7[_0xc8f6('0x11')]&&_0x3977b7[_0xc8f6('0x10')]==_0x45fcf3[_0xc8f6('0x10')]){return _0xc24375;}return _0xc24375[_0xc8f6('0x15')]({'data1':_0x13a9b6,'data2':null,'license':_0x45fcf3['license']});}else{if(_0x45fcf3[_0xc8f6('0x10')]||_0x3977b7['license']){if(!_0x3977b7[_0xc8f6('0x11')]){if(_0x3977b7[_0xc8f6('0xe')]==_0x13a9b6){GRAY_PERIOD_REASON='Disabled';logger[_0xc8f6('0x12')](_0xc8f6('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xc8f6('0x12')](_0xc8f6('0x17'),_0x3977b7[_0xc8f6('0xe')],_0x13a9b6);}logger['info'](_0xc8f6('0x18'),GRAY_PERIOD_REASON[_0xc8f6('0x19')](),moment()[_0xc8f6('0x9')](_0xc8f6('0x1a')));return _0xc24375[_0xc8f6('0x15')]({'data2':encryptor[_0xc8f6('0x1b')](moment()[_0xc8f6('0x9')](_0xc8f6('0x1a')))});}else{if(moment()[_0xc8f6('0x1c')](encryptor[_0xc8f6('0x1d')](_0x3977b7[_0xc8f6('0x11')]),_0xc8f6('0x1e'))>DAYS){logger[_0xc8f6('0x12')](_0xc8f6('0x1f'),moment()[_0xc8f6('0x9')](_0xc8f6('0x1a')));isOldTokenSent=![];return _0xc24375['update']({'data1':_0x13a9b6,'data2':null,'license':null});}}}else{if(_0x3977b7[_0xc8f6('0xe')]!=_0x13a9b6){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3977b7['data1'],_0x13a9b6);return _0xc24375[_0xc8f6('0x15')]({'data1':_0x13a9b6,'data2':null,'license':null});}}}return _0xc24375;})[_0xc8f6('0xc')](function(_0x3e87c6){_0xc24375=_0x3e87c6;})['catch'](function(_0x146a20){logger[_0xc8f6('0x20')](_0x146a20['message']);})[_0xc8f6('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xc8f6('0x22')](),_0xc24375);},TIME);});}function defaultLicense(){var _0x1e52ac=hardware[_0xc8f6('0x22')]();if(_0x1e52ac){return db['License'][_0xc8f6('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x1e52ac}})['spread'](function(_0x2088e5,_0x1cc0fd){logger[_0xc8f6('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x1e52ac);manageLicense(_0x1e52ac,_0x2088e5);})[_0xc8f6('0xd')](function(_0x180fbf){logger[_0xc8f6('0x20')](_0x180fbf[_0xc8f6('0x24')]);});}}exports[_0xc8f6('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 9c976e2..253411c 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 _0x251f=['catch','data1','license','isEmpty','data2','split','decryptString','format','%s:%s:%s','demo','uuid','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','message','User','role','sequelize','col','count','admin','telephone','users','telephones','forEach','user','countBy','License\x20limit\x20reached\x20for\x20users','exports','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','defaults','then'];(function(_0x3d927e,_0x225448){var _0x1285a9=function(_0x2b3e31){while(--_0x2b3e31){_0x3d927e['push'](_0x3d927e['shift']());}};_0x1285a9(++_0x225448);}(_0x251f,0x156));var _0xf251=function(_0x3eb450,_0x592b0a){_0x3eb450=_0x3eb450-0x0;var _0x2c4cfd=_0x251f[_0x3eb450];return _0x2c4cfd;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xf251('0x0'));var BPromise=require(_0xf251('0x1'));var hardware=require(_0xf251('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0xf251('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf251('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf251('0x5'),'machineUuid':hardware[_0xf251('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf251('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf251('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5c9be2){return new BPromise(function(_0x402c69,_0x28eebf){return db['License']['find'](_[_0xf251('0x8')](_0x5c9be2,{'raw':!![],'where':{'id':0x1}}))[_0xf251('0x9')](function(_0x117533){return checkLicense(_0x117533,null);})[_0xf251('0x9')](function(_0xcb5fcb){_0x402c69(_0xcb5fcb);return;})[_0xf251('0xa')](function(_0x27b576){_0x28eebf(_0x27b576);});});}function checkLicense(_0x3edc6f,_0x58bbe6){if(!_0x3edc6f){demoLicense['uuid']=_0x3edc6f[_0xf251('0xb')];return demoLicense;}try{var _0x2a74a4=_0x58bbe6||_0x3edc6f[_0xf251('0xc')];if(_[_0xf251('0xd')](_0x2a74a4)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x416eb2=_0x3edc6f[_0xf251('0xb')];var _0x426e51=_0x3edc6f[_0xf251('0xe')];var _0x290316=_0x416eb2[_0xf251('0xf')]('-')[0x4];var _0x50209c=_0x416eb2[_0xf251('0xf')]('-')[0x0];var _0x198f33=encryptor[_0xf251('0x10')](_0x2a74a4,util[_0xf251('0x11')](_0xf251('0x12'),_0x290316,_0x416eb2,_0x50209c));var _0xe46a56=JSON['parse'](_0x198f33);_0xe46a56[_0xf251('0x13')]=![];_0xe46a56[_0xf251('0x14')]=_0x416eb2;_0xe46a56['machineUuid']=hardware[_0xf251('0x6')]();if(_0x426e51){var _0x43908b=encryptor[_0xf251('0x10')](_0x426e51);_0xe46a56[_0xf251('0x15')]=_0x43908b;_0xe46a56[_0xf251('0x16')]=moment(_0x43908b)[_0xf251('0x17')](0x7,_0xf251('0x18'))[_0xf251('0x11')]();_0xe46a56[_0xf251('0x19')]=_0xe46a56['uuid']!=_0xe46a56[_0xf251('0x1a')]?_0xf251('0x1b'):_0xf251('0x1c');}return _0xe46a56;}catch(_0x24032b){breakingLicense[_0xf251('0x14')]=_0x3edc6f[_0xf251('0xb')];breakingLicense['message']=_0x24032b[_0xf251('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x47fa11,_0x2a553a){getLicense()[_0xf251('0x9')](function(_0x47f020){return db[_0xf251('0x1e')]['findAll']({'attributes':[_0xf251('0x1f'),[db[_0xf251('0x20')]['fn']('COUNT',db[_0xf251('0x20')][_0xf251('0x21')]('role')),_0xf251('0x22')]],'group':'role','where':{'role':{'$or':[_0xf251('0x23'),'user',_0xf251('0x24')]}},'raw':!![]})['then'](function(_0x368f65){var _0x1495e9={'user':_0x47f020[_0xf251('0x25')]||0x0,'telephone':_0x47f020[_0xf251('0x26')]||0x0};_0x368f65[_0xf251('0x27')](function(_0x4b0794){var _0x58a51c=_0x4b0794[_0xf251('0x1f')]==='admin'?_0xf251('0x28'):_0x4b0794['role'];_0x1495e9[_0x58a51c]-=_0x4b0794['count'];if(_0x1495e9[_0x58a51c]<0x0)_0x1495e9[_0x58a51c]=0x0;});_0x47fa11(_0x1495e9);return;});})[_0xf251('0xa')](function(_0xba38af){_0x2a553a(_0xba38af);});});}function checkUserLimits(_0x36254e){return new BPromise(function(_0x1ba315,_0xfda966){getLimits()['then'](function(_0x5aea90){var _0x3280f8=_['pick'](_[_0xf251('0x29')](_0x36254e,_0xf251('0x1f')),[_0xf251('0x23'),_0xf251('0x28'),_0xf251('0x24')]);var _0x10363c=(_0x3280f8['admin']||0x0)+(_0x3280f8[_0xf251('0x28')]||0x0);var _0x52f9a0=_0x3280f8[_0xf251('0x24')]||0x0;if(_0x10363c>_0x5aea90[_0xf251('0x28')])return _0xfda966(_0xf251('0x2a'));if(_0x52f9a0>_0x5aea90[_0xf251('0x24')])return _0xfda966('License\x20limit\x20reached\x20for\x20telephones');return _0x1ba315();})[_0xf251('0xa')](function(_0xddf1ae){_0xfda966(_0xddf1ae);});});}module[_0xf251('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xe1d4=['data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','demo','machineUuid','deadline','add','days','changed','disabled','message','User','findAll','sequelize','col','count','role','admin','user','telephone','telephones','forEach','pick','countBy','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','License','find','then','catch','uuid'];(function(_0x43dc7e,_0x49a390){var _0x21e12d=function(_0x15cc1a){while(--_0x15cc1a){_0x43dc7e['push'](_0x43dc7e['shift']());}};_0x21e12d(++_0x49a390);}(_0xe1d4,0x1b4));var _0x4e1d=function(_0x15ea0e,_0x217294){_0x15ea0e=_0x15ea0e-0x0;var _0x38f1b0=_0xe1d4[_0x15ea0e];return _0x38f1b0;};'use strict';var util=require(_0x4e1d('0x0'));var _=require(_0x4e1d('0x1'));var moment=require(_0x4e1d('0x2'));var BPromise=require(_0x4e1d('0x3'));var hardware=require(_0x4e1d('0x4'));var encryptor=require(_0x4e1d('0x5'));var db=require(_0x4e1d('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4e1d('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x4e1d('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x4e1d('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x45018f){return new BPromise(function(_0x479050,_0x367f0d){return db[_0x4e1d('0x9')][_0x4e1d('0xa')](_['defaults'](_0x45018f,{'raw':!![],'where':{'id':0x1}}))[_0x4e1d('0xb')](function(_0x41a6d0){return checkLicense(_0x41a6d0,null);})[_0x4e1d('0xb')](function(_0x4fcd55){_0x479050(_0x4fcd55);return;})[_0x4e1d('0xc')](function(_0x295764){_0x367f0d(_0x295764);});});}function checkLicense(_0x34bc76,_0x27f9b2){if(!_0x34bc76){demoLicense[_0x4e1d('0xd')]=_0x34bc76[_0x4e1d('0xe')];return demoLicense;}try{var _0xad1cc8=_0x27f9b2||_0x34bc76[_0x4e1d('0xf')];if(_[_0x4e1d('0x10')](_0xad1cc8)){throw new Error(_0x4e1d('0x11'));}var _0x2d706c=_0x34bc76['data1'];var _0x51287a=_0x34bc76[_0x4e1d('0x12')];var _0x13755c=_0x2d706c['split']('-')[0x4];var _0x9b3efd=_0x2d706c[_0x4e1d('0x13')]('-')[0x0];var _0x2b5803=encryptor['decryptString'](_0xad1cc8,util[_0x4e1d('0x14')](_0x4e1d('0x15'),_0x13755c,_0x2d706c,_0x9b3efd));var _0x245ea2=JSON[_0x4e1d('0x16')](_0x2b5803);_0x245ea2[_0x4e1d('0x17')]=![];_0x245ea2['uuid']=_0x2d706c;_0x245ea2[_0x4e1d('0x18')]=hardware[_0x4e1d('0x8')]();if(_0x51287a){var _0x3e73b6=encryptor['decryptString'](_0x51287a);_0x245ea2['gray']=_0x3e73b6;_0x245ea2[_0x4e1d('0x19')]=moment(_0x3e73b6)[_0x4e1d('0x1a')](0x7,_0x4e1d('0x1b'))[_0x4e1d('0x14')]();_0x245ea2['grayReason']=_0x245ea2[_0x4e1d('0xd')]!=_0x245ea2[_0x4e1d('0x18')]?_0x4e1d('0x1c'):_0x4e1d('0x1d');}return _0x245ea2;}catch(_0x3aa8ca){breakingLicense[_0x4e1d('0xd')]=_0x34bc76[_0x4e1d('0xe')];breakingLicense[_0x4e1d('0x1e')]=_0x3aa8ca[_0x4e1d('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x54953e,_0x21941f){getLicense()['then'](function(_0x9ce943){return db[_0x4e1d('0x1f')][_0x4e1d('0x20')]({'attributes':['role',[db[_0x4e1d('0x21')]['fn']('COUNT',db[_0x4e1d('0x21')][_0x4e1d('0x22')]('role')),_0x4e1d('0x23')]],'group':_0x4e1d('0x24'),'where':{'role':{'$or':[_0x4e1d('0x25'),_0x4e1d('0x26'),_0x4e1d('0x27')]}},'raw':!![]})['then'](function(_0x1f814b){var _0x299d80={'user':_0x9ce943['users']||0x0,'telephone':_0x9ce943[_0x4e1d('0x28')]||0x0};_0x1f814b[_0x4e1d('0x29')](function(_0x4a0b27){var _0x43068a=_0x4a0b27['role']===_0x4e1d('0x25')?_0x4e1d('0x26'):_0x4a0b27[_0x4e1d('0x24')];_0x299d80[_0x43068a]-=_0x4a0b27[_0x4e1d('0x23')];if(_0x299d80[_0x43068a]<0x0)_0x299d80[_0x43068a]=0x0;});_0x54953e(_0x299d80);return;});})[_0x4e1d('0xc')](function(_0x371f64){_0x21941f(_0x371f64);});});}function checkUserLimits(_0x3fe367){return new BPromise(function(_0x29b483,_0x97989b){getLimits()[_0x4e1d('0xb')](function(_0x5b484d){var _0x411317=_[_0x4e1d('0x2a')](_[_0x4e1d('0x2b')](_0x3fe367,_0x4e1d('0x24')),['admin',_0x4e1d('0x26'),_0x4e1d('0x27')]);var _0x13c0ac=(_0x411317[_0x4e1d('0x25')]||0x0)+(_0x411317[_0x4e1d('0x26')]||0x0);var _0x4ea584=_0x411317['telephone']||0x0;if(_0x13c0ac>_0x5b484d[_0x4e1d('0x26')])return _0x97989b('License\x20limit\x20reached\x20for\x20users');if(_0x4ea584>_0x5b484d[_0x4e1d('0x27')])return _0x97989b('License\x20limit\x20reached\x20for\x20telephones');return _0x29b483();})[_0x4e1d('0xc')](function(_0x3087e7){_0x97989b(_0x3087e7);});});}module[_0x4e1d('0x2c')]={'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 2e418cc..d6bb886 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 _0x1893=['myappanuglar-secret','app-id','secret'];(function(_0x483ba6,_0x70851b){var _0x45b9f3=function(_0x376404){while(--_0x376404){_0x483ba6['push'](_0x483ba6['shift']());}};_0x45b9f3(++_0x70851b);}(_0x1893,0xa2));var _0x3189=function(_0x2d0ef5,_0x5621a4){_0x2d0ef5=_0x2d0ef5-0x0;var _0x550979=_0x1893[_0x2d0ef5];return _0x550979;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3189('0x0'),'GOOGLE_ID':_0x3189('0x1'),'GOOGLE_SECRET':_0x3189('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x6d11=['http://localhost:9000','myappanuglar-secret','secret','exports'];(function(_0x16ef84,_0xf911a1){var _0x564dc0=function(_0x20f01e){while(--_0x20f01e){_0x16ef84['push'](_0x16ef84['shift']());}};_0x564dc0(++_0xf911a1);}(_0x6d11,0xbf));var _0x16d1=function(_0x1a75ae,_0x295ced){_0x1a75ae=_0x1a75ae-0x0;var _0xf3ab33=_0x6d11[_0x1a75ae];return _0xf3ab33;};'use strict';module[_0x16d1('0x0')]={'DOMAIN':_0x16d1('0x1'),'SESSION_SECRET':_0x16d1('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x16d1('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 7e4c546..be33a69 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3078=['../utils/loggers','fileLogger','exports'];(function(_0x618782,_0x3ea862){var _0x4e3612=function(_0x29fbc2){while(--_0x29fbc2){_0x618782['push'](_0x618782['shift']());}};_0x4e3612(++_0x3ea862);}(_0x3078,0x141));var _0x8307=function(_0x2c3a8f,_0x374e56){_0x2c3a8f=_0x2c3a8f-0x0;var _0x189412=_0x3078[_0x2c3a8f];return _0x189412;};'use strict';var fileLogger=require(_0x8307('0x0'))[_0x8307('0x1')];module[_0x8307('0x2')]=fileLogger; \ No newline at end of file +var _0x8ee7=['exports','../utils/loggers','fileLogger'];(function(_0x145fbd,_0x43c0d7){var _0x3b23c8=function(_0x3f2b2b){while(--_0x3f2b2b){_0x145fbd['push'](_0x145fbd['shift']());}};_0x3b23c8(++_0x43c0d7);}(_0x8ee7,0x1ea));var _0x78ee=function(_0x2c0772,_0x12e542){_0x2c0772=_0x2c0772-0x0;var _0xfb6016=_0x8ee7[_0x2c0772];return _0xfb6016;};'use strict';var fileLogger=require(_0x78ee('0x0'))[_0x78ee('0x1')];module[_0x78ee('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 05a5533..c9201e2 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 _0x79d9=['../../services/routing/index.js','xdr','path','resolve','join','root','legacy-libs','../../services/express/index.js','ami','agi','../../services/email/index.js','routing'];(function(_0x4b9655,_0x19c1f1){var _0x1f412e=function(_0x59bfe3){while(--_0x59bfe3){_0x4b9655['push'](_0x4b9655['shift']());}};_0x1f412e(++_0x19c1f1);}(_0x79d9,0xe6));var _0x979d=function(_0x853ff,_0x7f072b){_0x853ff=_0x853ff-0x0;var _0x9e868=_0x79d9[_0x853ff];return _0x9e868;};'use strict';var path=require(_0x979d('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x979d('0x1')](path[_0x979d('0x2')](cfg[_0x979d('0x3')],_0x979d('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x979d('0x2')](__dirname,_0x979d('0x5')),'env':env},{'name':_0x979d('0x6'),'script':path[_0x979d('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x979d('0x7'),'script':path[_0x979d('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':'email','script':path['join'](__dirname,_0x979d('0x8')),'env':env},{'name':_0x979d('0x9'),'script':path[_0x979d('0x2')](__dirname,_0x979d('0xa')),'env':env},{'name':_0x979d('0xb'),'script':path['join'](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x7673=['xdr','exports','../../config/environment','resolve','root','legacy-libs','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js'];(function(_0x3f1cd4,_0x25708a){var _0x18bfe0=function(_0x183f4e){while(--_0x183f4e){_0x3f1cd4['push'](_0x3f1cd4['shift']());}};_0x18bfe0(++_0x25708a);}(_0x7673,0x1bc));var _0x3767=function(_0x1ef2e3,_0x380ec2){_0x1ef2e3=_0x1ef2e3-0x0;var _0x173e11=_0x7673[_0x1ef2e3];return _0x173e11;};'use strict';var path=require('path');var cfg=require(_0x3767('0x0'));var env={'NODE_PATH':path[_0x3767('0x1')](path['join'](cfg[_0x3767('0x2')],_0x3767('0x3')))};var pm2config={'apps':[{'name':_0x3767('0x4'),'script':path[_0x3767('0x5')](__dirname,_0x3767('0x6')),'env':env},{'name':_0x3767('0x7'),'script':path['join'](__dirname,_0x3767('0x8')),'env':env},{'name':_0x3767('0x9'),'script':path[_0x3767('0x5')](__dirname,_0x3767('0xa')),'env':env},{'name':_0x3767('0xb'),'script':path[_0x3767('0x5')](__dirname,_0x3767('0xc')),'env':env},{'name':_0x3767('0xd'),'script':path[_0x3767('0x5')](__dirname,_0x3767('0xe')),'env':env},{'name':_0x3767('0xf'),'script':path[_0x3767('0x5')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x3767('0x10')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index e5de0c1..e9b5c6f 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 _0x7936=['stop','restart','list','describe','delete','dump','bluebird','./config','connect','connected','then','start','disconnect'];(function(_0x28d851,_0x4bf79d){var _0x217faa=function(_0x376531){while(--_0x376531){_0x28d851['push'](_0x28d851['shift']());}};_0x217faa(++_0x4bf79d);}(_0x7936,0x199));var _0x6793=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7936[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require('pm2');var BPromise=require(_0x6793('0x0'));var config=require(_0x6793('0x1'));function connect(){return new BPromise(function(_0x757067,_0x4fc03d){return pm2[_0x6793('0x2')](function(_0x44e4f3){if(_0x44e4f3){return _0x4fc03d(_0x44e4f3);}return _0x757067(_0x6793('0x3'));});});};exports['start']=function(_0x3ca57d){return connect()[_0x6793('0x4')](function(){return new BPromise(function(_0x22197d,_0x458c1f){return pm2[_0x6793('0x5')](_0x3ca57d,function(_0x30d01f,_0x2d123e){if(_0x30d01f){return _0x458c1f(_0x30d01f);}pm2[_0x6793('0x6')]();return _0x22197d(_0x2d123e);});});});};exports['stop']=function(_0x1ef868){return connect()['then'](function(){return new BPromise(function(_0x44513c,_0x52b2ac){return pm2[_0x6793('0x7')](_0x1ef868,function(_0x2a319f,_0x1a0a2c){if(_0x2a319f){return _0x52b2ac(_0x2a319f);}pm2['disconnect']();return _0x44513c(_0x1a0a2c);});});});};exports[_0x6793('0x8')]=function(_0x5567fe){return connect()[_0x6793('0x4')](function(){return new BPromise(function(_0x1f096a,_0x4b86bc){return pm2[_0x6793('0x8')](_0x5567fe,function(_0x1615e7,_0x27b981){if(_0x1615e7){return _0x4b86bc(_0x1615e7);}pm2[_0x6793('0x6')]();return _0x1f096a(_0x27b981);});});});};exports[_0x6793('0x9')]=function(){return connect()[_0x6793('0x4')](function(){return new BPromise(function(_0x12e846,_0x2c1385){return pm2['list'](function(_0x437296,_0x4b2cd0){if(_0x437296){return _0x2c1385(_0x437296);}pm2[_0x6793('0x6')]();return _0x12e846(_0x4b2cd0);});});});};exports[_0x6793('0xa')]=function(_0x26e6cd){return connect()[_0x6793('0x4')](function(){return new BPromise(function(_0x137f16,_0x383e6e){return pm2[_0x6793('0xa')](_0x26e6cd,function(_0x3d7e4a,_0x2edb1a){if(_0x3d7e4a){return _0x383e6e(_0x3d7e4a);}pm2[_0x6793('0x6')]();return _0x137f16(_0x2edb1a);});});});};exports[_0x6793('0xb')]=function(_0x17509f){return connect()[_0x6793('0x4')](function(){return new BPromise(function(_0x31bda2,_0x2f4ea2){return pm2[_0x6793('0xb')](_0x17509f,function(_0x5649f5,_0x349b34){if(_0x5649f5){return _0x2f4ea2(_0x5649f5);}pm2[_0x6793('0x6')]();return _0x31bda2(_0x349b34);});});});};exports[_0x6793('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2b99dc,_0xc9e135){return pm2[_0x6793('0xc')](function(_0x75fe10){if(_0x75fe10){return _0xc9e135(_0x75fe10);}return _0x2b99dc('saved');});});});}; \ No newline at end of file +var _0xd95d=['start','stop','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connected','then'];(function(_0x291606,_0x5de54a){var _0x4ae5c2=function(_0x518976){while(--_0x518976){_0x291606['push'](_0x291606['shift']());}};_0x4ae5c2(++_0x5de54a);}(_0xd95d,0x95));var _0xdd95=function(_0x36e70b,_0x242b65){_0x36e70b=_0x36e70b-0x0;var _0x27fde3=_0xd95d[_0x36e70b];return _0x27fde3;};'use strict';var pm2=require(_0xdd95('0x0'));var BPromise=require(_0xdd95('0x1'));var config=require(_0xdd95('0x2'));function connect(){return new BPromise(function(_0x2262bc,_0x5d015b){return pm2['connect'](function(_0x3bfbd9){if(_0x3bfbd9){return _0x5d015b(_0x3bfbd9);}return _0x2262bc(_0xdd95('0x3'));});});};exports['start']=function(_0x1cc101){return connect()[_0xdd95('0x4')](function(){return new BPromise(function(_0x320cfa,_0x5a3ca7){return pm2[_0xdd95('0x5')](_0x1cc101,function(_0x56a282,_0x42108d){if(_0x56a282){return _0x5a3ca7(_0x56a282);}pm2['disconnect']();return _0x320cfa(_0x42108d);});});});};exports[_0xdd95('0x6')]=function(_0x1c9c13){return connect()[_0xdd95('0x4')](function(){return new BPromise(function(_0x303e0d,_0x5923ff){return pm2[_0xdd95('0x6')](_0x1c9c13,function(_0x54f28b,_0x580163){if(_0x54f28b){return _0x5923ff(_0x54f28b);}pm2[_0xdd95('0x7')]();return _0x303e0d(_0x580163);});});});};exports[_0xdd95('0x8')]=function(_0x1a3c0d){return connect()[_0xdd95('0x4')](function(){return new BPromise(function(_0x213432,_0x35de64){return pm2['restart'](_0x1a3c0d,function(_0x2a55b2,_0x499d14){if(_0x2a55b2){return _0x35de64(_0x2a55b2);}pm2['disconnect']();return _0x213432(_0x499d14);});});});};exports[_0xdd95('0x9')]=function(){return connect()[_0xdd95('0x4')](function(){return new BPromise(function(_0x16abae,_0x3402d7){return pm2[_0xdd95('0x9')](function(_0x16e348,_0x198e6e){if(_0x16e348){return _0x3402d7(_0x16e348);}pm2[_0xdd95('0x7')]();return _0x16abae(_0x198e6e);});});});};exports[_0xdd95('0xa')]=function(_0x39f38a){return connect()[_0xdd95('0x4')](function(){return new BPromise(function(_0xc8f4a8,_0x5533a7){return pm2[_0xdd95('0xa')](_0x39f38a,function(_0x1204e7,_0x2e70ba){if(_0x1204e7){return _0x5533a7(_0x1204e7);}pm2[_0xdd95('0x7')]();return _0xc8f4a8(_0x2e70ba);});});});};exports[_0xdd95('0xb')]=function(_0x9b07a9){return connect()[_0xdd95('0x4')](function(){return new BPromise(function(_0x363303,_0x26ae65){return pm2[_0xdd95('0xb')](_0x9b07a9,function(_0x1d3165,_0x717e4a){if(_0x1d3165){return _0x26ae65(_0x1d3165);}pm2[_0xdd95('0x7')]();return _0x363303(_0x717e4a);});});});};exports[_0xdd95('0xc')]=function(){return connect()[_0xdd95('0x4')](function(){return new BPromise(function(_0x4c052e,_0x2182a0){return pm2['dump'](function(_0x5ba37e){if(_0x5ba37e){return _0x2182a0(_0x5ba37e);}return _0x4c052e(_0xdd95('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 2f09a81..384d5f8 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 _0xf781=['lastMsgAt','subtract','minutes','then','length','map','join','update','system','timeout','format','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','find','chatTimeout','ChatInteraction','findAll'];(function(_0xc249a9,_0x6d88fa){var _0x5992df=function(_0x481b68){while(--_0x481b68){_0xc249a9['push'](_0xc249a9['shift']());}};_0x5992df(++_0x6d88fa);}(_0xf781,0xf4));var _0x1f78=function(_0x1d4660,_0x18a364){_0x1d4660=_0x1d4660-0x0;var _0xfda846=_0xf781[_0x1d4660];return _0xfda846;};'use strict';var _=require('lodash');var moment=require(_0x1f78('0x0'));var Redis=require(_0x1f78('0x1'));var util=require('util');var config=require(_0x1f78('0x2'));var db=require(_0x1f78('0x3'))['db'];var logger=require('../logger')(_0x1f78('0x4'));config[_0x1f78('0x5')]=_[_0x1f78('0x6')](config['redis'],{'host':_0x1f78('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1f78('0x5')]));function closeInteractions(){var _0x2d3a5f=0x0;var _0x364fcb=[];return db['Setting'][_0x1f78('0x8')]({'raw':!![],'attributes':['id',_0x1f78('0x9')],'where':{'id':0x1}})['then'](function(_0x1c9fa5){_0x2d3a5f=_0x1c9fa5[_0x1f78('0x9')];if(_0x2d3a5f){return db[_0x1f78('0xa')][_0x1f78('0xb')]({'raw':!![],'attributes':['id',_0x1f78('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x1f78('0xd')](_0x1c9fa5[_0x1f78('0x9')],_0x1f78('0xe'))}}});}else{return[];}})[_0x1f78('0xf')](function(_0x58d866){if(_0x58d866&&_0x58d866[_0x1f78('0x10')]){_0x364fcb=_[_0x1f78('0x11')](_0x58d866||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x364fcb[_0x1f78('0x12')]());return db[_0x1f78('0xa')][_0x1f78('0x13')]({'closeReason':_0x1f78('0x14'),'disposition':_0x1f78('0x15'),'closed':!![],'closedAt':moment()[_0x1f78('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x364fcb}});}})[_0x1f78('0xf')](function(){if(_0x364fcb&&_0x364fcb['length']){logger[_0x1f78('0x17')](_0x1f78('0x18'),_0x364fcb[_0x1f78('0x12')]());for(var _0x1f0eb1=0x0;_0x1f0eb1<_0x364fcb['length'];_0x1f0eb1++){io[_0x1f78('0x19')](_0x1f78('0x1a'),{'id':_0x364fcb[_0x1f0eb1],'closed':!![]});}}})[_0x1f78('0x1b')](function(_0x2e6e44){logger[_0x1f78('0x1c')](_0x1f78('0x1d'),_0x2e6e44?util[_0x1f78('0x1e')](_0x2e6e44,{'showHidden':![],'depth':null}):'');});}exports[_0x1f78('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x71bd=['join','update','system','timeout','format','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','findAll','lastMsgAt','subtract','minutes','then','map','info','[CHAT]\x20Interactions\x20to\x20close:'];(function(_0x1501bd,_0x5c33a6){var _0x17020c=function(_0x5910ca){while(--_0x5910ca){_0x1501bd['push'](_0x1501bd['shift']());}};_0x17020c(++_0x5c33a6);}(_0x71bd,0x8e));var _0xd71b=function(_0xab8cbb,_0x3fd38e){_0xab8cbb=_0xab8cbb-0x0;var _0x2926c4=_0x71bd[_0xab8cbb];return _0x2926c4;};'use strict';var _=require(_0xd71b('0x0'));var moment=require(_0xd71b('0x1'));var Redis=require(_0xd71b('0x2'));var util=require(_0xd71b('0x3'));var config=require(_0xd71b('0x4'));var db=require(_0xd71b('0x5'))['db'];var logger=require(_0xd71b('0x6'))(_0xd71b('0x7'));config[_0xd71b('0x8')]=_[_0xd71b('0x9')](config['redis'],{'host':_0xd71b('0xa'),'port':0x18eb});var io=require(_0xd71b('0xb'))(new Redis(config['redis']));function closeInteractions(){var _0xa13298=0x0;var _0x130384=[];return db[_0xd71b('0xc')][_0xd71b('0xd')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x214b6c){_0xa13298=_0x214b6c[_0xd71b('0xe')];if(_0xa13298){return db['ChatInteraction'][_0xd71b('0xf')]({'raw':!![],'attributes':['id',_0xd71b('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd71b('0x11')](_0x214b6c[_0xd71b('0xe')],_0xd71b('0x12'))}}});}else{return[];}})[_0xd71b('0x13')](function(_0x3df743){if(_0x3df743&&_0x3df743['length']){_0x130384=_[_0xd71b('0x14')](_0x3df743||[],'id');logger[_0xd71b('0x15')](_0xd71b('0x16'),_0x130384[_0xd71b('0x17')]());return db['ChatInteraction'][_0xd71b('0x18')]({'closeReason':_0xd71b('0x19'),'disposition':_0xd71b('0x1a'),'closed':!![],'closedAt':moment()[_0xd71b('0x1b')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x130384}});}})[_0xd71b('0x13')](function(){if(_0x130384&&_0x130384[_0xd71b('0x1c')]){logger['info'](_0xd71b('0x1d'),_0x130384[_0xd71b('0x17')]());for(var _0x105473=0x0;_0x105473<_0x130384['length'];_0x105473++){io['emit']('chatInteraction:update',{'id':_0x130384[_0x105473],'closed':!![]});}}})[_0xd71b('0x1e')](function(_0x2816b7){logger['error'](_0xd71b('0x1f'),_0x2816b7?util[_0xd71b('0x20')](_0x2816b7,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 3259a3a..38461da 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 _0x4e7d=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x14a046,_0x2b0bde){var _0x10ccaf=function(_0x3a2cb4){while(--_0x3a2cb4){_0x14a046['push'](_0x14a046['shift']());}};_0x10ccaf(++_0x2b0bde);}(_0x4e7d,0x13f));var _0xd4e7=function(_0x272632,_0x4ca650){_0x272632=_0x272632-0x0;var _0x10b8ec=_0x4e7d[_0x272632];return _0x10b8ec;};'use strict';function start(){var _0x1f19f8=require(_0xd4e7('0x0'));return _0x1f19f8[_0xd4e7('0x1')]();}module[_0xd4e7('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x59e8=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x5ef52a,_0x5e4d11){var _0x22524e=function(_0x57f054){while(--_0x57f054){_0x5ef52a['push'](_0x5ef52a['shift']());}};_0x22524e(++_0x5e4d11);}(_0x59e8,0x1b7));var _0x859e=function(_0x2a3b3a,_0x97a664){_0x2a3b3a=_0x2a3b3a-0x0;var _0xaab42b=_0x59e8[_0x2a3b3a];return _0xaab42b;};'use strict';function start(){var _0x196b73=require(_0x859e('0x0'));return _0x196b73['startAllRefreshIntervals']();}module[_0x859e('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 515fc94..333f5cd 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 _0x3333=['add','start','add\x20cron','cron','stop\x20cron','update\x20cron','stop','run','util','path','lodash','cron-job-manager','bluebird','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','status','Sent','attachments','text','stringify','existsSync','message','sendIfEmpty','info','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','name','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','toString','length','exists','deleteJob','toRun','index','my\x20id','resolve','run\x20job','active','isBetween','startAt'];(function(_0x58f68a,_0x300396){var _0xbb93b4=function(_0x2fe468){while(--_0x2fe468){_0x58f68a['push'](_0x58f68a['shift']());}};_0xbb93b4(++_0x300396);}(_0x3333,0xf5));var _0x3333=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x3333[_0x3b96cf];return _0x2e315a;};'use strict';var fs=require('fs');var util=require(_0x3333('0x0'));var path=require(_0x3333('0x1'));var _=require(_0x3333('0x2'));var moment=require('moment');var CronJobManager=require(_0x3333('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x3333('0x4'));var logger=require('../logger')('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x3333('0x5'));var analyticDefaultReportController=require(_0x3333('0x6'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3e4e41,_0x4d7cb1){return function(){logger['info'](_0x3333('0x7'),_0x3e4e41[_0x3333('0x8')]);var _0x3a9336=!![];var _0x3095fc=_0x3e4e41[_0x3333('0x9')][_0x3333('0xa')]();var _0x37cc82={'account':_0x3095fc,'message':{'from':util[_0x3333('0xb')]('\x22%s\x22\x20<%s>',_0x3e4e41[_0x3333('0x9')]['name'],_0x3e4e41[_0x3333('0x9')][_0x3333('0x8')]||_0x3e4e41['MailAccount'][_0x3333('0xc')][_0x3333('0xd')]),'to':_0x3e4e41[_0x3333('0x8')],'cc':_0x3e4e41['cc'],'bcc':_0x3e4e41[_0x3333('0xe')],'subject':util[_0x3333('0xb')](_0x3333('0xf'),_0x4d7cb1['name'],_0x3e4e41[_0x3333('0x10')],_0x3e4e41[_0x3333('0x11')])}};var _0x354ba3=path[_0x3333('0x12')](__dirname,_0x3333('0x13'));var _0x4d580c=_0x4d7cb1[_0x3333('0x14')];var _0x2ff8a5=util['format'](_0x3333('0x15'),path[_0x3333('0x16')](_0x4d7cb1[_0x3333('0x14')],path[_0x3333('0x17')](_0x4d7cb1[_0x3333('0x14')])),'zip');var _0x42a91e=path['join'](_0x354ba3,_0x4d580c);var _0x32f63a=path['join'](_0x354ba3,_0x2ff8a5);if(fs['existsSync'](_0x42a91e)){_0x4d7cb1[_0x3333('0x18')]=_0x3333('0x19');_0x37cc82['message'][_0x3333('0x1a')]=[{'filename':_0x4d580c,'path':_0x42a91e}];_0x37cc82['message'][_0x3333('0x1b')]=util[_0x3333('0xb')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x3333('0x1c')](_0x4d7cb1,null,0x2));}else if(fs[_0x3333('0x1d')](_0x32f63a)){_0x4d7cb1[_0x3333('0x18')]=_0x3333('0x19');_0x37cc82[_0x3333('0x1e')][_0x3333('0x1a')]=[{'filename':_0x2ff8a5,'path':_0x32f63a}];}else{_0x37cc82[_0x3333('0x1e')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x3e4e41[_0x3333('0x1f')]){_0x3a9336=![];logger[_0x3333('0x20')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3a9336){return client['request'](_0x3333('0x21'),_0x37cc82)[_0x3333('0x22')](function(_0x48b64d){if(_0x48b64d['error']){return logger[_0x3333('0x23')](_0x3333('0x24'),JSON[_0x3333('0x1c')](_0x48b64d));}return logger[_0x3333('0x20')](_0x3333('0x25'));})[_0x3333('0x26')](function(_0x5789e1){return logger['error'](_0x3333('0x24'),JSON[_0x3333('0x1c')](_0x5789e1));});}};}function handleError(){return function(_0x5dd864){return logger[_0x3333('0x23')](JSON[_0x3333('0x1c')](_0x5dd864));};}function handleResult(_0x1eff69){return function(_0x130ae1){logger['info'](_0x3333('0x27'),JSON[_0x3333('0x1c')](_0x130ae1));if(_0x1eff69[_0x3333('0x9')]&&_0x1eff69[_0x3333('0x9')]['Smtp']&&!_['isNil'](_0x1eff69[_0x3333('0x8')])){setTimeout(handleSendEmail(_0x1eff69,_0x130ae1),0x3c*0x3e8);}};}function handleJob(_0x5c9833){return function(){try{if(_[_0x3333('0x28')](_0x5c9833[_0x3333('0x10')])){return logger[_0x3333('0x20')](_0x3333('0x29'));}if(_[_0x3333('0x28')](_0x5c9833['subtractUnit'])){return logger[_0x3333('0x20')](_0x3333('0x2a'));}var _0x2cfb7f={'startDate':moment()[_0x3333('0x2b')](_0x5c9833[_0x3333('0x10')],_0x5c9833[_0x3333('0x11')])[_0x3333('0xb')](_0x3333('0x2c')),'endDate':moment()['format'](_0x3333('0x2c')),'type':_0x3333('0x2d'),'output':_0x5c9833[_0x3333('0x2e')],'name':_0x5c9833[_0x3333('0x2f')]};if(!_[_0x3333('0x28')](_0x5c9833['DefaultReportId'])){logger[_0x3333('0x20')](_0x3333('0x30'),_0x5c9833[_0x3333('0x31')]);return analyticDefaultReportController[_0x3333('0x32')]({'id':_0x5c9833['DefaultReportId']},_0x2cfb7f)[_0x3333('0x22')](handleResult(_0x5c9833))[_0x3333('0x26')](handleError());}if(!_[_0x3333('0x28')](_0x5c9833[_0x3333('0x33')])){logger['info'](_0x3333('0x34'),_0x5c9833['CustomReportId']);return analyticCustomReportController[_0x3333('0x32')]({'id':_0x5c9833[_0x3333('0x33')]},_0x2cfb7f)['then'](handleResult(_0x5c9833))[_0x3333('0x26')](handleError());}}catch(_0x481006){logger[_0x3333('0x23')](JSON[_0x3333('0x1c')](_0x481006));}return logger[_0x3333('0x20')](_0x3333('0x35'));};}function getJobs(_0x31aa44){var _0x1dd8db={};if(_0x31aa44){_0x1dd8db['id']=_0x31aa44;}return db[_0x3333('0x36')][_0x3333('0x37')]({'where':_0x1dd8db,'include':[{'model':db[_0x3333('0x9')],'attributes':['id',_0x3333('0x2f'),_0x3333('0x8')],'include':[{'model':db[_0x3333('0x38')],'as':_0x3333('0xc'),'include':[{'model':db[_0x3333('0x39')],'as':_0x3333('0x39')}]}]}]})[_0x3333('0x22')](function(_0x4765d2){var _0x57c87d=_[_0x3333('0x3a')](manager['jobs']);var _0x481a4f=_['map'](_0x4765d2,function(_0x58175e){return _0x58175e['id'][_0x3333('0x3b')]();});var _0x30a8b0=_['keyBy'](_0x4765d2,function(_0x18a020){return _0x18a020['id']['toString']();});var _0x129275=_0x31aa44?_0x481a4f:_['difference'](_0x481a4f,_0x57c87d);var _0x3045af=_['intersection'](_0x481a4f,_0x57c87d);var _0x51f511=_['difference'](_0x57c87d,_0x481a4f);var _0x24e2bd;var _0x5b81f1;for(_0x24e2bd=0x0;_0x24e2bd<_0x51f511[_0x3333('0x3c')]&&!_0x31aa44;_0x24e2bd+=0x1){_0x5b81f1=_0x51f511[_0x24e2bd][_0x3333('0x3b')]();if(manager[_0x3333('0x3d')](_0x5b81f1)){manager['stop'](_0x5b81f1);manager[_0x3333('0x3e')](_0x5b81f1);logger[_0x3333('0x20')]('delete\x20cron',_0x5b81f1);}}logger[_0x3333('0x20')](_0x3333('0x3f'),JSON[_0x3333('0x1c')](_0x129275));for(_0x24e2bd=0x0;_0x24e2bd<_0x129275[_0x3333('0x3c')];_0x24e2bd+=0x1){_0x5b81f1=_0x129275[_0x24e2bd][_0x3333('0x3b')]();logger['info'](_0x3333('0x40'),_0x5b81f1);if(_0x31aa44){logger[_0x3333('0x20')](_0x3333('0x41'),_0x31aa44);logger[_0x3333('0x20')](JSON[_0x3333('0x1c')](_0x30a8b0[_0x5b81f1]));BPromise[_0x3333('0x42')]()[_0x3333('0x22')](handleJob(_0x30a8b0[_0x5b81f1]));logger['info'](_0x3333('0x43'),_0x30a8b0[_0x5b81f1][_0x3333('0x2f')],_0x30a8b0[_0x5b81f1]['cron']);}else if(_0x30a8b0[_0x5b81f1]['cron']&&_0x30a8b0[_0x5b81f1][_0x3333('0x44')]&&moment()[_0x3333('0x45')](_0x30a8b0[_0x5b81f1][_0x3333('0x46')],_0x30a8b0[_0x5b81f1]['endAt'])){manager[_0x3333('0x47')](_0x5b81f1,_0x30a8b0[_0x5b81f1]['cron'],handleJob(_0x30a8b0[_0x5b81f1]));manager[_0x3333('0x48')](_0x5b81f1);logger[_0x3333('0x20')](_0x3333('0x49'),_0x30a8b0[_0x5b81f1]['name'],_0x30a8b0[_0x5b81f1][_0x3333('0x4a')]);}else if(manager[_0x3333('0x3d')](_0x5b81f1)){manager['stop'](_0x5b81f1);manager[_0x3333('0x3e')](_0x5b81f1);logger[_0x3333('0x20')](_0x3333('0x4b'),_0x30a8b0[_0x5b81f1][_0x3333('0x2f')],_0x30a8b0[_0x5b81f1][_0x3333('0x4a')]);}}for(_0x24e2bd=0x0,_0x5b81f1;_0x24e2bd<_0x3045af[_0x3333('0x3c')]&&!_0x31aa44;_0x24e2bd+=0x1){_0x5b81f1=_0x3045af[_0x24e2bd][_0x3333('0x3b')]();if(manager[_0x3333('0x3d')](_0x5b81f1)){if(_0x30a8b0[_0x5b81f1]['cron']&&_0x30a8b0[_0x5b81f1]['active']&&moment()['isBetween'](_0x30a8b0[_0x5b81f1]['startAt'],_0x30a8b0[_0x5b81f1]['endAt'])){manager['update'](_0x5b81f1,_0x30a8b0[_0x5b81f1][_0x3333('0x4a')],handleJob(_0x30a8b0[_0x5b81f1]));logger[_0x3333('0x20')](_0x3333('0x4c'),_0x30a8b0[_0x5b81f1][_0x3333('0x2f')],_0x30a8b0[_0x5b81f1][_0x3333('0x4a')]);}else{manager[_0x3333('0x4d')](_0x5b81f1);manager['deleteJob'](_0x5b81f1);logger['info'](_0x3333('0x4b'),_0x30a8b0[_0x5b81f1][_0x3333('0x2f')],_0x30a8b0[_0x5b81f1][_0x3333('0x4a')]);}}}})['catch'](function(_0x79d12d){logger[_0x3333('0x23')](JSON[_0x3333('0x1c')](_0x79d12d));});}exports[_0x3333('0x4e')]=function(_0x33969c){return getJobs(_0x33969c);};exports[_0x3333('0x48')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xc8ee=['CloudProvider','keys','map','keyBy','toString','difference','intersection','length','exists','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','add','start','add\x20cron','deleteJob','stop\x20cron','active','endAt','update','update\x20cron','stop','util','path','moment','cron-job-manager','jayson/promise','bluebird','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','MailAccount','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','SendMail','then','error','stringify','email\x20sent','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','catch','no\x20report\x20id','Schedule','findAll'];(function(_0x48fa5,_0x837939){var _0x2ceacd=function(_0x42aa68){while(--_0x42aa68){_0x48fa5['push'](_0x48fa5['shift']());}};_0x2ceacd(++_0x837939);}(_0xc8ee,0x1c0));var _0xec8e=function(_0x1cd3b9,_0xeb744a){_0x1cd3b9=_0x1cd3b9-0x0;var _0x2df05d=_0xc8ee[_0x1cd3b9];return _0x2df05d;};'use strict';var fs=require('fs');var util=require(_0xec8e('0x0'));var path=require(_0xec8e('0x1'));var _=require('lodash');var moment=require(_0xec8e('0x2'));var CronJobManager=require(_0xec8e('0x3'));var jayson=require(_0xec8e('0x4'));var BPromise=require(_0xec8e('0x5'));var logger=require('../logger')('schedule');var db=require(_0xec8e('0x6'))['db'];var analyticCustomReportController=require(_0xec8e('0x7'));var analyticDefaultReportController=require(_0xec8e('0x8'));var client=jayson['client'][_0xec8e('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3249a7,_0x4f5633){return function(){logger[_0xec8e('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x3249a7[_0xec8e('0xb')]);var _0x1be8f4=!![];var _0x40870e=_0x3249a7['MailAccount'][_0xec8e('0xc')]();var _0x1659ca={'account':_0x40870e,'message':{'from':util[_0xec8e('0xd')](_0xec8e('0xe'),_0x3249a7['MailAccount'][_0xec8e('0xf')],_0x3249a7['MailAccount'][_0xec8e('0xb')]||_0x3249a7[_0xec8e('0x10')][_0xec8e('0x11')][_0xec8e('0x12')]),'to':_0x3249a7[_0xec8e('0xb')],'cc':_0x3249a7['cc'],'bcc':_0x3249a7['bcc'],'subject':util['format'](_0xec8e('0x13'),_0x4f5633[_0xec8e('0xf')],_0x3249a7[_0xec8e('0x14')],_0x3249a7[_0xec8e('0x15')])}};var _0x22664d=path[_0xec8e('0x16')](__dirname,'../../files/reports');var _0x45a33a=_0x4f5633[_0xec8e('0x17')];var _0x17c32b=util[_0xec8e('0xd')](_0xec8e('0x18'),path[_0xec8e('0x19')](_0x4f5633[_0xec8e('0x17')],path[_0xec8e('0x1a')](_0x4f5633[_0xec8e('0x17')])),_0xec8e('0x1b'));var _0x2468c3=path[_0xec8e('0x16')](_0x22664d,_0x45a33a);var _0x5b09ac=path[_0xec8e('0x16')](_0x22664d,_0x17c32b);if(fs[_0xec8e('0x1c')](_0x2468c3)){_0x4f5633[_0xec8e('0x1d')]=_0xec8e('0x1e');_0x1659ca[_0xec8e('0x1f')][_0xec8e('0x20')]=[{'filename':_0x45a33a,'path':_0x2468c3}];_0x1659ca['message'][_0xec8e('0x21')]=util[_0xec8e('0xd')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x4f5633,null,0x2));}else if(fs[_0xec8e('0x1c')](_0x5b09ac)){_0x4f5633[_0xec8e('0x1d')]=_0xec8e('0x1e');_0x1659ca[_0xec8e('0x1f')]['attachments']=[{'filename':_0x17c32b,'path':_0x5b09ac}];}else{_0x1659ca[_0xec8e('0x1f')][_0xec8e('0x21')]=_0xec8e('0x22');if(!_0x3249a7[_0xec8e('0x23')]){_0x1be8f4=![];logger[_0xec8e('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x1be8f4){return client['request'](_0xec8e('0x24'),_0x1659ca)[_0xec8e('0x25')](function(_0x3c97cd){if(_0x3c97cd[_0xec8e('0x26')]){return logger[_0xec8e('0x26')]('error\x20mail',JSON[_0xec8e('0x27')](_0x3c97cd));}return logger['info'](_0xec8e('0x28'));})['catch'](function(_0x3f393e){return logger[_0xec8e('0x26')](_0xec8e('0x29'),JSON[_0xec8e('0x27')](_0x3f393e));});}};}function handleError(){return function(_0x1a9ffa){return logger[_0xec8e('0x26')](JSON['stringify'](_0x1a9ffa));};}function handleResult(_0x335c39){return function(_0x5de9c5){logger[_0xec8e('0xa')](_0xec8e('0x2a'),JSON[_0xec8e('0x27')](_0x5de9c5));if(_0x335c39['MailAccount']&&_0x335c39[_0xec8e('0x10')][_0xec8e('0x11')]&&!_[_0xec8e('0x2b')](_0x335c39['email'])){setTimeout(handleSendEmail(_0x335c39,_0x5de9c5),0x3c*0x3e8);}};}function handleJob(_0x544c5d){return function(){try{if(_[_0xec8e('0x2b')](_0x544c5d[_0xec8e('0x14')])){return logger['info'](_0xec8e('0x2c'));}if(_[_0xec8e('0x2b')](_0x544c5d[_0xec8e('0x15')])){return logger[_0xec8e('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x271cec={'startDate':moment()[_0xec8e('0x2d')](_0x544c5d[_0xec8e('0x14')],_0x544c5d['subtractUnit'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xec8e('0xd')](_0xec8e('0x2e')),'type':_0xec8e('0x2f'),'output':_0x544c5d[_0xec8e('0x30')],'name':_0x544c5d[_0xec8e('0xf')]};if(!_[_0xec8e('0x2b')](_0x544c5d[_0xec8e('0x31')])){logger[_0xec8e('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x544c5d[_0xec8e('0x31')]);return analyticDefaultReportController[_0xec8e('0x32')]({'id':_0x544c5d[_0xec8e('0x31')]},_0x271cec)[_0xec8e('0x25')](handleResult(_0x544c5d))['catch'](handleError());}if(!_[_0xec8e('0x2b')](_0x544c5d['CustomReportId'])){logger[_0xec8e('0xa')](_0xec8e('0x33'),_0x544c5d['CustomReportId']);return analyticCustomReportController[_0xec8e('0x32')]({'id':_0x544c5d['CustomReportId']},_0x271cec)[_0xec8e('0x25')](handleResult(_0x544c5d))[_0xec8e('0x34')](handleError());}}catch(_0x408e7c){logger[_0xec8e('0x26')](JSON[_0xec8e('0x27')](_0x408e7c));}return logger[_0xec8e('0xa')](_0xec8e('0x35'));};}function getJobs(_0x11995c){var _0x16a30e={};if(_0x11995c){_0x16a30e['id']=_0x11995c;}return db[_0xec8e('0x36')][_0xec8e('0x37')]({'where':_0x16a30e,'include':[{'model':db[_0xec8e('0x10')],'attributes':['id',_0xec8e('0xf'),_0xec8e('0xb')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0xec8e('0x38')],'as':_0xec8e('0x38')}]}]}]})[_0xec8e('0x25')](function(_0xabe8b5){var _0x337a0f=_[_0xec8e('0x39')](manager['jobs']);var _0x1ec2f2=_[_0xec8e('0x3a')](_0xabe8b5,function(_0x82aae7){return _0x82aae7['id']['toString']();});var _0x11b2e9=_[_0xec8e('0x3b')](_0xabe8b5,function(_0x59201b){return _0x59201b['id'][_0xec8e('0x3c')]();});var _0x4ffedf=_0x11995c?_0x1ec2f2:_[_0xec8e('0x3d')](_0x1ec2f2,_0x337a0f);var _0x2006b7=_[_0xec8e('0x3e')](_0x1ec2f2,_0x337a0f);var _0x5dd119=_[_0xec8e('0x3d')](_0x337a0f,_0x1ec2f2);var _0x3042bb;var _0x8adfad;for(_0x3042bb=0x0;_0x3042bb<_0x5dd119[_0xec8e('0x3f')]&&!_0x11995c;_0x3042bb+=0x1){_0x8adfad=_0x5dd119[_0x3042bb]['toString']();if(manager[_0xec8e('0x40')](_0x8adfad)){manager['stop'](_0x8adfad);manager['deleteJob'](_0x8adfad);logger[_0xec8e('0xa')](_0xec8e('0x41'),_0x8adfad);}}logger[_0xec8e('0xa')](_0xec8e('0x42'),JSON[_0xec8e('0x27')](_0x4ffedf));for(_0x3042bb=0x0;_0x3042bb<_0x4ffedf[_0xec8e('0x3f')];_0x3042bb+=0x1){_0x8adfad=_0x4ffedf[_0x3042bb][_0xec8e('0x3c')]();logger[_0xec8e('0xa')](_0xec8e('0x43'),_0x8adfad);if(_0x11995c){logger[_0xec8e('0xa')](_0xec8e('0x44'),_0x11995c);logger[_0xec8e('0xa')](JSON[_0xec8e('0x27')](_0x11b2e9[_0x8adfad]));BPromise[_0xec8e('0x45')]()['then'](handleJob(_0x11b2e9[_0x8adfad]));logger[_0xec8e('0xa')](_0xec8e('0x46'),_0x11b2e9[_0x8adfad][_0xec8e('0xf')],_0x11b2e9[_0x8adfad]['cron']);}else if(_0x11b2e9[_0x8adfad][_0xec8e('0x47')]&&_0x11b2e9[_0x8adfad]['active']&&moment()[_0xec8e('0x48')](_0x11b2e9[_0x8adfad][_0xec8e('0x49')],_0x11b2e9[_0x8adfad]['endAt'])){manager[_0xec8e('0x4a')](_0x8adfad,_0x11b2e9[_0x8adfad][_0xec8e('0x47')],handleJob(_0x11b2e9[_0x8adfad]));manager[_0xec8e('0x4b')](_0x8adfad);logger[_0xec8e('0xa')](_0xec8e('0x4c'),_0x11b2e9[_0x8adfad][_0xec8e('0xf')],_0x11b2e9[_0x8adfad][_0xec8e('0x47')]);}else if(manager[_0xec8e('0x40')](_0x8adfad)){manager['stop'](_0x8adfad);manager[_0xec8e('0x4d')](_0x8adfad);logger['info'](_0xec8e('0x4e'),_0x11b2e9[_0x8adfad]['name'],_0x11b2e9[_0x8adfad][_0xec8e('0x47')]);}}for(_0x3042bb=0x0,_0x8adfad;_0x3042bb<_0x2006b7[_0xec8e('0x3f')]&&!_0x11995c;_0x3042bb+=0x1){_0x8adfad=_0x2006b7[_0x3042bb][_0xec8e('0x3c')]();if(manager['exists'](_0x8adfad)){if(_0x11b2e9[_0x8adfad]['cron']&&_0x11b2e9[_0x8adfad][_0xec8e('0x4f')]&&moment()[_0xec8e('0x48')](_0x11b2e9[_0x8adfad][_0xec8e('0x49')],_0x11b2e9[_0x8adfad][_0xec8e('0x50')])){manager[_0xec8e('0x51')](_0x8adfad,_0x11b2e9[_0x8adfad][_0xec8e('0x47')],handleJob(_0x11b2e9[_0x8adfad]));logger[_0xec8e('0xa')](_0xec8e('0x52'),_0x11b2e9[_0x8adfad][_0xec8e('0xf')],_0x11b2e9[_0x8adfad][_0xec8e('0x47')]);}else{manager[_0xec8e('0x53')](_0x8adfad);manager[_0xec8e('0x4d')](_0x8adfad);logger[_0xec8e('0xa')](_0xec8e('0x4e'),_0x11b2e9[_0x8adfad][_0xec8e('0xf')],_0x11b2e9[_0x8adfad][_0xec8e('0x47')]);}}}})[_0xec8e('0x34')](function(_0x1d782a){logger[_0xec8e('0x26')](JSON[_0xec8e('0x27')](_0x1d782a));});}exports['run']=function(_0x55bd5e){return getJobs(_0x55bd5e);};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 992233e..79caaef 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 _0xc06d=['length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','update','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','push','all','SequelizeValidationError','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts'];(function(_0x2a0f44,_0x36e0b0){var _0x51d52c=function(_0x53aaa0){while(--_0x53aaa0){_0x2a0f44['push'](_0x2a0f44['shift']());}};_0x51d52c(++_0x36e0b0);}(_0xc06d,0x15a));var _0xdc06=function(_0x46a104,_0x2a47a2){_0x46a104=_0x46a104-0x0;var _0x3837ff=_0xc06d[_0x46a104];return _0x3837ff;};var _=require(_0xdc06('0x0'));var AWS=require(_0xdc06('0x1'));var rp=require(_0xdc06('0x2'));var util=require(_0xdc06('0x3'));var BPromise=require('bluebird');var db=require(_0xdc06('0x4'))['db'];var logger=require(_0xdc06('0x5'))('transcribe');function getTranscriptionJob(_0x50cf75,_0x374d2d,_0x47e159,_0x3d613b){return new Promise(function(_0x2f7692,_0x5ce60c){var _0x513a0f=new AWS[(_0xdc06('0x6'))]({'accessKeyId':_0x374d2d,'secretAccessKey':_0x50cf75,'region':_0x47e159});_0x513a0f[_0xdc06('0x7')]({'TranscriptionJobName':_0x3d613b},function(_0x52aa1f,_0x1216bf){if(_0x52aa1f){return _0x5ce60c(_0x52aa1f);}else{return _0x2f7692(_0x1216bf);}});});}function sentiment(_0x3d5ed3,_0x3ba5c4,_0x406ceb,_0x2ed1ff,_0x5d306b){return new Promise(function(_0x5e9082,_0x433450){var _0x5c508e=new AWS[(_0xdc06('0x8'))]({'accessKeyId':_0x3ba5c4,'secretAccessKey':_0x3d5ed3,'region':_0x406ceb});_0x5c508e[_0xdc06('0x9')]({'Text':_0x2ed1ff,'LanguageCode':_0x5d306b[_0xdc06('0xa')](0x0,0x2)},function(_0x233586,_0x14fa33){if(_0x233586){return _0x433450(_0x233586);}else{return _0x5e9082(_0x14fa33);}});});}function checkTranscribeJob(_0x3e4af2,_0x582ceb,_0x4b5f06){var _0xb9e716;return new BPromise(function(_0xb59b84,_0x13821f){logger['info'](util[_0xdc06('0xb')](_0xdc06('0xc'),_0x3e4af2['id'],_0x3e4af2[_0xdc06('0xd')]));return getTranscriptionJob(_0x4b5f06[_0xdc06('0xe')],_0x4b5f06[_0xdc06('0xf')],_0x582ceb['transcribeRegion'],_0x3e4af2[_0xdc06('0xd')])[_0xdc06('0x10')](function(_0x3aeca3){logger[_0xdc06('0x11')](util[_0xdc06('0xb')](_0xdc06('0x12'),_0x3e4af2['id'],_0x3e4af2[_0xdc06('0xd')],_0x3aeca3['TranscriptionJob'][_0xdc06('0x13')]));if(!_0x3e4af2[_0xdc06('0x14')]){switch(_0x3aeca3[_0xdc06('0x15')]['TranscriptionJobStatus']){case _0xdc06('0x16'):var _0x16508e={'transcribeStatus':_0x3aeca3[_0xdc06('0x15')][_0xdc06('0x13')],'fileUri':_0x3aeca3[_0xdc06('0x15')]['Transcript'][_0xdc06('0x17')]};logger['info'](util[_0xdc06('0xb')](_0xdc06('0x18'),_0x3e4af2['id']));return rp({'uri':_0x3aeca3[_0xdc06('0x15')][_0xdc06('0x19')][_0xdc06('0x17')],'json':!![]})['then'](function(_0x49444d){logger[_0xdc06('0x11')](util[_0xdc06('0xb')](_0xdc06('0x1a'),_0x3e4af2['id']));if(_0x49444d&&_0x49444d[_0xdc06('0x1b')]&&_0x49444d[_0xdc06('0x1b')][_0xdc06('0x1c')]&&_0x49444d['results']['transcripts']['length']){_0x16508e[_0xdc06('0x14')]='';for(var _0x4528ac=0x0;_0x4528ac<_0x49444d[_0xdc06('0x1b')][_0xdc06('0x1c')][_0xdc06('0x1d')];_0x4528ac++){_0x16508e[_0xdc06('0x14')]+=_0x49444d[_0xdc06('0x1b')]['transcripts'][_0x4528ac][_0xdc06('0x1e')]+'';}}return _0x3e4af2['update'](_0x16508e);})[_0xdc06('0x10')](function(){logger[_0xdc06('0x11')](util[_0xdc06('0xb')](_0xdc06('0x1f'),_0x3e4af2['id']));if(!_0x3e4af2[_0xdc06('0x20')]){throw new db[(_0xdc06('0x21'))][(_0xdc06('0x22'))](_0xdc06('0x23'));}if(!_0x582ceb[_0xdc06('0x24')]||!_0x582ceb[_0xdc06('0x25')]||!_0x582ceb[_0xdc06('0x26')]||!_0x582ceb[_0xdc06('0x27')]||!_0x582ceb[_0xdc06('0x28')]){throw new db[(_0xdc06('0x21'))]['ValidationError'](_0xdc06('0x29'));}if(!_0x16508e[_0xdc06('0x14')]){throw new Error(_0xdc06('0x2a'));}if(_0x582ceb[_0xdc06('0x25')]===_0x4b5f06['id']){return _0x4b5f06;}else{return db[_0xdc06('0x2b')]['findOne']({'where':{'id':_settings[_0xdc06('0x25')]}});}})[_0xdc06('0x10')](function(_0x2ca502){if(!_0x2ca502){throw new db[(_0xdc06('0x21'))][(_0xdc06('0x22'))](_0xdc06('0x2c'));}if(!_0x2ca502['data1']||!_0x2ca502[_0xdc06('0xf')]){throw new db['Sequelize'][(_0xdc06('0x22'))](_0xdc06('0x2d'));}_0xb9e716=_0x2ca502;logger[_0xdc06('0x11')](util[_0xdc06('0xb')](_0xdc06('0x2e'),_0x3e4af2['id']));return sentiment(_0xb9e716[_0xdc06('0xe')],_0xb9e716[_0xdc06('0xf')],_0x582ceb[_0xdc06('0x26')],_0x16508e[_0xdc06('0x14')],_0x582ceb[_0xdc06('0x27')]);})['then'](function(_0x5c57e0){logger[_0xdc06('0x11')](util[_0xdc06('0xb')](_0xdc06('0x2f'),_0x3e4af2['id']));return _0x3e4af2['update']({'sentiment':_0x5c57e0['Sentiment'],'sPositive':_0x5c57e0[_0xdc06('0x30')][_0xdc06('0x31')],'sNegative':_0x5c57e0[_0xdc06('0x30')][_0xdc06('0x32')],'sMixed':_0x5c57e0[_0xdc06('0x30')][_0xdc06('0x33')],'sNeutral':_0x5c57e0[_0xdc06('0x30')][_0xdc06('0x34')]});})['then'](function(){logger[_0xdc06('0x11')](util[_0xdc06('0xb')](_0xdc06('0x1f'),_0x3e4af2['id']));_0xb59b84();});case _0xdc06('0x35'):return _0x3e4af2[_0xdc06('0x36')]({'transcribeStatus':'FAILED','failureReason':_0x3aeca3['TranscriptionJob'][_0xdc06('0x37')]})[_0xdc06('0x10')](function(){logger[_0xdc06('0x11')](util[_0xdc06('0xb')](_0xdc06('0x1f'),_0x3e4af2['id']));_0xb59b84();});default:logger[_0xdc06('0x11')](util[_0xdc06('0xb')](_0xdc06('0x38'),_0x3e4af2['id']));break;}}else{return BPromise[_0xdc06('0x39')]()['then'](function(){if(!_0x3e4af2[_0xdc06('0x20')]){throw new db[(_0xdc06('0x21'))][(_0xdc06('0x22'))](_0xdc06('0x23'));}if(!_0x582ceb['sentiment']||!_0x582ceb[_0xdc06('0x25')]||!_0x582ceb[_0xdc06('0x26')]||!_0x582ceb[_0xdc06('0x27')]||!_0x582ceb[_0xdc06('0x28')]){throw new db[(_0xdc06('0x21'))]['ValidationError'](_0xdc06('0x29'));}if(!_0x3e4af2[_0xdc06('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x582ceb[_0xdc06('0x25')]===_0x4b5f06['id']){return _0x4b5f06;}else{return db[_0xdc06('0x2b')][_0xdc06('0x3a')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xdc06('0x10')](function(_0xafb982){if(!_0xafb982){throw new db[(_0xdc06('0x21'))][(_0xdc06('0x22'))](_0xdc06('0x2c'));}if(!_0xafb982[_0xdc06('0xe')]||!_0xafb982[_0xdc06('0xf')]){throw new db[(_0xdc06('0x21'))][(_0xdc06('0x22'))](_0xdc06('0x2d'));}_0xb9e716=_0xafb982;logger['info'](util[_0xdc06('0xb')](_0xdc06('0x2e'),_0x3e4af2['id']));return sentiment(_0xb9e716[_0xdc06('0xe')],_0xb9e716[_0xdc06('0xf')],_0x582ceb[_0xdc06('0x26')],_0x3e4af2['fileText'],_0x582ceb[_0xdc06('0x27')]);})[_0xdc06('0x10')](function(_0x5b32b6){logger['info'](util[_0xdc06('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3e4af2['id']));return _0x3e4af2[_0xdc06('0x36')]({'sentiment':_0x5b32b6['Sentiment'],'sPositive':_0x5b32b6[_0xdc06('0x30')]['Positive'],'sNegative':_0x5b32b6[_0xdc06('0x30')][_0xdc06('0x32')],'sMixed':_0x5b32b6[_0xdc06('0x30')][_0xdc06('0x33')],'sNeutral':_0x5b32b6[_0xdc06('0x30')][_0xdc06('0x34')],'transcribeStatus':_0xdc06('0x16')});})[_0xdc06('0x10')](function(){logger[_0xdc06('0x11')](util[_0xdc06('0xb')](_0xdc06('0x1f'),_0x3e4af2['id']));_0xb59b84();});}})[_0xdc06('0x3b')](function(_0x55624f){if(_0x55624f){if(!_0x55624f[_0xdc06('0x3c')]||_0x55624f['name']!=='SequelizeValidationError'){logger[_0xdc06('0x3d')](util[_0xdc06('0xb')](_0xdc06('0x3e'),_0x3e4af2['id']),util[_0xdc06('0x3f')](_0x55624f,{'showHidden':![],'depth':null}));}}_0xb59b84();});});}function checkTranscribe(){var _0x26ad38;var _0xcaa53b;var _0xe4a6e7;return db[_0xdc06('0x40')][_0xdc06('0x41')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xdc06('0x10')](function(_0x18abee){if(!_0x18abee||!_0x18abee[_0xdc06('0x1d')]){throw new db['Sequelize'][(_0xdc06('0x22'))](_0xdc06('0x42'));}_0x26ad38=_0x18abee;return db[_0xdc06('0x43')][_0xdc06('0x3a')]({'where':{'id':0x1}});})[_0xdc06('0x10')](function(_0xd52529){if(!_0xd52529){throw new db[(_0xdc06('0x21'))][(_0xdc06('0x22'))](_0xdc06('0x44'));}_0xcaa53b=_0xd52529;if(!_0xcaa53b['transcribe']||!_0xcaa53b[_0xdc06('0x45')]||!_0xcaa53b[_0xdc06('0x46')]||!_0xcaa53b[_0xdc06('0x27')]||!_0xcaa53b['bucket']){throw new db[(_0xdc06('0x21'))][(_0xdc06('0x22'))](_0xdc06('0x47'));}return db['CloudProvider'][_0xdc06('0x3a')]({'where':{'id':_0xcaa53b[_0xdc06('0x45')]}});})[_0xdc06('0x10')](function(_0x710623){if(!_0x710623){throw new db[(_0xdc06('0x21'))]['ValidationError'](_0xdc06('0x2c'));}if(!_0x710623['data1']||!_0x710623[_0xdc06('0xf')]){throw new db[(_0xdc06('0x21'))][(_0xdc06('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0xe4a6e7=_0x710623;var _0x15347b=[];_0x26ad38['forEach'](function(_0x45c18b){_0x15347b[_0xdc06('0x48')](checkTranscribeJob(_0x45c18b,_0xcaa53b,_0xe4a6e7));});return BPromise[_0xdc06('0x49')](_0x15347b);})['catch'](function(_0x5021f9){if(_0x5021f9){if(!_0x5021f9['name']||_0x5021f9['name']!==_0xdc06('0x4a')){logger[_0xdc06('0x3d')](util['inspect'](_0x5021f9,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2bb0=['Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','findOne','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','forEach','push','start','lodash','aws-sdk','request-promise','bluebird','transcribe','TranscribeService','Comprehend','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','format','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','Transcript\x20not\x20available'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x2bb0,0xf3));var _0x02bb=function(_0x4d4fac,_0x914a79){_0x4d4fac=_0x4d4fac-0x0;var _0x481115=_0x2bb0[_0x4d4fac];return _0x481115;};var _=require(_0x02bb('0x0'));var AWS=require(_0x02bb('0x1'));var rp=require(_0x02bb('0x2'));var util=require('util');var BPromise=require(_0x02bb('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x02bb('0x4'));function getTranscriptionJob(_0x500cd1,_0x1dff97,_0xe8fdaa,_0x8e4057){return new Promise(function(_0x390ff7,_0x43dbb7){var _0x16bb7c=new AWS[(_0x02bb('0x5'))]({'accessKeyId':_0x1dff97,'secretAccessKey':_0x500cd1,'region':_0xe8fdaa});_0x16bb7c['getTranscriptionJob']({'TranscriptionJobName':_0x8e4057},function(_0x6d064a,_0x15e425){if(_0x6d064a){return _0x43dbb7(_0x6d064a);}else{return _0x390ff7(_0x15e425);}});});}function sentiment(_0x23f816,_0x4c5124,_0x3d28d5,_0x5a4a7f,_0x3edabe){return new Promise(function(_0x1863ec,_0x4d3418){var _0x3f861e=new AWS[(_0x02bb('0x6'))]({'accessKeyId':_0x4c5124,'secretAccessKey':_0x23f816,'region':_0x3d28d5});_0x3f861e[_0x02bb('0x7')]({'Text':_0x5a4a7f,'LanguageCode':_0x3edabe['substring'](0x0,0x2)},function(_0x2de7a2,_0x4e409d){if(_0x2de7a2){return _0x4d3418(_0x2de7a2);}else{return _0x1863ec(_0x4e409d);}});});}function checkTranscribeJob(_0x3fa733,_0x294078,_0x1079f9){var _0x5c8728;return new BPromise(function(_0x16330c,_0x40c5d0){logger[_0x02bb('0x8')](util['format'](_0x02bb('0x9'),_0x3fa733['id'],_0x3fa733['transcribeName']));return getTranscriptionJob(_0x1079f9[_0x02bb('0xa')],_0x1079f9[_0x02bb('0xb')],_0x294078[_0x02bb('0xc')],_0x3fa733[_0x02bb('0xd')])[_0x02bb('0xe')](function(_0x224e90){logger['info'](util['format'](_0x02bb('0xf'),_0x3fa733['id'],_0x3fa733[_0x02bb('0xd')],_0x224e90[_0x02bb('0x10')][_0x02bb('0x11')]));if(!_0x3fa733[_0x02bb('0x12')]){switch(_0x224e90[_0x02bb('0x10')]['TranscriptionJobStatus']){case _0x02bb('0x13'):var _0x4b3f78={'transcribeStatus':_0x224e90[_0x02bb('0x10')][_0x02bb('0x11')],'fileUri':_0x224e90[_0x02bb('0x10')]['Transcript'][_0x02bb('0x14')]};logger[_0x02bb('0x8')](util[_0x02bb('0x15')]('[RECORDING:%d]\x20Get\x20transcript',_0x3fa733['id']));return rp({'uri':_0x224e90[_0x02bb('0x10')][_0x02bb('0x16')]['TranscriptFileUri'],'json':!![]})[_0x02bb('0xe')](function(_0x4b9b16){logger[_0x02bb('0x8')](util[_0x02bb('0x15')](_0x02bb('0x17'),_0x3fa733['id']));if(_0x4b9b16&&_0x4b9b16[_0x02bb('0x18')]&&_0x4b9b16[_0x02bb('0x18')][_0x02bb('0x19')]&&_0x4b9b16[_0x02bb('0x18')]['transcripts']['length']){_0x4b3f78[_0x02bb('0x12')]='';for(var _0x5ac511=0x0;_0x5ac511<_0x4b9b16[_0x02bb('0x18')][_0x02bb('0x19')][_0x02bb('0x1a')];_0x5ac511++){_0x4b3f78['fileText']+=_0x4b9b16[_0x02bb('0x18')][_0x02bb('0x19')][_0x5ac511]['transcript']+'';}}return _0x3fa733[_0x02bb('0x1b')](_0x4b3f78);})[_0x02bb('0xe')](function(){logger[_0x02bb('0x8')](util[_0x02bb('0x15')](_0x02bb('0x1c'),_0x3fa733['id']));if(!_0x3fa733[_0x02bb('0x1d')]){throw new db['Sequelize'][(_0x02bb('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x294078[_0x02bb('0x1f')]||!_0x294078[_0x02bb('0x20')]||!_0x294078[_0x02bb('0x21')]||!_0x294078['language']||!_0x294078[_0x02bb('0x22')]){throw new db[(_0x02bb('0x23'))][(_0x02bb('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4b3f78[_0x02bb('0x12')]){throw new Error(_0x02bb('0x24'));}if(_0x294078[_0x02bb('0x20')]===_0x1079f9['id']){return _0x1079f9;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x02bb('0x20')]}});}})['then'](function(_0x5a9014){if(!_0x5a9014){throw new db[(_0x02bb('0x23'))][(_0x02bb('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5a9014[_0x02bb('0xa')]||!_0x5a9014[_0x02bb('0xb')]){throw new db[(_0x02bb('0x23'))]['ValidationError'](_0x02bb('0x25'));}_0x5c8728=_0x5a9014;logger[_0x02bb('0x8')](util[_0x02bb('0x15')](_0x02bb('0x26'),_0x3fa733['id']));return sentiment(_0x5c8728[_0x02bb('0xa')],_0x5c8728[_0x02bb('0xb')],_0x294078[_0x02bb('0x21')],_0x4b3f78[_0x02bb('0x12')],_0x294078[_0x02bb('0x27')]);})[_0x02bb('0xe')](function(_0x5e1b7b){logger[_0x02bb('0x8')](util[_0x02bb('0x15')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3fa733['id']));return _0x3fa733[_0x02bb('0x1b')]({'sentiment':_0x5e1b7b[_0x02bb('0x28')],'sPositive':_0x5e1b7b[_0x02bb('0x29')][_0x02bb('0x2a')],'sNegative':_0x5e1b7b['SentimentScore'][_0x02bb('0x2b')],'sMixed':_0x5e1b7b['SentimentScore'][_0x02bb('0x2c')],'sNeutral':_0x5e1b7b[_0x02bb('0x29')][_0x02bb('0x2d')]});})[_0x02bb('0xe')](function(){logger[_0x02bb('0x8')](util[_0x02bb('0x15')](_0x02bb('0x1c'),_0x3fa733['id']));_0x16330c();});case'FAILED':return _0x3fa733[_0x02bb('0x1b')]({'transcribeStatus':_0x02bb('0x2e'),'failureReason':_0x224e90['TranscriptionJob'][_0x02bb('0x2f')]})[_0x02bb('0xe')](function(){logger[_0x02bb('0x8')](util[_0x02bb('0x15')](_0x02bb('0x1c'),_0x3fa733['id']));_0x16330c();});default:logger[_0x02bb('0x8')](util['format'](_0x02bb('0x30'),_0x3fa733['id']));break;}}else{return BPromise['resolve']()[_0x02bb('0xe')](function(){if(!_0x3fa733[_0x02bb('0x1d')]){throw new db[(_0x02bb('0x23'))][(_0x02bb('0x1e'))](_0x02bb('0x31'));}if(!_0x294078[_0x02bb('0x1f')]||!_0x294078[_0x02bb('0x20')]||!_0x294078[_0x02bb('0x21')]||!_0x294078[_0x02bb('0x27')]||!_0x294078['bucket']){throw new db[(_0x02bb('0x23'))][(_0x02bb('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3fa733[_0x02bb('0x12')]){throw new Error(_0x02bb('0x24'));}if(_0x294078['sentimentAccountId']===_0x1079f9['id']){return _0x1079f9;}else{return db['CloudProvider'][_0x02bb('0x32')]({'where':{'id':_settings[_0x02bb('0x20')]}});}})[_0x02bb('0xe')](function(_0x430f3a){if(!_0x430f3a){throw new db[(_0x02bb('0x23'))][(_0x02bb('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x430f3a[_0x02bb('0xa')]||!_0x430f3a['data2']){throw new db['Sequelize'][(_0x02bb('0x1e'))](_0x02bb('0x25'));}_0x5c8728=_0x430f3a;logger['info'](util[_0x02bb('0x15')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3fa733['id']));return sentiment(_0x5c8728[_0x02bb('0xa')],_0x5c8728[_0x02bb('0xb')],_0x294078[_0x02bb('0x21')],_0x3fa733['fileText'],_0x294078['language']);})['then'](function(_0x51a006){logger[_0x02bb('0x8')](util[_0x02bb('0x15')](_0x02bb('0x33'),_0x3fa733['id']));return _0x3fa733['update']({'sentiment':_0x51a006[_0x02bb('0x28')],'sPositive':_0x51a006[_0x02bb('0x29')][_0x02bb('0x2a')],'sNegative':_0x51a006['SentimentScore'][_0x02bb('0x2b')],'sMixed':_0x51a006[_0x02bb('0x29')][_0x02bb('0x2c')],'sNeutral':_0x51a006[_0x02bb('0x29')][_0x02bb('0x2d')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x02bb('0x8')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3fa733['id']));_0x16330c();});}})[_0x02bb('0x34')](function(_0x11236b){if(_0x11236b){if(!_0x11236b['name']||_0x11236b[_0x02bb('0x35')]!==_0x02bb('0x36')){logger[_0x02bb('0x37')](util['format'](_0x02bb('0x38'),_0x3fa733['id']),util[_0x02bb('0x39')](_0x11236b,{'showHidden':![],'depth':null}));}}_0x16330c();});});}function checkTranscribe(){var _0x3a6e48;var _0x1ed878;var _0x14b866;return db[_0x02bb('0x3a')][_0x02bb('0x3b')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x02bb('0xe')](function(_0x1c1070){if(!_0x1c1070||!_0x1c1070[_0x02bb('0x1a')]){throw new db[(_0x02bb('0x23'))]['ValidationError'](_0x02bb('0x3c'));}_0x3a6e48=_0x1c1070;return db[_0x02bb('0x3d')][_0x02bb('0x32')]({'where':{'id':0x1}});})[_0x02bb('0xe')](function(_0x1f3c06){if(!_0x1f3c06){throw new db[(_0x02bb('0x23'))][(_0x02bb('0x1e'))](_0x02bb('0x3e'));}_0x1ed878=_0x1f3c06;if(!_0x1ed878[_0x02bb('0x4')]||!_0x1ed878[_0x02bb('0x3f')]||!_0x1ed878[_0x02bb('0xc')]||!_0x1ed878['language']||!_0x1ed878[_0x02bb('0x22')]){throw new db['Sequelize'][(_0x02bb('0x1e'))](_0x02bb('0x40'));}return db[_0x02bb('0x41')][_0x02bb('0x32')]({'where':{'id':_0x1ed878[_0x02bb('0x3f')]}});})[_0x02bb('0xe')](function(_0x2ed640){if(!_0x2ed640){throw new db[(_0x02bb('0x23'))]['ValidationError'](_0x02bb('0x42'));}if(!_0x2ed640[_0x02bb('0xa')]||!_0x2ed640[_0x02bb('0xb')]){throw new db[(_0x02bb('0x23'))][(_0x02bb('0x1e'))](_0x02bb('0x25'));}_0x14b866=_0x2ed640;var _0x4f3de6=[];_0x3a6e48[_0x02bb('0x43')](function(_0x22ad38){_0x4f3de6[_0x02bb('0x44')](checkTranscribeJob(_0x22ad38,_0x1ed878,_0x14b866));});return BPromise['all'](_0x4f3de6);})[_0x02bb('0x34')](function(_0x59df6e){if(_0x59df6e){if(!_0x59df6e[_0x02bb('0x35')]||_0x59df6e[_0x02bb('0x35')]!==_0x02bb('0x36')){logger[_0x02bb('0x37')](util[_0x02bb('0x39')](_0x59df6e,{'showHidden':![],'depth':null}));}}});}exports[_0x02bb('0x45')]=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 0e33191..21c8ce2 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 _0xb02d=['subtract','hours','then','length','map','info','join','update','system','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../logger','redis','defaults','findAll','lastMsgAt'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xb02d,0x188));var _0xdb02=function(_0x53f536,_0x370010){_0x53f536=_0x53f536-0x0;var _0x40a951=_0xb02d[_0x53f536];return _0x40a951;};'use strict';var _=require('lodash');var moment=require(_0xdb02('0x0'));var Redis=require(_0xdb02('0x1'));var util=require(_0xdb02('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xdb02('0x3'))('schedule');config[_0xdb02('0x4')]=_[_0xdb02('0x5')](config[_0xdb02('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x3e6fcb=[];return db['WhatsappInteraction'][_0xdb02('0x6')]({'raw':!![],'attributes':['id',_0xdb02('0x7')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xdb02('0x8')](0x18,_0xdb02('0x9'))}}})[_0xdb02('0xa')](function(_0x596157){if(_0x596157&&_0x596157[_0xdb02('0xb')]){_0x3e6fcb=_[_0xdb02('0xc')](_0x596157||[],'id');logger[_0xdb02('0xd')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x3e6fcb[_0xdb02('0xe')]());return db['WhatsappInteraction'][_0xdb02('0xf')]({'closeReason':_0xdb02('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xdb02('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3e6fcb}});}})[_0xdb02('0xa')](function(){if(_0x3e6fcb&&_0x3e6fcb[_0xdb02('0xb')]){logger['info'](_0xdb02('0x12'),_0x3e6fcb[_0xdb02('0xe')]());for(var _0x3f7c33=0x0;_0x3f7c33<_0x3e6fcb[_0xdb02('0xb')];_0x3f7c33++){io[_0xdb02('0x13')](_0xdb02('0x14'),{'id':_0x3e6fcb[_0x3f7c33],'closed':!![]});}}})[_0xdb02('0x15')](function(_0xced80d){logger['error'](_0xdb02('0x16'),_0xced80d?util[_0xdb02('0x17')](_0xced80d,{'showHidden':![],'depth':null}):'');});}exports[_0xdb02('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd0af=['YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','moment','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','length','info','update','system','timeout'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xd0af,0x87));var _0xfd0a=function(_0x5f0f2c,_0x9817bf){_0x5f0f2c=_0x5f0f2c-0x0;var _0x104e69=_0xd0af[_0x5f0f2c];return _0x104e69;};'use strict';var _=require('lodash');var moment=require(_0xfd0a('0x0'));var Redis=require('ioredis');var util=require(_0xfd0a('0x1'));var config=require('../../config/environment');var db=require(_0xfd0a('0x2'))['db'];var logger=require(_0xfd0a('0x3'))(_0xfd0a('0x4'));config[_0xfd0a('0x5')]=_[_0xfd0a('0x6')](config[_0xfd0a('0x5')],{'host':_0xfd0a('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfd0a('0x5')]));function closeInteractions(){var _0x4d77ca=[];return db[_0xfd0a('0x8')][_0xfd0a('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})['then'](function(_0x498610){if(_0x498610&&_0x498610[_0xfd0a('0xa')]){_0x4d77ca=_['map'](_0x498610||[],'id');logger[_0xfd0a('0xb')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4d77ca['join']());return db['WhatsappInteraction'][_0xfd0a('0xc')]({'closeReason':_0xfd0a('0xd'),'disposition':_0xfd0a('0xe'),'closed':!![],'closedAt':moment()['format'](_0xfd0a('0xf'))},{'where':{'id':_0x4d77ca}});}})[_0xfd0a('0x10')](function(){if(_0x4d77ca&&_0x4d77ca['length']){logger[_0xfd0a('0xb')](_0xfd0a('0x11'),_0x4d77ca[_0xfd0a('0x12')]());for(var _0x57e7cb=0x0;_0x57e7cb<_0x4d77ca[_0xfd0a('0xa')];_0x57e7cb++){io[_0xfd0a('0x13')](_0xfd0a('0x14'),{'id':_0x4d77ca[_0x57e7cb],'closed':!![]});}}})[_0xfd0a('0x15')](function(_0x52b07c){logger[_0xfd0a('0x16')](_0xfd0a('0x17'),_0x52b07c?util[_0xfd0a('0x18')](_0x52b07c,{'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 a3310c6..e2ba06b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe75d=['contacts2','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','then','CmContact','bulkCreate','log','finished\x20populating','CmHopper','hopper1'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xe75d,0x111));var _0xde75=function(_0x27b0c5,_0x25915c){_0x27b0c5=_0x27b0c5-0x0;var _0x27cbe9=_0xe75d[_0x27b0c5];return _0x27cbe9;};'use strict';var util=require(_0xde75('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xde75('0x1')]({'id':i,'firstName':_0xde75('0x2')+i,'lastName':_0xde75('0x3')+i,'phone':0xf879fb460+i,'email':_0xde75('0x4')+i+_0xde75('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xde75('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xde75('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xde75('0x3')+i,'phone':0xf879fb460+i,'email':_0xde75('0x4')+i+_0xde75('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xde75('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xde75('0x6')](),'updatedAt':Date['now']()});}db['CmContact'][_0xde75('0x7')]({'where':{}})[_0xde75('0x8')](function(){return db[_0xde75('0x9')][_0xde75('0xa')](contacts);})['then'](function(){console[_0xde75('0xb')](_0xde75('0xc'),'contacts1');return db[_0xde75('0xd')][_0xde75('0x7')]({'where':{}});})[_0xde75('0x8')](function(){return db[_0xde75('0xd')][_0xde75('0xa')](hopper);})['then'](function(){console[_0xde75('0xb')]('finished\x20populating',_0xde75('0xe'));return db['CmContact']['bulkCreate'](contacts2);})[_0xde75('0x8')](function(){console[_0xde75('0xb')](_0xde75('0xc'),_0xde75('0xf'));return db[_0xde75('0xd')]['bulkCreate'](hopper2);})[_0xde75('0x8')](function(){console[_0xde75('0xb')](_0xde75('0xc'),_0xde75('0x10'));})[_0xde75('0x11')](function(_0x36593d){console[_0xde75('0xb')](_0x36593d);}); \ No newline at end of file +var _0x5880=['then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x5880,0x186));var _0x0588=function(_0x4fcf0d,_0x1435ec){_0x4fcf0d=_0x4fcf0d-0x0;var _0x5ade91=_0x5880[_0x4fcf0d];return _0x5ade91;};'use strict';var util=require(_0x0588('0x0'));var db=require(_0x0588('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x0588('0x2')]({'id':i,'firstName':_0x0588('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x0588('0x4')+i+_0x0588('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0588('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x0588('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0588('0x6')](),'updatedAt':Date[_0x0588('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x0588('0x2')]({'id':i,'firstName':_0x0588('0x3')+i,'lastName':_0x0588('0x7')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x0588('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0588('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x0588('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0588('0x6')](),'updatedAt':Date['now']()});}db[_0x0588('0x8')][_0x0588('0x9')]({'where':{}})[_0x0588('0xa')](function(){return db[_0x0588('0x8')][_0x0588('0xb')](contacts);})['then'](function(){console[_0x0588('0xc')](_0x0588('0xd'),_0x0588('0xe'));return db[_0x0588('0xf')][_0x0588('0x9')]({'where':{}});})[_0x0588('0xa')](function(){return db['CmHopper'][_0x0588('0xb')](hopper);})[_0x0588('0xa')](function(){console[_0x0588('0xc')](_0x0588('0xd'),_0x0588('0x10'));return db[_0x0588('0x8')][_0x0588('0xb')](contacts2);})['then'](function(){console[_0x0588('0xc')](_0x0588('0xd'),_0x0588('0x11'));return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console[_0x0588('0xc')]('finished\x20populating',_0x0588('0x12'));})[_0x0588('0x13')](function(_0x5bac4a){console['log'](_0x5bac4a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index d4eea1f..08d84f4 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37dd=['format','agent','%s%s','%s%s@xcally.com','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch','log','../mysqldb'];(function(_0x2f15c5,_0x339a97){var _0x1fcff1=function(_0x49e389){while(--_0x49e389){_0x2f15c5['push'](_0x2f15c5['shift']());}};_0x1fcff1(++_0x339a97);}(_0x37dd,0x1e2));var _0xd37d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x37dd[_0x2dafbe];return _0x58a45a;};'use strict';var util=require('util');var db=require(_0xd37d('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xd37d('0x1')]('%s%s',_0xd37d('0x2'),i),'fullname':util['format'](_0xd37d('0x3'),_0xd37d('0x2'),i),'email':util['format'](_0xd37d('0x4'),_0xd37d('0x2'),i),'role':_0xd37d('0x2'),'password':'password','internal':0xfa0+i,'type':_0xd37d('0x5'),'transport':[_0xd37d('0x6'),'ws',_0xd37d('0x7')],'disallow':[_0xd37d('0x8')],'allow':[_0xd37d('0x9')],'defaultuser':util[_0xd37d('0x1')](_0xd37d('0x3'),_0xd37d('0x2'),i),'encryption':_0xd37d('0xa'),'avpf':_0xd37d('0xa'),'force_avp':_0xd37d('0xa'),'icesupport':_0xd37d('0xa'),'dtlsenable':_0xd37d('0xa'),'dtlsverify':'no','dtlscertfile':_0xd37d('0xb'),'dtlsprivatekey':_0xd37d('0xc'),'dtlssetup':_0xd37d('0xd'),'callerid':util[_0xd37d('0x1')](_0xd37d('0xe'),util[_0xd37d('0x1')]('%s%s','agent',i),0xfa0+i)});}db[_0xd37d('0xf')][_0xd37d('0x10')](users)[_0xd37d('0x11')](function(){console['log'](_0xd37d('0x12'));})[_0xd37d('0x13')](function(_0x298980){console[_0xd37d('0x14')](_0x298980);}); \ No newline at end of file +var _0x007b=['catch','format','agent','%s%s@xcally.com','password','friend','all','ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x007b,0xbf));var _0xb007=function(_0x8df1b4,_0x25686e){_0x8df1b4=_0x8df1b4-0x0;var _0x425ac7=_0x007b[_0x8df1b4];return _0x425ac7;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s','agent',i),'fullname':util[_0xb007('0x0')]('%s%s',_0xb007('0x1'),i),'email':util['format'](_0xb007('0x2'),_0xb007('0x1'),i),'role':_0xb007('0x1'),'password':_0xb007('0x3'),'internal':0xfa0+i,'type':_0xb007('0x4'),'transport':['udp','ws','wss'],'disallow':[_0xb007('0x5')],'allow':[_0xb007('0x6')],'defaultuser':util[_0xb007('0x0')](_0xb007('0x7'),_0xb007('0x1'),i),'encryption':_0xb007('0x8'),'avpf':_0xb007('0x8'),'force_avp':_0xb007('0x8'),'icesupport':'yes','dtlsenable':_0xb007('0x8'),'dtlsverify':'no','dtlscertfile':_0xb007('0x9'),'dtlsprivatekey':_0xb007('0xa'),'dtlssetup':_0xb007('0xb'),'callerid':util['format'](_0xb007('0xc'),util['format'](_0xb007('0x7'),'agent',i),0xfa0+i)});}db[_0xb007('0xd')][_0xb007('0xe')](users)[_0xb007('0xf')](function(){console[_0xb007('0x10')](_0xb007('0x11'));})[_0xb007('0x12')](function(_0x456c15){console['log'](_0x456c15);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index e74ba82..2bc35c0 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4813=['campaign:%s:%s','emit','user_has_chat_interactions:remove','leave','user_has_mail_interactions:remove','removeFaxInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','name','Agents','role','agent','telephone','type','UserProfileSection','findOne','then','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','UserProfileResource','map','resourceId','User','where','Campaign','ivr','%s:queue:%s','format','user:%s','query','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:outbound','hasOwnProperty','include','push','FaxQueue','MailQueue','user','voice:inbound','VoiceQueues','VoiceQueue','ChatQueue','SmsQueue','OpenchannelQueue','WhatsappQueues','WhatsappQueue','Trunk','getVoiceQueues','getChatQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','chat','fax','sms','mail','openchannel','telephone:%s'];(function(_0x363d9c,_0x40fd02){var _0x1d1c0c=function(_0x5773c3){while(--_0x5773c3){_0x363d9c['push'](_0x363d9c['shift']());}};_0x1d1c0c(++_0x40fd02);}(_0x4813,0xdc));var _0x3481=function(_0x34e250,_0x513da5){_0x34e250=_0x34e250-0x0;var _0x229bfa=_0x4813[_0x34e250];return _0x229bfa;};'use strict';var _=require(_0x3481('0x0'));var util=require('util');var BPromise=require(_0x3481('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x3481('0x2')],'include':[{'as':_0x3481('0x3'),'model':db['User'],'attributes':['id',_0x3481('0x2'),_0x3481('0x4')],'raw':!![],'where':{'role':_0x3481('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3481('0x2')],'where':{'role':_0x3481('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x3481('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0x3481('0x2')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x3481('0x7')],'where':{'type':'ivr'}};function getAssociatedResources(_0x17e61e,_0x216ad0,_0x39b6c4){return db[_0x3481('0x8')][_0x3481('0x9')]({'where':{'name':_0x17e61e,'userProfileId':_0x216ad0},'raw':!![]})[_0x3481('0xa')](function(_0xf24905){if(_0xf24905){if(_0xf24905['autoAssociation']){switch(_0x17e61e){case'VoiceQueues':case _0x3481('0xb'):case _0x3481('0xc'):case _0x3481('0xd'):case _0x3481('0xe'):case _0x3481('0xf'):case'WhatsappQueues':return db[_0x39b6c4][_0x3481('0x10')](queryQueues);case _0x3481('0x11'):return db[_0x39b6c4][_0x3481('0x10')](queryTelephones);case _0x3481('0x12'):return db[_0x39b6c4][_0x3481('0x10')](queryTrunks);case'IvrCampaigns':return db[_0x39b6c4]['findAll'](queryCampaigns);}}else{return db[_0x3481('0x13')][_0x3481('0x10')]({'attributes':['resourceId'],'where':{'sectionId':_0xf24905['id']},'raw':!![]})[_0x3481('0xa')](function(_0x1204a1){if(_0x1204a1){var _0x17b17a={'where':{'id':_[_0x3481('0x14')](_0x1204a1,_0x3481('0x15'))},'raw':!![]};switch(_0x39b6c4){case _0x3481('0x16'):_0x17b17a[_0x3481('0x17')]['role']=_0x3481('0x6');break;case _0x3481('0x18'):_0x17b17a[_0x3481('0x17')][_0x3481('0x7')]=_0x3481('0x19');break;}return db[_0x39b6c4][_0x3481('0x10')](_0x17b17a);}else{return[];}});}}else{return[];}})[_0x3481('0xa')](function(_0x3101ba){return _0x3101ba;});}function joinOrLeaveQueues(_0x4fc770,_0x85609f,_0x525ed1,_0x1f882f){_0x4fc770[_0x85609f](util['format'](_0x3481('0x1a'),_0x525ed1,_0x1f882f[_0x3481('0x2')]));if(_0x1f882f[_0x3481('0x3')]){for(var _0x3ead0c=0x0;_0x3ead0c<_0x1f882f[_0x3481('0x3')]['length'];_0x3ead0c+=0x1){_0x4fc770[_0x85609f](util[_0x3481('0x1b')](_0x3481('0x1c'),_0x1f882f[_0x3481('0x3')][_0x3ead0c][_0x3481('0x2')]));}}}function joinOrLeave(_0x2c5777,_0x504a12,_0x2e620f){var _0x3ef2c2;if(_0x2c5777['handshake'][_0x3481('0x1d')]['id']){db[_0x3481('0x16')]['find']({'attributes':['id',_0x3481('0x2'),_0x3481('0x4'),_0x3481('0x1e')],'where':{'id':_0x2c5777[_0x3481('0x1f')][_0x3481('0x1d')]['id']},'include':[{'model':db[_0x3481('0x20')],'as':_0x3481('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x3481('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x3481('0x23')],'as':_0x3481('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x3481('0x25')],'as':_0x3481('0x26'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x3481('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x3481('0x28')],'as':_0x3481('0x29'),'attributes':['id'],'raw':!![]}]})[_0x3481('0xa')](function(_0x12e5d6){if(_0x12e5d6){_0x3ef2c2=_0x12e5d6;_0x2c5777[_0x504a12](util[_0x3481('0x1b')]('user:%s',_0x12e5d6[_0x3481('0x2')]));var _0x249760=[];switch(_0x12e5d6[_0x3481('0x4')]){case'admin':_0x2c5777[_0x504a12]('voice:inbound');_0x2c5777[_0x504a12](_0x3481('0x2a'));if(queryQueues[_0x3481('0x2b')](_0x3481('0x2c'))){delete queryQueues[_0x3481('0x2c')];}_0x249760[_0x3481('0x2d')](db['VoiceQueue'][_0x3481('0x10')](queryQueues));_0x249760[_0x3481('0x2d')](db['ChatQueue'][_0x3481('0x10')](queryQueues));_0x249760[_0x3481('0x2d')](db[_0x3481('0x2e')]['findAll'](queryQueues));_0x249760['push'](db['SmsQueue'][_0x3481('0x10')](queryQueues));_0x249760[_0x3481('0x2d')](db[_0x3481('0x2f')]['findAll'](queryQueues));_0x249760['push'](db['OpenchannelQueue'][_0x3481('0x10')](queryQueues));_0x249760['push'](db['WhatsappQueue'][_0x3481('0x10')](queryQueues));_0x249760[_0x3481('0x2d')](db[_0x3481('0x16')][_0x3481('0x10')](queryTelephones));_0x249760[_0x3481('0x2d')](db['Trunk']['findAll'](queryTrunks));_0x249760[_0x3481('0x2d')](db[_0x3481('0x18')][_0x3481('0x10')](queryCampaigns));_0x249760['push'](db['User']['findAll'](queryAgents));break;case _0x3481('0x30'):_0x2c5777[_0x504a12](_0x3481('0x31'));_0x2c5777[_0x504a12](_0x3481('0x2a'));_0x249760['push'](getAssociatedResources(_0x3481('0x32'),_0x12e5d6['userProfileId'],_0x3481('0x33')));_0x249760[_0x3481('0x2d')](getAssociatedResources(_0x3481('0xb'),_0x12e5d6['userProfileId'],_0x3481('0x34')));_0x249760['push'](getAssociatedResources(_0x3481('0xc'),_0x12e5d6[_0x3481('0x1e')],_0x3481('0x2e')));_0x249760[_0x3481('0x2d')](getAssociatedResources('SmsQueues',_0x12e5d6[_0x3481('0x1e')],_0x3481('0x35')));_0x249760['push'](getAssociatedResources('MailQueues',_0x12e5d6[_0x3481('0x1e')],_0x3481('0x2f')));_0x249760[_0x3481('0x2d')](getAssociatedResources(_0x3481('0xf'),_0x12e5d6[_0x3481('0x1e')],_0x3481('0x36')));_0x249760[_0x3481('0x2d')](getAssociatedResources(_0x3481('0x37'),_0x12e5d6[_0x3481('0x1e')],_0x3481('0x38')));_0x249760[_0x3481('0x2d')](getAssociatedResources('Telephones',_0x12e5d6[_0x3481('0x1e')],'User'));_0x249760[_0x3481('0x2d')](getAssociatedResources('Trunks',_0x12e5d6[_0x3481('0x1e')],_0x3481('0x39')));_0x249760[_0x3481('0x2d')](getAssociatedResources('IvrCampaigns',_0x12e5d6[_0x3481('0x1e')],_0x3481('0x18')));_0x249760[_0x3481('0x2d')](db[_0x3481('0x16')]['findAll'](queryAgents));break;case _0x3481('0x5'):_0x2c5777[_0x504a12](_0x3481('0x31'));_0x2c5777[_0x504a12]('voice:outbound');_0x249760['push'](_0x12e5d6[_0x3481('0x3a')]({'attributes':['id',_0x3481('0x2')]}));_0x249760[_0x3481('0x2d')](_0x12e5d6[_0x3481('0x3b')]({'attributes':['id','name']}));_0x249760[_0x3481('0x2d')](_0x12e5d6['getFaxQueues']({'attributes':['id',_0x3481('0x2')]}));_0x249760['push'](_0x12e5d6['getSmsQueues']({'attributes':['id',_0x3481('0x2')]}));_0x249760['push'](_0x12e5d6[_0x3481('0x3c')]({'attributes':['id',_0x3481('0x2')]}));_0x249760[_0x3481('0x2d')](_0x12e5d6[_0x3481('0x3d')]({'attributes':['id',_0x3481('0x2')]}));_0x249760['push'](_0x12e5d6[_0x3481('0x3e')]({'attributes':['id',_0x3481('0x2')]}));break;}return BPromise[_0x3481('0x3f')](_0x249760);}})[_0x3481('0xa')](function(_0x18e25b){if(_0x18e25b&&_0x18e25b['length']){for(var _0x8a5590=0x0;_0x8a5590<_0x18e25b['length'];_0x8a5590+=0x1){for(var _0x44485e=0x0;_0x44485e<_0x18e25b[_0x8a5590][_0x3481('0x40')];_0x44485e+=0x1){switch(_0x8a5590){case 0x0:joinOrLeaveQueues(_0x2c5777,_0x504a12,'voice',_0x18e25b[_0x8a5590][_0x44485e]);break;case 0x1:joinOrLeaveQueues(_0x2c5777,_0x504a12,_0x3481('0x41'),_0x18e25b[_0x8a5590][_0x44485e]);break;case 0x2:joinOrLeaveQueues(_0x2c5777,_0x504a12,_0x3481('0x42'),_0x18e25b[_0x8a5590][_0x44485e]);break;case 0x3:joinOrLeaveQueues(_0x2c5777,_0x504a12,_0x3481('0x43'),_0x18e25b[_0x8a5590][_0x44485e]);break;case 0x4:joinOrLeaveQueues(_0x2c5777,_0x504a12,_0x3481('0x44'),_0x18e25b[_0x8a5590][_0x44485e]);break;case 0x5:joinOrLeaveQueues(_0x2c5777,_0x504a12,_0x3481('0x45'),_0x18e25b[_0x8a5590][_0x44485e]);break;case 0x6:joinOrLeaveQueues(_0x2c5777,_0x504a12,'whatsapp',_0x18e25b[_0x8a5590][_0x44485e]);break;case 0x7:if(_0x3ef2c2[_0x3481('0x4')]!==_0x3481('0x5'))_0x2c5777[_0x504a12](util[_0x3481('0x1b')](_0x3481('0x46'),_0x18e25b[_0x8a5590][_0x44485e][_0x3481('0x2')]));break;case 0x8:if(_0x3ef2c2[_0x3481('0x4')]!=='agent')_0x2c5777[_0x504a12](util[_0x3481('0x1b')]('trunk:%s',_0x18e25b[_0x8a5590][_0x44485e]['name']));break;case 0x9:if(_0x3ef2c2['role']!=='agent')_0x2c5777[_0x504a12](util[_0x3481('0x1b')](_0x3481('0x47'),_0x18e25b[_0x8a5590][_0x44485e][_0x3481('0x7')],_0x18e25b[_0x8a5590][_0x44485e][_0x3481('0x2')]));break;case 0xa:_0x2c5777[_0x504a12](util[_0x3481('0x1b')]('user:%s',_0x18e25b[_0x8a5590][_0x44485e]['name']));break;}}}}})[_0x3481('0xa')](function(){if(_0x504a12==='leave'){var _0x3a5dd1=_['map'](_0x3ef2c2[_0x3481('0x21')],'id');return _0x3ef2c2['removeChatInteractions'](_0x3a5dd1)[_0x3481('0xa')](function(){for(var _0x207240=0x0;_0x207240<_0x3a5dd1[_0x3481('0x40')];_0x207240+=0x1){_0x2e620f[_0x3481('0x48')](_0x3481('0x49'),{'ChatInteractionId':Number(_0x3a5dd1[_0x207240]),'UserId':Number(_0x3ef2c2['id'])});}});}})['then'](function(){if(_0x504a12===_0x3481('0x4a')){var _0x1bad36=_[_0x3481('0x14')](_0x3ef2c2[_0x3481('0x22')],'id');return _0x3ef2c2['removeMailInteractions'](_0x1bad36)['then'](function(){for(var _0x114024=0x0;_0x114024<_0x1bad36[_0x3481('0x40')];_0x114024+=0x1){_0x2e620f[_0x3481('0x48')](_0x3481('0x4b'),{'MailInteractionId':Number(_0x1bad36[_0x114024]),'UserId':Number(_0x3ef2c2['id'])});}});}})[_0x3481('0xa')](function(){if(_0x504a12===_0x3481('0x4a')){var _0x20d9f7=_['map'](_0x3ef2c2[_0x3481('0x24')],'id');return _0x3ef2c2[_0x3481('0x4c')](_0x20d9f7)[_0x3481('0xa')](function(){for(var _0x32db7e=0x0;_0x32db7e<_0x20d9f7[_0x3481('0x40')];_0x32db7e+=0x1){_0x2e620f[_0x3481('0x48')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x20d9f7[_0x32db7e]),'UserId':Number(_0x3ef2c2['id'])});}});}})[_0x3481('0xa')](function(){if(_0x504a12==='leave'){var _0x4b105f=_['map'](_0x3ef2c2[_0x3481('0x26')],'id');return _0x3ef2c2['removeSmsInteractions'](_0x4b105f)[_0x3481('0xa')](function(){for(var _0x3f381d=0x0;_0x3f381d<_0x4b105f[_0x3481('0x40')];_0x3f381d+=0x1){_0x2e620f[_0x3481('0x48')](_0x3481('0x4d'),{'SmsInteractionId':Number(_0x4b105f[_0x3f381d]),'UserId':Number(_0x3ef2c2['id'])});}});}})[_0x3481('0xa')](function(){if(_0x504a12==='leave'){var _0x392101=_['map'](_0x3ef2c2[_0x3481('0x27')],'id');return _0x3ef2c2[_0x3481('0x4e')](_0x392101)[_0x3481('0xa')](function(){for(var _0x165866=0x0;_0x165866<_0x392101[_0x3481('0x40')];_0x165866+=0x1){_0x2e620f['emit'](_0x3481('0x4f'),{'OpenchannelInteractionId':Number(_0x392101[_0x165866]),'UserId':Number(_0x3ef2c2['id'])});}});}})[_0x3481('0xa')](function(){if(_0x504a12===_0x3481('0x4a')){var _0x2765a2=_[_0x3481('0x14')](_0x3ef2c2[_0x3481('0x29')],'id');return _0x3ef2c2[_0x3481('0x50')](_0x2765a2)['then'](function(){for(var _0x3bfaa9=0x0;_0x3bfaa9<_0x2765a2[_0x3481('0x40')];_0x3bfaa9+=0x1){_0x2e620f[_0x3481('0x48')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2765a2[_0x3bfaa9]),'UserId':Number(_0x3ef2c2['id'])});}});}})[_0x3481('0x51')](function(_0x2e5c42){_0x2c5777[_0x3481('0x52')](_0x2e5c42);});}}function onDisconnect(_0x459491,_0x202304){joinOrLeave(_0x459491,_0x3481('0x4a'),_0x202304);}function onConnect(_0x537fdb){joinOrLeave(_0x537fdb,_0x3481('0x53'));}exports[_0x3481('0x54')]=function(_0x28bdf4){_0x28bdf4['on'](_0x3481('0x55'),function(_0x211254){_0x211254[_0x3481('0x56')](0x0);_0x211254[_0x3481('0x57')]=_0x211254[_0x3481('0x58')][_0x3481('0x55')][_0x3481('0x59')]+':'+_0x211254[_0x3481('0x58')][_0x3481('0x55')][_0x3481('0x5a')];_0x211254[_0x3481('0x5b')]=new Date();_0x211254[_0x3481('0x52')]=function(_0x2b1d99){console['log'](_0x3481('0x5c')+_0x211254[_0x3481('0x5d')][_0x3481('0x2')]+'['+_0x211254[_0x3481('0x57')]+']',_0x2b1d99);};_0x211254['on'](_0x3481('0x5e'),function(){onDisconnect(_0x211254,_0x28bdf4);_0x211254[_0x3481('0x52')](_0x3481('0x5f'));});onConnect(_0x211254);_0x211254['log'](_0x3481('0x60'));});}; \ No newline at end of file +var _0x69d4=['getChatQueues','getFaxQueues','getMailQueues','getWhatsappQueues','length','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','WhatsappInteractions','catch','join','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','../mysqldb','./environment','name','User','role','agent','telephone','ivr','then','VoiceQueues','ChatQueues','FaxQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','format','%s:queue:%s','Agents','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','SmsQueue','WhatsappQueue','Campaign','user','MailQueues','MailQueue','OpenchannelQueues','OpenchannelQueue','Trunk','getVoiceQueues'];(function(_0x3af80c,_0x2d436e){var _0x30db83=function(_0x22086d){while(--_0x22086d){_0x3af80c['push'](_0x3af80c['shift']());}};_0x30db83(++_0x2d436e);}(_0x69d4,0x83));var _0x469d=function(_0x680821,_0x23e67f){_0x680821=_0x680821-0x0;var _0x3f132c=_0x69d4[_0x680821];return _0x3f132c;};'use strict';var _=require(_0x469d('0x0'));var util=require(_0x469d('0x1'));var BPromise=require('bluebird');var db=require(_0x469d('0x2'))['db'];var config=require(_0x469d('0x3'));var queryQueues={'attributes':['id',_0x469d('0x4')],'include':[{'as':'Agents','model':db[_0x469d('0x5')],'attributes':['id','name',_0x469d('0x6')],'raw':!![],'where':{'role':_0x469d('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x469d('0x4')],'where':{'role':_0x469d('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x469d('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x469d('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x469d('0x4'),'type'],'where':{'type':_0x469d('0x9')}};function getAssociatedResources(_0x2598f1,_0x192648,_0x5f05c9){return db['UserProfileSection']['findOne']({'where':{'name':_0x2598f1,'userProfileId':_0x192648},'raw':!![]})[_0x469d('0xa')](function(_0x1c2d63){if(_0x1c2d63){if(_0x1c2d63['autoAssociation']){switch(_0x2598f1){case _0x469d('0xb'):case _0x469d('0xc'):case _0x469d('0xd'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case _0x469d('0xe'):return db[_0x5f05c9][_0x469d('0xf')](queryQueues);case _0x469d('0x10'):return db[_0x5f05c9][_0x469d('0xf')](queryTelephones);case _0x469d('0x11'):return db[_0x5f05c9][_0x469d('0xf')](queryTrunks);case _0x469d('0x12'):return db[_0x5f05c9]['findAll'](queryCampaigns);}}else{return db[_0x469d('0x13')][_0x469d('0xf')]({'attributes':[_0x469d('0x14')],'where':{'sectionId':_0x1c2d63['id']},'raw':!![]})[_0x469d('0xa')](function(_0x56ba9b){if(_0x56ba9b){var _0x384a2a={'where':{'id':_[_0x469d('0x15')](_0x56ba9b,_0x469d('0x14'))},'raw':!![]};switch(_0x5f05c9){case'User':_0x384a2a[_0x469d('0x16')][_0x469d('0x6')]=_0x469d('0x8');break;case'Campaign':_0x384a2a[_0x469d('0x16')]['type']='ivr';break;}return db[_0x5f05c9]['findAll'](_0x384a2a);}else{return[];}});}}else{return[];}})[_0x469d('0xa')](function(_0x47e41d){return _0x47e41d;});}function joinOrLeaveQueues(_0x26047a,_0x478fa4,_0xbd8b5,_0x38c3cc){_0x26047a[_0x478fa4](util[_0x469d('0x17')](_0x469d('0x18'),_0xbd8b5,_0x38c3cc['name']));if(_0x38c3cc[_0x469d('0x19')]){for(var _0x34fad0=0x0;_0x34fad0<_0x38c3cc[_0x469d('0x19')]['length'];_0x34fad0+=0x1){_0x26047a[_0x478fa4](util[_0x469d('0x17')](_0x469d('0x1a'),_0x38c3cc[_0x469d('0x19')][_0x34fad0]['name']));}}}function joinOrLeave(_0x1782d0,_0x586a74,_0x3df7e4){var _0x2206c4;if(_0x1782d0['handshake'][_0x469d('0x1b')]['id']){db[_0x469d('0x5')][_0x469d('0x1c')]({'attributes':['id',_0x469d('0x4'),_0x469d('0x6'),_0x469d('0x1d')],'where':{'id':_0x1782d0[_0x469d('0x1e')][_0x469d('0x1b')]['id']},'include':[{'model':db[_0x469d('0x1f')],'as':_0x469d('0x20'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x469d('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x469d('0x22')],'as':_0x469d('0x23'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x469d('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x469d('0x25')],'as':_0x469d('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x469d('0x27')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x3565f2){if(_0x3565f2){_0x2206c4=_0x3565f2;_0x1782d0[_0x586a74](util[_0x469d('0x17')](_0x469d('0x1a'),_0x3565f2[_0x469d('0x4')]));var _0x394c03=[];switch(_0x3565f2['role']){case _0x469d('0x28'):_0x1782d0[_0x586a74](_0x469d('0x29'));_0x1782d0[_0x586a74](_0x469d('0x2a'));if(queryQueues['hasOwnProperty'](_0x469d('0x2b'))){delete queryQueues[_0x469d('0x2b')];}_0x394c03[_0x469d('0x2c')](db[_0x469d('0x2d')][_0x469d('0xf')](queryQueues));_0x394c03[_0x469d('0x2c')](db[_0x469d('0x2e')]['findAll'](queryQueues));_0x394c03['push'](db['FaxQueue']['findAll'](queryQueues));_0x394c03[_0x469d('0x2c')](db[_0x469d('0x2f')][_0x469d('0xf')](queryQueues));_0x394c03[_0x469d('0x2c')](db['MailQueue'][_0x469d('0xf')](queryQueues));_0x394c03['push'](db['OpenchannelQueue'][_0x469d('0xf')](queryQueues));_0x394c03[_0x469d('0x2c')](db[_0x469d('0x30')][_0x469d('0xf')](queryQueues));_0x394c03[_0x469d('0x2c')](db[_0x469d('0x5')][_0x469d('0xf')](queryTelephones));_0x394c03['push'](db['Trunk'][_0x469d('0xf')](queryTrunks));_0x394c03['push'](db[_0x469d('0x31')][_0x469d('0xf')](queryCampaigns));_0x394c03[_0x469d('0x2c')](db['User']['findAll'](queryAgents));break;case _0x469d('0x32'):_0x1782d0[_0x586a74]('voice:inbound');_0x1782d0[_0x586a74](_0x469d('0x2a'));_0x394c03[_0x469d('0x2c')](getAssociatedResources(_0x469d('0xb'),_0x3565f2[_0x469d('0x1d')],_0x469d('0x2d')));_0x394c03[_0x469d('0x2c')](getAssociatedResources(_0x469d('0xc'),_0x3565f2[_0x469d('0x1d')],_0x469d('0x2e')));_0x394c03['push'](getAssociatedResources(_0x469d('0xd'),_0x3565f2[_0x469d('0x1d')],'FaxQueue'));_0x394c03[_0x469d('0x2c')](getAssociatedResources('SmsQueues',_0x3565f2[_0x469d('0x1d')],'SmsQueue'));_0x394c03[_0x469d('0x2c')](getAssociatedResources(_0x469d('0x33'),_0x3565f2[_0x469d('0x1d')],_0x469d('0x34')));_0x394c03['push'](getAssociatedResources(_0x469d('0x35'),_0x3565f2['userProfileId'],_0x469d('0x36')));_0x394c03[_0x469d('0x2c')](getAssociatedResources(_0x469d('0xe'),_0x3565f2[_0x469d('0x1d')],_0x469d('0x30')));_0x394c03[_0x469d('0x2c')](getAssociatedResources(_0x469d('0x10'),_0x3565f2[_0x469d('0x1d')],'User'));_0x394c03['push'](getAssociatedResources('Trunks',_0x3565f2[_0x469d('0x1d')],_0x469d('0x37')));_0x394c03[_0x469d('0x2c')](getAssociatedResources(_0x469d('0x12'),_0x3565f2[_0x469d('0x1d')],_0x469d('0x31')));_0x394c03[_0x469d('0x2c')](db['User'][_0x469d('0xf')](queryAgents));break;case'agent':_0x1782d0[_0x586a74](_0x469d('0x29'));_0x1782d0[_0x586a74](_0x469d('0x2a'));_0x394c03['push'](_0x3565f2[_0x469d('0x38')]({'attributes':['id','name']}));_0x394c03[_0x469d('0x2c')](_0x3565f2[_0x469d('0x39')]({'attributes':['id',_0x469d('0x4')]}));_0x394c03[_0x469d('0x2c')](_0x3565f2[_0x469d('0x3a')]({'attributes':['id',_0x469d('0x4')]}));_0x394c03[_0x469d('0x2c')](_0x3565f2['getSmsQueues']({'attributes':['id','name']}));_0x394c03[_0x469d('0x2c')](_0x3565f2[_0x469d('0x3b')]({'attributes':['id',_0x469d('0x4')]}));_0x394c03[_0x469d('0x2c')](_0x3565f2['getOpenchannelQueues']({'attributes':['id','name']}));_0x394c03[_0x469d('0x2c')](_0x3565f2[_0x469d('0x3c')]({'attributes':['id',_0x469d('0x4')]}));break;}return BPromise['all'](_0x394c03);}})[_0x469d('0xa')](function(_0x54033d){if(_0x54033d&&_0x54033d[_0x469d('0x3d')]){for(var _0x379d34=0x0;_0x379d34<_0x54033d[_0x469d('0x3d')];_0x379d34+=0x1){for(var _0x3b3834=0x0;_0x3b3834<_0x54033d[_0x379d34][_0x469d('0x3d')];_0x3b3834+=0x1){switch(_0x379d34){case 0x0:joinOrLeaveQueues(_0x1782d0,_0x586a74,_0x469d('0x3e'),_0x54033d[_0x379d34][_0x3b3834]);break;case 0x1:joinOrLeaveQueues(_0x1782d0,_0x586a74,_0x469d('0x3f'),_0x54033d[_0x379d34][_0x3b3834]);break;case 0x2:joinOrLeaveQueues(_0x1782d0,_0x586a74,_0x469d('0x40'),_0x54033d[_0x379d34][_0x3b3834]);break;case 0x3:joinOrLeaveQueues(_0x1782d0,_0x586a74,_0x469d('0x41'),_0x54033d[_0x379d34][_0x3b3834]);break;case 0x4:joinOrLeaveQueues(_0x1782d0,_0x586a74,_0x469d('0x42'),_0x54033d[_0x379d34][_0x3b3834]);break;case 0x5:joinOrLeaveQueues(_0x1782d0,_0x586a74,_0x469d('0x43'),_0x54033d[_0x379d34][_0x3b3834]);break;case 0x6:joinOrLeaveQueues(_0x1782d0,_0x586a74,_0x469d('0x44'),_0x54033d[_0x379d34][_0x3b3834]);break;case 0x7:if(_0x2206c4['role']!==_0x469d('0x7'))_0x1782d0[_0x586a74](util[_0x469d('0x17')]('telephone:%s',_0x54033d[_0x379d34][_0x3b3834][_0x469d('0x4')]));break;case 0x8:if(_0x2206c4[_0x469d('0x6')]!=='agent')_0x1782d0[_0x586a74](util['format'](_0x469d('0x45'),_0x54033d[_0x379d34][_0x3b3834]['name']));break;case 0x9:if(_0x2206c4[_0x469d('0x6')]!==_0x469d('0x7'))_0x1782d0[_0x586a74](util[_0x469d('0x17')](_0x469d('0x46'),_0x54033d[_0x379d34][_0x3b3834]['type'],_0x54033d[_0x379d34][_0x3b3834]['name']));break;case 0xa:_0x1782d0[_0x586a74](util['format']('user:%s',_0x54033d[_0x379d34][_0x3b3834][_0x469d('0x4')]));break;}}}}})[_0x469d('0xa')](function(){if(_0x586a74===_0x469d('0x47')){var _0x3d7f11=_[_0x469d('0x15')](_0x2206c4[_0x469d('0x20')],'id');return _0x2206c4[_0x469d('0x48')](_0x3d7f11)[_0x469d('0xa')](function(){for(var _0x5e0950=0x0;_0x5e0950<_0x3d7f11[_0x469d('0x3d')];_0x5e0950+=0x1){_0x3df7e4['emit'](_0x469d('0x49'),{'ChatInteractionId':Number(_0x3d7f11[_0x5e0950]),'UserId':Number(_0x2206c4['id'])});}});}})['then'](function(){if(_0x586a74===_0x469d('0x47')){var _0x38dcfe=_['map'](_0x2206c4['MailInteractions'],'id');return _0x2206c4[_0x469d('0x4a')](_0x38dcfe)[_0x469d('0xa')](function(){for(var _0x2df96a=0x0;_0x2df96a<_0x38dcfe['length'];_0x2df96a+=0x1){_0x3df7e4['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x38dcfe[_0x2df96a]),'UserId':Number(_0x2206c4['id'])});}});}})[_0x469d('0xa')](function(){if(_0x586a74==='leave'){var _0x52a8f3=_[_0x469d('0x15')](_0x2206c4[_0x469d('0x23')],'id');return _0x2206c4['removeFaxInteractions'](_0x52a8f3)[_0x469d('0xa')](function(){for(var _0x197cd4=0x0;_0x197cd4<_0x52a8f3[_0x469d('0x3d')];_0x197cd4+=0x1){_0x3df7e4[_0x469d('0x4b')](_0x469d('0x4c'),{'FaxInteractionId':Number(_0x52a8f3[_0x197cd4]),'UserId':Number(_0x2206c4['id'])});}});}})['then'](function(){if(_0x586a74===_0x469d('0x47')){var _0x53987a=_[_0x469d('0x15')](_0x2206c4[_0x469d('0x24')],'id');return _0x2206c4[_0x469d('0x4d')](_0x53987a)['then'](function(){for(var _0x327356=0x0;_0x327356<_0x53987a[_0x469d('0x3d')];_0x327356+=0x1){_0x3df7e4[_0x469d('0x4b')](_0x469d('0x4e'),{'SmsInteractionId':Number(_0x53987a[_0x327356]),'UserId':Number(_0x2206c4['id'])});}});}})[_0x469d('0xa')](function(){if(_0x586a74===_0x469d('0x47')){var _0xf09217=_[_0x469d('0x15')](_0x2206c4[_0x469d('0x26')],'id');return _0x2206c4[_0x469d('0x4f')](_0xf09217)[_0x469d('0xa')](function(){for(var _0x18dcd=0x0;_0x18dcd<_0xf09217[_0x469d('0x3d')];_0x18dcd+=0x1){_0x3df7e4['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0xf09217[_0x18dcd]),'UserId':Number(_0x2206c4['id'])});}});}})[_0x469d('0xa')](function(){if(_0x586a74===_0x469d('0x47')){var _0xa400c=_[_0x469d('0x15')](_0x2206c4[_0x469d('0x50')],'id');return _0x2206c4['removeWhatsappInteractions'](_0xa400c)[_0x469d('0xa')](function(){for(var _0x41e620=0x0;_0x41e620<_0xa400c[_0x469d('0x3d')];_0x41e620+=0x1){_0x3df7e4[_0x469d('0x4b')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0xa400c[_0x41e620]),'UserId':Number(_0x2206c4['id'])});}});}})[_0x469d('0x51')](function(_0x1538ef){_0x1782d0['log'](_0x1538ef);});}}function onDisconnect(_0x53b70d,_0x34153c){joinOrLeave(_0x53b70d,_0x469d('0x47'),_0x34153c);}function onConnect(_0x2704eb){joinOrLeave(_0x2704eb,_0x469d('0x52'));}exports['default']=function(_0x40060f){_0x40060f['on'](_0x469d('0x53'),function(_0x44576a){_0x44576a[_0x469d('0x54')](0x0);_0x44576a['address']=_0x44576a[_0x469d('0x55')]['connection'][_0x469d('0x56')]+':'+_0x44576a['request'][_0x469d('0x53')][_0x469d('0x57')];_0x44576a[_0x469d('0x58')]=new Date();_0x44576a[_0x469d('0x59')]=function(_0x31f39b){console[_0x469d('0x59')](_0x469d('0x5a')+_0x44576a[_0x469d('0x5b')][_0x469d('0x4')]+'['+_0x44576a['address']+']',_0x31f39b);};_0x44576a['on'](_0x469d('0x5c'),function(){onDisconnect(_0x44576a,_0x40060f);_0x44576a[_0x469d('0x59')](_0x469d('0x5d'));});onConnect(_0x44576a);_0x44576a['log']('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 66c9a65..6f5e127 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 _0xbe7a=['outgoingmessage','channel','motionChannel','event','offlineMessage','Sequelize','QueryTypes','AfterCreate','changed','closed','substatus','AfterUpdate','User','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','toLowerCase','condition','../logger','triggers','http','ChatInteraction','afterCreate','newinteraction','Chat','afterUpdate','closedinteraction','ChatMessage','ChatOfflineMessage','SmsInteraction','Sms','SmsMessage','newmessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','Trigger,\x20%s','code','error','catch','get','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','SELECT','contact','UserId','interface','format','SIP/%s','name','incomingmessage'];(function(_0x31327a,_0x4a6e24){var _0x4d1390=function(_0x38c788){while(--_0x38c788){_0x31327a['push'](_0x31327a['shift']());}};_0x4d1390(++_0x4a6e24);}(_0xbe7a,0xf3));var _0xabe7=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xbe7a[_0x2070da];return _0x4f9fe1;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require(_0xabe7('0x0'))(_0xabe7('0x1'));var client=jayson['client'][_0xabe7('0x2')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xabe7('0x3'),'event':_0xabe7('0x4'),'condition':_0xabe7('0x5'),'callback':afterCreate},{'channel':_0xabe7('0x6'),'model':'ChatInteraction','event':_0xabe7('0x7'),'condition':_0xabe7('0x8'),'callback':afterUpdate},{'channel':'Chat','model':_0xabe7('0x9'),'event':_0xabe7('0x4'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xabe7('0x6'),'model':_0xabe7('0xa'),'event':_0xabe7('0x4'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0xabe7('0xb'),'event':_0xabe7('0x4'),'condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0xabe7('0xb'),'event':_0xabe7('0x7'),'condition':_0xabe7('0x8'),'callback':afterUpdate},{'channel':_0xabe7('0xc'),'model':_0xabe7('0xd'),'event':_0xabe7('0x4'),'condition':_0xabe7('0xe'),'callback':afterCreateMessage},{'channel':_0xabe7('0xf'),'model':_0xabe7('0x10'),'event':_0xabe7('0x4'),'condition':_0xabe7('0x5'),'callback':afterCreate},{'channel':_0xabe7('0xf'),'model':_0xabe7('0x10'),'event':_0xabe7('0x7'),'condition':_0xabe7('0x8'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0xabe7('0x11'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0xabe7('0x12'),'event':'afterCreate','condition':_0xabe7('0x5'),'callback':afterCreate},{'channel':_0xabe7('0x13'),'model':'FaxInteraction','event':_0xabe7('0x7'),'condition':_0xabe7('0x8'),'callback':afterUpdate},{'channel':'Fax','model':_0xabe7('0x14'),'event':_0xabe7('0x4'),'condition':_0xabe7('0xe'),'callback':afterCreateMessage},{'channel':_0xabe7('0x15'),'model':_0xabe7('0x16'),'event':_0xabe7('0x4'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xabe7('0x15'),'model':'MailInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xabe7('0x15'),'model':_0xabe7('0x17'),'event':_0xabe7('0x4'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xabe7('0x18'),'model':_0xabe7('0x19'),'event':'afterCreate','condition':_0xabe7('0x5'),'callback':afterCreate},{'channel':'Openchannel','model':_0xabe7('0x19'),'event':_0xabe7('0x7'),'condition':_0xabe7('0x8'),'callback':afterUpdate},{'channel':_0xabe7('0x18'),'model':_0xabe7('0x1a'),'event':_0xabe7('0x4'),'condition':_0xabe7('0xe'),'callback':afterCreateMessage}];function request(_0x3acc36){return client[_0xabe7('0x1b')](_0xabe7('0x1c'),_0x3acc36)['then'](function(_0x274921){logger['info'](_0xabe7('0x1d'),_0xabe7('0x1c'),_0x274921);if(_0x274921['error']){if(_0x274921['error'][_0xabe7('0x1e')]===0x1f4){logger['error'](_0xabe7('0x1d'),'EventManager',_0x274921[_0xabe7('0x1f')]);}}})[_0xabe7('0x20')](function(_0x3101b){logger[_0xabe7('0x1f')](_0xabe7('0x1d'),_0xabe7('0x1c'),_0x3101b);});}function afterCreateMessage(_0x330ff5){return function(_0xe9c988){_0xe9c988=_0xe9c988[_0xabe7('0x21')]({'plain':!![]});_0xe9c988['channel']=_0x330ff5;_0xe9c988['motionChannel']=_0x330ff5;_0xe9c988['event']=_0xe9c988['direction'];Promise[_0xabe7('0x22')]()[_0xabe7('0x23')](function(){if(typeof _0xe9c988[_0xabe7('0x24')]===_0xabe7('0x25'))return null;var _0x2da1f4=_0xabe7('0x26')+_0xe9c988[_0xabe7('0x24')];return db[_0xabe7('0x27')][_0xabe7('0x28')](_0x2da1f4,{'type':db['Sequelize']['QueryTypes'][_0xabe7('0x29')],'raw':!![]});})[_0xabe7('0x23')](function(_0x392892){if(_0x392892){_0xe9c988[_0xabe7('0x2a')]=_0x392892[0x0];}if(typeof _0xe9c988['UserId']===_0xabe7('0x25'))return;return getAgent(_0xe9c988[_0xabe7('0x2b')]);})[_0xabe7('0x23')](function(_0x2e5629){if(_0x2e5629){_0xe9c988[_0xabe7('0x2c')]=util[_0xabe7('0x2d')](_0xabe7('0x2e'),_0x2e5629[_0xabe7('0x2f')]);_0xe9c988['agent']=_0x2e5629;_0xe9c988['channel']=_0x330ff5;return request({'event':_0xabe7('0x30'),'message':_0xe9c988});}else{return request({'event':_0xabe7('0x31'),'message':_0xe9c988});}})[_0xabe7('0x20')](function(_0x48f93b){logger[_0xabe7('0x1f')](_0xabe7('0x1d'),'AfterCreateMessage',_0x48f93b);});};}function afterCreateOfflineMessage(_0x3c4a4d){return function(_0x3bb689){_0x3bb689=_0x3bb689[_0xabe7('0x21')]({'plain':!![]});_0x3bb689[_0xabe7('0x32')]=_0x3c4a4d;_0x3bb689[_0xabe7('0x33')]=_0x3c4a4d;_0x3bb689[_0xabe7('0x34')]=_0xabe7('0x35');return request({'event':_0x3bb689[_0xabe7('0x34')],'message':_0x3bb689});};}function afterCreate(_0x287662,_0x2ebcb7){return function(_0x467811){_0x467811=_0x467811[_0xabe7('0x21')]({'plain':!![]});_0x467811['channel']=_0x287662;_0x467811['motionChannel']=_0x287662;_0x467811[_0xabe7('0x34')]='opened';Promise['resolve']()['then'](function(){var _0x545ece='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x467811[_0xabe7('0x24')];return db[_0xabe7('0x27')][_0xabe7('0x28')](_0x545ece,{'type':db[_0xabe7('0x36')][_0xabe7('0x37')][_0xabe7('0x29')],'raw':!![]});})[_0xabe7('0x23')](function(_0x11770c){if(_0x11770c){_0x467811[_0xabe7('0x2a')]=_0x11770c[0x0];}if(typeof _0x467811[_0xabe7('0x2b')]===_0xabe7('0x25'))return;return getAgent(_0x467811[_0xabe7('0x2b')]);})['then'](function(_0xc8f854){if(_0xc8f854){_0x467811[_0xabe7('0x2c')]=util['format']('SIP/%s',_0xc8f854['name']);_0x467811['agent']=_0xc8f854;}return request({'event':_0x2ebcb7,'message':_0x467811});})[_0xabe7('0x20')](function(_0x505fdd){logger[_0xabe7('0x1f')](_0xabe7('0x1d'),_0xabe7('0x38'),_0x505fdd);});};}function afterUpdate(_0x23eada){return function(_0x1025fc){var _0x4e4915=_0x1025fc[_0xabe7('0x39')](_0xabe7('0x3a'))&&_0x1025fc[_0xabe7('0x3a')];var _0x20f358=_0x1025fc['changed'](_0xabe7('0x3b'));if(_0x4e4915||_0x20f358){var _0x418d7c=_0x4e4915?_0xabe7('0x8'):_0xabe7('0x3b');var _0x7f6820=_0x1025fc['get']({'plain':!![]});_0x7f6820[_0xabe7('0x32')]=_0x23eada;_0x7f6820[_0xabe7('0x33')]=_0x23eada;_0x7f6820[_0xabe7('0x34')]=_0x4e4915?'closed':'substatus';var _0x2c9d06=_0xabe7('0x26')+_0x7f6820[_0xabe7('0x24')];return db[_0xabe7('0x27')][_0xabe7('0x28')](_0x2c9d06,{'type':db[_0xabe7('0x36')][_0xabe7('0x37')][_0xabe7('0x29')],'raw':!![]})[_0xabe7('0x23')](function(_0x392702){if(_0x392702){_0x7f6820['contact']=_0x392702[0x0];}if(typeof _0x7f6820[_0xabe7('0x2b')]===_0xabe7('0x25'))return;return getAgent(_0x7f6820[_0xabe7('0x2b')]);})['then'](function(_0x68cc7b){if(_0x68cc7b){_0x7f6820[_0xabe7('0x2c')]=util[_0xabe7('0x2d')]('SIP/%s',_0x68cc7b[_0xabe7('0x2f')]);_0x7f6820['agent']=_0x68cc7b;}return request({'event':_0x418d7c,'message':_0x7f6820});})[_0xabe7('0x20')](function(_0x565782){logger[_0xabe7('0x1f')](_0xabe7('0x1d'),_0xabe7('0x3c'),_0x565782);});}};}function getAgent(_0x213ddf){return db[_0xabe7('0x3d')][_0xabe7('0x3e')]({'where':{'id':_0x213ddf},'attributes':['id','name',_0xabe7('0x3f'),_0xabe7('0x40'),_0xabe7('0x41')],'raw':!![]})[_0xabe7('0x23')](function(_0x48b863){return _0x48b863;});}exports[_0xabe7('0x42')]=function(){for(var _0x5b4361=0x0;_0x5b4361=_0x32629f[_0xe952('0x12')]){throw Error(_0xe952('0x13'));}_0x3d2822(_0x48e1c4);})[_0xe952('0x14')](function(_0x5373bf){_0x53675e(_0x5373bf);});});}; \ No newline at end of file +var _0x38c9=['then','agents','catch','bluebird','../mysqldb','./license/util','mail','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','agent','count','getLicense'];(function(_0x8b98fc,_0x4b847c){var _0x6d10e6=function(_0x5c72eb){while(--_0x5c72eb){_0x8b98fc['push'](_0x8b98fc['shift']());}};_0x6d10e6(++_0x4b847c);}(_0x38c9,0xc0));var _0x938c=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x38c9[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var BPromise=require(_0x938c('0x0'));var db=require(_0x938c('0x1'))['db'];var util=require(_0x938c('0x2'));var channels=['voice',_0x938c('0x3'),'chat',_0x938c('0x4'),_0x938c('0x5'),'whatsapp',_0x938c('0x6')];exports[_0x938c('0x7')]=function(){return channels;};exports[_0x938c('0x8')]=function(_0x524f80){_0x524f80=_0x524f80[_0x938c('0x9')]();return _[_0x938c('0xa')](channels,_0x524f80);};exports[_0x938c('0xb')]=function(_0x1fdd66,_0x22a49e,_0x1a4cb7,_0xaf6b36){var _0x511298={'loginAttempts':_0x22a49e,'blocked':_0x1a4cb7};if(!_[_0x938c('0xc')](_0xaf6b36)){_0x511298[_0x938c('0xd')]=_0xaf6b36;}return _0x1fdd66[_0x938c('0xe')](_0x511298);};exports['getLicense']=function(_0x2bf19d){return new BPromise(function(_0x3c383b,_0x1d07b1){var _0x2563bd=0x0;if(_0x2bf19d['role']!==_0x938c('0xf')){_0x3c383b(_0x2bf19d);}db['User'][_0x938c('0x10')]({'where':{'role':_0x938c('0xf'),'online':!![],'id':{'$ne':_0x2bf19d['id']}}})['then'](function(_0x1719b2){_0x2563bd=_0x1719b2;return util[_0x938c('0x11')]();})[_0x938c('0x12')](function(_0x76903d){if(_0x76903d&&_0x76903d[_0x938c('0x13')]&&_0x2563bd>=_0x76903d[_0x938c('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x3c383b(_0x2bf19d);})[_0x938c('0x14')](function(_0x1bb2f0){_0x1d07b1(_0x1bb2f0);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index f6694a6..c8d5729 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4e6=['OutOfInterval','error','status','send','exports','util','api','message','Internal\x20Server\x20Error','name','Error','Bad\x20Request','Not\x20Found','inherits','Forbidden'];(function(_0x53547b,_0x33b155){var _0x3bf8df=function(_0xbb793e){while(--_0xbb793e){_0x53547b['push'](_0x53547b['shift']());}};_0x3bf8df(++_0x33b155);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x5e2152,_0x172f3d){_0x5e2152=_0x5e2152-0x0;var _0x5ddcf6=_0xb4e6[_0x5e2152];return _0x5ddcf6;};'use strict';var util=require(_0x6b4e('0x0'));var logger=require('../config/logger')(_0x6b4e('0x1'));var APIError=function(_0x1afd20,_0x365912){this[_0x6b4e('0x2')]=_0x1afd20||_0x6b4e('0x3');this[_0x6b4e('0x4')]=_0x365912||_0x6b4e('0x5');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x40da90){this[_0x6b4e('0x2')]=_0x40da90||_0x6b4e('0x6');this['name']=_0x6b4e('0x6');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x4f00be){this[_0x6b4e('0x2')]=_0x4f00be||'Entity\x20not\x20found';this['name']=_0x6b4e('0x7');util[_0x6b4e('0x8')](APINotFoundError,APIError);};function getStatusCode(_0x1e3bf6){switch(_0x1e3bf6){case _0x6b4e('0x6'):return 0x190;case _0x6b4e('0x9'),_0x6b4e('0xa'):return 0x193;case _0x6b4e('0x7'):return 0x194;default:return 0x1f4;}}function handleError(_0x49c734){return function(_0x39b4ec){logger[_0x6b4e('0xb')](_0x39b4ec['stack']);var _0x2a4d0f=getStatusCode(_0x39b4ec[_0x6b4e('0x4')]);if(_0x39b4ec[_0x6b4e('0x4')])delete _0x39b4ec[_0x6b4e('0x4')];return _0x49c734[_0x6b4e('0xc')](_0x2a4d0f)[_0x6b4e('0xd')](_0x39b4ec);};}module[_0x6b4e('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xf4eb=['Bad\x20Request','name','Not\x20Found','Forbidden','OutOfInterval','stack','send','exports','util','message','Error','inherits'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf4eb,0xec));var _0xbf4e=function(_0x34e08a,_0x56c7aa){_0x34e08a=_0x34e08a-0x0;var _0x51ca70=_0xf4eb[_0x34e08a];return _0x51ca70;};'use strict';var util=require(_0xbf4e('0x0'));var logger=require('../config/logger')('api');var APIError=function(_0x479210,_0x5ed5b9){this[_0xbf4e('0x1')]=_0x479210||'Internal\x20Server\x20Error';this['name']=_0x5ed5b9||_0xbf4e('0x2');util[_0xbf4e('0x3')](APIError,Error);};var APIBadRequestError=function(_0x32d1d7){this[_0xbf4e('0x1')]=_0x32d1d7||_0xbf4e('0x4');this[_0xbf4e('0x5')]=_0xbf4e('0x4');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x449d55){this['message']=_0x449d55||'Entity\x20not\x20found';this[_0xbf4e('0x5')]=_0xbf4e('0x6');util[_0xbf4e('0x3')](APINotFoundError,APIError);};function getStatusCode(_0xc86f04){switch(_0xc86f04){case _0xbf4e('0x4'):return 0x190;case _0xbf4e('0x7'),_0xbf4e('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x4d9a07){return function(_0x7dfb74){logger['error'](_0x7dfb74[_0xbf4e('0x9')]);var _0xcf6ba8=getStatusCode(_0x7dfb74['name']);if(_0x7dfb74[_0xbf4e('0x5')])delete _0x7dfb74['name'];return _0x4d9a07['status'](_0xcf6ba8)[_0xbf4e('0xa')](_0x7dfb74);};}module[_0xbf4e('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 7948acb..597195a 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x976c=['status','json'];(function(_0x245ca7,_0x32a087){var _0x359328=function(_0x13ad21){while(--_0x13ad21){_0x245ca7['push'](_0x245ca7['shift']());}};_0x359328(++_0x32a087);}(_0x976c,0x72));var _0xc976=function(_0x478e7d,_0x41c1c0){_0x478e7d=_0x478e7d-0x0;var _0x39f3f7=_0x976c[_0x478e7d];return _0x39f3f7;};'use strict';module['exports'][0x194]=function pageNotFound(_0x41225a,_0x45d0dd){var _0x390207='404';var _0x20b46b=0x194;var _0x504c10={'status':_0x20b46b};_0x45d0dd[_0xc976('0x0')](_0x504c10['status']);_0x45d0dd['render'](_0x390207,{},function(_0x3a7ab4,_0x147fda){if(_0x3a7ab4){return _0x45d0dd[_0xc976('0x0')](_0x504c10[_0xc976('0x0')])[_0xc976('0x1')](_0x504c10);}_0x45d0dd['send'](_0x147fda);});}; \ No newline at end of file +var _0xb666=['exports','404','status','render','json','send'];(function(_0x4eda7e,_0x4d642a){var _0x2e8f1d=function(_0x5bc5b4){while(--_0x5bc5b4){_0x4eda7e['push'](_0x4eda7e['shift']());}};_0x2e8f1d(++_0x4d642a);}(_0xb666,0x1e6));var _0x6b66=function(_0x280c03,_0x5ba994){_0x280c03=_0x280c03-0x0;var _0x5e271e=_0xb666[_0x280c03];return _0x5e271e;};'use strict';module[_0x6b66('0x0')][0x194]=function pageNotFound(_0x452b08,_0x353493){var _0x953afb=_0x6b66('0x1');var _0x43ad01=0x194;var _0x5b8dfb={'status':_0x43ad01};_0x353493[_0x6b66('0x2')](_0x5b8dfb[_0x6b66('0x2')]);_0x353493[_0x6b66('0x3')](_0x953afb,{},function(_0x1bc83b,_0x38ba0b){if(_0x1bc83b){return _0x353493[_0x6b66('0x2')](_0x5b8dfb[_0x6b66('0x2')])[_0x6b66('0x4')](_0x5b8dfb);}_0x353493[_0x6b66('0x5')](_0x38ba0b);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e90f8e4..6531672 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','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','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../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','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','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','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','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','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../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','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','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','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x5235dd,_0x3f91cf){var _0x13059d=function(_0x355a98){while(--_0x355a98){_0x5235dd['push'](_0x5235dd['shift']());}};_0x13059d(++_0x3f91cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 332a18f..d395e65 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f20=['./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','./api/mailApplication','/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/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./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/trigger','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','/api/migrations','/api/attachments','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/system','./api/pm2','/api/logs','/apidoc','join','root','/demo','static','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','/index.html','path','setupLoggers','./api/client-side-logs','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers'];(function(_0x46d1bb,_0x2f0ad9){var _0x4d83b6=function(_0x54f9c5){while(--_0x54f9c5){_0x46d1bb['push'](_0x46d1bb['shift']());}};_0x4d83b6(++_0x2f0ad9);}(_0x9f20,0x1f4));var _0x09f2=function(_0x55d543,_0x5ba056){_0x55d543=_0x55d543-0x0;var _0x51db03=_0x9f20[_0x55d543];return _0x51db03;};'use strict';var path=require(_0x09f2('0x0'));var express=require('express');var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')[_0x09f2('0x1')];var clientSideLogs=require(_0x09f2('0x2'));exports['default']=function(_0x5c024e){return setupLoggers(_0x5c024e)[_0x09f2('0x3')](function(){_0x5c024e[_0x09f2('0x4')](_0x09f2('0x5'),require(_0x09f2('0x6')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x7'),require(_0x09f2('0x8')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x9'),require(_0x09f2('0xa')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xb'),require(_0x09f2('0xc')));_0x5c024e['use'](_0x09f2('0xd'),require(_0x09f2('0xe')));_0x5c024e['use'](_0x09f2('0xf'),require(_0x09f2('0x10')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x11'),require('./api/voiceRecording'));_0x5c024e['use'](_0x09f2('0x12'),require(_0x09f2('0x13')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x14'),require(_0x09f2('0x15')));_0x5c024e[_0x09f2('0x4')]('/api/voice/mails/messages',require(_0x09f2('0x16')));_0x5c024e[_0x09f2('0x4')]('/api/voice/calls/reports',require(_0x09f2('0x17')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x18'),require(_0x09f2('0x19')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x1a'),require('./api/voiceAgentReport'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x1b'),require('./api/voiceQueueReport'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x1c'),require(_0x09f2('0x1d')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x1e'),require('./api/trunk'));_0x5c024e['use'](_0x09f2('0x1f'),require(_0x09f2('0x20')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x21'),require(_0x09f2('0x22')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x23'),require('./api/mailAccount'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x24'),require(_0x09f2('0x25')));_0x5c024e[_0x09f2('0x4')]('/api/mail/substatuses',require(_0x09f2('0x26')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x27'),require(_0x09f2('0x28')));_0x5c024e['use']('/api/mail/messages',require('./api/mailMessage'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x29'),require(_0x09f2('0x2a')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x2b'),require(_0x09f2('0x2c')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x2d'),require(_0x09f2('0x2e')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x2f'),require(_0x09f2('0x30')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x31'),require(_0x09f2('0x32')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x33'),require(_0x09f2('0x34')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x35'),require(_0x09f2('0x36')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x37'),require(_0x09f2('0x38')));_0x5c024e['use'](_0x09f2('0x39'),require(_0x09f2('0x3a')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x3b'),require(_0x09f2('0x3c')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x3d'),require(_0x09f2('0x3e')));_0x5c024e[_0x09f2('0x4')]('/api/sms/applications',require('./api/smsApplication'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x3f'),require(_0x09f2('0x40')));_0x5c024e['use'](_0x09f2('0x41'),require('./api/smsMessage'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x42'),require(_0x09f2('0x43')));_0x5c024e['use'](_0x09f2('0x44'),require(_0x09f2('0x45')));_0x5c024e['use']('/api/openchannel/applications',require(_0x09f2('0x46')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x47'),require(_0x09f2('0x48')));_0x5c024e['use']('/api/openchannel/messages',require(_0x09f2('0x49')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x4a'),require(_0x09f2('0x4b')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x4c'),require(_0x09f2('0x4d')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x4e'),require(_0x09f2('0x4f')));_0x5c024e[_0x09f2('0x4')]('/api/chat/applications',require(_0x09f2('0x50')));_0x5c024e[_0x09f2('0x4')]('/api/chat/interactions',require('./api/chatInteraction'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x51'),require(_0x09f2('0x52')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x53'),require(_0x09f2('0x54')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x55'),require('./api/chatQueue'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x56'),require(_0x09f2('0x57')));_0x5c024e['use'](_0x09f2('0x58'),require(_0x09f2('0x59')));_0x5c024e[_0x09f2('0x4')]('/api/cm/companies',require(_0x09f2('0x5a')));_0x5c024e['use'](_0x09f2('0x5b'),require('./api/cmContact'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x5c'),require('./api/cmHopper'));_0x5c024e['use'](_0x09f2('0x5d'),require(_0x09f2('0x5e')));_0x5c024e[_0x09f2('0x4')]('/api/cm/hopper_final',require(_0x09f2('0x5f')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x60'),require(_0x09f2('0x61')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x62'),require(_0x09f2('0x63')));_0x5c024e[_0x09f2('0x4')]('/api/actions',require(_0x09f2('0x64')));_0x5c024e[_0x09f2('0x4')]('/api/automations',require(_0x09f2('0x65')));_0x5c024e['use']('/api/canned_answers',require(_0x09f2('0x66')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x67'),require(_0x09f2('0x68')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x69'),require(_0x09f2('0x6a')));_0x5c024e[_0x09f2('0x4')]('/api/intervals',require(_0x09f2('0x6b')));_0x5c024e[_0x09f2('0x4')]('/api/pauses',require(_0x09f2('0x6c')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x6d'),require('./api/cdr'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x6e'),require(_0x09f2('0x6f')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x70'),require('./api/schedule'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x71'),require(_0x09f2('0x72')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x73'),require(_0x09f2('0x74')));_0x5c024e['use']('/api/contact_item_types',require(_0x09f2('0x75')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x76'),require(_0x09f2('0x77')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x78'),require(_0x09f2('0x79')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x7a'),require(_0x09f2('0x7b')));_0x5c024e[_0x09f2('0x4')]('/api/triggers',require(_0x09f2('0x7c')));_0x5c024e[_0x09f2('0x4')]('/api/variables',require(_0x09f2('0x7d')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x7e'),require('./api/integration'));_0x5c024e[_0x09f2('0x4')]('/api/integrations/reports',require(_0x09f2('0x7f')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x80'),require(_0x09f2('0x81')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x82'),require(_0x09f2('0x83')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x84'),require(_0x09f2('0x85')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x86'),require(_0x09f2('0x87')));_0x5c024e[_0x09f2('0x4')]('/api/analytics/field_reports',require(_0x09f2('0x88')));_0x5c024e[_0x09f2('0x4')]('/api/analytics/tree_reports',require(_0x09f2('0x89')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x8a'),require(_0x09f2('0x8b')));_0x5c024e['use'](_0x09f2('0x8c'),require(_0x09f2('0x8d')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x8e'),require('./api/intSalesforceField'));_0x5c024e['use'](_0x09f2('0x8f'),require(_0x09f2('0x90')));_0x5c024e['use']('/api/integrations/sugarcrm/configurations',require(_0x09f2('0x91')));_0x5c024e['use'](_0x09f2('0x92'),require(_0x09f2('0x93')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x94'),require(_0x09f2('0x95')));_0x5c024e[_0x09f2('0x4')]('/api/integrations/desk/configurations',require(_0x09f2('0x96')));_0x5c024e[_0x09f2('0x4')]('/api/integrations/desk/fields',require(_0x09f2('0x97')));_0x5c024e['use'](_0x09f2('0x98'),require(_0x09f2('0x99')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x9a'),require(_0x09f2('0x9b')));_0x5c024e[_0x09f2('0x4')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x5c024e[_0x09f2('0x4')]('/api/integrations/zendesk/accounts',require(_0x09f2('0x9c')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x9d'),require('./api/intZendeskConfiguration'));_0x5c024e['use']('/api/integrations/zendesk/fields',require(_0x09f2('0x9e')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0x9f'),require(_0x09f2('0xa0')));_0x5c024e[_0x09f2('0x4')]('/api/integrations/freshdesk/configurations',require(_0x09f2('0xa1')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xa2'),require('./api/intFreshdeskField'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xa3'),require(_0x09f2('0xa4')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xa5'),require(_0x09f2('0xa6')));_0x5c024e['use']('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xa7'),require(_0x09f2('0xa8')));_0x5c024e[_0x09f2('0x4')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xa9'),require('./api/intServicenowField'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xaa'),require(_0x09f2('0xab')));_0x5c024e[_0x09f2('0x4')]('/api/integrations/dynamics365/configurations',require(_0x09f2('0xac')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xad'),require(_0x09f2('0xae')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xaf'),require(_0x09f2('0xb0')));_0x5c024e['use']('/api/integrations/freshsales/configurations',require(_0x09f2('0xb1')));_0x5c024e[_0x09f2('0x4')]('/api/integrations/freshsales/fields',require(_0x09f2('0xb2')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xb3'),require(_0x09f2('0xb4')));_0x5c024e[_0x09f2('0x4')]('/api/chat/reports/queue',require(_0x09f2('0xb5')));_0x5c024e[_0x09f2('0x4')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x5c024e[_0x09f2('0x4')]('/api/jscripty/answers/reports',require(_0x09f2('0xb6')));_0x5c024e['use']('/api/jscripty/questions/reports',require(_0x09f2('0xb7')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xb8'),require(_0x09f2('0xb9')));_0x5c024e['use'](_0x09f2('0xba'),require(_0x09f2('0xbb')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xbc'),require(_0x09f2('0xbd')));_0x5c024e['use'](_0x09f2('0xbe'),require(_0x09f2('0xbf')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xc0'),require(_0x09f2('0xc1')));_0x5c024e[_0x09f2('0x4')]('/api/settings',require(_0x09f2('0xc2')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xc3'),require(_0x09f2('0xc4')));_0x5c024e[_0x09f2('0x4')]('/api/square/projects',require(_0x09f2('0xc5')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xc6'),require(_0x09f2('0xc7')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xc8'),require(_0x09f2('0xc9')));_0x5c024e['use'](_0x09f2('0xca'),require('./api/team'));_0x5c024e['use'](_0x09f2('0xcb'),require(_0x09f2('0xcc')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xcd'),require('./api/campaign'));_0x5c024e['use'](_0x09f2('0xce'),require('./api/migration'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xcf'),require('./api/attachment'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xd0'),require('./api/plugin'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xd1'),require(_0x09f2('0xd2')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xd3'),require(_0x09f2('0xd4')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xd5'),require('./api/faxTransferReport'));_0x5c024e['use'](_0x09f2('0xd6'),require(_0x09f2('0xd7')));_0x5c024e[_0x09f2('0x4')]('/api/sms/reports/transfer',require(_0x09f2('0xd8')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xd9'),require(_0x09f2('0xda')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xdb'),require(_0x09f2('0xdc')));_0x5c024e['use'](_0x09f2('0xdd'),require('./api/userProfile'));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xde'),require(_0x09f2('0xdf')));_0x5c024e['use'](_0x09f2('0xe0'),require(_0x09f2('0xe1')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xe2'),require(_0x09f2('0xe3')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xe4'),require(_0x09f2('0xe5')));_0x5c024e[_0x09f2('0x4')]('/api/whatsapp/applications',require(_0x09f2('0xe6')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xe7'),require(_0x09f2('0xe8')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xe9'),require(_0x09f2('0xea')));_0x5c024e[_0x09f2('0x4')]('/api/whatsapp/reports/queue',require(_0x09f2('0xeb')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xec'),require(_0x09f2('0xed')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xee'),require(_0x09f2('0xef')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xf0'),require(_0x09f2('0xf1')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xf2'),require(_0x09f2('0xf3')));_0x5c024e['use'](_0x09f2('0xf4'),require(_0x09f2('0xf5')));_0x5c024e[_0x09f2('0x4')]('/api/auth/local',require(_0x09f2('0xf6')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xf7'),require('./api/authGoogle'));_0x5c024e['use'](_0x09f2('0xf8'),require(_0x09f2('0xf9')));_0x5c024e[_0x09f2('0x4')](_0x09f2('0xfa'),require(_0x09f2('0xfb')));_0x5c024e[_0x09f2('0x4')]('/api/rpc',require('./api/rpc'));_0x5c024e['use']('/api/version',require('./api/version'));_0x5c024e[_0x09f2('0x4')]('/api/system',require(_0x09f2('0xfc')));_0x5c024e[_0x09f2('0x4')]('/api/pm2',require(_0x09f2('0xfd')));_0x5c024e[_0x09f2('0x4')]('/api/webbar',require('./api/webbar'));_0x5c024e['use'](_0x09f2('0xfe'),clientSideLogs);_0x5c024e[_0x09f2('0x4')](_0x09f2('0xff'),express['static'](path[_0x09f2('0x100')](config[_0x09f2('0x101')],_0x09f2('0xff'))));_0x5c024e[_0x09f2('0x4')]('/www',express['static'](path[_0x09f2('0x100')](config[_0x09f2('0x101')],'/www')));_0x5c024e['use'](_0x09f2('0x102'),express[_0x09f2('0x103')](path[_0x09f2('0x100')](config[_0x09f2('0x101')],'/demo')));_0x5c024e['use']('/snippet',express[_0x09f2('0x103')](path[_0x09f2('0x100')](config['root'],'snippet',_0x09f2('0x104'))));_0x5c024e['use'](_0x09f2('0x105'),express['static'](path[_0x09f2('0x100')](config[_0x09f2('0x101')],_0x09f2('0x106'))));_0x5c024e[_0x09f2('0x107')](_0x09f2('0x108'))[_0x09f2('0x109')](errors[0x194]);_0x5c024e[_0x09f2('0x107')]('/*')[_0x09f2('0x109')](function(_0x5d49f9,_0x41151f){_0x41151f['sendFile'](path['resolve'](_0x5c024e[_0x09f2('0x109')]('appPath')+_0x09f2('0x10a')));});return _0x5c024e;});}; \ No newline at end of file +var _0x19ac=['./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','3.1.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','/index.html','path','express','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','/api/voice/chanspy','use','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./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/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','./api/squareOdbc','./api/squareProject','./api/squareMessage','/api/teams'];(function(_0x5f529,_0x5de2bc){var _0x5504a9=function(_0x1130f0){while(--_0x1130f0){_0x5f529['push'](_0x5f529['shift']());}};_0x5504a9(++_0x5de2bc);}(_0x19ac,0x15c));var _0xc19a=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x19ac[_0x56916d];return _0x2b7f1f;};'use strict';var path=require(_0xc19a('0x0'));var express=require(_0xc19a('0x1'));var errors=require(_0xc19a('0x2'));var config=require(_0xc19a('0x3'));var setupLoggers=require('./utils/client-side-logger')[_0xc19a('0x4')];var clientSideLogs=require(_0xc19a('0x5'));exports[_0xc19a('0x6')]=function(_0x514926){return setupLoggers(_0x514926)[_0xc19a('0x7')](function(){_0x514926['use'](_0xc19a('0x8'),require(_0xc19a('0x9')));_0x514926['use'](_0xc19a('0xa'),require('./api/voiceChanSpy'));_0x514926[_0xc19a('0xb')](_0xc19a('0xc'),require(_0xc19a('0xd')));_0x514926[_0xc19a('0xb')](_0xc19a('0xe'),require(_0xc19a('0xf')));_0x514926[_0xc19a('0xb')](_0xc19a('0x10'),require('./api/voiceMusicOnHold'));_0x514926['use'](_0xc19a('0x11'),require(_0xc19a('0x12')));_0x514926['use'](_0xc19a('0x13'),require(_0xc19a('0x14')));_0x514926[_0xc19a('0xb')](_0xc19a('0x15'),require(_0xc19a('0x16')));_0x514926[_0xc19a('0xb')](_0xc19a('0x17'),require('./api/voiceMail'));_0x514926['use'](_0xc19a('0x18'),require(_0xc19a('0x19')));_0x514926[_0xc19a('0xb')]('/api/voice/calls/reports',require(_0xc19a('0x1a')));_0x514926['use']('/api/voice/dials/reports',require(_0xc19a('0x1b')));_0x514926[_0xc19a('0xb')](_0xc19a('0x1c'),require(_0xc19a('0x1d')));_0x514926[_0xc19a('0xb')](_0xc19a('0x1e'),require(_0xc19a('0x1f')));_0x514926['use'](_0xc19a('0x20'),require('./api/memberReport'));_0x514926[_0xc19a('0xb')](_0xc19a('0x21'),require(_0xc19a('0x22')));_0x514926[_0xc19a('0xb')](_0xc19a('0x23'),require('./api/voiceTransferReport'));_0x514926[_0xc19a('0xb')](_0xc19a('0x24'),require('./api/mailServerOut'));_0x514926['use']('/api/mail/accounts',require(_0xc19a('0x25')));_0x514926[_0xc19a('0xb')]('/api/mail/queues',require(_0xc19a('0x26')));_0x514926[_0xc19a('0xb')](_0xc19a('0x27'),require(_0xc19a('0x28')));_0x514926[_0xc19a('0xb')](_0xc19a('0x29'),require('./api/mailInteraction'));_0x514926[_0xc19a('0xb')](_0xc19a('0x2a'),require(_0xc19a('0x2b')));_0x514926[_0xc19a('0xb')](_0xc19a('0x2c'),require(_0xc19a('0x2d')));_0x514926[_0xc19a('0xb')]('/api/mail/reports/queue',require(_0xc19a('0x2e')));_0x514926[_0xc19a('0xb')]('/api/dashboards',require(_0xc19a('0x2f')));_0x514926[_0xc19a('0xb')](_0xc19a('0x30'),require(_0xc19a('0x31')));_0x514926[_0xc19a('0xb')](_0xc19a('0x32'),require(_0xc19a('0x33')));_0x514926[_0xc19a('0xb')](_0xc19a('0x34'),require(_0xc19a('0x35')));_0x514926[_0xc19a('0xb')](_0xc19a('0x36'),require(_0xc19a('0x37')));_0x514926[_0xc19a('0xb')](_0xc19a('0x38'),require(_0xc19a('0x39')));_0x514926[_0xc19a('0xb')]('/api/fax/queues',require(_0xc19a('0x3a')));_0x514926[_0xc19a('0xb')](_0xc19a('0x3b'),require('./api/faxQueueReport'));_0x514926[_0xc19a('0xb')](_0xc19a('0x3c'),require(_0xc19a('0x3d')));_0x514926[_0xc19a('0xb')](_0xc19a('0x3e'),require('./api/smsApplication'));_0x514926[_0xc19a('0xb')](_0xc19a('0x3f'),require(_0xc19a('0x40')));_0x514926['use']('/api/sms/messages',require(_0xc19a('0x41')));_0x514926[_0xc19a('0xb')](_0xc19a('0x42'),require(_0xc19a('0x43')));_0x514926[_0xc19a('0xb')](_0xc19a('0x44'),require('./api/openchannelAccount'));_0x514926[_0xc19a('0xb')](_0xc19a('0x45'),require('./api/openchannelApplication'));_0x514926[_0xc19a('0xb')](_0xc19a('0x46'),require(_0xc19a('0x47')));_0x514926[_0xc19a('0xb')](_0xc19a('0x48'),require('./api/openchannelMessage'));_0x514926['use'](_0xc19a('0x49'),require(_0xc19a('0x4a')));_0x514926[_0xc19a('0xb')](_0xc19a('0x4b'),require(_0xc19a('0x4c')));_0x514926['use'](_0xc19a('0x4d'),require(_0xc19a('0x4e')));_0x514926['use'](_0xc19a('0x4f'),require(_0xc19a('0x50')));_0x514926[_0xc19a('0xb')](_0xc19a('0x51'),require('./api/chatInteraction'));_0x514926[_0xc19a('0xb')](_0xc19a('0x52'),require(_0xc19a('0x53')));_0x514926[_0xc19a('0xb')](_0xc19a('0x54'),require(_0xc19a('0x55')));_0x514926['use']('/api/chat/queues',require(_0xc19a('0x56')));_0x514926[_0xc19a('0xb')](_0xc19a('0x57'),require('./api/chatGroup'));_0x514926[_0xc19a('0xb')](_0xc19a('0x58'),require(_0xc19a('0x59')));_0x514926[_0xc19a('0xb')](_0xc19a('0x5a'),require(_0xc19a('0x5b')));_0x514926['use'](_0xc19a('0x5c'),require(_0xc19a('0x5d')));_0x514926[_0xc19a('0xb')]('/api/cm/hopper',require(_0xc19a('0x5e')));_0x514926[_0xc19a('0xb')](_0xc19a('0x5f'),require(_0xc19a('0x60')));_0x514926['use'](_0xc19a('0x61'),require(_0xc19a('0x62')));_0x514926[_0xc19a('0xb')](_0xc19a('0x63'),require(_0xc19a('0x64')));_0x514926['use'](_0xc19a('0x65'),require('./api/cmCustomField'));_0x514926[_0xc19a('0xb')](_0xc19a('0x66'),require('./api/action'));_0x514926['use'](_0xc19a('0x67'),require('./api/automation'));_0x514926[_0xc19a('0xb')](_0xc19a('0x68'),require(_0xc19a('0x69')));_0x514926['use'](_0xc19a('0x6a'),require(_0xc19a('0x6b')));_0x514926[_0xc19a('0xb')](_0xc19a('0x6c'),require('./api/condition'));_0x514926[_0xc19a('0xb')](_0xc19a('0x6d'),require(_0xc19a('0x6e')));_0x514926[_0xc19a('0xb')](_0xc19a('0x6f'),require(_0xc19a('0x70')));_0x514926[_0xc19a('0xb')](_0xc19a('0x71'),require(_0xc19a('0x72')));_0x514926[_0xc19a('0xb')]('/api/voiceQueuesLog',require(_0xc19a('0x73')));_0x514926[_0xc19a('0xb')](_0xc19a('0x74'),require(_0xc19a('0x75')));_0x514926[_0xc19a('0xb')]('/api/sounds',require(_0xc19a('0x76')));_0x514926[_0xc19a('0xb')](_0xc19a('0x77'),require('./api/tag'));_0x514926[_0xc19a('0xb')](_0xc19a('0x78'),require(_0xc19a('0x79')));_0x514926['use'](_0xc19a('0x7a'),require('./api/cmContactHasItem'));_0x514926[_0xc19a('0xb')](_0xc19a('0x7b'),require(_0xc19a('0x7c')));_0x514926[_0xc19a('0xb')]('/api/templates',require(_0xc19a('0x7d')));_0x514926[_0xc19a('0xb')](_0xc19a('0x7e'),require(_0xc19a('0x7f')));_0x514926[_0xc19a('0xb')](_0xc19a('0x80'),require('./api/variable'));_0x514926[_0xc19a('0xb')](_0xc19a('0x81'),require(_0xc19a('0x82')));_0x514926[_0xc19a('0xb')]('/api/integrations/reports',require(_0xc19a('0x83')));_0x514926['use'](_0xc19a('0x84'),require(_0xc19a('0x85')));_0x514926[_0xc19a('0xb')]('/api/analytics/default_reports',require(_0xc19a('0x86')));_0x514926[_0xc19a('0xb')]('/api/analytics/extracted_reports',require(_0xc19a('0x87')));_0x514926[_0xc19a('0xb')](_0xc19a('0x88'),require(_0xc19a('0x89')));_0x514926['use'](_0xc19a('0x8a'),require(_0xc19a('0x8b')));_0x514926[_0xc19a('0xb')](_0xc19a('0x8c'),require(_0xc19a('0x8d')));_0x514926[_0xc19a('0xb')](_0xc19a('0x8e'),require('./api/intSalesforceAccount'));_0x514926[_0xc19a('0xb')](_0xc19a('0x8f'),require('./api/intSalesforceConfiguration'));_0x514926['use'](_0xc19a('0x90'),require(_0xc19a('0x91')));_0x514926[_0xc19a('0xb')](_0xc19a('0x92'),require(_0xc19a('0x93')));_0x514926['use'](_0xc19a('0x94'),require('./api/intSugarcrmConfiguration'));_0x514926[_0xc19a('0xb')]('/api/integrations/sugarcrm/fields',require(_0xc19a('0x95')));_0x514926['use'](_0xc19a('0x96'),require(_0xc19a('0x97')));_0x514926[_0xc19a('0xb')](_0xc19a('0x98'),require(_0xc19a('0x99')));_0x514926[_0xc19a('0xb')](_0xc19a('0x9a'),require(_0xc19a('0x9b')));_0x514926[_0xc19a('0xb')]('/api/integrations/zoho/accounts',require(_0xc19a('0x9c')));_0x514926['use']('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x514926[_0xc19a('0xb')]('/api/integrations/zoho/fields',require(_0xc19a('0x9d')));_0x514926['use'](_0xc19a('0x9e'),require('./api/intZendeskAccount'));_0x514926[_0xc19a('0xb')](_0xc19a('0x9f'),require(_0xc19a('0xa0')));_0x514926[_0xc19a('0xb')]('/api/integrations/zendesk/fields',require(_0xc19a('0xa1')));_0x514926[_0xc19a('0xb')](_0xc19a('0xa2'),require('./api/intFreshdeskAccount'));_0x514926[_0xc19a('0xb')](_0xc19a('0xa3'),require(_0xc19a('0xa4')));_0x514926[_0xc19a('0xb')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x514926[_0xc19a('0xb')](_0xc19a('0xa5'),require(_0xc19a('0xa6')));_0x514926['use'](_0xc19a('0xa7'),require(_0xc19a('0xa8')));_0x514926[_0xc19a('0xb')]('/api/integrations/vtiger/fields',require(_0xc19a('0xa9')));_0x514926['use'](_0xc19a('0xaa'),require('./api/intServicenowAccount'));_0x514926['use'](_0xc19a('0xab'),require(_0xc19a('0xac')));_0x514926[_0xc19a('0xb')](_0xc19a('0xad'),require('./api/intServicenowField'));_0x514926['use'](_0xc19a('0xae'),require('./api/intDynamics365Account'));_0x514926[_0xc19a('0xb')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x514926[_0xc19a('0xb')](_0xc19a('0xaf'),require(_0xc19a('0xb0')));_0x514926[_0xc19a('0xb')](_0xc19a('0xb1'),require(_0xc19a('0xb2')));_0x514926[_0xc19a('0xb')]('/api/integrations/freshsales/configurations',require(_0xc19a('0xb3')));_0x514926[_0xc19a('0xb')](_0xc19a('0xb4'),require(_0xc19a('0xb5')));_0x514926[_0xc19a('0xb')](_0xc19a('0xb6'),require(_0xc19a('0xb7')));_0x514926['use'](_0xc19a('0xb8'),require(_0xc19a('0xb9')));_0x514926['use'](_0xc19a('0xba'),require(_0xc19a('0xbb')));_0x514926['use'](_0xc19a('0xbc'),require(_0xc19a('0xbd')));_0x514926[_0xc19a('0xb')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x514926['use'](_0xc19a('0xbe'),require(_0xc19a('0xbf')));_0x514926['use'](_0xc19a('0xc0'),require(_0xc19a('0xc1')));_0x514926['use'](_0xc19a('0xc2'),require('./api/squareReport'));_0x514926[_0xc19a('0xb')](_0xc19a('0xc3'),require(_0xc19a('0xc4')));_0x514926[_0xc19a('0xb')](_0xc19a('0xc5'),require(_0xc19a('0xc6')));_0x514926[_0xc19a('0xb')]('/api/settings',require(_0xc19a('0xc7')));_0x514926[_0xc19a('0xb')]('/api/square/odbc',require(_0xc19a('0xc8')));_0x514926[_0xc19a('0xb')]('/api/square/projects',require(_0xc19a('0xc9')));_0x514926[_0xc19a('0xb')]('/api/square/recordings',require('./api/squareRecording'));_0x514926[_0xc19a('0xb')]('/api/square/messages',require(_0xc19a('0xca')));_0x514926[_0xc19a('0xb')](_0xc19a('0xcb'),require(_0xc19a('0xcc')));_0x514926[_0xc19a('0xb')]('/api/license',require(_0xc19a('0xcd')));_0x514926[_0xc19a('0xb')](_0xc19a('0xce'),require(_0xc19a('0xcf')));_0x514926[_0xc19a('0xb')](_0xc19a('0xd0'),require(_0xc19a('0xd1')));_0x514926[_0xc19a('0xb')](_0xc19a('0xd2'),require(_0xc19a('0xd3')));_0x514926[_0xc19a('0xb')]('/api/plugins',require(_0xc19a('0xd4')));_0x514926[_0xc19a('0xb')](_0xc19a('0xd5'),require(_0xc19a('0xd6')));_0x514926[_0xc19a('0xb')](_0xc19a('0xd7'),require(_0xc19a('0xd8')));_0x514926['use']('/api/fax/reports/transfer',require(_0xc19a('0xd9')));_0x514926[_0xc19a('0xb')]('/api/openchannel/reports/transfer',require(_0xc19a('0xda')));_0x514926[_0xc19a('0xb')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x514926[_0xc19a('0xb')](_0xc19a('0xdb'),require(_0xc19a('0xdc')));_0x514926[_0xc19a('0xb')](_0xc19a('0xdd'),require(_0xc19a('0xde')));_0x514926[_0xc19a('0xb')](_0xc19a('0xdf'),require(_0xc19a('0xe0')));_0x514926[_0xc19a('0xb')](_0xc19a('0xe1'),require(_0xc19a('0xe2')));_0x514926['use']('/api/userProfile/resources',require(_0xc19a('0xe3')));_0x514926[_0xc19a('0xb')](_0xc19a('0xe4'),require(_0xc19a('0xe5')));_0x514926[_0xc19a('0xb')](_0xc19a('0xe6'),require('./api/whatsappAccount'));_0x514926[_0xc19a('0xb')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x514926[_0xc19a('0xb')](_0xc19a('0xe7'),require(_0xc19a('0xe8')));_0x514926['use'](_0xc19a('0xe9'),require('./api/whatsappMessage'));_0x514926[_0xc19a('0xb')]('/api/whatsapp/reports/queue',require(_0xc19a('0xea')));_0x514926[_0xc19a('0xb')]('/api/whatsapp/reports/transfer',require(_0xc19a('0xeb')));_0x514926['use'](_0xc19a('0xec'),require(_0xc19a('0xed')));_0x514926['use'](_0xc19a('0xee'),require(_0xc19a('0xef')));_0x514926[_0xc19a('0xb')](_0xc19a('0xf0'),require(_0xc19a('0xf1')));_0x514926[_0xc19a('0xb')](_0xc19a('0xf2'),require(_0xc19a('0xf3')));_0x514926['use'](_0xc19a('0xf4'),require(_0xc19a('0xf5')));_0x514926[_0xc19a('0xb')]('/api/auth/google',require(_0xc19a('0xf6')));_0x514926[_0xc19a('0xb')](_0xc19a('0xf7'),require(_0xc19a('0xf8')));_0x514926[_0xc19a('0xb')](_0xc19a('0xf9'),require(_0xc19a('0xfa')));_0x514926['use'](_0xc19a('0xfb'),require('./api/rpc'));_0x514926[_0xc19a('0xb')](_0xc19a('0xfc'),require(_0xc19a('0xfd')));_0x514926[_0xc19a('0xb')](_0xc19a('0xfe'),require(_0xc19a('0xff')));_0x514926[_0xc19a('0xb')](_0xc19a('0x100'),require(_0xc19a('0x101')));_0x514926[_0xc19a('0xb')](_0xc19a('0x102'),require(_0xc19a('0x103')));_0x514926[_0xc19a('0xb')](_0xc19a('0x104'),clientSideLogs);_0x514926[_0xc19a('0xb')](_0xc19a('0x105'),express[_0xc19a('0x106')](path[_0xc19a('0x107')](config[_0xc19a('0x108')],_0xc19a('0x105'))));_0x514926['use'](_0xc19a('0x109'),express[_0xc19a('0x106')](path[_0xc19a('0x107')](config[_0xc19a('0x108')],_0xc19a('0x109'))));_0x514926[_0xc19a('0xb')](_0xc19a('0x10a'),express[_0xc19a('0x106')](path[_0xc19a('0x107')](config[_0xc19a('0x108')],'/demo')));_0x514926[_0xc19a('0xb')](_0xc19a('0x10b'),express['static'](path[_0xc19a('0x107')](config[_0xc19a('0x108')],'snippet',_0xc19a('0x10c'))));_0x514926[_0xc19a('0xb')](_0xc19a('0x10d'),express['static'](path[_0xc19a('0x107')](config[_0xc19a('0x108')],_0xc19a('0x10e'))));_0x514926[_0xc19a('0x10f')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xc19a('0x110')](errors[0x194]);_0x514926[_0xc19a('0x10f')]('/*')[_0xc19a('0x110')](function(_0x4b4762,_0x360324){_0x360324[_0xc19a('0x111')](path[_0xc19a('0x112')](_0x514926['get']('appPath')+_0xc19a('0x113')));});return _0x514926;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 8be28b9..368c21a 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc3c=['Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.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/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','server','http','rpc','port','error','log'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0xdc3c,0x1b4));var _0xcdc3=function(_0x7b664f,_0x21097a){_0x7b664f=_0x7b664f-0x0;var _0x429513=_0xdc3c[_0x7b664f];return _0x429513;};'use strict';var jayson=require(_0xcdc3('0x0'));var _=require('lodash');var config=require(_0xcdc3('0x1'));exports[_0xcdc3('0x2')]=function(){return new Promise(function(_0x50cb14,_0x2f6dba){var _0x2c1b9b={};_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x4')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x5')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x6')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x7')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x8')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x2c1b9b=_['merge'](_0x2c1b9b,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x9')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0xa')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0xb')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0xc')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x2c1b9b=_['merge'](_0x2c1b9b,require(_0xcdc3('0xd')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0xe')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0xf')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x10')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/mailMessage/mailMessage.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/mailApplication/mailApplication.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x11')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x12')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x13')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x14')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x15')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x16')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x17')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x18')));_0x2c1b9b=_['merge'](_0x2c1b9b,require('../api/smsQueue/smsQueue.rpc'));_0x2c1b9b=_['merge'](_0x2c1b9b,require(_0xcdc3('0x19')));_0x2c1b9b=_['merge'](_0x2c1b9b,require(_0xcdc3('0x1a')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x1b')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x1c')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x1d')));_0x2c1b9b=_['merge'](_0x2c1b9b,require('../api/chatInteraction/chatInteraction.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x1e')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x1f')));_0x2c1b9b=_['merge'](_0x2c1b9b,require(_0xcdc3('0x20')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/cmHopper/cmHopper.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x21')));_0x2c1b9b=_['merge'](_0x2c1b9b,require(_0xcdc3('0x22')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x23')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x24')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x25')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/pause/pause.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/sound/sound.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x26')));_0x2c1b9b=_['merge'](_0x2c1b9b,require(_0xcdc3('0x27')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/trigger/trigger.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x28')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x29')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x2a')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x2b')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x2c')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x2d')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x2e')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x2f')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x30')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x31')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x32')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x33')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x34')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x35')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/squareProject/squareProject.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x36')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x37')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x38')));_0x2c1b9b=_['merge'](_0x2c1b9b,require(_0xcdc3('0x39')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/plugin/plugin.rpc'));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x3a')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x3b')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x3c')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require(_0xcdc3('0x3d')));_0x2c1b9b=_[_0xcdc3('0x3')](_0x2c1b9b,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x51bd3d=jayson[_0xcdc3('0x3e')](_0x2c1b9b)[_0xcdc3('0x3f')]();var _0x568277=config[_0xcdc3('0x40')][_0xcdc3('0x41')]||config['port']+0x1;var _0x211ccf=config[_0xcdc3('0x40')]['ip']||'localhost';_0x51bd3d['on'](_0xcdc3('0x42'),function(_0x543bf6){return _0x2f6dba(_0x543bf6);});_0x51bd3d['listen'](_0x568277,_0x211ccf,function(){console[_0xcdc3('0x43')](_0xcdc3('0x44'),_0x211ccf,_0x568277);require(_0xcdc3('0x45'))[_0xcdc3('0x46')]();return _0x50cb14(_0xcdc3('0x47')+_0x211ccf+':'+_0x568277);});});}; \ No newline at end of file +var _0x0173=['../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.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/mailInteraction/mailInteraction.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc'];(function(_0x5aea32,_0x5a09f6){var _0x3deb08=function(_0x461612){while(--_0x461612){_0x5aea32['push'](_0x5aea32['shift']());}};_0x3deb08(++_0x5a09f6);}(_0x0173,0x198));var _0x3017=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0173[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x3017('0x0'));var _=require(_0x3017('0x1'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x227d58,_0x481f23){var _0x5aa267={};_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x3')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x4')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/voiceQueue/voiceQueue.rpc'));_0x5aa267=_['merge'](_0x5aa267,require(_0x3017('0x5')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x6')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x7')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x8')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x9')));_0x5aa267=_['merge'](_0x5aa267,require(_0x3017('0xa')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0xb')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0xc')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0xd')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0xe')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0xf')));_0x5aa267=_['merge'](_0x5aa267,require('../api/mailMessage/mailMessage.rpc'));_0x5aa267=_['merge'](_0x5aa267,require('../api/mailApplication/mailApplication.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x10')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/faxApplication/faxApplication.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x11')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x12')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x13')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x14')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x15')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x16')));_0x5aa267=_['merge'](_0x5aa267,require(_0x3017('0x17')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/smsQueue/smsQueue.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x18')));_0x5aa267=_['merge'](_0x5aa267,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x19')));_0x5aa267=_['merge'](_0x5aa267,require(_0x3017('0x1a')));_0x5aa267=_['merge'](_0x5aa267,require(_0x3017('0x1b')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x1c')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x1d')));_0x5aa267=_['merge'](_0x5aa267,require(_0x3017('0x1e')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/cmContact/cmContact.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x1f')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x20')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x21')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x22')));_0x5aa267=_['merge'](_0x5aa267,require(_0x3017('0x23')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/interval/interval.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x24')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x25')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x26')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x27')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x28')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x29')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x2a')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x2b')));_0x5aa267=_['merge'](_0x5aa267,require(_0x3017('0x2c')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x2d')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x2e')));_0x5aa267=_['merge'](_0x5aa267,require(_0x3017('0x2f')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x30')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x31')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x32')));_0x5aa267=_['merge'](_0x5aa267,require(_0x3017('0x33')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x34')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/squareReport/squareReport.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x35')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x36')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x37')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/squareRecording/squareRecording.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x38')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x39')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/attachment/attachment.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x3a')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x3b')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x3c')));_0x5aa267=_['merge'](_0x5aa267,require(_0x3017('0x3d')));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x5aa267=_[_0x3017('0x2')](_0x5aa267,require(_0x3017('0x3e')));var _0x45bb47=jayson['server'](_0x5aa267)['http']();var _0x8df1d=config['rpc'][_0x3017('0x3f')]||config['port']+0x1;var _0x5a3b89=config['rpc']['ip']||_0x3017('0x40');_0x45bb47['on'](_0x3017('0x41'),function(_0x336aa3){return _0x481f23(_0x336aa3);});_0x45bb47[_0x3017('0x42')](_0x8df1d,_0x5a3b89,function(){console[_0x3017('0x43')](_0x3017('0x44'),_0x5a3b89,_0x8df1d);require(_0x3017('0x45'))[_0x3017('0x46')]();return _0x227d58(_0x3017('0x47')+_0x5a3b89+':'+_0x8df1d);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 8f8ff8a..568df29 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 _0x2c31=['ANSWER','getData','beep','format','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','EventEmitter','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','function','replace','result=','indexOf','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','answer','sendRequest'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x2c31,0xb6));var _0x12c3=function(_0x2d57f0,_0xefed66){_0x2d57f0=_0x2d57f0-0x0;var _0x3a7f84=_0x2c31[_0x2d57f0];return _0x3a7f84;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x12c3('0x0'))[_0x12c3('0x1')];var AGIReply=require('./reply');var AGIError=require(_0x12c3('0x2'));function AGIChannel(_0x3f1699){var _0x1b21cc=this,_0x1163ca=new AGIReply(),_0x3735ba=![],_0x920b2c={};EventEmitter[_0x12c3('0x3')](_0x1b21cc);_0x3f1699[_0x12c3('0x4')](_0x12c3('0x5'));_0x3f1699['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x1163ca[_0x12c3('0x4')]('utf8');_0x1163ca['on'](_0x12c3('0x6'),function(_0x187f03){for(var _0x557148 in _0x187f03){_0x1b21cc[_0x557148]=_0x187f03[_0x557148];}_0x1b21cc[_0x12c3('0x7')]('ready');});_0x1163ca['on'](_0x12c3('0x8'),function(_0xec6d20){if(_0xec6d20[_0x12c3('0x9')]()==_0x12c3('0xa')){_0x1b21cc['emit']('hangup');return;}if(_0xec6d20[_0x12c3('0xb')](0x0,0xb)==_0x12c3('0xc')){_0x3735ba=!![];}if(_0x3735ba){_0x920b2c['rx']+=_0xec6d20+'\x0a';if(_0xec6d20[_0x12c3('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0x3735ba=![];}}else{_0x920b2c['rx']=_0xec6d20;}if(_0x3735ba){return;}if(typeof _0x920b2c['cb']==_0x12c3('0xe')){var _0x54e299=_0x920b2c['rx'][_0x12c3('0xb')](0x0,0x3),_0x2fd47f=null,_0x27b047=null;_0x54e299=parseInt(_0x54e299);if(isNaN(_0x54e299)){_0x920b2c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x54e299!=0xc8){_0x920b2c['cb'](null,{'code':_0x54e299,'result':-0x1,'extra':'KO'});return;}_0x2fd47f=_0x920b2c['rx'][_0x12c3('0xb')](0x4)[_0x12c3('0xf')](_0x12c3('0x10'),'');if(_0x2fd47f['indexOf']('\x20')!=-0x1){_0x2fd47f=_0x2fd47f['substr'](0x0,_0x2fd47f[_0x12c3('0x11')]('\x20'));}if(_['startsWith'](_0x2fd47f,'-1')){_0x2fd47f=parseInt(_0x2fd47f);}_0x27b047=_0x920b2c['rx'][_0x12c3('0x12')]('\x20');if(_0x27b047['length']==0x3){_0x27b047=_0x27b047[0x2][_0x12c3('0xb')](0x1,_0x27b047[0x2][_0x12c3('0x13')]-0x1);}else if(_0x27b047[_0x12c3('0x13')]>0x3){var _0x20d93b=/\((.+)\)/;var _0x4d359b=_0x920b2c['rx']['match'](_0x20d93b);if(_0x4d359b){_0x27b047=_0x4d359b[0x1];}else{_0x27b047=null;}}else{_0x27b047=null;}_0x920b2c['cb'](null,{'code':_0x54e299,'result':_0x2fd47f,'extra':_0x27b047});}});_0x3f1699['on'](_0x12c3('0x14'),function(_0x397ecc){_0x1b21cc[_0x12c3('0x7')](_0x12c3('0x14'),new AGIError(_0x12c3('0x15'),_0x397ecc[_0x12c3('0x16')]));});_0x3f1699['on'](_0x12c3('0x17'),function(){_0x1b21cc[_0x12c3('0x7')](_0x12c3('0x17'),new AGIError(_0x12c3('0x18')));});_0x3f1699['on'](_0x12c3('0x19'),function(){_0x1b21cc[_0x12c3('0x7')](_0x12c3('0x19'),new AGIError(_0x12c3('0x1a')));_0x3f1699[_0x12c3('0x1b')]();});_0x3f1699[_0x12c3('0x1c')](_0x1163ca);this[_0x12c3('0x1d')]=function(_0x39bd3d,_0x57109e){var _0x39bd3d=_0x39bd3d||'',_0x57109e=typeof _0x57109e==_0x12c3('0xe')?_0x57109e:new Function();_0x920b2c={'tx':_0x39bd3d,'rx':'','cb':_0x57109e};_0x3f1699[_0x12c3('0x1e')](_0x39bd3d+'\x0a');},this['close']=function(){_0x3f1699[_0x12c3('0x1b')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x12c3('0x1f')]['sendRequest']=function(_0x6c392a){return this['command']['sync'](this,_0x6c392a);};AGIChannel[_0x12c3('0x1f')][_0x12c3('0x20')]=function(){return this[_0x12c3('0x21')](_0x12c3('0x22'));};AGIChannel[_0x12c3('0x1f')][_0x12c3('0x23')]=function(_0x20c43d,_0x5d5412,_0x1fbf54){_0x20c43d=_0x20c43d===undefined?_0x12c3('0x24'):_0x20c43d;_0x5d5412=_0x5d5412===undefined?'5':_0x5d5412;_0x1fbf54=_0x1fbf54===undefined?'1':_0x1fbf54;return this[_0x12c3('0x21')](util[_0x12c3('0x25')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x20c43d,_0x5d5412*0x3e8,_0x1fbf54));};AGIChannel['prototype']['noop']=function(_0x4caa1c){_0x4caa1c=_0x4caa1c||_0x12c3('0x26');return this['sendRequest'](util[_0x12c3('0x25')](_0x12c3('0x27'),_0x4caa1c));};AGIChannel[_0x12c3('0x1f')][_0x12c3('0x28')]=function(_0x4af310,_0x3ffa66){if(_[_0x12c3('0x29')](_0x3ffa66)){return this[_0x12c3('0x21')](util[_0x12c3('0x25')](_0x12c3('0x2a'),_0x4af310,_0x3ffa66[_0x12c3('0x2b')](',')));}return this[_0x12c3('0x21')](util[_0x12c3('0x25')](_0x12c3('0x2a'),_0x4af310,_0x3ffa66));};AGIChannel['prototype']['setContext']=function(_0x1d3302){return this[_0x12c3('0x21')](util[_0x12c3('0x25')](_0x12c3('0x2c'),_0x1d3302));};AGIChannel[_0x12c3('0x1f')][_0x12c3('0x2d')]=function(_0x66f75f){return this[_0x12c3('0x21')](util[_0x12c3('0x25')](_0x12c3('0x2e'),_0x66f75f));};AGIChannel[_0x12c3('0x1f')][_0x12c3('0x2f')]=function(_0x4943cb){return this[_0x12c3('0x21')](util[_0x12c3('0x25')]('SET\x20PRIORITY\x20%s',_0x4943cb));};AGIChannel[_0x12c3('0x1f')][_0x12c3('0xa')]=function(){return this[_0x12c3('0x21')](_0x12c3('0x30'));};AGIChannel['prototype']['setVariable']=function(_0x136daf,_0x26f0ef){var _0x583e8a=_[_0x12c3('0x31')](_0x26f0ef)||_[_0x12c3('0x32')](_0x26f0ef)?_0x26f0ef[_0x12c3('0x33')]():_0x26f0ef;return this[_0x12c3('0x21')](util[_0x12c3('0x25')](_0x12c3('0x34'),_0x136daf,_0x583e8a?_0x583e8a[_0x12c3('0x33')]()[_0x12c3('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x12c3('0x1f')]['sayNumber']=function(_0x5d9954,_0x42b405){return this[_0x12c3('0x21')](util[_0x12c3('0x25')](_0x12c3('0x35'),_0x5d9954,_0x42b405));};AGIChannel[_0x12c3('0x1f')]['sayDigits']=function(_0x6a7dc3,_0x3f9008){return this['sendRequest'](util[_0x12c3('0x25')](_0x12c3('0x36'),_0x6a7dc3,_0x3f9008));};AGIChannel['prototype'][_0x12c3('0x37')]=function(_0x52ea7d,_0x3bf235){return this['sendRequest'](util['format'](_0x12c3('0x38'),_0x52ea7d,_0x3bf235));};AGIChannel['prototype']['continueAt']=function(_0x543f96,_0x27f59b,_0x5c15e5){_0x27f59b=_0x27f59b||this[_0x12c3('0x39')];_0x5c15e5=_0x5c15e5||0x1;this[_0x12c3('0x3a')](_0x543f96);this[_0x12c3('0x2d')](_0x27f59b);this[_0x12c3('0x2f')](_0x5c15e5);return this['noop'](util['format'](_0x12c3('0x3b'),_0x543f96,_0x27f59b,_0x5c15e5));};AGIChannel[_0x12c3('0x1f')][_0x12c3('0x3c')]=function(_0x29affc){return this[_0x12c3('0x21')](util[_0x12c3('0x25')](_0x12c3('0x3d'),_0x29affc));};AGIChannel[_0x12c3('0x1f')]['recordFile']=function(_0x509e45,_0x45b755,_0x267db1,_0x25b650,_0x131597,_0x40b43d){_0x45b755=_0x45b755||_0x12c3('0x3e');_0x267db1=_0x267db1||'';_0x25b650=_0x25b650===undefined?-0x1:_0x25b650==='-1'?-0x1:_0x25b650*0x3e8;_0x131597=_0x131597===undefined?'':'s='+_0x131597;_0x40b43d=_0x40b43d?_0x12c3('0x3f'):'';return this[_0x12c3('0x21')](util[_0x12c3('0x25')](_0x12c3('0x40'),_0x509e45,_0x45b755,_0x267db1,_0x25b650,_0x40b43d,_0x131597));};AGIChannel['prototype'][_0x12c3('0x41')]=function(_0x1978c9,_0x157285){_0x157285=_0x157285||'';return this[_0x12c3('0x21')](util['format'](_0x12c3('0x42'),_0x1978c9,_0x157285));};AGIChannel[_0x12c3('0x1f')]['agi']=function(_0x384675){return this[_0x12c3('0x28')]('AGI',_0x384675);};AGIChannel[_0x12c3('0x1f')][_0x12c3('0x43')]=function(_0x483abf){return this[_0x12c3('0x28')](_0x12c3('0x44'),_0x483abf);};AGIChannel[_0x12c3('0x1f')][_0x12c3('0x14')]=function(_0x59d7b7,_0x5e9868){this[_0x12c3('0x45')](util[_0x12c3('0x25')](_0x12c3('0x46'),_0x59d7b7['id'],_0x59d7b7[_0x12c3('0x47')],_0x5e9868));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x8fcd=['EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','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','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','exports','util','lodash','events','EventEmitter','./reply','call','setEncoding','headers','emit','hangup','search','520\x20End\x20of\x20proper','substring','no\x20code','replace','indexOf','substr','split','length','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','sendRequest','command','sync','answer','prototype','beep','format','noop','VERBOSE\x20\x22%s\x22','exec','isArray','join'];(function(_0x133937,_0x2ebfad){var _0x5e8947=function(_0x442ac5){while(--_0x442ac5){_0x133937['push'](_0x133937['shift']());}};_0x5e8947(++_0x2ebfad);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x4cb069,_0xfb9419){_0x4cb069=_0x4cb069-0x0;var _0x64367=_0x8fcd[_0x4cb069];return _0x64367;};'use strict';var util=require(_0xd8fc('0x0'));var _=require(_0xd8fc('0x1'));var EventEmitter=require(_0xd8fc('0x2'))[_0xd8fc('0x3')];var AGIReply=require(_0xd8fc('0x4'));var AGIError=require('./error');function AGIChannel(_0x5c7dba){var _0x353592=this,_0x36d5ad=new AGIReply(),_0x41aaf1=![],_0x2d5000={};EventEmitter[_0xd8fc('0x5')](_0x353592);_0x5c7dba[_0xd8fc('0x6')]('utf8');_0x5c7dba['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x36d5ad[_0xd8fc('0x6')]('utf8');_0x36d5ad['on'](_0xd8fc('0x7'),function(_0x1519e5){for(var _0x102bb8 in _0x1519e5){_0x353592[_0x102bb8]=_0x1519e5[_0x102bb8];}_0x353592[_0xd8fc('0x8')]('ready');});_0x36d5ad['on']('line',function(_0x16ef0c){if(_0x16ef0c['toLowerCase']()=='hangup'){_0x353592[_0xd8fc('0x8')](_0xd8fc('0x9'));return;}if(_0x16ef0c['substring'](0x0,0xb)=='520-Invalid'){_0x41aaf1=!![];}if(_0x41aaf1){_0x2d5000['rx']+=_0x16ef0c+'\x0a';if(_0x16ef0c[_0xd8fc('0xa')](_0xd8fc('0xb'))!=-0x1){_0x41aaf1=![];}}else{_0x2d5000['rx']=_0x16ef0c;}if(_0x41aaf1){return;}if(typeof _0x2d5000['cb']=='function'){var _0x3c41e9=_0x2d5000['rx'][_0xd8fc('0xc')](0x0,0x3),_0x955550=null,_0x2b9d7e=null;_0x3c41e9=parseInt(_0x3c41e9);if(isNaN(_0x3c41e9)){_0x2d5000['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xd8fc('0xd')});return;}if(_0x3c41e9!=0xc8){_0x2d5000['cb'](null,{'code':_0x3c41e9,'result':-0x1,'extra':'KO'});return;}_0x955550=_0x2d5000['rx']['substring'](0x4)[_0xd8fc('0xe')]('result=','');if(_0x955550[_0xd8fc('0xf')]('\x20')!=-0x1){_0x955550=_0x955550[_0xd8fc('0x10')](0x0,_0x955550[_0xd8fc('0xf')]('\x20'));}if(_['startsWith'](_0x955550,'-1')){_0x955550=parseInt(_0x955550);}_0x2b9d7e=_0x2d5000['rx'][_0xd8fc('0x11')]('\x20');if(_0x2b9d7e[_0xd8fc('0x12')]==0x3){_0x2b9d7e=_0x2b9d7e[0x2]['substring'](0x1,_0x2b9d7e[0x2]['length']-0x1);}else if(_0x2b9d7e[_0xd8fc('0x12')]>0x3){var _0x234b4d=/\((.+)\)/;var _0x111c5b=_0x2d5000['rx']['match'](_0x234b4d);if(_0x111c5b){_0x2b9d7e=_0x111c5b[0x1];}else{_0x2b9d7e=null;}}else{_0x2b9d7e=null;}_0x2d5000['cb'](null,{'code':_0x3c41e9,'result':_0x955550,'extra':_0x2b9d7e});}});_0x5c7dba['on'](_0xd8fc('0x13'),function(_0x1c744d){_0x353592[_0xd8fc('0x8')](_0xd8fc('0x13'),new AGIError(_0xd8fc('0x14'),_0x1c744d[_0xd8fc('0x15')]));});_0x5c7dba['on'](_0xd8fc('0x16'),function(){_0x353592[_0xd8fc('0x8')](_0xd8fc('0x16'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x5c7dba['on'](_0xd8fc('0x17'),function(){_0x353592[_0xd8fc('0x8')](_0xd8fc('0x17'),new AGIError(_0xd8fc('0x18')));_0x5c7dba[_0xd8fc('0x19')]();});_0x5c7dba[_0xd8fc('0x1a')](_0x36d5ad);this['command']=function(_0x202719,_0x3f0196){var _0x202719=_0x202719||'',_0x3f0196=typeof _0x3f0196=='function'?_0x3f0196:new Function();_0x2d5000={'tx':_0x202719,'rx':'','cb':_0x3f0196};_0x5c7dba[_0xd8fc('0x1b')](_0x202719+'\x0a');},this[_0xd8fc('0x16')]=function(){_0x5c7dba['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xd8fc('0x1c')]=function(_0x1539b0){return this[_0xd8fc('0x1d')][_0xd8fc('0x1e')](this,_0x1539b0);};AGIChannel['prototype'][_0xd8fc('0x1f')]=function(){return this[_0xd8fc('0x1c')]('ANSWER');};AGIChannel[_0xd8fc('0x20')]['getData']=function(_0x200a2b,_0x5afb99,_0x454a77){_0x200a2b=_0x200a2b===undefined?_0xd8fc('0x21'):_0x200a2b;_0x5afb99=_0x5afb99===undefined?'5':_0x5afb99;_0x454a77=_0x454a77===undefined?'1':_0x454a77;return this['sendRequest'](util[_0xd8fc('0x22')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x200a2b,_0x5afb99*0x3e8,_0x454a77));};AGIChannel[_0xd8fc('0x20')][_0xd8fc('0x23')]=function(_0x4e823d){_0x4e823d=_0x4e823d||'NO\x20MESSAGE';return this['sendRequest'](util[_0xd8fc('0x22')](_0xd8fc('0x24'),_0x4e823d));};AGIChannel[_0xd8fc('0x20')][_0xd8fc('0x25')]=function(_0x28c80d,_0x281559){if(_[_0xd8fc('0x26')](_0x281559)){return this[_0xd8fc('0x1c')](util[_0xd8fc('0x22')]('EXEC\x20%s\x20%s',_0x28c80d,_0x281559[_0xd8fc('0x27')](',')));}return this[_0xd8fc('0x1c')](util['format'](_0xd8fc('0x28'),_0x28c80d,_0x281559));};AGIChannel[_0xd8fc('0x20')][_0xd8fc('0x29')]=function(_0x49a432){return this[_0xd8fc('0x1c')](util[_0xd8fc('0x22')](_0xd8fc('0x2a'),_0x49a432));};AGIChannel['prototype']['setExtension']=function(_0x4a2efa){return this[_0xd8fc('0x1c')](util[_0xd8fc('0x22')](_0xd8fc('0x2b'),_0x4a2efa));};AGIChannel[_0xd8fc('0x20')][_0xd8fc('0x2c')]=function(_0x441c59){return this[_0xd8fc('0x1c')](util[_0xd8fc('0x22')](_0xd8fc('0x2d'),_0x441c59));};AGIChannel[_0xd8fc('0x20')]['hangup']=function(){return this[_0xd8fc('0x1c')]('HANGUP');};AGIChannel[_0xd8fc('0x20')]['setVariable']=function(_0x500d5a,_0x4647fc){var _0x429281=_[_0xd8fc('0x2e')](_0x4647fc)||_[_0xd8fc('0x2f')](_0x4647fc)?_0x4647fc[_0xd8fc('0x30')]():_0x4647fc;return this[_0xd8fc('0x1c')](util['format'](_0xd8fc('0x31'),_0x500d5a,_0x429281?_0x429281[_0xd8fc('0x30')]()[_0xd8fc('0xe')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xd8fc('0x32')]=function(_0x356edf,_0x563a41){return this['sendRequest'](util[_0xd8fc('0x22')]('SAY\x20NUMBER\x20%s\x20%s',_0x356edf,_0x563a41));};AGIChannel[_0xd8fc('0x20')]['sayDigits']=function(_0x14955,_0x2cd726){return this[_0xd8fc('0x1c')](util['format'](_0xd8fc('0x33'),_0x14955,_0x2cd726));};AGIChannel['prototype'][_0xd8fc('0x34')]=function(_0x16f411,_0x597ea7){return this[_0xd8fc('0x1c')](util[_0xd8fc('0x22')](_0xd8fc('0x35'),_0x16f411,_0x597ea7));};AGIChannel[_0xd8fc('0x20')]['continueAt']=function(_0x3ba4fb,_0x1b709d,_0x301fd2){_0x1b709d=_0x1b709d||this['extension'];_0x301fd2=_0x301fd2||0x1;this['setContext'](_0x3ba4fb);this['setExtension'](_0x1b709d);this[_0xd8fc('0x2c')](_0x301fd2);return this[_0xd8fc('0x23')](util[_0xd8fc('0x22')](_0xd8fc('0x36'),_0x3ba4fb,_0x1b709d,_0x301fd2));};AGIChannel['prototype'][_0xd8fc('0x37')]=function(_0x145f37){return this[_0xd8fc('0x1c')](util[_0xd8fc('0x22')](_0xd8fc('0x38'),_0x145f37));};AGIChannel[_0xd8fc('0x20')][_0xd8fc('0x39')]=function(_0x5bc6fe,_0x4dedad,_0x1f0de2,_0x50c84e,_0xa1de09,_0x33c74f){_0x4dedad=_0x4dedad||_0xd8fc('0x3a');_0x1f0de2=_0x1f0de2||'';_0x50c84e=_0x50c84e===undefined?-0x1:_0x50c84e==='-1'?-0x1:_0x50c84e*0x3e8;_0xa1de09=_0xa1de09===undefined?'':'s='+_0xa1de09;_0x33c74f=_0x33c74f?_0xd8fc('0x3b'):'';return this[_0xd8fc('0x1c')](util[_0xd8fc('0x22')](_0xd8fc('0x3c'),_0x5bc6fe,_0x4dedad,_0x1f0de2,_0x50c84e,_0x33c74f,_0xa1de09));};AGIChannel[_0xd8fc('0x20')][_0xd8fc('0x3d')]=function(_0x2e51ee,_0x3e1392){_0x3e1392=_0x3e1392||'';return this[_0xd8fc('0x1c')](util[_0xd8fc('0x22')](_0xd8fc('0x3e'),_0x2e51ee,_0x3e1392));};AGIChannel['prototype']['agi']=function(_0x498c5c){return this[_0xd8fc('0x25')](_0xd8fc('0x3f'),_0x498c5c);};AGIChannel[_0xd8fc('0x20')][_0xd8fc('0x40')]=function(_0x580668){return this[_0xd8fc('0x25')](_0xd8fc('0x41'),_0x580668);};AGIChannel[_0xd8fc('0x20')][_0xd8fc('0x13')]=function(_0x3631f9,_0x19b43e){this[_0xd8fc('0x23')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3631f9['id'],_0x3631f9['label'],_0x19b43e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xd8fc('0x42')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 457dbdc..bd90be5 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 _0xdd51=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x5edafc,_0x22002c){var _0x1fa600=function(_0x5dc143){while(--_0x5dc143){_0x5edafc['push'](_0x5edafc['shift']());}};_0x1fa600(++_0x22002c);}(_0xdd51,0xdf));var _0x1dd5=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xdd51[_0x411add];return _0x238242;};'use strict';var util=require(_0x1dd5('0x0'));var error={'E_AGI_UNDEFINED':_0x1dd5('0x1'),'E_AGI_ARGUMENT_PORT':_0x1dd5('0x2'),'E_AGI_SERVER_ERROR':_0x1dd5('0x3'),'E_AGI_SERVER_CLOSE':_0x1dd5('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x1dd5('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x1dd5('0x6'),'E_AGI_SOCKET_CLOSE':_0x1dd5('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x1dd5('0x8'),'E_AGI_COMMAND_EMPTY':_0x1dd5('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1dd5('0xa'),'E_AGI_IVR_ENTRY':_0x1dd5('0xb')};function AGIError(_0x5baf3f){var _0x5baf3f=_0x5baf3f||null,_0x587be0=_0x587be0||[],_0x2c0861=0x1,_0x1258ff='';if(!error[_0x5baf3f]){_0x5baf3f=_0x1dd5('0xc');}_0x587be0[_0x1dd5('0xd')](error[_0x5baf3f]);while(arguments[_0x2c0861]){_0x587be0[_0x1dd5('0xd')](arguments[_0x2c0861]);_0x2c0861++;}_0x1258ff=util[_0x1dd5('0xe')][_0x1dd5('0xf')](util,_0x587be0);this[_0x1dd5('0x10')]=_0x1258ff;this[_0x1dd5('0x11')]=_0x5baf3f;}module['exports']=AGIError; \ No newline at end of file +var _0xfd47=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x339b42,_0x3ae3b8){var _0x4b68d0=function(_0x297d4e){while(--_0x297d4e){_0x339b42['push'](_0x339b42['shift']());}};_0x4b68d0(++_0x3ae3b8);}(_0xfd47,0x1d9));var _0x7fd4=function(_0x3f0939,_0x1da40f){_0x3f0939=_0x3f0939-0x0;var _0x359cb2=_0xfd47[_0x3f0939];return _0x359cb2;};'use strict';var util=require(_0x7fd4('0x0'));var error={'E_AGI_UNDEFINED':_0x7fd4('0x1'),'E_AGI_ARGUMENT_PORT':_0x7fd4('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x7fd4('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x7fd4('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x7fd4('0x5'),'E_AGI_SOCKET_ERROR':_0x7fd4('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x7fd4('0x7'),'E_AGI_COMMAND_EMPTY':_0x7fd4('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x7fd4('0x9')};function AGIError(_0x18d1cb){var _0x18d1cb=_0x18d1cb||null,_0x5eaf4b=_0x5eaf4b||[],_0x214ca2=0x1,_0x55e923='';if(!error[_0x18d1cb]){_0x18d1cb='E_AGI_UNDEFINED';}_0x5eaf4b[_0x7fd4('0xa')](error[_0x18d1cb]);while(arguments[_0x214ca2]){_0x5eaf4b[_0x7fd4('0xa')](arguments[_0x214ca2]);_0x214ca2++;}_0x55e923=util[_0x7fd4('0xb')][_0x7fd4('0xc')](util,_0x5eaf4b);this[_0x7fd4('0xd')]=_0x55e923;this[_0x7fd4('0xe')]=_0x18d1cb;}module[_0x7fd4('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index bc58f6e..f34f211 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 _0xac17=['emit','error','E_AGI_SERVER_ERROR','message','parse','exports','lodash','events','EventEmitter','ioredis','./error','redis','localhost','subscribe','agi'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xac17,0x8d));var _0x7ac1=function(_0xa711b,_0x81a280){_0xa711b=_0xa711b-0x0;var _0x1f061d=_0xac17[_0xa711b];return _0x1f061d;};'use strict';var _=require(_0x7ac1('0x0'));var EventEmitter=require(_0x7ac1('0x1'))[_0x7ac1('0x2')];var Redis=require(_0x7ac1('0x3'));var AGIError=require(_0x7ac1('0x4'));var config=require('../../config/environment');config[_0x7ac1('0x5')]=_['defaults'](config[_0x7ac1('0x5')],{'host':_0x7ac1('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x7ac1('0x7')](_0x7ac1('0x8'),function(_0x3f68ac){if(_0x3f68ac)return eventEmitter[_0x7ac1('0x9')](_0x7ac1('0xa'),new AGIError(_0x7ac1('0xb'),_0x3f68ac));});sub['on'](_0x7ac1('0xc'),function(_0x3a704c,_0x1ba5cd){if(_0x3a704c!==_0x7ac1('0x8'))return;try{var _0x55b271=JSON[_0x7ac1('0xd')](_0x1ba5cd);eventEmitter[_0x7ac1('0x9')]('projectUpdate',_0x55b271);}catch(_0x467464){eventEmitter[_0x7ac1('0x9')](_0x7ac1('0xa'),new AGIError(_0x7ac1('0xb'),_0x467464));}});module[_0x7ac1('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x72de=['lodash','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','agi','error','message','emit','E_AGI_SERVER_ERROR','exports'];(function(_0x283c87,_0x545688){var _0xde4143=function(_0x187b8d){while(--_0x187b8d){_0x283c87['push'](_0x283c87['shift']());}};_0xde4143(++_0x545688);}(_0x72de,0x1ea));var _0xe72d=function(_0x20b10e,_0xdba420){_0x20b10e=_0x20b10e-0x0;var _0x537c68=_0x72de[_0x20b10e];return _0x537c68;};'use strict';var _=require(_0xe72d('0x0'));var EventEmitter=require('events')[_0xe72d('0x1')];var Redis=require(_0xe72d('0x2'));var AGIError=require(_0xe72d('0x3'));var config=require(_0xe72d('0x4'));config[_0xe72d('0x5')]=_[_0xe72d('0x6')](config[_0xe72d('0x5')],{'host':_0xe72d('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xe72d('0x5')]);sub['subscribe'](_0xe72d('0x8'),function(_0x21ffd5){if(_0x21ffd5)return eventEmitter['emit'](_0xe72d('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x21ffd5));});sub['on'](_0xe72d('0xa'),function(_0x465389,_0x198726){if(_0x465389!==_0xe72d('0x8'))return;try{var _0x374b29=JSON['parse'](_0x198726);eventEmitter[_0xe72d('0xb')]('projectUpdate',_0x374b29);}catch(_0x41b0a2){eventEmitter[_0xe72d('0xb')]('error',new AGIError(_0xe72d('0xc'),_0x41b0a2));}});module[_0xe72d('0xd')]={'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 1ef4415..9d5564c 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 _0x56c7=['edges','numberOfEdges','prototype','addEdge','push','size','relations','traverseBFS','info','no\x20vertex\x20found','no\x20edge/s\x20available','length','condition','split','vswitch','target','default','agicommand','invalid','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices'];(function(_0x4b9fd4,_0x3a679e){var _0x112c49=function(_0x18c7bf){while(--_0x18c7bf){_0x4b9fd4['push'](_0x4b9fd4['shift']());}};_0x112c49(++_0x3a679e);}(_0x56c7,0xe9));var _0x756c=function(_0x296144,_0x26bbbf){_0x296144=_0x296144-0x0;var _0x5329b1=_0x56c7[_0x296144];return _0x5329b1;};'use strict';var _=require(_0x756c('0x0'));var logger=require(_0x756c('0x1'))(_0x756c('0x2'));var verticesWithRetry=[_0x756c('0x3'),_0x756c('0x4'),_0x756c('0x5')];var Graph=function(){this[_0x756c('0x6')]={};this[_0x756c('0x7')]={};this[_0x756c('0x8')]=0x0;};Graph[_0x756c('0x9')]['addVertex']=function(_0x3ff9c7){this[_0x756c('0x6')][_0x3ff9c7['id']]=_0x3ff9c7;this[_0x756c('0x7')][_0x3ff9c7['id']]=[];};Graph['prototype'][_0x756c('0xa')]=function(_0x277509,_0x446409,_0x294ffd){this[_0x756c('0x7')][_0x277509][_0x756c('0xb')]({'target':_0x446409,'condition':_0x294ffd});this['numberOfEdges']+=0x1;};Graph[_0x756c('0x9')][_0x756c('0xc')]=function(){return _[_0x756c('0xc')](this[_0x756c('0x6')]);};Graph['prototype'][_0x756c('0xd')]=function(){return this['numberOfEdges'];};Graph['prototype']['getVertex']=function(_0x53e380){return this[_0x756c('0x6')][_0x53e380];};Graph[_0x756c('0x9')][_0x756c('0xe')]=function(_0x2b7a4c,_0x264ffe){if(!this[_0x756c('0x6')][_0x2b7a4c]){return logger[_0x756c('0xf')](_0x756c('0x10'));}var _0x3ab4d6=_0x264ffe(this[_0x756c('0x6')][_0x2b7a4c]);if(!_0x3ab4d6){return logger['info']('stop\x20traverse');}if(this[_0x756c('0x7')][_0x2b7a4c]['length']===0x0){return logger[_0x756c('0xf')](_0x756c('0x11'));}for(var _0x2c481e=0x0,_0x1f65e4=[],_0x3ee4c4=![];_0x2c481e\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','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','close','evtHangup','find','handleNotFound','handleUnpublished','initialize','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb186,0xe7));var _0x6b18=function(_0x2f9d83,_0xfbc7e7){_0x2f9d83=_0x2f9d83-0x0;var _0x112d5f=_0xb186[_0x2f9d83];return _0x112d5f;};'use strict';var _=require(_0x6b18('0x0'));var syncho=require(_0x6b18('0x1'));var util=require(_0x6b18('0x2'));var config=require(_0x6b18('0x3'));var logger=require(_0x6b18('0x4'))(_0x6b18('0x5'));var utilLicense=require(_0x6b18('0x6'));var rpc=require(_0x6b18('0x7'));var Project=require(_0x6b18('0x8'));var AGIEmitter=require('./events')[_0x6b18('0x9')];var projects=[];config[_0x6b18('0x5')]=_[_0x6b18('0xa')](config[_0x6b18('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x6b18('0xb'),projectUpdateHandler);function connectionHandler(_0x12811e){process[_0x6b18('0xc')](function(){syncho(function(){try{setChannelVariables(_0x12811e);agiHandler(_0x12811e);}catch(_0x407412){logger[_0x6b18('0xd')](_0x407412['stack']);}});});}function projectUpdateHandler(_0x368414){try{var _0x15c262=_[_0x6b18('0xe')](projects,['id',_0x368414['id']]);if(_0x15c262>-0x1){if(_0x368414[_0x6b18('0xf')]===!![]){projects[_0x6b18('0x10')](_0x15c262,0x1);}else{projects[_0x15c262]=_0x368414;}}else{projects[_0x6b18('0x11')](_0x368414);}}catch(_0x3abe1a){logger['error'](_0x3abe1a[_0x6b18('0x12')]);}}function listeningHandler(){console[_0x6b18('0x13')](_0x6b18('0x14'),config[_0x6b18('0x5')]['port']);logger[_0x6b18('0x15')](util[_0x6b18('0x16')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x6b18('0x5')]['ip'],config['agi'][_0x6b18('0x17')]));}function errorHandler(_0x2a396d){if(_0x2a396d&&_0x2a396d[_0x6b18('0x18')]&&_0x2a396d['message']){logger['error'](util[_0x6b18('0x16')](_0x6b18('0x19'),_0x2a396d[_0x6b18('0x18')],_0x2a396d[_0x6b18('0x1a')]));}else{logger[_0x6b18('0xd')](util[_0x6b18('0x16')](_0x6b18('0x1b'),_0x2a396d[_0x6b18('0x12')]));}}function closeHandler(){logger[_0x6b18('0x15')](util[_0x6b18('0x16')](_0x6b18('0x1c'),this[_0x6b18('0x1d')],this[_0x6b18('0x1e')],this[_0x6b18('0x1f')],this['dnid'],this[_0x6b18('0x20')]));try{createSquareReport(this);}catch(_0x4984af){logger[_0x6b18('0xd')](_0x4984af['stack']);}}function timeoutHandler(){logger[_0x6b18('0x15')](util['format'](_0x6b18('0x21'),this[_0x6b18('0x1d')],this['calleridname'],this['callerid'],this[_0x6b18('0x22')],this[_0x6b18('0x20')]));}function hangupHandler(){logger[_0x6b18('0x15')](util[_0x6b18('0x16')](_0x6b18('0x23'),this[_0x6b18('0x1d')],this[_0x6b18('0x1e')],this[_0x6b18('0x1f')],this['dnid'],this[_0x6b18('0x20')]));this['evtHangup']=!![];}function createSquareReport(_0x246253,_0xa4cdd){rpc['createSquareReport'](_0x246253)['then'](function(_0x25250a){if(_0xa4cdd){_0xa4cdd(null,_0x25250a);}})[_0x6b18('0x24')](function(_0x1869bb){if(_0xa4cdd){_0xa4cdd(null,_0x1869bb);}});}function setChannelVariables(_0x299564){for(var _0x39a114 in _0x299564){if(_0x299564[_0x6b18('0x25')](_0x39a114)){if(_0x39a114[_0x6b18('0x26')](_0x6b18('0x27'))===0x0){_0x299564[_0x39a114[_0x6b18('0x28')](0x4)]=_0x299564[_0x39a114];delete _0x299564[_0x39a114];}}}}function agiHandler(_0x49b712){logger[_0x6b18('0x29')](_0x6b18('0x2a'),JSON['stringify'](_0x49b712,null,0x2));logger[_0x6b18('0x15')](util[_0x6b18('0x16')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x49b712[_0x6b18('0x1d')],_0x49b712[_0x6b18('0x1e')],_0x49b712[_0x6b18('0x1f')],_0x49b712[_0x6b18('0x22')],_0x49b712['uniqueid']));_0x49b712['on'](_0x6b18('0xd'),errorHandler);_0x49b712['on'](_0x6b18('0x2b'),closeHandler);_0x49b712['on']('timeout',timeoutHandler);_0x49b712[_0x6b18('0x2c')]=![];_0x49b712['on']('hangup',hangupHandler);var _0x4e80db=_[_0x6b18('0x2d')](projects,[_0x6b18('0x18'),_0x49b712[_0x6b18('0x1d')]]);if(!_0x4e80db)return Project[_0x6b18('0x2e')](_0x49b712);if(!_0x4e80db['production'])return Project[_0x6b18('0x2f')](_0x49b712);return Project[_0x6b18('0x30')](_0x4e80db,_0x49b712);}function main(){var _0x3942df;return utilLicense[_0x6b18('0x31')]()[_0x6b18('0x32')](function(_0x5116a){if(!_0x5116a)return;if(_0x5116a[_0x6b18('0x33')]){if(_0x5116a[_0x6b18('0x34')]&&_0x5116a[_0x6b18('0x34')]>0x0){logger[_0x6b18('0x15')](util[_0x6b18('0x16')](_0x6b18('0x35'),_0x5116a[_0x6b18('0x34')]));_0x3942df=_0x5116a[_0x6b18('0x34')];}else{logger[_0x6b18('0x15')](_0x6b18('0x36'));}}else{logger[_0x6b18('0x15')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x3942df=-0x1;}})['then'](function(){return Project['getAll']();})[_0x6b18('0x32')](function(_0x660041){projects=_0x660041;return;})[_0x6b18('0x24')](function(_0x38b26e){logger['error'](_0x6b18('0x37'),_0x38b26e['stack']);})[_0x6b18('0x38')](function(){var _0x39d05c=require(_0x6b18('0x39'))(config[_0x6b18('0x5')][_0x6b18('0x17')],config['agi']['ip'],_0x3942df);_0x39d05c['on'](_0x6b18('0xd'),errorHandler);_0x39d05c['on'](_0x6b18('0x3a'),listeningHandler);_0x39d05c['on'](_0x6b18('0x3b'),connectionHandler);_0x39d05c['on'](_0x6b18('0x2b'),closeHandler);});}main(); \ No newline at end of file +var _0x583a=['dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','hasOwnProperty','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','handleNotFound','production','initialize','getLicense','then','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','EventEmitter','projectUpdate','stack','deleted','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid'];(function(_0x5271a3,_0x62c5b9){var _0x128054=function(_0x1feec2){while(--_0x1feec2){_0x5271a3['push'](_0x5271a3['shift']());}};_0x128054(++_0x62c5b9);}(_0x583a,0x18d));var _0xa583=function(_0x3caeb5,_0x219363){_0x3caeb5=_0x3caeb5-0x0;var _0x5eca7e=_0x583a[_0x3caeb5];return _0x5eca7e;};'use strict';var _=require(_0xa583('0x0'));var syncho=require(_0xa583('0x1'));var util=require(_0xa583('0x2'));var config=require(_0xa583('0x3'));var logger=require(_0xa583('0x4'))(_0xa583('0x5'));var utilLicense=require(_0xa583('0x6'));var rpc=require(_0xa583('0x7'));var Project=require(_0xa583('0x8'));var AGIEmitter=require('./events')[_0xa583('0x9')];var projects=[];config['agi']=_['defaults'](config[_0xa583('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xa583('0xa'),projectUpdateHandler);function connectionHandler(_0x5f4af9){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5f4af9);agiHandler(_0x5f4af9);}catch(_0x4c9e55){logger['error'](_0x4c9e55[_0xa583('0xb')]);}});});}function projectUpdateHandler(_0x3317bc){try{var _0x358844=_['findIndex'](projects,['id',_0x3317bc['id']]);if(_0x358844>-0x1){if(_0x3317bc[_0xa583('0xc')]===!![]){projects['splice'](_0x358844,0x1);}else{projects[_0x358844]=_0x3317bc;}}else{projects['push'](_0x3317bc);}}catch(_0x254d52){logger[_0xa583('0xd')](_0x254d52[_0xa583('0xb')]);}}function listeningHandler(){console[_0xa583('0xe')](_0xa583('0xf'),config[_0xa583('0x5')][_0xa583('0x10')]);logger[_0xa583('0x11')](util[_0xa583('0x12')](_0xa583('0x13'),config['agi']['ip'],config[_0xa583('0x5')][_0xa583('0x10')]));}function errorHandler(_0x4fdcc3){if(_0x4fdcc3&&_0x4fdcc3[_0xa583('0x14')]&&_0x4fdcc3[_0xa583('0x15')]){logger[_0xa583('0xd')](util['format'](_0xa583('0x16'),_0x4fdcc3[_0xa583('0x14')],_0x4fdcc3['message']));}else{logger[_0xa583('0xd')](util[_0xa583('0x12')]('[ERROR]\x20%s',_0x4fdcc3[_0xa583('0xb')]));}}function closeHandler(){logger['info'](util['format'](_0xa583('0x17'),this[_0xa583('0x18')],this[_0xa583('0x19')],this[_0xa583('0x1a')],this[_0xa583('0x1b')],this[_0xa583('0x1c')]));try{createSquareReport(this);}catch(_0x2c73c8){logger[_0xa583('0xd')](_0x2c73c8[_0xa583('0xb')]);}}function timeoutHandler(){logger[_0xa583('0x11')](util[_0xa583('0x12')](_0xa583('0x1d'),this[_0xa583('0x18')],this[_0xa583('0x19')],this['callerid'],this[_0xa583('0x1b')],this[_0xa583('0x1c')]));}function hangupHandler(){logger[_0xa583('0x11')](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xa583('0x18')],this['calleridname'],this[_0xa583('0x1a')],this[_0xa583('0x1b')],this[_0xa583('0x1c')]));this[_0xa583('0x1e')]=!![];}function createSquareReport(_0x44d702,_0x3fa88b){rpc[_0xa583('0x1f')](_0x44d702)['then'](function(_0x25d007){if(_0x3fa88b){_0x3fa88b(null,_0x25d007);}})[_0xa583('0x20')](function(_0x3362d3){if(_0x3fa88b){_0x3fa88b(null,_0x3362d3);}});}function setChannelVariables(_0x479311){for(var _0xd48e57 in _0x479311){if(_0x479311[_0xa583('0x21')](_0xd48e57)){if(_0xd48e57['indexOf']('agi_')===0x0){_0x479311[_0xd48e57[_0xa583('0x22')](0x4)]=_0x479311[_0xd48e57];delete _0x479311[_0xd48e57];}}}}function agiHandler(_0x170165){logger[_0xa583('0x23')]('variables',JSON[_0xa583('0x24')](_0x170165,null,0x2));logger[_0xa583('0x11')](util['format'](_0xa583('0x25'),_0x170165[_0xa583('0x18')],_0x170165['calleridname'],_0x170165[_0xa583('0x1a')],_0x170165[_0xa583('0x1b')],_0x170165[_0xa583('0x1c')]));_0x170165['on']('error',errorHandler);_0x170165['on']('close',closeHandler);_0x170165['on'](_0xa583('0x26'),timeoutHandler);_0x170165['evtHangup']=![];_0x170165['on'](_0xa583('0x27'),hangupHandler);var _0x5ec972=_['find'](projects,[_0xa583('0x14'),_0x170165[_0xa583('0x18')]]);if(!_0x5ec972)return Project[_0xa583('0x28')](_0x170165);if(!_0x5ec972[_0xa583('0x29')])return Project['handleUnpublished'](_0x170165);return Project[_0xa583('0x2a')](_0x5ec972,_0x170165);}function main(){var _0x38271b;return utilLicense[_0xa583('0x2b')]()[_0xa583('0x2c')](function(_0xb032d6){if(!_0xb032d6)return;if(_0xb032d6['voice']){if(_0xb032d6['callysquare']&&_0xb032d6[_0xa583('0x2d')]>0x0){logger[_0xa583('0x11')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0xb032d6[_0xa583('0x2d')]));_0x38271b=_0xb032d6['callysquare'];}else{logger['info'](_0xa583('0x2e'));}}else{logger[_0xa583('0x11')](_0xa583('0x2f'));_0x38271b=-0x1;}})[_0xa583('0x2c')](function(){return Project[_0xa583('0x30')]();})[_0xa583('0x2c')](function(_0x628078){projects=_0x628078;return;})[_0xa583('0x20')](function(_0x34666d){logger[_0xa583('0xd')](_0xa583('0x31'),_0x34666d['stack']);})[_0xa583('0x32')](function(){var _0x5a7240=require('./server')(config[_0xa583('0x5')][_0xa583('0x10')],config['agi']['ip'],_0x38271b);_0x5a7240['on'](_0xa583('0xd'),errorHandler);_0x5a7240['on'](_0xa583('0x33'),listeningHandler);_0x5a7240['on'](_0xa583('0x34'),connectionHandler);_0x5a7240['on']('close',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 f127c4c..64c9b4e 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 _0x02f7=['jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x4d62bc,_0x393272){var _0x1dea32=function(_0x50cae8){while(--_0x50cae8){_0x4d62bc['push'](_0x4d62bc['shift']());}};_0x1dea32(++_0x393272);}(_0x02f7,0x107));var _0x702f=function(_0x52b169,_0x30b73c){_0x52b169=_0x52b169-0x0;var _0x23d3f1=_0x02f7[_0x52b169];return _0x23d3f1;};'use strict';var BPromise=require(_0x702f('0x0'));var jayson=require(_0x702f('0x1'));var client=jayson[_0x702f('0x2')][_0x702f('0x3')]({'port':0x232b});function request(_0x5cba74,_0x5848cf){return new BPromise(function(_0x3fc2ec,_0x31a153){return client[_0x702f('0x4')](_0x5cba74,_0x5848cf)[_0x702f('0x5')](function(_0x3c0a66){if(_0x3c0a66['error']){return _0x31a153(_0x3c0a66[_0x702f('0x6')]['message']);}else{return _0x3fc2ec(_0x3c0a66[_0x702f('0x7')]);}})[_0x702f('0x8')](function(_0x5ecde5){return _0x31a153(_0x5ecde5);});});}exports[_0x702f('0x9')]=function(_0x2c8022,_0x1bb070){return request(_0x702f('0xa'),{'account':_0x2c8022,'message':_0x1bb070});}; \ No newline at end of file +var _0x030c=['result','catch','sendMailMessage','SendMail','request','then','error','message'];(function(_0x8d9399,_0x490955){var _0x5a0645=function(_0x404d19){while(--_0x404d19){_0x8d9399['push'](_0x8d9399['shift']());}};_0x5a0645(++_0x490955);}(_0x030c,0xf4));var _0xc030=function(_0x6b57b5,_0x6386ca){_0x6b57b5=_0x6b57b5-0x0;var _0x127d96=_0x030c[_0x6b57b5];return _0x127d96;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x32f0d9,_0x1a5fe1){return new BPromise(function(_0x27dc94,_0x1555b0){return client[_0xc030('0x0')](_0x32f0d9,_0x1a5fe1)[_0xc030('0x1')](function(_0x2b4eeb){if(_0x2b4eeb[_0xc030('0x2')]){return _0x1555b0(_0x2b4eeb[_0xc030('0x2')][_0xc030('0x3')]);}else{return _0x27dc94(_0x2b4eeb[_0xc030('0x4')]);}})[_0xc030('0x5')](function(_0x5e077e){return _0x1555b0(_0x5e077e);});});}exports[_0xc030('0x6')]=function(_0x2f97c0,_0x226c19){return request(_0xc030('0x7'),{'account':_0x2f97c0,'message':_0x226c19});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 0bb3a0f..0cecdf9 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 _0x7993=['info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','stack','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','lodash','moment','util','../../config/logger','./graph','./vertices','getSquareProjects','error','agicommand','hasOwnProperty','retry','omit','length','source','target','value','toJson','root','start','debug','joinAt','mxCell'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7993,0x1b5));var _0x3799=function(_0x4f095b,_0x323b5d){_0x4f095b=_0x4f095b-0x0;var _0x44efa9=_0x7993[_0x4f095b];return _0x44efa9;};'use strict';var _=require(_0x3799('0x0'));var moment=require(_0x3799('0x1'));var parser=require('xml2json');var util=require(_0x3799('0x2'));var logger=require(_0x3799('0x3'))('agi');var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x3799('0x4'));var Vertices=require(_0x3799('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x3799('0x6')]()['catch'](function(_0x4152f4){logger[_0x3799('0x7')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x4152f4['stack']);return[];});}function addVertex(_0x384e78,_0x4df6be,_0x2aadbc){_0x4df6be[_0x3799('0x8')]=_0x2aadbc;if(_0x4df6be[_0x3799('0x9')](_0x3799('0xa'))){_0x4df6be['maxRetry']=parseInt(_0x4df6be[_0x3799('0xa')],0xa);}_0x384e78['addVertex'](_[_0x3799('0xb')](_0x4df6be,'mxCell'));}function initGraph(_0x363286,_0x106c8b){var _0x2f56bd=new Graph();for(var _0x509fea in _0x363286){if(_0x363286[_0x3799('0x9')](_0x509fea)){if(_['isArray'](_0x363286[_0x509fea])){for(var _0x5ce648=0x0;_0x5ce648<_0x363286[_0x509fea]['length'];_0x5ce648+=0x1){addVertex(_0x2f56bd,_0x363286[_0x509fea][_0x5ce648],_0x509fea);}}else{addVertex(_0x2f56bd,_0x363286[_0x509fea],_0x509fea);}}}for(var _0x49d2c6=0x0;_0x49d2c6<_0x106c8b[_0x3799('0xc')];_0x49d2c6+=0x1){if(_0x106c8b[_0x49d2c6][_0x3799('0xd')]&&_0x106c8b[_0x49d2c6][_0x3799('0xe')]){_0x2f56bd['addEdge'](_0x106c8b[_0x49d2c6][_0x3799('0xd')],_0x106c8b[_0x49d2c6]['target'],_0x106c8b[_0x49d2c6][_0x3799('0xf')]);}}return _0x2f56bd;}function getRoot(_0x2a2644){return parser[_0x3799('0x10')](_0x2a2644,{'object':!![]})['mxGraphModel'][_0x3799('0x11')];}function inspect(_0x10bf9c){return util['inspect'](_0x10bf9c,{'showHidden':![],'depth':null});}function initialize(_0x33ff37,_0x551e7c){var _0x2e4522=getRoot(_0x33ff37['production']);if(!_0x2e4522||!_0x2e4522[_0x3799('0x12')])return;var _0x343819,_0x4629fd,_0x7ac707;logger[_0x3799('0x13')](_0x3799('0x11'),JSON['stringify'](_0x2e4522,null,0x2));_0x551e7c[_0x3799('0x14')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x343819=initGraph(_[_0x3799('0xb')](_0x2e4522,_0x3799('0x15')),_0x2e4522[_0x3799('0x15')]);_0x4629fd=new Vertices(_0x551e7c,rpc,mailRpc);logger[_0x3799('0x16')](util[_0x3799('0x17')](_0x3799('0x18'),_0x551e7c[_0x3799('0x19')],_0x551e7c[_0x3799('0x1a')],_0x551e7c[_0x3799('0x1b')],_0x551e7c[_0x3799('0x1c')],_0x551e7c[_0x3799('0x1d')]));_0x343819[_0x3799('0x1e')](_0x2e4522[_0x3799('0x12')]['id'],function(_0x1b3b9a){try{_0x1b3b9a=_0x4629fd['clear'](_0x1b3b9a);logger['debug']('vertex',JSON[_0x3799('0x1f')](_0x1b3b9a,null,0x2));if(_0x1b3b9a[_0x3799('0x8')]===_0x3799('0x20')){logger['info'](_0x3799('0x21'));_0x551e7c[_0x3799('0x22')]=_0x1b3b9a[_0x3799('0x22')]||_0x551e7c[_0x3799('0x22')];_0x551e7c[_0x3799('0x23')]=_0x1b3b9a[_0x3799('0x23')];_0x551e7c['priority']=_0x1b3b9a['priority']?_0x1b3b9a[_0x3799('0x24')]-0x1:0x1;return null;}else if(_0x1b3b9a&&_0x4629fd[_0x1b3b9a[_0x3799('0x8')]]){_0x7ac707=_0x4629fd[_0x1b3b9a[_0x3799('0x8')]](_0x1b3b9a);logger['info'](_0x3799('0x25'),JSON[_0x3799('0x1f')](_0x7ac707,null,0x2));if(_0x7ac707&&_0x7ac707[_0x3799('0x26')]===AGI_CODE_SUCCESS&&_0x7ac707['result']!==AGI_RESULT_ERROR&&!_0x551e7c['evtHangup']){logger['debug'](_0x3799('0x25'),inspect(_0x7ac707));return _[_0x3799('0x27')](_0x7ac707[_0x3799('0x28')])?null:_0x7ac707[_0x3799('0x28')][_0x3799('0x29')]();}else{logger[_0x3799('0x7')](_0x3799('0x25'),inspect(_0x7ac707));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x53ec99){logger[_0x3799('0x7')](_0x53ec99['stack']);return null;}});if(_0x2e4522[_0x3799('0x2a')]){logger[_0x3799('0x16')](util[_0x3799('0x17')](_0x3799('0x2b'),_0x551e7c[_0x3799('0x19')],_0x551e7c[_0x3799('0x1a')],_0x551e7c['callerid'],_0x551e7c[_0x3799('0x1c')],_0x551e7c[_0x3799('0x1d')]));_0x343819[_0x3799('0x1e')](_0x2e4522[_0x3799('0x2a')]['id'],function(_0x27c441){try{_0x27c441=_0x4629fd['clear'](_0x27c441);logger[_0x3799('0x13')](_0x3799('0x2c'),JSON[_0x3799('0x1f')](_0x27c441,null,0x2));if(_0x27c441&&_0x4629fd[_0x27c441[_0x3799('0x8')]]){_0x7ac707=_0x4629fd[_0x27c441[_0x3799('0x8')]](_0x27c441);if(_0x7ac707){logger[_0x3799('0x13')](_0x3799('0x25'),inspect(_0x7ac707));return _[_0x3799('0x27')](_0x7ac707[_0x3799('0x28')])?null:_0x7ac707[_0x3799('0x28')][_0x3799('0x29')]();}else{logger['error'](_0x3799('0x25'),inspect(_0x7ac707));return null;}}else{logger[_0x3799('0x7')]('agicommand\x20not\x20found');return null;}}catch(_0x6f9b59){logger[_0x3799('0x7')](_0x6f9b59[_0x3799('0x2d')]);return null;}});}logger[_0x3799('0x16')](util[_0x3799('0x17')](_0x3799('0x2e'),_0x551e7c['arg_1'],_0x551e7c[_0x3799('0x1a')],_0x551e7c[_0x3799('0x1b')],_0x551e7c[_0x3799('0x1c')],_0x551e7c[_0x3799('0x1d')]));logger['info'](util[_0x3799('0x17')](_0x3799('0x2f'),_0x551e7c[_0x3799('0x22')],_0x551e7c[_0x3799('0x23')],parseInt(_0x551e7c[_0x3799('0x24')],0xa)+0x1));_0x551e7c[_0x3799('0x30')](_0x551e7c['context'],_0x551e7c['extension'],parseInt(_0x551e7c[_0x3799('0x24')],0xa)+0x1);_0x551e7c[_0x3799('0x31')]();}function handleNotFound(_0x4aca8a){logger[_0x3799('0x7')](util['format']('Project\x20%s\x20not\x20found',_0x4aca8a[_0x3799('0x19')]));_0x4aca8a[_0x3799('0x30')](_0x4aca8a['context'],_0x4aca8a[_0x3799('0x23')],parseInt(_0x4aca8a[_0x3799('0x24')],0xa)+0x1);_0x4aca8a['close']();}function handleUnpublished(_0x146768){logger[_0x3799('0x7')](util[_0x3799('0x17')](_0x3799('0x32'),_0x146768[_0x3799('0x19')]));_0x146768[_0x3799('0x30')](_0x146768[_0x3799('0x22')],_0x146768[_0x3799('0x23')],parseInt(_0x146768[_0x3799('0x24')],0xa)+0x1);_0x146768[_0x3799('0x31')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xd10e=['root','joinAt','format','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','traverseBFS','clear','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','isUndefined','result','agicommand\x20not\x20found','finally','calleridname','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','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','retry','maxRetry','omit','hasOwnProperty','isArray','length','source','target','value','toJson','inspect','production','debug'];(function(_0x1a9cc6,_0x11f87e){var _0x4961e5=function(_0xeddc0){while(--_0xeddc0){_0x1a9cc6['push'](_0x1a9cc6['shift']());}};_0x4961e5(++_0x11f87e);}(_0xd10e,0x1f2));var _0xed10=function(_0x3fb5eb,_0x5947a6){_0x3fb5eb=_0x3fb5eb-0x0;var _0x481291=_0xd10e[_0x3fb5eb];return _0x481291;};'use strict';var _=require('lodash');var moment=require(_0xed10('0x0'));var parser=require('xml2json');var util=require('util');var logger=require(_0xed10('0x1'))(_0xed10('0x2'));var rpc=require('./rpc');var mailRpc=require(_0xed10('0x3'));var Graph=require(_0xed10('0x4'));var Vertices=require(_0xed10('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xed10('0x6')]()[_0xed10('0x7')](function(_0x4717bc){logger[_0xed10('0x8')](_0xed10('0x9'),_0x4717bc['stack']);return[];});}function addVertex(_0x1d821b,_0x1f210b,_0x42f867){_0x1f210b[_0xed10('0xa')]=_0x42f867;if(_0x1f210b['hasOwnProperty'](_0xed10('0xb'))){_0x1f210b[_0xed10('0xc')]=parseInt(_0x1f210b[_0xed10('0xb')],0xa);}_0x1d821b['addVertex'](_[_0xed10('0xd')](_0x1f210b,'mxCell'));}function initGraph(_0xda9d3c,_0x259c48){var _0x33bb66=new Graph();for(var _0x373ccb in _0xda9d3c){if(_0xda9d3c[_0xed10('0xe')](_0x373ccb)){if(_[_0xed10('0xf')](_0xda9d3c[_0x373ccb])){for(var _0x873c5f=0x0;_0x873c5f<_0xda9d3c[_0x373ccb][_0xed10('0x10')];_0x873c5f+=0x1){addVertex(_0x33bb66,_0xda9d3c[_0x373ccb][_0x873c5f],_0x373ccb);}}else{addVertex(_0x33bb66,_0xda9d3c[_0x373ccb],_0x373ccb);}}}for(var _0x5e00ec=0x0;_0x5e00ec<_0x259c48['length'];_0x5e00ec+=0x1){if(_0x259c48[_0x5e00ec][_0xed10('0x11')]&&_0x259c48[_0x5e00ec][_0xed10('0x12')]){_0x33bb66['addEdge'](_0x259c48[_0x5e00ec][_0xed10('0x11')],_0x259c48[_0x5e00ec][_0xed10('0x12')],_0x259c48[_0x5e00ec][_0xed10('0x13')]);}}return _0x33bb66;}function getRoot(_0x40738e){return parser[_0xed10('0x14')](_0x40738e,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x5622b5){return util[_0xed10('0x15')](_0x5622b5,{'showHidden':![],'depth':null});}function initialize(_0x27e7cc,_0x1e366c){var _0x98bf12=getRoot(_0x27e7cc[_0xed10('0x16')]);if(!_0x98bf12||!_0x98bf12['start'])return;var _0x532045,_0x513cad,_0x2e2dfd;logger[_0xed10('0x17')](_0xed10('0x18'),JSON['stringify'](_0x98bf12,null,0x2));_0x1e366c[_0xed10('0x19')]=moment()[_0xed10('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');_0x532045=initGraph(_[_0xed10('0xd')](_0x98bf12,_0xed10('0x1b')),_0x98bf12[_0xed10('0x1b')]);_0x513cad=new Vertices(_0x1e366c,rpc,mailRpc);logger[_0xed10('0x1c')](util['format'](_0xed10('0x1d'),_0x1e366c[_0xed10('0x1e')],_0x1e366c['calleridname'],_0x1e366c[_0xed10('0x1f')],_0x1e366c[_0xed10('0x20')],_0x1e366c[_0xed10('0x21')]));_0x532045[_0xed10('0x22')](_0x98bf12['start']['id'],function(_0x181edc){try{_0x181edc=_0x513cad[_0xed10('0x23')](_0x181edc);logger[_0xed10('0x17')]('vertex',JSON[_0xed10('0x24')](_0x181edc,null,0x2));if(_0x181edc['agicommand']===_0xed10('0x25')){logger[_0xed10('0x1c')](_0xed10('0x26'));_0x1e366c[_0xed10('0x27')]=_0x181edc[_0xed10('0x27')]||_0x1e366c[_0xed10('0x27')];_0x1e366c[_0xed10('0x28')]=_0x181edc['extension'];_0x1e366c[_0xed10('0x29')]=_0x181edc[_0xed10('0x29')]?_0x181edc[_0xed10('0x29')]-0x1:0x1;return null;}else if(_0x181edc&&_0x513cad[_0x181edc[_0xed10('0xa')]]){_0x2e2dfd=_0x513cad[_0x181edc['agicommand']](_0x181edc);logger[_0xed10('0x1c')](_0xed10('0x2a'),JSON['stringify'](_0x2e2dfd,null,0x2));if(_0x2e2dfd&&_0x2e2dfd[_0xed10('0x2b')]===AGI_CODE_SUCCESS&&_0x2e2dfd['result']!==AGI_RESULT_ERROR&&!_0x1e366c[_0xed10('0x2c')]){logger[_0xed10('0x17')](_0xed10('0x2a'),inspect(_0x2e2dfd));return _[_0xed10('0x2d')](_0x2e2dfd['result'])?null:_0x2e2dfd[_0xed10('0x2e')]['toString']();}else{logger[_0xed10('0x8')](_0xed10('0x2a'),inspect(_0x2e2dfd));return null;}}else{logger[_0xed10('0x8')](_0xed10('0x2f'));return null;}}catch(_0xc0dadb){logger['error'](_0xc0dadb['stack']);return null;}});if(_0x98bf12[_0xed10('0x30')]){logger[_0xed10('0x1c')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1e366c[_0xed10('0x1e')],_0x1e366c[_0xed10('0x31')],_0x1e366c[_0xed10('0x1f')],_0x1e366c[_0xed10('0x20')],_0x1e366c['uniqueid']));_0x532045[_0xed10('0x22')](_0x98bf12[_0xed10('0x30')]['id'],function(_0x58ed86){try{_0x58ed86=_0x513cad[_0xed10('0x23')](_0x58ed86);logger['debug']('vertex',JSON[_0xed10('0x24')](_0x58ed86,null,0x2));if(_0x58ed86&&_0x513cad[_0x58ed86[_0xed10('0xa')]]){_0x2e2dfd=_0x513cad[_0x58ed86[_0xed10('0xa')]](_0x58ed86);if(_0x2e2dfd){logger[_0xed10('0x17')](_0xed10('0x2a'),inspect(_0x2e2dfd));return _[_0xed10('0x2d')](_0x2e2dfd[_0xed10('0x2e')])?null:_0x2e2dfd[_0xed10('0x2e')][_0xed10('0x32')]();}else{logger['error'](_0xed10('0x2a'),inspect(_0x2e2dfd));return null;}}else{logger[_0xed10('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x3b2214){logger[_0xed10('0x8')](_0x3b2214['stack']);return null;}});}logger['info'](util[_0xed10('0x1a')](_0xed10('0x33'),_0x1e366c['arg_1'],_0x1e366c['calleridname'],_0x1e366c['callerid'],_0x1e366c[_0xed10('0x20')],_0x1e366c[_0xed10('0x21')]));logger['info'](util[_0xed10('0x1a')](_0xed10('0x34'),_0x1e366c['context'],_0x1e366c[_0xed10('0x28')],parseInt(_0x1e366c['priority'],0xa)+0x1));_0x1e366c[_0xed10('0x35')](_0x1e366c['context'],_0x1e366c[_0xed10('0x28')],parseInt(_0x1e366c['priority'],0xa)+0x1);_0x1e366c[_0xed10('0x36')]();}function handleNotFound(_0x1f2596){logger[_0xed10('0x8')](util[_0xed10('0x1a')](_0xed10('0x37'),_0x1f2596[_0xed10('0x1e')]));_0x1f2596[_0xed10('0x35')](_0x1f2596[_0xed10('0x27')],_0x1f2596[_0xed10('0x28')],parseInt(_0x1f2596[_0xed10('0x29')],0xa)+0x1);_0x1f2596[_0xed10('0x36')]();}function handleUnpublished(_0xe15542){logger[_0xed10('0x8')](util[_0xed10('0x1a')](_0xed10('0x38'),_0xe15542[_0xed10('0x1e')]));_0xe15542[_0xed10('0x35')](_0xe15542[_0xed10('0x27')],_0xe15542[_0xed10('0x28')],parseInt(_0xe15542[_0xed10('0x29')],0xa)+0x1);_0xe15542[_0xed10('0x36')]();}module[_0xed10('0x39')]={'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 063d71c..b5cf4af 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 _0x9db7=['_inBody','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','headers','line','exports','stream','Transform','call','_localBuffer'];(function(_0x42f23e,_0x221c5d){var _0x18ab15=function(_0x38a151){while(--_0x38a151){_0x42f23e['push'](_0x42f23e['shift']());}};_0x18ab15(++_0x221c5d);}(_0x9db7,0x176));var _0x79db=function(_0xc82544,_0x9776c3){_0xc82544=_0xc82544-0x0;var _0x579f2e=_0x9db7[_0xc82544];return _0x579f2e;};'use strict';var util=require('util');var Transform=require(_0x79db('0x0'))[_0x79db('0x1')];function AGIReply(_0x51d9a2){Transform[_0x79db('0x2')](this,_0x51d9a2);this[_0x79db('0x3')]='';this[_0x79db('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x79db('0x5')]=function(_0x3f4c03,_0x1d3da3,_0x21c2e8){var _0x5ece38='\x0a',_0x863509=['\x0a\x0a',_0x79db('0x6')],_0x24e144=-0x1,_0x20a729=-0x1,_0x574ced='',_0x5e39fd=0x0,_0x175888='',_0x4ef727='';this[_0x79db('0x3')]+=_0x3f4c03[_0x79db('0x7')]();_0x175888=this['_localBuffer'];if(!this[_0x79db('0x4')]){_0x5e39fd=0x0;while(_0x863509[_0x5e39fd]){while((_0x20a729=_0x175888[_0x79db('0x8')](_0x863509[_0x5e39fd]))!=-0x1){_0x574ced=_0x863509[_0x5e39fd];_0x4ef727=_0x175888[_0x79db('0x9')](0x0,_0x20a729);_0x175888=_0x175888[_0x79db('0x9')](_0x20a729+_0x574ced[_0x79db('0xa')]);var _0x3b1952=_0x4ef727[_0x79db('0xb')](_0x5ece38),_0x3a3bd7=0x0,_0x36b763={},_0x4b8ccd='',_0x2bd673='',_0x5d6e52=-0x1;while(_0x3b1952[_0x3a3bd7]){_0x5d6e52=_0x3b1952[_0x3a3bd7][_0x79db('0x8')](':');if(_0x5d6e52!=-0x1){_0x4b8ccd=_0x3b1952[_0x3a3bd7][_0x79db('0xc')](0x0,_0x5d6e52)['trim']();_0x2bd673=_0x3b1952[_0x3a3bd7][_0x79db('0xc')](_0x5d6e52+0x1)[_0x79db('0xd')]();if(_0x4b8ccd[_0x79db('0xa')]>0x0){_0x36b763[_0x4b8ccd]=_0x2bd673;}}else{}_0x3a3bd7++;}this[_0x79db('0xe')](_0x79db('0xf'),_0x36b763);this[_0x79db('0x4')]=!![];}_0x5e39fd++;}this[_0x79db('0x3')]=_0x175888;}else{while((_0x24e144=_0x175888[_0x79db('0x8')](_0x5ece38))!=-0x1){_0x4ef727=_0x175888['substring'](0x0,_0x24e144);this['emit'](_0x79db('0x10'),_0x4ef727);_0x175888=_0x175888[_0x79db('0x9')](_0x24e144+_0x5ece38[_0x79db('0xa')]);}this[_0x79db('0x3')]=_0x175888;}_0x21c2e8();};module[_0x79db('0x11')]=AGIReply; \ No newline at end of file +var _0x480b=['substring','length','slice','emit','headers','line','exports','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x480b,0x1b9));var _0xb480=function(_0x385a57,_0x46c06a){_0x385a57=_0x385a57-0x0;var _0x501866=_0x480b[_0x385a57];return _0x501866;};'use strict';var util=require('util');var Transform=require('stream')['Transform'];function AGIReply(_0x91fd89){Transform['call'](this,_0x91fd89);this['_localBuffer']='';this[_0xb480('0x0')]=![];}util[_0xb480('0x1')](AGIReply,Transform);AGIReply['prototype'][_0xb480('0x2')]=function(_0x460e9c,_0x1c9268,_0x1bf5c4){var _0x53f53c='\x0a',_0x464ccb=['\x0a\x0a',_0xb480('0x3')],_0x34b309=-0x1,_0x9f7c00=-0x1,_0x429dde='',_0x1b6fdc=0x0,_0x5a320b='',_0x2dc5ad='';this[_0xb480('0x4')]+=_0x460e9c[_0xb480('0x5')]();_0x5a320b=this[_0xb480('0x4')];if(!this[_0xb480('0x0')]){_0x1b6fdc=0x0;while(_0x464ccb[_0x1b6fdc]){while((_0x9f7c00=_0x5a320b[_0xb480('0x6')](_0x464ccb[_0x1b6fdc]))!=-0x1){_0x429dde=_0x464ccb[_0x1b6fdc];_0x2dc5ad=_0x5a320b[_0xb480('0x7')](0x0,_0x9f7c00);_0x5a320b=_0x5a320b['substring'](_0x9f7c00+_0x429dde[_0xb480('0x8')]);var _0x41c07b=_0x2dc5ad['split'](_0x53f53c),_0x193115=0x0,_0x40808f={},_0x10b660='',_0x197489='',_0xc6ead6=-0x1;while(_0x41c07b[_0x193115]){_0xc6ead6=_0x41c07b[_0x193115][_0xb480('0x6')](':');if(_0xc6ead6!=-0x1){_0x10b660=_0x41c07b[_0x193115][_0xb480('0x9')](0x0,_0xc6ead6)['trim']();_0x197489=_0x41c07b[_0x193115][_0xb480('0x9')](_0xc6ead6+0x1)['trim']();if(_0x10b660[_0xb480('0x8')]>0x0){_0x40808f[_0x10b660]=_0x197489;}}else{}_0x193115++;}this[_0xb480('0xa')](_0xb480('0xb'),_0x40808f);this['_inBody']=!![];}_0x1b6fdc++;}this[_0xb480('0x4')]=_0x5a320b;}else{while((_0x34b309=_0x5a320b[_0xb480('0x6')](_0x53f53c))!=-0x1){_0x2dc5ad=_0x5a320b[_0xb480('0x7')](0x0,_0x34b309);this[_0xb480('0xa')](_0xb480('0xc'),_0x2dc5ad);_0x5a320b=_0x5a320b['substring'](_0x34b309+_0x53f53c[_0xb480('0x8')]);}this[_0xb480('0x4')]=_0x5a320b;}_0x1bf5c4();};module[_0xb480('0xd')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 9f7a895..8633ade 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 _0x5183=['createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','error','getSquareProjects','GetSquareProjects','production','ShowSquareProject','ShowMailAccount','Smtp','CloudProvider','name','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById'];(function(_0x5b1424,_0x20a88a){var _0x109911=function(_0x4185df){while(--_0x4185df){_0x5b1424['push'](_0x5b1424['shift']());}};_0x109911(++_0x20a88a);}(_0x5183,0x13e));var _0x3518=function(_0xd28200,_0xdf65ef){_0xd28200=_0xd28200-0x0;var _0x32447e=_0x5183[_0xd28200];return _0x32447e;};'use strict';var _=require(_0x3518('0x0'));var moment=require(_0x3518('0x1'));var jayson=require(_0x3518('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0x2323f3,_0x3cc276){return new Promise(function(_0x178571,_0x421ab5){return client['request'](_0x2323f3,_0x3cc276)['then'](function(_0x242c22){if(_0x242c22[_0x3518('0x3')]){return _0x421ab5(_0x242c22[_0x3518('0x3')]['message']);}else{return _0x178571(_0x242c22['result']);}})['catch'](function(_0x147b59){return _0x421ab5(_0x147b59);});});}exports[_0x3518('0x4')]=function(){return request(_0x3518('0x5'),{'options':{'raw':![],'attributes':['id','name',_0x3518('0x6')]}});};exports['getSquareProject']=function(_0x16931f){return request(_0x3518('0x7'),{'options':{'raw':![],'where':{'name':_0x16931f},'attributes':[_0x3518('0x6')]}});};exports['getMailAccountById']=function(_0x3a60c7){return request(_0x3518('0x8'),{'options':{'raw':![],'where':{'id':_0x3a60c7},'include':[{'model':'MailServerOut','as':_0x3518('0x9'),'include':[{'model':_0x3518('0xa'),'as':_0x3518('0xa')}]}],'attributes':['id',_0x3518('0xb'),'email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x7f5c5a){return request(_0x3518('0x7'),{'options':{'where':{'id':_0x7f5c5a},'attributes':[_0x3518('0xb')]}});};exports['getVoiceQueueById']=function(_0x563507){return request(_0x3518('0xc'),{'options':{'where':{'id':_0x563507},'attributes':[_0x3518('0xb')]}});};exports[_0x3518('0xd')]=function(_0x488364){return request(_0x3518('0xe'),{'options':{'where':{'id':_0x488364},'attributes':[_0x3518('0xb')]}});};exports[_0x3518('0xf')]=function(_0x30a74d){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x30a74d},'attributes':[_0x3518('0x10')]}});};exports['getUserById']=function(_0xd24f36){return request('ShowUser',{'options':{'where':{'id':_0xd24f36},'attributes':[_0x3518('0xb')]}});};exports[_0x3518('0x11')]=function(_0x4b9a06){return request(_0x3518('0x12'),{'options':{'where':{'phone':_0x4b9a06[_0x3518('0x13')]},'attributes':['id']}});};exports[_0x3518('0x14')]=function(_0x8092d6){return request(_0x3518('0x15'),{'options':{'where':{'id':_0x8092d6},'attributes':['name']}});};exports[_0x3518('0x16')]=function(_0x568f26){return request(_0x3518('0x17'),{'options':{'where':{'id':_0x568f26},'attributes':[_0x3518('0x18')]}});};exports[_0x3518('0x19')]=function(_0x507047){return request(_0x3518('0x1a'),{'options':{'raw':![],'where':{'id':_0x507047},'include':[{'model':_0x3518('0x1b'),'as':_0x3518('0x1c')}]}});};exports[_0x3518('0x1d')]=function(_0x1d76fe){return request('ShowSmsAccount',{'options':{'where':{'id':_0x1d76fe},'attributes':['id',_0x3518('0xb')]}});};exports[_0x3518('0x1e')]=function(_0x421c2e){return request(_0x3518('0x1f'),{'body':_0x421c2e});};exports[_0x3518('0x20')]=function(_0x3aa4e0){return request(_0x3518('0x21'),{'body':_0x3aa4e0});};exports[_0x3518('0x22')]=function(_0x8baad6){return request(_0x3518('0x23'),{'body':_[_0x3518('0x24')](_0x8baad6,{'project_name':_0x8baad6[_0x3518('0x25')],'prev_project_name':_0x8baad6[_0x3518('0x26')]||'','is_subproject':_0x8baad6[_0x3518('0x26')]?!![]:![],'leaveAt':moment()[_0x3518('0x27')](_0x3518('0x28'))})});};exports[_0x3518('0x29')]=function(_0x30ebce){return request(_0x3518('0x2a'),{'body':_0x30ebce});};exports[_0x3518('0x2b')]=function(_0x34a6d6){return request(_0x3518('0x2c'),{'body':_0x34a6d6});};exports[_0x3518('0x2d')]=function(_0x369d58){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x369d58['phone'],'ListId':_0x369d58[_0x3518('0x2e')]}}})[_0x3518('0x2f')](function(_0x4c16d6){if(_0x4c16d6){return _0x4c16d6;}return request(_0x3518('0x30'),{'body':_0x369d58});});};exports[_0x3518('0x31')]=function(_0x5986e1){return request(_0x3518('0x32'),{'options':{'where':{'id':_0x5986e1},'attributes':['name']}});};exports[_0x3518('0x33')]=function(_0x550c64,_0x6f3e96){return request(_0x3518('0x34'),{'body':{'interface':_0x6f3e96},'options':{'where':_0x550c64}});};exports[_0x3518('0x35')]=function(_0x16f354,_0xf5ad75,_0x3e7d29){return request('PauseUser',{'body':{'type':_0xf5ad75,'uniqueid':_0x3e7d29},'options':{'where':_0x16f354}});};exports[_0x3518('0x36')]=function(_0x5bc9c3){return request(_0x3518('0x37'),{'body':{},'options':{'where':_0x5bc9c3}});};exports[_0x3518('0x38')]=function(_0x313be1){return request(_0x3518('0x39'),{'body':{},'options':{'where':_0x313be1}});}; \ No newline at end of file +var _0xc368=['agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','moment','client','http','request','then','error','result','catch','getSquareProjects','GetSquareProjects','name','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','ShowCmHopper','ListId','ShowPause'];(function(_0x5ef7b7,_0x396790){var _0x53c878=function(_0x4693e9){while(--_0x4693e9){_0x5ef7b7['push'](_0x5ef7b7['shift']());}};_0x53c878(++_0x396790);}(_0xc368,0x7b));var _0x8c36=function(_0x5354a7,_0x50eb51){_0x5354a7=_0x5354a7-0x0;var _0x2a0c80=_0xc368[_0x5354a7];return _0x2a0c80;};'use strict';var _=require('lodash');var moment=require(_0x8c36('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x8c36('0x1')][_0x8c36('0x2')]({'port':0x2329});function request(_0x20e697,_0x2640c5){return new Promise(function(_0x288b85,_0x5d3b27){return client[_0x8c36('0x3')](_0x20e697,_0x2640c5)[_0x8c36('0x4')](function(_0x912acb){if(_0x912acb[_0x8c36('0x5')]){return _0x5d3b27(_0x912acb['error']['message']);}else{return _0x288b85(_0x912acb[_0x8c36('0x6')]);}})[_0x8c36('0x7')](function(_0x3e76be){return _0x5d3b27(_0x3e76be);});});}exports[_0x8c36('0x8')]=function(){return request(_0x8c36('0x9'),{'options':{'raw':![],'attributes':['id',_0x8c36('0xa'),'production']}});};exports['getSquareProject']=function(_0x49f227){return request(_0x8c36('0xb'),{'options':{'raw':![],'where':{'name':_0x49f227},'attributes':[_0x8c36('0xc')]}});};exports['getMailAccountById']=function(_0x36cb13){return request(_0x8c36('0xd'),{'options':{'raw':![],'where':{'id':_0x36cb13},'include':[{'model':_0x8c36('0xe'),'as':_0x8c36('0xf'),'include':[{'model':_0x8c36('0x10'),'as':_0x8c36('0x10')}]}],'attributes':['id',_0x8c36('0xa'),_0x8c36('0x11')],'smtp':!![]}});};exports[_0x8c36('0x12')]=function(_0x11f8fa){return request(_0x8c36('0xb'),{'options':{'where':{'id':_0x11f8fa},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x13')]=function(_0x220f18){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x220f18},'attributes':[_0x8c36('0xa')]}});};exports['getVariableById']=function(_0xea7509){return request(_0x8c36('0x14'),{'options':{'where':{'id':_0xea7509},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x15')]=function(_0xcfdbf7){return request(_0x8c36('0x16'),{'options':{'where':{'id':_0xcfdbf7},'attributes':[_0x8c36('0x17')]}});};exports[_0x8c36('0x18')]=function(_0x30229e){return request('ShowUser',{'options':{'where':{'id':_0x30229e},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x19')]=function(_0x47832a){return request(_0x8c36('0x1a'),{'options':{'where':{'phone':_0x47832a[_0x8c36('0x1b')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x15100f){return request(_0x8c36('0x1c'),{'options':{'where':{'id':_0x15100f},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x1d')]=function(_0xc30310){return request(_0x8c36('0x1e'),{'options':{'where':{'id':_0xc30310},'attributes':[_0x8c36('0x1f')]}});};exports[_0x8c36('0x20')]=function(_0x153735){return request(_0x8c36('0x21'),{'options':{'raw':![],'where':{'id':_0x153735},'include':[{'model':_0x8c36('0x22'),'as':_0x8c36('0x23')}]}});};exports[_0x8c36('0x24')]=function(_0x51fd6c){return request('ShowSmsAccount',{'options':{'where':{'id':_0x51fd6c},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x2269f5){return request(_0x8c36('0x25'),{'body':_0x2269f5});};exports[_0x8c36('0x26')]=function(_0x2c9e9a){return request(_0x8c36('0x27'),{'body':_0x2c9e9a});};exports[_0x8c36('0x28')]=function(_0x4bf4c2){return request(_0x8c36('0x29'),{'body':_['merge'](_0x4bf4c2,{'project_name':_0x4bf4c2[_0x8c36('0x2a')],'prev_project_name':_0x4bf4c2['arg_2']||'','is_subproject':_0x4bf4c2[_0x8c36('0x2b')]?!![]:![],'leaveAt':moment()[_0x8c36('0x2c')](_0x8c36('0x2d'))})});};exports[_0x8c36('0x2e')]=function(_0x50aa48){return request('CreateSquareRecording',{'body':_0x50aa48});};exports[_0x8c36('0x2f')]=function(_0x28fa76){return request('CreateSquareMessage',{'body':_0x28fa76});};exports['createCmContact']=function(_0x418663){return request(_0x8c36('0x30'),{'options':{'raw':![],'where':{'phone':_0x418663['phone'],'ListId':_0x418663[_0x8c36('0x31')]}}})[_0x8c36('0x4')](function(_0x3ca98e){if(_0x3ca98e){return _0x3ca98e;}return request('CreateCmContact',{'body':_0x418663});});};exports['getPauseById']=function(_0x46b72f){return request(_0x8c36('0x32'),{'options':{'where':{'id':_0x46b72f},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x33')]=function(_0x3ae970,_0x2e8855){return request(_0x8c36('0x34'),{'body':{'interface':_0x2e8855},'options':{'where':_0x3ae970}});};exports[_0x8c36('0x35')]=function(_0xda4e74,_0x2d6476,_0x35a349){return request(_0x8c36('0x36'),{'body':{'type':_0x2d6476,'uniqueid':_0x35a349},'options':{'where':_0xda4e74}});};exports[_0x8c36('0x37')]=function(_0x178fe5){return request(_0x8c36('0x38'),{'body':{},'options':{'where':_0x178fe5}});};exports[_0x8c36('0x39')]=function(_0x2e6b95){return request('LogoutUser',{'body':{},'options':{'where':_0x2e6b95}});}; \ 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 7d2f897..e64997a 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 _0x0324=['./lex','exports'];(function(_0xd5917f,_0x4b08f8){var _0x141e3c=function(_0x54afcc){while(--_0x54afcc){_0xd5917f['push'](_0xd5917f['shift']());}};_0x141e3c(++_0x4b08f8);}(_0x0324,0x90));var _0x4032=function(_0x43a0c6,_0x28afea){_0x43a0c6=_0x43a0c6-0x0;var _0x4bc10b=_0x0324[_0x43a0c6];return _0x4bc10b;};var polly=require('./polly');var lex=require(_0x4032('0x0'));module[_0x4032('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x9fc5=['./lex','exports'];(function(_0x8d750c,_0x4fca01){var _0x5112db=function(_0x30dc8e){while(--_0x30dc8e){_0x8d750c['push'](_0x8d750c['shift']());}};_0x5112db(++_0x4fca01);}(_0x9fc5,0xb6));var _0x59fc=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0x9fc5[_0x514c15];return _0x16283e;};var polly=require('./polly');var lex=require(_0x59fc('0x0'));module[_0x59fc('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 1a8a92f..aeb2e74 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b){return lex(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b);}; \ No newline at end of file +var _0x9348=['exports','./lib/api'];(function(_0x484e5f,_0x4ff2b1){var _0xe5f191=function(_0x4ff587){while(--_0x4ff587){_0x484e5f['push'](_0x484e5f['shift']());}};_0xe5f191(++_0x4ff2b1);}(_0x9348,0x10d));var _0x8934=function(_0x411f6f,_0x1a311d){_0x411f6f=_0x411f6f-0x0;var _0x14d129=_0x9348[_0x411f6f];return _0x14d129;};'use strict';var lex=require(_0x8934('0x0'));module[_0x8934('0x1')]=function(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b){return lex(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index b5fecfa..19c5067 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(_0x46614d,_0x2585cd){var _0x2ac14a=function(_0x347118){while(--_0x347118){_0x46614d['push'](_0x46614d['shift']());}};_0x2ac14a(++_0x2585cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x4e7b42,_0x1c30da){var _0x15948f=function(_0x4a3578){while(--_0x4a3578){_0x4e7b42['push'](_0x4e7b42['shift']());}};_0x15948f(++_0x1c30da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index a98356f..d21fd98 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 _0x9afd=['./lib/api'];(function(_0x3a77ce,_0x486ee8){var _0xe885c7=function(_0x5a8ae0){while(--_0x5a8ae0){_0x3a77ce['push'](_0x3a77ce['shift']());}};_0xe885c7(++_0x486ee8);}(_0x9afd,0x1c5));var _0xd9af=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x9afd[_0x237546];return _0x233e29;};'use strict';var polly=require(_0xd9af('0x0'));module['exports']=function(_0x270661,_0x232595,_0x558f7e,_0x5dd83a,_0x17072b,_0x1fe3b9,_0x3329f4){return polly(_0x270661,_0x232595,_0x558f7e,_0x5dd83a,_0x17072b,_0x1fe3b9,_0x3329f4);}; \ No newline at end of file +var _0x4236=['./lib/api'];(function(_0x4d2d73,_0x583269){var _0x12d0e8=function(_0x5223a8){while(--_0x5223a8){_0x4d2d73['push'](_0x4d2d73['shift']());}};_0x12d0e8(++_0x583269);}(_0x4236,0xfb));var _0x6423=function(_0x2ea3c9,_0x52a886){_0x2ea3c9=_0x2ea3c9-0x0;var _0x5321f5=_0x4236[_0x2ea3c9];return _0x5321f5;};'use strict';var polly=require(_0x6423('0x0'));module['exports']=function(_0x763095,_0x968866,_0x212267,_0x20b9e8,_0x2d031f,_0x274f4b,_0x500c09){return polly(_0x763095,_0x968866,_0x212267,_0x20b9e8,_0x2d031f,_0x274f4b,_0x500c09);}; \ 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 54a83d3..b328277 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 _0x3535=['bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path'];(function(_0x8e4931,_0x3683f8){var _0x1fa36e=function(_0x3b6839){while(--_0x3b6839){_0x8e4931['push'](_0x8e4931['shift']());}};_0x1fa36e(++_0x3683f8);}(_0x3535,0x83));var _0x5353=function(_0x235ea5,_0x2014c8){_0x235ea5=_0x235ea5-0x0;var _0x2973fa=_0x3535[_0x235ea5];return _0x2973fa;};'use strict';var fs=require('fs');var path=require(_0x5353('0x0'));var BPromise=require(_0x5353('0x1'));var rs=require(_0x5353('0x2'));var AWS=require(_0x5353('0x3'));function pollyResult(_0x5dbf94,_0x5d4f45,_0x4a219d){return new BPromise(function(_0x6c4918,_0x5ccd28){_0x5dbf94[_0x5353('0x4')](_0x5d4f45,function(_0x393b90,_0x32bba0){if(_0x393b90){_0x5ccd28(_0x393b90);}else if(_0x32bba0){if(_0x32bba0[_0x5353('0x5')]instanceof Buffer){fs['writeFile'](_0x4a219d,_0x32bba0[_0x5353('0x5')],function(_0x4ec41b){if(_0x4ec41b){_0x5ccd28(_0x4ec41b);}else{_0x6c4918();}});}else{_0x5ccd28(new Error(_0x5353('0x6')));}}else{_0x5ccd28(new Error(_0x5353('0x7')));}});});}module[_0x5353('0x8')]=function(_0x15dab1,_0x50e1a5,_0x40b3f9,_0x336184,_0x2b3add,_0x154ed3,_0x409d51){var _0x5221d0=new AWS[(_0x5353('0x9'))]({'accessKeyId':_0x15dab1,'secretAccessKey':_0x50e1a5,'region':_0x40b3f9});var _0x11fb4a={'Text':_0x2b3add,'TextType':_0x154ed3||'text','OutputFormat':_0x5353('0xa'),'VoiceId':_0x336184};return pollyResult(_0x5221d0,_0x11fb4a,_0x409d51);}; \ No newline at end of file +var _0x8faf=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','bluebird','randomstring'];(function(_0x28cf60,_0x2fe9d9){var _0x2b61e5=function(_0x28b6ba){while(--_0x28b6ba){_0x28cf60['push'](_0x28cf60['shift']());}};_0x2b61e5(++_0x2fe9d9);}(_0x8faf,0x76));var _0xf8fa=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x8faf[_0x4e6ae6];return _0x23c108;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xf8fa('0x0'));var rs=require(_0xf8fa('0x1'));var AWS=require(_0xf8fa('0x2'));function pollyResult(_0x5c606b,_0x2e14af,_0x398dcd){return new BPromise(function(_0x12e58c,_0x15e71f){_0x5c606b[_0xf8fa('0x3')](_0x2e14af,function(_0x423cbb,_0x5ec459){if(_0x423cbb){_0x15e71f(_0x423cbb);}else if(_0x5ec459){if(_0x5ec459[_0xf8fa('0x4')]instanceof Buffer){fs[_0xf8fa('0x5')](_0x398dcd,_0x5ec459['AudioStream'],function(_0x27e2c7){if(_0x27e2c7){_0x15e71f(_0x27e2c7);}else{_0x12e58c();}});}else{_0x15e71f(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x15e71f(new Error(_0xf8fa('0x6')));}});});}module[_0xf8fa('0x7')]=function(_0x1af645,_0x31c82b,_0x15a64a,_0x13ab49,_0x5434c1,_0x28b78a,_0xe8610d){var _0x31cb3a=new AWS['Polly']({'accessKeyId':_0x1af645,'secretAccessKey':_0x31c82b,'region':_0x15a64a});var _0x8b8a9d={'Text':_0x5434c1,'TextType':_0x28b78a||_0xf8fa('0x8'),'OutputFormat':_0xf8fa('0x9'),'VoiceId':_0x13ab49};return pollyResult(_0x31cb3a,_0x8b8a9d,_0xe8610d);}; \ 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 5346d43..8edb8cb 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc11f=['exports'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0xc11f,0x15c));var _0xfc11=function(_0x76cc4b,_0x404f30){_0x76cc4b=_0x76cc4b-0x0;var _0x1293c7=_0xc11f[_0x76cc4b];return _0x1293c7;};'use strict';var asr=require('./lib/api');module[_0xfc11('0x0')]=function(_0x27722c,_0x248312,_0x38fe5b,_0x4b167f){return asr(_0x27722c,_0x248312,_0x38fe5b);}; \ No newline at end of file +var _0x6124=['./lib/api','exports'];(function(_0x2f8e0f,_0x2d0d16){var _0x54c568=function(_0x26d720){while(--_0x26d720){_0x2f8e0f['push'](_0x2f8e0f['shift']());}};_0x54c568(++_0x2d0d16);}(_0x6124,0xc6));var _0x4612=function(_0x73ad2,_0x3c36a0){_0x73ad2=_0x73ad2-0x0;var _0x56c214=_0x6124[_0x73ad2];return _0x56c214;};'use strict';var asr=require(_0x4612('0x0'));module[_0x4612('0x1')]=function(_0x129c19,_0x2e48aa,_0x24317e,_0x1487f4){return asr(_0x129c19,_0x2e48aa,_0x24317e);}; \ 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 a5760b0..9b3b915 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 _0x3667=['8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0x49f575,_0x4454df){var _0x1e57a9=function(_0xef8ee5){while(--_0xef8ee5){_0x49f575['push'](_0x49f575['shift']());}};_0x1e57a9(++_0x4454df);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var url=require(_0x7366('0x0'));var BPromise=require(_0x7366('0x1'));var fs=require('fs');var host=_0x7366('0x2');module[_0x7366('0x3')]=function(_0x3c601d,_0x5d1072,_0x27a90d){return new BPromise(function(_0x1cfcc9,_0x4b32a7){var _0x27726b;if(typeof _0x3c601d!==_0x7366('0x4')||_0x3c601d[_0x7366('0x5')]===0x0){return _0x4b32a7(_0x7366('0x6'));}if(typeof _0x5d1072!==_0x7366('0x4')||_0x5d1072['length']===0x0){return _0x4b32a7(_0x7366('0x7'));}if(typeof _0x27a90d!==_0x7366('0x8')&&(typeof _0x27a90d!==_0x7366('0x4')||_0x27a90d[_0x7366('0x5')]===0x0)){return _0x4b32a7(_0x7366('0x9'));}try{_0x27726b=fs[_0x7366('0xa')](_0x3c601d)[_0x7366('0xb')](_0x7366('0xc'));}catch(_0x18aee5){return _0x4b32a7(_0x18aee5);}return _0x1cfcc9({'method':_0x7366('0xd'),'uri':host+_0x7366('0xe')+_0x5d1072,'body':{'config':{'encoding':_0x7366('0xf'),'sampleRateHertz':_0x7366('0x10'),'languageCode':_0x27a90d},'audio':{'content':_0x27726b}},'json':!![]});});}; \ No newline at end of file +var _0xe829=['filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xe829,0x1d8));var _0x9e82=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0xe829[_0xf04c6d];return _0x4a804e;};'use strict';var url=require(_0x9e82('0x0'));var BPromise=require(_0x9e82('0x1'));var fs=require('fs');var host=_0x9e82('0x2');module['exports']=function(_0x559076,_0xf56525,_0x337730){return new BPromise(function(_0x1b47d8,_0x168d3e){var _0x31591a;if(typeof _0x559076!==_0x9e82('0x3')||_0x559076['length']===0x0){return _0x168d3e(_0x9e82('0x4'));}if(typeof _0xf56525!==_0x9e82('0x3')||_0xf56525[_0x9e82('0x5')]===0x0){return _0x168d3e(_0x9e82('0x6'));}if(typeof _0x337730!==_0x9e82('0x7')&&(typeof _0x337730!=='string'||_0x337730[_0x9e82('0x5')]===0x0)){return _0x168d3e('lang\x20should\x20be\x20a\x20string');}try{_0x31591a=fs[_0x9e82('0x8')](_0x559076)[_0x9e82('0x9')]('base64');}catch(_0x5965b0){return _0x168d3e(_0x5965b0);}return _0x1b47d8({'method':_0x9e82('0xa'),'uri':host+_0x9e82('0xb')+_0xf56525,'body':{'config':{'encoding':_0x9e82('0xc'),'sampleRateHertz':_0x9e82('0xd'),'languageCode':_0x337730},'audio':{'content':_0x31591a}},'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 d117f25..4a9b51c 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 _0xc361=['exports'];(function(_0xad65d5,_0x57314c){var _0x3f7e4c=function(_0x49e2a6){while(--_0x49e2a6){_0xad65d5['push'](_0xad65d5['shift']());}};_0x3f7e4c(++_0x57314c);}(_0xc361,0x120));var _0x1c36=function(_0x52dc13,_0x5813c2){_0x52dc13=_0x52dc13-0x0;var _0x1143e7=_0xc361[_0x52dc13];return _0x1143e7;};var asr=require('./asr');module[_0x1c36('0x0')]={'asr':asr}; \ No newline at end of file +var _0x43d6=['./asr','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x43d6,0x140));var _0x643d=function(_0x34b881,_0x4dcda6){_0x34b881=_0x34b881-0x0;var _0xe094c1=_0x43d6[_0x34b881];return _0xe094c1;};var asr=require(_0x643d('0x0'));module[_0x643d('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 9596531..4f244b0 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 _0x751f=['POST','application/x-www-form-urlencoded','f.req=','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','displayName','intent','isFallback','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','ispeechASR','model=%s','freeform=3','parse','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','http','https','md5','path','querystring','randomstring','google-tts-api','url','util','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','protocol','get','data','transcode','wav','error\x20convert','start','.wav','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','voice','audioConfig','MP3','text:synthesize','resolve','tmp','.mp3','from','audioContent','writeFile','generate','googleCloudTTS\x20path','googleTTS','utf8'];(function(_0x4156e9,_0x139ecf){var _0x5a77b7=function(_0x4d2caf){while(--_0x4d2caf){_0x4156e9['push'](_0x4156e9['shift']());}};_0x5a77b7(++_0x139ecf);}(_0x751f,0xd1));var _0xf751=function(_0x2ef41c,_0x4e9052){_0x2ef41c=_0x2ef41c-0x0;var _0x413f4e=_0x751f[_0x2ef41c];return _0x413f4e;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xf751('0x0'));var https=require(_0xf751('0x1'));var md5=require(_0xf751('0x2'));var path=require(_0xf751('0x3'));var querystring=require(_0xf751('0x4'));var rp=require('request-promise');var rs=require(_0xf751('0x5'));var sox=require('sox');var tts=require(_0xf751('0x6'));var urlParse=require(_0xf751('0x7'))['parse'];var util=require(_0xf751('0x8'));var aws=require(_0xf751('0x9'));var google=require('./google');var sestek=require(_0xf751('0xa'));var tilde=require('./tilde');var logger=require(_0xf751('0xb'))(_0xf751('0xc'));var ISPEECH_API=_0xf751('0xd');function downloadFile(_0x5ee48b,_0x48925e){return new BPromise(function(_0x5a33c4,_0x5c80c7){var _0x497263=urlParse(_0x5ee48b);var _0xee664d=_0x497263['protocol']===_0xf751('0xe')?https:http;var _0x26e7ae={'host':_0x497263[_0xf751('0xf')],'path':_0x497263['path'],'headers':{'user-agent':_0xf751('0x10')}};_0xee664d['get'](_0x26e7ae,function(_0x5977cc){if(_0x5977cc[_0xf751('0x11')]!==0xc8){logger[_0xf751('0x12')]('request\x20to\x20'+_0x5ee48b+_0xf751('0x13')+_0x5977cc['statusCode']+'\x20('+_0x5977cc[_0xf751('0x14')]+')');_0x5c80c7(new Error(_0xf751('0x15')+_0x5ee48b+_0xf751('0x13')+_0x5977cc[_0xf751('0x11')]+'\x20('+_0x5977cc['statusMessage']+')'));return;}var _0x587fec=fs[_0xf751('0x16')](_0x48925e);_0x587fec['on']('finish',function(){logger[_0xf751('0x17')](_0xf751('0x18'));_0x587fec[_0xf751('0x19')](_0x5a33c4);});_0x587fec['on'](_0xf751('0x12'),function(_0x51a959){fs[_0xf751('0x1a')](_0x48925e);logger[_0xf751('0x12')](_0xf751('0x1b'),_0x51a959);_0x5c80c7(_0x51a959);});_0x5977cc[_0xf751('0x1c')](_0x587fec);})['on'](_0xf751('0x12'),function(_0x5d1961){logger[_0xf751('0x12')](_0x5d1961);_0x5c80c7(_0x5d1961);})[_0xf751('0x1d')]();});}function uploadFile(_0x1865c4){return new BPromise(function(_0x59ffd1,_0xfc7362){var _0x367c73=urlParse(_0x1865c4);var _0x56ae0d=_0x367c73[_0xf751('0x1e')]===_0xf751('0xe')?https:http;var _0xf284f6={'host':_0x367c73[_0xf751('0xf')],'path':_0x367c73[_0xf751('0x3')],'headers':{'user-agent':_0xf751('0x10')}};_0x56ae0d[_0xf751('0x1f')](_0xf284f6,function(_0x5819da){if(_0x5819da[_0xf751('0x11')]!==0xc8){_0xfc7362(new Error(_0xf751('0x15')+_0x1865c4+'\x20failed,\x20status\x20code\x20=\x20'+_0x5819da['statusCode']+'\x20('+_0x5819da[_0xf751('0x14')]+')'));return;}var _0x24a10a='';_0x5819da['on'](_0xf751('0x20'),function(_0x15ea01){_0x24a10a+=_0x15ea01;});_0x5819da['on'](_0xf751('0x1d'),function(){_0x59ffd1(_0x24a10a);});})['on'](_0xf751('0x12'),function(_0x3e9a70){_0xfc7362(_0x3e9a70);})[_0xf751('0x1d')]();});}function convertFile(_0xdb66a9,_0x2a149f){return new BPromise(function(_0x46e8ca,_0x570e11){var _0x47b03a=sox[_0xf751('0x21')](_0xdb66a9,_0x2a149f,{'sampleRate':0x1f40,'format':_0xf751('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x47b03a['on']('error',function(_0x2e1e54){logger[_0xf751('0x12')](_0xf751('0x23'),_0x2e1e54);_0x570e11(_0x2e1e54);});_0x47b03a['on'](_0xf751('0x1d'),function(){logger[_0xf751('0x17')]('finish\x20to\x20convert');_0x46e8ca();});_0x47b03a[_0xf751('0x24')]();});}function base64Decode(_0xc42efc,_0x40fbda){var _0x562907=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xf751('0x25'));fs['writeFileSync'](_0x562907,_0xc42efc,_0xf751('0x26'));return convertFile(_0x562907,_0x40fbda)[_0xf751('0x27')](function(){try{fs['unlink'](_0x562907);fs[_0xf751('0x28')](_0x40fbda,_0xf751('0x29'));}catch(_0x5c4209){logger['error'](_0x5c4209);}return _0x40fbda[_0xf751('0x2a')]('.')[0x0];});}function base64Encode(_0x263308){var _0x2bdc4e=fs[_0xf751('0x2b')](_0x263308);return new Buffer(_0x2bdc4e)['toString'](_0xf751('0x26'));}exports[_0xf751('0x2c')]=function(_0x4f9f1f,_0x3cd6e7,_0x3ff88c,_0x5bdb11,_0x3fb5eb,_0x1a5c16){var _0x5d8488,_0xb81c1e;var _0x2f2622=_0xf751('0x2d');var _0x35b18e='?key='+_0x4f9f1f;var _0x383db3={};if(_0x3cd6e7==='ssml'){_0x383db3[_0xf751('0x2e')]={'ssml':_0x3ff88c};}else{_0x383db3[_0xf751('0x2e')]={'text':_0x3ff88c};};_0x383db3[_0xf751('0x2f')]={'languageCode':_0x5bdb11,'ssmlGender':_0x3fb5eb};_0x383db3[_0xf751('0x30')]={'audioEncoding':_0xf751('0x31'),'sampleRateHertz':0x1f40};var _0x166379={'url':_0x2f2622+_0xf751('0x32')+_0x35b18e,'method':'POST','json':!![],'body':_0x383db3};return rp(_0x166379)[_0xf751('0x27')](function(_0x2fa655){return new BPromise(function(_0x4ccab7,_0x1a533e){_0x5d8488=path[_0xf751('0x33')](__dirname,_0xf751('0x34'),rs['generate'](0x4)+_0xf751('0x35'));var _0x2a5993=Buffer[_0xf751('0x36')](_0x2fa655[_0xf751('0x37')],_0xf751('0x26'));return fs[_0xf751('0x38')](_0x5d8488,_0x2a5993,function(_0x56adc6){_0x1a533e(_0x56adc6);},function(_0x24293c){fs[_0xf751('0x28')](_0x5d8488,_0xf751('0x29'));_0x4ccab7(_0x24293c);});});})[_0xf751('0x27')](function(_0x1c5454){_0xb81c1e=path[_0xf751('0x33')](__dirname,_0xf751('0x34'),rs[_0xf751('0x39')](0x4)+'.wav');return convertFile(_0x5d8488,_0xb81c1e);})[_0xf751('0x27')](function(){try{fs[_0xf751('0x1a')](_0x5d8488);fs[_0xf751('0x28')](_0xb81c1e,_0xf751('0x29'));}catch(_0x41fd35){logger['error'](_0x41fd35);}logger['info'](_0xf751('0x3a'),_0xb81c1e[_0xf751('0x2a')]('.')[0x0]);return _0xb81c1e[_0xf751('0x2a')]('.')[0x0];});};exports[_0xf751('0x3b')]=function(_0x54805a,_0x151c25){var _0x1c9cae='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x1015b4,_0x1ab273;var _0x5f1a55;var _0x324e5d={'encoding':_0xf751('0x3c'),'method':_0xf751('0x3d'),'timeout':0x2710,'url':_0x1c9cae,'headers':{'Content-Type':_0xf751('0x3e')},'body':_0xf751('0x3f')+encodeURIComponent(JSON[_0xf751('0x40')]([[['jQ1olc',JSON[_0xf751('0x40')]([_0x54805a,_0x151c25||'en',![],'null']),null,_0xf751('0x41')]]]))};return rp(_0x324e5d)[_0xf751('0x27')](function(_0x43544c){try{_0x5f1a55=eval(_0x43544c[_0xf751('0x42')](0x5))[0x0][0x2];}catch(_0x49dfaf){throw new Error(_0xf751('0x43')+_0x43544c[_0xf751('0x20')]);}if(!_0x5f1a55){if(_0x54805a[_0xf751('0x44')]>0xc8){throw new Error(_0xf751('0x45'));}else{throw new Error(_0xf751('0x46')+_0x151c25+_0xf751('0x47'));}}try{_0x5f1a55=eval(_0x5f1a55)[0x0];}catch(_0x539e04){throw new Error(_0xf751('0x43')+res[_0xf751('0x20')]);}const _0x378e53=_0x5f1a55;_0x1015b4=path[_0xf751('0x33')](__dirname,_0xf751('0x34'),rs[_0xf751('0x39')](0x4)+_0xf751('0x35'));fs[_0xf751('0x48')](_0x1015b4,_0x5f1a55,{'encoding':_0xf751('0x26')});_0x1ab273=path[_0xf751('0x33')](__dirname,_0xf751('0x34'),rs[_0xf751('0x39')](0x4)+_0xf751('0x25'));return convertFile(_0x1015b4,_0x1ab273);})['then'](function(){try{fs[_0xf751('0x1a')](_0x1015b4);fs['chmodSync'](_0x1ab273,_0xf751('0x29'));}catch(_0x139a75){logger['error'](_0x139a75);}logger[_0xf751('0x17')](_0xf751('0x49'),_0x1ab273[_0xf751('0x2a')]('.')[0x0]);return _0x1ab273['split']('.')[0x0];});};exports[_0xf751('0x4a')]=function(_0x28237a,_0xb386f1,_0x524e11){return google[_0xf751('0x4b')](_0x28237a,_0xb386f1,_0x524e11)[_0xf751('0x27')](function(_0x1ae3ba){logger[_0xf751('0x17')](_0x1ae3ba[_0xf751('0x4c')]);return rp(_0x1ae3ba);})['then'](function(_0x36b690){var _0x2ec9d4='';var _0x1b8be0=0x0;try{fs[_0xf751('0x1a')](_0x28237a);}catch(_0x27225c){logger[_0xf751('0x12')](_0x27225c);}if(_0x36b690&&_0x36b690[_0xf751('0x4d')]){_0x2ec9d4=_0x36b690[_0xf751('0x4d')][_0xf751('0x4e')](function(_0x49b985){return _0x49b985&&_0x49b985[_0xf751('0x4f')][0x0]&&_0x49b985[_0xf751('0x4f')][0x0][_0xf751('0x50')]?_0x49b985['alternatives'][0x0][_0xf751('0x50')]:'';})['join']('\x0a');_0x1b8be0=_0x36b690[_0xf751('0x4d')][_0xf751('0x4e')](function(_0x4641aa){return _0x4641aa&&_0x4641aa['alternatives'][0x0]&&_0x4641aa[_0xf751('0x4f')][0x0][_0xf751('0x51')]?_0x4641aa[_0xf751('0x4f')][0x0][_0xf751('0x51')]:0x0;})[_0xf751('0x52')]('\x0a');}logger[_0xf751('0x17')]('googleASR\x20transcription',_0x2ec9d4);logger[_0xf751('0x17')](_0xf751('0x53'),_0x1b8be0);return{'transcript':_0x2ec9d4,'confidence':_0x1b8be0};})[_0xf751('0x54')](function(_0x2f84e6){logger[_0xf751('0x12')](_0xf751('0x55'),_0x2f84e6['statusCode'],_0x2f84e6[_0xf751('0x56')],_0x2f84e6[_0xf751('0x57')]);});};exports[_0xf751('0x58')]=function(_0x52b5f4,_0x1303cf,_0xa1d20a,_0x2b13ab){var _0x1adca5=apiai(_0x1303cf,{'language':_0x2b13ab||'en'});return _0x1adca5[_0xf751('0x59')](_0xa1d20a,{'sessionId':md5(_0x52b5f4)})[_0xf751('0x27')](function(_0x29778e){logger[_0xf751('0x17')](JSON[_0xf751('0x40')](_0x29778e));return{'source':_0x29778e[_0xf751('0x5a')][_0xf751('0x5b')],'resolvedQuery':_0x29778e['result'][_0xf751('0x5c')],'action':_0x29778e['result'][_0xf751('0x5d')],'actionIncomplete':_0x29778e[_0xf751('0x5a')][_0xf751('0x5e')],'speech':_0x29778e['result'][_0xf751('0x5f')][_0xf751('0x60')],'score':_0x29778e[_0xf751('0x5a')]['score'],'statusCode':_0x29778e[_0xf751('0x61')]['code'],'endConversation':_0x29778e[_0xf751('0x5a')][_0xf751('0x62')][_0xf751('0x63')]||![],'isFallbackIntent':_0x29778e['result']['metadata']['isFallbackIntent']};});};exports[_0xf751('0x64')]=function(_0x9491be,_0xf65de7,_0x2b4ba5,_0x30be3b,_0xcb5b26,_0x2998ea){var _0x442018=_0x30be3b[_0xf751('0x65')](/\\n/g,'\x0a');var _0x142c89={'credentials':{'private_key':_0x442018,'client_email':_0x2b4ba5}};var _0x8613e5=new dialogflow[(_0xf751('0x66'))](_0x142c89);var _0x3d28d7=_0x8613e5[_0xf751('0x67')](_0xf65de7,md5(_0x9491be));var _0x422170={'session':_0x3d28d7,'queryInput':{'text':{'text':_0xcb5b26,'languageCode':_0x2998ea}}};return _0x8613e5['detectIntent'](_0x422170)[_0xf751('0x27')](function(_0x24d38d){if(_0x24d38d&&_0x24d38d['length']){logger[_0xf751('0x17')](_0xf751('0x68'),JSON[_0xf751('0x40')](_0x24d38d));var _0x56cb91=_0x24d38d[0x0];if(_0x56cb91){var _0x5a5113={'action':_0x56cb91[_0xf751('0x69')]['action'],'allRequiredParamsPresent':_0x56cb91[_0xf751('0x69')][_0xf751('0x6a')],'endConversation':_0x56cb91['queryResult'][_0xf751('0x6b')]&&_0x56cb91[_0xf751('0x69')][_0xf751('0x6b')][_0xf751('0x6c')]?_0x56cb91[_0xf751('0x69')][_0xf751('0x6b')][_0xf751('0x6c')][_0xf751('0x6d')]['boolValue']:![],'fulfillmentText':_0x56cb91[_0xf751('0x69')][_0xf751('0x6e')],'intentName':_0x56cb91[_0xf751('0x69')]['intent']['name'],'intentDisplayName':_0x56cb91[_0xf751('0x69')]['intent'][_0xf751('0x6f')],'isFallbackIntent':_0x56cb91[_0xf751('0x69')][_0xf751('0x70')][_0xf751('0x71')],'languageCode':_0x56cb91[_0xf751('0x69')]['languageCode'],'queryText':_0x56cb91[_0xf751('0x69')][_0xf751('0x72')],'responseId':_0x56cb91['responseId'],'score':_0x56cb91['queryResult'][_0xf751('0x73')],'speech':_0x56cb91[_0xf751('0x69')]['fulfillmentText'],'providerResponse':JSON[_0xf751('0x40')](_0x24d38d)};return _0x5a5113;}}});};exports[_0xf751('0x74')]=function(_0x434829,_0x51da01,_0x4c1478,_0xb6139){return tilde['asr'](_0x434829,_0x51da01,_0x4c1478,_0xb6139)['then'](function(_0x15e3ba){try{fs[_0xf751('0x1a')](_0x434829);}catch(_0x52237f){logger[_0xf751('0x12')](_0x52237f);}logger['info']('Tilde\x20ASR\x20transcription',_0x15e3ba[_0xf751('0x50')]);logger[_0xf751('0x17')](_0xf751('0x75'),_0x15e3ba[_0xf751('0x51')]);return _0x15e3ba;});};exports[_0xf751('0x76')]=function(_0xdffa3d,_0x3797e6,_0x3717b8,_0x23eeb5,_0x3d4131,_0x1d799f){var _0xa0a7fc=path[_0xf751('0x33')](__dirname,_0xf751('0x34'),rs[_0xf751('0x39')](0x4)+'.mp3');var _0x3c796e;return aws[_0xf751('0x77')](_0xdffa3d,_0x3797e6,_0x3717b8,_0x23eeb5,_0x3d4131,_0x1d799f,_0xa0a7fc)['then'](function(){_0x3c796e=path[_0xf751('0x33')](__dirname,_0xf751('0x34'),rs[_0xf751('0x39')](0x4)+_0xf751('0x25'));return convertFile(_0xa0a7fc,_0x3c796e);})[_0xf751('0x27')](function(){try{fs[_0xf751('0x1a')](_0xa0a7fc);fs[_0xf751('0x28')](_0x3c796e,_0xf751('0x29'));}catch(_0x557009){logger[_0xf751('0x12')](_0x557009);}return _0x3c796e['split']('.')[0x0];});};exports[_0xf751('0x78')]=function(_0x2e4f94,_0x133a23,_0x5a3b42,_0x5c0db4,_0x5079af,_0x5c204e){return aws['lex'](_0x2e4f94,_0x133a23,_0x5a3b42,_0x5c0db4,_0x5079af,_0x5c204e)[_0xf751('0x27')](function(_0x2fa7fa){logger['info'](JSON[_0xf751('0x40')](_0x2fa7fa));return _0x2fa7fa;});};exports[_0xf751('0x79')]=function(_0x304937,_0x5aea53,_0xdae189,_0x1e0fd8){var _0xcf22f1=util[_0xf751('0x7a')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x304937,encodeURIComponent(_0x5aea53),_0xdae189,_0x1e0fd8);var _0x19eb7f=path[_0xf751('0x33')](__dirname,_0xf751('0x34'),rs['generate'](0x4)+_0xf751('0x35'));var _0x4d093f;return downloadFile(_0xcf22f1,_0x19eb7f)[_0xf751('0x27')](function(){_0x4d093f=path['resolve'](__dirname,_0xf751('0x34'),rs[_0xf751('0x39')](0x4)+_0xf751('0x25'));return convertFile(_0x19eb7f,_0x4d093f);})[_0xf751('0x27')](function(){try{fs[_0xf751('0x1a')](_0x19eb7f);fs[_0xf751('0x28')](_0x4d093f,'777');}catch(_0x4ec93d){logger[_0xf751('0x12')](_0x4ec93d);}return _0x4d093f[_0xf751('0x2a')]('.')[0x0];});};exports[_0xf751('0x7b')]=function(_0x21a51b,_0x12b633,_0x303ec0,_0xc33b6f){var _0x13e1a2=util[_0xf751('0x7a')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x12b633,_0x303ec0,base64Encode(_0x21a51b),_0xc33b6f?util[_0xf751('0x7a')](_0xf751('0x7c'),encodeURIComponent(_0xc33b6f)):_0xf751('0x7d'));return uploadFile(_0x13e1a2)[_0xf751('0x27')](function(_0x4fc0f3){return querystring[_0xf751('0x7e')](_0x4fc0f3);});};exports['sestekNDA']=function(_0x3d93b5,_0x2cc0b5){return sestek['nda'](_0x3d93b5,_0x2cc0b5)[_0xf751('0x27')](function(_0x50072b){logger[_0xf751('0x17')](JSON[_0xf751('0x40')](_0x50072b));var _0x5431ac={'speech':_0x50072b[_0xf751('0x7f')],'action':_0x50072b[_0xf751('0x80')]?_0x50072b['channelData'][_0xf751('0x81')]:undefined,'actiondata':_0x50072b['channelData']?_0x50072b[_0xf751('0x80')][_0xf751('0x82')]:undefined};if(_0x50072b[_0xf751('0x80')]&&_0x50072b[_0xf751('0x80')][_0xf751('0x83')]){return base64Decode(_0x50072b['channelData'][_0xf751('0x83')][_0xf751('0x84')],path[_0xf751('0x33')](__dirname,_0xf751('0x34'),rs[_0xf751('0x39')](0x4)+_0xf751('0x25')))[_0xf751('0x27')](function(_0x2cd671){_0x5431ac[_0xf751('0x85')]=_0x2cd671;return _0x5431ac;});}return _0x5431ac;});};exports[_0xf751('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0x2b51=['queryResult','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','bluebird','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./google','./sestek','agi','https:','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','protocol','path','get','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','POST','then','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','join','confidence','name','result','source','resolvedQuery','actionIncomplete','speech','score','status','code','metadata','endConversation','isFallbackIntent','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:'];(function(_0x3391fe,_0x8f7a51){var _0x1d7f4e=function(_0x5504ac){while(--_0x5504ac){_0x3391fe['push'](_0x3391fe['shift']());}};_0x1d7f4e(++_0x8f7a51);}(_0x2b51,0x1a5));var _0x12b5=function(_0x33de4f,_0x5578c7){_0x33de4f=_0x33de4f-0x0;var _0x32dc04=_0x2b51[_0x33de4f];return _0x32dc04;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x12b5('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x12b5('0x1'));var path=require('path');var querystring=require(_0x12b5('0x2'));var rp=require(_0x12b5('0x3'));var rs=require(_0x12b5('0x4'));var sox=require(_0x12b5('0x5'));var tts=require(_0x12b5('0x6'));var urlParse=require(_0x12b5('0x7'))[_0x12b5('0x8')];var util=require('util');var aws=require('./aws');var google=require(_0x12b5('0x9'));var sestek=require(_0x12b5('0xa'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x12b5('0xb'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x34133f,_0x31ab8d){return new BPromise(function(_0x217cac,_0x13a3d7){var _0x340d9a=urlParse(_0x34133f);var _0x4c6613=_0x340d9a['protocol']===_0x12b5('0xc')?https:http;var _0x2e098d={'host':_0x340d9a['host'],'path':_0x340d9a['path'],'headers':{'user-agent':_0x12b5('0xd')}};_0x4c6613['get'](_0x2e098d,function(_0x2e9b6f){if(_0x2e9b6f[_0x12b5('0xe')]!==0xc8){logger[_0x12b5('0xf')](_0x12b5('0x10')+_0x34133f+_0x12b5('0x11')+_0x2e9b6f[_0x12b5('0xe')]+'\x20('+_0x2e9b6f[_0x12b5('0x12')]+')');_0x13a3d7(new Error(_0x12b5('0x10')+_0x34133f+_0x12b5('0x11')+_0x2e9b6f[_0x12b5('0xe')]+'\x20('+_0x2e9b6f[_0x12b5('0x12')]+')'));return;}var _0x2f6fad=fs[_0x12b5('0x13')](_0x31ab8d);_0x2f6fad['on'](_0x12b5('0x14'),function(){logger[_0x12b5('0x15')](_0x12b5('0x16'));_0x2f6fad[_0x12b5('0x17')](_0x217cac);});_0x2f6fad['on']('error',function(_0xe7b989){fs[_0x12b5('0x18')](_0x31ab8d);logger['error'](_0x12b5('0x19'),_0xe7b989);_0x13a3d7(_0xe7b989);});_0x2e9b6f[_0x12b5('0x1a')](_0x2f6fad);})['on']('error',function(_0xfd5d10){logger[_0x12b5('0xf')](_0xfd5d10);_0x13a3d7(_0xfd5d10);})['end']();});}function uploadFile(_0x37a868){return new BPromise(function(_0xc3633d,_0x402b2a){var _0x2eee29=urlParse(_0x37a868);var _0x27bbac=_0x2eee29[_0x12b5('0x1b')]===_0x12b5('0xc')?https:http;var _0x535716={'host':_0x2eee29['host'],'path':_0x2eee29[_0x12b5('0x1c')],'headers':{'user-agent':_0x12b5('0xd')}};_0x27bbac[_0x12b5('0x1d')](_0x535716,function(_0x99c141){if(_0x99c141[_0x12b5('0xe')]!==0xc8){_0x402b2a(new Error(_0x12b5('0x10')+_0x37a868+_0x12b5('0x11')+_0x99c141[_0x12b5('0xe')]+'\x20('+_0x99c141['statusMessage']+')'));return;}var _0x485d05='';_0x99c141['on'](_0x12b5('0x1e'),function(_0x59a2a2){_0x485d05+=_0x59a2a2;});_0x99c141['on']('end',function(){_0xc3633d(_0x485d05);});})['on'](_0x12b5('0xf'),function(_0x229235){_0x402b2a(_0x229235);})[_0x12b5('0x1f')]();});}function convertFile(_0x48fa5c,_0x2e835c){return new BPromise(function(_0x399d06,_0x2378f7){var _0x2313a8=sox[_0x12b5('0x20')](_0x48fa5c,_0x2e835c,{'sampleRate':0x1f40,'format':_0x12b5('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2313a8['on'](_0x12b5('0xf'),function(_0x359b91){logger['error'](_0x12b5('0x22'),_0x359b91);_0x2378f7(_0x359b91);});_0x2313a8['on'](_0x12b5('0x1f'),function(){logger[_0x12b5('0x15')](_0x12b5('0x23'));_0x399d06();});_0x2313a8[_0x12b5('0x24')]();});}function base64Decode(_0x20c192,_0x562778){var _0x3fecf0=path[_0x12b5('0x25')](__dirname,_0x12b5('0x26'),rs[_0x12b5('0x27')](0x4)+_0x12b5('0x28'));fs[_0x12b5('0x29')](_0x3fecf0,_0x20c192,_0x12b5('0x2a'));return convertFile(_0x3fecf0,_0x562778)['then'](function(){try{fs['unlink'](_0x3fecf0);fs[_0x12b5('0x2b')](_0x562778,_0x12b5('0x2c'));}catch(_0x14a31f){logger[_0x12b5('0xf')](_0x14a31f);}return _0x562778['split']('.')[0x0];});}function base64Encode(_0x192179){var _0x8bca04=fs['readFileSync'](_0x192179);return new Buffer(_0x8bca04)['toString'](_0x12b5('0x2a'));}exports[_0x12b5('0x2d')]=function(_0x4ce210,_0x29d220,_0x11cd52,_0xa9fca8,_0x18088d,_0x3f149d){var _0x5a1666,_0x4c0e30;var _0x28f678=_0x12b5('0x2e');var _0x5bcd05=_0x12b5('0x2f')+_0x4ce210;var _0x5da81b={};if(_0x29d220==='ssml'){_0x5da81b[_0x12b5('0x30')]={'ssml':_0x11cd52};}else{_0x5da81b['input']={'text':_0x11cd52};};_0x5da81b[_0x12b5('0x31')]={'languageCode':_0xa9fca8,'ssmlGender':_0x18088d};_0x5da81b[_0x12b5('0x32')]={'audioEncoding':_0x12b5('0x33'),'sampleRateHertz':0x1f40};var _0x9887c6={'url':_0x28f678+'text:synthesize'+_0x5bcd05,'method':_0x12b5('0x34'),'json':!![],'body':_0x5da81b};return rp(_0x9887c6)[_0x12b5('0x35')](function(_0x54929e){return new BPromise(function(_0x2218d6,_0x1abb37){_0x5a1666=path[_0x12b5('0x25')](__dirname,'tmp',rs[_0x12b5('0x27')](0x4)+_0x12b5('0x36'));var _0x570f8a=Buffer[_0x12b5('0x37')](_0x54929e[_0x12b5('0x38')],_0x12b5('0x2a'));return fs[_0x12b5('0x39')](_0x5a1666,_0x570f8a,function(_0x498aa8){_0x1abb37(_0x498aa8);},function(_0xf7dd9e){fs[_0x12b5('0x2b')](_0x5a1666,_0x12b5('0x2c'));_0x2218d6(_0xf7dd9e);});});})[_0x12b5('0x35')](function(_0x40b19f){_0x4c0e30=path[_0x12b5('0x25')](__dirname,_0x12b5('0x26'),rs[_0x12b5('0x27')](0x4)+_0x12b5('0x28'));return convertFile(_0x5a1666,_0x4c0e30);})[_0x12b5('0x35')](function(){try{fs[_0x12b5('0x18')](_0x5a1666);fs['chmodSync'](_0x4c0e30,'777');}catch(_0x40dc6a){logger['error'](_0x40dc6a);}logger[_0x12b5('0x15')](_0x12b5('0x3a'),_0x4c0e30['split']('.')[0x0]);return _0x4c0e30[_0x12b5('0x3b')]('.')[0x0];});};exports[_0x12b5('0x3c')]=function(_0xfb453e,_0x3123cb){var _0x4485fd=_0x12b5('0x3d');var _0x44bec5,_0x1aa1e7;var _0x192714;var _0x34acb4={'encoding':_0x12b5('0x3e'),'method':_0x12b5('0x34'),'timeout':0x2710,'url':_0x4485fd,'headers':{'Content-Type':_0x12b5('0x3f')},'body':_0x12b5('0x40')+encodeURIComponent(JSON[_0x12b5('0x41')]([[[_0x12b5('0x42'),JSON[_0x12b5('0x41')]([_0xfb453e,_0x3123cb||'en',![],'null']),null,_0x12b5('0x43')]]]))};return rp(_0x34acb4)[_0x12b5('0x35')](function(_0x5227fd){try{_0x192714=eval(_0x5227fd[_0x12b5('0x44')](0x5))[0x0][0x2];}catch(_0x41987e){throw new Error(_0x12b5('0x45')+_0x5227fd[_0x12b5('0x1e')]);}if(!_0x192714){if(_0xfb453e[_0x12b5('0x46')]>0xc8){throw new Error(_0x12b5('0x47'));}else{throw new Error(_0x12b5('0x48')+_0x3123cb+_0x12b5('0x49'));}}try{_0x192714=eval(_0x192714)[0x0];}catch(_0x565eac){throw new Error(_0x12b5('0x45')+res[_0x12b5('0x1e')]);}const _0xc6f5b3=_0x192714;_0x44bec5=path[_0x12b5('0x25')](__dirname,_0x12b5('0x26'),rs['generate'](0x4)+_0x12b5('0x36'));fs[_0x12b5('0x29')](_0x44bec5,_0x192714,{'encoding':_0x12b5('0x2a')});_0x1aa1e7=path[_0x12b5('0x25')](__dirname,_0x12b5('0x26'),rs[_0x12b5('0x27')](0x4)+'.wav');return convertFile(_0x44bec5,_0x1aa1e7);})['then'](function(){try{fs[_0x12b5('0x18')](_0x44bec5);fs[_0x12b5('0x2b')](_0x1aa1e7,'777');}catch(_0x2b82c3){logger[_0x12b5('0xf')](_0x2b82c3);}logger['info'](_0x12b5('0x4a'),_0x1aa1e7[_0x12b5('0x3b')]('.')[0x0]);return _0x1aa1e7['split']('.')[0x0];});};exports[_0x12b5('0x4b')]=function(_0x37b072,_0x45956f,_0x4a3708){return google[_0x12b5('0x4c')](_0x37b072,_0x45956f,_0x4a3708)[_0x12b5('0x35')](function(_0x241b2c){logger[_0x12b5('0x15')](_0x241b2c[_0x12b5('0x4d')]);return rp(_0x241b2c);})[_0x12b5('0x35')](function(_0x9b164f){var _0x23be24='';var _0x3277ac=0x0;try{fs[_0x12b5('0x18')](_0x37b072);}catch(_0x1800c1){logger[_0x12b5('0xf')](_0x1800c1);}if(_0x9b164f&&_0x9b164f[_0x12b5('0x4e')]){_0x23be24=_0x9b164f[_0x12b5('0x4e')][_0x12b5('0x4f')](function(_0x3531d1){return _0x3531d1&&_0x3531d1['alternatives'][0x0]&&_0x3531d1['alternatives'][0x0]['transcript']?_0x3531d1[_0x12b5('0x50')][0x0]['transcript']:'';})[_0x12b5('0x51')]('\x0a');_0x3277ac=_0x9b164f['results'][_0x12b5('0x4f')](function(_0x1118be){return _0x1118be&&_0x1118be[_0x12b5('0x50')][0x0]&&_0x1118be[_0x12b5('0x50')][0x0][_0x12b5('0x52')]?_0x1118be[_0x12b5('0x50')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x12b5('0x15')]('googleASR\x20transcription',_0x23be24);logger[_0x12b5('0x15')]('googleASR\x20confidence',_0x3277ac);return{'transcript':_0x23be24,'confidence':_0x3277ac};})['catch'](function(_0x319105){logger[_0x12b5('0xf')]('[%s]\x20%s:%s',_0x319105[_0x12b5('0xe')],_0x319105[_0x12b5('0x53')],_0x319105['message']);});};exports['googleDialogflow']=function(_0x435da9,_0x225e75,_0x4b9e42,_0x111418){var _0xfcd67c=apiai(_0x225e75,{'language':_0x111418||'en'});return _0xfcd67c['textRequest'](_0x4b9e42,{'sessionId':md5(_0x435da9)})[_0x12b5('0x35')](function(_0x24888a){logger[_0x12b5('0x15')](JSON[_0x12b5('0x41')](_0x24888a));return{'source':_0x24888a[_0x12b5('0x54')][_0x12b5('0x55')],'resolvedQuery':_0x24888a[_0x12b5('0x54')][_0x12b5('0x56')],'action':_0x24888a[_0x12b5('0x54')]['action'],'actionIncomplete':_0x24888a['result'][_0x12b5('0x57')],'speech':_0x24888a['result']['fulfillment'][_0x12b5('0x58')],'score':_0x24888a[_0x12b5('0x54')][_0x12b5('0x59')],'statusCode':_0x24888a[_0x12b5('0x5a')][_0x12b5('0x5b')],'endConversation':_0x24888a[_0x12b5('0x54')][_0x12b5('0x5c')][_0x12b5('0x5d')]||![],'isFallbackIntent':_0x24888a[_0x12b5('0x54')][_0x12b5('0x5c')][_0x12b5('0x5e')]};});};exports['googleDialogflowV2']=function(_0x265070,_0x479eb1,_0x3c1989,_0x5d5dd1,_0x4eb1c5,_0x4819e3){var _0x92da49=_0x5d5dd1[_0x12b5('0x5f')](/\\n/g,'\x0a');var _0x2ccb59={'credentials':{'private_key':_0x92da49,'client_email':_0x3c1989}};var _0x545f00=new dialogflow['SessionsClient'](_0x2ccb59);var _0xc23b6=_0x545f00[_0x12b5('0x60')](_0x479eb1,md5(_0x265070));var _0x45516f={'session':_0xc23b6,'queryInput':{'text':{'text':_0x4eb1c5,'languageCode':_0x4819e3}}};return _0x545f00[_0x12b5('0x61')](_0x45516f)['then'](function(_0x163268){if(_0x163268&&_0x163268['length']){logger[_0x12b5('0x15')](_0x12b5('0x62'),JSON[_0x12b5('0x41')](_0x163268));var _0x197b28=_0x163268[0x0];if(_0x197b28){var _0x2c8c43={'action':_0x197b28[_0x12b5('0x63')]['action'],'allRequiredParamsPresent':_0x197b28[_0x12b5('0x63')]['allRequiredParamsPresent'],'endConversation':_0x197b28[_0x12b5('0x63')][_0x12b5('0x64')]&&_0x197b28['queryResult']['diagnosticInfo'][_0x12b5('0x65')]?_0x197b28[_0x12b5('0x63')][_0x12b5('0x64')][_0x12b5('0x65')]['end_conversation'][_0x12b5('0x66')]:![],'fulfillmentText':_0x197b28['queryResult'][_0x12b5('0x67')],'intentName':_0x197b28['queryResult']['intent']['name'],'intentDisplayName':_0x197b28['queryResult'][_0x12b5('0x68')][_0x12b5('0x69')],'isFallbackIntent':_0x197b28[_0x12b5('0x63')]['intent']['isFallback'],'languageCode':_0x197b28[_0x12b5('0x63')][_0x12b5('0x6a')],'queryText':_0x197b28['queryResult'][_0x12b5('0x6b')],'responseId':_0x197b28[_0x12b5('0x6c')],'score':_0x197b28[_0x12b5('0x63')]['intentDetectionConfidence'],'speech':_0x197b28['queryResult'][_0x12b5('0x67')],'providerResponse':JSON['stringify'](_0x163268)};return _0x2c8c43;}}});};exports[_0x12b5('0x6d')]=function(_0x1f14cc,_0x3a4004,_0x51ee20,_0x1e4686){return tilde[_0x12b5('0x4c')](_0x1f14cc,_0x3a4004,_0x51ee20,_0x1e4686)[_0x12b5('0x35')](function(_0x168f9c){try{fs['unlink'](_0x1f14cc);}catch(_0x48804d){logger[_0x12b5('0xf')](_0x48804d);}logger[_0x12b5('0x15')](_0x12b5('0x6e'),_0x168f9c[_0x12b5('0x6f')]);logger[_0x12b5('0x15')](_0x12b5('0x70'),_0x168f9c[_0x12b5('0x52')]);return _0x168f9c;});};exports[_0x12b5('0x71')]=function(_0x1b17cc,_0xdb1373,_0x5d0641,_0x166078,_0x1744fa,_0x3d7a89){var _0xdd4177=path[_0x12b5('0x25')](__dirname,'tmp',rs[_0x12b5('0x27')](0x4)+_0x12b5('0x36'));var _0x288c6f;return aws[_0x12b5('0x72')](_0x1b17cc,_0xdb1373,_0x5d0641,_0x166078,_0x1744fa,_0x3d7a89,_0xdd4177)['then'](function(){_0x288c6f=path[_0x12b5('0x25')](__dirname,_0x12b5('0x26'),rs[_0x12b5('0x27')](0x4)+_0x12b5('0x28'));return convertFile(_0xdd4177,_0x288c6f);})[_0x12b5('0x35')](function(){try{fs['unlink'](_0xdd4177);fs['chmodSync'](_0x288c6f,_0x12b5('0x2c'));}catch(_0x565c20){logger[_0x12b5('0xf')](_0x565c20);}return _0x288c6f[_0x12b5('0x3b')]('.')[0x0];});};exports[_0x12b5('0x73')]=function(_0x4b8878,_0x2ecf3d,_0x26d474,_0x4d3e8d,_0x11dd33,_0x251cd3){return aws[_0x12b5('0x74')](_0x4b8878,_0x2ecf3d,_0x26d474,_0x4d3e8d,_0x11dd33,_0x251cd3)[_0x12b5('0x35')](function(_0x27bc1a){logger[_0x12b5('0x15')](JSON[_0x12b5('0x41')](_0x27bc1a));return _0x27bc1a;});};exports[_0x12b5('0x75')]=function(_0x3f837c,_0x224754,_0x5b02b1,_0x100b91){var _0x17f102=util[_0x12b5('0x76')](_0x12b5('0x77'),ISPEECH_API,_0x3f837c,encodeURIComponent(_0x224754),_0x5b02b1,_0x100b91);var _0x1de2b4=path[_0x12b5('0x25')](__dirname,'tmp',rs[_0x12b5('0x27')](0x4)+_0x12b5('0x36'));var _0x344905;return downloadFile(_0x17f102,_0x1de2b4)['then'](function(){_0x344905=path[_0x12b5('0x25')](__dirname,_0x12b5('0x26'),rs[_0x12b5('0x27')](0x4)+_0x12b5('0x28'));return convertFile(_0x1de2b4,_0x344905);})[_0x12b5('0x35')](function(){try{fs[_0x12b5('0x18')](_0x1de2b4);fs[_0x12b5('0x2b')](_0x344905,_0x12b5('0x2c'));}catch(_0x5a693f){logger['error'](_0x5a693f);}return _0x344905[_0x12b5('0x3b')]('.')[0x0];});};exports[_0x12b5('0x78')]=function(_0x475f0e,_0xb2f77f,_0x410c07,_0x1920a4){var _0x313126=util[_0x12b5('0x76')](_0x12b5('0x79'),ISPEECH_API,_0xb2f77f,_0x410c07,base64Encode(_0x475f0e),_0x1920a4?util[_0x12b5('0x76')](_0x12b5('0x7a'),encodeURIComponent(_0x1920a4)):_0x12b5('0x7b'));return uploadFile(_0x313126)['then'](function(_0xc98d72){return querystring[_0x12b5('0x8')](_0xc98d72);});};exports['sestekNDA']=function(_0x7726e1,_0x33050c){return sestek['nda'](_0x7726e1,_0x33050c)['then'](function(_0x45e5a6){logger['info'](JSON[_0x12b5('0x41')](_0x45e5a6));var _0x46a28d={'speech':_0x45e5a6['text'],'action':_0x45e5a6[_0x12b5('0x7c')]?_0x45e5a6[_0x12b5('0x7c')][_0x12b5('0x7d')]:undefined,'actiondata':_0x45e5a6[_0x12b5('0x7c')]?_0x45e5a6[_0x12b5('0x7c')][_0x12b5('0x7e')]:undefined};if(_0x45e5a6[_0x12b5('0x7c')]&&_0x45e5a6[_0x12b5('0x7c')][_0x12b5('0x7f')]){return base64Decode(_0x45e5a6[_0x12b5('0x7c')]['AudioFromTts']['Data'],path[_0x12b5('0x25')](__dirname,'tmp',rs[_0x12b5('0x27')](0x4)+_0x12b5('0x28')))[_0x12b5('0x35')](function(_0x25f599){_0x46a28d[_0x12b5('0x80')]=_0x25f599;return _0x46a28d;});}return _0x46a28d;});};exports[_0x12b5('0x81')]=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 e37d93b..107d6c9 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 _0x4644=['./nda','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4644,0xde));var _0x4464=function(_0x56a37c,_0x749e8e){_0x56a37c=_0x56a37c-0x0;var _0x5afdee=_0x4644[_0x56a37c];return _0x5afdee;};var nda=require(_0x4464('0x0'));module[_0x4464('0x1')]={'nda':nda}; \ No newline at end of file +var _0x5586=['./nda','exports'];(function(_0x166c10,_0x3b0756){var _0x33be20=function(_0x53a523){while(--_0x53a523){_0x166c10['push'](_0x166c10['shift']());}};_0x33be20(++_0x3b0756);}(_0x5586,0x1ae));var _0x6558=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x5586[_0x29d94e];return _0x106237;};var nda=require(_0x6558('0x0'));module[_0x6558('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 f5c4d6f..f6448d1 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 _0x7846=['../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','url'];(function(_0x1bd7e5,_0x24b050){var _0x2d0137=function(_0x509e8e){while(--_0x509e8e){_0x1bd7e5['push'](_0x1bd7e5['shift']());}};_0x2d0137(++_0x24b050);}(_0x7846,0xf4));var _0x6784=function(_0x4ccf7f,_0x161ffd){_0x4ccf7f=_0x4ccf7f-0x0;var _0x1953f0=_0x7846[_0x4ccf7f];return _0x1953f0;};'use strict';var rp=require('request-promise');var url=require(_0x6784('0x0'));var logger=require(_0x6784('0x1'))(_0x6784('0x2'));module[_0x6784('0x3')]=function(_0x3c868d,_0x7653ef){var _0x479b0a={'method':_0x6784('0x4'),'uri':url[_0x6784('0x5')](_0x7653ef[_0x6784('0x6')],_0x6784('0x7')),'form':{'grant_type':_0x6784('0x8'),'username':_0x7653ef[_0x6784('0x9')],'password':_0x7653ef[_0x6784('0x8')]},'json':!![]};return rp(_0x479b0a)['then'](function(_0x560e3f){var _0x289ae9={'method':_0x6784('0x4'),'uri':url[_0x6784('0x5')](_0x7653ef[_0x6784('0xa')],_0x6784('0xb')),'body':{'type':_0x7653ef[_0x6784('0xc')]||_0x6784('0xd'),'channelId':_0x6784('0xe'),'conversation':{'id':_0x3c868d[_0x6784('0xf')]},'from':{'id':_0x3c868d[_0x6784('0x10')],'name':_0x3c868d[_0x6784('0x11')]},'recipient':{'id':_0x3c868d[_0x6784('0x12')],'name':_0x3c868d[_0x6784('0x13')]},'text':_0x7653ef[_0x6784('0x14')],'channelData':{}},'headers':{'Authorization':_0x6784('0x15')+_0x560e3f[_0x6784('0x16')]},'json':!![]};if(_0x7653ef['project']){_0x289ae9[_0x6784('0x17')][_0x6784('0x18')][_0x6784('0x19')]=_0x7653ef[_0x6784('0x1a')];}if(_0x7653ef['ndagenerate_audio']=='1'){_0x289ae9[_0x6784('0x17')][_0x6784('0x18')][_0x6784('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6784('0x1c')};}if(_0x7653ef[_0x6784('0x1d')]){_0x289ae9[_0x6784('0x17')][_0x6784('0x18')][_0x6784('0x1e')]=_0x7653ef[_0x6784('0x1d')];if(_0x7653ef[_0x6784('0x1f')]){_0x289ae9[_0x6784('0x17')]['channelData'][_0x6784('0x20')]=_0x7653ef[_0x6784('0x1f')];}}logger[_0x6784('0x21')](JSON[_0x6784('0x22')](_0x289ae9));return rp(_0x289ae9);});}; \ No newline at end of file +var _0x3715=['agi','exports','POST','resolve','ndauth_url','/token','username','password','ndassistant_url','message','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','channelData','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger'];(function(_0x24a15e,_0x4862ce){var _0x10256f=function(_0x43ed6e){while(--_0x43ed6e){_0x24a15e['push'](_0x24a15e['shift']());}};_0x10256f(++_0x4862ce);}(_0x3715,0xc3));var _0x5371=function(_0x514fbf,_0x440521){_0x514fbf=_0x514fbf-0x0;var _0x3ee712=_0x3715[_0x514fbf];return _0x3ee712;};'use strict';var rp=require(_0x5371('0x0'));var url=require(_0x5371('0x1'));var logger=require(_0x5371('0x2'))(_0x5371('0x3'));module[_0x5371('0x4')]=function(_0x2f9a2c,_0x132ef3){var _0x396146={'method':_0x5371('0x5'),'uri':url[_0x5371('0x6')](_0x132ef3[_0x5371('0x7')],_0x5371('0x8')),'form':{'grant_type':'password','username':_0x132ef3[_0x5371('0x9')],'password':_0x132ef3[_0x5371('0xa')]},'json':!![]};return rp(_0x396146)['then'](function(_0x426a2a){var _0x16c64a={'method':_0x5371('0x5'),'uri':url['resolve'](_0x132ef3[_0x5371('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x132ef3['ndaactivity_type']||_0x5371('0xc'),'channelId':_0x5371('0xd'),'conversation':{'id':_0x2f9a2c[_0x5371('0xe')]},'from':{'id':_0x2f9a2c['callerid'],'name':_0x2f9a2c[_0x5371('0xf')]},'recipient':{'id':_0x2f9a2c[_0x5371('0x10')],'name':_0x2f9a2c[_0x5371('0x11')]},'text':_0x132ef3['text'],'channelData':{}},'headers':{'Authorization':_0x5371('0x12')+_0x426a2a[_0x5371('0x13')]},'json':!![]};if(_0x132ef3[_0x5371('0x14')]){_0x16c64a[_0x5371('0x15')]['channelData'][_0x5371('0x16')]=_0x132ef3['project'];}if(_0x132ef3[_0x5371('0x17')]=='1'){_0x16c64a[_0x5371('0x15')]['channelData'][_0x5371('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5371('0x19')};}if(_0x132ef3[_0x5371('0x1a')]){_0x16c64a[_0x5371('0x15')][_0x5371('0x1b')][_0x5371('0x1c')]=_0x132ef3[_0x5371('0x1a')];if(_0x132ef3['custom_action_data']){_0x16c64a[_0x5371('0x15')][_0x5371('0x1b')][_0x5371('0x1d')]=_0x132ef3[_0x5371('0x1e')];}}logger[_0x5371('0x1f')](JSON[_0x5371('0x20')](_0x16c64a));return rp(_0x16c64a);});}; \ 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 c21040d..dbebfbc 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 _0x262a=['./lib/api','exports'];(function(_0x57a782,_0x384f01){var _0x4b9534=function(_0x931e6c){while(--_0x931e6c){_0x57a782['push'](_0x57a782['shift']());}};_0x4b9534(++_0x384f01);}(_0x262a,0x178));var _0xa262=function(_0x41dfac,_0x278319){_0x41dfac=_0x41dfac-0x0;var _0x12900b=_0x262a[_0x41dfac];return _0x12900b;};'use strict';var asr=require(_0xa262('0x0'));module[_0xa262('0x1')]=function(_0x406de8,_0xb19d4b,_0x2cebe9,_0x35ec12){return asr(_0x406de8,_0xb19d4b,_0x2cebe9,_0x35ec12);}; \ No newline at end of file +var _0xfa00=['exports','./lib/api'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xfa00,0x129));var _0x0fa0=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xfa00[_0x46e363];return _0x3fb059;};'use strict';var asr=require(_0x0fa0('0x0'));module[_0x0fa0('0x1')]=function(_0x41805f,_0x5927b9,_0x5246a8,_0x9db3b7){return asr(_0x41805f,_0x5927b9,_0x5246a8,_0x9db3b7);}; \ 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 698b6a6..9b07484 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 _0x4d85=['unix','send','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','result','final','Tilde\x20ASR\x20hypoteses','stringify','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','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket'];(function(_0x31fb49,_0x3102b1){var _0xb92c74=function(_0x29201d){while(--_0x29201d){_0x31fb49['push'](_0x31fb49['shift']());}};_0xb92c74(++_0x3102b1);}(_0x4d85,0x1dd));var _0x54d8=function(_0x3a17b5,_0x350d1e){_0x3a17b5=_0x3a17b5-0x0;var _0x2f5421=_0x4d85[_0x3a17b5];return _0x2f5421;};'use strict';var BPromise=require(_0x54d8('0x0'));var _=require(_0x54d8('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x54d8('0x2'));var crypto=require(_0x54d8('0x3'));var logger=require(_0x54d8('0x4'))(_0x54d8('0x5'));module['exports']=function(_0xa2e1e3,_0x28e9f5,_0x536d8f,_0x4c3bbd){return new BPromise(function(_0x11eb2f,_0x258bda){logger['info']('Tilde\x20URI',_0x4c3bbd||_0x54d8('0x6'));var _0x588724=new WebSocket(_0x4c3bbd||_0x54d8('0x6'),{'perMessageDeflate':![]});var _0x102efb='';var _0x5e8502='0';var _0x3f94cf='1';var _0x2daf54=_0x54d8('0x7');function _0x367c93(_0x38ef8b){var _0x390c4e=crypto[_0x54d8('0x8')](_0x54d8('0x9'));_0x390c4e[_0x54d8('0xa')](_0x38ef8b);return _0x390c4e[_0x54d8('0xb')](_0x54d8('0xc'));}function _0x3756cd(){try{logger[_0x54d8('0xd')](_0x54d8('0xe'));var _0x3d2c56=moment()[_0x54d8('0xf')]();var _0x5cdd54=_0x367c93(_0x3d2c56+_0x28e9f5+_0x536d8f);_0x588724[_0x54d8('0x10')](JSON['stringify']({'appID':_0x28e9f5,'timestamp':_0x3d2c56,'appKey':_0x5cdd54}));var _0x46f9ee=fs[_0x54d8('0x11')](_0xa2e1e3);_0x46f9ee['on'](_0x54d8('0x12'),function(_0x55bfc9){_0x588724[_0x54d8('0x10')](_0x55bfc9);});_0x46f9ee['on'](_0x54d8('0x13'),function(){_0x588724[_0x54d8('0x10')]('EOS');});}catch(_0x64fa00){logger[_0x54d8('0x14')](_0x54d8('0x15'),JSON['stringify'](_0x64fa00));_0x588724[_0x54d8('0x16')]();}}function _0x121b79(_0x967343){try{if(_0x967343){var _0x4cfe4b=JSON['parse'](_0x967343);switch(_0x4cfe4b['status']){case 0x0:if(_0x4cfe4b[_0x54d8('0x17')]){if(_0x4cfe4b['result'][_0x54d8('0x18')]){logger['info'](_0x54d8('0x19'),JSON[_0x54d8('0x1a')](_0x4cfe4b[_0x54d8('0x17')][_0x54d8('0x1b')]));_0x102efb=_0x4cfe4b[_0x54d8('0x17')]['hypotheses'][0x0][_0x54d8('0x1c')];_0x5e8502=_0x4cfe4b[_0x54d8('0x17')][_0x54d8('0x1b')][0x0][_0x54d8('0x1d')];_0x3f94cf='0';_0x2daf54=_0x54d8('0x1e');_0x588724['terminate']();}}break;case 0x1:logger[_0x54d8('0xd')](_0x54d8('0x7'));_0x3f94cf='1';_0x2daf54=_0x54d8('0x7');break;case 0x2:logger[_0x54d8('0xd')](_0x54d8('0x1f'));_0x3f94cf='2';_0x2daf54='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x54d8('0xd')](_0x54d8('0x20'));_0x3f94cf='9';_0x2daf54=_0x54d8('0x20');break;case 0xa:logger['info'](_0x54d8('0x21'));_0x3f94cf='10';_0x2daf54='Authentication\x20failed.';break;case 0xb:logger['info'](_0x54d8('0x22'));_0x3f94cf='11';_0x2daf54='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x1a0b0e){logger[_0x54d8('0x14')](_0x54d8('0x23'),JSON['stringify'](_0x1a0b0e));_0x588724['terminate']();}}function _0x4dc05f(){logger[_0x54d8('0xd')](_0x54d8('0x24'));_0x11eb2f({'transcript':_0x102efb,'confidence':_0x5e8502,'status':_0x3f94cf,'status_message':_0x2daf54});}function _0x20e44e(_0x500b26){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x54d8('0x25')](_0x500b26)){logger[_0x54d8('0x14')](_[_0x54d8('0x26')](_0x500b26)?JSON[_0x54d8('0x1a')](_0x500b26):_0x500b26);}}_0x588724['on'](_0x54d8('0x27'),_0x3756cd);_0x588724['on'](_0x54d8('0x28'),_0x121b79);_0x588724['on'](_0x54d8('0x13'),_0x4dc05f);_0x588724['on']('error',_0x20e44e);});}; \ No newline at end of file +var _0x8770=['Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket'];(function(_0x808fb0,_0x34c892){var _0x4705da=function(_0x302f35){while(--_0x302f35){_0x808fb0['push'](_0x808fb0['shift']());}};_0x4705da(++_0x34c892);}(_0x8770,0xad));var _0x0877=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8770[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0877('0x0'));var _=require(_0x0877('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0877('0x2'));var crypto=require(_0x0877('0x3'));var logger=require(_0x0877('0x4'))(_0x0877('0x5'));module['exports']=function(_0x4f08be,_0x440f0f,_0x3ea3f7,_0x51cd0e){return new BPromise(function(_0x168187,_0x4fc4ad){logger[_0x0877('0x6')](_0x0877('0x7'),_0x51cd0e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2c34fd=new WebSocket(_0x51cd0e||_0x0877('0x8'),{'perMessageDeflate':![]});var _0xfe2dd1='';var _0x15b72a='0';var _0xab29d3='1';var _0x34522f=_0x0877('0x9');function _0x361f16(_0x268575){var _0x14d202=crypto[_0x0877('0xa')](_0x0877('0xb'));_0x14d202[_0x0877('0xc')](_0x268575);return _0x14d202['digest'](_0x0877('0xd'));}function _0x330c83(){try{logger['info'](_0x0877('0xe'));var _0x451ea6=moment()['unix']();var _0x3ce2ff=_0x361f16(_0x451ea6+_0x440f0f+_0x3ea3f7);_0x2c34fd[_0x0877('0xf')](JSON[_0x0877('0x10')]({'appID':_0x440f0f,'timestamp':_0x451ea6,'appKey':_0x3ce2ff}));var _0x4e5459=fs[_0x0877('0x11')](_0x4f08be);_0x4e5459['on'](_0x0877('0x12'),function(_0xf67d23){_0x2c34fd[_0x0877('0xf')](_0xf67d23);});_0x4e5459['on'](_0x0877('0x13'),function(){_0x2c34fd[_0x0877('0xf')](_0x0877('0x14'));});}catch(_0x39c63b){logger[_0x0877('0x15')](_0x0877('0x16'),JSON[_0x0877('0x10')](_0x39c63b));_0x2c34fd[_0x0877('0x17')]();}}function _0x2ea90b(_0x2a2aee){try{if(_0x2a2aee){var _0x220e94=JSON[_0x0877('0x18')](_0x2a2aee);switch(_0x220e94[_0x0877('0x19')]){case 0x0:if(_0x220e94['result']){if(_0x220e94[_0x0877('0x1a')]['final']){logger[_0x0877('0x6')](_0x0877('0x1b'),JSON['stringify'](_0x220e94[_0x0877('0x1a')][_0x0877('0x1c')]));_0xfe2dd1=_0x220e94[_0x0877('0x1a')][_0x0877('0x1c')][0x0]['transcript'];_0x15b72a=_0x220e94[_0x0877('0x1a')]['hypotheses'][0x0][_0x0877('0x1d')];_0xab29d3='0';_0x34522f=_0x0877('0x1e');_0x2c34fd[_0x0877('0x17')]();}}break;case 0x1:logger[_0x0877('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0xab29d3='1';_0x34522f=_0x0877('0x9');break;case 0x2:logger[_0x0877('0x6')](_0x0877('0x1f'));_0xab29d3='2';_0x34522f=_0x0877('0x1f');break;case 0x9:logger[_0x0877('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0xab29d3='9';_0x34522f=_0x0877('0x20');break;case 0xa:logger['info']('Authentication\x20failed.');_0xab29d3='10';_0x34522f=_0x0877('0x21');break;case 0xb:logger[_0x0877('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0xab29d3='11';_0x34522f=_0x0877('0x22');}}}catch(_0x2103c8){logger['error'](_0x0877('0x23'),JSON['stringify'](_0x2103c8));_0x2c34fd[_0x0877('0x17')]();}}function _0x54229b(){logger[_0x0877('0x6')](_0x0877('0x24'));_0x168187({'transcript':_0xfe2dd1,'confidence':_0x15b72a,'status':_0xab29d3,'status_message':_0x34522f});}function _0x18414d(_0x19a8a5){logger[_0x0877('0x15')](_0x0877('0x25'));if(!_[_0x0877('0x26')](_0x19a8a5)){logger[_0x0877('0x15')](_[_0x0877('0x27')](_0x19a8a5)?JSON[_0x0877('0x10')](_0x19a8a5):_0x19a8a5);}}_0x2c34fd['on'](_0x0877('0x28'),_0x330c83);_0x2c34fd['on'](_0x0877('0x29'),_0x2ea90b);_0x2c34fd['on'](_0x0877('0x13'),_0x54229b);_0x2c34fd['on'](_0x0877('0x15'),_0x18414d);});}; \ 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 c138c58..9d558ac 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 _0x106c=['./asr','exports'];(function(_0x24d282,_0x1a2b5a){var _0x1b70b1=function(_0x44cb5e){while(--_0x44cb5e){_0x24d282['push'](_0x24d282['shift']());}};_0x1b70b1(++_0x1a2b5a);}(_0x106c,0x17e));var _0xc106=function(_0x11feca,_0x267832){_0x11feca=_0x11feca-0x0;var _0x57f6e9=_0x106c[_0x11feca];return _0x57f6e9;};var asr=require(_0xc106('0x0'));module[_0xc106('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa057=['exports','./asr'];(function(_0xaa393b,_0x265ddc){var _0x4bb14a=function(_0x465d6a){while(--_0x465d6a){_0xaa393b['push'](_0xaa393b['shift']());}};_0x4bb14a(++_0x265ddc);}(_0xa057,0x1d5));var _0x7a05=function(_0x155b0d,_0x3cad94){_0x155b0d=_0x155b0d-0x0;var _0x5061a8=_0xa057[_0x155b0d];return _0x5061a8;};var asr=require(_0x7a05('0x0'));module[_0x7a05('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index b65eac5..3337fc7 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 _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x1a58fa,_0x30353f){var _0x2d90b1=function(_0x26c36e){while(--_0x26c36e){_0x1a58fa['push'](_0x1a58fa['shift']());}};_0x2d90b1(++_0x30353f);}(_0x34e8,0x12c));var _0x834e=function(_0x3a22ae,_0x35b56a){_0x3a22ae=_0x3a22ae-0x0;var _0x50a925=_0x34e8[_0x3a22ae];return _0x50a925;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xe706,0xa3));var _0x6e70=function(_0x212d22,_0x2309d2){_0x212d22=_0x212d22-0x0;var _0x48f2b1=_0xe706[_0x212d22];return _0x48f2b1;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index e2338a0..97b2f6c 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 _0x2182=['keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','speech','dialogflow','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','setVariable','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','file_id','no\x20file\x20audio\x20selected','getSound','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','generate','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','wav','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechASR','ISPEECH_ASR_%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','escape_digits','restapi','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','template_id','account_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','debug','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','agi://%s/square,\x22%s\x22,\x22%s\x22','host','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\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','split','join','exports','util','lodash','shelljs','odbc','moment','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','toUpperCase','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','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','key','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','replaceAll','extra','getAndSetVariable','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','result','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach'];(function(_0x5e1a3e,_0xaf5f51){var _0x3a04b4=function(_0x5361a0){while(--_0x5361a0){_0x5e1a3e['push'](_0x5e1a3e['shift']());}};_0x3a04b4(++_0xaf5f51);}(_0x2182,0xea));var _0x2218=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2182[_0x3bf83f];return _0x22c4a9;};'use strict';var fs=require('fs');var util=require(_0x2218('0x0'));var _=require(_0x2218('0x1'));var sh=require(_0x2218('0x2'));var odbc=require(_0x2218('0x3'))();var rs=require('randomstring');var moment=require(_0x2218('0x4'));var Mustache=require('mustache');var rp=require(_0x2218('0x5'));var logger=require(_0x2218('0x6'))(_0x2218('0x7'));var config=require(_0x2218('0x8'));var shared=require(_0x2218('0x9'));var scripts=require(_0x2218('0xa'));var FILES_PATH=_0x2218('0xb');var recursiveMapAttributes=[_0x2218('0xc'),_0x2218('0xd')];var verticesWithRetry=[_0x2218('0xe'),'getdigits',_0x2218('0xf')];var AGIVertices=function(_0xed1f79,_0x15f490,_0x5bd041){this['channel']=_0xed1f79;this[_0x2218('0x10')]=_0x15f490;this[_0x2218('0x11')]=_0x5bd041;};AGIVertices[_0x2218('0x12')][_0x2218('0x13')]=function(_0x5a2a8d,_0x299c34){this[_0x2218('0x10')][_0x2218('0x14')](_0x5a2a8d)[_0x2218('0x15')](function(_0x2a0b55){_0x299c34(null,_0x2a0b55?_0x2a0b55['name']:![]);})[_0x2218('0x16')](function(_0x5d7d24){_0x299c34(_0x5d7d24);});};AGIVertices[_0x2218('0x12')][_0x2218('0x17')]=function(_0x383a56,_0x2b953a){this[_0x2218('0x10')][_0x2218('0x18')](_0x383a56)[_0x2218('0x15')](function(_0x2cbd55){_0x2b953a(null,_0x2cbd55?_0x2cbd55[_0x2218('0x19')]:![]);})[_0x2218('0x16')](function(_0x466d80){_0x2b953a(_0x466d80);});};AGIVertices[_0x2218('0x12')][_0x2218('0x1a')]=function(_0x3554fd,_0x21a612){this[_0x2218('0x10')][_0x2218('0x1b')](_0x3554fd)[_0x2218('0x15')](function(_0x1c83ea){_0x21a612(null,_0x1c83ea?_0x1c83ea[_0x2218('0x19')]:![]);})[_0x2218('0x16')](function(_0x58fe42){_0x21a612(_0x58fe42);});};AGIVertices[_0x2218('0x12')][_0x2218('0x1c')]=function(_0x2989f0,_0x40fc8d){this[_0x2218('0x10')][_0x2218('0x1d')](_0x2989f0)[_0x2218('0x15')](function(_0x4533c2){_0x40fc8d(null,_0x4533c2?_0x4533c2[_0x2218('0x1e')]:![]);})[_0x2218('0x16')](function(_0x2cee53){_0x40fc8d(_0x2cee53);});};AGIVertices[_0x2218('0x12')][_0x2218('0x1f')]=function(_0x439e5d,_0x11a2be){this[_0x2218('0x10')][_0x2218('0x20')](_0x439e5d)[_0x2218('0x15')](function(_0x4947a3){_0x11a2be(null,_0x4947a3?_0x4947a3[_0x2218('0x19')]:![]);})[_0x2218('0x16')](function(_0x980f15){_0x11a2be(_0x980f15);});};AGIVertices['prototype']['getTrunk']=function(_0x123996,_0x13246c){this['rpc'][_0x2218('0x21')](_0x123996)['then'](function(_0x44f352){_0x13246c(null,_0x44f352?_0x44f352[_0x2218('0x19')]:![]);})[_0x2218('0x16')](function(_0x65a513){_0x13246c(_0x65a513);});};AGIVertices['prototype']['getSound']=function(_0x10f1ff,_0x316651){var _0xcbe144=this;this[_0x2218('0x10')]['getSoundById'](_0x10f1ff)['then'](function(_0x4c211d){_0x316651(null,_0x4c211d?_0xcbe144['getSoundPath'](_0x4c211d[_0x2218('0x22')]):![]);})[_0x2218('0x16')](function(_0xac2931){_0x316651(_0xac2931);});};AGIVertices[_0x2218('0x12')][_0x2218('0x23')]=function(_0x45ba98,_0x2f3f1f){this[_0x2218('0x10')][_0x2218('0x24')](_0x45ba98)[_0x2218('0x15')](function(_0x2c1dfc){_0x2f3f1f(null,_0x2c1dfc?_0x2c1dfc:![]);})[_0x2218('0x16')](function(_0x31d347){_0x2f3f1f(_0x31d347);});};AGIVertices[_0x2218('0x12')][_0x2218('0x25')]=function(_0x2f92f0,_0x321a5e,_0x1004ff){this[_0x2218('0x11')]['sendMailMessage'](_0x2f92f0,_0x321a5e)[_0x2218('0x15')](function(){_0x1004ff(null);})[_0x2218('0x16')](function(_0x1e326f){_0x1004ff(_0x1e326f);});};AGIVertices['prototype'][_0x2218('0x26')]=function(_0x17d9cd,_0x14afeb){this[_0x2218('0x10')][_0x2218('0x27')](_0x17d9cd)[_0x2218('0x15')](function(_0x30164d){if(_0x30164d){if(_0x30164d[_0x2218('0x28')]){_0x14afeb(null,[_0x30164d[_0x2218('0x29')]]);}else{_0x14afeb(null,_['map'](_0x30164d[_0x2218('0x2a')],_0x2218('0x29')));}}else{_0x14afeb(null,![]);}})[_0x2218('0x16')](function(_0x54fb7a){_0x14afeb(_0x54fb7a);});};AGIVertices[_0x2218('0x12')][_0x2218('0x2b')]=function(_0x174256){return util[_0x2218('0x2c')](_0x2218('0x2d'),FILES_PATH,_0x174256);};AGIVertices[_0x2218('0x12')][_0x2218('0x2e')]=function(_0x1629f4,_0x100fee,_0x4f9a62){odbc[_0x2218('0x2f')](_0x1629f4,function(_0x2e45db){if(_0x2e45db){logger['error'](_0x2218('0x30'),_0x2e45db);_0x4f9a62(_0x2e45db);}else{logger[_0x2218('0x31')](_0x2218('0x32'));odbc['query'](_0x100fee,function(_0x4c89d0,_0x5230cb){if(_0x4c89d0){logger['info'](_0x2218('0x33'),_0x100fee);_0x4f9a62(_0x4c89d0);}else{logger[_0x2218('0x31')](_0x2218('0x34'),_0x100fee);odbc[_0x2218('0x35')](function(_0x353a97){if(_0x353a97){logger[_0x2218('0x36')](_0x2218('0x37'),_0x353a97);}_0x4f9a62(null,_0x5230cb);});}});}});};AGIVertices['prototype'][_0x2218('0x38')]=function(_0x2926bf,_0x12435b){this[_0x2218('0x10')]['getSmsAccountById'](_0x2926bf)[_0x2218('0x15')](function(_0x2a4350){_0x12435b(null,_0x2a4350?_0x2a4350:![]);})[_0x2218('0x16')](function(_0x2978e3){_0x12435b(_0x2978e3);});};AGIVertices['prototype']['createSmsMessage']=function(_0x5cb17a,_0x4bd948){this[_0x2218('0x10')][_0x2218('0x39')](_0x5cb17a)[_0x2218('0x15')](function(_0x1edab0){_0x4bd948(null,_0x1edab0);})[_0x2218('0x16')](function(_0x4d0e76){_0x4bd948(_0x4d0e76);});};AGIVertices['prototype'][_0x2218('0x3a')]=function(_0x3e44e9,_0x2b773a,_0x4646c0){this['rpc'][_0x2218('0x3a')]({'uniqueid':this[_0x2218('0x3b')][_0x2218('0x3c')],'node':_0x3e44e9[_0x2218('0x3d')],'application':_0x3e44e9[_0x2218('0x3e')],'data':_0x2b773a||null,'project_name':this[_0x2218('0x3b')][_0x2218('0x3f')],'callerid':this['channel'][_0x2218('0x40')]})['then'](function(_0x18025d){if(_0x4646c0){_0x4646c0(null,_0x18025d);}})[_0x2218('0x16')](function(_0x569175){if(_0x4646c0){_0x4646c0(_0x569175);}});};AGIVertices['prototype'][_0x2218('0x41')]=function(_0x152ced,_0x3a870d,_0x479072,_0x4e3bcb){this[_0x2218('0x10')][_0x2218('0x41')]({'uniqueid':this[_0x2218('0x3b')]['uniqueid'],'callerid':this[_0x2218('0x3b')][_0x2218('0x40')],'calleridname':this[_0x2218('0x3b')][_0x2218('0x42')],'context':this[_0x2218('0x3b')][_0x2218('0x43')],'extension':this[_0x2218('0x3b')]['extension'],'priority':this['channel'][_0x2218('0x44')],'accountcode':this[_0x2218('0x3b')][_0x2218('0x45')],'dnid':this[_0x2218('0x3b')][_0x2218('0x46')],'projectName':this[_0x2218('0x3b')]['arg_1'],'saveName':_0x3a870d,'filename':_0x152ced[_0x2218('0x47')]||_0x3a870d,'savePath':_0x479072})[_0x2218('0x15')](function(_0x2ac9d7){_0x4e3bcb(null,_0x2ac9d7);})['catch'](function(_0x4da7f4){_0x4e3bcb(_0x4da7f4);});};AGIVertices[_0x2218('0x12')][_0x2218('0x48')]=function(_0x19d255,_0x2ebddf,_0x3bcfd9,_0x3f2fc8,_0x5d90f7){this['rpc'][_0x2218('0x48')]({'uniqueid':this['channel'][_0x2218('0x3c')],'body':_0x19d255,'direction':_0x2ebddf,'providerName':_0x3bcfd9,'providerResponse':_0x3f2fc8})[_0x2218('0x15')](function(_0x53d8e4){if(_0x5d90f7){_0x5d90f7(null,_0x53d8e4);}})[_0x2218('0x16')](function(_0x4995a9){if(_0x5d90f7){_0x5d90f7(_0x4995a9);}});};AGIVertices['prototype'][_0x2218('0x49')]=function(_0xc0106e,_0x230a03){this[_0x2218('0x10')]['createCmContact']({'firstName':_[_0x2218('0x4a')](_0xc0106e[_0x2218('0x19')])||_['isNil'](_0xc0106e[_0x2218('0x19')])?_0x2218('0x4b')+Math[_0x2218('0x4c')]():_0xc0106e[_0x2218('0x19')],'lastName':_['isEmpty'](_0xc0106e[_0x2218('0x4d')])||_['isNil'](_0xc0106e[_0x2218('0x4d')])?null:_0xc0106e['lastName'],'phone':_0xc0106e[_0x2218('0x4e')],'ListId':_0xc0106e[_0x2218('0x4f')],'scheduledat':_0xc0106e[_0x2218('0x50')],'callbackUniqueid':this['channel'][_0x2218('0x3c')],'tags':'callback','description':_0x2218('0x51')+_0xc0106e['scheduledAt'][_0x2218('0x52')](),'priority':_0xc0106e[_0x2218('0x53')]})[_0x2218('0x15')](function(_0x803f21){_0x230a03(null,_0x803f21);})[_0x2218('0x16')](function(_0x273a43){_0x230a03(_0x273a43);});};AGIVertices[_0x2218('0x12')]['getPause']=function(_0x30066e,_0x5c53ff){this[_0x2218('0x10')][_0x2218('0x54')](_0x30066e)[_0x2218('0x15')](function(_0x3f2397){_0x5c53ff(null,_0x3f2397?_0x3f2397[_0x2218('0x19')]:![]);})[_0x2218('0x16')](function(_0x5a80c2){_0x5c53ff(_0x5a80c2);});};AGIVertices['prototype'][_0x2218('0x55')]=function(_0x2ac01f,_0x2bebe7,_0x317d90){var _0x2b05c5={'role':_0x2218('0x56')};_0x2b05c5[_0x2ac01f]=this[_0x2218('0x3b')][_0x2218('0x40')];this['rpc'][_0x2218('0x55')](_0x2b05c5,_0x2bebe7,this[_0x2218('0x3b')][_0x2218('0x3c')])[_0x2218('0x15')](function(_0x409c6b){_0x317d90(null,_[_0x2218('0x57')](_0x409c6b)?![]:!![]);})[_0x2218('0x16')](function(_0x1486c2){logger[_0x2218('0x36')](_0x1486c2);_0x317d90(null,![]);});};AGIVertices[_0x2218('0x12')][_0x2218('0x58')]=function(_0x2db29d,_0x56c5fb){var _0x423c8c={'role':_0x2218('0x56')};_0x423c8c[_0x2db29d]=this[_0x2218('0x3b')][_0x2218('0x40')];this['rpc']['agentUnpause'](_0x423c8c)['then'](function(_0x3613ce){_0x56c5fb(null,_[_0x2218('0x57')](_0x3613ce)?![]:!![]);})[_0x2218('0x16')](function(_0x185266){logger[_0x2218('0x36')](_0x185266);_0x56c5fb(null,![]);});};AGIVertices[_0x2218('0x12')][_0x2218('0x59')]=function(_0x343bc7,_0x58fc66){var _0x2266d1={'role':_0x2218('0x56')};_0x2266d1[_0x343bc7]=this[_0x2218('0x3b')][_0x2218('0x40')];this[_0x2218('0x10')][_0x2218('0x59')](_0x2266d1)[_0x2218('0x15')](function(_0x15f59b){_0x58fc66(null,_['isNil'](_0x15f59b)?![]:!![]);})[_0x2218('0x16')](function(_0x177420){logger['error'](_0x177420);_0x58fc66(null,![]);});};AGIVertices[_0x2218('0x12')][_0x2218('0x5a')]=function(_0x59545e,_0x4cf6fc){var _0x2beb12={'role':_0x2218('0x56')};_0x2beb12[_0x59545e]=this[_0x2218('0x3b')]['callerid'];var _0x206537=_0x59545e!=_0x2218('0x5b')?util[_0x2218('0x2c')](_0x2218('0x5c'),_0x2218('0x5d'),this['channel'][_0x2218('0x40')]):undefined;this[_0x2218('0x10')][_0x2218('0x5a')](_0x2beb12,_0x206537)['then'](function(_0xe2245f){_0x4cf6fc(null,_[_0x2218('0x57')](_0xe2245f)?![]:!![]);})[_0x2218('0x16')](function(_0x5e8c26){logger['error'](_0x5e8c26);_0x4cf6fc(null,![]);});};AGIVertices[_0x2218('0x12')][_0x2218('0x5e')]=function(_0x5e4a6c,_0x44aa53){sh[_0x2218('0x5f')](_[_0x2218('0x60')](_0x5e4a6c),function(_0x5a7f6d,_0x3116ad){var _0xac5205=_0x3116ad[_0x2218('0x61')](/(\r\n|\n|\r)/gm,'');_0x44aa53(null,_0xac5205);});};AGIVertices['prototype'][_0x2218('0x62')]=function(_0x240480,_0x531881){scripts[_0x2218('0x62')](_0x240480['apiKey'],_0x240480['google_cloud_tts_text_type']||'text',_0x240480[_0x2218('0x63')],_0x240480[_0x2218('0x64')]||_0x2218('0x65'),_0x240480[_0x2218('0x66')]||_0x2218('0x67'),_0x240480['audioEncoding']||_0x2218('0x68'))[_0x2218('0x15')](function(_0x3a5ebd){_0x531881(null,_0x3a5ebd);})[_0x2218('0x16')](function(_0x3bfb8e){_0x531881(_0x3bfb8e);});};AGIVertices[_0x2218('0x12')][_0x2218('0x69')]=function(_0x27183b,_0x266000){scripts[_0x2218('0x69')](_0x27183b[_0x2218('0x63')],_0x27183b[_0x2218('0x6a')]||'en',0x1)['then'](function(_0x285eb2){_0x266000(null,_0x285eb2);})[_0x2218('0x16')](function(_0x5c7e45){_0x266000(_0x5c7e45);});};AGIVertices[_0x2218('0x12')][_0x2218('0x6b')]=function(_0x5688e4,_0x5ee514){var _0xe16190={'uri':_0x5688e4[_0x2218('0x6c')],'method':_0x5688e4[_0x2218('0x6d')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5688e4[_0x2218('0x6e')])===_0x2218('0x6f')&&parseInt(_0x5688e4['timeout'])>=0x1?parseInt(_0x5688e4['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x2218('0x70')](['POST',_0x2218('0x71')],_0xe16190[_0x2218('0x6d')][_0x2218('0x72')]())){try{_0xe16190['body']=_0x5688e4[_0x2218('0xd')]?JSON[_0x2218('0x73')](_0x5688e4[_0x2218('0xd')]):{};}catch(_0x1be7dd){logger[_0x2218('0x36')](_0x2218('0x74'),_0x1be7dd);}}try{_0xe16190[_0x2218('0x75')]=_0x5688e4[_0x2218('0xc')]?JSON[_0x2218('0x73')](_0x5688e4[_0x2218('0xc')]):{};}catch(_0x396d66){logger[_0x2218('0x36')](_0x2218('0x76'),_0x396d66);}if(_0x5688e4[_0x2218('0x77')]){try{var _0xe01ca4=require(_0x5688e4['computedVariables'])[_0x2218('0x78')](this,_0xe16190);_0xe16190[_0x2218('0x79')]=Mustache[_0x2218('0x7a')](_0x5688e4[_0x2218('0x6c')],_0xe01ca4,{},['$$','$$']);if(_0xe16190[_0x2218('0x75')]){_0xe16190[_0x2218('0x75')]=JSON['parse'](Mustache[_0x2218('0x7a')](JSON[_0x2218('0x7b')](_0xe16190[_0x2218('0x75')]),_0xe01ca4,{},['$$','$$']));}if(_0xe16190[_0x2218('0x7c')]){_0xe16190[_0x2218('0x7c')]=JSON[_0x2218('0x73')](Mustache[_0x2218('0x7a')](JSON[_0x2218('0x7b')](_0xe16190[_0x2218('0x7c')]),_0xe01ca4,{},['$$','$$']));}}catch(_0x1eda49){logger['error'](_0x2218('0x7d'),_0x1eda49);}}rp(_0xe16190)['then'](function(_0x14685b){var _0x1756b6={'statusCode':_0x14685b[_0x2218('0x7e')]||0xc8,'statusMessage':_0x14685b['statusMessage']||'OK','headers':_0x14685b[_0x2218('0x75')]||{},'body':_0x14685b[_0x2218('0x7c')]||{}};_0x5ee514(null,_0x1756b6);})[_0x2218('0x16')](function(_0x344c08){var _0xfa304b={'statusCode':_0x344c08[_0x2218('0x7e')]||0x1f4,'statusMessage':_0x344c08[_0x2218('0x7f')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x344c08[_0x2218('0x80')][_0x2218('0x75')]||{},'body':_0x344c08[_0x2218('0x80')]['body']||{}};_0x5ee514(null,_0xfa304b);});};AGIVertices['prototype']['googleDialogflow']=function(_0x1c2156,_0x4ab610){scripts['googleDialogflow'](this[_0x2218('0x3b')][_0x2218('0x3c')],_0x1c2156[_0x2218('0x81')],_0x1c2156[_0x2218('0x63')],_0x1c2156['dialogflow_language']||'en')[_0x2218('0x15')](function(_0x431c54){_0x4ab610(null,_0x431c54);})[_0x2218('0x16')](function(_0x1a4ef6){_0x4ab610(_0x1a4ef6);});};AGIVertices[_0x2218('0x12')][_0x2218('0x82')]=function(_0x3e7cc5,_0x3dd439){scripts[_0x2218('0x82')](this[_0x2218('0x3b')]['uniqueid'],_0x3e7cc5['dialogflowV2_project_id'],_0x3e7cc5[_0x2218('0x83')],_0x3e7cc5[_0x2218('0x84')],_0x3e7cc5[_0x2218('0x63')],_0x3e7cc5[_0x2218('0x85')]||'en')[_0x2218('0x15')](function(_0x3b8fca){_0x3dd439(null,_0x3b8fca);})['catch'](function(_0x41d8c8){_0x3dd439(_0x41d8c8);});};AGIVertices['prototype'][_0x2218('0x86')]=function(_0x237d8d,_0x34161d){scripts[_0x2218('0x86')](this[_0x2218('0x3b')],_0x237d8d)[_0x2218('0x15')](function(_0x3a6ca1){_0x34161d(null,_0x3a6ca1);})[_0x2218('0x16')](function(_0x3f9e33){_0x34161d(_0x3f9e33);});};AGIVertices['prototype'][_0x2218('0x87')]=function(_0x3a20bc,_0x479237){scripts['ispeechTTS'](_0x3a20bc[_0x2218('0x81')],_0x3a20bc[_0x2218('0x63')],_0x3a20bc[_0x2218('0x88')]||_0x2218('0x65'),_0x3a20bc[_0x2218('0x89')])['then'](function(_0x56e0e6){_0x479237(null,_0x56e0e6);})[_0x2218('0x16')](function(_0x5b69c5){_0x479237(_0x5b69c5);});};AGIVertices[_0x2218('0x12')]['ispeechASR']=function(_0x32f3bb,_0x18fe39,_0x2396f5){scripts['ispeechASR'](_0x18fe39,_0x32f3bb['key'],_0x32f3bb[_0x2218('0x8a')]||_0x2218('0x65'),this[_0x2218('0x8b')](_0x32f3bb[_0x2218('0x8c')])?_0x32f3bb[_0x2218('0x8c')]:undefined)['then'](function(_0x3f6914){_0x2396f5(null,_0x3f6914);})[_0x2218('0x16')](function(_0x2f5221){_0x2396f5(_0x2f5221);});};AGIVertices[_0x2218('0x12')][_0x2218('0x8d')]=function(_0x11972c,_0x255ca3){scripts['awsPolly'](_0x11972c['aws_access_key_id'],_0x11972c[_0x2218('0x8e')],_0x11972c['aws_polly_region'],_0x11972c[_0x2218('0x8f')]||'Amy',_0x11972c[_0x2218('0x63')],_0x11972c[_0x2218('0x90')]||_0x2218('0x63'))[_0x2218('0x15')](function(_0x32238b){_0x255ca3(null,_0x32238b);})[_0x2218('0x16')](function(_0x3860a7){_0x255ca3(_0x3860a7);});};AGIVertices[_0x2218('0x12')]['awsLex']=function(_0x3e4dcd,_0x1ad4d4){scripts[_0x2218('0x91')](this[_0x2218('0x3b')][_0x2218('0x3c')],_0x3e4dcd['aws_access_key_id'],_0x3e4dcd[_0x2218('0x8e')],_0x3e4dcd[_0x2218('0x92')],_0x3e4dcd[_0x2218('0x63')],_0x3e4dcd[_0x2218('0x93')])[_0x2218('0x15')](function(_0x139382){_0x1ad4d4(null,_0x139382);})['catch'](function(_0x473ef0){_0x1ad4d4(_0x473ef0);});};AGIVertices['prototype'][_0x2218('0x94')]=function(_0xe33074,_0x5d36c1,_0x519b2b){scripts[_0x2218('0x94')](_0x5d36c1,_0xe33074[_0x2218('0x81')],_0xe33074[_0x2218('0x95')]||_0x2218('0x65'))['then'](function(_0x5eb471){_0x519b2b(null,_0x5eb471);})[_0x2218('0x16')](function(_0x4b0d6e){_0x519b2b(_0x4b0d6e);});};AGIVertices[_0x2218('0x12')]['tildeASR']=function(_0x1d05cc,_0x1ed0fb,_0x168790){scripts[_0x2218('0x96')](_0x1ed0fb,_0x1d05cc['appid'],_0x1d05cc[_0x2218('0x97')],_0x1d05cc[_0x2218('0x79')])[_0x2218('0x15')](function(_0x439781){_0x168790(null,_0x439781);})['catch'](function(_0x13e12a){_0x168790(_0x13e12a);});};AGIVertices['prototype'][_0x2218('0x98')]=function(_0x36a3ef){var _0x3522ea=_[_0x2218('0x70')](verticesWithRetry,_0x36a3ef['agicommand'])?_0x36a3ef:_[_0x2218('0x99')](_0x36a3ef);for(var _0x386552 in _0x3522ea){if(_0x3522ea[_0x2218('0x9a')](_0x386552)){if(_0x3522ea[_0x386552]&&_[_0x2218('0x9b')](_0x3522ea[_0x386552])){if(_[_0x2218('0x70')](recursiveMapAttributes,_0x386552)){_0x3522ea[_0x386552]=this[_0x2218('0x9c')](_0x3522ea[_0x386552]);}else{_0x3522ea[_0x386552]=this[_0x2218('0x9d')](_0x3522ea[_0x386552]);}}}}return _0x3522ea;};AGIVertices[_0x2218('0x12')][_0x2218('0x9e')]=function(_0x42fa9d){for(var _0x317c55 in _0x42fa9d){if(_0x42fa9d['hasOwnProperty'](_0x317c55)){if(_[_0x2218('0x9f')](_0x42fa9d[_0x317c55])){this[_0x2218('0x9e')](_0x42fa9d[_0x317c55]);}else if(_[_0x2218('0xa0')](_0x42fa9d[_0x317c55])){for(var _0x38c8d2=0x0;_0x38c8d2<_0x42fa9d[_0x317c55]['length'];_0x38c8d2++){this['recursiveNodeIndex'](_0x42fa9d[_0x317c55][_0x38c8d2]);}}else if(_[_0x2218('0x9b')](_0x42fa9d[_0x317c55])){_0x42fa9d[_0x317c55]=this[_0x2218('0x9d')](_0x42fa9d[_0x317c55]);}}}};AGIVertices['prototype'][_0x2218('0xa1')]=function(_0x334d0a,_0x3195f6){for(var _0x31ed26 in _0x334d0a){if(_0x334d0a[_0x2218('0x9a')](_0x31ed26)){if(_[_0x2218('0x9f')](_0x334d0a[_0x31ed26])){if(!_['isEmpty'](_0x334d0a[_0x31ed26])){this[_0x2218('0xa1')](_0x334d0a[_0x31ed26],util[_0x2218('0x2c')](_0x2218('0xa2'),_0x3195f6,_0x31ed26));}}else if(_[_0x2218('0xa0')](_0x334d0a[_0x31ed26])){for(var _0x50e547=0x0;_0x50e547<_0x334d0a[_0x31ed26][_0x2218('0xa3')];_0x50e547++){this[_0x2218('0xa1')](_0x334d0a[_0x31ed26][_0x50e547],util[_0x2218('0x2c')](_0x2218('0xa2'),_0x3195f6,_0x31ed26+'['+_0x50e547+']'));}}else{if(!_['isNil'](_0x334d0a[_0x31ed26])){this[_0x2218('0x3b')]['setVariable'](util[_0x2218('0x2c')](_0x2218('0xa2'),_0x3195f6,_0x31ed26),_0x334d0a[_0x31ed26]);}}}}};AGIVertices[_0x2218('0x12')][_0x2218('0x9c')]=function(_0x3eb4cd){try{var _0x4e0d91=JSON['parse'](_0x3eb4cd);this[_0x2218('0x9e')](_0x4e0d91);return JSON[_0x2218('0x7b')](_0x4e0d91);}catch(_0x3daca5){return this['replaceAllVariables'](_0x3eb4cd);}};AGIVertices['prototype'][_0x2218('0x9d')]=function(_0x109d4c){var _0x425955=_0x109d4c['split']('{');for(var _0x11a59a=0x1;_0x11a59a<_0x425955[_0x2218('0xa3')];_0x11a59a+=0x1){var _0x1c8648=_0x425955[_0x11a59a]['split']('}');if(_0x1c8648['length']>0x1){_0x109d4c=_0x109d4c[_0x2218('0xa4')]('{'+_0x1c8648[0x0]+'}',this['channel'][_0x2218('0x13')](_0x1c8648[0x0])[_0x2218('0xa5')]||_0x1c8648[0x0]);}}if(_0x425955['length']===0x1){return _0x109d4c[_0x2218('0x52')]();}return this[_0x2218('0x9d')](_0x109d4c);};AGIVertices[_0x2218('0x12')][_0x2218('0xa6')]=function(_0x46f004,_0x5b4f78){var _0x516a5a=this['channel'][_0x2218('0x13')](_0x46f004);if(_0x516a5a['result']===-0x1){return _0x516a5a;}logger[_0x2218('0x31')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5b4f78,_0x516a5a[_0x2218('0xa5')]));return this[_0x2218('0x3b')]['setVariable'](_0x5b4f78,_0x516a5a[_0x2218('0xa5')]);};AGIVertices[_0x2218('0x12')][_0x2218('0x8b')]=function(_0x44582f){return _0x44582f&&_0x44582f!=='0'&&_0x44582f!=='-1'&&_0x44582f!=='';};AGIVertices[_0x2218('0x12')][_0x2218('0xa7')]=function(_0xe38754){this['createSquareDetailsReport'][_0x2218('0x78')](this,_0xe38754,'-');_0xe38754[_0x2218('0xa8')]=_0xe38754[_0x2218('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x2218('0x12')][_0x2218('0xa9')]=function(_0x1da556){logger['info'](util[_0x2218('0x2c')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x1da556[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0x1da556['text'])){return this['channel'][_0x2218('0xaa')](_0x2218('0xab'));}var _0x324b8='\x22'+_0x1da556[_0x2218('0x63')]+'\x22';if(this[_0x2218('0x8b')](_0x1da556[_0x2218('0x80')])){_0x324b8+=','+_0x1da556[_0x2218('0x80')];}var _0x5bdea3=this[_0x2218('0x3b')][_0x2218('0x5f')](_0x2218('0xac'),_0x324b8);if(_0x5bdea3['result']===-0x1){return _0x5bdea3;}return this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x324b8));};AGIVertices[_0x2218('0x12')][_0x2218('0xad')]=function(_0x461987){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0xae'),_0x461987[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0x461987['grammar'])){return this['channel'][_0x2218('0xaa')](_0x2218('0xaf'));}var _0x5a7507=_0x461987[_0x2218('0xb0')];if(this[_0x2218('0x8b')](_0x461987[_0x2218('0x80')])){_0x5a7507+=','+_0x461987[_0x2218('0x80')];}var _0x583a64=this['channel']['exec'](_0x2218('0xb1'),_0x5a7507);if(_0x583a64[_0x2218('0xb2')]===-0x1){return _0x583a64;}var _0x453920=this[_0x2218('0xa6')](_0x2218('0xb3'),_0x2218('0xb4'));if(_0x453920[_0x2218('0xb2')]===-0x1){return _0x453920;}var _0x1aac62=this[_0x2218('0xa6')](_0x2218('0xb5'),'MRCP_RECOG_TRANSCRIPT');if(_0x1aac62[_0x2218('0xb2')]===-0x1){return _0x1aac62;}var _0x37e2ee=this[_0x2218('0xa6')](_0x2218('0xb6'),_0x2218('0xb7'));if(_0x37e2ee[_0x2218('0xb2')]===-0x1){return _0x37e2ee;}return this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0xb8'),_0x5a7507));};AGIVertices[_0x2218('0x12')]['agi']=function(_0x47b7c0){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0xb9'),_0x47b7c0[_0x2218('0x3d')]));return this[_0x2218('0x3b')][_0x2218('0x7')]([_0x47b7c0[_0x2218('0xba')],_0x47b7c0[_0x2218('0xbb')]]);};AGIVertices['prototype'][_0x2218('0xbc')]=function(_0x49b69c){logger['info'](util[_0x2218('0x2c')](_0x2218('0xbd'),_0x49b69c[_0x2218('0x3d')]));if(this[_0x2218('0x8b')](_0x49b69c['timeout'])){logger[_0x2218('0x31')](util['format'](_0x2218('0xbe'),_0x49b69c['timeout']));var _0x555989=this[_0x2218('0x3b')][_0x2218('0xbf')](_0x49b69c[_0x2218('0x6e')]);if(_0x555989['result']===-0x1){return _0x555989;}}return this[_0x2218('0x3b')][_0x2218('0xbc')]();};AGIVertices['prototype'][_0x2218('0xc0')]=function(_0x3cc688){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0xc1'),_0x3cc688['label']));if(!this[_0x2218('0x8b')](_0x3cc688[_0x2218('0x4f')])){return this['channel']['error'](_0x3cc688,_0x2218('0xc2'));}_0x3cc688[_0x2218('0x50')]=moment();if(this[_0x2218('0x8b')](_0x3cc688[_0x2218('0xc3')])){_0x3cc688['scheduledAt']=moment()[_0x2218('0xc4')](_0x3cc688[_0x2218('0xc3')],_0x2218('0xc5'));}if(!this[_0x2218('0x8b')](_0x3cc688[_0x2218('0x53')])){_0x3cc688['callback_priority']=0x2;}this[_0x2218('0x49')][_0x2218('0x78')](this,_0x3cc688);return this[_0x2218('0x3b')]['noop'](util[_0x2218('0x2c')](_0x2218('0xc6'),_0x3cc688[_0x2218('0x4e')],_0x3cc688[_0x2218('0x4f')],_0x3cc688['scheduledAt']));};AGIVertices[_0x2218('0x12')][_0x2218('0xc7')]=function(_0x452a08){logger[_0x2218('0x31')](util['format'](_0x2218('0xc8'),_0x452a08[_0x2218('0x3d')]));var _0xb0cfe1=this[_0x2218('0x3b')][_0x2218('0x5f')](_0x452a08[_0x2218('0xc9')],_0x452a08[_0x2218('0x80')]);if(_0xb0cfe1[_0x2218('0xb2')]===-0x1){return _0xb0cfe1;}return this[_0x2218('0x3b')]['noop'](util[_0x2218('0x2c')](_0x2218('0xca'),_0x452a08[_0x2218('0xc9')],_0x452a08[_0x2218('0x80')]));};AGIVertices['prototype'][_0x2218('0xcb')]=function(_0x2eca90){logger[_0x2218('0x31')](util['format'](_0x2218('0xcc'),_0x2eca90['label']));if(!this[_0x2218('0x8b')](_0x2eca90['text'])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0xab'));}var _0x1e766d='\x22'+_0x2eca90[_0x2218('0x63')]+'\x22';if(this['isConfigured'](_0x2eca90['options'])){_0x1e766d+=','+_0x2eca90[_0x2218('0x80')];}var _0xa843b5=this[_0x2218('0x3b')][_0x2218('0x5f')](_0x2218('0xac'),_0x1e766d);if(_0xa843b5['result']===-0x1){return _0xa843b5;}return this[_0x2218('0x3b')]['noop'](util[_0x2218('0x2c')](_0x2218('0xcd'),_0x1e766d));};AGIVertices['prototype'][_0x2218('0xce')]=function(_0x341f8d){logger[_0x2218('0x31')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x341f8d['label']));if(!this['isConfigured'](_0x341f8d[_0x2218('0x63')])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0xab'));}var _0x597b0d='\x22'+_0x341f8d[_0x2218('0x63')]+'\x22';if(this[_0x2218('0x8b')](_0x341f8d[_0x2218('0x80')])){_0x597b0d+=','+_0x341f8d[_0x2218('0x80')];}var _0x1979f9=this[_0x2218('0x3b')]['exec'](_0x2218('0xac'),_0x597b0d);if(_0x1979f9['result']===-0x1){return _0x1979f9;}return this['channel'][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0xcd'),_0x597b0d));};AGIVertices[_0x2218('0x12')][_0x2218('0xcf')]=function(_0x512d53){logger['info'](util[_0x2218('0x2c')](_0x2218('0xd0'),_0x512d53[_0x2218('0x3d')]));if(!this['isConfigured'](_0x512d53[_0x2218('0xb0')])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0xaf'));}var _0x4d2b0d=_0x512d53[_0x2218('0xb0')];if(this['isConfigured'](_0x512d53['options'])){_0x4d2b0d+=','+_0x512d53[_0x2218('0x80')];}var _0x3735f3=this[_0x2218('0x3b')]['exec'](_0x2218('0xb1'),_0x4d2b0d);if(_0x3735f3[_0x2218('0xb2')]===-0x1){return _0x3735f3;}var _0x49161e=this[_0x2218('0xa6')](_0x2218('0xb3'),_0x2218('0xd1'));if(_0x49161e['result']===-0x1){return _0x49161e;}var _0x3cf969=this['getAndSetVariable']('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x3cf969[_0x2218('0xb2')]===-0x1){return _0x3cf969;}var _0x1bc052=this[_0x2218('0xa6')](_0x2218('0xb6'),_0x2218('0xd2'));if(_0x1bc052[_0x2218('0xb2')]===-0x1){return _0x1bc052;}return this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0xb8'),_0x4d2b0d));};AGIVertices[_0x2218('0x12')][_0x2218('0xd3')]=function(_0x2a445d){logger['info'](util[_0x2218('0x2c')](_0x2218('0xd4'),_0x2a445d[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0x2a445d[_0x2218('0xb0')])){return this['channel'][_0x2218('0xaa')](_0x2218('0xaf'));}var _0x47cc6c=_0x2a445d[_0x2218('0xb0')];if(this[_0x2218('0x8b')](_0x2a445d[_0x2218('0x80')])){_0x47cc6c+=','+_0x2a445d[_0x2218('0x80')];}var _0x34c2ed=this[_0x2218('0x3b')][_0x2218('0x5f')](_0x2218('0xb1'),_0x47cc6c);if(_0x34c2ed[_0x2218('0xb2')]===-0x1){return _0x34c2ed;}var _0x5764a8=this['getAndSetVariable'](_0x2218('0xb3'),_0x2218('0xd5'));if(_0x5764a8[_0x2218('0xb2')]===-0x1){return _0x5764a8;}var _0x41c581=this[_0x2218('0xa6')](_0x2218('0xb5'),_0x2218('0xd6'));if(_0x41c581[_0x2218('0xb2')]===-0x1){return _0x41c581;}var _0x23731b=this['getAndSetVariable'](_0x2218('0xb6'),_0x2218('0xd7'));if(_0x23731b[_0x2218('0xb2')]===-0x1){return _0x23731b;}return this['channel'][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0xb8'),_0x47cc6c));};AGIVertices['prototype'][_0x2218('0xd8')]=function(_0x19812f){logger[_0x2218('0x31')](util[_0x2218('0x2c')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x19812f['label']));if(!this['isConfigured'](_0x19812f[_0x2218('0xd9')])){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x19812f,_0x2218('0xda'));}var _0x2344ba=this[_0x2218('0x1c')]['sync'](this,_0x19812f[_0x2218('0xd9')]);if(!_0x2344ba){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x19812f,_0x2218('0xdb'));}if(!this['isConfigured'](_0x19812f[_0x2218('0xdc')])){return this[_0x2218('0x3b')]['error'](_0x19812f,_0x2218('0xdd'));}var _0x15fd98=_0x19812f[_0x2218('0xdc')][_0x2218('0x61')](/(\r\n|\n|\r)/gm,'\x20');this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0xde'),_0x15fd98));var _0x2b0da0=this[_0x2218('0x2e')][_0x2218('0x78')](this,_0x2344ba,_0x15fd98);this[_0x2218('0x3a')][_0x2218('0x78')](this,_0x19812f,_0x15fd98);if(!this[_0x2218('0x8b')](_0x19812f[_0x2218('0xdf')])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0xe0'));}var _0x4c2d37=this[_0x2218('0x13')][_0x2218('0x78')](this,_0x19812f[_0x2218('0xdf')]);if(!_0x4c2d37){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x19812f,_0x2218('0xe1'));}var _0xf68ddd=this;_0x2b0da0[_0x2218('0xe2')](function(_0x2459cf,_0x34d271){Object[_0x2218('0xe3')](_0x2459cf)['forEach'](function(_0x287a15){_0xf68ddd['channel']['setVariable'](util[_0x2218('0x2c')](_0x2218('0xe4'),_0x4c2d37,_0x34d271,_0x287a15),_0x2459cf[_0x287a15]);});});this[_0x2218('0x3b')]['setVariable'](util[_0x2218('0x2c')](_0x2218('0xe5'),_0x4c2d37),_0x2b0da0[_0x2218('0xa3')]);return this[_0x2218('0x3b')][_0x2218('0xaa')](util['format'](_0x2218('0xe6'),_0x4c2d37));};AGIVertices[_0x2218('0x12')][_0x2218('0xe7')]=function(_0x262b93){logger['debug'](util[_0x2218('0x2c')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x262b93[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0x262b93[_0x2218('0xe8')])){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x262b93,_0x2218('0xe9'));}var _0x284155=this[_0x2218('0x1f')][_0x2218('0x78')](this,_0x262b93['sip_id']);if(!_0x284155){return this['channel'][_0x2218('0x36')](_0x262b93,_0x2218('0xea'));}var _0x44b686=this['channel'][_0x2218('0x5f')](_0x2218('0xeb'),[util['format'](_0x2218('0xec'),_0x284155),_0x262b93['timeout'],_0x262b93[_0x2218('0xed')],_0x262b93[_0x2218('0x6c')]]);if(_0x44b686[_0x2218('0xb2')]===-0x1){return _0x44b686;}return this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0xee'),_0x2218('0xeb')));};AGIVertices[_0x2218('0x12')]['dialogflow']=function(_0x4a2f76){logger[_0x2218('0x31')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4a2f76['label']));if(!this[_0x2218('0x8b')](_0x4a2f76[_0x2218('0x81')])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0xef'));}if(!this[_0x2218('0x8b')](_0x4a2f76[_0x2218('0x63')])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0xab'));}this[_0x2218('0x3b')][_0x2218('0xf0')]=!![];this[_0x2218('0x3a')](_0x4a2f76);this[_0x2218('0x48')](_0x4a2f76[_0x2218('0x63')],'in','','');this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0xf1'),_0x4a2f76[_0x2218('0x63')]));var _0x13bdf7=this[_0x2218('0xf2')][_0x2218('0x78')](this,_0x4a2f76);if(_0x13bdf7){for(var _0x92075a in _0x13bdf7){if(_0x13bdf7[_0x2218('0x9a')](_0x92075a)){this['channel']['setVariable'](util[_0x2218('0x2c')](_0x2218('0xf3'),_0x92075a[_0x2218('0x72')]()),_0x13bdf7[_0x92075a]);}}this[_0x2218('0x48')](_0x13bdf7[_0x2218('0xf4')],'out',_0x2218('0xf5'),'');return this[_0x2218('0x3b')][_0x2218('0xaa')](util['format']('Dialogflow\x20Result\x20%s',_0x13bdf7[_0x2218('0xf4')]));}return this['channel'][_0x2218('0x36')](_0x4a2f76,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x2218('0xf6')]=function(_0x2c9268){logger[_0x2218('0x31')](util['format'](_0x2218('0xf7'),_0x2c9268[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0x2c9268[_0x2218('0xf8')])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0xf9'));}if(!this[_0x2218('0x8b')](_0x2c9268[_0x2218('0x83')])){return this['channel']['noop']('no\x20client_email\x20configured');}if(!this[_0x2218('0x8b')](_0x2c9268[_0x2218('0x84')])){return this['channel']['noop'](_0x2218('0xfa'));}if(!this[_0x2218('0x8b')](_0x2c9268[_0x2218('0x85')])){return this['channel'][_0x2218('0xaa')](_0x2218('0xfb'));}if(!this[_0x2218('0x8b')](_0x2c9268[_0x2218('0x63')])){return this['channel'][_0x2218('0xaa')](_0x2218('0xab'));}this['channel']['bot']=!![];this[_0x2218('0x3a')](_0x2c9268);this[_0x2218('0x48')](_0x2c9268[_0x2218('0x63')],'in','','');this[_0x2218('0x3b')][_0x2218('0xaa')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x2c9268[_0x2218('0x63')]));var _0x863225=this['googleDialogflowV2'][_0x2218('0x78')](this,_0x2c9268);if(_0x863225){for(var _0x15830a in _0x863225){if(_0x863225[_0x2218('0x9a')](_0x15830a)){if(_0x15830a!==_0x2218('0xfc')){this[_0x2218('0x3b')][_0x2218('0xfd')](util['format'](_0x2218('0xf3'),_0x15830a[_0x2218('0x72')]()),_0x863225[_0x15830a]);}}}this['createSquareMessage'](_0x863225['speech'],_0x2218('0xfe'),_0x2218('0xf6'),_0x863225[_0x2218('0xfc')]);return this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0xff'),_0x863225[_0x2218('0xf4')]));}return this[_0x2218('0x3b')]['error'](_0x2c9268,_0x2218('0x100'));};AGIVertices['prototype'][_0x2218('0x101')]=function(_0x27a0c2){logger['info'](util[_0x2218('0x2c')](_0x2218('0x102'),_0x27a0c2[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0x27a0c2[_0x2218('0x103')])){return this[_0x2218('0x3b')]['noop'](_0x2218('0x104'));}if(!this[_0x2218('0x8b')](_0x27a0c2[_0x2218('0x105')])){return this['channel'][_0x2218('0xaa')](_0x2218('0x106'));}if(!this['isConfigured'](_0x27a0c2[_0x2218('0x107')])){return this[_0x2218('0x3b')][_0x2218('0xaa')]('no\x20password\x20configured');}if(!this[_0x2218('0x8b')](_0x27a0c2[_0x2218('0x108')])){return this[_0x2218('0x3b')]['noop'](_0x2218('0xab'));}this[_0x2218('0x3b')][_0x2218('0xf0')]=!![];this[_0x2218('0x3a')](_0x27a0c2);this['createSquareMessage'](_0x27a0c2[_0x2218('0x63')],'in','','');this['channel']['noop'](util['format'](_0x2218('0x109'),_0x27a0c2[_0x2218('0x63')]));var _0x53b28f=this[_0x2218('0x86')][_0x2218('0x78')](this,_0x27a0c2);if(_0x53b28f){for(var _0x6b8d50 in _0x53b28f){if(_0x53b28f['hasOwnProperty'](_0x6b8d50)){this[_0x2218('0x3b')]['setVariable'](util[_0x2218('0x2c')](_0x2218('0x10a'),_0x6b8d50[_0x2218('0x72')]()),_0x53b28f[_0x6b8d50]);}}this[_0x2218('0x48')](_0x53b28f['speech'],_0x2218('0xfe'),_0x2218('0x101'),'');if(_0x53b28f[_0x2218('0x10b')]){this['channel'][_0x2218('0xaa')](util[_0x2218('0x2c')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x53b28f[_0x2218('0x10b')]));var _0x3248a1=this[_0x2218('0x3b')][_0x2218('0x10c')](_0x53b28f[_0x2218('0x10b')]);try{fs['unlink'](_0x53b28f[_0x2218('0x10b')]+_0x2218('0x10d'));}catch(_0x1221c5){logger['error'](_0x1221c5);}return _0x3248a1;}else{return this[_0x2218('0x3b')]['noop'](util[_0x2218('0x2c')]('SestekNDA\x20Result\x20%s',_0x53b28f[_0x2218('0xf4')]));}}return this[_0x2218('0x3b')][_0x2218('0x36')](_0x27a0c2,_0x2218('0x10e'));};AGIVertices[_0x2218('0x12')]['end']=function(_0x3d9c87){logger[_0x2218('0x31')](util['format'](_0x2218('0x10f'),_0x3d9c87[_0x2218('0x3d')]));return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0x110'));};AGIVertices[_0x2218('0x12')][_0x2218('0x111')]=function(_0x178fe8){logger[_0x2218('0x31')](util['format'](_0x2218('0x112'),_0x178fe8[_0x2218('0x3d')]));var _0x325fd9='';if(_0x178fe8[_0x2218('0x113')]){if(!this[_0x2218('0x8b')](_0x178fe8['trunk_id'])){return this[_0x2218('0x3b')]['error'](_0x178fe8,_0x2218('0x114'));}else{var _0x38cf1f=parseInt(_0x178fe8[_0x2218('0x113')],0xa);if(isNaN(_0x38cf1f)){_0x325fd9=_0x178fe8['trunk_id'];}else{_0x325fd9=this[_0x2218('0x115')][_0x2218('0x78')](this,_0x178fe8['trunk_id']);if(!_0x325fd9){return this['channel']['error'](_0x178fe8,'no\x20trunk\x20found');}}}}else if(_0x178fe8[_0x2218('0x116')]){_0x325fd9=_0x178fe8[_0x2218('0x116')];}else{return this[_0x2218('0x3b')][_0x2218('0x36')](_0x178fe8,_0x2218('0x114'));}var _0x25127c=this[_0x2218('0x3b')]['exec'](_0x2218('0xeb'),[util['format'](_0x2218('0x117'),_0x325fd9,_0x178fe8['phone']),_0x178fe8[_0x2218('0x6e')],_0x178fe8[_0x2218('0xed')],_0x178fe8[_0x2218('0x6c')]]);if(_0x25127c[_0x2218('0xb2')]===-0x1){return _0x25127c;}return this[_0x2218('0x3b')]['noop'](util[_0x2218('0x2c')](_0x2218('0xee'),_0x2218('0xeb')));};AGIVertices['prototype'][_0x2218('0x118')]=function(_0x5aa984){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x119'),_0x5aa984[_0x2218('0x3d')]));return this[_0x2218('0x3b')][_0x2218('0xaa')]('finally');};AGIVertices[_0x2218('0x12')][_0x2218('0x11a')]=function(_0x5164a8){logger['info'](util[_0x2218('0x2c')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x5164a8[_0x2218('0x3d')]));if(_0x5164a8[_0x2218('0xa8')]===0x0){return this['maxRetry'](_0x5164a8);}_0x5164a8[_0x2218('0xa8')]-=0x1;if(!this[_0x2218('0x8b')](_0x5164a8[_0x2218('0x11b')])){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x5164a8,_0x2218('0x11c'));}var _0x357e91=this[_0x2218('0x11d')][_0x2218('0x78')](this,_0x5164a8['file_id']);if(!_0x357e91){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x5164a8,'no\x20file\x20audio\x20found');}if(!this[_0x2218('0x8b')](_0x5164a8[_0x2218('0xdf')])){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x2218('0xe0'));}var _0x3f6a0c=this[_0x2218('0x3b')]['getData'](_0x357e91,_0x5164a8['response'],_0x5164a8[_0x2218('0x11e')]);var _0x3b4e9d=_0x3f6a0c[_0x2218('0xb2')]?_0x3f6a0c[_0x2218('0xb2')]['toString']():'';logger[_0x2218('0x31')](_0x2218('0x11f'),JSON[_0x2218('0x7b')](_0x3f6a0c));if(_0x3f6a0c[_0x2218('0xb2')]===-0x1){this['createSquareDetailsReport'][_0x2218('0x78')](this,_0x5164a8,_0x3b4e9d);return _0x3f6a0c;}else if(_0x3f6a0c[_0x2218('0xa5')]===_0x2218('0x6e')){_0x3f6a0c[_0x2218('0xb2')]=_0x3b4e9d[_0x2218('0xa3')]>=parseInt(_0x5164a8[_0x2218('0x120')])?'x':'i';}else{_0x3f6a0c[_0x2218('0xb2')]=_0x3b4e9d['length']>=parseInt(_0x5164a8['mindigit'])&&_0x3b4e9d[_0x2218('0xa3')]<=parseInt(_0x5164a8[_0x2218('0x11e')])?'x':'i';}var _0x3a1c24=this[_0x2218('0x13')][_0x2218('0x78')](this,_0x5164a8[_0x2218('0xdf')]);if(!_0x3a1c24){return this[_0x2218('0x3b')]['error'](_0x5164a8,_0x2218('0xe1'));}this[_0x2218('0x3b')]['setVariable'](_0x3a1c24,_0x3b4e9d);if(this[_0x2218('0x8b')](_0x5164a8[_0x2218('0x121')])){var _0x174684=parseInt(_0x5164a8[_0x2218('0x121')],0xa);var _0x307ec4=rs['generate']({'charset':'*','length':_0x174684});var _0x1da537=_0x3b4e9d['length'];if(_0x1da537>0x0){if(_0x1da537>_0x174684){this[_0x2218('0x3a')][_0x2218('0x78')](this,_0x5164a8,_0x5164a8[_0x2218('0x122')]===_0x2218('0x123')?_0x307ec4+_0x3b4e9d['substr'](_0x174684):_0x3b4e9d[_0x2218('0x124')](0x0,_0x1da537-_0x174684)+_0x307ec4);}else{this[_0x2218('0x3a')][_0x2218('0x78')](this,_0x5164a8,rs['generate']({'charset':'*','length':_0x1da537}));}}else{this[_0x2218('0x3a')][_0x2218('0x78')](this,_0x5164a8,'');}}else{this[_0x2218('0x3a')][_0x2218('0x78')](this,_0x5164a8,_0x3b4e9d);}return _0x3f6a0c;};AGIVertices['prototype'][_0x2218('0xf')]=function(_0x212474){logger[_0x2218('0x31')](util['format'](_0x2218('0x125'),_0x212474[_0x2218('0x3d')]));return this['getdigits'](_0x212474);};AGIVertices[_0x2218('0x12')][_0x2218('0x126')]=function(_0x41ea79){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x127'),_0x41ea79[_0x2218('0x3d')]));this['createSquareDetailsReport']['sync'](this,_0x41ea79,_0x41ea79[_0x2218('0x128')]);return this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')]('GOAL\x20%s',_0x41ea79[_0x2218('0x128')]));};AGIVertices[_0x2218('0x12')][_0x2218('0x129')]=function(_0x3b0e66){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x12a'),_0x3b0e66[_0x2218('0x3d')]));if(!this['isConfigured'](_0x3b0e66[_0x2218('0x12b')])||!this[_0x2218('0x8b')](_0x3b0e66[_0x2218('0x8e')])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0x12c'));}if(!this[_0x2218('0x8b')](_0x3b0e66[_0x2218('0x63')])){return this['channel'][_0x2218('0xaa')](_0x2218('0xab'));}this['channel'][_0x2218('0xaa')](util[_0x2218('0x2c')]('Trying\x20aws\x20Polly\x20%s',_0x3b0e66[_0x2218('0x63')]));var _0x15e4ed=this[_0x2218('0x8d')][_0x2218('0x78')](this,_0x3b0e66);if(_0x15e4ed){this[_0x2218('0x3b')][_0x2218('0xaa')](util['format'](_0x2218('0x12d'),_0x15e4ed));var _0x45cbce=this[_0x2218('0x3b')][_0x2218('0x10c')](_0x15e4ed);try{fs[_0x2218('0x12e')](_0x15e4ed+_0x2218('0x10d'));}catch(_0x196231){logger[_0x2218('0x36')](_0x196231);}return _0x45cbce;}return this[_0x2218('0x3b')]['error'](_0x3b0e66,_0x2218('0x12f'));};AGIVertices[_0x2218('0x12')][_0x2218('0x130')]=function(_0x1d46de){logger['info'](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x1d46de[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0x1d46de['aws_access_key_id'])||!this[_0x2218('0x8b')](_0x1d46de[_0x2218('0x8e')])){return this['channel'][_0x2218('0xaa')](_0x2218('0x12c'));}if(!this[_0x2218('0x8b')](_0x1d46de[_0x2218('0x93')])){return this[_0x2218('0x3b')][_0x2218('0xaa')]('no\x20bot\x20name\x20configured');}if(!this[_0x2218('0x8b')](_0x1d46de[_0x2218('0x63')])){return this[_0x2218('0x3b')]['noop']('no\x20text\x20configured');}this[_0x2218('0x3b')]['bot']=!![];this[_0x2218('0x3a')](_0x1d46de);this['createSquareMessage'](_0x1d46de[_0x2218('0x63')],'in','','');this[_0x2218('0x3b')][_0x2218('0xaa')](util['format'](_0x2218('0x131'),_0x1d46de[_0x2218('0x63')]));var _0x4ab9c2=this[_0x2218('0x91')][_0x2218('0x78')](this,_0x1d46de);if(_0x4ab9c2){for(var _0x45a157 in _0x4ab9c2){if(_0x4ab9c2['hasOwnProperty'](_0x45a157)&&_[_0x2218('0x9b')](_0x4ab9c2[_0x45a157])){this['channel'][_0x2218('0xfd')](util[_0x2218('0x2c')]('AWS_LEX_%s',_0x45a157[_0x2218('0x72')]()),_0x4ab9c2[_0x45a157]);}}if(_[_0x2218('0x57')](_0x4ab9c2[_0x2218('0x7f')])){return this['channel'][_0x2218('0xaa')](_0x2218('0x132'));}else{this[_0x2218('0x48')](_0x4ab9c2[_0x2218('0x7f')],_0x2218('0xfe'),_0x2218('0x133'),'');return this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')]('Amazon\x20Lex\x20Result\x20%s',_0x4ab9c2['message']));}}return this[_0x2218('0x3b')]['error'](_0x1d46de,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x2218('0x12')]['googleasr']=function(_0x10a315){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x134'),_0x10a315[_0x2218('0x3d')],_0x10a315[_0x2218('0x6e')]));if(!this[_0x2218('0x8b')](_0x10a315[_0x2218('0x81')])){return this[_0x2218('0x3b')]['noop'](_0x2218('0xef'));}var _0x386deb='wav';var _0x2f51fa=util[_0x2218('0x2c')](_0x2218('0x135'),FILES_PATH,rs[_0x2218('0x136')](0x4));var _0x558c0e=util[_0x2218('0x2c')](_0x2218('0xa2'),_0x2f51fa,_0x386deb);var _0x4f7f62=!![];if(_0x10a315[_0x2218('0x137')]==='NOBEEP'){_0x4f7f62=![];}var _0x3e41ec=this[_0x2218('0x3b')][_0x2218('0x138')](_0x2f51fa,_0x386deb,_0x10a315[_0x2218('0x139')],_0x10a315['timeout'],undefined,_0x4f7f62);if(_0x3e41ec[_0x2218('0xb2')]!==-0x1){this['channel'][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0x13a'),_0x558c0e));var _0x2747de=this[_0x2218('0x94')]['sync'](this,_0x10a315,_0x558c0e);if(_0x2747de){for(var _0x440cba in _0x2747de){if(_0x2747de[_0x2218('0x9a')](_0x440cba)){this['channel'][_0x2218('0xfd')](util[_0x2218('0x2c')](_0x2218('0x13b'),_0x440cba[_0x2218('0x72')]()),_0x2747de[_0x440cba]);}}return this[_0x2218('0x3b')][_0x2218('0xaa')](util['format'](_0x2218('0x13c'),JSON[_0x2218('0x7b')](_0x2747de)));}}return _0x3e41ec;};AGIVertices[_0x2218('0x12')][_0x2218('0x13d')]=function(_0x39409e){logger['info'](util[_0x2218('0x2c')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x39409e[_0x2218('0x3d')]));if(!this['isConfigured'](_0x39409e['appid'])){return this[_0x2218('0x3b')]['noop'](_0x2218('0x13e'));}if(!this[_0x2218('0x8b')](_0x39409e[_0x2218('0x97')])){return this[_0x2218('0x3b')]['noop']('no\x20appsecret\x20configured');}var _0x22a94b=_0x2218('0x13f');var _0x363f14=util[_0x2218('0x2c')](_0x2218('0x135'),FILES_PATH,rs[_0x2218('0x136')](0x4));var _0xee2d77=util[_0x2218('0x2c')](_0x2218('0xa2'),_0x363f14,_0x22a94b);var _0xe3a2ce=!![];if(_0x39409e[_0x2218('0x137')]===_0x2218('0x140')){_0xe3a2ce=![];}var _0x3d76b7=this[_0x2218('0x3b')][_0x2218('0x138')](_0x363f14,_0x22a94b,_0x39409e[_0x2218('0x139')],_0x39409e[_0x2218('0x6e')],undefined,_0xe3a2ce);if(_0x3d76b7[_0x2218('0xb2')]!==-0x1){this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0x141'),_0xee2d77));var _0x3843e4=this[_0x2218('0x96')][_0x2218('0x78')](this,_0x39409e,_0xee2d77);if(_0x3843e4){for(var _0x5ed544 in _0x3843e4){if(_0x3843e4[_0x2218('0x9a')](_0x5ed544)){this[_0x2218('0x3b')][_0x2218('0xfd')](util[_0x2218('0x2c')](_0x2218('0x142'),_0x5ed544[_0x2218('0x72')]()),_0x3843e4[_0x5ed544]);}}return this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')]('TildeASR\x20Result\x20%s',JSON[_0x2218('0x7b')](_0x3843e4)));}}return _0x3d76b7;};AGIVertices['prototype']['gotoc']=function(_0x50fac3){logger[_0x2218('0x31')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x50fac3[_0x2218('0x3d')]));return this['channel'][_0x2218('0x143')](_0x50fac3['context'],_0x50fac3['extension'],_0x50fac3[_0x2218('0x44')]);};AGIVertices[_0x2218('0x12')]['gotoif']=function(_0x3cd75e){logger['info'](util[_0x2218('0x2c')](_0x2218('0x144'),_0x3cd75e['label']));if(!this[_0x2218('0x8b')](_0x3cd75e[_0x2218('0x145')])){return this[_0x2218('0x3b')]['error'](_0x3cd75e,_0x2218('0x146'));}try{var _0x2adeea=eval(_0x3cd75e[_0x2218('0x145')])?_0x2218('0x147'):_0x2218('0x148');this['channel'][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0x149'),_0x3cd75e['condition'],_0x2adeea));return{'code':0xc8,'result':_0x2adeea};}catch(_0x112d7c){return{'code':0xc8,'result':_0x2218('0x148')};}};AGIVertices[_0x2218('0x12')][_0x2218('0x14a')]=function(_0x331e4f){logger['info'](util[_0x2218('0x2c')](_0x2218('0x14b'),_0x331e4f[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0x331e4f['interval_id'])){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x331e4f,'no\x20interval\x20configured');}var _0x16c599=this[_0x2218('0x26')][_0x2218('0x78')](this,_0x331e4f['interval_id']);if(!_0x16c599){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x331e4f,_0x2218('0x14c'));}for(var _0x5ebaac=0x0;_0x5ebaac<_0x16c599[_0x2218('0xa3')];_0x5ebaac+=0x1){var _0x2204e9=this['channel'][_0x2218('0x13')](util[_0x2218('0x2c')](_0x2218('0x14d'),_0x16c599[_0x5ebaac]));if(_0x2204e9[_0x2218('0xb2')]===-0x1){return _0x2204e9;}logger[_0x2218('0x31')](util['format'](_0x2218('0x14e'),_0x16c599[_0x5ebaac],_0x2204e9[_0x2218('0xa5')]));if(_0x2204e9['extra']===_0x2218('0x147')){logger['info'](util['format'](_0x2218('0x14e'),_0x16c599[_0x5ebaac],_0x2218('0x147')));this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')]('IFTIME\x20%s\x20%s',_0x16c599[_0x5ebaac],_0x2218('0x147')));return{'code':0xc8,'result':_0x2218('0x147')};}else{logger['info'](util[_0x2218('0x2c')](_0x2218('0x14e'),_0x16c599[_0x5ebaac],'false'));this[_0x2218('0x3b')]['noop'](util[_0x2218('0x2c')](_0x2218('0x14e'),_0x16c599[_0x5ebaac],_0x2218('0x148')));}}return{'code':0xc8,'result':_0x2218('0x148')};};AGIVertices[_0x2218('0x12')][_0x2218('0x14f')]=function(_0x33fd30){logger['info'](util[_0x2218('0x2c')](_0x2218('0x150'),_0x33fd30[_0x2218('0x3d')]));return this[_0x2218('0x3b')][_0x2218('0x14f')]();};AGIVertices[_0x2218('0x12')][_0x2218('0x151')]=function(_0x106cff){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x152'),_0x106cff[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0x106cff[_0x2218('0x81')])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0xef'));}var _0x3e6bad=_0x2218('0x13f');var _0x89b632=util[_0x2218('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0x2218('0x136')](0x4));var _0x20d69f=util[_0x2218('0x2c')](_0x2218('0xa2'),_0x89b632,_0x3e6bad);var _0x2259eb=!![];if(_0x106cff[_0x2218('0x137')]===_0x2218('0x140')){_0x2259eb=![];}var _0x403bf9=this['channel'][_0x2218('0x138')](_0x89b632,_0x3e6bad,_0x106cff[_0x2218('0x139')],_0x106cff[_0x2218('0x6e')],undefined,_0x2259eb);if(_0x403bf9[_0x2218('0xb2')]!==-0x1){this['channel'][_0x2218('0xaa')](util['format'](_0x2218('0x153'),_0x20d69f));var _0x298b6a=this[_0x2218('0x154')][_0x2218('0x78')](this,_0x106cff,_0x20d69f);if(_0x298b6a){for(var _0x17f58b in _0x298b6a){if(_0x298b6a[_0x2218('0x9a')](_0x17f58b)){this['channel']['setVariable'](util[_0x2218('0x2c')](_0x2218('0x155'),_0x17f58b['toUpperCase']()),_0x298b6a[_0x17f58b]);}}return this['channel'][_0x2218('0xaa')](util[_0x2218('0x2c')]('IspeechASR\x20Result\x20%s',JSON[_0x2218('0x7b')](_0x298b6a)));}}return _0x403bf9;};AGIVertices[_0x2218('0x12')][_0x2218('0x156')]=function(_0xb0cc92){logger[_0x2218('0x31')](util[_0x2218('0x2c')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0xb0cc92[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0xb0cc92[_0x2218('0x81')])){return this[_0x2218('0x3b')][_0x2218('0xaa')]('no\x20key\x20configured');}if(!this['isConfigured'](_0xb0cc92['text'])){return this[_0x2218('0x3b')][_0x2218('0xaa')]('no\x20text\x20configured');}this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0x157'),_0xb0cc92[_0x2218('0x63')]));var _0x29512b=this[_0x2218('0x87')][_0x2218('0x78')](this,_0xb0cc92);if(_0x29512b){this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0x153'),_0x29512b));var _0xd7943a=this['channel']['streamFile'](_0x29512b,_0xb0cc92['intKey']);try{fs['unlink'](_0x29512b+_0x2218('0x10d'));}catch(_0x3a79b5){logger[_0x2218('0x36')](_0x3a79b5);}return _0xd7943a;}return this['channel'][_0x2218('0x36')](_0xb0cc92,_0x2218('0x158'));};AGIVertices[_0x2218('0x12')][_0x2218('0x159')]=function(_0x5e1f95){logger[_0x2218('0x31')](util['format'](_0x2218('0x15a'),_0x5e1f95['label']));if(!this[_0x2218('0x8b')](_0x5e1f95[_0x2218('0x15b')])){return this['channel'][_0x2218('0x36')](_0x5e1f95,_0x2218('0x15c'));}logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x15d'),this['channel'][_0x2218('0x40')],_0x5e1f95[_0x2218('0x15b')]));var _0x11911e=this[_0x2218('0x5a')]['sync'](this,_0x5e1f95[_0x2218('0x15b')]);if(_0x11911e){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x15e'),this[_0x2218('0x3b')][_0x2218('0x40')],_0x5e1f95[_0x2218('0x15b')]));this[_0x2218('0x3b')]['noop'](util[_0x2218('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2218('0x3b')]['callerid'],_0x5e1f95['findBy']));return{'code':0xc8,'result':_0x2218('0x15f')};}else{logger[_0x2218('0x31')](util['format'](_0x2218('0x160'),this[_0x2218('0x3b')][_0x2218('0x40')],_0x5e1f95[_0x2218('0x15b')]));this['channel'][_0x2218('0xaa')](util['format'](_0x2218('0x160'),this[_0x2218('0x3b')][_0x2218('0x40')],_0x5e1f95[_0x2218('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['logout']=function(_0x5c6e1f){logger['info'](util[_0x2218('0x2c')](_0x2218('0x161'),_0x5c6e1f['label']));if(!this['isConfigured'](_0x5c6e1f['findBy'])){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x5c6e1f,'no\x20find\x20by\x20configured');}logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x15d'),this[_0x2218('0x3b')][_0x2218('0x40')],_0x5c6e1f['findBy']));var _0x2ece30=this['agentLogout'][_0x2218('0x78')](this,_0x5c6e1f[_0x2218('0x15b')]);if(_0x2ece30){logger['info'](util[_0x2218('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x2218('0x40')],_0x5c6e1f[_0x2218('0x15b')]));this[_0x2218('0x3b')][_0x2218('0xaa')](util['format'](_0x2218('0x15e'),this[_0x2218('0x3b')][_0x2218('0x40')],_0x5c6e1f[_0x2218('0x15b')]));return{'code':0xc8,'result':'success'};}else{logger[_0x2218('0x31')](util[_0x2218('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2218('0x3b')]['callerid'],_0x5c6e1f[_0x2218('0x15b')]));this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0x160'),this[_0x2218('0x3b')][_0x2218('0x40')],_0x5c6e1f[_0x2218('0x15b')]));return{'code':0xc8,'result':_0x2218('0x162')};}};AGIVertices[_0x2218('0x12')]['math']=function(_0x445517){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x163'),_0x445517[_0x2218('0x3d')]));if(!this['isConfigured'](_0x445517[_0x2218('0x164')])){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x445517,_0x2218('0x165'));}this['channel']['noop'](util[_0x2218('0x2c')](_0x2218('0x166'),_0x445517[_0x2218('0x164')]));var _0x5d2a39=eval(_0x445517[_0x2218('0x164')]);if(!this[_0x2218('0x8b')](_0x445517[_0x2218('0xdf')])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0xe0'));}var _0x321ab4=this['getVariable'][_0x2218('0x78')](this,_0x445517[_0x2218('0xdf')]);if(!_0x321ab4){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x445517,'no\x20variable\x20found');}if(_[_0x2218('0xa0')](_0x5d2a39)){var _0x390069=this;_0x5d2a39[_0x2218('0xe2')](function(_0x45c24f,_0x434c39){_0x390069[_0x2218('0x3b')][_0x2218('0xfd')](util['format'](_0x2218('0x167'),_0x321ab4,_0x434c39),_0x45c24f);});return this[_0x2218('0x3b')][_0x2218('0xaa')](util['format'](_0x2218('0x168'),_0x321ab4));}else{return this[_0x2218('0x3b')][_0x2218('0xfd')](_0x321ab4,_0x5d2a39);}};AGIVertices[_0x2218('0x12')]['menu']=function(_0x380f1b){logger[_0x2218('0x31')](util['format'](_0x2218('0x169'),_0x380f1b[_0x2218('0x3d')]));if(_0x380f1b[_0x2218('0xa8')]===0x0){return this[_0x2218('0xa7')](_0x380f1b);}_0x380f1b[_0x2218('0xa8')]-=0x1;if(!this[_0x2218('0x8b')](_0x380f1b[_0x2218('0x11b')])){return this[_0x2218('0x3b')]['error'](_0x380f1b,_0x2218('0x11c'));}var _0xedfca5=this[_0x2218('0x11d')][_0x2218('0x78')](this,_0x380f1b[_0x2218('0x11b')]);if(!_0xedfca5){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x380f1b,'no\x20file\x20audio\x20found');}var _0x5c0fb7=this['channel']['getData'](_0xedfca5,_0x380f1b[_0x2218('0x16a')],_0x380f1b['digit']);var _0x503cb0=_0x5c0fb7[_0x2218('0xb2')];if(_0x5c0fb7[_0x2218('0xb2')]===-0x1){this[_0x2218('0x3a')][_0x2218('0x78')](this,_0x380f1b,'-1');return _0x5c0fb7;}else if(_0x5c0fb7['extra']===_0x2218('0x6e')){_0x5c0fb7[_0x2218('0xb2')]=_0x5c0fb7[_0x2218('0xb2')]['length']>0x0?_0x5c0fb7['result']:'t';}else if(_[_0x2218('0x4a')](_0x5c0fb7[_0x2218('0xb2')])){_0x5c0fb7['result']='#';_0x503cb0='#';}if(!this[_0x2218('0x8b')](_0x380f1b[_0x2218('0xdf')])){this[_0x2218('0x3b')]['noop'](_0x2218('0xe0'));}else{var _0x3113f7=this['getVariable'][_0x2218('0x78')](this,_0x380f1b[_0x2218('0xdf')]);if(!_0x3113f7){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x380f1b,_0x2218('0xe1'));}this[_0x2218('0x3b')][_0x2218('0xfd')](_0x3113f7,_0x503cb0);}this[_0x2218('0x3a')][_0x2218('0x78')](this,_0x380f1b,_0x503cb0);return _0x5c0fb7;};AGIVertices[_0x2218('0x12')][_0x2218('0xaa')]=function(_0x3497de){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x16b'),_0x3497de['label']));return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x3497de[_0x2218('0x16c')]||_0x3497de['label']);};AGIVertices[_0x2218('0x12')]['pause']=function(_0x2a3603){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x16d'),_0x2a3603[_0x2218('0x3d')]));if(!this['isConfigured'](_0x2a3603[_0x2218('0x15b')])){return this['channel'][_0x2218('0x36')](_0x2a3603,_0x2218('0x15c'));}logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x15d'),this[_0x2218('0x3b')][_0x2218('0x40')],_0x2a3603[_0x2218('0x15b')]));var _0x935ade=this[_0x2218('0x16e')]['sync'](this,_0x2a3603['pause_id']);var _0x5bf341=this[_0x2218('0x55')][_0x2218('0x78')](this,_0x2a3603['findBy'],_0x935ade);if(_0x5bf341){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x15e'),this['channel'][_0x2218('0x40')],_0x2a3603[_0x2218('0x15b')]));this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2218('0x3b')][_0x2218('0x40')],_0x2a3603[_0x2218('0x15b')]));return{'code':0xc8,'result':_0x2218('0x15f')};}else{logger[_0x2218('0x31')](util[_0x2218('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2218('0x3b')]['callerid'],_0x2a3603[_0x2218('0x15b')]));this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0x15e'),this[_0x2218('0x3b')][_0x2218('0x40')],_0x2a3603[_0x2218('0x15b')]));return{'code':0xc8,'result':_0x2218('0x162')};}};AGIVertices[_0x2218('0x12')]['playback']=function(_0x9e4f80){logger[_0x2218('0x31')](util['format'](_0x2218('0x16f'),_0x9e4f80[_0x2218('0x3d')]));if(!this['isConfigured'](_0x9e4f80['file_id'])){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x9e4f80,'no\x20file\x20audio\x20selected');}var _0x134234=this[_0x2218('0x11d')][_0x2218('0x78')](this,_0x9e4f80[_0x2218('0x11b')]);if(!_0x134234){return this['channel'][_0x2218('0x36')](_0x9e4f80,_0x2218('0x170'));}var _0x7dbf4c=this[_0x2218('0x3b')][_0x2218('0x5f')](_0x2218('0x171'),[_0x134234,_0x9e4f80[_0x2218('0xed')]]);if(_0x7dbf4c['result']===-0x1){return _0x7dbf4c;}return this[_0x2218('0x3b')]['noop'](util[_0x2218('0x2c')](_0x2218('0xca'),_0x2218('0x171'),_0x134234));};AGIVertices[_0x2218('0x12')][_0x2218('0x172')]=function(_0x3b2ff3){logger[_0x2218('0x31')](util['format'](_0x2218('0x173'),_0x3b2ff3['label']));if(!this[_0x2218('0x8b')](_0x3b2ff3[_0x2218('0x174')])){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x3b2ff3,_0x2218('0x175'));}var _0x5cc2ac='';var _0x555059=parseInt(_0x3b2ff3[_0x2218('0x174')],0xa);if(isNaN(_0x555059)){_0x5cc2ac=_0x3b2ff3[_0x2218('0x174')];}else{_0x5cc2ac=this[_0x2218('0x17')]['sync'](this,_0x3b2ff3['queue_id']);if(!_0x5cc2ac){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x3b2ff3,_0x2218('0x176'));}}var _0x53245a='';if(this[_0x2218('0x8b')](_0x3b2ff3['file_id'])){var _0x16b1a0=this['getSound']['sync'](this,_0x3b2ff3[_0x2218('0x11b')]);if(_0x16b1a0){_0x53245a=_0x16b1a0;}}this[_0x2218('0x3a')][_0x2218('0x78')](this,_0x3b2ff3,_0x5cc2ac);if(_0x3b2ff3[_0x2218('0xed')]['indexOf']('x')<0x0){_0x3b2ff3[_0x2218('0xed')]+='x';}if(_0x3b2ff3[_0x2218('0xed')][_0x2218('0x177')]('X')<0x0){_0x3b2ff3[_0x2218('0xed')]+='X';}this[_0x2218('0x3b')][_0x2218('0xfd')](_0x2218('0x178'),_0x5cc2ac?_0x5cc2ac[_0x2218('0x179')]():'');var _0xd36a76=this[_0x2218('0x3b')][_0x2218('0x5f')]('QUEUE',[_0x5cc2ac,_0x3b2ff3['opts'],_0x3b2ff3[_0x2218('0x6c')],_0x53245a,_0x3b2ff3[_0x2218('0x6e')],_0x3b2ff3[_0x2218('0x7')],_0x3b2ff3['macro'],_0x3b2ff3[_0x2218('0x17a')],'',_0x3b2ff3[_0x2218('0x17b')]]);if(_0xd36a76[_0x2218('0xb2')]===-0x1){return _0xd36a76;}return this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0xca'),_0x2218('0x17c'),_0x5cc2ac));};AGIVertices[_0x2218('0x12')]['record']=function(_0x2358f4){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x17d'),_0x2358f4[_0x2218('0x3d')]));var _0x3ce95e=_0x2358f4['recordingFormat']||'wav';var _0x568eb3=util['format'](_0x2218('0x17e'),this[_0x2218('0x3b')][_0x2218('0x3c')],rs[_0x2218('0x136')](0x5));var _0x59938b=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x568eb3,_0x3ce95e);var _0x539ef3=util['format'](_0x2218('0x135'),FILES_PATH,_0x568eb3);this[_0x2218('0x41')]['sync'](this,_0x2358f4,_0x568eb3,_0x59938b);this[_0x2218('0x3b')][_0x2218('0xfd')]('RECORDING_SAVENAME',_0x568eb3);logger[_0x2218('0x31')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x539ef3,_0x3ce95e,_0x2358f4[_0x2218('0x17f')],_0x2358f4[_0x2218('0x6e')]);return this[_0x2218('0x3b')][_0x2218('0x138')](_0x539ef3,_0x3ce95e,_0x2358f4['escape_digits'],_0x2358f4[_0x2218('0x6e')],undefined,!![]);};AGIVertices[_0x2218('0x12')][_0x2218('0x180')]=function(_0x207842){logger[_0x2218('0x31')](util[_0x2218('0x2c')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x207842[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0x207842[_0x2218('0x6c')])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0x181'));}var _0x24e86e=this[_0x2218('0x6b')]['sync'](this,_0x207842);logger['info'](util['format'](_0x2218('0x182'),util['inspect'](_0x24e86e,{'showHidden':![],'depth':null})));if(!this[_0x2218('0x8b')](_0x207842[_0x2218('0xdf')])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0x183'));}var _0x39a523=this[_0x2218('0x13')]['sync'](this,_0x207842[_0x2218('0xdf')]);if(!_0x39a523){return this[_0x2218('0x3b')]['error'](_0x207842,'no\x20variable\x20found');}this['channel'][_0x2218('0xfd')](util[_0x2218('0x2c')](_0x2218('0x184'),_0x39a523),_0x24e86e[_0x2218('0x7e')]?_0x24e86e[_0x2218('0x7e')]:'200');this[_0x2218('0x3b')][_0x2218('0xfd')](util[_0x2218('0x2c')](_0x2218('0x185'),_0x39a523),_0x24e86e['statusMessage']?_0x24e86e[_0x2218('0x186')]:'OK');if(_0x24e86e[_0x2218('0x7c')]){try{this[_0x2218('0xa1')](_0x24e86e['body'],_0x39a523);}catch(_0x5cf798){logger[_0x2218('0x36')](util['format'](_0x2218('0x187'),_0x39a523));}}return this[_0x2218('0x3b')]['noop'](util[_0x2218('0x2c')](_0x2218('0xe6'),_0x39a523));};AGIVertices[_0x2218('0x12')][_0x2218('0x188')]=function(_0x139fb8){logger[_0x2218('0x31')](util['format'](_0x2218('0x189'),_0x139fb8['label']));return this[_0x2218('0x3b')][_0x2218('0x18a')](_0x139fb8[_0x2218('0x18b')][_0x2218('0x61')](/\s+/g,''),_0x139fb8[_0x2218('0x17f')]);};AGIVertices[_0x2218('0x12')][_0x2218('0x18c')]=function(_0x3a8253){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x18d'),_0x3a8253[_0x2218('0x3d')]));return this[_0x2218('0x3b')][_0x2218('0x18e')](_0x3a8253[_0x2218('0x6f')][_0x2218('0x61')](/\s+/g,''),_0x3a8253[_0x2218('0x17f')]);};AGIVertices[_0x2218('0x12')]['sayphonetic']=function(_0x250e02){logger['info'](util[_0x2218('0x2c')](_0x2218('0x18f'),_0x250e02['label']));return this[_0x2218('0x3b')][_0x2218('0x190')](_0x250e02[_0x2218('0x63')],_0x250e02[_0x2218('0x17f')]);};AGIVertices[_0x2218('0x12')]['sendMail']=function(_0x349939){logger[_0x2218('0x31')](util[_0x2218('0x2c')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x349939[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0x349939['account_id'])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0x191'));}var _0x37fcbe=this[_0x2218('0x23')][_0x2218('0x78')](this,_0x349939['account_id']);if(!_0x37fcbe||!_0x37fcbe[_0x2218('0x192')]){return this[_0x2218('0x3b')]['error'](_0x349939,_0x2218('0x193'));}var _0x3d8f75={'from':util[_0x2218('0x2c')](_0x2218('0x194'),_0x37fcbe[_0x2218('0x19')],_0x37fcbe[_0x2218('0x195')]||_0x37fcbe[_0x2218('0x192')][_0x2218('0x196')]),'to':_0x349939['to']||'','cc':_0x349939['cc']||'','bcc':_0x349939[_0x2218('0x197')]||'','subject':_0x349939['subject'],'html':_0x349939[_0x2218('0x63')],'text':_0x349939[_0x2218('0x63')]};if(this[_0x2218('0x8b')](_0x349939[_0x2218('0x198')])){}logger['debug']('sendMail\x20message',JSON[_0x2218('0x7b')](_0x3d8f75));this[_0x2218('0x3a')][_0x2218('0x78')](this,_0x349939,_0x349939[_0x2218('0x199')]);this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0x19a'),_0x37fcbe[_0x2218('0x19')]));this[_0x2218('0x25')][_0x2218('0x78')](this,_0x37fcbe[_0x2218('0x19b')],_0x3d8f75);return this['channel'][_0x2218('0xaa')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x2218('0x12')][_0x2218('0x19c')]=function(_0x458fac){logger['info'](util[_0x2218('0x2c')](_0x2218('0x19d'),_0x458fac['label']));return this[_0x2218('0x3b')]['noop'](_0x2218('0x19e'));};AGIVertices['prototype'][_0x2218('0x19f')]=function(_0xf763cd){logger[_0x2218('0x31')](util['format'](_0x2218('0x1a0'),_0xf763cd[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0xf763cd[_0x2218('0x1a1')])){return this['channel'][_0x2218('0xaa')](_0x2218('0x1a2'));}var _0x2fb2cf=this[_0x2218('0x38')]['sync'](this,_0xf763cd[_0x2218('0x1a1')]);if(!_0x2fb2cf){return this[_0x2218('0x3b')]['error'](_0xf763cd,'no\x20sms\x20account\x20found');}var _0x14e108={'body':_0xf763cd['sms_text'],'phone':_0xf763cd['to']||'','SmsAccountId':_0x2fb2cf['id']};logger[_0x2218('0x1a3')](_0x2218('0x1a4'),JSON[_0x2218('0x7b')](_0x14e108));this[_0x2218('0x3a')]['sync'](this,_0xf763cd,_0xf763cd[_0x2218('0x1a1')]);this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0x1a5'),_0x2fb2cf[_0x2218('0x19')]));this['createSmsMessage'][_0x2218('0x78')](this,_0x14e108);return this['channel'][_0x2218('0xaa')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x2218('0x12')][_0x2218('0x1a6')]=function(_0x5d9f3e){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x1a7'),_0x5d9f3e[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0x5d9f3e[_0x2218('0xdf')])){return this[_0x2218('0x3b')]['error'](_0x5d9f3e,_0x2218('0x1a8'));}var _0xeaa60e=this[_0x2218('0x13')][_0x2218('0x78')](this,_0x5d9f3e['variable_id']);if(!_0xeaa60e){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x5d9f3e,'no\x20variable\x20found');}return this['channel']['setVariable'](_0xeaa60e,_0x5d9f3e['variable_value']);};AGIVertices[_0x2218('0x12')][_0x2218('0x1a9')]=function(_0x2c7987){logger[_0x2218('0x31')](util[_0x2218('0x2c')]('Enter\x20in\x20START\x20(%s)\x20block',_0x2c7987[_0x2218('0x3d')]));this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0x1aa'));if(_0x2c7987['answer']===_0x2218('0x1ab')){this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0x1ac'));return this[_0x2218('0x3b')][_0x2218('0xbc')]();}return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0x1ad'));};AGIVertices[_0x2218('0x12')][_0x2218('0x1ae')]=function(_0x5e61ef){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x1af'),_0x5e61ef[_0x2218('0x3d')]));if(!this['isConfigured'](_0x5e61ef[_0x2218('0x1b0')])){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x5e61ef,_0x2218('0x1b1'));}var _0x19cdee=this[_0x2218('0x1a')]['sync'](this,_0x5e61ef[_0x2218('0x1b0')]);if(!this['isConfigured'](_0x19cdee)){return this[_0x2218('0x3b')]['error'](_0x5e61ef,util[_0x2218('0x2c')](_0x2218('0x1b2'),_0x5e61ef[_0x2218('0x1b0')]));}if(_0x19cdee===this[_0x2218('0x3b')][_0x2218('0x3f')]){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x5e61ef,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x2218('0x3a')][_0x2218('0x78')](this,_0x5e61ef,_0x19cdee);var _0x2e3f22=this[_0x2218('0x3b')][_0x2218('0x5f')]('AGI',util[_0x2218('0x2c')](_0x2218('0x1b3'),config[_0x2218('0x7')][_0x2218('0x1b4')]||'127.0.0.1',_0x19cdee,this[_0x2218('0x3b')][_0x2218('0x3f')]));if(_0x2e3f22[_0x2218('0xb2')]===-0x1){return _0x2e3f22;}return this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0xca'),_0x2218('0x1b5'),_0x19cdee));};AGIVertices['prototype'][_0x2218('0x1b6')]=function(_0xa83192){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x1b7'),_0xa83192[_0x2218('0x3d')]));var _0x39bcf2=this['shellCommand'][_0x2218('0x78')](this,_0xa83192[_0x2218('0xba')]);this['createSquareDetailsReport'][_0x2218('0x78')](this,_0xa83192,_0xa83192[_0x2218('0xba')]);if(this[_0x2218('0x8b')](_0xa83192['variable_id'])){var _0x2a7b30=this[_0x2218('0x13')]['sync'](this,_0xa83192[_0x2218('0xdf')]);if(_0x2a7b30){this[_0x2218('0x3b')][_0x2218('0xfd')](_0x2a7b30,_0x39bcf2);return this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0xa83192[_0x2218('0xba')],_0x2a7b30));}}return this[_0x2218('0x3b')]['noop'](util[_0x2218('0x2c')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xa83192[_0x2218('0xba')]));};AGIVertices[_0x2218('0x12')]['google_cloud_tts']=function(_0x44e1c0){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x1b8'),_0x44e1c0[_0x2218('0x3d')]));_0x44e1c0['text']=_0x44e1c0[_0x2218('0x63')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2218('0x8b')](_0x44e1c0[_0x2218('0x1b9')])){return this['channel'][_0x2218('0xaa')](_0x2218('0x1ba'));}if(!this[_0x2218('0x8b')](_0x44e1c0['text'])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0xab'));}this[_0x2218('0x3b')]['noop'](util[_0x2218('0x2c')](_0x2218('0x1bb'),_0x44e1c0[_0x2218('0x63')]));var _0x179450=this[_0x2218('0x62')][_0x2218('0x78')](this,_0x44e1c0);if(_0x179450){this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0x1bc'),_0x179450));var _0x42634c=this[_0x2218('0x3b')][_0x2218('0x10c')](_0x179450);try{fs[_0x2218('0x12e')](_0x179450+_0x2218('0x10d'));}catch(_0x450337){logger['error'](_0x450337);}return _0x42634c;}return this[_0x2218('0x3b')][_0x2218('0x36')](_0x44e1c0,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x2218('0x1bd')]=function(_0x1c5ccf){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x1be'),_0x1c5ccf[_0x2218('0x3d')]));_0x1c5ccf[_0x2218('0x63')]=_0x1c5ccf[_0x2218('0x63')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2218('0x8b')](_0x1c5ccf['text'])){return this[_0x2218('0x3b')][_0x2218('0xaa')](_0x2218('0xab'));}this[_0x2218('0x3b')]['noop'](util['format'](_0x2218('0x1bf'),_0x1c5ccf[_0x2218('0x63')]));var _0x3a505e=this[_0x2218('0x69')][_0x2218('0x78')](this,_0x1c5ccf);if(_0x3a505e){this[_0x2218('0x3b')]['noop'](util[_0x2218('0x2c')](_0x2218('0x1c0'),_0x3a505e));var _0x1fa2f2=this[_0x2218('0x3b')]['streamFile'](_0x3a505e);try{fs[_0x2218('0x12e')](_0x3a505e+'.wav');}catch(_0x29fd2e){logger[_0x2218('0x36')](_0x29fd2e);}return _0x1fa2f2;}return this['channel'][_0x2218('0x36')](_0x1c5ccf,_0x2218('0x1c1'));};AGIVertices['prototype'][_0x2218('0x1c2')]=function(_0x220b1a){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x1c3'),_0x220b1a[_0x2218('0x3d')]));if(!this[_0x2218('0x8b')](_0x220b1a['findBy'])){return this['channel']['error'](_0x220b1a,_0x2218('0x15c'));}logger['info'](util[_0x2218('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x2218('0x3b')][_0x2218('0x40')],_0x220b1a[_0x2218('0x15b')]));var _0x341e16=this[_0x2218('0x58')][_0x2218('0x78')](this,_0x220b1a[_0x2218('0x15b')]);if(_0x341e16){logger[_0x2218('0x31')](util[_0x2218('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2218('0x3b')][_0x2218('0x40')],_0x220b1a[_0x2218('0x15b')]));this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2218('0x3b')][_0x2218('0x40')],_0x220b1a[_0x2218('0x15b')]));return{'code':0xc8,'result':_0x2218('0x15f')};}else{logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x160'),this[_0x2218('0x3b')][_0x2218('0x40')],_0x220b1a[_0x2218('0x15b')]));this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0x160'),this['channel'][_0x2218('0x40')],_0x220b1a[_0x2218('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x2218('0x12')][_0x2218('0x1c4')]=function(_0x3bbbc6){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x1c5'),_0x3bbbc6[_0x2218('0x3d')]));var _0x15a363=this[_0x2218('0x3b')][_0x2218('0x5f')](_0x2218('0x1c6'),[_0x3bbbc6[_0x2218('0x1c7')],_0x3bbbc6[_0x2218('0x80')]]);if(_0x15a363[_0x2218('0xb2')]===-0x1){return _0x15a363;}return this[_0x2218('0x3b')][_0x2218('0xaa')](util[_0x2218('0x2c')](_0x2218('0xca'),_0x2218('0x1c6'),_0x3bbbc6['mailbox']));};AGIVertices[_0x2218('0x12')][_0x2218('0x1c8')]=function(_0x3269cb){logger[_0x2218('0x31')](util[_0x2218('0x2c')](_0x2218('0x1c9'),_0x3269cb['label']));if(!this[_0x2218('0x8b')](_0x3269cb[_0x2218('0xdf')])){return this[_0x2218('0x3b')]['error'](_0x3269cb,_0x2218('0x1a8'));}var _0x375058=this[_0x2218('0x13')]['sync'](this,_0x3269cb[_0x2218('0xdf')]);if(!_0x375058){return this[_0x2218('0x3b')][_0x2218('0x36')](_0x3269cb,_0x2218('0xe1'));}var _0x4265a6=this[_0x2218('0x3b')]['getVariable'](_0x375058);return{'code':0xc8,'result':_0x4265a6[_0x2218('0xa5')]?_0x4265a6[_0x2218('0xa5')]:'-'};};String['prototype'][_0x2218('0xa4')]=function(_0x4c04a0,_0x37f9e9){return this[_0x2218('0x1ca')](_0x4c04a0)[_0x2218('0x1cb')](_0x37f9e9);};module[_0x2218('0x1cc')]=AGIVertices; \ No newline at end of file +var _0x9458=['./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','prototype','getVariable','then','name','catch','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','isEmpty','callback_','random','lastName','isNil','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','number','timeout','includes','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','headers','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','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','tildeASR','appsecret','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','saveRestApiResult','isArray','length','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','sync','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','command','args','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','createCmContact','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','googleDialogflow','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','retry','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','hiddendigitsnum','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appsecret\x20configured','NOBEEP','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','getPause','pause_id','playback','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','debug','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','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','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','shelljs','moment','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared'];(function(_0x4c2069,_0x32b34d){var _0x1d350e=function(_0x40458a){while(--_0x40458a){_0x4c2069['push'](_0x4c2069['shift']());}};_0x1d350e(++_0x32b34d);}(_0x9458,0x1b8));var _0x8945=function(_0x35eed2,_0x1fa72b){_0x35eed2=_0x35eed2-0x0;var _0x35adb2=_0x9458[_0x35eed2];return _0x35adb2;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require(_0x8945('0x0'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x8945('0x1'));var Mustache=require('mustache');var rp=require(_0x8945('0x2'));var logger=require(_0x8945('0x3'))(_0x8945('0x4'));var config=require(_0x8945('0x5'));var shared=require(_0x8945('0x6'));var scripts=require(_0x8945('0x7'));var FILES_PATH=_0x8945('0x8');var recursiveMapAttributes=[_0x8945('0x9'),_0x8945('0xa')];var verticesWithRetry=[_0x8945('0xb'),'getdigits',_0x8945('0xc')];var AGIVertices=function(_0x409ebc,_0x363ae8,_0x307b9e){this[_0x8945('0xd')]=_0x409ebc;this[_0x8945('0xe')]=_0x363ae8;this['mailRpc']=_0x307b9e;};AGIVertices[_0x8945('0xf')][_0x8945('0x10')]=function(_0x4a0578,_0x54fe39){this[_0x8945('0xe')]['getVariableById'](_0x4a0578)[_0x8945('0x11')](function(_0x76c5c7){_0x54fe39(null,_0x76c5c7?_0x76c5c7[_0x8945('0x12')]:![]);})[_0x8945('0x13')](function(_0x3634fd){_0x54fe39(_0x3634fd);});};AGIVertices[_0x8945('0xf')]['getVoiceQueue']=function(_0x1582cb,_0xaa2141){this['rpc'][_0x8945('0x14')](_0x1582cb)[_0x8945('0x11')](function(_0x21b076){_0xaa2141(null,_0x21b076?_0x21b076[_0x8945('0x12')]:![]);})[_0x8945('0x13')](function(_0x442241){_0xaa2141(_0x442241);});};AGIVertices['prototype']['getSquareProject']=function(_0x425752,_0x4c0b8f){this['rpc'][_0x8945('0x15')](_0x425752)['then'](function(_0x4bd38f){_0x4c0b8f(null,_0x4bd38f?_0x4bd38f[_0x8945('0x12')]:![]);})[_0x8945('0x13')](function(_0x38d181){_0x4c0b8f(_0x38d181);});};AGIVertices[_0x8945('0xf')][_0x8945('0x16')]=function(_0x32ce5e,_0x456628){this[_0x8945('0xe')][_0x8945('0x17')](_0x32ce5e)[_0x8945('0x11')](function(_0x1738e1){_0x456628(null,_0x1738e1?_0x1738e1[_0x8945('0x18')]:![]);})[_0x8945('0x13')](function(_0x453495){_0x456628(_0x453495);});};AGIVertices['prototype']['getUser']=function(_0x501422,_0x5046b1){this[_0x8945('0xe')][_0x8945('0x19')](_0x501422)[_0x8945('0x11')](function(_0x20833b){_0x5046b1(null,_0x20833b?_0x20833b[_0x8945('0x12')]:![]);})[_0x8945('0x13')](function(_0x31a7ec){_0x5046b1(_0x31a7ec);});};AGIVertices['prototype'][_0x8945('0x1a')]=function(_0x199b73,_0x27d231){this[_0x8945('0xe')][_0x8945('0x1b')](_0x199b73)[_0x8945('0x11')](function(_0x34d8de){_0x27d231(null,_0x34d8de?_0x34d8de[_0x8945('0x12')]:![]);})[_0x8945('0x13')](function(_0x3084e4){_0x27d231(_0x3084e4);});};AGIVertices[_0x8945('0xf')][_0x8945('0x1c')]=function(_0x52523a,_0x40f6c5){var _0x55cc6c=this;this[_0x8945('0xe')]['getSoundById'](_0x52523a)[_0x8945('0x11')](function(_0x435c2a){_0x40f6c5(null,_0x435c2a?_0x55cc6c[_0x8945('0x1d')](_0x435c2a[_0x8945('0x1e')]):![]);})['catch'](function(_0x3af7df){_0x40f6c5(_0x3af7df);});};AGIVertices[_0x8945('0xf')][_0x8945('0x1f')]=function(_0x3aa963,_0x476788){this[_0x8945('0xe')][_0x8945('0x20')](_0x3aa963)[_0x8945('0x11')](function(_0x3a094b){_0x476788(null,_0x3a094b?_0x3a094b:![]);})[_0x8945('0x13')](function(_0x168db6){_0x476788(_0x168db6);});};AGIVertices[_0x8945('0xf')][_0x8945('0x21')]=function(_0x4bf762,_0x5dc86d,_0x522e52){this[_0x8945('0x22')]['sendMailMessage'](_0x4bf762,_0x5dc86d)['then'](function(){_0x522e52(null);})[_0x8945('0x13')](function(_0x2f104d){_0x522e52(_0x2f104d);});};AGIVertices[_0x8945('0xf')]['getIntervals']=function(_0x29f5fe,_0x2cd70e){this['rpc'][_0x8945('0x23')](_0x29f5fe)[_0x8945('0x11')](function(_0x2f0fbc){if(_0x2f0fbc){if(_0x2f0fbc['IntervalId']){_0x2cd70e(null,[_0x2f0fbc['interval']]);}else{_0x2cd70e(null,_['map'](_0x2f0fbc[_0x8945('0x24')],'interval'));}}else{_0x2cd70e(null,![]);}})[_0x8945('0x13')](function(_0x210ef0){_0x2cd70e(_0x210ef0);});};AGIVertices[_0x8945('0xf')][_0x8945('0x1d')]=function(_0x1fe406){return util['format'](_0x8945('0x25'),FILES_PATH,_0x1fe406);};AGIVertices['prototype'][_0x8945('0x26')]=function(_0x636a3d,_0x6388e5,_0x3d972f){odbc['open'](_0x636a3d,function(_0x2beedd){if(_0x2beedd){logger[_0x8945('0x27')](_0x8945('0x28'),_0x2beedd);_0x3d972f(_0x2beedd);}else{logger[_0x8945('0x29')](_0x8945('0x2a'));odbc[_0x8945('0x2b')](_0x6388e5,function(_0x1a3f84,_0x13a215){if(_0x1a3f84){logger[_0x8945('0x29')](_0x8945('0x2c'),_0x6388e5);_0x3d972f(_0x1a3f84);}else{logger[_0x8945('0x29')](_0x8945('0x2d'),_0x6388e5);odbc[_0x8945('0x2e')](function(_0x34b3fa){if(_0x34b3fa){logger[_0x8945('0x27')](_0x8945('0x2f'),_0x34b3fa);}_0x3d972f(null,_0x13a215);});}});}});};AGIVertices[_0x8945('0xf')][_0x8945('0x30')]=function(_0x58214b,_0xd61060){this['rpc'][_0x8945('0x31')](_0x58214b)[_0x8945('0x11')](function(_0x45a68c){_0xd61060(null,_0x45a68c?_0x45a68c:![]);})[_0x8945('0x13')](function(_0x55967d){_0xd61060(_0x55967d);});};AGIVertices[_0x8945('0xf')][_0x8945('0x32')]=function(_0x5c9540,_0x30b04d){this[_0x8945('0xe')][_0x8945('0x32')](_0x5c9540)[_0x8945('0x11')](function(_0x199ac2){_0x30b04d(null,_0x199ac2);})['catch'](function(_0x1cfc73){_0x30b04d(_0x1cfc73);});};AGIVertices['prototype'][_0x8945('0x33')]=function(_0x4b5de2,_0x15b657,_0x24b317){this[_0x8945('0xe')]['createSquareDetailsReport']({'uniqueid':this[_0x8945('0xd')][_0x8945('0x34')],'node':_0x4b5de2[_0x8945('0x35')],'application':_0x4b5de2['agicommand'],'data':_0x15b657||null,'project_name':this[_0x8945('0xd')][_0x8945('0x36')],'callerid':this['channel'][_0x8945('0x37')]})['then'](function(_0x4ea606){if(_0x24b317){_0x24b317(null,_0x4ea606);}})[_0x8945('0x13')](function(_0x3552f9){if(_0x24b317){_0x24b317(_0x3552f9);}});};AGIVertices[_0x8945('0xf')]['createSquareRecording']=function(_0x2bd4ff,_0x4164b9,_0x1553b2,_0xc056af){this[_0x8945('0xe')][_0x8945('0x38')]({'uniqueid':this['channel'][_0x8945('0x34')],'callerid':this['channel'][_0x8945('0x37')],'calleridname':this[_0x8945('0xd')][_0x8945('0x39')],'context':this[_0x8945('0xd')][_0x8945('0x3a')],'extension':this['channel'][_0x8945('0x3b')],'priority':this['channel'][_0x8945('0x3c')],'accountcode':this['channel']['accountcode'],'dnid':this[_0x8945('0xd')][_0x8945('0x3d')],'projectName':this['channel'][_0x8945('0x36')],'saveName':_0x4164b9,'filename':_0x2bd4ff[_0x8945('0x3e')]||_0x4164b9,'savePath':_0x1553b2})[_0x8945('0x11')](function(_0x2d702a){_0xc056af(null,_0x2d702a);})['catch'](function(_0x542ee0){_0xc056af(_0x542ee0);});};AGIVertices[_0x8945('0xf')][_0x8945('0x3f')]=function(_0x5c6867,_0x3afaa3,_0x4cac52,_0x54fe43,_0x35a38c){this['rpc']['createSquareMessage']({'uniqueid':this['channel']['uniqueid'],'body':_0x5c6867,'direction':_0x3afaa3,'providerName':_0x4cac52,'providerResponse':_0x54fe43})[_0x8945('0x11')](function(_0xbb3f73){if(_0x35a38c){_0x35a38c(null,_0xbb3f73);}})['catch'](function(_0x2d39c9){if(_0x35a38c){_0x35a38c(_0x2d39c9);}});};AGIVertices['prototype']['createCmContact']=function(_0x393a28,_0x59c3b0){this[_0x8945('0xe')]['createCmContact']({'firstName':_[_0x8945('0x40')](_0x393a28[_0x8945('0x12')])||_['isNil'](_0x393a28[_0x8945('0x12')])?_0x8945('0x41')+Math[_0x8945('0x42')]():_0x393a28[_0x8945('0x12')],'lastName':_['isEmpty'](_0x393a28[_0x8945('0x43')])||_[_0x8945('0x44')](_0x393a28[_0x8945('0x43')])?null:_0x393a28[_0x8945('0x43')],'phone':_0x393a28['phone'],'ListId':_0x393a28['list_id'],'scheduledat':_0x393a28[_0x8945('0x45')],'callbackUniqueid':this[_0x8945('0xd')][_0x8945('0x34')],'tags':_0x8945('0x46'),'description':_0x8945('0x47')+_0x393a28[_0x8945('0x45')][_0x8945('0x48')](),'priority':_0x393a28[_0x8945('0x49')]})[_0x8945('0x11')](function(_0x54bd37){_0x59c3b0(null,_0x54bd37);})[_0x8945('0x13')](function(_0xfb38e5){_0x59c3b0(_0xfb38e5);});};AGIVertices[_0x8945('0xf')]['getPause']=function(_0x1a7b06,_0x9c4e21){this[_0x8945('0xe')][_0x8945('0x4a')](_0x1a7b06)[_0x8945('0x11')](function(_0x3d970e){_0x9c4e21(null,_0x3d970e?_0x3d970e[_0x8945('0x12')]:![]);})[_0x8945('0x13')](function(_0xbc7fd0){_0x9c4e21(_0xbc7fd0);});};AGIVertices[_0x8945('0xf')][_0x8945('0x4b')]=function(_0x3f41a0,_0x4bc9c9,_0x54b042){var _0x6da7be={'role':_0x8945('0x4c')};_0x6da7be[_0x3f41a0]=this[_0x8945('0xd')][_0x8945('0x37')];this[_0x8945('0xe')][_0x8945('0x4b')](_0x6da7be,_0x4bc9c9,this[_0x8945('0xd')]['uniqueid'])[_0x8945('0x11')](function(_0x584081){_0x54b042(null,_['isNil'](_0x584081)?![]:!![]);})[_0x8945('0x13')](function(_0xd6c1f1){logger[_0x8945('0x27')](_0xd6c1f1);_0x54b042(null,![]);});};AGIVertices['prototype'][_0x8945('0x4d')]=function(_0x46ff52,_0x318877){var _0x4bbbbb={'role':'agent'};_0x4bbbbb[_0x46ff52]=this['channel'][_0x8945('0x37')];this['rpc'][_0x8945('0x4d')](_0x4bbbbb)['then'](function(_0x15d3bb){_0x318877(null,_[_0x8945('0x44')](_0x15d3bb)?![]:!![]);})['catch'](function(_0x107cfb){logger[_0x8945('0x27')](_0x107cfb);_0x318877(null,![]);});};AGIVertices[_0x8945('0xf')]['agentLogout']=function(_0x35483c,_0x265107){var _0x17ecf4={'role':_0x8945('0x4c')};_0x17ecf4[_0x35483c]=this['channel']['callerid'];this['rpc'][_0x8945('0x4e')](_0x17ecf4)[_0x8945('0x11')](function(_0x4b30eb){_0x265107(null,_[_0x8945('0x44')](_0x4b30eb)?![]:!![]);})[_0x8945('0x13')](function(_0x1d8ca2){logger[_0x8945('0x27')](_0x1d8ca2);_0x265107(null,![]);});};AGIVertices[_0x8945('0xf')][_0x8945('0x4f')]=function(_0x1500ee,_0x2af354){var _0x53f79b={'role':_0x8945('0x4c')};_0x53f79b[_0x1500ee]=this[_0x8945('0xd')][_0x8945('0x37')];var _0x4ea195=_0x1500ee!=_0x8945('0x50')?util[_0x8945('0x51')](_0x8945('0x52'),_0x8945('0x53'),this[_0x8945('0xd')][_0x8945('0x37')]):undefined;this[_0x8945('0xe')][_0x8945('0x4f')](_0x53f79b,_0x4ea195)[_0x8945('0x11')](function(_0x1994e3){_0x2af354(null,_[_0x8945('0x44')](_0x1994e3)?![]:!![]);})[_0x8945('0x13')](function(_0x1a7b4b){logger['error'](_0x1a7b4b);_0x2af354(null,![]);});};AGIVertices[_0x8945('0xf')]['shellCommand']=function(_0x3c0513,_0x24d4cb){sh['exec'](_[_0x8945('0x54')](_0x3c0513),function(_0x47aeea,_0x38591c){var _0x8fc7f1=_0x38591c[_0x8945('0x55')](/(\r\n|\n|\r)/gm,'');_0x24d4cb(null,_0x8fc7f1);});};AGIVertices['prototype'][_0x8945('0x56')]=function(_0x4c685d,_0x3e321e){scripts[_0x8945('0x56')](_0x4c685d[_0x8945('0x57')],_0x4c685d['google_cloud_tts_text_type']||_0x8945('0x58'),_0x4c685d[_0x8945('0x58')],_0x4c685d[_0x8945('0x59')]||_0x8945('0x5a'),_0x4c685d[_0x8945('0x5b')]||_0x8945('0x5c'),_0x4c685d[_0x8945('0x5d')]||_0x8945('0x5e'))[_0x8945('0x11')](function(_0x278f3d){_0x3e321e(null,_0x278f3d);})['catch'](function(_0x455621){_0x3e321e(_0x455621);});};AGIVertices[_0x8945('0xf')]['googleTTS']=function(_0x24246f,_0x57b8ed){scripts[_0x8945('0x5f')](_0x24246f[_0x8945('0x58')],_0x24246f[_0x8945('0x60')]||'en',0x1)[_0x8945('0x11')](function(_0x292d47){_0x57b8ed(null,_0x292d47);})[_0x8945('0x13')](function(_0x36642){_0x57b8ed(_0x36642);});};AGIVertices[_0x8945('0xf')][_0x8945('0x61')]=function(_0x3502df,_0x1a7243){var _0x29bcfb={'uri':_0x3502df[_0x8945('0x62')],'method':_0x3502df['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3502df['timeout'])===_0x8945('0x63')&&parseInt(_0x3502df[_0x8945('0x64')])>=0x1?parseInt(_0x3502df[_0x8945('0x64')])*0x3e8:0x5*0x3e8};if(_[_0x8945('0x65')](['POST',_0x8945('0x66')],_0x29bcfb['method'][_0x8945('0x67')]())){try{_0x29bcfb[_0x8945('0x68')]=_0x3502df[_0x8945('0xa')]?JSON[_0x8945('0x69')](_0x3502df['rawBody']):{};}catch(_0x4e5352){logger['error'](_0x8945('0x6a'),_0x4e5352);}}try{_0x29bcfb['headers']=_0x3502df['rawHeaders']?JSON[_0x8945('0x69')](_0x3502df[_0x8945('0x9')]):{};}catch(_0x2beeb1){logger[_0x8945('0x27')](_0x8945('0x6b'),_0x2beeb1);}if(_0x3502df[_0x8945('0x6c')]){try{var _0x15a716=require(_0x3502df['computedVariables'])['sync'](this,_0x29bcfb);_0x29bcfb[_0x8945('0x6d')]=Mustache[_0x8945('0x6e')](_0x3502df[_0x8945('0x62')],_0x15a716,{},['$$','$$']);if(_0x29bcfb[_0x8945('0x6f')]){_0x29bcfb[_0x8945('0x6f')]=JSON[_0x8945('0x69')](Mustache['render'](JSON['stringify'](_0x29bcfb[_0x8945('0x6f')]),_0x15a716,{},['$$','$$']));}if(_0x29bcfb[_0x8945('0x68')]){_0x29bcfb[_0x8945('0x68')]=JSON[_0x8945('0x69')](Mustache[_0x8945('0x6e')](JSON[_0x8945('0x70')](_0x29bcfb[_0x8945('0x68')]),_0x15a716,{},['$$','$$']));}}catch(_0x3d80d1){logger[_0x8945('0x27')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3d80d1);}}rp(_0x29bcfb)[_0x8945('0x11')](function(_0x50ca21){var _0x45d5d6={'statusCode':_0x50ca21[_0x8945('0x71')]||0xc8,'statusMessage':_0x50ca21[_0x8945('0x72')]||'OK','headers':_0x50ca21['headers']||{},'body':_0x50ca21['body']||{}};_0x1a7243(null,_0x45d5d6);})[_0x8945('0x13')](function(_0x4b631f){var _0x5286fb={'statusCode':_0x4b631f[_0x8945('0x71')]||0x1f4,'statusMessage':_0x4b631f[_0x8945('0x73')]||_0x8945('0x74'),'headers':_0x4b631f[_0x8945('0x75')][_0x8945('0x6f')]||{},'body':_0x4b631f[_0x8945('0x75')]['body']||{}};_0x1a7243(null,_0x5286fb);});};AGIVertices['prototype']['googleDialogflow']=function(_0x3b4350,_0x4ab9a8){scripts['googleDialogflow'](this[_0x8945('0xd')][_0x8945('0x34')],_0x3b4350[_0x8945('0x76')],_0x3b4350[_0x8945('0x58')],_0x3b4350[_0x8945('0x77')]||'en')['then'](function(_0x3cb9bf){_0x4ab9a8(null,_0x3cb9bf);})[_0x8945('0x13')](function(_0x24292a){_0x4ab9a8(_0x24292a);});};AGIVertices[_0x8945('0xf')]['googleDialogflowV2']=function(_0x311a28,_0x22dd5a){scripts[_0x8945('0x78')](this[_0x8945('0xd')][_0x8945('0x34')],_0x311a28[_0x8945('0x79')],_0x311a28[_0x8945('0x7a')],_0x311a28[_0x8945('0x7b')],_0x311a28[_0x8945('0x58')],_0x311a28[_0x8945('0x7c')]||'en')[_0x8945('0x11')](function(_0x11284b){_0x22dd5a(null,_0x11284b);})['catch'](function(_0x4ef5a2){_0x22dd5a(_0x4ef5a2);});};AGIVertices[_0x8945('0xf')][_0x8945('0x7d')]=function(_0x398471,_0xce7f3f){scripts['sestekNDA'](this[_0x8945('0xd')],_0x398471)[_0x8945('0x11')](function(_0x97d106){_0xce7f3f(null,_0x97d106);})[_0x8945('0x13')](function(_0x189a84){_0xce7f3f(_0x189a84);});};AGIVertices[_0x8945('0xf')]['ispeechTTS']=function(_0x15c2ab,_0x444c92){scripts[_0x8945('0x7e')](_0x15c2ab[_0x8945('0x76')],_0x15c2ab['text'],_0x15c2ab['ispeech_tts_language']||_0x8945('0x5a'),_0x15c2ab['speed'])['then'](function(_0x23547e){_0x444c92(null,_0x23547e);})['catch'](function(_0x44870a){_0x444c92(_0x44870a);});};AGIVertices['prototype'][_0x8945('0x7f')]=function(_0x481a29,_0x27f714,_0xa4890b){scripts[_0x8945('0x7f')](_0x27f714,_0x481a29[_0x8945('0x76')],_0x481a29[_0x8945('0x80')]||_0x8945('0x5a'),this[_0x8945('0x81')](_0x481a29['model'])?_0x481a29['model']:undefined)[_0x8945('0x11')](function(_0x20afa6){_0xa4890b(null,_0x20afa6);})['catch'](function(_0x2e8be6){_0xa4890b(_0x2e8be6);});};AGIVertices[_0x8945('0xf')][_0x8945('0x82')]=function(_0x3b199f,_0x411988){scripts[_0x8945('0x82')](_0x3b199f[_0x8945('0x83')],_0x3b199f[_0x8945('0x84')],_0x3b199f[_0x8945('0x85')],_0x3b199f[_0x8945('0x86')]||_0x8945('0x87'),_0x3b199f[_0x8945('0x58')],_0x3b199f[_0x8945('0x88')]||_0x8945('0x58'))[_0x8945('0x11')](function(_0x12ee22){_0x411988(null,_0x12ee22);})[_0x8945('0x13')](function(_0x50cbba){_0x411988(_0x50cbba);});};AGIVertices[_0x8945('0xf')][_0x8945('0x89')]=function(_0x29681a,_0x216a1b){scripts[_0x8945('0x89')](this[_0x8945('0xd')][_0x8945('0x34')],_0x29681a[_0x8945('0x83')],_0x29681a[_0x8945('0x84')],_0x29681a[_0x8945('0x8a')],_0x29681a[_0x8945('0x58')],_0x29681a[_0x8945('0x8b')])[_0x8945('0x11')](function(_0x312cd0){_0x216a1b(null,_0x312cd0);})[_0x8945('0x13')](function(_0x3626be){_0x216a1b(_0x3626be);});};AGIVertices[_0x8945('0xf')]['googleASR']=function(_0x2b7fc4,_0x59834e,_0x5581d0){scripts[_0x8945('0x8c')](_0x59834e,_0x2b7fc4[_0x8945('0x76')],_0x2b7fc4['google_asr_language']||'en-US')[_0x8945('0x11')](function(_0x12256a){_0x5581d0(null,_0x12256a);})[_0x8945('0x13')](function(_0x1e1ccd){_0x5581d0(_0x1e1ccd);});};AGIVertices[_0x8945('0xf')][_0x8945('0x8d')]=function(_0x404bba,_0x2d2b75,_0x367d58){scripts['tildeASR'](_0x2d2b75,_0x404bba['appid'],_0x404bba[_0x8945('0x8e')],_0x404bba[_0x8945('0x6d')])[_0x8945('0x11')](function(_0x7f16a){_0x367d58(null,_0x7f16a);})[_0x8945('0x13')](function(_0x563226){_0x367d58(_0x563226);});};AGIVertices['prototype']['clear']=function(_0x5078a1){var _0x2e07bb=_[_0x8945('0x65')](verticesWithRetry,_0x5078a1[_0x8945('0x8f')])?_0x5078a1:_[_0x8945('0x90')](_0x5078a1);for(var _0x82bcb7 in _0x2e07bb){if(_0x2e07bb[_0x8945('0x91')](_0x82bcb7)){if(_0x2e07bb[_0x82bcb7]&&_[_0x8945('0x92')](_0x2e07bb[_0x82bcb7])){if(_[_0x8945('0x65')](recursiveMapAttributes,_0x82bcb7)){_0x2e07bb[_0x82bcb7]=this[_0x8945('0x93')](_0x2e07bb[_0x82bcb7]);}else{_0x2e07bb[_0x82bcb7]=this[_0x8945('0x94')](_0x2e07bb[_0x82bcb7]);}}}}return _0x2e07bb;};AGIVertices[_0x8945('0xf')][_0x8945('0x95')]=function(_0x49d262){for(var _0x3bd10f in _0x49d262){if(_0x49d262[_0x8945('0x91')](_0x3bd10f)){if(_[_0x8945('0x96')](_0x49d262[_0x3bd10f])){this[_0x8945('0x95')](_0x49d262[_0x3bd10f]);}else if(_['isArray'](_0x49d262[_0x3bd10f])){for(var _0x925255=0x0;_0x925255<_0x49d262[_0x3bd10f]['length'];_0x925255++){this[_0x8945('0x95')](_0x49d262[_0x3bd10f][_0x925255]);}}else if(_[_0x8945('0x92')](_0x49d262[_0x3bd10f])){_0x49d262[_0x3bd10f]=this[_0x8945('0x94')](_0x49d262[_0x3bd10f]);}}}};AGIVertices[_0x8945('0xf')]['saveRestApiResult']=function(_0x31a077,_0x37ba5d){for(var _0x530025 in _0x31a077){if(_0x31a077[_0x8945('0x91')](_0x530025)){if(_[_0x8945('0x96')](_0x31a077[_0x530025])){if(!_[_0x8945('0x40')](_0x31a077[_0x530025])){this[_0x8945('0x97')](_0x31a077[_0x530025],util[_0x8945('0x51')]('%s.%s',_0x37ba5d,_0x530025));}}else if(_[_0x8945('0x98')](_0x31a077[_0x530025])){for(var _0x416925=0x0;_0x416925<_0x31a077[_0x530025][_0x8945('0x99')];_0x416925++){this[_0x8945('0x97')](_0x31a077[_0x530025][_0x416925],util[_0x8945('0x51')](_0x8945('0x9a'),_0x37ba5d,_0x530025+'['+_0x416925+']'));}}else{if(!_[_0x8945('0x44')](_0x31a077[_0x530025])){this[_0x8945('0xd')][_0x8945('0x9b')](util[_0x8945('0x51')]('%s.%s',_0x37ba5d,_0x530025),_0x31a077[_0x530025]);}}}}};AGIVertices['prototype'][_0x8945('0x93')]=function(_0x255e82){try{var _0x1456a6=JSON[_0x8945('0x69')](_0x255e82);this[_0x8945('0x95')](_0x1456a6);return JSON['stringify'](_0x1456a6);}catch(_0x230143){return this['replaceAllVariables'](_0x255e82);}};AGIVertices[_0x8945('0xf')]['replaceAllVariables']=function(_0x2a3c1d){var _0x4d3c38=_0x2a3c1d['split']('{');for(var _0x35309d=0x1;_0x35309d<_0x4d3c38[_0x8945('0x99')];_0x35309d+=0x1){var _0x36e01d=_0x4d3c38[_0x35309d][_0x8945('0x9c')]('}');if(_0x36e01d['length']>0x1){_0x2a3c1d=_0x2a3c1d[_0x8945('0x9d')]('{'+_0x36e01d[0x0]+'}',this[_0x8945('0xd')][_0x8945('0x10')](_0x36e01d[0x0])[_0x8945('0x9e')]||_0x36e01d[0x0]);}}if(_0x4d3c38[_0x8945('0x99')]===0x1){return _0x2a3c1d[_0x8945('0x48')]();}return this[_0x8945('0x94')](_0x2a3c1d);};AGIVertices[_0x8945('0xf')][_0x8945('0x9f')]=function(_0x55886d,_0x5ce934){var _0x8715cd=this[_0x8945('0xd')][_0x8945('0x10')](_0x55886d);if(_0x8715cd[_0x8945('0xa0')]===-0x1){return _0x8715cd;}logger['info'](util[_0x8945('0x51')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5ce934,_0x8715cd[_0x8945('0x9e')]));return this['channel'][_0x8945('0x9b')](_0x5ce934,_0x8715cd[_0x8945('0x9e')]);};AGIVertices[_0x8945('0xf')][_0x8945('0x81')]=function(_0x4bde77){return _0x4bde77&&_0x4bde77!=='0'&&_0x4bde77!=='-1'&&_0x4bde77!=='';};AGIVertices[_0x8945('0xf')]['maxRetry']=function(_0x15fe5b){this[_0x8945('0x33')][_0x8945('0xa1')](this,_0x15fe5b,'-');_0x15fe5b['retry']=_0x15fe5b[_0x8945('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8945('0xf')][_0x8945('0xa3')]=function(_0x8a99eb){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0xa4'),_0x8a99eb[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x8a99eb['text'])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0xa6'));}var _0x25f1e5='\x22'+_0x8a99eb[_0x8945('0x58')]+'\x22';if(this[_0x8945('0x81')](_0x8a99eb[_0x8945('0x75')])){_0x25f1e5+=','+_0x8a99eb[_0x8945('0x75')];}var _0x1d1677=this[_0x8945('0xd')][_0x8945('0xa7')](_0x8945('0xa8'),_0x25f1e5);if(_0x1d1677[_0x8945('0xa0')]===-0x1){return _0x1d1677;}return this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')]('Executed\x20command\x20MRCPSynth\x20%s',_0x25f1e5));};AGIVertices[_0x8945('0xf')][_0x8945('0xa9')]=function(_0x312ed6){logger['info'](util[_0x8945('0x51')](_0x8945('0xaa'),_0x312ed6[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x312ed6[_0x8945('0xab')])){return this[_0x8945('0xd')]['noop'](_0x8945('0xac'));}var _0x2ab191=_0x312ed6[_0x8945('0xab')];if(this['isConfigured'](_0x312ed6[_0x8945('0x75')])){_0x2ab191+=','+_0x312ed6[_0x8945('0x75')];}var _0xd5d262=this[_0x8945('0xd')][_0x8945('0xa7')](_0x8945('0xad'),_0x2ab191);if(_0xd5d262[_0x8945('0xa0')]===-0x1){return _0xd5d262;}var _0x4ee06f=this[_0x8945('0x9f')](_0x8945('0xae'),_0x8945('0xaf'));if(_0x4ee06f['result']===-0x1){return _0x4ee06f;}var _0x27f13f=this[_0x8945('0x9f')]('RECOG_INPUT()',_0x8945('0xb0'));if(_0x27f13f['result']===-0x1){return _0x27f13f;}var _0x3dbd21=this['getAndSetVariable'](_0x8945('0xb1'),_0x8945('0xb2'));if(_0x3dbd21['result']===-0x1){return _0x3dbd21;}return this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2ab191));};AGIVertices[_0x8945('0xf')][_0x8945('0x4')]=function(_0x2313cc){logger[_0x8945('0x29')](util[_0x8945('0x51')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x2313cc['label']));return this[_0x8945('0xd')]['agi']([_0x2313cc[_0x8945('0xb3')],_0x2313cc[_0x8945('0xb4')]]);};AGIVertices[_0x8945('0xf')]['answer']=function(_0x150e93){logger[_0x8945('0x29')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x150e93['label']));if(this[_0x8945('0x81')](_0x150e93['timeout'])){logger['info'](util[_0x8945('0x51')](_0x8945('0xb5'),_0x150e93[_0x8945('0x64')]));var _0x4e7799=this[_0x8945('0xd')]['wait'](_0x150e93[_0x8945('0x64')]);if(_0x4e7799[_0x8945('0xa0')]===-0x1){return _0x4e7799;}}return this[_0x8945('0xd')]['answer']();};AGIVertices['prototype'][_0x8945('0x46')]=function(_0x74100a){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0xb6'),_0x74100a[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x74100a[_0x8945('0xb7')])){return this[_0x8945('0xd')][_0x8945('0x27')](_0x74100a,_0x8945('0xb8'));}_0x74100a[_0x8945('0x45')]=moment();if(this[_0x8945('0x81')](_0x74100a[_0x8945('0xb9')])){_0x74100a[_0x8945('0x45')]=moment()[_0x8945('0xba')](_0x74100a[_0x8945('0xb9')],_0x8945('0xbb'));}if(!this[_0x8945('0x81')](_0x74100a[_0x8945('0x49')])){_0x74100a['callback_priority']=0x2;}this[_0x8945('0xbc')][_0x8945('0xa1')](this,_0x74100a);return this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x74100a[_0x8945('0xbd')],_0x74100a[_0x8945('0xb7')],_0x74100a[_0x8945('0x45')]));};AGIVertices['prototype']['custom_app']=function(_0x4d9624){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0xbe'),_0x4d9624['label']));var _0x1a65a7=this[_0x8945('0xd')][_0x8945('0xa7')](_0x4d9624[_0x8945('0xbf')],_0x4d9624[_0x8945('0x75')]);if(_0x1a65a7[_0x8945('0xa0')]===-0x1){return _0x1a65a7;}return this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')]('Executed\x20command\x20%s\x20%s',_0x4d9624[_0x8945('0xbf')],_0x4d9624[_0x8945('0x75')]));};AGIVertices[_0x8945('0xf')][_0x8945('0xc0')]=function(_0x59daf1){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0xc1'),_0x59daf1[_0x8945('0x35')]));if(!this['isConfigured'](_0x59daf1[_0x8945('0x58')])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0xa6'));}var _0x5181d8='\x22'+_0x59daf1[_0x8945('0x58')]+'\x22';if(this['isConfigured'](_0x59daf1[_0x8945('0x75')])){_0x5181d8+=','+_0x59daf1[_0x8945('0x75')];}var _0x2b1631=this[_0x8945('0xd')][_0x8945('0xa7')]('MRCPSynth',_0x5181d8);if(_0x2b1631[_0x8945('0xa0')]===-0x1){return _0x2b1631;}return this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5181d8));};AGIVertices['prototype'][_0x8945('0xc2')]=function(_0x2c0cc4){logger['info'](util['format'](_0x8945('0xc3'),_0x2c0cc4[_0x8945('0x35')]));if(!this['isConfigured'](_0x2c0cc4[_0x8945('0x58')])){return this['channel']['noop'](_0x8945('0xa6'));}var _0x3f4887='\x22'+_0x2c0cc4['text']+'\x22';if(this[_0x8945('0x81')](_0x2c0cc4[_0x8945('0x75')])){_0x3f4887+=','+_0x2c0cc4[_0x8945('0x75')];}var _0x47d6ac=this[_0x8945('0xd')][_0x8945('0xa7')](_0x8945('0xa8'),_0x3f4887);if(_0x47d6ac[_0x8945('0xa0')]===-0x1){return _0x47d6ac;}return this[_0x8945('0xd')][_0x8945('0xa5')](util['format'](_0x8945('0xc4'),_0x3f4887));};AGIVertices[_0x8945('0xf')]['lumenvoxasr']=function(_0x39b542){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0xc5'),_0x39b542[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x39b542['grammar'])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0xac'));}var _0x90f602=_0x39b542[_0x8945('0xab')];if(this['isConfigured'](_0x39b542[_0x8945('0x75')])){_0x90f602+=','+_0x39b542['options'];}var _0x386823=this[_0x8945('0xd')][_0x8945('0xa7')](_0x8945('0xad'),_0x90f602);if(_0x386823[_0x8945('0xa0')]===-0x1){return _0x386823;}var _0x24162c=this[_0x8945('0x9f')](_0x8945('0xae'),_0x8945('0xc6'));if(_0x24162c[_0x8945('0xa0')]===-0x1){return _0x24162c;}var _0xd74980=this[_0x8945('0x9f')](_0x8945('0xc7'),_0x8945('0xc8'));if(_0xd74980[_0x8945('0xa0')]===-0x1){return _0xd74980;}var _0x373501=this[_0x8945('0x9f')](_0x8945('0xb1'),_0x8945('0xc9'));if(_0x373501[_0x8945('0xa0')]===-0x1){return _0x373501;}return this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')]('Executed\x20command\x20MRCPRecog\x20%s',_0x90f602));};AGIVertices['prototype'][_0x8945('0xca')]=function(_0x4c2715){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0xcb'),_0x4c2715[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x4c2715['grammar'])){return this[_0x8945('0xd')]['noop'](_0x8945('0xac'));}var _0x51a28f=_0x4c2715[_0x8945('0xab')];if(this[_0x8945('0x81')](_0x4c2715[_0x8945('0x75')])){_0x51a28f+=','+_0x4c2715[_0x8945('0x75')];}var _0x48e451=this[_0x8945('0xd')][_0x8945('0xa7')](_0x8945('0xad'),_0x51a28f);if(_0x48e451[_0x8945('0xa0')]===-0x1){return _0x48e451;}var _0x3be17d=this[_0x8945('0x9f')](_0x8945('0xae'),'SESTEK_ASR_CONFIDENCE');if(_0x3be17d[_0x8945('0xa0')]===-0x1){return _0x3be17d;}var _0x4fee5f=this[_0x8945('0x9f')](_0x8945('0xc7'),'SESTEK_ASR_TRANSCRIPT');if(_0x4fee5f[_0x8945('0xa0')]===-0x1){return _0x4fee5f;}var _0x41baa0=this[_0x8945('0x9f')](_0x8945('0xb1'),_0x8945('0xcc'));if(_0x41baa0[_0x8945('0xa0')]===-0x1){return _0x41baa0;}return this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0xcd'),_0x51a28f));};AGIVertices[_0x8945('0xf')]['database']=function(_0x3b96cf){logger['info'](util['format'](_0x8945('0xce'),_0x3b96cf[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x3b96cf[_0x8945('0xcf')])){return this['channel'][_0x8945('0x27')](_0x3b96cf,_0x8945('0xd0'));}var _0x4124fe=this['getSquareOdbc'][_0x8945('0xa1')](this,_0x3b96cf[_0x8945('0xcf')]);if(!_0x4124fe){return this[_0x8945('0xd')][_0x8945('0x27')](_0x3b96cf,_0x8945('0xd1'));}if(!this['isConfigured'](_0x3b96cf[_0x8945('0x2b')])){return this[_0x8945('0xd')][_0x8945('0x27')](_0x3b96cf,'no\x20query\x20configured');}var _0x20f1aa=_0x3b96cf[_0x8945('0x2b')][_0x8945('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8945('0xd')]['noop'](util['format'](_0x8945('0xd2'),_0x20f1aa));var _0x13df19=this[_0x8945('0x26')]['sync'](this,_0x4124fe,_0x20f1aa);this[_0x8945('0x33')][_0x8945('0xa1')](this,_0x3b96cf,_0x20f1aa);if(!this[_0x8945('0x81')](_0x3b96cf['variable_id'])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0xd3'));}var _0x34f528=this[_0x8945('0x10')][_0x8945('0xa1')](this,_0x3b96cf[_0x8945('0xd4')]);if(!_0x34f528){return this[_0x8945('0xd')][_0x8945('0x27')](_0x3b96cf,_0x8945('0xd5'));}var _0x46f46c=this;_0x13df19[_0x8945('0xd6')](function(_0x43ac67,_0x452856){Object['keys'](_0x43ac67)[_0x8945('0xd6')](function(_0x45f8b9){_0x46f46c[_0x8945('0xd')][_0x8945('0x9b')](util[_0x8945('0x51')](_0x8945('0xd7'),_0x34f528,_0x452856,_0x45f8b9),_0x43ac67[_0x45f8b9]);});});this[_0x8945('0xd')][_0x8945('0x9b')](util[_0x8945('0x51')](_0x8945('0xd8'),_0x34f528),_0x13df19[_0x8945('0x99')]);return this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0xd9'),_0x34f528));};AGIVertices['prototype'][_0x8945('0xda')]=function(_0x26d907){logger['debug'](util[_0x8945('0x51')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x26d907['label']));if(!this[_0x8945('0x81')](_0x26d907[_0x8945('0xdb')])){return this[_0x8945('0xd')]['error'](_0x26d907,_0x8945('0xdc'));}var _0xea1fd3=this[_0x8945('0xdd')][_0x8945('0xa1')](this,_0x26d907[_0x8945('0xdb')]);if(!_0xea1fd3){return this['channel'][_0x8945('0x27')](_0x26d907,_0x8945('0xde'));}var _0x4105e5=this[_0x8945('0xd')][_0x8945('0xa7')](_0x8945('0xdf'),[util[_0x8945('0x51')](_0x8945('0xe0'),_0xea1fd3),_0x26d907[_0x8945('0x64')],_0x26d907['opts'],_0x26d907[_0x8945('0x62')]]);if(_0x4105e5[_0x8945('0xa0')]===-0x1){return _0x4105e5;}return this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')](_0x8945('0xe1'),_0x8945('0xdf')));};AGIVertices['prototype']['dialogflow']=function(_0x1efe2c){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0xe2'),_0x1efe2c['label']));if(!this[_0x8945('0x81')](_0x1efe2c['key'])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0xe3'));}if(!this['isConfigured'](_0x1efe2c[_0x8945('0x58')])){return this[_0x8945('0xd')][_0x8945('0xa5')]('no\x20text\x20configured');}this['channel'][_0x8945('0xe4')]=!![];this[_0x8945('0x33')](_0x1efe2c);this[_0x8945('0x3f')](_0x1efe2c[_0x8945('0x58')],'in','','');this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')]('Trying\x20Dialogflow:\x20%s',_0x1efe2c[_0x8945('0x58')]));var _0x5912d9=this[_0x8945('0xe5')][_0x8945('0xa1')](this,_0x1efe2c);if(_0x5912d9){for(var _0x13f884 in _0x5912d9){if(_0x5912d9['hasOwnProperty'](_0x13f884)){this[_0x8945('0xd')][_0x8945('0x9b')](util[_0x8945('0x51')](_0x8945('0xe6'),_0x13f884['toUpperCase']()),_0x5912d9[_0x13f884]);}}this[_0x8945('0x3f')](_0x5912d9[_0x8945('0xe7')],_0x8945('0xe8'),'dialogflow','');return this['channel'][_0x8945('0xa5')](util['format'](_0x8945('0xe9'),_0x5912d9[_0x8945('0xe7')]));}return this[_0x8945('0xd')][_0x8945('0x27')](_0x1efe2c,_0x8945('0xea'));};AGIVertices['prototype'][_0x8945('0xeb')]=function(_0x175c6d){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0xec'),_0x175c6d[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x175c6d['dialogflowV2_project_id'])){return this['channel'][_0x8945('0xa5')](_0x8945('0xed'));}if(!this[_0x8945('0x81')](_0x175c6d['client_email'])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0xee'));}if(!this[_0x8945('0x81')](_0x175c6d[_0x8945('0x7b')])){return this['channel']['noop']('no\x20private_key\x20configured');}if(!this[_0x8945('0x81')](_0x175c6d[_0x8945('0x7c')])){return this['channel'][_0x8945('0xa5')](_0x8945('0xef'));}if(!this[_0x8945('0x81')](_0x175c6d[_0x8945('0x58')])){return this['channel'][_0x8945('0xa5')](_0x8945('0xa6'));}this[_0x8945('0xd')][_0x8945('0xe4')]=!![];this[_0x8945('0x33')](_0x175c6d);this[_0x8945('0x3f')](_0x175c6d['text'],'in','','');this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0xf0'),_0x175c6d[_0x8945('0x58')]));var _0x3a1854=this[_0x8945('0x78')][_0x8945('0xa1')](this,_0x175c6d);if(_0x3a1854){for(var _0x150836 in _0x3a1854){if(_0x3a1854[_0x8945('0x91')](_0x150836)){if(_0x150836!=='providerResponse'){this['channel']['setVariable'](util[_0x8945('0x51')](_0x8945('0xe6'),_0x150836[_0x8945('0x67')]()),_0x3a1854[_0x150836]);}}}this[_0x8945('0x3f')](_0x3a1854[_0x8945('0xe7')],_0x8945('0xe8'),_0x8945('0xeb'),_0x3a1854[_0x8945('0xf1')]);return this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')](_0x8945('0xf2'),_0x3a1854[_0x8945('0xe7')]));}return this[_0x8945('0xd')][_0x8945('0x27')](_0x175c6d,_0x8945('0xf3'));};AGIVertices[_0x8945('0xf')][_0x8945('0xf4')]=function(_0x108d94){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0xf5'),_0x108d94[_0x8945('0x35')]));if(!this['isConfigured'](_0x108d94['ndauth_url'])){return this[_0x8945('0xd')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0x8945('0x81')](_0x108d94[_0x8945('0xf6')])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0xf7'));}if(!this['isConfigured'](_0x108d94['password'])){return this[_0x8945('0xd')]['noop']('no\x20password\x20configured');}if(!this[_0x8945('0x81')](_0x108d94['ndassistant_url'])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0xa6'));}this[_0x8945('0xd')][_0x8945('0xe4')]=!![];this[_0x8945('0x33')](_0x108d94);this['createSquareMessage'](_0x108d94[_0x8945('0x58')],'in','','');this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')]('Trying\x20SestekNDA:\x20%s',_0x108d94[_0x8945('0x58')]));var _0x4b78af=this['sestekNDA'][_0x8945('0xa1')](this,_0x108d94);if(_0x4b78af){for(var _0x53d219 in _0x4b78af){if(_0x4b78af[_0x8945('0x91')](_0x53d219)){this[_0x8945('0xd')][_0x8945('0x9b')](util['format'](_0x8945('0xf8'),_0x53d219['toUpperCase']()),_0x4b78af[_0x53d219]);}}this[_0x8945('0x3f')](_0x4b78af[_0x8945('0xe7')],'out',_0x8945('0xf4'),'');if(_0x4b78af[_0x8945('0xf9')]){this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')](_0x8945('0xfa'),_0x4b78af['audiofile']));var _0x355189=this['channel'][_0x8945('0xfb')](_0x4b78af['audiofile']);try{fs['unlink'](_0x4b78af['audiofile']+_0x8945('0xfc'));}catch(_0x3a1262){logger['error'](_0x3a1262);}return _0x355189;}else{return this['channel'][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0xfd'),_0x4b78af[_0x8945('0xe7')]));}}return this[_0x8945('0xd')][_0x8945('0x27')](_0x108d94,_0x8945('0xfe'));};AGIVertices[_0x8945('0xf')][_0x8945('0xff')]=function(_0x2e8628){logger[_0x8945('0x29')](util[_0x8945('0x51')]('Enter\x20in\x20END\x20(%s)\x20block',_0x2e8628[_0x8945('0x35')]));return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0xff'));};AGIVertices[_0x8945('0xf')]['ext_dial']=function(_0x2eebb6){logger['info'](util[_0x8945('0x51')](_0x8945('0x100'),_0x2eebb6[_0x8945('0x35')]));var _0x8990f3='';if(_0x2eebb6[_0x8945('0x101')]){if(!this['isConfigured'](_0x2eebb6[_0x8945('0x101')])){return this[_0x8945('0xd')][_0x8945('0x27')](_0x2eebb6,_0x8945('0x102'));}else{var _0x4a5024=parseInt(_0x2eebb6['trunk_id'],0xa);if(isNaN(_0x4a5024)){_0x8990f3=_0x2eebb6[_0x8945('0x101')];}else{_0x8990f3=this[_0x8945('0x1a')]['sync'](this,_0x2eebb6[_0x8945('0x101')]);if(!_0x8990f3){return this['channel'][_0x8945('0x27')](_0x2eebb6,_0x8945('0x103'));}}}}else if(_0x2eebb6[_0x8945('0x104')]){_0x8990f3=_0x2eebb6['trunk_name'];}else{return this[_0x8945('0xd')][_0x8945('0x27')](_0x2eebb6,'no\x20trunk\x20selected');}var _0x48d7b4=this[_0x8945('0xd')][_0x8945('0xa7')]('DIAL',[util[_0x8945('0x51')]('SIP/%s/%s',_0x8990f3,_0x2eebb6[_0x8945('0xbd')]),_0x2eebb6[_0x8945('0x64')],_0x2eebb6[_0x8945('0x105')],_0x2eebb6[_0x8945('0x62')]]);if(_0x48d7b4[_0x8945('0xa0')]===-0x1){return _0x48d7b4;}return this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')](_0x8945('0xe1'),_0x8945('0xdf')));};AGIVertices['prototype'][_0x8945('0x106')]=function(_0xf65fe7){logger['info'](util[_0x8945('0x51')](_0x8945('0x107'),_0xf65fe7[_0x8945('0x35')]));return this['channel'][_0x8945('0xa5')](_0x8945('0x106'));};AGIVertices['prototype'][_0x8945('0x108')]=function(_0x361bfb){logger['info'](util[_0x8945('0x51')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x361bfb[_0x8945('0x35')]));if(_0x361bfb[_0x8945('0x109')]===0x0){return this['maxRetry'](_0x361bfb);}_0x361bfb[_0x8945('0x109')]-=0x1;if(!this[_0x8945('0x81')](_0x361bfb[_0x8945('0x10a')])){return this[_0x8945('0xd')][_0x8945('0x27')](_0x361bfb,_0x8945('0x10b'));}var _0x5ce12f=this['getSound'][_0x8945('0xa1')](this,_0x361bfb['file_id']);if(!_0x5ce12f){return this[_0x8945('0xd')][_0x8945('0x27')](_0x361bfb,'no\x20file\x20audio\x20found');}if(!this[_0x8945('0x81')](_0x361bfb[_0x8945('0xd4')])){return this[_0x8945('0xd')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4d5467=this[_0x8945('0xd')][_0x8945('0x10c')](_0x5ce12f,_0x361bfb[_0x8945('0x10d')],_0x361bfb[_0x8945('0x10e')]);var _0x33e793=_0x4d5467[_0x8945('0xa0')]?_0x4d5467[_0x8945('0xa0')][_0x8945('0x48')]():'';logger[_0x8945('0x29')](_0x8945('0x10f'),JSON['stringify'](_0x4d5467));if(_0x4d5467[_0x8945('0xa0')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x361bfb,_0x33e793);return _0x4d5467;}else if(_0x4d5467[_0x8945('0x9e')]==='timeout'){_0x4d5467[_0x8945('0xa0')]=_0x33e793[_0x8945('0x99')]>=parseInt(_0x361bfb['mindigit'])?'x':'i';}else{_0x4d5467['result']=_0x33e793['length']>=parseInt(_0x361bfb[_0x8945('0x110')])&&_0x33e793[_0x8945('0x99')]<=parseInt(_0x361bfb[_0x8945('0x10e')])?'x':'i';}var _0x4c3667=this[_0x8945('0x10')][_0x8945('0xa1')](this,_0x361bfb[_0x8945('0xd4')]);if(!_0x4c3667){return this['channel'][_0x8945('0x27')](_0x361bfb,'no\x20variable\x20found');}this['channel']['setVariable'](_0x4c3667,_0x33e793);if(this[_0x8945('0x81')](_0x361bfb[_0x8945('0x111')])){var _0xcffa00=parseInt(_0x361bfb['hiddendigitsnum'],0xa);var _0xd5264b=rs['generate']({'charset':'*','length':_0xcffa00});var _0x24f038=_0x33e793['length'];if(_0x24f038>0x0){if(_0x24f038>_0xcffa00){this[_0x8945('0x33')][_0x8945('0xa1')](this,_0x361bfb,_0x361bfb['hiddendigitspos']===_0x8945('0x112')?_0xd5264b+_0x33e793['substr'](_0xcffa00):_0x33e793[_0x8945('0x113')](0x0,_0x24f038-_0xcffa00)+_0xd5264b);}else{this[_0x8945('0x33')][_0x8945('0xa1')](this,_0x361bfb,rs[_0x8945('0x114')]({'charset':'*','length':_0x24f038}));}}else{this[_0x8945('0x33')]['sync'](this,_0x361bfb,'');}}else{this[_0x8945('0x33')]['sync'](this,_0x361bfb,_0x33e793);}return _0x4d5467;};AGIVertices[_0x8945('0xf')][_0x8945('0xc')]=function(_0x53f09e){logger['info'](util[_0x8945('0x51')](_0x8945('0x115'),_0x53f09e[_0x8945('0x35')]));return this[_0x8945('0x108')](_0x53f09e);};AGIVertices[_0x8945('0xf')][_0x8945('0x116')]=function(_0x41d630){logger[_0x8945('0x29')](util[_0x8945('0x51')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x41d630['label']));this[_0x8945('0x33')][_0x8945('0xa1')](this,_0x41d630,_0x41d630['goalname']);return this['channel'][_0x8945('0xa5')](util[_0x8945('0x51')]('GOAL\x20%s',_0x41d630[_0x8945('0x117')]));};AGIVertices[_0x8945('0xf')][_0x8945('0x118')]=function(_0x564f78){logger[_0x8945('0x29')](util[_0x8945('0x51')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x564f78[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x564f78[_0x8945('0x83')])||!this[_0x8945('0x81')](_0x564f78['aws_secret_access_key'])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0x119'));}if(!this[_0x8945('0x81')](_0x564f78[_0x8945('0x58')])){return this[_0x8945('0xd')][_0x8945('0xa5')]('no\x20text\x20configured');}this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0x11a'),_0x564f78[_0x8945('0x58')]));var _0xbf1d11=this['awsPolly'][_0x8945('0xa1')](this,_0x564f78);if(_0xbf1d11){this[_0x8945('0xd')]['noop'](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0xbf1d11));var _0x10ef17=this[_0x8945('0xd')]['streamFile'](_0xbf1d11);try{fs[_0x8945('0x11b')](_0xbf1d11+_0x8945('0xfc'));}catch(_0x4d2165){logger[_0x8945('0x27')](_0x4d2165);}return _0x10ef17;}return this[_0x8945('0xd')][_0x8945('0x27')](_0x564f78,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x8945('0xf')][_0x8945('0x11c')]=function(_0x2f53fd){logger['info'](util['format'](_0x8945('0x11d'),_0x2f53fd[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x2f53fd['aws_access_key_id'])||!this[_0x8945('0x81')](_0x2f53fd[_0x8945('0x84')])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0x119'));}if(!this['isConfigured'](_0x2f53fd[_0x8945('0x8b')])){return this[_0x8945('0xd')][_0x8945('0xa5')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x2f53fd[_0x8945('0x58')])){return this[_0x8945('0xd')]['noop'](_0x8945('0xa6'));}this[_0x8945('0xd')][_0x8945('0xe4')]=!![];this[_0x8945('0x33')](_0x2f53fd);this[_0x8945('0x3f')](_0x2f53fd['text'],'in','','');this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')]('Trying\x20Amazon\x20Lex:\x20%s',_0x2f53fd[_0x8945('0x58')]));var _0x41d27d=this[_0x8945('0x89')][_0x8945('0xa1')](this,_0x2f53fd);if(_0x41d27d){for(var _0x45ea38 in _0x41d27d){if(_0x41d27d[_0x8945('0x91')](_0x45ea38)&&_[_0x8945('0x92')](_0x41d27d[_0x45ea38])){this[_0x8945('0xd')][_0x8945('0x9b')](util['format']('AWS_LEX_%s',_0x45ea38[_0x8945('0x67')]()),_0x41d27d[_0x45ea38]);}}if(_['isNil'](_0x41d27d['message'])){return this['channel'][_0x8945('0xa5')](_0x8945('0x11e'));}else{this[_0x8945('0x3f')](_0x41d27d[_0x8945('0x73')],_0x8945('0xe8'),_0x8945('0x11f'),'');return this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0x120'),_0x41d27d['message']));}}return this['channel'][_0x8945('0x27')](_0x2f53fd,_0x8945('0x121'));};AGIVertices[_0x8945('0xf')][_0x8945('0x122')]=function(_0x49334b){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x123'),_0x49334b[_0x8945('0x35')],_0x49334b['timeout']));if(!this[_0x8945('0x81')](_0x49334b['key'])){return this['channel'][_0x8945('0xa5')](_0x8945('0xe3'));}var _0x199b27=_0x8945('0x124');var _0x418ea=util[_0x8945('0x51')](_0x8945('0x125'),FILES_PATH,rs[_0x8945('0x114')](0x4));var _0xd9656e=util[_0x8945('0x51')]('%s.%s',_0x418ea,_0x199b27);var _0x359ef9=!![];if(_0x49334b[_0x8945('0x126')]==='NOBEEP'){_0x359ef9=![];}var _0x844839=this[_0x8945('0xd')]['recordFile'](_0x418ea,_0x199b27,_0x49334b[_0x8945('0x127')],_0x49334b[_0x8945('0x64')],undefined,_0x359ef9);if(_0x844839[_0x8945('0xa0')]!==-0x1){this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')](_0x8945('0x128'),_0xd9656e));var _0x1093e7=this[_0x8945('0x8c')][_0x8945('0xa1')](this,_0x49334b,_0xd9656e);if(_0x1093e7){for(var _0x3be4ce in _0x1093e7){if(_0x1093e7[_0x8945('0x91')](_0x3be4ce)){this[_0x8945('0xd')][_0x8945('0x9b')](util[_0x8945('0x51')](_0x8945('0x129'),_0x3be4ce['toUpperCase']()),_0x1093e7[_0x3be4ce]);}}return this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0x12a'),JSON[_0x8945('0x70')](_0x1093e7)));}}return _0x844839;};AGIVertices[_0x8945('0xf')][_0x8945('0x12b')]=function(_0x25f11d){logger[_0x8945('0x29')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x25f11d['label']));if(!this['isConfigured'](_0x25f11d['appid'])){return this[_0x8945('0xd')][_0x8945('0xa5')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x25f11d[_0x8945('0x8e')])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0x12c'));}var _0x337919=_0x8945('0x124');var _0x384722=util['format'](_0x8945('0x125'),FILES_PATH,rs[_0x8945('0x114')](0x4));var _0x4f02a0=util[_0x8945('0x51')](_0x8945('0x9a'),_0x384722,_0x337919);var _0x3a9d85=!![];if(_0x25f11d['beep']===_0x8945('0x12d')){_0x3a9d85=![];}var _0x42533d=this[_0x8945('0xd')][_0x8945('0x12e')](_0x384722,_0x337919,_0x25f11d[_0x8945('0x127')],_0x25f11d['timeout'],undefined,_0x3a9d85);if(_0x42533d[_0x8945('0xa0')]!==-0x1){this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')](_0x8945('0x12f'),_0x4f02a0));var _0x23b519=this[_0x8945('0x8d')]['sync'](this,_0x25f11d,_0x4f02a0);if(_0x23b519){for(var _0x30cc62 in _0x23b519){if(_0x23b519[_0x8945('0x91')](_0x30cc62)){this[_0x8945('0xd')][_0x8945('0x9b')](util['format']('TILDE_ASR_%s',_0x30cc62['toUpperCase']()),_0x23b519[_0x30cc62]);}}return this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0x130'),JSON[_0x8945('0x70')](_0x23b519)));}}return _0x42533d;};AGIVertices[_0x8945('0xf')][_0x8945('0x131')]=function(_0x2b3e58){logger[_0x8945('0x29')](util['format'](_0x8945('0x132'),_0x2b3e58['label']));return this['channel'][_0x8945('0x133')](_0x2b3e58[_0x8945('0x3a')],_0x2b3e58[_0x8945('0x3b')],_0x2b3e58[_0x8945('0x3c')]);};AGIVertices[_0x8945('0xf')][_0x8945('0x134')]=function(_0x1c6a5f){logger[_0x8945('0x29')](util['format'](_0x8945('0x135'),_0x1c6a5f[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x1c6a5f[_0x8945('0x136')])){return this[_0x8945('0xd')][_0x8945('0x27')](_0x1c6a5f,_0x8945('0x137'));}try{var _0x5ac39f=eval(_0x1c6a5f[_0x8945('0x136')])?_0x8945('0x138'):_0x8945('0x139');this['channel'][_0x8945('0xa5')](util[_0x8945('0x51')]('EVAL\x20CONDITION\x20%s\x20%s',_0x1c6a5f['condition'],_0x5ac39f));return{'code':0xc8,'result':_0x5ac39f};}catch(_0xb228ee){return{'code':0xc8,'result':_0x8945('0x139')};}};AGIVertices[_0x8945('0xf')][_0x8945('0x13a')]=function(_0x393869){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x13b'),_0x393869['label']));if(!this[_0x8945('0x81')](_0x393869[_0x8945('0x13c')])){return this['channel'][_0x8945('0x27')](_0x393869,_0x8945('0x13d'));}var _0x122989=this[_0x8945('0x13e')][_0x8945('0xa1')](this,_0x393869['interval_id']);if(!_0x122989){return this[_0x8945('0xd')][_0x8945('0x27')](_0x393869,'no\x20intervals\x20found');}for(var _0x34019c=0x0;_0x34019c<_0x122989[_0x8945('0x99')];_0x34019c+=0x1){var _0x42f34e=this[_0x8945('0xd')][_0x8945('0x10')](util[_0x8945('0x51')](_0x8945('0x13f'),_0x122989[_0x34019c]));if(_0x42f34e[_0x8945('0xa0')]===-0x1){return _0x42f34e;}logger[_0x8945('0x29')](util[_0x8945('0x51')]('IFTIME\x20%s\x20%s',_0x122989[_0x34019c],_0x42f34e['extra']));if(_0x42f34e[_0x8945('0x9e')]===_0x8945('0x138')){logger['info'](util[_0x8945('0x51')](_0x8945('0x140'),_0x122989[_0x34019c],_0x8945('0x138')));this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0x140'),_0x122989[_0x34019c],_0x8945('0x138')));return{'code':0xc8,'result':_0x8945('0x138')};}else{logger['info'](util[_0x8945('0x51')]('IFTIME\x20%s\x20%s',_0x122989[_0x34019c],_0x8945('0x139')));this[_0x8945('0xd')][_0x8945('0xa5')](util['format'](_0x8945('0x140'),_0x122989[_0x34019c],_0x8945('0x139')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype']['hangup']=function(_0x3bc0ae){logger['info'](util[_0x8945('0x51')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3bc0ae['label']));return this['channel'][_0x8945('0x141')]();};AGIVertices[_0x8945('0xf')][_0x8945('0x142')]=function(_0x2bfc9c){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x143'),_0x2bfc9c[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x2bfc9c[_0x8945('0x76')])){return this['channel'][_0x8945('0xa5')](_0x8945('0xe3'));}var _0x3a3aac='wav';var _0x18ab7a=util[_0x8945('0x51')]('%s/recordings/%s',FILES_PATH,rs[_0x8945('0x114')](0x4));var _0x5ec5ee=util['format']('%s.%s',_0x18ab7a,_0x3a3aac);var _0x351c8c=!![];if(_0x2bfc9c[_0x8945('0x126')]==='NOBEEP'){_0x351c8c=![];}var _0x2467d5=this[_0x8945('0xd')][_0x8945('0x12e')](_0x18ab7a,_0x3a3aac,_0x2bfc9c['intKey'],_0x2bfc9c[_0x8945('0x64')],undefined,_0x351c8c);if(_0x2467d5[_0x8945('0xa0')]!==-0x1){this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')](_0x8945('0x144'),_0x5ec5ee));var _0x29a938=this[_0x8945('0x7f')][_0x8945('0xa1')](this,_0x2bfc9c,_0x5ec5ee);if(_0x29a938){for(var _0x37b267 in _0x29a938){if(_0x29a938[_0x8945('0x91')](_0x37b267)){this[_0x8945('0xd')][_0x8945('0x9b')](util['format'](_0x8945('0x145'),_0x37b267[_0x8945('0x67')]()),_0x29a938[_0x37b267]);}}return this['channel'][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0x146'),JSON[_0x8945('0x70')](_0x29a938)));}}return _0x2467d5;};AGIVertices[_0x8945('0xf')][_0x8945('0x147')]=function(_0x74dadd){logger['info'](util[_0x8945('0x51')](_0x8945('0x148'),_0x74dadd['label']));if(!this[_0x8945('0x81')](_0x74dadd[_0x8945('0x76')])){return this['channel'][_0x8945('0xa5')](_0x8945('0xe3'));}if(!this[_0x8945('0x81')](_0x74dadd[_0x8945('0x58')])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0xa6'));}this['channel'][_0x8945('0xa5')](util[_0x8945('0x51')]('Trying\x20ispeech\x20TTS\x20%s',_0x74dadd[_0x8945('0x58')]));var _0x52b756=this['ispeechTTS'][_0x8945('0xa1')](this,_0x74dadd);if(_0x52b756){this[_0x8945('0xd')][_0x8945('0xa5')](util['format'](_0x8945('0x144'),_0x52b756));var _0x8cabb0=this[_0x8945('0xd')]['streamFile'](_0x52b756,_0x74dadd[_0x8945('0x127')]);try{fs[_0x8945('0x11b')](_0x52b756+_0x8945('0xfc'));}catch(_0x380a13){logger['error'](_0x380a13);}return _0x8cabb0;}return this['channel'][_0x8945('0x27')](_0x74dadd,_0x8945('0x149'));};AGIVertices[_0x8945('0xf')][_0x8945('0x14a')]=function(_0x194350){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x14b'),_0x194350[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x194350[_0x8945('0x14c')])){return this[_0x8945('0xd')][_0x8945('0x27')](_0x194350,_0x8945('0x14d'));}logger['info'](util[_0x8945('0x51')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8945('0xd')][_0x8945('0x37')],_0x194350[_0x8945('0x14c')]));var _0x308ee6=this[_0x8945('0x4f')][_0x8945('0xa1')](this,_0x194350[_0x8945('0x14c')]);if(_0x308ee6){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x14e'),this[_0x8945('0xd')]['callerid'],_0x194350[_0x8945('0x14c')]));this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')](_0x8945('0x14e'),this['channel'][_0x8945('0x37')],_0x194350['findBy']));return{'code':0xc8,'result':_0x8945('0x14f')};}else{logger['info'](util[_0x8945('0x51')](_0x8945('0x150'),this[_0x8945('0xd')]['callerid'],_0x194350['findBy']));this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')](_0x8945('0x150'),this[_0x8945('0xd')][_0x8945('0x37')],_0x194350['findBy']));return{'code':0xc8,'result':_0x8945('0x151')};}};AGIVertices[_0x8945('0xf')][_0x8945('0x152')]=function(_0x278bf3){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x153'),_0x278bf3['label']));if(!this[_0x8945('0x81')](_0x278bf3[_0x8945('0x14c')])){return this[_0x8945('0xd')][_0x8945('0x27')](_0x278bf3,_0x8945('0x14d'));}logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x154'),this['channel'][_0x8945('0x37')],_0x278bf3[_0x8945('0x14c')]));var _0x46a796=this['agentLogout'][_0x8945('0xa1')](this,_0x278bf3[_0x8945('0x14c')]);if(_0x46a796){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x14e'),this[_0x8945('0xd')][_0x8945('0x37')],_0x278bf3['findBy']));this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0x14e'),this['channel'][_0x8945('0x37')],_0x278bf3['findBy']));return{'code':0xc8,'result':_0x8945('0x14f')};}else{logger['info'](util[_0x8945('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8945('0xd')][_0x8945('0x37')],_0x278bf3['findBy']));this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x8945('0x37')],_0x278bf3[_0x8945('0x14c')]));return{'code':0xc8,'result':_0x8945('0x151')};}};AGIVertices[_0x8945('0xf')]['math']=function(_0x3f2992){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x155'),_0x3f2992[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x3f2992[_0x8945('0x156')])){return this['channel'][_0x8945('0x27')](_0x3f2992,_0x8945('0x157'));}this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')]('math\x20%s',_0x3f2992[_0x8945('0x156')]));var _0x3a087f=eval(_0x3f2992['operation']);if(!this[_0x8945('0x81')](_0x3f2992[_0x8945('0xd4')])){return this['channel']['noop'](_0x8945('0xd3'));}var _0x599c60=this['getVariable'][_0x8945('0xa1')](this,_0x3f2992[_0x8945('0xd4')]);if(!_0x599c60){return this[_0x8945('0xd')][_0x8945('0x27')](_0x3f2992,_0x8945('0xd5'));}if(_[_0x8945('0x98')](_0x3a087f)){var _0x4ca97e=this;_0x3a087f[_0x8945('0xd6')](function(_0xf184e4,_0x399f8c){_0x4ca97e['channel'][_0x8945('0x9b')](util['format'](_0x8945('0x158'),_0x599c60,_0x399f8c),_0xf184e4);});return this['channel'][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0x159'),_0x599c60));}else{return this['channel'][_0x8945('0x9b')](_0x599c60,_0x3a087f);}};AGIVertices[_0x8945('0xf')][_0x8945('0xb')]=function(_0x2ecc49){logger['info'](util[_0x8945('0x51')](_0x8945('0x15a'),_0x2ecc49[_0x8945('0x35')]));if(_0x2ecc49[_0x8945('0x109')]===0x0){return this[_0x8945('0xa2')](_0x2ecc49);}_0x2ecc49['retry']-=0x1;if(!this[_0x8945('0x81')](_0x2ecc49[_0x8945('0x10a')])){return this['channel']['error'](_0x2ecc49,'no\x20file\x20audio\x20selected');}var _0x23e54a=this[_0x8945('0x1c')][_0x8945('0xa1')](this,_0x2ecc49['file_id']);if(!_0x23e54a){return this[_0x8945('0xd')][_0x8945('0x27')](_0x2ecc49,_0x8945('0x15b'));}var _0x3e91ca=this[_0x8945('0xd')][_0x8945('0x10c')](_0x23e54a,_0x2ecc49[_0x8945('0x10d')],_0x2ecc49[_0x8945('0x15c')]);var _0xb0165=_0x3e91ca[_0x8945('0xa0')];if(_0x3e91ca[_0x8945('0xa0')]===-0x1){this[_0x8945('0x33')][_0x8945('0xa1')](this,_0x2ecc49,'-1');return _0x3e91ca;}else if(_0x3e91ca['extra']===_0x8945('0x64')){_0x3e91ca[_0x8945('0xa0')]=_0x3e91ca[_0x8945('0xa0')]['length']>0x0?_0x3e91ca['result']:'t';}else if(_[_0x8945('0x40')](_0x3e91ca[_0x8945('0xa0')])){_0x3e91ca[_0x8945('0xa0')]='#';_0xb0165='#';}if(!this[_0x8945('0x81')](_0x2ecc49[_0x8945('0xd4')])){this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0xd3'));}else{var _0x329a5c=this[_0x8945('0x10')][_0x8945('0xa1')](this,_0x2ecc49['variable_id']);if(!_0x329a5c){return this['channel']['error'](_0x2ecc49,'no\x20variable\x20found');}this[_0x8945('0xd')]['setVariable'](_0x329a5c,_0xb0165);}this['createSquareDetailsReport']['sync'](this,_0x2ecc49,_0xb0165);return _0x3e91ca;};AGIVertices['prototype']['noop']=function(_0x338a7e){logger[_0x8945('0x29')](util['format'](_0x8945('0x15d'),_0x338a7e[_0x8945('0x35')]));return this[_0x8945('0xd')][_0x8945('0xa5')](_0x338a7e[_0x8945('0x15e')]||_0x338a7e[_0x8945('0x35')]);};AGIVertices[_0x8945('0xf')][_0x8945('0x15f')]=function(_0x39334f){logger[_0x8945('0x29')](util[_0x8945('0x51')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x39334f[_0x8945('0x35')]));if(!this['isConfigured'](_0x39334f[_0x8945('0x14c')])){return this['channel'][_0x8945('0x27')](_0x39334f,_0x8945('0x14d'));}logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x154'),this[_0x8945('0xd')][_0x8945('0x37')],_0x39334f[_0x8945('0x14c')]));var _0xc92ff5=this[_0x8945('0x160')][_0x8945('0xa1')](this,_0x39334f[_0x8945('0x161')]);var _0x9ef56a=this[_0x8945('0x4b')][_0x8945('0xa1')](this,_0x39334f['findBy'],_0xc92ff5);if(_0x9ef56a){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x14e'),this[_0x8945('0xd')][_0x8945('0x37')],_0x39334f[_0x8945('0x14c')]));this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')](_0x8945('0x14e'),this[_0x8945('0xd')][_0x8945('0x37')],_0x39334f[_0x8945('0x14c')]));return{'code':0xc8,'result':_0x8945('0x14f')};}else{logger[_0x8945('0x29')](util[_0x8945('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8945('0xd')][_0x8945('0x37')],_0x39334f[_0x8945('0x14c')]));this['channel'][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0x14e'),this[_0x8945('0xd')][_0x8945('0x37')],_0x39334f[_0x8945('0x14c')]));return{'code':0xc8,'result':_0x8945('0x151')};}};AGIVertices[_0x8945('0xf')][_0x8945('0x162')]=function(_0x5b5843){logger[_0x8945('0x29')](util[_0x8945('0x51')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x5b5843[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x5b5843[_0x8945('0x10a')])){return this[_0x8945('0xd')][_0x8945('0x27')](_0x5b5843,_0x8945('0x10b'));}var _0x40facd=this[_0x8945('0x1c')][_0x8945('0xa1')](this,_0x5b5843[_0x8945('0x10a')]);if(!_0x40facd){return this[_0x8945('0xd')][_0x8945('0x27')](_0x5b5843,_0x8945('0x15b'));}var _0x5f31f1=this['channel'][_0x8945('0xa7')](_0x8945('0x163'),[_0x40facd,_0x5b5843[_0x8945('0x105')]]);if(_0x5f31f1[_0x8945('0xa0')]===-0x1){return _0x5f31f1;}return this[_0x8945('0xd')][_0x8945('0xa5')](util['format'](_0x8945('0x164'),_0x8945('0x163'),_0x40facd));};AGIVertices[_0x8945('0xf')][_0x8945('0x165')]=function(_0x21638a){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x166'),_0x21638a[_0x8945('0x35')]));if(!this['isConfigured'](_0x21638a['queue_id'])){return this[_0x8945('0xd')][_0x8945('0x27')](_0x21638a,'no\x20queue\x20selected');}var _0xfe2f4c='';var _0x10832c=parseInt(_0x21638a[_0x8945('0x167')],0xa);if(isNaN(_0x10832c)){_0xfe2f4c=_0x21638a['queue_id'];}else{_0xfe2f4c=this[_0x8945('0x168')]['sync'](this,_0x21638a['queue_id']);if(!_0xfe2f4c){return this['channel'][_0x8945('0x27')](_0x21638a,_0x8945('0x169'));}}var _0x2da5c4='';if(this[_0x8945('0x81')](_0x21638a['file_id'])){var _0x3c4e4b=this[_0x8945('0x1c')][_0x8945('0xa1')](this,_0x21638a['file_id']);if(_0x3c4e4b){_0x2da5c4=_0x3c4e4b;}}this[_0x8945('0x33')][_0x8945('0xa1')](this,_0x21638a,_0xfe2f4c);if(_0x21638a[_0x8945('0x105')][_0x8945('0x16a')]('x')<0x0){_0x21638a[_0x8945('0x105')]+='x';}if(_0x21638a[_0x8945('0x105')][_0x8945('0x16a')]('X')<0x0){_0x21638a[_0x8945('0x105')]+='X';}this[_0x8945('0xd')][_0x8945('0x9b')](_0x8945('0x16b'),_0xfe2f4c?_0xfe2f4c[_0x8945('0x16c')]():'');var _0x1c0ae5=this['channel'][_0x8945('0xa7')](_0x8945('0x16d'),[_0xfe2f4c,_0x21638a[_0x8945('0x105')],_0x21638a['url'],_0x2da5c4,_0x21638a[_0x8945('0x64')],_0x21638a[_0x8945('0x4')],_0x21638a[_0x8945('0x16e')],_0x21638a['gosub'],'',_0x21638a['position']]);if(_0x1c0ae5['result']===-0x1){return _0x1c0ae5;}return this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')]('Executed\x20command\x20%s\x20%s',_0x8945('0x16d'),_0xfe2f4c));};AGIVertices[_0x8945('0xf')]['record']=function(_0x3e7ad2){logger[_0x8945('0x29')](util[_0x8945('0x51')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x3e7ad2[_0x8945('0x35')]));var _0x51a21b=_0x3e7ad2[_0x8945('0x16f')]||_0x8945('0x124');var _0x188912=util[_0x8945('0x51')](_0x8945('0x170'),this[_0x8945('0xd')][_0x8945('0x34')],rs[_0x8945('0x114')](0x5));var _0x1aa410=util[_0x8945('0x51')](_0x8945('0x171'),FILES_PATH,_0x188912,_0x51a21b);var _0xd9810e=util[_0x8945('0x51')](_0x8945('0x125'),FILES_PATH,_0x188912);this[_0x8945('0x38')][_0x8945('0xa1')](this,_0x3e7ad2,_0x188912,_0x1aa410);this[_0x8945('0xd')][_0x8945('0x9b')]('RECORDING_SAVENAME',_0x188912);logger[_0x8945('0x29')](_0x8945('0x172'),_0xd9810e,_0x51a21b,_0x3e7ad2['escape_digits'],_0x3e7ad2[_0x8945('0x64')]);return this[_0x8945('0xd')][_0x8945('0x12e')](_0xd9810e,_0x51a21b,_0x3e7ad2[_0x8945('0x173')],_0x3e7ad2['timeout'],undefined,!![]);};AGIVertices[_0x8945('0xf')]['restapi']=function(_0x2b669c){logger['info'](util[_0x8945('0x51')](_0x8945('0x174'),_0x2b669c['label']));if(!this[_0x8945('0x81')](_0x2b669c[_0x8945('0x62')])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0x175'));}var _0x3b36af=this[_0x8945('0x61')][_0x8945('0xa1')](this,_0x2b669c);logger['info'](util[_0x8945('0x51')](_0x8945('0x176'),util[_0x8945('0x177')](_0x3b36af,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x2b669c[_0x8945('0xd4')])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0x178'));}var _0xb4c5b5=this[_0x8945('0x10')][_0x8945('0xa1')](this,_0x2b669c[_0x8945('0xd4')]);if(!_0xb4c5b5){return this['channel']['error'](_0x2b669c,_0x8945('0xd5'));}this['channel'][_0x8945('0x9b')](util['format']('%s_STATUS_CODE',_0xb4c5b5),_0x3b36af[_0x8945('0x71')]?_0x3b36af[_0x8945('0x71')]:_0x8945('0x179'));this[_0x8945('0xd')][_0x8945('0x9b')](util[_0x8945('0x51')]('%s_STATUS_MESSAGE',_0xb4c5b5),_0x3b36af[_0x8945('0x72')]?_0x3b36af[_0x8945('0x72')]:'OK');if(_0x3b36af[_0x8945('0x68')]){try{this[_0x8945('0x97')](_0x3b36af[_0x8945('0x68')],_0xb4c5b5);}catch(_0x1b1a21){logger[_0x8945('0x27')](util[_0x8945('0x51')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0xb4c5b5));}}return this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0xd9'),_0xb4c5b5));};AGIVertices[_0x8945('0xf')][_0x8945('0x17a')]=function(_0x25417b){logger[_0x8945('0x29')](util['format'](_0x8945('0x17b'),_0x25417b[_0x8945('0x35')]));return this[_0x8945('0xd')][_0x8945('0x17c')](_0x25417b[_0x8945('0x17d')]['replace'](/\s+/g,''),_0x25417b[_0x8945('0x173')]);};AGIVertices[_0x8945('0xf')][_0x8945('0x17e')]=function(_0x435532){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x17f'),_0x435532[_0x8945('0x35')]));return this[_0x8945('0xd')][_0x8945('0x180')](_0x435532[_0x8945('0x63')][_0x8945('0x55')](/\s+/g,''),_0x435532[_0x8945('0x173')]);};AGIVertices[_0x8945('0xf')][_0x8945('0x181')]=function(_0x2a230a){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x182'),_0x2a230a[_0x8945('0x35')]));return this['channel'][_0x8945('0x183')](_0x2a230a[_0x8945('0x58')],_0x2a230a[_0x8945('0x173')]);};AGIVertices[_0x8945('0xf')]['sendMail']=function(_0x441601){logger[_0x8945('0x29')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x441601[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x441601[_0x8945('0x184')])){return this[_0x8945('0xd')]['noop'](_0x8945('0x185'));}var _0x36ed2a=this[_0x8945('0x1f')]['sync'](this,_0x441601[_0x8945('0x184')]);if(!_0x36ed2a||!_0x36ed2a['Smtp']){return this['channel'][_0x8945('0x27')](_0x441601,'no\x20mail\x20account\x20found');}var _0x11b3ca={'from':util[_0x8945('0x51')](_0x8945('0x186'),_0x36ed2a[_0x8945('0x12')],_0x36ed2a[_0x8945('0x187')]||_0x36ed2a['Smtp']['user']),'to':_0x441601['to']||'','cc':_0x441601['cc']||'','bcc':_0x441601[_0x8945('0x188')]||'','subject':_0x441601[_0x8945('0x189')],'html':_0x441601[_0x8945('0x58')],'text':_0x441601[_0x8945('0x58')]};if(this[_0x8945('0x81')](_0x441601[_0x8945('0x18a')])){}logger['debug'](_0x8945('0x18b'),JSON[_0x8945('0x70')](_0x11b3ca));this[_0x8945('0x33')][_0x8945('0xa1')](this,_0x441601,_0x441601[_0x8945('0x184')]);this['channel']['noop'](util['format'](_0x8945('0x18c'),_0x36ed2a[_0x8945('0x12')]));this[_0x8945('0x21')][_0x8945('0xa1')](this,_0x36ed2a['smtpOptions'],_0x11b3ca);return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0x18d'));};AGIVertices[_0x8945('0xf')][_0x8945('0x18e')]=function(_0x1b7c46){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x18f'),_0x1b7c46[_0x8945('0x35')]));return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0x190'));};AGIVertices[_0x8945('0xf')][_0x8945('0x191')]=function(_0x4d9b09){logger[_0x8945('0x29')](util[_0x8945('0x51')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4d9b09['label']));if(!this['isConfigured'](_0x4d9b09[_0x8945('0x192')])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0x193'));}var _0x388bf6=this[_0x8945('0x30')][_0x8945('0xa1')](this,_0x4d9b09[_0x8945('0x192')]);if(!_0x388bf6){return this[_0x8945('0xd')][_0x8945('0x27')](_0x4d9b09,'no\x20sms\x20account\x20found');}var _0x53be6c={'body':_0x4d9b09['sms_text'],'phone':_0x4d9b09['to']||'','SmsAccountId':_0x388bf6['id']};logger[_0x8945('0x194')]('sendSMS\x20message',JSON[_0x8945('0x70')](_0x53be6c));this[_0x8945('0x33')][_0x8945('0xa1')](this,_0x4d9b09,_0x4d9b09['sms_account_id']);this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')](_0x8945('0x195'),_0x388bf6[_0x8945('0x12')]));this[_0x8945('0x32')][_0x8945('0xa1')](this,_0x53be6c);return this[_0x8945('0xd')]['noop'](_0x8945('0x196'));};AGIVertices[_0x8945('0xf')][_0x8945('0x197')]=function(_0xadf6fe){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x198'),_0xadf6fe[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0xadf6fe[_0x8945('0xd4')])){return this['channel'][_0x8945('0x27')](_0xadf6fe,'no\x20variable\x20selected');}var _0x71637e=this[_0x8945('0x10')][_0x8945('0xa1')](this,_0xadf6fe[_0x8945('0xd4')]);if(!_0x71637e){return this['channel']['error'](_0xadf6fe,_0x8945('0xd5'));}return this['channel'][_0x8945('0x9b')](_0x71637e,_0xadf6fe[_0x8945('0x199')]);};AGIVertices[_0x8945('0xf')][_0x8945('0x19a')]=function(_0x2fe7d0){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x19b'),_0x2fe7d0['label']));this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0x19c'));if(_0x2fe7d0['answer']===_0x8945('0x19d')){this[_0x8945('0xd')]['noop'](_0x8945('0x19e'));return this[_0x8945('0xd')][_0x8945('0x19f')]();}return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0x1a0'));};AGIVertices[_0x8945('0xf')][_0x8945('0x1a1')]=function(_0x15c165){logger['info'](util[_0x8945('0x51')](_0x8945('0x1a2'),_0x15c165['label']));if(!this[_0x8945('0x81')](_0x15c165[_0x8945('0x1a3')])){return this[_0x8945('0xd')]['error'](_0x15c165,'no\x20subproject\x20selected');}var _0xca3e6b=this[_0x8945('0x1a4')][_0x8945('0xa1')](this,_0x15c165['project_id']);if(!this[_0x8945('0x81')](_0xca3e6b)){return this['channel'][_0x8945('0x27')](_0x15c165,util[_0x8945('0x51')](_0x8945('0x1a5'),_0x15c165[_0x8945('0x1a3')]));}if(_0xca3e6b===this[_0x8945('0xd')][_0x8945('0x36')]){return this['channel'][_0x8945('0x27')](_0x15c165,_0x8945('0x1a6'));}this['createSquareDetailsReport'][_0x8945('0xa1')](this,_0x15c165,_0xca3e6b);var _0x353ae6=this[_0x8945('0xd')][_0x8945('0xa7')](_0x8945('0x1a7'),util[_0x8945('0x51')](_0x8945('0x1a8'),config['agi']['host']||_0x8945('0x1a9'),_0xca3e6b,this['channel'][_0x8945('0x36')]));if(_0x353ae6[_0x8945('0xa0')]===-0x1){return _0x353ae6;}return this['channel'][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0x164'),_0x8945('0x1a7'),_0xca3e6b));};AGIVertices['prototype'][_0x8945('0x1aa')]=function(_0x1b7f88){logger[_0x8945('0x29')](util['format'](_0x8945('0x1ab'),_0x1b7f88[_0x8945('0x35')]));var _0x45b140=this[_0x8945('0x1ac')][_0x8945('0xa1')](this,_0x1b7f88[_0x8945('0xb3')]);this['createSquareDetailsReport']['sync'](this,_0x1b7f88,_0x1b7f88[_0x8945('0xb3')]);if(this['isConfigured'](_0x1b7f88[_0x8945('0xd4')])){var _0x51f9eb=this['getVariable'][_0x8945('0xa1')](this,_0x1b7f88['variable_id']);if(_0x51f9eb){this['channel'][_0x8945('0x9b')](_0x51f9eb,_0x45b140);return this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0x1ad'),_0x1b7f88['command'],_0x51f9eb));}}return this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0x1ae'),_0x1b7f88[_0x8945('0xb3')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x2c1c2f){logger['info'](util[_0x8945('0x51')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x2c1c2f[_0x8945('0x35')]));_0x2c1c2f[_0x8945('0x58')]=_0x2c1c2f[_0x8945('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8945('0x81')](_0x2c1c2f['apiKey'])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0x1af'));}if(!this[_0x8945('0x81')](_0x2c1c2f['text'])){return this['channel'][_0x8945('0xa5')](_0x8945('0xa6'));}this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')](_0x8945('0x1b0'),_0x2c1c2f[_0x8945('0x58')]));var _0x54440b=this[_0x8945('0x56')][_0x8945('0xa1')](this,_0x2c1c2f);if(_0x54440b){this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x54440b));var _0x3191ff=this['channel'][_0x8945('0xfb')](_0x54440b);try{fs[_0x8945('0x11b')](_0x54440b+_0x8945('0xfc'));}catch(_0xb87b2e){logger[_0x8945('0x27')](_0xb87b2e);}return _0x3191ff;}return this[_0x8945('0xd')][_0x8945('0x27')](_0x2c1c2f,_0x8945('0x1b1'));};AGIVertices[_0x8945('0xf')][_0x8945('0x1b2')]=function(_0x2f6846){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x1b3'),_0x2f6846[_0x8945('0x35')]));_0x2f6846['text']=_0x2f6846['text'][_0x8945('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8945('0x81')](_0x2f6846[_0x8945('0x58')])){return this[_0x8945('0xd')][_0x8945('0xa5')](_0x8945('0xa6'));}this[_0x8945('0xd')][_0x8945('0xa5')](util['format'](_0x8945('0x1b4'),_0x2f6846[_0x8945('0x58')]));var _0x32b63b=this['googleTTS'][_0x8945('0xa1')](this,_0x2f6846);if(_0x32b63b){this[_0x8945('0xd')][_0x8945('0xa5')](util[_0x8945('0x51')]('Google\x20TTS\x20%s\x20file\x20created',_0x32b63b));var _0x32a391=this['channel'][_0x8945('0xfb')](_0x32b63b);try{fs[_0x8945('0x11b')](_0x32b63b+'.wav');}catch(_0x3f3632){logger[_0x8945('0x27')](_0x3f3632);}return _0x32a391;}return this[_0x8945('0xd')]['error'](_0x2f6846,_0x8945('0x1b5'));};AGIVertices[_0x8945('0xf')]['unpause']=function(_0x5cc490){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x1b6'),_0x5cc490[_0x8945('0x35')]));if(!this[_0x8945('0x81')](_0x5cc490[_0x8945('0x14c')])){return this[_0x8945('0xd')][_0x8945('0x27')](_0x5cc490,'no\x20find\x20by\x20configured');}logger[_0x8945('0x29')](util[_0x8945('0x51')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8945('0xd')][_0x8945('0x37')],_0x5cc490['findBy']));var _0x2e6d2=this[_0x8945('0x4d')][_0x8945('0xa1')](this,_0x5cc490[_0x8945('0x14c')]);if(_0x2e6d2){logger['info'](util[_0x8945('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8945('0xd')][_0x8945('0x37')],_0x5cc490[_0x8945('0x14c')]));this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')](_0x8945('0x14e'),this['channel'][_0x8945('0x37')],_0x5cc490[_0x8945('0x14c')]));return{'code':0xc8,'result':_0x8945('0x14f')};}else{logger['info'](util['format'](_0x8945('0x150'),this[_0x8945('0xd')][_0x8945('0x37')],_0x5cc490['findBy']));this['channel']['noop'](util[_0x8945('0x51')](_0x8945('0x150'),this['channel'][_0x8945('0x37')],_0x5cc490[_0x8945('0x14c')]));return{'code':0xc8,'result':_0x8945('0x151')};}};AGIVertices['prototype'][_0x8945('0x1b7')]=function(_0x29b843){logger[_0x8945('0x29')](util[_0x8945('0x51')](_0x8945('0x1b8'),_0x29b843[_0x8945('0x35')]));var _0xe989fa=this['channel'][_0x8945('0xa7')]('VOICEMAIL',[_0x29b843['mailbox'],_0x29b843[_0x8945('0x75')]]);if(_0xe989fa[_0x8945('0xa0')]===-0x1){return _0xe989fa;}return this[_0x8945('0xd')]['noop'](util[_0x8945('0x51')](_0x8945('0x164'),'VOICEMAIL',_0x29b843[_0x8945('0x1b9')]));};AGIVertices[_0x8945('0xf')][_0x8945('0x1ba')]=function(_0x103e4c){logger['info'](util[_0x8945('0x51')](_0x8945('0x1bb'),_0x103e4c['label']));if(!this[_0x8945('0x81')](_0x103e4c[_0x8945('0xd4')])){return this[_0x8945('0xd')]['error'](_0x103e4c,_0x8945('0x1bc'));}var _0x585ef2=this['getVariable']['sync'](this,_0x103e4c['variable_id']);if(!_0x585ef2){return this[_0x8945('0xd')][_0x8945('0x27')](_0x103e4c,'no\x20variable\x20found');}var _0x184902=this[_0x8945('0xd')][_0x8945('0x10')](_0x585ef2);return{'code':0xc8,'result':_0x184902[_0x8945('0x9e')]?_0x184902['extra']:'-'};};String[_0x8945('0xf')][_0x8945('0x9d')]=function(_0x287d29,_0x524460){return this[_0x8945('0x9c')](_0x287d29)[_0x8945('0x1bd')](_0x524460);};module[_0x8945('0x1be')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 2b0fc86..2259369 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 _0x5232=['[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','prototype','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','savePause','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','updateAcw','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','interface'];(function(_0x1b650a,_0x41a453){var _0x3ac6b1=function(_0x4eb6f5){while(--_0x4eb6f5){_0x1b650a['push'](_0x1b650a['shift']());}};_0x3ac6b1(++_0x41a453);}(_0x5232,0x1c9));var _0x2523=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0x5232[_0x22431e];return _0xd978e9;};'use strict';var _=require(_0x2523('0x0'));var moment=require(_0x2523('0x1'));var ami=require(_0x2523('0x2'));var logger=require(_0x2523('0x3'))(_0x2523('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3ce9f5){this[_0x2523('0x5')]=_0x3ce9f5['voiceQueues'];this[_0x2523('0x6')]=_0x3ce9f5[_0x2523('0x6')];this[_0x2523('0x7')]=_0x3ce9f5[_0x2523('0x7')];this[_0x2523('0x8')]={};ami['on'](_0x2523('0x9'),this[_0x2523('0xa')][_0x2523('0xb')](this));ami['on'](_0x2523('0xc'),this[_0x2523('0xd')][_0x2523('0xb')](this));ami['on'](_0x2523('0xe'),this['syncHangup'][_0x2523('0xb')](this));ami['on'](_0x2523('0xf'),this[_0x2523('0x10')][_0x2523('0xb')](this));ami['on'](_0x2523('0x11'),this[_0x2523('0x12')]['bind'](this));ami['on'](_0x2523('0x13'),this[_0x2523('0x14')][_0x2523('0xb')](this));ami['on'](_0x2523('0x15'),this['syncAgentConnectPreview'][_0x2523('0xb')](this));}function getDiff(_0x9fa814){var _0x5e1e1d=moment()[_0x2523('0x16')](0x0);var _0x2cd6e1=moment(_0x9fa814)[_0x2523('0x16')](0x0);return _0x5e1e1d[_0x2523('0x17')](_0x2cd6e1,'seconds');}Acw[_0x2523('0x18')]['updateAcw']=function(_0x3f9b51,_0x1ac5d3){var _0x173218=this;var _0x73e57a=getDiff(_0x173218['timers'][_0x3f9b51][_0x2523('0x19')]);clearTimeout(_0x173218[_0x2523('0x7')][_0x3f9b51][_0x2523('0x1a')]);_0x173218[_0x2523('0x7')][_0x3f9b51][_0x2523('0x1a')]=![];return RpcVoiceAgentReport[_0x2523('0x1b')]({'acwtime':_0x73e57a},_0x173218['timers'][_0x3f9b51][_0x2523('0x1c')],_0x3f9b51)[_0x2523('0x1d')](function(_0x540ec8){logger[_0x2523('0x1e')](_0x2523('0x1f'),_0x1ac5d3,_0x73e57a,_0x540ec8);})[_0x2523('0x20')](function(_0xd2b9ab){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x1ac5d3,_0xd2b9ab);})['finally'](function(){delete _0x173218['timers'][_0x3f9b51];});};Acw[_0x2523('0x18')][_0x2523('0x21')]=function(_0x469eda){try{var _0x3baae5=this;var _0x1c39d8=this['channels'][_0x469eda]['interface'];var _0x5444bb=this[_0x2523('0x8')][_0x469eda][_0x2523('0x22')];var _0x4847c1=this['voiceQueues'][_0x5444bb];var _0x5b5043=![];var _0x1df86b=_0x2523('0x23');if(_0x4847c1[_0x2523('0x24')]&&_0x4847c1[_0x2523('0x25')][_0x2523('0x26')]){_0x5b5043=!![];_0x1df86b=_0x4847c1['mandatoryDispositionPause'][_0x2523('0x26')];}if(!_0x3baae5[_0x2523('0x6')][_0x1c39d8]){return Promise[_0x2523('0x27')]();}return RpcUser[_0x2523('0x28')](_0x3baae5[_0x2523('0x6')][_0x1c39d8]['id'])[_0x2523('0x1d')](function(_0x17b55c){if(!_0x17b55c||_0x17b55c[_0x2523('0x29')]){logger[_0x2523('0x1e')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x469eda,_0x1c39d8,_0x5444bb);return;}logger[_0x2523('0x1e')](_0x2523('0x2a'),_0x469eda,_0x1c39d8,_0x5444bb);var _0x53b772=_0x3baae5[_0x2523('0x8')][_0x469eda]['attended']&&_0x3baae5['channels'][_0x469eda]['destlinkedid']?_0x3baae5[_0x2523('0x8')][_0x469eda]['destlinkedid']:_0x469eda;return RpcUser[_0x2523('0x2b')](_0x3baae5['agents'][_0x1c39d8],_0x1df86b,_0x53b772);})[_0x2523('0x1d')](function(_0xb9cba8){if(_0x5b5043||!_0xb9cba8){return;}_0x3baae5['timers'][_0x1c39d8]={};logger[_0x2523('0x1e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x469eda,_0x3baae5[_0x2523('0x5')][_0x5444bb][_0x2523('0x2c')],_0x1c39d8,_0x5444bb);_0x3baae5[_0x2523('0x7')][_0x1c39d8][_0x2523('0x1a')]=setTimeout(_0x3baae5[_0x2523('0x2d')][_0x2523('0xb')](_0x3baae5,_0x1c39d8),_0x3baae5['voiceQueues'][_0x5444bb][_0x2523('0x2c')]*0x3e8);_0x3baae5[_0x2523('0x7')][_0x1c39d8][_0x2523('0x19')]=moment()['format'](_0x2523('0x2e'));_0x3baae5['timers'][_0x1c39d8][_0x2523('0x1c')]=_0x469eda;_0x3baae5[_0x2523('0x7')][_0x1c39d8][_0x2523('0x22')]=_0x5444bb;_0x3baae5[_0x2523('0x7')][_0x1c39d8][_0x2523('0x2f')]=_0x3baae5[_0x2523('0x2f')][_0x2523('0xb')](_0x3baae5,_0x1c39d8,_0x469eda);})['catch'](function(){logger[_0x2523('0x30')](_0x2523('0x31'),_0x469eda,_0x3baae5[_0x2523('0x5')][_0x5444bb][_0x2523('0x2c')],_0x1c39d8,_0x5444bb);})[_0x2523('0x32')](function(){delete _0x3baae5['channels'][_0x469eda];});}catch(_0x44ab04){logger[_0x2523('0x30')](_0x2523('0x33'),_0x44ab04[_0x2523('0x34')]);}};Acw['prototype'][_0x2523('0x2d')]=function(_0x5b95e5){try{var _0x4da7c4=this;if(_0x4da7c4['timers'][_0x5b95e5]){_0x4da7c4[_0x2523('0x7')][_0x5b95e5][_0x2523('0x1a')]=![];var _0x10687a=_0x4da7c4[_0x2523('0x7')][_0x5b95e5][_0x2523('0x1c')];var _0x3a4b37=_0x4da7c4[_0x2523('0x7')][_0x5b95e5][_0x2523('0x22')];var _0x4b3b25=_0x4da7c4[_0x2523('0x5')][_0x3a4b37][_0x2523('0x2c')];logger[_0x2523('0x1e')](_0x2523('0x35'),_0x10687a,_0x5b95e5);RpcUser[_0x2523('0x36')](this['agents'][_0x5b95e5]);RpcVoiceAgentReport[_0x2523('0x1b')]({'acwtime':_0x4b3b25,'agentacw':!![]},_0x10687a,_0x5b95e5)[_0x2523('0x1d')](function(_0x5164c3){logger['info'](_0x2523('0x1f'),_0x10687a,_0x4b3b25,_0x5164c3);})['catch'](function(_0x1ff27a){logger[_0x2523('0x30')](_0x2523('0x37'),_0x10687a,_0x1ff27a);});}else{logger[_0x2523('0x30')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x5b95e5);if(_0x4da7c4['timers']){logger[_0x2523('0x1e')](_0x2523('0x38'),JSON[_0x2523('0x39')](_0x4da7c4[_0x2523('0x7')]));}}}catch(_0x14104c){logger['error']('[ACW][STOP]\x20%s',_0x14104c['message']);}};Acw[_0x2523('0x18')][_0x2523('0xa')]=function(_0xceff81){try{if(this['voiceQueues'][_0xceff81[_0x2523('0x22')]]&&(this[_0x2523('0x5')][_0xceff81['queue']][_0x2523('0x4')]||this[_0x2523('0x5')][_0xceff81[_0x2523('0x22')]][_0x2523('0x24')])){if(this[_0x2523('0x6')][_0xceff81['interface']]){this[_0x2523('0x8')][_0xceff81[_0x2523('0x1c')]]={'queue':_0xceff81[_0x2523('0x22')],'interface':_0xceff81[_0x2523('0x3a')],'destlinkedid':_0xceff81['destlinkedid']};}}}catch(_0x3000bf){logger[_0x2523('0x30')](_0x2523('0x3b'),_0x3000bf[_0x2523('0x34')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x20f1d6){try{if(this['voiceQueues'][_0x20f1d6[_0x2523('0x22')]]&&(this[_0x2523('0x5')][_0x20f1d6[_0x2523('0x22')]][_0x2523('0x4')]||this[_0x2523('0x5')][_0x20f1d6['queue']][_0x2523('0x24')])){if(this[_0x2523('0x6')][_0x20f1d6['interface']]){this[_0x2523('0x8')][_0x20f1d6[_0x2523('0x1c')]]={'queue':_0x20f1d6[_0x2523('0x22')],'interface':_0x20f1d6['interface']};}}}catch(_0x337993){logger[_0x2523('0x30')](_0x2523('0x3c'),_0x337993[_0x2523('0x34')]);}};Acw[_0x2523('0x18')]['syncHangupRequest']=function(_0x17109e){try{if(this[_0x2523('0x8')][_0x17109e['uniqueid']]&&_[_0x2523('0x3d')](this['channels'][_0x17109e['uniqueid']][_0x2523('0x3e')])){logger[_0x2523('0x1e')](_0x2523('0x3f'),_0x17109e[_0x2523('0x1c')]);this[_0x2523('0x21')](_0x17109e[_0x2523('0x1c')]);}else if(this[_0x2523('0x8')][_0x17109e['linkedid']]&&_['isUndefined'](this['channels'][_0x17109e[_0x2523('0x40')]][_0x2523('0x3e')])){logger['info'](_0x2523('0x41'),_0x17109e[_0x2523('0x40')]);this[_0x2523('0x21')](_0x17109e['linkedid']);}}catch(_0x447343){logger[_0x2523('0x30')](_0x2523('0x42'),_0x447343['message']);}};Acw['prototype'][_0x2523('0x43')]=function(_0xf9b58f){try{if(this['channels'][_0xf9b58f[_0x2523('0x1c')]]&&this[_0x2523('0x8')][_0xf9b58f[_0x2523('0x1c')]][_0x2523('0x3e')]){logger[_0x2523('0x1e')](_0x2523('0x44'),_0xf9b58f[_0x2523('0x1c')]);this[_0x2523('0x21')](_0xf9b58f[_0x2523('0x1c')]);}else if(this[_0x2523('0x8')][_0xf9b58f[_0x2523('0x40')]]&&this[_0x2523('0x8')][_0xf9b58f[_0x2523('0x40')]][_0x2523('0x3e')]){logger[_0x2523('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xf9b58f[_0x2523('0x40')]);this['startAcw'](_0xf9b58f[_0x2523('0x40')]);}}catch(_0x328d2a){logger['error']('[ACW][syncHangup]\x20%s',_0x328d2a[_0x2523('0x34')]);}};Acw[_0x2523('0x18')]['syncAttendedTransfer']=function(_0x23b11b){try{if(!_[_0x2523('0x45')](this['channels'][_0x23b11b['transfereeuniqueid']])){this[_0x2523('0x21')](_0x23b11b['transfereeuniqueid']);if(this[_0x2523('0x8')][_0x23b11b[_0x2523('0x46')]]){this[_0x2523('0x8')][_0x23b11b[_0x2523('0x46')]][_0x2523('0x3e')]=!![];this[_0x2523('0x8')][_0x23b11b['transfertargetuniqueid']]=this[_0x2523('0x8')][_0x23b11b[_0x2523('0x46')]];delete this['channels'][_0x23b11b[_0x2523('0x46')]];}}else if(!_['isNil'](this['channels'][_0x23b11b[_0x2523('0x47')]])){this['startAcw'](_0x23b11b['transfertargetuniqueid']);if(this[_0x2523('0x8')][_0x23b11b[_0x2523('0x48')]]){this[_0x2523('0x8')][_0x23b11b[_0x2523('0x48')]][_0x2523('0x3e')]=!![];this[_0x2523('0x8')][_0x23b11b[_0x2523('0x49')]]=this['channels'][_0x23b11b['origtransfereruniqueid']];delete this[_0x2523('0x8')][_0x23b11b[_0x2523('0x48')]];}}}catch(_0x3bcdf6){logger['error'](_0x2523('0x4a'),_0x3bcdf6[_0x2523('0x34')]);}};Acw['prototype'][_0x2523('0x14')]=function(_0x94e275){try{if(this[_0x2523('0x8')][_0x94e275[_0x2523('0x4b')]]){logger['info'](_0x2523('0x4c'),JSON[_0x2523('0x39')](_0x94e275[_0x2523('0x4b')]));this[_0x2523('0x21')](_0x94e275[_0x2523('0x4b')]);}else if(this[_0x2523('0x8')][_0x94e275[_0x2523('0x4d')]]){logger[_0x2523('0x1e')](_0x2523('0x4e'),JSON[_0x2523('0x39')](_0x94e275[_0x2523('0x4d')]));this[_0x2523('0x21')](_0x94e275[_0x2523('0x4d')]);}}catch(_0x1cb92d){logger['error'](_0x2523('0x4f'),_0x1cb92d[_0x2523('0x34')]);}};Acw[_0x2523('0x18')][_0x2523('0x10')]=function(_0x13fbbe){try{if(this[_0x2523('0x5')][_0x13fbbe['queue']]&&this[_0x2523('0x5')][_0x13fbbe['queue']][_0x2523('0x50')]===_0x2523('0x51')){if(this[_0x2523('0x6')][_0x13fbbe['interface']]){logger[_0x2523('0x1e')](_0x2523('0x52'),_0x13fbbe[_0x2523('0x1c')],_0x13fbbe[_0x2523('0x3a')],_0x13fbbe[_0x2523('0x22')]);return RpcUser[_0x2523('0x2b')](this[_0x2523('0x6')][_0x13fbbe[_0x2523('0x3a')]],_0x2523('0x53'),_0x13fbbe[_0x2523('0x1c')]);}}}catch(_0x3a54ac){logger['error'](_0x2523('0x54'),_0x3a54ac['message']);}};module[_0x2523('0x55')]=Acw; \ No newline at end of file +var _0xd9fb=['voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','stopAcw','updateAcw','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][TIMERS]','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','lastPauseAt','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','getAgent'];(function(_0x448e35,_0x1611a6){var _0x5aa5bc=function(_0x2e0e06){while(--_0x2e0e06){_0x448e35['push'](_0x448e35['shift']());}};_0x5aa5bc(++_0x1611a6);}(_0xd9fb,0x189));var _0xbd9f=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd9fb[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xbd9f('0x0'));var moment=require(_0xbd9f('0x1'));var ami=require(_0xbd9f('0x2'));var logger=require(_0xbd9f('0x3'))(_0xbd9f('0x4'));var RpcUser=require(_0xbd9f('0x5'));var RpcVoiceAgentReport=require(_0xbd9f('0x6'));function Acw(_0x56fe1b){this[_0xbd9f('0x7')]=_0x56fe1b[_0xbd9f('0x7')];this['agents']=_0x56fe1b[_0xbd9f('0x8')];this['timers']=_0x56fe1b[_0xbd9f('0x9')];this[_0xbd9f('0xa')]={};ami['on']('agentconnect',this[_0xbd9f('0xb')][_0xbd9f('0xc')](this));ami['on'](_0xbd9f('0xd'),this[_0xbd9f('0xe')]['bind'](this));ami['on'](_0xbd9f('0xf'),this[_0xbd9f('0x10')][_0xbd9f('0xc')](this));ami['on'](_0xbd9f('0x11'),this[_0xbd9f('0x12')][_0xbd9f('0xc')](this));ami['on'](_0xbd9f('0x13'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xbd9f('0xc')](this));ami['on']('custom:agentConnectPreview',this[_0xbd9f('0x14')][_0xbd9f('0xc')](this));}function getDiff(_0x3030f5){var _0x530513=moment()[_0xbd9f('0x15')](0x0);var _0x5beefe=moment(_0x3030f5)[_0xbd9f('0x15')](0x0);return _0x530513[_0xbd9f('0x16')](_0x5beefe,_0xbd9f('0x17'));}Acw[_0xbd9f('0x18')]['updateAcw']=function(_0x442253,_0x25557f){var _0x104cfd=this;var _0x1deb0f=getDiff(_0x104cfd[_0xbd9f('0x9')][_0x442253][_0xbd9f('0x19')]);clearTimeout(_0x104cfd[_0xbd9f('0x9')][_0x442253]['timer']);_0x104cfd['timers'][_0x442253][_0xbd9f('0x1a')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x1deb0f},_0x104cfd[_0xbd9f('0x9')][_0x442253][_0xbd9f('0x1b')],_0x442253)[_0xbd9f('0x1c')](function(_0x1a42a0){logger[_0xbd9f('0x1d')](_0xbd9f('0x1e'),_0x25557f,_0x1deb0f,_0x1a42a0);})[_0xbd9f('0x1f')](function(_0xe82e22){logger['error'](_0xbd9f('0x20'),_0x25557f,_0xe82e22);})[_0xbd9f('0x21')](function(){delete _0x104cfd[_0xbd9f('0x9')][_0x442253];});};Acw[_0xbd9f('0x18')][_0xbd9f('0x22')]=function(_0x135f49){try{var _0x5f7881=this;var _0x30e745=this[_0xbd9f('0xa')][_0x135f49][_0xbd9f('0x23')];var _0x198797=this['channels'][_0x135f49][_0xbd9f('0x24')];var _0x10697a=this[_0xbd9f('0x7')][_0x198797];var _0x18b387=![];var _0x5d74e0=_0xbd9f('0x25');if(_0x10697a[_0xbd9f('0x26')]&&_0x10697a[_0xbd9f('0x27')][_0xbd9f('0x28')]){_0x18b387=!![];_0x5d74e0=_0x10697a[_0xbd9f('0x27')][_0xbd9f('0x28')];}if(!_0x5f7881[_0xbd9f('0x8')][_0x30e745]){return Promise['resolve']();}return RpcUser[_0xbd9f('0x29')](_0x5f7881[_0xbd9f('0x8')][_0x30e745]['id'])[_0xbd9f('0x1c')](function(_0x892315){if(!_0x892315||_0x892315[_0xbd9f('0x2a')]){logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x135f49,_0x30e745,_0x198797);return;}logger[_0xbd9f('0x1d')](_0xbd9f('0x2b'),_0x135f49,_0x30e745,_0x198797);var _0x1d92fa=_0x5f7881['channels'][_0x135f49][_0xbd9f('0x2c')]&&_0x5f7881[_0xbd9f('0xa')][_0x135f49][_0xbd9f('0x2d')]?_0x5f7881['channels'][_0x135f49][_0xbd9f('0x2d')]:_0x135f49;return RpcUser[_0xbd9f('0x2e')](_0x5f7881[_0xbd9f('0x8')][_0x30e745],_0x5d74e0,_0x1d92fa);})[_0xbd9f('0x1c')](function(_0x2a733e){if(_0x18b387||!_0x2a733e){return;}_0x5f7881[_0xbd9f('0x9')][_0x30e745]={};logger[_0xbd9f('0x1d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x135f49,_0x5f7881['voiceQueues'][_0x198797][_0xbd9f('0x2f')],_0x30e745,_0x198797);_0x5f7881[_0xbd9f('0x9')][_0x30e745][_0xbd9f('0x1a')]=setTimeout(_0x5f7881[_0xbd9f('0x30')][_0xbd9f('0xc')](_0x5f7881,_0x30e745),_0x5f7881[_0xbd9f('0x7')][_0x198797][_0xbd9f('0x2f')]*0x3e8);_0x5f7881[_0xbd9f('0x9')][_0x30e745][_0xbd9f('0x19')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5f7881[_0xbd9f('0x9')][_0x30e745]['uniqueid']=_0x135f49;_0x5f7881['timers'][_0x30e745][_0xbd9f('0x24')]=_0x198797;_0x5f7881[_0xbd9f('0x9')][_0x30e745][_0xbd9f('0x31')]=_0x5f7881[_0xbd9f('0x31')][_0xbd9f('0xc')](_0x5f7881,_0x30e745,_0x135f49);})[_0xbd9f('0x1f')](function(){logger[_0xbd9f('0x32')](_0xbd9f('0x33'),_0x135f49,_0x5f7881['voiceQueues'][_0x198797][_0xbd9f('0x2f')],_0x30e745,_0x198797);})[_0xbd9f('0x21')](function(){delete _0x5f7881[_0xbd9f('0xa')][_0x135f49];});}catch(_0x4cab13){logger['error'](_0xbd9f('0x34'),_0x4cab13[_0xbd9f('0x35')]);}};Acw['prototype'][_0xbd9f('0x30')]=function(_0x518b9b){try{var _0x3abcae=this;if(_0x3abcae[_0xbd9f('0x9')][_0x518b9b]){_0x3abcae[_0xbd9f('0x9')][_0x518b9b][_0xbd9f('0x1a')]=![];var _0x1c13c7=_0x3abcae['timers'][_0x518b9b][_0xbd9f('0x1b')];var _0x2c9943=_0x3abcae['timers'][_0x518b9b][_0xbd9f('0x24')];var _0x3e66c9=_0x3abcae[_0xbd9f('0x7')][_0x2c9943][_0xbd9f('0x2f')];logger['info'](_0xbd9f('0x36'),_0x1c13c7,_0x518b9b);RpcUser[_0xbd9f('0x37')](this[_0xbd9f('0x8')][_0x518b9b]);RpcVoiceAgentReport[_0xbd9f('0x38')]({'acwtime':_0x3e66c9,'agentacw':!![]},_0x1c13c7,_0x518b9b)['then'](function(_0x28cedb){logger[_0xbd9f('0x1d')](_0xbd9f('0x1e'),_0x1c13c7,_0x3e66c9,_0x28cedb);})[_0xbd9f('0x1f')](function(_0x5333c9){logger['error'](_0xbd9f('0x20'),_0x1c13c7,_0x5333c9);});}else{logger[_0xbd9f('0x32')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x518b9b);if(_0x3abcae[_0xbd9f('0x9')]){logger['info'](_0xbd9f('0x39'),JSON['stringify'](_0x3abcae[_0xbd9f('0x9')]));}}}catch(_0x342ada){logger['error']('[ACW][STOP]\x20%s',_0x342ada['message']);}};Acw[_0xbd9f('0x18')][_0xbd9f('0xb')]=function(_0x533339){try{if(this['voiceQueues'][_0x533339[_0xbd9f('0x24')]]&&(this[_0xbd9f('0x7')][_0x533339[_0xbd9f('0x24')]][_0xbd9f('0x4')]||this['voiceQueues'][_0x533339[_0xbd9f('0x24')]][_0xbd9f('0x26')])){if(this[_0xbd9f('0x8')][_0x533339[_0xbd9f('0x23')]]){this[_0xbd9f('0xa')][_0x533339['uniqueid']]={'queue':_0x533339[_0xbd9f('0x24')],'interface':_0x533339[_0xbd9f('0x23')],'destlinkedid':_0x533339[_0xbd9f('0x2d')]};}}}catch(_0x3a151e){logger['error'](_0xbd9f('0x3a'),_0x3a151e[_0xbd9f('0x35')]);}};Acw[_0xbd9f('0x18')]['syncAgentConnectPreview']=function(_0x5c36dc){try{if(this[_0xbd9f('0x7')][_0x5c36dc[_0xbd9f('0x24')]]&&(this[_0xbd9f('0x7')][_0x5c36dc[_0xbd9f('0x24')]]['acw']||this[_0xbd9f('0x7')][_0x5c36dc[_0xbd9f('0x24')]][_0xbd9f('0x26')])){if(this[_0xbd9f('0x8')][_0x5c36dc['interface']]){this['channels'][_0x5c36dc[_0xbd9f('0x1b')]]={'queue':_0x5c36dc[_0xbd9f('0x24')],'interface':_0x5c36dc[_0xbd9f('0x23')]};}}}catch(_0x585065){logger[_0xbd9f('0x32')](_0xbd9f('0x3b'),_0x585065[_0xbd9f('0x35')]);}};Acw[_0xbd9f('0x18')][_0xbd9f('0xe')]=function(_0xbeca49){try{if(this[_0xbd9f('0xa')][_0xbeca49[_0xbd9f('0x1b')]]&&_[_0xbd9f('0x3c')](this[_0xbd9f('0xa')][_0xbeca49[_0xbd9f('0x1b')]][_0xbd9f('0x2c')])){logger[_0xbd9f('0x1d')](_0xbd9f('0x3d'),_0xbeca49[_0xbd9f('0x1b')]);this['startAcw'](_0xbeca49[_0xbd9f('0x1b')]);}else if(this['channels'][_0xbeca49[_0xbd9f('0x3e')]]&&_[_0xbd9f('0x3c')](this['channels'][_0xbeca49['linkedid']][_0xbd9f('0x2c')])){logger[_0xbd9f('0x1d')](_0xbd9f('0x3f'),_0xbeca49[_0xbd9f('0x3e')]);this[_0xbd9f('0x22')](_0xbeca49[_0xbd9f('0x3e')]);}}catch(_0xa6b0bc){logger[_0xbd9f('0x32')](_0xbd9f('0x40'),_0xa6b0bc[_0xbd9f('0x35')]);}};Acw['prototype'][_0xbd9f('0x10')]=function(_0x5399f5){try{if(this[_0xbd9f('0xa')][_0x5399f5[_0xbd9f('0x1b')]]&&this[_0xbd9f('0xa')][_0x5399f5[_0xbd9f('0x1b')]][_0xbd9f('0x2c')]){logger['info'](_0xbd9f('0x41'),_0x5399f5[_0xbd9f('0x1b')]);this[_0xbd9f('0x22')](_0x5399f5[_0xbd9f('0x1b')]);}else if(this[_0xbd9f('0xa')][_0x5399f5[_0xbd9f('0x3e')]]&&this[_0xbd9f('0xa')][_0x5399f5[_0xbd9f('0x3e')]][_0xbd9f('0x2c')]){logger[_0xbd9f('0x1d')](_0xbd9f('0x42'),_0x5399f5[_0xbd9f('0x3e')]);this[_0xbd9f('0x22')](_0x5399f5[_0xbd9f('0x3e')]);}}catch(_0x48c24e){logger[_0xbd9f('0x32')](_0xbd9f('0x43'),_0x48c24e[_0xbd9f('0x35')]);}};Acw[_0xbd9f('0x18')][_0xbd9f('0x44')]=function(_0x5a907a){try{if(!_['isNil'](this[_0xbd9f('0xa')][_0x5a907a[_0xbd9f('0x45')]])){this[_0xbd9f('0x22')](_0x5a907a['transfereeuniqueid']);if(this['channels'][_0x5a907a[_0xbd9f('0x46')]]){this[_0xbd9f('0xa')][_0x5a907a[_0xbd9f('0x46')]]['attended']=!![];this[_0xbd9f('0xa')][_0x5a907a[_0xbd9f('0x47')]]=this['channels'][_0x5a907a[_0xbd9f('0x46')]];delete this['channels'][_0x5a907a[_0xbd9f('0x46')]];}}else if(!_[_0xbd9f('0x48')](this[_0xbd9f('0xa')][_0x5a907a[_0xbd9f('0x47')]])){this[_0xbd9f('0x22')](_0x5a907a[_0xbd9f('0x47')]);if(this[_0xbd9f('0xa')][_0x5a907a[_0xbd9f('0x49')]]){this[_0xbd9f('0xa')][_0x5a907a[_0xbd9f('0x49')]][_0xbd9f('0x2c')]=!![];this[_0xbd9f('0xa')][_0x5a907a['transfereeuniqueid']]=this['channels'][_0x5a907a['origtransfereruniqueid']];delete this[_0xbd9f('0xa')][_0x5a907a[_0xbd9f('0x49')]];}}}catch(_0x2b9cff){logger[_0xbd9f('0x32')](_0xbd9f('0x4a'),_0x2b9cff[_0xbd9f('0x35')]);}};Acw[_0xbd9f('0x18')][_0xbd9f('0x4b')]=function(_0x522fa6){try{if(this[_0xbd9f('0xa')][_0x522fa6[_0xbd9f('0x4c')]]){logger['info'](_0xbd9f('0x4d'),JSON[_0xbd9f('0x4e')](_0x522fa6[_0xbd9f('0x4c')]));this['startAcw'](_0x522fa6['transfereruniqueid']);}else if(this[_0xbd9f('0xa')][_0x522fa6[_0xbd9f('0x4f')]]){logger[_0xbd9f('0x1d')](_0xbd9f('0x50'),JSON[_0xbd9f('0x4e')](_0x522fa6[_0xbd9f('0x4f')]));this[_0xbd9f('0x22')](_0x522fa6[_0xbd9f('0x4f')]);}}catch(_0x470b52){logger['error'](_0xbd9f('0x51'),_0x470b52[_0xbd9f('0x35')]);}};Acw[_0xbd9f('0x18')][_0xbd9f('0x12')]=function(_0x2832aa){try{if(this[_0xbd9f('0x7')][_0x2832aa[_0xbd9f('0x24')]]&&this[_0xbd9f('0x7')][_0x2832aa[_0xbd9f('0x24')]][_0xbd9f('0x52')]===_0xbd9f('0x53')){if(this['agents'][_0x2832aa[_0xbd9f('0x23')]]){logger[_0xbd9f('0x1d')](_0xbd9f('0x54'),_0x2832aa[_0xbd9f('0x1b')],_0x2832aa[_0xbd9f('0x23')],_0x2832aa[_0xbd9f('0x24')]);return RpcUser[_0xbd9f('0x2e')](this[_0xbd9f('0x8')][_0x2832aa[_0xbd9f('0x23')]],'Auto-Pause',_0x2832aa[_0xbd9f('0x1b')]);}}}catch(_0x2e22ba){logger['error'](_0xbd9f('0x55'),_0x2e22ba['message']);}};module[_0xbd9f('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d32f9db..313167e 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 _0x8a27=['error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','username','password','Action','promisify'];(function(_0x209bbf,_0x2e2375){var _0x592d4b=function(_0x419947){while(--_0x419947){_0x209bbf['push'](_0x209bbf['shift']());}};_0x592d4b(++_0x2e2375);}(_0x8a27,0x15d));var _0x78a2=function(_0x4799ef,_0x3e6eaa){_0x4799ef=_0x4799ef-0x0;var _0xac82ac=_0x8a27[_0x4799ef];return _0xac82ac;};'use strict';var Manager=require(_0x78a2('0x0'));var BPromise=require(_0x78a2('0x1'));var util=require(_0x78a2('0x2'));var logger=require(_0x78a2('0x3'))(_0x78a2('0x4'));var config=require(_0x78a2('0x5'));var ami=new Manager(config['asterisk']['port'],config[_0x78a2('0x6')]['ip'],config[_0x78a2('0x6')][_0x78a2('0x7')],config['asterisk'][_0x78a2('0x8')],!![]);ami['keepConnected']();ami[_0x78a2('0x9')]=BPromise[_0x78a2('0xa')](ami['action']);function error(_0x578c0f){logger[_0x78a2('0xb')](util[_0x78a2('0xc')](_0x78a2('0xd'),config[_0x78a2('0x6')]['username'],config[_0x78a2('0x6')]['ip'],config[_0x78a2('0x6')][_0x78a2('0xe')],util[_0x78a2('0xf')](_0x578c0f,![],null)));}function close(){logger[_0x78a2('0xb')](util[_0x78a2('0xc')](_0x78a2('0x10'),config[_0x78a2('0x6')][_0x78a2('0x7')],config[_0x78a2('0x6')]['ip'],config['asterisk'][_0x78a2('0xe')]));}ami[_0x78a2('0x11')]=function(){return function(){return ami[_0x78a2('0x9')]({'action':_0x78a2('0x12')});};};ami[_0x78a2('0x13')]=function(){return function(){return ami[_0x78a2('0x9')]({'action':_0x78a2('0x14')});};};ami[_0x78a2('0x15')]=function(){return function(){return ami[_0x78a2('0x9')]({'action':_0x78a2('0x16')});};};ami[_0x78a2('0x17')]=function(){return function(){return ami['Action']({'action':_0x78a2('0x18')});};};ami[_0x78a2('0x19')]=function(){return function(){return ami[_0x78a2('0x9')]({'action':'coreshowchannels'});};};function connect(){logger[_0x78a2('0x1a')](util[_0x78a2('0xc')](_0x78a2('0x1b'),config[_0x78a2('0x6')][_0x78a2('0x7')],config[_0x78a2('0x6')]['ip'],config[_0x78a2('0x6')][_0x78a2('0xe')]));ami[_0x78a2('0x1c')](_0x78a2('0xb'),error);ami[_0x78a2('0x1c')](_0x78a2('0x1d'),close);}ami['on'](_0x78a2('0x1e'),connect);ami['on'](_0x78a2('0x1f'),function(_0x3b8770){logger['info'](util[_0x78a2('0xc')](_0x78a2('0x20'),config[_0x78a2('0x6')][_0x78a2('0x7')],config['asterisk']['ip'],config[_0x78a2('0x6')][_0x78a2('0xe')],util[_0x78a2('0xf')](_0x3b8770,![],null)));});ami['on']('fullybooted',function(){logger[_0x78a2('0x1a')](util[_0x78a2('0xc')](_0x78a2('0x21'),config[_0x78a2('0x6')][_0x78a2('0x7')],config['asterisk']['ip'],config[_0x78a2('0x6')]['port']));return Promise['resolve']()[_0x78a2('0x22')](ami[_0x78a2('0x11')]())['then'](ami[_0x78a2('0x13')]())[_0x78a2('0x22')](ami[_0x78a2('0x15')]())[_0x78a2('0x22')](ami[_0x78a2('0x17')]())[_0x78a2('0x22')](ami[_0x78a2('0x19')]())['catch'](function(_0x3aaab7){logger['error']('[ami.js][fullybooted]',util[_0x78a2('0xf')](_0x3aaab7,{'showHidden':![],'depth':null}));});});ami[_0x78a2('0x1c')]('error',error);ami[_0x78a2('0x1c')](_0x78a2('0x1d'),close);module[_0x78a2('0x23')]=ami; \ No newline at end of file +var _0xb7a5=['error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','devicestatelist','actionSipPeerStatus','sippeerstatus','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','info','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionQueueSummary','actionCoreShowChannels','[ami.js][fullybooted]','close','exports','util','../../config/logger','port','asterisk','username','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect'];(function(_0x10a0a9,_0x441989){var _0x46c9a5=function(_0x136838){while(--_0x136838){_0x10a0a9['push'](_0x10a0a9['shift']());}};_0x46c9a5(++_0x441989);}(_0xb7a5,0x147));var _0x5b7a=function(_0x4330da,_0x1beed1){_0x4330da=_0x4330da-0x0;var _0x5862e8=_0xb7a5[_0x4330da];return _0x5862e8;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require(_0x5b7a('0x0'));var logger=require(_0x5b7a('0x1'))('ami');var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0x5b7a('0x2')],config['asterisk']['ip'],config[_0x5b7a('0x3')][_0x5b7a('0x4')],config[_0x5b7a('0x3')][_0x5b7a('0x5')],!![]);ami[_0x5b7a('0x6')]();ami[_0x5b7a('0x7')]=BPromise[_0x5b7a('0x8')](ami[_0x5b7a('0x9')]);function error(_0x4760b9){logger['error'](util[_0x5b7a('0xa')](_0x5b7a('0xb'),config[_0x5b7a('0x3')][_0x5b7a('0x4')],config[_0x5b7a('0x3')]['ip'],config[_0x5b7a('0x3')][_0x5b7a('0x2')],util[_0x5b7a('0xc')](_0x4760b9,![],null)));}function close(){logger[_0x5b7a('0xd')](util['format'](_0x5b7a('0xe'),config[_0x5b7a('0x3')][_0x5b7a('0x4')],config[_0x5b7a('0x3')]['ip'],config[_0x5b7a('0x3')][_0x5b7a('0x2')]));}ami[_0x5b7a('0xf')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x5b7a('0x7')]({'action':_0x5b7a('0x10')});};};ami[_0x5b7a('0x11')]=function(){return function(){return ami[_0x5b7a('0x7')]({'action':_0x5b7a('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x5b7a('0x7')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x5b7a('0x7')]({'action':_0x5b7a('0x13')});};};function connect(){logger['info'](util[_0x5b7a('0xa')](_0x5b7a('0x14'),config['asterisk'][_0x5b7a('0x4')],config[_0x5b7a('0x3')]['ip'],config[_0x5b7a('0x3')][_0x5b7a('0x2')]));ami[_0x5b7a('0x15')](_0x5b7a('0xd'),error);ami[_0x5b7a('0x15')]('close',close);}ami['on'](_0x5b7a('0x16'),connect);ami['on'](_0x5b7a('0x17'),function(_0x2461cd){logger[_0x5b7a('0x18')](util[_0x5b7a('0xa')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x5b7a('0x3')][_0x5b7a('0x4')],config['asterisk']['ip'],config[_0x5b7a('0x3')][_0x5b7a('0x2')],util['inspect'](_0x2461cd,![],null)));});ami['on'](_0x5b7a('0x19'),function(){logger['info'](util['format'](_0x5b7a('0x1a'),config[_0x5b7a('0x3')][_0x5b7a('0x4')],config['asterisk']['ip'],config[_0x5b7a('0x3')][_0x5b7a('0x2')]));return Promise[_0x5b7a('0x1b')]()[_0x5b7a('0x1c')](ami[_0x5b7a('0xf')]())[_0x5b7a('0x1c')](ami['actionDeviceStateList']())[_0x5b7a('0x1c')](ami[_0x5b7a('0x11')]())[_0x5b7a('0x1c')](ami[_0x5b7a('0x1d')]())[_0x5b7a('0x1c')](ami[_0x5b7a('0x1e')]())['catch'](function(_0x4c566e){logger[_0x5b7a('0xd')](_0x5b7a('0x1f'),util['inspect'](_0x4c566e,{'showHidden':![],'depth':null}));});});ami[_0x5b7a('0x15')](_0x5b7a('0xd'),error);ami[_0x5b7a('0x15')](_0x5b7a('0x20'),close);module[_0x5b7a('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 9420e46..6b07581 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 _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xac4a,0x13f));var _0xaac4=function(_0x509d1f,_0x245ab8){_0x509d1f=_0x509d1f-0x0;var _0x4a5989=_0xac4a[_0x509d1f];return _0x4a5989;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x100770,_0x2a6617){var _0x26c777=function(_0x58174d){while(--_0x58174d){_0x100770['push'](_0x100770['shift']());}};_0x26c777(++_0x2a6617);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 5b5df1b..d23e234 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 _0x9f7c=['isNil','paused','locked','stateinterface','syncQueueStatusComplete','roundrobin','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','dialAMDActive','value','HANGUP','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','[rescheduleContact][Machine]','saveInDb','countcongestionretry','dialMachineRetryFrequency','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','talking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','throttle','filter','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','[syncQueueCallerAbandon]\x20[Drop]','Agent','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','xcally-motion-dialer','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','dialPrefix','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','predictiveIntervalErlangCallsDroppedCalls','dropRate','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','check\x20failure','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','dialMethod','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','getContactDialerIvr','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','checkContactEmpty','[countReScheduled]\x20','checkIsBlackList','tryOriginatePredictive','dialOrderByScheduledAt','countReScheduled','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','ioredis','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','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','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','Error','prototype','isTrunkReachable','active','status','reachable','SIP/%s','unmonitored','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','command','interval','content','indexOf','true','catch','Action','iftime\x20%s,%s','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','type','ivr','updateOriginated','outboundAnswerCallsDay','agent','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','state','Drop','dropreason','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','swapAdditionalPhones','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','minutes','ContactId','[rescheduleContact][Abandoned]','calleridnum','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','strategy'];(function(_0x3e71bf,_0x39cc5f){var _0x3bde2c=function(_0x5295bd){while(--_0x5295bd){_0x3e71bf['push'](_0x3e71bf['shift']());}};_0x3bde2c(++_0x39cc5f);}(_0x9f7c,0x126));var _0xc9f7=function(_0x372a53,_0x1c72b9){_0x372a53=_0x372a53-0x0;var _0x13379f=_0x9f7c[_0x372a53];return _0x13379f;};'use strict';var util=require(_0xc9f7('0x0'));var _=require(_0xc9f7('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require(_0xc9f7('0x2'));var utils=require('./utils');var hopperUtils=require(_0xc9f7('0x3'));var ut=require('../preview/util/util');var config=require(_0xc9f7('0x4'));var logger=require(_0xc9f7('0x5'))(_0xc9f7('0x6'));var loggerBooked=require(_0xc9f7('0x5'))(_0xc9f7('0x7'));var loggerPredictive=require('../../../config/logger')(_0xc9f7('0x8'));var loggerPredictiveCalls=require(_0xc9f7('0x5'))(_0xc9f7('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xc9f7('0xa'));var ami=require(_0xc9f7('0xb'));config[_0xc9f7('0xc')]=_['defaults'](config[_0xc9f7('0xc')],{'host':_0xc9f7('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0xc9f7('0xe'));var RpcSetting=require(_0xc9f7('0xf'));var Interval=require(_0xc9f7('0x10'));var Action=require(_0xc9f7('0x11'));var History=require(_0xc9f7('0x12'));var Final=require(_0xc9f7('0x13'));var AgentComplete=require(_0xc9f7('0x14'));var QueueCallerAbandon=require(_0xc9f7('0x15'));var Hangup=require(_0xc9f7('0x16'));var ipAgi=process[_0xc9f7('0x17')][_0xc9f7('0x18')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0xf10a67){this['tail']=this[_0xc9f7('0x19')]?this[_0xc9f7('0x19')][_0xc9f7('0x1a')](_0xf10a67):_0xf10a67();};function Dialer(_0x49764c,_0x306b27){this[_0xc9f7('0x1b')]=new Sequence();this[_0xc9f7('0x1c')]=_0x306b27;this[_0xc9f7('0x1d')]=_0x49764c[_0xc9f7('0x1d')];this[_0xc9f7('0x1e')]=_0x49764c[_0xc9f7('0x1e')];this['agents']=_0x49764c[_0xc9f7('0x1f')];this[_0xc9f7('0x20')]=_0x49764c[_0xc9f7('0x20')];this['maxNumberOriginate']=config[_0xc9f7('0x21')]||0x2;this[_0xc9f7('0x22')]={};this[_0xc9f7('0x23')]={};this[_0xc9f7('0x24')]={};this[_0xc9f7('0x25')]={};this[_0xc9f7('0x26')]={};this[_0xc9f7('0x27')]={};this[_0xc9f7('0x28')]={};this[_0xc9f7('0x29')]={};this[_0xc9f7('0x2a')]={};this['queueBookedRR']={};this[_0xc9f7('0x2b')]={};ami['on'](_0xc9f7('0x2c'),this[_0xc9f7('0x2d')][_0xc9f7('0x2e')](this));ami['on'](_0xc9f7('0x2f'),this[_0xc9f7('0x30')][_0xc9f7('0x2e')](this));ami['on'](_0xc9f7('0x31'),this[_0xc9f7('0x32')][_0xc9f7('0x2e')](this));ami['on'](_0xc9f7('0x33'),this[_0xc9f7('0x34')]['bind'](this));ami['on'](_0xc9f7('0x35'),this[_0xc9f7('0xa')][_0xc9f7('0x2e')](this));ami['on'](_0xc9f7('0x36'),this[_0xc9f7('0x37')]['bind'](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xc9f7('0x38'),this['syncNewExten'][_0xc9f7('0x2e')](this));ami['on'](_0xc9f7('0x39'),this[_0xc9f7('0x3a')][_0xc9f7('0x2e')](this));ami['on'](_0xc9f7('0x3b'),this[_0xc9f7('0x3c')][_0xc9f7('0x2e')](this));ami['on'](_0xc9f7('0x3d'),this['syncQueueStatusComplete'][_0xc9f7('0x2e')](this));this[_0xc9f7('0x3e')]();this[_0xc9f7('0x3f')]();RpcSetting['getSettings']()[_0xc9f7('0x40')](function(_0x45dc3a){previewRecallmeReminderInterval=_0x45dc3a[_0xc9f7('0x41')];});}function isNotNull(_0x5eea87){return _0x5eea87!==null&&!_[_0xc9f7('0x42')](_0x5eea87);}function msgResponse(_0x1388a7,_0x505414,_0x4d1f25){return{'action':_0x1388a7,'response':_0x505414,'message':_0x4d1f25,'stack':_0x4d1f25};}function emit(_0x3aca2f,_0x1f2f25,_0x422948){io['to'](_0x3aca2f)[_0xc9f7('0x43')](_0x1f2f25,_0x422948);}function emitOutboundVoiceQueueSummary(_0x53c398){if(_0x53c398['type']===_0xc9f7('0x44')){logger[_0xc9f7('0x45')](_0xc9f7('0x46'),util[_0xc9f7('0x47')](_0x53c398,{'showHidden':![],'depth':null}));emit(util[_0xc9f7('0x48')](_0xc9f7('0x49'),_0x53c398[_0xc9f7('0x4a')]),'voice_queue:save',_0x53c398);}}function checkGetDataPredictive(_0x2efbd2){if(isNotNull(_0x2efbd2)&&!_[_0xc9f7('0x4b')](_0x2efbd2)){loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x4d'));loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x4e'),_0x2efbd2[_0xc9f7('0x4f')]);loggerPredictive['info'](_0xc9f7('0x50'),_0x2efbd2['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x51'),_0x2efbd2[_0xc9f7('0x52')]);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x53'),_0x2efbd2[_0xc9f7('0x54')]);loggerPredictive[_0xc9f7('0x4c')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2efbd2[_0xc9f7('0x55')]);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x56'),_0x2efbd2[_0xc9f7('0x57')]);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x58'));if(_0x2efbd2[_0xc9f7('0x4f')]>0x0){if(!_[_0xc9f7('0x42')](_0x2efbd2[_0xc9f7('0x57')])&&_0x2efbd2['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x59'));if(!_['isUndefined'](_0x2efbd2['predictiveIntervalAvgHoldtime'])&&_0x2efbd2[_0xc9f7('0x55')]>0x0){return!![];}loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x5a'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x5b'));}return![];}function mergeDataErlangB(_0x39aaff){return function(_0x24f736){loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x5c'));loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x5d'),_0x24f736[_0xc9f7('0x5e')]);loggerPredictive[_0xc9f7('0x4c')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x24f736[_0xc9f7('0x5f')]);loggerPredictive[_0xc9f7('0x4c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x24f736[_0xc9f7('0x60')]);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x61'),_0x24f736[_0xc9f7('0x62')]);loggerPredictive['info'](_0xc9f7('0x63'),_0x24f736[_0xc9f7('0x60')]);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x58'));_[_0xc9f7('0x64')](_0x39aaff,_0x24f736);};}function ifInterval(_0x268684,_0x36e62b){if(_[_0xc9f7('0x42')](_0x36e62b)){return![];}return utils[_0xc9f7('0x65')](undefined,_0x36e62b)<_0x268684*0x3c;}function clearPredictiveAttributes(_0x4f8f07){if(_0x4f8f07[_0xc9f7('0x28')]){_0x4f8f07[_0xc9f7('0x28')]=undefined;loggerPredictive[_0xc9f7('0x45')](_0x4f8f07['name'],_0xc9f7('0x66'));}if(_0x4f8f07[_0xc9f7('0x27')]){_0x4f8f07[_0xc9f7('0x27')]=undefined;loggerPredictive['debug'](_0x4f8f07[_0xc9f7('0x4a')],_0xc9f7('0x67'));}if(_0x4f8f07[_0xc9f7('0x68')]){clearInterval(_0x4f8f07[_0xc9f7('0x68')]);_0x4f8f07[_0xc9f7('0x68')]=undefined;loggerPredictive[_0xc9f7('0x45')](_0x4f8f07[_0xc9f7('0x4a')],_0xc9f7('0x69'));}}function loggerCatchPredictive(_0x536f97,_0x583008){return function(_0x43cb75){loggerPredictive[_0xc9f7('0x6a')](_0x583008[_0xc9f7('0x4a')],_0x536f97);loggerPredictive[_0xc9f7('0x6a')](_0x43cb75[_0xc9f7('0x6b')]);clearPredictiveAttributes(_0x583008);};}function loggerCatch(_0x515cfb){return function(_0x1ae98a){logger[_0xc9f7('0x6a')](_0x515cfb,util[_0xc9f7('0x47')](_0x1ae98a,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x359186,_0x2ef57e,_0x2bca49){return function(_0x4bd05b){utils['checkContactLowerLimitOriginate'](_0x2ef57e,_0x2bca49,0x0);logger[_0xc9f7('0x6a')](_0x359186,util['inspect'](_0x4bd05b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xed47a8){return function(_0x2c0e6a){if(isNotNull(_0x2c0e6a)&&isNotNull(_0x2c0e6a[0x0])){if(_0x2c0e6a[0x0][_0xc9f7('0x6c')]>0x0){_0xed47a8[_0xc9f7('0x6d')]=utils[_0xc9f7('0x6e')][_0xc9f7('0x6f')];logger['info'](_0xc9f7('0x70')+_0xed47a8[_0xc9f7('0x4a')],_0x2c0e6a[0x0][_0xc9f7('0x6c')],_0xc9f7('0x71'));}else{_0xed47a8[_0xc9f7('0x6d')]=utils['CAMPAIGN_STATUS'][_0xc9f7('0x72')];logger[_0xc9f7('0x4c')](_0xc9f7('0x73')+_0xed47a8[_0xc9f7('0x4a')]);}}};}function createObjHistory(_0x5a319d,_0x1aab43,_0x5481aa,_0x5916b9,_0x5e7248){_0x5a319d[_0xc9f7('0x6d')]=_0x5481aa;var _0x2507b5=new Action(_0x5a319d,_0x1aab43);var _0x2977f4=new History(_0x2507b5);_0x2977f4['state']=_0x5916b9;_0x2977f4[_0xc9f7('0x74')]=_0x5e7248;_0x2977f4[_0xc9f7('0x75')]=_0x2507b5[_0xc9f7('0x76')];return _0x2977f4;}function unlockQueueStatus(_0x440171,_0x4ab08d){setTimeout(function(){if(_[_0xc9f7('0x42')](_0x440171[_0xc9f7('0x77')])){loggerBooked[_0xc9f7('0x6a')](_0xc9f7('0x78'),_0x4ab08d);}_0x440171[_0xc9f7('0x77')]=!![];loggerBooked[_0xc9f7('0x4c')](_0xc9f7('0x79'),_0x4ab08d,JSON[_0xc9f7('0x7a')](_[_0xc9f7('0x7b')](_0x440171,['name',_0xc9f7('0x77')])));},0x1f3);}function checkInterval(_0x298214){return function(){if(!isNotNull(_0x298214[_0xc9f7('0x7c')])){_0x298214[_0xc9f7('0x6d')]=utils[_0xc9f7('0x6e')][_0xc9f7('0x7d')];throw _0x298214[_0xc9f7('0x4a')]+_0xc9f7('0x7e');}if(!isNotNull(_0x298214[_0xc9f7('0x7c')][_0xc9f7('0x7f')])){_0x298214[_0xc9f7('0x6d')]=utils[_0xc9f7('0x6e')][_0xc9f7('0x7d')];throw _0x298214[_0xc9f7('0x4a')]+_0xc9f7('0x7e');}if(!isNotNull(_[_0xc9f7('0x4b')](_0x298214[_0xc9f7('0x7c')][_0xc9f7('0x7f')]))){_0x298214[_0xc9f7('0x6d')]=utils[_0xc9f7('0x6e')][_0xc9f7('0x7d')];throw _0x298214[_0xc9f7('0x4a')]+_0xc9f7('0x7e');}};}function checkIsIVRCampaignActive(_0x54b4df){return function(){if(!utils[_0xc9f7('0x80')](_0x54b4df)){_0x54b4df[_0xc9f7('0x6d')]=utils[_0xc9f7('0x6e')][_0xc9f7('0x81')];throw _0x54b4df[_0xc9f7('0x4a')]+_0xc9f7('0x82');}};}function emitCampaignSummary(_0x735e25){if(utils[_0xc9f7('0x83')](_0x735e25)){emit(util[_0xc9f7('0x48')](_0xc9f7('0x84'),_0x735e25[_0xc9f7('0x4a')]),'campaign:save',_0x735e25);}}function loggerCatchQueueSummary(_0x2cc23a,_0x3e7413){return function(_0x626e88){clearPredictiveAttributes(_0x3e7413);emitCampaignSummary(_0x3e7413);loggerSyncQueueSummary[_0xc9f7('0x45')](_0x2cc23a,util[_0xc9f7('0x47')](_0x626e88,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5aa212){if(_0x5aa212[_0xc9f7('0x85')]){if(_0x5aa212[_0xc9f7('0x86')]===0x0){_0x5aa212['sendMessageOneNotActive']=![];_0x5aa212[_0xc9f7('0x6d')]=utils['CAMPAIGN_STATUS'][_0xc9f7('0x81')];loggerSyncQueueSummary[_0xc9f7('0x45')](_0xc9f7('0x87'),_0x5aa212[_0xc9f7('0x4a')],'is\x20not\x20active');}else{_0x5aa212[_0xc9f7('0x6d')]=utils[_0xc9f7('0x6e')][_0xc9f7('0x88')];loggerSyncQueueSummary[_0xc9f7('0x45')](_0xc9f7('0x87'),_0x5aa212[_0xc9f7('0x4a')],_0xc9f7('0x89'));}emitCampaignSummary(_0x5aa212);}}function myreject(_0x3f056d){return function(_0x7f9fe1){return _0x3f056d(msgResponse('[ifTime][Action]',_0xc9f7('0x8a'),JSON[_0xc9f7('0x7a')](_0x7f9fe1)));};}Dialer[_0xc9f7('0x8b')][_0xc9f7('0x8c')]=function(_0x273459){return!_['isUndefined'](_0x273459)&&_0x273459&&!_[_0xc9f7('0x42')](_0x273459[_0xc9f7('0x4a')])&&!_[_0xc9f7('0x42')](_0x273459['active'])&&_0x273459[_0xc9f7('0x8d')]&&(this[_0xc9f7('0x20')][util['format']('SIP/%s',_0x273459[_0xc9f7('0x4a')])][_0xc9f7('0x8e')]===_0xc9f7('0x8f')||this[_0xc9f7('0x20')][util['format'](_0xc9f7('0x90'),_0x273459[_0xc9f7('0x4a')])][_0xc9f7('0x8e')]===_0xc9f7('0x91'));};Dialer[_0xc9f7('0x8b')]['checkIsTrunkReachable']=function(_0x27ded3){var _0x50296f=this;return function(){if(!_0x50296f[_0xc9f7('0x8c')](_0x27ded3[_0xc9f7('0x92')])){if(!_0x50296f[_0xc9f7('0x8c')](_0x27ded3['TrunkBackup'])){_0x27ded3[_0xc9f7('0x6d')]=utils[_0xc9f7('0x6e')][_0xc9f7('0x93')];throw _0x27ded3[_0xc9f7('0x4a')]+_0xc9f7('0x94');}}};};Dialer[_0xc9f7('0x8b')]['checkIfTime']=function(_0x4eb5fb,_0x37ef5e,_0xf67d70,_0x1517fd){var _0x31502e=this;return function(){var _0x481df3=!![];return _0x31502e[_0xc9f7('0x95')](_0x4eb5fb,_0x37ef5e,_0xf67d70,_0x1517fd,_0x481df3);};};Dialer['prototype'][_0xc9f7('0x96')]=function(_0x65ce24,_0x37a657,_0x4f5929,_0xbe097f){var _0x2f5a80=this;return function(){var _0x58e667=![];return _0x2f5a80[_0xc9f7('0x95')](_0x65ce24['Intervals'],_0x37a657,_0x4f5929,_0xbe097f,_0x58e667);};};Dialer['prototype']['ifTimeIvr']=function(_0xf4120e,_0x52b845,_0x47305b,_0x1c97b7,_0x2a62a9){var _0x3f3121=[];return new Promise(function(_0x5fa41d,_0x11b7fd){if(!isNotNull(_0xf4120e)){_0x1c97b7['message']=utils[_0xc9f7('0x6e')][_0xc9f7('0x7d')];return _0x11b7fd(msgResponse(_0xc9f7('0x97'),'Failure',_0x47305b+_0xc9f7('0x98')));}if(_['isEmpty'](_0xf4120e)){_0x1c97b7[_0xc9f7('0x6d')]=utils[_0xc9f7('0x6e')][_0xc9f7('0x99')];return _0x11b7fd(msgResponse(_0xc9f7('0x97'),_0xc9f7('0x9a'),_0x47305b+_0xc9f7('0x9b')));}if(_0x52b845&&_[_0xc9f7('0x42')](config[_0xc9f7('0x9c')][_0x52b845])){_0x1c97b7[_0xc9f7('0x6d')]=utils[_0xc9f7('0x6e')][_0xc9f7('0x9d')];return _0x11b7fd(msgResponse(_0xc9f7('0x97'),_0xc9f7('0x9a'),_0x47305b+_0xc9f7('0x9e')+_0x52b845));}if(_[_0xc9f7('0x9f')](_0xf4120e)){for(var _0xe824aa=0x0;_0xe824aa<_0xf4120e[_0xc9f7('0xa0')];_0xe824aa+=0x1){_0x3f3121[_0xc9f7('0xa1')](ami['Action']({'action':_0xc9f7('0xa2'),'command':util[_0xc9f7('0x48')]('iftime\x20%s,%s',_0xf4120e[_0xe824aa][_0xc9f7('0xa3')],!_[_0xc9f7('0x42')](config['timezones'][_0x52b845])?_0x52b845:'')})[_0xc9f7('0x40')](function(_0x40ae35){return _0x40ae35[_0xc9f7('0xa4')][_0xc9f7('0xa5')](_0xc9f7('0xa6'))>=0x0;})[_0xc9f7('0xa7')](myreject(_0x11b7fd)));}}else{_0x3f3121['push'](ami[_0xc9f7('0xa8')]({'action':_0xc9f7('0xa2'),'command':util['format'](_0xc9f7('0xa9'),_0xf4120e,!_['isUndefined'](config[_0xc9f7('0x9c')][_0x52b845])?_0x52b845:'')})[_0xc9f7('0x40')](function(_0x275b0c){return _0x275b0c['content']['indexOf'](_0xc9f7('0xa6'))>=0x0;})[_0xc9f7('0xa7')](myreject(_0x11b7fd)));}Promise[_0xc9f7('0xaa')](_0x3f3121)[_0xc9f7('0x40')](function(_0x2fd284){var _0x5d9f19=_[_0xc9f7('0xab')](_0x2fd284);if(_0x5d9f19){return _0x5fa41d(_0x5d9f19);}else{_0x1c97b7[_0xc9f7('0x6d')]=_0x2a62a9?utils[_0xc9f7('0x6e')][_0xc9f7('0xac')]:utils[_0xc9f7('0x6e')]['OVERTIME_INTERVAL'];return _0x11b7fd(msgResponse(_0xc9f7('0xad'),_0xc9f7('0x9a'),_0xc9f7('0xae')+_0x2a62a9+'\x20'+_0x47305b+_0xc9f7('0xaf')+util[_0xc9f7('0x47')](_0xf4120e,{'showHidden':![],'depth':null})+_0xc9f7('0xb0')+_0x52b845));}})['catch'](function(_0x457797){return _0x11b7fd(msgResponse(_0xc9f7('0x97'),_0xc9f7('0x9a'),JSON[_0xc9f7('0x7a')](_0x457797)));});});};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x3e')]=function(){var _0x29a07c=this;return cmHopper[_0xc9f7('0xb1')]({'active':![]},{'where':{'active':!![]}})[_0xc9f7('0x40')](function(){setInterval(function(){_0x29a07c[_0xc9f7('0xb2')]();},0x3e8);});};Dialer[_0xc9f7('0x8b')][_0xc9f7('0xb2')]=function(){var _0x420f64=this;var _0x307d7b;for(var _0x3e1455 in this[_0xc9f7('0x1e')]){if(typeof this[_0xc9f7('0x1e')][_0x3e1455]!==_0xc9f7('0xb3')){_0x307d7b=this[_0xc9f7('0x1e')][_0x3e1455];if(utils[_0xc9f7('0x83')](_0x307d7b)&&utils[_0xc9f7('0x80')](_0x307d7b)){_0x307d7b[_0xc9f7('0x85')]=!![];Promise[_0xc9f7('0xb4')]()[_0xc9f7('0x40')](checkIsIVRCampaignActive(_0x307d7b))[_0xc9f7('0x40')](checkInterval(_0x307d7b))[_0xc9f7('0x40')](_0x420f64[_0xc9f7('0xb5')](_0x307d7b))[_0xc9f7('0x40')](_0x420f64[_0xc9f7('0xb6')](_0x307d7b[_0xc9f7('0xb7')],_0x307d7b[_0xc9f7('0xb8')],_0x307d7b[_0xc9f7('0x4a')],_0x307d7b))[_0xc9f7('0x40')](_0x420f64[_0xc9f7('0x96')](_0x307d7b[_0xc9f7('0x7c')],_0x307d7b[_0xc9f7('0xb8')],_0x307d7b[_0xc9f7('0x4a')],_0x307d7b))[_0xc9f7('0x40')](_0x420f64[_0xc9f7('0xb9')](_0x307d7b))[_0xc9f7('0xa7')](loggerCatchQueueSummary('[syncCampaigns]',_0x307d7b));}else{notSendMessagesCampaign(_0x307d7b);}}}};Dialer[_0xc9f7('0x8b')][_0xc9f7('0xba')]=function(_0x3af9f3){if(_0x3af9f3['dialMethod']!==_0xc9f7('0x8')){clearPredictiveAttributes(_0x3af9f3);}switch(_0x3af9f3['dialMethod']){case _0xc9f7('0xbb'):this[_0xc9f7('0xbc')](_0x3af9f3,0x1);break;case _0xc9f7('0xbd'):this['handlePower'](_0x3af9f3,_0x3af9f3[_0xc9f7('0xbe')]);break;case _0xc9f7('0x8'):this[_0xc9f7('0x8')](_0x3af9f3);break;case'booked':this['handlePower'](_0x3af9f3,0x1);break;default:logger['error']('Queue',_0x3af9f3[_0xc9f7('0x4a')],_0xc9f7('0xbf'));}};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x97')]=function(_0x3b4e53,_0x4612e2){var _0x349175=_0x3b4e53[_0xc9f7('0xb8')];var _0x89d1a5=_0x4612e2?_0x3b4e53[_0xc9f7('0xb7')]:_0x3b4e53[_0xc9f7('0x7c')][_0xc9f7('0x7f')];logger[_0xc9f7('0xc0')](_0xc9f7('0xc1'),_0x89d1a5,_0x349175,_0x3b4e53['name'],util[_0xc9f7('0x48')](_0xc9f7('0xc2'),_0x3b4e53[_0xc9f7('0x4a')],_0x3b4e53['id']));var _0x58449b=null;return Interval[_0xc9f7('0xc3')](_0x89d1a5,_0x349175)['then'](function(_0x52cd99){if(_0x52cd99===!![]){return _0x52cd99;}else{_0x3b4e53[_0xc9f7('0x6d')]=_0x4612e2?utils[_0xc9f7('0x6e')][_0xc9f7('0xac')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];_0x58449b=msgResponse(_0xc9f7('0xad'),_0xc9f7('0x9a'),'Global:\x20'+_0x4612e2+'\x20'+_0x3b4e53[_0xc9f7('0x4a')]+_0xc9f7('0xaf')+util[_0xc9f7('0x47')](_0x89d1a5,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x349175);}if(_0x58449b!==null){logger['silly'](_0xc9f7('0xc4'),_0x58449b);_0x58449b[_0xc9f7('0xc5')]=_0x4612e2;throw _0x58449b;}})['catch'](function(_0x22e6d0){logger[_0xc9f7('0x6a')](_0xc9f7('0xc6'),_0x22e6d0);throw msgResponse(_0xc9f7('0xc7'),_0xc9f7('0x8a'),util[_0xc9f7('0x47')](_0x22e6d0,{'showHidden':![],'depth':null}));});};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x2d')]=function(_0x45a80f){if(this['voiceQueues'][_0x45a80f[_0xc9f7('0xc8')]]){if(this['uniqueId'][_0x45a80f[_0xc9f7('0xc9')]]&&this[_0xc9f7('0x25')][_0x45a80f[_0xc9f7('0xc9')]][_0xc9f7('0xca')]!==_0xc9f7('0xcb')){this[_0xc9f7('0xcc')](this[_0xc9f7('0x1d')][_0x45a80f['queue']]);this[_0xc9f7('0x25')][_0x45a80f[_0xc9f7('0xc9')]]['answertime']=moment()[_0xc9f7('0x48')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x34')]=function(_0x2171b6){var _0x3a65ae=this[_0xc9f7('0x25')][_0x2171b6[_0xc9f7('0xc9')]];if(this[_0xc9f7('0x1d')][_0x2171b6[_0xc9f7('0xc8')]]){if(_0x3a65ae&&_0x3a65ae[_0xc9f7('0xca')]!==_0xc9f7('0xcb')){delete this['uniqueId'][_0x2171b6[_0xc9f7('0xc9')]];this[_0xc9f7('0x1d')][_0x2171b6[_0xc9f7('0xc8')]][_0xc9f7('0xcd')]+=0x1;var _0x3682a3=new AgentComplete(_0x3a65ae,_0x2171b6);if(_0x2171b6['reason']===_0xc9f7('0xce')){_0x3682a3['agiafterat']=this[_0xc9f7('0x1d')][_0x2171b6[_0xc9f7('0xc8')]][_0xc9f7('0xcf')]&&this[_0xc9f7('0x1d')][_0x2171b6['queue']][_0xc9f7('0xd0')]?moment()['format'](_0xc9f7('0xd1')):undefined;}hopperUtils[_0xc9f7('0xd2')](_0x3682a3)['catch'](loggerCatch(_0xc9f7('0xd3')));hopperUtils[_0xc9f7('0xd4')](_0x3682a3)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0xd5')));}}};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x30')]=function(_0x5ab89){var _0x2b3fb1=this[_0xc9f7('0x25')][_0x5ab89['uniqueid']];var _0x4e3616=this;var _0xf3cb57=![];var _0x3772ad;var _0x65b3df;if(this[_0xc9f7('0x1d')][_0x5ab89[_0xc9f7('0xc8')]]){if(_0x2b3fb1&&_0x2b3fb1[_0xc9f7('0xca')]!==_0xc9f7('0xcb')){delete this[_0xc9f7('0x25')][_0x5ab89[_0xc9f7('0xc9')]];this[_0xc9f7('0xcc')](this[_0xc9f7('0x1d')][_0x5ab89[_0xc9f7('0xc8')]]);_0x2b3fb1['droptime']=moment()[_0xc9f7('0x48')](_0xc9f7('0xd1'));var _0x5d79cb=new QueueCallerAbandon(_0x2b3fb1,_0x5ab89);if(utils[_0xc9f7('0x65')](_0x2b3fb1[_0xc9f7('0xd6')],_0x2b3fb1['responsetime'])>=_0x2b3fb1[_0xc9f7('0xd7')]){this[_0xc9f7('0x1d')][_0x5ab89[_0xc9f7('0xc8')]][_0xc9f7('0x52')]+=0x1;this[_0xc9f7('0x1d')][_0x5ab89[_0xc9f7('0xc8')]][_0xc9f7('0xd8')]+=0x1;this[_0xc9f7('0x1d')][_0x5ab89[_0xc9f7('0xc8')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x5d79cb[_0xc9f7('0xd9')]=0xa;_0x5d79cb[_0xc9f7('0x74')]=_0xc9f7('0xda');_0x5d79cb[_0xc9f7('0xdb')]='TIMEOUT';_0x5d79cb['agiafterat']=this['voiceQueues'][_0x5ab89[_0xc9f7('0xc8')]][_0xc9f7('0xcf')]?moment()[_0xc9f7('0x48')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x5d79cb['countdropretry']+=0x1;_0x5d79cb['countglobal']+=0x1;_0x3772ad=this[_0xc9f7('0x1d')][_0x5ab89[_0xc9f7('0xc8')]][_0xc9f7('0xdc')];_0x65b3df=this['voiceQueues'][_0x5ab89[_0xc9f7('0xc8')]][_0xc9f7('0xdd')];hopperUtils[_0xc9f7('0xde')](_0x5d79cb,_0x5d79cb[_0xc9f7('0xd9')],_0x2b3fb1[_0xc9f7('0xdf')])[_0xc9f7('0x40')](function(_0x1ad354){_0xf3cb57=_0x1ad354[_0xc9f7('0xe0')]==0x1;if(_0x5d79cb[_0xc9f7('0xe1')]>=_0x4e3616[_0xc9f7('0x1d')][_0x5ab89['queue']][_0xc9f7('0xe2')]){_0x4e3616[_0xc9f7('0xe3')](_0x5d79cb,_0x1ad354[_0xc9f7('0xe0')]);}else{hopperUtils[_0xc9f7('0xe4')]({'active':![],'countdropretry':_0x5d79cb['countdropretry'],'scheduledat':moment()[_0xc9f7('0xe5')](_0x4e3616['voiceQueues'][_0x5ab89[_0xc9f7('0xc8')]][_0xc9f7('0xdc')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b3fb1['ContactId'],'ListId':_0x2b3fb1[_0xc9f7('0xe6')],'VoiceQueueId':_0x2b3fb1[_0xc9f7('0xe7')]||undefined,'CampaignId':_0x2b3fb1[_0xc9f7('0xe8')]||undefined})[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0xe9')));var _0x2c69db=new History(_0x5d79cb);_0x2c69db[_0xc9f7('0xd9')]=0xa;_0x2c69db['statedesc']=_0xc9f7('0xda');_0x2c69db[_0xc9f7('0x76')]=moment()[_0xc9f7('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c69db['endtime']=_0x2c69db[_0xc9f7('0x76')];_0x2c69db[_0xc9f7('0xea')]=_0x5d79cb[_0xc9f7('0xea')];_0x2c69db['calleridnum']=_0x5d79cb['calleridnum'];hopperUtils['createHistory'](_0x2c69db)[_0xc9f7('0xa7')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xc9f7('0x40')](function(){if(_0xf3cb57)hopperUtils[_0xc9f7('0xeb')](_0x5d79cb,_0x3772ad,_0x65b3df)[_0xc9f7('0x40')](function(){return 0x1;});});}else{this[_0xc9f7('0x1d')][_0x5ab89[_0xc9f7('0xc8')]][_0xc9f7('0x54')]+=0x1;this[_0xc9f7('0x1d')][_0x5ab89['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x5d79cb[_0xc9f7('0xd9')]=0xb;_0x5d79cb[_0xc9f7('0x74')]=_0xc9f7('0xec');_0x5d79cb[_0xc9f7('0xdb')]=_0xc9f7('0xed');_0x5d79cb[_0xc9f7('0xee')]+=0x1;_0x5d79cb['countglobal']+=0x1;_0x3772ad=this[_0xc9f7('0x1d')][_0x5ab89[_0xc9f7('0xc8')]][_0xc9f7('0xef')];_0x65b3df=this[_0xc9f7('0x1d')][_0x5ab89['queue']][_0xc9f7('0xdd')];hopperUtils[_0xc9f7('0xde')](_0x5d79cb,_0x5d79cb[_0xc9f7('0xd9')],_0x2b3fb1[_0xc9f7('0xdf')])['then'](function(_0xd43309){if(_0x5d79cb[_0xc9f7('0xee')]>=_0x4e3616[_0xc9f7('0x1d')][_0x5ab89[_0xc9f7('0xc8')]][_0xc9f7('0xf0')]){_0x4e3616[_0xc9f7('0xe3')](_0x5d79cb,_0xd43309['additional']);}else{hopperUtils[_0xc9f7('0xe4')]({'active':![],'countabandonedretry':_0x5d79cb[_0xc9f7('0xee')],'scheduledat':moment()['add'](_0x4e3616['voiceQueues'][_0x5ab89[_0xc9f7('0xc8')]][_0xc9f7('0xef')],_0xc9f7('0xf1'))[_0xc9f7('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b3fb1[_0xc9f7('0xf2')],'ListId':_0x2b3fb1['ListId'],'VoiceQueueId':_0x2b3fb1['VoiceQueueId']||undefined,'CampaignId':_0x2b3fb1[_0xc9f7('0xe8')]||undefined})['catch'](loggerCatch(_0xc9f7('0xf3')));var _0x29b81a=new History(_0x5d79cb);_0x29b81a[_0xc9f7('0xd9')]=0xb;_0x29b81a[_0xc9f7('0x74')]='Abandoned';_0x29b81a[_0xc9f7('0x76')]=moment()[_0xc9f7('0x48')](_0xc9f7('0xd1'));_0x29b81a[_0xc9f7('0x75')]=_0x29b81a[_0xc9f7('0x76')];_0x29b81a['calleridname']=_0x5d79cb[_0xc9f7('0xea')];_0x29b81a['calleridnum']=_0x5d79cb[_0xc9f7('0xf4')];hopperUtils['createHistory'](_0x29b81a)['catch'](loggerCatch(_0xc9f7('0xf5')));}})[_0xc9f7('0x40')](function(){if(_0xf3cb57)hopperUtils[_0xc9f7('0xeb')](_0x5d79cb,_0x3772ad,_0x65b3df)[_0xc9f7('0x40')](function(){return 0x1;});});}}}};Dialer[_0xc9f7('0x8b')][_0xc9f7('0xf6')]=function(_0x2420a1){if(this[_0xc9f7('0x23')][_0x2420a1['uniqueid']]){this[_0xc9f7('0x23')][_0x2420a1[_0xc9f7('0xc9')]][_0xc9f7('0xf7')]=_0x2420a1[_0xc9f7('0xf7')];}if(this[_0xc9f7('0x25')][_0x2420a1[_0xc9f7('0xc9')]]){this[_0xc9f7('0x25')][_0x2420a1[_0xc9f7('0xc9')]][_0xc9f7('0xf7')]=_0x2420a1[_0xc9f7('0xf7')];}};Dialer['prototype'][_0xc9f7('0x3c')]=function(_0x29f069){if(!this[_0xc9f7('0x23')][_0x29f069[_0xc9f7('0xf8')]]){return;}var _0x1f2664=this['voiceQueues'][this['actions'][_0x29f069[_0xc9f7('0xf8')]]['queue']][_0xc9f7('0xf9')]||'rrmemory';if(_0x1f2664==='roundrobin'){if(this[_0xc9f7('0x23')][_0x29f069['actionid']]&&_[_0xc9f7('0xfa')](this[_0xc9f7('0x23')][_0x29f069[_0xc9f7('0xf8')]]['locked'])&&_0x29f069[_0xc9f7('0x8e')]==='1'&&_0x29f069[_0xc9f7('0xfb')]==='0'){if(this['agents'][_0x29f069['stateinterface']]){if(!this['agents'][_0x29f069['stateinterface']][_0xc9f7('0xfc')]){this[_0xc9f7('0x1f')][_0x29f069[_0xc9f7('0xfd')]][_0xc9f7('0xfc')]=!![];this[_0xc9f7('0x23')][_0x29f069[_0xc9f7('0xf8')]][_0xc9f7('0xfc')]=!![];this[_0xc9f7('0x23')][_0x29f069[_0xc9f7('0xf8')]][_0xc9f7('0xfd')]=_0x29f069[_0xc9f7('0xfd')];}}}}else if(_0x1f2664==='rrmemory'){if(this[_0xc9f7('0x23')][_0x29f069[_0xc9f7('0xf8')]]){if(this[_0xc9f7('0x1f')][_0x29f069['stateinterface']]){this['actions'][_0x29f069[_0xc9f7('0xf8')]][_0xc9f7('0xfd')]=_0x29f069[_0xc9f7('0xfd')];if(_[_0xc9f7('0xfa')](this[_0xc9f7('0x2a')][this['actions'][_0x29f069[_0xc9f7('0xf8')]]['queue']])){this[_0xc9f7('0x2a')][this['actions'][_0x29f069[_0xc9f7('0xf8')]][_0xc9f7('0xc8')]]=[];}this[_0xc9f7('0x2a')][this[_0xc9f7('0x23')][_0x29f069[_0xc9f7('0xf8')]][_0xc9f7('0xc8')]]['push'](_['merge'](_[_0xc9f7('0x7b')](this[_0xc9f7('0x23')][_0x29f069[_0xc9f7('0xf8')]],['idHopper','stateinterface']),{'status':_0x29f069[_0xc9f7('0x8e')],'paused':_0x29f069[_0xc9f7('0xfb')]}));}}}};Dialer[_0xc9f7('0x8b')][_0xc9f7('0xfe')]=function(_0x271b54){if(!this[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]]){return;}var _0x1dc718=this;var _0x14bb69=this[_0xc9f7('0x1d')][this[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]]['queue']];var _0x391884=_0x14bb69['strategy']||'rrmemory';if(_0x391884===_0xc9f7('0xff')){if(this[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]]&&this[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]][_0xc9f7('0xfd')]){this[_0xc9f7('0x1c')][_0xc9f7('0x100')](this['actions'][_0x271b54[_0xc9f7('0xf8')]][_0xc9f7('0x101')],this['actions'][_0x271b54[_0xc9f7('0xf8')]]['stateinterface'])['catch'](function(_0x414bb3){logger['error'](_0xc9f7('0x102'),util[_0xc9f7('0x47')](_0x414bb3,{'showHidden':![],'depth':null}));})[_0xc9f7('0x1a')](function(){_0x1dc718['updateOriginated'](_0x1dc718[_0xc9f7('0x1d')][_0x1dc718[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]]['queue']]);_0x1dc718[_0xc9f7('0x1f')][_0x1dc718[_0xc9f7('0x23')][_0x271b54['actionid']][_0xc9f7('0xfd')]]['locked']=![];delete _0x1dc718['actions'][_0x271b54[_0xc9f7('0xf8')]];unlockQueueStatus(_0x14bb69);});}else{this[_0xc9f7('0xcc')](this[_0xc9f7('0x1d')][this['actions'][_0x271b54[_0xc9f7('0xf8')]][_0xc9f7('0xc8')]]);hopperUtils[_0xc9f7('0xe4')]({'active':![],'ContactId':this[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]][_0xc9f7('0xf2')],'ListId':this[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]]['ListId'],'VoiceQueueId':this[_0xc9f7('0x23')][_0x271b54['actionid']][_0xc9f7('0xe7')]||undefined,'CampaignId':this[_0xc9f7('0x23')][_0x271b54['actionid']][_0xc9f7('0xe8')]||undefined})[_0xc9f7('0xa7')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]];unlockQueueStatus(_0x14bb69);}}else if(_0x391884==='rrmemory'){var _0x259743;if(this[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]]&&!_[_0xc9f7('0x4b')](this[_0xc9f7('0x2a')][this[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]][_0xc9f7('0xc8')]])){if(this[_0xc9f7('0x103')][_0x1dc718[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]][_0xc9f7('0xc8')]]){this['queueBookedRR'][_0x1dc718[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]][_0xc9f7('0xc8')]]=this[_0xc9f7('0x103')][this[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]][_0xc9f7('0xc8')]]?this[_0xc9f7('0x103')][this[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]][_0xc9f7('0xc8')]]:this[_0xc9f7('0x2a')][this['actions'][_0x271b54[_0xc9f7('0xf8')]][_0xc9f7('0xc8')]]?this[_0xc9f7('0x2a')][this['actions'][_0x271b54[_0xc9f7('0xf8')]][_0xc9f7('0xc8')]][_0xc9f7('0x104')]||0x0:0x0;}this[_0xc9f7('0x2a')][this[_0xc9f7('0x23')][_0x271b54[_0xc9f7('0xf8')]][_0xc9f7('0xc8')]][_0xc9f7('0x104')]=this['queueBookedRR'][this['actions'][_0x271b54[_0xc9f7('0xf8')]][_0xc9f7('0xc8')]];for(var _0x148a2c=0x0;_0x148a2c=_0x41bf22[_0xc9f7('0x12b')]){_0xb66705[_0xc9f7('0x12c')](_0x47bbb8,_0x178741,_0x2b090b,_0xc9f7('0x12d'));}else{if(_0x47bbb8[_0xc9f7('0x129')]>=_0x41bf22[_0xc9f7('0x12e')]){_0xb66705[_0xc9f7('0x12f')](_0x47bbb8,_0x178741,_0x2b090b,'reason\x2019\x20machine....');}else{hopperUtils[_0xc9f7('0xe4')]({'active':![],'countmachineretry':_0x47bbb8[_0xc9f7('0x129')],'scheduledat':moment()[_0xc9f7('0xe5')](_0x41bf22['dialMachineRetryFrequency'],_0xc9f7('0xf1'))[_0xc9f7('0x48')](_0xc9f7('0xd1')),'ContactId':_0x47bbb8['ContactId'],'ListId':_0x47bbb8[_0xc9f7('0xe6')],'VoiceQueueId':_0x47bbb8[_0xc9f7('0xe7')]||undefined,'CampaignId':_0x47bbb8['CampaignId']||undefined})['catch'](loggerCatch(_0xc9f7('0x130')));_0x178741({'reschedule':0x1});}}});}if(_0xf60e82['type']==='ivr'&&this[_0xc9f7('0x1e')][_0xf60e82[_0xc9f7('0xc8')]][_0xc9f7('0x117')]&&_0x3171fd[_0xc9f7('0x118')]===_0xc9f7('0x119')){delete this[_0xc9f7('0x25')][_0x3171fd['uniqueid']];this[_0xc9f7('0xcc')](this[_0xc9f7('0x1e')][_0xf60e82['queue']]);_0x309c53=new Hangup(_0xf60e82,_0x3171fd);_0x309c53[_0xc9f7('0xd9')]=0x12;_0x309c53['statedesc']='HangupInAMD';_0x309c53[_0xc9f7('0x11a')]=_0xc9f7('0x11b');ami['emit']('custom:amd',ut[_0xc9f7('0x11d')](_0x309c53,_0xc9f7('0x11e')));this[_0xc9f7('0x131')](_0x309c53,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0xf60e82[_0xc9f7('0xca')]===_0xc9f7('0xcb')&&this['campaigns'][_0xf60e82[_0xc9f7('0xc8')]][_0xc9f7('0x117')]&&_0x3171fd[_0xc9f7('0x118')]===_0xc9f7('0x121')){return new Promise(function(_0x4744e9,_0x2e993c){delete _0xb66705[_0xc9f7('0x25')][_0x3171fd[_0xc9f7('0xc9')]];_0xb66705['updateOriginated'](_0xb66705[_0xc9f7('0x1e')][_0xf60e82[_0xc9f7('0xc8')]]);_0xb66705[_0xc9f7('0x1e')][_0xf60e82[_0xc9f7('0xc8')]][_0xc9f7('0xcd')]+=0x1;_0xb66705[_0xc9f7('0x1e')][_0xf60e82[_0xc9f7('0xc8')]][_0xc9f7('0x122')]+=0x1;var _0x3542c8=_0xb66705[_0xc9f7('0x1e')][_0xf60e82[_0xc9f7('0xc8')]];var _0x29c843=new Hangup(_0xf60e82,_0x3171fd);_0x29c843[_0xc9f7('0xd9')]=0x13;_0x29c843['statedesc']=_0xc9f7('0x123');_0x29c843[_0xc9f7('0x11a')]=_0xc9f7('0x11b');_0x29c843[_0xc9f7('0x129')]+=0x1;_0x29c843[_0xc9f7('0x124')]+=0x1;_0x29c843[_0xc9f7('0x11e')]=!![];ami[_0xc9f7('0x43')](_0xc9f7('0x11c'),ut['buildObj'](_0x29c843,_0xc9f7('0x11e')));hopperUtils[_0xc9f7('0xd2')](_0x29c843)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x125')));if(_0x29c843[_0xc9f7('0x126')]+_0x29c843[_0xc9f7('0x132')]+_0x29c843[_0xc9f7('0x127')]+_0x29c843[_0xc9f7('0x128')]+_0x29c843[_0xc9f7('0xe1')]+_0x29c843['countabandonedretry']+_0x29c843['countmachineretry']+_0x29c843[_0xc9f7('0x12a')]>=_0x3542c8[_0xc9f7('0x12b')]){_0xb66705[_0xc9f7('0x12c')](_0x29c843,_0x4744e9,_0x2e993c,_0xc9f7('0x12d'));}else{if(_0x29c843[_0xc9f7('0x129')]>=_0x3542c8[_0xc9f7('0x12e')]){_0xb66705[_0xc9f7('0x12f')](_0x29c843,_0x4744e9,_0x2e993c,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x29c843[_0xc9f7('0x129')],'scheduledat':moment()[_0xc9f7('0xe5')](_0x3542c8[_0xc9f7('0x133')],_0xc9f7('0xf1'))[_0xc9f7('0x48')](_0xc9f7('0xd1')),'ContactId':_0x29c843['ContactId'],'ListId':_0x29c843[_0xc9f7('0xe6')],'VoiceQueueId':_0x29c843['VoiceQueueId']||undefined,'CampaignId':_0x29c843[_0xc9f7('0xe8')]||undefined})['catch'](loggerCatch(_0xc9f7('0x130')));_0x4744e9({'reschedule':0x1});}}});}}};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x134')]=function(_0x1bea5d){var _0x2c50d8=this[_0xc9f7('0x25')][_0x1bea5d[_0xc9f7('0xc9')]];var _0x434344;if(_0x2c50d8&&_0x2c50d8[_0xc9f7('0xca')]===_0xc9f7('0xcb')){delete this[_0xc9f7('0x25')][_0x1bea5d[_0xc9f7('0xc9')]];this[_0xc9f7('0xcc')](this[_0xc9f7('0x1e')][_0x2c50d8[_0xc9f7('0xc8')]]);this['campaigns'][_0x2c50d8[_0xc9f7('0xc8')]][_0xc9f7('0x135')]+=0x1;_0x434344=new Hangup(_0x2c50d8,_0x1bea5d);hopperUtils[_0xc9f7('0xd2')](_0x434344)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x136')));hopperUtils[_0xc9f7('0xd4')](_0x434344)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x137')));}if(_0x2c50d8&&_0x2c50d8[_0xc9f7('0xca')]!==_0xc9f7('0xcb')&&isNotNull(this[_0xc9f7('0x1d')][_0x2c50d8[_0xc9f7('0xc8')]][_0xc9f7('0x138')])){delete this[_0xc9f7('0x25')][_0x1bea5d[_0xc9f7('0xc9')]];this[_0xc9f7('0xcc')](this[_0xc9f7('0x1d')][_0x2c50d8[_0xc9f7('0xc8')]]);this['voiceQueues'][_0x2c50d8[_0xc9f7('0xc8')]][_0xc9f7('0xcd')]+=0x1;this[_0xc9f7('0x1d')][_0x2c50d8[_0xc9f7('0xc8')]]['outboundAnswerAgiCallsDay']+=0x1;_0x434344=new Hangup(_0x2c50d8,_0x1bea5d);_0x434344['state']=0x10;_0x434344[_0xc9f7('0x74')]=_0xc9f7('0x139');_0x434344['membername']=_0xc9f7('0x13a');hopperUtils[_0xc9f7('0xd2')](_0x434344)['catch'](loggerCatch(_0xc9f7('0x136')));hopperUtils['moveContactManagedDialer'](_0x434344)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x137')));}if(_0x2c50d8&&_0x2c50d8[_0xc9f7('0xca')]!==_0xc9f7('0xcb')&&!isNotNull(this[_0xc9f7('0x1d')][_0x2c50d8['queue']][_0xc9f7('0x138')])){delete this[_0xc9f7('0x25')][_0x1bea5d['uniqueid']];this['updateOriginated'](this[_0xc9f7('0x1d')][_0x2c50d8['queue']]);this[_0xc9f7('0x1d')][_0x2c50d8['queue']][_0xc9f7('0x13b')]+=0x1;_0x434344=new Hangup(_0x2c50d8,_0x1bea5d);_0x434344[_0xc9f7('0xd9')]=0xc;_0x434344[_0xc9f7('0x74')]=_0x1bea5d[_0xc9f7('0x13c')];_0x434344['membername']=_0xc9f7('0x13d');hopperUtils['createHistory'](_0x434344)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xc9f7('0xd4')](_0x434344)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x137')));}};Dialer[_0xc9f7('0x8b')][_0xc9f7('0xa')]=function(_0x5d0cb5){var _0x1727d6=this;if(!_0x1727d6[_0xc9f7('0x2b')][_0x5d0cb5[_0xc9f7('0x4a')]]){_0x1727d6[_0xc9f7('0x2b')][_0x5d0cb5[_0xc9f7('0x4a')]]={'running':![]};}else if(_0x1727d6[_0xc9f7('0x2b')][_0x5d0cb5[_0xc9f7('0x4a')]][_0xc9f7('0x13e')]===!![]){return;}else if(_0x1727d6['queuesSummary'][_0x5d0cb5[_0xc9f7('0x4a')]][_0xc9f7('0x13e')]===![]){_0x1727d6[_0xc9f7('0x2b')][_0x5d0cb5[_0xc9f7('0x4a')]][_0xc9f7('0x13e')]=!![];}var _0x36f67e=_0x1727d6[_0xc9f7('0x1d')][_0x5d0cb5[_0xc9f7('0x4a')]];var _0x30a486=_0x36f67e['message']!==utils[_0xc9f7('0x6e')]['INACTIVE'];var _0x5a6465=utils[_0xc9f7('0x13f')](_0x36f67e);_0x36f67e[_0xc9f7('0x140')]=utils[_0xc9f7('0x141')](_0x36f67e,_0x1727d6[_0xc9f7('0x20')]);Promise[_0xc9f7('0xb4')]()[_0xc9f7('0x40')](function(){if(_0x36f67e[_0xc9f7('0x140')]===utils['CAMPAIGN_STATUS']['INACTIVE']){if(_0x30a486){clearPredictiveAttributes(_0x36f67e);_0x5d0cb5[_0xc9f7('0x27')]=undefined;_0x5d0cb5[_0xc9f7('0x28')]=undefined;}if(_0x36f67e[_0xc9f7('0x140')]===utils['CAMPAIGN_STATUS']['INACTIVE']){_0x5d0cb5[_0xc9f7('0x142')]=0x0;_0x5d0cb5['paused']=0x0;_0x5d0cb5['inUse']=0x0;_0x5d0cb5[_0xc9f7('0x143')]=0x0;_0x5d0cb5['pTalking']=0x0;}}else if(_0x36f67e[_0xc9f7('0x140')]===utils[_0xc9f7('0x6e')][_0xc9f7('0x144')]&&!_0x5a6465){return _0x1727d6[_0xc9f7('0x97')](_0x36f67e,!![])[_0xc9f7('0x40')](function(){return _0x1727d6[_0xc9f7('0x97')](_0x36f67e,![]);})[_0xc9f7('0x40')](function(){return _0x1727d6[_0xc9f7('0xba')](_0x36f67e);})[_0xc9f7('0xa7')](function(_0x5c4ff4){loggerSyncQueueSummary[_0xc9f7('0x45')]('[syncQueueSummary]',util['inspect'](_0x5c4ff4,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x36f67e);});}else{clearPredictiveAttributes(_0x36f67e);}})['then'](function(){var _0x15e32d=_0x5d0cb5[_0xc9f7('0x145')](_0x36f67e);if(_0x15e32d||_0x36f67e[_0xc9f7('0x146')]){_0x36f67e[_0xc9f7('0x146')]=![];_0x5d0cb5[_0xc9f7('0x147')](_0x36f67e);Object[_0xc9f7('0x148')](_0x36f67e,_0x5d0cb5);emitOutboundVoiceQueueSummary(_0x5d0cb5);}_0x1727d6[_0xc9f7('0x2b')][_0x36f67e[_0xc9f7('0x4a')]]['running']=![];})['catch'](function(_0x361104){logger[_0xc9f7('0x6a')](_0xc9f7('0x149'),util['inspect'](_0x361104,{'showHidden':![],'depth':null}));_0x1727d6[_0xc9f7('0x2b')][_0x36f67e['name']][_0xc9f7('0x13e')]=![];});};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x37')]=_[_0xc9f7('0x14a')](function(){var _0x336ffe=_[_0xc9f7('0x14b')](this['voiceQueues'],function(_0x2a9b7c){return _0x2a9b7c['dialPreviewRecallmeReminder'];});var _0xe9a41b=_[_0xc9f7('0x14b')](this[_0xc9f7('0x1f')],function(_0x585259){return _0x585259['online']&&_0x585259['status']===_0xc9f7('0x8f');});if(_0x336ffe['length']>0x0&&_0xe9a41b[_0xc9f7('0xa0')]>0x0){return Promise[_0xc9f7('0xb4')]()[_0xc9f7('0x40')](cmHopper[_0xc9f7('0x14c')](_[_0xc9f7('0x14d')](_0x336ffe,'id'),previewRecallmeReminderInterval,_[_0xc9f7('0x14d')](_0xe9a41b,'id')))[_0xc9f7('0x40')](function(_0x1ed136){for(var _0x4057d0=0x0;_0x4057d0<_0x1ed136[_0xc9f7('0xa0')];_0x4057d0++){var _0x55d5b4=_0x1ed136[_0x4057d0]['Agent'][_0xc9f7('0x4a')];if(_0x55d5b4)io['to'](util[_0xc9f7('0x48')](_0xc9f7('0x14e'),_0x55d5b4))[_0xc9f7('0x43')](_0xc9f7('0x14f'),{'hopper':_0x1ed136[_0x4057d0]});}})[_0xc9f7('0xa7')](function(_0x5c4015){logger[_0xc9f7('0x6a')](_0xc9f7('0x150'),_0x5c4015);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xc9f7('0x8b')][_0xc9f7('0x3f')]=function(){var _0x16f3a4=this;setInterval(function(){_0x16f3a4['clearZombieChannels'](_0x16f3a4[_0xc9f7('0x25')],_0xc9f7('0x151'));_0x16f3a4[_0xc9f7('0x152')](_0x16f3a4[_0xc9f7('0x23')],_0xc9f7('0x153'));},0x32c8);};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x152')]=function(_0x5de909,_0x2c5415){var _0x13eac5=this;for(var _0x4078ae in _0x5de909){if(typeof _0x5de909[_0x4078ae]!==_0xc9f7('0xb3')){this[_0xc9f7('0x1b')][_0xc9f7('0x154')](function(){if(!_[_0xc9f7('0xfa')](_0x5de909[_0x4078ae])){return ami[_0xc9f7('0xa8')]({'action':_0xc9f7('0x8e'),'channel':_0x5de909[_0x4078ae][_0xc9f7('0xf7')]})[_0xc9f7('0xa7')](function(_0x47c5fb){if(_0x47c5fb[_0xc9f7('0x6d')]===_0xc9f7('0x155')){setTimeout(function(){if(_0x5de909[_0x4078ae]&&_0x5de909[_0x4078ae][_0xc9f7('0xca')]!==_0xc9f7('0xcb')){_0x13eac5[_0xc9f7('0xcc')](_0x13eac5[_0xc9f7('0x1d')][_0x5de909[_0x4078ae][_0xc9f7('0xc8')]]);logger[_0xc9f7('0x6a')](_0xc9f7('0x156'),_0x2c5415,_0x4078ae,_0x5de909[_0x4078ae][_0xc9f7('0xc8')]);delete _0x5de909[_0x4078ae];}if(_0x5de909[_0x4078ae]&&_0x5de909[_0x4078ae][_0xc9f7('0xca')]==='ivr'){_0x13eac5[_0xc9f7('0xcc')](_0x13eac5[_0xc9f7('0x1e')][_0x5de909[_0x4078ae][_0xc9f7('0xc8')]]);logger[_0xc9f7('0x6a')](_0xc9f7('0x157'),_0x2c5415,_0x4078ae,_0x5de909[_0x4078ae]['queue']);delete _0x5de909[_0x4078ae];}},0x2328);}});}});}}};Dialer['prototype'][_0xc9f7('0x158')]=function(_0x2b065b){return Promise[_0xc9f7('0xb4')]()['then'](voiceQueueRt[_0xc9f7('0x158')](_0x2b065b))['catch'](loggerCatch(_0xc9f7('0x159')));};Dialer['prototype'][_0xc9f7('0xcc')]=function(_0x3adaf5){if(!_[_0xc9f7('0x42')](_0x3adaf5)&&_0x3adaf5!==null){if(typeof _0x3adaf5[_0xc9f7('0x86')]!==_0xc9f7('0xb3')){if(_0x3adaf5['originated']>0x0){_0x3adaf5[_0xc9f7('0x86')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xc9f7('0x6a')](_0xc9f7('0x15a'));}};Dialer['prototype'][_0xc9f7('0x15b')]=function(_0x3cc89e,_0x4725fb){var _0x15f529=this;return function(_0x2a4df3){_0x15f529['updateOriginated'](_0x4725fb);logger[_0xc9f7('0x6a')](_0x3cc89e,util[_0xc9f7('0x47')](_0x2a4df3,{'showHidden':![],'depth':null}));};};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x15c')]=function(_0x4b733d,_0x1b2818,_0x3a0e85){var _0x2fda69={'state':0x19,'statedesc':_0xc9f7('0x15d')};this[_0xc9f7('0xcc')](_0x1b2818);this[_0xc9f7('0x131')](_[_0xc9f7('0x64')](_0x2fda69,_['pick'](_0x3a0e85,[_0xc9f7('0xf2'),_0xc9f7('0xe6'),'UserId','VoiceQueueId',_0xc9f7('0xe8')])),'[emptyContact][createHistory]','[emptyContact]');logger['error'](_0x4b733d);};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x131')]=function(_0x2bb40f,_0x41d956,_0xfa9968){hopperUtils['createHistory'](_0x2bb40f)['catch'](loggerCatch(_0x41d956));hopperUtils[_0xc9f7('0xd4')](_0x2bb40f)['catch'](loggerCatch(_0xfa9968));};Dialer[_0xc9f7('0x8b')][_0xc9f7('0xe3')]=function(_0x401e6e,_0x41c300){hopperUtils[_0xc9f7('0xd2')](_0x401e6e)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0xd3')));if(_0x41c300==0x0){hopperUtils[_0xc9f7('0xd4')](_0x401e6e)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x15e')));}};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x150')]=function(_0x4ac816){return Promise['resolve']()[_0xc9f7('0x40')](cmHopper['handlePreviewRecallNotifications'](_0x4ac816['id'],previewRecallmeReminderInterval))['then'](function(_0x207e52){for(var _0x2911d7=0x0;_0x2911d7<_0x207e52[_0xc9f7('0xa0')];_0x2911d7++){var _0x276422=_0x207e52[_0x2911d7][_0xc9f7('0x15f')][_0xc9f7('0x4a')];if(_0x276422)io['to'](util[_0xc9f7('0x48')](_0xc9f7('0x14e'),_0x276422))[_0xc9f7('0x43')](_0xc9f7('0x14f'),{'hopper':_0x207e52[_0x2911d7]});}})[_0xc9f7('0xa7')](function(){});};Dialer['prototype'][_0xc9f7('0xb9')]=function(_0x48393e){var _0x2a329c=this;return function(){_0x2a329c['handleIvr'](_0x48393e);};};Dialer[_0xc9f7('0x8b')]['actionOriginate']=function(_0x1d41db,_0x28729e){var _0x45337d=this;var _0x42bbd1=uuid['v4']();this[_0xc9f7('0x23')][_0x42bbd1]=new Action(_0x1d41db,_0x28729e,_0x42bbd1);return new Promise(function(_0x4c4bf2,_0x1e156b){if(_[_0xc9f7('0x42')](_0x1d41db)&&typeof _0x1d41db!==_0xc9f7('0x160')){return _0x1e156b(msgResponse(_0xc9f7('0x161'),_0xc9f7('0x9a'),_0xc9f7('0x162')));}if(_[_0xc9f7('0x42')](_0x28729e[_0xc9f7('0x163')])||_0x28729e['phone']===null){return _0x1e156b(msgResponse(_0xc9f7('0x161'),_0xc9f7('0x9a'),'contact\x20is\x20undefine'));}var _0x470461={'XMD-CALLERID':_0x45337d[_0xc9f7('0x23')][_0x42bbd1][_0xc9f7('0x164')](),'XMD-AGI':_0x1d41db[_0xc9f7('0x138')]?util[_0xc9f7('0x48')](_0xc9f7('0x165'),ipAgi,_0x1d41db[_0xc9f7('0x138')]):_0xc9f7('0x166'),'XMD-AGIAFTER':_0x1d41db[_0xc9f7('0xcf')]?util[_0xc9f7('0x48')](_0xc9f7('0x165'),ipAgi,_0x1d41db[_0xc9f7('0xcf')]):_0xc9f7('0x166'),'XMD-QUEUE':utils['isOutboundQueue'](_0x1d41db)?util[_0xc9f7('0x48')]('\x22%s,%s%s,,,%s\x22',_0x1d41db['name'],_0x1d41db[_0xc9f7('0x167')]||'',_0x1d41db[_0xc9f7('0xd0')]?'c':'',_0x1d41db[_0xc9f7('0xd7')]||0x3):'NONE','XMD-CONTACTID':_0x28729e[_0xc9f7('0xf2')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x45337d[_0xc9f7('0x23')][_0x42bbd1]['getCaller'](),'XMD-AMD':_0x1d41db[_0xc9f7('0x117')]?_0xc9f7('0x144'):_0xc9f7('0x166'),'XMD-DESTINATION':_0xc9f7('0x168')};if(_0x1d41db['dialAMDActive']){_0x470461['XMD-AMDINITIALSILENCE']=_0x1d41db['dialAMDInitialSilence']||0x9c4;_0x470461[_0xc9f7('0x169')]=_0x1d41db[_0xc9f7('0x16a')]||0x5dc;_0x470461[_0xc9f7('0x16b')]=_0x1d41db[_0xc9f7('0x16c')]||0x320;_0x470461[_0xc9f7('0x16d')]=_0x1d41db[_0xc9f7('0x16e')]||0x1388;_0x470461['XMD-AMDMINWORDLENGTH']=_0x1d41db[_0xc9f7('0x16f')]||0x64;_0x470461[_0xc9f7('0x170')]=_0x1d41db[_0xc9f7('0x171')]||0x32;_0x470461[_0xc9f7('0x172')]=_0x1d41db[_0xc9f7('0x173')]||0x3;_0x470461[_0xc9f7('0x174')]=_0x1d41db['dialAMDSilenceThreshold']||0x100;_0x470461['XMD-AMDMAXIMUMWORDLENGTH']=_0x1d41db[_0xc9f7('0x175')]||0x1388;}if(utils[_0xc9f7('0x176')](_0x1d41db)){_0x470461[_0xc9f7('0x177')]=_0x28729e[_0xc9f7('0xe7')];}else{_0x470461[_0xc9f7('0x178')]=_0x28729e[_0xc9f7('0xe8')];}var _0x23fdd2=utils[_0xc9f7('0x179')](_0x28729e[_0xc9f7('0x17a')]);Object['assign'](_0x470461,_0x23fdd2);var _0xd697c6=_0x45337d[_0xc9f7('0x8c')](_0x1d41db['Trunk'])?utils[_0xc9f7('0x17b')](_0x1d41db[_0xc9f7('0x92')][_0xc9f7('0x17c')],_0x1d41db[_0xc9f7('0x17d')],_0x1d41db[_0xc9f7('0x17e')]>0x0?utils[_0xc9f7('0x17f')](_0x1d41db[_0xc9f7('0x180')],_0x1d41db[_0xc9f7('0x17e')]):_0x1d41db[_0xc9f7('0x180')]):utils[_0xc9f7('0x17b')](_[_0xc9f7('0xfa')](_0x1d41db[_0xc9f7('0x181')])?_0x1d41db[_0xc9f7('0x92')][_0xc9f7('0x17c')]:_0x1d41db[_0xc9f7('0x181')][_0xc9f7('0x17c')],_0x1d41db[_0xc9f7('0x17d')],_0x1d41db[_0xc9f7('0x17e')]>0x0?utils[_0xc9f7('0x17f')](_0x1d41db[_0xc9f7('0x180')],_0x1d41db[_0xc9f7('0x17e')]):_0x1d41db['dialOriginateCallerIdNumber']);if(_0xd697c6){_0x470461[_0xc9f7('0x182')]=_0x45337d['actions'][_0x42bbd1][_0xc9f7('0x183')]=utils[_0xc9f7('0x184')](_0xd697c6);_0x470461[_0xc9f7('0x185')]=_0x28729e['phone'];}_0x1d41db['variables']=_0x470461;return ami['Action']({'actionid':_0x42bbd1,'action':_0xc9f7('0x161'),'channel':_0x45337d[_0xc9f7('0x8c')](_0x1d41db[_0xc9f7('0x92')])?util[_0xc9f7('0x48')](_0xc9f7('0x186'),_0x1d41db['Trunk'][_0xc9f7('0x4a')],isNotNull(_0x1d41db['dialPrefix'])?_0x1d41db['dialPrefix'][_0xc9f7('0x187')]()||'':'',_0x1d41db[_0xc9f7('0x188')]>0x0?_0x28729e[_0xc9f7('0x163')]['substring'](_0x1d41db[_0xc9f7('0x188')]):_0x28729e[_0xc9f7('0x163')]):util[_0xc9f7('0x48')]('SIP/%s/%s%s',_[_0xc9f7('0xfa')](_0x1d41db[_0xc9f7('0x181')])?_0x1d41db['Trunk']['name']:_0x1d41db[_0xc9f7('0x181')][_0xc9f7('0x4a')],isNotNull(_0x1d41db[_0xc9f7('0x189')])?_0x1d41db[_0xc9f7('0x189')][_0xc9f7('0x187')]()||'':'',_0x1d41db[_0xc9f7('0x188')]>0x0?_0x28729e[_0xc9f7('0x163')][_0xc9f7('0x18a')](_0x1d41db[_0xc9f7('0x188')]):_0x28729e[_0xc9f7('0x163')]),'callerid':_0xd697c6,'Exten':_0xc9f7('0x168'),'Context':'from-sip','Priority':'1','variable':_0x470461,'timeout':(_0x1d41db[_0xc9f7('0x18b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x42bbd1})[_0xc9f7('0x40')](function(_0x439fc5){return _0x4c4bf2(_0x439fc5);})[_0xc9f7('0xa7')](function(_0x1adc09){_0x1d41db[_0xc9f7('0x18c')]+=0x1;var _0x4ea59b=new History(_0x45337d['actions'][_0x42bbd1]);logger[_0xc9f7('0x6a')](util[_0xc9f7('0x48')](_0xc9f7('0x18d'),JSON[_0xc9f7('0x7a')](_0x1adc09)));_0x4ea59b[_0xc9f7('0xd9')]=0xe;_0x4ea59b[_0xc9f7('0x74')]=_0xc9f7('0x18e');_0x4ea59b[_0xc9f7('0x76')]=moment()[_0xc9f7('0x48')](_0xc9f7('0xd1'));_0x4ea59b[_0xc9f7('0x75')]=_0x4ea59b[_0xc9f7('0x76')];hopperUtils['createHistory'](_0x4ea59b)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x18f')));_0x45337d[_0xc9f7('0xd4')](_0x4ea59b)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x18f')))['finally'](function(){delete _0x45337d[_0xc9f7('0x23')][_0x42bbd1];return _0x1e156b(msgResponse(_0xc9f7('0x161'),_0xc9f7('0x8a'),_0xc9f7('0x190')));});});});};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x191')]=function(_0xe95004,_0x2a8cc4,_0x5ea7dd){var _0x1d30fd=new History(_0x2a8cc4);if(_0x1d30fd[_0xc9f7('0x126')]+_0x1d30fd[_0xc9f7('0x132')]+_0x1d30fd[_0xc9f7('0x127')]+_0x1d30fd[_0xc9f7('0x128')]+_0x1d30fd[_0xc9f7('0xe1')]+_0x1d30fd[_0xc9f7('0xee')]+_0x1d30fd['countmachineretry']+_0x1d30fd[_0xc9f7('0x12a')]>=_0x5ea7dd['dialGlobalMaxRetry']-0x1){return!![];}switch(_0xe95004){case 0x3:if(_0x1d30fd[_0xc9f7('0x127')]>=_0x5ea7dd[_0xc9f7('0x192')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x1d30fd['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x5ea7dd['dialNoAnswerRetryFrequency'],_0xc9f7('0xf1'))[_0xc9f7('0x48')](_0xc9f7('0xd1')),'ContactId':_0x1d30fd[_0xc9f7('0xf2')],'ListId':_0x1d30fd[_0xc9f7('0xe6')],'VoiceQueueId':_0x1d30fd[_0xc9f7('0xe7')]||undefined,'CampaignId':_0x1d30fd['CampaignId']||undefined})[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x193')));break;case 0x5:if(_0x1d30fd[_0xc9f7('0x126')]>=_0x5ea7dd[_0xc9f7('0x194')]-0x1){return!![];}hopperUtils[_0xc9f7('0xe4')]({'active':![],'countbusyretry':_0x1d30fd[_0xc9f7('0x126')]+=0x1,'scheduledat':moment()[_0xc9f7('0xe5')](_0x5ea7dd[_0xc9f7('0x195')],_0xc9f7('0xf1'))[_0xc9f7('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d30fd[_0xc9f7('0xf2')],'ListId':_0x1d30fd[_0xc9f7('0xe6')],'VoiceQueueId':_0x1d30fd[_0xc9f7('0xe7')]||undefined,'CampaignId':_0x1d30fd[_0xc9f7('0xe8')]||undefined})[_0xc9f7('0xa7')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x1d30fd[_0xc9f7('0x132')]>=_0x5ea7dd[_0xc9f7('0x196')]-0x1){return!![];}hopperUtils[_0xc9f7('0xe4')]({'active':![],'countcongestionretry':_0x1d30fd[_0xc9f7('0x132')]+=0x1,'scheduledat':moment()[_0xc9f7('0xe5')](_0x5ea7dd[_0xc9f7('0x197')],_0xc9f7('0xf1'))[_0xc9f7('0x48')](_0xc9f7('0xd1')),'ContactId':_0x1d30fd[_0xc9f7('0xf2')],'ListId':_0x1d30fd['ListId'],'VoiceQueueId':_0x1d30fd[_0xc9f7('0xe7')]||undefined,'CampaignId':_0x1d30fd[_0xc9f7('0xe8')]||undefined})[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x198')));break;case 0x0:if(_0x1d30fd[_0xc9f7('0x128')]>=_0x5ea7dd[_0xc9f7('0x199')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1d30fd[_0xc9f7('0x128')]+=0x1,'scheduledat':moment()['add'](_0x5ea7dd[_0xc9f7('0x19a')],_0xc9f7('0xf1'))[_0xc9f7('0x48')](_0xc9f7('0xd1')),'ContactId':_0x1d30fd[_0xc9f7('0xf2')],'ListId':_0x1d30fd['ListId'],'VoiceQueueId':_0x1d30fd['VoiceQueueId']||undefined,'CampaignId':_0x1d30fd[_0xc9f7('0xe8')]||undefined})['catch'](loggerCatch(_0xc9f7('0x19b')));}break;case 0xa:if(_0x1d30fd[_0xc9f7('0xe1')]>=_0x5ea7dd[_0xc9f7('0xe2')]-0x1){return!![];}hopperUtils[_0xc9f7('0xe4')]({'active':![],'countdropretry':_0x1d30fd[_0xc9f7('0xe1')]+=0x1,'scheduledat':moment()[_0xc9f7('0xe5')](_0x5ea7dd[_0xc9f7('0xdc')],_0xc9f7('0xf1'))[_0xc9f7('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d30fd[_0xc9f7('0xf2')],'ListId':_0x1d30fd[_0xc9f7('0xe6')],'VoiceQueueId':_0x1d30fd[_0xc9f7('0xe7')]||undefined,'CampaignId':_0x1d30fd[_0xc9f7('0xe8')]||undefined})[_0xc9f7('0xa7')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1d30fd[_0xc9f7('0xee')]>=_0x5ea7dd[_0xc9f7('0xf0')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1d30fd[_0xc9f7('0xee')]+=0x1,'scheduledat':moment()['add'](_0x5ea7dd[_0xc9f7('0xef')],_0xc9f7('0xf1'))['format'](_0xc9f7('0xd1')),'ContactId':_0x1d30fd[_0xc9f7('0xf2')],'ListId':_0x1d30fd['ListId'],'VoiceQueueId':_0x1d30fd['VoiceQueueId']||undefined,'CampaignId':_0x1d30fd['CampaignId']||undefined})[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0xf3')));break;case 0x13:if(_0x1d30fd[_0xc9f7('0x129')]>=_0x5ea7dd[_0xc9f7('0x12e')]-0x1){return!![];}hopperUtils[_0xc9f7('0xe4')]({'active':![],'countmachineretry':_0x1d30fd['countmachineretry']+=0x1,'scheduledat':moment()[_0xc9f7('0xe5')](_0x5ea7dd[_0xc9f7('0x133')],_0xc9f7('0xf1'))[_0xc9f7('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d30fd[_0xc9f7('0xf2')],'ListId':_0x1d30fd[_0xc9f7('0xe6')],'VoiceQueueId':_0x1d30fd[_0xc9f7('0xe7')]||undefined,'CampaignId':_0x1d30fd[_0xc9f7('0xe8')]||undefined})[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x130')));break;case 0x14:if(_0x1d30fd[_0xc9f7('0x12a')]>=_0x5ea7dd['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xc9f7('0xe4')]({'active':![],'countagentrejectretry':_0x1d30fd[_0xc9f7('0x12a')]+=0x1,'scheduledat':moment()[_0xc9f7('0xe5')](_0x5ea7dd['dialAgentRejectRetryFrequency'],_0xc9f7('0xf1'))['format'](_0xc9f7('0xd1')),'ContactId':_0x1d30fd[_0xc9f7('0xf2')],'ListId':_0x1d30fd[_0xc9f7('0xe6')],'VoiceQueueId':_0x1d30fd[_0xc9f7('0xe7')]||undefined,'CampaignId':_0x1d30fd[_0xc9f7('0xe8')]||undefined})[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x19c')));break;default:return!![];}};Dialer[_0xc9f7('0x8b')]['callProgressDetecting']=function(_0x1b446f,_0xb51a44,_0x114ac1){var _0x58a775=this;var _0x3a2640=new History(_0x1b446f);var _0x59f093=![];var _0x11f588;var _0x4f3023;return new Promise(function(_0x4e78ba,_0x10f893){if(_[_0xc9f7('0x42')](_0xb51a44)&&typeof _0xb51a44!==_0xc9f7('0x160')){return _0x10f893(msgResponse(_0xc9f7('0x19d'),_0xc9f7('0x9a'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x114ac1)&&typeof _0x114ac1!==_0xc9f7('0x160')){return _0x10f893(msgResponse(_0xc9f7('0x19d'),_0xc9f7('0x9a'),_0xc9f7('0x19e')));}hopperUtils[_0xc9f7('0xde')](_0x3a2640,_0x114ac1[_0xc9f7('0x19f')],_0xb51a44)[_0xc9f7('0x40')](function(_0x3f4378){if(_0x3f4378['additional']==0x1)_0x59f093=!![];switch(_0x114ac1['reason']){case'0':_0xb51a44[_0xc9f7('0x1a0')]+=0x1;_0x3a2640[_0xc9f7('0xd9')]=0x0;_0x3a2640['statedesc']='NoSuchNumber';_0x3a2640[_0xc9f7('0x128')]+=0x1;_0x3a2640[_0xc9f7('0x124')]+=0x1;ami['emit'](_0xc9f7('0x1a1'),ut[_0xc9f7('0x11d')](_0x1b446f,_0xc9f7('0x1a2')));_0x11f588=_0xb51a44[_0xc9f7('0x19a')];_0x4f3023=_0xb51a44[_0xc9f7('0xdd')];hopperUtils['createHistory'](_0x3a2640)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x125')));if(_0x58a775['checkRetriveMax'](0x0,_0x1b446f,_0xb51a44)&&!_0x59f093){if(_0x3a2640[_0xc9f7('0x128')]>=_0xb51a44[_0xc9f7('0x199')]){_0x58a775[_0xc9f7('0x12f')](_0x3a2640,_0x4e78ba,_0x10f893,'reason\x200\x20no\x20such\x20number....');}else{_0x58a775[_0xc9f7('0x12c')](_0x3a2640,_0x4e78ba,_0x10f893,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0xb51a44['outboundNoAnswerCallsDay']+=0x1;_0x3a2640['state']=0x3;_0x3a2640[_0xc9f7('0x74')]=_0xc9f7('0x1a3');_0x3a2640[_0xc9f7('0x127')]+=0x1;_0x3a2640[_0xc9f7('0x124')]+=0x1;var _0x22242e=ut[_0xc9f7('0x1a4')](_0x1b446f,_0xb51a44);ami['emit']('custom:agentnoanswer',_0x22242e);_0x11f588=_0xb51a44['dialNoAnswerRetryFrequency'];_0x4f3023=_0xb51a44[_0xc9f7('0xdd')];hopperUtils[_0xc9f7('0xd2')](_0x3a2640)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x1a5')));if(_0x58a775[_0xc9f7('0x191')](0x3,_0x1b446f,_0xb51a44)&&!_0x59f093){if(_0x3a2640[_0xc9f7('0x127')]>=_0xb51a44[_0xc9f7('0x192')]){_0x58a775[_0xc9f7('0x12f')](_0x3a2640,_0x4e78ba,_0x10f893,_0xc9f7('0x1a6'));}else{_0x58a775[_0xc9f7('0x12c')](_0x3a2640,_0x4e78ba,_0x10f893,_0xc9f7('0x1a6'));}}break;case'5':_0xb51a44[_0xc9f7('0x1a7')]+=0x1;_0x3a2640[_0xc9f7('0xd9')]=0x5;_0x3a2640[_0xc9f7('0x74')]=_0xc9f7('0x1a8');_0x3a2640[_0xc9f7('0x126')]+=0x1;_0x3a2640[_0xc9f7('0x124')]+=0x1;ami[_0xc9f7('0x43')]('custom:agentbusy',ut['buildObj'](_0x1b446f,_0xc9f7('0x1a9')));_0x11f588=_0xb51a44[_0xc9f7('0x195')];_0x4f3023=_0xb51a44[_0xc9f7('0xdd')];hopperUtils[_0xc9f7('0xd2')](_0x3a2640)[_0xc9f7('0xa7')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x58a775[_0xc9f7('0x191')](0x5,_0x1b446f,_0xb51a44)&&!_0x59f093){if(_0x3a2640[_0xc9f7('0x126')]>=_0xb51a44[_0xc9f7('0x194')]){_0x58a775[_0xc9f7('0x12f')](_0x3a2640,_0x4e78ba,_0x10f893,_0xc9f7('0x1aa'));}else{_0x58a775[_0xc9f7('0x12c')](_0x3a2640,_0x4e78ba,_0x10f893,_0xc9f7('0x1aa'));}}break;case'8':_0xb51a44[_0xc9f7('0x1ab')]+=0x1;_0x3a2640[_0xc9f7('0xd9')]=0x8;_0x3a2640[_0xc9f7('0x74')]=_0xc9f7('0x1ac');_0x3a2640[_0xc9f7('0x132')]+=0x1;_0x3a2640['countglobal']+=0x1;_0x11f588=_0xb51a44[_0xc9f7('0x197')];_0x4f3023=_0xb51a44['callAdditionalPhoneAfterMin'];ami[_0xc9f7('0x43')](_0xc9f7('0x1ad'),ut[_0xc9f7('0x11d')](_0x1b446f,_0xc9f7('0x1ae')));hopperUtils[_0xc9f7('0xd2')](_0x3a2640)[_0xc9f7('0xa7')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x58a775[_0xc9f7('0x191')](0x8,_0x1b446f,_0xb51a44)&&!_0x59f093){if(_0x3a2640[_0xc9f7('0x132')]>=_0xb51a44[_0xc9f7('0x196')]){_0x58a775[_0xc9f7('0x12f')](_0x3a2640,_0x4e78ba,_0x10f893,'reason\x208\x20congestion');}else{_0x58a775[_0xc9f7('0x12c')](_0x3a2640,_0x4e78ba,_0x10f893,'reason\x208\x20congestion');}}break;case'11':_0xb51a44['outboundAbandonedCallsDay']+=0x1;_0x3a2640[_0xc9f7('0xd9')]=0xb;_0x3a2640[_0xc9f7('0x74')]=_0xc9f7('0xec');_0x3a2640[_0xc9f7('0xee')]+=0x1;_0x3a2640[_0xc9f7('0x124')]+=0x1;_0x11f588=_0xb51a44[_0xc9f7('0xef')];_0x4f3023=_0xb51a44[_0xc9f7('0xdd')];hopperUtils['createHistory'](_0x3a2640)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0xf5')));if(_0x58a775[_0xc9f7('0x191')](0xb,_0x1b446f,_0xb51a44)&&!_0x59f093){if(_0x3a2640[_0xc9f7('0xee')]>=_0xb51a44[_0xc9f7('0xf0')]){_0x58a775[_0xc9f7('0x12f')](_0x3a2640,_0x4e78ba,_0x10f893,_0xc9f7('0x1af'));}else{_0x58a775[_0xc9f7('0x12c')](_0x3a2640,_0x4e78ba,_0x10f893,_0xc9f7('0x1af'));}}break;case'20':_0xb51a44[_0xc9f7('0x1b0')]+=0x1;_0x3a2640[_0xc9f7('0xd9')]=0x14;_0x3a2640[_0xc9f7('0x74')]=_0xc9f7('0x1b1');_0x3a2640['countagentrejectretry']+=0x1;_0x3a2640[_0xc9f7('0x124')]+=0x1;_0x11f588=_0xb51a44['dialAgentRejectRetryFrequency'];_0x4f3023=_0xb51a44['callAdditionalPhoneAfterMin'];ami[_0xc9f7('0x43')](_0xc9f7('0x1b2'),ut[_0xc9f7('0x11d')](_0x1b446f,_0xc9f7('0x1b3')));hopperUtils['createHistory'](_0x3a2640)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x1b4')));if(_0x58a775['checkRetriveMax'](0x14,_0x1b446f,_0xb51a44)&&!_0x59f093){if(_0x3a2640[_0xc9f7('0x12a')]>=_0xb51a44[_0xc9f7('0x1b5')]){_0x58a775[_0xc9f7('0x12f')](_0x3a2640,_0x4e78ba,_0x10f893,_0xc9f7('0x1b6'));}else{_0x58a775[_0xc9f7('0x12c')](_0x3a2640,_0x4e78ba,_0x10f893,_0xc9f7('0x1b6'));}}break;default:_0xb51a44[_0xc9f7('0x13b')]+=0x1;_0x3a2640[_0xc9f7('0xd9')]=0xc;_0x3a2640[_0xc9f7('0x74')]=_0x114ac1[_0xc9f7('0x19f')];_0x11f588=_0xb51a44[_0xc9f7('0x1b7')];_0x4f3023=_0xb51a44[_0xc9f7('0xdd')];hopperUtils[_0xc9f7('0xd2')](_0x3a2640)[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x1b8')));if(_0x58a775[_0xc9f7('0x191')](_0x114ac1[_0xc9f7('0x19f')],_0x1b446f,_0xb51a44)&&!_0x59f093){if(_0x3a2640[_0xc9f7('0x126')]+_0x3a2640[_0xc9f7('0x132')]+_0x3a2640[_0xc9f7('0x127')]+_0x3a2640[_0xc9f7('0x128')]+_0x3a2640[_0xc9f7('0xe1')]+_0x3a2640[_0xc9f7('0xee')]+_0x3a2640[_0xc9f7('0x129')]+_0x3a2640[_0xc9f7('0x12a')]>=_0xb51a44[_0xc9f7('0x12b')]){_0x58a775[_0xc9f7('0x12c')](_0x3a2640,_0x4e78ba,_0x10f893,_0x114ac1[_0xc9f7('0x19f')]);}else{_0x58a775[_0xc9f7('0x12f')](_0x3a2640,_0x4e78ba,_0x10f893,_0x114ac1[_0xc9f7('0x19f')]);}}}})['then'](function(){if(_0x59f093){hopperUtils[_0xc9f7('0xeb')](_0x3a2640,_0x11f588,_0x4f3023)['then'](function(){return _0x4e78ba(0x1);});}});});};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x12c')]=function(_0x1b8086,_0x42e09a,_0x9d9ab4,_0x1e084e){var _0xa4e34=new Final(_0x1b8086);_0xa4e34[_0xc9f7('0xd9')]=0xf;_0xa4e34[_0xc9f7('0x74')]='Global';this['createStateFinal'](_0xa4e34,_0x42e09a,_0x9d9ab4,_0x1e084e);};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x12f')]=function(_0x4c9006,_0x819a25,_0x5e3b90,_0x5243d4){hopperUtils[_0xc9f7('0xd4')](_0x4c9006)[_0xc9f7('0x40')](function(){return _0x819a25(msgResponse(_0xc9f7('0x19d'),_0xc9f7('0x112'),_0x5243d4));})['catch'](function(){return _0x5e3b90(msgResponse(_0xc9f7('0x1b9'),_0xc9f7('0x9a'),'contact\x20not\x20moved'));});};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x8')]=function(_0x2ab997){var _0x14f9ce=_0x2ab997[_0xc9f7('0x1ba')]/0x64;var _0x2b4893=_0x2ab997['outboundDropCallsDayTimeout']/(_0x2ab997[_0xc9f7('0xd8')]+_0x2ab997[_0xc9f7('0xcd')]);var _0x4d73ff=Math[_0xc9f7('0x1bb')](_0x2ab997[_0xc9f7('0x1bc')]*(_0x2ab997['predictiveIntervalMaxThreshold']/0x64));var _0x2a2f37=Math[_0xc9f7('0x1bb')](_0x2ab997[_0xc9f7('0x1bc')]*(_0x2ab997[_0xc9f7('0x1bd')]/0x64));var _0x3af6dc=_0x2ab997['available']+_0x2ab997['talking'];var _0x146381=Math['floor'](_0x2ab997[_0xc9f7('0x5e')]*_0x2ab997[_0xc9f7('0x60')]*_0x2ab997[_0xc9f7('0x1be')]*_0x2ab997[_0xc9f7('0x1bf')]);if(_['isUndefined'](_0x2ab997['startProgressive'])){if(!_[_0xc9f7('0x42')](_0x2ab997[_0xc9f7('0x27')])){_0x2ab997[_0xc9f7('0x27')]=undefined;loggerPredictive[_0xc9f7('0x6a')](_0xc9f7('0x1c0'),_0xc9f7('0x1c1'));}if(!_[_0xc9f7('0x42')](_0x2ab997[_0xc9f7('0x68')])){loggerPredictive['error'](_0xc9f7('0x1c0'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2ab997['handlePredictive']);_0x2ab997['handlePredictive']=undefined;}_0x2ab997[_0xc9f7('0x28')]=moment()[_0xc9f7('0x48')](_0xc9f7('0xd1'));loggerPredictive[_0xc9f7('0x4c')](_0x2ab997[_0xc9f7('0x4a')],_0xc9f7('0x1c2'),_0x2ab997[_0xc9f7('0x28')]);this['handlePower'](_0x2ab997,0x1);}else if(ifInterval(_0x2ab997[_0xc9f7('0x1c3')],_0x2ab997[_0xc9f7('0x28')])){this[_0xc9f7('0xbc')](_0x2ab997,0x1);loggerPredictiveCalls[_0xc9f7('0x4c')](_0xc9f7('0x1c4'),_0x2ab997[_0xc9f7('0x28')],_0x2ab997[_0xc9f7('0x4a')]);_0x2ab997['erlangCalls']=0x0;_0x2ab997['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x14f9ce<_0x2b4893&&_0x2ab997[_0xc9f7('0x1c5')]==='dropRate'){clearPredictiveAttributes(_0x2ab997);loggerPredictive['info'](_0xc9f7('0x1c6'),'Dropped\x20calls\x20day',_0x2b4893,_0xc9f7('0x28'),_0x2ab997[_0xc9f7('0x4a')]);}else if(_0x146381<_0x2ab997[_0xc9f7('0x1c7')]&&_0x2ab997[_0xc9f7('0x1c5')]===_0xc9f7('0x1c8')){clearPredictiveAttributes(_0x2ab997);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xc9f7('0x1c9'),_0x146381,'Drop\x20in\x20this\x20interval',_0x2ab997['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x2ab997[_0xc9f7('0x4a')]);}else if(!ifInterval(_0x2ab997[_0xc9f7('0x1c3')],_0x2ab997[_0xc9f7('0x28')])&&_[_0xc9f7('0x42')](_0x2ab997[_0xc9f7('0x27')])&&!_['isUndefined'](_0x2ab997['startProgressive'])){_0x2ab997[_0xc9f7('0x27')]=moment()[_0xc9f7('0x48')](_0xc9f7('0xd1'));loggerPredictive[_0xc9f7('0x4c')](_0x2ab997[_0xc9f7('0x4a')],_0xc9f7('0x1ca'),_0x2ab997[_0xc9f7('0x27')]);hopperUtils[_0xc9f7('0x1cb')](_0x2ab997['dialPredictiveInterval'])[_0xc9f7('0x40')](this['getDataPredictive'](_0x2ab997))[_0xc9f7('0x40')](mergeDataErlangB(_0x2ab997))[_0xc9f7('0x40')](this['startMethodPredictive'](_0x2ab997))[_0xc9f7('0xa7')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x2ab997));}else if(!ifInterval(_0x2ab997['dialPredictiveInterval'],_0x2ab997[_0xc9f7('0x27')])){_0x2ab997['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2ab997['startPredictive']=moment()['format'](_0xc9f7('0xd1'));loggerPredictive[_0xc9f7('0x4c')](_0x2ab997['name'],_0xc9f7('0x1cc'),_0x2ab997['startPredictive']);clearInterval(_0x2ab997[_0xc9f7('0x68')]);_0x2ab997[_0xc9f7('0x68')]=undefined;hopperUtils[_0xc9f7('0x1cb')](_0x2ab997[_0xc9f7('0x1c3')])[_0xc9f7('0x40')](this[_0xc9f7('0x1cd')](_0x2ab997))['then'](mergeDataErlangB(_0x2ab997))[_0xc9f7('0x40')](this['startMethodPredictive'](_0x2ab997))[_0xc9f7('0xa7')](loggerCatchPredictive(_0xc9f7('0x1ce'),_0x2ab997));}else if(_0x2ab997[_0xc9f7('0x1bc')]&&_0x3af6dc<_0x2ab997[_0xc9f7('0x1bc')]-_0x2a2f37){clearPredictiveAttributes(_0x2ab997);loggerPredictive[_0xc9f7('0x4c')](_0x2ab997['name'],_0xc9f7('0x1cf'),_0x3af6dc,_0xc9f7('0x1d0'),_0x2ab997['predictiveIntervalAvailable'],'-',_0x2a2f37,'=',_0x2ab997['predictiveIntervalAvailable']-_0x2a2f37,')');}else if(_0x2ab997['predictiveIntervalAvailable']&&_0x3af6dc>_0x2ab997[_0xc9f7('0x1bc')]+_0x4d73ff){clearPredictiveAttributes(_0x2ab997);loggerPredictive[_0xc9f7('0x4c')](_0x2ab997[_0xc9f7('0x4a')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3af6dc,_0xc9f7('0x1d1'),_0x2ab997[_0xc9f7('0x1bc')],'+',_0x4d73ff,'=',_0x2ab997['predictiveIntervalAvailable']+_0x4d73ff,')');}};Dialer[_0xc9f7('0x8b')]['getDataPredictive']=function(_0x3f9048){var _0xf0b1f3=this;return function(_0x11ead9){return new Promise(function(_0x22370b,_0x3cde22){_[_0xc9f7('0x64')](_0x3f9048,_0x11ead9[0x0]);if(checkGetDataPredictive(_0x11ead9[0x0])){var _0x510168=_0x3f9048[_0xc9f7('0x1bc')]=_0x3f9048[_0xc9f7('0x143')]+_0x3f9048['available'];var _0x36d287=_0x3f9048[_0xc9f7('0x1c3')]*0x3c;var _0xc709df=_0x11ead9[0x0]['predictiveIntervalAvgTalktime']+_0x11ead9[0x0][_0xc9f7('0x55')];var _0x3e3e9b=(_0x11ead9[0x0][_0xc9f7('0x1d2')]+_0x11ead9[0x0][_0xc9f7('0x52')]+_0x11ead9[0x0][_0xc9f7('0x54')])/_0x11ead9[0x0]['predictiveIntervalTotalCalls'];_0x3f9048[_0xc9f7('0x1be')]=_0x3e3e9b>0x0?_0x3e3e9b:0x1;switch(_0x3f9048['dialPredictiveOptimization']){case _0xc9f7('0x1c8'):var _0x39b151=_0x3f9048[_0xc9f7('0x1ba')]/0x64;return _0xf0b1f3[_0xc9f7('0x1d3')](_0x510168,_0x36d287,_0xc709df,_0x3e3e9b,_0x39b151)['then'](function(_0x2c380d){return _0x22370b(_0x2c380d);});case _0xc9f7('0x1d4'):var _0x251e27=_0x3f9048['dialPredictiveOptimizationPercentage']/0x64;return _0xf0b1f3[_0xc9f7('0x1d5')](_0x510168,_0x36d287,_0xc709df,_0x3e3e9b,_0x251e27)[_0xc9f7('0x40')](function(_0x3a0a21){return _0x22370b(_0x3a0a21);});default:return _0x3cde22(msgResponse(_0xc9f7('0x1d6'),_0xc9f7('0x9a'),'Unknown\x20Predictive'));}}else{return _0x3cde22(msgResponse(_0xc9f7('0x1d6'),_0xc9f7('0x9a'),'check\x20failure'));}});};};Dialer['prototype'][_0xc9f7('0x1d7')]=function(_0x2722b0){var _0x2ef185=this;return function(_0x34abb3){return new Promise(function(_0x27c5d3,_0x1c08b8){_[_0xc9f7('0x64')](_0x2722b0,_0x34abb3[0x0]);if(checkGetDataPredictive(_0x34abb3[0x0])){loggerPredictive[_0xc9f7('0x4c')](JSON[_0xc9f7('0x7a')](_0x34abb3[0x0]));if(_0x2722b0[_0xc9f7('0x1c5')]===_0xc9f7('0x1c8')){return _0x2ef185[_0xc9f7('0x158')](_0x2722b0['id'])[_0xc9f7('0x40')](function(_0x45d11e){var _0x1a6c64=_0x2722b0['loggedIn']-_0x45d11e[0x0][_0xc9f7('0x1d8')];var _0x19588d=_0x2722b0[_0xc9f7('0x1c3')]*0x3c;var _0x5e5747=_0x34abb3[0x0]['predictiveIntervalAvgTalktime']+_0x34abb3[0x0][_0xc9f7('0x55')];var _0x5d64b0=(_0x34abb3[0x0][_0xc9f7('0x1d2')]+_0x34abb3[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x34abb3[0x0][_0xc9f7('0x54')])/_0x34abb3[0x0][_0xc9f7('0x4f')];var _0x5ca530=_0x2722b0[_0xc9f7('0x1ba')]/0x64;_0x2722b0[_0xc9f7('0x1d9')]=_0x45d11e[0x0][_0xc9f7('0x1d8')]||0x0;_0x2722b0['predictiveIntervalHitRate']=_0x5d64b0>0x0?_0x5d64b0:0x1;return _0x2ef185[_0xc9f7('0x1d3')](_0x1a6c64,_0x19588d,_0x5e5747,_0x5d64b0,_0x5ca530);})[_0xc9f7('0x40')](function(_0x374387){return _0x27c5d3(_0x374387);})['catch'](function(_0x236384){return _0x1c08b8(msgResponse(_0xc9f7('0x1da'),_0xc9f7('0x9a'),JSON[_0xc9f7('0x7a')](_0x236384)));});}if(_0x2722b0[_0xc9f7('0x1c5')]===_0xc9f7('0x1d4')){return _0x2ef185[_0xc9f7('0x158')](_0x2722b0['id'])[_0xc9f7('0x40')](function(_0x1f47ea){var _0x3ddd48=_0x2722b0['loggedIn']-_0x1f47ea[0x0]['outboundQueuePauses'];var _0x165937=_0x2722b0['dialPredictiveInterval']*0x3c;var _0xee2ab2=_0x34abb3[0x0]['predictiveIntervalAvgTalktime']+_0x34abb3[0x0][_0xc9f7('0x55')];var _0x598379=(_0x34abb3[0x0][_0xc9f7('0x1d2')]+_0x34abb3[0x0][_0xc9f7('0x52')]+_0x34abb3[0x0][_0xc9f7('0x54')])/_0x34abb3[0x0][_0xc9f7('0x4f')];var _0x25b614=_0x2722b0[_0xc9f7('0x1ba')]/0x64;_0x2722b0['predictiveIntervalPauses']=_0x1f47ea[0x0][_0xc9f7('0x1d8')]||0x0;_0x2722b0[_0xc9f7('0x1be')]=_0x598379>0x0?_0x598379:0x1;return _0x2ef185[_0xc9f7('0x1d5')](_0x3ddd48,_0x165937,_0xee2ab2,_0x598379,_0x25b614);})['then'](function(_0x5a12aa){return _0x27c5d3(_0x5a12aa);})[_0xc9f7('0xa7')](function(_0x347ef2){return _0x1c08b8(msgResponse(_0xc9f7('0x1da'),_0xc9f7('0x9a'),JSON['stringify'](_0x347ef2)));});}}else{return _0x1c08b8(msgResponse(_0xc9f7('0x1d6'),_0xc9f7('0x9a'),_0xc9f7('0x1db')));}});};};Dialer[_0xc9f7('0x8b')]['startMethodPredictive']=function(_0x57203e){var _0x4d6154=this;return function(){var _0x29a537=0x0;var _0x10a2bd=Math[_0xc9f7('0x1dc')](_0x57203e['erlangCallToSecond']*0x3e8);if(_0x10a2bd>0x0){_0x10a2bd=_0x10a2bd<0x64?0x64:_0x10a2bd;loggerPredictive[_0xc9f7('0x4c')](_0x57203e[_0xc9f7('0x4a')],_0xc9f7('0x1dd'),_0x10a2bd,_0xc9f7('0x1de'));_0x57203e[_0xc9f7('0x68')]=setInterval(function(){_0x4d6154[_0xc9f7('0x68')](_0x57203e);loggerPredictiveCalls[_0xc9f7('0x4c')](_0xc9f7('0x1df'),_0x29a537+=0x1);},_0x10a2bd);}else{loggerPredictive['info'](_0x57203e[_0xc9f7('0x4a')],_0xc9f7('0x1e0'));}};};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x1e1')]=function(_0x39b826,_0x24bcda){var _0x1740de=this;return function(_0x2b35b0){if(_[_0xc9f7('0x4b')](_0x2b35b0)){if(_[_0xc9f7('0xfa')](_0x24bcda[_0xc9f7('0x1e2')])||!_0x24bcda[_0xc9f7('0x1e3')]){if(_0x39b826[_0xc9f7('0x1e4')]===_0xc9f7('0x7')){_0x39b826[_0xc9f7('0x77')]=_[_0xc9f7('0x42')](_0x39b826[_0xc9f7('0x77')])?!![]:_0x39b826[_0xc9f7('0x77')];var _0x1bf1bf=uuid['v4']();_0x1740de[_0xc9f7('0x23')][_0x1bf1bf]=new Action(_0x39b826,_0x24bcda,_0x1bf1bf);loggerBooked['info'](_0xc9f7('0x1e5'),_0x1bf1bf,_0xc9f7('0x1e6'),JSON[_0xc9f7('0x7a')](_0x39b826[_0xc9f7('0x77')]),_0xc9f7('0x1e7'),_0x39b826[_0xc9f7('0x4a')]);if(_0x39b826[_0xc9f7('0x77')]){_0x39b826[_0xc9f7('0x77')]=![];_0x1740de[_0xc9f7('0x2a')][_0x1740de[_0xc9f7('0x23')][_0x1bf1bf][_0xc9f7('0xc8')]]=[];ami[_0xc9f7('0xa8')]({'actionid':_0x1bf1bf,'action':_0xc9f7('0x1e8'),'queue':_0x39b826[_0xc9f7('0x4a')]})[_0xc9f7('0xa7')](function(){_0x1740de[_0xc9f7('0xcc')](_0x39b826);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x1740de['actions'][_0x1bf1bf][_0xc9f7('0xf2')],'ListId':_0x1740de['actions'][_0x1bf1bf][_0xc9f7('0xe6')],'VoiceQueueId':_0x1740de[_0xc9f7('0x23')][_0x1bf1bf]['VoiceQueueId']||undefined,'CampaignId':_0x1740de[_0xc9f7('0x23')][_0x1bf1bf][_0xc9f7('0xe8')]||undefined})[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x1e9')));delete _0x1740de[_0xc9f7('0x23')][_0x1bf1bf];});}else{loggerBooked['info'](_0xc9f7('0x1ea'),JSON[_0xc9f7('0x7a')](_0x39b826['queueStatusComplete']),_0xc9f7('0x1e7'),_0x39b826[_0xc9f7('0x4a')]);_0x1740de['updateOriginated'](_0x39b826);hopperUtils[_0xc9f7('0xe4')]({'active':![],'ContactId':_0x1740de[_0xc9f7('0x23')][_0x1bf1bf]['ContactId'],'ListId':_0x1740de[_0xc9f7('0x23')][_0x1bf1bf][_0xc9f7('0xe6')],'VoiceQueueId':_0x1740de['actions'][_0x1bf1bf][_0xc9f7('0xe7')]||undefined,'CampaignId':_0x1740de[_0xc9f7('0x23')][_0x1bf1bf][_0xc9f7('0xe8')]||undefined})[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x1e9')));delete _0x1740de[_0xc9f7('0x23')][_0x1bf1bf];}}else{return _0x1740de['actionOriginate'](_0x39b826,_0x24bcda);}}else{if(utils[_0xc9f7('0x65')](undefined,_0x24bcda[_0xc9f7('0x1eb')])<_0x39b826[_0xc9f7('0x1ec')]*0x3c){if(_0x24bcda[_0xc9f7('0x15f')]&&!_0x24bcda[_0xc9f7('0x15f')][_0xc9f7('0x1ed')]){_0x1740de['preview'][_0xc9f7('0x100')](_0x24bcda['id'])[_0xc9f7('0x1a')](function(){_0x1740de['updateOriginated'](_0x39b826);});}else{hopperUtils[_0xc9f7('0x1ee')]({'active':![]},_0x24bcda['id'],0x1)[_0xc9f7('0x1a')](function(){_0x1740de[_0xc9f7('0xcc')](_0x39b826);});}}else{_0x39b826[_0xc9f7('0x1ef')]+=0x1;_0x1740de[_0xc9f7('0xcc')](_0x39b826);if(_0x39b826['dialRecallInQueue']){hopperUtils[_0xc9f7('0xe4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x24bcda[_0xc9f7('0xf2')],'ListId':_0x24bcda[_0xc9f7('0xe6')],'VoiceQueueId':_0x24bcda[_0xc9f7('0xe7')]||undefined,'CampaignId':_0x24bcda[_0xc9f7('0xe8')]||undefined})[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x1f0')));hopperUtils[_0xc9f7('0xd2')](createObjHistory(_0x39b826,_0x24bcda,utils[_0xc9f7('0x6e')]['QUEUE_RECALL'],0x17,_0xc9f7('0x1f1')))[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x1f2')));}else{_0x1740de[_0xc9f7('0x131')](createObjHistory(_0x39b826,_0x24bcda,utils[_0xc9f7('0x6e')]['RECALL_TIMEOUT'],0x16,_0xc9f7('0x1f3')),_0xc9f7('0x1f4'),_0xc9f7('0x1f5'));}}}}else{_0x39b826[_0xc9f7('0x1f6')]+=0x1;_0x1740de[_0xc9f7('0x131')](createObjHistory(_0x39b826,_0x24bcda,utils[_0xc9f7('0x6e')][_0xc9f7('0x1f7')],0xd,_0xc9f7('0x1f8')),_0xc9f7('0x1f9'),_0xc9f7('0x1fa'));throw _0xc9f7('0x1fb');}};};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x1fc')]=function(_0x32cf15){var _0x1c73c2=this;var _0x1b9e9c=_0x32cf15[_0xc9f7('0x1fd')]-_0x32cf15['originated'];emitCampaignSummary(_0x32cf15);if(_0x1b9e9c>0x0&&_0x32cf15[_0xc9f7('0x1fe')]==0x0){if(_0x1b9e9c>this['maxNumberOriginate']){_0x1b9e9c=this['maxNumberOriginate'];}_0x32cf15['temp']=0x1;hopperUtils[_0xc9f7('0x1ff')](_0x32cf15,_0x1b9e9c)[_0xc9f7('0x40')](function(_0x2d5f1f){_0x32cf15['temp']=0x0;if(_0x2d5f1f){if(!utils['checkContactEmpty'](_0x2d5f1f)){_0x32cf15[_0xc9f7('0x6d')]=utils[_0xc9f7('0x6e')]['NO_AVAILABLE_CONTACTS'];logger[_0xc9f7('0x4c')](_0xc9f7('0x200')+_0x32cf15['name']);}else{_0x32cf15[_0xc9f7('0x86')]+=_0x2d5f1f[_0xc9f7('0xa0')];_0x32cf15['message']=utils[_0xc9f7('0x6e')][_0xc9f7('0x201')];for(var _0x78652b=0x0;_0x78652b<_0x2d5f1f[_0xc9f7('0xa0')];_0x78652b+=0x1){_0x32cf15[_0xc9f7('0x202')]+=0x1;if(_[_0xc9f7('0xfa')](_0x2d5f1f[_0x78652b])||_[_0xc9f7('0xfa')](_0x2d5f1f[_0x78652b]['Contact'])||_[_0xc9f7('0xfa')](_0x2d5f1f[_0x78652b][_0xc9f7('0x163')])){_0x1c73c2['emptyContact'](_0xc9f7('0x203'),_0x32cf15,_0x2d5f1f[_0x78652b]);}else{hopperUtils[_0xc9f7('0x204')](_[_0xc9f7('0x7b')](_0x2d5f1f[_0x78652b],[_0xc9f7('0xe8'),_0xc9f7('0x163')]))[_0xc9f7('0x40')](_0x1c73c2[_0xc9f7('0x1e1')](_0x32cf15,_0x2d5f1f[_0x78652b]))[_0xc9f7('0xa7')](_0x1c73c2['loggerHandler'](_0xc9f7('0x205'),_0x32cf15));}}}}})['catch'](loggerGetContactDialer(_0xc9f7('0x206'),_0x32cf15,_0x1b9e9c));}};Dialer['prototype']['handlePower']=function(_0x17b3e4,_0x50ee66){var _0x5f1e50=this;var _0x1de795=[];if(_0x50ee66<0x1||_0x17b3e4['dialMethod']===_0xc9f7('0x7')){_0x50ee66=0x1;}var _0x16272a=Math[_0xc9f7('0x1dc')](_0x17b3e4[_0xc9f7('0x142')]*_0x50ee66)-_0x17b3e4['originated'];if(_0x17b3e4[_0xc9f7('0x207')]>0x0){var _0xcd95b5=_0x17b3e4['dialLimitQueue']-_0x17b3e4[_0xc9f7('0x86')]-_0x17b3e4[_0xc9f7('0x143')]-_0x17b3e4[_0xc9f7('0x208')];if(_0x16272a>_0xcd95b5){_0x16272a=_0xcd95b5;}}if(_0x16272a>0x0&&_0x17b3e4['temp']==0x0){if(_0x17b3e4[_0xc9f7('0x1e4')]===_0xc9f7('0x7')){_0x16272a=0x1;}if(_0x16272a>this['maxNumberOriginate']){_0x16272a=this[_0xc9f7('0x21')];}for(var _0x462046 in this[_0xc9f7('0x1f')]){if(typeof this[_0xc9f7('0x1f')][_0x462046]!==_0xc9f7('0xb3')){if(this[_0xc9f7('0x1f')][_0x462046]['state']===_0xc9f7('0x209')&&this['agents'][_0x462046][_0xc9f7('0x8e')]===_0xc9f7('0x8f')){_0x1de795[_0xc9f7('0xa1')](this[_0xc9f7('0x1f')][_0x462046]['id']);}}}_0x17b3e4[_0xc9f7('0x1fe')]=0x1;hopperUtils['getContactDialer'](_0x17b3e4,_0x1de795,_0x16272a)['then'](function(_0x27f830){_0x17b3e4[_0xc9f7('0x1fe')]=0x0;if(_0x27f830){if(!utils[_0xc9f7('0x20a')](_0x27f830)){hopperUtils['countReScheduled'](_0x17b3e4)[_0xc9f7('0x40')](sendMessageReschedule(_0x17b3e4))[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x20b')));}else{_0x17b3e4[_0xc9f7('0x86')]+=_0x27f830[_0xc9f7('0xa0')];_0x17b3e4['message']=_0x17b3e4[_0xc9f7('0x1e4')]===_0xc9f7('0x7')?utils[_0xc9f7('0x6e')][_0xc9f7('0x144')]:utils[_0xc9f7('0x6e')][_0xc9f7('0x201')];for(var _0x2f1de6=0x0;_0x2f1de6<_0x27f830[_0xc9f7('0xa0')];_0x2f1de6+=0x1){if(_[_0xc9f7('0xfa')](_0x27f830[_0x2f1de6])||_[_0xc9f7('0xfa')](_0x27f830[_0x2f1de6][_0xc9f7('0x17a')])||_[_0xc9f7('0xfa')](_0x27f830[_0x2f1de6][_0xc9f7('0x163')])){_0x5f1e50[_0xc9f7('0x15c')](_0xc9f7('0x203'),_0x17b3e4,_0x27f830[_0x2f1de6]);}else{hopperUtils[_0xc9f7('0x20c')](_['pick'](_0x27f830[_0x2f1de6],['VoiceQueueId',_0xc9f7('0x163')]))[_0xc9f7('0x40')](_0x5f1e50[_0xc9f7('0x1e1')](_0x17b3e4,_0x27f830[_0x2f1de6]))[_0xc9f7('0xa7')](_0x5f1e50[_0xc9f7('0x15b')]('[actionOriginate]\x20',_0x17b3e4));}}}}})[_0xc9f7('0xa7')](loggerGetContactDialer('[getContactDialer2]',_0x17b3e4,_0x16272a));}};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x68')]=function(_0x4a7d2e){if(_0x4a7d2e[_0xc9f7('0x207')]>0x0){var _0x15bb0d=_0x4a7d2e[_0xc9f7('0x207')]-_0x4a7d2e['originated']-_0x4a7d2e[_0xc9f7('0x143')];if(_0x15bb0d>0x0&&_0x4a7d2e[_0xc9f7('0x1fe')]==0x0){this[_0xc9f7('0x20d')](_0x4a7d2e);}else{loggerPredictiveCalls[_0xc9f7('0x4c')]('[handlePredictive][limitChannel]');}}else{this[_0xc9f7('0x20d')](_0x4a7d2e);}};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x20d')]=function(_0x2ec4ef){var _0x2e1b74=this;var _0x189b69=[];_0x2ec4ef[_0xc9f7('0x86')]+=0x1;for(var _0x272650 in this[_0xc9f7('0x1f')]){if(typeof this[_0xc9f7('0x1f')][_0x272650]!==_0xc9f7('0xb3')){if(this['agents'][_0x272650][_0xc9f7('0xd9')]===_0xc9f7('0x209')&&this[_0xc9f7('0x1f')][_0x272650]['status']==='reachable'){_0x189b69[_0xc9f7('0xa1')](this['agents'][_0x272650]['id']);}}}_0x2ec4ef[_0xc9f7('0x1fe')]=0x1;return this['getContactDialer'](_0x2ec4ef['id'],_0x189b69,0x1,_0x2ec4ef[_0xc9f7('0x20e')],_0x2ec4ef)[_0xc9f7('0x40')](function(_0x49e1e7){_0x2ec4ef[_0xc9f7('0x1fe')]=0x1;if(_0x49e1e7){if(!utils[_0xc9f7('0x20a')](_0x49e1e7)){utils['checkContactLowerLimitOriginate'](_0x2ec4ef,0x1,0x0);return hopperUtils[_0xc9f7('0x20f')](_0x2ec4ef)['then'](sendMessageReschedule(_0x2ec4ef))[_0xc9f7('0xa7')](loggerCatch(_0xc9f7('0x20b')));}else{_0x2ec4ef['message']=utils['CAMPAIGN_STATUS'][_0xc9f7('0x201')];if(_[_0xc9f7('0xfa')](_0x49e1e7[0x0])||_[_0xc9f7('0xfa')](_0x49e1e7[0x0][_0xc9f7('0x17a')])||_[_0xc9f7('0xfa')](_0x49e1e7[0x0]['phone'])){_0x2e1b74[_0xc9f7('0x15c')](_0xc9f7('0x203'),_0x2ec4ef,_0x49e1e7[0x0]);}else{return hopperUtils[_0xc9f7('0x20c')](_['pick'](_0x49e1e7[0x0],['VoiceQueueId',_0xc9f7('0x163')]))[_0xc9f7('0x40')](_0x2e1b74[_0xc9f7('0x1e1')](_0x2ec4ef,_0x49e1e7[0x0]))['catch'](_0x2e1b74[_0xc9f7('0x15b')]('[actionOriginatePredictive]\x20',_0x2ec4ef));}}}})[_0xc9f7('0xa7')](loggerGetContactDialer('[getContactDialerPredictive]',_0x2ec4ef,0x1));};Dialer[_0xc9f7('0x8b')]['abandonmentRate']=function(_0x38f439,_0x23e17d,_0x4f0106,_0x4be925,_0x32665d,_0x5828b4){loggerPredictive['info'](_0xc9f7('0x210'));loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x211'),_0x38f439);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x212'),_0x23e17d);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x213'),_0x4f0106);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x214'),_0x4be925);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x215'),_0x32665d);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x58'));return new Promise(function(_0x42f3e1,_0x28bb2a){if(_0x38f439<=0x0||isNaN(_0x38f439)){return _0x28bb2a(msgResponse('[abandonmentRate]','Error',_0xc9f7('0x216')+_0x38f439));}if(_0x4f0106<=0x0||isNaN(_0x4f0106)){return _0x28bb2a(msgResponse(_0xc9f7('0x217'),'Error','Ts\x20=\x20'+_0x4f0106));}if(_0x4be925<=0x0||isNaN(_0x4be925)){return _0x28bb2a(msgResponse(_0xc9f7('0x217'),_0xc9f7('0x8a'),_0xc9f7('0x218')+_0x4be925));}if(_0x23e17d<=0x0||isNaN(_0x23e17d)){return _0x28bb2a(msgResponse(_0xc9f7('0x217'),'Error',_0xc9f7('0x219')+_0x23e17d));}if(_0x32665d<=0x0||isNaN(_0x32665d)){return _0x28bb2a(msgResponse(_0xc9f7('0x217'),'Error',_0xc9f7('0x21a')+_0x32665d));}_0x5828b4=_0x5828b4||0x0;var _0xb3883d=0x1/_0x4f0106;var _0x2aeae2=0x0;var _0x24336c=0x0;var _0x3cab2f=0x0;var _0x6a4a0b=0x0;for(var _0x5c349e=0x0;_0x3cab2f<_0x32665d;_0x5c349e+=0x1){_0x24336c=_0x5c349e/_0x23e17d;_0x2aeae2=(_0x4be925*_0x24336c+_0x5828b4)/_0xb3883d;_0x3cab2f=utils[_0xc9f7('0x21b')](_0x2aeae2,_0x38f439);_0x6a4a0b=_0x2aeae2/_0x38f439*(0x1-utils[_0xc9f7('0x21b')](_0x2aeae2,_0x38f439));}return _0x42f3e1({'erlangCalls':_0x5c349e,'erlangCallToSecond':_0x23e17d/_0x5c349e,'erlangAbandonmentRate':_0x3cab2f,'erlangBusyFactor':_0x6a4a0b});});};Dialer[_0xc9f7('0x8b')][_0xc9f7('0x1d5')]=function(_0x45a0fd,_0x14cfcf,_0x13fa1c,_0x3a079c,_0x54bfda,_0xcc99dc){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0xc9f7('0x211'),_0x45a0fd);loggerPredictive[_0xc9f7('0x4c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x14cfcf);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x213'),_0x13fa1c);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x214'),_0x3a079c);loggerPredictive[_0xc9f7('0x4c')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54bfda);loggerPredictive[_0xc9f7('0x4c')](_0xc9f7('0x58'));return new Promise(function(_0x42e7e9,_0x20a0eb){if(_0x45a0fd<=0x0||isNaN(_0x45a0fd)){return _0x20a0eb(msgResponse(_0xc9f7('0x21c'),_0xc9f7('0x8a'),_0xc9f7('0x216')+_0x45a0fd));}if(_0x13fa1c<=0x0||isNaN(_0x13fa1c)){return _0x20a0eb(msgResponse(_0xc9f7('0x21c'),_0xc9f7('0x8a'),_0xc9f7('0x21d')+_0x13fa1c));}if(_0x3a079c<=0x0||isNaN(_0x3a079c)){return _0x20a0eb(msgResponse(_0xc9f7('0x21c'),_0xc9f7('0x8a'),_0xc9f7('0x218')+_0x3a079c));}if(_0x14cfcf<=0x0||isNaN(_0x14cfcf)){return _0x20a0eb(msgResponse(_0xc9f7('0x21c'),_0xc9f7('0x8a'),_0xc9f7('0x219')+_0x14cfcf));}if(_0x54bfda<=0x0||isNaN(_0x54bfda)){return _0x20a0eb(msgResponse(_0xc9f7('0x21c'),_0xc9f7('0x8a'),_0xc9f7('0x21e')+_0x54bfda));}_0xcc99dc=_0xcc99dc||0x0;var _0x39f3a7=0x1/_0x13fa1c;var _0xc3d2e4=0x0;var _0x1f267c=0x0;var _0x13365e=0x0;var _0x44effd=0x0;for(var _0x41383b=0x0;_0x44effd<_0x54bfda;_0x41383b+=0x1){_0x1f267c=_0x41383b/_0x14cfcf;_0xc3d2e4=(_0x3a079c*_0x1f267c+_0xcc99dc)/_0x39f3a7;_0x13365e=utils[_0xc9f7('0x21b')](_0xc3d2e4,_0x45a0fd);_0x44effd=_0xc3d2e4/_0x45a0fd*(0x1-utils[_0xc9f7('0x21b')](_0xc3d2e4,_0x45a0fd));}return _0x42e7e9({'erlangCalls':_0x41383b,'erlangCallToSecond':_0x14cfcf/_0x41383b,'erlangAbandonmentRate':_0x13365e,'erlangBusyFactor':_0x44effd});});};module[_0xc9f7('0x21f')]=Dialer; \ No newline at end of file +var _0xcf52=['silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','Global:\x20','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','ivr','updateOriginated','uniqueid','answertime','syncAgentComplete','outboundAnswerCallsDay','agent','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','droptime','getSeconds','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','Drop','TIMEOUT','agiafterat','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','stateinterface','locked','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','paused','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','Success','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','dialAMDActive','MACHINE','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countcongestionretry','countnoanswerretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','available','inUse','talking','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','online','resolve','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','undefined','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','isOutboundQueue','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','Trunk','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','checkRetriveMax','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','avgHandleTime','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','loggedIn','busyFactor','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','pTalking','getContactDialer','countReScheduled','checkIsBlackList','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[countReScheduled]\x20','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','p\x20=\x20','Umin\x20=\x20','erlangb','exports','lodash','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','dialer','booked','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','localhost','redis','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','actions','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','isEmpty','-----\x20Stats\x20Predictive\x20---','info','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','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','---------------------------','Avg\x20Talk\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','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','isUndefined','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','starttime','queueStatusComplete','stringify','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','trunks','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','iftime\x20%s,%s','interval','then','content','indexOf','true','Action','command','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','handlePower','dialPowerLevel','method\x20not\x20recognized','dialGlobalInterval'];(function(_0x4b332a,_0x5ec2db){var _0x115a04=function(_0x422160){while(--_0x422160){_0x4b332a['push'](_0x4b332a['shift']());}};_0x115a04(++_0x5ec2db);}(_0xcf52,0x166));var _0x2cf5=function(_0x349dc3,_0x160c29){_0x349dc3=_0x349dc3-0x0;var _0x3d0935=_0xcf52[_0x349dc3];return _0x3d0935;};'use strict';var util=require('util');var _=require(_0x2cf5('0x0'));var uuid=require(_0x2cf5('0x1'));var moment=require(_0x2cf5('0x2'));var rr=require('rr');var Redis=require(_0x2cf5('0x3'));var utils=require(_0x2cf5('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0x2cf5('0x5'));var config=require(_0x2cf5('0x6'));var logger=require('../../../config/logger')(_0x2cf5('0x7'));var loggerBooked=require('../../../config/logger')(_0x2cf5('0x8'));var loggerPredictive=require(_0x2cf5('0x9'))(_0x2cf5('0xa'));var loggerPredictiveCalls=require(_0x2cf5('0x9'))(_0x2cf5('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x2cf5('0xc'));var ami=require(_0x2cf5('0xd'));config['redis']=_['defaults'](config['redis'],{'host':_0x2cf5('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2cf5('0xf')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x2cf5('0x10'));var RpcSetting=require(_0x2cf5('0x11'));var Interval=require(_0x2cf5('0x12'));var Action=require(_0x2cf5('0x13'));var History=require('./models/history');var Final=require(_0x2cf5('0x14'));var AgentComplete=require(_0x2cf5('0x15'));var QueueCallerAbandon=require(_0x2cf5('0x16'));var Hangup=require(_0x2cf5('0x17'));var ipAgi=process[_0x2cf5('0x18')][_0x2cf5('0x19')]||_0x2cf5('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x2cf5('0x1b')][_0x2cf5('0x1c')]=function(_0x334ba1){this['tail']=this[_0x2cf5('0x1d')]?this['tail'][_0x2cf5('0x1e')](_0x334ba1):_0x334ba1();};function Dialer(_0x598144,_0x2ed09d){this[_0x2cf5('0x1f')]=new Sequence();this[_0x2cf5('0x20')]=_0x2ed09d;this[_0x2cf5('0x21')]=_0x598144[_0x2cf5('0x21')];this[_0x2cf5('0x22')]=_0x598144[_0x2cf5('0x22')];this[_0x2cf5('0x23')]=_0x598144['agents'];this['trunks']=_0x598144['trunks'];this[_0x2cf5('0x24')]=config['maxNumberOriginate']||0x2;this[_0x2cf5('0x25')]={};this[_0x2cf5('0x26')]={};this['contactsId']={};this[_0x2cf5('0x27')]={};this['optionPredictive']={};this[_0x2cf5('0x28')]={};this[_0x2cf5('0x29')]={};this[_0x2cf5('0x2a')]={};this[_0x2cf5('0x2b')]={};this[_0x2cf5('0x2c')]={};this[_0x2cf5('0x2d')]={};ami['on'](_0x2cf5('0x2e'),this[_0x2cf5('0x2f')][_0x2cf5('0x30')](this));ami['on']('queuecallerabandon',this[_0x2cf5('0x31')][_0x2cf5('0x30')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0x2cf5('0x32'),this['syncAgentComplete'][_0x2cf5('0x30')](this));ami['on'](_0x2cf5('0x33'),this[_0x2cf5('0xc')]['bind'](this));ami['on'](_0x2cf5('0x34'),this[_0x2cf5('0x35')][_0x2cf5('0x30')](this));ami['on'](_0x2cf5('0x36'),this[_0x2cf5('0x37')][_0x2cf5('0x30')](this));ami['on'](_0x2cf5('0x38'),this[_0x2cf5('0x39')][_0x2cf5('0x30')](this));ami['on'](_0x2cf5('0x3a'),this[_0x2cf5('0x3b')][_0x2cf5('0x30')](this));ami['on']('queuemember',this['syncQueueMember']['bind'](this));ami['on'](_0x2cf5('0x3c'),this[_0x2cf5('0x3d')][_0x2cf5('0x30')](this));this[_0x2cf5('0x3e')]();this[_0x2cf5('0x3f')]();RpcSetting[_0x2cf5('0x40')]()['then'](function(_0x333a5f){previewRecallmeReminderInterval=_0x333a5f[_0x2cf5('0x41')];});}function isNotNull(_0x36855c){return _0x36855c!==null&&!_['isUndefined'](_0x36855c);}function msgResponse(_0x5eb2a4,_0x18717c,_0x410aa7){return{'action':_0x5eb2a4,'response':_0x18717c,'message':_0x410aa7,'stack':_0x410aa7};}function emit(_0x4762fc,_0x469487,_0x118fed){io['to'](_0x4762fc)[_0x2cf5('0x42')](_0x469487,_0x118fed);}function emitOutboundVoiceQueueSummary(_0x3edcbc){if(_0x3edcbc[_0x2cf5('0x43')]==='outbound'){logger[_0x2cf5('0x44')](_0x2cf5('0x45'),util[_0x2cf5('0x46')](_0x3edcbc,{'showHidden':![],'depth':null}));emit(util['format'](_0x2cf5('0x47'),_0x3edcbc[_0x2cf5('0x48')]),'voice_queue:save',_0x3edcbc);}}function checkGetDataPredictive(_0x128a19){if(isNotNull(_0x128a19)&&!_[_0x2cf5('0x49')](_0x128a19)){loggerPredictive['info'](_0x2cf5('0x4a'));loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x4c'),_0x128a19[_0x2cf5('0x4d')]);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x4e'),_0x128a19[_0x2cf5('0x4f')]);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x50'),_0x128a19['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x2cf5('0x4b')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x128a19['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x51'),_0x128a19[_0x2cf5('0x52')]);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x53'),_0x128a19[_0x2cf5('0x54')]);loggerPredictive['info'](_0x2cf5('0x55'));if(_0x128a19[_0x2cf5('0x4d')]>0x0){if(!_['isUndefined'](_0x128a19['predictiveIntervalAvgTalktime'])&&_0x128a19[_0x2cf5('0x54')]>0x0){return!![];}loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x56'));if(!_['isUndefined'](_0x128a19[_0x2cf5('0x52')])&&_0x128a19[_0x2cf5('0x52')]>0x0){return!![];}loggerPredictive[_0x2cf5('0x4b')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x57'));}}else{loggerPredictive['info'](_0x2cf5('0x58'));}return![];}function mergeDataErlangB(_0x1b3038){return function(_0x35a383){loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x59'));loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x5a'),_0x35a383[_0x2cf5('0x5b')]);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x5c'),_0x35a383[_0x2cf5('0x5d')]);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x5e'),_0x35a383[_0x2cf5('0x5f')]);loggerPredictive[_0x2cf5('0x4b')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35a383['erlangBusyFactor']);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x5e'),_0x35a383[_0x2cf5('0x5f')]);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x55'));_[_0x2cf5('0x60')](_0x1b3038,_0x35a383);};}function ifInterval(_0x52e67d,_0x4a1774){if(_[_0x2cf5('0x61')](_0x4a1774)){return![];}return utils['getSeconds'](undefined,_0x4a1774)<_0x52e67d*0x3c;}function clearPredictiveAttributes(_0x44273d){if(_0x44273d['startProgressive']){_0x44273d['startProgressive']=undefined;loggerPredictive[_0x2cf5('0x44')](_0x44273d[_0x2cf5('0x48')],_0x2cf5('0x62'));}if(_0x44273d[_0x2cf5('0x28')]){_0x44273d[_0x2cf5('0x28')]=undefined;loggerPredictive['debug'](_0x44273d['name'],'startPredictive\x20value\x20cleared');}if(_0x44273d['handlePredictive']){clearInterval(_0x44273d['handlePredictive']);_0x44273d[_0x2cf5('0x63')]=undefined;loggerPredictive[_0x2cf5('0x44')](_0x44273d[_0x2cf5('0x48')],_0x2cf5('0x64'));}}function loggerCatchPredictive(_0x5cdeda,_0x2bfefc){return function(_0x4d5bfb){loggerPredictive[_0x2cf5('0x65')](_0x2bfefc[_0x2cf5('0x48')],_0x5cdeda);loggerPredictive[_0x2cf5('0x65')](_0x4d5bfb['stack']);clearPredictiveAttributes(_0x2bfefc);};}function loggerCatch(_0x551e72){return function(_0x49fd8c){logger[_0x2cf5('0x65')](_0x551e72,util['inspect'](_0x49fd8c,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xf4c3fb,_0x3def8c,_0x10b3f4){return function(_0x5eaf42){utils['checkContactLowerLimitOriginate'](_0x3def8c,_0x10b3f4,0x0);logger[_0x2cf5('0x65')](_0xf4c3fb,util[_0x2cf5('0x46')](_0x5eaf42,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x55d06c){return function(_0x56fe47){if(isNotNull(_0x56fe47)&&isNotNull(_0x56fe47[0x0])){if(_0x56fe47[0x0][_0x2cf5('0x66')]>0x0){_0x55d06c[_0x2cf5('0x67')]=utils[_0x2cf5('0x68')]['CONTACTS_RESCHEDULED'];logger[_0x2cf5('0x4b')](_0x2cf5('0x69')+_0x55d06c['name'],_0x56fe47[0x0]['contactsRescheduled'],_0x2cf5('0x6a'));}else{_0x55d06c['message']=utils['CAMPAIGN_STATUS'][_0x2cf5('0x6b')];logger['info']('[getContactDialer2][Empty]'+_0x55d06c[_0x2cf5('0x48')]);}}};}function createObjHistory(_0x135375,_0x330cb2,_0x5ac3fe,_0x2bc2d0,_0x286ac1){_0x135375[_0x2cf5('0x67')]=_0x5ac3fe;var _0x2ca552=new Action(_0x135375,_0x330cb2);var _0x280e7b=new History(_0x2ca552);_0x280e7b[_0x2cf5('0x6c')]=_0x2bc2d0;_0x280e7b[_0x2cf5('0x6d')]=_0x286ac1;_0x280e7b[_0x2cf5('0x6e')]=_0x2ca552[_0x2cf5('0x6f')];return _0x280e7b;}function unlockQueueStatus(_0x5dd449,_0x1e8b69){setTimeout(function(){if(_[_0x2cf5('0x61')](_0x5dd449[_0x2cf5('0x70')])){loggerBooked[_0x2cf5('0x65')]('[unlockQueueStatus][undefined]',_0x1e8b69);}_0x5dd449[_0x2cf5('0x70')]=!![];loggerBooked[_0x2cf5('0x4b')]('[booked][unlockQueueStatus]',_0x1e8b69,JSON[_0x2cf5('0x71')](_[_0x2cf5('0x72')](_0x5dd449,['name',_0x2cf5('0x70')])));},0x1f3);}function checkInterval(_0x29d3af){return function(){if(!isNotNull(_0x29d3af[_0x2cf5('0x73')])){_0x29d3af['message']=utils[_0x2cf5('0x68')][_0x2cf5('0x74')];throw _0x29d3af[_0x2cf5('0x48')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x29d3af['Interval'][_0x2cf5('0x75')])){_0x29d3af[_0x2cf5('0x67')]=utils[_0x2cf5('0x68')]['NULL_INTERVAL'];throw _0x29d3af[_0x2cf5('0x48')]+_0x2cf5('0x76');}if(!isNotNull(_['isEmpty'](_0x29d3af['Interval']['Intervals']))){_0x29d3af[_0x2cf5('0x67')]=utils[_0x2cf5('0x68')][_0x2cf5('0x74')];throw _0x29d3af[_0x2cf5('0x48')]+_0x2cf5('0x76');}};}function checkIsIVRCampaignActive(_0x526fe1){return function(){if(!utils[_0x2cf5('0x77')](_0x526fe1)){_0x526fe1[_0x2cf5('0x67')]=utils['CAMPAIGN_STATUS'][_0x2cf5('0x78')];throw _0x526fe1[_0x2cf5('0x48')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x52462b){if(utils[_0x2cf5('0x79')](_0x52462b)){emit(util[_0x2cf5('0x7a')](_0x2cf5('0x7b'),_0x52462b[_0x2cf5('0x48')]),_0x2cf5('0x7c'),_0x52462b);}}function loggerCatchQueueSummary(_0xdeb63b,_0x12af27){return function(_0x656c34){clearPredictiveAttributes(_0x12af27);emitCampaignSummary(_0x12af27);loggerSyncQueueSummary[_0x2cf5('0x44')](_0xdeb63b,util[_0x2cf5('0x46')](_0x656c34,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3ffcf4){if(_0x3ffcf4[_0x2cf5('0x7d')]){if(_0x3ffcf4[_0x2cf5('0x7e')]===0x0){_0x3ffcf4[_0x2cf5('0x7d')]=![];_0x3ffcf4[_0x2cf5('0x67')]=utils['CAMPAIGN_STATUS'][_0x2cf5('0x78')];loggerSyncQueueSummary['debug'](_0x2cf5('0x7f'),_0x3ffcf4[_0x2cf5('0x48')],_0x2cf5('0x80'));}else{_0x3ffcf4['message']=utils[_0x2cf5('0x68')]['DISACTIVED'];loggerSyncQueueSummary[_0x2cf5('0x44')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3ffcf4[_0x2cf5('0x48')],_0x2cf5('0x81'));}emitCampaignSummary(_0x3ffcf4);}}function myreject(_0x1fe11f){return function(_0x8eb185){return _0x1fe11f(msgResponse(_0x2cf5('0x82'),_0x2cf5('0x83'),JSON['stringify'](_0x8eb185)));};}Dialer[_0x2cf5('0x1b')][_0x2cf5('0x84')]=function(_0x5c0219){return!_['isUndefined'](_0x5c0219)&&_0x5c0219&&!_[_0x2cf5('0x61')](_0x5c0219[_0x2cf5('0x48')])&&!_[_0x2cf5('0x61')](_0x5c0219[_0x2cf5('0x85')])&&_0x5c0219[_0x2cf5('0x85')]&&(this[_0x2cf5('0x86')][util[_0x2cf5('0x7a')](_0x2cf5('0x87'),_0x5c0219[_0x2cf5('0x48')])]['status']===_0x2cf5('0x88')||this[_0x2cf5('0x86')][util[_0x2cf5('0x7a')]('SIP/%s',_0x5c0219[_0x2cf5('0x48')])][_0x2cf5('0x89')]===_0x2cf5('0x8a'));};Dialer['prototype'][_0x2cf5('0x8b')]=function(_0x4cb882){var _0x17d446=this;return function(){if(!_0x17d446['isTrunkReachable'](_0x4cb882['Trunk'])){if(!_0x17d446[_0x2cf5('0x84')](_0x4cb882[_0x2cf5('0x8c')])){_0x4cb882[_0x2cf5('0x67')]=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x4cb882[_0x2cf5('0x48')]+_0x2cf5('0x8d');}}};};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x8e')]=function(_0x752528,_0x4b116b,_0x5a4ed7,_0x57eb83){var _0x3b5656=this;return function(){var _0x4770b3=!![];return _0x3b5656[_0x2cf5('0x8f')](_0x752528,_0x4b116b,_0x5a4ed7,_0x57eb83,_0x4770b3);};};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x90')]=function(_0x3470e4,_0x40e28a,_0x301c23,_0x3b47db){var _0x4accd3=this;return function(){var _0x194259=![];return _0x4accd3['ifTimeIvr'](_0x3470e4[_0x2cf5('0x75')],_0x40e28a,_0x301c23,_0x3b47db,_0x194259);};};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x8f')]=function(_0x2fbe3b,_0x459870,_0x264c98,_0xdaca81,_0x3c86ce){var _0x3d5870=[];return new Promise(function(_0x4c5660,_0x1ba582){if(!isNotNull(_0x2fbe3b)){_0xdaca81[_0x2cf5('0x67')]=utils[_0x2cf5('0x68')][_0x2cf5('0x74')];return _0x1ba582(msgResponse(_0x2cf5('0x91'),_0x2cf5('0x92'),_0x264c98+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x2cf5('0x49')](_0x2fbe3b)){_0xdaca81[_0x2cf5('0x67')]=utils['CAMPAIGN_STATUS'][_0x2cf5('0x93')];return _0x1ba582(msgResponse(_0x2cf5('0x91'),_0x2cf5('0x92'),_0x264c98+_0x2cf5('0x94')));}if(_0x459870&&_[_0x2cf5('0x61')](config[_0x2cf5('0x95')][_0x459870])){_0xdaca81[_0x2cf5('0x67')]=utils['CAMPAIGN_STATUS'][_0x2cf5('0x96')];return _0x1ba582(msgResponse(_0x2cf5('0x91'),'Failure',_0x264c98+_0x2cf5('0x97')+_0x459870));}if(_[_0x2cf5('0x98')](_0x2fbe3b)){for(var _0x6558c3=0x0;_0x6558c3<_0x2fbe3b[_0x2cf5('0x99')];_0x6558c3+=0x1){_0x3d5870[_0x2cf5('0x9a')](ami['Action']({'action':'command','command':util[_0x2cf5('0x7a')](_0x2cf5('0x9b'),_0x2fbe3b[_0x6558c3][_0x2cf5('0x9c')],!_[_0x2cf5('0x61')](config[_0x2cf5('0x95')][_0x459870])?_0x459870:'')})[_0x2cf5('0x9d')](function(_0x1c93ff){return _0x1c93ff[_0x2cf5('0x9e')][_0x2cf5('0x9f')](_0x2cf5('0xa0'))>=0x0;})['catch'](myreject(_0x1ba582)));}}else{_0x3d5870[_0x2cf5('0x9a')](ami[_0x2cf5('0xa1')]({'action':_0x2cf5('0xa2'),'command':util[_0x2cf5('0x7a')](_0x2cf5('0x9b'),_0x2fbe3b,!_[_0x2cf5('0x61')](config[_0x2cf5('0x95')][_0x459870])?_0x459870:'')})[_0x2cf5('0x9d')](function(_0x590632){return _0x590632[_0x2cf5('0x9e')][_0x2cf5('0x9f')](_0x2cf5('0xa0'))>=0x0;})[_0x2cf5('0xa3')](myreject(_0x1ba582)));}Promise[_0x2cf5('0xa4')](_0x3d5870)[_0x2cf5('0x9d')](function(_0x2b1bed){var _0x3b5db4=_[_0x2cf5('0xa5')](_0x2b1bed);if(_0x3b5db4){return _0x4c5660(_0x3b5db4);}else{_0xdaca81[_0x2cf5('0x67')]=_0x3c86ce?utils[_0x2cf5('0x68')][_0x2cf5('0xa6')]:utils[_0x2cf5('0x68')][_0x2cf5('0xa7')];return _0x1ba582(msgResponse(_0x2cf5('0xa8'),_0x2cf5('0x92'),'Global:\x20'+_0x3c86ce+'\x20'+_0x264c98+_0x2cf5('0xa9')+util[_0x2cf5('0x46')](_0x2fbe3b,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x459870));}})[_0x2cf5('0xa3')](function(_0x5ebe55){return _0x1ba582(msgResponse('ifTime',_0x2cf5('0x92'),JSON[_0x2cf5('0x71')](_0x5ebe55)));});});};Dialer[_0x2cf5('0x1b')]['loopCampaigns']=function(){var _0x37df1e=this;return cmHopper[_0x2cf5('0xaa')]({'active':![]},{'where':{'active':!![]}})[_0x2cf5('0x9d')](function(){setInterval(function(){_0x37df1e[_0x2cf5('0xab')]();},0x3e8);});};Dialer[_0x2cf5('0x1b')][_0x2cf5('0xab')]=function(){var _0x1b6fdf=this;var _0x15891e;for(var _0xa74eb0 in this[_0x2cf5('0x22')]){if(typeof this['campaigns'][_0xa74eb0]!=='undefined'){_0x15891e=this['campaigns'][_0xa74eb0];if(utils[_0x2cf5('0x79')](_0x15891e)&&utils['isIVRCampaignActive'](_0x15891e)){_0x15891e['sendMessageOneNotActive']=!![];Promise['resolve']()[_0x2cf5('0x9d')](checkIsIVRCampaignActive(_0x15891e))['then'](checkInterval(_0x15891e))[_0x2cf5('0x9d')](_0x1b6fdf[_0x2cf5('0x8b')](_0x15891e))[_0x2cf5('0x9d')](_0x1b6fdf['checkIfTime'](_0x15891e['dialGlobalInterval'],_0x15891e[_0x2cf5('0xac')],_0x15891e[_0x2cf5('0x48')],_0x15891e))['then'](_0x1b6fdf['checkIfTimeIntervals'](_0x15891e[_0x2cf5('0x73')],_0x15891e[_0x2cf5('0xac')],_0x15891e[_0x2cf5('0x48')],_0x15891e))[_0x2cf5('0x9d')](_0x1b6fdf[_0x2cf5('0xad')](_0x15891e))[_0x2cf5('0xa3')](loggerCatchQueueSummary(_0x2cf5('0xae'),_0x15891e));}else{notSendMessagesCampaign(_0x15891e);}}}};Dialer['prototype']['checkDialMethod']=function(_0x2a87e0){if(_0x2a87e0[_0x2cf5('0xaf')]!==_0x2cf5('0xa')){clearPredictiveAttributes(_0x2a87e0);}switch(_0x2a87e0[_0x2cf5('0xaf')]){case _0x2cf5('0xb0'):this[_0x2cf5('0xb1')](_0x2a87e0,0x1);break;case'power':this['handlePower'](_0x2a87e0,_0x2a87e0[_0x2cf5('0xb2')]);break;case _0x2cf5('0xa'):this[_0x2cf5('0xa')](_0x2a87e0);break;case _0x2cf5('0x8'):this[_0x2cf5('0xb1')](_0x2a87e0,0x1);break;default:logger['error']('Queue',_0x2a87e0[_0x2cf5('0x48')],_0x2cf5('0xb3'));}};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x91')]=function(_0x1b4d0,_0x1454a5){var _0x2a82ad=_0x1b4d0['dialTimezone'];var _0xc38a46=_0x1454a5?_0x1b4d0[_0x2cf5('0xb4')]:_0x1b4d0['Interval'][_0x2cf5('0x75')];logger[_0x2cf5('0xb5')](_0x2cf5('0xb6'),_0xc38a46,_0x2a82ad,_0x1b4d0[_0x2cf5('0x48')],util[_0x2cf5('0x7a')](_0x2cf5('0xb7'),_0x1b4d0[_0x2cf5('0x48')],_0x1b4d0['id']));var _0x3fe4a0=null;return Interval['intervalIftime'](_0xc38a46,_0x2a82ad)[_0x2cf5('0x9d')](function(_0x2d6e62){if(_0x2d6e62===!![]){return _0x2d6e62;}else{_0x1b4d0['message']=_0x1454a5?utils[_0x2cf5('0x68')][_0x2cf5('0xa6')]:utils[_0x2cf5('0x68')][_0x2cf5('0xa7')];_0x3fe4a0=msgResponse(_0x2cf5('0xa8'),_0x2cf5('0x92'),_0x2cf5('0xb8')+_0x1454a5+'\x20'+_0x1b4d0[_0x2cf5('0x48')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2cf5('0x46')](_0xc38a46,{'showHidden':![],'depth':null})+_0x2cf5('0xb9')+_0x2a82ad);}if(_0x3fe4a0!==null){logger[_0x2cf5('0xb5')](_0x2cf5('0xba'),_0x3fe4a0);_0x3fe4a0['isGlobal']=_0x1454a5;throw _0x3fe4a0;}})[_0x2cf5('0xa3')](function(_0x5c71f5){logger['error'](_0x2cf5('0xbb'),_0x5c71f5);throw msgResponse('[ifTime][Action]',_0x2cf5('0x83'),util['inspect'](_0x5c71f5,{'showHidden':![],'depth':null}));});};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x2f')]=function(_0x451a9b){if(this[_0x2cf5('0x21')][_0x451a9b[_0x2cf5('0xbc')]]){if(this[_0x2cf5('0x27')][_0x451a9b['uniqueid']]&&this[_0x2cf5('0x27')][_0x451a9b['uniqueid']]['type']!==_0x2cf5('0xbd')){this[_0x2cf5('0xbe')](this[_0x2cf5('0x21')][_0x451a9b['queue']]);this[_0x2cf5('0x27')][_0x451a9b[_0x2cf5('0xbf')]][_0x2cf5('0xc0')]=moment()[_0x2cf5('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x2cf5('0x1b')][_0x2cf5('0xc1')]=function(_0x2a620b){var _0x31d1d0=this[_0x2cf5('0x27')][_0x2a620b['uniqueid']];if(this[_0x2cf5('0x21')][_0x2a620b[_0x2cf5('0xbc')]]){if(_0x31d1d0&&_0x31d1d0[_0x2cf5('0x43')]!==_0x2cf5('0xbd')){delete this[_0x2cf5('0x27')][_0x2a620b['uniqueid']];this['voiceQueues'][_0x2a620b[_0x2cf5('0xbc')]][_0x2cf5('0xc2')]+=0x1;var _0x4336b5=new AgentComplete(_0x31d1d0,_0x2a620b);if(_0x2a620b['reason']===_0x2cf5('0xc3')){_0x4336b5['agiafterat']=this[_0x2cf5('0x21')][_0x2a620b['queue']][_0x2cf5('0xc4')]&&this['voiceQueues'][_0x2a620b[_0x2cf5('0xbc')]][_0x2cf5('0xc5')]?moment()[_0x2cf5('0x7a')](_0x2cf5('0xc6')):undefined;}hopperUtils[_0x2cf5('0xc7')](_0x4336b5)['catch'](loggerCatch(_0x2cf5('0xc8')));hopperUtils[_0x2cf5('0xc9')](_0x4336b5)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x31')]=function(_0x15cdb4){var _0xe0841f=this[_0x2cf5('0x27')][_0x15cdb4['uniqueid']];var _0x15847a=this;var _0x21ef74=![];var _0x10cf4c;var _0x1d8deb;if(this[_0x2cf5('0x21')][_0x15cdb4[_0x2cf5('0xbc')]]){if(_0xe0841f&&_0xe0841f['type']!==_0x2cf5('0xbd')){delete this[_0x2cf5('0x27')][_0x15cdb4['uniqueid']];this['updateOriginated'](this[_0x2cf5('0x21')][_0x15cdb4['queue']]);_0xe0841f[_0x2cf5('0xca')]=moment()[_0x2cf5('0x7a')](_0x2cf5('0xc6'));var _0x5e7f89=new QueueCallerAbandon(_0xe0841f,_0x15cdb4);if(utils[_0x2cf5('0xcb')](_0xe0841f[_0x2cf5('0xca')],_0xe0841f[_0x2cf5('0xcc')])>=_0xe0841f[_0x2cf5('0xcd')]){this['voiceQueues'][_0x15cdb4['queue']][_0x2cf5('0xce')]+=0x1;this['voiceQueues'][_0x15cdb4[_0x2cf5('0xbc')]][_0x2cf5('0xcf')]+=0x1;this[_0x2cf5('0x21')][_0x15cdb4['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x5e7f89[_0x2cf5('0x6c')]=0xa;_0x5e7f89[_0x2cf5('0x6d')]=_0x2cf5('0xd0');_0x5e7f89['dropreason']=_0x2cf5('0xd1');_0x5e7f89[_0x2cf5('0xd2')]=this[_0x2cf5('0x21')][_0x15cdb4[_0x2cf5('0xbc')]][_0x2cf5('0xc4')]?moment()[_0x2cf5('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x5e7f89['countdropretry']+=0x1;_0x5e7f89[_0x2cf5('0xd3')]+=0x1;_0x10cf4c=this[_0x2cf5('0x21')][_0x15cdb4[_0x2cf5('0xbc')]][_0x2cf5('0xd4')];_0x1d8deb=this[_0x2cf5('0x21')][_0x15cdb4[_0x2cf5('0xbc')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x2cf5('0xd5')](_0x5e7f89,_0x5e7f89['state'],_0xe0841f[_0x2cf5('0xd6')])[_0x2cf5('0x9d')](function(_0x141b0e){_0x21ef74=_0x141b0e[_0x2cf5('0xd7')]==0x1;if(_0x5e7f89[_0x2cf5('0xd8')]>=_0x15847a['voiceQueues'][_0x15cdb4['queue']][_0x2cf5('0xd9')]){_0x15847a[_0x2cf5('0xda')](_0x5e7f89,_0x141b0e['additional']);}else{hopperUtils[_0x2cf5('0xdb')]({'active':![],'countdropretry':_0x5e7f89[_0x2cf5('0xd8')],'scheduledat':moment()[_0x2cf5('0xdc')](_0x15847a[_0x2cf5('0x21')][_0x15cdb4[_0x2cf5('0xbc')]][_0x2cf5('0xd4')],_0x2cf5('0xdd'))['format'](_0x2cf5('0xc6')),'ContactId':_0xe0841f[_0x2cf5('0xde')],'ListId':_0xe0841f[_0x2cf5('0xdf')],'VoiceQueueId':_0xe0841f[_0x2cf5('0xe0')]||undefined,'CampaignId':_0xe0841f[_0x2cf5('0xe1')]||undefined})[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0xe2')));var _0x1a17a9=new History(_0x5e7f89);_0x1a17a9[_0x2cf5('0x6c')]=0xa;_0x1a17a9[_0x2cf5('0x6d')]='Drop';_0x1a17a9['starttime']=moment()[_0x2cf5('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a17a9[_0x2cf5('0x6e')]=_0x1a17a9[_0x2cf5('0x6f')];_0x1a17a9[_0x2cf5('0xe3')]=_0x5e7f89[_0x2cf5('0xe3')];_0x1a17a9[_0x2cf5('0xe4')]=_0x5e7f89[_0x2cf5('0xe4')];hopperUtils['createHistory'](_0x1a17a9)['catch'](loggerCatch(_0x2cf5('0xe5')));}})[_0x2cf5('0x9d')](function(){if(_0x21ef74)hopperUtils[_0x2cf5('0xe6')](_0x5e7f89,_0x10cf4c,_0x1d8deb)[_0x2cf5('0x9d')](function(){return 0x1;});});}else{this[_0x2cf5('0x21')][_0x15cdb4[_0x2cf5('0xbc')]][_0x2cf5('0xe7')]+=0x1;this[_0x2cf5('0x21')][_0x15cdb4['queue']][_0x2cf5('0xe8')]+=0x1;_0x5e7f89[_0x2cf5('0x6c')]=0xb;_0x5e7f89['statedesc']=_0x2cf5('0xe9');_0x5e7f89['dropreason']=_0x2cf5('0xea');_0x5e7f89[_0x2cf5('0xeb')]+=0x1;_0x5e7f89[_0x2cf5('0xd3')]+=0x1;_0x10cf4c=this[_0x2cf5('0x21')][_0x15cdb4[_0x2cf5('0xbc')]][_0x2cf5('0xec')];_0x1d8deb=this['voiceQueues'][_0x15cdb4['queue']][_0x2cf5('0xed')];hopperUtils['verifyAdditionalPhones'](_0x5e7f89,_0x5e7f89[_0x2cf5('0x6c')],_0xe0841f[_0x2cf5('0xd6')])[_0x2cf5('0x9d')](function(_0x454632){if(_0x5e7f89[_0x2cf5('0xeb')]>=_0x15847a[_0x2cf5('0x21')][_0x15cdb4[_0x2cf5('0xbc')]]['dialAbandonedMaxRetry']){_0x15847a[_0x2cf5('0xda')](_0x5e7f89,_0x454632[_0x2cf5('0xd7')]);}else{hopperUtils[_0x2cf5('0xdb')]({'active':![],'countabandonedretry':_0x5e7f89[_0x2cf5('0xeb')],'scheduledat':moment()[_0x2cf5('0xdc')](_0x15847a[_0x2cf5('0x21')][_0x15cdb4[_0x2cf5('0xbc')]][_0x2cf5('0xec')],_0x2cf5('0xdd'))[_0x2cf5('0x7a')](_0x2cf5('0xc6')),'ContactId':_0xe0841f['ContactId'],'ListId':_0xe0841f[_0x2cf5('0xdf')],'VoiceQueueId':_0xe0841f[_0x2cf5('0xe0')]||undefined,'CampaignId':_0xe0841f[_0x2cf5('0xe1')]||undefined})['catch'](loggerCatch(_0x2cf5('0xee')));var _0x197aec=new History(_0x5e7f89);_0x197aec[_0x2cf5('0x6c')]=0xb;_0x197aec['statedesc']=_0x2cf5('0xe9');_0x197aec[_0x2cf5('0x6f')]=moment()['format'](_0x2cf5('0xc6'));_0x197aec[_0x2cf5('0x6e')]=_0x197aec[_0x2cf5('0x6f')];_0x197aec[_0x2cf5('0xe3')]=_0x5e7f89[_0x2cf5('0xe3')];_0x197aec['calleridnum']=_0x5e7f89[_0x2cf5('0xe4')];hopperUtils[_0x2cf5('0xc7')](_0x197aec)[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0xef')));}})[_0x2cf5('0x9d')](function(){if(_0x21ef74)hopperUtils[_0x2cf5('0xe6')](_0x5e7f89,_0x10cf4c,_0x1d8deb)[_0x2cf5('0x9d')](function(){return 0x1;});});}}}};Dialer[_0x2cf5('0x1b')]['syncNewExten']=function(_0x25531d){if(this[_0x2cf5('0x26')][_0x25531d[_0x2cf5('0xbf')]]){this[_0x2cf5('0x26')][_0x25531d[_0x2cf5('0xbf')]][_0x2cf5('0xf0')]=_0x25531d['channel'];}if(this[_0x2cf5('0x27')][_0x25531d['uniqueid']]){this['uniqueId'][_0x25531d['uniqueid']]['channel']=_0x25531d['channel'];}};Dialer['prototype']['syncQueueMember']=function(_0xc2a19f){if(!this[_0x2cf5('0x26')][_0xc2a19f[_0x2cf5('0xf1')]]){return;}var _0x2b5695=this[_0x2cf5('0x21')][this[_0x2cf5('0x26')][_0xc2a19f[_0x2cf5('0xf1')]]['queue']][_0x2cf5('0xf2')]||_0x2cf5('0xf3');if(_0x2b5695===_0x2cf5('0xf4')){if(this[_0x2cf5('0x26')][_0xc2a19f[_0x2cf5('0xf1')]]&&_[_0x2cf5('0xf5')](this[_0x2cf5('0x26')][_0xc2a19f['actionid']]['locked'])&&_0xc2a19f[_0x2cf5('0x89')]==='1'&&_0xc2a19f['paused']==='0'){if(this[_0x2cf5('0x23')][_0xc2a19f['stateinterface']]){if(!this[_0x2cf5('0x23')][_0xc2a19f[_0x2cf5('0xf6')]]['locked']){this[_0x2cf5('0x23')][_0xc2a19f[_0x2cf5('0xf6')]][_0x2cf5('0xf7')]=!![];this[_0x2cf5('0x26')][_0xc2a19f['actionid']][_0x2cf5('0xf7')]=!![];this['actions'][_0xc2a19f[_0x2cf5('0xf1')]][_0x2cf5('0xf6')]=_0xc2a19f['stateinterface'];}}}}else if(_0x2b5695==='rrmemory'){if(this[_0x2cf5('0x26')][_0xc2a19f['actionid']]){if(this[_0x2cf5('0x23')][_0xc2a19f[_0x2cf5('0xf6')]]){this[_0x2cf5('0x26')][_0xc2a19f[_0x2cf5('0xf1')]]['stateinterface']=_0xc2a19f[_0x2cf5('0xf6')];if(_['isNil'](this[_0x2cf5('0x2b')][this[_0x2cf5('0x26')][_0xc2a19f['actionid']][_0x2cf5('0xbc')]])){this['queueBooked'][this[_0x2cf5('0x26')][_0xc2a19f[_0x2cf5('0xf1')]][_0x2cf5('0xbc')]]=[];}this[_0x2cf5('0x2b')][this[_0x2cf5('0x26')][_0xc2a19f[_0x2cf5('0xf1')]][_0x2cf5('0xbc')]][_0x2cf5('0x9a')](_['merge'](_['pick'](this['actions'][_0xc2a19f[_0x2cf5('0xf1')]],[_0x2cf5('0xf8'),_0x2cf5('0xf6')]),{'status':_0xc2a19f[_0x2cf5('0x89')],'paused':_0xc2a19f['paused']}));}}}};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x3d')]=function(_0x2e2e05){if(!this[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]]){return;}var _0x58a64a=this;var _0x9259e8=this['voiceQueues'][this[_0x2cf5('0x26')][_0x2e2e05['actionid']][_0x2cf5('0xbc')]];var _0x447c7b=_0x9259e8['strategy']||'rrmemory';if(_0x447c7b===_0x2cf5('0xf4')){if(this['actions'][_0x2e2e05[_0x2cf5('0xf1')]]&&this['actions'][_0x2e2e05[_0x2cf5('0xf1')]][_0x2cf5('0xf6')]){this[_0x2cf5('0x20')][_0x2cf5('0xf9')](this[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]][_0x2cf5('0xf8')],this[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]]['stateinterface'])['catch'](function(_0x5ea43d){logger['error'](_0x2cf5('0xfa'),util[_0x2cf5('0x46')](_0x5ea43d,{'showHidden':![],'depth':null}));})[_0x2cf5('0x1e')](function(){_0x58a64a['updateOriginated'](_0x58a64a[_0x2cf5('0x21')][_0x58a64a[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]]['queue']]);_0x58a64a[_0x2cf5('0x23')][_0x58a64a[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]][_0x2cf5('0xf6')]]['locked']=![];delete _0x58a64a['actions'][_0x2e2e05['actionid']];unlockQueueStatus(_0x9259e8);});}else{this['updateOriginated'](this[_0x2cf5('0x21')][this['actions'][_0x2e2e05['actionid']][_0x2cf5('0xbc')]]);hopperUtils[_0x2cf5('0xdb')]({'active':![],'ContactId':this[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]][_0x2cf5('0xde')],'ListId':this[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]][_0x2cf5('0xdf')],'VoiceQueueId':this[_0x2cf5('0x26')][_0x2e2e05['actionid']][_0x2cf5('0xe0')]||undefined,'CampaignId':this[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]][_0x2cf5('0xe1')]||undefined})['catch'](loggerCatch(_0x2cf5('0xfb')));delete this[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]];unlockQueueStatus(_0x9259e8);}}else if(_0x447c7b===_0x2cf5('0xf3')){var _0x5815e0;if(this[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]]&&!_[_0x2cf5('0x49')](this[_0x2cf5('0x2b')][this[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]]['queue']])){if(this[_0x2cf5('0x2c')][_0x58a64a[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]][_0x2cf5('0xbc')]]){this[_0x2cf5('0x2c')][_0x58a64a[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]]['queue']]=this['queueBookedRR'][this[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]][_0x2cf5('0xbc')]]?this[_0x2cf5('0x2c')][this['actions'][_0x2e2e05[_0x2cf5('0xf1')]][_0x2cf5('0xbc')]]:this[_0x2cf5('0x2b')][this['actions'][_0x2e2e05[_0x2cf5('0xf1')]][_0x2cf5('0xbc')]]?this[_0x2cf5('0x2b')][this['actions'][_0x2e2e05[_0x2cf5('0xf1')]][_0x2cf5('0xbc')]][_0x2cf5('0xfc')]||0x0:0x0;}this[_0x2cf5('0x2b')][this[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]][_0x2cf5('0xbc')]][_0x2cf5('0xfc')]=this[_0x2cf5('0x2c')][this[_0x2cf5('0x26')][_0x2e2e05[_0x2cf5('0xf1')]]['queue']];for(var _0x54d7ee=0x0;_0x54d7ee=_0x566fe5[_0x2cf5('0x120')]){_0x11ad7e[_0x2cf5('0x121')](_0x575ca6,_0x154efb,_0x39f6b8,_0x2cf5('0x122'));}else{if(_0x575ca6[_0x2cf5('0x11b')]>=_0x566fe5[_0x2cf5('0x123')]){_0x11ad7e[_0x2cf5('0x124')](_0x575ca6,_0x154efb,_0x39f6b8,_0x2cf5('0x125'));}else{hopperUtils[_0x2cf5('0xdb')]({'active':![],'countmachineretry':_0x575ca6[_0x2cf5('0x11b')],'scheduledat':moment()[_0x2cf5('0xdc')](_0x566fe5[_0x2cf5('0x126')],_0x2cf5('0xdd'))[_0x2cf5('0x7a')](_0x2cf5('0xc6')),'ContactId':_0x575ca6['ContactId'],'ListId':_0x575ca6['ListId'],'VoiceQueueId':_0x575ca6[_0x2cf5('0xe0')]||undefined,'CampaignId':_0x575ca6['CampaignId']||undefined})[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x127')));_0x154efb({'reschedule':0x1});}}});}if(_0xd1f2cb[_0x2cf5('0x43')]===_0x2cf5('0xbd')&&this[_0x2cf5('0x22')][_0xd1f2cb['queue']][_0x2cf5('0x119')]&&_0x5841b4[_0x2cf5('0x10f')]===_0x2cf5('0x110')){delete this['uniqueId'][_0x5841b4[_0x2cf5('0xbf')]];this['updateOriginated'](this[_0x2cf5('0x22')][_0xd1f2cb[_0x2cf5('0xbc')]]);_0x20b970=new Hangup(_0xd1f2cb,_0x5841b4);_0x20b970[_0x2cf5('0x6c')]=0x12;_0x20b970[_0x2cf5('0x6d')]='HangupInAMD';_0x20b970['membername']=_0x2cf5('0x114');ami[_0x2cf5('0x42')]('custom:amd',ut['buildObj'](_0x20b970,_0x2cf5('0x117')));this[_0x2cf5('0x118')](_0x20b970,_0x2cf5('0x128'),_0x2cf5('0x129'));}if(_0xd1f2cb[_0x2cf5('0x43')]===_0x2cf5('0xbd')&&this[_0x2cf5('0x22')][_0xd1f2cb[_0x2cf5('0xbc')]][_0x2cf5('0x119')]&&_0x5841b4[_0x2cf5('0x10f')]===_0x2cf5('0x11a')){return new Promise(function(_0x156d60,_0xed7faa){delete _0x11ad7e['uniqueId'][_0x5841b4[_0x2cf5('0xbf')]];_0x11ad7e['updateOriginated'](_0x11ad7e[_0x2cf5('0x22')][_0xd1f2cb[_0x2cf5('0xbc')]]);_0x11ad7e['campaigns'][_0xd1f2cb[_0x2cf5('0xbc')]][_0x2cf5('0xc2')]+=0x1;_0x11ad7e[_0x2cf5('0x22')][_0xd1f2cb[_0x2cf5('0xbc')]][_0x2cf5('0x111')]+=0x1;var _0x3ebb6=_0x11ad7e[_0x2cf5('0x22')][_0xd1f2cb[_0x2cf5('0xbc')]];var _0x2c02af=new Hangup(_0xd1f2cb,_0x5841b4);_0x2c02af['state']=0x13;_0x2c02af[_0x2cf5('0x6d')]=_0x2cf5('0x12a');_0x2c02af['membername']=_0x2cf5('0x114');_0x2c02af[_0x2cf5('0x11b')]+=0x1;_0x2c02af[_0x2cf5('0xd3')]+=0x1;_0x2c02af['amd']=!![];ami[_0x2cf5('0x42')]('custom:amd',ut['buildObj'](_0x2c02af,_0x2cf5('0x117')));hopperUtils[_0x2cf5('0xc7')](_0x2c02af)[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x11c')));if(_0x2c02af[_0x2cf5('0x11d')]+_0x2c02af[_0x2cf5('0x12b')]+_0x2c02af[_0x2cf5('0x12c')]+_0x2c02af[_0x2cf5('0x11e')]+_0x2c02af[_0x2cf5('0xd8')]+_0x2c02af[_0x2cf5('0xeb')]+_0x2c02af[_0x2cf5('0x11b')]+_0x2c02af[_0x2cf5('0x11f')]>=_0x3ebb6[_0x2cf5('0x120')]){_0x11ad7e[_0x2cf5('0x121')](_0x2c02af,_0x156d60,_0xed7faa,'reason19\x20machine....');}else{if(_0x2c02af[_0x2cf5('0x11b')]>=_0x3ebb6[_0x2cf5('0x123')]){_0x11ad7e['createStateFinal'](_0x2c02af,_0x156d60,_0xed7faa,_0x2cf5('0x125'));}else{hopperUtils[_0x2cf5('0xdb')]({'active':![],'countmachineretry':_0x2c02af[_0x2cf5('0x11b')],'scheduledat':moment()[_0x2cf5('0xdc')](_0x3ebb6['dialMachineRetryFrequency'],_0x2cf5('0xdd'))[_0x2cf5('0x7a')](_0x2cf5('0xc6')),'ContactId':_0x2c02af['ContactId'],'ListId':_0x2c02af[_0x2cf5('0xdf')],'VoiceQueueId':_0x2c02af[_0x2cf5('0xe0')]||undefined,'CampaignId':_0x2c02af[_0x2cf5('0xe1')]||undefined})[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x127')));_0x156d60({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x2cf5('0x37')]=function(_0x3b399b){var _0x157189=this[_0x2cf5('0x27')][_0x3b399b[_0x2cf5('0xbf')]];var _0x304a74;if(_0x157189&&_0x157189[_0x2cf5('0x43')]===_0x2cf5('0xbd')){delete this['uniqueId'][_0x3b399b[_0x2cf5('0xbf')]];this[_0x2cf5('0xbe')](this[_0x2cf5('0x22')][_0x157189[_0x2cf5('0xbc')]]);this[_0x2cf5('0x22')][_0x157189[_0x2cf5('0xbc')]][_0x2cf5('0x12d')]+=0x1;_0x304a74=new Hangup(_0x157189,_0x3b399b);hopperUtils[_0x2cf5('0xc7')](_0x304a74)['catch'](loggerCatch(_0x2cf5('0x12e')));hopperUtils[_0x2cf5('0xc9')](_0x304a74)[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x12f')));}if(_0x157189&&_0x157189['type']!==_0x2cf5('0xbd')&&isNotNull(this[_0x2cf5('0x21')][_0x157189[_0x2cf5('0xbc')]][_0x2cf5('0x130')])){delete this[_0x2cf5('0x27')][_0x3b399b[_0x2cf5('0xbf')]];this[_0x2cf5('0xbe')](this[_0x2cf5('0x21')][_0x157189['queue']]);this['voiceQueues'][_0x157189['queue']][_0x2cf5('0xc2')]+=0x1;this['voiceQueues'][_0x157189[_0x2cf5('0xbc')]]['outboundAnswerAgiCallsDay']+=0x1;_0x304a74=new Hangup(_0x157189,_0x3b399b);_0x304a74[_0x2cf5('0x6c')]=0x10;_0x304a74['statedesc']=_0x2cf5('0x131');_0x304a74[_0x2cf5('0x113')]=_0x2cf5('0x132');hopperUtils[_0x2cf5('0xc7')](_0x304a74)[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x12e')));hopperUtils[_0x2cf5('0xc9')](_0x304a74)[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x12f')));}if(_0x157189&&_0x157189['type']!==_0x2cf5('0xbd')&&!isNotNull(this[_0x2cf5('0x21')][_0x157189[_0x2cf5('0xbc')]][_0x2cf5('0x130')])){delete this[_0x2cf5('0x27')][_0x3b399b[_0x2cf5('0xbf')]];this[_0x2cf5('0xbe')](this[_0x2cf5('0x21')][_0x157189[_0x2cf5('0xbc')]]);this['voiceQueues'][_0x157189[_0x2cf5('0xbc')]][_0x2cf5('0x133')]+=0x1;_0x304a74=new Hangup(_0x157189,_0x3b399b);_0x304a74[_0x2cf5('0x6c')]=0xc;_0x304a74[_0x2cf5('0x6d')]=_0x3b399b[_0x2cf5('0x134')];_0x304a74['membername']=_0x2cf5('0x135');hopperUtils[_0x2cf5('0xc7')](_0x304a74)[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x12e')));hopperUtils[_0x2cf5('0xc9')](_0x304a74)[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x12f')));}};Dialer['prototype'][_0x2cf5('0xc')]=function(_0x431b0f){var _0x149c5a=this;if(!_0x149c5a['queuesSummary'][_0x431b0f[_0x2cf5('0x48')]]){_0x149c5a[_0x2cf5('0x2d')][_0x431b0f['name']]={'running':![]};}else if(_0x149c5a[_0x2cf5('0x2d')][_0x431b0f[_0x2cf5('0x48')]]['running']===!![]){return;}else if(_0x149c5a[_0x2cf5('0x2d')][_0x431b0f['name']][_0x2cf5('0x136')]===![]){_0x149c5a['queuesSummary'][_0x431b0f[_0x2cf5('0x48')]][_0x2cf5('0x136')]=!![];}var _0x555b29=_0x149c5a[_0x2cf5('0x21')][_0x431b0f[_0x2cf5('0x48')]];var _0x5a6f0d=_0x555b29['message']!==utils[_0x2cf5('0x68')][_0x2cf5('0x78')];var _0x50e548=utils[_0x2cf5('0x137')](_0x555b29);_0x555b29['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x555b29,_0x149c5a['trunks']);Promise['resolve']()[_0x2cf5('0x9d')](function(){if(_0x555b29[_0x2cf5('0x138')]===utils[_0x2cf5('0x68')]['INACTIVE']){if(_0x5a6f0d){clearPredictiveAttributes(_0x555b29);_0x431b0f['startPredictive']=undefined;_0x431b0f[_0x2cf5('0x29')]=undefined;}if(_0x555b29[_0x2cf5('0x138')]===utils[_0x2cf5('0x68')][_0x2cf5('0x78')]){_0x431b0f[_0x2cf5('0x139')]=0x0;_0x431b0f[_0x2cf5('0xfd')]=0x0;_0x431b0f[_0x2cf5('0x13a')]=0x0;_0x431b0f[_0x2cf5('0x13b')]=0x0;_0x431b0f['pTalking']=0x0;}}else if(_0x555b29['statusMessage']===utils['CAMPAIGN_STATUS']['ACTIVE']&&!_0x50e548){return _0x149c5a[_0x2cf5('0x91')](_0x555b29,!![])[_0x2cf5('0x9d')](function(){return _0x149c5a[_0x2cf5('0x91')](_0x555b29,![]);})['then'](function(){return _0x149c5a['checkDialMethod'](_0x555b29);})[_0x2cf5('0xa3')](function(_0x531c69){loggerSyncQueueSummary['debug'](_0x2cf5('0x13c'),util[_0x2cf5('0x46')](_0x531c69,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x555b29);});}else{clearPredictiveAttributes(_0x555b29);}})[_0x2cf5('0x9d')](function(){var _0x5c458a=_0x431b0f['compareToOutboundQueue'](_0x555b29);if(_0x5c458a||_0x555b29[_0x2cf5('0x13d')]){_0x555b29['queueSummaryCountersUpdated']=![];_0x431b0f[_0x2cf5('0x13e')](_0x555b29);Object[_0x2cf5('0x13f')](_0x555b29,_0x431b0f);emitOutboundVoiceQueueSummary(_0x431b0f);}_0x149c5a[_0x2cf5('0x2d')][_0x555b29[_0x2cf5('0x48')]][_0x2cf5('0x136')]=![];})[_0x2cf5('0xa3')](function(_0x3f58b1){logger[_0x2cf5('0x65')](_0x2cf5('0x13c'),util['inspect'](_0x3f58b1,{'showHidden':![],'depth':null}));_0x149c5a[_0x2cf5('0x2d')][_0x555b29[_0x2cf5('0x48')]]['running']=![];});};Dialer[_0x2cf5('0x1b')]['syncQueueSummaryComplete']=_['throttle'](function(){var _0x44972f=_[_0x2cf5('0x140')](this['voiceQueues'],function(_0x35fa59){return _0x35fa59['dialPreviewRecallmeReminder'];});var _0x4be814=_[_0x2cf5('0x140')](this[_0x2cf5('0x23')],function(_0x199d5e){return _0x199d5e[_0x2cf5('0x141')]&&_0x199d5e[_0x2cf5('0x89')]===_0x2cf5('0x88');});if(_0x44972f[_0x2cf5('0x99')]>0x0&&_0x4be814[_0x2cf5('0x99')]>0x0){return Promise[_0x2cf5('0x142')]()[_0x2cf5('0x9d')](cmHopper[_0x2cf5('0x143')](_[_0x2cf5('0x144')](_0x44972f,'id'),previewRecallmeReminderInterval,_[_0x2cf5('0x144')](_0x4be814,'id')))[_0x2cf5('0x9d')](function(_0xbb25f3){for(var _0x3f34a8=0x0;_0x3f34a8<_0xbb25f3[_0x2cf5('0x99')];_0x3f34a8++){var _0x50610f=_0xbb25f3[_0x3f34a8][_0x2cf5('0x145')]['name'];if(_0x50610f)io['to'](util['format'](_0x2cf5('0x146'),_0x50610f))[_0x2cf5('0x42')](_0x2cf5('0x147'),{'hopper':_0xbb25f3[_0x3f34a8]});}})[_0x2cf5('0xa3')](function(_0x3c14e4){logger[_0x2cf5('0x65')](_0x2cf5('0x148'),_0x3c14e4);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x2cf5('0x1b')][_0x2cf5('0x3f')]=function(){var _0x1825f1=this;setInterval(function(){_0x1825f1[_0x2cf5('0x149')](_0x1825f1[_0x2cf5('0x27')],_0x2cf5('0x14a'));_0x1825f1['clearZombieChannels'](_0x1825f1['actions'],_0x2cf5('0x14b'));},0x32c8);};Dialer[_0x2cf5('0x1b')]['clearZombieChannels']=function(_0x3b5697,_0x57821e){var _0x2be6e7=this;for(var _0x5625b9 in _0x3b5697){if(typeof _0x3b5697[_0x5625b9]!==_0x2cf5('0x14c')){this[_0x2cf5('0x1f')][_0x2cf5('0x1c')](function(){if(!_['isNil'](_0x3b5697[_0x5625b9])){return ami[_0x2cf5('0xa1')]({'action':_0x2cf5('0x89'),'channel':_0x3b5697[_0x5625b9]['channel']})['catch'](function(_0x28fd77){if(_0x28fd77['message']===_0x2cf5('0x14d')){setTimeout(function(){if(_0x3b5697[_0x5625b9]&&_0x3b5697[_0x5625b9][_0x2cf5('0x43')]!==_0x2cf5('0xbd')){_0x2be6e7[_0x2cf5('0xbe')](_0x2be6e7[_0x2cf5('0x21')][_0x3b5697[_0x5625b9][_0x2cf5('0xbc')]]);logger[_0x2cf5('0x65')](_0x2cf5('0x14e'),_0x57821e,_0x5625b9,_0x3b5697[_0x5625b9]['queue']);delete _0x3b5697[_0x5625b9];}if(_0x3b5697[_0x5625b9]&&_0x3b5697[_0x5625b9]['type']==='ivr'){_0x2be6e7['updateOriginated'](_0x2be6e7[_0x2cf5('0x22')][_0x3b5697[_0x5625b9][_0x2cf5('0xbc')]]);logger['error'](_0x2cf5('0x14f'),_0x57821e,_0x5625b9,_0x3b5697[_0x5625b9][_0x2cf5('0xbc')]);delete _0x3b5697[_0x5625b9];}},0x2328);}});}});}}};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x150')]=function(_0x30e0e0){return Promise[_0x2cf5('0x142')]()[_0x2cf5('0x9d')](voiceQueueRt['getVoiceQueueRtPauses'](_0x30e0e0))['catch'](loggerCatch(_0x2cf5('0x151')));};Dialer[_0x2cf5('0x1b')]['updateOriginated']=function(_0x59337f){if(!_[_0x2cf5('0x61')](_0x59337f)&&_0x59337f!==null){if(typeof _0x59337f[_0x2cf5('0x7e')]!==_0x2cf5('0x14c')){if(_0x59337f[_0x2cf5('0x7e')]>0x0){_0x59337f[_0x2cf5('0x7e')]-=0x1;}else{logger[_0x2cf5('0x65')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x2cf5('0x65')](_0x2cf5('0x152'));}};Dialer['prototype'][_0x2cf5('0x153')]=function(_0xb6ab55,_0x49980b){var _0x45f52e=this;return function(_0x3c83f7){_0x45f52e['updateOriginated'](_0x49980b);logger[_0x2cf5('0x65')](_0xb6ab55,util[_0x2cf5('0x46')](_0x3c83f7,{'showHidden':![],'depth':null}));};};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x154')]=function(_0x52132c,_0x3d763a,_0x5f5020){var _0x42cb9c={'state':0x19,'statedesc':_0x2cf5('0x155')};this[_0x2cf5('0xbe')](_0x3d763a);this[_0x2cf5('0x118')](_['merge'](_0x42cb9c,_[_0x2cf5('0x72')](_0x5f5020,[_0x2cf5('0xde'),_0x2cf5('0xdf'),_0x2cf5('0x156'),_0x2cf5('0xe0'),_0x2cf5('0xe1')])),'[emptyContact][createHistory]',_0x2cf5('0x157'));logger['error'](_0x52132c);};Dialer[_0x2cf5('0x1b')]['saveInDb']=function(_0x559b6c,_0x217a5a,_0x2d819e){hopperUtils[_0x2cf5('0xc7')](_0x559b6c)['catch'](loggerCatch(_0x217a5a));hopperUtils[_0x2cf5('0xc9')](_0x559b6c)[_0x2cf5('0xa3')](loggerCatch(_0x2d819e));};Dialer[_0x2cf5('0x1b')][_0x2cf5('0xda')]=function(_0x1cc3d0,_0x531e99){hopperUtils[_0x2cf5('0xc7')](_0x1cc3d0)[_0x2cf5('0xa3')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x531e99==0x0){hopperUtils['moveContactManagedDialer'](_0x1cc3d0)[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x158')));}};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x148')]=function(_0x1dab1e){return Promise[_0x2cf5('0x142')]()['then'](cmHopper['handlePreviewRecallNotifications'](_0x1dab1e['id'],previewRecallmeReminderInterval))[_0x2cf5('0x9d')](function(_0x4f6067){for(var _0x5a3fdd=0x0;_0x5a3fdd<_0x4f6067[_0x2cf5('0x99')];_0x5a3fdd++){var _0x164236=_0x4f6067[_0x5a3fdd][_0x2cf5('0x145')]['name'];if(_0x164236)io['to'](util[_0x2cf5('0x7a')](_0x2cf5('0x146'),_0x164236))[_0x2cf5('0x42')](_0x2cf5('0x147'),{'hopper':_0x4f6067[_0x5a3fdd]});}})[_0x2cf5('0xa3')](function(){});};Dialer[_0x2cf5('0x1b')][_0x2cf5('0xad')]=function(_0x41828b){var _0x4dbe78=this;return function(){_0x4dbe78[_0x2cf5('0x159')](_0x41828b);};};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x15a')]=function(_0x13db94,_0x8d97f7){var _0x2584f0=this;var _0x24b4ee=uuid['v4']();this[_0x2cf5('0x26')][_0x24b4ee]=new Action(_0x13db94,_0x8d97f7,_0x24b4ee);return new Promise(function(_0x3bbc03,_0x3f7f4a){if(_[_0x2cf5('0x61')](_0x13db94)&&typeof _0x13db94!==_0x2cf5('0x15b')){return _0x3f7f4a(msgResponse(_0x2cf5('0x15c'),_0x2cf5('0x92'),_0x2cf5('0x15d')));}if(_[_0x2cf5('0x61')](_0x8d97f7[_0x2cf5('0x15e')])||_0x8d97f7[_0x2cf5('0x15e')]===null){return _0x3f7f4a(msgResponse('originate','Failure','contact\x20is\x20undefine'));}var _0x5badd8={'XMD-CALLERID':_0x2584f0['actions'][_0x24b4ee][_0x2cf5('0x15f')](),'XMD-AGI':_0x13db94[_0x2cf5('0x130')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x13db94[_0x2cf5('0x130')]):_0x2cf5('0x160'),'XMD-AGIAFTER':_0x13db94['dialQueueProject2']?util['format'](_0x2cf5('0x161'),ipAgi,_0x13db94[_0x2cf5('0xc4')]):_0x2cf5('0x160'),'XMD-QUEUE':utils['isOutboundQueue'](_0x13db94)?util[_0x2cf5('0x7a')](_0x2cf5('0x162'),_0x13db94[_0x2cf5('0x48')],_0x13db94[_0x2cf5('0x163')]||'',_0x13db94[_0x2cf5('0xc5')]?'c':'',_0x13db94[_0x2cf5('0xcd')]||0x3):_0x2cf5('0x160'),'XMD-CONTACTID':_0x8d97f7[_0x2cf5('0xde')],'XMD-CDRTYPE':_0x2cf5('0x7'),'CALLERID(all)':_0x2584f0[_0x2cf5('0x26')][_0x24b4ee][_0x2cf5('0x15f')](),'XMD-AMD':_0x13db94[_0x2cf5('0x119')]?_0x2cf5('0x164'):_0x2cf5('0x160'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x13db94[_0x2cf5('0x119')]){_0x5badd8[_0x2cf5('0x165')]=_0x13db94[_0x2cf5('0x166')]||0x9c4;_0x5badd8[_0x2cf5('0x167')]=_0x13db94[_0x2cf5('0x168')]||0x5dc;_0x5badd8[_0x2cf5('0x169')]=_0x13db94[_0x2cf5('0x16a')]||0x320;_0x5badd8[_0x2cf5('0x16b')]=_0x13db94[_0x2cf5('0x16c')]||0x1388;_0x5badd8[_0x2cf5('0x16d')]=_0x13db94[_0x2cf5('0x16e')]||0x64;_0x5badd8[_0x2cf5('0x16f')]=_0x13db94['dialAMDBetweenWordsSilence']||0x32;_0x5badd8[_0x2cf5('0x170')]=_0x13db94[_0x2cf5('0x171')]||0x3;_0x5badd8[_0x2cf5('0x172')]=_0x13db94[_0x2cf5('0x173')]||0x100;_0x5badd8['XMD-AMDMAXIMUMWORDLENGTH']=_0x13db94[_0x2cf5('0x174')]||0x1388;}if(utils[_0x2cf5('0x175')](_0x13db94)){_0x5badd8['XMD-VOICEQUEUEID']=_0x8d97f7[_0x2cf5('0xe0')];}else{_0x5badd8[_0x2cf5('0x176')]=_0x8d97f7[_0x2cf5('0xe1')];}var _0x15ce41=utils[_0x2cf5('0x177')](_0x8d97f7[_0x2cf5('0x178')]);Object[_0x2cf5('0x13f')](_0x5badd8,_0x15ce41);var _0x57e996=_0x2584f0[_0x2cf5('0x84')](_0x13db94['Trunk'])?utils[_0x2cf5('0x179')](_0x13db94[_0x2cf5('0x17a')][_0x2cf5('0x17b')],_0x13db94[_0x2cf5('0x17c')],_0x13db94['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x2cf5('0x17d')](_0x13db94[_0x2cf5('0x17e')],_0x13db94[_0x2cf5('0x17f')]):_0x13db94[_0x2cf5('0x17e')]):utils[_0x2cf5('0x179')](_[_0x2cf5('0xf5')](_0x13db94['TrunkBackup'])?_0x13db94[_0x2cf5('0x17a')][_0x2cf5('0x17b')]:_0x13db94[_0x2cf5('0x8c')][_0x2cf5('0x17b')],_0x13db94[_0x2cf5('0x17c')],_0x13db94[_0x2cf5('0x17f')]>0x0?utils[_0x2cf5('0x17d')](_0x13db94[_0x2cf5('0x17e')],_0x13db94[_0x2cf5('0x17f')]):_0x13db94[_0x2cf5('0x17e')]);if(_0x57e996){_0x5badd8[_0x2cf5('0x180')]=_0x2584f0[_0x2cf5('0x26')][_0x24b4ee][_0x2cf5('0x181')]=utils['extractCalleridName'](_0x57e996);_0x5badd8[_0x2cf5('0x182')]=_0x8d97f7['phone'];}_0x13db94[_0x2cf5('0x183')]=_0x5badd8;return ami['Action']({'actionid':_0x24b4ee,'action':_0x2cf5('0x15c'),'channel':_0x2584f0['isTrunkReachable'](_0x13db94[_0x2cf5('0x17a')])?util['format'](_0x2cf5('0x184'),_0x13db94[_0x2cf5('0x17a')]['name'],isNotNull(_0x13db94[_0x2cf5('0x185')])?_0x13db94[_0x2cf5('0x185')][_0x2cf5('0x186')]()||'':'',_0x13db94['dialCutDigit']>0x0?_0x8d97f7[_0x2cf5('0x15e')][_0x2cf5('0x187')](_0x13db94[_0x2cf5('0x188')]):_0x8d97f7[_0x2cf5('0x15e')]):util[_0x2cf5('0x7a')]('SIP/%s/%s%s',_[_0x2cf5('0xf5')](_0x13db94[_0x2cf5('0x8c')])?_0x13db94[_0x2cf5('0x17a')][_0x2cf5('0x48')]:_0x13db94[_0x2cf5('0x8c')][_0x2cf5('0x48')],isNotNull(_0x13db94[_0x2cf5('0x185')])?_0x13db94[_0x2cf5('0x185')][_0x2cf5('0x186')]()||'':'',_0x13db94[_0x2cf5('0x188')]>0x0?_0x8d97f7[_0x2cf5('0x15e')][_0x2cf5('0x187')](_0x13db94[_0x2cf5('0x188')]):_0x8d97f7[_0x2cf5('0x15e')]),'callerid':_0x57e996,'Exten':'xcally-motion-dialer','Context':_0x2cf5('0x189'),'Priority':'1','variable':_0x5badd8,'timeout':(_0x13db94[_0x2cf5('0x18a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x24b4ee})['then'](function(_0x53bdab){return _0x3bbc03(_0x53bdab);})[_0x2cf5('0xa3')](function(_0xf270ee){_0x13db94[_0x2cf5('0x18b')]+=0x1;var _0x454b36=new History(_0x2584f0[_0x2cf5('0x26')][_0x24b4ee]);logger[_0x2cf5('0x65')](util[_0x2cf5('0x7a')](_0x2cf5('0x18c'),JSON[_0x2cf5('0x71')](_0xf270ee)));_0x454b36[_0x2cf5('0x6c')]=0xe;_0x454b36['statedesc']=_0x2cf5('0x18d');_0x454b36['starttime']=moment()[_0x2cf5('0x7a')](_0x2cf5('0xc6'));_0x454b36[_0x2cf5('0x6e')]=_0x454b36[_0x2cf5('0x6f')];hopperUtils[_0x2cf5('0xc7')](_0x454b36)[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x18e')));_0x2584f0[_0x2cf5('0xc9')](_0x454b36)[_0x2cf5('0xa3')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x2584f0[_0x2cf5('0x26')][_0x24b4ee];return _0x3f7f4a(msgResponse(_0x2cf5('0x15c'),_0x2cf5('0x83'),_0x2cf5('0x18f')));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x1cb694,_0x3b6553,_0xd62299){var _0x5c1a7f=new History(_0x3b6553);if(_0x5c1a7f[_0x2cf5('0x11d')]+_0x5c1a7f[_0x2cf5('0x12b')]+_0x5c1a7f[_0x2cf5('0x12c')]+_0x5c1a7f[_0x2cf5('0x11e')]+_0x5c1a7f[_0x2cf5('0xd8')]+_0x5c1a7f[_0x2cf5('0xeb')]+_0x5c1a7f[_0x2cf5('0x11b')]+_0x5c1a7f[_0x2cf5('0x11f')]>=_0xd62299[_0x2cf5('0x120')]-0x1){return!![];}switch(_0x1cb694){case 0x3:if(_0x5c1a7f[_0x2cf5('0x12c')]>=_0xd62299['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x2cf5('0xdb')]({'active':![],'countnoanswerretry':_0x5c1a7f[_0x2cf5('0x12c')]+=0x1,'scheduledat':moment()['add'](_0xd62299[_0x2cf5('0x190')],_0x2cf5('0xdd'))['format'](_0x2cf5('0xc6')),'ContactId':_0x5c1a7f[_0x2cf5('0xde')],'ListId':_0x5c1a7f[_0x2cf5('0xdf')],'VoiceQueueId':_0x5c1a7f[_0x2cf5('0xe0')]||undefined,'CampaignId':_0x5c1a7f['CampaignId']||undefined})[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x191')));break;case 0x5:if(_0x5c1a7f[_0x2cf5('0x11d')]>=_0xd62299['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x2cf5('0xdb')]({'active':![],'countbusyretry':_0x5c1a7f['countbusyretry']+=0x1,'scheduledat':moment()[_0x2cf5('0xdc')](_0xd62299[_0x2cf5('0x192')],_0x2cf5('0xdd'))[_0x2cf5('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5c1a7f[_0x2cf5('0xde')],'ListId':_0x5c1a7f[_0x2cf5('0xdf')],'VoiceQueueId':_0x5c1a7f[_0x2cf5('0xe0')]||undefined,'CampaignId':_0x5c1a7f[_0x2cf5('0xe1')]||undefined})[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x193')));break;case 0x8:if(_0x5c1a7f[_0x2cf5('0x12b')]>=_0xd62299['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x2cf5('0xdb')]({'active':![],'countcongestionretry':_0x5c1a7f[_0x2cf5('0x12b')]+=0x1,'scheduledat':moment()[_0x2cf5('0xdc')](_0xd62299[_0x2cf5('0x194')],_0x2cf5('0xdd'))[_0x2cf5('0x7a')](_0x2cf5('0xc6')),'ContactId':_0x5c1a7f['ContactId'],'ListId':_0x5c1a7f['ListId'],'VoiceQueueId':_0x5c1a7f[_0x2cf5('0xe0')]||undefined,'CampaignId':_0x5c1a7f[_0x2cf5('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x5c1a7f['countnosuchnumberretry']>=_0xd62299[_0x2cf5('0x195')]-0x1){return!![];}else{hopperUtils[_0x2cf5('0xdb')]({'active':![],'countnosuchnumberretry':_0x5c1a7f[_0x2cf5('0x11e')]+=0x1,'scheduledat':moment()[_0x2cf5('0xdc')](_0xd62299['dialNoSuchNumberRetryFrequency'],_0x2cf5('0xdd'))[_0x2cf5('0x7a')](_0x2cf5('0xc6')),'ContactId':_0x5c1a7f[_0x2cf5('0xde')],'ListId':_0x5c1a7f[_0x2cf5('0xdf')],'VoiceQueueId':_0x5c1a7f[_0x2cf5('0xe0')]||undefined,'CampaignId':_0x5c1a7f[_0x2cf5('0xe1')]||undefined})[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x196')));}break;case 0xa:if(_0x5c1a7f[_0x2cf5('0xd8')]>=_0xd62299[_0x2cf5('0xd9')]-0x1){return!![];}hopperUtils[_0x2cf5('0xdb')]({'active':![],'countdropretry':_0x5c1a7f['countdropretry']+=0x1,'scheduledat':moment()['add'](_0xd62299[_0x2cf5('0xd4')],'minutes')[_0x2cf5('0x7a')](_0x2cf5('0xc6')),'ContactId':_0x5c1a7f['ContactId'],'ListId':_0x5c1a7f[_0x2cf5('0xdf')],'VoiceQueueId':_0x5c1a7f[_0x2cf5('0xe0')]||undefined,'CampaignId':_0x5c1a7f[_0x2cf5('0xe1')]||undefined})[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0xe2')));break;case 0xb:if(_0x5c1a7f[_0x2cf5('0xeb')]>=_0xd62299[_0x2cf5('0x197')]-0x1){return!![];}hopperUtils[_0x2cf5('0xdb')]({'active':![],'countabandonedretry':_0x5c1a7f[_0x2cf5('0xeb')]+=0x1,'scheduledat':moment()['add'](_0xd62299[_0x2cf5('0xec')],_0x2cf5('0xdd'))[_0x2cf5('0x7a')](_0x2cf5('0xc6')),'ContactId':_0x5c1a7f[_0x2cf5('0xde')],'ListId':_0x5c1a7f['ListId'],'VoiceQueueId':_0x5c1a7f[_0x2cf5('0xe0')]||undefined,'CampaignId':_0x5c1a7f[_0x2cf5('0xe1')]||undefined})[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0xee')));break;case 0x13:if(_0x5c1a7f[_0x2cf5('0x11b')]>=_0xd62299['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x2cf5('0xdb')]({'active':![],'countmachineretry':_0x5c1a7f[_0x2cf5('0x11b')]+=0x1,'scheduledat':moment()[_0x2cf5('0xdc')](_0xd62299['dialMachineRetryFrequency'],_0x2cf5('0xdd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5c1a7f['ContactId'],'ListId':_0x5c1a7f[_0x2cf5('0xdf')],'VoiceQueueId':_0x5c1a7f[_0x2cf5('0xe0')]||undefined,'CampaignId':_0x5c1a7f['CampaignId']||undefined})[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x127')));break;case 0x14:if(_0x5c1a7f[_0x2cf5('0x11f')]>=_0xd62299['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x2cf5('0xdb')]({'active':![],'countagentrejectretry':_0x5c1a7f[_0x2cf5('0x11f')]+=0x1,'scheduledat':moment()[_0x2cf5('0xdc')](_0xd62299[_0x2cf5('0x198')],_0x2cf5('0xdd'))[_0x2cf5('0x7a')](_0x2cf5('0xc6')),'ContactId':_0x5c1a7f[_0x2cf5('0xde')],'ListId':_0x5c1a7f[_0x2cf5('0xdf')],'VoiceQueueId':_0x5c1a7f[_0x2cf5('0xe0')]||undefined,'CampaignId':_0x5c1a7f['CampaignId']||undefined})[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x199')));break;default:return!![];}};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x10a')]=function(_0x3db085,_0x55b4b5,_0x4f8ec0){var _0x2e2e18=this;var _0x28462c=new History(_0x3db085);var _0x456817=![];var _0x287756;var _0x12d259;return new Promise(function(_0x426930,_0x44646c){if(_['isUndefined'](_0x55b4b5)&&typeof _0x55b4b5!==_0x2cf5('0x15b')){return _0x44646c(msgResponse(_0x2cf5('0x19a'),_0x2cf5('0x92'),_0x2cf5('0x19b')));}if(_[_0x2cf5('0x61')](_0x4f8ec0)&&typeof _0x4f8ec0!==_0x2cf5('0x15b')){return _0x44646c(msgResponse('[callProgressDetecting]',_0x2cf5('0x92'),_0x2cf5('0x19c')));}hopperUtils[_0x2cf5('0xd5')](_0x28462c,_0x4f8ec0[_0x2cf5('0x19d')],_0x55b4b5)[_0x2cf5('0x9d')](function(_0x2f119f){if(_0x2f119f[_0x2cf5('0xd7')]==0x1)_0x456817=!![];switch(_0x4f8ec0[_0x2cf5('0x19d')]){case'0':_0x55b4b5['outboundNoSuchCallsDay']+=0x1;_0x28462c[_0x2cf5('0x6c')]=0x0;_0x28462c[_0x2cf5('0x6d')]=_0x2cf5('0x19e');_0x28462c[_0x2cf5('0x11e')]+=0x1;_0x28462c[_0x2cf5('0xd3')]+=0x1;ami[_0x2cf5('0x42')]('custom:agentnosuchnumber',ut[_0x2cf5('0x116')](_0x3db085,_0x2cf5('0x19f')));_0x287756=_0x55b4b5[_0x2cf5('0x1a0')];_0x12d259=_0x55b4b5['callAdditionalPhoneAfterMin'];hopperUtils[_0x2cf5('0xc7')](_0x28462c)[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x11c')));if(_0x2e2e18['checkRetriveMax'](0x0,_0x3db085,_0x55b4b5)&&!_0x456817){if(_0x28462c['countnosuchnumberretry']>=_0x55b4b5[_0x2cf5('0x195')]){_0x2e2e18[_0x2cf5('0x124')](_0x28462c,_0x426930,_0x44646c,_0x2cf5('0x1a1'));}else{_0x2e2e18[_0x2cf5('0x121')](_0x28462c,_0x426930,_0x44646c,_0x2cf5('0x1a1'));}}break;case'3':_0x55b4b5['outboundNoAnswerCallsDay']+=0x1;_0x28462c[_0x2cf5('0x6c')]=0x3;_0x28462c[_0x2cf5('0x6d')]='NoAnswer';_0x28462c[_0x2cf5('0x12c')]+=0x1;_0x28462c['countglobal']+=0x1;var _0x19ed36=ut[_0x2cf5('0x1a2')](_0x3db085,_0x55b4b5);ami[_0x2cf5('0x42')]('custom:agentnoanswer',_0x19ed36);_0x287756=_0x55b4b5[_0x2cf5('0x190')];_0x12d259=_0x55b4b5['callAdditionalPhoneAfterMin'];hopperUtils[_0x2cf5('0xc7')](_0x28462c)[_0x2cf5('0xa3')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2e2e18[_0x2cf5('0x1a3')](0x3,_0x3db085,_0x55b4b5)&&!_0x456817){if(_0x28462c[_0x2cf5('0x12c')]>=_0x55b4b5[_0x2cf5('0x1a4')]){_0x2e2e18[_0x2cf5('0x124')](_0x28462c,_0x426930,_0x44646c,_0x2cf5('0x1a5'));}else{_0x2e2e18[_0x2cf5('0x121')](_0x28462c,_0x426930,_0x44646c,_0x2cf5('0x1a5'));}}break;case'5':_0x55b4b5[_0x2cf5('0x1a6')]+=0x1;_0x28462c[_0x2cf5('0x6c')]=0x5;_0x28462c['statedesc']='Busy';_0x28462c[_0x2cf5('0x11d')]+=0x1;_0x28462c['countglobal']+=0x1;ami[_0x2cf5('0x42')](_0x2cf5('0x1a7'),ut[_0x2cf5('0x116')](_0x3db085,_0x2cf5('0x1a8')));_0x287756=_0x55b4b5[_0x2cf5('0x192')];_0x12d259=_0x55b4b5['callAdditionalPhoneAfterMin'];hopperUtils[_0x2cf5('0xc7')](_0x28462c)[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x1a9')));if(_0x2e2e18['checkRetriveMax'](0x5,_0x3db085,_0x55b4b5)&&!_0x456817){if(_0x28462c[_0x2cf5('0x11d')]>=_0x55b4b5[_0x2cf5('0x1aa')]){_0x2e2e18[_0x2cf5('0x124')](_0x28462c,_0x426930,_0x44646c,_0x2cf5('0x1ab'));}else{_0x2e2e18[_0x2cf5('0x121')](_0x28462c,_0x426930,_0x44646c,_0x2cf5('0x1ab'));}}break;case'8':_0x55b4b5[_0x2cf5('0x1ac')]+=0x1;_0x28462c[_0x2cf5('0x6c')]=0x8;_0x28462c[_0x2cf5('0x6d')]=_0x2cf5('0x1ad');_0x28462c[_0x2cf5('0x12b')]+=0x1;_0x28462c[_0x2cf5('0xd3')]+=0x1;_0x287756=_0x55b4b5['dialCongestionRetryFrequency'];_0x12d259=_0x55b4b5[_0x2cf5('0xed')];ami['emit'](_0x2cf5('0x1ae'),ut[_0x2cf5('0x116')](_0x3db085,_0x2cf5('0x1af')));hopperUtils[_0x2cf5('0xc7')](_0x28462c)[_0x2cf5('0xa3')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x2e2e18[_0x2cf5('0x1a3')](0x8,_0x3db085,_0x55b4b5)&&!_0x456817){if(_0x28462c['countcongestionretry']>=_0x55b4b5[_0x2cf5('0x1b0')]){_0x2e2e18[_0x2cf5('0x124')](_0x28462c,_0x426930,_0x44646c,'reason\x208\x20congestion');}else{_0x2e2e18['stateGlobal'](_0x28462c,_0x426930,_0x44646c,_0x2cf5('0x1b1'));}}break;case'11':_0x55b4b5['outboundAbandonedCallsDay']+=0x1;_0x28462c[_0x2cf5('0x6c')]=0xb;_0x28462c[_0x2cf5('0x6d')]=_0x2cf5('0xe9');_0x28462c[_0x2cf5('0xeb')]+=0x1;_0x28462c[_0x2cf5('0xd3')]+=0x1;_0x287756=_0x55b4b5[_0x2cf5('0xec')];_0x12d259=_0x55b4b5[_0x2cf5('0xed')];hopperUtils[_0x2cf5('0xc7')](_0x28462c)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x2e2e18[_0x2cf5('0x1a3')](0xb,_0x3db085,_0x55b4b5)&&!_0x456817){if(_0x28462c[_0x2cf5('0xeb')]>=_0x55b4b5[_0x2cf5('0x197')]){_0x2e2e18[_0x2cf5('0x124')](_0x28462c,_0x426930,_0x44646c,_0x2cf5('0x1b2'));}else{_0x2e2e18['stateGlobal'](_0x28462c,_0x426930,_0x44646c,_0x2cf5('0x1b2'));}}break;case'20':_0x55b4b5[_0x2cf5('0x1b3')]+=0x1;_0x28462c[_0x2cf5('0x6c')]=0x14;_0x28462c['statedesc']=_0x2cf5('0x1b4');_0x28462c[_0x2cf5('0x11f')]+=0x1;_0x28462c['countglobal']+=0x1;_0x287756=_0x55b4b5['dialAgentRejectRetryFrequency'];_0x12d259=_0x55b4b5['callAdditionalPhoneAfterMin'];ami[_0x2cf5('0x42')](_0x2cf5('0x1b5'),ut[_0x2cf5('0x116')](_0x3db085,_0x2cf5('0x1b6')));hopperUtils[_0x2cf5('0xc7')](_0x28462c)['catch'](loggerCatch(_0x2cf5('0x1b7')));if(_0x2e2e18[_0x2cf5('0x1a3')](0x14,_0x3db085,_0x55b4b5)&&!_0x456817){if(_0x28462c['countagentrejectretry']>=_0x55b4b5[_0x2cf5('0x1b8')]){_0x2e2e18['createStateFinal'](_0x28462c,_0x426930,_0x44646c,'reason\x2020\x20agentreject');}else{_0x2e2e18[_0x2cf5('0x121')](_0x28462c,_0x426930,_0x44646c,_0x2cf5('0x1b9'));}}break;default:_0x55b4b5[_0x2cf5('0x133')]+=0x1;_0x28462c['state']=0xc;_0x28462c[_0x2cf5('0x6d')]=_0x4f8ec0[_0x2cf5('0x19d')];_0x287756=_0x55b4b5[_0x2cf5('0x198')];_0x12d259=_0x55b4b5[_0x2cf5('0xed')];hopperUtils[_0x2cf5('0xc7')](_0x28462c)['catch'](loggerCatch(_0x2cf5('0x1ba')));if(_0x2e2e18[_0x2cf5('0x1a3')](_0x4f8ec0[_0x2cf5('0x19d')],_0x3db085,_0x55b4b5)&&!_0x456817){if(_0x28462c['countbusyretry']+_0x28462c['countcongestionretry']+_0x28462c[_0x2cf5('0x12c')]+_0x28462c[_0x2cf5('0x11e')]+_0x28462c[_0x2cf5('0xd8')]+_0x28462c[_0x2cf5('0xeb')]+_0x28462c[_0x2cf5('0x11b')]+_0x28462c[_0x2cf5('0x11f')]>=_0x55b4b5[_0x2cf5('0x120')]){_0x2e2e18[_0x2cf5('0x121')](_0x28462c,_0x426930,_0x44646c,_0x4f8ec0[_0x2cf5('0x19d')]);}else{_0x2e2e18['createStateFinal'](_0x28462c,_0x426930,_0x44646c,_0x4f8ec0[_0x2cf5('0x19d')]);}}}})[_0x2cf5('0x9d')](function(){if(_0x456817){hopperUtils[_0x2cf5('0xe6')](_0x28462c,_0x287756,_0x12d259)[_0x2cf5('0x9d')](function(){return _0x426930(0x1);});}});});};Dialer[_0x2cf5('0x1b')]['stateGlobal']=function(_0x976074,_0x135d61,_0x11146f,_0x13a115){var _0x4ac87b=new Final(_0x976074);_0x4ac87b[_0x2cf5('0x6c')]=0xf;_0x4ac87b[_0x2cf5('0x6d')]=_0x2cf5('0x1bb');this[_0x2cf5('0x124')](_0x4ac87b,_0x135d61,_0x11146f,_0x13a115);};Dialer[_0x2cf5('0x1b')]['createStateFinal']=function(_0x987cf1,_0x15bf7e,_0x2219b6,_0x235c9b){hopperUtils[_0x2cf5('0xc9')](_0x987cf1)[_0x2cf5('0x9d')](function(){return _0x15bf7e(msgResponse(_0x2cf5('0x19a'),_0x2cf5('0x109'),_0x235c9b));})['catch'](function(){return _0x2219b6(msgResponse(_0x2cf5('0x1bc'),_0x2cf5('0x92'),_0x2cf5('0x1bd')));});};Dialer[_0x2cf5('0x1b')][_0x2cf5('0xa')]=function(_0x215761){var _0x2fc2ba=_0x215761[_0x2cf5('0x1be')]/0x64;var _0x9e1ee=_0x215761[_0x2cf5('0xcf')]/(_0x215761['outboundDropCallsDayTimeout']+_0x215761['outboundAnswerCallsDay']);var _0x346be3=Math[_0x2cf5('0x1bf')](_0x215761['predictiveIntervalAvailable']*(_0x215761['predictiveIntervalMaxThreshold']/0x64));var _0x1d739b=Math[_0x2cf5('0x1bf')](_0x215761[_0x2cf5('0x1c0')]*(_0x215761[_0x2cf5('0x1c1')]/0x64));var _0x1c9c40=_0x215761[_0x2cf5('0x139')]+_0x215761[_0x2cf5('0x13b')];var _0x3feaba=Math[_0x2cf5('0x1c2')](_0x215761[_0x2cf5('0x5b')]*_0x215761[_0x2cf5('0x5f')]*_0x215761[_0x2cf5('0x1c3')]*_0x215761['predictiveIntervalMultiplicativeFactor']);if(_[_0x2cf5('0x61')](_0x215761['startProgressive'])){if(!_[_0x2cf5('0x61')](_0x215761['startPredictive'])){_0x215761[_0x2cf5('0x28')]=undefined;loggerPredictive['error'](_0x2cf5('0x1c4'),_0x2cf5('0x1c5'));}if(!_['isUndefined'](_0x215761['handlePredictive'])){loggerPredictive[_0x2cf5('0x65')](_0x2cf5('0x1c4'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x215761[_0x2cf5('0x63')]);_0x215761['handlePredictive']=undefined;}_0x215761[_0x2cf5('0x29')]=moment()[_0x2cf5('0x7a')](_0x2cf5('0xc6'));loggerPredictive['info'](_0x215761[_0x2cf5('0x48')],'collection\x20data\x20in\x20progressive\x20at',_0x215761[_0x2cf5('0x29')]);this['handlePower'](_0x215761,0x1);}else if(ifInterval(_0x215761[_0x2cf5('0x1c6')],_0x215761[_0x2cf5('0x29')])){this[_0x2cf5('0xb1')](_0x215761,0x1);loggerPredictiveCalls['info'](_0x2cf5('0x1c7'),_0x215761[_0x2cf5('0x29')],_0x215761[_0x2cf5('0x48')]);_0x215761[_0x2cf5('0x5b')]=0x0;_0x215761[_0x2cf5('0x1c8')]=0x0;}else if(_0x2fc2ba<_0x9e1ee&&_0x215761[_0x2cf5('0x1c9')]===_0x2cf5('0x1ca')){clearPredictiveAttributes(_0x215761);loggerPredictive[_0x2cf5('0x4b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x2cf5('0x1cb'),_0x9e1ee,_0x2cf5('0x29'),_0x215761[_0x2cf5('0x48')]);}else if(_0x3feaba<_0x215761['predictiveIntervalErlangCallsDroppedCalls']&&_0x215761[_0x2cf5('0x1c9')]===_0x2cf5('0x1ca')){clearPredictiveAttributes(_0x215761);loggerPredictive['info'](_0x2cf5('0x1cc'),_0x2cf5('0x1cd'),_0x3feaba,_0x2cf5('0x1ce'),_0x215761['predictiveIntervalErlangCallsDroppedCalls'],_0x2cf5('0x29'),_0x215761[_0x2cf5('0x48')]);}else if(!ifInterval(_0x215761[_0x2cf5('0x1c6')],_0x215761[_0x2cf5('0x29')])&&_['isUndefined'](_0x215761[_0x2cf5('0x28')])&&!_[_0x2cf5('0x61')](_0x215761[_0x2cf5('0x29')])){_0x215761[_0x2cf5('0x28')]=moment()[_0x2cf5('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2cf5('0x4b')](_0x215761[_0x2cf5('0x48')],'started\x20in\x20predictive\x20at',_0x215761[_0x2cf5('0x28')]);hopperUtils['avgHandleTime'](_0x215761['dialPredictiveInterval'])[_0x2cf5('0x9d')](this[_0x2cf5('0x1cf')](_0x215761))[_0x2cf5('0x9d')](mergeDataErlangB(_0x215761))[_0x2cf5('0x9d')](this[_0x2cf5('0x1d0')](_0x215761))[_0x2cf5('0xa3')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x215761));}else if(!ifInterval(_0x215761['dialPredictiveInterval'],_0x215761[_0x2cf5('0x28')])){_0x215761[_0x2cf5('0x1c8')]=0x0;_0x215761[_0x2cf5('0x28')]=moment()['format'](_0x2cf5('0xc6'));loggerPredictive[_0x2cf5('0x4b')](_0x215761['name'],_0x2cf5('0x1d1'),_0x215761[_0x2cf5('0x28')]);clearInterval(_0x215761[_0x2cf5('0x63')]);_0x215761[_0x2cf5('0x63')]=undefined;hopperUtils[_0x2cf5('0x1d2')](_0x215761[_0x2cf5('0x1c6')])[_0x2cf5('0x9d')](this[_0x2cf5('0x1cf')](_0x215761))[_0x2cf5('0x9d')](mergeDataErlangB(_0x215761))[_0x2cf5('0x9d')](this[_0x2cf5('0x1d0')](_0x215761))[_0x2cf5('0xa3')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x215761));}else if(_0x215761['predictiveIntervalAvailable']&&_0x1c9c40<_0x215761['predictiveIntervalAvailable']-_0x1d739b){clearPredictiveAttributes(_0x215761);loggerPredictive[_0x2cf5('0x4b')](_0x215761['name'],_0x2cf5('0x1d3'),_0x1c9c40,_0x2cf5('0x1d4'),_0x215761['predictiveIntervalAvailable'],'-',_0x1d739b,'=',_0x215761[_0x2cf5('0x1c0')]-_0x1d739b,')');}else if(_0x215761[_0x2cf5('0x1c0')]&&_0x1c9c40>_0x215761[_0x2cf5('0x1c0')]+_0x346be3){clearPredictiveAttributes(_0x215761);loggerPredictive[_0x2cf5('0x4b')](_0x215761[_0x2cf5('0x48')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1c9c40,')\x20are\x20more\x20than\x20threshold\x20(',_0x215761[_0x2cf5('0x1c0')],'+',_0x346be3,'=',_0x215761[_0x2cf5('0x1c0')]+_0x346be3,')');}};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x1cf')]=function(_0x24c7e1){var _0x306ae3=this;return function(_0x366f5d){return new Promise(function(_0x1ca6f7,_0x354260){_[_0x2cf5('0x60')](_0x24c7e1,_0x366f5d[0x0]);if(checkGetDataPredictive(_0x366f5d[0x0])){var _0x31bd72=_0x24c7e1[_0x2cf5('0x1c0')]=_0x24c7e1['talking']+_0x24c7e1[_0x2cf5('0x139')];var _0x494b03=_0x24c7e1['dialPredictiveInterval']*0x3c;var _0x5a5089=_0x366f5d[0x0]['predictiveIntervalAvgTalktime']+_0x366f5d[0x0][_0x2cf5('0x52')];var _0x53b70d=(_0x366f5d[0x0][_0x2cf5('0x4f')]+_0x366f5d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x366f5d[0x0][_0x2cf5('0xe7')])/_0x366f5d[0x0][_0x2cf5('0x4d')];_0x24c7e1[_0x2cf5('0x1c3')]=_0x53b70d>0x0?_0x53b70d:0x1;switch(_0x24c7e1['dialPredictiveOptimization']){case'dropRate':var _0x28ed97=_0x24c7e1[_0x2cf5('0x1be')]/0x64;return _0x306ae3[_0x2cf5('0x1d5')](_0x31bd72,_0x494b03,_0x5a5089,_0x53b70d,_0x28ed97)[_0x2cf5('0x9d')](function(_0x5dfe49){return _0x1ca6f7(_0x5dfe49);});case'agentBusyFactor':var _0x1a4d7f=_0x24c7e1['dialPredictiveOptimizationPercentage']/0x64;return _0x306ae3['busyFactor'](_0x31bd72,_0x494b03,_0x5a5089,_0x53b70d,_0x1a4d7f)[_0x2cf5('0x9d')](function(_0x3bd6d1){return _0x1ca6f7(_0x3bd6d1);});default:return _0x354260(msgResponse('[getDataPredictive]',_0x2cf5('0x92'),_0x2cf5('0x1d6')));}}else{return _0x354260(msgResponse('[getDataPredictive]',_0x2cf5('0x92'),_0x2cf5('0x1d7')));}});};};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x1d8')]=function(_0x5cca11){var _0x3d67f4=this;return function(_0x33cec2){return new Promise(function(_0x219423,_0x55ba87){_[_0x2cf5('0x60')](_0x5cca11,_0x33cec2[0x0]);if(checkGetDataPredictive(_0x33cec2[0x0])){loggerPredictive[_0x2cf5('0x4b')](JSON[_0x2cf5('0x71')](_0x33cec2[0x0]));if(_0x5cca11['dialPredictiveOptimization']===_0x2cf5('0x1ca')){return _0x3d67f4[_0x2cf5('0x150')](_0x5cca11['id'])['then'](function(_0x406e19){var _0x1dd0ae=_0x5cca11['loggedIn']-_0x406e19[0x0][_0x2cf5('0x1d9')];var _0x30d55e=_0x5cca11['dialPredictiveInterval']*0x3c;var _0x3b28f1=_0x33cec2[0x0][_0x2cf5('0x54')]+_0x33cec2[0x0]['predictiveIntervalAvgHoldtime'];var _0x46a871=(_0x33cec2[0x0][_0x2cf5('0x4f')]+_0x33cec2[0x0][_0x2cf5('0xce')]+_0x33cec2[0x0][_0x2cf5('0xe7')])/_0x33cec2[0x0][_0x2cf5('0x4d')];var _0x20aa67=_0x5cca11[_0x2cf5('0x1be')]/0x64;_0x5cca11[_0x2cf5('0x1da')]=_0x406e19[0x0][_0x2cf5('0x1d9')]||0x0;_0x5cca11[_0x2cf5('0x1c3')]=_0x46a871>0x0?_0x46a871:0x1;return _0x3d67f4[_0x2cf5('0x1d5')](_0x1dd0ae,_0x30d55e,_0x3b28f1,_0x46a871,_0x20aa67);})[_0x2cf5('0x9d')](function(_0x1bbcc0){return _0x219423(_0x1bbcc0);})[_0x2cf5('0xa3')](function(_0xaa21d9){return _0x55ba87(msgResponse(_0x2cf5('0x1db'),'Failure',JSON[_0x2cf5('0x71')](_0xaa21d9)));});}if(_0x5cca11['dialPredictiveOptimization']===_0x2cf5('0x1dc')){return _0x3d67f4['getVoiceQueueRtPauses'](_0x5cca11['id'])[_0x2cf5('0x9d')](function(_0xcf8f1a){var _0x79e566=_0x5cca11[_0x2cf5('0x1dd')]-_0xcf8f1a[0x0]['outboundQueuePauses'];var _0x23a58f=_0x5cca11[_0x2cf5('0x1c6')]*0x3c;var _0x2b9db5=_0x33cec2[0x0][_0x2cf5('0x54')]+_0x33cec2[0x0][_0x2cf5('0x52')];var _0x5c39c=(_0x33cec2[0x0]['predictiveIntervalAnsweredCalls']+_0x33cec2[0x0][_0x2cf5('0xce')]+_0x33cec2[0x0][_0x2cf5('0xe7')])/_0x33cec2[0x0][_0x2cf5('0x4d')];var _0x53f84e=_0x5cca11[_0x2cf5('0x1be')]/0x64;_0x5cca11[_0x2cf5('0x1da')]=_0xcf8f1a[0x0]['outboundQueuePauses']||0x0;_0x5cca11[_0x2cf5('0x1c3')]=_0x5c39c>0x0?_0x5c39c:0x1;return _0x3d67f4[_0x2cf5('0x1de')](_0x79e566,_0x23a58f,_0x2b9db5,_0x5c39c,_0x53f84e);})[_0x2cf5('0x9d')](function(_0x83fb89){return _0x219423(_0x83fb89);})['catch'](function(_0x32e7cd){return _0x55ba87(msgResponse('[CatchErlangB]',_0x2cf5('0x92'),JSON[_0x2cf5('0x71')](_0x32e7cd)));});}}else{return _0x55ba87(msgResponse('[getDataPredictive]','Failure',_0x2cf5('0x1d7')));}});};};Dialer[_0x2cf5('0x1b')]['startMethodPredictive']=function(_0x3ca3ba){var _0x4dc8bb=this;return function(){var _0x309879=0x0;var _0x51ae99=Math[_0x2cf5('0x1c2')](_0x3ca3ba[_0x2cf5('0x5d')]*0x3e8);if(_0x51ae99>0x0){_0x51ae99=_0x51ae99<0x64?0x64:_0x51ae99;loggerPredictive[_0x2cf5('0x4b')](_0x3ca3ba[_0x2cf5('0x48')],'one\x20call\x20every:',_0x51ae99,_0x2cf5('0x1df'));_0x3ca3ba[_0x2cf5('0x63')]=setInterval(function(){_0x4dc8bb[_0x2cf5('0x63')](_0x3ca3ba);loggerPredictiveCalls[_0x2cf5('0x4b')](_0x2cf5('0x1e0'),_0x309879+=0x1);},_0x51ae99);}else{loggerPredictive[_0x2cf5('0x4b')](_0x3ca3ba[_0x2cf5('0x48')],_0x2cf5('0x1e1'));}};};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x1e2')]=function(_0x2b0e17,_0x48818b){var _0x3e20da=this;return function(_0x1864fd){if(_[_0x2cf5('0x49')](_0x1864fd)){if(_[_0x2cf5('0xf5')](_0x48818b['UserId'])||!_0x48818b[_0x2cf5('0x1e3')]){if(_0x2b0e17[_0x2cf5('0xaf')]===_0x2cf5('0x8')){_0x2b0e17['queueStatusComplete']=_[_0x2cf5('0x61')](_0x2b0e17[_0x2cf5('0x70')])?!![]:_0x2b0e17[_0x2cf5('0x70')];var _0x4a7763=uuid['v4']();_0x3e20da['actions'][_0x4a7763]=new Action(_0x2b0e17,_0x48818b,_0x4a7763);loggerBooked[_0x2cf5('0x4b')]('[booked][checkContactBlack]',_0x4a7763,'queueStatusComplete:\x20',JSON[_0x2cf5('0x71')](_0x2b0e17[_0x2cf5('0x70')]),'Queue:\x20',_0x2b0e17[_0x2cf5('0x48')]);if(_0x2b0e17[_0x2cf5('0x70')]){_0x2b0e17[_0x2cf5('0x70')]=![];_0x3e20da['queueBooked'][_0x3e20da['actions'][_0x4a7763]['queue']]=[];ami[_0x2cf5('0xa1')]({'actionid':_0x4a7763,'action':'queuestatus','queue':_0x2b0e17[_0x2cf5('0x48')]})[_0x2cf5('0xa3')](function(){_0x3e20da[_0x2cf5('0xbe')](_0x2b0e17);hopperUtils[_0x2cf5('0xdb')]({'active':![],'ContactId':_0x3e20da[_0x2cf5('0x26')][_0x4a7763]['ContactId'],'ListId':_0x3e20da[_0x2cf5('0x26')][_0x4a7763][_0x2cf5('0xdf')],'VoiceQueueId':_0x3e20da[_0x2cf5('0x26')][_0x4a7763][_0x2cf5('0xe0')]||undefined,'CampaignId':_0x3e20da[_0x2cf5('0x26')][_0x4a7763]['CampaignId']||undefined})[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x1e4')));delete _0x3e20da[_0x2cf5('0x26')][_0x4a7763];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON['stringify'](_0x2b0e17[_0x2cf5('0x70')]),_0x2cf5('0x1e5'),_0x2b0e17['name']);_0x3e20da['updateOriginated'](_0x2b0e17);hopperUtils[_0x2cf5('0xdb')]({'active':![],'ContactId':_0x3e20da[_0x2cf5('0x26')][_0x4a7763][_0x2cf5('0xde')],'ListId':_0x3e20da[_0x2cf5('0x26')][_0x4a7763][_0x2cf5('0xdf')],'VoiceQueueId':_0x3e20da[_0x2cf5('0x26')][_0x4a7763][_0x2cf5('0xe0')]||undefined,'CampaignId':_0x3e20da[_0x2cf5('0x26')][_0x4a7763]['CampaignId']||undefined})[_0x2cf5('0xa3')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3e20da[_0x2cf5('0x26')][_0x4a7763];}}else{return _0x3e20da['actionOriginate'](_0x2b0e17,_0x48818b);}}else{if(utils[_0x2cf5('0xcb')](undefined,_0x48818b[_0x2cf5('0x1e6')])<_0x2b0e17['dialRecallMeTimeout']*0x3c){if(_0x48818b[_0x2cf5('0x145')]&&!_0x48818b[_0x2cf5('0x145')][_0x2cf5('0x1e7')]){_0x3e20da[_0x2cf5('0x20')][_0x2cf5('0xf9')](_0x48818b['id'])[_0x2cf5('0x1e')](function(){_0x3e20da[_0x2cf5('0xbe')](_0x2b0e17);});}else{hopperUtils[_0x2cf5('0x1e8')]({'active':![]},_0x48818b['id'],0x1)['finally'](function(){_0x3e20da[_0x2cf5('0xbe')](_0x2b0e17);});}}else{_0x2b0e17[_0x2cf5('0x1e9')]+=0x1;_0x3e20da[_0x2cf5('0xbe')](_0x2b0e17);if(_0x2b0e17[_0x2cf5('0x1ea')]){hopperUtils[_0x2cf5('0xdb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x48818b[_0x2cf5('0xde')],'ListId':_0x48818b[_0x2cf5('0xdf')],'VoiceQueueId':_0x48818b[_0x2cf5('0xe0')]||undefined,'CampaignId':_0x48818b[_0x2cf5('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x2cf5('0xc7')](createObjHistory(_0x2b0e17,_0x48818b,utils[_0x2cf5('0x68')]['QUEUE_RECALL'],0x17,'RecallInQueue'))[_0x2cf5('0xa3')](loggerCatch(_0x2cf5('0x1eb')));}else{_0x3e20da['saveInDb'](createObjHistory(_0x2b0e17,_0x48818b,utils[_0x2cf5('0x68')][_0x2cf5('0x1ec')],0x16,_0x2cf5('0x1ed')),_0x2cf5('0x1ee'),_0x2cf5('0x1ef'));}}}}else{_0x2b0e17['outboundBlacklistCallsDay']+=0x1;_0x3e20da[_0x2cf5('0x118')](createObjHistory(_0x2b0e17,_0x48818b,utils['CAMPAIGN_STATUS'][_0x2cf5('0x1f0')],0xd,_0x2cf5('0x1f1')),_0x2cf5('0x1f2'),'[Originate][MoveBlacklist]');throw _0x2cf5('0x1f3');}};};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x159')]=function(_0x4ae3ec){var _0x3a02b5=this;var _0x2c6506=_0x4ae3ec['limitCalls']-_0x4ae3ec['originated'];emitCampaignSummary(_0x4ae3ec);if(_0x2c6506>0x0&&_0x4ae3ec['temp']==0x0){if(_0x2c6506>this[_0x2cf5('0x24')]){_0x2c6506=this[_0x2cf5('0x24')];}_0x4ae3ec[_0x2cf5('0x1f4')]=0x1;hopperUtils[_0x2cf5('0x1f5')](_0x4ae3ec,_0x2c6506)[_0x2cf5('0x9d')](function(_0xa06453){_0x4ae3ec[_0x2cf5('0x1f4')]=0x0;if(_0xa06453){if(!utils[_0x2cf5('0x1f6')](_0xa06453)){_0x4ae3ec[_0x2cf5('0x67')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0x2cf5('0x4b')](_0x2cf5('0x1f7')+_0x4ae3ec['name']);}else{_0x4ae3ec[_0x2cf5('0x7e')]+=_0xa06453[_0x2cf5('0x99')];_0x4ae3ec[_0x2cf5('0x67')]=utils[_0x2cf5('0x68')][_0x2cf5('0x1f8')];for(var _0x3f2193=0x0;_0x3f2193<_0xa06453[_0x2cf5('0x99')];_0x3f2193+=0x1){_0x4ae3ec[_0x2cf5('0x1f9')]+=0x1;if(_[_0x2cf5('0xf5')](_0xa06453[_0x3f2193])||_[_0x2cf5('0xf5')](_0xa06453[_0x3f2193][_0x2cf5('0x178')])||_[_0x2cf5('0xf5')](_0xa06453[_0x3f2193]['phone'])){_0x3a02b5[_0x2cf5('0x154')](_0x2cf5('0x1fa'),_0x4ae3ec,_0xa06453[_0x3f2193]);}else{hopperUtils[_0x2cf5('0x1fb')](_['pick'](_0xa06453[_0x3f2193],[_0x2cf5('0xe1'),'phone']))[_0x2cf5('0x9d')](_0x3a02b5[_0x2cf5('0x1e2')](_0x4ae3ec,_0xa06453[_0x3f2193]))[_0x2cf5('0xa3')](_0x3a02b5[_0x2cf5('0x153')](_0x2cf5('0x1fc'),_0x4ae3ec));}}}}})[_0x2cf5('0xa3')](loggerGetContactDialer('[getContactCampaign2]',_0x4ae3ec,_0x2c6506));}};Dialer['prototype'][_0x2cf5('0xb1')]=function(_0x6283b1,_0x5167b9){var _0x22bd73=this;var _0xe556b3=[];if(_0x5167b9<0x1||_0x6283b1[_0x2cf5('0xaf')]==='booked'){_0x5167b9=0x1;}var _0x17ff99=Math[_0x2cf5('0x1c2')](_0x6283b1[_0x2cf5('0x139')]*_0x5167b9)-_0x6283b1['originated'];if(_0x6283b1['dialLimitQueue']>0x0){var _0x32852f=_0x6283b1['dialLimitQueue']-_0x6283b1[_0x2cf5('0x7e')]-_0x6283b1[_0x2cf5('0x13b')]-_0x6283b1[_0x2cf5('0x1fd')];if(_0x17ff99>_0x32852f){_0x17ff99=_0x32852f;}}if(_0x17ff99>0x0&&_0x6283b1[_0x2cf5('0x1f4')]==0x0){if(_0x6283b1[_0x2cf5('0xaf')]===_0x2cf5('0x8')){_0x17ff99=0x1;}if(_0x17ff99>this[_0x2cf5('0x24')]){_0x17ff99=this[_0x2cf5('0x24')];}for(var _0x31e007 in this[_0x2cf5('0x23')]){if(typeof this[_0x2cf5('0x23')][_0x31e007]!==_0x2cf5('0x14c')){if(this[_0x2cf5('0x23')][_0x31e007][_0x2cf5('0x6c')]==='not_inuse'&&this[_0x2cf5('0x23')][_0x31e007][_0x2cf5('0x89')]===_0x2cf5('0x88')){_0xe556b3[_0x2cf5('0x9a')](this[_0x2cf5('0x23')][_0x31e007]['id']);}}}_0x6283b1[_0x2cf5('0x1f4')]=0x1;hopperUtils[_0x2cf5('0x1fe')](_0x6283b1,_0xe556b3,_0x17ff99)[_0x2cf5('0x9d')](function(_0x67a238){_0x6283b1[_0x2cf5('0x1f4')]=0x0;if(_0x67a238){if(!utils[_0x2cf5('0x1f6')](_0x67a238)){hopperUtils[_0x2cf5('0x1ff')](_0x6283b1)[_0x2cf5('0x9d')](sendMessageReschedule(_0x6283b1))[_0x2cf5('0xa3')](loggerCatch('[countReScheduled]\x20'));}else{_0x6283b1['originated']+=_0x67a238[_0x2cf5('0x99')];_0x6283b1[_0x2cf5('0x67')]=_0x6283b1[_0x2cf5('0xaf')]===_0x2cf5('0x8')?utils['CAMPAIGN_STATUS'][_0x2cf5('0x164')]:utils[_0x2cf5('0x68')][_0x2cf5('0x1f8')];for(var _0x5ecbcf=0x0;_0x5ecbcf<_0x67a238[_0x2cf5('0x99')];_0x5ecbcf+=0x1){if(_[_0x2cf5('0xf5')](_0x67a238[_0x5ecbcf])||_[_0x2cf5('0xf5')](_0x67a238[_0x5ecbcf][_0x2cf5('0x178')])||_[_0x2cf5('0xf5')](_0x67a238[_0x5ecbcf][_0x2cf5('0x15e')])){_0x22bd73[_0x2cf5('0x154')](_0x2cf5('0x1fa'),_0x6283b1,_0x67a238[_0x5ecbcf]);}else{hopperUtils[_0x2cf5('0x200')](_[_0x2cf5('0x72')](_0x67a238[_0x5ecbcf],['VoiceQueueId','phone']))[_0x2cf5('0x9d')](_0x22bd73[_0x2cf5('0x1e2')](_0x6283b1,_0x67a238[_0x5ecbcf]))['catch'](_0x22bd73[_0x2cf5('0x153')]('[actionOriginate]\x20',_0x6283b1));}}}}})['catch'](loggerGetContactDialer(_0x2cf5('0x201'),_0x6283b1,_0x17ff99));}};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x63')]=function(_0xef9911){if(_0xef9911[_0x2cf5('0x202')]>0x0){var _0xf4a33f=_0xef9911[_0x2cf5('0x202')]-_0xef9911[_0x2cf5('0x7e')]-_0xef9911[_0x2cf5('0x13b')];if(_0xf4a33f>0x0&&_0xef9911['temp']==0x0){this[_0x2cf5('0x203')](_0xef9911);}else{loggerPredictiveCalls[_0x2cf5('0x4b')](_0x2cf5('0x204'));}}else{this[_0x2cf5('0x203')](_0xef9911);}};Dialer['prototype'][_0x2cf5('0x203')]=function(_0x44d619){var _0x295fea=this;var _0x313071=[];_0x44d619[_0x2cf5('0x7e')]+=0x1;for(var _0x1ca716 in this[_0x2cf5('0x23')]){if(typeof this['agents'][_0x1ca716]!==_0x2cf5('0x14c')){if(this[_0x2cf5('0x23')][_0x1ca716][_0x2cf5('0x6c')]===_0x2cf5('0x205')&&this['agents'][_0x1ca716][_0x2cf5('0x89')]===_0x2cf5('0x88')){_0x313071[_0x2cf5('0x9a')](this['agents'][_0x1ca716]['id']);}}}_0x44d619[_0x2cf5('0x1f4')]=0x1;return this[_0x2cf5('0x1fe')](_0x44d619['id'],_0x313071,0x1,_0x44d619[_0x2cf5('0x206')],_0x44d619)[_0x2cf5('0x9d')](function(_0x1fbd74){_0x44d619['temp']=0x1;if(_0x1fbd74){if(!utils['checkContactEmpty'](_0x1fbd74)){utils[_0x2cf5('0x207')](_0x44d619,0x1,0x0);return hopperUtils[_0x2cf5('0x1ff')](_0x44d619)[_0x2cf5('0x9d')](sendMessageReschedule(_0x44d619))['catch'](loggerCatch(_0x2cf5('0x208')));}else{_0x44d619[_0x2cf5('0x67')]=utils[_0x2cf5('0x68')]['RUNNING'];if(_[_0x2cf5('0xf5')](_0x1fbd74[0x0])||_['isNil'](_0x1fbd74[0x0]['Contact'])||_[_0x2cf5('0xf5')](_0x1fbd74[0x0][_0x2cf5('0x15e')])){_0x295fea['emptyContact'](_0x2cf5('0x1fa'),_0x44d619,_0x1fbd74[0x0]);}else{return hopperUtils[_0x2cf5('0x200')](_['pick'](_0x1fbd74[0x0],[_0x2cf5('0xe0'),'phone']))[_0x2cf5('0x9d')](_0x295fea[_0x2cf5('0x1e2')](_0x44d619,_0x1fbd74[0x0]))['catch'](_0x295fea[_0x2cf5('0x153')](_0x2cf5('0x209'),_0x44d619));}}}})[_0x2cf5('0xa3')](loggerGetContactDialer('[getContactDialerPredictive]',_0x44d619,0x1));};Dialer[_0x2cf5('0x1b')][_0x2cf5('0x1d5')]=function(_0x396637,_0x188277,_0x5e35ac,_0x2895ee,_0xcf4c32,_0x5c24cb){loggerPredictive['info'](_0x2cf5('0x20a'));loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x20b'),_0x396637);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x20c'),_0x188277);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x20d'),_0x5e35ac);loggerPredictive[_0x2cf5('0x4b')]('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',_0x2895ee);loggerPredictive['info'](_0x2cf5('0x20e'),_0xcf4c32);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x55'));return new Promise(function(_0x394efb,_0x632d36){if(_0x396637<=0x0||isNaN(_0x396637)){return _0x632d36(msgResponse(_0x2cf5('0x20f'),'Error','m\x20=\x20'+_0x396637));}if(_0x5e35ac<=0x0||isNaN(_0x5e35ac)){return _0x632d36(msgResponse(_0x2cf5('0x20f'),_0x2cf5('0x83'),_0x2cf5('0x210')+_0x5e35ac));}if(_0x2895ee<=0x0||isNaN(_0x2895ee)){return _0x632d36(msgResponse(_0x2cf5('0x20f'),'Error','p\x20=\x20'+_0x2895ee));}if(_0x188277<=0x0||isNaN(_0x188277)){return _0x632d36(msgResponse(_0x2cf5('0x20f'),_0x2cf5('0x83'),_0x2cf5('0x211')+_0x188277));}if(_0xcf4c32<=0x0||isNaN(_0xcf4c32)){return _0x632d36(msgResponse(_0x2cf5('0x20f'),'Error','Amax\x20=\x20'+_0xcf4c32));}_0x5c24cb=_0x5c24cb||0x0;var _0x53cdb8=0x1/_0x5e35ac;var _0x21478b=0x0;var _0x3a149a=0x0;var _0x1ae24b=0x0;var _0x1d8553=0x0;for(var _0xf4ee9=0x0;_0x1ae24b<_0xcf4c32;_0xf4ee9+=0x1){_0x3a149a=_0xf4ee9/_0x188277;_0x21478b=(_0x2895ee*_0x3a149a+_0x5c24cb)/_0x53cdb8;_0x1ae24b=utils['erlangb'](_0x21478b,_0x396637);_0x1d8553=_0x21478b/_0x396637*(0x1-utils['erlangb'](_0x21478b,_0x396637));}return _0x394efb({'erlangCalls':_0xf4ee9,'erlangCallToSecond':_0x188277/_0xf4ee9,'erlangAbandonmentRate':_0x1ae24b,'erlangBusyFactor':_0x1d8553});});};Dialer['prototype'][_0x2cf5('0x1de')]=function(_0x595d25,_0x349381,_0x15c33e,_0x4830c5,_0x1c36dd,_0x245478){loggerPredictive['info'](_0x2cf5('0x212'));loggerPredictive['info'](_0x2cf5('0x20b'),_0x595d25);loggerPredictive[_0x2cf5('0x4b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x349381);loggerPredictive['info'](_0x2cf5('0x20d'),_0x15c33e);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x213'),_0x4830c5);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x214'),_0x1c36dd);loggerPredictive[_0x2cf5('0x4b')](_0x2cf5('0x55'));return new Promise(function(_0x36188a,_0x50b707){if(_0x595d25<=0x0||isNaN(_0x595d25)){return _0x50b707(msgResponse(_0x2cf5('0x215'),'Error',_0x2cf5('0x216')+_0x595d25));}if(_0x15c33e<=0x0||isNaN(_0x15c33e)){return _0x50b707(msgResponse(_0x2cf5('0x215'),_0x2cf5('0x83'),_0x2cf5('0x210')+_0x15c33e));}if(_0x4830c5<=0x0||isNaN(_0x4830c5)){return _0x50b707(msgResponse(_0x2cf5('0x215'),_0x2cf5('0x83'),_0x2cf5('0x217')+_0x4830c5));}if(_0x349381<=0x0||isNaN(_0x349381)){return _0x50b707(msgResponse(_0x2cf5('0x215'),_0x2cf5('0x83'),'interval\x20=\x20'+_0x349381));}if(_0x1c36dd<=0x0||isNaN(_0x1c36dd)){return _0x50b707(msgResponse(_0x2cf5('0x215'),'Error',_0x2cf5('0x218')+_0x1c36dd));}_0x245478=_0x245478||0x0;var _0x2cbaa5=0x1/_0x15c33e;var _0x4450a7=0x0;var _0x47604e=0x0;var _0x5683cd=0x0;var _0x53a80a=0x0;for(var _0x77123c=0x0;_0x53a80a<_0x1c36dd;_0x77123c+=0x1){_0x47604e=_0x77123c/_0x349381;_0x4450a7=(_0x4830c5*_0x47604e+_0x245478)/_0x2cbaa5;_0x5683cd=utils[_0x2cf5('0x219')](_0x4450a7,_0x595d25);_0x53a80a=_0x4450a7/_0x595d25*(0x1-utils[_0x2cf5('0x219')](_0x4450a7,_0x595d25));}return _0x36188a({'erlangCalls':_0x77123c,'erlangCallToSecond':_0x349381/_0x77123c,'erlangAbandonmentRate':_0x5683cd,'erlangBusyFactor':_0x53a80a});});};module[_0x2cf5('0x21a')]=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 ff01698..87ee77f 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 _0x4363=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper'];(function(_0x4a6936,_0x305c0d){var _0x1e1d3c=function(_0xb5dcf3){while(--_0xb5dcf3){_0x4a6936['push'](_0x4a6936['shift']());}};_0x1e1d3c(++_0x305c0d);}(_0x4363,0x19c));var _0x3436=function(_0x32cfed,_0x278ecd){_0x32cfed=_0x32cfed-0x0;var _0x5735e9=_0x4363[_0x32cfed];return _0x5735e9;};'use strict';var util=require(_0x3436('0x0'));var _=require(_0x3436('0x1'));var moment=require(_0x3436('0x2'));function checkNameSurname(_0x335481,_0x4b0314,_0x451781){var _0xc0371f='';if(!_[_0x3436('0x3')](_0x4b0314)&&_0x3436('0x4')===typeof _0x4b0314){_0xc0371f+=_0x4b0314;}if(!_[_0x3436('0x3')](_0x451781)&&'string'===typeof _0x451781){_0xc0371f+='\x20'+_0x451781;}if(_0xc0371f!==''){return _0xc0371f;}return _0x335481;}function Action(_0x19ef0f,_0x42ad8e,_0x1402b9){this[_0x3436('0x5')]=_0x19ef0f;this[_0x3436('0x6')]=_0x1402b9||undefined;this[_0x3436('0x7')]=checkNameSurname(_0x42ad8e[_0x3436('0x8')][_0x3436('0x9')],_0x42ad8e[_0x3436('0x8')][_0x3436('0xa')],_0x42ad8e[_0x3436('0x8')][_0x3436('0xb')]);this[_0x3436('0xc')]=_0x42ad8e[_0x3436('0x9')];this[_0x3436('0xd')]=_0x19ef0f[_0x3436('0x7')];this[_0x3436('0xe')]=_0x42ad8e[_0x3436('0xe')]||![];this[_0x3436('0xf')]=_0x19ef0f[_0x3436('0xf')];this[_0x3436('0x10')]=_0x19ef0f['dialQueueTimeout']||0x3;this[_0x3436('0x11')]=_0x42ad8e[_0x3436('0x11')];this[_0x3436('0x12')]=_0x42ad8e[_0x3436('0x12')];this[_0x3436('0x13')]=_0x42ad8e[_0x3436('0x13')];this['countnoanswerretry']=_0x42ad8e['countnoanswerretry'];this[_0x3436('0x14')]=_0x42ad8e[_0x3436('0x14')];this['countdropretry']=_0x42ad8e['countdropretry'];this[_0x3436('0x15')]=_0x42ad8e[_0x3436('0x15')];this[_0x3436('0x16')]=_0x42ad8e[_0x3436('0x16')];this['countagentrejectretry']=_0x42ad8e['countagentrejectretry'];this[_0x3436('0x17')]=_0x42ad8e[_0x3436('0x17')];this['ListId']=_0x42ad8e['ListId'];this[_0x3436('0x18')]=_0x42ad8e[_0x3436('0x18')];this[_0x3436('0x19')]=_0x42ad8e['VoiceQueueId'];this[_0x3436('0x1a')]=_0x42ad8e[_0x3436('0x1a')];this[_0x3436('0x1b')]=_0x42ad8e['id'];this['ContactFirstName']=_0x42ad8e[_0x3436('0x8')]['firstName']||'';this[_0x3436('0x1c')]=moment()[_0x3436('0x1d')](_0x3436('0x1e'));this[_0x3436('0x1f')]=_0x42ad8e['callback'];this[_0x3436('0x20')]=_0x42ad8e[_0x3436('0x20')];this[_0x3436('0x21')]=_0x42ad8e[_0x3436('0x21')];this[_0x3436('0x22')]=_0x42ad8e[_0x3436('0x22')];this[_0x3436('0x23')]='';this[_0x3436('0x24')]='';}Action['prototype'][_0x3436('0x25')]=function(){return util[_0x3436('0x1d')](_0x3436('0x26'),this[_0x3436('0x7')],this['voiceQueue'][_0x3436('0x27')]>0x0?this[_0x3436('0xc')][_0x3436('0x28')](this[_0x3436('0x5')]['dialCutDigit']):this['number']);};Action[_0x3436('0x29')][_0x3436('0x2a')]=function(){return this['queue'];};module[_0x3436('0x2b')]=Action; \ No newline at end of file +var _0x78fd=['CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','lodash','moment','isNil','string','voiceQueue','name','Contact','firstName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x78fd,0x1a7));var _0xd78f=function(_0x17e826,_0x3397fc){_0x17e826=_0x17e826-0x0;var _0x50d6c0=_0x78fd[_0x17e826];return _0x50d6c0;};'use strict';var util=require('util');var _=require(_0xd78f('0x0'));var moment=require(_0xd78f('0x1'));function checkNameSurname(_0x27e1ae,_0x32e2ae,_0x1e4725){var _0x1ea326='';if(!_[_0xd78f('0x2')](_0x32e2ae)&&_0xd78f('0x3')===typeof _0x32e2ae){_0x1ea326+=_0x32e2ae;}if(!_[_0xd78f('0x2')](_0x1e4725)&&_0xd78f('0x3')===typeof _0x1e4725){_0x1ea326+='\x20'+_0x1e4725;}if(_0x1ea326!==''){return _0x1ea326;}return _0x27e1ae;}function Action(_0x3dc547,_0x2102fe,_0x50c714){this[_0xd78f('0x4')]=_0x3dc547;this['uniqueid']=_0x50c714||undefined;this[_0xd78f('0x5')]=checkNameSurname(_0x2102fe[_0xd78f('0x6')]['phone'],_0x2102fe[_0xd78f('0x6')][_0xd78f('0x7')],_0x2102fe[_0xd78f('0x6')]['lastName']);this[_0xd78f('0x8')]=_0x2102fe[_0xd78f('0x9')];this[_0xd78f('0xa')]=_0x3dc547[_0xd78f('0x5')];this[_0xd78f('0xb')]=_0x2102fe['active']||![];this['type']=_0x3dc547[_0xd78f('0xc')];this[_0xd78f('0xd')]=_0x3dc547[_0xd78f('0xd')]||0x3;this[_0xd78f('0xe')]=_0x2102fe[_0xd78f('0xe')];this[_0xd78f('0xf')]=_0x2102fe[_0xd78f('0xf')];this[_0xd78f('0x10')]=_0x2102fe['countcongestionretry'];this[_0xd78f('0x11')]=_0x2102fe['countnoanswerretry'];this[_0xd78f('0x12')]=_0x2102fe['countnosuchnumberretry'];this['countdropretry']=_0x2102fe[_0xd78f('0x13')];this[_0xd78f('0x14')]=_0x2102fe['countabandonedretry'];this[_0xd78f('0x15')]=_0x2102fe['countmachineretry'];this[_0xd78f('0x16')]=_0x2102fe['countagentrejectretry'];this[_0xd78f('0x17')]=_0x2102fe[_0xd78f('0x17')];this[_0xd78f('0x18')]=_0x2102fe['ListId'];this[_0xd78f('0x19')]=_0x2102fe[_0xd78f('0x19')];this[_0xd78f('0x1a')]=_0x2102fe['VoiceQueueId'];this[_0xd78f('0x1b')]=_0x2102fe['CampaignId'];this[_0xd78f('0x1c')]=_0x2102fe['id'];this[_0xd78f('0x1d')]=_0x2102fe[_0xd78f('0x6')][_0xd78f('0x7')]||'';this[_0xd78f('0x1e')]=moment()['format'](_0xd78f('0x1f'));this[_0xd78f('0x20')]=_0x2102fe['callback'];this[_0xd78f('0x21')]=_0x2102fe[_0xd78f('0x21')];this[_0xd78f('0x22')]=_0x2102fe[_0xd78f('0x22')];this[_0xd78f('0x23')]=_0x2102fe['recallme'];this[_0xd78f('0x24')]='';this[_0xd78f('0x25')]='';}Action[_0xd78f('0x26')][_0xd78f('0x27')]=function(){return util[_0xd78f('0x28')](_0xd78f('0x29'),this['name'],this[_0xd78f('0x4')][_0xd78f('0x2a')]>0x0?this[_0xd78f('0x8')][_0xd78f('0x2b')](this[_0xd78f('0x4')][_0xd78f('0x2a')]):this[_0xd78f('0x8')]);};Action[_0xd78f('0x26')]['getQueue']=function(){return this[_0xd78f('0xa')];};module[_0xd78f('0x2c')]=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 c729406..70d84e8 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 _0xea41=['moment','../utils','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports'];(function(_0x4dbc6a,_0x57a63e){var _0x1e3ae1=function(_0x402d07){while(--_0x402d07){_0x4dbc6a['push'](_0x4dbc6a['shift']());}};_0x1e3ae1(++_0x57a63e);}(_0xea41,0x1d9));var _0x1ea4=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xea41[_0x1e7b16];return _0x37fadc;};'use strict';var moment=require(_0x1ea4('0x0'));var utils=require(_0x1ea4('0x1'));function AgentComplete(_0x41295f,_0x3a272c){this[_0x1ea4('0x2')]=0x4;this[_0x1ea4('0x3')]='Answer';this[_0x1ea4('0x4')]=_0x41295f[_0x1ea4('0x4')];this[_0x1ea4('0x5')]=_0x41295f[_0x1ea4('0x5')];this[_0x1ea4('0x6')]=_0x41295f[_0x1ea4('0x5')]===_0x1ea4('0x7')?_0x1ea4('0x8'):_0x41295f[_0x1ea4('0x5')];this[_0x1ea4('0x9')]=_0x41295f[_0x1ea4('0x9')];this['countcongestionretry']=_0x41295f[_0x1ea4('0xa')];this[_0x1ea4('0xb')]=_0x41295f[_0x1ea4('0xb')];this[_0x1ea4('0xc')]=_0x41295f['countbusyretry']+_0x41295f[_0x1ea4('0xa')]+_0x41295f['countnoanswerretry']+_0x41295f[_0x1ea4('0xd')]+_0x41295f[_0x1ea4('0xe')]+_0x41295f[_0x1ea4('0xf')]+_0x41295f[_0x1ea4('0x10')]+_0x41295f[_0x1ea4('0x11')];this[_0x1ea4('0xd')]=_0x41295f[_0x1ea4('0xd')];this[_0x1ea4('0xe')]=_0x41295f[_0x1ea4('0xe')];this['countabandonedretry']=_0x41295f[_0x1ea4('0xf')];this['countmachineretry']=_0x41295f[_0x1ea4('0x10')];this[_0x1ea4('0x11')]=_0x41295f[_0x1ea4('0x11')];this[_0x1ea4('0x12')]=_0x3a272c[_0x1ea4('0x12')];this[_0x1ea4('0x13')]=_0x41295f['name'];this[_0x1ea4('0x14')]=_0x41295f['number'];this[_0x1ea4('0x15')]=_0x41295f[_0x1ea4('0x15')];this[_0x1ea4('0x16')]=_0x41295f[_0x1ea4('0x16')];this[_0x1ea4('0x17')]=_0x41295f['answertime'];this[_0x1ea4('0x18')]=moment()['format'](_0x1ea4('0x19'));this[_0x1ea4('0x1a')]=utils['getSeconds'](_0x41295f['responsetime'],_0x41295f['starttime']);this[_0x1ea4('0x1b')]=utils[_0x1ea4('0x1c')](_0x41295f[_0x1ea4('0x17')],_0x41295f[_0x1ea4('0x16')]);this['talktime']=utils[_0x1ea4('0x1c')](this[_0x1ea4('0x18')],_0x41295f[_0x1ea4('0x17')]);this[_0x1ea4('0x8')]=_0x3a272c[_0x1ea4('0x8')];this[_0x1ea4('0x1d')]=_0x3a272c[_0x1ea4('0x1d')];this[_0x1ea4('0x1e')]=_0x3a272c[_0x1ea4('0x1e')];this[_0x1ea4('0x1f')]=_0x41295f[_0x1ea4('0x1f')];this[_0x1ea4('0x20')]=_0x41295f[_0x1ea4('0x20')];this[_0x1ea4('0x21')]=_0x41295f[_0x1ea4('0x21')];this['recallme']=_0x41295f[_0x1ea4('0x22')];this['ContactId']=_0x41295f[_0x1ea4('0x23')];this[_0x1ea4('0x24')]=_0x41295f[_0x1ea4('0x24')];this['UserId']=_0x41295f['UserId'];this[_0x1ea4('0x25')]=_0x41295f[_0x1ea4('0x25')];this['CampaignId']=_0x41295f[_0x1ea4('0x26')];this[_0x1ea4('0x27')]=_0x41295f[_0x1ea4('0x27')]||'';this[_0x1ea4('0x28')]=_0x41295f[_0x1ea4('0x28')]||'';this[_0x1ea4('0x29')]=_0x41295f[_0x1ea4('0x29')];}module[_0x1ea4('0x2a')]=AgentComplete; \ No newline at end of file +var _0x6d03=['originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','Answer','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x327c92,_0x5b6d4c){var _0x48b572=function(_0x624621){while(--_0x624621){_0x327c92['push'](_0x327c92['shift']());}};_0x48b572(++_0x5b6d4c);}(_0x6d03,0xb4));var _0x36d0=function(_0x542201,_0x546330){_0x542201=_0x542201-0x0;var _0x395954=_0x6d03[_0x542201];return _0x395954;};'use strict';var moment=require('moment');var utils=require(_0x36d0('0x0'));function AgentComplete(_0x1ec0e7,_0x4f6135){this[_0x36d0('0x1')]=0x4;this[_0x36d0('0x2')]=_0x36d0('0x3');this['scheduledat']=_0x1ec0e7[_0x36d0('0x4')];this[_0x36d0('0x5')]=_0x1ec0e7[_0x36d0('0x5')];this['campaigntype']=_0x1ec0e7['type']==='outbound'?_0x36d0('0x6'):_0x1ec0e7[_0x36d0('0x5')];this[_0x36d0('0x7')]=_0x1ec0e7[_0x36d0('0x7')];this[_0x36d0('0x8')]=_0x1ec0e7[_0x36d0('0x8')];this['countnoanswerretry']=_0x1ec0e7[_0x36d0('0x9')];this[_0x36d0('0xa')]=_0x1ec0e7[_0x36d0('0x7')]+_0x1ec0e7['countcongestionretry']+_0x1ec0e7['countnoanswerretry']+_0x1ec0e7[_0x36d0('0xb')]+_0x1ec0e7[_0x36d0('0xc')]+_0x1ec0e7['countabandonedretry']+_0x1ec0e7[_0x36d0('0xd')]+_0x1ec0e7[_0x36d0('0xe')];this[_0x36d0('0xb')]=_0x1ec0e7[_0x36d0('0xb')];this[_0x36d0('0xc')]=_0x1ec0e7['countdropretry'];this[_0x36d0('0xf')]=_0x1ec0e7[_0x36d0('0xf')];this[_0x36d0('0xd')]=_0x1ec0e7[_0x36d0('0xd')];this[_0x36d0('0xe')]=_0x1ec0e7[_0x36d0('0xe')];this[_0x36d0('0x10')]=_0x4f6135[_0x36d0('0x10')];this[_0x36d0('0x11')]=_0x1ec0e7[_0x36d0('0x12')];this['calleridnum']=_0x1ec0e7['number'];this['starttime']=_0x1ec0e7[_0x36d0('0x13')];this[_0x36d0('0x14')]=_0x1ec0e7['responsetime'];this['answertime']=_0x1ec0e7[_0x36d0('0x15')];this[_0x36d0('0x16')]=moment()[_0x36d0('0x17')](_0x36d0('0x18'));this[_0x36d0('0x19')]=utils[_0x36d0('0x1a')](_0x1ec0e7[_0x36d0('0x14')],_0x1ec0e7[_0x36d0('0x13')]);this[_0x36d0('0x1b')]=utils[_0x36d0('0x1a')](_0x1ec0e7[_0x36d0('0x15')],_0x1ec0e7['responsetime']);this[_0x36d0('0x1c')]=utils[_0x36d0('0x1a')](this[_0x36d0('0x16')],_0x1ec0e7[_0x36d0('0x15')]);this[_0x36d0('0x6')]=_0x4f6135['queue'];this[_0x36d0('0x1d')]=_0x4f6135[_0x36d0('0x1d')];this[_0x36d0('0x1e')]=_0x4f6135[_0x36d0('0x1e')];this['callback']=_0x1ec0e7[_0x36d0('0x1f')];this[_0x36d0('0x20')]=_0x1ec0e7[_0x36d0('0x20')];this['callbackat']=_0x1ec0e7[_0x36d0('0x21')];this[_0x36d0('0x22')]=_0x1ec0e7[_0x36d0('0x22')];this['ContactId']=_0x1ec0e7[_0x36d0('0x23')];this[_0x36d0('0x24')]=_0x1ec0e7[_0x36d0('0x24')];this['UserId']=_0x1ec0e7[_0x36d0('0x25')];this[_0x36d0('0x26')]=_0x1ec0e7[_0x36d0('0x26')];this[_0x36d0('0x27')]=_0x1ec0e7[_0x36d0('0x27')];this[_0x36d0('0x28')]=_0x1ec0e7['originatecalleridnum']||'';this[_0x36d0('0x29')]=_0x1ec0e7['originatecalleridname']||'';this[_0x36d0('0x2a')]=_0x1ec0e7[_0x36d0('0x2a')];}module[_0x36d0('0x2b')]=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 58b05bb..e60ada0 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 _0x3b81=['uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports'];(function(_0x179e0d,_0x592109){var _0x3f1bc5=function(_0x31a86a){while(--_0x31a86a){_0x179e0d['push'](_0x179e0d['shift']());}};_0x3f1bc5(++_0x592109);}(_0x3b81,0xee));var _0x13b8=function(_0x25c5bf,_0xb5e5de){_0x25c5bf=_0x25c5bf-0x0;var _0x53fe2e=_0x3b81[_0x25c5bf];return _0x53fe2e;};'use strict';function Final(_0x2910d7){this[_0x13b8('0x0')]=_0x2910d7['uniqueid'];this[_0x13b8('0x1')]=_0x2910d7[_0x13b8('0x1')];this[_0x13b8('0x2')]=_0x2910d7[_0x13b8('0x2')];this[_0x13b8('0x3')]=_0x2910d7[_0x13b8('0x2')]==='outbound'?_0x13b8('0x4'):_0x2910d7['type'];this[_0x13b8('0x5')]=_0x2910d7['countbusyretry'];this[_0x13b8('0x6')]=_0x2910d7[_0x13b8('0x6')];this['countnoanswerretry']=_0x2910d7[_0x13b8('0x7')];this[_0x13b8('0x8')]=_0x2910d7[_0x13b8('0x5')]+_0x2910d7[_0x13b8('0x6')]+_0x2910d7[_0x13b8('0x7')]+_0x2910d7[_0x13b8('0x9')]+_0x2910d7[_0x13b8('0xa')]+_0x2910d7['countabandonedretry']+_0x2910d7[_0x13b8('0xb')]+_0x2910d7[_0x13b8('0xc')];this[_0x13b8('0x9')]=_0x2910d7[_0x13b8('0x9')];this[_0x13b8('0xa')]=_0x2910d7[_0x13b8('0xa')];this[_0x13b8('0xd')]=_0x2910d7[_0x13b8('0xd')];this[_0x13b8('0xb')]=_0x2910d7['countmachineretry'];this[_0x13b8('0xc')]=_0x2910d7[_0x13b8('0xc')];this['queue']=_0x2910d7['queue'];this[_0x13b8('0xe')]=_0x2910d7[_0x13b8('0xe')];this['calleridnum']=_0x2910d7['calleridnum'];this[_0x13b8('0xf')]=_0x2910d7[_0x13b8('0xf')];this['responsetime']=_0x2910d7[_0x13b8('0x10')];this[_0x13b8('0x11')]=_0x2910d7[_0x13b8('0x10')];this['ringtime']=_0x2910d7[_0x13b8('0x12')]||0x0;this[_0x13b8('0x13')]=_0x2910d7[_0x13b8('0x13')]||0x0;this[_0x13b8('0x14')]=_0x2910d7[_0x13b8('0x14')]||0x0;this[_0x13b8('0x15')]=_0x2910d7[_0x13b8('0x15')];this[_0x13b8('0x16')]=_0x2910d7[_0x13b8('0x16')];this['callbackat']=_0x2910d7['callbackat'];this[_0x13b8('0x17')]=_0x2910d7['recallme'];this[_0x13b8('0x18')]=_0x2910d7[_0x13b8('0x18')];this[_0x13b8('0x19')]=_0x2910d7['ListId'];this['UserId']=_0x2910d7[_0x13b8('0x1a')];this[_0x13b8('0x1b')]=_0x2910d7['VoiceQueueId'];this[_0x13b8('0x1c')]=_0x2910d7[_0x13b8('0x1c')];this[_0x13b8('0x1d')]=_0x2910d7[_0x13b8('0x1d')]||'';this[_0x13b8('0x1e')]=_0x2910d7[_0x13b8('0x1e')]||'';this[_0x13b8('0x1f')]=_0x2910d7[_0x13b8('0x1f')];this[_0x13b8('0x20')]=_0x2910d7[_0x13b8('0x20')];}module[_0x13b8('0x21')]=Final; \ No newline at end of file +var _0xd84e=['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','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xd84e,0x7b));var _0xed84=function(_0x49ef32,_0x2864c1){_0x49ef32=_0x49ef32-0x0;var _0x49a18a=_0xd84e[_0x49ef32];return _0x49a18a;};'use strict';function Final(_0x4d02bf){this[_0xed84('0x0')]=_0x4d02bf[_0xed84('0x0')];this[_0xed84('0x1')]=_0x4d02bf[_0xed84('0x1')];this[_0xed84('0x2')]=_0x4d02bf[_0xed84('0x2')];this[_0xed84('0x3')]=_0x4d02bf[_0xed84('0x2')]===_0xed84('0x4')?_0xed84('0x5'):_0x4d02bf[_0xed84('0x2')];this[_0xed84('0x6')]=_0x4d02bf[_0xed84('0x6')];this[_0xed84('0x7')]=_0x4d02bf[_0xed84('0x7')];this[_0xed84('0x8')]=_0x4d02bf[_0xed84('0x8')];this[_0xed84('0x9')]=_0x4d02bf[_0xed84('0x6')]+_0x4d02bf[_0xed84('0x7')]+_0x4d02bf['countnoanswerretry']+_0x4d02bf[_0xed84('0xa')]+_0x4d02bf[_0xed84('0xb')]+_0x4d02bf[_0xed84('0xc')]+_0x4d02bf['countmachineretry']+_0x4d02bf['countagentrejectretry'];this['countnosuchnumberretry']=_0x4d02bf[_0xed84('0xa')];this[_0xed84('0xb')]=_0x4d02bf['countdropretry'];this[_0xed84('0xc')]=_0x4d02bf['countabandonedretry'];this[_0xed84('0xd')]=_0x4d02bf[_0xed84('0xd')];this[_0xed84('0xe')]=_0x4d02bf['countagentrejectretry'];this[_0xed84('0x5')]=_0x4d02bf[_0xed84('0x5')];this[_0xed84('0xf')]=_0x4d02bf['calleridname'];this[_0xed84('0x10')]=_0x4d02bf['calleridnum'];this[_0xed84('0x11')]=_0x4d02bf[_0xed84('0x11')];this['responsetime']=_0x4d02bf[_0xed84('0x12')];this[_0xed84('0x13')]=_0x4d02bf[_0xed84('0x12')];this['ringtime']=_0x4d02bf[_0xed84('0x14')]||0x0;this[_0xed84('0x15')]=_0x4d02bf['holdtime']||0x0;this[_0xed84('0x16')]=_0x4d02bf[_0xed84('0x16')]||0x0;this[_0xed84('0x17')]=_0x4d02bf[_0xed84('0x17')];this['callbackuniqueid']=_0x4d02bf[_0xed84('0x18')];this[_0xed84('0x19')]=_0x4d02bf[_0xed84('0x19')];this[_0xed84('0x1a')]=_0x4d02bf[_0xed84('0x1a')];this[_0xed84('0x1b')]=_0x4d02bf['ContactId'];this[_0xed84('0x1c')]=_0x4d02bf['ListId'];this[_0xed84('0x1d')]=_0x4d02bf['UserId'];this[_0xed84('0x1e')]=_0x4d02bf[_0xed84('0x1e')];this[_0xed84('0x1f')]=_0x4d02bf[_0xed84('0x1f')];this[_0xed84('0x20')]=_0x4d02bf[_0xed84('0x20')]||'';this[_0xed84('0x21')]=_0x4d02bf[_0xed84('0x21')]||'';this[_0xed84('0x22')]=_0x4d02bf[_0xed84('0x22')];this[_0xed84('0x23')]=_0x4d02bf[_0xed84('0x23')];}module[_0xed84('0x24')]=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 2072e68..790524e 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 _0x6648=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','ringtime','getSeconds','responsetime','talktime','endtime','membername','IVR','reason','cause-txt'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6648,0xe1));var _0x8664=function(_0x24d747,_0x290acd){_0x24d747=_0x24d747-0x0;var _0x433804=_0x6648[_0x24d747];return _0x433804;};'use strict';var moment=require(_0x8664('0x0'));var utils=require(_0x8664('0x1'));function Hangup(_0xde7952,_0x29320e){this[_0x8664('0x2')]=0x4;this[_0x8664('0x3')]=_0x8664('0x4');this[_0x8664('0x5')]=_0xde7952['scheduledat'];this[_0x8664('0x6')]=_0xde7952[_0x8664('0x6')];this[_0x8664('0x7')]=_0xde7952[_0x8664('0x6')]===_0x8664('0x8')?_0x8664('0x9'):_0xde7952[_0x8664('0x6')];this[_0x8664('0xa')]=_0xde7952[_0x8664('0xa')]||![];this[_0x8664('0xb')]=_0xde7952[_0x8664('0xb')];this[_0x8664('0xc')]=_0xde7952[_0x8664('0xc')];this[_0x8664('0xd')]=_0xde7952[_0x8664('0xd')];this['countglobal']=_0xde7952['countbusyretry']+_0xde7952['countcongestionretry']+_0xde7952['countnoanswerretry']+_0xde7952[_0x8664('0xe')]+_0xde7952[_0x8664('0xf')]+_0xde7952[_0x8664('0x10')]+_0xde7952['countmachineretry']+_0xde7952[_0x8664('0x11')];this[_0x8664('0xe')]=_0xde7952[_0x8664('0xe')];this['countdropretry']=_0xde7952['countdropretry'];this['countabandonedretry']=_0xde7952[_0x8664('0x10')];this[_0x8664('0x12')]=_0xde7952[_0x8664('0x12')];this[_0x8664('0x11')]=_0xde7952[_0x8664('0x11')];this[_0x8664('0x13')]=_0x29320e['uniqueid'];this['calleridname']=_0xde7952[_0x8664('0x14')];this[_0x8664('0x15')]=_0xde7952[_0x8664('0x16')];this[_0x8664('0x17')]=_0xde7952[_0x8664('0x17')];this['responsetime']=_0xde7952['responsetime'];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x8664('0x18')]=utils[_0x8664('0x19')](_0xde7952[_0x8664('0x1a')],_0xde7952[_0x8664('0x17')]);this['holdtime']=0x0;this[_0x8664('0x1b')]=utils[_0x8664('0x19')](this[_0x8664('0x1c')],_0xde7952[_0x8664('0x1a')]);this['queue']=_0xde7952[_0x8664('0x9')];this[_0x8664('0x1d')]=_0x8664('0x1e');this[_0x8664('0x1f')]=_0x29320e[_0x8664('0x20')];this[_0x8664('0x21')]=_0xde7952['callback'];this['callbackuniqueid']=_0xde7952[_0x8664('0x22')];this[_0x8664('0x23')]=_0xde7952[_0x8664('0x23')];this[_0x8664('0x24')]=_0xde7952[_0x8664('0x24')];this[_0x8664('0x25')]=_0xde7952[_0x8664('0x25')];this[_0x8664('0x26')]=_0xde7952['ListId'];this[_0x8664('0x27')]=_0xde7952[_0x8664('0x27')];this[_0x8664('0x28')]=_0xde7952[_0x8664('0x28')];this[_0x8664('0x29')]=_0xde7952[_0x8664('0x29')];}module[_0x8664('0x2a')]=Hangup; \ No newline at end of file +var _0xd0b6=['campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0xd0b6,0x134));var _0x6d0b=function(_0x510347,_0xdf770a){_0x510347=_0x510347-0x0;var _0x5cb84f=_0xd0b6[_0x510347];return _0x5cb84f;};'use strict';var moment=require(_0x6d0b('0x0'));var utils=require(_0x6d0b('0x1'));function Hangup(_0x42f407,_0x5e062c){this[_0x6d0b('0x2')]=0x4;this[_0x6d0b('0x3')]=_0x6d0b('0x4');this[_0x6d0b('0x5')]=_0x42f407['scheduledat'];this['type']=_0x42f407[_0x6d0b('0x6')];this[_0x6d0b('0x7')]=_0x42f407[_0x6d0b('0x6')]===_0x6d0b('0x8')?_0x6d0b('0x9'):_0x42f407[_0x6d0b('0x6')];this[_0x6d0b('0xa')]=_0x42f407['amd']||![];this[_0x6d0b('0xb')]=_0x42f407['countbusyretry'];this[_0x6d0b('0xc')]=_0x42f407[_0x6d0b('0xc')];this['countnoanswerretry']=_0x42f407[_0x6d0b('0xd')];this[_0x6d0b('0xe')]=_0x42f407[_0x6d0b('0xb')]+_0x42f407[_0x6d0b('0xc')]+_0x42f407[_0x6d0b('0xd')]+_0x42f407[_0x6d0b('0xf')]+_0x42f407[_0x6d0b('0x10')]+_0x42f407['countabandonedretry']+_0x42f407[_0x6d0b('0x11')]+_0x42f407[_0x6d0b('0x12')];this['countnosuchnumberretry']=_0x42f407[_0x6d0b('0xf')];this['countdropretry']=_0x42f407[_0x6d0b('0x10')];this['countabandonedretry']=_0x42f407[_0x6d0b('0x13')];this['countmachineretry']=_0x42f407['countmachineretry'];this[_0x6d0b('0x12')]=_0x42f407[_0x6d0b('0x12')];this[_0x6d0b('0x14')]=_0x5e062c[_0x6d0b('0x14')];this[_0x6d0b('0x15')]=_0x42f407[_0x6d0b('0x16')];this['calleridnum']=_0x42f407[_0x6d0b('0x17')];this[_0x6d0b('0x18')]=_0x42f407[_0x6d0b('0x18')];this['responsetime']=_0x42f407[_0x6d0b('0x19')];this[_0x6d0b('0x1a')]=moment()['format'](_0x6d0b('0x1b'));this[_0x6d0b('0x1c')]=utils[_0x6d0b('0x1d')](_0x42f407[_0x6d0b('0x19')],_0x42f407[_0x6d0b('0x18')]);this[_0x6d0b('0x1e')]=0x0;this['talktime']=utils[_0x6d0b('0x1d')](this['endtime'],_0x42f407[_0x6d0b('0x19')]);this[_0x6d0b('0x9')]=_0x42f407[_0x6d0b('0x9')];this[_0x6d0b('0x1f')]=_0x6d0b('0x20');this[_0x6d0b('0x21')]=_0x5e062c[_0x6d0b('0x22')];this[_0x6d0b('0x23')]=_0x42f407[_0x6d0b('0x23')];this[_0x6d0b('0x24')]=_0x42f407[_0x6d0b('0x24')];this[_0x6d0b('0x25')]=_0x42f407[_0x6d0b('0x25')];this[_0x6d0b('0x26')]=_0x42f407[_0x6d0b('0x26')];this[_0x6d0b('0x27')]=_0x42f407[_0x6d0b('0x27')];this[_0x6d0b('0x28')]=_0x42f407[_0x6d0b('0x28')];this[_0x6d0b('0x29')]=_0x42f407['UserId'];this[_0x6d0b('0x2a')]=_0x42f407[_0x6d0b('0x2a')];this[_0x6d0b('0x2b')]=_0x42f407[_0x6d0b('0x2b')];}module[_0x6d0b('0x2c')]=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 a28f38a..d3ac530 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 _0xdd5a=['responsetime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','number','starttime'];(function(_0x4b461d,_0x1afb32){var _0x281da5=function(_0x2d0002){while(--_0x2d0002){_0x4b461d['push'](_0x4b461d['shift']());}};_0x281da5(++_0x1afb32);}(_0xdd5a,0x9d));var _0xadd5=function(_0x176ec4,_0x3c5d01){_0x176ec4=_0x176ec4-0x0;var _0x2f8fa8=_0xdd5a[_0x176ec4];return _0x2f8fa8;};'use strict';var utils=require(_0xadd5('0x0'));function History(_0x3dff20){this[_0xadd5('0x1')]=_0x3dff20[_0xadd5('0x1')];this[_0xadd5('0x2')]=_0x3dff20[_0xadd5('0x2')]||undefined;this[_0xadd5('0x3')]=_0x3dff20[_0xadd5('0x3')];this[_0xadd5('0x4')]=_0x3dff20[_0xadd5('0x3')]==='outbound'?_0xadd5('0x5'):_0x3dff20['type'];this[_0xadd5('0x6')]=_0x3dff20[_0xadd5('0x6')];this[_0xadd5('0x7')]=_0x3dff20['countcongestionretry'];this['countnoanswerretry']=_0x3dff20[_0xadd5('0x8')];this['countglobal']=_0x3dff20['countbusyretry']+_0x3dff20[_0xadd5('0x7')]+_0x3dff20['countnoanswerretry']+_0x3dff20[_0xadd5('0x9')]+_0x3dff20[_0xadd5('0xa')]+_0x3dff20[_0xadd5('0xb')]+_0x3dff20[_0xadd5('0xc')]+_0x3dff20['countagentrejectretry'];this[_0xadd5('0x9')]=_0x3dff20[_0xadd5('0x9')];this['countdropretry']=_0x3dff20[_0xadd5('0xa')];this[_0xadd5('0xb')]=_0x3dff20[_0xadd5('0xb')];this[_0xadd5('0xc')]=_0x3dff20[_0xadd5('0xc')];this['countagentrejectretry']=_0x3dff20['countagentrejectretry'];this['queue']=_0x3dff20['queue'];this[_0xadd5('0xd')]=_0x3dff20[_0xadd5('0xe')];this[_0xadd5('0xf')]=_0x3dff20[_0xadd5('0x10')];this['starttime']=_0x3dff20[_0xadd5('0x11')];this[_0xadd5('0x12')]=_0x3dff20[_0xadd5('0x12')];this['endtime']=_0x3dff20[_0xadd5('0x12')];this[_0xadd5('0x13')]=utils[_0xadd5('0x14')](_0x3dff20[_0xadd5('0x12')],_0x3dff20[_0xadd5('0x11')]);this['holdtime']=0x0;this[_0xadd5('0x15')]=0x0;this[_0xadd5('0x16')]=_0x3dff20[_0xadd5('0x16')];this[_0xadd5('0x17')]=_0x3dff20[_0xadd5('0x17')];this['callbackat']=_0x3dff20[_0xadd5('0x18')];this[_0xadd5('0x19')]=_0x3dff20[_0xadd5('0x19')];this[_0xadd5('0x1a')]=_0x3dff20[_0xadd5('0x1a')];this[_0xadd5('0x1b')]=_0x3dff20[_0xadd5('0x1b')];this['UserId']=_0x3dff20[_0xadd5('0x1c')];this['VoiceQueueId']=_0x3dff20[_0xadd5('0x1d')];this[_0xadd5('0x1e')]=_0x3dff20[_0xadd5('0x1e')];this[_0xadd5('0x1f')]=_0x3dff20[_0xadd5('0x1f')]||'';this['originatecalleridname']=_0x3dff20[_0xadd5('0x20')]||'';this['state']=_0x3dff20[_0xadd5('0x21')];this[_0xadd5('0x22')]=_0x3dff20[_0xadd5('0x22')];}module['exports']=History; \ No newline at end of file +var _0x5b6e=['countglobal','countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','endtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x5d82ca,_0x41de04){var _0x40a3e1=function(_0x507ae5){while(--_0x507ae5){_0x5d82ca['push'](_0x5d82ca['shift']());}};_0x40a3e1(++_0x41de04);}(_0x5b6e,0x66));var _0xe5b6=function(_0x543932,_0x4a4900){_0x543932=_0x543932-0x0;var _0x36a5cf=_0x5b6e[_0x543932];return _0x36a5cf;};'use strict';var utils=require(_0xe5b6('0x0'));function History(_0x24102f){this['uniqueid']=_0x24102f[_0xe5b6('0x1')];this[_0xe5b6('0x2')]=_0x24102f[_0xe5b6('0x2')]||undefined;this[_0xe5b6('0x3')]=_0x24102f['type'];this['campaigntype']=_0x24102f[_0xe5b6('0x3')]===_0xe5b6('0x4')?_0xe5b6('0x5'):_0x24102f[_0xe5b6('0x3')];this[_0xe5b6('0x6')]=_0x24102f[_0xe5b6('0x6')];this[_0xe5b6('0x7')]=_0x24102f[_0xe5b6('0x7')];this[_0xe5b6('0x8')]=_0x24102f[_0xe5b6('0x8')];this[_0xe5b6('0x9')]=_0x24102f[_0xe5b6('0x6')]+_0x24102f[_0xe5b6('0x7')]+_0x24102f[_0xe5b6('0x8')]+_0x24102f[_0xe5b6('0xa')]+_0x24102f['countdropretry']+_0x24102f['countabandonedretry']+_0x24102f[_0xe5b6('0xb')]+_0x24102f['countagentrejectretry'];this['countnosuchnumberretry']=_0x24102f[_0xe5b6('0xa')];this['countdropretry']=_0x24102f[_0xe5b6('0xc')];this[_0xe5b6('0xd')]=_0x24102f[_0xe5b6('0xd')];this['countmachineretry']=_0x24102f[_0xe5b6('0xb')];this[_0xe5b6('0xe')]=_0x24102f['countagentrejectretry'];this['queue']=_0x24102f[_0xe5b6('0x5')];this['calleridname']=_0x24102f[_0xe5b6('0xf')];this[_0xe5b6('0x10')]=_0x24102f[_0xe5b6('0x11')];this[_0xe5b6('0x12')]=_0x24102f['starttime'];this[_0xe5b6('0x13')]=_0x24102f[_0xe5b6('0x13')];this[_0xe5b6('0x14')]=_0x24102f[_0xe5b6('0x13')];this['ringtime']=utils[_0xe5b6('0x15')](_0x24102f[_0xe5b6('0x13')],_0x24102f[_0xe5b6('0x12')]);this[_0xe5b6('0x16')]=0x0;this[_0xe5b6('0x17')]=0x0;this[_0xe5b6('0x18')]=_0x24102f[_0xe5b6('0x18')];this[_0xe5b6('0x19')]=_0x24102f[_0xe5b6('0x19')];this['callbackat']=_0x24102f[_0xe5b6('0x1a')];this[_0xe5b6('0x1b')]=_0x24102f[_0xe5b6('0x1b')];this['ContactId']=_0x24102f['ContactId'];this[_0xe5b6('0x1c')]=_0x24102f[_0xe5b6('0x1c')];this['UserId']=_0x24102f[_0xe5b6('0x1d')];this['VoiceQueueId']=_0x24102f[_0xe5b6('0x1e')];this[_0xe5b6('0x1f')]=_0x24102f[_0xe5b6('0x1f')];this[_0xe5b6('0x20')]=_0x24102f[_0xe5b6('0x20')]||'';this[_0xe5b6('0x21')]=_0x24102f['originatecalleridname']||'';this[_0xe5b6('0x22')]=_0x24102f[_0xe5b6('0x22')];this[_0xe5b6('0x23')]=_0x24102f[_0xe5b6('0x23')];}module[_0xe5b6('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 2e46823..5a393a7 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 _0xaa5b=['exports','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xaa5b,0xfd));var _0xbaa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa5b[_0x14add3];return _0x4a174f;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x2add49,_0x4c4249){this[_0xbaa5('0x0')]=_0x2add49[_0xbaa5('0x0')];this['type']=_0x2add49['type'];this[_0xbaa5('0x1')]=_0x2add49[_0xbaa5('0x2')]===_0xbaa5('0x3')?_0xbaa5('0x4'):_0x2add49[_0xbaa5('0x2')];this['countbusyretry']=_0x2add49[_0xbaa5('0x5')];this['countcongestionretry']=_0x2add49['countcongestionretry'];this[_0xbaa5('0x6')]=_0x2add49[_0xbaa5('0x6')];this['countglobal']=_0x2add49[_0xbaa5('0x5')]+_0x2add49['countcongestionretry']+_0x2add49['countnoanswerretry']+_0x2add49[_0xbaa5('0x7')]+_0x2add49[_0xbaa5('0x8')]+_0x2add49['countabandonedretry']+_0x2add49[_0xbaa5('0x9')]+_0x2add49[_0xbaa5('0xa')];this[_0xbaa5('0x7')]=_0x2add49[_0xbaa5('0x7')];this['countdropretry']=_0x2add49['countdropretry'];this['countabandonedretry']=_0x2add49['countabandonedretry'];this['countmachineretry']=_0x2add49[_0xbaa5('0x9')];this[_0xbaa5('0xa')]=_0x2add49[_0xbaa5('0xa')];this[_0xbaa5('0xb')]=_0x4c4249[_0xbaa5('0xb')];this[_0xbaa5('0xc')]=_0x2add49[_0xbaa5('0xd')];this['calleridnum']=_0x2add49[_0xbaa5('0xe')];this[_0xbaa5('0xf')]=_0x2add49[_0xbaa5('0xf')];this[_0xbaa5('0x10')]=_0x2add49[_0xbaa5('0x10')];this[_0xbaa5('0x11')]=_0x2add49[_0xbaa5('0x11')];this[_0xbaa5('0x12')]=_0x2add49[_0xbaa5('0x12')];this[_0xbaa5('0x13')]=this[_0xbaa5('0x11')];this[_0xbaa5('0x14')]=utils[_0xbaa5('0x15')](_0x2add49['responsetime'],_0x2add49[_0xbaa5('0xf')]);this[_0xbaa5('0x16')]=utils[_0xbaa5('0x15')](this[_0xbaa5('0x11')],_0x2add49[_0xbaa5('0x10')]);this[_0xbaa5('0x17')]=0x0;this[_0xbaa5('0x4')]=_0x4c4249[_0xbaa5('0x4')];this[_0xbaa5('0x18')]=_0x4c4249[_0xbaa5('0x19')];this[_0xbaa5('0x1a')]=_0x4c4249['reason'];this[_0xbaa5('0x1b')]=_0x2add49['callback'];this[_0xbaa5('0x1c')]=_0x2add49[_0xbaa5('0x1c')];this[_0xbaa5('0x1d')]=_0x2add49[_0xbaa5('0x1d')];this[_0xbaa5('0x1e')]=_0x2add49[_0xbaa5('0x1e')];this[_0xbaa5('0x1f')]=_0x2add49['ContactId'];this[_0xbaa5('0x20')]=_0x2add49[_0xbaa5('0x20')];this[_0xbaa5('0x21')]=_0x2add49[_0xbaa5('0x21')];this[_0xbaa5('0x22')]=_0x2add49[_0xbaa5('0x22')];this[_0xbaa5('0x23')]=_0x2add49[_0xbaa5('0x23')];this[_0xbaa5('0x24')]=_0x2add49[_0xbaa5('0x24')]||'';this[_0xbaa5('0x25')]=_0x2add49[_0xbaa5('0x25')]||'';this['agiafterat']=_0x2add49[_0xbaa5('0x26')];this[_0xbaa5('0x27')]=_0x2add49['state'];this[_0xbaa5('0x28')]=_0x2add49[_0xbaa5('0x28')];}module[_0xbaa5('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xf2d7=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','type','campaigntype','outbound','queue'];(function(_0x3fb2ee,_0x154bc8){var _0x4b9ad5=function(_0x2d2fa){while(--_0x2d2fa){_0x3fb2ee['push'](_0x3fb2ee['shift']());}};_0x4b9ad5(++_0x154bc8);}(_0xf2d7,0x15a));var _0x7f2d=function(_0x385aa6,_0x45f973){_0x385aa6=_0x385aa6-0x0;var _0x2e1305=_0xf2d7[_0x385aa6];return _0x2e1305;};'use strict';var utils=require(_0x7f2d('0x0'));function QueueCallerAbandon(_0xde98c2,_0x2215ac){this['scheduledat']=_0xde98c2['scheduledat'];this['type']=_0xde98c2[_0x7f2d('0x1')];this[_0x7f2d('0x2')]=_0xde98c2[_0x7f2d('0x1')]===_0x7f2d('0x3')?_0x7f2d('0x4'):_0xde98c2[_0x7f2d('0x1')];this[_0x7f2d('0x5')]=_0xde98c2[_0x7f2d('0x5')];this[_0x7f2d('0x6')]=_0xde98c2[_0x7f2d('0x6')];this[_0x7f2d('0x7')]=_0xde98c2[_0x7f2d('0x7')];this[_0x7f2d('0x8')]=_0xde98c2[_0x7f2d('0x5')]+_0xde98c2['countcongestionretry']+_0xde98c2['countnoanswerretry']+_0xde98c2['countnosuchnumberretry']+_0xde98c2[_0x7f2d('0x9')]+_0xde98c2[_0x7f2d('0xa')]+_0xde98c2['countmachineretry']+_0xde98c2[_0x7f2d('0xb')];this[_0x7f2d('0xc')]=_0xde98c2[_0x7f2d('0xc')];this['countdropretry']=_0xde98c2[_0x7f2d('0x9')];this[_0x7f2d('0xa')]=_0xde98c2[_0x7f2d('0xa')];this[_0x7f2d('0xd')]=_0xde98c2[_0x7f2d('0xd')];this['countagentrejectretry']=_0xde98c2[_0x7f2d('0xb')];this['uniqueid']=_0x2215ac['uniqueid'];this[_0x7f2d('0xe')]=_0xde98c2[_0x7f2d('0xf')];this[_0x7f2d('0x10')]=_0xde98c2[_0x7f2d('0x11')];this[_0x7f2d('0x12')]=_0xde98c2['starttime'];this[_0x7f2d('0x13')]=_0xde98c2[_0x7f2d('0x13')];this['droptime']=_0xde98c2[_0x7f2d('0x14')];this['dropreason']=_0xde98c2[_0x7f2d('0x15')];this[_0x7f2d('0x16')]=this[_0x7f2d('0x14')];this['ringtime']=utils[_0x7f2d('0x17')](_0xde98c2[_0x7f2d('0x13')],_0xde98c2[_0x7f2d('0x12')]);this[_0x7f2d('0x18')]=utils[_0x7f2d('0x17')](this[_0x7f2d('0x14')],_0xde98c2[_0x7f2d('0x13')]);this['talktime']=0x0;this[_0x7f2d('0x4')]=_0x2215ac['queue'];this[_0x7f2d('0x19')]=_0x2215ac['connectedlinename'];this[_0x7f2d('0x1a')]=_0x2215ac['reason'];this['callback']=_0xde98c2['callback'];this['callbackuniqueid']=_0xde98c2[_0x7f2d('0x1b')];this['callbackat']=_0xde98c2[_0x7f2d('0x1c')];this['recallme']=_0xde98c2[_0x7f2d('0x1d')];this[_0x7f2d('0x1e')]=_0xde98c2[_0x7f2d('0x1e')];this[_0x7f2d('0x1f')]=_0xde98c2['ListId'];this[_0x7f2d('0x20')]=_0xde98c2[_0x7f2d('0x20')];this[_0x7f2d('0x21')]=_0xde98c2[_0x7f2d('0x21')];this[_0x7f2d('0x22')]=_0xde98c2[_0x7f2d('0x22')];this[_0x7f2d('0x23')]=_0xde98c2[_0x7f2d('0x23')]||'';this[_0x7f2d('0x24')]=_0xde98c2[_0x7f2d('0x24')]||'';this['agiafterat']=_0xde98c2['agiafterat'];this[_0x7f2d('0x25')]=_0xde98c2[_0x7f2d('0x25')];this[_0x7f2d('0x26')]=_0xde98c2[_0x7f2d('0x26')];}module['exports']=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 49ea10b..4cc3cf3 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 _0xda19=['getContactDialerIvr','[countReScheduled]','countReScheduled','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','../../../../config/logger','dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialerIvr]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda19,0xd5));var _0x9da1=function(_0x26e529,_0x5dcae1){_0x26e529=_0x26e529-0x0;var _0x419f69=_0xda19[_0x26e529];return _0x419f69;};'use strict';var util=require('util');var logger=require(_0x9da1('0x0'))(_0x9da1('0x1'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x9da1('0x2'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x9da1('0x3'));function inspectError(_0x4c9c86){return util[_0x9da1('0x4')](_0x4c9c86,{'showHidden':![],'depth':null});}function getContactDialer(_0xef6f5a,_0x3c5f54,_0x470043){return cmHopper[_0x9da1('0x5')](_0xef6f5a['id'],_0x3c5f54,_0x470043,_0xef6f5a[_0x9da1('0x6')])[_0x9da1('0x7')](function(_0x2c3cdd){_0xef6f5a[_0x9da1('0x8')]=0x0;logger[_0x9da1('0x9')]('[getContactDialer]',inspectError(_0x2c3cdd));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x4cb9f7,_0x417312){return cmHopper['getContactDialerIvr'](_0x4cb9f7['id'],_0x417312,_0x4cb9f7[_0x9da1('0x6')])[_0x9da1('0x7')](function(_0x3ba3d3){_0x4cb9f7[_0x9da1('0x8')]=0x0;logger[_0x9da1('0x9')](_0x9da1('0xa'),inspectError(_0x3ba3d3));});}exports[_0x9da1('0xb')]=getContactDialerIvr;function countReScheduled(_0x5807ec){return cmHopper['countReScheduled'](_0x5807ec)[_0x9da1('0x7')](function(_0x596b6b){logger[_0x9da1('0x9')](_0x9da1('0xc'),inspectError(_0x596b6b));});}exports[_0x9da1('0xd')]=countReScheduled;function rescheduleContact(_0x1ffa2a){return cmHopper['rescheduleContact'](_0x1ffa2a)[_0x9da1('0x7')](function(_0x535a13){logger['error'](_0x9da1('0xe'),inspectError(_0x535a13));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x433ff4,_0x43c093,_0x37653d){return cmHopper[_0x9da1('0xf')](_0x433ff4,_0x43c093,_0x37653d)[_0x9da1('0x7')](function(_0x514d8e){logger[_0x9da1('0x9')](_0x9da1('0x10'),inspectError(_0x514d8e));});}exports[_0x9da1('0xf')]=unlockContact;function moveContactManagedDialer(_0x77347a){return cmHopper[_0x9da1('0x11')](_0x77347a)[_0x9da1('0x7')](function(_0x497676){logger['error'](_0x9da1('0x12'),inspectError(_0x497676));});}exports[_0x9da1('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x1b0e7f){return cmHopperBlack[_0x9da1('0x13')](_0x1b0e7f)[_0x9da1('0x7')](function(_0x3b1645){logger[_0x9da1('0x9')]('[checkIsBlackList]',inspectError(_0x3b1645));});}exports[_0x9da1('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x554845){return cmHopperBlack[_0x9da1('0x14')](_0x554845)[_0x9da1('0x7')](function(_0x1fc065){logger['error']('[checkIsBlackListIvr]',inspectError(_0x1fc065));});}exports[_0x9da1('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3e6f85,_0x16ee0c,_0x330219){return cmHopperAdditionalPhone[_0x9da1('0x15')](_0x3e6f85,_0x16ee0c,_0x330219)[_0x9da1('0x7')](function(_0x4c60aa){logger[_0x9da1('0x9')](_0x9da1('0x16'),inspectError(_0x4c60aa));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x45fcce,_0x3f5680,_0x534210){return cmHopperAdditionalPhone[_0x9da1('0x17')](_0x45fcce,_0x3f5680,_0x534210)[_0x9da1('0x7')](function(_0x4b1152){logger[_0x9da1('0x9')](_0x9da1('0x18'),inspectError(_0x4b1152));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x5c09ed){return cmHopperHistory[_0x9da1('0x19')](_0x5c09ed)[_0x9da1('0x7')](function(_0x5eca5b){logger[_0x9da1('0x9')]('[avgHandleTime]',inspectError(_0x5eca5b));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x5a59c2){return cmHopperHistory[_0x9da1('0x1a')](_0x5a59c2)[_0x9da1('0x7')](function(_0x24c6d5){logger[_0x9da1('0x9')](_0x9da1('0x1b'),inspectError(_0x24c6d5));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0x4819=['[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','error','[getContactDialer]','dialOrderByScheduledAt','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','catch','rescheduleContact','[rescheduleContact]','unlockContact'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x4819,0xcd));var _0x9481=function(_0x3d6135,_0x256136){_0x3d6135=_0x3d6135-0x0;var _0x16f3c1=_0x4819[_0x3d6135];return _0x16f3c1;};'use strict';var util=require('util');var logger=require(_0x9481('0x0'))(_0x9481('0x1'));var cmHopper=require(_0x9481('0x2'));var cmHopperAdditionalPhone=require(_0x9481('0x3'));var cmHopperBlack=require(_0x9481('0x4'));var cmHopperHistory=require(_0x9481('0x5'));function inspectError(_0x40a703){return util[_0x9481('0x6')](_0x40a703,{'showHidden':![],'depth':null});}function getContactDialer(_0xc39edf,_0x16c617,_0x5ac51c){return cmHopper[_0x9481('0x7')](_0xc39edf['id'],_0x16c617,_0x5ac51c,_0xc39edf['dialOrderByScheduledAt'])['catch'](function(_0x14e05a){_0xc39edf[_0x9481('0x8')]=0x0;logger[_0x9481('0x9')](_0x9481('0xa'),inspectError(_0x14e05a));});}exports[_0x9481('0x7')]=getContactDialer;function getContactDialerIvr(_0x4c7d9c,_0x1818cf){return cmHopper['getContactDialerIvr'](_0x4c7d9c['id'],_0x1818cf,_0x4c7d9c[_0x9481('0xb')])['catch'](function(_0x411d24){_0x4c7d9c[_0x9481('0x8')]=0x0;logger[_0x9481('0x9')](_0x9481('0xc'),inspectError(_0x411d24));});}exports[_0x9481('0xd')]=getContactDialerIvr;function countReScheduled(_0x29515a){return cmHopper[_0x9481('0xe')](_0x29515a)[_0x9481('0xf')](function(_0xed8e9){logger['error']('[countReScheduled]',inspectError(_0xed8e9));});}exports[_0x9481('0xe')]=countReScheduled;function rescheduleContact(_0x150276){return cmHopper[_0x9481('0x10')](_0x150276)[_0x9481('0xf')](function(_0x3d23c2){logger[_0x9481('0x9')](_0x9481('0x11'),inspectError(_0x3d23c2));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x4220f1,_0x7a7ee,_0x5b1fe6){return cmHopper[_0x9481('0x12')](_0x4220f1,_0x7a7ee,_0x5b1fe6)['catch'](function(_0x34108d){logger[_0x9481('0x9')](_0x9481('0x13'),inspectError(_0x34108d));});}exports[_0x9481('0x12')]=unlockContact;function moveContactManagedDialer(_0x546fce){return cmHopper['moveContactManagedDialer'](_0x546fce)[_0x9481('0xf')](function(_0x50a559){logger['error'](_0x9481('0x14'),inspectError(_0x50a559));});}exports[_0x9481('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x18c6f5){return cmHopperBlack[_0x9481('0x16')](_0x18c6f5)[_0x9481('0xf')](function(_0x3dc33f){logger['error'](_0x9481('0x17'),inspectError(_0x3dc33f));});}exports[_0x9481('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x45f9df){return cmHopperBlack[_0x9481('0x18')](_0x45f9df)[_0x9481('0xf')](function(_0x56da97){logger[_0x9481('0x9')](_0x9481('0x19'),inspectError(_0x56da97));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2bcf37,_0xd1cd1a,_0x352b3a){return cmHopperAdditionalPhone[_0x9481('0x1a')](_0x2bcf37,_0xd1cd1a,_0x352b3a)[_0x9481('0xf')](function(_0x49ecfa){logger[_0x9481('0x9')](_0x9481('0x1b'),inspectError(_0x49ecfa));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x5eb4f5,_0x12b0c3,_0x299e28){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5eb4f5,_0x12b0c3,_0x299e28)[_0x9481('0xf')](function(_0x20ff9a){logger[_0x9481('0x9')](_0x9481('0x1c'),inspectError(_0x20ff9a));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x14f03e){return cmHopperHistory[_0x9481('0x1d')](_0x14f03e)[_0x9481('0xf')](function(_0x587706){logger[_0x9481('0x9')]('[avgHandleTime]',inspectError(_0x587706));});}exports[_0x9481('0x1d')]=avgHandleTime;function createHistory(_0xe153ab){return cmHopperHistory[_0x9481('0x1e')](_0xe153ab)[_0x9481('0xf')](function(_0x2e5e63){logger['error'](_0x9481('0x1f'),inspectError(_0x2e5e63));});}exports[_0x9481('0x1e')]=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 7fdb376..92ebddb 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 _0xfb3f=['isUndefined','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','format','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','createdAt','description','tags','undefined','%s%s','XMD-','toUpperCase','lodash','moment','util','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','name','Trunk','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','string'];(function(_0x41b792,_0x10480a){var _0x17894e=function(_0x548ab6){while(--_0x548ab6){_0x41b792['push'](_0x41b792['shift']());}};_0x17894e(++_0x10480a);}(_0xfb3f,0x1c9));var _0xffb3=function(_0x7dd8d3,_0x12e9d5){_0x7dd8d3=_0x7dd8d3-0x0;var _0x33c7e3=_0xfb3f[_0x7dd8d3];return _0x33c7e3;};'use strict';var _=require(_0xffb3('0x0'));var moment=require(_0xffb3('0x1'));var util=require(_0xffb3('0x2'));var logger=require('../../../../config/logger')('dialer');var timezones=require(_0xffb3('0x3'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xffb3('0x4'),'BLACKLIST':_0xffb3('0x5'),'CONTACTS_RESCHEDULED':_0xffb3('0x6'),'DEACTIVATED':_0xffb3('0x7'),'DISACTIVED':_0xffb3('0x8'),'EMPTY_INTERVAL':_0xffb3('0x9'),'INACTIVE':_0xffb3('0xa'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xffb3('0xb'),'NULL_INTERVAL':_0xffb3('0xc'),'OVERTIME_INTERVAL':_0xffb3('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xffb3('0xe'),'QUEUE_RECALL':_0xffb3('0xf'),'RECALL_TIMEOUT':_0xffb3('0x10'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xffb3('0x11')};exports[_0xffb3('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x38a7fc){return _0x38a7fc[_0xffb3('0x13')]===_0xffb3('0x14');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x9b0032){return _0x9b0032[_0xffb3('0x15')]===_0xffb3('0x16');}exports[_0xffb3('0x17')]=isIVRCampaign;function isOutboundQueue(_0x42bfc5){return _0x42bfc5[_0xffb3('0x15')]==='outbound';}exports[_0xffb3('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x5122e3){return _0x5122e3[_0xffb3('0x19')];}exports[_0xffb3('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x43e4b4){return _0x43e4b4[_0xffb3('0x1b')];}exports[_0xffb3('0x1c')]=isIVRCampaignActive;function getSeconds(_0x259fb4,_0x2d2042){var _0x5005d9=moment(_0x259fb4)[_0xffb3('0x1d')](0x0);var _0x56fb08=moment(_0x2d2042)['milliseconds'](0x0);return _0x5005d9['diff'](_0x56fb08,_0xffb3('0x1e'));}exports[_0xffb3('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x2ca8db,_0x3d0a69){var _0x33eed1=![];var _0x296918=_0x2ca8db[_0xffb3('0x13')]!==_0x3d0a69['dialMethod']||_0x2ca8db['dialActive']!==_0x3d0a69[_0xffb3('0x19')]||_0x2ca8db[_0xffb3('0x20')]!==_0x3d0a69[_0xffb3('0x20')];var _0x2358c4=_0x2ca8db['available']!==_0x3d0a69[_0xffb3('0x21')]||_0x2ca8db[_0xffb3('0x22')]!==_0x3d0a69[_0xffb3('0x22')]||_0x2ca8db[_0xffb3('0x23')]!==_0x3d0a69[_0xffb3('0x23')]||_0x2ca8db[_0xffb3('0x24')]!==_0x3d0a69[_0xffb3('0x24')]||_0x2ca8db[_0xffb3('0x25')]!==_0x3d0a69[_0xffb3('0x25')]||_0x2ca8db[_0xffb3('0x26')]!==_0x3d0a69[_0xffb3('0x26')]||_0x2ca8db[_0xffb3('0x27')]!==_0x3d0a69['waiting']||_0x2ca8db[_0xffb3('0x28')]!==_0x3d0a69[_0xffb3('0x28')]||_0x2ca8db[_0xffb3('0x29')]!==_0x3d0a69['originated'];if(_0x2ca8db['Trunk']&&_0x3d0a69['Trunk']){_0x33eed1=_0x2ca8db['Trunk'][_0xffb3('0x2a')]!==_0x3d0a69['Trunk']['name']||_0x2ca8db[_0xffb3('0x2b')][_0xffb3('0x1b')]!==_0x3d0a69[_0xffb3('0x2b')][_0xffb3('0x1b')];}return _0x296918||_0x2358c4||_0x33eed1;}exports[_0xffb3('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x22d428){var _0x1a038d=null;var _0x334c0e=_0x22d428[_0xffb3('0x2d')];if(_[_0xffb3('0x2e')](_0x22d428[_0xffb3('0x2f')])||_[_0xffb3('0x2e')](_0x22d428[_0xffb3('0x30')])||_['isNil'](_0x22d428[_0xffb3('0x30')][_0xffb3('0x31')])){_0x1a038d=CAMPAIGN_STATUS[_0xffb3('0x32')];}else if(_['isEmpty'](_0x22d428[_0xffb3('0x2f')])||_[_0xffb3('0x33')](_0x22d428['Interval']['Intervals'])){_0x1a038d=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x334c0e&&!timezones[_0x334c0e]){_0x1a038d=CAMPAIGN_STATUS[_0xffb3('0x34')];}return _0x1a038d;}function checkAnyValidTrunk(_0x529581,_0x2875fe){var _0x3f6ca7=null;var _0x1eb649=_0xffb3('0x35');var _0x2c47d1=[_0xffb3('0x36'),_0xffb3('0x37')];var _0x5c8e21=!![];if(_0x529581['Trunk']&&_0x529581[_0xffb3('0x2b')][_0xffb3('0x1b')]){_0x1eb649+=_0x529581[_0xffb3('0x2b')][_0xffb3('0x2a')];_0x3f6ca7=_0x2875fe[_0x1eb649];_0x5c8e21=_0x2c47d1[_0xffb3('0x38')](_0x3f6ca7[_0xffb3('0x39')]);}else if(_0x529581[_0xffb3('0x3a')]&&_0x529581[_0xffb3('0x3a')][_0xffb3('0x1b')]){_0x1eb649+=_0x529581[_0xffb3('0x3a')][_0xffb3('0x2a')];_0x3f6ca7=_0x2875fe[_0x1eb649];_0x5c8e21=_0x2c47d1[_0xffb3('0x38')](_0x3f6ca7[_0xffb3('0x39')]);}return _0x5c8e21;}function getQueueCampaignStatusMessage(_0xfb6d99,_0xcdf90c){var _0x40483b=CAMPAIGN_STATUS['ACTIVE'];var _0x59b70f=isPreviewCampaign(_0xfb6d99);if(!isQueueCampaignActive(_0xfb6d99)){if(_0x59b70f){_0x40483b=CAMPAIGN_STATUS[_0xffb3('0x3b')];}else{if(_0xfb6d99['originated']===0x0&&_0xfb6d99[_0xffb3('0x25')]===0x0&&_0xfb6d99[_0xffb3('0x27')]===0x0&&(_0xfb6d99['pTalking']||0x0)===0x0){_0x40483b=CAMPAIGN_STATUS[_0xffb3('0x3b')];}else{_0x40483b=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0xfb6d99['loggedIn']===0x0){_0x40483b=CAMPAIGN_STATUS[_0xffb3('0x3c')];}else if(!checkAnyValidTrunk(_0xfb6d99,_0xcdf90c)){_0x40483b=CAMPAIGN_STATUS[_0xffb3('0x3d')];}else if(!isPreviewCampaign(_0xfb6d99)){var _0x4b2d55=checkAnyValidQueueCampaignInterval(_0xfb6d99);if(_0x4b2d55){_0x40483b=_0x4b2d55;}}return _0x40483b;}exports[_0xffb3('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x505f50){var _0x420418=CAMPAIGN_STATUS[_0xffb3('0x3f')];if(_0x505f50[_0xffb3('0x29')]===0x0&&_0x505f50[_0xffb3('0x25')]===0x0&&_0x505f50[_0xffb3('0x27')]===0x0&&(_0x505f50[_0xffb3('0x26')]||0x0)===0x0){_0x420418=CAMPAIGN_STATUS[_0xffb3('0x3b')];}return _0x420418;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x13681f){var _0x2cafca=_0x13681f['match'](/"(.*?)"/);return _0x2cafca?_0x2cafca[0x1]:_0x13681f;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x58b753,_0x4c9e8b,_0x3a2599){if(!_['isUndefined'](_0x3a2599)&&typeof _0x3a2599===_0xffb3('0x40')&&!_['isEmpty'](_0x3a2599)){if(!_[_0xffb3('0x41')](_0x4c9e8b)&&typeof _0x4c9e8b==='string'&&!_[_0xffb3('0x33')](_0x4c9e8b)){return util['format'](_0xffb3('0x42'),_0x4c9e8b,_0x3a2599);}return util['format'](_0xffb3('0x42'),_0x3a2599,_0x3a2599);}if(!_[_0xffb3('0x41')](_0x58b753)&&typeof _0x58b753===_0xffb3('0x40')&&!_[_0xffb3('0x33')](_0x58b753)){return _0x58b753;}return _0xffb3('0x43');}exports[_0xffb3('0x44')]=getCallerId;function getCallerIdRandom(_0x1d589f,_0x12504c){var _0xf438df;var _0x2fa62e;var _0x432fbe;if(_0x12504c<=0x0){_0x12504c=0x1;}_0xf438df=new RegExp(_0xffb3('0x45')+_0x12504c+'}$');_0x2fa62e=Math[_0xffb3('0x46')](0xa,_0x12504c-0x1);_0x432fbe=Math['pow'](0xa,_0x12504c)-0x1;return util[_0xffb3('0x47')]('%s',_[_0xffb3('0x48')](_0x1d589f,_0xf438df,_[_0xffb3('0x49')](_0x2fa62e,_0x432fbe)[_0xffb3('0x4a')]()));}exports[_0xffb3('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x473c65){if(_0x473c65[_0xffb3('0x29')]&&_0x473c65['originated']>0x0){_0x473c65['originated']-=0x1;}else{logger[_0xffb3('0x4c')](_0xffb3('0x4d'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x1de095){return _0x1de095&&_0x1de095[_0xffb3('0x4e')]>0x0;}exports[_0xffb3('0x4f')]=checkContactEmpty;function erlangb(_0x1a3335,_0x79693d){if(_0x79693d===0x0){return 0x0;}var _0x1bc502=0x1;for(var _0x2e51ec=0x1;_0x2e51ec<=_0x79693d;_0x2e51ec+=0x1){_0x1bc502=0x1+_0x1bc502*_0x2e51ec/_0x1a3335;}return 0x1/_0x1bc502;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x35093a,_0x4c78d3,_0x5520a8){if(_0x4c78d3>_0x5520a8){for(var _0x4b5515=0x0;_0x4b5515<_0x4c78d3-_0x5520a8;_0x4b5515+=0x1){decrementOriginate(_0x35093a);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x276a4b){var _0x2a197f={};var _0x4de572=['id',_0xffb3('0x50'),_0xffb3('0x51'),_0xffb3('0x52'),'updatedAt'];if(_0x276a4b){for(var _0x30dbae in _0x276a4b){if(typeof _0x276a4b[_0x30dbae]!==_0xffb3('0x53')){if(!_[_0xffb3('0x2e')](_0x276a4b[_0x30dbae])&&!_0x4de572['includes'](_0x30dbae)){_0x2a197f[util[_0xffb3('0x47')](_0xffb3('0x54'),_0xffb3('0x55'),_0x30dbae[_0xffb3('0x56')]())]=_0x276a4b[_0x30dbae];}}}}return _0x2a197f;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x101c=['pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','%s%s','XMD-','toUpperCase','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','isQueueCampaignActive','isIVRCampaignActive','milliseconds','seconds','getSeconds','dialActive','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x101c,0x116));var _0xc101=function(_0x592df4,_0x4e719b){_0x592df4=_0x592df4-0x0;var _0x3b4fe4=_0x101c[_0x592df4];return _0x3b4fe4;};'use strict';var _=require(_0xc101('0x0'));var moment=require(_0xc101('0x1'));var util=require(_0xc101('0x2'));var logger=require(_0xc101('0x3'))(_0xc101('0x4'));var timezones=require(_0xc101('0x5'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xc101('0x6'),'CONTACTS_RESCHEDULED':_0xc101('0x7'),'DEACTIVATED':_0xc101('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xc101('0x9'),'INACTIVE':_0xc101('0xa'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xc101('0xb'),'NULL_INTERVAL':_0xc101('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xc101('0xd'),'QUEUE_RECALL':_0xc101('0xe'),'RECALL_TIMEOUT':_0xc101('0xf'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xc101('0x10'),'UNREACHABLE_TRUNK':_0xc101('0x11')};exports[_0xc101('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x4cc31c){return _0x4cc31c[_0xc101('0x13')]===_0xc101('0x14');}exports[_0xc101('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x1dcedf){return _0x1dcedf[_0xc101('0x16')]===_0xc101('0x17');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x515938){return _0x515938[_0xc101('0x16')]===_0xc101('0x18');}exports[_0xc101('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x23d85b){return _0x23d85b['dialActive'];}exports[_0xc101('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4cb9a4){return _0x4cb9a4['active'];}exports[_0xc101('0x1b')]=isIVRCampaignActive;function getSeconds(_0x2fbc3c,_0x30af0c){var _0x3b29d3=moment(_0x2fbc3c)[_0xc101('0x1c')](0x0);var _0x454af3=moment(_0x30af0c)[_0xc101('0x1c')](0x0);return _0x3b29d3['diff'](_0x454af3,_0xc101('0x1d'));}exports[_0xc101('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x68e014,_0x49bf37){var _0x48059f=![];var _0x5cca6b=_0x68e014[_0xc101('0x13')]!==_0x49bf37[_0xc101('0x13')]||_0x68e014[_0xc101('0x1f')]!==_0x49bf37[_0xc101('0x1f')]||_0x68e014['message']!==_0x49bf37['message'];var _0x487938=_0x68e014[_0xc101('0x20')]!==_0x49bf37[_0xc101('0x20')]||_0x68e014[_0xc101('0x21')]!==_0x49bf37[_0xc101('0x21')]||_0x68e014['loggedInDb']!==_0x49bf37[_0xc101('0x22')]||_0x68e014[_0xc101('0x23')]!==_0x49bf37['paused']||_0x68e014[_0xc101('0x24')]!==_0x49bf37[_0xc101('0x24')]||_0x68e014['pTalking']!==_0x49bf37[_0xc101('0x25')]||_0x68e014[_0xc101('0x26')]!==_0x49bf37['waiting']||_0x68e014['inUse']!==_0x49bf37[_0xc101('0x27')]||_0x68e014[_0xc101('0x28')]!==_0x49bf37[_0xc101('0x28')];if(_0x68e014[_0xc101('0x29')]&&_0x49bf37['Trunk']){_0x48059f=_0x68e014['Trunk'][_0xc101('0x2a')]!==_0x49bf37[_0xc101('0x29')][_0xc101('0x2a')]||_0x68e014[_0xc101('0x29')][_0xc101('0x2b')]!==_0x49bf37[_0xc101('0x29')][_0xc101('0x2b')];}return _0x5cca6b||_0x487938||_0x48059f;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x301686){var _0x517b84=null;var _0x595dd7=_0x301686['dialTimezone'];if(_[_0xc101('0x2c')](_0x301686[_0xc101('0x2d')])||_[_0xc101('0x2c')](_0x301686[_0xc101('0x2e')])||_['isNil'](_0x301686[_0xc101('0x2e')][_0xc101('0x2f')])){_0x517b84=CAMPAIGN_STATUS[_0xc101('0x30')];}else if(_['isEmpty'](_0x301686[_0xc101('0x2d')])||_[_0xc101('0x31')](_0x301686[_0xc101('0x2e')][_0xc101('0x2f')])){_0x517b84=CAMPAIGN_STATUS[_0xc101('0x32')];}else if(_0x595dd7&&!timezones[_0x595dd7]){_0x517b84=CAMPAIGN_STATUS[_0xc101('0x33')];}return _0x517b84;}function checkAnyValidTrunk(_0x1e1479,_0x57512b){var _0x3040ab=null;var _0x4d9e8a=_0xc101('0x34');var _0x5cb050=[_0xc101('0x35'),'unmonitored'];var _0x5f561f=!![];if(_0x1e1479['Trunk']&&_0x1e1479[_0xc101('0x29')][_0xc101('0x2b')]){_0x4d9e8a+=_0x1e1479[_0xc101('0x29')]['name'];_0x3040ab=_0x57512b[_0x4d9e8a];_0x5f561f=_0x5cb050[_0xc101('0x36')](_0x3040ab[_0xc101('0x37')]);}else if(_0x1e1479[_0xc101('0x38')]&&_0x1e1479[_0xc101('0x38')][_0xc101('0x2b')]){_0x4d9e8a+=_0x1e1479[_0xc101('0x38')][_0xc101('0x2a')];_0x3040ab=_0x57512b[_0x4d9e8a];_0x5f561f=_0x5cb050[_0xc101('0x36')](_0x3040ab['status']);}return _0x5f561f;}function getQueueCampaignStatusMessage(_0x2ce83e,_0x22f78d){var _0x3d44a3=CAMPAIGN_STATUS['ACTIVE'];var _0x1b7266=isPreviewCampaign(_0x2ce83e);if(!isQueueCampaignActive(_0x2ce83e)){if(_0x1b7266){_0x3d44a3=CAMPAIGN_STATUS[_0xc101('0x39')];}else{if(_0x2ce83e[_0xc101('0x28')]===0x0&&_0x2ce83e[_0xc101('0x24')]===0x0&&_0x2ce83e['waiting']===0x0&&(_0x2ce83e['pTalking']||0x0)===0x0){_0x3d44a3=CAMPAIGN_STATUS['INACTIVE'];}else{_0x3d44a3=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x2ce83e[_0xc101('0x21')]===0x0){_0x3d44a3=CAMPAIGN_STATUS[_0xc101('0x3a')];}else if(!checkAnyValidTrunk(_0x2ce83e,_0x22f78d)){_0x3d44a3=CAMPAIGN_STATUS[_0xc101('0x3b')];}else if(!isPreviewCampaign(_0x2ce83e)){var _0xb59582=checkAnyValidQueueCampaignInterval(_0x2ce83e);if(_0xb59582){_0x3d44a3=_0xb59582;}}return _0x3d44a3;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5abba3){var _0x4ae49b=CAMPAIGN_STATUS[_0xc101('0x3c')];if(_0x5abba3['originated']===0x0&&_0x5abba3['talking']===0x0&&_0x5abba3['waiting']===0x0&&(_0x5abba3['pTalking']||0x0)===0x0){_0x4ae49b=CAMPAIGN_STATUS[_0xc101('0x39')];}return _0x4ae49b;}exports[_0xc101('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x232ee0){var _0x427ac8=_0x232ee0[_0xc101('0x3e')](/"(.*?)"/);return _0x427ac8?_0x427ac8[0x1]:_0x232ee0;}exports[_0xc101('0x3f')]=extractCalleridName;function getCallerId(_0x3deea7,_0x91eb94,_0x37d49c){if(!_['isUndefined'](_0x37d49c)&&typeof _0x37d49c===_0xc101('0x40')&&!_[_0xc101('0x31')](_0x37d49c)){if(!_[_0xc101('0x41')](_0x91eb94)&&typeof _0x91eb94==='string'&&!_[_0xc101('0x31')](_0x91eb94)){return util[_0xc101('0x42')](_0xc101('0x43'),_0x91eb94,_0x37d49c);}return util[_0xc101('0x42')](_0xc101('0x43'),_0x37d49c,_0x37d49c);}if(!_['isUndefined'](_0x3deea7)&&typeof _0x3deea7===_0xc101('0x40')&&!_[_0xc101('0x31')](_0x3deea7)){return _0x3deea7;}return _0xc101('0x44');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x1c2c67,_0x1030dc){var _0x5a51e9;var _0x28c289;var _0x380dce;if(_0x1030dc<=0x0){_0x1030dc=0x1;}_0x5a51e9=new RegExp(_0xc101('0x45')+_0x1030dc+'}$');_0x28c289=Math[_0xc101('0x46')](0xa,_0x1030dc-0x1);_0x380dce=Math['pow'](0xa,_0x1030dc)-0x1;return util[_0xc101('0x42')]('%s',_[_0xc101('0x47')](_0x1c2c67,_0x5a51e9,_[_0xc101('0x48')](_0x28c289,_0x380dce)[_0xc101('0x49')]()));}exports[_0xc101('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x15d995){if(_0x15d995['originated']&&_0x15d995[_0xc101('0x28')]>0x0){_0x15d995[_0xc101('0x28')]-=0x1;}else{logger[_0xc101('0x4b')](_0xc101('0x4c'));}}exports[_0xc101('0x4d')]=decrementOriginate;function checkContactEmpty(_0x263db1){return _0x263db1&&_0x263db1[_0xc101('0x4e')]>0x0;}exports[_0xc101('0x4f')]=checkContactEmpty;function erlangb(_0x56f57d,_0x196e18){if(_0x196e18===0x0){return 0x0;}var _0x2fc596=0x1;for(var _0x39b085=0x1;_0x39b085<=_0x196e18;_0x39b085+=0x1){_0x2fc596=0x1+_0x2fc596*_0x39b085/_0x56f57d;}return 0x1/_0x2fc596;}exports[_0xc101('0x50')]=erlangb;function checkContactLowerLimitOriginate(_0x24fac9,_0x3fd0ce,_0x28e06c){if(_0x3fd0ce>_0x28e06c){for(var _0x56526f=0x0;_0x56526f<_0x3fd0ce-_0x28e06c;_0x56526f+=0x1){decrementOriginate(_0x24fac9);}}}exports[_0xc101('0x51')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x1d0aef){var _0x1d912c={};var _0x418c37=['id',_0xc101('0x52'),_0xc101('0x53'),'tags','updatedAt'];if(_0x1d0aef){for(var _0x1e2f1e in _0x1d0aef){if(typeof _0x1d0aef[_0x1e2f1e]!=='undefined'){if(!_['isNil'](_0x1d0aef[_0x1e2f1e])&&!_0x418c37['includes'](_0x1e2f1e)){_0x1d912c[util['format'](_0xc101('0x54'),_0xc101('0x55'),_0x1e2f1e[_0xc101('0x56')]())]=_0x1d0aef[_0x1e2f1e];}}}}return _0x1d912c;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 6d49aef..f9ecd8a 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(_0x2f4e68,_0xe9bc3d){var _0xc70c7a=function(_0x14af32){while(--_0x14af32){_0x2f4e68['push'](_0x2f4e68['shift']());}};_0xc70c7a(++_0xe9bc3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x304ce4,_0x252f62){var _0x197377=function(_0x48e324){while(--_0x48e324){_0x304ce4['push'](_0x304ce4['shift']());}};_0x197377(++_0x252f62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 dc999a1..72b4fd4 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 _0x2a84=['status','filename','\x20syncFaxStatus\x20','syncReceiveFax','pagestransferred','resolution','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isNil','active','SIP/%s','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','uuid','path','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a84,0x194));var _0x42a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2a84[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x42a8('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x42a8('0x1'));var moment=require('moment');var path=require(_0x42a8('0x2'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0x42a8('0x3'))(_0x42a8('0x4'));var ami=require(_0x42a8('0x5'));var rpcDb=require(_0x42a8('0x6'));var Channel=require(_0x42a8('0x7'));var ut=require(_0x42a8('0x8'));var Action=require(_0x42a8('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x42a8('0xa'));var faxMessage=require(_0x42a8('0xb'));function Fax(_0x1b0dca){this[_0x42a8('0xc')]={};this[_0x42a8('0xd')]=_0x1b0dca[_0x42a8('0xd')];this['trunks']=_0x1b0dca[_0x42a8('0xe')];this[_0x42a8('0xf')]={};ami['on'](_0x42a8('0x10'),this[_0x42a8('0x11')][_0x42a8('0x12')](this));ami['on'](_0x42a8('0x13'),this['syncVarSet']['bind'](this));ami['on'](_0x42a8('0x14'),this['syncNewState'][_0x42a8('0x12')](this));ami['on'](_0x42a8('0x15'),this[_0x42a8('0x16')][_0x42a8('0x12')](this));ami['on'](_0x42a8('0x17'),this[_0x42a8('0x18')][_0x42a8('0x12')](this));ami['on'](_0x42a8('0x19'),this['syncReceiveFax'][_0x42a8('0x12')](this));ami['on']('hangup',this[_0x42a8('0x1a')]['bind'](this));ami['on']('originateresponse',this[_0x42a8('0x1b')]['bind'](this));}Fax[_0x42a8('0x1c')][_0x42a8('0x11')]=function(_0x583738){if(_0x583738[_0x42a8('0x1d')]===_0x42a8('0x1e')){for(var _0xda70ab in this[_0x42a8('0xd')]){if(this[_0x42a8('0xd')][_0x42a8('0x1f')](_0xda70ab)){if(_0x583738['exten']===this[_0x42a8('0xd')][_0xda70ab][_0x42a8('0x20')]){this[_0x42a8('0xc')][_0x583738[_0x42a8('0x21')]]={};this[_0x42a8('0xc')][_0x583738['uniqueid']][_0x42a8('0x22')]=_0x583738[_0x42a8('0x22')];this[_0x42a8('0xc')][_0x583738[_0x42a8('0x21')]]['id']=this[_0x42a8('0xd')][_0xda70ab]['id'];this[_0x42a8('0xc')][_0x583738[_0x42a8('0x21')]][_0x42a8('0x23')]=this[_0x42a8('0xd')][_0xda70ab][_0x42a8('0x23')];logger[_0x42a8('0x24')](_0x583738[_0x42a8('0x21')],'\x20syncNewchannel\x20');}}}}if(this[_0x42a8('0xf')][_0x583738['uniqueid']]){this[_0x42a8('0xc')][_0x583738['uniqueid']]={};this[_0x42a8('0xc')][_0x583738[_0x42a8('0x21')]]['channel']=_0x583738[_0x42a8('0x22')];logger[_0x42a8('0x24')](_0x583738[_0x42a8('0x21')],_0x42a8('0x25'));}};Fax[_0x42a8('0x1c')]['syncVarSet']=function(_0x3f25df){if(this[_0x42a8('0xc')][_0x3f25df[_0x42a8('0x21')]]){for(var _0x33380b in _0x3f25df[_0x42a8('0x26')]){if(_0x3f25df['variable'][_0x42a8('0x1f')](_0x33380b)){this['channels'][_0x3f25df[_0x42a8('0x21')]][_0x33380b]=_0x3f25df[_0x42a8('0x27')];}}}};Fax[_0x42a8('0x1c')][_0x42a8('0x28')]=function(_0xed09a5){if(this[_0x42a8('0xc')][_0xed09a5[_0x42a8('0x21')]]){this['channels'][_0xed09a5['uniqueid']]['channelstate']=_0xed09a5[_0x42a8('0x29')];this[_0x42a8('0xc')][_0xed09a5[_0x42a8('0x21')]][_0x42a8('0x2a')]=_0xed09a5[_0x42a8('0x2a')];}};Fax[_0x42a8('0x1c')][_0x42a8('0x16')]=function(_0x5c4fc3){if(this['channels'][_0x5c4fc3['uniqueid']]){for(var _0x206463 in _0x5c4fc3[_0x42a8('0x26')]){if(_0x5c4fc3['variable'][_0x42a8('0x1f')](_0x206463)){this[_0x42a8('0xc')][_0x5c4fc3['uniqueid']][_0x206463]=_0x5c4fc3[_0x42a8('0x27')];}}}};Fax[_0x42a8('0x1c')][_0x42a8('0x18')]=function(_0x25c17e){if(this[_0x42a8('0xc')][_0x25c17e['uniqueid']]){this[_0x42a8('0xc')][_0x25c17e[_0x42a8('0x21')]][_0x42a8('0x2b')]=_0x25c17e[_0x42a8('0x2b')];this[_0x42a8('0xc')][_0x25c17e['uniqueid']][_0x42a8('0x2c')]=_0x25c17e[_0x42a8('0x2c')];this['channels'][_0x25c17e[_0x42a8('0x21')]][_0x42a8('0x20')]=_0x25c17e[_0x42a8('0x20')];this[_0x42a8('0xc')][_0x25c17e[_0x42a8('0x21')]][_0x42a8('0x2d')]=_0x25c17e[_0x42a8('0x2d')];logger[_0x42a8('0x24')](_0x25c17e['uniqueid'],_0x42a8('0x2e'));}};Fax[_0x42a8('0x1c')][_0x42a8('0x2f')]=function(_0x6c3c33){var _0x41e162=this;if(this[_0x42a8('0xc')][_0x6c3c33[_0x42a8('0x21')]]){var _0x186fd7=this['channels'][_0x6c3c33['uniqueid']]['id'];this[_0x42a8('0xc')][_0x6c3c33['uniqueid']]['remotestationid']=_0x6c3c33['remotestationid'];this[_0x42a8('0xc')][_0x6c3c33[_0x42a8('0x21')]][_0x42a8('0x30')]=_0x6c3c33[_0x42a8('0x30')];this[_0x42a8('0xc')][_0x6c3c33[_0x42a8('0x21')]]['localstationid']=_0x6c3c33[_0x42a8('0x20')];this[_0x42a8('0xc')][_0x6c3c33['uniqueid']][_0x42a8('0x31')]=_0x6c3c33[_0x42a8('0x31')];this[_0x42a8('0xc')][_0x6c3c33[_0x42a8('0x21')]]['transferrate']=_0x6c3c33['transferrate'];this[_0x42a8('0xc')][_0x6c3c33['uniqueid']][_0x42a8('0x2d')]=_0x6c3c33[_0x42a8('0x2d')];this[_0x42a8('0xc')][_0x6c3c33[_0x42a8('0x21')]][_0x42a8('0x32')]=_0x6c3c33['calleridnum'];if(this[_0x42a8('0xc')][_0x6c3c33[_0x42a8('0x21')]][_0x42a8('0x30')]>0x0){tiff2pdf(_0x6c3c33[_0x42a8('0x2d')],'/var/opt/motion2/server/files/attachments/',function(_0x24e101){logger[_0x42a8('0x24')](_0x6c3c33['uniqueid'],_0x42a8('0x33'),_0x24e101[_0x42a8('0x34')]);attachment[_0x42a8('0x35')]({'name':path['parse'](_0x6c3c33[_0x42a8('0x2d')])[_0x42a8('0x23')],'basename':path[_0x42a8('0x36')](_0x6c3c33[_0x42a8('0x2d')])['name']+_0x42a8('0x37'),'type':'application/pdf'})[_0x42a8('0x38')](function(_0x35c91b){faxAccount[_0x42a8('0x39')](_0x186fd7,{'from':_0x6c3c33['calleridnum'],'mapKey':_0x42a8('0x4'),'body':path[_0x42a8('0x36')](_0x6c3c33[_0x42a8('0x2d')])[_0x42a8('0x23')]+_0x42a8('0x37'),'AttachmentId':_0x35c91b['id']})[_0x42a8('0x3a')](function(_0x1d4da1){logger[_0x42a8('0x3b')](_0x6c3c33[_0x42a8('0x21')],_0x42a8('0x3c'),JSON[_0x42a8('0x3d')](_0x1d4da1));});})[_0x42a8('0x3a')](function(_0x2582b5){logger[_0x42a8('0x3b')](_0x6c3c33['uniqueid'],'\x20receiveFax\x20',JSON[_0x42a8('0x3d')](_0x2582b5));});});}logger[_0x42a8('0x24')](_0x6c3c33[_0x42a8('0x21')],_0x42a8('0x3e'));}};Fax[_0x42a8('0x1c')][_0x42a8('0x1b')]=function(_0x20904){if(this[_0x42a8('0xf')][_0x20904[_0x42a8('0x21')]]){_[_0x42a8('0x3f')](this[_0x42a8('0xc')][_0x20904[_0x42a8('0x21')]],_[_0x42a8('0x40')](_0x20904,[_0x42a8('0x41'),'reason']));}};function updateStatus(_0xe80246){if(_0xe80246[_0x42a8('0x42')]){faxMessage['update'](_0xe80246[_0x42a8('0x42')],{'failMessage':_0x42a8('0x43')})[_0x42a8('0x38')](function(_0x38e4e7){ut[_0x42a8('0x44')](_0x42a8('0x45'),_0x38e4e7);})[_0x42a8('0x3a')](function(_0x5b7a8d){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x5b7a8d);});}else{ut[_0x42a8('0x44')](_0x42a8('0x46'));}}Fax[_0x42a8('0x1c')][_0x42a8('0x47')]=function(_0x28bd9f,_0xc99e87,_0x440eff){var _0x584db2=this;var _0x4c3499={};if(_0xc99e87){_0x4c3499={'read':_0xc99e87};}else{_0x4c3499={'failMessage':_0x440eff};}if(this['actions'][_0x28bd9f][_0x42a8('0x42')]){faxMessage[_0x42a8('0x48')](this[_0x42a8('0xf')][_0x28bd9f][_0x42a8('0x42')],_0x4c3499)[_0x42a8('0x38')](function(_0x12b22e){ut[_0x42a8('0x44')](_0x42a8('0x49'),_0x12b22e);})[_0x42a8('0x3a')](function(_0x2f3d5c){ut[_0x42a8('0x44')](_0x42a8('0x4a'),_0x2f3d5c);})['finally'](function(){delete _0x584db2[_0x42a8('0xc')][_0x28bd9f];delete _0x584db2[_0x42a8('0xf')][_0x28bd9f];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this['channels'][_0x28bd9f];delete this['actions'][_0x28bd9f];}};Fax[_0x42a8('0x1c')][_0x42a8('0x1a')]=function(_0x1d1268){var _0x574552=this;if(this['channels'][_0x1d1268[_0x42a8('0x21')]]){if(this[_0x42a8('0xf')][_0x1d1268[_0x42a8('0x21')]]){this[_0x42a8('0xc')][_0x1d1268[_0x42a8('0x21')]]['id']=this[_0x42a8('0xf')][_0x1d1268['uniqueid']]['id'];this['channels'][_0x1d1268['uniqueid']]['name']=this[_0x42a8('0xf')][_0x1d1268[_0x42a8('0x21')]][_0x42a8('0x23')];}logger[_0x42a8('0x24')](_0x1d1268[_0x42a8('0x21')],this[_0x42a8('0xf')][_0x1d1268[_0x42a8('0x21')]]?_0x42a8('0x4b'):_0x42a8('0x4c'),JSON[_0x42a8('0x3d')](this[_0x42a8('0xc')][_0x1d1268['uniqueid']]));if(this[_0x42a8('0xf')][_0x1d1268[_0x42a8('0x21')]]){if(this[_0x42a8('0xc')][_0x1d1268[_0x42a8('0x21')]][_0x42a8('0x4d')]>0x0&&this['channels'][_0x1d1268[_0x42a8('0x21')]][_0x42a8('0x17')]==='SUCCESS'){this[_0x42a8('0x47')](_0x1d1268[_0x42a8('0x21')],!![]);}else{this['updateStatus'](_0x1d1268[_0x42a8('0x21')],![],this[_0x42a8('0xc')][_0x1d1268['uniqueid']][_0x42a8('0x4e')]?_0x42a8('0x4f')+this[_0x42a8('0xc')][_0x1d1268[_0x42a8('0x21')]][_0x42a8('0x4e')]:_0x42a8('0x50'));}}}};Fax[_0x42a8('0x1c')][_0x42a8('0x51')]=function(_0x1347e1){var _0x54e339=this;return new BPromise(function(_0x1f0008,_0x5e56b1){_0x54e339[_0x42a8('0x52')](_0x1347e1,_0x54e339['faxAccounts'][_0x1347e1[_0x42a8('0x53')]])[_0x42a8('0x38')](function(_0x4a2f70){ut[_0x42a8('0x44')](_0x42a8('0x54'),_0x4a2f70);_0x1f0008(ut[_0x42a8('0x34')](_0x42a8('0x55')));})[_0x42a8('0x3a')](function(_0x2cc767){ut[_0x42a8('0x44')]('[Fax][execOriginate][failure]',_0x2cc767);updateStatus(_0x1347e1);_0x5e56b1(ut['message'](_0x42a8('0x56')));});});};Fax[_0x42a8('0x1c')][_0x42a8('0x57')]=function(_0x1e51a5){var _0x4cf0a6=this;return new BPromise(function(_0x46d682,_0x3b04a2){var _0x19bcc0=_0x4cf0a6[_0x42a8('0x58')](_0x4cf0a6[_0x42a8('0xd')][_0x1e51a5[_0x42a8('0x53')]][_0x42a8('0x59')],_0x1e51a5);if(_0x19bcc0['isValid']){_0x46d682(ut[_0x42a8('0x34')]('Trunk\x20Reachable'));}else{_0x3b04a2(ut['message'](_0x19bcc0[_0x42a8('0x34')]));}});};function originate(_0xb85b98,_0x56b15b,_0x17a09d){return new BPromise(function(_0x44f5bd,_0x539763){if(_0x17a09d){var _0x66cbbe=util[_0x42a8('0x5a')](_0x42a8('0x5b'),path[_0x42a8('0x36')](_0xb85b98[_0x42a8('0x2')])[_0x42a8('0x23')],_0xb85b98[_0x42a8('0x2')]);gs[_0x42a8('0x5c')](_0x66cbbe)[_0x42a8('0x38')](function(){_0xb85b98[_0x42a8('0x2')]=util[_0x42a8('0x5a')](_0x42a8('0x5d'),path[_0x42a8('0x36')](_0xb85b98[_0x42a8('0x2')])[_0x42a8('0x5e')],path[_0x42a8('0x36')](_0xb85b98[_0x42a8('0x2')])[_0x42a8('0x23')]);_0x56b15b[_0x42a8('0x5f')]=_0xb85b98['path'];ut['logger'](_0x42a8('0x60'),'');ami[_0x42a8('0x61')](ut[_0x42a8('0x62')](_0xb85b98,_0x56b15b))[_0x42a8('0x38')](function(_0x56b046){_0x44f5bd(_0x56b046);})[_0x42a8('0x3a')](function(_0x34e94f){_0x539763(_0x34e94f);});})[_0x42a8('0x3a')](function(_0x90da34){_0x539763(_0x90da34);});}else{ami[_0x42a8('0x61')](ut[_0x42a8('0x62')](_0xb85b98,_0x56b15b))['then'](function(_0x41c233){_0x44f5bd(_0x41c233);})[_0x42a8('0x3a')](function(_0x161244){_0x539763(_0x161244);});}});}Fax['prototype'][_0x42a8('0x52')]=function(_0x59d292,_0x2c99c6){var _0x1a5bbf=this;return new BPromise(function(_0x10575a,_0x1e71bb){var _0x3c62c7=uuid['v4']();var _0x1f7270=ut[_0x42a8('0x63')](_0x59d292,_0x2c99c6);_0x1a5bbf[_0x42a8('0xf')][_0x3c62c7]=new Action(_0x3c62c7,_0x2c99c6,_0x59d292);var _0x5d3a56=_0x1a5bbf['actions'][_0x3c62c7];if(path[_0x42a8('0x36')](_0x59d292[_0x42a8('0x2')])['ext']===_0x42a8('0x37')){originate(_0x5d3a56,_0x1f7270,!![])[_0x42a8('0x38')](function(_0x4a86b7){_0x10575a(_0x4a86b7);})[_0x42a8('0x3a')](function(_0x3c16af){_0x1e71bb(_0x3c16af);});}else{originate(_0x5d3a56,_0x1f7270,![])['then'](function(_0x472b27){_0x10575a(_0x472b27);})[_0x42a8('0x3a')](function(_0x547381){_0x1e71bb(_0x547381);});}});};Fax[_0x42a8('0x1c')]['isTrunkReachable']=function(_0x2f8c1c){return!_['isNil'](_0x2f8c1c)&&!_['isNil'](_0x2f8c1c['name'])&&!_[_0x42a8('0x64')](_0x2f8c1c['active'])&&_0x2f8c1c[_0x42a8('0x65')]&&!_[_0x42a8('0x64')](this[_0x42a8('0xe')][util[_0x42a8('0x5a')](_0x42a8('0x66'),_0x2f8c1c[_0x42a8('0x23')])])&&!_[_0x42a8('0x64')](this[_0x42a8('0xe')][util['format']('SIP/%s',_0x2f8c1c[_0x42a8('0x23')])][_0x42a8('0x2c')])&&(this[_0x42a8('0xe')][util['format'](_0x42a8('0x66'),_0x2f8c1c[_0x42a8('0x23')])][_0x42a8('0x2c')]==='reachable'||this[_0x42a8('0xe')][util[_0x42a8('0x5a')](_0x42a8('0x66'),_0x2f8c1c[_0x42a8('0x23')])]['status']===_0x42a8('0x67'));};Fax['prototype'][_0x42a8('0x58')]=function(_0xacf8db,_0x178f09){if(!this[_0x42a8('0x68')](_0xacf8db)){ut['logger'](_0x42a8('0x69'),_[_0x42a8('0x64')](_0xacf8db)?'':_0xacf8db[_0x42a8('0x23')]+_0x42a8('0x6a'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_['isNil'](_0x178f09['fax'])){ut[_0x42a8('0x44')](_0x42a8('0x6b'),JSON[_0x42a8('0x3d')](_0x178f09));return{'isValid':![],'message':_0x42a8('0x6c')};}if(_[_0x42a8('0x64')](_0x178f09[_0x42a8('0x2')])){ut[_0x42a8('0x44')](_0x42a8('0x6d'),JSON[_0x42a8('0x3d')](_0x178f09));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x42a8('0x6e')};};module[_0x42a8('0x6f')]=Fax; \ No newline at end of file +var _0x03dc=['trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','channel','uniqueid','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','notify','error','\x20notify\x20','catch','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','then','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts'];(function(_0xf2552,_0x7063b1){var _0x211d0f=function(_0x19bff2){while(--_0x19bff2){_0xf2552['push'](_0xf2552['shift']());}};_0x211d0f(++_0x7063b1);}(_0x03dc,0xdb));var _0xc03d=function(_0x299653,_0x43c809){_0x299653=_0x299653-0x0;var _0x5320e2=_0x03dc[_0x299653];return _0x5320e2;};'use strict';var util=require(_0xc03d('0x0'));var _=require(_0xc03d('0x1'));var BPromise=require(_0xc03d('0x2'));var uuid=require(_0xc03d('0x3'));var moment=require(_0xc03d('0x4'));var path=require(_0xc03d('0x5'));var tiff2pdf=require(_0xc03d('0x6'));var gs=require(_0xc03d('0x7'));var logger=require('../../../config/logger')(_0xc03d('0x8'));var ami=require(_0xc03d('0x9'));var rpcDb=require(_0xc03d('0xa'));var Channel=require('./channel');var ut=require(_0xc03d('0xb'));var Action=require('./action');var faxAccount=require(_0xc03d('0xc'));var attachment=require(_0xc03d('0xd'));var faxMessage=require(_0xc03d('0xe'));function Fax(_0xc48248){this[_0xc03d('0xf')]={};this[_0xc03d('0x10')]=_0xc48248[_0xc03d('0x10')];this['trunks']=_0xc48248[_0xc03d('0x11')];this[_0xc03d('0x12')]={};ami['on'](_0xc03d('0x13'),this[_0xc03d('0x14')][_0xc03d('0x15')](this));ami['on'](_0xc03d('0x16'),this[_0xc03d('0x17')][_0xc03d('0x15')](this));ami['on']('newstate',this[_0xc03d('0x18')][_0xc03d('0x15')](this));ami['on'](_0xc03d('0x19'),this[_0xc03d('0x1a')]['bind'](this));ami['on'](_0xc03d('0x1b'),this[_0xc03d('0x1c')][_0xc03d('0x15')](this));ami['on'](_0xc03d('0x1d'),this[_0xc03d('0x1e')][_0xc03d('0x15')](this));ami['on']('hangup',this[_0xc03d('0x1f')][_0xc03d('0x15')](this));ami['on'](_0xc03d('0x20'),this[_0xc03d('0x21')][_0xc03d('0x15')](this));}Fax[_0xc03d('0x22')][_0xc03d('0x14')]=function(_0x4f3fab){if(_0x4f3fab[_0xc03d('0x23')]==='from-voip-provider'){for(var _0x5c60c7 in this[_0xc03d('0x10')]){if(this[_0xc03d('0x10')][_0xc03d('0x24')](_0x5c60c7)){if(_0x4f3fab[_0xc03d('0x25')]===this[_0xc03d('0x10')][_0x5c60c7][_0xc03d('0x26')]){this[_0xc03d('0xf')][_0x4f3fab['uniqueid']]={};this['channels'][_0x4f3fab['uniqueid']]['channel']=_0x4f3fab[_0xc03d('0x27')];this[_0xc03d('0xf')][_0x4f3fab[_0xc03d('0x28')]]['id']=this[_0xc03d('0x10')][_0x5c60c7]['id'];this[_0xc03d('0xf')][_0x4f3fab[_0xc03d('0x28')]][_0xc03d('0x29')]=this[_0xc03d('0x10')][_0x5c60c7][_0xc03d('0x29')];logger[_0xc03d('0x2a')](_0x4f3fab[_0xc03d('0x28')],_0xc03d('0x2b'));}}}}if(this['actions'][_0x4f3fab[_0xc03d('0x28')]]){this[_0xc03d('0xf')][_0x4f3fab[_0xc03d('0x28')]]={};this['channels'][_0x4f3fab[_0xc03d('0x28')]][_0xc03d('0x27')]=_0x4f3fab[_0xc03d('0x27')];logger[_0xc03d('0x2a')](_0x4f3fab[_0xc03d('0x28')],_0xc03d('0x2b'));}};Fax[_0xc03d('0x22')][_0xc03d('0x17')]=function(_0x5ad251){if(this['channels'][_0x5ad251[_0xc03d('0x28')]]){for(var _0x4f28cc in _0x5ad251['variable']){if(_0x5ad251[_0xc03d('0x2c')][_0xc03d('0x24')](_0x4f28cc)){this[_0xc03d('0xf')][_0x5ad251[_0xc03d('0x28')]][_0x4f28cc]=_0x5ad251['value'];}}}};Fax[_0xc03d('0x22')][_0xc03d('0x18')]=function(_0x52584f){if(this[_0xc03d('0xf')][_0x52584f[_0xc03d('0x28')]]){this[_0xc03d('0xf')][_0x52584f[_0xc03d('0x28')]][_0xc03d('0x2d')]=_0x52584f[_0xc03d('0x2d')];this[_0xc03d('0xf')][_0x52584f[_0xc03d('0x28')]][_0xc03d('0x2e')]=_0x52584f[_0xc03d('0x2e')];}};Fax['prototype'][_0xc03d('0x1a')]=function(_0x24d6f3){if(this[_0xc03d('0xf')][_0x24d6f3[_0xc03d('0x28')]]){for(var _0x2db611 in _0x24d6f3[_0xc03d('0x2c')]){if(_0x24d6f3['variable']['hasOwnProperty'](_0x2db611)){this[_0xc03d('0xf')][_0x24d6f3[_0xc03d('0x28')]][_0x2db611]=_0x24d6f3[_0xc03d('0x2f')];}}}};Fax[_0xc03d('0x22')]['syncFaxStatus']=function(_0x746817){if(this[_0xc03d('0xf')][_0x746817[_0xc03d('0x28')]]){this[_0xc03d('0xf')][_0x746817[_0xc03d('0x28')]]['operation']=_0x746817[_0xc03d('0x30')];this[_0xc03d('0xf')][_0x746817['uniqueid']][_0xc03d('0x31')]=_0x746817[_0xc03d('0x31')];this[_0xc03d('0xf')][_0x746817['uniqueid']][_0xc03d('0x26')]=_0x746817[_0xc03d('0x26')];this['channels'][_0x746817[_0xc03d('0x28')]][_0xc03d('0x32')]=_0x746817[_0xc03d('0x32')];logger[_0xc03d('0x2a')](_0x746817[_0xc03d('0x28')],_0xc03d('0x33'));}};Fax[_0xc03d('0x22')][_0xc03d('0x1e')]=function(_0x6ba3fb){var _0x4e62c7=this;if(this[_0xc03d('0xf')][_0x6ba3fb[_0xc03d('0x28')]]){var _0x1ee8d1=this[_0xc03d('0xf')][_0x6ba3fb[_0xc03d('0x28')]]['id'];this[_0xc03d('0xf')][_0x6ba3fb[_0xc03d('0x28')]]['remotestationid']=_0x6ba3fb[_0xc03d('0x34')];this[_0xc03d('0xf')][_0x6ba3fb[_0xc03d('0x28')]][_0xc03d('0x35')]=_0x6ba3fb[_0xc03d('0x35')];this[_0xc03d('0xf')][_0x6ba3fb[_0xc03d('0x28')]][_0xc03d('0x26')]=_0x6ba3fb[_0xc03d('0x26')];this[_0xc03d('0xf')][_0x6ba3fb[_0xc03d('0x28')]][_0xc03d('0x36')]=_0x6ba3fb['resolution'];this[_0xc03d('0xf')][_0x6ba3fb[_0xc03d('0x28')]]['transferrate']=_0x6ba3fb[_0xc03d('0x37')];this[_0xc03d('0xf')][_0x6ba3fb['uniqueid']][_0xc03d('0x32')]=_0x6ba3fb['filename'];this[_0xc03d('0xf')][_0x6ba3fb['uniqueid']]['calleridnum']=_0x6ba3fb[_0xc03d('0x38')];if(this[_0xc03d('0xf')][_0x6ba3fb[_0xc03d('0x28')]][_0xc03d('0x35')]>0x0){tiff2pdf(_0x6ba3fb[_0xc03d('0x32')],_0xc03d('0x39'),function(_0x1edcbe){logger['info'](_0x6ba3fb[_0xc03d('0x28')],_0xc03d('0x3a'),_0x1edcbe[_0xc03d('0x3b')]);attachment['create']({'name':path['parse'](_0x6ba3fb['filename'])[_0xc03d('0x29')],'basename':path[_0xc03d('0x3c')](_0x6ba3fb[_0xc03d('0x32')])[_0xc03d('0x29')]+_0xc03d('0x3d'),'type':_0xc03d('0x3e')})['then'](function(_0x1b8b91){faxAccount[_0xc03d('0x3f')](_0x1ee8d1,{'from':_0x6ba3fb['calleridnum'],'mapKey':_0xc03d('0x8'),'body':path[_0xc03d('0x3c')](_0x6ba3fb['filename'])[_0xc03d('0x29')]+_0xc03d('0x3d'),'AttachmentId':_0x1b8b91['id']})['catch'](function(_0x1db696){logger[_0xc03d('0x40')](_0x6ba3fb[_0xc03d('0x28')],_0xc03d('0x41'),JSON['stringify'](_0x1db696));});})[_0xc03d('0x42')](function(_0x407fd7){logger['error'](_0x6ba3fb[_0xc03d('0x28')],'\x20receiveFax\x20',JSON['stringify'](_0x407fd7));});});}logger[_0xc03d('0x2a')](_0x6ba3fb['uniqueid'],_0xc03d('0x43'));}};Fax['prototype'][_0xc03d('0x21')]=function(_0x4625de){if(this[_0xc03d('0x12')][_0x4625de[_0xc03d('0x28')]]){_[_0xc03d('0x44')](this[_0xc03d('0xf')][_0x4625de[_0xc03d('0x28')]],_[_0xc03d('0x45')](_0x4625de,['response',_0xc03d('0x46')]));}};function updateStatus(_0x441dbb){if(_0x441dbb['AttachmentId']){faxMessage[_0xc03d('0x47')](_0x441dbb[_0xc03d('0x48')],{'failMessage':_0xc03d('0x49')})['then'](function(_0xa6e00b){ut[_0xc03d('0x4a')]('[Fax][Message][Error][Updated]',_0xa6e00b);})[_0xc03d('0x42')](function(_0x29abb8){ut['logger'](_0xc03d('0x4b'),_0x29abb8);});}else{ut[_0xc03d('0x4a')](_0xc03d('0x4c'));}}Fax['prototype']['updateStatus']=function(_0x2bc002,_0x2427bb,_0x4bdf43){var _0x460857=this;var _0x24c66f={};if(_0x2427bb){_0x24c66f={'read':_0x2427bb};}else{_0x24c66f={'failMessage':_0x4bdf43};}if(this[_0xc03d('0x12')][_0x2bc002][_0xc03d('0x48')]){faxMessage['update'](this[_0xc03d('0x12')][_0x2bc002][_0xc03d('0x48')],_0x24c66f)[_0xc03d('0x4d')](function(_0x3f3667){ut[_0xc03d('0x4a')]('[Fax][Message][Updated]',_0x3f3667);})[_0xc03d('0x42')](function(_0x153f67){ut['logger']('[Fax][Message][NoUpdate1]',_0x153f67);})[_0xc03d('0x4e')](function(){delete _0x460857[_0xc03d('0xf')][_0x2bc002];delete _0x460857['actions'][_0x2bc002];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0xc03d('0xf')][_0x2bc002];delete this[_0xc03d('0x12')][_0x2bc002];}};Fax[_0xc03d('0x22')][_0xc03d('0x1f')]=function(_0x507410){var _0x29e19e=this;if(this[_0xc03d('0xf')][_0x507410[_0xc03d('0x28')]]){if(this[_0xc03d('0x12')][_0x507410[_0xc03d('0x28')]]){this['channels'][_0x507410[_0xc03d('0x28')]]['id']=this[_0xc03d('0x12')][_0x507410[_0xc03d('0x28')]]['id'];this[_0xc03d('0xf')][_0x507410['uniqueid']][_0xc03d('0x29')]=this[_0xc03d('0x12')][_0x507410['uniqueid']][_0xc03d('0x29')];}logger[_0xc03d('0x2a')](_0x507410[_0xc03d('0x28')],this[_0xc03d('0x12')][_0x507410['uniqueid']]?_0xc03d('0x4f'):_0xc03d('0x50'),JSON[_0xc03d('0x51')](this[_0xc03d('0xf')][_0x507410[_0xc03d('0x28')]]));if(this[_0xc03d('0x12')][_0x507410[_0xc03d('0x28')]]){if(this[_0xc03d('0xf')][_0x507410[_0xc03d('0x28')]]['faxpages']>0x0&&this['channels'][_0x507410[_0xc03d('0x28')]][_0xc03d('0x1b')]===_0xc03d('0x52')){this[_0xc03d('0x53')](_0x507410[_0xc03d('0x28')],!![]);}else{this[_0xc03d('0x53')](_0x507410[_0xc03d('0x28')],![],this[_0xc03d('0xf')][_0x507410[_0xc03d('0x28')]][_0xc03d('0x54')]?_0xc03d('0x55')+this[_0xc03d('0xf')][_0x507410['uniqueid']]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0xc03d('0x22')][_0xc03d('0x56')]=function(_0x11e540){var _0x3f4f1e=this;return new BPromise(function(_0x5896fc,_0x570889){_0x3f4f1e[_0xc03d('0x57')](_0x11e540,_0x3f4f1e[_0xc03d('0x10')][_0x11e540[_0xc03d('0x58')]])[_0xc03d('0x4d')](function(_0x1df72d){ut['logger'](_0xc03d('0x59'),_0x1df72d);_0x5896fc(ut[_0xc03d('0x3b')](_0xc03d('0x5a')));})['catch'](function(_0x2469c0){ut['logger'](_0xc03d('0x5b'),_0x2469c0);updateStatus(_0x11e540);_0x570889(ut['message']('Fax\x20failed'));});});};Fax[_0xc03d('0x22')][_0xc03d('0x5c')]=function(_0x282efb){var _0xdedc6=this;return new BPromise(function(_0x425c3b,_0x5dbdd1){var _0x173656=_0xdedc6['checkTrunk'](_0xdedc6[_0xc03d('0x10')][_0x282efb['FaxAccountId']][_0xc03d('0x5d')],_0x282efb);if(_0x173656[_0xc03d('0x5e')]){_0x425c3b(ut[_0xc03d('0x3b')](_0xc03d('0x5f')));}else{_0x5dbdd1(ut[_0xc03d('0x3b')](_0x173656[_0xc03d('0x3b')]));}});};function originate(_0x33a324,_0x9261dc,_0x24269f){return new BPromise(function(_0x5160c5,_0x5ed7fd){if(_0x24269f){var _0x2b20a3=util[_0xc03d('0x60')](_0xc03d('0x61'),path[_0xc03d('0x3c')](_0x33a324[_0xc03d('0x5')])[_0xc03d('0x29')],_0x33a324[_0xc03d('0x5')]);gs[_0xc03d('0x62')](_0x2b20a3)[_0xc03d('0x4d')](function(){_0x33a324[_0xc03d('0x5')]=util[_0xc03d('0x60')](_0xc03d('0x63'),path[_0xc03d('0x3c')](_0x33a324['path'])[_0xc03d('0x64')],path[_0xc03d('0x3c')](_0x33a324['path'])[_0xc03d('0x29')]);_0x9261dc[_0xc03d('0x65')]=_0x33a324['path'];ut[_0xc03d('0x4a')](_0xc03d('0x66'),'');ami[_0xc03d('0x67')](ut[_0xc03d('0x68')](_0x33a324,_0x9261dc))[_0xc03d('0x4d')](function(_0x2cedc5){_0x5160c5(_0x2cedc5);})[_0xc03d('0x42')](function(_0x32b2d6){_0x5ed7fd(_0x32b2d6);});})[_0xc03d('0x42')](function(_0x25d23c){_0x5ed7fd(_0x25d23c);});}else{ami[_0xc03d('0x67')](ut[_0xc03d('0x68')](_0x33a324,_0x9261dc))[_0xc03d('0x4d')](function(_0x6ba615){_0x5160c5(_0x6ba615);})[_0xc03d('0x42')](function(_0x281320){_0x5ed7fd(_0x281320);});}});}Fax[_0xc03d('0x22')]['execOriginate']=function(_0x3712e4,_0x1a248d){var _0x12e9dc=this;return new BPromise(function(_0x43c7da,_0x36ba54){var _0x464d83=uuid['v4']();var _0x24fab5=ut['addVariables'](_0x3712e4,_0x1a248d);_0x12e9dc['actions'][_0x464d83]=new Action(_0x464d83,_0x1a248d,_0x3712e4);var _0xdb4b69=_0x12e9dc['actions'][_0x464d83];if(path[_0xc03d('0x3c')](_0x3712e4['path'])[_0xc03d('0x69')]===_0xc03d('0x3d')){originate(_0xdb4b69,_0x24fab5,!![])['then'](function(_0x58b29e){_0x43c7da(_0x58b29e);})[_0xc03d('0x42')](function(_0x3a44da){_0x36ba54(_0x3a44da);});}else{originate(_0xdb4b69,_0x24fab5,![])[_0xc03d('0x4d')](function(_0x301339){_0x43c7da(_0x301339);})[_0xc03d('0x42')](function(_0x2690b0){_0x36ba54(_0x2690b0);});}});};Fax[_0xc03d('0x22')][_0xc03d('0x6a')]=function(_0x3bd644){return!_[_0xc03d('0x6b')](_0x3bd644)&&!_['isNil'](_0x3bd644[_0xc03d('0x29')])&&!_[_0xc03d('0x6b')](_0x3bd644[_0xc03d('0x6c')])&&_0x3bd644[_0xc03d('0x6c')]&&!_[_0xc03d('0x6b')](this[_0xc03d('0x11')][util[_0xc03d('0x60')](_0xc03d('0x6d'),_0x3bd644[_0xc03d('0x29')])])&&!_[_0xc03d('0x6b')](this[_0xc03d('0x11')][util[_0xc03d('0x60')](_0xc03d('0x6d'),_0x3bd644[_0xc03d('0x29')])][_0xc03d('0x31')])&&(this[_0xc03d('0x11')][util[_0xc03d('0x60')](_0xc03d('0x6d'),_0x3bd644[_0xc03d('0x29')])][_0xc03d('0x31')]===_0xc03d('0x6e')||this['trunks'][util[_0xc03d('0x60')](_0xc03d('0x6d'),_0x3bd644[_0xc03d('0x29')])]['status']==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0xe4448e,_0x5d68c0){if(!this[_0xc03d('0x6a')](_0xe4448e)){ut[_0xc03d('0x4a')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0xc03d('0x6b')](_0xe4448e)?'':_0xe4448e['name']+_0xc03d('0x6f'));return{'isValid':![],'message':_0xc03d('0x70')};}if(_[_0xc03d('0x6b')](_0x5d68c0[_0xc03d('0x8')])){ut[_0xc03d('0x4a')](_0xc03d('0x71'),JSON['stringify'](_0x5d68c0));return{'isValid':![],'message':_0xc03d('0x72')};}if(_[_0xc03d('0x6b')](_0x5d68c0[_0xc03d('0x5')])){ut[_0xc03d('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x5d68c0));return{'isValid':![],'message':_0xc03d('0x73')};}return{'isValid':!![],'message':_0xc03d('0x74')};};module[_0xc03d('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 2406478..aab5b55 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 _0xae11=['[Notify]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','catch'];(function(_0x485e26,_0x3caf9a){var _0x52f229=function(_0x310dc4){while(--_0x310dc4){_0x485e26['push'](_0x485e26['shift']());}};_0x52f229(++_0x3caf9a);}(_0xae11,0x1c9));var _0x1ae1=function(_0xbc4659,_0x578fba){_0xbc4659=_0xbc4659-0x0;var _0x5831f9=_0xae11[_0xbc4659];return _0x5831f9;};'use strict';var util=require('util');var BPromise=require(_0x1ae1('0x0'));var logger=require(_0x1ae1('0x1'))(_0x1ae1('0x2'));var _=require(_0x1ae1('0x3'));var faxAccount=require(_0x1ae1('0x4'));function loggerCatch(_0x554313){return function(_0x133a7b){logger[_0x1ae1('0x5')](_0x554313,util[_0x1ae1('0x6')](_0x133a7b,{'showHidden':![],'depth':null}));};}exports[_0x1ae1('0x7')]=function(_0xf4da29,_0x5cf3ba){return BPromise[_0x1ae1('0x8')]()[_0x1ae1('0x9')](faxAccount[_0x1ae1('0x7')](_0xf4da29,_0x5cf3ba))[_0x1ae1('0xa')](loggerCatch(_0x1ae1('0xb')));}; \ No newline at end of file +var _0x0671=['bluebird','../../../config/logger','preview','../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0671,0x16a));var _0x1067=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x0671[_0x1e2080];return _0x260111;};'use strict';var util=require(_0x1067('0x0'));var BPromise=require(_0x1067('0x1'));var logger=require(_0x1067('0x2'))(_0x1067('0x3'));var _=require('lodash');var faxAccount=require(_0x1067('0x4'));function loggerCatch(_0x53db5a){return function(_0x264b8e){logger[_0x1067('0x5')](_0x53db5a,util['inspect'](_0x264b8e,{'showHidden':![],'depth':null}));};}exports[_0x1067('0x6')]=function(_0x35e993,_0x166ddd){return BPromise[_0x1067('0x7')]()[_0x1067('0x8')](faxAccount[_0x1067('0x6')](_0x35e993,_0x166ddd))[_0x1067('0x9')](loggerCatch(_0x1067('0xa')));}; \ 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 9243d5e..3798078 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 _0x3234=['info','Exec\x20gs','\x20Error\x20:','../../../../config/logger','fax','child_process','execute'];(function(_0x449f6b,_0x226471){var _0x2df4e6=function(_0x187b71){while(--_0x187b71){_0x449f6b['push'](_0x449f6b['shift']());}};_0x2df4e6(++_0x226471);}(_0x3234,0x10d));var _0x4323=function(_0x23445d,_0x371efe){_0x23445d=_0x23445d-0x0;var _0x928037=_0x3234[_0x23445d];return _0x928037;};'use strict';var util=require('util');var logger=require(_0x4323('0x0'))(_0x4323('0x1'));var BPromise=require('bluebird');var exec=require(_0x4323('0x2'))['exec'];exports[_0x4323('0x3')]=function(_0x164953){return new BPromise(function(_0x39934b,_0x58acf3){exec(_0x164953,function(_0x9160f,_0x3e5ffe,_0x3c9ed0){logger['info']('Exec\x20gs',_0x3e5ffe);if(_0x9160f){logger[_0x4323('0x4')](_0x4323('0x5'),_0x4323('0x6'),util['inspect'](_0x9160f,{'showHidden':![],'depth':null}),_0x3e5ffe,_0x3c9ed0);_0x58acf3(_0x9160f);}_0x39934b(_0x3e5ffe);});});}; \ No newline at end of file +var _0x4379=['child_process','execute','Exec\x20gs','info','\x20Error\x20:','inspect','util','fax','bluebird'];(function(_0x2b9852,_0x5e5e04){var _0x8a7a89=function(_0x301011){while(--_0x301011){_0x2b9852['push'](_0x2b9852['shift']());}};_0x8a7a89(++_0x5e5e04);}(_0x4379,0x7b));var _0x9437=function(_0x2e1b47,_0xfa12c1){_0x2e1b47=_0x2e1b47-0x0;var _0x488347=_0x4379[_0x2e1b47];return _0x488347;};'use strict';var util=require(_0x9437('0x0'));var logger=require('../../../../config/logger')(_0x9437('0x1'));var BPromise=require(_0x9437('0x2'));var exec=require(_0x9437('0x3'))['exec'];exports[_0x9437('0x4')]=function(_0x1803b9){return new BPromise(function(_0x3aab99,_0x526da5){exec(_0x1803b9,function(_0x4d5153,_0x504c62,_0x3fbb04){logger['info'](_0x9437('0x5'),_0x504c62);if(_0x4d5153){logger[_0x9437('0x6')](_0x9437('0x5'),_0x9437('0x7'),util[_0x9437('0x8')](_0x4d5153,{'showHidden':![],'depth':null}),_0x504c62,_0x3fbb04);_0x526da5(_0x4d5153);}_0x3aab99(_0x504c62);});});}; \ 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 367d0ba..5085d4a 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 _0xc1f9=['gateway','t38timeout','localstationid','path','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','fax','message','logger','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem'];(function(_0x1a188e,_0x1087e6){var _0x46f4e=function(_0x321081){while(--_0x321081){_0x1a188e['push'](_0x1a188e['shift']());}};_0x46f4e(++_0x1087e6);}(_0xc1f9,0xca));var _0x9c1f=function(_0x36f1dd,_0x262354){_0x36f1dd=_0x36f1dd-0x0;var _0x2c9bb3=_0xc1f9[_0x36f1dd];return _0x2c9bb3;};'use strict';var util=require(_0x9c1f('0x0'));var _=require(_0x9c1f('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x9c1f('0x2'));exports[_0x9c1f('0x3')]=function(_0x38a9c){return{'message':_0x38a9c};};exports[_0x9c1f('0x4')]=function(_0x4ac843,_0x43e874){logger['info'](_0x4ac843,util[_0x9c1f('0x5')](_0x43e874,{'showHidden':![],'depth':null}));};exports[_0x9c1f('0x6')]=function(_0xd8b293,_0x4e1adc){var _0x1d61b0={'XMF-ECM':_0x4e1adc[_0x9c1f('0x7')],'XMF-HEADERINFO':_0x4e1adc[_0x9c1f('0x8')],'XMF-MINRATE':_0x4e1adc[_0x9c1f('0x9')],'XMF-MAXRATE':_0x4e1adc[_0x9c1f('0xa')],'XMF-MODEM':util[_0x9c1f('0xb')](_0x9c1f('0xc'),_0x4e1adc[_0x9c1f('0xd')]),'XMF-GATEWAY':_0x4e1adc[_0x9c1f('0xe')],'XMF-FAXDETECT':_0x4e1adc['faxdetect'],'XMF-T38TIMEOUT':_0x4e1adc[_0x9c1f('0xf')],'XMF-LOCALSTATIONID':_0x4e1adc[_0x9c1f('0x10')],'XMF-PATH':_0xd8b293[_0x9c1f('0x11')]};return _0x1d61b0;};exports[_0x9c1f('0x12')]=function(_0x29d8c5,_0x150c71){return{'actionid':_0x29d8c5[_0x9c1f('0x13')],'action':'originate','channel':_0x29d8c5[_0x9c1f('0x14')],'Exten':_0x9c1f('0x15'),'Context':_0x9c1f('0x16'),'Priority':'1','callerid':util[_0x9c1f('0xb')](_0x9c1f('0x17'),_0x29d8c5['headerinfo']?_0x29d8c5[_0x9c1f('0x8')]:'',_0x29d8c5[_0x9c1f('0x10')]),'variable':_0x150c71,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x29d8c5[_0x9c1f('0x13')]};}; \ No newline at end of file +var _0x9acd=['uniqueid','originate','channel','xcally-motion-fax','from-sip','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','gateway','t38timeout','path','variablesAction'];(function(_0x1a2d27,_0x2696b0){var _0x584a86=function(_0x282ee5){while(--_0x282ee5){_0x1a2d27['push'](_0x1a2d27['shift']());}};_0x584a86(++_0x2696b0);}(_0x9acd,0x82));var _0xd9ac=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9acd[_0x4fde08];return _0x12e725;};'use strict';var util=require(_0xd9ac('0x0'));var _=require(_0xd9ac('0x1'));var moment=require(_0xd9ac('0x2'));var logger=require(_0xd9ac('0x3'))(_0xd9ac('0x4'));exports[_0xd9ac('0x5')]=function(_0x198c4b){return{'message':_0x198c4b};};exports[_0xd9ac('0x6')]=function(_0x58434e,_0x43d275){logger[_0xd9ac('0x7')](_0x58434e,util[_0xd9ac('0x8')](_0x43d275,{'showHidden':![],'depth':null}));};exports[_0xd9ac('0x9')]=function(_0x3504ec,_0x477a1c){var _0x362ff7={'XMF-ECM':_0x477a1c[_0xd9ac('0xa')],'XMF-HEADERINFO':_0x477a1c[_0xd9ac('0xb')],'XMF-MINRATE':_0x477a1c[_0xd9ac('0xc')],'XMF-MAXRATE':_0x477a1c[_0xd9ac('0xd')],'XMF-MODEM':util[_0xd9ac('0xe')]('\x22%s\x22',_0x477a1c[_0xd9ac('0xf')]),'XMF-GATEWAY':_0x477a1c[_0xd9ac('0x10')],'XMF-FAXDETECT':_0x477a1c['faxdetect'],'XMF-T38TIMEOUT':_0x477a1c[_0xd9ac('0x11')],'XMF-LOCALSTATIONID':_0x477a1c['localstationid'],'XMF-PATH':_0x3504ec[_0xd9ac('0x12')]};return _0x362ff7;};exports[_0xd9ac('0x13')]=function(_0x5e9eb2,_0x49884e){return{'actionid':_0x5e9eb2[_0xd9ac('0x14')],'action':_0xd9ac('0x15'),'channel':_0x5e9eb2[_0xd9ac('0x16')],'Exten':_0xd9ac('0x17'),'Context':_0xd9ac('0x18'),'Priority':'1','callerid':util[_0xd9ac('0xe')]('\x22%s\x22\x20<%s>',_0x5e9eb2[_0xd9ac('0xb')]?_0x5e9eb2['headerinfo']:'',_0x5e9eb2['localstationid']),'variable':_0x49884e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5e9eb2[_0xd9ac('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index f865eee..ca9f095 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 _0x8cc9=['./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','sync','[index.js][main]','util','moment','./realtime','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory'];(function(_0x29c8db,_0x4bceec){var _0x378a4f=function(_0x37964f){while(--_0x37964f){_0x29c8db['push'](_0x29c8db['shift']());}};_0x378a4f(++_0x4bceec);}(_0x8cc9,0x76));var _0x98cc=function(_0x31603f,_0x5240f3){_0x31603f=_0x31603f-0x0;var _0x4d0d60=_0x8cc9[_0x31603f];return _0x4d0d60;};'use strict';var util=require(_0x98cc('0x0'));var moment=require(_0x98cc('0x1'));var server=require('./server');var Realtime=require(_0x98cc('0x2'));var Report=require('./report');var Acw=require(_0x98cc('0x3'));var Trigger=require(_0x98cc('0x4'));var Dialer=require('./dialer');var Preview=require(_0x98cc('0x5'));var Fax=require(_0x98cc('0x6'));var user=require(_0x98cc('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x98cc('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x98cc('0x9'));var trigger=require(_0x98cc('0xa'));var template=require('./rpc/template');var cmHopperHistory=require(_0x98cc('0xb'));var campaign=require(_0x98cc('0xc'));var voiceExtension=require(_0x98cc('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x98cc('0xe'));var sugarcrm=require(_0x98cc('0xf'));var freshdesk=require(_0x98cc('0x10'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x98cc('0x11'));var freshsales=require(_0x98cc('0x12'));var servicenow=require(_0x98cc('0x13'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x98cc('0x14'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x98cc('0x15')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x98cc('0x15')](_0x98cc('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x98cc('0x17')]()[_0x98cc('0x18')](user[_0x98cc('0x19')]())['then'](realtime[_0x98cc('0x1a')]())[_0x98cc('0x18')](user[_0x98cc('0x1b')]())[_0x98cc('0x18')](realtime['initTelephones']())[_0x98cc('0x18')](trunk['getTrunks']())['then'](realtime['initTrunks']())[_0x98cc('0x18')](voiceQueue[_0x98cc('0x1c')]())['then'](realtime[_0x98cc('0x1d')]())['then'](trigger['getTriggers']())['then'](realtime[_0x98cc('0x1e')]())[_0x98cc('0x18')](template[_0x98cc('0x1f')]())[_0x98cc('0x18')](realtime[_0x98cc('0x20')]())[_0x98cc('0x18')](zendesk[_0x98cc('0x21')]())[_0x98cc('0x18')](realtime[_0x98cc('0x22')]())[_0x98cc('0x18')](salesforce[_0x98cc('0x23')]())[_0x98cc('0x18')](realtime[_0x98cc('0x24')]())[_0x98cc('0x18')](sugarcrm[_0x98cc('0x25')]())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x98cc('0x26')]())[_0x98cc('0x18')](realtime[_0x98cc('0x27')]())[_0x98cc('0x18')](desk['getDeskAccounts']())[_0x98cc('0x18')](realtime[_0x98cc('0x28')]())[_0x98cc('0x18')](zoho[_0x98cc('0x29')]())[_0x98cc('0x18')](realtime['initZohoAccounts']())[_0x98cc('0x18')](vtiger['getVtigerAccounts']())[_0x98cc('0x18')](realtime[_0x98cc('0x2a')]())['then'](freshsales[_0x98cc('0x2b')]())[_0x98cc('0x18')](realtime[_0x98cc('0x2c')]())[_0x98cc('0x18')](servicenow['getServicenowAccounts']())[_0x98cc('0x18')](realtime[_0x98cc('0x2d')]())[_0x98cc('0x18')](dynamics365[_0x98cc('0x2e')]())[_0x98cc('0x18')](realtime[_0x98cc('0x2f')]())['then'](campaign[_0x98cc('0x30')]())[_0x98cc('0x18')](realtime['initCampaigns']())[_0x98cc('0x18')](voiceExtension[_0x98cc('0x31')]())[_0x98cc('0x18')](realtime[_0x98cc('0x32')]())[_0x98cc('0x18')](faxAccount[_0x98cc('0x33')]())[_0x98cc('0x18')](realtime[_0x98cc('0x34')]())[_0x98cc('0x18')](function(){return realtime;});}function initParams(){return Promise[_0x98cc('0x17')]()[_0x98cc('0x18')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x98cc('0x35')]())[_0x98cc('0x18')](cmHopperHistory[_0x98cc('0x36')]())[_0x98cc('0x18')](realtime[_0x98cc('0x37')]())[_0x98cc('0x18')](cmHopperHistory['getCampaignHopperHistory']())[_0x98cc('0x18')](realtime[_0x98cc('0x38')]())[_0x98cc('0x18')](voiceCallReport[_0x98cc('0x39')]())[_0x98cc('0x18')](realtime[_0x98cc('0x3a')]())[_0x98cc('0x3b')](function(_0xfa5ed5){logger[_0x98cc('0x3c')](_0x98cc('0x3d'),util[_0x98cc('0x3e')](_0xfa5ed5,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x98cc('0x18')](function(){return initRealtime();})[_0x98cc('0x18')](function(){return initParams();})[_0x98cc('0x18')](function(){report[_0x98cc('0x3f')]();setInterval(initRealtime,0x1388);})[_0x98cc('0x3b')](function(_0x14aac0){logger[_0x98cc('0x3c')](_0x98cc('0x40'),util['inspect'](_0x14aac0,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x9269=['then','initAgents','getTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','[index.js][main]','moment','./realtime','./report','./trigger','./dialer','./preview','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','ami','hour','get','resolve','getAgents'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9269,0x127));var _0x9926=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0x9269[_0x170772];return _0x3ef69c;};'use strict';var util=require('util');var moment=require(_0x9926('0x0'));var server=require('./server');var Realtime=require(_0x9926('0x1'));var Report=require(_0x9926('0x2'));var Acw=require('./acw');var Trigger=require(_0x9926('0x3'));var Dialer=require(_0x9926('0x4'));var Preview=require(_0x9926('0x5'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x9926('0x6'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x9926('0x7'));var trunk=require(_0x9926('0x8'));var trigger=require(_0x9926('0x9'));var template=require('./rpc/template');var cmHopperHistory=require(_0x9926('0xa'));var campaign=require(_0x9926('0xb'));var voiceExtension=require(_0x9926('0xc'));var faxAccount=require(_0x9926('0xd'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x9926('0xe'));var sugarcrm=require(_0x9926('0xf'));var freshdesk=require(_0x9926('0x10'));var desk=require(_0x9926('0x11'));var zoho=require(_0x9926('0x12'));var vtiger=require(_0x9926('0x13'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x9926('0x14'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x9926('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9926('0x16')](_0x9926('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x9926('0x17')]()['then'](user[_0x9926('0x18')]())[_0x9926('0x19')](realtime[_0x9926('0x1a')]())['then'](user[_0x9926('0x1b')]())['then'](realtime['initTelephones']())[_0x9926('0x19')](trunk['getTrunks']())[_0x9926('0x19')](realtime[_0x9926('0x1c')]())[_0x9926('0x19')](voiceQueue[_0x9926('0x1d')]())[_0x9926('0x19')](realtime[_0x9926('0x1e')]())['then'](trigger['getTriggers']())[_0x9926('0x19')](realtime['initTriggers']())['then'](template[_0x9926('0x1f')]())[_0x9926('0x19')](realtime[_0x9926('0x20')]())[_0x9926('0x19')](zendesk[_0x9926('0x21')]())[_0x9926('0x19')](realtime[_0x9926('0x22')]())[_0x9926('0x19')](salesforce['getSalesforceAccounts']())[_0x9926('0x19')](realtime[_0x9926('0x23')]())[_0x9926('0x19')](sugarcrm[_0x9926('0x24')]())[_0x9926('0x19')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x9926('0x25')]())[_0x9926('0x19')](realtime[_0x9926('0x26')]())[_0x9926('0x19')](desk[_0x9926('0x27')]())['then'](realtime[_0x9926('0x28')]())[_0x9926('0x19')](zoho[_0x9926('0x29')]())['then'](realtime[_0x9926('0x2a')]())[_0x9926('0x19')](vtiger[_0x9926('0x2b')]())['then'](realtime[_0x9926('0x2c')]())[_0x9926('0x19')](freshsales[_0x9926('0x2d')]())[_0x9926('0x19')](realtime[_0x9926('0x2e')]())[_0x9926('0x19')](servicenow[_0x9926('0x2f')]())[_0x9926('0x19')](realtime[_0x9926('0x30')]())[_0x9926('0x19')](dynamics365[_0x9926('0x31')]())[_0x9926('0x19')](realtime['initDynamics365Accounts']())[_0x9926('0x19')](campaign['getCampaigns']())[_0x9926('0x19')](realtime[_0x9926('0x32')]())[_0x9926('0x19')](voiceExtension['getVoiceExtensions']())[_0x9926('0x19')](realtime[_0x9926('0x33')]())[_0x9926('0x19')](faxAccount[_0x9926('0x34')]())[_0x9926('0x19')](realtime[_0x9926('0x35')]())[_0x9926('0x19')](function(){return realtime;});}function initParams(){return Promise[_0x9926('0x17')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x9926('0x19')](realtime[_0x9926('0x36')]())[_0x9926('0x19')](cmHopperHistory[_0x9926('0x37')]())[_0x9926('0x19')](realtime[_0x9926('0x38')]())['then'](cmHopperHistory[_0x9926('0x39')]())[_0x9926('0x19')](realtime['initCampaignHopperHistory']())[_0x9926('0x19')](voiceCallReport[_0x9926('0x3a')]())[_0x9926('0x19')](realtime[_0x9926('0x3b')]())[_0x9926('0x3c')](function(_0x3cd34f){logger[_0x9926('0x3d')]('[index.js][initParams]',util[_0x9926('0x3e')](_0x3cd34f,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x9926('0x19')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x9926('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x9926('0x3c')](function(_0x3b7e3c){logger[_0x9926('0x3d')](_0x9926('0x3f'),util[_0x9926('0x3e')](_0x3b7e3c,{'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 d317e13..a87a84f 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 _0xd93a=['idle','inuse','talking','voiceStatusQueue','format','emit','user:save','user:presence','exports','lodash','util','md5','ioredis','../../../config/environment','redis','localhost','name','email','accountcode','fullname','state','unknown','status','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime'];(function(_0x12fef5,_0x5a4506){var _0x55bc75=function(_0x13a85e){while(--_0x13a85e){_0x12fef5['push'](_0x12fef5['shift']());}};_0x55bc75(++_0x5a4506);}(_0xd93a,0x91));var _0xad93=function(_0x3e61cc,_0x325f70){_0x3e61cc=_0x3e61cc-0x0;var _0x1b05e6=_0xd93a[_0x3e61cc];return _0x1b05e6;};'use strict';var _=require(_0xad93('0x0'));var util=require(_0xad93('0x1'));var moment=require('moment');var md5=require(_0xad93('0x2'));var Redis=require(_0xad93('0x3'));var config=require(_0xad93('0x4'));config[_0xad93('0x5')]=_['defaults'](config[_0xad93('0x5')],{'host':_0xad93('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xad93('0x5')]));function Agent(_0x820a93){this['id']=_0x820a93['id']||0x0;this[_0xad93('0x7')]=_0x820a93[_0xad93('0x7')]||'';this[_0xad93('0x8')]=_0x820a93['email']||'';this[_0xad93('0x9')]=_0x820a93[_0xad93('0x9')]||'';this[_0xad93('0xa')]=_0x820a93[_0xad93('0xa')]||'';this[_0xad93('0xb')]=_0xad93('0xc');this['stateTime']=0x0;this[_0xad93('0xd')]='unknown';this[_0xad93('0xe')]='';this['phone']='';this[_0xad93('0xf')]='';this[_0xad93('0x10')]='';this['online']=_0x820a93[_0xad93('0x11')]||![];this[_0xad93('0x12')]='unknown';this[_0xad93('0x13')]=0x0;this[_0xad93('0x14')]='';this['voiceStatusQueue']='';this[_0xad93('0x15')]=![];this[_0xad93('0x16')]=![];this['md5']='';}Agent[_0xad93('0x17')][_0xad93('0x18')]=function(_0x5b1493){var _0x59c499;if(_0x5b1493&&_0x5b1493[_0xad93('0xb')]){_0x59c499=_0x5b1493[_0xad93('0xb')]['toLowerCase']();switch(_0x59c499){case'not_inuse':_0x59c499=_0xad93('0x19');break;case _0xad93('0x1a'):_0x59c499=_0xad93('0x1b');break;}}if(_0x59c499&&this['voiceStatus']!==_0x59c499||_0x5b1493['statePause']){this[_0xad93('0x13')]=_['toNumber'](moment()['format']('x'));}if(_0x59c499){this[_0xad93('0x12')]=_0x59c499;}var _0x32767b={'id':this['id'],'name':this['name'],'email':this[_0xad93('0x8')],'accountcode':this['accountcode'],'fullname':this[_0xad93('0xa')],'state':this['state'],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0xad93('0xe')],'online':this[_0xad93('0x11')],'voiceStatus':this[_0xad93('0x12')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xad93('0x1c')],'interface':this['interface'],'onhold':this[_0xad93('0x15')]};var _0x1c0cf9=md5(JSON['stringify'](_0x32767b));if(this['md5']!==_0x1c0cf9){this[_0xad93('0x2')]=_0x1c0cf9;io['to'](util[_0xad93('0x1d')]('user:%s',_0x32767b[_0xad93('0x7')]))[_0xad93('0x1e')](_0xad93('0x1f'),_0x32767b);io[_0xad93('0x1e')](_0xad93('0x20'),_0x32767b);}};module[_0xad93('0x21')]=Agent; \ No newline at end of file +var _0x86bc=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','interface','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','not_inuse','idle','inuse','talking','statePause','format','online','stringify','emit','user:save','user:presence','exports','lodash','moment','md5'];(function(_0x193cf2,_0x3ddfb9){var _0x480a51=function(_0x23ae8f){while(--_0x23ae8f){_0x193cf2['push'](_0x193cf2['shift']());}};_0x480a51(++_0x3ddfb9);}(_0x86bc,0x19f));var _0xc86b=function(_0x465dce,_0x449c3e){_0x465dce=_0x465dce-0x0;var _0x41781a=_0x86bc[_0x465dce];return _0x41781a;};'use strict';var _=require(_0xc86b('0x0'));var util=require('util');var moment=require(_0xc86b('0x1'));var md5=require(_0xc86b('0x2'));var Redis=require('ioredis');var config=require(_0xc86b('0x3'));config[_0xc86b('0x4')]=_[_0xc86b('0x5')](config[_0xc86b('0x4')],{'host':_0xc86b('0x6'),'port':0x18eb});var io=require(_0xc86b('0x7'))(new Redis(config[_0xc86b('0x4')]));function Agent(_0x5a29b6){this['id']=_0x5a29b6['id']||0x0;this['name']=_0x5a29b6[_0xc86b('0x8')]||'';this['email']=_0x5a29b6[_0xc86b('0x9')]||'';this[_0xc86b('0xa')]=_0x5a29b6['accountcode']||'';this['fullname']=_0x5a29b6[_0xc86b('0xb')]||'';this['state']=_0xc86b('0xc');this[_0xc86b('0xd')]=0x0;this[_0xc86b('0xe')]=_0xc86b('0xc');this[_0xc86b('0xf')]='';this['phone']='';this['mobile']='';this[_0xc86b('0x10')]='';this['online']=_0x5a29b6['online']||![];this[_0xc86b('0x11')]=_0xc86b('0xc');this[_0xc86b('0x12')]=0x0;this[_0xc86b('0x13')]='';this[_0xc86b('0x14')]='';this[_0xc86b('0x15')]=![];this[_0xc86b('0x16')]=![];this[_0xc86b('0x2')]='';}Agent[_0xc86b('0x17')][_0xc86b('0x18')]=function(_0x58b5f3){var _0x990557;if(_0x58b5f3&&_0x58b5f3[_0xc86b('0x19')]){_0x990557=_0x58b5f3[_0xc86b('0x19')]['toLowerCase']();switch(_0x990557){case _0xc86b('0x1a'):_0x990557=_0xc86b('0x1b');break;case _0xc86b('0x1c'):_0x990557=_0xc86b('0x1d');break;}}if(_0x990557&&this[_0xc86b('0x11')]!==_0x990557||_0x58b5f3[_0xc86b('0x1e')]){this[_0xc86b('0x12')]=_['toNumber'](moment()[_0xc86b('0x1f')]('x'));}if(_0x990557){this[_0xc86b('0x11')]=_0x990557;}var _0x2118ef={'id':this['id'],'name':this[_0xc86b('0x8')],'email':this['email'],'accountcode':this[_0xc86b('0xa')],'fullname':this[_0xc86b('0xb')],'state':this[_0xc86b('0x19')],'stateTime':this[_0xc86b('0xd')],'status':this[_0xc86b('0xe')],'address':this[_0xc86b('0xf')],'online':this[_0xc86b('0x20')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xc86b('0x13')],'voiceStatusQueue':this[_0xc86b('0x14')],'interface':this[_0xc86b('0x10')],'onhold':this[_0xc86b('0x15')]};var _0x20a556=md5(JSON[_0xc86b('0x21')](_0x2118ef));if(this[_0xc86b('0x2')]!==_0x20a556){this['md5']=_0x20a556;io['to'](util['format']('user:%s',_0x2118ef[_0xc86b('0x8')]))[_0xc86b('0x22')](_0xc86b('0x23'),_0x2118ef);io[_0xc86b('0x22')](_0xc86b('0x24'),_0x2118ef);}};module[_0xc86b('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index d5096ca..1f1aa79 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 _0xae61=['temp','ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type'];(function(_0x4dfec4,_0x49a6cb){var _0x1f7ba8=function(_0x40184b){while(--_0x40184b){_0x4dfec4['push'](_0x4dfec4['shift']());}};_0x1f7ba8(++_0x49a6cb);}(_0xae61,0x1a5));var _0x1ae6=function(_0x3a6cb4,_0x31ae70){_0x3a6cb4=_0x3a6cb4-0x0;var _0xb5a45e=_0xae61[_0x3a6cb4];return _0xb5a45e;};'use strict';function Campaign(_0x19918e){this['id']=_0x19918e['id']||0x0;this[_0x1ae6('0x0')]=_0x19918e['name']||'';this[_0x1ae6('0x1')]=_0x19918e['type']||'campaign';this['originated']=0x0;this[_0x1ae6('0x2')]=0x0;this[_0x1ae6('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x1ae6('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0x1ae6('0x5')]=_0x19918e[_0x1ae6('0x5')];this[_0x1ae6('0x6')]=_0x19918e['limitCalls'];this[_0x1ae6('0x7')]=_0x19918e['dialTimezone']||null;this[_0x1ae6('0x8')]=_0x19918e[_0x1ae6('0x8')]?_0x19918e[_0x1ae6('0x8')]:null;this[_0x1ae6('0x9')]=_0x19918e[_0x1ae6('0x9')];this[_0x1ae6('0xa')]=_0x19918e[_0x1ae6('0xa')];this[_0x1ae6('0xb')]=_0x19918e[_0x1ae6('0xb')]||0x1e;this[_0x1ae6('0xc')]=_0x19918e[_0x1ae6('0xc')];this['dialCongestionRetryFrequency']=_0x19918e[_0x1ae6('0xd')];this['dialBusyMaxRetry']=_0x19918e[_0x1ae6('0xe')];this[_0x1ae6('0xf')]=_0x19918e[_0x1ae6('0xf')];this['dialNoAnswerMaxRetry']=_0x19918e['dialNoAnswerMaxRetry'];this[_0x1ae6('0x10')]=_0x19918e[_0x1ae6('0x10')];this[_0x1ae6('0x11')]=_0x19918e[_0x1ae6('0x11')];this[_0x1ae6('0x12')]=_0x19918e[_0x1ae6('0x12')]||0x3;this[_0x1ae6('0x13')]=_0x19918e['dialNoSuchNumberRetryFrequency']||0x96;this[_0x1ae6('0x14')]=_0x19918e['dialDropMaxRetry']||0x3;this[_0x1ae6('0x15')]=_0x19918e[_0x1ae6('0x15')]||0x96;this['dialAbandonedMaxRetry']=_0x19918e[_0x1ae6('0x16')]||0x3;this[_0x1ae6('0x17')]=_0x19918e[_0x1ae6('0x17')]||0x96;this['dialMachineMaxRetry']=_0x19918e[_0x1ae6('0x18')]||0x3;this[_0x1ae6('0x19')]=_0x19918e['dialMachineRetryFrequency']||0x96;this[_0x1ae6('0x1a')]=_0x19918e[_0x1ae6('0x1a')]||0x3;this[_0x1ae6('0x1b')]=_0x19918e[_0x1ae6('0x1b')]||0x96;this['dialOrderByScheduledAt']=_0x19918e['dialOrderByScheduledAt']||_0x1ae6('0x1c');this[_0x1ae6('0x1d')]=_0x19918e[_0x1ae6('0x1d')]||undefined;this[_0x1ae6('0x1e')]=_0x19918e[_0x1ae6('0x1e')]||undefined;this['dialCutDigit']=_0x19918e[_0x1ae6('0x1f')]||undefined;this[_0x1ae6('0x20')]=_0x19918e['TrunkBackup']?_0x19918e[_0x1ae6('0x20')]:undefined;this['Trunk']=_0x19918e[_0x1ae6('0x21')]?_0x19918e[_0x1ae6('0x21')]:undefined;this[_0x1ae6('0x22')]=_0x19918e[_0x1ae6('0x22')]?_0x19918e[_0x1ae6('0x22')]:undefined;this[_0x1ae6('0x23')]=_0x19918e['SquareProject']?_0x19918e[_0x1ae6('0x23')]:undefined;this[_0x1ae6('0x24')]=_0x19918e[_0x1ae6('0x23')]?_0x19918e[_0x1ae6('0x23')][_0x1ae6('0x0')]:undefined;this[_0x1ae6('0x25')]=_0x19918e[_0x1ae6('0x25')]||![];this['dialAMDInitialSilence']=_0x19918e['dialAMDInitialSilence'];this[_0x1ae6('0x26')]=_0x19918e[_0x1ae6('0x26')];this[_0x1ae6('0x27')]=_0x19918e[_0x1ae6('0x27')];this[_0x1ae6('0x28')]=_0x19918e['dialAMDTotalAnalysisTime'];this[_0x1ae6('0x29')]=_0x19918e[_0x1ae6('0x29')];this[_0x1ae6('0x2a')]=_0x19918e[_0x1ae6('0x2a')];this[_0x1ae6('0x2b')]=_0x19918e[_0x1ae6('0x2b')];this[_0x1ae6('0x2c')]=_0x19918e[_0x1ae6('0x2c')];this[_0x1ae6('0x2d')]=_0x19918e['dialAMDMaximumWordLength'];}module[_0x1ae6('0x2e')]=Campaign; \ No newline at end of file +var _0xf089=['type','originated','temp','ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name'];(function(_0x1e68bb,_0x389857){var _0x22a1de=function(_0x3da02c){while(--_0x3da02c){_0x1e68bb['push'](_0x1e68bb['shift']());}};_0x22a1de(++_0x389857);}(_0xf089,0xe0));var _0x9f08=function(_0x3c3b01,_0x411554){_0x3c3b01=_0x3c3b01-0x0;var _0x1138cc=_0xf089[_0x3c3b01];return _0x1138cc;};'use strict';function Campaign(_0x4d79ee){this['id']=_0x4d79ee['id']||0x0;this[_0x9f08('0x0')]=_0x4d79ee['name']||'';this[_0x9f08('0x1')]=_0x4d79ee[_0x9f08('0x1')]||'campaign';this[_0x9f08('0x2')]=0x0;this[_0x9f08('0x3')]=0x0;this[_0x9f08('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x9f08('0x5')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x4d79ee[_0x9f08('0x6')];this['limitCalls']=_0x4d79ee[_0x9f08('0x7')];this[_0x9f08('0x8')]=_0x4d79ee[_0x9f08('0x8')]||null;this['dialGlobalInterval']=_0x4d79ee['dialGlobalInterval']?_0x4d79ee['dialGlobalInterval']:null;this[_0x9f08('0x9')]=_0x4d79ee[_0x9f08('0x9')];this[_0x9f08('0xa')]=_0x4d79ee[_0x9f08('0xa')];this[_0x9f08('0xb')]=_0x4d79ee[_0x9f08('0xb')]||0x1e;this[_0x9f08('0xc')]=_0x4d79ee[_0x9f08('0xc')];this[_0x9f08('0xd')]=_0x4d79ee[_0x9f08('0xd')];this['dialBusyMaxRetry']=_0x4d79ee[_0x9f08('0xe')];this[_0x9f08('0xf')]=_0x4d79ee[_0x9f08('0xf')];this[_0x9f08('0x10')]=_0x4d79ee[_0x9f08('0x10')];this['dialNoAnswerRetryFrequency']=_0x4d79ee['dialNoAnswerRetryFrequency'];this[_0x9f08('0x11')]=_0x4d79ee[_0x9f08('0x11')];this[_0x9f08('0x12')]=_0x4d79ee['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4d79ee['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x4d79ee[_0x9f08('0x13')]||0x3;this['dialDropRetryFrequency']=_0x4d79ee['dialDropRetryFrequency']||0x96;this[_0x9f08('0x14')]=_0x4d79ee[_0x9f08('0x14')]||0x3;this[_0x9f08('0x15')]=_0x4d79ee[_0x9f08('0x15')]||0x96;this[_0x9f08('0x16')]=_0x4d79ee[_0x9f08('0x16')]||0x3;this[_0x9f08('0x17')]=_0x4d79ee[_0x9f08('0x17')]||0x96;this[_0x9f08('0x18')]=_0x4d79ee[_0x9f08('0x18')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4d79ee[_0x9f08('0x19')]||0x96;this[_0x9f08('0x1a')]=_0x4d79ee['dialOrderByScheduledAt']||_0x9f08('0x1b');this['dialPrefix']=_0x4d79ee[_0x9f08('0x1c')]||undefined;this[_0x9f08('0x1d')]=_0x4d79ee[_0x9f08('0x1d')]||undefined;this[_0x9f08('0x1e')]=_0x4d79ee[_0x9f08('0x1e')]||undefined;this[_0x9f08('0x1f')]=_0x4d79ee[_0x9f08('0x1f')]?_0x4d79ee['TrunkBackup']:undefined;this[_0x9f08('0x20')]=_0x4d79ee['Trunk']?_0x4d79ee[_0x9f08('0x20')]:undefined;this[_0x9f08('0x21')]=_0x4d79ee['Interval']?_0x4d79ee[_0x9f08('0x21')]:undefined;this[_0x9f08('0x22')]=_0x4d79ee[_0x9f08('0x22')]?_0x4d79ee[_0x9f08('0x22')]:undefined;this[_0x9f08('0x23')]=_0x4d79ee['SquareProject']?_0x4d79ee[_0x9f08('0x22')][_0x9f08('0x0')]:undefined;this[_0x9f08('0x24')]=_0x4d79ee[_0x9f08('0x24')]||![];this[_0x9f08('0x25')]=_0x4d79ee[_0x9f08('0x25')];this[_0x9f08('0x26')]=_0x4d79ee['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x4d79ee['dialAMDAfterGreetingSilence'];this[_0x9f08('0x27')]=_0x4d79ee[_0x9f08('0x27')];this['dialAMDMinWordLength']=_0x4d79ee['dialAMDMinWordLength'];this[_0x9f08('0x28')]=_0x4d79ee[_0x9f08('0x28')];this[_0x9f08('0x29')]=_0x4d79ee[_0x9f08('0x29')];this[_0x9f08('0x2a')]=_0x4d79ee['dialAMDSilenceThreshold'];this[_0x9f08('0x2b')]=_0x4d79ee['dialAMDMaximumWordLength'];}module[_0x9f08('0x2c')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index b2ecc35..49ff44b 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 _0x14d8=['connectedlinenum','accountcode','exten','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname'];(function(_0x1d0499,_0x23e22f){var _0x153fb3=function(_0x40c19c){while(--_0x40c19c){_0x1d0499['push'](_0x1d0499['shift']());}};_0x153fb3(++_0x23e22f);}(_0x14d8,0x87));var _0x814d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x14d8[_0x465028];return _0xb783d4;};'use strict';function Channel(){this[_0x814d('0x0')]=null;this[_0x814d('0x1')]='';this[_0x814d('0x2')]='';this[_0x814d('0x3')]=0x0;this[_0x814d('0x4')]='';this[_0x814d('0x5')]=undefined;this['connectedlinename']=undefined;this[_0x814d('0x6')]=0x0;this['context']='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x814d('0x7')]=0x0;this[_0x814d('0x8')]=![];this[_0x814d('0x9')]=null;this['endtime']=null;this[_0x814d('0xa')]=![];this[_0x814d('0xb')]=![];this[_0x814d('0xc')]='';this[_0x814d('0xd')]='';this[_0x814d('0xe')]=0x0;this[_0x814d('0xf')]=0x0;this[_0x814d('0x10')]=0x0;this['type']=null;this[_0x814d('0x11')]=null;this[_0x814d('0x12')]=null;this[_0x814d('0x13')]=![];this[_0x814d('0x14')]=null;this[_0x814d('0x15')]=null;this[_0x814d('0x16')]=[];this[_0x814d('0x17')]=undefined;this[_0x814d('0x18')]=undefined;this[_0x814d('0x19')]=undefined;this[_0x814d('0x1a')]=0x0;}module[_0x814d('0x1b')]=Channel; \ No newline at end of file +var _0xb477=['lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferType','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned'];(function(_0x1dee54,_0x21fdbf){var _0x3a319d=function(_0x10724c){while(--_0x10724c){_0x1dee54['push'](_0x1dee54['shift']());}};_0x3a319d(++_0x21fdbf);}(_0xb477,0x8f));var _0x7b47=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xb477[_0x18ab2a];return _0x16dcee;};'use strict';function Channel(){this['starttime']=null;this[_0x7b47('0x0')]='';this[_0x7b47('0x1')]='';this[_0x7b47('0x2')]=0x0;this['calleridname']='';this[_0x7b47('0x3')]=undefined;this[_0x7b47('0x4')]=undefined;this[_0x7b47('0x5')]=0x0;this['context']='';this[_0x7b47('0x6')]=0x0;this[_0x7b47('0x7')]=0x0;this[_0x7b47('0x8')]=0x0;this[_0x7b47('0x9')]=![];this[_0x7b47('0xa')]=null;this['endtime']=null;this[_0x7b47('0xb')]=![];this[_0x7b47('0xc')]=![];this['lastapplication']='';this[_0x7b47('0xd')]='';this[_0x7b47('0xe')]=0x0;this[_0x7b47('0xf')]=0x0;this[_0x7b47('0x10')]=0x0;this[_0x7b47('0x11')]=null;this[_0x7b47('0x12')]=null;this[_0x7b47('0x13')]=null;this[_0x7b47('0x14')]=![];this[_0x7b47('0x15')]=null;this[_0x7b47('0x16')]=null;this[_0x7b47('0x17')]=[];this[_0x7b47('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x7b47('0x19')]=undefined;this['mohtime']=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 a1eccbc..3a8cc18 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 _0x61e1=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerSecret'];(function(_0x1dc4cb,_0x1c8fe5){var _0x20333c=function(_0x268961){while(--_0x268961){_0x1dc4cb['push'](_0x1dc4cb['shift']());}};_0x20333c(++_0x1c8fe5);}(_0x61e1,0x1b6));var _0x161e=function(_0x2605be,_0x335d88){_0x2605be=_0x2605be-0x0;var _0x593cf9=_0x61e1[_0x2605be];return _0x593cf9;};'use strict';function DeskAccount(_0x5d36ff){this['id']=_0x5d36ff['id']||0x0;this['name']=_0x5d36ff[_0x161e('0x0')]||'';this[_0x161e('0x1')]=_0x5d36ff['username']||'';this['remoteUri']=_0x5d36ff[_0x161e('0x2')]||'';this[_0x161e('0x3')]=_0x5d36ff[_0x161e('0x3')]||'';this['password']=_0x5d36ff[_0x161e('0x4')]||'';this['consumerKey']=_0x5d36ff['consumerKey']||'';this[_0x161e('0x5')]=_0x5d36ff[_0x161e('0x5')]||'';this[_0x161e('0x6')]=_0x5d36ff['token']||'';this['tokenSecret']=_0x5d36ff[_0x161e('0x7')]||'';this[_0x161e('0x8')]=_0x5d36ff[_0x161e('0x8')]||'';this['serverUrl']=_0x5d36ff[_0x161e('0x9')]||'';this[_0x161e('0xa')]=_0x5d36ff['Configurations']||{};}module[_0x161e('0xb')]=DeskAccount; \ No newline at end of file +var _0x5e80=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x53c8b5,_0x5ce538){var _0x1fecac=function(_0x5506d2){while(--_0x5506d2){_0x53c8b5['push'](_0x53c8b5['shift']());}};_0x1fecac(++_0x5ce538);}(_0x5e80,0x190));var _0x05e8=function(_0x1309cc,_0x30970e){_0x1309cc=_0x1309cc-0x0;var _0x5958c3=_0x5e80[_0x1309cc];return _0x5958c3;};'use strict';function DeskAccount(_0x2535f9){this['id']=_0x2535f9['id']||0x0;this['name']=_0x2535f9[_0x05e8('0x0')]||'';this[_0x05e8('0x1')]=_0x2535f9[_0x05e8('0x1')]||'';this['remoteUri']=_0x2535f9[_0x05e8('0x2')]||'';this[_0x05e8('0x3')]=_0x2535f9['authType']||'';this['password']=_0x2535f9['password']||'';this[_0x05e8('0x4')]=_0x2535f9[_0x05e8('0x4')]||'';this[_0x05e8('0x5')]=_0x2535f9[_0x05e8('0x5')]||'';this[_0x05e8('0x6')]=_0x2535f9[_0x05e8('0x6')]||'';this[_0x05e8('0x7')]=_0x2535f9[_0x05e8('0x7')]||'';this[_0x05e8('0x8')]=_0x2535f9['type']||'';this[_0x05e8('0x9')]=_0x2535f9[_0x05e8('0x9')]||'';this[_0x05e8('0xa')]=_0x2535f9['Configurations']||{};}module[_0x05e8('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 366ad38..b33ef1f 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 _0x29a0=['modernAuthentication','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x46fae8,_0x4f5cd3){var _0x5c80b5=function(_0x160770){while(--_0x160770){_0x46fae8['push'](_0x46fae8['shift']());}};_0x5c80b5(++_0x4f5cd3);}(_0x29a0,0xb3));var _0x029a=function(_0x1165e3,_0x23e2ab){_0x1165e3=_0x1165e3-0x0;var _0xf19867=_0x29a0[_0x1165e3];return _0xf19867;};'use strict';function Dynamics365Account(_0x2cb4dc){this['id']=_0x2cb4dc['id']||0x0;this['name']=_0x2cb4dc[_0x029a('0x0')]||'';this['username']=_0x2cb4dc[_0x029a('0x1')]||'';this[_0x029a('0x2')]=_0x2cb4dc['password']||'';this[_0x029a('0x3')]=_0x2cb4dc[_0x029a('0x3')]||'';this[_0x029a('0x4')]=_0x2cb4dc['tenantId']||'';this[_0x029a('0x5')]=_0x2cb4dc[_0x029a('0x5')]||'';this['clientSecret']=_0x2cb4dc[_0x029a('0x6')]||{};this[_0x029a('0x7')]=_0x2cb4dc[_0x029a('0x7')]||'';this[_0x029a('0x8')]=_0x2cb4dc[_0x029a('0x8')]||![];this[_0x029a('0x9')]=_0x2cb4dc[_0x029a('0x9')]||{};this['CloudProvider']=_0x2cb4dc['CloudProvider']||{};}module[_0x029a('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xfb9e=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','CloudProvider'];(function(_0x3f13bf,_0x3f6748){var _0x30ae22=function(_0x4886ae){while(--_0x4886ae){_0x3f13bf['push'](_0x3f13bf['shift']());}};_0x30ae22(++_0x3f6748);}(_0xfb9e,0xbc));var _0xefb9=function(_0x1b9629,_0x5554b4){_0x1b9629=_0x1b9629-0x0;var _0x4ade3a=_0xfb9e[_0x1b9629];return _0x4ade3a;};'use strict';function Dynamics365Account(_0x4661fa){this['id']=_0x4661fa['id']||0x0;this[_0xefb9('0x0')]=_0x4661fa[_0xefb9('0x0')]||'';this[_0xefb9('0x1')]=_0x4661fa['username']||'';this[_0xefb9('0x2')]=_0x4661fa[_0xefb9('0x2')]||'';this[_0xefb9('0x3')]=_0x4661fa['remoteUri']||'';this[_0xefb9('0x4')]=_0x4661fa['tenantId']||'';this[_0xefb9('0x5')]=_0x4661fa['clientId']||'';this[_0xefb9('0x6')]=_0x4661fa['clientSecret']||{};this['serverUrl']=_0x4661fa[_0xefb9('0x7')]||'';this[_0xefb9('0x8')]=_0x4661fa[_0xefb9('0x8')]||![];this['Configurations']=_0x4661fa['Configurations']||{};this[_0xefb9('0x9')]=_0x4661fa[_0xefb9('0x9')]||{};}module[_0xefb9('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index a038726..ae7cb13 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 _0x596e=['key','description','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x5061b9,_0x331b0c){var _0x27cba4=function(_0x4f3606){while(--_0x4f3606){_0x5061b9['push'](_0x5061b9['shift']());}};_0x27cba4(++_0x331b0c);}(_0x596e,0x16d));var _0xe596=function(_0x3fec3b,_0x1ea9cc){_0x3fec3b=_0x3fec3b-0x0;var _0x260577=_0x596e[_0x3fec3b];return _0x260577;};'use strict';function FaxAccount(_0x56b779){this['id']=_0x56b779['id']||0x0;this['name']=_0x56b779['name']||'';this[_0xe596('0x0')]=_0x56b779[_0xe596('0x0')];this['ecm']=_0x56b779['ecm'];this[_0xe596('0x1')]=_0x56b779['headerinfo'];this[_0xe596('0x2')]=_0x56b779[_0xe596('0x2')];this[_0xe596('0x3')]=_0x56b779['minrate']||0x960;this[_0xe596('0x4')]=_0x56b779[_0xe596('0x4')]||0x3840;this[_0xe596('0x5')]=_0x56b779[_0xe596('0x5')]||_0xe596('0x6');this[_0xe596('0x7')]=_0x56b779[_0xe596('0x7')]||'no';this['faxdetect']=_0x56b779['faxdetect']||'no';this[_0xe596('0x8')]=_0x56b779['t38timeout']||0x1388;this[_0xe596('0x9')]=_0x56b779[_0xe596('0x9')]||_0xe596('0xa');this[_0xe596('0xb')]=_0x56b779['Trunk']?_0x56b779['Trunk']:undefined;this[_0xe596('0xc')]=_0x56b779[_0xe596('0xc')];this[_0xe596('0xd')]=_0x56b779[_0xe596('0xd')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x0ff0=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','key','exports','name','description'];(function(_0x28e24b,_0x3a39a1){var _0x408dc7=function(_0x596b7c){while(--_0x596b7c){_0x28e24b['push'](_0x28e24b['shift']());}};_0x408dc7(++_0x3a39a1);}(_0x0ff0,0x75));var _0x00ff=function(_0x10a76d,_0x4f542a){_0x10a76d=_0x10a76d-0x0;var _0x15cd8e=_0x0ff0[_0x10a76d];return _0x15cd8e;};'use strict';function FaxAccount(_0x190e44){this['id']=_0x190e44['id']||0x0;this[_0x00ff('0x0')]=_0x190e44['name']||'';this[_0x00ff('0x1')]=_0x190e44['description'];this[_0x00ff('0x2')]=_0x190e44[_0x00ff('0x2')];this['headerinfo']=_0x190e44[_0x00ff('0x3')];this[_0x00ff('0x4')]=_0x190e44[_0x00ff('0x4')];this[_0x00ff('0x5')]=_0x190e44[_0x00ff('0x5')]||0x960;this[_0x00ff('0x6')]=_0x190e44[_0x00ff('0x6')]||0x3840;this[_0x00ff('0x7')]=_0x190e44[_0x00ff('0x7')]||_0x00ff('0x8');this[_0x00ff('0x9')]=_0x190e44[_0x00ff('0x9')]||'no';this['faxdetect']=_0x190e44[_0x00ff('0xa')]||'no';this['t38timeout']=_0x190e44[_0x00ff('0xb')]||0x1388;this[_0x00ff('0xc')]=_0x190e44[_0x00ff('0xc')]||_0x00ff('0xd');this[_0x00ff('0xe')]=_0x190e44[_0x00ff('0xe')]?_0x190e44['Trunk']:undefined;this['ListId']=_0x190e44['ListId'];this[_0x00ff('0xf')]=_0x190e44[_0x00ff('0xf')];}module[_0x00ff('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index cef92ad..1b37bab 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 _0xb844=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x4e3da2,_0x2780b2){var _0x497df4=function(_0x32651e){while(--_0x32651e){_0x4e3da2['push'](_0x4e3da2['shift']());}};_0x497df4(++_0x2780b2);}(_0xb844,0x1bd));var _0x4b84=function(_0x55cff0,_0x465259){_0x55cff0=_0x55cff0-0x0;var _0x51c6c9=_0xb844[_0x55cff0];return _0x51c6c9;};'use strict';function FreshdeskAccount(_0x2cb42a){this['id']=_0x2cb42a['id']||0x0;this[_0x4b84('0x0')]=_0x2cb42a[_0x4b84('0x0')]||'';this[_0x4b84('0x1')]=_0x2cb42a[_0x4b84('0x1')]||'';this['apiKey']=_0x2cb42a[_0x4b84('0x2')]||'';this[_0x4b84('0x3')]=_0x2cb42a[_0x4b84('0x3')]||'';this[_0x4b84('0x4')]=_0x2cb42a[_0x4b84('0x4')]||'';this[_0x4b84('0x5')]=_0x2cb42a[_0x4b84('0x5')]||{};}module[_0x4b84('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x21d9=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x44a399,_0x5127a2){var _0x5218cd=function(_0x444e11){while(--_0x444e11){_0x44a399['push'](_0x44a399['shift']());}};_0x5218cd(++_0x5127a2);}(_0x21d9,0xb9));var _0x921d=function(_0x2679b0,_0x2a1a6f){_0x2679b0=_0x2679b0-0x0;var _0x192302=_0x21d9[_0x2679b0];return _0x192302;};'use strict';function FreshdeskAccount(_0x8a3598){this['id']=_0x8a3598['id']||0x0;this[_0x921d('0x0')]=_0x8a3598[_0x921d('0x0')]||'';this[_0x921d('0x1')]=_0x8a3598[_0x921d('0x1')]||'';this['apiKey']=_0x8a3598['token']||'';this[_0x921d('0x2')]=_0x8a3598[_0x921d('0x2')]||'';this[_0x921d('0x3')]=_0x8a3598[_0x921d('0x3')]||'';this['Configurations']=_0x8a3598[_0x921d('0x4')]||{};}module[_0x921d('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 359dc9e..ebbe15c 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 _0x31af=['name','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x31af,0xde));var _0xf31a=function(_0xb5586,_0x4793c3){_0xb5586=_0xb5586-0x0;var _0x284ad0=_0x31af[_0xb5586];return _0x284ad0;};'use strict';function FreshsalesAccount(_0x3c3137){this['id']=_0x3c3137['id']||0x0;this[_0xf31a('0x0')]=_0x3c3137[_0xf31a('0x0')]||'';this['username']=_0x3c3137['username']||'';this[_0xf31a('0x1')]=_0x3c3137['token']||'';this[_0xf31a('0x2')]=_0x3c3137[_0xf31a('0x2')]||'';this[_0xf31a('0x3')]=_0x3c3137[_0xf31a('0x3')]||'';this['Configurations']=_0x3c3137[_0xf31a('0x4')]||{};}module[_0xf31a('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x23ea=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x24f3d3,_0xb13780){var _0x2b9655=function(_0xc08d16){while(--_0xc08d16){_0x24f3d3['push'](_0x24f3d3['shift']());}};_0x2b9655(++_0xb13780);}(_0x23ea,0xc3));var _0xa23e=function(_0x2ff022,_0x183a9c){_0x2ff022=_0x2ff022-0x0;var _0x1cbaa5=_0x23ea[_0x2ff022];return _0x1cbaa5;};'use strict';function FreshsalesAccount(_0xb91cc){this['id']=_0xb91cc['id']||0x0;this[_0xa23e('0x0')]=_0xb91cc[_0xa23e('0x0')]||'';this[_0xa23e('0x1')]=_0xb91cc[_0xa23e('0x1')]||'';this[_0xa23e('0x2')]=_0xb91cc[_0xa23e('0x3')]||'';this[_0xa23e('0x4')]=_0xb91cc[_0xa23e('0x4')]||'';this[_0xa23e('0x5')]=_0xb91cc[_0xa23e('0x5')]||'';this['Configurations']=_0xb91cc[_0xa23e('0x6')]||{};}module[_0xa23e('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 067f97b..a8bf214 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 _0xa3a7=['routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice'];(function(_0x4cff4f,_0x14ba4f){var _0x5d9275=function(_0x402678){while(--_0x402678){_0x4cff4f['push'](_0x4cff4f['shift']());}};_0x5d9275(++_0x14ba4f);}(_0xa3a7,0x100));var _0x7a3a=function(_0x125016,_0x17a721){_0x125016=_0x125016-0x0;var _0x35f491=_0xa3a7[_0x125016];return _0x35f491;};'use strict';function QueueReport(){this[_0x7a3a('0x0')]=_0x7a3a('0x1');this[_0x7a3a('0x2')]='';this[_0x7a3a('0x3')]='';this[_0x7a3a('0x4')]='';this[_0x7a3a('0x5')]='';this[_0x7a3a('0x6')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x7a3a('0x7')]=0x1;this[_0x7a3a('0x8')]=![];this[_0x7a3a('0x9')]=null;this[_0x7a3a('0xa')]=![];this[_0x7a3a('0xb')]=null;this['queuecallerexit']=![];this[_0x7a3a('0xc')]=null;this[_0x7a3a('0xd')]=0x1;this['channel']='';this[_0x7a3a('0xe')]='';this[_0x7a3a('0xf')]='';this['accountcode']='';this[_0x7a3a('0x10')]='';this[_0x7a3a('0x11')]='';this[_0x7a3a('0x12')]='';this[_0x7a3a('0x13')]=0x0;this[_0x7a3a('0x14')]=![];this[_0x7a3a('0x15')]='';this[_0x7a3a('0x16')]=_0x7a3a('0x17');this[_0x7a3a('0x18')]=null;this[_0x7a3a('0x19')]=0x0;this[_0x7a3a('0x1a')]={};}module[_0x7a3a('0x1b')]=QueueReport; \ No newline at end of file +var _0xa54b=['mohtime','variables','exports','calleridname','queuecallerjoinAt','position','count','queuecallerabandon','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','accountcode','context','priority','holdtime','assigned','lastAssignedTo','voice'];(function(_0x5b26b0,_0x18964f){var _0x23feff=function(_0x1f62cd){while(--_0x1f62cd){_0x5b26b0['push'](_0x5b26b0['shift']());}};_0x23feff(++_0x18964f);}(_0xa54b,0x157));var _0xba54=function(_0x38fae1,_0x4013b0){_0x38fae1=_0x38fae1-0x0;var _0x3ec8d4=_0xa54b[_0x38fae1];return _0x3ec8d4;};'use strict';function QueueReport(){this['type']='inbound';this['uniqueid']='';this['calleridnum']='';this[_0xba54('0x0')]='';this['queue']='';this[_0xba54('0x1')]=null;this['queuecallerleaveAt']=null;this[_0xba54('0x2')]=0x1;this[_0xba54('0x3')]=0x1;this[_0xba54('0x4')]=![];this['queuecallerabandonAt']=null;this[_0xba54('0x5')]=![];this['queuecallercompleteAt']=null;this[_0xba54('0x6')]=![];this[_0xba54('0x7')]=null;this[_0xba54('0x8')]=0x1;this['channel']='';this[_0xba54('0x9')]='';this['connectedlinename']='';this[_0xba54('0xa')]='';this[_0xba54('0xb')]='';this['exten']='';this[_0xba54('0xc')]='';this[_0xba54('0xd')]=0x0;this[_0xba54('0xe')]=![];this[_0xba54('0xf')]='';this['motionChannel']=_0xba54('0x10');this['routealias']=null;this[_0xba54('0x11')]=0x0;this[_0xba54('0x12')]={};}module[_0xba54('0x13')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 7e56406..e05858d 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 _0x01b5=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x1bd926,_0xd8d307){var _0x2f2cf7=function(_0x4ec05f){while(--_0x4ec05f){_0x1bd926['push'](_0x1bd926['shift']());}};_0x2f2cf7(++_0xd8d307);}(_0x01b5,0xca));var _0x501b=function(_0x4b0fa7,_0x216430){_0x4b0fa7=_0x4b0fa7-0x0;var _0x46cc6b=_0x01b5[_0x4b0fa7];return _0x46cc6b;};'use strict';function SalesforceAccount(_0x232f79){this['id']=_0x232f79['id']||0x0;this[_0x501b('0x0')]=_0x232f79[_0x501b('0x0')]||'';this[_0x501b('0x1')]=_0x232f79[_0x501b('0x1')]||'';this[_0x501b('0x2')]=_0x232f79['remoteUri']||'';this[_0x501b('0x3')]=_0x232f79[_0x501b('0x3')]||'';this[_0x501b('0x4')]=_0x232f79[_0x501b('0x4')]||'';this['clientSecret']=_0x232f79[_0x501b('0x5')]||'';this[_0x501b('0x6')]=_0x232f79[_0x501b('0x6')]||'';this['type']=_0x232f79[_0x501b('0x7')]||_0x501b('0x8');this[_0x501b('0x9')]=_0x232f79['serverUrl']||'';this[_0x501b('0xa')]=_0x232f79[_0x501b('0xa')]||{};}module[_0x501b('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x10ee=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0x10ee,0xed));var _0xe10e=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x10ee[_0x4c12ec];return _0x3ae42c;};'use strict';function SalesforceAccount(_0x30978b){this['id']=_0x30978b['id']||0x0;this[_0xe10e('0x0')]=_0x30978b[_0xe10e('0x0')]||'';this[_0xe10e('0x1')]=_0x30978b['username']||'';this[_0xe10e('0x2')]=_0x30978b[_0xe10e('0x2')]||'';this[_0xe10e('0x3')]=_0x30978b[_0xe10e('0x3')]||'';this[_0xe10e('0x4')]=_0x30978b['clientId']||'';this[_0xe10e('0x5')]=_0x30978b[_0xe10e('0x5')]||'';this[_0xe10e('0x6')]=_0x30978b['securityToken']||'';this[_0xe10e('0x7')]=_0x30978b[_0xe10e('0x7')]||_0xe10e('0x8');this[_0xe10e('0x9')]=_0x30978b['serverUrl']||'';this[_0xe10e('0xa')]=_0x30978b[_0xe10e('0xa')]||{};}module[_0xe10e('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 bf220d9..ad40da9 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 _0x41f6=['serverUrl','Configurations','name','username','remoteUri'];(function(_0x5e4a4c,_0x1b8d7e){var _0x1afefb=function(_0x2f4eb0){while(--_0x2f4eb0){_0x5e4a4c['push'](_0x5e4a4c['shift']());}};_0x1afefb(++_0x1b8d7e);}(_0x41f6,0x174));var _0x641f=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x41f6[_0x26fc81];return _0x9feece;};'use strict';function ServicenowAccount(_0x34531f){this['id']=_0x34531f['id']||0x0;this[_0x641f('0x0')]=_0x34531f[_0x641f('0x0')]||'';this['username']=_0x34531f[_0x641f('0x1')]||'';this['password']=_0x34531f['password']||'';this[_0x641f('0x2')]=_0x34531f[_0x641f('0x2')]||'';this[_0x641f('0x3')]=_0x34531f[_0x641f('0x3')]||'';this['Configurations']=_0x34531f[_0x641f('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x7321=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x7321,0x181));var _0x1732=function(_0x21ccfc,_0x3136b7){_0x21ccfc=_0x21ccfc-0x0;var _0x49356b=_0x7321[_0x21ccfc];return _0x49356b;};'use strict';function ServicenowAccount(_0x4ac729){this['id']=_0x4ac729['id']||0x0;this[_0x1732('0x0')]=_0x4ac729[_0x1732('0x0')]||'';this['username']=_0x4ac729[_0x1732('0x1')]||'';this['password']=_0x4ac729[_0x1732('0x2')]||'';this[_0x1732('0x3')]=_0x4ac729[_0x1732('0x3')]||'';this[_0x1732('0x4')]=_0x4ac729[_0x1732('0x4')]||'';this[_0x1732('0x5')]=_0x4ac729[_0x1732('0x5')]||{};}module[_0x1732('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 67c6fb2..51de3da 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 _0x65f9=['serverUrl','Configurations','exports','name','username','password'];(function(_0x38b67a,_0xd27c3c){var _0x1052f8=function(_0x2e55d3){while(--_0x2e55d3){_0x38b67a['push'](_0x38b67a['shift']());}};_0x1052f8(++_0xd27c3c);}(_0x65f9,0xa5));var _0x965f=function(_0x311204,_0x5b965d){_0x311204=_0x311204-0x0;var _0x411918=_0x65f9[_0x311204];return _0x411918;};'use strict';function SugarcrmAccount(_0x5e0e62){this['id']=_0x5e0e62['id']||0x0;this[_0x965f('0x0')]=_0x5e0e62[_0x965f('0x0')]||'';this[_0x965f('0x1')]=_0x5e0e62['username']||'';this[_0x965f('0x2')]=_0x5e0e62[_0x965f('0x2')]||'';this['remoteUri']=_0x5e0e62['remoteUri']||'';this['serverUrl']=_0x5e0e62[_0x965f('0x3')]||'';this['Configurations']=_0x5e0e62[_0x965f('0x4')]||{};}module[_0x965f('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x092f=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x1fc72b,_0x2b911b){var _0x2b350f=function(_0x460100){while(--_0x460100){_0x1fc72b['push'](_0x1fc72b['shift']());}};_0x2b350f(++_0x2b911b);}(_0x092f,0xfc));var _0xf092=function(_0x1809c5,_0x46cabc){_0x1809c5=_0x1809c5-0x0;var _0x5254a4=_0x092f[_0x1809c5];return _0x5254a4;};'use strict';function SugarcrmAccount(_0x4ea79d){this['id']=_0x4ea79d['id']||0x0;this[_0xf092('0x0')]=_0x4ea79d['name']||'';this['username']=_0x4ea79d[_0xf092('0x1')]||'';this['password']=_0x4ea79d[_0xf092('0x2')]||'';this['remoteUri']=_0x4ea79d[_0xf092('0x3')]||'';this[_0xf092('0x4')]=_0x4ea79d['serverUrl']||'';this['Configurations']=_0x4ea79d[_0xf092('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 007cad8..d78afa7 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 _0x4641=['unknown','stateTime','status','address','name','accountcode','state'];(function(_0x4069fa,_0x3ef590){var _0x2e3ca4=function(_0x247ea5){while(--_0x247ea5){_0x4069fa['push'](_0x4069fa['shift']());}};_0x2e3ca4(++_0x3ef590);}(_0x4641,0x185));var _0x1464=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4641[_0x413feb];return _0x40ee88;};'use strict';function Telephone(_0x2482bd){this['id']=_0x2482bd['id']||0x0;this[_0x1464('0x0')]=_0x2482bd[_0x1464('0x0')]||'';this[_0x1464('0x1')]=_0x2482bd[_0x1464('0x1')]||'';this[_0x1464('0x2')]=_0x1464('0x3');this[_0x1464('0x4')]=0x0;this[_0x1464('0x5')]='unknown';this[_0x1464('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x905b=['stateTime','status','address','exports','name','state','unknown'];(function(_0x2c715e,_0x19559f){var _0x3395c4=function(_0x4a3c1c){while(--_0x4a3c1c){_0x2c715e['push'](_0x2c715e['shift']());}};_0x3395c4(++_0x19559f);}(_0x905b,0x1a1));var _0xb905=function(_0x3339d8,_0x1a5676){_0x3339d8=_0x3339d8-0x0;var _0x2f3b1e=_0x905b[_0x3339d8];return _0x2f3b1e;};'use strict';function Telephone(_0x6bec08){this['id']=_0x6bec08['id']||0x0;this['name']=_0x6bec08[_0xb905('0x0')]||'';this['accountcode']=_0x6bec08['accountcode']||'';this[_0xb905('0x1')]=_0xb905('0x2');this[_0xb905('0x3')]=0x0;this[_0xb905('0x4')]=_0xb905('0x2');this[_0xb905('0x5')]='';}module[_0xb905('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 d471d72..72106b2 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(_0x70fdc5,_0x3628f2){var _0x81d1e5=function(_0x46bd4f){while(--_0x46bd4f){_0x70fdc5['push'](_0x70fdc5['shift']());}};_0x81d1e5(++_0x3628f2);}(_0xb10b,0x12a));var _0xbb10=function(_0x33875d,_0xf2f624){_0x33875d=_0x33875d-0x0;var _0x477086=_0xb10b[_0x33875d];return _0x477086;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x2d4017,_0x27f4b4){var _0x452978=function(_0x1028d3){while(--_0x1028d3){_0x2d4017['push'](_0x2d4017['shift']());}};_0x452978(++_0x27f4b4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2035ef,_0x3f7d39){_0x2035ef=_0x2035ef-0x0;var _0x86c909=_0xb10b[_0x2035ef];return _0x86c909;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 7e5871d..e586a51 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(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x108db1,_0x89896d){_0x108db1=_0x108db1-0x0;var _0x16848d=_0x0b0e[_0x108db1];return _0x16848d;};'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 _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0x5eb8,0xb0));var _0x85eb=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0x5eb8[_0x48ec91];return _0x22766c;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 180c69b..b4b95d0 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 _0x1957=['domain','stateRegistry','defaultuser','exports','active','name','state','unknown','registry','split','host','port'];(function(_0x40b19e,_0x51f6ec){var _0x423c2f=function(_0x59ec4a){while(--_0x59ec4a){_0x40b19e['push'](_0x40b19e['shift']());}};_0x423c2f(++_0x51f6ec);}(_0x1957,0x184));var _0x7195=function(_0x17cdd6,_0x94ae6d){_0x17cdd6=_0x17cdd6-0x0;var _0x42970a=_0x1957[_0x17cdd6];return _0x42970a;};'use strict';function Trunk(_0x561b59){this['id']=_0x561b59['id']||0x0;this['active']=_0x561b59[_0x7195('0x0')]||![];this[_0x7195('0x1')]=_0x561b59[_0x7195('0x1')]||'';this[_0x7195('0x2')]=_0x7195('0x3');this['stateTime']=0x0;this['status']=_0x7195('0x3');this[_0x7195('0x4')]=_0x561b59[_0x7195('0x4')]&&_0x561b59['registry']['indexOf'](':')?_0x561b59['registry'][_0x7195('0x5')](':')[0x0]:'';this[_0x7195('0x6')]='';this[_0x7195('0x7')]='';this[_0x7195('0x8')]='';this['domainport']='';this['refresh']='';this[_0x7195('0x9')]='unknown';this['registrationtime']='';this['address']='';this[_0x7195('0xa')]=_0x561b59[_0x7195('0xa')]||'';}module[_0x7195('0xb')]=Trunk; \ No newline at end of file +var _0xa568=['split','host','port','domain','domainport','refresh','registrationtime','address','defaultuser','active','name','unknown','stateTime','status','registry','indexOf'];(function(_0x334297,_0x939764){var _0x3b76de=function(_0x5c8dc4){while(--_0x5c8dc4){_0x334297['push'](_0x334297['shift']());}};_0x3b76de(++_0x939764);}(_0xa568,0xf9));var _0x8a56=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa568[_0x122ef9];return _0x42fba0;};'use strict';function Trunk(_0x430d08){this['id']=_0x430d08['id']||0x0;this[_0x8a56('0x0')]=_0x430d08[_0x8a56('0x0')]||![];this[_0x8a56('0x1')]=_0x430d08[_0x8a56('0x1')]||'';this['state']=_0x8a56('0x2');this[_0x8a56('0x3')]=0x0;this[_0x8a56('0x4')]=_0x8a56('0x2');this[_0x8a56('0x5')]=_0x430d08[_0x8a56('0x5')]&&_0x430d08['registry'][_0x8a56('0x6')](':')?_0x430d08[_0x8a56('0x5')][_0x8a56('0x7')](':')[0x0]:'';this[_0x8a56('0x8')]='';this[_0x8a56('0x9')]='';this[_0x8a56('0xa')]='';this[_0x8a56('0xb')]='';this[_0x8a56('0xc')]='';this['stateRegistry']='unknown';this[_0x8a56('0xd')]='';this[_0x8a56('0xe')]='';this[_0x8a56('0xf')]=_0x430d08[_0x8a56('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index af2ceca..1fb24c4 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 _0xbf69=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x21f393,_0x4375ef){var _0x2e28e5=function(_0x373d66){while(--_0x373d66){_0x21f393['push'](_0x21f393['shift']());}};_0x2e28e5(++_0x4375ef);}(_0xbf69,0x70));var _0x9bf6=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xbf69[_0x1589dd];return _0x1bddd1;};'use strict';function voiceExtension(_0x55695b){this['id']=_0x55695b['id']||0x0;this[_0x9bf6('0x0')]=_0x55695b[_0x9bf6('0x0')]||'';this[_0x9bf6('0x1')]=_0x55695b['recordingFormat']||_0x9bf6('0x2');this[_0x9bf6('0x3')]=_0x55695b[_0x9bf6('0x3')]||![];}module[_0x9bf6('0x4')]=voiceExtension; \ No newline at end of file +var _0xd1aa=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0xf17c23,_0x186344){var _0x227ab8=function(_0x2d6dba){while(--_0x2d6dba){_0xf17c23['push'](_0xf17c23['shift']());}};_0x227ab8(++_0x186344);}(_0xd1aa,0x159));var _0xad1a=function(_0x47d7ec,_0x17f197){_0x47d7ec=_0x47d7ec-0x0;var _0x98674a=_0xd1aa[_0x47d7ec];return _0x98674a;};'use strict';function voiceExtension(_0x3046ea){this['id']=_0x3046ea['id']||0x0;this['exten']=_0x3046ea[_0xad1a('0x0')]||'';this['recordingFormat']=_0x3046ea[_0xad1a('0x1')]||_0xad1a('0x2');this[_0xad1a('0x3')]=_0x3046ea[_0xad1a('0x3')]||![];}module[_0xad1a('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 1b1884c..d427435 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 _0xc1fc=['predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav49','gsm','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','dialTimezone','dialGlobalInterval','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime'];(function(_0x2f6233,_0x90172){var _0x1c9c36=function(_0x3ac680){while(--_0x3ac680){_0x2f6233['push'](_0x2f6233['shift']());}};_0x1c9c36(++_0x90172);}(_0xc1fc,0x93));var _0xcc1f=function(_0x101899,_0x3fb12a){_0x101899=_0x101899-0x0;var _0x1d67e2=_0xc1fc[_0x101899];return _0x1d67e2;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xcc1f('0x0'),'gsm':_0xcc1f('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xcc1f('0x2'),'linear':_0xcc1f('0x3'),'random':_0xcc1f('0x4'),'ringall':_0xcc1f('0x5'),'rr':_0xcc1f('0x6'),'rrmemory':_0xcc1f('0x7'),'rrordered':_0xcc1f('0x8'),'wrandom':_0xcc1f('0x9')};function VoiceQueue(_0x493a97){this['id']=_0x493a97['id']||0x0;this['name']=_0x493a97[_0xcc1f('0xa')]||'';this[_0xcc1f('0xb')]=_0x493a97[_0xcc1f('0xb')]||'';this[_0xcc1f('0xc')]=_0x493a97[_0xcc1f('0xc')]||'inbound';this['waiting']=0x0;this['total']=0x0;this[_0xcc1f('0xd')]=0x0;this[_0xcc1f('0xe')]=0x0;this[_0xcc1f('0xf')]=0x0;this[_0xcc1f('0x10')]=0x0;this[_0xcc1f('0x11')]=0x0;this[_0xcc1f('0x12')]=0x0;this[_0xcc1f('0x13')]=0x0;this[_0xcc1f('0x14')]=0x0;this[_0xcc1f('0x15')]=0x0;this['invalid']=0x0;this[_0xcc1f('0x16')]=0x0;this[_0xcc1f('0x17')]=0x0;this[_0xcc1f('0x18')]=0x0;this[_0xcc1f('0x19')]=0x0;this[_0xcc1f('0x1a')]=0x0;this[_0xcc1f('0x1b')]=0x0;this[_0xcc1f('0x1c')]=0x0;this['unavailable']=0x0;this[_0xcc1f('0x1d')]=0x0;this[_0xcc1f('0x1e')]=_0x493a97[_0xcc1f('0x1e')]||![];this[_0xcc1f('0x1f')]=_0x493a97[_0xcc1f('0x1f')]||0xa;this[_0xcc1f('0x20')]=_0x493a97[_0xcc1f('0x20')]||'no';this[_0xcc1f('0x21')]=!![];this[_0xcc1f('0x22')]='';this[_0xcc1f('0x23')]='';this['originated']=0x0;this['temp']=0x0;this[_0xcc1f('0x24')]=_0x493a97[_0xcc1f('0x24')]||null;this[_0xcc1f('0x25')]=_0x493a97['dialGlobalInterval']?_0x493a97[_0xcc1f('0x25')]:null;this['dialActive']=_0x493a97['dialActive'];this[_0xcc1f('0x26')]=_0x493a97[_0xcc1f('0x26')]||'progressive';this[_0xcc1f('0x27')]=_0x493a97[_0xcc1f('0x27')]||0x0;this[_0xcc1f('0x28')]=_0x493a97[_0xcc1f('0x28')]||0x0;this[_0xcc1f('0x29')]=_0x493a97[_0xcc1f('0x29')]||0x1;this['dialPredictiveOptimization']=_0x493a97[_0xcc1f('0x2a')]||'dropRate';this[_0xcc1f('0x2b')]=_0x493a97[_0xcc1f('0x2b')]||0.03;this[_0xcc1f('0x2c')]=_0x493a97[_0xcc1f('0x2c')]||0x258;this['dialOriginateCallerIdName']=_0x493a97[_0xcc1f('0x2d')]||_0xcc1f('0x2e');this[_0xcc1f('0x2f')]=_0x493a97[_0xcc1f('0x2f')]||_0xcc1f('0x2e');this[_0xcc1f('0x30')]=_0x493a97[_0xcc1f('0x30')]||0x1e;this['dialQueueOptions']=_0x493a97[_0xcc1f('0x31')]||_0xcc1f('0x32');this[_0xcc1f('0x33')]=_0x493a97[_0xcc1f('0x33')]||0x3;this[_0xcc1f('0x34')]=_0x493a97[_0xcc1f('0x34')]||undefined;this[_0xcc1f('0x35')]=_0x493a97[_0xcc1f('0x35')]||0x3;this['dialCongestionRetryFrequency']=_0x493a97[_0xcc1f('0x36')]||0x96;this[_0xcc1f('0x37')]=_0x493a97[_0xcc1f('0x37')]||0x3;this[_0xcc1f('0x38')]=_0x493a97[_0xcc1f('0x38')]||0x96;this[_0xcc1f('0x39')]=_0x493a97['dialNoAnswerMaxRetry']||0x3;this[_0xcc1f('0x3a')]=_0x493a97[_0xcc1f('0x3a')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x493a97[_0xcc1f('0x3b')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x493a97[_0xcc1f('0x3c')]||0x96;this[_0xcc1f('0x3d')]=_0x493a97[_0xcc1f('0x3d')]||0x3;this[_0xcc1f('0x3e')]=_0x493a97['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x493a97[_0xcc1f('0x3f')]||0x3;this[_0xcc1f('0x40')]=_0x493a97[_0xcc1f('0x40')]||0x96;this[_0xcc1f('0x41')]=_0x493a97[_0xcc1f('0x41')]||0x3;this[_0xcc1f('0x42')]=_0x493a97[_0xcc1f('0x42')]||0x96;this['dialAgentRejectMaxRetry']=_0x493a97[_0xcc1f('0x43')]||0x3;this[_0xcc1f('0x44')]=_0x493a97[_0xcc1f('0x44')]||0x96;this['callAdditionalPhoneAfterMin']=_0x493a97[_0xcc1f('0x45')]||0x3;this[_0xcc1f('0x46')]=_0x493a97[_0xcc1f('0x46')]||0x4;this[_0xcc1f('0x47')]=_0x493a97[_0xcc1f('0x47')]?_0x493a97[_0xcc1f('0x47')]:undefined;this[_0xcc1f('0x48')]=_0x493a97[_0xcc1f('0x48')]?_0x493a97['TrunkBackup']:undefined;this[_0xcc1f('0x49')]=_0x493a97[_0xcc1f('0x49')]||undefined;this['Interval']=_0x493a97[_0xcc1f('0x4a')]?_0x493a97[_0xcc1f('0x4a')]:undefined;this[_0xcc1f('0x4b')]=_0x493a97['dialOrderByScheduledAt']||'DESC';this[_0xcc1f('0x4c')]=_0x493a97[_0xcc1f('0x4c')]||undefined;this[_0xcc1f('0x4d')]=_0x493a97['dialCutDigit']||undefined;this[_0xcc1f('0x4e')]=strategy[_0x493a97[_0xcc1f('0x4e')]];this[_0xcc1f('0x4f')]=!![];this[_0xcc1f('0x50')]=_0x493a97[_0xcc1f('0x50')]||![];this[_0xcc1f('0x51')]=_0x493a97[_0xcc1f('0x51')];this[_0xcc1f('0x52')]=_0x493a97[_0xcc1f('0x52')];this[_0xcc1f('0x53')]=_0x493a97[_0xcc1f('0x53')];this['dialAMDTotalAnalysisTime']=_0x493a97['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x493a97[_0xcc1f('0x54')];this[_0xcc1f('0x55')]=_0x493a97[_0xcc1f('0x55')];this[_0xcc1f('0x56')]=_0x493a97[_0xcc1f('0x56')];this[_0xcc1f('0x57')]=_0x493a97[_0xcc1f('0x57')];this[_0xcc1f('0x58')]=_0x493a97[_0xcc1f('0x58')];this[_0xcc1f('0x59')]=0x0;this[_0xcc1f('0x5a')]=0x0;this[_0xcc1f('0x5b')]=_0x493a97[_0xcc1f('0x5b')];this['outboundAnswerCallsDay']=0x0;this[_0xcc1f('0x5c')]=0x0;this[_0xcc1f('0x5d')]=0x0;this[_0xcc1f('0x5e')]=0x0;this[_0xcc1f('0x5f')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xcc1f('0x60')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xcc1f('0x61')]=0x0;this[_0xcc1f('0x62')]=0x0;this[_0xcc1f('0x63')]=0x0;this['outboundReCallsDay']=0x0;this[_0xcc1f('0x64')]=0x0;this[_0xcc1f('0x65')]=undefined;this['startPredictive']=undefined;this[_0xcc1f('0x66')]=undefined;this[_0xcc1f('0x67')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xcc1f('0x68')]=0x0;this[_0xcc1f('0x69')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xcc1f('0x6a')]=0x0;this[_0xcc1f('0x6b')]=0x0;this[_0xcc1f('0x6c')]=0x0;this[_0xcc1f('0x6d')]=_0x493a97[_0xcc1f('0x6e')]||0x14;this['predictiveIntervalMinThreshold']=_0x493a97['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xcc1f('0x6f')]=0x0;this[_0xcc1f('0x70')]=0x0;this[_0xcc1f('0x71')]=0x1;this[_0xcc1f('0x72')]=0x0;this[_0xcc1f('0x73')]=0x0;this[_0xcc1f('0x74')]=0x0;this['erlangBusyFactor']=0x0;this[_0xcc1f('0x75')]=_0x493a97[_0xcc1f('0x75')]||0x1e;this[_0xcc1f('0x76')]=_0x493a97[_0xcc1f('0x76')]||![];this['dialPreviewAutoRecallMe']=!!_0x493a97[_0xcc1f('0x77')]||![];this['dialPreviewRecallmeReminder']=!!_0x493a97[_0xcc1f('0x78')]||![];this[_0xcc1f('0x79')]=_0x493a97[_0xcc1f('0x79')]||undefined;this['dialAgiAfterHangupClient']=_0x493a97[_0xcc1f('0x7a')]||![];this[_0xcc1f('0x7b')]=_0x493a97[_0xcc1f('0x7b')]||![];this[_0xcc1f('0xb')]=monitorFormat[_0x493a97['monitor_format']]?monitorFormat[_0x493a97[_0xcc1f('0xb')]]:undefined;this[_0xcc1f('0x7c')]=_0x493a97['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x493a97[_0xcc1f('0x7d')]?_0x493a97[_0xcc1f('0x7d')]:undefined;this[_0xcc1f('0x7e')]=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0xbcbb=['dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','ringall','roundrobin','rrordered','wrandom','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','available','inUse','invalid','onHold','paused','ringing','ringInUse','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval'];(function(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0xbcbb,0x14d));var _0xbbcb=function(_0x385567,_0x40550f){_0x385567=_0x385567-0x0;var _0x49cf95=_0xbcbb[_0x385567];return _0x49cf95;};'use strict';var monitorFormat={'wav':_0xbbcb('0x0'),'wav49':_0xbbcb('0x1'),'gsm':_0xbbcb('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xbbcb('0x3'),'linear':'linear','random':'random','ringall':_0xbbcb('0x4'),'rr':_0xbbcb('0x5'),'rrmemory':'rrmemory','rrordered':_0xbbcb('0x6'),'wrandom':_0xbbcb('0x7')};function VoiceQueue(_0x452b31){this['id']=_0x452b31['id']||0x0;this[_0xbbcb('0x8')]=_0x452b31[_0xbbcb('0x8')]||'';this[_0xbbcb('0x9')]=_0x452b31[_0xbbcb('0x9')]||'';this[_0xbbcb('0xa')]=_0x452b31['type']||_0xbbcb('0xb');this['waiting']=0x0;this[_0xbbcb('0xc')]=0x0;this[_0xbbcb('0xd')]=0x0;this[_0xbbcb('0xe')]=0x0;this[_0xbbcb('0xf')]=0x0;this[_0xbbcb('0x10')]=0x0;this['unmanaged']=0x0;this[_0xbbcb('0x11')]=0x0;this[_0xbbcb('0x12')]=0x0;this['busy']=0x0;this[_0xbbcb('0x13')]=0x0;this[_0xbbcb('0x14')]=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this[_0xbbcb('0x15')]=0x0;this[_0xbbcb('0x16')]=0x0;this[_0xbbcb('0x17')]=0x0;this[_0xbbcb('0x18')]=0x0;this['talking']=0x0;this[_0xbbcb('0x19')]=0x0;this['unknown']=0x0;this[_0xbbcb('0x1a')]=_0x452b31[_0xbbcb('0x1a')]||![];this[_0xbbcb('0x1b')]=_0x452b31[_0xbbcb('0x1b')]||0xa;this[_0xbbcb('0x1c')]=_0x452b31['autopause']||'no';this[_0xbbcb('0x1d')]=!![];this[_0xbbcb('0x1e')]='';this['statusMessage']='';this[_0xbbcb('0x1f')]=0x0;this[_0xbbcb('0x20')]=0x0;this[_0xbbcb('0x21')]=_0x452b31[_0xbbcb('0x21')]||null;this[_0xbbcb('0x22')]=_0x452b31[_0xbbcb('0x22')]?_0x452b31[_0xbbcb('0x22')]:null;this[_0xbbcb('0x23')]=_0x452b31[_0xbbcb('0x23')];this['dialMethod']=_0x452b31['dialMethod']||_0xbbcb('0x24');this['dialLimitChannel']=_0x452b31['dialLimitChannel']||0x0;this[_0xbbcb('0x25')]=_0x452b31['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x452b31[_0xbbcb('0x26')]||0x1;this[_0xbbcb('0x27')]=_0x452b31[_0xbbcb('0x27')]||'dropRate';this[_0xbbcb('0x28')]=_0x452b31[_0xbbcb('0x28')]||0.03;this[_0xbbcb('0x29')]=_0x452b31[_0xbbcb('0x29')]||0x258;this[_0xbbcb('0x2a')]=_0x452b31[_0xbbcb('0x2a')]||_0xbbcb('0x2b');this[_0xbbcb('0x2c')]=_0x452b31['dialOriginateCallerIdNumber']||_0xbbcb('0x2b');this[_0xbbcb('0x2d')]=_0x452b31['dialOriginateTimeout']||0x1e;this[_0xbbcb('0x2e')]=_0x452b31[_0xbbcb('0x2e')]||_0xbbcb('0x2f');this[_0xbbcb('0x30')]=_0x452b31[_0xbbcb('0x30')]||0x3;this[_0xbbcb('0x31')]=_0x452b31['dialQueueProject']||undefined;this[_0xbbcb('0x32')]=_0x452b31[_0xbbcb('0x32')]||0x3;this['dialCongestionRetryFrequency']=_0x452b31[_0xbbcb('0x33')]||0x96;this[_0xbbcb('0x34')]=_0x452b31[_0xbbcb('0x34')]||0x3;this[_0xbbcb('0x35')]=_0x452b31['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x452b31[_0xbbcb('0x36')]||0x3;this['dialNoAnswerRetryFrequency']=_0x452b31[_0xbbcb('0x37')]||0x96;this[_0xbbcb('0x38')]=_0x452b31[_0xbbcb('0x38')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x452b31['dialNoSuchNumberRetryFrequency']||0x96;this[_0xbbcb('0x39')]=_0x452b31[_0xbbcb('0x39')]||0x3;this[_0xbbcb('0x3a')]=_0x452b31[_0xbbcb('0x3a')]||0x96;this[_0xbbcb('0x3b')]=_0x452b31[_0xbbcb('0x3b')]||0x3;this[_0xbbcb('0x3c')]=_0x452b31[_0xbbcb('0x3c')]||0x96;this[_0xbbcb('0x3d')]=_0x452b31[_0xbbcb('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x452b31[_0xbbcb('0x3e')]||0x96;this[_0xbbcb('0x3f')]=_0x452b31['dialAgentRejectMaxRetry']||0x3;this[_0xbbcb('0x40')]=_0x452b31[_0xbbcb('0x40')]||0x96;this[_0xbbcb('0x41')]=_0x452b31[_0xbbcb('0x41')]||0x3;this[_0xbbcb('0x42')]=_0x452b31[_0xbbcb('0x42')]||0x4;this[_0xbbcb('0x43')]=_0x452b31[_0xbbcb('0x43')]?_0x452b31['Trunk']:undefined;this[_0xbbcb('0x44')]=_0x452b31[_0xbbcb('0x44')]?_0x452b31[_0xbbcb('0x44')]:undefined;this[_0xbbcb('0x45')]=_0x452b31[_0xbbcb('0x45')]||undefined;this[_0xbbcb('0x46')]=_0x452b31[_0xbbcb('0x46')]?_0x452b31[_0xbbcb('0x46')]:undefined;this[_0xbbcb('0x47')]=_0x452b31[_0xbbcb('0x47')]||'DESC';this[_0xbbcb('0x48')]=_0x452b31[_0xbbcb('0x48')]||undefined;this[_0xbbcb('0x49')]=_0x452b31[_0xbbcb('0x49')]||undefined;this['strategy']=strategy[_0x452b31[_0xbbcb('0x4a')]];this[_0xbbcb('0x4b')]=!![];this[_0xbbcb('0x4c')]=_0x452b31[_0xbbcb('0x4c')]||![];this[_0xbbcb('0x4d')]=_0x452b31[_0xbbcb('0x4d')];this[_0xbbcb('0x4e')]=_0x452b31[_0xbbcb('0x4e')];this['dialAMDAfterGreetingSilence']=_0x452b31[_0xbbcb('0x4f')];this['dialAMDTotalAnalysisTime']=_0x452b31[_0xbbcb('0x50')];this[_0xbbcb('0x51')]=_0x452b31[_0xbbcb('0x51')];this[_0xbbcb('0x52')]=_0x452b31['dialAMDBetweenWordsSilence'];this[_0xbbcb('0x53')]=_0x452b31[_0xbbcb('0x53')];this['dialAMDSilenceThreshold']=_0x452b31[_0xbbcb('0x54')];this[_0xbbcb('0x55')]=_0x452b31[_0xbbcb('0x55')];this[_0xbbcb('0x56')]=0x0;this[_0xbbcb('0x57')]=0x0;this[_0xbbcb('0x58')]=_0x452b31[_0xbbcb('0x58')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xbbcb('0x59')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xbbcb('0x5a')]=0x0;this[_0xbbcb('0x5b')]=0x0;this[_0xbbcb('0x5c')]=0x0;this[_0xbbcb('0x5d')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xbbcb('0x5e')]=0x0;this[_0xbbcb('0x5f')]=0x0;this[_0xbbcb('0x60')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xbbcb('0x61')]=undefined;this[_0xbbcb('0x62')]=undefined;this[_0xbbcb('0x63')]=undefined;this[_0xbbcb('0x64')]=1.05;this[_0xbbcb('0x65')]=0x0;this[_0xbbcb('0x66')]=0x0;this[_0xbbcb('0x67')]=0x0;this[_0xbbcb('0x68')]=0x0;this[_0xbbcb('0x69')]=0x0;this[_0xbbcb('0x6a')]=0x0;this[_0xbbcb('0x6b')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xbbcb('0x6c')]=_0x452b31[_0xbbcb('0x6d')]||0x14;this['predictiveIntervalMinThreshold']=_0x452b31['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xbbcb('0x6e')]=0x0;this[_0xbbcb('0x6f')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xbbcb('0x70')]=0x0;this['erlangCallToSecond']=0x0;this[_0xbbcb('0x71')]=0x0;this['erlangBusyFactor']=0x0;this[_0xbbcb('0x72')]=_0x452b31[_0xbbcb('0x72')]||0x1e;this[_0xbbcb('0x73')]=_0x452b31[_0xbbcb('0x73')]||![];this[_0xbbcb('0x74')]=!!_0x452b31[_0xbbcb('0x74')]||![];this[_0xbbcb('0x75')]=!!_0x452b31['dialPreviewRecallmeReminder']||![];this[_0xbbcb('0x76')]=_0x452b31[_0xbbcb('0x76')]||undefined;this[_0xbbcb('0x77')]=_0x452b31['dialAgiAfterHangupClient']||![];this[_0xbbcb('0x78')]=_0x452b31[_0xbbcb('0x78')]||![];this['monitor_format']=monitorFormat[_0x452b31['monitor_format']]?monitorFormat[_0x452b31[_0xbbcb('0x9')]]:undefined;this[_0xbbcb('0x79')]=_0x452b31[_0xbbcb('0x79')]||![];this[_0xbbcb('0x7a')]=_0x452b31['mandatoryDispositionPause']?_0x452b31[_0xbbcb('0x7a')]:undefined;this[_0xbbcb('0x7b')]=![];}module[_0xbbcb('0x7c')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 257088c..5e1c43e 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 _0x078c=['onHold','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','message','statusMessage','Trunk','callerid','createReport','loggedin','callers','length','SIP/','online','incall','status','booked','keys','queue','exten','xcally-motion-preview','compareToInboundQueue','compareToOutboundQueue','some','active','prototype','updateReportFromOutboundQueue','preview','exports','available','loggedInDb','paused','talking','waiting','answered','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','inUse','invalid'];(function(_0x5e2d89,_0x8a19c4){var _0x546fdf=function(_0xc447f8){while(--_0xc447f8){_0x5e2d89['push'](_0x5e2d89['shift']());}};_0x546fdf(++_0x8a19c4);}(_0x078c,0x19f));var _0xc078=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0x078c[_0x14e9f0];return _0xa63f7e;};'use strict';var INBOUND_COUNTERS=[_0xc078('0x0'),'loggedIn',_0xc078('0x1'),_0xc078('0x2'),'ringing',_0xc078('0x3'),_0xc078('0x4')];var OUTBOUND_COUNTERS=[_0xc078('0x0'),_0xc078('0x5'),'inUse',_0xc078('0x6'),_0xc078('0x1'),_0xc078('0x7'),_0xc078('0x8'),_0xc078('0x9'),_0xc078('0xa'),_0xc078('0xb'),_0xc078('0xc'),'outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay',_0xc078('0xd'),_0xc078('0xe'),'paused',_0xc078('0xf'),_0xc078('0x3'),_0xc078('0x10'),_0xc078('0x11'),_0xc078('0x12'),'waiting'];function VoiceQueueSummary(_0x524b55){this['id']=_0x524b55['id'];this[_0xc078('0x13')]=_0x524b55[_0xc078('0x13')];this[_0xc078('0x14')]=_0x524b55[_0xc078('0x14')];this[_0xc078('0x15')]=_0x524b55[_0xc078('0x15')]||0x0;this[_0xc078('0x5')]=_0x524b55[_0xc078('0x5')]||0x0;this[_0xc078('0x0')]=_0x524b55[_0xc078('0x0')]||0x0;this[_0xc078('0x16')]=_0x524b55[_0xc078('0x16')]||0x0;this[_0xc078('0x17')]=_0x524b55[_0xc078('0x17')]||0x0;this[_0xc078('0x18')]=_0x524b55['invalid']||0x0;this[_0xc078('0x6')]=_0x524b55[_0xc078('0x6')]||0x0;this[_0xc078('0x1')]=_0x524b55['loggedInDb']||0x0;this[_0xc078('0x19')]=_0x524b55['onHold']||0x0;this['notInUse']=_0x524b55[_0xc078('0x1a')]||0x0;this['paused']=_0x524b55[_0xc078('0x2')]||0x0;this['ringing']=_0x524b55[_0xc078('0x1b')]||0x0;this[_0xc078('0x1c')]=_0x524b55[_0xc078('0x1c')];this['sumBillable']=_0x524b55[_0xc078('0x10')];this['sumDuration']=_0x524b55[_0xc078('0x11')];this[_0xc078('0x1d')]=_0x524b55[_0xc078('0x1d')]||0x0;this[_0xc078('0x3')]=_0x524b55[_0xc078('0x3')]||0x0;this['total']=_0x524b55[_0xc078('0x12')]||0x0;this[_0xc078('0x1e')]=_0x524b55[_0xc078('0x1e')];this[_0xc078('0x1f')]=_0x524b55['unavailable']||0x0;this[_0xc078('0x20')]=_0x524b55[_0xc078('0x20')]||0x0;this[_0xc078('0x21')]=_0x524b55[_0xc078('0x21')]||0x0;this[_0xc078('0x4')]=_0x524b55[_0xc078('0x4')]||0x0;if(_0x524b55[_0xc078('0x1e')]===_0xc078('0x22')){this[_0xc078('0xf')]=_0x524b55[_0xc078('0xf')]||0x0;this[_0xc078('0x23')]=_0x524b55['dialActive'];this['dialMethod']=_0x524b55[_0xc078('0x24')];this['dialOriginateCallerIdName']=_0x524b55['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x524b55[_0xc078('0x25')];this['dialOriginateTimeout']=_0x524b55[_0xc078('0x26')];this[_0xc078('0x27')]=_0x524b55[_0xc078('0x27')];this[_0xc078('0x28')]=_0x524b55[_0xc078('0x28')];this[_0xc078('0x29')]=_0x524b55[_0xc078('0x29')];this[_0xc078('0x9')]=_0x524b55[_0xc078('0x9')];this[_0xc078('0xa')]=_0x524b55[_0xc078('0xa')];this['outboundBusyCallsDay']=_0x524b55[_0xc078('0xb')];this['outboundCongestionCallsDay']=_0x524b55[_0xc078('0xc')];this[_0xc078('0x2a')]=_0x524b55[_0xc078('0x2a')];this[_0xc078('0x2b')]=_0x524b55['outboundDropCallsDayCallersExit'];this[_0xc078('0x2c')]=_0x524b55['outboundDropCallsDayTimeout'];this['outboundNoAnswerCallsDay']=_0x524b55[_0xc078('0x2d')];this[_0xc078('0x2e')]=_0x524b55['outboundNoSuchCallsDay'];this[_0xc078('0x2f')]=_0x524b55[_0xc078('0x2f')];this[_0xc078('0x30')]=_0x524b55['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x524b55[_0xc078('0xd')];this['outboundUnknownCallsDay']=_0x524b55[_0xc078('0xe')];this[_0xc078('0x31')]=_0x524b55['predictiveIntervalAnsweredCalls'];this[_0xc078('0x32')]=_0x524b55[_0xc078('0x32')];this[_0xc078('0x33')]=_0x524b55['predictiveIntervalAvgTalktime'];this[_0xc078('0x34')]=_0x524b55[_0xc078('0x34')];this[_0xc078('0x35')]=_0x524b55['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x524b55[_0xc078('0x36')];this[_0xc078('0x37')]=_0x524b55['predictiveIntervalErlangCallsDroppedCalls'];this['predictiveIntervalHitRate']=_0x524b55['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0x524b55['predictiveIntervalMultiplicativeFactor'];this[_0xc078('0x38')]=_0x524b55[_0xc078('0x38')];this[_0xc078('0x39')]=_0x524b55[_0xc078('0x39')];this['predictiveIntervalTotalCalls']=_0x524b55[_0xc078('0x3a')];this['originated']=_0x524b55['originated'];this[_0xc078('0x3b')]=_0x524b55[_0xc078('0x3b')];this[_0xc078('0x3c')]=_0x524b55[_0xc078('0x3c')];this[_0xc078('0x3d')]=_0x524b55[_0xc078('0x3d')];this[_0xc078('0x3e')]=_0x524b55[_0xc078('0x3e')];this['startPredictive']=_0x524b55['startPredictive'];this['startProgressive']=_0x524b55['startProgressive'];this[_0xc078('0x3f')]=_0x524b55['message'];this[_0xc078('0x40')]=_0x524b55['statusMessage'];}if(_0x524b55[_0xc078('0x41')]){this['Trunk']={'id':_0x524b55['Trunk']['id'],'name':_0x524b55[_0xc078('0x41')][_0xc078('0x13')],'active':_0x524b55[_0xc078('0x41')]['active'],'callerid':_0x524b55[_0xc078('0x41')][_0xc078('0x42')]};}}VoiceQueueSummary['prototype'][_0xc078('0x43')]=function(_0x3c2bc9,_0x459fed,_0x3e44ea,_0x432fc1){this['loggedInDb']=0x0;this[_0xc078('0x3')]=0x0;this[_0xc078('0x2')]=0x0;this[_0xc078('0x20')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this[_0xc078('0x16')]=0x0;this['invalid']=0x0;this['unavailable']=0x0;this[_0xc078('0x1b')]=0x0;this[_0xc078('0x1c')]=0x0;this['onHold']=0x0;if(_0x3e44ea){if(_0x3e44ea[_0xc078('0x0')]){this['available']=Number(_0x3e44ea[_0xc078('0x0')]);}if(_0x3e44ea['loggedin']){this[_0xc078('0x6')]=Number(_0x3e44ea[_0xc078('0x44')]);}if(_0x3e44ea[_0xc078('0x45')]){this[_0xc078('0x4')]=Number(_0x3e44ea['callers']);}}for(var _0x43762a=0x0;_0x43762a<_0x3c2bc9[_0xc078('0x46')];_0x43762a++){var _0x1635d6=_0x459fed[_0xc078('0x47')+_0x3c2bc9[_0x43762a]['name']];if(_0x1635d6&&_0x1635d6[_0xc078('0x48')]){this[_0xc078('0x1')]+=0x1;}if(_0x3c2bc9[_0x43762a][_0xc078('0x49')]==='1'){this[_0xc078('0x3')]+=0x1;}if(_0x3c2bc9[_0x43762a][_0xc078('0x2')]==='1'&&!['2','7','8']['includes'](_0x3c2bc9[_0x43762a][_0xc078('0x4a')])){this['paused']+=0x1;}switch(_0x3c2bc9[_0x43762a]['status']){case'0':this['unknown']+=0x1;break;case'1':this[_0xc078('0x1a')]+=0x1;break;case'2':this[_0xc078('0x17')]+=0x1;break;case'3':this[_0xc078('0x16')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xc078('0x1b')]+=0x1;break;case'7':this[_0xc078('0x1c')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xc078('0x24')]===_0xc078('0x4b')){var _0x4855de=Object[_0xc078('0x4c')](_0x432fc1);for(var _0x57889b=0x0;_0x57889b<_0x4855de[_0xc078('0x46')];_0x57889b++){var _0x21b506=_0x4855de[_0x57889b];var _0x2dc9e8=_0x432fc1[_0x21b506];if(_0x2dc9e8[_0xc078('0x4d')]===this[_0xc078('0x13')]&&_0x2dc9e8[_0xc078('0x1e')]==='dialer'&&_0x2dc9e8[_0xc078('0x4e')]===_0xc078('0x4f')){this[_0xc078('0x3')]+=0x1;}}if(this[_0xc078('0x3')]>this[_0xc078('0x17')]){this['talking']=this[_0xc078('0x17')];}this[_0xc078('0xf')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0xc078('0x50')]=function(_0x1bfef8){var _0x1cc086=![];if(_0x1bfef8){_0x1cc086=INBOUND_COUNTERS['some'](function(_0x36456e){return this[_0x36456e]!==_0x1bfef8[_0x36456e];},this);}return _0x1cc086;};VoiceQueueSummary['prototype'][_0xc078('0x51')]=function(_0x519124){var _0x273b65=![];var _0x1e62ac=![];var _0x5bf30c=![];if(_0x519124){_0x273b65=this[_0xc078('0x24')]!==_0x519124[_0xc078('0x24')]||this[_0xc078('0x23')]!==_0x519124[_0xc078('0x23')]||this[_0xc078('0x3f')]!==_0x519124[_0xc078('0x3f')]||this[_0xc078('0x40')]!==_0x519124[_0xc078('0x40')];_0x1e62ac=OUTBOUND_COUNTERS[_0xc078('0x52')](function(_0x1c04ef){return this[_0x1c04ef]!==_0x519124[_0x1c04ef];},this);if(this[_0xc078('0x41')]&&_0x519124['Trunk']){_0x5bf30c=this[_0xc078('0x41')][_0xc078('0x13')]!==_0x519124[_0xc078('0x41')][_0xc078('0x13')]||this['Trunk']['active']!==_0x519124['Trunk'][_0xc078('0x53')];}}return _0x273b65||_0x1e62ac||_0x5bf30c;};VoiceQueueSummary[_0xc078('0x54')][_0xc078('0x55')]=function(_0xdb27db){this[_0xc078('0x5')]=_0xdb27db[_0xc078('0x5')];this[_0xc078('0x3f')]=_0xdb27db[_0xc078('0x3f')];this[_0xc078('0x40')]=_0xdb27db[_0xc078('0x40')];this['originated']=_0xdb27db['originated'];this[_0xc078('0x8')]=_0xdb27db[_0xc078('0x8')];this[_0xc078('0x9')]=_0xdb27db[_0xc078('0x9')];this[_0xc078('0xa')]=_0xdb27db[_0xc078('0xa')];this[_0xc078('0xb')]=_0xdb27db[_0xc078('0xb')];this[_0xc078('0xc')]=_0xdb27db[_0xc078('0xc')];this['outboundNoAnswerCallsDay']=_0xdb27db[_0xc078('0x2d')];this['outboundNoSuchCallsDay']=_0xdb27db[_0xc078('0x2e')];this[_0xc078('0x30')]=_0xdb27db[_0xc078('0x30')];this[_0xc078('0xd')]=_0xdb27db[_0xc078('0xd')];this['outboundUnknownCallsDay']=_0xdb27db[_0xc078('0xe')];this['sumBillable']=_0xdb27db[_0xc078('0x10')];this['sumDuration']=_0xdb27db[_0xc078('0x11')];this['total']=_0xdb27db['total'];if(this[_0xc078('0x24')]===_0xc078('0x56')){this[_0xc078('0xf')]=_0xdb27db['pTalking'];}};module[_0xc078('0x57')]=VoiceQueueSummary; \ No newline at end of file +var _0x9fd4=['ringing','talking','waiting','answered','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','ringInUse','loggedin','callers','length','SIP/','online','incall','includes','status','keys','queue','dialer','exten','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','outboundRejectCallsDay','preview','exports','available','loggedIn','loggedInDb','paused'];(function(_0x5ad4be,_0x357097){var _0x156465=function(_0x4935ce){while(--_0x4935ce){_0x5ad4be['push'](_0x5ad4be['shift']());}};_0x156465(++_0x357097);}(_0x9fd4,0x16c));var _0x49fd=function(_0x4c075b,_0x56c2e7){_0x4c075b=_0x4c075b-0x0;var _0x228448=_0x9fd4[_0x4c075b];return _0x228448;};'use strict';var INBOUND_COUNTERS=[_0x49fd('0x0'),_0x49fd('0x1'),_0x49fd('0x2'),_0x49fd('0x3'),_0x49fd('0x4'),_0x49fd('0x5'),_0x49fd('0x6')];var OUTBOUND_COUNTERS=[_0x49fd('0x0'),_0x49fd('0x7'),'inUse','loggedIn',_0x49fd('0x2'),_0x49fd('0x8'),_0x49fd('0x9'),_0x49fd('0xa'),'outboundBlacklistCallsDay',_0x49fd('0xb'),_0x49fd('0xc'),_0x49fd('0xd'),_0x49fd('0xe'),_0x49fd('0xf'),'outboundRejectCallsDay',_0x49fd('0x10'),_0x49fd('0x3'),_0x49fd('0x11'),_0x49fd('0x5'),_0x49fd('0x12'),_0x49fd('0x13'),_0x49fd('0x14'),'waiting'];function VoiceQueueSummary(_0x70933e){this['id']=_0x70933e['id'];this[_0x49fd('0x15')]=_0x70933e[_0x49fd('0x15')];this[_0x49fd('0x16')]=_0x70933e[_0x49fd('0x16')];this[_0x49fd('0x17')]=_0x70933e[_0x49fd('0x17')]||0x0;this[_0x49fd('0x7')]=_0x70933e[_0x49fd('0x7')]||0x0;this[_0x49fd('0x0')]=_0x70933e[_0x49fd('0x0')]||0x0;this[_0x49fd('0x18')]=_0x70933e[_0x49fd('0x18')]||0x0;this[_0x49fd('0x19')]=_0x70933e[_0x49fd('0x19')]||0x0;this[_0x49fd('0x1a')]=_0x70933e[_0x49fd('0x1a')]||0x0;this[_0x49fd('0x1')]=_0x70933e[_0x49fd('0x1')]||0x0;this[_0x49fd('0x2')]=_0x70933e[_0x49fd('0x2')]||0x0;this[_0x49fd('0x1b')]=_0x70933e[_0x49fd('0x1b')]||0x0;this[_0x49fd('0x1c')]=_0x70933e[_0x49fd('0x1c')]||0x0;this[_0x49fd('0x3')]=_0x70933e['paused']||0x0;this[_0x49fd('0x4')]=_0x70933e[_0x49fd('0x4')]||0x0;this['ringInUse']=_0x70933e['ringInUse'];this[_0x49fd('0x12')]=_0x70933e['sumBillable'];this[_0x49fd('0x13')]=_0x70933e[_0x49fd('0x13')];this['sumHoldTime']=_0x70933e[_0x49fd('0x1d')]||0x0;this[_0x49fd('0x5')]=_0x70933e['talking']||0x0;this[_0x49fd('0x14')]=_0x70933e[_0x49fd('0x14')]||0x0;this[_0x49fd('0x1e')]=_0x70933e[_0x49fd('0x1e')];this[_0x49fd('0x1f')]=_0x70933e[_0x49fd('0x1f')]||0x0;this['unknown']=_0x70933e[_0x49fd('0x20')]||0x0;this[_0x49fd('0x21')]=_0x70933e[_0x49fd('0x21')]||0x0;this['waiting']=_0x70933e[_0x49fd('0x6')]||0x0;if(_0x70933e[_0x49fd('0x1e')]===_0x49fd('0x22')){this['pTalking']=_0x70933e['pTalking']||0x0;this['dialActive']=_0x70933e[_0x49fd('0x23')];this[_0x49fd('0x24')]=_0x70933e[_0x49fd('0x24')];this[_0x49fd('0x25')]=_0x70933e[_0x49fd('0x25')];this[_0x49fd('0x26')]=_0x70933e[_0x49fd('0x26')];this[_0x49fd('0x27')]=_0x70933e['dialOriginateTimeout'];this[_0x49fd('0x28')]=_0x70933e['dialPrefix'];this[_0x49fd('0x29')]=_0x70933e[_0x49fd('0x29')];this['outboundAnswerAgiCallsDay']=_0x70933e[_0x49fd('0x2a')];this[_0x49fd('0xa')]=_0x70933e[_0x49fd('0xa')];this[_0x49fd('0x2b')]=_0x70933e[_0x49fd('0x2b')];this[_0x49fd('0xb')]=_0x70933e[_0x49fd('0xb')];this[_0x49fd('0xc')]=_0x70933e['outboundCongestionCallsDay'];this[_0x49fd('0x2c')]=_0x70933e['outboundDropCallsDayACS'];this[_0x49fd('0x2d')]=_0x70933e['outboundDropCallsDayCallersExit'];this[_0x49fd('0x2e')]=_0x70933e[_0x49fd('0x2e')];this[_0x49fd('0xd')]=_0x70933e['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x70933e['outboundNoSuchCallsDay'];this[_0x49fd('0x2f')]=_0x70933e[_0x49fd('0x2f')];this['outboundReCallsDay']=_0x70933e[_0x49fd('0xf')];this['outboundRejectCallsDay']=_0x70933e['outboundRejectCallsDay'];this[_0x49fd('0x10')]=_0x70933e[_0x49fd('0x10')];this[_0x49fd('0x30')]=_0x70933e[_0x49fd('0x30')];this[_0x49fd('0x31')]=_0x70933e['predictiveIntervalAvgHoldtime'];this['predictiveIntervalAvgTalktime']=_0x70933e[_0x49fd('0x32')];this[_0x49fd('0x33')]=_0x70933e[_0x49fd('0x33')];this[_0x49fd('0x34')]=_0x70933e['predictiveIntervalDroppedCallsTimeout'];this[_0x49fd('0x35')]=_0x70933e[_0x49fd('0x35')];this[_0x49fd('0x36')]=_0x70933e[_0x49fd('0x36')];this[_0x49fd('0x37')]=_0x70933e[_0x49fd('0x37')];this[_0x49fd('0x38')]=_0x70933e[_0x49fd('0x38')];this[_0x49fd('0x39')]=_0x70933e[_0x49fd('0x39')];this[_0x49fd('0x3a')]=_0x70933e['predictiveIntervalAvailable'];this[_0x49fd('0x3b')]=_0x70933e[_0x49fd('0x3b')];this[_0x49fd('0x8')]=_0x70933e[_0x49fd('0x8')];this[_0x49fd('0x3c')]=_0x70933e[_0x49fd('0x3c')];this[_0x49fd('0x3d')]=_0x70933e[_0x49fd('0x3d')];this[_0x49fd('0x3e')]=_0x70933e['erlangAbandonmentRate'];this[_0x49fd('0x3f')]=_0x70933e['erlangBusyFactor'];this[_0x49fd('0x40')]=_0x70933e[_0x49fd('0x40')];this['startProgressive']=_0x70933e[_0x49fd('0x41')];this[_0x49fd('0x42')]=_0x70933e['message'];this[_0x49fd('0x43')]=_0x70933e['statusMessage'];}if(_0x70933e['Trunk']){this['Trunk']={'id':_0x70933e[_0x49fd('0x44')]['id'],'name':_0x70933e[_0x49fd('0x44')][_0x49fd('0x15')],'active':_0x70933e[_0x49fd('0x44')]['active'],'callerid':_0x70933e[_0x49fd('0x44')][_0x49fd('0x45')]};}}VoiceQueueSummary[_0x49fd('0x46')][_0x49fd('0x47')]=function(_0x115c5a,_0x28d7ea,_0x26a0c7,_0x1f5c18){this['loggedInDb']=0x0;this[_0x49fd('0x5')]=0x0;this[_0x49fd('0x3')]=0x0;this['unknown']=0x0;this[_0x49fd('0x1c')]=0x0;this[_0x49fd('0x19')]=0x0;this['busy']=0x0;this[_0x49fd('0x1a')]=0x0;this['unavailable']=0x0;this[_0x49fd('0x4')]=0x0;this[_0x49fd('0x48')]=0x0;this[_0x49fd('0x1b')]=0x0;if(_0x26a0c7){if(_0x26a0c7[_0x49fd('0x0')]){this['available']=Number(_0x26a0c7['available']);}if(_0x26a0c7[_0x49fd('0x49')]){this['loggedIn']=Number(_0x26a0c7[_0x49fd('0x49')]);}if(_0x26a0c7[_0x49fd('0x4a')]){this[_0x49fd('0x6')]=Number(_0x26a0c7[_0x49fd('0x4a')]);}}for(var _0x5d32d7=0x0;_0x5d32d7<_0x115c5a[_0x49fd('0x4b')];_0x5d32d7++){var _0x29bcbf=_0x28d7ea[_0x49fd('0x4c')+_0x115c5a[_0x5d32d7][_0x49fd('0x15')]];if(_0x29bcbf&&_0x29bcbf[_0x49fd('0x4d')]){this[_0x49fd('0x2')]+=0x1;}if(_0x115c5a[_0x5d32d7][_0x49fd('0x4e')]==='1'){this[_0x49fd('0x5')]+=0x1;}if(_0x115c5a[_0x5d32d7][_0x49fd('0x3')]==='1'&&!['2','7','8'][_0x49fd('0x4f')](_0x115c5a[_0x5d32d7][_0x49fd('0x50')])){this[_0x49fd('0x3')]+=0x1;}switch(_0x115c5a[_0x5d32d7][_0x49fd('0x50')]){case'0':this[_0x49fd('0x20')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x49fd('0x18')]+=0x1;break;case'4':this[_0x49fd('0x1a')]+=0x1;break;case'5':this[_0x49fd('0x1f')]+=0x1;break;case'6':this[_0x49fd('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x49fd('0x1b')]+=0x1;break;}}if(this[_0x49fd('0x24')]==='booked'){var _0x341728=Object[_0x49fd('0x51')](_0x1f5c18);for(var _0xaac56f=0x0;_0xaac56f<_0x341728[_0x49fd('0x4b')];_0xaac56f++){var _0x1316cb=_0x341728[_0xaac56f];var _0x3c6070=_0x1f5c18[_0x1316cb];if(_0x3c6070[_0x49fd('0x52')]===this[_0x49fd('0x15')]&&_0x3c6070[_0x49fd('0x1e')]===_0x49fd('0x53')&&_0x3c6070[_0x49fd('0x54')]==='xcally-motion-preview'){this[_0x49fd('0x5')]+=0x1;}}if(this[_0x49fd('0x5')]>this[_0x49fd('0x19')]){this[_0x49fd('0x5')]=this[_0x49fd('0x19')];}this[_0x49fd('0x11')]=0x0;}return this;};VoiceQueueSummary['prototype']['compareToInboundQueue']=function(_0x436a03){var _0x765bca=![];if(_0x436a03){_0x765bca=INBOUND_COUNTERS[_0x49fd('0x55')](function(_0x5c34c0){return this[_0x5c34c0]!==_0x436a03[_0x5c34c0];},this);}return _0x765bca;};VoiceQueueSummary[_0x49fd('0x46')][_0x49fd('0x56')]=function(_0x5d5dd5){var _0x501a05=![];var _0x5c3268=![];var _0x49c53b=![];if(_0x5d5dd5){_0x501a05=this['dialMethod']!==_0x5d5dd5['dialMethod']||this['dialActive']!==_0x5d5dd5[_0x49fd('0x23')]||this[_0x49fd('0x42')]!==_0x5d5dd5[_0x49fd('0x42')]||this[_0x49fd('0x43')]!==_0x5d5dd5[_0x49fd('0x43')];_0x5c3268=OUTBOUND_COUNTERS[_0x49fd('0x55')](function(_0x39a2a5){return this[_0x39a2a5]!==_0x5d5dd5[_0x39a2a5];},this);if(this[_0x49fd('0x44')]&&_0x5d5dd5[_0x49fd('0x44')]){_0x49c53b=this[_0x49fd('0x44')]['name']!==_0x5d5dd5[_0x49fd('0x44')][_0x49fd('0x15')]||this[_0x49fd('0x44')][_0x49fd('0x57')]!==_0x5d5dd5[_0x49fd('0x44')][_0x49fd('0x57')];}}return _0x501a05||_0x5c3268||_0x49c53b;};VoiceQueueSummary['prototype'][_0x49fd('0x58')]=function(_0x40f18c){this['answered']=_0x40f18c['answered'];this[_0x49fd('0x42')]=_0x40f18c['message'];this[_0x49fd('0x43')]=_0x40f18c['statusMessage'];this[_0x49fd('0x8')]=_0x40f18c['originated'];this[_0x49fd('0x9')]=_0x40f18c[_0x49fd('0x9')];this['outboundAnswerCallsDay']=_0x40f18c[_0x49fd('0xa')];this[_0x49fd('0x2b')]=_0x40f18c[_0x49fd('0x2b')];this[_0x49fd('0xb')]=_0x40f18c[_0x49fd('0xb')];this[_0x49fd('0xc')]=_0x40f18c[_0x49fd('0xc')];this[_0x49fd('0xd')]=_0x40f18c['outboundNoAnswerCallsDay'];this[_0x49fd('0xe')]=_0x40f18c[_0x49fd('0xe')];this[_0x49fd('0xf')]=_0x40f18c['outboundReCallsDay'];this[_0x49fd('0x59')]=_0x40f18c[_0x49fd('0x59')];this[_0x49fd('0x10')]=_0x40f18c[_0x49fd('0x10')];this[_0x49fd('0x12')]=_0x40f18c[_0x49fd('0x12')];this[_0x49fd('0x13')]=_0x40f18c[_0x49fd('0x13')];this[_0x49fd('0x14')]=_0x40f18c['total'];if(this[_0x49fd('0x24')]===_0x49fd('0x5a')){this['pTalking']=_0x40f18c[_0x49fd('0x11')];}};module[_0x49fd('0x5b')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index d90fce6..eddf9a1 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 _0x20de=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x333755,_0x47aadf){var _0x1335ce=function(_0x370044){while(--_0x370044){_0x333755['push'](_0x333755['shift']());}};_0x1335ce(++_0x47aadf);}(_0x20de,0x1ad));var _0xe20d=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x20de[_0x2b9b7f];return _0x4ed19a;};'use strict';function VtigerAccount(_0x2fb432){this['id']=_0x2fb432['id']||0x0;this[_0xe20d('0x0')]=_0x2fb432[_0xe20d('0x0')]||'';this[_0xe20d('0x1')]=_0x2fb432[_0xe20d('0x1')]||'';this[_0xe20d('0x2')]=_0x2fb432[_0xe20d('0x2')]||'';this['remoteUri']=_0x2fb432[_0xe20d('0x3')]||'';this['serverUrl']=_0x2fb432[_0xe20d('0x4')]||'';this[_0xe20d('0x5')]=_0x2fb432[_0xe20d('0x5')]||{};}module[_0xe20d('0x6')]=VtigerAccount; \ No newline at end of file +var _0x7b13=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x7b13,0x1d1));var _0x37b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b13[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x3880ab){this['id']=_0x3880ab['id']||0x0;this[_0x37b1('0x0')]=_0x3880ab[_0x37b1('0x0')]||'';this[_0x37b1('0x1')]=_0x3880ab['username']||'';this[_0x37b1('0x2')]=_0x3880ab[_0x37b1('0x2')]||'';this[_0x37b1('0x3')]=_0x3880ab['remoteUri']||'';this[_0x37b1('0x4')]=_0x3880ab[_0x37b1('0x4')]||'';this[_0x37b1('0x5')]=_0x3880ab[_0x37b1('0x5')]||{};}module[_0x37b1('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 ed6bdeb..1ad019f 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 _0x4eef=['name','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0xd75a66,_0x156900){var _0x35ae80=function(_0x362286){while(--_0x362286){_0xd75a66['push'](_0xd75a66['shift']());}};_0x35ae80(++_0x156900);}(_0x4eef,0x148));var _0xf4ee=function(_0x37f4d4,_0x65ae4f){_0x37f4d4=_0x37f4d4-0x0;var _0x150752=_0x4eef[_0x37f4d4];return _0x150752;};'use strict';function ZendeskAccount(_0x3ad5c5){this['id']=_0x3ad5c5['id']||0x0;this[_0xf4ee('0x0')]=_0x3ad5c5[_0xf4ee('0x0')]||'';this['username']=_0x3ad5c5['username']||'';this['password']=_0x3ad5c5['password']||'';this[_0xf4ee('0x1')]=_0x3ad5c5[_0xf4ee('0x1')]||'';this[_0xf4ee('0x2')]=_0x3ad5c5[_0xf4ee('0x2')]||'';this[_0xf4ee('0x3')]=_0x3ad5c5[_0xf4ee('0x3')]||'';this['type']=_0x3ad5c5[_0xf4ee('0x4')]||_0xf4ee('0x5');this['serverUrl']=_0x3ad5c5[_0xf4ee('0x6')]||'';this[_0xf4ee('0x7')]=_0x3ad5c5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x2ff3=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x129f99,_0x198043){var _0x4cddf3=function(_0x4b86b6){while(--_0x4b86b6){_0x129f99['push'](_0x129f99['shift']());}};_0x4cddf3(++_0x198043);}(_0x2ff3,0x1a7));var _0x32ff=function(_0x25f96d,_0x43cf35){_0x25f96d=_0x25f96d-0x0;var _0x40ea08=_0x2ff3[_0x25f96d];return _0x40ea08;};'use strict';function ZendeskAccount(_0x46560b){this['id']=_0x46560b['id']||0x0;this[_0x32ff('0x0')]=_0x46560b[_0x32ff('0x0')]||'';this[_0x32ff('0x1')]=_0x46560b[_0x32ff('0x1')]||'';this[_0x32ff('0x2')]=_0x46560b[_0x32ff('0x2')]||'';this[_0x32ff('0x3')]=_0x46560b[_0x32ff('0x3')]||'';this[_0x32ff('0x4')]=_0x46560b['remoteUri']||'';this[_0x32ff('0x5')]=_0x46560b[_0x32ff('0x5')]||'';this['type']=_0x46560b[_0x32ff('0x6')]||_0x32ff('0x7');this['serverUrl']=_0x46560b[_0x32ff('0x8')]||'';this[_0x32ff('0x9')]=_0x46560b[_0x32ff('0x9')]||{};}module[_0x32ff('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 aef9308..4f60253 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 _0x04dd=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x27d3f0,_0x5ac562){var _0x3edd25=function(_0xdbf130){while(--_0xdbf130){_0x27d3f0['push'](_0x27d3f0['shift']());}};_0x3edd25(++_0x5ac562);}(_0x04dd,0x191));var _0xd04d=function(_0x5ae93d,_0x48a929){_0x5ae93d=_0x5ae93d-0x0;var _0x3bc344=_0x04dd[_0x5ae93d];return _0x3bc344;};'use strict';function ZohoAccount(_0x2b2bf4){this['id']=_0x2b2bf4['id']||0x0;this[_0xd04d('0x0')]=_0x2b2bf4[_0xd04d('0x0')]||'';this[_0xd04d('0x1')]=_0x2b2bf4[_0xd04d('0x1')]||'';this[_0xd04d('0x2')]=_0x2b2bf4['host']||'';this[_0xd04d('0x3')]=_0x2b2bf4[_0xd04d('0x3')]||'';this[_0xd04d('0x4')]=_0x2b2bf4['clientId']||'';this[_0xd04d('0x5')]=_0x2b2bf4['clientSecret']||'';this[_0xd04d('0x6')]=_0x2b2bf4[_0xd04d('0x6')]||'';this[_0xd04d('0x7')]=_0x2b2bf4[_0xd04d('0x7')]||'';this[_0xd04d('0x8')]=_0x2b2bf4[_0xd04d('0x8')]||'';this[_0xd04d('0x9')]=_0x2b2bf4[_0xd04d('0x9')]||{};}module[_0xd04d('0xa')]=ZohoAccount; \ No newline at end of file +var _0xa814=['description','host','zone','serverUrl','code','refreshToken','Configurations','name'];(function(_0x4442ab,_0x1ef637){var _0x579aee=function(_0x114fce){while(--_0x114fce){_0x4442ab['push'](_0x4442ab['shift']());}};_0x579aee(++_0x1ef637);}(_0xa814,0xbf));var _0x4a81=function(_0x336a9f,_0x2ce6f3){_0x336a9f=_0x336a9f-0x0;var _0x17b127=_0xa814[_0x336a9f];return _0x17b127;};'use strict';function ZohoAccount(_0x167a0f){this['id']=_0x167a0f['id']||0x0;this[_0x4a81('0x0')]=_0x167a0f[_0x4a81('0x0')]||'';this[_0x4a81('0x1')]=_0x167a0f['description']||'';this[_0x4a81('0x2')]=_0x167a0f[_0x4a81('0x2')]||'';this[_0x4a81('0x3')]=_0x167a0f[_0x4a81('0x3')]||'';this['clientId']=_0x167a0f['clientId']||'';this['clientSecret']=_0x167a0f['clientSecret']||'';this[_0x4a81('0x4')]=_0x167a0f['serverUrl']||'';this[_0x4a81('0x5')]=_0x167a0f[_0x4a81('0x5')]||'';this[_0x4a81('0x6')]=_0x167a0f['refreshToken']||'';this[_0x4a81('0x7')]=_0x167a0f['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index f35e9a3..c82a75d 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 _0x3266=['callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x3266,0x6a));var _0x6326=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0x3266[_0x3b5049];return _0x12454e;};'use strict';var util=require(_0x6326('0x0'));var _=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));function checkNameSurname(_0x2bed83,_0x545df7,_0x6b67c0){var _0x29aef3='';if(!_[_0x6326('0x3')](_0x545df7)&&_0x6326('0x4')===typeof _0x545df7){_0x29aef3+=_0x545df7;}if(!_['isNil'](_0x6b67c0)&&_0x6326('0x4')===typeof _0x6b67c0){_0x29aef3+='\x20'+_0x6b67c0;}if(_0x29aef3!==''){return _0x29aef3;}return _0x2bed83;}function Action(_0x5f38a3,_0x25ecd8,_0x44460c,_0x14208e,_0x5402e5){this[_0x6326('0x5')]=_0x44460c||undefined;this['idContact']=_0x5f38a3['id'];this[_0x6326('0x6')]=_0x25ecd8[_0x6326('0x7')];this[_0x6326('0x8')]=_0x25ecd8[_0x6326('0x8')];this[_0x6326('0x9')]='queue';this[_0x6326('0xa')]=![];this[_0x6326('0xb')]=_[_0x6326('0x3')](_0x5f38a3[_0x6326('0xc')])?undefined:_0x5f38a3[_0x6326('0xc')][_0x6326('0x7')];this[_0x6326('0xd')]=this[_0x6326('0xb')]?util[_0x6326('0xe')](_0x6326('0xf'),this['membername']):_0x14208e||undefined;this['calleridname']=checkNameSurname(_0x5f38a3[_0x6326('0x10')][_0x6326('0x11')],_0x5f38a3['Contact'][_0x6326('0x12')],_0x5f38a3['Contact'][_0x6326('0x13')]);this[_0x6326('0x14')]=_0x5f38a3[_0x6326('0x14')]||![];this[_0x6326('0x15')]=_0x5f38a3[_0x6326('0x11')];this[_0x6326('0x16')]=_0x5f38a3['scheduledat'];this[_0x6326('0x17')]=_0x5f38a3['countbusyretry']||0x0;this['countcongestionretry']=_0x5f38a3['countcongestionretry']||0x0;this['countnoanswerretry']=_0x5f38a3['countnoanswerretry']||0x0;this['countglobal']=(_0x5f38a3[_0x6326('0x17')]||0x0)+(_0x5f38a3[_0x6326('0x18')]||0x0)+(_0x5f38a3[_0x6326('0x19')]||0x0)+(_0x5f38a3['countnosuchnumberretry']||0x0)+(_0x5f38a3['countdropretry']||0x0)+(_0x5f38a3[_0x6326('0x1a')]||0x0)+(_0x5f38a3[_0x6326('0x1b')]||0x0)+(_0x5f38a3[_0x6326('0x1c')]||0x0);this[_0x6326('0x1d')]=_0x5f38a3[_0x6326('0x1d')]||0x0;this[_0x6326('0x1e')]=_0x5f38a3[_0x6326('0x1e')]||0x0;this['countabandonedretry']=_0x5f38a3[_0x6326('0x1a')]||0x0;this['countmachineretry']=_0x5f38a3[_0x6326('0x1b')]||0x0;this[_0x6326('0x1c')]=_0x5f38a3[_0x6326('0x1c')]||0x0;this[_0x6326('0x1f')]=_0x5f38a3[_0x6326('0x1f')];this[_0x6326('0x20')]=_0x5f38a3[_0x6326('0x20')];this[_0x6326('0x21')]=_0x5f38a3[_0x6326('0x21')];this[_0x6326('0x22')]=_0x5f38a3[_0x6326('0x22')];this['ContactId']=_0x5f38a3[_0x6326('0x23')];this[_0x6326('0x24')]=_0x5f38a3['ListId'];this['UserId']=_['isNil'](_0x5f38a3[_0x6326('0xc')])?_0x5f38a3['UserId']:_0x5f38a3[_0x6326('0xc')]['id'];this[_0x6326('0x25')]=_0x5f38a3['VoiceQueueId'];this[_0x6326('0x26')]='';this[_0x6326('0x27')]='';}Action[_0x6326('0x28')][_0x6326('0x29')]=function(){return util[_0x6326('0xe')](_0x6326('0x2a'),this[_0x6326('0x2b')],this[_0x6326('0x2c')]);};module[_0x6326('0x2d')]=Action; \ No newline at end of file +var _0x2032=['originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','lodash','moment','string','isNil','uniqueid','idContact','queue','type','dialAnswer','membername','Agent','name','format','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0x2032,0xd9));var _0x2203=function(_0x59cdec,_0x389613){_0x59cdec=_0x59cdec-0x0;var _0x35ae53=_0x2032[_0x59cdec];return _0x35ae53;};'use strict';var util=require('util');var _=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));function checkNameSurname(_0xcd892f,_0x4c28da,_0x486390){var _0x228a29='';if(!_['isNil'](_0x4c28da)&&_0x2203('0x2')===typeof _0x4c28da){_0x228a29+=_0x4c28da;}if(!_[_0x2203('0x3')](_0x486390)&&_0x2203('0x2')===typeof _0x486390){_0x228a29+='\x20'+_0x486390;}if(_0x228a29!==''){return _0x228a29;}return _0xcd892f;}function Action(_0x201796,_0x3f7ba1,_0x13367a,_0x2e0f63,_0x2676aa){this[_0x2203('0x4')]=_0x13367a||undefined;this[_0x2203('0x5')]=_0x201796['id'];this[_0x2203('0x6')]=_0x3f7ba1['name'];this['type']=_0x3f7ba1[_0x2203('0x7')];this['campaigntype']=_0x2203('0x6');this[_0x2203('0x8')]=![];this[_0x2203('0x9')]=_['isNil'](_0x201796[_0x2203('0xa')])?undefined:_0x201796['Agent'][_0x2203('0xb')];this['channelAgent']=this[_0x2203('0x9')]?util[_0x2203('0xc')]('SIP/%s',this['membername']):_0x2e0f63||undefined;this['calleridname']=checkNameSurname(_0x201796['Contact']['phone'],_0x201796[_0x2203('0xd')]['firstName'],_0x201796['Contact'][_0x2203('0xe')]);this[_0x2203('0xf')]=_0x201796[_0x2203('0xf')]||![];this[_0x2203('0x10')]=_0x201796[_0x2203('0x11')];this[_0x2203('0x12')]=_0x201796[_0x2203('0x12')];this[_0x2203('0x13')]=_0x201796[_0x2203('0x13')]||0x0;this[_0x2203('0x14')]=_0x201796['countcongestionretry']||0x0;this[_0x2203('0x15')]=_0x201796[_0x2203('0x15')]||0x0;this['countglobal']=(_0x201796[_0x2203('0x13')]||0x0)+(_0x201796[_0x2203('0x14')]||0x0)+(_0x201796['countnoanswerretry']||0x0)+(_0x201796[_0x2203('0x16')]||0x0)+(_0x201796['countdropretry']||0x0)+(_0x201796[_0x2203('0x17')]||0x0)+(_0x201796[_0x2203('0x18')]||0x0)+(_0x201796[_0x2203('0x19')]||0x0);this[_0x2203('0x16')]=_0x201796[_0x2203('0x16')]||0x0;this[_0x2203('0x1a')]=_0x201796['countdropretry']||0x0;this[_0x2203('0x17')]=_0x201796['countabandonedretry']||0x0;this['countmachineretry']=_0x201796[_0x2203('0x18')]||0x0;this['countagentrejectretry']=_0x201796[_0x2203('0x19')]||0x0;this[_0x2203('0x1b')]=_0x201796['callback'];this[_0x2203('0x1c')]=_0x201796['callbackuniqueid'];this['callbackat']=_0x201796[_0x2203('0x1d')];this[_0x2203('0x1e')]=_0x201796[_0x2203('0x1e')];this[_0x2203('0x1f')]=_0x201796[_0x2203('0x1f')];this[_0x2203('0x20')]=_0x201796[_0x2203('0x20')];this[_0x2203('0x21')]=_['isNil'](_0x201796[_0x2203('0xa')])?_0x201796[_0x2203('0x21')]:_0x201796[_0x2203('0xa')]['id'];this['VoiceQueueId']=_0x201796[_0x2203('0x22')];this[_0x2203('0x23')]='';this['originatecalleridname']='';}Action[_0x2203('0x24')][_0x2203('0x25')]=function(){return util[_0x2203('0xc')](_0x2203('0x26'),this[_0x2203('0x27')],this[_0x2203('0x28')]);};module[_0x2203('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8916a73..a6f939c 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 _0xb156=['[callProgressDetectingCustomer][logBusy]','countbusyretry','dialBusyMaxRetry','scheduledAt','NOANSWER','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','dialNoAnswerRetryFrequency','incrementPreviewCounters','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialBusyRetryFrequency','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','resolve','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','execRun','unlock','unlockContact','recallme','isValid','checkIsBlackList','[Preview][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','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','trim','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridName','originatecalleridnum','addVariables','setXMDContactVariables','Contact','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','logLookAgent','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','addVariable','syncVarSet','filterKey','variable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','name','voice_queue_channel:remove','emit','originated','pTalking','sendMessageOneNotActive','available','message','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','logger','syncCampaigns','hasOwnProperty','dialMethod','type','outbound','dialActive','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','catch','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','setMessage','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','Trunk','isTrunkReachable','TrunkBackup','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','custom:agentbusy','busy'];(function(_0x59bd74,_0x51e23a){var _0x310574=function(_0xa102d6){while(--_0xa102d6){_0x59bd74['push'](_0x59bd74['shift']());}};_0x310574(++_0x51e23a);}(_0xb156,0x1da));var _0x6b15=function(_0x593683,_0x2b3213){_0x593683=_0x593683-0x0;var _0x44cc39=_0xb156[_0x593683];return _0x44cc39;};'use strict';var util=require(_0x6b15('0x0'));var _=require(_0x6b15('0x1'));var uuid=require(_0x6b15('0x2'));var moment=require(_0x6b15('0x3'));var Redis=require(_0x6b15('0x4'));var config=require(_0x6b15('0x5'));var logger=require(_0x6b15('0x6'))(_0x6b15('0x7'));var loggerAction=require(_0x6b15('0x6'))('actionPreview');var ami=require(_0x6b15('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x6b15('0x9'));var Action=require(_0x6b15('0xa'));var ut=require(_0x6b15('0xb'));var utils=require(_0x6b15('0xc'));config['redis']=_[_0x6b15('0xd')](config['redis'],{'host':_0x6b15('0xe'),'port':0x18eb});var io=require(_0x6b15('0xf'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x6b15('0x10')][_0x6b15('0x11')]=function(_0x320b8d){this[_0x6b15('0x12')]=this['tail']?this[_0x6b15('0x12')][_0x6b15('0x13')](_0x320b8d):_0x320b8d();};function Preview(_0x190af5){this['sequence']=new Sequence();this[_0x6b15('0x14')]=_0x190af5[_0x6b15('0x15')];this[_0x6b15('0x16')]=_0x190af5[_0x6b15('0x16')];this[_0x6b15('0x17')]={};this[_0x6b15('0x18')]=_0x190af5[_0x6b15('0x18')];this[_0x6b15('0x19')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x6b15('0x1a')](this));ami['on']('hangup',this[_0x6b15('0x1b')][_0x6b15('0x1a')](this));ami['on'](_0x6b15('0x1c'),this[_0x6b15('0x1d')]['bind'](this));ami['on'](_0x6b15('0x1e'),this['syncDialEnd'][_0x6b15('0x1a')](this));ami['on']('newexten',this[_0x6b15('0x1f')][_0x6b15('0x1a')](this));ami['on'](_0x6b15('0x20'),this['syncVarSet'][_0x6b15('0x1a')](this));ami['on'](_0x6b15('0x21'),this[_0x6b15('0x22')][_0x6b15('0x1a')](this));ami['on'](_0x6b15('0x23'),this['syncBlindTransfer'][_0x6b15('0x1a')](this));this[_0x6b15('0x24')](this[_0x6b15('0x14')]);}function emit(_0x146ab2,_0x40957e,_0x15a1bd){io['to'](_0x146ab2)['emit'](_0x40957e,_0x15a1bd);}function emitVoiceQueueChannelRemove(_0x47293b){logger[_0x6b15('0x25')](_0x6b15('0x26'),JSON['stringify'](_0x47293b));emit(util[_0x6b15('0x27')]('voice:queue:%s',_0x47293b[_0x6b15('0x28')]),_0x6b15('0x29'),_0x47293b);io[_0x6b15('0x2a')]('voice_queue_presence:remove',_0x47293b);}function notSendMessagesQueue(_0x5c8e71){if(_0x5c8e71['sendMessageOneNotActive']){if(_0x5c8e71[_0x6b15('0x2b')]===0x0&&_0x5c8e71[_0x6b15('0x2c')]===0x0){_0x5c8e71[_0x6b15('0x2d')]=![];_0x5c8e71[_0x6b15('0x2e')]=0x0;_0x5c8e71['paused']=0x0;_0x5c8e71[_0x6b15('0x2f')]=utils[_0x6b15('0x30')][_0x6b15('0x31')];ut['logger'](_0x6b15('0x32'),_0x5c8e71[_0x6b15('0x28')]+'\x20is\x20not\x20active');}else{_0x5c8e71[_0x6b15('0x2f')]=utils[_0x6b15('0x30')][_0x6b15('0x33')];ut[_0x6b15('0x34')](_0x6b15('0x32'),_0x5c8e71[_0x6b15('0x28')]+'\x20is\x20deactivated');}}}Preview['prototype'][_0x6b15('0x24')]=function(){var _0xf26ede=this;setInterval(function(){_0xf26ede[_0x6b15('0x35')]();},0x7cf);};Preview[_0x6b15('0x10')][_0x6b15('0x35')]=function(){var _0x2c8a6a=this[_0x6b15('0x14')];this[_0x6b15('0x19')]+=0x1;for(var _0x59c9e1 in _0x2c8a6a){if(_0x2c8a6a[_0x6b15('0x36')](_0x59c9e1)&&(_0x2c8a6a[_0x59c9e1][_0x6b15('0x37')]===_0x6b15('0x7')||_0x2c8a6a[_0x59c9e1][_0x6b15('0x37')]==='booked')&&_0x2c8a6a[_0x59c9e1]['type']==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x6b15('0x19')]=0x0;this['clearZombieChannels']();}}if(_0x2c8a6a[_0x6b15('0x36')](_0x59c9e1)&&_0x2c8a6a[_0x59c9e1]['dialMethod']===_0x6b15('0x7')&&_0x2c8a6a[_0x59c9e1][_0x6b15('0x38')]===_0x6b15('0x39')){if(_0x2c8a6a[_0x59c9e1][_0x6b15('0x3a')]){this['setMessage'](_0x2c8a6a[_0x59c9e1]);if(_0x2c8a6a[_0x59c9e1][_0x6b15('0x3b')])this[_0x6b15('0x3c')](_0x2c8a6a[_0x59c9e1]);}else{notSendMessagesQueue(_0x2c8a6a[_0x59c9e1]);}}}};Preview[_0x6b15('0x10')][_0x6b15('0x3d')]=function(_0xa1f70e){var _0x494a10=this;this[_0x6b15('0x3e')][_0x6b15('0x11')](function(){if(!_[_0x6b15('0x3f')](_0x494a10[_0x6b15('0x17')][_0xa1f70e])){loggerAction[_0x6b15('0x25')]('[clearZombieChannels][talking]',_0xa1f70e,_0x6b15('0x40'),_0x494a10[_0x6b15('0x17')][_0xa1f70e][_0x6b15('0x41')],_0x6b15('0x42'),JSON[_0x6b15('0x43')](_0x494a10[_0x6b15('0x14')][_0x494a10['actions'][_0xa1f70e]['queue']][_0x6b15('0x2b')]),_0x6b15('0x44'),JSON[_0x6b15('0x43')](_0x494a10[_0x6b15('0x14')][_0x494a10['actions'][_0xa1f70e][_0x6b15('0x41')]][_0x6b15('0x2c')]),JSON[_0x6b15('0x43')](_0x494a10[_0x6b15('0x17')][_0xa1f70e][_0x6b15('0x45')]),JSON[_0x6b15('0x43')](_[_0x6b15('0x46')](_0x494a10[_0x6b15('0x17')][_0xa1f70e],[_0x6b15('0x47'),_0x6b15('0x48'),_0x6b15('0x49'),'ListId'])));return ami['Action']({'action':_0x6b15('0x4a'),'channel':_0x494a10['actions'][_0xa1f70e][_0x6b15('0x4b')]})['catch'](function(_0x5f5410){if(_0x5f5410[_0x6b15('0x2f')]===_0x6b15('0x4c')){setTimeout(function(){if(_0x494a10[_0x6b15('0x17')][_0xa1f70e]){ut[_0x6b15('0x4d')](_0x494a10[_0x6b15('0x14')][_0x494a10[_0x6b15('0x17')][_0xa1f70e]['queue']],_0x6b15('0x4e'));if(_0x494a10[_0x6b15('0x17')][_0xa1f70e][_0x6b15('0x45')]===!![]){ut[_0x6b15('0x4f')](_0x494a10[_0x6b15('0x14')][_0x494a10[_0x6b15('0x17')][_0xa1f70e][_0x6b15('0x41')]],_0x6b15('0x4e'));ut[_0x6b15('0x50')](_0x6b15('0x51')+_0xa1f70e,_0x494a10[_0x6b15('0x17')][_0xa1f70e][_0x6b15('0x41')]);}ut[_0x6b15('0x50')](_0x6b15('0x52')+_0xa1f70e,_0x494a10[_0x6b15('0x17')][_0xa1f70e][_0x6b15('0x41')]);delete _0x494a10['actions'][_0xa1f70e];}},0x2328);}});}});};Preview['prototype'][_0x6b15('0x53')]=function(){var _0x312410=this;loggerAction[_0x6b15('0x25')](_0x6b15('0x54'),_['size'](this[_0x6b15('0x17')]));for(var _0x582947 in this['actions']){if(_0x312410[_0x6b15('0x17')][_0x6b15('0x36')](_0x582947)){_0x312410[_0x6b15('0x3d')](_0x582947);}}};Preview['prototype'][_0x6b15('0x3c')]=function(_0x28cddd){var _0x180525=this;rpcDb[_0x6b15('0x55')](_0x28cddd['id'],ut[_0x6b15('0x56')](this['agents']))[_0x6b15('0x57')](function(_0x58a80e){if(!_[_0x6b15('0x3f')](_0x58a80e)){for(var _0x5491e3=0x0;_0x5491e3<_0x58a80e['length'];_0x5491e3+=0x1){if(ut[_0x6b15('0x58')](_0x58a80e[_0x5491e3][_0x6b15('0x59')])<_0x28cddd[_0x6b15('0x5a')]*0x3c){if(_0x58a80e[_0x5491e3][_0x6b15('0x5b')]&&!_0x58a80e[_0x5491e3][_0x6b15('0x5b')]['voicePause']){_0x180525[_0x6b15('0x5c')](_0x58a80e[_0x5491e3]['id'])[_0x6b15('0x57')](ut[_0x6b15('0x5d')](_0x6b15('0x5e')))[_0x6b15('0x5f')](ut[_0x6b15('0x5d')](_0x6b15('0x5e')));}else{rpcDb[_0x6b15('0x60')](_0x58a80e[_0x5491e3]['id']);}}else{var _0x415078=new Action(_0x58a80e[_0x5491e3],_0x28cddd);_0x415078[_0x6b15('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x28cddd[_0x6b15('0x62')]+=0x1;ut[_0x6b15('0x63')](_0x415078,0x17,_0x6b15('0x64'));if(_0x28cddd[_0x6b15('0x65')]){rpcDb['rescheduleContactInQueue'](ut[_0x6b15('0x66')](_0x58a80e[_0x5491e3]));rpcDb[_0x6b15('0x67')](_0x415078,_0x6b15('0x68'));}else{ut['logCustomer'](_0x415078,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x415078,_0x6b15('0x69'));rpcDb['createCustomerFinal'](_0x415078,_0x6b15('0x69'));}}}}})[_0x6b15('0x5f')](ut[_0x6b15('0x5d')]('[getContactRecallMe]'));};Preview[_0x6b15('0x10')][_0x6b15('0x6a')]=function(_0x26dc5){_0x26dc5[_0x6b15('0x2d')]=!![];if(ut[_0x6b15('0x6b')](_0x26dc5['loggedIn'])){_0x26dc5[_0x6b15('0x2f')]=utils[_0x6b15('0x30')][_0x6b15('0x6c')];}else if(!ut[_0x6b15('0x6d')](_0x26dc5[_0x6b15('0x3a')])){_0x26dc5[_0x6b15('0x2f')]=utils[_0x6b15('0x30')]['INACTIVE'];}else if(!this['isTrunkReachable'](_0x26dc5[_0x6b15('0x6e')])){if(!this[_0x6b15('0x6f')](_0x26dc5[_0x6b15('0x70')])){_0x26dc5['message']=utils[_0x6b15('0x30')]['UNREACHABLE_TRUNK'];}else{_0x26dc5[_0x6b15('0x2f')]=utils[_0x6b15('0x30')][_0x6b15('0x71')];}}else{_0x26dc5[_0x6b15('0x2f')]=utils[_0x6b15('0x30')][_0x6b15('0x71')];}};Preview[_0x6b15('0x10')]['callProgressDetectingCustomer']=function(_0xda5c40,_0x28d3f9,_0x1381dc){var _0x2145f5=this;var _0x4cb357=this['actions'][_0x28d3f9];var _0x1ab60c=this[_0x6b15('0x14')][_0x4cb357[_0x6b15('0x41')]];var _0x306de1;var _0x3fcd47=![];var _0x4d8443=0x2;var _0x2be5b0=0x3;if(_0x1ab60c){switch(_0x1381dc){case'1':_0x1ab60c[_0x6b15('0x72')]+=0x1;_0x4cb357[_0x6b15('0x73')]+=0x1;_0x4cb357[_0x6b15('0x74')]=ut[_0x6b15('0x75')](_0x4cb357);ut[_0x6b15('0x63')](_0x4cb357,0x0,_0x6b15('0x76'));ami['emit'](_0x6b15('0x77'),ut[_0x6b15('0x78')](_0x4cb357,_0x6b15('0x79')));rpcDb[_0x6b15('0x67')](_0x4cb357,_0x6b15('0x7a'));_0x2145f5[_0x6b15('0x7b')](_0x4cb357,'0',_0x1ab60c)[_0x6b15('0x57')](function(_0x463597){_0x3fcd47=_0x463597[_0x6b15('0x7c')]==0x1;_0x4d8443=_0x1ab60c[_0x6b15('0x7d')];_0x2be5b0=_0x1ab60c[_0x6b15('0x7e')];if(!_0x3fcd47){if(ut[_0x6b15('0x75')](_0x4cb357)>=_0x1ab60c[_0x6b15('0x7f')]){_0x306de1=ut[_0x6b15('0x80')](_0x4cb357,0xf,_0x6b15('0x81'));rpcDb[_0x6b15('0x82')](_0x306de1,_0x6b15('0x83'));}else{if(_0x4cb357[_0x6b15('0x73')]>=_0x1ab60c['dialNoSuchNumberMaxRetry']){rpcDb[_0x6b15('0x82')](_0x4cb357,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x4cb357,_0x6b15('0x73'),_0x1ab60c[_0x6b15('0x7d')]),_0x4cb357[_0x6b15('0x84')],_0x4cb357[_0x6b15('0x85')]);}}delete this['actions'][_0xda5c40[_0x6b15('0x86')]];}else{_0x4cb357[_0x6b15('0x73')]++;logger[_0x6b15('0x25')](_0x6b15('0x87'),_0x4cb357[_0x6b15('0x73')]);logger[_0x6b15('0x25')]('id',_0x4cb357[_0x6b15('0x88')]);_0x2145f5['incrementPreviewCounters']({'id':_0x4cb357[_0x6b15('0x88')],'field':{'countnosuchnumberretry':_0x4cb357[_0x6b15('0x73')]}})[_0x6b15('0x57')](function(){_0x2145f5[_0x6b15('0x89')](_0x4cb357,_0x4d8443,_0x2be5b0)[_0x6b15('0x57')](function(){});});}});break;case _0x6b15('0x8a'):var _0x121e54=moment()[_0x6b15('0x27')](_0x6b15('0x8b'));_0x4cb357[_0x6b15('0x8c')]=_0x121e54;_0x4cb357[_0x6b15('0x8d')]=_0x121e54;_0x4cb357[_0x6b15('0x45')]=!![];_0x1ab60c[_0x6b15('0x2c')]+=0x1;logger[_0x6b15('0x25')](_0x6b15('0x8e'),_0x4cb357[_0x6b15('0x8f')],_0x6b15('0x90'),_0x1ab60c[_0x6b15('0x28')],'pTalking:\x20',_0x1ab60c[_0x6b15('0x2c')]);ami['emit'](_0x6b15('0x91'),ut[_0x6b15('0x78')](_0x4cb357,_0x6b15('0x92'),this['campaignsPreview'][_0x4cb357[_0x6b15('0x41')]]));if(_0x1ab60c[_0x6b15('0x93')]){ami[_0x6b15('0x2a')](_0x6b15('0x94'),ut['buildAcw'](_0x4cb357));}break;case'16':ami[_0x6b15('0x2a')](_0x6b15('0x95'),ut[_0x6b15('0x78')](_0x4cb357,_0x6b15('0x96'),this['campaignsPreview'][_0x4cb357[_0x6b15('0x41')]]));emitVoiceQueueChannelRemove(ut[_0x6b15('0x78')](_0x4cb357,_0x6b15('0x96')));_0x1ab60c[_0x6b15('0x97')]+=0x1;_0x1ab60c[_0x6b15('0x98')]+=0x1;_0x1ab60c['answered']+=0x1;ut[_0x6b15('0x4f')](_0x1ab60c,_0x6b15('0x99'));_0x4cb357[_0x6b15('0x74')]=ut[_0x6b15('0x75')](_0x4cb357);ut[_0x6b15('0x63')](_0x4cb357,0x4,_0x6b15('0x9a'));rpcDb[_0x6b15('0x67')](_0x4cb357,_0x6b15('0x9b'));rpcDb[_0x6b15('0x82')](_0x4cb357,_0x6b15('0x9c'));rpcDb[_0x6b15('0x9d')](_0x4cb357);_0x1ab60c['sumDuration']+=_0x4cb357[_0x6b15('0x9e')];_0x1ab60c[_0x6b15('0x9f')]+=_0x4cb357[_0x6b15('0x9e')];logger[_0x6b15('0x25')](_0x6b15('0xa0'),_0x4cb357[_0x6b15('0x8f')],'\x20Queue',_0x1ab60c[_0x6b15('0x28')],_0x6b15('0x44'),_0x1ab60c[_0x6b15('0x2c')]);delete this[_0x6b15('0x17')][_0xda5c40[_0x6b15('0x86')]];break;case _0x6b15('0xa1'):_0x1ab60c['outboundBusyCallsDay']+=0x1;_0x4cb357['countbusyretry']+=0x1;_0x4cb357[_0x6b15('0x74')]=ut['totalGlobal'](_0x4cb357);ut[_0x6b15('0x63')](_0x4cb357,0x5,'Busy');_0x4d8443=_0x1ab60c['dialBusyRetryFrequency'];_0x2be5b0=_0x1ab60c[_0x6b15('0x7e')];ami[_0x6b15('0x2a')](_0x6b15('0xa2'),ut[_0x6b15('0x78')](_0x4cb357,_0x6b15('0xa3')));rpcDb[_0x6b15('0x67')](_0x4cb357,_0x6b15('0xa4'));_0x2145f5[_0x6b15('0x7b')](_0x4cb357,'5',_0x1ab60c)[_0x6b15('0x57')](function(_0x5e4296){_0x3fcd47=_0x5e4296['additional']==0x1;if(!_0x3fcd47){if(ut[_0x6b15('0x75')](_0x4cb357)>=_0x1ab60c[_0x6b15('0x7f')]){_0x306de1=ut[_0x6b15('0x80')](_0x4cb357,0xf,_0x6b15('0x81'));rpcDb['createCustomerFinal'](_0x306de1,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x4cb357[_0x6b15('0xa5')]>=_0x1ab60c[_0x6b15('0xa6')]){rpcDb[_0x6b15('0x82')](_0x4cb357,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x6b15('0xa7')](_0x4cb357,_0x6b15('0xa5'),_0x1ab60c['dialBusyRetryFrequency']),_0x4cb357[_0x6b15('0x84')],_0x4cb357['activeContact']);}}}else{_0x4cb357[_0x6b15('0xa5')]++;_0x2145f5['incrementPreviewCounters']({'id':_0x4cb357[_0x6b15('0x88')],'field':{'countbusyretry':_0x4cb357[_0x6b15('0xa5')]}})[_0x6b15('0x57')](function(){_0x2145f5[_0x6b15('0x89')](_0x4cb357,_0x4d8443,_0x2be5b0)[_0x6b15('0x57')](function(){});});}});break;case _0x6b15('0xa8'):_0x1ab60c['outboundNoAnswerCallsDay']+=0x1;_0x4cb357[_0x6b15('0xa9')]+=0x1;_0x4cb357[_0x6b15('0x74')]=ut[_0x6b15('0x75')](_0x4cb357);ut['logCustomer'](_0x4cb357,0x3,_0x6b15('0xaa'));_0x4d8443=_0x1ab60c['dialNoAnswerRetryFrequency'];_0x2be5b0=_0x1ab60c[_0x6b15('0x7e')];var _0x158f61=ut[_0x6b15('0xab')](_0x4cb357,_0x1ab60c);ami[_0x6b15('0x2a')](_0x6b15('0xac'),_0x158f61);rpcDb['createCustomerHistory'](_0x4cb357,_0x6b15('0xad'));_0x2145f5[_0x6b15('0x7b')](_0x4cb357,'3',_0x1ab60c)[_0x6b15('0x57')](function(_0x26247b){_0x3fcd47=_0x26247b[_0x6b15('0x7c')]==0x1;if(!_0x3fcd47){if(ut[_0x6b15('0x75')](_0x4cb357)>=_0x1ab60c['dialGlobalMaxRetry']){_0x306de1=ut[_0x6b15('0x80')](_0x4cb357,0xf,'Global');rpcDb[_0x6b15('0x82')](_0x306de1,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x4cb357['countnoanswerretry']>=_0x1ab60c['dialNoAnswerMaxRetry']){rpcDb[_0x6b15('0x82')](_0x4cb357,_0x6b15('0xad'));}else{rpcDb[_0x6b15('0xae')](ut[_0x6b15('0xa7')](_0x4cb357,_0x6b15('0xa9'),_0x1ab60c[_0x6b15('0xaf')]),_0x4cb357[_0x6b15('0x84')],_0x4cb357[_0x6b15('0x85')]);}}}else{_0x4cb357[_0x6b15('0xa9')]++;_0x2145f5[_0x6b15('0xb0')]({'id':_0x4cb357['idContact'],'field':{'countnoanswerretry':_0x4cb357[_0x6b15('0xa9')]}})[_0x6b15('0x57')](function(){_0x2145f5[_0x6b15('0x89')](_0x4cb357,_0x4d8443,_0x2be5b0)[_0x6b15('0x57')](function(){});});}});break;case'CONGESTION':_0x1ab60c['outboundCongestionCallsDay']+=0x1;_0x4cb357[_0x6b15('0xb1')]+=0x1;_0x4cb357[_0x6b15('0x74')]=ut[_0x6b15('0x75')](_0x4cb357);ut[_0x6b15('0x63')](_0x4cb357,0x8,'Congestion');_0x4d8443=_0x1ab60c[_0x6b15('0xb2')];_0x2be5b0=_0x1ab60c[_0x6b15('0x7e')];ami['emit'](_0x6b15('0xb3'),ut[_0x6b15('0x78')](_0x4cb357,_0x6b15('0xb4')));rpcDb[_0x6b15('0x67')](_0x4cb357,'[callProgressDetectingCustomer][logCongestion]');_0x2145f5[_0x6b15('0x7b')](_0x4cb357,'8',_0x1ab60c)[_0x6b15('0x57')](function(_0x114ed7){_0x3fcd47=_0x114ed7[_0x6b15('0x7c')]==0x1;if(!_0x3fcd47){if(ut[_0x6b15('0x75')](_0x4cb357)>=_0x1ab60c[_0x6b15('0x7f')]){_0x306de1=ut[_0x6b15('0x80')](_0x4cb357,0xf,_0x6b15('0x81'));rpcDb['createCustomerFinal'](_0x306de1,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x4cb357[_0x6b15('0xb1')]>=_0x1ab60c['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x4cb357,_0x6b15('0xb5'));}else{rpcDb[_0x6b15('0xae')](ut[_0x6b15('0xa7')](_0x4cb357,_0x6b15('0xb1'),_0x1ab60c[_0x6b15('0xb6')]),_0x4cb357[_0x6b15('0x84')],_0x4cb357[_0x6b15('0x85')]);}}}else{_0x4cb357[_0x6b15('0xb1')]++;_0x2145f5['incrementPreviewCounters']({'id':_0x4cb357[_0x6b15('0x88')],'field':{'countcongestionretry':_0x4cb357[_0x6b15('0xb1')]}})['then'](function(){_0x2145f5[_0x6b15('0x89')](_0x4cb357,_0x4d8443,_0x2be5b0)['then'](function(){});});}});break;case _0x6b15('0xb7'):_0x1ab60c[_0x6b15('0xb8')]+=0x1;_0x4cb357[_0x6b15('0xb9')]+=0x1;_0x4cb357[_0x6b15('0x74')]=ut['totalGlobal'](_0x4cb357);ut['logCustomer'](_0x4cb357,0x14,_0x6b15('0xba'));_0x4d8443=_0x1ab60c['dialAgentRejectRetryFrequency'];_0x2be5b0=_0x1ab60c['callAdditionalPhoneAfterMin'];ami[_0x6b15('0x2a')](_0x6b15('0xbb'),ut[_0x6b15('0x78')](_0x4cb357,_0x6b15('0xbc')));rpcDb[_0x6b15('0x67')](_0x4cb357,_0x6b15('0xbd'));_0x2145f5[_0x6b15('0x7b')](_0x4cb357,'20',_0x1ab60c)[_0x6b15('0x57')](function(_0x36ae9e){_0x3fcd47=_0x36ae9e[_0x6b15('0x7c')]==0x1;if(!_0x3fcd47){if(ut[_0x6b15('0x75')](_0x4cb357)>=_0x1ab60c[_0x6b15('0x7f')]){_0x306de1=ut[_0x6b15('0x80')](_0x4cb357,0x14,_0x6b15('0xba'));rpcDb[_0x6b15('0x82')](_0x306de1,_0x6b15('0xbe'));}else{if(_0x4cb357['countagentrejectretry']>=_0x1ab60c[_0x6b15('0xbf')]){rpcDb['createCustomerFinal'](_0x4cb357,_0x6b15('0xbe'));}else{rpcDb[_0x6b15('0xae')](ut[_0x6b15('0xa7')](_0x4cb357,_0x6b15('0xb9'),_0x1ab60c[_0x6b15('0xc0')]),_0x4cb357[_0x6b15('0x84')],_0x4cb357[_0x6b15('0x85')]);}}}else{_0x4cb357[_0x6b15('0xa9')]++;_0x2145f5[_0x6b15('0xb0')]({'id':_0x4cb357[_0x6b15('0x88')],'field':{'countnoanswerretry':_0x4cb357['countnoanswerretry']}})[_0x6b15('0x57')](function(){_0x2145f5[_0x6b15('0x89')](_0x4cb357,_0x4d8443,_0x2be5b0)[_0x6b15('0x57')](function(){});});}});break;case'ABANDONED':_0x1ab60c[_0x6b15('0xc1')]+=0x1;_0x4cb357[_0x6b15('0xc2')]+=0x1;_0x4cb357[_0x6b15('0x74')]=ut['totalGlobal'](_0x4cb357);ut['logCustomer'](_0x4cb357,0xb,_0x6b15('0xc3'));rpcDb[_0x6b15('0x67')](_0x4cb357,_0x6b15('0xc4'));_0x2145f5[_0x6b15('0x7b')](_0x4cb357,'11',_0x1ab60c)[_0x6b15('0x57')](function(_0x2a9d06){_0x3fcd47=_0x2a9d06[_0x6b15('0x7c')]==0x1;if(!_0x3fcd47){if(ut['totalGlobal'](_0x4cb357)>=_0x1ab60c[_0x6b15('0x7f')]){_0x306de1=ut['cloneAction'](_0x4cb357,0xf,_0x6b15('0x81'));rpcDb['createCustomerFinal'](_0x306de1,_0x6b15('0xc4'));}else{if(_0x4cb357['countabandonedetry']>=_0x1ab60c[_0x6b15('0xc5')]){rpcDb[_0x6b15('0x82')](_0x4cb357,_0x6b15('0xc4'));}else{rpcDb[_0x6b15('0xae')](ut[_0x6b15('0xa7')](_0x4cb357,_0x6b15('0xc2'),_0x1ab60c[_0x6b15('0xc6')]),_0x4cb357[_0x6b15('0x84')],_0x4cb357[_0x6b15('0x85')]);}}}else{_0x4cb357[_0x6b15('0xa9')]++;_0x2145f5[_0x6b15('0xb0')]({'id':_0x4cb357[_0x6b15('0x88')],'field':{'countnoanswerretry':_0x4cb357[_0x6b15('0xa9')]}})[_0x6b15('0x57')](function(){_0x2145f5[_0x6b15('0x89')](_0x4cb357,_0x4d8443,_0x2be5b0)[_0x6b15('0x57')](function(){});});}});break;case'18':_0x1ab60c[_0x6b15('0xc7')]+=0x1;_0x4cb357[_0x6b15('0xc8')]+=0x1;_0x4cb357['countglobal']=ut['totalGlobal'](_0x4cb357);ut[_0x6b15('0x63')](_0x4cb357,0x12,_0xda5c40[_0x6b15('0xc9')]||_0xda5c40[_0x6b15('0xca')]);ami[_0x6b15('0x2a')](_0x6b15('0xcb'),ut[_0x6b15('0x78')](_0x4cb357,'amd'));rpcDb[_0x6b15('0x67')](_0x4cb357,'[callProgressDetectingCustomer][hangupInAMD]');_0x2145f5[_0x6b15('0x7b')](_0x4cb357,'18',_0x1ab60c)[_0x6b15('0x57')](function(_0x5c94cc){_0x3fcd47=_0x5c94cc['additional']==0x1;if(!_0x3fcd47){if(ut[_0x6b15('0x75')](_0x4cb357)>=_0x1ab60c[_0x6b15('0x7f')]){_0x306de1=ut[_0x6b15('0x80')](_0x4cb357,0x12,'Global');rpcDb[_0x6b15('0x82')](_0x306de1,_0x6b15('0xcc'));}else{rpcDb[_0x6b15('0x82')](_0x4cb357,_0x6b15('0xcc'));}}else{_0x4cb357[_0x6b15('0xa9')]++;_0x2145f5[_0x6b15('0xb0')]({'id':_0x4cb357[_0x6b15('0x88')],'field':{'countnoanswerretry':_0x4cb357[_0x6b15('0xa9')]}})[_0x6b15('0x57')](function(){_0x2145f5[_0x6b15('0x89')](_0x4cb357,_0x4d8443,_0x2be5b0)[_0x6b15('0x57')](function(){});});}});delete this[_0x6b15('0x17')][_0xda5c40[_0x6b15('0x86')]];break;case'19':_0x1ab60c[_0x6b15('0xc7')]+=0x1;_0x4cb357[_0x6b15('0x74')]=ut[_0x6b15('0x75')](_0x4cb357);ut[_0x6b15('0x63')](_0x4cb357,0x13,_0xda5c40[_0x6b15('0xc9')]||_0xda5c40[_0x6b15('0xca')]);ami[_0x6b15('0x2a')](_0x6b15('0xcb'),ut[_0x6b15('0x78')](_0x4cb357,'amd'));rpcDb['createCustomerHistory'](_0x4cb357,'[callProgressDetectingCustomer][machine]');_0x2145f5['verifyAdditionalPhones'](_0x4cb357,'18',_0x1ab60c)['then'](function(_0xd228e8){_0x3fcd47=_0xd228e8['additional']==0x1;if(!_0x3fcd47){if(ut[_0x6b15('0x75')](_0x4cb357)>=_0x1ab60c[_0x6b15('0x7f')]){_0x306de1=ut[_0x6b15('0x80')](_0x4cb357,0xf,'Global');rpcDb[_0x6b15('0x82')](_0x306de1,_0x6b15('0xcd'));}else{rpcDb['createCustomerFinal'](_0x4cb357,_0x6b15('0xcd'));}}else{_0x4cb357[_0x6b15('0xa9')]++;_0x2145f5[_0x6b15('0xb0')]({'id':_0x4cb357[_0x6b15('0x88')],'field':{'countnoanswerretry':_0x4cb357[_0x6b15('0xa9')]}})[_0x6b15('0x57')](function(){_0x2145f5[_0x6b15('0x89')](_0x4cb357,_0x4d8443,_0x2be5b0)['then'](function(){});});}});delete this[_0x6b15('0x17')][_0xda5c40['linkedid']];break;default:if(_0x4cb357[_0x6b15('0x45')]){ut[_0x6b15('0x4f')](_0x1ab60c,_0x6b15('0xce'));ut[_0x6b15('0x50')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x1ab60c['name'],_0xda5c40);}_0x1ab60c[_0x6b15('0xc7')]+=0x1;_0x4cb357[_0x6b15('0x74')]=ut[_0x6b15('0x75')](_0x4cb357);ut['logCustomer'](_0x4cb357,0xc,_0xda5c40['cause-txt']||_0xda5c40[_0x6b15('0xca')]);_0x4d8443=_0x1ab60c[_0x6b15('0xc0')];_0x2be5b0=_0x1ab60c[_0x6b15('0x7e')];rpcDb[_0x6b15('0x67')](_0x4cb357,_0x6b15('0xcf'));_0x2145f5[_0x6b15('0x7b')](_0x4cb357,'20',_0x1ab60c)['then'](function(_0x1581d5){_0x3fcd47=_0x1581d5[_0x6b15('0x7c')]==0x1;if(!_0x3fcd47){if(ut[_0x6b15('0x75')](_0x4cb357)>=_0x1ab60c[_0x6b15('0x7f')]){_0x306de1=ut['cloneAction'](_0x4cb357,0xf,_0x6b15('0x81'));rpcDb['createCustomerFinal'](_0x306de1,_0x6b15('0xd0'));}else{rpcDb[_0x6b15('0x82')](_0x4cb357,_0x6b15('0xd0'));}delete this[_0x6b15('0x17')][_0xda5c40[_0x6b15('0x86')]];}else{_0x2145f5['swapAdditionalPhones'](_0x4cb357,_0x4d8443,_0x2be5b0)['then'](function(){});}});}if(!(_0x4cb357[_0x6b15('0x45')]&&_0x1381dc==='16')){ut[_0x6b15('0x4d')](_0x1ab60c,_0x6b15('0xd1'));logger['info'](_0x6b15('0xd2'),_0x4cb357[_0x6b15('0x8f')],_0x6b15('0x90'),_0x1ab60c[_0x6b15('0x28')],'originated:\x20',_0x1ab60c['originated']);}if(_0x1381dc!=='ANSWER'){delete this['actions'][_0xda5c40[_0x6b15('0x86')]];delete this[_0x6b15('0x17')][_0xda5c40[_0x6b15('0xd3')]];}_0x1ab60c['queueSummaryCountersUpdated']=!![];}};Preview['prototype'][_0x6b15('0xd4')]=function(_0x59c531,_0x543b6f,_0x508bfe){if(_[_0x6b15('0xd5')](_0x543b6f)&&_0x6b15('0xd6')!==typeof _0x543b6f){return;}if(_[_0x6b15('0xd5')](_0x508bfe)&&_0x6b15('0xd6')!==typeof _0x508bfe){return;}switch(_0x508bfe['reason']){case'0':ut[_0x6b15('0xd7')](_0x59c531,0x0,'NoSuchNumber');rpcDb[_0x6b15('0xd8')](_0x59c531,_0x6b15('0xd9'));break;case'3':ut[_0x6b15('0xd7')](_0x59c531,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x59c531,_0x6b15('0xda'));break;case'5':ut[_0x6b15('0xd7')](_0x59c531,0x5,_0x6b15('0xdb'));rpcDb[_0x6b15('0xd8')](_0x59c531,_0x6b15('0xdc'));break;case'8':ut[_0x6b15('0xd7')](_0x59c531,0x8,_0x6b15('0xdd'));rpcDb[_0x6b15('0xd8')](_0x59c531,_0x6b15('0xde'));break;case'22':ut[_0x6b15('0xd7')](_0x59c531,0x16,_0x6b15('0xdf'));rpcDb[_0x6b15('0xd8')](_0x59c531,_0x6b15('0xe0'));break;default:ut[_0x6b15('0xd7')](_0x59c531,0xc,_0x508bfe[_0x6b15('0xe1')]);rpcDb[_0x6b15('0xd8')](_0x59c531,_0x6b15('0xde'));}ut[_0x6b15('0x4d')](_0x543b6f,'[callProgressDetectingAgent]');logger[_0x6b15('0x25')](_0x6b15('0xe2'),_0x59c531[_0x6b15('0x8f')],_0x6b15('0x90'),_0x543b6f[_0x6b15('0x28')],_0x6b15('0x42'),_0x543b6f[_0x6b15('0x2b')]);delete this[_0x6b15('0x17')][_0x59c531['uniqueid']];};Preview[_0x6b15('0x10')][_0x6b15('0x7b')]=function(_0x5ac7fc,_0x467a91,_0x3a120c){return cmHopperAdditionalPhone[_0x6b15('0x7b')](_0x5ac7fc,_0x467a91,_0x3a120c)[_0x6b15('0x5f')](logger[_0x6b15('0x25')]('[verifyAdditionalPhone]\x20'));};Preview['prototype']['swapAdditionalPhones']=function(_0x5a821b,_0x28a6a4,_0x10438c){return cmHopperAdditionalPhone[_0x6b15('0x89')](_0x5a821b,_0x28a6a4,_0x10438c)[_0x6b15('0x5f')](logger[_0x6b15('0x25')](_0x6b15('0xe3')));};Preview[_0x6b15('0x10')]['incrementPreviewCounters']=function(_0xefa3e1){return Promise[_0x6b15('0xe4')]()[_0x6b15('0x57')](cmHopperAdditionalPhone[_0x6b15('0xb0')](_0xefa3e1))[_0x6b15('0x5f')](logger[_0x6b15('0x25')]('[incrementPreviewCounters]\x20'));};Preview['prototype']['checkInBlack']=function(_0xf3acae,_0x549113,_0x205faa,_0x3703c3,_0x1899cf){var _0x39cbbe=this;return new Promise(function(_0x4339f1,_0x202959){if(_['isNil'](_0x549113)||_['isNil'](_0x549113['Contact'])||_[_0x6b15('0x3f')](_0x549113[_0x6b15('0xe5')])||_[_0x6b15('0x3f')](_0x549113[_0x6b15('0x49')])){_0x202959(ut[_0x6b15('0x2f')](_0x6b15('0xe6'),_0x3703c3,_0x1899cf));return;}var _0xbacf11=uuid['v4']();var _0x3d7845=_0x39cbbe[_0x6b15('0x14')][_0x549113[_0x6b15('0x40')][_0x6b15('0x28')]];var _0x21e468=_0x205faa?_0x39cbbe[_0x6b15('0x18')][_0x205faa]['id']:undefined;_0x39cbbe[_0x6b15('0x17')][_0xbacf11]=new Action(_0x549113,_0x3d7845,_0xbacf11,_0x205faa,_0x21e468);var _0x9fdbef=_0x39cbbe[_0x6b15('0x17')][_0xbacf11];_0x9fdbef[_0x6b15('0x84')]=_0x3703c3;_0x9fdbef['activeContact']=_0x1899cf;_0x9fdbef[_0x6b15('0xe7')]=_0x205faa;if(_[_0x6b15('0xe8')](_0xf3acae)){_0x39cbbe[_0x6b15('0xe9')](_0x9fdbef,_0x3d7845,_0x549113,_0x205faa)[_0x6b15('0x57')](function(_0x5baf99){logger[_0x6b15('0x25')](_0x6b15('0xea'),_0x6b15('0xeb')+_0x9fdbef[_0x6b15('0x41')]+'\x20IdHopper:\x20'+_0x9fdbef[_0x6b15('0x88')],JSON['stringify'](_0x5baf99));ami['emit']('custom:agentcalled',ut[_0x6b15('0x78')](_0x9fdbef,_0x6b15('0xec'),_0x39cbbe['campaignsPreview'][_0x9fdbef[_0x6b15('0x41')]]));_0x4339f1(ut[_0x6b15('0x2f')](_0x6b15('0xed')));})[_0x6b15('0x5f')](function(_0x48e468){ut[_0x6b15('0x34')](_0x6b15('0xee'),_0x48e468);_0x202959(ut[_0x6b15('0x2f')](_0x6b15('0xef'),_0x3703c3,_0x1899cf));});}else{_0x3d7845[_0x6b15('0xf0')]+=0x1;ut['logBlacklist'](_0x9fdbef);rpcDb[_0x6b15('0xf1')](_0x9fdbef,_0x6b15('0xf2'));delete _0x39cbbe[_0x6b15('0x17')][_0xbacf11];_0x202959(ut['message'](_0x6b15('0xf3'),_0x3703c3,_0x1899cf));}});};Preview[_0x6b15('0x10')][_0x6b15('0x6f')]=function(_0x59ce82){return!_[_0x6b15('0x3f')](_0x59ce82)&&!_['isNil'](_0x59ce82['name'])&&!_[_0x6b15('0x3f')](_0x59ce82[_0x6b15('0xf4')])&&_0x59ce82[_0x6b15('0xf4')]&&!_['isNil'](this['trunks'][util[_0x6b15('0x27')](_0x6b15('0xf5'),_0x59ce82[_0x6b15('0x28')])])&&!_[_0x6b15('0x3f')](this[_0x6b15('0x16')][util[_0x6b15('0x27')]('SIP/%s',_0x59ce82[_0x6b15('0x28')])][_0x6b15('0x4a')])&&(this[_0x6b15('0x16')][util[_0x6b15('0x27')](_0x6b15('0xf5'),_0x59ce82[_0x6b15('0x28')])][_0x6b15('0x4a')]==='reachable'||this[_0x6b15('0x16')][util['format'](_0x6b15('0xf5'),_0x59ce82[_0x6b15('0x28')])]['status']===_0x6b15('0xf6'));};Preview[_0x6b15('0x10')][_0x6b15('0x5c')]=function(_0x3ab49e,_0x4c74ba){return this[_0x6b15('0xf7')](_0x3ab49e,_0x4c74ba)[_0x6b15('0x57')](function(_0x47663a){return _[_0x6b15('0x46')](_0x47663a,[_0x6b15('0x2f')]);})[_0x6b15('0x5f')](function(_0x2fad2c){if(_0x2fad2c[_0x6b15('0xf8')]){rpcDb[_0x6b15('0xf9')](_0x3ab49e);}if(_0x2fad2c[_0x6b15('0xf4')]){rpcDb[_0x6b15('0x60')](_0x3ab49e);}throw _[_0x6b15('0x46')](_0x2fad2c,['message']);});};Preview[_0x6b15('0x10')][_0x6b15('0xf7')]=function(_0x22b8f5,_0x432df8){var _0x3390e3=this;var _0x27c536,_0x9c8405;return rpcDb['getContactPreview'](_0x22b8f5)[_0x6b15('0x57')](function(_0x3a2496){if(!_[_0x6b15('0x3f')](_0x3a2496[0x0])){_0x9c8405=_0x3a2496[0x0][_0x6b15('0xfa')]?![]:!![];_0x27c536=_0x3a2496[0x0][_0x6b15('0xfa')]?!![]:![];_0x27c536=_0x432df8?!![]:_0x27c536;}var _0x4abade=_0x3390e3['validateContact'](_0x3a2496);if(_0x4abade[_0x6b15('0xfb')]){rpcDb[_0x6b15('0xfc')](_['pick'](_0x3a2496[0x0],[_0x6b15('0x49'),_0x6b15('0xe5')]))[_0x6b15('0x57')](function(_0x2f04f3){_0x3390e3['checkInBlack'](_0x2f04f3,_0x3a2496[0x0],_0x432df8,_0x9c8405,_0x27c536)['then'](function(_0x5f1107){return _0x5f1107;})['catch'](function(_0x45b55b){throw _0x45b55b;});})[_0x6b15('0x5f')](function(_0x13d8ec){ut['logger'](_0x6b15('0xfd'),_0x13d8ec);throw ut[_0x6b15('0x2f')]('Call\x20unsuccessful',_0x9c8405,_0x27c536);});}else{throw ut[_0x6b15('0x2f')](_0x4abade['message'],_0x9c8405,_0x27c536);}})[_0x6b15('0x5f')](function(_0xa88c00){ut['logger']('[Preview][getContactPreview]',_0xa88c00);throw ut[_0x6b15('0x2f')](_0x6b15('0xfe'),![],!![]);});};Preview[_0x6b15('0x10')]['validateContact']=function(_0x55791c){if(_[_0x6b15('0x3f')](_0x55791c)||_[_0x6b15('0xe8')](_0x55791c)||!_['isNil'](_0x55791c[0x0][_0x6b15('0x5b')])&&_['isNil'](_0x55791c[0x0][_0x6b15('0x5b')][_0x6b15('0x28')])){ut['logger'](_0x6b15('0xff'),_0x55791c);return{'isValid':![],'message':_0x6b15('0x100')};}var _0x2b7aa0=this[_0x6b15('0x14')][_0x55791c[0x0][_0x6b15('0x40')][_0x6b15('0x28')]];_0x2b7aa0['message']=utils['CAMPAIGN_STATUS'][_0x6b15('0x71')];if(_[_0x6b15('0x3f')](_0x2b7aa0)){ut[_0x6b15('0x34')](_0x6b15('0x101'),_0x2b7aa0);return{'isValid':![],'message':_0x6b15('0x102')};}if(!this['isTrunkReachable'](_0x2b7aa0[_0x6b15('0x6e')])){ut[_0x6b15('0x34')](_0x6b15('0x103'),_0x6b15('0x104')+_0x2b7aa0['name']+_0x6b15('0x105'));if(!this[_0x6b15('0x6f')](_0x2b7aa0[_0x6b15('0x70')])){ut[_0x6b15('0x34')](_0x6b15('0x103'),_0x2b7aa0[_0x6b15('0x28')]+_0x6b15('0x106'));return{'isValid':![],'message':_0x6b15('0x107')};}}if(!ut[_0x6b15('0x6d')](_0x2b7aa0[_0x6b15('0x3a')])){ut[_0x6b15('0x34')](_0x6b15('0x108'),_0x2b7aa0[_0x6b15('0x28')]+_0x6b15('0x109'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x2b7aa0[_0x6b15('0x28')]+_0x6b15('0x109')};}return{'isValid':!![],'message':_0x6b15('0x10a')};};Preview[_0x6b15('0x10')][_0x6b15('0xe9')]=function(_0x577669,_0x1a35fc,_0x2a8947,_0x5b5a76){var _0x1b7e14=this;return new Promise(function(_0x3298f0,_0x3d0e34){var _0x300058=_0x577669['uniqueid'];var _0x797ad=_0x1b7e14[_0x6b15('0x6f')](_0x1a35fc[_0x6b15('0x6e')])?util[_0x6b15('0x27')](_0x6b15('0x10b'),_0x1a35fc[_0x6b15('0x6e')][_0x6b15('0x28')],_['isNil'](_0x1a35fc[_0x6b15('0x10c')])?'':_0x1a35fc[_0x6b15('0x10c')]['trim']()||'',_0x1a35fc['dialCutDigit']>0x0?_0x2a8947[_0x6b15('0xe5')]['substring'](_0x1a35fc[_0x6b15('0x10d')]):_0x2a8947[_0x6b15('0xe5')]):util[_0x6b15('0x27')]('SIP/%s/%s%s',_['isNil'](_0x1a35fc[_0x6b15('0x70')])?_0x1a35fc['Trunk'][_0x6b15('0x28')]:_0x1a35fc[_0x6b15('0x70')][_0x6b15('0x28')],_['isNil'](_0x1a35fc[_0x6b15('0x10c')])?'':_0x1a35fc[_0x6b15('0x10c')][_0x6b15('0x10e')]()||'',_0x1a35fc[_0x6b15('0x10d')]>0x0?_0x2a8947['phone']['substring'](_0x1a35fc[_0x6b15('0x10d')]):_0x2a8947[_0x6b15('0xe5')]);var _0x16d332=_0x1b7e14[_0x6b15('0x6f')](_0x1a35fc[_0x6b15('0x6e')])?ut[_0x6b15('0x10f')](_0x1a35fc[_0x6b15('0x6e')][_0x6b15('0x110')],_0x1a35fc[_0x6b15('0x111')],_0x1a35fc[_0x6b15('0x112')]>0x0?ut[_0x6b15('0x113')](_0x1a35fc[_0x6b15('0x114')],_0x1a35fc[_0x6b15('0x112')]):_0x1a35fc[_0x6b15('0x114')]):ut['getCallerId'](_[_0x6b15('0x3f')](_0x1a35fc[_0x6b15('0x70')])?_0x1a35fc[_0x6b15('0x6e')]['callerid']:_0x1a35fc[_0x6b15('0x70')][_0x6b15('0x110')],_0x1a35fc[_0x6b15('0x111')],_0x1a35fc['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x1a35fc[_0x6b15('0x114')],_0x1a35fc[_0x6b15('0x112')]):_0x1a35fc[_0x6b15('0x114')]);if(_0x16d332){_0x577669['originatecalleridname']=ut[_0x6b15('0x115')](_0x16d332);_0x577669[_0x6b15('0x116')]=ut['extractCalleridNumber'](_0x16d332);}var _0x3b2a49=ut[_0x6b15('0x117')](_0x1a35fc,_0x2a8947,_0x797ad,_0x16d332,_0x300058,_0x577669);var _0xec87fa=utils[_0x6b15('0x118')](_0x2a8947[_0x6b15('0x119')]);Object['assign'](_0x3b2a49,_0xec87fa);_[_0x6b15('0x11a')](_0x577669,ut[_0x6b15('0x11b')](_0x3b2a49));_0x577669['starttime']=moment()[_0x6b15('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a35fc[_0x6b15('0x11c')]=_0x3b2a49;var _0x330034=ut[_0x6b15('0x11d')](_0x577669,_0x1a35fc,_0x3b2a49,_0x577669['activeContact'],_0x5b5a76);return ami[_0x6b15('0x11e')](_0x330034)['then'](function(_0xdf29a){_0x1a35fc['originated']+=0x1;logger[_0x6b15('0x25')](_0x6b15('0x11f'),_0x300058,_0x6b15('0x90'),_0x1a35fc[_0x6b15('0x28')],'originated:\x20',_0x1a35fc[_0x6b15('0x2b')]);_0x3298f0(_0xdf29a);})[_0x6b15('0x5f')](function(_0x1c5111){ut['logAgent'](_0x577669,0xe,_0x6b15('0x120'));rpcDb[_0x6b15('0xd8')](_0x577669,_0x6b15('0x121'));_0x3d0e34(_0x1c5111);});});};Preview[_0x6b15('0x10')][_0x6b15('0x1f')]=function(_0x4f79a9){if(this['actions'][_0x4f79a9['linkedid']]){this[_0x6b15('0x17')][_0x4f79a9[_0x6b15('0x86')]][_0x6b15('0x4b')]=_0x4f79a9[_0x6b15('0x4b')];}};Preview['prototype'][_0x6b15('0x122')]=function(_0x50a806){var _0x4f8e12=this;var _0x1affd4=this['actions'][_0x50a806['actionid']];if(_0x1affd4){if(_0x1affd4[_0x6b15('0xe7')]&&this[_0x6b15('0x18')][_0x1affd4[_0x6b15('0xe7')]]){ut[_0x6b15('0x123')](_0x1affd4,this[_0x6b15('0x18')][_0x1affd4[_0x6b15('0xe7')]][_0x6b15('0x28')],this[_0x6b15('0x18')][_0x1affd4[_0x6b15('0xe7')]]['id']);}var _0x21a021=_['clone'](_0x1affd4);_0x21a021['responsetime']=moment()[_0x6b15('0x27')](_0x6b15('0x8b'));var _0x3681ff=_0x4f8e12[_0x6b15('0x14')][_0x1affd4['queue']];if(ut[_0x6b15('0x124')](_0x50a806[_0x6b15('0x125')])){if(_0x1affd4['unlockAgent']){rpcDb['unlockContact'](_0x1affd4[_0x6b15('0x88')]);}if(_0x1affd4[_0x6b15('0x85')]){rpcDb[_0x6b15('0x60')](_0x1affd4['idContact']);}ami[_0x6b15('0x2a')](_0x6b15('0x126'),ut[_0x6b15('0x78')](_0x1affd4,_0x6b15('0x127'),this[_0x6b15('0x14')][_0x1affd4['queue']]));this[_0x6b15('0xd4')](_0x21a021,_0x3681ff,_0x50a806);}else{_0x1affd4[_0x6b15('0x61')]=moment()['format'](_0x6b15('0x8b'));ut[_0x6b15('0xd7')](_0x21a021,0x4,_0x6b15('0x9a'));rpcDb[_0x6b15('0xd8')](_0x21a021,_0x6b15('0x128'));}}};Preview['prototype'][_0x6b15('0x1b')]=function(_0x70de9){var _0x472ace=this[_0x6b15('0x17')][_0x70de9['linkedid']];var _0x1c23bd;if(_0x472ace){_0x1c23bd=this[_0x6b15('0x14')][_0x472ace[_0x6b15('0x41')]];logger[_0x6b15('0x25')](_0x6b15('0x129'),_0x70de9[_0x6b15('0x86')],_0x6b15('0x90'),_0x1c23bd[_0x6b15('0x28')],_0x6b15('0x44'),_0x1c23bd[_0x6b15('0x2c')]);}if(this['actions'][_0x70de9[_0x6b15('0x86')]]&&_0x70de9[_0x6b15('0x86')]!==_0x70de9['uniqueid']){if(_0x70de9[_0x6b15('0x12a')]==='16'&&this[_0x6b15('0x17')][_0x70de9[_0x6b15('0x86')]][_0x6b15('0x45')]){this[_0x6b15('0x12b')](_0x70de9,_0x70de9[_0x6b15('0x86')],_0x70de9[_0x6b15('0x12a')]);}else if(this[_0x6b15('0x17')][_0x70de9[_0x6b15('0x86')]][_0x6b15('0x45')]){logger[_0x6b15('0x25')](_0x6b15('0x12c'),_0x70de9['linkedid'],_0x70de9[_0x6b15('0x12a')],'\x20Queue',_0x1c23bd[_0x6b15('0x28')],_0x6b15('0x44'),_0x1c23bd[_0x6b15('0x2c')]);this[_0x6b15('0x12b')](_0x70de9,_0x70de9[_0x6b15('0x86')],_0x70de9[_0x6b15('0x12a')]);}}else if(_0x472ace&&_['isNil'](_0x472ace[_0x6b15('0x12d')])&&_0x1c23bd[_0x6b15('0x12e')]&&_0x70de9[_0x6b15('0x86')]===_0x70de9[_0x6b15('0x8f')]&&_[_0x6b15('0x3f')](_0x70de9[_0x6b15('0xe1')])&&_0x70de9[_0x6b15('0x12a')]==='16'&&_0x70de9[_0x6b15('0x12f')]==='6'&&_[_0x6b15('0xd5')](_0x472ace[_0x6b15('0x130')])){if(_0x472ace['unlockAgent']){rpcDb[_0x6b15('0xf9')](_0x472ace[_0x6b15('0x88')]);}if(_0x472ace[_0x6b15('0x85')]){rpcDb[_0x6b15('0x60')](_0x472ace['idContact']);}_0x70de9[_0x6b15('0xe1')]='22';this['callProgressDetectingAgent'](_0x472ace,_0x1c23bd,_0x70de9);}else if(_0x472ace&&_0x472ace['transfer']){if(_0x70de9[_0x6b15('0x12a')]==='16'&&this[_0x6b15('0x17')][_0x70de9[_0x6b15('0x86')]][_0x6b15('0x45')]){logger[_0x6b15('0x25')]('[syncHangup][talking][transfer]',_0x70de9[_0x6b15('0x86')],_0x70de9[_0x6b15('0x12a')],'\x20Queue',_0x1c23bd[_0x6b15('0x28')],_0x6b15('0x44'),_0x1c23bd[_0x6b15('0x2c')]);this[_0x6b15('0x12b')](_0x70de9,_0x70de9[_0x6b15('0x86')],_0x70de9[_0x6b15('0x12a')]);}else if(this[_0x6b15('0x17')][_0x70de9[_0x6b15('0x86')]][_0x6b15('0x45')]){logger['info']('[syncHangup][talking][cause]',_0x70de9[_0x6b15('0x86')],_0x70de9[_0x6b15('0x12a')],_0x6b15('0x90'),_0x1c23bd[_0x6b15('0x28')],'pTalking:\x20',_0x1c23bd['pTalking']);this[_0x6b15('0x12b')](_0x70de9,_0x70de9['linkedid'],_0x70de9[_0x6b15('0x12a')]);}}};Preview[_0x6b15('0x10')]['syncDialEnd']=function(_0x14f17c){if(this['actions'][_0x14f17c[_0x6b15('0xd3')]]&&_0x14f17c[_0x6b15('0xd3')]!==_0x14f17c[_0x6b15('0x131')]){this[_0x6b15('0x12b')](_0x14f17c,_0x14f17c['destlinkedid'],_0x14f17c[_0x6b15('0xca')]);}};Preview['prototype'][_0x6b15('0x1d')]=function(_0x329899){if(this[_0x6b15('0x17')][_0x329899[_0x6b15('0x86')]]&&_0x329899[_0x6b15('0x86')]!==_0x329899['uniqueid']&&!this[_0x6b15('0x17')][_0x329899[_0x6b15('0x86')]][_0x6b15('0x45')]){if(_0x329899[_0x6b15('0x12a')]==='1'){this[_0x6b15('0x12b')](_0x329899,_0x329899['linkedid'],_0x329899[_0x6b15('0x12a')]);}}};Preview[_0x6b15('0x10')][_0x6b15('0x132')]=function(_0x2a8991,_0x3af79c,_0x355181){if(this[_0x6b15('0x17')][_0x2a8991]){if(_[_0x6b15('0x3f')](this[_0x6b15('0x17')][_0x2a8991][_0x6b15('0x11c')])){this[_0x6b15('0x17')][_0x2a8991]['variables']={};}this['actions'][_0x2a8991][_0x6b15('0x11c')][_0x3af79c]=_0x355181;}};Preview[_0x6b15('0x10')][_0x6b15('0x133')]=function(_0x2229da){try{if(!_[_0x6b15('0x3f')](_0x2229da)){if(ut[_0x6b15('0x134')](_['keys'](_0x2229da[_0x6b15('0x135')])[0x0])){this[_0x6b15('0x132')](_0x2229da[_0x6b15('0x8f')],_[_0x6b15('0x136')](_0x2229da[_0x6b15('0x135')])[0x0],_0x2229da[_0x6b15('0x137')]);}}}catch(_0x5a3b23){logger[_0x6b15('0x138')](_0x6b15('0x139'),util[_0x6b15('0x13a')](_0x5a3b23,{'showHidden':![],'depth':null}));}};Preview[_0x6b15('0x10')][_0x6b15('0x22')]=function(_0x2ee3e5){if(_0x2ee3e5){if(this[_0x6b15('0x17')][_0x2ee3e5[_0x6b15('0x13b')]]){this[_0x6b15('0x17')][_0x2ee3e5[_0x6b15('0x13b')]][_0x6b15('0x130')]=!![];}}};Preview[_0x6b15('0x10')][_0x6b15('0x13c')]=function(_0xed13a9){if(_0xed13a9){if(this[_0x6b15('0x17')][_0xed13a9[_0x6b15('0x13d')]]){this['actions'][_0xed13a9[_0x6b15('0x13d')]][_0x6b15('0x130')]=!![];}}};module[_0x6b15('0x13e')]=Preview; \ No newline at end of file +var _0x1e10=['complete','outboundAnswerCallsDay','total','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','dialGlobalMaxRetry','cloneAction','rescheduleContact','unlockAgent','idContact','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','queueSummaryCountersUpdated','isUndefined','object','logAgent','NoSuchNumber','createAgentHistory','NoAnswer','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','checkInBlack','Contact','phone','VoiceQueueId','Queue','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','called','Calling','logger','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','disableContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','callProgressDetectingAgent','Answer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','syncHangupRequest','addVariable','filterKey','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','../dialer/utils','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncHangup','bind','hanguprequest','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','campaignsPreview','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','message','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','originated:\x20','stringify','queue','pTalking','dialAnswer','pick','contactId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','agentReadyId','then','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','additional','callAdditionalPhoneAfterMin','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','actioncountonusuch','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','uniqueid','\x20Queue','pTalking:\x20','connect','acw','buildAcw','custom:agentcomplete'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1e10,0xb5));var _0x01e1=function(_0x596293,_0xc5bde3){_0x596293=_0x596293-0x0;var _0x3a8529=_0x1e10[_0x596293];return _0x3a8529;};'use strict';var util=require(_0x01e1('0x0'));var _=require(_0x01e1('0x1'));var uuid=require('uuid');var moment=require(_0x01e1('0x2'));var Redis=require(_0x01e1('0x3'));var config=require('../../../config/environment');var logger=require(_0x01e1('0x4'))(_0x01e1('0x5'));var loggerAction=require(_0x01e1('0x4'))(_0x01e1('0x6'));var ami=require('../ami');var rpcDb=require(_0x01e1('0x7'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x01e1('0x8'));var ut=require(_0x01e1('0x9'));var utils=require(_0x01e1('0xa'));config[_0x01e1('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x01e1('0xc'))(new Redis(config[_0x01e1('0xb')]));var Sequence=function(){};Sequence[_0x01e1('0xd')][_0x01e1('0xe')]=function(_0x2da147){this['tail']=this[_0x01e1('0xf')]?this[_0x01e1('0xf')][_0x01e1('0x10')](_0x2da147):_0x2da147();};function Preview(_0x3ee4ad){this[_0x01e1('0x11')]=new Sequence();this['campaignsPreview']=_0x3ee4ad['voiceQueues'];this[_0x01e1('0x12')]=_0x3ee4ad['trunks'];this[_0x01e1('0x13')]={};this[_0x01e1('0x14')]=_0x3ee4ad[_0x01e1('0x14')];this[_0x01e1('0x15')]=0x0;ami['on'](_0x01e1('0x16'),this['syncOriginateResponse']['bind'](this));ami['on']('hangup',this[_0x01e1('0x17')][_0x01e1('0x18')](this));ami['on'](_0x01e1('0x19'),this['syncHangupRequest'][_0x01e1('0x18')](this));ami['on']('dialend',this[_0x01e1('0x1a')][_0x01e1('0x18')](this));ami['on']('newexten',this[_0x01e1('0x1b')][_0x01e1('0x18')](this));ami['on'](_0x01e1('0x1c'),this[_0x01e1('0x1d')][_0x01e1('0x18')](this));ami['on'](_0x01e1('0x1e'),this[_0x01e1('0x1f')]['bind'](this));ami['on'](_0x01e1('0x20'),this['syncBlindTransfer'][_0x01e1('0x18')](this));this[_0x01e1('0x21')](this[_0x01e1('0x22')]);}function emit(_0x570519,_0xfaf1ae,_0x2aee37){io['to'](_0x570519)['emit'](_0xfaf1ae,_0x2aee37);}function emitVoiceQueueChannelRemove(_0x1b8671){logger['info'](_0x01e1('0x23'),JSON['stringify'](_0x1b8671));emit(util[_0x01e1('0x24')](_0x01e1('0x25'),_0x1b8671[_0x01e1('0x26')]),_0x01e1('0x27'),_0x1b8671);io[_0x01e1('0x28')](_0x01e1('0x29'),_0x1b8671);}function notSendMessagesQueue(_0x3ae7ce){if(_0x3ae7ce[_0x01e1('0x2a')]){if(_0x3ae7ce[_0x01e1('0x2b')]===0x0&&_0x3ae7ce['pTalking']===0x0){_0x3ae7ce[_0x01e1('0x2a')]=![];_0x3ae7ce['available']=0x0;_0x3ae7ce[_0x01e1('0x2c')]=0x0;_0x3ae7ce[_0x01e1('0x2d')]=utils[_0x01e1('0x2e')][_0x01e1('0x2f')];ut['logger'](_0x01e1('0x30'),_0x3ae7ce['name']+_0x01e1('0x31'));}else{_0x3ae7ce[_0x01e1('0x2d')]=utils['CAMPAIGN_STATUS'][_0x01e1('0x32')];ut['logger'](_0x01e1('0x30'),_0x3ae7ce[_0x01e1('0x26')]+_0x01e1('0x33'));}}}Preview[_0x01e1('0xd')][_0x01e1('0x21')]=function(){var _0x537343=this;setInterval(function(){_0x537343[_0x01e1('0x34')]();},0x7cf);};Preview[_0x01e1('0xd')][_0x01e1('0x34')]=function(){var _0x14d540=this[_0x01e1('0x22')];this[_0x01e1('0x15')]+=0x1;for(var _0x3d920a in _0x14d540){if(_0x14d540[_0x01e1('0x35')](_0x3d920a)&&(_0x14d540[_0x3d920a]['dialMethod']==='preview'||_0x14d540[_0x3d920a][_0x01e1('0x36')]===_0x01e1('0x37'))&&_0x14d540[_0x3d920a][_0x01e1('0x38')]===_0x01e1('0x39')){if(this[_0x01e1('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x01e1('0x3a')]();}}if(_0x14d540[_0x01e1('0x35')](_0x3d920a)&&_0x14d540[_0x3d920a]['dialMethod']===_0x01e1('0x5')&&_0x14d540[_0x3d920a]['type']==='outbound'){if(_0x14d540[_0x3d920a][_0x01e1('0x3b')]){this[_0x01e1('0x3c')](_0x14d540[_0x3d920a]);if(_0x14d540[_0x3d920a][_0x01e1('0x3d')])this[_0x01e1('0x3e')](_0x14d540[_0x3d920a]);}else{notSendMessagesQueue(_0x14d540[_0x3d920a]);}}}};Preview[_0x01e1('0xd')][_0x01e1('0x3f')]=function(_0xd120c1){var _0x19bc8b=this;this[_0x01e1('0x11')]['enqueue'](function(){if(!_[_0x01e1('0x40')](_0x19bc8b[_0x01e1('0x13')][_0xd120c1])){loggerAction[_0x01e1('0x41')](_0x01e1('0x42'),_0xd120c1,'Queue',_0x19bc8b[_0x01e1('0x13')][_0xd120c1]['queue'],_0x01e1('0x43'),JSON[_0x01e1('0x44')](_0x19bc8b['campaignsPreview'][_0x19bc8b[_0x01e1('0x13')][_0xd120c1][_0x01e1('0x45')]][_0x01e1('0x2b')]),'pTalking:\x20',JSON[_0x01e1('0x44')](_0x19bc8b['campaignsPreview'][_0x19bc8b[_0x01e1('0x13')][_0xd120c1][_0x01e1('0x45')]][_0x01e1('0x46')]),JSON[_0x01e1('0x44')](_0x19bc8b[_0x01e1('0x13')][_0xd120c1][_0x01e1('0x47')]),JSON[_0x01e1('0x44')](_[_0x01e1('0x48')](_0x19bc8b['actions'][_0xd120c1],[_0x01e1('0x49'),'UserId','VoiceQueueId',_0x01e1('0x4a')])));return ami[_0x01e1('0x4b')]({'action':_0x01e1('0x4c'),'channel':_0x19bc8b[_0x01e1('0x13')][_0xd120c1][_0x01e1('0x4d')]})[_0x01e1('0x4e')](function(_0xcf3529){if(_0xcf3529[_0x01e1('0x2d')]===_0x01e1('0x4f')){setTimeout(function(){if(_0x19bc8b['actions'][_0xd120c1]){ut[_0x01e1('0x50')](_0x19bc8b[_0x01e1('0x22')][_0x19bc8b[_0x01e1('0x13')][_0xd120c1][_0x01e1('0x45')]],'[clearZombieChannel]');if(_0x19bc8b[_0x01e1('0x13')][_0xd120c1]['dialAnswer']===!![]){ut[_0x01e1('0x51')](_0x19bc8b[_0x01e1('0x22')][_0x19bc8b[_0x01e1('0x13')][_0xd120c1][_0x01e1('0x45')]],_0x01e1('0x52'));ut[_0x01e1('0x53')](_0x01e1('0x54')+_0xd120c1,_0x19bc8b['actions'][_0xd120c1][_0x01e1('0x45')]);}ut[_0x01e1('0x53')](_0x01e1('0x55')+_0xd120c1,_0x19bc8b['actions'][_0xd120c1][_0x01e1('0x45')]);delete _0x19bc8b[_0x01e1('0x13')][_0xd120c1];}},0x2328);}});}});};Preview[_0x01e1('0xd')][_0x01e1('0x3a')]=function(){var _0x29d765=this;loggerAction[_0x01e1('0x41')](_0x01e1('0x56'),_['size'](this[_0x01e1('0x13')]));for(var _0x2e9834 in this['actions']){if(_0x29d765[_0x01e1('0x13')][_0x01e1('0x35')](_0x2e9834)){_0x29d765[_0x01e1('0x3f')](_0x2e9834);}}};Preview['prototype'][_0x01e1('0x3e')]=function(_0x56be31){var _0xb57ed4=this;rpcDb['getContactRecallMe'](_0x56be31['id'],ut[_0x01e1('0x57')](this[_0x01e1('0x14')]))[_0x01e1('0x58')](function(_0xc6b9f5){if(!_[_0x01e1('0x40')](_0xc6b9f5)){for(var _0x3db6c2=0x0;_0x3db6c2<_0xc6b9f5['length'];_0x3db6c2+=0x1){if(ut[_0x01e1('0x59')](_0xc6b9f5[_0x3db6c2][_0x01e1('0x5a')])<_0x56be31['dialRecallMeTimeout']*0x3c){if(_0xc6b9f5[_0x3db6c2]['Agent']&&!_0xc6b9f5[_0x3db6c2][_0x01e1('0x5b')][_0x01e1('0x5c')]){_0xb57ed4[_0x01e1('0x5d')](_0xc6b9f5[_0x3db6c2]['id'])[_0x01e1('0x58')](ut[_0x01e1('0x5e')]('[RecallMe]'))[_0x01e1('0x4e')](ut[_0x01e1('0x5e')](_0x01e1('0x5f')));}else{rpcDb['disableContact'](_0xc6b9f5[_0x3db6c2]['id']);}}else{var _0x312d8e=new Action(_0xc6b9f5[_0x3db6c2],_0x56be31);_0x312d8e[_0x01e1('0x60')]=moment()['format'](_0x01e1('0x61'));_0x56be31[_0x01e1('0x62')]+=0x1;ut[_0x01e1('0x63')](_0x312d8e,0x17,_0x01e1('0x64'));if(_0x56be31[_0x01e1('0x65')]){rpcDb[_0x01e1('0x66')](ut[_0x01e1('0x67')](_0xc6b9f5[_0x3db6c2]));rpcDb['createCustomerHistory'](_0x312d8e,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x01e1('0x63')](_0x312d8e,0x16,_0x01e1('0x68'));rpcDb[_0x01e1('0x69')](_0x312d8e,_0x01e1('0x6a'));rpcDb['createCustomerFinal'](_0x312d8e,_0x01e1('0x6a'));}}}}})[_0x01e1('0x4e')](ut[_0x01e1('0x5e')](_0x01e1('0x6b')));};Preview['prototype'][_0x01e1('0x3c')]=function(_0x483b20){_0x483b20[_0x01e1('0x2a')]=!![];if(ut[_0x01e1('0x6c')](_0x483b20[_0x01e1('0x6d')])){_0x483b20[_0x01e1('0x2d')]=utils[_0x01e1('0x2e')][_0x01e1('0x6e')];}else if(!ut[_0x01e1('0x6f')](_0x483b20[_0x01e1('0x3b')])){_0x483b20[_0x01e1('0x2d')]=utils[_0x01e1('0x2e')]['INACTIVE'];}else if(!this[_0x01e1('0x70')](_0x483b20[_0x01e1('0x71')])){if(!this['isTrunkReachable'](_0x483b20[_0x01e1('0x72')])){_0x483b20[_0x01e1('0x2d')]=utils['CAMPAIGN_STATUS'][_0x01e1('0x73')];}else{_0x483b20[_0x01e1('0x2d')]=utils[_0x01e1('0x2e')][_0x01e1('0x74')];}}else{_0x483b20[_0x01e1('0x2d')]=utils[_0x01e1('0x2e')][_0x01e1('0x74')];}};Preview[_0x01e1('0xd')][_0x01e1('0x75')]=function(_0x33f7e8,_0x166ed7,_0x2512f9){var _0xf38683=this;var _0x4fe350=this['actions'][_0x166ed7];var _0x27015a=this[_0x01e1('0x22')][_0x4fe350[_0x01e1('0x45')]];var _0x198196;var _0x28f149=![];var _0xdc6e6b=0x2;var _0x44b23c=0x3;if(_0x27015a){switch(_0x2512f9){case'1':_0x27015a[_0x01e1('0x76')]+=0x1;_0x4fe350[_0x01e1('0x77')]+=0x1;_0x4fe350[_0x01e1('0x78')]=ut[_0x01e1('0x79')](_0x4fe350);ut['logCustomer'](_0x4fe350,0x0,'NoSuchNumber');ami['emit'](_0x01e1('0x7a'),ut[_0x01e1('0x7b')](_0x4fe350,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x4fe350,_0x01e1('0x7c'));_0xf38683['verifyAdditionalPhones'](_0x4fe350,'0',_0x27015a)['then'](function(_0x4a1c77){_0x28f149=_0x4a1c77[_0x01e1('0x7d')]==0x1;_0xdc6e6b=_0x27015a['dialNoSuchNumberRetryFrequency'];_0x44b23c=_0x27015a[_0x01e1('0x7e')];if(!_0x28f149){if(ut[_0x01e1('0x79')](_0x4fe350)>=_0x27015a['dialGlobalMaxRetry']){_0x198196=ut['cloneAction'](_0x4fe350,0xf,_0x01e1('0x7f'));rpcDb[_0x01e1('0x80')](_0x198196,_0x01e1('0x81'));}else{if(_0x4fe350[_0x01e1('0x77')]>=_0x27015a[_0x01e1('0x82')]){rpcDb['createCustomerFinal'](_0x4fe350,_0x01e1('0x81'));}else{rpcDb['rescheduleContact'](ut[_0x01e1('0x83')](_0x4fe350,_0x01e1('0x77'),_0x27015a[_0x01e1('0x84')]),_0x4fe350['unlockAgent'],_0x4fe350[_0x01e1('0x85')]);}}delete this[_0x01e1('0x13')][_0x33f7e8['linkedid']];}else{_0x4fe350[_0x01e1('0x77')]++;logger[_0x01e1('0x41')](_0x01e1('0x86'),_0x4fe350[_0x01e1('0x77')]);logger['info']('id',_0x4fe350['idContact']);_0xf38683[_0x01e1('0x87')]({'id':_0x4fe350['idContact'],'field':{'countnosuchnumberretry':_0x4fe350[_0x01e1('0x77')]}})[_0x01e1('0x58')](function(){_0xf38683[_0x01e1('0x88')](_0x4fe350,_0xdc6e6b,_0x44b23c)[_0x01e1('0x58')](function(){});});}});break;case _0x01e1('0x89'):var _0x4de9bc=moment()['format'](_0x01e1('0x61'));_0x4fe350[_0x01e1('0x8a')]=_0x4de9bc;_0x4fe350[_0x01e1('0x8b')]=_0x4de9bc;_0x4fe350[_0x01e1('0x47')]=!![];_0x27015a['pTalking']+=0x1;logger[_0x01e1('0x41')]('[syncHangup][talking][increment]',_0x4fe350[_0x01e1('0x8c')],_0x01e1('0x8d'),_0x27015a['name'],_0x01e1('0x8e'),_0x27015a[_0x01e1('0x46')]);ami[_0x01e1('0x28')]('custom:agentconnect',ut[_0x01e1('0x7b')](_0x4fe350,_0x01e1('0x8f'),this['campaignsPreview'][_0x4fe350[_0x01e1('0x45')]]));if(_0x27015a[_0x01e1('0x90')]){ami[_0x01e1('0x28')]('custom:agentConnectPreview',ut[_0x01e1('0x91')](_0x4fe350));}break;case'16':ami[_0x01e1('0x28')](_0x01e1('0x92'),ut[_0x01e1('0x7b')](_0x4fe350,_0x01e1('0x93'),this[_0x01e1('0x22')][_0x4fe350['queue']]));emitVoiceQueueChannelRemove(ut[_0x01e1('0x7b')](_0x4fe350,_0x01e1('0x93')));_0x27015a[_0x01e1('0x94')]+=0x1;_0x27015a[_0x01e1('0x95')]+=0x1;_0x27015a[_0x01e1('0x96')]+=0x1;ut['decrementTalkink'](_0x27015a,_0x01e1('0x97'));_0x4fe350['countglobal']=ut[_0x01e1('0x79')](_0x4fe350);ut['logCustomer'](_0x4fe350,0x4,'Answer');rpcDb[_0x01e1('0x69')](_0x4fe350,_0x01e1('0x98'));rpcDb[_0x01e1('0x80')](_0x4fe350,_0x01e1('0x99'));rpcDb[_0x01e1('0x9a')](_0x4fe350);_0x27015a[_0x01e1('0x9b')]+=_0x4fe350[_0x01e1('0x9c')];_0x27015a[_0x01e1('0x9d')]+=_0x4fe350[_0x01e1('0x9c')];logger[_0x01e1('0x41')](_0x01e1('0x9e'),_0x4fe350[_0x01e1('0x8c')],_0x01e1('0x8d'),_0x27015a[_0x01e1('0x26')],_0x01e1('0x8e'),_0x27015a[_0x01e1('0x46')]);delete this['actions'][_0x33f7e8[_0x01e1('0x9f')]];break;case _0x01e1('0xa0'):_0x27015a[_0x01e1('0xa1')]+=0x1;_0x4fe350[_0x01e1('0xa2')]+=0x1;_0x4fe350[_0x01e1('0x78')]=ut[_0x01e1('0x79')](_0x4fe350);ut['logCustomer'](_0x4fe350,0x5,_0x01e1('0xa3'));_0xdc6e6b=_0x27015a[_0x01e1('0xa4')];_0x44b23c=_0x27015a['callAdditionalPhoneAfterMin'];ami[_0x01e1('0x28')](_0x01e1('0xa5'),ut['buildObj'](_0x4fe350,_0x01e1('0xa6')));rpcDb['createCustomerHistory'](_0x4fe350,_0x01e1('0xa7'));_0xf38683[_0x01e1('0xa8')](_0x4fe350,'5',_0x27015a)[_0x01e1('0x58')](function(_0x24da9a){_0x28f149=_0x24da9a[_0x01e1('0x7d')]==0x1;if(!_0x28f149){if(ut[_0x01e1('0x79')](_0x4fe350)>=_0x27015a[_0x01e1('0xa9')]){_0x198196=ut[_0x01e1('0xaa')](_0x4fe350,0xf,'Global');rpcDb[_0x01e1('0x80')](_0x198196,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x4fe350['countbusyretry']>=_0x27015a['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x4fe350,_0x01e1('0xa7'));}else{rpcDb[_0x01e1('0xab')](ut[_0x01e1('0x83')](_0x4fe350,_0x01e1('0xa2'),_0x27015a['dialBusyRetryFrequency']),_0x4fe350[_0x01e1('0xac')],_0x4fe350['activeContact']);}}}else{_0x4fe350[_0x01e1('0xa2')]++;_0xf38683['incrementPreviewCounters']({'id':_0x4fe350[_0x01e1('0xad')],'field':{'countbusyretry':_0x4fe350[_0x01e1('0xa2')]}})[_0x01e1('0x58')](function(){_0xf38683[_0x01e1('0x88')](_0x4fe350,_0xdc6e6b,_0x44b23c)[_0x01e1('0x58')](function(){});});}});break;case'NOANSWER':_0x27015a[_0x01e1('0xae')]+=0x1;_0x4fe350[_0x01e1('0xaf')]+=0x1;_0x4fe350[_0x01e1('0x78')]=ut[_0x01e1('0x79')](_0x4fe350);ut[_0x01e1('0x63')](_0x4fe350,0x3,'NoAnswer');_0xdc6e6b=_0x27015a[_0x01e1('0xb0')];_0x44b23c=_0x27015a['callAdditionalPhoneAfterMin'];var _0x27d3aa=ut[_0x01e1('0xb1')](_0x4fe350,_0x27015a);ami[_0x01e1('0x28')]('custom:agentnoanswer',_0x27d3aa);rpcDb['createCustomerHistory'](_0x4fe350,_0x01e1('0xb2'));_0xf38683[_0x01e1('0xa8')](_0x4fe350,'3',_0x27015a)[_0x01e1('0x58')](function(_0x239224){_0x28f149=_0x239224[_0x01e1('0x7d')]==0x1;if(!_0x28f149){if(ut[_0x01e1('0x79')](_0x4fe350)>=_0x27015a['dialGlobalMaxRetry']){_0x198196=ut[_0x01e1('0xaa')](_0x4fe350,0xf,'Global');rpcDb[_0x01e1('0x80')](_0x198196,_0x01e1('0xb3'));}else{if(_0x4fe350['countnoanswerretry']>=_0x27015a[_0x01e1('0xb4')]){rpcDb[_0x01e1('0x80')](_0x4fe350,_0x01e1('0xb2'));}else{rpcDb[_0x01e1('0xab')](ut[_0x01e1('0x83')](_0x4fe350,'countnoanswerretry',_0x27015a[_0x01e1('0xb0')]),_0x4fe350[_0x01e1('0xac')],_0x4fe350['activeContact']);}}}else{_0x4fe350[_0x01e1('0xaf')]++;_0xf38683['incrementPreviewCounters']({'id':_0x4fe350['idContact'],'field':{'countnoanswerretry':_0x4fe350[_0x01e1('0xaf')]}})[_0x01e1('0x58')](function(){_0xf38683[_0x01e1('0x88')](_0x4fe350,_0xdc6e6b,_0x44b23c)[_0x01e1('0x58')](function(){});});}});break;case _0x01e1('0xb5'):_0x27015a[_0x01e1('0xb6')]+=0x1;_0x4fe350['countcongestionretry']+=0x1;_0x4fe350[_0x01e1('0x78')]=ut[_0x01e1('0x79')](_0x4fe350);ut['logCustomer'](_0x4fe350,0x8,_0x01e1('0xb7'));_0xdc6e6b=_0x27015a[_0x01e1('0xb8')];_0x44b23c=_0x27015a[_0x01e1('0x7e')];ami['emit'](_0x01e1('0xb9'),ut[_0x01e1('0x7b')](_0x4fe350,'congestion'));rpcDb[_0x01e1('0x69')](_0x4fe350,_0x01e1('0xba'));_0xf38683[_0x01e1('0xa8')](_0x4fe350,'8',_0x27015a)[_0x01e1('0x58')](function(_0x1aff4b){_0x28f149=_0x1aff4b[_0x01e1('0x7d')]==0x1;if(!_0x28f149){if(ut[_0x01e1('0x79')](_0x4fe350)>=_0x27015a[_0x01e1('0xa9')]){_0x198196=ut['cloneAction'](_0x4fe350,0xf,_0x01e1('0x7f'));rpcDb[_0x01e1('0x80')](_0x198196,_0x01e1('0xbb'));}else{if(_0x4fe350[_0x01e1('0xbc')]>=_0x27015a[_0x01e1('0xbd')]){rpcDb[_0x01e1('0x80')](_0x4fe350,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x01e1('0x83')](_0x4fe350,'countcongestionretry',_0x27015a[_0x01e1('0xa4')]),_0x4fe350[_0x01e1('0xac')],_0x4fe350[_0x01e1('0x85')]);}}}else{_0x4fe350[_0x01e1('0xbc')]++;_0xf38683[_0x01e1('0x87')]({'id':_0x4fe350[_0x01e1('0xad')],'field':{'countcongestionretry':_0x4fe350['countcongestionretry']}})[_0x01e1('0x58')](function(){_0xf38683[_0x01e1('0x88')](_0x4fe350,_0xdc6e6b,_0x44b23c)[_0x01e1('0x58')](function(){});});}});break;case _0x01e1('0xbe'):_0x27015a[_0x01e1('0xbf')]+=0x1;_0x4fe350[_0x01e1('0xc0')]+=0x1;_0x4fe350[_0x01e1('0x78')]=ut[_0x01e1('0x79')](_0x4fe350);ut[_0x01e1('0x63')](_0x4fe350,0x14,_0x01e1('0xc1'));_0xdc6e6b=_0x27015a[_0x01e1('0xc2')];_0x44b23c=_0x27015a[_0x01e1('0x7e')];ami[_0x01e1('0x28')]('custom:agentreject',ut[_0x01e1('0x7b')](_0x4fe350,_0x01e1('0xc3')));rpcDb[_0x01e1('0x69')](_0x4fe350,_0x01e1('0xc4'));_0xf38683[_0x01e1('0xa8')](_0x4fe350,'20',_0x27015a)['then'](function(_0xa0e502){_0x28f149=_0xa0e502['additional']==0x1;if(!_0x28f149){if(ut[_0x01e1('0x79')](_0x4fe350)>=_0x27015a['dialGlobalMaxRetry']){_0x198196=ut[_0x01e1('0xaa')](_0x4fe350,0x14,_0x01e1('0xc1'));rpcDb[_0x01e1('0x80')](_0x198196,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4fe350['countagentrejectretry']>=_0x27015a[_0x01e1('0xc5')]){rpcDb[_0x01e1('0x80')](_0x4fe350,_0x01e1('0xc6'));}else{rpcDb[_0x01e1('0xab')](ut[_0x01e1('0x83')](_0x4fe350,_0x01e1('0xc0'),_0x27015a[_0x01e1('0xc2')]),_0x4fe350[_0x01e1('0xac')],_0x4fe350[_0x01e1('0x85')]);}}}else{_0x4fe350[_0x01e1('0xaf')]++;_0xf38683['incrementPreviewCounters']({'id':_0x4fe350['idContact'],'field':{'countnoanswerretry':_0x4fe350[_0x01e1('0xaf')]}})[_0x01e1('0x58')](function(){_0xf38683['swapAdditionalPhones'](_0x4fe350,_0xdc6e6b,_0x44b23c)[_0x01e1('0x58')](function(){});});}});break;case _0x01e1('0xc7'):_0x27015a[_0x01e1('0xc8')]+=0x1;_0x4fe350[_0x01e1('0xc9')]+=0x1;_0x4fe350[_0x01e1('0x78')]=ut[_0x01e1('0x79')](_0x4fe350);ut[_0x01e1('0x63')](_0x4fe350,0xb,_0x01e1('0xca'));rpcDb[_0x01e1('0x69')](_0x4fe350,_0x01e1('0xcb'));_0xf38683['verifyAdditionalPhones'](_0x4fe350,'11',_0x27015a)[_0x01e1('0x58')](function(_0x10aa5a){_0x28f149=_0x10aa5a[_0x01e1('0x7d')]==0x1;if(!_0x28f149){if(ut[_0x01e1('0x79')](_0x4fe350)>=_0x27015a[_0x01e1('0xa9')]){_0x198196=ut['cloneAction'](_0x4fe350,0xf,_0x01e1('0x7f'));rpcDb['createCustomerFinal'](_0x198196,_0x01e1('0xcb'));}else{if(_0x4fe350[_0x01e1('0xcc')]>=_0x27015a[_0x01e1('0xcd')]){rpcDb[_0x01e1('0x80')](_0x4fe350,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x01e1('0xab')](ut[_0x01e1('0x83')](_0x4fe350,_0x01e1('0xc9'),_0x27015a[_0x01e1('0xce')]),_0x4fe350[_0x01e1('0xac')],_0x4fe350[_0x01e1('0x85')]);}}}else{_0x4fe350['countnoanswerretry']++;_0xf38683['incrementPreviewCounters']({'id':_0x4fe350[_0x01e1('0xad')],'field':{'countnoanswerretry':_0x4fe350[_0x01e1('0xaf')]}})[_0x01e1('0x58')](function(){_0xf38683['swapAdditionalPhones'](_0x4fe350,_0xdc6e6b,_0x44b23c)[_0x01e1('0x58')](function(){});});}});break;case'18':_0x27015a['outboundUnknownCallsDay']+=0x1;_0x4fe350[_0x01e1('0xcf')]+=0x1;_0x4fe350[_0x01e1('0x78')]=ut[_0x01e1('0x79')](_0x4fe350);ut[_0x01e1('0x63')](_0x4fe350,0x12,_0x33f7e8[_0x01e1('0xd0')]||_0x33f7e8[_0x01e1('0xd1')]);ami[_0x01e1('0x28')](_0x01e1('0xd2'),ut[_0x01e1('0x7b')](_0x4fe350,_0x01e1('0xd3')));rpcDb[_0x01e1('0x69')](_0x4fe350,_0x01e1('0xd4'));_0xf38683[_0x01e1('0xa8')](_0x4fe350,'18',_0x27015a)[_0x01e1('0x58')](function(_0x23254a){_0x28f149=_0x23254a[_0x01e1('0x7d')]==0x1;if(!_0x28f149){if(ut[_0x01e1('0x79')](_0x4fe350)>=_0x27015a[_0x01e1('0xa9')]){_0x198196=ut[_0x01e1('0xaa')](_0x4fe350,0x12,_0x01e1('0x7f'));rpcDb[_0x01e1('0x80')](_0x198196,_0x01e1('0xd4'));}else{rpcDb[_0x01e1('0x80')](_0x4fe350,_0x01e1('0xd4'));}}else{_0x4fe350[_0x01e1('0xaf')]++;_0xf38683['incrementPreviewCounters']({'id':_0x4fe350[_0x01e1('0xad')],'field':{'countnoanswerretry':_0x4fe350[_0x01e1('0xaf')]}})['then'](function(){_0xf38683['swapAdditionalPhones'](_0x4fe350,_0xdc6e6b,_0x44b23c)[_0x01e1('0x58')](function(){});});}});delete this[_0x01e1('0x13')][_0x33f7e8[_0x01e1('0x9f')]];break;case'19':_0x27015a[_0x01e1('0xd5')]+=0x1;_0x4fe350[_0x01e1('0x78')]=ut[_0x01e1('0x79')](_0x4fe350);ut[_0x01e1('0x63')](_0x4fe350,0x13,_0x33f7e8[_0x01e1('0xd0')]||_0x33f7e8[_0x01e1('0xd1')]);ami[_0x01e1('0x28')]('custom:amd',ut[_0x01e1('0x7b')](_0x4fe350,_0x01e1('0xd3')));rpcDb[_0x01e1('0x69')](_0x4fe350,_0x01e1('0xd6'));_0xf38683[_0x01e1('0xa8')](_0x4fe350,'18',_0x27015a)[_0x01e1('0x58')](function(_0xc5154e){_0x28f149=_0xc5154e[_0x01e1('0x7d')]==0x1;if(!_0x28f149){if(ut['totalGlobal'](_0x4fe350)>=_0x27015a[_0x01e1('0xa9')]){_0x198196=ut['cloneAction'](_0x4fe350,0xf,_0x01e1('0x7f'));rpcDb['createCustomerFinal'](_0x198196,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x01e1('0x80')](_0x4fe350,_0x01e1('0xd6'));}}else{_0x4fe350[_0x01e1('0xaf')]++;_0xf38683[_0x01e1('0x87')]({'id':_0x4fe350['idContact'],'field':{'countnoanswerretry':_0x4fe350[_0x01e1('0xaf')]}})[_0x01e1('0x58')](function(){_0xf38683['swapAdditionalPhones'](_0x4fe350,_0xdc6e6b,_0x44b23c)[_0x01e1('0x58')](function(){});});}});delete this[_0x01e1('0x13')][_0x33f7e8[_0x01e1('0x9f')]];break;default:if(_0x4fe350[_0x01e1('0x47')]){ut[_0x01e1('0x51')](_0x27015a,_0x01e1('0xd7'));ut[_0x01e1('0x53')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x27015a[_0x01e1('0x26')],_0x33f7e8);}_0x27015a[_0x01e1('0xd5')]+=0x1;_0x4fe350[_0x01e1('0x78')]=ut[_0x01e1('0x79')](_0x4fe350);ut[_0x01e1('0x63')](_0x4fe350,0xc,_0x33f7e8[_0x01e1('0xd0')]||_0x33f7e8['dialstatus']);_0xdc6e6b=_0x27015a[_0x01e1('0xc2')];_0x44b23c=_0x27015a[_0x01e1('0x7e')];rpcDb[_0x01e1('0x69')](_0x4fe350,_0x01e1('0xd8'));_0xf38683[_0x01e1('0xa8')](_0x4fe350,'20',_0x27015a)[_0x01e1('0x58')](function(_0x25a8dc){_0x28f149=_0x25a8dc[_0x01e1('0x7d')]==0x1;if(!_0x28f149){if(ut[_0x01e1('0x79')](_0x4fe350)>=_0x27015a[_0x01e1('0xa9')]){_0x198196=ut['cloneAction'](_0x4fe350,0xf,_0x01e1('0x7f'));rpcDb[_0x01e1('0x80')](_0x198196,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x01e1('0x80')](_0x4fe350,_0x01e1('0xd9'));}delete this[_0x01e1('0x13')][_0x33f7e8[_0x01e1('0x9f')]];}else{_0xf38683[_0x01e1('0x88')](_0x4fe350,_0xdc6e6b,_0x44b23c)['then'](function(){});}});}if(!(_0x4fe350['dialAnswer']&&_0x2512f9==='16')){ut['updateOriginated'](_0x27015a,'[callProgressDetectingCustomer]');logger[_0x01e1('0x41')](_0x01e1('0xda'),_0x4fe350['uniqueid'],_0x01e1('0x8d'),_0x27015a[_0x01e1('0x26')],_0x01e1('0x43'),_0x27015a[_0x01e1('0x2b')]);}if(_0x2512f9!==_0x01e1('0x89')){delete this[_0x01e1('0x13')][_0x33f7e8[_0x01e1('0x9f')]];delete this[_0x01e1('0x13')][_0x33f7e8['destlinkedid']];}_0x27015a[_0x01e1('0xdb')]=!![];}};Preview['prototype']['callProgressDetectingAgent']=function(_0x595da2,_0x402c24,_0xc129fc){if(_[_0x01e1('0xdc')](_0x402c24)&&_0x01e1('0xdd')!==typeof _0x402c24){return;}if(_[_0x01e1('0xdc')](_0xc129fc)&&'object'!==typeof _0xc129fc){return;}switch(_0xc129fc['reason']){case'0':ut[_0x01e1('0xde')](_0x595da2,0x0,_0x01e1('0xdf'));rpcDb[_0x01e1('0xe0')](_0x595da2,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x595da2,0x3,_0x01e1('0xe1'));rpcDb[_0x01e1('0xe0')](_0x595da2,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x01e1('0xde')](_0x595da2,0x5,_0x01e1('0xa3'));rpcDb[_0x01e1('0xe0')](_0x595da2,_0x01e1('0xe2'));break;case'8':ut['logAgent'](_0x595da2,0x8,'Congestion');rpcDb[_0x01e1('0xe0')](_0x595da2,_0x01e1('0xe3'));break;case'22':ut[_0x01e1('0xde')](_0x595da2,0x16,_0x01e1('0xe4'));rpcDb[_0x01e1('0xe0')](_0x595da2,_0x01e1('0xe5'));break;default:ut['logAgent'](_0x595da2,0xc,_0xc129fc[_0x01e1('0xe6')]);rpcDb[_0x01e1('0xe0')](_0x595da2,'[callProgressDetectingAgent][logCongestion]');}ut[_0x01e1('0x50')](_0x402c24,_0x01e1('0xe7'));logger[_0x01e1('0x41')](_0x01e1('0xe8'),_0x595da2[_0x01e1('0x8c')],'\x20Queue',_0x402c24['name'],_0x01e1('0x43'),_0x402c24[_0x01e1('0x2b')]);delete this[_0x01e1('0x13')][_0x595da2[_0x01e1('0x8c')]];};Preview['prototype'][_0x01e1('0xa8')]=function(_0x2e0f1d,_0x7dc848,_0x460a5d){return cmHopperAdditionalPhone[_0x01e1('0xa8')](_0x2e0f1d,_0x7dc848,_0x460a5d)[_0x01e1('0x4e')](logger[_0x01e1('0x41')]('[verifyAdditionalPhone]\x20'));};Preview[_0x01e1('0xd')][_0x01e1('0x88')]=function(_0x27dde8,_0x57e8fa,_0x112ab6){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x27dde8,_0x57e8fa,_0x112ab6)[_0x01e1('0x4e')](logger[_0x01e1('0x41')](_0x01e1('0xe9')));};Preview['prototype'][_0x01e1('0x87')]=function(_0x3d7faa){return Promise['resolve']()[_0x01e1('0x58')](cmHopperAdditionalPhone[_0x01e1('0x87')](_0x3d7faa))[_0x01e1('0x4e')](logger[_0x01e1('0x41')]('[incrementPreviewCounters]\x20'));};Preview[_0x01e1('0xd')][_0x01e1('0xea')]=function(_0x3c5898,_0x4ceb28,_0x1312c2,_0x4e373f,_0x5c7136){var _0x5dc701=this;return new Promise(function(_0x4a5817,_0x3bbaaa){if(_[_0x01e1('0x40')](_0x4ceb28)||_[_0x01e1('0x40')](_0x4ceb28[_0x01e1('0xeb')])||_['isNil'](_0x4ceb28[_0x01e1('0xec')])||_[_0x01e1('0x40')](_0x4ceb28[_0x01e1('0xed')])){_0x3bbaaa(ut[_0x01e1('0x2d')]('Contact\x20is\x20undefined',_0x4e373f,_0x5c7136));return;}var _0x1fd43f=uuid['v4']();var _0x21c11f=_0x5dc701[_0x01e1('0x22')][_0x4ceb28[_0x01e1('0xee')][_0x01e1('0x26')]];var _0x31ed68=_0x1312c2?_0x5dc701[_0x01e1('0x14')][_0x1312c2]['id']:undefined;_0x5dc701['actions'][_0x1fd43f]=new Action(_0x4ceb28,_0x21c11f,_0x1fd43f,_0x1312c2,_0x31ed68);var _0x167499=_0x5dc701[_0x01e1('0x13')][_0x1fd43f];_0x167499[_0x01e1('0xac')]=_0x4e373f;_0x167499['activeContact']=_0x5c7136;_0x167499[_0x01e1('0xef')]=_0x1312c2;if(_[_0x01e1('0xf0')](_0x3c5898)){_0x5dc701[_0x01e1('0xf1')](_0x167499,_0x21c11f,_0x4ceb28,_0x1312c2)[_0x01e1('0x58')](function(_0x151e8f){logger['info']('[Preview][execCall][success]',_0x01e1('0xf2')+_0x167499['queue']+_0x01e1('0xf3')+_0x167499[_0x01e1('0xad')],JSON[_0x01e1('0x44')](_0x151e8f));ami['emit']('custom:agentcalled',ut[_0x01e1('0x7b')](_0x167499,_0x01e1('0xf4'),_0x5dc701[_0x01e1('0x22')][_0x167499[_0x01e1('0x45')]]));_0x4a5817(ut[_0x01e1('0x2d')](_0x01e1('0xf5')));})[_0x01e1('0x4e')](function(_0x9c6073){ut[_0x01e1('0xf6')]('[Preview][execCall][failure]',_0x9c6073);_0x3bbaaa(ut['message'](_0x01e1('0xf7'),_0x4e373f,_0x5c7136));});}else{_0x21c11f[_0x01e1('0xf8')]+=0x1;ut[_0x01e1('0xf9')](_0x167499);rpcDb[_0x01e1('0xfa')](_0x167499,_0x01e1('0xfb'));delete _0x5dc701['actions'][_0x1fd43f];_0x3bbaaa(ut[_0x01e1('0x2d')](_0x01e1('0xfc'),_0x4e373f,_0x5c7136));}});};Preview[_0x01e1('0xd')][_0x01e1('0x70')]=function(_0x3c73c2){return!_[_0x01e1('0x40')](_0x3c73c2)&&!_[_0x01e1('0x40')](_0x3c73c2[_0x01e1('0x26')])&&!_[_0x01e1('0x40')](_0x3c73c2['active'])&&_0x3c73c2[_0x01e1('0xfd')]&&!_[_0x01e1('0x40')](this['trunks'][util['format'](_0x01e1('0xfe'),_0x3c73c2[_0x01e1('0x26')])])&&!_[_0x01e1('0x40')](this[_0x01e1('0x12')][util[_0x01e1('0x24')](_0x01e1('0xfe'),_0x3c73c2['name'])]['status'])&&(this[_0x01e1('0x12')][util['format'](_0x01e1('0xfe'),_0x3c73c2[_0x01e1('0x26')])]['status']===_0x01e1('0xff')||this[_0x01e1('0x12')][util[_0x01e1('0x24')]('SIP/%s',_0x3c73c2['name'])][_0x01e1('0x4c')]===_0x01e1('0x100'));};Preview[_0x01e1('0xd')][_0x01e1('0x5d')]=function(_0x20f423,_0x336776){return this[_0x01e1('0x101')](_0x20f423,_0x336776)[_0x01e1('0x58')](function(_0x1a80f2){return _['pick'](_0x1a80f2,[_0x01e1('0x2d')]);})[_0x01e1('0x4e')](function(_0x2b6e79){if(_0x2b6e79[_0x01e1('0x102')]){rpcDb[_0x01e1('0x103')](_0x20f423);}if(_0x2b6e79['active']){rpcDb[_0x01e1('0x104')](_0x20f423);}throw _[_0x01e1('0x48')](_0x2b6e79,[_0x01e1('0x2d')]);});};Preview['prototype'][_0x01e1('0x101')]=function(_0x5da5f9,_0x5c855b){var _0x26cd75=this;var _0x4280fc,_0x2fe7db;return rpcDb['getContactPreview'](_0x5da5f9)[_0x01e1('0x58')](function(_0x5638b1){if(!_['isNil'](_0x5638b1[0x0])){_0x2fe7db=_0x5638b1[0x0][_0x01e1('0x105')]?![]:!![];_0x4280fc=_0x5638b1[0x0][_0x01e1('0x105')]?!![]:![];_0x4280fc=_0x5c855b?!![]:_0x4280fc;}var _0x508697=_0x26cd75[_0x01e1('0x106')](_0x5638b1);if(_0x508697[_0x01e1('0x107')]){rpcDb[_0x01e1('0x108')](_['pick'](_0x5638b1[0x0],[_0x01e1('0xed'),'phone']))['then'](function(_0x106bbd){_0x26cd75[_0x01e1('0xea')](_0x106bbd,_0x5638b1[0x0],_0x5c855b,_0x2fe7db,_0x4280fc)['then'](function(_0x377876){return _0x377876;})[_0x01e1('0x4e')](function(_0xbc9195){throw _0xbc9195;});})[_0x01e1('0x4e')](function(_0x216f27){ut[_0x01e1('0xf6')](_0x01e1('0x109'),_0x216f27);throw ut['message'](_0x01e1('0x10a'),_0x2fe7db,_0x4280fc);});}else{throw ut[_0x01e1('0x2d')](_0x508697['message'],_0x2fe7db,_0x4280fc);}})[_0x01e1('0x4e')](function(_0x46820d){ut[_0x01e1('0xf6')](_0x01e1('0x10b'),_0x46820d);throw ut[_0x01e1('0x2d')](_0x01e1('0x10a'),![],!![]);});};Preview[_0x01e1('0xd')]['validateContact']=function(_0x1061b7){if(_[_0x01e1('0x40')](_0x1061b7)||_[_0x01e1('0xf0')](_0x1061b7)||!_[_0x01e1('0x40')](_0x1061b7[0x0][_0x01e1('0x5b')])&&_[_0x01e1('0x40')](_0x1061b7[0x0][_0x01e1('0x5b')][_0x01e1('0x26')])){ut[_0x01e1('0xf6')](_0x01e1('0x10c'),_0x1061b7);return{'isValid':![],'message':_0x01e1('0x10d')};}var _0xb1dc7b=this[_0x01e1('0x22')][_0x1061b7[0x0][_0x01e1('0xee')]['name']];_0xb1dc7b['message']=utils['CAMPAIGN_STATUS'][_0x01e1('0x74')];if(_[_0x01e1('0x40')](_0xb1dc7b)){ut[_0x01e1('0xf6')](_0x01e1('0x10e'),_0xb1dc7b);return{'isValid':![],'message':_0x01e1('0x10f')};}if(!this[_0x01e1('0x70')](_0xb1dc7b[_0x01e1('0x71')])){ut[_0x01e1('0xf6')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x01e1('0x110')+_0xb1dc7b[_0x01e1('0x26')]+_0x01e1('0x111'));if(!this[_0x01e1('0x70')](_0xb1dc7b[_0x01e1('0x72')])){ut['logger'](_0x01e1('0x112'),_0xb1dc7b[_0x01e1('0x26')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x01e1('0x113')};}}if(!ut[_0x01e1('0x6f')](_0xb1dc7b['dialActive'])){ut[_0x01e1('0xf6')](_0x01e1('0x114'),_0xb1dc7b[_0x01e1('0x26')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x01e1('0x110')+_0xb1dc7b[_0x01e1('0x26')]+_0x01e1('0x115')};}return{'isValid':!![],'message':_0x01e1('0x116')};};Preview[_0x01e1('0xd')][_0x01e1('0xf1')]=function(_0x5e1d9f,_0x14cc82,_0x5a1e8d,_0x202809){var _0x569a63=this;return new Promise(function(_0x5d2615,_0x3c341e){var _0x26180c=_0x5e1d9f[_0x01e1('0x8c')];var _0x2e341f=_0x569a63['isTrunkReachable'](_0x14cc82[_0x01e1('0x71')])?util['format']('SIP/%s/%s%s',_0x14cc82[_0x01e1('0x71')][_0x01e1('0x26')],_['isNil'](_0x14cc82['dialPrefix'])?'':_0x14cc82[_0x01e1('0x117')][_0x01e1('0x118')]()||'',_0x14cc82['dialCutDigit']>0x0?_0x5a1e8d['phone']['substring'](_0x14cc82[_0x01e1('0x119')]):_0x5a1e8d[_0x01e1('0xec')]):util[_0x01e1('0x24')]('SIP/%s/%s%s',_[_0x01e1('0x40')](_0x14cc82[_0x01e1('0x72')])?_0x14cc82[_0x01e1('0x71')]['name']:_0x14cc82[_0x01e1('0x72')][_0x01e1('0x26')],_[_0x01e1('0x40')](_0x14cc82[_0x01e1('0x117')])?'':_0x14cc82[_0x01e1('0x117')]['trim']()||'',_0x14cc82[_0x01e1('0x119')]>0x0?_0x5a1e8d[_0x01e1('0xec')]['substring'](_0x14cc82[_0x01e1('0x119')]):_0x5a1e8d[_0x01e1('0xec')]);var _0x40851b=_0x569a63[_0x01e1('0x70')](_0x14cc82[_0x01e1('0x71')])?ut[_0x01e1('0x11a')](_0x14cc82[_0x01e1('0x71')]['callerid'],_0x14cc82[_0x01e1('0x11b')],_0x14cc82[_0x01e1('0x11c')]>0x0?ut[_0x01e1('0x11d')](_0x14cc82['dialOriginateCallerIdNumber'],_0x14cc82[_0x01e1('0x11c')]):_0x14cc82[_0x01e1('0x11e')]):ut[_0x01e1('0x11a')](_[_0x01e1('0x40')](_0x14cc82[_0x01e1('0x72')])?_0x14cc82[_0x01e1('0x71')][_0x01e1('0x11f')]:_0x14cc82[_0x01e1('0x72')]['callerid'],_0x14cc82[_0x01e1('0x11b')],_0x14cc82[_0x01e1('0x11c')]>0x0?ut['getCallerIdRandom'](_0x14cc82[_0x01e1('0x11e')],_0x14cc82[_0x01e1('0x11c')]):_0x14cc82['dialOriginateCallerIdNumber']);if(_0x40851b){_0x5e1d9f['originatecalleridname']=ut[_0x01e1('0x120')](_0x40851b);_0x5e1d9f['originatecalleridnum']=ut[_0x01e1('0x121')](_0x40851b);}var _0x5f4685=ut[_0x01e1('0x122')](_0x14cc82,_0x5a1e8d,_0x2e341f,_0x40851b,_0x26180c,_0x5e1d9f);var _0x4c9fdf=utils[_0x01e1('0x123')](_0x5a1e8d[_0x01e1('0xeb')]);Object[_0x01e1('0x124')](_0x5f4685,_0x4c9fdf);_[_0x01e1('0x125')](_0x5e1d9f,ut[_0x01e1('0x126')](_0x5f4685));_0x5e1d9f['starttime']=moment()[_0x01e1('0x24')](_0x01e1('0x61'));_0x14cc82[_0x01e1('0x127')]=_0x5f4685;var _0x36c9f3=ut[_0x01e1('0x128')](_0x5e1d9f,_0x14cc82,_0x5f4685,_0x5e1d9f['activeContact'],_0x202809);return ami[_0x01e1('0x4b')](_0x36c9f3)[_0x01e1('0x58')](function(_0x560f07){_0x14cc82[_0x01e1('0x2b')]+=0x1;logger[_0x01e1('0x41')](_0x01e1('0x129'),_0x26180c,_0x01e1('0x8d'),_0x14cc82[_0x01e1('0x26')],_0x01e1('0x43'),_0x14cc82[_0x01e1('0x2b')]);_0x5d2615(_0x560f07);})[_0x01e1('0x4e')](function(_0x365019){ut[_0x01e1('0xde')](_0x5e1d9f,0xe,'OriginateError');rpcDb[_0x01e1('0xe0')](_0x5e1d9f,'[originateFailure][logOriginateFailure]');_0x3c341e(_0x365019);});});};Preview[_0x01e1('0xd')][_0x01e1('0x1b')]=function(_0x2bf5d0){if(this[_0x01e1('0x13')][_0x2bf5d0[_0x01e1('0x9f')]]){this['actions'][_0x2bf5d0['linkedid']]['channel']=_0x2bf5d0[_0x01e1('0x4d')];}};Preview[_0x01e1('0xd')][_0x01e1('0x12a')]=function(_0x2542ca){var _0x1db139=this;var _0x10810a=this[_0x01e1('0x13')][_0x2542ca[_0x01e1('0x12b')]];if(_0x10810a){if(_0x10810a[_0x01e1('0xef')]&&this[_0x01e1('0x14')][_0x10810a[_0x01e1('0xef')]]){ut[_0x01e1('0x12c')](_0x10810a,this[_0x01e1('0x14')][_0x10810a[_0x01e1('0xef')]][_0x01e1('0x26')],this['agents'][_0x10810a[_0x01e1('0xef')]]['id']);}var _0x35f5d8=_[_0x01e1('0x12d')](_0x10810a);_0x35f5d8[_0x01e1('0x8a')]=moment()[_0x01e1('0x24')](_0x01e1('0x61'));var _0x724611=_0x1db139[_0x01e1('0x22')][_0x10810a[_0x01e1('0x45')]];if(ut[_0x01e1('0x12e')](_0x2542ca[_0x01e1('0x12f')])){if(_0x10810a['unlockAgent']){rpcDb[_0x01e1('0x103')](_0x10810a[_0x01e1('0xad')]);}if(_0x10810a[_0x01e1('0x85')]){rpcDb[_0x01e1('0x104')](_0x10810a['idContact']);}ami[_0x01e1('0x28')](_0x01e1('0x130'),ut[_0x01e1('0x7b')](_0x10810a,'rejected',this[_0x01e1('0x22')][_0x10810a['queue']]));this[_0x01e1('0x131')](_0x35f5d8,_0x724611,_0x2542ca);}else{_0x10810a[_0x01e1('0x60')]=moment()[_0x01e1('0x24')](_0x01e1('0x61'));ut['logAgent'](_0x35f5d8,0x4,_0x01e1('0x132'));rpcDb[_0x01e1('0xe0')](_0x35f5d8,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype'][_0x01e1('0x17')]=function(_0x740e2d){var _0x3d4627=this[_0x01e1('0x13')][_0x740e2d[_0x01e1('0x9f')]];var _0x4e26d5;if(_0x3d4627){_0x4e26d5=this[_0x01e1('0x22')][_0x3d4627[_0x01e1('0x45')]];logger[_0x01e1('0x41')](_0x01e1('0x133'),_0x740e2d[_0x01e1('0x9f')],_0x01e1('0x8d'),_0x4e26d5[_0x01e1('0x26')],_0x01e1('0x8e'),_0x4e26d5[_0x01e1('0x46')]);}if(this[_0x01e1('0x13')][_0x740e2d['linkedid']]&&_0x740e2d[_0x01e1('0x9f')]!==_0x740e2d[_0x01e1('0x8c')]){if(_0x740e2d[_0x01e1('0x134')]==='16'&&this[_0x01e1('0x13')][_0x740e2d[_0x01e1('0x9f')]][_0x01e1('0x47')]){this[_0x01e1('0x75')](_0x740e2d,_0x740e2d[_0x01e1('0x9f')],_0x740e2d[_0x01e1('0x134')]);}else if(this[_0x01e1('0x13')][_0x740e2d[_0x01e1('0x9f')]][_0x01e1('0x47')]){logger[_0x01e1('0x41')](_0x01e1('0x135'),_0x740e2d[_0x01e1('0x9f')],_0x740e2d['cause'],_0x01e1('0x8d'),_0x4e26d5[_0x01e1('0x26')],_0x01e1('0x8e'),_0x4e26d5[_0x01e1('0x46')]);this[_0x01e1('0x75')](_0x740e2d,_0x740e2d['linkedid'],_0x740e2d[_0x01e1('0x134')]);}}else if(_0x3d4627&&_[_0x01e1('0x40')](_0x3d4627[_0x01e1('0x136')])&&_0x4e26d5[_0x01e1('0x137')]&&_0x740e2d['linkedid']===_0x740e2d[_0x01e1('0x8c')]&&_[_0x01e1('0x40')](_0x740e2d['reason'])&&_0x740e2d['cause']==='16'&&_0x740e2d[_0x01e1('0x138')]==='6'&&_[_0x01e1('0xdc')](_0x3d4627['transfer'])){if(_0x3d4627[_0x01e1('0xac')]){rpcDb[_0x01e1('0x103')](_0x3d4627['idContact']);}if(_0x3d4627[_0x01e1('0x85')]){rpcDb[_0x01e1('0x104')](_0x3d4627[_0x01e1('0xad')]);}_0x740e2d[_0x01e1('0xe6')]='22';this[_0x01e1('0x131')](_0x3d4627,_0x4e26d5,_0x740e2d);}else if(_0x3d4627&&_0x3d4627[_0x01e1('0x139')]){if(_0x740e2d[_0x01e1('0x134')]==='16'&&this['actions'][_0x740e2d[_0x01e1('0x9f')]][_0x01e1('0x47')]){logger[_0x01e1('0x41')](_0x01e1('0x13a'),_0x740e2d['linkedid'],_0x740e2d[_0x01e1('0x134')],'\x20Queue',_0x4e26d5['name'],_0x01e1('0x8e'),_0x4e26d5[_0x01e1('0x46')]);this[_0x01e1('0x75')](_0x740e2d,_0x740e2d['linkedid'],_0x740e2d[_0x01e1('0x134')]);}else if(this[_0x01e1('0x13')][_0x740e2d['linkedid']][_0x01e1('0x47')]){logger[_0x01e1('0x41')](_0x01e1('0x135'),_0x740e2d[_0x01e1('0x9f')],_0x740e2d[_0x01e1('0x134')],_0x01e1('0x8d'),_0x4e26d5['name'],_0x01e1('0x8e'),_0x4e26d5['pTalking']);this[_0x01e1('0x75')](_0x740e2d,_0x740e2d[_0x01e1('0x9f')],_0x740e2d[_0x01e1('0x134')]);}}};Preview['prototype'][_0x01e1('0x1a')]=function(_0x251a21){if(this[_0x01e1('0x13')][_0x251a21[_0x01e1('0x13b')]]&&_0x251a21[_0x01e1('0x13b')]!==_0x251a21[_0x01e1('0x13c')]){this['callProgressDetectingCustomer'](_0x251a21,_0x251a21[_0x01e1('0x13b')],_0x251a21['dialstatus']);}};Preview[_0x01e1('0xd')][_0x01e1('0x13d')]=function(_0x226957){if(this[_0x01e1('0x13')][_0x226957[_0x01e1('0x9f')]]&&_0x226957[_0x01e1('0x9f')]!==_0x226957[_0x01e1('0x8c')]&&!this[_0x01e1('0x13')][_0x226957[_0x01e1('0x9f')]][_0x01e1('0x47')]){if(_0x226957['cause']==='1'){this[_0x01e1('0x75')](_0x226957,_0x226957[_0x01e1('0x9f')],_0x226957[_0x01e1('0x134')]);}}};Preview[_0x01e1('0xd')][_0x01e1('0x13e')]=function(_0x59d0c5,_0x30ca5f,_0x3ed11c){if(this[_0x01e1('0x13')][_0x59d0c5]){if(_['isNil'](this[_0x01e1('0x13')][_0x59d0c5][_0x01e1('0x127')])){this[_0x01e1('0x13')][_0x59d0c5][_0x01e1('0x127')]={};}this['actions'][_0x59d0c5][_0x01e1('0x127')][_0x30ca5f]=_0x3ed11c;}};Preview[_0x01e1('0xd')]['syncVarSet']=function(_0x175190){try{if(!_[_0x01e1('0x40')](_0x175190)){if(ut[_0x01e1('0x13f')](_['keys'](_0x175190[_0x01e1('0x140')])[0x0])){this['addVariable'](_0x175190[_0x01e1('0x8c')],_['keys'](_0x175190['variable'])[0x0],_0x175190[_0x01e1('0x141')]);}}}catch(_0x479050){logger['error'](_0x01e1('0x142'),util[_0x01e1('0x143')](_0x479050,{'showHidden':![],'depth':null}));}};Preview[_0x01e1('0xd')][_0x01e1('0x1f')]=function(_0x5047d2){if(_0x5047d2){if(this[_0x01e1('0x13')][_0x5047d2[_0x01e1('0x144')]]){this[_0x01e1('0x13')][_0x5047d2['transfertargetlinkedid']][_0x01e1('0x139')]=!![];}}};Preview[_0x01e1('0xd')][_0x01e1('0x145')]=function(_0x5eb6a2){if(_0x5eb6a2){if(this['actions'][_0x5eb6a2[_0x01e1('0x146')]]){this['actions'][_0x5eb6a2[_0x01e1('0x146')]][_0x01e1('0x139')]=!![];}}};module[_0x01e1('0x147')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 2cb8ebe..2bd87b0 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 _0x1606=['assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1606,0x77));var _0x6160=function(_0x29c275,_0x580b32){_0x29c275=_0x29c275-0x0;var _0x27c8fb=_0x1606[_0x29c275];return _0x27c8fb;};'use strict';var util=require(_0x6160('0x0'));var BPromise=require(_0x6160('0x1'));var logger=require(_0x6160('0x2'))(_0x6160('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x6160('0x4'));var cmHopperBlack=require(_0x6160('0x5'));var agentReportPreview=require(_0x6160('0x6'));var voiceQueueReport=require(_0x6160('0x7'));function loggerCatch(_0x884245){return function(_0x3f3c18){logger[_0x6160('0x8')](_0x884245,util['inspect'](_0x3f3c18,{'showHidden':![],'depth':null}));};}function create(_0x4c06a9){return cmHopperHistory[_0x6160('0x9')](_0x4c06a9)[_0x6160('0xa')](loggerCatch(_0x6160('0xb')));}function createAgent(_0x4bf010){return BPromise[_0x6160('0xc')]()[_0x6160('0xd')](agentReportPreview[_0x6160('0x9')](_0x4bf010))[_0x6160('0xa')](loggerCatch(_0x6160('0xb')));}function moveContact(_0x58461b){return cmHopper[_0x6160('0xe')](_0x58461b,!![])[_0x6160('0xa')](loggerCatch(_0x6160('0xf')));}exports[_0x6160('0x10')]=function(_0x2e42e2){return cmHopperBlack[_0x6160('0x10')](_0x2e42e2)[_0x6160('0xa')](loggerCatch(_0x6160('0x11')));};exports[_0x6160('0x12')]=function(_0x4923b6){return BPromise[_0x6160('0xc')]()['then'](cmHopper[_0x6160('0x12')](_0x4923b6))[_0x6160('0xa')](loggerCatch('[getContactPreview]\x20'));};exports[_0x6160('0x9')]=function(_0x1d7ae6,_0x25eb17){create(_0x1d7ae6)[_0x6160('0xa')](loggerCatch(_0x25eb17));moveContact(_0x1d7ae6)[_0x6160('0xa')](loggerCatch(_0x25eb17));};exports[_0x6160('0x13')]=function(_0x53d6d3,_0x1c3d6c){createAgent(_0x53d6d3)['catch'](loggerCatch(_0x1c3d6c));};exports[_0x6160('0x14')]=function(_0x4c8622,_0x63a35a){create(_0x4c8622)['catch'](loggerCatch(_0x63a35a));};exports[_0x6160('0x15')]=function(_0x284f6a,_0xcc3107){moveContact(_0x284f6a)[_0x6160('0xa')](loggerCatch(_0xcc3107));};exports[_0x6160('0x16')]=function(_0x9a3779,_0x89324b,_0x300db1){if(_0x89324b){_0x9a3779[_0x6160('0x17')]=null;}if(_0x300db1){_0x9a3779[_0x6160('0x18')]=![];}return cmHopper[_0x6160('0x16')](_0x9a3779)[_0x6160('0xa')](loggerCatch(_0x6160('0x19')));};exports[_0x6160('0x1a')]=function(_0x46a279){return cmHopper[_0x6160('0x1a')](_0x46a279)[_0x6160('0xa')](loggerCatch('[countReScheduled]\x20'));};exports[_0x6160('0x1b')]=function(_0x207904){return cmHopper['unlockContact']({'UserId':null},_0x207904,0x1)[_0x6160('0xa')](loggerCatch('[unlockContact]\x20'));};exports[_0x6160('0x1c')]=function(_0x128289){return cmHopper[_0x6160('0x1b')]({'active':![]},_0x128289,0x1)[_0x6160('0xa')](loggerCatch(_0x6160('0x1d')));};exports[_0x6160('0x1e')]=function(_0x35dda3){var _0x56a5bc={};_0x56a5bc['type']=_0x35dda3[_0x6160('0x1f')];_0x56a5bc[_0x6160('0x20')]=_0x35dda3['uniqueid'];_0x56a5bc[_0x6160('0x21')]=_0x35dda3['calleridnum'];_0x56a5bc[_0x6160('0x22')]=_0x35dda3[_0x6160('0x22')];_0x56a5bc[_0x6160('0x23')]=_0x35dda3[_0x6160('0x23')];_0x56a5bc[_0x6160('0x24')]=_0x35dda3[_0x6160('0x25')];_0x56a5bc[_0x6160('0x26')]=_0x35dda3['answertime'];_0x56a5bc['queuecallercomplete']=0x1;_0x56a5bc[_0x6160('0x27')]=_0x35dda3[_0x6160('0x28')];_0x56a5bc[_0x6160('0x29')]=_0x35dda3[_0x6160('0x2a')];_0x56a5bc[_0x6160('0x2b')]='from-sip';_0x56a5bc[_0x6160('0x2c')]=_0x6160('0x2d');_0x56a5bc['holdtime']=0x0;_0x56a5bc[_0x6160('0x2e')]=0x1;_0x56a5bc['lastAssignedTo']=_0x35dda3[_0x6160('0x2a')];_0x56a5bc[_0x6160('0x2f')]=_0x6160('0x30');return BPromise[_0x6160('0xc')]()[_0x6160('0xd')](voiceQueueReport[_0x6160('0x31')](_0x56a5bc))[_0x6160('0xa')](loggerCatch(_0x6160('0x32')));};exports[_0x6160('0x33')]=function(_0x352377,_0x43f4e7){return BPromise['resolve']()[_0x6160('0xd')](cmHopper['getContactRecallMe'](_0x352377,_0x43f4e7))[_0x6160('0xa')](loggerCatch(_0x6160('0x34')));};exports[_0x6160('0x35')]=function(_0x27b831){return cmHopper[_0x6160('0x16')](_0x27b831,!![],!![])[_0x6160('0xa')](loggerCatch(_0x6160('0x36')));}; \ No newline at end of file +var _0x685f=['endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','[getContactPreview]\x20','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x685f,0x11e));var _0xf685=function(_0x38ab71,_0x3d278b){_0x38ab71=_0x38ab71-0x0;var _0x27e45a=_0x685f[_0x38ab71];return _0x27e45a;};'use strict';var util=require(_0xf685('0x0'));var BPromise=require(_0xf685('0x1'));var logger=require('../../../config/logger')(_0xf685('0x2'));var cmHopper=require(_0xf685('0x3'));var cmHopperHistory=require(_0xf685('0x4'));var cmHopperBlack=require(_0xf685('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xf685('0x6'));function loggerCatch(_0x5efc56){return function(_0x328ece){logger[_0xf685('0x7')](_0x5efc56,util[_0xf685('0x8')](_0x328ece,{'showHidden':![],'depth':null}));};}function create(_0x47e68f){return cmHopperHistory[_0xf685('0x9')](_0x47e68f)[_0xf685('0xa')](loggerCatch(_0xf685('0xb')));}function createAgent(_0x2b3821){return BPromise['resolve']()[_0xf685('0xc')](agentReportPreview[_0xf685('0x9')](_0x2b3821))[_0xf685('0xa')](loggerCatch(_0xf685('0xb')));}function moveContact(_0x279c3a){return cmHopper[_0xf685('0xd')](_0x279c3a,!![])[_0xf685('0xa')](loggerCatch(_0xf685('0xe')));}exports[_0xf685('0xf')]=function(_0x4ec126){return cmHopperBlack[_0xf685('0xf')](_0x4ec126)[_0xf685('0xa')](loggerCatch(_0xf685('0x10')));};exports[_0xf685('0x11')]=function(_0x4aef53){return BPromise[_0xf685('0x12')]()['then'](cmHopper[_0xf685('0x11')](_0x4aef53))['catch'](loggerCatch(_0xf685('0x13')));};exports[_0xf685('0x9')]=function(_0x4d26b3,_0x5f3b59){create(_0x4d26b3)[_0xf685('0xa')](loggerCatch(_0x5f3b59));moveContact(_0x4d26b3)[_0xf685('0xa')](loggerCatch(_0x5f3b59));};exports['createAgentHistory']=function(_0x32aa1f,_0x698b25){createAgent(_0x32aa1f)['catch'](loggerCatch(_0x698b25));};exports['createCustomerHistory']=function(_0x184e71,_0x29f091){create(_0x184e71)[_0xf685('0xa')](loggerCatch(_0x29f091));};exports['createCustomerFinal']=function(_0x2c5e74,_0x265838){moveContact(_0x2c5e74)[_0xf685('0xa')](loggerCatch(_0x265838));};exports[_0xf685('0x14')]=function(_0x3eac54,_0x525074,_0x186026){if(_0x525074){_0x3eac54[_0xf685('0x15')]=null;}if(_0x186026){_0x3eac54[_0xf685('0x16')]=![];}return cmHopper['rescheduleContact'](_0x3eac54)[_0xf685('0xa')](loggerCatch(_0xf685('0x17')));};exports[_0xf685('0x18')]=function(_0x109b63){return cmHopper[_0xf685('0x18')](_0x109b63)['catch'](loggerCatch(_0xf685('0x19')));};exports['unlockContact']=function(_0x1b03c4){return cmHopper[_0xf685('0x1a')]({'UserId':null},_0x1b03c4,0x1)[_0xf685('0xa')](loggerCatch(_0xf685('0x1b')));};exports[_0xf685('0x1c')]=function(_0x2dd709){return cmHopper[_0xf685('0x1a')]({'active':![]},_0x2dd709,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x1324a7){var _0x275edb={};_0x275edb[_0xf685('0x1d')]=_0x1324a7[_0xf685('0x1d')];_0x275edb[_0xf685('0x1e')]=_0x1324a7[_0xf685('0x1e')];_0x275edb[_0xf685('0x1f')]=_0x1324a7['calleridnum'];_0x275edb['calleridname']=_0x1324a7[_0xf685('0x20')];_0x275edb['queue']=_0x1324a7[_0xf685('0x21')];_0x275edb[_0xf685('0x22')]=_0x1324a7['answertime'];_0x275edb['queuecallerleaveAt']=_0x1324a7[_0xf685('0x23')];_0x275edb[_0xf685('0x24')]=0x1;_0x275edb[_0xf685('0x25')]=_0x1324a7[_0xf685('0x26')];_0x275edb[_0xf685('0x27')]=_0x1324a7[_0xf685('0x28')];_0x275edb[_0xf685('0x29')]='from-sip';_0x275edb[_0xf685('0x2a')]=_0xf685('0x2b');_0x275edb[_0xf685('0x2c')]=0x0;_0x275edb[_0xf685('0x2d')]=0x1;_0x275edb[_0xf685('0x2e')]=_0x1324a7[_0xf685('0x28')];_0x275edb[_0xf685('0x2f')]=_0xf685('0x30');return BPromise['resolve']()[_0xf685('0xc')](voiceQueueReport['create'](_0x275edb))[_0xf685('0xa')](loggerCatch(_0xf685('0x31')));};exports[_0xf685('0x32')]=function(_0x3c0305,_0x338623){return BPromise['resolve']()['then'](cmHopper[_0xf685('0x32')](_0x3c0305,_0x338623))['catch'](loggerCatch(_0xf685('0x33')));};exports[_0xf685('0x34')]=function(_0x4ea8d0){return cmHopper[_0xf685('0x14')](_0x4ea8d0,!![],!![])['catch'](loggerCatch(_0xf685('0x35')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 38d02d2..6dd34fb 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 _0xe229=['scheduledat','ContactId','ListId','decrementTalkink','pTalking','IsNotLoggedIn','lastevent','queue','interface','motionChannel','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','active','countglobal','callback','callbackat','recallme','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','random','extractCalleridName','match','noanswer','variables','keys','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','inspect','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','ringtime','logLookAgent','UserId','logCustomer','talktime','getSeconds','answertime','isFailure','variablesAction','originate','channelAgent','timeout','uniqueid','countbusyretry','countnoanswerretry','countagentrejectretry','cloneAction','scheduledAt'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0xe229,0x1ba));var _0x9e22=function(_0xc0cdd2,_0x4809e1){_0xc0cdd2=_0xc0cdd2-0x0;var _0x2c82af=_0xe229[_0xc0cdd2];return _0x2c82af;};'use strict';var util=require(_0x9e22('0x0'));var _=require(_0x9e22('0x1'));var moment=require(_0x9e22('0x2'));var logger=require(_0x9e22('0x3'))('preview');var ipAgi=process[_0x9e22('0x4')][_0x9e22('0x5')]||_0x9e22('0x6');var utils=require(_0x9e22('0x7'));exports['loggerCatch']=function(_0x1b973c){return function(_0x3d6e67){logger[_0x9e22('0x8')](_0x1b973c,util[_0x9e22('0x9')](_0x3d6e67,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1b74c7,_0x587e5e){logger['info'](_0x1b74c7,util[_0x9e22('0x9')](_0x587e5e,{'showHidden':![],'depth':null}));};exports[_0x9e22('0xa')]=function(_0x811866,_0x414ef8){logger['error'](_0x811866,util[_0x9e22('0x9')](_0x414ef8,{'showHidden':![],'depth':null}));};exports[_0x9e22('0xb')]=function(_0x3c4b90){return function(_0x5a7943){logger['info'](_0x3c4b90,util[_0x9e22('0x9')](_0x5a7943,{'showHidden':![],'depth':null}));};};exports[_0x9e22('0xc')]=function(_0x399dbb,_0x50b247,_0x3b16c2){return{'message':_0x399dbb,'unlock':_0x50b247,'active':_0x3b16c2};};exports['getCallerId']=function(_0x149927,_0x492db4,_0x587e1c){if(!_[_0x9e22('0xd')](_0x587e1c)&&_0x9e22('0xe')===typeof _0x587e1c&&!_[_0x9e22('0xf')](_0x587e1c)){if(!_[_0x9e22('0xd')](_0x492db4)&&'string'===typeof _0x492db4&&!_[_0x9e22('0xf')](_0x492db4)){return util[_0x9e22('0x10')](_0x9e22('0x11'),_0x492db4,_0x587e1c);}return util[_0x9e22('0x10')](_0x9e22('0x11'),_0x587e1c,_0x587e1c);}if(!_[_0x9e22('0xd')](_0x149927)&&_0x9e22('0xe')===typeof _0x149927&&!_[_0x9e22('0xf')](_0x149927)){return _0x149927;}return _0x9e22('0x12');};exports[_0x9e22('0x13')]=function(_0x5ffa34){if(_[_0x9e22('0x14')](_0x5ffa34)){return![];}return _0x5ffa34;};exports[_0x9e22('0x15')]=function(_0x2e837b,_0x1b0d59,_0x588603,_0x542369,_0x96b742,_0x4a577d){var _0x2f63d0={'XMD-QUEUE':_0x1b0d59[_0x9e22('0x16')]?_0x1b0d59[_0x9e22('0x16')][_0x9e22('0x17')]:'','XMD-CALLERID':_0x542369,'XMD-CALLERID-PREVIEW':_0x4a577d?util[_0x9e22('0x10')](_0x9e22('0x11'),_0x4a577d[_0x9e22('0x18')],_0x4a577d[_0x9e22('0x19')]):_0x542369,'XMD-DIALID':_0x96b742,'XMD-CONTACTID':_0x1b0d59['ContactId'],'XMD-CDRTYPE':_0x9e22('0x1a'),'CALLERID(all)':_0x542369,'XMD-VOICEQUEUEID':_0x1b0d59[_0x9e22('0x1b')],'XMD-DIALCHANNEL':_0x588603,'XMD-DIALTIMEOUT':_0x2e837b['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0x9e22('0x1c'),_0x2e837b[_0x9e22('0x1d')]?'g':'',_[_0x9e22('0xf')](_0x2e837b[_0x9e22('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x2e837b[_0x9e22('0x1f')]||'','XMD-AGI':_0x2e837b[_0x9e22('0x20')]?util[_0x9e22('0x10')](_0x9e22('0x21'),ipAgi,_0x2e837b[_0x9e22('0x20')]):_0x9e22('0x22'),'XMD-AGIAFTER':_0x2e837b['dialQueueProject2']?util[_0x9e22('0x10')](_0x9e22('0x21'),ipAgi,_0x2e837b['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4a577d?_0x4a577d['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x4a577d?_0x4a577d[_0x9e22('0x23')]:'','XMD-DESTINATION':_0x9e22('0x24'),'SIPADDHEADER':_0x9e22('0x25')};if(!_[_0x9e22('0xf')](_0x2e837b['monitor_format'])){_0x2f63d0[util[_0x9e22('0x10')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x2e837b[_0x9e22('0x1e')];_0x2f63d0[util[_0x9e22('0x10')]('%s',_0x9e22('0x26'))]=_0x96b742;}return _0x2f63d0;};exports['toLowerVariables']=function(_0x377ee8){var _0x5b1acc={};for(var _0x3d16cd in _0x377ee8){if(_0x377ee8['hasOwnProperty'](_0x3d16cd)){_0x5b1acc[util[_0x9e22('0x10')]('%s',_[_0x9e22('0x27')](_0x3d16cd))]=_0x377ee8[_0x3d16cd];}}return{'variables':_0x5b1acc};};exports[_0x9e22('0x28')]=function(_0x1c1ea4,_0x3745e8){if(!_[_0x9e22('0x14')](_0x1c1ea4)){if(_0x1c1ea4['hasOwnProperty'](_0x9e22('0x29'))){if(_0x1c1ea4[_0x9e22('0x29')]>0x0){_0x1c1ea4[_0x9e22('0x29')]-=0x1;}else{logger[_0x9e22('0x8')](_0x9e22('0x2a'),_0x3745e8);}}}else{logger[_0x9e22('0x8')](_0x9e22('0x2b'),_0x3745e8);}};exports[_0x9e22('0x2c')]=function(_0x8f46d3){var _0x1ce6a1=moment()[_0x9e22('0x10')](_0x9e22('0x2d'));_0x8f46d3[_0x9e22('0x2e')]=0xd;_0x8f46d3[_0x9e22('0x2f')]=_0x9e22('0x30');_0x8f46d3[_0x9e22('0x31')]=_0x1ce6a1;_0x8f46d3[_0x9e22('0x32')]=_0x1ce6a1;_0x8f46d3[_0x9e22('0x33')]=_0x1ce6a1;};exports['logAgent']=function(_0x59eb83,_0x3e741b,_0x14cab1){var _0x25646b=moment()['format'](_0x9e22('0x2d'));_0x59eb83[_0x9e22('0x2e')]=_0x3e741b;_0x59eb83[_0x9e22('0x2f')]=_0x14cab1;_0x59eb83[_0x9e22('0x32')]=_0x25646b;_0x59eb83[_0x9e22('0x34')]=utils['getSeconds'](_0x59eb83[_0x9e22('0x32')],_0x59eb83[_0x9e22('0x31')]);};exports[_0x9e22('0x35')]=function(_0x71bcc0,_0x3f4856,_0x41eb2d){_0x71bcc0['membername']=_0x3f4856;_0x71bcc0[_0x9e22('0x36')]=_0x41eb2d;};exports[_0x9e22('0x37')]=function(_0x5bcac4,_0x3e0e6d,_0x483d7c){var _0x2108ef=moment()['format'](_0x9e22('0x2d'));_0x5bcac4[_0x9e22('0x2e')]=_0x3e0e6d;_0x5bcac4[_0x9e22('0x2f')]=_0x483d7c;_0x5bcac4['responsetime']=_0x5bcac4[_0x9e22('0x32')]?_0x5bcac4[_0x9e22('0x32')]:_0x2108ef;_0x5bcac4[_0x9e22('0x33')]=_0x5bcac4[_0x9e22('0x33')]?_0x5bcac4['endtime']:_0x2108ef;_0x5bcac4[_0x9e22('0x34')]=utils['getSeconds'](_0x5bcac4['responsetime']||0x0,_0x5bcac4[_0x9e22('0x31')]||0x0);_0x5bcac4[_0x9e22('0x38')]=_0x5bcac4['answertime']?utils[_0x9e22('0x39')](_0x5bcac4[_0x9e22('0x33')],_0x5bcac4[_0x9e22('0x3a')]):0x0;};exports[_0x9e22('0x3b')]=function(_0x463323){return _0x463323==='Failure';};exports[_0x9e22('0x3c')]=function(_0xc3bcc6,_0x65d89a,_0x5286da,_0x21a9ab,_0x54adee){var _0x57a1e7=_0x21a9ab?'RECALL':_0xc3bcc6[_0x9e22('0x18')];_0x57a1e7=_0x54adee?'BOOKED':_0x57a1e7;return{'actionid':_0xc3bcc6['uniqueid'],'action':_0x9e22('0x3d'),'channel':_0xc3bcc6[_0x9e22('0x3e')],'callerid':util[_0x9e22('0x10')]('\x22%s\x22\x20<%s>',_0x57a1e7,_0xc3bcc6[_0x9e22('0x19')]),'Exten':_0x9e22('0x24'),'Context':'from-sip','Priority':'1','variable':_0x5286da,'timeout':(_0x65d89a[_0x9e22('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0xc3bcc6[_0x9e22('0x40')]};};exports['totalGlobal']=function(_0x507c12){return _0x507c12[_0x9e22('0x41')]+_0x507c12['countcongestionretry']+_0x507c12[_0x9e22('0x42')]+_0x507c12[_0x9e22('0x43')]+_0x507c12['countnosuchnumberretry'];};exports[_0x9e22('0x44')]=function(_0x40b984){var _0x3cbfb8=_['clone'](_0x40b984);_0x3cbfb8['state']=0xf;_0x3cbfb8[_0x9e22('0x2f')]='Global';return _0x3cbfb8;};exports[_0x9e22('0x45')]=function(_0x233b0f,_0x57f46f,_0x1532e9){var _0x43d38c={};_0x43d38c[_0x57f46f]=_0x233b0f[_0x57f46f];_0x43d38c['active']=![];_0x43d38c[_0x9e22('0x46')]=moment()['add'](_0x1532e9,'minutes')[_0x9e22('0x10')](_0x9e22('0x2d'));_0x43d38c[_0x9e22('0x47')]=_0x233b0f[_0x9e22('0x47')];_0x43d38c[_0x9e22('0x48')]=_0x233b0f[_0x9e22('0x48')];_0x43d38c[_0x9e22('0x1b')]=_0x233b0f[_0x9e22('0x1b')]||undefined;return _0x43d38c;};exports[_0x9e22('0x49')]=function(_0x197b05,_0x22beed){if(!_[_0x9e22('0x14')](_0x197b05)){if(_0x197b05[_0x9e22('0x4a')]>0x0){_0x197b05[_0x9e22('0x4a')]-=0x1;}else{logger[_0x9e22('0x8')](_0x22beed,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x9e22('0x8')](_0x22beed,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x9e22('0x4b')]=function(_0x1d0641){if(_0x1d0641<=0x0){return!![];}return![];};function buildObj(_0x1dff4f,_0x442236,_0x61643d){_0x1dff4f[_0x9e22('0x4c')]=_0x442236;_0x1dff4f['name']=_0x1dff4f[_0x9e22('0x4d')];_0x1dff4f[_0x9e22('0x4e')]=_0x1dff4f['channelAgent'];_0x1dff4f[_0x9e22('0x4f')]='voice';if(_0x61643d){_0x1dff4f['mandatoryDisposition']=_0x61643d[_0x9e22('0x50')];}return _0x1dff4f;}exports[_0x9e22('0x51')]=buildObj;exports[_0x9e22('0x52')]=function(_0x3c5fad){var _0x1b73a1={};_0x1b73a1[_0x9e22('0x4d')]=_0x3c5fad['queue'];_0x1b73a1['interface']=_0x3c5fad[_0x9e22('0x3e')];_0x1b73a1[_0x9e22('0x40')]=_0x3c5fad[_0x9e22('0x40')];return _0x1b73a1;};exports[_0x9e22('0x53')]=function(_0xe83845){var _0x1ab952=[];for(var _0xffa4f8 in _0xe83845){if(_0xe83845['hasOwnProperty'](_0xffa4f8)){if(!_['isNil'](_0xe83845[_0xffa4f8])&&_0xe83845[_0xffa4f8][_0x9e22('0x2e')]===_0x9e22('0x54')&&_0xe83845[_0xffa4f8][_0x9e22('0x55')]==='reachable'){_0x1ab952['push'](_0xe83845[_0xffa4f8]['id']);}}}return _0x1ab952;};exports[_0x9e22('0x56')]=function(_0x42a29e){var _0x10daf5=moment()['milliseconds'](0x0);var _0x18b25b=moment(_0x42a29e)[_0x9e22('0x57')](0x0);return _0x10daf5[_0x9e22('0x58')](_0x18b25b,_0x9e22('0x59'));};exports['createBody']=function(_0xd7c072){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xd7c072[_0x9e22('0x47')],'ListId':_0xd7c072[_0x9e22('0x48')],'VoiceQueueId':_0xd7c072[_0x9e22('0x1b')]||undefined,'CampaignId':_0xd7c072[_0x9e22('0x5a')]||undefined};};exports[_0x9e22('0x5b')]=function(_0x444f87){if(_0x444f87===_0x9e22('0x40')||_0x444f87===_0x9e22('0x5c')||_0x444f87===_0x9e22('0x4d')||_0x444f87==='type'||_0x444f87===_0x9e22('0x5d')||_0x444f87===_0x9e22('0x5e')||_0x444f87===_0x9e22('0x5f')||_0x444f87==='channelAgent'||_0x444f87==='calleridname'||_0x444f87===_0x9e22('0x60')||_0x444f87===_0x9e22('0x19')||_0x444f87==='scheduledat'||_0x444f87===_0x9e22('0x41')||_0x444f87==='countcongestionretry'||_0x444f87===_0x9e22('0x42')||_0x444f87===_0x9e22('0x61')||_0x444f87===_0x9e22('0x62')||_0x444f87==='callbackuniqueid'||_0x444f87===_0x9e22('0x63')||_0x444f87===_0x9e22('0x64')||_0x444f87===_0x9e22('0x47')||_0x444f87===_0x9e22('0x48')||_0x444f87===_0x9e22('0x36')||_0x444f87===_0x9e22('0x1b')||_0x444f87==='sipcallid'||_0x444f87===_0x9e22('0x65')||_0x444f87==='xmd-queue'||_0x444f87===_0x9e22('0x66')||_0x444f87===_0x9e22('0x67')||_0x444f87==='xmd-dialurl'||_0x444f87==='xmd-dialtimeout'||_0x444f87===_0x9e22('0x68')||_0x444f87===_0x9e22('0x69')||_0x444f87===_0x9e22('0x6a')||_0x444f87===_0x9e22('0x6b')||_0x444f87==='xmd-cdrtype'||_0x444f87==='xmd-callerid'||_0x444f87===_0x9e22('0x6c')||_0x444f87===_0x9e22('0x6d')||_0x444f87==='rtpaudioqos'||_0x444f87==='rtpaudioqosbridged'||_0x444f87===_0x9e22('0x6e')||_0x444f87===_0x9e22('0x6f')||_0x444f87===_0x9e22('0x70')||_0x444f87==='rtpaudioqoslossbridged'||_0x444f87===_0x9e22('0x71')||_0x444f87===_0x9e22('0x72')||_0x444f87==='rtpaudioqos'||_0x444f87===_0x9e22('0x73')||_0x444f87==='rtpaudioqosjitter'||_0x444f87==='rtpaudioqosjitterbridged'||_0x444f87===_0x9e22('0x70')||_0x444f87===_0x9e22('0x74')||_0x444f87==='rtpaudioqosrtt'||_0x444f87==='rtpaudioqosrttbridged'||_0x444f87===_0x9e22('0x75')||_0x444f87===_0x9e22('0x76')||_0x444f87===_0x9e22('0x2e')||_0x444f87===_0x9e22('0x2f')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x531e52,_0x5d1e95){var _0x2efd7e,_0x108537,_0x568d8e;if(_0x5d1e95<=0x0){_0x5d1e95=0x1;}_0x2efd7e=new RegExp(_0x9e22('0x77')+_0x5d1e95+'}$');_0x108537=Math[_0x9e22('0x78')](0xa,_0x5d1e95-0x1);_0x568d8e=Math[_0x9e22('0x78')](0xa,_0x5d1e95)-0x1;return util[_0x9e22('0x10')]('%s',_['replace'](_0x531e52,_0x2efd7e,_[_0x9e22('0x79')](_0x108537,_0x568d8e)));};exports[_0x9e22('0x7a')]=function(_0x1f1e73){var _0x102881=_0x1f1e73['match'](/"(.*?)"/);return _0x102881?_0x102881[0x1]:_0x1f1e73;};exports['extractCalleridNumber']=function(_0x3c62ae){var _0x36e31e=_0x3c62ae[_0x9e22('0x7b')](/<(.*?)>/);return _0x36e31e?_0x36e31e[0x1]:_0x3c62ae;};function buildNoAnswerEventPayload(_0x42090d,_0x51d890){var _0x293d3d=buildObj(_0x42090d,_0x9e22('0x7c'));if(!_['isEmpty'](_0x51d890[_0x9e22('0x7d')])){Object[_0x9e22('0x7e')](_0x51d890[_0x9e22('0x7d')])['forEach'](function(_0x525b25){_0x293d3d[_0x525b25['toLowerCase']()]=_0x51d890['variables'][_0x525b25];});}return _0x293d3d;}exports[_0x9e22('0x7f')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x89c0=['rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','variables','keys','forEach','toLowerCase','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isActive','addVariables','Queue','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','updateOriginated','isNil','hasOwnProperty','originated','error','logBlacklist','state','starttime','responsetime','endtime','logAgent','statedesc','ringtime','getSeconds','logLookAgent','logCustomer','YYYY-MM-DD\x20HH:mm:ss','talktime','answertime','Failure','variablesAction','RECALL','calleridname','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','scheduledAt','active','scheduledat','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','name','interface','motionChannel','voice','buildAcw','queue','agentReadyId','not_inuse','reachable','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','type','campaigntype','membername','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged'];(function(_0x7d4488,_0x3765ad){var _0x33daa3=function(_0x2fc69e){while(--_0x2fc69e){_0x7d4488['push'](_0x7d4488['shift']());}};_0x33daa3(++_0x3765ad);}(_0x89c0,0x9b));var _0x089c=function(_0x46b98a,_0x242cd9){_0x46b98a=_0x46b98a-0x0;var _0x343312=_0x89c0[_0x46b98a];return _0x343312;};'use strict';var util=require(_0x089c('0x0'));var _=require(_0x089c('0x1'));var moment=require(_0x089c('0x2'));var logger=require(_0x089c('0x3'))(_0x089c('0x4'));var ipAgi=process[_0x089c('0x5')][_0x089c('0x6')]||_0x089c('0x7');var utils=require('../../dialer/utils');exports[_0x089c('0x8')]=function(_0x1b158b){return function(_0x3ff787){logger['error'](_0x1b158b,util[_0x089c('0x9')](_0x3ff787,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2b701f,_0x399572){logger[_0x089c('0xa')](_0x2b701f,util[_0x089c('0x9')](_0x399572,{'showHidden':![],'depth':null}));};exports[_0x089c('0xb')]=function(_0x10c268,_0x1a4823){logger['error'](_0x10c268,util[_0x089c('0x9')](_0x1a4823,{'showHidden':![],'depth':null}));};exports[_0x089c('0xc')]=function(_0x196737){return function(_0x6a3929){logger['info'](_0x196737,util[_0x089c('0x9')](_0x6a3929,{'showHidden':![],'depth':null}));};};exports[_0x089c('0xd')]=function(_0x50e200,_0x2c150a,_0x43e8ed){return{'message':_0x50e200,'unlock':_0x2c150a,'active':_0x43e8ed};};exports[_0x089c('0xe')]=function(_0x2f6731,_0x226423,_0x5c83bd){if(!_[_0x089c('0xf')](_0x5c83bd)&&'string'===typeof _0x5c83bd&&!_[_0x089c('0x10')](_0x5c83bd)){if(!_[_0x089c('0xf')](_0x226423)&&'string'===typeof _0x226423&&!_[_0x089c('0x10')](_0x226423)){return util[_0x089c('0x11')](_0x089c('0x12'),_0x226423,_0x5c83bd);}return util[_0x089c('0x11')](_0x089c('0x12'),_0x5c83bd,_0x5c83bd);}if(!_['isUndefined'](_0x2f6731)&&_0x089c('0x13')===typeof _0x2f6731&&!_[_0x089c('0x10')](_0x2f6731)){return _0x2f6731;}return _0x089c('0x14');};exports[_0x089c('0x15')]=function(_0x2ac667){if(_['isNil'](_0x2ac667)){return![];}return _0x2ac667;};exports[_0x089c('0x16')]=function(_0x4fc215,_0x26a98a,_0x59d5f2,_0x3b25ce,_0x122d19,_0x16057){var _0x156524={'XMD-QUEUE':_0x26a98a[_0x089c('0x17')]?_0x26a98a[_0x089c('0x17')]['name']:'','XMD-CALLERID':_0x3b25ce,'XMD-CALLERID-PREVIEW':_0x16057?util[_0x089c('0x11')]('\x22%s\x22\x20<%s>',_0x16057['calleridname'],_0x16057[_0x089c('0x18')]):_0x3b25ce,'XMD-DIALID':_0x122d19,'XMD-CONTACTID':_0x26a98a[_0x089c('0x19')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3b25ce,'XMD-VOICEQUEUEID':_0x26a98a[_0x089c('0x1a')],'XMD-DIALCHANNEL':_0x59d5f2,'XMD-DIALTIMEOUT':_0x4fc215[_0x089c('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x089c('0x11')](_0x089c('0x1c'),_0x4fc215[_0x089c('0x1d')]?'g':'',_[_0x089c('0x10')](_0x4fc215[_0x089c('0x1e')])?'':_0x089c('0x1f')),'XMD-DIALURL':_0x4fc215[_0x089c('0x20')]||'','XMD-AGI':_0x4fc215['dialQueueProject']?util[_0x089c('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4fc215['dialQueueProject']):_0x089c('0x21'),'XMD-AGIAFTER':_0x4fc215[_0x089c('0x1d')]?util[_0x089c('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4fc215[_0x089c('0x1d')]):_0x089c('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x16057?_0x16057[_0x089c('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x16057?_0x16057['originatecalleridname']:'','XMD-DESTINATION':_0x089c('0x23'),'SIPADDHEADER':_0x089c('0x24')};if(!_[_0x089c('0x10')](_0x4fc215[_0x089c('0x1e')])){_0x156524[util[_0x089c('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x4fc215[_0x089c('0x1e')];_0x156524[util[_0x089c('0x11')]('%s',_0x089c('0x25'))]=_0x122d19;}return _0x156524;};exports['toLowerVariables']=function(_0x49a4bb){var _0x1959ee={};for(var _0x3166ae in _0x49a4bb){if(_0x49a4bb['hasOwnProperty'](_0x3166ae)){_0x1959ee[util[_0x089c('0x11')]('%s',_['toLower'](_0x3166ae))]=_0x49a4bb[_0x3166ae];}}return{'variables':_0x1959ee};};exports[_0x089c('0x26')]=function(_0x369bbc,_0x350a4a){if(!_[_0x089c('0x27')](_0x369bbc)){if(_0x369bbc[_0x089c('0x28')](_0x089c('0x29'))){if(_0x369bbc['originated']>0x0){_0x369bbc[_0x089c('0x29')]-=0x1;}else{logger[_0x089c('0x2a')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x350a4a);}}}else{logger[_0x089c('0x2a')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x350a4a);}};exports[_0x089c('0x2b')]=function(_0x172905){var _0xc1d9ed=moment()[_0x089c('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x172905[_0x089c('0x2c')]=0xd;_0x172905['statedesc']='Blacklist';_0x172905[_0x089c('0x2d')]=_0xc1d9ed;_0x172905[_0x089c('0x2e')]=_0xc1d9ed;_0x172905[_0x089c('0x2f')]=_0xc1d9ed;};exports[_0x089c('0x30')]=function(_0x4c33ef,_0x3c415d,_0x468abc){var _0x25b04b=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4c33ef[_0x089c('0x2c')]=_0x3c415d;_0x4c33ef[_0x089c('0x31')]=_0x468abc;_0x4c33ef['responsetime']=_0x25b04b;_0x4c33ef[_0x089c('0x32')]=utils[_0x089c('0x33')](_0x4c33ef['responsetime'],_0x4c33ef[_0x089c('0x2d')]);};exports[_0x089c('0x34')]=function(_0x51d15f,_0x32b0be,_0xd21fa3){_0x51d15f['membername']=_0x32b0be;_0x51d15f['UserId']=_0xd21fa3;};exports[_0x089c('0x35')]=function(_0x13e39a,_0x163ae7,_0x542b18){var _0x48ae27=moment()[_0x089c('0x11')](_0x089c('0x36'));_0x13e39a[_0x089c('0x2c')]=_0x163ae7;_0x13e39a[_0x089c('0x31')]=_0x542b18;_0x13e39a[_0x089c('0x2e')]=_0x13e39a[_0x089c('0x2e')]?_0x13e39a[_0x089c('0x2e')]:_0x48ae27;_0x13e39a[_0x089c('0x2f')]=_0x13e39a[_0x089c('0x2f')]?_0x13e39a['endtime']:_0x48ae27;_0x13e39a['ringtime']=utils[_0x089c('0x33')](_0x13e39a[_0x089c('0x2e')]||0x0,_0x13e39a[_0x089c('0x2d')]||0x0);_0x13e39a[_0x089c('0x37')]=_0x13e39a[_0x089c('0x38')]?utils[_0x089c('0x33')](_0x13e39a[_0x089c('0x2f')],_0x13e39a[_0x089c('0x38')]):0x0;};exports['isFailure']=function(_0x32de6a){return _0x32de6a===_0x089c('0x39');};exports[_0x089c('0x3a')]=function(_0x1be1b9,_0x2268ca,_0x22c134,_0x3cfdbf,_0x5cb487){var _0x597e7b=_0x3cfdbf?_0x089c('0x3b'):_0x1be1b9[_0x089c('0x3c')];_0x597e7b=_0x5cb487?_0x089c('0x3d'):_0x597e7b;return{'actionid':_0x1be1b9['uniqueid'],'action':_0x089c('0x3e'),'channel':_0x1be1b9[_0x089c('0x3f')],'callerid':util['format'](_0x089c('0x12'),_0x597e7b,_0x1be1b9['calleridnum']),'Exten':_0x089c('0x23'),'Context':_0x089c('0x40'),'Priority':'1','variable':_0x22c134,'timeout':(_0x2268ca[_0x089c('0x41')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1be1b9[_0x089c('0x42')]};};exports[_0x089c('0x43')]=function(_0x354661){return _0x354661['countbusyretry']+_0x354661[_0x089c('0x44')]+_0x354661['countnoanswerretry']+_0x354661[_0x089c('0x45')]+_0x354661[_0x089c('0x46')];};exports[_0x089c('0x47')]=function(_0x4f6af0){var _0x96cc2e=_['clone'](_0x4f6af0);_0x96cc2e['state']=0xf;_0x96cc2e['statedesc']='Global';return _0x96cc2e;};exports[_0x089c('0x48')]=function(_0x101788,_0x25c2c6,_0x59695e){var _0x16a219={};_0x16a219[_0x25c2c6]=_0x101788[_0x25c2c6];_0x16a219[_0x089c('0x49')]=![];_0x16a219[_0x089c('0x4a')]=moment()['add'](_0x59695e,'minutes')[_0x089c('0x11')](_0x089c('0x36'));_0x16a219[_0x089c('0x19')]=_0x101788[_0x089c('0x19')];_0x16a219[_0x089c('0x4b')]=_0x101788[_0x089c('0x4b')];_0x16a219[_0x089c('0x1a')]=_0x101788[_0x089c('0x1a')]||undefined;return _0x16a219;};exports[_0x089c('0x4c')]=function(_0x47bb7c,_0x5b7ba7){if(!_[_0x089c('0x27')](_0x47bb7c)){if(_0x47bb7c[_0x089c('0x4d')]>0x0){_0x47bb7c['pTalking']-=0x1;}else{logger[_0x089c('0x2a')](_0x5b7ba7,_0x089c('0x4e'));}}else{logger[_0x089c('0x2a')](_0x5b7ba7,_0x089c('0x4f'));}};exports['IsNotLoggedIn']=function(_0x3e7e12){if(_0x3e7e12<=0x0){return!![];}return![];};function buildObj(_0x48e146,_0x51c22f,_0x1d463f){_0x48e146[_0x089c('0x50')]=_0x51c22f;_0x48e146[_0x089c('0x51')]=_0x48e146['queue'];_0x48e146[_0x089c('0x52')]=_0x48e146[_0x089c('0x3f')];_0x48e146[_0x089c('0x53')]=_0x089c('0x54');if(_0x1d463f){_0x48e146['mandatoryDisposition']=_0x1d463f['mandatoryDisposition'];}return _0x48e146;}exports['buildObj']=buildObj;exports[_0x089c('0x55')]=function(_0x2f7af1){var _0x24fbb8={};_0x24fbb8[_0x089c('0x56')]=_0x2f7af1[_0x089c('0x56')];_0x24fbb8[_0x089c('0x52')]=_0x2f7af1[_0x089c('0x3f')];_0x24fbb8[_0x089c('0x42')]=_0x2f7af1['uniqueid'];return _0x24fbb8;};exports[_0x089c('0x57')]=function(_0x3f52d9){var _0x238229=[];for(var _0x4fcffc in _0x3f52d9){if(_0x3f52d9[_0x089c('0x28')](_0x4fcffc)){if(!_[_0x089c('0x27')](_0x3f52d9[_0x4fcffc])&&_0x3f52d9[_0x4fcffc]['state']===_0x089c('0x58')&&_0x3f52d9[_0x4fcffc]['status']===_0x089c('0x59')){_0x238229['push'](_0x3f52d9[_0x4fcffc]['id']);}}}return _0x238229;};exports[_0x089c('0x5a')]=function(_0x557f7a){var _0x155f78=moment()[_0x089c('0x5b')](0x0);var _0x2fff2c=moment(_0x557f7a)['milliseconds'](0x0);return _0x155f78[_0x089c('0x5c')](_0x2fff2c,_0x089c('0x5d'));};exports[_0x089c('0x5e')]=function(_0x3934a4){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3934a4[_0x089c('0x19')],'ListId':_0x3934a4['ListId'],'VoiceQueueId':_0x3934a4[_0x089c('0x1a')]||undefined,'CampaignId':_0x3934a4[_0x089c('0x5f')]||undefined};};exports[_0x089c('0x60')]=function(_0x3eba49){if(_0x3eba49==='uniqueid'||_0x3eba49==='idContact'||_0x3eba49===_0x089c('0x56')||_0x3eba49===_0x089c('0x61')||_0x3eba49===_0x089c('0x62')||_0x3eba49==='dialAnswer'||_0x3eba49===_0x089c('0x63')||_0x3eba49===_0x089c('0x3f')||_0x3eba49==='calleridname'||_0x3eba49===_0x089c('0x49')||_0x3eba49===_0x089c('0x18')||_0x3eba49===_0x089c('0x4a')||_0x3eba49==='countbusyretry'||_0x3eba49==='countcongestionretry'||_0x3eba49===_0x089c('0x64')||_0x3eba49===_0x089c('0x65')||_0x3eba49===_0x089c('0x66')||_0x3eba49===_0x089c('0x67')||_0x3eba49===_0x089c('0x68')||_0x3eba49==='recallme'||_0x3eba49===_0x089c('0x19')||_0x3eba49===_0x089c('0x4b')||_0x3eba49==='UserId'||_0x3eba49==='VoiceQueueId'||_0x3eba49===_0x089c('0x69')||_0x3eba49===_0x089c('0x6a')||_0x3eba49==='xmd-queue'||_0x3eba49===_0x089c('0x6b')||_0x3eba49===_0x089c('0x6c')||_0x3eba49==='xmd-dialurl'||_0x3eba49==='xmd-dialtimeout'||_0x3eba49===_0x089c('0x6d')||_0x3eba49===_0x089c('0x6e')||_0x3eba49==='xmd-dialchannel'||_0x3eba49===_0x089c('0x6f')||_0x3eba49===_0x089c('0x70')||_0x3eba49===_0x089c('0x71')||_0x3eba49===_0x089c('0x72')||_0x3eba49===_0x089c('0x73')||_0x3eba49===_0x089c('0x74')||_0x3eba49==='rtpaudioqosbridged'||_0x3eba49===_0x089c('0x75')||_0x3eba49===_0x089c('0x76')||_0x3eba49==='rtpaudioqosloss'||_0x3eba49===_0x089c('0x77')||_0x3eba49===_0x089c('0x78')||_0x3eba49===_0x089c('0x79')||_0x3eba49===_0x089c('0x74')||_0x3eba49===_0x089c('0x7a')||_0x3eba49===_0x089c('0x75')||_0x3eba49==='rtpaudioqosjitterbridged'||_0x3eba49===_0x089c('0x7b')||_0x3eba49===_0x089c('0x77')||_0x3eba49===_0x089c('0x78')||_0x3eba49===_0x089c('0x79')||_0x3eba49===_0x089c('0x7c')||_0x3eba49===_0x089c('0x7d')||_0x3eba49===_0x089c('0x2c')||_0x3eba49===_0x089c('0x31')){return![];}return!![];};exports[_0x089c('0x7e')]=function(_0x11d3c3,_0x5b89c4){var _0x119312,_0x3deb3c,_0x4a9ff0;if(_0x5b89c4<=0x0){_0x5b89c4=0x1;}_0x119312=new RegExp(_0x089c('0x7f')+_0x5b89c4+'}$');_0x3deb3c=Math[_0x089c('0x80')](0xa,_0x5b89c4-0x1);_0x4a9ff0=Math['pow'](0xa,_0x5b89c4)-0x1;return util[_0x089c('0x11')]('%s',_[_0x089c('0x81')](_0x11d3c3,_0x119312,_[_0x089c('0x82')](_0x3deb3c,_0x4a9ff0)));};exports[_0x089c('0x83')]=function(_0x594c1b){var _0x151a62=_0x594c1b['match'](/"(.*?)"/);return _0x151a62?_0x151a62[0x1]:_0x594c1b;};exports[_0x089c('0x84')]=function(_0x2a1c2c){var _0x157bf6=_0x2a1c2c['match'](/<(.*?)>/);return _0x157bf6?_0x157bf6[0x1]:_0x2a1c2c;};function buildNoAnswerEventPayload(_0x3a1155,_0x5b9654){var _0x4668d0=buildObj(_0x3a1155,'noanswer');if(!_[_0x089c('0x10')](_0x5b9654[_0x089c('0x85')])){Object[_0x089c('0x86')](_0x5b9654['variables'])[_0x089c('0x87')](function(_0xf2ee3e){_0x4668d0[_0xf2ee3e[_0x089c('0x88')]()]=_0x5b9654[_0x089c('0x85')][_0xf2ee3e];});}return _0x4668d0;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 2bb4f84..8edae88 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 _0x9dff=['queueremove','queuepause','reload','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x5ecff9,_0x473070){var _0x5e1415=function(_0x3c34a1){while(--_0x3c34a1){_0x5ecff9['push'](_0x5ecff9['shift']());}};_0x5e1415(++_0x473070);}(_0x9dff,0x1d4));var _0xf9df=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x9dff[_0x51020b];return _0x371e47;};'use strict';exports[_0xf9df('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xf9df('0x1'),'required':!![]},'penalty':{'type':_0xf9df('0x2'),'required':![]},'paused':{'type':_0xf9df('0x3'),'required':![]}};exports[_0xf9df('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xf9df('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xf9df('0x3')},'reason':{'type':_0xf9df('0x1'),'required':![]}};exports[_0xf9df('0x6')]={'module':{'type':_0xf9df('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xf9df('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xf9df('0x1'),'required':!![]},'filename':{'type':_0xf9df('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf9df('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xf9df('0x1'),'required':!![]}};exports[_0xf9df('0x7')]={'uniqueid':{'type':_0xf9df('0x1'),'required':!![]},'exten':{'type':_0xf9df('0x1'),'required':!![]},'context':{'type':_0xf9df('0x1')}}; \ No newline at end of file +var _0x3eb7=['number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string'];(function(_0x14710e,_0x2b9460){var _0x128ce0=function(_0x183c96){while(--_0x183c96){_0x14710e['push'](_0x14710e['shift']());}};_0x128ce0(++_0x2b9460);}(_0x3eb7,0x10c));var _0x73eb=function(_0x157202,_0x21b30f){_0x157202=_0x157202-0x0;var _0x572370=_0x3eb7[_0x157202];return _0x572370;};'use strict';exports[_0x73eb('0x0')]={'queue':{'type':_0x73eb('0x1'),'required':!![]},'interface':{'type':_0x73eb('0x1'),'required':!![]},'membername':{'type':_0x73eb('0x1'),'required':!![]},'penalty':{'type':_0x73eb('0x2'),'required':![]},'paused':{'type':_0x73eb('0x3'),'required':![]}};exports[_0x73eb('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x73eb('0x1'),'required':!![]}};exports[_0x73eb('0x5')]={'interface':{'type':_0x73eb('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x73eb('0x1'),'required':![]}};exports[_0x73eb('0x6')]={'module':{'type':'string','required':![]}};exports[_0x73eb('0x7')]={'uniqueid':{'type':_0x73eb('0x1'),'required':!![]}};exports[_0x73eb('0x8')]={'uniqueid':{'type':_0x73eb('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0x73eb('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0x73eb('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x73eb('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 37d3c9b..e4aa6cb 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 _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x7dd239,_0x21726f){var _0x445a7c=function(_0x28c884){while(--_0x28c884){_0x7dd239['push'](_0x7dd239['shift']());}};_0x445a7c(++_0x21726f);}(_0xadb5,0xad));var _0x5adb=function(_0x4bc40,_0x483bc8){_0x4bc40=_0x4bc40-0x0;var _0x4cb6d1=_0xadb5[_0x4bc40];return _0x4cb6d1;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x4bab89,_0x2af6d0){var _0x16f339=function(_0xb61432){while(--_0xb61432){_0x4bab89['push'](_0x4bab89['shift']());}};_0x16f339(++_0x2af6d0);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fa97c,_0x4aa6ab){_0x4fa97c=_0x4fa97c-0x0;var _0x518c7f=_0xb10b[_0x4fa97c];return _0x518c7f;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 158676d..eb44877 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 _0x8ff8=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x49a54d,_0x3ebc95){var _0x1cce16=function(_0x31a82c){while(--_0x31a82c){_0x49a54d['push'](_0x49a54d['shift']());}};_0x1cce16(++_0x3ebc95);}(_0x8ff8,0xd5));var _0x88ff=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ff8[_0x321bb2];return _0x9c12ed;};'use strict';function mergeDBDataToRealtime(_0x378f38,_0x38d48a){var _0x1139b1=Object[_0x88ff('0x0')]({},_0x378f38);for(var _0x41c5cb in _0x38d48a){if(_0x1139b1[_0x88ff('0x1')](_0x41c5cb)){_0x1139b1[_0x41c5cb]=_0x38d48a[_0x41c5cb];}}return _0x1139b1;}exports[_0x88ff('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x3b04=['assign','hasOwnProperty'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3b04,0x1a0));var _0x43b0=function(_0x1fc19d,_0x3dd8c2){_0x1fc19d=_0x1fc19d-0x0;var _0x30ac1f=_0x3b04[_0x1fc19d];return _0x30ac1f;};'use strict';function mergeDBDataToRealtime(_0x864420,_0x1ee4e6){var _0x47ce2f=Object[_0x43b0('0x0')]({},_0x864420);for(var _0x2c5abc in _0x1ee4e6){if(_0x47ce2f[_0x43b0('0x1')](_0x2c5abc)){_0x47ce2f[_0x2c5abc]=_0x1ee4e6[_0x2c5abc];}}return _0x47ce2f;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 1e0e196..434a4e7 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 _0x92bf=['findAgent','find','name','isNil','interface','format','SIP/%s','length','connectedlinenum','accountcode','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','keys','getCallType','calleridnum','outbound','internal','destination','exten','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','channel','destinationchannel','originatecalleridnum','disposition','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','membername','monitor','monitors','monitorFilename','createdAt','connectedlinename','xcally-motion-dialer','isArray','create','startsWith','Local','indexOf','phone','substring','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer'];(function(_0x1e8f35,_0x3db390){var _0x446c13=function(_0xa1e11e){while(--_0xa1e11e){_0x1e8f35['push'](_0x1e8f35['shift']());}};_0x446c13(++_0x3db390);}(_0x92bf,0x100));var _0xf92b=function(_0x46ff05,_0x2152b8){_0x46ff05=_0x46ff05-0x0;var _0x5843f7=_0x92bf[_0x46ff05];return _0x5843f7;};'use strict';var _=require(_0xf92b('0x0'));var moment=require(_0xf92b('0x1'));var util=require(_0xf92b('0x2'));var config=require(_0xf92b('0x3'));var ami=require(_0xf92b('0x4'));var RpcVoiceAgentReport=require(_0xf92b('0x5'));var RpcVoiceCallReport=require(_0xf92b('0x6'));var RpcVoiceDialReport=require(_0xf92b('0x7'));var RpcMemberReport=require(_0xf92b('0x8'));var RpcVoiceQueueReport=require(_0xf92b('0x9'));var RpcVoiceRecording=require(_0xf92b('0xa'));var RpcVoiceTransferReport=require(_0xf92b('0xb'));var VoiceQueueReport=require(_0xf92b('0xc'));var VoiceCallReport=require(_0xf92b('0xd'));var VoiceAgentReport=require(_0xf92b('0xe'));var VoiceDialReport=require(_0xf92b('0xf'));var UserReport=require('./userReport');function Report(_0x4b06b6){this[_0xf92b('0x10')]=_0x4b06b6;this['agents']=_0x4b06b6[_0xf92b('0x11')];this['telephones']=_0x4b06b6[_0xf92b('0x12')];}Report[_0xf92b('0x13')][_0xf92b('0x14')]=function(_0x1a4228){var _0x11c5f1=new VoiceQueueReport(this[_0xf92b('0x10')]);var _0x4bc978=new VoiceAgentReport(this[_0xf92b('0x10')]);var _0x3fb8b0=new VoiceDialReport(this['realtime']);var _0xa99cea=new VoiceCallReport(this[_0xf92b('0x10')]);var _0x2809ae=new UserReport(this[_0xf92b('0x10')]);if(config[_0xf92b('0x15')]&&config['xdr'][_0xf92b('0x16')]){ami['on'](_0xf92b('0x17'),this[_0xf92b('0x18')][_0xf92b('0x19')](this));ami['on'](_0xf92b('0x1a'),this[_0xf92b('0x1b')][_0xf92b('0x19')](this));ami['on'](_0xf92b('0x1c'),this[_0xf92b('0x1d')][_0xf92b('0x19')](this));ami['on'](_0xf92b('0x1e'),this[_0xf92b('0x1f')][_0xf92b('0x19')](this));ami['on']('blindtransfer',this[_0xf92b('0x20')][_0xf92b('0x19')](this));ami['on'](_0xf92b('0x21'),this[_0xf92b('0x22')][_0xf92b('0x19')](this));}};Report[_0xf92b('0x13')][_0xf92b('0x23')]=function(_0x27881e){var _0x631b2c;_0x631b2c=_[_0xf92b('0x24')](this[_0xf92b('0x11')],function(_0x330af3){return _0x330af3['accountcode']==_0x27881e||_0x330af3[_0xf92b('0x25')]==_0x27881e;});if(_[_0xf92b('0x26')](_0x631b2c)){var _0xffd1be=_['find'](this[_0xf92b('0x12')],function(_0x39d9f8){return _0x39d9f8['accountcode']==_0x27881e||_0x39d9f8[_0xf92b('0x25')]==_0x27881e;});if(_0xffd1be){_0x631b2c=_[_0xf92b('0x24')](this['agents'],function(_0xb6c49e){return _0xb6c49e[_0xf92b('0x27')]==util[_0xf92b('0x28')](_0xf92b('0x29'),_0xffd1be[_0xf92b('0x25')]);});}}return _0x631b2c;};Report['prototype'][_0xf92b('0x18')]=function(_0x2e7f46){for(var _0x57b310=0x0;_0x57b310<_0x2e7f46[_0xf92b('0x2a')];_0x57b310+=0x1){var _0x3dc633=this['findAgent'](_0x2e7f46[_0x57b310][_0xf92b('0x2b')]);if(_0x3dc633){_0x2e7f46[_0x57b310][_0xf92b('0x2c')]=_0x3dc633[_0xf92b('0x2c')];_0x2e7f46[_0x57b310][_0xf92b('0x2d')]=!![];_0x2e7f46[_0x57b310][_0xf92b('0x2e')]=_0x3dc633['name'];_0x2e7f46[_0x57b310][_0xf92b('0x27')]=_[_0xf92b('0x26')](_0x3dc633[_0xf92b('0x27')])?util[_0xf92b('0x28')]('SIP/%s',_0x3dc633[_0xf92b('0x25')]):_0x3dc633[_0xf92b('0x27')];if(_0x2e7f46[_0x57b310][_0xf92b('0x2f')]){_0x2e7f46[_0x57b310]['queuecallercompleteAt']=moment()['format'](_0xf92b('0x30'));}if(_0x2e7f46[_0x57b310][_0xf92b('0x31')]){_0x2e7f46[_0x57b310][_0xf92b('0x32')]=moment()['format'](_0xf92b('0x30'));}RpcMemberReport[_0xf92b('0x18')](_0x2e7f46[_0x57b310]);}RpcVoiceQueueReport['create'](_0x2e7f46[_0x57b310]);}};function extractCalleridNumber(_0x2f8b90){var _0x3519c1=_0x2f8b90[_0xf92b('0x33')](/<(.*?)>/);return _0x3519c1?_0x3519c1[0x1]:_0x2f8b90;}Report[_0xf92b('0x13')][_0xf92b('0x34')]=function(_0x275fc9){for(var _0x3a4447=0x0;_0x3a4447',_0x39dfbb[_0xf92b('0x49')],_0x39dfbb['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0x39dfbb['linkedid']]){var _0x57487d=RpcVoiceTransferReport[_0xf92b('0x4a')][_0x39dfbb[_0xf92b('0x4b')]];_0x57487d[_0xf92b('0x4c')]=_0x39dfbb[_0xf92b('0x4d')];RpcVoiceTransferReport[_0xf92b('0x20')](_0x57487d);delete RpcVoiceTransferReport[_0xf92b('0x4a')][_0x39dfbb[_0xf92b('0x4b')]];}if(_['isNil'](_0x39dfbb[_0xf92b('0x4e')])){_0x39dfbb[_0xf92b('0x4e')]=this[_0xf92b('0x36')](_0x39dfbb);}if(_[_0xf92b('0x26')](_0x39dfbb[_0xf92b('0x4f')])){var _0x285688=_0x39dfbb[_0xf92b('0x44')]['split']('-')[0x0];var _0x4c4dfc=this[_0xf92b('0x11')][_0x285688];if(!_0x4c4dfc)_0x4c4dfc=this[_0xf92b('0x34')](_0x39dfbb['accountcode']);if(_0x4c4dfc){_0x39dfbb['UserId']=_0x4c4dfc['id'];_0x39dfbb[_0xf92b('0x50')]=_0x4c4dfc['name'];}}RpcVoiceCallReport['create'](_0x39dfbb);if(_0x39dfbb[_0xf92b('0x51')]){for(var _0x56f612=0x0;_0x56f612<_0x39dfbb[_0xf92b('0x52')]['length'];_0x56f612+=0x1){_0x39dfbb[_0xf92b('0x53')]=_0x39dfbb[_0xf92b('0x52')][_0x56f612]['filename'];_0x39dfbb[_0xf92b('0x54')]=_0x39dfbb['monitors'][_0x56f612][_0xf92b('0x54')];if(_0x39dfbb[_0xf92b('0x3b')]=='xcally-motion-preview'){_0x39dfbb[_0xf92b('0x37')]=_0x39dfbb[_0xf92b('0x2b')];_0x39dfbb['calleridname']=_0x39dfbb[_0xf92b('0x55')];_0x39dfbb[_0xf92b('0x2b')]=_0x39dfbb[_0xf92b('0x2c')];_0x39dfbb[_0xf92b('0x55')]=_0x39dfbb[_0xf92b('0x50')];_0x39dfbb['exten']=_0x39dfbb[_0xf92b('0x46')];}else if(_0x39dfbb[_0xf92b('0x3b')]==_0xf92b('0x56')){_0x39dfbb[_0xf92b('0x37')]=_0x39dfbb['destination'];_0x39dfbb[_0xf92b('0x3b')]=_0x39dfbb['originatecalleridnum'];}RpcVoiceRecording['create'](_0x39dfbb);}}};Report[_0xf92b('0x13')][_0xf92b('0x1d')]=function(_0x1434f8){if(_[_0xf92b('0x57')](_0x1434f8)){_0x1434f8['forEach'](function(_0x33de2d){RpcVoiceAgentReport[_0xf92b('0x58')](_0x33de2d);});}else{RpcVoiceAgentReport['create'](_0x1434f8);}};Report[_0xf92b('0x13')]['voiceDialReport']=function(_0x58d0ba){RpcVoiceDialReport[_0xf92b('0x58')](_0x58d0ba);var _0x408a73;var _0x493dd2;var _0x22a5f3=_0x58d0ba[_0xf92b('0x44')];if(_[_0xf92b('0x59')](_0x22a5f3,_0xf92b('0x5a'))){_0x493dd2=_0x22a5f3['substring'](_0x22a5f3[_0xf92b('0x5b')]('/')+0x1,_0x22a5f3['indexOf']('@'));_0x408a73=_[_0xf92b('0x24')](this[_0xf92b('0x11')],function(_0x588c9c){return _0x588c9c['mobile']==_0x493dd2||_0x588c9c[_0xf92b('0x5c')]==_0x493dd2||_0x588c9c['accountcode']==_0x493dd2;});}else{_0x493dd2=_0x22a5f3[_0xf92b('0x5d')](_0x22a5f3[_0xf92b('0x5b')]('/')+0x1,_0x22a5f3[_0xf92b('0x5e')]('-'));_0x408a73=this[_0xf92b('0x23')](_0x493dd2);}if(_0x408a73){_0x58d0ba['interface']=_['isNil'](_0x408a73[_0xf92b('0x27')])?util[_0xf92b('0x28')](_0xf92b('0x29'),_0x408a73['name']):_0x408a73[_0xf92b('0x27')];_0x58d0ba[_0xf92b('0x50')]=_0x408a73['name'];_0x58d0ba[_0xf92b('0x2c')]=_0x408a73[_0xf92b('0x2c')];RpcMemberReport['voiceDialReport'](_0x58d0ba);}};Report['prototype']['blindTransfer']=function(_0x3212c2){RpcVoiceTransferReport[_0xf92b('0x4a')][_0x3212c2[_0xf92b('0x5f')]]=_0x3212c2;};Report[_0xf92b('0x13')][_0xf92b('0x22')]=function(_0x845090){RpcVoiceTransferReport[_0xf92b('0x22')](_0x845090);};module[_0xf92b('0x60')]=Report; \ No newline at end of file +var _0xfbac=['findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','voiceQueueReport','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','length','getCallType','channel','split','calleridnum','outbound','internal','destination','exten','dialer','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','originatecalleridnum','destinationchannel','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','monitor','monitors','monitorFilename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','substring','indexOf','mobile','lastIndexOf','exports','lodash','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','prototype'];(function(_0x30dbd6,_0x358432){var _0x5dd08a=function(_0x120fa9){while(--_0x120fa9){_0x30dbd6['push'](_0x30dbd6['shift']());}};_0x5dd08a(++_0x358432);}(_0xfbac,0x19c));var _0xcfba=function(_0xe399b8,_0x3830c2){_0xe399b8=_0xe399b8-0x0;var _0x1a2ebe=_0xfbac[_0xe399b8];return _0x1a2ebe;};'use strict';var _=require(_0xcfba('0x0'));var moment=require('moment');var util=require('util');var config=require(_0xcfba('0x1'));var ami=require(_0xcfba('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xcfba('0x3'));var RpcVoiceDialReport=require(_0xcfba('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xcfba('0x5'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xcfba('0x6'));var VoiceQueueReport=require(_0xcfba('0x7'));var VoiceCallReport=require(_0xcfba('0x8'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xcfba('0x9'));var UserReport=require(_0xcfba('0xa'));function Report(_0x1647e8){this[_0xcfba('0xb')]=_0x1647e8;this[_0xcfba('0xc')]=_0x1647e8[_0xcfba('0xc')];this[_0xcfba('0xd')]=_0x1647e8[_0xcfba('0xd')];}Report['prototype'][_0xcfba('0xe')]=function(_0x3dbcb6){var _0x2bbf96=new VoiceQueueReport(this[_0xcfba('0xb')]);var _0xa0d347=new VoiceAgentReport(this[_0xcfba('0xb')]);var _0x33a301=new VoiceDialReport(this['realtime']);var _0x4d537d=new VoiceCallReport(this[_0xcfba('0xb')]);var _0x4ac738=new UserReport(this[_0xcfba('0xb')]);if(config[_0xcfba('0xf')]&&config[_0xcfba('0xf')][_0xcfba('0x10')]){ami['on'](_0xcfba('0x11'),this['voiceQueueReport'][_0xcfba('0x12')](this));ami['on'](_0xcfba('0x13'),this[_0xcfba('0x14')][_0xcfba('0x12')](this));ami['on'](_0xcfba('0x15'),this[_0xcfba('0x16')][_0xcfba('0x12')](this));ami['on'](_0xcfba('0x17'),this['voiceDialReport']['bind'](this));ami['on']('blindtransfer',this[_0xcfba('0x18')][_0xcfba('0x12')](this));ami['on'](_0xcfba('0x19'),this[_0xcfba('0x1a')][_0xcfba('0x12')](this));}};Report[_0xcfba('0x1b')][_0xcfba('0x1c')]=function(_0x91f0e8){var _0x541256;_0x541256=_[_0xcfba('0x1d')](this['agents'],function(_0x3b21e0){return _0x3b21e0[_0xcfba('0x1e')]==_0x91f0e8||_0x3b21e0[_0xcfba('0x1f')]==_0x91f0e8;});if(_[_0xcfba('0x20')](_0x541256)){var _0x492ce6=_[_0xcfba('0x1d')](this['telephones'],function(_0x5c810a){return _0x5c810a[_0xcfba('0x1e')]==_0x91f0e8||_0x5c810a[_0xcfba('0x1f')]==_0x91f0e8;});if(_0x492ce6){_0x541256=_[_0xcfba('0x1d')](this[_0xcfba('0xc')],function(_0x34e9f7){return _0x34e9f7[_0xcfba('0x21')]==util[_0xcfba('0x22')](_0xcfba('0x23'),_0x492ce6[_0xcfba('0x1f')]);});}}return _0x541256;};Report[_0xcfba('0x1b')][_0xcfba('0x24')]=function(_0x7b5c85){for(var _0x418927=0x0;_0x418927<_0x7b5c85['length'];_0x418927+=0x1){var _0x5b3c83=this[_0xcfba('0x1c')](_0x7b5c85[_0x418927][_0xcfba('0x25')]);if(_0x5b3c83){_0x7b5c85[_0x418927][_0xcfba('0x1e')]=_0x5b3c83[_0xcfba('0x1e')];_0x7b5c85[_0x418927][_0xcfba('0x26')]=!![];_0x7b5c85[_0x418927][_0xcfba('0x27')]=_0x5b3c83[_0xcfba('0x1f')];_0x7b5c85[_0x418927][_0xcfba('0x21')]=_[_0xcfba('0x20')](_0x5b3c83[_0xcfba('0x21')])?util[_0xcfba('0x22')](_0xcfba('0x23'),_0x5b3c83['name']):_0x5b3c83[_0xcfba('0x21')];if(_0x7b5c85[_0x418927][_0xcfba('0x28')]){_0x7b5c85[_0x418927]['queuecallercompleteAt']=moment()['format'](_0xcfba('0x29'));}if(_0x7b5c85[_0x418927][_0xcfba('0x2a')]){_0x7b5c85[_0x418927][_0xcfba('0x2b')]=moment()[_0xcfba('0x22')](_0xcfba('0x29'));}RpcMemberReport['voiceQueueReport'](_0x7b5c85[_0x418927]);}RpcVoiceQueueReport[_0xcfba('0x2c')](_0x7b5c85[_0x418927]);}};function extractCalleridNumber(_0x475c7a){var _0x4a58d7=_0x475c7a['match'](/<(.*?)>/);return _0x4a58d7?_0x4a58d7[0x1]:_0x475c7a;}Report[_0xcfba('0x1b')][_0xcfba('0x2d')]=function(_0x109d48){for(var _0x2227db=0x0;_0x2227db0x0?!![]:![];if(!_0x516433){return this['syncQueueSummaryComplete'](this[_0x0ba7('0x15')][_0x0ba7('0x6d')]);}};VoiceQueueReport[_0x0ba7('0xb')][_0x0ba7('0x1b')]=function(_0x97b509){var _0x2e4108=this[_0x0ba7('0x15')]['id'];if(this[_0x0ba7('0x15')][_0x0ba7('0x62')][_0x2e4108]&&this[_0x0ba7('0x15')]['queuestatus'][_0x2e4108][_0x97b509[_0x0ba7('0x61')]]){this['summary'][_0x0ba7('0x62')][_0x2e4108][_0x97b509[_0x0ba7('0x61')]]['agents'][_0x0ba7('0x6e')](_0x97b509);}};VoiceQueueReport[_0x0ba7('0xb')][_0x0ba7('0x6f')]=function(_0x510092){var _0x476638=this;try{if(this[_0x0ba7('0x5b')](_0x510092)&&this['isNotNull'](_0x510092['queue'])){logger[_0x0ba7('0x50')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x0ba7('0x42')](_0x510092,{'showHidden':![],'depth':null}));var _0x1e0d3b=this[_0x0ba7('0x13')][_0x510092[_0x0ba7('0x53')]];if(_0x1e0d3b){logger[_0x0ba7('0x50')](_0x0ba7('0x70'),_0x1e0d3b[_0x0ba7('0x59')]);this[_0x0ba7('0x15')][_0x0ba7('0x5d')][_0x1e0d3b[_0x0ba7('0x59')]]={'summaryEvent':_0x510092};this[_0x0ba7('0x15')][_0x0ba7('0x6c')]+=0x1;return ami[_0x0ba7('0x3c')]({'action':_0x0ba7('0x62'),'queue':_0x1e0d3b['name']})[_0x0ba7('0x60')](function(_0x3cef13){if(!_0x476638[_0x0ba7('0x15')][_0x0ba7('0x62')][_0x510092[_0x0ba7('0x61')]]){_0x476638[_0x0ba7('0x15')][_0x0ba7('0x62')][_0x510092[_0x0ba7('0x61')]]={};}_0x476638[_0x0ba7('0x15')]['queuestatus'][_0x510092['actionid']][_0x3cef13['actionid']]={'queue':_0x1e0d3b['name'],'agents':[]};})[_0x0ba7('0x3d')](function(_0xbcbd53){throw _0xbcbd53;});}}}catch(_0x4ecccb){logger[_0x0ba7('0x40')](_0x0ba7('0x63'),util[_0x0ba7('0x42')](_0x4ecccb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0ba7('0x71')]=function(_0x475b83){if(this[_0x0ba7('0x15')][_0x0ba7('0x6c')]>0x0){this[_0x0ba7('0x15')][_0x0ba7('0x6d')]=_0x475b83;return;}logger[_0x0ba7('0x50')](_0x0ba7('0x72'),util[_0x0ba7('0x42')](_0x475b83,{'showHidden':![],'depth':null}));this[_0x0ba7('0x15')]=initializeSummary();ami[_0x0ba7('0x47')](_0x0ba7('0x73'),{});};VoiceQueueReport[_0x0ba7('0xb')][_0x0ba7('0x1e')]=function(_0x502e1f){try{if(this[_0x0ba7('0x5b')](_0x502e1f)){logger[_0x0ba7('0x50')](_0x0ba7('0x74'),_0x502e1f['uniqueid'],util[_0x0ba7('0x42')](_0x502e1f,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x0ba7('0x75')][_0x502e1f['uniqueid']])){this[_0x0ba7('0x75')][_0x502e1f[_0x0ba7('0x4b')]]=[];}if(_['isUndefined'](this[_0x0ba7('0x11')][_0x502e1f[_0x0ba7('0x4b')]])){this[_0x0ba7('0x11')][_0x502e1f['uniqueid']]={};}var _0x18cb20=new QueueReport();_0x18cb20['queue']=_0x502e1f['queue'];_0x18cb20[_0x0ba7('0x57')]=this[_0x0ba7('0x13')][_0x18cb20[_0x0ba7('0x53')]]&&this[_0x0ba7('0x13')][_0x18cb20[_0x0ba7('0x53')]][_0x0ba7('0x57')]?this[_0x0ba7('0x13')][_0x18cb20[_0x0ba7('0x53')]]['type']||_0x0ba7('0x6a'):'inbound';_0x18cb20['queuecallerjoinAt']=moment()[_0x0ba7('0x4c')](_0x0ba7('0x76'));_0x18cb20[_0x0ba7('0x77')]=_0x502e1f[_0x0ba7('0x77')];_0x18cb20[_0x0ba7('0x78')]=_0x502e1f[_0x0ba7('0x78')];_0x18cb20['uniqueid']=_0x502e1f['uniqueid'];_0x18cb20[_0x0ba7('0x79')]=this[_0x0ba7('0x11')][_0x502e1f[_0x0ba7('0x4b')]][_0x0ba7('0x79')];logger[_0x0ba7('0x7a')](_0x0ba7('0x7b'),_0x18cb20[_0x0ba7('0x53')],_0x18cb20[_0x0ba7('0x57')]);Object[_0x0ba7('0x69')](_0x18cb20,_[_0x0ba7('0x7c')](_0x502e1f,_[_0x0ba7('0x7d')](_0x18cb20)));this[_0x0ba7('0x75')][_0x502e1f[_0x0ba7('0x4b')]]['push'](_0x18cb20);this[_0x0ba7('0x11')][_0x502e1f['uniqueid']]=_0x18cb20;this[_0x0ba7('0x48')](_0x18cb20,_0x0ba7('0x7e'));}}catch(_0x2dda6c){logger[_0x0ba7('0x40')]('[%s][voiceQueueReport][queuecallerjoin]',_0x502e1f[_0x0ba7('0x4b')],util[_0x0ba7('0x42')](_0x2dda6c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0ba7('0xb')][_0x0ba7('0x20')]=function(_0x43cb7d){try{if(this[_0x0ba7('0x5b')](_0x43cb7d)){logger[_0x0ba7('0x50')]('[%s][voiceQueueReport][queuecallerabandon]',_0x43cb7d[_0x0ba7('0x4b')],util[_0x0ba7('0x42')](_0x43cb7d,{'showHidden':![],'depth':null}));if(this[_0x0ba7('0x75')][_0x43cb7d[_0x0ba7('0x4b')]]){var _0x53b5ee=_['last'](this[_0x0ba7('0x75')][_0x43cb7d[_0x0ba7('0x4b')]]);_0x53b5ee['queuecallercomplete']=![];_0x53b5ee[_0x0ba7('0x7f')]=null;_0x53b5ee[_0x0ba7('0x80')]=_0x43cb7d[_0x0ba7('0x80')];_0x53b5ee[_0x0ba7('0x81')]=_0x43cb7d['originalposition'];_0x53b5ee[_0x0ba7('0x1f')]=!![];_0x53b5ee[_0x0ba7('0x82')]=moment()[_0x0ba7('0x4c')](_0x0ba7('0x76'));_0x53b5ee[_0x0ba7('0x83')]=_0x0ba7('0x84');_0x53b5ee[_0x0ba7('0x85')]=null;logger[_0x0ba7('0x7a')](_0x0ba7('0x86'),_0x53b5ee['queue'],_0x53b5ee[_0x0ba7('0x57')]);this[_0x0ba7('0x11')][_0x43cb7d[_0x0ba7('0x4b')]]=_0x53b5ee;this[_0x0ba7('0x4f')](_0x53b5ee,_0x0ba7('0x1f'));}}}catch(_0xf77e76){logger[_0x0ba7('0x40')](_0x0ba7('0x87'),_0x43cb7d[_0x0ba7('0x4b')],util[_0x0ba7('0x42')](_0xf77e76,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x3bcf4a){try{if(this[_0x0ba7('0x5b')](_0x3bcf4a)){logger[_0x0ba7('0x50')]('[%s][voiceQueueReport][queuecallerleave]',_0x3bcf4a[_0x0ba7('0x4b')],util[_0x0ba7('0x42')](_0x3bcf4a,{'showHidden':![],'depth':null}));if(this[_0x0ba7('0x75')][_0x3bcf4a[_0x0ba7('0x4b')]]){var _0xd329ed=_['last'](this['queueReports'][_0x3bcf4a[_0x0ba7('0x4b')]]);_0xd329ed[_0x0ba7('0x88')]=moment()[_0x0ba7('0x4c')](_0x0ba7('0x76'));_0xd329ed[_0x0ba7('0x89')]=_0x3bcf4a[_0x0ba7('0x89')];_0xd329ed[_0x0ba7('0x8a')]=_0x3bcf4a[_0x0ba7('0x8a')];logger['info'](_0x0ba7('0x8b'),_0xd329ed[_0x0ba7('0x53')],_0xd329ed[_0x0ba7('0x57')],_0x3bcf4a['connectedlinenum'],_0x3bcf4a[_0x0ba7('0x8a')]);this['channels'][_0x3bcf4a[_0x0ba7('0x4b')]]=_0xd329ed;this[_0x0ba7('0x48')](_0xd329ed,_0x0ba7('0x8c'));}}}catch(_0x3645c7){logger[_0x0ba7('0x40')]('[%s][voiceQueueReport][queuecallerleave]',_0x3bcf4a['uniqueid'],util['inspect'](_0x3645c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0ba7('0x24')]=function(_0x3309ef){try{if(this[_0x0ba7('0x5b')](_0x3309ef)){logger[_0x0ba7('0x50')](_0x0ba7('0x8d'),_0x3309ef[_0x0ba7('0x4b')],util[_0x0ba7('0x42')](_0x3309ef,{'showHidden':![],'depth':null}));if(this[_0x0ba7('0x75')][_0x3309ef[_0x0ba7('0x4b')]]){var _0x1bc0fb=_[_0x0ba7('0x8e')](this[_0x0ba7('0x75')][_0x3309ef[_0x0ba7('0x4b')]]);_0x1bc0fb[_0x0ba7('0x38')]=!![];_0x1bc0fb[_0x0ba7('0x83')]=_0x0ba7('0x8f');logger['info'](_0x0ba7('0x90'),_0x1bc0fb[_0x0ba7('0x53')],_0x1bc0fb[_0x0ba7('0x57')]);}}}catch(_0x3660dd){logger[_0x0ba7('0x40')](_0x0ba7('0x8d'),_0x3309ef[_0x0ba7('0x4b')],util[_0x0ba7('0x42')](_0x3660dd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0ba7('0x22')]=function(_0x9c1f9d){try{if(this[_0x0ba7('0x5b')](_0x9c1f9d)){logger[_0x0ba7('0x50')](_0x0ba7('0x91'),_0x9c1f9d[_0x0ba7('0x4b')],util['inspect'](_0x9c1f9d,{'showHidden':![],'depth':null}));if(this[_0x0ba7('0x75')][_0x9c1f9d[_0x0ba7('0x4b')]]){var _0x1d4ff2=_[_0x0ba7('0x8e')](this[_0x0ba7('0x75')][_0x9c1f9d[_0x0ba7('0x4b')]]);_0x1d4ff2['queuecallerabandon']=![];_0x1d4ff2[_0x0ba7('0x82')]=null;_0x1d4ff2['assigned']=!![];_0x1d4ff2[_0x0ba7('0x85')]=_0x9c1f9d[_0x0ba7('0x92')];_0x1d4ff2['holdtime']=_0x9c1f9d[_0x0ba7('0x80')];_0x1d4ff2['queuecallercomplete']=!![];_0x1d4ff2[_0x0ba7('0x37')]=![];_0x1d4ff2[_0x0ba7('0x93')]=null;if(!_0x1d4ff2['transfer']){if(_0x9c1f9d[_0x0ba7('0x94')]=='transfer'){_0x1d4ff2[_0x0ba7('0x83')]=_0x0ba7('0x95');logger[_0x0ba7('0x7a')](_0x0ba7('0x96'),_0x1d4ff2[_0x0ba7('0x53')],_0x1d4ff2['type']);}else{if(_[_0x0ba7('0x97')](_0x9c1f9d[_0x0ba7('0x98')][_0x0ba7('0x99')](),_0x0ba7('0x9a'))){if(this['queueReports'][_0x9c1f9d[_0x0ba7('0x9b')]]){var _0x4d7eb1=_[_0x0ba7('0x8e')](this[_0x0ba7('0x75')][_0x9c1f9d[_0x0ba7('0x9b')]]);_0x4d7eb1[_0x0ba7('0x38')]=![];_0x4d7eb1[_0x0ba7('0x37')]=!![];_0x4d7eb1['queuecallerexitAt']=moment(_0x1d4ff2[_0x0ba7('0x9c')])['add'](_0x9c1f9d[_0x0ba7('0x80')],_0x0ba7('0x9d'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4d7eb1[_0x0ba7('0x83')]=_0x0ba7('0x9e');_0x4d7eb1['transfer']=!![];_0x4d7eb1[_0x0ba7('0x9f')]=_0x0ba7('0xa0');_0x4d7eb1[_0x0ba7('0xa1')]=_0x9c1f9d[_0x0ba7('0xa2')];_0x4d7eb1[_0x0ba7('0xa3')]=_0x9c1f9d[_0x0ba7('0x4b')];logger[_0x0ba7('0x7a')](_0x0ba7('0xa4'),_0x4d7eb1['queue'],_0x4d7eb1[_0x0ba7('0x57')]);var _0x2a554b=this[_0x0ba7('0x75')][_0x9c1f9d[_0x0ba7('0x9b')]];this['queueReports'][_0x9c1f9d[_0x0ba7('0x9b')]]=this[_0x0ba7('0x75')][_0x9c1f9d['uniqueid']];this['queueReports'][_0x9c1f9d['uniqueid']]=_0x2a554b;}}else{_0x1d4ff2[_0x0ba7('0x83')]=_0x0ba7('0xa5')+_0x9c1f9d['reason']['toUpperCase']();logger[_0x0ba7('0x7a')](_0x0ba7('0xa6'),_0x1d4ff2[_0x0ba7('0x53')],_0x1d4ff2[_0x0ba7('0x57')],_0x1d4ff2['queuecallerexitreason']);}}}this['channels'][_0x9c1f9d[_0x0ba7('0x4b')]]=_0x1d4ff2;}}}catch(_0x43c24c){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x9c1f9d[_0x0ba7('0x4b')],util['inspect'](_0x43c24c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0ba7('0xb')][_0x0ba7('0x25')]=function(_0x21b932){try{if(this['isNotNull'](_0x21b932)){logger['debug'](_0x0ba7('0xa7'),_0x21b932[_0x0ba7('0x4b')],util[_0x0ba7('0x42')](_0x21b932,{'showHidden':![],'depth':null}));this[_0x0ba7('0xa8')](_0x21b932[_0x0ba7('0x4b')],_[_0x0ba7('0x7d')](_0x21b932[_0x0ba7('0xa9')])[0x0],_0x21b932[_0x0ba7('0xaa')]);if(this[_0x0ba7('0x75')][_0x21b932[_0x0ba7('0x4b')]]){var _0x11fa54=_['last'](this[_0x0ba7('0x75')][_0x21b932[_0x0ba7('0x4b')]]);if(_0x11fa54){if(this[_0x0ba7('0x5b')](_0x21b932[_0x0ba7('0xa9')])&&this[_0x0ba7('0x5b')](_0x21b932['variable'][_0x0ba7('0x62')])){switch(_0x21b932[_0x0ba7('0xaa')]){case _0x0ba7('0xab'):_0x11fa54[_0x0ba7('0x37')]=![];_0x11fa54[_0x0ba7('0x93')]=null;break;case'TIMEOUT':_0x11fa54[_0x0ba7('0xac')]=_0x0ba7('0xad');_0x11fa54['queuecallerexit']=!![];_0x11fa54[_0x0ba7('0x93')]=moment()[_0x0ba7('0x4c')](_0x0ba7('0x76'));_0x11fa54[_0x0ba7('0x88')]=moment()[_0x0ba7('0x4c')](_0x0ba7('0x76'));logger['debug'](_0x0ba7('0xae'),_0x21b932[_0x0ba7('0x4b')],util[_0x0ba7('0x42')](_0x11fa54,{'showHidden':![],'depth':null}));ami[_0x0ba7('0x47')](_0x0ba7('0xaf'),_0x11fa54);break;default:_0x11fa54[_0x0ba7('0x37')]=!![];_0x11fa54[_0x0ba7('0x93')]=moment()[_0x0ba7('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x11fa54['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x11fa54[_0x0ba7('0x1f')]=![];_0x11fa54[_0x0ba7('0x82')]=null;_0x11fa54['queuecallerexitreason']=_0x21b932['value'];this[_0x0ba7('0x11')][_0x21b932[_0x0ba7('0x4b')]]=_0x11fa54;this[_0x0ba7('0x4f')](_0x11fa54,_0x0ba7('0xb0'));}else if(this[_0x0ba7('0x5b')](_0x21b932[_0x0ba7('0xa9')])&&this['isNotNull'](_0x21b932[_0x0ba7('0xa9')][_0x0ba7('0xb1')])){if(!_0x11fa54[_0x0ba7('0x1f')]){_0x11fa54[_0x0ba7('0x37')]=!![];_0x11fa54['queuecallerexitAt']=moment()[_0x0ba7('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x11fa54[_0x0ba7('0x83')]='EXITWITHKEY';_0x11fa54[_0x0ba7('0x88')]=moment()[_0x0ba7('0x4c')](_0x0ba7('0x76'));this[_0x0ba7('0x11')][_0x21b932[_0x0ba7('0x4b')]]=_0x11fa54;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x21b932[_0x0ba7('0x4b')],_0x11fa54[_0x0ba7('0x53')],_0x11fa54['type'],_[_0x0ba7('0x7d')](_0x21b932[_0x0ba7('0xa9')])[0x0],_0x21b932[_0x0ba7('0xaa')]);_0x11fa54[_0x0ba7('0x16')]=this[_0x0ba7('0x16')][_0x21b932[_0x0ba7('0x4b')]];}}}}catch(_0x22dc5a){logger[_0x0ba7('0x40')](_0x0ba7('0xa7'),_0x21b932[_0x0ba7('0x4b')],util[_0x0ba7('0x42')](_0x22dc5a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0ba7('0xb')][_0x0ba7('0xa8')]=function(_0x18dee0,_0x1b44de,_0x112a33){var _0x44e75d=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x0ba7('0xb2'),_0x0ba7('0xb3'),_0x0ba7('0xb4'),_0x0ba7('0xb5'),'sipcallid',_0x0ba7('0xb6'),_0x0ba7('0xb7'),_0x0ba7('0xb8'),_0x0ba7('0xb9'),_0x0ba7('0xba'),_0x0ba7('0xbb'),_0x0ba7('0xbc'),_0x0ba7('0x92'),_0x0ba7('0xbd'),_0x0ba7('0xbe')];if(!_[_0x0ba7('0x3b')](_0x1b44de)&&!_['includes'](_0x44e75d,_0x1b44de)){if(_[_0x0ba7('0x5c')](this[_0x0ba7('0x16')][_0x18dee0])){this['variables'][_0x18dee0]={};}this['variables'][_0x18dee0][_0x1b44de]=_0x112a33;}};VoiceQueueReport[_0x0ba7('0xb')][_0x0ba7('0xbf')]=function(_0x2b2619,_0x5aef41,_0x397d17){try{var _0x1a5f47={};if(this[_0x0ba7('0x75')][_0x2b2619]){for(var _0x49f525=0x0;_0x49f5250x0?!![]:![];if(!_0x3a82da){return this['syncQueueSummaryComplete'](this[_0xe9b8('0x18')][_0xe9b8('0x77')]);}};VoiceQueueReport['prototype'][_0xe9b8('0x78')]=function(_0x161f56){var _0x4a1968=this[_0xe9b8('0x18')]['id'];if(this[_0xe9b8('0x18')][_0xe9b8('0x6b')][_0x4a1968]&&this[_0xe9b8('0x18')][_0xe9b8('0x6b')][_0x4a1968][_0x161f56[_0xe9b8('0x6a')]]){this[_0xe9b8('0x18')][_0xe9b8('0x6b')][_0x4a1968][_0x161f56['actionid']][_0xe9b8('0x13')][_0xe9b8('0x79')](_0x161f56);}};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x46adb6){var _0x438a3c=this;try{if(this[_0xe9b8('0x65')](_0x46adb6)&&this[_0xe9b8('0x65')](_0x46adb6[_0xe9b8('0x59')])){logger[_0xe9b8('0x55')](_0xe9b8('0x7a'),util[_0xe9b8('0x4d')](_0x46adb6,{'showHidden':![],'depth':null}));var _0x5d99bc=this[_0xe9b8('0x16')][_0x46adb6['queue']];if(_0x5d99bc){logger[_0xe9b8('0x55')](_0xe9b8('0x7b'),_0x5d99bc[_0xe9b8('0x63')]);this['summary'][_0xe9b8('0x66')][_0x5d99bc[_0xe9b8('0x63')]]={'summaryEvent':_0x46adb6};this[_0xe9b8('0x18')]['statusRequests']+=0x1;return ami[_0xe9b8('0x45')]({'action':_0xe9b8('0x6b'),'queue':_0x5d99bc[_0xe9b8('0x63')]})[_0xe9b8('0x69')](function(_0x3f26a5){if(!_0x438a3c[_0xe9b8('0x18')][_0xe9b8('0x6b')][_0x46adb6['actionid']]){_0x438a3c[_0xe9b8('0x18')][_0xe9b8('0x6b')][_0x46adb6[_0xe9b8('0x6a')]]={};}_0x438a3c['summary'][_0xe9b8('0x6b')][_0x46adb6[_0xe9b8('0x6a')]][_0x3f26a5[_0xe9b8('0x6a')]]={'queue':_0x5d99bc[_0xe9b8('0x63')],'agents':[]};})[_0xe9b8('0x48')](function(_0x103c1f){throw _0x103c1f;});}}}catch(_0xed81fb){logger['error']('[voiceQueueReport][queuesummary]',util[_0xe9b8('0x4d')](_0xed81fb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe9b8('0xc')][_0xe9b8('0x1e')]=function(_0x15a654){if(this[_0xe9b8('0x18')][_0xe9b8('0x76')]>0x0){this['summary'][_0xe9b8('0x77')]=_0x15a654;return;}logger[_0xe9b8('0x55')](_0xe9b8('0x7c'),util['inspect'](_0x15a654,{'showHidden':![],'depth':null}));this[_0xe9b8('0x18')]=initializeSummary();ami[_0xe9b8('0x53')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xe9b8('0xc')][_0xe9b8('0x22')]=function(_0x573cd9){try{if(this[_0xe9b8('0x65')](_0x573cd9)){logger[_0xe9b8('0x55')](_0xe9b8('0x7d'),_0x573cd9['uniqueid'],util[_0xe9b8('0x4d')](_0x573cd9,{'showHidden':![],'depth':null}));if(_[_0xe9b8('0x7e')](this[_0xe9b8('0x11')][_0x573cd9['uniqueid']])){this[_0xe9b8('0x11')][_0x573cd9[_0xe9b8('0x57')]]=[];}if(_[_0xe9b8('0x7e')](this[_0xe9b8('0x14')][_0x573cd9[_0xe9b8('0x57')]])){this[_0xe9b8('0x14')][_0x573cd9[_0xe9b8('0x57')]]={};}var _0x2ff773=new QueueReport();_0x2ff773[_0xe9b8('0x59')]=_0x573cd9[_0xe9b8('0x59')];_0x2ff773['type']=this[_0xe9b8('0x16')][_0x2ff773['queue']]&&this[_0xe9b8('0x16')][_0x2ff773['queue']]['type']?this[_0xe9b8('0x16')][_0x2ff773['queue']][_0xe9b8('0x72')]||_0xe9b8('0x61'):_0xe9b8('0x61');_0x2ff773[_0xe9b8('0x7f')]=moment()[_0xe9b8('0x58')](_0xe9b8('0x80'));_0x2ff773[_0xe9b8('0x81')]=_0x573cd9[_0xe9b8('0x81')];_0x2ff773['count']=_0x573cd9[_0xe9b8('0x82')];_0x2ff773[_0xe9b8('0x57')]=_0x573cd9[_0xe9b8('0x57')];_0x2ff773['routealias']=this[_0xe9b8('0x14')][_0x573cd9[_0xe9b8('0x57')]][_0xe9b8('0x83')];logger[_0xe9b8('0x84')](_0xe9b8('0x85'),_0x2ff773[_0xe9b8('0x59')],_0x2ff773[_0xe9b8('0x72')]);Object['assign'](_0x2ff773,_[_0xe9b8('0x86')](_0x573cd9,_[_0xe9b8('0x87')](_0x2ff773)));this['queueReports'][_0x573cd9[_0xe9b8('0x57')]][_0xe9b8('0x79')](_0x2ff773);this[_0xe9b8('0x14')][_0x573cd9[_0xe9b8('0x57')]]=_0x2ff773;this['emitVoiceQueueChannelSave'](_0x2ff773,_0xe9b8('0x21'));}}catch(_0x4737a9){logger['error'](_0xe9b8('0x7d'),_0x573cd9[_0xe9b8('0x57')],util[_0xe9b8('0x4d')](_0x4737a9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe9b8('0xc')][_0xe9b8('0x24')]=function(_0x183934){try{if(this['isNotNull'](_0x183934)){logger[_0xe9b8('0x55')](_0xe9b8('0x88'),_0x183934[_0xe9b8('0x57')],util['inspect'](_0x183934,{'showHidden':![],'depth':null}));if(this[_0xe9b8('0x11')][_0x183934[_0xe9b8('0x57')]]){var _0x200153=_[_0xe9b8('0x89')](this[_0xe9b8('0x11')][_0x183934[_0xe9b8('0x57')]]);_0x200153[_0xe9b8('0x41')]=![];_0x200153[_0xe9b8('0x8a')]=null;_0x200153['holdtime']=_0x183934[_0xe9b8('0x8b')];_0x200153[_0xe9b8('0x8c')]=_0x183934['originalposition'];_0x200153[_0xe9b8('0x23')]=!![];_0x200153[_0xe9b8('0x8d')]=moment()['format'](_0xe9b8('0x80'));_0x200153[_0xe9b8('0x5c')]=_0xe9b8('0x8e');_0x200153[_0xe9b8('0x8f')]=null;logger[_0xe9b8('0x84')](_0xe9b8('0x90'),_0x200153[_0xe9b8('0x59')],_0x200153[_0xe9b8('0x72')]);this[_0xe9b8('0x14')][_0x183934[_0xe9b8('0x57')]]=_0x200153;this[_0xe9b8('0x52')](_0x200153,'queuecallerabandon');}}}catch(_0x230d0d){logger[_0xe9b8('0x4b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x183934[_0xe9b8('0x57')],util['inspect'](_0x230d0d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe9b8('0xc')][_0xe9b8('0x26')]=function(_0x43b9e7){try{if(this['isNotNull'](_0x43b9e7)){logger['debug'](_0xe9b8('0x91'),_0x43b9e7['uniqueid'],util[_0xe9b8('0x4d')](_0x43b9e7,{'showHidden':![],'depth':null}));if(this[_0xe9b8('0x11')][_0x43b9e7[_0xe9b8('0x57')]]){var _0xac1468=_[_0xe9b8('0x89')](this[_0xe9b8('0x11')][_0x43b9e7[_0xe9b8('0x57')]]);_0xac1468[_0xe9b8('0x92')]=moment()['format'](_0xe9b8('0x80'));_0xac1468['connectedlinenum']=_0x43b9e7[_0xe9b8('0x93')];_0xac1468['connectedlinename']=_0x43b9e7[_0xe9b8('0x94')];logger['info'](_0xe9b8('0x95'),_0xac1468[_0xe9b8('0x59')],_0xac1468[_0xe9b8('0x72')],_0x43b9e7['connectedlinenum'],_0x43b9e7[_0xe9b8('0x94')]);this[_0xe9b8('0x14')][_0x43b9e7[_0xe9b8('0x57')]]=_0xac1468;this[_0xe9b8('0x54')](_0xac1468,_0xe9b8('0x25'));}}}catch(_0x36fd67){logger['error'](_0xe9b8('0x91'),_0x43b9e7['uniqueid'],util[_0xe9b8('0x4d')](_0x36fd67,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe9b8('0xc')][_0xe9b8('0x29')]=function(_0x570c88){try{if(this[_0xe9b8('0x65')](_0x570c88)){logger[_0xe9b8('0x55')]('[%s][voiceQueueReport][agentconnect]',_0x570c88[_0xe9b8('0x57')],util['inspect'](_0x570c88,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x570c88[_0xe9b8('0x57')]]){var _0x1f7025=_['last'](this['queueReports'][_0x570c88['uniqueid']]);_0x1f7025[_0xe9b8('0x41')]=!![];_0x1f7025['queuecallerexitreason']=_0xe9b8('0x96');logger['info'](_0xe9b8('0x97'),_0x1f7025[_0xe9b8('0x59')],_0x1f7025[_0xe9b8('0x72')]);}}}catch(_0x32b285){logger[_0xe9b8('0x4b')]('[%s][voiceQueueReport][agentconnect]',_0x570c88[_0xe9b8('0x57')],util[_0xe9b8('0x4d')](_0x32b285,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe9b8('0xc')][_0xe9b8('0x27')]=function(_0x3004ed){try{if(this['isNotNull'](_0x3004ed)){logger[_0xe9b8('0x55')](_0xe9b8('0x98'),_0x3004ed[_0xe9b8('0x57')],util[_0xe9b8('0x4d')](_0x3004ed,{'showHidden':![],'depth':null}));if(this[_0xe9b8('0x11')][_0x3004ed[_0xe9b8('0x57')]]){var _0x6a3f0f=_[_0xe9b8('0x89')](this[_0xe9b8('0x11')][_0x3004ed[_0xe9b8('0x57')]]);_0x6a3f0f[_0xe9b8('0x23')]=![];_0x6a3f0f[_0xe9b8('0x8d')]=null;_0x6a3f0f[_0xe9b8('0x99')]=!![];_0x6a3f0f[_0xe9b8('0x8f')]=_0x3004ed['membername'];_0x6a3f0f['holdtime']=_0x3004ed[_0xe9b8('0x8b')];_0x6a3f0f['queuecallercomplete']=!![];_0x6a3f0f[_0xe9b8('0x40')]=![];_0x6a3f0f[_0xe9b8('0x9a')]=null;if(!_0x6a3f0f[_0xe9b8('0x9b')]){if(_0x3004ed['reason']==_0xe9b8('0x9b')){_0x6a3f0f[_0xe9b8('0x5c')]=_0xe9b8('0x9c');logger['info'](_0xe9b8('0x9d'),_0x6a3f0f[_0xe9b8('0x59')],_0x6a3f0f['type']);}else{if(_[_0xe9b8('0x9e')](_0x3004ed[_0xe9b8('0x47')][_0xe9b8('0x9f')](),_0xe9b8('0xa0'))){if(this[_0xe9b8('0x11')][_0x3004ed[_0xe9b8('0xa1')]]){var _0x32f204=_['last'](this[_0xe9b8('0x11')][_0x3004ed[_0xe9b8('0xa1')]]);_0x32f204['queuecallercomplete']=![];_0x32f204[_0xe9b8('0x40')]=!![];_0x32f204[_0xe9b8('0x9a')]=moment(_0x6a3f0f[_0xe9b8('0x7f')])[_0xe9b8('0xa2')](_0x3004ed[_0xe9b8('0x8b')],_0xe9b8('0xa3'))[_0xe9b8('0x58')](_0xe9b8('0x80'));_0x32f204[_0xe9b8('0x5c')]=_0xe9b8('0xa4');_0x32f204[_0xe9b8('0x9b')]=!![];_0x32f204[_0xe9b8('0xa5')]=_0xe9b8('0xa6');_0x32f204[_0xe9b8('0xa7')]=_0x3004ed['destexten'];_0x32f204[_0xe9b8('0xa8')]=_0x3004ed[_0xe9b8('0x57')];logger[_0xe9b8('0x84')](_0xe9b8('0xa9'),_0x32f204[_0xe9b8('0x59')],_0x32f204['type']);var _0x43d578=this['queueReports'][_0x3004ed[_0xe9b8('0xa1')]];this[_0xe9b8('0x11')][_0x3004ed[_0xe9b8('0xa1')]]=this[_0xe9b8('0x11')][_0x3004ed[_0xe9b8('0x57')]];this[_0xe9b8('0x11')][_0x3004ed[_0xe9b8('0x57')]]=_0x43d578;}}else{_0x6a3f0f[_0xe9b8('0x5c')]=_0xe9b8('0xaa')+_0x3004ed[_0xe9b8('0xab')][_0xe9b8('0xac')]();logger[_0xe9b8('0x84')](_0xe9b8('0xad'),_0x6a3f0f[_0xe9b8('0x59')],_0x6a3f0f[_0xe9b8('0x72')],_0x6a3f0f[_0xe9b8('0x5c')]);}}}this[_0xe9b8('0x14')][_0x3004ed[_0xe9b8('0x57')]]=_0x6a3f0f;}}}catch(_0x3917a1){logger['error'](_0xe9b8('0x98'),_0x3004ed[_0xe9b8('0x57')],util[_0xe9b8('0x4d')](_0x3917a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe9b8('0xc')][_0xe9b8('0x2b')]=function(_0x34f450){try{if(this[_0xe9b8('0x65')](_0x34f450)){logger[_0xe9b8('0x55')](_0xe9b8('0xae'),_0x34f450['uniqueid'],util[_0xe9b8('0x4d')](_0x34f450,{'showHidden':![],'depth':null}));this[_0xe9b8('0xaf')](_0x34f450[_0xe9b8('0x57')],_['keys'](_0x34f450[_0xe9b8('0xb0')])[0x0],_0x34f450[_0xe9b8('0xb1')]);if(this[_0xe9b8('0x11')][_0x34f450[_0xe9b8('0x57')]]){var _0x1f8eaf=_['last'](this[_0xe9b8('0x11')][_0x34f450[_0xe9b8('0x57')]]);if(_0x1f8eaf){if(this[_0xe9b8('0x65')](_0x34f450['variable'])&&this[_0xe9b8('0x65')](_0x34f450[_0xe9b8('0xb0')][_0xe9b8('0x6b')])){switch(_0x34f450[_0xe9b8('0xb1')]){case _0xe9b8('0xb2'):_0x1f8eaf[_0xe9b8('0x40')]=![];_0x1f8eaf['queuecallerexitAt']=null;break;case _0xe9b8('0xb3'):_0x1f8eaf[_0xe9b8('0xb4')]='timeout';_0x1f8eaf[_0xe9b8('0x40')]=!![];_0x1f8eaf['queuecallerexitAt']=moment()[_0xe9b8('0x58')](_0xe9b8('0x80'));_0x1f8eaf[_0xe9b8('0x92')]=moment()['format'](_0xe9b8('0x80'));logger['debug'](_0xe9b8('0xb5'),_0x34f450[_0xe9b8('0x57')],util[_0xe9b8('0x4d')](_0x1f8eaf,{'showHidden':![],'depth':null}));ami[_0xe9b8('0x53')](_0xe9b8('0xb6'),_0x1f8eaf);break;default:_0x1f8eaf[_0xe9b8('0x40')]=!![];_0x1f8eaf[_0xe9b8('0x9a')]=moment()[_0xe9b8('0x58')](_0xe9b8('0x80'));_0x1f8eaf[_0xe9b8('0x92')]=moment()[_0xe9b8('0x58')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1f8eaf[_0xe9b8('0x23')]=![];_0x1f8eaf[_0xe9b8('0x8d')]=null;_0x1f8eaf[_0xe9b8('0x5c')]=_0x34f450[_0xe9b8('0xb1')];this[_0xe9b8('0x14')][_0x34f450[_0xe9b8('0x57')]]=_0x1f8eaf;this['emitVoiceQueueChannelRemove'](_0x1f8eaf,_0xe9b8('0x2a'));}else if(this[_0xe9b8('0x65')](_0x34f450['variable'])&&this['isNotNull'](_0x34f450[_0xe9b8('0xb0')][_0xe9b8('0xb7')])){if(!_0x1f8eaf[_0xe9b8('0x23')]){_0x1f8eaf[_0xe9b8('0x40')]=!![];_0x1f8eaf[_0xe9b8('0x9a')]=moment()['format'](_0xe9b8('0x80'));_0x1f8eaf[_0xe9b8('0x5c')]=_0xe9b8('0xb8');_0x1f8eaf[_0xe9b8('0x92')]=moment()[_0xe9b8('0x58')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x34f450[_0xe9b8('0x57')]]=_0x1f8eaf;}}logger[_0xe9b8('0x84')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x34f450['uniqueid'],_0x1f8eaf['queue'],_0x1f8eaf[_0xe9b8('0x72')],_[_0xe9b8('0x87')](_0x34f450[_0xe9b8('0xb0')])[0x0],_0x34f450['value']);_0x1f8eaf[_0xe9b8('0x19')]=this[_0xe9b8('0x19')][_0x34f450['uniqueid']];}}}}catch(_0x40f2e5){logger[_0xe9b8('0x4b')](_0xe9b8('0xae'),_0x34f450[_0xe9b8('0x57')],util['inspect'](_0x40f2e5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe9b8('0xc')][_0xe9b8('0xaf')]=function(_0x5f3ca1,_0x1595b0,_0x4883f2){var _0x3af5a6=['rtpaudioqos',_0xe9b8('0xb9'),'rtpaudioqosjitter',_0xe9b8('0xba'),_0xe9b8('0xbb'),_0xe9b8('0xbc'),_0xe9b8('0xbd'),'rtpaudioqosrttbridged',_0xe9b8('0xbe'),_0xe9b8('0xbf'),'bridgepeer',_0xe9b8('0xc0'),_0xe9b8('0xc1'),_0xe9b8('0xc2'),_0xe9b8('0xc3'),'memberlastcall',_0xe9b8('0xc4'),'memberpenalty',_0xe9b8('0xc5')];if(!_['isNil'](_0x1595b0)&&!_['includes'](_0x3af5a6,_0x1595b0)){if(_['isUndefined'](this['variables'][_0x5f3ca1])){this[_0xe9b8('0x19')][_0x5f3ca1]={};}this[_0xe9b8('0x19')][_0x5f3ca1][_0x1595b0]=_0x4883f2;}};VoiceQueueReport[_0xe9b8('0xc')][_0xe9b8('0xc6')]=function(_0x455d85,_0x5d94ce,_0x579d4d){try{var _0x4578d3={};if(this[_0xe9b8('0x11')][_0x455d85]){for(var _0x1f8866=0x0;_0x1f8866=0x0?moment(_0x180ef5[_0x3319('0x15')])[_0x3319('0x16')](_0x180ef5[_0x3319('0x17')],_0x3319('0xd')):null,'data1':_0x3319('0x18'),'data2':_0x180ef5[_0x3319('0x11')],'data3':_0x180ef5[_0x3319('0x19')],'data4':_0x180ef5[_0x3319('0x1a')]||null,'role':_0x3319('0x10'),'internal':_0x180ef5[_0x3319('0x11')]?_['toNumber'](_0x180ef5[_0x3319('0x11')]):undefined,'uniqueid':_0x180ef5[_0x3319('0x12')]},'log':_0x3319('0x6')});}; \ No newline at end of file +var _0xe081=['TALKING','queuecallerleaveAt','diff','seconds','exten','queue','agent','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','format','SIP/%s'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0xe081,0x16b));var _0x1e08=function(_0x3537a1,_0x32d760){_0x3537a1=_0x3537a1-0x0;var _0x324a86=_0xe081[_0x3537a1];return _0x324a86;};'use strict';var moment=require(_0x1e08('0x0'));var _=require(_0x1e08('0x1'));var util=require(_0x1e08('0x2'));var client=require(_0x1e08('0x3'));exports[_0x1e08('0x4')]=function(_0x52ffaf){var _0x35279b=_0x52ffaf[_0x1e08('0x5')]||_0x52ffaf[_0x1e08('0x6')];return client[_0x1e08('0x7')](_0x1e08('0x8'),{'body':{'channel':_0x1e08('0x9'),'membername':_0x52ffaf[_0x1e08('0xa')],'interface':_['isNil'](_0x52ffaf[_0x1e08('0xb')])?util[_0x1e08('0xc')](_0x1e08('0xd'),_0x52ffaf[_0x1e08('0xa')]):_0x52ffaf[_0x1e08('0xb')],'type':_0x1e08('0xe'),'enterAt':_0x52ffaf[_0x1e08('0xf')],'exitAt':_0x35279b,'duration':moment(_0x35279b)[_0x1e08('0x10')](_0x52ffaf[_0x1e08('0xf')],_0x1e08('0x11')),'data1':'inbound','data2':_0x52ffaf['calleridnum'],'data3':_0x52ffaf[_0x1e08('0x12')],'data4':null,'data5':_0x52ffaf[_0x1e08('0x13')],'role':_0x1e08('0x14'),'internal':_0x52ffaf[_0x1e08('0x15')]?_['toNumber'](_0x52ffaf['accountcode']):undefined,'uniqueid':_0x52ffaf[_0x1e08('0x16')]},'log':_0x1e08('0x8')});};exports[_0x1e08('0x17')]=function(_0x24a787){return client['Request']('CreateMemberReport',{'body':{'channel':_0x1e08('0x9'),'membername':_0x24a787[_0x1e08('0x18')],'interface':_0x24a787['interface'],'type':'TALKING','enterAt':_0x24a787[_0x1e08('0x19')],'exitAt':_0x24a787[_0x1e08('0x1a')],'duration':moment(_0x24a787[_0x1e08('0x1a')])['diff'](_0x24a787[_0x1e08('0x19')],_0x1e08('0x11'))>=0x0?moment(_0x24a787[_0x1e08('0x1a')])['diff'](_0x24a787['starttime'],_0x1e08('0x11')):null,'data1':_0x1e08('0x1b'),'data2':_0x24a787[_0x1e08('0x15')],'data3':_0x24a787[_0x1e08('0x12')],'data4':_0x24a787[_0x1e08('0x1c')]||null,'role':_0x1e08('0x14'),'internal':_0x24a787[_0x1e08('0x15')]?_['toNumber'](_0x24a787[_0x1e08('0x15')]):undefined,'uniqueid':_0x24a787[_0x1e08('0x16')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index eed7e47..d80f4ed 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 _0x3080=['../client','getSettings','Request','ShowSetting','previewRecallmeReminderInterval','GetSettings'];(function(_0x16eb73,_0x11c17c){var _0x4c0bcf=function(_0x1bf45f){while(--_0x1bf45f){_0x16eb73['push'](_0x16eb73['shift']());}};_0x4c0bcf(++_0x11c17c);}(_0x3080,0x1e6));var _0x0308=function(_0x9fce09,_0x5adccb){_0x9fce09=_0x9fce09-0x0;var _0x19ac2b=_0x3080[_0x9fce09];return _0x19ac2b;};'use strict';var client=require(_0x0308('0x0'));exports[_0x0308('0x1')]=function(){return client[_0x0308('0x2')](_0x0308('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x0308('0x4')]},'log':_0x0308('0x5')});}; \ No newline at end of file +var _0x6d77=['getSettings','Request','ShowSetting','previewRecallmeReminderInterval','../client'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0x6d77,0x13a));var _0x76d7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6d77[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0x76d7('0x0'));exports[_0x76d7('0x1')]=function(){return client[_0x76d7('0x2')](_0x76d7('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x76d7('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 0425768..91b35e7 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 _0x1f65=['getTemplates','Request','name','html','GetTemplate','../client'];(function(_0x4c68bd,_0x187912){var _0x2af91c=function(_0x53f13c){while(--_0x53f13c){_0x4c68bd['push'](_0x4c68bd['shift']());}};_0x2af91c(++_0x187912);}(_0x1f65,0x185));var _0x51f6=function(_0x33ac28,_0xbcde95){_0x33ac28=_0x33ac28-0x0;var _0x263076=_0x1f65[_0x33ac28];return _0x263076;};'use strict';var client=require(_0x51f6('0x0'));exports[_0x51f6('0x1')]=function(_0xdd6894){return function(_0x565034){return client[_0x51f6('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x51f6('0x3'),_0x51f6('0x4')]},'log':_0x51f6('0x5')});};}; \ No newline at end of file +var _0x3e9f=['name','html','../client','getTemplates','GetTemplate'];(function(_0x4171f3,_0x1c14e8){var _0x3aff23=function(_0xb2113a){while(--_0xb2113a){_0x4171f3['push'](_0x4171f3['shift']());}};_0x3aff23(++_0x1c14e8);}(_0x3e9f,0x98));var _0xf3e9=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x3e9f[_0x21549c];return _0x426cbd;};'use strict';var client=require(_0xf3e9('0x0'));exports[_0xf3e9('0x1')]=function(_0x431bff){return function(_0xa5c566){return client['Request'](_0xf3e9('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf3e9('0x3'),_0xf3e9('0x4')]},'log':_0xf3e9('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index fa61859..c8601ea 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 _0xc5ad=['field','operator','value','Actions','action','data1','data2','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition'];(function(_0x1a9390,_0x3339e6){var _0x2b4514=function(_0x1c07d5){while(--_0x1c07d5){_0x1a9390['push'](_0x1a9390['shift']());}};_0x2b4514(++_0x3339e6);}(_0xc5ad,0x1d4));var _0xdc5a=function(_0x34bf78,_0x52cffc){_0x34bf78=_0x34bf78-0x0;var _0x38cf0c=_0xc5ad[_0x34bf78];return _0x38cf0c;};'use strict';var client=require(_0xdc5a('0x0'));exports[_0xdc5a('0x1')]=function(_0x3f419e){return function(_0x3a2b24){return client[_0xdc5a('0x2')](_0xdc5a('0x3'),{'options':{'raw':![],'attributes':['id',_0xdc5a('0x4'),_0xdc5a('0x5'),_0xdc5a('0x6')],'include':[{'model':_0xdc5a('0x7'),'as':'AllConditions','attributes':['id',_0xdc5a('0x8'),_0xdc5a('0x9'),_0xdc5a('0xa')]},{'model':_0xdc5a('0x7'),'as':'AnyConditions','attributes':['id',_0xdc5a('0x8'),_0xdc5a('0x9'),_0xdc5a('0xa')]},{'model':'Action','as':_0xdc5a('0xb'),'attributes':['id',_0xdc5a('0xc'),_0xdc5a('0xd'),_0xdc5a('0xe'),'data3','data4','data5',_0xdc5a('0xf'),_0xdc5a('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xdacc=['getTriggers','Request','channel','status','AllConditions','field','Condition','AnyConditions','operator','action','data1','data3','data4','data5','data6','data7','GetTrigger','../client'];(function(_0x1bb926,_0x58f074){var _0x53508e=function(_0xe3bc33){while(--_0xe3bc33){_0x1bb926['push'](_0x1bb926['shift']());}};_0x53508e(++_0x58f074);}(_0xdacc,0xb3));var _0xcdac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdacc[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xcdac('0x0'));exports[_0xcdac('0x1')]=function(_0x573f89){return function(_0x5e3b8e){return client[_0xcdac('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0xcdac('0x3'),_0xcdac('0x4')],'include':[{'model':'Condition','as':_0xcdac('0x5'),'attributes':['id',_0xcdac('0x6'),'operator','value']},{'model':_0xcdac('0x7'),'as':_0xcdac('0x8'),'attributes':['id',_0xcdac('0x6'),_0xcdac('0x9'),'value']},{'model':'Action','as':'Actions','attributes':['id',_0xcdac('0xa'),_0xcdac('0xb'),'data2',_0xcdac('0xc'),_0xcdac('0xd'),_0xcdac('0xe'),_0xcdac('0xf'),_0xcdac('0x10')]}]},'log':_0xcdac('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 1668e10..3232798 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 _0x6a88=['defaultuser','../client','getTrunks','Request','GetTrunk','name'];(function(_0x1c0781,_0x4a19f1){var _0x1f577e=function(_0x396577){while(--_0x396577){_0x1c0781['push'](_0x1c0781['shift']());}};_0x1f577e(++_0x4a19f1);}(_0x6a88,0xa9));var _0x86a8=function(_0x580e99,_0x32049e){_0x580e99=_0x580e99-0x0;var _0x217605=_0x6a88[_0x580e99];return _0x217605;};'use strict';var client=require(_0x86a8('0x0'));exports[_0x86a8('0x1')]=function(_0x4346ff){return function(_0x3c2a38){return client[_0x86a8('0x2')](_0x86a8('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x86a8('0x4'),'registry',_0x86a8('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x2794=['defaultuser','../client','GetTrunk','name','registry'];(function(_0x4bc156,_0x5ab86e){var _0x33c7da=function(_0x4118f5){while(--_0x4118f5){_0x4bc156['push'](_0x4bc156['shift']());}};_0x33c7da(++_0x5ab86e);}(_0x2794,0x1b9));var _0x4279=function(_0x185f38,_0x5e618f){_0x185f38=_0x185f38-0x0;var _0x3fb6e9=_0x2794[_0x185f38];return _0x3fb6e9;};'use strict';var client=require(_0x4279('0x0'));exports['getTrunks']=function(_0x37f23c){return function(_0x5c4c9f){return client['Request'](_0x4279('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x4279('0x2'),_0x4279('0x3'),_0x4279('0x4')]},'log':_0x4279('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index b0f57b2..f743f29 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x41725a,_0x2fc8b3){var _0x913b2d=function(_0x5c7e9e){while(--_0x5c7e9e){_0x41725a['push'](_0x41725a['shift']());}};_0x913b2d(++_0x2fc8b3);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x5b3764,_0xd0599e){var _0x405608=function(_0x2ca700){while(--_0x2ca700){_0x5b3764['push'](_0x5b3764['shift']());}};_0x405608(++_0xd0599e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index c89b3bf..ee63600 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 _0xe7c0=['UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xe7c0,0x141));var _0x0e7c=function(_0x15bf58,_0x170ea4){_0x15bf58=_0x15bf58-0x0;var _0x5d6c96=_0xe7c0[_0x15bf58];return _0x5d6c96;};'use strict';var client=require('../client');exports[_0x0e7c('0x0')]=function(_0x17823b){return client[_0x0e7c('0x1')](_0x0e7c('0x2'),{'body':_0x17823b,'log':_0x0e7c('0x2')});};exports['update']=function(_0x436b4d,_0x1c3746,_0x1d0a1f){return client[_0x0e7c('0x1')](_0x0e7c('0x3'),{'body':_0x436b4d,'options':{'where':{'uniqueid':_0x1c3746,'interface':_0x1d0a1f,'agentcomplete':!![]}},'log':_0x0e7c('0x3')});}; \ No newline at end of file +var _0x70d1=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x4ddf82,_0x51a8ab){var _0x131c0d=function(_0x4df815){while(--_0x4df815){_0x4ddf82['push'](_0x4ddf82['shift']());}};_0x131c0d(++_0x51a8ab);}(_0x70d1,0x192));var _0x170d=function(_0x48f827,_0x269e8d){_0x48f827=_0x48f827-0x0;var _0xc763f7=_0x70d1[_0x48f827];return _0xc763f7;};'use strict';var client=require(_0x170d('0x0'));exports[_0x170d('0x1')]=function(_0x5353b1){return client[_0x170d('0x2')](_0x170d('0x3'),{'body':_0x5353b1,'log':_0x170d('0x3')});};exports[_0x170d('0x4')]=function(_0x5d145e,_0x2254ad,_0x4c67a0){return client['Request']('UpdateVoiceAgentReport',{'body':_0x5d145e,'options':{'where':{'uniqueid':_0x2254ad,'interface':_0x4c67a0,'agentcomplete':!![]}},'log':_0x170d('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3d504a0..b58f967 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 _0x1205=['type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','Request','calleridnum','context','DOCUMENTATION','CreateVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format'];(function(_0x20aaf4,_0x472881){var _0x1bc34c=function(_0x3bd8ca){while(--_0x3bd8ca){_0x20aaf4['push'](_0x20aaf4['shift']());}};_0x1bc34c(++_0x472881);}(_0x1205,0x195));var _0x5120=function(_0x3c3149,_0x107a9f){_0x3c3149=_0x3c3149-0x0;var _0x584e62=_0x1205[_0x3c3149];return _0x584e62;};'use strict';var moment=require(_0x5120('0x0'));var util=require(_0x5120('0x1'));var _=require(_0x5120('0x2'));var client=require(_0x5120('0x3'));exports['create']=function(_0x13a183){return client[_0x5120('0x4')]('CreateVoiceCallReport',{'body':_['merge'](_0x13a183,{'source':_0x13a183[_0x5120('0x5')],'destinationcontext':_0x13a183[_0x5120('0x6')],'callerid':_0x13a183['callerid'],'amaflags':_0x5120('0x7')}),'log':_0x5120('0x8')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x5120('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x5120('0x9')],'createdAt':{'$between':[moment()[_0x5120('0xa')](_0x5120('0xb'))['format'](_0x5120('0xc')),moment()[_0x5120('0xd')]('day')[_0x5120('0xe')](_0x5120('0xc'))]}},'attributes':[_0x5120('0xf'),_0x5120('0x10'),_0x5120('0x11'),_0x5120('0x12')]},'log':_0x5120('0x13')});};}; \ No newline at end of file +var _0xd1fb=['CreateVoiceCallReport','calleridnum','context','callerid','GetVoiceCallReport','outbound','startOf','day','format','type','disposition','duration','billableseconds','GetVoiceCallReports','lodash','../client','create','Request'];(function(_0x2bf36f,_0x4648d9){var _0x42a44b=function(_0x32e2bc){while(--_0x32e2bc){_0x2bf36f['push'](_0x2bf36f['shift']());}};_0x42a44b(++_0x4648d9);}(_0xd1fb,0x12e));var _0xbd1f=function(_0x597b6e,_0x3ae6b3){_0x597b6e=_0x597b6e-0x0;var _0x52b268=_0xd1fb[_0x597b6e];return _0x52b268;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0xbd1f('0x0'));var client=require(_0xbd1f('0x1'));exports[_0xbd1f('0x2')]=function(_0x3992af){return client[_0xbd1f('0x3')](_0xbd1f('0x4'),{'body':_['merge'](_0x3992af,{'source':_0x3992af[_0xbd1f('0x5')],'destinationcontext':_0x3992af[_0xbd1f('0x6')],'callerid':_0x3992af[_0xbd1f('0x7')],'amaflags':'DOCUMENTATION'}),'log':_0xbd1f('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xbd1f('0x3')](_0xbd1f('0x8'),{'options':{'where':{'type':[_0xbd1f('0x9')],'createdAt':{'$between':[moment()[_0xbd1f('0xa')](_0xbd1f('0xb'))[_0xbd1f('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xbd1f('0xb'))[_0xbd1f('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xbd1f('0xd'),_0xbd1f('0xe'),_0xbd1f('0xf'),_0xbd1f('0x10')]},'log':_0xbd1f('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8b83f2e..3fff481 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 _0x51b2=['CreateVoiceDialReport','../client','create','Request'];(function(_0x4f88e5,_0x5f546d){var _0xe57f0d=function(_0x10691e){while(--_0x10691e){_0x4f88e5['push'](_0x4f88e5['shift']());}};_0xe57f0d(++_0x5f546d);}(_0x51b2,0x1ad));var _0x251b=function(_0x4b0008,_0x41218b){_0x4b0008=_0x4b0008-0x0;var _0x401c96=_0x51b2[_0x4b0008];return _0x401c96;};'use strict';var client=require(_0x251b('0x0'));exports[_0x251b('0x1')]=function(_0x1fd05c){return client[_0x251b('0x2')](_0x251b('0x3'),{'body':_0x1fd05c,'log':_0x251b('0x3')});}; \ No newline at end of file +var _0xe168=['Request','CreateVoiceDialReport','../client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe168,0xce));var _0x8e16=function(_0x4d5379,_0x4557ab){_0x4d5379=_0x4d5379-0x0;var _0x5ca8f9=_0xe168[_0x4d5379];return _0x5ca8f9;};'use strict';var client=require(_0x8e16('0x0'));exports['create']=function(_0x4a5981){return client[_0x8e16('0x1')](_0x8e16('0x2'),{'body':_0x4a5981,'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 3ba166e..387020f 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 _0x2917=['Request','GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2917,0x142));var _0x7291=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0x2917[_0xf4666e];return _0x1853f1;};'use strict';var client=require(_0x7291('0x0'));exports[_0x7291('0x1')]=function(){return function(){return client[_0x7291('0x2')](_0x7291('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7291('0x4'),_0x7291('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x7291('0x1')});};}; \ No newline at end of file +var _0x1123=['Request','exten','recordingFormat','getVoiceExtensions'];(function(_0x17d25b,_0x3f0a01){var _0x301afc=function(_0x1e212e){while(--_0x1e212e){_0x17d25b['push'](_0x17d25b['shift']());}};_0x301afc(++_0x3f0a01);}(_0x1123,0x118));var _0x3112=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1123[_0x17d9e3];return _0x14192d;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x3112('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x3112('0x1'),_0x3112('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x3112('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 55faf47..e249f21 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 _0xb371=['name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Interval','Intervals','interval','getVoiceQueues','Request'];(function(_0x2fa27b,_0x38f64c){var _0x5c5fd6=function(_0xf628a1){while(--_0xf628a1){_0x2fa27b['push'](_0x2fa27b['shift']());}};_0x5c5fd6(++_0x38f64c);}(_0xb371,0x1a9));var _0x1b37=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xb371[_0x1e4360];return _0x31e6b4;};'use strict';var client=require('../client');exports[_0x1b37('0x0')]=function(){return function(){return client[_0x1b37('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x1b37('0x2'),_0x1b37('0x3'),_0x1b37('0x4'),_0x1b37('0x5'),_0x1b37('0x6'),_0x1b37('0x7'),_0x1b37('0x8'),_0x1b37('0x9'),'dialLimitChannel',_0x1b37('0xa'),_0x1b37('0xb'),_0x1b37('0xc'),_0x1b37('0xd'),_0x1b37('0xe'),_0x1b37('0xf'),_0x1b37('0x10'),_0x1b37('0x11'),_0x1b37('0x12'),_0x1b37('0x13'),_0x1b37('0x14'),_0x1b37('0x15'),_0x1b37('0x16'),_0x1b37('0x17'),_0x1b37('0x18'),_0x1b37('0x19'),_0x1b37('0x1a'),_0x1b37('0x1b'),'dialTimezone',_0x1b37('0x1c'),_0x1b37('0x1d'),'dialCheckDuplicateType',_0x1b37('0x1e'),'dialAMDInitialSilence',_0x1b37('0x1f'),'dialAMDAfterGreetingSilence',_0x1b37('0x20'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x1b37('0x21'),_0x1b37('0x22'),'dialAMDMaximumWordLength',_0x1b37('0x23'),_0x1b37('0x24'),'dialRecallInQueue',_0x1b37('0x25'),_0x1b37('0x26'),_0x1b37('0x27'),_0x1b37('0x28'),'monitor_format',_0x1b37('0x29'),_0x1b37('0x2a'),_0x1b37('0x2b'),_0x1b37('0x2c'),_0x1b37('0x2d'),'dialDropMaxRetry',_0x1b37('0x2e'),'dialAbandonedMaxRetry',_0x1b37('0x2f'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x1b37('0x30'),_0x1b37('0x31'),_0x1b37('0x32'),_0x1b37('0x33'),_0x1b37('0x34'),_0x1b37('0x35'),_0x1b37('0x36')],'include':[{'model':_0x1b37('0x37'),'as':_0x1b37('0x37'),'attributes':['id',_0x1b37('0x2'),_0x1b37('0x38'),_0x1b37('0x39')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0x1b37('0x2')]},{'model':_0x1b37('0x37'),'as':'TrunkBackup','attributes':['id',_0x1b37('0x2'),_0x1b37('0x38'),_0x1b37('0x39')]},{'model':_0x1b37('0x3a'),'as':'Interval','attributes':['id',_0x1b37('0x2')],'include':[{'model':_0x1b37('0x3a'),'as':_0x1b37('0x3b'),'attributes':['id',_0x1b37('0x2'),_0x1b37('0x3c')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xb869=['type','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','interval','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format'];(function(_0x531ffd,_0xe6e95){var _0x58eb1f=function(_0x4a1ac){while(--_0x4a1ac){_0x531ffd['push'](_0x531ffd['shift']());}};_0x58eb1f(++_0xe6e95);}(_0xb869,0xde));var _0x9b86=function(_0x49ad1c,_0x45c36b){_0x49ad1c=_0x49ad1c-0x0;var _0x58714d=_0xb869[_0x49ad1c];return _0x58714d;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0x9b86('0x0')](_0x9b86('0x1'),{'options':{'raw':![],'attributes':['id',_0x9b86('0x2'),'acw',_0x9b86('0x3'),_0x9b86('0x4'),_0x9b86('0x5'),_0x9b86('0x6'),'dialActive','dialMethod',_0x9b86('0x7'),'dialLimitQueue',_0x9b86('0x8'),_0x9b86('0x9'),_0x9b86('0xa'),_0x9b86('0xb'),_0x9b86('0xc'),_0x9b86('0xd'),_0x9b86('0xe'),_0x9b86('0xf'),'dialQueueTimeout',_0x9b86('0x10'),_0x9b86('0x11'),_0x9b86('0x12'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x9b86('0x13'),'dialNoAnswerRetryFrequency',_0x9b86('0x14'),_0x9b86('0x15'),_0x9b86('0x16'),_0x9b86('0x17'),'dialCheckDuplicateType',_0x9b86('0x18'),_0x9b86('0x19'),'dialAMDGreeting',_0x9b86('0x1a'),_0x9b86('0x1b'),'dialAMDMinWordLength',_0x9b86('0x1c'),'dialAMDMaximumNumberOfWords',_0x9b86('0x1d'),'dialAMDMaximumWordLength','timeout',_0x9b86('0x1e'),_0x9b86('0x1f'),_0x9b86('0x20'),_0x9b86('0x21'),_0x9b86('0x22'),'dialQueueProject2','monitor_format',_0x9b86('0x23'),_0x9b86('0x24'),'dialCutDigit',_0x9b86('0x25'),_0x9b86('0x26'),_0x9b86('0x27'),_0x9b86('0x28'),_0x9b86('0x29'),_0x9b86('0x2a'),_0x9b86('0x2b'),_0x9b86('0x2c'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition',_0x9b86('0x2d'),_0x9b86('0x2e'),_0x9b86('0x2f'),_0x9b86('0x30')],'include':[{'model':_0x9b86('0x31'),'as':'Trunk','attributes':['id',_0x9b86('0x2'),_0x9b86('0x32'),_0x9b86('0x33')]},{'model':'Pause','as':_0x9b86('0x34'),'attributes':['id',_0x9b86('0x2')]},{'model':_0x9b86('0x31'),'as':_0x9b86('0x35'),'attributes':['id',_0x9b86('0x2'),_0x9b86('0x32'),_0x9b86('0x33')]},{'model':_0x9b86('0x36'),'as':'Interval','attributes':['id',_0x9b86('0x2')],'include':[{'model':_0x9b86('0x36'),'as':'Intervals','attributes':['id','name',_0x9b86('0x37')]}]}]},'log':_0x9b86('0x38')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d91a4b0..6a04f3d 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(_0x308450,_0x47d83c){var _0x62fc54=function(_0x133e36){while(--_0x133e36){_0x308450['push'](_0x308450['shift']());}};_0x62fc54(++_0x47d83c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x17e633,_0x59aa38){var _0x7dc04d=function(_0x1730b5){while(--_0x1730b5){_0x17e633['push'](_0x17e633['shift']());}};_0x7dc04d(++_0x59aa38);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 0a82c7f..933a553 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 _0xcc8f=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xcc8f,0x1e5));var _0xfcc8=function(_0x41e172,_0x4b0cf9){_0x41e172=_0x41e172-0x0;var _0x3cbda2=_0xcc8f[_0x41e172];return _0x3cbda2;};'use strict';var client=require(_0xfcc8('0x0'));exports[_0xfcc8('0x1')]=function(_0x478212){return function(){return client['Request'](_0xfcc8('0x2'),{'options':{'where':{'VoiceQueueId':_0x478212,'paused':!![]},'raw':!![]},'log':_0xfcc8('0x1')});};}; \ No newline at end of file +var _0xc634=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x5c1449,_0x2af4b4){var _0x270473=function(_0x1461b6){while(--_0x1461b6){_0x5c1449['push'](_0x5c1449['shift']());}};_0x270473(++_0x2af4b4);}(_0xc634,0x1d7));var _0x4c63=function(_0x3b9060,_0x3a34af){_0x3b9060=_0x3b9060-0x0;var _0x25fdc9=_0xc634[_0x3b9060];return _0x25fdc9;};'use strict';var client=require('../client');exports[_0x4c63('0x0')]=function(_0x5509b9){return function(){return client[_0x4c63('0x1')](_0x4c63('0x2'),{'options':{'where':{'VoiceQueueId':_0x5509b9,'paused':!![]},'raw':!![]},'log':_0x4c63('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 47ad116..8462b24 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(_0x30b557,_0x57041b){var _0x286fe6=function(_0x2548f6){while(--_0x2548f6){_0x30b557['push'](_0x30b557['shift']());}};_0x286fe6(++_0x57041b);}(_0x7a54,0x106));var _0x47a5=function(_0x39a746,_0x4d6ff2){_0x39a746=_0x39a746-0x0;var _0x1588bc=_0x7a54[_0x39a746];return _0x1588bc;};'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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x4f634f,_0x643f42){var _0x156619=function(_0x319ace){while(--_0x319ace){_0x4f634f['push'](_0x4f634f['shift']());}};_0x156619(++_0x643f42);}(_0x7a54,0x106));var _0x47a5=function(_0x28199f,_0x24e503){_0x28199f=_0x28199f-0x0;var _0x408d38=_0x7a54[_0x28199f];return _0x408d38;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 6a2ff21..c7ae561 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 _0xfd9c=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x4702d5,_0x407c8a){var _0x30fd67=function(_0x2964ed){while(--_0x2964ed){_0x4702d5['push'](_0x4702d5['shift']());}};_0x30fd67(++_0x407c8a);}(_0xfd9c,0x102));var _0xcfd9=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0xfd9c[_0x334599];return _0x4cdff2;};'use strict';var client=require(_0xcfd9('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x2031f7){return client[_0xcfd9('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x2031f7[_0xcfd9('0x2')],'transfererchannel':_0x2031f7['transfererchannel'],'transferercalleridnum':_0x2031f7[_0xcfd9('0x3')],'transferercalleridname':_0x2031f7[_0xcfd9('0x4')],'transfererconnectedlinenum':_0x2031f7[_0xcfd9('0x5')],'transfererconnectedlinename':_0x2031f7[_0xcfd9('0x6')],'transfereraccountcode':_0x2031f7[_0xcfd9('0x7')],'transferercontext':_0x2031f7[_0xcfd9('0x8')],'transfererexten':_0x2031f7[_0xcfd9('0x9')],'transfererlinkedid':_0x2031f7[_0xcfd9('0xa')],'transfereechannel':_0x2031f7[_0xcfd9('0xb')],'transfereecalleridnum':_0x2031f7[_0xcfd9('0xc')],'transfereecalleridname':_0x2031f7[_0xcfd9('0xd')],'transfereeconnectedlinenum':_0x2031f7[_0xcfd9('0xe')],'transfereeconnectedlinename':_0x2031f7[_0xcfd9('0xf')],'transfereeaccountcode':_0x2031f7['transfereeaccountcode'],'transfereecontext':_0x2031f7['transfereecontext'],'transfereeexten':_0x2031f7[_0xcfd9('0x10')],'transfereelinkedid':_0x2031f7[_0xcfd9('0x11')],'isexternal':_0x2031f7[_0xcfd9('0x12')],'context':_0x2031f7[_0xcfd9('0x13')],'extension':_0x2031f7[_0xcfd9('0x14')],'type':_0xcfd9('0x15')},'log':_0xcfd9('0x16')});};exports[_0xcfd9('0x17')]=function(_0x2a4035){return client[_0xcfd9('0x1')](_0xcfd9('0x16'),{'body':{'result':_0x2a4035['result'],'transfererchannel':_0x2a4035[_0xcfd9('0x18')],'transferercalleridnum':_0x2a4035['origtransferercalleridnum'],'transferercalleridname':_0x2a4035[_0xcfd9('0x19')],'transfererconnectedlinenum':_0x2a4035[_0xcfd9('0x1a')],'transfererconnectedlinename':_0x2a4035[_0xcfd9('0x1b')],'transfereraccountcode':_0x2a4035[_0xcfd9('0x1c')],'transferercontext':_0x2a4035[_0xcfd9('0x1d')],'transfererexten':_0x2a4035[_0xcfd9('0x1e')],'transfererlinkedid':_0x2a4035[_0xcfd9('0x1f')],'transfereechannel':_0x2a4035[_0xcfd9('0x20')],'transfereecalleridnum':_0x2a4035[_0xcfd9('0x21')],'transfereecalleridname':_0x2a4035['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2a4035[_0xcfd9('0x22')],'transfereeconnectedlinename':_0x2a4035['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2a4035[_0xcfd9('0x23')],'transfereecontext':_0x2a4035[_0xcfd9('0x24')],'transfereeexten':_0x2a4035[_0xcfd9('0x25')],'transfereelinkedid':_0x2a4035[_0xcfd9('0x26')],'isexternal':_0x2a4035[_0xcfd9('0x12')],'context':_0x2a4035['origtransferercontext'],'extension':_0x2a4035[_0xcfd9('0x27')],'type':_0xcfd9('0x28')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x5285=['transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','transfertargetchannel'];(function(_0x4ec6cf,_0x160045){var _0x38ee7d=function(_0x2c0369){while(--_0x2c0369){_0x4ec6cf['push'](_0x4ec6cf['shift']());}};_0x38ee7d(++_0x160045);}(_0x5285,0xaf));var _0x5528=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x5285[_0x3054be];return _0x3df150;};'use strict';var client=require(_0x5528('0x0'));exports[_0x5528('0x1')]={};exports[_0x5528('0x2')]=function(_0x10f178){return client[_0x5528('0x3')](_0x5528('0x4'),{'body':{'result':_0x10f178[_0x5528('0x5')],'transfererchannel':_0x10f178['transfererchannel'],'transferercalleridnum':_0x10f178[_0x5528('0x6')],'transferercalleridname':_0x10f178[_0x5528('0x7')],'transfererconnectedlinenum':_0x10f178['transfererconnectedlinenum'],'transfererconnectedlinename':_0x10f178[_0x5528('0x8')],'transfereraccountcode':_0x10f178[_0x5528('0x9')],'transferercontext':_0x10f178['transferercontext'],'transfererexten':_0x10f178[_0x5528('0xa')],'transfererlinkedid':_0x10f178[_0x5528('0xb')],'transfereechannel':_0x10f178[_0x5528('0xc')],'transfereecalleridnum':_0x10f178['transfereecalleridnum'],'transfereecalleridname':_0x10f178[_0x5528('0xd')],'transfereeconnectedlinenum':_0x10f178[_0x5528('0xe')],'transfereeconnectedlinename':_0x10f178[_0x5528('0xf')],'transfereeaccountcode':_0x10f178[_0x5528('0x10')],'transfereecontext':_0x10f178[_0x5528('0x11')],'transfereeexten':_0x10f178[_0x5528('0x12')],'transfereelinkedid':_0x10f178[_0x5528('0x13')],'isexternal':_0x10f178[_0x5528('0x14')],'context':_0x10f178[_0x5528('0x15')],'extension':_0x10f178['extension'],'type':_0x5528('0x16')},'log':_0x5528('0x4')});};exports[_0x5528('0x17')]=function(_0x440837){return client[_0x5528('0x3')](_0x5528('0x4'),{'body':{'result':_0x440837[_0x5528('0x5')],'transfererchannel':_0x440837[_0x5528('0x18')],'transferercalleridnum':_0x440837[_0x5528('0x19')],'transferercalleridname':_0x440837['origtransferercalleridname'],'transfererconnectedlinenum':_0x440837[_0x5528('0x1a')],'transfererconnectedlinename':_0x440837[_0x5528('0x1b')],'transfereraccountcode':_0x440837['origtransfereraccountcode'],'transferercontext':_0x440837[_0x5528('0x1c')],'transfererexten':_0x440837['secondtransfererexten'],'transfererlinkedid':_0x440837['origtransfererlinkedid'],'transfereechannel':_0x440837[_0x5528('0x1d')],'transfereecalleridnum':_0x440837[_0x5528('0x1e')],'transfereecalleridname':_0x440837[_0x5528('0x1f')],'transfereeconnectedlinenum':_0x440837[_0x5528('0x20')],'transfereeconnectedlinename':_0x440837[_0x5528('0x21')],'transfereeaccountcode':_0x440837[_0x5528('0x22')],'transfereecontext':_0x440837[_0x5528('0x23')],'transfereeexten':_0x440837[_0x5528('0x24')],'transfereelinkedid':_0x440837[_0x5528('0x25')],'isexternal':_0x440837[_0x5528('0x14')],'context':_0x440837[_0x5528('0x26')],'extension':_0x440837[_0x5528('0x27')],'type':_0x5528('0x28')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b88e19b..fa99bd2 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 _0xf2ca=['module','action','Reload','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','voicechannel','validate','map','uniqueid','%s.%s','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','Action','StopMixMonitor','stop','filename','StopMixMonitor\x20Success','queueChannels','type','inbound','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','run','event','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','lodash','util','jayson/promise','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','SIP','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','reload'];(function(_0x3ad06e,_0x2cc9af){var _0xa97338=function(_0x387190){while(--_0x387190){_0x3ad06e['push'](_0x3ad06e['shift']());}};_0xa97338(++_0x2cc9af);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0xf2ca[_0x1177d5];return _0xc3ddc2;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var jayson=require(_0xaf2c('0x2'));var schema=require('validate');var moment=require(_0xaf2c('0x3'));var config=require(_0xaf2c('0x4'));var properties=require(_0xaf2c('0x5'));var ami=require(_0xaf2c('0x6'));var VoiceQueueSummary=require(_0xaf2c('0x7'));exports[_0xaf2c('0x8')]=function(_0x5b8c81,_0x1fd101,_0x100d17){return new Promise(function(_0x297740,_0x1f9531){var _0x58351f={'QueuePause':function(_0x37fedd){return new Promise(function(_0x3c0421){var _0x4a7397=util[_0xaf2c('0x9')]('%s/%s',_0xaf2c('0xa'),_0x37fedd['name']);if(_0x5b8c81[_0xaf2c('0xb')]&&_0x5b8c81[_0xaf2c('0xb')][_0x4a7397]&&_0x5b8c81[_0xaf2c('0xb')][_0x4a7397][_0xaf2c('0xc')]){_0x5b8c81['timers'][_0x4a7397]['updateAcw']();}if(_0x5b8c81[_0xaf2c('0xd')][_0x4a7397]){_0x5b8c81[_0xaf2c('0xd')][_0x4a7397][_0xaf2c('0xe')]({'statePause':_0x37fedd[_0xaf2c('0xf')]?!![]:![]});}_0x3c0421({'code':0xc8,'message':_0xaf2c('0x10')});});},'Reload':function(_0x59a59b){var _0x590126=this;return new Promise(function(_0x15ccb4,_0x8eaf9b){if(ami[_0xaf2c('0x11')]()==![]){return _0x8eaf9b(_0x590126[_0xaf2c('0x12')](0x1f4,[config[_0xaf2c('0x13')]['ip'],config[_0xaf2c('0x13')][_0xaf2c('0x14')],_0xaf2c('0x15')][_0xaf2c('0x16')]('\x20')));}_0x59a59b=_[_0xaf2c('0x17')](_0x59a59b,_[_0xaf2c('0x18')](properties[_0xaf2c('0x19')][_0xaf2c('0x1a')]));_0x59a59b[_0xaf2c('0x1b')]=_0xaf2c('0x1c');return ami['Action'](_0x59a59b)[_0xaf2c('0x1d')](function(_0x553163){_0x15ccb4({'code':0xc8,'message':_0x553163[_0xaf2c('0x1e')]});})[_0xaf2c('0x1f')](function(_0x1d544a){_0x8eaf9b(_0x590126['error'](0x1f5,_0x1d544a[_0xaf2c('0x1e')]));});});},'Command':function(_0x297bcd){var _0x1fec4c=this;return new Promise(function(_0x20000b,_0x3f977c){if(ami[_0xaf2c('0x11')]()==![]){return _0x3f977c(_0x1fec4c['error'](0x1f4,[config[_0xaf2c('0x13')]['ip'],config[_0xaf2c('0x13')][_0xaf2c('0x14')],_0xaf2c('0x15')][_0xaf2c('0x16')]('\x20')));}_0x297bcd=_['pick'](_0x297bcd,_0xaf2c('0x20'));_0x297bcd[_0xaf2c('0x1b')]=_0xaf2c('0x21');return ami['Action'](_0x297bcd)['then'](function(_0x29cbdf){_0x20000b({'code':0xc8,'message':_0x29cbdf[_0xaf2c('0x22')]});})[_0xaf2c('0x1f')](function(_0x99f78d){_0x3f977c(_0x1fec4c['error'](0x1f5,_0x99f78d[_0xaf2c('0x1e')]));});});},'VoiceQueues':function(){return new Promise(function(_0xf1a7cf){var _0x3a0145=[];for(var _0x3c1ae6 in _0x5b8c81[_0xaf2c('0x23')]){if(_0x5b8c81[_0xaf2c('0x23')][_0xaf2c('0x24')](_0x3c1ae6)){var _0x4a8dd8=_0x5b8c81[_0xaf2c('0x23')][_0x3c1ae6];var _0x2051be=new VoiceQueueSummary(_0x4a8dd8);_0x3a0145[_0xaf2c('0x25')](_0x2051be);}}_0xf1a7cf({'count':_0x3a0145[_0xaf2c('0x26')],'rows':_0x3a0145});});},'UpdateVoiceQueue':function(_0x4b7cf2){return new Promise(function(_0x3fb190,_0x589d47){var _0x38db1b=_[_0xaf2c('0x27')](_0x5b8c81[_0xaf2c('0x23')],{'id':parseInt(_0x4b7cf2['id'])});var _0x5d685a=_[_0xaf2c('0x28')](_0x4b7cf2,['id']);if(_0x38db1b){for(var _0x2ea490 in _0x5d685a){if(typeof _0x5d685a[_0x2ea490]!==_0xaf2c('0x29')&&typeof _0x38db1b[_0x2ea490]!=='undefined'){_0x38db1b[_0x2ea490]=_0x5d685a[_0x2ea490];}}_0x3fb190(_0x38db1b);}else{_0x589d47();}});},'VoiceChannels':function(){return new Promise(function(_0xe18ba7){var _0x32d95c=_[_0xaf2c('0x2a')](_0x5b8c81[_0xaf2c('0x2b')]);_0xe18ba7({'count':_0x32d95c['length'],'rows':_0x32d95c});});},'VoiceChannelMixMonitor':function(_0x3da072){var _0x4072ff=this;return new Promise(function(_0x1be1ef,_0x51a49c){if(ami['isConnected']()==![]){return _0x51a49c(_0x4072ff[_0xaf2c('0x12')](0x1f4,[config['asterisk']['ip'],config[_0xaf2c('0x13')]['username'],_0xaf2c('0x15')][_0xaf2c('0x16')]('\x20')));}var _0x4ffbb9=schema(properties[_0xaf2c('0x2c')])[_0xaf2c('0x2d')](_0x3da072);if(_0x4ffbb9['length']>0x0){return _0x51a49c(_0x4072ff[_0xaf2c('0x12')](0x1f4,_[_0xaf2c('0x2e')](_0x4ffbb9,_0xaf2c('0x1e'))[_0xaf2c('0x16')](',\x20')));}var _0x2d6ed7=_[_0xaf2c('0x27')](_0x5b8c81['channels'],{'uniqueid':_0x3da072[_0xaf2c('0x2f')]});if(_0x2d6ed7&&_0x2d6ed7['channel']){var _0x321f7c=util['format'](_0xaf2c('0x30'),_0x3da072['filename']||_0x3da072[_0xaf2c('0x2f')],_0x3da072['format']||_0xaf2c('0x31'));return ami['Action']({'action':_0xaf2c('0x32'),'channel':_0x2d6ed7[_0xaf2c('0x33')],'file':_0x321f7c,'options':_0xaf2c('0x34')})[_0xaf2c('0x1d')](function(_0x470aff){var _0x598adb=_['find'](_0x2d6ed7[_0xaf2c('0x35')],{'filename':_0xaf2c('0x36')+_0x321f7c[_0xaf2c('0x37')]()});if(_[_0xaf2c('0x38')](_0x598adb)){_0x2d6ed7[_0xaf2c('0x35')][_0xaf2c('0x25')]({'filename':'/var/spool/asterisk/monitor/'+_0x321f7c[_0xaf2c('0x37')](),'createdAt':moment()[_0xaf2c('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x470aff[_0xaf2c('0x39')],'status':_0xaf2c('0x3a')});}else{_0x598adb[_0xaf2c('0x39')]=_0x470aff[_0xaf2c('0x39')];_0x598adb[_0xaf2c('0x3b')]=_0xaf2c('0x3a');}_0x1be1ef({'code':0xc8,'message':[_0x3da072[_0xaf2c('0x2f')],_0xaf2c('0x3c'),_0x470aff[_0xaf2c('0x39')]][_0xaf2c('0x16')]('\x20'),'mixmonitorid':_0x470aff[_0xaf2c('0x39')]});})[_0xaf2c('0x1f')](function(_0xaba85d){_0x51a49c(_0x4072ff['error'](0x1f5,[_0x3da072['uniqueid'],_0xaba85d['message'][_0xaf2c('0x37')]()][_0xaf2c('0x16')]('\x20')));});}else{return _0x51a49c(_0x4072ff[_0xaf2c('0x12')](0x1f5,_0xaf2c('0x3d')));}});},'VoiceChannelStopMixMonitor':function(_0x715f39){var _0x29460c=this;return new Promise(function(_0x51c441,_0x1d58bd){if(ami[_0xaf2c('0x11')]()==![]){return _0x1d58bd(_0x29460c[_0xaf2c('0x12')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xaf2c('0x14')],'ami\x20disconnected'][_0xaf2c('0x16')]('\x20')));}var _0x25ba26=schema(properties[_0xaf2c('0x2c')])[_0xaf2c('0x2d')](_0x715f39);if(_0x25ba26['length']>0x0){return _0x1d58bd(_0x29460c[_0xaf2c('0x12')](0x1f4,_['map'](_0x25ba26,_0xaf2c('0x1e'))[_0xaf2c('0x16')](',\x20')));}var _0x58bd9b=_[_0xaf2c('0x27')](_0x5b8c81['channels'],{'uniqueid':_0x715f39[_0xaf2c('0x2f')]});if(_0x58bd9b){return Promise[_0xaf2c('0x3e')]()[_0xaf2c('0x1d')](function(){if(_0x58bd9b[_0xaf2c('0x33')]){return ami[_0xaf2c('0x3f')]({'action':_0xaf2c('0x40'),'channel':_0x58bd9b[_0xaf2c('0x33')],'mixmonitorid':_0x715f39[_0xaf2c('0x39')]})[_0xaf2c('0x1f')](function(){});}})['then'](function(){if(_0x58bd9b['destinationchannel']){return ami[_0xaf2c('0x3f')]({'action':'StopMixMonitor','channel':_0x58bd9b['destinationchannel'],'mixmonitorid':_0x715f39['mixmonitorid']})[_0xaf2c('0x1f')](function(){});}})[_0xaf2c('0x1d')](function(){var _0x3cabd4=_[_0xaf2c('0x27')](_0x58bd9b['monitors'],{'mixmonitorid':_0x715f39[_0xaf2c('0x39')]});if(_0x3cabd4){_0x3cabd4['status']=_0xaf2c('0x41');}})['then'](function(){var _0x166c26=util[_0xaf2c('0x9')](_0xaf2c('0x30'),_0x715f39[_0xaf2c('0x42')]||_0x715f39[_0xaf2c('0x2f')],_0x715f39['format']||_0xaf2c('0x31'));var _0x26afee=_['find'](_0x58bd9b['monitors'],{'filename':_0xaf2c('0x36')+_0x166c26['toLowerCase']()});if(_0x26afee){_0x26afee[_0xaf2c('0x3b')]=_0xaf2c('0x41');}})[_0xaf2c('0x1d')](function(){_0x51c441({'code':0xc8,'message':[_0x715f39[_0xaf2c('0x2f')],_0xaf2c('0x43')][_0xaf2c('0x16')]('\x20')});})[_0xaf2c('0x1f')](function(_0x4473c9){_0x1d58bd(_0x29460c[_0xaf2c('0x12')](0x1f5,[_0x715f39[_0xaf2c('0x2f')],_0x4473c9[_0xaf2c('0x1e')]['toLowerCase']()][_0xaf2c('0x16')]('\x20')));});}else{return _0x1d58bd(_0x29460c[_0xaf2c('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5175f8){var _0x56d7ce=this;return new Promise(function(_0x7ddca0){var _0x1f6907=_['values'](_0x5b8c81[_0xaf2c('0x44')]);var _0x2893c4={'count':_0x1f6907[_0xaf2c('0x26')],'rows':_0x1f6907};if(_0x5175f8&&_0x5175f8[_0xaf2c('0x45')]){if(![_0xaf2c('0x46'),_0xaf2c('0x47')][_0xaf2c('0x48')](_0x5175f8['type'])){return _0x1f9531(_0x56d7ce[_0xaf2c('0x12')](0x190,_0xaf2c('0x49')));}var _0x5771e5=_[_0xaf2c('0x4a')](_0x1f6907,function(_0x61442d){return _0x61442d[_0xaf2c('0x45')]===_0x5175f8[_0xaf2c('0x45')];});_0x2893c4[_0xaf2c('0x4b')]=_0x5771e5[_0xaf2c('0x26')];_0x2893c4[_0xaf2c('0x4c')]=_0x5771e5;}_0x7ddca0(_0x2893c4);});},'VoiceQueuesChannel':function(_0x15a335){var _0x19b82d=this;return new Promise(function(_0x300254,_0x133678){var _0x10a270=schema(properties[_0xaf2c('0x4d')])[_0xaf2c('0x2d')](_0x15a335);if(_0x10a270[_0xaf2c('0x26')]>0x0){return _0x133678(_0x19b82d[_0xaf2c('0x12')](0x1f4,_[_0xaf2c('0x2e')](_0x10a270,_0xaf2c('0x1e'))[_0xaf2c('0x16')](',\x20')));}var _0x23bf95=_['find'](_0x5b8c81[_0xaf2c('0x44')],{'uniqueid':_0x15a335[_0xaf2c('0x2f')]});if(_0x23bf95){_0x300254(_0x23bf95);}else{return _0x133678(_0x19b82d[_0xaf2c('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x22af48){var _0x5ed624=this;return new Promise(function(_0xc46f29,_0x2bce19){if(ami[_0xaf2c('0x11')]()==![]){return _0x2bce19(_0x5ed624[_0xaf2c('0x12')](0x1f4,[config[_0xaf2c('0x13')]['ip'],config[_0xaf2c('0x13')][_0xaf2c('0x14')],_0xaf2c('0x15')][_0xaf2c('0x16')]('\x20')));}var _0x580c2d=schema(properties[_0xaf2c('0x4e')])[_0xaf2c('0x2d')](_0x22af48);if(_0x580c2d[_0xaf2c('0x26')]>0x0){return _0x2bce19(_0x5ed624[_0xaf2c('0x12')](0x1f4,_[_0xaf2c('0x2e')](_0x580c2d,'message')[_0xaf2c('0x16')](',\x20')));}var _0x30dfeb=_['find'](_0x5b8c81[_0xaf2c('0x44')],{'uniqueid':_0x22af48[_0xaf2c('0x2f')]});if(_0x30dfeb&&_0x30dfeb['channel']){return ami['Action']({'action':_0xaf2c('0x4f'),'channel':_0x30dfeb[_0xaf2c('0x33')]})[_0xaf2c('0x1d')](function(_0x39c5d2){_0xc46f29({'code':0xc8,'message':[_0x22af48['uniqueid'],_0x39c5d2[_0xaf2c('0x1e')][_0xaf2c('0x37')]()]['join']('\x20')});})[_0xaf2c('0x1f')](function(_0x486b5a){_0x2bce19(_0x5ed624[_0xaf2c('0x12')](0x1f5,[_0x22af48[_0xaf2c('0x2f')],_0x486b5a[_0xaf2c('0x1e')][_0xaf2c('0x37')]()][_0xaf2c('0x16')]('\x20')));});}else{return _0x2bce19(_0x5ed624[_0xaf2c('0x12')](0x1f5,_0xaf2c('0x3d')));}});},'VoiceQueuesChannelRedirect':function(_0x25bdaa){var _0x1520ec=this;return new Promise(function(_0xc27601,_0x53ba41){if(ami[_0xaf2c('0x11')]()==![]){return _0x53ba41(_0x1520ec[_0xaf2c('0x12')](0x1f4,[config[_0xaf2c('0x13')]['ip'],config[_0xaf2c('0x13')][_0xaf2c('0x14')],'ami\x20disconnected'][_0xaf2c('0x16')]('\x20')));}var _0x28b09f=schema(properties[_0xaf2c('0x50')])[_0xaf2c('0x2d')](_0x25bdaa);if(_0x28b09f[_0xaf2c('0x26')]>0x0){return _0x53ba41(_0x1520ec['error'](0x1f4,_['map'](_0x28b09f,_0xaf2c('0x1e'))[_0xaf2c('0x16')](',\x20')));}var _0x5849f8=_[_0xaf2c('0x27')](_0x5b8c81[_0xaf2c('0x44')],{'uniqueid':_0x25bdaa[_0xaf2c('0x2f')]});if(_0x5849f8&&_0x5849f8['channel']){return ami[_0xaf2c('0x3f')]({'action':_0xaf2c('0x51'),'channel':_0x5849f8[_0xaf2c('0x33')],'exten':_0x25bdaa[_0xaf2c('0x52')],'context':_0x25bdaa['context']||_0x5849f8[_0xaf2c('0x53')],'priority':0x1})[_0xaf2c('0x1d')](function(_0x296c6b){_0xc27601({'code':0xc8,'message':[_0x25bdaa[_0xaf2c('0x2f')],_0x296c6b[_0xaf2c('0x1e')][_0xaf2c('0x37')]()][_0xaf2c('0x16')]('\x20')});})[_0xaf2c('0x1f')](function(_0x349dbb){_0x53ba41(_0x1520ec[_0xaf2c('0x12')](0x1f5,[_0x25bdaa[_0xaf2c('0x2f')],_0x349dbb['message'][_0xaf2c('0x37')]()]['join']('\x20')));});}else{return _0x53ba41(_0x1520ec[_0xaf2c('0x12')](0x1f5,_0xaf2c('0x3d')));}});},'Agents':function(_0x4e227a){return new Promise(function(_0x1b377c){var _0x5a95ac=_['values'](_0x5b8c81[_0xaf2c('0xd')]);if(_0x4e227a&&_0x4e227a['id']){var _0x1d73ef=_[_0xaf2c('0x27')](_0x5a95ac,function(_0x47c464){return _0x47c464['id']===_0x4e227a['id'];});_0x1b377c(_0x1d73ef);}else{_0x1b377c({'count':_0x5a95ac['length'],'rows':_0x5a95ac});}});},'Telephones':function(){return new Promise(function(_0x5a4716){var _0x103393=_[_0xaf2c('0x2a')](_0x5b8c81['telephones']);_0x5a4716({'count':_0x103393[_0xaf2c('0x26')],'rows':_0x103393});});},'Trunks':function(){return new Promise(function(_0x14931a){var _0x3700b8=_[_0xaf2c('0x2a')](_0x5b8c81[_0xaf2c('0x54')]);_0x14931a({'count':_0x3700b8[_0xaf2c('0x26')],'rows':_0x3700b8});});},'OutboundChannels':function(){return new Promise(function(_0x4be47b){var _0x4779a2=_[_0xaf2c('0x2a')](_0x5b8c81[_0xaf2c('0x55')]);_0x4be47b({'count':_0x4779a2['length'],'rows':_0x4779a2});});},'Outbound':function(){return new Promise(function(_0xc9dd21){_0xc9dd21(_0x5b8c81[_0xaf2c('0x47')]);});},'Campaigns':function(){return new Promise(function(_0x37ee02){var _0x577eaa=_[_0xaf2c('0x2a')](_0x5b8c81[_0xaf2c('0x56')]);_0x37ee02({'count':_0x577eaa[_0xaf2c('0x26')],'rows':_0x577eaa});});},'VoiceQueuesPreview':function(_0x5f705){var _0x491160=this;return new Promise(function(_0x286a40,_0x309532){_0x1fd101[_0xaf2c('0x57')](_0x5f705['id'])['then'](function(_0x5d0de0){_0x286a40({'code':0xc8,'message':_0x5d0de0[_0xaf2c('0x1e')]});})[_0xaf2c('0x1f')](function(_0x5571eb){_0x309532(_0x491160[_0xaf2c('0x12')](0x1f4,_0x5571eb[_0xaf2c('0x1e')]));});});},'EventManager':function(_0x5365fa){var _0x41e739=this;return new Promise(function(_0x31cf3e,_0x36e6a2){if(!_0x5365fa[_0xaf2c('0x58')]){return _0x36e6a2(_0x41e739[_0xaf2c('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0xaf2c('0x59')+_0x5365fa[_0xaf2c('0x58')],_0x5365fa[_0xaf2c('0x1e')]);_0x31cf3e({'code':0xc8,'message':_0x5365fa});});},'FaxAccounts':function(){return new Promise(function(_0x4f378e){var _0xca027d=_[_0xaf2c('0x2a')](_0x5b8c81[_0xaf2c('0x5a')]);_0x4f378e({'count':_0xca027d[_0xaf2c('0x26')],'rows':_0xca027d});});},'SendFax':function(_0x39ddec){var _0x4b9fdc=this;return new Promise(function(_0x2da0ce,_0x21e494){_0x100d17[_0xaf2c('0x5b')](_0x39ddec)[_0xaf2c('0x1d')](function(_0x346060){_0x2da0ce({'code':0xc8,'message':_0x346060[_0xaf2c('0x1e')]});})['catch'](function(_0xd26d9a){_0x21e494(_0x4b9fdc[_0xaf2c('0x12')](0x1f4,_0xd26d9a['message']));});});},'CheckAfterSend':function(_0x5beb89){var _0x493e84=this;return new Promise(function(_0x2c4a8f,_0x1044ca){_0x100d17[_0xaf2c('0x5c')](_0x5beb89)[_0xaf2c('0x1d')](function(_0x499bbe){_0x2c4a8f({'code':0xc8,'message':_0x499bbe[_0xaf2c('0x1e')]});})[_0xaf2c('0x1f')](function(_0x2b57d2){_0x1044ca(_0x493e84[_0xaf2c('0x12')](0x1f4,_0x2b57d2['message']));});});}};var _0x1e8fc0=jayson[_0xaf2c('0x5d')](_0x58351f)[_0xaf2c('0x5e')]();_0x1e8fc0['on'](_0xaf2c('0x12'),function(_0x1c7e15){return _0x1f9531(_0x1c7e15);});_0x1e8fc0['listen'](0x232a,_0xaf2c('0x5f'),function(){console[_0xaf2c('0x60')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x297740('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x7da7=['AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','../../../config/environment','../properties','../model/voiceQueueSummary','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','join','keys','reload','module','action','message','catch','ami\x20disconnected','Action','then','content','voiceQueues','push','length','find','undefined','channels','voicechannel','map','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','isConnected','validate','resolve','StopMixMonitor','destinationchannel','status','stop','filename','StopMixMonitor\x20Success','queueChannels','type','inbound','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','voicequeuechannelhangup','Hangup','exten','context','values','telephones','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','faxAccounts','send','server','http','127.0.0.1','log'];(function(_0xc7951e,_0x2a7c2b){var _0x4f9cea=function(_0x1678c4){while(--_0x1678c4){_0xc7951e['push'](_0xc7951e['shift']());}};_0x4f9cea(++_0x2a7c2b);}(_0x7da7,0x10d));var _0x77da=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x7da7[_0x3e7804];return _0x56efda;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var jayson=require(_0x77da('0x2'));var schema=require('validate');var moment=require('moment');var config=require(_0x77da('0x3'));var properties=require(_0x77da('0x4'));var ami=require('../ami');var VoiceQueueSummary=require(_0x77da('0x5'));exports[_0x77da('0x6')]=function(_0x56458c,_0x19331c,_0xc54a12){return new Promise(function(_0x47da81,_0x30afe0){var _0x47cf1d={'QueuePause':function(_0x1191de){return new Promise(function(_0x13992e){var _0x37c5ab=util[_0x77da('0x7')](_0x77da('0x8'),'SIP',_0x1191de[_0x77da('0x9')]);if(_0x56458c[_0x77da('0xa')]&&_0x56458c[_0x77da('0xa')][_0x37c5ab]&&_0x56458c['timers'][_0x37c5ab][_0x77da('0xb')]){_0x56458c[_0x77da('0xa')][_0x37c5ab][_0x77da('0xc')]();}if(_0x56458c[_0x77da('0xd')][_0x37c5ab]){_0x56458c['agents'][_0x37c5ab][_0x77da('0xe')]({'statePause':_0x1191de[_0x77da('0xf')]?!![]:![]});}_0x13992e({'code':0xc8,'message':_0x77da('0x10')});});},'Reload':function(_0x5d6e2f){var _0x4a7748=this;return new Promise(function(_0x26e3ff,_0x4263d9){if(ami['isConnected']()==![]){return _0x4263d9(_0x4a7748[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config[_0x77da('0x12')][_0x77da('0x13')],'ami\x20disconnected'][_0x77da('0x14')]('\x20')));}_0x5d6e2f=_['pick'](_0x5d6e2f,_[_0x77da('0x15')](properties[_0x77da('0x16')][_0x77da('0x17')]));_0x5d6e2f[_0x77da('0x18')]='Reload';return ami['Action'](_0x5d6e2f)['then'](function(_0x482b87){_0x26e3ff({'code':0xc8,'message':_0x482b87[_0x77da('0x19')]});})[_0x77da('0x1a')](function(_0x289887){_0x4263d9(_0x4a7748[_0x77da('0x11')](0x1f5,_0x289887[_0x77da('0x19')]));});});},'Command':function(_0x12d2b1){var _0x1d325c=this;return new Promise(function(_0x3b6dde,_0x544104){if(ami['isConnected']()==![]){return _0x544104(_0x1d325c[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config['asterisk'][_0x77da('0x13')],_0x77da('0x1b')][_0x77da('0x14')]('\x20')));}_0x12d2b1=_['pick'](_0x12d2b1,'command');_0x12d2b1[_0x77da('0x18')]='Command';return ami[_0x77da('0x1c')](_0x12d2b1)[_0x77da('0x1d')](function(_0xc52f0e){_0x3b6dde({'code':0xc8,'message':_0xc52f0e[_0x77da('0x1e')]});})[_0x77da('0x1a')](function(_0x270318){_0x544104(_0x1d325c[_0x77da('0x11')](0x1f5,_0x270318['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x4885ec){var _0xfd160=[];for(var _0x2d009f in _0x56458c[_0x77da('0x1f')]){if(_0x56458c[_0x77da('0x1f')]['hasOwnProperty'](_0x2d009f)){var _0x42240b=_0x56458c[_0x77da('0x1f')][_0x2d009f];var _0x470c9f=new VoiceQueueSummary(_0x42240b);_0xfd160[_0x77da('0x20')](_0x470c9f);}}_0x4885ec({'count':_0xfd160[_0x77da('0x21')],'rows':_0xfd160});});},'UpdateVoiceQueue':function(_0x5997b6){return new Promise(function(_0xce24b8,_0x3e090d){var _0x1f2279=_[_0x77da('0x22')](_0x56458c['voiceQueues'],{'id':parseInt(_0x5997b6['id'])});var _0x5b4638=_['omit'](_0x5997b6,['id']);if(_0x1f2279){for(var _0x2258e9 in _0x5b4638){if(typeof _0x5b4638[_0x2258e9]!==_0x77da('0x23')&&typeof _0x1f2279[_0x2258e9]!==_0x77da('0x23')){_0x1f2279[_0x2258e9]=_0x5b4638[_0x2258e9];}}_0xce24b8(_0x1f2279);}else{_0x3e090d();}});},'VoiceChannels':function(){return new Promise(function(_0x3394d6){var _0x34228f=_['values'](_0x56458c[_0x77da('0x24')]);_0x3394d6({'count':_0x34228f[_0x77da('0x21')],'rows':_0x34228f});});},'VoiceChannelMixMonitor':function(_0x356bfb){var _0x1d381b=this;return new Promise(function(_0x1e7853,_0x46e6b4){if(ami['isConnected']()==![]){return _0x46e6b4(_0x1d381b[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config[_0x77da('0x12')][_0x77da('0x13')],_0x77da('0x1b')][_0x77da('0x14')]('\x20')));}var _0x3343b4=schema(properties[_0x77da('0x25')])['validate'](_0x356bfb);if(_0x3343b4['length']>0x0){return _0x46e6b4(_0x1d381b[_0x77da('0x11')](0x1f4,_[_0x77da('0x26')](_0x3343b4,'message')[_0x77da('0x14')](',\x20')));}var _0x390399=_[_0x77da('0x22')](_0x56458c[_0x77da('0x24')],{'uniqueid':_0x356bfb[_0x77da('0x27')]});if(_0x390399&&_0x390399[_0x77da('0x28')]){var _0x20d1cc=util['format'](_0x77da('0x29'),_0x356bfb['filename']||_0x356bfb['uniqueid'],_0x356bfb['format']||_0x77da('0x2a'));return ami['Action']({'action':_0x77da('0x2b'),'channel':_0x390399[_0x77da('0x28')],'file':_0x20d1cc,'options':_0x77da('0x2c')})[_0x77da('0x1d')](function(_0x3c46d2){var _0x3f0593=_[_0x77da('0x22')](_0x390399['monitors'],{'filename':_0x77da('0x2d')+_0x20d1cc[_0x77da('0x2e')]()});if(_[_0x77da('0x2f')](_0x3f0593)){_0x390399[_0x77da('0x30')][_0x77da('0x20')]({'filename':_0x77da('0x2d')+_0x20d1cc['toLowerCase'](),'createdAt':moment()[_0x77da('0x7')](_0x77da('0x31')),'mixmonitorid':_0x3c46d2[_0x77da('0x32')],'status':'rec'});}else{_0x3f0593[_0x77da('0x32')]=_0x3c46d2['mixmonitorid'];_0x3f0593['status']='rec';}_0x1e7853({'code':0xc8,'message':[_0x356bfb['uniqueid'],_0x77da('0x33'),_0x3c46d2[_0x77da('0x32')]][_0x77da('0x14')]('\x20'),'mixmonitorid':_0x3c46d2['mixmonitorid']});})[_0x77da('0x1a')](function(_0x5b7e63){_0x46e6b4(_0x1d381b[_0x77da('0x11')](0x1f5,[_0x356bfb['uniqueid'],_0x5b7e63[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')));});}else{return _0x46e6b4(_0x1d381b[_0x77da('0x11')](0x1f5,_0x77da('0x34')));}});},'VoiceChannelStopMixMonitor':function(_0x5ecf12){var _0x759b86=this;return new Promise(function(_0x1f48bd,_0x44717a){if(ami[_0x77da('0x35')]()==![]){return _0x44717a(_0x759b86[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config['asterisk'][_0x77da('0x13')],_0x77da('0x1b')][_0x77da('0x14')]('\x20')));}var _0x2dfeca=schema(properties[_0x77da('0x25')])[_0x77da('0x36')](_0x5ecf12);if(_0x2dfeca['length']>0x0){return _0x44717a(_0x759b86[_0x77da('0x11')](0x1f4,_['map'](_0x2dfeca,_0x77da('0x19'))[_0x77da('0x14')](',\x20')));}var _0x40a492=_['find'](_0x56458c[_0x77da('0x24')],{'uniqueid':_0x5ecf12[_0x77da('0x27')]});if(_0x40a492){return Promise[_0x77da('0x37')]()[_0x77da('0x1d')](function(){if(_0x40a492[_0x77da('0x28')]){return ami[_0x77da('0x1c')]({'action':_0x77da('0x38'),'channel':_0x40a492[_0x77da('0x28')],'mixmonitorid':_0x5ecf12[_0x77da('0x32')]})['catch'](function(){});}})[_0x77da('0x1d')](function(){if(_0x40a492[_0x77da('0x39')]){return ami[_0x77da('0x1c')]({'action':_0x77da('0x38'),'channel':_0x40a492[_0x77da('0x39')],'mixmonitorid':_0x5ecf12[_0x77da('0x32')]})['catch'](function(){});}})['then'](function(){var _0x240d7b=_[_0x77da('0x22')](_0x40a492[_0x77da('0x30')],{'mixmonitorid':_0x5ecf12[_0x77da('0x32')]});if(_0x240d7b){_0x240d7b[_0x77da('0x3a')]=_0x77da('0x3b');}})['then'](function(){var _0x6ccb8f=util[_0x77da('0x7')](_0x77da('0x29'),_0x5ecf12[_0x77da('0x3c')]||_0x5ecf12['uniqueid'],_0x5ecf12[_0x77da('0x7')]||'wav');var _0x518fd5=_[_0x77da('0x22')](_0x40a492[_0x77da('0x30')],{'filename':_0x77da('0x2d')+_0x6ccb8f[_0x77da('0x2e')]()});if(_0x518fd5){_0x518fd5['status']=_0x77da('0x3b');}})[_0x77da('0x1d')](function(){_0x1f48bd({'code':0xc8,'message':[_0x5ecf12['uniqueid'],_0x77da('0x3d')][_0x77da('0x14')]('\x20')});})['catch'](function(_0x6c0b00){_0x44717a(_0x759b86[_0x77da('0x11')](0x1f5,[_0x5ecf12[_0x77da('0x27')],_0x6c0b00[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')));});}else{return _0x44717a(_0x759b86[_0x77da('0x11')](0x1f5,_0x77da('0x34')));}});},'VoiceQueuesChannels':function(_0x128ce3){var _0x3a34a8=this;return new Promise(function(_0x52aa0a){var _0x3d04a3=_['values'](_0x56458c[_0x77da('0x3e')]);var _0x14cd3c={'count':_0x3d04a3[_0x77da('0x21')],'rows':_0x3d04a3};if(_0x128ce3&&_0x128ce3[_0x77da('0x3f')]){if(![_0x77da('0x40'),_0x77da('0x41')][_0x77da('0x42')](_0x128ce3['type'])){return _0x30afe0(_0x3a34a8[_0x77da('0x11')](0x190,_0x77da('0x43')));}var _0x1a7115=_[_0x77da('0x44')](_0x3d04a3,function(_0x4f30a1){return _0x4f30a1[_0x77da('0x3f')]===_0x128ce3[_0x77da('0x3f')];});_0x14cd3c[_0x77da('0x45')]=_0x1a7115['length'];_0x14cd3c['rows']=_0x1a7115;}_0x52aa0a(_0x14cd3c);});},'VoiceQueuesChannel':function(_0x332763){var _0x3a0396=this;return new Promise(function(_0x42ea9e,_0x1d1ea2){var _0x451897=schema(properties['voicequeuechannel'])['validate'](_0x332763);if(_0x451897[_0x77da('0x21')]>0x0){return _0x1d1ea2(_0x3a0396[_0x77da('0x11')](0x1f4,_['map'](_0x451897,_0x77da('0x19'))[_0x77da('0x14')](',\x20')));}var _0x1e0146=_['find'](_0x56458c[_0x77da('0x3e')],{'uniqueid':_0x332763[_0x77da('0x27')]});if(_0x1e0146){_0x42ea9e(_0x1e0146);}else{return _0x1d1ea2(_0x3a0396['error'](0x1f5,_0x77da('0x34')));}});},'VoiceQueuesChannelHangup':function(_0x27aa8c){var _0xfb06b5=this;return new Promise(function(_0x1a4bab,_0x20cce1){if(ami[_0x77da('0x35')]()==![]){return _0x20cce1(_0xfb06b5[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config[_0x77da('0x12')]['username'],_0x77da('0x1b')][_0x77da('0x14')]('\x20')));}var _0x1f6141=schema(properties[_0x77da('0x46')])[_0x77da('0x36')](_0x27aa8c);if(_0x1f6141[_0x77da('0x21')]>0x0){return _0x20cce1(_0xfb06b5['error'](0x1f4,_[_0x77da('0x26')](_0x1f6141,_0x77da('0x19'))[_0x77da('0x14')](',\x20')));}var _0x5b9cf2=_[_0x77da('0x22')](_0x56458c[_0x77da('0x3e')],{'uniqueid':_0x27aa8c[_0x77da('0x27')]});if(_0x5b9cf2&&_0x5b9cf2[_0x77da('0x28')]){return ami[_0x77da('0x1c')]({'action':_0x77da('0x47'),'channel':_0x5b9cf2[_0x77da('0x28')]})['then'](function(_0x100094){_0x1a4bab({'code':0xc8,'message':[_0x27aa8c['uniqueid'],_0x100094[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')});})['catch'](function(_0x30c746){_0x20cce1(_0xfb06b5[_0x77da('0x11')](0x1f5,[_0x27aa8c[_0x77da('0x27')],_0x30c746[_0x77da('0x19')]['toLowerCase']()]['join']('\x20')));});}else{return _0x20cce1(_0xfb06b5['error'](0x1f5,_0x77da('0x34')));}});},'VoiceQueuesChannelRedirect':function(_0x1bca78){var _0x2c4d7c=this;return new Promise(function(_0x2c7c8e,_0x458da6){if(ami[_0x77da('0x35')]()==![]){return _0x458da6(_0x2c4d7c[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config[_0x77da('0x12')][_0x77da('0x13')],'ami\x20disconnected'][_0x77da('0x14')]('\x20')));}var _0x6dd79f=schema(properties['voicequeuechannelredirect'])['validate'](_0x1bca78);if(_0x6dd79f[_0x77da('0x21')]>0x0){return _0x458da6(_0x2c4d7c['error'](0x1f4,_[_0x77da('0x26')](_0x6dd79f,_0x77da('0x19'))[_0x77da('0x14')](',\x20')));}var _0x4b9115=_[_0x77da('0x22')](_0x56458c[_0x77da('0x3e')],{'uniqueid':_0x1bca78[_0x77da('0x27')]});if(_0x4b9115&&_0x4b9115[_0x77da('0x28')]){return ami[_0x77da('0x1c')]({'action':'Redirect','channel':_0x4b9115[_0x77da('0x28')],'exten':_0x1bca78[_0x77da('0x48')],'context':_0x1bca78['context']||_0x4b9115[_0x77da('0x49')],'priority':0x1})[_0x77da('0x1d')](function(_0xd14296){_0x2c7c8e({'code':0xc8,'message':[_0x1bca78[_0x77da('0x27')],_0xd14296[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')});})['catch'](function(_0x3f5766){_0x458da6(_0x2c4d7c['error'](0x1f5,[_0x1bca78[_0x77da('0x27')],_0x3f5766[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')));});}else{return _0x458da6(_0x2c4d7c[_0x77da('0x11')](0x1f5,_0x77da('0x34')));}});},'Agents':function(_0xf75c3c){return new Promise(function(_0x103e1b){var _0x195a34=_[_0x77da('0x4a')](_0x56458c[_0x77da('0xd')]);if(_0xf75c3c&&_0xf75c3c['id']){var _0x19065e=_['find'](_0x195a34,function(_0x39d569){return _0x39d569['id']===_0xf75c3c['id'];});_0x103e1b(_0x19065e);}else{_0x103e1b({'count':_0x195a34[_0x77da('0x21')],'rows':_0x195a34});}});},'Telephones':function(){return new Promise(function(_0xeb5121){var _0x16d8cd=_['values'](_0x56458c[_0x77da('0x4b')]);_0xeb5121({'count':_0x16d8cd[_0x77da('0x21')],'rows':_0x16d8cd});});},'Trunks':function(){return new Promise(function(_0x16c7b7){var _0x4f3479=_[_0x77da('0x4a')](_0x56458c['trunks']);_0x16c7b7({'count':_0x4f3479['length'],'rows':_0x4f3479});});},'OutboundChannels':function(){return new Promise(function(_0x2a4f85){var _0x4015f0=_[_0x77da('0x4a')](_0x56458c[_0x77da('0x4c')]);_0x2a4f85({'count':_0x4015f0[_0x77da('0x21')],'rows':_0x4015f0});});},'Outbound':function(){return new Promise(function(_0x337621){_0x337621(_0x56458c[_0x77da('0x41')]);});},'Campaigns':function(){return new Promise(function(_0xf95d48){var _0x470840=_['values'](_0x56458c[_0x77da('0x4d')]);_0xf95d48({'count':_0x470840[_0x77da('0x21')],'rows':_0x470840});});},'VoiceQueuesPreview':function(_0x2d3ab4){var _0x1206c7=this;return new Promise(function(_0x17175,_0x502249){_0x19331c[_0x77da('0x4e')](_0x2d3ab4['id'])[_0x77da('0x1d')](function(_0x27c0a2){_0x17175({'code':0xc8,'message':_0x27c0a2[_0x77da('0x19')]});})[_0x77da('0x1a')](function(_0x94f1e1){_0x502249(_0x1206c7[_0x77da('0x11')](0x1f4,_0x94f1e1[_0x77da('0x19')]));});});},'EventManager':function(_0x352a4e){var _0x37d94a=this;return new Promise(function(_0x4df868,_0x519e38){if(!_0x352a4e['event']){return _0x519e38(_0x37d94a[_0x77da('0x11')](0x1f4,_0x77da('0x4f')));}ami[_0x77da('0x50')]('custom:'+_0x352a4e['event'],_0x352a4e[_0x77da('0x19')]);_0x4df868({'code':0xc8,'message':_0x352a4e});});},'FaxAccounts':function(){return new Promise(function(_0xdbd9d5){var _0x17a2e6=_[_0x77da('0x4a')](_0x56458c[_0x77da('0x51')]);_0xdbd9d5({'count':_0x17a2e6[_0x77da('0x21')],'rows':_0x17a2e6});});},'SendFax':function(_0x3fca4b){var _0x276805=this;return new Promise(function(_0x1523a8,_0x11152b){_0xc54a12[_0x77da('0x52')](_0x3fca4b)[_0x77da('0x1d')](function(_0x1d2944){_0x1523a8({'code':0xc8,'message':_0x1d2944['message']});})['catch'](function(_0x1cdd40){_0x11152b(_0x276805['error'](0x1f4,_0x1cdd40['message']));});});},'CheckAfterSend':function(_0x22de60){var _0x1e37da=this;return new Promise(function(_0x2ae66f,_0x583a7a){_0xc54a12['checkAfterSend'](_0x22de60)[_0x77da('0x1d')](function(_0x4f1ae0){_0x2ae66f({'code':0xc8,'message':_0x4f1ae0[_0x77da('0x19')]});})[_0x77da('0x1a')](function(_0x554c44){_0x583a7a(_0x1e37da[_0x77da('0x11')](0x1f4,_0x554c44['message']));});});}};var _0x15cec0=jayson[_0x77da('0x53')](_0x47cf1d)[_0x77da('0x54')]();_0x15cec0['on'](_0x77da('0x11'),function(_0x4e3014){return _0x30afe0(_0x4e3014);});_0x15cec0[_0x77da('0x6')](0x232a,_0x77da('0x55'),function(){console[_0x77da('0x56')](_0x77da('0x57'),0x232a);return _0x47da81(_0x77da('0x58')+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 39c8c40..32aebfb 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 _0x56d6=['getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','info','[CM][%s][%s]','emit','data1','data2','isNil','xmd-contactid','ListId','data3','split','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then'];(function(_0xe3c682,_0x5eb40c){var _0x2d0c5f=function(_0xa08e10){while(--_0xa08e10){_0xe3c682['push'](_0xe3c682['shift']());}};_0x2d0c5f(++_0x5eb40c);}(_0x56d6,0x18e));var _0x656d=function(_0x8a55fc,_0x14eb6f){_0x8a55fc=_0x8a55fc-0x0;var _0x1f3a8c=_0x56d6[_0x8a55fc];return _0x1f3a8c;};'use strict';var _=require(_0x656d('0x0'));var BPromise=require(_0x656d('0x1'));var Redis=require(_0x656d('0x2'));var util=require(_0x656d('0x3'));var config=require(_0x656d('0x4'));var logger=require(_0x656d('0x5'))('trigger');var cmContactRpc=require(_0x656d('0x6'));config[_0x656d('0x7')]=_[_0x656d('0x8')](config[_0x656d('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x656d('0x7')]));function emit(_0x18c51d,_0xff9129,_0x5f55ed,_0xdb80dc,_0x2e3148){logger[_0x656d('0x9')](_0x656d('0xa'),_0x18c51d,_0xff9129['id'],_0x5f55ed,_0xdb80dc,JSON['stringify'](_0x2e3148));io['to'](_0x5f55ed)[_0x656d('0xb')](_0xdb80dc,_0x2e3148);}exports['exec']=function(_0x13a826,_0x5adaa5,_0x2323c1,_0x2afa6d){var _0x5af363,_0x20f5c9;var _0xa5b816={};var _0x244e87;var _0x528738=Number(_0x2323c1[_0x656d('0xc')]);var _0x86ed8c=_0x2323c1['data2']?Boolean(Number(_0x2323c1[_0x656d('0xd')])):![];var _0x3aeae9;var _0x3e7e27=![];if(!_[_0x656d('0xe')](_0x2323c1['data5'])){if(_0x2323c1['data5']=='1')_0x3e7e27=!![];}if(!_0x3e7e27){if(_0x2afa6d[_0x656d('0xf')]){_0xa5b816['id']=_0x2afa6d[_0x656d('0xf')];}}if(!_0xa5b816['id']){_0xa5b816[_0x656d('0x10')]=_0x528738;_0x3aeae9=_0x2323c1[_0x656d('0x11')]&&_0x2323c1['data3']!=='0'?_0x2323c1[_0x656d('0x11')][_0x656d('0x12')](','):['phone'];_0xa5b816['$or']=_[_0x656d('0x13')](_0x3aeae9,function(_0x3cdbe5){var _0x168452={};_0x168452[_0x3cdbe5]=_0x2afa6d[_0x656d('0x14')]?_0x2afa6d[_0x656d('0x15')]:_0x2afa6d[_0x656d('0x16')];return _0x168452;});_0x244e87=_0x2afa6d['routeId']?_0x2afa6d[_0x656d('0x15')]:_0x2afa6d[_0x656d('0x16')];}var _0x57bfaf=['id',_0x656d('0x17'),_0x656d('0x18'),_0x656d('0x19'),_0x656d('0x1a'),_0x656d('0x1b'),_0x656d('0x10'),_0x656d('0x1c'),_0x656d('0x1d'),_0x656d('0x1e')];var _0x1f8d79=_[_0x656d('0x1f')](_0x57bfaf,_0x3aeae9);BPromise[_0x656d('0x20')]()[_0x656d('0x21')](cmContactRpc[_0x656d('0x22')]({'attributes':_0x1f8d79,'where':_0xa5b816,'phone':_0x244e87}))['then'](function(_0x586ace){_0x20f5c9=_0x586ace;if(!_[_0x656d('0x23')](_0x20f5c9)){if(_0x20f5c9[_0x656d('0x24')]===0x1){_0x5af363=_0x20f5c9[0x0];logger['info'](_0x656d('0x25'),_0x2afa6d['uniqueid'],_0x5adaa5['id'],_0x5af363['id']);}else{logger[_0x656d('0x9')](_0x656d('0x26'),_0x2afa6d['uniqueid'],_0x5adaa5['id'],_[_0x656d('0x13')](_0x20f5c9,'id')[_0x656d('0x27')](','));}return;}else{logger[_0x656d('0x9')](_0x656d('0x28'),_0x2afa6d[_0x656d('0x29')],_0x5adaa5['id']);var _0x156950={'ListId':_0x528738};var _0x48b33d=_0x2323c1[_0x656d('0x2a')]&&_0x2323c1[_0x656d('0x2a')]!=='0'?_0x2323c1[_0x656d('0x2a')]:'phone';if(_0x86ed8c){logger['info'](_0x656d('0x2b'),_0x2afa6d[_0x656d('0x29')],_0x5adaa5['id']);_0x156950[_0x48b33d]=_['isNil'](_0x2afa6d[_0x656d('0x14')])?_0x2afa6d[_0x656d('0x16')]:_0x2afa6d[_0x656d('0x15')];if(_[_0x656d('0xe')](_0x2afa6d[_0x656d('0x14')])){_0x156950[_0x656d('0x17')]=_0x2afa6d[_0x656d('0x2c')]&&_0x2afa6d[_0x656d('0x2c')]!==_0x656d('0x2d')?_0x2afa6d[_0x656d('0x2c')]:'Unknown';}else{_0x156950[_0x656d('0x17')]=_0x2afa6d[_0x656d('0x2e')]&&_0x2afa6d['destcalleridname']!==_0x656d('0x2d')?_0x2afa6d['destcalleridname']:_0x656d('0x2f');}return BPromise[_0x656d('0x20')]()[_0x656d('0x21')](cmContactRpc[_0x656d('0x30')](_0x156950))[_0x656d('0x21')](function(_0x5347c4){_0x5af363=_0x5347c4;_0x20f5c9[_0x656d('0x31')](_0x5347c4);if(_0x5af363){logger[_0x656d('0x9')](_0x656d('0x32'),_0x2afa6d[_0x656d('0x29')],_0x5adaa5['id'],_0x5af363['id']);}return;});}else{logger['info'](_0x656d('0x33'),_0x2afa6d[_0x656d('0x29')],_0x5adaa5['id']);_0x156950[_0x48b33d]=_['isNil'](_0x2afa6d[_0x656d('0x14')])?_0x2afa6d[_0x656d('0x16')]:_0x2afa6d[_0x656d('0x15')];if(_[_0x656d('0xe')](_0x2afa6d[_0x656d('0x14')])){_0x156950[_0x656d('0x17')]=_0x2afa6d['calleridname']&&_0x2afa6d[_0x656d('0x2c')]!==_0x656d('0x2d')?_0x2afa6d['calleridname']:_0x656d('0x2f');}else{_0x156950['firstName']=_0x2afa6d[_0x656d('0x2e')]&&_0x2afa6d[_0x656d('0x2e')]!==_0x656d('0x2d')?_0x2afa6d[_0x656d('0x2e')]:_0x656d('0x2f');}_0x5af363=_0x156950;_0x20f5c9[_0x656d('0x31')](_0x156950);return;}}})[_0x656d('0x21')](function(){if(_0x13a826){emit(_0x2afa6d[_0x656d('0x29')],_0x5adaa5,util[_0x656d('0x34')](_0x656d('0x35'),_0x13a826['name']),util[_0x656d('0x34')]('trigger:%s',_0x2323c1['action']['toLowerCase']()),{'evt':_['merge'](_0x2afa6d,{'autoCreate':_0x86ed8c}),'contact':_0x5af363===undefined?{}:_0x5af363,'contacts':_0x20f5c9[_0x656d('0x24')]===0x0?undefined:_0x20f5c9});}});}; \ No newline at end of file +var _0x0db9=['mobile','createdAt','scheduledAt','union','resolve','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','','calleridname','destcalleridname','Unknown','then','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','action','toLowerCase','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','info','emit','data2','data5','xmd-contactid','ListId','data3','$or','routeId','calleridnum','destcalleridnum','firstName','lastName','phone'];(function(_0xb55b47,_0x4acac6){var _0x53650f=function(_0x2d1cd1){while(--_0x2d1cd1){_0xb55b47['push'](_0xb55b47['shift']());}};_0x53650f(++_0x4acac6);}(_0x0db9,0xe4));var _0x90db=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0x0db9[_0x40ebff];return _0x40122a;};'use strict';var _=require(_0x90db('0x0'));var BPromise=require(_0x90db('0x1'));var Redis=require('ioredis');var util=require(_0x90db('0x2'));var config=require(_0x90db('0x3'));var logger=require(_0x90db('0x4'))(_0x90db('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0x90db('0x6')]=_[_0x90db('0x7')](config[_0x90db('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x90db('0x6')]));function emit(_0x15a90a,_0x1d7773,_0x1e2937,_0x28eba2,_0x55c184){logger[_0x90db('0x8')]('[CM][%s][%s]',_0x15a90a,_0x1d7773['id'],_0x1e2937,_0x28eba2,JSON['stringify'](_0x55c184));io['to'](_0x1e2937)[_0x90db('0x9')](_0x28eba2,_0x55c184);}exports['exec']=function(_0x42b690,_0x4d4ec2,_0x36b1a5,_0x385e7b){var _0x149952,_0x1a244c;var _0x47e3dd={};var _0x4fd190;var _0x1d1b68=Number(_0x36b1a5['data1']);var _0x3b3c89=_0x36b1a5[_0x90db('0xa')]?Boolean(Number(_0x36b1a5[_0x90db('0xa')])):![];var _0x4df096;var _0x5b99c5=![];if(!_['isNil'](_0x36b1a5[_0x90db('0xb')])){if(_0x36b1a5[_0x90db('0xb')]=='1')_0x5b99c5=!![];}if(!_0x5b99c5){if(_0x385e7b['xmd-contactid']){_0x47e3dd['id']=_0x385e7b[_0x90db('0xc')];}}if(!_0x47e3dd['id']){_0x47e3dd[_0x90db('0xd')]=_0x1d1b68;_0x4df096=_0x36b1a5[_0x90db('0xe')]&&_0x36b1a5[_0x90db('0xe')]!=='0'?_0x36b1a5[_0x90db('0xe')]['split'](','):['phone'];_0x47e3dd[_0x90db('0xf')]=_['map'](_0x4df096,function(_0x39449d){var _0x1e7dcb={};_0x1e7dcb[_0x39449d]=_0x385e7b[_0x90db('0x10')]?_0x385e7b['destcalleridnum']:_0x385e7b[_0x90db('0x11')];return _0x1e7dcb;});_0x4fd190=_0x385e7b[_0x90db('0x10')]?_0x385e7b[_0x90db('0x12')]:_0x385e7b[_0x90db('0x11')];}var _0x41ef4f=['id',_0x90db('0x13'),_0x90db('0x14'),_0x90db('0x15'),_0x90db('0x16'),'fax','ListId',_0x90db('0x17'),_0x90db('0x18'),'updatedAt'];var _0x4aff53=_[_0x90db('0x19')](_0x41ef4f,_0x4df096);BPromise[_0x90db('0x1a')]()['then'](cmContactRpc[_0x90db('0x1b')]({'attributes':_0x4aff53,'where':_0x47e3dd,'phone':_0x4fd190}))['then'](function(_0x302913){_0x1a244c=_0x302913;if(!_['isEmpty'](_0x1a244c)){if(_0x1a244c[_0x90db('0x1c')]===0x1){_0x149952=_0x1a244c[0x0];logger[_0x90db('0x8')](_0x90db('0x1d'),_0x385e7b['uniqueid'],_0x4d4ec2['id'],_0x149952['id']);}else{logger[_0x90db('0x8')](_0x90db('0x1e'),_0x385e7b[_0x90db('0x1f')],_0x4d4ec2['id'],_[_0x90db('0x20')](_0x1a244c,'id')[_0x90db('0x21')](','));}return;}else{logger[_0x90db('0x8')](_0x90db('0x22'),_0x385e7b[_0x90db('0x1f')],_0x4d4ec2['id']);var _0x2af403={'ListId':_0x1d1b68};var _0x427ea3=_0x36b1a5[_0x90db('0x23')]&&_0x36b1a5[_0x90db('0x23')]!=='0'?_0x36b1a5[_0x90db('0x23')]:_0x90db('0x15');if(_0x3b3c89){logger[_0x90db('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x385e7b[_0x90db('0x1f')],_0x4d4ec2['id']);_0x2af403[_0x427ea3]=_['isNil'](_0x385e7b[_0x90db('0x10')])?_0x385e7b[_0x90db('0x11')]:_0x385e7b[_0x90db('0x12')];if(_[_0x90db('0x24')](_0x385e7b[_0x90db('0x10')])){_0x2af403['firstName']=_0x385e7b['calleridname']&&_0x385e7b['calleridname']!==_0x90db('0x25')?_0x385e7b[_0x90db('0x26')]:'Unknown';}else{_0x2af403['firstName']=_0x385e7b[_0x90db('0x27')]&&_0x385e7b[_0x90db('0x27')]!==''?_0x385e7b[_0x90db('0x27')]:_0x90db('0x28');}return BPromise[_0x90db('0x1a')]()[_0x90db('0x29')](cmContactRpc[_0x90db('0x2a')](_0x2af403))[_0x90db('0x29')](function(_0x3136f2){_0x149952=_0x3136f2;_0x1a244c[_0x90db('0x2b')](_0x3136f2);if(_0x149952){logger[_0x90db('0x8')](_0x90db('0x2c'),_0x385e7b[_0x90db('0x1f')],_0x4d4ec2['id'],_0x149952['id']);}return;});}else{logger[_0x90db('0x8')](_0x90db('0x2d'),_0x385e7b[_0x90db('0x1f')],_0x4d4ec2['id']);_0x2af403[_0x427ea3]=_[_0x90db('0x24')](_0x385e7b['routeId'])?_0x385e7b[_0x90db('0x11')]:_0x385e7b[_0x90db('0x12')];if(_['isNil'](_0x385e7b[_0x90db('0x10')])){_0x2af403['firstName']=_0x385e7b[_0x90db('0x26')]&&_0x385e7b[_0x90db('0x26')]!==_0x90db('0x25')?_0x385e7b[_0x90db('0x26')]:_0x90db('0x28');}else{_0x2af403[_0x90db('0x13')]=_0x385e7b[_0x90db('0x27')]&&_0x385e7b['destcalleridname']!==_0x90db('0x25')?_0x385e7b[_0x90db('0x27')]:'Unknown';}_0x149952=_0x2af403;_0x1a244c[_0x90db('0x2b')](_0x2af403);return;}}})[_0x90db('0x29')](function(){if(_0x42b690){emit(_0x385e7b['uniqueid'],_0x4d4ec2,util[_0x90db('0x2e')](_0x90db('0x2f'),_0x42b690['name']),util['format']('trigger:%s',_0x36b1a5[_0x90db('0x30')][_0x90db('0x31')]()),{'evt':_['merge'](_0x385e7b,{'autoCreate':_0x3b3c89}),'contact':_0x149952===undefined?{}:_0x149952,'contacts':_0x1a244c[_0x90db('0x1c')]===0x0?undefined:_0x1a244c});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 69b6c11..5649889 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 _0xda31=['voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','emit','info','stringify','prototype','clone','motionChannel','undefined','inspect','checkTriggers','interface','hasOwnProperty','status','merge','variables','length','Actions','agents','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','html','data2','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','600','winArguments','format','user:%s','trigger:%s:%s','jscripty','name','trigger:%s','exec','integration','accounts','queue','routeId','urlforward','script','parse','query','search','replace','checkTrigger','channel','every','AllConditions','checkConditions','AnyConditions','some','debug','checkTrigger:\x20trigger','evt','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','mailSubstatus','offlineMessage','equals','util','url','mustache','ioredis','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','voiceQueues','templates'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0xda31,0xfb));var _0x1da3=function(_0x4a002e,_0x14a5f6){_0x4a002e=_0x4a002e-0x0;var _0xb86ae3=_0xda31[_0x4a002e];return _0xb86ae3;};'use strict';var util=require(_0x1da3('0x0'));var _=require('lodash');var url=require(_0x1da3('0x1'));var Mustache=require(_0x1da3('0x2'));var Redis=require(_0x1da3('0x3'));var urlforward=require(_0x1da3('0x4'));var integration=require(_0x1da3('0x5'));var cmContact=require('./cmContact');var script=require(_0x1da3('0x6'));var config=require(_0x1da3('0x7'));var logger=require(_0x1da3('0x8'))(_0x1da3('0x9'));var ami=require(_0x1da3('0xa'));config[_0x1da3('0xb')]=_['defaults'](config['redis'],{'host':_0x1da3('0xc'),'port':0x18eb});var io=require(_0x1da3('0xd'))(new Redis(config[_0x1da3('0xb')]));var operators={'equals':function(_0x3c401f,_0x57d6b2){return _0x3c401f==_0x57d6b2;},'not_equals':function(_0x1b3230,_0x59ceb0){return _0x1b3230!=_0x59ceb0;}};var barAndWebActions=[_0x1da3('0xe'),'url',_0x1da3('0xf')];function Trigger(_0x2af5cd){this[_0x1da3('0x10')]=_0x2af5cd[_0x1da3('0x10')];this['agents']=_0x2af5cd['agents'];this[_0x1da3('0x11')]=_0x2af5cd[_0x1da3('0x11')];this['templates']=_0x2af5cd[_0x1da3('0x12')];this[_0x1da3('0x13')]=_0x2af5cd[_0x1da3('0x13')];this['zendeskAccounts']=_0x2af5cd[_0x1da3('0x14')];this[_0x1da3('0x15')]=_0x2af5cd[_0x1da3('0x15')];this[_0x1da3('0x16')]=_0x2af5cd[_0x1da3('0x16')];this[_0x1da3('0x17')]=_0x2af5cd[_0x1da3('0x17')];this['zohoAccounts']=_0x2af5cd[_0x1da3('0x18')];this[_0x1da3('0x19')]=_0x2af5cd[_0x1da3('0x19')];this[_0x1da3('0x1a')]=_0x2af5cd[_0x1da3('0x1a')];this[_0x1da3('0x1b')]=_0x2af5cd[_0x1da3('0x1b')];this[_0x1da3('0x1c')]=_0x2af5cd[_0x1da3('0x1c')];this['freshsalesAccounts']=_0x2af5cd[_0x1da3('0x1d')];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x1da3('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this['zohoAccounts'],'desk':this[_0x1da3('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x1da3('0x1c')],'freshsales':this[_0x1da3('0x1d')],'servicenow':this[_0x1da3('0x1b')]};ami['on'](_0x1da3('0x1e'),this[_0x1da3('0x1f')][_0x1da3('0x20')](this));ami['on'](_0x1da3('0x21'),this['syncCustomEvent']['bind'](this));ami['on'](_0x1da3('0x22'),this[_0x1da3('0x1f')][_0x1da3('0x20')](this));ami['on']('custom:agentcomplete',this['syncCustomEvent'][_0x1da3('0x20')](this));ami['on']('custom:agentnosuchnumber',this[_0x1da3('0x1f')][_0x1da3('0x20')](this));ami['on'](_0x1da3('0x23'),this[_0x1da3('0x1f')][_0x1da3('0x20')](this));ami['on'](_0x1da3('0x24'),this[_0x1da3('0x1f')][_0x1da3('0x20')](this));ami['on']('custom:agentcongestion',this['syncCustomEvent'][_0x1da3('0x20')](this));ami['on'](_0x1da3('0x25'),this[_0x1da3('0x1f')][_0x1da3('0x20')](this));ami['on'](_0x1da3('0x26'),this[_0x1da3('0x1f')][_0x1da3('0x20')](this));ami['on'](_0x1da3('0x27'),this[_0x1da3('0x1f')]['bind'](this));ami['on'](_0x1da3('0x28'),this[_0x1da3('0x1f')][_0x1da3('0x20')](this));ami['on'](_0x1da3('0x29'),this[_0x1da3('0x2a')][_0x1da3('0x20')](this));ami['on'](_0x1da3('0x2b'),this[_0x1da3('0x2a')]['bind'](this));ami['on'](_0x1da3('0x2c'),this[_0x1da3('0x2a')][_0x1da3('0x20')](this));ami['on'](_0x1da3('0x2d'),this[_0x1da3('0x1f')]['bind'](this));ami['on'](_0x1da3('0x2e'),this[_0x1da3('0x1f')][_0x1da3('0x20')](this));ami['on']('custom:substatus',this[_0x1da3('0x1f')][_0x1da3('0x20')](this));ami['on'](_0x1da3('0x2f'),this[_0x1da3('0x1f')]['bind'](this));ami['on']('custom:outgoingmessage',this[_0x1da3('0x1f')]['bind'](this));ami['on'](_0x1da3('0x30'),this['syncCustomEvent']['bind'](this));ami['on'](_0x1da3('0x31'),this[_0x1da3('0x1f')]['bind'](this));ami['on']('custom:offlineMessage',this[_0x1da3('0x1f')][_0x1da3('0x20')](this));}Trigger['prototype'][_0x1da3('0x32')]=function(_0x462c12,_0x1b2d38,_0x5d881b){logger[_0x1da3('0x33')](_0x462c12,_0x1b2d38,JSON[_0x1da3('0x34')](_0x5d881b));io['to'](_0x462c12)['emit'](_0x1b2d38,_0x5d881b);};Trigger[_0x1da3('0x35')][_0x1da3('0x1f')]=function(_0x4af4c3){var _0xac9dd4=_[_0x1da3('0x36')](_0x4af4c3);if(typeof _0xac9dd4[_0x1da3('0x37')]===_0x1da3('0x38')){_0xac9dd4[_0x1da3('0x37')]='voice';}logger['debug'](_0x1da3('0x1f'),util[_0x1da3('0x39')](_0xac9dd4,{'showHidden':!![],'depth':null}));this[_0x1da3('0x3a')](_0xac9dd4);};Trigger['prototype'][_0x1da3('0x2a')]=function(_0x29c10d){if(this['agents'][_0x29c10d[_0x1da3('0x3b')]]){this[_0x1da3('0x1f')](_0x29c10d);}};Trigger['prototype'][_0x1da3('0x3a')]=function(_0x2de809){var _0x5e4c86;for(var _0xfbb052 in this['triggers']){if(this['triggers'][_0x1da3('0x3c')](_0xfbb052)){if(this['triggers'][_0xfbb052][_0x1da3('0x3d')]){_0x5e4c86=this['checkTrigger'](this[_0x1da3('0x10')][_0xfbb052],_0x2de809);if(_0x5e4c86){_[_0x1da3('0x3e')](_0x2de809,_0x2de809[_0x1da3('0x3f')]);for(var _0x5cc4f6=0x0,_0x3b95c4,_0x579e4a,_0x117e4d;_0x5cc4f60x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','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','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x127c7e,_0x470192){var _0x45f955=function(_0x26dcea){while(--_0x26dcea){_0x127c7e['push'](_0x127c7e['shift']());}};_0x45f955(++_0x470192);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ 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 3af9c18..6ff0b31 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 _0x5925=['body','headers','substring','lastIndexOf','enduserId','outbound','destcalleridnum','&$filter=','\x20eq\x20\x27','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','nameField','idField','indexOf','content','ticketType','incident','assign','getString','Descriptions','/contacts(','Fields','phonecall','queue','callDirection','phonecalls','Subjects','odata-entityid','ticketId','catch','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','resolve','POST','password','then','access_token','toUpperCase',']\x20Wrong\x20credentials!','message','GET','value','isNil','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','toLowerCase','calleridnum','/systemusers(','Bearer\x20','4.0'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5925,0x187));var _0x5592=function(_0x11f4b5,_0x279f0d){_0x11f4b5=_0x11f4b5-0x0;var _0x59d5e0=_0x5925[_0x11f4b5];return _0x59d5e0;};'use strict';var _=require(_0x5592('0x0'));var rp=require('request-promise');var util=require(_0x5592('0x1'));var intUtil=require(_0x5592('0x2'));var md5=require(_0x5592('0x3'));var Redis=require(_0x5592('0x4'));var logger=require(_0x5592('0x5'))(_0x5592('0x6'));var config=require(_0x5592('0x7'));config['redis']=_[_0x5592('0x8')](config[_0x5592('0x9')],{'host':_0x5592('0xa'),'port':0x18eb});var io=require(_0x5592('0xb'))(new Redis(config['redis']));function getAuthToken(_0x2ef609,_0x5dff50,_0x2352c1){if(_0x2ef609[_0x5592('0xc')]){_0x2ef609[_0x5592('0xd')]=_0x2ef609['CloudProvider'][_0x5592('0xe')];_0x2ef609[_0x5592('0xf')]=_0x2ef609[_0x5592('0x10')]['data2'];return Promise[_0x5592('0x11')](_0x2ef609[_0x5592('0x10')]['data5']);}var _0x2856c8={'method':_0x5592('0x12'),'uri':_0x5dff50,'form':{'client_id':_0x2ef609['clientId'],'resource':_0x2ef609['remoteUri'],'username':_0x2ef609['username'],'password':_0x2ef609[_0x5592('0x13')],'grant_type':_0x5592('0x13'),'client_secret':_0x2ef609['clientSecret']},'json':!![]};return rp(_0x2856c8)[_0x5592('0x14')](function(_0x55af78){return _0x55af78[_0x5592('0x15')];})['catch'](function(_0x2b7daa){logger['error']('['+[_0x2352c1[_0x5592('0x16')]()]+_0x5592('0x17'));return _0x2b7daa[_0x5592('0x18')];});}function getUser(_0x1e3b7a,_0x37baf2,_0xfd3f28,_0x55f949,_0x4331c8,_0x4a360b){return new Promise(function(_0x18ffff,_0x219d49){return getAuthToken(_0x37baf2,_0x55f949,_0x4a360b)[_0x5592('0x14')](function(_0x3d5561){var _0x2398d8={'method':_0x5592('0x19'),'uri':_0x4331c8+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x3d5561,'OData-Version':'4.0'},'json':!![]};return rp(_0x2398d8);})[_0x5592('0x14')](function(_0xb0ebc8){var _0x9d33a1=_0xb0ebc8[_0x5592('0x1a')];var _0x164c25=![];var _0x112dff=null;if(!_[_0x5592('0x1b')](_0xfd3f28)){if(intUtil[_0x5592('0x1c')](_0xfd3f28[_0x5592('0x1d')])){_0x1e3b7a[_0x5592('0x1e')]=_0xfd3f28[_0x5592('0x1d')];for(_0x112dff=0x0;_0x112dff<_0x9d33a1[_0x5592('0x1f')];_0x112dff++){if(_0x9d33a1[_0x112dff]['internalemailaddress']===_0xfd3f28[_0x5592('0x1d')]&&!_0x9d33a1[_0x112dff][_0x5592('0x20')]){_0x164c25=!![];logger[_0x5592('0x21')]('['+[_0x4a360b['toUpperCase']()]+_0x5592('0x22')+_0x9d33a1[_0x112dff][_0x5592('0x23')]+'!');_0x1e3b7a[_0x5592('0x24')]=_0x9d33a1[_0x112dff][_0x5592('0x23')];}}}}if(!_0x164c25){logger[_0x5592('0x21')]('['+[_0x4a360b['toUpperCase']()]+_0x5592('0x25'));_0x1e3b7a[_0x5592('0x1e')]=_0x37baf2[_0x5592('0x26')];for(_0x112dff=0x0;_0x112dff<_0x9d33a1[_0x5592('0x1f')];_0x112dff++){if(_0x9d33a1[_0x112dff][_0x5592('0x27')]===_0x37baf2[_0x5592('0x26')]){_0x1e3b7a['userId']=_0x9d33a1[_0x112dff][_0x5592('0x23')];}}}_0x18ffff(_0x1e3b7a);})['catch'](function(_0x22c52f){_0x219d49(_0x22c52f['message']);});});}function createEndUser(_0xaf118a,_0x1e559e,_0x48a07f,_0x560246,_0x21e147,_0x1450e4,_0x51315d){return new Promise(function(_0x48fe5d,_0x408cc7){return getAuthToken(_0x1e559e,_0x48a07f,_0x1450e4)[_0x5592('0x14')](function(_0x27d34c){var _0x4ea671=_0x1450e4[_0x5592('0x28')]()==='outbound'?_0x21e147['destcalleridnum']:_0x21e147[_0x5592('0x29')];var _0x19b9a6={'method':_0x5592('0x12'),'uri':_0x560246+'contacts','body':{'fullname':_0x4ea671,'firstname':_0x4ea671,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5592('0x2a')+_0xaf118a[_0x5592('0x24')]+')'},'headers':{'Authorization':_0x5592('0x2b')+_0x27d34c,'OData-Version':_0x5592('0x2c')},'json':!![],'resolveWithFullResponse':!![]};_0x19b9a6[_0x5592('0x2d')][_0x51315d]=_0x4ea671;return rp(_0x19b9a6);})[_0x5592('0x14')](function(_0x531581){var _0x10f141=_0x531581[_0x5592('0x2e')]['odata-entityid'];var _0x180f44=_0x10f141[_0x5592('0x2f')](_0x10f141['lastIndexOf']('(')+0x1,_0x10f141[_0x5592('0x30')](')'));_0xaf118a[_0x5592('0x31')]=_0x180f44;_0x48fe5d(_0xaf118a);})['catch'](function(_0x24eea8){_0x408cc7(_0x24eea8[_0x5592('0x18')]);});});}function getEndUser(_0x311cec,_0x379f6a,_0x307013,_0x24ae8f,_0x5f3f51,_0x57fc31,_0x1ee353,_0x1d6d5a){var _0x1d4b4c=_0x57fc31[_0x5592('0x28')]()===_0x5592('0x32')?_0x5f3f51[_0x5592('0x33')]:_0x5f3f51[_0x5592('0x29')];return getAuthToken(_0x379f6a,_0x307013,_0x57fc31)[_0x5592('0x14')](function(_0x2f3771){_0x1d6d5a=_0x1d6d5a?_0x1d6d5a:'telephone1';var _0x36ee7b={'method':_0x5592('0x19'),'uri':_0x24ae8f+'contacts?$select='+_0x1d6d5a+_0x5592('0x34')+_0x1d6d5a+_0x5592('0x35')+_0x1d4b4c['replace']('+',_0x5592('0x36'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x2f3771,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x36ee7b);})[_0x5592('0x14')](function(_0x19b045){var _0x56b0c8=![];if(!_0x19b045)return _0x56b0c8;var _0x516ac6=_0x19b045['value'];for(var _0xde8b9d=0x0;_0xde8b9d<_0x516ac6[_0x5592('0x1f')];_0xde8b9d++){if(_0x516ac6[_0xde8b9d][_0x1d6d5a]===_0x1d4b4c){_0x56b0c8=!![];_0x311cec['enduserId']=_0x516ac6[_0xde8b9d]['contactid'];}}return _0x56b0c8;})[_0x5592('0x14')](function(_0x275356){if(_0x275356)return _0x311cec;if(_0x1ee353===_0x5592('0x37')){logger['info']('['+[_0x57fc31[_0x5592('0x16')]()]+_0x5592('0x38'));return _0x311cec;}return createEndUser(_0x311cec,_0x379f6a,_0x307013,_0x24ae8f,_0x5f3f51,_0x57fc31,_0x1d6d5a)[_0x5592('0x14')](function(_0x47720d){logger[_0x5592('0x21')]('['+[_0x57fc31[_0x5592('0x16')]()]+_0x5592('0x39'),_0x47720d[_0x5592('0x31')]);return _0x47720d;});});}function getCustomFields(_0x4a1408,_0x32dbba,_0x1f5a86){var _0x36b595={};if(_0x4a1408['length']>0x0){_[_0x5592('0x3a')](_0x4a1408,function(_0x529e60){if(_['includes']([_0x5592('0x3b'),_0x5592('0x3c')],_0x529e60['type'])&&_0x529e60[_0x5592('0x3d')]&&!_0x529e60['customField']){var _0xcdd599=_0x529e60[_0x5592('0x3e')][_0x5592('0x28')]();var _0x4d7198=_0xcdd599[_0x5592('0x2f')](0x0,_0xcdd599[_0x5592('0x3f')]('_'));var _0xc8f0b=_0xcdd599[_0x5592('0x2f')](_0xcdd599[_0x5592('0x3f')]('_')+0x1);if(_0x4d7198===_0x1f5a86){_0x36b595[_0xc8f0b]=_0x529e60[_0x5592('0x40')];}}});}return _0x36b595;}function getTicket(_0x46e0a7,_0x52a9fe,_0x4e9a2a,_0x4e578f,_0x55546c,_0x273547,_0x90785d){return new Promise(function(_0x132e60,_0x3be388){var _0x4b789f;return getAuthToken(_0x52a9fe,_0x4e9a2a,_0x90785d)[_0x5592('0x14')](function(_0x2d2076){if(_0x273547[_0x5592('0x41')]===_0x5592('0x42')){_0x4b789f={'method':'POST','uri':_0x4e578f+'incidents','body':Object[_0x5592('0x43')]({},{'title':intUtil[_0x5592('0x44')](_0x273547['Subjects'],_0x55546c,'\x20'),'description':intUtil['getString'](_0x273547[_0x5592('0x45')],_0x55546c,'\x0a'),'customerid_contact@odata.bind':_0x46e0a7[_0x5592('0x31')]?_0x5592('0x46')+_0x46e0a7[_0x5592('0x31')]+')':undefined,'ownerid@odata.bind':_0x5592('0x2a')+_0x46e0a7['userId']+')','caseorigincode':'1'},getCustomFields(_0x273547[_0x5592('0x47')],_0x55546c,_0x273547['ticketType'])),'headers':{'Authorization':_0x5592('0x2b')+_0x2d2076,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x273547['ticketType']===_0x5592('0x48')){var _0x1b6417=_0x46e0a7['enduserId']?[{'partyid_systemuser@odata.bind':_0x5592('0x2a')+_0x46e0a7['userId']+')','participationtypemask':_0x46e0a7['callDirection']===_0x5592('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0x5592('0x46')+_0x46e0a7[_0x5592('0x31')]+')','participationtypemask':_0x46e0a7[_0x5592('0x4a')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x5592('0x2a')+_0x46e0a7[_0x5592('0x24')]+')','participationtypemask':_0x46e0a7[_0x5592('0x4a')]===_0x5592('0x49')?0x2:0x1}];_0x4b789f={'method':'POST','uri':_0x4e578f+_0x5592('0x4b'),'body':Object[_0x5592('0x43')]({},{'subject':intUtil['getString'](_0x273547[_0x5592('0x4c')],_0x55546c,'\x20'),'phonenumber':String(_0x55546c[_0x5592('0x29')]),'description':intUtil[_0x5592('0x44')](_0x273547['Descriptions'],_0x55546c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x46e0a7[_0x5592('0x31')]?_0x5592('0x46')+_0x46e0a7[_0x5592('0x31')]+')':undefined,'ownerid@odata.bind':_0x5592('0x2a')+_0x46e0a7[_0x5592('0x24')]+')','directioncode':_0x46e0a7[_0x5592('0x4a')]===_0x5592('0x49')?![]:!![],'phonecall_activity_parties':_0x1b6417},getCustomFields(_0x273547[_0x5592('0x47')],_0x55546c,_0x273547['ticketType'])),'headers':{'Authorization':_0x5592('0x2b')+_0x2d2076,'OData-Version':_0x5592('0x2c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4b789f);})[_0x5592('0x14')](function(_0xb7082c){var _0x58d59e=_0xb7082c['headers'][_0x5592('0x4d')];var _0xfb0771=_0x58d59e['substring'](_0x58d59e[_0x5592('0x30')]('(')+0x1,_0x58d59e[_0x5592('0x30')](')'));_0x46e0a7[_0x5592('0x4e')]=_0xfb0771;_0x132e60(_0x46e0a7);})[_0x5592('0x4f')](function(_0x4889ff){_0x3be388(_0x4889ff['message']);});});}function emit(_0x171ed3,_0x52612a,_0x5400d3,_0x2b7b1b){var _0x3d3571={'uri':util['format'](_0x5592('0x50'),_0x171ed3,_0x5400d3,_0x2b7b1b)};io['to'](util[_0x5592('0x51')](_0x5592('0x52'),_0x52612a))[_0x5592('0x53')](_0x5592('0x54'),_0x3d3571);}exports['cs']=function(_0x570557,_0x174025,_0x2a8247,_0x34bf01,_0x3782bf,_0x4be794,_0x2b94a8,_0x348a81){var _0x15dbd0={};_0x4be794[_0x5592('0xd')]=_0x4be794[_0x5592('0xc')]?intUtil[_0x5592('0x55')](_0x4be794[_0x5592('0x10')][_0x5592('0xe')]):intUtil[_0x5592('0x55')](_0x4be794[_0x5592('0xd')]);_0x4be794[_0x5592('0x56')]=intUtil[_0x5592('0x55')](_0x4be794['serverUrl']);_0x15dbd0['callDirection']=_0x348a81===_0x5592('0x49')||_0x348a81===_0x5592('0x57')?_0x5592('0x49'):_0x5592('0x32');var _0x31c025=_0x4be794[_0x5592('0xc')]?util[_0x5592('0x51')](_0x5592('0x58'),_0x4be794[_0x5592('0x10')][_0x5592('0xe')]):util[_0x5592('0x51')](_0x5592('0x58'),_0x4be794[_0x5592('0xd')]);var _0x2bcc9a=util[_0x5592('0x51')](_0x5592('0x59'),_0x4be794['tenantId']);var _0x9b4415=util[_0x5592('0x51')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4be794[_0x5592('0x56')],_0x174025[_0x5592('0x5a')],md5(_0x174025[_0x5592('0x5a')]));if(_0x3782bf&&_0x3782bf[_0x5592('0x5b')]){logger['info']('[QUEUE]',_0x5592('0x5c'));_0x174025[_0x5592('0x5d')]=_0x9b4415;}else if(_0x2b94a8&&_0x2b94a8[_0x5592('0x5e')]&&_0x2b94a8[_0x5592('0x5e')]!=='none'){logger['info'](_0x5592('0x5f'),_0x5592('0x5c'));_0x174025['recordingURL']=_0x9b4415;}else{_0x174025['recordingURL']='';}return getUser(_0x15dbd0,_0x4be794,_0x34bf01,_0x2bcc9a,_0x31c025,_0x348a81)[_0x5592('0x14')](function(_0x4de22b){logger[_0x5592('0x21')]('['+_0x348a81[_0x5592('0x16')]()+_0x5592('0x60'),_0x4de22b[_0x5592('0x24')]);logger[_0x5592('0x21')]('['+_0x348a81[_0x5592('0x16')]()+_0x5592('0x61'),_0x4de22b['userEmail']);return getEndUser(_0x4de22b,_0x4be794,_0x2bcc9a,_0x31c025,_0x174025,_0x348a81,_0x2a8247[_0x5592('0x62')],_0x2a8247[_0x5592('0x63')]);})['then'](function(_0x29fd3b){logger['info']('['+_0x348a81[_0x5592('0x16')]()+_0x5592('0x64'),_0x29fd3b[_0x5592('0x31')]);logger[_0x5592('0x21')]('['+_0x348a81['toUpperCase']()+_0x5592('0x65'),_0x174025['calleridnum']);return getTicket(_0x29fd3b,_0x4be794,_0x2bcc9a,_0x31c025,_0x174025,_0x2a8247,_0x348a81);})['then'](function(_0xc030e3){logger['info'](util['format']('['+_0x348a81[_0x5592('0x16')]()+_0x5592('0x66'),_0x2a8247[_0x5592('0x41')],_0xc030e3[_0x5592('0x4e')]));logger['info'](util[_0x5592('0x51')]('['+_0x348a81['toUpperCase']()+_0x5592('0x67'),_0x348a81));if(_0x348a81!==_0x5592('0x57')&&_0x2a8247[_0x5592('0x68')]){logger['info']('['+_0x348a81['toUpperCase']()+']',_0x5592('0x69'));emit(_0x4be794['remoteUri'],_0x34bf01[_0x5592('0x6a')],_0x2a8247['ticketType'],_0xc030e3[_0x5592('0x4e')]);}})[_0x5592('0x4f')](function(_0x385a5d){logger[_0x5592('0x6b')]('['+_0x348a81[_0x5592('0x16')]()+_0x5592('0x6c'),_0x385a5d['message']);console[_0x5592('0x6b')]('Error\x20running\x20Dynamics365\x20integration',_0x385a5d);});}; \ No newline at end of file +var _0xedd0=['%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','picklist','type','nameField','idField','indexOf','content','ticketType','incident','assign','Subjects','getString','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','headers','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','clientId','username','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','then','value','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid','toLowerCase','outbound','destcalleridnum','POST','contacts','body','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','telephone1','contacts?$select=','&$filter=','replace'];(function(_0x2d2258,_0x2ce510){var _0x18e155=function(_0x11949e){while(--_0x11949e){_0x2d2258['push'](_0x2d2258['shift']());}};_0x18e155(++_0x2ce510);}(_0xedd0,0x17f));var _0x0edd=function(_0x83f3c7,_0x4da5c9){_0x83f3c7=_0x83f3c7-0x0;var _0x13e57a=_0xedd0[_0x83f3c7];return _0x13e57a;};'use strict';var _=require(_0x0edd('0x0'));var rp=require(_0x0edd('0x1'));var util=require(_0x0edd('0x2'));var intUtil=require(_0x0edd('0x3'));var md5=require(_0x0edd('0x4'));var Redis=require(_0x0edd('0x5'));var logger=require(_0x0edd('0x6'))(_0x0edd('0x7'));var config=require(_0x0edd('0x8'));config[_0x0edd('0x9')]=_['defaults'](config['redis'],{'host':_0x0edd('0xa'),'port':0x18eb});var io=require(_0x0edd('0xb'))(new Redis(config['redis']));function getAuthToken(_0x370fd9,_0x22d2ff,_0xf488ac){if(_0x370fd9[_0x0edd('0xc')]){_0x370fd9[_0x0edd('0xd')]=_0x370fd9[_0x0edd('0xe')][_0x0edd('0xf')];_0x370fd9[_0x0edd('0x10')]=_0x370fd9[_0x0edd('0xe')][_0x0edd('0x11')];return Promise[_0x0edd('0x12')](_0x370fd9[_0x0edd('0xe')][_0x0edd('0x13')]);}var _0xe0ba89={'method':'POST','uri':_0x22d2ff,'form':{'client_id':_0x370fd9[_0x0edd('0x14')],'resource':_0x370fd9[_0x0edd('0xd')],'username':_0x370fd9[_0x0edd('0x15')],'password':_0x370fd9[_0x0edd('0x16')],'grant_type':'password','client_secret':_0x370fd9[_0x0edd('0x17')]},'json':!![]};return rp(_0xe0ba89)['then'](function(_0x5133bb){return _0x5133bb[_0x0edd('0x18')];})[_0x0edd('0x19')](function(_0x41b2a1){logger[_0x0edd('0x1a')]('['+[_0xf488ac[_0x0edd('0x1b')]()]+_0x0edd('0x1c'));return _0x41b2a1[_0x0edd('0x1d')];});}function getUser(_0x5794f4,_0x57d8ae,_0xaad092,_0x5e4db9,_0x1ebad7,_0x468bc6){return new Promise(function(_0x3d1d2b,_0x46e3c5){return getAuthToken(_0x57d8ae,_0x5e4db9,_0x468bc6)['then'](function(_0x4fb8b8){var _0x54adbd={'method':_0x0edd('0x1e'),'uri':_0x1ebad7+_0x0edd('0x1f'),'headers':{'Authorization':_0x0edd('0x20')+_0x4fb8b8,'OData-Version':_0x0edd('0x21')},'json':!![]};return rp(_0x54adbd);})[_0x0edd('0x22')](function(_0x4b3932){var _0x1cd50b=_0x4b3932[_0x0edd('0x23')];var _0x5b333c=![];var _0x19755f=null;if(!_['isNil'](_0xaad092)){if(intUtil[_0x0edd('0x24')](_0xaad092['email'])){_0x5794f4[_0x0edd('0x25')]=_0xaad092[_0x0edd('0x26')];for(_0x19755f=0x0;_0x19755f<_0x1cd50b[_0x0edd('0x27')];_0x19755f++){if(_0x1cd50b[_0x19755f][_0x0edd('0x28')]===_0xaad092[_0x0edd('0x26')]&&!_0x1cd50b[_0x19755f][_0x0edd('0x29')]){_0x5b333c=!![];logger[_0x0edd('0x2a')]('['+[_0x468bc6['toUpperCase']()]+_0x0edd('0x2b')+_0x1cd50b[_0x19755f]['systemuserid']+'!');_0x5794f4[_0x0edd('0x2c')]=_0x1cd50b[_0x19755f][_0x0edd('0x2d')];}}}}if(!_0x5b333c){logger[_0x0edd('0x2a')]('['+[_0x468bc6[_0x0edd('0x1b')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x5794f4['userEmail']=_0x57d8ae[_0x0edd('0x15')];for(_0x19755f=0x0;_0x19755f<_0x1cd50b[_0x0edd('0x27')];_0x19755f++){if(_0x1cd50b[_0x19755f][_0x0edd('0x28')]===_0x57d8ae[_0x0edd('0x15')]){_0x5794f4[_0x0edd('0x2c')]=_0x1cd50b[_0x19755f][_0x0edd('0x2d')];}}}_0x3d1d2b(_0x5794f4);})['catch'](function(_0x5b295f){_0x46e3c5(_0x5b295f[_0x0edd('0x1d')]);});});}function createEndUser(_0x26fe70,_0x10041d,_0x27d046,_0x504ed3,_0x5e78ec,_0x384646,_0x20ba45){return new Promise(function(_0x4710d8,_0x13a8c5){return getAuthToken(_0x10041d,_0x27d046,_0x384646)[_0x0edd('0x22')](function(_0x2eb213){var _0x15bbff=_0x384646[_0x0edd('0x2e')]()===_0x0edd('0x2f')?_0x5e78ec[_0x0edd('0x30')]:_0x5e78ec['calleridnum'];var _0x1e9599={'method':_0x0edd('0x31'),'uri':_0x504ed3+_0x0edd('0x32'),'body':{'fullname':_0x15bbff,'firstname':_0x15bbff,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x26fe70[_0x0edd('0x2c')]+')'},'headers':{'Authorization':_0x0edd('0x20')+_0x2eb213,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x1e9599[_0x0edd('0x33')][_0x20ba45]=_0x15bbff;return rp(_0x1e9599);})[_0x0edd('0x22')](function(_0x2d34db){var _0x4bb18c=_0x2d34db['headers'][_0x0edd('0x34')];var _0x3fdf8f=_0x4bb18c[_0x0edd('0x35')](_0x4bb18c['lastIndexOf']('(')+0x1,_0x4bb18c[_0x0edd('0x36')](')'));_0x26fe70[_0x0edd('0x37')]=_0x3fdf8f;_0x4710d8(_0x26fe70);})[_0x0edd('0x19')](function(_0x14cb0e){_0x13a8c5(_0x14cb0e[_0x0edd('0x1d')]);});});}function getEndUser(_0x2b077c,_0x3a6cdb,_0xb00164,_0x37d6b6,_0x10bb0f,_0x51b45f,_0x5b52a8,_0x437abd){var _0x33b29a=_0x51b45f[_0x0edd('0x2e')]()===_0x0edd('0x2f')?_0x10bb0f[_0x0edd('0x30')]:_0x10bb0f[_0x0edd('0x38')];return getAuthToken(_0x3a6cdb,_0xb00164,_0x51b45f)[_0x0edd('0x22')](function(_0x156374){_0x437abd=_0x437abd?_0x437abd:_0x0edd('0x39');var _0x54bd0b={'method':'GET','uri':_0x37d6b6+_0x0edd('0x3a')+_0x437abd+_0x0edd('0x3b')+_0x437abd+'\x20eq\x20\x27'+_0x33b29a[_0x0edd('0x3c')]('+',_0x0edd('0x3d'))+'\x27','headers':{'Authorization':_0x0edd('0x20')+_0x156374,'If-None-Match':null,'OData-Version':_0x0edd('0x21')},'json':!![]};return rp(_0x54bd0b);})[_0x0edd('0x22')](function(_0x55970e){var _0x1c91d4=![];if(!_0x55970e)return _0x1c91d4;var _0x10e3c0=_0x55970e[_0x0edd('0x23')];for(var _0x496b32=0x0;_0x496b32<_0x10e3c0[_0x0edd('0x27')];_0x496b32++){if(_0x10e3c0[_0x496b32][_0x437abd]===_0x33b29a){_0x1c91d4=!![];_0x2b077c[_0x0edd('0x37')]=_0x10e3c0[_0x496b32][_0x0edd('0x3e')];}}return _0x1c91d4;})[_0x0edd('0x22')](function(_0x526692){if(_0x526692)return _0x2b077c;if(_0x5b52a8==='nothing'){logger['info']('['+[_0x51b45f[_0x0edd('0x1b')]()]+_0x0edd('0x3f'));return _0x2b077c;}return createEndUser(_0x2b077c,_0x3a6cdb,_0xb00164,_0x37d6b6,_0x10bb0f,_0x51b45f,_0x437abd)['then'](function(_0x39bfe1){logger[_0x0edd('0x2a')]('['+[_0x51b45f['toUpperCase']()]+_0x0edd('0x40'),_0x39bfe1['enduserId']);return _0x39bfe1;});});}function getCustomFields(_0x48c41d,_0x4c7e5a,_0x2b63d8){var _0x5ec04f={};if(_0x48c41d['length']>0x0){_['forEach'](_0x48c41d,function(_0x325d95){if(_['includes'](['string',_0x0edd('0x41')],_0x325d95[_0x0edd('0x42')])&&_0x325d95[_0x0edd('0x43')]&&!_0x325d95['customField']){var _0xb1063b=_0x325d95[_0x0edd('0x44')]['toLowerCase']();var _0x40bc39=_0xb1063b[_0x0edd('0x35')](0x0,_0xb1063b[_0x0edd('0x45')]('_'));var _0x2b2693=_0xb1063b[_0x0edd('0x35')](_0xb1063b[_0x0edd('0x45')]('_')+0x1);if(_0x40bc39===_0x2b63d8){_0x5ec04f[_0x2b2693]=_0x325d95[_0x0edd('0x46')];}}});}return _0x5ec04f;}function getTicket(_0x8c1f1e,_0x219e51,_0x13d09d,_0x70fa85,_0x4ce53b,_0x29e245,_0x1d4bee){return new Promise(function(_0x52b59f,_0x3385d5){var _0x1f8d49;return getAuthToken(_0x219e51,_0x13d09d,_0x1d4bee)[_0x0edd('0x22')](function(_0x4e283d){if(_0x29e245[_0x0edd('0x47')]===_0x0edd('0x48')){_0x1f8d49={'method':_0x0edd('0x31'),'uri':_0x70fa85+'incidents','body':Object[_0x0edd('0x49')]({},{'title':intUtil['getString'](_0x29e245[_0x0edd('0x4a')],_0x4ce53b,'\x20'),'description':intUtil[_0x0edd('0x4b')](_0x29e245[_0x0edd('0x4c')],_0x4ce53b,'\x0a'),'customerid_contact@odata.bind':_0x8c1f1e['enduserId']?_0x0edd('0x4d')+_0x8c1f1e[_0x0edd('0x37')]+')':undefined,'ownerid@odata.bind':_0x0edd('0x4e')+_0x8c1f1e[_0x0edd('0x2c')]+')','caseorigincode':'1'},getCustomFields(_0x29e245[_0x0edd('0x4f')],_0x4ce53b,_0x29e245[_0x0edd('0x47')])),'headers':{'Authorization':_0x0edd('0x20')+_0x4e283d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x29e245[_0x0edd('0x47')]===_0x0edd('0x50')){var _0xa5ee54=_0x8c1f1e[_0x0edd('0x37')]?[{'partyid_systemuser@odata.bind':_0x0edd('0x4e')+_0x8c1f1e['userId']+')','participationtypemask':_0x8c1f1e[_0x0edd('0x51')]===_0x0edd('0x52')?0x2:0x1},{'partyid_contact@odata.bind':_0x0edd('0x4d')+_0x8c1f1e[_0x0edd('0x37')]+')','participationtypemask':_0x8c1f1e[_0x0edd('0x51')]===_0x0edd('0x52')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x0edd('0x4e')+_0x8c1f1e[_0x0edd('0x2c')]+')','participationtypemask':_0x8c1f1e[_0x0edd('0x51')]==='queue'?0x2:0x1}];_0x1f8d49={'method':_0x0edd('0x31'),'uri':_0x70fa85+_0x0edd('0x53'),'body':Object['assign']({},{'subject':intUtil[_0x0edd('0x4b')](_0x29e245[_0x0edd('0x4a')],_0x4ce53b,'\x20'),'phonenumber':String(_0x4ce53b[_0x0edd('0x38')]),'description':intUtil['getString'](_0x29e245[_0x0edd('0x4c')],_0x4ce53b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x8c1f1e[_0x0edd('0x37')]?_0x0edd('0x4d')+_0x8c1f1e[_0x0edd('0x37')]+')':undefined,'ownerid@odata.bind':_0x0edd('0x4e')+_0x8c1f1e['userId']+')','directioncode':_0x8c1f1e[_0x0edd('0x51')]===_0x0edd('0x52')?![]:!![],'phonecall_activity_parties':_0xa5ee54},getCustomFields(_0x29e245[_0x0edd('0x4f')],_0x4ce53b,_0x29e245[_0x0edd('0x47')])),'headers':{'Authorization':_0x0edd('0x20')+_0x4e283d,'OData-Version':_0x0edd('0x21')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1f8d49);})[_0x0edd('0x22')](function(_0x228a43){var _0x24da51=_0x228a43[_0x0edd('0x54')]['odata-entityid'];var _0x5a9c8b=_0x24da51[_0x0edd('0x35')](_0x24da51['lastIndexOf']('(')+0x1,_0x24da51[_0x0edd('0x36')](')'));_0x8c1f1e[_0x0edd('0x55')]=_0x5a9c8b;_0x52b59f(_0x8c1f1e);})[_0x0edd('0x19')](function(_0x5ed120){_0x3385d5(_0x5ed120['message']);});});}function emit(_0x2de67e,_0x4427bd,_0x343cfe,_0x5d5659){var _0xb46d8e={'uri':util['format'](_0x0edd('0x56'),_0x2de67e,_0x343cfe,_0x5d5659)};io['to'](util[_0x0edd('0x57')]('user:%s',_0x4427bd))['emit'](_0x0edd('0x58'),_0xb46d8e);}exports['cs']=function(_0x33eef0,_0x1a2f42,_0x65083a,_0x2555a7,_0x24902f,_0x50503d,_0x1aa7b0,_0xae6648){var _0x3888db={};_0x50503d[_0x0edd('0xd')]=_0x50503d[_0x0edd('0xc')]?intUtil[_0x0edd('0x59')](_0x50503d[_0x0edd('0xe')]['data7']):intUtil[_0x0edd('0x59')](_0x50503d['remoteUri']);_0x50503d[_0x0edd('0x5a')]=intUtil[_0x0edd('0x59')](_0x50503d[_0x0edd('0x5a')]);_0x3888db[_0x0edd('0x51')]=_0xae6648===_0x0edd('0x52')||_0xae6648==='unmanaged'?_0x0edd('0x52'):_0x0edd('0x2f');var _0x1c25f2=_0x50503d[_0x0edd('0xc')]?util[_0x0edd('0x57')](_0x0edd('0x5b'),_0x50503d[_0x0edd('0xe')][_0x0edd('0xf')]):util[_0x0edd('0x57')]('%s/api/data/v9.0/',_0x50503d[_0x0edd('0xd')]);var _0x3d122f=util[_0x0edd('0x57')]('https://login.microsoftonline.com/%s/oauth2/token',_0x50503d[_0x0edd('0x10')]);var _0x13f564=util[_0x0edd('0x57')](_0x0edd('0x5c'),_0x50503d[_0x0edd('0x5a')],_0x1a2f42[_0x0edd('0x5d')],md5(_0x1a2f42['uniqueid']));if(_0x24902f&&_0x24902f[_0x0edd('0x5e')]){logger[_0x0edd('0x2a')](_0x0edd('0x5f'),'Recording\x20is\x20enabled!');_0x1a2f42['recordingURL']=_0x13f564;}else if(_0x1aa7b0&&_0x1aa7b0[_0x0edd('0x60')]&&_0x1aa7b0[_0x0edd('0x60')]!==_0x0edd('0x61')){logger[_0x0edd('0x2a')]('[OUTBOUND]',_0x0edd('0x62'));_0x1a2f42[_0x0edd('0x63')]=_0x13f564;}else{_0x1a2f42[_0x0edd('0x63')]='';}return getUser(_0x3888db,_0x50503d,_0x2555a7,_0x3d122f,_0x1c25f2,_0xae6648)['then'](function(_0x2be560){logger[_0x0edd('0x2a')]('['+_0xae6648[_0x0edd('0x1b')]()+_0x0edd('0x64'),_0x2be560[_0x0edd('0x2c')]);logger[_0x0edd('0x2a')]('['+_0xae6648[_0x0edd('0x1b')]()+_0x0edd('0x65'),_0x2be560['userEmail']);return getEndUser(_0x2be560,_0x50503d,_0x3d122f,_0x1c25f2,_0x1a2f42,_0xae6648,_0x65083a[_0x0edd('0x66')],_0x65083a[_0x0edd('0x67')]);})[_0x0edd('0x22')](function(_0x4e8f30){logger[_0x0edd('0x2a')]('['+_0xae6648['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x4e8f30[_0x0edd('0x37')]);logger[_0x0edd('0x2a')]('['+_0xae6648[_0x0edd('0x1b')]()+_0x0edd('0x68'),_0x1a2f42[_0x0edd('0x38')]);return getTicket(_0x4e8f30,_0x50503d,_0x3d122f,_0x1c25f2,_0x1a2f42,_0x65083a,_0xae6648);})[_0x0edd('0x22')](function(_0x9380a0){logger[_0x0edd('0x2a')](util[_0x0edd('0x57')]('['+_0xae6648[_0x0edd('0x1b')]()+_0x0edd('0x69'),_0x65083a['ticketType'],_0x9380a0[_0x0edd('0x55')]));logger[_0x0edd('0x2a')](util[_0x0edd('0x57')]('['+_0xae6648[_0x0edd('0x1b')]()+']\x20Call\x20direction:\x20%s',_0xae6648));if(_0xae6648!==_0x0edd('0x6a')&&_0x65083a[_0x0edd('0x6b')]){logger[_0x0edd('0x2a')]('['+_0xae6648[_0x0edd('0x1b')]()+']',_0x0edd('0x6c'));emit(_0x50503d[_0x0edd('0xd')],_0x2555a7[_0x0edd('0x6d')],_0x65083a[_0x0edd('0x47')],_0x9380a0[_0x0edd('0x55')]);}})[_0x0edd('0x19')](function(_0x501712){logger[_0x0edd('0x1a')]('['+_0xae6648[_0x0edd('0x1b')]()+_0x0edd('0x6e'),_0x501712[_0x0edd('0x1d')]);console[_0x0edd('0x1a')]('Error\x20running\x20Dynamics365\x20integration',_0x501712);});}; \ 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 181431b..a63b53a 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 _0xae42=['value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','debug','[HTTP]','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','toString','idField','push','content','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridnum','[OUTBOUND]','stringify','monitor_format','lastevent','catch','toUpperCase','request-promise','md5','ioredis','../../../../config/environment','redis','application/json','emit','Creating\x20new\x20ticket...','merge','format','calleridname','Subjects','getString','
','Tags','name','Fields','custom_fields','mapValues','keyBy'];(function(_0x40c0ff,_0x32ef02){var _0x59f4d1=function(_0x5876c0){while(--_0x5876c0){_0x40c0ff['push'](_0x40c0ff['shift']());}};_0x59f4d1(++_0x32ef02);}(_0xae42,0x98));var _0x2ae4=function(_0x1b0e59,_0x596faf){_0x1b0e59=_0x1b0e59-0x0;var _0x383761=_0xae42[_0x1b0e59];return _0x383761;};'use strict';var _=require('lodash');var rp=require(_0x2ae4('0x0'));var md5=require(_0x2ae4('0x1'));var util=require('util');var Redis=require(_0x2ae4('0x2'));var intUtil=require('./util');var config=require(_0x2ae4('0x3'));var logger=require('../../../../config/logger')('freshdesk');config['redis']=_['defaults'](config[_0x2ae4('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2ae4('0x4')]));var headers={'Content-Type':_0x2ae4('0x5'),'Accept':_0x2ae4('0x5')};function emit(_0x311d8e,_0x46f4de,_0x532a10){io['to'](_0x311d8e)[_0x2ae4('0x6')](_0x46f4de,_0x532a10);}function getTicket(_0x2bf235,_0x205df0,_0x47f3cf,_0x2da8c9,_0x5beaad){logger['info'](_0x2ae4('0x7'));var _0x5b1c17=_[_0x2ae4('0x8')]({'responder_id':_0x205df0['id'],'requester_id':_0x47f3cf['id'],'name':util[_0x2ae4('0x9')]('Caller\x20-\x20%s',_0x5beaad[_0x2ae4('0xa')]),'phone':_0x5beaad['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2da8c9[_0x2ae4('0xb')],_0x5beaad,'\x20'),'description':intUtil[_0x2ae4('0xc')](_0x2da8c9['Descriptions'],_0x5beaad,_0x2ae4('0xd')),'tags':getTags(_0x2da8c9[_0x2ae4('0xe')],_0x2ae4('0xf'))},getCustomFields(_0x2da8c9[_0x2ae4('0x10')],_0x5beaad));_0x5b1c17[_0x2ae4('0x11')]=_[_0x2ae4('0x12')](_[_0x2ae4('0x13')](_0x5b1c17[_0x2ae4('0x11')],'id'),_0x2ae4('0x14'));return request({'uri':util['format'](_0x2ae4('0x15'),_0x2bf235[_0x2ae4('0x16')]),'method':_0x2ae4('0x17'),'body':_0x5b1c17})[_0x2ae4('0x18')](function(_0x5773d9){logger[_0x2ae4('0x19')](_0x2ae4('0x1a'));return _0x5773d9;});}function getUser(_0x411d50,_0x181653){if(intUtil[_0x2ae4('0x1b')](_0x181653)){return request({'uri':util[_0x2ae4('0x9')](_0x2ae4('0x1c'),_0x411d50[_0x2ae4('0x16')]),'qs':{'email':_0x181653}})[_0x2ae4('0x18')](function(_0x41fd0e){if(_0x41fd0e[_0x2ae4('0x1d')]){logger['info'](_0x2ae4('0x1e'));return _[_0x2ae4('0x1f')](_0x41fd0e,function(_0x7e38f9){return _0x7e38f9[_0x2ae4('0x20')][_0x2ae4('0x21')]===_0x181653;});}else{logger[_0x2ae4('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2ae4('0x9')]('%s/api/v2/agents/me',_0x411d50[_0x2ae4('0x16')])})['then'](function(_0x427274){logger['info']('Admin\x20account\x20selected.');return _0x427274;});}});}else{logger[_0x2ae4('0x19')](_0x2ae4('0x22'));return request({'uri':util[_0x2ae4('0x9')]('%s/api/v2/agents/me',_0x411d50[_0x2ae4('0x16')])})[_0x2ae4('0x18')](function(_0x3ef9e2){logger[_0x2ae4('0x19')](_0x2ae4('0x23'));return _0x3ef9e2;});}}function getEndUser(_0x527c9c,_0x2ab237,_0x346bee){logger[_0x2ae4('0x19')](_0x2ae4('0x24'),_0x346bee);return request({'uri':util[_0x2ae4('0x9')](_0x2ae4('0x25'),_0x527c9c[_0x2ae4('0x16')]),'qs':{'phone':_0x346bee}})[_0x2ae4('0x18')](function(_0x373ba9){if(_0x373ba9[_0x2ae4('0x1d')]){logger['info']('Enduser\x20found!');return _[_0x2ae4('0x1f')](_0x373ba9,{'phone':_0x346bee});}else{logger[_0x2ae4('0x19')](_0x2ae4('0x26'));return request({'uri':util[_0x2ae4('0x9')](_0x2ae4('0x25'),_0x527c9c[_0x2ae4('0x16')]),'method':_0x2ae4('0x17'),'body':{'name':_0x2ab237,'phone':_0x346bee}})[_0x2ae4('0x18')](function(_0x1705ac){logger[_0x2ae4('0x19')](_0x2ae4('0x27'));return _0x1705ac;});}});}function getAuth(_0x6364c7){return util[_0x2ae4('0x9')](_0x2ae4('0x28'),new Buffer(_0x6364c7[_0x2ae4('0x29')]+':X')['toString']('base64'));}function request(_0x4dc233){logger[_0x2ae4('0x2a')](_0x2ae4('0x2b'),JSON['stringify'](_0x4dc233));return rp(_['defaults'](_0x4dc233,{'method':_0x2ae4('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x17fea7,_0x5a9080){var _0xb81cdb=[];if(_0x17fea7&&_0x17fea7[_0x2ae4('0x1d')]>0x0){_0xb81cdb=_[_0x2ae4('0x2d')](_0x17fea7,_0x5a9080);}return _0xb81cdb;}function getCustomFields(_0x48472c,_0x285a55){var _0x511f7a=[];var _0x18ff79={'custom_fields':[]};if(_0x48472c[_0x2ae4('0x1d')]>0x0){_['forEach'](_0x48472c,function(_0x458329){if(_[_0x2ae4('0x2e')]([_0x2ae4('0x2f'),_0x2ae4('0x30')],_0x458329[_0x2ae4('0x31')])&&_0x458329[_0x2ae4('0x32')]&&!_0x458329[_0x2ae4('0x33')]){_0x18ff79[_0x458329['nameField'][_0x2ae4('0x34')]()]=_0x458329['content'][_0x2ae4('0x35')]();}else if(_[_0x2ae4('0x2e')]([_0x2ae4('0x2f'),_0x2ae4('0x30')],_0x458329[_0x2ae4('0x31')])&&_0x458329[_0x2ae4('0x36')]&&_0x458329[_0x2ae4('0x33')]){_0x18ff79[_0x2ae4('0x11')][_0x2ae4('0x37')]({'id':_0x458329[_0x2ae4('0x36')],'value':_0x458329[_0x2ae4('0x38')][_0x2ae4('0x35')]()});}else if(_0x458329['type']===_0x2ae4('0x39')&&_0x458329[_0x2ae4('0x3a')]&&_0x458329[_0x2ae4('0x36')]&&_0x458329[_0x2ae4('0x33')]){_0x285a55[_0x458329[_0x2ae4('0x3a')]]&&_0x18ff79[_0x2ae4('0x11')][_0x2ae4('0x37')]({'id':_0x458329['idField'],'value':_0x285a55[_0x458329[_0x2ae4('0x3a')]][_0x2ae4('0x35')]()});}else if(_0x458329[_0x2ae4('0x31')]===_0x2ae4('0x3b')&&_0x458329[_0x2ae4('0x3c')]&&_0x458329[_0x2ae4('0x3c')][_0x2ae4('0xf')]&&_0x458329[_0x2ae4('0x36')]&&_0x458329[_0x2ae4('0x33')]){_0x285a55[_0x458329['Variable']['name'][_0x2ae4('0x34')]()]&&_0x18ff79['custom_fields'][_0x2ae4('0x37')]({'id':_0x458329[_0x2ae4('0x36')],'value':_0x285a55[_0x458329['Variable'][_0x2ae4('0xf')][_0x2ae4('0x34')]()][_0x2ae4('0x35')]()});}});}return _0x18ff79;}exports['queue']=function(_0x549623,_0x426592,_0x4feea8,_0x55403c,_0x4268d2,_0x5243a9){var _0x568d88,_0x1f8e14;_0x5243a9['remoteUri']=intUtil[_0x2ae4('0x3d')](_0x5243a9[_0x2ae4('0x16')]);_0x5243a9[_0x2ae4('0x3e')]=intUtil[_0x2ae4('0x3d')](_0x5243a9[_0x2ae4('0x3e')]);if(_0x4268d2&&_0x4268d2['monitor_format']){logger[_0x2ae4('0x19')]('[QUEUE]',_0x2ae4('0x3f'));_0x426592[_0x2ae4('0x40')]=util[_0x2ae4('0x9')](_0x2ae4('0x41'),_0x5243a9[_0x2ae4('0x3e')],_0x426592[_0x2ae4('0x42')],md5(_0x426592['uniqueid']));}else{_0x426592['recordingURL']='';}headers[_0x2ae4('0x43')]=getAuth(_0x5243a9);return getUser(_0x5243a9,_0x55403c['email'])[_0x2ae4('0x18')](function(_0x21c845){_0x568d88=_0x21c845;logger[_0x2ae4('0x19')]('The\x20User\x20ID\x20is:',_0x568d88['id']);return getEndUser(_0x5243a9,_0x426592[_0x2ae4('0xa')],_0x426592['calleridnum']);})[_0x2ae4('0x18')](function(_0x2f61df){_0x1f8e14=_0x2f61df;logger[_0x2ae4('0x19')](_0x2ae4('0x44'),_0x1f8e14['id']);return getTicket(_0x5243a9,_0x568d88,_0x1f8e14,_0x4feea8,_0x426592);})[_0x2ae4('0x18')](function(_0x544ccf){if(_0x544ccf&&_0x544ccf['id']){logger[_0x2ae4('0x19')](_0x2ae4('0x1a'));logger[_0x2ae4('0x19')](_0x2ae4('0x45'),_0x544ccf['id']);logger[_0x2ae4('0x19')](_0x2ae4('0x46'),_0x2ae4('0x47'));emit(util[_0x2ae4('0x9')](_0x2ae4('0x48'),_0x55403c['name']),_0x2ae4('0x49'),{'uri':util['format'](_0x2ae4('0x4a'),_0x5243a9[_0x2ae4('0x16')],_0x544ccf['id'])});}})['catch'](function(_0x3f2944){logger[_0x2ae4('0x4b')]('[QUEUE]',JSON['stringify'](_0x3f2944));});};exports['outbound']=function(_0x804669,_0x29a3fe,_0x173f75,_0x4c45b3,_0x4b505e,_0x28734b,_0x27d497){var _0x12fff1,_0x8a5fb0;_0x28734b[_0x2ae4('0x16')]=intUtil[_0x2ae4('0x3d')](_0x28734b[_0x2ae4('0x16')]);_0x28734b[_0x2ae4('0x3e')]=intUtil['stripTrailingSlash'](_0x28734b[_0x2ae4('0x3e')]);if(_0x27d497&&_0x27d497['recordingFormat']&&_0x27d497[_0x2ae4('0x4c')]!==_0x2ae4('0x4d')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x29a3fe[_0x2ae4('0x40')]=util['format'](_0x2ae4('0x41'),_0x28734b['serverUrl'],_0x29a3fe['uniqueid'],md5(_0x29a3fe[_0x2ae4('0x42')]));}headers[_0x2ae4('0x43')]=getAuth(_0x28734b);return getUser(_0x28734b,_0x4c45b3['email'])[_0x2ae4('0x18')](function(_0x26d457){_0x12fff1=_0x26d457;logger[_0x2ae4('0x19')](_0x2ae4('0x4e'),_0x12fff1['id']);return getEndUser(_0x28734b,_0x29a3fe['destcalleridname'],_0x29a3fe[_0x2ae4('0x4f')]);})[_0x2ae4('0x18')](function(_0x384b66){_0x8a5fb0=_0x384b66;logger[_0x2ae4('0x19')](_0x2ae4('0x44'),_0x8a5fb0['id']);return getTicket(_0x28734b,_0x12fff1,_0x8a5fb0,_0x173f75,_0x29a3fe);})['then'](function(_0x29d2c0){if(_0x29d2c0&&_0x29d2c0['id']){logger[_0x2ae4('0x19')](_0x2ae4('0x1a'));logger[_0x2ae4('0x19')](_0x2ae4('0x45'),_0x29d2c0['id']);logger['info'](_0x2ae4('0x50'),_0x2ae4('0x47'));emit(util[_0x2ae4('0x9')](_0x2ae4('0x48'),_0x4c45b3[_0x2ae4('0xf')]),_0x2ae4('0x49'),{'uri':util[_0x2ae4('0x9')](_0x2ae4('0x4a'),_0x28734b[_0x2ae4('0x16')],_0x29d2c0['id'])});}})['catch'](function(_0x4f094a){logger['error'](_0x2ae4('0x50'),JSON[_0x2ae4('0x51')](_0x4f094a));});};exports['unmanaged']=function(_0x304eea,_0x9c1b44,_0x1b748a,_0x4382b8,_0x193f93,_0x32f04b){var _0x4ee59a,_0x104052;_0x32f04b['remoteUri']=intUtil[_0x2ae4('0x3d')](_0x32f04b['remoteUri']);_0x32f04b['serverUrl']=intUtil['stripTrailingSlash'](_0x32f04b[_0x2ae4('0x3e')]);if(_0x193f93&&_0x193f93[_0x2ae4('0x52')]){logger['info']('['+_0x9c1b44[_0x2ae4('0x53')]['toUpperCase']()+']',_0x2ae4('0x3f'));_0x9c1b44['recordingURL']=util[_0x2ae4('0x9')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32f04b[_0x2ae4('0x3e')],_0x9c1b44[_0x2ae4('0x42')],md5(_0x9c1b44[_0x2ae4('0x42')]));}else{_0x9c1b44[_0x2ae4('0x40')]='';}headers[_0x2ae4('0x43')]=getAuth(_0x32f04b);return getUser(_0x32f04b,'')[_0x2ae4('0x18')](function(_0xfffe50){_0x4ee59a=_0xfffe50;logger['info']('The\x20User\x20ID\x20is:',_0x4ee59a['id']);return getEndUser(_0x32f04b,_0x9c1b44[_0x2ae4('0xa')],_0x9c1b44['calleridnum']);})[_0x2ae4('0x18')](function(_0x5c98c3){_0x104052=_0x5c98c3;logger['info']('The\x20Enduser\x20ID\x20is:',_0x104052['id']);return getTicket(_0x32f04b,_0x4ee59a,_0x104052,_0x1b748a,_0x9c1b44);})[_0x2ae4('0x18')](function(_0x552309){if(_0x552309){logger[_0x2ae4('0x19')](_0x2ae4('0x1a'));logger[_0x2ae4('0x19')](_0x2ae4('0x45'),_0x552309['id']);}})[_0x2ae4('0x54')](function(_0x1f63d2){logger[_0x2ae4('0x4b')]('['+_0x9c1b44[_0x2ae4('0x53')][_0x2ae4('0x55')]()+']',JSON[_0x2ae4('0x51')](_0x1f63d2));});}; \ No newline at end of file +var _0x09c3=['validateEmail','format','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','remoteUri','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','push','variable','variableName','customVariable','name','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','calleridnum','getString','Subjects','
','Tags','keyBy','custom_fields','value','%s/api/v2/tickets','POST','then','Ticket\x20created!'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x09c3,0x1bb));var _0x309c=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0x09c3[_0x2c2980];return _0x2a20a9;};'use strict';var _=require(_0x309c('0x0'));var rp=require('request-promise');var md5=require(_0x309c('0x1'));var util=require(_0x309c('0x2'));var Redis=require(_0x309c('0x3'));var intUtil=require('./util');var config=require(_0x309c('0x4'));var logger=require(_0x309c('0x5'))(_0x309c('0x6'));config[_0x309c('0x7')]=_[_0x309c('0x8')](config[_0x309c('0x7')],{'host':_0x309c('0x9'),'port':0x18eb});var io=require(_0x309c('0xa'))(new Redis(config[_0x309c('0x7')]));var headers={'Content-Type':_0x309c('0xb'),'Accept':_0x309c('0xb')};function emit(_0x441733,_0x366086,_0x32f7cf){io['to'](_0x441733)[_0x309c('0xc')](_0x366086,_0x32f7cf);}function getTicket(_0x1305a4,_0xfaa534,_0x12cb22,_0x1ebce7,_0x3fd84e){logger[_0x309c('0xd')]('Creating\x20new\x20ticket...');var _0x24770f=_[_0x309c('0xe')]({'responder_id':_0xfaa534['id'],'requester_id':_0x12cb22['id'],'name':util['format']('Caller\x20-\x20%s',_0x3fd84e['calleridname']),'phone':_0x3fd84e[_0x309c('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x309c('0x10')](_0x1ebce7[_0x309c('0x11')],_0x3fd84e,'\x20'),'description':intUtil[_0x309c('0x10')](_0x1ebce7['Descriptions'],_0x3fd84e,_0x309c('0x12')),'tags':getTags(_0x1ebce7[_0x309c('0x13')],'name')},getCustomFields(_0x1ebce7['Fields'],_0x3fd84e));_0x24770f['custom_fields']=_['mapValues'](_[_0x309c('0x14')](_0x24770f[_0x309c('0x15')],'id'),_0x309c('0x16'));return request({'uri':util['format'](_0x309c('0x17'),_0x1305a4['remoteUri']),'method':_0x309c('0x18'),'body':_0x24770f})[_0x309c('0x19')](function(_0x5245bd){logger['info'](_0x309c('0x1a'));return _0x5245bd;});}function getUser(_0x25b86c,_0xf93830){if(intUtil[_0x309c('0x1b')](_0xf93830)){return request({'uri':util[_0x309c('0x1c')](_0x309c('0x1d'),_0x25b86c['remoteUri']),'qs':{'email':_0xf93830}})[_0x309c('0x19')](function(_0x16a2f7){if(_0x16a2f7[_0x309c('0x1e')]){logger[_0x309c('0xd')](_0x309c('0x1f'));return _[_0x309c('0x20')](_0x16a2f7,function(_0x5851f4){return _0x5851f4[_0x309c('0x21')][_0x309c('0x22')]===_0xf93830;});}else{logger['info'](_0x309c('0x23'));return request({'uri':util[_0x309c('0x1c')](_0x309c('0x24'),_0x25b86c['remoteUri'])})[_0x309c('0x19')](function(_0x18bf38){logger[_0x309c('0xd')]('Admin\x20account\x20selected.');return _0x18bf38;});}});}else{logger[_0x309c('0xd')](_0x309c('0x25'));return request({'uri':util['format'](_0x309c('0x24'),_0x25b86c[_0x309c('0x26')])})[_0x309c('0x19')](function(_0x424ab5){logger[_0x309c('0xd')](_0x309c('0x27'));return _0x424ab5;});}}function getEndUser(_0x4cab77,_0x3acfa3,_0x250bf1){logger['info']('Searching\x20enduser\x20with\x20phone',_0x250bf1);return request({'uri':util['format'](_0x309c('0x28'),_0x4cab77[_0x309c('0x26')]),'qs':{'phone':_0x250bf1}})['then'](function(_0x315e92){if(_0x315e92[_0x309c('0x1e')]){logger[_0x309c('0xd')](_0x309c('0x29'));return _['find'](_0x315e92,{'phone':_0x250bf1});}else{logger['info'](_0x309c('0x2a'));return request({'uri':util[_0x309c('0x1c')](_0x309c('0x28'),_0x4cab77[_0x309c('0x26')]),'method':_0x309c('0x18'),'body':{'name':_0x3acfa3,'phone':_0x250bf1}})[_0x309c('0x19')](function(_0x5cf120){logger[_0x309c('0xd')](_0x309c('0x2b'));return _0x5cf120;});}});}function getAuth(_0x38db6c){return util[_0x309c('0x1c')](_0x309c('0x2c'),new Buffer(_0x38db6c[_0x309c('0x2d')]+':X')[_0x309c('0x2e')](_0x309c('0x2f')));}function request(_0x470c89){logger[_0x309c('0x30')](_0x309c('0x31'),JSON[_0x309c('0x32')](_0x470c89));return rp(_[_0x309c('0x8')](_0x470c89,{'method':_0x309c('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x5c943a,_0xb0bef7){var _0x5afe00=[];if(_0x5c943a&&_0x5c943a[_0x309c('0x1e')]>0x0){_0x5afe00=_['map'](_0x5c943a,_0xb0bef7);}return _0x5afe00;}function getCustomFields(_0x4cd985,_0x5d24f0){var _0x23feec=[];var _0x137155={'custom_fields':[]};if(_0x4cd985[_0x309c('0x1e')]>0x0){_[_0x309c('0x34')](_0x4cd985,function(_0xf68bd4){if(_[_0x309c('0x35')]([_0x309c('0x36'),_0x309c('0x37')],_0xf68bd4[_0x309c('0x38')])&&_0xf68bd4[_0x309c('0x39')]&&!_0xf68bd4['customField']){_0x137155[_0xf68bd4[_0x309c('0x39')][_0x309c('0x3a')]()]=_0xf68bd4[_0x309c('0x3b')][_0x309c('0x2e')]();}else if(_[_0x309c('0x35')]([_0x309c('0x36'),_0x309c('0x37')],_0xf68bd4[_0x309c('0x38')])&&_0xf68bd4[_0x309c('0x3c')]&&_0xf68bd4[_0x309c('0x3d')]){_0x137155[_0x309c('0x15')][_0x309c('0x3e')]({'id':_0xf68bd4['idField'],'value':_0xf68bd4[_0x309c('0x3b')][_0x309c('0x2e')]()});}else if(_0xf68bd4['type']===_0x309c('0x3f')&&_0xf68bd4['variableName']&&_0xf68bd4[_0x309c('0x3c')]&&_0xf68bd4[_0x309c('0x3d')]){_0x5d24f0[_0xf68bd4['variableName']]&&_0x137155[_0x309c('0x15')][_0x309c('0x3e')]({'id':_0xf68bd4['idField'],'value':_0x5d24f0[_0xf68bd4[_0x309c('0x40')]]['toString']()});}else if(_0xf68bd4['type']===_0x309c('0x41')&&_0xf68bd4['Variable']&&_0xf68bd4['Variable']['name']&&_0xf68bd4[_0x309c('0x3c')]&&_0xf68bd4[_0x309c('0x3d')]){_0x5d24f0[_0xf68bd4['Variable'][_0x309c('0x42')]['toLowerCase']()]&&_0x137155[_0x309c('0x15')]['push']({'id':_0xf68bd4[_0x309c('0x3c')],'value':_0x5d24f0[_0xf68bd4[_0x309c('0x43')]['name'][_0x309c('0x3a')]()][_0x309c('0x2e')]()});}});}return _0x137155;}exports['queue']=function(_0x3d7978,_0x4a0e9c,_0x8fb308,_0x297ccc,_0x177f80,_0x38241f){var _0x3d408f,_0x51de9f;_0x38241f[_0x309c('0x26')]=intUtil[_0x309c('0x44')](_0x38241f[_0x309c('0x26')]);_0x38241f[_0x309c('0x45')]=intUtil['stripTrailingSlash'](_0x38241f['serverUrl']);if(_0x177f80&&_0x177f80[_0x309c('0x46')]){logger[_0x309c('0xd')](_0x309c('0x47'),_0x309c('0x48'));_0x4a0e9c[_0x309c('0x49')]=util[_0x309c('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38241f[_0x309c('0x45')],_0x4a0e9c[_0x309c('0x4a')],md5(_0x4a0e9c[_0x309c('0x4a')]));}else{_0x4a0e9c['recordingURL']='';}headers[_0x309c('0x4b')]=getAuth(_0x38241f);return getUser(_0x38241f,_0x297ccc[_0x309c('0x22')])[_0x309c('0x19')](function(_0x4afe36){_0x3d408f=_0x4afe36;logger[_0x309c('0xd')](_0x309c('0x4c'),_0x3d408f['id']);return getEndUser(_0x38241f,_0x4a0e9c['calleridname'],_0x4a0e9c[_0x309c('0xf')]);})[_0x309c('0x19')](function(_0x504a54){_0x51de9f=_0x504a54;logger[_0x309c('0xd')]('The\x20Enduser\x20ID\x20is:',_0x51de9f['id']);return getTicket(_0x38241f,_0x3d408f,_0x51de9f,_0x8fb308,_0x4a0e9c);})['then'](function(_0x3d4950){if(_0x3d4950&&_0x3d4950['id']){logger[_0x309c('0xd')](_0x309c('0x1a'));logger[_0x309c('0xd')](_0x309c('0x4d'),_0x3d4950['id']);logger[_0x309c('0xd')](_0x309c('0x47'),_0x309c('0x4e'));emit(util['format'](_0x309c('0x4f'),_0x297ccc[_0x309c('0x42')]),_0x309c('0x50'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x38241f[_0x309c('0x26')],_0x3d4950['id'])});}})[_0x309c('0x51')](function(_0x1399f6){logger[_0x309c('0x52')]('[QUEUE]',JSON[_0x309c('0x32')](_0x1399f6));});};exports[_0x309c('0x53')]=function(_0x37524e,_0x7be560,_0x5b3a9e,_0x84b4c6,_0x4c4060,_0x42a11e,_0x417237){var _0x587bdf,_0x31c1c1;_0x42a11e[_0x309c('0x26')]=intUtil[_0x309c('0x44')](_0x42a11e[_0x309c('0x26')]);_0x42a11e[_0x309c('0x45')]=intUtil[_0x309c('0x44')](_0x42a11e[_0x309c('0x45')]);if(_0x417237&&_0x417237['recordingFormat']&&_0x417237['recordingFormat']!==_0x309c('0x54')){logger[_0x309c('0xd')](_0x309c('0x55'),_0x309c('0x48'));_0x7be560[_0x309c('0x49')]=util[_0x309c('0x1c')](_0x309c('0x56'),_0x42a11e[_0x309c('0x45')],_0x7be560[_0x309c('0x4a')],md5(_0x7be560['uniqueid']));}headers[_0x309c('0x4b')]=getAuth(_0x42a11e);return getUser(_0x42a11e,_0x84b4c6[_0x309c('0x22')])[_0x309c('0x19')](function(_0x1c3f30){_0x587bdf=_0x1c3f30;logger[_0x309c('0xd')](_0x309c('0x4c'),_0x587bdf['id']);return getEndUser(_0x42a11e,_0x7be560[_0x309c('0x57')],_0x7be560[_0x309c('0x58')]);})[_0x309c('0x19')](function(_0x960b4){_0x31c1c1=_0x960b4;logger[_0x309c('0xd')]('The\x20Enduser\x20ID\x20is:',_0x31c1c1['id']);return getTicket(_0x42a11e,_0x587bdf,_0x31c1c1,_0x5b3a9e,_0x7be560);})['then'](function(_0x2ccf8f){if(_0x2ccf8f&&_0x2ccf8f['id']){logger['info']('Ticket\x20created!');logger[_0x309c('0xd')](_0x309c('0x4d'),_0x2ccf8f['id']);logger[_0x309c('0xd')](_0x309c('0x55'),_0x309c('0x4e'));emit(util[_0x309c('0x1c')]('user:%s',_0x84b4c6['name']),_0x309c('0x50'),{'uri':util[_0x309c('0x1c')](_0x309c('0x59'),_0x42a11e[_0x309c('0x26')],_0x2ccf8f['id'])});}})[_0x309c('0x51')](function(_0x5da81d){logger[_0x309c('0x52')](_0x309c('0x55'),JSON[_0x309c('0x32')](_0x5da81d));});};exports[_0x309c('0x5a')]=function(_0x367fe7,_0x563c4a,_0x319205,_0x499160,_0x4e8cb6,_0x5d9bff){var _0xa55842,_0x4d52a6;_0x5d9bff[_0x309c('0x26')]=intUtil[_0x309c('0x44')](_0x5d9bff[_0x309c('0x26')]);_0x5d9bff['serverUrl']=intUtil[_0x309c('0x44')](_0x5d9bff[_0x309c('0x45')]);if(_0x4e8cb6&&_0x4e8cb6['monitor_format']){logger['info']('['+_0x563c4a[_0x309c('0x5b')][_0x309c('0x5c')]()+']',_0x309c('0x48'));_0x563c4a['recordingURL']=util[_0x309c('0x1c')](_0x309c('0x56'),_0x5d9bff['serverUrl'],_0x563c4a[_0x309c('0x4a')],md5(_0x563c4a[_0x309c('0x4a')]));}else{_0x563c4a[_0x309c('0x49')]='';}headers[_0x309c('0x4b')]=getAuth(_0x5d9bff);return getUser(_0x5d9bff,'')[_0x309c('0x19')](function(_0x359d1a){_0xa55842=_0x359d1a;logger[_0x309c('0xd')]('The\x20User\x20ID\x20is:',_0xa55842['id']);return getEndUser(_0x5d9bff,_0x563c4a['calleridname'],_0x563c4a[_0x309c('0xf')]);})[_0x309c('0x19')](function(_0x1a3dda){_0x4d52a6=_0x1a3dda;logger[_0x309c('0xd')](_0x309c('0x5d'),_0x4d52a6['id']);return getTicket(_0x5d9bff,_0xa55842,_0x4d52a6,_0x319205,_0x563c4a);})[_0x309c('0x19')](function(_0x185290){if(_0x185290){logger[_0x309c('0xd')](_0x309c('0x1a'));logger[_0x309c('0xd')](_0x309c('0x4d'),_0x185290['id']);}})[_0x309c('0x51')](function(_0x164a6a){logger['error']('['+_0x563c4a[_0x309c('0x5b')]['toUpperCase']()+']',JSON[_0x309c('0x32')](_0x164a6a));});}; \ 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 0a2eab6..dd4dab4 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 _0x221f=['ioredis','./util','../../../../config/logger','freshsales','redis','socket.io-emitter','/api/selector/owners','headers','Getting\x20admin\x20information','users','email','adminEmail','info','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','GET','then','agentEmail','Getting\x20user\x20with\x20email','length','userId','User\x20found:','Admin\x20selected','toUpperCase','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','POST','/api/contacts','contactNumber','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','Subjects','Contact','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','destcalleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x221f,0xeb));var _0xf221=function(_0x43b5a7,_0xf5e3d6){_0x43b5a7=_0x43b5a7-0x0;var _0x5461fe=_0x221f[_0x43b5a7];return _0x5461fe;};'use strict';var _=require(_0xf221('0x0'));var rp=require(_0xf221('0x1'));var md5=require(_0xf221('0x2'));var util=require(_0xf221('0x3'));var moment=require(_0xf221('0x4'));var Promise=require('bluebird');var Redis=require(_0xf221('0x5'));var intUtil=require(_0xf221('0x6'));var config=require('../../../../config/environment');var logger=require(_0xf221('0x7'))(_0xf221('0x8'));config[_0xf221('0x9')]=_['defaults'](config[_0xf221('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf221('0xa'))(new Redis(config[_0xf221('0x9')]));function getAdminId(_0x234fb5,_0x260a3d,_0x22d119,_0x5940cf){return new Promise(function(_0x12a0be,_0x51788d){var _0x1eaa7d=![];var _0x357779={'method':'GET','uri':_0x5940cf+_0xf221('0xb'),'json':!![]};_0x357779[_0xf221('0xc')]=_0x22d119;logger['info'](_0xf221('0xd'));return rp(_0x357779)['then'](function(_0x2c2878){if(_0x2c2878){var _0x308dd8=_0x2c2878[_0xf221('0xe')];var _0x151749=null;for(_0x151749=0x0;_0x151749<_0x308dd8['length'];_0x151749++){if(_0x308dd8[_0x151749][_0xf221('0xf')]===_0x234fb5[_0xf221('0x10')]){_0x234fb5['adminId']=_0x308dd8[_0x151749]['id'];_0x1eaa7d=!![];}}if(_0x1eaa7d){logger[_0xf221('0x11')]('Admin\x20found:',_0x234fb5[_0xf221('0x12')]);_0x12a0be(_0x234fb5);}else{_0x51788d({'statusCode':0x194,'message':_0xf221('0x13')});}}else{_0x51788d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xf221('0x14')](function(_0x558a32){logger[_0xf221('0x15')]('['+[_0x260a3d['toUpperCase']()]+']',_0x558a32[_0xf221('0x16')]);_0x51788d(_0x558a32);});});}function getUser(_0x3fbb45,_0x3b2ca4,_0xc4f60b){return function(_0x25deee){return new Promise(function(_0xd017a4,_0x5d5697){var _0x1e0f4d={'method':_0xf221('0x17'),'uri':_0xc4f60b+'/api/selector/owners','json':!![]};_0x1e0f4d[_0xf221('0xc')]=_0x3b2ca4;logger[_0xf221('0x11')]('Getting\x20user\x20list');return rp(_0x1e0f4d)[_0xf221('0x18')](function(_0x29daf0){if(_0x29daf0){var _0x373d49=_0x29daf0[_0xf221('0xe')];var _0x5910cb=![];var _0x529340=null;if(_0x25deee[_0xf221('0x19')]!==null){logger[_0xf221('0x11')](_0xf221('0x1a'),_0x25deee[_0xf221('0x19')]);_0x25deee['userEmail']=_0x25deee['agentEmail'];for(_0x529340=0x0;_0x529340<_0x373d49[_0xf221('0x1b')];_0x529340++){if(_0x373d49[_0x529340][_0xf221('0xf')]===_0x25deee[_0xf221('0x19')]){_0x5910cb=!![];_0x25deee[_0xf221('0x1c')]=_0x373d49[_0x529340]['id'];logger['info'](_0xf221('0x1d'),_0x25deee[_0xf221('0x1c')]);}}}if(!_0x5910cb){logger['info'](_0xf221('0x1e'));_0x25deee['userEmail']=_0x25deee[_0xf221('0x10')];_0x25deee[_0xf221('0x1c')]=_0x25deee[_0xf221('0x12')];_0x5910cb=!![];}if(_0x5910cb){_0xd017a4(_0x25deee);}else{_0x5d5697({'statusCode':0x194,'message':_0xf221('0x13')});}}else{_0x5d5697({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xf221('0x14')](function(_0x494dec){logger['error']('['+[_0x3fbb45[_0xf221('0x1f')]()]+']',_0x494dec[_0xf221('0x16')]);_0x5d5697(_0x494dec);});});};}function searchContact(_0x13b893,_0x2b4768,_0x387f25,_0x33588b){return new Promise(function(_0x39e4b5,_0x556de4){var _0x57a114={'method':_0xf221('0x17'),'headers':_0x2b4768,'uri':_0x13b893+'/api/lookup?q='+_0x33588b+_0xf221('0x20')+_0x387f25+_0xf221('0x21'),'json':!![]};rp(_0x57a114)['then'](function(_0x4389ed){var _0x3904e6=_[_0xf221('0x22')](_0x4389ed[_0xf221('0x23')]['contacts'],[_0x387f25,_0x33588b]);_0x39e4b5(_0x3904e6);})[_0xf221('0x14')](function(_0x20c5b4){_0x556de4(_0x20c5b4);});});}function getEndUser(_0x4bb2bc,_0x5608fa,_0x5f286c){return function(_0x5b19e4){return new Promise(function(_0x18c38c,_0x2fe2e8){logger[_0xf221('0x11')](util[_0xf221('0x24')](_0xf221('0x25'),_0x5b19e4['contactNumber']));searchContact(_0x5f286c,_0x5608fa,_0xf221('0x26'),_0x5b19e4['contactNumber'])[_0xf221('0x18')](function(_0xe98111){if(_0xe98111){_0x5b19e4[_0xf221('0x27')]=_0xe98111['id'];logger[_0xf221('0x11')](_0xf221('0x28'),_0x5b19e4[_0xf221('0x27')]);return _0x18c38c(_0x5b19e4);}searchContact(_0x5f286c,_0x5608fa,'work_number',_0x5b19e4['contactNumber'])[_0xf221('0x18')](function(_0x20d054){if(_0x20d054){_0x5b19e4[_0xf221('0x27')]=_0x20d054['id'];logger[_0xf221('0x11')](_0xf221('0x29'),_0x5b19e4[_0xf221('0x27')]);return _0x18c38c(_0x5b19e4);}createEndUser(_0x5b19e4,_0x4bb2bc,_0x5608fa,_0x5f286c)[_0xf221('0x18')](function(_0x578a85){logger[_0xf221('0x11')]('Contact\x20created:',_0x578a85[_0xf221('0x27')]);return _0x18c38c(_0x578a85);});});})[_0xf221('0x14')](function(_0x287622){_0x2fe2e8(_0x287622);});});};}function createEndUser(_0x1b746d,_0x3238c1,_0x279662,_0xef82e3){return new Promise(function(_0x16f0ff,_0x224cdf){var _0x443ac4=moment();var _0x1e3f8c={'method':_0xf221('0x2a'),'uri':_0xef82e3+_0xf221('0x2b'),'body':{'contact':{'last_name':_0x1b746d[_0xf221('0x2c')],'work_number':_0x1b746d[_0xf221('0x2c')],'mobile_number':_0x1b746d[_0xf221('0x2c')],'owner_id':_0x1b746d[_0xf221('0x1c')],'created_at':_0x443ac4[_0xf221('0x24')](_0xf221('0x2d'))}},'json':!![]};_0x1e3f8c[_0xf221('0xc')]=_0x279662;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x1e3f8c)[_0xf221('0x18')](function(_0x568080){_0x1b746d[_0xf221('0x27')]=_0x568080[_0xf221('0x2e')]['id'];_0x16f0ff(_0x1b746d);})[_0xf221('0x14')](function(_0x55e151){logger[_0xf221('0x15')]('['+[_0x3238c1[_0xf221('0x1f')]()]+']',_0x55e151['message']);_0x224cdf(_0x55e151[_0xf221('0x16')]);});});}function getTicket(_0x13958f,_0x9fe33e,_0x38201e,_0x13a94d,_0x297f55){return function(_0x1881fe){logger[_0xf221('0x11')](_0xf221('0x2f'));return new Promise(function(_0x1acc76,_0x47f3b8){var _0x536549=moment();var _0x275d9f={'method':_0xf221('0x2a'),'uri':_0x38201e+_0xf221('0x30'),'body':{'title':intUtil['getString'](_0x13a94d[_0xf221('0x31')],_0x297f55,'\x20'),'description':intUtil['getString'](_0x13a94d['Descriptions'],_0x297f55,'\x0a'),'owner_id':_0x1881fe[_0xf221('0x1c')],'creater_id':_0x1881fe[_0xf221('0x12')],'targetable_id':_0x1881fe[_0xf221('0x27')],'targetable_type':_0xf221('0x32'),'created_at':_0x536549[_0xf221('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x536549[_0xf221('0x33')](0x1e,'m')[_0xf221('0x24')](_0xf221('0x2d'))},'json':!![]};_0x275d9f[_0xf221('0xc')]=_0x9fe33e;return rp(_0x275d9f)[_0xf221('0x18')](function(_0x4994a8){_0x1881fe[_0xf221('0x34')]=_0x4994a8[_0xf221('0x35')]['id'];logger[_0xf221('0x11')](_0xf221('0x36'),_0x1881fe[_0xf221('0x34')]);_0x1acc76(_0x1881fe);})[_0xf221('0x14')](function(_0x217dae){logger[_0xf221('0x15')]('['+[_0x13958f['toUpperCase']()]+']',_0x217dae[_0xf221('0x16')]);_0x47f3b8(_0x217dae[_0xf221('0x16')]);});});};}function emit(_0x1835bc,_0x31462b,_0x589b39){var _0x5af648={'uri':_0x1835bc+_0xf221('0x37')+_0x589b39};io['to'](util[_0xf221('0x24')]('user:%s',_0x31462b))[_0xf221('0x38')](_0xf221('0x39'),_0x5af648);}exports['cs']=function(_0x423e8c,_0x5c97cb,_0xa5dcf5,_0x4a3ddf,_0x30918c,_0x5693d2,_0x33f081,_0x4f7950){var _0x3cc985={};var _0x55e701={'Authorization':_0xf221('0x3a')+_0x5693d2[_0xf221('0x3b')]};_0x5693d2['remoteUri']=intUtil[_0xf221('0x3c')](_0x5693d2[_0xf221('0x3d')]);_0x5693d2['serverUrl']=intUtil[_0xf221('0x3c')](_0x5693d2[_0xf221('0x3e')]);var _0x292f37=_0x5693d2[_0xf221('0x3d')];_0x3cc985[_0xf221('0x10')]=_0x5693d2[_0xf221('0x3f')];_0x3cc985[_0xf221('0x2c')]=_0x4f7950[_0xf221('0x40')]()==='outbound'?_0x5c97cb[_0xf221('0x41')]:_0x5c97cb['calleridnum'];_0x3cc985[_0xf221('0x42')]=_0x4f7950===_0xf221('0x43')||_0x4f7950===_0xf221('0x44')?_0xf221('0x43'):_0xf221('0x45');if(_0x4a3ddf){_0x3cc985[_0xf221('0x19')]=_0x4a3ddf[_0xf221('0xf')];}var _0x7a6153=util[_0xf221('0x24')](_0xf221('0x46'),_0x5693d2[_0xf221('0x3e')],_0x5c97cb[_0xf221('0x47')],md5(_0x5c97cb['uniqueid']));if(_0x30918c&&_0x30918c[_0xf221('0x48')]){logger[_0xf221('0x11')](_0xf221('0x49'),_0xf221('0x4a'));_0x5c97cb[_0xf221('0x4b')]=_0x7a6153;}else if(_0x33f081&&_0x33f081['recordingFormat']&&_0x33f081[_0xf221('0x4c')]!=='none'){logger[_0xf221('0x11')]('[OUTBOUND]',_0xf221('0x4a'));_0x5c97cb[_0xf221('0x4b')]=_0x7a6153;}else{_0x5c97cb[_0xf221('0x4b')]='';}return getAdminId(_0x3cc985,_0x4f7950,_0x55e701,_0x292f37)[_0xf221('0x18')](getUser(_0x4f7950,_0x55e701,_0x292f37))[_0xf221('0x18')](getEndUser(_0x4f7950,_0x55e701,_0x292f37))['then'](getTicket(_0x4f7950,_0x55e701,_0x292f37,_0xa5dcf5,_0x5c97cb))[_0xf221('0x18')](function(_0x294ee8){logger[_0xf221('0x11')](util[_0xf221('0x24')]('The\x20ticket\x20ID\x20is:\x20%s',_0x294ee8['ticketId']));if(_0x4f7950!==_0xf221('0x44')){logger[_0xf221('0x11')]('['+[_0x4f7950[_0xf221('0x1f')]()]+']',_0xf221('0x4d'));emit(_0x292f37,_0x4a3ddf[_0xf221('0x4e')],_0x294ee8['endUserId']);}})[_0xf221('0x14')](function(_0x1818c3){logger['error']('['+[_0x4f7950['toUpperCase']()]+_0xf221('0x4f'),util['inspect'](_0x1818c3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5313=['The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','localhost','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminId','Requested\x20Resource\x20not\x20Found','error','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Admin\x20selected','adminEmail','toUpperCase','/api/lookup?q=','&entities=contact','contacts','catch','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','headers','contact','Creating\x20new\x20task','Subjects','Descriptions','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL'];(function(_0x240622,_0x30d7d5){var _0x3385b8=function(_0x2f294d){while(--_0x2f294d){_0x240622['push'](_0x240622['shift']());}};_0x3385b8(++_0x30d7d5);}(_0x5313,0x1d8));var _0x3531=function(_0x25f3b4,_0x496a73){_0x25f3b4=_0x25f3b4-0x0;var _0x22995c=_0x5313[_0x25f3b4];return _0x22995c;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require('util');var moment=require(_0x3531('0x0'));var Promise=require(_0x3531('0x1'));var Redis=require(_0x3531('0x2'));var intUtil=require(_0x3531('0x3'));var config=require('../../../../config/environment');var logger=require(_0x3531('0x4'))(_0x3531('0x5'));config[_0x3531('0x6')]=_['defaults'](config[_0x3531('0x6')],{'host':_0x3531('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3531('0x6')]));function getAdminId(_0x9e8999,_0x5799ff,_0x232dd8,_0x158d6b){return new Promise(function(_0xb53923,_0x26aa13){var _0x4dec48=![];var _0x7fd71={'method':_0x3531('0x8'),'uri':_0x158d6b+_0x3531('0x9'),'json':!![]};_0x7fd71['headers']=_0x232dd8;logger[_0x3531('0xa')](_0x3531('0xb'));return rp(_0x7fd71)[_0x3531('0xc')](function(_0x48d7d6){if(_0x48d7d6){var _0xd4858c=_0x48d7d6[_0x3531('0xd')];var _0x1ec064=null;for(_0x1ec064=0x0;_0x1ec064<_0xd4858c[_0x3531('0xe')];_0x1ec064++){if(_0xd4858c[_0x1ec064][_0x3531('0xf')]===_0x9e8999['adminEmail']){_0x9e8999[_0x3531('0x10')]=_0xd4858c[_0x1ec064]['id'];_0x4dec48=!![];}}if(_0x4dec48){logger[_0x3531('0xa')]('Admin\x20found:',_0x9e8999[_0x3531('0x10')]);_0xb53923(_0x9e8999);}else{_0x26aa13({'statusCode':0x194,'message':_0x3531('0x11')});}}else{_0x26aa13({'statusCode':0x194,'message':_0x3531('0x11')});}})['catch'](function(_0x5b31ac){logger[_0x3531('0x12')]('['+[_0x5799ff['toUpperCase']()]+']',_0x5b31ac[_0x3531('0x13')]);_0x26aa13(_0x5b31ac);});});}function getUser(_0x2a05ce,_0x412acc,_0x34ea7d){return function(_0x345086){return new Promise(function(_0x473ca0,_0x359ee6){var _0x30a746={'method':'GET','uri':_0x34ea7d+_0x3531('0x9'),'json':!![]};_0x30a746['headers']=_0x412acc;logger[_0x3531('0xa')](_0x3531('0x14'));return rp(_0x30a746)['then'](function(_0xe8a6be){if(_0xe8a6be){var _0x328c7a=_0xe8a6be[_0x3531('0xd')];var _0x4b6268=![];var _0x3297fc=null;if(_0x345086[_0x3531('0x15')]!==null){logger[_0x3531('0xa')](_0x3531('0x16'),_0x345086[_0x3531('0x15')]);_0x345086[_0x3531('0x17')]=_0x345086[_0x3531('0x15')];for(_0x3297fc=0x0;_0x3297fc<_0x328c7a['length'];_0x3297fc++){if(_0x328c7a[_0x3297fc]['email']===_0x345086[_0x3531('0x15')]){_0x4b6268=!![];_0x345086['userId']=_0x328c7a[_0x3297fc]['id'];logger['info'](_0x3531('0x18'),_0x345086[_0x3531('0x19')]);}}}if(!_0x4b6268){logger[_0x3531('0xa')](_0x3531('0x1a'));_0x345086['userEmail']=_0x345086[_0x3531('0x1b')];_0x345086[_0x3531('0x19')]=_0x345086[_0x3531('0x10')];_0x4b6268=!![];}if(_0x4b6268){_0x473ca0(_0x345086);}else{_0x359ee6({'statusCode':0x194,'message':_0x3531('0x11')});}}else{_0x359ee6({'statusCode':0x194,'message':_0x3531('0x11')});}})['catch'](function(_0x54c568){logger[_0x3531('0x12')]('['+[_0x2a05ce[_0x3531('0x1c')]()]+']',_0x54c568[_0x3531('0x13')]);_0x359ee6(_0x54c568);});});};}function searchContact(_0x4f420e,_0x19bd2,_0x994078,_0x439db7){return new Promise(function(_0x3527cf,_0x3aff69){var _0x339c93={'method':_0x3531('0x8'),'headers':_0x19bd2,'uri':_0x4f420e+_0x3531('0x1d')+_0x439db7+'&f='+_0x994078+_0x3531('0x1e'),'json':!![]};rp(_0x339c93)[_0x3531('0xc')](function(_0x8c222f){var _0x47c3e8=_['find'](_0x8c222f[_0x3531('0x1f')][_0x3531('0x1f')],[_0x994078,_0x439db7]);_0x3527cf(_0x47c3e8);})[_0x3531('0x20')](function(_0x29dc7f){_0x3aff69(_0x29dc7f);});});}function getEndUser(_0x36f61d,_0x9769f6,_0x2984a8){return function(_0x102665){return new Promise(function(_0x22240d,_0x27f85b){logger[_0x3531('0xa')](util['format'](_0x3531('0x21'),_0x102665['contactNumber']));searchContact(_0x2984a8,_0x9769f6,_0x3531('0x22'),_0x102665[_0x3531('0x23')])['then'](function(_0xb79459){if(_0xb79459){_0x102665[_0x3531('0x24')]=_0xb79459['id'];logger[_0x3531('0xa')]('Contact\x20found\x20mobile_number:',_0x102665['endUserId']);return _0x22240d(_0x102665);}searchContact(_0x2984a8,_0x9769f6,_0x3531('0x25'),_0x102665[_0x3531('0x23')])[_0x3531('0xc')](function(_0x3fe731){if(_0x3fe731){_0x102665['endUserId']=_0x3fe731['id'];logger[_0x3531('0xa')](_0x3531('0x26'),_0x102665[_0x3531('0x24')]);return _0x22240d(_0x102665);}createEndUser(_0x102665,_0x36f61d,_0x9769f6,_0x2984a8)[_0x3531('0xc')](function(_0x38b884){logger[_0x3531('0xa')](_0x3531('0x27'),_0x38b884[_0x3531('0x24')]);return _0x22240d(_0x38b884);});});})[_0x3531('0x20')](function(_0x3e56e6){_0x27f85b(_0x3e56e6);});});};}function createEndUser(_0x560b15,_0x2277fd,_0x4b015a,_0x5ebbfe){return new Promise(function(_0x478e2c,_0x2ff7c3){var _0x608060=moment();var _0x4870fb={'method':_0x3531('0x28'),'uri':_0x5ebbfe+_0x3531('0x29'),'body':{'contact':{'last_name':_0x560b15[_0x3531('0x23')],'work_number':_0x560b15[_0x3531('0x23')],'mobile_number':_0x560b15['contactNumber'],'owner_id':_0x560b15[_0x3531('0x19')],'created_at':_0x608060['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4870fb[_0x3531('0x2a')]=_0x4b015a;logger[_0x3531('0xa')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4870fb)[_0x3531('0xc')](function(_0x3c1d32){_0x560b15[_0x3531('0x24')]=_0x3c1d32[_0x3531('0x2b')]['id'];_0x478e2c(_0x560b15);})[_0x3531('0x20')](function(_0x3b96b2){logger[_0x3531('0x12')]('['+[_0x2277fd[_0x3531('0x1c')]()]+']',_0x3b96b2[_0x3531('0x13')]);_0x2ff7c3(_0x3b96b2['message']);});});}function getTicket(_0x1470bf,_0x14ab2e,_0x4e6202,_0x343778,_0x570daf){return function(_0xefd8c8){logger[_0x3531('0xa')](_0x3531('0x2c'));return new Promise(function(_0x2c3f59,_0x54a1e5){var _0x272ec8=moment();var _0x5ea5bc={'method':'POST','uri':_0x4e6202+'/api/tasks','body':{'title':intUtil['getString'](_0x343778[_0x3531('0x2d')],_0x570daf,'\x20'),'description':intUtil['getString'](_0x343778[_0x3531('0x2e')],_0x570daf,'\x0a'),'owner_id':_0xefd8c8['userId'],'creater_id':_0xefd8c8[_0x3531('0x10')],'targetable_id':_0xefd8c8[_0x3531('0x24')],'targetable_type':'Contact','created_at':_0x272ec8['format'](_0x3531('0x2f')),'due_date':_0x272ec8[_0x3531('0x30')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x5ea5bc[_0x3531('0x2a')]=_0x14ab2e;return rp(_0x5ea5bc)[_0x3531('0xc')](function(_0x11cbb3){_0xefd8c8[_0x3531('0x31')]=_0x11cbb3[_0x3531('0x32')]['id'];logger[_0x3531('0xa')](_0x3531('0x33'),_0xefd8c8[_0x3531('0x31')]);_0x2c3f59(_0xefd8c8);})[_0x3531('0x20')](function(_0x4c68c4){logger[_0x3531('0x12')]('['+[_0x1470bf['toUpperCase']()]+']',_0x4c68c4['message']);_0x54a1e5(_0x4c68c4[_0x3531('0x13')]);});});};}function emit(_0x64bf21,_0x20a398,_0x4f7c74){var _0x39d976={'uri':_0x64bf21+_0x3531('0x34')+_0x4f7c74};io['to'](util['format'](_0x3531('0x35'),_0x20a398))[_0x3531('0x36')](_0x3531('0x37'),_0x39d976);}exports['cs']=function(_0x14927f,_0x288d11,_0x38779c,_0x39e8fc,_0x1b3906,_0x18c9c9,_0x2fa29a,_0x3708b7){var _0xd55bd8={};var _0x2c6bf4={'Authorization':'Token\x20token='+_0x18c9c9['apiKey']};_0x18c9c9[_0x3531('0x38')]=intUtil[_0x3531('0x39')](_0x18c9c9[_0x3531('0x38')]);_0x18c9c9['serverUrl']=intUtil[_0x3531('0x39')](_0x18c9c9[_0x3531('0x3a')]);var _0x46d417=_0x18c9c9['remoteUri'];_0xd55bd8[_0x3531('0x1b')]=_0x18c9c9['username'];_0xd55bd8[_0x3531('0x23')]=_0x3708b7[_0x3531('0x3b')]()===_0x3531('0x3c')?_0x288d11['destcalleridnum']:_0x288d11[_0x3531('0x3d')];_0xd55bd8[_0x3531('0x3e')]=_0x3708b7===_0x3531('0x3f')||_0x3708b7===_0x3531('0x40')?_0x3531('0x3f'):'outbound';if(_0x39e8fc){_0xd55bd8[_0x3531('0x15')]=_0x39e8fc[_0x3531('0xf')];}var _0x44e145=util[_0x3531('0x41')](_0x3531('0x42'),_0x18c9c9['serverUrl'],_0x288d11[_0x3531('0x43')],md5(_0x288d11[_0x3531('0x43')]));if(_0x1b3906&&_0x1b3906[_0x3531('0x44')]){logger[_0x3531('0xa')](_0x3531('0x45'),_0x3531('0x46'));_0x288d11['recordingURL']=_0x44e145;}else if(_0x2fa29a&&_0x2fa29a['recordingFormat']&&_0x2fa29a[_0x3531('0x47')]!==_0x3531('0x48')){logger[_0x3531('0xa')]('[OUTBOUND]',_0x3531('0x46'));_0x288d11[_0x3531('0x49')]=_0x44e145;}else{_0x288d11['recordingURL']='';}return getAdminId(_0xd55bd8,_0x3708b7,_0x2c6bf4,_0x46d417)[_0x3531('0xc')](getUser(_0x3708b7,_0x2c6bf4,_0x46d417))[_0x3531('0xc')](getEndUser(_0x3708b7,_0x2c6bf4,_0x46d417))['then'](getTicket(_0x3708b7,_0x2c6bf4,_0x46d417,_0x38779c,_0x288d11))[_0x3531('0xc')](function(_0x15668a){logger[_0x3531('0xa')](util[_0x3531('0x41')](_0x3531('0x4a'),_0x15668a[_0x3531('0x31')]));if(_0x3708b7!=='unmanaged'){logger[_0x3531('0xa')]('['+[_0x3708b7['toUpperCase']()]+']',_0x3531('0x4b'));emit(_0x46d417,_0x39e8fc[_0x3531('0x4c')],_0x15668a[_0x3531('0x24')]);}})[_0x3531('0x20')](function(_0x386253){logger[_0x3531('0x12')]('['+[_0x3708b7[_0x3531('0x1c')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x3531('0x4d')](_0x386253,{'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 d27c074..714b1c3 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 _0x7dee=['./zoho','./desk','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','includes','toLowerCase','data1','data2','find','Configurations','data3','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','error','lodash','./zendesk','./sugarcrm','./freshdesk'];(function(_0x1da407,_0xe685a8){var _0xb3605e=function(_0x20e0f6){while(--_0x20e0f6){_0x1da407['push'](_0x1da407['shift']());}};_0xb3605e(++_0xe685a8);}(_0x7dee,0xb0));var _0xe7de=function(_0x3bf181,_0x126273){_0x3bf181=_0x3bf181-0x0;var _0x5c33b9=_0x7dee[_0x3bf181];return _0x5c33b9;};'use strict';var _=require(_0xe7de('0x0'));var util=require('util');var zendesk=require(_0xe7de('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0xe7de('0x2'));var freshdesk=require(_0xe7de('0x3'));var zoho=require(_0xe7de('0x4'));var desk=require(_0xe7de('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0xe7de('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0xe7de('0x7'));var integrations=[_0xe7de('0x8'),_0xe7de('0x9'),_0xe7de('0xa'),_0xe7de('0xb'),_0xe7de('0xc'),'desk',_0xe7de('0xd'),_0xe7de('0xe'),_0xe7de('0xf'),_0xe7de('0x10')];exports['exec']=function(_0x130ac8,_0x42ddbc,_0x2a2042,_0x35718e,_0x18d907,_0x93a234){if(_0x2a2042){if(_[_0xe7de('0x11')](integrations,_0x130ac8['data1'][_0xe7de('0x12')]())){try{var _0x2d0a90=null;var _0x38c0a1='';var _0x2c535c=_0x2a2042[_0x130ac8[_0xe7de('0x13')]['toLowerCase']()];if(_0x2c535c){var _0x1cb4cf=_0x2c535c[_0x130ac8[_0xe7de('0x14')]];if(_0x1cb4cf){var _0x280473=_[_0xe7de('0x15')](_0x1cb4cf[_0xe7de('0x16')],{'id':parseInt(_0x130ac8[_0xe7de('0x17')],0xa)});if(_0x280473){if(_0x35718e){if(_0x18d907&&_0x42ddbc['queue']){_0x38c0a1='queue';}else if(_0x42ddbc[_0xe7de('0x18')]){_0x38c0a1=_0xe7de('0x19');}else{console[_0xe7de('0x1a')](_0xe7de('0x1b'),_0x42ddbc);}}else{_0x38c0a1=_0xe7de('0x1c');}switch(_0x130ac8['data1'][_0xe7de('0x12')]()){case'zendesk':zendesk[_0x38c0a1](_0x130ac8,_0x42ddbc,_0x280473,_0x35718e,_0x18d907,_0x1cb4cf,_0x93a234);break;case'salesforce':salesforce[_0x38c0a1](_0x130ac8,_0x42ddbc,_0x280473,_0x35718e,_0x18d907,_0x1cb4cf,_0x93a234);break;case'sugarcrm':sugarcrm[_0x38c0a1](_0x130ac8,_0x42ddbc,_0x280473,_0x35718e,_0x18d907,_0x1cb4cf,_0x93a234);break;case _0xe7de('0xb'):freshdesk[_0x38c0a1](_0x130ac8,_0x42ddbc,_0x280473,_0x35718e,_0x18d907,_0x1cb4cf,_0x93a234);break;case _0xe7de('0xc'):zoho[_0x38c0a1](_0x130ac8,_0x42ddbc,_0x280473,_0x35718e,_0x18d907,_0x1cb4cf,_0x93a234);break;case'desk':desk[_0x38c0a1](_0x130ac8,_0x42ddbc,_0x280473,_0x35718e,_0x18d907,_0x1cb4cf,_0x93a234);break;case _0xe7de('0xd'):vtiger[_0x38c0a1](_0x130ac8,_0x42ddbc,_0x280473,_0x35718e,_0x18d907,_0x1cb4cf,_0x93a234);break;case _0xe7de('0xf'):freshsales['cs'](_0x130ac8,_0x42ddbc,_0x280473,_0x35718e,_0x18d907,_0x1cb4cf,_0x93a234,_0x38c0a1);break;case _0xe7de('0x10'):servicenow['cs'](_0x130ac8,_0x42ddbc,_0x280473,_0x35718e,_0x18d907,_0x1cb4cf,_0x93a234,_0x38c0a1);break;case _0xe7de('0xe'):dynamics365['cs'](_0x130ac8,_0x42ddbc,_0x280473,_0x35718e,_0x18d907,_0x1cb4cf,_0x93a234,_0x38c0a1);break;default:console[_0xe7de('0x1a')](_0xe7de('0x1d'));}}else{_0x2d0a90=require(_0xe7de('0x1e'))(_0x130ac8[_0xe7de('0x13')][_0xe7de('0x12')]());_0x2d0a90['error'](_0xe7de('0x1f'),util[_0xe7de('0x20')](_0xe7de('0x21'),_0x130ac8['data1'][_0xe7de('0x12')](),_0x130ac8['data3']));}}else{_0x2d0a90=require(_0xe7de('0x1e'))(_0x130ac8[_0xe7de('0x13')][_0xe7de('0x12')]());_0x2d0a90['error'](_0xe7de('0x1f'),util[_0xe7de('0x20')](_0xe7de('0x22'),_0x130ac8[_0xe7de('0x13')][_0xe7de('0x12')](),_0x130ac8[_0xe7de('0x14')]));}}else{}}catch(_0xd7f3ca){console[_0xe7de('0x23')](_0xd7f3ca);}}}}; \ No newline at end of file +var _0xae14=['./dynamics365','./freshsales','zendesk','salesforce','zoho','desk','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','find','Configurations','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow'];(function(_0xbdf03f,_0x595215){var _0x2bbe9e=function(_0x59fbd4){while(--_0x59fbd4){_0xbdf03f['push'](_0xbdf03f['shift']());}};_0x2bbe9e(++_0x595215);}(_0xae14,0x14d));var _0x4ae1=function(_0x4d230c,_0x3862fd){_0x4d230c=_0x4d230c-0x0;var _0x16b044=_0xae14[_0x4d230c];return _0x16b044;};'use strict';var _=require('lodash');var util=require(_0x4ae1('0x0'));var zendesk=require(_0x4ae1('0x1'));var salesforce=require(_0x4ae1('0x2'));var sugarcrm=require(_0x4ae1('0x3'));var freshdesk=require(_0x4ae1('0x4'));var zoho=require(_0x4ae1('0x5'));var desk=require(_0x4ae1('0x6'));var vtiger=require(_0x4ae1('0x7'));var servicenow=require(_0x4ae1('0x8'));var dynamics365=require(_0x4ae1('0x9'));var freshsales=require(_0x4ae1('0xa'));var integrations=[_0x4ae1('0xb'),_0x4ae1('0xc'),'sugarcrm','freshdesk',_0x4ae1('0xd'),_0x4ae1('0xe'),_0x4ae1('0xf'),_0x4ae1('0x10'),_0x4ae1('0x11'),_0x4ae1('0x12')];exports['exec']=function(_0x55fb2a,_0x3f6cfd,_0x26dc7d,_0x42d483,_0x24f7df,_0x10cf32){if(_0x26dc7d){if(_[_0x4ae1('0x13')](integrations,_0x55fb2a[_0x4ae1('0x14')][_0x4ae1('0x15')]())){try{var _0x5447a3=null;var _0x3d13c9='';var _0x21fd91=_0x26dc7d[_0x55fb2a[_0x4ae1('0x14')][_0x4ae1('0x15')]()];if(_0x21fd91){var _0x347274=_0x21fd91[_0x55fb2a['data2']];if(_0x347274){var _0x1be074=_[_0x4ae1('0x16')](_0x347274[_0x4ae1('0x17')],{'id':parseInt(_0x55fb2a['data3'],0xa)});if(_0x1be074){if(_0x42d483){if(_0x24f7df&&_0x3f6cfd[_0x4ae1('0x18')]){_0x3d13c9=_0x4ae1('0x18');}else if(_0x3f6cfd['routeId']){_0x3d13c9=_0x4ae1('0x19');}else{console[_0x4ae1('0x1a')](_0x4ae1('0x1b'),_0x3f6cfd);}}else{_0x3d13c9=_0x4ae1('0x1c');}switch(_0x55fb2a[_0x4ae1('0x14')][_0x4ae1('0x15')]()){case'zendesk':zendesk[_0x3d13c9](_0x55fb2a,_0x3f6cfd,_0x1be074,_0x42d483,_0x24f7df,_0x347274,_0x10cf32);break;case _0x4ae1('0xc'):salesforce[_0x3d13c9](_0x55fb2a,_0x3f6cfd,_0x1be074,_0x42d483,_0x24f7df,_0x347274,_0x10cf32);break;case _0x4ae1('0x1d'):sugarcrm[_0x3d13c9](_0x55fb2a,_0x3f6cfd,_0x1be074,_0x42d483,_0x24f7df,_0x347274,_0x10cf32);break;case'freshdesk':freshdesk[_0x3d13c9](_0x55fb2a,_0x3f6cfd,_0x1be074,_0x42d483,_0x24f7df,_0x347274,_0x10cf32);break;case _0x4ae1('0xd'):zoho[_0x3d13c9](_0x55fb2a,_0x3f6cfd,_0x1be074,_0x42d483,_0x24f7df,_0x347274,_0x10cf32);break;case _0x4ae1('0xe'):desk[_0x3d13c9](_0x55fb2a,_0x3f6cfd,_0x1be074,_0x42d483,_0x24f7df,_0x347274,_0x10cf32);break;case _0x4ae1('0xf'):vtiger[_0x3d13c9](_0x55fb2a,_0x3f6cfd,_0x1be074,_0x42d483,_0x24f7df,_0x347274,_0x10cf32);break;case _0x4ae1('0x11'):freshsales['cs'](_0x55fb2a,_0x3f6cfd,_0x1be074,_0x42d483,_0x24f7df,_0x347274,_0x10cf32,_0x3d13c9);break;case _0x4ae1('0x12'):servicenow['cs'](_0x55fb2a,_0x3f6cfd,_0x1be074,_0x42d483,_0x24f7df,_0x347274,_0x10cf32,_0x3d13c9);break;case'dynamics365':dynamics365['cs'](_0x55fb2a,_0x3f6cfd,_0x1be074,_0x42d483,_0x24f7df,_0x347274,_0x10cf32,_0x3d13c9);break;default:console['log'](_0x4ae1('0x1e'));}}else{_0x5447a3=require(_0x4ae1('0x1f'))(_0x55fb2a[_0x4ae1('0x14')][_0x4ae1('0x15')]());_0x5447a3[_0x4ae1('0x20')](_0x4ae1('0x21'),util[_0x4ae1('0x22')](_0x4ae1('0x23'),_0x55fb2a['data1'][_0x4ae1('0x15')](),_0x55fb2a[_0x4ae1('0x24')]));}}else{_0x5447a3=require('../../../../config/logger')(_0x55fb2a[_0x4ae1('0x14')][_0x4ae1('0x15')]());_0x5447a3['error'](_0x4ae1('0x21'),util[_0x4ae1('0x22')](_0x4ae1('0x25'),_0x55fb2a['data1'][_0x4ae1('0x15')](),_0x55fb2a['data2']));}}else{}}catch(_0x474b38){console[_0x4ae1('0x20')](_0x474b38);}}}}; \ 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 d75f42a..148e924 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 _0xafdb=['bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','assign','getString','Descriptions','ActivityDate','utc','IsReminderSet','endUserType','WhatId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','ticketType','create','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','display_name','identity','user_id','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','contact','lead','account','first','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','Company','upperFirst','forEach','includes','string','picklist','content','variable','variableName','idField','toString','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','queue','[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','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','%s/%s/e','unmanaged','toUpperCase',']\x20Ticket\x20%s\x20created.','lastevent',']\x20Integration\x20account\x20type\x20%s.','moment'];(function(_0xfb001,_0x291fa9){var _0xd68352=function(_0x39f0d2){while(--_0x39f0d2){_0xfb001['push'](_0xfb001['shift']());}};_0xd68352(++_0x291fa9);}(_0xafdb,0x1f3));var _0xbafd=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0xafdb[_0x10d34b];return _0x92b0bf;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xbafd('0x0'));var BPromise=require(_0xbafd('0x1'));var md5=require(_0xbafd('0x2'));var jsforce=require(_0xbafd('0x3'));var util=require(_0xbafd('0x4'));var Redis=require(_0xbafd('0x5'));var intUtil=require(_0xbafd('0x6'));var config=require(_0xbafd('0x7'));var logger=require(_0xbafd('0x8'))(_0xbafd('0x9'));config[_0xbafd('0xa')]=_[_0xbafd('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbafd('0xa')]));function emit(_0x510b80,_0x50cf66,_0x436858){io['to'](_0x510b80)['emit'](_0x50cf66,_0x436858);}function getTicket(_0x451596,_0x327d6d,_0x12147a,_0xfdb92b,_0x492f97,_0x2a7fb5,_0x5887b8,_0x448ec4){var _0x42d2af=Object[_0xbafd('0xc')]({},{'OwnerId':_0x327d6d['id'],'Subject':intUtil[_0xbafd('0xd')](_0xfdb92b['Subjects'],_0x492f97,'\x20'),'Description':intUtil[_0xbafd('0xd')](_0xfdb92b[_0xbafd('0xe')],_0x492f97,'\x0a')},getCustomFields(_0x2a7fb5,_0x492f97));if(_0x12147a){if(_0xfdb92b['ticketType']==='Task'){_0x42d2af[_0xbafd('0xf')]=moment[_0xbafd('0x10')]();_0x42d2af[_0xbafd('0x11')]=![];_0x42d2af['IsRecurrence']=![];if(_0x12147a[_0xbafd('0x12')]==='contact'||_0x12147a[_0xbafd('0x12')]==='lead'){_0x42d2af['WhoId']=_0x12147a['id'];}else if(_0x12147a[_0xbafd('0x12')]==='account'){_0x42d2af[_0xbafd('0x13')]=_0x12147a['id'];}}else if(_0xfdb92b['ticketType']==='Case'){if(_0x12147a[_0xbafd('0x12')]==='contact'){_0x42d2af['ContactId']=_0x12147a['id'];}else if(_0x12147a[_0xbafd('0x12')]==='account'){_0x42d2af[_0xbafd('0x14')]=_0x12147a['id'];}else if(_0x12147a[_0xbafd('0x12')]==='lead'&&_0xfdb92b[_0xbafd('0x15')]){_0x42d2af[_0xfdb92b[_0xbafd('0x15')]]=_0x12147a['id'];}else{logger[_0xbafd('0x16')](_0xbafd('0x17'));}}}return _0x5887b8[_0xbafd('0x18')](_0xfdb92b[_0xbafd('0x19')])[_0xbafd('0x1a')](_0x42d2af);}function getUser(_0x4f2b20,_0x475285,_0x49fdf0){if(!_['isNil'](_0x475285)&&intUtil[_0xbafd('0x1b')](_0x475285)){var _0x4cbf22={'Email':_0x475285};var _0x59ccb8={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x49fdf0[_0xbafd('0x18')](_0xbafd('0x1c'))[_0xbafd('0x1d')](_0x4cbf22,_0x59ccb8)[_0xbafd('0x1e')]()[_0xbafd('0x1f')](function(_0x1c8327){if(_0x1c8327[_0xbafd('0x20')]){var _0x4a7eca=_[_0xbafd('0x1d')](_0x1c8327,function(_0x58b668){return _0x58b668[_0xbafd('0x21')]===_0x475285;});if(_0x4a7eca){logger[_0xbafd('0x16')](_0xbafd('0x22'),_0x475285);return BPromise[_0xbafd('0x23')]({'id':_0x4a7eca['Id'],'name':_0x4a7eca[_0xbafd('0x24')]});}}else{logger[_0xbafd('0x16')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x475285);return _0x49fdf0['identity']()[_0xbafd('0x1f')](function(_0x537e2e){return BPromise[_0xbafd('0x23')]({'id':_0x537e2e['user_id'],'name':_0x537e2e[_0xbafd('0x25')]});});}});}else{logger[_0xbafd('0x16')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x475285);return _0x49fdf0[_0xbafd('0x26')]()[_0xbafd('0x1f')](function(_0x3e20bd){return BPromise[_0xbafd('0x23')]({'id':_0x3e20bd[_0xbafd('0x27')],'name':_0x3e20bd[_0xbafd('0x25')]});});}}function getEndUser(_0x3a718d,_0x23fd23,_0x36caea,_0x29d216,_0x57b979){var _0x5f1659={'$or':{'Phone':_0x29d216}};var _0x4c7c92={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbafd('0x23')]()[_0xbafd('0x1f')](function(){logger[_0xbafd('0x16')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x29d216,_0x23fd23['moduleSearch']);switch(_0x23fd23['moduleSearch']){case _0xbafd('0x28'):var _0x12331e=_[_0xbafd('0x29')](_0x5f1659);if(_0x23fd23['additionalSearchContact']){var _0x4d1652={};_0x4d1652[_0x23fd23[_0xbafd('0x2a')]]=_0x29d216;_[_0xbafd('0x2b')](_0x12331e[_0xbafd('0x2c')],_0x4d1652);}return _0x57b979[_0xbafd('0x18')](_0xbafd('0x2d'))['find'](_0x12331e,_0x4c7c92)[_0xbafd('0x1e')]()[_0xbafd('0x1f')](function(_0x1a91e4){if(_0x1a91e4&&_0x1a91e4[_0xbafd('0x20')]){return _0x1a91e4;}else{var _0x355eab=_[_0xbafd('0x29')](_0x5f1659);if(_0x23fd23[_0xbafd('0x2e')]){var _0x4468fa={};_0x4468fa[_0x23fd23[_0xbafd('0x2e')]]=_0x29d216;_[_0xbafd('0x2b')](_0x355eab['$or'],_0x4468fa);}return _0x57b979['sobject'](_0xbafd('0x2f'))[_0xbafd('0x1d')](_0x355eab,_0x4c7c92);}});case _0xbafd('0x30'):var _0x450408=_[_0xbafd('0x29')](_0x5f1659);if(_0x23fd23[_0xbafd('0x31')]){var _0x4d1652={};_0x4d1652[_0x23fd23[_0xbafd('0x31')]]=_0x29d216;_[_0xbafd('0x2b')](_0x450408['$or'],_0x4d1652);}return _0x57b979[_0xbafd('0x18')](_0xbafd('0x32'))['find'](_0x450408,_0x4c7c92)[_0xbafd('0x1e')]()[_0xbafd('0x1f')](function(_0x392ebb){if(_0x392ebb&&_0x392ebb[_0xbafd('0x20')]){return _0x392ebb;}else{var _0x47a168=_['cloneDeep'](_0x5f1659);if(_0x23fd23[_0xbafd('0x2a')]){var _0x3e1d51={};_0x3e1d51[_0x23fd23[_0xbafd('0x2a')]]=_0x29d216;_['merge'](_0x47a168[_0xbafd('0x2c')],_0x3e1d51);}return _0x57b979[_0xbafd('0x18')](_0xbafd('0x2d'))['find'](_0x47a168,_0x4c7c92)[_0xbafd('0x1f')](function(_0x3e6b7a){if(_0x3e6b7a&&_0x3e6b7a[_0xbafd('0x20')]){return _0x3e6b7a;}else{var _0x2bd367=_['cloneDeep'](_0x5f1659);if(_0x23fd23[_0xbafd('0x2e')]){var _0x10b0f2={};_0x10b0f2[_0x23fd23[_0xbafd('0x2e')]]=_0x29d216;_[_0xbafd('0x2b')](_0x2bd367['$or'],_0x10b0f2);}return _0x57b979['sobject'](_0xbafd('0x2f'))[_0xbafd('0x1d')](_0x2bd367,_0x4c7c92);}});}});case _0xbafd('0x33'):var _0x12331e=_[_0xbafd('0x29')](_0x5f1659);if(_0x23fd23[_0xbafd('0x2a')]){var _0x4d1652={};_0x4d1652[_0x23fd23[_0xbafd('0x2a')]]=_0x29d216;_[_0xbafd('0x2b')](_0x12331e[_0xbafd('0x2c')],_0x4d1652);}return _0x57b979[_0xbafd('0x18')](_0xbafd('0x2d'))[_0xbafd('0x1d')](_0x12331e,_0x4c7c92)[_0xbafd('0x1e')]();case _0xbafd('0x34'):var _0x54b081=_[_0xbafd('0x29')](_0x5f1659);if(_0x23fd23[_0xbafd('0x2e')]){var _0x4d1652={};_0x4d1652[_0x23fd23[_0xbafd('0x2e')]]=_0x29d216;_[_0xbafd('0x2b')](_0x54b081['$or'],_0x4d1652);}return _0x57b979[_0xbafd('0x18')](_0xbafd('0x2f'))['find'](_0x54b081,_0x4c7c92);case _0xbafd('0x35'):var _0x450408=_[_0xbafd('0x29')](_0x5f1659);if(_0x23fd23[_0xbafd('0x31')]){var _0x4d1652={};_0x4d1652[_0x23fd23[_0xbafd('0x31')]]=_0x29d216;_[_0xbafd('0x2b')](_0x450408[_0xbafd('0x2c')],_0x4d1652);}return _0x57b979[_0xbafd('0x18')](_0xbafd('0x32'))[_0xbafd('0x1d')](_0x450408,_0x4c7c92);default:return null;}})[_0xbafd('0x1f')](function(_0xc94d81){if(_0xc94d81&&_0xc94d81[_0xbafd('0x20')]){var _0x296ef5=_[_0xbafd('0x36')](_0xc94d81);if(_0x296ef5){return BPromise['resolve']({'id':_0x296ef5['Id'],'name':_0x296ef5[_0xbafd('0x24')],'phone':_0x296ef5[_0xbafd('0x37')],'endUserType':_0x296ef5[_0xbafd('0x38')][_0xbafd('0x39')]['toLowerCase']()});}}})['then'](function(_0x553e30){if(_0x553e30){logger[_0xbafd('0x16')](_0xbafd('0x3a'),_0x553e30[_0xbafd('0x12')],_0x29d216);return BPromise[_0xbafd('0x23')](_0x553e30);}else{logger[_0xbafd('0x16')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x29d216);var _0xc408b7={'Phone':_0x29d216};if(_0x23fd23[_0xbafd('0x3b')]){if(_0x23fd23['moduleCreate']===_0xbafd('0x33')){logger[_0xbafd('0x16')](_0xbafd('0x3c'),_0x29d216,_0x23fd23['moduleCreate']);_0xc408b7['LastName']=_0x36caea!==_0xbafd('0x3d')?_0x36caea:util[_0xbafd('0x3e')](_0xbafd('0x3f'),_0x29d216);}else if(_0x23fd23[_0xbafd('0x3b')]===_0xbafd('0x34')){logger[_0xbafd('0x16')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x29d216,_0x23fd23[_0xbafd('0x3b')]);_0xc408b7['LastName']=_0x36caea!==_0xbafd('0x3d')?_0x36caea:util['format'](_0xbafd('0x3f'),_0x29d216);_0xc408b7[_0xbafd('0x40')]='No\x20Company';}else if(_0x23fd23[_0xbafd('0x3b')]==='account'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x29d216,_0x23fd23[_0xbafd('0x3b')]);_0xc408b7[_0xbafd('0x24')]=_0x36caea!==_0xbafd('0x3d')?_0x36caea:util['format']('Caller\x20-\x20%s',_0x29d216);}else{return null;}}return _0x57b979[_0xbafd('0x18')](_[_0xbafd('0x41')](_0x23fd23[_0xbafd('0x3b')]))[_0xbafd('0x1a')](_0xc408b7)[_0xbafd('0x1f')](function(_0x5b2dff){return BPromise[_0xbafd('0x23')]({'id':_0x5b2dff['id'],'endUserType':_0x23fd23['moduleCreate']});});}});}function getCustomFields(_0x58baf3,_0x461ab3){var _0x5a4076={};if(_0x58baf3[_0xbafd('0x20')]>0x0){_[_0xbafd('0x42')](_0x58baf3,function(_0x593f1c){if(_[_0xbafd('0x43')]([_0xbafd('0x44'),_0xbafd('0x45')],_0x593f1c['type'])&&_0x593f1c['idField']){_0x5a4076[_0x593f1c['idField']]=_0x593f1c[_0xbafd('0x46')]['toString']();}else if(_0x593f1c[_0xbafd('0x39')]===_0xbafd('0x47')&&_0x593f1c[_0xbafd('0x48')]&&_0x593f1c[_0xbafd('0x49')]){_0x461ab3[_0x593f1c[_0xbafd('0x48')]]&&(_0x5a4076[_0x593f1c['idField']]=_0x461ab3[_0x593f1c[_0xbafd('0x48')]][_0xbafd('0x4a')]());}else if(_0x593f1c[_0xbafd('0x39')]==='customVariable'&&_0x593f1c[_0xbafd('0x4b')]&&_0x593f1c['Variable'][_0xbafd('0x4c')]&&_0x593f1c[_0xbafd('0x49')]){_0x461ab3[_0x593f1c['Variable'][_0xbafd('0x4c')][_0xbafd('0x4d')]()]&&(_0x5a4076[_0x593f1c['idField']]=_0x461ab3[_0x593f1c[_0xbafd('0x4b')][_0xbafd('0x4c')][_0xbafd('0x4d')]()][_0xbafd('0x4a')]());}});}return _0x5a4076;}function getConnection(_0xe4336a){var _0x20c104=_0xe4336a[_0xbafd('0x4e')][_0xbafd('0x4f')](_0xe4336a['securityToken']);var _0x57e441=new jsforce[(_0xbafd('0x50'))]({'oauth2':{'loginUrl':_0xe4336a[_0xbafd('0x51')]||_0xbafd('0x52'),'clientId':_0xe4336a['clientId'],'clientSecret':_0xe4336a[_0xbafd('0x53')]}});return _0x57e441[_0xbafd('0x54')](_0xe4336a[_0xbafd('0x55')],_0x20c104)[_0xbafd('0x1f')](function(){logger[_0xbafd('0x16')](_0xbafd('0x56'));return _0x57e441;});}exports['queue']=function(_0x55d9ef,_0x1d8339,_0x5f2801,_0x4f4640,_0x3d8d12,_0x375d92){var _0x3b7439,_0x5a27e8,_0x1a26f3,_0x20315a;_0x375d92[_0xbafd('0x57')]=intUtil[_0xbafd('0x58')](_0x375d92[_0xbafd('0x57')]);_0x375d92[_0xbafd('0x51')]=intUtil[_0xbafd('0x58')](_0x375d92['remoteUri']);if(_0x3d8d12&&_0x3d8d12[_0xbafd('0x59')]){logger[_0xbafd('0x16')](_0xbafd('0x5a'),'Recording\x20is\x20enabled!');_0x1d8339['recordingURL']=util[_0xbafd('0x3e')](_0xbafd('0x5b'),_0x375d92[_0xbafd('0x57')],_0x1d8339[_0xbafd('0x5c')],md5(_0x1d8339['uniqueid']));}else{_0x1d8339[_0xbafd('0x5d')]='';}return getConnection(_0x375d92)[_0xbafd('0x1f')](function(_0x2976cc){_0x20315a=_0x2976cc;return getUser(_0x375d92,_0x4f4640[_0xbafd('0x5e')],_0x20315a);})[_0xbafd('0x1f')](function(_0x3bab87){_0x3b7439=_0x3bab87;return getEndUser(_0x375d92,_0x5f2801,_0x1d8339[_0xbafd('0x5f')],_0x1d8339[_0xbafd('0x60')],_0x20315a);})[_0xbafd('0x1f')](function(_0x1a49f5){_0x5a27e8=_0x1a49f5;return getTicket(_0x375d92,_0x3b7439,_0x5a27e8,_0x5f2801,_0x1d8339,_0x5f2801[_0xbafd('0x61')],_0x20315a,_0xbafd('0x62'));})[_0xbafd('0x1f')](function(_0x39dc35){_0x1a26f3=_0x39dc35;logger[_0xbafd('0x16')](_0xbafd('0x63'),_0x1a26f3['id']);logger[_0xbafd('0x16')](_0xbafd('0x64'),_0x1a26f3['id'],_0x4f4640['name'],_0x375d92[_0xbafd('0x39')]);switch(_0x375d92[_0xbafd('0x39')]){case _0xbafd('0x65'):emit(util[_0xbafd('0x3e')](_0xbafd('0x66'),_0x4f4640[_0xbafd('0x4c')]),_0xbafd('0x67'),{'recordId':_0x1a26f3['id']});break;case'newTab':emit(util[_0xbafd('0x3e')](_0xbafd('0x66'),_0x4f4640[_0xbafd('0x4c')]),_0xbafd('0x68'),{'uri':util[_0xbafd('0x3e')]('%s/%s/e',_0x20315a[_0xbafd('0x69')],_0x1a26f3['id'])});break;default:logger[_0xbafd('0x6a')](_0xbafd('0x6b'));}})[_0xbafd('0x6c')](function(_0xc91ca9){logger[_0xbafd('0x6a')]('[QUEUE]',_0xc91ca9);});};exports[_0xbafd('0x6d')]=function(_0x405c13,_0x184c61,_0x57eb24,_0x237707,_0x9f1065,_0x23b664,_0x3e5f8d){var _0x13f414,_0x10e802,_0x4ea1ea,_0x59736c;_0x23b664[_0xbafd('0x57')]=intUtil[_0xbafd('0x58')](_0x23b664[_0xbafd('0x57')]);_0x23b664['remoteUri']=intUtil[_0xbafd('0x58')](_0x23b664['remoteUri']);if(_0x3e5f8d&&_0x3e5f8d[_0xbafd('0x6e')]&&_0x3e5f8d[_0xbafd('0x6e')]!==_0xbafd('0x6f')){logger[_0xbafd('0x16')](_0xbafd('0x70'),_0xbafd('0x71'));_0x184c61[_0xbafd('0x5d')]=util[_0xbafd('0x3e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x23b664[_0xbafd('0x57')],_0x184c61[_0xbafd('0x5c')],md5(_0x184c61['uniqueid']));}return getConnection(_0x23b664)[_0xbafd('0x1f')](function(_0x1d68c9){_0x59736c=_0x1d68c9;return getUser(_0x23b664,_0x237707[_0xbafd('0x5e')],_0x59736c);})['then'](function(_0x3d3a03){_0x13f414=_0x3d3a03;return getEndUser(_0x23b664,_0x57eb24,_0x184c61[_0xbafd('0x72')],_0x184c61[_0xbafd('0x73')],_0x59736c);})['then'](function(_0xd0d76c){_0x10e802=_0xd0d76c;return getTicket(_0x23b664,_0x13f414,_0x10e802,_0x57eb24,_0x184c61,_0x57eb24[_0xbafd('0x61')],_0x59736c,_0xbafd('0x6d'));})[_0xbafd('0x1f')](function(_0xceb414){_0x4ea1ea=_0xceb414;logger[_0xbafd('0x16')](_0xbafd('0x74'),_0x4ea1ea['id']);logger['info'](_0xbafd('0x75'),_0x4ea1ea['id'],_0x237707[_0xbafd('0x4c')],_0x23b664[_0xbafd('0x39')]);switch(_0x23b664[_0xbafd('0x39')]){case _0xbafd('0x65'):emit(util[_0xbafd('0x3e')](_0xbafd('0x66'),_0x237707['name']),_0xbafd('0x67'),{'recordId':_0x4ea1ea['id']});break;case _0xbafd('0x76'):emit(util['format'](_0xbafd('0x66'),_0x237707[_0xbafd('0x4c')]),_0xbafd('0x68'),{'uri':util[_0xbafd('0x3e')](_0xbafd('0x77'),_0x59736c['instanceUrl'],_0x4ea1ea['id'])});break;default:logger[_0xbafd('0x6a')](_0xbafd('0x70'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xbafd('0x6c')](function(_0x3a858a){logger['error'](_0xbafd('0x70'),_0x3a858a);});};exports[_0xbafd('0x78')]=function(_0x1f53bc,_0x2502e2,_0x459e95,_0x361b22,_0x493758,_0x5d69e0){var _0x12bf5a,_0x1bb162,_0x32017e,_0x44428e;_0x5d69e0[_0xbafd('0x57')]=intUtil[_0xbafd('0x58')](_0x5d69e0['serverUrl']);_0x5d69e0[_0xbafd('0x51')]=intUtil['stripTrailingSlash'](_0x5d69e0['remoteUri']);if(_0x493758&&_0x493758[_0xbafd('0x59')]){logger[_0xbafd('0x16')]('['+_0x2502e2['lastevent'][_0xbafd('0x79')]()+']',_0xbafd('0x71'));_0x2502e2[_0xbafd('0x5d')]=util['format'](_0xbafd('0x5b'),_0x5d69e0[_0xbafd('0x57')],_0x2502e2[_0xbafd('0x5c')],md5(_0x2502e2[_0xbafd('0x5c')]));}else{_0x2502e2['recordingURL']='';}return getConnection(_0x5d69e0)['then'](function(_0x5be39a){_0x44428e=_0x5be39a;if(!_['isNil'](_0x361b22)){return getUser(_0x5d69e0,_0x361b22[_0xbafd('0x4c')],_0x44428e);}else{return getUser(_0x5d69e0,null,_0x44428e);}})[_0xbafd('0x1f')](function(_0x2fd20b){_0x12bf5a=_0x2fd20b;return getEndUser(_0x5d69e0,_0x459e95,_0x2502e2[_0xbafd('0x5f')],_0x2502e2[_0xbafd('0x60')],_0x44428e);})[_0xbafd('0x1f')](function(_0x1273aa){_0x1bb162=_0x1273aa;return getTicket(_0x5d69e0,_0x12bf5a,_0x1bb162,_0x459e95,_0x2502e2,_0x459e95[_0xbafd('0x61')],_0x44428e);})[_0xbafd('0x1f')](function(_0x501dd3){_0x32017e=_0x501dd3;logger['info']('['+_0x2502e2['lastevent']['toUpperCase']()+_0xbafd('0x7a'),_0x32017e['id']);logger[_0xbafd('0x16')]('['+_0x2502e2[_0xbafd('0x7b')]['toUpperCase']()+_0xbafd('0x7c'),_0x5d69e0[_0xbafd('0x39')]);})[_0xbafd('0x6c')](function(_0x4cf0c9){logger[_0xbafd('0x6a')]('['+_0x2502e2[_0xbafd('0x7b')][_0xbafd('0x79')]()+']',_0x4cf0c9);});}; \ No newline at end of file +var _0x362a=['user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','[QUEUE]','outbound','none','[OUTBOUND]','email','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','WhoId','account','WhatId','Case','contact','ContactId','AccountId','leadId','info','sobject','create','isNil','validateEmail','find','execute','length','Agent\x20%s\x20found.','resolve','Name','then','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','Contact','additionalSearchLead','merge','$or','Lead','account_contact_lead','additionalSearchAccount','Account','lead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','','format','LastName','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','idField','content','toString','variableName','Variable','name','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login','username','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridnum','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x362a,0x92));var _0xa362=function(_0x4eb6ec,_0x7f2520){_0x4eb6ec=_0x4eb6ec-0x0;var _0x58881b=_0x362a[_0x4eb6ec];return _0x58881b;};'use strict';var _=require(_0xa362('0x0'));var rp=require(_0xa362('0x1'));var moment=require(_0xa362('0x2'));var BPromise=require(_0xa362('0x3'));var md5=require(_0xa362('0x4'));var jsforce=require(_0xa362('0x5'));var util=require('util');var Redis=require(_0xa362('0x6'));var intUtil=require(_0xa362('0x7'));var config=require(_0xa362('0x8'));var logger=require(_0xa362('0x9'))(_0xa362('0xa'));config[_0xa362('0xb')]=_[_0xa362('0xc')](config[_0xa362('0xb')],{'host':_0xa362('0xd'),'port':0x18eb});var io=require(_0xa362('0xe'))(new Redis(config['redis']));function emit(_0x5c3406,_0x49bc4d,_0xb11947){io['to'](_0x5c3406)['emit'](_0x49bc4d,_0xb11947);}function getTicket(_0x4e5e57,_0xa45467,_0x1ced49,_0xd89054,_0x3d7b15,_0x2d07dd,_0x3ead63,_0x56bc9c){var _0x3318c3=Object['assign']({},{'OwnerId':_0xa45467['id'],'Subject':intUtil[_0xa362('0xf')](_0xd89054[_0xa362('0x10')],_0x3d7b15,'\x20'),'Description':intUtil[_0xa362('0xf')](_0xd89054[_0xa362('0x11')],_0x3d7b15,'\x0a')},getCustomFields(_0x2d07dd,_0x3d7b15));if(_0x1ced49){if(_0xd89054[_0xa362('0x12')]===_0xa362('0x13')){_0x3318c3[_0xa362('0x14')]=moment[_0xa362('0x15')]();_0x3318c3['IsReminderSet']=![];_0x3318c3[_0xa362('0x16')]=![];if(_0x1ced49[_0xa362('0x17')]==='contact'||_0x1ced49[_0xa362('0x17')]==='lead'){_0x3318c3[_0xa362('0x18')]=_0x1ced49['id'];}else if(_0x1ced49['endUserType']===_0xa362('0x19')){_0x3318c3[_0xa362('0x1a')]=_0x1ced49['id'];}}else if(_0xd89054[_0xa362('0x12')]===_0xa362('0x1b')){if(_0x1ced49[_0xa362('0x17')]===_0xa362('0x1c')){_0x3318c3[_0xa362('0x1d')]=_0x1ced49['id'];}else if(_0x1ced49[_0xa362('0x17')]===_0xa362('0x19')){_0x3318c3[_0xa362('0x1e')]=_0x1ced49['id'];}else if(_0x1ced49[_0xa362('0x17')]==='lead'&&_0xd89054[_0xa362('0x1f')]){_0x3318c3[_0xd89054['leadId']]=_0x1ced49['id'];}else{logger[_0xa362('0x20')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x3ead63[_0xa362('0x21')](_0xd89054[_0xa362('0x12')])[_0xa362('0x22')](_0x3318c3);}function getUser(_0x478015,_0x539052,_0x48466c){if(!_[_0xa362('0x23')](_0x539052)&&intUtil[_0xa362('0x24')](_0x539052)){var _0x273a6d={'Email':_0x539052};var _0x8cf3c5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x48466c[_0xa362('0x21')]('User')[_0xa362('0x25')](_0x273a6d,_0x8cf3c5)[_0xa362('0x26')]()['then'](function(_0x2529f8){if(_0x2529f8[_0xa362('0x27')]){var _0x20ec56=_['find'](_0x2529f8,function(_0x1c82a3){return _0x1c82a3['Email']===_0x539052;});if(_0x20ec56){logger[_0xa362('0x20')](_0xa362('0x28'),_0x539052);return BPromise[_0xa362('0x29')]({'id':_0x20ec56['Id'],'name':_0x20ec56[_0xa362('0x2a')]});}}else{logger[_0xa362('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x539052);return _0x48466c['identity']()[_0xa362('0x2b')](function(_0x40a222){return BPromise[_0xa362('0x29')]({'id':_0x40a222[_0xa362('0x2c')],'name':_0x40a222[_0xa362('0x2d')]});});}});}else{logger[_0xa362('0x20')](_0xa362('0x2e'),_0x539052);return _0x48466c[_0xa362('0x2f')]()[_0xa362('0x2b')](function(_0x26bec2){return BPromise['resolve']({'id':_0x26bec2[_0xa362('0x2c')],'name':_0x26bec2[_0xa362('0x2d')]});});}}function getEndUser(_0x5efbe9,_0x5c3927,_0x4d5922,_0x5e3356,_0x4daf3c){var _0x516d48={'$or':{'Phone':_0x5e3356}};var _0x57119a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa362('0x29')]()[_0xa362('0x2b')](function(){logger['info'](_0xa362('0x30'),_0x5e3356,_0x5c3927[_0xa362('0x31')]);switch(_0x5c3927[_0xa362('0x31')]){case _0xa362('0x32'):var _0x2946d8=_[_0xa362('0x33')](_0x516d48);if(_0x5c3927[_0xa362('0x34')]){var _0x528676={};_0x528676[_0x5c3927[_0xa362('0x34')]]=_0x5e3356;_['merge'](_0x2946d8['$or'],_0x528676);}return _0x4daf3c[_0xa362('0x21')](_0xa362('0x35'))['find'](_0x2946d8,_0x57119a)['execute']()['then'](function(_0x3bd87b){if(_0x3bd87b&&_0x3bd87b['length']){return _0x3bd87b;}else{var _0x392a73=_['cloneDeep'](_0x516d48);if(_0x5c3927['additionalSearchLead']){var _0x35d62a={};_0x35d62a[_0x5c3927[_0xa362('0x36')]]=_0x5e3356;_[_0xa362('0x37')](_0x392a73[_0xa362('0x38')],_0x35d62a);}return _0x4daf3c[_0xa362('0x21')](_0xa362('0x39'))[_0xa362('0x25')](_0x392a73,_0x57119a);}});case _0xa362('0x3a'):var _0x19f93c=_[_0xa362('0x33')](_0x516d48);if(_0x5c3927[_0xa362('0x3b')]){var _0x528676={};_0x528676[_0x5c3927[_0xa362('0x3b')]]=_0x5e3356;_[_0xa362('0x37')](_0x19f93c[_0xa362('0x38')],_0x528676);}return _0x4daf3c[_0xa362('0x21')](_0xa362('0x3c'))['find'](_0x19f93c,_0x57119a)[_0xa362('0x26')]()[_0xa362('0x2b')](function(_0x577d4f){if(_0x577d4f&&_0x577d4f[_0xa362('0x27')]){return _0x577d4f;}else{var _0x509acb=_[_0xa362('0x33')](_0x516d48);if(_0x5c3927[_0xa362('0x34')]){var _0x45a24a={};_0x45a24a[_0x5c3927[_0xa362('0x34')]]=_0x5e3356;_[_0xa362('0x37')](_0x509acb[_0xa362('0x38')],_0x45a24a);}return _0x4daf3c[_0xa362('0x21')](_0xa362('0x35'))['find'](_0x509acb,_0x57119a)[_0xa362('0x2b')](function(_0x3076b4){if(_0x3076b4&&_0x3076b4[_0xa362('0x27')]){return _0x3076b4;}else{var _0x462910=_[_0xa362('0x33')](_0x516d48);if(_0x5c3927['additionalSearchLead']){var _0xadf8c7={};_0xadf8c7[_0x5c3927[_0xa362('0x36')]]=_0x5e3356;_[_0xa362('0x37')](_0x462910[_0xa362('0x38')],_0xadf8c7);}return _0x4daf3c['sobject'](_0xa362('0x39'))[_0xa362('0x25')](_0x462910,_0x57119a);}});}});case _0xa362('0x1c'):var _0x2946d8=_[_0xa362('0x33')](_0x516d48);if(_0x5c3927['additionalSearchContact']){var _0x528676={};_0x528676[_0x5c3927[_0xa362('0x34')]]=_0x5e3356;_[_0xa362('0x37')](_0x2946d8[_0xa362('0x38')],_0x528676);}return _0x4daf3c[_0xa362('0x21')](_0xa362('0x35'))[_0xa362('0x25')](_0x2946d8,_0x57119a)['execute']();case _0xa362('0x3d'):var _0x30de88=_[_0xa362('0x33')](_0x516d48);if(_0x5c3927['additionalSearchLead']){var _0x528676={};_0x528676[_0x5c3927['additionalSearchLead']]=_0x5e3356;_['merge'](_0x30de88[_0xa362('0x38')],_0x528676);}return _0x4daf3c[_0xa362('0x21')]('Lead')[_0xa362('0x25')](_0x30de88,_0x57119a);case'account':var _0x19f93c=_[_0xa362('0x33')](_0x516d48);if(_0x5c3927[_0xa362('0x3b')]){var _0x528676={};_0x528676[_0x5c3927['additionalSearchAccount']]=_0x5e3356;_[_0xa362('0x37')](_0x19f93c[_0xa362('0x38')],_0x528676);}return _0x4daf3c[_0xa362('0x21')](_0xa362('0x3c'))['find'](_0x19f93c,_0x57119a);default:return null;}})[_0xa362('0x2b')](function(_0x6241a7){if(_0x6241a7&&_0x6241a7[_0xa362('0x27')]){var _0x4bdf82=_[_0xa362('0x3e')](_0x6241a7);if(_0x4bdf82){return BPromise[_0xa362('0x29')]({'id':_0x4bdf82['Id'],'name':_0x4bdf82[_0xa362('0x2a')],'phone':_0x4bdf82[_0xa362('0x3f')],'endUserType':_0x4bdf82[_0xa362('0x40')][_0xa362('0x41')][_0xa362('0x42')]()});}}})['then'](function(_0x4ae414){if(_0x4ae414){logger['info'](_0xa362('0x43'),_0x4ae414['endUserType'],_0x5e3356);return BPromise[_0xa362('0x29')](_0x4ae414);}else{logger[_0xa362('0x20')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x5e3356);var _0x4281a8={'Phone':_0x5e3356};if(_0x5c3927['moduleCreate']){if(_0x5c3927['moduleCreate']===_0xa362('0x1c')){logger[_0xa362('0x20')](_0xa362('0x44'),_0x5e3356,_0x5c3927[_0xa362('0x45')]);_0x4281a8['LastName']=_0x4d5922!==_0xa362('0x46')?_0x4d5922:util[_0xa362('0x47')]('Caller\x20-\x20%s',_0x5e3356);}else if(_0x5c3927[_0xa362('0x45')]==='lead'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5e3356,_0x5c3927[_0xa362('0x45')]);_0x4281a8[_0xa362('0x48')]=_0x4d5922!==_0xa362('0x46')?_0x4d5922:util[_0xa362('0x47')](_0xa362('0x49'),_0x5e3356);_0x4281a8[_0xa362('0x4a')]=_0xa362('0x4b');}else if(_0x5c3927[_0xa362('0x45')]===_0xa362('0x19')){logger[_0xa362('0x20')](_0xa362('0x44'),_0x5e3356,_0x5c3927[_0xa362('0x45')]);_0x4281a8[_0xa362('0x2a')]=_0x4d5922!==_0xa362('0x46')?_0x4d5922:util[_0xa362('0x47')](_0xa362('0x49'),_0x5e3356);}else{return null;}}return _0x4daf3c[_0xa362('0x21')](_[_0xa362('0x4c')](_0x5c3927[_0xa362('0x45')]))[_0xa362('0x22')](_0x4281a8)[_0xa362('0x2b')](function(_0x971d18){return BPromise['resolve']({'id':_0x971d18['id'],'endUserType':_0x5c3927['moduleCreate']});});}});}function getCustomFields(_0x42e771,_0x4e16a3){var _0x5374c={};if(_0x42e771[_0xa362('0x27')]>0x0){_[_0xa362('0x4d')](_0x42e771,function(_0x5626a1){if(_[_0xa362('0x4e')](['string','picklist'],_0x5626a1[_0xa362('0x41')])&&_0x5626a1[_0xa362('0x4f')]){_0x5374c[_0x5626a1['idField']]=_0x5626a1[_0xa362('0x50')][_0xa362('0x51')]();}else if(_0x5626a1[_0xa362('0x41')]==='variable'&&_0x5626a1[_0xa362('0x52')]&&_0x5626a1[_0xa362('0x4f')]){_0x4e16a3[_0x5626a1[_0xa362('0x52')]]&&(_0x5374c[_0x5626a1[_0xa362('0x4f')]]=_0x4e16a3[_0x5626a1['variableName']]['toString']());}else if(_0x5626a1['type']==='customVariable'&&_0x5626a1['Variable']&&_0x5626a1[_0xa362('0x53')][_0xa362('0x54')]&&_0x5626a1[_0xa362('0x4f')]){_0x4e16a3[_0x5626a1[_0xa362('0x53')][_0xa362('0x54')]['toLowerCase']()]&&(_0x5374c[_0x5626a1[_0xa362('0x4f')]]=_0x4e16a3[_0x5626a1['Variable'][_0xa362('0x54')][_0xa362('0x42')]()][_0xa362('0x51')]());}});}return _0x5374c;}function getConnection(_0x536202){var _0x10ccf8=_0x536202['password'][_0xa362('0x55')](_0x536202[_0xa362('0x56')]);var _0x32ac47=new jsforce[(_0xa362('0x57'))]({'oauth2':{'loginUrl':_0x536202[_0xa362('0x58')]||'https://login.salesforce.com','clientId':_0x536202[_0xa362('0x59')],'clientSecret':_0x536202[_0xa362('0x5a')]}});return _0x32ac47[_0xa362('0x5b')](_0x536202[_0xa362('0x5c')],_0x10ccf8)['then'](function(){logger['info']('Connection\x20established.');return _0x32ac47;});}exports['queue']=function(_0x4b3665,_0x2eba42,_0x388fcc,_0x2c63d6,_0x3a97f5,_0x1b470b){var _0x27c23d,_0x14a45d,_0x5b2e1c,_0xa930c6;_0x1b470b[_0xa362('0x5d')]=intUtil[_0xa362('0x5e')](_0x1b470b['serverUrl']);_0x1b470b['remoteUri']=intUtil[_0xa362('0x5e')](_0x1b470b[_0xa362('0x58')]);if(_0x3a97f5&&_0x3a97f5[_0xa362('0x5f')]){logger[_0xa362('0x20')]('[QUEUE]',_0xa362('0x60'));_0x2eba42['recordingURL']=util['format'](_0xa362('0x61'),_0x1b470b[_0xa362('0x5d')],_0x2eba42['uniqueid'],md5(_0x2eba42[_0xa362('0x62')]));}else{_0x2eba42[_0xa362('0x63')]='';}return getConnection(_0x1b470b)['then'](function(_0x1a52f0){_0xa930c6=_0x1a52f0;return getUser(_0x1b470b,_0x2c63d6['email'],_0xa930c6);})['then'](function(_0x497395){_0x27c23d=_0x497395;return getEndUser(_0x1b470b,_0x388fcc,_0x2eba42['calleridname'],_0x2eba42[_0xa362('0x64')],_0xa930c6);})[_0xa362('0x2b')](function(_0x5eb14d){_0x14a45d=_0x5eb14d;return getTicket(_0x1b470b,_0x27c23d,_0x14a45d,_0x388fcc,_0x2eba42,_0x388fcc['Fields'],_0xa930c6,_0xa362('0x65'));})[_0xa362('0x2b')](function(_0x2d83ab){_0x5b2e1c=_0x2d83ab;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x5b2e1c['id']);logger['info'](_0xa362('0x66'),_0x5b2e1c['id'],_0x2c63d6[_0xa362('0x54')],_0x1b470b['type']);switch(_0x1b470b[_0xa362('0x41')]){case _0xa362('0x67'):emit(util[_0xa362('0x47')](_0xa362('0x68'),_0x2c63d6['name']),_0xa362('0x69'),{'recordId':_0x5b2e1c['id']});break;case _0xa362('0x6a'):emit(util[_0xa362('0x47')]('user:%s',_0x2c63d6[_0xa362('0x54')]),_0xa362('0x6b'),{'uri':util['format'](_0xa362('0x6c'),_0xa930c6[_0xa362('0x6d')],_0x5b2e1c['id'])});break;default:logger[_0xa362('0x6e')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xa362('0x6f')](function(_0x42f578){logger[_0xa362('0x6e')](_0xa362('0x70'),_0x42f578);});};exports[_0xa362('0x71')]=function(_0x3f7d5f,_0x5282ff,_0x5a14fe,_0x4350bc,_0x385a05,_0x11ace2,_0x275c26){var _0xc126dc,_0x20a5c9,_0x40fe03,_0x4468e5;_0x11ace2[_0xa362('0x5d')]=intUtil[_0xa362('0x5e')](_0x11ace2[_0xa362('0x5d')]);_0x11ace2[_0xa362('0x58')]=intUtil['stripTrailingSlash'](_0x11ace2[_0xa362('0x58')]);if(_0x275c26&&_0x275c26['recordingFormat']&&_0x275c26['recordingFormat']!==_0xa362('0x72')){logger[_0xa362('0x20')](_0xa362('0x73'),_0xa362('0x60'));_0x5282ff['recordingURL']=util[_0xa362('0x47')](_0xa362('0x61'),_0x11ace2[_0xa362('0x5d')],_0x5282ff[_0xa362('0x62')],md5(_0x5282ff[_0xa362('0x62')]));}return getConnection(_0x11ace2)[_0xa362('0x2b')](function(_0x3f67fe){_0x4468e5=_0x3f67fe;return getUser(_0x11ace2,_0x4350bc[_0xa362('0x74')],_0x4468e5);})[_0xa362('0x2b')](function(_0x2278b1){_0xc126dc=_0x2278b1;return getEndUser(_0x11ace2,_0x5a14fe,_0x5282ff[_0xa362('0x75')],_0x5282ff['destcalleridnum'],_0x4468e5);})[_0xa362('0x2b')](function(_0x50d06c){_0x20a5c9=_0x50d06c;return getTicket(_0x11ace2,_0xc126dc,_0x20a5c9,_0x5a14fe,_0x5282ff,_0x5a14fe['Fields'],_0x4468e5,'outbound');})[_0xa362('0x2b')](function(_0x25566d){_0x40fe03=_0x25566d;logger['info'](_0xa362('0x76'),_0x40fe03['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x40fe03['id'],_0x4350bc[_0xa362('0x54')],_0x11ace2[_0xa362('0x41')]);switch(_0x11ace2[_0xa362('0x41')]){case _0xa362('0x67'):emit(util['format'](_0xa362('0x68'),_0x4350bc[_0xa362('0x54')]),_0xa362('0x69'),{'recordId':_0x40fe03['id']});break;case'newTab':emit(util[_0xa362('0x47')](_0xa362('0x68'),_0x4350bc['name']),_0xa362('0x6b'),{'uri':util['format'](_0xa362('0x6c'),_0x4468e5['instanceUrl'],_0x40fe03['id'])});break;default:logger[_0xa362('0x6e')](_0xa362('0x73'),_0xa362('0x77'));}})[_0xa362('0x6f')](function(_0x2be49f){logger[_0xa362('0x6e')](_0xa362('0x73'),_0x2be49f);});};exports['unmanaged']=function(_0x719d8f,_0x49b9b2,_0x2d12fd,_0x5a48f5,_0xf02643,_0x96b846){var _0x55dd46,_0x1241df,_0x570bf0,_0x28dced;_0x96b846['serverUrl']=intUtil[_0xa362('0x5e')](_0x96b846[_0xa362('0x5d')]);_0x96b846[_0xa362('0x58')]=intUtil['stripTrailingSlash'](_0x96b846[_0xa362('0x58')]);if(_0xf02643&&_0xf02643['monitor_format']){logger['info']('['+_0x49b9b2[_0xa362('0x78')][_0xa362('0x79')]()+']',_0xa362('0x60'));_0x49b9b2[_0xa362('0x63')]=util[_0xa362('0x47')](_0xa362('0x61'),_0x96b846[_0xa362('0x5d')],_0x49b9b2['uniqueid'],md5(_0x49b9b2[_0xa362('0x62')]));}else{_0x49b9b2[_0xa362('0x63')]='';}return getConnection(_0x96b846)[_0xa362('0x2b')](function(_0x1e5725){_0x28dced=_0x1e5725;if(!_[_0xa362('0x23')](_0x5a48f5)){return getUser(_0x96b846,_0x5a48f5[_0xa362('0x54')],_0x28dced);}else{return getUser(_0x96b846,null,_0x28dced);}})[_0xa362('0x2b')](function(_0x1127c4){_0x55dd46=_0x1127c4;return getEndUser(_0x96b846,_0x2d12fd,_0x49b9b2[_0xa362('0x7a')],_0x49b9b2[_0xa362('0x64')],_0x28dced);})[_0xa362('0x2b')](function(_0x5623ae){_0x1241df=_0x5623ae;return getTicket(_0x96b846,_0x55dd46,_0x1241df,_0x2d12fd,_0x49b9b2,_0x2d12fd['Fields'],_0x28dced);})[_0xa362('0x2b')](function(_0x3ebfa9){_0x570bf0=_0x3ebfa9;logger[_0xa362('0x20')]('['+_0x49b9b2[_0xa362('0x78')][_0xa362('0x79')]()+_0xa362('0x7b'),_0x570bf0['id']);logger[_0xa362('0x20')]('['+_0x49b9b2[_0xa362('0x78')]['toUpperCase']()+_0xa362('0x7c'),_0x96b846['type']);})[_0xa362('0x6f')](function(_0x226348){logger[_0xa362('0x6e')]('['+_0x49b9b2[_0xa362('0x78')][_0xa362('0x79')]()+']',_0x226348);});}; \ 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 363b0ee..b17dbae 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 _0xda32=['inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','true','userId','sys_id','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','nameField','toLowerCase','toString','type','customField','idField','content','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','forEach','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...'];(function(_0x13b01d,_0x269d5d){var _0x529a63=function(_0x1ccc3b){while(--_0x1ccc3b){_0x13b01d['push'](_0x13b01d['shift']());}};_0x529a63(++_0x269d5d);}(_0xda32,0x151));var _0x2da3=function(_0x20f35a,_0x2ba3bf){_0x20f35a=_0x20f35a-0x0;var _0x452b78=_0xda32[_0x20f35a];return _0x452b78;};'use strict';var _=require(_0x2da3('0x0'));var Promise=require(_0x2da3('0x1'));var rp=require(_0x2da3('0x2'));var util=require(_0x2da3('0x3'));var md5=require(_0x2da3('0x4'));var Redis=require(_0x2da3('0x5'));var intUtil=require('./util');var config=require(_0x2da3('0x6'));var logger=require(_0x2da3('0x7'))('servicenow');config['redis']=_[_0x2da3('0x8')](config[_0x2da3('0x9')],{'host':_0x2da3('0xa'),'port':0x18eb});var io=require(_0x2da3('0xb'))(new Redis(config[_0x2da3('0x9')]));function getAdminUser(_0x242546,_0x25999e,_0x69f83f,_0x319614,_0x119cef,_0x244b28){return new Promise(function(_0x22201a,_0x14e0ff){var _0x53afbb={'method':'GET','uri':_0x319614+_0x2da3('0xc')+'&'+_0x119cef+'&'+_0x244b28,'auth':_0x25999e,'json':!![]};return rp(_0x53afbb)['then'](function(_0x1fcf49){if(_0x1fcf49[_0x2da3('0xd')][_0x2da3('0xe')]>0x0){_0x69f83f[_0x2da3('0xf')]=_0x1fcf49[_0x2da3('0xd')][0x0]['sys_id'];}logger[_0x2da3('0x10')]('['+[_0x242546[_0x2da3('0x11')]()]+_0x2da3('0x12'),_0x69f83f);_0x22201a(_0x69f83f);})[_0x2da3('0x13')](function(_0x506dce){logger[_0x2da3('0x14')]('['+[_0x242546['toUpperCase']()]+']',_0x506dce[_0x2da3('0x15')]);_0x14e0ff(_0x506dce[_0x2da3('0x15')]);});});}function getUser(_0x3ef243,_0x56d36a,_0x45a70a,_0x10ab01,_0x771d18){return function(_0x2c13b9){logger[_0x2da3('0x10')]('['+[_0x3ef243[_0x2da3('0x11')]()]+_0x2da3('0x16'),_0x2c13b9);return new Promise(function(_0xad6edf,_0x24be56){if(intUtil[_0x2da3('0x17')](_0x2c13b9[_0x2da3('0x18')])){var _0x38633d={'method':_0x2da3('0x19'),'uri':_0x45a70a+_0x2da3('0x1a')+_0x2c13b9['userEmail']+'&'+_0x10ab01+'&'+_0x771d18,'auth':_0x56d36a,'json':!![]};logger[_0x2da3('0x10')]('['+[_0x3ef243[_0x2da3('0x11')]()]+_0x2da3('0x1b'),_0x38633d);return rp(_0x38633d)[_0x2da3('0x1c')](function(_0x19f90b){logger[_0x2da3('0x10')]('['+[_0x3ef243['toUpperCase']()]+'],\x20getUser\x20entity',_0x19f90b);if(_0x19f90b['result'][_0x2da3('0xe')]>0x0&&String(_0x19f90b['result'][0x0]['active'])===_0x2da3('0x1d')){_0x2c13b9[_0x2da3('0x1e')]=_0x19f90b['result'][0x0][_0x2da3('0x1f')];}else{_0x2c13b9['userId']=_0x2c13b9['adminId'];_0x2c13b9[_0x2da3('0x18')]=_0x2c13b9[_0x2da3('0x20')];}logger['info']('['+[_0x3ef243[_0x2da3('0x11')]()]+'],\x20getUser\x20crm',_0x2c13b9);_0xad6edf(_0x2c13b9);})['catch'](function(_0x451f19){logger['error']('['+[_0x3ef243[_0x2da3('0x11')]()]+']',_0x451f19[_0x2da3('0x15')]);_0x24be56(_0x451f19[_0x2da3('0x15')]);});}else{logger['info']('['+[_0x3ef243[_0x2da3('0x11')]()]+_0x2da3('0x21'));_0x2c13b9['userId']=_0x2c13b9[_0x2da3('0xf')];_0x2c13b9[_0x2da3('0x18')]=_0x2c13b9[_0x2da3('0x20')];_0xad6edf(_0x2c13b9);}});};}function createEndUser(_0x3162a3,_0x1f8a7e,_0x14a128,_0x15b4ef,_0x415cb8){logger[_0x2da3('0x10')]('['+[_0x3162a3[_0x2da3('0x11')]()]+_0x2da3('0x22'),_0x14a128);return new Promise(function(_0x2182cd,_0x188d75){var _0x495e0e={'method':_0x2da3('0x23'),'uri':_0x15b4ef+_0x2da3('0x24')+_0x415cb8,'body':{'user_name':_0x14a128[_0x2da3('0x25')],'roles':_0x2da3('0x26'),'first_name':_0x14a128['endUserNumber'],'active':_0x2da3('0x1d'),'date_format':_0x2da3('0x27'),'phone':_0x14a128[_0x2da3('0x25')]},'auth':_0x1f8a7e,'json':!![]};return rp(_0x495e0e)[_0x2da3('0x1c')](function(_0x288890){logger['info']('['+[_0x3162a3[_0x2da3('0x11')]()]+_0x2da3('0x28'),_0x288890['result']);_0x14a128['endUserId']=_0x288890[_0x2da3('0xd')][_0x2da3('0x1f')];_0x2182cd(_0x14a128);})[_0x2da3('0x13')](function(_0x127688){logger[_0x2da3('0x14')]('['+[_0x3162a3[_0x2da3('0x11')]()]+']',_0x127688['message']);_0x188d75(_0x127688['message']);});});}function getEndUser(_0xb47c03,_0x3572df,_0x4637d2,_0x4e8493,_0x37be44){return function(_0x20cf07){logger[_0x2da3('0x10')]('['+[_0xb47c03[_0x2da3('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x20cf07);return new Promise(function(_0x58e94c,_0x3f61ab){var _0x1bf78f={'method':_0x2da3('0x19'),'uri':_0x4637d2+_0x2da3('0x29')+_0x20cf07['endUserNumber']+'&'+_0x4e8493+'&'+_0x37be44,'auth':_0x3572df,'json':!![]};return rp(_0x1bf78f)['then'](function(_0x55a7df){if(_0x55a7df['result'][_0x2da3('0xe')]>0x0){_0x20cf07[_0x2da3('0x2a')]=_0x55a7df[_0x2da3('0xd')][0x0][_0x2da3('0x1f')];logger[_0x2da3('0x10')]('['+[_0xb47c03[_0x2da3('0x11')]()]+_0x2da3('0x2b'),_0x20cf07);_0x58e94c(_0x20cf07);}else{return createEndUser(_0xb47c03,_0x3572df,_0x20cf07,_0x4637d2,_0x4e8493)[_0x2da3('0x1c')](function(_0x1c9093){logger[_0x2da3('0x10')]('['+[_0xb47c03[_0x2da3('0x11')]()]+_0x2da3('0x2c'),_0x1c9093);_0x58e94c(_0x1c9093);});}})['catch'](function(_0x50f506){logger[_0x2da3('0x14')]('['+[_0xb47c03[_0x2da3('0x11')]()]+']',_0x50f506[_0x2da3('0x15')]);_0x3f61ab(_0x50f506['message']);});});};}function getCustomFields(_0x440517,_0x50c689){var _0x22f3ff={};if(_0x440517[_0x2da3('0xe')]>0x0){_['forEach'](_0x440517,function(_0x171d3a){if(_[_0x2da3('0x2d')]([_0x2da3('0x2e'),_0x2da3('0x2f')],_0x171d3a['type'])&&_0x171d3a[_0x2da3('0x30')]&&!_0x171d3a['customField']){_0x22f3ff[_0x171d3a[_0x2da3('0x30')][_0x2da3('0x31')]()]=_0x171d3a['content'][_0x2da3('0x32')]();}else if(_['includes'](['string',_0x2da3('0x2f')],_0x171d3a[_0x2da3('0x33')])&&_0x171d3a['idField']&&_0x171d3a[_0x2da3('0x34')]){_0x22f3ff[_0x171d3a[_0x2da3('0x35')][_0x2da3('0x31')]()]=_0x171d3a[_0x2da3('0x36')][_0x2da3('0x32')]();}else if(_0x171d3a[_0x2da3('0x33')]==='variable'&&_0x171d3a[_0x2da3('0x37')]&&_0x171d3a['idField']&&_0x171d3a[_0x2da3('0x34')]){_0x22f3ff[_0x171d3a[_0x2da3('0x35')]['toLowerCase']()]=_0x50c689[_0x171d3a[_0x2da3('0x37')]][_0x2da3('0x32')]();}else if(_0x171d3a[_0x2da3('0x33')]===_0x2da3('0x38')&&_0x171d3a[_0x2da3('0x39')]&&_0x171d3a[_0x2da3('0x39')][_0x2da3('0x3a')]&&_0x171d3a[_0x2da3('0x35')]&&_0x171d3a[_0x2da3('0x34')]){_0x22f3ff[_0x171d3a[_0x2da3('0x35')][_0x2da3('0x31')]()]=_0x50c689[_0x171d3a[_0x2da3('0x39')][_0x2da3('0x3a')][_0x2da3('0x31')]()][_0x2da3('0x32')]();}});}return _0x22f3ff;}function getTicket(_0x1f82ae,_0x231ddd,_0x4300eb,_0x8278b1,_0x1447cd,_0x5ab53b){return function(_0x43832f){logger[_0x2da3('0x10')]('['+[_0x1f82ae[_0x2da3('0x11')]()]+_0x2da3('0x3b'),_0x43832f);return new Promise(function(_0x2534be,_0xc97873){var _0x2ec58d=_0x1f82ae[_0x2da3('0x31')]()===_0x2da3('0x3c')?_0x43832f[_0x2da3('0x1e')]:_0x43832f[_0x2da3('0x2a')];var _0x565f65={'method':_0x2da3('0x23'),'uri':_0x4300eb+_0x2da3('0x3d')+'?'+_0x5ab53b,'body':Object[_0x2da3('0x3e')]({},{'active':_0x2da3('0x1d'),'caller_id':_0x2ec58d,'assigned_to':_0x43832f[_0x2da3('0x1e')],'short_description':intUtil[_0x2da3('0x3f')](_0x8278b1[_0x2da3('0x40')],_0x1447cd,'\x20'),'description':intUtil[_0x2da3('0x3f')](_0x8278b1[_0x2da3('0x41')],_0x1447cd,'\x0a')},getCustomFields(_0x8278b1[_0x2da3('0x42')],_0x1447cd)),'auth':_0x231ddd,'json':!![]};return rp(_0x565f65)[_0x2da3('0x1c')](function(_0x3f08cc){logger[_0x2da3('0x10')]('['+[_0x1f82ae[_0x2da3('0x11')]()]+_0x2da3('0x43'),_0x3f08cc[_0x2da3('0xd')]);_0x43832f[_0x2da3('0x44')]=_0x3f08cc[_0x2da3('0xd')]['sys_id'];_0x43832f['ticketNumber']=_0x3f08cc['result'][_0x2da3('0x45')];logger[_0x2da3('0x10')]('['+[_0x1f82ae['toUpperCase']()]+_0x2da3('0x46'),_0x43832f);_0x2534be(_0x43832f);})['catch'](function(_0x3d63b1){logger[_0x2da3('0x14')]('['+[_0x1f82ae[_0x2da3('0x11')]()]+']',_0x3d63b1[_0x2da3('0x15')]);_0xc97873(_0x3d63b1[_0x2da3('0x15')]);});});};}function createRemoteTag(_0x4adea3,_0x57e130,_0x22e4f7,_0x56b030){return new Promise(function(_0x31977b,_0xe804f){var _0x165f6f={'method':_0x2da3('0x23'),'uri':_0x22e4f7+_0x2da3('0x47')+'?'+_0x56b030,'body':{'short_description':_0x4adea3,'global':!![],'active':!![],'name':_0x4adea3},'auth':_0x57e130,'json':!![]};return rp(_0x165f6f)[_0x2da3('0x1c')](function(_0xbe1906){var _0x1dc521=_0xbe1906[_0x2da3('0xd')][_0x2da3('0x1f')];_0x31977b(_0x1dc521);});});}function getRemoteTag(_0x25bb02,_0xb8ead8,_0x250f16,_0xb03050,_0x55b280){return new Promise(function(_0x4f0e99,_0x5f154d){var _0x3391be={'method':_0x2da3('0x19'),'uri':_0x250f16+_0x2da3('0x47')+_0x2da3('0x48')+_0x25bb02+'&'+_0xb03050,'auth':_0xb8ead8,'json':!![]};return rp(_0x3391be)['then'](function(_0x2fbd24){if(_0x2fbd24[_0x2da3('0xd')][_0x2da3('0xe')]>0x0){var _0x1d50ad=_0x2fbd24['result'][0x0]['sys_id'];_0x4f0e99(_0x1d50ad);}else{return createRemoteTag(_0x25bb02,_0xb8ead8,_0x250f16,_0xb03050)['then'](function(_0x22a4ca){_0x4f0e99(_0x22a4ca);});}});});}function assignTagToIncident(_0x2707b9,_0x2a44d2,_0x23deee,_0xc11170,_0x350f05){return new Promise(function(_0x12f4f7,_0x1599fb){var _0x356164={'method':'POST','uri':_0x23deee+_0x2da3('0x49')+'?'+_0x350f05,'body':{'label':_0x2707b9,'table':'incident','id_type':_0x2da3('0x4a'),'table_key':_0xc11170['ticketId'],'title':_0x2da3('0x4b')+_0xc11170['ticketNumber'],'id_display':_0xc11170['ticketNumber']},'auth':_0x2a44d2,'json':!![]};return rp(_0x356164)[_0x2da3('0x1c')](function(_0x5546cf){_0x12f4f7();})['catch'](function(){_0x12f4f7();});});}function manageTags(_0x7e2513,_0x625197,_0x2139d2,_0xf2cc07,_0x190979,_0x344ae9,_0x1ad133){return new Promise(function(_0xf7958d,_0x2cf489){var _0x2ae7cd=[];_0x625197[_0x2da3('0x4c')](function(_0x280ede){_0x2ae7cd[_0x2da3('0x4d')](getRemoteTag(_0x280ede,_0x2139d2,_0xf2cc07,_0x344ae9,_0x1ad133));});return Promise[_0x2da3('0x4e')](_0x2ae7cd)[_0x2da3('0x1c')](function(_0x2a7459){if(_0x2a7459[_0x2da3('0xe')]){logger[_0x2da3('0x10')]('['+[_0x7e2513['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x2a7459);var _0x44ec43=[];_0x2a7459[_0x2da3('0x4c')](function(_0xcfe19){_0x44ec43[_0x2da3('0x4d')](assignTagToIncident(_0xcfe19,_0x2139d2,_0xf2cc07,_0x190979,_0x344ae9));});return Promise[_0x2da3('0x4e')](_0x44ec43)['then'](function(){_0xf7958d();})['catch'](function(){_0xf7958d();});}else{_0xf7958d();}});});}function getTags(_0x2e72ed,_0x5c9318,_0x5b1059,_0xe775fe,_0xf62147,_0x3f77ef){return function(_0x57fc21){return new Promise(function(_0xa07c3,_0xa7bbd1){var _0x8ff72a=[];var _0x5a597a=_0xe775fe[_0x2da3('0x4f')];if(_0x5a597a&&_0x5a597a[_0x2da3('0xe')]>0x0){_0x8ff72a=_[_0x2da3('0x50')](_0x5a597a,_0x2da3('0x3a'));}if(_0x8ff72a[_0x2da3('0xe')]>0x0){return manageTags(_0x2e72ed,_0x8ff72a,_0x5c9318,_0x5b1059,_0x57fc21,_0xf62147,_0x3f77ef)[_0x2da3('0x1c')](function(){_0xa07c3(_0x57fc21);});}else{_0xa07c3(_0x57fc21);}});};}function emit(_0x2b6132,_0x2402bb,_0x4f3923){var _0x4d5925=_0x2da3('0x51')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x2da3('0x52')+_0x2da3('0x53');var _0x32db11={'uri':_0x2b6132+_0x2da3('0x54')+_0x4f3923+_0x4d5925};io['to'](util[_0x2da3('0x55')](_0x2da3('0x56'),_0x2402bb))[_0x2da3('0x57')](_0x2da3('0x58'),_0x32db11);}exports['cs']=function(_0x4438ff,_0x57da01,_0xc46704,_0x10c2aa,_0x396918,_0x44552,_0x2dee57,_0x407a9b){var _0x814d7a={};var _0x49d673={'user':_0x44552[_0x2da3('0x59')],'pass':_0x44552[_0x2da3('0x5a')]};var _0x22a287=_0x2da3('0x5b');var _0x577b5f='sysparm_display_value=true';_0x44552[_0x2da3('0x5c')]=intUtil[_0x2da3('0x5d')](_0x44552[_0x2da3('0x5c')]);_0x44552['serverUrl']=intUtil[_0x2da3('0x5d')](_0x44552['serverUrl']);var _0x14c35e=util['format'](_0x2da3('0x5e'),_0x44552[_0x2da3('0x5c')]);_0x814d7a[_0x2da3('0x18')]=!_[_0x2da3('0x5f')](_0x10c2aa)?_0x10c2aa[_0x2da3('0x60')]:null;_0x814d7a[_0x2da3('0x20')]=_0x44552['email'];_0x814d7a[_0x2da3('0x25')]=_0x407a9b[_0x2da3('0x31')]()===_0x2da3('0x3c')?_0x57da01['destcalleridnum']:_0x57da01[_0x2da3('0x61')];_0x814d7a[_0x2da3('0x62')]=_0x407a9b===_0x2da3('0x63')||_0x407a9b==='unmanaged'?_0x2da3('0x63'):_0x2da3('0x3c');var _0x24789c=util[_0x2da3('0x55')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44552['serverUrl'],_0x57da01[_0x2da3('0x64')],md5(_0x57da01[_0x2da3('0x64')]));if(_0x396918&&_0x396918['monitor_format']){logger[_0x2da3('0x10')](_0x2da3('0x65'),_0x2da3('0x66'));_0x57da01[_0x2da3('0x67')]=_0x24789c;}else if(_0x2dee57&&_0x2dee57[_0x2da3('0x68')]&&_0x2dee57[_0x2da3('0x68')]!==_0x2da3('0x69')){logger['info'](_0x2da3('0x6a'),_0x2da3('0x66'));_0x57da01[_0x2da3('0x67')]=_0x24789c;}else{_0x57da01[_0x2da3('0x67')]='';}return getAdminUser(_0x407a9b,_0x49d673,_0x814d7a,_0x14c35e,_0x577b5f,_0x22a287)['then'](getUser(_0x407a9b,_0x49d673,_0x14c35e,_0x577b5f,_0x22a287))[_0x2da3('0x1c')](getEndUser(_0x407a9b,_0x49d673,_0x14c35e,_0x577b5f,_0x22a287))[_0x2da3('0x1c')](getTicket(_0x407a9b,_0x49d673,_0x14c35e,_0xc46704,_0x57da01,_0x577b5f))[_0x2da3('0x1c')](function(_0x13f908){logger['info'](util[_0x2da3('0x55')](_0x2da3('0x6b'),_0x13f908['ticketId']));logger[_0x2da3('0x10')](util['format'](_0x2da3('0x6c'),_0x407a9b));if(_0x407a9b!==_0x2da3('0x6d')){logger[_0x2da3('0x10')]('['+[_0x407a9b[_0x2da3('0x11')]()]+']',_0x2da3('0x6e'));emit(_0x44552[_0x2da3('0x5c')],_0x10c2aa[_0x2da3('0x3a')],_0x13f908[_0x2da3('0x44')]);}})[_0x2da3('0x13')](function(_0x54cecb){logger['error']('['+[_0x407a9b[_0x2da3('0x11')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x2da3('0x6f')](_0x54cecb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2870=['uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','defaults','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','sys_id','catch','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','length','forEach','string','picklist','type','nameField','customField','toLowerCase','content','toString','includes','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Fields','ticketNumber','number','label','label_entry','Incident','ticketId','Incident\x20-\x20','push','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0x2870,0x14d));var _0x0287=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x2870[_0x1602ef];return _0x5870ee;};'use strict';var _=require(_0x0287('0x0'));var Promise=require(_0x0287('0x1'));var rp=require(_0x0287('0x2'));var util=require(_0x0287('0x3'));var md5=require(_0x0287('0x4'));var Redis=require(_0x0287('0x5'));var intUtil=require(_0x0287('0x6'));var config=require(_0x0287('0x7'));var logger=require('../../../../config/logger')(_0x0287('0x8'));config['redis']=_[_0x0287('0x9')](config[_0x0287('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x210ed7,_0x535a76,_0x38c908,_0x41cd4d,_0x2b580c,_0x2c022c){return new Promise(function(_0x5554fb,_0x5bec19){var _0x2884e4={'method':_0x0287('0xb'),'uri':_0x41cd4d+_0x0287('0xc')+'&'+_0x2b580c+'&'+_0x2c022c,'auth':_0x535a76,'json':!![]};return rp(_0x2884e4)[_0x0287('0xd')](function(_0x1666ec){if(_0x1666ec[_0x0287('0xe')]['length']>0x0){_0x38c908[_0x0287('0xf')]=_0x1666ec['result'][0x0]['sys_id'];}logger[_0x0287('0x10')]('['+[_0x210ed7[_0x0287('0x11')]()]+_0x0287('0x12'),_0x38c908);_0x5554fb(_0x38c908);})['catch'](function(_0x449ae8){logger[_0x0287('0x13')]('['+[_0x210ed7[_0x0287('0x11')]()]+']',_0x449ae8[_0x0287('0x14')]);_0x5bec19(_0x449ae8['message']);});});}function getUser(_0x1e6457,_0x1a204c,_0x308f56,_0x3f5280,_0x1a0cbd){return function(_0x28777d){logger[_0x0287('0x10')]('['+[_0x1e6457['toUpperCase']()]+_0x0287('0x15'),_0x28777d);return new Promise(function(_0x2c6cac,_0x4b4a1d){if(intUtil[_0x0287('0x16')](_0x28777d[_0x0287('0x17')])){var _0x27d24={'method':_0x0287('0xb'),'uri':_0x308f56+'sys_user?sysparm_query=email%3D'+_0x28777d[_0x0287('0x17')]+'&'+_0x3f5280+'&'+_0x1a0cbd,'auth':_0x1a204c,'json':!![]};logger[_0x0287('0x10')]('['+[_0x1e6457[_0x0287('0x11')]()]+_0x0287('0x18'),_0x27d24);return rp(_0x27d24)[_0x0287('0xd')](function(_0x46a4da){logger[_0x0287('0x10')]('['+[_0x1e6457[_0x0287('0x11')]()]+_0x0287('0x19'),_0x46a4da);if(_0x46a4da['result']['length']>0x0&&String(_0x46a4da[_0x0287('0xe')][0x0][_0x0287('0x1a')])===_0x0287('0x1b')){_0x28777d['userId']=_0x46a4da[_0x0287('0xe')][0x0][_0x0287('0x1c')];}else{_0x28777d['userId']=_0x28777d[_0x0287('0xf')];_0x28777d['userEmail']=_0x28777d['adminEmail'];}logger[_0x0287('0x10')]('['+[_0x1e6457[_0x0287('0x11')]()]+'],\x20getUser\x20crm',_0x28777d);_0x2c6cac(_0x28777d);})[_0x0287('0x1d')](function(_0x1f6cd7){logger['error']('['+[_0x1e6457[_0x0287('0x11')]()]+']',_0x1f6cd7[_0x0287('0x14')]);_0x4b4a1d(_0x1f6cd7[_0x0287('0x14')]);});}else{logger[_0x0287('0x10')]('['+[_0x1e6457[_0x0287('0x11')]()]+']\x20using\x20admin\x20profile');_0x28777d[_0x0287('0x1e')]=_0x28777d[_0x0287('0xf')];_0x28777d['userEmail']=_0x28777d[_0x0287('0x1f')];_0x2c6cac(_0x28777d);}});};}function createEndUser(_0x2722d5,_0xe6b5d5,_0x4c437c,_0x46f1e8,_0xdcffb9){logger[_0x0287('0x10')]('['+[_0x2722d5[_0x0287('0x11')]()]+_0x0287('0x20'),_0x4c437c);return new Promise(function(_0x8f537c,_0x19a2ee){var _0x3c219b={'method':_0x0287('0x21'),'uri':_0x46f1e8+_0x0287('0x22')+_0xdcffb9,'body':{'user_name':_0x4c437c['endUserNumber'],'roles':'user','first_name':_0x4c437c[_0x0287('0x23')],'active':_0x0287('0x1b'),'date_format':'System','phone':_0x4c437c['endUserNumber']},'auth':_0xe6b5d5,'json':!![]};return rp(_0x3c219b)['then'](function(_0x2c6555){logger['info']('['+[_0x2722d5[_0x0287('0x11')]()]+_0x0287('0x24'),_0x2c6555[_0x0287('0xe')]);_0x4c437c[_0x0287('0x25')]=_0x2c6555[_0x0287('0xe')]['sys_id'];_0x8f537c(_0x4c437c);})[_0x0287('0x1d')](function(_0x4ae2bc){logger[_0x0287('0x13')]('['+[_0x2722d5[_0x0287('0x11')]()]+']',_0x4ae2bc[_0x0287('0x14')]);_0x19a2ee(_0x4ae2bc[_0x0287('0x14')]);});});}function getEndUser(_0x1fef5a,_0x533859,_0xa4fc6a,_0x40c957,_0x237747){return function(_0x3df7ac){logger[_0x0287('0x10')]('['+[_0x1fef5a[_0x0287('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x3df7ac);return new Promise(function(_0x1ca9cf,_0x355408){var _0x486ad9={'method':'GET','uri':_0xa4fc6a+_0x0287('0x26')+_0x3df7ac[_0x0287('0x23')]+'&'+_0x40c957+'&'+_0x237747,'auth':_0x533859,'json':!![]};return rp(_0x486ad9)[_0x0287('0xd')](function(_0xdb2702){if(_0xdb2702[_0x0287('0xe')][_0x0287('0x27')]>0x0){_0x3df7ac['endUserId']=_0xdb2702[_0x0287('0xe')][0x0][_0x0287('0x1c')];logger[_0x0287('0x10')]('['+[_0x1fef5a[_0x0287('0x11')]()]+'],\x20getEndUser\x20crm',_0x3df7ac);_0x1ca9cf(_0x3df7ac);}else{return createEndUser(_0x1fef5a,_0x533859,_0x3df7ac,_0xa4fc6a,_0x40c957)[_0x0287('0xd')](function(_0x568486){logger[_0x0287('0x10')]('['+[_0x1fef5a['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x568486);_0x1ca9cf(_0x568486);});}})['catch'](function(_0x55770e){logger[_0x0287('0x13')]('['+[_0x1fef5a[_0x0287('0x11')]()]+']',_0x55770e[_0x0287('0x14')]);_0x355408(_0x55770e[_0x0287('0x14')]);});});};}function getCustomFields(_0x42180c,_0x289465){var _0x3eab6c={};if(_0x42180c[_0x0287('0x27')]>0x0){_[_0x0287('0x28')](_0x42180c,function(_0xd4efad){if(_['includes']([_0x0287('0x29'),_0x0287('0x2a')],_0xd4efad[_0x0287('0x2b')])&&_0xd4efad[_0x0287('0x2c')]&&!_0xd4efad[_0x0287('0x2d')]){_0x3eab6c[_0xd4efad['nameField'][_0x0287('0x2e')]()]=_0xd4efad[_0x0287('0x2f')][_0x0287('0x30')]();}else if(_[_0x0287('0x31')](['string',_0x0287('0x2a')],_0xd4efad['type'])&&_0xd4efad[_0x0287('0x32')]&&_0xd4efad[_0x0287('0x2d')]){_0x3eab6c[_0xd4efad[_0x0287('0x32')][_0x0287('0x2e')]()]=_0xd4efad[_0x0287('0x2f')][_0x0287('0x30')]();}else if(_0xd4efad[_0x0287('0x2b')]===_0x0287('0x33')&&_0xd4efad[_0x0287('0x34')]&&_0xd4efad[_0x0287('0x32')]&&_0xd4efad['customField']){_0x3eab6c[_0xd4efad[_0x0287('0x32')][_0x0287('0x2e')]()]=_0x289465[_0xd4efad[_0x0287('0x34')]]['toString']();}else if(_0xd4efad[_0x0287('0x2b')]===_0x0287('0x35')&&_0xd4efad[_0x0287('0x36')]&&_0xd4efad['Variable'][_0x0287('0x37')]&&_0xd4efad['idField']&&_0xd4efad[_0x0287('0x2d')]){_0x3eab6c[_0xd4efad['idField'][_0x0287('0x2e')]()]=_0x289465[_0xd4efad[_0x0287('0x36')][_0x0287('0x37')]['toLowerCase']()][_0x0287('0x30')]();}});}return _0x3eab6c;}function getTicket(_0x57923d,_0x1111bc,_0x38f303,_0x518d42,_0x314a72,_0x3e9e06){return function(_0x1197b9){logger['info']('['+[_0x57923d[_0x0287('0x11')]()]+_0x0287('0x38'),_0x1197b9);return new Promise(function(_0xdaf139,_0x3c5728){var _0x3ccc52=_0x57923d['toLowerCase']()===_0x0287('0x39')?_0x1197b9['userId']:_0x1197b9['endUserId'];var _0x3f4032={'method':_0x0287('0x21'),'uri':_0x38f303+_0x0287('0x3a')+'?'+_0x3e9e06,'body':Object[_0x0287('0x3b')]({},{'active':_0x0287('0x1b'),'caller_id':_0x3ccc52,'assigned_to':_0x1197b9['userId'],'short_description':intUtil[_0x0287('0x3c')](_0x518d42['Subjects'],_0x314a72,'\x20'),'description':intUtil[_0x0287('0x3c')](_0x518d42['Descriptions'],_0x314a72,'\x0a')},getCustomFields(_0x518d42[_0x0287('0x3d')],_0x314a72)),'auth':_0x1111bc,'json':!![]};return rp(_0x3f4032)[_0x0287('0xd')](function(_0x11694b){logger['info']('['+[_0x57923d[_0x0287('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x11694b[_0x0287('0xe')]);_0x1197b9['ticketId']=_0x11694b[_0x0287('0xe')]['sys_id'];_0x1197b9[_0x0287('0x3e')]=_0x11694b[_0x0287('0xe')][_0x0287('0x3f')];logger[_0x0287('0x10')]('['+[_0x57923d[_0x0287('0x11')]()]+']\x20getTicket\x20crm',_0x1197b9);_0xdaf139(_0x1197b9);})[_0x0287('0x1d')](function(_0x193027){logger[_0x0287('0x13')]('['+[_0x57923d[_0x0287('0x11')]()]+']',_0x193027['message']);_0x3c5728(_0x193027[_0x0287('0x14')]);});});};}function createRemoteTag(_0x2ff315,_0x4937a0,_0x508152,_0x20f90f){return new Promise(function(_0x422f0e,_0x3bcf33){var _0x544159={'method':_0x0287('0x21'),'uri':_0x508152+_0x0287('0x40')+'?'+_0x20f90f,'body':{'short_description':_0x2ff315,'global':!![],'active':!![],'name':_0x2ff315},'auth':_0x4937a0,'json':!![]};return rp(_0x544159)['then'](function(_0x45f109){var _0x5620c3=_0x45f109[_0x0287('0xe')][_0x0287('0x1c')];_0x422f0e(_0x5620c3);});});}function getRemoteTag(_0x1557e9,_0x2dd157,_0x50d515,_0x548757,_0x1f83b3){return new Promise(function(_0x37f4cd,_0x35ba38){var _0x5478fb={'method':_0x0287('0xb'),'uri':_0x50d515+_0x0287('0x40')+'?sysparm_query=name%3D'+_0x1557e9+'&'+_0x548757,'auth':_0x2dd157,'json':!![]};return rp(_0x5478fb)['then'](function(_0x48f17b){if(_0x48f17b[_0x0287('0xe')][_0x0287('0x27')]>0x0){var _0x51704e=_0x48f17b['result'][0x0][_0x0287('0x1c')];_0x37f4cd(_0x51704e);}else{return createRemoteTag(_0x1557e9,_0x2dd157,_0x50d515,_0x548757)[_0x0287('0xd')](function(_0x1694d3){_0x37f4cd(_0x1694d3);});}});});}function assignTagToIncident(_0x277a6e,_0x1ab025,_0x1a0cc8,_0x1432fa,_0x5a2148){return new Promise(function(_0x2e70aa,_0x592bfd){var _0xd51cba={'method':_0x0287('0x21'),'uri':_0x1a0cc8+_0x0287('0x41')+'?'+_0x5a2148,'body':{'label':_0x277a6e,'table':_0x0287('0x3a'),'id_type':_0x0287('0x42'),'table_key':_0x1432fa[_0x0287('0x43')],'title':_0x0287('0x44')+_0x1432fa[_0x0287('0x3e')],'id_display':_0x1432fa[_0x0287('0x3e')]},'auth':_0x1ab025,'json':!![]};return rp(_0xd51cba)[_0x0287('0xd')](function(_0x14c5bc){_0x2e70aa();})[_0x0287('0x1d')](function(){_0x2e70aa();});});}function manageTags(_0x1cacd9,_0x161403,_0xe97ff3,_0x11f20c,_0x459ddb,_0x4dea1f,_0x2a7da6){return new Promise(function(_0x296234,_0x4a4c75){var _0xc2d02b=[];_0x161403['forEach'](function(_0x1da2cf){_0xc2d02b[_0x0287('0x45')](getRemoteTag(_0x1da2cf,_0xe97ff3,_0x11f20c,_0x4dea1f,_0x2a7da6));});return Promise[_0x0287('0x46')](_0xc2d02b)[_0x0287('0xd')](function(_0x869226){if(_0x869226[_0x0287('0x27')]){logger[_0x0287('0x10')]('['+[_0x1cacd9['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x869226);var _0x517e70=[];_0x869226[_0x0287('0x28')](function(_0x3eb2f4){_0x517e70[_0x0287('0x45')](assignTagToIncident(_0x3eb2f4,_0xe97ff3,_0x11f20c,_0x459ddb,_0x4dea1f));});return Promise[_0x0287('0x46')](_0x517e70)[_0x0287('0xd')](function(){_0x296234();})['catch'](function(){_0x296234();});}else{_0x296234();}});});}function getTags(_0x1fd4fe,_0x381cd9,_0x13d62b,_0x1b79fb,_0x46dd05,_0x2bda9a){return function(_0x4acefe){return new Promise(function(_0x4d33f0,_0x28fd42){var _0x5ef8b9=[];var _0x22e731=_0x1b79fb['Tags'];if(_0x22e731&&_0x22e731['length']>0x0){_0x5ef8b9=_[_0x0287('0x47')](_0x22e731,'name');}if(_0x5ef8b9[_0x0287('0x27')]>0x0){return manageTags(_0x1fd4fe,_0x5ef8b9,_0x381cd9,_0x13d62b,_0x4acefe,_0x46dd05,_0x2bda9a)[_0x0287('0xd')](function(){_0x4d33f0(_0x4acefe);});}else{_0x4d33f0(_0x4acefe);}});};}function emit(_0x3ff702,_0x497b36,_0x471a99){var _0x11f1bf=_0x0287('0x48')+_0x0287('0x49')+_0x0287('0x4a')+_0x0287('0x4b');var _0xd25e99={'uri':_0x3ff702+_0x0287('0x4c')+_0x471a99+_0x11f1bf};io['to'](util[_0x0287('0x4d')](_0x0287('0x4e'),_0x497b36))[_0x0287('0x4f')](_0x0287('0x50'),_0xd25e99);}exports['cs']=function(_0x5eb743,_0x34785c,_0x3f0efa,_0x52e616,_0x329b35,_0x4be274,_0x3b1fcb,_0x4305a2){var _0x3cc4b9={};var _0x44f695={'user':_0x4be274[_0x0287('0x51')],'pass':_0x4be274[_0x0287('0x52')]};var _0x5064b1=_0x0287('0x53');var _0x3d9138=_0x0287('0x54');_0x4be274['remoteUri']=intUtil[_0x0287('0x55')](_0x4be274[_0x0287('0x56')]);_0x4be274['serverUrl']=intUtil[_0x0287('0x55')](_0x4be274['serverUrl']);var _0xd98bb9=util['format'](_0x0287('0x57'),_0x4be274[_0x0287('0x56')]);_0x3cc4b9[_0x0287('0x17')]=!_['isNil'](_0x52e616)?_0x52e616[_0x0287('0x58')]:null;_0x3cc4b9[_0x0287('0x1f')]=_0x4be274[_0x0287('0x58')];_0x3cc4b9['endUserNumber']=_0x4305a2[_0x0287('0x2e')]()===_0x0287('0x39')?_0x34785c[_0x0287('0x59')]:_0x34785c[_0x0287('0x5a')];_0x3cc4b9[_0x0287('0x5b')]=_0x4305a2===_0x0287('0x5c')||_0x4305a2==='unmanaged'?_0x0287('0x5c'):_0x0287('0x39');var _0x497e0e=util['format'](_0x0287('0x5d'),_0x4be274[_0x0287('0x5e')],_0x34785c[_0x0287('0x5f')],md5(_0x34785c['uniqueid']));if(_0x329b35&&_0x329b35[_0x0287('0x60')]){logger[_0x0287('0x10')]('[QUEUE]','Recording\x20is\x20enabled!');_0x34785c[_0x0287('0x61')]=_0x497e0e;}else if(_0x3b1fcb&&_0x3b1fcb['recordingFormat']&&_0x3b1fcb[_0x0287('0x62')]!==_0x0287('0x63')){logger['info'](_0x0287('0x64'),_0x0287('0x65'));_0x34785c[_0x0287('0x61')]=_0x497e0e;}else{_0x34785c['recordingURL']='';}return getAdminUser(_0x4305a2,_0x44f695,_0x3cc4b9,_0xd98bb9,_0x3d9138,_0x5064b1)[_0x0287('0xd')](getUser(_0x4305a2,_0x44f695,_0xd98bb9,_0x3d9138,_0x5064b1))[_0x0287('0xd')](getEndUser(_0x4305a2,_0x44f695,_0xd98bb9,_0x3d9138,_0x5064b1))[_0x0287('0xd')](getTicket(_0x4305a2,_0x44f695,_0xd98bb9,_0x3f0efa,_0x34785c,_0x3d9138))[_0x0287('0xd')](function(_0xe87471){logger[_0x0287('0x10')](util[_0x0287('0x4d')](_0x0287('0x66'),_0xe87471[_0x0287('0x43')]));logger['info'](util[_0x0287('0x4d')](_0x0287('0x67'),_0x4305a2));if(_0x4305a2!==_0x0287('0x68')){logger[_0x0287('0x10')]('['+[_0x4305a2[_0x0287('0x11')]()]+']',_0x0287('0x69'));emit(_0x4be274['remoteUri'],_0x52e616[_0x0287('0x37')],_0xe87471[_0x0287('0x43')]);}})['catch'](function(_0x93c68f){logger[_0x0287('0x13')]('['+[_0x4305a2[_0x0287('0x11')]()]+_0x0287('0x6a'),util['inspect'](_0x93c68f,{'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 b482273..e446c91 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 _0xcb68=['info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string','nameField','content','toString','customField','custom_fields','customVariable','Variable','toLowerCase','login','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','stripTrailingSlash','uri','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','charAt','user:%s','lastevent','Ticket\x20created!','toUpperCase','lodash','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit'];(function(_0x4f87b6,_0x2f0953){var _0x52ba7c=function(_0x5da29e){while(--_0x5da29e){_0x4f87b6['push'](_0x4f87b6['shift']());}};_0x52ba7c(++_0x2f0953);}(_0xcb68,0x165));var _0x8cb6=function(_0xbc3f48,_0x58e0ba){_0xbc3f48=_0xbc3f48-0x0;var _0x51a17b=_0xcb68[_0xbc3f48];return _0x51a17b;};'use strict';var _=require(_0x8cb6('0x0'));var rp=require('request-promise');var BPromise=require(_0x8cb6('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x8cb6('0x2'));var intUtil=require(_0x8cb6('0x3'));var config=require(_0x8cb6('0x4'));var logger=require(_0x8cb6('0x5'))(_0x8cb6('0x6'));config[_0x8cb6('0x7')]=_[_0x8cb6('0x8')](config[_0x8cb6('0x7')],{'host':_0x8cb6('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8cb6('0x7')]));var def={'method':_0x8cb6('0xa'),'json':!![]};function emit(_0x553641,_0x53915e,_0x31be94){io['to'](_0x553641)[_0x8cb6('0xb')](_0x53915e,_0x31be94);}function getTicket(_0x52c41e,_0x4ac1d3,_0x4a5f61,_0x53b694,_0x25cf2e,_0x134979,_0xeee307,_0x20988f){logger[_0x8cb6('0xc')](_0x8cb6('0xd'));var _0x166ce7=new Date();var _0x404db5=[{'name':_0x8cb6('0xe'),'value':intUtil[_0x8cb6('0xf')](_0x53b694[_0x8cb6('0x10')],_0x25cf2e,'\x20')},{'name':_0x8cb6('0x11'),'value':_0x4ac1d3['id']},{'name':_0x8cb6('0x12'),'value':_0x4ac1d3['id']},{'name':'description','value':intUtil['getString'](_0x53b694[_0x8cb6('0x13')],_0x25cf2e,'\x0a')},{'name':'date_start','value':_0x166ce7[_0x8cb6('0x14')]()['slice'](0x0,0x13)[_0x8cb6('0x15')]('T','\x20')},{'name':_0x8cb6('0x16'),'value':'0'},{'name':_0x8cb6('0x17'),'value':'15'},{'name':_0x8cb6('0x18'),'value':_0x4a5f61['id']},{'name':_0x8cb6('0x19'),'value':'Contacts'},{'name':'parent_name','value':_0x4a5f61[_0x8cb6('0xe')]},{'name':'direction','value':_0x20988f}];if(_0x134979[_0x8cb6('0x1a')]){_[_0x8cb6('0x1b')](_0x134979,function(_0x513788){if(_0x25cf2e[_0x513788[_0x8cb6('0x1c')]]){_0x404db5[_0x8cb6('0x1d')]({'name':_0x513788[_0x8cb6('0x1e')],'value':_0x25cf2e[_0x513788['variableName']]});}});}return request({'form':{'method':_0x8cb6('0x1f'),'input_type':_0x8cb6('0x20'),'response_type':_0x8cb6('0x20'),'rest_data':JSON[_0x8cb6('0x21')]({'session':_0xeee307['id'],'module_name':_0x8cb6('0x22'),'name_value_list':_0x404db5})}});}function getAuth(_0x456a64){return util[_0x8cb6('0x23')](_0x8cb6('0x24'),new Buffer(_0x456a64['apiKey']+':X')['toString'](_0x8cb6('0x25')));}function getServerInfo(_0x59510c){return request({'form':{'method':_0x8cb6('0x26'),'input_type':'JSON','response_type':_0x8cb6('0x20'),'rest_data':JSON[_0x8cb6('0x21')]({'session':_0x59510c['id']})}});}function getUser(_0x6a788f,_0x2149d3,_0x9b17ab){if(!_[_0x8cb6('0x27')](_0x2149d3)){logger[_0x8cb6('0xc')](_0x8cb6('0x28'),_0x2149d3);return request({'form':{'method':'get_entry_list','input_type':_0x8cb6('0x20'),'response_type':'JSON','rest_data':JSON[_0x8cb6('0x21')]({'session':_0x9b17ab['id'],'module_name':_0x8cb6('0x29'),'query':util[_0x8cb6('0x23')](_0x8cb6('0x2a'),_0x2149d3),'order_by':'','offset':'0','select_fields':['id',_0x8cb6('0xe'),_0x8cb6('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8cb6('0x2c')](function(_0x309eab){if(_0x309eab['entry_list'][_0x8cb6('0x1a')]){var _0xd0d191=_[_0x8cb6('0x2d')](_0x309eab[_0x8cb6('0x2e')],function(_0x11eb53){return _0x11eb53[_0x8cb6('0x2f')][_0x8cb6('0x2b')][_0x8cb6('0x30')]===_0x2149d3;});if(_0xd0d191){logger['info'](_0x8cb6('0x31'));return BPromise[_0x8cb6('0x32')]({'id':_0xd0d191['name_value_list']['id']['value'],'name':_0xd0d191[_0x8cb6('0x2f')]['name'][_0x8cb6('0x30')]});}}logger[_0x8cb6('0xc')](_0x8cb6('0x33'));return BPromise[_0x8cb6('0x32')]({'id':_0x9b17ab[_0x8cb6('0x2f')]['user_id'][_0x8cb6('0x30')],'name':_0x9b17ab[_0x8cb6('0x2f')][_0x8cb6('0x2b')]['value']});});}else{logger[_0x8cb6('0xc')](_0x8cb6('0x34'));return BPromise[_0x8cb6('0x32')]({'id':_0x9b17ab[_0x8cb6('0x2f')][_0x8cb6('0x35')]['value'],'name':_0x9b17ab[_0x8cb6('0x2f')][_0x8cb6('0x2b')][_0x8cb6('0x30')]});}}function getEndUser(_0x191ab7,_0x109961,_0x32b693,_0x2225b8){logger[_0x8cb6('0xc')](_0x8cb6('0x36'),_0x32b693);return request({'form':{'method':_0x8cb6('0x37'),'input_type':'JSON','response_type':_0x8cb6('0x20'),'rest_data':JSON[_0x8cb6('0x21')]({'session':_0x2225b8['id'],'module_name':_0x8cb6('0x38'),'query':util[_0x8cb6('0x23')](_0x8cb6('0x39'),_0x32b693),'order_by':'','offset':'0','select_fields':['id',_0x8cb6('0xe'),_0x8cb6('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8cb6('0x2c')](function(_0x527f08){if(_0x527f08[_0x8cb6('0x2e')]['length']){var _0x6a86c5=_[_0x8cb6('0x2d')](_0x527f08['entry_list'],function(_0x2ac31f){return _0x2ac31f['name_value_list'][_0x8cb6('0x3a')][_0x8cb6('0x30')]===_0x32b693;});if(_0x6a86c5){logger[_0x8cb6('0xc')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x6a86c5['name_value_list']['id'][_0x8cb6('0x30')],'name':_0x6a86c5[_0x8cb6('0x2f')]['name'][_0x8cb6('0x30')],'phone':_0x6a86c5[_0x8cb6('0x2f')][_0x8cb6('0x3a')]['value']});}}else{logger[_0x8cb6('0xc')](_0x8cb6('0x3b'));return request({'form':{'method':_0x8cb6('0x1f'),'input_type':_0x8cb6('0x20'),'response_type':_0x8cb6('0x20'),'rest_data':JSON[_0x8cb6('0x21')]({'session':_0x2225b8['id'],'module_name':_0x8cb6('0x38'),'name_value_list':[{'name':_0x8cb6('0x3c'),'value':_0x109961!==_0x8cb6('0x3d')?_0x109961:util[_0x8cb6('0x23')](_0x8cb6('0x3e'),_0x32b693)},{'name':'phone_home','value':_0x32b693}]})}})[_0x8cb6('0x2c')](function(_0x374d46){logger['info'](_0x8cb6('0x3f'));return BPromise[_0x8cb6('0x32')]({'id':_0x374d46['id'],'name':_0x374d46[_0x8cb6('0x2e')][_0x8cb6('0x3c')][_0x8cb6('0x30')],'phone':_0x374d46[_0x8cb6('0x2e')][_0x8cb6('0x3a')][_0x8cb6('0x30')]});});}});}function request(_0x3a5a68){logger[_0x8cb6('0x40')]('[HTTP]',JSON[_0x8cb6('0x21')](_0x3a5a68));return rp(_[_0x8cb6('0x41')](def,_0x3a5a68));}function getTags(_0x5d8ed3,_0x1e032f){var _0x530488=[];if(_0x5d8ed3&&_0x5d8ed3[_0x8cb6('0x1a')]>0x0){_0x530488=_[_0x8cb6('0x42')](_0x5d8ed3,_0x1e032f);}return _0x530488;}function getCustomFields(_0x306b2e,_0xb7b257){var _0xe12312=[];var _0x3b571e={'custom_fields':[]};if(_0x306b2e[_0x8cb6('0x1a')]>0x0){_[_0x8cb6('0x1b')](_0x306b2e,function(_0x4b02d1){if(_0x4b02d1[_0x8cb6('0x43')]===_0x8cb6('0x44')&&_0x4b02d1[_0x8cb6('0x45')]&&!_0x4b02d1['customField']){_0x3b571e[_0x4b02d1[_0x8cb6('0x45')]['toLowerCase']()]=_0x4b02d1[_0x8cb6('0x46')][_0x8cb6('0x47')]();}else if(_0x4b02d1[_0x8cb6('0x43')]===_0x8cb6('0x44')&&_0x4b02d1['idField']&&_0x4b02d1[_0x8cb6('0x48')]){_0x3b571e[_0x8cb6('0x49')][_0x8cb6('0x1d')]({'id':_0x4b02d1[_0x8cb6('0x1e')],'value':_0x4b02d1[_0x8cb6('0x46')]['toString']()});}else if(_0x4b02d1[_0x8cb6('0x43')]==='variable'&&_0x4b02d1[_0x8cb6('0x1c')]&&_0x4b02d1[_0x8cb6('0x1e')]&&_0x4b02d1[_0x8cb6('0x48')]){_0xb7b257[_0x4b02d1[_0x8cb6('0x1c')]]&&_0x3b571e[_0x8cb6('0x49')]['push']({'id':_0x4b02d1['idField'],'value':_0xb7b257[_0x4b02d1['variableName']][_0x8cb6('0x47')]()});}else if(_0x4b02d1[_0x8cb6('0x43')]===_0x8cb6('0x4a')&&_0x4b02d1[_0x8cb6('0x4b')]&&_0x4b02d1['Variable'][_0x8cb6('0xe')]&&_0x4b02d1[_0x8cb6('0x1e')]&&_0x4b02d1[_0x8cb6('0x48')]){_0xb7b257[_0x4b02d1['Variable'][_0x8cb6('0xe')][_0x8cb6('0x4c')]()]&&_0x3b571e[_0x8cb6('0x49')]['push']({'id':_0x4b02d1['idField'],'value':_0xb7b257[_0x4b02d1[_0x8cb6('0x4b')][_0x8cb6('0xe')][_0x8cb6('0x4c')]()][_0x8cb6('0x47')]()});}});}return _0x3b571e;}function getConnection(_0x444c89){return request({'method':_0x8cb6('0xa'),'form':{'method':_0x8cb6('0x4d'),'input_type':_0x8cb6('0x20'),'response_type':_0x8cb6('0x20'),'rest_data':JSON[_0x8cb6('0x21')]({'user_auth':{'user_name':_0x444c89['username'],'password':_0x444c89[_0x8cb6('0x4e')],'encryption':_0x8cb6('0x4f')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x8cb6('0x2c')](function(_0x386420){var _0x2a6438=_0x386420;if(_0x2a6438['id']){def[_0x8cb6('0x50')]=_0x2a6438['id'];return BPromise[_0x8cb6('0x32')](_0x2a6438);}else{throw new Error(util[_0x8cb6('0x23')](_0x8cb6('0x51'),_0x444c89['id']));}});}function setRelationship(_0xa13ef,_0x13b2ac,_0xc5e0fc,_0x33ccc0){return request({'form':{'method':_0x8cb6('0x52'),'input_type':'JSON','response_type':_0x8cb6('0x20'),'rest_data':JSON[_0x8cb6('0x21')]({'session':_0xa13ef['id'],'module_name':_0x8cb6('0x22'),'module_id':_0xc5e0fc['id'],'link_field_name':_0x33ccc0,'related_ids':[_0x13b2ac['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x8cb6('0x53')]=function(_0x2c5311,_0x5a373e,_0x2abf37,_0x3cee65,_0x93bd55,_0x345e7a){var _0x30196c,_0x5ef129,_0xd66130,_0x49eec5;_0x345e7a[_0x8cb6('0x54')]=intUtil['stripTrailingSlash'](_0x345e7a[_0x8cb6('0x54')]);_0x345e7a[_0x8cb6('0x55')]=intUtil['stripTrailingSlash'](_0x345e7a['serverUrl']);def['uri']=util[_0x8cb6('0x23')](_0x8cb6('0x56'),_0x345e7a[_0x8cb6('0x54')]);if(_0x93bd55&&_0x93bd55[_0x8cb6('0x57')]){logger[_0x8cb6('0xc')](_0x8cb6('0x58'),_0x8cb6('0x59'));_0x5a373e[_0x8cb6('0x5a')]=util['format'](_0x8cb6('0x5b'),_0x345e7a[_0x8cb6('0x55')],_0x5a373e[_0x8cb6('0x5c')],md5(_0x5a373e[_0x8cb6('0x5c')]));}else{_0x5a373e['recordingURL']='';}return getConnection(_0x345e7a)[_0x8cb6('0x2c')](function(_0x12f1a4){_0x49eec5=_0x12f1a4;return getUser(_0x345e7a,_0x3cee65['name'],_0x49eec5);})[_0x8cb6('0x2c')](function(_0x2c0004){_0x30196c=_0x2c0004;logger[_0x8cb6('0xc')]('The\x20User\x20ID\x20is:',_0x30196c['id']);return getEndUser(_0x345e7a,_0x5a373e[_0x8cb6('0x5d')],_0x5a373e[_0x8cb6('0x5e')],_0x49eec5);})[_0x8cb6('0x2c')](function(_0x49b836){_0x5ef129=_0x49b836;logger[_0x8cb6('0xc')]('The\x20Enduser\x20ID\x20is:',_0x5ef129['id']);return getTicket(_0x345e7a,_0x30196c,_0x5ef129,_0x2abf37,_0x5a373e,_0x2abf37[_0x8cb6('0x5f')],_0x49eec5,_0x8cb6('0x60'));})['then'](function(_0x2d3043){_0xd66130=_0x2d3043;logger[_0x8cb6('0xc')]('Ticket\x20created!');logger[_0x8cb6('0xc')](_0x8cb6('0x61'),_0xd66130['id']);return setRelationship(_0x49eec5,_0x30196c,_0xd66130,_0x8cb6('0x62'));})[_0x8cb6('0x2c')](function(){return setRelationship(_0x49eec5,_0x5ef129,_0xd66130,_0x8cb6('0x63'));})[_0x8cb6('0x2c')](function(){return getServerInfo(_0x49eec5);})['then'](function(_0x2abe10){var _0x498138=parseInt(_0x2abe10[_0x8cb6('0x64')]['charAt'](0x0));var _0x47c1f7=util['format'](_0x8cb6('0x65'),_0x345e7a[_0x8cb6('0x54')],_0xd66130['id']);if(_0x498138>0x6){_0x47c1f7=util['format'](_0x8cb6('0x66'),_0x345e7a[_0x8cb6('0x54')],_0xd66130['id']);}logger[_0x8cb6('0xc')](_0x8cb6('0x58'),_0x8cb6('0x67'));emit(util[_0x8cb6('0x23')]('user:%s',_0x3cee65[_0x8cb6('0xe')]),_0x8cb6('0x68'),{'uri':_0x47c1f7});})[_0x8cb6('0x69')](function(_0x5e67e9){logger[_0x8cb6('0x6a')](_0x8cb6('0x58'),JSON[_0x8cb6('0x21')](_0x5e67e9));});};exports[_0x8cb6('0x6b')]=function(_0x3ecdb9,_0x2fa3c9,_0x35cfa7,_0x510dc3,_0x1f460c,_0x4c8202,_0x74a2ed){var _0x48642b,_0x11b27b,_0x13ca39,_0x13e6a3;_0x4c8202[_0x8cb6('0x54')]=intUtil[_0x8cb6('0x6c')](_0x4c8202[_0x8cb6('0x54')]);_0x4c8202[_0x8cb6('0x55')]=intUtil[_0x8cb6('0x6c')](_0x4c8202[_0x8cb6('0x55')]);def[_0x8cb6('0x6d')]=util[_0x8cb6('0x23')](_0x8cb6('0x56'),_0x4c8202['remoteUri']);if(_0x74a2ed&&_0x74a2ed[_0x8cb6('0x6e')]&&_0x74a2ed[_0x8cb6('0x6e')]!==_0x8cb6('0x6f')){logger['info'](_0x8cb6('0x70'),_0x8cb6('0x59'));_0x2fa3c9[_0x8cb6('0x5a')]=util[_0x8cb6('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4c8202[_0x8cb6('0x55')],_0x2fa3c9[_0x8cb6('0x5c')],md5(_0x2fa3c9[_0x8cb6('0x5c')]));}return getConnection(_0x4c8202)['then'](function(_0x59d5de){_0x13e6a3=_0x59d5de;return getUser(_0x4c8202,_0x510dc3[_0x8cb6('0xe')],_0x13e6a3);})['then'](function(_0x605ec3){_0x48642b=_0x605ec3;logger['info'](_0x8cb6('0x71'),_0x48642b['id']);return getEndUser(_0x4c8202,_0x2fa3c9[_0x8cb6('0x72')],_0x2fa3c9[_0x8cb6('0x73')],_0x13e6a3);})['then'](function(_0x449e70){_0x11b27b=_0x449e70;logger[_0x8cb6('0xc')](_0x8cb6('0x74'),_0x11b27b['id']);return getTicket(_0x4c8202,_0x48642b,_0x11b27b,_0x35cfa7,_0x2fa3c9,_0x35cfa7[_0x8cb6('0x5f')],_0x13e6a3,_0x8cb6('0x75'));})['then'](function(_0x13c98c){_0x13ca39=_0x13c98c;logger[_0x8cb6('0xc')]('Ticket\x20created!');logger['info'](_0x8cb6('0x61'),_0x13ca39['id']);return setRelationship(_0x13e6a3,_0x48642b,_0x13ca39,'users');})['then'](function(){return setRelationship(_0x13e6a3,_0x11b27b,_0x13ca39,_0x8cb6('0x63'));})['then'](function(){return getServerInfo(_0x13e6a3);})[_0x8cb6('0x2c')](function(_0x48a608){var _0x20ccde=parseInt(_0x48a608[_0x8cb6('0x64')][_0x8cb6('0x76')](0x0));var _0x49d338=util[_0x8cb6('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x4c8202[_0x8cb6('0x54')],_0x13ca39['id']);if(_0x20ccde>0x6){_0x49d338=util['format'](_0x8cb6('0x66'),_0x4c8202['remoteUri'],_0x13ca39['id']);}logger['info'](_0x8cb6('0x70'),_0x8cb6('0x67'));emit(util['format'](_0x8cb6('0x77'),_0x510dc3[_0x8cb6('0xe')]),'trigger:browser:url',{'uri':_0x49d338});})[_0x8cb6('0x69')](function(_0x3c874b){logger[_0x8cb6('0x6a')]('[OUTBOUND]',JSON[_0x8cb6('0x21')](_0x3c874b));});};exports['unmanaged']=function(_0x49847d,_0x133e9e,_0x5dcd37,_0xc35c20,_0x36c332,_0x143ea6){var _0x17405e,_0x4912ca,_0x40c53a,_0x5f395c;_0x143ea6[_0x8cb6('0x54')]=intUtil['stripTrailingSlash'](_0x143ea6[_0x8cb6('0x54')]);_0x143ea6[_0x8cb6('0x55')]=intUtil[_0x8cb6('0x6c')](_0x143ea6[_0x8cb6('0x55')]);def[_0x8cb6('0x6d')]=util[_0x8cb6('0x23')]('%s/service/v4_1/rest.php',_0x143ea6[_0x8cb6('0x54')]);if(_0x36c332&&_0x36c332['monitor_format']){logger[_0x8cb6('0xc')]('['+_0x133e9e[_0x8cb6('0x78')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x133e9e[_0x8cb6('0x5a')]=util[_0x8cb6('0x23')](_0x8cb6('0x5b'),_0x143ea6[_0x8cb6('0x55')],_0x133e9e[_0x8cb6('0x5c')],md5(_0x133e9e[_0x8cb6('0x5c')]));}else{_0x133e9e['recordingURL']='';}return getConnection(_0x143ea6)['then'](function(_0x4cbe5b){_0x5f395c=_0x4cbe5b;if(!_[_0x8cb6('0x27')](_0xc35c20)){return getUser(_0x143ea6,_0xc35c20['name'],_0x5f395c);}else{return getUser(_0x143ea6,null,_0x5f395c);}})[_0x8cb6('0x2c')](function(_0x3ea3b9){_0x17405e=_0x3ea3b9;logger[_0x8cb6('0xc')](_0x8cb6('0x71'),_0x17405e['id']);return getEndUser(_0x143ea6,_0x133e9e[_0x8cb6('0x5d')],_0x133e9e[_0x8cb6('0x5e')],_0x5f395c);})[_0x8cb6('0x2c')](function(_0x3c2095){_0x4912ca=_0x3c2095;logger[_0x8cb6('0xc')](_0x8cb6('0x74'),_0x4912ca['id']);return getTicket(_0x143ea6,_0x17405e,_0x4912ca,_0x5dcd37,_0x133e9e,_0x5dcd37[_0x8cb6('0x5f')],_0x5f395c,_0x8cb6('0x60'));})[_0x8cb6('0x2c')](function(_0x1f6fd6){_0x40c53a=_0x1f6fd6;logger[_0x8cb6('0xc')](_0x8cb6('0x79'));logger[_0x8cb6('0xc')](_0x8cb6('0x61'),_0x40c53a['id']);return setRelationship(_0x5f395c,_0x17405e,_0x40c53a,_0x8cb6('0x62'));})[_0x8cb6('0x2c')](function(){return setRelationship(_0x5f395c,_0x4912ca,_0x40c53a,_0x8cb6('0x63'));})[_0x8cb6('0x2c')](function(){return getServerInfo(_0x5f395c);})[_0x8cb6('0x69')](function(_0x5f31f9){logger[_0x8cb6('0x6a')]('['+_0x133e9e[_0x8cb6('0x78')][_0x8cb6('0x7a')]()+']',JSON[_0x8cb6('0x21')](_0x5f31f9));});}; \ No newline at end of file +var _0x61f2=['uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','destcalleridnum','Outbound','charAt','lastevent','calleridname','Ticket\x20created!','contacts','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','Agent\x20found!','resolve','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Searching\x20enduser\x20with\x20phone','phone_home','find','Enduser\x20found!','','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x5150bf,_0x169928){var _0x20dd71=function(_0x381dc1){while(--_0x381dc1){_0x5150bf['push'](_0x5150bf['shift']());}};_0x20dd71(++_0x169928);}(_0x61f2,0xa2));var _0x261f=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x61f2[_0x166d93];return _0xba708;};'use strict';var _=require(_0x261f('0x0'));var rp=require(_0x261f('0x1'));var BPromise=require(_0x261f('0x2'));var md5=require(_0x261f('0x3'));var util=require('util');var Redis=require(_0x261f('0x4'));var intUtil=require(_0x261f('0x5'));var config=require(_0x261f('0x6'));var logger=require(_0x261f('0x7'))(_0x261f('0x8'));config[_0x261f('0x9')]=_[_0x261f('0xa')](config['redis'],{'host':_0x261f('0xb'),'port':0x18eb});var io=require(_0x261f('0xc'))(new Redis(config['redis']));var def={'method':_0x261f('0xd'),'json':!![]};function emit(_0x93a6a6,_0x1b6a98,_0x1e93df){io['to'](_0x93a6a6)[_0x261f('0xe')](_0x1b6a98,_0x1e93df);}function getTicket(_0x8d9ec7,_0x562153,_0x88d46,_0x23aae1,_0x5c973a,_0x51f08d,_0x1b5515,_0x1dfe2c){logger[_0x261f('0xf')](_0x261f('0x10'));var _0x16d6cd=new Date();var _0x1445b9=[{'name':_0x261f('0x11'),'value':intUtil[_0x261f('0x12')](_0x23aae1[_0x261f('0x13')],_0x5c973a,'\x20')},{'name':_0x261f('0x14'),'value':_0x562153['id']},{'name':_0x261f('0x15'),'value':_0x562153['id']},{'name':'description','value':intUtil['getString'](_0x23aae1[_0x261f('0x16')],_0x5c973a,'\x0a')},{'name':'date_start','value':_0x16d6cd[_0x261f('0x17')]()[_0x261f('0x18')](0x0,0x13)[_0x261f('0x19')]('T','\x20')},{'name':_0x261f('0x1a'),'value':'0'},{'name':_0x261f('0x1b'),'value':'15'},{'name':_0x261f('0x1c'),'value':_0x88d46['id']},{'name':_0x261f('0x1d'),'value':_0x261f('0x1e')},{'name':_0x261f('0x1f'),'value':_0x88d46[_0x261f('0x11')]},{'name':_0x261f('0x20'),'value':_0x1dfe2c}];if(_0x51f08d[_0x261f('0x21')]){_['forEach'](_0x51f08d,function(_0x120369){if(_0x5c973a[_0x120369[_0x261f('0x22')]]){_0x1445b9[_0x261f('0x23')]({'name':_0x120369[_0x261f('0x24')],'value':_0x5c973a[_0x120369['variableName']]});}});}return request({'form':{'method':_0x261f('0x25'),'input_type':_0x261f('0x26'),'response_type':'JSON','rest_data':JSON[_0x261f('0x27')]({'session':_0x1b5515['id'],'module_name':'Calls','name_value_list':_0x1445b9})}});}function getAuth(_0x768eed){return util[_0x261f('0x28')](_0x261f('0x29'),new Buffer(_0x768eed[_0x261f('0x2a')]+':X')[_0x261f('0x2b')](_0x261f('0x2c')));}function getServerInfo(_0x1a0eb3){return request({'form':{'method':'get_server_info','input_type':_0x261f('0x26'),'response_type':_0x261f('0x26'),'rest_data':JSON[_0x261f('0x27')]({'session':_0x1a0eb3['id']})}});}function getUser(_0x5c826b,_0x40ff75,_0x5b84dd){if(!_[_0x261f('0x2d')](_0x40ff75)){logger[_0x261f('0xf')](_0x261f('0x2e'),_0x40ff75);return request({'form':{'method':_0x261f('0x2f'),'input_type':_0x261f('0x26'),'response_type':_0x261f('0x26'),'rest_data':JSON['stringify']({'session':_0x5b84dd['id'],'module_name':_0x261f('0x30'),'query':util[_0x261f('0x28')](_0x261f('0x31'),_0x40ff75),'order_by':'','offset':'0','select_fields':['id',_0x261f('0x11'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x261f('0x32')](function(_0x54fda0){if(_0x54fda0[_0x261f('0x33')]['length']){var _0x7c4b71=_['find'](_0x54fda0[_0x261f('0x33')],function(_0x32109d){return _0x32109d['name_value_list']['user_name']['value']===_0x40ff75;});if(_0x7c4b71){logger[_0x261f('0xf')](_0x261f('0x34'));return BPromise[_0x261f('0x35')]({'id':_0x7c4b71[_0x261f('0x36')]['id'][_0x261f('0x37')],'name':_0x7c4b71[_0x261f('0x36')][_0x261f('0x11')]['value']});}}logger['info'](_0x261f('0x38'));return BPromise['resolve']({'id':_0x5b84dd[_0x261f('0x36')][_0x261f('0x39')]['value'],'name':_0x5b84dd[_0x261f('0x36')][_0x261f('0x3a')][_0x261f('0x37')]});});}else{logger[_0x261f('0xf')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x261f('0x35')]({'id':_0x5b84dd[_0x261f('0x36')][_0x261f('0x39')][_0x261f('0x37')],'name':_0x5b84dd[_0x261f('0x36')][_0x261f('0x3a')][_0x261f('0x37')]});}}function getEndUser(_0x571d49,_0x37a3a0,_0x19bde3,_0x532646){logger[_0x261f('0xf')](_0x261f('0x3b'),_0x19bde3);return request({'form':{'method':_0x261f('0x2f'),'input_type':_0x261f('0x26'),'response_type':_0x261f('0x26'),'rest_data':JSON[_0x261f('0x27')]({'session':_0x532646['id'],'module_name':_0x261f('0x1e'),'query':util[_0x261f('0x28')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x19bde3),'order_by':'','offset':'0','select_fields':['id',_0x261f('0x11'),_0x261f('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x503fd6){if(_0x503fd6[_0x261f('0x33')][_0x261f('0x21')]){var _0x526df2=_[_0x261f('0x3d')](_0x503fd6[_0x261f('0x33')],function(_0x3bf6dc){return _0x3bf6dc[_0x261f('0x36')]['phone_home'][_0x261f('0x37')]===_0x19bde3;});if(_0x526df2){logger[_0x261f('0xf')](_0x261f('0x3e'));return BPromise[_0x261f('0x35')]({'id':_0x526df2[_0x261f('0x36')]['id'][_0x261f('0x37')],'name':_0x526df2[_0x261f('0x36')][_0x261f('0x11')][_0x261f('0x37')],'phone':_0x526df2['name_value_list'][_0x261f('0x3c')][_0x261f('0x37')]});}}else{logger[_0x261f('0xf')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x261f('0x25'),'input_type':_0x261f('0x26'),'response_type':'JSON','rest_data':JSON[_0x261f('0x27')]({'session':_0x532646['id'],'module_name':_0x261f('0x1e'),'name_value_list':[{'name':'first_name','value':_0x37a3a0!==_0x261f('0x3f')?_0x37a3a0:util[_0x261f('0x28')]('Caller\x20-\x20%s',_0x19bde3)},{'name':_0x261f('0x3c'),'value':_0x19bde3}]})}})[_0x261f('0x32')](function(_0x12eb88){logger[_0x261f('0xf')](_0x261f('0x40'));return BPromise[_0x261f('0x35')]({'id':_0x12eb88['id'],'name':_0x12eb88[_0x261f('0x33')][_0x261f('0x41')][_0x261f('0x37')],'phone':_0x12eb88['entry_list'][_0x261f('0x3c')]['value']});});}});}function request(_0x537a95){logger[_0x261f('0x42')](_0x261f('0x43'),JSON[_0x261f('0x27')](_0x537a95));return rp(_[_0x261f('0x44')](def,_0x537a95));}function getTags(_0x21371a,_0x5742cf){var _0x1b7b24=[];if(_0x21371a&&_0x21371a[_0x261f('0x21')]>0x0){_0x1b7b24=_[_0x261f('0x45')](_0x21371a,_0x5742cf);}return _0x1b7b24;}function getCustomFields(_0x2914c9,_0x26dead){var _0x4656fe=[];var _0x38bec6={'custom_fields':[]};if(_0x2914c9['length']>0x0){_[_0x261f('0x46')](_0x2914c9,function(_0x2f3554){if(_0x2f3554[_0x261f('0x47')]===_0x261f('0x48')&&_0x2f3554[_0x261f('0x49')]&&!_0x2f3554[_0x261f('0x4a')]){_0x38bec6[_0x2f3554[_0x261f('0x49')][_0x261f('0x4b')]()]=_0x2f3554[_0x261f('0x4c')][_0x261f('0x2b')]();}else if(_0x2f3554[_0x261f('0x47')]===_0x261f('0x48')&&_0x2f3554['idField']&&_0x2f3554[_0x261f('0x4a')]){_0x38bec6[_0x261f('0x4d')][_0x261f('0x23')]({'id':_0x2f3554[_0x261f('0x24')],'value':_0x2f3554[_0x261f('0x4c')][_0x261f('0x2b')]()});}else if(_0x2f3554[_0x261f('0x47')]===_0x261f('0x4e')&&_0x2f3554[_0x261f('0x22')]&&_0x2f3554[_0x261f('0x24')]&&_0x2f3554[_0x261f('0x4a')]){_0x26dead[_0x2f3554[_0x261f('0x22')]]&&_0x38bec6[_0x261f('0x4d')]['push']({'id':_0x2f3554[_0x261f('0x24')],'value':_0x26dead[_0x2f3554[_0x261f('0x22')]][_0x261f('0x2b')]()});}else if(_0x2f3554[_0x261f('0x47')]===_0x261f('0x4f')&&_0x2f3554['Variable']&&_0x2f3554[_0x261f('0x50')][_0x261f('0x11')]&&_0x2f3554[_0x261f('0x24')]&&_0x2f3554[_0x261f('0x4a')]){_0x26dead[_0x2f3554[_0x261f('0x50')][_0x261f('0x11')][_0x261f('0x4b')]()]&&_0x38bec6[_0x261f('0x4d')][_0x261f('0x23')]({'id':_0x2f3554['idField'],'value':_0x26dead[_0x2f3554[_0x261f('0x50')]['name'][_0x261f('0x4b')]()][_0x261f('0x2b')]()});}});}return _0x38bec6;}function getConnection(_0x4ce893){return request({'method':_0x261f('0xd'),'form':{'method':_0x261f('0x51'),'input_type':'JSON','response_type':_0x261f('0x26'),'rest_data':JSON[_0x261f('0x27')]({'user_auth':{'user_name':_0x4ce893[_0x261f('0x52')],'password':_0x4ce893[_0x261f('0x53')],'encryption':_0x261f('0x54')},'application':_0x261f('0x55')})}})[_0x261f('0x32')](function(_0x463388){var _0x130c58=_0x463388;if(_0x130c58['id']){def[_0x261f('0x56')]=_0x130c58['id'];return BPromise[_0x261f('0x35')](_0x130c58);}else{throw new Error(util[_0x261f('0x28')](_0x261f('0x57'),_0x4ce893['id']));}});}function setRelationship(_0x23c4f6,_0x1ac9ea,_0x5ddb1e,_0x109650){return request({'form':{'method':_0x261f('0x58'),'input_type':_0x261f('0x26'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x23c4f6['id'],'module_name':_0x261f('0x59'),'module_id':_0x5ddb1e['id'],'link_field_name':_0x109650,'related_ids':[_0x1ac9ea['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x261f('0x5a')]=function(_0x4dfa4a,_0x91e4cc,_0x1ed335,_0x323628,_0x535117,_0x69cab){var _0x9d4a53,_0x58e858,_0x3c944f,_0x114167;_0x69cab[_0x261f('0x5b')]=intUtil['stripTrailingSlash'](_0x69cab[_0x261f('0x5b')]);_0x69cab['serverUrl']=intUtil[_0x261f('0x5c')](_0x69cab[_0x261f('0x5d')]);def[_0x261f('0x5e')]=util[_0x261f('0x28')](_0x261f('0x5f'),_0x69cab['remoteUri']);if(_0x535117&&_0x535117[_0x261f('0x60')]){logger[_0x261f('0xf')]('[QUEUE]',_0x261f('0x61'));_0x91e4cc[_0x261f('0x62')]=util[_0x261f('0x28')](_0x261f('0x63'),_0x69cab[_0x261f('0x5d')],_0x91e4cc[_0x261f('0x64')],md5(_0x91e4cc[_0x261f('0x64')]));}else{_0x91e4cc[_0x261f('0x62')]='';}return getConnection(_0x69cab)[_0x261f('0x32')](function(_0x8befd3){_0x114167=_0x8befd3;return getUser(_0x69cab,_0x323628[_0x261f('0x11')],_0x114167);})[_0x261f('0x32')](function(_0xcfcf62){_0x9d4a53=_0xcfcf62;logger[_0x261f('0xf')](_0x261f('0x65'),_0x9d4a53['id']);return getEndUser(_0x69cab,_0x91e4cc['calleridname'],_0x91e4cc[_0x261f('0x66')],_0x114167);})[_0x261f('0x32')](function(_0x426ef8){_0x58e858=_0x426ef8;logger[_0x261f('0xf')](_0x261f('0x67'),_0x58e858['id']);return getTicket(_0x69cab,_0x9d4a53,_0x58e858,_0x1ed335,_0x91e4cc,_0x1ed335[_0x261f('0x68')],_0x114167,_0x261f('0x69'));})[_0x261f('0x32')](function(_0x2342c6){_0x3c944f=_0x2342c6;logger[_0x261f('0xf')]('Ticket\x20created!');logger[_0x261f('0xf')](_0x261f('0x6a'),_0x3c944f['id']);return setRelationship(_0x114167,_0x9d4a53,_0x3c944f,_0x261f('0x6b'));})[_0x261f('0x32')](function(){return setRelationship(_0x114167,_0x58e858,_0x3c944f,'contacts');})[_0x261f('0x32')](function(){return getServerInfo(_0x114167);})[_0x261f('0x32')](function(_0xb6c4af){var _0x282033=parseInt(_0xb6c4af[_0x261f('0x6c')]['charAt'](0x0));var _0x5de690=util[_0x261f('0x28')](_0x261f('0x6d'),_0x69cab['remoteUri'],_0x3c944f['id']);if(_0x282033>0x6){_0x5de690=util[_0x261f('0x28')](_0x261f('0x6e'),_0x69cab[_0x261f('0x5b')],_0x3c944f['id']);}logger[_0x261f('0xf')]('[QUEUE]',_0x261f('0x6f'));emit(util[_0x261f('0x28')](_0x261f('0x70'),_0x323628[_0x261f('0x11')]),_0x261f('0x71'),{'uri':_0x5de690});})[_0x261f('0x72')](function(_0x3dc22e){logger[_0x261f('0x73')](_0x261f('0x74'),JSON[_0x261f('0x27')](_0x3dc22e));});};exports[_0x261f('0x75')]=function(_0x392bb6,_0x250861,_0x34b013,_0xe6da17,_0x1782fe,_0xba7a1,_0x55d6cf){var _0x36727f,_0x2d7aea,_0x499288,_0x4f6519;_0xba7a1['remoteUri']=intUtil[_0x261f('0x5c')](_0xba7a1[_0x261f('0x5b')]);_0xba7a1[_0x261f('0x5d')]=intUtil['stripTrailingSlash'](_0xba7a1['serverUrl']);def['uri']=util[_0x261f('0x28')](_0x261f('0x5f'),_0xba7a1[_0x261f('0x5b')]);if(_0x55d6cf&&_0x55d6cf['recordingFormat']&&_0x55d6cf[_0x261f('0x76')]!=='none'){logger[_0x261f('0xf')](_0x261f('0x77'),'Recording\x20is\x20enabled!');_0x250861[_0x261f('0x62')]=util[_0x261f('0x28')](_0x261f('0x63'),_0xba7a1[_0x261f('0x5d')],_0x250861[_0x261f('0x64')],md5(_0x250861[_0x261f('0x64')]));}return getConnection(_0xba7a1)['then'](function(_0x70dba2){_0x4f6519=_0x70dba2;return getUser(_0xba7a1,_0xe6da17[_0x261f('0x11')],_0x4f6519);})[_0x261f('0x32')](function(_0x358c91){_0x36727f=_0x358c91;logger[_0x261f('0xf')](_0x261f('0x65'),_0x36727f['id']);return getEndUser(_0xba7a1,_0x250861['destcalleridname'],_0x250861[_0x261f('0x78')],_0x4f6519);})['then'](function(_0xfc4557){_0x2d7aea=_0xfc4557;logger['info'](_0x261f('0x67'),_0x2d7aea['id']);return getTicket(_0xba7a1,_0x36727f,_0x2d7aea,_0x34b013,_0x250861,_0x34b013[_0x261f('0x68')],_0x4f6519,_0x261f('0x79'));})[_0x261f('0x32')](function(_0x551fda){_0x499288=_0x551fda;logger[_0x261f('0xf')]('Ticket\x20created!');logger[_0x261f('0xf')](_0x261f('0x6a'),_0x499288['id']);return setRelationship(_0x4f6519,_0x36727f,_0x499288,_0x261f('0x6b'));})[_0x261f('0x32')](function(){return setRelationship(_0x4f6519,_0x2d7aea,_0x499288,'contacts');})[_0x261f('0x32')](function(){return getServerInfo(_0x4f6519);})[_0x261f('0x32')](function(_0x1ca990){var _0x532c78=parseInt(_0x1ca990['version'][_0x261f('0x7a')](0x0));var _0xf2e39f=util['format'](_0x261f('0x6d'),_0xba7a1['remoteUri'],_0x499288['id']);if(_0x532c78>0x6){_0xf2e39f=util[_0x261f('0x28')](_0x261f('0x6e'),_0xba7a1[_0x261f('0x5b')],_0x499288['id']);}logger[_0x261f('0xf')](_0x261f('0x77'),_0x261f('0x6f'));emit(util[_0x261f('0x28')](_0x261f('0x70'),_0xe6da17['name']),'trigger:browser:url',{'uri':_0xf2e39f});})[_0x261f('0x72')](function(_0x1a6ded){logger[_0x261f('0x73')](_0x261f('0x77'),JSON[_0x261f('0x27')](_0x1a6ded));});};exports['unmanaged']=function(_0x583263,_0x278030,_0x10c579,_0x127929,_0x594301,_0x2a9b72){var _0x13889d,_0x560925,_0x4d0395,_0x46fac2;_0x2a9b72[_0x261f('0x5b')]=intUtil[_0x261f('0x5c')](_0x2a9b72[_0x261f('0x5b')]);_0x2a9b72['serverUrl']=intUtil['stripTrailingSlash'](_0x2a9b72[_0x261f('0x5d')]);def[_0x261f('0x5e')]=util[_0x261f('0x28')](_0x261f('0x5f'),_0x2a9b72[_0x261f('0x5b')]);if(_0x594301&&_0x594301[_0x261f('0x60')]){logger[_0x261f('0xf')]('['+_0x278030[_0x261f('0x7b')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x278030[_0x261f('0x62')]=util[_0x261f('0x28')](_0x261f('0x63'),_0x2a9b72[_0x261f('0x5d')],_0x278030[_0x261f('0x64')],md5(_0x278030[_0x261f('0x64')]));}else{_0x278030[_0x261f('0x62')]='';}return getConnection(_0x2a9b72)[_0x261f('0x32')](function(_0x15e3ee){_0x46fac2=_0x15e3ee;if(!_[_0x261f('0x2d')](_0x127929)){return getUser(_0x2a9b72,_0x127929['name'],_0x46fac2);}else{return getUser(_0x2a9b72,null,_0x46fac2);}})[_0x261f('0x32')](function(_0x41bcdc){_0x13889d=_0x41bcdc;logger[_0x261f('0xf')](_0x261f('0x65'),_0x13889d['id']);return getEndUser(_0x2a9b72,_0x278030[_0x261f('0x7c')],_0x278030[_0x261f('0x66')],_0x46fac2);})['then'](function(_0x7b3e28){_0x560925=_0x7b3e28;logger[_0x261f('0xf')]('The\x20Enduser\x20ID\x20is:',_0x560925['id']);return getTicket(_0x2a9b72,_0x13889d,_0x560925,_0x10c579,_0x278030,_0x10c579[_0x261f('0x68')],_0x46fac2,_0x261f('0x69'));})[_0x261f('0x32')](function(_0x1b2535){_0x4d0395=_0x1b2535;logger['info'](_0x261f('0x7d'));logger[_0x261f('0xf')]('The\x20Ticket\x20ID\x20is:',_0x4d0395['id']);return setRelationship(_0x46fac2,_0x13889d,_0x4d0395,'users');})['then'](function(){return setRelationship(_0x46fac2,_0x560925,_0x4d0395,_0x261f('0x7e'));})[_0x261f('0x32')](function(){return getServerInfo(_0x46fac2);})[_0x261f('0x72')](function(_0x2e0567){logger[_0x261f('0x73')]('['+_0x278030['lastevent'][_0x261f('0x7f')]()+']',JSON[_0x261f('0x27')](_0x2e0567));});}; \ 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 8512760..5beafc1 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 _0x4bb4=['length','type','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','string','%s:\x20%s','key','keyType','format','join','slice','substring','lastIndexOf','validateEmail','isNil','lodash','getString'];(function(_0x3909bc,_0x22172a){var _0x4b7c7f=function(_0x3976a1){while(--_0x3976a1){_0x3909bc['push'](_0x3909bc['shift']());}};_0x4b7c7f(++_0x22172a);}(_0x4bb4,0x12a));var _0x44bb=function(_0x47ee5e,_0x4a8c6c){_0x47ee5e=_0x47ee5e-0x0;var _0x49d689=_0x4bb4[_0x47ee5e];return _0x49d689;};'use strict';var _=require(_0x44bb('0x0'));var util=require('util');exports[_0x44bb('0x1')]=function(_0x1ab73a,_0xf43852,_0xda8e5){var _0x4cf4fa=[];if(_0x1ab73a[_0x44bb('0x2')]>0x0){var _0x175d59=_['sortBy'](_0x1ab73a,['id']);for(var _0x964f36=0x0;_0x964f36<_0x175d59[_0x44bb('0x2')];_0x964f36++){var _0x1e241f=_0x175d59[_0x964f36];if(_0x1e241f[_0x44bb('0x3')]==='string'){_0x4cf4fa[_0x44bb('0x4')](_0x1e241f[_0x44bb('0x5')]);}else if(_0x1e241f[_0x44bb('0x3')]===_0x44bb('0x6')&&_0x1e241f[_0x44bb('0x7')]){_0xf43852[_0x1e241f[_0x44bb('0x7')]]&&_0x4cf4fa[_0x44bb('0x4')](_0xf43852[_0x1e241f[_0x44bb('0x7')]][_0x44bb('0x8')]());}else if(_0x1e241f[_0x44bb('0x3')]===_0x44bb('0x9')&&_0x1e241f[_0x44bb('0xa')]&&_0x1e241f[_0x44bb('0xa')][_0x44bb('0xb')]){_0xf43852[_0x1e241f['Variable'][_0x44bb('0xb')][_0x44bb('0xc')]()]&&_0x4cf4fa['push'](_0xf43852[_0x1e241f[_0x44bb('0xa')][_0x44bb('0xb')]['toLowerCase']()]['toString']());}else if(_0x1e241f['type']===_0x44bb('0xd')){if(_0x1e241f['keyType']===_0x44bb('0xe')&&_0x1e241f['key']){_0x4cf4fa['push'](util['format'](_0x44bb('0xf'),_0x1e241f[_0x44bb('0x10')],_0x1e241f['keyContent']));}else if(_0x1e241f[_0x44bb('0x11')]===_0x44bb('0x6')&&_0x1e241f[_0x44bb('0x7')]&&_0x1e241f['key']){_0xf43852[_0x1e241f[_0x44bb('0x7')]]&&_0x4cf4fa['push'](util[_0x44bb('0x12')](_0x44bb('0xf'),_0x1e241f[_0x44bb('0x10')],_0xf43852[_0x1e241f[_0x44bb('0x7')]]));}else if(_0x1e241f[_0x44bb('0x11')]===_0x44bb('0x9')&&_0x1e241f['Variable']&&_0x1e241f['Variable'][_0x44bb('0xb')]&&_0x1e241f[_0x44bb('0x10')]){_0xf43852[_0x1e241f[_0x44bb('0xa')][_0x44bb('0xb')]['toLowerCase']()]&&_0x4cf4fa['push'](util[_0x44bb('0x12')](_0x44bb('0xf'),_0x1e241f[_0x44bb('0x10')],_0xf43852[_0x1e241f[_0x44bb('0xa')][_0x44bb('0xb')][_0x44bb('0xc')]()]));}}}}return _0x4cf4fa[_0x44bb('0x13')](_0xda8e5);};exports['stripTrailingSlash']=function(_0xc7197){var _0x3635da=_0xc7197[_0x44bb('0x14')](-0x1);if(_0x3635da==='/'){_0xc7197=_0xc7197[_0x44bb('0x15')](0x0,_0xc7197[_0x44bb('0x16')](_0x3635da));}return _0xc7197;};exports[_0x44bb('0x17')]=function(_0xb1d23c){if(!_[_0x44bb('0x18')](_0xb1d23c)&&_0xb1d23c!==''){var _0x30f320=/^(([^<>()\[\]\\.,;:\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 _0x30f320['test'](String(_0xb1d23c)[_0x44bb('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x065e=['type','string','content','variable','variableName','push','toString','Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','key','keyContent','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','lodash','util','getString','length','sortBy'];(function(_0x3be119,_0x115984){var _0x2ce5ab=function(_0x4d8378){while(--_0x4d8378){_0x3be119['push'](_0x3be119['shift']());}};_0x2ce5ab(++_0x115984);}(_0x065e,0x6b));var _0xe065=function(_0x24befe,_0x38f2c0){_0x24befe=_0x24befe-0x0;var _0x17ece7=_0x065e[_0x24befe];return _0x17ece7;};'use strict';var _=require(_0xe065('0x0'));var util=require(_0xe065('0x1'));exports[_0xe065('0x2')]=function(_0x2a5425,_0x46dde1,_0x34e33e){var _0x374357=[];if(_0x2a5425[_0xe065('0x3')]>0x0){var _0xf6a475=_[_0xe065('0x4')](_0x2a5425,['id']);for(var _0x473df7=0x0;_0x473df7<_0xf6a475[_0xe065('0x3')];_0x473df7++){var _0x1f3089=_0xf6a475[_0x473df7];if(_0x1f3089[_0xe065('0x5')]===_0xe065('0x6')){_0x374357['push'](_0x1f3089[_0xe065('0x7')]);}else if(_0x1f3089[_0xe065('0x5')]===_0xe065('0x8')&&_0x1f3089['variableName']){_0x46dde1[_0x1f3089[_0xe065('0x9')]]&&_0x374357[_0xe065('0xa')](_0x46dde1[_0x1f3089['variableName']][_0xe065('0xb')]());}else if(_0x1f3089[_0xe065('0x5')]==='customVariable'&&_0x1f3089[_0xe065('0xc')]&&_0x1f3089[_0xe065('0xc')][_0xe065('0xd')]){_0x46dde1[_0x1f3089[_0xe065('0xc')][_0xe065('0xd')][_0xe065('0xe')]()]&&_0x374357[_0xe065('0xa')](_0x46dde1[_0x1f3089['Variable'][_0xe065('0xd')][_0xe065('0xe')]()][_0xe065('0xb')]());}else if(_0x1f3089['type']===_0xe065('0xf')){if(_0x1f3089[_0xe065('0x10')]===_0xe065('0x6')&&_0x1f3089['key']){_0x374357[_0xe065('0xa')](util[_0xe065('0x11')](_0xe065('0x12'),_0x1f3089[_0xe065('0x13')],_0x1f3089[_0xe065('0x14')]));}else if(_0x1f3089[_0xe065('0x10')]==='variable'&&_0x1f3089[_0xe065('0x9')]&&_0x1f3089['key']){_0x46dde1[_0x1f3089['variableName']]&&_0x374357[_0xe065('0xa')](util[_0xe065('0x11')](_0xe065('0x12'),_0x1f3089[_0xe065('0x13')],_0x46dde1[_0x1f3089['variableName']]));}else if(_0x1f3089[_0xe065('0x10')]===_0xe065('0x15')&&_0x1f3089['Variable']&&_0x1f3089[_0xe065('0xc')][_0xe065('0xd')]&&_0x1f3089['key']){_0x46dde1[_0x1f3089[_0xe065('0xc')][_0xe065('0xd')][_0xe065('0xe')]()]&&_0x374357[_0xe065('0xa')](util['format'](_0xe065('0x12'),_0x1f3089[_0xe065('0x13')],_0x46dde1[_0x1f3089[_0xe065('0xc')][_0xe065('0xd')][_0xe065('0xe')]()]));}}}}return _0x374357[_0xe065('0x16')](_0x34e33e);};exports[_0xe065('0x17')]=function(_0x42f6bc){var _0x4f8599=_0x42f6bc[_0xe065('0x18')](-0x1);if(_0x4f8599==='/'){_0x42f6bc=_0x42f6bc[_0xe065('0x19')](0x0,_0x42f6bc[_0xe065('0x1a')](_0x4f8599));}return _0x42f6bc;};exports[_0xe065('0x1b')]=function(_0x32e73f){if(!_['isNil'](_0x32e73f)&&_0x32e73f!==''){var _0x31e0c0=/^(([^<>()\[\]\\.,;:\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 _0x31e0c0['test'](String(_0x32e73f)[_0xe065('0xe')]());}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 c153157..7e2e789 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x18c01f,_0x123ae1){var _0x32297b=function(_0xa8efe7){while(--_0xa8efe7){_0x18c01f['push'](_0x18c01f['shift']());}};_0x32297b(++_0x123ae1);}(_0xe706,0xa3));var _0x6e70=function(_0x525798,_0x77a707){_0x525798=_0x525798-0x0;var _0x57da9a=_0xe706[_0x525798];return _0x57da9a;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 4397d85..008469f 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 _0xf253=['queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridname','Zendesk\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','zendesk','redis','defaults','emit','application/json','info','format','%s/tickets.json','POST','merge','Tags','name','getString','Descriptions','Fields','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','Enduser\x20found!','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','debug','[HTTP]','stringify','GET','forEach','string','picklist','type','nameField','toLowerCase','content','toString','includes','customField','custom_fields','push','idField','variableName','Variable'];(function(_0xf6b0a6,_0x4d5ab3){var _0x4052eb=function(_0x224074){while(--_0x224074){_0xf6b0a6['push'](_0xf6b0a6['shift']());}};_0x4052eb(++_0x4d5ab3);}(_0xf253,0x8b));var _0x3f25=function(_0x597be4,_0x27e874){_0x597be4=_0x597be4-0x0;var _0x2b2608=_0xf253[_0x597be4];return _0x2b2608;};'use strict';var _=require(_0x3f25('0x0'));var rp=require(_0x3f25('0x1'));var md5=require(_0x3f25('0x2'));var util=require(_0x3f25('0x3'));var Redis=require(_0x3f25('0x4'));var intUtil=require(_0x3f25('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x3f25('0x6'));config[_0x3f25('0x7')]=_[_0x3f25('0x8')](config[_0x3f25('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3f25('0x7')]));function emit(_0x555793,_0x15e23c,_0x6e39e4){io['to'](_0x555793)[_0x3f25('0x9')](_0x15e23c,_0x6e39e4);}var headers={'Content-Type':_0x3f25('0xa'),'Accept':'application/json'};function getTicket(_0x54b01e,_0x16bca6,_0x2eb727,_0x5e3fb7,_0x1b7668){logger[_0x3f25('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x3f25('0xc')](_0x3f25('0xd'),_0x54b01e['remoteUri']),'method':_0x3f25('0xe'),'body':{'ticket':_[_0x3f25('0xf')]({'requester_id':_0x2eb727['id'],'submitter_id':_0x16bca6?_0x16bca6['id']:undefined,'assignee_id':_0x16bca6?_0x16bca6['id']:undefined,'tags':getTags(_0x5e3fb7[_0x3f25('0x10')],_0x3f25('0x11')),'subject':intUtil['getString'](_0x5e3fb7['Subjects'],_0x1b7668,'\x20'),'description':intUtil[_0x3f25('0x12')](_0x5e3fb7[_0x3f25('0x13')],_0x1b7668,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x5e3fb7['Descriptions'],_0x1b7668,'\x0a')}},getCustomFields(_0x5e3fb7[_0x3f25('0x14')],_0x1b7668))}})['then'](function(_0x16b430){logger[_0x3f25('0xb')](_0x3f25('0x15'));return _0x16b430['ticket'];});}function getUser(_0x5e3d50,_0x442a53){if(intUtil['validateEmail'](_0x442a53)){logger[_0x3f25('0xb')](_0x3f25('0x16'),_0x442a53);return request({'uri':util['format'](_0x3f25('0x17'),_0x5e3d50['remoteUri']),'qs':{'query':util['format'](_0x3f25('0x18'),_0x442a53)}})[_0x3f25('0x19')](function(_0x37dfe0){if(_0x37dfe0['count']){logger[_0x3f25('0xb')](_0x3f25('0x1a'));return _[_0x3f25('0x1b')](_0x37dfe0['results'],{'email':_0x442a53,'role':_0x3f25('0x1c')});}else{logger[_0x3f25('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3f25('0xc')]('%s/users/me.json',_0x5e3d50['remoteUri'])})[_0x3f25('0x19')](function(_0x8ff853){logger['info']('Admin\x20account\x20selected.');return _0x8ff853['user'];});}});}else{logger[_0x3f25('0xb')](_0x3f25('0x1d'));return request({'uri':util['format'](_0x3f25('0x1e'),_0x5e3d50[_0x3f25('0x1f')])})[_0x3f25('0x19')](function(_0x4c9b9e){logger[_0x3f25('0xb')](_0x3f25('0x20'));return _0x4c9b9e[_0x3f25('0x21')];});}}function getEndUser(_0x881db9,_0x44fcad,_0xd7731){logger['info']('Searching\x20enduser\x20with\x20phone',_0xd7731);return request({'uri':util[_0x3f25('0xc')](_0x3f25('0x17'),_0x881db9[_0x3f25('0x1f')]),'qs':{'query':util[_0x3f25('0xc')](_0x3f25('0x22'),_0xd7731)}})[_0x3f25('0x19')](function(_0x33ad7d){var _0x1700bf;if(_0x33ad7d[_0x3f25('0x23')][_0x3f25('0x24')]){_0x33ad7d['results']=_[_0x3f25('0x25')](_0x33ad7d['results'],{'suspended':![],'role':_0x3f25('0x26')});if(_0x33ad7d['results'][_0x3f25('0x24')]){_0x1700bf=_['first'](_0x33ad7d[_0x3f25('0x23')]);}}if(_0x1700bf){logger[_0x3f25('0xb')](_0x3f25('0x27'));return _0x1700bf;}else{logger[_0x3f25('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x3f25('0xc')]('%s/users.json',_0x881db9['remoteUri']),'method':_0x3f25('0xe'),'body':{'user':{'role':_0x3f25('0x26'),'name':util['format'](_0x3f25('0x28'),_0x44fcad||_0xd7731),'phone':_0xd7731}}})['then'](function(_0x315a31){logger[_0x3f25('0xb')]('Enduser\x20created.');return _0x315a31[_0x3f25('0x21')];});}});}function getAuth(_0x28c47d){var _0x5caf89;if(_0x28c47d[_0x3f25('0x29')]===_0x3f25('0x2a')){_0x5caf89=util[_0x3f25('0xc')](_0x3f25('0x2b'),_0x28c47d[_0x3f25('0x2c')],_0x28c47d['password']);}else if(_0x28c47d[_0x3f25('0x29')]===_0x3f25('0x2d')){_0x5caf89=util[_0x3f25('0xc')](_0x3f25('0x2e'),_0x28c47d[_0x3f25('0x2c')],_0x28c47d[_0x3f25('0x2d')]);}return util[_0x3f25('0xc')](_0x3f25('0x2f'),new Buffer(_0x5caf89)['toString']('base64'));}function request(_0x5c2c3f){logger[_0x3f25('0x30')](_0x3f25('0x31'),JSON[_0x3f25('0x32')](_0x5c2c3f));return rp(_['defaults'](_0x5c2c3f,{'method':_0x3f25('0x33'),'headers':headers,'json':!![]}));}function getTags(_0xe126ec,_0x195b25){var _0x4c3543=[];if(_0xe126ec&&_0xe126ec[_0x3f25('0x24')]>0x0){_0x4c3543=_['map'](_0xe126ec,_0x195b25);}return _0x4c3543;}function getCustomFields(_0xf2fdd0,_0x8ad8d8){var _0xef18c2=[];var _0x3c21c4={'custom_fields':[]};if(_0xf2fdd0[_0x3f25('0x24')]>0x0){_[_0x3f25('0x34')](_0xf2fdd0,function(_0x199b4f){if(_['includes']([_0x3f25('0x35'),_0x3f25('0x36')],_0x199b4f[_0x3f25('0x37')])&&_0x199b4f[_0x3f25('0x38')]&&!_0x199b4f['customField']){_0x3c21c4[_0x199b4f['nameField'][_0x3f25('0x39')]()]=_0x199b4f[_0x3f25('0x3a')][_0x3f25('0x3b')]();}else if(_[_0x3f25('0x3c')]([_0x3f25('0x35'),_0x3f25('0x36')],_0x199b4f['type'])&&_0x199b4f['idField']&&_0x199b4f[_0x3f25('0x3d')]){_0x3c21c4[_0x3f25('0x3e')][_0x3f25('0x3f')]({'id':_0x199b4f[_0x3f25('0x40')],'value':_0x199b4f[_0x3f25('0x3a')][_0x3f25('0x3b')]()});}else if(_0x199b4f[_0x3f25('0x37')]==='variable'&&_0x199b4f[_0x3f25('0x41')]&&_0x199b4f[_0x3f25('0x40')]&&_0x199b4f[_0x3f25('0x3d')]){_0x8ad8d8[_0x199b4f[_0x3f25('0x41')]]&&_0x3c21c4[_0x3f25('0x3e')][_0x3f25('0x3f')]({'id':_0x199b4f['idField'],'value':_0x8ad8d8[_0x199b4f['variableName']][_0x3f25('0x3b')]()});}else if(_0x199b4f[_0x3f25('0x37')]==='customVariable'&&_0x199b4f[_0x3f25('0x42')]&&_0x199b4f[_0x3f25('0x42')][_0x3f25('0x11')]&&_0x199b4f[_0x3f25('0x40')]&&_0x199b4f['customField']){_0x8ad8d8[_0x199b4f[_0x3f25('0x42')][_0x3f25('0x11')][_0x3f25('0x39')]()]&&_0x3c21c4['custom_fields'][_0x3f25('0x3f')]({'id':_0x199b4f[_0x3f25('0x40')],'value':_0x8ad8d8[_0x199b4f['Variable'][_0x3f25('0x11')][_0x3f25('0x39')]()]['toString']()});}});}return _0x3c21c4;}exports[_0x3f25('0x43')]=function(_0x219d04,_0x1585f7,_0x2962c4,_0x19fbf1,_0x5528fa,_0x2da531){var _0x43ae46,_0xf45984;_0x2da531[_0x3f25('0x1f')]=intUtil[_0x3f25('0x44')](_0x2da531[_0x3f25('0x1f')]);_0x2da531[_0x3f25('0x45')]=intUtil[_0x3f25('0x44')](_0x2da531['serverUrl']);if(_0x5528fa&&_0x5528fa[_0x3f25('0x46')]){logger[_0x3f25('0xb')](_0x3f25('0x47'),_0x3f25('0x48'));_0x1585f7['recordingURL']=util[_0x3f25('0xc')](_0x3f25('0x49'),_0x2da531[_0x3f25('0x45')],_0x1585f7['uniqueid'],md5(_0x1585f7[_0x3f25('0x4a')]));}else{_0x1585f7[_0x3f25('0x4b')]='';}headers['Authorization']=getAuth(_0x2da531);return getUser(_0x2da531,_0x19fbf1['email'])['then'](function(_0x596e5d){_0x43ae46=_0x596e5d;logger[_0x3f25('0xb')](_0x3f25('0x4c'),_0x43ae46['id']);return getEndUser(_0x2da531,_0x1585f7[_0x3f25('0x4d')],_0x1585f7['calleridnum']);})['then'](function(_0x183766){_0xf45984=_0x183766;logger[_0x3f25('0xb')]('The\x20Enduser\x20ID\x20is:',_0xf45984['id']);return getTicket(_0x2da531,_0x43ae46,_0xf45984,_0x2962c4,_0x1585f7);})[_0x3f25('0x19')](function(_0x317afc){if(_0x317afc){logger[_0x3f25('0xb')](_0x3f25('0x4e'),_0x317afc['id']);switch(_0x2da531[_0x3f25('0x37')]){case _0x3f25('0x4f'):logger['info'](_0x3f25('0x47'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x3f25('0xc')](_0x3f25('0x50'),_0x2da531['remoteUri'],_0x43ae46['id'],_0x317afc['id']),'method':_0x3f25('0xe')});case _0x3f25('0x51'):logger['info'](_0x3f25('0x47'),_0x3f25('0x52'));emit(util['format'](_0x3f25('0x53'),_0x19fbf1[_0x3f25('0x11')]),'trigger:browser:url',{'uri':util[_0x3f25('0xc')](_0x3f25('0x54'),_0x2da531[_0x3f25('0x1f')][_0x3f25('0x55')](_0x3f25('0x56'),''),_0x317afc['id'])});break;default:logger[_0x3f25('0x57')](_0x3f25('0x47'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x42dc6d){logger[_0x3f25('0x57')](_0x3f25('0x58'),util[_0x3f25('0x59')](_0x42dc6d,{'showHidden':!![],'depth':null}));});};exports[_0x3f25('0x5a')]=function(_0xbc7b4b,_0x4c69ac,_0x5921d2,_0x5ed814,_0x2b73e7,_0x3a5332,_0x37eee0){var _0x364e01,_0x2243c1;_0x3a5332[_0x3f25('0x1f')]=intUtil[_0x3f25('0x44')](_0x3a5332[_0x3f25('0x1f')]);_0x3a5332[_0x3f25('0x45')]=intUtil[_0x3f25('0x44')](_0x3a5332[_0x3f25('0x45')]);if(_0x37eee0&&_0x37eee0[_0x3f25('0x5b')]&&_0x37eee0[_0x3f25('0x5b')]!==_0x3f25('0x5c')){logger[_0x3f25('0xb')](_0x3f25('0x5d'),_0x3f25('0x48'));_0x4c69ac[_0x3f25('0x4b')]=util['format'](_0x3f25('0x49'),_0x3a5332[_0x3f25('0x45')],_0x4c69ac[_0x3f25('0x4a')],md5(_0x4c69ac[_0x3f25('0x4a')]));}headers[_0x3f25('0x5e')]=getAuth(_0x3a5332);return getUser(_0x3a5332,_0x5ed814[_0x3f25('0x5f')])[_0x3f25('0x19')](function(_0x4bffe6){_0x364e01=_0x4bffe6;logger['info'](_0x3f25('0x4c'),_0x364e01['id']);return getEndUser(_0x3a5332,_0x4c69ac[_0x3f25('0x60')],_0x4c69ac['destcalleridnum']);})[_0x3f25('0x19')](function(_0x1178bd){_0x2243c1=_0x1178bd;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2243c1['id']);return getTicket(_0x3a5332,_0x364e01,_0x2243c1,_0x5921d2,_0x4c69ac);})['then'](function(_0x3b194b){if(_0x3b194b){logger['info'](_0x3f25('0x4e'),_0x3b194b['id']);switch(_0x3a5332[_0x3f25('0x37')]){case'integrationTab':logger['info'](_0x3f25('0x5d'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x3f25('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3a5332[_0x3f25('0x1f')],_0x364e01['id'],_0x3b194b['id']),'method':_0x3f25('0xe')});case'newTab':logger[_0x3f25('0xb')]('[OUTBOUND]',_0x3f25('0x52'));emit(util[_0x3f25('0xc')](_0x3f25('0x53'),_0x5ed814[_0x3f25('0x11')]),'trigger:browser:url',{'uri':util['format'](_0x3f25('0x54'),_0x3a5332['remoteUri'][_0x3f25('0x55')]('/api/v2',''),_0x3b194b['id'])});break;default:logger[_0x3f25('0x57')](_0x3f25('0x5d'),_0x3f25('0x61'));}}})[_0x3f25('0x62')](function(_0x4840ca){logger[_0x3f25('0x57')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x3f25('0x59')](_0x4840ca,{'showHidden':!![],'depth':null}));});};exports[_0x3f25('0x63')]=function(_0x496c39,_0x5878f3,_0x2e8037,_0x14bf5d,_0x16ab8b,_0x111257){var _0x217e77,_0x25a8f3;_0x111257[_0x3f25('0x1f')]=intUtil[_0x3f25('0x44')](_0x111257['remoteUri']);_0x111257[_0x3f25('0x45')]=intUtil[_0x3f25('0x44')](_0x111257['serverUrl']);if(_0x16ab8b&&_0x16ab8b[_0x3f25('0x46')]){logger[_0x3f25('0xb')]('['+_0x5878f3[_0x3f25('0x64')][_0x3f25('0x65')]()+']','Recording\x20is\x20enabled!');_0x5878f3[_0x3f25('0x4b')]=util[_0x3f25('0xc')](_0x3f25('0x49'),_0x111257[_0x3f25('0x45')],_0x5878f3[_0x3f25('0x4a')],md5(_0x5878f3[_0x3f25('0x4a')]));}else{_0x5878f3[_0x3f25('0x4b')]='';}headers['Authorization']=getAuth(_0x111257);return getUser(_0x111257)['then'](function(_0x204900){_0x217e77=_0x204900;logger[_0x3f25('0xb')]('The\x20User\x20ID\x20is:',_0x217e77['id']);return getEndUser(_0x111257,_0x5878f3[_0x3f25('0x4d')],_0x5878f3['calleridnum']);})[_0x3f25('0x19')](function(_0x1f7df2){_0x25a8f3=_0x1f7df2;logger[_0x3f25('0xb')]('The\x20Enduser\x20ID\x20is:',_0x25a8f3['id']);return getTicket(_0x111257,_0x217e77,_0x25a8f3,_0x2e8037,_0x5878f3);})[_0x3f25('0x19')](function(_0x24fcac){if(_0x24fcac){logger[_0x3f25('0xb')](_0x3f25('0x4e'),_0x24fcac['id']);}})['catch'](function(_0x444ff4){logger[_0x3f25('0x57')]('['+_0x5878f3[_0x3f25('0x64')][_0x3f25('0x65')]()+']'+_0x3f25('0x66'),util[_0x3f25('0x59')](_0x444ff4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3703=['Variable','custom_fields','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','replace','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','calleridname','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','./util','../../../../config/environment','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Descriptions','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','base64','debug','stringify','defaults','GET','map','forEach','includes','string','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','push','customVariable'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3703,0x102));var _0x3370=function(_0x208c01,_0x2dd63d){_0x208c01=_0x208c01-0x0;var _0x54a5fc=_0x3703[_0x208c01];return _0x54a5fc;};'use strict';var _=require(_0x3370('0x0'));var rp=require(_0x3370('0x1'));var md5=require('md5');var util=require(_0x3370('0x2'));var Redis=require('ioredis');var intUtil=require(_0x3370('0x3'));var config=require(_0x3370('0x4'));var logger=require('../../../../config/logger')(_0x3370('0x5'));config[_0x3370('0x6')]=_['defaults'](config[_0x3370('0x6')],{'host':_0x3370('0x7'),'port':0x18eb});var io=require(_0x3370('0x8'))(new Redis(config[_0x3370('0x6')]));function emit(_0x128bae,_0x1c3a5a,_0x2558b7){io['to'](_0x128bae)[_0x3370('0x9')](_0x1c3a5a,_0x2558b7);}var headers={'Content-Type':_0x3370('0xa'),'Accept':_0x3370('0xa')};function getTicket(_0x293739,_0x38f657,_0x3a2188,_0x4af533,_0x3e9bb4){logger[_0x3370('0xb')](_0x3370('0xc'));return request({'uri':util[_0x3370('0xd')](_0x3370('0xe'),_0x293739[_0x3370('0xf')]),'method':_0x3370('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x3a2188['id'],'submitter_id':_0x38f657?_0x38f657['id']:undefined,'assignee_id':_0x38f657?_0x38f657['id']:undefined,'tags':getTags(_0x4af533[_0x3370('0x11')],_0x3370('0x12')),'subject':intUtil[_0x3370('0x13')](_0x4af533['Subjects'],_0x3e9bb4,'\x20'),'description':intUtil[_0x3370('0x13')](_0x4af533[_0x3370('0x14')],_0x3e9bb4,'\x0a'),'comment':{'public':![],'body':intUtil[_0x3370('0x13')](_0x4af533[_0x3370('0x14')],_0x3e9bb4,'\x0a')}},getCustomFields(_0x4af533['Fields'],_0x3e9bb4))}})[_0x3370('0x15')](function(_0x49efe4){logger[_0x3370('0xb')](_0x3370('0x16'));return _0x49efe4[_0x3370('0x17')];});}function getUser(_0x10bf8d,_0x59603b){if(intUtil['validateEmail'](_0x59603b)){logger[_0x3370('0xb')](_0x3370('0x18'),_0x59603b);return request({'uri':util[_0x3370('0xd')](_0x3370('0x19'),_0x10bf8d['remoteUri']),'qs':{'query':util[_0x3370('0xd')](_0x3370('0x1a'),_0x59603b)}})[_0x3370('0x15')](function(_0x19511d){if(_0x19511d['count']){logger[_0x3370('0xb')](_0x3370('0x1b'));return _[_0x3370('0x1c')](_0x19511d[_0x3370('0x1d')],{'email':_0x59603b,'role':_0x3370('0x1e')});}else{logger[_0x3370('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3370('0xd')](_0x3370('0x1f'),_0x10bf8d[_0x3370('0xf')])})['then'](function(_0xd53ef3){logger[_0x3370('0xb')](_0x3370('0x20'));return _0xd53ef3[_0x3370('0x21')];});}});}else{logger[_0x3370('0xb')](_0x3370('0x22'));return request({'uri':util[_0x3370('0xd')](_0x3370('0x1f'),_0x10bf8d[_0x3370('0xf')])})[_0x3370('0x15')](function(_0x4a02f7){logger['info'](_0x3370('0x20'));return _0x4a02f7[_0x3370('0x21')];});}}function getEndUser(_0xf2e203,_0x3e88fe,_0x190ff3){logger[_0x3370('0xb')](_0x3370('0x23'),_0x190ff3);return request({'uri':util[_0x3370('0xd')](_0x3370('0x19'),_0xf2e203[_0x3370('0xf')]),'qs':{'query':util[_0x3370('0xd')](_0x3370('0x24'),_0x190ff3)}})[_0x3370('0x15')](function(_0x4354c0){var _0x477896;if(_0x4354c0['results'][_0x3370('0x25')]){_0x4354c0[_0x3370('0x1d')]=_[_0x3370('0x26')](_0x4354c0[_0x3370('0x1d')],{'suspended':![],'role':_0x3370('0x27')});if(_0x4354c0['results'][_0x3370('0x25')]){_0x477896=_[_0x3370('0x28')](_0x4354c0[_0x3370('0x1d')]);}}if(_0x477896){logger['info'](_0x3370('0x29'));return _0x477896;}else{logger[_0x3370('0xb')](_0x3370('0x2a'));return request({'uri':util[_0x3370('0xd')](_0x3370('0x2b'),_0xf2e203[_0x3370('0xf')]),'method':_0x3370('0x10'),'body':{'user':{'role':_0x3370('0x27'),'name':util[_0x3370('0xd')](_0x3370('0x2c'),_0x3e88fe||_0x190ff3),'phone':_0x190ff3}}})[_0x3370('0x15')](function(_0x1f87b7){logger[_0x3370('0xb')](_0x3370('0x2d'));return _0x1f87b7[_0x3370('0x21')];});}});}function getAuth(_0x46be9a){var _0x27e728;if(_0x46be9a[_0x3370('0x2e')]===_0x3370('0x2f')){_0x27e728=util[_0x3370('0xd')](_0x3370('0x30'),_0x46be9a[_0x3370('0x31')],_0x46be9a[_0x3370('0x2f')]);}else if(_0x46be9a[_0x3370('0x2e')]===_0x3370('0x32')){_0x27e728=util[_0x3370('0xd')]('%s/token:%s',_0x46be9a['username'],_0x46be9a[_0x3370('0x32')]);}return util[_0x3370('0xd')](_0x3370('0x33'),new Buffer(_0x27e728)['toString'](_0x3370('0x34')));}function request(_0x2e3344){logger[_0x3370('0x35')]('[HTTP]',JSON[_0x3370('0x36')](_0x2e3344));return rp(_[_0x3370('0x37')](_0x2e3344,{'method':_0x3370('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x253def,_0x47ab9d){var _0x107c90=[];if(_0x253def&&_0x253def[_0x3370('0x25')]>0x0){_0x107c90=_[_0x3370('0x39')](_0x253def,_0x47ab9d);}return _0x107c90;}function getCustomFields(_0x61a10d,_0x51119d){var _0x279dad=[];var _0x476927={'custom_fields':[]};if(_0x61a10d['length']>0x0){_[_0x3370('0x3a')](_0x61a10d,function(_0xba301e){if(_[_0x3370('0x3b')]([_0x3370('0x3c'),'picklist'],_0xba301e[_0x3370('0x3d')])&&_0xba301e[_0x3370('0x3e')]&&!_0xba301e[_0x3370('0x3f')]){_0x476927[_0xba301e[_0x3370('0x3e')][_0x3370('0x40')]()]=_0xba301e[_0x3370('0x41')][_0x3370('0x42')]();}else if(_[_0x3370('0x3b')]([_0x3370('0x3c'),'picklist'],_0xba301e[_0x3370('0x3d')])&&_0xba301e[_0x3370('0x43')]&&_0xba301e['customField']){_0x476927['custom_fields']['push']({'id':_0xba301e[_0x3370('0x43')],'value':_0xba301e[_0x3370('0x41')][_0x3370('0x42')]()});}else if(_0xba301e[_0x3370('0x3d')]===_0x3370('0x44')&&_0xba301e[_0x3370('0x45')]&&_0xba301e[_0x3370('0x43')]&&_0xba301e[_0x3370('0x3f')]){_0x51119d[_0xba301e[_0x3370('0x45')]]&&_0x476927['custom_fields'][_0x3370('0x46')]({'id':_0xba301e[_0x3370('0x43')],'value':_0x51119d[_0xba301e[_0x3370('0x45')]]['toString']()});}else if(_0xba301e['type']===_0x3370('0x47')&&_0xba301e[_0x3370('0x48')]&&_0xba301e[_0x3370('0x48')]['name']&&_0xba301e[_0x3370('0x43')]&&_0xba301e['customField']){_0x51119d[_0xba301e[_0x3370('0x48')][_0x3370('0x12')]['toLowerCase']()]&&_0x476927[_0x3370('0x49')][_0x3370('0x46')]({'id':_0xba301e['idField'],'value':_0x51119d[_0xba301e[_0x3370('0x48')]['name']['toLowerCase']()][_0x3370('0x42')]()});}});}return _0x476927;}exports['queue']=function(_0x37267e,_0x28db74,_0x1fb0c3,_0x41ebb0,_0x58466a,_0x1b4ba7){var _0x220a06,_0x17aaea;_0x1b4ba7[_0x3370('0xf')]=intUtil[_0x3370('0x4a')](_0x1b4ba7['remoteUri']);_0x1b4ba7[_0x3370('0x4b')]=intUtil[_0x3370('0x4a')](_0x1b4ba7[_0x3370('0x4b')]);if(_0x58466a&&_0x58466a[_0x3370('0x4c')]){logger[_0x3370('0xb')](_0x3370('0x4d'),_0x3370('0x4e'));_0x28db74[_0x3370('0x4f')]=util[_0x3370('0xd')](_0x3370('0x50'),_0x1b4ba7['serverUrl'],_0x28db74['uniqueid'],md5(_0x28db74[_0x3370('0x51')]));}else{_0x28db74[_0x3370('0x4f')]='';}headers[_0x3370('0x52')]=getAuth(_0x1b4ba7);return getUser(_0x1b4ba7,_0x41ebb0[_0x3370('0x53')])[_0x3370('0x15')](function(_0x1f657d){_0x220a06=_0x1f657d;logger[_0x3370('0xb')]('The\x20User\x20ID\x20is:',_0x220a06['id']);return getEndUser(_0x1b4ba7,_0x28db74['calleridname'],_0x28db74['calleridnum']);})['then'](function(_0x472f7b){_0x17aaea=_0x472f7b;logger[_0x3370('0xb')](_0x3370('0x54'),_0x17aaea['id']);return getTicket(_0x1b4ba7,_0x220a06,_0x17aaea,_0x1fb0c3,_0x28db74);})['then'](function(_0x358caa){if(_0x358caa){logger[_0x3370('0xb')](_0x3370('0x55'),_0x358caa['id']);switch(_0x1b4ba7[_0x3370('0x3d')]){case'integrationTab':logger[_0x3370('0xb')]('[QUEUE]',_0x3370('0x56'));return request({'uri':util[_0x3370('0xd')](_0x3370('0x57'),_0x1b4ba7[_0x3370('0xf')],_0x220a06['id'],_0x358caa['id']),'method':'POST'});case _0x3370('0x58'):logger[_0x3370('0xb')](_0x3370('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3370('0xd')](_0x3370('0x59'),_0x41ebb0['name']),_0x3370('0x5a'),{'uri':util[_0x3370('0xd')](_0x3370('0x5b'),_0x1b4ba7['remoteUri']['replace']('/api/v2',''),_0x358caa['id'])});break;default:logger['error'](_0x3370('0x4d'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x3370('0x5c')](function(_0x267241){logger['error'](_0x3370('0x5d'),util['inspect'](_0x267241,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x23cf19,_0x44983d,_0x5601a9,_0xc0b179,_0x21639a,_0x1bd3a7,_0x5befe8){var _0x5031b1,_0x62a9c7;_0x1bd3a7[_0x3370('0xf')]=intUtil[_0x3370('0x4a')](_0x1bd3a7[_0x3370('0xf')]);_0x1bd3a7['serverUrl']=intUtil[_0x3370('0x4a')](_0x1bd3a7[_0x3370('0x4b')]);if(_0x5befe8&&_0x5befe8['recordingFormat']&&_0x5befe8[_0x3370('0x5e')]!==_0x3370('0x5f')){logger['info'](_0x3370('0x60'),_0x3370('0x4e'));_0x44983d[_0x3370('0x4f')]=util[_0x3370('0xd')](_0x3370('0x50'),_0x1bd3a7[_0x3370('0x4b')],_0x44983d[_0x3370('0x51')],md5(_0x44983d['uniqueid']));}headers[_0x3370('0x52')]=getAuth(_0x1bd3a7);return getUser(_0x1bd3a7,_0xc0b179[_0x3370('0x53')])[_0x3370('0x15')](function(_0x282dce){_0x5031b1=_0x282dce;logger[_0x3370('0xb')](_0x3370('0x61'),_0x5031b1['id']);return getEndUser(_0x1bd3a7,_0x44983d['destcalleridname'],_0x44983d[_0x3370('0x62')]);})[_0x3370('0x15')](function(_0x19ed16){_0x62a9c7=_0x19ed16;logger[_0x3370('0xb')](_0x3370('0x54'),_0x62a9c7['id']);return getTicket(_0x1bd3a7,_0x5031b1,_0x62a9c7,_0x5601a9,_0x44983d);})[_0x3370('0x15')](function(_0x178152){if(_0x178152){logger[_0x3370('0xb')](_0x3370('0x55'),_0x178152['id']);switch(_0x1bd3a7[_0x3370('0x3d')]){case'integrationTab':logger[_0x3370('0xb')](_0x3370('0x60'),_0x3370('0x56'));return request({'uri':util[_0x3370('0xd')](_0x3370('0x57'),_0x1bd3a7[_0x3370('0xf')],_0x5031b1['id'],_0x178152['id']),'method':_0x3370('0x10')});case _0x3370('0x58'):logger[_0x3370('0xb')](_0x3370('0x60'),_0x3370('0x63'));emit(util[_0x3370('0xd')](_0x3370('0x59'),_0xc0b179[_0x3370('0x12')]),_0x3370('0x5a'),{'uri':util['format'](_0x3370('0x5b'),_0x1bd3a7['remoteUri'][_0x3370('0x64')]('/api/v2',''),_0x178152['id'])});break;default:logger[_0x3370('0x65')](_0x3370('0x60'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x3370('0x5c')](function(_0x2b2d94){logger['error'](_0x3370('0x66'),util[_0x3370('0x67')](_0x2b2d94,{'showHidden':!![],'depth':null}));});};exports[_0x3370('0x68')]=function(_0x3aee6f,_0x1b7a0a,_0x5297b1,_0x47813f,_0x3a05f6,_0x1ae1bf){var _0x367fa2,_0x1260bf;_0x1ae1bf[_0x3370('0xf')]=intUtil[_0x3370('0x4a')](_0x1ae1bf[_0x3370('0xf')]);_0x1ae1bf['serverUrl']=intUtil[_0x3370('0x4a')](_0x1ae1bf[_0x3370('0x4b')]);if(_0x3a05f6&&_0x3a05f6[_0x3370('0x4c')]){logger[_0x3370('0xb')]('['+_0x1b7a0a[_0x3370('0x69')][_0x3370('0x6a')]()+']',_0x3370('0x4e'));_0x1b7a0a[_0x3370('0x4f')]=util['format'](_0x3370('0x50'),_0x1ae1bf[_0x3370('0x4b')],_0x1b7a0a[_0x3370('0x51')],md5(_0x1b7a0a[_0x3370('0x51')]));}else{_0x1b7a0a['recordingURL']='';}headers[_0x3370('0x52')]=getAuth(_0x1ae1bf);return getUser(_0x1ae1bf)[_0x3370('0x15')](function(_0x175c39){_0x367fa2=_0x175c39;logger[_0x3370('0xb')](_0x3370('0x61'),_0x367fa2['id']);return getEndUser(_0x1ae1bf,_0x1b7a0a[_0x3370('0x6b')],_0x1b7a0a[_0x3370('0x6c')]);})[_0x3370('0x15')](function(_0x159b83){_0x1260bf=_0x159b83;logger[_0x3370('0xb')](_0x3370('0x54'),_0x1260bf['id']);return getTicket(_0x1ae1bf,_0x367fa2,_0x1260bf,_0x5297b1,_0x1b7a0a);})[_0x3370('0x15')](function(_0x1485ee){if(_0x1485ee){logger[_0x3370('0xb')](_0x3370('0x55'),_0x1485ee['id']);}})[_0x3370('0x5c')](function(_0x18db94){logger[_0x3370('0x65')]('['+_0x1b7a0a['lastevent'][_0x3370('0x6a')]()+']'+_0x3370('0x6d'),util['inspect'](_0x18db94,{'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 8782004..0d1d437 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 _0xf963=['endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Inbound','Fields','/crm/v2/Calls','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','unmanaged','monitor_format','toUpperCase','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','includes','picklist','type','idField','content','toString','variableName','Variable','name','toLowerCase','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientSecret','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','Creating\x20new\x20call...','administrator','getString','Subjects','Descriptions','Who_Id','First_Name','Last_Name','What_Id','Full_Name','utc','format','Call_Duration'];(function(_0xc13040,_0x27a5bb){var _0x456f31=function(_0x224b69){while(--_0x224b69){_0xc13040['push'](_0xc13040['shift']());}};_0x456f31(++_0x27a5bb);}(_0xf963,0x161));var _0x3f96=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf963[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var rp=require(_0x3f96('0x0'));var md5=require(_0x3f96('0x1'));var util=require(_0x3f96('0x2'));var intUtil=require(_0x3f96('0x3'));var moment=require(_0x3f96('0x4'));var Redis=require('ioredis');var BPromise=require(_0x3f96('0x5'));var config=require(_0x3f96('0x6'));var logger=require(_0x3f96('0x7'))(_0x3f96('0x8'));config['redis']=_[_0x3f96('0x9')](config[_0x3f96('0xa')],{'host':_0x3f96('0xb'),'port':0x18eb});var io=require(_0x3f96('0xc'))(new Redis(config[_0x3f96('0xa')]));function emit(_0x20070c,_0x59151f,_0x59828){io['to'](_0x20070c)[_0x3f96('0xd')](_0x59151f,_0x59828);}function request(_0x498ef8){logger[_0x3f96('0xe')](_0x3f96('0xf'),JSON[_0x3f96('0x10')](_0x498ef8));return rp(_0x498ef8);}function getCustomFields(_0x3cedd7,_0x40903d){var _0x368ea2={};if(_0x3cedd7[_0x3f96('0x11')]>0x0){_['forEach'](_0x3cedd7,function(_0x4968c1){if(_[_0x3f96('0x12')](['string',_0x3f96('0x13')],_0x4968c1[_0x3f96('0x14')])&&_0x4968c1[_0x3f96('0x15')]){_0x368ea2[_0x4968c1['idField']]=_0x4968c1[_0x3f96('0x16')][_0x3f96('0x17')]();}else if(_0x4968c1[_0x3f96('0x14')]==='variable'&&_0x4968c1['variableName']&&_0x4968c1[_0x3f96('0x15')]&&_0x40903d[_0x4968c1[_0x3f96('0x18')]]){_0x368ea2[_0x4968c1[_0x3f96('0x15')]]=_0x40903d[_0x4968c1[_0x3f96('0x18')]][_0x3f96('0x17')]();}else if(_0x4968c1['type']==='customVariable'&&_0x4968c1['Variable']&&_0x4968c1[_0x3f96('0x19')][_0x3f96('0x1a')]&&_0x4968c1[_0x3f96('0x15')]&&_0x40903d[_0x4968c1['Variable'][_0x3f96('0x1a')]['toLowerCase']()]){_0x368ea2[_0x4968c1[_0x3f96('0x15')]]=_0x40903d[_0x4968c1[_0x3f96('0x19')]['name'][_0x3f96('0x1b')]()][_0x3f96('0x17')]();}});}return _0x368ea2;}function getName(_0x55d8b2){if(_0x55d8b2['indexOf']('\x20')>0x0){var _0x15386d=_0x55d8b2[_0x3f96('0x1c')](/ (.+)/);if(_0x15386d[0x1]){return _0x15386d;}}return[_0x55d8b2,_0x55d8b2];}var accountsTokens={};function getAccessToken(_0x2bb330){return new Promise(function(_0x24e915,_0xd4f301){if(!_[_0x3f96('0x1d')](accountsTokens[_0x2bb330['id']])&&!_[_0x3f96('0x1d')](accountsTokens[_0x2bb330['id']][_0x3f96('0x1e')])){if(moment()['isBefore'](accountsTokens[_0x2bb330['id']][_0x3f96('0x1f')])){_0x24e915(accountsTokens[_0x2bb330['id']][_0x3f96('0x1e')]);}}var _0x4e1398;switch(_0x2bb330['zone']){case'US':_0x4e1398=_0x3f96('0x20');break;case'AU':_0x4e1398='https://accounts.zoho.com.au';break;case'EU':_0x4e1398='https://accounts.zoho.eu';break;case'IN':_0x4e1398=_0x3f96('0x21');break;case'CN':_0x4e1398=_0x3f96('0x22');break;default:_0x4e1398=_0x3f96('0x23');break;}var _0x4c3913={'method':_0x3f96('0x24'),'uri':_0x4e1398+'/oauth/v2/token','qs':{'refresh_token':_0x2bb330[_0x3f96('0x25')],'client_id':_0x2bb330['clientId'],'client_secret':_0x2bb330[_0x3f96('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4c3913)[_0x3f96('0x27')](function(_0x350801){accountsTokens[_0x2bb330['id']]={'access_token':_0x350801[_0x3f96('0x1e')],'expires_in':moment()[_0x3f96('0x28')](_0x350801[_0x3f96('0x1f')],_0x3f96('0x29'))};_0x24e915(_0x350801[_0x3f96('0x1e')]);})['catch'](function(_0x492a98){logger[_0x3f96('0x2a')](_0x3f96('0x2b'),_0x492a98[_0x3f96('0x2c')]);_0xd4f301(_0x492a98);});});}function getUser(_0x2f0d55,_0x224bf6,_0x27864a,_0x3a2bdf){logger[_0x3f96('0x2d')](_0x3f96('0x2e'));return request({'method':_0x3f96('0x2f'),'uri':util['format'](_0x3f96('0x30'),_0x224bf6),'qs':{'type':_0x3f96('0x31')},'headers':{'Authorization':_0x3f96('0x32')+_0x2f0d55},'json':!![]})['then'](function(_0xaedb3e){if(_0xaedb3e[_0x3f96('0x33')]){var _0x535863=-0x1;if(_[_0x3f96('0x34')](_0xaedb3e[_0x3f96('0x33')])){if(!_[_0x3f96('0x1d')](_0x3a2bdf)){_0x535863=_[_0x3f96('0x35')](_0xaedb3e[_0x3f96('0x33')],function(_0x45cced){return _0x45cced[_0x3f96('0x36')]===_0x3a2bdf;});}if(_0x535863>=0x0){logger[_0x3f96('0x2d')](_0x3f96('0x37'));}else{logger[_0x3f96('0x2d')]('Using\x20the\x20admin\x20account!');_0x535863=_['findIndex'](_0xaedb3e[_0x3f96('0x33')],function(_0x181525){return _0x181525[_0x3f96('0x38')][_0x3f96('0x1a')]==='Administrator';});}return _0xaedb3e['users'][_0x535863];}else{if(_0xaedb3e['user'][_0x3f96('0x38')][_0x3f96('0x1a')]===_0x3f96('0x39')){logger[_0x3f96('0x2d')]('Using\x20the\x20admin\x20account!');user=_0xaedb3e[_0x3f96('0x3a')];return user;}else{logger['error'](_0x3f96('0x3b'),JSON[_0x3f96('0x10')](_0xaedb3e));throw new Error(_0x3f96('0x3c')+JSON[_0x3f96('0x10')](_0xaedb3e));}}}else{logger[_0x3f96('0x2a')](_0x3f96('0x3b'),JSON[_0x3f96('0x10')](_0xaedb3e));throw new Error(_0x3f96('0x3c')+JSON[_0x3f96('0x10')](_0xaedb3e));}})[_0x3f96('0x3d')](function(_0x4a61c5){console[_0x3f96('0x2a')](_0x4a61c5);});}function getZohoUser(_0x581d20,_0x3e38d5){return new BPromise(function(_0x18ef9d,_0x35c49a){request(_0x581d20)[_0x3f96('0x27')](function(_0x2449c7){var _0x8e750d=null;if(_0x2449c7){_0x8e750d=_0x2449c7[_0x3f96('0x3e')][0x0];_0x8e750d[_0x3f96('0x3f')]=_0x3e38d5;}_0x18ef9d(_0x8e750d);})[_0x3f96('0x3d')](function(_0x35f291){_0x35c49a(_0x35f291);});});}function createEndUser(_0x5e043a,_0x34eb13,_0xc9f34f,_0x332614,_0x19ebdf,_0x329cfd){var _0xc9f34f=getName(_0xc9f34f);return request({'method':'POST','uri':_0x3f96('0x40')+_0x34eb13+_0x3f96('0x41')+_['startCase'](_0x329cfd[_0x3f96('0x42')])+'s','body':{'data':[{'Last_Name':_0xc9f34f[0x1],'First_Name':_0xc9f34f[0x0],'Phone':_0x332614,'Owner':{'name':!_[_0x3f96('0x1d')](_0x19ebdf[_0x3f96('0x43')][_0x3f96('0x1a')])?_0x19ebdf[_0x3f96('0x43')][_0x3f96('0x1a')]:!_[_0x3f96('0x1d')](_0x19ebdf[_0x3f96('0x44')])?_0x19ebdf[_0x3f96('0x44')]+'\x20'+_0x19ebdf[_0x3f96('0x45')]:_0x19ebdf['last_name'],'id':_0x19ebdf['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5e043a},'json':!![]})[_0x3f96('0x27')](function(_0x129a53){if(_0x129a53&&_0x129a53[_0x3f96('0x3e')][0x0][_0x3f96('0x46')]===_0x3f96('0x47')){var _0x212391=_0x129a53[_0x3f96('0x3e')][0x0]['details'];_0x212391[_0x3f96('0x3f')]=_[_0x3f96('0x48')](_0x329cfd[_0x3f96('0x42')])+'s';return _0x212391;}logger[_0x3f96('0x2a')](_0x3f96('0x3b'),JSON['stringify'](data));throw new Error(_0x3f96('0x49')+JSON[_0x3f96('0x10')](data));})[_0x3f96('0x3d')](function(_0x2db21c){console[_0x3f96('0x4a')](_0x3f96('0x4b'),_0x2db21c);});}function getEndUser(_0x2168bb,_0x2b1052,_0x41c7dc,_0x43c838,_0x3e8f35,_0x366364,_0x27d7e4){var _0x2b193d={'method':_0x3f96('0x2f'),'uri':'','headers':{'Authorization':_0x3f96('0x32')+_0x2168bb},'json':!![]};switch(_0x27d7e4[_0x3f96('0x4c')]){case'contact_lead':_0x2b193d[_0x3f96('0x4d')]=_0x3f96('0x40')+_0x2b1052+_0x3f96('0x4e')+_0x3e8f35+'))';return getZohoUser(_0x2b193d,_0x3f96('0x4f'))['then'](function(_0xd1ecb1){if(_0xd1ecb1)return _0xd1ecb1;_0x2b193d[_0x3f96('0x4d')]=_0x3f96('0x40')+_0x2b1052+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x3e8f35+'))';return getZohoUser(_0x2b193d,_0x3f96('0x50'))[_0x3f96('0x27')](function(_0x6dc0d3){if(_0x6dc0d3)return _0x6dc0d3;if(_0x27d7e4[_0x3f96('0x42')]!='nothing'){return createEndUser(_0x2168bb,_0x2b1052,_0x43c838,_0x3e8f35,_0x366364,_0x27d7e4);}else{return{};}});});break;case'contact':_0x2b193d[_0x3f96('0x4d')]='https://www.zohoapis.'+_0x2b1052+_0x3f96('0x4e')+_0x3e8f35+'))';return getZohoUser(_0x2b193d,_0x3f96('0x4f'))[_0x3f96('0x27')](function(_0x17b595){if(_0x17b595)return _0x17b595;if(_0x27d7e4[_0x3f96('0x42')]!='nothing'){return createEndUser(_0x2168bb,_0x2b1052,_0x43c838,_0x3e8f35,_0x366364,_0x27d7e4);}else{return{};}});break;case _0x3f96('0x51'):_0x2b193d[_0x3f96('0x4d')]=_0x3f96('0x40')+_0x2b1052+_0x3f96('0x52')+_0x3e8f35+'))';return getZohoUser(_0x2b193d,_0x3f96('0x50'))[_0x3f96('0x27')](function(_0x4583dc){if(_0x4583dc)return _0x4583dc;if(_0x27d7e4['moduleCreate']!=_0x3f96('0x53')){return createEndUser(_0x2168bb,_0x2b1052,_0x43c838,_0x3e8f35,_0x366364,_0x27d7e4);}else{return{};}});break;}}function getCall(_0x23d1af,_0x1cc3d6,_0x27e8ca,_0x205f64,_0x156b77,_0x32aed8,_0x5a5d3c,_0x3ebac7){logger[_0x3f96('0x2d')](_0x3f96('0x54'));var _0x3f9bd9={};_0x3f9bd9['Owner']={'name':!_['isNil'](_0x205f64[_0x3f96('0x43')][_0x3f96('0x1a')])&&!_['isNil'](_0x205f64[_0x3f96('0x38')][_0x3f96('0x1a')])&&_0x205f64[_0x3f96('0x38')][_0x3f96('0x1a')]===_0x3f96('0x55')?_0x205f64[_0x3f96('0x43')]['name']:!_[_0x3f96('0x1d')](_0x205f64[_0x3f96('0x44')])?_0x205f64[_0x3f96('0x44')]+'\x20'+_0x205f64[_0x3f96('0x45')]:_0x205f64[_0x3f96('0x45')],'id':_0x205f64['id']};_0x3f9bd9['Subject']=intUtil[_0x3f96('0x56')](_0x32aed8[_0x3f96('0x57')],_0x5a5d3c,'\x20');_0x3f9bd9['Description']=intUtil[_0x3f96('0x56')](_0x32aed8[_0x3f96('0x58')],_0x5a5d3c,'\x0a');if(_0x156b77[_0x3f96('0x3f')]===_0x3f96('0x4f')){_0x3f9bd9[_0x3f96('0x59')]={'name':!_[_0x3f96('0x1d')](_0x156b77['Full_Name'])?_0x156b77['Full_Name']:!_['isNil'](_0x156b77[_0x3f96('0x5a')])?_0x156b77[_0x3f96('0x5a')]+'\x20'+_0x156b77[_0x3f96('0x5b')]:_0x156b77[_0x3f96('0x5b')],'id':_0x156b77['id']};}if(_0x156b77[_0x3f96('0x3f')]===_0x3f96('0x50')){_0x3f9bd9[_0x3f96('0x5c')]={'name':!_[_0x3f96('0x1d')](_0x156b77[_0x3f96('0x5d')])?_0x156b77[_0x3f96('0x5d')]:!_[_0x3f96('0x1d')](_0x156b77[_0x3f96('0x5a')])?_0x156b77[_0x3f96('0x5a')]+'\x20'+_0x156b77[_0x3f96('0x5b')]:_0x156b77['Last_Name'],'id':_0x156b77['id']};_0x3f9bd9['$se_module']=_[_0x3f96('0x48')](_0x156b77[_0x3f96('0x3f')]);}if(_0x5a5d3c['talktime']){_0x3f9bd9['Call_Duration']=moment[_0x3f96('0x5e')](parseInt(_0x5a5d3c['talktime'])*0x3e8)[_0x3f96('0x5f')]('mm:ss');}else if(_0x5a5d3c['answertime']&&_0x5a5d3c['endtime']){_0x3f9bd9[_0x3f96('0x60')]=moment[_0x3f96('0x5e')](moment(_0x5a5d3c[_0x3f96('0x61')],_0x3f96('0x62'))[_0x3f96('0x63')](moment(_0x5a5d3c[_0x3f96('0x64')],'YYYY-MM-DDTHH:mm:ss')))[_0x3f96('0x5f')](_0x3f96('0x65'));}switch(_0x5a5d3c[_0x3f96('0x66')]){case _0x3f96('0x67'):_0x3f9bd9[_0x3f96('0x68')]=_0x3f96('0x69');break;case'complete':case _0x3f96('0x6a'):_0x3f9bd9[_0x3f96('0x68')]=_0x3f96('0x6b');break;case _0x3f96('0x6c'):_0x3f9bd9[_0x3f96('0x68')]=_0x3f96('0x6d');break;case'abandoned':_0x3f9bd9[_0x3f96('0x68')]=_0x3f96('0x6e');break;case _0x3f96('0x6f'):_0x3f9bd9['Call_Result']=_0x3f96('0x70');default:}_0x3f9bd9[_0x3f96('0x71')]=(_0x3ebac7==='outbound'?moment(_0x5a5d3c[_0x3f96('0x64')])['format'](_0x3f96('0x62')):moment(_0x5a5d3c[_0x3f96('0x72')])[_0x3f96('0x5f')](_0x3f96('0x62')))||moment()[_0x3f96('0x5f')](_0x3f96('0x62'));_0x3f9bd9['Call_Type']=_0x3ebac7||_0x3f96('0x73');_0x3f9bd9=_['merge'](_0x3f9bd9,getCustomFields(_0x32aed8[_0x3f96('0x74')],_0x5a5d3c));return request({'method':_0x3f96('0x24'),'uri':'https://www.zohoapis.'+_0x1cc3d6+_0x3f96('0x75'),'headers':{'Authorization':_0x3f96('0x32')+_0x23d1af},'body':{'data':[_0x3f9bd9]},'json':!![]})[_0x3f96('0x27')](function(_0xd2e3cf){if(_0xd2e3cf&&_0xd2e3cf['data'][0x0]['code']===_0x3f96('0x47')){logger['info'](_0x3f96('0x76'));return{'id':_0xd2e3cf[_0x3f96('0x3e')][0x0][_0x3f96('0x77')]['id']};}})[_0x3f96('0x3d')](function(_0xa365d1){logger[_0x3f96('0x2d')]('err',_0xa365d1['stack']);console[_0x3f96('0x4a')](_0x3f96('0x78'),_0xa365d1);});}exports[_0x3f96('0x79')]=function(_0x24b578,_0x33a317,_0x24fdce,_0x3c7dd0,_0x131942,_0x1062ee){var _0xdbdf8f,_0x23f6dc,_0x3c3b21;_0x1062ee[_0x3f96('0x7a')]=intUtil[_0x3f96('0x7b')](_0x1062ee[_0x3f96('0x7a')]);_0x1062ee['serverUrl']=intUtil['stripTrailingSlash'](_0x1062ee[_0x3f96('0x7c')]);if(_0x131942&&_0x131942['monitor_format']){logger[_0x3f96('0x2d')](_0x3f96('0x7d'),'Recording\x20is\x20enabled!');_0x33a317[_0x3f96('0x7e')]=_0x1062ee[_0x3f96('0x7c')]+_0x3f96('0x7f')+_0x33a317[_0x3f96('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x33a317['uniqueid']);}else{_0x33a317[_0x3f96('0x7e')]='';}var _0x1676fc=_0x1062ee[_0x3f96('0x7a')]==='zoho.eu'?'eu':_0x3f96('0x81');return getAccessToken(_0x1062ee)[_0x3f96('0x27')](function(_0x104eda){_0x3c3b21=_0x104eda;return getUser(_0x3c3b21,_0x1676fc,_0x1062ee,_0x3c7dd0[_0x3f96('0x36')]);})[_0x3f96('0x27')](function(_0x50f5b2){_0xdbdf8f=_0x50f5b2;logger[_0x3f96('0x2d')]('The\x20User\x20ID\x20is:',_0xdbdf8f['id']);return getEndUser(_0x3c3b21,_0x1676fc,_0x1062ee,_0x33a317[_0x3f96('0x82')],_0x33a317[_0x3f96('0x83')],_0xdbdf8f,_0x24fdce);})[_0x3f96('0x27')](function(_0x4284ce){_0x23f6dc=_0x4284ce;return getCall(_0x3c3b21,_0x1676fc,_0x1062ee,_0xdbdf8f,_0x23f6dc,_0x24fdce,_0x33a317,_0x3f96('0x73'));})[_0x3f96('0x27')](function(_0x12f4af){if(_0x12f4af){logger['info'](_0x3f96('0x84'),_0x12f4af['id']);logger[_0x3f96('0x2d')]('[QUEUE]',_0x3f96('0x85'));emit(util[_0x3f96('0x5f')](_0x3f96('0x86'),_0x3c7dd0['name']),_0x3f96('0x87'),{'uri':_0x3f96('0x88')+_0x1062ee[_0x3f96('0x7a')]+_0x3f96('0x89')+_0x12f4af['id']});}})[_0x3f96('0x3d')](function(_0x56331e){logger[_0x3f96('0x2a')]('[QUEUE]',JSON[_0x3f96('0x10')](_0x56331e));});};exports[_0x3f96('0x8a')]=function(_0x26ca5a,_0x5c3f46,_0x27ec58,_0x46b747,_0xfd112d,_0x3855f2,_0x4f7e87){var _0x5d7cb9,_0x4d3d7a,_0x1a9e70;_0x3855f2[_0x3f96('0x7a')]=intUtil[_0x3f96('0x7b')](_0x3855f2[_0x3f96('0x7a')]);_0x3855f2[_0x3f96('0x7c')]=intUtil[_0x3f96('0x7b')](_0x3855f2[_0x3f96('0x7c')]);if(_0x4f7e87&&_0x4f7e87[_0x3f96('0x8b')]&&_0x4f7e87[_0x3f96('0x8b')]!=='none'){logger[_0x3f96('0x2d')](_0x3f96('0x8c'),_0x3f96('0x8d'));_0x5c3f46['recordingURL']=_0x3855f2[_0x3f96('0x7c')]+_0x3f96('0x7f')+_0x5c3f46[_0x3f96('0x80')]+_0x3f96('0x8e')+md5(_0x5c3f46[_0x3f96('0x80')]);}var _0x263961=_0x3855f2[_0x3f96('0x7a')]===_0x3f96('0x8f')?'eu':'com';return getAccessToken(_0x3855f2)[_0x3f96('0x27')](function(_0x200ea4){_0x1a9e70=_0x200ea4;return getUser(_0x1a9e70,_0x263961,_0x3855f2,_0x46b747[_0x3f96('0x36')]);})[_0x3f96('0x27')](function(_0x11cdee){_0x5d7cb9=_0x11cdee;logger['info'](_0x3f96('0x90'),_0x5d7cb9['id']);return getEndUser(_0x1a9e70,_0x263961,_0x3855f2,_0x5c3f46[_0x3f96('0x91')],_0x5c3f46[_0x3f96('0x92')],_0x5d7cb9,_0x27ec58);})['then'](function(_0x1e95bd){_0x4d3d7a=_0x1e95bd;return getCall(_0x1a9e70,_0x263961,_0x3855f2,_0x5d7cb9,_0x4d3d7a,_0x27ec58,_0x5c3f46,'Outbound');})[_0x3f96('0x27')](function(_0x320b29){if(_0x320b29){logger['info'](_0x3f96('0x84'),_0x320b29['id']);logger['info'](_0x3f96('0x8c'),_0x3f96('0x85'));emit(util[_0x3f96('0x5f')](_0x3f96('0x86'),_0x46b747[_0x3f96('0x1a')]),_0x3f96('0x87'),{'uri':_0x3f96('0x88')+_0x3855f2[_0x3f96('0x7a')]+_0x3f96('0x89')+_0x320b29['id']});}})[_0x3f96('0x3d')](function(_0x39c028){logger[_0x3f96('0x2a')](_0x3f96('0x8c'),JSON[_0x3f96('0x10')](_0x39c028));});};exports[_0x3f96('0x93')]=function(_0x1ec98a,_0xb5b59,_0x25c10b,_0x23a393,_0x5ba525,_0x560ff5){var _0x3c5cb6,_0x1c51f7,_0x5802eb;_0x560ff5['host']=intUtil[_0x3f96('0x7b')](_0x560ff5['host']);_0x560ff5['serverUrl']=intUtil[_0x3f96('0x7b')](_0x560ff5[_0x3f96('0x7c')]);if(_0x5ba525&&_0x5ba525[_0x3f96('0x94')]){logger[_0x3f96('0x2d')]('['+_0xb5b59[_0x3f96('0x66')][_0x3f96('0x95')]()+']',_0x3f96('0x8d'));_0xb5b59[_0x3f96('0x7e')]=_0x560ff5[_0x3f96('0x7c')]+'/api/voice/recordings/'+_0xb5b59[_0x3f96('0x80')]+'/downloads?type=uniqueid&token='+md5(_0xb5b59[_0x3f96('0x80')]);}else{_0xb5b59[_0x3f96('0x7e')]='';}var _0x57bdf0=_0x560ff5['host']===_0x3f96('0x8f')?'eu':_0x3f96('0x81');return getAccessToken(_0x560ff5)[_0x3f96('0x27')](function(_0x143f7f){_0x5802eb=_0x143f7f;return getUser(_0x5802eb,_0x57bdf0,_0x560ff5);})[_0x3f96('0x27')](function(_0x3b9505){_0x3c5cb6=_0x3b9505;logger[_0x3f96('0x2d')](_0x3f96('0x90'),_0x3c5cb6['id']);return getEndUser(_0x5802eb,_0x57bdf0,_0x560ff5,_0xb5b59[_0x3f96('0x82')],_0xb5b59[_0x3f96('0x83')],_0x3c5cb6,_0x25c10b);})[_0x3f96('0x27')](function(_0xe7de82){_0x1c51f7=_0xe7de82;return getCall(_0x5802eb,_0x57bdf0,_0x560ff5,_0x3c5cb6,_0x1c51f7,_0x25c10b,_0xb5b59,'Inbound');})['then'](function(_0x41fb67){if(_0x41fb67){logger[_0x3f96('0x2d')](_0x3f96('0x84'),_0x41fb67['id']);}})['catch'](function(_0x18b11b){logger[_0x3f96('0x2a')]('['+_0xb5b59[_0x3f96('0x66')]['toUpperCase']()+']',JSON[_0x3f96('0x10')](_0x18b11b));});}; \ No newline at end of file +var _0xe85d=['/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','Call_Result','Called','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Inbound','merge','Fields','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','zoho.eu','destcalleridname','destcalleridnum','unmanaged','lastevent','toUpperCase','/api/voice/recordings/','uniqueid','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','catch','error','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','then','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','nothing','contact','lead'];(function(_0x29b2d0,_0x73bf4b){var _0x4af937=function(_0x1b19c9){while(--_0x1b19c9){_0x29b2d0['push'](_0x29b2d0['shift']());}};_0x4af937(++_0x73bf4b);}(_0xe85d,0x184));var _0xde85=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xe85d[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0xde85('0x0'));var rp=require(_0xde85('0x1'));var md5=require(_0xde85('0x2'));var util=require(_0xde85('0x3'));var intUtil=require(_0xde85('0x4'));var moment=require(_0xde85('0x5'));var Redis=require(_0xde85('0x6'));var BPromise=require(_0xde85('0x7'));var config=require(_0xde85('0x8'));var logger=require(_0xde85('0x9'))(_0xde85('0xa'));config[_0xde85('0xb')]=_[_0xde85('0xc')](config['redis'],{'host':_0xde85('0xd'),'port':0x18eb});var io=require(_0xde85('0xe'))(new Redis(config['redis']));function emit(_0x1a6d3d,_0x30c7f8,_0x1223f4){io['to'](_0x1a6d3d)[_0xde85('0xf')](_0x30c7f8,_0x1223f4);}function request(_0x3e1148){logger[_0xde85('0x10')](_0xde85('0x11'),JSON[_0xde85('0x12')](_0x3e1148));return rp(_0x3e1148);}function getCustomFields(_0x217ad7,_0x1f504f){var _0x19a19b={};if(_0x217ad7[_0xde85('0x13')]>0x0){_[_0xde85('0x14')](_0x217ad7,function(_0x2333b6){if(_[_0xde85('0x15')](['string',_0xde85('0x16')],_0x2333b6[_0xde85('0x17')])&&_0x2333b6[_0xde85('0x18')]){_0x19a19b[_0x2333b6[_0xde85('0x18')]]=_0x2333b6[_0xde85('0x19')][_0xde85('0x1a')]();}else if(_0x2333b6[_0xde85('0x17')]===_0xde85('0x1b')&&_0x2333b6[_0xde85('0x1c')]&&_0x2333b6[_0xde85('0x18')]&&_0x1f504f[_0x2333b6[_0xde85('0x1c')]]){_0x19a19b[_0x2333b6[_0xde85('0x18')]]=_0x1f504f[_0x2333b6['variableName']]['toString']();}else if(_0x2333b6['type']===_0xde85('0x1d')&&_0x2333b6[_0xde85('0x1e')]&&_0x2333b6[_0xde85('0x1e')]['name']&&_0x2333b6[_0xde85('0x18')]&&_0x1f504f[_0x2333b6[_0xde85('0x1e')][_0xde85('0x1f')][_0xde85('0x20')]()]){_0x19a19b[_0x2333b6['idField']]=_0x1f504f[_0x2333b6['Variable']['name']['toLowerCase']()][_0xde85('0x1a')]();}});}return _0x19a19b;}function getName(_0x400a4f){if(_0x400a4f['indexOf']('\x20')>0x0){var _0x23fe36=_0x400a4f['split'](/ (.+)/);if(_0x23fe36[0x1]){return _0x23fe36;}}return[_0x400a4f,_0x400a4f];}var accountsTokens={};function getAccessToken(_0x303230){return new Promise(function(_0x3bf6fd,_0x2218d0){if(!_[_0xde85('0x21')](accountsTokens[_0x303230['id']])&&!_[_0xde85('0x21')](accountsTokens[_0x303230['id']][_0xde85('0x22')])){if(moment()[_0xde85('0x23')](accountsTokens[_0x303230['id']][_0xde85('0x24')])){_0x3bf6fd(accountsTokens[_0x303230['id']][_0xde85('0x22')]);}}var _0x52b4ee;switch(_0x303230[_0xde85('0x25')]){case'US':_0x52b4ee='https://accounts.zoho.com';break;case'AU':_0x52b4ee=_0xde85('0x26');break;case'EU':_0x52b4ee=_0xde85('0x27');break;case'IN':_0x52b4ee=_0xde85('0x28');break;case'CN':_0x52b4ee=_0xde85('0x29');break;default:_0x52b4ee='https://accounts.zoho.eu';break;}var _0x10ade2={'method':_0xde85('0x2a'),'uri':_0x52b4ee+_0xde85('0x2b'),'qs':{'refresh_token':_0x303230[_0xde85('0x2c')],'client_id':_0x303230[_0xde85('0x2d')],'client_secret':_0x303230[_0xde85('0x2e')],'grant_type':_0xde85('0x2f')},'json':!![]};return rp(_0x10ade2)['then'](function(_0x167ca6){accountsTokens[_0x303230['id']]={'access_token':_0x167ca6['access_token'],'expires_in':moment()[_0xde85('0x30')](_0x167ca6[_0xde85('0x24')],'seconds')};_0x3bf6fd(_0x167ca6['access_token']);})[_0xde85('0x31')](function(_0x21dfda){logger[_0xde85('0x32')]('Failing\x20creating\x20the\x20access_token',_0x21dfda[_0xde85('0x33')]);_0x2218d0(_0x21dfda);});});}function getUser(_0x3080d9,_0xbd532f,_0x1d67da,_0x16e516){logger[_0xde85('0x34')](_0xde85('0x35'));return request({'method':'GET','uri':util[_0xde85('0x36')](_0xde85('0x37'),_0xbd532f),'qs':{'type':_0xde85('0x38')},'headers':{'Authorization':_0xde85('0x39')+_0x3080d9},'json':!![]})['then'](function(_0x4181ab){if(_0x4181ab[_0xde85('0x3a')]){var _0x382ce3=-0x1;if(_[_0xde85('0x3b')](_0x4181ab[_0xde85('0x3a')])){if(!_[_0xde85('0x21')](_0x16e516)){_0x382ce3=_[_0xde85('0x3c')](_0x4181ab[_0xde85('0x3a')],function(_0x27c082){return _0x27c082[_0xde85('0x3d')]===_0x16e516;});}if(_0x382ce3>=0x0){logger[_0xde85('0x34')](_0xde85('0x3e'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x382ce3=_[_0xde85('0x3c')](_0x4181ab[_0xde85('0x3a')],function(_0xa71bf3){return _0xa71bf3[_0xde85('0x3f')]['name']===_0xde85('0x40');});}return _0x4181ab[_0xde85('0x3a')][_0x382ce3];}else{if(_0x4181ab[_0xde85('0x41')][_0xde85('0x3f')][_0xde85('0x1f')]===_0xde85('0x40')){logger[_0xde85('0x34')]('Using\x20the\x20admin\x20account!');user=_0x4181ab[_0xde85('0x41')];return user;}else{logger[_0xde85('0x32')](_0xde85('0x42'),JSON[_0xde85('0x12')](_0x4181ab));throw new Error(_0xde85('0x43')+JSON['stringify'](_0x4181ab));}}}else{logger[_0xde85('0x32')](_0xde85('0x42'),JSON['stringify'](_0x4181ab));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xde85('0x12')](_0x4181ab));}})['catch'](function(_0x43b407){console['error'](_0x43b407);});}function getZohoUser(_0xc1ba7d,_0x527a72){return new BPromise(function(_0x19d3db,_0x4f5183){request(_0xc1ba7d)['then'](function(_0x428fa7){var _0x49cc43=null;if(_0x428fa7){_0x49cc43=_0x428fa7[_0xde85('0x44')][0x0];_0x49cc43[_0xde85('0x45')]=_0x527a72;}_0x19d3db(_0x49cc43);})[_0xde85('0x31')](function(_0x550034){_0x4f5183(_0x550034);});});}function createEndUser(_0x397fd4,_0x23c3bb,_0x23db0b,_0x2ff456,_0x53ece8,_0x24bf22){var _0x23db0b=getName(_0x23db0b);return request({'method':'POST','uri':_0xde85('0x46')+_0x23c3bb+_0xde85('0x47')+_[_0xde85('0x48')](_0x24bf22[_0xde85('0x49')])+'s','body':{'data':[{'Last_Name':_0x23db0b[0x1],'First_Name':_0x23db0b[0x0],'Phone':_0x2ff456,'Owner':{'name':!_[_0xde85('0x21')](_0x53ece8[_0xde85('0x4a')]['name'])?_0x53ece8[_0xde85('0x4a')]['name']:!_[_0xde85('0x21')](_0x53ece8[_0xde85('0x4b')])?_0x53ece8[_0xde85('0x4b')]+'\x20'+_0x53ece8[_0xde85('0x4c')]:_0x53ece8[_0xde85('0x4c')],'id':_0x53ece8['id']}}]},'headers':{'Authorization':_0xde85('0x39')+_0x397fd4},'json':!![]})[_0xde85('0x4d')](function(_0x2efe91){if(_0x2efe91&&_0x2efe91[_0xde85('0x44')][0x0][_0xde85('0x4e')]===_0xde85('0x4f')){var _0x32e80d=_0x2efe91['data'][0x0][_0xde85('0x50')];_0x32e80d[_0xde85('0x45')]=_[_0xde85('0x48')](_0x24bf22[_0xde85('0x49')])+'s';return _0x32e80d;}logger[_0xde85('0x32')](_0xde85('0x42'),JSON[_0xde85('0x12')](data));throw new Error(_0xde85('0x51')+JSON[_0xde85('0x12')](data));})[_0xde85('0x31')](function(_0x135035){console[_0xde85('0x52')](_0xde85('0x53'),_0x135035);});}function getEndUser(_0x35a8f8,_0xa6a3cb,_0x48863c,_0x585f7f,_0x5e00ff,_0x3165bc,_0x1986fe){var _0x2c121f={'method':_0xde85('0x54'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x35a8f8},'json':!![]};switch(_0x1986fe['moduleSearch']){case _0xde85('0x55'):_0x2c121f['uri']='https://www.zohoapis.'+_0xa6a3cb+_0xde85('0x56')+_0x5e00ff+'))';return getZohoUser(_0x2c121f,_0xde85('0x57'))['then'](function(_0x4c9185){if(_0x4c9185)return _0x4c9185;_0x2c121f[_0xde85('0x58')]=_0xde85('0x46')+_0xa6a3cb+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5e00ff+'))';return getZohoUser(_0x2c121f,'Leads')[_0xde85('0x4d')](function(_0x1ebee1){if(_0x1ebee1)return _0x1ebee1;if(_0x1986fe[_0xde85('0x49')]!=_0xde85('0x59')){return createEndUser(_0x35a8f8,_0xa6a3cb,_0x585f7f,_0x5e00ff,_0x3165bc,_0x1986fe);}else{return{};}});});break;case _0xde85('0x5a'):_0x2c121f['uri']=_0xde85('0x46')+_0xa6a3cb+_0xde85('0x56')+_0x5e00ff+'))';return getZohoUser(_0x2c121f,_0xde85('0x57'))[_0xde85('0x4d')](function(_0x203e2f){if(_0x203e2f)return _0x203e2f;if(_0x1986fe['moduleCreate']!=_0xde85('0x59')){return createEndUser(_0x35a8f8,_0xa6a3cb,_0x585f7f,_0x5e00ff,_0x3165bc,_0x1986fe);}else{return{};}});break;case _0xde85('0x5b'):_0x2c121f[_0xde85('0x58')]=_0xde85('0x46')+_0xa6a3cb+_0xde85('0x5c')+_0x5e00ff+'))';return getZohoUser(_0x2c121f,_0xde85('0x5d'))['then'](function(_0x3b038f){if(_0x3b038f)return _0x3b038f;if(_0x1986fe[_0xde85('0x49')]!=_0xde85('0x59')){return createEndUser(_0x35a8f8,_0xa6a3cb,_0x585f7f,_0x5e00ff,_0x3165bc,_0x1986fe);}else{return{};}});break;}}function getCall(_0x5b7d6a,_0x35d882,_0x40b691,_0x47e515,_0x20ae20,_0x2c6fd1,_0x3810df,_0x3a1e08){logger['info'](_0xde85('0x5e'));var _0x2eac3f={};_0x2eac3f[_0xde85('0x5f')]={'name':!_['isNil'](_0x47e515[_0xde85('0x4a')]['name'])&&!_[_0xde85('0x21')](_0x47e515['profile']['name'])&&_0x47e515[_0xde85('0x3f')][_0xde85('0x1f')]===_0xde85('0x60')?_0x47e515[_0xde85('0x4a')][_0xde85('0x1f')]:!_[_0xde85('0x21')](_0x47e515['first_name'])?_0x47e515[_0xde85('0x4b')]+'\x20'+_0x47e515[_0xde85('0x4c')]:_0x47e515[_0xde85('0x4c')],'id':_0x47e515['id']};_0x2eac3f[_0xde85('0x61')]=intUtil['getString'](_0x2c6fd1[_0xde85('0x62')],_0x3810df,'\x20');_0x2eac3f[_0xde85('0x63')]=intUtil['getString'](_0x2c6fd1[_0xde85('0x64')],_0x3810df,'\x0a');if(_0x20ae20['enduserType']===_0xde85('0x57')){_0x2eac3f[_0xde85('0x65')]={'name':!_[_0xde85('0x21')](_0x20ae20[_0xde85('0x66')])?_0x20ae20['Full_Name']:!_['isNil'](_0x20ae20[_0xde85('0x67')])?_0x20ae20['First_Name']+'\x20'+_0x20ae20[_0xde85('0x68')]:_0x20ae20[_0xde85('0x68')],'id':_0x20ae20['id']};}if(_0x20ae20[_0xde85('0x45')]==='Leads'){_0x2eac3f[_0xde85('0x69')]={'name':!_[_0xde85('0x21')](_0x20ae20[_0xde85('0x66')])?_0x20ae20['Full_Name']:!_[_0xde85('0x21')](_0x20ae20['First_Name'])?_0x20ae20[_0xde85('0x67')]+'\x20'+_0x20ae20[_0xde85('0x68')]:_0x20ae20[_0xde85('0x68')],'id':_0x20ae20['id']};_0x2eac3f['$se_module']=_[_0xde85('0x48')](_0x20ae20[_0xde85('0x45')]);}if(_0x3810df[_0xde85('0x6a')]){_0x2eac3f[_0xde85('0x6b')]=moment[_0xde85('0x6c')](parseInt(_0x3810df['talktime'])*0x3e8)[_0xde85('0x36')](_0xde85('0x6d'));}else if(_0x3810df['answertime']&&_0x3810df[_0xde85('0x6e')]){_0x2eac3f[_0xde85('0x6b')]=moment[_0xde85('0x6c')](moment(_0x3810df[_0xde85('0x6e')],_0xde85('0x6f'))[_0xde85('0x70')](moment(_0x3810df[_0xde85('0x71')],_0xde85('0x6f'))))[_0xde85('0x36')](_0xde85('0x6d'));}switch(_0x3810df['lastevent']){case'called':_0x2eac3f[_0xde85('0x72')]=_0xde85('0x73');break;case'complete':case _0xde85('0x74'):_0x2eac3f[_0xde85('0x72')]=_0xde85('0x75');break;case _0xde85('0x76'):_0x2eac3f['Call_Result']=_0xde85('0x77');break;case _0xde85('0x78'):_0x2eac3f['Call_Result']=_0xde85('0x79');break;case _0xde85('0x7a'):_0x2eac3f['Call_Result']=_0xde85('0x7b');default:}_0x2eac3f[_0xde85('0x7c')]=(_0x3a1e08==='outbound'?moment(_0x3810df['starttime'])['format'](_0xde85('0x6f')):moment(_0x3810df[_0xde85('0x7d')])[_0xde85('0x36')](_0xde85('0x6f')))||moment()[_0xde85('0x36')]('YYYY-MM-DDTHH:mm:ss');_0x2eac3f['Call_Type']=_0x3a1e08||_0xde85('0x7e');_0x2eac3f=_[_0xde85('0x7f')](_0x2eac3f,getCustomFields(_0x2c6fd1[_0xde85('0x80')],_0x3810df));return request({'method':'POST','uri':_0xde85('0x46')+_0x35d882+'/crm/v2/Calls','headers':{'Authorization':_0xde85('0x39')+_0x5b7d6a},'body':{'data':[_0x2eac3f]},'json':!![]})[_0xde85('0x4d')](function(_0x3f708c){if(_0x3f708c&&_0x3f708c[_0xde85('0x44')][0x0]['code']===_0xde85('0x4f')){logger['info']('Call\x20created!');return{'id':_0x3f708c[_0xde85('0x44')][0x0][_0xde85('0x50')]['id']};}})['catch'](function(_0x21f61c){logger['info'](_0xde85('0x81'),_0x21f61c['stack']);console[_0xde85('0x52')](_0xde85('0x81'),_0x21f61c);});}exports[_0xde85('0x82')]=function(_0x5aea84,_0x2398a3,_0x1be217,_0x35f2bb,_0x1a7170,_0x3b5a8e){var _0x592e5d,_0x5ba826,_0x252245;_0x3b5a8e[_0xde85('0x83')]=intUtil[_0xde85('0x84')](_0x3b5a8e[_0xde85('0x83')]);_0x3b5a8e[_0xde85('0x85')]=intUtil['stripTrailingSlash'](_0x3b5a8e[_0xde85('0x85')]);if(_0x1a7170&&_0x1a7170[_0xde85('0x86')]){logger[_0xde85('0x34')](_0xde85('0x87'),_0xde85('0x88'));_0x2398a3[_0xde85('0x89')]=_0x3b5a8e[_0xde85('0x85')]+'/api/voice/recordings/'+_0x2398a3['uniqueid']+_0xde85('0x8a')+md5(_0x2398a3['uniqueid']);}else{_0x2398a3[_0xde85('0x89')]='';}var _0x32b694=_0x3b5a8e[_0xde85('0x83')]==='zoho.eu'?'eu':_0xde85('0x8b');return getAccessToken(_0x3b5a8e)[_0xde85('0x4d')](function(_0x5ac4b6){_0x252245=_0x5ac4b6;return getUser(_0x252245,_0x32b694,_0x3b5a8e,_0x35f2bb['email']);})['then'](function(_0x2d3495){_0x592e5d=_0x2d3495;logger[_0xde85('0x34')](_0xde85('0x8c'),_0x592e5d['id']);return getEndUser(_0x252245,_0x32b694,_0x3b5a8e,_0x2398a3[_0xde85('0x8d')],_0x2398a3[_0xde85('0x8e')],_0x592e5d,_0x1be217);})[_0xde85('0x4d')](function(_0x259e3a){_0x5ba826=_0x259e3a;return getCall(_0x252245,_0x32b694,_0x3b5a8e,_0x592e5d,_0x5ba826,_0x1be217,_0x2398a3,_0xde85('0x7e'));})[_0xde85('0x4d')](function(_0x44f7f7){if(_0x44f7f7){logger[_0xde85('0x34')](_0xde85('0x8f'),_0x44f7f7['id']);logger['info'](_0xde85('0x87'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xde85('0x36')](_0xde85('0x90'),_0x35f2bb[_0xde85('0x1f')]),_0xde85('0x91'),{'uri':_0xde85('0x92')+_0x3b5a8e['host']+_0xde85('0x93')+_0x44f7f7['id']});}})[_0xde85('0x31')](function(_0x5a7b10){logger[_0xde85('0x32')](_0xde85('0x87'),JSON[_0xde85('0x12')](_0x5a7b10));});};exports[_0xde85('0x94')]=function(_0x4725cb,_0xebdae,_0x1843b6,_0x4873b0,_0x58e2d4,_0x5e8b6c,_0x52126a){var _0x22637f,_0xa0f83a,_0x22c252;_0x5e8b6c[_0xde85('0x83')]=intUtil[_0xde85('0x84')](_0x5e8b6c['host']);_0x5e8b6c[_0xde85('0x85')]=intUtil[_0xde85('0x84')](_0x5e8b6c[_0xde85('0x85')]);if(_0x52126a&&_0x52126a[_0xde85('0x95')]&&_0x52126a[_0xde85('0x95')]!==_0xde85('0x96')){logger[_0xde85('0x34')](_0xde85('0x97'),'Recording\x20is\x20enabled!');_0xebdae[_0xde85('0x89')]=_0x5e8b6c[_0xde85('0x85')]+'/api/voice/recordings/'+_0xebdae['uniqueid']+_0xde85('0x8a')+md5(_0xebdae['uniqueid']);}var _0x27ca28=_0x5e8b6c['host']===_0xde85('0x98')?'eu':_0xde85('0x8b');return getAccessToken(_0x5e8b6c)['then'](function(_0x222825){_0x22c252=_0x222825;return getUser(_0x22c252,_0x27ca28,_0x5e8b6c,_0x4873b0[_0xde85('0x3d')]);})['then'](function(_0x157711){_0x22637f=_0x157711;logger['info'](_0xde85('0x8c'),_0x22637f['id']);return getEndUser(_0x22c252,_0x27ca28,_0x5e8b6c,_0xebdae[_0xde85('0x99')],_0xebdae[_0xde85('0x9a')],_0x22637f,_0x1843b6);})['then'](function(_0xd4dc85){_0xa0f83a=_0xd4dc85;return getCall(_0x22c252,_0x27ca28,_0x5e8b6c,_0x22637f,_0xa0f83a,_0x1843b6,_0xebdae,'Outbound');})[_0xde85('0x4d')](function(_0x32bcd3){if(_0x32bcd3){logger['info']('The\x20Call\x20ID\x20is:',_0x32bcd3['id']);logger[_0xde85('0x34')](_0xde85('0x97'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x4873b0['name']),_0xde85('0x91'),{'uri':_0xde85('0x92')+_0x5e8b6c['host']+_0xde85('0x93')+_0x32bcd3['id']});}})[_0xde85('0x31')](function(_0x41d101){logger['error'](_0xde85('0x97'),JSON[_0xde85('0x12')](_0x41d101));});};exports[_0xde85('0x9b')]=function(_0x5944e2,_0x2353f1,_0x4e3919,_0x4be9e7,_0x115af7,_0x5f2433){var _0x2dfe06,_0x4c9961,_0x538474;_0x5f2433[_0xde85('0x83')]=intUtil[_0xde85('0x84')](_0x5f2433['host']);_0x5f2433['serverUrl']=intUtil[_0xde85('0x84')](_0x5f2433[_0xde85('0x85')]);if(_0x115af7&&_0x115af7[_0xde85('0x86')]){logger[_0xde85('0x34')]('['+_0x2353f1[_0xde85('0x9c')][_0xde85('0x9d')]()+']',_0xde85('0x88'));_0x2353f1[_0xde85('0x89')]=_0x5f2433[_0xde85('0x85')]+_0xde85('0x9e')+_0x2353f1['uniqueid']+_0xde85('0x8a')+md5(_0x2353f1[_0xde85('0x9f')]);}else{_0x2353f1['recordingURL']='';}var _0x23ecae=_0x5f2433[_0xde85('0x83')]===_0xde85('0x98')?'eu':_0xde85('0x8b');return getAccessToken(_0x5f2433)[_0xde85('0x4d')](function(_0x541d99){_0x538474=_0x541d99;return getUser(_0x538474,_0x23ecae,_0x5f2433);})[_0xde85('0x4d')](function(_0x29e266){_0x2dfe06=_0x29e266;logger[_0xde85('0x34')](_0xde85('0x8c'),_0x2dfe06['id']);return getEndUser(_0x538474,_0x23ecae,_0x5f2433,_0x2353f1['calleridname'],_0x2353f1[_0xde85('0x8e')],_0x2dfe06,_0x4e3919);})[_0xde85('0x4d')](function(_0x1f450b){_0x4c9961=_0x1f450b;return getCall(_0x538474,_0x23ecae,_0x5f2433,_0x2dfe06,_0x4c9961,_0x4e3919,_0x2353f1,'Inbound');})[_0xde85('0x4d')](function(_0x511379){if(_0x511379){logger[_0xde85('0x34')](_0xde85('0x8f'),_0x511379['id']);}})[_0xde85('0x31')](function(_0x24fdc7){logger[_0xde85('0x32')]('['+_0x2353f1[_0xde85('0x9c')][_0xde85('0x9d')]()+']',JSON[_0xde85('0x12')](_0x24fdc7));});}; \ 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 804de47..11d7484 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 _0xd716=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','trigger','exec','data2','Script','render','data3','format'];(function(_0x2e6dee,_0x1a61b0){var _0x47706=function(_0x365546){while(--_0x365546){_0x2e6dee['push'](_0x2e6dee['shift']());}};_0x47706(++_0x1a61b0);}(_0xd716,0x148));var _0x6d71=function(_0xf48244,_0x115cad){_0xf48244=_0xf48244-0x0;var _0x37d890=_0xd716[_0xf48244];return _0x37d890;};'use strict';var util=require(_0x6d71('0x0'));var sh=require(_0x6d71('0x1'));var Mustache=require('mustache');var logger=require(_0x6d71('0x2'))(_0x6d71('0x3'));exports[_0x6d71('0x4')]=function(_0x20d3b3,_0xdaf1c7){var _0x302a98=_0x20d3b3['data2']?_0x20d3b3[_0x6d71('0x5')]:_0x6d71('0x6');var _0x11b680=_0x20d3b3['data3']?Mustache[_0x6d71('0x7')](_0x20d3b3[_0x6d71('0x8')],_0xdaf1c7):_0xdaf1c7;sh[_0x6d71('0x4')](_0x11b680,function(_0x163bd6,_0x326209,_0x4da378){if(_0x163bd6!==0x0){logger['error'](util[_0x6d71('0x9')](_0x6d71('0xa'),_0x302a98,_0x11b680,_0x163bd6,_0x4da378));}else{logger[_0x6d71('0xb')](util[_0x6d71('0x9')](_0x6d71('0xc'),_0x302a98,_0x11b680,_0x326209));}});}; \ No newline at end of file +var _0xe57f=['mustache','../../../../config/logger','trigger','exec','data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xe57f,0x1a3));var _0xfe57=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe57f[_0x4565bf];return _0x5610ba;};'use strict';var util=require('util');var sh=require(_0xfe57('0x0'));var Mustache=require(_0xfe57('0x1'));var logger=require(_0xfe57('0x2'))(_0xfe57('0x3'));exports[_0xfe57('0x4')]=function(_0x6525,_0x2a6cd3){var _0x27859f=_0x6525[_0xfe57('0x5')]?_0x6525[_0xfe57('0x5')]:_0xfe57('0x6');var _0xbb7b09=_0x6525[_0xfe57('0x7')]?Mustache['render'](_0x6525[_0xfe57('0x7')],_0x2a6cd3):_0x2a6cd3;sh[_0xfe57('0x4')](_0xbb7b09,function(_0xb03ef6,_0x2929d4,_0x2ea06a){if(_0xb03ef6!==0x0){logger[_0xfe57('0x8')](util[_0xfe57('0x9')](_0xfe57('0xa'),_0x27859f,_0xbb7b09,_0xb03ef6,_0x2ea06a));}else{logger['info'](util['format'](_0xfe57('0xb'),_0x27859f,_0xbb7b09,_0x2929d4));}});}; \ 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 526c3a9..4eec086 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 _0x1ab2=['body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','../../../../config/logger','exec','data1','toUpperCase','render','data2','data5','headers','parse','data6','error','stack','GET','POST','PUT','data7'];(function(_0x13574b,_0x3517c0){var _0x7ed5c8=function(_0x50736b){while(--_0x50736b){_0x13574b['push'](_0x13574b['shift']());}};_0x7ed5c8(++_0x3517c0);}(_0x1ab2,0x183));var _0x21ab=function(_0x40ec06,_0xeb9cab){_0x40ec06=_0x40ec06-0x0;var _0x3d5784=_0x1ab2[_0x40ec06];return _0x3d5784;};'use strict';var rp=require('request-promise');var util=require('util');var _=require('lodash');var Mustache=require('mustache');var logger=require(_0x21ab('0x0'))('trigger');exports[_0x21ab('0x1')]=function(_0x18838d,_0x5d6922){var _0x596c7a,_0x54fc72;var _0x1b922c={'method':_0x18838d[_0x21ab('0x2')][_0x21ab('0x3')](),'uri':Mustache[_0x21ab('0x4')](_0x18838d[_0x21ab('0x5')],_0x5d6922),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x18838d['data5'])==='number'&&parseInt(_0x18838d[_0x21ab('0x6')])>=0x1&&parseInt(_0x18838d[_0x21ab('0x6')])<=0xa?parseInt(_0x18838d[_0x21ab('0x6')])*0x3e8:0x5*0x3e8};try{_0x1b922c[_0x21ab('0x7')]=_0x18838d['data6']?JSON[_0x21ab('0x8')](Mustache['render'](_0x18838d[_0x21ab('0x9')],_0x5d6922)):{};}catch(_0x4facbb){logger[_0x21ab('0xa')](_0x4facbb[_0x21ab('0xb')]);}switch(_0x18838d['data1'][_0x21ab('0x3')]()){case _0x21ab('0xc'):case'DELETE':_0x596c7a=null;_0x1b922c['qs']=_0x5d6922;break;case _0x21ab('0xd'):case _0x21ab('0xe'):if(_0x18838d[_0x21ab('0xf')]){try{_0x596c7a=JSON[_0x21ab('0x8')](Mustache[_0x21ab('0x4')](_0x18838d[_0x21ab('0xf')],_0x5d6922));_0x1b922c['body']=_0x596c7a;}catch(_0x5654c0){logger[_0x21ab('0xa')](_0x5654c0[_0x21ab('0xb')]);logger[_0x21ab('0xa')](_0x21ab('0x10'));}}else{_0x596c7a=_0x5d6922;_0x1b922c[_0x21ab('0x11')]=_0x596c7a;}break;}logger[_0x21ab('0x12')](util[_0x21ab('0x13')](_0x21ab('0x14'),_0x18838d['data1'],_0x18838d[_0x21ab('0x5')],JSON[_0x21ab('0x15')](_0x1b922c)));rp(_0x1b922c)[_0x21ab('0x16')](function(_0x410b32){_0x596c7a=!_[_0x21ab('0x17')](_0x596c7a)?_0x21ab('0x18')+_0x596c7a:'';_0x54fc72=typeof _0x410b32[_0x21ab('0x11')]===_0x21ab('0x19')?JSON[_0x21ab('0x15')](_0x410b32['body']):_0x410b32[_0x21ab('0x11')];logger[_0x21ab('0x12')](util['format'](_0x21ab('0x1a'),_0x18838d[_0x21ab('0x2')],_0x18838d[_0x21ab('0x5')],_0x410b32[_0x21ab('0x1b')],_0x54fc72));})['catch'](function(_0x1bccf1){logger['error'](util[_0x21ab('0x13')](_0x21ab('0x1c'),_0x18838d[_0x21ab('0x2')],_0x18838d[_0x21ab('0x5')],_0x1bccf1[_0x21ab('0x1b')],_0x1bccf1[_0x21ab('0x1d')],_0x1bccf1[_0x21ab('0x1e')]));});}; \ No newline at end of file +var _0xdc03=['POST','data7','error','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','exec','data1','toUpperCase','render','data5','number','headers','data6','parse','stack','DELETE'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0xdc03,0x1a4));var _0x3dc0=function(_0x5c00ff,_0x3578da){_0x5c00ff=_0x5c00ff-0x0;var _0x45aa8c=_0xdc03[_0x5c00ff];return _0x45aa8c;};'use strict';var rp=require(_0x3dc0('0x0'));var util=require(_0x3dc0('0x1'));var _=require(_0x3dc0('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports[_0x3dc0('0x3')]=function(_0x3e0869,_0x2eb2cd){var _0xb9a052,_0x115758;var _0x2f37a3={'method':_0x3e0869[_0x3dc0('0x4')][_0x3dc0('0x5')](),'uri':Mustache[_0x3dc0('0x6')](_0x3e0869['data2'],_0x2eb2cd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3e0869[_0x3dc0('0x7')])===_0x3dc0('0x8')&&parseInt(_0x3e0869[_0x3dc0('0x7')])>=0x1&&parseInt(_0x3e0869[_0x3dc0('0x7')])<=0xa?parseInt(_0x3e0869['data5'])*0x3e8:0x5*0x3e8};try{_0x2f37a3[_0x3dc0('0x9')]=_0x3e0869[_0x3dc0('0xa')]?JSON[_0x3dc0('0xb')](Mustache[_0x3dc0('0x6')](_0x3e0869[_0x3dc0('0xa')],_0x2eb2cd)):{};}catch(_0x4cf9c1){logger['error'](_0x4cf9c1[_0x3dc0('0xc')]);}switch(_0x3e0869['data1'][_0x3dc0('0x5')]()){case'GET':case _0x3dc0('0xd'):_0xb9a052=null;_0x2f37a3['qs']=_0x2eb2cd;break;case _0x3dc0('0xe'):case'PUT':if(_0x3e0869[_0x3dc0('0xf')]){try{_0xb9a052=JSON[_0x3dc0('0xb')](Mustache[_0x3dc0('0x6')](_0x3e0869[_0x3dc0('0xf')],_0x2eb2cd));_0x2f37a3['body']=_0xb9a052;}catch(_0x59f8a3){logger[_0x3dc0('0x10')](_0x59f8a3[_0x3dc0('0xc')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0xb9a052=_0x2eb2cd;_0x2f37a3[_0x3dc0('0x11')]=_0xb9a052;}break;}logger[_0x3dc0('0x12')](util[_0x3dc0('0x13')](_0x3dc0('0x14'),_0x3e0869['data1'],_0x3e0869[_0x3dc0('0x15')],JSON[_0x3dc0('0x16')](_0x2f37a3)));rp(_0x2f37a3)['then'](function(_0x36f292){_0xb9a052=!_[_0x3dc0('0x17')](_0xb9a052)?_0x3dc0('0x18')+_0xb9a052:'';_0x115758=typeof _0x36f292[_0x3dc0('0x11')]===_0x3dc0('0x19')?JSON[_0x3dc0('0x16')](_0x36f292[_0x3dc0('0x11')]):_0x36f292[_0x3dc0('0x11')];logger[_0x3dc0('0x12')](util[_0x3dc0('0x13')](_0x3dc0('0x1a'),_0x3e0869['data1'],_0x3e0869['data2'],_0x36f292[_0x3dc0('0x1b')],_0x115758));})[_0x3dc0('0x1c')](function(_0x40d79f){logger[_0x3dc0('0x10')](util[_0x3dc0('0x13')](_0x3dc0('0x1d'),_0x3e0869[_0x3dc0('0x4')],_0x3e0869[_0x3dc0('0x15')],_0x40d79f[_0x3dc0('0x1b')],_0x40d79f['name'],_0x40d79f[_0x3dc0('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 3e20beb..2e4d31f 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 _0x791c=['then','debug','rpc','routing','error','message','result','catch','exports','bluebird','../../config/logger','client','http','Request','request'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x791c,0x171));var _0xc791=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0x791c[_0x47408e];return _0x1636bc;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xc791('0x0'));var logger=require(_0xc791('0x1'))('routing');var client=jayson[_0xc791('0x2')][_0xc791('0x3')]({'port':0x2329});client[_0xc791('0x4')]=function(_0x5f4d66,_0x31ea3d){return new BPromise(function(_0xf625a3,_0x35d59e){return client[_0xc791('0x5')](_0x5f4d66,_0x31ea3d)[_0xc791('0x6')](function(_0x1d4ac3){logger[_0xc791('0x7')](_0xc791('0x8'),_0xc791('0x9'),_0x5f4d66,_0x31ea3d,_0x1d4ac3);if(_0x1d4ac3[_0xc791('0xa')]){logger[_0xc791('0xa')](_0xc791('0x8'),'routing',_0x5f4d66,_0x1d4ac3[_0xc791('0xa')][_0xc791('0xb')],_0x31ea3d);return _0x35d59e(_0x1d4ac3[_0xc791('0xa')]['message']);}else{return _0xf625a3(_0x1d4ac3[_0xc791('0xc')]);}})[_0xc791('0xd')](function(_0x21ae52){logger[_0xc791('0xa')](_0xc791('0x8'),_0xc791('0x9'),_0x5f4d66,_0x21ae52,_0x31ea3d);return _0x35d59e(_0x21ae52);});});};module[_0xc791('0xe')]=client; \ No newline at end of file +var _0x9066=['debug','rpc','error','message','result','jayson/promise','bluebird','../../config/logger','routing','client','Request','request','then'];(function(_0x33363e,_0x4dee7f){var _0x412a36=function(_0xeddc29){while(--_0xeddc29){_0x33363e['push'](_0x33363e['shift']());}};_0x412a36(++_0x4dee7f);}(_0x9066,0x1cc));var _0x6906=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9066[_0x167cc1];return _0x10bc4b;};'use strict';var jayson=require(_0x6906('0x0'));var BPromise=require(_0x6906('0x1'));var logger=require(_0x6906('0x2'))(_0x6906('0x3'));var client=jayson[_0x6906('0x4')]['http']({'port':0x2329});client[_0x6906('0x5')]=function(_0x39e2f5,_0x516d6d){return new BPromise(function(_0x2c9ebe,_0x3ff415){return client[_0x6906('0x6')](_0x39e2f5,_0x516d6d)[_0x6906('0x7')](function(_0x4b3c27){logger[_0x6906('0x8')](_0x6906('0x9'),_0x6906('0x3'),_0x39e2f5,_0x516d6d,_0x4b3c27);if(_0x4b3c27[_0x6906('0xa')]){logger[_0x6906('0xa')](_0x6906('0x9'),_0x6906('0x3'),_0x39e2f5,_0x4b3c27[_0x6906('0xa')][_0x6906('0xb')],_0x516d6d);return _0x3ff415(_0x4b3c27[_0x6906('0xa')][_0x6906('0xb')]);}else{return _0x2c9ebe(_0x4b3c27[_0x6906('0xc')]);}})['catch'](function(_0x3187f9){logger[_0x6906('0xa')]('rpc',_0x6906('0x3'),_0x39e2f5,_0x3187f9,_0x516d6d);return _0x3ff415(_0x3187f9);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 95494e7..37f0838 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 _0x2488=['./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','catch','error','Email\x20service\x20initialization'];(function(_0x39aa37,_0x4c9f42){var _0x2b1a31=function(_0x3f93d6){while(--_0x3f93d6){_0x39aa37['push'](_0x39aa37['shift']());}};_0x2b1a31(++_0x4c9f42);}(_0x2488,0x180));var _0x8248=function(_0x233ab2,_0x43cd05){_0x233ab2=_0x233ab2-0x0;var _0x4d893f=_0x2488[_0x233ab2];return _0x4d893f;};'use strict';var server=require('./server');var Realtime=require(_0x8248('0x0'));var EmailChannel=require(_0x8248('0x1'));var mailAccount=require(_0x8248('0x2'));var setting=require(_0x8248('0x3'));var logger=require(_0x8248('0x4'))(_0x8248('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x8248('0x6')](mailAccount[_0x8248('0x7')]())[_0x8248('0x6')](realtime[_0x8248('0x8')]())[_0x8248('0x6')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x8248('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x8248('0x6')](function(_0xa58335){return setInterval(initRealtime,_0xa58335['loginMailFrequency']*0x3e8);})[_0x8248('0x9')](function(_0x184eca){logger[_0x8248('0xa')](_0x8248('0xb'),_0x184eca);});}main(); \ No newline at end of file +var _0x25c7=['./rpc/setting','../../config/logger','email','then','getMailAccounts','refresh','listen','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./lib/email','./rpc/mailAccount'];(function(_0x5d2a89,_0x1853b6){var _0x4f023f=function(_0x45a41a){while(--_0x45a41a){_0x5d2a89['push'](_0x5d2a89['shift']());}};_0x4f023f(++_0x1853b6);}(_0x25c7,0x183));var _0x725c=function(_0x5aab45,_0x1856f9){_0x5aab45=_0x5aab45-0x0;var _0x14a5be=_0x25c7[_0x5aab45];return _0x14a5be;};'use strict';var server=require(_0x725c('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x725c('0x1'));var mailAccount=require(_0x725c('0x2'));var setting=require(_0x725c('0x3'));var logger=require(_0x725c('0x4'))(_0x725c('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x725c('0x6')](mailAccount[_0x725c('0x7')]())[_0x725c('0x6')](realtime['initMailAccounts']())[_0x725c('0x6')](function(){email[_0x725c('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x725c('0x9')](realtime,email)[_0x725c('0x6')](function(){return initRealtime();})[_0x725c('0x6')](function(){return setting['getSettings']();})['then'](function(_0x3ef093){return setInterval(initRealtime,_0x3ef093[_0x725c('0xa')]*0x3e8);})[_0x725c('0xb')](function(_0x5aefd3){logger['error'](_0x725c('0xc'),_0x5aefd3);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 468bbe2..7b26754 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 _0xfd33=['messageStatus','isNil','stringify','service','provider','hasOwnProperty','box','email','handleImapEmail','bind','handleImapEnd','disabled','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verify','verified','lodash','moment','bluebird','md5','../../../config/environment','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0xfd33,0x89));var _0x3fd3=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xfd33[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x3fd3('0x0'));var moment=require(_0x3fd3('0x1'));var BPromise=require(_0x3fd3('0x2'));var md5=require(_0x3fd3('0x3'));var Redis=require('ioredis');var config=require(_0x3fd3('0x4'));var logger=require('../../../config/logger')('email');config[_0x3fd3('0x5')]=_['defaults'](config[_0x3fd3('0x5')],{'host':_0x3fd3('0x6'),'port':0x18eb});var io=require(_0x3fd3('0x7'))(new Redis(config['redis']));var EmailImap=require(_0x3fd3('0x8'));var EmailSmtp=require(_0x3fd3('0x9'));var mailAccount=require(_0x3fd3('0xa'));var md5Accounts={};function EmailChannel(_0xcb571d){logger[_0x3fd3('0xb')]('start\x20email\x20channel');this[_0x3fd3('0xc')]=_0xcb571d['mailAccounts'];this[_0x3fd3('0xd')]={};this[_0x3fd3('0xe')]=new EmailSmtp();}EmailChannel[_0x3fd3('0xf')][_0x3fd3('0x10')]=function(_0x2b94ae){var _0x30eff6=this[_0x3fd3('0xc')][_0x2b94ae];var _0x17162d={'id':_0x30eff6['id'],'name':_0x30eff6[_0x3fd3('0x11')],'key':_0x30eff6[_0x3fd3('0x12')],'active':_0x30eff6[_0x3fd3('0x13')],'Imap':{'status':_0x30eff6[_0x3fd3('0x14')][_0x3fd3('0x15')],'messageStatus':_0x30eff6[_0x3fd3('0x14')][_0x3fd3('0x16')],'total':_0x30eff6[_0x3fd3('0x14')]['total']}};if(_[_0x3fd3('0x17')](md5Accounts[_0x2b94ae])){md5Accounts[_0x2b94ae]={};}var _0x4fc4d5=md5(JSON[_0x3fd3('0x18')](_0x17162d));if(md5Accounts[_0x2b94ae][_0x3fd3('0x3')]!==_0x4fc4d5){md5Accounts[_0x2b94ae]['md5']=_0x4fc4d5;io[_0x3fd3('0x10')]('mailAccount:update',_0x17162d);}};EmailChannel[_0x3fd3('0xf')]['refresh']=function(_0xbb1a3e){for(var _0x4d6f61 in _0xbb1a3e){if(_0xbb1a3e['hasOwnProperty'](_0x4d6f61)){if(_0xbb1a3e[_0x4d6f61]['Imap']&&_0xbb1a3e[_0x4d6f61][_0x3fd3('0x13')]){var _0x310bc6=_0xbb1a3e[_0x4d6f61][_0x3fd3('0x14')];if(!_0x310bc6[_0x3fd3('0x19')]&&_0xbb1a3e[_0x4d6f61][_0x3fd3('0x1a')]!=='custom')_0x310bc6[_0x3fd3('0x19')]=_0xbb1a3e[_0x4d6f61][_0x3fd3('0x1a')];if(!this[_0x3fd3('0xd')][_0x3fd3('0x1b')](_0x310bc6['id'])){this['imapAccounts'][_0x310bc6['id']]=new EmailImap(_0x310bc6,_0xbb1a3e[_0x4d6f61]['email']);this[_0x3fd3('0xd')][_0x310bc6['id']]['on'](_0x3fd3('0x1c'),this['handleImapBox']['bind'](this,_0x4d6f61));this[_0x3fd3('0xd')][_0x310bc6['id']]['on'](_0x3fd3('0x1d'),this[_0x3fd3('0x1e')][_0x3fd3('0x1f')](this,_0x4d6f61));this[_0x3fd3('0xd')][_0x310bc6['id']]['on']('end',this[_0x3fd3('0x20')][_0x3fd3('0x1f')](this,_0x4d6f61));this[_0x3fd3('0xd')][_0x310bc6['id']]['on']('error',this['handleImapError'][_0x3fd3('0x1f')](this,_0x4d6f61));}}else{if(_['isNil'](this[_0x3fd3('0xc')][_0x4d6f61][_0x3fd3('0x14')])){this['mailAccounts'][_0x4d6f61][_0x3fd3('0x14')]={};}this[_0x3fd3('0xc')][_0x4d6f61]['Imap'][_0x3fd3('0x15')]=_0x3fd3('0x21');this[_0x3fd3('0xc')][_0x4d6f61][_0x3fd3('0x14')][_0x3fd3('0x16')]='';this[_0x3fd3('0x10')](_0x4d6f61);}}}};EmailChannel[_0x3fd3('0xf')]['handleImapBox']=function(_0x5d7cc0,_0x459fff){if(this[_0x3fd3('0xc')][_0x5d7cc0]){this['mailAccounts'][_0x5d7cc0][_0x3fd3('0x14')][_0x3fd3('0x15')]='connected';this[_0x3fd3('0xc')][_0x5d7cc0]['Imap']['messageStatus']=_0x459fff['name'];if(_0x459fff[_0x3fd3('0x22')]){this[_0x3fd3('0xc')][_0x5d7cc0]['Imap']['total']=_0x459fff['messages'][_0x3fd3('0x23')];}return this[_0x3fd3('0x10')](_0x5d7cc0);}};EmailChannel['prototype'][_0x3fd3('0x1e')]=function(_0x1981c1,_0x53985b){logger['info'](_0x3fd3('0x24'),_0x53985b[_0x3fd3('0x25')],_0x53985b['lastName'],_0x53985b[_0x3fd3('0x26')],_0x1981c1);if(this[_0x3fd3('0xc')][_0x1981c1]){return mailAccount[_0x3fd3('0x27')](_0x1981c1,_0x53985b)[_0x3fd3('0x28')](function(_0x19aec8){if(_0x19aec8){logger[_0x3fd3('0xb')](_0x3fd3('0x29'));}})[_0x3fd3('0x2a')](function(_0x41c19e){logger[_0x3fd3('0x2b')](_0x3fd3('0x2c'),JSON['stringify'](_0x41c19e));});}};EmailChannel[_0x3fd3('0xf')]['handleImapEnd']=function(_0xde790a){if(this[_0x3fd3('0xc')][_0xde790a]&&this[_0x3fd3('0xc')][_0xde790a][_0x3fd3('0x14')]){if(this[_0x3fd3('0xd')][this['mailAccounts'][_0xde790a][_0x3fd3('0x14')]['id']]){delete this[_0x3fd3('0xd')][this[_0x3fd3('0xc')][_0xde790a][_0x3fd3('0x14')]['id']];}this[_0x3fd3('0xc')][_0xde790a]['Imap'][_0x3fd3('0x2d')]=moment();this[_0x3fd3('0x10')](_0xde790a);}};EmailChannel[_0x3fd3('0xf')][_0x3fd3('0x2e')]=function(_0x406b32,_0x43f818){if(this[_0x3fd3('0xc')][_0x406b32]){this[_0x3fd3('0xc')][_0x406b32][_0x3fd3('0x14')][_0x3fd3('0x15')]=_0x3fd3('0x2b');this['mailAccounts'][_0x406b32][_0x3fd3('0x14')][_0x3fd3('0x16')]=_0x43f818;return this[_0x3fd3('0x10')](_0x406b32);}};EmailChannel[_0x3fd3('0xf')][_0x3fd3('0x2f')]=function(_0x44a658,_0xe576){return this[_0x3fd3('0xe')][_0x3fd3('0x30')](_0x44a658,_0xe576);};EmailChannel['prototype'][_0x3fd3('0x31')]=function(_0x4ba8e9){var _0x59e6b3=this;if(this[_0x3fd3('0xc')][_0x4ba8e9['id']]){if(_[_0x3fd3('0x17')](this[_0x3fd3('0xc')][_0x4ba8e9['id']][_0x3fd3('0x32')])){this['mailAccounts'][_0x4ba8e9['id']][_0x3fd3('0x32')]={};}this['mailAccounts'][_0x4ba8e9['id']][_0x3fd3('0x32')][_0x3fd3('0x2d')]=moment();return new BPromise(function(_0x3cde9e,_0x1938d7){return _0x59e6b3['smtp'][_0x3fd3('0x33')](_0x4ba8e9)['then'](function(_0x5735e9){_0x59e6b3['mailAccounts'][_0x4ba8e9['id']]['Smtp'][_0x3fd3('0x15')]=_0x3fd3('0x34');_0x59e6b3[_0x3fd3('0xc')][_0x4ba8e9['id']][_0x3fd3('0x32')]['messageStatus']='';_0x59e6b3[_0x3fd3('0x10')](_0x4ba8e9['id']);_0x3cde9e(_0x5735e9);})[_0x3fd3('0x2a')](function(_0x49e2af){_0x59e6b3[_0x3fd3('0xc')][_0x4ba8e9['id']]['Smtp'][_0x3fd3('0x15')]=_0x3fd3('0x2b');_0x59e6b3['mailAccounts'][_0x4ba8e9['id']][_0x3fd3('0x32')][_0x3fd3('0x16')]=_0x49e2af;_0x59e6b3[_0x3fd3('0x10')](_0x4ba8e9['id']);_0x1938d7(_0x49e2af);});});}return this[_0x3fd3('0xe')]['verify'](_0x4ba8e9);};module['exports']=EmailChannel; \ No newline at end of file +var _0xfa31=['start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','total','mailAccount:update','refresh','custom','service','provider','hasOwnProperty','box','handleImapEmail','bind','end','handleImapEnd','isNil','status','disabled','messageStatus','handleImapBox','connected','messages','firstName','lastName','from','notify','then','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapError','sendMail','send','verifySmtp','Smtp','lastSync','verify','exports','lodash','moment','md5','../../../config/environment','../../../config/logger','email','defaults','localhost','socket.io-emitter','redis','./imap','./smtp','../rpc/mailAccount','info'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0xfa31,0x1c2));var _0x1fa3=function(_0x29dd39,_0x1ee516){_0x29dd39=_0x29dd39-0x0;var _0x933bf9=_0xfa31[_0x29dd39];return _0x933bf9;};'use strict';var _=require(_0x1fa3('0x0'));var moment=require(_0x1fa3('0x1'));var BPromise=require('bluebird');var md5=require(_0x1fa3('0x2'));var Redis=require('ioredis');var config=require(_0x1fa3('0x3'));var logger=require(_0x1fa3('0x4'))(_0x1fa3('0x5'));config['redis']=_[_0x1fa3('0x6')](config['redis'],{'host':_0x1fa3('0x7'),'port':0x18eb});var io=require(_0x1fa3('0x8'))(new Redis(config[_0x1fa3('0x9')]));var EmailImap=require(_0x1fa3('0xa'));var EmailSmtp=require(_0x1fa3('0xb'));var mailAccount=require(_0x1fa3('0xc'));var md5Accounts={};function EmailChannel(_0x51c184){logger[_0x1fa3('0xd')](_0x1fa3('0xe'));this['mailAccounts']=_0x51c184[_0x1fa3('0xf')];this[_0x1fa3('0x10')]={};this[_0x1fa3('0x11')]=new EmailSmtp();}EmailChannel[_0x1fa3('0x12')][_0x1fa3('0x13')]=function(_0x383e96){var _0x341b70=this[_0x1fa3('0xf')][_0x383e96];var _0x257fc6={'id':_0x341b70['id'],'name':_0x341b70[_0x1fa3('0x14')],'key':_0x341b70['key'],'active':_0x341b70[_0x1fa3('0x15')],'Imap':{'status':_0x341b70[_0x1fa3('0x16')]['status'],'messageStatus':_0x341b70[_0x1fa3('0x16')]['messageStatus'],'total':_0x341b70['Imap'][_0x1fa3('0x17')]}};if(_['isNil'](md5Accounts[_0x383e96])){md5Accounts[_0x383e96]={};}var _0x3cc7ca=md5(JSON['stringify'](_0x257fc6));if(md5Accounts[_0x383e96][_0x1fa3('0x2')]!==_0x3cc7ca){md5Accounts[_0x383e96][_0x1fa3('0x2')]=_0x3cc7ca;io[_0x1fa3('0x13')](_0x1fa3('0x18'),_0x257fc6);}};EmailChannel[_0x1fa3('0x12')][_0x1fa3('0x19')]=function(_0x351008){for(var _0x15fe47 in _0x351008){if(_0x351008['hasOwnProperty'](_0x15fe47)){if(_0x351008[_0x15fe47][_0x1fa3('0x16')]&&_0x351008[_0x15fe47]['active']){var _0x1ef7ec=_0x351008[_0x15fe47]['Imap'];if(!_0x1ef7ec['service']&&_0x351008[_0x15fe47]['provider']!==_0x1fa3('0x1a'))_0x1ef7ec[_0x1fa3('0x1b')]=_0x351008[_0x15fe47][_0x1fa3('0x1c')];if(!this[_0x1fa3('0x10')][_0x1fa3('0x1d')](_0x1ef7ec['id'])){this['imapAccounts'][_0x1ef7ec['id']]=new EmailImap(_0x1ef7ec,_0x351008[_0x15fe47][_0x1fa3('0x5')]);this['imapAccounts'][_0x1ef7ec['id']]['on'](_0x1fa3('0x1e'),this['handleImapBox']['bind'](this,_0x15fe47));this[_0x1fa3('0x10')][_0x1ef7ec['id']]['on'](_0x1fa3('0x5'),this[_0x1fa3('0x1f')][_0x1fa3('0x20')](this,_0x15fe47));this[_0x1fa3('0x10')][_0x1ef7ec['id']]['on'](_0x1fa3('0x21'),this[_0x1fa3('0x22')]['bind'](this,_0x15fe47));this[_0x1fa3('0x10')][_0x1ef7ec['id']]['on']('error',this['handleImapError'][_0x1fa3('0x20')](this,_0x15fe47));}}else{if(_[_0x1fa3('0x23')](this[_0x1fa3('0xf')][_0x15fe47][_0x1fa3('0x16')])){this[_0x1fa3('0xf')][_0x15fe47][_0x1fa3('0x16')]={};}this['mailAccounts'][_0x15fe47]['Imap'][_0x1fa3('0x24')]=_0x1fa3('0x25');this[_0x1fa3('0xf')][_0x15fe47][_0x1fa3('0x16')][_0x1fa3('0x26')]='';this[_0x1fa3('0x13')](_0x15fe47);}}}};EmailChannel[_0x1fa3('0x12')][_0x1fa3('0x27')]=function(_0x132beb,_0x206c88){if(this[_0x1fa3('0xf')][_0x132beb]){this[_0x1fa3('0xf')][_0x132beb][_0x1fa3('0x16')][_0x1fa3('0x24')]=_0x1fa3('0x28');this[_0x1fa3('0xf')][_0x132beb][_0x1fa3('0x16')]['messageStatus']=_0x206c88[_0x1fa3('0x14')];if(_0x206c88[_0x1fa3('0x29')]){this[_0x1fa3('0xf')][_0x132beb][_0x1fa3('0x16')][_0x1fa3('0x17')]=_0x206c88[_0x1fa3('0x29')]['total'];}return this['emit'](_0x132beb);}};EmailChannel[_0x1fa3('0x12')][_0x1fa3('0x1f')]=function(_0x4a79e4,_0x330bf8){logger[_0x1fa3('0xd')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x330bf8[_0x1fa3('0x2a')],_0x330bf8[_0x1fa3('0x2b')],_0x330bf8[_0x1fa3('0x2c')],_0x4a79e4);if(this[_0x1fa3('0xf')][_0x4a79e4]){return mailAccount[_0x1fa3('0x2d')](_0x4a79e4,_0x330bf8)[_0x1fa3('0x2e')](function(_0x4bb106){if(_0x4bb106){logger['info']('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x2effd2){logger[_0x1fa3('0x2f')](_0x1fa3('0x30'),JSON[_0x1fa3('0x31')](_0x2effd2));});}};EmailChannel[_0x1fa3('0x12')][_0x1fa3('0x22')]=function(_0x5037ba){if(this[_0x1fa3('0xf')][_0x5037ba]&&this[_0x1fa3('0xf')][_0x5037ba][_0x1fa3('0x16')]){if(this[_0x1fa3('0x10')][this[_0x1fa3('0xf')][_0x5037ba][_0x1fa3('0x16')]['id']]){delete this[_0x1fa3('0x10')][this['mailAccounts'][_0x5037ba][_0x1fa3('0x16')]['id']];}this[_0x1fa3('0xf')][_0x5037ba][_0x1fa3('0x16')]['lastSync']=moment();this[_0x1fa3('0x13')](_0x5037ba);}};EmailChannel[_0x1fa3('0x12')][_0x1fa3('0x32')]=function(_0x1341b0,_0x5b501c){if(this['mailAccounts'][_0x1341b0]){this[_0x1fa3('0xf')][_0x1341b0][_0x1fa3('0x16')][_0x1fa3('0x24')]=_0x1fa3('0x2f');this[_0x1fa3('0xf')][_0x1341b0]['Imap'][_0x1fa3('0x26')]=_0x5b501c;return this[_0x1fa3('0x13')](_0x1341b0);}};EmailChannel['prototype'][_0x1fa3('0x33')]=function(_0x551ac5,_0x1ff6f4){return this['smtp'][_0x1fa3('0x34')](_0x551ac5,_0x1ff6f4);};EmailChannel[_0x1fa3('0x12')][_0x1fa3('0x35')]=function(_0x25808c){var _0x5a4e9f=this;if(this[_0x1fa3('0xf')][_0x25808c['id']]){if(_[_0x1fa3('0x23')](this[_0x1fa3('0xf')][_0x25808c['id']]['Smtp'])){this[_0x1fa3('0xf')][_0x25808c['id']]['Smtp']={};}this[_0x1fa3('0xf')][_0x25808c['id']][_0x1fa3('0x36')][_0x1fa3('0x37')]=moment();return new BPromise(function(_0x11d8da,_0x2599a9){return _0x5a4e9f[_0x1fa3('0x11')][_0x1fa3('0x38')](_0x25808c)[_0x1fa3('0x2e')](function(_0x9266ba){_0x5a4e9f[_0x1fa3('0xf')][_0x25808c['id']]['Smtp'][_0x1fa3('0x24')]='verified';_0x5a4e9f[_0x1fa3('0xf')][_0x25808c['id']][_0x1fa3('0x36')]['messageStatus']='';_0x5a4e9f[_0x1fa3('0x13')](_0x25808c['id']);_0x11d8da(_0x9266ba);})['catch'](function(_0x2a8e63){_0x5a4e9f[_0x1fa3('0xf')][_0x25808c['id']][_0x1fa3('0x36')][_0x1fa3('0x24')]='error';_0x5a4e9f[_0x1fa3('0xf')][_0x25808c['id']][_0x1fa3('0x36')]['messageStatus']=_0x2a8e63;_0x5a4e9f[_0x1fa3('0x13')](_0x25808c['id']);_0x2599a9(_0x2a8e63);});});}return this[_0x1fa3('0x11')][_0x1fa3('0x38')](_0x25808c);};module[_0x1fa3('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index e0b1c22..5cf6b46 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 _0x449d=['handleEnd','bind','error','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','once','end','handleFetchEnd','body','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','handleFetchError','textCode','upperFirst','exports','lodash','util','simpleParser','Iconv','events','./utils','../../../config/logger','email','mailbox','account','getAccount','imap','handleReady'];(function(_0x395e18,_0x55c0a3){var _0x200b78=function(_0x51c10e){while(--_0x51c10e){_0x395e18['push'](_0x395e18['shift']());}};_0x200b78(++_0x55c0a3);}(_0x449d,0x1d3));var _0xd449=function(_0x502417,_0x3b4a19){_0x502417=_0x502417-0x0;var _0x32e1f8=_0x449d[_0x502417];return _0x32e1f8;};'use strict';var _=require(_0xd449('0x0'));var util=require(_0xd449('0x1'));var Imap=require('imap');var simpleParser=require('mailparser')[_0xd449('0x2')];var Iconv=require('iconv')[_0xd449('0x3')];var EventEmitter=require(_0xd449('0x4'))['EventEmitter'];var utils=require(_0xd449('0x5'));var logger=require(_0xd449('0x6'))(_0xd449('0x7'));function EmailImap(_0x282664,_0x532db5){this[_0xd449('0x8')]=_0x282664[_0xd449('0x8')];this[_0xd449('0x9')]=this[_0xd449('0xa')](_0x282664,_0x532db5);this[_0xd449('0xb')]=new Imap(this[_0xd449('0x9')]);this[_0xd449('0xb')]['once']('ready',this[_0xd449('0xc')]['bind'](this));this['imap']['once']('end',this[_0xd449('0xd')][_0xd449('0xe')](this));this[_0xd449('0xb')]['on'](_0xd449('0xf'),this['handleError'][_0xd449('0xe')](this));this[_0xd449('0xb')][_0xd449('0x10')]();}util[_0xd449('0x11')](EmailImap,EventEmitter);EmailImap[_0xd449('0x12')][_0xd449('0xa')]=function(_0x4c1466,_0x1ab1f1){var _0x281a46={'connTimeout':_0x4c1466[_0xd449('0x13')]?_0x4c1466[_0xd449('0x13')]*0x3e8:0x2710,'authTimeout':_0x4c1466['authTimeout']?_0x4c1466[_0xd449('0x14')]*0x3e8:0x1388};if(_0x4c1466[_0xd449('0x15')]){_0x281a46[_0xd449('0x16')]=_0x4c1466[_0xd449('0x16')];if(_0x4c1466[_0xd449('0x17')]){_0x281a46['xoauth2']=utils[_0xd449('0x18')](_0x4c1466[_0xd449('0x19')][_0xd449('0x1a')],_0x4c1466[_0xd449('0x16')]);}else{_0x281a46[_0xd449('0x1b')]=_0x4c1466[_0xd449('0x1b')];}}else{if(_0x4c1466['authentication']){_0x281a46[_0xd449('0x16')]=_0x4c1466[_0xd449('0x16')];_0x281a46[_0xd449('0x1b')]=_0x4c1466[_0xd449('0x1b')];}}_0x281a46[_0xd449('0x7')]=_0x1ab1f1||_0x4c1466['user']||_0xd449('0x1c');_0x281a46[_0xd449('0x1d')]=_0x4c1466[_0xd449('0x1d')];_0x281a46[_0xd449('0x1e')]=_0x4c1466['port']||0x3e1;if(_0x4c1466[_0xd449('0x1f')]){_0x281a46[_0xd449('0x1f')]=!![];}else{_0x281a46['tls']=![];_0x281a46[_0xd449('0x20')]=_0xd449('0x21');}return _0x281a46;};EmailImap[_0xd449('0x12')][_0xd449('0xc')]=function(){this[_0xd449('0xb')][_0xd449('0x22')](this[_0xd449('0x8')],![],this[_0xd449('0x23')][_0xd449('0xe')](this));};EmailImap[_0xd449('0x12')][_0xd449('0x23')]=function(_0x1ca458,_0x4fd0e3){if(_0x1ca458){this[_0xd449('0x24')](_0x1ca458,!![]);}else{this[_0xd449('0x25')](_0xd449('0x26'),_0x4fd0e3);this[_0xd449('0x27')]();}};EmailImap[_0xd449('0x12')][_0xd449('0x28')]=function(_0x271aa5){if(_0x271aa5){this['handleError'](_0x271aa5,!![]);}else{this[_0xd449('0xb')]['end']();}};EmailImap[_0xd449('0x12')][_0xd449('0x27')]=function(){this[_0xd449('0xb')]['search']([_0xd449('0x29')],this['handleReadUnseen'][_0xd449('0xe')](this));};EmailImap[_0xd449('0x12')][_0xd449('0x2a')]=function(_0x398490,_0x46da2d){if(_0x398490){this[_0xd449('0x24')](_0x398490,!![]);}else{if(_0x46da2d[_0xd449('0x2b')]){try{var _0x10aa74=this['imap']['fetch'](_0x46da2d,{'bodies':'','markSeen':!![]});_0x10aa74['on'](_0xd449('0x2c'),this[_0xd449('0x2d')][_0xd449('0xe')](this));_0x10aa74[_0xd449('0x2e')]('error',this['handleFetchError'][_0xd449('0xe')](this));_0x10aa74[_0xd449('0x2e')](_0xd449('0x2f'),this[_0xd449('0x30')][_0xd449('0xe')](this));}catch(_0x35934d){logger['error'](_0x35934d);}}else{this[_0xd449('0xb')]['closeBox'](!![],this['handleCloseBox'][_0xd449('0xe')](this));}}};EmailImap[_0xd449('0x12')][_0xd449('0x2d')]=function(_0x4730d6){_0x4730d6['on'](_0xd449('0x31'),this['handleMessageBody'][_0xd449('0xe')](this));_0x4730d6[_0xd449('0x2e')](_0xd449('0x32'),this[_0xd449('0x33')][_0xd449('0xe')](this));_0x4730d6['once'](_0xd449('0x2f'),this[_0xd449('0x34')]['bind'](this));};EmailImap['prototype']['handleMessageBody']=function(_0x31d1ad){simpleParser(_0x31d1ad,{'Iconv':Iconv},this[_0xd449('0x35')][_0xd449('0xe')](this));};EmailImap[_0xd449('0x12')]['handleMessageAttributes']=function(){};EmailImap[_0xd449('0x12')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0xd449('0x35')]=function(_0x4e66f5,_0x14be1c){if(_0x4e66f5){logger[_0xd449('0xf')](_0x4e66f5);}else{var _0x1a5c7a=this;utils[_0xd449('0x36')](this[_0xd449('0x9')],_0x14be1c,function(_0x55e163){_0x1a5c7a['emit'](_0xd449('0x7'),_0x55e163);});}};EmailImap[_0xd449('0x12')][_0xd449('0x30')]=function(){this[_0xd449('0xb')][_0xd449('0x37')](!![],this[_0xd449('0x28')]['bind'](this));};EmailImap['prototype'][_0xd449('0x38')]=function(_0x2ea52f){this[_0xd449('0x24')](_0x2ea52f);this[_0xd449('0xb')][_0xd449('0x37')](!![],this['handleCloseBox'][_0xd449('0xe')](this));};EmailImap[_0xd449('0x12')][_0xd449('0xd')]=function(){this[_0xd449('0x25')](_0xd449('0x2f'));};EmailImap[_0xd449('0x12')][_0xd449('0x24')]=function(_0x3f3ca9,_0x369d9d){logger['error']('handleError',this['account'][_0xd449('0x7')],JSON['stringify'](_0x3f3ca9));var _0x119a57='';if(_0x3f3ca9){if(_0x3f3ca9[_0xd449('0x39')]){_0x119a57=_0x3f3ca9[_0xd449('0x39')];}else{for(var _0x2af16b in _0x3f3ca9){if(_0x3f3ca9['hasOwnProperty'](_0x2af16b)){_0x119a57+=_[_0xd449('0x3a')](_0x2af16b)+':\x20'+_0x3f3ca9[_0x2af16b]+'\x0a';}}}}if(_0x369d9d){this[_0xd449('0xb')][_0xd449('0x2f')]();}else{this[_0xd449('0x25')](_0xd449('0xf'),_0x119a57);this[_0xd449('0x25')](_0xd449('0x2f'));}};module[_0xd449('0x3b')]=EmailImap; \ No newline at end of file +var _0xd6a0=['util','imap','mailparser','simpleParser','events','EventEmitter','../../../config/logger','email','mailbox','getAccount','account','once','handleReady','end','handleEnd','bind','connect','prototype','connTimeout','authTimeout','user','xoauth2','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','openBox','handleOpenBox','handleError','emit','box','handleCloseBox','readUnseen','search','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','textCode','exports','lodash'];(function(_0x333728,_0x18f80b){var _0x2dcb72=function(_0x1d95e4){while(--_0x1d95e4){_0x333728['push'](_0x333728['shift']());}};_0x2dcb72(++_0x18f80b);}(_0xd6a0,0x15b));var _0x0d6a=function(_0x4621c5,_0x79ca9d){_0x4621c5=_0x4621c5-0x0;var _0x114a4a=_0xd6a0[_0x4621c5];return _0x114a4a;};'use strict';var _=require(_0x0d6a('0x0'));var util=require(_0x0d6a('0x1'));var Imap=require(_0x0d6a('0x2'));var simpleParser=require(_0x0d6a('0x3'))[_0x0d6a('0x4')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x0d6a('0x5'))[_0x0d6a('0x6')];var utils=require('./utils');var logger=require(_0x0d6a('0x7'))(_0x0d6a('0x8'));function EmailImap(_0x49195f,_0xb7d546){this[_0x0d6a('0x9')]=_0x49195f[_0x0d6a('0x9')];this['account']=this[_0x0d6a('0xa')](_0x49195f,_0xb7d546);this[_0x0d6a('0x2')]=new Imap(this[_0x0d6a('0xb')]);this['imap'][_0x0d6a('0xc')]('ready',this[_0x0d6a('0xd')]['bind'](this));this[_0x0d6a('0x2')][_0x0d6a('0xc')](_0x0d6a('0xe'),this[_0x0d6a('0xf')][_0x0d6a('0x10')](this));this['imap']['on']('error',this['handleError'][_0x0d6a('0x10')](this));this['imap'][_0x0d6a('0x11')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x0d6a('0x12')][_0x0d6a('0xa')]=function(_0x57ecfa,_0x473122){var _0x161558={'connTimeout':_0x57ecfa[_0x0d6a('0x13')]?_0x57ecfa[_0x0d6a('0x13')]*0x3e8:0x2710,'authTimeout':_0x57ecfa['authTimeout']?_0x57ecfa[_0x0d6a('0x14')]*0x3e8:0x1388};if(_0x57ecfa['service']){_0x161558['user']=_0x57ecfa[_0x0d6a('0x15')];if(_0x57ecfa['modernAuthentication']){_0x161558[_0x0d6a('0x16')]=utils['generateXOAuth2Token'](_0x57ecfa[_0x0d6a('0x17')][_0x0d6a('0x18')],_0x57ecfa[_0x0d6a('0x15')]);}else{_0x161558[_0x0d6a('0x19')]=_0x57ecfa[_0x0d6a('0x19')];}}else{if(_0x57ecfa[_0x0d6a('0x1a')]){_0x161558[_0x0d6a('0x15')]=_0x57ecfa[_0x0d6a('0x15')];_0x161558[_0x0d6a('0x19')]=_0x57ecfa[_0x0d6a('0x19')];}}_0x161558[_0x0d6a('0x8')]=_0x473122||_0x57ecfa['user']||_0x0d6a('0x1b');_0x161558[_0x0d6a('0x1c')]=_0x57ecfa['host'];_0x161558[_0x0d6a('0x1d')]=_0x57ecfa[_0x0d6a('0x1d')]||0x3e1;if(_0x57ecfa[_0x0d6a('0x1e')]){_0x161558['tls']=!![];}else{_0x161558[_0x0d6a('0x1e')]=![];_0x161558[_0x0d6a('0x1f')]='required';}return _0x161558;};EmailImap[_0x0d6a('0x12')]['handleReady']=function(){this[_0x0d6a('0x2')][_0x0d6a('0x20')](this['mailbox'],![],this[_0x0d6a('0x21')]['bind'](this));};EmailImap[_0x0d6a('0x12')][_0x0d6a('0x21')]=function(_0x9811c6,_0x5dee42){if(_0x9811c6){this[_0x0d6a('0x22')](_0x9811c6,!![]);}else{this[_0x0d6a('0x23')](_0x0d6a('0x24'),_0x5dee42);this['readUnseen']();}};EmailImap[_0x0d6a('0x12')][_0x0d6a('0x25')]=function(_0x3a2ed8){if(_0x3a2ed8){this[_0x0d6a('0x22')](_0x3a2ed8,!![]);}else{this[_0x0d6a('0x2')][_0x0d6a('0xe')]();}};EmailImap[_0x0d6a('0x12')][_0x0d6a('0x26')]=function(){this[_0x0d6a('0x2')][_0x0d6a('0x27')](['UNSEEN'],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0x0d6a('0x28')]=function(_0x136921,_0x19561b){if(_0x136921){this[_0x0d6a('0x22')](_0x136921,!![]);}else{if(_0x19561b[_0x0d6a('0x29')]){try{var _0x21fb57=this[_0x0d6a('0x2')][_0x0d6a('0x2a')](_0x19561b,{'bodies':'','markSeen':!![]});_0x21fb57['on'](_0x0d6a('0x2b'),this[_0x0d6a('0x2c')]['bind'](this));_0x21fb57[_0x0d6a('0xc')](_0x0d6a('0x2d'),this[_0x0d6a('0x2e')][_0x0d6a('0x10')](this));_0x21fb57[_0x0d6a('0xc')]('end',this['handleFetchEnd'][_0x0d6a('0x10')](this));}catch(_0x4436d2){logger[_0x0d6a('0x2d')](_0x4436d2);}}else{this[_0x0d6a('0x2')][_0x0d6a('0x2f')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0x0d6a('0x12')]['handleFetchMessage']=function(_0x60d55){_0x60d55['on'](_0x0d6a('0x30'),this[_0x0d6a('0x31')][_0x0d6a('0x10')](this));_0x60d55[_0x0d6a('0xc')](_0x0d6a('0x32'),this[_0x0d6a('0x33')]['bind'](this));_0x60d55[_0x0d6a('0xc')]('end',this[_0x0d6a('0x34')]['bind'](this));};EmailImap[_0x0d6a('0x12')][_0x0d6a('0x31')]=function(_0x3d79b2){simpleParser(_0x3d79b2,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0x0d6a('0x12')][_0x0d6a('0x33')]=function(){};EmailImap[_0x0d6a('0x12')][_0x0d6a('0x34')]=function(){};EmailImap[_0x0d6a('0x12')][_0x0d6a('0x35')]=function(_0xe27225,_0x10888b){if(_0xe27225){logger[_0x0d6a('0x2d')](_0xe27225);}else{var _0x414979=this;utils[_0x0d6a('0x36')](this['account'],_0x10888b,function(_0x416c7d){_0x414979[_0x0d6a('0x23')](_0x0d6a('0x8'),_0x416c7d);});}};EmailImap['prototype'][_0x0d6a('0x37')]=function(){this[_0x0d6a('0x2')][_0x0d6a('0x2f')](!![],this[_0x0d6a('0x25')][_0x0d6a('0x10')](this));};EmailImap[_0x0d6a('0x12')]['handleFetchError']=function(_0x461aeb){this[_0x0d6a('0x22')](_0x461aeb);this[_0x0d6a('0x2')][_0x0d6a('0x2f')](!![],this[_0x0d6a('0x25')]['bind'](this));};EmailImap[_0x0d6a('0x12')][_0x0d6a('0xf')]=function(){this[_0x0d6a('0x23')](_0x0d6a('0xe'));};EmailImap[_0x0d6a('0x12')][_0x0d6a('0x22')]=function(_0x2c7464,_0x5558fc){logger[_0x0d6a('0x2d')](_0x0d6a('0x22'),this[_0x0d6a('0xb')][_0x0d6a('0x8')],JSON['stringify'](_0x2c7464));var _0x1b5ff8='';if(_0x2c7464){if(_0x2c7464['textCode']){_0x1b5ff8=_0x2c7464[_0x0d6a('0x38')];}else{for(var _0x598681 in _0x2c7464){if(_0x2c7464['hasOwnProperty'](_0x598681)){_0x1b5ff8+=_['upperFirst'](_0x598681)+':\x20'+_0x2c7464[_0x598681]+'\x0a';}}}}if(_0x5558fc){this[_0x0d6a('0x2')][_0x0d6a('0xe')]();}else{this[_0x0d6a('0x23')](_0x0d6a('0x2d'),_0x1b5ff8);this[_0x0d6a('0x23')](_0x0d6a('0xe'));}};module[_0x0d6a('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index dd5783e..c866f57 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x278d=['compile','sendMail','toString','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x3f8a92,_0x4c2824){var _0x536241=function(_0x48e8af){while(--_0x48e8af){_0x3f8a92['push'](_0x3f8a92['shift']());}};_0x536241(++_0x4c2824);}(_0x278d,0xd3));var _0xd278=function(_0x4aefb9,_0x55959c){_0x4aefb9=_0x4aefb9-0x0;var _0x3152dc=_0x278d[_0x4aefb9];return _0x3152dc;};'use strict';var nodemailer=require(_0xd278('0x0'));var inlineBase64=require(_0xd278('0x1'));function EmailSmtp(){}EmailSmtp[_0xd278('0x2')][_0xd278('0x3')]=function(_0x3221c3,_0x44b98e){return new Promise(function(_0x58e558,_0x45e774){var _0x3be624=nodemailer[_0xd278('0x4')](_0x3221c3);_0x3be624['use'](_0xd278('0x5'),inlineBase64());_0x3be624[_0xd278('0x6')](_0x44b98e,function(_0x1b3763,_0x1fd846){if(_0x1b3763){_0x45e774(_0x1b3763[_0xd278('0x7')]());}else{_0x58e558(_0x1fd846);}});});};EmailSmtp['prototype']['verify']=function(_0x384961){return new Promise(function(_0x2145d9,_0x36590f){var _0x22240d=nodemailer[_0xd278('0x4')](_0x384961);_0x22240d['verify'](function(_0x2e6c07,_0x5a3766){if(_0x2e6c07){_0x36590f(_0x2e6c07[_0xd278('0x7')]());}else{if(_0x5a3766){_0x2145d9(_0x5a3766);}else{_0x36590f(_0xd278('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x1a51=['createTransport','use','compile','toString','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0x1a51,0x14a));var _0x11a5=function(_0x515463,_0x40a2f8){_0x515463=_0x515463-0x0;var _0x38a312=_0x1a51[_0x515463];return _0x38a312;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x11a5('0x0'));function EmailSmtp(){}EmailSmtp[_0x11a5('0x1')][_0x11a5('0x2')]=function(_0x4126a6,_0x13a130){return new Promise(function(_0x47179a,_0x559014){var _0x3ac2c2=nodemailer[_0x11a5('0x3')](_0x4126a6);_0x3ac2c2[_0x11a5('0x4')](_0x11a5('0x5'),inlineBase64());_0x3ac2c2['sendMail'](_0x13a130,function(_0x20b57c,_0x53db9f){if(_0x20b57c){_0x559014(_0x20b57c[_0x11a5('0x6')]());}else{_0x47179a(_0x53db9f);}});});};EmailSmtp[_0x11a5('0x1')]['verify']=function(_0x1d3166){return new Promise(function(_0x4a10a2,_0x2915bf){var _0x158122=nodemailer[_0x11a5('0x3')](_0x1d3166);_0x158122['verify'](function(_0x3b45b8,_0x1904a3){if(_0x3b45b8){_0x2915bf(_0x3b45b8[_0x11a5('0x6')]());}else{if(_0x1904a3){_0x4a10a2(_0x1904a3);}else{_0x2915bf(_0x11a5('0x7'));}}});});};module[_0x11a5('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index a1ea4db..253253f 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdc0=['bcc','attachments','attach','type','attachment-','now','root','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','inReplyTo','date','format','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','

Empty\x20message

','Attachments','push','Title','generateXOAuth2Token','user=','utf-8','toString','moment','randomstring','path','util','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','pop','isEmpty','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x564f33[_0x0fdc('0x11')](0x0,-0x1)[_0x0fdc('0x12')]('\x20'):_0x3f9d27[_0x0fdc('0xc')];}return'Anonymous';}function getLastName(_0x2b5f15){var _0x456d46=_[_0x0fdc('0x6')](_0x2b5f15[_0x0fdc('0x7')]);if(_0x456d46&&_0x456d46[_0x0fdc('0xc')]){var _0x37a445=_0x456d46[_0x0fdc('0xc')]['split'](/\s+/);return _0x37a445[_0x0fdc('0x10')]>0x1?_0x37a445[_0x0fdc('0x13')]():'';}return'';}function getMails(_0x428829,_0x3aed40){var _0x427ec9='';for(var _0x36b3f2=0x0;_0x36b3f2<_0x3aed40[_0x0fdc('0x7')][_0x0fdc('0x10')];_0x36b3f2+=0x1){if(_0x3aed40[_0x0fdc('0x7')][_0x36b3f2]['address']!==_0x428829){if(!_[_0x0fdc('0x14')](_0x427ec9)){_0x427ec9+=',';}_0x427ec9+=_0x3aed40['value'][_0x36b3f2][_0x0fdc('0xc')]||_0x3aed40[_0x0fdc('0x7')][_0x36b3f2]['address']||'';_0x427ec9+='\x20<';_0x427ec9+=_0x3aed40['value'][_0x36b3f2][_0x0fdc('0x8')]?_0x3aed40[_0x0fdc('0x7')][_0x36b3f2][_0x0fdc('0x8')]:_0x0fdc('0x9')+random['generate'](0x6)+_0x0fdc('0xb');_0x427ec9+='>';}}return _0x427ec9;}function parseEmail(_0x5dc6c2,_0x3fb99d,_0x18cd27){if(_0x3fb99d['html']){var _0x267c8f=/)<[^<]*)*<\/script>/gi;while(_0x267c8f[_0x0fdc('0x15')](_0x3fb99d[_0x0fdc('0x16')])){_0x3fb99d[_0x0fdc('0x16')]=_0x3fb99d[_0x0fdc('0x16')][_0x0fdc('0x17')](_0x267c8f,'');}if(_0x3fb99d[_0x0fdc('0x16')][_0x0fdc('0x18')](_0x0fdc('0x19'))){var _0xfe1eea=[];_0x3fb99d['attachments'][_0x0fdc('0x1a')](_0x3ed939=>{_0xfe1eea['push'](_0x3ed939[_0x0fdc('0x1b')]);});var _0x8b088e=/]+>/g;var _0x494760=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4c3bd8=_0x3fb99d[_0x0fdc('0x16')][_0x0fdc('0x17')](_0x494760,_0x0fdc('0x1c'));var _0x27b9d6=_0x4c3bd8[_0x0fdc('0x17')](_0x8b088e,_0x0fdc('0x1d'));for(let _0x1d4e6c=0x0;_0x1d4e6c<_0xfe1eea[_0x0fdc('0x10')];_0x1d4e6c++){var _0xd87f1e=_0x27b9d6[_0x0fdc('0x17')](_0x0fdc('0x1d'),_0x0fdc('0x1e')+_0xfe1eea[_0x1d4e6c]+_0x0fdc('0x1f'));_0x27b9d6=_0xd87f1e;}_0x3fb99d['html']=_0x27b9d6;}_0x18cd27[_0x0fdc('0x20')]=_0x3fb99d[_0x0fdc('0x16')];}else{_0x18cd27['body']=_0x3fb99d[_0x0fdc('0x21')];}if(_0x18cd27['body']){_0x18cd27[_0x0fdc('0x20')]=_0x18cd27[_0x0fdc('0x20')]['replace'](/0x0){var _0x100b5d=[_0x0fdc('0x30'),_0x0fdc('0x31'),_0x0fdc('0x32')];for(var _0x5a109f=0x0;_0x5a109f<_0x3fb99d[_0x0fdc('0x2f')][_0x0fdc('0x10')];_0x5a109f++){var _0xca3c95=_[_0x0fdc('0xe')](_0x100b5d,_0x3fb99d[_0x0fdc('0x2f')][_0x5a109f][_0x0fdc('0x33')]);if(_0xca3c95>=0x0){_0x18cd27[_0x0fdc('0x34')]=!![];}}}return _0x18cd27;}exports[_0x0fdc('0x35')]=function(_0x1a77b2,_0x2084ef,_0x197c78){var _0x1c1dc5={'from':getAddress(_0x2084ef[_0x0fdc('0x36')]),'firstName':getFirstName(_0x2084ef[_0x0fdc('0x36')]),'lastName':getLastName(_0x2084ef[_0x0fdc('0x36')]),'mapKey':_0x0fdc('0x5'),'message':{'from':getMails(_0x1a77b2[_0x0fdc('0x5')],_0x2084ef['from']),'to':_0x1a77b2[_0x0fdc('0x5')],'cc':'','subject':_0x2084ef[_0x0fdc('0x37')]||'','messageId':_0x2084ef['messageId'],'inReplyTo':_0x2084ef[_0x0fdc('0x38')],'sentAt':moment(_0x2084ef[_0x0fdc('0x39')])[_0x0fdc('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x2084ef['html']&&!_0x2084ef['textAsHtml']){var _0x55eb45=_[_0x0fdc('0x3b')](_0x2084ef[_0x0fdc('0x27')],{'contentType':_0x0fdc('0x3c')});if(_0x55eb45[_0x0fdc('0x10')]){logger['info'](util[_0x0fdc('0x3a')](_0x0fdc('0x3d'),_0x2084ef[_0x0fdc('0x3e')]));tnef[_0x0fdc('0x3f')](_['first'](_0x55eb45)['content'],function(_0x39864b,_0x55186c){if(_0x55186c){_0x2084ef[_0x0fdc('0x16')]=_0x55186c['BodyHTML']||_0x0fdc('0x40');if(_0x55186c[_0x0fdc('0x41')]){for(var _0xd37481=0x0;_0xd37481<_0x55186c[_0x0fdc('0x41')]['length'];_0xd37481++){var _0x13c875=_0x55186c['Attachments'][_0xd37481];_0x1c1dc5['message'][_0x0fdc('0x27')][_0x0fdc('0x42')]({'filename':_0x13c875[_0x0fdc('0x43')],'content':Buffer['from'](_0x13c875['Data'])});}}}_0x197c78(parseEmail(_0x1a77b2,_0x2084ef,_0x1c1dc5));});}else{_0x2084ef[_0x0fdc('0x16')]=_0x0fdc('0x40');_0x197c78(parseEmail(_0x1a77b2,_0x2084ef,_0x1c1dc5));}}else{_0x197c78(parseEmail(_0x1a77b2,_0x2084ef,_0x1c1dc5));}};exports[_0x0fdc('0x44')]=function(_0x4c2bcb,_0x43713a){var _0x34c032=[_0x0fdc('0x45')+(_0x43713a||''),'auth=Bearer\x20'+_0x4c2bcb,'',''];return Buffer[_0x0fdc('0x36')](_0x34c032['join'](''),_0x0fdc('0x46'))[_0x0fdc('0x47')]('base64');}; \ No newline at end of file +var _0x0439=['user=','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','generate','@xcally.com','name','length','slice','Anonymous','pop','isEmpty','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0439,0xe5));var _0x9043=function(_0x395718,_0x20322d){_0x395718=_0x395718-0x0;var _0x3028b8=_0x0439[_0x395718];return _0x3028b8;};'use strict';var _=require(_0x9043('0x0'));var moment=require(_0x9043('0x1'));var random=require(_0x9043('0x2'));var fs=require('fs');var path=require(_0x9043('0x3'));var util=require(_0x9043('0x4'));var tnef=require(_0x9043('0x5'));var logger=require(_0x9043('0x6'))('email');var config=require(_0x9043('0x7'));function getAddress(_0x588b2d){var _0x194fbb=_[_0x9043('0x8')](_0x588b2d[_0x9043('0x9')]);return _0x194fbb&&_0x194fbb['address']?_0x194fbb[_0x9043('0xa')]:'anonymous'+random[_0x9043('0xb')](0x6)+_0x9043('0xc');}function getFirstName(_0x4bee85){var _0x50c7e3=_[_0x9043('0x8')](_0x4bee85[_0x9043('0x9')]);if(_0x50c7e3&&_0x50c7e3[_0x9043('0xd')]){if(_0x50c7e3[_0x9043('0xd')]==_0x50c7e3[_0x9043('0xa')]){return _0x50c7e3[_0x9043('0xd')]['substring'](0x0,_0x50c7e3[_0x9043('0xd')]['indexOf']('@'));}var _0x3da18a=_0x50c7e3[_0x9043('0xd')]['split'](/\s+/);return _0x3da18a[_0x9043('0xe')]>0x1?_0x3da18a[_0x9043('0xf')](0x0,-0x1)['join']('\x20'):_0x50c7e3[_0x9043('0xd')];}return _0x9043('0x10');}function getLastName(_0x2610a8){var _0x564791=_[_0x9043('0x8')](_0x2610a8['value']);if(_0x564791&&_0x564791[_0x9043('0xd')]){var _0x11a268=_0x564791[_0x9043('0xd')]['split'](/\s+/);return _0x11a268[_0x9043('0xe')]>0x1?_0x11a268[_0x9043('0x11')]():'';}return'';}function getMails(_0x148f62,_0x2e4d4f){var _0x2017e0='';for(var _0x2b03f8=0x0;_0x2b03f8<_0x2e4d4f[_0x9043('0x9')][_0x9043('0xe')];_0x2b03f8+=0x1){if(_0x2e4d4f['value'][_0x2b03f8][_0x9043('0xa')]!==_0x148f62){if(!_[_0x9043('0x12')](_0x2017e0)){_0x2017e0+=',';}_0x2017e0+=_0x2e4d4f[_0x9043('0x9')][_0x2b03f8][_0x9043('0xd')]||_0x2e4d4f[_0x9043('0x9')][_0x2b03f8][_0x9043('0xa')]||'';_0x2017e0+='\x20<';_0x2017e0+=_0x2e4d4f[_0x9043('0x9')][_0x2b03f8][_0x9043('0xa')]?_0x2e4d4f[_0x9043('0x9')][_0x2b03f8][_0x9043('0xa')]:'anonymous'+random[_0x9043('0xb')](0x6)+'@xcally.com';_0x2017e0+='>';}}return _0x2017e0;}function parseEmail(_0x41978e,_0x4f9e6a,_0x138a07){if(_0x4f9e6a[_0x9043('0x13')]){var _0x26f5ab=/)<[^<]*)*<\/script>/gi;while(_0x26f5ab[_0x9043('0x14')](_0x4f9e6a[_0x9043('0x13')])){_0x4f9e6a[_0x9043('0x13')]=_0x4f9e6a[_0x9043('0x13')]['replace'](_0x26f5ab,'');}if(_0x4f9e6a[_0x9043('0x13')][_0x9043('0x15')](_0x9043('0x16'))){var _0xa30896=[];_0x4f9e6a[_0x9043('0x17')]['forEach'](_0x1764bc=>{_0xa30896['push'](_0x1764bc['filename']);});var _0x21b69a=/]+>/g;var _0x4dd4f5=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x508b03=_0x4f9e6a['html']['replace'](_0x4dd4f5,_0x9043('0x18'));var _0x40da3a=_0x508b03[_0x9043('0x19')](_0x21b69a,_0x9043('0x1a'));for(let _0x683c26=0x0;_0x683c26<_0xa30896[_0x9043('0xe')];_0x683c26++){var _0x2fd840=_0x40da3a[_0x9043('0x19')](_0x9043('0x1a'),_0x9043('0x1b')+_0xa30896[_0x683c26]+_0x9043('0x1c'));_0x40da3a=_0x2fd840;}_0x4f9e6a['html']=_0x40da3a;}_0x138a07[_0x9043('0x1d')]=_0x4f9e6a[_0x9043('0x13')];}else{_0x138a07[_0x9043('0x1d')]=_0x4f9e6a[_0x9043('0x1e')];}if(_0x138a07['body']){_0x138a07['body']=_0x138a07[_0x9043('0x1d')]['replace'](/0x0){var _0x573097=[_0x9043('0x31'),_0x9043('0x32'),_0x9043('0x33')];for(var _0xeb8a16=0x0;_0xeb8a16<_0x4f9e6a[_0x9043('0x34')][_0x9043('0xe')];_0xeb8a16++){var _0x282039=_[_0x9043('0x35')](_0x573097,_0x4f9e6a['headerLines'][_0xeb8a16][_0x9043('0x36')]);if(_0x282039>=0x0){_0x138a07[_0x9043('0x37')]=!![];}}}return _0x138a07;}exports[_0x9043('0x38')]=function(_0x5b94c4,_0x44bd42,_0x485945){var _0x3c8e0e={'from':getAddress(_0x44bd42['from']),'firstName':getFirstName(_0x44bd42[_0x9043('0x39')]),'lastName':getLastName(_0x44bd42[_0x9043('0x39')]),'mapKey':_0x9043('0x22'),'message':{'from':getMails(_0x5b94c4[_0x9043('0x22')],_0x44bd42[_0x9043('0x39')]),'to':_0x5b94c4[_0x9043('0x22')],'cc':'','subject':_0x44bd42[_0x9043('0x3a')]||'','messageId':_0x44bd42[_0x9043('0x3b')],'inReplyTo':_0x44bd42[_0x9043('0x3c')],'sentAt':moment(_0x44bd42[_0x9043('0x3d')])[_0x9043('0x27')](_0x9043('0x3e')),'attach':![],'attachments':[]}};if(!_0x44bd42[_0x9043('0x13')]&&!_0x44bd42[_0x9043('0x1e')]){var _0x44ee25=_['filter'](_0x44bd42[_0x9043('0x17')],{'contentType':_0x9043('0x3f')});if(_0x44ee25[_0x9043('0xe')]){logger[_0x9043('0x40')](util[_0x9043('0x27')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x44bd42['messageId']));tnef['parseBuffer'](_[_0x9043('0x41')](_0x44ee25)[_0x9043('0x2e')],function(_0x355313,_0xf48527){if(_0xf48527){_0x44bd42[_0x9043('0x13')]=_0xf48527[_0x9043('0x42')]||'

Empty\x20message

';if(_0xf48527['Attachments']){for(var _0x37f46c=0x0;_0x37f46c<_0xf48527['Attachments'][_0x9043('0xe')];_0x37f46c++){var _0x514eb3=_0xf48527[_0x9043('0x43')][_0x37f46c];_0x3c8e0e[_0x9043('0x20')][_0x9043('0x17')][_0x9043('0x2f')]({'filename':_0x514eb3[_0x9043('0x44')],'content':Buffer[_0x9043('0x39')](_0x514eb3[_0x9043('0x45')])});}}}_0x485945(parseEmail(_0x5b94c4,_0x44bd42,_0x3c8e0e));});}else{_0x44bd42[_0x9043('0x13')]=_0x9043('0x46');_0x485945(parseEmail(_0x5b94c4,_0x44bd42,_0x3c8e0e));}}else{_0x485945(parseEmail(_0x5b94c4,_0x44bd42,_0x3c8e0e));}};exports['generateXOAuth2Token']=function(_0x2d7649,_0xd2d403){var _0x2b7f08=[_0x9043('0x47')+(_0xd2d403||''),'auth=Bearer\x20'+_0x2d7649,'',''];return Buffer[_0x9043('0x39')](_0x2b7f08[_0x9043('0x2a')](''),_0x9043('0x48'))[_0x9043('0x49')](_0x9043('0x4a'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 1c9e38a..4027f5a 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 _0x2a9b=['Service','key','SERV','active','Imap','Smtp','lodash','name'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x2a9b,0xfe));var _0xb2a9=function(_0x21e1e4,_0x2dbba2){_0x21e1e4=_0x21e1e4-0x0;var _0x57fc6b=_0x2a9b[_0x21e1e4];return _0x57fc6b;};'use strict';var _=require(_0xb2a9('0x0'));function MailAccount(_0x4106b1){this['id']=_0x4106b1['id']||0x0;this['name']=_0x4106b1[_0xb2a9('0x1')]||_0xb2a9('0x2');this[_0xb2a9('0x3')]=_0x4106b1['key']||_0xb2a9('0x4');this[_0xb2a9('0x5')]=_0x4106b1['active']||![];this[_0xb2a9('0x6')]=_0x4106b1[_0xb2a9('0x6')]||[];this[_0xb2a9('0x7')]=_0x4106b1[_0xb2a9('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x78a9=['Smtp','exports','lodash','key','SERV','active','Imap'];(function(_0x59039e,_0x23e998){var _0x443e54=function(_0x5368dc){while(--_0x5368dc){_0x59039e['push'](_0x59039e['shift']());}};_0x443e54(++_0x23e998);}(_0x78a9,0x1e5));var _0x978a=function(_0x118f89,_0x1be10e){_0x118f89=_0x118f89-0x0;var _0x1ec63e=_0x78a9[_0x118f89];return _0x1ec63e;};'use strict';var _=require(_0x978a('0x0'));function MailAccount(_0x57daac){this['id']=_0x57daac['id']||0x0;this['name']=_0x57daac['name']||'Service';this[_0x978a('0x1')]=_0x57daac['key']||_0x978a('0x2');this[_0x978a('0x3')]=_0x57daac[_0x978a('0x3')]||![];this['Imap']=_0x57daac[_0x978a('0x4')]||[];this[_0x978a('0x5')]=_0x57daac[_0x978a('0x5')]||[];}module[_0x978a('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 9068d30..ef3f82c 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 _0xd828=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','isUndefined','merge','exports','lodash','../model/mailAccount'];(function(_0xa61bb,_0x1981ce){var _0x3253a3=function(_0x492e9d){while(--_0x492e9d){_0xa61bb['push'](_0xa61bb['shift']());}};_0x3253a3(++_0x1981ce);}(_0xd828,0xda));var _0x8d82=function(_0xf87462,_0x1021f8){_0xf87462=_0xf87462-0x0;var _0x536548=_0xd828[_0xf87462];return _0x536548;};'use strict';var _=require(_0x8d82('0x0'));var MailAccount=require(_0x8d82('0x1'));var Realtime=function(){this[_0x8d82('0x2')]={};};function freeIsNotKey(_0x5c6f82,_0x140027,_0xde2bd4){var _0x1f5f59=_[_0x8d82('0x3')](_0x5c6f82,function(_0x23d3f7,_0x2d9d80){return _0x23d3f7[_0xde2bd4];});for(var _0x1b149a in _0x140027){if(_0x140027[_0x8d82('0x4')](_0x1b149a)){if(!_0x1f5f59[_0x1b149a]){delete _0x140027[_0x1b149a];}}}}Realtime[_0x8d82('0x5')][_0x8d82('0x6')]=function(_0x3484e5,_0x264a85){for(var _0x87962 in _0x264a85){if(_0x3484e5[_0x8d82('0x4')](_0x87962)){_0x3484e5[_0x87962]=_0x264a85[_0x87962];}}};Realtime['prototype'][_0x8d82('0x7')]=function(){var _0x1ed608=this;return function(_0x3c9d24){if(_0x3c9d24){freeIsNotKey(_0x3c9d24,_0x1ed608[_0x8d82('0x2')],'id');for(var _0x370890=0x0,_0x2da1c4={},_0x50d280={};_0x370890<_0x3c9d24['length'];_0x370890+=0x1){_0x2da1c4=_0x3c9d24[_0x370890];if(_[_0x8d82('0x8')](_0x1ed608[_0x8d82('0x2')][_0x2da1c4['id']])){_0x1ed608['mailAccounts'][_0x2da1c4['id']]=new MailAccount(_0x2da1c4);}else{_[_0x8d82('0x9')](_0x1ed608[_0x8d82('0x2')][_0x2da1c4['id']],_0x2da1c4);}}}return _0x1ed608[_0x8d82('0x2')];};};module[_0x8d82('0xa')]=Realtime; \ No newline at end of file +var _0xbd09=['initMailAccounts','isUndefined','merge','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x2b6049,_0x3d1393){var _0x397252=function(_0x5355a6){while(--_0x5355a6){_0x2b6049['push'](_0x2b6049['shift']());}};_0x397252(++_0x3d1393);}(_0xbd09,0x9c));var _0x9bd0=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xbd09[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x9bd0('0x0'));var MailAccount=require(_0x9bd0('0x1'));var Realtime=function(){this[_0x9bd0('0x2')]={};};function freeIsNotKey(_0x473421,_0x2c7fda,_0x13681f){var _0x1c2b23=_['mapKeys'](_0x473421,function(_0x41cda0,_0xfa2172){return _0x41cda0[_0x13681f];});for(var _0xd1343a in _0x2c7fda){if(_0x2c7fda[_0x9bd0('0x3')](_0xd1343a)){if(!_0x1c2b23[_0xd1343a]){delete _0x2c7fda[_0xd1343a];}}}}Realtime[_0x9bd0('0x4')][_0x9bd0('0x5')]=function(_0x36468c,_0x26f4ff){for(var _0x564428 in _0x26f4ff){if(_0x36468c[_0x9bd0('0x3')](_0x564428)){_0x36468c[_0x564428]=_0x26f4ff[_0x564428];}}};Realtime[_0x9bd0('0x4')][_0x9bd0('0x6')]=function(){var _0xaf43e9=this;return function(_0x5e3e29){if(_0x5e3e29){freeIsNotKey(_0x5e3e29,_0xaf43e9['mailAccounts'],'id');for(var _0x4c8010=0x0,_0x25f219={},_0xd5979b={};_0x4c8010<_0x5e3e29['length'];_0x4c8010+=0x1){_0x25f219=_0x5e3e29[_0x4c8010];if(_[_0x9bd0('0x7')](_0xaf43e9[_0x9bd0('0x2')][_0x25f219['id']])){_0xaf43e9[_0x9bd0('0x2')][_0x25f219['id']]=new MailAccount(_0x25f219);}else{_[_0x9bd0('0x8')](_0xaf43e9[_0x9bd0('0x2')][_0x25f219['id']],_0x25f219);}}}return _0xaf43e9[_0x9bd0('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 42f744b..b16eb94 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 _0x3457=['email','active','key','TemplateId','type','data5','CloudProvider','MailServerOut','getMailAccount','notify','Request','NotifyMailAccount','name','provider','service'];(function(_0x518d3e,_0x2f6816){var _0x3954b2=function(_0x5b83a1){while(--_0x5b83a1){_0x518d3e['push'](_0x518d3e['shift']());}};_0x3954b2(++_0x2f6816);}(_0x3457,0x93));var _0x7345=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3457[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x7345('0x0'),_0x7345('0x1'),_0x7345('0x2'),_0x7345('0x3'),_0x7345('0x4'),_0x7345('0x5'),'ListId',_0x7345('0x6')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':'CloudProvider','attributes':['id',_0x7345('0x0'),_0x7345('0x2'),_0x7345('0x7'),_0x7345('0x8')],'as':_0x7345('0x9')}]},{'model':_0x7345('0xa'),'as':'Smtp','include':[{'model':_0x7345('0x9'),'attributes':['id',_0x7345('0x0'),_0x7345('0x2'),_0x7345('0x7'),'data5'],'as':_0x7345('0x9')}]}]},'log':_0x7345('0xb')});};};exports[_0x7345('0xc')]=function(_0x39a092,_0x5101c1){return client[_0x7345('0xd')]('NotifyMailAccount',{'account':{'id':_0x39a092},'body':_0x5101c1,'log':_0x7345('0xe')});}; \ No newline at end of file +var _0x4753=['MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','name','provider','email','MailServerIn','Imap','service','type','data5','CloudProvider'];(function(_0xaa016c,_0x59e4b0){var _0x35f6ee=function(_0x4897f9){while(--_0x4897f9){_0xaa016c['push'](_0xaa016c['shift']());}};_0x35f6ee(++_0x59e4b0);}(_0x4753,0x1f4));var _0x3475=function(_0x512d9e,_0x2827fe){_0x512d9e=_0x512d9e-0x0;var _0x12e32f=_0x4753[_0x512d9e];return _0x12e32f;};'use strict';var client=require(_0x3475('0x0'));exports[_0x3475('0x1')]=function(){return function(){return client[_0x3475('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x3475('0x3'),_0x3475('0x4'),'service',_0x3475('0x5'),'active','key','ListId','TemplateId'],'raw':![],'include':[{'model':_0x3475('0x6'),'as':_0x3475('0x7'),'include':[{'model':'CloudProvider','attributes':['id',_0x3475('0x3'),_0x3475('0x8'),_0x3475('0x9'),_0x3475('0xa')],'as':_0x3475('0xb')}]},{'model':_0x3475('0xc'),'as':_0x3475('0xd'),'include':[{'model':_0x3475('0xb'),'attributes':['id',_0x3475('0x3'),_0x3475('0x8'),'type',_0x3475('0xa')],'as':_0x3475('0xb')}]}]},'log':_0x3475('0xe')});};};exports['notify']=function(_0x2e2662,_0x3e6cae){return client['Request'](_0x3475('0xf'),{'account':{'id':_0x2e2662},'body':_0x3e6cae,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 1775870..ff5a922 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 _0x8619=['../client','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x3c793c,_0x1e17b5){var _0x1e91f2=function(_0x980ea2){while(--_0x980ea2){_0x3c793c['push'](_0x3c793c['shift']());}};_0x1e91f2(++_0x1e17b5);}(_0x8619,0x7d));var _0x9861=function(_0x5d3267,_0xe106a8){_0x5d3267=_0x5d3267-0x0;var _0x57dba1=_0x8619[_0x5d3267];return _0x57dba1;};'use strict';var client=require(_0x9861('0x0'));exports['getSettings']=function(){return client[_0x9861('0x1')](_0x9861('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9861('0x3')]},'log':_0x9861('0x4')});}; \ No newline at end of file +var _0x75bd=['getSettings','Request','ShowSetting','GetSettings'];(function(_0x4c0abe,_0x4647a2){var _0x5dbe93=function(_0x3436c4){while(--_0x3436c4){_0x4c0abe['push'](_0x4c0abe['shift']());}};_0x5dbe93(++_0x4647a2);}(_0x75bd,0x1b8));var _0xd75b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x75bd[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0xd75b('0x0')]=function(){return client[_0xd75b('0x1')](_0xd75b('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xd75b('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index edcf8b8..6797de3 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 e799a10..19aad13 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 _0x694e=['log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','listen','port','websocket','polling','redis','defaults','localhost','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','listening'];(function(_0x528967,_0xcccffa){var _0x4b3fa8=function(_0x1a3834){while(--_0x1a3834){_0x528967['push'](_0x528967['shift']());}};_0x4b3fa8(++_0xcccffa);}(_0x694e,0x75));var _0xe694=function(_0x487738,_0x506e26){_0x487738=_0x487738-0x0;var _0x139165=_0x694e[_0x487738];return _0x139165;};'use strict';var _=require(_0xe694('0x0'));var http=require(_0xe694('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0xe694('0x2')](server,config[_0xe694('0x3')])){var socketio=require('socket.io')(server,{'transports':[_0xe694('0x4'),_0xe694('0x5')]});config[_0xe694('0x6')]=_[_0xe694('0x7')](config['redis'],{'host':_0xe694('0x8'),'port':0x18eb});socketio['adapter'](require(_0xe694('0x9'))({'pubClient':new Redis(config[_0xe694('0x6')]),'subClient':new Redis(config[_0xe694('0x6')])}));require('../../config/triggers')[_0xe694('0xa')]();require(_0xe694('0xb'))[_0xe694('0xa')](socketio);require(_0xe694('0xc'))[_0xe694('0xa')](app);require(_0xe694('0xd'))[_0xe694('0xa')](app);}else{server[_0xe694('0xe')](_0xe694('0xf'),function(){console[_0xe694('0x10')](_0xe694('0x11'),config['port']);});}exports=module[_0xe694('0x12')]=app; \ No newline at end of file +var _0x51d4=['lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','websocket','polling','defaults','redis','localhost','adapter','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','listening','log','exports'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x51d4,0x187));var _0x451d=function(_0x319b4b,_0x4abc27){_0x319b4b=_0x319b4b-0x0;var _0x412db2=_0x51d4[_0x319b4b];return _0x412db2;};'use strict';var _=require(_0x451d('0x0'));var http=require(_0x451d('0x1'));var express=require('express');var sticky=require(_0x451d('0x2'));var Redis=require(_0x451d('0x3'));var config=require(_0x451d('0x4'));var app=express();var server=http[_0x451d('0x5')](app);server[_0x451d('0x6')]=0xdbba0;if(sticky[_0x451d('0x7')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':[_0x451d('0x8'),_0x451d('0x9')]});config['redis']=_[_0x451d('0xa')](config[_0x451d('0xb')],{'host':_0x451d('0xc'),'port':0x18eb});socketio[_0x451d('0xd')](require(_0x451d('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x451d('0xb')])}));require('../../config/triggers')[_0x451d('0xf')]();require(_0x451d('0x10'))['default'](socketio);require(_0x451d('0x11'))[_0x451d('0xf')](app);require(_0x451d('0x12'))['default'](app);}else{server[_0x451d('0x13')](_0x451d('0x14'),function(){console[_0x451d('0x15')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module[_0x451d('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index daccea5..e1bb446 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 _0x2baa=['message','result','catch','exports','bluebird','../../config/logger','routing','client','http','Request','request','then','rpc','error'];(function(_0x537c02,_0x4fcbad){var _0x496498=function(_0x50156d){while(--_0x50156d){_0x537c02['push'](_0x537c02['shift']());}};_0x496498(++_0x4fcbad);}(_0x2baa,0x1a8));var _0xa2ba=function(_0x388d08,_0x260717){_0x388d08=_0x388d08-0x0;var _0x3fbe10=_0x2baa[_0x388d08];return _0x3fbe10;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa2ba('0x0'));var logger=require(_0xa2ba('0x1'))(_0xa2ba('0x2'));var client=jayson[_0xa2ba('0x3')][_0xa2ba('0x4')]({'port':0x2329});client[_0xa2ba('0x5')]=function(_0x202706,_0x5b675e){return new BPromise(function(_0xf90c98,_0x35bb81){return client[_0xa2ba('0x6')](_0x202706,_0x5b675e)[_0xa2ba('0x7')](function(_0x38710b){logger['debug'](_0xa2ba('0x8'),_0xa2ba('0x2'),_0x202706,_0x5b675e,_0x38710b);if(_0x38710b['error']){logger[_0xa2ba('0x9')](_0xa2ba('0x8'),_0xa2ba('0x2'),_0x202706,_0x38710b[_0xa2ba('0x9')][_0xa2ba('0xa')],_0x5b675e);return _0x35bb81(_0x38710b[_0xa2ba('0x9')]['message']);}else{return _0xf90c98(_0x38710b[_0xa2ba('0xb')]);}})[_0xa2ba('0xc')](function(_0x5c2a17){logger[_0xa2ba('0x9')](_0xa2ba('0x8'),_0xa2ba('0x2'),_0x202706,_0x5c2a17,_0x5b675e);return _0x35bb81(_0x5c2a17);});});};module[_0xa2ba('0xd')]=client; \ No newline at end of file +var _0x504b=['debug','rpc','error','routing','message','result','exports','jayson/promise','bluebird','../../config/logger','http','Request','then'];(function(_0x46c842,_0x1f384e){var _0x55e926=function(_0x2c09aa){while(--_0x2c09aa){_0x46c842['push'](_0x46c842['shift']());}};_0x55e926(++_0x1f384e);}(_0x504b,0x7c));var _0xb504=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x504b[_0x321bb2];return _0x9c12ed;};'use strict';var jayson=require(_0xb504('0x0'));var BPromise=require(_0xb504('0x1'));var logger=require(_0xb504('0x2'))('routing');var client=jayson['client'][_0xb504('0x3')]({'port':0x2329});client[_0xb504('0x4')]=function(_0x1a5808,_0x407627){return new BPromise(function(_0x1dfad6,_0xdb5968){return client['request'](_0x1a5808,_0x407627)[_0xb504('0x5')](function(_0x4ce7f1){logger[_0xb504('0x6')](_0xb504('0x7'),'routing',_0x1a5808,_0x407627,_0x4ce7f1);if(_0x4ce7f1[_0xb504('0x8')]){logger[_0xb504('0x8')]('rpc',_0xb504('0x9'),_0x1a5808,_0x4ce7f1[_0xb504('0x8')][_0xb504('0xa')],_0x407627);return _0xdb5968(_0x4ce7f1[_0xb504('0x8')][_0xb504('0xa')]);}else{return _0x1dfad6(_0x4ce7f1[_0xb504('0xb')]);}})['catch'](function(_0x22eec0){logger[_0xb504('0x8')](_0xb504('0x7'),_0xb504('0x9'),_0x1a5808,_0x22eec0,_0x407627);return _0xdb5968(_0x22eec0);});});};module[_0xb504('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index b113227..dce212a 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 _0xa84d=['initOpenchannelQueues','initWhatsappQueues','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues'];(function(_0x831181,_0x291cd9){var _0x37a37a=function(_0x3d47f7){while(--_0x3d47f7){_0x831181['push'](_0x831181['shift']());}};_0x37a37a(++_0x291cd9);}(_0xa84d,0x122));var _0xda84=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa84d[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0xda84('0x0'));var server=require(_0xda84('0x1'));var Realtime=require(_0xda84('0x2'));var user=require(_0xda84('0x3'));var interval=require(_0xda84('0x4'));var openchannelQueue=require(_0xda84('0x5'));var chatQueue=require(_0xda84('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xda84('0x7'));var faxQueue=require(_0xda84('0x8'));var whatsappQueue=require(_0xda84('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xda84('0xa')]()[_0xda84('0xb')](user[_0xda84('0xc')]())[_0xda84('0xb')](realtime[_0xda84('0xd')]())['then'](interval[_0xda84('0xe')]())[_0xda84('0xb')](realtime['initIntervals']())['then'](openchannelQueue[_0xda84('0xf')]())[_0xda84('0xb')](realtime[_0xda84('0x10')]())[_0xda84('0xb')](chatQueue['getChatQueues']())[_0xda84('0xb')](realtime['initChatQueues']())[_0xda84('0xb')](smsQueue['getSmsQueues']())[_0xda84('0xb')](realtime['initSmsQueues']())['then'](mailQueue['getMailQueues']())['then'](realtime['initMailQueues']())[_0xda84('0xb')](faxQueue['getFaxQueues']())[_0xda84('0xb')](realtime['initFaxQueues']())[_0xda84('0xb')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0xda84('0x11')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xda84('0xb')](function(_0x2ad988){return initRealtime();})[_0xda84('0xb')](function(_0xb36d95){return setInterval(initRealtime,0x1388);})['catch'](function(_0x4fe54a){console['log'](_0x4fe54a);});}main(); \ No newline at end of file +var _0x419c=['getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x419c,0x1af));var _0xc419=function(_0x50bace,_0x16f8b7){_0x50bace=_0x50bace-0x0;var _0x25dc5e=_0x419c[_0x50bace];return _0x25dc5e;};'use strict';var BPromise=require(_0xc419('0x0'));var server=require(_0xc419('0x1'));var Realtime=require(_0xc419('0x2'));var user=require(_0xc419('0x3'));var interval=require(_0xc419('0x4'));var openchannelQueue=require(_0xc419('0x5'));var chatQueue=require(_0xc419('0x6'));var smsQueue=require(_0xc419('0x7'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xc419('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xc419('0x9')]()[_0xc419('0xa')](user[_0xc419('0xb')]())[_0xc419('0xa')](realtime[_0xc419('0xc')]())['then'](interval[_0xc419('0xd')]())[_0xc419('0xa')](realtime[_0xc419('0xe')]())[_0xc419('0xa')](openchannelQueue[_0xc419('0xf')]())[_0xc419('0xa')](realtime[_0xc419('0x10')]())[_0xc419('0xa')](chatQueue[_0xc419('0x11')]())['then'](realtime[_0xc419('0x12')]())[_0xc419('0xa')](smsQueue[_0xc419('0x13')]())[_0xc419('0xa')](realtime[_0xc419('0x14')]())[_0xc419('0xa')](mailQueue['getMailQueues']())[_0xc419('0xa')](realtime[_0xc419('0x15')]())[_0xc419('0xa')](faxQueue[_0xc419('0x16')]())[_0xc419('0xa')](realtime['initFaxQueues']())['then'](whatsappQueue[_0xc419('0x17')]())[_0xc419('0xa')](realtime[_0xc419('0x18')]())['then'](function(){return realtime;});}function main(){return server[_0xc419('0x19')](realtime)[_0xc419('0xa')](function(_0xa5e7b6){return initRealtime();})['then'](function(_0x4a4712){return setInterval(initRealtime,0x1388);})[_0xc419('0x1a')](function(_0x168180){console[_0xc419('0x1b')](_0x168180);});}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 6627157..f14bf7d 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(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0x814b,0x1a2));var _0xb814=function(_0x2f037f,_0x2958c5){_0x2f037f=_0x2f037f-0x0;var _0x2d1573=_0x814b[_0x2f037f];return _0x2d1573;};'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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x5a7b73,_0x94dda1){var _0x4c26e0=function(_0xb54172){while(--_0xb54172){_0x5a7b73['push'](_0x5a7b73['shift']());}};_0x4c26e0(++_0x94dda1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index ae2707d..fa5924c 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 _0x4a25=['client','http','request','then','error','result','catch','sendMailMessage','bluebird','jayson/promise'];(function(_0x3d178f,_0x529f68){var _0x40c9d6=function(_0x4b204f){while(--_0x4b204f){_0x3d178f['push'](_0x3d178f['shift']());}};_0x40c9d6(++_0x529f68);}(_0x4a25,0x1b6));var _0x54a2=function(_0x2179f1,_0x21c653){_0x2179f1=_0x2179f1-0x0;var _0x176ec9=_0x4a25[_0x2179f1];return _0x176ec9;};'use strict';var BPromise=require(_0x54a2('0x0'));var jayson=require(_0x54a2('0x1'));var client=jayson[_0x54a2('0x2')][_0x54a2('0x3')]({'port':0x232b});function request(_0x46d5f0,_0x8ac885){return new BPromise(function(_0x4d58bc,_0x3469b1){return client[_0x54a2('0x4')](_0x46d5f0,_0x8ac885)[_0x54a2('0x5')](function(_0x428fc2){if(_0x428fc2[_0x54a2('0x6')]){return _0x3469b1(_0x428fc2[_0x54a2('0x6')]['message']);}else{return _0x4d58bc(_0x428fc2[_0x54a2('0x7')]);}})[_0x54a2('0x8')](function(_0x10c229){return _0x3469b1(_0x10c229);});});}exports[_0x54a2('0x9')]=function(_0x8dc909,_0x4b5115){return request('SendMail',{'account':_0x8dc909,'message':_0x4b5115});}; \ No newline at end of file +var _0x640b=['then','error','message','result','sendMailMessage','SendMail','jayson/promise','http','request'];(function(_0x88fab1,_0x1accff){var _0x20c571=function(_0x12de1c){while(--_0x12de1c){_0x88fab1['push'](_0x88fab1['shift']());}};_0x20c571(++_0x1accff);}(_0x640b,0x180));var _0xb640=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x640b[_0x53ccf2];return _0x5a2964;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xb640('0x0'));var client=jayson['client'][_0xb640('0x1')]({'port':0x232b});function request(_0x26c08b,_0x22f154){return new BPromise(function(_0x3b933f,_0x3db7a2){return client[_0xb640('0x2')](_0x26c08b,_0x22f154)[_0xb640('0x3')](function(_0x37b31c){if(_0x37b31c['error']){return _0x3db7a2(_0x37b31c[_0xb640('0x4')][_0xb640('0x5')]);}else{return _0x3b933f(_0x37b31c[_0xb640('0x6')]);}})['catch'](function(_0x10eb8e){return _0x3db7a2(_0x10eb8e);});});}exports[_0xb640('0x7')]=function(_0x2a2d38,_0x2e2dae){return request(_0xb640('0x8'),{'account':_0x2a2d38,'message':_0x2e2dae});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 0ae792e..e3e7926 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 _0xa5cb=['moment','md5','defaults','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','format','openchannelPause','chatCapacity','faxStatusTime','openchannelStatusTime','openchannelCurrentCapacity','busyQueue','emit','user:save','exports','lodash'];(function(_0x514833,_0x4f691e){var _0x1879fb=function(_0x1d382a){while(--_0x1d382a){_0x514833['push'](_0x514833['shift']());}};_0x1879fb(++_0x4f691e);}(_0xa5cb,0x7f));var _0xba5c=function(_0x1337c9,_0x5e2f5d){_0x1337c9=_0x1337c9-0x0;var _0x22bb89=_0xa5cb[_0x1337c9];return _0x22bb89;};'use strict';var _=require(_0xba5c('0x0'));var moment=require(_0xba5c('0x1'));var md5=require(_0xba5c('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xba5c('0x3')](config[_0xba5c('0x4')],{'host':_0xba5c('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xba5c('0x4')]));function Agent(_0x1bb37f){this['id']=_0x1bb37f['id']||0x0;this[_0xba5c('0x6')]=_0x1bb37f[_0xba5c('0x6')]||'';this[_0xba5c('0x7')]=_0x1bb37f[_0xba5c('0x7')]||!![];this[_0xba5c('0x8')]=_0x1bb37f[_0xba5c('0x8')]||![];this['chatPause']=_0x1bb37f[_0xba5c('0x9')]||![];this[_0xba5c('0xa')]=_0x1bb37f[_0xba5c('0xa')]||![];this['faxPause']=_0x1bb37f[_0xba5c('0xb')]||![];this['smsPause']=_0x1bb37f[_0xba5c('0xc')]||![];this['openchannelPause']=_0x1bb37f['openchannelPause']||![];this[_0xba5c('0xd')]=_0xba5c('0xe');this[_0xba5c('0xf')]=0x0;this['chatCapacity']=_0x1bb37f['chatCapacity']||0x0;this[_0xba5c('0x10')]=0x0;this[_0xba5c('0x11')]=_0xba5c('0xe');this[_0xba5c('0x12')]=0x0;this[_0xba5c('0x13')]=_0x1bb37f['mailCapacity']||0x0;this[_0xba5c('0x14')]=0x0;this[_0xba5c('0x15')]=_0xba5c('0xe');this['faxStatusTime']=0x0;this['faxCapacity']=_0x1bb37f[_0xba5c('0x16')]||0x0;this[_0xba5c('0x17')]=0x0;this[_0xba5c('0x18')]=_0xba5c('0xe');this[_0xba5c('0x19')]=0x0;this[_0xba5c('0x1a')]=_0x1bb37f[_0xba5c('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xba5c('0x1b')]=_0xba5c('0xe');this['whatsappStatusTime']=0x0;this[_0xba5c('0x1c')]=_0x1bb37f[_0xba5c('0x1c')]||0x0;this[_0xba5c('0x1d')]=0x0;this[_0xba5c('0x1e')]='unknown';this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x1bb37f[_0xba5c('0x1f')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xba5c('0x20')]=![];this['busyQueue']=undefined;this[_0xba5c('0x2')]='';this[_0xba5c('0x21')]={};this[_0xba5c('0x22')]={};this[_0xba5c('0x23')]={};this[_0xba5c('0x24')]={};this[_0xba5c('0x25')]={};this[_0xba5c('0x26')]={};this['updateRealtime']();}Agent[_0xba5c('0x27')][_0xba5c('0x28')]=function(_0x160181){if(this[_0x160181+_0xba5c('0x29')]>0x0){if(this[_0x160181+_0xba5c('0x2a')]>0x0&&this[_0x160181+_0xba5c('0x29')]>=this[_0x160181+_0xba5c('0x2a')]){return'maxcapacity';}else{return _0xba5c('0x2b');}}else{return _0xba5c('0x2c');}};Agent[_0xba5c('0x27')]['updateRealtime']=function(){var _0x3e55e7=[_0xba5c('0x2d'),_0xba5c('0x2e'),_0xba5c('0x2f'),_0xba5c('0x30'),_0xba5c('0x31'),_0xba5c('0x32')];for(var _0x527b66=0x0;_0x527b66<_0x3e55e7[_0xba5c('0x33')];_0x527b66+=0x1){var _0x49adaa=this['getChannelStatus'](_0x3e55e7[_0x527b66]);if(this[_0x3e55e7[_0x527b66]+_0xba5c('0x34')]!==_0x49adaa){this[_0x3e55e7[_0x527b66]+_0xba5c('0x35')]=_['toNumber'](moment()[_0xba5c('0x36')]('x'));}this[_0x3e55e7[_0x527b66]+_0xba5c('0x34')]=_0x49adaa;}var _0x102edc={'id':this['id'],'name':this[_0xba5c('0x6')],'online':this['online'],'voicePause':this[_0xba5c('0x8')],'chatPause':this[_0xba5c('0x9')],'mailPause':this[_0xba5c('0xa')],'smsPause':this[_0xba5c('0xc')],'faxPause':this[_0xba5c('0xb')],'openchannelPause':this[_0xba5c('0x37')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xba5c('0xf')],'chatCapacity':this[_0xba5c('0x38')],'chatCurrentCapacity':this[_0xba5c('0x10')],'mailStatus':this[_0xba5c('0x11')],'mailStatusTime':this[_0xba5c('0x12')],'mailCapacity':this[_0xba5c('0x13')],'mailCurrentCapacity':this[_0xba5c('0x14')],'faxStatus':this[_0xba5c('0x15')],'faxStatusTime':this[_0xba5c('0x39')],'faxCapacity':this[_0xba5c('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xba5c('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xba5c('0x1a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xba5c('0x1b')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xba5c('0x1c')],'whatsappCurrentCapacity':this[_0xba5c('0x1d')],'openchannelStatus':this[_0xba5c('0x1e')],'openchannelStatusTime':this[_0xba5c('0x3a')],'openchannelCapacity':this[_0xba5c('0x1f')],'openchannelCurrentCapacity':this[_0xba5c('0x3b')],'busy':this['busy'],'busyQueue':this[_0xba5c('0x3c')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xba5c('0x22')],'mailWaitingInteractions':this[_0xba5c('0x23')],'openchannelWaitingInteractions':this[_0xba5c('0x24')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xba5c('0x26')]};var _0x509a64=md5(JSON['stringify'](_0x102edc));if(this[_0xba5c('0x2')]!==_0x509a64){this[_0xba5c('0x2')]=_0x509a64;io[_0xba5c('0x3d')](_0xba5c('0x3e'),_0x102edc);}};module[_0xba5c('0x3f')]=Agent; \ No newline at end of file +var _0xc510=['smsWaitingInteractions','emit','exports','moment','ioredis','redis','defaults','socket.io-emitter','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','busyQueue','md5','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','chat','openchannel','whatsapp','length','Status','toNumber','format','name','chatCapacity','mailStatus','whatsappStatusTime','openchannelStatus','openchannelWaitingInteractions'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc510,0x1b5));var _0x0c51=function(_0x3a556e,_0x32191b){_0x3a556e=_0x3a556e-0x0;var _0xfe3a36=_0xc510[_0x3a556e];return _0xfe3a36;};'use strict';var _=require('lodash');var moment=require(_0x0c51('0x0'));var md5=require('md5');var Redis=require(_0x0c51('0x1'));var config=require('../../../config/environment');config[_0x0c51('0x2')]=_[_0x0c51('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0c51('0x4'))(new Redis(config[_0x0c51('0x2')]));function Agent(_0x340498){this['id']=_0x340498['id']||0x0;this['name']=_0x340498['name']||'';this[_0x0c51('0x5')]=_0x340498[_0x0c51('0x5')]||!![];this[_0x0c51('0x6')]=_0x340498[_0x0c51('0x6')]||![];this[_0x0c51('0x7')]=_0x340498['chatPause']||![];this['mailPause']=_0x340498[_0x0c51('0x8')]||![];this[_0x0c51('0x9')]=_0x340498['faxPause']||![];this[_0x0c51('0xa')]=_0x340498[_0x0c51('0xa')]||![];this[_0x0c51('0xb')]=_0x340498[_0x0c51('0xb')]||![];this[_0x0c51('0xc')]='unknown';this[_0x0c51('0xd')]=0x0;this['chatCapacity']=_0x340498['chatCapacity']||0x0;this[_0x0c51('0xe')]=0x0;this['mailStatus']='unknown';this[_0x0c51('0xf')]=0x0;this['mailCapacity']=_0x340498[_0x0c51('0x10')]||0x0;this[_0x0c51('0x11')]=0x0;this[_0x0c51('0x12')]=_0x0c51('0x13');this[_0x0c51('0x14')]=0x0;this[_0x0c51('0x15')]=_0x340498['faxCapacity']||0x0;this[_0x0c51('0x16')]=0x0;this[_0x0c51('0x17')]=_0x0c51('0x13');this[_0x0c51('0x18')]=0x0;this[_0x0c51('0x19')]=_0x340498[_0x0c51('0x19')]||0x0;this[_0x0c51('0x1a')]=0x0;this[_0x0c51('0x1b')]=_0x0c51('0x13');this['whatsappStatusTime']=0x0;this[_0x0c51('0x1c')]=_0x340498[_0x0c51('0x1c')]||0x0;this[_0x0c51('0x1d')]=0x0;this['openchannelStatus']='unknown';this[_0x0c51('0x1e')]=0x0;this[_0x0c51('0x1f')]=_0x340498[_0x0c51('0x1f')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x0c51('0x20')]=undefined;this[_0x0c51('0x21')]='';this[_0x0c51('0x22')]={};this[_0x0c51('0x23')]={};this[_0x0c51('0x24')]={};this['openchannelWaitingInteractions']={};this['smsWaitingInteractions']={};this[_0x0c51('0x25')]={};this['updateRealtime']();}Agent[_0x0c51('0x26')][_0x0c51('0x27')]=function(_0x53266d){if(this[_0x53266d+_0x0c51('0x28')]>0x0){if(this[_0x53266d+_0x0c51('0x29')]>0x0&&this[_0x53266d+_0x0c51('0x28')]>=this[_0x53266d+_0x0c51('0x29')]){return _0x0c51('0x2a');}else{return _0x0c51('0x2b');}}else{return _0x0c51('0x2c');}};Agent[_0x0c51('0x26')][_0x0c51('0x2d')]=function(){var _0x3f982e=['mail',_0x0c51('0x2e'),_0x0c51('0x2f'),'fax','sms',_0x0c51('0x30')];for(var _0x29302d=0x0;_0x29302d<_0x3f982e[_0x0c51('0x31')];_0x29302d+=0x1){var _0x31b37b=this[_0x0c51('0x27')](_0x3f982e[_0x29302d]);if(this[_0x3f982e[_0x29302d]+_0x0c51('0x32')]!==_0x31b37b){this[_0x3f982e[_0x29302d]+'StatusTime']=_[_0x0c51('0x33')](moment()[_0x0c51('0x34')]('x'));}this[_0x3f982e[_0x29302d]+_0x0c51('0x32')]=_0x31b37b;}var _0x3d367d={'id':this['id'],'name':this[_0x0c51('0x35')],'online':this[_0x0c51('0x5')],'voicePause':this['voicePause'],'chatPause':this[_0x0c51('0x7')],'mailPause':this[_0x0c51('0x8')],'smsPause':this['smsPause'],'faxPause':this[_0x0c51('0x9')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x0c51('0x36')],'chatCurrentCapacity':this[_0x0c51('0xe')],'mailStatus':this[_0x0c51('0x37')],'mailStatusTime':this[_0x0c51('0xf')],'mailCapacity':this[_0x0c51('0x10')],'mailCurrentCapacity':this[_0x0c51('0x11')],'faxStatus':this[_0x0c51('0x12')],'faxStatusTime':this[_0x0c51('0x14')],'faxCapacity':this[_0x0c51('0x15')],'faxCurrentCapacity':this[_0x0c51('0x16')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x0c51('0x18')],'smsCapacity':this[_0x0c51('0x19')],'smsCurrentCapacity':this[_0x0c51('0x1a')],'whatsappStatus':this[_0x0c51('0x1b')],'whatsappStatusTime':this[_0x0c51('0x38')],'whatsappCapacity':this[_0x0c51('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x0c51('0x39')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x0c51('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x0c51('0x20')],'chatWaitingInteractions':this[_0x0c51('0x22')],'faxWaitingInteractions':this[_0x0c51('0x23')],'mailWaitingInteractions':this[_0x0c51('0x24')],'openchannelWaitingInteractions':this[_0x0c51('0x3a')],'smsWaitingInteractions':this[_0x0c51('0x3b')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x521a24=md5(JSON['stringify'](_0x3d367d));if(this[_0x0c51('0x21')]!==_0x521a24){this[_0x0c51('0x21')]=_0x521a24;io[_0x0c51('0x3c')]('user:save',_0x3d367d);}};module[_0x0c51('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index dbee36a..1c454a2 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 _0x3af0=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','loggedIn','chatPause','available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3af0,0xc3));var _0x03af=function(_0x3af373,_0x595e02){_0x3af373=_0x3af373-0x0;var _0x26da35=_0x3af0[_0x3af373];return _0x26da35;};'use strict';var _=require(_0x03af('0x0'));var md5=require(_0x03af('0x1'));var util=require(_0x03af('0x2'));var Redis=require(_0x03af('0x3'));var config=require(_0x03af('0x4'));config[_0x03af('0x5')]=_['defaults'](config[_0x03af('0x5')],{'host':_0x03af('0x6'),'port':0x18eb});var io=require(_0x03af('0x7'))(new Redis(config[_0x03af('0x5')]));function ChatQueue(_0x166abf){this['id']=_0x166abf['id']||0x0;this[_0x03af('0x8')]=_0x166abf['name']||'';this[_0x03af('0x9')]=_0x166abf[_0x03af('0x9')]||0xa;this[_0x03af('0xa')]=_0x166abf[_0x03af('0xa')]||_0x03af('0xb');this[_0x03af('0xc')]=_0x166abf['Agents'];this[_0x03af('0xd')]={};this[_0x03af('0xe')]=0x0;this[_0x03af('0x1')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x03af('0xf')][_0x03af('0x10')]=function(){var _0x4039c2=this[_0x03af('0xd')][_0x03af('0x11')];this[_0x03af('0xd')]=_['map'](this[_0x03af('0xc')],'id');this['mapAgentsId'][_0x03af('0x11')]=_0x4039c2;};ChatQueue[_0x03af('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x03af('0x12')]=0x0;for(var _0x9652b4=0x0;_0x9652b4=0x0?this[_0x03af('0x17')]:0x0;var _0x5dc8cb={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x03af('0x12')],'waiting':this['waiting']};var _0x1c6533=md5(JSON[_0x03af('0x18')](_0x5dc8cb));if(this[_0x03af('0x1')]!==_0x1c6533){this[_0x03af('0x1')]=_0x1c6533;io['to'](util[_0x03af('0x19')](_0x03af('0x1a'),_0x5dc8cb[_0x03af('0x8')]))[_0x03af('0x1b')]('chat_queue:save',_0x5dc8cb);}};module[_0x03af('0x1c')]=ChatQueue; \ No newline at end of file +var _0x635f=['chat:queue:%s','emit','exports','lodash','md5','util','ioredis','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0x635f,0xf3));var _0xf635=function(_0x190150,_0x12708e){_0x190150=_0x190150-0x0;var _0x429f1c=_0x635f[_0x190150];return _0x429f1c;};'use strict';var _=require(_0xf635('0x0'));var md5=require(_0xf635('0x1'));var util=require(_0xf635('0x2'));var Redis=require(_0xf635('0x3'));var config=require('../../../config/environment');config['redis']=_[_0xf635('0x4')](config['redis'],{'host':_0xf635('0x5'),'port':0x18eb});var io=require(_0xf635('0x6'))(new Redis(config[_0xf635('0x7')]));function ChatQueue(_0x5a3132){this['id']=_0x5a3132['id']||0x0;this[_0xf635('0x8')]=_0x5a3132[_0xf635('0x8')]||'';this['timeout']=_0x5a3132[_0xf635('0x9')]||0xa;this[_0xf635('0xa')]=_0x5a3132['strategy']||'beepall';this['Agents']=_0x5a3132[_0xf635('0xb')];this[_0xf635('0xc')]={};this[_0xf635('0xd')]=0x0;this[_0xf635('0x1')]='';this[_0xf635('0xe')]();this[_0xf635('0xf')]();}ChatQueue[_0xf635('0x10')][_0xf635('0xe')]=function(){var _0x2d21be=this[_0xf635('0xc')][_0xf635('0x11')];this[_0xf635('0xc')]=_[_0xf635('0x12')](this[_0xf635('0xb')],'id');this[_0xf635('0xc')]['_rr']=_0x2d21be;};ChatQueue[_0xf635('0x10')][_0xf635('0xf')]=function(){this[_0xf635('0x13')]=0x0;this[_0xf635('0x14')]=0x0;for(var _0x3d362b=0x0;_0x3d362b=0x0?this[_0xf635('0x18')]:0x0;var _0x3ff72a={'id':this['id'],'available':this[_0xf635('0x18')],'loggedIn':this[_0xf635('0x13')],'name':this[_0xf635('0x8')],'paused':this['paused'],'waiting':this[_0xf635('0xd')]};var _0x2863e6=md5(JSON[_0xf635('0x19')](_0x3ff72a));if(this[_0xf635('0x1')]!==_0x2863e6){this['md5']=_0x2863e6;io['to'](util[_0xf635('0x1a')](_0xf635('0x1b'),_0x3ff72a['name']))[_0xf635('0x1c')]('chat_queue:save',_0x3ff72a);}};module[_0xf635('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 b01fe7d..6f1e7fe 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 _0x8e00=['_rr','map','updateRealtime','loggedIn','paused','length','faxPause','available','format','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype'];(function(_0x344c31,_0x60d141){var _0x3da7b5=function(_0x3a1265){while(--_0x3a1265){_0x344c31['push'](_0x344c31['shift']());}};_0x3da7b5(++_0x60d141);}(_0x8e00,0x111));var _0x08e0=function(_0x3836f6,_0x2849ef){_0x3836f6=_0x3836f6-0x0;var _0x34658b=_0x8e00[_0x3836f6];return _0x34658b;};'use strict';var _=require(_0x08e0('0x0'));var md5=require(_0x08e0('0x1'));var util=require(_0x08e0('0x2'));var Redis=require('ioredis');var config=require(_0x08e0('0x3'));config[_0x08e0('0x4')]=_[_0x08e0('0x5')](config[_0x08e0('0x4')],{'host':_0x08e0('0x6'),'port':0x18eb});var io=require(_0x08e0('0x7'))(new Redis(config[_0x08e0('0x4')]));function FaxQueue(_0x4adb9e){this['id']=_0x4adb9e['id']||0x0;this[_0x08e0('0x8')]=_0x4adb9e[_0x08e0('0x8')]||'';this[_0x08e0('0x9')]=_0x4adb9e['timeout']||0xa;this[_0x08e0('0xa')]=_0x4adb9e[_0x08e0('0xa')]||_0x08e0('0xb');this[_0x08e0('0xc')]=_0x4adb9e[_0x08e0('0xc')];this[_0x08e0('0xd')]={};this[_0x08e0('0xe')]=0x0;this[_0x08e0('0x1')]='';this[_0x08e0('0xf')]();this['updateRealtime']();}FaxQueue[_0x08e0('0x10')]['updateRouting']=function(){var _0x4280ae=this[_0x08e0('0xd')][_0x08e0('0x11')];this['mapAgentsId']=_[_0x08e0('0x12')](this[_0x08e0('0xc')],'id');this[_0x08e0('0xd')][_0x08e0('0x11')]=_0x4280ae;};FaxQueue[_0x08e0('0x10')][_0x08e0('0x13')]=function(){this[_0x08e0('0x14')]=0x0;this[_0x08e0('0x15')]=0x0;for(var _0x12624e=0x0;_0x12624e=0x0?this[_0x08e0('0x18')]:0x0;var _0xada6a3={'id':this['id'],'available':this[_0x08e0('0x18')],'loggedIn':this[_0x08e0('0x14')],'name':this[_0x08e0('0x8')],'paused':this[_0x08e0('0x15')],'waiting':this[_0x08e0('0xe')]};var _0x3f7f53=md5(JSON['stringify'](_0xada6a3));if(this[_0x08e0('0x1')]!==_0x3f7f53){this[_0x08e0('0x1')]=_0x3f7f53;io['to'](util[_0x08e0('0x19')](_0x08e0('0x1a'),_0xada6a3[_0x08e0('0x8')]))['emit'](_0x08e0('0x1b'),_0xada6a3);}};module[_0x08e0('0x1c')]=FaxQueue; \ No newline at end of file +var _0x3665=['redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x26601e,_0x139a4c){var _0x116282=function(_0x292edb){while(--_0x292edb){_0x26601e['push'](_0x26601e['shift']());}};_0x116282(++_0x139a4c);}(_0x3665,0x13a));var _0x5366=function(_0x1f8aaa,_0x337a13){_0x1f8aaa=_0x1f8aaa-0x0;var _0x437595=_0x3665[_0x1f8aaa];return _0x437595;};'use strict';var _=require(_0x5366('0x0'));var md5=require(_0x5366('0x1'));var util=require(_0x5366('0x2'));var Redis=require(_0x5366('0x3'));var config=require(_0x5366('0x4'));config['redis']=_['defaults'](config[_0x5366('0x5')],{'host':_0x5366('0x6'),'port':0x18eb});var io=require(_0x5366('0x7'))(new Redis(config['redis']));function FaxQueue(_0x2b790e){this['id']=_0x2b790e['id']||0x0;this[_0x5366('0x8')]=_0x2b790e[_0x5366('0x8')]||'';this[_0x5366('0x9')]=_0x2b790e[_0x5366('0x9')]||0xa;this[_0x5366('0xa')]=_0x2b790e[_0x5366('0xa')]||'beepall';this[_0x5366('0xb')]=_0x2b790e[_0x5366('0xb')];this[_0x5366('0xc')]={};this[_0x5366('0xd')]=0x0;this[_0x5366('0x1')]='';this[_0x5366('0xe')]();this[_0x5366('0xf')]();}FaxQueue[_0x5366('0x10')][_0x5366('0xe')]=function(){var _0x1a9069=this[_0x5366('0xc')][_0x5366('0x11')];this[_0x5366('0xc')]=_[_0x5366('0x12')](this['Agents'],'id');this[_0x5366('0xc')][_0x5366('0x11')]=_0x1a9069;};FaxQueue[_0x5366('0x10')][_0x5366('0xf')]=function(){this[_0x5366('0x13')]=0x0;this[_0x5366('0x14')]=0x0;for(var _0x528512=0x0;_0x528512=0x0?this[_0x5366('0x17')]:0x0;var _0x569792={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5366('0x13')],'name':this[_0x5366('0x8')],'paused':this[_0x5366('0x14')],'waiting':this[_0x5366('0xd')]};var _0x5bc04c=md5(JSON[_0x5366('0x18')](_0x569792));if(this[_0x5366('0x1')]!==_0x5bc04c){this[_0x5366('0x1')]=_0x5bc04c;io['to'](util[_0x5366('0x19')]('fax:queue:%s',_0x569792['name']))[_0x5366('0x1a')](_0x5366('0x1b'),_0x569792);}};module[_0x5366('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 08409a8..3175643 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 _0x8250=['name','Intervals','exports'];(function(_0x482ae9,_0x343272){var _0x2e5db9=function(_0x1e832d){while(--_0x1e832d){_0x482ae9['push'](_0x482ae9['shift']());}};_0x2e5db9(++_0x343272);}(_0x8250,0x18c));var _0x0825=function(_0x4ea00a,_0xf189bb){_0x4ea00a=_0x4ea00a-0x0;var _0x2255fb=_0x8250[_0x4ea00a];return _0x2255fb;};'use strict';function Interval(_0x229a86){this['id']=_0x229a86['id']||0x0;this[_0x0825('0x0')]=_0x229a86['name']||'';this['Intervals']=_0x229a86[_0x0825('0x1')]||{};}module[_0x0825('0x2')]=Interval; \ No newline at end of file +var _0xf2a7=['Intervals','name'];(function(_0x50e40b,_0x338d17){var _0x2608b7=function(_0x4ded5e){while(--_0x4ded5e){_0x50e40b['push'](_0x50e40b['shift']());}};_0x2608b7(++_0x338d17);}(_0xf2a7,0x1a7));var _0x7f2a=function(_0x455b80,_0x225251){_0x455b80=_0x455b80-0x0;var _0xc8c869=_0xf2a7[_0x455b80];return _0xc8c869;};'use strict';function Interval(_0x537fdb){this['id']=_0x537fdb['id']||0x0;this[_0x7f2a('0x0')]=_0x537fdb[_0x7f2a('0x0')]||'';this[_0x7f2a('0x1')]=_0x537fdb['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 4bc3aeb..9473715 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 _0x0784=['redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x53c4a9,_0x24c134){var _0x4272d4=function(_0x43a242){while(--_0x43a242){_0x53c4a9['push'](_0x53c4a9['shift']());}};_0x4272d4(++_0x24c134);}(_0x0784,0x191));var _0x4078=function(_0x35e461,_0x5de72d){_0x35e461=_0x35e461-0x0;var _0x4ef9cc=_0x0784[_0x35e461];return _0x4ef9cc;};'use strict';var _=require(_0x4078('0x0'));var md5=require(_0x4078('0x1'));var util=require(_0x4078('0x2'));var Redis=require(_0x4078('0x3'));var config=require(_0x4078('0x4'));config[_0x4078('0x5')]=_[_0x4078('0x6')](config['redis'],{'host':_0x4078('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4078('0x5')]));function MailQueue(_0x290cbe){this['id']=_0x290cbe['id']||0x0;this['name']=_0x290cbe[_0x4078('0x8')]||'';this[_0x4078('0x9')]=_0x290cbe[_0x4078('0x9')]||0xa;this['strategy']=_0x290cbe[_0x4078('0xa')]||_0x4078('0xb');this[_0x4078('0xc')]=_0x290cbe['Agents'];this[_0x4078('0xd')]={};this[_0x4078('0xe')]=0x0;this[_0x4078('0x1')]='';this['updateRouting']();this[_0x4078('0xf')]();}MailQueue[_0x4078('0x10')][_0x4078('0x11')]=function(){var _0x2aafda=this[_0x4078('0xd')][_0x4078('0x12')];this[_0x4078('0xd')]=_['map'](this[_0x4078('0xc')],'id');this[_0x4078('0xd')][_0x4078('0x12')]=_0x2aafda;};MailQueue[_0x4078('0x10')]['updateRealtime']=function(){this[_0x4078('0x13')]=0x0;this[_0x4078('0x14')]=0x0;for(var _0x50b81a=0x0;_0x50b81a=0x0?this[_0x4078('0x17')]:0x0;var _0x5003f7={'id':this['id'],'available':this[_0x4078('0x17')],'loggedIn':this[_0x4078('0x13')],'name':this[_0x4078('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x1507d2=md5(JSON[_0x4078('0x18')](_0x5003f7));if(this['md5']!==_0x1507d2){this[_0x4078('0x1')]=_0x1507d2;io['to'](util[_0x4078('0x19')](_0x4078('0x1a'),_0x5003f7['name']))[_0x4078('0x1b')](_0x4078('0x1c'),_0x5003f7);}};module['exports']=MailQueue; \ No newline at end of file +var _0x964f=['updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','available','waiting','emit','mail_queue:save','lodash','md5','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents'];(function(_0x119bfb,_0x14375b){var _0x5ef624=function(_0x10f8c2){while(--_0x10f8c2){_0x119bfb['push'](_0x119bfb['shift']());}};_0x5ef624(++_0x14375b);}(_0x964f,0x17a));var _0xf964=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x964f[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xf964('0x0'));var md5=require(_0xf964('0x1'));var util=require('util');var Redis=require(_0xf964('0x2'));var config=require(_0xf964('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0xf964('0x4'),'port':0x18eb});var io=require(_0xf964('0x5'))(new Redis(config[_0xf964('0x6')]));function MailQueue(_0x52df0d){this['id']=_0x52df0d['id']||0x0;this[_0xf964('0x7')]=_0x52df0d['name']||'';this['timeout']=_0x52df0d[_0xf964('0x8')]||0xa;this[_0xf964('0x9')]=_0x52df0d[_0xf964('0x9')]||_0xf964('0xa');this[_0xf964('0xb')]=_0x52df0d[_0xf964('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xf964('0x1')]='';this[_0xf964('0xc')]();this[_0xf964('0xd')]();}MailQueue[_0xf964('0xe')][_0xf964('0xc')]=function(){var _0x493246=this[_0xf964('0xf')][_0xf964('0x10')];this[_0xf964('0xf')]=_[_0xf964('0x11')](this['Agents'],'id');this[_0xf964('0xf')][_0xf964('0x10')]=_0x493246;};MailQueue['prototype']['updateRealtime']=function(){this[_0xf964('0x12')]=0x0;this[_0xf964('0x13')]=0x0;for(var _0x51db34=0x0;_0x51db34=0x0?this[_0xf964('0x16')]:0x0;var _0x333ca5={'id':this['id'],'available':this[_0xf964('0x16')],'loggedIn':this[_0xf964('0x12')],'name':this[_0xf964('0x7')],'paused':this[_0xf964('0x13')],'waiting':this[_0xf964('0x17')]};var _0x41ef3e=md5(JSON['stringify'](_0x333ca5));if(this[_0xf964('0x1')]!==_0x41ef3e){this[_0xf964('0x1')]=_0x41ef3e;io['to'](util['format']('mail:queue:%s',_0x333ca5[_0xf964('0x7')]))[_0xf964('0x18')](_0xf964('0x19'),_0x333ca5);}};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 e5b3f16..e2de826 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x326f,0xd1));var _0xf326=function(_0x24a03c,_0xb05842){_0x24a03c=_0x24a03c-0x0;var _0x58365b=_0x326f[_0x24a03c];return _0x58365b;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x440064,_0x15230d){var _0x4f32c7=function(_0x21c549){while(--_0x21c549){_0x440064['push'](_0x440064['shift']());}};_0x4f32c7(++_0x15230d);}(_0x5fc3,0xa8));var _0x35fc=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x5fc3[_0xa8883];return _0x479426;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index fd07b06..78248ec 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 _0x1cc7=['online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','updateRealtime','loggedIn','paused'];(function(_0x2ed868,_0x4ff127){var _0x53012c=function(_0x1fe3a9){while(--_0x1fe3a9){_0x2ed868['push'](_0x2ed868['shift']());}};_0x53012c(++_0x4ff127);}(_0x1cc7,0x15a));var _0x71cc=function(_0x4ad4ee,_0x4e1ab7){_0x4ad4ee=_0x4ad4ee-0x0;var _0x10a6f=_0x1cc7[_0x4ad4ee];return _0x10a6f;};'use strict';var _=require(_0x71cc('0x0'));var md5=require(_0x71cc('0x1'));var util=require(_0x71cc('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x71cc('0x3')](config[_0x71cc('0x4')],{'host':_0x71cc('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0x47ec3b){this['id']=_0x47ec3b['id']||0x0;this[_0x71cc('0x6')]=_0x47ec3b['name']||'';this[_0x71cc('0x7')]=_0x47ec3b[_0x71cc('0x7')]||0xa;this[_0x71cc('0x8')]=_0x47ec3b[_0x71cc('0x8')]||_0x71cc('0x9');this['Agents']=_0x47ec3b[_0x71cc('0xa')];this[_0x71cc('0xb')]={};this[_0x71cc('0xc')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}SmsQueue['prototype'][_0x71cc('0xd')]=function(){var _0x2db190=this[_0x71cc('0xb')]['_rr'];this[_0x71cc('0xb')]=_['map'](this[_0x71cc('0xa')],'id');this['mapAgentsId'][_0x71cc('0xe')]=_0x2db190;};SmsQueue['prototype'][_0x71cc('0xf')]=function(){this[_0x71cc('0x10')]=0x0;this[_0x71cc('0x11')]=0x0;for(var _0xd16032=0x0;_0xd16032=0x0?this[_0x71cc('0x14')]:0x0;var _0x1067be={'id':this['id'],'available':this[_0x71cc('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x71cc('0x6')],'paused':this[_0x71cc('0x11')],'waiting':this['waiting']};var _0x550ce7=md5(JSON[_0x71cc('0x15')](_0x1067be));if(this[_0x71cc('0x1')]!==_0x550ce7){this[_0x71cc('0x1')]=_0x550ce7;io['to'](util[_0x71cc('0x16')](_0x71cc('0x17'),_0x1067be[_0x71cc('0x6')]))[_0x71cc('0x18')](_0x71cc('0x19'),_0x1067be);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x3b75=['updateRouting','updateRealtime','prototype','_rr','map','mapAgentsId','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','strategy','beepall','Agents','waiting'];(function(_0x2c5ea7,_0x40133b){var _0x2f1615=function(_0x5ebcc6){while(--_0x5ebcc6){_0x2c5ea7['push'](_0x2c5ea7['shift']());}};_0x2f1615(++_0x40133b);}(_0x3b75,0x144));var _0x53b7=function(_0x1fa760,_0x1bf063){_0x1fa760=_0x1fa760-0x0;var _0xd8eda1=_0x3b75[_0x1fa760];return _0xd8eda1;};'use strict';var _=require(_0x53b7('0x0'));var md5=require(_0x53b7('0x1'));var util=require(_0x53b7('0x2'));var Redis=require(_0x53b7('0x3'));var config=require(_0x53b7('0x4'));config[_0x53b7('0x5')]=_[_0x53b7('0x6')](config[_0x53b7('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x53b7('0x5')]));function SmsQueue(_0x2f8b3d){this['id']=_0x2f8b3d['id']||0x0;this[_0x53b7('0x7')]=_0x2f8b3d[_0x53b7('0x7')]||'';this['timeout']=_0x2f8b3d['timeout']||0xa;this[_0x53b7('0x8')]=_0x2f8b3d[_0x53b7('0x8')]||_0x53b7('0x9');this[_0x53b7('0xa')]=_0x2f8b3d[_0x53b7('0xa')];this['mapAgentsId']={};this[_0x53b7('0xb')]=0x0;this[_0x53b7('0x1')]='';this[_0x53b7('0xc')]();this[_0x53b7('0xd')]();}SmsQueue[_0x53b7('0xe')][_0x53b7('0xc')]=function(){var _0x4d8a1f=this['mapAgentsId'][_0x53b7('0xf')];this['mapAgentsId']=_[_0x53b7('0x10')](this['Agents'],'id');this[_0x53b7('0x11')][_0x53b7('0xf')]=_0x4d8a1f;};SmsQueue[_0x53b7('0xe')]['updateRealtime']=function(){this[_0x53b7('0x12')]=0x0;this[_0x53b7('0x13')]=0x0;for(var _0x4a64f4=0x0;_0x4a64f4=0x0?this[_0x53b7('0x16')]:0x0;var _0x47da7c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x53b7('0x7')],'paused':this[_0x53b7('0x13')],'waiting':this[_0x53b7('0xb')]};var _0x113cb7=md5(JSON[_0x53b7('0x17')](_0x47da7c));if(this[_0x53b7('0x1')]!==_0x113cb7){this[_0x53b7('0x1')]=_0x113cb7;io['to'](util[_0x53b7('0x18')](_0x53b7('0x19'),_0x47da7c[_0x53b7('0x7')]))['emit'](_0x53b7('0x1a'),_0x47da7c);}};module[_0x53b7('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 a8e422b..7db095a 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 _0xadcb=['online','whatsappPause','available','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','name','timeout','strategy','Agents','md5','updateRealtime','prototype','mapAgentsId','loggedIn','paused','length'];(function(_0x16e06f,_0x583996){var _0x268731=function(_0x38a2f8){while(--_0x38a2f8){_0x16e06f['push'](_0x16e06f['shift']());}};_0x268731(++_0x583996);}(_0xadcb,0xdf));var _0xbadc=function(_0x11ee79,_0x2dd80f){_0x11ee79=_0x11ee79-0x0;var _0x1daf36=_0xadcb[_0x11ee79];return _0x1daf36;};'use strict';var _=require(_0xbadc('0x0'));var md5=require('md5');var util=require(_0xbadc('0x1'));var Redis=require(_0xbadc('0x2'));var config=require('../../../config/environment');config[_0xbadc('0x3')]=_[_0xbadc('0x4')](config[_0xbadc('0x3')],{'host':_0xbadc('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbadc('0x3')]));function WhatsappQueue(_0x4b14d8){this['id']=_0x4b14d8['id']||0x0;this[_0xbadc('0x6')]=_0x4b14d8[_0xbadc('0x6')]||'';this['timeout']=_0x4b14d8[_0xbadc('0x7')]||0xa;this[_0xbadc('0x8')]=_0x4b14d8[_0xbadc('0x8')]||'beepall';this[_0xbadc('0x9')]=_0x4b14d8['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xbadc('0xa')]='';this['updateRouting']();this[_0xbadc('0xb')]();}WhatsappQueue[_0xbadc('0xc')]['updateRouting']=function(){var _0x3f21c6=this[_0xbadc('0xd')]['_rr'];this[_0xbadc('0xd')]=_['map'](this[_0xbadc('0x9')],'id');this['mapAgentsId']['_rr']=_0x3f21c6;};WhatsappQueue[_0xbadc('0xc')][_0xbadc('0xb')]=function(){this[_0xbadc('0xe')]=0x0;this[_0xbadc('0xf')]=0x0;for(var _0x40c636=0x0;_0x40c636=0x0?this[_0xbadc('0x13')]:0x0;var _0x193fee={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbadc('0xe')],'name':this[_0xbadc('0x6')],'paused':this[_0xbadc('0xf')],'waiting':this['waiting']};var _0x2912fa=md5(JSON['stringify'](_0x193fee));if(this[_0xbadc('0xa')]!==_0x2912fa){this[_0xbadc('0xa')]=_0x2912fa;io['to'](util[_0xbadc('0x14')](_0xbadc('0x15'),_0x193fee[_0xbadc('0x6')]))['emit'](_0xbadc('0x16'),_0x193fee);}};module[_0xbadc('0x17')]=WhatsappQueue; \ No newline at end of file +var _0xd962=['name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','paused','whatsappPause','available','stringify','md5','format','whatsapp:queue:%s','emit','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x5321df,_0x2b21f8){var _0x8b683a=function(_0x2936f1){while(--_0x2936f1){_0x5321df['push'](_0x5321df['shift']());}};_0x8b683a(++_0x2b21f8);}(_0xd962,0x1e8));var _0x2d96=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xd962[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x2d96('0x0'));var Redis=require('ioredis');var config=require(_0x2d96('0x1'));config[_0x2d96('0x2')]=_[_0x2d96('0x3')](config[_0x2d96('0x2')],{'host':_0x2d96('0x4'),'port':0x18eb});var io=require(_0x2d96('0x5'))(new Redis(config[_0x2d96('0x2')]));function WhatsappQueue(_0xb010ee){this['id']=_0xb010ee['id']||0x0;this['name']=_0xb010ee[_0x2d96('0x6')]||'';this['timeout']=_0xb010ee[_0x2d96('0x7')]||0xa;this[_0x2d96('0x8')]=_0xb010ee[_0x2d96('0x8')]||'beepall';this[_0x2d96('0x9')]=_0xb010ee[_0x2d96('0x9')];this[_0x2d96('0xa')]={};this[_0x2d96('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x2d96('0xc')]();}WhatsappQueue[_0x2d96('0xd')][_0x2d96('0xe')]=function(){var _0x355254=this[_0x2d96('0xa')]['_rr'];this[_0x2d96('0xa')]=_[_0x2d96('0xf')](this[_0x2d96('0x9')],'id');this[_0x2d96('0xa')][_0x2d96('0x10')]=_0x355254;};WhatsappQueue[_0x2d96('0xd')][_0x2d96('0xc')]=function(){this[_0x2d96('0x11')]=0x0;this[_0x2d96('0x12')]=0x0;for(var _0x52bcd8=0x0;_0x52bcd8=0x0?this[_0x2d96('0x14')]:0x0;var _0x1ffcc0={'id':this['id'],'available':this[_0x2d96('0x14')],'loggedIn':this[_0x2d96('0x11')],'name':this['name'],'paused':this[_0x2d96('0x12')],'waiting':this['waiting']};var _0xbbcf86=md5(JSON[_0x2d96('0x15')](_0x1ffcc0));if(this[_0x2d96('0x16')]!==_0xbbcf86){this[_0x2d96('0x16')]=_0xbbcf86;io['to'](util[_0x2d96('0x17')](_0x2d96('0x18'),_0x1ffcc0[_0x2d96('0x6')]))[_0x2d96('0x19')]('whatsapp_queue:save',_0x1ffcc0);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index da5a011..1f4b7b6 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(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 26438d6..790d5fd 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 _0x1de9=['../client','UpdateChatInteraction','updateChatInteraction','Request','addTagsToChatInteraction'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0x1de9,0x15e));var _0x91de=function(_0x4fd5b4,_0x1a06b7){_0x4fd5b4=_0x4fd5b4-0x0;var _0x48b09e=_0x1de9[_0x4fd5b4];return _0x48b09e;};'use strict';var client=require(_0x91de('0x0'));exports['update']=function(_0x14af7b,_0x4b9370){return client['Request'](_0x91de('0x1'),{'body':_0x4b9370,'options':{'where':{'id':_0x14af7b}},'log':_0x91de('0x2')});};exports['addTags']=function(_0x212121,_0x32c02b){return client[_0x91de('0x3')]('AddTagsToChatInteraction',{'body':_0x32c02b,'options':{'where':{'id':_0x212121}},'log':_0x91de('0x4')});}; \ No newline at end of file +var _0xa080=['addTagsToChatInteraction','update','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa080,0x115));var _0x0a08=function(_0x486ca7,_0x4ca73b){_0x486ca7=_0x486ca7-0x0;var _0x31834a=_0xa080[_0x486ca7];return _0x31834a;};'use strict';var client=require('../client');exports[_0x0a08('0x0')]=function(_0x57e54a,_0x2ea882){return client[_0x0a08('0x1')](_0x0a08('0x2'),{'body':_0x2ea882,'options':{'where':{'id':_0x57e54a}},'log':'updateChatInteraction'});};exports[_0x0a08('0x3')]=function(_0x1523c7,_0x1f93f8){return client[_0x0a08('0x1')](_0x0a08('0x4'),{'body':_0x1f93f8,'options':{'where':{'id':_0x1523c7}},'log':_0x0a08('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index eae82d0..98ade42 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 _0x1c60=['../client','create','Request'];(function(_0x4819b3,_0xdcbd21){var _0x31859b=function(_0x452d25){while(--_0x452d25){_0x4819b3['push'](_0x4819b3['shift']());}};_0x31859b(++_0xdcbd21);}(_0x1c60,0x189));var _0x01c6=function(_0x4e9f1a,_0x35e3f3){_0x4e9f1a=_0x4e9f1a-0x0;var _0x441f20=_0x1c60[_0x4e9f1a];return _0x441f20;};'use strict';var client=require(_0x01c6('0x0'));exports[_0x01c6('0x1')]=function(_0x37759d){return client[_0x01c6('0x2')]('CreateChatMessage',{'body':_0x37759d,'log':'createChatMessage'});}; \ No newline at end of file +var _0x2427=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2427,0x1cc));var _0x7242=function(_0x3e6311,_0x118beb){_0x3e6311=_0x3e6311-0x0;var _0x43a5b2=_0x2427[_0x3e6311];return _0x43a5b2;};'use strict';var client=require('../client');exports[_0x7242('0x0')]=function(_0x407410){return client[_0x7242('0x1')](_0x7242('0x2'),{'body':_0x407410,'log':_0x7242('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 0188fe8..23d2134 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 _0x5db2=['Agents','online','chatPause','../client','getChatQueues','Request','name','timeout','strategy','User'];(function(_0x4f3b4a,_0x339c3d){var _0x246569=function(_0x3e0dc9){while(--_0x3e0dc9){_0x4f3b4a['push'](_0x4f3b4a['shift']());}};_0x246569(++_0x339c3d);}(_0x5db2,0xf3));var _0x25db=function(_0x10c7e0,_0x484507){_0x10c7e0=_0x10c7e0-0x0;var _0x330990=_0x5db2[_0x10c7e0];return _0x330990;};'use strict';var client=require(_0x25db('0x0'));exports[_0x25db('0x1')]=function(){return function(){return client[_0x25db('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x25db('0x3'),_0x25db('0x4'),_0x25db('0x5')],'include':[{'model':_0x25db('0x6'),'as':_0x25db('0x7'),'attributes':['id',_0x25db('0x3'),_0x25db('0x8'),_0x25db('0x9')]}]},'log':_0x25db('0x1')});};}; \ No newline at end of file +var _0xe7de=['timeout','strategy','User','Agents','name','online','chatPause','../client','getChatQueues','Request'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0xe7de,0x165));var _0xee7d=function(_0x2614f7,_0x56b91e){_0x2614f7=_0x2614f7-0x0;var _0x43d868=_0xe7de[_0x2614f7];return _0x43d868;};'use strict';var client=require(_0xee7d('0x0'));exports[_0xee7d('0x1')]=function(){return function(){return client[_0xee7d('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0xee7d('0x3'),_0xee7d('0x4')],'include':[{'model':_0xee7d('0x5'),'as':_0xee7d('0x6'),'attributes':['id',_0xee7d('0x7'),_0xee7d('0x8'),_0xee7d('0x9')]}]},'log':_0xee7d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 25d1888..2cf60fa 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 _0x5d70=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0x5d70,0x8d));var _0x05d7=function(_0x1edd5f,_0x343427){_0x1edd5f=_0x1edd5f-0x0;var _0x376f30=_0x5d70[_0x1edd5f];return _0x376f30;};'use strict';var client=require(_0x05d7('0x0'));exports[_0x05d7('0x1')]=function(_0x54771b){return client[_0x05d7('0x2')](_0x05d7('0x3'),{'body':_0x54771b,'log':_0x05d7('0x3')});};exports[_0x05d7('0x4')]=function(_0x43c0a7,_0x2a2455){return client['Request'](_0x05d7('0x5'),{'body':_0x2a2455,'options':{'where':{'uniqueid':_0x43c0a7},'order':[['id',_0x05d7('0x6')]],'limit':0x1},'log':_0x05d7('0x5')});}; \ No newline at end of file +var _0x7ec2=['../client','create','CreateChatQueueReport','Request','UpdateChatQueueReport','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ec2,0x15c));var _0x27ec=function(_0x154f64,_0x58425b){_0x154f64=_0x154f64-0x0;var _0x4b8233=_0x7ec2[_0x154f64];return _0x4b8233;};'use strict';var client=require(_0x27ec('0x0'));exports[_0x27ec('0x1')]=function(_0x29b076){return client['Request'](_0x27ec('0x2'),{'body':_0x29b076,'log':_0x27ec('0x2')});};exports['update']=function(_0x45b293,_0x340231){return client[_0x27ec('0x3')](_0x27ec('0x4'),{'body':_0x340231,'options':{'where':{'uniqueid':_0x45b293},'order':[['id',_0x27ec('0x5')]],'limit':0x1},'log':_0x27ec('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index a3be877..6f5ff85 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5e8fc,_0x1ccc06){var _0x41c58c=function(_0x495f2c){while(--_0x495f2c){_0x5e8fc['push'](_0x5e8fc['shift']());}};_0x41c58c(++_0x1ccc06);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x7a54,0x106));var _0x47a5=function(_0x11a01e,_0x31a844){_0x11a01e=_0x11a01e-0x0;var _0x1e709a=_0x7a54[_0x11a01e];return _0x1e709a;};'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 4a5580b..35a8ebf 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 _0xa787=['Request','../client','create'];(function(_0xef5c49,_0x34ca7f){var _0x4bf091=function(_0x177c9d){while(--_0x177c9d){_0xef5c49['push'](_0xef5c49['shift']());}};_0x4bf091(++_0x34ca7f);}(_0xa787,0xf4));var _0x7a78=function(_0x11ffdd,_0x1e811d){_0x11ffdd=_0x11ffdd-0x0;var _0xdda87d=_0xa787[_0x11ffdd];return _0xdda87d;};'use strict';var client=require(_0x7a78('0x0'));exports[_0x7a78('0x1')]=function(_0x6529f3){return client[_0x7a78('0x2')]('CreateFaxMessage',{'body':_0x6529f3,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x0e6f=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0e6f,0x105));var _0xf0e6=function(_0x52bb76,_0x325703){_0x52bb76=_0x52bb76-0x0;var _0x2f2f21=_0x0e6f[_0x52bb76];return _0x2f2f21;};'use strict';var client=require(_0xf0e6('0x0'));exports[_0xf0e6('0x1')]=function(_0x420aaf){return client[_0xf0e6('0x2')](_0xf0e6('0x3'),{'body':_0x420aaf,'log':_0xf0e6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 960534e..4cb0a3b 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 _0xc77c=['GetFaxQueue','User','Agents','../client','getFaxQueues','Request'];(function(_0x406aa1,_0x3e15aa){var _0x3e90a0=function(_0x38f7a9){while(--_0x38f7a9){_0x406aa1['push'](_0x406aa1['shift']());}};_0x3e90a0(++_0x3e15aa);}(_0xc77c,0xc3));var _0xcc77=function(_0x3597d2,_0x4046df){_0x3597d2=_0x3597d2-0x0;var _0x87f797=_0xc77c[_0x3597d2];return _0x87f797;};'use strict';var client=require(_0xcc77('0x0'));exports[_0xcc77('0x1')]=function(){return function(){return client[_0xcc77('0x2')](_0xcc77('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xcc77('0x4'),'as':_0xcc77('0x5'),'attributes':['id','name','online','faxPause']}]},'log':_0xcc77('0x1')});};}; \ No newline at end of file +var _0x63fb=['User','Agents','name','faxPause','../client','getFaxQueues','Request','GetFaxQueue','strategy'];(function(_0xc35427,_0x56e305){var _0x19f819=function(_0x4ab59d){while(--_0x4ab59d){_0xc35427['push'](_0xc35427['shift']());}};_0x19f819(++_0x56e305);}(_0x63fb,0xd3));var _0xb63f=function(_0x4d9fc9,_0x1a7049){_0x4d9fc9=_0x4d9fc9-0x0;var _0x21364d=_0x63fb[_0x4d9fc9];return _0x21364d;};'use strict';var client=require(_0xb63f('0x0'));exports[_0xb63f('0x1')]=function(){return function(){return client[_0xb63f('0x2')](_0xb63f('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xb63f('0x4')],'include':[{'model':_0xb63f('0x5'),'as':_0xb63f('0x6'),'attributes':['id',_0xb63f('0x7'),'online',_0xb63f('0x8')]}]},'log':_0xb63f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 74e74d8..0c24962 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 _0xf2f5=['DESC','../client','Request','update','UpdateFaxQueueReport'];(function(_0x3f25db,_0x1d3686){var _0x54f29d=function(_0x2963bb){while(--_0x2963bb){_0x3f25db['push'](_0x3f25db['shift']());}};_0x54f29d(++_0x1d3686);}(_0xf2f5,0xb0));var _0x5f2f=function(_0x2d67a5,_0x35bd1d){_0x2d67a5=_0x2d67a5-0x0;var _0x444b59=_0xf2f5[_0x2d67a5];return _0x444b59;};'use strict';var client=require(_0x5f2f('0x0'));exports['create']=function(_0x5886c1){return client[_0x5f2f('0x1')]('CreateFaxQueueReport',{'body':_0x5886c1,'log':'CreateFaxQueueReport'});};exports[_0x5f2f('0x2')]=function(_0x56f2b9,_0x25b421){return client['Request'](_0x5f2f('0x3'),{'body':_0x25b421,'options':{'where':{'uniqueid':_0x56f2b9},'order':[['id',_0x5f2f('0x4')]],'limit':0x1},'log':_0x5f2f('0x3')});}; \ No newline at end of file +var _0x7ba7=['DESC','../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x34d53c,_0x396d38){var _0x638b9a=function(_0xbbf8c9){while(--_0xbbf8c9){_0x34d53c['push'](_0x34d53c['shift']());}};_0x638b9a(++_0x396d38);}(_0x7ba7,0x1f3));var _0x77ba=function(_0xbcf185,_0x251002){_0xbcf185=_0xbcf185-0x0;var _0x2ae4de=_0x7ba7[_0xbcf185];return _0x2ae4de;};'use strict';var client=require(_0x77ba('0x0'));exports[_0x77ba('0x1')]=function(_0x3314df){return client[_0x77ba('0x2')]('CreateFaxQueueReport',{'body':_0x3314df,'log':_0x77ba('0x3')});};exports['update']=function(_0x5407d1,_0x40edde){return client[_0x77ba('0x2')](_0x77ba('0x4'),{'body':_0x40edde,'options':{'where':{'uniqueid':_0x5407d1},'order':[['id',_0x77ba('0x5')]],'limit':0x1},'log':_0x77ba('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c90053d..abc190e 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 _0x9cf5=['interval','../client','Request','GetInterval','name'];(function(_0x2b36c5,_0x1bc9c9){var _0x4108c3=function(_0x4422fa){while(--_0x4422fa){_0x2b36c5['push'](_0x2b36c5['shift']());}};_0x4108c3(++_0x1bc9c9);}(_0x9cf5,0xce));var _0x59cf=function(_0x2382a5,_0x40b318){_0x2382a5=_0x2382a5-0x0;var _0x26f7b7=_0x9cf5[_0x2382a5];return _0x26f7b7;};'use strict';var client=require(_0x59cf('0x0'));exports['getIntervals']=function(){return function(){return client[_0x59cf('0x1')](_0x59cf('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x59cf('0x3'),_0x59cf('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x2548=['getIntervals','Request','name','Interval','Intervals','../client'];(function(_0x4c548b,_0x3e69b2){var _0x48538f=function(_0x59f095){while(--_0x59f095){_0x4c548b['push'](_0x4c548b['shift']());}};_0x48538f(++_0x3e69b2);}(_0x2548,0x149));var _0x8254=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2548[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x8254('0x0'));exports[_0x8254('0x1')]=function(){return function(){return client[_0x8254('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8254('0x3')],'include':[{'model':_0x8254('0x4'),'as':_0x8254('0x5'),'attributes':['id',_0x8254('0x3'),'interval']}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f066f12..6afcec0 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 _0xd4a2=['UpdateMailInteraction','addTags','Request','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x14d98f,_0x2ed9ed){var _0x5a8c93=function(_0x21482f){while(--_0x21482f){_0x14d98f['push'](_0x14d98f['shift']());}};_0x5a8c93(++_0x2ed9ed);}(_0xd4a2,0x173));var _0x2d4a=function(_0x4e5461,_0x50e065){_0x4e5461=_0x4e5461-0x0;var _0x9d9712=_0xd4a2[_0x4e5461];return _0x9d9712;};'use strict';var client=require(_0x2d4a('0x0'));exports['update']=function(_0x4e88a9,_0xfba415){return client['Request'](_0x2d4a('0x1'),{'body':_0xfba415,'options':{'where':{'id':_0x4e88a9}},'log':'updateMailInteraction'});};exports[_0x2d4a('0x2')]=function(_0x5d435a,_0x32af9e){return client[_0x2d4a('0x3')](_0x2d4a('0x4'),{'body':_0x32af9e,'options':{'where':{'id':_0x5d435a}},'log':_0x2d4a('0x5')});}; \ No newline at end of file +var _0xd7d1=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x5370a,_0x32558c){_0x5370a=_0x5370a-0x0;var _0x3c6a5f=_0xd7d1[_0x5370a];return _0x3c6a5f;};'use strict';var client=require(_0x1d7d('0x0'));exports[_0x1d7d('0x1')]=function(_0xce4540,_0x447083){return client[_0x1d7d('0x2')](_0x1d7d('0x3'),{'body':_0x447083,'options':{'where':{'id':_0xce4540}},'log':_0x1d7d('0x4')});};exports[_0x1d7d('0x5')]=function(_0x1ac097,_0x1adb6b){return client[_0x1d7d('0x2')](_0x1d7d('0x6'),{'body':_0x1adb6b,'options':{'where':{'id':_0x1ac097}},'log':_0x1d7d('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 95ae95a..98b2d40 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 _0x72d8=['../client','Request','CreateMailMessage'];(function(_0x269094,_0x4701b3){var _0x10344f=function(_0x180a69){while(--_0x180a69){_0x269094['push'](_0x269094['shift']());}};_0x10344f(++_0x4701b3);}(_0x72d8,0x1c8));var _0x872d=function(_0x1de8cc,_0x3e3f90){_0x1de8cc=_0x1de8cc-0x0;var _0x6f59fa=_0x72d8[_0x1de8cc];return _0x6f59fa;};'use strict';var client=require(_0x872d('0x0'));exports['create']=function(_0x3c8849){return client[_0x872d('0x1')](_0x872d('0x2'),{'body':_0x3c8849,'log':'createMailMessage'});}; \ No newline at end of file +var _0x7e4c=['create','CreateMailMessage','createMailMessage','../client'];(function(_0x2bea3c,_0x45ddfd){var _0x533f1b=function(_0x1007df){while(--_0x1007df){_0x2bea3c['push'](_0x2bea3c['shift']());}};_0x533f1b(++_0x45ddfd);}(_0x7e4c,0x1d7));var _0xc7e4=function(_0xaeaf5e,_0x340ec7){_0xaeaf5e=_0xaeaf5e-0x0;var _0x46a767=_0x7e4c[_0xaeaf5e];return _0x46a767;};'use strict';var client=require(_0xc7e4('0x0'));exports[_0xc7e4('0x1')]=function(_0x5c8f82){return client['Request'](_0xc7e4('0x2'),{'body':_0x5c8f82,'log':_0xc7e4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 077b6a6..2c6f558 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 _0xc0bf=['GetMailQueue','timeout','strategy','User','Agents','online','mailPause','getMailQueues','Request'];(function(_0x2ebcbc,_0x40ff02){var _0x31d821=function(_0x337540){while(--_0x337540){_0x2ebcbc['push'](_0x2ebcbc['shift']());}};_0x31d821(++_0x40ff02);}(_0xc0bf,0xc4));var _0xfc0b=function(_0x28b13b,_0x105009){_0x28b13b=_0x28b13b-0x0;var _0x778a18=_0xc0bf[_0x28b13b];return _0x778a18;};'use strict';var client=require('../client');exports[_0xfc0b('0x0')]=function(){return function(){return client[_0xfc0b('0x1')](_0xfc0b('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xfc0b('0x3'),_0xfc0b('0x4')],'include':[{'model':_0xfc0b('0x5'),'as':_0xfc0b('0x6'),'attributes':['id','name',_0xfc0b('0x7'),_0xfc0b('0x8')]}]},'log':_0xfc0b('0x0')});};}; \ No newline at end of file +var _0x1955=['Request','GetMailQueue','name','timeout','User','online','mailPause','../client','getMailQueues'];(function(_0x2cad51,_0x521f37){var _0x334640=function(_0xaaa10){while(--_0xaaa10){_0x2cad51['push'](_0x2cad51['shift']());}};_0x334640(++_0x521f37);}(_0x1955,0x7c));var _0x5195=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1955[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x5195('0x0'));exports[_0x5195('0x1')]=function(){return function(){return client[_0x5195('0x2')](_0x5195('0x3'),{'options':{'raw':![],'attributes':['id',_0x5195('0x4'),_0x5195('0x5'),'strategy'],'include':[{'model':_0x5195('0x6'),'as':'Agents','attributes':['id',_0x5195('0x4'),_0x5195('0x7'),_0x5195('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7891451..a8bc95b 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 _0x570b=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x570b,0x6c));var _0xb570=function(_0x127250,_0x59b5da){_0x127250=_0x127250-0x0;var _0x6a1541=_0x570b[_0x127250];return _0x6a1541;};'use strict';var client=require(_0xb570('0x0'));exports[_0xb570('0x1')]=function(_0x1ce07c){return client[_0xb570('0x2')](_0xb570('0x3'),{'body':_0x1ce07c,'log':_0xb570('0x3')});};exports[_0xb570('0x4')]=function(_0x3806ee,_0x5ad8b8){return client[_0xb570('0x2')](_0xb570('0x5'),{'body':_0x5ad8b8,'options':{'where':{'uniqueid':_0x3806ee},'order':[['id',_0xb570('0x6')]],'limit':0x1},'log':_0xb570('0x5')});}; \ No newline at end of file +var _0xe469=['Request','UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport'];(function(_0x592483,_0x2d5d36){var _0x238beb=function(_0x3f89a5){while(--_0x3f89a5){_0x592483['push'](_0x592483['shift']());}};_0x238beb(++_0x2d5d36);}(_0xe469,0xed));var _0x9e46=function(_0x4573dd,_0x660a86){_0x4573dd=_0x4573dd-0x0;var _0x1d529f=_0xe469[_0x4573dd];return _0x1d529f;};'use strict';var client=require(_0x9e46('0x0'));exports[_0x9e46('0x1')]=function(_0x593305){return client['Request']('CreateMailQueueReport',{'body':_0x593305,'log':_0x9e46('0x2')});};exports['update']=function(_0x502eb6,_0x4f89bc){return client[_0x9e46('0x3')](_0x9e46('0x4'),{'body':_0x4f89bc,'options':{'where':{'uniqueid':_0x502eb6},'order':[['id',_0x9e46('0x5')]],'limit':0x1},'log':_0x9e46('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 0137831..07c7911 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 _0xed84=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','Request','UpdateOpenchannelInteraction'];(function(_0x2e6ef9,_0x4236ea){var _0x3adde0=function(_0x48ba29){while(--_0x48ba29){_0x2e6ef9['push'](_0x2e6ef9['shift']());}};_0x3adde0(++_0x4236ea);}(_0xed84,0xc4));var _0x4ed8=function(_0x21d2de,_0x16c66b){_0x21d2de=_0x21d2de-0x0;var _0x5f1067=_0xed84[_0x21d2de];return _0x5f1067;};'use strict';var client=require('../client');exports['update']=function(_0x5c6f10,_0x2ba149){return client[_0x4ed8('0x0')](_0x4ed8('0x1'),{'body':_0x2ba149,'options':{'where':{'id':_0x5c6f10}},'log':_0x4ed8('0x2')});};exports[_0x4ed8('0x3')]=function(_0x540ba3,_0x49b19b){return client[_0x4ed8('0x0')](_0x4ed8('0x4'),{'body':_0x49b19b,'options':{'where':{'id':_0x540ba3}},'log':_0x4ed8('0x5')});}; \ No newline at end of file +var _0x324f=['Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x3be688,_0x222648){var _0x4700ee=function(_0x1eec3c){while(--_0x1eec3c){_0x3be688['push'](_0x3be688['shift']());}};_0x4700ee(++_0x222648);}(_0x324f,0xef));var _0xf324=function(_0x25d895,_0x455c2e){_0x25d895=_0x25d895-0x0;var _0x10a795=_0x324f[_0x25d895];return _0x10a795;};'use strict';var client=require('../client');exports[_0xf324('0x0')]=function(_0x2eff15,_0x4e4efc){return client[_0xf324('0x1')]('UpdateOpenchannelInteraction',{'body':_0x4e4efc,'options':{'where':{'id':_0x2eff15}},'log':_0xf324('0x2')});};exports[_0xf324('0x3')]=function(_0x1b9132,_0x29ea2d){return client[_0xf324('0x1')](_0xf324('0x4'),{'body':_0x29ea2d,'options':{'where':{'id':_0x1b9132}},'log':_0xf324('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index c436413..d1c691a 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 _0x48d0=['create','Request','CreateOpenchannelMessage'];(function(_0x468dc6,_0xc12a04){var _0x7e4157=function(_0x5de21d){while(--_0x5de21d){_0x468dc6['push'](_0x468dc6['shift']());}};_0x7e4157(++_0xc12a04);}(_0x48d0,0xe7));var _0x048d=function(_0x5d0842,_0x3eea57){_0x5d0842=_0x5d0842-0x0;var _0x4783b5=_0x48d0[_0x5d0842];return _0x4783b5;};'use strict';var client=require('../client');exports[_0x048d('0x0')]=function(_0x6c0352){return client[_0x048d('0x1')](_0x048d('0x2'),{'body':_0x6c0352,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xffb4=['Request','createOpenchannelMessage','create'];(function(_0x568b0e,_0x49eae6){var _0x2fcd1e=function(_0x385bae){while(--_0x385bae){_0x568b0e['push'](_0x568b0e['shift']());}};_0x2fcd1e(++_0x49eae6);}(_0xffb4,0x92));var _0x4ffb=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xffb4[_0x27af45];return _0x18df21;};'use strict';var client=require('../client');exports[_0x4ffb('0x0')]=function(_0x451254){return client[_0x4ffb('0x1')]('CreateOpenchannelMessage',{'body':_0x451254,'log':_0x4ffb('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 83639a4..53cc148 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 _0x4d07=['../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy','Agents','online','openchannelPause'];(function(_0x257276,_0x3efab4){var _0x309b51=function(_0x31f041){while(--_0x31f041){_0x257276['push'](_0x257276['shift']());}};_0x309b51(++_0x3efab4);}(_0x4d07,0x168));var _0x74d0=function(_0x324798,_0x32187b){_0x324798=_0x324798-0x0;var _0x4c8cc2=_0x4d07[_0x324798];return _0x4c8cc2;};'use strict';var client=require(_0x74d0('0x0'));exports[_0x74d0('0x1')]=function(){return function(){return client['Request'](_0x74d0('0x2'),{'options':{'raw':![],'attributes':['id',_0x74d0('0x3'),_0x74d0('0x4'),_0x74d0('0x5')],'include':[{'model':'User','as':_0x74d0('0x6'),'attributes':['id','name',_0x74d0('0x7'),_0x74d0('0x8')]}]},'log':_0x74d0('0x1')});};}; \ No newline at end of file +var _0xdaa0=['GetOpenchannelQueue','name','strategy','User','Agents','online','../client','getOpenchannelQueues','Request'];(function(_0x5e8602,_0x2ce012){var _0x4434fb=function(_0x5ea1cb){while(--_0x5ea1cb){_0x5e8602['push'](_0x5e8602['shift']());}};_0x4434fb(++_0x2ce012);}(_0xdaa0,0x141));var _0x0daa=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xdaa0[_0x243b2f];return _0xcb3c2d;};'use strict';var client=require(_0x0daa('0x0'));exports[_0x0daa('0x1')]=function(){return function(){return client[_0x0daa('0x2')](_0x0daa('0x3'),{'options':{'raw':![],'attributes':['id',_0x0daa('0x4'),'timeout',_0x0daa('0x5')],'include':[{'model':_0x0daa('0x6'),'as':_0x0daa('0x7'),'attributes':['id','name',_0x0daa('0x8'),'openchannelPause']}]},'log':_0x0daa('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3fee5f4..3a5e640 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 _0x72d1=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client'];(function(_0x511647,_0x30d69d){var _0x369bdc=function(_0x2fe161){while(--_0x2fe161){_0x511647['push'](_0x511647['shift']());}};_0x369bdc(++_0x30d69d);}(_0x72d1,0x18b));var _0x172d=function(_0x237c45,_0x55cf99){_0x237c45=_0x237c45-0x0;var _0x2942f6=_0x72d1[_0x237c45];return _0x2942f6;};'use strict';var client=require(_0x172d('0x0'));exports[_0x172d('0x1')]=function(_0x48100c){return client[_0x172d('0x2')](_0x172d('0x3'),{'body':_0x48100c,'log':_0x172d('0x3')});};exports[_0x172d('0x4')]=function(_0x318a34,_0x4532e0){return client['Request'](_0x172d('0x5'),{'body':_0x4532e0,'options':{'where':{'uniqueid':_0x318a34},'order':[['id','DESC']],'limit':0x1},'log':_0x172d('0x5')});}; \ No newline at end of file +var _0x6afd=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6afd,0x67));var _0xd6af=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x6afd[_0x373dee];return _0x46798f;};'use strict';var client=require(_0xd6af('0x0'));exports['create']=function(_0x353fac){return client[_0xd6af('0x1')](_0xd6af('0x2'),{'body':_0x353fac,'log':'CreateOpenchannelQueueReport'});};exports[_0xd6af('0x3')]=function(_0x4b9e3f,_0xde0a3b){return client['Request'](_0xd6af('0x4'),{'body':_0xde0a3b,'options':{'where':{'uniqueid':_0x4b9e3f},'order':[['id','DESC']],'limit':0x1},'log':_0xd6af('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index c37314f..74bff62 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 _0x8832=['updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x1ef547,_0x31bfdb){var _0x1d697b=function(_0x57fbdc){while(--_0x57fbdc){_0x1ef547['push'](_0x1ef547['shift']());}};_0x1d697b(++_0x31bfdb);}(_0x8832,0x1f4));var _0x2883=function(_0x3255a3,_0x492c71){_0x3255a3=_0x3255a3-0x0;var _0x50e954=_0x8832[_0x3255a3];return _0x50e954;};'use strict';var client=require(_0x2883('0x0'));exports[_0x2883('0x1')]=function(_0x56a649,_0x598e48){return client[_0x2883('0x2')](_0x2883('0x3'),{'body':_0x598e48,'options':{'where':{'id':_0x56a649}},'log':_0x2883('0x4')});};exports['addTags']=function(_0x21be37,_0x5f5738){return client[_0x2883('0x2')](_0x2883('0x5'),{'body':_0x5f5738,'options':{'where':{'id':_0x21be37}},'log':_0x2883('0x6')});}; \ No newline at end of file +var _0x851c=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x24aa30,_0x16ae3b){var _0x383459=function(_0x2ae9f5){while(--_0x2ae9f5){_0x24aa30['push'](_0x24aa30['shift']());}};_0x383459(++_0x16ae3b);}(_0x851c,0x19d));var _0xc851=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x851c[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xc851('0x0'));exports[_0xc851('0x1')]=function(_0x40d1a7,_0x3f998c){return client[_0xc851('0x2')](_0xc851('0x3'),{'body':_0x3f998c,'options':{'where':{'id':_0x40d1a7}},'log':_0xc851('0x4')});};exports['addTags']=function(_0x2fddd4,_0x84f5ad){return client['Request'](_0xc851('0x5'),{'body':_0x84f5ad,'options':{'where':{'id':_0x2fddd4}},'log':_0xc851('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index e2ab068..eb27344 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 _0x41e3=['createSmsMessage','../client','Request','CreateSmsMessage'];(function(_0x2cd25c,_0x2ab214){var _0x323d7e=function(_0x181509){while(--_0x181509){_0x2cd25c['push'](_0x2cd25c['shift']());}};_0x323d7e(++_0x2ab214);}(_0x41e3,0x81));var _0x341e=function(_0x30e4c0,_0x58fed1){_0x30e4c0=_0x30e4c0-0x0;var _0x30b6d0=_0x41e3[_0x30e4c0];return _0x30b6d0;};'use strict';var client=require(_0x341e('0x0'));exports['create']=function(_0x2112cd){return client[_0x341e('0x1')](_0x341e('0x2'),{'body':_0x2112cd,'log':_0x341e('0x3')});}; \ No newline at end of file +var _0x6a22=['../client','create'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0x6a22,0x1c4));var _0x26a2=function(_0x3a351d,_0x5bb577){_0x3a351d=_0x3a351d-0x0;var _0x370d12=_0x6a22[_0x3a351d];return _0x370d12;};'use strict';var client=require(_0x26a2('0x0'));exports[_0x26a2('0x1')]=function(_0x8fa77){return client['Request']('CreateSmsMessage',{'body':_0x8fa77,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 7d6ec66..8772ca9 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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x3960b6,_0x415484){var _0x27db0c=function(_0x1b6a18){while(--_0x1b6a18){_0x3960b6['push'](_0x3960b6['shift']());}};_0x27db0c(++_0x415484);}(_0x70e0,0x17b));var _0x070e=function(_0x35132b,_0x4a59ae){_0x35132b=_0x35132b-0x0;var _0x18169e=_0x70e0[_0x35132b];return _0x18169e;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0xe53636,_0x538b55){var _0x480eab=function(_0x2ce4ce){while(--_0x2ce4ce){_0xe53636['push'](_0xe53636['shift']());}};_0x480eab(++_0x538b55);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xcb91[_0x4c7935];return _0x30651d;};'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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index e1fdfa5..3d504c6 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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x5afa2b,_0x4b9e09){var _0x3c7d16=function(_0x1f1823){while(--_0x1f1823){_0x5afa2b['push'](_0x5afa2b['shift']());}};_0x3c7d16(++_0x4b9e09);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x42d77b,_0x37c966){var _0x5a71e6=function(_0x136fb6){while(--_0x136fb6){_0x42d77b['push'](_0x42d77b['shift']());}};_0x5a71e6(++_0x37c966);}(_0x55ca,0x126));var _0xa55c=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x55ca[_0x3de7e0];return _0x11d0b3;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 043d8d6..4d206af 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(_0xd03c9d,_0x2b4216){var _0x11b92b=function(_0x5e000c){while(--_0x5e000c){_0xd03c9d['push'](_0xd03c9d['shift']());}};_0x11b92b(++_0x2b4216);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x37c1ed,_0x421c80){var _0x27fc7d=function(_0x37bdfa){while(--_0x37bdfa){_0x37c1ed['push'](_0x37c1ed['shift']());}};_0x27fc7d(++_0x421c80);}(_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 92d3d3b..79fb979 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 _0x2aa3=['update','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','../client'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x2aa3,0x83));var _0x32aa=function(_0xdaaaa3,_0x388836){_0xdaaaa3=_0xdaaaa3-0x0;var _0x15cbe7=_0x2aa3[_0xdaaaa3];return _0x15cbe7;};'use strict';var client=require(_0x32aa('0x0'));exports[_0x32aa('0x1')]=function(_0x107517,_0x2ef91b){return client['Request']('UpdateWhatsappInteraction',{'body':_0x2ef91b,'options':{'where':{'id':_0x107517}},'log':_0x32aa('0x2')});};exports[_0x32aa('0x3')]=function(_0x13843c,_0x33612d){return client[_0x32aa('0x4')](_0x32aa('0x5'),{'body':_0x33612d,'options':{'where':{'id':_0x13843c}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x2e88=['update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','../client'];(function(_0x4a6362,_0x9e782a){var _0x2653a5=function(_0x52b12b){while(--_0x52b12b){_0x4a6362['push'](_0x4a6362['shift']());}};_0x2653a5(++_0x9e782a);}(_0x2e88,0x95));var _0x82e8=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0x2e88[_0x5280f4];return _0xba93e7;};'use strict';var client=require(_0x82e8('0x0'));exports[_0x82e8('0x1')]=function(_0xc29d21,_0x2ef18d){return client[_0x82e8('0x2')](_0x82e8('0x3'),{'body':_0x2ef18d,'options':{'where':{'id':_0xc29d21}},'log':'updateWhatsappInteraction'});};exports[_0x82e8('0x4')]=function(_0x1d7415,_0x576435){return client[_0x82e8('0x2')](_0x82e8('0x5'),{'body':_0x576435,'options':{'where':{'id':_0x1d7415}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index af321f9..d6e6960 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 _0x8354=['CreateWhatsappMessage','../client','create','Request'];(function(_0x4ffb97,_0x168f01){var _0x355e73=function(_0x215f80){while(--_0x215f80){_0x4ffb97['push'](_0x4ffb97['shift']());}};_0x355e73(++_0x168f01);}(_0x8354,0x121));var _0x4835=function(_0x5de6a9,_0x11e69f){_0x5de6a9=_0x5de6a9-0x0;var _0x71ea62=_0x8354[_0x5de6a9];return _0x71ea62;};'use strict';var client=require(_0x4835('0x0'));exports[_0x4835('0x1')]=function(_0x182e40){return client[_0x4835('0x2')](_0x4835('0x3'),{'body':_0x182e40,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xb0d1=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0xb0d1,0x189));var _0x1b0d=function(_0x42c427,_0x1011e8){_0x42c427=_0x42c427-0x0;var _0xfd944f=_0xb0d1[_0x42c427];return _0xfd944f;};'use strict';var client=require(_0x1b0d('0x0'));exports[_0x1b0d('0x1')]=function(_0x4c56dc){return client[_0x1b0d('0x2')](_0x1b0d('0x3'),{'body':_0x4c56dc,'log':_0x1b0d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index fc46d8e..615159a 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 _0x6a99=['name','online','whatsappPause','../client','getWhatsappQueues','Request','timeout','strategy','User','Agents'];(function(_0xffd14,_0x3cb980){var _0x36cc38=function(_0x57482b){while(--_0x57482b){_0xffd14['push'](_0xffd14['shift']());}};_0x36cc38(++_0x3cb980);}(_0x6a99,0x107));var _0x96a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6a99[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x96a9('0x0'));exports[_0x96a9('0x1')]=function(){return function(){return client[_0x96a9('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0x96a9('0x3'),_0x96a9('0x4')],'include':[{'model':_0x96a9('0x5'),'as':_0x96a9('0x6'),'attributes':['id',_0x96a9('0x7'),_0x96a9('0x8'),_0x96a9('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x73fa=['../client','getWhatsappQueues','name','timeout','strategy','User','online','whatsappPause'];(function(_0x59ae8f,_0x148344){var _0x3900b5=function(_0x63af51){while(--_0x63af51){_0x59ae8f['push'](_0x59ae8f['shift']());}};_0x3900b5(++_0x148344);}(_0x73fa,0x1d8));var _0xa73f=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x73fa[_0x10dbf6];return _0x452147;};'use strict';var client=require(_0xa73f('0x0'));exports[_0xa73f('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xa73f('0x2'),_0xa73f('0x3'),_0xa73f('0x4')],'include':[{'model':_0xa73f('0x5'),'as':'Agents','attributes':['id',_0xa73f('0x2'),_0xa73f('0x6'),_0xa73f('0x7')]}]},'log':_0xa73f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 0b9e0a0..5743589 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 _0xb628=['../client','Request','CreateWhatsappQueueReport','update','DESC'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb628,0x16d));var _0x8b62=function(_0x35cb8d,_0x1c75c0){_0x35cb8d=_0x35cb8d-0x0;var _0x1e84a6=_0xb628[_0x35cb8d];return _0x1e84a6;};'use strict';var client=require(_0x8b62('0x0'));exports['create']=function(_0x2b9b38){return client[_0x8b62('0x1')]('CreateWhatsappQueueReport',{'body':_0x2b9b38,'log':_0x8b62('0x2')});};exports[_0x8b62('0x3')]=function(_0x2eae8d,_0x2d80e3){return client[_0x8b62('0x1')]('UpdateWhatsappQueueReport',{'body':_0x2d80e3,'options':{'where':{'uniqueid':_0x2eae8d},'order':[['id',_0x8b62('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xe184=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0xe184,0xfb));var _0x4e18=function(_0xbf5741,_0xd08b2d){_0xbf5741=_0xbf5741-0x0;var _0x46be43=_0xe184[_0xbf5741];return _0x46be43;};'use strict';var client=require(_0x4e18('0x0'));exports[_0x4e18('0x1')]=function(_0x3188a2){return client[_0x4e18('0x2')](_0x4e18('0x3'),{'body':_0x3188a2,'log':_0x4e18('0x3')});};exports[_0x4e18('0x4')]=function(_0x425f8c,_0x549592){return client[_0x4e18('0x2')](_0x4e18('0x5'),{'body':_0x549592,'options':{'where':{'uniqueid':_0x425f8c},'order':[['id',_0x4e18('0x6')]],'limit':0x1},'log':_0x4e18('0x5')});}; \ 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 e3f4951..a0bd555 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 _0x6bc6=['[%s][QUEUE]\x20%s','validate','lodash','seq-queue','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log'];(function(_0x26ebb3,_0x3a0527){var _0x34a113=function(_0x5f1d1d){while(--_0x5f1d1d){_0x26ebb3['push'](_0x26ebb3['shift']());}};_0x34a113(++_0x3a0527);}(_0x6bc6,0xab));var _0x66bc=function(_0x2ab3c5,_0x35a3ef){_0x2ab3c5=_0x2ab3c5-0x0;var _0x2733aa=_0x6bc6[_0x2ab3c5];return _0x2733aa;};'use strict';var schema=require(_0x66bc('0x0'));var _=require(_0x66bc('0x1'));var util=require('util');var seqqueue=require(_0x66bc('0x2'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x66bc('0x3'));var queue=schema({'name':{'type':_0x66bc('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x66bc('0x5'),'message':_0x66bc('0x6')}});function writeLog(_0x3c1ae0,_0x2dc06a,_0x27663d){return logger[_0x66bc('0x7')](util[_0x66bc('0x8')](_0x66bc('0x9'),_0x3c1ae0,_0x2dc06a[_0x66bc('0xa')],_0x27663d));}function handleFindAgent(_0x168094){return function(_0x3c60dd){return _0x3c60dd[_0x66bc('0xa')]['toLowerCase']()===_0x168094[_0x66bc('0xb')]();};}exports[_0x66bc('0xc')]=function(_0x3a8b52,_0x4708ce,_0x8e5bea,_0x1f317b){return function(_0x1e10c0){try{var _0x38802a={'name':_0x4708ce[0x0],'timeout':_0x4708ce[0x1]};var _0xa13c33=queue['validate'](_0x38802a,{'typecast':!![]});if(_0xa13c33[_0x66bc('0xd')]){logger[_0x66bc('0xe')]('[%s][AGENT]\x20%s',_0x3a8b52,_[_0x66bc('0xf')](_0xa13c33,_0x66bc('0x10'))[_0x66bc('0x11')](',\x20'));_0x1e10c0['stop']();}else{var _0x4dfb5b=_[_0x66bc('0x12')](_0x8e5bea[_0x66bc('0x13')],handleFindAgent(_0x38802a[_0x66bc('0xa')]));if(_0x4dfb5b){var _0x5b6b09=(_0x38802a[_0x66bc('0x14')]||0xa)*0x3e8;var _0x58765d,_0x4a0248;var _0x4cf8e5=seqqueue[_0x66bc('0x15')](_0x5b6b09);_0x4cf8e5['id']=_0x3a8b52;_0x4cf8e5[_0x66bc('0x16')]=_0x5b6b09;_0x4cf8e5[_0x66bc('0x17')]=_0x1f317b[_0x66bc('0x17')];writeLog(_0x3a8b52,_0x4dfb5b,util[_0x66bc('0x8')](_0x66bc('0x18'),_0x5b6b09));_0x8e5bea[_0x66bc('0x19')][_0x3a8b52]['on']('end',function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3a8b52);clearTimeout(_0x4a0248);_0x4a0248=undefined;_0x4cf8e5[_0x66bc('0x1a')]();if(_0x8e5bea[_0x66bc('0x19')][_0x3a8b52]){delete _0x8e5bea['rules'][_0x3a8b52];}_0x1e10c0[_0x66bc('0x1b')]();});_0x8e5bea[_0x66bc('0x19')][_0x3a8b52]['on'](_0x66bc('0x1c'),function(){if(_0x8e5bea[_0x66bc('0x19')][_0x3a8b52]){delete _0x8e5bea[_0x66bc('0x19')][_0x3a8b52];}});_0x4a0248=setTimeout(function(){logger['info'](_0x66bc('0x1d'),_0x3a8b52);clearTimeout(_0x4a0248);_0x4cf8e5[_0x66bc('0x1a')]();_0x1e10c0[_0x66bc('0x1e')]();},_0x5b6b09);strategy['agent'](_0x4cf8e5,_0x4dfb5b,_0x8e5bea,_0x1f317b);}else{logger[_0x66bc('0xe')](_0x66bc('0x1f'),_0x3a8b52,_0x38802a[_0x66bc('0xa')]);_0x1e10c0[_0x66bc('0x1b')]();}}}catch(_0x36709b){console[_0x66bc('0x20')](_0x36709b);logger[_0x66bc('0xe')](_0x66bc('0x21'),_0x3a8b52,_0x36709b['stack']);_0x1e10c0['stop']();}};}; \ No newline at end of file +var _0x72ee=['name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','close','next','agent','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]'];(function(_0x115683,_0x4a1c36){var _0x5715b0=function(_0x17a343){while(--_0x17a343){_0x115683['push'](_0x115683['shift']());}};_0x5715b0(++_0x4a1c36);}(_0x72ee,0xa9));var _0xe72e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x72ee[_0x57b54c];return _0x59cc19;};'use strict';var schema=require(_0xe72e('0x0'));var _=require(_0xe72e('0x1'));var util=require('util');var seqqueue=require(_0xe72e('0x2'));var logger=require('../../../../config/logger')(_0xe72e('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xe72e('0x4'),'required':!![],'message':_0xe72e('0x5')},'timeout':{'type':_0xe72e('0x6'),'message':_0xe72e('0x7')}});function writeLog(_0x4b2185,_0x3775c3,_0x34e460){return logger[_0xe72e('0x8')](util[_0xe72e('0x9')](_0xe72e('0xa'),_0x4b2185,_0x3775c3['name'],_0x34e460));}function handleFindAgent(_0x1b37be){return function(_0x767c36){return _0x767c36[_0xe72e('0xb')][_0xe72e('0xc')]()===_0x1b37be['toLowerCase']();};}exports[_0xe72e('0xd')]=function(_0x6ab3cf,_0x409267,_0x39d6ae,_0x16d1cc){return function(_0x179cdb){try{var _0x46c7ca={'name':_0x409267[0x0],'timeout':_0x409267[0x1]};var _0x7492ce=queue[_0xe72e('0x0')](_0x46c7ca,{'typecast':!![]});if(_0x7492ce[_0xe72e('0xe')]){logger[_0xe72e('0xf')](_0xe72e('0x10'),_0x6ab3cf,_['map'](_0x7492ce,_0xe72e('0x11'))['join'](',\x20'));_0x179cdb[_0xe72e('0x12')]();}else{var _0x4f954e=_[_0xe72e('0x13')](_0x39d6ae[_0xe72e('0x14')],handleFindAgent(_0x46c7ca['name']));if(_0x4f954e){var _0x13ac9d=(_0x46c7ca[_0xe72e('0x15')]||0xa)*0x3e8;var _0x40a92c,_0x385381;var _0x2f7303=seqqueue[_0xe72e('0x16')](_0x13ac9d);_0x2f7303['id']=_0x6ab3cf;_0x2f7303[_0xe72e('0x17')]=_0x13ac9d;_0x2f7303['channel']=_0x16d1cc[_0xe72e('0x18')];writeLog(_0x6ab3cf,_0x4f954e,util[_0xe72e('0x9')](_0xe72e('0x19'),_0x13ac9d));_0x39d6ae[_0xe72e('0x1a')][_0x6ab3cf]['on'](_0xe72e('0x1b'),function(){logger[_0xe72e('0x8')](_0xe72e('0x1c'),_0x6ab3cf);clearTimeout(_0x385381);_0x385381=undefined;_0x2f7303['close']();if(_0x39d6ae[_0xe72e('0x1a')][_0x6ab3cf]){delete _0x39d6ae['rules'][_0x6ab3cf];}_0x179cdb[_0xe72e('0x12')]();});_0x39d6ae[_0xe72e('0x1a')][_0x6ab3cf]['on'](_0xe72e('0x1d'),function(){if(_0x39d6ae[_0xe72e('0x1a')][_0x6ab3cf]){delete _0x39d6ae['rules'][_0x6ab3cf];}});_0x385381=setTimeout(function(){logger[_0xe72e('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x6ab3cf);clearTimeout(_0x385381);_0x2f7303[_0xe72e('0x1e')]();_0x179cdb[_0xe72e('0x1f')]();},_0x13ac9d);strategy[_0xe72e('0x20')](_0x2f7303,_0x4f954e,_0x39d6ae,_0x16d1cc);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x6ab3cf,_0x46c7ca[_0xe72e('0xb')]);_0x179cdb[_0xe72e('0x12')]();}}}catch(_0x347743){console[_0xe72e('0x21')](_0x347743);logger[_0xe72e('0xf')](_0xe72e('0x22'),_0x6ab3cf,_0x347743[_0xe72e('0x23')]);_0x179cdb[_0xe72e('0x12')]();}};}; \ 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 8a26dab..dd4c905 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 _0x022b=['message','providerName','amazonlex','Message','dialogState','lodash','aws-sdk','./utils','routing','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','toString'];(function(_0x291e0e,_0x792683){var _0x3f85f3=function(_0x4a4049){while(--_0x4a4049){_0x291e0e['push'](_0x291e0e['shift']());}};_0x3f85f3(++_0x792683);}(_0x022b,0xad));var _0xb022=function(_0x5abbde,_0x1d7624){_0x5abbde=_0x5abbde-0x0;var _0x4c84d0=_0x022b[_0x5abbde];return _0x4c84d0;};'use strict';var _=require(_0xb022('0x0'));var moment=require('moment');var AWS=require(_0xb022('0x1'));var utils=require(_0xb022('0x2'));var logger=require('../../../../config/logger')(_0xb022('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb022('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb022('0x5')),'whatsappMessage':require(_0xb022('0x6'))};exports[_0xb022('0x7')]=function(_0x19b404,_0x212c2f){return function(_0x12090f){try{if(!_['isNil'](this[_0xb022('0x8')][_0xb022('0x9')])){logger[_0xb022('0xa')](_0xb022('0xb'),_0x19b404,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x12090f[_0xb022('0xc')]();}var _0x1af2da={'ContactId':this[_0xb022('0xd')]['id'],'sentAt':moment()[_0xb022('0xe')](_0xb022('0xf')),'direction':_0xb022('0x10')};if(this[_0xb022('0x11')]==='sms'||this['channel']==='whatsapp'){_0x1af2da['phone']=this[_0xb022('0x8')][_0xb022('0x12')];}var _0x352101=this[_0xb022('0x11')];if(_0x352101===_0xb022('0x13')){_0x1af2da['ChatWebsiteId']=this[_0xb022('0x14')]['id'];}else{_0x1af2da[_['upperFirst'](_0x352101)+'AccountId']=this[_0xb022('0x14')]['id'];}_0x1af2da[_[_0xb022('0x15')](_0x352101)+_0xb022('0x16')]=this[_0xb022('0x8')]['id'];if(this[_0xb022('0x8')][_0xb022('0x17')]){var _0x114606=_0x212c2f[0x4];if(!_[_0xb022('0x18')](_0x114606)){_0x1af2da[_0xb022('0x19')]=utils[_0xb022('0x1a')](_0x114606,this);return rpc[_0x352101+'Message'][_0xb022('0x1b')](_0x1af2da)[_0xb022('0x1c')](function(_0xaddb4e){logger[_0xb022('0xa')](_0xb022('0xb'),_0x19b404,_0x1af2da[_0xb022('0x19')]);})[_0xb022('0x1d')](function(_0x2aa26b){logger[_0xb022('0x1e')](_0xb022('0xb'),_0x19b404,JSON[_0xb022('0x1f')](_0x2aa26b));})[_0xb022('0x20')](function(){logger[_0xb022('0xa')](_0xb022('0x21'),_0x19b404);_0x12090f[_0xb022('0x22')]();});}else{logger[_0xb022('0xa')](_0xb022('0x23'),_0x19b404);_0x12090f[_0xb022('0x22')]();}}else{var _0x2e2ae2=this;var _0x40eafc=new AWS['LexRuntime']({'accessKeyId':_0x212c2f[0x0],'secretAccessKey':_0x212c2f[0x1],'region':_0x212c2f[0x2]});var _0x1e20b9={'botAlias':'$LATEST','botName':_0x212c2f[0x3],'inputText':this['message'][_0xb022('0x19')],'userId':this['channel']+':'+this[_0xb022('0x8')]['id'][_0xb022('0x24')]()};_0x40eafc['postText'](_0x1e20b9,function(_0x309259,_0x4baf72){if(_0x309259){logger[_0xb022('0x1e')](_0xb022('0xb'),_0x19b404,_0x309259['message']);_0x12090f['next']();}else if(_0x4baf72&&_0x4baf72[_0xb022('0x25')]){_0x2e2ae2['body']['amazonlex']=_0x4baf72;_0x1af2da[_0xb022('0x19')]=_0x4baf72[_0xb022('0x25')];_0x1af2da[_0xb022('0x26')]=_0xb022('0x27');_0x1af2da['providerResponse']=JSON[_0xb022('0x1f')](_0x4baf72);return rpc[_0x352101+_0xb022('0x28')][_0xb022('0x1b')](_0x1af2da)[_0xb022('0x1c')](function(_0x72e59c){logger['info'](_0xb022('0xb'),_0x19b404,_0x1af2da[_0xb022('0x19')]);if(_0x4baf72[_0xb022('0x29')]=='Failed'){_0x12090f[_0xb022('0xc')]();}else{_0x12090f[_0xb022('0x22')]();}})[_0xb022('0x1d')](function(_0x4b2ce6){logger[_0xb022('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x19b404,JSON[_0xb022('0x1f')](_0x4b2ce6));_0x12090f[_0xb022('0xc')]();});}else{_0x12090f[_0xb022('0xc')]();}});}}catch(_0x2b970f){logger['error'](_0xb022('0xb'),_0x19b404,JSON['stringify'](_0x2b970f));_0x12090f[_0xb022('0x22')]();}};}; \ No newline at end of file +var _0xe239=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','next','format','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','create','then','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','message','toString','error','providerName','amazonlex','stringify','Message','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x40e771,_0x4ecc8f){var _0x201433=function(_0x182f21){while(--_0x182f21){_0x40e771['push'](_0x40e771['shift']());}};_0x201433(++_0x4ecc8f);}(_0xe239,0x106));var _0x9e23=function(_0x4c7d2e,_0x5f0ee7){_0x4c7d2e=_0x4c7d2e-0x0;var _0x1e9190=_0xe239[_0x4c7d2e];return _0x1e9190;};'use strict';var _=require(_0x9e23('0x0'));var moment=require(_0x9e23('0x1'));var AWS=require(_0x9e23('0x2'));var utils=require(_0x9e23('0x3'));var logger=require(_0x9e23('0x4'))(_0x9e23('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x9e23('0x6')),'mailMessage':require(_0x9e23('0x7')),'smsMessage':require(_0x9e23('0x8')),'faxMessage':require(_0x9e23('0x9')),'whatsappMessage':require(_0x9e23('0xa'))};exports['consequence']=function(_0x1ef2c0,_0x538b8a){return function(_0x3510d1){try{if(!_[_0x9e23('0xb')](this[_0x9e23('0xc')]['UserId'])){logger[_0x9e23('0xd')](_0x9e23('0xe'),_0x1ef2c0,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3510d1[_0x9e23('0xf')]();}var _0x16c3df={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9e23('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x9e23('0x11')]==='sms'||this[_0x9e23('0x11')]===_0x9e23('0x12')){_0x16c3df[_0x9e23('0x13')]=this[_0x9e23('0xc')][_0x9e23('0x13')];}var _0x10d2c7=this[_0x9e23('0x11')];if(_0x10d2c7===_0x9e23('0x14')){_0x16c3df[_0x9e23('0x15')]=this[_0x9e23('0x16')]['id'];}else{_0x16c3df[_['upperFirst'](_0x10d2c7)+_0x9e23('0x17')]=this[_0x9e23('0x16')]['id'];}_0x16c3df[_[_0x9e23('0x18')](_0x10d2c7)+_0x9e23('0x19')]=this[_0x9e23('0xc')]['id'];if(this[_0x9e23('0xc')][_0x9e23('0x1a')]){var _0xa8218f=_0x538b8a[0x4];if(!_[_0x9e23('0x1b')](_0xa8218f)){_0x16c3df[_0x9e23('0x1c')]=utils[_0x9e23('0x1d')](_0xa8218f,this);return rpc[_0x10d2c7+'Message'][_0x9e23('0x1e')](_0x16c3df)[_0x9e23('0x1f')](function(_0x1e0b05){logger[_0x9e23('0xd')](_0x9e23('0xe'),_0x1ef2c0,_0x16c3df[_0x9e23('0x1c')]);})['catch'](function(_0x4c26db){logger['error'](_0x9e23('0xe'),_0x1ef2c0,JSON['stringify'](_0x4c26db));})[_0x9e23('0x20')](function(){logger[_0x9e23('0xd')](_0x9e23('0x21'),_0x1ef2c0);_0x3510d1['stop']();});}else{logger[_0x9e23('0xd')](_0x9e23('0x22'),_0x1ef2c0);_0x3510d1[_0x9e23('0x23')]();}}else{var _0x1bec3a=this;var _0x52582c=new AWS['LexRuntime']({'accessKeyId':_0x538b8a[0x0],'secretAccessKey':_0x538b8a[0x1],'region':_0x538b8a[0x2]});var _0x559c96={'botAlias':'$LATEST','botName':_0x538b8a[0x3],'inputText':this[_0x9e23('0x24')]['body'],'userId':this[_0x9e23('0x11')]+':'+this[_0x9e23('0xc')]['id'][_0x9e23('0x25')]()};_0x52582c['postText'](_0x559c96,function(_0xa0730,_0xc93306){if(_0xa0730){logger[_0x9e23('0x26')]('[%s][AMAZONLEX]\x20%s',_0x1ef2c0,_0xa0730['message']);_0x3510d1[_0x9e23('0xf')]();}else if(_0xc93306&&_0xc93306['message']){_0x1bec3a[_0x9e23('0x1c')]['amazonlex']=_0xc93306;_0x16c3df[_0x9e23('0x1c')]=_0xc93306['message'];_0x16c3df[_0x9e23('0x27')]=_0x9e23('0x28');_0x16c3df['providerResponse']=JSON[_0x9e23('0x29')](_0xc93306);return rpc[_0x10d2c7+_0x9e23('0x2a')]['create'](_0x16c3df)[_0x9e23('0x1f')](function(_0x56a5a8){logger[_0x9e23('0xd')]('[%s][AMAZONLEX]\x20%s',_0x1ef2c0,_0x16c3df['body']);if(_0xc93306[_0x9e23('0x2b')]==_0x9e23('0x2c')){_0x3510d1[_0x9e23('0xf')]();}else{_0x3510d1[_0x9e23('0x23')]();}})['catch'](function(_0x1e620f){logger[_0x9e23('0x26')](_0x9e23('0xe'),_0x1ef2c0,JSON[_0x9e23('0x29')](_0x1e620f));_0x3510d1[_0x9e23('0xf')]();});}else{_0x3510d1[_0x9e23('0xf')]();}});}}catch(_0x4f434d){logger[_0x9e23('0x26')](_0x9e23('0xe'),_0x1ef2c0,JSON[_0x9e23('0x29')](_0x4f434d));_0x3510d1[_0x9e23('0x23')]();}};}; \ 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 9fef22b..c97d57d 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 _0x749c=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','info','[%s][AUTOREPLY]\x20%s','isNil','created','interaction','Autoreply\x20already\x20sent','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','replace','','headers','auto-replied','All','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','then','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','update','stringify','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x749c,0x191));var _0xc749=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x749c[_0x2bc3f4];return _0x14ac53;};'use strict';var _=require(_0xc749('0x0'));var moment=require(_0xc749('0x1'));var utils=require(_0xc749('0x2'));var logger=require(_0xc749('0x3'))(_0xc749('0x4'));var rpc={'chatMessage':require(_0xc749('0x5')),'openchannelMessage':require(_0xc749('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc749('0x7')),'faxMessage':require(_0xc749('0x8')),'whatsappMessage':require(_0xc749('0x9')),'chatInteraction':require(_0xc749('0xa')),'openchannelInteraction':require(_0xc749('0xb')),'mailInteraction':require(_0xc749('0xc')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xc749('0xd')),'whatsappInteraction':require(_0xc749('0xe'))};var mailRpc=require(_0xc749('0xf'));exports['consequence']=function(_0x179782,_0x493482,_0x2e8a4f,_0x19af10){return function(_0x2475e5){try{var _0x1844df=this[_0xc749('0x10')];if(_0x1844df==='mail'&&_0x19af10[_0xc749('0x11')]['isAutoreply']){logger[_0xc749('0x12')](_0xc749('0x13'),_0x179782,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x2475e5['next']();}if(_0x493482[0x0]==='1'&&(_[_0xc749('0x14')](this['interaction'][_0xc749('0x15')])||!this[_0xc749('0x16')]['created'])){logger[_0xc749('0x12')]('[%s][AUTOREPLY]\x20%s',_0x179782,_0xc749('0x17'));return _0x2475e5[_0xc749('0x18')]();}if(_0x493482[0x0]==='2'&&this[_0xc749('0x16')]['autoreplyExecuted']){logger[_0xc749('0x12')](_0xc749('0x19'),_0x179782,'One\x20Time\x20already\x20sent');return _0x2475e5[_0xc749('0x18')]();}var _0x2c5e18={'ContactId':this[_0xc749('0x1a')]['id'],'sentAt':moment()['format'](_0xc749('0x1b')),'direction':_0xc749('0x1c')};if(this[_0xc749('0x10')]===_0xc749('0x1d')){_0x2c5e18[_0xc749('0x11')]=utils[_0xc749('0x1e')](_0x493482[0x2],this);}else{_0x2c5e18[_0xc749('0x11')]=utils[_0xc749('0x1e')](_0x493482[0x1],this);}if(this[_0xc749('0x1f')]){_0x2c5e18['to']=this[_0xc749('0x1f')]['from']||'';if(this[_0xc749('0x10')]==='mail'&&_0x493482[0x1]==='1'){_0x2c5e18['cc']=this[_0xc749('0x1f')]['cc']||'';}_0x2c5e18[_0xc749('0x20')]=this[_0xc749('0x1f')]['to']||'';_0x2c5e18[_0xc749('0x21')]=this['message']['phone']||'';_0x2c5e18[_0xc749('0x22')]=!![];if(this['message']['subject']){_0x2c5e18[_0xc749('0x23')]='';_0x2c5e18[_0xc749('0x23')]+=_['startsWith'](this[_0xc749('0x1f')]['subject'],_0xc749('0x24'))?'':_0xc749('0x25');_0x2c5e18[_0xc749('0x23')]+=this[_0xc749('0x1f')][_0xc749('0x23')];}}if(this[_0xc749('0x10')]===_0xc749('0x26')){_0x2c5e18[_0xc749('0x27')]=this[_0xc749('0x28')]['id'];}else{_0x2c5e18[_[_0xc749('0x29')](this[_0xc749('0x10')])+_0xc749('0x2a')]=this['account']['id'];}_0x2c5e18[_['upperFirst'](this[_0xc749('0x10')])+_0xc749('0x2b')]=this[_0xc749('0x16')]['id'];var _0x4dcc51=this[_0xc749('0x16')];if(rpc[this['channel']+_0xc749('0x2c')]){if(this['channel']===_0xc749('0x1d')){_0x2c5e18[_0xc749('0x2d')]=this['message'][_0xc749('0x2e')];_0x2c5e18['html']=''+_[_0xc749('0x2f')](_0x2c5e18[_0xc749('0x11')],_0xc749('0x30'),''+_[_0xe629('0x31')](_0x4feb84[_0xe629('0x13')],_0xe629('0x32'),_0xe629('0x33'))+'';_0x4feb84[_0xe629('0x34')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xe629('0x35'),'Precedence':_0xe629('0x36')};return mailRpc[_0xe629('0x37')](this[_0xe629('0x2c')][_0xe629('0x38')],_0x4feb84)[_0xe629('0x39')](function(_0x6520f5){logger[_0xe629('0x15')](_0xe629('0x3a'),_0x2b8625);_0x4feb84[_0xe629('0x3b')]=_0x6520f5[_0xe629('0x23')]['messageId'];return rpc[_0x1f9a74+'Message']['create'](_0x4feb84);})[_0xe629('0x39')](function(_0x56a80c){logger['info'](_0xe629('0x16'),_0x2b8625,JSON[_0xe629('0x3c')](_0x56a80c));})['catch'](function(_0x525371){logger[_0xe629('0x3d')](_0xe629('0x3e'),_0x2b8625,JSON[_0xe629('0x3c')](_0x525371));})[_0xe629('0x3f')](function(){Promise[_0xe629('0x40')]()[_0xe629('0x39')](function(){if(_0x4780d5[0x0]!=='2'||_0x1b0140['autoreplyExecuted'])return;return rpc[_0x1f9a74+'Interaction'][_0xe629('0x41')](_0x1b0140['id'],{'autoreplyExecuted':!![]})['then'](function(_0x54f6c5){logger['info'](_0xe629('0x1d'),_0x2b8625,JSON[_0xe629('0x3c')](_0x54f6c5));})['catch'](function(_0x13b396){logger[_0xe629('0x3d')](_0xe629('0x42'),_0x2b8625,JSON[_0xe629('0x3c')](_0x13b396));});})['then'](function(){_0x1d07ce[_0xe629('0x1c')]();});});}else{return rpc[this[_0xe629('0x24')]+_0xe629('0x43')][_0xe629('0x44')](_0x4feb84)[_0xe629('0x39')](function(){logger[_0xe629('0x15')](_0xe629('0x16'),_0x2b8625,_0x4feb84[_0xe629('0x13')]);})['catch'](function(_0x269644){logger['error'](_0xe629('0x16'),_0x2b8625,JSON['stringify'](_0x269644));})[_0xe629('0x3f')](function(){Promise[_0xe629('0x40')]()[_0xe629('0x39')](function(){if(_0x4780d5[0x0]!=='2'||_0x1b0140['autoreplyExecuted'])return;return rpc[_0x1f9a74+_0xe629('0x45')][_0xe629('0x41')](_0x1b0140['id'],{'autoreplyExecuted':!![]})[_0xe629('0x39')](function(_0x59deff){logger[_0xe629('0x15')](_0xe629('0x1d'),_0x2b8625,JSON[_0xe629('0x3c')](_0x59deff));})[_0xe629('0x46')](function(_0x33d316){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2b8625,JSON[_0xe629('0x3c')](_0x33d316));});})[_0xe629('0x39')](function(){_0x1d07ce[_0xe629('0x1c')]();});});}}}catch(_0x44b0f1){logger[_0xe629('0x3d')](_0xe629('0x16'),_0x2b8625,JSON[_0xe629('0x3c')](_0x44b0f1));_0x1d07ce[_0xe629('0x47')]();}};}; \ 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 15007f2..09e336b 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 _0x3b62=['[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','finally','stop','error','[%s][CLOSE]\x20%s','stringify','moment','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','update','interaction','info'];(function(_0x3d8452,_0x56e819){var _0x5cfd80=function(_0x1496f8){while(--_0x1496f8){_0x3d8452['push'](_0x3d8452['shift']());}};_0x5cfd80(++_0x56e819);}(_0x3b62,0x196));var _0x23b6=function(_0x599e0a,_0x3162d9){_0x599e0a=_0x599e0a-0x0;var _0x3ac3e0=_0x3b62[_0x599e0a];return _0x3ac3e0;};'use strict';var moment=require(_0x23b6('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0x23b6('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x23b6('0x2')),'mailInteraction':require(_0x23b6('0x3')),'faxInteraction':require(_0x23b6('0x4')),'whatsappInteraction':require(_0x23b6('0x5'))};exports[_0x23b6('0x6')]=function(_0x5978c5,_0x2cd32a,_0x3f9f3f,_0x499bd8){return function(_0x459487){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x5978c5,_0x2cd32a[0x0]);var _0x2c0e10={'closed':0x1,'closedAt':moment()[_0x23b6('0x7')](_0x23b6('0x8')),'closeReason':_0x23b6('0x9'),'disposition':_0x2cd32a[0x0]};if(rpc[_0x499bd8[_0x23b6('0xa')]+'Interaction']){rpc[_0x499bd8[_0x23b6('0xa')]+'Interaction'][_0x23b6('0xb')](_0x499bd8[_0x23b6('0xc')]['id'],_0x2c0e10)['then'](function(_0x3dc16f){logger[_0x23b6('0xd')](_0x23b6('0xe'),_0x5978c5,_0x499bd8[_0x23b6('0xc')]['id']);})['catch'](function(_0x27cab5){logger['error']('[%s][CLOSE]\x20%s',_0x5978c5,JSON['stringify'](_0x27cab5));})[_0x23b6('0xf')](function(){_0x459487[_0x23b6('0x10')]();});}}catch(_0x4bade8){logger[_0x23b6('0x11')](_0x23b6('0x12'),_0x5978c5,JSON[_0x23b6('0x13')](_0x4bade8));_0x459487[_0x23b6('0x10')]();}};}; \ No newline at end of file +var _0xb866=['update','interaction','stringify','finally','stop','error','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','system','Interaction','channel'];(function(_0x2beb3b,_0x31f8f1){var _0x49eb58=function(_0x23efac){while(--_0x23efac){_0x2beb3b['push'](_0x2beb3b['shift']());}};_0x49eb58(++_0x31f8f1);}(_0xb866,0x14a));var _0x6b86=function(_0x533f71,_0x273efa){_0x533f71=_0x533f71-0x0;var _0x348ba8=_0xb866[_0x533f71];return _0x348ba8;};'use strict';var moment=require(_0x6b86('0x0'));var logger=require(_0x6b86('0x1'))(_0x6b86('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x6b86('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x6b86('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x6b86('0x5')]=function(_0xaada07,_0x5eb500,_0x4e46aa,_0x118ad7){return function(_0xa6ee53){try{logger[_0x6b86('0x6')](_0x6b86('0x7'),_0xaada07,_0x5eb500[0x0]);var _0x2ece9e={'closed':0x1,'closedAt':moment()[_0x6b86('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x6b86('0x9'),'disposition':_0x5eb500[0x0]};if(rpc[_0x118ad7['channel']+_0x6b86('0xa')]){rpc[_0x118ad7[_0x6b86('0xb')]+_0x6b86('0xa')][_0x6b86('0xc')](_0x118ad7[_0x6b86('0xd')]['id'],_0x2ece9e)['then'](function(_0x26d40b){logger[_0x6b86('0x6')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0xaada07,_0x118ad7['interaction']['id']);})['catch'](function(_0x30044b){logger['error']('[%s][CLOSE]\x20%s',_0xaada07,JSON[_0x6b86('0xe')](_0x30044b));})[_0x6b86('0xf')](function(){_0xa6ee53[_0x6b86('0x10')]();});}}catch(_0x2f8cc5){logger[_0x6b86('0x11')]('[%s][CLOSE]\x20%s',_0xaada07,JSON['stringify'](_0x2f8cc5));_0xa6ee53[_0x6b86('0x10')]();}};}; \ 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 d4d69a3..6bb9229 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 _0xf8bb=['finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','dialogflow','result','fulfillment','speech','providerResponse','Message','metadata','endConversation','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','catch','error','stringify'];(function(_0xdb3b47,_0x30d0a0){var _0x352627=function(_0x2049e1){while(--_0x2049e1){_0xdb3b47['push'](_0xdb3b47['shift']());}};_0x352627(++_0x30d0a0);}(_0xf8bb,0x111));var _0xbf8b=function(_0x5c6751,_0x346099){_0x5c6751=_0x5c6751-0x0;var _0x2e1b60=_0xf8bb[_0x5c6751];return _0x2e1b60;};'use strict';var _=require(_0xbf8b('0x0'));var moment=require(_0xbf8b('0x1'));var apiai=require(_0xbf8b('0x2'));var md5=require('md5');var utils=require(_0xbf8b('0x3'));var logger=require(_0xbf8b('0x4'))(_0xbf8b('0x5'));var rpc={'chatMessage':require(_0xbf8b('0x6')),'openchannelMessage':require(_0xbf8b('0x7')),'mailMessage':require(_0xbf8b('0x8')),'smsMessage':require(_0xbf8b('0x9')),'faxMessage':require(_0xbf8b('0xa')),'whatsappMessage':require(_0xbf8b('0xb'))};exports[_0xbf8b('0xc')]=function(_0x3b5f9e,_0x2dbd86){return function(_0xd17f35){try{if(!_['isNil'](this[_0xbf8b('0xd')]['UserId'])){logger['info'](_0xbf8b('0xe'),_0x3b5f9e,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xd17f35[_0xbf8b('0xf')]();}var _0x5c346c={'ContactId':this[_0xbf8b('0x10')]['id'],'sentAt':moment()[_0xbf8b('0x11')](_0xbf8b('0x12')),'direction':_0xbf8b('0x13')};if(this[_0xbf8b('0x14')]===_0xbf8b('0x15')||this[_0xbf8b('0x14')]===_0xbf8b('0x16')){_0x5c346c['phone']=this[_0xbf8b('0xd')][_0xbf8b('0x17')];}var _0x48656a=this[_0xbf8b('0x14')];if(_0x48656a===_0xbf8b('0x18')){_0x5c346c[_0xbf8b('0x19')]=this[_0xbf8b('0x1a')]['id'];}else{_0x5c346c[_[_0xbf8b('0x1b')](_0x48656a)+_0xbf8b('0x1c')]=this[_0xbf8b('0x1a')]['id'];}_0x5c346c[_[_0xbf8b('0x1b')](_0x48656a)+_0xbf8b('0x1d')]=this[_0xbf8b('0xd')]['id'];if(this['interaction'][_0xbf8b('0x1e')]){var _0x3985b7=_0x2dbd86[0x2];if(!_[_0xbf8b('0x1f')](_0x3985b7)){_0x5c346c[_0xbf8b('0x20')]=utils[_0xbf8b('0x21')](_0x3985b7,this);return rpc[_0x48656a+'Message'][_0xbf8b('0x22')](_0x5c346c)[_0xbf8b('0x23')](function(_0x460f3d){logger['info'](_0xbf8b('0xe'),_0x3b5f9e,_0x5c346c[_0xbf8b('0x20')]);})[_0xbf8b('0x24')](function(_0x4a978b){logger[_0xbf8b('0x25')](_0xbf8b('0xe'),_0x3b5f9e,JSON[_0xbf8b('0x26')](_0x4a978b));})[_0xbf8b('0x27')](function(){logger[_0xbf8b('0x28')](_0xbf8b('0x29'),_0x3b5f9e);_0xd17f35['stop']();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3b5f9e);_0xd17f35[_0xbf8b('0x2a')]();}}else{var _0x4f36e5=this;var _0x3d4b1a=apiai(_0x2dbd86[0x0],{'language':_0x2dbd86[0x1]||'en'});return _0x3d4b1a['textRequest'](this[_0xbf8b('0x2b')]['body'],{'sessionId':md5(this['interaction']['id'])})[_0xbf8b('0x23')](function(_0x35e83f){_0x4f36e5[_0xbf8b('0x20')][_0xbf8b('0x2c')]=_0x35e83f;_0x5c346c[_0xbf8b('0x20')]=_0x35e83f[_0xbf8b('0x2d')][_0xbf8b('0x2e')][_0xbf8b('0x2f')];_0x5c346c['providerName']=_0xbf8b('0x2c');_0x5c346c[_0xbf8b('0x30')]=JSON[_0xbf8b('0x26')](_0x35e83f);return rpc[_0x48656a+_0xbf8b('0x31')]['create'](_0x5c346c)[_0xbf8b('0x23')](function(_0x1595ac){logger['info'](_0xbf8b('0xe'),_0x3b5f9e,_0x5c346c[_0xbf8b('0x20')]);if(_0x35e83f[_0xbf8b('0x2d')][_0xbf8b('0x32')][_0xbf8b('0x33')]){_0xd17f35[_0xbf8b('0xf')]();}else{_0xd17f35[_0xbf8b('0x2a')]();}})[_0xbf8b('0x24')](function(_0x3b9275){logger[_0xbf8b('0x25')](_0xbf8b('0xe'),_0x3b5f9e,JSON[_0xbf8b('0x26')](_0x3b9275));_0xd17f35[_0xbf8b('0xf')]();});})['catch'](function(_0x22aa17){logger[_0xbf8b('0x25')](_0xbf8b('0xe'),_0x3b5f9e,_0x22aa17[_0xbf8b('0x2b')]);_0xd17f35['next']();});}}catch(_0x22b277){logger[_0xbf8b('0x25')](_0xbf8b('0xe'),_0x3b5f9e,JSON[_0xbf8b('0x26')](_0x22b277));_0xd17f35[_0xbf8b('0x2a')]();}};}; \ No newline at end of file +var _0xc21c=['catch','error','stringify','finally','stop','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','endConversation','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','next','contact','format','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','body','getMustacheRender','Message','create','then','info'];(function(_0x4074d3,_0x387316){var _0x23b49e=function(_0x5ccfe3){while(--_0x5ccfe3){_0x4074d3['push'](_0x4074d3['shift']());}};_0x23b49e(++_0x387316);}(_0xc21c,0x166));var _0xcc21=function(_0x55e2b3,_0x4d21be){_0x55e2b3=_0x55e2b3-0x0;var _0x378787=_0xc21c[_0x55e2b3];return _0x378787;};'use strict';var _=require(_0xcc21('0x0'));var moment=require(_0xcc21('0x1'));var apiai=require('apiai-promise');var md5=require(_0xcc21('0x2'));var utils=require(_0xcc21('0x3'));var logger=require(_0xcc21('0x4'))(_0xcc21('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xcc21('0x6')),'mailMessage':require(_0xcc21('0x7')),'smsMessage':require(_0xcc21('0x8')),'faxMessage':require(_0xcc21('0x9')),'whatsappMessage':require(_0xcc21('0xa'))};exports[_0xcc21('0xb')]=function(_0x33604a,_0x4f3166){return function(_0x2676fe){try{if(!_[_0xcc21('0xc')](this[_0xcc21('0xd')][_0xcc21('0xe')])){logger['info'](_0xcc21('0xf'),_0x33604a,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2676fe[_0xcc21('0x10')]();}var _0x4ecf6a={'ContactId':this[_0xcc21('0x11')]['id'],'sentAt':moment()[_0xcc21('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xcc21('0x13')]===_0xcc21('0x14')||this['channel']===_0xcc21('0x15')){_0x4ecf6a['phone']=this[_0xcc21('0xd')][_0xcc21('0x16')];}var _0x28ed9c=this['channel'];if(_0x28ed9c===_0xcc21('0x17')){_0x4ecf6a['ChatWebsiteId']=this[_0xcc21('0x18')]['id'];}else{_0x4ecf6a[_[_0xcc21('0x19')](_0x28ed9c)+_0xcc21('0x1a')]=this[_0xcc21('0x18')]['id'];}_0x4ecf6a[_[_0xcc21('0x19')](_0x28ed9c)+_0xcc21('0x1b')]=this[_0xcc21('0xd')]['id'];if(this['interaction']['created']){var _0x2bd0b4=_0x4f3166[0x2];if(!_['isEmpty'](_0x2bd0b4)){_0x4ecf6a[_0xcc21('0x1c')]=utils[_0xcc21('0x1d')](_0x2bd0b4,this);return rpc[_0x28ed9c+_0xcc21('0x1e')][_0xcc21('0x1f')](_0x4ecf6a)[_0xcc21('0x20')](function(_0x5a727c){logger[_0xcc21('0x21')](_0xcc21('0xf'),_0x33604a,_0x4ecf6a[_0xcc21('0x1c')]);})[_0xcc21('0x22')](function(_0x5c4417){logger[_0xcc21('0x23')](_0xcc21('0xf'),_0x33604a,JSON[_0xcc21('0x24')](_0x5c4417));})[_0xcc21('0x25')](function(){logger[_0xcc21('0x21')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x33604a);_0x2676fe[_0xcc21('0x26')]();});}else{logger[_0xcc21('0x21')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x33604a);_0x2676fe['stop']();}}else{var _0x10f49b=this;var _0x597ecf=apiai(_0x4f3166[0x0],{'language':_0x4f3166[0x1]||'en'});return _0x597ecf[_0xcc21('0x27')](this[_0xcc21('0x28')][_0xcc21('0x1c')],{'sessionId':md5(this[_0xcc21('0xd')]['id'])})[_0xcc21('0x20')](function(_0x266c92){_0x10f49b['body'][_0xcc21('0x29')]=_0x266c92;_0x4ecf6a['body']=_0x266c92[_0xcc21('0x2a')][_0xcc21('0x2b')][_0xcc21('0x2c')];_0x4ecf6a[_0xcc21('0x2d')]='dialogflow';_0x4ecf6a[_0xcc21('0x2e')]=JSON['stringify'](_0x266c92);return rpc[_0x28ed9c+_0xcc21('0x1e')][_0xcc21('0x1f')](_0x4ecf6a)[_0xcc21('0x20')](function(_0x83b75b){logger[_0xcc21('0x21')](_0xcc21('0xf'),_0x33604a,_0x4ecf6a[_0xcc21('0x1c')]);if(_0x266c92[_0xcc21('0x2a')][_0xcc21('0x2f')][_0xcc21('0x30')]){_0x2676fe['next']();}else{_0x2676fe[_0xcc21('0x26')]();}})['catch'](function(_0x10b19f){logger[_0xcc21('0x23')](_0xcc21('0xf'),_0x33604a,JSON['stringify'](_0x10b19f));_0x2676fe[_0xcc21('0x10')]();});})['catch'](function(_0x29f003){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x33604a,_0x29f003['message']);_0x2676fe['next']();});}}catch(_0x4310a1){logger['error'](_0xcc21('0xf'),_0x33604a,JSON['stringify'](_0x4310a1));_0x2676fe[_0xcc21('0x26')]();}};}; \ 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 4b3d767..57d5084 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 _0x6800=['dialogflow','md5','moment','bluebird','../../../../config/logger','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','fields','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','stringify','push','fulfillmentText','all','stack','lodash'];(function(_0x3f2abd,_0x23b3a9){var _0x3d8338=function(_0x26d053){while(--_0x26d053){_0x3f2abd['push'](_0x3f2abd['shift']());}};_0x3d8338(++_0x23b3a9);}(_0x6800,0x11f));var _0x0680=function(_0x5e5ce1,_0x209edd){_0x5e5ce1=_0x5e5ce1-0x0;var _0x3a12c5=_0x6800[_0x5e5ce1];return _0x3a12c5;};'use strict';var _=require(_0x0680('0x0'));var dialogflow=require(_0x0680('0x1'));var md5=require(_0x0680('0x2'));var moment=require(_0x0680('0x3'));var Promise=require(_0x0680('0x4'));var logger=require(_0x0680('0x5'))('routing');var utils=require(_0x0680('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x0680('0x7')),'mailMessage':require(_0x0680('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x0680('0x9')),'whatsappMessage':require(_0x0680('0xa'))};function createMessage(_0x2802f4,_0x437be3,_0x133dab,_0x2da5e9){return new Promise(function(_0x3cfc62,_0x16fc8e){var _0x5e1079=_[_0x0680('0xb')](_0x133dab);_0x5e1079[_0x0680('0xc')]=_0x2da5e9;return rpc[_0x437be3+_0x0680('0xd')][_0x0680('0xe')](_0x5e1079)['then'](function(){logger[_0x0680('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x2802f4,_0x5e1079[_0x0680('0xc')]);_0x3cfc62();})[_0x0680('0x10')](function(_0x49bdb0){logger[_0x0680('0x11')](_0x0680('0x12'),_0x2802f4,JSON['stringify'](_0x49bdb0));_0x16fc8e(_0x49bdb0);});});}exports['consequence']=function(_0x32bb76,_0x367813){return function(_0x43da86){try{if(!_[_0x0680('0x13')](this[_0x0680('0x14')]['UserId'])){logger[_0x0680('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x32bb76,_0x0680('0x15'));return _0x43da86[_0x0680('0x16')]();}var _0xca96d8={'ContactId':this['contact']['id'],'sentAt':moment()[_0x0680('0x17')](_0x0680('0x18')),'direction':_0x0680('0x19')};if(this[_0x0680('0x1a')]===_0x0680('0x1b')||this[_0x0680('0x1a')]===_0x0680('0x1c')){_0xca96d8[_0x0680('0x1d')]=this[_0x0680('0x14')]['phone'];}var _0x153341=this['channel'];if(_0x153341===_0x0680('0x1e')){_0xca96d8['ChatWebsiteId']=this[_0x0680('0x1f')]['id'];}else{_0xca96d8[_[_0x0680('0x20')](_0x153341)+_0x0680('0x21')]=this['account']['id'];}_0xca96d8[_[_0x0680('0x20')](_0x153341)+_0x0680('0x22')]=this[_0x0680('0x14')]['id'];if(this[_0x0680('0x14')][_0x0680('0x23')]){var _0x1a896e=_0x367813[0x4];if(!_['isEmpty'](_0x1a896e)){_0xca96d8['body']=utils['getMustacheRender'](_0x1a896e,this);return rpc[_0x153341+'Message']['create'](_0xca96d8)[_0x0680('0x24')](function(_0xac4a21){logger[_0x0680('0xf')](_0x0680('0x12'),_0x32bb76,_0xca96d8[_0x0680('0xc')]);})['catch'](function(_0x5ea44){logger['error'](_0x0680('0x12'),_0x32bb76,JSON['stringify'](_0x5ea44));})[_0x0680('0x25')](function(){logger[_0x0680('0xf')](_0x0680('0x26'),_0x32bb76);_0x43da86[_0x0680('0x27')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x32bb76);_0x43da86[_0x0680('0x27')]();}}else{var _0x3258c0=this;var _0x2e1a66=_0x367813[0x2][_0x0680('0x28')](/\\n/g,'\x0a');var _0xd67eb={'credentials':{'private_key':_0x2e1a66,'client_email':_0x367813[0x1]}};var _0x2032fb=new dialogflow[(_0x0680('0x29'))](_0xd67eb);var _0x2929ef=_0x2032fb[_0x0680('0x2a')](_0x367813[0x0],md5(_0x3258c0[_0x0680('0x14')]['id']));var _0x1bc183={'session':_0x2929ef,'queryInput':{'text':{'text':_0x3258c0[_0x0680('0x2b')][_0x0680('0xc')],'languageCode':_0x367813[0x3]||'en'}}};return _0x2032fb[_0x0680('0x2c')](_0x1bc183)[_0x0680('0x24')](function(_0x3a1038){if(_0x3a1038&&_0x3a1038[_0x0680('0x2d')]){_0x3258c0[_0x0680('0xc')][_0x0680('0x2e')]=_0x3a1038;var _0x4748cc=_0x3a1038[0x0];var _0x56dbef=_0x4748cc['queryResult']['diagnosticInfo']&&_0x4748cc[_0x0680('0x2f')]['diagnosticInfo']['fields']?_0x4748cc[_0x0680('0x2f')][_0x0680('0x30')]['fields'][_0x0680('0x31')][_0x0680('0x32')]:![];_0x3258c0[_0x0680('0xc')][_0x0680('0x33')]=_0x4748cc[_0x0680('0x2f')][_0x0680('0x34')];_0x3258c0[_0x0680('0xc')][_0x0680('0x35')]=_0x4748cc[_0x0680('0x2f')][_0x0680('0x36')];_0x3258c0['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x4748cc[_0x0680('0x2f')][_0x0680('0x30')]&&_0x4748cc[_0x0680('0x2f')][_0x0680('0x30')][_0x0680('0x37')]?_0x4748cc[_0x0680('0x2f')]['diagnosticInfo'][_0x0680('0x37')][_0x0680('0x31')][_0x0680('0x32')]:![];_0x3258c0[_0x0680('0xc')][_0x0680('0x38')]=_0x4748cc['queryResult'][_0x0680('0x39')][_0x0680('0x3a')];_0x3258c0['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x4748cc['queryResult']['intent'][_0x0680('0x3b')];_0x3258c0['body'][_0x0680('0x3c')]=_0x4748cc[_0x0680('0x2f')]['intent']['isFallback'];_0x3258c0[_0x0680('0xc')]['DIALOGFLOWV2_LANGUAGECODE']=_0x4748cc['queryResult'][_0x0680('0x3d')];_0x3258c0['body'][_0x0680('0x3e')]=_0x4748cc[_0x0680('0x2f')][_0x0680('0x3f')];_0x3258c0['body'][_0x0680('0x40')]=_0x4748cc[_0x0680('0x2f')]['intentDetectionConfidence'];_0xca96d8[_0x0680('0x41')]=_0x0680('0x2e');_0xca96d8[_0x0680('0x42')]=JSON[_0x0680('0x43')](_0x3a1038);var _0x343db5=[];for(var _0x14e636=0x0;_0x14e636<_0x3a1038['length'];_0x14e636++){var _0x13cc95=_0x3a1038[_0x14e636];if(_0x13cc95&&_0x13cc95['queryResult']&&_0x13cc95['queryResult']['fulfillmentText']){_0x343db5[_0x0680('0x44')](createMessage(_0x32bb76,_0x153341,_0xca96d8,_0x13cc95[_0x0680('0x2f')][_0x0680('0x45')]));}}return Promise[_0x0680('0x46')](_0x343db5)[_0x0680('0x24')](function(){if(_0x56dbef){_0x43da86[_0x0680('0x16')]();}else{_0x43da86['stop']();}})['catch'](function(_0x23565b){logger['error'](_0x0680('0x12'),_0x32bb76,JSON[_0x0680('0x43')](_0x23565b));_0x43da86['next']();});}})[_0x0680('0x10')](function(_0x5c6d2c){logger[_0x0680('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x32bb76,_0x5c6d2c[_0x0680('0x2b')],_0x5c6d2c[_0x0680('0x47')]);_0x43da86['next']();});}}catch(_0x30031e){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x32bb76,JSON[_0x0680('0x43')](_0x30031e));_0x43da86['stop']();}};}; \ No newline at end of file +var _0xa94f=['DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','all','stack','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','getMustacheRender','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','name','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText'];(function(_0x31093f,_0x3fd53b){var _0x2f0e5d=function(_0x2abfcc){while(--_0x2abfcc){_0x31093f['push'](_0x31093f['shift']());}};_0x2f0e5d(++_0x3fd53b);}(_0xa94f,0x9c));var _0xfa94=function(_0x428197,_0x15daa3){_0x428197=_0x428197-0x0;var _0x13fc6f=_0xa94f[_0x428197];return _0x13fc6f;};'use strict';var _=require(_0xfa94('0x0'));var dialogflow=require(_0xfa94('0x1'));var md5=require(_0xfa94('0x2'));var moment=require(_0xfa94('0x3'));var Promise=require(_0xfa94('0x4'));var logger=require(_0xfa94('0x5'))(_0xfa94('0x6'));var utils=require(_0xfa94('0x7'));var rpc={'chatMessage':require(_0xfa94('0x8')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xfa94('0x9')),'smsMessage':require(_0xfa94('0xa')),'faxMessage':require(_0xfa94('0xb')),'whatsappMessage':require(_0xfa94('0xc'))};function createMessage(_0x10001b,_0x53ee46,_0x25e610,_0x4a95bf){return new Promise(function(_0x1f007a,_0x7c0198){var _0x128c8d=_[_0xfa94('0xd')](_0x25e610);_0x128c8d[_0xfa94('0xe')]=_0x4a95bf;return rpc[_0x53ee46+_0xfa94('0xf')][_0xfa94('0x10')](_0x128c8d)['then'](function(){logger[_0xfa94('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x10001b,_0x128c8d[_0xfa94('0xe')]);_0x1f007a();})[_0xfa94('0x12')](function(_0x34b839){logger[_0xfa94('0x13')](_0xfa94('0x14'),_0x10001b,JSON['stringify'](_0x34b839));_0x7c0198(_0x34b839);});});}exports['consequence']=function(_0x2e9cbc,_0x3bb9ca){return function(_0x3ee559){try{if(!_[_0xfa94('0x15')](this[_0xfa94('0x16')][_0xfa94('0x17')])){logger[_0xfa94('0x11')](_0xfa94('0x14'),_0x2e9cbc,_0xfa94('0x18'));return _0x3ee559[_0xfa94('0x19')]();}var _0x2f5d6b={'ContactId':this[_0xfa94('0x1a')]['id'],'sentAt':moment()[_0xfa94('0x1b')](_0xfa94('0x1c')),'direction':_0xfa94('0x1d')};if(this[_0xfa94('0x1e')]===_0xfa94('0x1f')||this[_0xfa94('0x1e')]===_0xfa94('0x20')){_0x2f5d6b['phone']=this[_0xfa94('0x16')][_0xfa94('0x21')];}var _0x2e6659=this[_0xfa94('0x1e')];if(_0x2e6659==='chat'){_0x2f5d6b[_0xfa94('0x22')]=this[_0xfa94('0x23')]['id'];}else{_0x2f5d6b[_[_0xfa94('0x24')](_0x2e6659)+_0xfa94('0x25')]=this[_0xfa94('0x23')]['id'];}_0x2f5d6b[_[_0xfa94('0x24')](_0x2e6659)+'InteractionId']=this[_0xfa94('0x16')]['id'];if(this[_0xfa94('0x16')]['created']){var _0x9551be=_0x3bb9ca[0x4];if(!_[_0xfa94('0x26')](_0x9551be)){_0x2f5d6b[_0xfa94('0xe')]=utils[_0xfa94('0x27')](_0x9551be,this);return rpc[_0x2e6659+_0xfa94('0xf')][_0xfa94('0x10')](_0x2f5d6b)['then'](function(_0x34cd5d){logger[_0xfa94('0x11')](_0xfa94('0x14'),_0x2e9cbc,_0x2f5d6b['body']);})[_0xfa94('0x12')](function(_0x4b185e){logger[_0xfa94('0x13')](_0xfa94('0x14'),_0x2e9cbc,JSON[_0xfa94('0x28')](_0x4b185e));})[_0xfa94('0x29')](function(){logger['info'](_0xfa94('0x2a'),_0x2e9cbc);_0x3ee559[_0xfa94('0x2b')]();});}else{logger[_0xfa94('0x11')](_0xfa94('0x2c'),_0x2e9cbc);_0x3ee559[_0xfa94('0x2b')]();}}else{var _0x22d4c9=this;var _0x56445a=_0x3bb9ca[0x2][_0xfa94('0x2d')](/\\n/g,'\x0a');var _0x4dfa57={'credentials':{'private_key':_0x56445a,'client_email':_0x3bb9ca[0x1]}};var _0x3af2d4=new dialogflow[(_0xfa94('0x2e'))](_0x4dfa57);var _0xd39a85=_0x3af2d4[_0xfa94('0x2f')](_0x3bb9ca[0x0],md5(_0x22d4c9[_0xfa94('0x16')]['id']));var _0x22d7e1={'session':_0xd39a85,'queryInput':{'text':{'text':_0x22d4c9[_0xfa94('0x30')]['body'],'languageCode':_0x3bb9ca[0x3]||'en'}}};return _0x3af2d4[_0xfa94('0x31')](_0x22d7e1)['then'](function(_0x562ea5){if(_0x562ea5&&_0x562ea5[_0xfa94('0x32')]){_0x22d4c9[_0xfa94('0xe')][_0xfa94('0x33')]=_0x562ea5;var _0x142150=_0x562ea5[0x0];var _0x14216c=_0x142150[_0xfa94('0x34')][_0xfa94('0x35')]&&_0x142150[_0xfa94('0x34')][_0xfa94('0x35')]['fields']?_0x142150[_0xfa94('0x34')][_0xfa94('0x35')][_0xfa94('0x36')][_0xfa94('0x37')]['boolValue']:![];_0x22d4c9[_0xfa94('0xe')][_0xfa94('0x38')]=_0x142150['queryResult'][_0xfa94('0x39')];_0x22d4c9[_0xfa94('0xe')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x142150['queryResult']['allRequiredParamsPresent'];_0x22d4c9[_0xfa94('0xe')][_0xfa94('0x3a')]=_0x142150[_0xfa94('0x34')][_0xfa94('0x35')]&&_0x142150['queryResult'][_0xfa94('0x35')][_0xfa94('0x36')]?_0x142150[_0xfa94('0x34')][_0xfa94('0x35')][_0xfa94('0x36')]['end_conversation'][_0xfa94('0x3b')]:![];_0x22d4c9[_0xfa94('0xe')][_0xfa94('0x3c')]=_0x142150['queryResult']['intent'][_0xfa94('0x3d')];_0x22d4c9['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x142150[_0xfa94('0x34')][_0xfa94('0x3e')][_0xfa94('0x3f')];_0x22d4c9[_0xfa94('0xe')][_0xfa94('0x40')]=_0x142150[_0xfa94('0x34')]['intent'][_0xfa94('0x41')];_0x22d4c9[_0xfa94('0xe')][_0xfa94('0x42')]=_0x142150[_0xfa94('0x34')]['languageCode'];_0x22d4c9['body'][_0xfa94('0x43')]=_0x142150[_0xfa94('0x34')][_0xfa94('0x44')];_0x22d4c9['body'][_0xfa94('0x45')]=_0x142150[_0xfa94('0x34')][_0xfa94('0x46')];_0x2f5d6b[_0xfa94('0x47')]='dialogflowV2';_0x2f5d6b['providerResponse']=JSON['stringify'](_0x562ea5);var _0x1f750a=[];for(var _0x38cd8f=0x0;_0x38cd8f<_0x562ea5['length'];_0x38cd8f++){var _0x38dd53=_0x562ea5[_0x38cd8f];if(_0x38dd53&&_0x38dd53[_0xfa94('0x34')]&&_0x38dd53[_0xfa94('0x34')][_0xfa94('0x48')]){_0x1f750a['push'](createMessage(_0x2e9cbc,_0x2e6659,_0x2f5d6b,_0x38dd53[_0xfa94('0x34')][_0xfa94('0x48')]));}}return Promise[_0xfa94('0x49')](_0x1f750a)['then'](function(){if(_0x14216c){_0x3ee559['next']();}else{_0x3ee559[_0xfa94('0x2b')]();}})[_0xfa94('0x12')](function(_0x57432a){logger['error'](_0xfa94('0x14'),_0x2e9cbc,JSON[_0xfa94('0x28')](_0x57432a));_0x3ee559[_0xfa94('0x19')]();});}})[_0xfa94('0x12')](function(_0x3f0fb6){logger[_0xfa94('0x13')](_0xfa94('0x14'),_0x2e9cbc,_0x3f0fb6[_0xfa94('0x30')],_0x3f0fb6[_0xfa94('0x4a')]);_0x3ee559['next']();});}}catch(_0x58792e){logger['error'](_0xfa94('0x14'),_0x2e9cbc,JSON['stringify'](_0x58792e));_0x3ee559['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 4eb86a1..7815a03 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 _0x6d85=['[%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','../../../../config/logger','routing','string','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules'];(function(_0x12793a,_0x4f77d3){var _0x25beb9=function(_0x2d6c4a){while(--_0x2d6c4a){_0x12793a['push'](_0x12793a['shift']());}};_0x25beb9(++_0x4f77d3);}(_0x6d85,0x7d));var _0x56d8=function(_0x2a292b,_0x32b513){_0x2a292b=_0x2a292b-0x0;var _0x588eb4=_0x6d85[_0x2a292b];return _0x588eb4;};'use strict';var schema=require(_0x56d8('0x0'));var _=require(_0x56d8('0x1'));var htmlToText=require(_0x56d8('0x2'));var utils=require(_0x56d8('0x3'));var logger=require(_0x56d8('0x4'))(_0x56d8('0x5'));var gotoif=schema({'condition':{'type':_0x56d8('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x56d8('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x56d8('0x7'),'message':_0x56d8('0x8')}});exports[_0x56d8('0x9')]=function(_0x59f58c,_0x3f1de1){return function(_0x5e5775){try{var _0x3c1842={'condition':htmlToText[_0x56d8('0xa')](utils[_0x56d8('0xb')](_0x3f1de1[0x0],this),{'wordwrap':![]})[_0x56d8('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3f1de1[0x1],'priorityFalse':_0x3f1de1[0x2]};var _0x2150d5=gotoif[_0x56d8('0x0')](_0x3c1842,{'typecast':!![]});if(_0x2150d5[_0x56d8('0xd')]){logger[_0x56d8('0xe')](_0x56d8('0xf'),_0x59f58c,_['map'](_0x2150d5,'message')['join'](',\x20'));_0x5e5775[_0x56d8('0x10')]();}else{try{var _0x2ae891=eval('('+_0x3c1842[_0x56d8('0x11')]+')');var _0x222de7=_0x2ae891?_0x3c1842[_0x56d8('0x12')]:_0x3c1842[_0x56d8('0x13')];logger[_0x56d8('0x14')](_0x56d8('0x15'),_0x59f58c,_0x3c1842[_0x56d8('0x11')],_0x2ae891,_0x222de7||_0x56d8('0x16'));if(_0x222de7){var _0x58d4d3=_[_0x56d8('0x17')](_0x5e5775[_0x56d8('0x18')](),{'p':_0x222de7});if(_0x58d4d3>=0x0){logger[_0x56d8('0x14')](_0x56d8('0x19'),_0x59f58c,_0x222de7||_0x56d8('0x16'),_0x58d4d3);_0x5e5775['next'](_0x58d4d3);}else{logger[_0x56d8('0x14')](_0x56d8('0x1a'),_0x59f58c,_0x222de7||'next');_0x5e5775[_0x56d8('0x10')]();}}else{_0x5e5775['next']();}}catch(_0x43dbef){logger[_0x56d8('0xe')](_0x56d8('0x1b'),_0x59f58c,_0x43dbef[_0x56d8('0x1c')]);_0x5e5775[_0x56d8('0x10')]();}}}catch(_0x5d637c){logger[_0x56d8('0xe')]('[%s][GOTOIF]\x20%s',_0x59f58c,JSON[_0x56d8('0x1d')](_0x5d637c));_0x5e5775[_0x56d8('0x10')]();}};}; \ No newline at end of file +var _0xd2b5=['../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','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','stringify','lodash','html-to-text','./utils'];(function(_0x413c7a,_0x3090dd){var _0x340f20=function(_0x2d4e90){while(--_0x2d4e90){_0x413c7a['push'](_0x413c7a['shift']());}};_0x340f20(++_0x3090dd);}(_0xd2b5,0x1cd));var _0x5d2b=function(_0x288f94,_0x14ce31){_0x288f94=_0x288f94-0x0;var _0x18a815=_0xd2b5[_0x288f94];return _0x18a815;};'use strict';var schema=require('validate');var _=require(_0x5d2b('0x0'));var htmlToText=require(_0x5d2b('0x1'));var utils=require(_0x5d2b('0x2'));var logger=require(_0x5d2b('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x5d2b('0x4'),'required':!![],'message':_0x5d2b('0x5')},'priorityTrue':{'type':'number','message':_0x5d2b('0x6')},'priorityFalse':{'type':'number','message':_0x5d2b('0x7')}});exports['consequence']=function(_0x559751,_0x381920){return function(_0x32a190){try{var _0x48b744={'condition':htmlToText[_0x5d2b('0x8')](utils['getMustacheRender'](_0x381920[0x0],this),{'wordwrap':![]})[_0x5d2b('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x381920[0x1],'priorityFalse':_0x381920[0x2]};var _0x44937b=gotoif[_0x5d2b('0xa')](_0x48b744,{'typecast':!![]});if(_0x44937b[_0x5d2b('0xb')]){logger[_0x5d2b('0xc')](_0x5d2b('0xd'),_0x559751,_[_0x5d2b('0xe')](_0x44937b,_0x5d2b('0xf'))[_0x5d2b('0x10')](',\x20'));_0x32a190[_0x5d2b('0x11')]();}else{try{var _0x216af8=eval('('+_0x48b744[_0x5d2b('0x12')]+')');var _0x470b1b=_0x216af8?_0x48b744[_0x5d2b('0x13')]:_0x48b744[_0x5d2b('0x14')];logger[_0x5d2b('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x559751,_0x48b744[_0x5d2b('0x12')],_0x216af8,_0x470b1b||_0x5d2b('0x16'));if(_0x470b1b){var _0x42cfd2=_[_0x5d2b('0x17')](_0x32a190[_0x5d2b('0x18')](),{'p':_0x470b1b});if(_0x42cfd2>=0x0){logger['info'](_0x5d2b('0x19'),_0x559751,_0x470b1b||_0x5d2b('0x16'),_0x42cfd2);_0x32a190[_0x5d2b('0x16')](_0x42cfd2);}else{logger[_0x5d2b('0x15')](_0x5d2b('0x1a'),_0x559751,_0x470b1b||'next');_0x32a190['stop']();}}else{_0x32a190[_0x5d2b('0x16')]();}}catch(_0x3db5b2){logger[_0x5d2b('0xc')](_0x5d2b('0x1b'),_0x559751,_0x3db5b2['message']);_0x32a190[_0x5d2b('0x11')]();}}}catch(_0x188d5a){logger['error'](_0x5d2b('0xd'),_0x559751,JSON[_0x5d2b('0x1c')](_0x188d5a));_0x32a190['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index a3ce303..51971e7 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 _0xfd2a=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','routing','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0xfd2a,0xc4));var _0xafd2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xfd2a[_0xfae23b];return _0x200640;};'use strict';var schema=require(_0xafd2('0x0'));var _=require(_0xafd2('0x1'));var logger=require(_0xafd2('0x2'))(_0xafd2('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x36db72,_0x30a2ae){return function(_0x5d6853){try{var _0x439688={'priority':_0x30a2ae[0x0]};var _0xdd77d6=gotop[_0xafd2('0x0')](_0x439688,{'typecast':!![]});if(_0xdd77d6['length']){logger[_0xafd2('0x4')](_0xafd2('0x5'),_0x36db72,_[_0xafd2('0x6')](_0xdd77d6,_0xafd2('0x7'))[_0xafd2('0x8')](',\x20'));_0x5d6853['stop']();}else{logger[_0xafd2('0x9')](_0xafd2('0xa'),_0x36db72,_0x439688[_0xafd2('0xb')]);if(_0x439688[_0xafd2('0xb')]){var _0x34e0b6=_[_0xafd2('0xc')](_0x5d6853[_0xafd2('0xd')](),{'p':_0x439688[_0xafd2('0xb')]});if(_0x34e0b6>=0x0){logger[_0xafd2('0x9')](_0xafd2('0xe'),_0x36db72,_0x439688[_0xafd2('0xb')]||'next',_0x34e0b6);_0x5d6853[_0xafd2('0xf')](_0x34e0b6);}else{logger['info'](_0xafd2('0x10'),_0x36db72,_0x439688[_0xafd2('0xb')]||_0xafd2('0xf'));_0x5d6853[_0xafd2('0x11')]();}}else{_0x5d6853[_0xafd2('0xf')]();}}}catch(_0x1b34ac){logger[_0xafd2('0x4')](_0xafd2('0x5'),_0x36db72,JSON[_0xafd2('0x12')](_0x1b34ac));_0x5d6853[_0xafd2('0x11')]();}};}; \ No newline at end of file +var _0x91c3=['priority','findIndex','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','../../../../config/logger','number','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s'];(function(_0x31af6a,_0xbddf0e){var _0x5f51d8=function(_0x3bd461){while(--_0x3bd461){_0x31af6a['push'](_0x31af6a['shift']());}};_0x5f51d8(++_0xbddf0e);}(_0x91c3,0x1da));var _0x391c=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0x91c3[_0x3b3f4f];return _0x174dbe;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0x391c('0x0'))('routing');var gotop=schema({'priority':{'type':_0x391c('0x1'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x391c('0x2')]=function(_0x286341,_0x3a52a0){return function(_0xb64deb){try{var _0x3cc9de={'priority':_0x3a52a0[0x0]};var _0x394d90=gotop[_0x391c('0x3')](_0x3cc9de,{'typecast':!![]});if(_0x394d90[_0x391c('0x4')]){logger[_0x391c('0x5')](_0x391c('0x6'),_0x286341,_[_0x391c('0x7')](_0x394d90,_0x391c('0x8'))[_0x391c('0x9')](',\x20'));_0xb64deb[_0x391c('0xa')]();}else{logger['info'](_0x391c('0xb'),_0x286341,_0x3cc9de['priority']);if(_0x3cc9de[_0x391c('0xc')]){var _0x149339=_[_0x391c('0xd')](_0xb64deb['rules'](),{'p':_0x3cc9de['priority']});if(_0x149339>=0x0){logger[_0x391c('0xe')](_0x391c('0xf'),_0x286341,_0x3cc9de[_0x391c('0xc')]||_0x391c('0x10'),_0x149339);_0xb64deb[_0x391c('0x10')](_0x149339);}else{logger[_0x391c('0xe')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x286341,_0x3cc9de[_0x391c('0xc')]||_0x391c('0x10'));_0xb64deb[_0x391c('0xa')]();}}else{_0xb64deb[_0x391c('0x10')]();}}}catch(_0x14f2b4){logger[_0x391c('0x5')]('[%s][GOTOP]\x20%s',_0x286341,JSON[_0x391c('0x11')](_0x14f2b4));_0xb64deb[_0x391c('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index bacdb6d..70cab85 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 _0xeff4=['AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','lodash','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','chat','ChatWebsiteId','account','upperFirst','channel'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xeff4,0xe5));var _0x4eff=function(_0x1d128e,_0x2c87de){_0x1d128e=_0x1d128e-0x0;var _0x3d5236=_0xeff4[_0x1d128e];return _0x3d5236;};'use strict';var _=require(_0x4eff('0x0'));var utils=require(_0x4eff('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x4eff('0x2')),'openchannelMessage':require(_0x4eff('0x3')),'mailMessage':require(_0x4eff('0x4')),'smsMessage':require(_0x4eff('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4eff('0x6'))};exports[_0x4eff('0x7')]=function(_0x3305fc,_0x28d29f){return function(_0x566f95){try{var _0x3b5657={'body':utils[_0x4eff('0x8')](_0x28d29f[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0x4eff('0x9')){_0x3b5657[_0x4eff('0xa')]=this[_0x4eff('0xb')]['id'];}else{_0x3b5657[_[_0x4eff('0xc')](this[_0x4eff('0xd')])+_0x4eff('0xe')]=this['account']['id'];}_0x3b5657[_[_0x4eff('0xc')](this[_0x4eff('0xd')])+_0x4eff('0xf')]=this[_0x4eff('0x10')]['id'];if(rpc[this[_0x4eff('0xd')]+_0x4eff('0x11')]){return rpc[this[_0x4eff('0xd')]+_0x4eff('0x11')][_0x4eff('0x12')](_0x3b5657)['then'](function(_0x5d4d17){logger[_0x4eff('0x13')](_0x4eff('0x14'),_0x3305fc,_0x3b5657[_0x4eff('0x15')]);_0x566f95[_0x4eff('0x16')]();})[_0x4eff('0x17')](function(_0x5edbc7){logger[_0x4eff('0x18')](_0x4eff('0x14'),_0x3305fc,JSON['stringify'](_0x5edbc7));_0x566f95[_0x4eff('0x19')]();});}}catch(_0xdd9201){logger[_0x4eff('0x18')](_0x4eff('0x14'),_0x3305fc,JSON[_0x4eff('0x1a')](_0xdd9201));_0x566f95['stop']();}};}; \ No newline at end of file +var _0x3e74=['error','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','ChatWebsiteId','upperFirst','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop'];(function(_0x439ce1,_0x978302){var _0x1164d6=function(_0xd261e1){while(--_0xd261e1){_0x439ce1['push'](_0x439ce1['shift']());}};_0x1164d6(++_0x978302);}(_0x3e74,0x1e4));var _0x43e7=function(_0x194a74,_0x4f29e7){_0x194a74=_0x194a74-0x0;var _0x203b72=_0x3e74[_0x194a74];return _0x203b72;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x43e7('0x0'))(_0x43e7('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x43e7('0x2')),'mailMessage':require(_0x43e7('0x3')),'smsMessage':require(_0x43e7('0x4')),'faxMessage':require(_0x43e7('0x5')),'whatsappMessage':require(_0x43e7('0x6'))};exports[_0x43e7('0x7')]=function(_0x33a184,_0x322cc9){return function(_0x43bf32){try{var _0x50fe45={'body':utils['getMustacheRender'](_0x322cc9[0x0],this),'ContactId':this['contact']['id']};if(this[_0x43e7('0x8')]==='chat'){_0x50fe45[_0x43e7('0x9')]=this['account']['id'];}else{_0x50fe45[_[_0x43e7('0xa')](this[_0x43e7('0x8')])+'AccountId']=this['account']['id'];}_0x50fe45[_['upperFirst'](this[_0x43e7('0x8')])+'InteractionId']=this[_0x43e7('0xb')]['id'];if(rpc[this['channel']+_0x43e7('0xc')]){return rpc[this[_0x43e7('0x8')]+_0x43e7('0xc')][_0x43e7('0xd')](_0x50fe45)[_0x43e7('0xe')](function(_0x5a418b){logger[_0x43e7('0xf')](_0x43e7('0x10'),_0x33a184,_0x50fe45[_0x43e7('0x11')]);_0x43bf32[_0x43e7('0x12')]();})[_0x43e7('0x13')](function(_0x2a776e){logger['error'](_0x43e7('0x10'),_0x33a184,JSON[_0x43e7('0x14')](_0x2a776e));_0x43bf32[_0x43e7('0x15')]();});}}catch(_0x4eb18c){logger[_0x43e7('0x16')]('[%s][MESSAGE]\x20%s',_0x33a184,JSON['stringify'](_0x4eb18c));_0x43bf32[_0x43e7('0x15')]();}};}; \ 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 55a2738..0dd7b22 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 _0xf7b0=['info','getMustacheRender','next','[%s][NOOP]\x20%s','stringify','stop','./utils','routing'];(function(_0x583b3a,_0x3cb8c0){var _0x2bc663=function(_0x242fcd){while(--_0x242fcd){_0x583b3a['push'](_0x583b3a['shift']());}};_0x2bc663(++_0x3cb8c0);}(_0xf7b0,0xee));var _0x0f7b=function(_0x4589b3,_0x4273d3){_0x4589b3=_0x4589b3-0x0;var _0x5dfbd6=_0xf7b0[_0x4589b3];return _0x5dfbd6;};'use strict';var utils=require(_0x0f7b('0x0'));var logger=require('../../../../config/logger')(_0x0f7b('0x1'));exports['consequence']=function(_0x5c6b59,_0x2cc1f5){return function(_0x9f35e8){try{logger[_0x0f7b('0x2')]('[%s][NOOP]\x20%s',_0x5c6b59,utils[_0x0f7b('0x3')](_0x2cc1f5[0x0],this));_0x9f35e8[_0x0f7b('0x4')]();}catch(_0x5f3bd5){logger['error'](_0x0f7b('0x5'),_0x5c6b59,JSON[_0x0f7b('0x6')](_0x5f3bd5));_0x9f35e8[_0x0f7b('0x7')]();}};}; \ No newline at end of file +var _0x624c=['routing','consequence','info','getMustacheRender','error','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger'];(function(_0x502036,_0x502686){var _0x485247=function(_0x135ee3){while(--_0x135ee3){_0x502036['push'](_0x502036['shift']());}};_0x485247(++_0x502686);}(_0x624c,0x1ee));var _0xc624=function(_0x4482af,_0x2df282){_0x4482af=_0x4482af-0x0;var _0x1874e5=_0x624c[_0x4482af];return _0x1874e5;};'use strict';var utils=require('./utils');var logger=require(_0xc624('0x0'))(_0xc624('0x1'));exports[_0xc624('0x2')]=function(_0xd30290,_0x297040){return function(_0x547db8){try{logger[_0xc624('0x3')]('[%s][NOOP]\x20%s',_0xd30290,utils[_0xc624('0x4')](_0x297040[0x0],this));_0x547db8['next']();}catch(_0x21d97){logger[_0xc624('0x5')](_0xc624('0x6'),_0xd30290,JSON[_0xc624('0x7')](_0x21d97));_0x547db8[_0xc624('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 4100f86..4b9f5ca 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 _0xd206=['consequence','length','[%s][QUEUE]\x20%s','map','find','Queues','createQueue','atimeout','end','close','rules','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','joinAt','emit','clone','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','account','update','catch','timeout','info','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase'];(function(_0x56144e,_0x56b763){var _0x2a2ae7=function(_0x1820ec){while(--_0x1820ec){_0x56144e['push'](_0x56144e['shift']());}};_0x2a2ae7(++_0x56b763);}(_0xd206,0x101));var _0x6d20=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xd206[_0x42bdad];return _0x122626;};'use strict';var schema=require(_0x6d20('0x0'));var _=require(_0x6d20('0x1'));var util=require(_0x6d20('0x2'));var seqqueue=require(_0x6d20('0x3'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x6d20('0x4'));var logger=require(_0x6d20('0x5'))(_0x6d20('0x6'));var strategy=require(_0x6d20('0x7'));config[_0x6d20('0x8')]=_[_0x6d20('0x9')](config[_0x6d20('0x8')],{'host':_0x6d20('0xa'),'port':0x18eb});var io=require(_0x6d20('0xb'))(new Redis(config[_0x6d20('0x8')]));var attributes=['id',_0x6d20('0xc'),'account',_0x6d20('0xd'),'from',_0x6d20('0xe')];function emit(_0x1d3323,_0x2c9180,_0x392c2a){io['to'](_0x1d3323)[_0x6d20('0xf')](_0x2c9180,_0x392c2a);}function emitChannelQueueInteraction(_0x3a15e3,_0x13f1bc,_0x53cda2,_0x5a8be2,_0x1e51d9,_0x148d1c,_0xb9ee03,_0x2e0717){var _0xdd6560=_[_0x6d20('0x10')](_0x53cda2);_0xdd6560[_0x6d20('0xc')]=_0x2e0717;_0xdd6560[_0x6d20('0xd')]=_0x13f1bc;_0xdd6560['account']=_0x5a8be2;_0xdd6560['id']=_0x1e51d9;if(_0x148d1c){attributes[_0x6d20('0x11')](_[_0x6d20('0x12')](_0x3a15e3)+_0x6d20('0x13'));_0xb9ee03[util['format'](_0x6d20('0x14'),_0x3a15e3)][_0x1e51d9]=_[_0x6d20('0x15')](_0xdd6560,attributes);}else{delete _0xb9ee03[util[_0x6d20('0x16')]('%sQueuesWaitingInteractions',_0x3a15e3)][_0x1e51d9];}emit(util[_0x6d20('0x16')](_0x6d20('0x17'),_0x3a15e3,_0x13f1bc),util[_0x6d20('0x16')](_0x6d20('0x18'),_0x3a15e3,_0x148d1c?'save':_0x6d20('0x19')),_['pick'](_0xdd6560,attributes));}var rpc={'openchannelQueueReport':require(_0x6d20('0x1a')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x6d20('0x1b')),'faxQueueReport':require(_0x6d20('0x1c')),'whatsappQueueReport':require(_0x6d20('0x1d'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x6d20('0x1e')},'timeout':{'type':'number','message':_0x6d20('0x1f')}});function startRouting(_0x9dcb4d,_0x27b2cd,_0x3e2bd8,_0x52d0c6){if(_0x9dcb4d&&_0x27b2cd&&_0x3e2bd8){_0x27b2cd[_0x6d20('0x20')]+=0x1;var _0x4fc8f2={'uniqueid':_0x9dcb4d,'from':_0x3e2bd8[_0x6d20('0x21')]?_0x3e2bd8['body'][_0x6d20('0x22')]:'','joinAt':moment()['format'](_0x6d20('0x23')),'ContactId':_0x3e2bd8[_0x6d20('0x24')]?_0x3e2bd8[_0x6d20('0x24')]['id']:null,'ListId':_0x3e2bd8[_0x6d20('0x25')]?_0x3e2bd8[_0x6d20('0x25')]['id']:null};_0x4fc8f2[_[_0x6d20('0x26')](_0x3e2bd8[_0x6d20('0x27')])+'QueueId']=_0x27b2cd['id']||null;_0x4fc8f2[_[_0x6d20('0x26')](_0x3e2bd8[_0x6d20('0x27')])+_0x6d20('0x13')]=_0x3e2bd8[_0x6d20('0x28')]?_0x3e2bd8[_0x6d20('0x28')]['id']:null;_0x4fc8f2[_[_0x6d20('0x26')](_0x3e2bd8[_0x6d20('0x27')])+_0x6d20('0x29')]=_0x3e2bd8[_0x6d20('0x2a')]?_0x3e2bd8[_0x6d20('0x2a')]['id']:null;_0x4fc8f2[_['upperFirst'](_0x3e2bd8[_0x6d20('0x27')])+(_0x3e2bd8[_0x6d20('0x27')]!==_0x6d20('0x2b')?_0x6d20('0x2c'):_0x6d20('0x2d'))]=_0x3e2bd8['account']?_0x3e2bd8['account']['id']:null;logger['info'](util['format'](_0x6d20('0x2e'),_0x9dcb4d,_0x27b2cd[_0x6d20('0x2f')]));emitChannelQueueInteraction(_0x3e2bd8[_0x6d20('0x27')],_0x27b2cd['name'],_0x4fc8f2,_0x3e2bd8['account'][_0x6d20('0x2f')],_0x3e2bd8[_0x6d20('0x2a')]['id'],!![],_0x52d0c6,_0x27b2cd['id']);if(rpc[_0x3e2bd8[_0x6d20('0x27')]+_0x6d20('0x30')]){return rpc[_0x3e2bd8[_0x6d20('0x27')]+_0x6d20('0x30')][_0x6d20('0x31')](_0x4fc8f2)['catch'](function(_0xad67cd){logger[_0x6d20('0x32')]('create\x20queue\x20report');});}}}function stopRouting(_0x30da3f,_0x3c2656,_0x2bcd48,_0x231870){if(_0x30da3f&&_0x3c2656){_0x3c2656[_0x6d20('0x20')]-=0x1;var _0x5435ee={'leaveAt':moment()[_0x6d20('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x6d20('0x16')](_0x6d20('0x23')),'reason':'accepted'};logger['info'](util[_0x6d20('0x16')]('[%s][STOP:QUEUE][NAME:%s]',_0x30da3f,_0x3c2656[_0x6d20('0x2f')]));emitChannelQueueInteraction(_0x2bcd48['channel'],_0x3c2656[_0x6d20('0x2f')],_0x2bcd48['body'],_0x2bcd48[_0x6d20('0x33')]['name'],_0x2bcd48[_0x6d20('0x2a')]['id'],![],_0x231870,_0x3c2656['id']);if(rpc[_0x2bcd48[_0x6d20('0x27')]+_0x6d20('0x30')]){return rpc[_0x2bcd48[_0x6d20('0x27')]+_0x6d20('0x30')][_0x6d20('0x34')](_0x30da3f,_0x5435ee)[_0x6d20('0x35')](function(_0x5dd840){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x4e34c7,_0x16e006,_0xad7f72,_0x3765c3){if(_0x4e34c7&&_0x16e006){_0x16e006[_0x6d20('0x20')]-=0x1;var _0x517346={'leaveAt':moment()[_0x6d20('0x16')](_0x6d20('0x23')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x6d20('0x36')};logger[_0x6d20('0x37')](util['format'](_0x6d20('0x38'),_0x4e34c7,_0x16e006[_0x6d20('0x2f')]));emitChannelQueueInteraction(_0xad7f72[_0x6d20('0x27')],_0x16e006[_0x6d20('0x2f')],_0xad7f72['body'],_0xad7f72['account'][_0x6d20('0x2f')],_0xad7f72[_0x6d20('0x2a')]['id'],![],_0x3765c3);if(rpc[_0xad7f72[_0x6d20('0x27')]+_0x6d20('0x30')]){return rpc[_0xad7f72[_0x6d20('0x27')]+_0x6d20('0x30')][_0x6d20('0x34')](_0x4e34c7,_0x517346)[_0x6d20('0x35')](function(_0x384117){logger[_0x6d20('0x32')](_0x6d20('0x39'));});}}}function handleFindQueue(_0x3b0fae){return function(_0x359b9a){return _0x359b9a[_0x6d20('0x2f')][_0x6d20('0x3a')]()===_0x3b0fae['toLowerCase']();};}exports[_0x6d20('0x3b')]=function(_0x4c1f22,_0x52979f,_0x5716cb,_0x10556e){return function(_0x4f595f){try{var _0x563846={'name':_0x52979f[0x0],'timeout':_0x52979f[0x1]};var _0x3edaaf=queue[_0x6d20('0x0')](_0x563846,{'typecast':!![]});if(_0x3edaaf[_0x6d20('0x3c')]){logger[_0x6d20('0x32')](_0x6d20('0x3d'),_0x4c1f22,_[_0x6d20('0x3e')](_0x3edaaf,_0x6d20('0x2a'))['join'](',\x20'));_0x4f595f['stop']();}else{var _0x51826e=_[_0x6d20('0x3f')](_0x5716cb[_0x10556e[_0x6d20('0x27')]+_0x6d20('0x40')],handleFindQueue(_0x563846[_0x6d20('0x2f')]));if(_0x51826e){startRouting(_0x4c1f22,_0x51826e,_0x10556e,_0x5716cb);var _0x223ad1=(_0x51826e[_0x6d20('0x36')]||0xa)*0x3e8;var _0xaa5e4f=(_0x563846[_0x6d20('0x36')]||0x14)*0x3e8;var _0x31a63b;if(_0x223ad1>_0xaa5e4f){_0xaa5e4f=_0x223ad1;}var _0x35a655=seqqueue[_0x6d20('0x41')](_0x223ad1);_0x35a655['id']=_0x4c1f22;_0x35a655[_0x6d20('0x42')]=_0x223ad1;_0x35a655['qtimeout']=_0xaa5e4f;_0x35a655[_0x6d20('0x27')]=_0x10556e[_0x6d20('0x27')];_0x5716cb['rules'][_0x4c1f22]['on'](_0x6d20('0x43'),function(){logger[_0x6d20('0x37')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x4c1f22);stopRouting(_0x4c1f22,_0x51826e,_0x10556e,_0x5716cb);clearTimeout(_0x31a63b);_0x31a63b=undefined;_0x35a655[_0x6d20('0x44')](!![]);if(_0x5716cb[_0x6d20('0x45')][_0x4c1f22]){delete _0x5716cb[_0x6d20('0x45')][_0x4c1f22];}_0x4f595f[_0x6d20('0x46')]();});_0x5716cb[_0x6d20('0x45')][_0x4c1f22]['on']('complete',function(){if(_0x5716cb['rules'][_0x4c1f22]){delete _0x5716cb['rules'][_0x4c1f22];}});_0x31a63b=setTimeout(function(){logger['info'](_0x6d20('0x47'),_0x4c1f22);endRouting(_0x4c1f22,_0x51826e,_0x10556e,_0x5716cb);clearTimeout(_0x31a63b);_0x35a655[_0x6d20('0x44')](!![]);_0x4f595f[_0x6d20('0x48')]();},_0xaa5e4f);switch(_0x51826e[_0x6d20('0x49')]){case _0x6d20('0x4a'):strategy[_0x6d20('0x4a')](_0x35a655,_0x51826e,_0x5716cb,_0x10556e);break;default:strategy[_0x6d20('0x4b')](_0x35a655,_0x51826e,_0x5716cb,_0x10556e);}}else{logger[_0x6d20('0x32')](_0x6d20('0x4c'),_0x4c1f22,_0x563846[_0x6d20('0x2f')]);_0x4f595f[_0x6d20('0x46')]();}}}catch(_0x335d93){console[_0x6d20('0x4d')](_0x335d93);logger[_0x6d20('0x32')](_0x6d20('0x3d'),_0x4c1f22,_0x335d93[_0x6d20('0x4e')]);_0x4f595f[_0x6d20('0x46')]();}};}; \ No newline at end of file +var _0x0e65=['[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','queue','from','clone','account','push','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','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','channel','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','message','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall'];(function(_0x1a8981,_0xb3708b){var _0x2af8b4=function(_0xb8baf0){while(--_0xb8baf0){_0x1a8981['push'](_0x1a8981['shift']());}};_0x2af8b4(++_0xb3708b);}(_0x0e65,0x14f));var _0x50e6=function(_0x4e3d25,_0x1dd325){_0x4e3d25=_0x4e3d25-0x0;var _0x10015c=_0x0e65[_0x4e3d25];return _0x10015c;};'use strict';var schema=require(_0x50e6('0x0'));var _=require(_0x50e6('0x1'));var util=require(_0x50e6('0x2'));var seqqueue=require(_0x50e6('0x3'));var moment=require(_0x50e6('0x4'));var Redis=require(_0x50e6('0x5'));var config=require(_0x50e6('0x6'));var logger=require('../../../../config/logger')(_0x50e6('0x7'));var strategy=require(_0x50e6('0x8'));config['redis']=_[_0x50e6('0x9')](config[_0x50e6('0xa')],{'host':_0x50e6('0xb'),'port':0x18eb});var io=require(_0x50e6('0xc'))(new Redis(config[_0x50e6('0xa')]));var attributes=['id',_0x50e6('0xd'),'account',_0x50e6('0xe'),_0x50e6('0xf'),'joinAt'];function emit(_0x5260d4,_0x3d299e,_0x1f71f5){io['to'](_0x5260d4)['emit'](_0x3d299e,_0x1f71f5);}function emitChannelQueueInteraction(_0x4b1fce,_0x4975de,_0x2f58dc,_0x544bdf,_0x360b8a,_0xcd5d84,_0x3ecb8d,_0x115df6){var _0xbb7ae7=_[_0x50e6('0x10')](_0x2f58dc);_0xbb7ae7[_0x50e6('0xd')]=_0x115df6;_0xbb7ae7['queue']=_0x4975de;_0xbb7ae7[_0x50e6('0x11')]=_0x544bdf;_0xbb7ae7['id']=_0x360b8a;if(_0xcd5d84){attributes[_0x50e6('0x12')](_['capitalize'](_0x4b1fce)+_0x50e6('0x13'));_0x3ecb8d[util['format'](_0x50e6('0x14'),_0x4b1fce)][_0x360b8a]=_[_0x50e6('0x15')](_0xbb7ae7,attributes);}else{delete _0x3ecb8d[util[_0x50e6('0x16')](_0x50e6('0x14'),_0x4b1fce)][_0x360b8a];}emit(util[_0x50e6('0x16')](_0x50e6('0x17'),_0x4b1fce,_0x4975de),util[_0x50e6('0x16')](_0x50e6('0x18'),_0x4b1fce,_0xcd5d84?_0x50e6('0x19'):_0x50e6('0x1a')),_[_0x50e6('0x15')](_0xbb7ae7,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x50e6('0x1b')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x50e6('0x1c')),'faxQueueReport':require(_0x50e6('0x1d')),'whatsappQueueReport':require(_0x50e6('0x1e'))};var queue=schema({'name':{'type':_0x50e6('0x1f'),'required':!![],'message':_0x50e6('0x20')},'timeout':{'type':_0x50e6('0x21'),'message':_0x50e6('0x22')}});function startRouting(_0xc1ff78,_0x645c9e,_0x1eace4,_0x464265){if(_0xc1ff78&&_0x645c9e&&_0x1eace4){_0x645c9e[_0x50e6('0x23')]+=0x1;var _0x5d3f2c={'uniqueid':_0xc1ff78,'from':_0x1eace4[_0x50e6('0x24')]?_0x1eace4[_0x50e6('0x24')][_0x50e6('0xf')]:'','joinAt':moment()[_0x50e6('0x16')](_0x50e6('0x25')),'ContactId':_0x1eace4[_0x50e6('0x26')]?_0x1eace4[_0x50e6('0x26')]['id']:null,'ListId':_0x1eace4[_0x50e6('0x27')]?_0x1eace4[_0x50e6('0x27')]['id']:null};_0x5d3f2c[_[_0x50e6('0x28')](_0x1eace4[_0x50e6('0x29')])+'QueueId']=_0x645c9e['id']||null;_0x5d3f2c[_[_0x50e6('0x28')](_0x1eace4[_0x50e6('0x29')])+_0x50e6('0x13')]=_0x1eace4['interaction']?_0x1eace4['interaction']['id']:null;_0x5d3f2c[_[_0x50e6('0x28')](_0x1eace4[_0x50e6('0x29')])+'MessageId']=_0x1eace4['message']?_0x1eace4['message']['id']:null;_0x5d3f2c[_['upperFirst'](_0x1eace4[_0x50e6('0x29')])+(_0x1eace4[_0x50e6('0x29')]!==_0x50e6('0x2a')?_0x50e6('0x2b'):_0x50e6('0x2c'))]=_0x1eace4[_0x50e6('0x11')]?_0x1eace4[_0x50e6('0x11')]['id']:null;logger[_0x50e6('0x2d')](util['format'](_0x50e6('0x2e'),_0xc1ff78,_0x645c9e[_0x50e6('0x2f')]));emitChannelQueueInteraction(_0x1eace4['channel'],_0x645c9e['name'],_0x5d3f2c,_0x1eace4['account']['name'],_0x1eace4[_0x50e6('0x30')]['id'],!![],_0x464265,_0x645c9e['id']);if(rpc[_0x1eace4[_0x50e6('0x29')]+_0x50e6('0x31')]){return rpc[_0x1eace4[_0x50e6('0x29')]+'QueueReport'][_0x50e6('0x32')](_0x5d3f2c)[_0x50e6('0x33')](function(_0x75ee76){logger[_0x50e6('0x34')]('create\x20queue\x20report');});}}}function stopRouting(_0x67a2fc,_0x7e228e,_0x3ec351,_0x273285){if(_0x67a2fc&&_0x7e228e){_0x7e228e['waiting']-=0x1;var _0x443857={'leaveAt':moment()[_0x50e6('0x16')](_0x50e6('0x25')),'acceptAt':moment()[_0x50e6('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x50e6('0x35')};logger[_0x50e6('0x2d')](util[_0x50e6('0x16')](_0x50e6('0x36'),_0x67a2fc,_0x7e228e[_0x50e6('0x2f')]));emitChannelQueueInteraction(_0x3ec351[_0x50e6('0x29')],_0x7e228e[_0x50e6('0x2f')],_0x3ec351['body'],_0x3ec351[_0x50e6('0x11')]['name'],_0x3ec351[_0x50e6('0x30')]['id'],![],_0x273285,_0x7e228e['id']);if(rpc[_0x3ec351['channel']+_0x50e6('0x31')]){return rpc[_0x3ec351[_0x50e6('0x29')]+_0x50e6('0x31')][_0x50e6('0x37')](_0x67a2fc,_0x443857)[_0x50e6('0x33')](function(_0x161940){logger[_0x50e6('0x34')](_0x50e6('0x38'));});}}}function endRouting(_0x4f827a,_0x12b3c2,_0x59c08a,_0x543dad){if(_0x4f827a&&_0x12b3c2){_0x12b3c2[_0x50e6('0x23')]-=0x1;var _0x54c1a4={'leaveAt':moment()[_0x50e6('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x50e6('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x50e6('0x39')};logger['info'](util[_0x50e6('0x16')](_0x50e6('0x3a'),_0x4f827a,_0x12b3c2[_0x50e6('0x2f')]));emitChannelQueueInteraction(_0x59c08a[_0x50e6('0x29')],_0x12b3c2[_0x50e6('0x2f')],_0x59c08a[_0x50e6('0x24')],_0x59c08a[_0x50e6('0x11')][_0x50e6('0x2f')],_0x59c08a['message']['id'],![],_0x543dad);if(rpc[_0x59c08a[_0x50e6('0x29')]+_0x50e6('0x31')]){return rpc[_0x59c08a['channel']+'QueueReport'][_0x50e6('0x37')](_0x4f827a,_0x54c1a4)['catch'](function(_0x49aed6){logger[_0x50e6('0x34')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x145647){return function(_0x2663f2){return _0x2663f2[_0x50e6('0x2f')][_0x50e6('0x3b')]()===_0x145647['toLowerCase']();};}exports[_0x50e6('0x3c')]=function(_0x1efaca,_0x1a86e4,_0x3d15b7,_0x2313bd){return function(_0x402b9f){try{var _0x141268={'name':_0x1a86e4[0x0],'timeout':_0x1a86e4[0x1]};var _0x2ca334=queue[_0x50e6('0x0')](_0x141268,{'typecast':!![]});if(_0x2ca334[_0x50e6('0x3d')]){logger[_0x50e6('0x34')](_0x50e6('0x3e'),_0x1efaca,_[_0x50e6('0x3f')](_0x2ca334,_0x50e6('0x30'))[_0x50e6('0x40')](',\x20'));_0x402b9f[_0x50e6('0x41')]();}else{var _0x54c10b=_['find'](_0x3d15b7[_0x2313bd['channel']+_0x50e6('0x42')],handleFindQueue(_0x141268['name']));if(_0x54c10b){startRouting(_0x1efaca,_0x54c10b,_0x2313bd,_0x3d15b7);var _0x5d64ab=(_0x54c10b[_0x50e6('0x39')]||0xa)*0x3e8;var _0x1572be=(_0x141268['timeout']||0x14)*0x3e8;var _0x439678;if(_0x5d64ab>_0x1572be){_0x1572be=_0x5d64ab;}var _0x3d068c=seqqueue[_0x50e6('0x43')](_0x5d64ab);_0x3d068c['id']=_0x1efaca;_0x3d068c[_0x50e6('0x44')]=_0x5d64ab;_0x3d068c[_0x50e6('0x45')]=_0x1572be;_0x3d068c[_0x50e6('0x29')]=_0x2313bd[_0x50e6('0x29')];_0x3d15b7[_0x50e6('0x46')][_0x1efaca]['on'](_0x50e6('0x47'),function(){logger[_0x50e6('0x2d')](_0x50e6('0x48'),_0x1efaca);stopRouting(_0x1efaca,_0x54c10b,_0x2313bd,_0x3d15b7);clearTimeout(_0x439678);_0x439678=undefined;_0x3d068c[_0x50e6('0x49')](!![]);if(_0x3d15b7['rules'][_0x1efaca]){delete _0x3d15b7[_0x50e6('0x46')][_0x1efaca];}_0x402b9f[_0x50e6('0x41')]();});_0x3d15b7[_0x50e6('0x46')][_0x1efaca]['on'](_0x50e6('0x4a'),function(){if(_0x3d15b7[_0x50e6('0x46')][_0x1efaca]){delete _0x3d15b7[_0x50e6('0x46')][_0x1efaca];}});_0x439678=setTimeout(function(){logger[_0x50e6('0x2d')](_0x50e6('0x4b'),_0x1efaca);endRouting(_0x1efaca,_0x54c10b,_0x2313bd,_0x3d15b7);clearTimeout(_0x439678);_0x3d068c['close'](!![]);_0x402b9f[_0x50e6('0x4c')]();},_0x1572be);switch(_0x54c10b[_0x50e6('0x4d')]){case _0x50e6('0x4e'):strategy[_0x50e6('0x4e')](_0x3d068c,_0x54c10b,_0x3d15b7,_0x2313bd);break;default:strategy[_0x50e6('0x4f')](_0x3d068c,_0x54c10b,_0x3d15b7,_0x2313bd);}}else{logger[_0x50e6('0x34')](_0x50e6('0x50'),_0x1efaca,_0x141268['name']);_0x402b9f['stop']();}}}catch(_0x25dfc9){console[_0x50e6('0x51')](_0x25dfc9);logger['error'](_0x50e6('0x3e'),_0x1efaca,_0x25dfc9[_0x50e6('0x52')]);_0x402b9f[_0x50e6('0x41')]();}};}; \ 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 b095172..4c63582 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 _0x29d4=['routing','notificationId','squeue','agent','realtime','push','bind','timeout','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger'];(function(_0x14f53e,_0x442d7f){var _0x42a047=function(_0x372fbf){while(--_0x372fbf){_0x14f53e['push'](_0x14f53e['shift']());}};_0x42a047(++_0x442d7f);}(_0x29d4,0x1a1));var _0x429d=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x29d4[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0x429d('0x0'));var uuid=require('uuid');var util=require(_0x429d('0x1'));var logger=require(_0x429d('0x2'))(_0x429d('0x3'));var Agent=function(_0x472fc9,_0x45df1c,_0x4e287b,_0xc3989d){this[_0x429d('0x4')]=uuid['v4']();this[_0x429d('0x5')]=_0x472fc9;this[_0x429d('0x6')]=_0x45df1c;this[_0x429d('0x7')]=_0x4e287b;this[_0x429d('0x3')]=_0xc3989d;this[_0x429d('0x5')][_0x429d('0x8')](this['handleRun'][_0x429d('0x9')](this),this['handleTimeout'][_0x429d('0x9')](this));this[_0x429d('0x5')]['on'](_0x429d('0xa'),this['handleTimeout'][_0x429d('0x9')](this));this[_0x429d('0x5')]['on']('drained',this[_0x429d('0xb')][_0x429d('0x9')](this));};Agent[_0x429d('0xc')]['push']=function(){this[_0x429d('0x5')][_0x429d('0x8')](this[_0x429d('0xd')][_0x429d('0x9')](this),this['handleTimeout'][_0x429d('0x9')](this));};Agent[_0x429d('0xc')][_0x429d('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0x429d('0xc')][_0x429d('0xd')]=function(){logger['debug'](_0x429d('0xe'),this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);if(_[_0x429d('0xf')](this[_0x429d('0x7')][_0x429d('0x10')][this['agent']['id']])){logger[_0x429d('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);setTimeout(this[_0x429d('0x8')][_0x429d('0x9')](this),0x3e8);}else{if(this['routing'][_0x429d('0x12')]||util[_0x429d('0x13')](this[_0x429d('0x5')]['id'],this['realtime'][_0x429d('0x10')][this[_0x429d('0x6')]['id']],this[_0x429d('0x5')][_0x429d('0x14')],![])){this[_0x429d('0x7')][_0x429d('0x10')][this['agent']['id']][_0x429d('0x15')]=!![];this[_0x429d('0x7')][_0x429d('0x10')][this['agent']['id']][_0x429d('0x16')]=undefined;util[_0x429d('0x17')](this[_0x429d('0x7')],this[_0x429d('0x3')],this[_0x429d('0x6')],this[_0x429d('0x5')]['channel']);util[_0x429d('0x18')](this[_0x429d('0x4')],this['squeue']['id'],this[_0x429d('0x7')][_0x429d('0x10')][this[_0x429d('0x6')]['id']],null,this[_0x429d('0x3')]);util['writeLog'](this[_0x429d('0x5')]['id'],this[_0x429d('0x7')][_0x429d('0x10')][this[_0x429d('0x6')]['id']],_0x429d('0x19')+(this['routing'][_0x429d('0x12')]?_0x429d('0x1a'):''));}else{logger[_0x429d('0x11')](_0x429d('0x1b'),this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);setTimeout(this[_0x429d('0x8')][_0x429d('0x9')](this),0x3e8);}}};Agent[_0x429d('0xc')]['handleTimeout']=function(_0x31cae6){if(_[_0x429d('0xf')](this['realtime'][_0x429d('0x10')][this[_0x429d('0x6')]['id']])){return logger[_0x429d('0x11')](_0x429d('0x1c'),this[_0x429d('0x5')]['id'],this['agent']['id']);}else{logger[_0x429d('0x11')](_0x429d('0x1d'),this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);util[_0x429d('0x1e')](this[_0x429d('0x4')],this['squeue']['id'],this['realtime'][_0x429d('0x10')][this[_0x429d('0x6')]['id']],null,this['routing']);this['realtime'][_0x429d('0x10')][this['agent']['id']][_0x429d('0x15')]=![];this[_0x429d('0x7')][_0x429d('0x10')][this[_0x429d('0x6')]['id']]['busyQueue']=undefined;util[_0x429d('0x1f')](this[_0x429d('0x7')],this['routing'],this['agent'],this['squeue']['channel']);util['writeLog'](this[_0x429d('0x5')]['id'],this['realtime']['agents'][this[_0x429d('0x6')]['id']],_0x31cae6?_0x429d('0x20'):_0x429d('0x21'));}if(!_0x31cae6){setTimeout(this[_0x429d('0x8')][_0x429d('0x9')](this),0x3e8);}};function agent(_0x1a5d80,_0x4b23ab,_0x423dc8,_0x2c5fa5){return new Agent(_0x1a5d80,_0x4b23ab,_0x423dc8,_0x2c5fa5);}module[_0x429d('0x22')]=agent; \ No newline at end of file +var _0xed1f=['RINGING','forcedOwnership',':FORCED','debug','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','prototype','handleDrained','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agents','channel','busy','busyQueue'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xed1f,0x6a));var _0xfed1=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xed1f[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0xfed1('0x0'));var uuid=require(_0xfed1('0x1'));var util=require(_0xfed1('0x2'));var logger=require(_0xfed1('0x3'))(_0xfed1('0x4'));var Agent=function(_0x25f345,_0x1dd614,_0xa68587,_0x2209b3){this[_0xfed1('0x5')]=uuid['v4']();this[_0xfed1('0x6')]=_0x25f345;this[_0xfed1('0x7')]=_0x1dd614;this[_0xfed1('0x8')]=_0xa68587;this[_0xfed1('0x4')]=_0x2209b3;this[_0xfed1('0x6')][_0xfed1('0x9')](this[_0xfed1('0xa')][_0xfed1('0xb')](this),this['handleTimeout'][_0xfed1('0xb')](this));this[_0xfed1('0x6')]['on']('timeout',this[_0xfed1('0xc')][_0xfed1('0xb')](this));this['squeue']['on'](_0xfed1('0xd'),this['handleDrained'][_0xfed1('0xb')](this));};Agent[_0xfed1('0xe')]['push']=function(){this['squeue'][_0xfed1('0x9')](this[_0xfed1('0xa')]['bind'](this),this[_0xfed1('0xc')]['bind'](this));};Agent['prototype'][_0xfed1('0xf')]=function(){this[_0xfed1('0xc')](!![]);};Agent['prototype'][_0xfed1('0xa')]=function(){logger['debug']('[%s][AGENT]\x20try\x20with\x20%s',this[_0xfed1('0x6')]['id'],this[_0xfed1('0x7')]['id']);if(_[_0xfed1('0x10')](this[_0xfed1('0x8')]['agents'][this[_0xfed1('0x7')]['id']])){logger['debug'](_0xfed1('0x11'),this[_0xfed1('0x6')]['id'],this['agent']['id']);setTimeout(this[_0xfed1('0x9')][_0xfed1('0xb')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util['isAgentAvailable'](this[_0xfed1('0x6')]['id'],this['realtime'][_0xfed1('0x12')][this[_0xfed1('0x7')]['id']],this['squeue'][_0xfed1('0x13')],![])){this[_0xfed1('0x8')]['agents'][this[_0xfed1('0x7')]['id']][_0xfed1('0x14')]=!![];this[_0xfed1('0x8')][_0xfed1('0x12')][this['agent']['id']][_0xfed1('0x15')]=undefined;util['saveWaitingNotification'](this[_0xfed1('0x8')],this[_0xfed1('0x4')],this[_0xfed1('0x7')],this['squeue'][_0xfed1('0x13')]);util['showNotification'](this[_0xfed1('0x5')],this[_0xfed1('0x6')]['id'],this[_0xfed1('0x8')][_0xfed1('0x12')][this[_0xfed1('0x7')]['id']],null,this[_0xfed1('0x4')]);util['writeLog'](this[_0xfed1('0x6')]['id'],this[_0xfed1('0x8')]['agents'][this[_0xfed1('0x7')]['id']],_0xfed1('0x16')+(this[_0xfed1('0x4')][_0xfed1('0x17')]?_0xfed1('0x18'):''));}else{logger[_0xfed1('0x19')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xfed1('0x6')]['id'],this['agent']['id']);setTimeout(this[_0xfed1('0x9')]['bind'](this),0x3e8);}}};Agent['prototype'][_0xfed1('0xc')]=function(_0x42c950){if(_[_0xfed1('0x10')](this['realtime'][_0xfed1('0x12')][this[_0xfed1('0x7')]['id']])){return logger[_0xfed1('0x19')](_0xfed1('0x11'),this[_0xfed1('0x6')]['id'],this[_0xfed1('0x7')]['id']);}else{logger['debug'](_0xfed1('0x1a'),this[_0xfed1('0x6')]['id'],this['agent']['id']);util['hideNotification'](this[_0xfed1('0x5')],this[_0xfed1('0x6')]['id'],this[_0xfed1('0x8')][_0xfed1('0x12')][this[_0xfed1('0x7')]['id']],null,this['routing']);this[_0xfed1('0x8')][_0xfed1('0x12')][this[_0xfed1('0x7')]['id']][_0xfed1('0x14')]=![];this[_0xfed1('0x8')]['agents'][this[_0xfed1('0x7')]['id']]['busyQueue']=undefined;util[_0xfed1('0x1b')](this[_0xfed1('0x8')],this[_0xfed1('0x4')],this[_0xfed1('0x7')],this[_0xfed1('0x6')][_0xfed1('0x13')]);util[_0xfed1('0x1c')](this[_0xfed1('0x6')]['id'],this['realtime'][_0xfed1('0x12')][this[_0xfed1('0x7')]['id']],_0x42c950?_0xfed1('0x1d'):_0xfed1('0x1e'));}if(!_0x42c950){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x42d5df,_0x3c026d,_0x1d06af,_0x1105bd){return new Agent(_0x42d5df,_0x3c026d,_0x1d06af,_0x1105bd);}module[_0xfed1('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 1fed636..324dac1 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 _0x5a5c=['lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','realtime','channel','RINGING','agents','busy','busyQueue','name','showNotification','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog','STOP','TIMEOUT','removeWaitingNotification','exports'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x5a5c,0x17c));var _0xc5a5=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x5a5c[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xc5a5('0x0'));var uuid=require(_0xc5a5('0x1'));var util=require(_0xc5a5('0x2'));var logger=require(_0xc5a5('0x3'))('routing');var Beepall=function(_0x347c5f,_0x4cb437,_0x123310,_0x2237a2){this[_0xc5a5('0x4')]=uuid['v4']();this[_0xc5a5('0x5')]=_0x347c5f;this[_0xc5a5('0x6')]=_0x4cb437;this['realtime']=_0x123310;this[_0xc5a5('0x7')]=_0x2237a2;this[_0xc5a5('0x5')][_0xc5a5('0x8')](this[_0xc5a5('0x9')][_0xc5a5('0xa')](this),this[_0xc5a5('0xb')][_0xc5a5('0xa')](this));this[_0xc5a5('0x5')]['on'](_0xc5a5('0xc'),this[_0xc5a5('0xb')][_0xc5a5('0xa')](this));this['squeue']['on'](_0xc5a5('0xd'),this[_0xc5a5('0xe')]['bind'](this));};Beepall['prototype'][_0xc5a5('0x8')]=function(){this['squeue'][_0xc5a5('0x8')](this['handleRun']['bind'](this),this[_0xc5a5('0xb')][_0xc5a5('0xa')](this));};Beepall[_0xc5a5('0xf')][_0xc5a5('0xe')]=function(){this[_0xc5a5('0xb')](!![]);};Beepall[_0xc5a5('0xf')][_0xc5a5('0x9')]=function(){var _0x167059=!![];if(!_[_0xc5a5('0x10')](this['queue'])&&!_[_0xc5a5('0x10')](this[_0xc5a5('0x6')][_0xc5a5('0x11')])&&this['queue'][_0xc5a5('0x11')][_0xc5a5('0x12')]>0x0){for(var _0x1df33c=0x0,_0x4e63db;_0x1df33c0x0){for(var _0x105323=0x0,_0x5a4bec;_0x1053230x0&&_0x309327[_0x48e4ef+_0x2286('0x21')]>=_0x309327[_0x48e4ef+_0x2286('0x20')]){writeLog(_0x34c732,_0x309327,_0x48e4ef[_0x2286('0x22')]()+_0x2286('0x23'));return![];}}return!![];};exports[_0x2286('0x24')]=function(_0x2f07ed,_0x3286fa,_0x11f6c5,_0xf5469e,_0x9de2fd){return sendNotification(!![],_0x2f07ed,_0x3286fa,_0x11f6c5,_0xf5469e,_0x9de2fd);};exports[_0x2286('0x25')]=function(_0x1d0648,_0x299de6,_0xe40092,_0x3b04b5,_0x4441a6){return sendNotification(![],_0x1d0648,_0x299de6,_0xe40092,_0x3b04b5,_0x4441a6);};exports[_0x2286('0x26')]=function(_0x30f7e8,_0x2efa57,_0x40876d){var _0x584bf6=_0x2efa57[_0x2286('0x27')][_0x2286('0x28')];if(!_0x584bf6&&_0x40876d){_0x584bf6=_0x40876d['id'];}var _0x3583f5=_[_0x2286('0x29')](_0x30f7e8[_0x2efa57[_0x2286('0x2a')]+_0x2286('0x2b')],function(_0xea7f46){var _0x1e22ea=_[_0x2286('0x2c')](_0x2efa57['channel'])+_0x2286('0x2d');return _0xea7f46[_0x1e22ea]===_0x2efa57['interaction']['id'];});if(!_0x3583f5&&_0x584bf6){_0x3583f5=_['some'](_0x30f7e8['agents'][_0x584bf6][_0x2efa57['channel']+_0x2286('0x2e')],function(_0x367b06){return _0x367b06['id']===_0x2efa57[_0x2286('0x27')]['id'];});}return _0x3583f5;};exports[_0x2286('0x2f')]=function(_0x4f3a47,_0x11bb77,_0x59ff15,_0x54749c){_0x4f3a47[_0x2286('0x30')][_0x59ff15['id']][_0x54749c+_0x2286('0x2e')][_0x11bb77[_0x2286('0x31')]['id']]={'id':_0x11bb77['interaction']['id']};};exports['removeWaitingNotification']=function(_0x2d644f,_0x1c40c1,_0x3fc723,_0x910278){delete _0x2d644f[_0x2286('0x30')][_0x3fc723['id']][_0x910278+_0x2286('0x2e')][_0x1c40c1[_0x2286('0x31')]['id']];};exports['writeLog']=writeLog; \ No newline at end of file +var _0xa23a=['lodash','util','../utils','ioredis','../../../../../config/environment','routing','redis','defaults','localhost','emit','user:save','split','\x20interaction','name','notificationSound','account','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','message','user:%s','notification:%s','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','QueuesWaitingInteractions','capitalize','InteractionId','some','WaitingInteractions','interaction','saveWaitingNotification','agents','removeWaitingNotification','writeLog'];(function(_0x473644,_0x26507f){var _0x336714=function(_0x1ee369){while(--_0x1ee369){_0x473644['push'](_0x473644['shift']());}};_0x336714(++_0x26507f);}(_0xa23a,0xd4));var _0xaa23=function(_0xfa73ac,_0x2a7395){_0xfa73ac=_0xfa73ac-0x0;var _0x4e8e14=_0xa23a[_0xfa73ac];return _0x4e8e14;};'use strict';var _=require(_0xaa23('0x0'));var util=require(_0xaa23('0x1'));var utils=require(_0xaa23('0x2'));var Redis=require(_0xaa23('0x3'));var config=require(_0xaa23('0x4'));var logger=require('../../../../../config/logger')(_0xaa23('0x5'));config[_0xaa23('0x6')]=_[_0xaa23('0x7')](config[_0xaa23('0x6')],{'host':_0xaa23('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaa23('0x6')]));function sendNotification(_0x1241da,_0x177e69,_0x24a93f,_0x3bb9b7,_0x59cd88,_0x2d182e){io['to'](util['format']('user:%s',_0x3bb9b7['name']))[_0xaa23('0x9')](_0xaa23('0xa'),_0x3bb9b7);var _0x1853fe=_0x2d182e||{};var _0x4a6bb1=_0x24a93f[_0xaa23('0xb')]('.');var _0x443e9c={'uniqueid':_0x177e69,'channel':_0x4a6bb1[0x0],'id':_0x4a6bb1[0x1],'title':_0x4a6bb1[0x0]+_0xaa23('0xc'),'interactionId':_0x4a6bb1[0x2],'queue':_0x59cd88?_0x59cd88[_0xaa23('0xd')]:null,'sound':_0x1853fe['account'][_0xaa23('0xe')],'shake':_0x1853fe[_0xaa23('0xf')][_0xaa23('0x10')]};try{if(!_0x1853fe['body']){_0x1853fe[_0xaa23('0x11')]={};}if(_0x59cd88){_0x1853fe[_0xaa23('0x11')][_0xaa23('0x12')]=_0x59cd88;}else if(_0x1853fe[_0xaa23('0x11')][_0xaa23('0x12')]){delete _0x1853fe[_0xaa23('0x11')][_0xaa23('0x12')];}_0x443e9c['msg']=utils[_0xaa23('0x13')](_0x1853fe['account'][_0xaa23('0x14')],_0x1853fe);}catch(_0x169392){_0x443e9c[_0xaa23('0x15')]=_0xaa23('0x16');logger[_0xaa23('0x17')](util[_0xaa23('0x18')]('[%s][QUEUE]\x20%s',_0x177e69,_0x169392[_0xaa23('0x19')]));}io['to'](util[_0xaa23('0x18')](_0xaa23('0x1a'),_0x3bb9b7[_0xaa23('0xd')]))['emit'](util['format'](_0xaa23('0x1b'),_0x1241da?'save':_0xaa23('0x1c')),_0x443e9c);}function writeLog(_0x1ceb7d,_0x22344a,_0xe627d9){return logger[_0xaa23('0x1d')](util[_0xaa23('0x18')](_0xaa23('0x1e'),_0x1ceb7d,_0x22344a['name'],_0xe627d9));}exports['isAgentAvailable']=function(_0x2f8a24,_0x37bb8b,_0x129cd4,_0x577d9e){if(_0x37bb8b[_0xaa23('0x1f')]){writeLog(_0x2f8a24,_0x37bb8b,_0xaa23('0x20'));return![];}if(!_0x37bb8b['online']){writeLog(_0x2f8a24,_0x37bb8b,_0xaa23('0x21'));return![];}if(_0x37bb8b[_0x129cd4+_0xaa23('0x22')]){writeLog(_0x2f8a24,_0x37bb8b,_0xaa23('0x23'));return![];}if(_0x577d9e&&_0x37bb8b[_0xaa23('0x24')](_0x129cd4+_0xaa23('0x25'))&&_0x37bb8b[_0xaa23('0x24')](_0x129cd4+_0xaa23('0x26'))){if(_0x37bb8b[_0x129cd4+_0xaa23('0x25')]>0x0&&_0x37bb8b[_0x129cd4+'CurrentCapacity']>=_0x37bb8b[_0x129cd4+_0xaa23('0x25')]){writeLog(_0x2f8a24,_0x37bb8b,_0x129cd4[_0xaa23('0x27')]()+_0xaa23('0x28'));return![];}}return!![];};exports[_0xaa23('0x29')]=function(_0x4b8345,_0x4c459f,_0x30bb42,_0x21d551,_0x46b83e){return sendNotification(!![],_0x4b8345,_0x4c459f,_0x30bb42,_0x21d551,_0x46b83e);};exports[_0xaa23('0x2a')]=function(_0x22a99a,_0x4be4f0,_0x474fab,_0x441006,_0x234af6){return sendNotification(![],_0x22a99a,_0x4be4f0,_0x474fab,_0x441006,_0x234af6);};exports['checkWaitingNotifications']=function(_0x266ad2,_0x158677,_0x33964d){var _0x2b321f=_0x158677['interaction']['UserId'];if(!_0x2b321f&&_0x33964d){_0x2b321f=_0x33964d['id'];}var _0x353748=_['some'](_0x266ad2[_0x158677['channel']+_0xaa23('0x2b')],function(_0x2f1aad){var _0x586397=_[_0xaa23('0x2c')](_0x158677['channel'])+_0xaa23('0x2d');return _0x2f1aad[_0x586397]===_0x158677['interaction']['id'];});if(!_0x353748&&_0x2b321f){_0x353748=_[_0xaa23('0x2e')](_0x266ad2['agents'][_0x2b321f][_0x158677['channel']+_0xaa23('0x2f')],function(_0x5de549){return _0x5de549['id']===_0x158677[_0xaa23('0x30')]['id'];});}return _0x353748;};exports[_0xaa23('0x31')]=function(_0x415182,_0x3e90aa,_0x21e48c,_0x45f6e8){_0x415182[_0xaa23('0x32')][_0x21e48c['id']][_0x45f6e8+_0xaa23('0x2f')][_0x3e90aa[_0xaa23('0x19')]['id']]={'id':_0x3e90aa[_0xaa23('0x30')]['id']};};exports[_0xaa23('0x33')]=function(_0x10cd5e,_0x3fde3b,_0xca8aed,_0x4f5487){delete _0x10cd5e[_0xaa23('0x32')][_0xca8aed['id']][_0x4f5487+_0xaa23('0x2f')][_0x3fde3b['message']['id']];};exports[_0xaa23('0x34')]=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 f8d8975..868ce68 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 _0x4f20=['error','isObject','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][SYSTEM]\x20%s','join','info','next','getMustacheRender','exec','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4f20,0x86));var _0x04f2=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x4f20[_0x618414];return _0x21c19a;};'use strict';var schema=require('validate');var sh=require(_0x04f2('0x0'));var _=require(_0x04f2('0x1'));var utils=require(_0x04f2('0x2'));var logger=require(_0x04f2('0x3'))('routing');var system=schema({'command':{'type':_0x04f2('0x4'),'required':!![],'message':_0x04f2('0x5')}});exports[_0x04f2('0x6')]=function(_0x6605bd,_0x20de45){return function(_0x194568){try{var _0x4ea8e0={'command':_0x20de45[0x0]};var _0x2436b4=system[_0x04f2('0x7')](_0x4ea8e0,{'typecast':!![]});if(_0x2436b4[_0x04f2('0x8')]){logger['error'](_0x04f2('0x9'),_0x6605bd,_['map'](_0x2436b4,'message')[_0x04f2('0xa')](',\x20'));logger[_0x04f2('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x6605bd);_0x194568[_0x04f2('0xc')]();}else{var _0x141f28=this;var _0x2ac330=utils[_0x04f2('0xd')](_0x20de45[0x0],this);logger[_0x04f2('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x6605bd,_0x2ac330);sh[_0x04f2('0xe')](_['trim'](_0x2ac330),function(_0x484db0,_0x461bc2){logger[_0x04f2('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x6605bd,_0x484db0);if(_0x484db0==0x0){var _0x560a34=_0x461bc2['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x04f2('0xf')](_0x20de45[0x1])||_[_0x04f2('0x10')](_0x20de45[0x1])){logger['info'](_0x04f2('0x11'),_0x6605bd);_0x141f28[_0x04f2('0x12')][_0x20de45[0x1]]=_0x560a34;}else{logger['info'](_0x04f2('0x13'),_0x6605bd,_0x20de45[0x1],_0x560a34);_0x141f28[_0x04f2('0x12')][_0x20de45[0x1]]=_0x560a34;}}_0x194568[_0x04f2('0xc')]();});}}catch(_0x59f0ee){logger[_0x04f2('0x14')]('[%s][SYSTEM]\x20%s',_0x6605bd,_[_0x04f2('0x15')](_0x59f0ee)?JSON['stringify'](_0x59f0ee):_0x59f0ee);logger[_0x04f2('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x6605bd);_0x194568[_0x04f2('0xc')]();}};}; \ No newline at end of file +var _0x94c6=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','consequence','length','[%s][SYSTEM]\x20%s','message','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty'];(function(_0x148495,_0x4fcc3a){var _0x2a2148=function(_0x33beb6){while(--_0x33beb6){_0x148495['push'](_0x148495['shift']());}};_0x2a2148(++_0x4fcc3a);}(_0x94c6,0xa2));var _0x694c=function(_0x3ea24b,_0x16be28){_0x3ea24b=_0x3ea24b-0x0;var _0x37ff5c=_0x94c6[_0x3ea24b];return _0x37ff5c;};'use strict';var schema=require(_0x694c('0x0'));var sh=require(_0x694c('0x1'));var _=require(_0x694c('0x2'));var utils=require(_0x694c('0x3'));var logger=require(_0x694c('0x4'))(_0x694c('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x694c('0x6')]=function(_0x50786a,_0x1817ff){return function(_0x27c21e){try{var _0x46ce62={'command':_0x1817ff[0x0]};var _0xa8dfd2=system[_0x694c('0x0')](_0x46ce62,{'typecast':!![]});if(_0xa8dfd2[_0x694c('0x7')]){logger['error'](_0x694c('0x8'),_0x50786a,_['map'](_0xa8dfd2,_0x694c('0x9'))[_0x694c('0xa')](',\x20'));logger[_0x694c('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x50786a);_0x27c21e[_0x694c('0xc')]();}else{var _0x3c23ed=this;var _0x929e6=utils['getMustacheRender'](_0x1817ff[0x0],this);logger[_0x694c('0xb')](_0x694c('0xd'),_0x50786a,_0x929e6);sh[_0x694c('0xe')](_[_0x694c('0xf')](_0x929e6),function(_0xb7d172,_0x39abd1){logger[_0x694c('0xb')](_0x694c('0x10'),_0x50786a,_0xb7d172);if(_0xb7d172==0x0){var _0xb933d6=_0x39abd1[_0x694c('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x694c('0x12')](_0x1817ff[0x1])||_[_0x694c('0x13')](_0x1817ff[0x1])){logger[_0x694c('0xb')](_0x694c('0x14'),_0x50786a);_0x3c23ed[_0x694c('0x15')][_0x1817ff[0x1]]=_0xb933d6;}else{logger['info'](_0x694c('0x16'),_0x50786a,_0x1817ff[0x1],_0xb933d6);_0x3c23ed[_0x694c('0x15')][_0x1817ff[0x1]]=_0xb933d6;}}_0x27c21e['next']();});}}catch(_0xcdb0f4){logger['error'](_0x694c('0x8'),_0x50786a,_[_0x694c('0x17')](_0xcdb0f4)?JSON[_0x694c('0x18')](_0xcdb0f4):_0xcdb0f4);logger[_0x694c('0xb')](_0x694c('0x19'),_0x50786a);_0x27c21e[_0x694c('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 95a201f..4e323c5 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 _0xa14b=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','catch','[%s][TAG]\x20%s','stringify','finally','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing'];(function(_0x5e1fb3,_0x454df2){var _0x298c8a=function(_0x107af1){while(--_0x107af1){_0x5e1fb3['push'](_0x5e1fb3['shift']());}};_0x298c8a(++_0x454df2);}(_0xa14b,0x179));var _0xba14=function(_0x3ed3e5,_0x1a2c44){_0x3ed3e5=_0x3ed3e5-0x0;var _0x26a76d=_0xa14b[_0x3ed3e5];return _0x26a76d;};'use strict';var schema=require('validate');var _=require(_0xba14('0x0'));var rpc={'chatInteraction':require(_0xba14('0x1')),'openchannelInteraction':require(_0xba14('0x2')),'smsInteraction':require(_0xba14('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xba14('0x4')),'whatsappInteraction':require(_0xba14('0x5'))};var logger=require('../../../../config/logger')(_0xba14('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xba14('0x7')}});exports[_0xba14('0x8')]=function(_0x547da3,_0x322c82,_0x4fce80,_0x7b6dec){return function(_0x1f2abc){try{var _0x587986={'tag':_0x322c82[0x0]};var _0x30bfdf=tag[_0xba14('0x9')](_0x587986,{'typecast':!![]});if(_0x30bfdf['length']){logger[_0xba14('0xa')]('[%s][TAG]\x20%s',_0x547da3,_[_0xba14('0xb')](_0x30bfdf,_0xba14('0xc'))['join'](',\x20'));logger[_0xba14('0xd')](_0xba14('0xe'),_0x547da3);_0x1f2abc[_0xba14('0xf')]();}else{var _0xa19025={'ids':[_0x322c82[0x0]]};if(rpc[_0x7b6dec[_0xba14('0x10')]+_0xba14('0x11')]){rpc[_0x7b6dec[_0xba14('0x10')]+_0xba14('0x11')][_0xba14('0x12')](_0x7b6dec[_0xba14('0x13')]['id'],_0xa19025)['then'](function(_0x243fee){logger[_0xba14('0xd')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x547da3,_0x322c82[0x1],_0x7b6dec[_0xba14('0x10')],_0x7b6dec[_0xba14('0x13')]['id']);})[_0xba14('0x14')](function(_0x1bd0ef){logger[_0xba14('0xa')](_0xba14('0x15'),_0x547da3,JSON[_0xba14('0x16')](_0x1bd0ef));logger[_0xba14('0xd')](_0xba14('0xe'),_0x547da3);})[_0xba14('0x17')](function(){_0x1f2abc['next']();});}}}catch(_0x1d2835){logger[_0xba14('0xa')](_0xba14('0x15'),_0x547da3,_['isObject'](_0x1d2835)?JSON[_0xba14('0x16')](_0x1d2835):_0x1d2835);logger[_0xba14('0xd')](_0xba14('0xe'),_0x547da3);_0x1f2abc[_0xba14('0xf')]();}};}; \ No newline at end of file +var _0x96f2=['../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','finally','next','isObject','stringify','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction'];(function(_0x122373,_0x20b33e){var _0x3dabc1=function(_0x248940){while(--_0x248940){_0x122373['push'](_0x122373['shift']());}};_0x3dabc1(++_0x20b33e);}(_0x96f2,0x17b));var _0x296f=function(_0x36c191,_0x248300){_0x36c191=_0x36c191-0x0;var _0x20de02=_0x96f2[_0x36c191];return _0x20de02;};'use strict';var schema=require('validate');var _=require(_0x296f('0x0'));var rpc={'chatInteraction':require(_0x296f('0x1')),'openchannelInteraction':require(_0x296f('0x2')),'smsInteraction':require(_0x296f('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x296f('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x296f('0x5'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x296f('0x6')}});exports[_0x296f('0x7')]=function(_0x5f37e3,_0x179e9a,_0x5854b8,_0x305c51){return function(_0x5dd02b){try{var _0x58844d={'tag':_0x179e9a[0x0]};var _0x573a9e=tag[_0x296f('0x8')](_0x58844d,{'typecast':!![]});if(_0x573a9e[_0x296f('0x9')]){logger[_0x296f('0xa')]('[%s][TAG]\x20%s',_0x5f37e3,_[_0x296f('0xb')](_0x573a9e,_0x296f('0xc'))['join'](',\x20'));logger[_0x296f('0xd')](_0x296f('0xe'),_0x5f37e3);_0x5dd02b['next']();}else{var _0x331655={'ids':[_0x179e9a[0x0]]};if(rpc[_0x305c51[_0x296f('0xf')]+'Interaction']){rpc[_0x305c51[_0x296f('0xf')]+'Interaction'][_0x296f('0x10')](_0x305c51['interaction']['id'],_0x331655)[_0x296f('0x11')](function(_0x3a9edb){logger[_0x296f('0xd')](_0x296f('0x12'),_0x5f37e3,_0x179e9a[0x1],_0x305c51[_0x296f('0xf')],_0x305c51['interaction']['id']);})['catch'](function(_0x40242e){logger[_0x296f('0xa')](_0x296f('0x13'),_0x5f37e3,JSON['stringify'](_0x40242e));logger[_0x296f('0xd')](_0x296f('0xe'),_0x5f37e3);})[_0x296f('0x14')](function(){_0x5dd02b[_0x296f('0x15')]();});}}}catch(_0x2e235c){logger[_0x296f('0xa')](_0x296f('0x13'),_0x5f37e3,_[_0x296f('0x16')](_0x2e235c)?JSON[_0x296f('0x17')](_0x2e235c):_0x2e235c);logger['info'](_0x296f('0xe'),_0x5f37e3);_0x5dd02b[_0x296f('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 452fc06..c9036c3 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 _0x6f2e=['stringify','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','stop','catch','error','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','push','?params=','urlOnRing','title','jsonrpc','2.0','login','params'];(function(_0x47cb02,_0x5d3010){var _0x301d07=function(_0x6eca2e){while(--_0x6eca2e){_0x47cb02['push'](_0x47cb02['shift']());}};_0x301d07(++_0x5d3010);}(_0x6f2e,0xcc));var _0xe6f2=function(_0x5655ce,_0x5eb231){_0x5655ce=_0x5655ce-0x0;var _0x3b2c9f=_0x6f2e[_0x5655ce];return _0x3b2c9f;};'use strict';var rp=require(_0xe6f2('0x0'));var logger=require(_0xe6f2('0x1'))(_0xe6f2('0x2'));var _=require(_0xe6f2('0x3'));var arr=[];exports['consequence']=function(_0x1cc3dc,_0x590a62){return function(_0x1dc541){var _0x226883=_0x590a62[0xa];var _0x676409=_0x590a62[0xb];var _0x11baac=_0x590a62[0xc];var _0x44a198=_0x590a62[0xd];var _0x4d16be=_0x590a62[0xe];var _0x490663=_0x590a62[0xf]['replace'](/\n/g,'\x20-\x20');var _0x31de6e=_0x590a62[0x10][_0xe6f2('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x676409)){arr[_0xe6f2('0x5')](_0x676409);var _0x304596=_0x590a62[0x3];var _0xd53ecc=_0x590a62[0x4];var _0x2e5ae7=_0x590a62[0x1];var _0xe84e13=_0x590a62[0x0];var _0x1dbc49={};_0x1dbc49['urlOnAnswer']=_0x590a62[0x8]+_0xe6f2('0x6')+_0x11baac+'|'+_0x226883+'|'+_0x44a198+'|'+_0x676409+'|'+_0x4d16be;_0x1dbc49[_0xe6f2('0x7')]=_0x590a62[0x7]+'?params='+_0x11baac+'|'+_0x226883+'|'+_0x44a198+'|'+_0x676409+'|'+_0x4d16be+'|'+_0x490663+'|'+_0x31de6e;_0x1dbc49[_0xe6f2('0x8')]=_0x590a62[0x9];var _0x2263b5={};_0x2263b5[_0xe6f2('0x9')]=_0xe6f2('0xa');_0x2263b5['method']=_0xe6f2('0xb');var _0x199c44=[];_0x199c44[_0xe6f2('0x5')](_0x590a62[0x2]);_0x199c44[_0xe6f2('0x5')](_0x590a62[0x5]);_0x199c44[_0xe6f2('0x5')](_0x590a62[0x6]);_0x2263b5[_0xe6f2('0xc')]=_0x199c44;_0x2263b5['id']=0x1;var _0x356225=JSON[_0xe6f2('0xd')](_0x2263b5);var _0x3e1f48={'encoding':'utf8','method':_0xe6f2('0xe'),'timeout':0x2710,'url':_0x304596,'headers':{'Content-Type':_0xe6f2('0xf')},'body':_0x356225};return rp(_0x3e1f48)[_0xe6f2('0x10')](function(_0x4a5378){const _0xce2b2d=JSON[_0xe6f2('0x11')](_0x4a5378);if(!_0xce2b2d['result'][_0xe6f2('0x12')]){throw new Error(_0xe6f2('0x13'));}var _0x3ae580=_0x676409;var _0xdf1878=_0xe6f2('0x14')+_0x2e5ae7+_0xe6f2('0x15')+_0xe84e13+'&sessionId='+_0x3ae580+_0xe6f2('0x16')+JSON['stringify'](_0x1dbc49);var _0x4a73e6=_0xd53ecc+'?'+_0xdf1878;return rp(_0x4a73e6);})[_0xe6f2('0x10')](function(_0x3e2e2f){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x1cc3dc,_0x3e2e2f);_0x1dc541[_0xe6f2('0x17')]();})[_0xe6f2('0x18')](function(_0x29b191){logger[_0xe6f2('0x19')](_0xe6f2('0x1a'),_0x1cc3dc,_[_0xe6f2('0x1b')](_0x29b191)?JSON[_0xe6f2('0xd')](_0x29b191):_0x29b191);_0x1dc541[_0xe6f2('0x17')]();});}else{logger[_0xe6f2('0x1c')](_0xe6f2('0x1d'),_0x1cc3dc);_0x1dc541[_0xe6f2('0x1e')]();}};}; \ No newline at end of file +var _0xb9cd=['includes','urlOnAnswer','?params=','urlOnRing','jsonrpc','push','params','stringify','POST','application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace'];(function(_0x5e49de,_0x1d3dd9){var _0x328849=function(_0x457210){while(--_0x457210){_0x5e49de['push'](_0x5e49de['shift']());}};_0x328849(++_0x1d3dd9);}(_0xb9cd,0x12e));var _0xdb9c=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0xb9cd[_0x29ce14];return _0x48f289;};'use strict';var rp=require(_0xdb9c('0x0'));var logger=require(_0xdb9c('0x1'))(_0xdb9c('0x2'));var _=require(_0xdb9c('0x3'));var arr=[];exports[_0xdb9c('0x4')]=function(_0x171740,_0x373588){return function(_0x1f5f30){var _0xa44a91=_0x373588[0xa];var _0x4c471b=_0x373588[0xb];var _0x5e3def=_0x373588[0xc];var _0x49d5a9=_0x373588[0xd];var _0x2f143d=_0x373588[0xe];var _0x5d6e58=_0x373588[0xf][_0xdb9c('0x5')](/\n/g,'\x20-\x20');var _0x43a88=_0x373588[0x10][_0xdb9c('0x5')](/\n/g,'\x20');if(!arr[_0xdb9c('0x6')](_0x4c471b)){arr['push'](_0x4c471b);var _0x5c18d2=_0x373588[0x3];var _0x5aad17=_0x373588[0x4];var _0x5d321=_0x373588[0x1];var _0x4b2046=_0x373588[0x0];var _0x2204f9={};_0x2204f9[_0xdb9c('0x7')]=_0x373588[0x8]+_0xdb9c('0x8')+_0x5e3def+'|'+_0xa44a91+'|'+_0x49d5a9+'|'+_0x4c471b+'|'+_0x2f143d;_0x2204f9[_0xdb9c('0x9')]=_0x373588[0x7]+_0xdb9c('0x8')+_0x5e3def+'|'+_0xa44a91+'|'+_0x49d5a9+'|'+_0x4c471b+'|'+_0x2f143d+'|'+_0x5d6e58+'|'+_0x43a88;_0x2204f9['title']=_0x373588[0x9];var _0x1498a7={};_0x1498a7[_0xdb9c('0xa')]='2.0';_0x1498a7['method']='login';var _0xd6f0dd=[];_0xd6f0dd['push'](_0x373588[0x2]);_0xd6f0dd[_0xdb9c('0xb')](_0x373588[0x5]);_0xd6f0dd[_0xdb9c('0xb')](_0x373588[0x6]);_0x1498a7[_0xdb9c('0xc')]=_0xd6f0dd;_0x1498a7['id']=0x1;var _0x11cf3e=JSON[_0xdb9c('0xd')](_0x1498a7);var _0x4c1cdc={'encoding':'utf8','method':_0xdb9c('0xe'),'timeout':0x2710,'url':_0x5c18d2,'headers':{'Content-Type':_0xdb9c('0xf')},'body':_0x11cf3e};return rp(_0x4c1cdc)[_0xdb9c('0x10')](function(_0x4833a){const _0x2eec62=JSON['parse'](_0x4833a);if(!_0x2eec62[_0xdb9c('0x11')][_0xdb9c('0x12')]){throw new Error(_0xdb9c('0x13'));}var _0x4ffadd=_0x4c471b;var _0x159ceb='channelId='+_0x5d321+_0xdb9c('0x14')+_0x4b2046+_0xdb9c('0x15')+_0x4ffadd+'&data='+JSON[_0xdb9c('0xd')](_0x2204f9);var _0x36a987=_0x5aad17+'?'+_0x159ceb;return rp(_0x36a987);})['then'](function(_0x7e003b){logger['info'](_0xdb9c('0x16'),_0x171740,_0x7e003b);_0x1f5f30[_0xdb9c('0x17')]();})['catch'](function(_0x5d6ac4){logger[_0xdb9c('0x18')]('[%s][TVOX]\x20%s',_0x171740,_['isObject'](_0x5d6ac4)?JSON[_0xdb9c('0xd')](_0x5d6ac4):_0x5d6ac4);_0x1f5f30[_0xdb9c('0x17')]();});}else{logger[_0xdb9c('0x19')](_0xdb9c('0x1a'),_0x171740);_0x1f5f30[_0xdb9c('0x1b')]();}};}; \ 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 fb92e2c..68e9eb4 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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x59d737,_0x4da255){var _0x3d3622=function(_0x48b9da){while(--_0x48b9da){_0x59d737['push'](_0x59d737['shift']());}};_0x3d3622(++_0x4da255);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x598060,_0x398256){var _0x6b4eea=function(_0x4fb12a){while(--_0x4fb12a){_0x598060['push'](_0x598060['shift']());}};_0x6b4eea(++_0x398256);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index eb20b3b..5e010d4 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 _0x8795=['../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','rules','channel','message','applications','existsSync','join','app','.js','toLowerCase','appdata','split','mail','push','slice','length','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busy','busyQueue','interaction','emit','QueueReport','update','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0x8795,0xc2));var _0x5879=function(_0x46ecfe,_0x50722d){_0x46ecfe=_0x46ecfe-0x0;var _0x17c820=_0x8795[_0x46ecfe];return _0x17c820;};'use strict';var _=require(_0x5879('0x0'));var util=require(_0x5879('0x1'));var path=require(_0x5879('0x2'));var fs=require('fs');var jayson=require(_0x5879('0x3'));var BPromise=require(_0x5879('0x4'));var utils=require(_0x5879('0x5'));var sUtils=require(_0x5879('0x6'));var logger=require(_0x5879('0x7'))(_0x5879('0x8'));var rpc={'openchannelQueueReport':require(_0x5879('0x9')),'mailQueueReport':require(_0x5879('0xa')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x5879('0xb')),'faxQueueReport':require(_0x5879('0xc')),'whatsappQueueReport':require(_0x5879('0xd'))};var RuleEngine=require(_0x5879('0xe'));function getId(_0x56069e,_0x20e309,_0x58836a){return util[_0x5879('0xf')](_0x5879('0x10'),_0x56069e,_0x20e309||0x0,_0x58836a||0x0);}function getIntervals(_0x197c67,_0x12804b){var _0x5b953f=[];if(!_['isNil'](_0x12804b[_0x5879('0x11')])&&!_[_0x5879('0x12')](_0x197c67[_0x12804b[_0x5879('0x11')]])&&!_[_0x5879('0x12')](_0x197c67[_0x12804b[_0x5879('0x11')]][_0x5879('0x13')])){_0x5b953f=_[_0x5879('0x14')](_0x197c67[_0x12804b['IntervalId']]['Intervals'],'interval');}else if(!_[_0x5879('0x12')](_0x12804b[_0x5879('0x15')])){_0x5b953f=[_0x12804b[_0x5879('0x15')]];}return _0x5b953f;}exports['listen']=function(_0x4d8f69){_0x4d8f69[_0x5879('0x16')]={};return new BPromise(function(_0xf4a646,_0x398af0){var _0x2ca683={'Start':function(_0x560b7c){var _0x5309e2=this;return new Promise(function(_0x18cd49,_0x3110a1){if(_0x560b7c){try{var _0x3738d3=[];var _0x36b224=getId(_0x560b7c[_0x5879('0x17')],_0x560b7c[_0x5879('0x18')]?_0x560b7c[_0x5879('0x18')]['id']:0x0,_0x560b7c['interaction']?_0x560b7c['interaction']['id']:0x0);var _0x107a25=sUtils['checkWaitingNotifications'](_0x4d8f69,_0x560b7c);if(!_0x107a25&&_0x560b7c[_0x5879('0x19')]&&_['isArray'](_0x560b7c[_0x5879('0x19')])&&_0x560b7c[_0x5879('0x19')]['length']){for(var _0x2a8a53=0x0;_0x2a8a53<_0x560b7c[_0x5879('0x19')]['length'];_0x2a8a53+=0x1){var _0x5df5ff=_0x560b7c['applications'][_0x2a8a53];if(fs[_0x5879('0x1a')](path[_0x5879('0x1b')](__dirname,'applications',_0x5df5ff[_0x5879('0x1c')]+_0x5879('0x1d')))){var _0x4d35a1=[];switch(_0x5df5ff['app'][_0x5879('0x1e')]()){case'autoreply':var _0x5cfe74=_0x5df5ff[_0x5879('0x1f')][_0x5879('0x20')](',');if(_0x560b7c[_0x5879('0x17')]===_0x5879('0x21')){_0x4d35a1['push'](_0x5cfe74[0x0]);_0x4d35a1[_0x5879('0x22')](_0x5cfe74[0x1]);_0x4d35a1[_0x5879('0x22')](_0x5cfe74[_0x5879('0x23')](0x2,_0x5cfe74['length'])[_0x5879('0x1b')](','));}else{_0x4d35a1[_0x5879('0x22')](_0x5cfe74[0x0]);_0x4d35a1['push'](_0x5cfe74[_0x5879('0x23')](0x1,_0x5cfe74[_0x5879('0x24')])[_0x5879('0x1b')](','));}break;case _0x5879('0x25'):var _0x27b63d=_0x5df5ff[_0x5879('0x1f')][_0x5879('0x20')](',');_0x4d35a1[_0x5879('0x22')](_0x27b63d[0x0]);_0x4d35a1[_0x5879('0x22')](_0x27b63d[0x1]);_0x4d35a1[_0x5879('0x22')](_0x27b63d[_0x5879('0x23')](0x2,_0x27b63d['length'])[_0x5879('0x1b')](','));break;case _0x5879('0x26'):var _0xe9b078=_0x5df5ff['appdata'][_0x5879('0x20')](',');_0x4d35a1[_0x5879('0x22')](_0xe9b078[0x0]);_0x4d35a1[_0x5879('0x22')](_0xe9b078[0x1]);_0x4d35a1[_0x5879('0x22')](_0xe9b078[0x2]);_0x4d35a1[_0x5879('0x22')](_0xe9b078[0x3]);_0x4d35a1[_0x5879('0x22')](_0xe9b078[_0x5879('0x23')](0x4,_0xe9b078[_0x5879('0x24')])[_0x5879('0x1b')](','));break;case _0x5879('0x27'):var _0x55a7e8=_0x5df5ff[_0x5879('0x1f')][_0x5879('0x20')](',');_0x4d35a1[_0x5879('0x22')](_0x55a7e8[0x0]);_0x4d35a1[_0x5879('0x22')](_0x55a7e8[0x1]);_0x4d35a1[_0x5879('0x22')](_0x55a7e8[0x2]);_0x4d35a1[_0x5879('0x22')](_0x55a7e8[0x3]);_0x4d35a1['push'](_0x55a7e8['slice'](0x4,_0x55a7e8['length'])[_0x5879('0x1b')](','));break;case _0x5879('0x18'):_0x4d35a1[_0x5879('0x22')](_0x5df5ff['appdata']);break;case _0x5879('0x28'):_0x4d35a1['push'](_0x5df5ff[_0x5879('0x29')]);_0x4d35a1[_0x5879('0x22')](_0x5df5ff[_0x5879('0x1f')]);break;case _0x5879('0x2a'):var _0x47bb1c=utils[_0x5879('0x2b')](_0x560b7c['account'][_0x5879('0x2c')],_0x560b7c);var _0x214aad=_0x5df5ff[_0x5879('0x1f')][_0x5879('0x20')](',');_0x4d35a1['push'](_0x214aad[0x0]);_0x4d35a1['push'](_0x214aad[0x1]);_0x4d35a1[_0x5879('0x22')](_0x214aad[0x2]);_0x4d35a1['push'](_0x214aad[0x3]);_0x4d35a1[_0x5879('0x22')](_0x214aad[0x4]);_0x4d35a1[_0x5879('0x22')](_0x214aad[0x5]);_0x4d35a1[_0x5879('0x22')](_0x214aad[0x6]);_0x4d35a1[_0x5879('0x22')](_0x214aad[0x7]);_0x4d35a1[_0x5879('0x22')](_0x214aad[0x8]);_0x4d35a1[_0x5879('0x22')](_0x214aad[0x9]);_0x4d35a1[_0x5879('0x22')](_0x214aad[0xa]);_0x4d35a1[_0x5879('0x22')](_0x560b7c['interaction']['id']);_0x4d35a1[_0x5879('0x22')](_0x560b7c[_0x5879('0x18')]['id']);_0x4d35a1['push'](_0x5df5ff[_0x5879('0x2d')]);_0x4d35a1['push'](_0x560b7c['interaction'][_0x5879('0x2e')]);_0x4d35a1['push'](_0x560b7c[_0x5879('0x2f')][_0x5879('0x2f')]);_0x4d35a1[_0x5879('0x22')](_0x47bb1c);break;default:_0x4d35a1=_[_0x5879('0x12')](_0x5df5ff['appdata'])?[]:_0x5df5ff['appdata'][_0x5879('0x20')](',');}var _0x4b5388={'id':util[_0x5879('0xf')]('%s:%s:%s',_0x36b224,_0x5df5ff['id'],_0x5df5ff[_0x5879('0x1c')]),'condition':require('./interval')['condition'](_0x36b224,getIntervals(_0x4d8f69[_0x5879('0x30')],_0x5df5ff),_0x4d8f69),'consequence':require(_0x5879('0x31')+_0x5df5ff[_0x5879('0x1c')])['consequence'](_0x36b224,_0x4d35a1,_0x4d8f69,_0x560b7c),'p':_0x5df5ff[_0x5879('0x32')]||0x0};logger[_0x5879('0x33')](_0x5879('0x34'),_0x4b5388['id'],_0x5879('0x35'),getIntervals(_0x4d8f69[_0x5879('0x30')],_0x5df5ff)[_0x5879('0x1b')](_0x5879('0x36')));_0x3738d3['push'](_0x4b5388);}else{logger['error'](_0x5879('0x37'),path[_0x5879('0x1b')](__dirname,_0x5879('0x19'),_0x5df5ff['app']+_0x5879('0x1d')));}}_0x4d8f69[_0x5879('0x16')][_0x36b224]=new RuleEngine(_0x3738d3);_0x4d8f69['rules'][_0x36b224]['execute'](_0x560b7c,function(_0x4bb3df){logger[_0x5879('0x33')](_0x5879('0x38'),JSON['stringify'](_0x4bb3df[_0x5879('0x39')]));if(_0x4d8f69[_0x5879('0x16')][_0x36b224]){_0x4d8f69[_0x5879('0x16')][_0x36b224]['emit'](_0x5879('0x3a'));}});return _0x18cd49({'code':0xc8,'message':_0x560b7c});}else{if(_0x107a25){logger[_0x5879('0x33')](util[_0x5879('0xf')](_0x5879('0x3b'),_0x36b224));}else{logger[_0x5879('0x33')](_0x5879('0x3c'));}return _0x18cd49({'code':0xc8,'message':_0x560b7c});}}catch(_0x44a707){logger[_0x5879('0x3d')](_0x44a707['stack']);return _0x3110a1(_0x5309e2[_0x5879('0x3d')](0x1f4,_0x44a707));}}return _0x3110a1(_0x5879('0x3e'));});},'AcceptMessage':function(_0x10458f){var _0x4f9bdc=this;return new Promise(function(_0x529928,_0x1d1523){if(_0x10458f[_0x5879('0x3f')]&&_0x10458f['agent']['id']){if(_0x4d8f69[_0x5879('0x40')][_0x10458f['agent']['id']]){_0x4d8f69[_0x5879('0x40')][_0x10458f['agent']['id']][_0x5879('0x41')]=![];_0x4d8f69['agents'][_0x10458f[_0x5879('0x3f')]['id']][_0x5879('0x42')]=undefined;}}if(_0x10458f['message']&&_0x10458f[_0x5879('0x18')]['id']){try{var _0x153c19=getId(_0x10458f['channel'],_0x10458f[_0x5879('0x18')]?_0x10458f[_0x5879('0x18')]['id']:0x0,_0x10458f[_0x5879('0x43')]?_0x10458f[_0x5879('0x43')]['id']:0x0);if(_0x4d8f69[_0x5879('0x16')][_0x153c19]){_0x4d8f69[_0x5879('0x16')][_0x153c19][_0x5879('0x44')]('end');if(rpc[_0x10458f[_0x5879('0x17')]+'QueueReport']){rpc[_0x10458f[_0x5879('0x17')]+_0x5879('0x45')][_0x5879('0x46')](_0x153c19,{'UserId':_0x10458f[_0x5879('0x18')]['UserId']})[_0x5879('0x47')](function(){logger[_0x5879('0x3d')](_0x5879('0x48'));});}}return _0x529928({'code':0xc8,'message':_0x10458f});}catch(_0x288091){logger[_0x5879('0x3d')](_0x288091[_0x5879('0x49')]);return _0x1d1523(_0x4f9bdc['error'](0x1f4,_0x288091));}}logger[_0x5879('0x3d')](_0x5879('0x4a'));return _0x1d1523(_0x4f9bdc[_0x5879('0x3d')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x5cd30a){var _0x4665f7=this;return new Promise(function(_0x54dd7d,_0x5145cb){if(_0x5cd30a[_0x5879('0x3f')]&&_0x5cd30a['agent']['id']){try{if(_0x4d8f69['agents'][_0x5cd30a[_0x5879('0x3f')]['id']]){_0x4d8f69['agents'][_0x5cd30a[_0x5879('0x3f')]['id']][_0x5879('0x41')]=![];_0x4d8f69['agents'][_0x5cd30a[_0x5879('0x3f')]['id']][_0x5879('0x42')]=undefined;}return _0x54dd7d({'code':0xc8,'message':_0x5cd30a});}catch(_0x25e755){logger[_0x5879('0x3d')](_0x25e755[_0x5879('0x49')]);return _0x5145cb(_0x4665f7[_0x5879('0x3d')](0x1f4,_0x25e755));}}logger['error']('message\x20is\x20empty');return _0x5145cb(_0x4665f7[_0x5879('0x3d')](0x1f4,_0x5879('0x4a')));});},'AbandonInteraction':function(_0x428a77){var _0x58ab9a=this;return new Promise(function(_0x3774fc,_0x2e4408){if(_0x428a77[_0x5879('0x17')]&&_0x428a77[_0x5879('0x43')]&&_0x428a77[_0x5879('0x43')]['id']){try{var _0x22a755=getId(_0x428a77[_0x5879('0x17')],_0x428a77[_0x5879('0x18')]?_0x428a77['message']['id']:0x0,_0x428a77[_0x5879('0x43')]?_0x428a77['interaction']['id']:0x0);if(_0x4d8f69[_0x5879('0x16')][_0x22a755]){_0x4d8f69['rules'][_0x22a755][_0x5879('0x44')](_0x5879('0x4b'));}return _0x3774fc({'code':0xc8,'message':_0x428a77});}catch(_0x14c898){logger[_0x5879('0x3d')](_0x14c898[_0x5879('0x49')]);return _0x2e4408(_0x58ab9a[_0x5879('0x3d')](0x1f4,_0x14c898));}}logger[_0x5879('0x3d')](_0x5879('0x4a'));return _0x2e4408(_0x58ab9a[_0x5879('0x3d')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x2972a0){var _0x261e37=this;return new Promise(function(_0x146785,_0x5146b0){if(_0x4d8f69['agents'][_0x5879('0x4c')](_0x2972a0['id'])){for(var _0x29516b in _0x2972a0['capacity']){if(_0x2972a0[_0x5879('0x4d')]['hasOwnProperty'](_0x29516b)){if(_0x4d8f69[_0x5879('0x40')][_0x2972a0['id']]['hasOwnProperty'](_0x29516b+_0x5879('0x4e'))){_0x4d8f69['agents'][_0x2972a0['id']][_0x29516b+_0x5879('0x4e')]=parseInt(_0x2972a0[_0x5879('0x4d')][_0x29516b],0xa);}}}_0x4d8f69[_0x5879('0x40')][_0x2972a0['id']][_0x5879('0x4f')]();return _0x146785({'code':0xc8,'message':_0x4d8f69[_0x5879('0x40')][_0x2972a0['id']]});}else{return _0x5146b0(_0x261e37['error'](0x1f4,_0x5879('0x50')));}});},'Agents':function(_0x454221){return new Promise(function(_0xff958){var _0x40d1c9=_[_0x5879('0x51')](_0x4d8f69[_0x5879('0x40')]);if(_0x454221&&_0x454221['id']){var _0x55f7eb=_[_0x5879('0x52')](_0x40d1c9,function(_0x506a75){return _0x506a75['id']===_0x454221['id'];});_0xff958(_0x55f7eb);}else{_0xff958({'count':_0x40d1c9[_0x5879('0x24')],'rows':_0x40d1c9});}});},'ChatQueues':function(){return new Promise(function(_0x2f63b7){var _0x3ed815=[];for(var _0x4b1235 in _0x4d8f69['chatQueues']){if(_0x4d8f69[_0x5879('0x53')]['hasOwnProperty'](_0x4b1235)){var _0x468bfb=_0x4d8f69[_0x5879('0x53')][_0x4b1235];var _0x245983={'id':_0x468bfb['id'],'available':_0x468bfb[_0x5879('0x54')],'loggedIn':_0x468bfb[_0x5879('0x55')],'name':_0x468bfb[_0x5879('0x56')],'paused':_0x468bfb['paused'],'waiting':_0x468bfb[_0x5879('0x57')]};_0x3ed815[_0x5879('0x22')](_0x245983);}}_0x2f63b7({'count':_0x3ed815['length'],'rows':_0x3ed815});});},'MailQueues':function(){return new Promise(function(_0x17dd18){var _0x4fc85b=[];for(var _0x10f653 in _0x4d8f69[_0x5879('0x58')]){if(_0x4d8f69[_0x5879('0x58')][_0x5879('0x4c')](_0x10f653)){var _0x1a7d2a=_0x4d8f69[_0x5879('0x58')][_0x10f653];var _0x69c8c8={'id':_0x1a7d2a['id'],'available':_0x1a7d2a['available'],'loggedIn':_0x1a7d2a[_0x5879('0x55')],'name':_0x1a7d2a[_0x5879('0x56')],'paused':_0x1a7d2a[_0x5879('0x59')],'waiting':_0x1a7d2a['waiting']};_0x4fc85b[_0x5879('0x22')](_0x69c8c8);}}_0x17dd18({'count':_0x4fc85b[_0x5879('0x24')],'rows':_0x4fc85b});});},'OpenchannelQueues':function(){return new Promise(function(_0x52bbd1){var _0x5b5a04=[];for(var _0x1e4c5f in _0x4d8f69['openchannelQueues']){if(_0x4d8f69[_0x5879('0x5a')][_0x5879('0x4c')](_0x1e4c5f)){var _0x459122=_0x4d8f69['openchannelQueues'][_0x1e4c5f];var _0x4adc77={'id':_0x459122['id'],'available':_0x459122['available'],'loggedIn':_0x459122[_0x5879('0x55')],'name':_0x459122['name'],'paused':_0x459122[_0x5879('0x59')],'waiting':_0x459122[_0x5879('0x57')]};_0x5b5a04['push'](_0x4adc77);}}_0x52bbd1({'count':_0x5b5a04[_0x5879('0x24')],'rows':_0x5b5a04});});},'SmsQueues':function(){return new Promise(function(_0x390df2){var _0x165b0b=[];for(var _0x1e8628 in _0x4d8f69[_0x5879('0x5b')]){if(_0x4d8f69[_0x5879('0x5b')][_0x5879('0x4c')](_0x1e8628)){var _0x3e7ca7=_0x4d8f69[_0x5879('0x5b')][_0x1e8628];var _0xe8c94c={'id':_0x3e7ca7['id'],'available':_0x3e7ca7['available'],'loggedIn':_0x3e7ca7[_0x5879('0x55')],'name':_0x3e7ca7[_0x5879('0x56')],'paused':_0x3e7ca7['paused'],'waiting':_0x3e7ca7[_0x5879('0x57')]};_0x165b0b[_0x5879('0x22')](_0xe8c94c);}}_0x390df2({'count':_0x165b0b['length'],'rows':_0x165b0b});});},'FaxQueues':function(){return new Promise(function(_0x32a64c){var _0x995265=[];for(var _0x2969f1 in _0x4d8f69[_0x5879('0x5c')]){if(_0x4d8f69['faxQueues'][_0x5879('0x4c')](_0x2969f1)){var _0x33ab2f=_0x4d8f69[_0x5879('0x5c')][_0x2969f1];var _0x230bf1={'id':_0x33ab2f['id'],'available':_0x33ab2f[_0x5879('0x54')],'loggedIn':_0x33ab2f[_0x5879('0x55')],'name':_0x33ab2f[_0x5879('0x56')],'paused':_0x33ab2f[_0x5879('0x59')],'waiting':_0x33ab2f['waiting']};_0x995265[_0x5879('0x22')](_0x230bf1);}}_0x32a64c({'count':_0x995265['length'],'rows':_0x995265});});},'WhatsappQueues':function(){return new Promise(function(_0x415143){var _0x1b94c8=[];for(var _0x4a48ee in _0x4d8f69[_0x5879('0x5d')]){if(_0x4d8f69[_0x5879('0x5d')][_0x5879('0x4c')](_0x4a48ee)){var _0x3e7839=_0x4d8f69['whatsappQueues'][_0x4a48ee];var _0xcfe44e={'id':_0x3e7839['id'],'available':_0x3e7839['available'],'loggedIn':_0x3e7839[_0x5879('0x55')],'name':_0x3e7839[_0x5879('0x56')],'paused':_0x3e7839[_0x5879('0x59')],'waiting':_0x3e7839[_0x5879('0x57')]};_0x1b94c8[_0x5879('0x22')](_0xcfe44e);}}_0x415143({'count':_0x1b94c8[_0x5879('0x24')],'rows':_0x1b94c8});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4c4d53){var _0x5cd44b=_[_0x5879('0x51')](_0x4d8f69[_0x5879('0x5e')]);_0x4c4d53({'count':_0x5cd44b['length'],'rows':_0x5cd44b});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0xd13068){var _0x2376fe=_[_0x5879('0x51')](_0x4d8f69['mailQueuesWaitingInteractions']);_0xd13068({'count':_0x2376fe[_0x5879('0x24')],'rows':_0x2376fe});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x155317){var _0x60cfe5=_[_0x5879('0x51')](_0x4d8f69['openchannelQueuesWaitingInteractions']);_0x155317({'count':_0x60cfe5[_0x5879('0x24')],'rows':_0x60cfe5});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x44b95f){var _0x28667c=_[_0x5879('0x51')](_0x4d8f69[_0x5879('0x5f')]);_0x44b95f({'count':_0x28667c[_0x5879('0x24')],'rows':_0x28667c});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3f8246){var _0x38c8f6=_[_0x5879('0x51')](_0x4d8f69[_0x5879('0x60')]);_0x3f8246({'count':_0x38c8f6['length'],'rows':_0x38c8f6});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x337525){var _0x40aa36=_['values'](_0x4d8f69[_0x5879('0x61')]);_0x337525({'count':_0x40aa36[_0x5879('0x24')],'rows':_0x40aa36});});}};var _0x488a80=jayson[_0x5879('0x62')](_0x2ca683)[_0x5879('0x63')]();_0x488a80['on'](_0x5879('0x3d'),function(_0x3320ab){logger[_0x5879('0x3d')](JSON[_0x5879('0x64')](_0x3320ab));return _0x398af0(_0x3320ab);});_0x488a80['listen'](0x232c,'127.0.0.1',function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0xf4a646(_0x5879('0x65')+0x232c);});});}; \ No newline at end of file +var _0x6f14=['priority','info','Push\x20new\x20rule','error','Applications\x20executed','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','listen','log','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','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','split','amazonlex','tag','tvox','account','ChatWebsiteId','ContactId','%s:%s:%s','condition','intervals','consequence'];(function(_0x3bc44d,_0x47f40a){var _0x5e9b5b=function(_0x46492d){while(--_0x46492d){_0x3bc44d['push'](_0x3bc44d['shift']());}};_0x5e9b5b(++_0x47f40a);}(_0x6f14,0xfc));var _0x46f1=function(_0x484032,_0x11ce70){_0x484032=_0x484032-0x0;var _0xec7c10=_0x6f14[_0x484032];return _0xec7c10;};'use strict';var _=require(_0x46f1('0x0'));var util=require(_0x46f1('0x1'));var path=require(_0x46f1('0x2'));var fs=require('fs');var jayson=require(_0x46f1('0x3'));var BPromise=require(_0x46f1('0x4'));var utils=require(_0x46f1('0x5'));var sUtils=require(_0x46f1('0x6'));var logger=require(_0x46f1('0x7'))(_0x46f1('0x8'));var rpc={'openchannelQueueReport':require(_0x46f1('0x9')),'mailQueueReport':require(_0x46f1('0xa')),'chatQueueReport':require(_0x46f1('0xb')),'smsQueueReport':require(_0x46f1('0xc')),'faxQueueReport':require(_0x46f1('0xd')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x3bd356,_0x352b5c,_0x4fc325){return util[_0x46f1('0xe')](_0x46f1('0xf'),_0x3bd356,_0x352b5c||0x0,_0x4fc325||0x0);}function getIntervals(_0x55a4ae,_0x231277){var _0x3e68dc=[];if(!_[_0x46f1('0x10')](_0x231277[_0x46f1('0x11')])&&!_[_0x46f1('0x10')](_0x55a4ae[_0x231277[_0x46f1('0x11')]])&&!_[_0x46f1('0x10')](_0x55a4ae[_0x231277['IntervalId']]['Intervals'])){_0x3e68dc=_[_0x46f1('0x12')](_0x55a4ae[_0x231277[_0x46f1('0x11')]][_0x46f1('0x13')],'interval');}else if(!_['isNil'](_0x231277[_0x46f1('0x14')])){_0x3e68dc=[_0x231277[_0x46f1('0x14')]];}return _0x3e68dc;}exports['listen']=function(_0x1e2639){_0x1e2639[_0x46f1('0x15')]={};return new BPromise(function(_0x2a3d9e,_0x24827a){var _0x47e24c={'Start':function(_0x5403e7){var _0x52aec0=this;return new Promise(function(_0x30780e,_0x1b4423){if(_0x5403e7){try{var _0x282906=[];var _0x4469b0=getId(_0x5403e7[_0x46f1('0x16')],_0x5403e7[_0x46f1('0x17')]?_0x5403e7[_0x46f1('0x17')]['id']:0x0,_0x5403e7[_0x46f1('0x18')]?_0x5403e7[_0x46f1('0x18')]['id']:0x0);var _0x5bbd6a=sUtils[_0x46f1('0x19')](_0x1e2639,_0x5403e7);if(!_0x5bbd6a&&_0x5403e7[_0x46f1('0x1a')]&&_[_0x46f1('0x1b')](_0x5403e7['applications'])&&_0x5403e7[_0x46f1('0x1a')][_0x46f1('0x1c')]){for(var _0x212f50=0x0;_0x212f50<_0x5403e7[_0x46f1('0x1a')][_0x46f1('0x1c')];_0x212f50+=0x1){var _0x26245f=_0x5403e7[_0x46f1('0x1a')][_0x212f50];if(fs[_0x46f1('0x1d')](path[_0x46f1('0x1e')](__dirname,_0x46f1('0x1a'),_0x26245f[_0x46f1('0x1f')]+_0x46f1('0x20')))){var _0x136c48=[];switch(_0x26245f[_0x46f1('0x1f')][_0x46f1('0x21')]()){case _0x46f1('0x22'):var _0x49ddfb=_0x26245f[_0x46f1('0x23')]['split'](',');if(_0x5403e7[_0x46f1('0x16')]===_0x46f1('0x24')){_0x136c48['push'](_0x49ddfb[0x0]);_0x136c48['push'](_0x49ddfb[0x1]);_0x136c48[_0x46f1('0x25')](_0x49ddfb[_0x46f1('0x26')](0x2,_0x49ddfb['length'])['join'](','));}else{_0x136c48[_0x46f1('0x25')](_0x49ddfb[0x0]);_0x136c48[_0x46f1('0x25')](_0x49ddfb['slice'](0x1,_0x49ddfb['length'])[_0x46f1('0x1e')](','));}break;case _0x46f1('0x27'):var _0x644c0c=_0x26245f[_0x46f1('0x23')]['split'](',');_0x136c48['push'](_0x644c0c[0x0]);_0x136c48[_0x46f1('0x25')](_0x644c0c[0x1]);_0x136c48['push'](_0x644c0c[_0x46f1('0x26')](0x2,_0x644c0c['length'])['join'](','));break;case'dialogflowv2':var _0x108737=_0x26245f[_0x46f1('0x23')][_0x46f1('0x28')](',');_0x136c48[_0x46f1('0x25')](_0x108737[0x0]);_0x136c48[_0x46f1('0x25')](_0x108737[0x1]);_0x136c48[_0x46f1('0x25')](_0x108737[0x2]);_0x136c48[_0x46f1('0x25')](_0x108737[0x3]);_0x136c48[_0x46f1('0x25')](_0x108737[_0x46f1('0x26')](0x4,_0x108737[_0x46f1('0x1c')])['join'](','));break;case _0x46f1('0x29'):var _0x2ff9d9=_0x26245f[_0x46f1('0x23')]['split'](',');_0x136c48[_0x46f1('0x25')](_0x2ff9d9[0x0]);_0x136c48[_0x46f1('0x25')](_0x2ff9d9[0x1]);_0x136c48[_0x46f1('0x25')](_0x2ff9d9[0x2]);_0x136c48[_0x46f1('0x25')](_0x2ff9d9[0x3]);_0x136c48['push'](_0x2ff9d9[_0x46f1('0x26')](0x4,_0x2ff9d9['length'])[_0x46f1('0x1e')](','));break;case'message':_0x136c48['push'](_0x26245f['appdata']);break;case _0x46f1('0x2a'):_0x136c48[_0x46f1('0x25')](_0x26245f['TagId']);_0x136c48[_0x46f1('0x25')](_0x26245f['appdata']);break;case _0x46f1('0x2b'):var _0x1950bf=utils['getMustacheRender'](_0x5403e7[_0x46f1('0x2c')]['notificationTemplate'],_0x5403e7);var _0xf40bda=_0x26245f[_0x46f1('0x23')]['split'](',');_0x136c48[_0x46f1('0x25')](_0xf40bda[0x0]);_0x136c48['push'](_0xf40bda[0x1]);_0x136c48[_0x46f1('0x25')](_0xf40bda[0x2]);_0x136c48[_0x46f1('0x25')](_0xf40bda[0x3]);_0x136c48[_0x46f1('0x25')](_0xf40bda[0x4]);_0x136c48[_0x46f1('0x25')](_0xf40bda[0x5]);_0x136c48[_0x46f1('0x25')](_0xf40bda[0x6]);_0x136c48[_0x46f1('0x25')](_0xf40bda[0x7]);_0x136c48[_0x46f1('0x25')](_0xf40bda[0x8]);_0x136c48[_0x46f1('0x25')](_0xf40bda[0x9]);_0x136c48[_0x46f1('0x25')](_0xf40bda[0xa]);_0x136c48[_0x46f1('0x25')](_0x5403e7[_0x46f1('0x18')]['id']);_0x136c48[_0x46f1('0x25')](_0x5403e7['message']['id']);_0x136c48[_0x46f1('0x25')](_0x26245f[_0x46f1('0x2d')]);_0x136c48['push'](_0x5403e7['interaction'][_0x46f1('0x2e')]);_0x136c48[_0x46f1('0x25')](_0x5403e7['body']['body']);_0x136c48[_0x46f1('0x25')](_0x1950bf);break;default:_0x136c48=_[_0x46f1('0x10')](_0x26245f[_0x46f1('0x23')])?[]:_0x26245f[_0x46f1('0x23')][_0x46f1('0x28')](',');}var _0x2b9a90={'id':util['format'](_0x46f1('0x2f'),_0x4469b0,_0x26245f['id'],_0x26245f['app']),'condition':require('./interval')[_0x46f1('0x30')](_0x4469b0,getIntervals(_0x1e2639[_0x46f1('0x31')],_0x26245f),_0x1e2639),'consequence':require('./applications/'+_0x26245f[_0x46f1('0x1f')])[_0x46f1('0x32')](_0x4469b0,_0x136c48,_0x1e2639,_0x5403e7),'p':_0x26245f[_0x46f1('0x33')]||0x0};logger[_0x46f1('0x34')](_0x46f1('0x35'),_0x2b9a90['id'],'on\x20interval',getIntervals(_0x1e2639[_0x46f1('0x31')],_0x26245f)[_0x46f1('0x1e')]('\x20|\x20'));_0x282906[_0x46f1('0x25')](_0x2b9a90);}else{logger[_0x46f1('0x36')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x46f1('0x1e')](__dirname,_0x46f1('0x1a'),_0x26245f[_0x46f1('0x1f')]+_0x46f1('0x20')));}}_0x1e2639[_0x46f1('0x15')][_0x4469b0]=new RuleEngine(_0x282906);_0x1e2639[_0x46f1('0x15')][_0x4469b0]['execute'](_0x5403e7,function(_0x58d956){logger[_0x46f1('0x34')](_0x46f1('0x37'),JSON[_0x46f1('0x38')](_0x58d956[_0x46f1('0x39')]));if(_0x1e2639[_0x46f1('0x15')][_0x4469b0]){_0x1e2639[_0x46f1('0x15')][_0x4469b0]['emit'](_0x46f1('0x3a'));}});return _0x30780e({'code':0xc8,'message':_0x5403e7});}else{if(_0x5bbd6a){logger[_0x46f1('0x34')](util[_0x46f1('0xe')](_0x46f1('0x3b'),_0x4469b0));}else{logger[_0x46f1('0x34')](_0x46f1('0x3c'));}return _0x30780e({'code':0xc8,'message':_0x5403e7});}}catch(_0xdb6f8a){logger[_0x46f1('0x36')](_0xdb6f8a['stack']);return _0x1b4423(_0x52aec0[_0x46f1('0x36')](0x1f4,_0xdb6f8a));}}return _0x1b4423(_0x46f1('0x3d'));});},'AcceptMessage':function(_0x5685fd){var _0x56a6f6=this;return new Promise(function(_0x471928,_0x40531a){if(_0x5685fd[_0x46f1('0x3e')]&&_0x5685fd[_0x46f1('0x3e')]['id']){if(_0x1e2639[_0x46f1('0x3f')][_0x5685fd[_0x46f1('0x3e')]['id']]){_0x1e2639[_0x46f1('0x3f')][_0x5685fd['agent']['id']][_0x46f1('0x40')]=![];_0x1e2639[_0x46f1('0x3f')][_0x5685fd[_0x46f1('0x3e')]['id']][_0x46f1('0x41')]=undefined;}}if(_0x5685fd[_0x46f1('0x17')]&&_0x5685fd[_0x46f1('0x17')]['id']){try{var _0x4b62a2=getId(_0x5685fd[_0x46f1('0x16')],_0x5685fd[_0x46f1('0x17')]?_0x5685fd[_0x46f1('0x17')]['id']:0x0,_0x5685fd[_0x46f1('0x18')]?_0x5685fd[_0x46f1('0x18')]['id']:0x0);if(_0x1e2639[_0x46f1('0x15')][_0x4b62a2]){_0x1e2639[_0x46f1('0x15')][_0x4b62a2]['emit']('end');if(rpc[_0x5685fd[_0x46f1('0x16')]+_0x46f1('0x42')]){rpc[_0x5685fd[_0x46f1('0x16')]+_0x46f1('0x42')][_0x46f1('0x43')](_0x4b62a2,{'UserId':_0x5685fd[_0x46f1('0x17')][_0x46f1('0x44')]})[_0x46f1('0x45')](function(){logger[_0x46f1('0x36')](_0x46f1('0x46'));});}}return _0x471928({'code':0xc8,'message':_0x5685fd});}catch(_0x4e1653){logger[_0x46f1('0x36')](_0x4e1653[_0x46f1('0x47')]);return _0x40531a(_0x56a6f6[_0x46f1('0x36')](0x1f4,_0x4e1653));}}logger[_0x46f1('0x36')](_0x46f1('0x48'));return _0x40531a(_0x56a6f6['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x1f31c0){var _0x59bc80=this;return new Promise(function(_0x3791e1,_0xe7391a){if(_0x1f31c0[_0x46f1('0x3e')]&&_0x1f31c0[_0x46f1('0x3e')]['id']){try{if(_0x1e2639[_0x46f1('0x3f')][_0x1f31c0[_0x46f1('0x3e')]['id']]){_0x1e2639[_0x46f1('0x3f')][_0x1f31c0[_0x46f1('0x3e')]['id']][_0x46f1('0x40')]=![];_0x1e2639[_0x46f1('0x3f')][_0x1f31c0[_0x46f1('0x3e')]['id']][_0x46f1('0x41')]=undefined;}return _0x3791e1({'code':0xc8,'message':_0x1f31c0});}catch(_0x265ba9){logger[_0x46f1('0x36')](_0x265ba9[_0x46f1('0x47')]);return _0xe7391a(_0x59bc80[_0x46f1('0x36')](0x1f4,_0x265ba9));}}logger['error']('message\x20is\x20empty');return _0xe7391a(_0x59bc80['error'](0x1f4,_0x46f1('0x48')));});},'AbandonInteraction':function(_0xd39672){var _0x18b65b=this;return new Promise(function(_0x4feaaa,_0x11f22d){if(_0xd39672['channel']&&_0xd39672[_0x46f1('0x18')]&&_0xd39672[_0x46f1('0x18')]['id']){try{var _0x49b914=getId(_0xd39672['channel'],_0xd39672[_0x46f1('0x17')]?_0xd39672[_0x46f1('0x17')]['id']:0x0,_0xd39672[_0x46f1('0x18')]?_0xd39672[_0x46f1('0x18')]['id']:0x0);if(_0x1e2639['rules'][_0x49b914]){_0x1e2639[_0x46f1('0x15')][_0x49b914]['emit'](_0x46f1('0x49'));}return _0x4feaaa({'code':0xc8,'message':_0xd39672});}catch(_0x148415){logger['error'](_0x148415['stack']);return _0x11f22d(_0x18b65b[_0x46f1('0x36')](0x1f4,_0x148415));}}logger[_0x46f1('0x36')]('message\x20is\x20empty');return _0x11f22d(_0x18b65b['error'](0x1f4,_0x46f1('0x48')));});},'AgentCapacity':function(_0x2e0655){var _0x124901=this;return new Promise(function(_0x580c77,_0x3f018c){if(_0x1e2639[_0x46f1('0x3f')][_0x46f1('0x4a')](_0x2e0655['id'])){for(var _0xe5d7cd in _0x2e0655[_0x46f1('0x4b')]){if(_0x2e0655['capacity'][_0x46f1('0x4a')](_0xe5d7cd)){if(_0x1e2639[_0x46f1('0x3f')][_0x2e0655['id']]['hasOwnProperty'](_0xe5d7cd+_0x46f1('0x4c'))){_0x1e2639[_0x46f1('0x3f')][_0x2e0655['id']][_0xe5d7cd+_0x46f1('0x4c')]=parseInt(_0x2e0655['capacity'][_0xe5d7cd],0xa);}}}_0x1e2639[_0x46f1('0x3f')][_0x2e0655['id']][_0x46f1('0x4d')]();return _0x580c77({'code':0xc8,'message':_0x1e2639[_0x46f1('0x3f')][_0x2e0655['id']]});}else{return _0x3f018c(_0x124901[_0x46f1('0x36')](0x1f4,_0x46f1('0x4e')));}});},'Agents':function(_0x484ceb){return new Promise(function(_0x200eb8){var _0x167980=_['values'](_0x1e2639[_0x46f1('0x3f')]);if(_0x484ceb&&_0x484ceb['id']){var _0xbab4a2=_[_0x46f1('0x4f')](_0x167980,function(_0x58d0d3){return _0x58d0d3['id']===_0x484ceb['id'];});_0x200eb8(_0xbab4a2);}else{_0x200eb8({'count':_0x167980[_0x46f1('0x1c')],'rows':_0x167980});}});},'ChatQueues':function(){return new Promise(function(_0x385b73){var _0x36adee=[];for(var _0x1b35a1 in _0x1e2639[_0x46f1('0x50')]){if(_0x1e2639['chatQueues'][_0x46f1('0x4a')](_0x1b35a1)){var _0x481f4d=_0x1e2639[_0x46f1('0x50')][_0x1b35a1];var _0x3dd548={'id':_0x481f4d['id'],'available':_0x481f4d[_0x46f1('0x51')],'loggedIn':_0x481f4d[_0x46f1('0x52')],'name':_0x481f4d[_0x46f1('0x53')],'paused':_0x481f4d[_0x46f1('0x54')],'waiting':_0x481f4d[_0x46f1('0x55')]};_0x36adee[_0x46f1('0x25')](_0x3dd548);}}_0x385b73({'count':_0x36adee['length'],'rows':_0x36adee});});},'MailQueues':function(){return new Promise(function(_0x2c7970){var _0x1466dc=[];for(var _0x31b8cc in _0x1e2639[_0x46f1('0x56')]){if(_0x1e2639['mailQueues'][_0x46f1('0x4a')](_0x31b8cc)){var _0x58ff2d=_0x1e2639[_0x46f1('0x56')][_0x31b8cc];var _0x3167b8={'id':_0x58ff2d['id'],'available':_0x58ff2d[_0x46f1('0x51')],'loggedIn':_0x58ff2d[_0x46f1('0x52')],'name':_0x58ff2d['name'],'paused':_0x58ff2d['paused'],'waiting':_0x58ff2d[_0x46f1('0x55')]};_0x1466dc[_0x46f1('0x25')](_0x3167b8);}}_0x2c7970({'count':_0x1466dc[_0x46f1('0x1c')],'rows':_0x1466dc});});},'OpenchannelQueues':function(){return new Promise(function(_0x185903){var _0x3feed5=[];for(var _0x2c7729 in _0x1e2639[_0x46f1('0x57')]){if(_0x1e2639['openchannelQueues']['hasOwnProperty'](_0x2c7729)){var _0x36da08=_0x1e2639['openchannelQueues'][_0x2c7729];var _0x48513f={'id':_0x36da08['id'],'available':_0x36da08['available'],'loggedIn':_0x36da08[_0x46f1('0x52')],'name':_0x36da08[_0x46f1('0x53')],'paused':_0x36da08[_0x46f1('0x54')],'waiting':_0x36da08['waiting']};_0x3feed5[_0x46f1('0x25')](_0x48513f);}}_0x185903({'count':_0x3feed5[_0x46f1('0x1c')],'rows':_0x3feed5});});},'SmsQueues':function(){return new Promise(function(_0x3d153a){var _0x3feed4=[];for(var _0x38e1c6 in _0x1e2639[_0x46f1('0x58')]){if(_0x1e2639['smsQueues'][_0x46f1('0x4a')](_0x38e1c6)){var _0x577e08=_0x1e2639[_0x46f1('0x58')][_0x38e1c6];var _0x1e7985={'id':_0x577e08['id'],'available':_0x577e08['available'],'loggedIn':_0x577e08[_0x46f1('0x52')],'name':_0x577e08['name'],'paused':_0x577e08[_0x46f1('0x54')],'waiting':_0x577e08[_0x46f1('0x55')]};_0x3feed4[_0x46f1('0x25')](_0x1e7985);}}_0x3d153a({'count':_0x3feed4[_0x46f1('0x1c')],'rows':_0x3feed4});});},'FaxQueues':function(){return new Promise(function(_0x325a0d){var _0xd2eeee=[];for(var _0x31355d in _0x1e2639[_0x46f1('0x59')]){if(_0x1e2639[_0x46f1('0x59')][_0x46f1('0x4a')](_0x31355d)){var _0x39c616=_0x1e2639[_0x46f1('0x59')][_0x31355d];var _0xcd9229={'id':_0x39c616['id'],'available':_0x39c616[_0x46f1('0x51')],'loggedIn':_0x39c616[_0x46f1('0x52')],'name':_0x39c616[_0x46f1('0x53')],'paused':_0x39c616[_0x46f1('0x54')],'waiting':_0x39c616[_0x46f1('0x55')]};_0xd2eeee[_0x46f1('0x25')](_0xcd9229);}}_0x325a0d({'count':_0xd2eeee['length'],'rows':_0xd2eeee});});},'WhatsappQueues':function(){return new Promise(function(_0x55e51e){var _0x137527=[];for(var _0x5f3f8a in _0x1e2639[_0x46f1('0x5a')]){if(_0x1e2639[_0x46f1('0x5a')]['hasOwnProperty'](_0x5f3f8a)){var _0x4d1361=_0x1e2639[_0x46f1('0x5a')][_0x5f3f8a];var _0x154455={'id':_0x4d1361['id'],'available':_0x4d1361[_0x46f1('0x51')],'loggedIn':_0x4d1361[_0x46f1('0x52')],'name':_0x4d1361[_0x46f1('0x53')],'paused':_0x4d1361[_0x46f1('0x54')],'waiting':_0x4d1361[_0x46f1('0x55')]};_0x137527[_0x46f1('0x25')](_0x154455);}}_0x55e51e({'count':_0x137527['length'],'rows':_0x137527});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x30e985){var _0x431e40=_['values'](_0x1e2639[_0x46f1('0x5b')]);_0x30e985({'count':_0x431e40[_0x46f1('0x1c')],'rows':_0x431e40});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x24b18d){var _0x2cb81b=_[_0x46f1('0x5c')](_0x1e2639['mailQueuesWaitingInteractions']);_0x24b18d({'count':_0x2cb81b['length'],'rows':_0x2cb81b});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xc950fb){var _0x3ca6be=_['values'](_0x1e2639[_0x46f1('0x5d')]);_0xc950fb({'count':_0x3ca6be[_0x46f1('0x1c')],'rows':_0x3ca6be});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x22f6a6){var _0x2b36b6=_[_0x46f1('0x5c')](_0x1e2639[_0x46f1('0x5e')]);_0x22f6a6({'count':_0x2b36b6[_0x46f1('0x1c')],'rows':_0x2b36b6});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3f2075){var _0x24dc3e=_[_0x46f1('0x5c')](_0x1e2639[_0x46f1('0x5f')]);_0x3f2075({'count':_0x24dc3e[_0x46f1('0x1c')],'rows':_0x24dc3e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5e5a1a){var _0x2dfc36=_[_0x46f1('0x5c')](_0x1e2639['whatsappQueuesWaitingInteractions']);_0x5e5a1a({'count':_0x2dfc36[_0x46f1('0x1c')],'rows':_0x2dfc36});});}};var _0x5492b8=jayson['server'](_0x47e24c)[_0x46f1('0x60')]();_0x5492b8['on'](_0x46f1('0x36'),function(_0x4ed4d7){logger[_0x46f1('0x36')](JSON[_0x46f1('0x38')](_0x4ed4d7));return _0x24827a(_0x4ed4d7);});_0x5492b8[_0x46f1('0x61')](0x232c,'127.0.0.1',function(){console[_0x46f1('0x62')](_0x46f1('0x63'),0x232c);return _0x2a3d9e(_0x46f1('0x64')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 38a1889..3100526 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 _0x667c=['jayson/promise','lodash','../../../config/logger','client','http','request','then','error','message','catch','condition','rules','info','stop','length','Command','format','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','util','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x667c,0xfa));var _0xc667=function(_0x572152,_0x3f60ad){_0x572152=_0x572152-0x0;var _0x59445a=_0x667c[_0x572152];return _0x59445a;};'use strict';var util=require(_0xc667('0x0'));var BPromise=require(_0xc667('0x1'));var jayson=require(_0xc667('0x2'));var _=require(_0xc667('0x3'));var logger=require(_0xc667('0x4'))('routing');var client=jayson[_0xc667('0x5')][_0xc667('0x6')]({'port':0x232a});function request(_0x39cb74,_0x3bf373){return new BPromise(function(_0x18ac6f,_0x38c5cf){return client[_0xc667('0x7')](_0x39cb74,_0x3bf373)[_0xc667('0x8')](function(_0xc5d798){if(_0xc5d798[_0xc667('0x9')]){return _0x38c5cf(_0xc5d798[_0xc667('0x9')][_0xc667('0xa')]);}else{return _0x18ac6f(_0xc5d798['result']);}})[_0xc667('0xb')](function(_0x56dfea){return _0x38c5cf(_0x56dfea);});});}exports[_0xc667('0xc')]=function(_0x21cdfa,_0x287dfe,_0x586916){return function(_0x215f86){if(_0x586916['rules']&&!_0x586916[_0xc667('0xd')][_0x21cdfa]){logger[_0xc667('0xe')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x21cdfa);return _0x215f86[_0xc667('0xf')]();}var _0x5758ac=[];for(var _0x3b9f7a=0x0;_0x3b9f7a<_0x287dfe[_0xc667('0x10')];_0x3b9f7a+=0x1){_0x5758ac['push'](request(_0xc667('0x11'),{'command':util[_0xc667('0x12')](_0xc667('0x13'),_0x287dfe[_0x3b9f7a])})[_0xc667('0x8')](function(_0x58fd90){return _0x58fd90&&_0x58fd90[_0xc667('0xa')]&&_0x58fd90[_0xc667('0xa')][_0xc667('0x14')]('true')>=0x0?!![]:![];})[_0xc667('0xb')](function(_0x1ec793){logger[_0xc667('0x9')](_0xc667('0x15'),_0x21cdfa,_0x287dfe[_0x3b9f7a]);}));}BPromise[_0xc667('0x16')](_0x5758ac)['then'](function(_0xa55792){var _0x2f99af=_['some'](_0xa55792);logger['info'](_0xc667('0x17'),_0x21cdfa,_0x287dfe[_0xc667('0x18')](_0xc667('0x19')),_0x2f99af);_0x215f86[_0xc667('0x1a')](_0x2f99af);})[_0xc667('0xb')](function(_0x196f7c){console[_0xc667('0x1b')](_0x196f7c);logger[_0xc667('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x21cdfa,_0x287dfe[_0xc667('0x18')](_0xc667('0x19')),_0x196f7c['stack']);_0x215f86['stop']();});};}; \ No newline at end of file +var _0x5a99=['catch','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','format','iftime\x20%s','then','message','indexOf','[%s][INTERVAL]\x20%s','all','info','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','result'];(function(_0x31deaa,_0x26dade){var _0xfcc94a=function(_0x9ddb53){while(--_0x9ddb53){_0x31deaa['push'](_0x31deaa['shift']());}};_0xfcc94a(++_0x26dade);}(_0x5a99,0xb4));var _0x95a9=function(_0x3d2738,_0x40572a){_0x3d2738=_0x3d2738-0x0;var _0x5155e5=_0x5a99[_0x3d2738];return _0x5155e5;};'use strict';var util=require('util');var BPromise=require(_0x95a9('0x0'));var jayson=require(_0x95a9('0x1'));var _=require(_0x95a9('0x2'));var logger=require(_0x95a9('0x3'))(_0x95a9('0x4'));var client=jayson[_0x95a9('0x5')][_0x95a9('0x6')]({'port':0x232a});function request(_0x30b316,_0x5948d1){return new BPromise(function(_0x1c327b,_0x102076){return client[_0x95a9('0x7')](_0x30b316,_0x5948d1)['then'](function(_0x5ded59){if(_0x5ded59['error']){return _0x102076(_0x5ded59['error']['message']);}else{return _0x1c327b(_0x5ded59[_0x95a9('0x8')]);}})[_0x95a9('0x9')](function(_0x417713){return _0x102076(_0x417713);});});}exports['condition']=function(_0x4d9214,_0x38e654,_0x57eb30){return function(_0x52ea7f){if(_0x57eb30['rules']&&!_0x57eb30[_0x95a9('0xa')][_0x4d9214]){logger['info'](_0x95a9('0xb'),_0x4d9214);return _0x52ea7f[_0x95a9('0xc')]();}var _0x1cd0f8=[];for(var _0x2c4c71=0x0;_0x2c4c71<_0x38e654['length'];_0x2c4c71+=0x1){_0x1cd0f8['push'](request('Command',{'command':util[_0x95a9('0xd')](_0x95a9('0xe'),_0x38e654[_0x2c4c71])})[_0x95a9('0xf')](function(_0x393d98){return _0x393d98&&_0x393d98[_0x95a9('0x10')]&&_0x393d98[_0x95a9('0x10')][_0x95a9('0x11')]('true')>=0x0?!![]:![];})[_0x95a9('0x9')](function(_0xa44476){logger['error'](_0x95a9('0x12'),_0x4d9214,_0x38e654[_0x2c4c71]);}));}BPromise[_0x95a9('0x13')](_0x1cd0f8)[_0x95a9('0xf')](function(_0x12d09b){var _0x49b202=_['some'](_0x12d09b);logger[_0x95a9('0x14')](_0x95a9('0x15'),_0x4d9214,_0x38e654[_0x95a9('0x16')]('\x20|\x20'),_0x49b202);_0x52ea7f[_0x95a9('0x17')](_0x49b202);})['catch'](function(_0xf22871){console[_0x95a9('0x18')](_0xf22871);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x4d9214,_0x38e654[_0x95a9('0x16')](_0x95a9('0x19')),_0xf22871[_0x95a9('0x1a')]);_0x52ea7f[_0x95a9('0xc')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index ec70c69..3dcb749 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 _0xa478=['push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','type','agentcomplete','acw','agentacw','request','CreateVoiceAgentReport','agentcalled','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime'];(function(_0x2112e2,_0x5b9535){var _0x27dbe7=function(_0x100e2f){while(--_0x100e2f){_0x2112e2['push'](_0x2112e2['shift']());}};_0x27dbe7(++_0x5b9535);}(_0xa478,0x136));var _0x8a47=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0xa478[_0x41d432];return _0x1650f9;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var utils=require(_0x8a47('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x44be2c,_0x2c3f60){utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x5'),_0x44be2c[_0x8a47('0x6')],_0x44be2c[_0x8a47('0x7')],_0x44be2c[_0x8a47('0x8')],_0x44be2c[_0x8a47('0x9')],_0x44be2c['interface'],_0x44be2c[_0x8a47('0xa')],_0x44be2c[_0x8a47('0xb')],_0x44be2c[_0x8a47('0xc')]));if(_0x44be2c[_0x8a47('0x8')]){utils['getVoiceQueueByName'](_0x44be2c[_0x8a47('0x8')])['then'](function(_0x7b6e61){if(_0x7b6e61){_0x44be2c[_0x8a47('0xd')]=_0x7b6e61[_0x8a47('0xd')];_0x44be2c['agentacw']=_0x44be2c[_0x8a47('0xe')]?_0x7b6e61[_0x8a47('0xf')]:![];_0x44be2c['acwtime']=_0x44be2c[_0x8a47('0x10')]?_0x7b6e61['acwTimeout']:0x0;}utils[_0x8a47('0x11')](_0x8a47('0x12'),_0x44be2c);});}else{utils[_0x8a47('0x11')]('CreateVoiceAgentReport',_0x44be2c);}if(_0x2c3f60){delete transfers[_0x44be2c['uniqueid']];}else{delete agents[_0x44be2c['destuniqueid']];}}exports[_0x8a47('0x13')]=function(_0x12539c){try{utils['debug'](util[_0x8a47('0x4')](_0x8a47('0x14'),_0x12539c[_0x8a47('0x6')]),_0x12539c);agents[_0x12539c[_0x8a47('0x15')]]=_0x12539c;agents[_0x12539c[_0x8a47('0x15')]][_0x8a47('0x16')]=utils[_0x8a47('0x17')]();agents[_0x12539c[_0x8a47('0x15')]][_0x8a47('0xc')]=_0x8a47('0x18');agents[_0x12539c[_0x8a47('0x15')]][_0x8a47('0xb')]=null;agents[_0x12539c[_0x8a47('0x15')]]['connectedlinename']=null;utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x19'),_0x12539c['uniqueid'],agents[_0x12539c[_0x8a47('0x15')]]['membername'],_0x12539c['destuniqueid']));}catch(_0x1cf650){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x14'),_0x12539c[_0x8a47('0x6')]),_0x1cf650);}};exports[_0x8a47('0x1b')]=function(_0x44e119){try{if(!_[_0x8a47('0x1c')](agents[_0x44e119[_0x8a47('0x15')]])){utils[_0x8a47('0x1d')](util['format'](_0x8a47('0x1e'),_0x44e119['uniqueid']),_0x44e119);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x1f'),_0x44e119[_0x8a47('0x6')],agents[_0x44e119['destuniqueid']][_0x8a47('0x9')],_0x44e119['destuniqueid']));agents[_0x44e119['destuniqueid']]['agentringnoanswer']=!![];agents[_0x44e119['destuniqueid']][_0x8a47('0x20')]=utils[_0x8a47('0x17')]();agents[_0x44e119['destuniqueid']][_0x8a47('0xc')]=_0x8a47('0x21');agents[_0x44e119[_0x8a47('0x15')]][_0x8a47('0x22')]=_0x8a47('0x21');agents[_0x44e119[_0x8a47('0x15')]][_0x8a47('0x23')]=_0x44e119['ringtime']?parseInt(_0x44e119[_0x8a47('0x24')])/0x3e8:0x0;agents[_0x44e119['destuniqueid']][_0x8a47('0x25')]=0x0;unanswered[_0x8a47('0x26')](_0x44e119['destuniqueid']);}}catch(_0x1e89b1){utils['error'](util['format'](_0x8a47('0x1e'),_0x44e119[_0x8a47('0x6')]),_0x1e89b1);}};exports[_0x8a47('0x27')]=function(_0x12f0b7){try{_[_0x8a47('0x28')](agents,function(_0x18bfd3,_0x58aa06){if(_0x18bfd3[_0x8a47('0x6')]==_0x12f0b7['uniqueid']&&!_['includes'](unanswered,_0x18bfd3[_0x8a47('0x15')])){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x29'),_0x12f0b7[_0x8a47('0x6')]),_0x12f0b7);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x2a'),_0x12f0b7[_0x8a47('0x6')],_0x18bfd3[_0x8a47('0x9')],_0x18bfd3['destuniqueid']));_0x18bfd3[_0x8a47('0x1b')]=!![];_0x18bfd3[_0x8a47('0x20')]=utils[_0x8a47('0x17')]();_0x18bfd3['lastevent']=_0x8a47('0x2b');_0x18bfd3[_0x8a47('0x22')]='abandoned';_0x18bfd3[_0x8a47('0x23')]=_0x12f0b7[_0x8a47('0x23')];_0x18bfd3[_0x8a47('0x25')]=0x0;writeDB(_0x18bfd3);}});}catch(_0x20551b){utils['error'](util['format'](_0x8a47('0x29'),_0x12f0b7[_0x8a47('0x6')]),_0x20551b);}};exports[_0x8a47('0x2c')]=function(_0x42c5d7){try{if(agents[_0x42c5d7[_0x8a47('0x15')]]){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')]('[%s][agents][agentconnect]',_0x42c5d7['uniqueid']),_0x42c5d7);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x2d'),_0x42c5d7[_0x8a47('0x6')],agents[_0x42c5d7[_0x8a47('0x15')]][_0x8a47('0x9')],_0x42c5d7[_0x8a47('0x15')]));agents[_0x42c5d7[_0x8a47('0x15')]][_0x8a47('0x2e')]=utils[_0x8a47('0x17')]();agents[_0x42c5d7[_0x8a47('0x15')]]['connectedlinenum']=_0x42c5d7[_0x8a47('0xb')];agents[_0x42c5d7['destuniqueid']]['connectedlinename']=_0x42c5d7['connectedlinename'];agents[_0x42c5d7['destuniqueid']]['holdtime']=_0x42c5d7[_0x8a47('0x24')];agents[_0x42c5d7[_0x8a47('0x15')]][_0x8a47('0xc')]=_0x8a47('0x2f');_[_0x8a47('0x28')](agents,function(_0x20ba1c,_0x25c45b){if(_0x20ba1c[_0x8a47('0x15')]!=_0x42c5d7['destuniqueid']&&_0x20ba1c['uniqueid']==_0x42c5d7[_0x8a47('0x6')]){_0x20ba1c[_0x8a47('0x25')]=0x0;_0x20ba1c[_0x8a47('0x23')]=_0x42c5d7[_0x8a47('0x24')];_0x20ba1c['agentringnoanswer']=!![];_0x20ba1c[_0x8a47('0x20')]=utils[_0x8a47('0x17')]();_0x20ba1c[_0x8a47('0xc')]=_0x8a47('0x30');_0x20ba1c[_0x8a47('0x22')]='answered_elsewhere';_0x20ba1c[_0x8a47('0x31')]=_0x42c5d7[_0x8a47('0x15')];_0x20ba1c[_0x8a47('0x32')]=_0x42c5d7['membername'];writeDB(_0x20ba1c);}});}}catch(_0x2b3874){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x33'),_0x42c5d7['uniqueid']),_0x2b3874);}};exports[_0x8a47('0xe')]=function(_0x2f523f){try{if(!_[_0x8a47('0x1c')](agents[_0x2f523f[_0x8a47('0x15')]])){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')]('[%s][agents][agentcomplete]',_0x2f523f['uniqueid']),_0x2f523f);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x34'),_0x2f523f['uniqueid'],agents[_0x2f523f[_0x8a47('0x15')]][_0x8a47('0x9')],_0x2f523f['destuniqueid']));agents[_0x2f523f['destuniqueid']][_0x8a47('0xe')]=!![];agents[_0x2f523f['destuniqueid']][_0x8a47('0x35')]=utils[_0x8a47('0x17')]();agents[_0x2f523f[_0x8a47('0x15')]][_0x8a47('0x25')]=utils[_0x8a47('0x36')](agents[_0x2f523f[_0x8a47('0x15')]]['agentcompleteAt'],agents[_0x2f523f['destuniqueid']][_0x8a47('0x2e')]);agents[_0x2f523f[_0x8a47('0x15')]][_0x8a47('0x22')]=_0x2f523f[_0x8a47('0x22')];agents[_0x2f523f[_0x8a47('0x15')]]['lastevent']='complete';writeDB(agents[_0x2f523f[_0x8a47('0x15')]]);}}catch(_0x531faa){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')]('[%s][agents][agentcomplete]',_0x2f523f[_0x8a47('0x6')]),_0x531faa);}};exports[_0x8a47('0x37')]=function(_0x14e22c){try{if(!_[_0x8a47('0x1c')](agents[_0x14e22c[_0x8a47('0x38')]])){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x39'),_0x14e22c['uniqueid']),_0x14e22c);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x3a'),_0x14e22c[_0x8a47('0x6')],agents[_0x14e22c['transfereruniqueid']][_0x8a47('0x9')],agents[_0x14e22c[_0x8a47('0x38')]][_0x8a47('0x6')]));agents[_0x14e22c[_0x8a47('0x38')]][_0x8a47('0x3b')]=!![];agents[_0x14e22c[_0x8a47('0x38')]]['transfertype']='blind';agents[_0x14e22c[_0x8a47('0x38')]]['transferexten']=_0x14e22c[_0x8a47('0x3c')];agents[_0x14e22c[_0x8a47('0x38')]]['transferuniqueid']=agents[_0x14e22c[_0x8a47('0x38')]]['uniqueid'];}}catch(_0x315111){utils['error'](util[_0x8a47('0x4')]('[%s][agents][blindtransfer]',_0x14e22c[_0x8a47('0x6')]),_0x315111);}};exports[_0x8a47('0x3d')]=function(_0xdaa896){try{utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x3e'),_0xdaa896[_0x8a47('0x3f')]),_0xdaa896);if(_0xdaa896[_0x8a47('0x3f')]==_0xdaa896[_0x8a47('0x40')]){if(!_[_0x8a47('0x1c')](agents[_0xdaa896[_0x8a47('0x41')]])){utils['info'](util[_0x8a47('0x4')](_0x8a47('0x42'),_0xdaa896['origtransfereruniqueid'],agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x9')]));agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x3b')]=!![];agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x43')]=_0x8a47('0x44');agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x45')]=_0xdaa896[_0x8a47('0x46')];agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x47')]=_0xdaa896['origtransfereruniqueid'];}if(_0xdaa896[_0x8a47('0x48')]&&agents[_0xdaa896[_0x8a47('0x48')]]){agents[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x49')]=0x1;transfers[_0xdaa896[_0x8a47('0x48')]]=_[_0x8a47('0x4a')](agents[_0xdaa896[_0x8a47('0x48')]]);transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0xa')]=agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0xa')];transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x4b')]=agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x4b')];transfers[_0xdaa896[_0x8a47('0x48')]]['agentcalledAt']=utils[_0x8a47('0x17')]();transfers[_0xdaa896['transfereeuniqueid']][_0x8a47('0x2e')]=utils[_0x8a47('0x17')]();transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x23')]=0x0;transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x49')]=0x2;}}else if(_0xdaa896['secondtransfereruniqueid']==_0xdaa896[_0x8a47('0x4c')]){if(!_[_0x8a47('0x1c')](agents[_0xdaa896[_0x8a47('0x3f')]])){utils['info'](util['format'](_0x8a47('0x42'),_0xdaa896[_0x8a47('0x3f')],agents[_0xdaa896['origtransfereruniqueid']][_0x8a47('0x9')]));agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x3b')]=!![];agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x43')]=_0x8a47('0x44');agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x45')]=_0xdaa896[_0x8a47('0x4d')];agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x47')]=_0xdaa896[_0x8a47('0x41')];}if(_0xdaa896[_0x8a47('0x4e')]&&agents[_0xdaa896['transfertargetuniqueid']]){agents[_0xdaa896[_0x8a47('0x4e')]][_0x8a47('0x49')]=0x1;transfers[_0xdaa896[_0x8a47('0x4e')]]=_[_0x8a47('0x4a')](agents[_0xdaa896[_0x8a47('0x4e')]]);transfers[_0xdaa896[_0x8a47('0x4e')]]['calleridnum']=agents[_0xdaa896[_0x8a47('0x3f')]]['calleridnum'];transfers[_0xdaa896['transfertargetuniqueid']][_0x8a47('0x4b')]=agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x4b')];transfers[_0xdaa896[_0x8a47('0x4e')]][_0x8a47('0x16')]=utils[_0x8a47('0x17')]();transfers[_0xdaa896['transfertargetuniqueid']]['agentconnectAt']=utils[_0x8a47('0x17')]();transfers[_0xdaa896['transfertargetuniqueid']][_0x8a47('0x23')]=0x0;transfers[_0xdaa896[_0x8a47('0x4e')]][_0x8a47('0x49')]=0x2;}}}catch(_0x39d8f4){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x3e'),_0xdaa896[_0x8a47('0x3f')]),_0x39d8f4);}};exports['hangup']=function(_0x5c1e7e){try{utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x4f'),_0x5c1e7e['uniqueid']),_0x5c1e7e);if(agents[_0x5c1e7e['uniqueid']]&&agents[_0x5c1e7e['uniqueid']][_0x8a47('0x22')]==='timeout'){if(_0x5c1e7e[_0x8a47('0x50')]==='21'){agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x22')]=_0x8a47('0x51');agents[_0x5c1e7e['uniqueid']][_0x8a47('0xc')]='rejected';}utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x52'),_0x5c1e7e['uniqueid'],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x9')],agents[_0x5c1e7e['uniqueid']][_0x8a47('0x22')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]));writeDB(agents[_0x5c1e7e[_0x8a47('0x6')]]);var _0x4c6dbe=unanswered[_0x8a47('0x53')](_0x5c1e7e[_0x8a47('0x6')]);if(_0x4c6dbe>-0x1){unanswered[_0x8a47('0x54')](_0x4c6dbe,0x1);}}if(transfers[_0x5c1e7e['uniqueid']]){transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xe')]=!![];transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x35')]=utils[_0x8a47('0x17')]();transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x25')]=utils[_0x8a47('0x36')](transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x35')],transfers[_0x5c1e7e[_0x8a47('0x6')]]['agentconnectAt']);transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x22')]=_0x8a47('0x55');transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]=_0x8a47('0x56');utils[_0x8a47('0x3')](util[_0x8a47('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5c1e7e[_0x8a47('0x6')],transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x9')],transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x22')],transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]));writeDB(transfers[_0x5c1e7e[_0x8a47('0x6')]],!![]);}if(agents[_0x5c1e7e[_0x8a47('0x6')]]&&agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x2e')]){agents[_0x5c1e7e[_0x8a47('0x6')]]['agentcomplete']=!![];agents[_0x5c1e7e['uniqueid']][_0x8a47('0x35')]=utils[_0x8a47('0x17')]();agents[_0x5c1e7e[_0x8a47('0x6')]]['talktime']=utils[_0x8a47('0x36')](agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x35')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x2e')]);agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x22')]=agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x3b')]?_0x8a47('0x3b'):_0x8a47('0x55');agents[_0x5c1e7e[_0x8a47('0x6')]]['lastevent']=_0x8a47('0x56');utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x52'),_0x5c1e7e[_0x8a47('0x6')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x9')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x22')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]));writeDB(agents[_0x5c1e7e['uniqueid']]);}}catch(_0x98d7ae){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x4f'),_0x5c1e7e[_0x8a47('0x6')]),_0x98d7ae);}}; \ No newline at end of file +var _0xc788=['transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','queue','then','type','agentcomplete','acwtime','agentacw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','timeout','holdtime','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','reason','talktime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','isNil','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten'];(function(_0x33cdc1,_0x5ca5e6){var _0x532bc5=function(_0x307198){while(--_0x307198){_0x33cdc1['push'](_0x33cdc1['shift']());}};_0x532bc5(++_0x5ca5e6);}(_0xc788,0xc4));var _0x8c78=function(_0x2bcddb,_0x3eaf37){_0x2bcddb=_0x2bcddb-0x0;var _0x12a9e8=_0xc788[_0x2bcddb];return _0x12a9e8;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var utils=require(_0x8c78('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4ecb26,_0x4ce125){utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x5'),_0x4ecb26[_0x8c78('0x6')],_0x4ecb26[_0x8c78('0x7')],_0x4ecb26['queue'],_0x4ecb26[_0x8c78('0x8')],_0x4ecb26[_0x8c78('0x9')],_0x4ecb26[_0x8c78('0xa')],_0x4ecb26[_0x8c78('0xb')],_0x4ecb26[_0x8c78('0xc')]));if(_0x4ecb26['queue']){utils[_0x8c78('0xd')](_0x4ecb26[_0x8c78('0xe')])[_0x8c78('0xf')](function(_0x39c0e5){if(_0x39c0e5){_0x4ecb26[_0x8c78('0x10')]=_0x39c0e5[_0x8c78('0x10')];_0x4ecb26['agentacw']=_0x4ecb26[_0x8c78('0x11')]?_0x39c0e5['acw']:![];_0x4ecb26[_0x8c78('0x12')]=_0x4ecb26[_0x8c78('0x13')]?_0x39c0e5['acwTimeout']:0x0;}utils[_0x8c78('0x14')](_0x8c78('0x15'),_0x4ecb26);});}else{utils['request'](_0x8c78('0x15'),_0x4ecb26);}if(_0x4ce125){delete transfers[_0x4ecb26['uniqueid']];}else{delete agents[_0x4ecb26['destuniqueid']];}}exports[_0x8c78('0x16')]=function(_0x1b1d0e){try{utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x18'),_0x1b1d0e[_0x8c78('0x6')]),_0x1b1d0e);agents[_0x1b1d0e[_0x8c78('0x19')]]=_0x1b1d0e;agents[_0x1b1d0e[_0x8c78('0x19')]][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();agents[_0x1b1d0e['destuniqueid']][_0x8c78('0xc')]=_0x8c78('0x1c');agents[_0x1b1d0e['destuniqueid']][_0x8c78('0xb')]=null;agents[_0x1b1d0e[_0x8c78('0x19')]][_0x8c78('0x1d')]=null;utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x1e'),_0x1b1d0e['uniqueid'],agents[_0x1b1d0e['destuniqueid']][_0x8c78('0x8')],_0x1b1d0e['destuniqueid']));}catch(_0x56801a){utils[_0x8c78('0x1f')](util['format'](_0x8c78('0x18'),_0x1b1d0e[_0x8c78('0x6')]),_0x56801a);}};exports['agentringnoanswer']=function(_0x6c9a12){try{if(!_['isNil'](agents[_0x6c9a12[_0x8c78('0x19')]])){utils[_0x8c78('0x17')](util['format'](_0x8c78('0x20'),_0x6c9a12[_0x8c78('0x6')]),_0x6c9a12);utils['info'](util[_0x8c78('0x4')](_0x8c78('0x21'),_0x6c9a12[_0x8c78('0x6')],agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x8')],_0x6c9a12[_0x8c78('0x19')]));agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x22')]=!![];agents[_0x6c9a12[_0x8c78('0x19')]]['agentringnoanswerAt']=utils[_0x8c78('0x1b')]();agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0xc')]='timeout';agents[_0x6c9a12[_0x8c78('0x19')]]['reason']=_0x8c78('0x23');agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x24')]=_0x6c9a12['ringtime']?parseInt(_0x6c9a12[_0x8c78('0x25')])/0x3e8:0x0;agents[_0x6c9a12[_0x8c78('0x19')]]['talktime']=0x0;unanswered[_0x8c78('0x26')](_0x6c9a12[_0x8c78('0x19')]);}}catch(_0x394c1d){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x20'),_0x6c9a12['uniqueid']),_0x394c1d);}};exports[_0x8c78('0x27')]=function(_0x51add6){try{_[_0x8c78('0x28')](agents,function(_0x17f4c8,_0xb69c52){if(_0x17f4c8['uniqueid']==_0x51add6[_0x8c78('0x6')]&&!_[_0x8c78('0x29')](unanswered,_0x17f4c8['destuniqueid'])){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x2a'),_0x51add6['uniqueid']),_0x51add6);utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x2b'),_0x51add6['uniqueid'],_0x17f4c8[_0x8c78('0x8')],_0x17f4c8[_0x8c78('0x19')]));_0x17f4c8['agentringnoanswer']=!![];_0x17f4c8[_0x8c78('0x2c')]=utils[_0x8c78('0x1b')]();_0x17f4c8[_0x8c78('0xc')]=_0x8c78('0x2d');_0x17f4c8[_0x8c78('0x2e')]=_0x8c78('0x2d');_0x17f4c8[_0x8c78('0x24')]=_0x51add6[_0x8c78('0x24')];_0x17f4c8[_0x8c78('0x2f')]=0x0;writeDB(_0x17f4c8);}});}catch(_0x15a868){utils['error'](util[_0x8c78('0x4')](_0x8c78('0x2a'),_0x51add6[_0x8c78('0x6')]),_0x15a868);}};exports[_0x8c78('0x30')]=function(_0x34481a){try{if(agents[_0x34481a['destuniqueid']]){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x31'),_0x34481a['uniqueid']),_0x34481a);utils[_0x8c78('0x3')](util[_0x8c78('0x4')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x34481a[_0x8c78('0x6')],agents[_0x34481a['destuniqueid']][_0x8c78('0x8')],_0x34481a[_0x8c78('0x19')]));agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0x32')]=utils['now']();agents[_0x34481a[_0x8c78('0x19')]]['connectedlinenum']=_0x34481a[_0x8c78('0xb')];agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0x1d')]=_0x34481a['connectedlinename'];agents[_0x34481a['destuniqueid']][_0x8c78('0x24')]=_0x34481a[_0x8c78('0x25')];agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0xc')]=_0x8c78('0x33');_[_0x8c78('0x28')](agents,function(_0x326b34,_0x314679){if(_0x326b34[_0x8c78('0x19')]!=_0x34481a[_0x8c78('0x19')]&&_0x326b34[_0x8c78('0x6')]==_0x34481a[_0x8c78('0x6')]){_0x326b34[_0x8c78('0x2f')]=0x0;_0x326b34['holdtime']=_0x34481a[_0x8c78('0x25')];_0x326b34[_0x8c78('0x22')]=!![];_0x326b34['agentringnoanswerAt']=utils['now']();_0x326b34[_0x8c78('0xc')]=_0x8c78('0x34');_0x326b34['reason']=_0x8c78('0x34');_0x326b34[_0x8c78('0x35')]=_0x34481a['destuniqueid'];_0x326b34[_0x8c78('0x36')]=_0x34481a[_0x8c78('0x8')];writeDB(_0x326b34);}});}}catch(_0x57e2c7){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x31'),_0x34481a[_0x8c78('0x6')]),_0x57e2c7);}};exports[_0x8c78('0x11')]=function(_0x4e4880){try{if(!_['isNil'](agents[_0x4e4880[_0x8c78('0x19')]])){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x37'),_0x4e4880[_0x8c78('0x6')]),_0x4e4880);utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x38'),_0x4e4880[_0x8c78('0x6')],agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x8')],_0x4e4880['destuniqueid']));agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x11')]=!![];agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x39')]=utils[_0x8c78('0x1b')]();agents[_0x4e4880['destuniqueid']][_0x8c78('0x2f')]=utils[_0x8c78('0x3a')](agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x39')],agents[_0x4e4880[_0x8c78('0x19')]]['agentconnectAt']);agents[_0x4e4880[_0x8c78('0x19')]]['reason']=_0x4e4880['reason'];agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0xc')]=_0x8c78('0x3b');writeDB(agents[_0x4e4880['destuniqueid']]);}}catch(_0x1d78a0){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x37'),_0x4e4880[_0x8c78('0x6')]),_0x1d78a0);}};exports[_0x8c78('0x3c')]=function(_0x26103c){try{if(!_[_0x8c78('0x3d')](agents[_0x26103c[_0x8c78('0x3e')]])){utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x3f'),_0x26103c[_0x8c78('0x6')]),_0x26103c);utils[_0x8c78('0x3')](util['format'](_0x8c78('0x40'),_0x26103c[_0x8c78('0x6')],agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x8')],agents[_0x26103c['transfereruniqueid']][_0x8c78('0x6')]));agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x41')]=!![];agents[_0x26103c['transfereruniqueid']][_0x8c78('0x42')]='blind';agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x43')]=_0x26103c[_0x8c78('0x44')];agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x45')]=agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x6')];}}catch(_0x38fec1){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x3f'),_0x26103c[_0x8c78('0x6')]),_0x38fec1);}};exports[_0x8c78('0x46')]=function(_0x18d896){try{utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x47'),_0x18d896[_0x8c78('0x48')]),_0x18d896);if(_0x18d896[_0x8c78('0x48')]==_0x18d896['origtransfererlinkedid']){if(!_[_0x8c78('0x3d')](agents[_0x18d896[_0x8c78('0x49')]])){utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x4a'),_0x18d896[_0x8c78('0x48')],agents[_0x18d896['secondtransfereruniqueid']][_0x8c78('0x8')]));agents[_0x18d896[_0x8c78('0x49')]]['transfer']=!![];agents[_0x18d896[_0x8c78('0x49')]]['transfertype']=_0x8c78('0x4b');agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x43')]=_0x18d896[_0x8c78('0x4c')];agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x45')]=_0x18d896[_0x8c78('0x48')];}if(_0x18d896['transfereeuniqueid']&&agents[_0x18d896[_0x8c78('0x4d')]]){agents[_0x18d896[_0x8c78('0x4d')]]['agententerreason']=0x1;transfers[_0x18d896[_0x8c78('0x4d')]]=_[_0x8c78('0x4e')](agents[_0x18d896['transfereeuniqueid']]);transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0xa')]=agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0xa')];transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x4f')]=agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x4f')];transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x32')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896['transfereeuniqueid']][_0x8c78('0x24')]=0x0;transfers[_0x18d896['transfereeuniqueid']][_0x8c78('0x50')]=0x2;}}else if(_0x18d896['secondtransfereruniqueid']==_0x18d896['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x18d896[_0x8c78('0x48')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x18d896[_0x8c78('0x48')],agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x8')]));agents[_0x18d896[_0x8c78('0x48')]]['transfer']=!![];agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x42')]=_0x8c78('0x4b');agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x43')]=_0x18d896[_0x8c78('0x51')];agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x45')]=_0x18d896[_0x8c78('0x49')];}if(_0x18d896[_0x8c78('0x52')]&&agents[_0x18d896[_0x8c78('0x52')]]){agents[_0x18d896[_0x8c78('0x52')]][_0x8c78('0x50')]=0x1;transfers[_0x18d896[_0x8c78('0x52')]]=_['clone'](agents[_0x18d896[_0x8c78('0x52')]]);transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0xa')]=agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0xa')];transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x4f')]=agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x4f')];transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x32')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896[_0x8c78('0x52')]]['holdtime']=0x0;transfers[_0x18d896[_0x8c78('0x52')]][_0x8c78('0x50')]=0x2;}}}catch(_0x1015e8){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x47'),_0x18d896[_0x8c78('0x48')]),_0x1015e8);}};exports[_0x8c78('0x53')]=function(_0x240f1e){try{utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x54'),_0x240f1e[_0x8c78('0x6')]),_0x240f1e);if(agents[_0x240f1e[_0x8c78('0x6')]]&&agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')]===_0x8c78('0x23')){if(_0x240f1e[_0x8c78('0x55')]==='21'){agents[_0x240f1e[_0x8c78('0x6')]]['reason']=_0x8c78('0x56');agents[_0x240f1e[_0x8c78('0x6')]]['lastevent']='rejected';}utils[_0x8c78('0x3')](util['format'](_0x8c78('0x57'),_0x240f1e[_0x8c78('0x6')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],agents[_0x240f1e['uniqueid']]['lastevent']));writeDB(agents[_0x240f1e[_0x8c78('0x6')]]);var _0x2d385f=unanswered[_0x8c78('0x58')](_0x240f1e[_0x8c78('0x6')]);if(_0x2d385f>-0x1){unanswered[_0x8c78('0x59')](_0x2d385f,0x1);}}if(transfers[_0x240f1e['uniqueid']]){transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x11')]=!![];transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x39')]=utils[_0x8c78('0x1b')]();transfers[_0x240f1e[_0x8c78('0x6')]]['talktime']=utils[_0x8c78('0x3a')](transfers[_0x240f1e[_0x8c78('0x6')]]['agentcompleteAt'],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x32')]);transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')]=_0x8c78('0x5a');transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]=_0x8c78('0x3b');utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x57'),_0x240f1e[_0x8c78('0x6')],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],transfers[_0x240f1e[_0x8c78('0x6')]]['lastevent']));writeDB(transfers[_0x240f1e[_0x8c78('0x6')]],!![]);}if(agents[_0x240f1e['uniqueid']]&&agents[_0x240f1e['uniqueid']][_0x8c78('0x32')]){agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x11')]=!![];agents[_0x240f1e[_0x8c78('0x6')]]['agentcompleteAt']=utils[_0x8c78('0x1b')]();agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2f')]=utils['diffTime'](agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x39')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x32')]);agents[_0x240f1e['uniqueid']][_0x8c78('0x2e')]=agents[_0x240f1e[_0x8c78('0x6')]]['transfer']?'transfer':'agent';agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]=_0x8c78('0x3b');utils[_0x8c78('0x3')](util['format'](_0x8c78('0x57'),_0x240f1e['uniqueid'],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]));writeDB(agents[_0x240f1e['uniqueid']]);}}catch(_0x5c67c9){utils['error'](util[_0x8c78('0x4')](_0x8c78('0x54'),_0x240f1e['uniqueid']),_0x5c67c9);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b074c54..c91256e 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 _0xbc48=['[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridname','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','_attended','origtransfereruniqueid','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','variable','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','sipcallid','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','lastIndexOf','includes','hangup','noop','execif','set','gotoif','lastdata','lodash','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','channelstate'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbc48,0x111));var _0x8bc4=function(_0x31dbbb,_0x148a95){_0x31dbbb=_0x31dbbb-0x0;var _0xc25e6e=_0xbc48[_0x31dbbb];return _0xc25e6e;};'use strict';var _=require(_0x8bc4('0x0'));var util=require(_0x8bc4('0x1'));var utils=require(_0x8bc4('0x2'));var transfers=require(_0x8bc4('0x3'));var dispositions=['NO\x20ANSWER',_0x8bc4('0x4'),_0x8bc4('0x4'),_0x8bc4('0x5'),_0x8bc4('0x5'),'NO\x20ANSWER',_0x8bc4('0x6'),'BUSY','FAILED','FAILED',_0x8bc4('0x4')];var channels={};function writeDB(_0x5708fe){var _0x58df27;if(transfers[_0x8bc4('0x7')][_0x5708fe['uniqueid']]){_0x58df27=_0x5708fe[_0x8bc4('0x8')];_0x5708fe[_0x8bc4('0x8')]=transfers[_0x8bc4('0x7')][_0x5708fe[_0x8bc4('0x8')]]['transfereeuniqueid'];}utils[_0x8bc4('0x9')](util[_0x8bc4('0xa')](_0x8bc4('0xb'),_0x5708fe[_0x8bc4('0x8')],_0x5708fe[_0x8bc4('0xc')],_0x5708fe[_0x8bc4('0xd')],_0x5708fe[_0x8bc4('0xe')],_0x5708fe[_0x8bc4('0xf')],_0x5708fe[_0x8bc4('0x10')],_0x5708fe[_0x8bc4('0x11')],_0x5708fe[_0x8bc4('0x12')]));if(_0x5708fe[_0x8bc4('0x13')]){utils[_0x8bc4('0x14')](_0x5708fe[_0x8bc4('0x13')])[_0x8bc4('0x15')](function(_0x55e23a){if(_0x55e23a){_0x5708fe[_0x8bc4('0x16')]=_0x55e23a['id'];}utils[_0x8bc4('0x17')](_0x8bc4('0x18'),_0x5708fe);});}else{utils[_0x8bc4('0x17')](_0x8bc4('0x18'),_0x5708fe);}if(channels[_0x5708fe[_0x8bc4('0x8')]]){delete channels[_0x5708fe['uniqueid']];}else if(_0x58df27&&channels[_0x58df27]){if(!transfers['blinds'][_0x58df27]['recording'])delete transfers[_0x8bc4('0x7')][_0x58df27];delete channels[_0x58df27];}}exports['newchannel']=function(_0x2033df){try{utils[_0x8bc4('0x19')](util[_0x8bc4('0xa')]('[%s][calls][newchannel]',_0x2033df[_0x8bc4('0x8')]),_0x2033df);if(_0x2033df[_0x8bc4('0x8')]==_0x2033df['linkedid']&&_0x2033df[_0x8bc4('0xc')]!='OutgoingSpoolFailed'){utils[_0x8bc4('0x9')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x2033df[_0x8bc4('0x8')],_0x2033df[_0x8bc4('0x1a')],_0x2033df[_0x8bc4('0x1b')]));channels[_0x2033df[_0x8bc4('0x8')]]={'uniqueid':_0x2033df[_0x8bc4('0x8')],'accountcode':_0x2033df[_0x8bc4('0x13')],'source':_0x2033df[_0x8bc4('0x10')],'destination':_0x2033df[_0x8bc4('0x1b')],'destinationcontext':_0x2033df[_0x8bc4('0x1a')],'channel':_0x2033df[_0x8bc4('0xc')],'starttime':utils[_0x8bc4('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x8bc4('0x1d')};}}catch(_0x33f5b1){utils[_0x8bc4('0x1e')](util['format'](_0x8bc4('0x1f'),_0x2033df[_0x8bc4('0x8')]),_0x33f5b1);}};exports['newstate']=function(_0x3eac08){try{utils[_0x8bc4('0x19')](util[_0x8bc4('0xa')]('[%s][calls][newstate]',_0x3eac08[_0x8bc4('0x8')]),_0x3eac08);if(!_['isNil'](channels[_0x3eac08['uniqueid']])&&_0x3eac08[_0x8bc4('0x20')]==0x6){utils[_0x8bc4('0x9')](util[_0x8bc4('0xa')](_0x8bc4('0x21'),_0x3eac08[_0x8bc4('0x8')],_0x3eac08[_0x8bc4('0x1a')],_0x3eac08[_0x8bc4('0xc')]));if(_[_0x8bc4('0x22')](channels[_0x3eac08['uniqueid']]['systemanswertime'])){channels[_0x3eac08[_0x8bc4('0x8')]][_0x8bc4('0x23')]=utils[_0x8bc4('0x1c')]();}}else if(!_[_0x8bc4('0x22')](channels[_0x3eac08[_0x8bc4('0x24')]])&&_0x3eac08[_0x8bc4('0x20')]==0x6&&_0x3eac08['context']!=_0x8bc4('0x25')){utils[_0x8bc4('0x9')](util[_0x8bc4('0xa')](_0x8bc4('0x26'),_0x3eac08['uniqueid'],_0x3eac08[_0x8bc4('0x24')],_0x3eac08[_0x8bc4('0x1a')],_0x3eac08[_0x8bc4('0xc')]));channels[_0x3eac08[_0x8bc4('0x24')]][_0x8bc4('0x13')]=_0x3eac08['accountcode'];channels[_0x3eac08[_0x8bc4('0x24')]]['destinationchannel']=_0x3eac08[_0x8bc4('0xc')];if(_[_0x8bc4('0x22')](channels[_0x3eac08[_0x8bc4('0x24')]][_0x8bc4('0x27')])){channels[_0x3eac08['linkedid']]['answertime']=utils[_0x8bc4('0x1c')]();}channels[_0x3eac08[_0x8bc4('0x24')]][_0x8bc4('0x28')]=dispositions[_[_0x8bc4('0x29')](_0x3eac08['channelstate'])]||'ANSWERED';}}catch(_0x592820){utils[_0x8bc4('0x1e')](util[_0x8bc4('0xa')](_0x8bc4('0x2a'),_0x3eac08['uniqueid']),_0x592820);}};exports['hangup']=function(_0x52f358){try{if(!_['isNil'](channels[_0x52f358['uniqueid']])){utils[_0x8bc4('0x19')](util[_0x8bc4('0xa')](_0x8bc4('0x2b'),_0x52f358['uniqueid']),_0x52f358);if(_[_0x8bc4('0x22')](channels[_0x52f358[_0x8bc4('0x8')]][_0x8bc4('0x2c')])){channels[_0x52f358['uniqueid']][_0x8bc4('0x2c')]=_0x52f358[_0x8bc4('0x2d')]+'\x20<'+_0x52f358[_0x8bc4('0x10')]+'>';}utils[_0x8bc4('0x9')](util[_0x8bc4('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x52f358[_0x8bc4('0x8')],channels[_0x52f358[_0x8bc4('0x8')]][_0x8bc4('0x2c')],_0x52f358['cause-txt']));channels[_0x52f358[_0x8bc4('0x8')]][_0x8bc4('0x2e')]=utils[_0x8bc4('0x1c')]();channels[_0x52f358[_0x8bc4('0x8')]][_0x8bc4('0x2f')]=utils[_0x8bc4('0x30')](channels[_0x52f358[_0x8bc4('0x8')]][_0x8bc4('0x2e')],channels[_0x52f358[_0x8bc4('0x8')]][_0x8bc4('0x31')]);channels[_0x52f358[_0x8bc4('0x8')]]['billableseconds']=channels[_0x52f358['uniqueid']][_0x8bc4('0x27')]?utils[_0x8bc4('0x30')](channels[_0x52f358['uniqueid']][_0x8bc4('0x2e')],channels[_0x52f358[_0x8bc4('0x8')]][_0x8bc4('0x27')]):0x0;writeDB(channels[_0x52f358['uniqueid']]);}}catch(_0x513aa5){utils[_0x8bc4('0x1e')](util[_0x8bc4('0xa')](_0x8bc4('0x2b'),_0x52f358[_0x8bc4('0x8')]),_0x513aa5);}};exports[_0x8bc4('0x32')]=function(_0x38789a){try{if(!_[_0x8bc4('0x22')](channels[_0x38789a['localtwolinkedid']])){utils['debug'](util[_0x8bc4('0xa')]('[%s][calls][attendedtransfer]',_0x38789a['origtransfereruniqueid']),_0x38789a);if(channels[_0x38789a[_0x8bc4('0x33')]][_0x8bc4('0xc')]==_0x38789a[_0x8bc4('0x34')]){utils[_0x8bc4('0x9')](util[_0x8bc4('0xa')](_0x8bc4('0x35'),_0x38789a['origtransfereruniqueid'],_0x38789a[_0x8bc4('0x33')],_0x38789a[_0x8bc4('0x36')]));channels[_0x38789a['localtwolinkedid']][_0x8bc4('0x37')]=_0x38789a['secondtransfererchannel'];channels[_0x38789a[_0x8bc4('0x33')]]['userfield']=_0x8bc4('0x38');}else if(channels[_0x38789a[_0x8bc4('0x33')]][_0x8bc4('0xc')]=_0x38789a['transfertargetchannel']){utils[_0x8bc4('0x9')](util[_0x8bc4('0xa')](_0x8bc4('0x35'),_0x38789a[_0x8bc4('0x39')],_0x38789a['localtwolinkedid'],_0x38789a['origtransfererchannel']));channels[_0x38789a[_0x8bc4('0x33')]][_0x8bc4('0x37')]=_0x38789a[_0x8bc4('0x3a')];channels[_0x38789a['localtwolinkedid']]['userfield']=_0x8bc4('0x38');}}}catch(_0x546553){utils[_0x8bc4('0x1e')](util[_0x8bc4('0xa')](_0x8bc4('0x3b'),_0x38789a[_0x8bc4('0x39')]),_0x546553);}};exports[_0x8bc4('0x3c')]=function(_0x122540){try{if(!_[_0x8bc4('0x22')](channels[_0x122540[_0x8bc4('0x8')]])){utils[_0x8bc4('0x19')](util[_0x8bc4('0xa')](_0x8bc4('0x3d'),_0x122540[_0x8bc4('0x8')]),_0x122540);channels[_0x122540[_0x8bc4('0x8')]][_0x8bc4('0x3e')]=utils[_0x8bc4('0x1c')]();utils[_0x8bc4('0x9')](util['format'](_0x8bc4('0x3f'),_0x122540[_0x8bc4('0x8')],channels[_0x122540[_0x8bc4('0x8')]][_0x8bc4('0x3e')]));}}catch(_0x6e4f07){utils[_0x8bc4('0x1e')](util[_0x8bc4('0xa')](_0x8bc4('0x3d'),_0x122540['uniqueid']),_0x6e4f07);}};exports[_0x8bc4('0x40')]=function(_0x42bc1f){try{if(!_[_0x8bc4('0x22')](channels[_0x42bc1f[_0x8bc4('0x8')]])){utils['debug'](util[_0x8bc4('0xa')]('[%s][calls][musiconholdstop]',_0x42bc1f[_0x8bc4('0x8')]),_0x42bc1f);if(!_['isNil'](channels[_0x42bc1f[_0x8bc4('0x8')]][_0x8bc4('0x3e')])){channels[_0x42bc1f[_0x8bc4('0x8')]]['mohtime']+=utils[_0x8bc4('0x30')](utils[_0x8bc4('0x1c')](),channels[_0x42bc1f['uniqueid']]['musiconholdstartAt']);utils[_0x8bc4('0x9')](util['format'](_0x8bc4('0x41'),_0x42bc1f[_0x8bc4('0x8')],channels[_0x42bc1f[_0x8bc4('0x8')]]['mohtime']));delete channels[_0x42bc1f[_0x8bc4('0x8')]]['musiconholdstartAt'];}}}catch(_0x2a2ab1){utils[_0x8bc4('0x1e')](util[_0x8bc4('0xa')]('[%s][calls][musiconholdstop]',_0x42bc1f[_0x8bc4('0x8')]),_0x2a2ab1);}};exports[_0x8bc4('0x42')]=function(_0x5b3799){try{if(!_[_0x8bc4('0x22')](channels[_0x5b3799['uniqueid']])){utils[_0x8bc4('0x19')](util[_0x8bc4('0xa')](_0x8bc4('0x43'),_0x5b3799[_0x8bc4('0x8')]),_0x5b3799);if(!_[_0x8bc4('0x22')](_0x5b3799['variable'][_0x8bc4('0x44')])){utils['info'](util[_0x8bc4('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5b3799[_0x8bc4('0x8')],_0x5b3799['value']));channels[_0x5b3799[_0x8bc4('0x8')]]['source']=_0x5b3799[_0x8bc4('0x45')];}if(!_['isNil'](_0x5b3799['variable'][_0x8bc4('0x46')])){utils[_0x8bc4('0x9')](util['format'](_0x8bc4('0x47'),_0x5b3799[_0x8bc4('0x8')],_0x5b3799[_0x8bc4('0x45')]));channels[_0x5b3799['uniqueid']][_0x8bc4('0x48')]=_0x5b3799[_0x8bc4('0x45')];channels[_0x5b3799[_0x8bc4('0x8')]][_0x8bc4('0x2c')]='\x22'+_0x5b3799[_0x8bc4('0x45')]+_0x8bc4('0x49')+_0x5b3799[_0x8bc4('0x45')]+'>';}if(!_[_0x8bc4('0x22')](_0x5b3799[_0x8bc4('0x4a')][_0x8bc4('0x4b')])||!_['isNil'](_0x5b3799[_0x8bc4('0x4a')]['xmd-callerid'])){utils[_0x8bc4('0x9')](util[_0x8bc4('0xa')](_0x8bc4('0x4c'),_0x5b3799[_0x8bc4('0x8')],!_[_0x8bc4('0x22')](_0x5b3799['variable']['xmd-callerid-preview'])?_0x8bc4('0x4b'):'xmd-callerid',_0x5b3799[_0x8bc4('0x45')]));channels[_0x5b3799[_0x8bc4('0x8')]][_0x8bc4('0x2c')]=_0x5b3799['value'];}if(!_[_0x8bc4('0x22')](_0x5b3799[_0x8bc4('0x4a')][_0x8bc4('0x4d')])||!_[_0x8bc4('0x22')](_0x5b3799['variable'][_0x8bc4('0x4e')])){utils[_0x8bc4('0x9')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5b3799[_0x8bc4('0x8')],!_[_0x8bc4('0x22')](_0x5b3799[_0x8bc4('0x4a')]['xmd-queue'])?_0x8bc4('0x4d'):'xmcs-queue',_0x5b3799['value']));channels[_0x5b3799[_0x8bc4('0x8')]][_0x8bc4('0x4f')]=_0x8bc4('0x50');channels[_0x5b3799[_0x8bc4('0x8')]]['lastdata']=_0x5b3799[_0x8bc4('0x45')];channels[_0x5b3799['uniqueid']][_0x8bc4('0xd')]=!![];}if(!_[_0x8bc4('0x22')](_0x5b3799[_0x8bc4('0x4a')][_0x8bc4('0x51')])){utils[_0x8bc4('0x9')](util['format'](_0x8bc4('0x52'),_0x5b3799['uniqueid'],_0x5b3799['value']));channels[_0x5b3799[_0x8bc4('0x8')]]['ContactId']=_0x5b3799['value'];}if(!_[_0x8bc4('0x22')](_0x5b3799[_0x8bc4('0x4a')][_0x8bc4('0x53')])){utils[_0x8bc4('0x9')](util[_0x8bc4('0xa')](_0x8bc4('0x54'),_0x5b3799[_0x8bc4('0x8')],_0x5b3799[_0x8bc4('0x45')]));channels[_0x5b3799[_0x8bc4('0x8')]]['type']=_0x5b3799[_0x8bc4('0x45')];}if(!_[_0x8bc4('0x22')](_0x5b3799[_0x8bc4('0x4a')][_0x8bc4('0x55')])){utils[_0x8bc4('0x9')](util[_0x8bc4('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5b3799[_0x8bc4('0x8')],_0x5b3799[_0x8bc4('0x45')]));channels[_0x5b3799['uniqueid']]['routeid']=_0x5b3799['value'];}if(!_['isNil'](_0x5b3799[_0x8bc4('0x4a')][_0x8bc4('0x56')])){utils[_0x8bc4('0x9')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x5b3799[_0x8bc4('0x8')],_0x5b3799[_0x8bc4('0x45')]));channels[_0x5b3799[_0x8bc4('0x8')]][_0x8bc4('0x56')]=_0x5b3799[_0x8bc4('0x45')];}}}catch(_0x3b2788){utils[_0x8bc4('0x1e')](util[_0x8bc4('0xa')](_0x8bc4('0x43'),_0x5b3799[_0x8bc4('0x8')]),_0x3b2788);}};exports['newexten']=function(_0x22f949){try{if(!_[_0x8bc4('0x22')](channels[_0x22f949[_0x8bc4('0x8')]])){utils[_0x8bc4('0x19')](util['format']('[%s][calls][newexten]',_0x22f949[_0x8bc4('0x8')]),_0x22f949);utils[_0x8bc4('0x9')](util[_0x8bc4('0xa')](_0x8bc4('0x57'),_0x22f949[_0x8bc4('0x8')],_0x22f949[_0x8bc4('0x58')],_0x22f949[_0x8bc4('0x59')]));if(_0x22f949[_0x8bc4('0x58')][_0x8bc4('0x5a')]()=='set'&&_[_0x8bc4('0x5b')](_0x22f949[_0x8bc4('0x59')][_0x8bc4('0x5a')](),_0x8bc4('0x5c'))){var _0x4a47fe=_0x22f949[_0x8bc4('0x59')][_0x8bc4('0x5d')]('=');var _0x35bda3=_0x4a47fe[0x0]['substring'](_0x4a47fe[0x0][_0x8bc4('0x5e')]('(')+0x1,_0x4a47fe[0x0][_0x8bc4('0x5e')](')'));var _0x4e4f44=_0x4a47fe[0x1];channels[_0x22f949[_0x8bc4('0x8')]][_0x35bda3]=_0x4e4f44;}if(!_[_0x8bc4('0x5f')]([_0x8bc4('0x60'),_0x8bc4('0x61'),_0x8bc4('0x62'),_0x8bc4('0x63'),_0x8bc4('0x64')],_0x22f949['application'][_0x8bc4('0x5a')]())){channels[_0x22f949['uniqueid']][_0x8bc4('0x4f')]=_0x22f949[_0x8bc4('0x58')];channels[_0x22f949[_0x8bc4('0x8')]][_0x8bc4('0x65')]=_0x22f949[_0x8bc4('0x59')];}}}catch(_0x53a01c){utils[_0x8bc4('0x1e')](util[_0x8bc4('0xa')]('[%s][calls][newexten]',_0x22f949['uniqueid']),_0x53a01c);}}; \ No newline at end of file +var _0xe0ad=['OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lastapplication','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','recording','newchannel','linkedid'];(function(_0x27e5fb,_0x99294d){var _0x222513=function(_0x2a2535){while(--_0x2a2535){_0x27e5fb['push'](_0x27e5fb['shift']());}};_0x222513(++_0x99294d);}(_0xe0ad,0x1a5));var _0xde0a=function(_0x1d7880,_0x5f51e0){_0x1d7880=_0x1d7880-0x0;var _0xf5aede=_0xe0ad[_0x1d7880];return _0xf5aede;};'use strict';var _=require(_0xde0a('0x0'));var util=require('util');var utils=require(_0xde0a('0x1'));var transfers=require(_0xde0a('0x2'));var dispositions=[_0xde0a('0x3'),_0xde0a('0x4'),'FAILED',_0xde0a('0x3'),_0xde0a('0x3'),_0xde0a('0x3'),_0xde0a('0x5'),_0xde0a('0x6'),_0xde0a('0x4'),_0xde0a('0x4'),_0xde0a('0x4')];var channels={};function writeDB(_0x153450){var _0x2e25a3;if(transfers[_0xde0a('0x7')][_0x153450[_0xde0a('0x8')]]){_0x2e25a3=_0x153450[_0xde0a('0x8')];_0x153450[_0xde0a('0x8')]=transfers[_0xde0a('0x7')][_0x153450[_0xde0a('0x8')]][_0xde0a('0x9')];}utils['info'](util[_0xde0a('0xa')](_0xde0a('0xb'),_0x153450['uniqueid'],_0x153450[_0xde0a('0xc')],_0x153450[_0xde0a('0xd')],_0x153450[_0xde0a('0xe')],_0x153450[_0xde0a('0xf')],_0x153450[_0xde0a('0x10')],_0x153450[_0xde0a('0x11')],_0x153450[_0xde0a('0x12')]));if(_0x153450[_0xde0a('0x13')]){utils['getUserByInternal'](_0x153450[_0xde0a('0x13')])[_0xde0a('0x14')](function(_0x50dba6){if(_0x50dba6){_0x153450[_0xde0a('0x15')]=_0x50dba6['id'];}utils[_0xde0a('0x16')](_0xde0a('0x17'),_0x153450);});}else{utils[_0xde0a('0x16')](_0xde0a('0x17'),_0x153450);}if(channels[_0x153450['uniqueid']]){delete channels[_0x153450[_0xde0a('0x8')]];}else if(_0x2e25a3&&channels[_0x2e25a3]){if(!transfers[_0xde0a('0x7')][_0x2e25a3][_0xde0a('0x18')])delete transfers[_0xde0a('0x7')][_0x2e25a3];delete channels[_0x2e25a3];}}exports[_0xde0a('0x19')]=function(_0x4e1b2a){try{utils['debug'](util['format']('[%s][calls][newchannel]',_0x4e1b2a[_0xde0a('0x8')]),_0x4e1b2a);if(_0x4e1b2a['uniqueid']==_0x4e1b2a[_0xde0a('0x1a')]&&_0x4e1b2a['channel']!=_0xde0a('0x1b')){utils[_0xde0a('0x1c')](util['format'](_0xde0a('0x1d'),_0x4e1b2a[_0xde0a('0x8')],_0x4e1b2a[_0xde0a('0x1e')],_0x4e1b2a[_0xde0a('0x1f')]));channels[_0x4e1b2a['uniqueid']]={'uniqueid':_0x4e1b2a['uniqueid'],'accountcode':_0x4e1b2a[_0xde0a('0x13')],'source':_0x4e1b2a[_0xde0a('0x10')],'destination':_0x4e1b2a['exten'],'destinationcontext':_0x4e1b2a[_0xde0a('0x1e')],'channel':_0x4e1b2a['channel'],'starttime':utils[_0xde0a('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xde0a('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x2dee8a){utils[_0xde0a('0x21')](util[_0xde0a('0xa')]('[%s][calls][newchannel]',_0x4e1b2a[_0xde0a('0x8')]),_0x2dee8a);}};exports['newstate']=function(_0x419887){try{utils[_0xde0a('0x22')](util[_0xde0a('0xa')](_0xde0a('0x23'),_0x419887[_0xde0a('0x8')]),_0x419887);if(!_[_0xde0a('0x24')](channels[_0x419887[_0xde0a('0x8')]])&&_0x419887[_0xde0a('0x25')]==0x6){utils[_0xde0a('0x1c')](util['format'](_0xde0a('0x26'),_0x419887['uniqueid'],_0x419887[_0xde0a('0x1e')],_0x419887['channel']));if(_['isNil'](channels[_0x419887[_0xde0a('0x8')]][_0xde0a('0x27')])){channels[_0x419887[_0xde0a('0x8')]][_0xde0a('0x27')]=utils['now']();}}else if(!_[_0xde0a('0x24')](channels[_0x419887['linkedid']])&&_0x419887[_0xde0a('0x25')]==0x6&&_0x419887[_0xde0a('0x1e')]!=_0xde0a('0x28')){utils['info'](util[_0xde0a('0xa')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x419887[_0xde0a('0x8')],_0x419887[_0xde0a('0x1a')],_0x419887['context'],_0x419887[_0xde0a('0xc')]));channels[_0x419887[_0xde0a('0x1a')]]['accountcode']=_0x419887[_0xde0a('0x13')];channels[_0x419887[_0xde0a('0x1a')]][_0xde0a('0x29')]=_0x419887['channel'];if(_[_0xde0a('0x24')](channels[_0x419887[_0xde0a('0x1a')]][_0xde0a('0x2a')])){channels[_0x419887['linkedid']]['answertime']=utils[_0xde0a('0x20')]();}channels[_0x419887[_0xde0a('0x1a')]][_0xde0a('0x2b')]=dispositions[_[_0xde0a('0x2c')](_0x419887[_0xde0a('0x25')])]||_0xde0a('0x5');}}catch(_0x18d131){utils[_0xde0a('0x21')](util[_0xde0a('0xa')](_0xde0a('0x23'),_0x419887['uniqueid']),_0x18d131);}};exports['hangup']=function(_0x6d816f){try{if(!_[_0xde0a('0x24')](channels[_0x6d816f[_0xde0a('0x8')]])){utils[_0xde0a('0x22')](util[_0xde0a('0xa')](_0xde0a('0x2d'),_0x6d816f[_0xde0a('0x8')]),_0x6d816f);if(_[_0xde0a('0x24')](channels[_0x6d816f['uniqueid']][_0xde0a('0x2e')])){channels[_0x6d816f['uniqueid']][_0xde0a('0x2e')]=_0x6d816f[_0xde0a('0x2f')]+'\x20<'+_0x6d816f[_0xde0a('0x10')]+'>';}utils[_0xde0a('0x1c')](util[_0xde0a('0xa')](_0xde0a('0x30'),_0x6d816f[_0xde0a('0x8')],channels[_0x6d816f['uniqueid']][_0xde0a('0x2e')],_0x6d816f[_0xde0a('0x31')]));channels[_0x6d816f['uniqueid']][_0xde0a('0x32')]=utils[_0xde0a('0x20')]();channels[_0x6d816f[_0xde0a('0x8')]][_0xde0a('0x33')]=utils[_0xde0a('0x34')](channels[_0x6d816f[_0xde0a('0x8')]][_0xde0a('0x32')],channels[_0x6d816f[_0xde0a('0x8')]][_0xde0a('0x35')]);channels[_0x6d816f[_0xde0a('0x8')]][_0xde0a('0x36')]=channels[_0x6d816f[_0xde0a('0x8')]][_0xde0a('0x2a')]?utils[_0xde0a('0x34')](channels[_0x6d816f[_0xde0a('0x8')]]['endtime'],channels[_0x6d816f[_0xde0a('0x8')]][_0xde0a('0x2a')]):0x0;writeDB(channels[_0x6d816f[_0xde0a('0x8')]]);}}catch(_0xc12f77){utils[_0xde0a('0x21')](util[_0xde0a('0xa')](_0xde0a('0x2d'),_0x6d816f[_0xde0a('0x8')]),_0xc12f77);}};exports[_0xde0a('0x37')]=function(_0x2f7855){try{if(!_['isNil'](channels[_0x2f7855[_0xde0a('0x38')]])){utils[_0xde0a('0x22')](util[_0xde0a('0xa')](_0xde0a('0x39'),_0x2f7855[_0xde0a('0x3a')]),_0x2f7855);if(channels[_0x2f7855[_0xde0a('0x38')]][_0xde0a('0xc')]==_0x2f7855[_0xde0a('0x3b')]){utils[_0xde0a('0x1c')](util['format'](_0xde0a('0x3c'),_0x2f7855[_0xde0a('0x3a')],_0x2f7855[_0xde0a('0x38')],_0x2f7855[_0xde0a('0x3d')]));channels[_0x2f7855[_0xde0a('0x38')]][_0xde0a('0x29')]=_0x2f7855['secondtransfererchannel'];channels[_0x2f7855[_0xde0a('0x38')]]['userfield']=_0xde0a('0x3e');}else if(channels[_0x2f7855[_0xde0a('0x38')]]['channel']=_0x2f7855[_0xde0a('0x3f')]){utils[_0xde0a('0x1c')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2f7855['origtransfereruniqueid'],_0x2f7855[_0xde0a('0x38')],_0x2f7855[_0xde0a('0x40')]));channels[_0x2f7855[_0xde0a('0x38')]][_0xde0a('0x29')]=_0x2f7855[_0xde0a('0x40')];channels[_0x2f7855[_0xde0a('0x38')]][_0xde0a('0x41')]=_0xde0a('0x3e');}}}catch(_0x28b219){utils[_0xde0a('0x21')](util[_0xde0a('0xa')]('[%s][calls][attendedtransfer]',_0x2f7855[_0xde0a('0x3a')]),_0x28b219);}};exports['musiconholdstart']=function(_0x15110c){try{if(!_[_0xde0a('0x24')](channels[_0x15110c['uniqueid']])){utils['debug'](util[_0xde0a('0xa')](_0xde0a('0x42'),_0x15110c[_0xde0a('0x8')]),_0x15110c);channels[_0x15110c[_0xde0a('0x8')]][_0xde0a('0x43')]=utils[_0xde0a('0x20')]();utils['info'](util[_0xde0a('0xa')](_0xde0a('0x44'),_0x15110c[_0xde0a('0x8')],channels[_0x15110c['uniqueid']][_0xde0a('0x43')]));}}catch(_0x386563){utils[_0xde0a('0x21')](util[_0xde0a('0xa')]('[%s][calls][musiconholdstart]',_0x15110c[_0xde0a('0x8')]),_0x386563);}};exports[_0xde0a('0x45')]=function(_0x4aa9a1){try{if(!_[_0xde0a('0x24')](channels[_0x4aa9a1[_0xde0a('0x8')]])){utils['debug'](util[_0xde0a('0xa')]('[%s][calls][musiconholdstop]',_0x4aa9a1['uniqueid']),_0x4aa9a1);if(!_[_0xde0a('0x24')](channels[_0x4aa9a1[_0xde0a('0x8')]]['musiconholdstartAt'])){channels[_0x4aa9a1[_0xde0a('0x8')]]['mohtime']+=utils['diffTime'](utils[_0xde0a('0x20')](),channels[_0x4aa9a1[_0xde0a('0x8')]][_0xde0a('0x43')]);utils['info'](util['format'](_0xde0a('0x46'),_0x4aa9a1[_0xde0a('0x8')],channels[_0x4aa9a1[_0xde0a('0x8')]][_0xde0a('0x47')]));delete channels[_0x4aa9a1[_0xde0a('0x8')]][_0xde0a('0x43')];}}}catch(_0x2850a4){utils[_0xde0a('0x21')](util[_0xde0a('0xa')]('[%s][calls][musiconholdstop]',_0x4aa9a1[_0xde0a('0x8')]),_0x2850a4);}};exports[_0xde0a('0x48')]=function(_0x4d2659){try{if(!_['isNil'](channels[_0x4d2659[_0xde0a('0x8')]])){utils[_0xde0a('0x22')](util[_0xde0a('0xa')](_0xde0a('0x49'),_0x4d2659[_0xde0a('0x8')]),_0x4d2659);if(!_['isNil'](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x4b')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4d2659['uniqueid'],_0x4d2659['value']));channels[_0x4d2659[_0xde0a('0x8')]][_0xde0a('0x4c')]=_0x4d2659['value'];}if(!_[_0xde0a('0x24')](_0x4d2659[_0xde0a('0x4a')]['xmd-phone'])){utils[_0xde0a('0x1c')](util[_0xde0a('0xa')](_0xde0a('0x4d'),_0x4d2659['uniqueid'],_0x4d2659[_0xde0a('0x4e')]));channels[_0x4d2659[_0xde0a('0x8')]][_0xde0a('0x4f')]=_0x4d2659[_0xde0a('0x4e')];channels[_0x4d2659[_0xde0a('0x8')]][_0xde0a('0x2e')]='\x22'+_0x4d2659[_0xde0a('0x4e')]+_0xde0a('0x50')+_0x4d2659[_0xde0a('0x4e')]+'>';}if(!_[_0xde0a('0x24')](_0x4d2659['variable'][_0xde0a('0x51')])||!_['isNil'](_0x4d2659[_0xde0a('0x4a')]['xmd-callerid'])){utils[_0xde0a('0x1c')](util[_0xde0a('0xa')](_0xde0a('0x52'),_0x4d2659[_0xde0a('0x8')],!_['isNil'](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x51')])?_0xde0a('0x51'):'xmd-callerid',_0x4d2659[_0xde0a('0x4e')]));channels[_0x4d2659[_0xde0a('0x8')]][_0xde0a('0x2e')]=_0x4d2659[_0xde0a('0x4e')];}if(!_[_0xde0a('0x24')](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x53')])||!_[_0xde0a('0x24')](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x54')])){utils['info'](util[_0xde0a('0xa')](_0xde0a('0x52'),_0x4d2659[_0xde0a('0x8')],!_[_0xde0a('0x24')](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x53')])?_0xde0a('0x53'):_0xde0a('0x54'),_0x4d2659[_0xde0a('0x4e')]));channels[_0x4d2659[_0xde0a('0x8')]]['lastapplication']=_0xde0a('0x55');channels[_0x4d2659[_0xde0a('0x8')]][_0xde0a('0x56')]=_0x4d2659['value'];channels[_0x4d2659['uniqueid']][_0xde0a('0xd')]=!![];}if(!_[_0xde0a('0x24')](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x57')])){utils[_0xde0a('0x1c')](util[_0xde0a('0xa')](_0xde0a('0x58'),_0x4d2659[_0xde0a('0x8')],_0x4d2659[_0xde0a('0x4e')]));channels[_0x4d2659[_0xde0a('0x8')]]['ContactId']=_0x4d2659[_0xde0a('0x4e')];}if(!_[_0xde0a('0x24')](_0x4d2659['variable'][_0xde0a('0x59')])){utils['info'](util['format'](_0xde0a('0x5a'),_0x4d2659[_0xde0a('0x8')],_0x4d2659['value']));channels[_0x4d2659[_0xde0a('0x8')]]['type']=_0x4d2659[_0xde0a('0x4e')];}if(!_[_0xde0a('0x24')](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x5b')])){utils[_0xde0a('0x1c')](util[_0xde0a('0xa')](_0xde0a('0x5c'),_0x4d2659['uniqueid'],_0x4d2659[_0xde0a('0x4e')]));channels[_0x4d2659[_0xde0a('0x8')]]['routeid']=_0x4d2659[_0xde0a('0x4e')];}if(!_[_0xde0a('0x24')](_0x4d2659['variable'][_0xde0a('0x5d')])){utils[_0xde0a('0x1c')](util[_0xde0a('0xa')](_0xde0a('0x5e'),_0x4d2659['uniqueid'],_0x4d2659[_0xde0a('0x4e')]));channels[_0x4d2659[_0xde0a('0x8')]][_0xde0a('0x5d')]=_0x4d2659[_0xde0a('0x4e')];}}}catch(_0x189bc4){utils[_0xde0a('0x21')](util['format']('[%s][calls][varset]',_0x4d2659['uniqueid']),_0x189bc4);}};exports[_0xde0a('0x5f')]=function(_0x5772d3){try{if(!_['isNil'](channels[_0x5772d3[_0xde0a('0x8')]])){utils['debug'](util[_0xde0a('0xa')](_0xde0a('0x60'),_0x5772d3[_0xde0a('0x8')]),_0x5772d3);utils[_0xde0a('0x1c')](util[_0xde0a('0xa')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x5772d3['uniqueid'],_0x5772d3[_0xde0a('0x61')],_0x5772d3[_0xde0a('0x62')]));if(_0x5772d3[_0xde0a('0x61')][_0xde0a('0x63')]()==_0xde0a('0x64')&&_[_0xde0a('0x65')](_0x5772d3[_0xde0a('0x62')]['toLowerCase'](),_0xde0a('0x66'))){var _0x568ead=_0x5772d3[_0xde0a('0x62')][_0xde0a('0x67')]('=');var _0x57d7ed=_0x568ead[0x0][_0xde0a('0x68')](_0x568ead[0x0][_0xde0a('0x69')]('(')+0x1,_0x568ead[0x0]['lastIndexOf'](')'));var _0x572413=_0x568ead[0x1];channels[_0x5772d3[_0xde0a('0x8')]][_0x57d7ed]=_0x572413;}if(!_[_0xde0a('0x6a')]([_0xde0a('0x6b'),_0xde0a('0x6c'),_0xde0a('0x6d'),_0xde0a('0x64'),_0xde0a('0x6e')],_0x5772d3['application'][_0xde0a('0x63')]())){channels[_0x5772d3['uniqueid']][_0xde0a('0x6f')]=_0x5772d3['application'];channels[_0x5772d3[_0xde0a('0x8')]][_0xde0a('0x56')]=_0x5772d3[_0xde0a('0x62')];}}}catch(_0x263e20){utils[_0xde0a('0x21')](util[_0xde0a('0xa')](_0xde0a('0x60'),_0x5772d3['uniqueid']),_0x263e20);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 430e6c0..3c0718a 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 _0x7799=['info','[core]\x20connected','[core]\x20shutdown','fullybooted','error','[core]\x20error','[core]\x20close','./utils'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7799,0x12f));var _0x9779=function(_0x19ae7a,_0x5d3b51){_0x19ae7a=_0x19ae7a-0x0;var _0x30d82e=_0x7799[_0x19ae7a];return _0x30d82e;};'use strict';var utils=require(_0x9779('0x0'));exports['connect']=function(){utils[_0x9779('0x1')](_0x9779('0x2'));};exports['shutdown']=function(){utils[_0x9779('0x1')](_0x9779('0x3'));};exports[_0x9779('0x4')]=function(){utils[_0x9779('0x1')]('[core]\x20fullybooted');};exports['error']=function(_0x19814e){utils[_0x9779('0x5')](_0x9779('0x6'),_0x19814e);};exports['close']=function(){utils[_0x9779('0x1')](_0x9779('0x7'));};exports['managerevent']=function(_0x1b8bdf){}; \ No newline at end of file +var _0x490c=['[core]\x20fullybooted','[core]\x20error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted'];(function(_0x49bfb8,_0x5b6e2b){var _0x1be0b7=function(_0x3df70f){while(--_0x3df70f){_0x49bfb8['push'](_0x49bfb8['shift']());}};_0x1be0b7(++_0x5b6e2b);}(_0x490c,0x186));var _0xc490=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0x490c[_0x2bf888];return _0x3038d6;};'use strict';var utils=require(_0xc490('0x0'));exports['connect']=function(){utils[_0xc490('0x1')](_0xc490('0x2'));};exports[_0xc490('0x3')]=function(){utils[_0xc490('0x1')](_0xc490('0x4'));};exports[_0xc490('0x5')]=function(){utils[_0xc490('0x1')](_0xc490('0x6'));};exports['error']=function(_0x4445c5){utils['error'](_0xc490('0x7'),_0x4445c5);};exports[_0xc490('0x8')]=function(){utils[_0xc490('0x1')](_0xc490('0x9'));};exports[_0xc490('0xa')]=function(_0x502d49){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 73f94e2..6d25a10 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 _0xfbd9=['[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','endtime','diffTime','billableseconds','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','uniqueid','debug','format','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','connect'];(function(_0x333767,_0x3e6f9c){var _0x51661b=function(_0x46e5d6){while(--_0x46e5d6){_0x333767['push'](_0x333767['shift']());}};_0x51661b(++_0x3e6f9c);}(_0xfbd9,0x1de));var _0x9fbd=function(_0x542dcd,_0x1d12ed){_0x542dcd=_0x542dcd-0x0;var _0x2b49e7=_0xfbd9[_0x542dcd];return _0x2b49e7;};'use strict';var _=require('lodash');var util=require(_0x9fbd('0x0'));var utils=require(_0x9fbd('0x1'));var dials={};function writeDB(_0x59cac2){utils['info'](util['format'](_0x9fbd('0x2'),_0x59cac2['uniqueid'],_0x59cac2[_0x9fbd('0x3')],_0x59cac2[_0x9fbd('0x4')],_0x59cac2[_0x9fbd('0x5')],_0x59cac2[_0x9fbd('0x6')],_0x59cac2[_0x9fbd('0x7')]));utils['request'](_0x9fbd('0x8'),_0x59cac2);delete dials[_0x59cac2[_0x9fbd('0x9')]];}exports['newexten']=function(_0x5bfd17){try{utils[_0x9fbd('0xa')](util[_0x9fbd('0xb')](_0x9fbd('0xc'),_0x5bfd17[_0x9fbd('0x9')]),_0x5bfd17);utils[_0x9fbd('0xd')](util['format'](_0x9fbd('0xe'),_0x5bfd17[_0x9fbd('0x9')],_0x5bfd17[_0x9fbd('0xf')],_0x5bfd17[_0x9fbd('0x10')]));if(_0x5bfd17[_0x9fbd('0xf')][_0x9fbd('0x11')]()==_0x9fbd('0x12')&&_[_0x9fbd('0x13')](_0x5bfd17[_0x9fbd('0x10')][_0x9fbd('0x11')](),_0x9fbd('0x14'))){var _0x587a35=_0x5bfd17[_0x9fbd('0x10')][_0x9fbd('0x15')]('=');dials[_0x5bfd17['uniqueid']]={'routeId':_0x587a35[0x1]};}}catch(_0x3d3df0){utils['error'](util[_0x9fbd('0xb')](_0x9fbd('0xc'),_0x5bfd17[_0x9fbd('0x9')]),_0x3d3df0);}};exports['varset']=function(_0x2d7e6d){try{utils[_0x9fbd('0xa')](util[_0x9fbd('0xb')](_0x9fbd('0x16'),_0x2d7e6d['uniqueid']),_0x2d7e6d);if(!_[_0x9fbd('0x17')](_0x2d7e6d[_0x9fbd('0x18')][_0x9fbd('0x19')])){utils[_0x9fbd('0xd')](util['format'](_0x9fbd('0x1a'),_0x2d7e6d[_0x9fbd('0x9')],_0x2d7e6d[_0x9fbd('0x1b')]));dials[_0x2d7e6d[_0x9fbd('0x9')]]={'routeId':_0x2d7e6d[_0x9fbd('0x1b')]};}}catch(_0x2ecef4){utils['error'](util['format']('[%s][dials][varset]',_0x2d7e6d['uniqueid']),_0x2ecef4);}};exports[_0x9fbd('0x1c')]=function(_0x4962d7){try{if(!_[_0x9fbd('0x17')](dials[_0x4962d7[_0x9fbd('0x9')]])){utils[_0x9fbd('0xa')](util[_0x9fbd('0xb')](_0x9fbd('0x1d'),_0x4962d7['uniqueid']),_0x4962d7);dials[_0x4962d7[_0x9fbd('0x9')]]=_[_0x9fbd('0x1e')](dials[_0x4962d7['uniqueid']],_0x4962d7);dials[_0x4962d7['uniqueid']][_0x9fbd('0x1f')]=utils[_0x9fbd('0x20')]();dials[_0x4962d7[_0x9fbd('0x9')]]['lastevent']=_0x9fbd('0x21');utils[_0x9fbd('0xd')](util[_0x9fbd('0xb')](_0x9fbd('0x22'),_0x4962d7[_0x9fbd('0x9')],dials[_0x4962d7[_0x9fbd('0x9')]][_0x9fbd('0x1f')]));}}catch(_0x3f9dd1){utils[_0x9fbd('0x23')](util['format'](_0x9fbd('0x1d'),_0x4962d7[_0x9fbd('0x9')]),_0x3f9dd1);}};exports[_0x9fbd('0x24')]=function(_0x5bf96a){try{if(!_[_0x9fbd('0x17')](dials[_0x5bf96a[_0x9fbd('0x9')]])){utils[_0x9fbd('0xa')](util['format'](_0x9fbd('0x25'),_0x5bf96a['uniqueid']),_0x5bf96a);dials[_0x5bf96a[_0x9fbd('0x9')]]['dialstatus']=_0x5bf96a['dialstatus'];if(_0x5bf96a['dialstatus']==_0x9fbd('0x26')){dials[_0x5bf96a[_0x9fbd('0x9')]]=_[_0x9fbd('0x1e')](dials[_0x5bf96a[_0x9fbd('0x9')]],_0x5bf96a);dials[_0x5bf96a[_0x9fbd('0x9')]][_0x9fbd('0x27')]=utils[_0x9fbd('0x20')]();dials[_0x5bf96a[_0x9fbd('0x9')]][_0x9fbd('0x28')]=_0x9fbd('0x29');utils['info'](util[_0x9fbd('0xb')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x5bf96a[_0x9fbd('0x9')],_0x5bf96a[_0x9fbd('0x7')],dials[_0x5bf96a[_0x9fbd('0x9')]][_0x9fbd('0x27')]));}else{utils[_0x9fbd('0xd')](util[_0x9fbd('0xb')](_0x9fbd('0x2a'),_0x5bf96a['uniqueid'],_0x5bf96a[_0x9fbd('0x7')]));}}}catch(_0xdc5d32){utils[_0x9fbd('0x23')](util[_0x9fbd('0xb')]('[%s][dials][dialend]',_0x5bf96a['uniqueid']),_0xdc5d32);}};exports[_0x9fbd('0x2b')]=function(_0x5150fd){try{if(!_[_0x9fbd('0x17')](dials[_0x5150fd['uniqueid']])){utils[_0x9fbd('0xa')](util[_0x9fbd('0xb')](_0x9fbd('0x2c'),_0x5150fd[_0x9fbd('0x9')]),_0x5150fd);utils[_0x9fbd('0xd')](util[_0x9fbd('0xb')](_0x9fbd('0x2d'),_0x5150fd['uniqueid'],_0x5150fd['calleridnum'],_0x5150fd['calleridname'],_0x5150fd[_0x9fbd('0x2e')]));dials[_0x5150fd[_0x9fbd('0x9')]]=_['assign'](dials[_0x5150fd['uniqueid']],{'endtime':utils[_0x9fbd('0x20')](),'lastevent':_0x9fbd('0x2f')});dials[_0x5150fd[_0x9fbd('0x9')]][_0x9fbd('0x30')]=utils['diffTime'](dials[_0x5150fd['uniqueid']][_0x9fbd('0x31')],dials[_0x5150fd[_0x9fbd('0x9')]][_0x9fbd('0x1f')]);dials[_0x5150fd['uniqueid']]['holdtime']=utils[_0x9fbd('0x32')](dials[_0x5150fd[_0x9fbd('0x9')]][_0x9fbd('0x27')]||dials[_0x5150fd[_0x9fbd('0x9')]][_0x9fbd('0x31')],dials[_0x5150fd[_0x9fbd('0x9')]][_0x9fbd('0x1f')]);dials[_0x5150fd[_0x9fbd('0x9')]][_0x9fbd('0x33')]=dials[_0x5150fd['uniqueid']][_0x9fbd('0x27')]?utils[_0x9fbd('0x32')](dials[_0x5150fd[_0x9fbd('0x9')]]['endtime'],dials[_0x5150fd[_0x9fbd('0x9')]][_0x9fbd('0x27')]):0x0;writeDB(dials[_0x5150fd[_0x9fbd('0x9')]]);}}catch(_0x245caa){utils[_0x9fbd('0x23')](util['format'](_0x9fbd('0x2c'),_0x5150fd['uniqueid']),_0x245caa);}}; \ No newline at end of file +var _0x9150=['[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','debug','application','appdata','toLowerCase','set','startsWith','[%s][dials][newexten]','varset','isNil','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','error','dialend','[%s][dials][dialend]','ANSWER','answertime','connect'];(function(_0x2710c7,_0x3d04fd){var _0x443e7a=function(_0x16964e){while(--_0x16964e){_0x2710c7['push'](_0x2710c7['shift']());}};_0x443e7a(++_0x3d04fd);}(_0x9150,0xc1));var _0x0915=function(_0x4bd71d,_0x4fdb57){_0x4bd71d=_0x4bd71d-0x0;var _0x575878=_0x9150[_0x4bd71d];return _0x575878;};'use strict';var _=require(_0x0915('0x0'));var util=require(_0x0915('0x1'));var utils=require(_0x0915('0x2'));var dials={};function writeDB(_0x5d281a){utils[_0x0915('0x3')](util[_0x0915('0x4')](_0x0915('0x5'),_0x5d281a['uniqueid'],_0x5d281a[_0x0915('0x6')],_0x5d281a['dialstring'],_0x5d281a[_0x0915('0x7')],_0x5d281a[_0x0915('0x8')],_0x5d281a[_0x0915('0x9')]));utils[_0x0915('0xa')](_0x0915('0xb'),_0x5d281a);delete dials[_0x5d281a[_0x0915('0xc')]];}exports['newexten']=function(_0x1982a0){try{utils[_0x0915('0xd')](util[_0x0915('0x4')]('[%s][dials][newexten]',_0x1982a0[_0x0915('0xc')]),_0x1982a0);utils['info'](util[_0x0915('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1982a0[_0x0915('0xc')],_0x1982a0[_0x0915('0xe')],_0x1982a0[_0x0915('0xf')]));if(_0x1982a0['application'][_0x0915('0x10')]()==_0x0915('0x11')&&_[_0x0915('0x12')](_0x1982a0[_0x0915('0xf')][_0x0915('0x10')](),'cdr(routeid)')){var _0x7dc7bb=_0x1982a0[_0x0915('0xf')]['split']('=');dials[_0x1982a0[_0x0915('0xc')]]={'routeId':_0x7dc7bb[0x1]};}}catch(_0x5280b9){utils['error'](util[_0x0915('0x4')](_0x0915('0x13'),_0x1982a0[_0x0915('0xc')]),_0x5280b9);}};exports[_0x0915('0x14')]=function(_0x22f0fb){try{utils[_0x0915('0xd')](util[_0x0915('0x4')]('[%s][dials][varset]',_0x22f0fb[_0x0915('0xc')]),_0x22f0fb);if(!_[_0x0915('0x15')](_0x22f0fb['variable']['outboundrouteid'])){utils[_0x0915('0x3')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x22f0fb[_0x0915('0xc')],_0x22f0fb[_0x0915('0x16')]));dials[_0x22f0fb[_0x0915('0xc')]]={'routeId':_0x22f0fb[_0x0915('0x16')]};}}catch(_0x5b2ef2){utils['error'](util[_0x0915('0x4')](_0x0915('0x17'),_0x22f0fb['uniqueid']),_0x5b2ef2);}};exports[_0x0915('0x18')]=function(_0x45462a){try{if(!_[_0x0915('0x15')](dials[_0x45462a[_0x0915('0xc')]])){utils[_0x0915('0xd')](util[_0x0915('0x4')](_0x0915('0x19'),_0x45462a[_0x0915('0xc')]),_0x45462a);dials[_0x45462a['uniqueid']]=_[_0x0915('0x1a')](dials[_0x45462a[_0x0915('0xc')]],_0x45462a);dials[_0x45462a[_0x0915('0xc')]][_0x0915('0x1b')]=utils[_0x0915('0x1c')]();dials[_0x45462a[_0x0915('0xc')]][_0x0915('0x1d')]=_0x0915('0x1e');utils[_0x0915('0x3')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x45462a[_0x0915('0xc')],dials[_0x45462a[_0x0915('0xc')]][_0x0915('0x1b')]));}}catch(_0x5c115c){utils[_0x0915('0x1f')](util[_0x0915('0x4')](_0x0915('0x19'),_0x45462a[_0x0915('0xc')]),_0x5c115c);}};exports[_0x0915('0x20')]=function(_0x67f30){try{if(!_[_0x0915('0x15')](dials[_0x67f30[_0x0915('0xc')]])){utils[_0x0915('0xd')](util['format'](_0x0915('0x21'),_0x67f30['uniqueid']),_0x67f30);dials[_0x67f30[_0x0915('0xc')]]['dialstatus']=_0x67f30['dialstatus'];if(_0x67f30[_0x0915('0x9')]==_0x0915('0x22')){dials[_0x67f30[_0x0915('0xc')]]=_[_0x0915('0x1a')](dials[_0x67f30[_0x0915('0xc')]],_0x67f30);dials[_0x67f30['uniqueid']][_0x0915('0x23')]=utils[_0x0915('0x1c')]();dials[_0x67f30[_0x0915('0xc')]][_0x0915('0x1d')]=_0x0915('0x24');utils[_0x0915('0x3')](util['format'](_0x0915('0x25'),_0x67f30[_0x0915('0xc')],_0x67f30[_0x0915('0x9')],dials[_0x67f30['uniqueid']][_0x0915('0x23')]));}else{utils[_0x0915('0x3')](util[_0x0915('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x67f30[_0x0915('0xc')],_0x67f30['dialstatus']));}}}catch(_0x41f87f){utils[_0x0915('0x1f')](util[_0x0915('0x4')](_0x0915('0x21'),_0x67f30[_0x0915('0xc')]),_0x41f87f);}};exports[_0x0915('0x26')]=function(_0x35187d){try{if(!_[_0x0915('0x15')](dials[_0x35187d['uniqueid']])){utils[_0x0915('0xd')](util[_0x0915('0x4')]('[%s][dials][hangup]',_0x35187d[_0x0915('0xc')]),_0x35187d);utils['info'](util[_0x0915('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x35187d[_0x0915('0xc')],_0x35187d[_0x0915('0x7')],_0x35187d[_0x0915('0x27')],_0x35187d['cause-txt']));dials[_0x35187d[_0x0915('0xc')]]=_[_0x0915('0x1a')](dials[_0x35187d[_0x0915('0xc')]],{'endtime':utils[_0x0915('0x1c')](),'lastevent':_0x0915('0x28')});dials[_0x35187d[_0x0915('0xc')]][_0x0915('0x29')]=utils[_0x0915('0x2a')](dials[_0x35187d[_0x0915('0xc')]][_0x0915('0x2b')],dials[_0x35187d[_0x0915('0xc')]][_0x0915('0x1b')]);dials[_0x35187d['uniqueid']][_0x0915('0x2c')]=utils[_0x0915('0x2a')](dials[_0x35187d['uniqueid']]['answertime']||dials[_0x35187d[_0x0915('0xc')]][_0x0915('0x2b')],dials[_0x35187d['uniqueid']]['starttime']);dials[_0x35187d['uniqueid']][_0x0915('0x2d')]=dials[_0x35187d[_0x0915('0xc')]][_0x0915('0x23')]?utils['diffTime'](dials[_0x35187d['uniqueid']][_0x0915('0x2b')],dials[_0x35187d['uniqueid']][_0x0915('0x23')]):0x0;writeDB(dials[_0x35187d[_0x0915('0xc')]]);}}catch(_0x499826){utils[_0x0915('0x1f')](util[_0x0915('0x4')]('[%s][dials][hangup]',_0x35187d[_0x0915('0xc')]),_0x499826);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index e7ddd50..6ce5c69 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 _0x9a68=['./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s][index][dialend]','dialend','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','username','keepConnected','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9a68,0x1d4));var _0x89a6=function(_0x5f12f8,_0x4e8c06){_0x5f12f8=_0x5f12f8-0x0;var _0xd71edc=_0x9a68[_0x5f12f8];return _0xd71edc;};var AsteriskManager=require('asterisk-manager');var config=require(_0x89a6('0x0'));var utils=require(_0x89a6('0x1'));var util=require(_0x89a6('0x2'));var isXDREnabled=config['xdr']&&config[_0x89a6('0x3')][_0x89a6('0x4')]?!config[_0x89a6('0x3')]['disabled']:!![];var isProduction=config['env']===_0x89a6('0x5')||![];var isLocalAsterisk=config[_0x89a6('0x3')]&&config[_0x89a6('0x3')][_0x89a6('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x89a6('0x7')][_0x89a6('0x8')],config['asterisk']['ip'],config[_0x89a6('0x7')][_0x89a6('0x9')],config['asterisk']['password'],!![]);ami[_0x89a6('0xa')]();if(!isXDREnabled){utils['info'](_0x89a6('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x89a6('0xc'));}else{var agents=require('./agents.controller');var calls=require(_0x89a6('0xd'));var queues=require(_0x89a6('0xe'));var recordings=require(_0x89a6('0xf'));var members=require(_0x89a6('0x10'));var dials=require(_0x89a6('0x11'));var transfers=require(_0x89a6('0x12'));var core=require(_0x89a6('0x13'));ami['on']('connect',core[_0x89a6('0x14')]);ami['on'](_0x89a6('0x15'),core[_0x89a6('0x15')]);ami['on']('fullybooted',core[_0x89a6('0x16')]);ami['on'](_0x89a6('0x17'),core[_0x89a6('0x17')]);ami['on']('close',core[_0x89a6('0x18')]);ami['on'](_0x89a6('0x19'),core[_0x89a6('0x19')]);ami['on'](_0x89a6('0x1a'),function(_0x4ee611){try{utils[_0x89a6('0x1b')](util[_0x89a6('0x1c')](_0x89a6('0x1d'),_0x4ee611[_0x89a6('0x1e')]),_0x4ee611);members[_0x89a6('0x1a')](_0x4ee611);}catch(_0x1eff00){utils[_0x89a6('0x17')](util[_0x89a6('0x1c')](_0x89a6('0x1d'),_0x4ee611[_0x89a6('0x1e')]),_0x1eff00);}});ami['on']('agentcalled',function(_0x3374c5){try{utils[_0x89a6('0x1b')](util['format'](_0x89a6('0x1f'),_0x3374c5[_0x89a6('0x20')]),_0x3374c5);agents[_0x89a6('0x21')](_0x3374c5);}catch(_0x1c4b7c){utils['error'](util['format'](_0x89a6('0x1f'),_0x3374c5[_0x89a6('0x20')]),_0x1c4b7c);}});ami['on']('agentringnoanswer',function(_0x5a271a){try{utils['debug'](util[_0x89a6('0x1c')]('[%s][index][agentringnoanswer]',_0x5a271a[_0x89a6('0x20')]),_0x5a271a);agents[_0x89a6('0x22')](_0x5a271a);}catch(_0x20f095){utils[_0x89a6('0x17')](util[_0x89a6('0x1c')](_0x89a6('0x23'),_0x5a271a['uniqueid']),_0x20f095);}});ami['on'](_0x89a6('0x24'),function(_0x1170f2){try{utils[_0x89a6('0x1b')](util[_0x89a6('0x1c')]('[%s][index][agentconnect]',_0x1170f2[_0x89a6('0x20')]),_0x1170f2);agents['agentconnect'](_0x1170f2);queues[_0x89a6('0x24')](_0x1170f2);}catch(_0x4ccce6){utils[_0x89a6('0x17')](util[_0x89a6('0x1c')](_0x89a6('0x25'),_0x1170f2[_0x89a6('0x20')]),_0x4ccce6);}});ami['on'](_0x89a6('0x26'),function(_0x1c0d0f){try{utils[_0x89a6('0x1b')](util['format']('[%s][index][agentcomplete]',_0x1c0d0f['uniqueid']),_0x1c0d0f);agents[_0x89a6('0x26')](_0x1c0d0f);queues[_0x89a6('0x26')](_0x1c0d0f);members[_0x89a6('0x26')](_0x1c0d0f);}catch(_0x2862f1){utils[_0x89a6('0x17')](util[_0x89a6('0x1c')](_0x89a6('0x27'),_0x1c0d0f[_0x89a6('0x20')]),_0x2862f1);}});ami['on'](_0x89a6('0x28'),function(_0x4bef3c){try{utils[_0x89a6('0x1b')](util[_0x89a6('0x1c')](_0x89a6('0x29'),_0x4bef3c[_0x89a6('0x20')]),_0x4bef3c);agents[_0x89a6('0x28')](_0x4bef3c);queues['queuecallerabandon'](_0x4bef3c);}catch(_0x54d28c){utils[_0x89a6('0x17')](util[_0x89a6('0x1c')](_0x89a6('0x29'),_0x4bef3c[_0x89a6('0x20')]),_0x54d28c);}});ami['on']('queuecallerjoin',function(_0x107eb3){try{utils['debug'](util[_0x89a6('0x1c')](_0x89a6('0x2a'),_0x107eb3[_0x89a6('0x20')]),_0x107eb3);queues[_0x89a6('0x2b')](_0x107eb3);recordings[_0x89a6('0x2b')](_0x107eb3);}catch(_0x4b676b){utils[_0x89a6('0x17')](util[_0x89a6('0x1c')](_0x89a6('0x2a'),_0x107eb3[_0x89a6('0x20')]),_0x4b676b);}});ami['on'](_0x89a6('0x2c'),function(_0x539650){try{utils['debug'](util[_0x89a6('0x1c')](_0x89a6('0x2d'),_0x539650[_0x89a6('0x20')]),_0x539650);queues[_0x89a6('0x2c')](_0x539650);}catch(_0x3cc02e){utils[_0x89a6('0x17')](util[_0x89a6('0x1c')](_0x89a6('0x2d'),_0x539650[_0x89a6('0x20')]),_0x3cc02e);}});ami['on'](_0x89a6('0x2e'),function(_0x19ecf0){try{utils[_0x89a6('0x1b')](util[_0x89a6('0x1c')](_0x89a6('0x2f'),_0x19ecf0[_0x89a6('0x20')]),_0x19ecf0);queues[_0x89a6('0x2e')](_0x19ecf0);calls[_0x89a6('0x2e')](_0x19ecf0);}catch(_0x1c9cad){utils[_0x89a6('0x17')](util['format'](_0x89a6('0x2f'),_0x19ecf0[_0x89a6('0x20')]),_0x1c9cad);}});ami['on']('musiconholdstop',function(_0x8e59ce){try{utils['debug'](util[_0x89a6('0x1c')](_0x89a6('0x30'),_0x8e59ce['uniqueid']),_0x8e59ce);queues['musiconholdstop'](_0x8e59ce);calls['musiconholdstop'](_0x8e59ce);}catch(_0x4aa1fd){utils[_0x89a6('0x17')](util['format'](_0x89a6('0x30'),_0x8e59ce[_0x89a6('0x20')]),_0x4aa1fd);}});ami['on'](_0x89a6('0x31'),function(_0x33d7f7){try{utils[_0x89a6('0x1b')](util[_0x89a6('0x1c')](_0x89a6('0x32'),_0x33d7f7[_0x89a6('0x20')]),_0x33d7f7);calls[_0x89a6('0x31')](_0x33d7f7);recordings[_0x89a6('0x31')](_0x33d7f7);}catch(_0x49bd8a){utils[_0x89a6('0x17')](util[_0x89a6('0x1c')](_0x89a6('0x32'),_0x33d7f7[_0x89a6('0x20')]),_0x49bd8a);}});ami['on'](_0x89a6('0x33'),function(_0x338033){try{utils[_0x89a6('0x1b')](util[_0x89a6('0x1c')](_0x89a6('0x34'),_0x338033[_0x89a6('0x20')]),_0x338033);calls[_0x89a6('0x33')](_0x338033);recordings[_0x89a6('0x33')](_0x338033);dials['hangup'](_0x338033);agents[_0x89a6('0x33')](_0x338033);queues[_0x89a6('0x33')](_0x338033);}catch(_0x253c72){utils[_0x89a6('0x17')](util[_0x89a6('0x1c')](_0x89a6('0x34'),_0x338033['uniqueid']),_0x253c72);}});ami['on']('cdr',function(_0x1ff992){try{utils['debug'](util[_0x89a6('0x1c')]('[%s][index][cdr]',_0x1ff992[_0x89a6('0x20')]),_0x1ff992);members[_0x89a6('0x35')](_0x1ff992);}catch(_0x211209){utils[_0x89a6('0x17')](util['format'](_0x89a6('0x36'),_0x1ff992[_0x89a6('0x20')]),_0x211209);}});ami['on'](_0x89a6('0x37'),function(_0x1bc7f3){try{utils['debug'](util[_0x89a6('0x1c')](_0x89a6('0x38'),_0x1bc7f3[_0x89a6('0x20')]),_0x1bc7f3);queues[_0x89a6('0x37')](_0x1bc7f3);agents['blindtransfer'](_0x1bc7f3);transfers['blindtransfer'](_0x1bc7f3);recordings[_0x89a6('0x37')](_0x1bc7f3);}catch(_0x3882f7){utils[_0x89a6('0x17')](util[_0x89a6('0x1c')](_0x89a6('0x38'),_0x1bc7f3[_0x89a6('0x20')]),_0x3882f7);}});ami['on'](_0x89a6('0x39'),function(_0x1e032e){try{utils[_0x89a6('0x1b')](util['format'](_0x89a6('0x3a'),_0x1e032e[_0x89a6('0x3b')]),_0x1e032e);queues[_0x89a6('0x39')](_0x1e032e);transfers['attendedtransfer'](_0x1e032e);agents[_0x89a6('0x39')](_0x1e032e);calls[_0x89a6('0x39')](_0x1e032e);}catch(_0x49e53f){utils['error'](util[_0x89a6('0x1c')](_0x89a6('0x3a'),_0x1e032e[_0x89a6('0x3b')]),_0x49e53f);}});ami['on']('varset',function(_0xdfaff4){try{utils['debug'](util[_0x89a6('0x1c')]('[%s][index][varset]',_0xdfaff4[_0x89a6('0x20')]),_0xdfaff4);queues[_0x89a6('0x3c')](_0xdfaff4);recordings['varset'](_0xdfaff4);calls['varset'](_0xdfaff4);dials[_0x89a6('0x3c')](_0xdfaff4);}catch(_0x433b8f){utils[_0x89a6('0x17')](util['format']('[%s][index][varset]',_0xdfaff4['uniqueid']),_0x433b8f);}});ami['on'](_0x89a6('0x3d'),function(_0x49df56){try{utils[_0x89a6('0x1b')](util[_0x89a6('0x1c')](_0x89a6('0x3e'),_0x49df56[_0x89a6('0x20')]),_0x49df56);calls['newexten'](_0x49df56);recordings[_0x89a6('0x3d')](_0x49df56);dials[_0x89a6('0x3d')](_0x49df56);}catch(_0x2ac2dc){utils[_0x89a6('0x17')](util['format']('[%s][index][newexten]',_0x49df56[_0x89a6('0x20')]),_0x2ac2dc);}});ami['on'](_0x89a6('0x3f'),function(_0x3ba8ef){try{utils[_0x89a6('0x1b')](util[_0x89a6('0x1c')](_0x89a6('0x40'),_0x3ba8ef[_0x89a6('0x20')]),_0x3ba8ef);calls['newchannel'](_0x3ba8ef);recordings[_0x89a6('0x3f')](_0x3ba8ef);}catch(_0x23420e){utils['error'](util[_0x89a6('0x1c')]('[%s][index][newchannel]',_0x3ba8ef[_0x89a6('0x20')]),_0x23420e);}});ami['on'](_0x89a6('0x41'),function(_0x235ee2){try{utils[_0x89a6('0x1b')](util[_0x89a6('0x1c')](_0x89a6('0x42'),_0x235ee2['uniqueid']),_0x235ee2);dials[_0x89a6('0x41')](_0x235ee2);}catch(_0x3a468f){utils[_0x89a6('0x17')](util['format']('[%s]dialbegin',_0x235ee2[_0x89a6('0x20')]),_0x3a468f);}});ami['on']('dialend',function(_0x26c90b){try{utils[_0x89a6('0x1b')](util['format'](_0x89a6('0x43'),_0x26c90b[_0x89a6('0x20')]),_0x26c90b);dials[_0x89a6('0x44')](_0x26c90b);}catch(_0x4a6937){utils[_0x89a6('0x17')](util[_0x89a6('0x1c')](_0x89a6('0x43'),_0x26c90b[_0x89a6('0x20')]),_0x4a6937);}});} \ No newline at end of file +var _0xf3c7=['connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','format','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','env','production','local','asterisk','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller'];(function(_0x3da8a9,_0x568522){var _0x422328=function(_0x1b3e43){while(--_0x1b3e43){_0x3da8a9['push'](_0x3da8a9['shift']());}};_0x422328(++_0x568522);}(_0xf3c7,0x14a));var _0x7f3c=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0xf3c7[_0x25efdf];return _0x22c495;};var AsteriskManager=require(_0x7f3c('0x0'));var config=require('../../config/environment');var utils=require(_0x7f3c('0x1'));var util=require(_0x7f3c('0x2'));var isXDREnabled=config[_0x7f3c('0x3')]&&config[_0x7f3c('0x3')]['disabled']?!config[_0x7f3c('0x3')]['disabled']:!![];var isProduction=config[_0x7f3c('0x4')]===_0x7f3c('0x5')||![];var isLocalAsterisk=config[_0x7f3c('0x3')]&&config[_0x7f3c('0x3')][_0x7f3c('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x7f3c('0x7')]['port'],config[_0x7f3c('0x7')]['ip'],config[_0x7f3c('0x7')][_0x7f3c('0x8')],config[_0x7f3c('0x7')][_0x7f3c('0x9')],!![]);ami[_0x7f3c('0xa')]();if(!isXDREnabled){utils[_0x7f3c('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x7f3c('0xb')](_0x7f3c('0xc'));}else{var agents=require(_0x7f3c('0xd'));var calls=require(_0x7f3c('0xe'));var queues=require(_0x7f3c('0xf'));var recordings=require('./recordings.controller');var members=require(_0x7f3c('0x10'));var dials=require(_0x7f3c('0x11'));var transfers=require(_0x7f3c('0x12'));var core=require(_0x7f3c('0x13'));ami['on'](_0x7f3c('0x14'),core[_0x7f3c('0x14')]);ami['on'](_0x7f3c('0x15'),core[_0x7f3c('0x15')]);ami['on']('fullybooted',core[_0x7f3c('0x16')]);ami['on'](_0x7f3c('0x17'),core[_0x7f3c('0x17')]);ami['on'](_0x7f3c('0x18'),core['close']);ami['on'](_0x7f3c('0x19'),core[_0x7f3c('0x19')]);ami['on'](_0x7f3c('0x1a'),function(_0x335ba5){try{utils[_0x7f3c('0x1b')](util['format'](_0x7f3c('0x1c'),_0x335ba5['device']),_0x335ba5);members[_0x7f3c('0x1a')](_0x335ba5);}catch(_0x91cdf5){utils[_0x7f3c('0x17')](util['format'](_0x7f3c('0x1c'),_0x335ba5[_0x7f3c('0x1d')]),_0x91cdf5);}});ami['on']('agentcalled',function(_0xc165c7){try{utils[_0x7f3c('0x1b')](util['format'](_0x7f3c('0x1e'),_0xc165c7[_0x7f3c('0x1f')]),_0xc165c7);agents[_0x7f3c('0x20')](_0xc165c7);}catch(_0x1be103){utils[_0x7f3c('0x17')](util['format']('[%s][index][agentcalled]',_0xc165c7['uniqueid']),_0x1be103);}});ami['on']('agentringnoanswer',function(_0x5bd9c0){try{utils['debug'](util[_0x7f3c('0x21')](_0x7f3c('0x22'),_0x5bd9c0[_0x7f3c('0x1f')]),_0x5bd9c0);agents[_0x7f3c('0x23')](_0x5bd9c0);}catch(_0xd80eb2){utils[_0x7f3c('0x17')](util['format'](_0x7f3c('0x22'),_0x5bd9c0['uniqueid']),_0xd80eb2);}});ami['on'](_0x7f3c('0x24'),function(_0xac0bcd){try{utils[_0x7f3c('0x1b')](util[_0x7f3c('0x21')](_0x7f3c('0x25'),_0xac0bcd[_0x7f3c('0x1f')]),_0xac0bcd);agents[_0x7f3c('0x24')](_0xac0bcd);queues[_0x7f3c('0x24')](_0xac0bcd);}catch(_0x4339bc){utils[_0x7f3c('0x17')](util[_0x7f3c('0x21')]('[%s][index][agentconnect]',_0xac0bcd[_0x7f3c('0x1f')]),_0x4339bc);}});ami['on']('agentcomplete',function(_0xe2a809){try{utils[_0x7f3c('0x1b')](util['format'](_0x7f3c('0x26'),_0xe2a809[_0x7f3c('0x1f')]),_0xe2a809);agents[_0x7f3c('0x27')](_0xe2a809);queues['agentcomplete'](_0xe2a809);members[_0x7f3c('0x27')](_0xe2a809);}catch(_0x567ce2){utils[_0x7f3c('0x17')](util['format'](_0x7f3c('0x26'),_0xe2a809[_0x7f3c('0x1f')]),_0x567ce2);}});ami['on']('queuecallerabandon',function(_0x4ebb07){try{utils['debug'](util[_0x7f3c('0x21')](_0x7f3c('0x28'),_0x4ebb07['uniqueid']),_0x4ebb07);agents[_0x7f3c('0x29')](_0x4ebb07);queues[_0x7f3c('0x29')](_0x4ebb07);}catch(_0x6be8eb){utils[_0x7f3c('0x17')](util[_0x7f3c('0x21')](_0x7f3c('0x28'),_0x4ebb07[_0x7f3c('0x1f')]),_0x6be8eb);}});ami['on'](_0x7f3c('0x2a'),function(_0x355f9f){try{utils[_0x7f3c('0x1b')](util['format'](_0x7f3c('0x2b'),_0x355f9f['uniqueid']),_0x355f9f);queues[_0x7f3c('0x2a')](_0x355f9f);recordings['queuecallerjoin'](_0x355f9f);}catch(_0x2ddfcc){utils['error'](util[_0x7f3c('0x21')]('[%s][index][queuecallerjoin]',_0x355f9f[_0x7f3c('0x1f')]),_0x2ddfcc);}});ami['on'](_0x7f3c('0x2c'),function(_0x5ce93a){try{utils[_0x7f3c('0x1b')](util['format'](_0x7f3c('0x2d'),_0x5ce93a[_0x7f3c('0x1f')]),_0x5ce93a);queues[_0x7f3c('0x2c')](_0x5ce93a);}catch(_0x450864){utils['error'](util['format'](_0x7f3c('0x2d'),_0x5ce93a[_0x7f3c('0x1f')]),_0x450864);}});ami['on'](_0x7f3c('0x2e'),function(_0x5cf99e){try{utils[_0x7f3c('0x1b')](util[_0x7f3c('0x21')]('[%s][index][musiconholdstart]',_0x5cf99e[_0x7f3c('0x1f')]),_0x5cf99e);queues[_0x7f3c('0x2e')](_0x5cf99e);calls[_0x7f3c('0x2e')](_0x5cf99e);}catch(_0xf3cc75){utils[_0x7f3c('0x17')](util[_0x7f3c('0x21')]('[%s][index][musiconholdstart]',_0x5cf99e[_0x7f3c('0x1f')]),_0xf3cc75);}});ami['on'](_0x7f3c('0x2f'),function(_0x95ad07){try{utils[_0x7f3c('0x1b')](util[_0x7f3c('0x21')](_0x7f3c('0x30'),_0x95ad07[_0x7f3c('0x1f')]),_0x95ad07);queues[_0x7f3c('0x2f')](_0x95ad07);calls[_0x7f3c('0x2f')](_0x95ad07);}catch(_0x4a8078){utils[_0x7f3c('0x17')](util['format']('[%s][index][musiconholdstop]',_0x95ad07[_0x7f3c('0x1f')]),_0x4a8078);}});ami['on'](_0x7f3c('0x31'),function(_0x3160a4){try{utils[_0x7f3c('0x1b')](util[_0x7f3c('0x21')](_0x7f3c('0x32'),_0x3160a4[_0x7f3c('0x1f')]),_0x3160a4);calls['newstate'](_0x3160a4);recordings['newstate'](_0x3160a4);}catch(_0x3e2a54){utils[_0x7f3c('0x17')](util[_0x7f3c('0x21')](_0x7f3c('0x32'),_0x3160a4['uniqueid']),_0x3e2a54);}});ami['on'](_0x7f3c('0x33'),function(_0x121a30){try{utils[_0x7f3c('0x1b')](util[_0x7f3c('0x21')](_0x7f3c('0x34'),_0x121a30[_0x7f3c('0x1f')]),_0x121a30);calls['hangup'](_0x121a30);recordings[_0x7f3c('0x33')](_0x121a30);dials[_0x7f3c('0x33')](_0x121a30);agents[_0x7f3c('0x33')](_0x121a30);queues[_0x7f3c('0x33')](_0x121a30);}catch(_0x1ef688){utils[_0x7f3c('0x17')](util[_0x7f3c('0x21')]('[%s][index][hangup]',_0x121a30[_0x7f3c('0x1f')]),_0x1ef688);}});ami['on'](_0x7f3c('0x35'),function(_0x36e158){try{utils['debug'](util[_0x7f3c('0x21')](_0x7f3c('0x36'),_0x36e158['uniqueid']),_0x36e158);members[_0x7f3c('0x35')](_0x36e158);}catch(_0xe6f652){utils[_0x7f3c('0x17')](util[_0x7f3c('0x21')]('[%s][index][cdr]',_0x36e158['uniqueid']),_0xe6f652);}});ami['on'](_0x7f3c('0x37'),function(_0x5c8ee9){try{utils[_0x7f3c('0x1b')](util['format'](_0x7f3c('0x38'),_0x5c8ee9['uniqueid']),_0x5c8ee9);queues['blindtransfer'](_0x5c8ee9);agents[_0x7f3c('0x37')](_0x5c8ee9);transfers['blindtransfer'](_0x5c8ee9);recordings[_0x7f3c('0x37')](_0x5c8ee9);}catch(_0x2a87bc){utils[_0x7f3c('0x17')](util[_0x7f3c('0x21')](_0x7f3c('0x38'),_0x5c8ee9['uniqueid']),_0x2a87bc);}});ami['on'](_0x7f3c('0x39'),function(_0xb147e1){try{utils[_0x7f3c('0x1b')](util[_0x7f3c('0x21')](_0x7f3c('0x3a'),_0xb147e1['origtransfereruniqueid']),_0xb147e1);queues[_0x7f3c('0x39')](_0xb147e1);transfers['attendedtransfer'](_0xb147e1);agents[_0x7f3c('0x39')](_0xb147e1);calls[_0x7f3c('0x39')](_0xb147e1);}catch(_0x3feadc){utils[_0x7f3c('0x17')](util[_0x7f3c('0x21')](_0x7f3c('0x3a'),_0xb147e1[_0x7f3c('0x3b')]),_0x3feadc);}});ami['on'](_0x7f3c('0x3c'),function(_0x145908){try{utils['debug'](util[_0x7f3c('0x21')](_0x7f3c('0x3d'),_0x145908[_0x7f3c('0x1f')]),_0x145908);queues['varset'](_0x145908);recordings[_0x7f3c('0x3c')](_0x145908);calls[_0x7f3c('0x3c')](_0x145908);dials[_0x7f3c('0x3c')](_0x145908);}catch(_0x54e58b){utils[_0x7f3c('0x17')](util['format'](_0x7f3c('0x3d'),_0x145908['uniqueid']),_0x54e58b);}});ami['on']('newexten',function(_0x41d28b){try{utils[_0x7f3c('0x1b')](util[_0x7f3c('0x21')](_0x7f3c('0x3e'),_0x41d28b[_0x7f3c('0x1f')]),_0x41d28b);calls[_0x7f3c('0x3f')](_0x41d28b);recordings[_0x7f3c('0x3f')](_0x41d28b);dials[_0x7f3c('0x3f')](_0x41d28b);}catch(_0x231e52){utils[_0x7f3c('0x17')](util[_0x7f3c('0x21')]('[%s][index][newexten]',_0x41d28b[_0x7f3c('0x1f')]),_0x231e52);}});ami['on'](_0x7f3c('0x40'),function(_0x2fbb36){try{utils[_0x7f3c('0x1b')](util[_0x7f3c('0x21')](_0x7f3c('0x41'),_0x2fbb36[_0x7f3c('0x1f')]),_0x2fbb36);calls['newchannel'](_0x2fbb36);recordings[_0x7f3c('0x40')](_0x2fbb36);}catch(_0x54de66){utils['error'](util[_0x7f3c('0x21')](_0x7f3c('0x41'),_0x2fbb36[_0x7f3c('0x1f')]),_0x54de66);}});ami['on'](_0x7f3c('0x42'),function(_0x1d3416){try{utils['debug'](util[_0x7f3c('0x21')](_0x7f3c('0x43'),_0x1d3416[_0x7f3c('0x1f')]),_0x1d3416);dials[_0x7f3c('0x42')](_0x1d3416);}catch(_0x101811){utils[_0x7f3c('0x17')](util[_0x7f3c('0x21')]('[%s]dialbegin',_0x1d3416['uniqueid']),_0x101811);}});ami['on'](_0x7f3c('0x44'),function(_0x46c3ed){try{utils[_0x7f3c('0x1b')](util[_0x7f3c('0x21')](_0x7f3c('0x45'),_0x46c3ed[_0x7f3c('0x1f')]),_0x46c3ed);dials[_0x7f3c('0x44')](_0x46c3ed);}catch(_0x317da6){utils['error'](util[_0x7f3c('0x21')](_0x7f3c('0x45'),_0x46c3ed['uniqueid']),_0x317da6);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ada022a..39b5440 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 _0xce25=['NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','channel','split','assign','data1','data2','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','destination','./utils','info','format','uniqueid','interface','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','name','catch','some','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','agent'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xce25,0x196));var _0x5ce2=function(_0x9b163,_0x5d8c8f){_0x9b163=_0x9b163-0x0;var _0x824910=_0xce25[_0x9b163];return _0x824910;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x5ce2('0x0'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x4dc355){utils[_0x5ce2('0x1')](util[_0x5ce2('0x2')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x4dc355[_0x5ce2('0x3')],_0x4dc355[_0x5ce2('0x4')],_0x4dc355['channel'],_0x4dc355['data2'],_0x4dc355[_0x5ce2('0x5')],_0x4dc355[_0x5ce2('0x6')]));if(_0x4dc355[_0x5ce2('0x4')]){utils[_0x5ce2('0x7')](_0x4dc355['interface'])[_0x5ce2('0x8')](function(_0x412b62){if(_0x412b62){_0x4dc355[_0x5ce2('0x5')]=_0x412b62['name'];_0x4dc355[_0x5ce2('0x9')]=_0x412b62[_0x5ce2('0x9')];utils[_0x5ce2('0xa')](_0x5ce2('0xb'),_0x4dc355);}else{utils[_0x5ce2('0xc')](_0x4dc355[_0x5ce2('0x4')]['split']('/')[0x1])[_0x5ce2('0x8')](function(_0x4f7a36){if(_0x4f7a36){_0x4dc355[_0x5ce2('0x5')]=_0x4f7a36[_0x5ce2('0xd')];_0x4dc355['internal']=_0x4f7a36['internal'];utils['request']('CreateMemberReport',_0x4dc355);}});}})[_0x5ce2('0xe')](function(_0x4ed2f3){utils['error'](util[_0x5ce2('0x2')]('[%s][members][writeDB]',_0x4dc355[_0x5ce2('0x3')]),_0x4ed2f3);});}delete members[_0x4dc355[_0x5ce2('0x4')]];}function startsWith(_0x24522c,_0x53e047){return _[_0x5ce2('0xf')](_0x24522c,function(_0x2727c7){return _[_0x5ce2('0x10')](_0x53e047,_0x2727c7);});}exports['devicestatechange']=function(_0x4b89d3){try{utils[_0x5ce2('0x11')](util[_0x5ce2('0x2')](_0x5ce2('0x12'),members[_0x4b89d3['device']]?members[_0x4b89d3[_0x5ce2('0x13')]][_0x5ce2('0x3')]:_0x4b89d3[_0x5ce2('0x13')]),_0x4b89d3);utils[_0x5ce2('0x1')](util[_0x5ce2('0x2')](_0x5ce2('0x14'),members[_0x4b89d3[_0x5ce2('0x13')]]?members[_0x4b89d3[_0x5ce2('0x13')]][_0x5ce2('0x3')]:_0x4b89d3[_0x5ce2('0x13')],_0x4b89d3[_0x5ce2('0x15')],_0x4b89d3[_0x5ce2('0x13')]));switch(_0x4b89d3[_0x5ce2('0x15')]){case _0x5ce2('0x16'):case _0x5ce2('0x17'):if(!startsWith(exclude,_0x4b89d3[_0x5ce2('0x13')])){members[_0x4b89d3[_0x5ce2('0x13')]]={'channel':_0x5ce2('0x18'),'interface':_0x4b89d3[_0x5ce2('0x13')],'type':'TALKING','enterAt':utils['now'](),'role':_0x5ce2('0x19')};}break;case _0x5ce2('0x1a'):if(!_[_0x5ce2('0x1b')](members[_0x4b89d3['device']])){members[_0x4b89d3['device']][_0x5ce2('0x1c')]=utils[_0x5ce2('0x1d')]();members[_0x4b89d3['device']][_0x5ce2('0x1e')]=utils[_0x5ce2('0x1f')](members[_0x4b89d3[_0x5ce2('0x13')]][_0x5ce2('0x1c')],members[_0x4b89d3[_0x5ce2('0x13')]][_0x5ce2('0x20')]);if(members[_0x4b89d3[_0x5ce2('0x13')]][_0x5ce2('0x3')]){writeDB(members[_0x4b89d3[_0x5ce2('0x13')]]);}}break;default:break;}}catch(_0x642b21){utils[_0x5ce2('0x21')](util[_0x5ce2('0x2')](_0x5ce2('0x12'),members[_0x4b89d3[_0x5ce2('0x13')]]?members[_0x4b89d3[_0x5ce2('0x13')]][_0x5ce2('0x3')]:_0x4b89d3[_0x5ce2('0x13')]),_0x642b21);}};exports[_0x5ce2('0x22')]=function(_0x444d56){try{if(!_[_0x5ce2('0x1b')](members[_0x444d56[_0x5ce2('0x4')]])){utils[_0x5ce2('0x11')](util[_0x5ce2('0x2')](_0x5ce2('0x23'),_0x444d56[_0x5ce2('0x3')]),_0x444d56);utils[_0x5ce2('0x1')](util[_0x5ce2('0x2')](_0x5ce2('0x24'),_0x444d56[_0x5ce2('0x3')],_0x444d56[_0x5ce2('0x4')],_0x444d56[_0x5ce2('0x25')]));members[_0x444d56[_0x5ce2('0x4')]]=_['assign'](members[_0x444d56[_0x5ce2('0x4')]],{'data4':_0x444d56[_0x5ce2('0x25')],'uniqueid':_0x444d56[_0x5ce2('0x3')]});}}catch(_0x55fe14){utils['error'](util[_0x5ce2('0x2')](_0x5ce2('0x23'),_0x444d56[_0x5ce2('0x3')]),_0x55fe14);}};exports['cdr']=function(_0x562604){try{utils[_0x5ce2('0x11')](util[_0x5ce2('0x2')]('[%s][members][cdr]',_0x562604[_0x5ce2('0x3')]),_0x562604);if(_0x562604[_0x5ce2('0x26')]){var _0x106ecc=_0x562604[_0x5ce2('0x26')][_0x5ce2('0x27')]('-')[0x0];if(!_[_0x5ce2('0x1b')](members[_0x106ecc])){members[_0x106ecc]=_[_0x5ce2('0x28')](members[_0x106ecc],{'data1':members[_0x106ecc][_0x5ce2('0x29')]||_0x562604[_0x5ce2('0x6')],'data2':members[_0x106ecc][_0x5ce2('0x2a')]||_0x562604[_0x5ce2('0x2b')],'data3':members[_0x106ecc]['data3']||_0x562604['destination'],'uniqueid':members[_0x106ecc]['uniqueid']||_0x562604['uniqueid']});utils[_0x5ce2('0x1')](util[_0x5ce2('0x2')](_0x5ce2('0x2c'),_0x562604[_0x5ce2('0x3')],members[_0x106ecc][_0x5ce2('0x29')],members[_0x106ecc][_0x5ce2('0x2a')],members[_0x106ecc][_0x5ce2('0x2d')]));if(members[_0x106ecc][_0x5ce2('0x1c')]){writeDB(members[_0x106ecc]);}}}if(_0x562604[_0x5ce2('0x2e')]){var _0x3ea38e=_0x562604[_0x5ce2('0x2e')][_0x5ce2('0x27')]('-')[0x0];if(!_['isNil'](members[_0x3ea38e])){members[_0x3ea38e]=_[_0x5ce2('0x28')](members[_0x3ea38e],{'data1':members[_0x3ea38e][_0x5ce2('0x29')]||_0x562604['type'],'data2':members[_0x3ea38e][_0x5ce2('0x2a')]||_0x562604[_0x5ce2('0x2b')],'data3':members[_0x3ea38e][_0x5ce2('0x2d')]||_0x562604[_0x5ce2('0x2f')],'uniqueid':members[_0x3ea38e]['uniqueid']||_0x562604[_0x5ce2('0x3')]});utils[_0x5ce2('0x1')](util[_0x5ce2('0x2')](_0x5ce2('0x2c'),_0x562604[_0x5ce2('0x3')],members[_0x3ea38e][_0x5ce2('0x29')],members[_0x3ea38e]['data2'],members[_0x3ea38e][_0x5ce2('0x2d')]));if(members[_0x3ea38e][_0x5ce2('0x1c')]){writeDB(members[_0x3ea38e]);}}}}catch(_0x5c290a){utils[_0x5ce2('0x21')](util[_0x5ce2('0x2')]('[%s][members][cdr]',_0x562604[_0x5ce2('0x3')]),_0x5c290a);}}; \ No newline at end of file +var _0xd0ba=['format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','interface','getUserByInterface','name','internal','request','getUserByName','split','then','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','debug','[%s][members][agentcomplete]','queue','cdr','[%s][members][cdr]','assign','type','source','data3','destination','data1','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Local/_attended@transfer','Queue:','info'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xd0ba,0x17c));var _0xad0b=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xd0ba[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require(_0xad0b('0x0'));var utils=require(_0xad0b('0x1'));var members={};var exclude=[_0xad0b('0x2'),_0xad0b('0x3')];function writeDB(_0x1789a4){utils[_0xad0b('0x4')](util[_0xad0b('0x5')](_0xad0b('0x6'),_0x1789a4[_0xad0b('0x7')],_0x1789a4['interface'],_0x1789a4[_0xad0b('0x8')],_0x1789a4[_0xad0b('0x9')],_0x1789a4[_0xad0b('0xa')],_0x1789a4['type']));if(_0x1789a4[_0xad0b('0xb')]){utils[_0xad0b('0xc')](_0x1789a4['interface'])['then'](function(_0x51b082){if(_0x51b082){_0x1789a4['membername']=_0x51b082[_0xad0b('0xd')];_0x1789a4['internal']=_0x51b082[_0xad0b('0xe')];utils[_0xad0b('0xf')]('CreateMemberReport',_0x1789a4);}else{utils[_0xad0b('0x10')](_0x1789a4[_0xad0b('0xb')][_0xad0b('0x11')]('/')[0x1])[_0xad0b('0x12')](function(_0x56c92a){if(_0x56c92a){_0x1789a4['membername']=_0x56c92a[_0xad0b('0xd')];_0x1789a4[_0xad0b('0xe')]=_0x56c92a[_0xad0b('0xe')];utils[_0xad0b('0xf')](_0xad0b('0x13'),_0x1789a4);}});}})[_0xad0b('0x14')](function(_0xcb09c1){utils[_0xad0b('0x15')](util[_0xad0b('0x5')](_0xad0b('0x16'),_0x1789a4['uniqueid']),_0xcb09c1);});}delete members[_0x1789a4[_0xad0b('0xb')]];}function startsWith(_0x8deb46,_0x535618){return _[_0xad0b('0x17')](_0x8deb46,function(_0x5b171e){return _[_0xad0b('0x18')](_0x535618,_0x5b171e);});}exports[_0xad0b('0x19')]=function(_0x4394be){try{utils['debug'](util['format'](_0xad0b('0x1a'),members[_0x4394be['device']]?members[_0x4394be['device']][_0xad0b('0x7')]:_0x4394be[_0xad0b('0x1b')]),_0x4394be);utils[_0xad0b('0x4')](util[_0xad0b('0x5')](_0xad0b('0x1c'),members[_0x4394be['device']]?members[_0x4394be['device']][_0xad0b('0x7')]:_0x4394be[_0xad0b('0x1b')],_0x4394be[_0xad0b('0x1d')],_0x4394be[_0xad0b('0x1b')]));switch(_0x4394be[_0xad0b('0x1d')]){case _0xad0b('0x1e'):case _0xad0b('0x1f'):if(!startsWith(exclude,_0x4394be[_0xad0b('0x1b')])){members[_0x4394be[_0xad0b('0x1b')]]={'channel':_0xad0b('0x20'),'interface':_0x4394be[_0xad0b('0x1b')],'type':_0xad0b('0x21'),'enterAt':utils[_0xad0b('0x22')](),'role':_0xad0b('0x23')};}break;case _0xad0b('0x24'):if(!_[_0xad0b('0x25')](members[_0x4394be[_0xad0b('0x1b')]])){members[_0x4394be[_0xad0b('0x1b')]][_0xad0b('0x26')]=utils[_0xad0b('0x22')]();members[_0x4394be[_0xad0b('0x1b')]][_0xad0b('0x27')]=utils[_0xad0b('0x28')](members[_0x4394be[_0xad0b('0x1b')]][_0xad0b('0x26')],members[_0x4394be[_0xad0b('0x1b')]][_0xad0b('0x29')]);if(members[_0x4394be['device']]['uniqueid']){writeDB(members[_0x4394be[_0xad0b('0x1b')]]);}}break;default:break;}}catch(_0x21d104){utils[_0xad0b('0x15')](util[_0xad0b('0x5')](_0xad0b('0x1a'),members[_0x4394be[_0xad0b('0x1b')]]?members[_0x4394be[_0xad0b('0x1b')]][_0xad0b('0x7')]:_0x4394be[_0xad0b('0x1b')]),_0x21d104);}};exports['agentcomplete']=function(_0x13ff80){try{if(!_[_0xad0b('0x25')](members[_0x13ff80['interface']])){utils[_0xad0b('0x2a')](util[_0xad0b('0x5')](_0xad0b('0x2b'),_0x13ff80[_0xad0b('0x7')]),_0x13ff80);utils[_0xad0b('0x4')](util[_0xad0b('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x13ff80['uniqueid'],_0x13ff80[_0xad0b('0xb')],_0x13ff80[_0xad0b('0x2c')]));members[_0x13ff80['interface']]=_['assign'](members[_0x13ff80[_0xad0b('0xb')]],{'data4':_0x13ff80['queue'],'uniqueid':_0x13ff80[_0xad0b('0x7')]});}}catch(_0x1f5045){utils[_0xad0b('0x15')](util[_0xad0b('0x5')](_0xad0b('0x2b'),_0x13ff80['uniqueid']),_0x1f5045);}};exports[_0xad0b('0x2d')]=function(_0x2998c8){try{utils[_0xad0b('0x2a')](util[_0xad0b('0x5')](_0xad0b('0x2e'),_0x2998c8[_0xad0b('0x7')]),_0x2998c8);if(_0x2998c8[_0xad0b('0x8')]){var _0x3d1bd0=_0x2998c8[_0xad0b('0x8')][_0xad0b('0x11')]('-')[0x0];if(!_[_0xad0b('0x25')](members[_0x3d1bd0])){members[_0x3d1bd0]=_[_0xad0b('0x2f')](members[_0x3d1bd0],{'data1':members[_0x3d1bd0]['data1']||_0x2998c8[_0xad0b('0x30')],'data2':members[_0x3d1bd0][_0xad0b('0x9')]||_0x2998c8[_0xad0b('0x31')],'data3':members[_0x3d1bd0][_0xad0b('0x32')]||_0x2998c8[_0xad0b('0x33')],'uniqueid':members[_0x3d1bd0][_0xad0b('0x7')]||_0x2998c8['uniqueid']});utils[_0xad0b('0x4')](util[_0xad0b('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2998c8[_0xad0b('0x7')],members[_0x3d1bd0][_0xad0b('0x34')],members[_0x3d1bd0][_0xad0b('0x9')],members[_0x3d1bd0]['data3']));if(members[_0x3d1bd0]['exitAt']){writeDB(members[_0x3d1bd0]);}}}if(_0x2998c8[_0xad0b('0x35')]){var _0x14bfd0=_0x2998c8[_0xad0b('0x35')]['split']('-')[0x0];if(!_[_0xad0b('0x25')](members[_0x14bfd0])){members[_0x14bfd0]=_['assign'](members[_0x14bfd0],{'data1':members[_0x14bfd0][_0xad0b('0x34')]||_0x2998c8[_0xad0b('0x30')],'data2':members[_0x14bfd0][_0xad0b('0x9')]||_0x2998c8[_0xad0b('0x31')],'data3':members[_0x14bfd0][_0xad0b('0x32')]||_0x2998c8['destination'],'uniqueid':members[_0x14bfd0][_0xad0b('0x7')]||_0x2998c8[_0xad0b('0x7')]});utils[_0xad0b('0x4')](util[_0xad0b('0x5')](_0xad0b('0x36'),_0x2998c8['uniqueid'],members[_0x14bfd0][_0xad0b('0x34')],members[_0x14bfd0]['data2'],members[_0x14bfd0]['data3']));if(members[_0x14bfd0][_0xad0b('0x26')]){writeDB(members[_0x14bfd0]);}}}}catch(_0x30fa5){utils[_0xad0b('0x15')](util['format']('[%s][members][cdr]',_0x2998c8[_0xad0b('0x7')]),_0x30fa5);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f318175..53bbb69 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 _0x72c2=['queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]','destaccountcode','membername','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferuniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum'];(function(_0x13992d,_0x3029ea){var _0x3d15bf=function(_0x3444f7){while(--_0x3444f7){_0x13992d['push'](_0x13992d['shift']());}};_0x3d15bf(++_0x3029ea);}(_0x72c2,0x19a));var _0x272c=function(_0x4b9015,_0xac9fa0){_0x4b9015=_0x4b9015-0x0;var _0x498321=_0x72c2[_0x4b9015];return _0x498321;};'use strict';var _=require(_0x272c('0x0'));var util=require(_0x272c('0x1'));var utils=require(_0x272c('0x2'));var queues={};function writeDB(_0x2f8baf){utils[_0x272c('0x3')](util[_0x272c('0x4')](_0x272c('0x5'),_0x2f8baf[_0x272c('0x6')],_0x2f8baf['channel'],_0x2f8baf[_0x272c('0x7')],_0x2f8baf[_0x272c('0x8')],_0x2f8baf[_0x272c('0x9')],_0x2f8baf['accountcode'],_0x2f8baf[_0x272c('0xa')]));if(_0x2f8baf[_0x272c('0x7')]){utils[_0x272c('0xb')](_0x2f8baf[_0x272c('0x7')])['then'](function(_0x155dd5){if(_0x155dd5){_0x2f8baf[_0x272c('0xc')]=_0x155dd5[_0x272c('0xc')];}utils[_0x272c('0xd')](_0x272c('0xe'),_0x2f8baf);});}else{utils[_0x272c('0xd')](_0x272c('0xe'),_0x2f8baf);}if(_0x2f8baf[_0x272c('0xf')]){delete queues[_0x2f8baf[_0x272c('0xf')]];}else{delete queues[_0x2f8baf[_0x272c('0x6')]];}}exports[_0x272c('0x10')]=function(_0x4ebfd8){try{utils[_0x272c('0x11')](util[_0x272c('0x4')](_0x272c('0x12'),_0x4ebfd8[_0x272c('0x6')]),_0x4ebfd8);utils[_0x272c('0x3')](util[_0x272c('0x4')](_0x272c('0x13'),_0x4ebfd8[_0x272c('0x6')],_0x4ebfd8[_0x272c('0x7')],_0x4ebfd8[_0x272c('0x14')]));queues[_0x4ebfd8[_0x272c('0x6')]]=_[_0x272c('0x15')](_0x4ebfd8,{'originalposition':_0x4ebfd8['position'],'queuecallerjoinAt':utils[_0x272c('0x16')](),'mohtime':0x0});}catch(_0x528d83){utils[_0x272c('0x17')](util[_0x272c('0x4')](_0x272c('0x12'),_0x4ebfd8['uniqueid']),_0x528d83);}};exports[_0x272c('0x18')]=function(_0x315bf7){try{if(!_[_0x272c('0x19')](queues[_0x315bf7[_0x272c('0x6')]])){utils[_0x272c('0x11')](util['format']('[%s][queues][hangup]',_0x315bf7[_0x272c('0x6')]),_0x315bf7);if(queues[_0x315bf7[_0x272c('0x6')]][_0x272c('0x1a')]){if(!queues[_0x315bf7[_0x272c('0x6')]][_0x272c('0x1b')]&&!queues[_0x315bf7[_0x272c('0x6')]][_0x272c('0x1c')]){queues[_0x315bf7[_0x272c('0x6')]][_0x272c('0x1d')]=!![];queues[_0x315bf7[_0x272c('0x6')]][_0x272c('0x1e')]=utils[_0x272c('0x16')]();queues[_0x315bf7[_0x272c('0x6')]][_0x272c('0xa')]=_0x272c('0x1f');}utils[_0x272c('0x3')](util[_0x272c('0x4')](_0x272c('0x20'),_0x315bf7[_0x272c('0x6')],queues[_0x315bf7[_0x272c('0x6')]][_0x272c('0x21')],queues[_0x315bf7[_0x272c('0x6')]][_0x272c('0xa')]));writeDB(queues[_0x315bf7['uniqueid']]);}else if(queues[_0x315bf7['uniqueid']][_0x272c('0xf')]){utils[_0x272c('0x3')](util['format'](_0x272c('0x22'),_0x315bf7[_0x272c('0x6')],queues[_0x315bf7[_0x272c('0x6')]][_0x272c('0x21')],queues[_0x315bf7[_0x272c('0x6')]]['transfereduniqueid']));queues[queues[_0x315bf7[_0x272c('0x6')]][_0x272c('0xf')]]=queues[_0x315bf7[_0x272c('0x6')]];queues[queues[_0x315bf7[_0x272c('0x6')]][_0x272c('0xf')]][_0x272c('0x23')]=0x2;delete queues[_0x315bf7[_0x272c('0x6')]];}}}catch(_0x3218da){utils[_0x272c('0x17')](util['format'](_0x272c('0x24'),_0x315bf7[_0x272c('0x6')]),_0x3218da);}};exports[_0x272c('0x25')]=function(_0xe2d525){try{utils['debug'](util[_0x272c('0x4')]('[%s][queues][varset]',_0xe2d525['uniqueid']),_0xe2d525);if(!_[_0x272c('0x19')](_0xe2d525[_0x272c('0x26')][_0x272c('0x27')])&&_0xe2d525['value'][_0x272c('0x28')]()!==_0x272c('0x29')){if(!_[_0x272c('0x19')](queues[_0xe2d525[_0x272c('0x6')]])){queues[_0xe2d525['uniqueid']][_0x272c('0x1b')]=![];queues[_0xe2d525[_0x272c('0x6')]][_0x272c('0x2a')]=null;queues[_0xe2d525[_0x272c('0x6')]][_0x272c('0x1c')]=!![];queues[_0xe2d525['uniqueid']][_0x272c('0x2b')]=utils[_0x272c('0x16')]();queues[_0xe2d525[_0x272c('0x6')]]['queuecallerexitreason']=_0xe2d525[_0x272c('0x2c')][_0x272c('0x28')]();utils[_0x272c('0x3')](util['format'](_0x272c('0x2d'),_0xe2d525['uniqueid'],queues[_0xe2d525['uniqueid']][_0x272c('0x21')],_0xe2d525[_0x272c('0x2c')],queues[_0xe2d525[_0x272c('0x6')]]['queuecallerexitreason']));writeDB(queues[_0xe2d525[_0x272c('0x6')]]);}}else if(!_['isNil'](_0xe2d525[_0x272c('0x26')][_0x272c('0x2e')])){if(!_[_0x272c('0x19')](queues[_0xe2d525['uniqueid']])&&!queues[_0xe2d525[_0x272c('0x6')]][_0x272c('0x1b')]){queues[_0xe2d525[_0x272c('0x6')]]['queuecallerabandon']=![];queues[_0xe2d525[_0x272c('0x6')]][_0x272c('0x2a')]=null;queues[_0xe2d525[_0x272c('0x6')]][_0x272c('0x1c')]=!![];queues[_0xe2d525[_0x272c('0x6')]]['queuecallerexitAt']=utils['now']();queues[_0xe2d525['uniqueid']][_0x272c('0xa')]=_0x272c('0x2f');utils[_0x272c('0x3')](util[_0x272c('0x4')](_0x272c('0x30'),_0xe2d525['uniqueid'],queues[_0xe2d525['uniqueid']][_0x272c('0x21')],_0xe2d525[_0x272c('0x2c')],queues[_0xe2d525['uniqueid']][_0x272c('0xa')]));}}}catch(_0x410712){utils[_0x272c('0x17')](util[_0x272c('0x4')](_0x272c('0x31'),_0xe2d525[_0x272c('0x6')]),_0x410712);}};exports[_0x272c('0x1b')]=function(_0x381bb5){try{if(!_[_0x272c('0x19')](queues[_0x381bb5['uniqueid']])){utils['debug'](util[_0x272c('0x4')]('[%s][queues][queuecallerabandon]',_0x381bb5[_0x272c('0x6')]),_0x381bb5);queues[_0x381bb5['uniqueid']][_0x272c('0x1c')]=![];queues[_0x381bb5['uniqueid']][_0x272c('0x2b')]=null;queues[_0x381bb5[_0x272c('0x6')]][_0x272c('0x1b')]=!![];queues[_0x381bb5['uniqueid']][_0x272c('0x2a')]=utils['now']();queues[_0x381bb5['uniqueid']]['queuecallerexitreason']=_0x272c('0x32');utils[_0x272c('0x3')](util['format'](_0x272c('0x33'),_0x381bb5['uniqueid'],queues[_0x381bb5[_0x272c('0x6')]][_0x272c('0x21')],queues[_0x381bb5[_0x272c('0x6')]][_0x272c('0xa')]));}}catch(_0x241954){utils[_0x272c('0x17')](util['format'](_0x272c('0x34'),_0x381bb5['uniqueid']),_0x241954);}};exports[_0x272c('0x35')]=function(_0x47db0e){try{if(!_[_0x272c('0x19')](queues[_0x47db0e[_0x272c('0x6')]])){utils[_0x272c('0x11')](util[_0x272c('0x4')](_0x272c('0x36'),_0x47db0e['uniqueid']),_0x47db0e);utils[_0x272c('0x3')](util[_0x272c('0x4')](_0x272c('0x37'),_0x47db0e[_0x272c('0x6')],queues[_0x47db0e[_0x272c('0x6')]][_0x272c('0x21')],_0x47db0e[_0x272c('0x38')],_0x47db0e[_0x272c('0x39')]));queues[_0x47db0e[_0x272c('0x6')]][_0x272c('0x35')]=!![];queues[_0x47db0e[_0x272c('0x6')]][_0x272c('0x1a')]=utils[_0x272c('0x16')]();queues[_0x47db0e[_0x272c('0x6')]][_0x272c('0x3a')]=utils[_0x272c('0x3b')](queues[_0x47db0e['uniqueid']][_0x272c('0x1a')],queues[_0x47db0e[_0x272c('0x6')]]['queuecallerjoinAt']);queues[_0x47db0e[_0x272c('0x6')]][_0x272c('0x14')]=_0x47db0e[_0x272c('0x14')];queues[_0x47db0e[_0x272c('0x6')]][_0x272c('0x3c')]=_0x47db0e[_0x272c('0x3c')];queues[_0x47db0e[_0x272c('0x6')]][_0x272c('0x38')]=_0x47db0e[_0x272c('0x38')];queues[_0x47db0e['uniqueid']][_0x272c('0x39')]=_0x47db0e[_0x272c('0x39')];}}catch(_0x339d07){utils['error'](util[_0x272c('0x4')](_0x272c('0x36'),_0x47db0e[_0x272c('0x6')]),_0x339d07);}};exports[_0x272c('0x3d')]=function(_0x4b594d){try{if(!_[_0x272c('0x19')](queues[_0x4b594d[_0x272c('0x6')]])){utils['debug'](util[_0x272c('0x4')](_0x272c('0x3e'),_0x4b594d[_0x272c('0x6')]),_0x4b594d);utils[_0x272c('0x3')](util[_0x272c('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4b594d['uniqueid'],queues[_0x4b594d['uniqueid']][_0x272c('0x21')],_0x4b594d['membername'],_0x4b594d[_0x272c('0x3f')]));queues[_0x4b594d[_0x272c('0x6')]]['queuecallerabandon']=![];queues[_0x4b594d['uniqueid']][_0x272c('0x1b')]=![];queues[_0x4b594d['uniqueid']]['queuecallerabandonAt']=null;queues[_0x4b594d[_0x272c('0x6')]]['queuecallerexit']=![];queues[_0x4b594d['uniqueid']]['queuecallerexitreason']=null;queues[_0x4b594d['uniqueid']][_0x272c('0x2b')]=null;queues[_0x4b594d[_0x272c('0x6')]]['assigned']=!![];queues[_0x4b594d[_0x272c('0x6')]]['accountcode']=_0x4b594d[_0x272c('0x3f')];queues[_0x4b594d[_0x272c('0x6')]]['lastAssignedTo']=_0x4b594d[_0x272c('0x40')];}}catch(_0x108499){utils[_0x272c('0x17')](util[_0x272c('0x4')](_0x272c('0x3e'),_0x4b594d['uniqueid']),_0x108499);}};exports[_0x272c('0x41')]=function(_0xf9c9e8){try{if(!_[_0x272c('0x19')](queues[_0xf9c9e8[_0x272c('0x6')]])){if(queues[_0xf9c9e8[_0x272c('0x6')]]['queuecallerleaveAt']){utils[_0x272c('0x11')](util[_0x272c('0x4')](_0x272c('0x42'),_0xf9c9e8[_0x272c('0x6')]),_0xf9c9e8);queues[_0xf9c9e8[_0x272c('0x6')]]['queuecallerabandon']=![];queues[_0xf9c9e8[_0x272c('0x6')]]['queuecallerabandon']=![];queues[_0xf9c9e8[_0x272c('0x6')]][_0x272c('0x2a')]=null;queues[_0xf9c9e8[_0x272c('0x6')]][_0x272c('0x1c')]=![];queues[_0xf9c9e8[_0x272c('0x6')]]['queuecallerexitAt']=null;queues[_0xf9c9e8['uniqueid']][_0x272c('0x43')]=!![];queues[_0xf9c9e8[_0x272c('0x6')]]['lastAssignedTo']=_0xf9c9e8[_0x272c('0x40')];queues[_0xf9c9e8[_0x272c('0x6')]][_0x272c('0x1d')]=!![];queues[_0xf9c9e8['uniqueid']][_0x272c('0x1e')]=utils[_0x272c('0x16')]();if(_0xf9c9e8[_0x272c('0x44')]==_0x272c('0x45')){if(!queues[_0xf9c9e8[_0x272c('0x6')]][_0x272c('0x45')]){queues[_0xf9c9e8[_0x272c('0x6')]][_0x272c('0xa')]=_0x272c('0x46');}}else{queues[_0xf9c9e8[_0x272c('0x6')]]['queuecallerexitreason']=_0x272c('0x47')+_0xf9c9e8[_0x272c('0x44')]['toUpperCase']();}utils[_0x272c('0x3')](util[_0x272c('0x4')](_0x272c('0x48'),_0xf9c9e8[_0x272c('0x6')],queues[_0xf9c9e8[_0x272c('0x6')]]['name'],_0xf9c9e8[_0x272c('0x40')],queues[_0xf9c9e8[_0x272c('0x6')]]['queuecallerexitreason']));writeDB(queues[_0xf9c9e8[_0x272c('0x6')]]);}}}catch(_0x2b9cdf){utils[_0x272c('0x17')](util['format'](_0x272c('0x42'),_0xf9c9e8[_0x272c('0x6')]),_0x2b9cdf);}};exports['blindtransfer']=function(_0x3863d3){try{if(!_['isNil'](queues[_0x3863d3[_0x272c('0x49')]])){utils[_0x272c('0x11')](util[_0x272c('0x4')](_0x272c('0x4a'),_0x3863d3[_0x272c('0x6')]),_0x3863d3);queues[_0x3863d3[_0x272c('0x49')]][_0x272c('0x45')]=!![];queues[_0x3863d3[_0x272c('0x49')]][_0x272c('0x4b')]=_0x272c('0x4c');queues[_0x3863d3[_0x272c('0x49')]][_0x272c('0x4d')]=_0x3863d3[_0x272c('0x4e')];queues[_0x3863d3[_0x272c('0x49')]]['transferuniqueid']=_0x3863d3[_0x272c('0x49')];queues[_0x3863d3[_0x272c('0x49')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0x272c('0x3')](util[_0x272c('0x4')](_0x272c('0x4f'),_0x3863d3['uniqueid'],queues[_0x3863d3[_0x272c('0x49')]][_0x272c('0x21')],_0x3863d3['transfereeuniqueid'],_0x3863d3[_0x272c('0x4e')]));}}catch(_0x408231){utils[_0x272c('0x17')](util[_0x272c('0x4')](_0x272c('0x4a'),_0x3863d3[_0x272c('0x6')]),_0x408231);}};exports[_0x272c('0x50')]=function(_0x4dd8fe){try{utils[_0x272c('0x11')](util[_0x272c('0x4')]('[%s][queues][attendedtransfer]',_0x4dd8fe[_0x272c('0x51')]),_0x4dd8fe);if(_0x4dd8fe[_0x272c('0x51')]==_0x4dd8fe[_0x272c('0x52')]){if(!_[_0x272c('0x19')](queues[_0x4dd8fe[_0x272c('0x53')]])){utils[_0x272c('0x3')](util[_0x272c('0x4')](_0x272c('0x54'),_0x4dd8fe[_0x272c('0x51')],queues[_0x4dd8fe['secondtransfererlinkedid']][_0x272c('0x21')],_0x4dd8fe['origtransfererexten']));queues[_0x4dd8fe['secondtransfererlinkedid']][_0x272c('0x45')]=!![];queues[_0x4dd8fe[_0x272c('0x53')]]['transfertype']=_0x272c('0x55');queues[_0x4dd8fe[_0x272c('0x53')]][_0x272c('0x4d')]=_0x4dd8fe[_0x272c('0x56')];queues[_0x4dd8fe[_0x272c('0x53')]]['transferuniqueid']=_0x4dd8fe['origtransfereruniqueid'];queues[_0x4dd8fe[_0x272c('0x53')]]['queuecallerexitreason']=_0x272c('0x57');}if(!_[_0x272c('0x19')](queues[_0x4dd8fe[_0x272c('0x52')]])){if(_0x4dd8fe[_0x272c('0x58')]&&queues[_0x4dd8fe['transfereelinkedid']]){queues[_0x4dd8fe[_0x272c('0x58')]][_0x272c('0x23')]=0x1;queues[_0x4dd8fe[_0x272c('0x49')]]=_[_0x272c('0x59')](queues[_0x4dd8fe[_0x272c('0x58')]]);queues[_0x4dd8fe['transfereeuniqueid']][_0x272c('0xf')]=_0x4dd8fe[_0x272c('0x5a')];queues[_0x4dd8fe[_0x272c('0x49')]][_0x272c('0x23')]=0x2;queues[_0x4dd8fe[_0x272c('0x49')]][_0x272c('0x9')]=queues[_0x4dd8fe[_0x272c('0x53')]][_0x272c('0x9')];queues[_0x4dd8fe[_0x272c('0x49')]]['calleridname']=queues[_0x4dd8fe[_0x272c('0x53')]]['calleridname'];queues[_0x4dd8fe['transfereeuniqueid']][_0x272c('0x5b')]=utils[_0x272c('0x16')]();queues[_0x4dd8fe['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x272c('0x16')]();queues[_0x4dd8fe['transfereeuniqueid']][_0x272c('0x3a')]=0x0;queues[_0x4dd8fe['transfereeuniqueid']][_0x272c('0x5c')]=0x0;utils[_0x272c('0x3')](util['format'](_0x272c('0x5d'),_0x4dd8fe[_0x272c('0x51')],queues[_0x4dd8fe[_0x272c('0x49')]]['name'],queues[_0x4dd8fe[_0x272c('0x49')]][_0x272c('0x9')],queues[_0x4dd8fe[_0x272c('0x49')]][_0x272c('0x5e')]));}else{utils[_0x272c('0x3')](util[_0x272c('0x4')](_0x272c('0x5f'),_0x4dd8fe[_0x272c('0x51')],queues[_0x4dd8fe[_0x272c('0x52')]][_0x272c('0x21')],_0x4dd8fe[_0x272c('0x53')]));queues[_0x4dd8fe[_0x272c('0x52')]][_0x272c('0xf')]=_0x4dd8fe[_0x272c('0x53')];}}}else if(_0x4dd8fe[_0x272c('0x60')]==_0x4dd8fe[_0x272c('0x53')]){if(!_[_0x272c('0x19')](queues[_0x4dd8fe['origtransfererlinkedid']])){utils[_0x272c('0x3')](util[_0x272c('0x4')](_0x272c('0x61'),_0x4dd8fe['origtransfereruniqueid'],queues[_0x4dd8fe[_0x272c('0x52')]][_0x272c('0x21')],_0x4dd8fe[_0x272c('0x60')],_0x4dd8fe[_0x272c('0x62')]));queues[_0x4dd8fe['origtransfererlinkedid']][_0x272c('0x45')]=!![];queues[_0x4dd8fe[_0x272c('0x52')]][_0x272c('0x4b')]='ATTENDED';queues[_0x4dd8fe[_0x272c('0x52')]][_0x272c('0x4d')]=_0x4dd8fe[_0x272c('0x62')];queues[_0x4dd8fe['origtransfererlinkedid']][_0x272c('0x63')]=_0x4dd8fe[_0x272c('0x60')];queues[_0x4dd8fe['origtransfererlinkedid']]['queuecallerexitreason']=_0x272c('0x57');}if(!_['isNil'](queues[_0x4dd8fe[_0x272c('0x53')]])){if(_0x4dd8fe[_0x272c('0x64')]&&queues[_0x4dd8fe[_0x272c('0x64')]]){queues[_0x4dd8fe['transfertargetlinkedid']][_0x272c('0x23')]=0x1;queues[_0x4dd8fe['transfertargetuniqueid']]=_[_0x272c('0x59')](queues[_0x4dd8fe[_0x272c('0x64')]]);queues[_0x4dd8fe[_0x272c('0x5a')]][_0x272c('0xf')]=_0x4dd8fe[_0x272c('0x5a')];queues[_0x4dd8fe[_0x272c('0x5a')]][_0x272c('0x23')]=0x2;queues[_0x4dd8fe['transfertargetuniqueid']][_0x272c('0x9')]=queues[_0x4dd8fe['origtransfererlinkedid']]['calleridnum'];queues[_0x4dd8fe[_0x272c('0x5a')]][_0x272c('0x5e')]=queues[_0x4dd8fe['origtransfererlinkedid']][_0x272c('0x5e')];queues[_0x4dd8fe[_0x272c('0x5a')]][_0x272c('0x5b')]=utils[_0x272c('0x16')]();queues[_0x4dd8fe[_0x272c('0x5a')]][_0x272c('0x1a')]=utils['now']();queues[_0x4dd8fe[_0x272c('0x5a')]][_0x272c('0x3a')]=0x0;queues[_0x4dd8fe[_0x272c('0x5a')]][_0x272c('0x5c')]=0x0;utils['info'](util[_0x272c('0x4')](_0x272c('0x65'),_0x4dd8fe[_0x272c('0x51')],queues[_0x4dd8fe['transfertargetuniqueid']][_0x272c('0x21')],queues[_0x4dd8fe['transfertargetuniqueid']][_0x272c('0xf')],queues[_0x4dd8fe[_0x272c('0x5a')]][_0x272c('0x9')],queues[_0x4dd8fe[_0x272c('0x5a')]]['calleridname']));}else{utils[_0x272c('0x3')](util[_0x272c('0x4')](_0x272c('0x5f'),_0x4dd8fe[_0x272c('0x51')],queues[_0x4dd8fe[_0x272c('0x53')]]['name'],_0x4dd8fe[_0x272c('0x52')]));queues[_0x4dd8fe['secondtransfererlinkedid']][_0x272c('0xf')]=_0x4dd8fe['origtransfererlinkedid'];}}}}catch(_0x13d79d){utils[_0x272c('0x17')](util[_0x272c('0x4')]('[%s][queues][attendedtransfer]',_0x4dd8fe['origtransfereruniqueid']),_0x13d79d);}};exports[_0x272c('0x66')]=function(_0x22f15c){try{if(!_[_0x272c('0x19')](queues[_0x22f15c[_0x272c('0x6')]])){utils[_0x272c('0x11')](util['format']('[%s][queues][musiconholdstart]',_0x22f15c[_0x272c('0x6')]),_0x22f15c);queues[_0x22f15c[_0x272c('0x6')]]['musiconholdstartAt']=utils[_0x272c('0x16')]();utils[_0x272c('0x3')](util[_0x272c('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x22f15c[_0x272c('0x6')],queues[_0x22f15c[_0x272c('0x6')]][_0x272c('0x21')],queues[_0x22f15c[_0x272c('0x6')]][_0x272c('0x67')]));}}catch(_0x349445){utils[_0x272c('0x17')](util[_0x272c('0x4')]('[%s][queues][musiconholdstart]',_0x22f15c[_0x272c('0x6')]),_0x349445);}};exports['musiconholdstop']=function(_0x3c3308){try{if(!_[_0x272c('0x19')](queues[_0x3c3308[_0x272c('0x6')]])){if(!_[_0x272c('0x19')](queues[_0x3c3308['uniqueid']][_0x272c('0x67')])){utils[_0x272c('0x11')](util[_0x272c('0x4')]('[%s][queues][musiconholdstop]',_0x3c3308[_0x272c('0x6')]),_0x3c3308);queues[_0x3c3308['uniqueid']][_0x272c('0x5c')]+=utils[_0x272c('0x3b')](utils[_0x272c('0x16')](),queues[_0x3c3308['uniqueid']][_0x272c('0x67')]);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x3c3308[_0x272c('0x6')],queues[_0x3c3308[_0x272c('0x6')]][_0x272c('0x21')],queues[_0x3c3308['uniqueid']][_0x272c('0x5c')]));delete queues[_0x3c3308[_0x272c('0x6')]]['musiconholdstartAt'];}}}catch(_0xcd79f0){utils[_0x272c('0x17')](util[_0x272c('0x4')](_0x272c('0x68'),_0x3c3308[_0x272c('0x6')]),_0xcd79f0);}}; \ No newline at end of file +var _0xe1a2=['value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerabandonAt','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','queuecallerexitAt','assigned','agentcomplete','[%s][queues][agentcomplete]','transfer','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','transferexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','info','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','[%s][queues][queuecallerjoin]','position','assign','now','error','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','toUpperCase','CONTINUE','queuecallerabandon','queuecallerexit'];(function(_0x538613,_0x4f910f){var _0x330343=function(_0x12d4ac){while(--_0x12d4ac){_0x538613['push'](_0x538613['shift']());}};_0x330343(++_0x4f910f);}(_0xe1a2,0x9f));var _0x2e1a=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0xe1a2[_0x2e41e2];return _0x2844d6;};'use strict';var _=require(_0x2e1a('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x21c467){utils[_0x2e1a('0x1')](util[_0x2e1a('0x2')](_0x2e1a('0x3'),_0x21c467[_0x2e1a('0x4')],_0x21c467[_0x2e1a('0x5')],_0x21c467[_0x2e1a('0x6')],_0x21c467[_0x2e1a('0x7')],_0x21c467[_0x2e1a('0x8')],_0x21c467[_0x2e1a('0x9')],_0x21c467[_0x2e1a('0xa')]));if(_0x21c467['queue']){utils[_0x2e1a('0xb')](_0x21c467[_0x2e1a('0x6')])[_0x2e1a('0xc')](function(_0x3136c4){if(_0x3136c4){_0x21c467['type']=_0x3136c4[_0x2e1a('0xd')];}utils[_0x2e1a('0xe')](_0x2e1a('0xf'),_0x21c467);});}else{utils[_0x2e1a('0xe')]('CreateVoiceQueueReport',_0x21c467);}if(_0x21c467['transfereduniqueid']){delete queues[_0x21c467[_0x2e1a('0x10')]];}else{delete queues[_0x21c467[_0x2e1a('0x4')]];}}exports['queuecallerjoin']=function(_0x36d435){try{utils['debug'](util[_0x2e1a('0x2')](_0x2e1a('0x11'),_0x36d435[_0x2e1a('0x4')]),_0x36d435);utils['info'](util[_0x2e1a('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x36d435[_0x2e1a('0x4')],_0x36d435[_0x2e1a('0x6')],_0x36d435[_0x2e1a('0x12')]));queues[_0x36d435[_0x2e1a('0x4')]]=_[_0x2e1a('0x13')](_0x36d435,{'originalposition':_0x36d435[_0x2e1a('0x12')],'queuecallerjoinAt':utils[_0x2e1a('0x14')](),'mohtime':0x0});}catch(_0x3305cd){utils[_0x2e1a('0x15')](util['format'](_0x2e1a('0x11'),_0x36d435[_0x2e1a('0x4')]),_0x3305cd);}};exports['hangup']=function(_0xdd105e){try{if(!_[_0x2e1a('0x16')](queues[_0xdd105e[_0x2e1a('0x4')]])){utils[_0x2e1a('0x17')](util[_0x2e1a('0x2')](_0x2e1a('0x18'),_0xdd105e[_0x2e1a('0x4')]),_0xdd105e);if(queues[_0xdd105e[_0x2e1a('0x4')]][_0x2e1a('0x19')]){if(!queues[_0xdd105e[_0x2e1a('0x4')]]['queuecallerabandon']&&!queues[_0xdd105e[_0x2e1a('0x4')]]['queuecallerexit']){queues[_0xdd105e[_0x2e1a('0x4')]][_0x2e1a('0x1a')]=!![];queues[_0xdd105e[_0x2e1a('0x4')]][_0x2e1a('0x1b')]=utils[_0x2e1a('0x14')]();queues[_0xdd105e[_0x2e1a('0x4')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils['info'](util[_0x2e1a('0x2')](_0x2e1a('0x1c'),_0xdd105e[_0x2e1a('0x4')],queues[_0xdd105e[_0x2e1a('0x4')]][_0x2e1a('0x1d')],queues[_0xdd105e[_0x2e1a('0x4')]]['queuecallerexitreason']));writeDB(queues[_0xdd105e['uniqueid']]);}else if(queues[_0xdd105e[_0x2e1a('0x4')]]['transfereduniqueid']){utils[_0x2e1a('0x1')](util[_0x2e1a('0x2')](_0x2e1a('0x1e'),_0xdd105e[_0x2e1a('0x4')],queues[_0xdd105e[_0x2e1a('0x4')]][_0x2e1a('0x1d')],queues[_0xdd105e[_0x2e1a('0x4')]][_0x2e1a('0x10')]));queues[queues[_0xdd105e[_0x2e1a('0x4')]]['transfereduniqueid']]=queues[_0xdd105e['uniqueid']];queues[queues[_0xdd105e[_0x2e1a('0x4')]]['transfereduniqueid']][_0x2e1a('0x1f')]=0x2;delete queues[_0xdd105e[_0x2e1a('0x4')]];}}}catch(_0x1f297e){utils['error'](util[_0x2e1a('0x2')](_0x2e1a('0x18'),_0xdd105e['uniqueid']),_0x1f297e);}};exports['varset']=function(_0x3305f0){try{utils[_0x2e1a('0x17')](util[_0x2e1a('0x2')](_0x2e1a('0x20'),_0x3305f0['uniqueid']),_0x3305f0);if(!_['isNil'](_0x3305f0['variable']['queuestatus'])&&_0x3305f0['value'][_0x2e1a('0x21')]()!==_0x2e1a('0x22')){if(!_[_0x2e1a('0x16')](queues[_0x3305f0[_0x2e1a('0x4')]])){queues[_0x3305f0[_0x2e1a('0x4')]][_0x2e1a('0x23')]=![];queues[_0x3305f0[_0x2e1a('0x4')]]['queuecallerabandonAt']=null;queues[_0x3305f0[_0x2e1a('0x4')]][_0x2e1a('0x24')]=!![];queues[_0x3305f0[_0x2e1a('0x4')]]['queuecallerexitAt']=utils['now']();queues[_0x3305f0['uniqueid']][_0x2e1a('0xa')]=_0x3305f0[_0x2e1a('0x25')][_0x2e1a('0x21')]();utils[_0x2e1a('0x1')](util['format'](_0x2e1a('0x26'),_0x3305f0[_0x2e1a('0x4')],queues[_0x3305f0['uniqueid']][_0x2e1a('0x1d')],_0x3305f0[_0x2e1a('0x25')],queues[_0x3305f0['uniqueid']][_0x2e1a('0xa')]));writeDB(queues[_0x3305f0[_0x2e1a('0x4')]]);}}else if(!_[_0x2e1a('0x16')](_0x3305f0[_0x2e1a('0x27')]['queueposition'])){if(!_[_0x2e1a('0x16')](queues[_0x3305f0['uniqueid']])&&!queues[_0x3305f0[_0x2e1a('0x4')]][_0x2e1a('0x23')]){queues[_0x3305f0['uniqueid']][_0x2e1a('0x23')]=![];queues[_0x3305f0[_0x2e1a('0x4')]]['queuecallerabandonAt']=null;queues[_0x3305f0[_0x2e1a('0x4')]][_0x2e1a('0x24')]=!![];queues[_0x3305f0[_0x2e1a('0x4')]]['queuecallerexitAt']=utils['now']();queues[_0x3305f0[_0x2e1a('0x4')]]['queuecallerexitreason']=_0x2e1a('0x28');utils[_0x2e1a('0x1')](util[_0x2e1a('0x2')](_0x2e1a('0x29'),_0x3305f0['uniqueid'],queues[_0x3305f0[_0x2e1a('0x4')]][_0x2e1a('0x1d')],_0x3305f0[_0x2e1a('0x25')],queues[_0x3305f0[_0x2e1a('0x4')]][_0x2e1a('0xa')]));}}}catch(_0x23ac65){utils[_0x2e1a('0x15')](util[_0x2e1a('0x2')](_0x2e1a('0x20'),_0x3305f0[_0x2e1a('0x4')]),_0x23ac65);}};exports[_0x2e1a('0x23')]=function(_0x1e595d){try{if(!_[_0x2e1a('0x16')](queues[_0x1e595d[_0x2e1a('0x4')]])){utils[_0x2e1a('0x17')](util[_0x2e1a('0x2')](_0x2e1a('0x2a'),_0x1e595d[_0x2e1a('0x4')]),_0x1e595d);queues[_0x1e595d['uniqueid']]['queuecallerexit']=![];queues[_0x1e595d['uniqueid']]['queuecallerexitAt']=null;queues[_0x1e595d[_0x2e1a('0x4')]][_0x2e1a('0x23')]=!![];queues[_0x1e595d['uniqueid']][_0x2e1a('0x2b')]=utils[_0x2e1a('0x14')]();queues[_0x1e595d[_0x2e1a('0x4')]][_0x2e1a('0xa')]=_0x2e1a('0x2c');utils[_0x2e1a('0x1')](util[_0x2e1a('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1e595d['uniqueid'],queues[_0x1e595d[_0x2e1a('0x4')]]['name'],queues[_0x1e595d[_0x2e1a('0x4')]][_0x2e1a('0xa')]));}}catch(_0x3018c4){utils['error'](util[_0x2e1a('0x2')]('[%s][queues][queuecallerabandon]',_0x1e595d[_0x2e1a('0x4')]),_0x3018c4);}};exports[_0x2e1a('0x2d')]=function(_0x5880f0){try{if(!_['isNil'](queues[_0x5880f0['uniqueid']])){utils[_0x2e1a('0x17')](util[_0x2e1a('0x2')](_0x2e1a('0x2e'),_0x5880f0[_0x2e1a('0x4')]),_0x5880f0);utils[_0x2e1a('0x1')](util[_0x2e1a('0x2')](_0x2e1a('0x2f'),_0x5880f0[_0x2e1a('0x4')],queues[_0x5880f0[_0x2e1a('0x4')]][_0x2e1a('0x1d')],_0x5880f0[_0x2e1a('0x30')],_0x5880f0[_0x2e1a('0x31')]));queues[_0x5880f0['uniqueid']][_0x2e1a('0x2d')]=!![];queues[_0x5880f0['uniqueid']][_0x2e1a('0x19')]=utils[_0x2e1a('0x14')]();queues[_0x5880f0['uniqueid']][_0x2e1a('0x32')]=utils['diffTime'](queues[_0x5880f0[_0x2e1a('0x4')]][_0x2e1a('0x19')],queues[_0x5880f0[_0x2e1a('0x4')]][_0x2e1a('0x33')]);queues[_0x5880f0['uniqueid']][_0x2e1a('0x12')]=_0x5880f0[_0x2e1a('0x12')];queues[_0x5880f0['uniqueid']]['count']=_0x5880f0[_0x2e1a('0x34')];queues[_0x5880f0[_0x2e1a('0x4')]][_0x2e1a('0x30')]=_0x5880f0[_0x2e1a('0x30')];queues[_0x5880f0[_0x2e1a('0x4')]][_0x2e1a('0x31')]=_0x5880f0[_0x2e1a('0x31')];}}catch(_0x4e95c0){utils[_0x2e1a('0x15')](util[_0x2e1a('0x2')](_0x2e1a('0x2e'),_0x5880f0['uniqueid']),_0x4e95c0);}};exports[_0x2e1a('0x35')]=function(_0x457523){try{if(!_[_0x2e1a('0x16')](queues[_0x457523[_0x2e1a('0x4')]])){utils['debug'](util['format'](_0x2e1a('0x36'),_0x457523[_0x2e1a('0x4')]),_0x457523);utils[_0x2e1a('0x1')](util['format'](_0x2e1a('0x37'),_0x457523[_0x2e1a('0x4')],queues[_0x457523['uniqueid']][_0x2e1a('0x1d')],_0x457523[_0x2e1a('0x38')],_0x457523[_0x2e1a('0x39')]));queues[_0x457523['uniqueid']][_0x2e1a('0x23')]=![];queues[_0x457523[_0x2e1a('0x4')]][_0x2e1a('0x23')]=![];queues[_0x457523[_0x2e1a('0x4')]]['queuecallerabandonAt']=null;queues[_0x457523[_0x2e1a('0x4')]][_0x2e1a('0x24')]=![];queues[_0x457523[_0x2e1a('0x4')]][_0x2e1a('0xa')]=null;queues[_0x457523[_0x2e1a('0x4')]][_0x2e1a('0x3a')]=null;queues[_0x457523[_0x2e1a('0x4')]][_0x2e1a('0x3b')]=!![];queues[_0x457523['uniqueid']][_0x2e1a('0x9')]=_0x457523[_0x2e1a('0x39')];queues[_0x457523[_0x2e1a('0x4')]]['lastAssignedTo']=_0x457523[_0x2e1a('0x38')];}}catch(_0x4a1a50){utils[_0x2e1a('0x15')](util[_0x2e1a('0x2')]('[%s][queues][agentconnect]',_0x457523[_0x2e1a('0x4')]),_0x4a1a50);}};exports[_0x2e1a('0x3c')]=function(_0x3eca0f){try{if(!_[_0x2e1a('0x16')](queues[_0x3eca0f[_0x2e1a('0x4')]])){if(queues[_0x3eca0f[_0x2e1a('0x4')]]['queuecallerleaveAt']){utils['debug'](util[_0x2e1a('0x2')](_0x2e1a('0x3d'),_0x3eca0f[_0x2e1a('0x4')]),_0x3eca0f);queues[_0x3eca0f[_0x2e1a('0x4')]][_0x2e1a('0x23')]=![];queues[_0x3eca0f['uniqueid']][_0x2e1a('0x23')]=![];queues[_0x3eca0f[_0x2e1a('0x4')]][_0x2e1a('0x2b')]=null;queues[_0x3eca0f[_0x2e1a('0x4')]][_0x2e1a('0x24')]=![];queues[_0x3eca0f[_0x2e1a('0x4')]]['queuecallerexitAt']=null;queues[_0x3eca0f[_0x2e1a('0x4')]][_0x2e1a('0x3b')]=!![];queues[_0x3eca0f['uniqueid']][_0x2e1a('0x7')]=_0x3eca0f[_0x2e1a('0x38')];queues[_0x3eca0f['uniqueid']][_0x2e1a('0x1a')]=!![];queues[_0x3eca0f[_0x2e1a('0x4')]][_0x2e1a('0x1b')]=utils[_0x2e1a('0x14')]();if(_0x3eca0f['reason']==_0x2e1a('0x3e')){if(!queues[_0x3eca0f[_0x2e1a('0x4')]][_0x2e1a('0x3e')]){queues[_0x3eca0f[_0x2e1a('0x4')]][_0x2e1a('0xa')]='TRANSFER';}}else{queues[_0x3eca0f['uniqueid']][_0x2e1a('0xa')]=_0x2e1a('0x3f')+_0x3eca0f[_0x2e1a('0x40')][_0x2e1a('0x21')]();}utils[_0x2e1a('0x1')](util['format'](_0x2e1a('0x41'),_0x3eca0f[_0x2e1a('0x4')],queues[_0x3eca0f[_0x2e1a('0x4')]]['name'],_0x3eca0f['membername'],queues[_0x3eca0f[_0x2e1a('0x4')]][_0x2e1a('0xa')]));writeDB(queues[_0x3eca0f['uniqueid']]);}}}catch(_0x506572){utils[_0x2e1a('0x15')](util['format'](_0x2e1a('0x3d'),_0x3eca0f[_0x2e1a('0x4')]),_0x506572);}};exports['blindtransfer']=function(_0x3f057e){try{if(!_[_0x2e1a('0x16')](queues[_0x3f057e[_0x2e1a('0x42')]])){utils[_0x2e1a('0x17')](util[_0x2e1a('0x2')](_0x2e1a('0x43'),_0x3f057e[_0x2e1a('0x4')]),_0x3f057e);queues[_0x3f057e[_0x2e1a('0x42')]][_0x2e1a('0x3e')]=!![];queues[_0x3f057e[_0x2e1a('0x42')]]['transfertype']=_0x2e1a('0x44');queues[_0x3f057e[_0x2e1a('0x42')]]['transferexten']=_0x3f057e[_0x2e1a('0x45')];queues[_0x3f057e['transfereeuniqueid']][_0x2e1a('0x46')]=_0x3f057e[_0x2e1a('0x42')];queues[_0x3f057e[_0x2e1a('0x42')]][_0x2e1a('0xa')]='BLINDTRANSFER';utils[_0x2e1a('0x1')](util[_0x2e1a('0x2')](_0x2e1a('0x47'),_0x3f057e['uniqueid'],queues[_0x3f057e[_0x2e1a('0x42')]][_0x2e1a('0x1d')],_0x3f057e[_0x2e1a('0x42')],_0x3f057e[_0x2e1a('0x45')]));}}catch(_0x5f484c){utils[_0x2e1a('0x15')](util[_0x2e1a('0x2')](_0x2e1a('0x43'),_0x3f057e['uniqueid']),_0x5f484c);}};exports['attendedtransfer']=function(_0x3339c8){try{utils['debug'](util['format'](_0x2e1a('0x48'),_0x3339c8[_0x2e1a('0x49')]),_0x3339c8);if(_0x3339c8['origtransfereruniqueid']==_0x3339c8[_0x2e1a('0x4a')]){if(!_[_0x2e1a('0x16')](queues[_0x3339c8[_0x2e1a('0x4b')]])){utils[_0x2e1a('0x1')](util[_0x2e1a('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3339c8[_0x2e1a('0x49')],queues[_0x3339c8[_0x2e1a('0x4b')]]['name'],_0x3339c8[_0x2e1a('0x4c')]));queues[_0x3339c8[_0x2e1a('0x4b')]][_0x2e1a('0x3e')]=!![];queues[_0x3339c8[_0x2e1a('0x4b')]][_0x2e1a('0x4d')]=_0x2e1a('0x4e');queues[_0x3339c8[_0x2e1a('0x4b')]][_0x2e1a('0x4f')]=_0x3339c8[_0x2e1a('0x4c')];queues[_0x3339c8[_0x2e1a('0x4b')]][_0x2e1a('0x46')]=_0x3339c8[_0x2e1a('0x49')];queues[_0x3339c8[_0x2e1a('0x4b')]][_0x2e1a('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x2e1a('0x16')](queues[_0x3339c8[_0x2e1a('0x4a')]])){if(_0x3339c8['transfereelinkedid']&&queues[_0x3339c8[_0x2e1a('0x50')]]){queues[_0x3339c8[_0x2e1a('0x50')]][_0x2e1a('0x1f')]=0x1;queues[_0x3339c8[_0x2e1a('0x42')]]=_[_0x2e1a('0x51')](queues[_0x3339c8[_0x2e1a('0x50')]]);queues[_0x3339c8[_0x2e1a('0x42')]]['transfereduniqueid']=_0x3339c8[_0x2e1a('0x52')];queues[_0x3339c8[_0x2e1a('0x42')]][_0x2e1a('0x1f')]=0x2;queues[_0x3339c8[_0x2e1a('0x42')]][_0x2e1a('0x8')]=queues[_0x3339c8[_0x2e1a('0x4b')]]['calleridnum'];queues[_0x3339c8[_0x2e1a('0x42')]][_0x2e1a('0x53')]=queues[_0x3339c8['secondtransfererlinkedid']]['calleridname'];queues[_0x3339c8[_0x2e1a('0x42')]][_0x2e1a('0x33')]=utils[_0x2e1a('0x14')]();queues[_0x3339c8['transfereeuniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x3339c8[_0x2e1a('0x42')]][_0x2e1a('0x32')]=0x0;queues[_0x3339c8[_0x2e1a('0x42')]][_0x2e1a('0x54')]=0x0;utils[_0x2e1a('0x1')](util[_0x2e1a('0x2')](_0x2e1a('0x55'),_0x3339c8[_0x2e1a('0x49')],queues[_0x3339c8[_0x2e1a('0x42')]]['name'],queues[_0x3339c8[_0x2e1a('0x42')]]['calleridnum'],queues[_0x3339c8['transfereeuniqueid']][_0x2e1a('0x53')]));}else{utils[_0x2e1a('0x1')](util['format'](_0x2e1a('0x56'),_0x3339c8['origtransfereruniqueid'],queues[_0x3339c8['origtransfererlinkedid']][_0x2e1a('0x1d')],_0x3339c8[_0x2e1a('0x4b')]));queues[_0x3339c8[_0x2e1a('0x4a')]]['transfereduniqueid']=_0x3339c8[_0x2e1a('0x4b')];}}}else if(_0x3339c8[_0x2e1a('0x57')]==_0x3339c8['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x3339c8['origtransfererlinkedid']])){utils['info'](util[_0x2e1a('0x2')](_0x2e1a('0x58'),_0x3339c8[_0x2e1a('0x49')],queues[_0x3339c8[_0x2e1a('0x4a')]][_0x2e1a('0x1d')],_0x3339c8[_0x2e1a('0x57')],_0x3339c8[_0x2e1a('0x59')]));queues[_0x3339c8['origtransfererlinkedid']]['transfer']=!![];queues[_0x3339c8[_0x2e1a('0x4a')]][_0x2e1a('0x4d')]='ATTENDED';queues[_0x3339c8[_0x2e1a('0x4a')]][_0x2e1a('0x4f')]=_0x3339c8['secondtransfererexten'];queues[_0x3339c8[_0x2e1a('0x4a')]][_0x2e1a('0x46')]=_0x3339c8['secondtransfereruniqueid'];queues[_0x3339c8[_0x2e1a('0x4a')]][_0x2e1a('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x2e1a('0x16')](queues[_0x3339c8[_0x2e1a('0x4b')]])){if(_0x3339c8[_0x2e1a('0x5a')]&&queues[_0x3339c8[_0x2e1a('0x5a')]]){queues[_0x3339c8[_0x2e1a('0x5a')]][_0x2e1a('0x1f')]=0x1;queues[_0x3339c8['transfertargetuniqueid']]=_[_0x2e1a('0x51')](queues[_0x3339c8[_0x2e1a('0x5a')]]);queues[_0x3339c8[_0x2e1a('0x52')]]['transfereduniqueid']=_0x3339c8[_0x2e1a('0x52')];queues[_0x3339c8['transfertargetuniqueid']][_0x2e1a('0x1f')]=0x2;queues[_0x3339c8[_0x2e1a('0x52')]][_0x2e1a('0x8')]=queues[_0x3339c8[_0x2e1a('0x4a')]][_0x2e1a('0x8')];queues[_0x3339c8['transfertargetuniqueid']][_0x2e1a('0x53')]=queues[_0x3339c8[_0x2e1a('0x4a')]][_0x2e1a('0x53')];queues[_0x3339c8[_0x2e1a('0x52')]][_0x2e1a('0x33')]=utils['now']();queues[_0x3339c8[_0x2e1a('0x52')]][_0x2e1a('0x19')]=utils[_0x2e1a('0x14')]();queues[_0x3339c8[_0x2e1a('0x52')]][_0x2e1a('0x32')]=0x0;queues[_0x3339c8['transfertargetuniqueid']][_0x2e1a('0x54')]=0x0;utils[_0x2e1a('0x1')](util[_0x2e1a('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x3339c8['origtransfereruniqueid'],queues[_0x3339c8[_0x2e1a('0x52')]][_0x2e1a('0x1d')],queues[_0x3339c8[_0x2e1a('0x52')]][_0x2e1a('0x10')],queues[_0x3339c8[_0x2e1a('0x52')]][_0x2e1a('0x8')],queues[_0x3339c8[_0x2e1a('0x52')]]['calleridname']));}else{utils[_0x2e1a('0x1')](util['format'](_0x2e1a('0x56'),_0x3339c8[_0x2e1a('0x49')],queues[_0x3339c8[_0x2e1a('0x4b')]]['name'],_0x3339c8[_0x2e1a('0x4a')]));queues[_0x3339c8[_0x2e1a('0x4b')]][_0x2e1a('0x10')]=_0x3339c8['origtransfererlinkedid'];}}}}catch(_0x2913f8){utils[_0x2e1a('0x15')](util['format'](_0x2e1a('0x48'),_0x3339c8[_0x2e1a('0x49')]),_0x2913f8);}};exports[_0x2e1a('0x5b')]=function(_0x109f41){try{if(!_['isNil'](queues[_0x109f41[_0x2e1a('0x4')]])){utils[_0x2e1a('0x17')](util[_0x2e1a('0x2')](_0x2e1a('0x5c'),_0x109f41[_0x2e1a('0x4')]),_0x109f41);queues[_0x109f41[_0x2e1a('0x4')]][_0x2e1a('0x5d')]=utils[_0x2e1a('0x14')]();utils[_0x2e1a('0x1')](util[_0x2e1a('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x109f41[_0x2e1a('0x4')],queues[_0x109f41[_0x2e1a('0x4')]][_0x2e1a('0x1d')],queues[_0x109f41[_0x2e1a('0x4')]][_0x2e1a('0x5d')]));}}catch(_0x1c9a14){utils[_0x2e1a('0x15')](util['format']('[%s][queues][musiconholdstart]',_0x109f41[_0x2e1a('0x4')]),_0x1c9a14);}};exports[_0x2e1a('0x5e')]=function(_0x15c6a7){try{if(!_[_0x2e1a('0x16')](queues[_0x15c6a7[_0x2e1a('0x4')]])){if(!_[_0x2e1a('0x16')](queues[_0x15c6a7[_0x2e1a('0x4')]][_0x2e1a('0x5d')])){utils[_0x2e1a('0x17')](util['format'](_0x2e1a('0x5f'),_0x15c6a7[_0x2e1a('0x4')]),_0x15c6a7);queues[_0x15c6a7[_0x2e1a('0x4')]][_0x2e1a('0x54')]+=utils[_0x2e1a('0x60')](utils[_0x2e1a('0x14')](),queues[_0x15c6a7[_0x2e1a('0x4')]][_0x2e1a('0x5d')]);utils[_0x2e1a('0x1')](util['format'](_0x2e1a('0x61'),_0x15c6a7[_0x2e1a('0x4')],queues[_0x15c6a7['uniqueid']]['name'],queues[_0x15c6a7['uniqueid']][_0x2e1a('0x54')]));delete queues[_0x15c6a7[_0x2e1a('0x4')]][_0x2e1a('0x5d')];}}}catch(_0x5c7457){utils['error'](util[_0x2e1a('0x2')]('[%s][queues][musiconholdstop]',_0x15c6a7[_0x2e1a('0x4')]),_0x5c7457);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 74820e1..f8be062 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 _0x0bab=['getUserByInternal','accountcode','then','membername','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','isNil','channelstate','linkedid','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereruniqueid','lodash','util','./utils','./transfers.controller','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x0bab,0x1d3));var _0xb0ba=function(_0x5328e4,_0x1869e4){_0x5328e4=_0x5328e4-0x0;var _0x44137c=_0x0bab[_0x5328e4];return _0x44137c;};'use strict';var _=require(_0xb0ba('0x0'));var util=require(_0xb0ba('0x1'));var utils=require(_0xb0ba('0x2'));var transfers=require(_0xb0ba('0x3'));var recordings={};function writeDB(_0x5e6591){var _0x118893;utils['info'](util[_0xb0ba('0x4')](_0xb0ba('0x5'),_0x5e6591[_0xb0ba('0x6')]));if(transfers[_0xb0ba('0x7')][_0x5e6591[_0xb0ba('0x6')]]){_0x118893=_0x5e6591[_0xb0ba('0x6')];_0x5e6591[_0xb0ba('0x6')]=transfers['blinds'][_0x5e6591[_0xb0ba('0x6')]][_0xb0ba('0x8')];}if(_0x5e6591['accountcode']){utils[_0xb0ba('0x9')](_0x5e6591[_0xb0ba('0xa')])[_0xb0ba('0xb')](function(_0x5760cc){if(_0x5760cc){_0x5e6591[_0xb0ba('0xc')]=_0x5760cc[_0xb0ba('0xd')];_0x5e6591['UserId']=_0x5760cc['id'];}utils[_0xb0ba('0xe')](_0xb0ba('0xf'),_0x5e6591);});}else{utils[_0xb0ba('0xe')]('CreateVoiceRecording',_0x5e6591);}if(_0x118893)delete transfers['blinds'][_0x118893];}exports[_0xb0ba('0x10')]=function(_0x16fa10){try{utils[_0xb0ba('0x11')](util[_0xb0ba('0x4')](_0xb0ba('0x12'),_0x16fa10[_0xb0ba('0x6')]),_0x16fa10);if(_0x16fa10['uniqueid']==_0x16fa10['linkedid']){utils[_0xb0ba('0x13')](util[_0xb0ba('0x4')](_0xb0ba('0x14'),_0x16fa10[_0xb0ba('0x6')],_0x16fa10['context'],_0x16fa10[_0xb0ba('0x15')]));recordings[_0x16fa10[_0xb0ba('0x6')]]={'uniqueid':_0x16fa10[_0xb0ba('0x6')],'accountcode':_0x16fa10[_0xb0ba('0xa')],'exten':_0x16fa10[_0xb0ba('0x15')],'context':_0x16fa10[_0xb0ba('0x16')],'channel':_0x16fa10[_0xb0ba('0x17')],'monitors':[]};}}catch(_0x5d4a0d){utils[_0xb0ba('0x18')](util[_0xb0ba('0x4')](_0xb0ba('0x12'),_0x16fa10[_0xb0ba('0x6')]),_0x5d4a0d);}};exports[_0xb0ba('0x19')]=function(_0x3c9cf8){try{utils['debug'](util[_0xb0ba('0x4')]('[%s][recordings][newstate]',_0x3c9cf8[_0xb0ba('0x6')]),_0x3c9cf8);if(!_[_0xb0ba('0x1a')](recordings[_0x3c9cf8[_0xb0ba('0x6')]])&&_0x3c9cf8[_0xb0ba('0x1b')]==0x6){utils[_0xb0ba('0x13')](util[_0xb0ba('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3c9cf8[_0xb0ba('0x6')],_0x3c9cf8[_0xb0ba('0x16')],_0x3c9cf8['channel']));}else if(!_[_0xb0ba('0x1a')](recordings[_0x3c9cf8[_0xb0ba('0x1c')]])&&_0x3c9cf8[_0xb0ba('0x1b')]==0x6&&_0x3c9cf8[_0xb0ba('0x16')]!='transfer'){utils[_0xb0ba('0x13')](util[_0xb0ba('0x4')](_0xb0ba('0x1d'),_0x3c9cf8['uniqueid'],_0x3c9cf8[_0xb0ba('0x1c')],_0x3c9cf8[_0xb0ba('0x16')],_0x3c9cf8[_0xb0ba('0x17')]));recordings[_0x3c9cf8[_0xb0ba('0x1c')]][_0xb0ba('0xa')]=_0x3c9cf8[_0xb0ba('0xa')];}}catch(_0xf345be){utils[_0xb0ba('0x18')](util[_0xb0ba('0x4')](_0xb0ba('0x1e'),_0x3c9cf8['uniqueid']),_0xf345be);}};exports[_0xb0ba('0x1f')]=function(_0x2663ce){try{if(!_[_0xb0ba('0x1a')](_0x2663ce['variable'])&&!_['isNil'](_0x2663ce['variable'][_0xb0ba('0x20')])){utils[_0xb0ba('0x11')](util[_0xb0ba('0x4')](_0xb0ba('0x21'),_0x2663ce[_0xb0ba('0x6')]),_0x2663ce);utils[_0xb0ba('0x13')](util[_0xb0ba('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x2663ce[_0xb0ba('0x6')],_0x2663ce['variable'],_0x2663ce[_0xb0ba('0x22')]));if(_[_0xb0ba('0x23')](_0x2663ce['value'],_0xb0ba('0x24'))){_0x2663ce[_0xb0ba('0x22')]=_0x2663ce['value']['replace'](_0xb0ba('0x24'),_0xb0ba('0x25'));}if(recordings[_0x2663ce[_0xb0ba('0x1c')]]){var _0x5e9887=_[_0xb0ba('0x26')](recordings[_0x2663ce[_0xb0ba('0x1c')]]['monitors'],{'value':_0x2663ce['value']});if(_[_0xb0ba('0x1a')](_0x5e9887)){recordings[_0x2663ce[_0xb0ba('0x1c')]][_0xb0ba('0x27')]['push']({'value':_0x2663ce[_0xb0ba('0x22')]});}}}}catch(_0x21d948){utils[_0xb0ba('0x18')](util[_0xb0ba('0x4')](_0xb0ba('0x21'),_0x2663ce[_0xb0ba('0x6')]),_0x21d948);}};exports[_0xb0ba('0x28')]=function(_0x1df75a){try{if(!_[_0xb0ba('0x1a')](recordings[_0x1df75a[_0xb0ba('0x6')]])){utils[_0xb0ba('0x11')](util[_0xb0ba('0x4')](_0xb0ba('0x29'),_0x1df75a['uniqueid']),_0x1df75a);utils[_0xb0ba('0x13')](util[_0xb0ba('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x1df75a[_0xb0ba('0x6')],_0x1df75a[_0xb0ba('0x2a')],_0x1df75a[_0xb0ba('0x2b')],_0x1df75a[_0xb0ba('0x2c')]));recordings[_0x1df75a[_0xb0ba('0x6')]][_0xb0ba('0x2a')]=_0x1df75a[_0xb0ba('0x2a')];recordings[_0x1df75a[_0xb0ba('0x6')]][_0xb0ba('0x2b')]=_0x1df75a[_0xb0ba('0x2b')];recordings[_0x1df75a['uniqueid']][_0xb0ba('0x2d')]=_0x1df75a[_0xb0ba('0x2d')];recordings[_0x1df75a[_0xb0ba('0x6')]][_0xb0ba('0x2e')]=_0x1df75a[_0xb0ba('0x2e')];if(recordings[_0x1df75a[_0xb0ba('0x6')]][_0xb0ba('0x2f')]==_0xb0ba('0x30')&&recordings[_0x1df75a[_0xb0ba('0x6')]][_0xb0ba('0xa')]){recordings[_0x1df75a[_0xb0ba('0x6')]]['connectedlinenum']=recordings[_0x1df75a[_0xb0ba('0x6')]][_0xb0ba('0xa')];recordings[_0x1df75a['uniqueid']][_0xb0ba('0x2e')]='';}recordings[_0x1df75a[_0xb0ba('0x6')]]['monitors'][_0xb0ba('0x31')](function(_0x3ce639){var _0x246bf4=_['clone'](recordings[_0x1df75a[_0xb0ba('0x6')]]);_0x246bf4[_0xb0ba('0x22')]=_0x3ce639[_0xb0ba('0x22')];writeDB(_0x246bf4);});delete recordings[_0x1df75a[_0xb0ba('0x6')]];}}catch(_0x54430b){utils[_0xb0ba('0x18')](util[_0xb0ba('0x4')](_0xb0ba('0x29'),_0x1df75a[_0xb0ba('0x6')]),_0x54430b);}};exports[_0xb0ba('0x32')]=function(_0x19ca45){try{if(!_['isNil'](recordings[_0x19ca45[_0xb0ba('0x6')]])){utils[_0xb0ba('0x11')](util['format'](_0xb0ba('0x33'),_0x19ca45[_0xb0ba('0x6')]),_0x19ca45);utils[_0xb0ba('0x13')](util[_0xb0ba('0x4')](_0xb0ba('0x34'),_0x19ca45['uniqueid'],_0x19ca45[_0xb0ba('0x35')],_0x19ca45[_0xb0ba('0x36')]));if(_0x19ca45[_0xb0ba('0x35')][_0xb0ba('0x37')]()=='set'&&_[_0xb0ba('0x38')](_0x19ca45[_0xb0ba('0x36')][_0xb0ba('0x37')](),_0xb0ba('0x39'))){var _0x5cfddd=_0x19ca45[_0xb0ba('0x36')][_0xb0ba('0x3a')]('=');var _0x469811=_0x5cfddd[0x0]['substring'](_0x5cfddd[0x0][_0xb0ba('0x3b')]('(')+0x1,_0x5cfddd[0x0]['lastIndexOf'](')'));var _0x58d64a=_0x5cfddd[0x1];recordings[_0x19ca45[_0xb0ba('0x6')]][_0x469811]=_0x58d64a;}}}catch(_0x150efc){utils[_0xb0ba('0x18')](util[_0xb0ba('0x4')](_0xb0ba('0x33'),_0x19ca45[_0xb0ba('0x6')]),_0x150efc);}};exports['queuecallerjoin']=function(_0x2d915e){try{if(!_[_0xb0ba('0x1a')](recordings[_0x2d915e[_0xb0ba('0x6')]])){utils['debug'](util[_0xb0ba('0x4')](_0xb0ba('0x3c'),_0x2d915e[_0xb0ba('0x6')]),_0x2d915e);utils[_0xb0ba('0x13')](util[_0xb0ba('0x4')](_0xb0ba('0x3d'),_0x2d915e[_0xb0ba('0x6')],_0x2d915e[_0xb0ba('0x3e')]));recordings[_0x2d915e[_0xb0ba('0x6')]]['queue']=_0x2d915e[_0xb0ba('0x3e')];}}catch(_0x595c55){utils[_0xb0ba('0x18')](util['format'](_0xb0ba('0x3c'),_0x2d915e[_0xb0ba('0x6')]),_0x595c55);}};exports[_0xb0ba('0x3f')]=function(_0x47532c){try{utils[_0xb0ba('0x11')](util[_0xb0ba('0x4')]('[%s][recordings][blindtransfer]',_0x47532c[_0xb0ba('0x6')]),_0x47532c);utils[_0xb0ba('0x13')](util[_0xb0ba('0x4')](_0xb0ba('0x40'),_0x47532c[_0xb0ba('0x6')],_0x47532c['transferercalleridnum'],_0x47532c[_0xb0ba('0x41')],_0x47532c[_0xb0ba('0x42')],_0x47532c['transfereecalleridname']));if(recordings[_0x47532c[_0xb0ba('0x43')]]&&transfers[_0xb0ba('0x7')][_0x47532c[_0xb0ba('0x43')]]){transfers[_0xb0ba('0x7')][_0x47532c[_0xb0ba('0x43')]]['recording']=!![];}}catch(_0x583b81){utils[_0xb0ba('0x18')](util['format']('[%s][recordings][blindtransfer]',_0x47532c[_0xb0ba('0x6')]),_0x583b81);}}; \ No newline at end of file +var _0x2a9f=['linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','startsWith','split','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','./transfers.controller','info','format','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','accountcode','then','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]'];(function(_0x5f19,_0x5a43da){var _0x1ec206=function(_0x55d82f){while(--_0x55d82f){_0x5f19['push'](_0x5f19['shift']());}};_0x1ec206(++_0x5a43da);}(_0x2a9f,0x14d));var _0xf2a9=function(_0x30b8ae,_0x275a41){_0x30b8ae=_0x30b8ae-0x0;var _0x4d9aa0=_0x2a9f[_0x30b8ae];return _0x4d9aa0;};'use strict';var _=require(_0xf2a9('0x0'));var util=require('util');var utils=require('./utils');var transfers=require(_0xf2a9('0x1'));var recordings={};function writeDB(_0x79b17){var _0x4b0a6b;utils[_0xf2a9('0x2')](util[_0xf2a9('0x3')](_0xf2a9('0x4'),_0x79b17['uniqueid']));if(transfers[_0xf2a9('0x5')][_0x79b17[_0xf2a9('0x6')]]){_0x4b0a6b=_0x79b17[_0xf2a9('0x6')];_0x79b17['uniqueid']=transfers['blinds'][_0x79b17[_0xf2a9('0x6')]][_0xf2a9('0x7')];}if(_0x79b17[_0xf2a9('0x8')]){utils['getUserByInternal'](_0x79b17['accountcode'])[_0xf2a9('0x9')](function(_0xcc7bac){if(_0xcc7bac){_0x79b17['membername']=_0xcc7bac[_0xf2a9('0xa')];_0x79b17[_0xf2a9('0xb')]=_0xcc7bac['id'];}utils['request'](_0xf2a9('0xc'),_0x79b17);});}else{utils[_0xf2a9('0xd')](_0xf2a9('0xc'),_0x79b17);}if(_0x4b0a6b)delete transfers[_0xf2a9('0x5')][_0x4b0a6b];}exports[_0xf2a9('0xe')]=function(_0x4a863c){try{utils[_0xf2a9('0xf')](util['format'](_0xf2a9('0x10'),_0x4a863c[_0xf2a9('0x6')]),_0x4a863c);if(_0x4a863c[_0xf2a9('0x6')]==_0x4a863c[_0xf2a9('0x11')]){utils[_0xf2a9('0x2')](util[_0xf2a9('0x3')](_0xf2a9('0x12'),_0x4a863c['uniqueid'],_0x4a863c['context'],_0x4a863c[_0xf2a9('0x13')]));recordings[_0x4a863c[_0xf2a9('0x6')]]={'uniqueid':_0x4a863c['uniqueid'],'accountcode':_0x4a863c[_0xf2a9('0x8')],'exten':_0x4a863c['exten'],'context':_0x4a863c[_0xf2a9('0x14')],'channel':_0x4a863c[_0xf2a9('0x15')],'monitors':[]};}}catch(_0x2ccea0){utils[_0xf2a9('0x16')](util[_0xf2a9('0x3')](_0xf2a9('0x10'),_0x4a863c[_0xf2a9('0x6')]),_0x2ccea0);}};exports[_0xf2a9('0x17')]=function(_0x5e0c90){try{utils['debug'](util[_0xf2a9('0x3')](_0xf2a9('0x18'),_0x5e0c90['uniqueid']),_0x5e0c90);if(!_[_0xf2a9('0x19')](recordings[_0x5e0c90['uniqueid']])&&_0x5e0c90[_0xf2a9('0x1a')]==0x6){utils[_0xf2a9('0x2')](util[_0xf2a9('0x3')](_0xf2a9('0x1b'),_0x5e0c90[_0xf2a9('0x6')],_0x5e0c90[_0xf2a9('0x14')],_0x5e0c90[_0xf2a9('0x15')]));}else if(!_[_0xf2a9('0x19')](recordings[_0x5e0c90['linkedid']])&&_0x5e0c90[_0xf2a9('0x1a')]==0x6&&_0x5e0c90[_0xf2a9('0x14')]!='transfer'){utils[_0xf2a9('0x2')](util[_0xf2a9('0x3')](_0xf2a9('0x1c'),_0x5e0c90[_0xf2a9('0x6')],_0x5e0c90[_0xf2a9('0x11')],_0x5e0c90[_0xf2a9('0x14')],_0x5e0c90['channel']));recordings[_0x5e0c90[_0xf2a9('0x11')]][_0xf2a9('0x8')]=_0x5e0c90[_0xf2a9('0x8')];}}catch(_0x5ca804){utils['error'](util['format'](_0xf2a9('0x18'),_0x5e0c90[_0xf2a9('0x6')]),_0x5ca804);}};exports[_0xf2a9('0x1d')]=function(_0x5b8c4d){try{if(!_['isNil'](_0x5b8c4d[_0xf2a9('0x1e')])&&!_[_0xf2a9('0x19')](_0x5b8c4d[_0xf2a9('0x1e')]['mixmonitor_filename'])){utils[_0xf2a9('0xf')](util['format']('[%s][recordings][varset]',_0x5b8c4d[_0xf2a9('0x6')]),_0x5b8c4d);utils['info'](util[_0xf2a9('0x3')](_0xf2a9('0x1f'),_0x5b8c4d['uniqueid'],_0x5b8c4d['variable'],_0x5b8c4d['value']));if(_[_0xf2a9('0x20')](_0x5b8c4d[_0xf2a9('0x21')],_0xf2a9('0x22'))){_0x5b8c4d[_0xf2a9('0x21')]=_0x5b8c4d['value'][_0xf2a9('0x23')](_0xf2a9('0x22'),_0xf2a9('0x24'));}if(recordings[_0x5b8c4d[_0xf2a9('0x11')]]){var _0x131e75=_[_0xf2a9('0x25')](recordings[_0x5b8c4d[_0xf2a9('0x11')]][_0xf2a9('0x26')],{'value':_0x5b8c4d['value']});if(_['isNil'](_0x131e75)){recordings[_0x5b8c4d[_0xf2a9('0x11')]][_0xf2a9('0x26')][_0xf2a9('0x27')]({'value':_0x5b8c4d[_0xf2a9('0x21')]});}}}}catch(_0x1395c1){utils[_0xf2a9('0x16')](util[_0xf2a9('0x3')](_0xf2a9('0x28'),_0x5b8c4d[_0xf2a9('0x6')]),_0x1395c1);}};exports[_0xf2a9('0x29')]=function(_0x146b8d){try{if(!_[_0xf2a9('0x19')](recordings[_0x146b8d[_0xf2a9('0x6')]])){utils[_0xf2a9('0xf')](util[_0xf2a9('0x3')](_0xf2a9('0x2a'),_0x146b8d[_0xf2a9('0x6')]),_0x146b8d);utils[_0xf2a9('0x2')](util[_0xf2a9('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x146b8d[_0xf2a9('0x6')],_0x146b8d[_0xf2a9('0x2b')],_0x146b8d[_0xf2a9('0x2c')],_0x146b8d['cause-txt']));recordings[_0x146b8d[_0xf2a9('0x6')]][_0xf2a9('0x2b')]=_0x146b8d[_0xf2a9('0x2b')];recordings[_0x146b8d[_0xf2a9('0x6')]][_0xf2a9('0x2c')]=_0x146b8d['calleridname'];recordings[_0x146b8d['uniqueid']][_0xf2a9('0x2d')]=_0x146b8d[_0xf2a9('0x2d')];recordings[_0x146b8d['uniqueid']][_0xf2a9('0x2e')]=_0x146b8d['connectedlinename'];if(recordings[_0x146b8d[_0xf2a9('0x6')]][_0xf2a9('0x2f')]==_0xf2a9('0x30')&&recordings[_0x146b8d[_0xf2a9('0x6')]][_0xf2a9('0x8')]){recordings[_0x146b8d[_0xf2a9('0x6')]]['connectedlinenum']=recordings[_0x146b8d[_0xf2a9('0x6')]][_0xf2a9('0x8')];recordings[_0x146b8d[_0xf2a9('0x6')]][_0xf2a9('0x2e')]='';}recordings[_0x146b8d[_0xf2a9('0x6')]][_0xf2a9('0x26')][_0xf2a9('0x31')](function(_0xbf41f4){var _0x5a762a=_['clone'](recordings[_0x146b8d[_0xf2a9('0x6')]]);_0x5a762a[_0xf2a9('0x21')]=_0xbf41f4[_0xf2a9('0x21')];writeDB(_0x5a762a);});delete recordings[_0x146b8d['uniqueid']];}}catch(_0x20a2c1){utils[_0xf2a9('0x16')](util[_0xf2a9('0x3')](_0xf2a9('0x2a'),_0x146b8d[_0xf2a9('0x6')]),_0x20a2c1);}};exports[_0xf2a9('0x32')]=function(_0x45cdf2){try{if(!_['isNil'](recordings[_0x45cdf2[_0xf2a9('0x6')]])){utils[_0xf2a9('0xf')](util[_0xf2a9('0x3')](_0xf2a9('0x33'),_0x45cdf2[_0xf2a9('0x6')]),_0x45cdf2);utils['info'](util[_0xf2a9('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x45cdf2[_0xf2a9('0x6')],_0x45cdf2[_0xf2a9('0x34')],_0x45cdf2[_0xf2a9('0x35')]));if(_0x45cdf2[_0xf2a9('0x34')][_0xf2a9('0x36')]()=='set'&&_[_0xf2a9('0x37')](_0x45cdf2['appdata'][_0xf2a9('0x36')](),'cdr')){var _0x76b84f=_0x45cdf2[_0xf2a9('0x35')][_0xf2a9('0x38')]('=');var _0xadf8fd=_0x76b84f[0x0]['substring'](_0x76b84f[0x0]['lastIndexOf']('(')+0x1,_0x76b84f[0x0][_0xf2a9('0x39')](')'));var _0x45a8aa=_0x76b84f[0x1];recordings[_0x45cdf2[_0xf2a9('0x6')]][_0xadf8fd]=_0x45a8aa;}}}catch(_0x40977d){utils['error'](util[_0xf2a9('0x3')]('[%s][recordings][newexten]',_0x45cdf2['uniqueid']),_0x40977d);}};exports['queuecallerjoin']=function(_0x97600f){try{if(!_[_0xf2a9('0x19')](recordings[_0x97600f['uniqueid']])){utils[_0xf2a9('0xf')](util[_0xf2a9('0x3')](_0xf2a9('0x3a'),_0x97600f['uniqueid']),_0x97600f);utils['info'](util['format'](_0xf2a9('0x3b'),_0x97600f[_0xf2a9('0x6')],_0x97600f[_0xf2a9('0x3c')]));recordings[_0x97600f[_0xf2a9('0x6')]][_0xf2a9('0x3c')]=_0x97600f['queue'];}}catch(_0x55ea06){utils[_0xf2a9('0x16')](util[_0xf2a9('0x3')]('[%s][recordings][queuecallerjoin]',_0x97600f[_0xf2a9('0x6')]),_0x55ea06);}};exports[_0xf2a9('0x3d')]=function(_0x58219c){try{utils[_0xf2a9('0xf')](util['format'](_0xf2a9('0x3e'),_0x58219c[_0xf2a9('0x6')]),_0x58219c);utils[_0xf2a9('0x2')](util[_0xf2a9('0x3')](_0xf2a9('0x3f'),_0x58219c['uniqueid'],_0x58219c[_0xf2a9('0x40')],_0x58219c[_0xf2a9('0x41')],_0x58219c[_0xf2a9('0x42')],_0x58219c[_0xf2a9('0x43')]));if(recordings[_0x58219c[_0xf2a9('0x44')]]&&transfers[_0xf2a9('0x5')][_0x58219c[_0xf2a9('0x44')]]){transfers[_0xf2a9('0x5')][_0x58219c[_0xf2a9('0x44')]][_0xf2a9('0x45')]=!![];}}catch(_0x4ef571){utils[_0xf2a9('0x16')](util['format'](_0xf2a9('0x3e'),_0x58219c['uniqueid']),_0x4ef571);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index e888344..2763e81 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 _0xa592=['type','blind','blinds','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','lodash','util','./utils','info','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname'];(function(_0x522cc7,_0x149ffd){var _0x5f012b=function(_0x4f7ee1){while(--_0x4f7ee1){_0x522cc7['push'](_0x522cc7['shift']());}};_0x5f012b(++_0x149ffd);}(_0xa592,0x19f));var _0x2a59=function(_0x3b4a00,_0x3d9a32){_0x3b4a00=_0x3b4a00-0x0;var _0x5bff71=_0xa592[_0x3b4a00];return _0x5bff71;};'use strict';var _=require(_0x2a59('0x0'));var util=require(_0x2a59('0x1'));var utils=require(_0x2a59('0x2'));function writeDB(_0x22af9b){utils[_0x2a59('0x3')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x22af9b['type']===_0x2a59('0x4')?_0x22af9b[_0x2a59('0x5')]:_0x22af9b[_0x2a59('0x6')],_0x22af9b['type']));utils['request'](_0x2a59('0x7'),_0x22af9b);}exports['blinds']={};exports['blindtransfer']=function(_0x142d51){try{utils[_0x2a59('0x8')](util['format'](_0x2a59('0x9'),_0x142d51[_0x2a59('0x6')]),_0x142d51);utils[_0x2a59('0x3')](util[_0x2a59('0xa')](_0x2a59('0xb'),_0x142d51[_0x2a59('0x6')],_0x142d51[_0x2a59('0xc')],_0x142d51['transferercalleridname'],_0x142d51['transfereecalleridnum'],_0x142d51[_0x2a59('0xd')]));_0x142d51[_0x2a59('0xe')]=_0x2a59('0xf');exports[_0x2a59('0x10')][_0x142d51[_0x2a59('0x11')]]=_0x142d51;writeDB(_0x142d51);}catch(_0x33bbc9){utils[_0x2a59('0x12')](util[_0x2a59('0xa')](_0x2a59('0x9'),_0x142d51[_0x2a59('0x6')]),_0x33bbc9);}};exports[_0x2a59('0x13')]=function(_0x4a3240){try{utils['debug'](util['format'](_0x2a59('0x14'),_0x4a3240[_0x2a59('0x5')]),_0x4a3240);utils[_0x2a59('0x3')](util[_0x2a59('0xa')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4a3240['origtransfereruniqueid'],_0x4a3240[_0x2a59('0x15')],_0x4a3240[_0x2a59('0x16')],_0x4a3240[_0x2a59('0x17')],_0x4a3240[_0x2a59('0x18')]));_0x4a3240=_[_0x2a59('0x19')](_0x4a3240,{'transfererchannel':_0x4a3240[_0x2a59('0x1a')],'transferercalleridnum':_0x4a3240[_0x2a59('0x15')],'transferercalleridname':_0x4a3240[_0x2a59('0x16')],'transfererconnectedlinenum':_0x4a3240[_0x2a59('0x1b')],'transfererconnectedlinename':_0x4a3240[_0x2a59('0x1c')],'transfereraccountcode':_0x4a3240[_0x2a59('0x1d')],'transferercontext':_0x4a3240[_0x2a59('0x1e')],'transfererexten':_0x4a3240[_0x2a59('0x1f')],'transfererlinkedid':_0x4a3240[_0x2a59('0x20')],'context':_0x4a3240[_0x2a59('0x21')],'extension':_0x4a3240['origtransfererexten'],'type':_0x2a59('0x4')});if(_['isNil'](_0x4a3240['transfereechannel'])){_0x4a3240=_[_0x2a59('0x19')](_0x4a3240,{'transfereechannel':_0x4a3240[_0x2a59('0x22')],'transfereecalleridnum':_0x4a3240[_0x2a59('0x17')],'transfereecalleridname':_0x4a3240[_0x2a59('0x18')],'transfereeconnectedlinenum':_0x4a3240[_0x2a59('0x23')],'transfereeconnectedlinename':_0x4a3240[_0x2a59('0x24')],'transfereeaccountcode':_0x4a3240['transfertargetaccountcode'],'transfereecontext':_0x4a3240[_0x2a59('0x25')],'transfereeexten':_0x4a3240[_0x2a59('0x26')],'transfereelinkedid':_0x4a3240['transfertargetlinkedid']});}writeDB(_0x4a3240);}catch(_0x2097e3){utils[_0x2a59('0x12')](util[_0x2a59('0xa')](_0x2a59('0x14'),_0x4a3240[_0x2a59('0x5')]),_0x2097e3);}}; \ No newline at end of file +var _0x2c1c=['format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','[%s][transfers][blindtransfer]','transfereecalleridnum','transfereecalleridname','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','assign','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','./utils','info'];(function(_0x4a45e2,_0x4873af){var _0x13a8e7=function(_0x3ba39b){while(--_0x3ba39b){_0x4a45e2['push'](_0x4a45e2['shift']());}};_0x13a8e7(++_0x4873af);}(_0x2c1c,0xc0));var _0xc2c1=function(_0x5ce4e3,_0x42cb9a){_0x5ce4e3=_0x5ce4e3-0x0;var _0x42248f=_0x2c1c[_0x5ce4e3];return _0x42248f;};'use strict';var _=require(_0xc2c1('0x0'));var util=require('util');var utils=require(_0xc2c1('0x1'));function writeDB(_0x1d2813){utils[_0xc2c1('0x2')](util[_0xc2c1('0x3')](_0xc2c1('0x4'),_0x1d2813[_0xc2c1('0x5')]===_0xc2c1('0x6')?_0x1d2813[_0xc2c1('0x7')]:_0x1d2813[_0xc2c1('0x8')],_0x1d2813['type']));utils[_0xc2c1('0x9')](_0xc2c1('0xa'),_0x1d2813);}exports[_0xc2c1('0xb')]={};exports['blindtransfer']=function(_0x1cc04e){try{utils['debug'](util['format'](_0xc2c1('0xc'),_0x1cc04e['uniqueid']),_0x1cc04e);utils[_0xc2c1('0x2')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1cc04e[_0xc2c1('0x8')],_0x1cc04e['transferercalleridnum'],_0x1cc04e['transferercalleridname'],_0x1cc04e[_0xc2c1('0xd')],_0x1cc04e[_0xc2c1('0xe')]));_0x1cc04e[_0xc2c1('0x5')]='blind';exports[_0xc2c1('0xb')][_0x1cc04e[_0xc2c1('0xf')]]=_0x1cc04e;writeDB(_0x1cc04e);}catch(_0x2a19f5){utils[_0xc2c1('0x10')](util[_0xc2c1('0x3')]('[%s][transfers][blindtransfer]',_0x1cc04e['uniqueid']),_0x2a19f5);}};exports[_0xc2c1('0x11')]=function(_0x3bd9d2){try{utils[_0xc2c1('0x12')](util[_0xc2c1('0x3')](_0xc2c1('0x13'),_0x3bd9d2[_0xc2c1('0x7')]),_0x3bd9d2);utils['info'](util[_0xc2c1('0x3')](_0xc2c1('0x14'),_0x3bd9d2[_0xc2c1('0x7')],_0x3bd9d2[_0xc2c1('0x15')],_0x3bd9d2[_0xc2c1('0x16')],_0x3bd9d2['transfertargetcalleridnum'],_0x3bd9d2[_0xc2c1('0x17')]));_0x3bd9d2=_['assign'](_0x3bd9d2,{'transfererchannel':_0x3bd9d2[_0xc2c1('0x18')],'transferercalleridnum':_0x3bd9d2[_0xc2c1('0x15')],'transferercalleridname':_0x3bd9d2['origtransferercalleridname'],'transfererconnectedlinenum':_0x3bd9d2[_0xc2c1('0x19')],'transfererconnectedlinename':_0x3bd9d2[_0xc2c1('0x1a')],'transfereraccountcode':_0x3bd9d2['origtransfereraccountcode'],'transferercontext':_0x3bd9d2[_0xc2c1('0x1b')],'transfererexten':_0x3bd9d2[_0xc2c1('0x1c')],'transfererlinkedid':_0x3bd9d2['origtransfererlinkedid'],'context':_0x3bd9d2[_0xc2c1('0x1d')],'extension':_0x3bd9d2[_0xc2c1('0x1e')],'type':_0xc2c1('0x6')});if(_['isNil'](_0x3bd9d2['transfereechannel'])){_0x3bd9d2=_[_0xc2c1('0x1f')](_0x3bd9d2,{'transfereechannel':_0x3bd9d2[_0xc2c1('0x20')],'transfereecalleridnum':_0x3bd9d2[_0xc2c1('0x21')],'transfereecalleridname':_0x3bd9d2[_0xc2c1('0x17')],'transfereeconnectedlinenum':_0x3bd9d2[_0xc2c1('0x22')],'transfereeconnectedlinename':_0x3bd9d2[_0xc2c1('0x23')],'transfereeaccountcode':_0x3bd9d2[_0xc2c1('0x24')],'transfereecontext':_0x3bd9d2[_0xc2c1('0x25')],'transfereeexten':_0x3bd9d2[_0xc2c1('0x26')],'transfereelinkedid':_0x3bd9d2['transfertargetlinkedid']});}writeDB(_0x3bd9d2);}catch(_0x167a97){utils[_0xc2c1('0x10')](util[_0xc2c1('0x3')](_0xc2c1('0x13'),_0x3bd9d2['origtransfereruniqueid']),_0x167a97);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index fa40029..ce83656 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 _0xe1b7=['seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','../../config/logger','xdr','info','inspect','debug','request','then','[utils][request]\x20name:%s','GetUser','internal','interface','stringify','length','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','catch','error','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','name','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add'];(function(_0x495fe2,_0x1bc9e4){var _0x1e6bed=function(_0x17023d){while(--_0x17023d){_0x495fe2['push'](_0x495fe2['shift']());}};_0x1e6bed(++_0x1bc9e4);}(_0xe1b7,0x1bb));var _0x7e1b=function(_0xb8a63a,_0x3f90ac){_0xb8a63a=_0xb8a63a-0x0;var _0x3e8367=_0xe1b7[_0xb8a63a];return _0x3e8367;};'use strict';var BPromise=require(_0x7e1b('0x0'));var jayson=require('jayson/promise');var moment=require(_0x7e1b('0x1'));var util=require(_0x7e1b('0x2'));var client=jayson['client']['http']({'port':0x2329});var logger=require(_0x7e1b('0x3'))(_0x7e1b('0x4'));exports[_0x7e1b('0x5')]=function(_0x53322e,_0x1d7c28){logger[_0x7e1b('0x5')](_0x53322e,_0x1d7c28?util[_0x7e1b('0x6')](_0x1d7c28,{'showHidden':![],'depth':null}):'');};exports[_0x7e1b('0x7')]=function(_0x46a4e7,_0x3abe2b){logger[_0x7e1b('0x7')](_0x46a4e7,_0x3abe2b?util[_0x7e1b('0x6')](_0x3abe2b,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x1a173e,_0x2b6ec6){logger['error'](_0x1a173e,_0x2b6ec6?util[_0x7e1b('0x6')](_0x2b6ec6,{'showHidden':![],'depth':null}):'');};exports[_0x7e1b('0x8')]=function(_0x27f97,_0x4ff852){return client[_0x7e1b('0x8')](_0x27f97,{'body':_0x4ff852})[_0x7e1b('0x9')](function(_0x735311){logger['debug'](_0x7e1b('0xa'),_0x27f97,_0x735311?util[_0x7e1b('0x6')](_0x735311,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x5f5dc1){logger['error'](_0x7e1b('0xa'),_0x27f97,_0x5f5dc1?util[_0x7e1b('0x6')](_0x5f5dc1,{'showHidden':![],'depth':null}):'');});};function getUser(_0x22291f){return client[_0x7e1b('0x8')](_0x7e1b('0xb'),{'options':{'raw':!![],'attributes':['id',_0x7e1b('0xc'),'name',_0x7e1b('0xd')],'where':_0x22291f,'limit':0x1}})[_0x7e1b('0x9')](function(_0x5c9a0b){logger[_0x7e1b('0x7')]('[utils][getUser]\x20where:%s',JSON[_0x7e1b('0xe')](_0x22291f),_0x5c9a0b?util[_0x7e1b('0x6')](_0x5c9a0b,{'showHidden':![],'depth':null}):'');return _0x5c9a0b['result'][_0x7e1b('0xf')]?_0x5c9a0b[_0x7e1b('0x10')][0x0]:null;});}exports['getUserByInternal']=function(_0x4d17e4){return new BPromise(function(_0x587a7a,_0x1fb132){if(_0x4d17e4){return getUser({'internal':_0x4d17e4})[_0x7e1b('0x9')](function(_0x12c005){logger[_0x7e1b('0x5')](_0x7e1b('0x11'),_0x4d17e4,_0x12c005?_0x7e1b('0x12'):'notfound');return _0x587a7a(_0x12c005);})[_0x7e1b('0x13')](function(_0x3f5e01){logger[_0x7e1b('0x14')](_0x7e1b('0x15'),_0x3f5e01?util[_0x7e1b('0x6')](_0x3f5e01,{'showHidden':![],'depth':null}):'');return _0x587a7a(null);});}return _0x587a7a(null);});};exports[_0x7e1b('0x16')]=function(_0x513e97){return new BPromise(function(_0x496727,_0x325328){if(_0x513e97){return getUser({'interface':_0x513e97})['then'](function(_0x6c7f3c){logger[_0x7e1b('0x5')](_0x7e1b('0x17'),_0x513e97,_0x6c7f3c?'found':_0x7e1b('0x18'));return _0x496727(_0x6c7f3c);})[_0x7e1b('0x13')](function(_0x1740cc){logger[_0x7e1b('0x14')](_0x7e1b('0x19'),_0x1740cc?util[_0x7e1b('0x6')](_0x1740cc,{'showHidden':![],'depth':null}):'');return _0x496727(null);});}return _0x496727(null);});};exports[_0x7e1b('0x1a')]=function(_0x47901d){return new BPromise(function(_0x190416,_0x6bd621){if(_0x47901d){return getUser({'name':_0x47901d})['then'](function(_0x12cc87){logger['info'](_0x7e1b('0x1b'),_0x47901d,_0x12cc87?'found':_0x7e1b('0x18'));return _0x190416(_0x12cc87);})[_0x7e1b('0x13')](function(_0x3efd52){logger['error'](_0x7e1b('0x1c'),_0x3efd52?util[_0x7e1b('0x6')](_0x3efd52,{'showHidden':![],'depth':null}):'');return _0x190416(null);});}return _0x190416(null);});};exports[_0x7e1b('0x1d')]=function(_0x31b4bd){return new BPromise(function(_0x2ad18c,_0x3cc850){if(_0x31b4bd){return client[_0x7e1b('0x8')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x7e1b('0x1e'),_0x7e1b('0x1f'),_0x7e1b('0x20'),'acwTimeout'],'where':{'name':_0x31b4bd},'limit':0x1}})['then'](function(_0x4acede){logger['debug'](_0x7e1b('0x21'),_0x31b4bd,_0x4acede?util[_0x7e1b('0x6')](_0x4acede,{'showHidden':![],'depth':null}):'');logger[_0x7e1b('0x5')](_0x7e1b('0x22'),_0x31b4bd,_0x4acede?_0x7e1b('0x12'):_0x7e1b('0x18'));return _0x2ad18c(_0x4acede[_0x7e1b('0x10')][_0x7e1b('0xf')]?_0x4acede[_0x7e1b('0x10')][0x0]:null);})['catch'](function(_0x418629){logger[_0x7e1b('0x14')]('[utils][getVoiceQueueByName]',_0x418629?util[_0x7e1b('0x6')](_0x418629,{'showHidden':![],'depth':null}):'');return _0x2ad18c(null);});}return _0x2ad18c(null);});};exports[_0x7e1b('0x23')]=function(_0x2f2281,_0x5de73c){return moment(_0x2f2281)[_0x7e1b('0x24')](_0x5de73c,_0x7e1b('0x25'))['format'](_0x7e1b('0x26'));};exports[_0x7e1b('0x27')]=function(_0x44edab,_0x38a001){return moment(_0x44edab)[_0x7e1b('0x28')](_0x38a001,_0x7e1b('0x25'))[_0x7e1b('0x29')](_0x7e1b('0x26'));};exports[_0x7e1b('0x2a')]=function(_0x99583b,_0x350951){return moment(_0x99583b)[_0x7e1b('0x2b')](moment(_0x350951),_0x7e1b('0x25'));};exports[_0x7e1b('0x2c')]=function(_0x5bbaeb,_0x460e91){return parseInt(_0x5bbaeb,0xa)+parseInt(_0x460e91,0xa);};exports[_0x7e1b('0x2d')]=function(){return moment()[_0x7e1b('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7e1b('0x2e')]=function(_0x1239d7,_0x121763){if(_0x121763){return moment(_0x1239d7)[_0x7e1b('0x2e')](_0x121763);}return!![];};exports[_0x7e1b('0x2f')]=function(_0x12f7f1,_0x5a8ca7){if(_0x5a8ca7){return moment(_0x12f7f1)['isBefore'](_0x5a8ca7);}else if(_0x12f7f1){return!![];}return![];}; \ No newline at end of file +var _0x4484=['subtractTime','diffTime','diff','sumTime','now','isAfter','isBefore','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','catch','GetUser','internal','name','interface','stringify','length','result','getUserByInternal','[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]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x36ec9c,_0x4afb7d){var _0x52d92f=function(_0x16e3ed){while(--_0x16e3ed){_0x36ec9c['push'](_0x36ec9c['shift']());}};_0x52d92f(++_0x4afb7d);}(_0x4484,0xf2));var _0x4448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4484[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require('moment');var util=require('util');var client=jayson[_0x4448('0x0')][_0x4448('0x1')]({'port':0x2329});var logger=require(_0x4448('0x2'))(_0x4448('0x3'));exports[_0x4448('0x4')]=function(_0x19f471,_0x279cbc){logger[_0x4448('0x4')](_0x19f471,_0x279cbc?util[_0x4448('0x5')](_0x279cbc,{'showHidden':![],'depth':null}):'');};exports[_0x4448('0x6')]=function(_0x551d4d,_0x20374b){logger['debug'](_0x551d4d,_0x20374b?util[_0x4448('0x5')](_0x20374b,{'showHidden':![],'depth':null}):'');};exports[_0x4448('0x7')]=function(_0x3bdfdb,_0xa12353){logger[_0x4448('0x7')](_0x3bdfdb,_0xa12353?util[_0x4448('0x5')](_0xa12353,{'showHidden':![],'depth':null}):'');};exports[_0x4448('0x8')]=function(_0xd517d4,_0x20a494){return client[_0x4448('0x8')](_0xd517d4,{'body':_0x20a494})[_0x4448('0x9')](function(_0x79a723){logger['debug']('[utils][request]\x20name:%s',_0xd517d4,_0x79a723?util[_0x4448('0x5')](_0x79a723,{'showHidden':![],'depth':null}):'');})[_0x4448('0xa')](function(_0x2a5a1b){logger[_0x4448('0x7')]('[utils][request]\x20name:%s',_0xd517d4,_0x2a5a1b?util[_0x4448('0x5')](_0x2a5a1b,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4f041f){return client[_0x4448('0x8')](_0x4448('0xb'),{'options':{'raw':!![],'attributes':['id',_0x4448('0xc'),_0x4448('0xd'),_0x4448('0xe')],'where':_0x4f041f,'limit':0x1}})['then'](function(_0xac173e){logger[_0x4448('0x6')]('[utils][getUser]\x20where:%s',JSON[_0x4448('0xf')](_0x4f041f),_0xac173e?util[_0x4448('0x5')](_0xac173e,{'showHidden':![],'depth':null}):'');return _0xac173e['result'][_0x4448('0x10')]?_0xac173e[_0x4448('0x11')][0x0]:null;});}exports[_0x4448('0x12')]=function(_0x2023a2){return new BPromise(function(_0x14c979,_0x398bbc){if(_0x2023a2){return getUser({'internal':_0x2023a2})['then'](function(_0x4435ca){logger[_0x4448('0x4')](_0x4448('0x13'),_0x2023a2,_0x4435ca?_0x4448('0x14'):_0x4448('0x15'));return _0x14c979(_0x4435ca);})['catch'](function(_0x3ea369){logger[_0x4448('0x7')](_0x4448('0x16'),_0x3ea369?util[_0x4448('0x5')](_0x3ea369,{'showHidden':![],'depth':null}):'');return _0x14c979(null);});}return _0x14c979(null);});};exports[_0x4448('0x17')]=function(_0x6cdddc){return new BPromise(function(_0x13f2f1,_0x55c44b){if(_0x6cdddc){return getUser({'interface':_0x6cdddc})[_0x4448('0x9')](function(_0x4f91ed){logger[_0x4448('0x4')](_0x4448('0x18'),_0x6cdddc,_0x4f91ed?_0x4448('0x14'):_0x4448('0x15'));return _0x13f2f1(_0x4f91ed);})['catch'](function(_0x344e63){logger[_0x4448('0x7')](_0x4448('0x19'),_0x344e63?util[_0x4448('0x5')](_0x344e63,{'showHidden':![],'depth':null}):'');return _0x13f2f1(null);});}return _0x13f2f1(null);});};exports['getUserByName']=function(_0x36d4e6){return new BPromise(function(_0x2f7d11,_0x37f2cc){if(_0x36d4e6){return getUser({'name':_0x36d4e6})[_0x4448('0x9')](function(_0x2da310){logger['info'](_0x4448('0x1a'),_0x36d4e6,_0x2da310?_0x4448('0x14'):_0x4448('0x15'));return _0x2f7d11(_0x2da310);})[_0x4448('0xa')](function(_0x1319f3){logger[_0x4448('0x7')](_0x4448('0x1b'),_0x1319f3?util['inspect'](_0x1319f3,{'showHidden':![],'depth':null}):'');return _0x2f7d11(null);});}return _0x2f7d11(null);});};exports[_0x4448('0x1c')]=function(_0x2fb5e5){return new BPromise(function(_0x82982e,_0x4ed513){if(_0x2fb5e5){return client['request'](_0x4448('0x1d'),{'options':{'raw':!![],'attributes':['id','name',_0x4448('0x1e'),_0x4448('0x1f'),_0x4448('0x20')],'where':{'name':_0x2fb5e5},'limit':0x1}})['then'](function(_0x42a223){logger[_0x4448('0x6')](_0x4448('0x21'),_0x2fb5e5,_0x42a223?util[_0x4448('0x5')](_0x42a223,{'showHidden':![],'depth':null}):'');logger[_0x4448('0x4')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x2fb5e5,_0x42a223?'found':'notfound');return _0x82982e(_0x42a223[_0x4448('0x11')][_0x4448('0x10')]?_0x42a223[_0x4448('0x11')][0x0]:null);})[_0x4448('0xa')](function(_0x3778b5){logger[_0x4448('0x7')](_0x4448('0x22'),_0x3778b5?util['inspect'](_0x3778b5,{'showHidden':![],'depth':null}):'');return _0x82982e(null);});}return _0x82982e(null);});};exports[_0x4448('0x23')]=function(_0x3cf571,_0x19809c){return moment(_0x3cf571)[_0x4448('0x24')](_0x19809c,_0x4448('0x25'))[_0x4448('0x26')](_0x4448('0x27'));};exports[_0x4448('0x28')]=function(_0x2d7ff5,_0x4cae9e){return moment(_0x2d7ff5)['subtract'](_0x4cae9e,_0x4448('0x25'))[_0x4448('0x26')](_0x4448('0x27'));};exports[_0x4448('0x29')]=function(_0x2444a3,_0x5c77cc){return moment(_0x2444a3)[_0x4448('0x2a')](moment(_0x5c77cc),_0x4448('0x25'));};exports[_0x4448('0x2b')]=function(_0x3cde15,_0x1a2ebd){return parseInt(_0x3cde15,0xa)+parseInt(_0x1a2ebd,0xa);};exports[_0x4448('0x2c')]=function(){return moment()[_0x4448('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x4448('0x2d')]=function(_0x1ee4e2,_0x1430c1){if(_0x1430c1){return moment(_0x1ee4e2)[_0x4448('0x2d')](_0x1430c1);}return!![];};exports[_0x4448('0x2e')]=function(_0x3502fd,_0x1b63ff){if(_0x1b63ff){return moment(_0x3502fd)['isBefore'](_0x1b63ff);}else if(_0x3502fd){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 d38e8be..765d102 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 _0xd237=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','device','agent_name','test','fs-extra','lodash','express-winston','util','./loggers','fileLogger','safeTemplate','maskSensitiveData','join','/var','log','xcally','client','name','then','catch','user','no-user','data','timestamp','error','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','role','inspect'];(function(_0x3e3be2,_0x3a506a){var _0x43ada0=function(_0x249cb3){while(--_0x249cb3){_0x3e3be2['push'](_0x3e3be2['shift']());}};_0x43ada0(++_0x3a506a);}(_0xd237,0x19b));var _0x7d23=function(_0x4a1fa5,_0x251f61){_0x4a1fa5=_0x4a1fa5-0x0;var _0x27fd7c=_0xd237[_0x4a1fa5];return _0x27fd7c;};var fs=require(_0x7d23('0x0'));var _=require(_0x7d23('0x1'));var ewinston=require(_0x7d23('0x2'));var path=require('path');var util=require(_0x7d23('0x3'));var fileLogger=require(_0x7d23('0x4'))[_0x7d23('0x5')];var safeTemplate=require('./safe-template')[_0x7d23('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0x7d23('0x7')];function ClientSideLogger(){function _0x2cfb80(_0x564326){var _0x3e7852=path[_0x7d23('0x8')](_0x7d23('0x9'),_0x7d23('0xa'),_0x7d23('0xb'));var _0x3e0af8=path[_0x7d23('0x8')](_0x7d23('0xc'),_0x564326['role']+'-'+_0x564326[_0x7d23('0xd')]);return fs['ensureDir'](path[_0x7d23('0x8')](_0x3e7852,_0x3e0af8))[_0x7d23('0xe')](function(){var _0x316dbd=fileLogger(_0x7d23('0xc'),path[_0x7d23('0x8')](_0x3e7852,_0x3e0af8));return _0x316dbd;})[_0x7d23('0xf')](function(_0xb410e){throw _0xb410e;});}this[_0x7d23('0xa')]=function(_0x28c7d6,_0x1d6470,_0x1b3fcf,_0x438ed5){return _0x2cfb80(_0x28c7d6['user'])[_0x7d23('0xe')](function(_0xf40508){var _0x55c003=_0xf40508[_0x1d6470];return _0x55c003;})[_0x7d23('0xe')](function(_0x480126){var _0x1190bf=_0x28c7d6[_0x7d23('0x10')]?_0x28c7d6[_0x7d23('0x10')]['id']:_0x7d23('0x11');var _0x932b8c=_0x438ed5[_0x7d23('0x12')];var _0x12ee9e=_0x438ed5[_0x7d23('0x13')];var _0x3bb48c=new Date(Number(_0x12ee9e));return _0x480126(_0x1190bf,_0x3bb48c,_0x1b3fcf,_0x932b8c);})[_0x7d23('0xf')](function(_0x106b59){fileLogger(_0x7d23('0xc'))[_0x7d23('0x14')](_0x106b59);});};}function setupLoggers(_0x32be5c){return new Promise(function(_0xb06b2a){var _0x3443d6=new ClientSideLogger();var _0x36703c=fileLogger('api');var _0x1160bf=fileLogger(_0x7d23('0x15'));_0x32be5c[_0x7d23('0x16')](_0x7d23('0x17'),_0x3443d6);_0x32be5c[_0x7d23('0x18')](ewinston[_0x7d23('0x19')]({'winstonInstance':_0x36703c,'meta':![],'statusLevels':!![],'msg':function(_0x3d842c,_0x3b6832){var _0x479a30=_0x7d23('0x1a');if(!_[_0x7d23('0x1b')](_0x3d842c[_0x7d23('0x1c')])){_0x479a30+=_0x7d23('0x1d');var _0x19eea2=_0x3d842c[_0x7d23('0x1c')];maskSensitiveData(_0x19eea2);}return safeTemplate(util['format'](_0x479a30,_0x3d842c[_0x7d23('0x1e')],_0x3d842c[_0x7d23('0x1f')][_0x7d23('0x20')]?_0x3d842c['headers'][_0x7d23('0x20')]:_0x3d842c[_0x7d23('0x21')][_0x7d23('0x22')]||_0x3d842c['ip'],_0x3d842c[_0x7d23('0x23')],_0x3b6832[_0x7d23('0x24')],_0x3b6832['responseTime'],_0x3d842c['user']?_0x3d842c[_0x7d23('0x10')]['id']:null,_0x3d842c['user']?_0x3d842c['user']['name']:null,_0x3d842c[_0x7d23('0x10')]?_0x3d842c['user'][_0x7d23('0x25')]:null,_0x19eea2?util[_0x7d23('0x26')](_0x19eea2,![],null):''));}}));_0x32be5c['use'](ewinston[_0x7d23('0x19')]({'winstonInstance':_0x1160bf,'meta':![],'statusLevels':!![],'msg':function(_0x1a16d2,_0x5ee9d8){var _0x3e40c9=_0x7d23('0x27');if(_0x1a16d2[_0x7d23('0x1c')]&&_0x1a16d2['body']['device']&&_0x1a16d2['body'][_0x7d23('0x28')]){_0x3e40c9=_0x7d23('0x29');}return util['format'](_0x3e40c9,_0x1a16d2[_0x7d23('0x1e')],_0x1a16d2[_0x7d23('0x1f')]['x-forwarded-for']?_0x1a16d2[_0x7d23('0x1f')]['x-forwarded-for']:_0x1a16d2[_0x7d23('0x21')]['remoteAddress']||_0x1a16d2['ip'],_0x1a16d2[_0x7d23('0x23')],_0x5ee9d8['statusCode'],_0x5ee9d8['responseTime'],_0x1a16d2['user']?_0x1a16d2[_0x7d23('0x10')]['id']:null,_0x1a16d2['user']?_0x1a16d2[_0x7d23('0x10')][_0x7d23('0xd')]:null,_0x1a16d2[_0x7d23('0x10')]?_0x1a16d2[_0x7d23('0x10')][_0x7d23('0x25')]:null,_0x1a16d2[_0x7d23('0x1c')]&&_0x1a16d2[_0x7d23('0x1c')][_0x7d23('0x2a')]?_0x1a16d2[_0x7d23('0x1c')][_0x7d23('0x2a')]:'other',_0x1a16d2[_0x7d23('0x1c')]&&_0x1a16d2[_0x7d23('0x1c')]['agent_id']?_0x1a16d2[_0x7d23('0x1c')]['agent_id']:'',_0x1a16d2[_0x7d23('0x1c')]&&_0x1a16d2['body'][_0x7d23('0x2b')]?_0x1a16d2[_0x7d23('0x1c')][_0x7d23('0x2b')]:'');},'ignoreRoute':function(_0x48a2b0){var _0x420eb5=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x420eb5[_0x7d23('0x2c')](_0x48a2b0[_0x7d23('0x23')]);}}));return _0xb06b2a();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0xafee=['other','test','setupLoggers','fs-extra','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','catch','user','then','data','timestamp','error','set','client-side-logger','use','logger','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','device','agent_id','url'];(function(_0x58981e,_0x4c924a){var _0x19904a=function(_0x2b600c){while(--_0x2b600c){_0x58981e['push'](_0x58981e['shift']());}};_0x19904a(++_0x4c924a);}(_0xafee,0x14b));var _0xeafe=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xafee[_0x4e676e];return _0x336a3c;};var fs=require(_0xeafe('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require('path');var util=require(_0xeafe('0x1'));var fileLogger=require(_0xeafe('0x2'))[_0xeafe('0x3')];var safeTemplate=require(_0xeafe('0x4'))['safeTemplate'];var maskSensitiveData=require(_0xeafe('0x5'))[_0xeafe('0x6')];function ClientSideLogger(){function _0x23b9bd(_0x1fd9be){var _0x12d1bc=path[_0xeafe('0x7')](_0xeafe('0x8'),_0xeafe('0x9'),_0xeafe('0xa'));var _0x1cf47a=path[_0xeafe('0x7')](_0xeafe('0xb'),_0x1fd9be[_0xeafe('0xc')]+'-'+_0x1fd9be[_0xeafe('0xd')]);return fs['ensureDir'](path[_0xeafe('0x7')](_0x12d1bc,_0x1cf47a))['then'](function(){var _0x2f5901=fileLogger(_0xeafe('0xb'),path[_0xeafe('0x7')](_0x12d1bc,_0x1cf47a));return _0x2f5901;})[_0xeafe('0xe')](function(_0x2ee316){throw _0x2ee316;});}this[_0xeafe('0x9')]=function(_0x2776b0,_0x55adf4,_0x45d368,_0x3f4ac2){return _0x23b9bd(_0x2776b0[_0xeafe('0xf')])[_0xeafe('0x10')](function(_0x48b508){var _0xaf5abf=_0x48b508[_0x55adf4];return _0xaf5abf;})[_0xeafe('0x10')](function(_0x3f6140){var _0x5bd6b7=_0x2776b0[_0xeafe('0xf')]?_0x2776b0[_0xeafe('0xf')]['id']:'no-user';var _0x19d486=_0x3f4ac2[_0xeafe('0x11')];var _0x1b0e91=_0x3f4ac2[_0xeafe('0x12')];var _0x40c4b6=new Date(Number(_0x1b0e91));return _0x3f6140(_0x5bd6b7,_0x40c4b6,_0x45d368,_0x19d486);})['catch'](function(_0x192ac1){fileLogger(_0xeafe('0xb'))[_0xeafe('0x13')](_0x192ac1);});};}function setupLoggers(_0x245c99){return new Promise(function(_0x3b7eec){var _0x211b44=new ClientSideLogger();var _0x256879=fileLogger('api');var _0x31bed6=fileLogger('auth');_0x245c99[_0xeafe('0x14')](_0xeafe('0x15'),_0x211b44);_0x245c99[_0xeafe('0x16')](ewinston[_0xeafe('0x17')]({'winstonInstance':_0x256879,'meta':![],'statusLevels':!![],'msg':function(_0x3261e5,_0x4e82cf){var _0x530da9='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xeafe('0x18')](_0x3261e5[_0xeafe('0x19')])){_0x530da9+=_0xeafe('0x1a');var _0x1175ba=_0x3261e5['body'];maskSensitiveData(_0x1175ba);}return safeTemplate(util[_0xeafe('0x1b')](_0x530da9,_0x3261e5[_0xeafe('0x1c')],_0x3261e5[_0xeafe('0x1d')][_0xeafe('0x1e')]?_0x3261e5['headers'][_0xeafe('0x1e')]:_0x3261e5[_0xeafe('0x1f')][_0xeafe('0x20')]||_0x3261e5['ip'],_0x3261e5['url'],_0x4e82cf[_0xeafe('0x21')],_0x4e82cf[_0xeafe('0x22')],_0x3261e5[_0xeafe('0xf')]?_0x3261e5['user']['id']:null,_0x3261e5[_0xeafe('0xf')]?_0x3261e5[_0xeafe('0xf')][_0xeafe('0xd')]:null,_0x3261e5[_0xeafe('0xf')]?_0x3261e5[_0xeafe('0xf')][_0xeafe('0xc')]:null,_0x1175ba?util['inspect'](_0x1175ba,![],null):''));}}));_0x245c99[_0xeafe('0x16')](ewinston[_0xeafe('0x17')]({'winstonInstance':_0x31bed6,'meta':![],'statusLevels':!![],'msg':function(_0x37ba1c,_0x58d7cc){var _0x20c918='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x37ba1c[_0xeafe('0x19')]&&_0x37ba1c['body'][_0xeafe('0x23')]&&_0x37ba1c[_0xeafe('0x19')][_0xeafe('0x24')]){_0x20c918='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xeafe('0x1b')](_0x20c918,_0x37ba1c['method'],_0x37ba1c[_0xeafe('0x1d')][_0xeafe('0x1e')]?_0x37ba1c[_0xeafe('0x1d')][_0xeafe('0x1e')]:_0x37ba1c['connection'][_0xeafe('0x20')]||_0x37ba1c['ip'],_0x37ba1c[_0xeafe('0x25')],_0x58d7cc[_0xeafe('0x21')],_0x58d7cc[_0xeafe('0x22')],_0x37ba1c[_0xeafe('0xf')]?_0x37ba1c[_0xeafe('0xf')]['id']:null,_0x37ba1c['user']?_0x37ba1c[_0xeafe('0xf')][_0xeafe('0xd')]:null,_0x37ba1c[_0xeafe('0xf')]?_0x37ba1c[_0xeafe('0xf')][_0xeafe('0xc')]:null,_0x37ba1c[_0xeafe('0x19')]&&_0x37ba1c[_0xeafe('0x19')]['device']?_0x37ba1c[_0xeafe('0x19')][_0xeafe('0x23')]:_0xeafe('0x26'),_0x37ba1c['body']&&_0x37ba1c[_0xeafe('0x19')][_0xeafe('0x24')]?_0x37ba1c[_0xeafe('0x19')][_0xeafe('0x24')]:'',_0x37ba1c[_0xeafe('0x19')]&&_0x37ba1c['body']['agent_name']?_0x37ba1c['body']['agent_name']:'');},'ignoreRoute':function(_0x10782a){var _0x3fcf5f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3fcf5f[_0xeafe('0x27')](_0x10782a[_0xeafe('0x25')]);}}));return _0x3b7eec();});}exports[_0xeafe('0x28')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 03a17c8..e18c17d 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0184=['startOf','endOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','daysInMonth','min','max','domCompare','MMM','monthCompare','guess','test','padStart','length','iftime','lodash','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','map','locale','weekdaysShort','toLowerCase','indexOf','slice','exports','circularDoWInterval','monthsShort','concat','clone','hours','minutes','isBefore'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x0184,0xb8));var _0x4018=function(_0xcd9ec8,_0x27699f){_0xcd9ec8=_0xcd9ec8-0x0;var _0x5aa31b=_0x0184[_0xcd9ec8];return _0x5aa31b;};var _=require(_0x4018('0x0'));var moment=require(_0x4018('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]['map'](function(_0x51844a){return _0x51844a[_0x4018('0x2')];})[_0x4018('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x4018('0x4');var EINVALID_DATE=_0x4018('0x5');function throwIfDateNotValid(_0x1e8770){if(!_0x1e8770['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2dd7d9){var _0xe582de=_0x2dd7d9[_0x4018('0x6')](':')[_0x4018('0x7')](function(_0x3d5295){return parseInt(_0x3d5295,0xa);});var _0x4d1a54=_0xe582de[0x0];var _0x4577e3=_0xe582de[0x1];if(_0x4d1a54<0x0||_0x4d1a54>0x17||_0x4577e3<0x0||_0x4577e3>0x3b){throw new Error(EINVALID_DATE);}return[_0x4d1a54,_0x4577e3];}function circularDoWInterval(_0x509d17,_0x476700){if(_0x509d17===_0x476700){return[_0x509d17];}else{var _0x4bc549=moment['locale']();moment[_0x4018('0x8')]('en');var _0x595d25=moment[_0x4018('0x9')]()[_0x4018('0x7')](function(_0x3fc004){return _0x3fc004[_0x4018('0xa')]();});moment[_0x4018('0x8')](_0x4bc549);var _0xac4879=_0x595d25[_0x4018('0xb')](_0x509d17);var _0x346440=_0x595d25['indexOf'](_0x476700);if(_0x346440>_0xac4879){return _0x595d25[_0x4018('0xc')](_0xac4879,_0x346440+0x1);}else{var _0x131d34=_0x595d25['slice'](0x0,_0x346440+0x1);var _0x3bf19a=_0x595d25['slice'](_0xac4879);return _0x3bf19a['concat'](_0x131d34);}}}module[_0x4018('0xd')][_0x4018('0xe')]=circularDoWInterval;function circularMonthInterval(_0x15fa20,_0x38c2fe){if(_0x15fa20===_0x38c2fe){return[_0x15fa20];}else{var _0x211ae3=moment[_0x4018('0x8')]();moment['locale']('en');var _0x4f7ca2=moment[_0x4018('0xf')]()[_0x4018('0x7')](function(_0x440443){return _0x440443[_0x4018('0xa')]();});moment[_0x4018('0x8')](_0x211ae3);var _0x73b5d5=_0x4f7ca2['indexOf'](_0x15fa20);var _0x149d0e=_0x4f7ca2[_0x4018('0xb')](_0x38c2fe);if(_0x149d0e>_0x73b5d5){return _0x4f7ca2['slice'](_0x73b5d5,_0x149d0e+0x1);}else{var _0x4ee1cc=_0x4f7ca2[_0x4018('0xc')](0x0,_0x149d0e+0x1);var _0x32905e=_0x4f7ca2[_0x4018('0xc')](_0x73b5d5);return _0x32905e[_0x4018('0x10')](_0x4ee1cc);}}}module[_0x4018('0xd')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0xb6d9fc){var _0x24e50e=parseInt(_0xb6d9fc,0xa);if(_0x24e50e<0x1||_0x24e50e>0x1f){throw new Error(EINVALID_DATE);}return _0x24e50e;}function timeCompare(_0xc3266,_0x1df959,_0x272c06){var _0x2e7636=_0xc3266[_0x4018('0x11')]();var _0x56170b=extractTime(_0x1df959);var _0xc6dfca=_0x56170b[0x0];var _0x2aaf63=_0x56170b[0x1];var _0x33a85a=_0xc3266[_0x4018('0x11')]()[_0x4018('0x12')](_0xc6dfca)[_0x4018('0x13')](_0x2aaf63);throwIfDateNotValid(_0x33a85a);var _0x33a25d=extractTime(_0x272c06);var _0x4fbf90=_0x33a25d[0x0];var _0x1e4daf=_0x33a25d[0x1];var _0x480302=_0xc3266[_0x4018('0x11')]()['hours'](_0x4fbf90)[_0x4018('0x13')](_0x1e4daf);throwIfDateNotValid(_0x480302);if(_0x480302[_0x4018('0x14')](_0x33a85a)){var _0x158913=_0x2e7636['clone']()[_0x4018('0x15')]('day');var _0x771fa4=_0x2e7636[_0x4018('0x11')]()[_0x4018('0x16')](_0x4018('0x17'));return _0x2e7636[_0x4018('0x18')](_0x33a85a,_0x771fa4,undefined,'[]')||_0x2e7636['isBetween'](_0x158913,_0x480302,undefined,'[]');}else{return _0x2e7636[_0x4018('0x18')](_0x33a85a,_0x480302,undefined,'[]');}}module[_0x4018('0xd')][_0x4018('0x19')]=timeCompare;function dowCompare(_0x44588e,_0x157425,_0x15fad9){var _0xe33430=_0x44588e['locale']('en')[_0x4018('0x1a')](_0x4018('0x1b'))[_0x4018('0xa')]();return circularDoWInterval(_0x157425,_0x15fad9)[_0x4018('0x1c')](_0xe33430);}module[_0x4018('0xd')][_0x4018('0x1d')]=dowCompare;function domCompare(_0x23796a,_0x481fe9,_0x116775){var _0x3f7d23=_0x23796a['date']();if(_0x481fe9===_0x116775){return _0x3f7d23===_0x481fe9;}else{var _0x20a1a0=_0x23796a[_0x4018('0x1e')]();var _0x507019=_0x481fe9<_0x116775;let _0x546009=![];var _0x334eb5=0x0;var _0x2846c6=0x0;if(_0x507019){_0x334eb5=Math['max'](0x1,_0x481fe9);_0x2846c6=Math[_0x4018('0x1f')](_0x116775,_0x20a1a0);_0x546009=_0x3f7d23>=_0x334eb5&&_0x3f7d23<=_0x2846c6;}else{_0x334eb5=Math[_0x4018('0x1f')](_0x481fe9,_0x20a1a0);_0x2846c6=Math[_0x4018('0x20')](0x1,_0x116775);_0x546009=_0x3f7d23>=_0x334eb5||_0x3f7d23<=_0x2846c6;}return _0x546009;}}module[_0x4018('0xd')][_0x4018('0x21')]=domCompare;function monthCompare(_0x4173c1,_0x4ea8ab,_0x2ee2b7){var _0x4aedad=_0x4173c1[_0x4018('0x8')]('en')[_0x4018('0x1a')](_0x4018('0x22'))['toLowerCase']();return circularMonthInterval(_0x4ea8ab,_0x2ee2b7)[_0x4018('0x1c')](_0x4aedad);}module['exports'][_0x4018('0x23')]=monthCompare;function iftime(_0x44a72f,_0x2c0e96=moment['tz'][_0x4018('0x24')](),_0x13c57c=moment()){if(!validateRx[_0x4018('0x25')](_0x44a72f)){throw new Error(EINVALID_STRING);}else{var _0x5469c8=(moment['isMoment'](_0x13c57c)?_0x13c57c[_0x4018('0x11')]():moment(_0x13c57c))['tz'](_0x2c0e96)[_0x4018('0x8')]('en');throwIfDateNotValid(_0x5469c8);var _0x3caa5a=_0x44a72f['split'](',');var _0x41ede0=_0x3caa5a[0x0];var _0x33d530=_0x3caa5a[0x1];var _0x21e8a6=_0x3caa5a[0x2];var _0x28b9ab=_0x3caa5a[0x3];let _0x3b5f26=!![];if(_0x41ede0!=='*'){var _0x125642=_0x41ede0['split']('-');var _0x5de5a6=_['padStart'](_0x125642[0x0],0x5,'0');var _0x5c76ed=_0x125642['length']===0x2?_[_0x4018('0x26')](_0x125642[0x1],0x5,'0'):_0x5de5a6;_0x3b5f26=timeCompare(_0x5469c8,_0x5de5a6,_0x5c76ed);}let _0x41e285=!![];if(_0x33d530!=='*'){var _0x1c8fb5=_0x33d530[_0x4018('0x6')]('-');var _0x46558a=_0x1c8fb5[0x0];var _0x2194b8=_0x1c8fb5[_0x4018('0x27')]===0x2?_0x1c8fb5[0x1]:_0x46558a;_0x41e285=dowCompare(_0x5469c8,_0x46558a,_0x2194b8);}let _0xe6e87f=!![];if(_0x21e8a6!=='*'){var _0x59349c=_0x21e8a6[_0x4018('0x6')]('-');var _0x30a76a=parseDom(_0x59349c[0x0]);var _0x4302b2=_0x59349c[_0x4018('0x27')]===0x2?parseDom(_0x59349c[0x1]):_0x30a76a;_0xe6e87f=domCompare(_0x5469c8,_0x30a76a,_0x4302b2);}let _0x5d7103=!![];if(_0x28b9ab!=='*'){var _0x15c935=_0x28b9ab[_0x4018('0x6')]('-');var _0x37fc0b=_0x15c935[0x0];var _0x206b56=_0x15c935['length']===0x2?_0x15c935[0x1]:_0x15c935[0x0];_0x5d7103=monthCompare(_0x5469c8,_0x37fc0b,_0x206b56);}return _0x3b5f26&&_0x41e285&&_0xe6e87f&&_0x5d7103;}}module[_0x4018('0xd')][_0x4018('0x28')]=iftime; \ No newline at end of file +var _0xd477=['map','source','join','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','hours','clone','minutes','isBefore','startOf','endOf','day','isBetween','format','includes','dowCompare','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone'];(function(_0x2b9b66,_0x4c19b0){var _0x5a6267=function(_0x48ce39){while(--_0x48ce39){_0x2b9b66['push'](_0x2b9b66['shift']());}};_0x5a6267(++_0x4c19b0);}(_0xd477,0x16f));var _0x7d47=function(_0x13f9c3,_0x2036c0){_0x13f9c3=_0x13f9c3-0x0;var _0x22185a=_0xd477[_0x13f9c3];return _0x22185a;};var _=require(_0x7d47('0x0'));var moment=require(_0x7d47('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][_0x7d47('0x2')](function(_0x200eb4){return _0x200eb4[_0x7d47('0x3')];})[_0x7d47('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x7d47('0x5');function throwIfDateNotValid(_0x411a78){if(!_0x411a78[_0x7d47('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x130880){var _0x2939d4=_0x130880[_0x7d47('0x7')](':')['map'](function(_0x2b46e0){return parseInt(_0x2b46e0,0xa);});var _0x493250=_0x2939d4[0x0];var _0xebde07=_0x2939d4[0x1];if(_0x493250<0x0||_0x493250>0x17||_0xebde07<0x0||_0xebde07>0x3b){throw new Error(EINVALID_DATE);}return[_0x493250,_0xebde07];}function circularDoWInterval(_0x2a1853,_0x2a3600){if(_0x2a1853===_0x2a3600){return[_0x2a1853];}else{var _0x438785=moment[_0x7d47('0x8')]();moment[_0x7d47('0x8')]('en');var _0x1856a2=moment[_0x7d47('0x9')]()['map'](function(_0x1e1249){return _0x1e1249[_0x7d47('0xa')]();});moment[_0x7d47('0x8')](_0x438785);var _0x220b58=_0x1856a2['indexOf'](_0x2a1853);var _0x31b57f=_0x1856a2[_0x7d47('0xb')](_0x2a3600);if(_0x31b57f>_0x220b58){return _0x1856a2[_0x7d47('0xc')](_0x220b58,_0x31b57f+0x1);}else{var _0xc6708a=_0x1856a2['slice'](0x0,_0x31b57f+0x1);var _0x406183=_0x1856a2[_0x7d47('0xc')](_0x220b58);return _0x406183[_0x7d47('0xd')](_0xc6708a);}}}module[_0x7d47('0xe')][_0x7d47('0xf')]=circularDoWInterval;function circularMonthInterval(_0x41d74e,_0x38b46a){if(_0x41d74e===_0x38b46a){return[_0x41d74e];}else{var _0x1878e2=moment[_0x7d47('0x8')]();moment['locale']('en');var _0x5c1097=moment[_0x7d47('0x10')]()['map'](function(_0x5cf1a3){return _0x5cf1a3[_0x7d47('0xa')]();});moment[_0x7d47('0x8')](_0x1878e2);var _0x2e5f61=_0x5c1097['indexOf'](_0x41d74e);var _0x3edab6=_0x5c1097[_0x7d47('0xb')](_0x38b46a);if(_0x3edab6>_0x2e5f61){return _0x5c1097[_0x7d47('0xc')](_0x2e5f61,_0x3edab6+0x1);}else{var _0xcb22fc=_0x5c1097[_0x7d47('0xc')](0x0,_0x3edab6+0x1);var _0x1029db=_0x5c1097['slice'](_0x2e5f61);return _0x1029db[_0x7d47('0xd')](_0xcb22fc);}}}module[_0x7d47('0xe')][_0x7d47('0x11')]=circularMonthInterval;function parseDom(_0x5333d1){var _0x3785c0=parseInt(_0x5333d1,0xa);if(_0x3785c0<0x1||_0x3785c0>0x1f){throw new Error(EINVALID_DATE);}return _0x3785c0;}function timeCompare(_0xe656f1,_0x16f372,_0x32b91b){var _0x15c191=_0xe656f1['clone']();var _0x5d10cd=extractTime(_0x16f372);var _0x4eb70c=_0x5d10cd[0x0];var _0x386fd7=_0x5d10cd[0x1];var _0x46acaa=_0xe656f1['clone']()[_0x7d47('0x12')](_0x4eb70c)['minutes'](_0x386fd7);throwIfDateNotValid(_0x46acaa);var _0x5dc1a3=extractTime(_0x32b91b);var _0x2c235a=_0x5dc1a3[0x0];var _0x26b664=_0x5dc1a3[0x1];var _0x520571=_0xe656f1[_0x7d47('0x13')]()[_0x7d47('0x12')](_0x2c235a)[_0x7d47('0x14')](_0x26b664);throwIfDateNotValid(_0x520571);if(_0x520571[_0x7d47('0x15')](_0x46acaa)){var _0xb848e6=_0x15c191[_0x7d47('0x13')]()[_0x7d47('0x16')]('day');var _0x3f4870=_0x15c191[_0x7d47('0x13')]()[_0x7d47('0x17')](_0x7d47('0x18'));return _0x15c191[_0x7d47('0x19')](_0x46acaa,_0x3f4870,undefined,'[]')||_0x15c191[_0x7d47('0x19')](_0xb848e6,_0x520571,undefined,'[]');}else{return _0x15c191[_0x7d47('0x19')](_0x46acaa,_0x520571,undefined,'[]');}}module[_0x7d47('0xe')]['timeCompare']=timeCompare;function dowCompare(_0x5924d6,_0x171b4e,_0x5342b9){var _0x38d676=_0x5924d6['locale']('en')[_0x7d47('0x1a')]('ddd')[_0x7d47('0xa')]();return circularDoWInterval(_0x171b4e,_0x5342b9)[_0x7d47('0x1b')](_0x38d676);}module[_0x7d47('0xe')][_0x7d47('0x1c')]=dowCompare;function domCompare(_0x2711bc,_0x49de60,_0x2a0a51){var _0x38d095=_0x2711bc['date']();if(_0x49de60===_0x2a0a51){return _0x38d095===_0x49de60;}else{var _0x485946=_0x2711bc[_0x7d47('0x1d')]();var _0x15e9ba=_0x49de60<_0x2a0a51;let _0x5d1abb=![];var _0x5f4b2d=0x0;var _0x21d957=0x0;if(_0x15e9ba){_0x5f4b2d=Math[_0x7d47('0x1e')](0x1,_0x49de60);_0x21d957=Math[_0x7d47('0x1f')](_0x2a0a51,_0x485946);_0x5d1abb=_0x38d095>=_0x5f4b2d&&_0x38d095<=_0x21d957;}else{_0x5f4b2d=Math[_0x7d47('0x1f')](_0x49de60,_0x485946);_0x21d957=Math['max'](0x1,_0x2a0a51);_0x5d1abb=_0x38d095>=_0x5f4b2d||_0x38d095<=_0x21d957;}return _0x5d1abb;}}module[_0x7d47('0xe')][_0x7d47('0x20')]=domCompare;function monthCompare(_0x246710,_0x4cbb04,_0x2833f1){var _0x1c5079=_0x246710[_0x7d47('0x8')]('en')[_0x7d47('0x1a')](_0x7d47('0x21'))[_0x7d47('0xa')]();return circularMonthInterval(_0x4cbb04,_0x2833f1)[_0x7d47('0x1b')](_0x1c5079);}module['exports'][_0x7d47('0x22')]=monthCompare;function iftime(_0x113f9a,_0x2f9f2c=moment['tz'][_0x7d47('0x23')](),_0x52c847=moment()){if(!validateRx[_0x7d47('0x24')](_0x113f9a)){throw new Error(EINVALID_STRING);}else{var _0x186b87=(moment[_0x7d47('0x25')](_0x52c847)?_0x52c847[_0x7d47('0x13')]():moment(_0x52c847))['tz'](_0x2f9f2c)[_0x7d47('0x8')]('en');throwIfDateNotValid(_0x186b87);var _0x2184a9=_0x113f9a['split'](',');var _0x37e781=_0x2184a9[0x0];var _0x25aca5=_0x2184a9[0x1];var _0x222fa5=_0x2184a9[0x2];var _0x24c06a=_0x2184a9[0x3];let _0x46cb4d=!![];if(_0x37e781!=='*'){var _0x1512da=_0x37e781[_0x7d47('0x7')]('-');var _0x5a1a48=_[_0x7d47('0x26')](_0x1512da[0x0],0x5,'0');var _0x758878=_0x1512da[_0x7d47('0x27')]===0x2?_['padStart'](_0x1512da[0x1],0x5,'0'):_0x5a1a48;_0x46cb4d=timeCompare(_0x186b87,_0x5a1a48,_0x758878);}let _0x34bced=!![];if(_0x25aca5!=='*'){var _0x4cb552=_0x25aca5[_0x7d47('0x7')]('-');var _0x118887=_0x4cb552[0x0];var _0x47d7f9=_0x4cb552['length']===0x2?_0x4cb552[0x1]:_0x118887;_0x34bced=dowCompare(_0x186b87,_0x118887,_0x47d7f9);}let _0x2bd1e1=!![];if(_0x222fa5!=='*'){var _0x545c25=_0x222fa5[_0x7d47('0x7')]('-');var _0x4fa365=parseDom(_0x545c25[0x0]);var _0x560115=_0x545c25[_0x7d47('0x27')]===0x2?parseDom(_0x545c25[0x1]):_0x4fa365;_0x2bd1e1=domCompare(_0x186b87,_0x4fa365,_0x560115);}let _0x53f019=!![];if(_0x24c06a!=='*'){var _0xbff7e3=_0x24c06a[_0x7d47('0x7')]('-');var _0xff294a=_0xbff7e3[0x0];var _0x3e4e7a=_0xbff7e3['length']===0x2?_0xbff7e3[0x1]:_0xbff7e3[0x0];_0x53f019=monthCompare(_0x186b87,_0xff294a,_0x3e4e7a);}return _0x46cb4d&&_0x34bced&&_0x2bd1e1&&_0x53f019;}}module['exports'][_0x7d47('0x28')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 769cb10..bffabe5 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf16a=['format','%s-%s.log','message','{{{','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','error','%s-%s','consoleLogger','path','util','moment','winston','debugLevel','info','redBG\x20white','red','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join'];(function(_0x1e1b5a,_0x13b534){var _0x3206db=function(_0x5d6c2f){while(--_0x5d6c2f){_0x1e1b5a['push'](_0x1e1b5a['shift']());}};_0x3206db(++_0x13b534);}(_0xf16a,0x1a6));var _0xaf16=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0xf16a[_0x305c31];return _0x17f39f;};'use strict';var path=require(_0xaf16('0x0'));var util=require(_0xaf16('0x1'));var moment=require(_0xaf16('0x2'));var winston=require(_0xaf16('0x3'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0xaf16('0x4')]['toLowerCase']():_0xaf16('0x5');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':_0xaf16('0x6'),'error':_0xaf16('0x7'),'warn':'bold\x20yellow','info':_0xaf16('0x8'),'print':_0xaf16('0x9'),'success':_0xaf16('0xa'),'http':_0xaf16('0xb'),'verbose':_0xaf16('0xc'),'debug':_0xaf16('0xd'),'silly':_0xaf16('0xe')};winston[_0xaf16('0xf')](XC_LOG_COLORS);function getLogFileName(_0x28a140,_0x4ecbd8,_0x38e2c0){var _0x21bbe4=_0x28a140||_0xaf16('0x10');return path[_0xaf16('0x11')](_0x21bbe4,util[_0xaf16('0x12')](_0xaf16('0x13'),_0x4ecbd8,_0x38e2c0));}function formatter(_0x442e4b,_0x1bbff9){_0x1bbff9[_0xaf16('0x14')]=_0x1bbff9[_0xaf16('0x14')]['replace'](/@@{/g,_0xaf16('0x15'))['replace'](/}@@/g,'}}}')[_0xaf16('0x16')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0xaf16('0x17'),moment()[_0xaf16('0x12')](_0xaf16('0x18')),_0x1bbff9[_0xaf16('0x19')][_0xaf16('0x1a')](),_0x442e4b,_0x1bbff9[_0xaf16('0x14')]);}function fileFormat(_0x3c84dc,_0x409357){_0x409357[_0xaf16('0x14')]=_0x409357[_0xaf16('0x14')][_0xaf16('0x16')](/@@{/g,_0xaf16('0x15'))[_0xaf16('0x16')](/}@@/g,'}}}')[_0xaf16('0x16')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0xbff232=_0x409357[_0xaf16('0x1b')]&&Object[_0xaf16('0x1c')](_0x409357[_0xaf16('0x1b')])[_0xaf16('0x1d')]?'\x0a\x09'+JSON[_0xaf16('0x1e')](_0x409357[_0xaf16('0x1b')]):'';return util[_0xaf16('0x12')](_0xaf16('0x1f'),moment()[_0xaf16('0x12')](_0xaf16('0x18')),_0x409357[_0xaf16('0x19')][_0xaf16('0x1a')](),_0x3c84dc,_0x409357[_0xaf16('0x14')],_0xbff232);}function consoleLogger(){var _0x5dd045=new winston[(_0xaf16('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xaf16('0x21'))][(_0xaf16('0x22'))]({'level':_0xaf16('0x23'),'json':![],'formatter':function(_0x1784f6){return formatter('',_0x1784f6);}})]});return _0x5dd045;}function fileLogger(_0x58933b,_0x1a2f08){var _0x2027c3=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xaf16('0x21'))][(_0xaf16('0x24'))]({'name':util[_0xaf16('0x12')]('%s-%s',_0x58933b,_0xaf16('0x25')),'filename':getLogFileName(_0x1a2f08,_0x58933b,_0xaf16('0x25')),'level':_0xaf16('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xda3110){return fileFormat(_0x58933b,_0xda3110);}}),new winston[(_0xaf16('0x21'))][(_0xaf16('0x24'))]({'name':util[_0xaf16('0x12')](_0xaf16('0x26'),_0x58933b,debugLevel),'filename':getLogFileName(_0x1a2f08,_0x58933b,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x82f5d5){return fileFormat(_0x58933b,_0x82f5d5);}}),new winston['transports']['Console']({'level':_0xaf16('0x23'),'json':![],'formatter':function(_0x40d38f){return fileFormat(_0x58933b,_0x40d38f);}})]});return _0x2027c3;}exports[_0xaf16('0x27')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xc2c2=['winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','gray','bold\x20magenta','bold\x20cyan','/var/log/xcally','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','Console','warn','transports','File','error','%s-%s','consoleLogger','path','util','moment'];(function(_0x277768,_0x1f9064){var _0x4ad144=function(_0x310011){while(--_0x310011){_0x277768['push'](_0x277768['shift']());}};_0x4ad144(++_0x1f9064);}(_0xc2c2,0x141));var _0x2c2c=function(_0x3ab9f1,_0x85c28b){_0x3ab9f1=_0x3ab9f1-0x0;var _0x49ed43=_0xc2c2[_0x3ab9f1];return _0x49ed43;};'use strict';var path=require(_0x2c2c('0x0'));var util=require(_0x2c2c('0x1'));var moment=require(_0x2c2c('0x2'));var winston=require(_0x2c2c('0x3'));var config=require('../config/environment');var debugLevel=config[_0x2c2c('0x4')]?config[_0x2c2c('0x4')][_0x2c2c('0x5')]():_0x2c2c('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x2c2c('0x7'),'error':_0x2c2c('0x8'),'warn':_0x2c2c('0x9'),'info':_0x2c2c('0xa'),'print':_0x2c2c('0xb'),'success':'bold\x20green','http':_0x2c2c('0xc'),'verbose':_0x2c2c('0xd'),'debug':'bold\x20blue','silly':_0x2c2c('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x30d475,_0x2c6ef0,_0x2b89fe){var _0x24d061=_0x30d475||_0x2c2c('0xf');return path['join'](_0x24d061,util['format']('%s-%s.log',_0x2c6ef0,_0x2b89fe));}function formatter(_0x10ecfc,_0x305f22){_0x305f22[_0x2c2c('0x10')]=_0x305f22[_0x2c2c('0x10')][_0x2c2c('0x11')](/@@{/g,_0x2c2c('0x12'))[_0x2c2c('0x11')](/}@@/g,_0x2c2c('0x13'))[_0x2c2c('0x11')](/@{/g,'{{')[_0x2c2c('0x11')](/}@/g,'}}');return util[_0x2c2c('0x14')](_0x2c2c('0x15'),moment()[_0x2c2c('0x14')](_0x2c2c('0x16')),_0x305f22['level']['toUpperCase'](),_0x10ecfc,_0x305f22[_0x2c2c('0x10')]);}function fileFormat(_0x10330d,_0x3f0887){_0x3f0887[_0x2c2c('0x10')]=_0x3f0887[_0x2c2c('0x10')][_0x2c2c('0x11')](/@@{/g,_0x2c2c('0x12'))['replace'](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x126241=_0x3f0887[_0x2c2c('0x17')]&&Object[_0x2c2c('0x18')](_0x3f0887[_0x2c2c('0x17')])[_0x2c2c('0x19')]?'\x0a\x09'+JSON[_0x2c2c('0x1a')](_0x3f0887[_0x2c2c('0x17')]):'';return util['format'](_0x2c2c('0x1b'),moment()[_0x2c2c('0x14')](_0x2c2c('0x16')),_0x3f0887['level']['toUpperCase'](),_0x10330d,_0x3f0887['message'],_0x126241);}function consoleLogger(){var _0x38b885=new winston[(_0x2c2c('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x2c2c('0x1d'))]({'level':_0x2c2c('0x1e'),'json':![],'formatter':function(_0x114334){return formatter('',_0x114334);}})]});return _0x38b885;}function fileLogger(_0x3e8773,_0x3915fe){var _0x4105cb=new winston[(_0x2c2c('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2c2c('0x1f'))][(_0x2c2c('0x20'))]({'name':util[_0x2c2c('0x14')]('%s-%s',_0x3e8773,_0x2c2c('0x21')),'filename':getLogFileName(_0x3915fe,_0x3e8773,_0x2c2c('0x21')),'level':_0x2c2c('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5b94d4){return fileFormat(_0x3e8773,_0x5b94d4);}}),new winston['transports'][(_0x2c2c('0x20'))]({'name':util['format'](_0x2c2c('0x22'),_0x3e8773,debugLevel),'filename':getLogFileName(_0x3915fe,_0x3e8773,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x207008){return fileFormat(_0x3e8773,_0x207008);}}),new winston['transports']['Console']({'level':_0x2c2c('0x1e'),'json':![],'formatter':function(_0x7c81f3){return fileFormat(_0x3e8773,_0x7c81f3);}})]});return _0x4105cb;}exports[_0x2c2c('0x23')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index a0f737d..caae7f6 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['consumerSecret','membername','calleridname','exten','privateKey','secretaccesskey','user','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','lastName','street','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','consumerKey'];(function(_0x4613e1,_0x425216){var _0x333607=function(_0x446694){while(--_0x446694){_0x4613e1['push'](_0x4613e1['shift']());}};_0x333607(++_0x425216);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};var _=require('lodash');var sensitiveFields=[_0x65f6('0x0'),'password',_0x65f6('0x1'),_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'phone',_0x65f6('0x6'),'fax',_0x65f6('0x7'),_0x65f6('0x8'),'clientSecret','securityToken',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'accessTokenSecret','authToken',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12'),'calleridnum',_0x65f6('0x13'),'vidaooApiKey','clientEmail',_0x65f6('0x14'),'accesskeyid',_0x65f6('0x15'),'key',_0x65f6('0x16'),_0x65f6('0x17'),_0x65f6('0x18'),_0x65f6('0x19'),_0x65f6('0x1a'),_0x65f6('0x1b'),_0x65f6('0x1c'),_0x65f6('0x1d')];function maskSensitiveData(_0x46dbc6){const _0x3440af=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x46dbc6)){for(const _0x19b9ff in _0x46dbc6){if(_['isArray'](_0x46dbc6[_0x19b9ff])){for(let _0x5dd324=0x0;_0x5dd324<_0x46dbc6[_0x19b9ff][_0x65f6('0x1e')];_0x5dd324++){maskSensitiveData(_0x46dbc6[_0x19b9ff][_0x5dd324]);}}else if(_[_0x65f6('0x1f')](_0x46dbc6[_0x19b9ff])){maskSensitiveData(_0x46dbc6[_0x19b9ff]);}else if(_[_0x65f6('0x20')](_0x46dbc6[_0x19b9ff])){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](/{{{/g,_0x65f6('0x22'))[_0x65f6('0x21')](/}}}/g,_0x65f6('0x23'))[_0x65f6('0x21')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x19b9ff)){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](_0x3440af,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x2cd061,_0x3fde39){var _0xee1f5f=function(_0x553c16){while(--_0x553c16){_0x2cd061['push'](_0x2cd061['shift']());}};_0xee1f5f(++_0x3fde39);}(_0x2ef3,0xba));var _0x32ef=function(_0xa97bbf,_0x3c844c){_0xa97bbf=_0xa97bbf-0x0;var _0x211fa2=_0x2ef3[_0xa97bbf];return _0x211fa2;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 5135396..a83dde6 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 _0xef0f=['lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','isPlainObject','keys','reduce','safeTemplate'];(function(_0x45db61,_0x19e3d9){var _0x3c875c=function(_0x3c472d){while(--_0x3c472d){_0x45db61['push'](_0x45db61['shift']());}};_0x3c875c(++_0x19e3d9);}(_0xef0f,0x168));var _0xfef0=function(_0x38e5ac,_0xbffa11){_0x38e5ac=_0x38e5ac-0x0;var _0xb886c8=_0xef0f[_0x38e5ac];return _0xb886c8;};var _=require(_0xfef0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x581303){return _0x581303==='{{'?_0xfef0('0x1'):_0xfef0('0x2');}function safeTemplate(_0x19f865){var _0x4d29e5=_0x19f865;if(typeof _0x19f865===_0xfef0('0x3')){_0x4d29e5=_0x19f865[_0xfef0('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfef0('0x5')](_0x19f865)){_0x4d29e5=_0x19f865['map'](function(_0x2a6fcf){return safeTemplate(_0x2a6fcf);});}else if(_[_0xfef0('0x6')](_0x19f865)){_0x4d29e5=Object[_0xfef0('0x7')](_0x19f865)[_0xfef0('0x8')](function(_0xad43e,_0x11dfd7){_0xad43e[_0x11dfd7]=safeTemplate(_0x19f865[_0x11dfd7]);return _0xad43e;},{});}return _0x4d29e5;}module['exports'][_0xfef0('0x9')]=safeTemplate; \ No newline at end of file +var _0x5c00=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','string'];(function(_0x5176bf,_0x1f78c3){var _0x515ad3=function(_0x42f089){while(--_0x42f089){_0x5176bf['push'](_0x5176bf['shift']());}};_0x515ad3(++_0x1f78c3);}(_0x5c00,0x17e));var _0x05c0=function(_0x502a32,_0x23d261){_0x502a32=_0x502a32-0x0;var _0x30191c=_0x5c00[_0x502a32];return _0x30191c;};var _=require(_0x05c0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x7f1364){return _0x7f1364==='{{'?_0x05c0('0x1'):'\x20}\x20}';}function safeTemplate(_0x1e76da){var _0x5859bc=_0x1e76da;if(typeof _0x1e76da===_0x05c0('0x2')){_0x5859bc=_0x1e76da[_0x05c0('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x05c0('0x4')](_0x1e76da)){_0x5859bc=_0x1e76da[_0x05c0('0x5')](function(_0x565efc){return safeTemplate(_0x565efc);});}else if(_[_0x05c0('0x6')](_0x1e76da)){_0x5859bc=Object[_0x05c0('0x7')](_0x1e76da)[_0x05c0('0x8')](function(_0x27dc10,_0x5b9f09){_0x27dc10[_0x5b9f09]=safeTemplate(_0x1e76da[_0x5b9f09]);return _0x27dc10;},{});}return _0x5859bc;}module[_0x05c0('0x9')][_0x05c0('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 3c1e671..c100111 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 _0x571f=['isArray','apps','findIndex','name','env','string','NODE_PATH','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','../config/environment','root','resolve','server/app.json'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0x571f,0x19f));var _0xf571=function(_0x2ecc65,_0xd75c48){_0x2ecc65=_0x2ecc65-0x0;var _0x103cc3=_0x571f[_0x2ecc65];return _0x103cc3;};var fs=require(_0xf571('0x0'));var path=require('path');var config=require(_0xf571('0x1'));var root=config[_0xf571('0x2')];var APP_JSON_PATH=path[_0xf571('0x3')](root,_0xf571('0x4'));var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x418524){let _0x293af7=![];if(Array[_0xf571('0x5')](_0x418524[_0xf571('0x6')])){var _0x25610b=_0x418524[_0xf571('0x6')][_0xf571('0x7')](function(_0x26afbb){return _0x26afbb[_0xf571('0x8')]==='motion2';});if(_0x25610b>-0x1){var _0x1c81cc=_0x418524[_0xf571('0x6')][_0x25610b];if(typeof _0x1c81cc[_0xf571('0x9')]['NODE_PATH']!==_0xf571('0xa')){_0x1c81cc['env'][_0xf571('0xb')]=NODEPATH;_0x293af7=!![];}}return{'appConfig':_0x418524,'updated':_0x293af7};}}function updateAppConfig(_0x11adaa){return fs[_0xf571('0xc')](APP_JSON_PATH)[_0xf571('0xd')](function(_0x3560ef){if(_0x3560ef){return fs[_0xf571('0xe')](APP_JSON_PATH)[_0xf571('0xd')](function(_0x202847){var _0x2d37c2=setLegacyLibsNodeEnvPath(_0x202847);if(_0x2d37c2[_0xf571('0xf')]){_0x11adaa[_0xf571('0x10')](_0xf571('0x11'));return fs[_0xf571('0x12')](APP_JSON_PATH,_0x202847,{'spaces':0x2});}else{return Promise[_0xf571('0x3')]();}});}else{return Promise[_0xf571('0x3')]();}});}module[_0xf571('0x13')]=updateAppConfig; \ No newline at end of file +var _0x9447=['then','info','Updating\x20app.json','exports','fs-extra','path','../config/environment','root','server/app.json','resolve','legacy-libs','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','readJSON'];(function(_0x5e524e,_0x3804ad){var _0x59b93e=function(_0x1aae3e){while(--_0x1aae3e){_0x5e524e['push'](_0x5e524e['shift']());}};_0x59b93e(++_0x3804ad);}(_0x9447,0x68));var _0x7944=function(_0x27e075,_0x3f8c87){_0x27e075=_0x27e075-0x0;var _0x295859=_0x9447[_0x27e075];return _0x295859;};var fs=require(_0x7944('0x0'));var path=require(_0x7944('0x1'));var config=require(_0x7944('0x2'));var root=config[_0x7944('0x3')];var APP_JSON_PATH=path['resolve'](root,_0x7944('0x4'));var NODEPATH=path[_0x7944('0x5')](root,_0x7944('0x6'));function setLegacyLibsNodeEnvPath(_0x44e290){let _0x20b848=![];if(Array['isArray'](_0x44e290[_0x7944('0x7')])){var _0x181f57=_0x44e290[_0x7944('0x7')][_0x7944('0x8')](function(_0x5b785a){return _0x5b785a[_0x7944('0x9')]===_0x7944('0xa');});if(_0x181f57>-0x1){var _0x51a8c4=_0x44e290[_0x7944('0x7')][_0x181f57];if(typeof _0x51a8c4[_0x7944('0xb')][_0x7944('0xc')]!==_0x7944('0xd')){_0x51a8c4[_0x7944('0xb')]['NODE_PATH']=NODEPATH;_0x20b848=!![];}}return{'appConfig':_0x44e290,'updated':_0x20b848};}}function updateAppConfig(_0x151583){return fs[_0x7944('0xe')](APP_JSON_PATH)['then'](function(_0x245c16){if(_0x245c16){return fs[_0x7944('0xf')](APP_JSON_PATH)[_0x7944('0x10')](function(_0x1c0a3b){var _0x5d8947=setLegacyLibsNodeEnvPath(_0x1c0a3b);if(_0x5d8947['updated']){_0x151583[_0x7944('0x11')](_0x7944('0x12'));return fs['writeJSON'](APP_JSON_PATH,_0x1c0a3b,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x7944('0x5')]();}});}module[_0x7944('0x13')]=updateAppConfig; \ No newline at end of file